diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..43d4c4c Binary files /dev/null and b/.DS_Store differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..25c9786 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM public.ecr.aws/lambda/python:3.11 + +# Copy requirements.txt +COPY requirements.txt ${LAMBDA_TASK_ROOT} + +# Copy function code +COPY lambda_function.py ${LAMBDA_TASK_ROOT} + +# Install the specified packages +RUN pip install -r requirements.txt + +# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile) +CMD [ "lambda_function.handler" ] diff --git a/billinglayer/.DS_Store b/billinglayer/.DS_Store new file mode 100644 index 0000000..5117ba3 Binary files /dev/null and b/billinglayer/.DS_Store differ diff --git a/billinglayer/billing.zip b/billinglayer/billing.zip new file mode 100644 index 0000000..878a861 Binary files /dev/null and b/billinglayer/billing.zip differ diff --git a/billinglayer/python/.DS_Store b/billinglayer/python/.DS_Store new file mode 100644 index 0000000..5cc52ef Binary files /dev/null and b/billinglayer/python/.DS_Store differ diff --git a/billinglayer/python/_cffi_backend.cpython-311-x86_64-linux-gnu.so b/billinglayer/python/_cffi_backend.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..0ccaa84 Binary files /dev/null and b/billinglayer/python/_cffi_backend.cpython-311-x86_64-linux-gnu.so differ diff --git a/billinglayer/python/bin/__pycache__/vba_extract.cpython-311.pyc b/billinglayer/python/bin/__pycache__/vba_extract.cpython-311.pyc new file mode 100644 index 0000000..a0f92ad Binary files /dev/null and b/billinglayer/python/bin/__pycache__/vba_extract.cpython-311.pyc differ diff --git a/billinglayer/python/bin/f2py b/billinglayer/python/bin/f2py new file mode 100755 index 0000000..8133eea --- /dev/null +++ b/billinglayer/python/bin/f2py @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/billinglayer/python/bin/f2py3 b/billinglayer/python/bin/f2py3 new file mode 100755 index 0000000..8133eea --- /dev/null +++ b/billinglayer/python/bin/f2py3 @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/billinglayer/python/bin/f2py3.11 b/billinglayer/python/bin/f2py3.11 new file mode 100755 index 0000000..8133eea --- /dev/null +++ b/billinglayer/python/bin/f2py3.11 @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/billinglayer/python/bin/normalizer b/billinglayer/python/bin/normalizer new file mode 100755 index 0000000..f51dc01 --- /dev/null +++ b/billinglayer/python/bin/normalizer @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli.normalizer import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/billinglayer/python/bin/vba_extract.py b/billinglayer/python/bin/vba_extract.py new file mode 100755 index 0000000..e4c6848 --- /dev/null +++ b/billinglayer/python/bin/vba_extract.py @@ -0,0 +1,65 @@ +#!/var/lang/bin/python3.11 + +############################################################################## +# +# vba_extract - A simple utility to extract a vbaProject.bin binary from an +# Excel 2007+ xlsm file for insertion into an XlsxWriter file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import sys +from zipfile import ZipFile +from zipfile import BadZipFile + +# The VBA project file we want to extract. +vba_filename = "vbaProject.bin" + +# Get the xlsm file name from the commandline. +if len(sys.argv) > 1: + xlsm_file = sys.argv[1] +else: + print( + "\nUtility to extract a vbaProject.bin binary from an Excel 2007+ " + "xlsm macro file for insertion into an XlsxWriter file." + "\n" + "See: https://xlsxwriter.readthedocs.io/working_with_macros.html\n" + "\n" + "Usage: vba_extract file.xlsm\n" + ) + exit() + +try: + # Open the Excel xlsm file as a zip file. + xlsm_zip = ZipFile(xlsm_file, "r") + + # Read the xl/vbaProject.bin file. + vba_data = xlsm_zip.read("xl/" + vba_filename) + + # Write the vba data to a local file. + vba_file = open(vba_filename, "wb") + vba_file.write(vba_data) + vba_file.close() + +except IOError as e: + print("File error: %s" % str(e)) + exit() + +except KeyError as e: + # Usually when there isn't a xl/vbaProject.bin member in the file. + print("File error: %s" % str(e)) + print("File may not be an Excel xlsm macro file: '%s'" % xlsm_file) + exit() + +except BadZipFile as e: + # Usually if the file is an xls file and not an xlsm file. + print("File error: %s: '%s'" % (str(e), xlsm_file)) + print("File may not be an Excel xlsm macro file.") + exit() + +except Exception as e: + # Catch any other exceptions. + print("File error: %s" % str(e)) + exit() + +print("Extracted: %s" % vba_filename) diff --git a/billinglayer/python/certifi-2023.7.22.dist-info/INSTALLER b/billinglayer/python/certifi-2023.7.22.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/certifi-2023.7.22.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/certifi-2023.7.22.dist-info/LICENSE b/billinglayer/python/certifi-2023.7.22.dist-info/LICENSE new file mode 100644 index 0000000..0a64774 --- /dev/null +++ b/billinglayer/python/certifi-2023.7.22.dist-info/LICENSE @@ -0,0 +1,21 @@ +This package contains a modified version of ca-bundle.crt: + +ca-bundle.crt -- Bundle of CA Root Certificates + +Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011# +This is a bundle of X.509 certificates of public Certificate Authorities +(CA). These were automatically extracted from Mozilla's root certificates +file (certdata.txt). This file can be found in the mozilla source tree: +https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt +It contains the certificates in PEM format and therefore +can be directly used with curl / libcurl / php_curl, or with +an Apache+mod_ssl webserver for SSL client authentication. +Just configure this file as the SSLCACertificateFile.# + +***** BEGIN LICENSE BLOCK ***** +This Source Code Form is subject to the terms of the Mozilla Public License, +v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain +one at http://mozilla.org/MPL/2.0/. + +***** END LICENSE BLOCK ***** +@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ diff --git a/billinglayer/python/certifi-2023.7.22.dist-info/METADATA b/billinglayer/python/certifi-2023.7.22.dist-info/METADATA new file mode 100644 index 0000000..07f4991 --- /dev/null +++ b/billinglayer/python/certifi-2023.7.22.dist-info/METADATA @@ -0,0 +1,69 @@ +Metadata-Version: 2.1 +Name: certifi +Version: 2023.7.22 +Summary: Python package for providing Mozilla's CA Bundle. +Home-page: https://github.com/certifi/python-certifi +Author: Kenneth Reitz +Author-email: me@kennethreitz.com +License: MPL-2.0 +Project-URL: Source, https://github.com/certifi/python-certifi +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) +Classifier: Natural Language :: English +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Requires-Python: >=3.6 +License-File: LICENSE + +Certifi: Python SSL Certificates +================================ + +Certifi provides Mozilla's carefully curated collection of Root Certificates for +validating the trustworthiness of SSL certificates while verifying the identity +of TLS hosts. It has been extracted from the `Requests`_ project. + +Installation +------------ + +``certifi`` is available on PyPI. Simply install it with ``pip``:: + + $ pip install certifi + +Usage +----- + +To reference the installed certificate authority (CA) bundle, you can use the +built-in function:: + + >>> import certifi + + >>> certifi.where() + '/usr/local/lib/python3.7/site-packages/certifi/cacert.pem' + +Or from the command line:: + + $ python -m certifi + /usr/local/lib/python3.7/site-packages/certifi/cacert.pem + +Enjoy! + +.. _`Requests`: https://requests.readthedocs.io/en/master/ + +Addition/Removal of Certificates +-------------------------------- + +Certifi does not support any addition/removal or other modification of the +CA trust store content. This project is intended to provide a reliable and +highly portable root of trust to python deployments. Look to upstream projects +for methods to use alternate trust. + + diff --git a/billinglayer/python/certifi-2023.7.22.dist-info/RECORD b/billinglayer/python/certifi-2023.7.22.dist-info/RECORD new file mode 100644 index 0000000..aabc30c --- /dev/null +++ b/billinglayer/python/certifi-2023.7.22.dist-info/RECORD @@ -0,0 +1,14 @@ +certifi-2023.7.22.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +certifi-2023.7.22.dist-info/LICENSE,sha256=oC9sY4-fuE0G93ZMOrCF2K9-2luTwWbaVDEkeQd8b7A,1052 +certifi-2023.7.22.dist-info/METADATA,sha256=oyc8gd32SOVo0IGolt8-bR7FnZ9Z99GoHoGE6ACcvFA,2191 +certifi-2023.7.22.dist-info/RECORD,, +certifi-2023.7.22.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 +certifi-2023.7.22.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8 +certifi/__init__.py,sha256=L_j-d0kYuA_MzA2_2hraF1ovf6KT6DTquRdV3paQwOk,94 +certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243 +certifi/__pycache__/__init__.cpython-311.pyc,, +certifi/__pycache__/__main__.cpython-311.pyc,, +certifi/__pycache__/core.cpython-311.pyc,, +certifi/cacert.pem,sha256=eU0Dn_3yd8BH4m8sfVj4Glhl2KDrcCSg-sEWT-pNJ88,281617 +certifi/core.py,sha256=lhewz0zFb2b4ULsQurElmloYwQoecjWzPqY67P8T7iM,4219 +certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/billinglayer/python/certifi-2023.7.22.dist-info/WHEEL b/billinglayer/python/certifi-2023.7.22.dist-info/WHEEL new file mode 100644 index 0000000..5bad85f --- /dev/null +++ b/billinglayer/python/certifi-2023.7.22.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/billinglayer/python/certifi-2023.7.22.dist-info/top_level.txt b/billinglayer/python/certifi-2023.7.22.dist-info/top_level.txt new file mode 100644 index 0000000..963eac5 --- /dev/null +++ b/billinglayer/python/certifi-2023.7.22.dist-info/top_level.txt @@ -0,0 +1 @@ +certifi diff --git a/billinglayer/python/certifi/__init__.py b/billinglayer/python/certifi/__init__.py new file mode 100644 index 0000000..8ce89ce --- /dev/null +++ b/billinglayer/python/certifi/__init__.py @@ -0,0 +1,4 @@ +from .core import contents, where + +__all__ = ["contents", "where"] +__version__ = "2023.07.22" diff --git a/billinglayer/python/certifi/__main__.py b/billinglayer/python/certifi/__main__.py new file mode 100644 index 0000000..8945b5d --- /dev/null +++ b/billinglayer/python/certifi/__main__.py @@ -0,0 +1,12 @@ +import argparse + +from certifi import contents, where + +parser = argparse.ArgumentParser() +parser.add_argument("-c", "--contents", action="store_true") +args = parser.parse_args() + +if args.contents: + print(contents()) +else: + print(where()) diff --git a/billinglayer/python/certifi/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/certifi/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..5f757ec Binary files /dev/null and b/billinglayer/python/certifi/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/certifi/__pycache__/__main__.cpython-311.pyc b/billinglayer/python/certifi/__pycache__/__main__.cpython-311.pyc new file mode 100644 index 0000000..08f8bd2 Binary files /dev/null and b/billinglayer/python/certifi/__pycache__/__main__.cpython-311.pyc differ diff --git a/billinglayer/python/certifi/__pycache__/core.cpython-311.pyc b/billinglayer/python/certifi/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..5beb895 Binary files /dev/null and b/billinglayer/python/certifi/__pycache__/core.cpython-311.pyc differ diff --git a/billinglayer/python/certifi/cacert.pem b/billinglayer/python/certifi/cacert.pem new file mode 100644 index 0000000..0212369 --- /dev/null +++ b/billinglayer/python/certifi/cacert.pem @@ -0,0 +1,4635 @@ + +# Issuer: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA +# Subject: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA +# Label: "GlobalSign Root CA" +# Serial: 4835703278459707669005204 +# MD5 Fingerprint: 3e:45:52:15:09:51:92:e1:b7:5d:37:9f:b1:87:29:8a +# SHA1 Fingerprint: b1:bc:96:8b:d4:f4:9d:62:2a:a8:9a:81:f2:15:01:52:a4:1d:82:9c +# SHA256 Fingerprint: eb:d4:10:40:e4:bb:3e:c7:42:c9:e3:81:d3:1e:f2:a4:1a:48:b6:68:5c:96:e7:ce:f3:c1:df:6c:d4:33:1c:99 +-----BEGIN CERTIFICATE----- +MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG +A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv +b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw +MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i +YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT +aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ +jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp +xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp +1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG +snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ +U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 +9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E +BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B +AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz +yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE +38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP +AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad +DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME +HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== +-----END CERTIFICATE----- + +# Issuer: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited +# Subject: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited +# Label: "Entrust.net Premium 2048 Secure Server CA" +# Serial: 946069240 +# MD5 Fingerprint: ee:29:31:bc:32:7e:9a:e6:e8:b5:f7:51:b4:34:71:90 +# SHA1 Fingerprint: 50:30:06:09:1d:97:d4:f5:ae:39:f7:cb:e7:92:7d:7d:65:2d:34:31 +# SHA256 Fingerprint: 6d:c4:71:72:e0:1c:bc:b0:bf:62:58:0d:89:5f:e2:b8:ac:9a:d4:f8:73:80:1e:0c:10:b9:c8:37:d2:1e:b1:77 +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 +MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq +K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe +sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX +MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT +XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ +HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH +4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub +j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo +U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf +zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b +u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ +bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er +fF6adulZkMV8gzURZVE= +-----END CERTIFICATE----- + +# Issuer: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust +# Subject: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust +# Label: "Baltimore CyberTrust Root" +# Serial: 33554617 +# MD5 Fingerprint: ac:b6:94:a5:9c:17:e0:d7:91:52:9b:b1:97:06:a6:e4 +# SHA1 Fingerprint: d4:de:20:d0:5e:66:fc:53:fe:1a:50:88:2c:78:db:28:52:ca:e4:74 +# SHA256 Fingerprint: 16:af:57:a9:f6:76:b0:ab:12:60:95:aa:5e:ba:de:f2:2a:b3:11:19:d6:44:ac:95:cd:4b:93:db:f3:f2:6a:eb +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ +RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD +VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX +DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y +ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy +VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr +mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr +IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK +mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu +XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy +dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye +jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 +BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 +DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 +9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx +jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 +Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz +ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS +R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. +# Subject: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. +# Label: "Entrust Root Certification Authority" +# Serial: 1164660820 +# MD5 Fingerprint: d6:a5:c3:ed:5d:dd:3e:00:c1:3d:87:92:1f:1d:3f:e4 +# SHA1 Fingerprint: b3:1e:b1:b7:40:e3:6c:84:02:da:dc:37:d4:4d:f5:d4:67:49:52:f9 +# SHA256 Fingerprint: 73:c1:76:43:4f:1b:c6:d5:ad:f4:5b:0e:76:e7:27:28:7c:8d:e5:76:16:c1:e6:e6:14:1a:2b:2c:bc:7d:8e:4c +-----BEGIN CERTIFICATE----- +MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 +Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW +KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl +cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw +NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw +NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy +ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV +BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo +Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 +4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 +KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI +rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi +94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB +sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi +gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo +kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE +vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA +A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t +O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua +AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP +9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ +eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m +0vdXcDazv/wor3ElhVsT/h5/WrQ8 +-----END CERTIFICATE----- + +# Issuer: CN=AAA Certificate Services O=Comodo CA Limited +# Subject: CN=AAA Certificate Services O=Comodo CA Limited +# Label: "Comodo AAA Services root" +# Serial: 1 +# MD5 Fingerprint: 49:79:04:b0:eb:87:19:ac:47:b0:bc:11:51:9b:74:d0 +# SHA1 Fingerprint: d1:eb:23:a4:6d:17:d6:8f:d9:25:64:c2:f1:f1:60:17:64:d8:e3:49 +# SHA256 Fingerprint: d7:a7:a0:fb:5d:7e:27:31:d7:71:e9:48:4e:bc:de:f7:1d:5f:0c:3e:0a:29:48:78:2b:c8:3e:e0:ea:69:9e:f4 +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj +YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM +GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua +BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe +3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 +YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR +rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm +ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU +oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v +QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t +b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF +AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q +GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz +Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 +G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi +l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 +smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 2 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 2 O=QuoVadis Limited +# Label: "QuoVadis Root CA 2" +# Serial: 1289 +# MD5 Fingerprint: 5e:39:7b:dd:f8:ba:ec:82:e9:ac:62:ba:0c:54:00:2b +# SHA1 Fingerprint: ca:3a:fb:cf:12:40:36:4b:44:b2:16:20:88:80:48:39:19:93:7c:f7 +# SHA256 Fingerprint: 85:a0:dd:7d:d7:20:ad:b7:ff:05:f8:3d:54:2b:20:9d:c7:ff:45:28:f7:d6:77:b1:83:89:fe:a5:e5:c4:9e:86 +-----BEGIN CERTIFICATE----- +MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa +GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg +Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J +WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB +rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp ++ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 +ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i +Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz +PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og +/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH +oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI +yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud +EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 +A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL +MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT +ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f +BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn +g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl +fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K +WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha +B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc +hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR +TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD +mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z +ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y +4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza +8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 3" +# Serial: 1478 +# MD5 Fingerprint: 31:85:3c:62:94:97:63:b9:aa:fd:89:4e:af:6f:e0:cf +# SHA1 Fingerprint: 1f:49:14:f7:d8:74:95:1d:dd:ae:02:c0:be:fd:3a:2d:82:75:51:85 +# SHA256 Fingerprint: 18:f1:fc:7f:20:5d:f8:ad:dd:eb:7f:e0:07:dd:57:e3:af:37:5a:9c:4d:8d:73:54:6b:f4:f1:fe:d1:e1:8d:35 +-----BEGIN CERTIFICATE----- +MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM +V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB +4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr +H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd +8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv +vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT +mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe +btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc +T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt +WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ +c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A +4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD +VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG +CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 +aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 +aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu +dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw +czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G +A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC +TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg +Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 +7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem +d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd ++LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B +4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN +t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x +DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 +k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s +zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j +Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT +mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK +4SVhM7JZG+Ju1zdXtg2pEto= +-----END CERTIFICATE----- + +# Issuer: O=SECOM Trust.net OU=Security Communication RootCA1 +# Subject: O=SECOM Trust.net OU=Security Communication RootCA1 +# Label: "Security Communication Root CA" +# Serial: 0 +# MD5 Fingerprint: f1:bc:63:6a:54:e0:b5:27:f5:cd:e7:1a:e3:4d:6e:4a +# SHA1 Fingerprint: 36:b1:2b:49:f9:81:9e:d7:4c:9e:bc:38:0f:c6:56:8f:5d:ac:b2:f7 +# SHA256 Fingerprint: e7:5e:72:ed:9f:56:0e:ec:6e:b4:80:00:73:a4:3f:c3:ad:19:19:5a:39:22:82:01:78:95:97:4a:99:02:6b:6c +-----BEGIN CERTIFICATE----- +MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY +MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t +dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 +WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD +VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 +9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ +DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 +Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N +QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ +xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G +A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG +kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr +Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 +Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU +JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot +RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== +-----END CERTIFICATE----- + +# Issuer: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com +# Subject: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com +# Label: "XRamp Global CA Root" +# Serial: 107108908803651509692980124233745014957 +# MD5 Fingerprint: a1:0b:44:b3:ca:10:d8:00:6e:9d:0f:d8:0f:92:0a:d1 +# SHA1 Fingerprint: b8:01:86:d1:eb:9c:86:a5:41:04:cf:30:54:f3:4c:52:b7:e5:58:c6 +# SHA256 Fingerprint: ce:cd:dc:90:50:99:d8:da:df:c5:b1:d2:09:b7:37:cb:e2:c1:8c:fb:2c:10:c0:ff:0b:cf:0d:32:86:fc:1a:a2 +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB +gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk +MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY +UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx +NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 +dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy +dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 +38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP +KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q +DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 +qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa +JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi +PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P +BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs +jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 +eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD +ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR +vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt +qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa +IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy +i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ +O+7ETPTsJ3xCwnR8gooJybQDJbw= +-----END CERTIFICATE----- + +# Issuer: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority +# Subject: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority +# Label: "Go Daddy Class 2 CA" +# Serial: 0 +# MD5 Fingerprint: 91:de:06:25:ab:da:fd:32:17:0c:bb:25:17:2a:84:67 +# SHA1 Fingerprint: 27:96:ba:e6:3f:18:01:e2:77:26:1b:a0:d7:77:70:02:8f:20:ee:e4 +# SHA256 Fingerprint: c3:84:6b:f2:4b:9e:93:ca:64:27:4c:0e:c6:7c:1e:cc:5e:02:4f:fc:ac:d2:d7:40:19:35:0e:81:fe:54:6a:e4 +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh +MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE +YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 +MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo +ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg +MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN +ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA +PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w +wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi +EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY +avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ +YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE +sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h +/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 +IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD +ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy +OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P +TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER +dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf +ReYNnyicsbkqWletNw+vHX/bvZ8= +-----END CERTIFICATE----- + +# Issuer: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority +# Subject: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority +# Label: "Starfield Class 2 CA" +# Serial: 0 +# MD5 Fingerprint: 32:4a:4b:bb:c8:63:69:9b:be:74:9a:c6:dd:1d:46:24 +# SHA1 Fingerprint: ad:7e:1c:28:b0:64:ef:8f:60:03:40:20:14:c3:d0:e3:37:0e:b5:8a +# SHA256 Fingerprint: 14:65:fa:20:53:97:b8:76:fa:a6:f0:a9:95:8e:55:90:e4:0f:cc:7f:aa:4f:b7:c2:c8:67:75:21:fb:5f:b6:58 +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl +MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp +U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw +NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE +ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp +ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 +DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf +8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN ++lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 +X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa +K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA +1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G +A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR +zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 +YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD +bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w +DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 +L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D +eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl +xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp +VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY +WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root CA" +# Serial: 17154717934120587862167794914071425081 +# MD5 Fingerprint: 87:ce:0b:7b:2a:0e:49:00:e1:58:71:9b:37:a8:93:72 +# SHA1 Fingerprint: 05:63:b8:63:0d:62:d7:5a:bb:c8:ab:1e:4b:df:b5:a8:99:b2:4d:43 +# SHA256 Fingerprint: 3e:90:99:b5:01:5e:8f:48:6c:00:bc:ea:9d:11:1e:e7:21:fa:ba:35:5a:89:bc:f1:df:69:56:1e:3d:c6:32:5c +-----BEGIN CERTIFICATE----- +MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c +JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP +mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ +wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 +VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ +AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB +AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun +pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC +dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf +fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm +NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx +H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe ++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root CA" +# Serial: 10944719598952040374951832963794454346 +# MD5 Fingerprint: 79:e4:a9:84:0d:7d:3a:96:d7:c0:4f:e2:43:4c:89:2e +# SHA1 Fingerprint: a8:98:5d:3a:65:e5:e5:c4:b2:d7:d6:6d:40:c6:dd:2f:b1:9c:54:36 +# SHA256 Fingerprint: 43:48:a0:e9:44:4c:78:cb:26:5e:05:8d:5e:89:44:b4:d8:4f:96:62:bd:26:db:25:7f:89:34:a4:43:c7:01:61 +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert High Assurance EV Root CA" +# Serial: 3553400076410547919724730734378100087 +# MD5 Fingerprint: d4:74:de:57:5c:39:b2:d3:9c:85:83:c5:c0:65:49:8a +# SHA1 Fingerprint: 5f:b7:ee:06:33:e2:59:db:ad:0c:4c:9a:e6:d3:8f:1a:61:c7:dc:25 +# SHA256 Fingerprint: 74:31:e5:f4:c3:c1:ce:46:90:77:4f:0b:61:e0:54:40:88:3b:a9:a0:1e:d0:0b:a6:ab:d7:80:6e:d3:b1:18:cf +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j +ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL +MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 +LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug +RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm ++9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW +PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM +xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB +Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 +hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg +EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA +FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec +nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z +eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF +hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 +Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe +vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep ++OkuE6N36B9K +-----END CERTIFICATE----- + +# Issuer: CN=SwissSign Gold CA - G2 O=SwissSign AG +# Subject: CN=SwissSign Gold CA - G2 O=SwissSign AG +# Label: "SwissSign Gold CA - G2" +# Serial: 13492815561806991280 +# MD5 Fingerprint: 24:77:d9:a8:91:d1:3b:fa:88:2d:c2:ff:f8:cd:33:93 +# SHA1 Fingerprint: d8:c5:38:8a:b7:30:1b:1b:6e:d4:7a:e6:45:25:3a:6f:9f:1a:27:61 +# SHA256 Fingerprint: 62:dd:0b:e9:b9:f5:0a:16:3e:a0:f8:e7:5c:05:3b:1e:ca:57:ea:55:c8:68:8f:64:7c:68:81:f2:c8:35:7b:95 +-----BEGIN CERTIFICATE----- +MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln +biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF +MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT +d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 +76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ +bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c +6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE +emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd +MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt +MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y +MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y +FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi +aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM +gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB +qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 +lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn +8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov +L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 +45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO +UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 +O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC +bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv +GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a +77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC +hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 +92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp +Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w +ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt +Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ +-----END CERTIFICATE----- + +# Issuer: CN=SwissSign Silver CA - G2 O=SwissSign AG +# Subject: CN=SwissSign Silver CA - G2 O=SwissSign AG +# Label: "SwissSign Silver CA - G2" +# Serial: 5700383053117599563 +# MD5 Fingerprint: e0:06:a1:c9:7d:cf:c9:fc:0d:c0:56:75:96:d8:62:13 +# SHA1 Fingerprint: 9b:aa:e5:9f:56:ee:21:cb:43:5a:be:25:93:df:a7:f0:40:d1:1d:cb +# SHA256 Fingerprint: be:6c:4d:a2:bb:b9:ba:59:b6:f3:93:97:68:37:42:46:c3:c0:05:99:3f:a9:8f:02:0d:1d:ed:be:d4:8a:81:d5 +-----BEGIN CERTIFICATE----- +MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE +BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu +IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow +RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY +U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv +Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br +YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF +nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH +6ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt +eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/ +c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ +MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH +HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf +jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6 +5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB +rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU +F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c +wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 +cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB +AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp +WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9 +xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ +2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ +IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8 +aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X +em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR +dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/ +OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+ +hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy +tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u +-----END CERTIFICATE----- + +# Issuer: CN=SecureTrust CA O=SecureTrust Corporation +# Subject: CN=SecureTrust CA O=SecureTrust Corporation +# Label: "SecureTrust CA" +# Serial: 17199774589125277788362757014266862032 +# MD5 Fingerprint: dc:32:c3:a7:6d:25:57:c7:68:09:9d:ea:2d:a9:a2:d1 +# SHA1 Fingerprint: 87:82:c6:c3:04:35:3b:cf:d2:96:92:d2:59:3e:7d:44:d9:34:ff:11 +# SHA256 Fingerprint: f1:c1:b5:0a:e5:a2:0d:d8:03:0e:c9:f6:bc:24:82:3d:d3:67:b5:25:57:59:b4:e7:1b:61:fc:e9:f7:37:5d:73 +-----BEGIN CERTIFICATE----- +MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz +MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv +cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz +Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO +0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao +wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj +7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS +8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT +BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg +JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC +NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 +6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ +3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm +D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS +CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR +3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= +-----END CERTIFICATE----- + +# Issuer: CN=Secure Global CA O=SecureTrust Corporation +# Subject: CN=Secure Global CA O=SecureTrust Corporation +# Label: "Secure Global CA" +# Serial: 9751836167731051554232119481456978597 +# MD5 Fingerprint: cf:f4:27:0d:d4:ed:dc:65:16:49:6d:3d:da:bf:6e:de +# SHA1 Fingerprint: 3a:44:73:5a:e5:81:90:1f:24:86:61:46:1e:3b:9c:c4:5f:f5:3a:1b +# SHA256 Fingerprint: 42:00:f5:04:3a:c8:59:0e:bb:52:7d:20:9e:d1:50:30:29:fb:cb:d4:1c:a1:b5:06:ec:27:f1:5a:de:7d:ac:69 +-----BEGIN CERTIFICATE----- +MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx +MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg +Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ +iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa +/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ +jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI +HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 +sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w +gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw +KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG +AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L +URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO +H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm +I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY +iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc +f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW +-----END CERTIFICATE----- + +# Issuer: CN=COMODO Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO Certification Authority O=COMODO CA Limited +# Label: "COMODO Certification Authority" +# Serial: 104350513648249232941998508985834464573 +# MD5 Fingerprint: 5c:48:dc:f7:42:72:ec:56:94:6d:1c:cc:71:35:80:75 +# SHA1 Fingerprint: 66:31:bf:9e:f7:4f:9e:b6:c9:d5:a6:0c:ba:6a:be:d1:f7:bd:ef:7b +# SHA256 Fingerprint: 0c:2c:d6:3d:f7:80:6f:a3:99:ed:e8:09:11:6b:57:5b:f8:79:89:f0:65:18:f9:80:8c:86:05:03:17:8b:af:66 +-----BEGIN CERTIFICATE----- +MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB +gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV +BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw +MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl +YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P +RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 +UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI +2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 +Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp ++2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ +DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O +nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW +/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g +PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u +QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY +SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv +IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ +RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 +zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd +BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB +ZQ== +-----END CERTIFICATE----- + +# Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited +# Label: "COMODO ECC Certification Authority" +# Serial: 41578283867086692638256921589707938090 +# MD5 Fingerprint: 7c:62:ff:74:9d:31:53:5e:68:4a:d5:78:aa:1e:bf:23 +# SHA1 Fingerprint: 9f:74:4e:9f:2b:4d:ba:ec:0f:31:2c:50:b6:56:3b:8e:2d:93:c3:11 +# SHA256 Fingerprint: 17:93:92:7a:06:14:54:97:89:ad:ce:2f:8f:34:f7:f0:b6:6d:0f:3a:e3:a3:b8:4d:21:ec:15:db:ba:4f:ad:c7 +-----BEGIN CERTIFICATE----- +MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT +IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwMzA2MDAw +MDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy +ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N +T0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSR +FtSrYpn1PlILBs5BAH+X4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0J +cfRK9ChQtP6IHG4/bC8vCVlbpVsLM5niwz2J+Wos77LTBumjQjBAMB0GA1UdDgQW +BBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VGFAkK+qDm +fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv +GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= +-----END CERTIFICATE----- + +# Issuer: CN=Certigna O=Dhimyotis +# Subject: CN=Certigna O=Dhimyotis +# Label: "Certigna" +# Serial: 18364802974209362175 +# MD5 Fingerprint: ab:57:a6:5b:7d:42:82:19:b5:d8:58:26:28:5e:fd:ff +# SHA1 Fingerprint: b1:2e:13:63:45:86:a4:6f:1a:b2:60:68:37:58:2d:c4:ac:fd:94:97 +# SHA256 Fingerprint: e3:b6:a2:db:2e:d7:ce:48:84:2f:7a:c5:32:41:c7:b7:1d:54:14:4b:fb:40:c1:1f:3f:1d:0b:42:f5:ee:a1:2d +-----BEGIN CERTIFICATE----- +MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV +BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X +DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ +BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 +QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny +gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw +zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q +130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 +JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw +DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw +ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT +AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj +AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG +9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h +bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc +fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu +HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w +t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw +WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== +-----END CERTIFICATE----- + +# Issuer: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority +# Subject: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority +# Label: "ePKI Root Certification Authority" +# Serial: 28956088682735189655030529057352760477 +# MD5 Fingerprint: 1b:2e:00:ca:26:06:90:3d:ad:fe:6f:15:68:d3:6b:b3 +# SHA1 Fingerprint: 67:65:0d:f1:7e:8e:7e:5b:82:40:a4:f4:56:4b:cf:e2:3d:69:c6:f0 +# SHA256 Fingerprint: c0:a6:f4:dc:63:a2:4b:fd:cf:54:ef:2a:6a:08:2a:0a:72:de:35:80:3e:2f:f5:ff:52:7a:e5:d8:72:06:df:d5 +-----BEGIN CERTIFICATE----- +MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe +MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 +ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe +Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw +IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL +SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH +SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh +ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X +DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 +TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ +fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA +sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU +WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS +nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH +dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip +NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC +AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF +MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH +ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB +uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl +PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP +JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ +gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 +j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 +5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB +o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS +/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z +Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE +W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D +hNQ+IIX3Sj0rnP0qCglN6oH4EZw= +-----END CERTIFICATE----- + +# Issuer: O=certSIGN OU=certSIGN ROOT CA +# Subject: O=certSIGN OU=certSIGN ROOT CA +# Label: "certSIGN ROOT CA" +# Serial: 35210227249154 +# MD5 Fingerprint: 18:98:c0:d6:e9:3a:fc:f9:b0:f5:0c:f7:4b:01:44:17 +# SHA1 Fingerprint: fa:b7:ee:36:97:26:62:fb:2d:b0:2a:f6:bf:03:fd:e8:7c:4b:2f:9b +# SHA256 Fingerprint: ea:a9:62:c4:fa:4a:6b:af:eb:e4:15:19:6d:35:1c:cd:88:8d:4f:53:f3:fa:8a:e6:d7:c4:66:a9:4e:60:42:bb +-----BEGIN CERTIFICATE----- +MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT +AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD +QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP +MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do +0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ +UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d +RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ +OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv +JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C +AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O +BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ +LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY +MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ +44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I +Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw +i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN +9u6wWk5JRFRYX0KD +-----END CERTIFICATE----- + +# Issuer: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) +# Subject: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) +# Label: "NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny" +# Serial: 80544274841616 +# MD5 Fingerprint: c5:a1:b7:ff:73:dd:d6:d7:34:32:18:df:fc:3c:ad:88 +# SHA1 Fingerprint: 06:08:3f:59:3f:15:a1:04:a0:69:a4:6b:a9:03:d0:06:b7:97:09:91 +# SHA256 Fingerprint: 6c:61:da:c3:a2:de:f0:31:50:6b:e0:36:d2:a6:fe:40:19:94:fb:d1:3d:f9:c8:d4:66:59:92:74:c4:46:ec:98 +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG +EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 +MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl +cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR +dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB +pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM +b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm +aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz +IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT +lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz +AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 +VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG +ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 +BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG +AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M +U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh +bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C ++C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC +bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F +uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 +XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= +-----END CERTIFICATE----- + +# Issuer: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. +# Subject: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. +# Label: "SecureSign RootCA11" +# Serial: 1 +# MD5 Fingerprint: b7:52:74:e2:92:b4:80:93:f2:75:e4:cc:d7:f2:ea:26 +# SHA1 Fingerprint: 3b:c4:9f:48:f8:f3:73:a0:9c:1e:bd:f8:5b:b1:c3:65:c7:d8:11:b3 +# SHA256 Fingerprint: bf:0f:ee:fb:9e:3a:58:1a:d5:f9:e9:db:75:89:98:57:43:d2:61:08:5c:4d:31:4f:6f:5d:72:59:aa:42:16:12 +-----BEGIN CERTIFICATE----- +MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDEr +MCkGA1UEChMiSmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoG +A1UEAxMTU2VjdXJlU2lnbiBSb290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0 +MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSswKQYDVQQKEyJKYXBhbiBDZXJ0aWZp +Y2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1cmVTaWduIFJvb3RD +QTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvLTJsz +i1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8 +h9uuywGOwvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOV +MdrAG/LuYpmGYz+/3ZMqg6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9 +UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rPO7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni +8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitAbpSACW22s293bzUIUPsC +h8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZXt94wDgYD +VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB +AKChOBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xm +KbabfSVSSUOrTC4rbnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQ +X5Ucv+2rIrVls4W6ng+4reV6G4pQOh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWr +QbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01y8hSyn+B/tlr0/cR7SXf+Of5 +pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061lgeLKBObjBmN +QSdJQO7e5iNEOdyhIta6A/I= +-----END CERTIFICATE----- + +# Issuer: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. +# Subject: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. +# Label: "Microsec e-Szigno Root CA 2009" +# Serial: 14014712776195784473 +# MD5 Fingerprint: f8:49:f4:03:bc:44:2d:83:be:48:69:7d:29:64:fc:b1 +# SHA1 Fingerprint: 89:df:74:fe:5c:f4:0f:4a:80:f9:e3:37:7d:54:da:91:e1:01:31:8e +# SHA256 Fingerprint: 3c:5f:81:fe:a5:fa:b8:2c:64:bf:a2:ea:ec:af:cd:e8:e0:77:fc:86:20:a7:ca:e5:37:16:3d:f3:6e:db:f3:78 +-----BEGIN CERTIFICATE----- +MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD +VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 +ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G +CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y +OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx +FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp +Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o +dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP +kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc +cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U +fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 +N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC +xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 ++rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM +Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG +SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h +mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk +ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 +tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c +2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t +HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 +# Label: "GlobalSign Root CA - R3" +# Serial: 4835703278459759426209954 +# MD5 Fingerprint: c5:df:b8:49:ca:05:13:55:ee:2d:ba:1a:c3:3e:b0:28 +# SHA1 Fingerprint: d6:9b:56:11:48:f0:1c:77:c5:45:78:c1:09:26:df:5b:85:69:76:ad +# SHA256 Fingerprint: cb:b5:22:d7:b7:f1:27:ad:6a:01:13:86:5b:df:1c:d4:10:2e:7d:07:59:af:63:5a:7c:f4:72:0d:c9:63:c5:3b +-----BEGIN CERTIFICATE----- +MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G +A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp +Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 +MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG +A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 +RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT +gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm +KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd +QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ +XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw +DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o +LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU +RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp +jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK +6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX +mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs +Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH +WD9f +-----END CERTIFICATE----- + +# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" +# Serial: 6047274297262753887 +# MD5 Fingerprint: 73:3a:74:7a:ec:bb:a3:96:a6:c2:e4:e2:c8:9b:c0:c3 +# SHA1 Fingerprint: ae:c5:fb:3f:c8:e1:bf:c4:e5:4f:03:07:5a:9a:e8:00:b7:f7:b6:fa +# SHA256 Fingerprint: 04:04:80:28:bf:1f:28:64:d4:8f:9a:d4:d8:32:94:36:6a:82:88:56:55:3f:3b:14:30:3f:90:14:7f:5d:40:ef +-----BEGIN CERTIFICATE----- +MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UE +BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h +cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEy +MzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg +Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 +thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM +cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG +L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i +NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h +X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b +m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy +Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja +EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T +KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF +6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh +OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNHDhpkLzCBpgYD +VR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp +cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBv +ACAAZABlACAAbABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBl +AGwAbwBuAGEAIAAwADgAMAAxADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF +661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx51tkljYyGOylMnfX40S2wBEqgLk9 +am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qkR71kMrv2JYSiJ0L1 +ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaPT481 +PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS +3a/DTg4fJl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5k +SeTy36LssUzAKh3ntLFlosS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF +3dvd6qJ2gHN99ZwExEWN57kci57q13XRcrHedUTnQn3iV2t93Jm8PYMo6oCTjcVM +ZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoRsaS8I8nkvof/uZS2+F0g +StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz +Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB +jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V +-----END CERTIFICATE----- + +# Issuer: CN=Izenpe.com O=IZENPE S.A. +# Subject: CN=Izenpe.com O=IZENPE S.A. +# Label: "Izenpe.com" +# Serial: 917563065490389241595536686991402621 +# MD5 Fingerprint: a6:b0:cd:85:80:da:5c:50:34:a3:39:90:2f:55:67:73 +# SHA1 Fingerprint: 2f:78:3d:25:52:18:a7:4a:65:39:71:b5:2c:a2:9c:45:15:6f:e9:19 +# SHA256 Fingerprint: 25:30:cc:8e:98:32:15:02:ba:d9:6f:9b:1f:ba:1b:09:9e:2d:29:9e:0f:45:48:bb:91:4f:36:3b:c0:d4:53:1f +-----BEGIN CERTIFICATE----- +MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 +MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 +ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD +VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j +b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq +scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO +xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H +LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX +uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD +yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ +JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q +rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN +BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L +hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB +QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ +HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu +Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg +QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB +BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx +MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA +A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb +laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 +awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo +JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw +LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT +VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk +LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb +UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ +QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ +naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls +QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== +-----END CERTIFICATE----- + +# Issuer: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. +# Subject: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. +# Label: "Go Daddy Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: 80:3a:bc:22:c1:e6:fb:8d:9b:3b:27:4a:32:1b:9a:01 +# SHA1 Fingerprint: 47:be:ab:c9:22:ea:e8:0e:78:78:34:62:a7:9f:45:c2:54:fd:e6:8b +# SHA256 Fingerprint: 45:14:0b:32:47:eb:9c:c8:c5:b4:f0:d7:b5:30:91:f7:32:92:08:9e:6e:5a:63:e2:74:9d:d3:ac:a9:19:8e:da +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT +EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp +ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz +NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH +EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE +AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD +E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH +/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy +DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh +GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR +tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA +AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX +WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu +9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr +gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo +2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO +LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI +4uJEvlz36hz1 +-----END CERTIFICATE----- + +# Issuer: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Subject: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Label: "Starfield Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: d6:39:81:c6:52:7e:96:69:fc:fc:ca:66:ed:05:f2:96 +# SHA1 Fingerprint: b5:1c:06:7c:ee:2b:0c:3d:f8:55:ab:2d:92:f4:fe:39:d4:e7:0f:0e +# SHA256 Fingerprint: 2c:e1:cb:0b:f9:d2:f9:e1:02:99:3f:be:21:51:52:c3:b2:dd:0c:ab:de:1c:68:e5:31:9b:83:91:54:db:b7:f5 +-----BEGIN CERTIFICATE----- +MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT +HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs +ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw +MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 +b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj +aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp +Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg +nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 +HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N +Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN +dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 +HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO +BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G +CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU +sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 +4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg +8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K +pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 +mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 +-----END CERTIFICATE----- + +# Issuer: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Subject: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Label: "Starfield Services Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: 17:35:74:af:7b:61:1c:eb:f4:f9:3c:e2:ee:40:f9:a2 +# SHA1 Fingerprint: 92:5a:8f:8d:2c:6d:04:e0:66:5f:59:6a:ff:22:d8:63:e8:25:6f:3f +# SHA256 Fingerprint: 56:8d:69:05:a2:c8:87:08:a4:b3:02:51:90:ed:cf:ed:b1:97:4a:60:6a:13:c6:e5:29:0f:cb:2a:e6:3e:da:b5 +-----BEGIN CERTIFICATE----- +MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT +HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs +ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 +MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy +ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy +dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p +OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 +8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K +Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe +hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk +6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw +DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q +AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI +bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB +ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z +qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd +iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn +0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN +sSi6 +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Commercial O=AffirmTrust +# Subject: CN=AffirmTrust Commercial O=AffirmTrust +# Label: "AffirmTrust Commercial" +# Serial: 8608355977964138876 +# MD5 Fingerprint: 82:92:ba:5b:ef:cd:8a:6f:a6:3d:55:f9:84:f6:d6:b7 +# SHA1 Fingerprint: f9:b5:b6:32:45:5f:9c:be:ec:57:5f:80:dc:e9:6e:2c:c7:b2:78:b7 +# SHA256 Fingerprint: 03:76:ab:1d:54:c5:f9:80:3c:e4:b2:e2:01:a0:ee:7e:ef:7b:57:b6:36:e8:a9:3c:9b:8d:48:60:c9:6f:5f:a7 +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz +dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL +MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp +cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP +Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr +ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL +MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1 +yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr +VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/ +nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ +KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG +XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj +vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt +Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g +N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC +nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Networking O=AffirmTrust +# Subject: CN=AffirmTrust Networking O=AffirmTrust +# Label: "AffirmTrust Networking" +# Serial: 8957382827206547757 +# MD5 Fingerprint: 42:65:ca:be:01:9a:9a:4c:a9:8c:41:49:cd:c0:d5:7f +# SHA1 Fingerprint: 29:36:21:02:8b:20:ed:02:f5:66:c5:32:d1:d6:ed:90:9f:45:00:2f +# SHA256 Fingerprint: 0a:81:ec:5a:92:97:77:f1:45:90:4a:f3:8d:5d:50:9f:66:b5:e2:c5:8f:cd:b5:31:05:8b:0e:17:f3:f0:b4:1b +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz +dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL +MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp +cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y +YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua +kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL +QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp +6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG +yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i +QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ +KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO +tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu +QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ +Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u +olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 +x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Premium O=AffirmTrust +# Subject: CN=AffirmTrust Premium O=AffirmTrust +# Label: "AffirmTrust Premium" +# Serial: 7893706540734352110 +# MD5 Fingerprint: c4:5d:0e:48:b6:ac:28:30:4e:0a:bc:f9:38:16:87:57 +# SHA1 Fingerprint: d8:a6:33:2c:e0:03:6f:b1:85:f6:63:4f:7d:6a:06:65:26:32:28:27 +# SHA256 Fingerprint: 70:a7:3f:7f:37:6b:60:07:42:48:90:45:34:b1:14:82:d5:bf:0e:69:8e:cc:49:8d:f5:25:77:eb:f2:e9:3b:9a +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz +dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG +A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U +cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf +qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ +JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ ++jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS +s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5 +HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7 +70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG +V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S +qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S +5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia +C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX +OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE +FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ +BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2 +KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg +Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B +8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ +MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc +0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ +u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF +u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH +YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 +GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO +RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e +KeC2uAloGRwYQw== +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Premium ECC O=AffirmTrust +# Subject: CN=AffirmTrust Premium ECC O=AffirmTrust +# Label: "AffirmTrust Premium ECC" +# Serial: 8401224907861490260 +# MD5 Fingerprint: 64:b0:09:55:cf:b1:d5:99:e2:be:13:ab:a6:5d:ea:4d +# SHA1 Fingerprint: b8:23:6b:00:2f:1d:16:86:53:01:55:6c:11:a4:37:ca:eb:ff:c3:bb +# SHA256 Fingerprint: bd:71:fd:f6:da:97:e4:cf:62:d1:64:7a:dd:25:81:b0:7d:79:ad:f8:39:7e:b4:ec:ba:9c:5e:84:88:82:14:23 +-----BEGIN CERTIFICATE----- +MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC +VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ +cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ +BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt +VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D +0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 +ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G +A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G +A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs +aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I +flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Network CA" +# Serial: 279744 +# MD5 Fingerprint: d5:e9:81:40:c5:18:69:fc:46:2c:89:75:62:0f:aa:78 +# SHA1 Fingerprint: 07:e0:32:e0:20:b7:2c:3f:19:2f:06:28:a2:59:3a:19:a7:0f:06:9e +# SHA256 Fingerprint: 5c:58:46:8d:55:f5:8e:49:7e:74:39:82:d2:b5:00:10:b6:d1:65:37:4a:cf:83:a7:d4:a3:2d:b7:68:c4:40:8e +-----BEGIN CERTIFICATE----- +MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM +MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D +ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU +cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 +WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg +Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw +IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH +UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM +TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU +BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM +kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x +AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV +HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y +sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL +I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 +J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY +VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI +03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= +-----END CERTIFICATE----- + +# Issuer: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA +# Subject: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA +# Label: "TWCA Root Certification Authority" +# Serial: 1 +# MD5 Fingerprint: aa:08:8f:f6:f9:7b:b7:f2:b1:a7:1e:9b:ea:ea:bd:79 +# SHA1 Fingerprint: cf:9e:87:6d:d3:eb:fc:42:26:97:a3:b5:a3:7a:a0:76:a9:06:23:48 +# SHA256 Fingerprint: bf:d8:8f:e1:10:1c:41:ae:3e:80:1b:f8:be:56:35:0e:e9:ba:d1:a6:b9:bd:51:5e:dc:5c:6d:5b:87:11:ac:44 +-----BEGIN CERTIFICATE----- +MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES +MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU +V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz +WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO +LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm +aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE +AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH +K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX +RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z +rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx +3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq +hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC +MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls +XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D +lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn +aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ +YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== +-----END CERTIFICATE----- + +# Issuer: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 +# Subject: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 +# Label: "Security Communication RootCA2" +# Serial: 0 +# MD5 Fingerprint: 6c:39:7d:a4:0e:55:59:b2:3f:d6:41:b1:12:50:de:43 +# SHA1 Fingerprint: 5f:3b:8c:f2:f8:10:b3:7d:78:b4:ce:ec:19:19:c3:73:34:b9:c7:74 +# SHA256 Fingerprint: 51:3b:2c:ec:b8:10:d4:cd:e5:dd:85:39:1a:df:c6:c2:dd:60:d8:7b:b7:36:d2:b5:21:48:4a:a4:7a:0e:be:f6 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl +MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe +U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX +DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy +dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj +YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV +OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr +zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM +VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ +hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO +ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw +awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs +OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 +DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF +coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc +okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 +t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy +1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ +SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 +-----END CERTIFICATE----- + +# Issuer: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 +# Subject: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 +# Label: "Actalis Authentication Root CA" +# Serial: 6271844772424770508 +# MD5 Fingerprint: 69:c1:0d:4f:07:a3:1b:c3:fe:56:3d:04:bc:11:f6:a6 +# SHA1 Fingerprint: f3:73:b3:87:06:5a:28:84:8a:f2:f3:4a:ce:19:2b:dd:c7:8e:9c:ac +# SHA256 Fingerprint: 55:92:60:84:ec:96:3a:64:b9:6e:2a:be:01:ce:0b:a8:6a:64:fb:fe:bc:c7:aa:b5:af:c1:55:b3:7f:d7:60:66 +-----BEGIN CERTIFICATE----- +MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE +BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w +MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 +IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC +SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 +ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv +UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX +4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 +KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ +gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb +rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ +51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F +be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe +KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F +v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn +fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 +jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz +ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt +ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL +e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 +jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz +WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V +SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j +pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX +X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok +fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R +K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU +ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU +LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT +LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== +-----END CERTIFICATE----- + +# Issuer: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 +# Subject: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 +# Label: "Buypass Class 2 Root CA" +# Serial: 2 +# MD5 Fingerprint: 46:a7:d2:fe:45:fb:64:5a:a8:59:90:9b:78:44:9b:29 +# SHA1 Fingerprint: 49:0a:75:74:de:87:0a:47:fe:58:ee:f6:c7:6b:eb:c6:0b:12:40:99 +# SHA256 Fingerprint: 9a:11:40:25:19:7c:5b:b9:5d:94:e6:3d:55:cd:43:79:08:47:b6:46:b2:3c:df:11:ad:a4:a0:0e:ff:15:fb:48 +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd +MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg +Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow +TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw +HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB +BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr +6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV +L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 +1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx +MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ +QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB +arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr +Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi +FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS +P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN +9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP +AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz +uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h +9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s +A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t +OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo ++fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 +KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 +DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us +H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ +I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 +5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h +3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz +Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= +-----END CERTIFICATE----- + +# Issuer: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 +# Subject: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 +# Label: "Buypass Class 3 Root CA" +# Serial: 2 +# MD5 Fingerprint: 3d:3b:18:9e:2c:64:5a:e8:d5:88:ce:0e:f9:37:c2:ec +# SHA1 Fingerprint: da:fa:f7:fa:66:84:ec:06:8f:14:50:bd:c7:c2:81:a5:bc:a9:64:57 +# SHA256 Fingerprint: ed:f7:eb:bc:a2:7a:2a:38:4d:38:7b:7d:40:10:c6:66:e2:ed:b4:84:3e:4c:29:b4:ae:1d:5b:93:32:e6:b2:4d +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd +MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg +Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow +TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw +HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB +BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y +ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E +N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 +tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX +0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c +/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X +KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY +zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS +O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D +34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP +K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 +AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv +Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj +QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV +cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS +IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 +HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa +O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv +033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u +dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE +kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 +3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD +u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq +4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= +-----END CERTIFICATE----- + +# Issuer: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Subject: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Label: "T-TeleSec GlobalRoot Class 3" +# Serial: 1 +# MD5 Fingerprint: ca:fb:40:a8:4e:39:92:8a:1d:fe:8e:2f:c4:27:ea:ef +# SHA1 Fingerprint: 55:a6:72:3e:cb:f2:ec:cd:c3:23:74:70:19:9d:2a:be:11:e3:81:d1 +# SHA256 Fingerprint: fd:73:da:d3:1c:64:4f:f1:b4:3b:ef:0c:cd:da:96:71:0b:9c:d9:87:5e:ca:7e:31:70:7a:f3:e9:6d:52:2b:bd +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx +KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd +BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl +YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 +OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy +aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 +ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN +8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ +RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 +hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 +ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM +EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 +A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy +WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ +1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 +6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT +91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml +e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p +TpPDpFQUWw== +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH +# Subject: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH +# Label: "D-TRUST Root Class 3 CA 2 2009" +# Serial: 623603 +# MD5 Fingerprint: cd:e0:25:69:8d:47:ac:9c:89:35:90:f7:fd:51:3d:2f +# SHA1 Fingerprint: 58:e8:ab:b0:36:15:33:fb:80:f7:9b:1b:6d:29:d3:ff:8d:5f:00:f0 +# SHA256 Fingerprint: 49:e7:a4:42:ac:f0:ea:62:87:05:00:54:b5:25:64:b6:50:e4:f4:9e:42:e3:48:d6:aa:38:e0:39:e9:57:b1:c1 +-----BEGIN CERTIFICATE----- +MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF +MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD +bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha +ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM +HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 +UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 +tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R +ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM +lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp +/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G +A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G +A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj +dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy +MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl +cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js +L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL +BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni +acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 +o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K +zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 +PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y +Johw1+qRzT65ysCQblrGXnRl11z+o+I= +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH +# Subject: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH +# Label: "D-TRUST Root Class 3 CA 2 EV 2009" +# Serial: 623604 +# MD5 Fingerprint: aa:c6:43:2c:5e:2d:cd:c4:34:c0:50:4f:11:02:4f:b6 +# SHA1 Fingerprint: 96:c9:1b:0b:95:b4:10:98:42:fa:d0:d8:22:79:fe:60:fa:b9:16:83 +# SHA256 Fingerprint: ee:c5:49:6b:98:8c:e9:86:25:b9:34:09:2e:ec:29:08:be:d0:b0:f3:16:c2:d4:73:0c:84:ea:f1:f3:d3:48:81 +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF +MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD +bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw +NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV +BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn +ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 +3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z +qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR +p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 +HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw +ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea +HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw +Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh +c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E +RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt +dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku +Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp +3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 +nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF +CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na +xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX +KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 +-----END CERTIFICATE----- + +# Issuer: CN=CA Disig Root R2 O=Disig a.s. +# Subject: CN=CA Disig Root R2 O=Disig a.s. +# Label: "CA Disig Root R2" +# Serial: 10572350602393338211 +# MD5 Fingerprint: 26:01:fb:d8:27:a7:17:9a:45:54:38:1a:43:01:3b:03 +# SHA1 Fingerprint: b5:61:eb:ea:a4:de:e4:25:4b:69:1a:98:a5:57:47:c2:34:c7:d9:71 +# SHA256 Fingerprint: e2:3d:4a:03:6d:7b:70:e9:f5:95:b1:42:20:79:d2:b9:1e:df:bb:1f:b6:51:a0:63:3e:aa:8a:9d:c5:f8:07:03 +-----BEGIN CERTIFICATE----- +MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV +BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu +MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy +MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx +EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw +ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe +NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH +PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I +x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe +QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR +yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO +QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 +H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ +QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD +i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs +nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 +rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud +DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI +hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM +tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf +GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb +lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka ++elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal +TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i +nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 +gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr +G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os +zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x +L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL +-----END CERTIFICATE----- + +# Issuer: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV +# Subject: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV +# Label: "ACCVRAIZ1" +# Serial: 6828503384748696800 +# MD5 Fingerprint: d0:a0:5a:ee:05:b6:09:94:21:a1:7d:f1:b2:29:82:02 +# SHA1 Fingerprint: 93:05:7a:88:15:c6:4f:ce:88:2f:fa:91:16:52:28:78:bc:53:64:17 +# SHA256 Fingerprint: 9a:6e:c0:12:e1:a7:da:9d:be:34:19:4d:47:8a:d7:c0:db:18:22:fb:07:1d:f1:29:81:49:6e:d1:04:38:41:13 +-----BEGIN CERTIFICATE----- +MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE +AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw +CQYDVQQGEwJFUzAeFw0xMTA1MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQ +BgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwHUEtJQUNDVjENMAsGA1UECgwEQUND +VjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCb +qau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gMjmoY +HtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWo +G2ioPej0RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpA +lHPrzg5XPAOBOp0KoVdDaaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhr +IA8wKFSVf+DuzgpmndFALW4ir50awQUZ0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/ +0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDGWuzndN9wrqODJerWx5eH +k6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs78yM2x/47 +4KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMO +m3WR5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpa +cXpkatcnYGMN285J9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPl +uUsXQA+xtrn13k/c4LOsOxFwYIRKQ26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYI +KwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRwOi8vd3d3LmFjY3YuZXMvZmls +ZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEuY3J0MB8GCCsG +AQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 +VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeT +VfZW6oHlNsyMHj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIG +CCsGAQUFBwICMIIBFB6CARAAQQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUA +cgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBhAO0AegAgAGQAZQAgAGwAYQAgAEEA +QwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUAYwBuAG8AbABvAGcA +7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBjAHQA +cgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAA +QwBQAFMAIABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUA +czAwBggrBgEFBQcCARYkaHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2Mu +aHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRt +aW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2MV9kZXIuY3JsMA4GA1Ud +DwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZIhvcNAQEF +BQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdp +D70ER9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gU +JyCpZET/LtZ1qmxNYEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+m +AM/EKXMRNt6GGT6d7hmKG9Ww7Y49nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepD +vV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJTS+xJlsndQAJxGJ3KQhfnlms +tn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3sCPdK6jT2iWH +7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h +I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szA +h1xA2syVP1XgNce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xF +d3+YJ5oyXSrjhO7FmGYvliAd3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2H +pPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3pEfbRD0tVNEYqi4Y7 +-----END CERTIFICATE----- + +# Issuer: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA +# Subject: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA +# Label: "TWCA Global Root CA" +# Serial: 3262 +# MD5 Fingerprint: f9:03:7e:cf:e6:9e:3c:73:7a:2a:90:07:69:ff:2b:96 +# SHA1 Fingerprint: 9c:bb:48:53:f6:a4:f6:d3:52:a4:e8:32:52:55:60:13:f5:ad:af:65 +# SHA256 Fingerprint: 59:76:90:07:f7:68:5d:0f:cd:50:87:2f:9f:95:d5:75:5a:5b:2b:45:7d:81:f3:69:2b:61:0a:98:67:2f:0e:1b +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx +EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT +VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 +NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT +B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF +10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz +0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh +MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH +zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc +46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 +yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi +laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP +oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA +BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE +qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm +4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL +1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn +LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF +H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo +RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ +nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh +15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW +6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW +nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j +wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz +aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy +KwbQBM0= +-----END CERTIFICATE----- + +# Issuer: CN=TeliaSonera Root CA v1 O=TeliaSonera +# Subject: CN=TeliaSonera Root CA v1 O=TeliaSonera +# Label: "TeliaSonera Root CA v1" +# Serial: 199041966741090107964904287217786801558 +# MD5 Fingerprint: 37:41:49:1b:18:56:9a:26:f5:ad:c2:66:fb:40:a5:4c +# SHA1 Fingerprint: 43:13:bb:96:f1:d5:86:9b:c1:4e:6a:92:f6:cf:f6:34:69:87:82:37 +# SHA256 Fingerprint: dd:69:36:fe:21:f8:f0:77:c1:23:a1:a5:21:c1:22:24:f7:22:55:b7:3e:03:a7:26:06:93:e8:a2:4b:0f:a3:89 +-----BEGIN CERTIFICATE----- +MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw +NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv +b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD +VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F +VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 +7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X +Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ +/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs +81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm +dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe +Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu +sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 +pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs +slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ +arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD +VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG +9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl +dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx +0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj +TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed +Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 +Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI +OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 +vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW +t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn +HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx +SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= +-----END CERTIFICATE----- + +# Issuer: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Subject: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Label: "T-TeleSec GlobalRoot Class 2" +# Serial: 1 +# MD5 Fingerprint: 2b:9b:9e:e4:7b:6c:1f:00:72:1a:cc:c1:77:79:df:6a +# SHA1 Fingerprint: 59:0d:2d:7d:88:4f:40:2e:61:7e:a5:62:32:17:65:cf:17:d8:94:e9 +# SHA256 Fingerprint: 91:e2:f5:78:8d:58:10:eb:a7:ba:58:73:7d:e1:54:8a:8e:ca:cd:01:45:98:bc:0b:14:3e:04:1b:17:05:25:52 +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx +KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd +BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl +YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 +OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy +aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 +ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd +AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC +FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi +1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq +jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ +wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ +WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy +NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC +uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw +IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 +g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN +9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP +BSeOE6Fuwg== +-----END CERTIFICATE----- + +# Issuer: CN=Atos TrustedRoot 2011 O=Atos +# Subject: CN=Atos TrustedRoot 2011 O=Atos +# Label: "Atos TrustedRoot 2011" +# Serial: 6643877497813316402 +# MD5 Fingerprint: ae:b9:c4:32:4b:ac:7f:5d:66:cc:77:94:bb:2a:77:56 +# SHA1 Fingerprint: 2b:b1:f5:3e:55:0c:1d:c5:f1:d4:e6:b7:6a:46:4b:55:06:02:ac:21 +# SHA256 Fingerprint: f3:56:be:a2:44:b7:a9:1e:b3:5d:53:ca:9a:d7:86:4a:ce:01:8e:2d:35:d5:f8:f9:6d:df:68:a6:f4:1a:a4:74 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE +AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG +EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM +FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC +REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp +Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM +VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+ +SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ +4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L +cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi +eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV +HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG +A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3 +DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j +vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP +DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc +maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D +lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv +KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 1 G3" +# Serial: 687049649626669250736271037606554624078720034195 +# MD5 Fingerprint: a4:bc:5b:3f:fe:37:9a:fa:64:f0:e2:fa:05:3d:0b:ab +# SHA1 Fingerprint: 1b:8e:ea:57:96:29:1a:c9:39:ea:b8:0a:81:1a:73:73:c0:93:79:67 +# SHA256 Fingerprint: 8a:86:6f:d1:b2:76:b5:7e:57:8e:92:1c:65:82:8a:2b:ed:58:e9:f2:f2:88:05:41:34:b7:f1:f4:bf:c9:cc:74 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00 +MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakEPBtV +wedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWe +rNrwU8lmPNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF341 +68Xfuw6cwI2H44g4hWf6Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh +4Pw5qlPafX7PGglTvF0FBM+hSo+LdoINofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXp +UhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/lg6AnhF4EwfWQvTA9xO+o +abw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV7qJZjqlc +3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/G +KubX9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSt +hfbZxbGL0eUQMk1fiyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KO +Tk0k+17kBL5yG6YnLUlamXrXXAkgt3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOt +zCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZIhvcNAQELBQAD +ggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC +MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2 +cDMT/uFPpiN3GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUN +qXsCHKnQO18LwIE6PWThv6ctTr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5 +YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP+V04ikkwj+3x6xn0dxoxGE1nVGwv +b2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh3jRJjehZrJ3ydlo2 +8hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fawx/k +NSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNj +ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp +q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt +nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 2 G3" +# Serial: 390156079458959257446133169266079962026824725800 +# MD5 Fingerprint: af:0c:86:6e:bf:40:2d:7f:0b:3e:12:50:ba:12:3d:06 +# SHA1 Fingerprint: 09:3c:61:f3:8b:8b:dc:7d:55:df:75:38:02:05:00:e1:25:f5:c8:36 +# SHA256 Fingerprint: 8f:e4:fb:0a:f9:3a:4d:0d:67:db:0b:eb:b2:3e:37:c7:1b:f3:25:dc:bc:dd:24:0e:a0:4d:af:58:b4:7e:18:40 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00 +MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFhZiFf +qq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMW +n4rjyduYNM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ym +c5GQYaYDFCDy54ejiK2toIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+ +O7q414AB+6XrW7PFXmAqMaCvN+ggOp+oMiwMzAkd056OXbxMmO7FGmh77FOm6RQ1 +o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+lV0POKa2Mq1W/xPtbAd0j +IaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZoL1NesNKq +IcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz +8eQQsSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43eh +vNURG3YBZwjgQQvD6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l +7ZizlWNof/k19N+IxWA1ksB8aRxhlRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALG +cC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZIhvcNAQELBQAD +ggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 +AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RC +roijQ1h5fq7KpVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0Ga +W/ZZGYjeVYg3UQt4XAoeo0L9x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4n +lv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgzdWqTHBLmYF5vHX/JHyPLhGGfHoJE ++V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6XU/IyAgkwo1jwDQHV +csaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+NwmNtd +dbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNg +KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM +HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 +WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 3 G3" +# Serial: 268090761170461462463995952157327242137089239581 +# MD5 Fingerprint: df:7d:b9:ad:54:6f:68:a1:df:89:57:03:97:43:b0:d7 +# SHA1 Fingerprint: 48:12:bd:92:3c:a8:c4:39:06:e7:30:6d:27:96:e6:a4:cf:22:2e:7d +# SHA256 Fingerprint: 88:ef:81:de:20:2e:b0:18:45:2e:43:f8:64:72:5c:ea:5f:bd:1f:c2:d9:d2:05:73:07:09:c5:d8:b8:69:0f:46 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00 +MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286IxSR +/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNu +FoM7pmRLMon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXR +U7Ox7sWTaYI+FrUoRqHe6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+c +ra1AdHkrAj80//ogaX3T7mH1urPnMNA3I4ZyYUUpSFlob3emLoG+B01vr87ERROR +FHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3UVDmrJqMz6nWB2i3ND0/k +A9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f75li59wzw +eyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634Ryl +sSqiMd5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBp +VzgeAVuNVejH38DMdyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0Q +A4XN8f+MFrXBsj6IbGB/kE+V9/YtrQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ +ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZIhvcNAQELBQAD +ggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px +KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnI +FUBhynLWcKzSt/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5Wvv +oxXqA/4Ti2Tk08HS6IT7SdEQTXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFg +u/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9DuDcpmvJRPpq3t/O5jrFc/ZSXPsoaP +0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGibIh6BJpsQBJFxwAYf +3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmDhPbl +8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+ +DhcI00iX0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HN +PlopNLk9hM6xZdRZkZFWdSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ +ywaZWWDYWGWVjUTR939+J399roD1B0y2PpxxVJkES/1Y+Zj0 +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root G2" +# Serial: 15385348160840213938643033620894905419 +# MD5 Fingerprint: 92:38:b9:f8:63:24:82:65:2c:57:33:e6:fe:81:8f:9d +# SHA1 Fingerprint: a1:4b:48:d9:43:ee:0a:0e:40:90:4f:3c:e0:a4:c0:91:93:51:5d:3f +# SHA256 Fingerprint: 7d:05:eb:b6:82:33:9f:8c:94:51:ee:09:4e:eb:fe:fa:79:53:a1:14:ed:b2:f4:49:49:45:2f:ab:7d:2f:c1:85 +-----BEGIN CERTIFICATE----- +MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA +n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc +biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp +EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA +bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu +YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB +AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW +BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI +QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I +0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni +lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 +B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv +ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo +IhNzbM8m9Yop5w== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root G3" +# Serial: 15459312981008553731928384953135426796 +# MD5 Fingerprint: 7c:7f:65:31:0c:81:df:8d:ba:3e:99:e2:5c:ad:6e:fb +# SHA1 Fingerprint: f5:17:a2:4f:9a:48:c6:c9:f8:a2:00:26:9f:dc:0f:48:2c:ab:30:89 +# SHA256 Fingerprint: 7e:37:cb:8b:4c:47:09:0c:ab:36:55:1b:a6:f4:5d:b8:40:68:0f:ba:16:6a:95:2d:b1:00:71:7f:43:05:3f:c2 +-----BEGIN CERTIFICATE----- +MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw +CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu +ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg +RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu +Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq +hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf +Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q +RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ +BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD +AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY +JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv +6pZjamVFkpUBtA== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root G2" +# Serial: 4293743540046975378534879503202253541 +# MD5 Fingerprint: e4:a6:8a:c8:54:ac:52:42:46:0a:fd:72:48:1b:2a:44 +# SHA1 Fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4 +# SHA256 Fingerprint: cb:3c:cb:b7:60:31:e5:e0:13:8f:8d:d3:9a:23:f9:de:47:ff:c3:5e:43:c1:14:4c:ea:27:d4:6a:5a:b1:cb:5f +-----BEGIN CERTIFICATE----- +MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH +MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI +2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx +1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ +q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz +tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ +vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV +5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY +1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 +NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG +Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 +8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe +pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl +MrY= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root G3" +# Serial: 7089244469030293291760083333884364146 +# MD5 Fingerprint: f5:5d:a4:50:a5:fb:28:7e:1e:0f:0d:cc:96:57:56:ca +# SHA1 Fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e +# SHA256 Fingerprint: 31:ad:66:48:f8:10:41:38:c7:38:f3:9e:a4:32:01:33:39:3e:3a:18:cc:02:29:6e:f9:7c:2a:c9:ef:67:31:d0 +-----BEGIN CERTIFICATE----- +MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw +CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu +ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe +Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw +EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x +IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF +K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG +fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO +Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd +BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx +AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ +oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 +sycX +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Trusted Root G4" +# Serial: 7451500558977370777930084869016614236 +# MD5 Fingerprint: 78:f2:fc:aa:60:1f:2f:b4:eb:c9:37:ba:53:2e:75:49 +# SHA1 Fingerprint: dd:fb:16:cd:49:31:c9:73:a2:03:7d:3f:c8:3a:4d:7d:77:5d:05:e4 +# SHA256 Fingerprint: 55:2f:7b:dc:f1:a7:af:9e:6c:e6:72:01:7f:4f:12:ab:f7:72:40:c7:8e:76:1a:c2:03:d1:d9:d2:0a:c8:99:88 +-----BEGIN CERTIFICATE----- +MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg +RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu +Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y +ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If +xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV +ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO +DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ +jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ +CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi +EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM +fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY +uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK +chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t +9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD +ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 +SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd ++SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc +fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa +sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N +cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N +0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie +4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI +r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 +/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm +gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ +-----END CERTIFICATE----- + +# Issuer: CN=COMODO RSA Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO RSA Certification Authority O=COMODO CA Limited +# Label: "COMODO RSA Certification Authority" +# Serial: 101909084537582093308941363524873193117 +# MD5 Fingerprint: 1b:31:b0:71:40:36:cc:14:36:91:ad:c4:3e:fd:ec:18 +# SHA1 Fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 +# SHA256 Fingerprint: 52:f0:e1:c4:e5:8e:c6:29:29:1b:60:31:7f:07:46:71:b8:5d:7e:a8:0d:5b:07:27:34:63:53:4b:32:b4:02:34 +-----BEGIN CERTIFICATE----- +MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB +hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV +BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5 +MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT +EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR +Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR +6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X +pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC +9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV +/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf +Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z ++pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w +qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah +SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC +u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf +Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq +crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E +FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB +/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl +wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM +4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV +2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna +FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ +CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK +boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke +jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL +S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb +QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl +0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB +NVOFBkpdn627G190 +-----END CERTIFICATE----- + +# Issuer: CN=USERTrust RSA Certification Authority O=The USERTRUST Network +# Subject: CN=USERTrust RSA Certification Authority O=The USERTRUST Network +# Label: "USERTrust RSA Certification Authority" +# Serial: 2645093764781058787591871645665788717 +# MD5 Fingerprint: 1b:fe:69:d1:91:b7:19:33:a3:72:a8:0f:e1:55:e5:b5 +# SHA1 Fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e +# SHA256 Fingerprint: e7:93:c9:b0:2f:d8:aa:13:e2:1c:31:22:8a:cc:b0:81:19:64:3b:74:9c:89:89:64:b1:74:6d:46:c3:d4:cb:d2 +-----BEGIN CERTIFICATE----- +MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB +iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl +cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV +BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw +MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV +BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy +dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B +3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY +tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/ +Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2 +VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT +79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6 +c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT +Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l +c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee +UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE +Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd +BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G +A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF +Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO +VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3 +ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs +8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR +iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze +Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ +XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/ +qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB +VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB +L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG +jjxDah2nGN59PRbxYvnKkKj9 +-----END CERTIFICATE----- + +# Issuer: CN=USERTrust ECC Certification Authority O=The USERTRUST Network +# Subject: CN=USERTrust ECC Certification Authority O=The USERTRUST Network +# Label: "USERTrust ECC Certification Authority" +# Serial: 123013823720199481456569720443997572134 +# MD5 Fingerprint: fa:68:bc:d9:b5:7f:ad:fd:c9:1d:06:83:28:cc:24:c1 +# SHA1 Fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e5:f0:5a:1d:0c:95:7d:f0 +# SHA256 Fingerprint: 4f:f4:60:d5:4b:9c:86:da:bf:bc:fc:57:12:e0:40:0d:2b:ed:3f:bc:4d:4f:bd:aa:86:e0:6a:dc:d2:a9:ad:7a +-----BEGIN CERTIFICATE----- +MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL +MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl +eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT +JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx +MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT +Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg +VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm +aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo +I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng +o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G +A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB +zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW +RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 +# Label: "GlobalSign ECC Root CA - R5" +# Serial: 32785792099990507226680698011560947931244 +# MD5 Fingerprint: 9f:ad:3b:1c:02:1e:8a:ba:17:74:38:81:0c:a2:bc:08 +# SHA1 Fingerprint: 1f:24:c6:30:cd:a4:18:ef:20:69:ff:ad:4f:dd:5f:46:3a:1b:69:aa +# SHA256 Fingerprint: 17:9f:bc:14:8a:3d:d0:0f:d2:4e:a1:34:58:cc:43:bf:a7:f5:9c:81:82:d7:83:a5:13:f6:eb:ec:10:0c:89:24 +-----BEGIN CERTIFICATE----- +MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk +MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH +bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX +DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD +QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc +8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke +hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI +KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg +515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO +xwy8p2Fp8fc74SrL+SvzZpA3 +-----END CERTIFICATE----- + +# Issuer: CN=IdenTrust Commercial Root CA 1 O=IdenTrust +# Subject: CN=IdenTrust Commercial Root CA 1 O=IdenTrust +# Label: "IdenTrust Commercial Root CA 1" +# Serial: 13298821034946342390520003877796839426 +# MD5 Fingerprint: b3:3e:77:73:75:ee:a0:d3:e3:7e:49:63:49:59:bb:c7 +# SHA1 Fingerprint: df:71:7e:aa:4a:d9:4e:c9:55:84:99:60:2d:48:de:5f:bc:f0:3a:25 +# SHA256 Fingerprint: 5d:56:49:9b:e4:d2:e0:8b:cf:ca:d0:8a:3e:38:72:3d:50:50:3b:de:70:69:48:e4:2f:55:60:30:19:e5:28:ae +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBK +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVu +VHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQw +MTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScw +JQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ldhNlT +3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU ++ehcCuz/mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gp +S0l4PJNgiCL8mdo2yMKi1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1 +bVoE/c40yiTcdCMbXTMTEl3EASX2MN0CXZ/g1Ue9tOsbobtJSdifWwLziuQkkORi +T0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl3ZBWzvurpWCdxJ35UrCL +vYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzyNeVJSQjK +Vsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZK +dHzVWYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHT +c+XvvqDtMwt0viAgxGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hv +l7yTmvmcEpB4eoCHFddydJxVdHixuuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5N +iGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZIhvcNAQELBQAD +ggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH +6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwt +LRvM7Kqas6pgghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93 +nAbowacYXVKV7cndJZ5t+qntozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3 ++wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmVYjzlVYA211QC//G5Xc7UI2/YRYRK +W2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUXfeu+h1sXIFRRk0pT +AwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/rokTLq +l1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG +4iZZRHUe2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZ +mUlO+KWA2yUPHGNiiskzZ2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A +7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7RcGzM7vRX+Bi6hG6H +-----END CERTIFICATE----- + +# Issuer: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust +# Subject: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust +# Label: "IdenTrust Public Sector Root CA 1" +# Serial: 13298821034946342390521976156843933698 +# MD5 Fingerprint: 37:06:a5:b0:fc:89:9d:ba:f4:6b:8c:1a:64:cd:d5:ba +# SHA1 Fingerprint: ba:29:41:60:77:98:3f:f4:f3:ef:f2:31:05:3b:2e:ea:6d:4d:45:fd +# SHA256 Fingerprint: 30:d0:89:5a:9a:44:8a:26:20:91:63:55:22:d1:f5:20:10:b5:86:7a:ca:e1:2c:78:ef:95:8f:d4:f4:38:9f:2f +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBN +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVu +VHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcN +MzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0 +MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTyP4o7 +ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGy +RBb06tD6Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlS +bdsHyo+1W/CD80/HLaXIrcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF +/YTLNiCBWS2ab21ISGHKTN9T0a9SvESfqy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R +3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoSmJxZZoY+rfGwyj4GD3vw +EUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFnol57plzy +9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9V +GxyhLrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ +2fjXctscvG29ZV/viDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsV +WaFHVCkugyhfHMKiq3IXAAaOReyL4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gD +W/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMwDQYJKoZIhvcN +AQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj +t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHV +DRDtfULAj+7AmgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9 +TaDKQGXSc3z1i9kKlT/YPyNtGtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8G +lwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFtm6/n6J91eEyrRjuazr8FGF1NFTwW +mhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMxNRF4eKLg6TCMf4Df +WN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4Mhn5 ++bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJ +tshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA +GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv +8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - G2" +# Serial: 1246989352 +# MD5 Fingerprint: 4b:e2:c9:91:96:65:0c:f4:0e:5a:93:92:a0:0a:fe:b2 +# SHA1 Fingerprint: 8c:f4:27:fd:79:0c:3a:d1:66:06:8d:e8:1e:57:ef:bb:93:22:72:d4 +# SHA256 Fingerprint: 43:df:57:74:b0:3e:7f:ef:5f:e4:0d:93:1a:7b:ed:f1:bb:2e:6b:42:73:8c:4e:6d:38:41:10:3d:3a:a7:f3:39 +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 +cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs +IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz +dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy +NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu +dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt +dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 +aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T +RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN +cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW +wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 +U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 +jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN +BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ +jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ +Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v +1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R +nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH +VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - EC1" +# Serial: 51543124481930649114116133369 +# MD5 Fingerprint: b6:7e:1d:f0:58:c5:49:6c:24:3b:3d:ed:98:18:ed:bc +# SHA1 Fingerprint: 20:d8:06:40:df:9b:25:f5:12:25:3a:11:ea:f7:59:8a:eb:14:b5:47 +# SHA256 Fingerprint: 02:ed:0e:b2:8c:14:da:45:16:5c:56:67:91:70:0d:64:51:d7:fb:56:f0:b2:ab:1d:3b:8e:b0:70:e5:6e:df:f5 +-----BEGIN CERTIFICATE----- +MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG +A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 +d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu +dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq +RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy +MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD +VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 +L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g +Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi +A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt +ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH +Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O +BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC +R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX +hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G +-----END CERTIFICATE----- + +# Issuer: CN=CFCA EV ROOT O=China Financial Certification Authority +# Subject: CN=CFCA EV ROOT O=China Financial Certification Authority +# Label: "CFCA EV ROOT" +# Serial: 407555286 +# MD5 Fingerprint: 74:e1:b6:ed:26:7a:7a:44:30:33:94:ab:7b:27:81:30 +# SHA1 Fingerprint: e2:b8:29:4b:55:84:ab:6b:58:c2:90:46:6c:ac:3f:b8:39:8f:84:83 +# SHA256 Fingerprint: 5c:c3:d7:8e:4e:1d:5e:45:54:7a:04:e6:87:3e:64:f9:0c:f9:53:6d:1c:cc:2e:f8:00:f3:55:c4:c5:fd:70:fd +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD +TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y +aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx +MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j +aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP +T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03 +sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL +TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5 +/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp +7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz +EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt +hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP +a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot +aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg +TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV +PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv +cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL +tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd +BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB +ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT +ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL +jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS +ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy +P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19 +xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d +Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN +5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe +/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z +AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ +5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su +-----END CERTIFICATE----- + +# Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed +# Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed +# Label: "OISTE WISeKey Global Root GB CA" +# Serial: 157768595616588414422159278966750757568 +# MD5 Fingerprint: a4:eb:b9:61:28:2e:b7:2f:98:b0:35:26:90:99:51:1d +# SHA1 Fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed +# SHA256 Fingerprint: 6b:9c:08:e8:6e:b0:f7:67:cf:ad:65:cd:98:b6:21:49:e5:49:4a:67:f5:84:5e:7b:d1:ed:01:9f:27:b8:6b:d6 +-----BEGIN CERTIFICATE----- +MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBt +MQswCQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUg +Rm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9i +YWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAwMzJaFw0zOTEyMDExNTEwMzFaMG0x +CzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBG +b3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh +bCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3 +HEokKtaXscriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGx +WuR51jIjK+FTzJlFXHtPrby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX +1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNk +u7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4oQnc/nSMbsrY9gBQHTC5P +99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvgGUpuuy9r +M2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUB +BAMCAQAwDQYJKoZIhvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrgh +cViXfa43FK8+5/ea4n32cZiZBKpDdHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5 +gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0VQreUGdNZtGn//3ZwLWoo4rO +ZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEuiHZeeevJuQHHf +aPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic +Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= +-----END CERTIFICATE----- + +# Issuer: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. +# Subject: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. +# Label: "SZAFIR ROOT CA2" +# Serial: 357043034767186914217277344587386743377558296292 +# MD5 Fingerprint: 11:64:c1:89:b0:24:b1:8c:b1:07:7e:89:9e:51:9e:99 +# SHA1 Fingerprint: e2:52:fa:95:3f:ed:db:24:60:bd:6e:28:f3:9c:cc:cf:5e:b3:3f:de +# SHA256 Fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe +-----BEGIN CERTIFICATE----- +MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQEL +BQAwUTELMAkGA1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6 +ZW5pb3dhIFMuQS4xGDAWBgNVBAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkw +NzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9L +cmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYDVQQDDA9TWkFGSVIg +Uk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5QqEvN +QLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT +3PSQ1hNKDJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw +3gAeqDRHu5rr/gsUvTaE2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr6 +3fE9biCloBK0TXC5ztdyO4mTp4CEHCdJckm1/zuVnsHMyAHs6A6KCpbns6aH5db5 +BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwiieDhZNRnvDF5YTy7ykHN +XGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsF +AAOCAQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw +8PRBEew/R40/cof5O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOG +nXkZ7/e7DDWQw4rtTw/1zBLZpD67oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCP +oky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul4+vJhaAlIDf7js4MNIThPIGy +d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg +LvWpCz/UXeHPhJ/iGcJfitYgHuNztw== +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Network CA 2" +# Serial: 44979900017204383099463764357512596969 +# MD5 Fingerprint: 6d:46:9e:d9:25:6d:08:23:5b:5e:74:7d:1e:27:db:f2 +# SHA1 Fingerprint: d3:dd:48:3e:2b:bf:4c:05:e8:af:10:f5:fa:76:26:cf:d3:dc:30:92 +# SHA256 Fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 +-----BEGIN CERTIFICATE----- +MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCB +gDELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu +QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIG +A1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQSAyMCIYDzIwMTExMDA2MDgz +OTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQTDEiMCAGA1UEChMZ +VW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3 +b3JrIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWA +DGSdhhuWZGc/IjoedQF97/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn +0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+oCgCXhVqqndwpyeI1B+twTUrWwbNWuKFB +OJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40bRr5HMNUuctHFY9rnY3lE +fktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2puTRZCr+E +Sv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1m +o130GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02i +sx7QBlrd9pPPV3WZ9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOW +OZV7bIBaTxNyxtd9KXpEulKkKtVBRgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgez +Tv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pyehizKV/Ma5ciSixqClnrDvFAS +adgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vMBhBgu4M1t15n +3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMC +AQYwDQYJKoZIhvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQ +F/xlhMcQSZDe28cmk4gmb3DWAl45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTf +CVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuAL55MYIR4PSFk1vtBHxgP58l1cb29 +XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMoclm2q8KMZiYcdywm +djWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tMpkT/ +WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jb +AoJnwTnbw3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksq +P/ujmv5zMnHCnsZy4YpoJ/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Ko +b7a6bINDd82Kkhehnlt4Fj1F4jNy3eFmypnTycUm/Q1oBEauttmbjL4ZvrHG8hnj +XALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLXis7VmFxWlgPF7ncGNf/P +5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7zAYspsbi +DrW5viSP +-----END CERTIFICATE----- + +# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Subject: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Label: "Hellenic Academic and Research Institutions RootCA 2015" +# Serial: 0 +# MD5 Fingerprint: ca:ff:e2:db:03:d9:cb:4b:e9:0f:ad:84:fd:7b:18:ce +# SHA1 Fingerprint: 01:0c:06:95:a6:98:19:14:ff:bf:5f:c6:b0:b6:95:ea:29:e9:12:a6 +# SHA256 Fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 +-----BEGIN CERTIFICATE----- +MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1Ix +DzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5k +IFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMT +N0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9v +dENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAxMTIxWjCBpjELMAkG +A1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNh +ZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkx +QDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 +dGlvbnMgUm9vdENBIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC +AQDC+Kk/G4n8PDwEXT2QNrCROnk8ZlrvbTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA +4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+ehiGsxr/CL0BgzuNtFajT0 +AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+6PAQZe10 +4S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06C +ojXdFPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV +9Cz82XBST3i4vTwri5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrD +gfgXy5I2XdGj2HUb4Ysn6npIQf1FGQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6 +Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2fu/Z8VFRfS0myGlZYeCsargq +NhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9muiNX6hME6wGko +LfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc +Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNV +HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVd +ctA4GGqd83EkVAswDQYJKoZIhvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0I +XtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+D1hYc2Ryx+hFjtyp8iY/xnmMsVMI +M4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrMd/K4kPFox/la/vot +9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+yd+2V +Z5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/ea +j8GsGsVn82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnh +X9izjFk0WaSrT2y7HxjbdavYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQ +l033DlZdwJVqwjbDG2jJ9SrcR5q+ss7FJej6A7na+RZukYT1HCjI/CbM1xyQVqdf +bzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVtJ94Cj8rDtSvK6evIIVM4 +pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGaJI7ZjnHK +e7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0 +vm9qp/UsQu0yrbYhnr68 +-----END CERTIFICATE----- + +# Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Label: "Hellenic Academic and Research Institutions ECC RootCA 2015" +# Serial: 0 +# MD5 Fingerprint: 81:e5:b4:17:eb:c2:f5:e1:4b:0d:41:7b:49:92:fe:ef +# SHA1 Fingerprint: 9f:f1:71:8d:92:d5:9a:f3:7d:74:97:b4:bc:6f:84:68:0b:ba:b6:66 +# SHA256 Fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b1:15:82:dc:48:7b:48:33 +-----BEGIN CERTIFICATE----- +MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzAN +BgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl +c2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hl +bGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgRUNDIFJv +b3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEwMzcxMlowgaoxCzAJ +BgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmljIEFj +YWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5 +MUQwQgYDVQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0 +dXRpb25zIEVDQyBSb290Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKg +QehLgoRc4vgxEZmGZE4JJS+dQS8KrjVPdJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJa +jq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoKVlp8aQuqgAkkbH7BRqNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLQi +C4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaep +lSTAGiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7Sof +TUwJCA3sS61kFyjndc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR +-----END CERTIFICATE----- + +# Issuer: CN=ISRG Root X1 O=Internet Security Research Group +# Subject: CN=ISRG Root X1 O=Internet Security Research Group +# Label: "ISRG Root X1" +# Serial: 172886928669790476064670243504169061120 +# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e +# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8 +# SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- + +# Issuer: O=FNMT-RCM OU=AC RAIZ FNMT-RCM +# Subject: O=FNMT-RCM OU=AC RAIZ FNMT-RCM +# Label: "AC RAIZ FNMT-RCM" +# Serial: 485876308206448804701554682760554759 +# MD5 Fingerprint: e2:09:04:b4:d3:bd:d1:a0:14:fd:1a:d2:47:c4:57:1d +# SHA1 Fingerprint: ec:50:35:07:b2:15:c4:95:62:19:e2:a8:9a:5b:42:99:2c:4c:2c:20 +# SHA256 Fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsx +CzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJ +WiBGTk1ULVJDTTAeFw0wODEwMjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJ +BgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBG +Tk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALpxgHpMhm5/ +yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcfqQgf +BBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAz +WHFctPVrbtQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxF +tBDXaEAUwED653cXeuYLj2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z +374jNUUeAlz+taibmSXaXvMiwzn15Cou08YfxGyqxRxqAQVKL9LFwag0Jl1mpdIC +IfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mwWsXmo8RZZUc1g16p6DUL +mbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnTtOmlcYF7 +wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peS +MKGJ47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2 +ZSysV4999AeU14ECll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMet +UqIJ5G+GR4of6ygnXYMgrwTJbFaai0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUw +AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPd9xf3E6Jobd2Sn9R2gzL+H +YJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwOi8vd3d3 +LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD +nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1 +RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYM +LVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf +77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2N +JpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jm +fZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp +6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp +1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B +9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wok +RqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYv +uu8wd+RU4riEmViAqhOLUTpPSPaLtrM= +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 1 O=Amazon +# Subject: CN=Amazon Root CA 1 O=Amazon +# Label: "Amazon Root CA 1" +# Serial: 143266978916655856878034712317230054538369994 +# MD5 Fingerprint: 43:c6:bf:ae:ec:fe:ad:2f:18:c6:88:68:30:fc:c8:e6 +# SHA1 Fingerprint: 8d:a7:f9:65:ec:5e:fc:37:91:0f:1c:6e:59:fd:c1:cc:6a:6e:de:16 +# SHA256 Fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e +-----BEGIN CERTIFICATE----- +MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF +ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 +b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL +MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv +b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj +ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM +9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw +IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6 +VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L +93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm +jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA +A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI +U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs +N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv +o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU +5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy +rqXRfboQnoZsG4q5WTP468SQvvG5 +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 2 O=Amazon +# Subject: CN=Amazon Root CA 2 O=Amazon +# Label: "Amazon Root CA 2" +# Serial: 143266982885963551818349160658925006970653239 +# MD5 Fingerprint: c8:e5:8d:ce:a8:42:e2:7a:c0:2a:5c:7c:9e:26:bf:66 +# SHA1 Fingerprint: 5a:8c:ef:45:d7:a6:98:59:76:7a:8c:8b:44:96:b5:78:cf:47:4b:1a +# SHA256 Fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF +ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 +b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL +MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv +b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK +gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ +W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg +1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K +8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r +2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me +z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR +8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj +mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz +7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6 ++XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI +0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB +Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm +UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2 +LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY ++gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS +k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl +7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm +btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl +urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+ +fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63 +n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE +76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H +9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT +4PsJYGw= +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 3 O=Amazon +# Subject: CN=Amazon Root CA 3 O=Amazon +# Label: "Amazon Root CA 3" +# Serial: 143266986699090766294700635381230934788665930 +# MD5 Fingerprint: a0:d4:ef:0b:f7:b5:d8:49:95:2a:ec:f5:c4:fc:81:87 +# SHA1 Fingerprint: 0d:44:dd:8c:3c:8c:1a:1a:58:75:64:81:e9:0f:2e:2a:ff:b3:d2:6e +# SHA256 Fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:69:f5:03:43:b4:6d:b3:a4 +-----BEGIN CERTIFICATE----- +MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5 +MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g +Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG +A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg +Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl +ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr +ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr +BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM +YyRIHN8wfdVoOw== +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 4 O=Amazon +# Subject: CN=Amazon Root CA 4 O=Amazon +# Label: "Amazon Root CA 4" +# Serial: 143266989758080763974105200630763877849284878 +# MD5 Fingerprint: 89:bc:27:d5:eb:17:8d:06:6a:69:d5:fd:89:47:b4:cd +# SHA1 Fingerprint: f6:10:84:07:d6:f8:bb:67:98:0c:c2:e2:44:c2:eb:ae:1c:ef:63:be +# SHA256 Fingerprint: e3:5d:28:41:9e:d0:20:25:cf:a6:90:38:cd:62:39:62:45:8d:a5:c6:95:fb:de:a3:c2:2b:0b:fb:25:89:70:92 +-----BEGIN CERTIFICATE----- +MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5 +MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g +Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG +A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg +Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi +9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk +M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB +MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw +CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW +1KyLa2tJElMzrdfkviT8tQp21KW8EA== +-----END CERTIFICATE----- + +# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1" +# Serial: 1 +# MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49 +# SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca +# SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 +-----BEGIN CERTIFICATE----- +MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx +GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp +bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w +KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0 +BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy +dW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYDVQQG +EwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXll +IEJpbGltc2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklU +QUsxLTArBgNVBAsTJEthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBT +TTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11IFNNIFNTTCBLb2sgU2VydGlmaWthc2kg +LSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr3UwM6q7 +a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y86Ij5iySr +LqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INr +N3wcwv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2X +YacQuFWQfw4tJzh03+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/ +iSIzL+aFCr2lqBs23tPcLG07xxO9WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4f +AJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQUZT/HiobGPN08VFw1+DrtUgxH +V8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh +AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPf +IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4 +lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c +8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf +lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= +-----END CERTIFICATE----- + +# Issuer: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. +# Subject: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. +# Label: "GDCA TrustAUTH R5 ROOT" +# Serial: 9009899650740120186 +# MD5 Fingerprint: 63:cc:d9:3d:34:35:5c:6f:53:a3:e2:08:70:48:1f:b4 +# SHA1 Fingerprint: 0f:36:38:5b:81:1a:25:c3:9b:31:4e:83:ca:e9:34:66:70:cc:74:b4 +# SHA256 Fingerprint: bf:ff:8f:d0:44:33:48:7d:6a:8a:a6:0c:1a:29:76:7a:9f:c2:bb:b0:5e:42:0f:71:3a:13:b9:92:89:1d:38:93 +-----BEGIN CERTIFICATE----- +MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UE +BhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ +IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0 +MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVowYjELMAkGA1UEBhMCQ04xMjAwBgNV +BAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8w +HQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJj +Dp6L3TQsAlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBj +TnnEt1u9ol2x8kECK62pOqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+u +KU49tm7srsHwJ5uu4/Ts765/94Y9cnrrpftZTqfrlYwiOXnhLQiPzLyRuEH3FMEj +qcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ9Cy5WmYqsBebnh52nUpm +MUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQxXABZG12 +ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloP +zgsMR6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3Gk +L30SgLdTMEZeS1SZD2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeC +jGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4oR24qoAATILnsn8JuLwwoC8N9VKejveSswoA +HQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx9hoh49pwBiFYFIeFd3mqgnkC +AwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlRMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg +p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZm +DRd9FBUb1Ov9H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5 +COmSdI31R9KrO9b7eGZONn356ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ry +L3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd+PwyvzeG5LuOmCd+uh8W4XAR8gPf +JWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQHtZa37dG/OaG+svg +IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io +2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV +09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ +XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq +T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe +MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g== +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com Root Certification Authority RSA O=SSL Corporation +# Subject: CN=SSL.com Root Certification Authority RSA O=SSL Corporation +# Label: "SSL.com Root Certification Authority RSA" +# Serial: 8875640296558310041 +# MD5 Fingerprint: 86:69:12:c0:70:f1:ec:ac:ac:c2:d5:bc:a5:5b:a1:29 +# SHA1 Fingerprint: b7:ab:33:08:d1:ea:44:77:ba:14:80:12:5a:6f:bd:a9:36:49:0c:bb +# SHA256 Fingerprint: 85:66:6a:56:2e:e0:be:5c:e9:25:c1:d8:89:0a:6f:76:a8:7e:c1:6d:4d:7d:5f:29:ea:74:19:cf:20:12:3b:69 +-----BEGIN CERTIFICATE----- +MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UE +BhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQK +DA9TU0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYwMjEyMTczOTM5WhcNNDEwMjEyMTcz +OTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv +dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv +bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcN +AQEBBQADggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2R +xFdHaxh3a3by/ZPkPQ/CFp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aX +qhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcC +C52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/geoeOy3ZExqysdBP+lSgQ3 +6YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkpk8zruFvh +/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrF +YD3ZfBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93E +JNyAKoFBbZQ+yODJgUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVc +US4cK38acijnALXRdMbX5J+tB5O2UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8 +ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi81xtZPCvM8hnIk2snYxnP/Okm ++Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4sbE6x/c+cCbqi +M+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV +HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4G +A1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGV +cpNxJK1ok1iOMq8bs3AD/CUrdIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBc +Hadm47GUBwwyOabqG7B52B2ccETjit3E+ZUfijhDPwGFpUenPUayvOUiaPd7nNgs +PgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAslu1OJD7OAUN5F7kR/ +q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjqerQ0 +cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jr +a6x+3uxjMxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90I +H37hVZkLId6Tngr75qNJvTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/Y +K9f1JmzJBjSWFupwWRoyeXkLtoh/D1JIPb9s2KJELtFOt3JY04kTlf5Eq/jXixtu +nLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktuf +oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY +Ic2wBlX7Jz9TkHCpBB5XJ7k= +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com Root Certification Authority ECC O=SSL Corporation +# Subject: CN=SSL.com Root Certification Authority ECC O=SSL Corporation +# Label: "SSL.com Root Certification Authority ECC" +# Serial: 8495723813297216424 +# MD5 Fingerprint: 2e:da:e4:39:7f:9c:8f:37:d1:70:9f:26:17:51:3a:8e +# SHA1 Fingerprint: c3:19:7c:39:24:e6:54:af:1b:c4:ab:20:95:7a:e2:c3:0e:13:02:6a +# SHA256 Fingerprint: 34:17:bb:06:cc:60:07:da:1b:96:1c:92:0b:8a:b4:ce:3f:ad:82:0e:4a:a3:0b:9a:cb:c4:a7:4e:bd:ce:bc:65 +-----BEGIN CERTIFICATE----- +MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMC +VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T +U0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0 +aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNDAzWhcNNDEwMjEyMTgxNDAz +WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0 +b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNvbSBS +b290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI +7Z4INcgn64mMU1jrYor+8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPg +CemB+vNH06NjMGEwHQYDVR0OBBYEFILRhXMw5zUE044CkvvlpNHEIejNMA8GA1Ud +EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTTjgKS++Wk0cQh6M0wDgYD +VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T +kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+ +gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation +# Subject: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation +# Label: "SSL.com EV Root Certification Authority RSA R2" +# Serial: 6248227494352943350 +# MD5 Fingerprint: e1:1e:31:58:1a:ae:54:53:02:f6:17:6a:11:7b:4d:95 +# SHA1 Fingerprint: 74:3a:f0:52:9b:d0:32:a0:f4:4a:83:cd:d4:ba:a9:7b:7c:2e:c4:9a +# SHA256 Fingerprint: 2e:7b:f1:6c:c2:24:85:a7:bb:e2:aa:86:96:75:07:61:b0:ae:39:be:3b:2f:e9:d0:cc:6d:4e:f7:34:91:42:5c +-----BEGIN CERTIFICATE----- +MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNV +BAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UE +CgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2Vy +dGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMB4XDTE3MDUzMTE4MTQzN1oXDTQy +MDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4G +A1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQD +DC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvq +M0fNTPl9fb69LT3w23jhhqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssuf +OePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7wcXHswxzpY6IXFJ3vG2fThVUCAtZJycxa +4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTOZw+oz12WGQvE43LrrdF9 +HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+B6KjBSYR +aZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcA +b9ZhCBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQ +Gp8hLH94t2S42Oim9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQV +PWKchjgGAGYS5Fl2WlPAApiiECtoRHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMO +pgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+SlmJuwgUHfbSguPvuUCYHBBXtSu +UDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48+qvWBkofZ6aY +MBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV +HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa4 +9QaAJadz20ZpqJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBW +s47LCp1Jjr+kxJG7ZhcFUZh1++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5 +Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nxY/hoLVUE0fKNsKTPvDxeH3jnpaAg +cLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2GguDKBAdRUNf/ktUM +79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDzOFSz +/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXt +ll9ldDz7CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEm +Kf7GUmG6sXP/wwyc5WxqlD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKK +QbNmC1r7fSOl8hqw/96bg5Qu0T/fkreRrwU7ZcegbLHNYhLDkBvjJc40vG93drEQ +w/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooi +S9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07 +mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation +# Subject: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation +# Label: "SSL.com EV Root Certification Authority ECC" +# Serial: 3182246526754555285 +# MD5 Fingerprint: 59:53:22:65:83:42:01:54:c0:ce:42:b9:5a:7c:f2:90 +# SHA1 Fingerprint: 4c:dd:51:a3:d1:f5:20:32:14:b0:c6:c5:32:23:03:91:c7:46:42:6d +# SHA256 Fingerprint: 22:a2:c1:f7:bd:ed:70:4c:c1:e7:01:b5:f4:08:c3:10:88:0f:e9:56:b5:de:2a:4a:44:f9:9c:87:3a:25:a7:c8 +-----BEGIN CERTIFICATE----- +MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMC +VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T +U0wgQ29ycG9yYXRpb24xNDAyBgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNTIzWhcNNDEwMjEyMTgx +NTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv +dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NMLmNv +bSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49 +AgEGBSuBBAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMA +VIbc/R/fALhBYlzccBYy3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1Kthku +WnBaBu2+8KGwytAJKaNjMGEwHQYDVR0OBBYEFFvKXuXe0oGqzagtZFG22XKbl+ZP +MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe5d7SgarNqC1kUbbZcpuX +5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJN+vp1RPZ +ytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZg +h5Mmm7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 +# Label: "GlobalSign Root CA - R6" +# Serial: 1417766617973444989252670301619537 +# MD5 Fingerprint: 4f:dd:07:e4:d4:22:64:39:1e:0c:37:42:ea:d1:c6:ae +# SHA1 Fingerprint: 80:94:64:0e:b5:a7:a1:ca:11:9c:1f:dd:d5:9f:81:02:63:a7:fb:d1 +# SHA256 Fingerprint: 2c:ab:ea:fe:37:d0:6c:a2:2a:ba:73:91:c0:03:3d:25:98:29:52:c4:53:64:73:49:76:3a:3a:b5:ad:6c:cf:69 +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEg +MB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2Jh +bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQx +MjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjET +MBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCAiIwDQYJ +KoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQssgrRI +xutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1k +ZguSgMpE3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxD +aNc9PIrFsmbVkJq3MQbFvuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJw +LnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqMPKq0pPbzlUoSB239jLKJz9CgYXfIWHSw +1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+azayOeSsJDa38O+2HBNX +k7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05OWgtH8wY2 +SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/h +bguyCLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4n +WUx2OVvq+aWh2IMP0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpY +rZxCRXluDocZXFSxZba/jJvcE+kNb7gu3GduyYsRtYQUigAZcIN5kZeR1Bonvzce +MgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNVHSMEGDAWgBSu +bAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN +nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGt +Ixg93eFyRJa0lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr61 +55wsTLxDKZmOMNOsIeDjHfrYBzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLj +vUYAGm0CuiVdjaExUd1URhxN25mW7xocBFymFe944Hn+Xds+qkxV/ZoVqW/hpvvf +cDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr3TsTjxKM4kEaSHpz +oHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB10jZp +nOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfs +pA9MRf/TuTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+v +JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R +8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW4 +5hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA= +-----END CERTIFICATE----- + +# Issuer: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed +# Subject: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed +# Label: "OISTE WISeKey Global Root GC CA" +# Serial: 44084345621038548146064804565436152554 +# MD5 Fingerprint: a9:d6:b9:2d:2f:93:64:f8:a5:69:ca:91:e9:68:07:23 +# SHA1 Fingerprint: e0:11:84:5e:34:de:be:88:81:b9:9c:f6:16:26:d1:96:1f:c3:b9:31 +# SHA256 Fingerprint: 85:60:f9:1c:36:24:da:ba:95:70:b5:fe:a0:db:e3:6f:f1:1a:83:23:be:94:86:85:4f:b3:f3:4a:55:71:19:8d +-----BEGIN CERTIFICATE----- +MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQsw +CQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91 +bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwg +Um9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRaFw00MjA1MDkwOTU4MzNaMG0xCzAJ +BgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBGb3Vu +ZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2JhbCBS +b290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4ni +eUqjFqdrVCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4W +p2OQ0jnUsYd4XxiWD1AbNTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7T +rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV +57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtkAjEA2zQg +Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 +-----END CERTIFICATE----- + +# Issuer: CN=UCA Global G2 Root O=UniTrust +# Subject: CN=UCA Global G2 Root O=UniTrust +# Label: "UCA Global G2 Root" +# Serial: 124779693093741543919145257850076631279 +# MD5 Fingerprint: 80:fe:f0:c4:4a:f0:5c:62:32:9f:1c:ba:78:a9:50:f8 +# SHA1 Fingerprint: 28:f9:78:16:19:7a:ff:18:25:18:aa:44:fe:c1:a0:ce:5c:b6:4c:8a +# SHA256 Fingerprint: 9b:ea:11:c9:76:fe:01:47:64:c1:be:56:a6:f9:14:b5:a5:60:31:7a:bd:99:88:39:33:82:e5:16:1a:a0:49:3c +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9 +MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBH +bG9iYWwgRzIgUm9vdDAeFw0xNjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0x +CzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlUcnVzdDEbMBkGA1UEAwwSVUNBIEds +b2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxeYr +b3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmToni9 +kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzm +VHqUwCoV8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/R +VogvGjqNO7uCEeBHANBSh6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDc +C/Vkw85DvG1xudLeJ1uK6NjGruFZfc8oLTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIj +tm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/R+zvWr9LesGtOxdQXGLY +D0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBeKW4bHAyv +j5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6Dl +NaBa4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6 +iIis7nCs+dwp4wwcOxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznP +O6Q0ibd5Ei9Hxeepl2n8pndntd978XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/ +BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIHEjMz15DD/pQwIX4wV +ZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj +L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5 +1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl +1qnN3e92mI0ADs0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oU +b3n09tDh05S60FdRvScFDcH9yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LV +PtateJLbXDzz2K36uGt/xDYotgIVilQsnLAXc47QN6MUPJiVAAwpBVueSUmxX8fj +y88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHojhJi6IjMtX9Gl8Cb +EGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZkbxqg +DMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI ++Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy +YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bX +UB+K+wb1whnw0A== +-----END CERTIFICATE----- + +# Issuer: CN=UCA Extended Validation Root O=UniTrust +# Subject: CN=UCA Extended Validation Root O=UniTrust +# Label: "UCA Extended Validation Root" +# Serial: 106100277556486529736699587978573607008 +# MD5 Fingerprint: a1:f3:5f:43:c6:34:9b:da:bf:8c:7e:05:53:ad:96:e2 +# SHA1 Fingerprint: a3:a1:b0:6f:24:61:23:4a:e3:36:a5:c2:37:fc:a6:ff:dd:f0:d7:3a +# SHA256 Fingerprint: d4:3a:f9:b3:54:73:75:5c:96:84:fc:06:d7:d8:cb:70:ee:5c:28:e7:73:fb:29:4e:b4:1e:e7:17:22:92:4d:24 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBH +MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBF +eHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMx +MDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNV +BAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrsiWog +D4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvS +sPGP2KxFRv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aop +O2z6+I9tTcg1367r3CTueUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dk +sHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR59mzLC52LqGj3n5qiAno8geK+LLNEOfi +c0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH0mK1lTnj8/FtDw5lhIpj +VMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KRel7sFsLz +KuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/ +TuDvB0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41G +sx2VYVdWf6/wFlthWG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs +1+lvK9JKBZP8nm9rZ/+I8U6laUpSNwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQD +fwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS3H5aBZ8eNJr34RQwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADaN +l8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR +ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQ +VBcZEhrxH9cMaVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5 +c6sq1WnIeJEmMX3ixzDx/BR4dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp +4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb+7lsq+KePRXBOy5nAliRn+/4Qh8s +t2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOWF3sGPjLtx7dCvHaj +2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwiGpWO +vpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2C +xR9GUeOcGMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmx +cmtpzyKEC2IPrNkZAJSidjzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbM +fjKaiJUINlK73nZfdklJrX+9ZSCyycErdhh2n1ax +-----END CERTIFICATE----- + +# Issuer: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 +# Subject: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 +# Label: "Certigna Root CA" +# Serial: 269714418870597844693661054334862075617 +# MD5 Fingerprint: 0e:5c:30:62:27:eb:5b:bc:d7:ae:62:ba:e9:d5:df:77 +# SHA1 Fingerprint: 2d:0d:52:14:ff:9e:ad:99:24:01:74:20:47:6e:6c:85:27:27:f5:43 +# SHA256 Fingerprint: d4:8d:3d:23:ee:db:50:a4:59:e5:51:97:60:1c:27:77:4b:9d:7b:18:c9:4d:5a:05:95:11:a1:02:50:b9:31:68 +-----BEGIN CERTIFICATE----- +MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAw +WjELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAw +MiA0ODE0NjMwODEwMDAzNjEZMBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0x +MzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjdaMFoxCzAJBgNVBAYTAkZSMRIwEAYD +VQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYzMDgxMDAwMzYxGTAX +BgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sO +ty3tRQgXstmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9M +CiBtnyN6tMbaLOQdLNyzKNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPu +I9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8JXrJhFwLrN1CTivngqIkicuQstDuI7pm +TLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16XdG+RCYyKfHx9WzMfgIh +C59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq4NYKpkDf +ePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3Yz +IoejwpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWT +Co/1VTp2lc5ZmIoJlXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1k +JWumIWmbat10TWuXekG9qxf5kBdIjzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5 +hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp//TBt2dzhauH8XwIDAQABo4IB +GjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of +1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczov +L3d3d3cuY2VydGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilo +dHRwOi8vY3JsLmNlcnRpZ25hLmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYr +aHR0cDovL2NybC5kaGlteW90aXMuY29tL2NlcnRpZ25hcm9vdGNhLmNybDANBgkq +hkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOItOoldaDgvUSILSo3L +6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxPTGRG +HVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH6 +0BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB +lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdi +o2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1 +gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/v +faci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63 +Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayh +jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw +3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0= +-----END CERTIFICATE----- + +# Issuer: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI +# Subject: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI +# Label: "emSign Root CA - G1" +# Serial: 235931866688319308814040 +# MD5 Fingerprint: 9c:42:84:57:dd:cb:0b:a7:2e:95:ad:b6:f3:da:bc:ac +# SHA1 Fingerprint: 8a:c7:ad:8f:73:ac:4e:c1:b5:75:4d:a5:40:f4:fc:cf:7c:b5:8e:8c +# SHA256 Fingerprint: 40:f6:af:03:46:a9:9a:a1:cd:1d:55:5a:4e:9c:ce:62:c7:f9:63:46:03:ee:40:66:15:83:3d:c8:c8:d0:03:67 +-----BEGIN CERTIFICATE----- +MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYD +VQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBU +ZWNobm9sb2dpZXMgTGltaXRlZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBH +MTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgxODMwMDBaMGcxCzAJBgNVBAYTAklO +MRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVkaHJhIFRlY2hub2xv +Z2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQz +f2N4aLTNLnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO +8oG0x5ZOrRkVUkr+PHB1cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aq +d7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHWDV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhM +tTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ6DqS0hdW5TUaQBw+jSzt +Od9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrHhQIDAQAB +o0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQD +AgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31x +PaOfG1vR2vjTnGs2vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjM +wiI/aTvFthUvozXGaCocV685743QNcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6d +GNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q+Mri/Tm3R7nrft8EI6/6nAYH +6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeihU80Bv2noWgby +RQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx +iN66zB+Afko= +-----END CERTIFICATE----- + +# Issuer: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI +# Subject: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI +# Label: "emSign ECC Root CA - G3" +# Serial: 287880440101571086945156 +# MD5 Fingerprint: ce:0b:72:d1:9f:88:8e:d0:50:03:e8:e3:b8:8b:67:40 +# SHA1 Fingerprint: 30:43:fa:4f:f2:57:dc:a0:c3:80:ee:2e:58:ea:78:b2:3f:e6:bb:c1 +# SHA256 Fingerprint: 86:a1:ec:ba:08:9c:4a:8d:3b:be:27:34:c6:12:ba:34:1d:81:3e:04:3c:f9:e8:a8:62:cd:5c:57:a3:6b:be:6b +-----BEGIN CERTIFICATE----- +MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG +EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo +bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g +RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ +TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s +b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw +djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 +WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS +fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB +zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq +hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB +CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD ++JbNR6iC8hZVdyR+EhCVBCyj +-----END CERTIFICATE----- + +# Issuer: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI +# Subject: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI +# Label: "emSign Root CA - C1" +# Serial: 825510296613316004955058 +# MD5 Fingerprint: d8:e3:5d:01:21:fa:78:5a:b0:df:ba:d2:ee:2a:5f:68 +# SHA1 Fingerprint: e7:2e:f1:df:fc:b2:09:28:cf:5d:d4:d5:67:37:b1:51:cb:86:4f:01 +# SHA256 Fingerprint: 12:56:09:aa:30:1d:a0:a2:49:b9:7a:82:39:cb:6a:34:21:6f:44:dc:ac:9f:39:54:b1:42:92:f2:e8:c8:60:8f +-----BEGIN CERTIFICATE----- +MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkG +A1UEBhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEg +SW5jMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAw +MFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln +biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNpZ24gUm9v +dCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+upufGZ +BczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZ +HdPIWoU/Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH +3DspVpNqs8FqOp099cGXOFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvH +GPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4VI5b2P/AgNBbeCsbEBEV5f6f9vtKppa+c +xSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleoomslMuoaJuvimUnzYnu3Yy1 +aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+XJGFehiq +TbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87 +/kOXSTKZEhVb3xEp/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4 +kqNPEjE2NuLe/gDEo2APJ62gsIq1NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrG +YQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9wC68AivTxEDkigcxHpvOJpkT ++xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQBmIMMMAVSKeo +WXzhriKi4gp6D/piq1JM4fHfyr6DDUI= +-----END CERTIFICATE----- + +# Issuer: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI +# Subject: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI +# Label: "emSign ECC Root CA - C3" +# Serial: 582948710642506000014504 +# MD5 Fingerprint: 3e:53:b3:a3:81:ee:d7:10:f8:d3:b0:1d:17:92:f5:d5 +# SHA1 Fingerprint: b6:af:43:c2:9b:81:53:7d:f6:ef:6b:c3:1f:1f:60:15:0c:ee:48:66 +# SHA256 Fingerprint: bc:4d:80:9b:15:18:9d:78:db:3e:1d:8c:f4:f9:72:6a:79:5d:a1:64:3c:a5:f1:35:8e:1d:db:0e:dc:0d:7e:b3 +-----BEGIN CERTIFICATE----- +MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQG +EwJVUzETMBEGA1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMx +IDAeBgNVBAMTF2VtU2lnbiBFQ0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAw +MFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln +biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQDExdlbVNpZ24gRUND +IFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd6bci +MK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4Ojavti +sIGJAnB9SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0O +BBYEFPtaSNCAIEDyqOkAB2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB +Af8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQC02C8Cif22TGK6Q04ThHK1rt0c +3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwUZOR8loMRnLDRWmFLpg9J +0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== +-----END CERTIFICATE----- + +# Issuer: CN=Hongkong Post Root CA 3 O=Hongkong Post +# Subject: CN=Hongkong Post Root CA 3 O=Hongkong Post +# Label: "Hongkong Post Root CA 3" +# Serial: 46170865288971385588281144162979347873371282084 +# MD5 Fingerprint: 11:fc:9f:bd:73:30:02:8a:fd:3f:f3:58:b9:cb:20:f0 +# SHA1 Fingerprint: 58:a2:d0:ec:20:52:81:5b:c1:f3:f8:64:02:24:4e:c2:8e:02:4b:02 +# SHA256 Fingerprint: 5a:2f:c0:3f:0c:83:b0:90:bb:fa:40:60:4b:09:88:44:6c:76:36:18:3d:f9:84:6e:17:10:1a:44:7f:b8:ef:d6 +-----BEGIN CERTIFICATE----- +MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQEL +BQAwbzELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJ +SG9uZyBLb25nMRYwFAYDVQQKEw1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25n +a29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2MDMwMjI5NDZaFw00MjA2MDMwMjI5 +NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcxEjAQBgNVBAcT +CUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMXSG9u +Z2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCziNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFO +dem1p+/l6TWZ5Mwc50tfjTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mI +VoBc+L0sPOFMV4i707mV78vH9toxdCim5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV +9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOesL4jpNrcyCse2m5FHomY +2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj0mRiikKY +vLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+Tt +bNe/JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZb +x39ri1UbSsUgYT2uy1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+ +l2oBlKN8W4UdKjk60FSh0Tlxnf0h+bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YK +TE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsGxVd7GYYKecsAyVKvQv83j+Gj +Hno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwIDAQABo2MwYTAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e +i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEw +DQYJKoZIhvcNAQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG +7BJ8dNVI0lkUmcDrudHr9EgwW62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCk +MpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWldy8joRTnU+kLBEUx3XZL7av9YROXr +gZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov+BS5gLNdTaqX4fnk +GMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDceqFS +3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJm +Ozj/2ZQw9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+ +l6mc1X5VTMbeRRAc6uk7nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6c +JfTzPV4e0hz5sy229zdcxsshTrD3mUcYhcErulWuBurQB7Lcq9CClnXO0lD+mefP +L5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB60PZ2Pierc+xYw5F9KBa +LJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fqdBb9HxEG +mpv0 +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - G4" +# Serial: 289383649854506086828220374796556676440 +# MD5 Fingerprint: 89:53:f1:83:23:b7:7c:8e:05:f1:8c:71:38:4e:1f:88 +# SHA1 Fingerprint: 14:88:4e:86:26:37:b0:26:af:59:62:5c:40:77:ec:35:29:ba:96:01 +# SHA256 Fingerprint: db:35:17:d1:f6:73:2a:2d:5a:b9:7c:53:3e:c7:07:79:ee:32:70:a6:2f:b4:ac:42:38:37:24:60:e6:f0:1e:88 +-----BEGIN CERTIFICATE----- +MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAw +gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL +Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg +MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw +BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0 +MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1 +c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJ +bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3Qg +Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0MIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3DumSXbcr3DbVZwbPLqGgZ +2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV3imz/f3E +T+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j +5pds8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAM +C1rlLAHGVK/XqsEQe9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73T +DtTUXm6Hnmo9RR3RXRv06QqsYJn7ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNX +wbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5XxNMhIWNlUpEbsZmOeX7m640A +2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV7rtNOzK+mndm +nqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8 +dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwl +N4y6mACXi0mWHv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNj +c0kCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9nMA0GCSqGSIb3DQEBCwUAA4ICAQAS +5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4QjbRaZIxowLByQzTS +Gwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht7LGr +hFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/ +B7NTeLUKYvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uI +AeV8KEsD+UmDfLJ/fOPtjqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbw +H5Lk6rWS02FREAutp9lfx1/cH6NcjKF+m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+ +b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKWRGhXxNUzzxkvFMSUHHuk +2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjAJOgc47Ol +IQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk +5F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuY +n/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw== +-----END CERTIFICATE----- + +# Issuer: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation +# Subject: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation +# Label: "Microsoft ECC Root Certificate Authority 2017" +# Serial: 136839042543790627607696632466672567020 +# MD5 Fingerprint: dd:a1:03:e6:4a:93:10:d1:bf:f0:19:42:cb:fe:ed:67 +# SHA1 Fingerprint: 99:9a:64:c3:7f:f4:7d:9f:ab:95:f1:47:69:89:14:60:ee:c4:c3:c5 +# SHA256 Fingerprint: 35:8d:f3:9d:76:4a:f9:e1:b7:66:e9:c9:72:df:35:2e:e1:5c:fa:c2:27:af:6a:d1:d7:0e:8e:4a:6e:dc:ba:02 +-----BEGIN CERTIFICATE----- +MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQsw +CQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYD +VQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIw +MTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJV +UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy +b3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQBgcq +hkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZR +ogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYb +hGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E +BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3 +FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zV +L8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUB +iudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M= +-----END CERTIFICATE----- + +# Issuer: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation +# Subject: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation +# Label: "Microsoft RSA Root Certificate Authority 2017" +# Serial: 40975477897264996090493496164228220339 +# MD5 Fingerprint: 10:ff:00:ff:cf:c9:f8:c7:7a:c0:ee:35:8e:c9:0f:47 +# SHA1 Fingerprint: 73:a5:e6:4a:3b:ff:83:16:ff:0e:dc:cc:61:8a:90:6e:4e:ae:4d:74 +# SHA256 Fingerprint: c7:41:f7:0f:4b:2a:8d:88:bf:2e:71:c1:41:22:ef:53:ef:10:eb:a0:cf:a5:e6:4c:fa:20:f4:18:85:30:73:e0 +-----BEGIN CERTIFICATE----- +MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBl +MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw +NAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 +IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIwNzE4MjMwMDIzWjBlMQswCQYDVQQG +EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1N +aWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZ +Nt9GkMml7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0 +ZdDMbRnMlfl7rEqUrQ7eS0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1 +HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw71VdyvD/IybLeS2v4I2wDwAW9lcfNcztm +gGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+dkC0zVJhUXAoP8XFWvLJ +jEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49FyGcohJUc +aDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaG +YaRSMLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6 +W6IYZVcSn2i51BVrlMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4K +UGsTuqwPN1q3ErWQgR5WrlcihtnJ0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH ++FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJClTUFLkqqNfs+avNJVgyeY+Q +W5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC +NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZC +LgLNFgVZJ8og6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OC +gMNPOsduET/m4xaRhPtthH80dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6 +tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk+ONVFT24bcMKpBLBaYVu32TxU5nh +SnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex/2kskZGT4d9Mozd2 +TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDyAmH3 +pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGR +xpl/j8nWZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiApp +GWSZI1b7rCoucL5mxAyE7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9 +dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKTc0QWbej09+CVgI+WXTik9KveCjCHk9hN +AHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZB +RA+GsCyRxj3qrg+E +-----END CERTIFICATE----- + +# Issuer: CN=e-Szigno Root CA 2017 O=Microsec Ltd. +# Subject: CN=e-Szigno Root CA 2017 O=Microsec Ltd. +# Label: "e-Szigno Root CA 2017" +# Serial: 411379200276854331539784714 +# MD5 Fingerprint: de:1f:f6:9e:84:ae:a7:b4:21:ce:1e:58:7d:d1:84:98 +# SHA1 Fingerprint: 89:d4:83:03:4f:9e:9a:48:80:5f:72:37:d4:a9:a6:ef:cb:7c:1f:d1 +# SHA256 Fingerprint: be:b0:0b:30:83:9b:9b:c3:2c:32:e4:44:79:05:95:06:41:f2:64:21:b1:5e:d0:89:19:8b:51:8a:e2:ea:1b:99 +-----BEGIN CERTIFICATE----- +MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNV +BAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRk +LjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJv +b3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZaFw00MjA4MjIxMjA3MDZaMHExCzAJ +BgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMg +THRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25v +IFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtv +xie+RJCxs1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+H +Wyx7xf58etqjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBSHERUI0arBeAyxr87GyZDvvzAEwDAfBgNVHSMEGDAWgBSHERUI0arB +eAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEAtVfd14pVCzbhhkT61Nlo +jbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxOsvxyqltZ ++efcMQ== +-----END CERTIFICATE----- + +# Issuer: O=CERTSIGN SA OU=certSIGN ROOT CA G2 +# Subject: O=CERTSIGN SA OU=certSIGN ROOT CA G2 +# Label: "certSIGN Root CA G2" +# Serial: 313609486401300475190 +# MD5 Fingerprint: 8c:f1:75:8a:c6:19:cf:94:b7:f7:65:20:87:c3:97:c7 +# SHA1 Fingerprint: 26:f9:93:b4:ed:3d:28:27:b0:b9:4b:a7:e9:15:1d:a3:8d:92:e5:32 +# SHA256 Fingerprint: 65:7c:fe:2f:a7:3f:aa:38:46:25:71:f3:32:a2:36:3a:46:fc:e7:02:09:51:71:07:02:cd:fb:b6:ee:da:33:05 +-----BEGIN CERTIFICATE----- +MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNV +BAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04g +Uk9PVCBDQSBHMjAeFw0xNzAyMDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJ +BgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJ +R04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDF +dRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05N0Iw +vlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZ +uIt4ImfkabBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhp +n+Sc8CnTXPnGFiWeI8MgwT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKs +cpc/I1mbySKEwQdPzH/iV8oScLumZfNpdWO9lfsbl83kqK/20U6o2YpxJM02PbyW +xPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91QqhngLjYl/rNUssuHLoPj1P +rCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732jcZZroiF +DsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fx +DTvf95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgy +LcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6C +eWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg4BXrzkwJ +d8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq +kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC +b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQl +qiCA2ClV9+BB/AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0 +OJD7uNGzcgbJceaBxXntC6Z58hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+c +NywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXk +ltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklWatKcsWMy5WHgUyIO +pwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tUSxfj +03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZk +PuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE +1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MX +QRBdJ3NghVdJIgc= +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global Certification Authority" +# Serial: 1846098327275375458322922162 +# MD5 Fingerprint: f8:1c:18:2d:2f:ba:5f:6d:a1:6c:bc:c7:ab:91:c7:0e +# SHA1 Fingerprint: 2f:8f:36:4f:e1:58:97:44:21:59:87:a5:2a:9a:d0:69:95:26:7f:b5 +# SHA256 Fingerprint: 97:55:20:15:f5:dd:fc:3c:87:88:c0:06:94:45:55:40:88:94:45:00:84:f1:00:86:70:86:bc:1a:2b:b5:8d:c8 +-----BEGIN CERTIFICATE----- +MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQsw +CQYDVQQGEwJVUzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28x +ITAfBgNVBAoMGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1 +c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMx +OTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJVUzERMA8GA1UECAwI +SWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2ZSBI +b2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB +ALldUShLPDeS0YLOvR29zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0Xzn +swuvCAAJWX/NKSqIk4cXGIDtiLK0thAfLdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu +7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4BqstTnoApTAbqOl5F2brz8 +1Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9oWN0EACyW +80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotP +JqX+OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1l +RtzuzWniTY+HKE40Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfw +hI0Vcnyh78zyiGG69Gm7DIwLdVcEuE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10 +coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm+9jaJXLE9gCxInm943xZYkqc +BW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqjifLJS3tBEW1n +twiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1Ud +DwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W +0OhUKDtkLSGm+J1WE2pIPU/HPinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfe +uyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0HZJDmHvUqoai7PF35owgLEQzxPy0Q +lG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla4gt5kNdXElE1GYhB +aCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5RvbbE +sLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPT +MaCm/zjdzyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qe +qu5AvzSxnI9O4fKSTx+O856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxh +VicGaeVyQYHTtgGJoC86cnn+OjC/QezHYj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8 +h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu3R3y4G5OBVixwJAWKqQ9 +EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP29FpHOTK +yeC2nOnOcXHebD8WpHk= +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global ECC P256 Certification Authority" +# Serial: 4151900041497450638097112925 +# MD5 Fingerprint: 5b:44:e3:8d:5d:36:86:26:e8:0d:05:d2:59:a7:83:54 +# SHA1 Fingerprint: b4:90:82:dd:45:0c:be:8b:5b:b1:66:d3:e2:a4:08:26:cd:ed:42:cf +# SHA256 Fingerprint: 94:5b:bc:82:5e:a5:54:f4:89:d1:fd:51:a7:3d:df:2e:a6:24:ac:70:19:a0:52:05:22:5c:22:a7:8c:cf:a8:b4 +-----BEGIN CERTIFICATE----- +MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYD +VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf +BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 +YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x +NzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYDVQQGEwJVUzERMA8G +A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 +d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF +Q0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqG +SM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN +FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8w +DwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcw +CgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wgh +DDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7 +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global ECC P384 Certification Authority" +# Serial: 2704997926503831671788816187 +# MD5 Fingerprint: ea:cf:60:c4:3b:b9:15:29:40:a1:97:ed:78:27:93:d6 +# SHA1 Fingerprint: e7:f3:a3:c8:cf:6f:c3:04:2e:6d:0e:67:32:c5:9e:68:95:0d:5e:d2 +# SHA256 Fingerprint: 55:90:38:59:c8:c0:c3:eb:b8:75:9e:ce:4e:25:57:22:5f:f5:75:8b:bd:38:eb:d4:82:76:60:1e:1b:d5:80:97 +-----BEGIN CERTIFICATE----- +MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYD +VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf +BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 +YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x +NzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYDVQQGEwJVUzERMA8G +A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 +d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF +Q0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuB +BAAiA2IABGvaDXU1CDFHBa5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJ +j9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr/TklZvFe/oyujUF5nQlgziip04pt89ZF +1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwYAMB0G +A1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNnADBkAjA3 +AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC +MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu +Sw== +-----END CERTIFICATE----- + +# Issuer: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. +# Subject: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. +# Label: "NAVER Global Root Certification Authority" +# Serial: 9013692873798656336226253319739695165984492813 +# MD5 Fingerprint: c8:7e:41:f6:25:3b:f5:09:b3:17:e8:46:3d:bf:d0:9b +# SHA1 Fingerprint: 8f:6b:f2:a9:27:4a:da:14:a0:c4:f4:8e:61:27:f9:c0:1e:78:5d:d1 +# SHA256 Fingerprint: 88:f4:38:dc:f8:ff:d1:fa:8f:42:91:15:ff:e5:f8:2a:e1:e0:6e:0c:70:c3:75:fa:ad:71:7b:34:a4:9e:72:65 +-----BEGIN CERTIFICATE----- +MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEM +BQAwaTELMAkGA1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRG +T1JNIENvcnAuMTIwMAYDVQQDDClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0 +aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4NDJaFw0zNzA4MTgyMzU5NTlaMGkx +CzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVTUyBQTEFURk9STSBD +b3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVA +iQqrDZBbUGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH +38dq6SZeWYp34+hInDEW+j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lE +HoSTGEq0n+USZGnQJoViAbbJAh2+g1G7XNr4rRVqmfeSVPc0W+m/6imBEtRTkZaz +kVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2aacp+yPOiNgSnABIqKYP +szuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4Yb8Obtoq +vC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHf +nZ3zVHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaG +YQ5fG8Ir4ozVu53BA0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo +0es+nPxdGoMuK8u180SdOqcXYZaicdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3a +CJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejyYhbLgGvtPe31HzClrkvJE+2K +AQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNVHQ4EFgQU0p+I +36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB +Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoN +qo0hV4/GPnrK21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatj +cu3cvuzHV+YwIHHW1xDBE1UBjCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm ++LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bxhYTeodoS76TiEJd6eN4MUZeoIUCL +hr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTgE34h5prCy8VCZLQe +lHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTHD8z7 +p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8 +piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR +LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX +5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO +dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul +9XXeifdy +-----END CERTIFICATE----- + +# Issuer: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres +# Subject: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres +# Label: "AC RAIZ FNMT-RCM SERVIDORES SEGUROS" +# Serial: 131542671362353147877283741781055151509 +# MD5 Fingerprint: 19:36:9c:52:03:2f:d2:d1:bb:23:cc:dd:1e:12:55:bb +# SHA1 Fingerprint: 62:ff:d9:9e:c0:65:0d:03:ce:75:93:d2:ed:3f:2d:32:c9:e3:e5:4a +# SHA256 Fingerprint: 55:41:53:b1:3d:2c:f9:dd:b7:53:bf:be:1a:4e:0a:e0:8d:0a:a4:18:70:58:fe:60:a2:b8:62:b2:e4:b8:7b:cb +-----BEGIN CERTIFICATE----- +MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw +CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw +FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S +Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 +MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL +DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS +QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH +sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK +Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu +SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC +MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy +v+c= +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign Root R46 O=GlobalSign nv-sa +# Subject: CN=GlobalSign Root R46 O=GlobalSign nv-sa +# Label: "GlobalSign Root R46" +# Serial: 1552617688466950547958867513931858518042577 +# MD5 Fingerprint: c4:14:30:e4:fa:66:43:94:2a:6a:1b:24:5f:19:d0:ef +# SHA1 Fingerprint: 53:a2:b0:4b:ca:6b:d6:45:e6:39:8a:8e:c4:0d:d2:bf:77:c3:a2:90 +# SHA256 Fingerprint: 4f:a3:12:6d:8d:3a:11:d1:c4:85:5a:4f:80:7c:ba:d6:cf:91:9d:3a:5a:88:b0:3b:ea:2c:63:72:d9:3c:40:c9 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUA +MEYxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYD +VQQDExNHbG9iYWxTaWduIFJvb3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMy +MDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYt +c2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08EsCVeJ +OaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQG +vGIFAha/r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud +316HCkD7rRlr+/fKYIje2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo +0q3v84RLHIf8E6M6cqJaESvWJ3En7YEtbWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSE +y132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvjK8Cd+RTyG/FWaha/LIWF +zXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD412lPFzYE ++cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCN +I/onccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzs +x2sZy/N78CsHpdlseVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqa +ByFrgY/bxFn63iLABJzjqls2k+g9vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC +4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEMBQADggIBAHx4 +7PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg +JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti +2kM3S+LGteWygxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIk +pnnpHs6i58FZFZ8d4kuaPp92CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRF +FRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZmOUdkLG5NrmJ7v2B0GbhWrJKsFjLt +rWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qqJZ4d16GLuc1CLgSk +ZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwyeqiv5 +u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP +4vkYxboznxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6 +N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 +vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign Root E46 O=GlobalSign nv-sa +# Subject: CN=GlobalSign Root E46 O=GlobalSign nv-sa +# Label: "GlobalSign Root E46" +# Serial: 1552617690338932563915843282459653771421763 +# MD5 Fingerprint: b5:b8:66:ed:de:08:83:e3:c9:e2:01:34:06:ac:51:6f +# SHA1 Fingerprint: 39:b4:6c:d5:fe:80:06:eb:e2:2f:4a:bb:08:33:a0:af:db:b9:dd:84 +# SHA256 Fingerprint: cb:b9:c4:4d:84:b8:04:3e:10:50:ea:31:a6:9f:51:49:55:d7:bf:d2:e2:c6:b4:93:01:01:9a:d6:1d:9f:50:58 +-----BEGIN CERTIFICATE----- +MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYx +CzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQD +ExNHbG9iYWxTaWduIFJvb3QgRTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAw +MDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2Ex +HDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkBjtjq +R+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGdd +yXqBPCCjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud +DgQWBBQxCpCPtsad0kRLgLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ +7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZkvLtoURMMA/cVi4RguYv/Uo7njLwcAjA8 ++RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+CAezNIm8BZ/3Hobui3A= +-----END CERTIFICATE----- + +# Issuer: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH +# Subject: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH +# Label: "GLOBALTRUST 2020" +# Serial: 109160994242082918454945253 +# MD5 Fingerprint: 8a:c7:6f:cb:6d:e3:cc:a2:f1:7c:83:fa:0e:78:d7:e8 +# SHA1 Fingerprint: d0:67:c1:13:51:01:0c:aa:d0:c7:6a:65:37:31:16:26:4f:53:71:a2 +# SHA256 Fingerprint: 9a:29:6a:51:82:d1:d4:51:a2:e3:7f:43:9b:74:da:af:a2:67:52:33:29:f9:0f:9a:0d:20:07:c3:34:e2:3c:9a +-----BEGIN CERTIFICATE----- +MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkG +A1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkw +FwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYx +MDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9u +aXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMIICIjANBgkq +hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWiD59b +RatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9Z +YybNpyrOVPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3 +QWPKzv9pj2gOlTblzLmMCcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPw +yJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCmfecqQjuCgGOlYx8ZzHyyZqjC0203b+J+ +BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKAA1GqtH6qRNdDYfOiaxaJ +SaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9ORJitHHmkH +r96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj0 +4KlGDfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9Me +dKZssCz3AwyIDMvUclOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIw +q7ejMZdnrY8XD2zHc+0klGvIg5rQmjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2 +nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1UdIwQYMBaAFNwu +H9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA +VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJC +XtzoRlgHNQIw4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd +6IwPS3BD0IL/qMy/pJTAvoe9iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf ++I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS8cE54+X1+NZK3TTN+2/BT+MAi1bi +kvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2HcqtbepBEX4tdJP7 +wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxSvTOB +TI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6C +MUO+1918oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn +4rnvyOL2NSl6dPrFf4IFYqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+I +aFvowdlxfv1k7/9nR4hYJS8+hge9+6jlgqispdNpQ80xiEmEU5LAsTkbOYMBMMTy +qfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg== +-----END CERTIFICATE----- + +# Issuer: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz +# Subject: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz +# Label: "ANF Secure Server Root CA" +# Serial: 996390341000653745 +# MD5 Fingerprint: 26:a6:44:5a:d9:af:4e:2f:b2:1d:b6:65:b0:4e:e8:96 +# SHA1 Fingerprint: 5b:6e:68:d0:cc:15:b6:a0:5f:1e:c1:5f:ae:02:fc:6b:2f:5d:6f:74 +# SHA256 Fingerprint: fb:8f:ec:75:91:69:b9:10:6b:1e:51:16:44:c6:18:c5:13:04:37:3f:6c:06:43:08:8d:8b:ef:fd:1b:99:75:99 +-----BEGIN CERTIFICATE----- +MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV +BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk +YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV +BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN +MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF +UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD +VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v +dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj +cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q +yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH +2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX +H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL +zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR +p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz +W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ +SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn +LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 +n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B +u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj +o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L +9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej +rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK +pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 +vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq +OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ +/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 +2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI ++PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 +MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo +tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= +-----END CERTIFICATE----- + +# Issuer: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Subject: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Label: "Certum EC-384 CA" +# Serial: 160250656287871593594747141429395092468 +# MD5 Fingerprint: b6:65:b3:96:60:97:12:a1:ec:4e:e1:3d:a3:c6:c9:f1 +# SHA1 Fingerprint: f3:3e:78:3c:ac:df:f4:a2:cc:ac:67:55:69:56:d7:e5:16:3c:e1:ed +# SHA256 Fingerprint: 6b:32:80:85:62:53:18:aa:50:d1:73:c9:8d:8b:da:09:d5:7e:27:41:3d:11:4c:f7:87:a0:f5:d0:6c:03:0c:f6 +-----BEGIN CERTIFICATE----- +MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw +CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw +JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT +EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0 +WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT +LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX +BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE +KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm +Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI0GZnQkdjrzife81r1HfS+8 +EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjADVS2m5hjEfO/J +UG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0QoSZ/6vn +nvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k= +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Root CA" +# Serial: 40870380103424195783807378461123655149 +# MD5 Fingerprint: 51:e1:c2:e7:fe:4c:84:af:59:0e:2f:f4:54:6f:ea:29 +# SHA1 Fingerprint: c8:83:44:c0:18:ae:9f:cc:f1:87:b7:8f:22:d1:c5:d7:45:84:ba:e5 +# SHA256 Fingerprint: fe:76:96:57:38:55:77:3e:37:a9:5e:7a:d4:d9:cc:96:c3:01:57:c1:5d:31:76:5b:a9:b1:57:04:e1:ae:78:fd +-----BEGIN CERTIFICATE----- +MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6 +MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEu +MScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNV +BAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwHhcNMTgwMzE2MTIxMDEzWhcNNDMw +MzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEg +U3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRo +b3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZ +n0EGze2jusDbCSzBfN8pfktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/q +p1x4EaTByIVcJdPTsuclzxFUl6s1wB52HO8AU5853BSlLCIls3Jy/I2z5T4IHhQq +NwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2fJmItdUDmj0VDT06qKhF +8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGtg/BKEiJ3 +HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGa +mqi4NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi +7VdNIuJGmj8PkTQkfVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSF +ytKAQd8FqKPVhJBPC/PgP5sZ0jeJP/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0P +qafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSYnjYJdmZm/Bo/6khUHL4wvYBQ +v3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHKHRzQ+8S1h9E6 +Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1 +vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQAD +ggIBAEii1QALLtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4 +WxmB82M+w85bj/UvXgF2Ez8sALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvo +zMrnadyHncI013nR03e4qllY/p0m+jiGPp2Kh2RX5Rc64vmNueMzeMGQ2Ljdt4NR +5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8CYyqOhNf6DR5UMEQ +GfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA4kZf +5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq +0Uc9NneoWWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7D +P78v3DSk+yshzWePS/Tj6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTM +qJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmTOPQD8rv7gmsHINFSH5pkAnuYZttcTVoP +0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZckbxJF0WddCajJFdr60qZf +E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb +-----END CERTIFICATE----- + +# Issuer: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique +# Subject: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique +# Label: "TunTrust Root CA" +# Serial: 108534058042236574382096126452369648152337120275 +# MD5 Fingerprint: 85:13:b9:90:5b:36:5c:b6:5e:b8:5a:f8:e0:31:57:b4 +# SHA1 Fingerprint: cf:e9:70:84:0f:e0:73:0f:9d:f6:0c:7f:2c:4b:ee:20:46:34:9c:bb +# SHA256 Fingerprint: 2e:44:10:2a:b5:8c:b8:54:19:45:1c:8e:19:d9:ac:f3:66:2c:af:bc:61:4b:6a:53:96:0a:30:f7:d0:e2:eb:41 +-----BEGIN CERTIFICATE----- +MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQEL +BQAwYTELMAkGA1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUg +Q2VydGlmaWNhdGlvbiBFbGVjdHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJv +b3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQwNDI2MDg1NzU2WjBhMQswCQYDVQQG +EwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBDZXJ0aWZpY2F0aW9u +IEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIwDQYJ +KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZ +n56eY+hz2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd +2JQDoOw05TDENX37Jk0bbjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgF +VwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZ +GoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAdgjH8KcwAWJeRTIAAHDOF +li/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViWVSHbhlnU +r8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2 +eY8fTpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIb +MlEsPvLfe/ZdeikZjuXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISg +jwBUFfyRbVinljvrS5YnzWuioYasDXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB +7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwSVXAkPcvCFDVDXSdOvsC9qnyW +5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI04Y+oXNZtPdE +ITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0 +90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+z +xiD2BkewhpMl0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYu +QEkHDVneixCwSQXi/5E/S7fdAo74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4 +FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRYYdZ2vyJ/0Adqp2RT8JeNnYA/u8EH +22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJpadbGNjHh/PqAulxP +xOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65xxBzn +dFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5 +Xc0yGYuPjCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7b +nV2UqL1g52KAdoGDDIzMMEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQ +CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH +u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj +d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o= +-----END CERTIFICATE----- + +# Issuer: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Subject: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Label: "HARICA TLS RSA Root CA 2021" +# Serial: 76817823531813593706434026085292783742 +# MD5 Fingerprint: 65:47:9b:58:86:dd:2c:f0:fc:a2:84:1f:1e:96:c4:91 +# SHA1 Fingerprint: 02:2d:05:82:fa:88:ce:14:0c:06:79:de:7f:14:10:e9:45:d7:a5:6d +# SHA256 Fingerprint: d9:5d:0e:8e:da:79:52:5b:f9:be:b1:1b:14:d2:10:0d:32:94:98:5f:0c:62:d9:fa:bd:9c:d9:99:ec:cb:7b:1d +-----BEGIN CERTIFICATE----- +MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBs +MQswCQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl +c2VhcmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0Eg +Um9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUzOFoXDTQ1MDIxMzEwNTUzN1owbDEL +MAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl +YXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNBIFJv +b3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569l +mwVnlskNJLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE +4VGC/6zStGndLuwRo0Xua2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uv +a9of08WRiFukiZLRgeaMOVig1mlDqa2YUlhu2wr7a89o+uOkXjpFc5gH6l8Cct4M +pbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K5FrZx40d/JiZ+yykgmvw +Kh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEvdmn8kN3b +LW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcY +AuUR0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqB +AGMUuTNe3QvboEUHGjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYq +E613TBoYm5EPWNgGVMWX+Ko/IIqmhaZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHr +W2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQCPxrvrNQKlr9qEgYRtaQQJKQ +CoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAU +X15QvWiWkKQUEapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3 +f5Z2EMVGpdAgS1D0NTsY9FVqQRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxaja +H6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxDQpSbIPDRzbLrLFPCU3hKTwSUQZqP +JzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcRj88YxeMn/ibvBZ3P +zzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5vZSt +jBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0 +/L5H9MG0qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pT +BGIBnfHAT+7hOtSLIBD6Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79 +aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW +xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU +63ZTGI0RmLo= +-----END CERTIFICATE----- + +# Issuer: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Subject: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Label: "HARICA TLS ECC Root CA 2021" +# Serial: 137515985548005187474074462014555733966 +# MD5 Fingerprint: ae:f7:4c:e5:66:35:d1:b7:9b:8c:22:93:74:d3:4b:b0 +# SHA1 Fingerprint: bc:b0:c1:9d:e9:98:92:70:19:38:57:e9:8d:a7:b4:5d:6e:ee:01:48 +# SHA256 Fingerprint: 3f:99:cc:47:4a:cf:ce:4d:fe:d5:87:94:66:5e:47:8d:15:47:73:9f:2e:78:0f:1b:b4:ca:9b:13:30:97:d4:01 +-----BEGIN CERTIFICATE----- +MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQsw +CQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2Vh +cmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9v +dCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoXDTQ1MDIxMzExMDEwOVowbDELMAkG +A1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj +aCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJvb3Qg +Q0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7 +KKrxcm1lAEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9Y +STHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQD +AgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNw +SaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygN +nxS2PFOiTAZpffpskcYqSUXm7LcT4Tps +-----END CERTIFICATE----- + +# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" +# Serial: 1977337328857672817 +# MD5 Fingerprint: 4e:6e:9b:54:4c:ca:b7:fa:48:e4:90:b1:15:4b:1c:a3 +# SHA1 Fingerprint: 0b:be:c2:27:22:49:cb:39:aa:db:35:5c:53:e3:8c:ae:78:ff:b6:fe +# SHA256 Fingerprint: 57:de:05:83:ef:d2:b2:6e:03:61:da:99:da:9d:f4:64:8d:ef:7e:e8:44:1c:3b:72:8a:fa:9b:cd:e0:f9:b2:6a +-----BEGIN CERTIFICATE----- +MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UE +BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h +cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1 +MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg +Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 +thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM +cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG +L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i +NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h +X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b +m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy +Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja +EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T +KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF +6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh +OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1UdDgQWBBRlzeurNR4APn7VdMAc +tHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4wgZswgZgGBFUd +IAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j +b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABC +AG8AbgBhAG4AbwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAw +ADEANzAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9m +iWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL4QjbEwj4KKE1soCzC1HA01aajTNF +Sa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDbLIpgD7dvlAceHabJ +hfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1ilI45P +Vf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZE +EAEeiGaPcjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV +1aUsIC+nmCjuRfzxuIgALI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2t +CsvMo2ebKHTEm9caPARYpoKdrcd7b/+Alun4jWq9GJAd/0kakFI3ky88Al2CdgtR +5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH9IBk9W6VULgRfhVwOEqw +f9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpfNIbnYrX9 +ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNK +GbqEZycPvEJdvSRUDewdcAZfpLz6IHxV +-----END CERTIFICATE----- + +# Issuer: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. +# Subject: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. +# Label: "vTrus ECC Root CA" +# Serial: 630369271402956006249506845124680065938238527194 +# MD5 Fingerprint: de:4b:c1:f5:52:8c:9b:43:e1:3e:8f:55:54:17:8d:85 +# SHA1 Fingerprint: f6:9c:db:b0:fc:f6:02:13:b6:52:32:a6:a3:91:3f:16:70:da:c3:e1 +# SHA256 Fingerprint: 30:fb:ba:2c:32:23:8e:2a:98:54:7a:f9:79:31:e5:50:42:8b:9b:3f:1c:8e:eb:66:33:dc:fa:86:c5:b2:7d:d3 +-----BEGIN CERTIFICATE----- +MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMw +RzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAY +BgNVBAMTEXZUcnVzIEVDQyBSb290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDcz +MTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28u +LEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYwEAYHKoZIzj0CAQYF +K4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+cToL0 +v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUd +e4BdS49nTPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYD +VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIw +V53dVvHH4+m4SVBrm2nDb+zDfSXkV5UTQJtS0zvzQBm8JsctBp61ezaf9SXUY2sA +AjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQLYgmRWAD5Tfs0aNoJrSEG +GJTO +-----END CERTIFICATE----- + +# Issuer: CN=vTrus Root CA O=iTrusChina Co.,Ltd. +# Subject: CN=vTrus Root CA O=iTrusChina Co.,Ltd. +# Label: "vTrus Root CA" +# Serial: 387574501246983434957692974888460947164905180485 +# MD5 Fingerprint: b8:c9:37:df:fa:6b:31:84:64:c5:ea:11:6a:1b:75:fc +# SHA1 Fingerprint: 84:1a:69:fb:f5:cd:1a:25:34:13:3d:e3:f8:fc:b8:99:d0:c9:14:b7 +# SHA256 Fingerprint: 8a:71:de:65:59:33:6f:42:6c:26:e5:38:80:d0:0d:88:a1:8d:a4:c6:a9:1f:0d:cb:61:94:e2:06:c5:c9:63:87 +-----BEGIN CERTIFICATE----- +MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL +BQAwQzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4x +FjAUBgNVBAMTDXZUcnVzIFJvb3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMx +MDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoGA1UEChMTaVRydXNDaGluYSBDby4s +THRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZotsSKYc +IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU +AyyNJJrIZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+ +GrPSbcKvdmaVayqwlHeFXgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z9 +8Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KAYPxMvDVTAWqXcoKv8R1w6Jz1717CbMdH +flqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70kLJrxLT5ZOrpGgrIDajt +J8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2AXPKBlim +0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZN +pGvu/9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQ +UqqzApVg+QxMaPnu1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHW +OXSuTEGC2/KmSNGzm/MzqvOmwMVO9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMB +AAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYgscasGrz2iTAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAKbqSSaet +8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd +nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1j +bhd47F18iMjrjld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvM +Kar5CKXiNxTKsbhm7xqC5PD48acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIiv +TDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJnxDHO2zTlJQNgJXtxmOTAGytfdELS +S8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554WgicEFOwE30z9J4nfr +I8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4sEb9 +b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNB +UvupLnKWnyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1P +Ti07NEPhmg4NpGaXutIcSkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929ven +sBxXVsFy6K2ir40zSbofitzmdHxghm+Hl3s= +-----END CERTIFICATE----- + +# Issuer: CN=ISRG Root X2 O=Internet Security Research Group +# Subject: CN=ISRG Root X2 O=Internet Security Research Group +# Label: "ISRG Root X2" +# Serial: 87493402998870891108772069816698636114 +# MD5 Fingerprint: d3:9e:c4:1e:23:3c:a6:df:cf:a3:7e:6d:e0:14:e6:e5 +# SHA1 Fingerprint: bd:b1:b9:3c:d5:97:8d:45:c6:26:14:55:f8:db:95:c7:5a:d1:53:af +# SHA256 Fingerprint: 69:72:9b:8e:15:a8:6e:fc:17:7a:57:af:b7:17:1d:fc:64:ad:d2:8c:2f:ca:8c:f1:50:7e:34:45:3c:cb:14:70 +-----BEGIN CERTIFICATE----- +MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw +CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg +R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 +MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT +ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw +EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW ++1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 +ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI +zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW +tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 +/q4AaOeMSQ+2b1tbFfLn +-----END CERTIFICATE----- + +# Issuer: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. +# Subject: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. +# Label: "HiPKI Root CA - G1" +# Serial: 60966262342023497858655262305426234976 +# MD5 Fingerprint: 69:45:df:16:65:4b:e8:68:9a:8f:76:5f:ff:80:9e:d3 +# SHA1 Fingerprint: 6a:92:e4:a8:ee:1b:ec:96:45:37:e3:29:57:49:cd:96:e3:e5:d2:60 +# SHA256 Fingerprint: f0:15:ce:3c:c2:39:bf:ef:06:4b:e9:f1:d2:c4:17:e1:a0:26:4a:0a:94:be:1f:0c:8d:12:18:64:eb:69:49:cc +-----BEGIN CERTIFICATE----- +MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBP +MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 +ZC4xGzAZBgNVBAMMEkhpUEtJIFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRa +Fw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3 +YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kgUm9vdCBDQSAtIEcx +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0o9Qw +qNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twv +Vcg3Px+kwJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6 +lZgRZq2XNdZ1AYDgr/SEYYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnz +Qs7ZngyzsHeXZJzA9KMuH5UHsBffMNsAGJZMoYFL3QRtU6M9/Aes1MU3guvklQgZ +KILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfdhSi8MEyr48KxRURHH+CK +FgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj1jOXTyFj +HluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDr +y+K49a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ +/W3c1pzAtH2lsN0/Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgM +a/aOEmem8rJY5AIJEzypuxC00jBF8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6 +fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQDAgGGMA0GCSqG +SIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi +7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqc +SE5XCV0vrPSltJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6Fza +ZsT0pPBWGTMpWmWSBUdGSquEwx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9Tc +XzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07QJNBAsNB1CI69aO4I1258EHBGG3zg +iLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv5wiZqAxeJoBF1Pho +L5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+GpzjLrF +Ne85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wr +kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+ +vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU +YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ== +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 +# Label: "GlobalSign ECC Root CA - R4" +# Serial: 159662223612894884239637590694 +# MD5 Fingerprint: 26:29:f8:6d:e1:88:bf:a2:65:7f:aa:c4:cd:0f:7f:fc +# SHA1 Fingerprint: 6b:a0:b0:98:e1:71:ef:5a:ad:fe:48:15:80:77:10:f4:bd:6f:0b:28 +# SHA256 Fingerprint: b0:85:d7:0b:96:4f:19:1a:73:e4:af:0d:54:ae:7a:0e:07:aa:fd:af:9b:71:dd:08:62:13:8a:b7:32:5a:24:a2 +-----BEGIN CERTIFICATE----- +MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYD +VQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2Jh +bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgw +MTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0g +UjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wWTAT +BgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkWymOx +uYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNV +HQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/ ++wpu+74zyTyjhNUwCgYIKoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147 +bmF0774BxL4YSFlhgjICICadVGNA3jdgUM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R1 O=Google Trust Services LLC +# Subject: CN=GTS Root R1 O=Google Trust Services LLC +# Label: "GTS Root R1" +# Serial: 159662320309726417404178440727 +# MD5 Fingerprint: 05:fe:d0:bf:71:a8:a3:76:63:da:01:e0:d8:52:dc:40 +# SHA1 Fingerprint: e5:8c:1c:c4:91:3b:38:63:4b:e9:10:6e:e3:ad:8e:6b:9d:d9:81:4a +# SHA256 Fingerprint: d9:47:43:2a:bd:e7:b7:fa:90:fc:2e:6b:59:10:1b:12:80:e0:e1:c7:e4:e4:0f:a3:c6:88:7f:ff:57:a7:f4:cf +-----BEGIN CERTIFICATE----- +MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw +CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU +MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw +MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp +Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo +27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w +Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw +TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl +qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH +szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8 +Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk +MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92 +wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p +aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN +VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID +AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb +C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe +QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy +h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4 +7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J +ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef +MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/ +Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT +6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ +0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm +2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb +bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R2 O=Google Trust Services LLC +# Subject: CN=GTS Root R2 O=Google Trust Services LLC +# Label: "GTS Root R2" +# Serial: 159662449406622349769042896298 +# MD5 Fingerprint: 1e:39:c0:53:e6:1e:29:82:0b:ca:52:55:36:5d:57:dc +# SHA1 Fingerprint: 9a:44:49:76:32:db:de:fa:d0:bc:fb:5a:7b:17:bd:9e:56:09:24:94 +# SHA256 Fingerprint: 8d:25:cd:97:22:9d:bf:70:35:6b:da:4e:b3:cc:73:40:31:e2:4c:f0:0f:af:cf:d3:2d:c7:6e:b5:84:1c:7e:a8 +-----BEGIN CERTIFICATE----- +MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw +CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU +MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw +MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp +Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt +nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY +6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu +MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k +RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg +f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV ++3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo +dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW +Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa +G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq +gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID +AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H +vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8 +0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC +B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u +NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg +yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev +HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6 +xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR +TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg +JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV +7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl +6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R3 O=Google Trust Services LLC +# Subject: CN=GTS Root R3 O=Google Trust Services LLC +# Label: "GTS Root R3" +# Serial: 159662495401136852707857743206 +# MD5 Fingerprint: 3e:e7:9d:58:02:94:46:51:94:e5:e0:22:4a:8b:e7:73 +# SHA1 Fingerprint: ed:e5:71:80:2b:c8:92:b9:5b:83:3c:d2:32:68:3f:09:cd:a0:1e:46 +# SHA256 Fingerprint: 34:d8:a7:3e:e2:08:d9:bc:db:0d:95:65:20:93:4b:4e:40:e6:94:82:59:6e:8b:6f:73:c8:42:6b:01:0a:6f:48 +-----BEGIN CERTIFICATE----- +MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYD +VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG +A1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw +WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz +IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNi +AAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout736G +jOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL2 +4CejQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7 +VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azTL818+FsuVbu/3ZL3pAzcMeGiAjEA/Jdm +ZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV11RZt+cRLInUue4X +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R4 O=Google Trust Services LLC +# Subject: CN=GTS Root R4 O=Google Trust Services LLC +# Label: "GTS Root R4" +# Serial: 159662532700760215368942768210 +# MD5 Fingerprint: 43:96:83:77:19:4d:76:b3:9d:65:52:e4:1d:22:a5:e8 +# SHA1 Fingerprint: 77:d3:03:67:b5:e0:0c:15:f6:0c:38:61:df:7c:e1:3b:92:46:4d:47 +# SHA256 Fingerprint: 34:9d:fa:40:58:c5:e2:63:12:3b:39:8a:e7:95:57:3c:4e:13:13:c8:3f:e6:8f:93:55:6c:d5:e8:03:1b:3c:7d +-----BEGIN CERTIFICATE----- +MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD +VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG +A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw +WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz +IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi +AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi +QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR +HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D +9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8 +p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD +-----END CERTIFICATE----- + +# Issuer: CN=Telia Root CA v2 O=Telia Finland Oyj +# Subject: CN=Telia Root CA v2 O=Telia Finland Oyj +# Label: "Telia Root CA v2" +# Serial: 7288924052977061235122729490515358 +# MD5 Fingerprint: 0e:8f:ac:aa:82:df:85:b1:f4:dc:10:1c:fc:99:d9:48 +# SHA1 Fingerprint: b9:99:cd:d1:73:50:8a:c4:47:05:08:9c:8c:88:fb:be:a0:2b:40:cd +# SHA256 Fingerprint: 24:2b:69:74:2f:cb:1e:5b:2a:bf:98:89:8b:94:57:21:87:54:4e:5b:4d:99:11:78:65:73:62:1f:6a:74:b8:2c +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQx +CzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UE +AwwQVGVsaWEgUm9vdCBDQSB2MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1 +NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZ +MBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ76zBq +AMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9 +vVYiQJ3q9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9 +lRdU2HhE8Qx3FZLgmEKnpNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTOD +n3WhUidhOPFZPY5Q4L15POdslv5e2QJltI5c0BE0312/UqeBAMN/mUWZFdUXyApT +7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW5olWK8jjfN7j/4nlNW4o +6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNrRBH0pUPC +TEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6 +WT0EBXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63R +DolUK5X6wK0dmBR4M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZI +pEYslOqodmJHixBTB0hXbOKSTbauBcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGj +YzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7Wxy+G2CQ5MB0GA1UdDgQWBBRy +rOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw +AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ +8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi +0f6X+J8wfBj5tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMM +A8iZGok1GTzTyVR8qPAs5m4HeW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBS +SRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+Cy748fdHif64W1lZYudogsYMVoe+K +TTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygCQMez2P2ccGrGKMOF +6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15h2Er +3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMt +Ty3EHD70sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pT +VmBds9hCG1xLEooc6+t9xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAW +ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA +rBPuUBQemMc= +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH +# Subject: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH +# Label: "D-TRUST BR Root CA 1 2020" +# Serial: 165870826978392376648679885835942448534 +# MD5 Fingerprint: b5:aa:4b:d5:ed:f7:e3:55:2e:8f:72:0a:f3:75:b8:ed +# SHA1 Fingerprint: 1f:5b:98:f0:e3:b5:f7:74:3c:ed:e6:b0:36:7d:32:cd:f4:09:41:67 +# SHA256 Fingerprint: e5:9a:aa:81:60:09:c2:2b:ff:5b:25:ba:d3:7d:f3:06:f0:49:79:7c:1f:81:d8:5a:b0:89:e6:57:bd:8f:00:44 +-----BEGIN CERTIFICATE----- +MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQsw +CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS +VVNUIEJSIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5 +NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG +A1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB +BAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7dPYS +zuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0 +QVK5buXuQqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/ +VbNafAkl1bK6CKBrqx9tMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g +PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2JyX3Jvb3Rf +Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l +dC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 +c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO +PQQDAwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFW +wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV +dWNbFJWcHwHP2NVypw87 +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH +# Subject: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH +# Label: "D-TRUST EV Root CA 1 2020" +# Serial: 126288379621884218666039612629459926992 +# MD5 Fingerprint: 8c:2d:9d:70:9f:48:99:11:06:11:fb:e9:cb:30:c0:6e +# SHA1 Fingerprint: 61:db:8c:21:59:69:03:90:d8:7c:9c:12:86:54:cf:9d:3d:f4:dd:07 +# SHA256 Fingerprint: 08:17:0d:1a:a3:64:53:90:1a:2f:95:92:45:e3:47:db:0c:8d:37:ab:aa:bc:56:b8:1a:a1:00:dc:95:89:70:db +-----BEGIN CERTIFICATE----- +MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw +CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS +VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5 +NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG +A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB +BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC +/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD +wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3 +OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g +PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf +Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l +dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 +c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO +PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA +y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb +gfM0agPnIjhQW+0ZT0MW +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. +# Subject: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. +# Label: "DigiCert TLS ECC P384 Root G5" +# Serial: 13129116028163249804115411775095713523 +# MD5 Fingerprint: d3:71:04:6a:43:1c:db:a6:59:e1:a8:a3:aa:c5:71:ed +# SHA1 Fingerprint: 17:f3:de:5e:9f:0f:19:e9:8e:f6:1f:32:26:6e:20:c4:07:ae:30:ee +# SHA256 Fingerprint: 01:8e:13:f0:77:25:32:cf:80:9b:d1:b1:72:81:86:72:83:fc:48:c6:e1:3b:e9:c6:98:12:85:4a:49:0c:1b:05 +-----BEGIN CERTIFICATE----- +MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURp +Z2lDZXJ0IFRMUyBFQ0MgUDM4NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2 +MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJ +bmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQgUm9vdCBHNTB2MBAG +ByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1TzvdlHJS +7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp +0zVozptjn4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICIS +B4CIfBFqMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49 +BAMDA2gAMGUCMQCJao1H5+z8blUD2WdsJk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQ +LgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIxAJSdYsiJvRmEFOml+wG4 +DXZDjC5Ty3zfDBeWUA== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. +# Subject: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. +# Label: "DigiCert TLS RSA4096 Root G5" +# Serial: 11930366277458970227240571539258396554 +# MD5 Fingerprint: ac:fe:f7:34:96:a9:f2:b3:b4:12:4b:e4:27:41:6f:e1 +# SHA1 Fingerprint: a7:88:49:dc:5d:7c:75:8c:8c:de:39:98:56:b3:aa:d0:b2:a5:71:35 +# SHA256 Fingerprint: 37:1a:00:dc:05:33:b3:72:1a:7e:eb:40:e8:41:9e:70:79:9d:2b:0a:0f:2c:1d:80:69:31:65:f7:ce:c4:ad:75 +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBN +MQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMT +HERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcN +NDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQs +IEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS87IE+ +ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG0 +2C+JFvuUAT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgp +wgscONyfMXdcvyej/Cestyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZM +pG2T6T867jp8nVid9E6P/DsjyG244gXazOvswzH016cpVIDPRFtMbzCe88zdH5RD +nU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnVDdXifBBiqmvwPXbzP6Po +sMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9qTXeXAaDx +Zre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cd +Lvvyz6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvX +KyY//SovcfXWJL5/MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNe +XoVPzthwiHvOAbWWl9fNff2C+MIkwcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPL +tgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4EFgQUUTMc7TZArxfTJc1paPKv +TiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN +AQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw +GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7H +PNtQOa27PShNlnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLF +O4uJ+DQtpBflF+aZfTCIITfNMBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQ +REtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/u4cnYiWB39yhL/btp/96j1EuMPik +AdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9GOUrYU9DzLjtxpdRv +/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh47a+ +p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilw +MUc/dNAUFvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WF +qUITVuwhd4GTWgzqltlJyqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCK +ovfepEWFJqgejF0pW8hL2JpqA15w8oVPbEtoL8pU9ozaMv7Da4M/OMZ+ +-----END CERTIFICATE----- + +# Issuer: CN=Certainly Root R1 O=Certainly +# Subject: CN=Certainly Root R1 O=Certainly +# Label: "Certainly Root R1" +# Serial: 188833316161142517227353805653483829216 +# MD5 Fingerprint: 07:70:d4:3e:82:87:a0:fa:33:36:13:f4:fa:33:e7:12 +# SHA1 Fingerprint: a0:50:ee:0f:28:71:f4:27:b2:12:6d:6f:50:96:25:ba:cc:86:42:af +# SHA256 Fingerprint: 77:b8:2c:d8:64:4c:43:05:f7:ac:c5:cb:15:6b:45:67:50:04:03:3d:51:c6:0c:62:02:a8:e0:c3:34:67:d3:a0 +-----BEGIN CERTIFICATE----- +MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAw +PTELMAkGA1UEBhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2Vy +dGFpbmx5IFJvb3QgUjEwHhcNMjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9 +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0 +YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANA2 +1B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O5MQT +vqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbed +aFySpvXl8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b0 +1C7jcvk2xusVtyWMOvwlDbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5 +r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGIXsXwClTNSaa/ApzSRKft43jvRl5tcdF5 +cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkNKPl6I7ENPT2a/Z2B7yyQ +wHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQAjeZjOVJ +6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA +2CnbrlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyH +Wyf5QBGenDPBt+U1VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMR +eiFPCyEQtkA6qyI6BJyLm4SGcprSp6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB +/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTgqj8ljZ9EXME66C6u +d0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAszHQNTVfSVcOQr +PbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d +8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi +1wrykXprOQ4vMMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrd +rRT90+7iIgXr0PK3aBLXWopBGsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9di +taY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+gjwN/KUD+nsa2UUeYNrEjvn8K8l7 +lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgHJBu6haEaBQmAupVj +yTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7fpYn +Kx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLy +yCwzk5Iwx06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5n +wXARPbv0+Em34yaXOp/SX3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6 +OV+KmalBWQewLK8= +-----END CERTIFICATE----- + +# Issuer: CN=Certainly Root E1 O=Certainly +# Subject: CN=Certainly Root E1 O=Certainly +# Label: "Certainly Root E1" +# Serial: 8168531406727139161245376702891150584 +# MD5 Fingerprint: 0a:9e:ca:cd:3e:52:50:c6:36:f3:4b:a3:ed:a7:53:e9 +# SHA1 Fingerprint: f9:e1:6d:dc:01:89:cf:d5:82:45:63:3e:c5:37:7d:c2:eb:93:6f:2b +# SHA256 Fingerprint: b4:58:5f:22:e4:ac:75:6a:4e:86:12:a1:36:1c:5d:9d:03:1a:93:fd:84:fe:bb:77:8f:a3:06:8b:0f:c4:2d:c2 +-----BEGIN CERTIFICATE----- +MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQsw +CQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlu +bHkgUm9vdCBFMTAeFw0yMTA0MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJ +BgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlubHkxGjAYBgNVBAMTEUNlcnRhaW5s +eSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4fxzf7flHh4axpMCK ++IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9YBk2 +QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4 +hevIIgcwCgYIKoZIzj0EAwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozm +ut6Dacpps6kFtZaSF4fC0urQe87YQVt8rgIwRt7qy12a7DLCZRawTDBcMPPaTnOG +BtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR +-----END CERTIFICATE----- + +# Issuer: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD. +# Subject: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD. +# Label: "Security Communication RootCA3" +# Serial: 16247922307909811815 +# MD5 Fingerprint: 1c:9a:16:ff:9e:5c:e0:4d:8a:14:01:f4:35:5d:29:26 +# SHA1 Fingerprint: c3:03:c8:22:74:92:e5:61:a2:9c:5f:79:91:2b:1e:44:13:91:30:3a +# SHA256 Fingerprint: 24:a5:5c:2a:b0:51:44:2d:06:17:76:65:41:23:9a:4a:d0:32:d7:c5:51:75:aa:34:ff:de:2f:bc:4f:5c:52:94 +-----BEGIN CERTIFICATE----- +MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNV +BAYTAkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScw +JQYDVQQDEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2 +MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc +U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UEAxMeU2VjdXJpdHkg +Q29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEA48lySfcw3gl8qUCBWNO0Ot26YQ+TUG5pPDXC7ltzkBtnTCHsXzW7OT4r +CmDvu20rhvtxosis5FaU+cmvsXLUIKx00rgVrVH+hXShuRD+BYD5UpOzQD11EKzA +lrenfna84xtSGc4RHwsENPXY9Wk8d/Nk9A2qhd7gCVAEF5aEt8iKvE1y/By7z/MG +TfmfZPd+pmaGNXHIEYBMwXFAWB6+oHP2/D5Q4eAvJj1+XCO1eXDe+uDRpdYMQXF7 +9+qMHIjH7Iv10S9VlkZ8WjtYO/u62C21Jdp6Ts9EriGmnpjKIG58u4iFW/vAEGK7 +8vknR+/RiTlDxN/e4UG/VHMgly1s2vPUB6PmudhvrvyMGS7TZ2crldtYXLVqAvO4 +g160a75BflcJdURQVc1aEWEhCmHCqYj9E7wtiS/NYeCVvsq1e+F7NGcLH7YMx3we +GVPKp7FKFSBWFHA9K4IsD50VHUeAR/94mQ4xr28+j+2GaR57GIgUssL8gjMunEst ++3A7caoreyYn8xrC3PsXuKHqy6C0rtOUfnrQq8PsOC0RLoi/1D+tEjtCrI8Cbn3M +0V9hvqG8OmpI6iZVIhZdXw3/JzOfGAN0iltSIEdrRU0id4xVJ/CvHozJgyJUt5rQ +T9nO/NkuHJYosQLTA70lUhw0Zk8jq/R3gpYd0VcwCBEF/VfR2ccCAwEAAaNCMEAw +HQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS +YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PA +FNr0Y/Dq9HHuTofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd +9XbXv8S2gVj/yP9kaWJ5rW4OH3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQI +UYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASxYfQAW0q3nHE3GYV5v4GwxxMOdnE+ +OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZXSEIx2C/pHF7uNke +gr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml+LLf +iAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUV +nuiZIesnKwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD +2NCcnWXL0CsnMQMeNuE9dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI// +1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm6Vwdp6POXiUyK+OVrCoHzrQoeIY8Laad +TdJ0MN1kURXbg4NR16/9M51NZg== +-----END CERTIFICATE----- + +# Issuer: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. +# Subject: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. +# Label: "Security Communication ECC RootCA1" +# Serial: 15446673492073852651 +# MD5 Fingerprint: 7e:43:b0:92:68:ec:05:43:4c:98:ab:5d:35:2e:7e:86 +# SHA1 Fingerprint: b8:0e:26:a9:bf:d2:b2:3b:c0:ef:46:c9:ba:c7:bb:f6:1d:0d:41:41 +# SHA256 Fingerprint: e7:4f:bd:a5:5b:d5:64:c4:73:a3:6b:44:1a:a7:99:c8:a6:8e:07:74:40:e8:28:8b:9f:a1:e5:0e:4b:ba:ca:11 +-----BEGIN CERTIFICATE----- +MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYT +AkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYD +VQQDEyJTZWN1cml0eSBDb21tdW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYx +NjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTELMAkGA1UEBhMCSlAxJTAjBgNVBAoT +HFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNVBAMTIlNlY3VyaXR5 +IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQAIgNi +AASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+Cnnfdl +dB9sELLo5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpK +ULGjQjBAMB0GA1UdDgQWBBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu +9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O +be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k= +-----END CERTIFICATE----- + +# Issuer: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY +# Subject: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY +# Label: "BJCA Global Root CA1" +# Serial: 113562791157148395269083148143378328608 +# MD5 Fingerprint: 42:32:99:76:43:33:36:24:35:07:82:9b:28:f9:d0:90 +# SHA1 Fingerprint: d5:ec:8d:7b:4c:ba:79:f4:e7:e8:cb:9d:6b:ae:77:83:10:03:21:6a +# SHA256 Fingerprint: f3:89:6f:88:fe:7c:0a:88:27:66:a7:fa:6a:d2:74:9f:b5:7a:7f:3e:98:fb:76:9c:1f:a7:b0:9c:2c:44:d5:ae +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBU +MQswCQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRI +T1JJVFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAz +MTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJF +SUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2Jh +bCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFmCL3Z +xRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZ +spDyRhySsTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O5 +58dnJCNPYwpj9mZ9S1WnP3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgR +at7GGPZHOiJBhyL8xIkoVNiMpTAK+BcWyqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll +5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRjeulumijWML3mG90Vr4Tq +nMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNnMoH1V6XK +V0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/ +pj+bOT0CFqMYs2esWz8sgytnOYFcuX6U1WTdno9uruh8W7TXakdI136z1C2OVnZO +z2nxbkRs1CTqjSShGL+9V/6pmTW12xB3uD1IutbB5/EjPtffhZ0nPNRAvQoMvfXn +jSXWgXSHRtQpdaJCbPdzied9v3pKH9MiyRVVz99vfFXQpIsHETdfg6YmV6YBW37+ +WGgHqel62bno/1Afq8K0wM7o6v0PvY1NuLxxAgMBAAGjQjBAMB0GA1UdDgQWBBTF +7+3M2I0hxkjk49cULqcWk+WYATAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE +AwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAUoKsITQfI/Ki2Pm4rzc2IInRNwPWaZ+4 +YRC6ojGYWUfo0Q0lHhVBDOAqVdVXUsv45Mdpox1NcQJeXyFFYEhcCY5JEMEE3Kli +awLwQ8hOnThJdMkycFRtwUf8jrQ2ntScvd0g1lPJGKm1Vrl2i5VnZu69mP6u775u ++2D2/VnGKhs/I0qUJDAnyIm860Qkmss9vk/Ves6OF8tiwdneHg56/0OGNFK8YT88 +X7vZdrRTvJez/opMEi4r89fO4aL/3Xtw+zuhTaRjAv04l5U/BXCga99igUOLtFkN +SoxUnMW7gZ/NfaXvCyUeOiDbHPwfmGcCCtRzRBPbUYQaVQNW4AB+dAb/OMRyHdOo +P2gxXdMJxy6MW2Pg6Nwe0uxhHvLe5e/2mXZgLR6UcnHGCyoyx5JO1UbXHfmpGQrI ++pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRz +znfSxqxx4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9 +eVzYH6Eze9mCUAyTF6ps3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2 +YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4SSPfSKcOYKMryMguTjClPPGAyzQWWYezy +r/6zcCwupvI= +-----END CERTIFICATE----- + +# Issuer: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY +# Subject: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY +# Label: "BJCA Global Root CA2" +# Serial: 58605626836079930195615843123109055211 +# MD5 Fingerprint: 5e:0a:f6:47:5f:a6:14:e8:11:01:95:3f:4d:01:eb:3c +# SHA1 Fingerprint: f4:27:86:eb:6e:b8:6d:88:31:67:02:fb:ba:66:a4:53:00:aa:7a:a6 +# SHA256 Fingerprint: 57:4d:f6:93:1e:27:80:39:66:7b:72:0a:fd:c1:60:0f:c2:7e:b6:6d:d3:09:29:79:fb:73:85:64:87:21:28:82 +-----BEGIN CERTIFICATE----- +MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQsw +CQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJ +VFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgy +MVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJ +TkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2JhbCBS +b290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jlSR9B +IgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK+ ++kpRuDCK/eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJK +sVF/BvDRgh9Obl+rg/xI1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA +94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8gUXOQwKhbYdDFUDn9hf7B +43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== +-----END CERTIFICATE----- + +# Issuer: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited +# Subject: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited +# Label: "Sectigo Public Server Authentication Root E46" +# Serial: 88989738453351742415770396670917916916 +# MD5 Fingerprint: 28:23:f8:b2:98:5c:37:16:3b:3e:46:13:4e:b0:b3:01 +# SHA1 Fingerprint: ec:8a:39:6c:40:f0:2e:bc:42:75:d4:9f:ab:1c:1a:5b:67:be:d2:9a +# SHA256 Fingerprint: c9:0f:26:f0:fb:1b:40:18:b2:22:27:51:9b:5c:a2:b5:3e:2c:a5:b3:be:5c:f1:8e:fe:1b:ef:47:38:0c:53:83 +-----BEGIN CERTIFICATE----- +MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQsw +CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T +ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcN +MjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYG +A1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT +ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccC +WvkEN/U0NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+ +6xnOQ6OjQjBAMB0GA1UdDgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8B +Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjAn7qRa +qCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RHlAFWovgzJQxC36oCMB3q +4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21USAGKcw== +-----END CERTIFICATE----- + +# Issuer: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited +# Subject: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited +# Label: "Sectigo Public Server Authentication Root R46" +# Serial: 156256931880233212765902055439220583700 +# MD5 Fingerprint: 32:10:09:52:00:d5:7e:6c:43:df:15:c0:b1:16:93:e5 +# SHA1 Fingerprint: ad:98:f9:f3:e4:7d:75:3b:65:d4:82:b3:a4:52:17:bb:6e:f5:e4:38 +# SHA256 Fingerprint: 7b:b6:47:a6:2a:ee:ac:88:bf:25:7a:a5:22:d0:1f:fe:a3:95:e0:ab:45:c7:3f:93:f6:56:54:ec:38:f2:5a:06 +-----BEGIN CERTIFICATE----- +MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBf +MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQD +Ey1TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYw +HhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEY +MBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1Ymxp +YyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDa +ef0rty2k1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnz +SDBh+oF8HqcIStw+KxwfGExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xf +iOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMPFF1bFOdLvt30yNoDN9HWOaEhUTCDsG3X +ME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vuZDCQOc2TZYEhMbUjUDM3 +IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5QazYw6A3OAS +VYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgE +SJ/AwSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu ++Zd4KKTIRJLpfSYFplhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt +8uaZFURww3y8nDnAtOFr94MlI1fZEoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+L +HaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW6aWWrL3DkJiy4Pmi1KZHQ3xt +zwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWIIUkwDgYDVR0P +AQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c +mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQ +YKlJfp/imTYpE0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52 +gDY9hAaLMyZlbcp+nv4fjFg4exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZA +Fv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M0ejf5lG5Nkc/kLnHvALcWxxPDkjB +JYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI84HxZmduTILA7rpX +DhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9mpFui +TdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5 +dHn5HrwdVw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65 +LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp +0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmmJ1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAY +QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation +# Subject: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation +# Label: "SSL.com TLS RSA Root CA 2022" +# Serial: 148535279242832292258835760425842727825 +# MD5 Fingerprint: d8:4e:c6:59:30:d8:fe:a0:d6:7a:5a:2c:2c:69:78:da +# SHA1 Fingerprint: ec:2c:83:40:72:af:26:95:10:ff:0e:f2:03:ee:31:70:f6:78:9d:ca +# SHA256 Fingerprint: 8f:af:7d:2e:2c:b4:70:9b:b8:e0:b3:36:66:bf:75:a5:dd:45:b5:de:48:0f:8e:a8:d4:bf:e6:be:bc:17:f2:ed +-----BEGIN CERTIFICATE----- +MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBO +MQswCQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQD +DBxTU0wuY29tIFRMUyBSU0EgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloX +DTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jw +b3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJvb3QgQ0EgMjAyMjCC +AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u9nTP +L3tYPc48DRAokC+X94xI2KDYJbFMsBFMF3NQ0CJKY7uB0ylu1bUJPiYYf7ISf5OY +t6/wNr/y7hienDtSxUcZXXTzZGbVXcdotL8bHAajvI9AI7YexoS9UcQbOcGV0ins +S657Lb85/bRi3pZ7QcacoOAGcvvwB5cJOYF0r/c0WRFXCsJbwST0MXMwgsadugL3 +PnxEX4MN8/HdIGkWCVDi1FW24IBydm5MR7d1VVm0U3TZlMZBrViKMWYPHqIbKUBO +L9975hYsLfy/7PO0+r4Y9ptJ1O4Fbtk085zx7AGL0SDGD6C1vBdOSHtRwvzpXGk3 +R2azaPgVKPC506QVzFpPulJwoxJF3ca6TvvC0PeoUidtbnm1jPx7jMEWTO6Af77w +dr5BUxIzrlo4QqvXDz5BjXYHMtWrifZOZ9mxQnUjbvPNQrL8VfVThxc7wDNY8VLS ++YCk8OjwO4s4zKTGkH8PnP2L0aPP2oOnaclQNtVcBdIKQXTbYxE3waWglksejBYS +d66UNHsef8JmAOSqg+qKkK3ONkRN0VHpvB/zagX9wHQfJRlAUW7qglFA35u5CCoG +AtUjHBPW6dvbxrB6y3snm/vg1UYk7RBLY0ulBY+6uB0rpvqR4pJSvezrZ5dtmi2f +gTIFZzL7SAg/2SW4BCUvAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j +BBgwFoAU+y437uOEeicuzRk1sTN8/9REQrkwHQYDVR0OBBYEFPsuN+7jhHonLs0Z +NbEzfP/UREK5MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAjYlt +hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsM +QtfhWsSWTVTNj8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvf +R4iyrT7gJ4eLSYwfqUdYe5byiB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJ +DPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjUo3KUQyxi4U5cMj29TH0ZR6LDSeeW +P4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqoENjwuSfr98t67wVy +lrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7EgkaibMOlq +bLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2w +AgDHbICivRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3q +r5nsLFR+jM4uElZI7xc7P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sji +Mho6/4UIyYOf8kpIEFR3N+2ivEC+5BB09+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU +98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA= +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation +# Subject: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation +# Label: "SSL.com TLS ECC Root CA 2022" +# Serial: 26605119622390491762507526719404364228 +# MD5 Fingerprint: 99:d7:5c:f1:51:36:cc:e9:ce:d9:19:2e:77:71:56:c5 +# SHA1 Fingerprint: 9f:5f:d9:1a:54:6d:f5:0c:71:f0:ee:7a:bd:17:49:98:84:73:e2:39 +# SHA256 Fingerprint: c3:2f:fd:9f:46:f9:36:d1:6c:36:73:99:09:59:43:4b:9a:d6:0a:af:bb:9e:7c:f3:36:54:f1:44:cc:1b:a1:43 +-----BEGIN CERTIFICATE----- +MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw +CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT +U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2 +MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh +dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG +ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm +acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN +SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME +GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW +uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp +15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN +b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g== +-----END CERTIFICATE----- + +# Issuer: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos +# Subject: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos +# Label: "Atos TrustedRoot Root CA ECC TLS 2021" +# Serial: 81873346711060652204712539181482831616 +# MD5 Fingerprint: 16:9f:ad:f1:70:ad:79:d6:ed:29:b4:d1:c5:79:70:a8 +# SHA1 Fingerprint: 9e:bc:75:10:42:b3:02:f3:81:f4:f7:30:62:d4:8f:c3:a7:51:b2:dd +# SHA256 Fingerprint: b2:fa:e5:3e:14:cc:d7:ab:92:12:06:47:01:ae:27:9c:1d:89:88:fa:cb:77:5f:a8:a0:08:91:4e:66:39:88:a8 +-----BEGIN CERTIFICATE----- +MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4w +LAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0w +CwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0 +MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBF +Q0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMHYwEAYHKoZI +zj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6KDP/X +tXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4 +AjJn8ZQSb+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2 +KCXWfeBmmnoJsmo7jjPXNtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMD +aAAwZQIwW5kp85wxtolrbNa9d+F851F+uDrNozZffPc8dz7kUK2o59JZDCaOMDtu +CCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGYa3cpetskz2VAv9LcjBHo +9H1/IISpQuQo +-----END CERTIFICATE----- + +# Issuer: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos +# Subject: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos +# Label: "Atos TrustedRoot Root CA RSA TLS 2021" +# Serial: 111436099570196163832749341232207667876 +# MD5 Fingerprint: d4:d3:46:b8:9a:c0:9c:76:5d:9e:3a:c3:b9:99:31:d2 +# SHA1 Fingerprint: 18:52:3b:0d:06:37:e4:d6:3a:df:23:e4:98:fb:5b:16:fb:86:74:48 +# SHA256 Fingerprint: 81:a9:08:8e:a5:9f:b3:64:c5:48:a6:f8:55:59:09:9b:6f:04:05:ef:bf:18:e5:32:4e:c9:f4:57:ba:00:11:2f +-----BEGIN CERTIFICATE----- +MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBM +MS4wLAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIx +MQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00 +MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBD +QSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BBl01Z +4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYv +Ye+W/CBGvevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZ +kmGbzSoXfduP9LVq6hdKZChmFSlsAvFr1bqjM9xaZ6cF4r9lthawEO3NUDPJcFDs +GY6wx/J0W2tExn2WuZgIWWbeKQGb9Cpt0xU6kGpn8bRrZtkh68rZYnxGEFzedUln +nkL5/nWpo63/dgpnQOPF943HhZpZnmKaau1Fh5hnstVKPNe0OwANwI8f4UDErmwh +3El+fsqyjW22v5MvoVw+j8rtgI5Y4dtXz4U2OLJxpAmMkokIiEjxQGMYsluMWuPD +0xeqqxmjLBvk1cbiZnrXghmmOxYsL3GHX0WelXOTwkKBIROW1527k2gV+p2kHYzy +geBYBr3JtuP2iV2J+axEoctr+hbxx1A9JNr3w+SH1VbxT5Aw+kUJWdo0zuATHAR8 +ANSbhqRAvNncTFd+rrcztl524WWLZt+NyteYr842mIycg5kDcPOvdO3GDjbnvezB +c6eUWsuSZIKmAMFwoW4sKeFYV+xafJlrJaSQOoD0IJ2azsct+bJLKZWD6TWNp0lI +pw9MGZHQ9b8Q4HECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU +dEmZ0f+0emhFdcN+tNzMzjkz2ggwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB +DAUAA4ICAQAjQ1MkYlxt/T7Cz1UAbMVWiLkO3TriJQ2VSpfKgInuKs1l+NsW4AmS +4BjHeJi78+xCUvuppILXTdiK/ORO/auQxDh1MoSf/7OwKwIzNsAQkG8dnK/haZPs +o0UvFJ/1TCplQ3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJ +qM7F78PRreBrAwA0JrRUITWXAdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuyw +xfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9GslA9hGCZcbUztVdF5kJHdWoOsAgM +rr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2VktafcxBPTy+av5EzH4 +AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9qTFsR +0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuY +o7Ey7Nmj1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5 +dDTedk+SKlOxJTnbPP/lPqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcE +oji2jbDwN/zIIX8/syQbPYtuzE2wFg2WHYMfRsCbvUOZ58SWLs5fyQ== +-----END CERTIFICATE----- diff --git a/billinglayer/python/certifi/core.py b/billinglayer/python/certifi/core.py new file mode 100644 index 0000000..de02898 --- /dev/null +++ b/billinglayer/python/certifi/core.py @@ -0,0 +1,108 @@ +""" +certifi.py +~~~~~~~~~~ + +This module returns the installation location of cacert.pem or its contents. +""" +import sys + + +if sys.version_info >= (3, 11): + + from importlib.resources import as_file, files + + _CACERT_CTX = None + _CACERT_PATH = None + + def where() -> str: + # This is slightly terrible, but we want to delay extracting the file + # in cases where we're inside of a zipimport situation until someone + # actually calls where(), but we don't want to re-extract the file + # on every call of where(), so we'll do it once then store it in a + # global variable. + global _CACERT_CTX + global _CACERT_PATH + if _CACERT_PATH is None: + # This is slightly janky, the importlib.resources API wants you to + # manage the cleanup of this file, so it doesn't actually return a + # path, it returns a context manager that will give you the path + # when you enter it and will do any cleanup when you leave it. In + # the common case of not needing a temporary file, it will just + # return the file system location and the __exit__() is a no-op. + # + # We also have to hold onto the actual context manager, because + # it will do the cleanup whenever it gets garbage collected, so + # we will also store that at the global level as well. + _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem")) + _CACERT_PATH = str(_CACERT_CTX.__enter__()) + + return _CACERT_PATH + + def contents() -> str: + return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii") + +elif sys.version_info >= (3, 7): + + from importlib.resources import path as get_path, read_text + + _CACERT_CTX = None + _CACERT_PATH = None + + def where() -> str: + # This is slightly terrible, but we want to delay extracting the + # file in cases where we're inside of a zipimport situation until + # someone actually calls where(), but we don't want to re-extract + # the file on every call of where(), so we'll do it once then store + # it in a global variable. + global _CACERT_CTX + global _CACERT_PATH + if _CACERT_PATH is None: + # This is slightly janky, the importlib.resources API wants you + # to manage the cleanup of this file, so it doesn't actually + # return a path, it returns a context manager that will give + # you the path when you enter it and will do any cleanup when + # you leave it. In the common case of not needing a temporary + # file, it will just return the file system location and the + # __exit__() is a no-op. + # + # We also have to hold onto the actual context manager, because + # it will do the cleanup whenever it gets garbage collected, so + # we will also store that at the global level as well. + _CACERT_CTX = get_path("certifi", "cacert.pem") + _CACERT_PATH = str(_CACERT_CTX.__enter__()) + + return _CACERT_PATH + + def contents() -> str: + return read_text("certifi", "cacert.pem", encoding="ascii") + +else: + import os + import types + from typing import Union + + Package = Union[types.ModuleType, str] + Resource = Union[str, "os.PathLike"] + + # This fallback will work for Python versions prior to 3.7 that lack the + # importlib.resources module but relies on the existing `where` function + # so won't address issues with environments like PyOxidizer that don't set + # __file__ on modules. + def read_text( + package: Package, + resource: Resource, + encoding: str = 'utf-8', + errors: str = 'strict' + ) -> str: + with open(where(), encoding=encoding) as data: + return data.read() + + # If we don't have importlib.resources, then we will just do the old logic + # of assuming we're on the filesystem and munge the path directly. + def where() -> str: + f = os.path.dirname(__file__) + + return os.path.join(f, "cacert.pem") + + def contents() -> str: + return read_text("certifi", "cacert.pem", encoding="ascii") diff --git a/billinglayer/python/certifi/py.typed b/billinglayer/python/certifi/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/cffi-1.15.1.dist-info/INSTALLER b/billinglayer/python/cffi-1.15.1.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/cffi-1.15.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/cffi-1.15.1.dist-info/LICENSE b/billinglayer/python/cffi-1.15.1.dist-info/LICENSE new file mode 100644 index 0000000..29225ee --- /dev/null +++ b/billinglayer/python/cffi-1.15.1.dist-info/LICENSE @@ -0,0 +1,26 @@ + +Except when otherwise stated (look for LICENSE files in directories or +information at the beginning of each file) all software and +documentation is licensed as follows: + + The MIT License + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + diff --git a/billinglayer/python/cffi-1.15.1.dist-info/METADATA b/billinglayer/python/cffi-1.15.1.dist-info/METADATA new file mode 100644 index 0000000..538e679 --- /dev/null +++ b/billinglayer/python/cffi-1.15.1.dist-info/METADATA @@ -0,0 +1,34 @@ +Metadata-Version: 2.1 +Name: cffi +Version: 1.15.1 +Summary: Foreign Function Interface for Python calling C code. +Home-page: http://cffi.readthedocs.org +Author: Armin Rigo, Maciej Fijalkowski +Author-email: python-cffi@googlegroups.com +License: MIT +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: License :: OSI Approved :: MIT License +License-File: LICENSE +Requires-Dist: pycparser + + +CFFI +==== + +Foreign Function Interface for Python calling C code. +Please see the `Documentation `_. + +Contact +------- + +`Mailing list `_ diff --git a/billinglayer/python/cffi-1.15.1.dist-info/RECORD b/billinglayer/python/cffi-1.15.1.dist-info/RECORD new file mode 100644 index 0000000..9a17f6a --- /dev/null +++ b/billinglayer/python/cffi-1.15.1.dist-info/RECORD @@ -0,0 +1,44 @@ +_cffi_backend.cpython-311-x86_64-linux-gnu.so,sha256=Tqtlk67ccuzwROK1EjnDv_LCj8qMxKsTlJdYDjl3uvA,1065976 +cffi-1.15.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +cffi-1.15.1.dist-info/LICENSE,sha256=BLgPWwd7vtaICM_rreteNSPyqMmpZJXFh72W3x6sKjM,1294 +cffi-1.15.1.dist-info/METADATA,sha256=KP4G3WmavRgDGwD2b8Y_eDsM1YeV6ckcG6Alz3-D8VY,1144 +cffi-1.15.1.dist-info/RECORD,, +cffi-1.15.1.dist-info/WHEEL,sha256=MXkSmZj-ucMvJEZe-5F9uGaWQfgqj_gRjwLyMfC10Vs,152 +cffi-1.15.1.dist-info/entry_points.txt,sha256=y6jTxnyeuLnL-XJcDv8uML3n6wyYiGRg8MTp_QGJ9Ho,75 +cffi-1.15.1.dist-info/top_level.txt,sha256=rE7WR3rZfNKxWI9-jn6hsHCAl7MDkB-FmuQbxWjFehQ,19 +cffi/__init__.py,sha256=6xB_tafGvhhM5Xvj0Ova3oPC2SEhVlLTEObVLnazeiM,513 +cffi/__pycache__/__init__.cpython-311.pyc,, +cffi/__pycache__/api.cpython-311.pyc,, +cffi/__pycache__/backend_ctypes.cpython-311.pyc,, +cffi/__pycache__/cffi_opcode.cpython-311.pyc,, +cffi/__pycache__/commontypes.cpython-311.pyc,, +cffi/__pycache__/cparser.cpython-311.pyc,, +cffi/__pycache__/error.cpython-311.pyc,, +cffi/__pycache__/ffiplatform.cpython-311.pyc,, +cffi/__pycache__/lock.cpython-311.pyc,, +cffi/__pycache__/model.cpython-311.pyc,, +cffi/__pycache__/pkgconfig.cpython-311.pyc,, +cffi/__pycache__/recompiler.cpython-311.pyc,, +cffi/__pycache__/setuptools_ext.cpython-311.pyc,, +cffi/__pycache__/vengine_cpy.cpython-311.pyc,, +cffi/__pycache__/vengine_gen.cpython-311.pyc,, +cffi/__pycache__/verifier.cpython-311.pyc,, +cffi/_cffi_errors.h,sha256=zQXt7uR_m8gUW-fI2hJg0KoSkJFwXv8RGUkEDZ177dQ,3908 +cffi/_cffi_include.h,sha256=tKnA1rdSoPHp23FnDL1mDGwFo-Uj6fXfA6vA6kcoEUc,14800 +cffi/_embedding.h,sha256=9tnjF44QRobR8z0FGqAmAZY-wMSBOae1SUPqHccowqc,17680 +cffi/api.py,sha256=yxJalIePbr1mz_WxAHokSwyP5CVYde44m-nolHnbJNo,42064 +cffi/backend_ctypes.py,sha256=h5ZIzLc6BFVXnGyc9xPqZWUS7qGy7yFSDqXe68Sa8z4,42454 +cffi/cffi_opcode.py,sha256=v9RdD_ovA8rCtqsC95Ivki5V667rAOhGgs3fb2q9xpM,5724 +cffi/commontypes.py,sha256=QS4uxCDI7JhtTyjh1hlnCA-gynmaszWxJaRRLGkJa1A,2689 +cffi/cparser.py,sha256=rO_1pELRw1gI1DE1m4gi2ik5JMfpxouAACLXpRPlVEA,44231 +cffi/error.py,sha256=v6xTiS4U0kvDcy4h_BDRo5v39ZQuj-IMRYLv5ETddZs,877 +cffi/ffiplatform.py,sha256=HMXqR8ks2wtdsNxGaWpQ_PyqIvtiuos_vf1qKCy-cwg,4046 +cffi/lock.py,sha256=l9TTdwMIMpi6jDkJGnQgE9cvTIR7CAntIJr8EGHt3pY,747 +cffi/model.py,sha256=_GH_UF1Rn9vC4AvmgJm6qj7RUXXG3eqKPc8bPxxyBKE,21768 +cffi/parse_c_type.h,sha256=OdwQfwM9ktq6vlCB43exFQmxDBtj2MBNdK8LYl15tjw,5976 +cffi/pkgconfig.py,sha256=LP1w7vmWvmKwyqLaU1Z243FOWGNQMrgMUZrvgFuOlco,4374 +cffi/recompiler.py,sha256=YgVYTh2CrXIobo-vMk7_K9mwAXdd_LqB4-IbYABQ488,64598 +cffi/setuptools_ext.py,sha256=RUR17N5f8gpiQBBlXL34P9FtOu1mhHIaAf3WJlg5S4I,8931 +cffi/vengine_cpy.py,sha256=YglN8YS-UaHEv2k2cxgotNWE87dHX20-68EyKoiKUYA,43320 +cffi/vengine_gen.py,sha256=5dX7s1DU6pTBOMI6oTVn_8Bnmru_lj932B6b4v29Hlg,26684 +cffi/verifier.py,sha256=ESwuXWXtXrKEagCKveLRDjFzLNCyaKdqAgAlKREcyhY,11253 diff --git a/billinglayer/python/cffi-1.15.1.dist-info/WHEEL b/billinglayer/python/cffi-1.15.1.dist-info/WHEEL new file mode 100644 index 0000000..1d3967a --- /dev/null +++ b/billinglayer/python/cffi-1.15.1.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.1) +Root-Is-Purelib: false +Tag: cp311-cp311-manylinux_2_17_x86_64 +Tag: cp311-cp311-manylinux2014_x86_64 + diff --git a/billinglayer/python/cffi-1.15.1.dist-info/entry_points.txt b/billinglayer/python/cffi-1.15.1.dist-info/entry_points.txt new file mode 100644 index 0000000..4b0274f --- /dev/null +++ b/billinglayer/python/cffi-1.15.1.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[distutils.setup_keywords] +cffi_modules = cffi.setuptools_ext:cffi_modules diff --git a/billinglayer/python/cffi-1.15.1.dist-info/top_level.txt b/billinglayer/python/cffi-1.15.1.dist-info/top_level.txt new file mode 100644 index 0000000..f645779 --- /dev/null +++ b/billinglayer/python/cffi-1.15.1.dist-info/top_level.txt @@ -0,0 +1,2 @@ +_cffi_backend +cffi diff --git a/billinglayer/python/cffi/__init__.py b/billinglayer/python/cffi/__init__.py new file mode 100644 index 0000000..90e2e65 --- /dev/null +++ b/billinglayer/python/cffi/__init__.py @@ -0,0 +1,14 @@ +__all__ = ['FFI', 'VerificationError', 'VerificationMissing', 'CDefError', + 'FFIError'] + +from .api import FFI +from .error import CDefError, FFIError, VerificationError, VerificationMissing +from .error import PkgConfigError + +__version__ = "1.15.1" +__version_info__ = (1, 15, 1) + +# The verifier module file names are based on the CRC32 of a string that +# contains the following version number. It may be older than __version__ +# if nothing is clearly incompatible. +__version_verifier_modules__ = "0.8.6" diff --git a/billinglayer/python/cffi/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..a2bc643 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/api.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/api.cpython-311.pyc new file mode 100644 index 0000000..5eca4b0 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/api.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/backend_ctypes.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/backend_ctypes.cpython-311.pyc new file mode 100644 index 0000000..23c17b7 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/backend_ctypes.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/cffi_opcode.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/cffi_opcode.cpython-311.pyc new file mode 100644 index 0000000..476a810 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/cffi_opcode.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/commontypes.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/commontypes.cpython-311.pyc new file mode 100644 index 0000000..01eb5b9 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/commontypes.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/cparser.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/cparser.cpython-311.pyc new file mode 100644 index 0000000..a51a859 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/cparser.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/error.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/error.cpython-311.pyc new file mode 100644 index 0000000..0947871 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/error.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/ffiplatform.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/ffiplatform.cpython-311.pyc new file mode 100644 index 0000000..b52183c Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/ffiplatform.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/lock.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/lock.cpython-311.pyc new file mode 100644 index 0000000..4ec7eef Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/lock.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/model.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/model.cpython-311.pyc new file mode 100644 index 0000000..1e2e435 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/model.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/pkgconfig.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/pkgconfig.cpython-311.pyc new file mode 100644 index 0000000..6190437 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/pkgconfig.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/recompiler.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/recompiler.cpython-311.pyc new file mode 100644 index 0000000..58aa486 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/recompiler.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/setuptools_ext.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/setuptools_ext.cpython-311.pyc new file mode 100644 index 0000000..985cd71 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/setuptools_ext.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/vengine_cpy.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/vengine_cpy.cpython-311.pyc new file mode 100644 index 0000000..7149b8a Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/vengine_cpy.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/vengine_gen.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/vengine_gen.cpython-311.pyc new file mode 100644 index 0000000..0d6b1fb Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/vengine_gen.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/__pycache__/verifier.cpython-311.pyc b/billinglayer/python/cffi/__pycache__/verifier.cpython-311.pyc new file mode 100644 index 0000000..642e083 Binary files /dev/null and b/billinglayer/python/cffi/__pycache__/verifier.cpython-311.pyc differ diff --git a/billinglayer/python/cffi/_cffi_errors.h b/billinglayer/python/cffi/_cffi_errors.h new file mode 100644 index 0000000..158e059 --- /dev/null +++ b/billinglayer/python/cffi/_cffi_errors.h @@ -0,0 +1,149 @@ +#ifndef CFFI_MESSAGEBOX +# ifdef _MSC_VER +# define CFFI_MESSAGEBOX 1 +# else +# define CFFI_MESSAGEBOX 0 +# endif +#endif + + +#if CFFI_MESSAGEBOX +/* Windows only: logic to take the Python-CFFI embedding logic + initialization errors and display them in a background thread + with MessageBox. The idea is that if the whole program closes + as a result of this problem, then likely it is already a console + program and you can read the stderr output in the console too. + If it is not a console program, then it will likely show its own + dialog to complain, or generally not abruptly close, and for this + case the background thread should stay alive. +*/ +static void *volatile _cffi_bootstrap_text; + +static PyObject *_cffi_start_error_capture(void) +{ + PyObject *result = NULL; + PyObject *x, *m, *bi; + + if (InterlockedCompareExchangePointer(&_cffi_bootstrap_text, + (void *)1, NULL) != NULL) + return (PyObject *)1; + + m = PyImport_AddModule("_cffi_error_capture"); + if (m == NULL) + goto error; + + result = PyModule_GetDict(m); + if (result == NULL) + goto error; + +#if PY_MAJOR_VERSION >= 3 + bi = PyImport_ImportModule("builtins"); +#else + bi = PyImport_ImportModule("__builtin__"); +#endif + if (bi == NULL) + goto error; + PyDict_SetItemString(result, "__builtins__", bi); + Py_DECREF(bi); + + x = PyRun_String( + "import sys\n" + "class FileLike:\n" + " def write(self, x):\n" + " try:\n" + " of.write(x)\n" + " except: pass\n" + " self.buf += x\n" + " def flush(self):\n" + " pass\n" + "fl = FileLike()\n" + "fl.buf = ''\n" + "of = sys.stderr\n" + "sys.stderr = fl\n" + "def done():\n" + " sys.stderr = of\n" + " return fl.buf\n", /* make sure the returned value stays alive */ + Py_file_input, + result, result); + Py_XDECREF(x); + + error: + if (PyErr_Occurred()) + { + PyErr_WriteUnraisable(Py_None); + PyErr_Clear(); + } + return result; +} + +#pragma comment(lib, "user32.lib") + +static DWORD WINAPI _cffi_bootstrap_dialog(LPVOID ignored) +{ + Sleep(666); /* may be interrupted if the whole process is closing */ +#if PY_MAJOR_VERSION >= 3 + MessageBoxW(NULL, (wchar_t *)_cffi_bootstrap_text, + L"Python-CFFI error", + MB_OK | MB_ICONERROR); +#else + MessageBoxA(NULL, (char *)_cffi_bootstrap_text, + "Python-CFFI error", + MB_OK | MB_ICONERROR); +#endif + _cffi_bootstrap_text = NULL; + return 0; +} + +static void _cffi_stop_error_capture(PyObject *ecap) +{ + PyObject *s; + void *text; + + if (ecap == (PyObject *)1) + return; + + if (ecap == NULL) + goto error; + + s = PyRun_String("done()", Py_eval_input, ecap, ecap); + if (s == NULL) + goto error; + + /* Show a dialog box, but in a background thread, and + never show multiple dialog boxes at once. */ +#if PY_MAJOR_VERSION >= 3 + text = PyUnicode_AsWideCharString(s, NULL); +#else + text = PyString_AsString(s); +#endif + + _cffi_bootstrap_text = text; + + if (text != NULL) + { + HANDLE h; + h = CreateThread(NULL, 0, _cffi_bootstrap_dialog, + NULL, 0, NULL); + if (h != NULL) + CloseHandle(h); + } + /* decref the string, but it should stay alive as 'fl.buf' + in the small module above. It will really be freed only if + we later get another similar error. So it's a leak of at + most one copy of the small module. That's fine for this + situation which is usually a "fatal error" anyway. */ + Py_DECREF(s); + PyErr_Clear(); + return; + + error: + _cffi_bootstrap_text = NULL; + PyErr_Clear(); +} + +#else + +static PyObject *_cffi_start_error_capture(void) { return NULL; } +static void _cffi_stop_error_capture(PyObject *ecap) { } + +#endif diff --git a/billinglayer/python/cffi/_cffi_include.h b/billinglayer/python/cffi/_cffi_include.h new file mode 100644 index 0000000..e4c0a67 --- /dev/null +++ b/billinglayer/python/cffi/_cffi_include.h @@ -0,0 +1,385 @@ +#define _CFFI_ + +/* We try to define Py_LIMITED_API before including Python.h. + + Mess: we can only define it if Py_DEBUG, Py_TRACE_REFS and + Py_REF_DEBUG are not defined. This is a best-effort approximation: + we can learn about Py_DEBUG from pyconfig.h, but it is unclear if + the same works for the other two macros. Py_DEBUG implies them, + but not the other way around. + + The implementation is messy (issue #350): on Windows, with _MSC_VER, + we have to define Py_LIMITED_API even before including pyconfig.h. + In that case, we guess what pyconfig.h will do to the macros above, + and check our guess after the #include. + + Note that on Windows, with CPython 3.x, you need >= 3.5 and virtualenv + version >= 16.0.0. With older versions of either, you don't get a + copy of PYTHON3.DLL in the virtualenv. We can't check the version of + CPython *before* we even include pyconfig.h. ffi.set_source() puts + a ``#define _CFFI_NO_LIMITED_API'' at the start of this file if it is + running on Windows < 3.5, as an attempt at fixing it, but that's + arguably wrong because it may not be the target version of Python. + Still better than nothing I guess. As another workaround, you can + remove the definition of Py_LIMITED_API here. + + See also 'py_limited_api' in cffi/setuptools_ext.py. +*/ +#if !defined(_CFFI_USE_EMBEDDING) && !defined(Py_LIMITED_API) +# ifdef _MSC_VER +# if !defined(_DEBUG) && !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API) +# define Py_LIMITED_API +# endif +# include + /* sanity-check: Py_LIMITED_API will cause crashes if any of these + are also defined. Normally, the Python file PC/pyconfig.h does not + cause any of these to be defined, with the exception that _DEBUG + causes Py_DEBUG. Double-check that. */ +# ifdef Py_LIMITED_API +# if defined(Py_DEBUG) +# error "pyconfig.h unexpectedly defines Py_DEBUG, but Py_LIMITED_API is set" +# endif +# if defined(Py_TRACE_REFS) +# error "pyconfig.h unexpectedly defines Py_TRACE_REFS, but Py_LIMITED_API is set" +# endif +# if defined(Py_REF_DEBUG) +# error "pyconfig.h unexpectedly defines Py_REF_DEBUG, but Py_LIMITED_API is set" +# endif +# endif +# else +# include +# if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API) +# define Py_LIMITED_API +# endif +# endif +#endif + +#include +#ifdef __cplusplus +extern "C" { +#endif +#include +#include "parse_c_type.h" + +/* this block of #ifs should be kept exactly identical between + c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py + and cffi/_cffi_include.h */ +#if defined(_MSC_VER) +# include /* for alloca() */ +# if _MSC_VER < 1600 /* MSVC < 2010 */ + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; + typedef __int8 int_least8_t; + typedef __int16 int_least16_t; + typedef __int32 int_least32_t; + typedef __int64 int_least64_t; + typedef unsigned __int8 uint_least8_t; + typedef unsigned __int16 uint_least16_t; + typedef unsigned __int32 uint_least32_t; + typedef unsigned __int64 uint_least64_t; + typedef __int8 int_fast8_t; + typedef __int16 int_fast16_t; + typedef __int32 int_fast32_t; + typedef __int64 int_fast64_t; + typedef unsigned __int8 uint_fast8_t; + typedef unsigned __int16 uint_fast16_t; + typedef unsigned __int32 uint_fast32_t; + typedef unsigned __int64 uint_fast64_t; + typedef __int64 intmax_t; + typedef unsigned __int64 uintmax_t; +# else +# include +# endif +# if _MSC_VER < 1800 /* MSVC < 2013 */ +# ifndef __cplusplus + typedef unsigned char _Bool; +# endif +# endif +#else +# include +# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux) +# include +# endif +#endif + +#ifdef __GNUC__ +# define _CFFI_UNUSED_FN __attribute__((unused)) +#else +# define _CFFI_UNUSED_FN /* nothing */ +#endif + +#ifdef __cplusplus +# ifndef _Bool + typedef bool _Bool; /* semi-hackish: C++ has no _Bool; bool is builtin */ +# endif +#endif + +/********** CPython-specific section **********/ +#ifndef PYPY_VERSION + + +#if PY_MAJOR_VERSION >= 3 +# define PyInt_FromLong PyLong_FromLong +#endif + +#define _cffi_from_c_double PyFloat_FromDouble +#define _cffi_from_c_float PyFloat_FromDouble +#define _cffi_from_c_long PyInt_FromLong +#define _cffi_from_c_ulong PyLong_FromUnsignedLong +#define _cffi_from_c_longlong PyLong_FromLongLong +#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong +#define _cffi_from_c__Bool PyBool_FromLong + +#define _cffi_to_c_double PyFloat_AsDouble +#define _cffi_to_c_float PyFloat_AsDouble + +#define _cffi_from_c_int(x, type) \ + (((type)-1) > 0 ? /* unsigned */ \ + (sizeof(type) < sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + sizeof(type) == sizeof(long) ? \ + PyLong_FromUnsignedLong((unsigned long)x) : \ + PyLong_FromUnsignedLongLong((unsigned long long)x)) : \ + (sizeof(type) <= sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + PyLong_FromLongLong((long long)x))) + +#define _cffi_to_c_int(o, type) \ + ((type)( \ + sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o) \ + : (type)_cffi_to_c_i8(o)) : \ + sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o) \ + : (type)_cffi_to_c_i16(o)) : \ + sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o) \ + : (type)_cffi_to_c_i32(o)) : \ + sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o) \ + : (type)_cffi_to_c_i64(o)) : \ + (Py_FatalError("unsupported size for type " #type), (type)0))) + +#define _cffi_to_c_i8 \ + ((int(*)(PyObject *))_cffi_exports[1]) +#define _cffi_to_c_u8 \ + ((int(*)(PyObject *))_cffi_exports[2]) +#define _cffi_to_c_i16 \ + ((int(*)(PyObject *))_cffi_exports[3]) +#define _cffi_to_c_u16 \ + ((int(*)(PyObject *))_cffi_exports[4]) +#define _cffi_to_c_i32 \ + ((int(*)(PyObject *))_cffi_exports[5]) +#define _cffi_to_c_u32 \ + ((unsigned int(*)(PyObject *))_cffi_exports[6]) +#define _cffi_to_c_i64 \ + ((long long(*)(PyObject *))_cffi_exports[7]) +#define _cffi_to_c_u64 \ + ((unsigned long long(*)(PyObject *))_cffi_exports[8]) +#define _cffi_to_c_char \ + ((int(*)(PyObject *))_cffi_exports[9]) +#define _cffi_from_c_pointer \ + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[10]) +#define _cffi_to_c_pointer \ + ((char *(*)(PyObject *, struct _cffi_ctypedescr *))_cffi_exports[11]) +#define _cffi_get_struct_layout \ + not used any more +#define _cffi_restore_errno \ + ((void(*)(void))_cffi_exports[13]) +#define _cffi_save_errno \ + ((void(*)(void))_cffi_exports[14]) +#define _cffi_from_c_char \ + ((PyObject *(*)(char))_cffi_exports[15]) +#define _cffi_from_c_deref \ + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[16]) +#define _cffi_to_c \ + ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[17]) +#define _cffi_from_c_struct \ + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[18]) +#define _cffi_to_c_wchar_t \ + ((_cffi_wchar_t(*)(PyObject *))_cffi_exports[19]) +#define _cffi_from_c_wchar_t \ + ((PyObject *(*)(_cffi_wchar_t))_cffi_exports[20]) +#define _cffi_to_c_long_double \ + ((long double(*)(PyObject *))_cffi_exports[21]) +#define _cffi_to_c__Bool \ + ((_Bool(*)(PyObject *))_cffi_exports[22]) +#define _cffi_prepare_pointer_call_argument \ + ((Py_ssize_t(*)(struct _cffi_ctypedescr *, \ + PyObject *, char **))_cffi_exports[23]) +#define _cffi_convert_array_from_object \ + ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[24]) +#define _CFFI_CPIDX 25 +#define _cffi_call_python \ + ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[_CFFI_CPIDX]) +#define _cffi_to_c_wchar3216_t \ + ((int(*)(PyObject *))_cffi_exports[26]) +#define _cffi_from_c_wchar3216_t \ + ((PyObject *(*)(int))_cffi_exports[27]) +#define _CFFI_NUM_EXPORTS 28 + +struct _cffi_ctypedescr; + +static void *_cffi_exports[_CFFI_NUM_EXPORTS]; + +#define _cffi_type(index) ( \ + assert((((uintptr_t)_cffi_types[index]) & 1) == 0), \ + (struct _cffi_ctypedescr *)_cffi_types[index]) + +static PyObject *_cffi_init(const char *module_name, Py_ssize_t version, + const struct _cffi_type_context_s *ctx) +{ + PyObject *module, *o_arg, *new_module; + void *raw[] = { + (void *)module_name, + (void *)version, + (void *)_cffi_exports, + (void *)ctx, + }; + + module = PyImport_ImportModule("_cffi_backend"); + if (module == NULL) + goto failure; + + o_arg = PyLong_FromVoidPtr((void *)raw); + if (o_arg == NULL) + goto failure; + + new_module = PyObject_CallMethod( + module, (char *)"_init_cffi_1_0_external_module", (char *)"O", o_arg); + + Py_DECREF(o_arg); + Py_DECREF(module); + return new_module; + + failure: + Py_XDECREF(module); + return NULL; +} + + +#ifdef HAVE_WCHAR_H +typedef wchar_t _cffi_wchar_t; +#else +typedef uint16_t _cffi_wchar_t; /* same random pick as _cffi_backend.c */ +#endif + +_CFFI_UNUSED_FN static uint16_t _cffi_to_c_char16_t(PyObject *o) +{ + if (sizeof(_cffi_wchar_t) == 2) + return (uint16_t)_cffi_to_c_wchar_t(o); + else + return (uint16_t)_cffi_to_c_wchar3216_t(o); +} + +_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char16_t(uint16_t x) +{ + if (sizeof(_cffi_wchar_t) == 2) + return _cffi_from_c_wchar_t((_cffi_wchar_t)x); + else + return _cffi_from_c_wchar3216_t((int)x); +} + +_CFFI_UNUSED_FN static int _cffi_to_c_char32_t(PyObject *o) +{ + if (sizeof(_cffi_wchar_t) == 4) + return (int)_cffi_to_c_wchar_t(o); + else + return (int)_cffi_to_c_wchar3216_t(o); +} + +_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char32_t(unsigned int x) +{ + if (sizeof(_cffi_wchar_t) == 4) + return _cffi_from_c_wchar_t((_cffi_wchar_t)x); + else + return _cffi_from_c_wchar3216_t((int)x); +} + +union _cffi_union_alignment_u { + unsigned char m_char; + unsigned short m_short; + unsigned int m_int; + unsigned long m_long; + unsigned long long m_longlong; + float m_float; + double m_double; + long double m_longdouble; +}; + +struct _cffi_freeme_s { + struct _cffi_freeme_s *next; + union _cffi_union_alignment_u alignment; +}; + +_CFFI_UNUSED_FN static int +_cffi_convert_array_argument(struct _cffi_ctypedescr *ctptr, PyObject *arg, + char **output_data, Py_ssize_t datasize, + struct _cffi_freeme_s **freeme) +{ + char *p; + if (datasize < 0) + return -1; + + p = *output_data; + if (p == NULL) { + struct _cffi_freeme_s *fp = (struct _cffi_freeme_s *)PyObject_Malloc( + offsetof(struct _cffi_freeme_s, alignment) + (size_t)datasize); + if (fp == NULL) + return -1; + fp->next = *freeme; + *freeme = fp; + p = *output_data = (char *)&fp->alignment; + } + memset((void *)p, 0, (size_t)datasize); + return _cffi_convert_array_from_object(p, ctptr, arg); +} + +_CFFI_UNUSED_FN static void +_cffi_free_array_arguments(struct _cffi_freeme_s *freeme) +{ + do { + void *p = (void *)freeme; + freeme = freeme->next; + PyObject_Free(p); + } while (freeme != NULL); +} + +/********** end CPython-specific section **********/ +#else +_CFFI_UNUSED_FN +static void (*_cffi_call_python_org)(struct _cffi_externpy_s *, char *); +# define _cffi_call_python _cffi_call_python_org +#endif + + +#define _cffi_array_len(array) (sizeof(array) / sizeof((array)[0])) + +#define _cffi_prim_int(size, sign) \ + ((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \ + (size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \ + (size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \ + (size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \ + _CFFI__UNKNOWN_PRIM) + +#define _cffi_prim_float(size) \ + ((size) == sizeof(float) ? _CFFI_PRIM_FLOAT : \ + (size) == sizeof(double) ? _CFFI_PRIM_DOUBLE : \ + (size) == sizeof(long double) ? _CFFI__UNKNOWN_LONG_DOUBLE : \ + _CFFI__UNKNOWN_FLOAT_PRIM) + +#define _cffi_check_int(got, got_nonpos, expected) \ + ((got_nonpos) == (expected <= 0) && \ + (got) == (unsigned long long)expected) + +#ifdef MS_WIN32 +# define _cffi_stdcall __stdcall +#else +# define _cffi_stdcall /* nothing */ +#endif + +#ifdef __cplusplus +} +#endif diff --git a/billinglayer/python/cffi/_embedding.h b/billinglayer/python/cffi/_embedding.h new file mode 100644 index 0000000..8e8df88 --- /dev/null +++ b/billinglayer/python/cffi/_embedding.h @@ -0,0 +1,528 @@ + +/***** Support code for embedding *****/ + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined(_WIN32) +# define CFFI_DLLEXPORT __declspec(dllexport) +#elif defined(__GNUC__) +# define CFFI_DLLEXPORT __attribute__((visibility("default"))) +#else +# define CFFI_DLLEXPORT /* nothing */ +#endif + + +/* There are two global variables of type _cffi_call_python_fnptr: + + * _cffi_call_python, which we declare just below, is the one called + by ``extern "Python"`` implementations. + + * _cffi_call_python_org, which on CPython is actually part of the + _cffi_exports[] array, is the function pointer copied from + _cffi_backend. If _cffi_start_python() fails, then this is set + to NULL; otherwise, it should never be NULL. + + After initialization is complete, both are equal. However, the + first one remains equal to &_cffi_start_and_call_python until the + very end of initialization, when we are (or should be) sure that + concurrent threads also see a completely initialized world, and + only then is it changed. +*/ +#undef _cffi_call_python +typedef void (*_cffi_call_python_fnptr)(struct _cffi_externpy_s *, char *); +static void _cffi_start_and_call_python(struct _cffi_externpy_s *, char *); +static _cffi_call_python_fnptr _cffi_call_python = &_cffi_start_and_call_python; + + +#ifndef _MSC_VER + /* --- Assuming a GCC not infinitely old --- */ +# define cffi_compare_and_swap(l,o,n) __sync_bool_compare_and_swap(l,o,n) +# define cffi_write_barrier() __sync_synchronize() +# if !defined(__amd64__) && !defined(__x86_64__) && \ + !defined(__i386__) && !defined(__i386) +# define cffi_read_barrier() __sync_synchronize() +# else +# define cffi_read_barrier() (void)0 +# endif +#else + /* --- Windows threads version --- */ +# include +# define cffi_compare_and_swap(l,o,n) \ + (InterlockedCompareExchangePointer(l,n,o) == (o)) +# define cffi_write_barrier() InterlockedCompareExchange(&_cffi_dummy,0,0) +# define cffi_read_barrier() (void)0 +static volatile LONG _cffi_dummy; +#endif + +#ifdef WITH_THREAD +# ifndef _MSC_VER +# include + static pthread_mutex_t _cffi_embed_startup_lock; +# else + static CRITICAL_SECTION _cffi_embed_startup_lock; +# endif + static char _cffi_embed_startup_lock_ready = 0; +#endif + +static void _cffi_acquire_reentrant_mutex(void) +{ + static void *volatile lock = NULL; + + while (!cffi_compare_and_swap(&lock, NULL, (void *)1)) { + /* should ideally do a spin loop instruction here, but + hard to do it portably and doesn't really matter I + think: pthread_mutex_init() should be very fast, and + this is only run at start-up anyway. */ + } + +#ifdef WITH_THREAD + if (!_cffi_embed_startup_lock_ready) { +# ifndef _MSC_VER + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&_cffi_embed_startup_lock, &attr); +# else + InitializeCriticalSection(&_cffi_embed_startup_lock); +# endif + _cffi_embed_startup_lock_ready = 1; + } +#endif + + while (!cffi_compare_and_swap(&lock, (void *)1, NULL)) + ; + +#ifndef _MSC_VER + pthread_mutex_lock(&_cffi_embed_startup_lock); +#else + EnterCriticalSection(&_cffi_embed_startup_lock); +#endif +} + +static void _cffi_release_reentrant_mutex(void) +{ +#ifndef _MSC_VER + pthread_mutex_unlock(&_cffi_embed_startup_lock); +#else + LeaveCriticalSection(&_cffi_embed_startup_lock); +#endif +} + + +/********** CPython-specific section **********/ +#ifndef PYPY_VERSION + +#include "_cffi_errors.h" + + +#define _cffi_call_python_org _cffi_exports[_CFFI_CPIDX] + +PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(void); /* forward */ + +static void _cffi_py_initialize(void) +{ + /* XXX use initsigs=0, which "skips initialization registration of + signal handlers, which might be useful when Python is + embedded" according to the Python docs. But review and think + if it should be a user-controllable setting. + + XXX we should also give a way to write errors to a buffer + instead of to stderr. + + XXX if importing 'site' fails, CPython (any version) calls + exit(). Should we try to work around this behavior here? + */ + Py_InitializeEx(0); +} + +static int _cffi_initialize_python(void) +{ + /* This initializes Python, imports _cffi_backend, and then the + present .dll/.so is set up as a CPython C extension module. + */ + int result; + PyGILState_STATE state; + PyObject *pycode=NULL, *global_dict=NULL, *x; + PyObject *builtins; + + state = PyGILState_Ensure(); + + /* Call the initxxx() function from the present module. It will + create and initialize us as a CPython extension module, instead + of letting the startup Python code do it---it might reimport + the same .dll/.so and get maybe confused on some platforms. + It might also have troubles locating the .dll/.so again for all + I know. + */ + (void)_CFFI_PYTHON_STARTUP_FUNC(); + if (PyErr_Occurred()) + goto error; + + /* Now run the Python code provided to ffi.embedding_init_code(). + */ + pycode = Py_CompileString(_CFFI_PYTHON_STARTUP_CODE, + "", + Py_file_input); + if (pycode == NULL) + goto error; + global_dict = PyDict_New(); + if (global_dict == NULL) + goto error; + builtins = PyEval_GetBuiltins(); + if (builtins == NULL) + goto error; + if (PyDict_SetItemString(global_dict, "__builtins__", builtins) < 0) + goto error; + x = PyEval_EvalCode( +#if PY_MAJOR_VERSION < 3 + (PyCodeObject *) +#endif + pycode, global_dict, global_dict); + if (x == NULL) + goto error; + Py_DECREF(x); + + /* Done! Now if we've been called from + _cffi_start_and_call_python() in an ``extern "Python"``, we can + only hope that the Python code did correctly set up the + corresponding @ffi.def_extern() function. Otherwise, the + general logic of ``extern "Python"`` functions (inside the + _cffi_backend module) will find that the reference is still + missing and print an error. + */ + result = 0; + done: + Py_XDECREF(pycode); + Py_XDECREF(global_dict); + PyGILState_Release(state); + return result; + + error:; + { + /* Print as much information as potentially useful. + Debugging load-time failures with embedding is not fun + */ + PyObject *ecap; + PyObject *exception, *v, *tb, *f, *modules, *mod; + PyErr_Fetch(&exception, &v, &tb); + ecap = _cffi_start_error_capture(); + f = PySys_GetObject((char *)"stderr"); + if (f != NULL && f != Py_None) { + PyFile_WriteString( + "Failed to initialize the Python-CFFI embedding logic:\n\n", f); + } + + if (exception != NULL) { + PyErr_NormalizeException(&exception, &v, &tb); + PyErr_Display(exception, v, tb); + } + Py_XDECREF(exception); + Py_XDECREF(v); + Py_XDECREF(tb); + + if (f != NULL && f != Py_None) { + PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME + "\ncompiled with cffi version: 1.15.1" + "\n_cffi_backend module: ", f); + modules = PyImport_GetModuleDict(); + mod = PyDict_GetItemString(modules, "_cffi_backend"); + if (mod == NULL) { + PyFile_WriteString("not loaded", f); + } + else { + v = PyObject_GetAttrString(mod, "__file__"); + PyFile_WriteObject(v, f, 0); + Py_XDECREF(v); + } + PyFile_WriteString("\nsys.path: ", f); + PyFile_WriteObject(PySys_GetObject((char *)"path"), f, 0); + PyFile_WriteString("\n\n", f); + } + _cffi_stop_error_capture(ecap); + } + result = -1; + goto done; +} + +#if PY_VERSION_HEX < 0x03080000 +PyAPI_DATA(char *) _PyParser_TokenNames[]; /* from CPython */ +#endif + +static int _cffi_carefully_make_gil(void) +{ + /* This does the basic initialization of Python. It can be called + completely concurrently from unrelated threads. It assumes + that we don't hold the GIL before (if it exists), and we don't + hold it afterwards. + + (What it really does used to be completely different in Python 2 + and Python 3, with the Python 2 solution avoiding the spin-lock + around the Py_InitializeEx() call. However, after recent changes + to CPython 2.7 (issue #358) it no longer works. So we use the + Python 3 solution everywhere.) + + This initializes Python by calling Py_InitializeEx(). + Important: this must not be called concurrently at all. + So we use a global variable as a simple spin lock. This global + variable must be from 'libpythonX.Y.so', not from this + cffi-based extension module, because it must be shared from + different cffi-based extension modules. + + In Python < 3.8, we choose + _PyParser_TokenNames[0] as a completely arbitrary pointer value + that is never written to. The default is to point to the + string "ENDMARKER". We change it temporarily to point to the + next character in that string. (Yes, I know it's REALLY + obscure.) + + In Python >= 3.8, this string array is no longer writable, so + instead we pick PyCapsuleType.tp_version_tag. We can't change + Python < 3.8 because someone might use a mixture of cffi + embedded modules, some of which were compiled before this file + changed. + */ + +#ifdef WITH_THREAD +# if PY_VERSION_HEX < 0x03080000 + char *volatile *lock = (char *volatile *)_PyParser_TokenNames; + char *old_value, *locked_value; + + while (1) { /* spin loop */ + old_value = *lock; + locked_value = old_value + 1; + if (old_value[0] == 'E') { + assert(old_value[1] == 'N'); + if (cffi_compare_and_swap(lock, old_value, locked_value)) + break; + } + else { + assert(old_value[0] == 'N'); + /* should ideally do a spin loop instruction here, but + hard to do it portably and doesn't really matter I + think: PyEval_InitThreads() should be very fast, and + this is only run at start-up anyway. */ + } + } +# else + int volatile *lock = (int volatile *)&PyCapsule_Type.tp_version_tag; + int old_value, locked_value; + assert(!(PyCapsule_Type.tp_flags & Py_TPFLAGS_HAVE_VERSION_TAG)); + + while (1) { /* spin loop */ + old_value = *lock; + locked_value = -42; + if (old_value == 0) { + if (cffi_compare_and_swap(lock, old_value, locked_value)) + break; + } + else { + assert(old_value == locked_value); + /* should ideally do a spin loop instruction here, but + hard to do it portably and doesn't really matter I + think: PyEval_InitThreads() should be very fast, and + this is only run at start-up anyway. */ + } + } +# endif +#endif + + /* call Py_InitializeEx() */ + if (!Py_IsInitialized()) { + _cffi_py_initialize(); +#if PY_VERSION_HEX < 0x03070000 + PyEval_InitThreads(); +#endif + PyEval_SaveThread(); /* release the GIL */ + /* the returned tstate must be the one that has been stored into the + autoTLSkey by _PyGILState_Init() called from Py_Initialize(). */ + } + else { +#if PY_VERSION_HEX < 0x03070000 + /* PyEval_InitThreads() is always a no-op from CPython 3.7 */ + PyGILState_STATE state = PyGILState_Ensure(); + PyEval_InitThreads(); + PyGILState_Release(state); +#endif + } + +#ifdef WITH_THREAD + /* release the lock */ + while (!cffi_compare_and_swap(lock, locked_value, old_value)) + ; +#endif + + return 0; +} + +/********** end CPython-specific section **********/ + + +#else + + +/********** PyPy-specific section **********/ + +PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(const void *[]); /* forward */ + +static struct _cffi_pypy_init_s { + const char *name; + void *func; /* function pointer */ + const char *code; +} _cffi_pypy_init = { + _CFFI_MODULE_NAME, + _CFFI_PYTHON_STARTUP_FUNC, + _CFFI_PYTHON_STARTUP_CODE, +}; + +extern int pypy_carefully_make_gil(const char *); +extern int pypy_init_embedded_cffi_module(int, struct _cffi_pypy_init_s *); + +static int _cffi_carefully_make_gil(void) +{ + return pypy_carefully_make_gil(_CFFI_MODULE_NAME); +} + +static int _cffi_initialize_python(void) +{ + return pypy_init_embedded_cffi_module(0xB011, &_cffi_pypy_init); +} + +/********** end PyPy-specific section **********/ + + +#endif + + +#ifdef __GNUC__ +__attribute__((noinline)) +#endif +static _cffi_call_python_fnptr _cffi_start_python(void) +{ + /* Delicate logic to initialize Python. This function can be + called multiple times concurrently, e.g. when the process calls + its first ``extern "Python"`` functions in multiple threads at + once. It can also be called recursively, in which case we must + ignore it. We also have to consider what occurs if several + different cffi-based extensions reach this code in parallel + threads---it is a different copy of the code, then, and we + can't have any shared global variable unless it comes from + 'libpythonX.Y.so'. + + Idea: + + * _cffi_carefully_make_gil(): "carefully" call + PyEval_InitThreads() (possibly with Py_InitializeEx() first). + + * then we use a (local) custom lock to make sure that a call to this + cffi-based extension will wait if another call to the *same* + extension is running the initialization in another thread. + It is reentrant, so that a recursive call will not block, but + only one from a different thread. + + * then we grab the GIL and (Python 2) we call Py_InitializeEx(). + At this point, concurrent calls to Py_InitializeEx() are not + possible: we have the GIL. + + * do the rest of the specific initialization, which may + temporarily release the GIL but not the custom lock. + Only release the custom lock when we are done. + */ + static char called = 0; + + if (_cffi_carefully_make_gil() != 0) + return NULL; + + _cffi_acquire_reentrant_mutex(); + + /* Here the GIL exists, but we don't have it. We're only protected + from concurrency by the reentrant mutex. */ + + /* This file only initializes the embedded module once, the first + time this is called, even if there are subinterpreters. */ + if (!called) { + called = 1; /* invoke _cffi_initialize_python() only once, + but don't set '_cffi_call_python' right now, + otherwise concurrent threads won't call + this function at all (we need them to wait) */ + if (_cffi_initialize_python() == 0) { + /* now initialization is finished. Switch to the fast-path. */ + + /* We would like nobody to see the new value of + '_cffi_call_python' without also seeing the rest of the + data initialized. However, this is not possible. But + the new value of '_cffi_call_python' is the function + 'cffi_call_python()' from _cffi_backend. So: */ + cffi_write_barrier(); + /* ^^^ we put a write barrier here, and a corresponding + read barrier at the start of cffi_call_python(). This + ensures that after that read barrier, we see everything + done here before the write barrier. + */ + + assert(_cffi_call_python_org != NULL); + _cffi_call_python = (_cffi_call_python_fnptr)_cffi_call_python_org; + } + else { + /* initialization failed. Reset this to NULL, even if it was + already set to some other value. Future calls to + _cffi_start_python() are still forced to occur, and will + always return NULL from now on. */ + _cffi_call_python_org = NULL; + } + } + + _cffi_release_reentrant_mutex(); + + return (_cffi_call_python_fnptr)_cffi_call_python_org; +} + +static +void _cffi_start_and_call_python(struct _cffi_externpy_s *externpy, char *args) +{ + _cffi_call_python_fnptr fnptr; + int current_err = errno; +#ifdef _MSC_VER + int current_lasterr = GetLastError(); +#endif + fnptr = _cffi_start_python(); + if (fnptr == NULL) { + fprintf(stderr, "function %s() called, but initialization code " + "failed. Returning 0.\n", externpy->name); + memset(args, 0, externpy->size_of_result); + } +#ifdef _MSC_VER + SetLastError(current_lasterr); +#endif + errno = current_err; + + if (fnptr != NULL) + fnptr(externpy, args); +} + + +/* The cffi_start_python() function makes sure Python is initialized + and our cffi module is set up. It can be called manually from the + user C code. The same effect is obtained automatically from any + dll-exported ``extern "Python"`` function. This function returns + -1 if initialization failed, 0 if all is OK. */ +_CFFI_UNUSED_FN +static int cffi_start_python(void) +{ + if (_cffi_call_python == &_cffi_start_and_call_python) { + if (_cffi_start_python() == NULL) + return -1; + } + cffi_read_barrier(); + return 0; +} + +#undef cffi_compare_and_swap +#undef cffi_write_barrier +#undef cffi_read_barrier + +#ifdef __cplusplus +} +#endif diff --git a/billinglayer/python/cffi/api.py b/billinglayer/python/cffi/api.py new file mode 100644 index 0000000..999a8ae --- /dev/null +++ b/billinglayer/python/cffi/api.py @@ -0,0 +1,965 @@ +import sys, types +from .lock import allocate_lock +from .error import CDefError +from . import model + +try: + callable +except NameError: + # Python 3.1 + from collections import Callable + callable = lambda x: isinstance(x, Callable) + +try: + basestring +except NameError: + # Python 3.x + basestring = str + +_unspecified = object() + + + +class FFI(object): + r''' + The main top-level class that you instantiate once, or once per module. + + Example usage: + + ffi = FFI() + ffi.cdef(""" + int printf(const char *, ...); + """) + + C = ffi.dlopen(None) # standard library + -or- + C = ffi.verify() # use a C compiler: verify the decl above is right + + C.printf("hello, %s!\n", ffi.new("char[]", "world")) + ''' + + def __init__(self, backend=None): + """Create an FFI instance. The 'backend' argument is used to + select a non-default backend, mostly for tests. + """ + if backend is None: + # You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with + # _cffi_backend.so compiled. + import _cffi_backend as backend + from . import __version__ + if backend.__version__ != __version__: + # bad version! Try to be as explicit as possible. + if hasattr(backend, '__file__'): + # CPython + raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r. The two versions should be equal; check your installation." % ( + __version__, __file__, + backend.__version__, backend.__file__)) + else: + # PyPy + raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. This interpreter comes with a built-in '_cffi_backend' module, which is version %s. The two versions should be equal; check your installation." % ( + __version__, __file__, backend.__version__)) + # (If you insist you can also try to pass the option + # 'backend=backend_ctypes.CTypesBackend()', but don't + # rely on it! It's probably not going to work well.) + + from . import cparser + self._backend = backend + self._lock = allocate_lock() + self._parser = cparser.Parser() + self._cached_btypes = {} + self._parsed_types = types.ModuleType('parsed_types').__dict__ + self._new_types = types.ModuleType('new_types').__dict__ + self._function_caches = [] + self._libraries = [] + self._cdefsources = [] + self._included_ffis = [] + self._windows_unicode = None + self._init_once_cache = {} + self._cdef_version = None + self._embedding = None + self._typecache = model.get_typecache(backend) + if hasattr(backend, 'set_ffi'): + backend.set_ffi(self) + for name in list(backend.__dict__): + if name.startswith('RTLD_'): + setattr(self, name, getattr(backend, name)) + # + with self._lock: + self.BVoidP = self._get_cached_btype(model.voidp_type) + self.BCharA = self._get_cached_btype(model.char_array_type) + if isinstance(backend, types.ModuleType): + # _cffi_backend: attach these constants to the class + if not hasattr(FFI, 'NULL'): + FFI.NULL = self.cast(self.BVoidP, 0) + FFI.CData, FFI.CType = backend._get_types() + else: + # ctypes backend: attach these constants to the instance + self.NULL = self.cast(self.BVoidP, 0) + self.CData, self.CType = backend._get_types() + self.buffer = backend.buffer + + def cdef(self, csource, override=False, packed=False, pack=None): + """Parse the given C source. This registers all declared functions, + types, and global variables. The functions and global variables can + then be accessed via either 'ffi.dlopen()' or 'ffi.verify()'. + The types can be used in 'ffi.new()' and other functions. + If 'packed' is specified as True, all structs declared inside this + cdef are packed, i.e. laid out without any field alignment at all. + Alternatively, 'pack' can be a small integer, and requests for + alignment greater than that are ignored (pack=1 is equivalent to + packed=True). + """ + self._cdef(csource, override=override, packed=packed, pack=pack) + + def embedding_api(self, csource, packed=False, pack=None): + self._cdef(csource, packed=packed, pack=pack, dllexport=True) + if self._embedding is None: + self._embedding = '' + + def _cdef(self, csource, override=False, **options): + if not isinstance(csource, str): # unicode, on Python 2 + if not isinstance(csource, basestring): + raise TypeError("cdef() argument must be a string") + csource = csource.encode('ascii') + with self._lock: + self._cdef_version = object() + self._parser.parse(csource, override=override, **options) + self._cdefsources.append(csource) + if override: + for cache in self._function_caches: + cache.clear() + finishlist = self._parser._recomplete + if finishlist: + self._parser._recomplete = [] + for tp in finishlist: + tp.finish_backend_type(self, finishlist) + + def dlopen(self, name, flags=0): + """Load and return a dynamic library identified by 'name'. + The standard C library can be loaded by passing None. + Note that functions and types declared by 'ffi.cdef()' are not + linked to a particular library, just like C headers; in the + library we only look for the actual (untyped) symbols. + """ + if not (isinstance(name, basestring) or + name is None or + isinstance(name, self.CData)): + raise TypeError("dlopen(name): name must be a file name, None, " + "or an already-opened 'void *' handle") + with self._lock: + lib, function_cache = _make_ffi_library(self, name, flags) + self._function_caches.append(function_cache) + self._libraries.append(lib) + return lib + + def dlclose(self, lib): + """Close a library obtained with ffi.dlopen(). After this call, + access to functions or variables from the library will fail + (possibly with a segmentation fault). + """ + type(lib).__cffi_close__(lib) + + def _typeof_locked(self, cdecl): + # call me with the lock! + key = cdecl + if key in self._parsed_types: + return self._parsed_types[key] + # + if not isinstance(cdecl, str): # unicode, on Python 2 + cdecl = cdecl.encode('ascii') + # + type = self._parser.parse_type(cdecl) + really_a_function_type = type.is_raw_function + if really_a_function_type: + type = type.as_function_pointer() + btype = self._get_cached_btype(type) + result = btype, really_a_function_type + self._parsed_types[key] = result + return result + + def _typeof(self, cdecl, consider_function_as_funcptr=False): + # string -> ctype object + try: + result = self._parsed_types[cdecl] + except KeyError: + with self._lock: + result = self._typeof_locked(cdecl) + # + btype, really_a_function_type = result + if really_a_function_type and not consider_function_as_funcptr: + raise CDefError("the type %r is a function type, not a " + "pointer-to-function type" % (cdecl,)) + return btype + + def typeof(self, cdecl): + """Parse the C type given as a string and return the + corresponding object. + It can also be used on 'cdata' instance to get its C type. + """ + if isinstance(cdecl, basestring): + return self._typeof(cdecl) + if isinstance(cdecl, self.CData): + return self._backend.typeof(cdecl) + if isinstance(cdecl, types.BuiltinFunctionType): + res = _builtin_function_type(cdecl) + if res is not None: + return res + if (isinstance(cdecl, types.FunctionType) + and hasattr(cdecl, '_cffi_base_type')): + with self._lock: + return self._get_cached_btype(cdecl._cffi_base_type) + raise TypeError(type(cdecl)) + + def sizeof(self, cdecl): + """Return the size in bytes of the argument. It can be a + string naming a C type, or a 'cdata' instance. + """ + if isinstance(cdecl, basestring): + BType = self._typeof(cdecl) + return self._backend.sizeof(BType) + else: + return self._backend.sizeof(cdecl) + + def alignof(self, cdecl): + """Return the natural alignment size in bytes of the C type + given as a string. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.alignof(cdecl) + + def offsetof(self, cdecl, *fields_or_indexes): + """Return the offset of the named field inside the given + structure or array, which must be given as a C type name. + You can give several field names in case of nested structures. + You can also give numeric values which correspond to array + items, in case of an array type. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._typeoffsetof(cdecl, *fields_or_indexes)[1] + + def new(self, cdecl, init=None): + """Allocate an instance according to the specified C type and + return a pointer to it. The specified C type must be either a + pointer or an array: ``new('X *')`` allocates an X and returns + a pointer to it, whereas ``new('X[n]')`` allocates an array of + n X'es and returns an array referencing it (which works + mostly like a pointer, like in C). You can also use + ``new('X[]', n)`` to allocate an array of a non-constant + length n. + + The memory is initialized following the rules of declaring a + global variable in C: by default it is zero-initialized, but + an explicit initializer can be given which can be used to + fill all or part of the memory. + + When the returned object goes out of scope, the memory + is freed. In other words the returned object has + ownership of the value of type 'cdecl' that it points to. This + means that the raw data can be used as long as this object is + kept alive, but must not be used for a longer time. Be careful + about that when copying the pointer to the memory somewhere + else, e.g. into another structure. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.newp(cdecl, init) + + def new_allocator(self, alloc=None, free=None, + should_clear_after_alloc=True): + """Return a new allocator, i.e. a function that behaves like ffi.new() + but uses the provided low-level 'alloc' and 'free' functions. + + 'alloc' is called with the size as argument. If it returns NULL, a + MemoryError is raised. 'free' is called with the result of 'alloc' + as argument. Both can be either Python function or directly C + functions. If 'free' is None, then no free function is called. + If both 'alloc' and 'free' are None, the default is used. + + If 'should_clear_after_alloc' is set to False, then the memory + returned by 'alloc' is assumed to be already cleared (or you are + fine with garbage); otherwise CFFI will clear it. + """ + compiled_ffi = self._backend.FFI() + allocator = compiled_ffi.new_allocator(alloc, free, + should_clear_after_alloc) + def allocate(cdecl, init=None): + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return allocator(cdecl, init) + return allocate + + def cast(self, cdecl, source): + """Similar to a C cast: returns an instance of the named C + type initialized with the given 'source'. The source is + casted between integers or pointers of any type. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.cast(cdecl, source) + + def string(self, cdata, maxlen=-1): + """Return a Python string (or unicode string) from the 'cdata'. + If 'cdata' is a pointer or array of characters or bytes, returns + the null-terminated string. The returned string extends until + the first null character, or at most 'maxlen' characters. If + 'cdata' is an array then 'maxlen' defaults to its length. + + If 'cdata' is a pointer or array of wchar_t, returns a unicode + string following the same rules. + + If 'cdata' is a single character or byte or a wchar_t, returns + it as a string or unicode string. + + If 'cdata' is an enum, returns the value of the enumerator as a + string, or 'NUMBER' if the value is out of range. + """ + return self._backend.string(cdata, maxlen) + + def unpack(self, cdata, length): + """Unpack an array of C data of the given length, + returning a Python string/unicode/list. + + If 'cdata' is a pointer to 'char', returns a byte string. + It does not stop at the first null. This is equivalent to: + ffi.buffer(cdata, length)[:] + + If 'cdata' is a pointer to 'wchar_t', returns a unicode string. + 'length' is measured in wchar_t's; it is not the size in bytes. + + If 'cdata' is a pointer to anything else, returns a list of + 'length' items. This is a faster equivalent to: + [cdata[i] for i in range(length)] + """ + return self._backend.unpack(cdata, length) + + #def buffer(self, cdata, size=-1): + # """Return a read-write buffer object that references the raw C data + # pointed to by the given 'cdata'. The 'cdata' must be a pointer or + # an array. Can be passed to functions expecting a buffer, or directly + # manipulated with: + # + # buf[:] get a copy of it in a regular string, or + # buf[idx] as a single character + # buf[:] = ... + # buf[idx] = ... change the content + # """ + # note that 'buffer' is a type, set on this instance by __init__ + + def from_buffer(self, cdecl, python_buffer=_unspecified, + require_writable=False): + """Return a cdata of the given type pointing to the data of the + given Python object, which must support the buffer interface. + Note that this is not meant to be used on the built-in types + str or unicode (you can build 'char[]' arrays explicitly) + but only on objects containing large quantities of raw data + in some other format, like 'array.array' or numpy arrays. + + The first argument is optional and default to 'char[]'. + """ + if python_buffer is _unspecified: + cdecl, python_buffer = self.BCharA, cdecl + elif isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.from_buffer(cdecl, python_buffer, + require_writable) + + def memmove(self, dest, src, n): + """ffi.memmove(dest, src, n) copies n bytes of memory from src to dest. + + Like the C function memmove(), the memory areas may overlap; + apart from that it behaves like the C function memcpy(). + + 'src' can be any cdata ptr or array, or any Python buffer object. + 'dest' can be any cdata ptr or array, or a writable Python buffer + object. The size to copy, 'n', is always measured in bytes. + + Unlike other methods, this one supports all Python buffer including + byte strings and bytearrays---but it still does not support + non-contiguous buffers. + """ + return self._backend.memmove(dest, src, n) + + def callback(self, cdecl, python_callable=None, error=None, onerror=None): + """Return a callback object or a decorator making such a + callback object. 'cdecl' must name a C function pointer type. + The callback invokes the specified 'python_callable' (which may + be provided either directly or via a decorator). Important: the + callback object must be manually kept alive for as long as the + callback may be invoked from the C level. + """ + def callback_decorator_wrap(python_callable): + if not callable(python_callable): + raise TypeError("the 'python_callable' argument " + "is not callable") + return self._backend.callback(cdecl, python_callable, + error, onerror) + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl, consider_function_as_funcptr=True) + if python_callable is None: + return callback_decorator_wrap # decorator mode + else: + return callback_decorator_wrap(python_callable) # direct mode + + def getctype(self, cdecl, replace_with=''): + """Return a string giving the C type 'cdecl', which may be itself + a string or a object. If 'replace_with' is given, it gives + extra text to append (or insert for more complicated C types), like + a variable name, or '*' to get actually the C type 'pointer-to-cdecl'. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + replace_with = replace_with.strip() + if (replace_with.startswith('*') + and '&[' in self._backend.getcname(cdecl, '&')): + replace_with = '(%s)' % replace_with + elif replace_with and not replace_with[0] in '[(': + replace_with = ' ' + replace_with + return self._backend.getcname(cdecl, replace_with) + + def gc(self, cdata, destructor, size=0): + """Return a new cdata object that points to the same + data. Later, when this new cdata object is garbage-collected, + 'destructor(old_cdata_object)' will be called. + + The optional 'size' gives an estimate of the size, used to + trigger the garbage collection more eagerly. So far only used + on PyPy. It tells the GC that the returned object keeps alive + roughly 'size' bytes of external memory. + """ + return self._backend.gcp(cdata, destructor, size) + + def _get_cached_btype(self, type): + assert self._lock.acquire(False) is False + # call me with the lock! + try: + BType = self._cached_btypes[type] + except KeyError: + finishlist = [] + BType = type.get_cached_btype(self, finishlist) + for type in finishlist: + type.finish_backend_type(self, finishlist) + return BType + + def verify(self, source='', tmpdir=None, **kwargs): + """Verify that the current ffi signatures compile on this + machine, and return a dynamic library object. The dynamic + library can be used to call functions and access global + variables declared in this 'ffi'. The library is compiled + by the C compiler: it gives you C-level API compatibility + (including calling macros). This is unlike 'ffi.dlopen()', + which requires binary compatibility in the signatures. + """ + from .verifier import Verifier, _caller_dir_pycache + # + # If set_unicode(True) was called, insert the UNICODE and + # _UNICODE macro declarations + if self._windows_unicode: + self._apply_windows_unicode(kwargs) + # + # Set the tmpdir here, and not in Verifier.__init__: it picks + # up the caller's directory, which we want to be the caller of + # ffi.verify(), as opposed to the caller of Veritier(). + tmpdir = tmpdir or _caller_dir_pycache() + # + # Make a Verifier() and use it to load the library. + self.verifier = Verifier(self, source, tmpdir, **kwargs) + lib = self.verifier.load_library() + # + # Save the loaded library for keep-alive purposes, even + # if the caller doesn't keep it alive itself (it should). + self._libraries.append(lib) + return lib + + def _get_errno(self): + return self._backend.get_errno() + def _set_errno(self, errno): + self._backend.set_errno(errno) + errno = property(_get_errno, _set_errno, None, + "the value of 'errno' from/to the C calls") + + def getwinerror(self, code=-1): + return self._backend.getwinerror(code) + + def _pointer_to(self, ctype): + with self._lock: + return model.pointer_cache(self, ctype) + + def addressof(self, cdata, *fields_or_indexes): + """Return the address of a . + If 'fields_or_indexes' are given, returns the address of that + field or array item in the structure or array, recursively in + case of nested structures. + """ + try: + ctype = self._backend.typeof(cdata) + except TypeError: + if '__addressof__' in type(cdata).__dict__: + return type(cdata).__addressof__(cdata, *fields_or_indexes) + raise + if fields_or_indexes: + ctype, offset = self._typeoffsetof(ctype, *fields_or_indexes) + else: + if ctype.kind == "pointer": + raise TypeError("addressof(pointer)") + offset = 0 + ctypeptr = self._pointer_to(ctype) + return self._backend.rawaddressof(ctypeptr, cdata, offset) + + def _typeoffsetof(self, ctype, field_or_index, *fields_or_indexes): + ctype, offset = self._backend.typeoffsetof(ctype, field_or_index) + for field1 in fields_or_indexes: + ctype, offset1 = self._backend.typeoffsetof(ctype, field1, 1) + offset += offset1 + return ctype, offset + + def include(self, ffi_to_include): + """Includes the typedefs, structs, unions and enums defined + in another FFI instance. Usage is similar to a #include in C, + where a part of the program might include types defined in + another part for its own usage. Note that the include() + method has no effect on functions, constants and global + variables, which must anyway be accessed directly from the + lib object returned by the original FFI instance. + """ + if not isinstance(ffi_to_include, FFI): + raise TypeError("ffi.include() expects an argument that is also of" + " type cffi.FFI, not %r" % ( + type(ffi_to_include).__name__,)) + if ffi_to_include is self: + raise ValueError("self.include(self)") + with ffi_to_include._lock: + with self._lock: + self._parser.include(ffi_to_include._parser) + self._cdefsources.append('[') + self._cdefsources.extend(ffi_to_include._cdefsources) + self._cdefsources.append(']') + self._included_ffis.append(ffi_to_include) + + def new_handle(self, x): + return self._backend.newp_handle(self.BVoidP, x) + + def from_handle(self, x): + return self._backend.from_handle(x) + + def release(self, x): + self._backend.release(x) + + def set_unicode(self, enabled_flag): + """Windows: if 'enabled_flag' is True, enable the UNICODE and + _UNICODE defines in C, and declare the types like TCHAR and LPTCSTR + to be (pointers to) wchar_t. If 'enabled_flag' is False, + declare these types to be (pointers to) plain 8-bit characters. + This is mostly for backward compatibility; you usually want True. + """ + if self._windows_unicode is not None: + raise ValueError("set_unicode() can only be called once") + enabled_flag = bool(enabled_flag) + if enabled_flag: + self.cdef("typedef wchar_t TBYTE;" + "typedef wchar_t TCHAR;" + "typedef const wchar_t *LPCTSTR;" + "typedef const wchar_t *PCTSTR;" + "typedef wchar_t *LPTSTR;" + "typedef wchar_t *PTSTR;" + "typedef TBYTE *PTBYTE;" + "typedef TCHAR *PTCHAR;") + else: + self.cdef("typedef char TBYTE;" + "typedef char TCHAR;" + "typedef const char *LPCTSTR;" + "typedef const char *PCTSTR;" + "typedef char *LPTSTR;" + "typedef char *PTSTR;" + "typedef TBYTE *PTBYTE;" + "typedef TCHAR *PTCHAR;") + self._windows_unicode = enabled_flag + + def _apply_windows_unicode(self, kwds): + defmacros = kwds.get('define_macros', ()) + if not isinstance(defmacros, (list, tuple)): + raise TypeError("'define_macros' must be a list or tuple") + defmacros = list(defmacros) + [('UNICODE', '1'), + ('_UNICODE', '1')] + kwds['define_macros'] = defmacros + + def _apply_embedding_fix(self, kwds): + # must include an argument like "-lpython2.7" for the compiler + def ensure(key, value): + lst = kwds.setdefault(key, []) + if value not in lst: + lst.append(value) + # + if '__pypy__' in sys.builtin_module_names: + import os + if sys.platform == "win32": + # we need 'libpypy-c.lib'. Current distributions of + # pypy (>= 4.1) contain it as 'libs/python27.lib'. + pythonlib = "python{0[0]}{0[1]}".format(sys.version_info) + if hasattr(sys, 'prefix'): + ensure('library_dirs', os.path.join(sys.prefix, 'libs')) + else: + # we need 'libpypy-c.{so,dylib}', which should be by + # default located in 'sys.prefix/bin' for installed + # systems. + if sys.version_info < (3,): + pythonlib = "pypy-c" + else: + pythonlib = "pypy3-c" + if hasattr(sys, 'prefix'): + ensure('library_dirs', os.path.join(sys.prefix, 'bin')) + # On uninstalled pypy's, the libpypy-c is typically found in + # .../pypy/goal/. + if hasattr(sys, 'prefix'): + ensure('library_dirs', os.path.join(sys.prefix, 'pypy', 'goal')) + else: + if sys.platform == "win32": + template = "python%d%d" + if hasattr(sys, 'gettotalrefcount'): + template += '_d' + else: + try: + import sysconfig + except ImportError: # 2.6 + from distutils import sysconfig + template = "python%d.%d" + if sysconfig.get_config_var('DEBUG_EXT'): + template += sysconfig.get_config_var('DEBUG_EXT') + pythonlib = (template % + (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + if hasattr(sys, 'abiflags'): + pythonlib += sys.abiflags + ensure('libraries', pythonlib) + if sys.platform == "win32": + ensure('extra_link_args', '/MANIFEST') + + def set_source(self, module_name, source, source_extension='.c', **kwds): + import os + if hasattr(self, '_assigned_source'): + raise ValueError("set_source() cannot be called several times " + "per ffi object") + if not isinstance(module_name, basestring): + raise TypeError("'module_name' must be a string") + if os.sep in module_name or (os.altsep and os.altsep in module_name): + raise ValueError("'module_name' must not contain '/': use a dotted " + "name to make a 'package.module' location") + self._assigned_source = (str(module_name), source, + source_extension, kwds) + + def set_source_pkgconfig(self, module_name, pkgconfig_libs, source, + source_extension='.c', **kwds): + from . import pkgconfig + if not isinstance(pkgconfig_libs, list): + raise TypeError("the pkgconfig_libs argument must be a list " + "of package names") + kwds2 = pkgconfig.flags_from_pkgconfig(pkgconfig_libs) + pkgconfig.merge_flags(kwds, kwds2) + self.set_source(module_name, source, source_extension, **kwds) + + def distutils_extension(self, tmpdir='build', verbose=True): + from distutils.dir_util import mkpath + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + if hasattr(self, 'verifier'): # fallback, 'tmpdir' ignored + return self.verifier.get_extension() + raise ValueError("set_source() must be called before" + " distutils_extension()") + module_name, source, source_extension, kwds = self._assigned_source + if source is None: + raise TypeError("distutils_extension() is only for C extension " + "modules, not for dlopen()-style pure Python " + "modules") + mkpath(tmpdir) + ext, updated = recompile(self, module_name, + source, tmpdir=tmpdir, extradir=tmpdir, + source_extension=source_extension, + call_c_compiler=False, **kwds) + if verbose: + if updated: + sys.stderr.write("regenerated: %r\n" % (ext.sources[0],)) + else: + sys.stderr.write("not modified: %r\n" % (ext.sources[0],)) + return ext + + def emit_c_code(self, filename): + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + raise ValueError("set_source() must be called before emit_c_code()") + module_name, source, source_extension, kwds = self._assigned_source + if source is None: + raise TypeError("emit_c_code() is only for C extension modules, " + "not for dlopen()-style pure Python modules") + recompile(self, module_name, source, + c_file=filename, call_c_compiler=False, **kwds) + + def emit_python_code(self, filename): + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + raise ValueError("set_source() must be called before emit_c_code()") + module_name, source, source_extension, kwds = self._assigned_source + if source is not None: + raise TypeError("emit_python_code() is only for dlopen()-style " + "pure Python modules, not for C extension modules") + recompile(self, module_name, source, + c_file=filename, call_c_compiler=False, **kwds) + + def compile(self, tmpdir='.', verbose=0, target=None, debug=None): + """The 'target' argument gives the final file name of the + compiled DLL. Use '*' to force distutils' choice, suitable for + regular CPython C API modules. Use a file name ending in '.*' + to ask for the system's default extension for dynamic libraries + (.so/.dll/.dylib). + + The default is '*' when building a non-embedded C API extension, + and (module_name + '.*') when building an embedded library. + """ + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + raise ValueError("set_source() must be called before compile()") + module_name, source, source_extension, kwds = self._assigned_source + return recompile(self, module_name, source, tmpdir=tmpdir, + target=target, source_extension=source_extension, + compiler_verbose=verbose, debug=debug, **kwds) + + def init_once(self, func, tag): + # Read _init_once_cache[tag], which is either (False, lock) if + # we're calling the function now in some thread, or (True, result). + # Don't call setdefault() in most cases, to avoid allocating and + # immediately freeing a lock; but still use setdefaut() to avoid + # races. + try: + x = self._init_once_cache[tag] + except KeyError: + x = self._init_once_cache.setdefault(tag, (False, allocate_lock())) + # Common case: we got (True, result), so we return the result. + if x[0]: + return x[1] + # Else, it's a lock. Acquire it to serialize the following tests. + with x[1]: + # Read again from _init_once_cache the current status. + x = self._init_once_cache[tag] + if x[0]: + return x[1] + # Call the function and store the result back. + result = func() + self._init_once_cache[tag] = (True, result) + return result + + def embedding_init_code(self, pysource): + if self._embedding: + raise ValueError("embedding_init_code() can only be called once") + # fix 'pysource' before it gets dumped into the C file: + # - remove empty lines at the beginning, so it starts at "line 1" + # - dedent, if all non-empty lines are indented + # - check for SyntaxErrors + import re + match = re.match(r'\s*\n', pysource) + if match: + pysource = pysource[match.end():] + lines = pysource.splitlines() or [''] + prefix = re.match(r'\s*', lines[0]).group() + for i in range(1, len(lines)): + line = lines[i] + if line.rstrip(): + while not line.startswith(prefix): + prefix = prefix[:-1] + i = len(prefix) + lines = [line[i:]+'\n' for line in lines] + pysource = ''.join(lines) + # + compile(pysource, "cffi_init", "exec") + # + self._embedding = pysource + + def def_extern(self, *args, **kwds): + raise ValueError("ffi.def_extern() is only available on API-mode FFI " + "objects") + + def list_types(self): + """Returns the user type names known to this FFI instance. + This returns a tuple containing three lists of names: + (typedef_names, names_of_structs, names_of_unions) + """ + typedefs = [] + structs = [] + unions = [] + for key in self._parser._declarations: + if key.startswith('typedef '): + typedefs.append(key[8:]) + elif key.startswith('struct '): + structs.append(key[7:]) + elif key.startswith('union '): + unions.append(key[6:]) + typedefs.sort() + structs.sort() + unions.sort() + return (typedefs, structs, unions) + + +def _load_backend_lib(backend, name, flags): + import os + if not isinstance(name, basestring): + if sys.platform != "win32" or name is not None: + return backend.load_library(name, flags) + name = "c" # Windows: load_library(None) fails, but this works + # on Python 2 (backward compatibility hack only) + first_error = None + if '.' in name or '/' in name or os.sep in name: + try: + return backend.load_library(name, flags) + except OSError as e: + first_error = e + import ctypes.util + path = ctypes.util.find_library(name) + if path is None: + if name == "c" and sys.platform == "win32" and sys.version_info >= (3,): + raise OSError("dlopen(None) cannot work on Windows for Python 3 " + "(see http://bugs.python.org/issue23606)") + msg = ("ctypes.util.find_library() did not manage " + "to locate a library called %r" % (name,)) + if first_error is not None: + msg = "%s. Additionally, %s" % (first_error, msg) + raise OSError(msg) + return backend.load_library(path, flags) + +def _make_ffi_library(ffi, libname, flags): + backend = ffi._backend + backendlib = _load_backend_lib(backend, libname, flags) + # + def accessor_function(name): + key = 'function ' + name + tp, _ = ffi._parser._declarations[key] + BType = ffi._get_cached_btype(tp) + value = backendlib.load_function(BType, name) + library.__dict__[name] = value + # + def accessor_variable(name): + key = 'variable ' + name + tp, _ = ffi._parser._declarations[key] + BType = ffi._get_cached_btype(tp) + read_variable = backendlib.read_variable + write_variable = backendlib.write_variable + setattr(FFILibrary, name, property( + lambda self: read_variable(BType, name), + lambda self, value: write_variable(BType, name, value))) + # + def addressof_var(name): + try: + return addr_variables[name] + except KeyError: + with ffi._lock: + if name not in addr_variables: + key = 'variable ' + name + tp, _ = ffi._parser._declarations[key] + BType = ffi._get_cached_btype(tp) + if BType.kind != 'array': + BType = model.pointer_cache(ffi, BType) + p = backendlib.load_function(BType, name) + addr_variables[name] = p + return addr_variables[name] + # + def accessor_constant(name): + raise NotImplementedError("non-integer constant '%s' cannot be " + "accessed from a dlopen() library" % (name,)) + # + def accessor_int_constant(name): + library.__dict__[name] = ffi._parser._int_constants[name] + # + accessors = {} + accessors_version = [False] + addr_variables = {} + # + def update_accessors(): + if accessors_version[0] is ffi._cdef_version: + return + # + for key, (tp, _) in ffi._parser._declarations.items(): + if not isinstance(tp, model.EnumType): + tag, name = key.split(' ', 1) + if tag == 'function': + accessors[name] = accessor_function + elif tag == 'variable': + accessors[name] = accessor_variable + elif tag == 'constant': + accessors[name] = accessor_constant + else: + for i, enumname in enumerate(tp.enumerators): + def accessor_enum(name, tp=tp, i=i): + tp.check_not_partial() + library.__dict__[name] = tp.enumvalues[i] + accessors[enumname] = accessor_enum + for name in ffi._parser._int_constants: + accessors.setdefault(name, accessor_int_constant) + accessors_version[0] = ffi._cdef_version + # + def make_accessor(name): + with ffi._lock: + if name in library.__dict__ or name in FFILibrary.__dict__: + return # added by another thread while waiting for the lock + if name not in accessors: + update_accessors() + if name not in accessors: + raise AttributeError(name) + accessors[name](name) + # + class FFILibrary(object): + def __getattr__(self, name): + make_accessor(name) + return getattr(self, name) + def __setattr__(self, name, value): + try: + property = getattr(self.__class__, name) + except AttributeError: + make_accessor(name) + setattr(self, name, value) + else: + property.__set__(self, value) + def __dir__(self): + with ffi._lock: + update_accessors() + return accessors.keys() + def __addressof__(self, name): + if name in library.__dict__: + return library.__dict__[name] + if name in FFILibrary.__dict__: + return addressof_var(name) + make_accessor(name) + if name in library.__dict__: + return library.__dict__[name] + if name in FFILibrary.__dict__: + return addressof_var(name) + raise AttributeError("cffi library has no function or " + "global variable named '%s'" % (name,)) + def __cffi_close__(self): + backendlib.close_lib() + self.__dict__.clear() + # + if isinstance(libname, basestring): + try: + if not isinstance(libname, str): # unicode, on Python 2 + libname = libname.encode('utf-8') + FFILibrary.__name__ = 'FFILibrary_%s' % libname + except UnicodeError: + pass + library = FFILibrary() + return library, library.__dict__ + +def _builtin_function_type(func): + # a hack to make at least ffi.typeof(builtin_function) work, + # if the builtin function was obtained by 'vengine_cpy'. + import sys + try: + module = sys.modules[func.__module__] + ffi = module._cffi_original_ffi + types_of_builtin_funcs = module._cffi_types_of_builtin_funcs + tp = types_of_builtin_funcs[func] + except (KeyError, AttributeError, TypeError): + return None + else: + with ffi._lock: + return ffi._get_cached_btype(tp) diff --git a/billinglayer/python/cffi/backend_ctypes.py b/billinglayer/python/cffi/backend_ctypes.py new file mode 100644 index 0000000..e7956a7 --- /dev/null +++ b/billinglayer/python/cffi/backend_ctypes.py @@ -0,0 +1,1121 @@ +import ctypes, ctypes.util, operator, sys +from . import model + +if sys.version_info < (3,): + bytechr = chr +else: + unicode = str + long = int + xrange = range + bytechr = lambda num: bytes([num]) + +class CTypesType(type): + pass + +class CTypesData(object): + __metaclass__ = CTypesType + __slots__ = ['__weakref__'] + __name__ = '' + + def __init__(self, *args): + raise TypeError("cannot instantiate %r" % (self.__class__,)) + + @classmethod + def _newp(cls, init): + raise TypeError("expected a pointer or array ctype, got '%s'" + % (cls._get_c_name(),)) + + @staticmethod + def _to_ctypes(value): + raise TypeError + + @classmethod + def _arg_to_ctypes(cls, *value): + try: + ctype = cls._ctype + except AttributeError: + raise TypeError("cannot create an instance of %r" % (cls,)) + if value: + res = cls._to_ctypes(*value) + if not isinstance(res, ctype): + res = cls._ctype(res) + else: + res = cls._ctype() + return res + + @classmethod + def _create_ctype_obj(cls, init): + if init is None: + return cls._arg_to_ctypes() + else: + return cls._arg_to_ctypes(init) + + @staticmethod + def _from_ctypes(ctypes_value): + raise TypeError + + @classmethod + def _get_c_name(cls, replace_with=''): + return cls._reftypename.replace(' &', replace_with) + + @classmethod + def _fix_class(cls): + cls.__name__ = 'CData<%s>' % (cls._get_c_name(),) + cls.__qualname__ = 'CData<%s>' % (cls._get_c_name(),) + cls.__module__ = 'ffi' + + def _get_own_repr(self): + raise NotImplementedError + + def _addr_repr(self, address): + if address == 0: + return 'NULL' + else: + if address < 0: + address += 1 << (8*ctypes.sizeof(ctypes.c_void_p)) + return '0x%x' % address + + def __repr__(self, c_name=None): + own = self._get_own_repr() + return '' % (c_name or self._get_c_name(), own) + + def _convert_to_address(self, BClass): + if BClass is None: + raise TypeError("cannot convert %r to an address" % ( + self._get_c_name(),)) + else: + raise TypeError("cannot convert %r to %r" % ( + self._get_c_name(), BClass._get_c_name())) + + @classmethod + def _get_size(cls): + return ctypes.sizeof(cls._ctype) + + def _get_size_of_instance(self): + return ctypes.sizeof(self._ctype) + + @classmethod + def _cast_from(cls, source): + raise TypeError("cannot cast to %r" % (cls._get_c_name(),)) + + def _cast_to_integer(self): + return self._convert_to_address(None) + + @classmethod + def _alignment(cls): + return ctypes.alignment(cls._ctype) + + def __iter__(self): + raise TypeError("cdata %r does not support iteration" % ( + self._get_c_name()),) + + def _make_cmp(name): + cmpfunc = getattr(operator, name) + def cmp(self, other): + v_is_ptr = not isinstance(self, CTypesGenericPrimitive) + w_is_ptr = (isinstance(other, CTypesData) and + not isinstance(other, CTypesGenericPrimitive)) + if v_is_ptr and w_is_ptr: + return cmpfunc(self._convert_to_address(None), + other._convert_to_address(None)) + elif v_is_ptr or w_is_ptr: + return NotImplemented + else: + if isinstance(self, CTypesGenericPrimitive): + self = self._value + if isinstance(other, CTypesGenericPrimitive): + other = other._value + return cmpfunc(self, other) + cmp.func_name = name + return cmp + + __eq__ = _make_cmp('__eq__') + __ne__ = _make_cmp('__ne__') + __lt__ = _make_cmp('__lt__') + __le__ = _make_cmp('__le__') + __gt__ = _make_cmp('__gt__') + __ge__ = _make_cmp('__ge__') + + def __hash__(self): + return hash(self._convert_to_address(None)) + + def _to_string(self, maxlen): + raise TypeError("string(): %r" % (self,)) + + +class CTypesGenericPrimitive(CTypesData): + __slots__ = [] + + def __hash__(self): + return hash(self._value) + + def _get_own_repr(self): + return repr(self._from_ctypes(self._value)) + + +class CTypesGenericArray(CTypesData): + __slots__ = [] + + @classmethod + def _newp(cls, init): + return cls(init) + + def __iter__(self): + for i in xrange(len(self)): + yield self[i] + + def _get_own_repr(self): + return self._addr_repr(ctypes.addressof(self._blob)) + + +class CTypesGenericPtr(CTypesData): + __slots__ = ['_address', '_as_ctype_ptr'] + _automatic_casts = False + kind = "pointer" + + @classmethod + def _newp(cls, init): + return cls(init) + + @classmethod + def _cast_from(cls, source): + if source is None: + address = 0 + elif isinstance(source, CTypesData): + address = source._cast_to_integer() + elif isinstance(source, (int, long)): + address = source + else: + raise TypeError("bad type for cast to %r: %r" % + (cls, type(source).__name__)) + return cls._new_pointer_at(address) + + @classmethod + def _new_pointer_at(cls, address): + self = cls.__new__(cls) + self._address = address + self._as_ctype_ptr = ctypes.cast(address, cls._ctype) + return self + + def _get_own_repr(self): + try: + return self._addr_repr(self._address) + except AttributeError: + return '???' + + def _cast_to_integer(self): + return self._address + + def __nonzero__(self): + return bool(self._address) + __bool__ = __nonzero__ + + @classmethod + def _to_ctypes(cls, value): + if not isinstance(value, CTypesData): + raise TypeError("unexpected %s object" % type(value).__name__) + address = value._convert_to_address(cls) + return ctypes.cast(address, cls._ctype) + + @classmethod + def _from_ctypes(cls, ctypes_ptr): + address = ctypes.cast(ctypes_ptr, ctypes.c_void_p).value or 0 + return cls._new_pointer_at(address) + + @classmethod + def _initialize(cls, ctypes_ptr, value): + if value: + ctypes_ptr.contents = cls._to_ctypes(value).contents + + def _convert_to_address(self, BClass): + if (BClass in (self.__class__, None) or BClass._automatic_casts + or self._automatic_casts): + return self._address + else: + return CTypesData._convert_to_address(self, BClass) + + +class CTypesBaseStructOrUnion(CTypesData): + __slots__ = ['_blob'] + + @classmethod + def _create_ctype_obj(cls, init): + # may be overridden + raise TypeError("cannot instantiate opaque type %s" % (cls,)) + + def _get_own_repr(self): + return self._addr_repr(ctypes.addressof(self._blob)) + + @classmethod + def _offsetof(cls, fieldname): + return getattr(cls._ctype, fieldname).offset + + def _convert_to_address(self, BClass): + if getattr(BClass, '_BItem', None) is self.__class__: + return ctypes.addressof(self._blob) + else: + return CTypesData._convert_to_address(self, BClass) + + @classmethod + def _from_ctypes(cls, ctypes_struct_or_union): + self = cls.__new__(cls) + self._blob = ctypes_struct_or_union + return self + + @classmethod + def _to_ctypes(cls, value): + return value._blob + + def __repr__(self, c_name=None): + return CTypesData.__repr__(self, c_name or self._get_c_name(' &')) + + +class CTypesBackend(object): + + PRIMITIVE_TYPES = { + 'char': ctypes.c_char, + 'short': ctypes.c_short, + 'int': ctypes.c_int, + 'long': ctypes.c_long, + 'long long': ctypes.c_longlong, + 'signed char': ctypes.c_byte, + 'unsigned char': ctypes.c_ubyte, + 'unsigned short': ctypes.c_ushort, + 'unsigned int': ctypes.c_uint, + 'unsigned long': ctypes.c_ulong, + 'unsigned long long': ctypes.c_ulonglong, + 'float': ctypes.c_float, + 'double': ctypes.c_double, + '_Bool': ctypes.c_bool, + } + + for _name in ['unsigned long long', 'unsigned long', + 'unsigned int', 'unsigned short', 'unsigned char']: + _size = ctypes.sizeof(PRIMITIVE_TYPES[_name]) + PRIMITIVE_TYPES['uint%d_t' % (8*_size)] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_void_p): + PRIMITIVE_TYPES['uintptr_t'] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_size_t): + PRIMITIVE_TYPES['size_t'] = PRIMITIVE_TYPES[_name] + + for _name in ['long long', 'long', 'int', 'short', 'signed char']: + _size = ctypes.sizeof(PRIMITIVE_TYPES[_name]) + PRIMITIVE_TYPES['int%d_t' % (8*_size)] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_void_p): + PRIMITIVE_TYPES['intptr_t'] = PRIMITIVE_TYPES[_name] + PRIMITIVE_TYPES['ptrdiff_t'] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_size_t): + PRIMITIVE_TYPES['ssize_t'] = PRIMITIVE_TYPES[_name] + + + def __init__(self): + self.RTLD_LAZY = 0 # not supported anyway by ctypes + self.RTLD_NOW = 0 + self.RTLD_GLOBAL = ctypes.RTLD_GLOBAL + self.RTLD_LOCAL = ctypes.RTLD_LOCAL + + def set_ffi(self, ffi): + self.ffi = ffi + + def _get_types(self): + return CTypesData, CTypesType + + def load_library(self, path, flags=0): + cdll = ctypes.CDLL(path, flags) + return CTypesLibrary(self, cdll) + + def new_void_type(self): + class CTypesVoid(CTypesData): + __slots__ = [] + _reftypename = 'void &' + @staticmethod + def _from_ctypes(novalue): + return None + @staticmethod + def _to_ctypes(novalue): + if novalue is not None: + raise TypeError("None expected, got %s object" % + (type(novalue).__name__,)) + return None + CTypesVoid._fix_class() + return CTypesVoid + + def new_primitive_type(self, name): + if name == 'wchar_t': + raise NotImplementedError(name) + ctype = self.PRIMITIVE_TYPES[name] + if name == 'char': + kind = 'char' + elif name in ('float', 'double'): + kind = 'float' + else: + if name in ('signed char', 'unsigned char'): + kind = 'byte' + elif name == '_Bool': + kind = 'bool' + else: + kind = 'int' + is_signed = (ctype(-1).value == -1) + # + def _cast_source_to_int(source): + if isinstance(source, (int, long, float)): + source = int(source) + elif isinstance(source, CTypesData): + source = source._cast_to_integer() + elif isinstance(source, bytes): + source = ord(source) + elif source is None: + source = 0 + else: + raise TypeError("bad type for cast to %r: %r" % + (CTypesPrimitive, type(source).__name__)) + return source + # + kind1 = kind + class CTypesPrimitive(CTypesGenericPrimitive): + __slots__ = ['_value'] + _ctype = ctype + _reftypename = '%s &' % name + kind = kind1 + + def __init__(self, value): + self._value = value + + @staticmethod + def _create_ctype_obj(init): + if init is None: + return ctype() + return ctype(CTypesPrimitive._to_ctypes(init)) + + if kind == 'int' or kind == 'byte': + @classmethod + def _cast_from(cls, source): + source = _cast_source_to_int(source) + source = ctype(source).value # cast within range + return cls(source) + def __int__(self): + return self._value + + if kind == 'bool': + @classmethod + def _cast_from(cls, source): + if not isinstance(source, (int, long, float)): + source = _cast_source_to_int(source) + return cls(bool(source)) + def __int__(self): + return int(self._value) + + if kind == 'char': + @classmethod + def _cast_from(cls, source): + source = _cast_source_to_int(source) + source = bytechr(source & 0xFF) + return cls(source) + def __int__(self): + return ord(self._value) + + if kind == 'float': + @classmethod + def _cast_from(cls, source): + if isinstance(source, float): + pass + elif isinstance(source, CTypesGenericPrimitive): + if hasattr(source, '__float__'): + source = float(source) + else: + source = int(source) + else: + source = _cast_source_to_int(source) + source = ctype(source).value # fix precision + return cls(source) + def __int__(self): + return int(self._value) + def __float__(self): + return self._value + + _cast_to_integer = __int__ + + if kind == 'int' or kind == 'byte' or kind == 'bool': + @staticmethod + def _to_ctypes(x): + if not isinstance(x, (int, long)): + if isinstance(x, CTypesData): + x = int(x) + else: + raise TypeError("integer expected, got %s" % + type(x).__name__) + if ctype(x).value != x: + if not is_signed and x < 0: + raise OverflowError("%s: negative integer" % name) + else: + raise OverflowError("%s: integer out of bounds" + % name) + return x + + if kind == 'char': + @staticmethod + def _to_ctypes(x): + if isinstance(x, bytes) and len(x) == 1: + return x + if isinstance(x, CTypesPrimitive): # > + return x._value + raise TypeError("character expected, got %s" % + type(x).__name__) + def __nonzero__(self): + return ord(self._value) != 0 + else: + def __nonzero__(self): + return self._value != 0 + __bool__ = __nonzero__ + + if kind == 'float': + @staticmethod + def _to_ctypes(x): + if not isinstance(x, (int, long, float, CTypesData)): + raise TypeError("float expected, got %s" % + type(x).__name__) + return ctype(x).value + + @staticmethod + def _from_ctypes(value): + return getattr(value, 'value', value) + + @staticmethod + def _initialize(blob, init): + blob.value = CTypesPrimitive._to_ctypes(init) + + if kind == 'char': + def _to_string(self, maxlen): + return self._value + if kind == 'byte': + def _to_string(self, maxlen): + return chr(self._value & 0xff) + # + CTypesPrimitive._fix_class() + return CTypesPrimitive + + def new_pointer_type(self, BItem): + getbtype = self.ffi._get_cached_btype + if BItem is getbtype(model.PrimitiveType('char')): + kind = 'charp' + elif BItem in (getbtype(model.PrimitiveType('signed char')), + getbtype(model.PrimitiveType('unsigned char'))): + kind = 'bytep' + elif BItem is getbtype(model.void_type): + kind = 'voidp' + else: + kind = 'generic' + # + class CTypesPtr(CTypesGenericPtr): + __slots__ = ['_own'] + if kind == 'charp': + __slots__ += ['__as_strbuf'] + _BItem = BItem + if hasattr(BItem, '_ctype'): + _ctype = ctypes.POINTER(BItem._ctype) + _bitem_size = ctypes.sizeof(BItem._ctype) + else: + _ctype = ctypes.c_void_p + if issubclass(BItem, CTypesGenericArray): + _reftypename = BItem._get_c_name('(* &)') + else: + _reftypename = BItem._get_c_name(' * &') + + def __init__(self, init): + ctypeobj = BItem._create_ctype_obj(init) + if kind == 'charp': + self.__as_strbuf = ctypes.create_string_buffer( + ctypeobj.value + b'\x00') + self._as_ctype_ptr = ctypes.cast( + self.__as_strbuf, self._ctype) + else: + self._as_ctype_ptr = ctypes.pointer(ctypeobj) + self._address = ctypes.cast(self._as_ctype_ptr, + ctypes.c_void_p).value + self._own = True + + def __add__(self, other): + if isinstance(other, (int, long)): + return self._new_pointer_at(self._address + + other * self._bitem_size) + else: + return NotImplemented + + def __sub__(self, other): + if isinstance(other, (int, long)): + return self._new_pointer_at(self._address - + other * self._bitem_size) + elif type(self) is type(other): + return (self._address - other._address) // self._bitem_size + else: + return NotImplemented + + def __getitem__(self, index): + if getattr(self, '_own', False) and index != 0: + raise IndexError + return BItem._from_ctypes(self._as_ctype_ptr[index]) + + def __setitem__(self, index, value): + self._as_ctype_ptr[index] = BItem._to_ctypes(value) + + if kind == 'charp' or kind == 'voidp': + @classmethod + def _arg_to_ctypes(cls, *value): + if value and isinstance(value[0], bytes): + return ctypes.c_char_p(value[0]) + else: + return super(CTypesPtr, cls)._arg_to_ctypes(*value) + + if kind == 'charp' or kind == 'bytep': + def _to_string(self, maxlen): + if maxlen < 0: + maxlen = sys.maxsize + p = ctypes.cast(self._as_ctype_ptr, + ctypes.POINTER(ctypes.c_char)) + n = 0 + while n < maxlen and p[n] != b'\x00': + n += 1 + return b''.join([p[i] for i in range(n)]) + + def _get_own_repr(self): + if getattr(self, '_own', False): + return 'owning %d bytes' % ( + ctypes.sizeof(self._as_ctype_ptr.contents),) + return super(CTypesPtr, self)._get_own_repr() + # + if (BItem is self.ffi._get_cached_btype(model.void_type) or + BItem is self.ffi._get_cached_btype(model.PrimitiveType('char'))): + CTypesPtr._automatic_casts = True + # + CTypesPtr._fix_class() + return CTypesPtr + + def new_array_type(self, CTypesPtr, length): + if length is None: + brackets = ' &[]' + else: + brackets = ' &[%d]' % length + BItem = CTypesPtr._BItem + getbtype = self.ffi._get_cached_btype + if BItem is getbtype(model.PrimitiveType('char')): + kind = 'char' + elif BItem in (getbtype(model.PrimitiveType('signed char')), + getbtype(model.PrimitiveType('unsigned char'))): + kind = 'byte' + else: + kind = 'generic' + # + class CTypesArray(CTypesGenericArray): + __slots__ = ['_blob', '_own'] + if length is not None: + _ctype = BItem._ctype * length + else: + __slots__.append('_ctype') + _reftypename = BItem._get_c_name(brackets) + _declared_length = length + _CTPtr = CTypesPtr + + def __init__(self, init): + if length is None: + if isinstance(init, (int, long)): + len1 = init + init = None + elif kind == 'char' and isinstance(init, bytes): + len1 = len(init) + 1 # extra null + else: + init = tuple(init) + len1 = len(init) + self._ctype = BItem._ctype * len1 + self._blob = self._ctype() + self._own = True + if init is not None: + self._initialize(self._blob, init) + + @staticmethod + def _initialize(blob, init): + if isinstance(init, bytes): + init = [init[i:i+1] for i in range(len(init))] + else: + if isinstance(init, CTypesGenericArray): + if (len(init) != len(blob) or + not isinstance(init, CTypesArray)): + raise TypeError("length/type mismatch: %s" % (init,)) + init = tuple(init) + if len(init) > len(blob): + raise IndexError("too many initializers") + addr = ctypes.cast(blob, ctypes.c_void_p).value + PTR = ctypes.POINTER(BItem._ctype) + itemsize = ctypes.sizeof(BItem._ctype) + for i, value in enumerate(init): + p = ctypes.cast(addr + i * itemsize, PTR) + BItem._initialize(p.contents, value) + + def __len__(self): + return len(self._blob) + + def __getitem__(self, index): + if not (0 <= index < len(self._blob)): + raise IndexError + return BItem._from_ctypes(self._blob[index]) + + def __setitem__(self, index, value): + if not (0 <= index < len(self._blob)): + raise IndexError + self._blob[index] = BItem._to_ctypes(value) + + if kind == 'char' or kind == 'byte': + def _to_string(self, maxlen): + if maxlen < 0: + maxlen = len(self._blob) + p = ctypes.cast(self._blob, + ctypes.POINTER(ctypes.c_char)) + n = 0 + while n < maxlen and p[n] != b'\x00': + n += 1 + return b''.join([p[i] for i in range(n)]) + + def _get_own_repr(self): + if getattr(self, '_own', False): + return 'owning %d bytes' % (ctypes.sizeof(self._blob),) + return super(CTypesArray, self)._get_own_repr() + + def _convert_to_address(self, BClass): + if BClass in (CTypesPtr, None) or BClass._automatic_casts: + return ctypes.addressof(self._blob) + else: + return CTypesData._convert_to_address(self, BClass) + + @staticmethod + def _from_ctypes(ctypes_array): + self = CTypesArray.__new__(CTypesArray) + self._blob = ctypes_array + return self + + @staticmethod + def _arg_to_ctypes(value): + return CTypesPtr._arg_to_ctypes(value) + + def __add__(self, other): + if isinstance(other, (int, long)): + return CTypesPtr._new_pointer_at( + ctypes.addressof(self._blob) + + other * ctypes.sizeof(BItem._ctype)) + else: + return NotImplemented + + @classmethod + def _cast_from(cls, source): + raise NotImplementedError("casting to %r" % ( + cls._get_c_name(),)) + # + CTypesArray._fix_class() + return CTypesArray + + def _new_struct_or_union(self, kind, name, base_ctypes_class): + # + class struct_or_union(base_ctypes_class): + pass + struct_or_union.__name__ = '%s_%s' % (kind, name) + kind1 = kind + # + class CTypesStructOrUnion(CTypesBaseStructOrUnion): + __slots__ = ['_blob'] + _ctype = struct_or_union + _reftypename = '%s &' % (name,) + _kind = kind = kind1 + # + CTypesStructOrUnion._fix_class() + return CTypesStructOrUnion + + def new_struct_type(self, name): + return self._new_struct_or_union('struct', name, ctypes.Structure) + + def new_union_type(self, name): + return self._new_struct_or_union('union', name, ctypes.Union) + + def complete_struct_or_union(self, CTypesStructOrUnion, fields, tp, + totalsize=-1, totalalignment=-1, sflags=0, + pack=0): + if totalsize >= 0 or totalalignment >= 0: + raise NotImplementedError("the ctypes backend of CFFI does not support " + "structures completed by verify(); please " + "compile and install the _cffi_backend module.") + struct_or_union = CTypesStructOrUnion._ctype + fnames = [fname for (fname, BField, bitsize) in fields] + btypes = [BField for (fname, BField, bitsize) in fields] + bitfields = [bitsize for (fname, BField, bitsize) in fields] + # + bfield_types = {} + cfields = [] + for (fname, BField, bitsize) in fields: + if bitsize < 0: + cfields.append((fname, BField._ctype)) + bfield_types[fname] = BField + else: + cfields.append((fname, BField._ctype, bitsize)) + bfield_types[fname] = Ellipsis + if sflags & 8: + struct_or_union._pack_ = 1 + elif pack: + struct_or_union._pack_ = pack + struct_or_union._fields_ = cfields + CTypesStructOrUnion._bfield_types = bfield_types + # + @staticmethod + def _create_ctype_obj(init): + result = struct_or_union() + if init is not None: + initialize(result, init) + return result + CTypesStructOrUnion._create_ctype_obj = _create_ctype_obj + # + def initialize(blob, init): + if is_union: + if len(init) > 1: + raise ValueError("union initializer: %d items given, but " + "only one supported (use a dict if needed)" + % (len(init),)) + if not isinstance(init, dict): + if isinstance(init, (bytes, unicode)): + raise TypeError("union initializer: got a str") + init = tuple(init) + if len(init) > len(fnames): + raise ValueError("too many values for %s initializer" % + CTypesStructOrUnion._get_c_name()) + init = dict(zip(fnames, init)) + addr = ctypes.addressof(blob) + for fname, value in init.items(): + BField, bitsize = name2fieldtype[fname] + assert bitsize < 0, \ + "not implemented: initializer with bit fields" + offset = CTypesStructOrUnion._offsetof(fname) + PTR = ctypes.POINTER(BField._ctype) + p = ctypes.cast(addr + offset, PTR) + BField._initialize(p.contents, value) + is_union = CTypesStructOrUnion._kind == 'union' + name2fieldtype = dict(zip(fnames, zip(btypes, bitfields))) + # + for fname, BField, bitsize in fields: + if fname == '': + raise NotImplementedError("nested anonymous structs/unions") + if hasattr(CTypesStructOrUnion, fname): + raise ValueError("the field name %r conflicts in " + "the ctypes backend" % fname) + if bitsize < 0: + def getter(self, fname=fname, BField=BField, + offset=CTypesStructOrUnion._offsetof(fname), + PTR=ctypes.POINTER(BField._ctype)): + addr = ctypes.addressof(self._blob) + p = ctypes.cast(addr + offset, PTR) + return BField._from_ctypes(p.contents) + def setter(self, value, fname=fname, BField=BField): + setattr(self._blob, fname, BField._to_ctypes(value)) + # + if issubclass(BField, CTypesGenericArray): + setter = None + if BField._declared_length == 0: + def getter(self, fname=fname, BFieldPtr=BField._CTPtr, + offset=CTypesStructOrUnion._offsetof(fname), + PTR=ctypes.POINTER(BField._ctype)): + addr = ctypes.addressof(self._blob) + p = ctypes.cast(addr + offset, PTR) + return BFieldPtr._from_ctypes(p) + # + else: + def getter(self, fname=fname, BField=BField): + return BField._from_ctypes(getattr(self._blob, fname)) + def setter(self, value, fname=fname, BField=BField): + # xxx obscure workaround + value = BField._to_ctypes(value) + oldvalue = getattr(self._blob, fname) + setattr(self._blob, fname, value) + if value != getattr(self._blob, fname): + setattr(self._blob, fname, oldvalue) + raise OverflowError("value too large for bitfield") + setattr(CTypesStructOrUnion, fname, property(getter, setter)) + # + CTypesPtr = self.ffi._get_cached_btype(model.PointerType(tp)) + for fname in fnames: + if hasattr(CTypesPtr, fname): + raise ValueError("the field name %r conflicts in " + "the ctypes backend" % fname) + def getter(self, fname=fname): + return getattr(self[0], fname) + def setter(self, value, fname=fname): + setattr(self[0], fname, value) + setattr(CTypesPtr, fname, property(getter, setter)) + + def new_function_type(self, BArgs, BResult, has_varargs): + nameargs = [BArg._get_c_name() for BArg in BArgs] + if has_varargs: + nameargs.append('...') + nameargs = ', '.join(nameargs) + # + class CTypesFunctionPtr(CTypesGenericPtr): + __slots__ = ['_own_callback', '_name'] + _ctype = ctypes.CFUNCTYPE(getattr(BResult, '_ctype', None), + *[BArg._ctype for BArg in BArgs], + use_errno=True) + _reftypename = BResult._get_c_name('(* &)(%s)' % (nameargs,)) + + def __init__(self, init, error=None): + # create a callback to the Python callable init() + import traceback + assert not has_varargs, "varargs not supported for callbacks" + if getattr(BResult, '_ctype', None) is not None: + error = BResult._from_ctypes( + BResult._create_ctype_obj(error)) + else: + error = None + def callback(*args): + args2 = [] + for arg, BArg in zip(args, BArgs): + args2.append(BArg._from_ctypes(arg)) + try: + res2 = init(*args2) + res2 = BResult._to_ctypes(res2) + except: + traceback.print_exc() + res2 = error + if issubclass(BResult, CTypesGenericPtr): + if res2: + res2 = ctypes.cast(res2, ctypes.c_void_p).value + # .value: http://bugs.python.org/issue1574593 + else: + res2 = None + #print repr(res2) + return res2 + if issubclass(BResult, CTypesGenericPtr): + # The only pointers callbacks can return are void*s: + # http://bugs.python.org/issue5710 + callback_ctype = ctypes.CFUNCTYPE( + ctypes.c_void_p, + *[BArg._ctype for BArg in BArgs], + use_errno=True) + else: + callback_ctype = CTypesFunctionPtr._ctype + self._as_ctype_ptr = callback_ctype(callback) + self._address = ctypes.cast(self._as_ctype_ptr, + ctypes.c_void_p).value + self._own_callback = init + + @staticmethod + def _initialize(ctypes_ptr, value): + if value: + raise NotImplementedError("ctypes backend: not supported: " + "initializers for function pointers") + + def __repr__(self): + c_name = getattr(self, '_name', None) + if c_name: + i = self._reftypename.index('(* &)') + if self._reftypename[i-1] not in ' )*': + c_name = ' ' + c_name + c_name = self._reftypename.replace('(* &)', c_name) + return CTypesData.__repr__(self, c_name) + + def _get_own_repr(self): + if getattr(self, '_own_callback', None) is not None: + return 'calling %r' % (self._own_callback,) + return super(CTypesFunctionPtr, self)._get_own_repr() + + def __call__(self, *args): + if has_varargs: + assert len(args) >= len(BArgs) + extraargs = args[len(BArgs):] + args = args[:len(BArgs)] + else: + assert len(args) == len(BArgs) + ctypes_args = [] + for arg, BArg in zip(args, BArgs): + ctypes_args.append(BArg._arg_to_ctypes(arg)) + if has_varargs: + for i, arg in enumerate(extraargs): + if arg is None: + ctypes_args.append(ctypes.c_void_p(0)) # NULL + continue + if not isinstance(arg, CTypesData): + raise TypeError( + "argument %d passed in the variadic part " + "needs to be a cdata object (got %s)" % + (1 + len(BArgs) + i, type(arg).__name__)) + ctypes_args.append(arg._arg_to_ctypes(arg)) + result = self._as_ctype_ptr(*ctypes_args) + return BResult._from_ctypes(result) + # + CTypesFunctionPtr._fix_class() + return CTypesFunctionPtr + + def new_enum_type(self, name, enumerators, enumvalues, CTypesInt): + assert isinstance(name, str) + reverse_mapping = dict(zip(reversed(enumvalues), + reversed(enumerators))) + # + class CTypesEnum(CTypesInt): + __slots__ = [] + _reftypename = '%s &' % name + + def _get_own_repr(self): + value = self._value + try: + return '%d: %s' % (value, reverse_mapping[value]) + except KeyError: + return str(value) + + def _to_string(self, maxlen): + value = self._value + try: + return reverse_mapping[value] + except KeyError: + return str(value) + # + CTypesEnum._fix_class() + return CTypesEnum + + def get_errno(self): + return ctypes.get_errno() + + def set_errno(self, value): + ctypes.set_errno(value) + + def string(self, b, maxlen=-1): + return b._to_string(maxlen) + + def buffer(self, bptr, size=-1): + raise NotImplementedError("buffer() with ctypes backend") + + def sizeof(self, cdata_or_BType): + if isinstance(cdata_or_BType, CTypesData): + return cdata_or_BType._get_size_of_instance() + else: + assert issubclass(cdata_or_BType, CTypesData) + return cdata_or_BType._get_size() + + def alignof(self, BType): + assert issubclass(BType, CTypesData) + return BType._alignment() + + def newp(self, BType, source): + if not issubclass(BType, CTypesData): + raise TypeError + return BType._newp(source) + + def cast(self, BType, source): + return BType._cast_from(source) + + def callback(self, BType, source, error, onerror): + assert onerror is None # XXX not implemented + return BType(source, error) + + _weakref_cache_ref = None + + def gcp(self, cdata, destructor, size=0): + if self._weakref_cache_ref is None: + import weakref + class MyRef(weakref.ref): + def __eq__(self, other): + myref = self() + return self is other or ( + myref is not None and myref is other()) + def __ne__(self, other): + return not (self == other) + def __hash__(self): + try: + return self._hash + except AttributeError: + self._hash = hash(self()) + return self._hash + self._weakref_cache_ref = {}, MyRef + weak_cache, MyRef = self._weakref_cache_ref + + if destructor is None: + try: + del weak_cache[MyRef(cdata)] + except KeyError: + raise TypeError("Can remove destructor only on a object " + "previously returned by ffi.gc()") + return None + + def remove(k): + cdata, destructor = weak_cache.pop(k, (None, None)) + if destructor is not None: + destructor(cdata) + + new_cdata = self.cast(self.typeof(cdata), cdata) + assert new_cdata is not cdata + weak_cache[MyRef(new_cdata, remove)] = (cdata, destructor) + return new_cdata + + typeof = type + + def getcname(self, BType, replace_with): + return BType._get_c_name(replace_with) + + def typeoffsetof(self, BType, fieldname, num=0): + if isinstance(fieldname, str): + if num == 0 and issubclass(BType, CTypesGenericPtr): + BType = BType._BItem + if not issubclass(BType, CTypesBaseStructOrUnion): + raise TypeError("expected a struct or union ctype") + BField = BType._bfield_types[fieldname] + if BField is Ellipsis: + raise TypeError("not supported for bitfields") + return (BField, BType._offsetof(fieldname)) + elif isinstance(fieldname, (int, long)): + if issubclass(BType, CTypesGenericArray): + BType = BType._CTPtr + if not issubclass(BType, CTypesGenericPtr): + raise TypeError("expected an array or ptr ctype") + BItem = BType._BItem + offset = BItem._get_size() * fieldname + if offset > sys.maxsize: + raise OverflowError + return (BItem, offset) + else: + raise TypeError(type(fieldname)) + + def rawaddressof(self, BTypePtr, cdata, offset=None): + if isinstance(cdata, CTypesBaseStructOrUnion): + ptr = ctypes.pointer(type(cdata)._to_ctypes(cdata)) + elif isinstance(cdata, CTypesGenericPtr): + if offset is None or not issubclass(type(cdata)._BItem, + CTypesBaseStructOrUnion): + raise TypeError("unexpected cdata type") + ptr = type(cdata)._to_ctypes(cdata) + elif isinstance(cdata, CTypesGenericArray): + ptr = type(cdata)._to_ctypes(cdata) + else: + raise TypeError("expected a ") + if offset: + ptr = ctypes.cast( + ctypes.c_void_p( + ctypes.cast(ptr, ctypes.c_void_p).value + offset), + type(ptr)) + return BTypePtr._from_ctypes(ptr) + + +class CTypesLibrary(object): + + def __init__(self, backend, cdll): + self.backend = backend + self.cdll = cdll + + def load_function(self, BType, name): + c_func = getattr(self.cdll, name) + funcobj = BType._from_ctypes(c_func) + funcobj._name = name + return funcobj + + def read_variable(self, BType, name): + try: + ctypes_obj = BType._ctype.in_dll(self.cdll, name) + except AttributeError as e: + raise NotImplementedError(e) + return BType._from_ctypes(ctypes_obj) + + def write_variable(self, BType, name, value): + new_ctypes_obj = BType._to_ctypes(value) + ctypes_obj = BType._ctype.in_dll(self.cdll, name) + ctypes.memmove(ctypes.addressof(ctypes_obj), + ctypes.addressof(new_ctypes_obj), + ctypes.sizeof(BType._ctype)) diff --git a/billinglayer/python/cffi/cffi_opcode.py b/billinglayer/python/cffi/cffi_opcode.py new file mode 100644 index 0000000..a0df98d --- /dev/null +++ b/billinglayer/python/cffi/cffi_opcode.py @@ -0,0 +1,187 @@ +from .error import VerificationError + +class CffiOp(object): + def __init__(self, op, arg): + self.op = op + self.arg = arg + + def as_c_expr(self): + if self.op is None: + assert isinstance(self.arg, str) + return '(_cffi_opcode_t)(%s)' % (self.arg,) + classname = CLASS_NAME[self.op] + return '_CFFI_OP(_CFFI_OP_%s, %s)' % (classname, self.arg) + + def as_python_bytes(self): + if self.op is None and self.arg.isdigit(): + value = int(self.arg) # non-negative: '-' not in self.arg + if value >= 2**31: + raise OverflowError("cannot emit %r: limited to 2**31-1" + % (self.arg,)) + return format_four_bytes(value) + if isinstance(self.arg, str): + raise VerificationError("cannot emit to Python: %r" % (self.arg,)) + return format_four_bytes((self.arg << 8) | self.op) + + def __str__(self): + classname = CLASS_NAME.get(self.op, self.op) + return '(%s %s)' % (classname, self.arg) + +def format_four_bytes(num): + return '\\x%02X\\x%02X\\x%02X\\x%02X' % ( + (num >> 24) & 0xFF, + (num >> 16) & 0xFF, + (num >> 8) & 0xFF, + (num ) & 0xFF) + +OP_PRIMITIVE = 1 +OP_POINTER = 3 +OP_ARRAY = 5 +OP_OPEN_ARRAY = 7 +OP_STRUCT_UNION = 9 +OP_ENUM = 11 +OP_FUNCTION = 13 +OP_FUNCTION_END = 15 +OP_NOOP = 17 +OP_BITFIELD = 19 +OP_TYPENAME = 21 +OP_CPYTHON_BLTN_V = 23 # varargs +OP_CPYTHON_BLTN_N = 25 # noargs +OP_CPYTHON_BLTN_O = 27 # O (i.e. a single arg) +OP_CONSTANT = 29 +OP_CONSTANT_INT = 31 +OP_GLOBAL_VAR = 33 +OP_DLOPEN_FUNC = 35 +OP_DLOPEN_CONST = 37 +OP_GLOBAL_VAR_F = 39 +OP_EXTERN_PYTHON = 41 + +PRIM_VOID = 0 +PRIM_BOOL = 1 +PRIM_CHAR = 2 +PRIM_SCHAR = 3 +PRIM_UCHAR = 4 +PRIM_SHORT = 5 +PRIM_USHORT = 6 +PRIM_INT = 7 +PRIM_UINT = 8 +PRIM_LONG = 9 +PRIM_ULONG = 10 +PRIM_LONGLONG = 11 +PRIM_ULONGLONG = 12 +PRIM_FLOAT = 13 +PRIM_DOUBLE = 14 +PRIM_LONGDOUBLE = 15 + +PRIM_WCHAR = 16 +PRIM_INT8 = 17 +PRIM_UINT8 = 18 +PRIM_INT16 = 19 +PRIM_UINT16 = 20 +PRIM_INT32 = 21 +PRIM_UINT32 = 22 +PRIM_INT64 = 23 +PRIM_UINT64 = 24 +PRIM_INTPTR = 25 +PRIM_UINTPTR = 26 +PRIM_PTRDIFF = 27 +PRIM_SIZE = 28 +PRIM_SSIZE = 29 +PRIM_INT_LEAST8 = 30 +PRIM_UINT_LEAST8 = 31 +PRIM_INT_LEAST16 = 32 +PRIM_UINT_LEAST16 = 33 +PRIM_INT_LEAST32 = 34 +PRIM_UINT_LEAST32 = 35 +PRIM_INT_LEAST64 = 36 +PRIM_UINT_LEAST64 = 37 +PRIM_INT_FAST8 = 38 +PRIM_UINT_FAST8 = 39 +PRIM_INT_FAST16 = 40 +PRIM_UINT_FAST16 = 41 +PRIM_INT_FAST32 = 42 +PRIM_UINT_FAST32 = 43 +PRIM_INT_FAST64 = 44 +PRIM_UINT_FAST64 = 45 +PRIM_INTMAX = 46 +PRIM_UINTMAX = 47 +PRIM_FLOATCOMPLEX = 48 +PRIM_DOUBLECOMPLEX = 49 +PRIM_CHAR16 = 50 +PRIM_CHAR32 = 51 + +_NUM_PRIM = 52 +_UNKNOWN_PRIM = -1 +_UNKNOWN_FLOAT_PRIM = -2 +_UNKNOWN_LONG_DOUBLE = -3 + +_IO_FILE_STRUCT = -1 + +PRIMITIVE_TO_INDEX = { + 'char': PRIM_CHAR, + 'short': PRIM_SHORT, + 'int': PRIM_INT, + 'long': PRIM_LONG, + 'long long': PRIM_LONGLONG, + 'signed char': PRIM_SCHAR, + 'unsigned char': PRIM_UCHAR, + 'unsigned short': PRIM_USHORT, + 'unsigned int': PRIM_UINT, + 'unsigned long': PRIM_ULONG, + 'unsigned long long': PRIM_ULONGLONG, + 'float': PRIM_FLOAT, + 'double': PRIM_DOUBLE, + 'long double': PRIM_LONGDOUBLE, + 'float _Complex': PRIM_FLOATCOMPLEX, + 'double _Complex': PRIM_DOUBLECOMPLEX, + '_Bool': PRIM_BOOL, + 'wchar_t': PRIM_WCHAR, + 'char16_t': PRIM_CHAR16, + 'char32_t': PRIM_CHAR32, + 'int8_t': PRIM_INT8, + 'uint8_t': PRIM_UINT8, + 'int16_t': PRIM_INT16, + 'uint16_t': PRIM_UINT16, + 'int32_t': PRIM_INT32, + 'uint32_t': PRIM_UINT32, + 'int64_t': PRIM_INT64, + 'uint64_t': PRIM_UINT64, + 'intptr_t': PRIM_INTPTR, + 'uintptr_t': PRIM_UINTPTR, + 'ptrdiff_t': PRIM_PTRDIFF, + 'size_t': PRIM_SIZE, + 'ssize_t': PRIM_SSIZE, + 'int_least8_t': PRIM_INT_LEAST8, + 'uint_least8_t': PRIM_UINT_LEAST8, + 'int_least16_t': PRIM_INT_LEAST16, + 'uint_least16_t': PRIM_UINT_LEAST16, + 'int_least32_t': PRIM_INT_LEAST32, + 'uint_least32_t': PRIM_UINT_LEAST32, + 'int_least64_t': PRIM_INT_LEAST64, + 'uint_least64_t': PRIM_UINT_LEAST64, + 'int_fast8_t': PRIM_INT_FAST8, + 'uint_fast8_t': PRIM_UINT_FAST8, + 'int_fast16_t': PRIM_INT_FAST16, + 'uint_fast16_t': PRIM_UINT_FAST16, + 'int_fast32_t': PRIM_INT_FAST32, + 'uint_fast32_t': PRIM_UINT_FAST32, + 'int_fast64_t': PRIM_INT_FAST64, + 'uint_fast64_t': PRIM_UINT_FAST64, + 'intmax_t': PRIM_INTMAX, + 'uintmax_t': PRIM_UINTMAX, + } + +F_UNION = 0x01 +F_CHECK_FIELDS = 0x02 +F_PACKED = 0x04 +F_EXTERNAL = 0x08 +F_OPAQUE = 0x10 + +G_FLAGS = dict([('_CFFI_' + _key, globals()[_key]) + for _key in ['F_UNION', 'F_CHECK_FIELDS', 'F_PACKED', + 'F_EXTERNAL', 'F_OPAQUE']]) + +CLASS_NAME = {} +for _name, _value in list(globals().items()): + if _name.startswith('OP_') and isinstance(_value, int): + CLASS_NAME[_value] = _name[3:] diff --git a/billinglayer/python/cffi/commontypes.py b/billinglayer/python/cffi/commontypes.py new file mode 100644 index 0000000..8ec97c7 --- /dev/null +++ b/billinglayer/python/cffi/commontypes.py @@ -0,0 +1,80 @@ +import sys +from . import model +from .error import FFIError + + +COMMON_TYPES = {} + +try: + # fetch "bool" and all simple Windows types + from _cffi_backend import _get_common_types + _get_common_types(COMMON_TYPES) +except ImportError: + pass + +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') +COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above + +for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + if _type.endswith('_t'): + COMMON_TYPES[_type] = _type +del _type + +_CACHE = {} + +def resolve_common_type(parser, commontype): + try: + return _CACHE[commontype] + except KeyError: + cdecl = COMMON_TYPES.get(commontype, commontype) + if not isinstance(cdecl, str): + result, quals = cdecl, 0 # cdecl is already a BaseType + elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + result, quals = model.PrimitiveType(cdecl), 0 + elif cdecl == 'set-unicode-needed': + raise FFIError("The Windows type %r is only available after " + "you call ffi.set_unicode()" % (commontype,)) + else: + if commontype == cdecl: + raise FFIError( + "Unsupported type: %r. Please look at " + "http://cffi.readthedocs.io/en/latest/cdef.html#ffi-cdef-limitations " + "and file an issue if you think this type should really " + "be supported." % (commontype,)) + result, quals = parser.parse_type_and_quals(cdecl) # recursive + + assert isinstance(result, model.BaseTypeByIdentity) + _CACHE[commontype] = result, quals + return result, quals + + +# ____________________________________________________________ +# extra types for Windows (most of them are in commontypes.c) + + +def win_common_types(): + return { + "UNICODE_STRING": model.StructType( + "_UNICODE_STRING", + ["Length", + "MaximumLength", + "Buffer"], + [model.PrimitiveType("unsigned short"), + model.PrimitiveType("unsigned short"), + model.PointerType(model.PrimitiveType("wchar_t"))], + [-1, -1, -1]), + "PUNICODE_STRING": "UNICODE_STRING *", + "PCUNICODE_STRING": "const UNICODE_STRING *", + + "TBYTE": "set-unicode-needed", + "TCHAR": "set-unicode-needed", + "LPCTSTR": "set-unicode-needed", + "PCTSTR": "set-unicode-needed", + "LPTSTR": "set-unicode-needed", + "PTSTR": "set-unicode-needed", + "PTBYTE": "set-unicode-needed", + "PTCHAR": "set-unicode-needed", + } + +if sys.platform == 'win32': + COMMON_TYPES.update(win_common_types()) diff --git a/billinglayer/python/cffi/cparser.py b/billinglayer/python/cffi/cparser.py new file mode 100644 index 0000000..74830e9 --- /dev/null +++ b/billinglayer/python/cffi/cparser.py @@ -0,0 +1,1006 @@ +from . import model +from .commontypes import COMMON_TYPES, resolve_common_type +from .error import FFIError, CDefError +try: + from . import _pycparser as pycparser +except ImportError: + import pycparser +import weakref, re, sys + +try: + if sys.version_info < (3,): + import thread as _thread + else: + import _thread + lock = _thread.allocate_lock() +except ImportError: + lock = None + +def _workaround_for_static_import_finders(): + # Issue #392: packaging tools like cx_Freeze can not find these + # because pycparser uses exec dynamic import. This is an obscure + # workaround. This function is never called. + import pycparser.yacctab + import pycparser.lextab + +CDEF_SOURCE_STRING = "" +_r_comment = re.compile(r"/\*.*?\*/|//([^\n\\]|\\.)*?$", + re.DOTALL | re.MULTILINE) +_r_define = re.compile(r"^\s*#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)" + r"\b((?:[^\n\\]|\\.)*?)$", + re.DOTALL | re.MULTILINE) +_r_line_directive = re.compile(r"^[ \t]*#[ \t]*(?:line|\d+)\b.*$", re.MULTILINE) +_r_partial_enum = re.compile(r"=\s*\.\.\.\s*[,}]|\.\.\.\s*\}") +_r_enum_dotdotdot = re.compile(r"__dotdotdot\d+__$") +_r_partial_array = re.compile(r"\[\s*\.\.\.\s*\]") +_r_words = re.compile(r"\w+|\S") +_parser_cache = None +_r_int_literal = re.compile(r"-?0?x?[0-9a-f]+[lu]*$", re.IGNORECASE) +_r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") +_r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") +_r_cdecl = re.compile(r"\b__cdecl\b") +_r_extern_python = re.compile(r'\bextern\s*"' + r'(Python|Python\s*\+\s*C|C\s*\+\s*Python)"\s*.') +_r_star_const_space = re.compile( # matches "* const " + r"[*]\s*((const|volatile|restrict)\b\s*)+") +_r_int_dotdotdot = re.compile(r"(\b(int|long|short|signed|unsigned|char)\s*)+" + r"\.\.\.") +_r_float_dotdotdot = re.compile(r"\b(double|float)\s*\.\.\.") + +def _get_parser(): + global _parser_cache + if _parser_cache is None: + _parser_cache = pycparser.CParser() + return _parser_cache + +def _workaround_for_old_pycparser(csource): + # Workaround for a pycparser issue (fixed between pycparser 2.10 and + # 2.14): "char*const***" gives us a wrong syntax tree, the same as + # for "char***(*const)". This means we can't tell the difference + # afterwards. But "char(*const(***))" gives us the right syntax + # tree. The issue only occurs if there are several stars in + # sequence with no parenthesis inbetween, just possibly qualifiers. + # Attempt to fix it by adding some parentheses in the source: each + # time we see "* const" or "* const *", we add an opening + # parenthesis before each star---the hard part is figuring out where + # to close them. + parts = [] + while True: + match = _r_star_const_space.search(csource) + if not match: + break + #print repr(''.join(parts)+csource), '=>', + parts.append(csource[:match.start()]) + parts.append('('); closing = ')' + parts.append(match.group()) # e.g. "* const " + endpos = match.end() + if csource.startswith('*', endpos): + parts.append('('); closing += ')' + level = 0 + i = endpos + while i < len(csource): + c = csource[i] + if c == '(': + level += 1 + elif c == ')': + if level == 0: + break + level -= 1 + elif c in ',;=': + if level == 0: + break + i += 1 + csource = csource[endpos:i] + closing + csource[i:] + #print repr(''.join(parts)+csource) + parts.append(csource) + return ''.join(parts) + +def _preprocess_extern_python(csource): + # input: `extern "Python" int foo(int);` or + # `extern "Python" { int foo(int); }` + # output: + # void __cffi_extern_python_start; + # int foo(int); + # void __cffi_extern_python_stop; + # + # input: `extern "Python+C" int foo(int);` + # output: + # void __cffi_extern_python_plus_c_start; + # int foo(int); + # void __cffi_extern_python_stop; + parts = [] + while True: + match = _r_extern_python.search(csource) + if not match: + break + endpos = match.end() - 1 + #print + #print ''.join(parts)+csource + #print '=>' + parts.append(csource[:match.start()]) + if 'C' in match.group(1): + parts.append('void __cffi_extern_python_plus_c_start; ') + else: + parts.append('void __cffi_extern_python_start; ') + if csource[endpos] == '{': + # grouping variant + closing = csource.find('}', endpos) + if closing < 0: + raise CDefError("'extern \"Python\" {': no '}' found") + if csource.find('{', endpos + 1, closing) >= 0: + raise NotImplementedError("cannot use { } inside a block " + "'extern \"Python\" { ... }'") + parts.append(csource[endpos+1:closing]) + csource = csource[closing+1:] + else: + # non-grouping variant + semicolon = csource.find(';', endpos) + if semicolon < 0: + raise CDefError("'extern \"Python\": no ';' found") + parts.append(csource[endpos:semicolon+1]) + csource = csource[semicolon+1:] + parts.append(' void __cffi_extern_python_stop;') + #print ''.join(parts)+csource + #print + parts.append(csource) + return ''.join(parts) + +def _warn_for_string_literal(csource): + if '"' not in csource: + return + for line in csource.splitlines(): + if '"' in line and not line.lstrip().startswith('#'): + import warnings + warnings.warn("String literal found in cdef() or type source. " + "String literals are ignored here, but you should " + "remove them anyway because some character sequences " + "confuse pre-parsing.") + break + +def _warn_for_non_extern_non_static_global_variable(decl): + if not decl.storage: + import warnings + warnings.warn("Global variable '%s' in cdef(): for consistency " + "with C it should have a storage class specifier " + "(usually 'extern')" % (decl.name,)) + +def _remove_line_directives(csource): + # _r_line_directive matches whole lines, without the final \n, if they + # start with '#line' with some spacing allowed, or '#NUMBER'. This + # function stores them away and replaces them with exactly the string + # '#line@N', where N is the index in the list 'line_directives'. + line_directives = [] + def replace(m): + i = len(line_directives) + line_directives.append(m.group()) + return '#line@%d' % i + csource = _r_line_directive.sub(replace, csource) + return csource, line_directives + +def _put_back_line_directives(csource, line_directives): + def replace(m): + s = m.group() + if not s.startswith('#line@'): + raise AssertionError("unexpected #line directive " + "(should have been processed and removed") + return line_directives[int(s[6:])] + return _r_line_directive.sub(replace, csource) + +def _preprocess(csource): + # First, remove the lines of the form '#line N "filename"' because + # the "filename" part could confuse the rest + csource, line_directives = _remove_line_directives(csource) + # Remove comments. NOTE: this only work because the cdef() section + # should not contain any string literals (except in line directives)! + def replace_keeping_newlines(m): + return ' ' + m.group().count('\n') * '\n' + csource = _r_comment.sub(replace_keeping_newlines, csource) + # Remove the "#define FOO x" lines + macros = {} + for match in _r_define.finditer(csource): + macroname, macrovalue = match.groups() + macrovalue = macrovalue.replace('\\\n', '').strip() + macros[macroname] = macrovalue + csource = _r_define.sub('', csource) + # + if pycparser.__version__ < '2.14': + csource = _workaround_for_old_pycparser(csource) + # + # BIG HACK: replace WINAPI or __stdcall with "volatile const". + # It doesn't make sense for the return type of a function to be + # "volatile volatile const", so we abuse it to detect __stdcall... + # Hack number 2 is that "int(volatile *fptr)();" is not valid C + # syntax, so we place the "volatile" before the opening parenthesis. + csource = _r_stdcall2.sub(' volatile volatile const(', csource) + csource = _r_stdcall1.sub(' volatile volatile const ', csource) + csource = _r_cdecl.sub(' ', csource) + # + # Replace `extern "Python"` with start/end markers + csource = _preprocess_extern_python(csource) + # + # Now there should not be any string literal left; warn if we get one + _warn_for_string_literal(csource) + # + # Replace "[...]" with "[__dotdotdotarray__]" + csource = _r_partial_array.sub('[__dotdotdotarray__]', csource) + # + # Replace "...}" with "__dotdotdotNUM__}". This construction should + # occur only at the end of enums; at the end of structs we have "...;}" + # and at the end of vararg functions "...);". Also replace "=...[,}]" + # with ",__dotdotdotNUM__[,}]": this occurs in the enums too, when + # giving an unknown value. + matches = list(_r_partial_enum.finditer(csource)) + for number, match in enumerate(reversed(matches)): + p = match.start() + if csource[p] == '=': + p2 = csource.find('...', p, match.end()) + assert p2 > p + csource = '%s,__dotdotdot%d__ %s' % (csource[:p], number, + csource[p2+3:]) + else: + assert csource[p:p+3] == '...' + csource = '%s __dotdotdot%d__ %s' % (csource[:p], number, + csource[p+3:]) + # Replace "int ..." or "unsigned long int..." with "__dotdotdotint__" + csource = _r_int_dotdotdot.sub(' __dotdotdotint__ ', csource) + # Replace "float ..." or "double..." with "__dotdotdotfloat__" + csource = _r_float_dotdotdot.sub(' __dotdotdotfloat__ ', csource) + # Replace all remaining "..." with the same name, "__dotdotdot__", + # which is declared with a typedef for the purpose of C parsing. + csource = csource.replace('...', ' __dotdotdot__ ') + # Finally, put back the line directives + csource = _put_back_line_directives(csource, line_directives) + return csource, macros + +def _common_type_names(csource): + # Look in the source for what looks like usages of types from the + # list of common types. A "usage" is approximated here as the + # appearance of the word, minus a "definition" of the type, which + # is the last word in a "typedef" statement. Approximative only + # but should be fine for all the common types. + look_for_words = set(COMMON_TYPES) + look_for_words.add(';') + look_for_words.add(',') + look_for_words.add('(') + look_for_words.add(')') + look_for_words.add('typedef') + words_used = set() + is_typedef = False + paren = 0 + previous_word = '' + for word in _r_words.findall(csource): + if word in look_for_words: + if word == ';': + if is_typedef: + words_used.discard(previous_word) + look_for_words.discard(previous_word) + is_typedef = False + elif word == 'typedef': + is_typedef = True + paren = 0 + elif word == '(': + paren += 1 + elif word == ')': + paren -= 1 + elif word == ',': + if is_typedef and paren == 0: + words_used.discard(previous_word) + look_for_words.discard(previous_word) + else: # word in COMMON_TYPES + words_used.add(word) + previous_word = word + return words_used + + +class Parser(object): + + def __init__(self): + self._declarations = {} + self._included_declarations = set() + self._anonymous_counter = 0 + self._structnode2type = weakref.WeakKeyDictionary() + self._options = {} + self._int_constants = {} + self._recomplete = [] + self._uses_new_feature = None + + def _parse(self, csource): + csource, macros = _preprocess(csource) + # XXX: for more efficiency we would need to poke into the + # internals of CParser... the following registers the + # typedefs, because their presence or absence influences the + # parsing itself (but what they are typedef'ed to plays no role) + ctn = _common_type_names(csource) + typenames = [] + for name in sorted(self._declarations): + if name.startswith('typedef '): + name = name[8:] + typenames.append(name) + ctn.discard(name) + typenames += sorted(ctn) + # + csourcelines = [] + csourcelines.append('# 1 ""') + for typename in typenames: + csourcelines.append('typedef int %s;' % typename) + csourcelines.append('typedef int __dotdotdotint__, __dotdotdotfloat__,' + ' __dotdotdot__;') + # this forces pycparser to consider the following in the file + # called from line 1 + csourcelines.append('# 1 "%s"' % (CDEF_SOURCE_STRING,)) + csourcelines.append(csource) + fullcsource = '\n'.join(csourcelines) + if lock is not None: + lock.acquire() # pycparser is not thread-safe... + try: + ast = _get_parser().parse(fullcsource) + except pycparser.c_parser.ParseError as e: + self.convert_pycparser_error(e, csource) + finally: + if lock is not None: + lock.release() + # csource will be used to find buggy source text + return ast, macros, csource + + def _convert_pycparser_error(self, e, csource): + # xxx look for ":NUM:" at the start of str(e) + # and interpret that as a line number. This will not work if + # the user gives explicit ``# NUM "FILE"`` directives. + line = None + msg = str(e) + match = re.match(r"%s:(\d+):" % (CDEF_SOURCE_STRING,), msg) + if match: + linenum = int(match.group(1), 10) + csourcelines = csource.splitlines() + if 1 <= linenum <= len(csourcelines): + line = csourcelines[linenum-1] + return line + + def convert_pycparser_error(self, e, csource): + line = self._convert_pycparser_error(e, csource) + + msg = str(e) + if line: + msg = 'cannot parse "%s"\n%s' % (line.strip(), msg) + else: + msg = 'parse error\n%s' % (msg,) + raise CDefError(msg) + + def parse(self, csource, override=False, packed=False, pack=None, + dllexport=False): + if packed: + if packed != True: + raise ValueError("'packed' should be False or True; use " + "'pack' to give another value") + if pack: + raise ValueError("cannot give both 'pack' and 'packed'") + pack = 1 + elif pack: + if pack & (pack - 1): + raise ValueError("'pack' must be a power of two, not %r" % + (pack,)) + else: + pack = 0 + prev_options = self._options + try: + self._options = {'override': override, + 'packed': pack, + 'dllexport': dllexport} + self._internal_parse(csource) + finally: + self._options = prev_options + + def _internal_parse(self, csource): + ast, macros, csource = self._parse(csource) + # add the macros + self._process_macros(macros) + # find the first "__dotdotdot__" and use that as a separator + # between the repeated typedefs and the real csource + iterator = iter(ast.ext) + for decl in iterator: + if decl.name == '__dotdotdot__': + break + else: + assert 0 + current_decl = None + # + try: + self._inside_extern_python = '__cffi_extern_python_stop' + for decl in iterator: + current_decl = decl + if isinstance(decl, pycparser.c_ast.Decl): + self._parse_decl(decl) + elif isinstance(decl, pycparser.c_ast.Typedef): + if not decl.name: + raise CDefError("typedef does not declare any name", + decl) + quals = 0 + if (isinstance(decl.type.type, pycparser.c_ast.IdentifierType) and + decl.type.type.names[-1].startswith('__dotdotdot')): + realtype = self._get_unknown_type(decl) + elif (isinstance(decl.type, pycparser.c_ast.PtrDecl) and + isinstance(decl.type.type, pycparser.c_ast.TypeDecl) and + isinstance(decl.type.type.type, + pycparser.c_ast.IdentifierType) and + decl.type.type.type.names[-1].startswith('__dotdotdot')): + realtype = self._get_unknown_ptr_type(decl) + else: + realtype, quals = self._get_type_and_quals( + decl.type, name=decl.name, partial_length_ok=True, + typedef_example="*(%s *)0" % (decl.name,)) + self._declare('typedef ' + decl.name, realtype, quals=quals) + elif decl.__class__.__name__ == 'Pragma': + pass # skip pragma, only in pycparser 2.15 + else: + raise CDefError("unexpected <%s>: this construct is valid " + "C but not valid in cdef()" % + decl.__class__.__name__, decl) + except CDefError as e: + if len(e.args) == 1: + e.args = e.args + (current_decl,) + raise + except FFIError as e: + msg = self._convert_pycparser_error(e, csource) + if msg: + e.args = (e.args[0] + "\n *** Err: %s" % msg,) + raise + + def _add_constants(self, key, val): + if key in self._int_constants: + if self._int_constants[key] == val: + return # ignore identical double declarations + raise FFIError( + "multiple declarations of constant: %s" % (key,)) + self._int_constants[key] = val + + def _add_integer_constant(self, name, int_str): + int_str = int_str.lower().rstrip("ul") + neg = int_str.startswith('-') + if neg: + int_str = int_str[1:] + # "010" is not valid oct in py3 + if (int_str.startswith("0") and int_str != '0' + and not int_str.startswith("0x")): + int_str = "0o" + int_str[1:] + pyvalue = int(int_str, 0) + if neg: + pyvalue = -pyvalue + self._add_constants(name, pyvalue) + self._declare('macro ' + name, pyvalue) + + def _process_macros(self, macros): + for key, value in macros.items(): + value = value.strip() + if _r_int_literal.match(value): + self._add_integer_constant(key, value) + elif value == '...': + self._declare('macro ' + key, value) + else: + raise CDefError( + 'only supports one of the following syntax:\n' + ' #define %s ... (literally dot-dot-dot)\n' + ' #define %s NUMBER (with NUMBER an integer' + ' constant, decimal/hex/octal)\n' + 'got:\n' + ' #define %s %s' + % (key, key, key, value)) + + def _declare_function(self, tp, quals, decl): + tp = self._get_type_pointer(tp, quals) + if self._options.get('dllexport'): + tag = 'dllexport_python ' + elif self._inside_extern_python == '__cffi_extern_python_start': + tag = 'extern_python ' + elif self._inside_extern_python == '__cffi_extern_python_plus_c_start': + tag = 'extern_python_plus_c ' + else: + tag = 'function ' + self._declare(tag + decl.name, tp) + + def _parse_decl(self, decl): + node = decl.type + if isinstance(node, pycparser.c_ast.FuncDecl): + tp, quals = self._get_type_and_quals(node, name=decl.name) + assert isinstance(tp, model.RawFunctionType) + self._declare_function(tp, quals, decl) + else: + if isinstance(node, pycparser.c_ast.Struct): + self._get_struct_union_enum_type('struct', node) + elif isinstance(node, pycparser.c_ast.Union): + self._get_struct_union_enum_type('union', node) + elif isinstance(node, pycparser.c_ast.Enum): + self._get_struct_union_enum_type('enum', node) + elif not decl.name: + raise CDefError("construct does not declare any variable", + decl) + # + if decl.name: + tp, quals = self._get_type_and_quals(node, + partial_length_ok=True) + if tp.is_raw_function: + self._declare_function(tp, quals, decl) + elif (tp.is_integer_type() and + hasattr(decl, 'init') and + hasattr(decl.init, 'value') and + _r_int_literal.match(decl.init.value)): + self._add_integer_constant(decl.name, decl.init.value) + elif (tp.is_integer_type() and + isinstance(decl.init, pycparser.c_ast.UnaryOp) and + decl.init.op == '-' and + hasattr(decl.init.expr, 'value') and + _r_int_literal.match(decl.init.expr.value)): + self._add_integer_constant(decl.name, + '-' + decl.init.expr.value) + elif (tp is model.void_type and + decl.name.startswith('__cffi_extern_python_')): + # hack: `extern "Python"` in the C source is replaced + # with "void __cffi_extern_python_start;" and + # "void __cffi_extern_python_stop;" + self._inside_extern_python = decl.name + else: + if self._inside_extern_python !='__cffi_extern_python_stop': + raise CDefError( + "cannot declare constants or " + "variables with 'extern \"Python\"'") + if (quals & model.Q_CONST) and not tp.is_array_type: + self._declare('constant ' + decl.name, tp, quals=quals) + else: + _warn_for_non_extern_non_static_global_variable(decl) + self._declare('variable ' + decl.name, tp, quals=quals) + + def parse_type(self, cdecl): + return self.parse_type_and_quals(cdecl)[0] + + def parse_type_and_quals(self, cdecl): + ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] + assert not macros + exprnode = ast.ext[-1].type.args.params[0] + if isinstance(exprnode, pycparser.c_ast.ID): + raise CDefError("unknown identifier '%s'" % (exprnode.name,)) + return self._get_type_and_quals(exprnode.type) + + def _declare(self, name, obj, included=False, quals=0): + if name in self._declarations: + prevobj, prevquals = self._declarations[name] + if prevobj is obj and prevquals == quals: + return + if not self._options.get('override'): + raise FFIError( + "multiple declarations of %s (for interactive usage, " + "try cdef(xx, override=True))" % (name,)) + assert '__dotdotdot__' not in name.split() + self._declarations[name] = (obj, quals) + if included: + self._included_declarations.add(obj) + + def _extract_quals(self, type): + quals = 0 + if isinstance(type, (pycparser.c_ast.TypeDecl, + pycparser.c_ast.PtrDecl)): + if 'const' in type.quals: + quals |= model.Q_CONST + if 'volatile' in type.quals: + quals |= model.Q_VOLATILE + if 'restrict' in type.quals: + quals |= model.Q_RESTRICT + return quals + + def _get_type_pointer(self, type, quals, declname=None): + if isinstance(type, model.RawFunctionType): + return type.as_function_pointer() + if (isinstance(type, model.StructOrUnionOrEnum) and + type.name.startswith('$') and type.name[1:].isdigit() and + type.forcename is None and declname is not None): + return model.NamedPointerType(type, declname, quals) + return model.PointerType(type, quals) + + def _get_type_and_quals(self, typenode, name=None, partial_length_ok=False, + typedef_example=None): + # first, dereference typedefs, if we have it already parsed, we're good + if (isinstance(typenode, pycparser.c_ast.TypeDecl) and + isinstance(typenode.type, pycparser.c_ast.IdentifierType) and + len(typenode.type.names) == 1 and + ('typedef ' + typenode.type.names[0]) in self._declarations): + tp, quals = self._declarations['typedef ' + typenode.type.names[0]] + quals |= self._extract_quals(typenode) + return tp, quals + # + if isinstance(typenode, pycparser.c_ast.ArrayDecl): + # array type + if typenode.dim is None: + length = None + else: + length = self._parse_constant( + typenode.dim, partial_length_ok=partial_length_ok) + # a hack: in 'typedef int foo_t[...][...];', don't use '...' as + # the length but use directly the C expression that would be + # generated by recompiler.py. This lets the typedef be used in + # many more places within recompiler.py + if typedef_example is not None: + if length == '...': + length = '_cffi_array_len(%s)' % (typedef_example,) + typedef_example = "*" + typedef_example + # + tp, quals = self._get_type_and_quals(typenode.type, + partial_length_ok=partial_length_ok, + typedef_example=typedef_example) + return model.ArrayType(tp, length), quals + # + if isinstance(typenode, pycparser.c_ast.PtrDecl): + # pointer type + itemtype, itemquals = self._get_type_and_quals(typenode.type) + tp = self._get_type_pointer(itemtype, itemquals, declname=name) + quals = self._extract_quals(typenode) + return tp, quals + # + if isinstance(typenode, pycparser.c_ast.TypeDecl): + quals = self._extract_quals(typenode) + type = typenode.type + if isinstance(type, pycparser.c_ast.IdentifierType): + # assume a primitive type. get it from .names, but reduce + # synonyms to a single chosen combination + names = list(type.names) + if names != ['signed', 'char']: # keep this unmodified + prefixes = {} + while names: + name = names[0] + if name in ('short', 'long', 'signed', 'unsigned'): + prefixes[name] = prefixes.get(name, 0) + 1 + del names[0] + else: + break + # ignore the 'signed' prefix below, and reorder the others + newnames = [] + for prefix in ('unsigned', 'short', 'long'): + for i in range(prefixes.get(prefix, 0)): + newnames.append(prefix) + if not names: + names = ['int'] # implicitly + if names == ['int']: # but kill it if 'short' or 'long' + if 'short' in prefixes or 'long' in prefixes: + names = [] + names = newnames + names + ident = ' '.join(names) + if ident == 'void': + return model.void_type, quals + if ident == '__dotdotdot__': + raise FFIError(':%d: bad usage of "..."' % + typenode.coord.line) + tp0, quals0 = resolve_common_type(self, ident) + return tp0, (quals | quals0) + # + if isinstance(type, pycparser.c_ast.Struct): + # 'struct foobar' + tp = self._get_struct_union_enum_type('struct', type, name) + return tp, quals + # + if isinstance(type, pycparser.c_ast.Union): + # 'union foobar' + tp = self._get_struct_union_enum_type('union', type, name) + return tp, quals + # + if isinstance(type, pycparser.c_ast.Enum): + # 'enum foobar' + tp = self._get_struct_union_enum_type('enum', type, name) + return tp, quals + # + if isinstance(typenode, pycparser.c_ast.FuncDecl): + # a function type + return self._parse_function_type(typenode, name), 0 + # + # nested anonymous structs or unions end up here + if isinstance(typenode, pycparser.c_ast.Struct): + return self._get_struct_union_enum_type('struct', typenode, name, + nested=True), 0 + if isinstance(typenode, pycparser.c_ast.Union): + return self._get_struct_union_enum_type('union', typenode, name, + nested=True), 0 + # + raise FFIError(":%d: bad or unsupported type declaration" % + typenode.coord.line) + + def _parse_function_type(self, typenode, funcname=None): + params = list(getattr(typenode.args, 'params', [])) + for i, arg in enumerate(params): + if not hasattr(arg, 'type'): + raise CDefError("%s arg %d: unknown type '%s'" + " (if you meant to use the old C syntax of giving" + " untyped arguments, it is not supported)" + % (funcname or 'in expression', i + 1, + getattr(arg, 'name', '?'))) + ellipsis = ( + len(params) > 0 and + isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and + isinstance(params[-1].type.type, + pycparser.c_ast.IdentifierType) and + params[-1].type.type.names == ['__dotdotdot__']) + if ellipsis: + params.pop() + if not params: + raise CDefError( + "%s: a function with only '(...)' as argument" + " is not correct C" % (funcname or 'in expression')) + args = [self._as_func_arg(*self._get_type_and_quals(argdeclnode.type)) + for argdeclnode in params] + if not ellipsis and args == [model.void_type]: + args = [] + result, quals = self._get_type_and_quals(typenode.type) + # the 'quals' on the result type are ignored. HACK: we absure them + # to detect __stdcall functions: we textually replace "__stdcall" + # with "volatile volatile const" above. + abi = None + if hasattr(typenode.type, 'quals'): # else, probable syntax error anyway + if typenode.type.quals[-3:] == ['volatile', 'volatile', 'const']: + abi = '__stdcall' + return model.RawFunctionType(tuple(args), result, ellipsis, abi) + + def _as_func_arg(self, type, quals): + if isinstance(type, model.ArrayType): + return model.PointerType(type.item, quals) + elif isinstance(type, model.RawFunctionType): + return type.as_function_pointer() + else: + return type + + def _get_struct_union_enum_type(self, kind, type, name=None, nested=False): + # First, a level of caching on the exact 'type' node of the AST. + # This is obscure, but needed because pycparser "unrolls" declarations + # such as "typedef struct { } foo_t, *foo_p" and we end up with + # an AST that is not a tree, but a DAG, with the "type" node of the + # two branches foo_t and foo_p of the trees being the same node. + # It's a bit silly but detecting "DAG-ness" in the AST tree seems + # to be the only way to distinguish this case from two independent + # structs. See test_struct_with_two_usages. + try: + return self._structnode2type[type] + except KeyError: + pass + # + # Note that this must handle parsing "struct foo" any number of + # times and always return the same StructType object. Additionally, + # one of these times (not necessarily the first), the fields of + # the struct can be specified with "struct foo { ...fields... }". + # If no name is given, then we have to create a new anonymous struct + # with no caching; in this case, the fields are either specified + # right now or never. + # + force_name = name + name = type.name + # + # get the type or create it if needed + if name is None: + # 'force_name' is used to guess a more readable name for + # anonymous structs, for the common case "typedef struct { } foo". + if force_name is not None: + explicit_name = '$%s' % force_name + else: + self._anonymous_counter += 1 + explicit_name = '$%d' % self._anonymous_counter + tp = None + else: + explicit_name = name + key = '%s %s' % (kind, name) + tp, _ = self._declarations.get(key, (None, None)) + # + if tp is None: + if kind == 'struct': + tp = model.StructType(explicit_name, None, None, None) + elif kind == 'union': + tp = model.UnionType(explicit_name, None, None, None) + elif kind == 'enum': + if explicit_name == '__dotdotdot__': + raise CDefError("Enums cannot be declared with ...") + tp = self._build_enum_type(explicit_name, type.values) + else: + raise AssertionError("kind = %r" % (kind,)) + if name is not None: + self._declare(key, tp) + else: + if kind == 'enum' and type.values is not None: + raise NotImplementedError( + "enum %s: the '{}' declaration should appear on the first " + "time the enum is mentioned, not later" % explicit_name) + if not tp.forcename: + tp.force_the_name(force_name) + if tp.forcename and '$' in tp.name: + self._declare('anonymous %s' % tp.forcename, tp) + # + self._structnode2type[type] = tp + # + # enums: done here + if kind == 'enum': + return tp + # + # is there a 'type.decls'? If yes, then this is the place in the + # C sources that declare the fields. If no, then just return the + # existing type, possibly still incomplete. + if type.decls is None: + return tp + # + if tp.fldnames is not None: + raise CDefError("duplicate declaration of struct %s" % name) + fldnames = [] + fldtypes = [] + fldbitsize = [] + fldquals = [] + for decl in type.decls: + if (isinstance(decl.type, pycparser.c_ast.IdentifierType) and + ''.join(decl.type.names) == '__dotdotdot__'): + # XXX pycparser is inconsistent: 'names' should be a list + # of strings, but is sometimes just one string. Use + # str.join() as a way to cope with both. + self._make_partial(tp, nested) + continue + if decl.bitsize is None: + bitsize = -1 + else: + bitsize = self._parse_constant(decl.bitsize) + self._partial_length = False + type, fqual = self._get_type_and_quals(decl.type, + partial_length_ok=True) + if self._partial_length: + self._make_partial(tp, nested) + if isinstance(type, model.StructType) and type.partial: + self._make_partial(tp, nested) + fldnames.append(decl.name or '') + fldtypes.append(type) + fldbitsize.append(bitsize) + fldquals.append(fqual) + tp.fldnames = tuple(fldnames) + tp.fldtypes = tuple(fldtypes) + tp.fldbitsize = tuple(fldbitsize) + tp.fldquals = tuple(fldquals) + if fldbitsize != [-1] * len(fldbitsize): + if isinstance(tp, model.StructType) and tp.partial: + raise NotImplementedError("%s: using both bitfields and '...;'" + % (tp,)) + tp.packed = self._options.get('packed') + if tp.completed: # must be re-completed: it is not opaque any more + tp.completed = 0 + self._recomplete.append(tp) + return tp + + def _make_partial(self, tp, nested): + if not isinstance(tp, model.StructOrUnion): + raise CDefError("%s cannot be partial" % (tp,)) + if not tp.has_c_name() and not nested: + raise NotImplementedError("%s is partial but has no C name" %(tp,)) + tp.partial = True + + def _parse_constant(self, exprnode, partial_length_ok=False): + # for now, limited to expressions that are an immediate number + # or positive/negative number + if isinstance(exprnode, pycparser.c_ast.Constant): + s = exprnode.value + if '0' <= s[0] <= '9': + s = s.rstrip('uUlL') + try: + if s.startswith('0'): + return int(s, 8) + else: + return int(s, 10) + except ValueError: + if len(s) > 1: + if s.lower()[0:2] == '0x': + return int(s, 16) + elif s.lower()[0:2] == '0b': + return int(s, 2) + raise CDefError("invalid constant %r" % (s,)) + elif s[0] == "'" and s[-1] == "'" and ( + len(s) == 3 or (len(s) == 4 and s[1] == "\\")): + return ord(s[-2]) + else: + raise CDefError("invalid constant %r" % (s,)) + # + if (isinstance(exprnode, pycparser.c_ast.UnaryOp) and + exprnode.op == '+'): + return self._parse_constant(exprnode.expr) + # + if (isinstance(exprnode, pycparser.c_ast.UnaryOp) and + exprnode.op == '-'): + return -self._parse_constant(exprnode.expr) + # load previously defined int constant + if (isinstance(exprnode, pycparser.c_ast.ID) and + exprnode.name in self._int_constants): + return self._int_constants[exprnode.name] + # + if (isinstance(exprnode, pycparser.c_ast.ID) and + exprnode.name == '__dotdotdotarray__'): + if partial_length_ok: + self._partial_length = True + return '...' + raise FFIError(":%d: unsupported '[...]' here, cannot derive " + "the actual array length in this context" + % exprnode.coord.line) + # + if isinstance(exprnode, pycparser.c_ast.BinaryOp): + left = self._parse_constant(exprnode.left) + right = self._parse_constant(exprnode.right) + if exprnode.op == '+': + return left + right + elif exprnode.op == '-': + return left - right + elif exprnode.op == '*': + return left * right + elif exprnode.op == '/': + return self._c_div(left, right) + elif exprnode.op == '%': + return left - self._c_div(left, right) * right + elif exprnode.op == '<<': + return left << right + elif exprnode.op == '>>': + return left >> right + elif exprnode.op == '&': + return left & right + elif exprnode.op == '|': + return left | right + elif exprnode.op == '^': + return left ^ right + # + raise FFIError(":%d: unsupported expression: expected a " + "simple numeric constant" % exprnode.coord.line) + + def _c_div(self, a, b): + result = a // b + if ((a < 0) ^ (b < 0)) and (a % b) != 0: + result += 1 + return result + + def _build_enum_type(self, explicit_name, decls): + if decls is not None: + partial = False + enumerators = [] + enumvalues = [] + nextenumvalue = 0 + for enum in decls.enumerators: + if _r_enum_dotdotdot.match(enum.name): + partial = True + continue + if enum.value is not None: + nextenumvalue = self._parse_constant(enum.value) + enumerators.append(enum.name) + enumvalues.append(nextenumvalue) + self._add_constants(enum.name, nextenumvalue) + nextenumvalue += 1 + enumerators = tuple(enumerators) + enumvalues = tuple(enumvalues) + tp = model.EnumType(explicit_name, enumerators, enumvalues) + tp.partial = partial + else: # opaque enum + tp = model.EnumType(explicit_name, (), ()) + return tp + + def include(self, other): + for name, (tp, quals) in other._declarations.items(): + if name.startswith('anonymous $enum_$'): + continue # fix for test_anonymous_enum_include + kind = name.split(' ', 1)[0] + if kind in ('struct', 'union', 'enum', 'anonymous', 'typedef'): + self._declare(name, tp, included=True, quals=quals) + for k, v in other._int_constants.items(): + self._add_constants(k, v) + + def _get_unknown_type(self, decl): + typenames = decl.type.type.names + if typenames == ['__dotdotdot__']: + return model.unknown_type(decl.name) + + if typenames == ['__dotdotdotint__']: + if self._uses_new_feature is None: + self._uses_new_feature = "'typedef int... %s'" % decl.name + return model.UnknownIntegerType(decl.name) + + if typenames == ['__dotdotdotfloat__']: + # note: not for 'long double' so far + if self._uses_new_feature is None: + self._uses_new_feature = "'typedef float... %s'" % decl.name + return model.UnknownFloatType(decl.name) + + raise FFIError(':%d: unsupported usage of "..." in typedef' + % decl.coord.line) + + def _get_unknown_ptr_type(self, decl): + if decl.type.type.type.names == ['__dotdotdot__']: + return model.unknown_ptr_type(decl.name) + raise FFIError(':%d: unsupported usage of "..." in typedef' + % decl.coord.line) diff --git a/billinglayer/python/cffi/error.py b/billinglayer/python/cffi/error.py new file mode 100644 index 0000000..0a27247 --- /dev/null +++ b/billinglayer/python/cffi/error.py @@ -0,0 +1,31 @@ + +class FFIError(Exception): + __module__ = 'cffi' + +class CDefError(Exception): + __module__ = 'cffi' + def __str__(self): + try: + current_decl = self.args[1] + filename = current_decl.coord.file + linenum = current_decl.coord.line + prefix = '%s:%d: ' % (filename, linenum) + except (AttributeError, TypeError, IndexError): + prefix = '' + return '%s%s' % (prefix, self.args[0]) + +class VerificationError(Exception): + """ An error raised when verification fails + """ + __module__ = 'cffi' + +class VerificationMissing(Exception): + """ An error raised when incomplete structures are passed into + cdef, but no verification has been done + """ + __module__ = 'cffi' + +class PkgConfigError(Exception): + """ An error raised for missing modules in pkg-config + """ + __module__ = 'cffi' diff --git a/billinglayer/python/cffi/ffiplatform.py b/billinglayer/python/cffi/ffiplatform.py new file mode 100644 index 0000000..8531346 --- /dev/null +++ b/billinglayer/python/cffi/ffiplatform.py @@ -0,0 +1,127 @@ +import sys, os +from .error import VerificationError + + +LIST_OF_FILE_NAMES = ['sources', 'include_dirs', 'library_dirs', + 'extra_objects', 'depends'] + +def get_extension(srcfilename, modname, sources=(), **kwds): + _hack_at_distutils() + from distutils.core import Extension + allsources = [srcfilename] + for src in sources: + allsources.append(os.path.normpath(src)) + return Extension(name=modname, sources=allsources, **kwds) + +def compile(tmpdir, ext, compiler_verbose=0, debug=None): + """Compile a C extension module using distutils.""" + + _hack_at_distutils() + saved_environ = os.environ.copy() + try: + outputfilename = _build(tmpdir, ext, compiler_verbose, debug) + outputfilename = os.path.abspath(outputfilename) + finally: + # workaround for a distutils bugs where some env vars can + # become longer and longer every time it is used + for key, value in saved_environ.items(): + if os.environ.get(key) != value: + os.environ[key] = value + return outputfilename + +def _build(tmpdir, ext, compiler_verbose=0, debug=None): + # XXX compact but horrible :-( + from distutils.core import Distribution + import distutils.errors, distutils.log + # + dist = Distribution({'ext_modules': [ext]}) + dist.parse_config_files() + options = dist.get_option_dict('build_ext') + if debug is None: + debug = sys.flags.debug + options['debug'] = ('ffiplatform', debug) + options['force'] = ('ffiplatform', True) + options['build_lib'] = ('ffiplatform', tmpdir) + options['build_temp'] = ('ffiplatform', tmpdir) + # + try: + old_level = distutils.log.set_threshold(0) or 0 + try: + distutils.log.set_verbosity(compiler_verbose) + dist.run_command('build_ext') + cmd_obj = dist.get_command_obj('build_ext') + [soname] = cmd_obj.get_outputs() + finally: + distutils.log.set_threshold(old_level) + except (distutils.errors.CompileError, + distutils.errors.LinkError) as e: + raise VerificationError('%s: %s' % (e.__class__.__name__, e)) + # + return soname + +try: + from os.path import samefile +except ImportError: + def samefile(f1, f2): + return os.path.abspath(f1) == os.path.abspath(f2) + +def maybe_relative_path(path): + if not os.path.isabs(path): + return path # already relative + dir = path + names = [] + while True: + prevdir = dir + dir, name = os.path.split(prevdir) + if dir == prevdir or not dir: + return path # failed to make it relative + names.append(name) + try: + if samefile(dir, os.curdir): + names.reverse() + return os.path.join(*names) + except OSError: + pass + +# ____________________________________________________________ + +try: + int_or_long = (int, long) + import cStringIO +except NameError: + int_or_long = int # Python 3 + import io as cStringIO + +def _flatten(x, f): + if isinstance(x, str): + f.write('%ds%s' % (len(x), x)) + elif isinstance(x, dict): + keys = sorted(x.keys()) + f.write('%dd' % len(keys)) + for key in keys: + _flatten(key, f) + _flatten(x[key], f) + elif isinstance(x, (list, tuple)): + f.write('%dl' % len(x)) + for value in x: + _flatten(value, f) + elif isinstance(x, int_or_long): + f.write('%di' % (x,)) + else: + raise TypeError( + "the keywords to verify() contains unsupported object %r" % (x,)) + +def flatten(x): + f = cStringIO.StringIO() + _flatten(x, f) + return f.getvalue() + +def _hack_at_distutils(): + # Windows-only workaround for some configurations: see + # https://bugs.python.org/issue23246 (Python 2.7 with + # a specific MS compiler suite download) + if sys.platform == "win32": + try: + import setuptools # for side-effects, patches distutils + except ImportError: + pass diff --git a/billinglayer/python/cffi/lock.py b/billinglayer/python/cffi/lock.py new file mode 100644 index 0000000..db91b71 --- /dev/null +++ b/billinglayer/python/cffi/lock.py @@ -0,0 +1,30 @@ +import sys + +if sys.version_info < (3,): + try: + from thread import allocate_lock + except ImportError: + from dummy_thread import allocate_lock +else: + try: + from _thread import allocate_lock + except ImportError: + from _dummy_thread import allocate_lock + + +##import sys +##l1 = allocate_lock + +##class allocate_lock(object): +## def __init__(self): +## self._real = l1() +## def __enter__(self): +## for i in range(4, 0, -1): +## print sys._getframe(i).f_code +## print +## return self._real.__enter__() +## def __exit__(self, *args): +## return self._real.__exit__(*args) +## def acquire(self, f): +## assert f is False +## return self._real.acquire(f) diff --git a/billinglayer/python/cffi/model.py b/billinglayer/python/cffi/model.py new file mode 100644 index 0000000..ad1c176 --- /dev/null +++ b/billinglayer/python/cffi/model.py @@ -0,0 +1,617 @@ +import types +import weakref + +from .lock import allocate_lock +from .error import CDefError, VerificationError, VerificationMissing + +# type qualifiers +Q_CONST = 0x01 +Q_RESTRICT = 0x02 +Q_VOLATILE = 0x04 + +def qualify(quals, replace_with): + if quals & Q_CONST: + replace_with = ' const ' + replace_with.lstrip() + if quals & Q_VOLATILE: + replace_with = ' volatile ' + replace_with.lstrip() + if quals & Q_RESTRICT: + # It seems that __restrict is supported by gcc and msvc. + # If you hit some different compiler, add a #define in + # _cffi_include.h for it (and in its copies, documented there) + replace_with = ' __restrict ' + replace_with.lstrip() + return replace_with + + +class BaseTypeByIdentity(object): + is_array_type = False + is_raw_function = False + + def get_c_name(self, replace_with='', context='a C file', quals=0): + result = self.c_name_with_marker + assert result.count('&') == 1 + # some logic duplication with ffi.getctype()... :-( + replace_with = replace_with.strip() + if replace_with: + if replace_with.startswith('*') and '&[' in result: + replace_with = '(%s)' % replace_with + elif not replace_with[0] in '[(': + replace_with = ' ' + replace_with + replace_with = qualify(quals, replace_with) + result = result.replace('&', replace_with) + if '$' in result: + raise VerificationError( + "cannot generate '%s' in %s: unknown type name" + % (self._get_c_name(), context)) + return result + + def _get_c_name(self): + return self.c_name_with_marker.replace('&', '') + + def has_c_name(self): + return '$' not in self._get_c_name() + + def is_integer_type(self): + return False + + def get_cached_btype(self, ffi, finishlist, can_delay=False): + try: + BType = ffi._cached_btypes[self] + except KeyError: + BType = self.build_backend_type(ffi, finishlist) + BType2 = ffi._cached_btypes.setdefault(self, BType) + assert BType2 is BType + return BType + + def __repr__(self): + return '<%s>' % (self._get_c_name(),) + + def _get_items(self): + return [(name, getattr(self, name)) for name in self._attrs_] + + +class BaseType(BaseTypeByIdentity): + + def __eq__(self, other): + return (self.__class__ == other.__class__ and + self._get_items() == other._get_items()) + + def __ne__(self, other): + return not self == other + + def __hash__(self): + return hash((self.__class__, tuple(self._get_items()))) + + +class VoidType(BaseType): + _attrs_ = () + + def __init__(self): + self.c_name_with_marker = 'void&' + + def build_backend_type(self, ffi, finishlist): + return global_cache(self, ffi, 'new_void_type') + +void_type = VoidType() + + +class BasePrimitiveType(BaseType): + def is_complex_type(self): + return False + + +class PrimitiveType(BasePrimitiveType): + _attrs_ = ('name',) + + ALL_PRIMITIVE_TYPES = { + 'char': 'c', + 'short': 'i', + 'int': 'i', + 'long': 'i', + 'long long': 'i', + 'signed char': 'i', + 'unsigned char': 'i', + 'unsigned short': 'i', + 'unsigned int': 'i', + 'unsigned long': 'i', + 'unsigned long long': 'i', + 'float': 'f', + 'double': 'f', + 'long double': 'f', + 'float _Complex': 'j', + 'double _Complex': 'j', + '_Bool': 'i', + # the following types are not primitive in the C sense + 'wchar_t': 'c', + 'char16_t': 'c', + 'char32_t': 'c', + 'int8_t': 'i', + 'uint8_t': 'i', + 'int16_t': 'i', + 'uint16_t': 'i', + 'int32_t': 'i', + 'uint32_t': 'i', + 'int64_t': 'i', + 'uint64_t': 'i', + 'int_least8_t': 'i', + 'uint_least8_t': 'i', + 'int_least16_t': 'i', + 'uint_least16_t': 'i', + 'int_least32_t': 'i', + 'uint_least32_t': 'i', + 'int_least64_t': 'i', + 'uint_least64_t': 'i', + 'int_fast8_t': 'i', + 'uint_fast8_t': 'i', + 'int_fast16_t': 'i', + 'uint_fast16_t': 'i', + 'int_fast32_t': 'i', + 'uint_fast32_t': 'i', + 'int_fast64_t': 'i', + 'uint_fast64_t': 'i', + 'intptr_t': 'i', + 'uintptr_t': 'i', + 'intmax_t': 'i', + 'uintmax_t': 'i', + 'ptrdiff_t': 'i', + 'size_t': 'i', + 'ssize_t': 'i', + } + + def __init__(self, name): + assert name in self.ALL_PRIMITIVE_TYPES + self.name = name + self.c_name_with_marker = name + '&' + + def is_char_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'c' + def is_integer_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'i' + def is_float_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'f' + def is_complex_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'j' + + def build_backend_type(self, ffi, finishlist): + return global_cache(self, ffi, 'new_primitive_type', self.name) + + +class UnknownIntegerType(BasePrimitiveType): + _attrs_ = ('name',) + + def __init__(self, name): + self.name = name + self.c_name_with_marker = name + '&' + + def is_integer_type(self): + return True + + def build_backend_type(self, ffi, finishlist): + raise NotImplementedError("integer type '%s' can only be used after " + "compilation" % self.name) + +class UnknownFloatType(BasePrimitiveType): + _attrs_ = ('name', ) + + def __init__(self, name): + self.name = name + self.c_name_with_marker = name + '&' + + def build_backend_type(self, ffi, finishlist): + raise NotImplementedError("float type '%s' can only be used after " + "compilation" % self.name) + + +class BaseFunctionType(BaseType): + _attrs_ = ('args', 'result', 'ellipsis', 'abi') + + def __init__(self, args, result, ellipsis, abi=None): + self.args = args + self.result = result + self.ellipsis = ellipsis + self.abi = abi + # + reprargs = [arg._get_c_name() for arg in self.args] + if self.ellipsis: + reprargs.append('...') + reprargs = reprargs or ['void'] + replace_with = self._base_pattern % (', '.join(reprargs),) + if abi is not None: + replace_with = replace_with[:1] + abi + ' ' + replace_with[1:] + self.c_name_with_marker = ( + self.result.c_name_with_marker.replace('&', replace_with)) + + +class RawFunctionType(BaseFunctionType): + # Corresponds to a C type like 'int(int)', which is the C type of + # a function, but not a pointer-to-function. The backend has no + # notion of such a type; it's used temporarily by parsing. + _base_pattern = '(&)(%s)' + is_raw_function = True + + def build_backend_type(self, ffi, finishlist): + raise CDefError("cannot render the type %r: it is a function " + "type, not a pointer-to-function type" % (self,)) + + def as_function_pointer(self): + return FunctionPtrType(self.args, self.result, self.ellipsis, self.abi) + + +class FunctionPtrType(BaseFunctionType): + _base_pattern = '(*&)(%s)' + + def build_backend_type(self, ffi, finishlist): + result = self.result.get_cached_btype(ffi, finishlist) + args = [] + for tp in self.args: + args.append(tp.get_cached_btype(ffi, finishlist)) + abi_args = () + if self.abi == "__stdcall": + if not self.ellipsis: # __stdcall ignored for variadic funcs + try: + abi_args = (ffi._backend.FFI_STDCALL,) + except AttributeError: + pass + return global_cache(self, ffi, 'new_function_type', + tuple(args), result, self.ellipsis, *abi_args) + + def as_raw_function(self): + return RawFunctionType(self.args, self.result, self.ellipsis, self.abi) + + +class PointerType(BaseType): + _attrs_ = ('totype', 'quals') + + def __init__(self, totype, quals=0): + self.totype = totype + self.quals = quals + extra = qualify(quals, " *&") + if totype.is_array_type: + extra = "(%s)" % (extra.lstrip(),) + self.c_name_with_marker = totype.c_name_with_marker.replace('&', extra) + + def build_backend_type(self, ffi, finishlist): + BItem = self.totype.get_cached_btype(ffi, finishlist, can_delay=True) + return global_cache(self, ffi, 'new_pointer_type', BItem) + +voidp_type = PointerType(void_type) + +def ConstPointerType(totype): + return PointerType(totype, Q_CONST) + +const_voidp_type = ConstPointerType(void_type) + + +class NamedPointerType(PointerType): + _attrs_ = ('totype', 'name') + + def __init__(self, totype, name, quals=0): + PointerType.__init__(self, totype, quals) + self.name = name + self.c_name_with_marker = name + '&' + + +class ArrayType(BaseType): + _attrs_ = ('item', 'length') + is_array_type = True + + def __init__(self, item, length): + self.item = item + self.length = length + # + if length is None: + brackets = '&[]' + elif length == '...': + brackets = '&[/*...*/]' + else: + brackets = '&[%s]' % length + self.c_name_with_marker = ( + self.item.c_name_with_marker.replace('&', brackets)) + + def length_is_unknown(self): + return isinstance(self.length, str) + + def resolve_length(self, newlength): + return ArrayType(self.item, newlength) + + def build_backend_type(self, ffi, finishlist): + if self.length_is_unknown(): + raise CDefError("cannot render the type %r: unknown length" % + (self,)) + self.item.get_cached_btype(ffi, finishlist) # force the item BType + BPtrItem = PointerType(self.item).get_cached_btype(ffi, finishlist) + return global_cache(self, ffi, 'new_array_type', BPtrItem, self.length) + +char_array_type = ArrayType(PrimitiveType('char'), None) + + +class StructOrUnionOrEnum(BaseTypeByIdentity): + _attrs_ = ('name',) + forcename = None + + def build_c_name_with_marker(self): + name = self.forcename or '%s %s' % (self.kind, self.name) + self.c_name_with_marker = name + '&' + + def force_the_name(self, forcename): + self.forcename = forcename + self.build_c_name_with_marker() + + def get_official_name(self): + assert self.c_name_with_marker.endswith('&') + return self.c_name_with_marker[:-1] + + +class StructOrUnion(StructOrUnionOrEnum): + fixedlayout = None + completed = 0 + partial = False + packed = 0 + + def __init__(self, name, fldnames, fldtypes, fldbitsize, fldquals=None): + self.name = name + self.fldnames = fldnames + self.fldtypes = fldtypes + self.fldbitsize = fldbitsize + self.fldquals = fldquals + self.build_c_name_with_marker() + + def anonymous_struct_fields(self): + if self.fldtypes is not None: + for name, type in zip(self.fldnames, self.fldtypes): + if name == '' and isinstance(type, StructOrUnion): + yield type + + def enumfields(self, expand_anonymous_struct_union=True): + fldquals = self.fldquals + if fldquals is None: + fldquals = (0,) * len(self.fldnames) + for name, type, bitsize, quals in zip(self.fldnames, self.fldtypes, + self.fldbitsize, fldquals): + if (name == '' and isinstance(type, StructOrUnion) + and expand_anonymous_struct_union): + # nested anonymous struct/union + for result in type.enumfields(): + yield result + else: + yield (name, type, bitsize, quals) + + def force_flatten(self): + # force the struct or union to have a declaration that lists + # directly all fields returned by enumfields(), flattening + # nested anonymous structs/unions. + names = [] + types = [] + bitsizes = [] + fldquals = [] + for name, type, bitsize, quals in self.enumfields(): + names.append(name) + types.append(type) + bitsizes.append(bitsize) + fldquals.append(quals) + self.fldnames = tuple(names) + self.fldtypes = tuple(types) + self.fldbitsize = tuple(bitsizes) + self.fldquals = tuple(fldquals) + + def get_cached_btype(self, ffi, finishlist, can_delay=False): + BType = StructOrUnionOrEnum.get_cached_btype(self, ffi, finishlist, + can_delay) + if not can_delay: + self.finish_backend_type(ffi, finishlist) + return BType + + def finish_backend_type(self, ffi, finishlist): + if self.completed: + if self.completed != 2: + raise NotImplementedError("recursive structure declaration " + "for '%s'" % (self.name,)) + return + BType = ffi._cached_btypes[self] + # + self.completed = 1 + # + if self.fldtypes is None: + pass # not completing it: it's an opaque struct + # + elif self.fixedlayout is None: + fldtypes = [tp.get_cached_btype(ffi, finishlist) + for tp in self.fldtypes] + lst = list(zip(self.fldnames, fldtypes, self.fldbitsize)) + extra_flags = () + if self.packed: + if self.packed == 1: + extra_flags = (8,) # SF_PACKED + else: + extra_flags = (0, self.packed) + ffi._backend.complete_struct_or_union(BType, lst, self, + -1, -1, *extra_flags) + # + else: + fldtypes = [] + fieldofs, fieldsize, totalsize, totalalignment = self.fixedlayout + for i in range(len(self.fldnames)): + fsize = fieldsize[i] + ftype = self.fldtypes[i] + # + if isinstance(ftype, ArrayType) and ftype.length_is_unknown(): + # fix the length to match the total size + BItemType = ftype.item.get_cached_btype(ffi, finishlist) + nlen, nrest = divmod(fsize, ffi.sizeof(BItemType)) + if nrest != 0: + self._verification_error( + "field '%s.%s' has a bogus size?" % ( + self.name, self.fldnames[i] or '{}')) + ftype = ftype.resolve_length(nlen) + self.fldtypes = (self.fldtypes[:i] + (ftype,) + + self.fldtypes[i+1:]) + # + BFieldType = ftype.get_cached_btype(ffi, finishlist) + if isinstance(ftype, ArrayType) and ftype.length is None: + assert fsize == 0 + else: + bitemsize = ffi.sizeof(BFieldType) + if bitemsize != fsize: + self._verification_error( + "field '%s.%s' is declared as %d bytes, but is " + "really %d bytes" % (self.name, + self.fldnames[i] or '{}', + bitemsize, fsize)) + fldtypes.append(BFieldType) + # + lst = list(zip(self.fldnames, fldtypes, self.fldbitsize, fieldofs)) + ffi._backend.complete_struct_or_union(BType, lst, self, + totalsize, totalalignment) + self.completed = 2 + + def _verification_error(self, msg): + raise VerificationError(msg) + + def check_not_partial(self): + if self.partial and self.fixedlayout is None: + raise VerificationMissing(self._get_c_name()) + + def build_backend_type(self, ffi, finishlist): + self.check_not_partial() + finishlist.append(self) + # + return global_cache(self, ffi, 'new_%s_type' % self.kind, + self.get_official_name(), key=self) + + +class StructType(StructOrUnion): + kind = 'struct' + + +class UnionType(StructOrUnion): + kind = 'union' + + +class EnumType(StructOrUnionOrEnum): + kind = 'enum' + partial = False + partial_resolved = False + + def __init__(self, name, enumerators, enumvalues, baseinttype=None): + self.name = name + self.enumerators = enumerators + self.enumvalues = enumvalues + self.baseinttype = baseinttype + self.build_c_name_with_marker() + + def force_the_name(self, forcename): + StructOrUnionOrEnum.force_the_name(self, forcename) + if self.forcename is None: + name = self.get_official_name() + self.forcename = '$' + name.replace(' ', '_') + + def check_not_partial(self): + if self.partial and not self.partial_resolved: + raise VerificationMissing(self._get_c_name()) + + def build_backend_type(self, ffi, finishlist): + self.check_not_partial() + base_btype = self.build_baseinttype(ffi, finishlist) + return global_cache(self, ffi, 'new_enum_type', + self.get_official_name(), + self.enumerators, self.enumvalues, + base_btype, key=self) + + def build_baseinttype(self, ffi, finishlist): + if self.baseinttype is not None: + return self.baseinttype.get_cached_btype(ffi, finishlist) + # + if self.enumvalues: + smallest_value = min(self.enumvalues) + largest_value = max(self.enumvalues) + else: + import warnings + try: + # XXX! The goal is to ensure that the warnings.warn() + # will not suppress the warning. We want to get it + # several times if we reach this point several times. + __warningregistry__.clear() + except NameError: + pass + warnings.warn("%r has no values explicitly defined; " + "guessing that it is equivalent to 'unsigned int'" + % self._get_c_name()) + smallest_value = largest_value = 0 + if smallest_value < 0: # needs a signed type + sign = 1 + candidate1 = PrimitiveType("int") + candidate2 = PrimitiveType("long") + else: + sign = 0 + candidate1 = PrimitiveType("unsigned int") + candidate2 = PrimitiveType("unsigned long") + btype1 = candidate1.get_cached_btype(ffi, finishlist) + btype2 = candidate2.get_cached_btype(ffi, finishlist) + size1 = ffi.sizeof(btype1) + size2 = ffi.sizeof(btype2) + if (smallest_value >= ((-1) << (8*size1-1)) and + largest_value < (1 << (8*size1-sign))): + return btype1 + if (smallest_value >= ((-1) << (8*size2-1)) and + largest_value < (1 << (8*size2-sign))): + return btype2 + raise CDefError("%s values don't all fit into either 'long' " + "or 'unsigned long'" % self._get_c_name()) + +def unknown_type(name, structname=None): + if structname is None: + structname = '$%s' % name + tp = StructType(structname, None, None, None) + tp.force_the_name(name) + tp.origin = "unknown_type" + return tp + +def unknown_ptr_type(name, structname=None): + if structname is None: + structname = '$$%s' % name + tp = StructType(structname, None, None, None) + return NamedPointerType(tp, name) + + +global_lock = allocate_lock() +_typecache_cffi_backend = weakref.WeakValueDictionary() + +def get_typecache(backend): + # returns _typecache_cffi_backend if backend is the _cffi_backend + # module, or type(backend).__typecache if backend is an instance of + # CTypesBackend (or some FakeBackend class during tests) + if isinstance(backend, types.ModuleType): + return _typecache_cffi_backend + with global_lock: + if not hasattr(type(backend), '__typecache'): + type(backend).__typecache = weakref.WeakValueDictionary() + return type(backend).__typecache + +def global_cache(srctype, ffi, funcname, *args, **kwds): + key = kwds.pop('key', (funcname, args)) + assert not kwds + try: + return ffi._typecache[key] + except KeyError: + pass + try: + res = getattr(ffi._backend, funcname)(*args) + except NotImplementedError as e: + raise NotImplementedError("%s: %r: %s" % (funcname, srctype, e)) + # note that setdefault() on WeakValueDictionary is not atomic + # and contains a rare bug (http://bugs.python.org/issue19542); + # we have to use a lock and do it ourselves + cache = ffi._typecache + with global_lock: + res1 = cache.get(key) + if res1 is None: + cache[key] = res + return res + else: + return res1 + +def pointer_cache(ffi, BType): + return global_cache('?', ffi, 'new_pointer_type', BType) + +def attach_exception_info(e, name): + if e.args and type(e.args[0]) is str: + e.args = ('%s: %s' % (name, e.args[0]),) + e.args[1:] diff --git a/billinglayer/python/cffi/parse_c_type.h b/billinglayer/python/cffi/parse_c_type.h new file mode 100644 index 0000000..84e4ef8 --- /dev/null +++ b/billinglayer/python/cffi/parse_c_type.h @@ -0,0 +1,181 @@ + +/* This part is from file 'cffi/parse_c_type.h'. It is copied at the + beginning of C sources generated by CFFI's ffi.set_source(). */ + +typedef void *_cffi_opcode_t; + +#define _CFFI_OP(opcode, arg) (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8)) +#define _CFFI_GETOP(cffi_opcode) ((unsigned char)(uintptr_t)cffi_opcode) +#define _CFFI_GETARG(cffi_opcode) (((intptr_t)cffi_opcode) >> 8) + +#define _CFFI_OP_PRIMITIVE 1 +#define _CFFI_OP_POINTER 3 +#define _CFFI_OP_ARRAY 5 +#define _CFFI_OP_OPEN_ARRAY 7 +#define _CFFI_OP_STRUCT_UNION 9 +#define _CFFI_OP_ENUM 11 +#define _CFFI_OP_FUNCTION 13 +#define _CFFI_OP_FUNCTION_END 15 +#define _CFFI_OP_NOOP 17 +#define _CFFI_OP_BITFIELD 19 +#define _CFFI_OP_TYPENAME 21 +#define _CFFI_OP_CPYTHON_BLTN_V 23 // varargs +#define _CFFI_OP_CPYTHON_BLTN_N 25 // noargs +#define _CFFI_OP_CPYTHON_BLTN_O 27 // O (i.e. a single arg) +#define _CFFI_OP_CONSTANT 29 +#define _CFFI_OP_CONSTANT_INT 31 +#define _CFFI_OP_GLOBAL_VAR 33 +#define _CFFI_OP_DLOPEN_FUNC 35 +#define _CFFI_OP_DLOPEN_CONST 37 +#define _CFFI_OP_GLOBAL_VAR_F 39 +#define _CFFI_OP_EXTERN_PYTHON 41 + +#define _CFFI_PRIM_VOID 0 +#define _CFFI_PRIM_BOOL 1 +#define _CFFI_PRIM_CHAR 2 +#define _CFFI_PRIM_SCHAR 3 +#define _CFFI_PRIM_UCHAR 4 +#define _CFFI_PRIM_SHORT 5 +#define _CFFI_PRIM_USHORT 6 +#define _CFFI_PRIM_INT 7 +#define _CFFI_PRIM_UINT 8 +#define _CFFI_PRIM_LONG 9 +#define _CFFI_PRIM_ULONG 10 +#define _CFFI_PRIM_LONGLONG 11 +#define _CFFI_PRIM_ULONGLONG 12 +#define _CFFI_PRIM_FLOAT 13 +#define _CFFI_PRIM_DOUBLE 14 +#define _CFFI_PRIM_LONGDOUBLE 15 + +#define _CFFI_PRIM_WCHAR 16 +#define _CFFI_PRIM_INT8 17 +#define _CFFI_PRIM_UINT8 18 +#define _CFFI_PRIM_INT16 19 +#define _CFFI_PRIM_UINT16 20 +#define _CFFI_PRIM_INT32 21 +#define _CFFI_PRIM_UINT32 22 +#define _CFFI_PRIM_INT64 23 +#define _CFFI_PRIM_UINT64 24 +#define _CFFI_PRIM_INTPTR 25 +#define _CFFI_PRIM_UINTPTR 26 +#define _CFFI_PRIM_PTRDIFF 27 +#define _CFFI_PRIM_SIZE 28 +#define _CFFI_PRIM_SSIZE 29 +#define _CFFI_PRIM_INT_LEAST8 30 +#define _CFFI_PRIM_UINT_LEAST8 31 +#define _CFFI_PRIM_INT_LEAST16 32 +#define _CFFI_PRIM_UINT_LEAST16 33 +#define _CFFI_PRIM_INT_LEAST32 34 +#define _CFFI_PRIM_UINT_LEAST32 35 +#define _CFFI_PRIM_INT_LEAST64 36 +#define _CFFI_PRIM_UINT_LEAST64 37 +#define _CFFI_PRIM_INT_FAST8 38 +#define _CFFI_PRIM_UINT_FAST8 39 +#define _CFFI_PRIM_INT_FAST16 40 +#define _CFFI_PRIM_UINT_FAST16 41 +#define _CFFI_PRIM_INT_FAST32 42 +#define _CFFI_PRIM_UINT_FAST32 43 +#define _CFFI_PRIM_INT_FAST64 44 +#define _CFFI_PRIM_UINT_FAST64 45 +#define _CFFI_PRIM_INTMAX 46 +#define _CFFI_PRIM_UINTMAX 47 +#define _CFFI_PRIM_FLOATCOMPLEX 48 +#define _CFFI_PRIM_DOUBLECOMPLEX 49 +#define _CFFI_PRIM_CHAR16 50 +#define _CFFI_PRIM_CHAR32 51 + +#define _CFFI__NUM_PRIM 52 +#define _CFFI__UNKNOWN_PRIM (-1) +#define _CFFI__UNKNOWN_FLOAT_PRIM (-2) +#define _CFFI__UNKNOWN_LONG_DOUBLE (-3) + +#define _CFFI__IO_FILE_STRUCT (-1) + + +struct _cffi_global_s { + const char *name; + void *address; + _cffi_opcode_t type_op; + void *size_or_direct_fn; // OP_GLOBAL_VAR: size, or 0 if unknown + // OP_CPYTHON_BLTN_*: addr of direct function +}; + +struct _cffi_getconst_s { + unsigned long long value; + const struct _cffi_type_context_s *ctx; + int gindex; +}; + +struct _cffi_struct_union_s { + const char *name; + int type_index; // -> _cffi_types, on a OP_STRUCT_UNION + int flags; // _CFFI_F_* flags below + size_t size; + int alignment; + int first_field_index; // -> _cffi_fields array + int num_fields; +}; +#define _CFFI_F_UNION 0x01 // is a union, not a struct +#define _CFFI_F_CHECK_FIELDS 0x02 // complain if fields are not in the + // "standard layout" or if some are missing +#define _CFFI_F_PACKED 0x04 // for CHECK_FIELDS, assume a packed struct +#define _CFFI_F_EXTERNAL 0x08 // in some other ffi.include() +#define _CFFI_F_OPAQUE 0x10 // opaque + +struct _cffi_field_s { + const char *name; + size_t field_offset; + size_t field_size; + _cffi_opcode_t field_type_op; +}; + +struct _cffi_enum_s { + const char *name; + int type_index; // -> _cffi_types, on a OP_ENUM + int type_prim; // _CFFI_PRIM_xxx + const char *enumerators; // comma-delimited string +}; + +struct _cffi_typename_s { + const char *name; + int type_index; /* if opaque, points to a possibly artificial + OP_STRUCT which is itself opaque */ +}; + +struct _cffi_type_context_s { + _cffi_opcode_t *types; + const struct _cffi_global_s *globals; + const struct _cffi_field_s *fields; + const struct _cffi_struct_union_s *struct_unions; + const struct _cffi_enum_s *enums; + const struct _cffi_typename_s *typenames; + int num_globals; + int num_struct_unions; + int num_enums; + int num_typenames; + const char *const *includes; + int num_types; + int flags; /* future extension */ +}; + +struct _cffi_parse_info_s { + const struct _cffi_type_context_s *ctx; + _cffi_opcode_t *output; + unsigned int output_size; + size_t error_location; + const char *error_message; +}; + +struct _cffi_externpy_s { + const char *name; + size_t size_of_result; + void *reserved1, *reserved2; +}; + +#ifdef _CFFI_INTERNAL +static int parse_c_type(struct _cffi_parse_info_s *info, const char *input); +static int search_in_globals(const struct _cffi_type_context_s *ctx, + const char *search, size_t search_len); +static int search_in_struct_unions(const struct _cffi_type_context_s *ctx, + const char *search, size_t search_len); +#endif diff --git a/billinglayer/python/cffi/pkgconfig.py b/billinglayer/python/cffi/pkgconfig.py new file mode 100644 index 0000000..5c93f15 --- /dev/null +++ b/billinglayer/python/cffi/pkgconfig.py @@ -0,0 +1,121 @@ +# pkg-config, https://www.freedesktop.org/wiki/Software/pkg-config/ integration for cffi +import sys, os, subprocess + +from .error import PkgConfigError + + +def merge_flags(cfg1, cfg2): + """Merge values from cffi config flags cfg2 to cf1 + + Example: + merge_flags({"libraries": ["one"]}, {"libraries": ["two"]}) + {"libraries": ["one", "two"]} + """ + for key, value in cfg2.items(): + if key not in cfg1: + cfg1[key] = value + else: + if not isinstance(cfg1[key], list): + raise TypeError("cfg1[%r] should be a list of strings" % (key,)) + if not isinstance(value, list): + raise TypeError("cfg2[%r] should be a list of strings" % (key,)) + cfg1[key].extend(value) + return cfg1 + + +def call(libname, flag, encoding=sys.getfilesystemencoding()): + """Calls pkg-config and returns the output if found + """ + a = ["pkg-config", "--print-errors"] + a.append(flag) + a.append(libname) + try: + pc = subprocess.Popen(a, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except EnvironmentError as e: + raise PkgConfigError("cannot run pkg-config: %s" % (str(e).strip(),)) + + bout, berr = pc.communicate() + if pc.returncode != 0: + try: + berr = berr.decode(encoding) + except Exception: + pass + raise PkgConfigError(berr.strip()) + + if sys.version_info >= (3,) and not isinstance(bout, str): # Python 3.x + try: + bout = bout.decode(encoding) + except UnicodeDecodeError: + raise PkgConfigError("pkg-config %s %s returned bytes that cannot " + "be decoded with encoding %r:\n%r" % + (flag, libname, encoding, bout)) + + if os.altsep != '\\' and '\\' in bout: + raise PkgConfigError("pkg-config %s %s returned an unsupported " + "backslash-escaped output:\n%r" % + (flag, libname, bout)) + return bout + + +def flags_from_pkgconfig(libs): + r"""Return compiler line flags for FFI.set_source based on pkg-config output + + Usage + ... + ffibuilder.set_source("_foo", pkgconfig = ["libfoo", "libbar >= 1.8.3"]) + + If pkg-config is installed on build machine, then arguments include_dirs, + library_dirs, libraries, define_macros, extra_compile_args and + extra_link_args are extended with an output of pkg-config for libfoo and + libbar. + + Raises PkgConfigError in case the pkg-config call fails. + """ + + def get_include_dirs(string): + return [x[2:] for x in string.split() if x.startswith("-I")] + + def get_library_dirs(string): + return [x[2:] for x in string.split() if x.startswith("-L")] + + def get_libraries(string): + return [x[2:] for x in string.split() if x.startswith("-l")] + + # convert -Dfoo=bar to list of tuples [("foo", "bar")] expected by distutils + def get_macros(string): + def _macro(x): + x = x[2:] # drop "-D" + if '=' in x: + return tuple(x.split("=", 1)) # "-Dfoo=bar" => ("foo", "bar") + else: + return (x, None) # "-Dfoo" => ("foo", None) + return [_macro(x) for x in string.split() if x.startswith("-D")] + + def get_other_cflags(string): + return [x for x in string.split() if not x.startswith("-I") and + not x.startswith("-D")] + + def get_other_libs(string): + return [x for x in string.split() if not x.startswith("-L") and + not x.startswith("-l")] + + # return kwargs for given libname + def kwargs(libname): + fse = sys.getfilesystemencoding() + all_cflags = call(libname, "--cflags") + all_libs = call(libname, "--libs") + return { + "include_dirs": get_include_dirs(all_cflags), + "library_dirs": get_library_dirs(all_libs), + "libraries": get_libraries(all_libs), + "define_macros": get_macros(all_cflags), + "extra_compile_args": get_other_cflags(all_cflags), + "extra_link_args": get_other_libs(all_libs), + } + + # merge all arguments together + ret = {} + for libname in libs: + lib_flags = kwargs(libname) + merge_flags(ret, lib_flags) + return ret diff --git a/billinglayer/python/cffi/recompiler.py b/billinglayer/python/cffi/recompiler.py new file mode 100644 index 0000000..5d9d32d --- /dev/null +++ b/billinglayer/python/cffi/recompiler.py @@ -0,0 +1,1581 @@ +import os, sys, io +from . import ffiplatform, model +from .error import VerificationError +from .cffi_opcode import * + +VERSION_BASE = 0x2601 +VERSION_EMBEDDED = 0x2701 +VERSION_CHAR16CHAR32 = 0x2801 + +USE_LIMITED_API = (sys.platform != 'win32' or sys.version_info < (3, 0) or + sys.version_info >= (3, 5)) + + +class GlobalExpr: + def __init__(self, name, address, type_op, size=0, check_value=0): + self.name = name + self.address = address + self.type_op = type_op + self.size = size + self.check_value = check_value + + def as_c_expr(self): + return ' { "%s", (void *)%s, %s, (void *)%s },' % ( + self.name, self.address, self.type_op.as_c_expr(), self.size) + + def as_python_expr(self): + return "b'%s%s',%d" % (self.type_op.as_python_bytes(), self.name, + self.check_value) + +class FieldExpr: + def __init__(self, name, field_offset, field_size, fbitsize, field_type_op): + self.name = name + self.field_offset = field_offset + self.field_size = field_size + self.fbitsize = fbitsize + self.field_type_op = field_type_op + + def as_c_expr(self): + spaces = " " * len(self.name) + return (' { "%s", %s,\n' % (self.name, self.field_offset) + + ' %s %s,\n' % (spaces, self.field_size) + + ' %s %s },' % (spaces, self.field_type_op.as_c_expr())) + + def as_python_expr(self): + raise NotImplementedError + + def as_field_python_expr(self): + if self.field_type_op.op == OP_NOOP: + size_expr = '' + elif self.field_type_op.op == OP_BITFIELD: + size_expr = format_four_bytes(self.fbitsize) + else: + raise NotImplementedError + return "b'%s%s%s'" % (self.field_type_op.as_python_bytes(), + size_expr, + self.name) + +class StructUnionExpr: + def __init__(self, name, type_index, flags, size, alignment, comment, + first_field_index, c_fields): + self.name = name + self.type_index = type_index + self.flags = flags + self.size = size + self.alignment = alignment + self.comment = comment + self.first_field_index = first_field_index + self.c_fields = c_fields + + def as_c_expr(self): + return (' { "%s", %d, %s,' % (self.name, self.type_index, self.flags) + + '\n %s, %s, ' % (self.size, self.alignment) + + '%d, %d ' % (self.first_field_index, len(self.c_fields)) + + ('/* %s */ ' % self.comment if self.comment else '') + + '},') + + def as_python_expr(self): + flags = eval(self.flags, G_FLAGS) + fields_expr = [c_field.as_field_python_expr() + for c_field in self.c_fields] + return "(b'%s%s%s',%s)" % ( + format_four_bytes(self.type_index), + format_four_bytes(flags), + self.name, + ','.join(fields_expr)) + +class EnumExpr: + def __init__(self, name, type_index, size, signed, allenums): + self.name = name + self.type_index = type_index + self.size = size + self.signed = signed + self.allenums = allenums + + def as_c_expr(self): + return (' { "%s", %d, _cffi_prim_int(%s, %s),\n' + ' "%s" },' % (self.name, self.type_index, + self.size, self.signed, self.allenums)) + + def as_python_expr(self): + prim_index = { + (1, 0): PRIM_UINT8, (1, 1): PRIM_INT8, + (2, 0): PRIM_UINT16, (2, 1): PRIM_INT16, + (4, 0): PRIM_UINT32, (4, 1): PRIM_INT32, + (8, 0): PRIM_UINT64, (8, 1): PRIM_INT64, + }[self.size, self.signed] + return "b'%s%s%s\\x00%s'" % (format_four_bytes(self.type_index), + format_four_bytes(prim_index), + self.name, self.allenums) + +class TypenameExpr: + def __init__(self, name, type_index): + self.name = name + self.type_index = type_index + + def as_c_expr(self): + return ' { "%s", %d },' % (self.name, self.type_index) + + def as_python_expr(self): + return "b'%s%s'" % (format_four_bytes(self.type_index), self.name) + + +# ____________________________________________________________ + + +class Recompiler: + _num_externpy = 0 + + def __init__(self, ffi, module_name, target_is_python=False): + self.ffi = ffi + self.module_name = module_name + self.target_is_python = target_is_python + self._version = VERSION_BASE + + def needs_version(self, ver): + self._version = max(self._version, ver) + + def collect_type_table(self): + self._typesdict = {} + self._generate("collecttype") + # + all_decls = sorted(self._typesdict, key=str) + # + # prepare all FUNCTION bytecode sequences first + self.cffi_types = [] + for tp in all_decls: + if tp.is_raw_function: + assert self._typesdict[tp] is None + self._typesdict[tp] = len(self.cffi_types) + self.cffi_types.append(tp) # placeholder + for tp1 in tp.args: + assert isinstance(tp1, (model.VoidType, + model.BasePrimitiveType, + model.PointerType, + model.StructOrUnionOrEnum, + model.FunctionPtrType)) + if self._typesdict[tp1] is None: + self._typesdict[tp1] = len(self.cffi_types) + self.cffi_types.append(tp1) # placeholder + self.cffi_types.append('END') # placeholder + # + # prepare all OTHER bytecode sequences + for tp in all_decls: + if not tp.is_raw_function and self._typesdict[tp] is None: + self._typesdict[tp] = len(self.cffi_types) + self.cffi_types.append(tp) # placeholder + if tp.is_array_type and tp.length is not None: + self.cffi_types.append('LEN') # placeholder + assert None not in self._typesdict.values() + # + # collect all structs and unions and enums + self._struct_unions = {} + self._enums = {} + for tp in all_decls: + if isinstance(tp, model.StructOrUnion): + self._struct_unions[tp] = None + elif isinstance(tp, model.EnumType): + self._enums[tp] = None + for i, tp in enumerate(sorted(self._struct_unions, + key=lambda tp: tp.name)): + self._struct_unions[tp] = i + for i, tp in enumerate(sorted(self._enums, + key=lambda tp: tp.name)): + self._enums[tp] = i + # + # emit all bytecode sequences now + for tp in all_decls: + method = getattr(self, '_emit_bytecode_' + tp.__class__.__name__) + method(tp, self._typesdict[tp]) + # + # consistency check + for op in self.cffi_types: + assert isinstance(op, CffiOp) + self.cffi_types = tuple(self.cffi_types) # don't change any more + + def _enum_fields(self, tp): + # When producing C, expand all anonymous struct/union fields. + # That's necessary to have C code checking the offsets of the + # individual fields contained in them. When producing Python, + # don't do it and instead write it like it is, with the + # corresponding fields having an empty name. Empty names are + # recognized at runtime when we import the generated Python + # file. + expand_anonymous_struct_union = not self.target_is_python + return tp.enumfields(expand_anonymous_struct_union) + + def _do_collect_type(self, tp): + if not isinstance(tp, model.BaseTypeByIdentity): + if isinstance(tp, tuple): + for x in tp: + self._do_collect_type(x) + return + if tp not in self._typesdict: + self._typesdict[tp] = None + if isinstance(tp, model.FunctionPtrType): + self._do_collect_type(tp.as_raw_function()) + elif isinstance(tp, model.StructOrUnion): + if tp.fldtypes is not None and ( + tp not in self.ffi._parser._included_declarations): + for name1, tp1, _, _ in self._enum_fields(tp): + self._do_collect_type(self._field_type(tp, name1, tp1)) + else: + for _, x in tp._get_items(): + self._do_collect_type(x) + + def _generate(self, step_name): + lst = self.ffi._parser._declarations.items() + for name, (tp, quals) in sorted(lst): + kind, realname = name.split(' ', 1) + try: + method = getattr(self, '_generate_cpy_%s_%s' % (kind, + step_name)) + except AttributeError: + raise VerificationError( + "not implemented in recompile(): %r" % name) + try: + self._current_quals = quals + method(tp, realname) + except Exception as e: + model.attach_exception_info(e, name) + raise + + # ---------- + + ALL_STEPS = ["global", "field", "struct_union", "enum", "typename"] + + def collect_step_tables(self): + # collect the declarations for '_cffi_globals', '_cffi_typenames', etc. + self._lsts = {} + for step_name in self.ALL_STEPS: + self._lsts[step_name] = [] + self._seen_struct_unions = set() + self._generate("ctx") + self._add_missing_struct_unions() + # + for step_name in self.ALL_STEPS: + lst = self._lsts[step_name] + if step_name != "field": + lst.sort(key=lambda entry: entry.name) + self._lsts[step_name] = tuple(lst) # don't change any more + # + # check for a possible internal inconsistency: _cffi_struct_unions + # should have been generated with exactly self._struct_unions + lst = self._lsts["struct_union"] + for tp, i in self._struct_unions.items(): + assert i < len(lst) + assert lst[i].name == tp.name + assert len(lst) == len(self._struct_unions) + # same with enums + lst = self._lsts["enum"] + for tp, i in self._enums.items(): + assert i < len(lst) + assert lst[i].name == tp.name + assert len(lst) == len(self._enums) + + # ---------- + + def _prnt(self, what=''): + self._f.write(what + '\n') + + def write_source_to_f(self, f, preamble): + if self.target_is_python: + assert preamble is None + self.write_py_source_to_f(f) + else: + assert preamble is not None + self.write_c_source_to_f(f, preamble) + + def _rel_readlines(self, filename): + g = open(os.path.join(os.path.dirname(__file__), filename), 'r') + lines = g.readlines() + g.close() + return lines + + def write_c_source_to_f(self, f, preamble): + self._f = f + prnt = self._prnt + if self.ffi._embedding is not None: + prnt('#define _CFFI_USE_EMBEDDING') + if not USE_LIMITED_API: + prnt('#define _CFFI_NO_LIMITED_API') + # + # first the '#include' (actually done by inlining the file's content) + lines = self._rel_readlines('_cffi_include.h') + i = lines.index('#include "parse_c_type.h"\n') + lines[i:i+1] = self._rel_readlines('parse_c_type.h') + prnt(''.join(lines)) + # + # if we have ffi._embedding != None, we give it here as a macro + # and include an extra file + base_module_name = self.module_name.split('.')[-1] + if self.ffi._embedding is not None: + prnt('#define _CFFI_MODULE_NAME "%s"' % (self.module_name,)) + prnt('static const char _CFFI_PYTHON_STARTUP_CODE[] = {') + self._print_string_literal_in_array(self.ffi._embedding) + prnt('0 };') + prnt('#ifdef PYPY_VERSION') + prnt('# define _CFFI_PYTHON_STARTUP_FUNC _cffi_pypyinit_%s' % ( + base_module_name,)) + prnt('#elif PY_MAJOR_VERSION >= 3') + prnt('# define _CFFI_PYTHON_STARTUP_FUNC PyInit_%s' % ( + base_module_name,)) + prnt('#else') + prnt('# define _CFFI_PYTHON_STARTUP_FUNC init%s' % ( + base_module_name,)) + prnt('#endif') + lines = self._rel_readlines('_embedding.h') + i = lines.index('#include "_cffi_errors.h"\n') + lines[i:i+1] = self._rel_readlines('_cffi_errors.h') + prnt(''.join(lines)) + self.needs_version(VERSION_EMBEDDED) + # + # then paste the C source given by the user, verbatim. + prnt('/************************************************************/') + prnt() + prnt(preamble) + prnt() + prnt('/************************************************************/') + prnt() + # + # the declaration of '_cffi_types' + prnt('static void *_cffi_types[] = {') + typeindex2type = dict([(i, tp) for (tp, i) in self._typesdict.items()]) + for i, op in enumerate(self.cffi_types): + comment = '' + if i in typeindex2type: + comment = ' // ' + typeindex2type[i]._get_c_name() + prnt('/* %2d */ %s,%s' % (i, op.as_c_expr(), comment)) + if not self.cffi_types: + prnt(' 0') + prnt('};') + prnt() + # + # call generate_cpy_xxx_decl(), for every xxx found from + # ffi._parser._declarations. This generates all the functions. + self._seen_constants = set() + self._generate("decl") + # + # the declaration of '_cffi_globals' and '_cffi_typenames' + nums = {} + for step_name in self.ALL_STEPS: + lst = self._lsts[step_name] + nums[step_name] = len(lst) + if nums[step_name] > 0: + prnt('static const struct _cffi_%s_s _cffi_%ss[] = {' % ( + step_name, step_name)) + for entry in lst: + prnt(entry.as_c_expr()) + prnt('};') + prnt() + # + # the declaration of '_cffi_includes' + if self.ffi._included_ffis: + prnt('static const char * const _cffi_includes[] = {') + for ffi_to_include in self.ffi._included_ffis: + try: + included_module_name, included_source = ( + ffi_to_include._assigned_source[:2]) + except AttributeError: + raise VerificationError( + "ffi object %r includes %r, but the latter has not " + "been prepared with set_source()" % ( + self.ffi, ffi_to_include,)) + if included_source is None: + raise VerificationError( + "not implemented yet: ffi.include() of a Python-based " + "ffi inside a C-based ffi") + prnt(' "%s",' % (included_module_name,)) + prnt(' NULL') + prnt('};') + prnt() + # + # the declaration of '_cffi_type_context' + prnt('static const struct _cffi_type_context_s _cffi_type_context = {') + prnt(' _cffi_types,') + for step_name in self.ALL_STEPS: + if nums[step_name] > 0: + prnt(' _cffi_%ss,' % step_name) + else: + prnt(' NULL, /* no %ss */' % step_name) + for step_name in self.ALL_STEPS: + if step_name != "field": + prnt(' %d, /* num_%ss */' % (nums[step_name], step_name)) + if self.ffi._included_ffis: + prnt(' _cffi_includes,') + else: + prnt(' NULL, /* no includes */') + prnt(' %d, /* num_types */' % (len(self.cffi_types),)) + flags = 0 + if self._num_externpy > 0 or self.ffi._embedding is not None: + flags |= 1 # set to mean that we use extern "Python" + prnt(' %d, /* flags */' % flags) + prnt('};') + prnt() + # + # the init function + prnt('#ifdef __GNUC__') + prnt('# pragma GCC visibility push(default) /* for -fvisibility= */') + prnt('#endif') + prnt() + prnt('#ifdef PYPY_VERSION') + prnt('PyMODINIT_FUNC') + prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) + prnt('{') + if flags & 1: + prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') + prnt(' _cffi_call_python_org = ' + '(void(*)(struct _cffi_externpy_s *, char *))p[1];') + prnt(' }') + prnt(' p[0] = (const void *)0x%x;' % self._version) + prnt(' p[1] = &_cffi_type_context;') + prnt('#if PY_MAJOR_VERSION >= 3') + prnt(' return NULL;') + prnt('#endif') + prnt('}') + # on Windows, distutils insists on putting init_cffi_xyz in + # 'export_symbols', so instead of fighting it, just give up and + # give it one + prnt('# ifdef _MSC_VER') + prnt(' PyMODINIT_FUNC') + prnt('# if PY_MAJOR_VERSION >= 3') + prnt(' PyInit_%s(void) { return NULL; }' % (base_module_name,)) + prnt('# else') + prnt(' init%s(void) { }' % (base_module_name,)) + prnt('# endif') + prnt('# endif') + prnt('#elif PY_MAJOR_VERSION >= 3') + prnt('PyMODINIT_FUNC') + prnt('PyInit_%s(void)' % (base_module_name,)) + prnt('{') + prnt(' return _cffi_init("%s", 0x%x, &_cffi_type_context);' % ( + self.module_name, self._version)) + prnt('}') + prnt('#else') + prnt('PyMODINIT_FUNC') + prnt('init%s(void)' % (base_module_name,)) + prnt('{') + prnt(' _cffi_init("%s", 0x%x, &_cffi_type_context);' % ( + self.module_name, self._version)) + prnt('}') + prnt('#endif') + prnt() + prnt('#ifdef __GNUC__') + prnt('# pragma GCC visibility pop') + prnt('#endif') + self._version = None + + def _to_py(self, x): + if isinstance(x, str): + return "b'%s'" % (x,) + if isinstance(x, (list, tuple)): + rep = [self._to_py(item) for item in x] + if len(rep) == 1: + rep.append('') + return "(%s)" % (','.join(rep),) + return x.as_python_expr() # Py2: unicode unexpected; Py3: bytes unexp. + + def write_py_source_to_f(self, f): + self._f = f + prnt = self._prnt + # + # header + prnt("# auto-generated file") + prnt("import _cffi_backend") + # + # the 'import' of the included ffis + num_includes = len(self.ffi._included_ffis or ()) + for i in range(num_includes): + ffi_to_include = self.ffi._included_ffis[i] + try: + included_module_name, included_source = ( + ffi_to_include._assigned_source[:2]) + except AttributeError: + raise VerificationError( + "ffi object %r includes %r, but the latter has not " + "been prepared with set_source()" % ( + self.ffi, ffi_to_include,)) + if included_source is not None: + raise VerificationError( + "not implemented yet: ffi.include() of a C-based " + "ffi inside a Python-based ffi") + prnt('from %s import ffi as _ffi%d' % (included_module_name, i)) + prnt() + prnt("ffi = _cffi_backend.FFI('%s'," % (self.module_name,)) + prnt(" _version = 0x%x," % (self._version,)) + self._version = None + # + # the '_types' keyword argument + self.cffi_types = tuple(self.cffi_types) # don't change any more + types_lst = [op.as_python_bytes() for op in self.cffi_types] + prnt(' _types = %s,' % (self._to_py(''.join(types_lst)),)) + typeindex2type = dict([(i, tp) for (tp, i) in self._typesdict.items()]) + # + # the keyword arguments from ALL_STEPS + for step_name in self.ALL_STEPS: + lst = self._lsts[step_name] + if len(lst) > 0 and step_name != "field": + prnt(' _%ss = %s,' % (step_name, self._to_py(lst))) + # + # the '_includes' keyword argument + if num_includes > 0: + prnt(' _includes = (%s,),' % ( + ', '.join(['_ffi%d' % i for i in range(num_includes)]),)) + # + # the footer + prnt(')') + + # ---------- + + def _gettypenum(self, type): + # a KeyError here is a bug. please report it! :-) + return self._typesdict[type] + + def _convert_funcarg_to_c(self, tp, fromvar, tovar, errcode): + extraarg = '' + if isinstance(tp, model.BasePrimitiveType) and not tp.is_complex_type(): + if tp.is_integer_type() and tp.name != '_Bool': + converter = '_cffi_to_c_int' + extraarg = ', %s' % tp.name + elif isinstance(tp, model.UnknownFloatType): + # don't check with is_float_type(): it may be a 'long + # double' here, and _cffi_to_c_double would loose precision + converter = '(%s)_cffi_to_c_double' % (tp.get_c_name(''),) + else: + cname = tp.get_c_name('') + converter = '(%s)_cffi_to_c_%s' % (cname, + tp.name.replace(' ', '_')) + if cname in ('char16_t', 'char32_t'): + self.needs_version(VERSION_CHAR16CHAR32) + errvalue = '-1' + # + elif isinstance(tp, model.PointerType): + self._convert_funcarg_to_c_ptr_or_array(tp, fromvar, + tovar, errcode) + return + # + elif (isinstance(tp, model.StructOrUnionOrEnum) or + isinstance(tp, model.BasePrimitiveType)): + # a struct (not a struct pointer) as a function argument; + # or, a complex (the same code works) + self._prnt(' if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)' + % (tovar, self._gettypenum(tp), fromvar)) + self._prnt(' %s;' % errcode) + return + # + elif isinstance(tp, model.FunctionPtrType): + converter = '(%s)_cffi_to_c_pointer' % tp.get_c_name('') + extraarg = ', _cffi_type(%d)' % self._gettypenum(tp) + errvalue = 'NULL' + # + else: + raise NotImplementedError(tp) + # + self._prnt(' %s = %s(%s%s);' % (tovar, converter, fromvar, extraarg)) + self._prnt(' if (%s == (%s)%s && PyErr_Occurred())' % ( + tovar, tp.get_c_name(''), errvalue)) + self._prnt(' %s;' % errcode) + + def _extra_local_variables(self, tp, localvars, freelines): + if isinstance(tp, model.PointerType): + localvars.add('Py_ssize_t datasize') + localvars.add('struct _cffi_freeme_s *large_args_free = NULL') + freelines.add('if (large_args_free != NULL)' + ' _cffi_free_array_arguments(large_args_free);') + + def _convert_funcarg_to_c_ptr_or_array(self, tp, fromvar, tovar, errcode): + self._prnt(' datasize = _cffi_prepare_pointer_call_argument(') + self._prnt(' _cffi_type(%d), %s, (char **)&%s);' % ( + self._gettypenum(tp), fromvar, tovar)) + self._prnt(' if (datasize != 0) {') + self._prnt(' %s = ((size_t)datasize) <= 640 ? ' + '(%s)alloca((size_t)datasize) : NULL;' % ( + tovar, tp.get_c_name(''))) + self._prnt(' if (_cffi_convert_array_argument(_cffi_type(%d), %s, ' + '(char **)&%s,' % (self._gettypenum(tp), fromvar, tovar)) + self._prnt(' datasize, &large_args_free) < 0)') + self._prnt(' %s;' % errcode) + self._prnt(' }') + + def _convert_expr_from_c(self, tp, var, context): + if isinstance(tp, model.BasePrimitiveType): + if tp.is_integer_type() and tp.name != '_Bool': + return '_cffi_from_c_int(%s, %s)' % (var, tp.name) + elif isinstance(tp, model.UnknownFloatType): + return '_cffi_from_c_double(%s)' % (var,) + elif tp.name != 'long double' and not tp.is_complex_type(): + cname = tp.name.replace(' ', '_') + if cname in ('char16_t', 'char32_t'): + self.needs_version(VERSION_CHAR16CHAR32) + return '_cffi_from_c_%s(%s)' % (cname, var) + else: + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, (model.PointerType, model.FunctionPtrType)): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.ArrayType): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(model.PointerType(tp.item))) + elif isinstance(tp, model.StructOrUnion): + if tp.fldnames is None: + raise TypeError("'%s' is used as %s, but is opaque" % ( + tp._get_c_name(), context)) + return '_cffi_from_c_struct((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.EnumType): + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + else: + raise NotImplementedError(tp) + + # ---------- + # typedefs + + def _typedef_type(self, tp, name): + return self._global_type(tp, "(*(%s *)0)" % (name,)) + + def _generate_cpy_typedef_collecttype(self, tp, name): + self._do_collect_type(self._typedef_type(tp, name)) + + def _generate_cpy_typedef_decl(self, tp, name): + pass + + def _typedef_ctx(self, tp, name): + type_index = self._typesdict[tp] + self._lsts["typename"].append(TypenameExpr(name, type_index)) + + def _generate_cpy_typedef_ctx(self, tp, name): + tp = self._typedef_type(tp, name) + self._typedef_ctx(tp, name) + if getattr(tp, "origin", None) == "unknown_type": + self._struct_ctx(tp, tp.name, approxname=None) + elif isinstance(tp, model.NamedPointerType): + self._struct_ctx(tp.totype, tp.totype.name, approxname=tp.name, + named_ptr=tp) + + # ---------- + # function declarations + + def _generate_cpy_function_collecttype(self, tp, name): + self._do_collect_type(tp.as_raw_function()) + if tp.ellipsis and not self.target_is_python: + self._do_collect_type(tp) + + def _generate_cpy_function_decl(self, tp, name): + assert not self.target_is_python + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + # cannot support vararg functions better than this: check for its + # exact type (including the fixed arguments), and build it as a + # constant function pointer (no CPython wrapper) + self._generate_cpy_constant_decl(tp, name) + return + prnt = self._prnt + numargs = len(tp.args) + if numargs == 0: + argname = 'noarg' + elif numargs == 1: + argname = 'arg0' + else: + argname = 'args' + # + # ------------------------------ + # the 'd' version of the function, only for addressof(lib, 'func') + arguments = [] + call_arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arguments.append(type.get_c_name(' x%d' % i, context)) + call_arguments.append('x%d' % i) + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + if tp.abi: + abi = tp.abi + ' ' + else: + abi = '' + name_and_arguments = '%s_cffi_d_%s(%s)' % (abi, name, repr_arguments) + prnt('static %s' % (tp.result.get_c_name(name_and_arguments),)) + prnt('{') + call_arguments = ', '.join(call_arguments) + result_code = 'return ' + if isinstance(tp.result, model.VoidType): + result_code = '' + prnt(' %s%s(%s);' % (result_code, name, call_arguments)) + prnt('}') + # + prnt('#ifndef PYPY_VERSION') # ------------------------------ + # + prnt('static PyObject *') + prnt('_cffi_f_%s(PyObject *self, PyObject *%s)' % (name, argname)) + prnt('{') + # + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arg = type.get_c_name(' x%d' % i, context) + prnt(' %s;' % arg) + # + localvars = set() + freelines = set() + for type in tp.args: + self._extra_local_variables(type, localvars, freelines) + for decl in sorted(localvars): + prnt(' %s;' % (decl,)) + # + if not isinstance(tp.result, model.VoidType): + result_code = 'result = ' + context = 'result of %s' % name + result_decl = ' %s;' % tp.result.get_c_name(' result', context) + prnt(result_decl) + prnt(' PyObject *pyresult;') + else: + result_decl = None + result_code = '' + # + if len(tp.args) > 1: + rng = range(len(tp.args)) + for i in rng: + prnt(' PyObject *arg%d;' % i) + prnt() + prnt(' if (!PyArg_UnpackTuple(args, "%s", %d, %d, %s))' % ( + name, len(rng), len(rng), + ', '.join(['&arg%d' % i for i in rng]))) + prnt(' return NULL;') + prnt() + # + for i, type in enumerate(tp.args): + self._convert_funcarg_to_c(type, 'arg%d' % i, 'x%d' % i, + 'return NULL') + prnt() + # + prnt(' Py_BEGIN_ALLOW_THREADS') + prnt(' _cffi_restore_errno();') + call_arguments = ['x%d' % i for i in range(len(tp.args))] + call_arguments = ', '.join(call_arguments) + prnt(' { %s%s(%s); }' % (result_code, name, call_arguments)) + prnt(' _cffi_save_errno();') + prnt(' Py_END_ALLOW_THREADS') + prnt() + # + prnt(' (void)self; /* unused */') + if numargs == 0: + prnt(' (void)noarg; /* unused */') + if result_code: + prnt(' pyresult = %s;' % + self._convert_expr_from_c(tp.result, 'result', 'result type')) + for freeline in freelines: + prnt(' ' + freeline) + prnt(' return pyresult;') + else: + for freeline in freelines: + prnt(' ' + freeline) + prnt(' Py_INCREF(Py_None);') + prnt(' return Py_None;') + prnt('}') + # + prnt('#else') # ------------------------------ + # + # the PyPy version: need to replace struct/union arguments with + # pointers, and if the result is a struct/union, insert a first + # arg that is a pointer to the result. We also do that for + # complex args and return type. + def need_indirection(type): + return (isinstance(type, model.StructOrUnion) or + (isinstance(type, model.PrimitiveType) and + type.is_complex_type())) + difference = False + arguments = [] + call_arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + indirection = '' + if need_indirection(type): + indirection = '*' + difference = True + arg = type.get_c_name(' %sx%d' % (indirection, i), context) + arguments.append(arg) + call_arguments.append('%sx%d' % (indirection, i)) + tp_result = tp.result + if need_indirection(tp_result): + context = 'result of %s' % name + arg = tp_result.get_c_name(' *result', context) + arguments.insert(0, arg) + tp_result = model.void_type + result_decl = None + result_code = '*result = ' + difference = True + if difference: + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + name_and_arguments = '%s_cffi_f_%s(%s)' % (abi, name, + repr_arguments) + prnt('static %s' % (tp_result.get_c_name(name_and_arguments),)) + prnt('{') + if result_decl: + prnt(result_decl) + call_arguments = ', '.join(call_arguments) + prnt(' { %s%s(%s); }' % (result_code, name, call_arguments)) + if result_decl: + prnt(' return result;') + prnt('}') + else: + prnt('# define _cffi_f_%s _cffi_d_%s' % (name, name)) + # + prnt('#endif') # ------------------------------ + prnt() + + def _generate_cpy_function_ctx(self, tp, name): + if tp.ellipsis and not self.target_is_python: + self._generate_cpy_constant_ctx(tp, name) + return + type_index = self._typesdict[tp.as_raw_function()] + numargs = len(tp.args) + if self.target_is_python: + meth_kind = OP_DLOPEN_FUNC + elif numargs == 0: + meth_kind = OP_CPYTHON_BLTN_N # 'METH_NOARGS' + elif numargs == 1: + meth_kind = OP_CPYTHON_BLTN_O # 'METH_O' + else: + meth_kind = OP_CPYTHON_BLTN_V # 'METH_VARARGS' + self._lsts["global"].append( + GlobalExpr(name, '_cffi_f_%s' % name, + CffiOp(meth_kind, type_index), + size='_cffi_d_%s' % name)) + + # ---------- + # named structs or unions + + def _field_type(self, tp_struct, field_name, tp_field): + if isinstance(tp_field, model.ArrayType): + actual_length = tp_field.length + if actual_length == '...': + ptr_struct_name = tp_struct.get_c_name('*') + actual_length = '_cffi_array_len(((%s)0)->%s)' % ( + ptr_struct_name, field_name) + tp_item = self._field_type(tp_struct, '%s[0]' % field_name, + tp_field.item) + tp_field = model.ArrayType(tp_item, actual_length) + return tp_field + + def _struct_collecttype(self, tp): + self._do_collect_type(tp) + if self.target_is_python: + # also requires nested anon struct/unions in ABI mode, recursively + for fldtype in tp.anonymous_struct_fields(): + self._struct_collecttype(fldtype) + + def _struct_decl(self, tp, cname, approxname): + if tp.fldtypes is None: + return + prnt = self._prnt + checkfuncname = '_cffi_checkfld_%s' % (approxname,) + prnt('_CFFI_UNUSED_FN') + prnt('static void %s(%s *p)' % (checkfuncname, cname)) + prnt('{') + prnt(' /* only to generate compile-time warnings or errors */') + prnt(' (void)p;') + for fname, ftype, fbitsize, fqual in self._enum_fields(tp): + try: + if ftype.is_integer_type() or fbitsize >= 0: + # accept all integers, but complain on float or double + if fname != '': + prnt(" (void)((p->%s) | 0); /* check that '%s.%s' is " + "an integer */" % (fname, cname, fname)) + continue + # only accept exactly the type declared, except that '[]' + # is interpreted as a '*' and so will match any array length. + # (It would also match '*', but that's harder to detect...) + while (isinstance(ftype, model.ArrayType) + and (ftype.length is None or ftype.length == '...')): + ftype = ftype.item + fname = fname + '[0]' + prnt(' { %s = &p->%s; (void)tmp; }' % ( + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) + except VerificationError as e: + prnt(' /* %s */' % str(e)) # cannot verify it, ignore + prnt('}') + prnt('struct _cffi_align_%s { char x; %s y; };' % (approxname, cname)) + prnt() + + def _struct_ctx(self, tp, cname, approxname, named_ptr=None): + type_index = self._typesdict[tp] + reason_for_not_expanding = None + flags = [] + if isinstance(tp, model.UnionType): + flags.append("_CFFI_F_UNION") + if tp.fldtypes is None: + flags.append("_CFFI_F_OPAQUE") + reason_for_not_expanding = "opaque" + if (tp not in self.ffi._parser._included_declarations and + (named_ptr is None or + named_ptr not in self.ffi._parser._included_declarations)): + if tp.fldtypes is None: + pass # opaque + elif tp.partial or any(tp.anonymous_struct_fields()): + pass # field layout obtained silently from the C compiler + else: + flags.append("_CFFI_F_CHECK_FIELDS") + if tp.packed: + if tp.packed > 1: + raise NotImplementedError( + "%r is declared with 'pack=%r'; only 0 or 1 are " + "supported in API mode (try to use \"...;\", which " + "does not require a 'pack' declaration)" % + (tp, tp.packed)) + flags.append("_CFFI_F_PACKED") + else: + flags.append("_CFFI_F_EXTERNAL") + reason_for_not_expanding = "external" + flags = '|'.join(flags) or '0' + c_fields = [] + if reason_for_not_expanding is None: + enumfields = list(self._enum_fields(tp)) + for fldname, fldtype, fbitsize, fqual in enumfields: + fldtype = self._field_type(tp, fldname, fldtype) + self._check_not_opaque(fldtype, + "field '%s.%s'" % (tp.name, fldname)) + # cname is None for _add_missing_struct_unions() only + op = OP_NOOP + if fbitsize >= 0: + op = OP_BITFIELD + size = '%d /* bits */' % fbitsize + elif cname is None or ( + isinstance(fldtype, model.ArrayType) and + fldtype.length is None): + size = '(size_t)-1' + else: + size = 'sizeof(((%s)0)->%s)' % ( + tp.get_c_name('*') if named_ptr is None + else named_ptr.name, + fldname) + if cname is None or fbitsize >= 0: + offset = '(size_t)-1' + elif named_ptr is not None: + offset = '((char *)&((%s)0)->%s) - (char *)0' % ( + named_ptr.name, fldname) + else: + offset = 'offsetof(%s, %s)' % (tp.get_c_name(''), fldname) + c_fields.append( + FieldExpr(fldname, offset, size, fbitsize, + CffiOp(op, self._typesdict[fldtype]))) + first_field_index = len(self._lsts["field"]) + self._lsts["field"].extend(c_fields) + # + if cname is None: # unknown name, for _add_missing_struct_unions + size = '(size_t)-2' + align = -2 + comment = "unnamed" + else: + if named_ptr is not None: + size = 'sizeof(*(%s)0)' % (named_ptr.name,) + align = '-1 /* unknown alignment */' + else: + size = 'sizeof(%s)' % (cname,) + align = 'offsetof(struct _cffi_align_%s, y)' % (approxname,) + comment = None + else: + size = '(size_t)-1' + align = -1 + first_field_index = -1 + comment = reason_for_not_expanding + self._lsts["struct_union"].append( + StructUnionExpr(tp.name, type_index, flags, size, align, comment, + first_field_index, c_fields)) + self._seen_struct_unions.add(tp) + + def _check_not_opaque(self, tp, location): + while isinstance(tp, model.ArrayType): + tp = tp.item + if isinstance(tp, model.StructOrUnion) and tp.fldtypes is None: + raise TypeError( + "%s is of an opaque type (not declared in cdef())" % location) + + def _add_missing_struct_unions(self): + # not very nice, but some struct declarations might be missing + # because they don't have any known C name. Check that they are + # not partial (we can't complete or verify them!) and emit them + # anonymously. + lst = list(self._struct_unions.items()) + lst.sort(key=lambda tp_order: tp_order[1]) + for tp, order in lst: + if tp not in self._seen_struct_unions: + if tp.partial: + raise NotImplementedError("internal inconsistency: %r is " + "partial but was not seen at " + "this point" % (tp,)) + if tp.name.startswith('$') and tp.name[1:].isdigit(): + approxname = tp.name[1:] + elif tp.name == '_IO_FILE' and tp.forcename == 'FILE': + approxname = 'FILE' + self._typedef_ctx(tp, 'FILE') + else: + raise NotImplementedError("internal inconsistency: %r" % + (tp,)) + self._struct_ctx(tp, None, approxname) + + def _generate_cpy_struct_collecttype(self, tp, name): + self._struct_collecttype(tp) + _generate_cpy_union_collecttype = _generate_cpy_struct_collecttype + + def _struct_names(self, tp): + cname = tp.get_c_name('') + if ' ' in cname: + return cname, cname.replace(' ', '_') + else: + return cname, '_' + cname + + def _generate_cpy_struct_decl(self, tp, name): + self._struct_decl(tp, *self._struct_names(tp)) + _generate_cpy_union_decl = _generate_cpy_struct_decl + + def _generate_cpy_struct_ctx(self, tp, name): + self._struct_ctx(tp, *self._struct_names(tp)) + _generate_cpy_union_ctx = _generate_cpy_struct_ctx + + # ---------- + # 'anonymous' declarations. These are produced for anonymous structs + # or unions; the 'name' is obtained by a typedef. + + def _generate_cpy_anonymous_collecttype(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_cpy_enum_collecttype(tp, name) + else: + self._struct_collecttype(tp) + + def _generate_cpy_anonymous_decl(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_cpy_enum_decl(tp) + else: + self._struct_decl(tp, name, 'typedef_' + name) + + def _generate_cpy_anonymous_ctx(self, tp, name): + if isinstance(tp, model.EnumType): + self._enum_ctx(tp, name) + else: + self._struct_ctx(tp, name, 'typedef_' + name) + + # ---------- + # constants, declared with "static const ..." + + def _generate_cpy_const(self, is_int, name, tp=None, category='const', + check_value=None): + if (category, name) in self._seen_constants: + raise VerificationError( + "duplicate declaration of %s '%s'" % (category, name)) + self._seen_constants.add((category, name)) + # + prnt = self._prnt + funcname = '_cffi_%s_%s' % (category, name) + if is_int: + prnt('static int %s(unsigned long long *o)' % funcname) + prnt('{') + prnt(' int n = (%s) <= 0;' % (name,)) + prnt(' *o = (unsigned long long)((%s) | 0);' + ' /* check that %s is an integer */' % (name, name)) + if check_value is not None: + if check_value > 0: + check_value = '%dU' % (check_value,) + prnt(' if (!_cffi_check_int(*o, n, %s))' % (check_value,)) + prnt(' n |= 2;') + prnt(' return n;') + prnt('}') + else: + assert check_value is None + prnt('static void %s(char *o)' % funcname) + prnt('{') + prnt(' *(%s)o = %s;' % (tp.get_c_name('*'), name)) + prnt('}') + prnt() + + def _generate_cpy_constant_collecttype(self, tp, name): + is_int = tp.is_integer_type() + if not is_int or self.target_is_python: + self._do_collect_type(tp) + + def _generate_cpy_constant_decl(self, tp, name): + is_int = tp.is_integer_type() + self._generate_cpy_const(is_int, name, tp) + + def _generate_cpy_constant_ctx(self, tp, name): + if not self.target_is_python and tp.is_integer_type(): + type_op = CffiOp(OP_CONSTANT_INT, -1) + else: + if self.target_is_python: + const_kind = OP_DLOPEN_CONST + else: + const_kind = OP_CONSTANT + type_index = self._typesdict[tp] + type_op = CffiOp(const_kind, type_index) + self._lsts["global"].append( + GlobalExpr(name, '_cffi_const_%s' % name, type_op)) + + # ---------- + # enums + + def _generate_cpy_enum_collecttype(self, tp, name): + self._do_collect_type(tp) + + def _generate_cpy_enum_decl(self, tp, name=None): + for enumerator in tp.enumerators: + self._generate_cpy_const(True, enumerator) + + def _enum_ctx(self, tp, cname): + type_index = self._typesdict[tp] + type_op = CffiOp(OP_ENUM, -1) + if self.target_is_python: + tp.check_not_partial() + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + self._lsts["global"].append( + GlobalExpr(enumerator, '_cffi_const_%s' % enumerator, type_op, + check_value=enumvalue)) + # + if cname is not None and '$' not in cname and not self.target_is_python: + size = "sizeof(%s)" % cname + signed = "((%s)-1) <= 0" % cname + else: + basetp = tp.build_baseinttype(self.ffi, []) + size = self.ffi.sizeof(basetp) + signed = int(int(self.ffi.cast(basetp, -1)) < 0) + allenums = ",".join(tp.enumerators) + self._lsts["enum"].append( + EnumExpr(tp.name, type_index, size, signed, allenums)) + + def _generate_cpy_enum_ctx(self, tp, name): + self._enum_ctx(tp, tp._get_c_name()) + + # ---------- + # macros: for now only for integers + + def _generate_cpy_macro_collecttype(self, tp, name): + pass + + def _generate_cpy_macro_decl(self, tp, name): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + self._generate_cpy_const(True, name, check_value=check_value) + + def _generate_cpy_macro_ctx(self, tp, name): + if tp == '...': + if self.target_is_python: + raise VerificationError( + "cannot use the syntax '...' in '#define %s ...' when " + "using the ABI mode" % (name,)) + check_value = None + else: + check_value = tp # an integer + type_op = CffiOp(OP_CONSTANT_INT, -1) + self._lsts["global"].append( + GlobalExpr(name, '_cffi_const_%s' % name, type_op, + check_value=check_value)) + + # ---------- + # global variables + + def _global_type(self, tp, global_name): + if isinstance(tp, model.ArrayType): + actual_length = tp.length + if actual_length == '...': + actual_length = '_cffi_array_len(%s)' % (global_name,) + tp_item = self._global_type(tp.item, '%s[0]' % global_name) + tp = model.ArrayType(tp_item, actual_length) + return tp + + def _generate_cpy_variable_collecttype(self, tp, name): + self._do_collect_type(self._global_type(tp, name)) + + def _generate_cpy_variable_decl(self, tp, name): + prnt = self._prnt + tp = self._global_type(tp, name) + if isinstance(tp, model.ArrayType) and tp.length is None: + tp = tp.item + ampersand = '' + else: + ampersand = '&' + # This code assumes that casts from "tp *" to "void *" is a + # no-op, i.e. a function that returns a "tp *" can be called + # as if it returned a "void *". This should be generally true + # on any modern machine. The only exception to that rule (on + # uncommon architectures, and as far as I can tell) might be + # if 'tp' were a function type, but that is not possible here. + # (If 'tp' is a function _pointer_ type, then casts from "fn_t + # **" to "void *" are again no-ops, as far as I can tell.) + decl = '*_cffi_var_%s(void)' % (name,) + prnt('static ' + tp.get_c_name(decl, quals=self._current_quals)) + prnt('{') + prnt(' return %s(%s);' % (ampersand, name)) + prnt('}') + prnt() + + def _generate_cpy_variable_ctx(self, tp, name): + tp = self._global_type(tp, name) + type_index = self._typesdict[tp] + if self.target_is_python: + op = OP_GLOBAL_VAR + else: + op = OP_GLOBAL_VAR_F + self._lsts["global"].append( + GlobalExpr(name, '_cffi_var_%s' % name, CffiOp(op, type_index))) + + # ---------- + # extern "Python" + + def _generate_cpy_extern_python_collecttype(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + self._do_collect_type(tp) + _generate_cpy_dllexport_python_collecttype = \ + _generate_cpy_extern_python_plus_c_collecttype = \ + _generate_cpy_extern_python_collecttype + + def _extern_python_decl(self, tp, name, tag_and_space): + prnt = self._prnt + if isinstance(tp.result, model.VoidType): + size_of_result = '0' + else: + context = 'result of %s' % name + size_of_result = '(int)sizeof(%s)' % ( + tp.result.get_c_name('', context),) + prnt('static struct _cffi_externpy_s _cffi_externpy__%s =' % name) + prnt(' { "%s.%s", %s, 0, 0 };' % ( + self.module_name, name, size_of_result)) + prnt() + # + arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arg = type.get_c_name(' a%d' % i, context) + arguments.append(arg) + # + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + name_and_arguments = '%s(%s)' % (name, repr_arguments) + if tp.abi == "__stdcall": + name_and_arguments = '_cffi_stdcall ' + name_and_arguments + # + def may_need_128_bits(tp): + return (isinstance(tp, model.PrimitiveType) and + tp.name == 'long double') + # + size_of_a = max(len(tp.args)*8, 8) + if may_need_128_bits(tp.result): + size_of_a = max(size_of_a, 16) + if isinstance(tp.result, model.StructOrUnion): + size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % ( + tp.result.get_c_name(''), size_of_a, + tp.result.get_c_name(''), size_of_a) + prnt('%s%s' % (tag_and_space, tp.result.get_c_name(name_and_arguments))) + prnt('{') + prnt(' char a[%s];' % size_of_a) + prnt(' char *p = a;') + for i, type in enumerate(tp.args): + arg = 'a%d' % i + if (isinstance(type, model.StructOrUnion) or + may_need_128_bits(type)): + arg = '&' + arg + type = model.PointerType(type) + prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) + prnt(' _cffi_call_python(&_cffi_externpy__%s, p);' % name) + if not isinstance(tp.result, model.VoidType): + prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) + prnt('}') + prnt() + self._num_externpy += 1 + + def _generate_cpy_extern_python_decl(self, tp, name): + self._extern_python_decl(tp, name, 'static ') + + def _generate_cpy_dllexport_python_decl(self, tp, name): + self._extern_python_decl(tp, name, 'CFFI_DLLEXPORT ') + + def _generate_cpy_extern_python_plus_c_decl(self, tp, name): + self._extern_python_decl(tp, name, '') + + def _generate_cpy_extern_python_ctx(self, tp, name): + if self.target_is_python: + raise VerificationError( + "cannot use 'extern \"Python\"' in the ABI mode") + if tp.ellipsis: + raise NotImplementedError("a vararg function is extern \"Python\"") + type_index = self._typesdict[tp] + type_op = CffiOp(OP_EXTERN_PYTHON, type_index) + self._lsts["global"].append( + GlobalExpr(name, '&_cffi_externpy__%s' % name, type_op, name)) + + _generate_cpy_dllexport_python_ctx = \ + _generate_cpy_extern_python_plus_c_ctx = \ + _generate_cpy_extern_python_ctx + + def _print_string_literal_in_array(self, s): + prnt = self._prnt + prnt('// # NB. this is not a string because of a size limit in MSVC') + if not isinstance(s, bytes): # unicode + s = s.encode('utf-8') # -> bytes + else: + s.decode('utf-8') # got bytes, check for valid utf-8 + try: + s.decode('ascii') + except UnicodeDecodeError: + s = b'# -*- encoding: utf8 -*-\n' + s + for line in s.splitlines(True): + comment = line + if type('//') is bytes: # python2 + line = map(ord, line) # make a list of integers + else: # python3 + # type(line) is bytes, which enumerates like a list of integers + comment = ascii(comment)[1:-1] + prnt(('// ' + comment).rstrip()) + printed_line = '' + for c in line: + if len(printed_line) >= 76: + prnt(printed_line) + printed_line = '' + printed_line += '%d,' % (c,) + prnt(printed_line) + + # ---------- + # emitting the opcodes for individual types + + def _emit_bytecode_VoidType(self, tp, index): + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, PRIM_VOID) + + def _emit_bytecode_PrimitiveType(self, tp, index): + prim_index = PRIMITIVE_TO_INDEX[tp.name] + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, prim_index) + + def _emit_bytecode_UnknownIntegerType(self, tp, index): + s = ('_cffi_prim_int(sizeof(%s), (\n' + ' ((%s)-1) | 0 /* check that %s is an integer type */\n' + ' ) <= 0)' % (tp.name, tp.name, tp.name)) + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s) + + def _emit_bytecode_UnknownFloatType(self, tp, index): + s = ('_cffi_prim_float(sizeof(%s) *\n' + ' (((%s)1) / 2) * 2 /* integer => 0, float => 1 */\n' + ' )' % (tp.name, tp.name)) + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s) + + def _emit_bytecode_RawFunctionType(self, tp, index): + self.cffi_types[index] = CffiOp(OP_FUNCTION, self._typesdict[tp.result]) + index += 1 + for tp1 in tp.args: + realindex = self._typesdict[tp1] + if index != realindex: + if isinstance(tp1, model.PrimitiveType): + self._emit_bytecode_PrimitiveType(tp1, index) + else: + self.cffi_types[index] = CffiOp(OP_NOOP, realindex) + index += 1 + flags = int(tp.ellipsis) + if tp.abi is not None: + if tp.abi == '__stdcall': + flags |= 2 + else: + raise NotImplementedError("abi=%r" % (tp.abi,)) + self.cffi_types[index] = CffiOp(OP_FUNCTION_END, flags) + + def _emit_bytecode_PointerType(self, tp, index): + self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[tp.totype]) + + _emit_bytecode_ConstPointerType = _emit_bytecode_PointerType + _emit_bytecode_NamedPointerType = _emit_bytecode_PointerType + + def _emit_bytecode_FunctionPtrType(self, tp, index): + raw = tp.as_raw_function() + self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[raw]) + + def _emit_bytecode_ArrayType(self, tp, index): + item_index = self._typesdict[tp.item] + if tp.length is None: + self.cffi_types[index] = CffiOp(OP_OPEN_ARRAY, item_index) + elif tp.length == '...': + raise VerificationError( + "type %s badly placed: the '...' array length can only be " + "used on global arrays or on fields of structures" % ( + str(tp).replace('/*...*/', '...'),)) + else: + assert self.cffi_types[index + 1] == 'LEN' + self.cffi_types[index] = CffiOp(OP_ARRAY, item_index) + self.cffi_types[index + 1] = CffiOp(None, str(tp.length)) + + def _emit_bytecode_StructType(self, tp, index): + struct_index = self._struct_unions[tp] + self.cffi_types[index] = CffiOp(OP_STRUCT_UNION, struct_index) + _emit_bytecode_UnionType = _emit_bytecode_StructType + + def _emit_bytecode_EnumType(self, tp, index): + enum_index = self._enums[tp] + self.cffi_types[index] = CffiOp(OP_ENUM, enum_index) + + +if sys.version_info >= (3,): + NativeIO = io.StringIO +else: + class NativeIO(io.BytesIO): + def write(self, s): + if isinstance(s, unicode): + s = s.encode('ascii') + super(NativeIO, self).write(s) + +def _make_c_or_py_source(ffi, module_name, preamble, target_file, verbose): + if verbose: + print("generating %s" % (target_file,)) + recompiler = Recompiler(ffi, module_name, + target_is_python=(preamble is None)) + recompiler.collect_type_table() + recompiler.collect_step_tables() + f = NativeIO() + recompiler.write_source_to_f(f, preamble) + output = f.getvalue() + try: + with open(target_file, 'r') as f1: + if f1.read(len(output) + 1) != output: + raise IOError + if verbose: + print("(already up-to-date)") + return False # already up-to-date + except IOError: + tmp_file = '%s.~%d' % (target_file, os.getpid()) + with open(tmp_file, 'w') as f1: + f1.write(output) + try: + os.rename(tmp_file, target_file) + except OSError: + os.unlink(target_file) + os.rename(tmp_file, target_file) + return True + +def make_c_source(ffi, module_name, preamble, target_c_file, verbose=False): + assert preamble is not None + return _make_c_or_py_source(ffi, module_name, preamble, target_c_file, + verbose) + +def make_py_source(ffi, module_name, target_py_file, verbose=False): + return _make_c_or_py_source(ffi, module_name, None, target_py_file, + verbose) + +def _modname_to_file(outputdir, modname, extension): + parts = modname.split('.') + try: + os.makedirs(os.path.join(outputdir, *parts[:-1])) + except OSError: + pass + parts[-1] += extension + return os.path.join(outputdir, *parts), parts + + +# Aaargh. Distutils is not tested at all for the purpose of compiling +# DLLs that are not extension modules. Here are some hacks to work +# around that, in the _patch_for_*() functions... + +def _patch_meth(patchlist, cls, name, new_meth): + old = getattr(cls, name) + patchlist.append((cls, name, old)) + setattr(cls, name, new_meth) + return old + +def _unpatch_meths(patchlist): + for cls, name, old_meth in reversed(patchlist): + setattr(cls, name, old_meth) + +def _patch_for_embedding(patchlist): + if sys.platform == 'win32': + # we must not remove the manifest when building for embedding! + from distutils.msvc9compiler import MSVCCompiler + _patch_meth(patchlist, MSVCCompiler, '_remove_visual_c_ref', + lambda self, manifest_file: manifest_file) + + if sys.platform == 'darwin': + # we must not make a '-bundle', but a '-dynamiclib' instead + from distutils.ccompiler import CCompiler + def my_link_shared_object(self, *args, **kwds): + if '-bundle' in self.linker_so: + self.linker_so = list(self.linker_so) + i = self.linker_so.index('-bundle') + self.linker_so[i] = '-dynamiclib' + return old_link_shared_object(self, *args, **kwds) + old_link_shared_object = _patch_meth(patchlist, CCompiler, + 'link_shared_object', + my_link_shared_object) + +def _patch_for_target(patchlist, target): + from distutils.command.build_ext import build_ext + # if 'target' is different from '*', we need to patch some internal + # method to just return this 'target' value, instead of having it + # built from module_name + if target.endswith('.*'): + target = target[:-2] + if sys.platform == 'win32': + target += '.dll' + elif sys.platform == 'darwin': + target += '.dylib' + else: + target += '.so' + _patch_meth(patchlist, build_ext, 'get_ext_filename', + lambda self, ext_name: target) + + +def recompile(ffi, module_name, preamble, tmpdir='.', call_c_compiler=True, + c_file=None, source_extension='.c', extradir=None, + compiler_verbose=1, target=None, debug=None, **kwds): + if not isinstance(module_name, str): + module_name = module_name.encode('ascii') + if ffi._windows_unicode: + ffi._apply_windows_unicode(kwds) + if preamble is not None: + embedding = (ffi._embedding is not None) + if embedding: + ffi._apply_embedding_fix(kwds) + if c_file is None: + c_file, parts = _modname_to_file(tmpdir, module_name, + source_extension) + if extradir: + parts = [extradir] + parts + ext_c_file = os.path.join(*parts) + else: + ext_c_file = c_file + # + if target is None: + if embedding: + target = '%s.*' % module_name + else: + target = '*' + # + ext = ffiplatform.get_extension(ext_c_file, module_name, **kwds) + updated = make_c_source(ffi, module_name, preamble, c_file, + verbose=compiler_verbose) + if call_c_compiler: + patchlist = [] + cwd = os.getcwd() + try: + if embedding: + _patch_for_embedding(patchlist) + if target != '*': + _patch_for_target(patchlist, target) + if compiler_verbose: + if tmpdir == '.': + msg = 'the current directory is' + else: + msg = 'setting the current directory to' + print('%s %r' % (msg, os.path.abspath(tmpdir))) + os.chdir(tmpdir) + outputfilename = ffiplatform.compile('.', ext, + compiler_verbose, debug) + finally: + os.chdir(cwd) + _unpatch_meths(patchlist) + return outputfilename + else: + return ext, updated + else: + if c_file is None: + c_file, _ = _modname_to_file(tmpdir, module_name, '.py') + updated = make_py_source(ffi, module_name, c_file, + verbose=compiler_verbose) + if call_c_compiler: + return c_file + else: + return None, updated + diff --git a/billinglayer/python/cffi/setuptools_ext.py b/billinglayer/python/cffi/setuptools_ext.py new file mode 100644 index 0000000..8fe3614 --- /dev/null +++ b/billinglayer/python/cffi/setuptools_ext.py @@ -0,0 +1,219 @@ +import os +import sys + +try: + basestring +except NameError: + # Python 3.x + basestring = str + +def error(msg): + from distutils.errors import DistutilsSetupError + raise DistutilsSetupError(msg) + + +def execfile(filename, glob): + # We use execfile() (here rewritten for Python 3) instead of + # __import__() to load the build script. The problem with + # a normal import is that in some packages, the intermediate + # __init__.py files may already try to import the file that + # we are generating. + with open(filename) as f: + src = f.read() + src += '\n' # Python 2.6 compatibility + code = compile(src, filename, 'exec') + exec(code, glob, glob) + + +def add_cffi_module(dist, mod_spec): + from cffi.api import FFI + + if not isinstance(mod_spec, basestring): + error("argument to 'cffi_modules=...' must be a str or a list of str," + " not %r" % (type(mod_spec).__name__,)) + mod_spec = str(mod_spec) + try: + build_file_name, ffi_var_name = mod_spec.split(':') + except ValueError: + error("%r must be of the form 'path/build.py:ffi_variable'" % + (mod_spec,)) + if not os.path.exists(build_file_name): + ext = '' + rewritten = build_file_name.replace('.', '/') + '.py' + if os.path.exists(rewritten): + ext = ' (rewrite cffi_modules to [%r])' % ( + rewritten + ':' + ffi_var_name,) + error("%r does not name an existing file%s" % (build_file_name, ext)) + + mod_vars = {'__name__': '__cffi__', '__file__': build_file_name} + execfile(build_file_name, mod_vars) + + try: + ffi = mod_vars[ffi_var_name] + except KeyError: + error("%r: object %r not found in module" % (mod_spec, + ffi_var_name)) + if not isinstance(ffi, FFI): + ffi = ffi() # maybe it's a function instead of directly an ffi + if not isinstance(ffi, FFI): + error("%r is not an FFI instance (got %r)" % (mod_spec, + type(ffi).__name__)) + if not hasattr(ffi, '_assigned_source'): + error("%r: the set_source() method was not called" % (mod_spec,)) + module_name, source, source_extension, kwds = ffi._assigned_source + if ffi._windows_unicode: + kwds = kwds.copy() + ffi._apply_windows_unicode(kwds) + + if source is None: + _add_py_module(dist, ffi, module_name) + else: + _add_c_module(dist, ffi, module_name, source, source_extension, kwds) + +def _set_py_limited_api(Extension, kwds): + """ + Add py_limited_api to kwds if setuptools >= 26 is in use. + Do not alter the setting if it already exists. + Setuptools takes care of ignoring the flag on Python 2 and PyPy. + + CPython itself should ignore the flag in a debugging version + (by not listing .abi3.so in the extensions it supports), but + it doesn't so far, creating troubles. That's why we check + for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent + of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401) + + On Windows, with CPython <= 3.4, it's better not to use py_limited_api + because virtualenv *still* doesn't copy PYTHON3.DLL on these versions. + Recently (2020) we started shipping only >= 3.5 wheels, though. So + we'll give it another try and set py_limited_api on Windows >= 3.5. + """ + from cffi import recompiler + + if ('py_limited_api' not in kwds and not hasattr(sys, 'gettotalrefcount') + and recompiler.USE_LIMITED_API): + import setuptools + try: + setuptools_major_version = int(setuptools.__version__.partition('.')[0]) + if setuptools_major_version >= 26: + kwds['py_limited_api'] = True + except ValueError: # certain development versions of setuptools + # If we don't know the version number of setuptools, we + # try to set 'py_limited_api' anyway. At worst, we get a + # warning. + kwds['py_limited_api'] = True + return kwds + +def _add_c_module(dist, ffi, module_name, source, source_extension, kwds): + from distutils.core import Extension + # We are a setuptools extension. Need this build_ext for py_limited_api. + from setuptools.command.build_ext import build_ext + from distutils.dir_util import mkpath + from distutils import log + from cffi import recompiler + + allsources = ['$PLACEHOLDER'] + allsources.extend(kwds.pop('sources', [])) + kwds = _set_py_limited_api(Extension, kwds) + ext = Extension(name=module_name, sources=allsources, **kwds) + + def make_mod(tmpdir, pre_run=None): + c_file = os.path.join(tmpdir, module_name + source_extension) + log.info("generating cffi module %r" % c_file) + mkpath(tmpdir) + # a setuptools-only, API-only hook: called with the "ext" and "ffi" + # arguments just before we turn the ffi into C code. To use it, + # subclass the 'distutils.command.build_ext.build_ext' class and + # add a method 'def pre_run(self, ext, ffi)'. + if pre_run is not None: + pre_run(ext, ffi) + updated = recompiler.make_c_source(ffi, module_name, source, c_file) + if not updated: + log.info("already up-to-date") + return c_file + + if dist.ext_modules is None: + dist.ext_modules = [] + dist.ext_modules.append(ext) + + base_class = dist.cmdclass.get('build_ext', build_ext) + class build_ext_make_mod(base_class): + def run(self): + if ext.sources[0] == '$PLACEHOLDER': + pre_run = getattr(self, 'pre_run', None) + ext.sources[0] = make_mod(self.build_temp, pre_run) + base_class.run(self) + dist.cmdclass['build_ext'] = build_ext_make_mod + # NB. multiple runs here will create multiple 'build_ext_make_mod' + # classes. Even in this case the 'build_ext' command should be + # run once; but just in case, the logic above does nothing if + # called again. + + +def _add_py_module(dist, ffi, module_name): + from distutils.dir_util import mkpath + from setuptools.command.build_py import build_py + from setuptools.command.build_ext import build_ext + from distutils import log + from cffi import recompiler + + def generate_mod(py_file): + log.info("generating cffi module %r" % py_file) + mkpath(os.path.dirname(py_file)) + updated = recompiler.make_py_source(ffi, module_name, py_file) + if not updated: + log.info("already up-to-date") + + base_class = dist.cmdclass.get('build_py', build_py) + class build_py_make_mod(base_class): + def run(self): + base_class.run(self) + module_path = module_name.split('.') + module_path[-1] += '.py' + generate_mod(os.path.join(self.build_lib, *module_path)) + def get_source_files(self): + # This is called from 'setup.py sdist' only. Exclude + # the generate .py module in this case. + saved_py_modules = self.py_modules + try: + if saved_py_modules: + self.py_modules = [m for m in saved_py_modules + if m != module_name] + return base_class.get_source_files(self) + finally: + self.py_modules = saved_py_modules + dist.cmdclass['build_py'] = build_py_make_mod + + # distutils and setuptools have no notion I could find of a + # generated python module. If we don't add module_name to + # dist.py_modules, then things mostly work but there are some + # combination of options (--root and --record) that will miss + # the module. So we add it here, which gives a few apparently + # harmless warnings about not finding the file outside the + # build directory. + # Then we need to hack more in get_source_files(); see above. + if dist.py_modules is None: + dist.py_modules = [] + dist.py_modules.append(module_name) + + # the following is only for "build_ext -i" + base_class_2 = dist.cmdclass.get('build_ext', build_ext) + class build_ext_make_mod(base_class_2): + def run(self): + base_class_2.run(self) + if self.inplace: + # from get_ext_fullpath() in distutils/command/build_ext.py + module_path = module_name.split('.') + package = '.'.join(module_path[:-1]) + build_py = self.get_finalized_command('build_py') + package_dir = build_py.get_package_dir(package) + file_name = module_path[-1] + '.py' + generate_mod(os.path.join(package_dir, file_name)) + dist.cmdclass['build_ext'] = build_ext_make_mod + +def cffi_modules(dist, attr, value): + assert attr == 'cffi_modules' + if isinstance(value, basestring): + value = [value] + + for cffi_module in value: + add_cffi_module(dist, cffi_module) diff --git a/billinglayer/python/cffi/vengine_cpy.py b/billinglayer/python/cffi/vengine_cpy.py new file mode 100644 index 0000000..6de0df0 --- /dev/null +++ b/billinglayer/python/cffi/vengine_cpy.py @@ -0,0 +1,1076 @@ +# +# DEPRECATED: implementation for ffi.verify() +# +import sys, imp +from . import model +from .error import VerificationError + + +class VCPythonEngine(object): + _class_key = 'x' + _gen_python_module = True + + def __init__(self, verifier): + self.verifier = verifier + self.ffi = verifier.ffi + self._struct_pending_verification = {} + self._types_of_builtin_functions = {} + + def patch_extension_kwds(self, kwds): + pass + + def find_module(self, module_name, path, so_suffixes): + try: + f, filename, descr = imp.find_module(module_name, path) + except ImportError: + return None + if f is not None: + f.close() + # Note that after a setuptools installation, there are both .py + # and .so files with the same basename. The code here relies on + # imp.find_module() locating the .so in priority. + if descr[0] not in so_suffixes: + return None + return filename + + def collect_types(self): + self._typesdict = {} + self._generate("collecttype") + + def _prnt(self, what=''): + self._f.write(what + '\n') + + def _gettypenum(self, type): + # a KeyError here is a bug. please report it! :-) + return self._typesdict[type] + + def _do_collect_type(self, tp): + if ((not isinstance(tp, model.PrimitiveType) + or tp.name == 'long double') + and tp not in self._typesdict): + num = len(self._typesdict) + self._typesdict[tp] = num + + def write_source_to_f(self): + self.collect_types() + # + # The new module will have a _cffi_setup() function that receives + # objects from the ffi world, and that calls some setup code in + # the module. This setup code is split in several independent + # functions, e.g. one per constant. The functions are "chained" + # by ending in a tail call to each other. + # + # This is further split in two chained lists, depending on if we + # can do it at import-time or if we must wait for _cffi_setup() to + # provide us with the objects. This is needed because we + # need the values of the enum constants in order to build the + # that we may have to pass to _cffi_setup(). + # + # The following two 'chained_list_constants' items contains + # the head of these two chained lists, as a string that gives the + # call to do, if any. + self._chained_list_constants = ['((void)lib,0)', '((void)lib,0)'] + # + prnt = self._prnt + # first paste some standard set of lines that are mostly '#define' + prnt(cffimod_header) + prnt() + # then paste the C source given by the user, verbatim. + prnt(self.verifier.preamble) + prnt() + # + # call generate_cpy_xxx_decl(), for every xxx found from + # ffi._parser._declarations. This generates all the functions. + self._generate("decl") + # + # implement the function _cffi_setup_custom() as calling the + # head of the chained list. + self._generate_setup_custom() + prnt() + # + # produce the method table, including the entries for the + # generated Python->C function wrappers, which are done + # by generate_cpy_function_method(). + prnt('static PyMethodDef _cffi_methods[] = {') + self._generate("method") + prnt(' {"_cffi_setup", _cffi_setup, METH_VARARGS, NULL},') + prnt(' {NULL, NULL, 0, NULL} /* Sentinel */') + prnt('};') + prnt() + # + # standard init. + modname = self.verifier.get_module_name() + constants = self._chained_list_constants[False] + prnt('#if PY_MAJOR_VERSION >= 3') + prnt() + prnt('static struct PyModuleDef _cffi_module_def = {') + prnt(' PyModuleDef_HEAD_INIT,') + prnt(' "%s",' % modname) + prnt(' NULL,') + prnt(' -1,') + prnt(' _cffi_methods,') + prnt(' NULL, NULL, NULL, NULL') + prnt('};') + prnt() + prnt('PyMODINIT_FUNC') + prnt('PyInit_%s(void)' % modname) + prnt('{') + prnt(' PyObject *lib;') + prnt(' lib = PyModule_Create(&_cffi_module_def);') + prnt(' if (lib == NULL)') + prnt(' return NULL;') + prnt(' if (%s < 0 || _cffi_init() < 0) {' % (constants,)) + prnt(' Py_DECREF(lib);') + prnt(' return NULL;') + prnt(' }') + prnt(' return lib;') + prnt('}') + prnt() + prnt('#else') + prnt() + prnt('PyMODINIT_FUNC') + prnt('init%s(void)' % modname) + prnt('{') + prnt(' PyObject *lib;') + prnt(' lib = Py_InitModule("%s", _cffi_methods);' % modname) + prnt(' if (lib == NULL)') + prnt(' return;') + prnt(' if (%s < 0 || _cffi_init() < 0)' % (constants,)) + prnt(' return;') + prnt(' return;') + prnt('}') + prnt() + prnt('#endif') + + def load_library(self, flags=None): + # XXX review all usages of 'self' here! + # import it as a new extension module + imp.acquire_lock() + try: + if hasattr(sys, "getdlopenflags"): + previous_flags = sys.getdlopenflags() + try: + if hasattr(sys, "setdlopenflags") and flags is not None: + sys.setdlopenflags(flags) + module = imp.load_dynamic(self.verifier.get_module_name(), + self.verifier.modulefilename) + except ImportError as e: + error = "importing %r: %s" % (self.verifier.modulefilename, e) + raise VerificationError(error) + finally: + if hasattr(sys, "setdlopenflags"): + sys.setdlopenflags(previous_flags) + finally: + imp.release_lock() + # + # call loading_cpy_struct() to get the struct layout inferred by + # the C compiler + self._load(module, 'loading') + # + # the C code will need the objects. Collect them in + # order in a list. + revmapping = dict([(value, key) + for (key, value) in self._typesdict.items()]) + lst = [revmapping[i] for i in range(len(revmapping))] + lst = list(map(self.ffi._get_cached_btype, lst)) + # + # build the FFILibrary class and instance and call _cffi_setup(). + # this will set up some fields like '_cffi_types', and only then + # it will invoke the chained list of functions that will really + # build (notably) the constant objects, as if they are + # pointers, and store them as attributes on the 'library' object. + class FFILibrary(object): + _cffi_python_module = module + _cffi_ffi = self.ffi + _cffi_dir = [] + def __dir__(self): + return FFILibrary._cffi_dir + list(self.__dict__) + library = FFILibrary() + if module._cffi_setup(lst, VerificationError, library): + import warnings + warnings.warn("reimporting %r might overwrite older definitions" + % (self.verifier.get_module_name())) + # + # finally, call the loaded_cpy_xxx() functions. This will perform + # the final adjustments, like copying the Python->C wrapper + # functions from the module to the 'library' object, and setting + # up the FFILibrary class with properties for the global C variables. + self._load(module, 'loaded', library=library) + module._cffi_original_ffi = self.ffi + module._cffi_types_of_builtin_funcs = self._types_of_builtin_functions + return library + + def _get_declarations(self): + lst = [(key, tp) for (key, (tp, qual)) in + self.ffi._parser._declarations.items()] + lst.sort() + return lst + + def _generate(self, step_name): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + try: + method = getattr(self, '_generate_cpy_%s_%s' % (kind, + step_name)) + except AttributeError: + raise VerificationError( + "not implemented in verify(): %r" % name) + try: + method(tp, realname) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _load(self, module, step_name, **kwds): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + method = getattr(self, '_%s_cpy_%s' % (step_name, kind)) + try: + method(tp, realname, module, **kwds) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _generate_nothing(self, tp, name): + pass + + def _loaded_noop(self, tp, name, module, **kwds): + pass + + # ---------- + + def _convert_funcarg_to_c(self, tp, fromvar, tovar, errcode): + extraarg = '' + if isinstance(tp, model.PrimitiveType): + if tp.is_integer_type() and tp.name != '_Bool': + converter = '_cffi_to_c_int' + extraarg = ', %s' % tp.name + else: + converter = '(%s)_cffi_to_c_%s' % (tp.get_c_name(''), + tp.name.replace(' ', '_')) + errvalue = '-1' + # + elif isinstance(tp, model.PointerType): + self._convert_funcarg_to_c_ptr_or_array(tp, fromvar, + tovar, errcode) + return + # + elif isinstance(tp, (model.StructOrUnion, model.EnumType)): + # a struct (not a struct pointer) as a function argument + self._prnt(' if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)' + % (tovar, self._gettypenum(tp), fromvar)) + self._prnt(' %s;' % errcode) + return + # + elif isinstance(tp, model.FunctionPtrType): + converter = '(%s)_cffi_to_c_pointer' % tp.get_c_name('') + extraarg = ', _cffi_type(%d)' % self._gettypenum(tp) + errvalue = 'NULL' + # + else: + raise NotImplementedError(tp) + # + self._prnt(' %s = %s(%s%s);' % (tovar, converter, fromvar, extraarg)) + self._prnt(' if (%s == (%s)%s && PyErr_Occurred())' % ( + tovar, tp.get_c_name(''), errvalue)) + self._prnt(' %s;' % errcode) + + def _extra_local_variables(self, tp, localvars, freelines): + if isinstance(tp, model.PointerType): + localvars.add('Py_ssize_t datasize') + localvars.add('struct _cffi_freeme_s *large_args_free = NULL') + freelines.add('if (large_args_free != NULL)' + ' _cffi_free_array_arguments(large_args_free);') + + def _convert_funcarg_to_c_ptr_or_array(self, tp, fromvar, tovar, errcode): + self._prnt(' datasize = _cffi_prepare_pointer_call_argument(') + self._prnt(' _cffi_type(%d), %s, (char **)&%s);' % ( + self._gettypenum(tp), fromvar, tovar)) + self._prnt(' if (datasize != 0) {') + self._prnt(' %s = ((size_t)datasize) <= 640 ? ' + 'alloca((size_t)datasize) : NULL;' % (tovar,)) + self._prnt(' if (_cffi_convert_array_argument(_cffi_type(%d), %s, ' + '(char **)&%s,' % (self._gettypenum(tp), fromvar, tovar)) + self._prnt(' datasize, &large_args_free) < 0)') + self._prnt(' %s;' % errcode) + self._prnt(' }') + + def _convert_expr_from_c(self, tp, var, context): + if isinstance(tp, model.PrimitiveType): + if tp.is_integer_type() and tp.name != '_Bool': + return '_cffi_from_c_int(%s, %s)' % (var, tp.name) + elif tp.name != 'long double': + return '_cffi_from_c_%s(%s)' % (tp.name.replace(' ', '_'), var) + else: + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, (model.PointerType, model.FunctionPtrType)): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.ArrayType): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(model.PointerType(tp.item))) + elif isinstance(tp, model.StructOrUnion): + if tp.fldnames is None: + raise TypeError("'%s' is used as %s, but is opaque" % ( + tp._get_c_name(), context)) + return '_cffi_from_c_struct((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.EnumType): + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + else: + raise NotImplementedError(tp) + + # ---------- + # typedefs: generates no code so far + + _generate_cpy_typedef_collecttype = _generate_nothing + _generate_cpy_typedef_decl = _generate_nothing + _generate_cpy_typedef_method = _generate_nothing + _loading_cpy_typedef = _loaded_noop + _loaded_cpy_typedef = _loaded_noop + + # ---------- + # function declarations + + def _generate_cpy_function_collecttype(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + self._do_collect_type(tp) + else: + # don't call _do_collect_type(tp) in this common case, + # otherwise test_autofilled_struct_as_argument fails + for type in tp.args: + self._do_collect_type(type) + self._do_collect_type(tp.result) + + def _generate_cpy_function_decl(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + # cannot support vararg functions better than this: check for its + # exact type (including the fixed arguments), and build it as a + # constant function pointer (no CPython wrapper) + self._generate_cpy_const(False, name, tp) + return + prnt = self._prnt + numargs = len(tp.args) + if numargs == 0: + argname = 'noarg' + elif numargs == 1: + argname = 'arg0' + else: + argname = 'args' + prnt('static PyObject *') + prnt('_cffi_f_%s(PyObject *self, PyObject *%s)' % (name, argname)) + prnt('{') + # + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + prnt(' %s;' % type.get_c_name(' x%d' % i, context)) + # + localvars = set() + freelines = set() + for type in tp.args: + self._extra_local_variables(type, localvars, freelines) + for decl in sorted(localvars): + prnt(' %s;' % (decl,)) + # + if not isinstance(tp.result, model.VoidType): + result_code = 'result = ' + context = 'result of %s' % name + prnt(' %s;' % tp.result.get_c_name(' result', context)) + prnt(' PyObject *pyresult;') + else: + result_code = '' + # + if len(tp.args) > 1: + rng = range(len(tp.args)) + for i in rng: + prnt(' PyObject *arg%d;' % i) + prnt() + prnt(' if (!PyArg_ParseTuple(args, "%s:%s", %s))' % ( + 'O' * numargs, name, ', '.join(['&arg%d' % i for i in rng]))) + prnt(' return NULL;') + prnt() + # + for i, type in enumerate(tp.args): + self._convert_funcarg_to_c(type, 'arg%d' % i, 'x%d' % i, + 'return NULL') + prnt() + # + prnt(' Py_BEGIN_ALLOW_THREADS') + prnt(' _cffi_restore_errno();') + prnt(' { %s%s(%s); }' % ( + result_code, name, + ', '.join(['x%d' % i for i in range(len(tp.args))]))) + prnt(' _cffi_save_errno();') + prnt(' Py_END_ALLOW_THREADS') + prnt() + # + prnt(' (void)self; /* unused */') + if numargs == 0: + prnt(' (void)noarg; /* unused */') + if result_code: + prnt(' pyresult = %s;' % + self._convert_expr_from_c(tp.result, 'result', 'result type')) + for freeline in freelines: + prnt(' ' + freeline) + prnt(' return pyresult;') + else: + for freeline in freelines: + prnt(' ' + freeline) + prnt(' Py_INCREF(Py_None);') + prnt(' return Py_None;') + prnt('}') + prnt() + + def _generate_cpy_function_method(self, tp, name): + if tp.ellipsis: + return + numargs = len(tp.args) + if numargs == 0: + meth = 'METH_NOARGS' + elif numargs == 1: + meth = 'METH_O' + else: + meth = 'METH_VARARGS' + self._prnt(' {"%s", _cffi_f_%s, %s, NULL},' % (name, name, meth)) + + _loading_cpy_function = _loaded_noop + + def _loaded_cpy_function(self, tp, name, module, library): + if tp.ellipsis: + return + func = getattr(module, name) + setattr(library, name, func) + self._types_of_builtin_functions[func] = tp + + # ---------- + # named structs + + _generate_cpy_struct_collecttype = _generate_nothing + def _generate_cpy_struct_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'struct', name) + def _generate_cpy_struct_method(self, tp, name): + self._generate_struct_or_union_method(tp, 'struct', name) + def _loading_cpy_struct(self, tp, name, module): + self._loading_struct_or_union(tp, 'struct', name, module) + def _loaded_cpy_struct(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + _generate_cpy_union_collecttype = _generate_nothing + def _generate_cpy_union_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'union', name) + def _generate_cpy_union_method(self, tp, name): + self._generate_struct_or_union_method(tp, 'union', name) + def _loading_cpy_union(self, tp, name, module): + self._loading_struct_or_union(tp, 'union', name, module) + def _loaded_cpy_union(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + def _generate_struct_or_union_decl(self, tp, prefix, name): + if tp.fldnames is None: + return # nothing to do with opaque structs + checkfuncname = '_cffi_check_%s_%s' % (prefix, name) + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + cname = ('%s %s' % (prefix, name)).strip() + # + prnt = self._prnt + prnt('static void %s(%s *p)' % (checkfuncname, cname)) + prnt('{') + prnt(' /* only to generate compile-time warnings or errors */') + prnt(' (void)p;') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if (isinstance(ftype, model.PrimitiveType) + and ftype.is_integer_type()) or fbitsize >= 0: + # accept all integers, but complain on float or double + prnt(' (void)((p->%s) << 1);' % fname) + else: + # only accept exactly the type declared. + try: + prnt(' { %s = &p->%s; (void)tmp; }' % ( + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) + except VerificationError as e: + prnt(' /* %s */' % str(e)) # cannot verify it, ignore + prnt('}') + prnt('static PyObject *') + prnt('%s(PyObject *self, PyObject *noarg)' % (layoutfuncname,)) + prnt('{') + prnt(' struct _cffi_aligncheck { char x; %s y; };' % cname) + prnt(' static Py_ssize_t nums[] = {') + prnt(' sizeof(%s),' % cname) + prnt(' offsetof(struct _cffi_aligncheck, y),') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + prnt(' offsetof(%s, %s),' % (cname, fname)) + if isinstance(ftype, model.ArrayType) and ftype.length is None: + prnt(' 0, /* %s */' % ftype._get_c_name()) + else: + prnt(' sizeof(((%s *)0)->%s),' % (cname, fname)) + prnt(' -1') + prnt(' };') + prnt(' (void)self; /* unused */') + prnt(' (void)noarg; /* unused */') + prnt(' return _cffi_get_struct_layout(nums);') + prnt(' /* the next line is not executed, but compiled */') + prnt(' %s(0);' % (checkfuncname,)) + prnt('}') + prnt() + + def _generate_struct_or_union_method(self, tp, prefix, name): + if tp.fldnames is None: + return # nothing to do with opaque structs + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + self._prnt(' {"%s", %s, METH_NOARGS, NULL},' % (layoutfuncname, + layoutfuncname)) + + def _loading_struct_or_union(self, tp, prefix, name, module): + if tp.fldnames is None: + return # nothing to do with opaque structs + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + # + function = getattr(module, layoutfuncname) + layout = function() + if isinstance(tp, model.StructOrUnion) and tp.partial: + # use the function()'s sizes and offsets to guide the + # layout of the struct + totalsize = layout[0] + totalalignment = layout[1] + fieldofs = layout[2::2] + fieldsize = layout[3::2] + tp.force_flatten() + assert len(fieldofs) == len(fieldsize) == len(tp.fldnames) + tp.fixedlayout = fieldofs, fieldsize, totalsize, totalalignment + else: + cname = ('%s %s' % (prefix, name)).strip() + self._struct_pending_verification[tp] = layout, cname + + def _loaded_struct_or_union(self, tp): + if tp.fldnames is None: + return # nothing to do with opaque structs + self.ffi._get_cached_btype(tp) # force 'fixedlayout' to be considered + + if tp in self._struct_pending_verification: + # check that the layout sizes and offsets match the real ones + def check(realvalue, expectedvalue, msg): + if realvalue != expectedvalue: + raise VerificationError( + "%s (we have %d, but C compiler says %d)" + % (msg, expectedvalue, realvalue)) + ffi = self.ffi + BStruct = ffi._get_cached_btype(tp) + layout, cname = self._struct_pending_verification.pop(tp) + check(layout[0], ffi.sizeof(BStruct), "wrong total size") + check(layout[1], ffi.alignof(BStruct), "wrong total alignment") + i = 2 + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + check(layout[i], ffi.offsetof(BStruct, fname), + "wrong offset for field %r" % (fname,)) + if layout[i+1] != 0: + BField = ffi._get_cached_btype(ftype) + check(layout[i+1], ffi.sizeof(BField), + "wrong size for field %r" % (fname,)) + i += 2 + assert i == len(layout) + + # ---------- + # 'anonymous' declarations. These are produced for anonymous structs + # or unions; the 'name' is obtained by a typedef. + + _generate_cpy_anonymous_collecttype = _generate_nothing + + def _generate_cpy_anonymous_decl(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_cpy_enum_decl(tp, name, '') + else: + self._generate_struct_or_union_decl(tp, '', name) + + def _generate_cpy_anonymous_method(self, tp, name): + if not isinstance(tp, model.EnumType): + self._generate_struct_or_union_method(tp, '', name) + + def _loading_cpy_anonymous(self, tp, name, module): + if isinstance(tp, model.EnumType): + self._loading_cpy_enum(tp, name, module) + else: + self._loading_struct_or_union(tp, '', name, module) + + def _loaded_cpy_anonymous(self, tp, name, module, **kwds): + if isinstance(tp, model.EnumType): + self._loaded_cpy_enum(tp, name, module, **kwds) + else: + self._loaded_struct_or_union(tp) + + # ---------- + # constants, likely declared with '#define' + + def _generate_cpy_const(self, is_int, name, tp=None, category='const', + vartp=None, delayed=True, size_too=False, + check_value=None): + prnt = self._prnt + funcname = '_cffi_%s_%s' % (category, name) + prnt('static int %s(PyObject *lib)' % funcname) + prnt('{') + prnt(' PyObject *o;') + prnt(' int res;') + if not is_int: + prnt(' %s;' % (vartp or tp).get_c_name(' i', name)) + else: + assert category == 'const' + # + if check_value is not None: + self._check_int_constant_value(name, check_value) + # + if not is_int: + if category == 'var': + realexpr = '&' + name + else: + realexpr = name + prnt(' i = (%s);' % (realexpr,)) + prnt(' o = %s;' % (self._convert_expr_from_c(tp, 'i', + 'variable type'),)) + assert delayed + else: + prnt(' o = _cffi_from_c_int_const(%s);' % name) + prnt(' if (o == NULL)') + prnt(' return -1;') + if size_too: + prnt(' {') + prnt(' PyObject *o1 = o;') + prnt(' o = Py_BuildValue("On", o1, (Py_ssize_t)sizeof(%s));' + % (name,)) + prnt(' Py_DECREF(o1);') + prnt(' if (o == NULL)') + prnt(' return -1;') + prnt(' }') + prnt(' res = PyObject_SetAttrString(lib, "%s", o);' % name) + prnt(' Py_DECREF(o);') + prnt(' if (res < 0)') + prnt(' return -1;') + prnt(' return %s;' % self._chained_list_constants[delayed]) + self._chained_list_constants[delayed] = funcname + '(lib)' + prnt('}') + prnt() + + def _generate_cpy_constant_collecttype(self, tp, name): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + if not is_int: + self._do_collect_type(tp) + + def _generate_cpy_constant_decl(self, tp, name): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + self._generate_cpy_const(is_int, name, tp) + + _generate_cpy_constant_method = _generate_nothing + _loading_cpy_constant = _loaded_noop + _loaded_cpy_constant = _loaded_noop + + # ---------- + # enums + + def _check_int_constant_value(self, name, value, err_prefix=''): + prnt = self._prnt + if value <= 0: + prnt(' if ((%s) > 0 || (long)(%s) != %dL) {' % ( + name, name, value)) + else: + prnt(' if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {' % ( + name, name, value)) + prnt(' char buf[64];') + prnt(' if ((%s) <= 0)' % name) + prnt(' snprintf(buf, 63, "%%ld", (long)(%s));' % name) + prnt(' else') + prnt(' snprintf(buf, 63, "%%lu", (unsigned long)(%s));' % + name) + prnt(' PyErr_Format(_cffi_VerificationError,') + prnt(' "%s%s has the real value %s, not %s",') + prnt(' "%s", "%s", buf, "%d");' % ( + err_prefix, name, value)) + prnt(' return -1;') + prnt(' }') + + def _enum_funcname(self, prefix, name): + # "$enum_$1" => "___D_enum____D_1" + name = name.replace('$', '___D_') + return '_cffi_e_%s_%s' % (prefix, name) + + def _generate_cpy_enum_decl(self, tp, name, prefix='enum'): + if tp.partial: + for enumerator in tp.enumerators: + self._generate_cpy_const(True, enumerator, delayed=False) + return + # + funcname = self._enum_funcname(prefix, name) + prnt = self._prnt + prnt('static int %s(PyObject *lib)' % funcname) + prnt('{') + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + self._check_int_constant_value(enumerator, enumvalue, + "enum %s: " % name) + prnt(' return %s;' % self._chained_list_constants[True]) + self._chained_list_constants[True] = funcname + '(lib)' + prnt('}') + prnt() + + _generate_cpy_enum_collecttype = _generate_nothing + _generate_cpy_enum_method = _generate_nothing + + def _loading_cpy_enum(self, tp, name, module): + if tp.partial: + enumvalues = [getattr(module, enumerator) + for enumerator in tp.enumerators] + tp.enumvalues = tuple(enumvalues) + tp.partial_resolved = True + + def _loaded_cpy_enum(self, tp, name, module, library): + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + setattr(library, enumerator, enumvalue) + + # ---------- + # macros: for now only for integers + + def _generate_cpy_macro_decl(self, tp, name): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + self._generate_cpy_const(True, name, check_value=check_value) + + _generate_cpy_macro_collecttype = _generate_nothing + _generate_cpy_macro_method = _generate_nothing + _loading_cpy_macro = _loaded_noop + _loaded_cpy_macro = _loaded_noop + + # ---------- + # global variables + + def _generate_cpy_variable_collecttype(self, tp, name): + if isinstance(tp, model.ArrayType): + tp_ptr = model.PointerType(tp.item) + else: + tp_ptr = model.PointerType(tp) + self._do_collect_type(tp_ptr) + + def _generate_cpy_variable_decl(self, tp, name): + if isinstance(tp, model.ArrayType): + tp_ptr = model.PointerType(tp.item) + self._generate_cpy_const(False, name, tp, vartp=tp_ptr, + size_too = tp.length_is_unknown()) + else: + tp_ptr = model.PointerType(tp) + self._generate_cpy_const(False, name, tp_ptr, category='var') + + _generate_cpy_variable_method = _generate_nothing + _loading_cpy_variable = _loaded_noop + + def _loaded_cpy_variable(self, tp, name, module, library): + value = getattr(library, name) + if isinstance(tp, model.ArrayType): # int a[5] is "constant" in the + # sense that "a=..." is forbidden + if tp.length_is_unknown(): + assert isinstance(value, tuple) + (value, size) = value + BItemType = self.ffi._get_cached_btype(tp.item) + length, rest = divmod(size, self.ffi.sizeof(BItemType)) + if rest != 0: + raise VerificationError( + "bad size: %r does not seem to be an array of %s" % + (name, tp.item)) + tp = tp.resolve_length(length) + # 'value' is a which we have to replace with + # a if the N is actually known + if tp.length is not None: + BArray = self.ffi._get_cached_btype(tp) + value = self.ffi.cast(BArray, value) + setattr(library, name, value) + return + # remove ptr= from the library instance, and replace + # it by a property on the class, which reads/writes into ptr[0]. + ptr = value + delattr(library, name) + def getter(library): + return ptr[0] + def setter(library, value): + ptr[0] = value + setattr(type(library), name, property(getter, setter)) + type(library)._cffi_dir.append(name) + + # ---------- + + def _generate_setup_custom(self): + prnt = self._prnt + prnt('static int _cffi_setup_custom(PyObject *lib)') + prnt('{') + prnt(' return %s;' % self._chained_list_constants[True]) + prnt('}') + +cffimod_header = r''' +#include +#include + +/* this block of #ifs should be kept exactly identical between + c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py + and cffi/_cffi_include.h */ +#if defined(_MSC_VER) +# include /* for alloca() */ +# if _MSC_VER < 1600 /* MSVC < 2010 */ + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; + typedef __int8 int_least8_t; + typedef __int16 int_least16_t; + typedef __int32 int_least32_t; + typedef __int64 int_least64_t; + typedef unsigned __int8 uint_least8_t; + typedef unsigned __int16 uint_least16_t; + typedef unsigned __int32 uint_least32_t; + typedef unsigned __int64 uint_least64_t; + typedef __int8 int_fast8_t; + typedef __int16 int_fast16_t; + typedef __int32 int_fast32_t; + typedef __int64 int_fast64_t; + typedef unsigned __int8 uint_fast8_t; + typedef unsigned __int16 uint_fast16_t; + typedef unsigned __int32 uint_fast32_t; + typedef unsigned __int64 uint_fast64_t; + typedef __int64 intmax_t; + typedef unsigned __int64 uintmax_t; +# else +# include +# endif +# if _MSC_VER < 1800 /* MSVC < 2013 */ +# ifndef __cplusplus + typedef unsigned char _Bool; +# endif +# endif +#else +# include +# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux) +# include +# endif +#endif + +#if PY_MAJOR_VERSION < 3 +# undef PyCapsule_CheckExact +# undef PyCapsule_GetPointer +# define PyCapsule_CheckExact(capsule) (PyCObject_Check(capsule)) +# define PyCapsule_GetPointer(capsule, name) \ + (PyCObject_AsVoidPtr(capsule)) +#endif + +#if PY_MAJOR_VERSION >= 3 +# define PyInt_FromLong PyLong_FromLong +#endif + +#define _cffi_from_c_double PyFloat_FromDouble +#define _cffi_from_c_float PyFloat_FromDouble +#define _cffi_from_c_long PyInt_FromLong +#define _cffi_from_c_ulong PyLong_FromUnsignedLong +#define _cffi_from_c_longlong PyLong_FromLongLong +#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong +#define _cffi_from_c__Bool PyBool_FromLong + +#define _cffi_to_c_double PyFloat_AsDouble +#define _cffi_to_c_float PyFloat_AsDouble + +#define _cffi_from_c_int_const(x) \ + (((x) > 0) ? \ + ((unsigned long long)(x) <= (unsigned long long)LONG_MAX) ? \ + PyInt_FromLong((long)(x)) : \ + PyLong_FromUnsignedLongLong((unsigned long long)(x)) : \ + ((long long)(x) >= (long long)LONG_MIN) ? \ + PyInt_FromLong((long)(x)) : \ + PyLong_FromLongLong((long long)(x))) + +#define _cffi_from_c_int(x, type) \ + (((type)-1) > 0 ? /* unsigned */ \ + (sizeof(type) < sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + sizeof(type) == sizeof(long) ? \ + PyLong_FromUnsignedLong((unsigned long)x) : \ + PyLong_FromUnsignedLongLong((unsigned long long)x)) : \ + (sizeof(type) <= sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + PyLong_FromLongLong((long long)x))) + +#define _cffi_to_c_int(o, type) \ + ((type)( \ + sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o) \ + : (type)_cffi_to_c_i8(o)) : \ + sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o) \ + : (type)_cffi_to_c_i16(o)) : \ + sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o) \ + : (type)_cffi_to_c_i32(o)) : \ + sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o) \ + : (type)_cffi_to_c_i64(o)) : \ + (Py_FatalError("unsupported size for type " #type), (type)0))) + +#define _cffi_to_c_i8 \ + ((int(*)(PyObject *))_cffi_exports[1]) +#define _cffi_to_c_u8 \ + ((int(*)(PyObject *))_cffi_exports[2]) +#define _cffi_to_c_i16 \ + ((int(*)(PyObject *))_cffi_exports[3]) +#define _cffi_to_c_u16 \ + ((int(*)(PyObject *))_cffi_exports[4]) +#define _cffi_to_c_i32 \ + ((int(*)(PyObject *))_cffi_exports[5]) +#define _cffi_to_c_u32 \ + ((unsigned int(*)(PyObject *))_cffi_exports[6]) +#define _cffi_to_c_i64 \ + ((long long(*)(PyObject *))_cffi_exports[7]) +#define _cffi_to_c_u64 \ + ((unsigned long long(*)(PyObject *))_cffi_exports[8]) +#define _cffi_to_c_char \ + ((int(*)(PyObject *))_cffi_exports[9]) +#define _cffi_from_c_pointer \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[10]) +#define _cffi_to_c_pointer \ + ((char *(*)(PyObject *, CTypeDescrObject *))_cffi_exports[11]) +#define _cffi_get_struct_layout \ + ((PyObject *(*)(Py_ssize_t[]))_cffi_exports[12]) +#define _cffi_restore_errno \ + ((void(*)(void))_cffi_exports[13]) +#define _cffi_save_errno \ + ((void(*)(void))_cffi_exports[14]) +#define _cffi_from_c_char \ + ((PyObject *(*)(char))_cffi_exports[15]) +#define _cffi_from_c_deref \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[16]) +#define _cffi_to_c \ + ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[17]) +#define _cffi_from_c_struct \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[18]) +#define _cffi_to_c_wchar_t \ + ((wchar_t(*)(PyObject *))_cffi_exports[19]) +#define _cffi_from_c_wchar_t \ + ((PyObject *(*)(wchar_t))_cffi_exports[20]) +#define _cffi_to_c_long_double \ + ((long double(*)(PyObject *))_cffi_exports[21]) +#define _cffi_to_c__Bool \ + ((_Bool(*)(PyObject *))_cffi_exports[22]) +#define _cffi_prepare_pointer_call_argument \ + ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23]) +#define _cffi_convert_array_from_object \ + ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) +#define _CFFI_NUM_EXPORTS 25 + +typedef struct _ctypedescr CTypeDescrObject; + +static void *_cffi_exports[_CFFI_NUM_EXPORTS]; +static PyObject *_cffi_types, *_cffi_VerificationError; + +static int _cffi_setup_custom(PyObject *lib); /* forward */ + +static PyObject *_cffi_setup(PyObject *self, PyObject *args) +{ + PyObject *library; + int was_alive = (_cffi_types != NULL); + (void)self; /* unused */ + if (!PyArg_ParseTuple(args, "OOO", &_cffi_types, &_cffi_VerificationError, + &library)) + return NULL; + Py_INCREF(_cffi_types); + Py_INCREF(_cffi_VerificationError); + if (_cffi_setup_custom(library) < 0) + return NULL; + return PyBool_FromLong(was_alive); +} + +union _cffi_union_alignment_u { + unsigned char m_char; + unsigned short m_short; + unsigned int m_int; + unsigned long m_long; + unsigned long long m_longlong; + float m_float; + double m_double; + long double m_longdouble; +}; + +struct _cffi_freeme_s { + struct _cffi_freeme_s *next; + union _cffi_union_alignment_u alignment; +}; + +#ifdef __GNUC__ + __attribute__((unused)) +#endif +static int _cffi_convert_array_argument(CTypeDescrObject *ctptr, PyObject *arg, + char **output_data, Py_ssize_t datasize, + struct _cffi_freeme_s **freeme) +{ + char *p; + if (datasize < 0) + return -1; + + p = *output_data; + if (p == NULL) { + struct _cffi_freeme_s *fp = (struct _cffi_freeme_s *)PyObject_Malloc( + offsetof(struct _cffi_freeme_s, alignment) + (size_t)datasize); + if (fp == NULL) + return -1; + fp->next = *freeme; + *freeme = fp; + p = *output_data = (char *)&fp->alignment; + } + memset((void *)p, 0, (size_t)datasize); + return _cffi_convert_array_from_object(p, ctptr, arg); +} + +#ifdef __GNUC__ + __attribute__((unused)) +#endif +static void _cffi_free_array_arguments(struct _cffi_freeme_s *freeme) +{ + do { + void *p = (void *)freeme; + freeme = freeme->next; + PyObject_Free(p); + } while (freeme != NULL); +} + +static int _cffi_init(void) +{ + PyObject *module, *c_api_object = NULL; + + module = PyImport_ImportModule("_cffi_backend"); + if (module == NULL) + goto failure; + + c_api_object = PyObject_GetAttrString(module, "_C_API"); + if (c_api_object == NULL) + goto failure; + if (!PyCapsule_CheckExact(c_api_object)) { + PyErr_SetNone(PyExc_ImportError); + goto failure; + } + memcpy(_cffi_exports, PyCapsule_GetPointer(c_api_object, "cffi"), + _CFFI_NUM_EXPORTS * sizeof(void *)); + + Py_DECREF(module); + Py_DECREF(c_api_object); + return 0; + + failure: + Py_XDECREF(module); + Py_XDECREF(c_api_object); + return -1; +} + +#define _cffi_type(num) ((CTypeDescrObject *)PyList_GET_ITEM(_cffi_types, num)) + +/**********/ +''' diff --git a/billinglayer/python/cffi/vengine_gen.py b/billinglayer/python/cffi/vengine_gen.py new file mode 100644 index 0000000..2642152 --- /dev/null +++ b/billinglayer/python/cffi/vengine_gen.py @@ -0,0 +1,675 @@ +# +# DEPRECATED: implementation for ffi.verify() +# +import sys, os +import types + +from . import model +from .error import VerificationError + + +class VGenericEngine(object): + _class_key = 'g' + _gen_python_module = False + + def __init__(self, verifier): + self.verifier = verifier + self.ffi = verifier.ffi + self.export_symbols = [] + self._struct_pending_verification = {} + + def patch_extension_kwds(self, kwds): + # add 'export_symbols' to the dictionary. Note that we add the + # list before filling it. When we fill it, it will thus also show + # up in kwds['export_symbols']. + kwds.setdefault('export_symbols', self.export_symbols) + + def find_module(self, module_name, path, so_suffixes): + for so_suffix in so_suffixes: + basename = module_name + so_suffix + if path is None: + path = sys.path + for dirname in path: + filename = os.path.join(dirname, basename) + if os.path.isfile(filename): + return filename + + def collect_types(self): + pass # not needed in the generic engine + + def _prnt(self, what=''): + self._f.write(what + '\n') + + def write_source_to_f(self): + prnt = self._prnt + # first paste some standard set of lines that are mostly '#include' + prnt(cffimod_header) + # then paste the C source given by the user, verbatim. + prnt(self.verifier.preamble) + # + # call generate_gen_xxx_decl(), for every xxx found from + # ffi._parser._declarations. This generates all the functions. + self._generate('decl') + # + # on Windows, distutils insists on putting init_cffi_xyz in + # 'export_symbols', so instead of fighting it, just give up and + # give it one + if sys.platform == 'win32': + if sys.version_info >= (3,): + prefix = 'PyInit_' + else: + prefix = 'init' + modname = self.verifier.get_module_name() + prnt("void %s%s(void) { }\n" % (prefix, modname)) + + def load_library(self, flags=0): + # import it with the CFFI backend + backend = self.ffi._backend + # needs to make a path that contains '/', on Posix + filename = os.path.join(os.curdir, self.verifier.modulefilename) + module = backend.load_library(filename, flags) + # + # call loading_gen_struct() to get the struct layout inferred by + # the C compiler + self._load(module, 'loading') + + # build the FFILibrary class and instance, this is a module subclass + # because modules are expected to have usually-constant-attributes and + # in PyPy this means the JIT is able to treat attributes as constant, + # which we want. + class FFILibrary(types.ModuleType): + _cffi_generic_module = module + _cffi_ffi = self.ffi + _cffi_dir = [] + def __dir__(self): + return FFILibrary._cffi_dir + library = FFILibrary("") + # + # finally, call the loaded_gen_xxx() functions. This will set + # up the 'library' object. + self._load(module, 'loaded', library=library) + return library + + def _get_declarations(self): + lst = [(key, tp) for (key, (tp, qual)) in + self.ffi._parser._declarations.items()] + lst.sort() + return lst + + def _generate(self, step_name): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + try: + method = getattr(self, '_generate_gen_%s_%s' % (kind, + step_name)) + except AttributeError: + raise VerificationError( + "not implemented in verify(): %r" % name) + try: + method(tp, realname) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _load(self, module, step_name, **kwds): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + method = getattr(self, '_%s_gen_%s' % (step_name, kind)) + try: + method(tp, realname, module, **kwds) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _generate_nothing(self, tp, name): + pass + + def _loaded_noop(self, tp, name, module, **kwds): + pass + + # ---------- + # typedefs: generates no code so far + + _generate_gen_typedef_decl = _generate_nothing + _loading_gen_typedef = _loaded_noop + _loaded_gen_typedef = _loaded_noop + + # ---------- + # function declarations + + def _generate_gen_function_decl(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + # cannot support vararg functions better than this: check for its + # exact type (including the fixed arguments), and build it as a + # constant function pointer (no _cffi_f_%s wrapper) + self._generate_gen_const(False, name, tp) + return + prnt = self._prnt + numargs = len(tp.args) + argnames = [] + for i, type in enumerate(tp.args): + indirection = '' + if isinstance(type, model.StructOrUnion): + indirection = '*' + argnames.append('%sx%d' % (indirection, i)) + context = 'argument of %s' % name + arglist = [type.get_c_name(' %s' % arg, context) + for type, arg in zip(tp.args, argnames)] + tpresult = tp.result + if isinstance(tpresult, model.StructOrUnion): + arglist.insert(0, tpresult.get_c_name(' *r', context)) + tpresult = model.void_type + arglist = ', '.join(arglist) or 'void' + wrappername = '_cffi_f_%s' % name + self.export_symbols.append(wrappername) + if tp.abi: + abi = tp.abi + ' ' + else: + abi = '' + funcdecl = ' %s%s(%s)' % (abi, wrappername, arglist) + context = 'result of %s' % name + prnt(tpresult.get_c_name(funcdecl, context)) + prnt('{') + # + if isinstance(tp.result, model.StructOrUnion): + result_code = '*r = ' + elif not isinstance(tp.result, model.VoidType): + result_code = 'return ' + else: + result_code = '' + prnt(' %s%s(%s);' % (result_code, name, ', '.join(argnames))) + prnt('}') + prnt() + + _loading_gen_function = _loaded_noop + + def _loaded_gen_function(self, tp, name, module, library): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + newfunction = self._load_constant(False, tp, name, module) + else: + indirections = [] + base_tp = tp + if (any(isinstance(typ, model.StructOrUnion) for typ in tp.args) + or isinstance(tp.result, model.StructOrUnion)): + indirect_args = [] + for i, typ in enumerate(tp.args): + if isinstance(typ, model.StructOrUnion): + typ = model.PointerType(typ) + indirections.append((i, typ)) + indirect_args.append(typ) + indirect_result = tp.result + if isinstance(indirect_result, model.StructOrUnion): + if indirect_result.fldtypes is None: + raise TypeError("'%s' is used as result type, " + "but is opaque" % ( + indirect_result._get_c_name(),)) + indirect_result = model.PointerType(indirect_result) + indirect_args.insert(0, indirect_result) + indirections.insert(0, ("result", indirect_result)) + indirect_result = model.void_type + tp = model.FunctionPtrType(tuple(indirect_args), + indirect_result, tp.ellipsis) + BFunc = self.ffi._get_cached_btype(tp) + wrappername = '_cffi_f_%s' % name + newfunction = module.load_function(BFunc, wrappername) + for i, typ in indirections: + newfunction = self._make_struct_wrapper(newfunction, i, typ, + base_tp) + setattr(library, name, newfunction) + type(library)._cffi_dir.append(name) + + def _make_struct_wrapper(self, oldfunc, i, tp, base_tp): + backend = self.ffi._backend + BType = self.ffi._get_cached_btype(tp) + if i == "result": + ffi = self.ffi + def newfunc(*args): + res = ffi.new(BType) + oldfunc(res, *args) + return res[0] + else: + def newfunc(*args): + args = args[:i] + (backend.newp(BType, args[i]),) + args[i+1:] + return oldfunc(*args) + newfunc._cffi_base_type = base_tp + return newfunc + + # ---------- + # named structs + + def _generate_gen_struct_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'struct', name) + + def _loading_gen_struct(self, tp, name, module): + self._loading_struct_or_union(tp, 'struct', name, module) + + def _loaded_gen_struct(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + def _generate_gen_union_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'union', name) + + def _loading_gen_union(self, tp, name, module): + self._loading_struct_or_union(tp, 'union', name, module) + + def _loaded_gen_union(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + def _generate_struct_or_union_decl(self, tp, prefix, name): + if tp.fldnames is None: + return # nothing to do with opaque structs + checkfuncname = '_cffi_check_%s_%s' % (prefix, name) + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + cname = ('%s %s' % (prefix, name)).strip() + # + prnt = self._prnt + prnt('static void %s(%s *p)' % (checkfuncname, cname)) + prnt('{') + prnt(' /* only to generate compile-time warnings or errors */') + prnt(' (void)p;') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if (isinstance(ftype, model.PrimitiveType) + and ftype.is_integer_type()) or fbitsize >= 0: + # accept all integers, but complain on float or double + prnt(' (void)((p->%s) << 1);' % fname) + else: + # only accept exactly the type declared. + try: + prnt(' { %s = &p->%s; (void)tmp; }' % ( + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) + except VerificationError as e: + prnt(' /* %s */' % str(e)) # cannot verify it, ignore + prnt('}') + self.export_symbols.append(layoutfuncname) + prnt('intptr_t %s(intptr_t i)' % (layoutfuncname,)) + prnt('{') + prnt(' struct _cffi_aligncheck { char x; %s y; };' % cname) + prnt(' static intptr_t nums[] = {') + prnt(' sizeof(%s),' % cname) + prnt(' offsetof(struct _cffi_aligncheck, y),') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + prnt(' offsetof(%s, %s),' % (cname, fname)) + if isinstance(ftype, model.ArrayType) and ftype.length is None: + prnt(' 0, /* %s */' % ftype._get_c_name()) + else: + prnt(' sizeof(((%s *)0)->%s),' % (cname, fname)) + prnt(' -1') + prnt(' };') + prnt(' return nums[i];') + prnt(' /* the next line is not executed, but compiled */') + prnt(' %s(0);' % (checkfuncname,)) + prnt('}') + prnt() + + def _loading_struct_or_union(self, tp, prefix, name, module): + if tp.fldnames is None: + return # nothing to do with opaque structs + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + # + BFunc = self.ffi._typeof_locked("intptr_t(*)(intptr_t)")[0] + function = module.load_function(BFunc, layoutfuncname) + layout = [] + num = 0 + while True: + x = function(num) + if x < 0: break + layout.append(x) + num += 1 + if isinstance(tp, model.StructOrUnion) and tp.partial: + # use the function()'s sizes and offsets to guide the + # layout of the struct + totalsize = layout[0] + totalalignment = layout[1] + fieldofs = layout[2::2] + fieldsize = layout[3::2] + tp.force_flatten() + assert len(fieldofs) == len(fieldsize) == len(tp.fldnames) + tp.fixedlayout = fieldofs, fieldsize, totalsize, totalalignment + else: + cname = ('%s %s' % (prefix, name)).strip() + self._struct_pending_verification[tp] = layout, cname + + def _loaded_struct_or_union(self, tp): + if tp.fldnames is None: + return # nothing to do with opaque structs + self.ffi._get_cached_btype(tp) # force 'fixedlayout' to be considered + + if tp in self._struct_pending_verification: + # check that the layout sizes and offsets match the real ones + def check(realvalue, expectedvalue, msg): + if realvalue != expectedvalue: + raise VerificationError( + "%s (we have %d, but C compiler says %d)" + % (msg, expectedvalue, realvalue)) + ffi = self.ffi + BStruct = ffi._get_cached_btype(tp) + layout, cname = self._struct_pending_verification.pop(tp) + check(layout[0], ffi.sizeof(BStruct), "wrong total size") + check(layout[1], ffi.alignof(BStruct), "wrong total alignment") + i = 2 + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + check(layout[i], ffi.offsetof(BStruct, fname), + "wrong offset for field %r" % (fname,)) + if layout[i+1] != 0: + BField = ffi._get_cached_btype(ftype) + check(layout[i+1], ffi.sizeof(BField), + "wrong size for field %r" % (fname,)) + i += 2 + assert i == len(layout) + + # ---------- + # 'anonymous' declarations. These are produced for anonymous structs + # or unions; the 'name' is obtained by a typedef. + + def _generate_gen_anonymous_decl(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_gen_enum_decl(tp, name, '') + else: + self._generate_struct_or_union_decl(tp, '', name) + + def _loading_gen_anonymous(self, tp, name, module): + if isinstance(tp, model.EnumType): + self._loading_gen_enum(tp, name, module, '') + else: + self._loading_struct_or_union(tp, '', name, module) + + def _loaded_gen_anonymous(self, tp, name, module, **kwds): + if isinstance(tp, model.EnumType): + self._loaded_gen_enum(tp, name, module, **kwds) + else: + self._loaded_struct_or_union(tp) + + # ---------- + # constants, likely declared with '#define' + + def _generate_gen_const(self, is_int, name, tp=None, category='const', + check_value=None): + prnt = self._prnt + funcname = '_cffi_%s_%s' % (category, name) + self.export_symbols.append(funcname) + if check_value is not None: + assert is_int + assert category == 'const' + prnt('int %s(char *out_error)' % funcname) + prnt('{') + self._check_int_constant_value(name, check_value) + prnt(' return 0;') + prnt('}') + elif is_int: + assert category == 'const' + prnt('int %s(long long *out_value)' % funcname) + prnt('{') + prnt(' *out_value = (long long)(%s);' % (name,)) + prnt(' return (%s) <= 0;' % (name,)) + prnt('}') + else: + assert tp is not None + assert check_value is None + if category == 'var': + ampersand = '&' + else: + ampersand = '' + extra = '' + if category == 'const' and isinstance(tp, model.StructOrUnion): + extra = 'const *' + ampersand = '&' + prnt(tp.get_c_name(' %s%s(void)' % (extra, funcname), name)) + prnt('{') + prnt(' return (%s%s);' % (ampersand, name)) + prnt('}') + prnt() + + def _generate_gen_constant_decl(self, tp, name): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + self._generate_gen_const(is_int, name, tp) + + _loading_gen_constant = _loaded_noop + + def _load_constant(self, is_int, tp, name, module, check_value=None): + funcname = '_cffi_const_%s' % name + if check_value is not None: + assert is_int + self._load_known_int_constant(module, funcname) + value = check_value + elif is_int: + BType = self.ffi._typeof_locked("long long*")[0] + BFunc = self.ffi._typeof_locked("int(*)(long long*)")[0] + function = module.load_function(BFunc, funcname) + p = self.ffi.new(BType) + negative = function(p) + value = int(p[0]) + if value < 0 and not negative: + BLongLong = self.ffi._typeof_locked("long long")[0] + value += (1 << (8*self.ffi.sizeof(BLongLong))) + else: + assert check_value is None + fntypeextra = '(*)(void)' + if isinstance(tp, model.StructOrUnion): + fntypeextra = '*' + fntypeextra + BFunc = self.ffi._typeof_locked(tp.get_c_name(fntypeextra, name))[0] + function = module.load_function(BFunc, funcname) + value = function() + if isinstance(tp, model.StructOrUnion): + value = value[0] + return value + + def _loaded_gen_constant(self, tp, name, module, library): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + value = self._load_constant(is_int, tp, name, module) + setattr(library, name, value) + type(library)._cffi_dir.append(name) + + # ---------- + # enums + + def _check_int_constant_value(self, name, value): + prnt = self._prnt + if value <= 0: + prnt(' if ((%s) > 0 || (long)(%s) != %dL) {' % ( + name, name, value)) + else: + prnt(' if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {' % ( + name, name, value)) + prnt(' char buf[64];') + prnt(' if ((%s) <= 0)' % name) + prnt(' sprintf(buf, "%%ld", (long)(%s));' % name) + prnt(' else') + prnt(' sprintf(buf, "%%lu", (unsigned long)(%s));' % + name) + prnt(' sprintf(out_error, "%s has the real value %s, not %s",') + prnt(' "%s", buf, "%d");' % (name[:100], value)) + prnt(' return -1;') + prnt(' }') + + def _load_known_int_constant(self, module, funcname): + BType = self.ffi._typeof_locked("char[]")[0] + BFunc = self.ffi._typeof_locked("int(*)(char*)")[0] + function = module.load_function(BFunc, funcname) + p = self.ffi.new(BType, 256) + if function(p) < 0: + error = self.ffi.string(p) + if sys.version_info >= (3,): + error = str(error, 'utf-8') + raise VerificationError(error) + + def _enum_funcname(self, prefix, name): + # "$enum_$1" => "___D_enum____D_1" + name = name.replace('$', '___D_') + return '_cffi_e_%s_%s' % (prefix, name) + + def _generate_gen_enum_decl(self, tp, name, prefix='enum'): + if tp.partial: + for enumerator in tp.enumerators: + self._generate_gen_const(True, enumerator) + return + # + funcname = self._enum_funcname(prefix, name) + self.export_symbols.append(funcname) + prnt = self._prnt + prnt('int %s(char *out_error)' % funcname) + prnt('{') + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + self._check_int_constant_value(enumerator, enumvalue) + prnt(' return 0;') + prnt('}') + prnt() + + def _loading_gen_enum(self, tp, name, module, prefix='enum'): + if tp.partial: + enumvalues = [self._load_constant(True, tp, enumerator, module) + for enumerator in tp.enumerators] + tp.enumvalues = tuple(enumvalues) + tp.partial_resolved = True + else: + funcname = self._enum_funcname(prefix, name) + self._load_known_int_constant(module, funcname) + + def _loaded_gen_enum(self, tp, name, module, library): + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + setattr(library, enumerator, enumvalue) + type(library)._cffi_dir.append(enumerator) + + # ---------- + # macros: for now only for integers + + def _generate_gen_macro_decl(self, tp, name): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + self._generate_gen_const(True, name, check_value=check_value) + + _loading_gen_macro = _loaded_noop + + def _loaded_gen_macro(self, tp, name, module, library): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + value = self._load_constant(True, tp, name, module, + check_value=check_value) + setattr(library, name, value) + type(library)._cffi_dir.append(name) + + # ---------- + # global variables + + def _generate_gen_variable_decl(self, tp, name): + if isinstance(tp, model.ArrayType): + if tp.length_is_unknown(): + prnt = self._prnt + funcname = '_cffi_sizeof_%s' % (name,) + self.export_symbols.append(funcname) + prnt("size_t %s(void)" % funcname) + prnt("{") + prnt(" return sizeof(%s);" % (name,)) + prnt("}") + tp_ptr = model.PointerType(tp.item) + self._generate_gen_const(False, name, tp_ptr) + else: + tp_ptr = model.PointerType(tp) + self._generate_gen_const(False, name, tp_ptr, category='var') + + _loading_gen_variable = _loaded_noop + + def _loaded_gen_variable(self, tp, name, module, library): + if isinstance(tp, model.ArrayType): # int a[5] is "constant" in the + # sense that "a=..." is forbidden + if tp.length_is_unknown(): + funcname = '_cffi_sizeof_%s' % (name,) + BFunc = self.ffi._typeof_locked('size_t(*)(void)')[0] + function = module.load_function(BFunc, funcname) + size = function() + BItemType = self.ffi._get_cached_btype(tp.item) + length, rest = divmod(size, self.ffi.sizeof(BItemType)) + if rest != 0: + raise VerificationError( + "bad size: %r does not seem to be an array of %s" % + (name, tp.item)) + tp = tp.resolve_length(length) + tp_ptr = model.PointerType(tp.item) + value = self._load_constant(False, tp_ptr, name, module) + # 'value' is a which we have to replace with + # a if the N is actually known + if tp.length is not None: + BArray = self.ffi._get_cached_btype(tp) + value = self.ffi.cast(BArray, value) + setattr(library, name, value) + type(library)._cffi_dir.append(name) + return + # remove ptr= from the library instance, and replace + # it by a property on the class, which reads/writes into ptr[0]. + funcname = '_cffi_var_%s' % name + BFunc = self.ffi._typeof_locked(tp.get_c_name('*(*)(void)', name))[0] + function = module.load_function(BFunc, funcname) + ptr = function() + def getter(library): + return ptr[0] + def setter(library, value): + ptr[0] = value + setattr(type(library), name, property(getter, setter)) + type(library)._cffi_dir.append(name) + +cffimod_header = r''' +#include +#include +#include +#include +#include /* XXX for ssize_t on some platforms */ + +/* this block of #ifs should be kept exactly identical between + c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py + and cffi/_cffi_include.h */ +#if defined(_MSC_VER) +# include /* for alloca() */ +# if _MSC_VER < 1600 /* MSVC < 2010 */ + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; + typedef __int8 int_least8_t; + typedef __int16 int_least16_t; + typedef __int32 int_least32_t; + typedef __int64 int_least64_t; + typedef unsigned __int8 uint_least8_t; + typedef unsigned __int16 uint_least16_t; + typedef unsigned __int32 uint_least32_t; + typedef unsigned __int64 uint_least64_t; + typedef __int8 int_fast8_t; + typedef __int16 int_fast16_t; + typedef __int32 int_fast32_t; + typedef __int64 int_fast64_t; + typedef unsigned __int8 uint_fast8_t; + typedef unsigned __int16 uint_fast16_t; + typedef unsigned __int32 uint_fast32_t; + typedef unsigned __int64 uint_fast64_t; + typedef __int64 intmax_t; + typedef unsigned __int64 uintmax_t; +# else +# include +# endif +# if _MSC_VER < 1800 /* MSVC < 2013 */ +# ifndef __cplusplus + typedef unsigned char _Bool; +# endif +# endif +#else +# include +# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux) +# include +# endif +#endif +''' diff --git a/billinglayer/python/cffi/verifier.py b/billinglayer/python/cffi/verifier.py new file mode 100644 index 0000000..a500c78 --- /dev/null +++ b/billinglayer/python/cffi/verifier.py @@ -0,0 +1,307 @@ +# +# DEPRECATED: implementation for ffi.verify() +# +import sys, os, binascii, shutil, io +from . import __version_verifier_modules__ +from . import ffiplatform +from .error import VerificationError + +if sys.version_info >= (3, 3): + import importlib.machinery + def _extension_suffixes(): + return importlib.machinery.EXTENSION_SUFFIXES[:] +else: + import imp + def _extension_suffixes(): + return [suffix for suffix, _, type in imp.get_suffixes() + if type == imp.C_EXTENSION] + + +if sys.version_info >= (3,): + NativeIO = io.StringIO +else: + class NativeIO(io.BytesIO): + def write(self, s): + if isinstance(s, unicode): + s = s.encode('ascii') + super(NativeIO, self).write(s) + + +class Verifier(object): + + def __init__(self, ffi, preamble, tmpdir=None, modulename=None, + ext_package=None, tag='', force_generic_engine=False, + source_extension='.c', flags=None, relative_to=None, **kwds): + if ffi._parser._uses_new_feature: + raise VerificationError( + "feature not supported with ffi.verify(), but only " + "with ffi.set_source(): %s" % (ffi._parser._uses_new_feature,)) + self.ffi = ffi + self.preamble = preamble + if not modulename: + flattened_kwds = ffiplatform.flatten(kwds) + vengine_class = _locate_engine_class(ffi, force_generic_engine) + self._vengine = vengine_class(self) + self._vengine.patch_extension_kwds(kwds) + self.flags = flags + self.kwds = self.make_relative_to(kwds, relative_to) + # + if modulename: + if tag: + raise TypeError("can't specify both 'modulename' and 'tag'") + else: + key = '\x00'.join(['%d.%d' % sys.version_info[:2], + __version_verifier_modules__, + preamble, flattened_kwds] + + ffi._cdefsources) + if sys.version_info >= (3,): + key = key.encode('utf-8') + k1 = hex(binascii.crc32(key[0::2]) & 0xffffffff) + k1 = k1.lstrip('0x').rstrip('L') + k2 = hex(binascii.crc32(key[1::2]) & 0xffffffff) + k2 = k2.lstrip('0').rstrip('L') + modulename = '_cffi_%s_%s%s%s' % (tag, self._vengine._class_key, + k1, k2) + suffix = _get_so_suffixes()[0] + self.tmpdir = tmpdir or _caller_dir_pycache() + self.sourcefilename = os.path.join(self.tmpdir, modulename + source_extension) + self.modulefilename = os.path.join(self.tmpdir, modulename + suffix) + self.ext_package = ext_package + self._has_source = False + self._has_module = False + + def write_source(self, file=None): + """Write the C source code. It is produced in 'self.sourcefilename', + which can be tweaked beforehand.""" + with self.ffi._lock: + if self._has_source and file is None: + raise VerificationError( + "source code already written") + self._write_source(file) + + def compile_module(self): + """Write the C source code (if not done already) and compile it. + This produces a dynamic link library in 'self.modulefilename'.""" + with self.ffi._lock: + if self._has_module: + raise VerificationError("module already compiled") + if not self._has_source: + self._write_source() + self._compile_module() + + def load_library(self): + """Get a C module from this Verifier instance. + Returns an instance of a FFILibrary class that behaves like the + objects returned by ffi.dlopen(), but that delegates all + operations to the C module. If necessary, the C code is written + and compiled first. + """ + with self.ffi._lock: + if not self._has_module: + self._locate_module() + if not self._has_module: + if not self._has_source: + self._write_source() + self._compile_module() + return self._load_library() + + def get_module_name(self): + basename = os.path.basename(self.modulefilename) + # kill both the .so extension and the other .'s, as introduced + # by Python 3: 'basename.cpython-33m.so' + basename = basename.split('.', 1)[0] + # and the _d added in Python 2 debug builds --- but try to be + # conservative and not kill a legitimate _d + if basename.endswith('_d') and hasattr(sys, 'gettotalrefcount'): + basename = basename[:-2] + return basename + + def get_extension(self): + ffiplatform._hack_at_distutils() # backward compatibility hack + if not self._has_source: + with self.ffi._lock: + if not self._has_source: + self._write_source() + sourcename = ffiplatform.maybe_relative_path(self.sourcefilename) + modname = self.get_module_name() + return ffiplatform.get_extension(sourcename, modname, **self.kwds) + + def generates_python_module(self): + return self._vengine._gen_python_module + + def make_relative_to(self, kwds, relative_to): + if relative_to and os.path.dirname(relative_to): + dirname = os.path.dirname(relative_to) + kwds = kwds.copy() + for key in ffiplatform.LIST_OF_FILE_NAMES: + if key in kwds: + lst = kwds[key] + if not isinstance(lst, (list, tuple)): + raise TypeError("keyword '%s' should be a list or tuple" + % (key,)) + lst = [os.path.join(dirname, fn) for fn in lst] + kwds[key] = lst + return kwds + + # ---------- + + def _locate_module(self): + if not os.path.isfile(self.modulefilename): + if self.ext_package: + try: + pkg = __import__(self.ext_package, None, None, ['__doc__']) + except ImportError: + return # cannot import the package itself, give up + # (e.g. it might be called differently before installation) + path = pkg.__path__ + else: + path = None + filename = self._vengine.find_module(self.get_module_name(), path, + _get_so_suffixes()) + if filename is None: + return + self.modulefilename = filename + self._vengine.collect_types() + self._has_module = True + + def _write_source_to(self, file): + self._vengine._f = file + try: + self._vengine.write_source_to_f() + finally: + del self._vengine._f + + def _write_source(self, file=None): + if file is not None: + self._write_source_to(file) + else: + # Write our source file to an in memory file. + f = NativeIO() + self._write_source_to(f) + source_data = f.getvalue() + + # Determine if this matches the current file + if os.path.exists(self.sourcefilename): + with open(self.sourcefilename, "r") as fp: + needs_written = not (fp.read() == source_data) + else: + needs_written = True + + # Actually write the file out if it doesn't match + if needs_written: + _ensure_dir(self.sourcefilename) + with open(self.sourcefilename, "w") as fp: + fp.write(source_data) + + # Set this flag + self._has_source = True + + def _compile_module(self): + # compile this C source + tmpdir = os.path.dirname(self.sourcefilename) + outputfilename = ffiplatform.compile(tmpdir, self.get_extension()) + try: + same = ffiplatform.samefile(outputfilename, self.modulefilename) + except OSError: + same = False + if not same: + _ensure_dir(self.modulefilename) + shutil.move(outputfilename, self.modulefilename) + self._has_module = True + + def _load_library(self): + assert self._has_module + if self.flags is not None: + return self._vengine.load_library(self.flags) + else: + return self._vengine.load_library() + +# ____________________________________________________________ + +_FORCE_GENERIC_ENGINE = False # for tests + +def _locate_engine_class(ffi, force_generic_engine): + if _FORCE_GENERIC_ENGINE: + force_generic_engine = True + if not force_generic_engine: + if '__pypy__' in sys.builtin_module_names: + force_generic_engine = True + else: + try: + import _cffi_backend + except ImportError: + _cffi_backend = '?' + if ffi._backend is not _cffi_backend: + force_generic_engine = True + if force_generic_engine: + from . import vengine_gen + return vengine_gen.VGenericEngine + else: + from . import vengine_cpy + return vengine_cpy.VCPythonEngine + +# ____________________________________________________________ + +_TMPDIR = None + +def _caller_dir_pycache(): + if _TMPDIR: + return _TMPDIR + result = os.environ.get('CFFI_TMPDIR') + if result: + return result + filename = sys._getframe(2).f_code.co_filename + return os.path.abspath(os.path.join(os.path.dirname(filename), + '__pycache__')) + +def set_tmpdir(dirname): + """Set the temporary directory to use instead of __pycache__.""" + global _TMPDIR + _TMPDIR = dirname + +def cleanup_tmpdir(tmpdir=None, keep_so=False): + """Clean up the temporary directory by removing all files in it + called `_cffi_*.{c,so}` as well as the `build` subdirectory.""" + tmpdir = tmpdir or _caller_dir_pycache() + try: + filelist = os.listdir(tmpdir) + except OSError: + return + if keep_so: + suffix = '.c' # only remove .c files + else: + suffix = _get_so_suffixes()[0].lower() + for fn in filelist: + if fn.lower().startswith('_cffi_') and ( + fn.lower().endswith(suffix) or fn.lower().endswith('.c')): + try: + os.unlink(os.path.join(tmpdir, fn)) + except OSError: + pass + clean_dir = [os.path.join(tmpdir, 'build')] + for dir in clean_dir: + try: + for fn in os.listdir(dir): + fn = os.path.join(dir, fn) + if os.path.isdir(fn): + clean_dir.append(fn) + else: + os.unlink(fn) + except OSError: + pass + +def _get_so_suffixes(): + suffixes = _extension_suffixes() + if not suffixes: + # bah, no C_EXTENSION available. Occurs on pypy without cpyext + if sys.platform == 'win32': + suffixes = [".pyd"] + else: + suffixes = [".so"] + + return suffixes + +def _ensure_dir(filename): + dirname = os.path.dirname(filename) + if dirname and not os.path.isdir(dirname): + os.makedirs(dirname) diff --git a/billinglayer/python/charset_normalizer-3.2.0.dist-info/INSTALLER b/billinglayer/python/charset_normalizer-3.2.0.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/charset_normalizer-3.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/charset_normalizer-3.2.0.dist-info/LICENSE b/billinglayer/python/charset_normalizer-3.2.0.dist-info/LICENSE new file mode 100644 index 0000000..ad82355 --- /dev/null +++ b/billinglayer/python/charset_normalizer-3.2.0.dist-info/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 TAHRI Ahmed R. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/billinglayer/python/charset_normalizer-3.2.0.dist-info/METADATA b/billinglayer/python/charset_normalizer-3.2.0.dist-info/METADATA new file mode 100644 index 0000000..ca190e1 --- /dev/null +++ b/billinglayer/python/charset_normalizer-3.2.0.dist-info/METADATA @@ -0,0 +1,628 @@ +Metadata-Version: 2.1 +Name: charset-normalizer +Version: 3.2.0 +Summary: The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. +Home-page: https://github.com/Ousret/charset_normalizer +Author: Ahmed TAHRI +Author-email: ahmed.tahri@cloudnursery.dev +License: MIT +Project-URL: Bug Reports, https://github.com/Ousret/charset_normalizer/issues +Project-URL: Documentation, https://charset-normalizer.readthedocs.io/en/latest +Keywords: encoding,charset,charset-detector,detector,normalization,unicode,chardet,detect +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: MIT License +Classifier: Intended Audience :: Developers +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Text Processing :: Linguistic +Classifier: Topic :: Utilities +Classifier: Typing :: Typed +Requires-Python: >=3.7.0 +Description-Content-Type: text/markdown +License-File: LICENSE +Provides-Extra: unicode_backport + +

Charset Detection, for Everyone 👋

+ +

+ The Real First Universal Charset Detector
+ + + + + Download Count Total + + + + +

+ +> A library that helps you read text from an unknown charset encoding.
Motivated by `chardet`, +> I'm trying to resolve the issue by taking a new approach. +> All IANA character set names for which the Python core library provides codecs are supported. + +

+ >>>>> 👉 Try Me Online Now, Then Adopt Me 👈 <<<<< +

+ +This project offers you an alternative to **Universal Charset Encoding Detector**, also known as **Chardet**. + +| Feature | [Chardet](https://github.com/chardet/chardet) | Charset Normalizer | [cChardet](https://github.com/PyYoshi/cChardet) | +|--------------------------------------------------|:---------------------------------------------:|:------------------------------------------------------------------------------------------------------:|:-----------------------------------------------:| +| `Fast` | ❌
| ✅
| ✅
| +| `Universal**` | ❌ | ✅ | ❌ | +| `Reliable` **without** distinguishable standards | ❌ | ✅ | ✅ | +| `Reliable` **with** distinguishable standards | ✅ | ✅ | ✅ | +| `License` | LGPL-2.1
_restrictive_ | MIT | MPL-1.1
_restrictive_ | +| `Native Python` | ✅ | ✅ | ❌ | +| `Detect spoken language` | ❌ | ✅ | N/A | +| `UnicodeDecodeError Safety` | ❌ | ✅ | ❌ | +| `Whl Size` | 193.6 kB | 40 kB | ~200 kB | +| `Supported Encoding` | 33 | 🎉 [90](https://charset-normalizer.readthedocs.io/en/latest/user/support.html#supported-encodings) | 40 | + +

+Reading Normalized TextCat Reading Text + +*\*\* : They are clearly using specific code for a specific encoding even if covering most of used one*
+Did you got there because of the logs? See [https://charset-normalizer.readthedocs.io/en/latest/user/miscellaneous.html](https://charset-normalizer.readthedocs.io/en/latest/user/miscellaneous.html) + +## ⚡ Performance + +This package offer better performance than its counterpart Chardet. Here are some numbers. + +| Package | Accuracy | Mean per file (ms) | File per sec (est) | +|-----------------------------------------------|:--------:|:------------------:|:------------------:| +| [chardet](https://github.com/chardet/chardet) | 86 % | 200 ms | 5 file/sec | +| charset-normalizer | **98 %** | **10 ms** | 100 file/sec | + +| Package | 99th percentile | 95th percentile | 50th percentile | +|-----------------------------------------------|:---------------:|:---------------:|:---------------:| +| [chardet](https://github.com/chardet/chardet) | 1200 ms | 287 ms | 23 ms | +| charset-normalizer | 100 ms | 50 ms | 5 ms | + +Chardet's performance on larger file (1MB+) are very poor. Expect huge difference on large payload. + +> Stats are generated using 400+ files using default parameters. More details on used files, see GHA workflows. +> And yes, these results might change at any time. The dataset can be updated to include more files. +> The actual delays heavily depends on your CPU capabilities. The factors should remain the same. +> Keep in mind that the stats are generous and that Chardet accuracy vs our is measured using Chardet initial capability +> (eg. Supported Encoding) Challenge-them if you want. + +## ✨ Installation + +Using pip: + +```sh +pip install charset-normalizer -U +``` + +## 🚀 Basic Usage + +### CLI +This package comes with a CLI. + +``` +usage: normalizer [-h] [-v] [-a] [-n] [-m] [-r] [-f] [-t THRESHOLD] + file [file ...] + +The Real First Universal Charset Detector. Discover originating encoding used +on text file. Normalize text to unicode. + +positional arguments: + files File(s) to be analysed + +optional arguments: + -h, --help show this help message and exit + -v, --verbose Display complementary information about file if any. + Stdout will contain logs about the detection process. + -a, --with-alternative + Output complementary possibilities if any. Top-level + JSON WILL be a list. + -n, --normalize Permit to normalize input file. If not set, program + does not write anything. + -m, --minimal Only output the charset detected to STDOUT. Disabling + JSON output. + -r, --replace Replace file when trying to normalize it instead of + creating a new one. + -f, --force Replace file without asking if you are sure, use this + flag with caution. + -t THRESHOLD, --threshold THRESHOLD + Define a custom maximum amount of chaos allowed in + decoded content. 0. <= chaos <= 1. + --version Show version information and exit. +``` + +```bash +normalizer ./data/sample.1.fr.srt +``` + +🎉 Since version 1.4.0 the CLI produce easily usable stdout result in JSON format. + +```json +{ + "path": "/home/default/projects/charset_normalizer/data/sample.1.fr.srt", + "encoding": "cp1252", + "encoding_aliases": [ + "1252", + "windows_1252" + ], + "alternative_encodings": [ + "cp1254", + "cp1256", + "cp1258", + "iso8859_14", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_9", + "latin_1", + "mbcs" + ], + "language": "French", + "alphabets": [ + "Basic Latin", + "Latin-1 Supplement" + ], + "has_sig_or_bom": false, + "chaos": 0.149, + "coherence": 97.152, + "unicode_path": null, + "is_preferred": true +} +``` + +### Python +*Just print out normalized text* +```python +from charset_normalizer import from_path + +results = from_path('./my_subtitle.srt') + +print(str(results.best())) +``` + +*Upgrade your code without effort* +```python +from charset_normalizer import detect +``` + +The above code will behave the same as **chardet**. We ensure that we offer the best (reasonable) BC result possible. + +See the docs for advanced usage : [readthedocs.io](https://charset-normalizer.readthedocs.io/en/latest/) + +## 😇 Why + +When I started using Chardet, I noticed that it was not suited to my expectations, and I wanted to propose a +reliable alternative using a completely different method. Also! I never back down on a good challenge! + +I **don't care** about the **originating charset** encoding, because **two different tables** can +produce **two identical rendered string.** +What I want is to get readable text, the best I can. + +In a way, **I'm brute forcing text decoding.** How cool is that ? 😎 + +Don't confuse package **ftfy** with charset-normalizer or chardet. ftfy goal is to repair unicode string whereas charset-normalizer to convert raw file in unknown encoding to unicode. + +## 🍰 How + + - Discard all charset encoding table that could not fit the binary content. + - Measure noise, or the mess once opened (by chunks) with a corresponding charset encoding. + - Extract matches with the lowest mess detected. + - Additionally, we measure coherence / probe for a language. + +**Wait a minute**, what is noise/mess and coherence according to **YOU ?** + +*Noise :* I opened hundred of text files, **written by humans**, with the wrong encoding table. **I observed**, then +**I established** some ground rules about **what is obvious** when **it seems like** a mess. + I know that my interpretation of what is noise is probably incomplete, feel free to contribute in order to + improve or rewrite it. + +*Coherence :* For each language there is on earth, we have computed ranked letter appearance occurrences (the best we can). So I thought +that intel is worth something here. So I use those records against decoded text to check if I can detect intelligent design. + +## ⚡ Known limitations + + - Language detection is unreliable when text contains two or more languages sharing identical letters. (eg. HTML (english tags) + Turkish content (Sharing Latin characters)) + - Every charset detector heavily depends on sufficient content. In common cases, do not bother run detection on very tiny content. + +## ⚠️ About Python EOLs + +**If you are running:** + +- Python >=2.7,<3.5: Unsupported +- Python 3.5: charset-normalizer < 2.1 +- Python 3.6: charset-normalizer < 3.1 + +Upgrade your Python interpreter as soon as possible. + +## 👤 Contributing + +Contributions, issues and feature requests are very much welcome.
+Feel free to check [issues page](https://github.com/ousret/charset_normalizer/issues) if you want to contribute. + +## 📝 License + +Copyright © [Ahmed TAHRI @Ousret](https://github.com/Ousret).
+This project is [MIT](https://github.com/Ousret/charset_normalizer/blob/master/LICENSE) licensed. + +Characters frequencies used in this project © 2012 [Denny Vrandečić](http://simia.net/letters/) + +## 💼 For Enterprise + +Professional support for charset-normalizer is available as part of the [Tidelift +Subscription][1]. Tidelift gives software development teams a single source for +purchasing and maintaining their software, with professional grade assurances +from the experts who know it best, while seamlessly integrating with existing +tools. + +[1]: https://tidelift.com/subscription/pkg/pypi-charset-normalizer?utm_source=pypi-charset-normalizer&utm_medium=readme + +# Changelog +All notable changes to charset-normalizer will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## [3.2.0](https://github.com/Ousret/charset_normalizer/compare/3.1.0...3.2.0) (2023-06-07) + +### Changed +- Typehint for function `from_path` no longer enforce `PathLike` as its first argument +- Minor improvement over the global detection reliability + +### Added +- Introduce function `is_binary` that relies on main capabilities, and optimized to detect binaries +- Propagate `enable_fallback` argument throughout `from_bytes`, `from_path`, and `from_fp` that allow a deeper control over the detection (default True) +- Explicit support for Python 3.12 + +### Fixed +- Edge case detection failure where a file would contain 'very-long' camel cased word (Issue #289) + +## [3.1.0](https://github.com/Ousret/charset_normalizer/compare/3.0.1...3.1.0) (2023-03-06) + +### Added +- Argument `should_rename_legacy` for legacy function `detect` and disregard any new arguments without errors (PR #262) + +### Removed +- Support for Python 3.6 (PR #260) + +### Changed +- Optional speedup provided by mypy/c 1.0.1 + +## [3.0.1](https://github.com/Ousret/charset_normalizer/compare/3.0.0...3.0.1) (2022-11-18) + +### Fixed +- Multi-bytes cutter/chunk generator did not always cut correctly (PR #233) + +### Changed +- Speedup provided by mypy/c 0.990 on Python >= 3.7 + +## [3.0.0](https://github.com/Ousret/charset_normalizer/compare/2.1.1...3.0.0) (2022-10-20) + +### Added +- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results +- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES +- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio +- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) + +### Changed +- Build with static metadata using 'build' frontend +- Make the language detection stricter +- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 + +### Fixed +- CLI with opt --normalize fail when using full path for files +- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it +- Sphinx warnings when generating the documentation + +### Removed +- Coherence detector no longer return 'Simple English' instead return 'English' +- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' +- Breaking: Method `first()` and `best()` from CharsetMatch +- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) +- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches +- Breaking: Top-level function `normalize` +- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch +- Support for the backport `unicodedata2` + +## [3.0.0rc1](https://github.com/Ousret/charset_normalizer/compare/3.0.0b2...3.0.0rc1) (2022-10-18) + +### Added +- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results +- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES +- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio + +### Changed +- Build with static metadata using 'build' frontend +- Make the language detection stricter + +### Fixed +- CLI with opt --normalize fail when using full path for files +- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it + +### Removed +- Coherence detector no longer return 'Simple English' instead return 'English' +- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' + +## [3.0.0b2](https://github.com/Ousret/charset_normalizer/compare/3.0.0b1...3.0.0b2) (2022-08-21) + +### Added +- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) + +### Removed +- Breaking: Method `first()` and `best()` from CharsetMatch +- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) + +### Fixed +- Sphinx warnings when generating the documentation + +## [3.0.0b1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...3.0.0b1) (2022-08-15) + +### Changed +- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 + +### Removed +- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches +- Breaking: Top-level function `normalize` +- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch +- Support for the backport `unicodedata2` + +## [2.1.1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...2.1.1) (2022-08-19) + +### Deprecated +- Function `normalize` scheduled for removal in 3.0 + +### Changed +- Removed useless call to decode in fn is_unprintable (#206) + +### Fixed +- Third-party library (i18n xgettext) crashing not recognizing utf_8 (PEP 263) with underscore from [@aleksandernovikov](https://github.com/aleksandernovikov) (#204) + +## [2.1.0](https://github.com/Ousret/charset_normalizer/compare/2.0.12...2.1.0) (2022-06-19) + +### Added +- Output the Unicode table version when running the CLI with `--version` (PR #194) + +### Changed +- Re-use decoded buffer for single byte character sets from [@nijel](https://github.com/nijel) (PR #175) +- Fixing some performance bottlenecks from [@deedy5](https://github.com/deedy5) (PR #183) + +### Fixed +- Workaround potential bug in cpython with Zero Width No-Break Space located in Arabic Presentation Forms-B, Unicode 1.1 not acknowledged as space (PR #175) +- CLI default threshold aligned with the API threshold from [@oleksandr-kuzmenko](https://github.com/oleksandr-kuzmenko) (PR #181) + +### Removed +- Support for Python 3.5 (PR #192) + +### Deprecated +- Use of backport unicodedata from `unicodedata2` as Python is quickly catching up, scheduled for removal in 3.0 (PR #194) + +## [2.0.12](https://github.com/Ousret/charset_normalizer/compare/2.0.11...2.0.12) (2022-02-12) + +### Fixed +- ASCII miss-detection on rare cases (PR #170) + +## [2.0.11](https://github.com/Ousret/charset_normalizer/compare/2.0.10...2.0.11) (2022-01-30) + +### Added +- Explicit support for Python 3.11 (PR #164) + +### Changed +- The logging behavior have been completely reviewed, now using only TRACE and DEBUG levels (PR #163 #165) + +## [2.0.10](https://github.com/Ousret/charset_normalizer/compare/2.0.9...2.0.10) (2022-01-04) + +### Fixed +- Fallback match entries might lead to UnicodeDecodeError for large bytes sequence (PR #154) + +### Changed +- Skipping the language-detection (CD) on ASCII (PR #155) + +## [2.0.9](https://github.com/Ousret/charset_normalizer/compare/2.0.8...2.0.9) (2021-12-03) + +### Changed +- Moderating the logging impact (since 2.0.8) for specific environments (PR #147) + +### Fixed +- Wrong logging level applied when setting kwarg `explain` to True (PR #146) + +## [2.0.8](https://github.com/Ousret/charset_normalizer/compare/2.0.7...2.0.8) (2021-11-24) +### Changed +- Improvement over Vietnamese detection (PR #126) +- MD improvement on trailing data and long foreign (non-pure latin) data (PR #124) +- Efficiency improvements in cd/alphabet_languages from [@adbar](https://github.com/adbar) (PR #122) +- call sum() without an intermediary list following PEP 289 recommendations from [@adbar](https://github.com/adbar) (PR #129) +- Code style as refactored by Sourcery-AI (PR #131) +- Minor adjustment on the MD around european words (PR #133) +- Remove and replace SRTs from assets / tests (PR #139) +- Initialize the library logger with a `NullHandler` by default from [@nmaynes](https://github.com/nmaynes) (PR #135) +- Setting kwarg `explain` to True will add provisionally (bounded to function lifespan) a specific stream handler (PR #135) + +### Fixed +- Fix large (misleading) sequence giving UnicodeDecodeError (PR #137) +- Avoid using too insignificant chunk (PR #137) + +### Added +- Add and expose function `set_logging_handler` to configure a specific StreamHandler from [@nmaynes](https://github.com/nmaynes) (PR #135) +- Add `CHANGELOG.md` entries, format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) (PR #141) + +## [2.0.7](https://github.com/Ousret/charset_normalizer/compare/2.0.6...2.0.7) (2021-10-11) +### Added +- Add support for Kazakh (Cyrillic) language detection (PR #109) + +### Changed +- Further, improve inferring the language from a given single-byte code page (PR #112) +- Vainly trying to leverage PEP263 when PEP3120 is not supported (PR #116) +- Refactoring for potential performance improvements in loops from [@adbar](https://github.com/adbar) (PR #113) +- Various detection improvement (MD+CD) (PR #117) + +### Removed +- Remove redundant logging entry about detected language(s) (PR #115) + +### Fixed +- Fix a minor inconsistency between Python 3.5 and other versions regarding language detection (PR #117 #102) + +## [2.0.6](https://github.com/Ousret/charset_normalizer/compare/2.0.5...2.0.6) (2021-09-18) +### Fixed +- Unforeseen regression with the loss of the backward-compatibility with some older minor of Python 3.5.x (PR #100) +- Fix CLI crash when using --minimal output in certain cases (PR #103) + +### Changed +- Minor improvement to the detection efficiency (less than 1%) (PR #106 #101) + +## [2.0.5](https://github.com/Ousret/charset_normalizer/compare/2.0.4...2.0.5) (2021-09-14) +### Changed +- The project now comply with: flake8, mypy, isort and black to ensure a better overall quality (PR #81) +- The BC-support with v1.x was improved, the old staticmethods are restored (PR #82) +- The Unicode detection is slightly improved (PR #93) +- Add syntax sugar \_\_bool\_\_ for results CharsetMatches list-container (PR #91) + +### Removed +- The project no longer raise warning on tiny content given for detection, will be simply logged as warning instead (PR #92) + +### Fixed +- In some rare case, the chunks extractor could cut in the middle of a multi-byte character and could mislead the mess detection (PR #95) +- Some rare 'space' characters could trip up the UnprintablePlugin/Mess detection (PR #96) +- The MANIFEST.in was not exhaustive (PR #78) + +## [2.0.4](https://github.com/Ousret/charset_normalizer/compare/2.0.3...2.0.4) (2021-07-30) +### Fixed +- The CLI no longer raise an unexpected exception when no encoding has been found (PR #70) +- Fix accessing the 'alphabets' property when the payload contains surrogate characters (PR #68) +- The logger could mislead (explain=True) on detected languages and the impact of one MBCS match (PR #72) +- Submatch factoring could be wrong in rare edge cases (PR #72) +- Multiple files given to the CLI were ignored when publishing results to STDOUT. (After the first path) (PR #72) +- Fix line endings from CRLF to LF for certain project files (PR #67) + +### Changed +- Adjust the MD to lower the sensitivity, thus improving the global detection reliability (PR #69 #76) +- Allow fallback on specified encoding if any (PR #71) + +## [2.0.3](https://github.com/Ousret/charset_normalizer/compare/2.0.2...2.0.3) (2021-07-16) +### Changed +- Part of the detection mechanism has been improved to be less sensitive, resulting in more accurate detection results. Especially ASCII. (PR #63) +- According to the community wishes, the detection will fall back on ASCII or UTF-8 in a last-resort case. (PR #64) + +## [2.0.2](https://github.com/Ousret/charset_normalizer/compare/2.0.1...2.0.2) (2021-07-15) +### Fixed +- Empty/Too small JSON payload miss-detection fixed. Report from [@tseaver](https://github.com/tseaver) (PR #59) + +### Changed +- Don't inject unicodedata2 into sys.modules from [@akx](https://github.com/akx) (PR #57) + +## [2.0.1](https://github.com/Ousret/charset_normalizer/compare/2.0.0...2.0.1) (2021-07-13) +### Fixed +- Make it work where there isn't a filesystem available, dropping assets frequencies.json. Report from [@sethmlarson](https://github.com/sethmlarson). (PR #55) +- Using explain=False permanently disable the verbose output in the current runtime (PR #47) +- One log entry (language target preemptive) was not show in logs when using explain=True (PR #47) +- Fix undesired exception (ValueError) on getitem of instance CharsetMatches (PR #52) + +### Changed +- Public function normalize default args values were not aligned with from_bytes (PR #53) + +### Added +- You may now use charset aliases in cp_isolation and cp_exclusion arguments (PR #47) + +## [2.0.0](https://github.com/Ousret/charset_normalizer/compare/1.4.1...2.0.0) (2021-07-02) +### Changed +- 4x to 5 times faster than the previous 1.4.0 release. At least 2x faster than Chardet. +- Accent has been made on UTF-8 detection, should perform rather instantaneous. +- The backward compatibility with Chardet has been greatly improved. The legacy detect function returns an identical charset name whenever possible. +- The detection mechanism has been slightly improved, now Turkish content is detected correctly (most of the time) +- The program has been rewritten to ease the readability and maintainability. (+Using static typing)+ +- utf_7 detection has been reinstated. + +### Removed +- This package no longer require anything when used with Python 3.5 (Dropped cached_property) +- Removed support for these languages: Catalan, Esperanto, Kazakh, Baque, Volapük, Azeri, Galician, Nynorsk, Macedonian, and Serbocroatian. +- The exception hook on UnicodeDecodeError has been removed. + +### Deprecated +- Methods coherence_non_latin, w_counter, chaos_secondary_pass of the class CharsetMatch are now deprecated and scheduled for removal in v3.0 + +### Fixed +- The CLI output used the relative path of the file(s). Should be absolute. + +## [1.4.1](https://github.com/Ousret/charset_normalizer/compare/1.4.0...1.4.1) (2021-05-28) +### Fixed +- Logger configuration/usage no longer conflict with others (PR #44) + +## [1.4.0](https://github.com/Ousret/charset_normalizer/compare/1.3.9...1.4.0) (2021-05-21) +### Removed +- Using standard logging instead of using the package loguru. +- Dropping nose test framework in favor of the maintained pytest. +- Choose to not use dragonmapper package to help with gibberish Chinese/CJK text. +- Require cached_property only for Python 3.5 due to constraint. Dropping for every other interpreter version. +- Stop support for UTF-7 that does not contain a SIG. +- Dropping PrettyTable, replaced with pure JSON output in CLI. + +### Fixed +- BOM marker in a CharsetNormalizerMatch instance could be False in rare cases even if obviously present. Due to the sub-match factoring process. +- Not searching properly for the BOM when trying utf32/16 parent codec. + +### Changed +- Improving the package final size by compressing frequencies.json. +- Huge improvement over the larges payload. + +### Added +- CLI now produces JSON consumable output. +- Return ASCII if given sequences fit. Given reasonable confidence. + +## [1.3.9](https://github.com/Ousret/charset_normalizer/compare/1.3.8...1.3.9) (2021-05-13) + +### Fixed +- In some very rare cases, you may end up getting encode/decode errors due to a bad bytes payload (PR #40) + +## [1.3.8](https://github.com/Ousret/charset_normalizer/compare/1.3.7...1.3.8) (2021-05-12) + +### Fixed +- Empty given payload for detection may cause an exception if trying to access the `alphabets` property. (PR #39) + +## [1.3.7](https://github.com/Ousret/charset_normalizer/compare/1.3.6...1.3.7) (2021-05-12) + +### Fixed +- The legacy detect function should return UTF-8-SIG if sig is present in the payload. (PR #38) + +## [1.3.6](https://github.com/Ousret/charset_normalizer/compare/1.3.5...1.3.6) (2021-02-09) + +### Changed +- Amend the previous release to allow prettytable 2.0 (PR #35) + +## [1.3.5](https://github.com/Ousret/charset_normalizer/compare/1.3.4...1.3.5) (2021-02-08) + +### Fixed +- Fix error while using the package with a python pre-release interpreter (PR #33) + +### Changed +- Dependencies refactoring, constraints revised. + +### Added +- Add python 3.9 and 3.10 to the supported interpreters + +MIT License + +Copyright (c) 2019 TAHRI Ahmed R. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/billinglayer/python/charset_normalizer-3.2.0.dist-info/RECORD b/billinglayer/python/charset_normalizer-3.2.0.dist-info/RECORD new file mode 100644 index 0000000..5cd4703 --- /dev/null +++ b/billinglayer/python/charset_normalizer-3.2.0.dist-info/RECORD @@ -0,0 +1,35 @@ +../../bin/normalizer,sha256=s96Kuek2W41Ri7tEiehraywrWWFl5pttBZvlFrupd74,252 +charset_normalizer-3.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +charset_normalizer-3.2.0.dist-info/LICENSE,sha256=6zGgxaT7Cbik4yBV0lweX5w1iidS_vPNcgIT0cz-4kE,1070 +charset_normalizer-3.2.0.dist-info/METADATA,sha256=K2QHhX9fQ7jFxO7y4IQk7TqYZSH7iTyxgTJQxA65EH0,31284 +charset_normalizer-3.2.0.dist-info/RECORD,, +charset_normalizer-3.2.0.dist-info/WHEEL,sha256=8KU227XctfdX2qUwyjQUO-ciQuZtmyPUCKmeGV6Byto,152 +charset_normalizer-3.2.0.dist-info/entry_points.txt,sha256=uYo8aIGLWv8YgWfSna5HnfY_En4pkF1w4bgawNAXzP0,76 +charset_normalizer-3.2.0.dist-info/top_level.txt,sha256=7ASyzePr8_xuZWJsnqJjIBtyV8vhEo0wBCv1MPRRi3Q,19 +charset_normalizer/__init__.py,sha256=UzI3xC8PhmcLRMzSgPb6minTmRq0kWznnCBJ8ZCc2XI,1577 +charset_normalizer/__pycache__/__init__.cpython-311.pyc,, +charset_normalizer/__pycache__/api.cpython-311.pyc,, +charset_normalizer/__pycache__/cd.cpython-311.pyc,, +charset_normalizer/__pycache__/constant.cpython-311.pyc,, +charset_normalizer/__pycache__/legacy.cpython-311.pyc,, +charset_normalizer/__pycache__/md.cpython-311.pyc,, +charset_normalizer/__pycache__/models.cpython-311.pyc,, +charset_normalizer/__pycache__/utils.cpython-311.pyc,, +charset_normalizer/__pycache__/version.cpython-311.pyc,, +charset_normalizer/api.py,sha256=WOlWjy6wT8SeMYFpaGbXZFN1TMXa-s8vZYfkL4G29iQ,21097 +charset_normalizer/assets/__init__.py,sha256=wpRfujN7GJuEE5wHHo3wEDVoJ5ovzRIxsImyimCBfGU,20069 +charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc,, +charset_normalizer/cd.py,sha256=mZuiTSKq4XpweSDD2H4T4R3Axtaa-QS0tpEWdpMuAzQ,12554 +charset_normalizer/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc,, +charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc,, +charset_normalizer/cli/normalizer.py,sha256=2F-xURZJzo063Ye-2RLJ2wcmURpbKeAzKwpiws65dAs,9744 +charset_normalizer/constant.py,sha256=PmCeoKXqq3ZbCtCUpKHwwFBIv9DXMT_an1yd24q28mA,19101 +charset_normalizer/legacy.py,sha256=T-QuVMsMeDiQEk8WSszMrzVJg_14AMeSkmHdRYhdl1k,2071 +charset_normalizer/md.cpython-311-x86_64-linux-gnu.so,sha256=drk8jTNY7lZ9fU8bZ_e8bFSbF5erdCt5BCN8lI49IZ0,17496 +charset_normalizer/md.py,sha256=gEWM354DqBsiSoNkKzFrIW4KRFQjQLbqYnbHAdBwj74,18682 +charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so,sha256=YZtTuQgOU2p-fpmS6PZJBbjPI0M-IDmYj_7urdONnIQ,418056 +charset_normalizer/models.py,sha256=mC11wo84l00u2o03TRNX7M5ItBAbPUKKXgJSFxA35GY,11492 +charset_normalizer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +charset_normalizer/utils.py,sha256=HdwmBy9vRqcRVGHKZqYWtpiS5wA35cLjnlVQCm0Bq9s,11578 +charset_normalizer/version.py,sha256=LbH8odlzMnwR4xZF9wCsnGXQA19axDO7HZ-J9hegIX0,79 diff --git a/billinglayer/python/charset_normalizer-3.2.0.dist-info/WHEEL b/billinglayer/python/charset_normalizer-3.2.0.dist-info/WHEEL new file mode 100644 index 0000000..3bed0cb --- /dev/null +++ b/billinglayer/python/charset_normalizer-3.2.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.40.0) +Root-Is-Purelib: false +Tag: cp311-cp311-manylinux_2_17_x86_64 +Tag: cp311-cp311-manylinux2014_x86_64 + diff --git a/billinglayer/python/charset_normalizer-3.2.0.dist-info/entry_points.txt b/billinglayer/python/charset_normalizer-3.2.0.dist-info/entry_points.txt new file mode 100644 index 0000000..a06d360 --- /dev/null +++ b/billinglayer/python/charset_normalizer-3.2.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +normalizer = charset_normalizer.cli.normalizer:cli_detect diff --git a/billinglayer/python/charset_normalizer-3.2.0.dist-info/top_level.txt b/billinglayer/python/charset_normalizer-3.2.0.dist-info/top_level.txt new file mode 100644 index 0000000..66958f0 --- /dev/null +++ b/billinglayer/python/charset_normalizer-3.2.0.dist-info/top_level.txt @@ -0,0 +1 @@ +charset_normalizer diff --git a/billinglayer/python/charset_normalizer/__init__.py b/billinglayer/python/charset_normalizer/__init__.py new file mode 100644 index 0000000..55991fc --- /dev/null +++ b/billinglayer/python/charset_normalizer/__init__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +""" +Charset-Normalizer +~~~~~~~~~~~~~~ +The Real First Universal Charset Detector. +A library that helps you read text from an unknown charset encoding. +Motivated by chardet, This package is trying to resolve the issue by taking a new approach. +All IANA character set names for which the Python core library provides codecs are supported. + +Basic usage: + >>> from charset_normalizer import from_bytes + >>> results = from_bytes('Bсеки човек има право на образование. Oбразованието!'.encode('utf_8')) + >>> best_guess = results.best() + >>> str(best_guess) + 'Bсеки човек има право на образование. Oбразованието!' + +Others methods and usages are available - see the full documentation +at . +:copyright: (c) 2021 by Ahmed TAHRI +:license: MIT, see LICENSE for more details. +""" +import logging + +from .api import from_bytes, from_fp, from_path, is_binary +from .legacy import detect +from .models import CharsetMatch, CharsetMatches +from .utils import set_logging_handler +from .version import VERSION, __version__ + +__all__ = ( + "from_fp", + "from_path", + "from_bytes", + "is_binary", + "detect", + "CharsetMatch", + "CharsetMatches", + "__version__", + "VERSION", + "set_logging_handler", +) + +# Attach a NullHandler to the top level logger by default +# https://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library + +logging.getLogger("charset_normalizer").addHandler(logging.NullHandler()) diff --git a/billinglayer/python/charset_normalizer/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e7d23ae Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/api.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/api.cpython-311.pyc new file mode 100644 index 0000000..369c017 Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/api.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/cd.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/cd.cpython-311.pyc new file mode 100644 index 0000000..40417de Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/cd.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/constant.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/constant.cpython-311.pyc new file mode 100644 index 0000000..d26dee0 Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/constant.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/legacy.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/legacy.cpython-311.pyc new file mode 100644 index 0000000..97756d8 Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/legacy.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/md.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/md.cpython-311.pyc new file mode 100644 index 0000000..c564ae1 Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/md.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/models.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..b5bd4c1 Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/models.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/utils.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..87869b7 Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/utils.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/__pycache__/version.cpython-311.pyc b/billinglayer/python/charset_normalizer/__pycache__/version.cpython-311.pyc new file mode 100644 index 0000000..d7dc94f Binary files /dev/null and b/billinglayer/python/charset_normalizer/__pycache__/version.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/api.py b/billinglayer/python/charset_normalizer/api.py new file mode 100644 index 0000000..0ba08e3 --- /dev/null +++ b/billinglayer/python/charset_normalizer/api.py @@ -0,0 +1,626 @@ +import logging +from os import PathLike +from typing import BinaryIO, List, Optional, Set, Union + +from .cd import ( + coherence_ratio, + encoding_languages, + mb_encoding_languages, + merge_coherence_ratios, +) +from .constant import IANA_SUPPORTED, TOO_BIG_SEQUENCE, TOO_SMALL_SEQUENCE, TRACE +from .md import mess_ratio +from .models import CharsetMatch, CharsetMatches +from .utils import ( + any_specified_encoding, + cut_sequence_chunks, + iana_name, + identify_sig_or_bom, + is_cp_similar, + is_multi_byte_encoding, + should_strip_sig_or_bom, +) + +# Will most likely be controversial +# logging.addLevelName(TRACE, "TRACE") +logger = logging.getLogger("charset_normalizer") +explain_handler = logging.StreamHandler() +explain_handler.setFormatter( + logging.Formatter("%(asctime)s | %(levelname)s | %(message)s") +) + + +def from_bytes( + sequences: Union[bytes, bytearray], + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.2, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = True, +) -> CharsetMatches: + """ + Given a raw bytes sequence, return the best possibles charset usable to render str objects. + If there is no results, it is a strong indicator that the source is binary/not text. + By default, the process will extract 5 blocks of 512o each to assess the mess and coherence of a given sequence. + And will give up a particular code page after 20% of measured mess. Those criteria are customizable at will. + + The preemptive behavior DOES NOT replace the traditional detection workflow, it prioritize a particular code page + but never take it for granted. Can improve the performance. + + You may want to focus your attention to some code page or/and not others, use cp_isolation and cp_exclusion for that + purpose. + + This function will strip the SIG in the payload/sequence every time except on UTF-16, UTF-32. + By default the library does not setup any handler other than the NullHandler, if you choose to set the 'explain' + toggle to True it will alter the logger configuration to add a StreamHandler that is suitable for debugging. + Custom logging format and handler can be set manually. + """ + + if not isinstance(sequences, (bytearray, bytes)): + raise TypeError( + "Expected object of type bytes or bytearray, got: {0}".format( + type(sequences) + ) + ) + + if explain: + previous_logger_level: int = logger.level + logger.addHandler(explain_handler) + logger.setLevel(TRACE) + + length: int = len(sequences) + + if length == 0: + logger.debug("Encoding detection on empty bytes, assuming utf_8 intention.") + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level or logging.WARNING) + return CharsetMatches([CharsetMatch(sequences, "utf_8", 0.0, False, [], "")]) + + if cp_isolation is not None: + logger.log( + TRACE, + "cp_isolation is set. use this flag for debugging purpose. " + "limited list of encoding allowed : %s.", + ", ".join(cp_isolation), + ) + cp_isolation = [iana_name(cp, False) for cp in cp_isolation] + else: + cp_isolation = [] + + if cp_exclusion is not None: + logger.log( + TRACE, + "cp_exclusion is set. use this flag for debugging purpose. " + "limited list of encoding excluded : %s.", + ", ".join(cp_exclusion), + ) + cp_exclusion = [iana_name(cp, False) for cp in cp_exclusion] + else: + cp_exclusion = [] + + if length <= (chunk_size * steps): + logger.log( + TRACE, + "override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.", + steps, + chunk_size, + length, + ) + steps = 1 + chunk_size = length + + if steps > 1 and length / steps < chunk_size: + chunk_size = int(length / steps) + + is_too_small_sequence: bool = len(sequences) < TOO_SMALL_SEQUENCE + is_too_large_sequence: bool = len(sequences) >= TOO_BIG_SEQUENCE + + if is_too_small_sequence: + logger.log( + TRACE, + "Trying to detect encoding from a tiny portion of ({}) byte(s).".format( + length + ), + ) + elif is_too_large_sequence: + logger.log( + TRACE, + "Using lazy str decoding because the payload is quite large, ({}) byte(s).".format( + length + ), + ) + + prioritized_encodings: List[str] = [] + + specified_encoding: Optional[str] = ( + any_specified_encoding(sequences) if preemptive_behaviour else None + ) + + if specified_encoding is not None: + prioritized_encodings.append(specified_encoding) + logger.log( + TRACE, + "Detected declarative mark in sequence. Priority +1 given for %s.", + specified_encoding, + ) + + tested: Set[str] = set() + tested_but_hard_failure: List[str] = [] + tested_but_soft_failure: List[str] = [] + + fallback_ascii: Optional[CharsetMatch] = None + fallback_u8: Optional[CharsetMatch] = None + fallback_specified: Optional[CharsetMatch] = None + + results: CharsetMatches = CharsetMatches() + + sig_encoding, sig_payload = identify_sig_or_bom(sequences) + + if sig_encoding is not None: + prioritized_encodings.append(sig_encoding) + logger.log( + TRACE, + "Detected a SIG or BOM mark on first %i byte(s). Priority +1 given for %s.", + len(sig_payload), + sig_encoding, + ) + + prioritized_encodings.append("ascii") + + if "utf_8" not in prioritized_encodings: + prioritized_encodings.append("utf_8") + + for encoding_iana in prioritized_encodings + IANA_SUPPORTED: + if cp_isolation and encoding_iana not in cp_isolation: + continue + + if cp_exclusion and encoding_iana in cp_exclusion: + continue + + if encoding_iana in tested: + continue + + tested.add(encoding_iana) + + decoded_payload: Optional[str] = None + bom_or_sig_available: bool = sig_encoding == encoding_iana + strip_sig_or_bom: bool = bom_or_sig_available and should_strip_sig_or_bom( + encoding_iana + ) + + if encoding_iana in {"utf_16", "utf_32"} and not bom_or_sig_available: + logger.log( + TRACE, + "Encoding %s won't be tested as-is because it require a BOM. Will try some sub-encoder LE/BE.", + encoding_iana, + ) + continue + if encoding_iana in {"utf_7"} and not bom_or_sig_available: + logger.log( + TRACE, + "Encoding %s won't be tested as-is because detection is unreliable without BOM/SIG.", + encoding_iana, + ) + continue + + try: + is_multi_byte_decoder: bool = is_multi_byte_encoding(encoding_iana) + except (ModuleNotFoundError, ImportError): + logger.log( + TRACE, + "Encoding %s does not provide an IncrementalDecoder", + encoding_iana, + ) + continue + + try: + if is_too_large_sequence and is_multi_byte_decoder is False: + str( + sequences[: int(50e4)] + if strip_sig_or_bom is False + else sequences[len(sig_payload) : int(50e4)], + encoding=encoding_iana, + ) + else: + decoded_payload = str( + sequences + if strip_sig_or_bom is False + else sequences[len(sig_payload) :], + encoding=encoding_iana, + ) + except (UnicodeDecodeError, LookupError) as e: + if not isinstance(e, LookupError): + logger.log( + TRACE, + "Code page %s does not fit given bytes sequence at ALL. %s", + encoding_iana, + str(e), + ) + tested_but_hard_failure.append(encoding_iana) + continue + + similar_soft_failure_test: bool = False + + for encoding_soft_failed in tested_but_soft_failure: + if is_cp_similar(encoding_iana, encoding_soft_failed): + similar_soft_failure_test = True + break + + if similar_soft_failure_test: + logger.log( + TRACE, + "%s is deemed too similar to code page %s and was consider unsuited already. Continuing!", + encoding_iana, + encoding_soft_failed, + ) + continue + + r_ = range( + 0 if not bom_or_sig_available else len(sig_payload), + length, + int(length / steps), + ) + + multi_byte_bonus: bool = ( + is_multi_byte_decoder + and decoded_payload is not None + and len(decoded_payload) < length + ) + + if multi_byte_bonus: + logger.log( + TRACE, + "Code page %s is a multi byte encoding table and it appear that at least one character " + "was encoded using n-bytes.", + encoding_iana, + ) + + max_chunk_gave_up: int = int(len(r_) / 4) + + max_chunk_gave_up = max(max_chunk_gave_up, 2) + early_stop_count: int = 0 + lazy_str_hard_failure = False + + md_chunks: List[str] = [] + md_ratios = [] + + try: + for chunk in cut_sequence_chunks( + sequences, + encoding_iana, + r_, + chunk_size, + bom_or_sig_available, + strip_sig_or_bom, + sig_payload, + is_multi_byte_decoder, + decoded_payload, + ): + md_chunks.append(chunk) + + md_ratios.append( + mess_ratio( + chunk, + threshold, + explain is True and 1 <= len(cp_isolation) <= 2, + ) + ) + + if md_ratios[-1] >= threshold: + early_stop_count += 1 + + if (early_stop_count >= max_chunk_gave_up) or ( + bom_or_sig_available and strip_sig_or_bom is False + ): + break + except ( + UnicodeDecodeError + ) as e: # Lazy str loading may have missed something there + logger.log( + TRACE, + "LazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %s", + encoding_iana, + str(e), + ) + early_stop_count = max_chunk_gave_up + lazy_str_hard_failure = True + + # We might want to check the sequence again with the whole content + # Only if initial MD tests passes + if ( + not lazy_str_hard_failure + and is_too_large_sequence + and not is_multi_byte_decoder + ): + try: + sequences[int(50e3) :].decode(encoding_iana, errors="strict") + except UnicodeDecodeError as e: + logger.log( + TRACE, + "LazyStr Loading: After final lookup, code page %s does not fit given bytes sequence at ALL. %s", + encoding_iana, + str(e), + ) + tested_but_hard_failure.append(encoding_iana) + continue + + mean_mess_ratio: float = sum(md_ratios) / len(md_ratios) if md_ratios else 0.0 + if mean_mess_ratio >= threshold or early_stop_count >= max_chunk_gave_up: + tested_but_soft_failure.append(encoding_iana) + logger.log( + TRACE, + "%s was excluded because of initial chaos probing. Gave up %i time(s). " + "Computed mean chaos is %f %%.", + encoding_iana, + early_stop_count, + round(mean_mess_ratio * 100, ndigits=3), + ) + # Preparing those fallbacks in case we got nothing. + if ( + enable_fallback + and encoding_iana in ["ascii", "utf_8", specified_encoding] + and not lazy_str_hard_failure + ): + fallback_entry = CharsetMatch( + sequences, encoding_iana, threshold, False, [], decoded_payload + ) + if encoding_iana == specified_encoding: + fallback_specified = fallback_entry + elif encoding_iana == "ascii": + fallback_ascii = fallback_entry + else: + fallback_u8 = fallback_entry + continue + + logger.log( + TRACE, + "%s passed initial chaos probing. Mean measured chaos is %f %%", + encoding_iana, + round(mean_mess_ratio * 100, ndigits=3), + ) + + if not is_multi_byte_decoder: + target_languages: List[str] = encoding_languages(encoding_iana) + else: + target_languages = mb_encoding_languages(encoding_iana) + + if target_languages: + logger.log( + TRACE, + "{} should target any language(s) of {}".format( + encoding_iana, str(target_languages) + ), + ) + + cd_ratios = [] + + # We shall skip the CD when its about ASCII + # Most of the time its not relevant to run "language-detection" on it. + if encoding_iana != "ascii": + for chunk in md_chunks: + chunk_languages = coherence_ratio( + chunk, + language_threshold, + ",".join(target_languages) if target_languages else None, + ) + + cd_ratios.append(chunk_languages) + + cd_ratios_merged = merge_coherence_ratios(cd_ratios) + + if cd_ratios_merged: + logger.log( + TRACE, + "We detected language {} using {}".format( + cd_ratios_merged, encoding_iana + ), + ) + + results.append( + CharsetMatch( + sequences, + encoding_iana, + mean_mess_ratio, + bom_or_sig_available, + cd_ratios_merged, + decoded_payload, + ) + ) + + if ( + encoding_iana in [specified_encoding, "ascii", "utf_8"] + and mean_mess_ratio < 0.1 + ): + logger.debug( + "Encoding detection: %s is most likely the one.", encoding_iana + ) + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level) + return CharsetMatches([results[encoding_iana]]) + + if encoding_iana == sig_encoding: + logger.debug( + "Encoding detection: %s is most likely the one as we detected a BOM or SIG within " + "the beginning of the sequence.", + encoding_iana, + ) + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level) + return CharsetMatches([results[encoding_iana]]) + + if len(results) == 0: + if fallback_u8 or fallback_ascii or fallback_specified: + logger.log( + TRACE, + "Nothing got out of the detection process. Using ASCII/UTF-8/Specified fallback.", + ) + + if fallback_specified: + logger.debug( + "Encoding detection: %s will be used as a fallback match", + fallback_specified.encoding, + ) + results.append(fallback_specified) + elif ( + (fallback_u8 and fallback_ascii is None) + or ( + fallback_u8 + and fallback_ascii + and fallback_u8.fingerprint != fallback_ascii.fingerprint + ) + or (fallback_u8 is not None) + ): + logger.debug("Encoding detection: utf_8 will be used as a fallback match") + results.append(fallback_u8) + elif fallback_ascii: + logger.debug("Encoding detection: ascii will be used as a fallback match") + results.append(fallback_ascii) + + if results: + logger.debug( + "Encoding detection: Found %s as plausible (best-candidate) for content. With %i alternatives.", + results.best().encoding, # type: ignore + len(results) - 1, + ) + else: + logger.debug("Encoding detection: Unable to determine any suitable charset.") + + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level) + + return results + + +def from_fp( + fp: BinaryIO, + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.20, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = True, +) -> CharsetMatches: + """ + Same thing than the function from_bytes but using a file pointer that is already ready. + Will not close the file pointer. + """ + return from_bytes( + fp.read(), + steps, + chunk_size, + threshold, + cp_isolation, + cp_exclusion, + preemptive_behaviour, + explain, + language_threshold, + enable_fallback, + ) + + +def from_path( + path: Union[str, bytes, PathLike], # type: ignore[type-arg] + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.20, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = True, +) -> CharsetMatches: + """ + Same thing than the function from_bytes but with one extra step. Opening and reading given file path in binary mode. + Can raise IOError. + """ + with open(path, "rb") as fp: + return from_fp( + fp, + steps, + chunk_size, + threshold, + cp_isolation, + cp_exclusion, + preemptive_behaviour, + explain, + language_threshold, + enable_fallback, + ) + + +def is_binary( + fp_or_path_or_payload: Union[PathLike, str, BinaryIO, bytes], # type: ignore[type-arg] + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.20, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = False, +) -> bool: + """ + Detect if the given input (file, bytes, or path) points to a binary file. aka. not a string. + Based on the same main heuristic algorithms and default kwargs at the sole exception that fallbacks match + are disabled to be stricter around ASCII-compatible but unlikely to be a string. + """ + if isinstance(fp_or_path_or_payload, (str, PathLike)): + guesses = from_path( + fp_or_path_or_payload, + steps=steps, + chunk_size=chunk_size, + threshold=threshold, + cp_isolation=cp_isolation, + cp_exclusion=cp_exclusion, + preemptive_behaviour=preemptive_behaviour, + explain=explain, + language_threshold=language_threshold, + enable_fallback=enable_fallback, + ) + elif isinstance( + fp_or_path_or_payload, + ( + bytes, + bytearray, + ), + ): + guesses = from_bytes( + fp_or_path_or_payload, + steps=steps, + chunk_size=chunk_size, + threshold=threshold, + cp_isolation=cp_isolation, + cp_exclusion=cp_exclusion, + preemptive_behaviour=preemptive_behaviour, + explain=explain, + language_threshold=language_threshold, + enable_fallback=enable_fallback, + ) + else: + guesses = from_fp( + fp_or_path_or_payload, + steps=steps, + chunk_size=chunk_size, + threshold=threshold, + cp_isolation=cp_isolation, + cp_exclusion=cp_exclusion, + preemptive_behaviour=preemptive_behaviour, + explain=explain, + language_threshold=language_threshold, + enable_fallback=enable_fallback, + ) + + return not guesses diff --git a/billinglayer/python/charset_normalizer/assets/__init__.py b/billinglayer/python/charset_normalizer/assets/__init__.py new file mode 100644 index 0000000..9075930 --- /dev/null +++ b/billinglayer/python/charset_normalizer/assets/__init__.py @@ -0,0 +1,1440 @@ +# -*- coding: utf-8 -*- +from typing import Dict, List + +# Language label that contain the em dash "—" +# character are to be considered alternative seq to origin +FREQUENCIES: Dict[str, List[str]] = { + "English": [ + "e", + "a", + "t", + "i", + "o", + "n", + "s", + "r", + "h", + "l", + "d", + "c", + "u", + "m", + "f", + "p", + "g", + "w", + "y", + "b", + "v", + "k", + "x", + "j", + "z", + "q", + ], + "English—": [ + "e", + "a", + "t", + "i", + "o", + "n", + "s", + "r", + "h", + "l", + "d", + "c", + "m", + "u", + "f", + "p", + "g", + "w", + "b", + "y", + "v", + "k", + "j", + "x", + "z", + "q", + ], + "German": [ + "e", + "n", + "i", + "r", + "s", + "t", + "a", + "d", + "h", + "u", + "l", + "g", + "o", + "c", + "m", + "b", + "f", + "k", + "w", + "z", + "p", + "v", + "ü", + "ä", + "ö", + "j", + ], + "French": [ + "e", + "a", + "s", + "n", + "i", + "t", + "r", + "l", + "u", + "o", + "d", + "c", + "p", + "m", + "é", + "v", + "g", + "f", + "b", + "h", + "q", + "à", + "x", + "è", + "y", + "j", + ], + "Dutch": [ + "e", + "n", + "a", + "i", + "r", + "t", + "o", + "d", + "s", + "l", + "g", + "h", + "v", + "m", + "u", + "k", + "c", + "p", + "b", + "w", + "j", + "z", + "f", + "y", + "x", + "ë", + ], + "Italian": [ + "e", + "i", + "a", + "o", + "n", + "l", + "t", + "r", + "s", + "c", + "d", + "u", + "p", + "m", + "g", + "v", + "f", + "b", + "z", + "h", + "q", + "è", + "à", + "k", + "y", + "ò", + ], + "Polish": [ + "a", + "i", + "o", + "e", + "n", + "r", + "z", + "w", + "s", + "c", + "t", + "k", + "y", + "d", + "p", + "m", + "u", + "l", + "j", + "ł", + "g", + "b", + "h", + "ą", + "ę", + "ó", + ], + "Spanish": [ + "e", + "a", + "o", + "n", + "s", + "r", + "i", + "l", + "d", + "t", + "c", + "u", + "m", + "p", + "b", + "g", + "v", + "f", + "y", + "ó", + "h", + "q", + "í", + "j", + "z", + "á", + ], + "Russian": [ + "о", + "а", + "е", + "и", + "н", + "с", + "т", + "р", + "в", + "л", + "к", + "м", + "д", + "п", + "у", + "г", + "я", + "ы", + "з", + "б", + "й", + "ь", + "ч", + "х", + "ж", + "ц", + ], + # Jap-Kanji + "Japanese": [ + "人", + "一", + "大", + "亅", + "丁", + "丨", + "竹", + "笑", + "口", + "日", + "今", + "二", + "彳", + "行", + "十", + "土", + "丶", + "寸", + "寺", + "時", + "乙", + "丿", + "乂", + "气", + "気", + "冂", + "巾", + "亠", + "市", + "目", + "儿", + "見", + "八", + "小", + "凵", + "県", + "月", + "彐", + "門", + "間", + "木", + "東", + "山", + "出", + "本", + "中", + "刀", + "分", + "耳", + "又", + "取", + "最", + "言", + "田", + "心", + "思", + "刂", + "前", + "京", + "尹", + "事", + "生", + "厶", + "云", + "会", + "未", + "来", + "白", + "冫", + "楽", + "灬", + "馬", + "尸", + "尺", + "駅", + "明", + "耂", + "者", + "了", + "阝", + "都", + "高", + "卜", + "占", + "厂", + "广", + "店", + "子", + "申", + "奄", + "亻", + "俺", + "上", + "方", + "冖", + "学", + "衣", + "艮", + "食", + "自", + ], + # Jap-Katakana + "Japanese—": [ + "ー", + "ン", + "ス", + "・", + "ル", + "ト", + "リ", + "イ", + "ア", + "ラ", + "ッ", + "ク", + "ド", + "シ", + "レ", + "ジ", + "タ", + "フ", + "ロ", + "カ", + "テ", + "マ", + "ィ", + "グ", + "バ", + "ム", + "プ", + "オ", + "コ", + "デ", + "ニ", + "ウ", + "メ", + "サ", + "ビ", + "ナ", + "ブ", + "ャ", + "エ", + "ュ", + "チ", + "キ", + "ズ", + "ダ", + "パ", + "ミ", + "ェ", + "ョ", + "ハ", + "セ", + "ベ", + "ガ", + "モ", + "ツ", + "ネ", + "ボ", + "ソ", + "ノ", + "ァ", + "ヴ", + "ワ", + "ポ", + "ペ", + "ピ", + "ケ", + "ゴ", + "ギ", + "ザ", + "ホ", + "ゲ", + "ォ", + "ヤ", + "ヒ", + "ユ", + "ヨ", + "ヘ", + "ゼ", + "ヌ", + "ゥ", + "ゾ", + "ヶ", + "ヂ", + "ヲ", + "ヅ", + "ヵ", + "ヱ", + "ヰ", + "ヮ", + "ヽ", + "゠", + "ヾ", + "ヷ", + "ヿ", + "ヸ", + "ヹ", + "ヺ", + ], + # Jap-Hiragana + "Japanese——": [ + "の", + "に", + "る", + "た", + "と", + "は", + "し", + "い", + "を", + "で", + "て", + "が", + "な", + "れ", + "か", + "ら", + "さ", + "っ", + "り", + "す", + "あ", + "も", + "こ", + "ま", + "う", + "く", + "よ", + "き", + "ん", + "め", + "お", + "け", + "そ", + "つ", + "だ", + "や", + "え", + "ど", + "わ", + "ち", + "み", + "せ", + "じ", + "ば", + "へ", + "び", + "ず", + "ろ", + "ほ", + "げ", + "む", + "べ", + "ひ", + "ょ", + "ゆ", + "ぶ", + "ご", + "ゃ", + "ね", + "ふ", + "ぐ", + "ぎ", + "ぼ", + "ゅ", + "づ", + "ざ", + "ぞ", + "ぬ", + "ぜ", + "ぱ", + "ぽ", + "ぷ", + "ぴ", + "ぃ", + "ぁ", + "ぇ", + "ぺ", + "ゞ", + "ぢ", + "ぉ", + "ぅ", + "ゐ", + "ゝ", + "ゑ", + "゛", + "゜", + "ゎ", + "ゔ", + "゚", + "ゟ", + "゙", + "ゕ", + "ゖ", + ], + "Portuguese": [ + "a", + "e", + "o", + "s", + "i", + "r", + "d", + "n", + "t", + "m", + "u", + "c", + "l", + "p", + "g", + "v", + "b", + "f", + "h", + "ã", + "q", + "é", + "ç", + "á", + "z", + "í", + ], + "Swedish": [ + "e", + "a", + "n", + "r", + "t", + "s", + "i", + "l", + "d", + "o", + "m", + "k", + "g", + "v", + "h", + "f", + "u", + "p", + "ä", + "c", + "b", + "ö", + "å", + "y", + "j", + "x", + ], + "Chinese": [ + "的", + "一", + "是", + "不", + "了", + "在", + "人", + "有", + "我", + "他", + "这", + "个", + "们", + "中", + "来", + "上", + "大", + "为", + "和", + "国", + "地", + "到", + "以", + "说", + "时", + "要", + "就", + "出", + "会", + "可", + "也", + "你", + "对", + "生", + "能", + "而", + "子", + "那", + "得", + "于", + "着", + "下", + "自", + "之", + "年", + "过", + "发", + "后", + "作", + "里", + "用", + "道", + "行", + "所", + "然", + "家", + "种", + "事", + "成", + "方", + "多", + "经", + "么", + "去", + "法", + "学", + "如", + "都", + "同", + "现", + "当", + "没", + "动", + "面", + "起", + "看", + "定", + "天", + "分", + "还", + "进", + "好", + "小", + "部", + "其", + "些", + "主", + "样", + "理", + "心", + "她", + "本", + "前", + "开", + "但", + "因", + "只", + "从", + "想", + "实", + ], + "Ukrainian": [ + "о", + "а", + "н", + "і", + "и", + "р", + "в", + "т", + "е", + "с", + "к", + "л", + "у", + "д", + "м", + "п", + "з", + "я", + "ь", + "б", + "г", + "й", + "ч", + "х", + "ц", + "ї", + ], + "Norwegian": [ + "e", + "r", + "n", + "t", + "a", + "s", + "i", + "o", + "l", + "d", + "g", + "k", + "m", + "v", + "f", + "p", + "u", + "b", + "h", + "å", + "y", + "j", + "ø", + "c", + "æ", + "w", + ], + "Finnish": [ + "a", + "i", + "n", + "t", + "e", + "s", + "l", + "o", + "u", + "k", + "ä", + "m", + "r", + "v", + "j", + "h", + "p", + "y", + "d", + "ö", + "g", + "c", + "b", + "f", + "w", + "z", + ], + "Vietnamese": [ + "n", + "h", + "t", + "i", + "c", + "g", + "a", + "o", + "u", + "m", + "l", + "r", + "à", + "đ", + "s", + "e", + "v", + "p", + "b", + "y", + "ư", + "d", + "á", + "k", + "ộ", + "ế", + ], + "Czech": [ + "o", + "e", + "a", + "n", + "t", + "s", + "i", + "l", + "v", + "r", + "k", + "d", + "u", + "m", + "p", + "í", + "c", + "h", + "z", + "á", + "y", + "j", + "b", + "ě", + "é", + "ř", + ], + "Hungarian": [ + "e", + "a", + "t", + "l", + "s", + "n", + "k", + "r", + "i", + "o", + "z", + "á", + "é", + "g", + "m", + "b", + "y", + "v", + "d", + "h", + "u", + "p", + "j", + "ö", + "f", + "c", + ], + "Korean": [ + "이", + "다", + "에", + "의", + "는", + "로", + "하", + "을", + "가", + "고", + "지", + "서", + "한", + "은", + "기", + "으", + "년", + "대", + "사", + "시", + "를", + "리", + "도", + "인", + "스", + "일", + ], + "Indonesian": [ + "a", + "n", + "e", + "i", + "r", + "t", + "u", + "s", + "d", + "k", + "m", + "l", + "g", + "p", + "b", + "o", + "h", + "y", + "j", + "c", + "w", + "f", + "v", + "z", + "x", + "q", + ], + "Turkish": [ + "a", + "e", + "i", + "n", + "r", + "l", + "ı", + "k", + "d", + "t", + "s", + "m", + "y", + "u", + "o", + "b", + "ü", + "ş", + "v", + "g", + "z", + "h", + "c", + "p", + "ç", + "ğ", + ], + "Romanian": [ + "e", + "i", + "a", + "r", + "n", + "t", + "u", + "l", + "o", + "c", + "s", + "d", + "p", + "m", + "ă", + "f", + "v", + "î", + "g", + "b", + "ș", + "ț", + "z", + "h", + "â", + "j", + ], + "Farsi": [ + "ا", + "ی", + "ر", + "د", + "ن", + "ه", + "و", + "م", + "ت", + "ب", + "س", + "ل", + "ک", + "ش", + "ز", + "ف", + "گ", + "ع", + "خ", + "ق", + "ج", + "آ", + "پ", + "ح", + "ط", + "ص", + ], + "Arabic": [ + "ا", + "ل", + "ي", + "م", + "و", + "ن", + "ر", + "ت", + "ب", + "ة", + "ع", + "د", + "س", + "ف", + "ه", + "ك", + "ق", + "أ", + "ح", + "ج", + "ش", + "ط", + "ص", + "ى", + "خ", + "إ", + ], + "Danish": [ + "e", + "r", + "n", + "t", + "a", + "i", + "s", + "d", + "l", + "o", + "g", + "m", + "k", + "f", + "v", + "u", + "b", + "h", + "p", + "å", + "y", + "ø", + "æ", + "c", + "j", + "w", + ], + "Serbian": [ + "а", + "и", + "о", + "е", + "н", + "р", + "с", + "у", + "т", + "к", + "ј", + "в", + "д", + "м", + "п", + "л", + "г", + "з", + "б", + "a", + "i", + "e", + "o", + "n", + "ц", + "ш", + ], + "Lithuanian": [ + "i", + "a", + "s", + "o", + "r", + "e", + "t", + "n", + "u", + "k", + "m", + "l", + "p", + "v", + "d", + "j", + "g", + "ė", + "b", + "y", + "ų", + "š", + "ž", + "c", + "ą", + "į", + ], + "Slovene": [ + "e", + "a", + "i", + "o", + "n", + "r", + "s", + "l", + "t", + "j", + "v", + "k", + "d", + "p", + "m", + "u", + "z", + "b", + "g", + "h", + "č", + "c", + "š", + "ž", + "f", + "y", + ], + "Slovak": [ + "o", + "a", + "e", + "n", + "i", + "r", + "v", + "t", + "s", + "l", + "k", + "d", + "m", + "p", + "u", + "c", + "h", + "j", + "b", + "z", + "á", + "y", + "ý", + "í", + "č", + "é", + ], + "Hebrew": [ + "י", + "ו", + "ה", + "ל", + "ר", + "ב", + "ת", + "מ", + "א", + "ש", + "נ", + "ע", + "ם", + "ד", + "ק", + "ח", + "פ", + "ס", + "כ", + "ג", + "ט", + "צ", + "ן", + "ז", + "ך", + ], + "Bulgarian": [ + "а", + "и", + "о", + "е", + "н", + "т", + "р", + "с", + "в", + "л", + "к", + "д", + "п", + "м", + "з", + "г", + "я", + "ъ", + "у", + "б", + "ч", + "ц", + "й", + "ж", + "щ", + "х", + ], + "Croatian": [ + "a", + "i", + "o", + "e", + "n", + "r", + "j", + "s", + "t", + "u", + "k", + "l", + "v", + "d", + "m", + "p", + "g", + "z", + "b", + "c", + "č", + "h", + "š", + "ž", + "ć", + "f", + ], + "Hindi": [ + "क", + "र", + "स", + "न", + "त", + "म", + "ह", + "प", + "य", + "ल", + "व", + "ज", + "द", + "ग", + "ब", + "श", + "ट", + "अ", + "ए", + "थ", + "भ", + "ड", + "च", + "ध", + "ष", + "इ", + ], + "Estonian": [ + "a", + "i", + "e", + "s", + "t", + "l", + "u", + "n", + "o", + "k", + "r", + "d", + "m", + "v", + "g", + "p", + "j", + "h", + "ä", + "b", + "õ", + "ü", + "f", + "c", + "ö", + "y", + ], + "Thai": [ + "า", + "น", + "ร", + "อ", + "ก", + "เ", + "ง", + "ม", + "ย", + "ล", + "ว", + "ด", + "ท", + "ส", + "ต", + "ะ", + "ป", + "บ", + "ค", + "ห", + "แ", + "จ", + "พ", + "ช", + "ข", + "ใ", + ], + "Greek": [ + "α", + "τ", + "ο", + "ι", + "ε", + "ν", + "ρ", + "σ", + "κ", + "η", + "π", + "ς", + "υ", + "μ", + "λ", + "ί", + "ό", + "ά", + "γ", + "έ", + "δ", + "ή", + "ω", + "χ", + "θ", + "ύ", + ], + "Tamil": [ + "க", + "த", + "ப", + "ட", + "ர", + "ம", + "ல", + "ன", + "வ", + "ற", + "ய", + "ள", + "ச", + "ந", + "இ", + "ண", + "அ", + "ஆ", + "ழ", + "ங", + "எ", + "உ", + "ஒ", + "ஸ", + ], + "Kazakh": [ + "а", + "ы", + "е", + "н", + "т", + "р", + "л", + "і", + "д", + "с", + "м", + "қ", + "к", + "о", + "б", + "и", + "у", + "ғ", + "ж", + "ң", + "з", + "ш", + "й", + "п", + "г", + "ө", + ], +} diff --git a/billinglayer/python/charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d01ef7d Binary files /dev/null and b/billinglayer/python/charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/cd.py b/billinglayer/python/charset_normalizer/cd.py new file mode 100644 index 0000000..6e56fe8 --- /dev/null +++ b/billinglayer/python/charset_normalizer/cd.py @@ -0,0 +1,390 @@ +import importlib +from codecs import IncrementalDecoder +from collections import Counter +from functools import lru_cache +from typing import Counter as TypeCounter, Dict, List, Optional, Tuple + +from .assets import FREQUENCIES +from .constant import KO_NAMES, LANGUAGE_SUPPORTED_COUNT, TOO_SMALL_SEQUENCE, ZH_NAMES +from .md import is_suspiciously_successive_range +from .models import CoherenceMatches +from .utils import ( + is_accentuated, + is_latin, + is_multi_byte_encoding, + is_unicode_range_secondary, + unicode_range, +) + + +def encoding_unicode_range(iana_name: str) -> List[str]: + """ + Return associated unicode ranges in a single byte code page. + """ + if is_multi_byte_encoding(iana_name): + raise IOError("Function not supported on multi-byte code page") + + decoder = importlib.import_module( + "encodings.{}".format(iana_name) + ).IncrementalDecoder + + p: IncrementalDecoder = decoder(errors="ignore") + seen_ranges: Dict[str, int] = {} + character_count: int = 0 + + for i in range(0x40, 0xFF): + chunk: str = p.decode(bytes([i])) + + if chunk: + character_range: Optional[str] = unicode_range(chunk) + + if character_range is None: + continue + + if is_unicode_range_secondary(character_range) is False: + if character_range not in seen_ranges: + seen_ranges[character_range] = 0 + seen_ranges[character_range] += 1 + character_count += 1 + + return sorted( + [ + character_range + for character_range in seen_ranges + if seen_ranges[character_range] / character_count >= 0.15 + ] + ) + + +def unicode_range_languages(primary_range: str) -> List[str]: + """ + Return inferred languages used with a unicode range. + """ + languages: List[str] = [] + + for language, characters in FREQUENCIES.items(): + for character in characters: + if unicode_range(character) == primary_range: + languages.append(language) + break + + return languages + + +@lru_cache() +def encoding_languages(iana_name: str) -> List[str]: + """ + Single-byte encoding language association. Some code page are heavily linked to particular language(s). + This function does the correspondence. + """ + unicode_ranges: List[str] = encoding_unicode_range(iana_name) + primary_range: Optional[str] = None + + for specified_range in unicode_ranges: + if "Latin" not in specified_range: + primary_range = specified_range + break + + if primary_range is None: + return ["Latin Based"] + + return unicode_range_languages(primary_range) + + +@lru_cache() +def mb_encoding_languages(iana_name: str) -> List[str]: + """ + Multi-byte encoding language association. Some code page are heavily linked to particular language(s). + This function does the correspondence. + """ + if ( + iana_name.startswith("shift_") + or iana_name.startswith("iso2022_jp") + or iana_name.startswith("euc_j") + or iana_name == "cp932" + ): + return ["Japanese"] + if iana_name.startswith("gb") or iana_name in ZH_NAMES: + return ["Chinese"] + if iana_name.startswith("iso2022_kr") or iana_name in KO_NAMES: + return ["Korean"] + + return [] + + +@lru_cache(maxsize=LANGUAGE_SUPPORTED_COUNT) +def get_target_features(language: str) -> Tuple[bool, bool]: + """ + Determine main aspects from a supported language if it contains accents and if is pure Latin. + """ + target_have_accents: bool = False + target_pure_latin: bool = True + + for character in FREQUENCIES[language]: + if not target_have_accents and is_accentuated(character): + target_have_accents = True + if target_pure_latin and is_latin(character) is False: + target_pure_latin = False + + return target_have_accents, target_pure_latin + + +def alphabet_languages( + characters: List[str], ignore_non_latin: bool = False +) -> List[str]: + """ + Return associated languages associated to given characters. + """ + languages: List[Tuple[str, float]] = [] + + source_have_accents = any(is_accentuated(character) for character in characters) + + for language, language_characters in FREQUENCIES.items(): + target_have_accents, target_pure_latin = get_target_features(language) + + if ignore_non_latin and target_pure_latin is False: + continue + + if target_have_accents is False and source_have_accents: + continue + + character_count: int = len(language_characters) + + character_match_count: int = len( + [c for c in language_characters if c in characters] + ) + + ratio: float = character_match_count / character_count + + if ratio >= 0.2: + languages.append((language, ratio)) + + languages = sorted(languages, key=lambda x: x[1], reverse=True) + + return [compatible_language[0] for compatible_language in languages] + + +def characters_popularity_compare( + language: str, ordered_characters: List[str] +) -> float: + """ + Determine if a ordered characters list (by occurrence from most appearance to rarest) match a particular language. + The result is a ratio between 0. (absolutely no correspondence) and 1. (near perfect fit). + Beware that is function is not strict on the match in order to ease the detection. (Meaning close match is 1.) + """ + if language not in FREQUENCIES: + raise ValueError("{} not available".format(language)) + + character_approved_count: int = 0 + FREQUENCIES_language_set = set(FREQUENCIES[language]) + + ordered_characters_count: int = len(ordered_characters) + target_language_characters_count: int = len(FREQUENCIES[language]) + + large_alphabet: bool = target_language_characters_count > 26 + + for character, character_rank in zip( + ordered_characters, range(0, ordered_characters_count) + ): + if character not in FREQUENCIES_language_set: + continue + + character_rank_in_language: int = FREQUENCIES[language].index(character) + expected_projection_ratio: float = ( + target_language_characters_count / ordered_characters_count + ) + character_rank_projection: int = int(character_rank * expected_projection_ratio) + + if ( + large_alphabet is False + and abs(character_rank_projection - character_rank_in_language) > 4 + ): + continue + + if ( + large_alphabet is True + and abs(character_rank_projection - character_rank_in_language) + < target_language_characters_count / 3 + ): + character_approved_count += 1 + continue + + characters_before_source: List[str] = FREQUENCIES[language][ + 0:character_rank_in_language + ] + characters_after_source: List[str] = FREQUENCIES[language][ + character_rank_in_language: + ] + characters_before: List[str] = ordered_characters[0:character_rank] + characters_after: List[str] = ordered_characters[character_rank:] + + before_match_count: int = len( + set(characters_before) & set(characters_before_source) + ) + + after_match_count: int = len( + set(characters_after) & set(characters_after_source) + ) + + if len(characters_before_source) == 0 and before_match_count <= 4: + character_approved_count += 1 + continue + + if len(characters_after_source) == 0 and after_match_count <= 4: + character_approved_count += 1 + continue + + if ( + before_match_count / len(characters_before_source) >= 0.4 + or after_match_count / len(characters_after_source) >= 0.4 + ): + character_approved_count += 1 + continue + + return character_approved_count / len(ordered_characters) + + +def alpha_unicode_split(decoded_sequence: str) -> List[str]: + """ + Given a decoded text sequence, return a list of str. Unicode range / alphabet separation. + Ex. a text containing English/Latin with a bit a Hebrew will return two items in the resulting list; + One containing the latin letters and the other hebrew. + """ + layers: Dict[str, str] = {} + + for character in decoded_sequence: + if character.isalpha() is False: + continue + + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + continue + + layer_target_range: Optional[str] = None + + for discovered_range in layers: + if ( + is_suspiciously_successive_range(discovered_range, character_range) + is False + ): + layer_target_range = discovered_range + break + + if layer_target_range is None: + layer_target_range = character_range + + if layer_target_range not in layers: + layers[layer_target_range] = character.lower() + continue + + layers[layer_target_range] += character.lower() + + return list(layers.values()) + + +def merge_coherence_ratios(results: List[CoherenceMatches]) -> CoherenceMatches: + """ + This function merge results previously given by the function coherence_ratio. + The return type is the same as coherence_ratio. + """ + per_language_ratios: Dict[str, List[float]] = {} + for result in results: + for sub_result in result: + language, ratio = sub_result + if language not in per_language_ratios: + per_language_ratios[language] = [ratio] + continue + per_language_ratios[language].append(ratio) + + merge = [ + ( + language, + round( + sum(per_language_ratios[language]) / len(per_language_ratios[language]), + 4, + ), + ) + for language in per_language_ratios + ] + + return sorted(merge, key=lambda x: x[1], reverse=True) + + +def filter_alt_coherence_matches(results: CoherenceMatches) -> CoherenceMatches: + """ + We shall NOT return "English—" in CoherenceMatches because it is an alternative + of "English". This function only keeps the best match and remove the em-dash in it. + """ + index_results: Dict[str, List[float]] = dict() + + for result in results: + language, ratio = result + no_em_name: str = language.replace("—", "") + + if no_em_name not in index_results: + index_results[no_em_name] = [] + + index_results[no_em_name].append(ratio) + + if any(len(index_results[e]) > 1 for e in index_results): + filtered_results: CoherenceMatches = [] + + for language in index_results: + filtered_results.append((language, max(index_results[language]))) + + return filtered_results + + return results + + +@lru_cache(maxsize=2048) +def coherence_ratio( + decoded_sequence: str, threshold: float = 0.1, lg_inclusion: Optional[str] = None +) -> CoherenceMatches: + """ + Detect ANY language that can be identified in given sequence. The sequence will be analysed by layers. + A layer = Character extraction by alphabets/ranges. + """ + + results: List[Tuple[str, float]] = [] + ignore_non_latin: bool = False + + sufficient_match_count: int = 0 + + lg_inclusion_list = lg_inclusion.split(",") if lg_inclusion is not None else [] + if "Latin Based" in lg_inclusion_list: + ignore_non_latin = True + lg_inclusion_list.remove("Latin Based") + + for layer in alpha_unicode_split(decoded_sequence): + sequence_frequencies: TypeCounter[str] = Counter(layer) + most_common = sequence_frequencies.most_common() + + character_count: int = sum(o for c, o in most_common) + + if character_count <= TOO_SMALL_SEQUENCE: + continue + + popular_character_ordered: List[str] = [c for c, o in most_common] + + for language in lg_inclusion_list or alphabet_languages( + popular_character_ordered, ignore_non_latin + ): + ratio: float = characters_popularity_compare( + language, popular_character_ordered + ) + + if ratio < threshold: + continue + elif ratio >= 0.8: + sufficient_match_count += 1 + + results.append((language, round(ratio, 4))) + + if sufficient_match_count >= 3: + break + + return sorted( + filter_alt_coherence_matches(results), key=lambda x: x[1], reverse=True + ) diff --git a/billinglayer/python/charset_normalizer/cli/__init__.py b/billinglayer/python/charset_normalizer/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..c9486e8 Binary files /dev/null and b/billinglayer/python/charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc b/billinglayer/python/charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc new file mode 100644 index 0000000..997f5ae Binary files /dev/null and b/billinglayer/python/charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc differ diff --git a/billinglayer/python/charset_normalizer/cli/normalizer.py b/billinglayer/python/charset_normalizer/cli/normalizer.py new file mode 100644 index 0000000..f4bcbaa --- /dev/null +++ b/billinglayer/python/charset_normalizer/cli/normalizer.py @@ -0,0 +1,296 @@ +import argparse +import sys +from json import dumps +from os.path import abspath, basename, dirname, join, realpath +from platform import python_version +from typing import List, Optional +from unicodedata import unidata_version + +import charset_normalizer.md as md_module +from charset_normalizer import from_fp +from charset_normalizer.models import CliDetectionResult +from charset_normalizer.version import __version__ + + +def query_yes_no(question: str, default: str = "yes") -> bool: + """Ask a yes/no question via input() and return their answer. + + "question" is a string that is presented to the user. + "default" is the presumed answer if the user just hits . + It must be "yes" (the default), "no" or None (meaning + an answer is required of the user). + + The "answer" return value is True for "yes" or False for "no". + + Credit goes to (c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input + """ + valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} + if default is None: + prompt = " [y/n] " + elif default == "yes": + prompt = " [Y/n] " + elif default == "no": + prompt = " [y/N] " + else: + raise ValueError("invalid default answer: '%s'" % default) + + while True: + sys.stdout.write(question + prompt) + choice = input().lower() + if default is not None and choice == "": + return valid[default] + elif choice in valid: + return valid[choice] + else: + sys.stdout.write("Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n") + + +def cli_detect(argv: Optional[List[str]] = None) -> int: + """ + CLI assistant using ARGV and ArgumentParser + :param argv: + :return: 0 if everything is fine, anything else equal trouble + """ + parser = argparse.ArgumentParser( + description="The Real First Universal Charset Detector. " + "Discover originating encoding used on text file. " + "Normalize text to unicode." + ) + + parser.add_argument( + "files", type=argparse.FileType("rb"), nargs="+", help="File(s) to be analysed" + ) + parser.add_argument( + "-v", + "--verbose", + action="store_true", + default=False, + dest="verbose", + help="Display complementary information about file if any. " + "Stdout will contain logs about the detection process.", + ) + parser.add_argument( + "-a", + "--with-alternative", + action="store_true", + default=False, + dest="alternatives", + help="Output complementary possibilities if any. Top-level JSON WILL be a list.", + ) + parser.add_argument( + "-n", + "--normalize", + action="store_true", + default=False, + dest="normalize", + help="Permit to normalize input file. If not set, program does not write anything.", + ) + parser.add_argument( + "-m", + "--minimal", + action="store_true", + default=False, + dest="minimal", + help="Only output the charset detected to STDOUT. Disabling JSON output.", + ) + parser.add_argument( + "-r", + "--replace", + action="store_true", + default=False, + dest="replace", + help="Replace file when trying to normalize it instead of creating a new one.", + ) + parser.add_argument( + "-f", + "--force", + action="store_true", + default=False, + dest="force", + help="Replace file without asking if you are sure, use this flag with caution.", + ) + parser.add_argument( + "-t", + "--threshold", + action="store", + default=0.2, + type=float, + dest="threshold", + help="Define a custom maximum amount of chaos allowed in decoded content. 0. <= chaos <= 1.", + ) + parser.add_argument( + "--version", + action="version", + version="Charset-Normalizer {} - Python {} - Unicode {} - SpeedUp {}".format( + __version__, + python_version(), + unidata_version, + "OFF" if md_module.__file__.lower().endswith(".py") else "ON", + ), + help="Show version information and exit.", + ) + + args = parser.parse_args(argv) + + if args.replace is True and args.normalize is False: + print("Use --replace in addition of --normalize only.", file=sys.stderr) + return 1 + + if args.force is True and args.replace is False: + print("Use --force in addition of --replace only.", file=sys.stderr) + return 1 + + if args.threshold < 0.0 or args.threshold > 1.0: + print("--threshold VALUE should be between 0. AND 1.", file=sys.stderr) + return 1 + + x_ = [] + + for my_file in args.files: + matches = from_fp(my_file, threshold=args.threshold, explain=args.verbose) + + best_guess = matches.best() + + if best_guess is None: + print( + 'Unable to identify originating encoding for "{}". {}'.format( + my_file.name, + "Maybe try increasing maximum amount of chaos." + if args.threshold < 1.0 + else "", + ), + file=sys.stderr, + ) + x_.append( + CliDetectionResult( + abspath(my_file.name), + None, + [], + [], + "Unknown", + [], + False, + 1.0, + 0.0, + None, + True, + ) + ) + else: + x_.append( + CliDetectionResult( + abspath(my_file.name), + best_guess.encoding, + best_guess.encoding_aliases, + [ + cp + for cp in best_guess.could_be_from_charset + if cp != best_guess.encoding + ], + best_guess.language, + best_guess.alphabets, + best_guess.bom, + best_guess.percent_chaos, + best_guess.percent_coherence, + None, + True, + ) + ) + + if len(matches) > 1 and args.alternatives: + for el in matches: + if el != best_guess: + x_.append( + CliDetectionResult( + abspath(my_file.name), + el.encoding, + el.encoding_aliases, + [ + cp + for cp in el.could_be_from_charset + if cp != el.encoding + ], + el.language, + el.alphabets, + el.bom, + el.percent_chaos, + el.percent_coherence, + None, + False, + ) + ) + + if args.normalize is True: + if best_guess.encoding.startswith("utf") is True: + print( + '"{}" file does not need to be normalized, as it already came from unicode.'.format( + my_file.name + ), + file=sys.stderr, + ) + if my_file.closed is False: + my_file.close() + continue + + dir_path = dirname(realpath(my_file.name)) + file_name = basename(realpath(my_file.name)) + + o_: List[str] = file_name.split(".") + + if args.replace is False: + o_.insert(-1, best_guess.encoding) + if my_file.closed is False: + my_file.close() + elif ( + args.force is False + and query_yes_no( + 'Are you sure to normalize "{}" by replacing it ?'.format( + my_file.name + ), + "no", + ) + is False + ): + if my_file.closed is False: + my_file.close() + continue + + try: + x_[0].unicode_path = join(dir_path, ".".join(o_)) + + with open(x_[0].unicode_path, "w", encoding="utf-8") as fp: + fp.write(str(best_guess)) + except IOError as e: + print(str(e), file=sys.stderr) + if my_file.closed is False: + my_file.close() + return 2 + + if my_file.closed is False: + my_file.close() + + if args.minimal is False: + print( + dumps( + [el.__dict__ for el in x_] if len(x_) > 1 else x_[0].__dict__, + ensure_ascii=True, + indent=4, + ) + ) + else: + for my_file in args.files: + print( + ", ".join( + [ + el.encoding or "undefined" + for el in x_ + if el.path == abspath(my_file.name) + ] + ) + ) + + return 0 + + +if __name__ == "__main__": + cli_detect() diff --git a/billinglayer/python/charset_normalizer/constant.py b/billinglayer/python/charset_normalizer/constant.py new file mode 100644 index 0000000..3188108 --- /dev/null +++ b/billinglayer/python/charset_normalizer/constant.py @@ -0,0 +1,495 @@ +from codecs import BOM_UTF8, BOM_UTF16_BE, BOM_UTF16_LE, BOM_UTF32_BE, BOM_UTF32_LE +from encodings.aliases import aliases +from re import IGNORECASE, compile as re_compile +from typing import Dict, List, Set, Union + +from .assets import FREQUENCIES + +# Contain for each eligible encoding a list of/item bytes SIG/BOM +ENCODING_MARKS: Dict[str, Union[bytes, List[bytes]]] = { + "utf_8": BOM_UTF8, + "utf_7": [ + b"\x2b\x2f\x76\x38", + b"\x2b\x2f\x76\x39", + b"\x2b\x2f\x76\x2b", + b"\x2b\x2f\x76\x2f", + b"\x2b\x2f\x76\x38\x2d", + ], + "gb18030": b"\x84\x31\x95\x33", + "utf_32": [BOM_UTF32_BE, BOM_UTF32_LE], + "utf_16": [BOM_UTF16_BE, BOM_UTF16_LE], +} + +TOO_SMALL_SEQUENCE: int = 32 +TOO_BIG_SEQUENCE: int = int(10e6) + +UTF8_MAXIMAL_ALLOCATION: int = 1112064 + +UNICODE_RANGES_COMBINED: Dict[str, range] = { + "Control character": range(31 + 1), + "Basic Latin": range(32, 127 + 1), + "Latin-1 Supplement": range(128, 255 + 1), + "Latin Extended-A": range(256, 383 + 1), + "Latin Extended-B": range(384, 591 + 1), + "IPA Extensions": range(592, 687 + 1), + "Spacing Modifier Letters": range(688, 767 + 1), + "Combining Diacritical Marks": range(768, 879 + 1), + "Greek and Coptic": range(880, 1023 + 1), + "Cyrillic": range(1024, 1279 + 1), + "Cyrillic Supplement": range(1280, 1327 + 1), + "Armenian": range(1328, 1423 + 1), + "Hebrew": range(1424, 1535 + 1), + "Arabic": range(1536, 1791 + 1), + "Syriac": range(1792, 1871 + 1), + "Arabic Supplement": range(1872, 1919 + 1), + "Thaana": range(1920, 1983 + 1), + "NKo": range(1984, 2047 + 1), + "Samaritan": range(2048, 2111 + 1), + "Mandaic": range(2112, 2143 + 1), + "Syriac Supplement": range(2144, 2159 + 1), + "Arabic Extended-A": range(2208, 2303 + 1), + "Devanagari": range(2304, 2431 + 1), + "Bengali": range(2432, 2559 + 1), + "Gurmukhi": range(2560, 2687 + 1), + "Gujarati": range(2688, 2815 + 1), + "Oriya": range(2816, 2943 + 1), + "Tamil": range(2944, 3071 + 1), + "Telugu": range(3072, 3199 + 1), + "Kannada": range(3200, 3327 + 1), + "Malayalam": range(3328, 3455 + 1), + "Sinhala": range(3456, 3583 + 1), + "Thai": range(3584, 3711 + 1), + "Lao": range(3712, 3839 + 1), + "Tibetan": range(3840, 4095 + 1), + "Myanmar": range(4096, 4255 + 1), + "Georgian": range(4256, 4351 + 1), + "Hangul Jamo": range(4352, 4607 + 1), + "Ethiopic": range(4608, 4991 + 1), + "Ethiopic Supplement": range(4992, 5023 + 1), + "Cherokee": range(5024, 5119 + 1), + "Unified Canadian Aboriginal Syllabics": range(5120, 5759 + 1), + "Ogham": range(5760, 5791 + 1), + "Runic": range(5792, 5887 + 1), + "Tagalog": range(5888, 5919 + 1), + "Hanunoo": range(5920, 5951 + 1), + "Buhid": range(5952, 5983 + 1), + "Tagbanwa": range(5984, 6015 + 1), + "Khmer": range(6016, 6143 + 1), + "Mongolian": range(6144, 6319 + 1), + "Unified Canadian Aboriginal Syllabics Extended": range(6320, 6399 + 1), + "Limbu": range(6400, 6479 + 1), + "Tai Le": range(6480, 6527 + 1), + "New Tai Lue": range(6528, 6623 + 1), + "Khmer Symbols": range(6624, 6655 + 1), + "Buginese": range(6656, 6687 + 1), + "Tai Tham": range(6688, 6831 + 1), + "Combining Diacritical Marks Extended": range(6832, 6911 + 1), + "Balinese": range(6912, 7039 + 1), + "Sundanese": range(7040, 7103 + 1), + "Batak": range(7104, 7167 + 1), + "Lepcha": range(7168, 7247 + 1), + "Ol Chiki": range(7248, 7295 + 1), + "Cyrillic Extended C": range(7296, 7311 + 1), + "Sundanese Supplement": range(7360, 7375 + 1), + "Vedic Extensions": range(7376, 7423 + 1), + "Phonetic Extensions": range(7424, 7551 + 1), + "Phonetic Extensions Supplement": range(7552, 7615 + 1), + "Combining Diacritical Marks Supplement": range(7616, 7679 + 1), + "Latin Extended Additional": range(7680, 7935 + 1), + "Greek Extended": range(7936, 8191 + 1), + "General Punctuation": range(8192, 8303 + 1), + "Superscripts and Subscripts": range(8304, 8351 + 1), + "Currency Symbols": range(8352, 8399 + 1), + "Combining Diacritical Marks for Symbols": range(8400, 8447 + 1), + "Letterlike Symbols": range(8448, 8527 + 1), + "Number Forms": range(8528, 8591 + 1), + "Arrows": range(8592, 8703 + 1), + "Mathematical Operators": range(8704, 8959 + 1), + "Miscellaneous Technical": range(8960, 9215 + 1), + "Control Pictures": range(9216, 9279 + 1), + "Optical Character Recognition": range(9280, 9311 + 1), + "Enclosed Alphanumerics": range(9312, 9471 + 1), + "Box Drawing": range(9472, 9599 + 1), + "Block Elements": range(9600, 9631 + 1), + "Geometric Shapes": range(9632, 9727 + 1), + "Miscellaneous Symbols": range(9728, 9983 + 1), + "Dingbats": range(9984, 10175 + 1), + "Miscellaneous Mathematical Symbols-A": range(10176, 10223 + 1), + "Supplemental Arrows-A": range(10224, 10239 + 1), + "Braille Patterns": range(10240, 10495 + 1), + "Supplemental Arrows-B": range(10496, 10623 + 1), + "Miscellaneous Mathematical Symbols-B": range(10624, 10751 + 1), + "Supplemental Mathematical Operators": range(10752, 11007 + 1), + "Miscellaneous Symbols and Arrows": range(11008, 11263 + 1), + "Glagolitic": range(11264, 11359 + 1), + "Latin Extended-C": range(11360, 11391 + 1), + "Coptic": range(11392, 11519 + 1), + "Georgian Supplement": range(11520, 11567 + 1), + "Tifinagh": range(11568, 11647 + 1), + "Ethiopic Extended": range(11648, 11743 + 1), + "Cyrillic Extended-A": range(11744, 11775 + 1), + "Supplemental Punctuation": range(11776, 11903 + 1), + "CJK Radicals Supplement": range(11904, 12031 + 1), + "Kangxi Radicals": range(12032, 12255 + 1), + "Ideographic Description Characters": range(12272, 12287 + 1), + "CJK Symbols and Punctuation": range(12288, 12351 + 1), + "Hiragana": range(12352, 12447 + 1), + "Katakana": range(12448, 12543 + 1), + "Bopomofo": range(12544, 12591 + 1), + "Hangul Compatibility Jamo": range(12592, 12687 + 1), + "Kanbun": range(12688, 12703 + 1), + "Bopomofo Extended": range(12704, 12735 + 1), + "CJK Strokes": range(12736, 12783 + 1), + "Katakana Phonetic Extensions": range(12784, 12799 + 1), + "Enclosed CJK Letters and Months": range(12800, 13055 + 1), + "CJK Compatibility": range(13056, 13311 + 1), + "CJK Unified Ideographs Extension A": range(13312, 19903 + 1), + "Yijing Hexagram Symbols": range(19904, 19967 + 1), + "CJK Unified Ideographs": range(19968, 40959 + 1), + "Yi Syllables": range(40960, 42127 + 1), + "Yi Radicals": range(42128, 42191 + 1), + "Lisu": range(42192, 42239 + 1), + "Vai": range(42240, 42559 + 1), + "Cyrillic Extended-B": range(42560, 42655 + 1), + "Bamum": range(42656, 42751 + 1), + "Modifier Tone Letters": range(42752, 42783 + 1), + "Latin Extended-D": range(42784, 43007 + 1), + "Syloti Nagri": range(43008, 43055 + 1), + "Common Indic Number Forms": range(43056, 43071 + 1), + "Phags-pa": range(43072, 43135 + 1), + "Saurashtra": range(43136, 43231 + 1), + "Devanagari Extended": range(43232, 43263 + 1), + "Kayah Li": range(43264, 43311 + 1), + "Rejang": range(43312, 43359 + 1), + "Hangul Jamo Extended-A": range(43360, 43391 + 1), + "Javanese": range(43392, 43487 + 1), + "Myanmar Extended-B": range(43488, 43519 + 1), + "Cham": range(43520, 43615 + 1), + "Myanmar Extended-A": range(43616, 43647 + 1), + "Tai Viet": range(43648, 43743 + 1), + "Meetei Mayek Extensions": range(43744, 43775 + 1), + "Ethiopic Extended-A": range(43776, 43823 + 1), + "Latin Extended-E": range(43824, 43887 + 1), + "Cherokee Supplement": range(43888, 43967 + 1), + "Meetei Mayek": range(43968, 44031 + 1), + "Hangul Syllables": range(44032, 55215 + 1), + "Hangul Jamo Extended-B": range(55216, 55295 + 1), + "High Surrogates": range(55296, 56191 + 1), + "High Private Use Surrogates": range(56192, 56319 + 1), + "Low Surrogates": range(56320, 57343 + 1), + "Private Use Area": range(57344, 63743 + 1), + "CJK Compatibility Ideographs": range(63744, 64255 + 1), + "Alphabetic Presentation Forms": range(64256, 64335 + 1), + "Arabic Presentation Forms-A": range(64336, 65023 + 1), + "Variation Selectors": range(65024, 65039 + 1), + "Vertical Forms": range(65040, 65055 + 1), + "Combining Half Marks": range(65056, 65071 + 1), + "CJK Compatibility Forms": range(65072, 65103 + 1), + "Small Form Variants": range(65104, 65135 + 1), + "Arabic Presentation Forms-B": range(65136, 65279 + 1), + "Halfwidth and Fullwidth Forms": range(65280, 65519 + 1), + "Specials": range(65520, 65535 + 1), + "Linear B Syllabary": range(65536, 65663 + 1), + "Linear B Ideograms": range(65664, 65791 + 1), + "Aegean Numbers": range(65792, 65855 + 1), + "Ancient Greek Numbers": range(65856, 65935 + 1), + "Ancient Symbols": range(65936, 65999 + 1), + "Phaistos Disc": range(66000, 66047 + 1), + "Lycian": range(66176, 66207 + 1), + "Carian": range(66208, 66271 + 1), + "Coptic Epact Numbers": range(66272, 66303 + 1), + "Old Italic": range(66304, 66351 + 1), + "Gothic": range(66352, 66383 + 1), + "Old Permic": range(66384, 66431 + 1), + "Ugaritic": range(66432, 66463 + 1), + "Old Persian": range(66464, 66527 + 1), + "Deseret": range(66560, 66639 + 1), + "Shavian": range(66640, 66687 + 1), + "Osmanya": range(66688, 66735 + 1), + "Osage": range(66736, 66815 + 1), + "Elbasan": range(66816, 66863 + 1), + "Caucasian Albanian": range(66864, 66927 + 1), + "Linear A": range(67072, 67455 + 1), + "Cypriot Syllabary": range(67584, 67647 + 1), + "Imperial Aramaic": range(67648, 67679 + 1), + "Palmyrene": range(67680, 67711 + 1), + "Nabataean": range(67712, 67759 + 1), + "Hatran": range(67808, 67839 + 1), + "Phoenician": range(67840, 67871 + 1), + "Lydian": range(67872, 67903 + 1), + "Meroitic Hieroglyphs": range(67968, 67999 + 1), + "Meroitic Cursive": range(68000, 68095 + 1), + "Kharoshthi": range(68096, 68191 + 1), + "Old South Arabian": range(68192, 68223 + 1), + "Old North Arabian": range(68224, 68255 + 1), + "Manichaean": range(68288, 68351 + 1), + "Avestan": range(68352, 68415 + 1), + "Inscriptional Parthian": range(68416, 68447 + 1), + "Inscriptional Pahlavi": range(68448, 68479 + 1), + "Psalter Pahlavi": range(68480, 68527 + 1), + "Old Turkic": range(68608, 68687 + 1), + "Old Hungarian": range(68736, 68863 + 1), + "Rumi Numeral Symbols": range(69216, 69247 + 1), + "Brahmi": range(69632, 69759 + 1), + "Kaithi": range(69760, 69839 + 1), + "Sora Sompeng": range(69840, 69887 + 1), + "Chakma": range(69888, 69967 + 1), + "Mahajani": range(69968, 70015 + 1), + "Sharada": range(70016, 70111 + 1), + "Sinhala Archaic Numbers": range(70112, 70143 + 1), + "Khojki": range(70144, 70223 + 1), + "Multani": range(70272, 70319 + 1), + "Khudawadi": range(70320, 70399 + 1), + "Grantha": range(70400, 70527 + 1), + "Newa": range(70656, 70783 + 1), + "Tirhuta": range(70784, 70879 + 1), + "Siddham": range(71040, 71167 + 1), + "Modi": range(71168, 71263 + 1), + "Mongolian Supplement": range(71264, 71295 + 1), + "Takri": range(71296, 71375 + 1), + "Ahom": range(71424, 71487 + 1), + "Warang Citi": range(71840, 71935 + 1), + "Zanabazar Square": range(72192, 72271 + 1), + "Soyombo": range(72272, 72367 + 1), + "Pau Cin Hau": range(72384, 72447 + 1), + "Bhaiksuki": range(72704, 72815 + 1), + "Marchen": range(72816, 72895 + 1), + "Masaram Gondi": range(72960, 73055 + 1), + "Cuneiform": range(73728, 74751 + 1), + "Cuneiform Numbers and Punctuation": range(74752, 74879 + 1), + "Early Dynastic Cuneiform": range(74880, 75087 + 1), + "Egyptian Hieroglyphs": range(77824, 78895 + 1), + "Anatolian Hieroglyphs": range(82944, 83583 + 1), + "Bamum Supplement": range(92160, 92735 + 1), + "Mro": range(92736, 92783 + 1), + "Bassa Vah": range(92880, 92927 + 1), + "Pahawh Hmong": range(92928, 93071 + 1), + "Miao": range(93952, 94111 + 1), + "Ideographic Symbols and Punctuation": range(94176, 94207 + 1), + "Tangut": range(94208, 100351 + 1), + "Tangut Components": range(100352, 101119 + 1), + "Kana Supplement": range(110592, 110847 + 1), + "Kana Extended-A": range(110848, 110895 + 1), + "Nushu": range(110960, 111359 + 1), + "Duployan": range(113664, 113823 + 1), + "Shorthand Format Controls": range(113824, 113839 + 1), + "Byzantine Musical Symbols": range(118784, 119039 + 1), + "Musical Symbols": range(119040, 119295 + 1), + "Ancient Greek Musical Notation": range(119296, 119375 + 1), + "Tai Xuan Jing Symbols": range(119552, 119647 + 1), + "Counting Rod Numerals": range(119648, 119679 + 1), + "Mathematical Alphanumeric Symbols": range(119808, 120831 + 1), + "Sutton SignWriting": range(120832, 121519 + 1), + "Glagolitic Supplement": range(122880, 122927 + 1), + "Mende Kikakui": range(124928, 125151 + 1), + "Adlam": range(125184, 125279 + 1), + "Arabic Mathematical Alphabetic Symbols": range(126464, 126719 + 1), + "Mahjong Tiles": range(126976, 127023 + 1), + "Domino Tiles": range(127024, 127135 + 1), + "Playing Cards": range(127136, 127231 + 1), + "Enclosed Alphanumeric Supplement": range(127232, 127487 + 1), + "Enclosed Ideographic Supplement": range(127488, 127743 + 1), + "Miscellaneous Symbols and Pictographs": range(127744, 128511 + 1), + "Emoticons range(Emoji)": range(128512, 128591 + 1), + "Ornamental Dingbats": range(128592, 128639 + 1), + "Transport and Map Symbols": range(128640, 128767 + 1), + "Alchemical Symbols": range(128768, 128895 + 1), + "Geometric Shapes Extended": range(128896, 129023 + 1), + "Supplemental Arrows-C": range(129024, 129279 + 1), + "Supplemental Symbols and Pictographs": range(129280, 129535 + 1), + "CJK Unified Ideographs Extension B": range(131072, 173791 + 1), + "CJK Unified Ideographs Extension C": range(173824, 177983 + 1), + "CJK Unified Ideographs Extension D": range(177984, 178207 + 1), + "CJK Unified Ideographs Extension E": range(178208, 183983 + 1), + "CJK Unified Ideographs Extension F": range(183984, 191471 + 1), + "CJK Compatibility Ideographs Supplement": range(194560, 195103 + 1), + "Tags": range(917504, 917631 + 1), + "Variation Selectors Supplement": range(917760, 917999 + 1), +} + + +UNICODE_SECONDARY_RANGE_KEYWORD: List[str] = [ + "Supplement", + "Extended", + "Extensions", + "Modifier", + "Marks", + "Punctuation", + "Symbols", + "Forms", + "Operators", + "Miscellaneous", + "Drawing", + "Block", + "Shapes", + "Supplemental", + "Tags", +] + +RE_POSSIBLE_ENCODING_INDICATION = re_compile( + r"(?:(?:encoding)|(?:charset)|(?:coding))(?:[\:= ]{1,10})(?:[\"\']?)([a-zA-Z0-9\-_]+)(?:[\"\']?)", + IGNORECASE, +) + +IANA_SUPPORTED: List[str] = sorted( + filter( + lambda x: x.endswith("_codec") is False + and x not in {"rot_13", "tactis", "mbcs"}, + list(set(aliases.values())), + ) +) + +IANA_SUPPORTED_COUNT: int = len(IANA_SUPPORTED) + +# pre-computed code page that are similar using the function cp_similarity. +IANA_SUPPORTED_SIMILAR: Dict[str, List[str]] = { + "cp037": ["cp1026", "cp1140", "cp273", "cp500"], + "cp1026": ["cp037", "cp1140", "cp273", "cp500"], + "cp1125": ["cp866"], + "cp1140": ["cp037", "cp1026", "cp273", "cp500"], + "cp1250": ["iso8859_2"], + "cp1251": ["kz1048", "ptcp154"], + "cp1252": ["iso8859_15", "iso8859_9", "latin_1"], + "cp1253": ["iso8859_7"], + "cp1254": ["iso8859_15", "iso8859_9", "latin_1"], + "cp1257": ["iso8859_13"], + "cp273": ["cp037", "cp1026", "cp1140", "cp500"], + "cp437": ["cp850", "cp858", "cp860", "cp861", "cp862", "cp863", "cp865"], + "cp500": ["cp037", "cp1026", "cp1140", "cp273"], + "cp850": ["cp437", "cp857", "cp858", "cp865"], + "cp857": ["cp850", "cp858", "cp865"], + "cp858": ["cp437", "cp850", "cp857", "cp865"], + "cp860": ["cp437", "cp861", "cp862", "cp863", "cp865"], + "cp861": ["cp437", "cp860", "cp862", "cp863", "cp865"], + "cp862": ["cp437", "cp860", "cp861", "cp863", "cp865"], + "cp863": ["cp437", "cp860", "cp861", "cp862", "cp865"], + "cp865": ["cp437", "cp850", "cp857", "cp858", "cp860", "cp861", "cp862", "cp863"], + "cp866": ["cp1125"], + "iso8859_10": ["iso8859_14", "iso8859_15", "iso8859_4", "iso8859_9", "latin_1"], + "iso8859_11": ["tis_620"], + "iso8859_13": ["cp1257"], + "iso8859_14": [ + "iso8859_10", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_9", + "latin_1", + ], + "iso8859_15": [ + "cp1252", + "cp1254", + "iso8859_10", + "iso8859_14", + "iso8859_16", + "iso8859_3", + "iso8859_9", + "latin_1", + ], + "iso8859_16": [ + "iso8859_14", + "iso8859_15", + "iso8859_2", + "iso8859_3", + "iso8859_9", + "latin_1", + ], + "iso8859_2": ["cp1250", "iso8859_16", "iso8859_4"], + "iso8859_3": ["iso8859_14", "iso8859_15", "iso8859_16", "iso8859_9", "latin_1"], + "iso8859_4": ["iso8859_10", "iso8859_2", "iso8859_9", "latin_1"], + "iso8859_7": ["cp1253"], + "iso8859_9": [ + "cp1252", + "cp1254", + "cp1258", + "iso8859_10", + "iso8859_14", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_4", + "latin_1", + ], + "kz1048": ["cp1251", "ptcp154"], + "latin_1": [ + "cp1252", + "cp1254", + "cp1258", + "iso8859_10", + "iso8859_14", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_4", + "iso8859_9", + ], + "mac_iceland": ["mac_roman", "mac_turkish"], + "mac_roman": ["mac_iceland", "mac_turkish"], + "mac_turkish": ["mac_iceland", "mac_roman"], + "ptcp154": ["cp1251", "kz1048"], + "tis_620": ["iso8859_11"], +} + + +CHARDET_CORRESPONDENCE: Dict[str, str] = { + "iso2022_kr": "ISO-2022-KR", + "iso2022_jp": "ISO-2022-JP", + "euc_kr": "EUC-KR", + "tis_620": "TIS-620", + "utf_32": "UTF-32", + "euc_jp": "EUC-JP", + "koi8_r": "KOI8-R", + "iso8859_1": "ISO-8859-1", + "iso8859_2": "ISO-8859-2", + "iso8859_5": "ISO-8859-5", + "iso8859_6": "ISO-8859-6", + "iso8859_7": "ISO-8859-7", + "iso8859_8": "ISO-8859-8", + "utf_16": "UTF-16", + "cp855": "IBM855", + "mac_cyrillic": "MacCyrillic", + "gb2312": "GB2312", + "gb18030": "GB18030", + "cp932": "CP932", + "cp866": "IBM866", + "utf_8": "utf-8", + "utf_8_sig": "UTF-8-SIG", + "shift_jis": "SHIFT_JIS", + "big5": "Big5", + "cp1250": "windows-1250", + "cp1251": "windows-1251", + "cp1252": "Windows-1252", + "cp1253": "windows-1253", + "cp1255": "windows-1255", + "cp1256": "windows-1256", + "cp1254": "Windows-1254", + "cp949": "CP949", +} + + +COMMON_SAFE_ASCII_CHARACTERS: Set[str] = { + "<", + ">", + "=", + ":", + "/", + "&", + ";", + "{", + "}", + "[", + "]", + ",", + "|", + '"', + "-", +} + + +KO_NAMES: Set[str] = {"johab", "cp949", "euc_kr"} +ZH_NAMES: Set[str] = {"big5", "cp950", "big5hkscs", "hz"} + +LANGUAGE_SUPPORTED_COUNT: int = len(FREQUENCIES) + +# Logging LEVEL below DEBUG +TRACE: int = 5 diff --git a/billinglayer/python/charset_normalizer/legacy.py b/billinglayer/python/charset_normalizer/legacy.py new file mode 100644 index 0000000..43aad21 --- /dev/null +++ b/billinglayer/python/charset_normalizer/legacy.py @@ -0,0 +1,54 @@ +from typing import Any, Dict, Optional, Union +from warnings import warn + +from .api import from_bytes +from .constant import CHARDET_CORRESPONDENCE + + +def detect( + byte_str: bytes, should_rename_legacy: bool = False, **kwargs: Any +) -> Dict[str, Optional[Union[str, float]]]: + """ + chardet legacy method + Detect the encoding of the given byte string. It should be mostly backward-compatible. + Encoding name will match Chardet own writing whenever possible. (Not on encoding name unsupported by it) + This function is deprecated and should be used to migrate your project easily, consult the documentation for + further information. Not planned for removal. + + :param byte_str: The byte sequence to examine. + :param should_rename_legacy: Should we rename legacy encodings + to their more modern equivalents? + """ + if len(kwargs): + warn( + f"charset-normalizer disregard arguments '{','.join(list(kwargs.keys()))}' in legacy function detect()" + ) + + if not isinstance(byte_str, (bytearray, bytes)): + raise TypeError( # pragma: nocover + "Expected object of type bytes or bytearray, got: " + "{0}".format(type(byte_str)) + ) + + if isinstance(byte_str, bytearray): + byte_str = bytes(byte_str) + + r = from_bytes(byte_str).best() + + encoding = r.encoding if r is not None else None + language = r.language if r is not None and r.language != "Unknown" else "" + confidence = 1.0 - r.chaos if r is not None else None + + # Note: CharsetNormalizer does not return 'UTF-8-SIG' as the sig get stripped in the detection/normalization process + # but chardet does return 'utf-8-sig' and it is a valid codec name. + if r is not None and encoding == "utf_8" and r.bom: + encoding += "_sig" + + if should_rename_legacy is False and encoding in CHARDET_CORRESPONDENCE: + encoding = CHARDET_CORRESPONDENCE[encoding] + + return { + "encoding": encoding, + "language": language, + "confidence": confidence, + } diff --git a/billinglayer/python/charset_normalizer/md.cpython-311-x86_64-linux-gnu.so b/billinglayer/python/charset_normalizer/md.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..38fda6e Binary files /dev/null and b/billinglayer/python/charset_normalizer/md.cpython-311-x86_64-linux-gnu.so differ diff --git a/billinglayer/python/charset_normalizer/md.py b/billinglayer/python/charset_normalizer/md.py new file mode 100644 index 0000000..13aa062 --- /dev/null +++ b/billinglayer/python/charset_normalizer/md.py @@ -0,0 +1,582 @@ +from functools import lru_cache +from logging import getLogger +from typing import List, Optional + +from .constant import ( + COMMON_SAFE_ASCII_CHARACTERS, + TRACE, + UNICODE_SECONDARY_RANGE_KEYWORD, +) +from .utils import ( + is_accentuated, + is_ascii, + is_case_variable, + is_cjk, + is_emoticon, + is_hangul, + is_hiragana, + is_katakana, + is_latin, + is_punctuation, + is_separator, + is_symbol, + is_thai, + is_unprintable, + remove_accent, + unicode_range, +) + + +class MessDetectorPlugin: + """ + Base abstract class used for mess detection plugins. + All detectors MUST extend and implement given methods. + """ + + def eligible(self, character: str) -> bool: + """ + Determine if given character should be fed in. + """ + raise NotImplementedError # pragma: nocover + + def feed(self, character: str) -> None: + """ + The main routine to be executed upon character. + Insert the logic in witch the text would be considered chaotic. + """ + raise NotImplementedError # pragma: nocover + + def reset(self) -> None: # pragma: no cover + """ + Permit to reset the plugin to the initial state. + """ + raise NotImplementedError + + @property + def ratio(self) -> float: + """ + Compute the chaos ratio based on what your feed() has seen. + Must NOT be lower than 0.; No restriction gt 0. + """ + raise NotImplementedError # pragma: nocover + + +class TooManySymbolOrPunctuationPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._punctuation_count: int = 0 + self._symbol_count: int = 0 + self._character_count: int = 0 + + self._last_printable_char: Optional[str] = None + self._frenzy_symbol_in_word: bool = False + + def eligible(self, character: str) -> bool: + return character.isprintable() + + def feed(self, character: str) -> None: + self._character_count += 1 + + if ( + character != self._last_printable_char + and character not in COMMON_SAFE_ASCII_CHARACTERS + ): + if is_punctuation(character): + self._punctuation_count += 1 + elif ( + character.isdigit() is False + and is_symbol(character) + and is_emoticon(character) is False + ): + self._symbol_count += 2 + + self._last_printable_char = character + + def reset(self) -> None: # pragma: no cover + self._punctuation_count = 0 + self._character_count = 0 + self._symbol_count = 0 + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + ratio_of_punctuation: float = ( + self._punctuation_count + self._symbol_count + ) / self._character_count + + return ratio_of_punctuation if ratio_of_punctuation >= 0.3 else 0.0 + + +class TooManyAccentuatedPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._character_count: int = 0 + self._accentuated_count: int = 0 + + def eligible(self, character: str) -> bool: + return character.isalpha() + + def feed(self, character: str) -> None: + self._character_count += 1 + + if is_accentuated(character): + self._accentuated_count += 1 + + def reset(self) -> None: # pragma: no cover + self._character_count = 0 + self._accentuated_count = 0 + + @property + def ratio(self) -> float: + if self._character_count == 0 or self._character_count < 8: + return 0.0 + ratio_of_accentuation: float = self._accentuated_count / self._character_count + return ratio_of_accentuation if ratio_of_accentuation >= 0.35 else 0.0 + + +class UnprintablePlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._unprintable_count: int = 0 + self._character_count: int = 0 + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + if is_unprintable(character): + self._unprintable_count += 1 + self._character_count += 1 + + def reset(self) -> None: # pragma: no cover + self._unprintable_count = 0 + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + return (self._unprintable_count * 8) / self._character_count + + +class SuspiciousDuplicateAccentPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._successive_count: int = 0 + self._character_count: int = 0 + + self._last_latin_character: Optional[str] = None + + def eligible(self, character: str) -> bool: + return character.isalpha() and is_latin(character) + + def feed(self, character: str) -> None: + self._character_count += 1 + if ( + self._last_latin_character is not None + and is_accentuated(character) + and is_accentuated(self._last_latin_character) + ): + if character.isupper() and self._last_latin_character.isupper(): + self._successive_count += 1 + # Worse if its the same char duplicated with different accent. + if remove_accent(character) == remove_accent(self._last_latin_character): + self._successive_count += 1 + self._last_latin_character = character + + def reset(self) -> None: # pragma: no cover + self._successive_count = 0 + self._character_count = 0 + self._last_latin_character = None + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + return (self._successive_count * 2) / self._character_count + + +class SuspiciousRange(MessDetectorPlugin): + def __init__(self) -> None: + self._suspicious_successive_range_count: int = 0 + self._character_count: int = 0 + self._last_printable_seen: Optional[str] = None + + def eligible(self, character: str) -> bool: + return character.isprintable() + + def feed(self, character: str) -> None: + self._character_count += 1 + + if ( + character.isspace() + or is_punctuation(character) + or character in COMMON_SAFE_ASCII_CHARACTERS + ): + self._last_printable_seen = None + return + + if self._last_printable_seen is None: + self._last_printable_seen = character + return + + unicode_range_a: Optional[str] = unicode_range(self._last_printable_seen) + unicode_range_b: Optional[str] = unicode_range(character) + + if is_suspiciously_successive_range(unicode_range_a, unicode_range_b): + self._suspicious_successive_range_count += 1 + + self._last_printable_seen = character + + def reset(self) -> None: # pragma: no cover + self._character_count = 0 + self._suspicious_successive_range_count = 0 + self._last_printable_seen = None + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + ratio_of_suspicious_range_usage: float = ( + self._suspicious_successive_range_count * 2 + ) / self._character_count + + if ratio_of_suspicious_range_usage < 0.1: + return 0.0 + + return ratio_of_suspicious_range_usage + + +class SuperWeirdWordPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._word_count: int = 0 + self._bad_word_count: int = 0 + self._foreign_long_count: int = 0 + + self._is_current_word_bad: bool = False + self._foreign_long_watch: bool = False + + self._character_count: int = 0 + self._bad_character_count: int = 0 + + self._buffer: str = "" + self._buffer_accent_count: int = 0 + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + if character.isalpha(): + self._buffer += character + if is_accentuated(character): + self._buffer_accent_count += 1 + if ( + self._foreign_long_watch is False + and (is_latin(character) is False or is_accentuated(character)) + and is_cjk(character) is False + and is_hangul(character) is False + and is_katakana(character) is False + and is_hiragana(character) is False + and is_thai(character) is False + ): + self._foreign_long_watch = True + return + if not self._buffer: + return + if ( + character.isspace() or is_punctuation(character) or is_separator(character) + ) and self._buffer: + self._word_count += 1 + buffer_length: int = len(self._buffer) + + self._character_count += buffer_length + + if buffer_length >= 4: + if self._buffer_accent_count / buffer_length > 0.34: + self._is_current_word_bad = True + # Word/Buffer ending with an upper case accentuated letter are so rare, + # that we will consider them all as suspicious. Same weight as foreign_long suspicious. + if is_accentuated(self._buffer[-1]) and self._buffer[-1].isupper(): + self._foreign_long_count += 1 + self._is_current_word_bad = True + if buffer_length >= 24 and self._foreign_long_watch: + camel_case_dst = [ + i + for c, i in zip(self._buffer, range(0, buffer_length)) + if c.isupper() + ] + probable_camel_cased: bool = False + + if camel_case_dst and (len(camel_case_dst) / buffer_length <= 0.3): + probable_camel_cased = True + + if not probable_camel_cased: + self._foreign_long_count += 1 + self._is_current_word_bad = True + + if self._is_current_word_bad: + self._bad_word_count += 1 + self._bad_character_count += len(self._buffer) + self._is_current_word_bad = False + + self._foreign_long_watch = False + self._buffer = "" + self._buffer_accent_count = 0 + elif ( + character not in {"<", ">", "-", "=", "~", "|", "_"} + and character.isdigit() is False + and is_symbol(character) + ): + self._is_current_word_bad = True + self._buffer += character + + def reset(self) -> None: # pragma: no cover + self._buffer = "" + self._is_current_word_bad = False + self._foreign_long_watch = False + self._bad_word_count = 0 + self._word_count = 0 + self._character_count = 0 + self._bad_character_count = 0 + self._foreign_long_count = 0 + + @property + def ratio(self) -> float: + if self._word_count <= 10 and self._foreign_long_count == 0: + return 0.0 + + return self._bad_character_count / self._character_count + + +class CjkInvalidStopPlugin(MessDetectorPlugin): + """ + GB(Chinese) based encoding often render the stop incorrectly when the content does not fit and + can be easily detected. Searching for the overuse of '丅' and '丄'. + """ + + def __init__(self) -> None: + self._wrong_stop_count: int = 0 + self._cjk_character_count: int = 0 + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + if character in {"丅", "丄"}: + self._wrong_stop_count += 1 + return + if is_cjk(character): + self._cjk_character_count += 1 + + def reset(self) -> None: # pragma: no cover + self._wrong_stop_count = 0 + self._cjk_character_count = 0 + + @property + def ratio(self) -> float: + if self._cjk_character_count < 16: + return 0.0 + return self._wrong_stop_count / self._cjk_character_count + + +class ArchaicUpperLowerPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._buf: bool = False + + self._character_count_since_last_sep: int = 0 + + self._successive_upper_lower_count: int = 0 + self._successive_upper_lower_count_final: int = 0 + + self._character_count: int = 0 + + self._last_alpha_seen: Optional[str] = None + self._current_ascii_only: bool = True + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + is_concerned = character.isalpha() and is_case_variable(character) + chunk_sep = is_concerned is False + + if chunk_sep and self._character_count_since_last_sep > 0: + if ( + self._character_count_since_last_sep <= 64 + and character.isdigit() is False + and self._current_ascii_only is False + ): + self._successive_upper_lower_count_final += ( + self._successive_upper_lower_count + ) + + self._successive_upper_lower_count = 0 + self._character_count_since_last_sep = 0 + self._last_alpha_seen = None + self._buf = False + self._character_count += 1 + self._current_ascii_only = True + + return + + if self._current_ascii_only is True and is_ascii(character) is False: + self._current_ascii_only = False + + if self._last_alpha_seen is not None: + if (character.isupper() and self._last_alpha_seen.islower()) or ( + character.islower() and self._last_alpha_seen.isupper() + ): + if self._buf is True: + self._successive_upper_lower_count += 2 + self._buf = False + else: + self._buf = True + else: + self._buf = False + + self._character_count += 1 + self._character_count_since_last_sep += 1 + self._last_alpha_seen = character + + def reset(self) -> None: # pragma: no cover + self._character_count = 0 + self._character_count_since_last_sep = 0 + self._successive_upper_lower_count = 0 + self._successive_upper_lower_count_final = 0 + self._last_alpha_seen = None + self._buf = False + self._current_ascii_only = True + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + return self._successive_upper_lower_count_final / self._character_count + + +@lru_cache(maxsize=1024) +def is_suspiciously_successive_range( + unicode_range_a: Optional[str], unicode_range_b: Optional[str] +) -> bool: + """ + Determine if two Unicode range seen next to each other can be considered as suspicious. + """ + if unicode_range_a is None or unicode_range_b is None: + return True + + if unicode_range_a == unicode_range_b: + return False + + if "Latin" in unicode_range_a and "Latin" in unicode_range_b: + return False + + if "Emoticons" in unicode_range_a or "Emoticons" in unicode_range_b: + return False + + # Latin characters can be accompanied with a combining diacritical mark + # eg. Vietnamese. + if ("Latin" in unicode_range_a or "Latin" in unicode_range_b) and ( + "Combining" in unicode_range_a or "Combining" in unicode_range_b + ): + return False + + keywords_range_a, keywords_range_b = unicode_range_a.split( + " " + ), unicode_range_b.split(" ") + + for el in keywords_range_a: + if el in UNICODE_SECONDARY_RANGE_KEYWORD: + continue + if el in keywords_range_b: + return False + + # Japanese Exception + range_a_jp_chars, range_b_jp_chars = ( + unicode_range_a + in ( + "Hiragana", + "Katakana", + ), + unicode_range_b in ("Hiragana", "Katakana"), + ) + if (range_a_jp_chars or range_b_jp_chars) and ( + "CJK" in unicode_range_a or "CJK" in unicode_range_b + ): + return False + if range_a_jp_chars and range_b_jp_chars: + return False + + if "Hangul" in unicode_range_a or "Hangul" in unicode_range_b: + if "CJK" in unicode_range_a or "CJK" in unicode_range_b: + return False + if unicode_range_a == "Basic Latin" or unicode_range_b == "Basic Latin": + return False + + # Chinese/Japanese use dedicated range for punctuation and/or separators. + if ("CJK" in unicode_range_a or "CJK" in unicode_range_b) or ( + unicode_range_a in ["Katakana", "Hiragana"] + and unicode_range_b in ["Katakana", "Hiragana"] + ): + if "Punctuation" in unicode_range_a or "Punctuation" in unicode_range_b: + return False + if "Forms" in unicode_range_a or "Forms" in unicode_range_b: + return False + + return True + + +@lru_cache(maxsize=2048) +def mess_ratio( + decoded_sequence: str, maximum_threshold: float = 0.2, debug: bool = False +) -> float: + """ + Compute a mess ratio given a decoded bytes sequence. The maximum threshold does stop the computation earlier. + """ + + detectors: List[MessDetectorPlugin] = [ + md_class() for md_class in MessDetectorPlugin.__subclasses__() + ] + + length: int = len(decoded_sequence) + 1 + + mean_mess_ratio: float = 0.0 + + if length < 512: + intermediary_mean_mess_ratio_calc: int = 32 + elif length <= 1024: + intermediary_mean_mess_ratio_calc = 64 + else: + intermediary_mean_mess_ratio_calc = 128 + + for character, index in zip(decoded_sequence + "\n", range(length)): + for detector in detectors: + if detector.eligible(character): + detector.feed(character) + + if ( + index > 0 and index % intermediary_mean_mess_ratio_calc == 0 + ) or index == length - 1: + mean_mess_ratio = sum(dt.ratio for dt in detectors) + + if mean_mess_ratio >= maximum_threshold: + break + + if debug: + logger = getLogger("charset_normalizer") + + logger.log( + TRACE, + "Mess-detector extended-analysis start. " + f"intermediary_mean_mess_ratio_calc={intermediary_mean_mess_ratio_calc} mean_mess_ratio={mean_mess_ratio} " + f"maximum_threshold={maximum_threshold}", + ) + + if len(decoded_sequence) > 16: + logger.log(TRACE, f"Starting with: {decoded_sequence[:16]}") + logger.log(TRACE, f"Ending with: {decoded_sequence[-16::]}") + + for dt in detectors: # pragma: nocover + logger.log(TRACE, f"{dt.__class__}: {dt.ratio}") + + return round(mean_mess_ratio, 3) diff --git a/billinglayer/python/charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so b/billinglayer/python/charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..b9b97c9 Binary files /dev/null and b/billinglayer/python/charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so differ diff --git a/billinglayer/python/charset_normalizer/models.py b/billinglayer/python/charset_normalizer/models.py new file mode 100644 index 0000000..7f8ca38 --- /dev/null +++ b/billinglayer/python/charset_normalizer/models.py @@ -0,0 +1,337 @@ +from encodings.aliases import aliases +from hashlib import sha256 +from json import dumps +from typing import Any, Dict, Iterator, List, Optional, Tuple, Union + +from .constant import TOO_BIG_SEQUENCE +from .utils import iana_name, is_multi_byte_encoding, unicode_range + + +class CharsetMatch: + def __init__( + self, + payload: bytes, + guessed_encoding: str, + mean_mess_ratio: float, + has_sig_or_bom: bool, + languages: "CoherenceMatches", + decoded_payload: Optional[str] = None, + ): + self._payload: bytes = payload + + self._encoding: str = guessed_encoding + self._mean_mess_ratio: float = mean_mess_ratio + self._languages: CoherenceMatches = languages + self._has_sig_or_bom: bool = has_sig_or_bom + self._unicode_ranges: Optional[List[str]] = None + + self._leaves: List[CharsetMatch] = [] + self._mean_coherence_ratio: float = 0.0 + + self._output_payload: Optional[bytes] = None + self._output_encoding: Optional[str] = None + + self._string: Optional[str] = decoded_payload + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CharsetMatch): + raise TypeError( + "__eq__ cannot be invoked on {} and {}.".format( + str(other.__class__), str(self.__class__) + ) + ) + return self.encoding == other.encoding and self.fingerprint == other.fingerprint + + def __lt__(self, other: object) -> bool: + """ + Implemented to make sorted available upon CharsetMatches items. + """ + if not isinstance(other, CharsetMatch): + raise ValueError + + chaos_difference: float = abs(self.chaos - other.chaos) + coherence_difference: float = abs(self.coherence - other.coherence) + + # Below 1% difference --> Use Coherence + if chaos_difference < 0.01 and coherence_difference > 0.02: + # When having a tough decision, use the result that decoded as many multi-byte as possible. + if chaos_difference == 0.0 and self.coherence == other.coherence: + return self.multi_byte_usage > other.multi_byte_usage + return self.coherence > other.coherence + + return self.chaos < other.chaos + + @property + def multi_byte_usage(self) -> float: + return 1.0 - len(str(self)) / len(self.raw) + + def __str__(self) -> str: + # Lazy Str Loading + if self._string is None: + self._string = str(self._payload, self._encoding, "strict") + return self._string + + def __repr__(self) -> str: + return "".format(self.encoding, self.fingerprint) + + def add_submatch(self, other: "CharsetMatch") -> None: + if not isinstance(other, CharsetMatch) or other == self: + raise ValueError( + "Unable to add instance <{}> as a submatch of a CharsetMatch".format( + other.__class__ + ) + ) + + other._string = None # Unload RAM usage; dirty trick. + self._leaves.append(other) + + @property + def encoding(self) -> str: + return self._encoding + + @property + def encoding_aliases(self) -> List[str]: + """ + Encoding name are known by many name, using this could help when searching for IBM855 when it's listed as CP855. + """ + also_known_as: List[str] = [] + for u, p in aliases.items(): + if self.encoding == u: + also_known_as.append(p) + elif self.encoding == p: + also_known_as.append(u) + return also_known_as + + @property + def bom(self) -> bool: + return self._has_sig_or_bom + + @property + def byte_order_mark(self) -> bool: + return self._has_sig_or_bom + + @property + def languages(self) -> List[str]: + """ + Return the complete list of possible languages found in decoded sequence. + Usually not really useful. Returned list may be empty even if 'language' property return something != 'Unknown'. + """ + return [e[0] for e in self._languages] + + @property + def language(self) -> str: + """ + Most probable language found in decoded sequence. If none were detected or inferred, the property will return + "Unknown". + """ + if not self._languages: + # Trying to infer the language based on the given encoding + # Its either English or we should not pronounce ourselves in certain cases. + if "ascii" in self.could_be_from_charset: + return "English" + + # doing it there to avoid circular import + from charset_normalizer.cd import encoding_languages, mb_encoding_languages + + languages = ( + mb_encoding_languages(self.encoding) + if is_multi_byte_encoding(self.encoding) + else encoding_languages(self.encoding) + ) + + if len(languages) == 0 or "Latin Based" in languages: + return "Unknown" + + return languages[0] + + return self._languages[0][0] + + @property + def chaos(self) -> float: + return self._mean_mess_ratio + + @property + def coherence(self) -> float: + if not self._languages: + return 0.0 + return self._languages[0][1] + + @property + def percent_chaos(self) -> float: + return round(self.chaos * 100, ndigits=3) + + @property + def percent_coherence(self) -> float: + return round(self.coherence * 100, ndigits=3) + + @property + def raw(self) -> bytes: + """ + Original untouched bytes. + """ + return self._payload + + @property + def submatch(self) -> List["CharsetMatch"]: + return self._leaves + + @property + def has_submatch(self) -> bool: + return len(self._leaves) > 0 + + @property + def alphabets(self) -> List[str]: + if self._unicode_ranges is not None: + return self._unicode_ranges + # list detected ranges + detected_ranges: List[Optional[str]] = [ + unicode_range(char) for char in str(self) + ] + # filter and sort + self._unicode_ranges = sorted(list({r for r in detected_ranges if r})) + return self._unicode_ranges + + @property + def could_be_from_charset(self) -> List[str]: + """ + The complete list of encoding that output the exact SAME str result and therefore could be the originating + encoding. + This list does include the encoding available in property 'encoding'. + """ + return [self._encoding] + [m.encoding for m in self._leaves] + + def output(self, encoding: str = "utf_8") -> bytes: + """ + Method to get re-encoded bytes payload using given target encoding. Default to UTF-8. + Any errors will be simply ignored by the encoder NOT replaced. + """ + if self._output_encoding is None or self._output_encoding != encoding: + self._output_encoding = encoding + self._output_payload = str(self).encode(encoding, "replace") + + return self._output_payload # type: ignore + + @property + def fingerprint(self) -> str: + """ + Retrieve the unique SHA256 computed using the transformed (re-encoded) payload. Not the original one. + """ + return sha256(self.output()).hexdigest() + + +class CharsetMatches: + """ + Container with every CharsetMatch items ordered by default from most probable to the less one. + Act like a list(iterable) but does not implements all related methods. + """ + + def __init__(self, results: Optional[List[CharsetMatch]] = None): + self._results: List[CharsetMatch] = sorted(results) if results else [] + + def __iter__(self) -> Iterator[CharsetMatch]: + yield from self._results + + def __getitem__(self, item: Union[int, str]) -> CharsetMatch: + """ + Retrieve a single item either by its position or encoding name (alias may be used here). + Raise KeyError upon invalid index or encoding not present in results. + """ + if isinstance(item, int): + return self._results[item] + if isinstance(item, str): + item = iana_name(item, False) + for result in self._results: + if item in result.could_be_from_charset: + return result + raise KeyError + + def __len__(self) -> int: + return len(self._results) + + def __bool__(self) -> bool: + return len(self._results) > 0 + + def append(self, item: CharsetMatch) -> None: + """ + Insert a single match. Will be inserted accordingly to preserve sort. + Can be inserted as a submatch. + """ + if not isinstance(item, CharsetMatch): + raise ValueError( + "Cannot append instance '{}' to CharsetMatches".format( + str(item.__class__) + ) + ) + # We should disable the submatch factoring when the input file is too heavy (conserve RAM usage) + if len(item.raw) <= TOO_BIG_SEQUENCE: + for match in self._results: + if match.fingerprint == item.fingerprint and match.chaos == item.chaos: + match.add_submatch(item) + return + self._results.append(item) + self._results = sorted(self._results) + + def best(self) -> Optional["CharsetMatch"]: + """ + Simply return the first match. Strict equivalent to matches[0]. + """ + if not self._results: + return None + return self._results[0] + + def first(self) -> Optional["CharsetMatch"]: + """ + Redundant method, call the method best(). Kept for BC reasons. + """ + return self.best() + + +CoherenceMatch = Tuple[str, float] +CoherenceMatches = List[CoherenceMatch] + + +class CliDetectionResult: + def __init__( + self, + path: str, + encoding: Optional[str], + encoding_aliases: List[str], + alternative_encodings: List[str], + language: str, + alphabets: List[str], + has_sig_or_bom: bool, + chaos: float, + coherence: float, + unicode_path: Optional[str], + is_preferred: bool, + ): + self.path: str = path + self.unicode_path: Optional[str] = unicode_path + self.encoding: Optional[str] = encoding + self.encoding_aliases: List[str] = encoding_aliases + self.alternative_encodings: List[str] = alternative_encodings + self.language: str = language + self.alphabets: List[str] = alphabets + self.has_sig_or_bom: bool = has_sig_or_bom + self.chaos: float = chaos + self.coherence: float = coherence + self.is_preferred: bool = is_preferred + + @property + def __dict__(self) -> Dict[str, Any]: # type: ignore + return { + "path": self.path, + "encoding": self.encoding, + "encoding_aliases": self.encoding_aliases, + "alternative_encodings": self.alternative_encodings, + "language": self.language, + "alphabets": self.alphabets, + "has_sig_or_bom": self.has_sig_or_bom, + "chaos": self.chaos, + "coherence": self.coherence, + "unicode_path": self.unicode_path, + "is_preferred": self.is_preferred, + } + + def to_json(self) -> str: + return dumps(self.__dict__, ensure_ascii=True, indent=4) diff --git a/billinglayer/python/charset_normalizer/py.typed b/billinglayer/python/charset_normalizer/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/charset_normalizer/utils.py b/billinglayer/python/charset_normalizer/utils.py new file mode 100644 index 0000000..bf2767a --- /dev/null +++ b/billinglayer/python/charset_normalizer/utils.py @@ -0,0 +1,414 @@ +import importlib +import logging +import unicodedata +from codecs import IncrementalDecoder +from encodings.aliases import aliases +from functools import lru_cache +from re import findall +from typing import Generator, List, Optional, Set, Tuple, Union + +from _multibytecodec import MultibyteIncrementalDecoder + +from .constant import ( + ENCODING_MARKS, + IANA_SUPPORTED_SIMILAR, + RE_POSSIBLE_ENCODING_INDICATION, + UNICODE_RANGES_COMBINED, + UNICODE_SECONDARY_RANGE_KEYWORD, + UTF8_MAXIMAL_ALLOCATION, +) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_accentuated(character: str) -> bool: + try: + description: str = unicodedata.name(character) + except ValueError: + return False + return ( + "WITH GRAVE" in description + or "WITH ACUTE" in description + or "WITH CEDILLA" in description + or "WITH DIAERESIS" in description + or "WITH CIRCUMFLEX" in description + or "WITH TILDE" in description + ) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def remove_accent(character: str) -> str: + decomposed: str = unicodedata.decomposition(character) + if not decomposed: + return character + + codes: List[str] = decomposed.split(" ") + + return chr(int(codes[0], 16)) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def unicode_range(character: str) -> Optional[str]: + """ + Retrieve the Unicode range official name from a single character. + """ + character_ord: int = ord(character) + + for range_name, ord_range in UNICODE_RANGES_COMBINED.items(): + if character_ord in ord_range: + return range_name + + return None + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_latin(character: str) -> bool: + try: + description: str = unicodedata.name(character) + except ValueError: + return False + return "LATIN" in description + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_ascii(character: str) -> bool: + try: + character.encode("ascii") + except UnicodeEncodeError: + return False + return True + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_punctuation(character: str) -> bool: + character_category: str = unicodedata.category(character) + + if "P" in character_category: + return True + + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + return False + + return "Punctuation" in character_range + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_symbol(character: str) -> bool: + character_category: str = unicodedata.category(character) + + if "S" in character_category or "N" in character_category: + return True + + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + return False + + return "Forms" in character_range + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_emoticon(character: str) -> bool: + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + return False + + return "Emoticons" in character_range + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_separator(character: str) -> bool: + if character.isspace() or character in {"|", "+", "<", ">"}: + return True + + character_category: str = unicodedata.category(character) + + return "Z" in character_category or character_category in {"Po", "Pd", "Pc"} + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_case_variable(character: str) -> bool: + return character.islower() != character.isupper() + + +def is_private_use_only(character: str) -> bool: + character_category: str = unicodedata.category(character) + + return character_category == "Co" + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_cjk(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "CJK" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_hiragana(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "HIRAGANA" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_katakana(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "KATAKANA" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_hangul(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "HANGUL" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_thai(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "THAI" in character_name + + +@lru_cache(maxsize=len(UNICODE_RANGES_COMBINED)) +def is_unicode_range_secondary(range_name: str) -> bool: + return any(keyword in range_name for keyword in UNICODE_SECONDARY_RANGE_KEYWORD) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_unprintable(character: str) -> bool: + return ( + character.isspace() is False # includes \n \t \r \v + and character.isprintable() is False + and character != "\x1A" # Why? Its the ASCII substitute character. + and character != "\ufeff" # bug discovered in Python, + # Zero Width No-Break Space located in Arabic Presentation Forms-B, Unicode 1.1 not acknowledged as space. + ) + + +def any_specified_encoding(sequence: bytes, search_zone: int = 4096) -> Optional[str]: + """ + Extract using ASCII-only decoder any specified encoding in the first n-bytes. + """ + if not isinstance(sequence, bytes): + raise TypeError + + seq_len: int = len(sequence) + + results: List[str] = findall( + RE_POSSIBLE_ENCODING_INDICATION, + sequence[: min(seq_len, search_zone)].decode("ascii", errors="ignore"), + ) + + if len(results) == 0: + return None + + for specified_encoding in results: + specified_encoding = specified_encoding.lower().replace("-", "_") + + encoding_alias: str + encoding_iana: str + + for encoding_alias, encoding_iana in aliases.items(): + if encoding_alias == specified_encoding: + return encoding_iana + if encoding_iana == specified_encoding: + return encoding_iana + + return None + + +@lru_cache(maxsize=128) +def is_multi_byte_encoding(name: str) -> bool: + """ + Verify is a specific encoding is a multi byte one based on it IANA name + """ + return name in { + "utf_8", + "utf_8_sig", + "utf_16", + "utf_16_be", + "utf_16_le", + "utf_32", + "utf_32_le", + "utf_32_be", + "utf_7", + } or issubclass( + importlib.import_module("encodings.{}".format(name)).IncrementalDecoder, + MultibyteIncrementalDecoder, + ) + + +def identify_sig_or_bom(sequence: bytes) -> Tuple[Optional[str], bytes]: + """ + Identify and extract SIG/BOM in given sequence. + """ + + for iana_encoding in ENCODING_MARKS: + marks: Union[bytes, List[bytes]] = ENCODING_MARKS[iana_encoding] + + if isinstance(marks, bytes): + marks = [marks] + + for mark in marks: + if sequence.startswith(mark): + return iana_encoding, mark + + return None, b"" + + +def should_strip_sig_or_bom(iana_encoding: str) -> bool: + return iana_encoding not in {"utf_16", "utf_32"} + + +def iana_name(cp_name: str, strict: bool = True) -> str: + cp_name = cp_name.lower().replace("-", "_") + + encoding_alias: str + encoding_iana: str + + for encoding_alias, encoding_iana in aliases.items(): + if cp_name in [encoding_alias, encoding_iana]: + return encoding_iana + + if strict: + raise ValueError("Unable to retrieve IANA for '{}'".format(cp_name)) + + return cp_name + + +def range_scan(decoded_sequence: str) -> List[str]: + ranges: Set[str] = set() + + for character in decoded_sequence: + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + continue + + ranges.add(character_range) + + return list(ranges) + + +def cp_similarity(iana_name_a: str, iana_name_b: str) -> float: + if is_multi_byte_encoding(iana_name_a) or is_multi_byte_encoding(iana_name_b): + return 0.0 + + decoder_a = importlib.import_module( + "encodings.{}".format(iana_name_a) + ).IncrementalDecoder + decoder_b = importlib.import_module( + "encodings.{}".format(iana_name_b) + ).IncrementalDecoder + + id_a: IncrementalDecoder = decoder_a(errors="ignore") + id_b: IncrementalDecoder = decoder_b(errors="ignore") + + character_match_count: int = 0 + + for i in range(255): + to_be_decoded: bytes = bytes([i]) + if id_a.decode(to_be_decoded) == id_b.decode(to_be_decoded): + character_match_count += 1 + + return character_match_count / 254 + + +def is_cp_similar(iana_name_a: str, iana_name_b: str) -> bool: + """ + Determine if two code page are at least 80% similar. IANA_SUPPORTED_SIMILAR dict was generated using + the function cp_similarity. + """ + return ( + iana_name_a in IANA_SUPPORTED_SIMILAR + and iana_name_b in IANA_SUPPORTED_SIMILAR[iana_name_a] + ) + + +def set_logging_handler( + name: str = "charset_normalizer", + level: int = logging.INFO, + format_string: str = "%(asctime)s | %(levelname)s | %(message)s", +) -> None: + logger = logging.getLogger(name) + logger.setLevel(level) + + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter(format_string)) + logger.addHandler(handler) + + +def cut_sequence_chunks( + sequences: bytes, + encoding_iana: str, + offsets: range, + chunk_size: int, + bom_or_sig_available: bool, + strip_sig_or_bom: bool, + sig_payload: bytes, + is_multi_byte_decoder: bool, + decoded_payload: Optional[str] = None, +) -> Generator[str, None, None]: + if decoded_payload and is_multi_byte_decoder is False: + for i in offsets: + chunk = decoded_payload[i : i + chunk_size] + if not chunk: + break + yield chunk + else: + for i in offsets: + chunk_end = i + chunk_size + if chunk_end > len(sequences) + 8: + continue + + cut_sequence = sequences[i : i + chunk_size] + + if bom_or_sig_available and strip_sig_or_bom is False: + cut_sequence = sig_payload + cut_sequence + + chunk = cut_sequence.decode( + encoding_iana, + errors="ignore" if is_multi_byte_decoder else "strict", + ) + + # multi-byte bad cutting detector and adjustment + # not the cleanest way to perform that fix but clever enough for now. + if is_multi_byte_decoder and i > 0: + chunk_partial_size_chk: int = min(chunk_size, 16) + + if ( + decoded_payload + and chunk[:chunk_partial_size_chk] not in decoded_payload + ): + for j in range(i, i - 4, -1): + cut_sequence = sequences[j:chunk_end] + + if bom_or_sig_available and strip_sig_or_bom is False: + cut_sequence = sig_payload + cut_sequence + + chunk = cut_sequence.decode(encoding_iana, errors="ignore") + + if chunk[:chunk_partial_size_chk] in decoded_payload: + break + + yield chunk diff --git a/billinglayer/python/charset_normalizer/version.py b/billinglayer/python/charset_normalizer/version.py new file mode 100644 index 0000000..5eed49a --- /dev/null +++ b/billinglayer/python/charset_normalizer/version.py @@ -0,0 +1,6 @@ +""" +Expose version +""" + +__version__ = "3.2.0" +VERSION = __version__.split(".") diff --git a/billinglayer/python/click/__init__.py b/billinglayer/python/click/__init__.py new file mode 100644 index 0000000..9a1dab0 --- /dev/null +++ b/billinglayer/python/click/__init__.py @@ -0,0 +1,73 @@ +""" +Click is a simple Python module inspired by the stdlib optparse to make +writing command line scripts fun. Unlike other modules, it's based +around a simple API that does not come with too much magic and is +composable. +""" +from .core import Argument as Argument +from .core import BaseCommand as BaseCommand +from .core import Command as Command +from .core import CommandCollection as CommandCollection +from .core import Context as Context +from .core import Group as Group +from .core import MultiCommand as MultiCommand +from .core import Option as Option +from .core import Parameter as Parameter +from .decorators import argument as argument +from .decorators import command as command +from .decorators import confirmation_option as confirmation_option +from .decorators import group as group +from .decorators import help_option as help_option +from .decorators import make_pass_decorator as make_pass_decorator +from .decorators import option as option +from .decorators import pass_context as pass_context +from .decorators import pass_obj as pass_obj +from .decorators import password_option as password_option +from .decorators import version_option as version_option +from .exceptions import Abort as Abort +from .exceptions import BadArgumentUsage as BadArgumentUsage +from .exceptions import BadOptionUsage as BadOptionUsage +from .exceptions import BadParameter as BadParameter +from .exceptions import ClickException as ClickException +from .exceptions import FileError as FileError +from .exceptions import MissingParameter as MissingParameter +from .exceptions import NoSuchOption as NoSuchOption +from .exceptions import UsageError as UsageError +from .formatting import HelpFormatter as HelpFormatter +from .formatting import wrap_text as wrap_text +from .globals import get_current_context as get_current_context +from .parser import OptionParser as OptionParser +from .termui import clear as clear +from .termui import confirm as confirm +from .termui import echo_via_pager as echo_via_pager +from .termui import edit as edit +from .termui import getchar as getchar +from .termui import launch as launch +from .termui import pause as pause +from .termui import progressbar as progressbar +from .termui import prompt as prompt +from .termui import secho as secho +from .termui import style as style +from .termui import unstyle as unstyle +from .types import BOOL as BOOL +from .types import Choice as Choice +from .types import DateTime as DateTime +from .types import File as File +from .types import FLOAT as FLOAT +from .types import FloatRange as FloatRange +from .types import INT as INT +from .types import IntRange as IntRange +from .types import ParamType as ParamType +from .types import Path as Path +from .types import STRING as STRING +from .types import Tuple as Tuple +from .types import UNPROCESSED as UNPROCESSED +from .types import UUID as UUID +from .utils import echo as echo +from .utils import format_filename as format_filename +from .utils import get_app_dir as get_app_dir +from .utils import get_binary_stream as get_binary_stream +from .utils import get_text_stream as get_text_stream +from .utils import open_file as open_file + +__version__ = "8.1.7" diff --git a/billinglayer/python/click/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/click/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1c4b03d Binary files /dev/null and b/billinglayer/python/click/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/_compat.cpython-311.pyc b/billinglayer/python/click/__pycache__/_compat.cpython-311.pyc new file mode 100644 index 0000000..aa105fe Binary files /dev/null and b/billinglayer/python/click/__pycache__/_compat.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/_termui_impl.cpython-311.pyc b/billinglayer/python/click/__pycache__/_termui_impl.cpython-311.pyc new file mode 100644 index 0000000..206cfdd Binary files /dev/null and b/billinglayer/python/click/__pycache__/_termui_impl.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/_textwrap.cpython-311.pyc b/billinglayer/python/click/__pycache__/_textwrap.cpython-311.pyc new file mode 100644 index 0000000..ef2c062 Binary files /dev/null and b/billinglayer/python/click/__pycache__/_textwrap.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/_winconsole.cpython-311.pyc b/billinglayer/python/click/__pycache__/_winconsole.cpython-311.pyc new file mode 100644 index 0000000..8eec081 Binary files /dev/null and b/billinglayer/python/click/__pycache__/_winconsole.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/core.cpython-311.pyc b/billinglayer/python/click/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..893a478 Binary files /dev/null and b/billinglayer/python/click/__pycache__/core.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/decorators.cpython-311.pyc b/billinglayer/python/click/__pycache__/decorators.cpython-311.pyc new file mode 100644 index 0000000..221aa30 Binary files /dev/null and b/billinglayer/python/click/__pycache__/decorators.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/exceptions.cpython-311.pyc b/billinglayer/python/click/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..62589f2 Binary files /dev/null and b/billinglayer/python/click/__pycache__/exceptions.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/formatting.cpython-311.pyc b/billinglayer/python/click/__pycache__/formatting.cpython-311.pyc new file mode 100644 index 0000000..d4defa2 Binary files /dev/null and b/billinglayer/python/click/__pycache__/formatting.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/globals.cpython-311.pyc b/billinglayer/python/click/__pycache__/globals.cpython-311.pyc new file mode 100644 index 0000000..d98bf27 Binary files /dev/null and b/billinglayer/python/click/__pycache__/globals.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/parser.cpython-311.pyc b/billinglayer/python/click/__pycache__/parser.cpython-311.pyc new file mode 100644 index 0000000..f7ea009 Binary files /dev/null and b/billinglayer/python/click/__pycache__/parser.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/shell_completion.cpython-311.pyc b/billinglayer/python/click/__pycache__/shell_completion.cpython-311.pyc new file mode 100644 index 0000000..cdafa8f Binary files /dev/null and b/billinglayer/python/click/__pycache__/shell_completion.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/termui.cpython-311.pyc b/billinglayer/python/click/__pycache__/termui.cpython-311.pyc new file mode 100644 index 0000000..218f9e0 Binary files /dev/null and b/billinglayer/python/click/__pycache__/termui.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/testing.cpython-311.pyc b/billinglayer/python/click/__pycache__/testing.cpython-311.pyc new file mode 100644 index 0000000..21e2744 Binary files /dev/null and b/billinglayer/python/click/__pycache__/testing.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/types.cpython-311.pyc b/billinglayer/python/click/__pycache__/types.cpython-311.pyc new file mode 100644 index 0000000..4575bc6 Binary files /dev/null and b/billinglayer/python/click/__pycache__/types.cpython-311.pyc differ diff --git a/billinglayer/python/click/__pycache__/utils.cpython-311.pyc b/billinglayer/python/click/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..5767500 Binary files /dev/null and b/billinglayer/python/click/__pycache__/utils.cpython-311.pyc differ diff --git a/billinglayer/python/click/_compat.py b/billinglayer/python/click/_compat.py new file mode 100644 index 0000000..23f8866 --- /dev/null +++ b/billinglayer/python/click/_compat.py @@ -0,0 +1,623 @@ +import codecs +import io +import os +import re +import sys +import typing as t +from weakref import WeakKeyDictionary + +CYGWIN = sys.platform.startswith("cygwin") +WIN = sys.platform.startswith("win") +auto_wrap_for_ansi: t.Optional[t.Callable[[t.TextIO], t.TextIO]] = None +_ansi_re = re.compile(r"\033\[[;?0-9]*[a-zA-Z]") + + +def _make_text_stream( + stream: t.BinaryIO, + encoding: t.Optional[str], + errors: t.Optional[str], + force_readable: bool = False, + force_writable: bool = False, +) -> t.TextIO: + if encoding is None: + encoding = get_best_encoding(stream) + if errors is None: + errors = "replace" + return _NonClosingTextIOWrapper( + stream, + encoding, + errors, + line_buffering=True, + force_readable=force_readable, + force_writable=force_writable, + ) + + +def is_ascii_encoding(encoding: str) -> bool: + """Checks if a given encoding is ascii.""" + try: + return codecs.lookup(encoding).name == "ascii" + except LookupError: + return False + + +def get_best_encoding(stream: t.IO[t.Any]) -> str: + """Returns the default stream encoding if not found.""" + rv = getattr(stream, "encoding", None) or sys.getdefaultencoding() + if is_ascii_encoding(rv): + return "utf-8" + return rv + + +class _NonClosingTextIOWrapper(io.TextIOWrapper): + def __init__( + self, + stream: t.BinaryIO, + encoding: t.Optional[str], + errors: t.Optional[str], + force_readable: bool = False, + force_writable: bool = False, + **extra: t.Any, + ) -> None: + self._stream = stream = t.cast( + t.BinaryIO, _FixupStream(stream, force_readable, force_writable) + ) + super().__init__(stream, encoding, errors, **extra) + + def __del__(self) -> None: + try: + self.detach() + except Exception: + pass + + def isatty(self) -> bool: + # https://bitbucket.org/pypy/pypy/issue/1803 + return self._stream.isatty() + + +class _FixupStream: + """The new io interface needs more from streams than streams + traditionally implement. As such, this fix-up code is necessary in + some circumstances. + + The forcing of readable and writable flags are there because some tools + put badly patched objects on sys (one such offender are certain version + of jupyter notebook). + """ + + def __init__( + self, + stream: t.BinaryIO, + force_readable: bool = False, + force_writable: bool = False, + ): + self._stream = stream + self._force_readable = force_readable + self._force_writable = force_writable + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._stream, name) + + def read1(self, size: int) -> bytes: + f = getattr(self._stream, "read1", None) + + if f is not None: + return t.cast(bytes, f(size)) + + return self._stream.read(size) + + def readable(self) -> bool: + if self._force_readable: + return True + x = getattr(self._stream, "readable", None) + if x is not None: + return t.cast(bool, x()) + try: + self._stream.read(0) + except Exception: + return False + return True + + def writable(self) -> bool: + if self._force_writable: + return True + x = getattr(self._stream, "writable", None) + if x is not None: + return t.cast(bool, x()) + try: + self._stream.write("") # type: ignore + except Exception: + try: + self._stream.write(b"") + except Exception: + return False + return True + + def seekable(self) -> bool: + x = getattr(self._stream, "seekable", None) + if x is not None: + return t.cast(bool, x()) + try: + self._stream.seek(self._stream.tell()) + except Exception: + return False + return True + + +def _is_binary_reader(stream: t.IO[t.Any], default: bool = False) -> bool: + try: + return isinstance(stream.read(0), bytes) + except Exception: + return default + # This happens in some cases where the stream was already + # closed. In this case, we assume the default. + + +def _is_binary_writer(stream: t.IO[t.Any], default: bool = False) -> bool: + try: + stream.write(b"") + except Exception: + try: + stream.write("") + return False + except Exception: + pass + return default + return True + + +def _find_binary_reader(stream: t.IO[t.Any]) -> t.Optional[t.BinaryIO]: + # We need to figure out if the given stream is already binary. + # This can happen because the official docs recommend detaching + # the streams to get binary streams. Some code might do this, so + # we need to deal with this case explicitly. + if _is_binary_reader(stream, False): + return t.cast(t.BinaryIO, stream) + + buf = getattr(stream, "buffer", None) + + # Same situation here; this time we assume that the buffer is + # actually binary in case it's closed. + if buf is not None and _is_binary_reader(buf, True): + return t.cast(t.BinaryIO, buf) + + return None + + +def _find_binary_writer(stream: t.IO[t.Any]) -> t.Optional[t.BinaryIO]: + # We need to figure out if the given stream is already binary. + # This can happen because the official docs recommend detaching + # the streams to get binary streams. Some code might do this, so + # we need to deal with this case explicitly. + if _is_binary_writer(stream, False): + return t.cast(t.BinaryIO, stream) + + buf = getattr(stream, "buffer", None) + + # Same situation here; this time we assume that the buffer is + # actually binary in case it's closed. + if buf is not None and _is_binary_writer(buf, True): + return t.cast(t.BinaryIO, buf) + + return None + + +def _stream_is_misconfigured(stream: t.TextIO) -> bool: + """A stream is misconfigured if its encoding is ASCII.""" + # If the stream does not have an encoding set, we assume it's set + # to ASCII. This appears to happen in certain unittest + # environments. It's not quite clear what the correct behavior is + # but this at least will force Click to recover somehow. + return is_ascii_encoding(getattr(stream, "encoding", None) or "ascii") + + +def _is_compat_stream_attr(stream: t.TextIO, attr: str, value: t.Optional[str]) -> bool: + """A stream attribute is compatible if it is equal to the + desired value or the desired value is unset and the attribute + has a value. + """ + stream_value = getattr(stream, attr, None) + return stream_value == value or (value is None and stream_value is not None) + + +def _is_compatible_text_stream( + stream: t.TextIO, encoding: t.Optional[str], errors: t.Optional[str] +) -> bool: + """Check if a stream's encoding and errors attributes are + compatible with the desired values. + """ + return _is_compat_stream_attr( + stream, "encoding", encoding + ) and _is_compat_stream_attr(stream, "errors", errors) + + +def _force_correct_text_stream( + text_stream: t.IO[t.Any], + encoding: t.Optional[str], + errors: t.Optional[str], + is_binary: t.Callable[[t.IO[t.Any], bool], bool], + find_binary: t.Callable[[t.IO[t.Any]], t.Optional[t.BinaryIO]], + force_readable: bool = False, + force_writable: bool = False, +) -> t.TextIO: + if is_binary(text_stream, False): + binary_reader = t.cast(t.BinaryIO, text_stream) + else: + text_stream = t.cast(t.TextIO, text_stream) + # If the stream looks compatible, and won't default to a + # misconfigured ascii encoding, return it as-is. + if _is_compatible_text_stream(text_stream, encoding, errors) and not ( + encoding is None and _stream_is_misconfigured(text_stream) + ): + return text_stream + + # Otherwise, get the underlying binary reader. + possible_binary_reader = find_binary(text_stream) + + # If that's not possible, silently use the original reader + # and get mojibake instead of exceptions. + if possible_binary_reader is None: + return text_stream + + binary_reader = possible_binary_reader + + # Default errors to replace instead of strict in order to get + # something that works. + if errors is None: + errors = "replace" + + # Wrap the binary stream in a text stream with the correct + # encoding parameters. + return _make_text_stream( + binary_reader, + encoding, + errors, + force_readable=force_readable, + force_writable=force_writable, + ) + + +def _force_correct_text_reader( + text_reader: t.IO[t.Any], + encoding: t.Optional[str], + errors: t.Optional[str], + force_readable: bool = False, +) -> t.TextIO: + return _force_correct_text_stream( + text_reader, + encoding, + errors, + _is_binary_reader, + _find_binary_reader, + force_readable=force_readable, + ) + + +def _force_correct_text_writer( + text_writer: t.IO[t.Any], + encoding: t.Optional[str], + errors: t.Optional[str], + force_writable: bool = False, +) -> t.TextIO: + return _force_correct_text_stream( + text_writer, + encoding, + errors, + _is_binary_writer, + _find_binary_writer, + force_writable=force_writable, + ) + + +def get_binary_stdin() -> t.BinaryIO: + reader = _find_binary_reader(sys.stdin) + if reader is None: + raise RuntimeError("Was not able to determine binary stream for sys.stdin.") + return reader + + +def get_binary_stdout() -> t.BinaryIO: + writer = _find_binary_writer(sys.stdout) + if writer is None: + raise RuntimeError("Was not able to determine binary stream for sys.stdout.") + return writer + + +def get_binary_stderr() -> t.BinaryIO: + writer = _find_binary_writer(sys.stderr) + if writer is None: + raise RuntimeError("Was not able to determine binary stream for sys.stderr.") + return writer + + +def get_text_stdin( + encoding: t.Optional[str] = None, errors: t.Optional[str] = None +) -> t.TextIO: + rv = _get_windows_console_stream(sys.stdin, encoding, errors) + if rv is not None: + return rv + return _force_correct_text_reader(sys.stdin, encoding, errors, force_readable=True) + + +def get_text_stdout( + encoding: t.Optional[str] = None, errors: t.Optional[str] = None +) -> t.TextIO: + rv = _get_windows_console_stream(sys.stdout, encoding, errors) + if rv is not None: + return rv + return _force_correct_text_writer(sys.stdout, encoding, errors, force_writable=True) + + +def get_text_stderr( + encoding: t.Optional[str] = None, errors: t.Optional[str] = None +) -> t.TextIO: + rv = _get_windows_console_stream(sys.stderr, encoding, errors) + if rv is not None: + return rv + return _force_correct_text_writer(sys.stderr, encoding, errors, force_writable=True) + + +def _wrap_io_open( + file: t.Union[str, "os.PathLike[str]", int], + mode: str, + encoding: t.Optional[str], + errors: t.Optional[str], +) -> t.IO[t.Any]: + """Handles not passing ``encoding`` and ``errors`` in binary mode.""" + if "b" in mode: + return open(file, mode) + + return open(file, mode, encoding=encoding, errors=errors) + + +def open_stream( + filename: "t.Union[str, os.PathLike[str]]", + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + atomic: bool = False, +) -> t.Tuple[t.IO[t.Any], bool]: + binary = "b" in mode + filename = os.fspath(filename) + + # Standard streams first. These are simple because they ignore the + # atomic flag. Use fsdecode to handle Path("-"). + if os.fsdecode(filename) == "-": + if any(m in mode for m in ["w", "a", "x"]): + if binary: + return get_binary_stdout(), False + return get_text_stdout(encoding=encoding, errors=errors), False + if binary: + return get_binary_stdin(), False + return get_text_stdin(encoding=encoding, errors=errors), False + + # Non-atomic writes directly go out through the regular open functions. + if not atomic: + return _wrap_io_open(filename, mode, encoding, errors), True + + # Some usability stuff for atomic writes + if "a" in mode: + raise ValueError( + "Appending to an existing file is not supported, because that" + " would involve an expensive `copy`-operation to a temporary" + " file. Open the file in normal `w`-mode and copy explicitly" + " if that's what you're after." + ) + if "x" in mode: + raise ValueError("Use the `overwrite`-parameter instead.") + if "w" not in mode: + raise ValueError("Atomic writes only make sense with `w`-mode.") + + # Atomic writes are more complicated. They work by opening a file + # as a proxy in the same folder and then using the fdopen + # functionality to wrap it in a Python file. Then we wrap it in an + # atomic file that moves the file over on close. + import errno + import random + + try: + perm: t.Optional[int] = os.stat(filename).st_mode + except OSError: + perm = None + + flags = os.O_RDWR | os.O_CREAT | os.O_EXCL + + if binary: + flags |= getattr(os, "O_BINARY", 0) + + while True: + tmp_filename = os.path.join( + os.path.dirname(filename), + f".__atomic-write{random.randrange(1 << 32):08x}", + ) + try: + fd = os.open(tmp_filename, flags, 0o666 if perm is None else perm) + break + except OSError as e: + if e.errno == errno.EEXIST or ( + os.name == "nt" + and e.errno == errno.EACCES + and os.path.isdir(e.filename) + and os.access(e.filename, os.W_OK) + ): + continue + raise + + if perm is not None: + os.chmod(tmp_filename, perm) # in case perm includes bits in umask + + f = _wrap_io_open(fd, mode, encoding, errors) + af = _AtomicFile(f, tmp_filename, os.path.realpath(filename)) + return t.cast(t.IO[t.Any], af), True + + +class _AtomicFile: + def __init__(self, f: t.IO[t.Any], tmp_filename: str, real_filename: str) -> None: + self._f = f + self._tmp_filename = tmp_filename + self._real_filename = real_filename + self.closed = False + + @property + def name(self) -> str: + return self._real_filename + + def close(self, delete: bool = False) -> None: + if self.closed: + return + self._f.close() + os.replace(self._tmp_filename, self._real_filename) + self.closed = True + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._f, name) + + def __enter__(self) -> "_AtomicFile": + return self + + def __exit__(self, exc_type: t.Optional[t.Type[BaseException]], *_: t.Any) -> None: + self.close(delete=exc_type is not None) + + def __repr__(self) -> str: + return repr(self._f) + + +def strip_ansi(value: str) -> str: + return _ansi_re.sub("", value) + + +def _is_jupyter_kernel_output(stream: t.IO[t.Any]) -> bool: + while isinstance(stream, (_FixupStream, _NonClosingTextIOWrapper)): + stream = stream._stream + + return stream.__class__.__module__.startswith("ipykernel.") + + +def should_strip_ansi( + stream: t.Optional[t.IO[t.Any]] = None, color: t.Optional[bool] = None +) -> bool: + if color is None: + if stream is None: + stream = sys.stdin + return not isatty(stream) and not _is_jupyter_kernel_output(stream) + return not color + + +# On Windows, wrap the output streams with colorama to support ANSI +# color codes. +# NOTE: double check is needed so mypy does not analyze this on Linux +if sys.platform.startswith("win") and WIN: + from ._winconsole import _get_windows_console_stream + + def _get_argv_encoding() -> str: + import locale + + return locale.getpreferredencoding() + + _ansi_stream_wrappers: t.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary() + + def auto_wrap_for_ansi( # noqa: F811 + stream: t.TextIO, color: t.Optional[bool] = None + ) -> t.TextIO: + """Support ANSI color and style codes on Windows by wrapping a + stream with colorama. + """ + try: + cached = _ansi_stream_wrappers.get(stream) + except Exception: + cached = None + + if cached is not None: + return cached + + import colorama + + strip = should_strip_ansi(stream, color) + ansi_wrapper = colorama.AnsiToWin32(stream, strip=strip) + rv = t.cast(t.TextIO, ansi_wrapper.stream) + _write = rv.write + + def _safe_write(s): + try: + return _write(s) + except BaseException: + ansi_wrapper.reset_all() + raise + + rv.write = _safe_write + + try: + _ansi_stream_wrappers[stream] = rv + except Exception: + pass + + return rv + +else: + + def _get_argv_encoding() -> str: + return getattr(sys.stdin, "encoding", None) or sys.getfilesystemencoding() + + def _get_windows_console_stream( + f: t.TextIO, encoding: t.Optional[str], errors: t.Optional[str] + ) -> t.Optional[t.TextIO]: + return None + + +def term_len(x: str) -> int: + return len(strip_ansi(x)) + + +def isatty(stream: t.IO[t.Any]) -> bool: + try: + return stream.isatty() + except Exception: + return False + + +def _make_cached_stream_func( + src_func: t.Callable[[], t.Optional[t.TextIO]], + wrapper_func: t.Callable[[], t.TextIO], +) -> t.Callable[[], t.Optional[t.TextIO]]: + cache: t.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary() + + def func() -> t.Optional[t.TextIO]: + stream = src_func() + + if stream is None: + return None + + try: + rv = cache.get(stream) + except Exception: + rv = None + if rv is not None: + return rv + rv = wrapper_func() + try: + cache[stream] = rv + except Exception: + pass + return rv + + return func + + +_default_text_stdin = _make_cached_stream_func(lambda: sys.stdin, get_text_stdin) +_default_text_stdout = _make_cached_stream_func(lambda: sys.stdout, get_text_stdout) +_default_text_stderr = _make_cached_stream_func(lambda: sys.stderr, get_text_stderr) + + +binary_streams: t.Mapping[str, t.Callable[[], t.BinaryIO]] = { + "stdin": get_binary_stdin, + "stdout": get_binary_stdout, + "stderr": get_binary_stderr, +} + +text_streams: t.Mapping[ + str, t.Callable[[t.Optional[str], t.Optional[str]], t.TextIO] +] = { + "stdin": get_text_stdin, + "stdout": get_text_stdout, + "stderr": get_text_stderr, +} diff --git a/billinglayer/python/click/_termui_impl.py b/billinglayer/python/click/_termui_impl.py new file mode 100644 index 0000000..f744657 --- /dev/null +++ b/billinglayer/python/click/_termui_impl.py @@ -0,0 +1,739 @@ +""" +This module contains implementations for the termui module. To keep the +import time of Click down, some infrequently used functionality is +placed in this module and only imported as needed. +""" +import contextlib +import math +import os +import sys +import time +import typing as t +from gettext import gettext as _ +from io import StringIO +from types import TracebackType + +from ._compat import _default_text_stdout +from ._compat import CYGWIN +from ._compat import get_best_encoding +from ._compat import isatty +from ._compat import open_stream +from ._compat import strip_ansi +from ._compat import term_len +from ._compat import WIN +from .exceptions import ClickException +from .utils import echo + +V = t.TypeVar("V") + +if os.name == "nt": + BEFORE_BAR = "\r" + AFTER_BAR = "\n" +else: + BEFORE_BAR = "\r\033[?25l" + AFTER_BAR = "\033[?25h\n" + + +class ProgressBar(t.Generic[V]): + def __init__( + self, + iterable: t.Optional[t.Iterable[V]], + length: t.Optional[int] = None, + fill_char: str = "#", + empty_char: str = " ", + bar_template: str = "%(bar)s", + info_sep: str = " ", + show_eta: bool = True, + show_percent: t.Optional[bool] = None, + show_pos: bool = False, + item_show_func: t.Optional[t.Callable[[t.Optional[V]], t.Optional[str]]] = None, + label: t.Optional[str] = None, + file: t.Optional[t.TextIO] = None, + color: t.Optional[bool] = None, + update_min_steps: int = 1, + width: int = 30, + ) -> None: + self.fill_char = fill_char + self.empty_char = empty_char + self.bar_template = bar_template + self.info_sep = info_sep + self.show_eta = show_eta + self.show_percent = show_percent + self.show_pos = show_pos + self.item_show_func = item_show_func + self.label: str = label or "" + + if file is None: + file = _default_text_stdout() + + # There are no standard streams attached to write to. For example, + # pythonw on Windows. + if file is None: + file = StringIO() + + self.file = file + self.color = color + self.update_min_steps = update_min_steps + self._completed_intervals = 0 + self.width: int = width + self.autowidth: bool = width == 0 + + if length is None: + from operator import length_hint + + length = length_hint(iterable, -1) + + if length == -1: + length = None + if iterable is None: + if length is None: + raise TypeError("iterable or length is required") + iterable = t.cast(t.Iterable[V], range(length)) + self.iter: t.Iterable[V] = iter(iterable) + self.length = length + self.pos = 0 + self.avg: t.List[float] = [] + self.last_eta: float + self.start: float + self.start = self.last_eta = time.time() + self.eta_known: bool = False + self.finished: bool = False + self.max_width: t.Optional[int] = None + self.entered: bool = False + self.current_item: t.Optional[V] = None + self.is_hidden: bool = not isatty(self.file) + self._last_line: t.Optional[str] = None + + def __enter__(self) -> "ProgressBar[V]": + self.entered = True + self.render_progress() + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + self.render_finish() + + def __iter__(self) -> t.Iterator[V]: + if not self.entered: + raise RuntimeError("You need to use progress bars in a with block.") + self.render_progress() + return self.generator() + + def __next__(self) -> V: + # Iteration is defined in terms of a generator function, + # returned by iter(self); use that to define next(). This works + # because `self.iter` is an iterable consumed by that generator, + # so it is re-entry safe. Calling `next(self.generator())` + # twice works and does "what you want". + return next(iter(self)) + + def render_finish(self) -> None: + if self.is_hidden: + return + self.file.write(AFTER_BAR) + self.file.flush() + + @property + def pct(self) -> float: + if self.finished: + return 1.0 + return min(self.pos / (float(self.length or 1) or 1), 1.0) + + @property + def time_per_iteration(self) -> float: + if not self.avg: + return 0.0 + return sum(self.avg) / float(len(self.avg)) + + @property + def eta(self) -> float: + if self.length is not None and not self.finished: + return self.time_per_iteration * (self.length - self.pos) + return 0.0 + + def format_eta(self) -> str: + if self.eta_known: + t = int(self.eta) + seconds = t % 60 + t //= 60 + minutes = t % 60 + t //= 60 + hours = t % 24 + t //= 24 + if t > 0: + return f"{t}d {hours:02}:{minutes:02}:{seconds:02}" + else: + return f"{hours:02}:{minutes:02}:{seconds:02}" + return "" + + def format_pos(self) -> str: + pos = str(self.pos) + if self.length is not None: + pos += f"/{self.length}" + return pos + + def format_pct(self) -> str: + return f"{int(self.pct * 100): 4}%"[1:] + + def format_bar(self) -> str: + if self.length is not None: + bar_length = int(self.pct * self.width) + bar = self.fill_char * bar_length + bar += self.empty_char * (self.width - bar_length) + elif self.finished: + bar = self.fill_char * self.width + else: + chars = list(self.empty_char * (self.width or 1)) + if self.time_per_iteration != 0: + chars[ + int( + (math.cos(self.pos * self.time_per_iteration) / 2.0 + 0.5) + * self.width + ) + ] = self.fill_char + bar = "".join(chars) + return bar + + def format_progress_line(self) -> str: + show_percent = self.show_percent + + info_bits = [] + if self.length is not None and show_percent is None: + show_percent = not self.show_pos + + if self.show_pos: + info_bits.append(self.format_pos()) + if show_percent: + info_bits.append(self.format_pct()) + if self.show_eta and self.eta_known and not self.finished: + info_bits.append(self.format_eta()) + if self.item_show_func is not None: + item_info = self.item_show_func(self.current_item) + if item_info is not None: + info_bits.append(item_info) + + return ( + self.bar_template + % { + "label": self.label, + "bar": self.format_bar(), + "info": self.info_sep.join(info_bits), + } + ).rstrip() + + def render_progress(self) -> None: + import shutil + + if self.is_hidden: + # Only output the label as it changes if the output is not a + # TTY. Use file=stderr if you expect to be piping stdout. + if self._last_line != self.label: + self._last_line = self.label + echo(self.label, file=self.file, color=self.color) + + return + + buf = [] + # Update width in case the terminal has been resized + if self.autowidth: + old_width = self.width + self.width = 0 + clutter_length = term_len(self.format_progress_line()) + new_width = max(0, shutil.get_terminal_size().columns - clutter_length) + if new_width < old_width: + buf.append(BEFORE_BAR) + buf.append(" " * self.max_width) # type: ignore + self.max_width = new_width + self.width = new_width + + clear_width = self.width + if self.max_width is not None: + clear_width = self.max_width + + buf.append(BEFORE_BAR) + line = self.format_progress_line() + line_len = term_len(line) + if self.max_width is None or self.max_width < line_len: + self.max_width = line_len + + buf.append(line) + buf.append(" " * (clear_width - line_len)) + line = "".join(buf) + # Render the line only if it changed. + + if line != self._last_line: + self._last_line = line + echo(line, file=self.file, color=self.color, nl=False) + self.file.flush() + + def make_step(self, n_steps: int) -> None: + self.pos += n_steps + if self.length is not None and self.pos >= self.length: + self.finished = True + + if (time.time() - self.last_eta) < 1.0: + return + + self.last_eta = time.time() + + # self.avg is a rolling list of length <= 7 of steps where steps are + # defined as time elapsed divided by the total progress through + # self.length. + if self.pos: + step = (time.time() - self.start) / self.pos + else: + step = time.time() - self.start + + self.avg = self.avg[-6:] + [step] + + self.eta_known = self.length is not None + + def update(self, n_steps: int, current_item: t.Optional[V] = None) -> None: + """Update the progress bar by advancing a specified number of + steps, and optionally set the ``current_item`` for this new + position. + + :param n_steps: Number of steps to advance. + :param current_item: Optional item to set as ``current_item`` + for the updated position. + + .. versionchanged:: 8.0 + Added the ``current_item`` optional parameter. + + .. versionchanged:: 8.0 + Only render when the number of steps meets the + ``update_min_steps`` threshold. + """ + if current_item is not None: + self.current_item = current_item + + self._completed_intervals += n_steps + + if self._completed_intervals >= self.update_min_steps: + self.make_step(self._completed_intervals) + self.render_progress() + self._completed_intervals = 0 + + def finish(self) -> None: + self.eta_known = False + self.current_item = None + self.finished = True + + def generator(self) -> t.Iterator[V]: + """Return a generator which yields the items added to the bar + during construction, and updates the progress bar *after* the + yielded block returns. + """ + # WARNING: the iterator interface for `ProgressBar` relies on + # this and only works because this is a simple generator which + # doesn't create or manage additional state. If this function + # changes, the impact should be evaluated both against + # `iter(bar)` and `next(bar)`. `next()` in particular may call + # `self.generator()` repeatedly, and this must remain safe in + # order for that interface to work. + if not self.entered: + raise RuntimeError("You need to use progress bars in a with block.") + + if self.is_hidden: + yield from self.iter + else: + for rv in self.iter: + self.current_item = rv + + # This allows show_item_func to be updated before the + # item is processed. Only trigger at the beginning of + # the update interval. + if self._completed_intervals == 0: + self.render_progress() + + yield rv + self.update(1) + + self.finish() + self.render_progress() + + +def pager(generator: t.Iterable[str], color: t.Optional[bool] = None) -> None: + """Decide what method to use for paging through text.""" + stdout = _default_text_stdout() + + # There are no standard streams attached to write to. For example, + # pythonw on Windows. + if stdout is None: + stdout = StringIO() + + if not isatty(sys.stdin) or not isatty(stdout): + return _nullpager(stdout, generator, color) + pager_cmd = (os.environ.get("PAGER", None) or "").strip() + if pager_cmd: + if WIN: + return _tempfilepager(generator, pager_cmd, color) + return _pipepager(generator, pager_cmd, color) + if os.environ.get("TERM") in ("dumb", "emacs"): + return _nullpager(stdout, generator, color) + if WIN or sys.platform.startswith("os2"): + return _tempfilepager(generator, "more <", color) + if hasattr(os, "system") and os.system("(less) 2>/dev/null") == 0: + return _pipepager(generator, "less", color) + + import tempfile + + fd, filename = tempfile.mkstemp() + os.close(fd) + try: + if hasattr(os, "system") and os.system(f'more "{filename}"') == 0: + return _pipepager(generator, "more", color) + return _nullpager(stdout, generator, color) + finally: + os.unlink(filename) + + +def _pipepager(generator: t.Iterable[str], cmd: str, color: t.Optional[bool]) -> None: + """Page through text by feeding it to another program. Invoking a + pager through this might support colors. + """ + import subprocess + + env = dict(os.environ) + + # If we're piping to less we might support colors under the + # condition that + cmd_detail = cmd.rsplit("/", 1)[-1].split() + if color is None and cmd_detail[0] == "less": + less_flags = f"{os.environ.get('LESS', '')}{' '.join(cmd_detail[1:])}" + if not less_flags: + env["LESS"] = "-R" + color = True + elif "r" in less_flags or "R" in less_flags: + color = True + + c = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, env=env) + stdin = t.cast(t.BinaryIO, c.stdin) + encoding = get_best_encoding(stdin) + try: + for text in generator: + if not color: + text = strip_ansi(text) + + stdin.write(text.encode(encoding, "replace")) + except (OSError, KeyboardInterrupt): + pass + else: + stdin.close() + + # Less doesn't respect ^C, but catches it for its own UI purposes (aborting + # search or other commands inside less). + # + # That means when the user hits ^C, the parent process (click) terminates, + # but less is still alive, paging the output and messing up the terminal. + # + # If the user wants to make the pager exit on ^C, they should set + # `LESS='-K'`. It's not our decision to make. + while True: + try: + c.wait() + except KeyboardInterrupt: + pass + else: + break + + +def _tempfilepager( + generator: t.Iterable[str], cmd: str, color: t.Optional[bool] +) -> None: + """Page through text by invoking a program on a temporary file.""" + import tempfile + + fd, filename = tempfile.mkstemp() + # TODO: This never terminates if the passed generator never terminates. + text = "".join(generator) + if not color: + text = strip_ansi(text) + encoding = get_best_encoding(sys.stdout) + with open_stream(filename, "wb")[0] as f: + f.write(text.encode(encoding)) + try: + os.system(f'{cmd} "{filename}"') + finally: + os.close(fd) + os.unlink(filename) + + +def _nullpager( + stream: t.TextIO, generator: t.Iterable[str], color: t.Optional[bool] +) -> None: + """Simply print unformatted text. This is the ultimate fallback.""" + for text in generator: + if not color: + text = strip_ansi(text) + stream.write(text) + + +class Editor: + def __init__( + self, + editor: t.Optional[str] = None, + env: t.Optional[t.Mapping[str, str]] = None, + require_save: bool = True, + extension: str = ".txt", + ) -> None: + self.editor = editor + self.env = env + self.require_save = require_save + self.extension = extension + + def get_editor(self) -> str: + if self.editor is not None: + return self.editor + for key in "VISUAL", "EDITOR": + rv = os.environ.get(key) + if rv: + return rv + if WIN: + return "notepad" + for editor in "sensible-editor", "vim", "nano": + if os.system(f"which {editor} >/dev/null 2>&1") == 0: + return editor + return "vi" + + def edit_file(self, filename: str) -> None: + import subprocess + + editor = self.get_editor() + environ: t.Optional[t.Dict[str, str]] = None + + if self.env: + environ = os.environ.copy() + environ.update(self.env) + + try: + c = subprocess.Popen(f'{editor} "{filename}"', env=environ, shell=True) + exit_code = c.wait() + if exit_code != 0: + raise ClickException( + _("{editor}: Editing failed").format(editor=editor) + ) + except OSError as e: + raise ClickException( + _("{editor}: Editing failed: {e}").format(editor=editor, e=e) + ) from e + + def edit(self, text: t.Optional[t.AnyStr]) -> t.Optional[t.AnyStr]: + import tempfile + + if not text: + data = b"" + elif isinstance(text, (bytes, bytearray)): + data = text + else: + if text and not text.endswith("\n"): + text += "\n" + + if WIN: + data = text.replace("\n", "\r\n").encode("utf-8-sig") + else: + data = text.encode("utf-8") + + fd, name = tempfile.mkstemp(prefix="editor-", suffix=self.extension) + f: t.BinaryIO + + try: + with os.fdopen(fd, "wb") as f: + f.write(data) + + # If the filesystem resolution is 1 second, like Mac OS + # 10.12 Extended, or 2 seconds, like FAT32, and the editor + # closes very fast, require_save can fail. Set the modified + # time to be 2 seconds in the past to work around this. + os.utime(name, (os.path.getatime(name), os.path.getmtime(name) - 2)) + # Depending on the resolution, the exact value might not be + # recorded, so get the new recorded value. + timestamp = os.path.getmtime(name) + + self.edit_file(name) + + if self.require_save and os.path.getmtime(name) == timestamp: + return None + + with open(name, "rb") as f: + rv = f.read() + + if isinstance(text, (bytes, bytearray)): + return rv + + return rv.decode("utf-8-sig").replace("\r\n", "\n") # type: ignore + finally: + os.unlink(name) + + +def open_url(url: str, wait: bool = False, locate: bool = False) -> int: + import subprocess + + def _unquote_file(url: str) -> str: + from urllib.parse import unquote + + if url.startswith("file://"): + url = unquote(url[7:]) + + return url + + if sys.platform == "darwin": + args = ["open"] + if wait: + args.append("-W") + if locate: + args.append("-R") + args.append(_unquote_file(url)) + null = open("/dev/null", "w") + try: + return subprocess.Popen(args, stderr=null).wait() + finally: + null.close() + elif WIN: + if locate: + url = _unquote_file(url.replace('"', "")) + args = f'explorer /select,"{url}"' + else: + url = url.replace('"', "") + wait_str = "/WAIT" if wait else "" + args = f'start {wait_str} "" "{url}"' + return os.system(args) + elif CYGWIN: + if locate: + url = os.path.dirname(_unquote_file(url).replace('"', "")) + args = f'cygstart "{url}"' + else: + url = url.replace('"', "") + wait_str = "-w" if wait else "" + args = f'cygstart {wait_str} "{url}"' + return os.system(args) + + try: + if locate: + url = os.path.dirname(_unquote_file(url)) or "." + else: + url = _unquote_file(url) + c = subprocess.Popen(["xdg-open", url]) + if wait: + return c.wait() + return 0 + except OSError: + if url.startswith(("http://", "https://")) and not locate and not wait: + import webbrowser + + webbrowser.open(url) + return 0 + return 1 + + +def _translate_ch_to_exc(ch: str) -> t.Optional[BaseException]: + if ch == "\x03": + raise KeyboardInterrupt() + + if ch == "\x04" and not WIN: # Unix-like, Ctrl+D + raise EOFError() + + if ch == "\x1a" and WIN: # Windows, Ctrl+Z + raise EOFError() + + return None + + +if WIN: + import msvcrt + + @contextlib.contextmanager + def raw_terminal() -> t.Iterator[int]: + yield -1 + + def getchar(echo: bool) -> str: + # The function `getch` will return a bytes object corresponding to + # the pressed character. Since Windows 10 build 1803, it will also + # return \x00 when called a second time after pressing a regular key. + # + # `getwch` does not share this probably-bugged behavior. Moreover, it + # returns a Unicode object by default, which is what we want. + # + # Either of these functions will return \x00 or \xe0 to indicate + # a special key, and you need to call the same function again to get + # the "rest" of the code. The fun part is that \u00e0 is + # "latin small letter a with grave", so if you type that on a French + # keyboard, you _also_ get a \xe0. + # E.g., consider the Up arrow. This returns \xe0 and then \x48. The + # resulting Unicode string reads as "a with grave" + "capital H". + # This is indistinguishable from when the user actually types + # "a with grave" and then "capital H". + # + # When \xe0 is returned, we assume it's part of a special-key sequence + # and call `getwch` again, but that means that when the user types + # the \u00e0 character, `getchar` doesn't return until a second + # character is typed. + # The alternative is returning immediately, but that would mess up + # cross-platform handling of arrow keys and others that start with + # \xe0. Another option is using `getch`, but then we can't reliably + # read non-ASCII characters, because return values of `getch` are + # limited to the current 8-bit codepage. + # + # Anyway, Click doesn't claim to do this Right(tm), and using `getwch` + # is doing the right thing in more situations than with `getch`. + func: t.Callable[[], str] + + if echo: + func = msvcrt.getwche # type: ignore + else: + func = msvcrt.getwch # type: ignore + + rv = func() + + if rv in ("\x00", "\xe0"): + # \x00 and \xe0 are control characters that indicate special key, + # see above. + rv += func() + + _translate_ch_to_exc(rv) + return rv + +else: + import tty + import termios + + @contextlib.contextmanager + def raw_terminal() -> t.Iterator[int]: + f: t.Optional[t.TextIO] + fd: int + + if not isatty(sys.stdin): + f = open("/dev/tty") + fd = f.fileno() + else: + fd = sys.stdin.fileno() + f = None + + try: + old_settings = termios.tcgetattr(fd) + + try: + tty.setraw(fd) + yield fd + finally: + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) + sys.stdout.flush() + + if f is not None: + f.close() + except termios.error: + pass + + def getchar(echo: bool) -> str: + with raw_terminal() as fd: + ch = os.read(fd, 32).decode(get_best_encoding(sys.stdin), "replace") + + if echo and isatty(sys.stdout): + sys.stdout.write(ch) + + _translate_ch_to_exc(ch) + return ch diff --git a/billinglayer/python/click/_textwrap.py b/billinglayer/python/click/_textwrap.py new file mode 100644 index 0000000..b47dcbd --- /dev/null +++ b/billinglayer/python/click/_textwrap.py @@ -0,0 +1,49 @@ +import textwrap +import typing as t +from contextlib import contextmanager + + +class TextWrapper(textwrap.TextWrapper): + def _handle_long_word( + self, + reversed_chunks: t.List[str], + cur_line: t.List[str], + cur_len: int, + width: int, + ) -> None: + space_left = max(width - cur_len, 1) + + if self.break_long_words: + last = reversed_chunks[-1] + cut = last[:space_left] + res = last[space_left:] + cur_line.append(cut) + reversed_chunks[-1] = res + elif not cur_line: + cur_line.append(reversed_chunks.pop()) + + @contextmanager + def extra_indent(self, indent: str) -> t.Iterator[None]: + old_initial_indent = self.initial_indent + old_subsequent_indent = self.subsequent_indent + self.initial_indent += indent + self.subsequent_indent += indent + + try: + yield + finally: + self.initial_indent = old_initial_indent + self.subsequent_indent = old_subsequent_indent + + def indent_only(self, text: str) -> str: + rv = [] + + for idx, line in enumerate(text.splitlines()): + indent = self.initial_indent + + if idx > 0: + indent = self.subsequent_indent + + rv.append(f"{indent}{line}") + + return "\n".join(rv) diff --git a/billinglayer/python/click/_winconsole.py b/billinglayer/python/click/_winconsole.py new file mode 100644 index 0000000..6b20df3 --- /dev/null +++ b/billinglayer/python/click/_winconsole.py @@ -0,0 +1,279 @@ +# This module is based on the excellent work by Adam Bartoš who +# provided a lot of what went into the implementation here in +# the discussion to issue1602 in the Python bug tracker. +# +# There are some general differences in regards to how this works +# compared to the original patches as we do not need to patch +# the entire interpreter but just work in our little world of +# echo and prompt. +import io +import sys +import time +import typing as t +from ctypes import byref +from ctypes import c_char +from ctypes import c_char_p +from ctypes import c_int +from ctypes import c_ssize_t +from ctypes import c_ulong +from ctypes import c_void_p +from ctypes import POINTER +from ctypes import py_object +from ctypes import Structure +from ctypes.wintypes import DWORD +from ctypes.wintypes import HANDLE +from ctypes.wintypes import LPCWSTR +from ctypes.wintypes import LPWSTR + +from ._compat import _NonClosingTextIOWrapper + +assert sys.platform == "win32" +import msvcrt # noqa: E402 +from ctypes import windll # noqa: E402 +from ctypes import WINFUNCTYPE # noqa: E402 + +c_ssize_p = POINTER(c_ssize_t) + +kernel32 = windll.kernel32 +GetStdHandle = kernel32.GetStdHandle +ReadConsoleW = kernel32.ReadConsoleW +WriteConsoleW = kernel32.WriteConsoleW +GetConsoleMode = kernel32.GetConsoleMode +GetLastError = kernel32.GetLastError +GetCommandLineW = WINFUNCTYPE(LPWSTR)(("GetCommandLineW", windll.kernel32)) +CommandLineToArgvW = WINFUNCTYPE(POINTER(LPWSTR), LPCWSTR, POINTER(c_int))( + ("CommandLineToArgvW", windll.shell32) +) +LocalFree = WINFUNCTYPE(c_void_p, c_void_p)(("LocalFree", windll.kernel32)) + +STDIN_HANDLE = GetStdHandle(-10) +STDOUT_HANDLE = GetStdHandle(-11) +STDERR_HANDLE = GetStdHandle(-12) + +PyBUF_SIMPLE = 0 +PyBUF_WRITABLE = 1 + +ERROR_SUCCESS = 0 +ERROR_NOT_ENOUGH_MEMORY = 8 +ERROR_OPERATION_ABORTED = 995 + +STDIN_FILENO = 0 +STDOUT_FILENO = 1 +STDERR_FILENO = 2 + +EOF = b"\x1a" +MAX_BYTES_WRITTEN = 32767 + +try: + from ctypes import pythonapi +except ImportError: + # On PyPy we cannot get buffers so our ability to operate here is + # severely limited. + get_buffer = None +else: + + class Py_buffer(Structure): + _fields_ = [ + ("buf", c_void_p), + ("obj", py_object), + ("len", c_ssize_t), + ("itemsize", c_ssize_t), + ("readonly", c_int), + ("ndim", c_int), + ("format", c_char_p), + ("shape", c_ssize_p), + ("strides", c_ssize_p), + ("suboffsets", c_ssize_p), + ("internal", c_void_p), + ] + + PyObject_GetBuffer = pythonapi.PyObject_GetBuffer + PyBuffer_Release = pythonapi.PyBuffer_Release + + def get_buffer(obj, writable=False): + buf = Py_buffer() + flags = PyBUF_WRITABLE if writable else PyBUF_SIMPLE + PyObject_GetBuffer(py_object(obj), byref(buf), flags) + + try: + buffer_type = c_char * buf.len + return buffer_type.from_address(buf.buf) + finally: + PyBuffer_Release(byref(buf)) + + +class _WindowsConsoleRawIOBase(io.RawIOBase): + def __init__(self, handle): + self.handle = handle + + def isatty(self): + super().isatty() + return True + + +class _WindowsConsoleReader(_WindowsConsoleRawIOBase): + def readable(self): + return True + + def readinto(self, b): + bytes_to_be_read = len(b) + if not bytes_to_be_read: + return 0 + elif bytes_to_be_read % 2: + raise ValueError( + "cannot read odd number of bytes from UTF-16-LE encoded console" + ) + + buffer = get_buffer(b, writable=True) + code_units_to_be_read = bytes_to_be_read // 2 + code_units_read = c_ulong() + + rv = ReadConsoleW( + HANDLE(self.handle), + buffer, + code_units_to_be_read, + byref(code_units_read), + None, + ) + if GetLastError() == ERROR_OPERATION_ABORTED: + # wait for KeyboardInterrupt + time.sleep(0.1) + if not rv: + raise OSError(f"Windows error: {GetLastError()}") + + if buffer[0] == EOF: + return 0 + return 2 * code_units_read.value + + +class _WindowsConsoleWriter(_WindowsConsoleRawIOBase): + def writable(self): + return True + + @staticmethod + def _get_error_message(errno): + if errno == ERROR_SUCCESS: + return "ERROR_SUCCESS" + elif errno == ERROR_NOT_ENOUGH_MEMORY: + return "ERROR_NOT_ENOUGH_MEMORY" + return f"Windows error {errno}" + + def write(self, b): + bytes_to_be_written = len(b) + buf = get_buffer(b) + code_units_to_be_written = min(bytes_to_be_written, MAX_BYTES_WRITTEN) // 2 + code_units_written = c_ulong() + + WriteConsoleW( + HANDLE(self.handle), + buf, + code_units_to_be_written, + byref(code_units_written), + None, + ) + bytes_written = 2 * code_units_written.value + + if bytes_written == 0 and bytes_to_be_written > 0: + raise OSError(self._get_error_message(GetLastError())) + return bytes_written + + +class ConsoleStream: + def __init__(self, text_stream: t.TextIO, byte_stream: t.BinaryIO) -> None: + self._text_stream = text_stream + self.buffer = byte_stream + + @property + def name(self) -> str: + return self.buffer.name + + def write(self, x: t.AnyStr) -> int: + if isinstance(x, str): + return self._text_stream.write(x) + try: + self.flush() + except Exception: + pass + return self.buffer.write(x) + + def writelines(self, lines: t.Iterable[t.AnyStr]) -> None: + for line in lines: + self.write(line) + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._text_stream, name) + + def isatty(self) -> bool: + return self.buffer.isatty() + + def __repr__(self): + return f"" + + +def _get_text_stdin(buffer_stream: t.BinaryIO) -> t.TextIO: + text_stream = _NonClosingTextIOWrapper( + io.BufferedReader(_WindowsConsoleReader(STDIN_HANDLE)), + "utf-16-le", + "strict", + line_buffering=True, + ) + return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) + + +def _get_text_stdout(buffer_stream: t.BinaryIO) -> t.TextIO: + text_stream = _NonClosingTextIOWrapper( + io.BufferedWriter(_WindowsConsoleWriter(STDOUT_HANDLE)), + "utf-16-le", + "strict", + line_buffering=True, + ) + return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) + + +def _get_text_stderr(buffer_stream: t.BinaryIO) -> t.TextIO: + text_stream = _NonClosingTextIOWrapper( + io.BufferedWriter(_WindowsConsoleWriter(STDERR_HANDLE)), + "utf-16-le", + "strict", + line_buffering=True, + ) + return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) + + +_stream_factories: t.Mapping[int, t.Callable[[t.BinaryIO], t.TextIO]] = { + 0: _get_text_stdin, + 1: _get_text_stdout, + 2: _get_text_stderr, +} + + +def _is_console(f: t.TextIO) -> bool: + if not hasattr(f, "fileno"): + return False + + try: + fileno = f.fileno() + except (OSError, io.UnsupportedOperation): + return False + + handle = msvcrt.get_osfhandle(fileno) + return bool(GetConsoleMode(handle, byref(DWORD()))) + + +def _get_windows_console_stream( + f: t.TextIO, encoding: t.Optional[str], errors: t.Optional[str] +) -> t.Optional[t.TextIO]: + if ( + get_buffer is not None + and encoding in {"utf-16-le", None} + and errors in {"strict", None} + and _is_console(f) + ): + func = _stream_factories.get(f.fileno()) + if func is not None: + b = getattr(f, "buffer", None) + + if b is None: + return None + + return func(b) diff --git a/billinglayer/python/click/core.py b/billinglayer/python/click/core.py new file mode 100644 index 0000000..cc65e89 --- /dev/null +++ b/billinglayer/python/click/core.py @@ -0,0 +1,3042 @@ +import enum +import errno +import inspect +import os +import sys +import typing as t +from collections import abc +from contextlib import contextmanager +from contextlib import ExitStack +from functools import update_wrapper +from gettext import gettext as _ +from gettext import ngettext +from itertools import repeat +from types import TracebackType + +from . import types +from .exceptions import Abort +from .exceptions import BadParameter +from .exceptions import ClickException +from .exceptions import Exit +from .exceptions import MissingParameter +from .exceptions import UsageError +from .formatting import HelpFormatter +from .formatting import join_options +from .globals import pop_context +from .globals import push_context +from .parser import _flag_needs_value +from .parser import OptionParser +from .parser import split_opt +from .termui import confirm +from .termui import prompt +from .termui import style +from .utils import _detect_program_name +from .utils import _expand_args +from .utils import echo +from .utils import make_default_short_help +from .utils import make_str +from .utils import PacifyFlushWrapper + +if t.TYPE_CHECKING: + import typing_extensions as te + from .shell_completion import CompletionItem + +F = t.TypeVar("F", bound=t.Callable[..., t.Any]) +V = t.TypeVar("V") + + +def _complete_visible_commands( + ctx: "Context", incomplete: str +) -> t.Iterator[t.Tuple[str, "Command"]]: + """List all the subcommands of a group that start with the + incomplete value and aren't hidden. + + :param ctx: Invocation context for the group. + :param incomplete: Value being completed. May be empty. + """ + multi = t.cast(MultiCommand, ctx.command) + + for name in multi.list_commands(ctx): + if name.startswith(incomplete): + command = multi.get_command(ctx, name) + + if command is not None and not command.hidden: + yield name, command + + +def _check_multicommand( + base_command: "MultiCommand", cmd_name: str, cmd: "Command", register: bool = False +) -> None: + if not base_command.chain or not isinstance(cmd, MultiCommand): + return + if register: + hint = ( + "It is not possible to add multi commands as children to" + " another multi command that is in chain mode." + ) + else: + hint = ( + "Found a multi command as subcommand to a multi command" + " that is in chain mode. This is not supported." + ) + raise RuntimeError( + f"{hint}. Command {base_command.name!r} is set to chain and" + f" {cmd_name!r} was added as a subcommand but it in itself is a" + f" multi command. ({cmd_name!r} is a {type(cmd).__name__}" + f" within a chained {type(base_command).__name__} named" + f" {base_command.name!r})." + ) + + +def batch(iterable: t.Iterable[V], batch_size: int) -> t.List[t.Tuple[V, ...]]: + return list(zip(*repeat(iter(iterable), batch_size))) + + +@contextmanager +def augment_usage_errors( + ctx: "Context", param: t.Optional["Parameter"] = None +) -> t.Iterator[None]: + """Context manager that attaches extra information to exceptions.""" + try: + yield + except BadParameter as e: + if e.ctx is None: + e.ctx = ctx + if param is not None and e.param is None: + e.param = param + raise + except UsageError as e: + if e.ctx is None: + e.ctx = ctx + raise + + +def iter_params_for_processing( + invocation_order: t.Sequence["Parameter"], + declaration_order: t.Sequence["Parameter"], +) -> t.List["Parameter"]: + """Given a sequence of parameters in the order as should be considered + for processing and an iterable of parameters that exist, this returns + a list in the correct order as they should be processed. + """ + + def sort_key(item: "Parameter") -> t.Tuple[bool, float]: + try: + idx: float = invocation_order.index(item) + except ValueError: + idx = float("inf") + + return not item.is_eager, idx + + return sorted(declaration_order, key=sort_key) + + +class ParameterSource(enum.Enum): + """This is an :class:`~enum.Enum` that indicates the source of a + parameter's value. + + Use :meth:`click.Context.get_parameter_source` to get the + source for a parameter by name. + + .. versionchanged:: 8.0 + Use :class:`~enum.Enum` and drop the ``validate`` method. + + .. versionchanged:: 8.0 + Added the ``PROMPT`` value. + """ + + COMMANDLINE = enum.auto() + """The value was provided by the command line args.""" + ENVIRONMENT = enum.auto() + """The value was provided with an environment variable.""" + DEFAULT = enum.auto() + """Used the default specified by the parameter.""" + DEFAULT_MAP = enum.auto() + """Used a default provided by :attr:`Context.default_map`.""" + PROMPT = enum.auto() + """Used a prompt to confirm a default or provide a value.""" + + +class Context: + """The context is a special internal object that holds state relevant + for the script execution at every single level. It's normally invisible + to commands unless they opt-in to getting access to it. + + The context is useful as it can pass internal objects around and can + control special execution features such as reading data from + environment variables. + + A context can be used as context manager in which case it will call + :meth:`close` on teardown. + + :param command: the command class for this context. + :param parent: the parent context. + :param info_name: the info name for this invocation. Generally this + is the most descriptive name for the script or + command. For the toplevel script it is usually + the name of the script, for commands below it it's + the name of the script. + :param obj: an arbitrary object of user data. + :param auto_envvar_prefix: the prefix to use for automatic environment + variables. If this is `None` then reading + from environment variables is disabled. This + does not affect manually set environment + variables which are always read. + :param default_map: a dictionary (like object) with default values + for parameters. + :param terminal_width: the width of the terminal. The default is + inherit from parent context. If no context + defines the terminal width then auto + detection will be applied. + :param max_content_width: the maximum width for content rendered by + Click (this currently only affects help + pages). This defaults to 80 characters if + not overridden. In other words: even if the + terminal is larger than that, Click will not + format things wider than 80 characters by + default. In addition to that, formatters might + add some safety mapping on the right. + :param resilient_parsing: if this flag is enabled then Click will + parse without any interactivity or callback + invocation. Default values will also be + ignored. This is useful for implementing + things such as completion support. + :param allow_extra_args: if this is set to `True` then extra arguments + at the end will not raise an error and will be + kept on the context. The default is to inherit + from the command. + :param allow_interspersed_args: if this is set to `False` then options + and arguments cannot be mixed. The + default is to inherit from the command. + :param ignore_unknown_options: instructs click to ignore options it does + not know and keeps them for later + processing. + :param help_option_names: optionally a list of strings that define how + the default help parameter is named. The + default is ``['--help']``. + :param token_normalize_func: an optional function that is used to + normalize tokens (options, choices, + etc.). This for instance can be used to + implement case insensitive behavior. + :param color: controls if the terminal supports ANSI colors or not. The + default is autodetection. This is only needed if ANSI + codes are used in texts that Click prints which is by + default not the case. This for instance would affect + help output. + :param show_default: Show the default value for commands. If this + value is not set, it defaults to the value from the parent + context. ``Command.show_default`` overrides this default for the + specific command. + + .. versionchanged:: 8.1 + The ``show_default`` parameter is overridden by + ``Command.show_default``, instead of the other way around. + + .. versionchanged:: 8.0 + The ``show_default`` parameter defaults to the value from the + parent context. + + .. versionchanged:: 7.1 + Added the ``show_default`` parameter. + + .. versionchanged:: 4.0 + Added the ``color``, ``ignore_unknown_options``, and + ``max_content_width`` parameters. + + .. versionchanged:: 3.0 + Added the ``allow_extra_args`` and ``allow_interspersed_args`` + parameters. + + .. versionchanged:: 2.0 + Added the ``resilient_parsing``, ``help_option_names``, and + ``token_normalize_func`` parameters. + """ + + #: The formatter class to create with :meth:`make_formatter`. + #: + #: .. versionadded:: 8.0 + formatter_class: t.Type["HelpFormatter"] = HelpFormatter + + def __init__( + self, + command: "Command", + parent: t.Optional["Context"] = None, + info_name: t.Optional[str] = None, + obj: t.Optional[t.Any] = None, + auto_envvar_prefix: t.Optional[str] = None, + default_map: t.Optional[t.MutableMapping[str, t.Any]] = None, + terminal_width: t.Optional[int] = None, + max_content_width: t.Optional[int] = None, + resilient_parsing: bool = False, + allow_extra_args: t.Optional[bool] = None, + allow_interspersed_args: t.Optional[bool] = None, + ignore_unknown_options: t.Optional[bool] = None, + help_option_names: t.Optional[t.List[str]] = None, + token_normalize_func: t.Optional[t.Callable[[str], str]] = None, + color: t.Optional[bool] = None, + show_default: t.Optional[bool] = None, + ) -> None: + #: the parent context or `None` if none exists. + self.parent = parent + #: the :class:`Command` for this context. + self.command = command + #: the descriptive information name + self.info_name = info_name + #: Map of parameter names to their parsed values. Parameters + #: with ``expose_value=False`` are not stored. + self.params: t.Dict[str, t.Any] = {} + #: the leftover arguments. + self.args: t.List[str] = [] + #: protected arguments. These are arguments that are prepended + #: to `args` when certain parsing scenarios are encountered but + #: must be never propagated to another arguments. This is used + #: to implement nested parsing. + self.protected_args: t.List[str] = [] + #: the collected prefixes of the command's options. + self._opt_prefixes: t.Set[str] = set(parent._opt_prefixes) if parent else set() + + if obj is None and parent is not None: + obj = parent.obj + + #: the user object stored. + self.obj: t.Any = obj + self._meta: t.Dict[str, t.Any] = getattr(parent, "meta", {}) + + #: A dictionary (-like object) with defaults for parameters. + if ( + default_map is None + and info_name is not None + and parent is not None + and parent.default_map is not None + ): + default_map = parent.default_map.get(info_name) + + self.default_map: t.Optional[t.MutableMapping[str, t.Any]] = default_map + + #: This flag indicates if a subcommand is going to be executed. A + #: group callback can use this information to figure out if it's + #: being executed directly or because the execution flow passes + #: onwards to a subcommand. By default it's None, but it can be + #: the name of the subcommand to execute. + #: + #: If chaining is enabled this will be set to ``'*'`` in case + #: any commands are executed. It is however not possible to + #: figure out which ones. If you require this knowledge you + #: should use a :func:`result_callback`. + self.invoked_subcommand: t.Optional[str] = None + + if terminal_width is None and parent is not None: + terminal_width = parent.terminal_width + + #: The width of the terminal (None is autodetection). + self.terminal_width: t.Optional[int] = terminal_width + + if max_content_width is None and parent is not None: + max_content_width = parent.max_content_width + + #: The maximum width of formatted content (None implies a sensible + #: default which is 80 for most things). + self.max_content_width: t.Optional[int] = max_content_width + + if allow_extra_args is None: + allow_extra_args = command.allow_extra_args + + #: Indicates if the context allows extra args or if it should + #: fail on parsing. + #: + #: .. versionadded:: 3.0 + self.allow_extra_args = allow_extra_args + + if allow_interspersed_args is None: + allow_interspersed_args = command.allow_interspersed_args + + #: Indicates if the context allows mixing of arguments and + #: options or not. + #: + #: .. versionadded:: 3.0 + self.allow_interspersed_args: bool = allow_interspersed_args + + if ignore_unknown_options is None: + ignore_unknown_options = command.ignore_unknown_options + + #: Instructs click to ignore options that a command does not + #: understand and will store it on the context for later + #: processing. This is primarily useful for situations where you + #: want to call into external programs. Generally this pattern is + #: strongly discouraged because it's not possibly to losslessly + #: forward all arguments. + #: + #: .. versionadded:: 4.0 + self.ignore_unknown_options: bool = ignore_unknown_options + + if help_option_names is None: + if parent is not None: + help_option_names = parent.help_option_names + else: + help_option_names = ["--help"] + + #: The names for the help options. + self.help_option_names: t.List[str] = help_option_names + + if token_normalize_func is None and parent is not None: + token_normalize_func = parent.token_normalize_func + + #: An optional normalization function for tokens. This is + #: options, choices, commands etc. + self.token_normalize_func: t.Optional[ + t.Callable[[str], str] + ] = token_normalize_func + + #: Indicates if resilient parsing is enabled. In that case Click + #: will do its best to not cause any failures and default values + #: will be ignored. Useful for completion. + self.resilient_parsing: bool = resilient_parsing + + # If there is no envvar prefix yet, but the parent has one and + # the command on this level has a name, we can expand the envvar + # prefix automatically. + if auto_envvar_prefix is None: + if ( + parent is not None + and parent.auto_envvar_prefix is not None + and self.info_name is not None + ): + auto_envvar_prefix = ( + f"{parent.auto_envvar_prefix}_{self.info_name.upper()}" + ) + else: + auto_envvar_prefix = auto_envvar_prefix.upper() + + if auto_envvar_prefix is not None: + auto_envvar_prefix = auto_envvar_prefix.replace("-", "_") + + self.auto_envvar_prefix: t.Optional[str] = auto_envvar_prefix + + if color is None and parent is not None: + color = parent.color + + #: Controls if styling output is wanted or not. + self.color: t.Optional[bool] = color + + if show_default is None and parent is not None: + show_default = parent.show_default + + #: Show option default values when formatting help text. + self.show_default: t.Optional[bool] = show_default + + self._close_callbacks: t.List[t.Callable[[], t.Any]] = [] + self._depth = 0 + self._parameter_source: t.Dict[str, ParameterSource] = {} + self._exit_stack = ExitStack() + + def to_info_dict(self) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. This traverses the entire CLI + structure. + + .. code-block:: python + + with Context(cli) as ctx: + info = ctx.to_info_dict() + + .. versionadded:: 8.0 + """ + return { + "command": self.command.to_info_dict(self), + "info_name": self.info_name, + "allow_extra_args": self.allow_extra_args, + "allow_interspersed_args": self.allow_interspersed_args, + "ignore_unknown_options": self.ignore_unknown_options, + "auto_envvar_prefix": self.auto_envvar_prefix, + } + + def __enter__(self) -> "Context": + self._depth += 1 + push_context(self) + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + self._depth -= 1 + if self._depth == 0: + self.close() + pop_context() + + @contextmanager + def scope(self, cleanup: bool = True) -> t.Iterator["Context"]: + """This helper method can be used with the context object to promote + it to the current thread local (see :func:`get_current_context`). + The default behavior of this is to invoke the cleanup functions which + can be disabled by setting `cleanup` to `False`. The cleanup + functions are typically used for things such as closing file handles. + + If the cleanup is intended the context object can also be directly + used as a context manager. + + Example usage:: + + with ctx.scope(): + assert get_current_context() is ctx + + This is equivalent:: + + with ctx: + assert get_current_context() is ctx + + .. versionadded:: 5.0 + + :param cleanup: controls if the cleanup functions should be run or + not. The default is to run these functions. In + some situations the context only wants to be + temporarily pushed in which case this can be disabled. + Nested pushes automatically defer the cleanup. + """ + if not cleanup: + self._depth += 1 + try: + with self as rv: + yield rv + finally: + if not cleanup: + self._depth -= 1 + + @property + def meta(self) -> t.Dict[str, t.Any]: + """This is a dictionary which is shared with all the contexts + that are nested. It exists so that click utilities can store some + state here if they need to. It is however the responsibility of + that code to manage this dictionary well. + + The keys are supposed to be unique dotted strings. For instance + module paths are a good choice for it. What is stored in there is + irrelevant for the operation of click. However what is important is + that code that places data here adheres to the general semantics of + the system. + + Example usage:: + + LANG_KEY = f'{__name__}.lang' + + def set_language(value): + ctx = get_current_context() + ctx.meta[LANG_KEY] = value + + def get_language(): + return get_current_context().meta.get(LANG_KEY, 'en_US') + + .. versionadded:: 5.0 + """ + return self._meta + + def make_formatter(self) -> HelpFormatter: + """Creates the :class:`~click.HelpFormatter` for the help and + usage output. + + To quickly customize the formatter class used without overriding + this method, set the :attr:`formatter_class` attribute. + + .. versionchanged:: 8.0 + Added the :attr:`formatter_class` attribute. + """ + return self.formatter_class( + width=self.terminal_width, max_width=self.max_content_width + ) + + def with_resource(self, context_manager: t.ContextManager[V]) -> V: + """Register a resource as if it were used in a ``with`` + statement. The resource will be cleaned up when the context is + popped. + + Uses :meth:`contextlib.ExitStack.enter_context`. It calls the + resource's ``__enter__()`` method and returns the result. When + the context is popped, it closes the stack, which calls the + resource's ``__exit__()`` method. + + To register a cleanup function for something that isn't a + context manager, use :meth:`call_on_close`. Or use something + from :mod:`contextlib` to turn it into a context manager first. + + .. code-block:: python + + @click.group() + @click.option("--name") + @click.pass_context + def cli(ctx): + ctx.obj = ctx.with_resource(connect_db(name)) + + :param context_manager: The context manager to enter. + :return: Whatever ``context_manager.__enter__()`` returns. + + .. versionadded:: 8.0 + """ + return self._exit_stack.enter_context(context_manager) + + def call_on_close(self, f: t.Callable[..., t.Any]) -> t.Callable[..., t.Any]: + """Register a function to be called when the context tears down. + + This can be used to close resources opened during the script + execution. Resources that support Python's context manager + protocol which would be used in a ``with`` statement should be + registered with :meth:`with_resource` instead. + + :param f: The function to execute on teardown. + """ + return self._exit_stack.callback(f) + + def close(self) -> None: + """Invoke all close callbacks registered with + :meth:`call_on_close`, and exit all context managers entered + with :meth:`with_resource`. + """ + self._exit_stack.close() + # In case the context is reused, create a new exit stack. + self._exit_stack = ExitStack() + + @property + def command_path(self) -> str: + """The computed command path. This is used for the ``usage`` + information on the help page. It's automatically created by + combining the info names of the chain of contexts to the root. + """ + rv = "" + if self.info_name is not None: + rv = self.info_name + if self.parent is not None: + parent_command_path = [self.parent.command_path] + + if isinstance(self.parent.command, Command): + for param in self.parent.command.get_params(self): + parent_command_path.extend(param.get_usage_pieces(self)) + + rv = f"{' '.join(parent_command_path)} {rv}" + return rv.lstrip() + + def find_root(self) -> "Context": + """Finds the outermost context.""" + node = self + while node.parent is not None: + node = node.parent + return node + + def find_object(self, object_type: t.Type[V]) -> t.Optional[V]: + """Finds the closest object of a given type.""" + node: t.Optional["Context"] = self + + while node is not None: + if isinstance(node.obj, object_type): + return node.obj + + node = node.parent + + return None + + def ensure_object(self, object_type: t.Type[V]) -> V: + """Like :meth:`find_object` but sets the innermost object to a + new instance of `object_type` if it does not exist. + """ + rv = self.find_object(object_type) + if rv is None: + self.obj = rv = object_type() + return rv + + @t.overload + def lookup_default( + self, name: str, call: "te.Literal[True]" = True + ) -> t.Optional[t.Any]: + ... + + @t.overload + def lookup_default( + self, name: str, call: "te.Literal[False]" = ... + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + ... + + def lookup_default(self, name: str, call: bool = True) -> t.Optional[t.Any]: + """Get the default for a parameter from :attr:`default_map`. + + :param name: Name of the parameter. + :param call: If the default is a callable, call it. Disable to + return the callable instead. + + .. versionchanged:: 8.0 + Added the ``call`` parameter. + """ + if self.default_map is not None: + value = self.default_map.get(name) + + if call and callable(value): + return value() + + return value + + return None + + def fail(self, message: str) -> "te.NoReturn": + """Aborts the execution of the program with a specific error + message. + + :param message: the error message to fail with. + """ + raise UsageError(message, self) + + def abort(self) -> "te.NoReturn": + """Aborts the script.""" + raise Abort() + + def exit(self, code: int = 0) -> "te.NoReturn": + """Exits the application with a given exit code.""" + raise Exit(code) + + def get_usage(self) -> str: + """Helper method to get formatted usage string for the current + context and command. + """ + return self.command.get_usage(self) + + def get_help(self) -> str: + """Helper method to get formatted help page for the current + context and command. + """ + return self.command.get_help(self) + + def _make_sub_context(self, command: "Command") -> "Context": + """Create a new context of the same type as this context, but + for a new command. + + :meta private: + """ + return type(self)(command, info_name=command.name, parent=self) + + @t.overload + def invoke( + __self, # noqa: B902 + __callback: "t.Callable[..., V]", + *args: t.Any, + **kwargs: t.Any, + ) -> V: + ... + + @t.overload + def invoke( + __self, # noqa: B902 + __callback: "Command", + *args: t.Any, + **kwargs: t.Any, + ) -> t.Any: + ... + + def invoke( + __self, # noqa: B902 + __callback: t.Union["Command", "t.Callable[..., V]"], + *args: t.Any, + **kwargs: t.Any, + ) -> t.Union[t.Any, V]: + """Invokes a command callback in exactly the way it expects. There + are two ways to invoke this method: + + 1. the first argument can be a callback and all other arguments and + keyword arguments are forwarded directly to the function. + 2. the first argument is a click command object. In that case all + arguments are forwarded as well but proper click parameters + (options and click arguments) must be keyword arguments and Click + will fill in defaults. + + Note that before Click 3.2 keyword arguments were not properly filled + in against the intention of this code and no context was created. For + more information about this change and why it was done in a bugfix + release see :ref:`upgrade-to-3.2`. + + .. versionchanged:: 8.0 + All ``kwargs`` are tracked in :attr:`params` so they will be + passed if :meth:`forward` is called at multiple levels. + """ + if isinstance(__callback, Command): + other_cmd = __callback + + if other_cmd.callback is None: + raise TypeError( + "The given command does not have a callback that can be invoked." + ) + else: + __callback = t.cast("t.Callable[..., V]", other_cmd.callback) + + ctx = __self._make_sub_context(other_cmd) + + for param in other_cmd.params: + if param.name not in kwargs and param.expose_value: + kwargs[param.name] = param.type_cast_value( # type: ignore + ctx, param.get_default(ctx) + ) + + # Track all kwargs as params, so that forward() will pass + # them on in subsequent calls. + ctx.params.update(kwargs) + else: + ctx = __self + + with augment_usage_errors(__self): + with ctx: + return __callback(*args, **kwargs) + + def forward( + __self, __cmd: "Command", *args: t.Any, **kwargs: t.Any # noqa: B902 + ) -> t.Any: + """Similar to :meth:`invoke` but fills in default keyword + arguments from the current context if the other command expects + it. This cannot invoke callbacks directly, only other commands. + + .. versionchanged:: 8.0 + All ``kwargs`` are tracked in :attr:`params` so they will be + passed if ``forward`` is called at multiple levels. + """ + # Can only forward to other commands, not direct callbacks. + if not isinstance(__cmd, Command): + raise TypeError("Callback is not a command.") + + for param in __self.params: + if param not in kwargs: + kwargs[param] = __self.params[param] + + return __self.invoke(__cmd, *args, **kwargs) + + def set_parameter_source(self, name: str, source: ParameterSource) -> None: + """Set the source of a parameter. This indicates the location + from which the value of the parameter was obtained. + + :param name: The name of the parameter. + :param source: A member of :class:`~click.core.ParameterSource`. + """ + self._parameter_source[name] = source + + def get_parameter_source(self, name: str) -> t.Optional[ParameterSource]: + """Get the source of a parameter. This indicates the location + from which the value of the parameter was obtained. + + This can be useful for determining when a user specified a value + on the command line that is the same as the default value. It + will be :attr:`~click.core.ParameterSource.DEFAULT` only if the + value was actually taken from the default. + + :param name: The name of the parameter. + :rtype: ParameterSource + + .. versionchanged:: 8.0 + Returns ``None`` if the parameter was not provided from any + source. + """ + return self._parameter_source.get(name) + + +class BaseCommand: + """The base command implements the minimal API contract of commands. + Most code will never use this as it does not implement a lot of useful + functionality but it can act as the direct subclass of alternative + parsing methods that do not depend on the Click parser. + + For instance, this can be used to bridge Click and other systems like + argparse or docopt. + + Because base commands do not implement a lot of the API that other + parts of Click take for granted, they are not supported for all + operations. For instance, they cannot be used with the decorators + usually and they have no built-in callback system. + + .. versionchanged:: 2.0 + Added the `context_settings` parameter. + + :param name: the name of the command to use unless a group overrides it. + :param context_settings: an optional dictionary with defaults that are + passed to the context object. + """ + + #: The context class to create with :meth:`make_context`. + #: + #: .. versionadded:: 8.0 + context_class: t.Type[Context] = Context + #: the default for the :attr:`Context.allow_extra_args` flag. + allow_extra_args = False + #: the default for the :attr:`Context.allow_interspersed_args` flag. + allow_interspersed_args = True + #: the default for the :attr:`Context.ignore_unknown_options` flag. + ignore_unknown_options = False + + def __init__( + self, + name: t.Optional[str], + context_settings: t.Optional[t.MutableMapping[str, t.Any]] = None, + ) -> None: + #: the name the command thinks it has. Upon registering a command + #: on a :class:`Group` the group will default the command name + #: with this information. You should instead use the + #: :class:`Context`\'s :attr:`~Context.info_name` attribute. + self.name = name + + if context_settings is None: + context_settings = {} + + #: an optional dictionary with defaults passed to the context. + self.context_settings: t.MutableMapping[str, t.Any] = context_settings + + def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. This traverses the entire structure + below this command. + + Use :meth:`click.Context.to_info_dict` to traverse the entire + CLI structure. + + :param ctx: A :class:`Context` representing this command. + + .. versionadded:: 8.0 + """ + return {"name": self.name} + + def __repr__(self) -> str: + return f"<{self.__class__.__name__} {self.name}>" + + def get_usage(self, ctx: Context) -> str: + raise NotImplementedError("Base commands cannot get usage") + + def get_help(self, ctx: Context) -> str: + raise NotImplementedError("Base commands cannot get help") + + def make_context( + self, + info_name: t.Optional[str], + args: t.List[str], + parent: t.Optional[Context] = None, + **extra: t.Any, + ) -> Context: + """This function when given an info name and arguments will kick + off the parsing and create a new :class:`Context`. It does not + invoke the actual command callback though. + + To quickly customize the context class used without overriding + this method, set the :attr:`context_class` attribute. + + :param info_name: the info name for this invocation. Generally this + is the most descriptive name for the script or + command. For the toplevel script it's usually + the name of the script, for commands below it's + the name of the command. + :param args: the arguments to parse as list of strings. + :param parent: the parent context if available. + :param extra: extra keyword arguments forwarded to the context + constructor. + + .. versionchanged:: 8.0 + Added the :attr:`context_class` attribute. + """ + for key, value in self.context_settings.items(): + if key not in extra: + extra[key] = value + + ctx = self.context_class( + self, info_name=info_name, parent=parent, **extra # type: ignore + ) + + with ctx.scope(cleanup=False): + self.parse_args(ctx, args) + return ctx + + def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: + """Given a context and a list of arguments this creates the parser + and parses the arguments, then modifies the context as necessary. + This is automatically invoked by :meth:`make_context`. + """ + raise NotImplementedError("Base commands do not know how to parse arguments.") + + def invoke(self, ctx: Context) -> t.Any: + """Given a context, this invokes the command. The default + implementation is raising a not implemented error. + """ + raise NotImplementedError("Base commands are not invocable by default") + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. Looks + at the names of chained multi-commands. + + Any command could be part of a chained multi-command, so sibling + commands are valid at any point during command completion. Other + command classes will return more completions. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + results: t.List["CompletionItem"] = [] + + while ctx.parent is not None: + ctx = ctx.parent + + if isinstance(ctx.command, MultiCommand) and ctx.command.chain: + results.extend( + CompletionItem(name, help=command.get_short_help_str()) + for name, command in _complete_visible_commands(ctx, incomplete) + if name not in ctx.protected_args + ) + + return results + + @t.overload + def main( + self, + args: t.Optional[t.Sequence[str]] = None, + prog_name: t.Optional[str] = None, + complete_var: t.Optional[str] = None, + standalone_mode: "te.Literal[True]" = True, + **extra: t.Any, + ) -> "te.NoReturn": + ... + + @t.overload + def main( + self, + args: t.Optional[t.Sequence[str]] = None, + prog_name: t.Optional[str] = None, + complete_var: t.Optional[str] = None, + standalone_mode: bool = ..., + **extra: t.Any, + ) -> t.Any: + ... + + def main( + self, + args: t.Optional[t.Sequence[str]] = None, + prog_name: t.Optional[str] = None, + complete_var: t.Optional[str] = None, + standalone_mode: bool = True, + windows_expand_args: bool = True, + **extra: t.Any, + ) -> t.Any: + """This is the way to invoke a script with all the bells and + whistles as a command line application. This will always terminate + the application after a call. If this is not wanted, ``SystemExit`` + needs to be caught. + + This method is also available by directly calling the instance of + a :class:`Command`. + + :param args: the arguments that should be used for parsing. If not + provided, ``sys.argv[1:]`` is used. + :param prog_name: the program name that should be used. By default + the program name is constructed by taking the file + name from ``sys.argv[0]``. + :param complete_var: the environment variable that controls the + bash completion support. The default is + ``"__COMPLETE"`` with prog_name in + uppercase. + :param standalone_mode: the default behavior is to invoke the script + in standalone mode. Click will then + handle exceptions and convert them into + error messages and the function will never + return but shut down the interpreter. If + this is set to `False` they will be + propagated to the caller and the return + value of this function is the return value + of :meth:`invoke`. + :param windows_expand_args: Expand glob patterns, user dir, and + env vars in command line args on Windows. + :param extra: extra keyword arguments are forwarded to the context + constructor. See :class:`Context` for more information. + + .. versionchanged:: 8.0.1 + Added the ``windows_expand_args`` parameter to allow + disabling command line arg expansion on Windows. + + .. versionchanged:: 8.0 + When taking arguments from ``sys.argv`` on Windows, glob + patterns, user dir, and env vars are expanded. + + .. versionchanged:: 3.0 + Added the ``standalone_mode`` parameter. + """ + if args is None: + args = sys.argv[1:] + + if os.name == "nt" and windows_expand_args: + args = _expand_args(args) + else: + args = list(args) + + if prog_name is None: + prog_name = _detect_program_name() + + # Process shell completion requests and exit early. + self._main_shell_completion(extra, prog_name, complete_var) + + try: + try: + with self.make_context(prog_name, args, **extra) as ctx: + rv = self.invoke(ctx) + if not standalone_mode: + return rv + # it's not safe to `ctx.exit(rv)` here! + # note that `rv` may actually contain data like "1" which + # has obvious effects + # more subtle case: `rv=[None, None]` can come out of + # chained commands which all returned `None` -- so it's not + # even always obvious that `rv` indicates success/failure + # by its truthiness/falsiness + ctx.exit() + except (EOFError, KeyboardInterrupt) as e: + echo(file=sys.stderr) + raise Abort() from e + except ClickException as e: + if not standalone_mode: + raise + e.show() + sys.exit(e.exit_code) + except OSError as e: + if e.errno == errno.EPIPE: + sys.stdout = t.cast(t.TextIO, PacifyFlushWrapper(sys.stdout)) + sys.stderr = t.cast(t.TextIO, PacifyFlushWrapper(sys.stderr)) + sys.exit(1) + else: + raise + except Exit as e: + if standalone_mode: + sys.exit(e.exit_code) + else: + # in non-standalone mode, return the exit code + # note that this is only reached if `self.invoke` above raises + # an Exit explicitly -- thus bypassing the check there which + # would return its result + # the results of non-standalone execution may therefore be + # somewhat ambiguous: if there are codepaths which lead to + # `ctx.exit(1)` and to `return 1`, the caller won't be able to + # tell the difference between the two + return e.exit_code + except Abort: + if not standalone_mode: + raise + echo(_("Aborted!"), file=sys.stderr) + sys.exit(1) + + def _main_shell_completion( + self, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + complete_var: t.Optional[str] = None, + ) -> None: + """Check if the shell is asking for tab completion, process + that, then exit early. Called from :meth:`main` before the + program is invoked. + + :param prog_name: Name of the executable in the shell. + :param complete_var: Name of the environment variable that holds + the completion instruction. Defaults to + ``_{PROG_NAME}_COMPLETE``. + + .. versionchanged:: 8.2.0 + Dots (``.``) in ``prog_name`` are replaced with underscores (``_``). + """ + if complete_var is None: + complete_name = prog_name.replace("-", "_").replace(".", "_") + complete_var = f"_{complete_name}_COMPLETE".upper() + + instruction = os.environ.get(complete_var) + + if not instruction: + return + + from .shell_completion import shell_complete + + rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction) + sys.exit(rv) + + def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any: + """Alias for :meth:`main`.""" + return self.main(*args, **kwargs) + + +class Command(BaseCommand): + """Commands are the basic building block of command line interfaces in + Click. A basic command handles command line parsing and might dispatch + more parsing to commands nested below it. + + :param name: the name of the command to use unless a group overrides it. + :param context_settings: an optional dictionary with defaults that are + passed to the context object. + :param callback: the callback to invoke. This is optional. + :param params: the parameters to register with this command. This can + be either :class:`Option` or :class:`Argument` objects. + :param help: the help string to use for this command. + :param epilog: like the help string but it's printed at the end of the + help page after everything else. + :param short_help: the short help to use for this command. This is + shown on the command listing of the parent command. + :param add_help_option: by default each command registers a ``--help`` + option. This can be disabled by this parameter. + :param no_args_is_help: this controls what happens if no arguments are + provided. This option is disabled by default. + If enabled this will add ``--help`` as argument + if no arguments are passed + :param hidden: hide this command from help outputs. + + :param deprecated: issues a message indicating that + the command is deprecated. + + .. versionchanged:: 8.1 + ``help``, ``epilog``, and ``short_help`` are stored unprocessed, + all formatting is done when outputting help text, not at init, + and is done even if not using the ``@command`` decorator. + + .. versionchanged:: 8.0 + Added a ``repr`` showing the command name. + + .. versionchanged:: 7.1 + Added the ``no_args_is_help`` parameter. + + .. versionchanged:: 2.0 + Added the ``context_settings`` parameter. + """ + + def __init__( + self, + name: t.Optional[str], + context_settings: t.Optional[t.MutableMapping[str, t.Any]] = None, + callback: t.Optional[t.Callable[..., t.Any]] = None, + params: t.Optional[t.List["Parameter"]] = None, + help: t.Optional[str] = None, + epilog: t.Optional[str] = None, + short_help: t.Optional[str] = None, + options_metavar: t.Optional[str] = "[OPTIONS]", + add_help_option: bool = True, + no_args_is_help: bool = False, + hidden: bool = False, + deprecated: bool = False, + ) -> None: + super().__init__(name, context_settings) + #: the callback to execute when the command fires. This might be + #: `None` in which case nothing happens. + self.callback = callback + #: the list of parameters for this command in the order they + #: should show up in the help page and execute. Eager parameters + #: will automatically be handled before non eager ones. + self.params: t.List["Parameter"] = params or [] + self.help = help + self.epilog = epilog + self.options_metavar = options_metavar + self.short_help = short_help + self.add_help_option = add_help_option + self.no_args_is_help = no_args_is_help + self.hidden = hidden + self.deprecated = deprecated + + def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict(ctx) + info_dict.update( + params=[param.to_info_dict() for param in self.get_params(ctx)], + help=self.help, + epilog=self.epilog, + short_help=self.short_help, + hidden=self.hidden, + deprecated=self.deprecated, + ) + return info_dict + + def get_usage(self, ctx: Context) -> str: + """Formats the usage line into a string and returns it. + + Calls :meth:`format_usage` internally. + """ + formatter = ctx.make_formatter() + self.format_usage(ctx, formatter) + return formatter.getvalue().rstrip("\n") + + def get_params(self, ctx: Context) -> t.List["Parameter"]: + rv = self.params + help_option = self.get_help_option(ctx) + + if help_option is not None: + rv = [*rv, help_option] + + return rv + + def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the usage line into the formatter. + + This is a low-level method called by :meth:`get_usage`. + """ + pieces = self.collect_usage_pieces(ctx) + formatter.write_usage(ctx.command_path, " ".join(pieces)) + + def collect_usage_pieces(self, ctx: Context) -> t.List[str]: + """Returns all the pieces that go into the usage line and returns + it as a list of strings. + """ + rv = [self.options_metavar] if self.options_metavar else [] + + for param in self.get_params(ctx): + rv.extend(param.get_usage_pieces(ctx)) + + return rv + + def get_help_option_names(self, ctx: Context) -> t.List[str]: + """Returns the names for the help option.""" + all_names = set(ctx.help_option_names) + for param in self.params: + all_names.difference_update(param.opts) + all_names.difference_update(param.secondary_opts) + return list(all_names) + + def get_help_option(self, ctx: Context) -> t.Optional["Option"]: + """Returns the help option object.""" + help_options = self.get_help_option_names(ctx) + + if not help_options or not self.add_help_option: + return None + + def show_help(ctx: Context, param: "Parameter", value: str) -> None: + if value and not ctx.resilient_parsing: + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + return Option( + help_options, + is_flag=True, + is_eager=True, + expose_value=False, + callback=show_help, + help=_("Show this message and exit."), + ) + + def make_parser(self, ctx: Context) -> OptionParser: + """Creates the underlying option parser for this command.""" + parser = OptionParser(ctx) + for param in self.get_params(ctx): + param.add_to_parser(parser, ctx) + return parser + + def get_help(self, ctx: Context) -> str: + """Formats the help into a string and returns it. + + Calls :meth:`format_help` internally. + """ + formatter = ctx.make_formatter() + self.format_help(ctx, formatter) + return formatter.getvalue().rstrip("\n") + + def get_short_help_str(self, limit: int = 45) -> str: + """Gets short help for the command or makes it by shortening the + long help string. + """ + if self.short_help: + text = inspect.cleandoc(self.short_help) + elif self.help: + text = make_default_short_help(self.help, limit) + else: + text = "" + + if self.deprecated: + text = _("(Deprecated) {text}").format(text=text) + + return text.strip() + + def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the help into the formatter if it exists. + + This is a low-level method called by :meth:`get_help`. + + This calls the following methods: + + - :meth:`format_usage` + - :meth:`format_help_text` + - :meth:`format_options` + - :meth:`format_epilog` + """ + self.format_usage(ctx, formatter) + self.format_help_text(ctx, formatter) + self.format_options(ctx, formatter) + self.format_epilog(ctx, formatter) + + def format_help_text(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the help text to the formatter if it exists.""" + if self.help is not None: + # truncate the help text to the first form feed + text = inspect.cleandoc(self.help).partition("\f")[0] + else: + text = "" + + if self.deprecated: + text = _("(Deprecated) {text}").format(text=text) + + if text: + formatter.write_paragraph() + + with formatter.indentation(): + formatter.write_text(text) + + def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes all the options into the formatter if they exist.""" + opts = [] + for param in self.get_params(ctx): + rv = param.get_help_record(ctx) + if rv is not None: + opts.append(rv) + + if opts: + with formatter.section(_("Options")): + formatter.write_dl(opts) + + def format_epilog(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the epilog into the formatter if it exists.""" + if self.epilog: + epilog = inspect.cleandoc(self.epilog) + formatter.write_paragraph() + + with formatter.indentation(): + formatter.write_text(epilog) + + def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: + if not args and self.no_args_is_help and not ctx.resilient_parsing: + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + parser = self.make_parser(ctx) + opts, args, param_order = parser.parse_args(args=args) + + for param in iter_params_for_processing(param_order, self.get_params(ctx)): + value, args = param.handle_parse_result(ctx, opts, args) + + if args and not ctx.allow_extra_args and not ctx.resilient_parsing: + ctx.fail( + ngettext( + "Got unexpected extra argument ({args})", + "Got unexpected extra arguments ({args})", + len(args), + ).format(args=" ".join(map(str, args))) + ) + + ctx.args = args + ctx._opt_prefixes.update(parser._opt_prefixes) + return args + + def invoke(self, ctx: Context) -> t.Any: + """Given a context, this invokes the attached callback (if it exists) + in the right way. + """ + if self.deprecated: + message = _( + "DeprecationWarning: The command {name!r} is deprecated." + ).format(name=self.name) + echo(style(message, fg="red"), err=True) + + if self.callback is not None: + return ctx.invoke(self.callback, **ctx.params) + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. Looks + at the names of options and chained multi-commands. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + results: t.List["CompletionItem"] = [] + + if incomplete and not incomplete[0].isalnum(): + for param in self.get_params(ctx): + if ( + not isinstance(param, Option) + or param.hidden + or ( + not param.multiple + and ctx.get_parameter_source(param.name) # type: ignore + is ParameterSource.COMMANDLINE + ) + ): + continue + + results.extend( + CompletionItem(name, help=param.help) + for name in [*param.opts, *param.secondary_opts] + if name.startswith(incomplete) + ) + + results.extend(super().shell_complete(ctx, incomplete)) + return results + + +class MultiCommand(Command): + """A multi command is the basic implementation of a command that + dispatches to subcommands. The most common version is the + :class:`Group`. + + :param invoke_without_command: this controls how the multi command itself + is invoked. By default it's only invoked + if a subcommand is provided. + :param no_args_is_help: this controls what happens if no arguments are + provided. This option is enabled by default if + `invoke_without_command` is disabled or disabled + if it's enabled. If enabled this will add + ``--help`` as argument if no arguments are + passed. + :param subcommand_metavar: the string that is used in the documentation + to indicate the subcommand place. + :param chain: if this is set to `True` chaining of multiple subcommands + is enabled. This restricts the form of commands in that + they cannot have optional arguments but it allows + multiple commands to be chained together. + :param result_callback: The result callback to attach to this multi + command. This can be set or changed later with the + :meth:`result_callback` decorator. + :param attrs: Other command arguments described in :class:`Command`. + """ + + allow_extra_args = True + allow_interspersed_args = False + + def __init__( + self, + name: t.Optional[str] = None, + invoke_without_command: bool = False, + no_args_is_help: t.Optional[bool] = None, + subcommand_metavar: t.Optional[str] = None, + chain: bool = False, + result_callback: t.Optional[t.Callable[..., t.Any]] = None, + **attrs: t.Any, + ) -> None: + super().__init__(name, **attrs) + + if no_args_is_help is None: + no_args_is_help = not invoke_without_command + + self.no_args_is_help = no_args_is_help + self.invoke_without_command = invoke_without_command + + if subcommand_metavar is None: + if chain: + subcommand_metavar = "COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]..." + else: + subcommand_metavar = "COMMAND [ARGS]..." + + self.subcommand_metavar = subcommand_metavar + self.chain = chain + # The result callback that is stored. This can be set or + # overridden with the :func:`result_callback` decorator. + self._result_callback = result_callback + + if self.chain: + for param in self.params: + if isinstance(param, Argument) and not param.required: + raise RuntimeError( + "Multi commands in chain mode cannot have" + " optional arguments." + ) + + def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict(ctx) + commands = {} + + for name in self.list_commands(ctx): + command = self.get_command(ctx, name) + + if command is None: + continue + + sub_ctx = ctx._make_sub_context(command) + + with sub_ctx.scope(cleanup=False): + commands[name] = command.to_info_dict(sub_ctx) + + info_dict.update(commands=commands, chain=self.chain) + return info_dict + + def collect_usage_pieces(self, ctx: Context) -> t.List[str]: + rv = super().collect_usage_pieces(ctx) + rv.append(self.subcommand_metavar) + return rv + + def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: + super().format_options(ctx, formatter) + self.format_commands(ctx, formatter) + + def result_callback(self, replace: bool = False) -> t.Callable[[F], F]: + """Adds a result callback to the command. By default if a + result callback is already registered this will chain them but + this can be disabled with the `replace` parameter. The result + callback is invoked with the return value of the subcommand + (or the list of return values from all subcommands if chaining + is enabled) as well as the parameters as they would be passed + to the main callback. + + Example:: + + @click.group() + @click.option('-i', '--input', default=23) + def cli(input): + return 42 + + @cli.result_callback() + def process_result(result, input): + return result + input + + :param replace: if set to `True` an already existing result + callback will be removed. + + .. versionchanged:: 8.0 + Renamed from ``resultcallback``. + + .. versionadded:: 3.0 + """ + + def decorator(f: F) -> F: + old_callback = self._result_callback + + if old_callback is None or replace: + self._result_callback = f + return f + + def function(__value, *args, **kwargs): # type: ignore + inner = old_callback(__value, *args, **kwargs) + return f(inner, *args, **kwargs) + + self._result_callback = rv = update_wrapper(t.cast(F, function), f) + return rv + + return decorator + + def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: + """Extra format methods for multi methods that adds all the commands + after the options. + """ + commands = [] + for subcommand in self.list_commands(ctx): + cmd = self.get_command(ctx, subcommand) + # What is this, the tool lied about a command. Ignore it + if cmd is None: + continue + if cmd.hidden: + continue + + commands.append((subcommand, cmd)) + + # allow for 3 times the default spacing + if len(commands): + limit = formatter.width - 6 - max(len(cmd[0]) for cmd in commands) + + rows = [] + for subcommand, cmd in commands: + help = cmd.get_short_help_str(limit) + rows.append((subcommand, help)) + + if rows: + with formatter.section(_("Commands")): + formatter.write_dl(rows) + + def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: + if not args and self.no_args_is_help and not ctx.resilient_parsing: + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + rest = super().parse_args(ctx, args) + + if self.chain: + ctx.protected_args = rest + ctx.args = [] + elif rest: + ctx.protected_args, ctx.args = rest[:1], rest[1:] + + return ctx.args + + def invoke(self, ctx: Context) -> t.Any: + def _process_result(value: t.Any) -> t.Any: + if self._result_callback is not None: + value = ctx.invoke(self._result_callback, value, **ctx.params) + return value + + if not ctx.protected_args: + if self.invoke_without_command: + # No subcommand was invoked, so the result callback is + # invoked with the group return value for regular + # groups, or an empty list for chained groups. + with ctx: + rv = super().invoke(ctx) + return _process_result([] if self.chain else rv) + ctx.fail(_("Missing command.")) + + # Fetch args back out + args = [*ctx.protected_args, *ctx.args] + ctx.args = [] + ctx.protected_args = [] + + # If we're not in chain mode, we only allow the invocation of a + # single command but we also inform the current context about the + # name of the command to invoke. + if not self.chain: + # Make sure the context is entered so we do not clean up + # resources until the result processor has worked. + with ctx: + cmd_name, cmd, args = self.resolve_command(ctx, args) + assert cmd is not None + ctx.invoked_subcommand = cmd_name + super().invoke(ctx) + sub_ctx = cmd.make_context(cmd_name, args, parent=ctx) + with sub_ctx: + return _process_result(sub_ctx.command.invoke(sub_ctx)) + + # In chain mode we create the contexts step by step, but after the + # base command has been invoked. Because at that point we do not + # know the subcommands yet, the invoked subcommand attribute is + # set to ``*`` to inform the command that subcommands are executed + # but nothing else. + with ctx: + ctx.invoked_subcommand = "*" if args else None + super().invoke(ctx) + + # Otherwise we make every single context and invoke them in a + # chain. In that case the return value to the result processor + # is the list of all invoked subcommand's results. + contexts = [] + while args: + cmd_name, cmd, args = self.resolve_command(ctx, args) + assert cmd is not None + sub_ctx = cmd.make_context( + cmd_name, + args, + parent=ctx, + allow_extra_args=True, + allow_interspersed_args=False, + ) + contexts.append(sub_ctx) + args, sub_ctx.args = sub_ctx.args, [] + + rv = [] + for sub_ctx in contexts: + with sub_ctx: + rv.append(sub_ctx.command.invoke(sub_ctx)) + return _process_result(rv) + + def resolve_command( + self, ctx: Context, args: t.List[str] + ) -> t.Tuple[t.Optional[str], t.Optional[Command], t.List[str]]: + cmd_name = make_str(args[0]) + original_cmd_name = cmd_name + + # Get the command + cmd = self.get_command(ctx, cmd_name) + + # If we can't find the command but there is a normalization + # function available, we try with that one. + if cmd is None and ctx.token_normalize_func is not None: + cmd_name = ctx.token_normalize_func(cmd_name) + cmd = self.get_command(ctx, cmd_name) + + # If we don't find the command we want to show an error message + # to the user that it was not provided. However, there is + # something else we should do: if the first argument looks like + # an option we want to kick off parsing again for arguments to + # resolve things like --help which now should go to the main + # place. + if cmd is None and not ctx.resilient_parsing: + if split_opt(cmd_name)[0]: + self.parse_args(ctx, ctx.args) + ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) + return cmd_name if cmd else None, cmd, args[1:] + + def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: + """Given a context and a command name, this returns a + :class:`Command` object if it exists or returns `None`. + """ + raise NotImplementedError + + def list_commands(self, ctx: Context) -> t.List[str]: + """Returns a list of subcommand names in the order they should + appear. + """ + return [] + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. Looks + at the names of options, subcommands, and chained + multi-commands. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + results = [ + CompletionItem(name, help=command.get_short_help_str()) + for name, command in _complete_visible_commands(ctx, incomplete) + ] + results.extend(super().shell_complete(ctx, incomplete)) + return results + + +class Group(MultiCommand): + """A group allows a command to have subcommands attached. This is + the most common way to implement nesting in Click. + + :param name: The name of the group command. + :param commands: A dict mapping names to :class:`Command` objects. + Can also be a list of :class:`Command`, which will use + :attr:`Command.name` to create the dict. + :param attrs: Other command arguments described in + :class:`MultiCommand`, :class:`Command`, and + :class:`BaseCommand`. + + .. versionchanged:: 8.0 + The ``commands`` argument can be a list of command objects. + """ + + #: If set, this is used by the group's :meth:`command` decorator + #: as the default :class:`Command` class. This is useful to make all + #: subcommands use a custom command class. + #: + #: .. versionadded:: 8.0 + command_class: t.Optional[t.Type[Command]] = None + + #: If set, this is used by the group's :meth:`group` decorator + #: as the default :class:`Group` class. This is useful to make all + #: subgroups use a custom group class. + #: + #: If set to the special value :class:`type` (literally + #: ``group_class = type``), this group's class will be used as the + #: default class. This makes a custom group class continue to make + #: custom groups. + #: + #: .. versionadded:: 8.0 + group_class: t.Optional[t.Union[t.Type["Group"], t.Type[type]]] = None + # Literal[type] isn't valid, so use Type[type] + + def __init__( + self, + name: t.Optional[str] = None, + commands: t.Optional[ + t.Union[t.MutableMapping[str, Command], t.Sequence[Command]] + ] = None, + **attrs: t.Any, + ) -> None: + super().__init__(name, **attrs) + + if commands is None: + commands = {} + elif isinstance(commands, abc.Sequence): + commands = {c.name: c for c in commands if c.name is not None} + + #: The registered subcommands by their exported names. + self.commands: t.MutableMapping[str, Command] = commands + + def add_command(self, cmd: Command, name: t.Optional[str] = None) -> None: + """Registers another :class:`Command` with this group. If the name + is not provided, the name of the command is used. + """ + name = name or cmd.name + if name is None: + raise TypeError("Command has no name.") + _check_multicommand(self, name, cmd, register=True) + self.commands[name] = cmd + + @t.overload + def command(self, __func: t.Callable[..., t.Any]) -> Command: + ... + + @t.overload + def command( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Callable[[t.Callable[..., t.Any]], Command]: + ... + + def command( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Union[t.Callable[[t.Callable[..., t.Any]], Command], Command]: + """A shortcut decorator for declaring and attaching a command to + the group. This takes the same arguments as :func:`command` and + immediately registers the created command with this group by + calling :meth:`add_command`. + + To customize the command class used, set the + :attr:`command_class` attribute. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + + .. versionchanged:: 8.0 + Added the :attr:`command_class` attribute. + """ + from .decorators import command + + func: t.Optional[t.Callable[..., t.Any]] = None + + if args and callable(args[0]): + assert ( + len(args) == 1 and not kwargs + ), "Use 'command(**kwargs)(callable)' to provide arguments." + (func,) = args + args = () + + if self.command_class and kwargs.get("cls") is None: + kwargs["cls"] = self.command_class + + def decorator(f: t.Callable[..., t.Any]) -> Command: + cmd: Command = command(*args, **kwargs)(f) + self.add_command(cmd) + return cmd + + if func is not None: + return decorator(func) + + return decorator + + @t.overload + def group(self, __func: t.Callable[..., t.Any]) -> "Group": + ... + + @t.overload + def group( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Callable[[t.Callable[..., t.Any]], "Group"]: + ... + + def group( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Union[t.Callable[[t.Callable[..., t.Any]], "Group"], "Group"]: + """A shortcut decorator for declaring and attaching a group to + the group. This takes the same arguments as :func:`group` and + immediately registers the created group with this group by + calling :meth:`add_command`. + + To customize the group class used, set the :attr:`group_class` + attribute. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + + .. versionchanged:: 8.0 + Added the :attr:`group_class` attribute. + """ + from .decorators import group + + func: t.Optional[t.Callable[..., t.Any]] = None + + if args and callable(args[0]): + assert ( + len(args) == 1 and not kwargs + ), "Use 'group(**kwargs)(callable)' to provide arguments." + (func,) = args + args = () + + if self.group_class is not None and kwargs.get("cls") is None: + if self.group_class is type: + kwargs["cls"] = type(self) + else: + kwargs["cls"] = self.group_class + + def decorator(f: t.Callable[..., t.Any]) -> "Group": + cmd: Group = group(*args, **kwargs)(f) + self.add_command(cmd) + return cmd + + if func is not None: + return decorator(func) + + return decorator + + def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: + return self.commands.get(cmd_name) + + def list_commands(self, ctx: Context) -> t.List[str]: + return sorted(self.commands) + + +class CommandCollection(MultiCommand): + """A command collection is a multi command that merges multiple multi + commands together into one. This is a straightforward implementation + that accepts a list of different multi commands as sources and + provides all the commands for each of them. + + See :class:`MultiCommand` and :class:`Command` for the description of + ``name`` and ``attrs``. + """ + + def __init__( + self, + name: t.Optional[str] = None, + sources: t.Optional[t.List[MultiCommand]] = None, + **attrs: t.Any, + ) -> None: + super().__init__(name, **attrs) + #: The list of registered multi commands. + self.sources: t.List[MultiCommand] = sources or [] + + def add_source(self, multi_cmd: MultiCommand) -> None: + """Adds a new multi command to the chain dispatcher.""" + self.sources.append(multi_cmd) + + def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: + for source in self.sources: + rv = source.get_command(ctx, cmd_name) + + if rv is not None: + if self.chain: + _check_multicommand(self, cmd_name, rv) + + return rv + + return None + + def list_commands(self, ctx: Context) -> t.List[str]: + rv: t.Set[str] = set() + + for source in self.sources: + rv.update(source.list_commands(ctx)) + + return sorted(rv) + + +def _check_iter(value: t.Any) -> t.Iterator[t.Any]: + """Check if the value is iterable but not a string. Raises a type + error, or return an iterator over the value. + """ + if isinstance(value, str): + raise TypeError + + return iter(value) + + +class Parameter: + r"""A parameter to a command comes in two versions: they are either + :class:`Option`\s or :class:`Argument`\s. Other subclasses are currently + not supported by design as some of the internals for parsing are + intentionally not finalized. + + Some settings are supported by both options and arguments. + + :param param_decls: the parameter declarations for this option or + argument. This is a list of flags or argument + names. + :param type: the type that should be used. Either a :class:`ParamType` + or a Python type. The latter is converted into the former + automatically if supported. + :param required: controls if this is optional or not. + :param default: the default value if omitted. This can also be a callable, + in which case it's invoked when the default is needed + without any arguments. + :param callback: A function to further process or validate the value + after type conversion. It is called as ``f(ctx, param, value)`` + and must return the value. It is called for all sources, + including prompts. + :param nargs: the number of arguments to match. If not ``1`` the return + value is a tuple instead of single value. The default for + nargs is ``1`` (except if the type is a tuple, then it's + the arity of the tuple). If ``nargs=-1``, all remaining + parameters are collected. + :param metavar: how the value is represented in the help page. + :param expose_value: if this is `True` then the value is passed onwards + to the command callback and stored on the context, + otherwise it's skipped. + :param is_eager: eager values are processed before non eager ones. This + should not be set for arguments or it will inverse the + order of processing. + :param envvar: a string or list of strings that are environment variables + that should be checked. + :param shell_complete: A function that returns custom shell + completions. Used instead of the param's type completion if + given. Takes ``ctx, param, incomplete`` and must return a list + of :class:`~click.shell_completion.CompletionItem` or a list of + strings. + + .. versionchanged:: 8.0 + ``process_value`` validates required parameters and bounded + ``nargs``, and invokes the parameter callback before returning + the value. This allows the callback to validate prompts. + ``full_process_value`` is removed. + + .. versionchanged:: 8.0 + ``autocompletion`` is renamed to ``shell_complete`` and has new + semantics described above. The old name is deprecated and will + be removed in 8.1, until then it will be wrapped to match the + new requirements. + + .. versionchanged:: 8.0 + For ``multiple=True, nargs>1``, the default must be a list of + tuples. + + .. versionchanged:: 8.0 + Setting a default is no longer required for ``nargs>1``, it will + default to ``None``. ``multiple=True`` or ``nargs=-1`` will + default to ``()``. + + .. versionchanged:: 7.1 + Empty environment variables are ignored rather than taking the + empty string value. This makes it possible for scripts to clear + variables if they can't unset them. + + .. versionchanged:: 2.0 + Changed signature for parameter callback to also be passed the + parameter. The old callback format will still work, but it will + raise a warning to give you a chance to migrate the code easier. + """ + + param_type_name = "parameter" + + def __init__( + self, + param_decls: t.Optional[t.Sequence[str]] = None, + type: t.Optional[t.Union[types.ParamType, t.Any]] = None, + required: bool = False, + default: t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]] = None, + callback: t.Optional[t.Callable[[Context, "Parameter", t.Any], t.Any]] = None, + nargs: t.Optional[int] = None, + multiple: bool = False, + metavar: t.Optional[str] = None, + expose_value: bool = True, + is_eager: bool = False, + envvar: t.Optional[t.Union[str, t.Sequence[str]]] = None, + shell_complete: t.Optional[ + t.Callable[ + [Context, "Parameter", str], + t.Union[t.List["CompletionItem"], t.List[str]], + ] + ] = None, + ) -> None: + self.name: t.Optional[str] + self.opts: t.List[str] + self.secondary_opts: t.List[str] + self.name, self.opts, self.secondary_opts = self._parse_decls( + param_decls or (), expose_value + ) + self.type: types.ParamType = types.convert_type(type, default) + + # Default nargs to what the type tells us if we have that + # information available. + if nargs is None: + if self.type.is_composite: + nargs = self.type.arity + else: + nargs = 1 + + self.required = required + self.callback = callback + self.nargs = nargs + self.multiple = multiple + self.expose_value = expose_value + self.default = default + self.is_eager = is_eager + self.metavar = metavar + self.envvar = envvar + self._custom_shell_complete = shell_complete + + if __debug__: + if self.type.is_composite and nargs != self.type.arity: + raise ValueError( + f"'nargs' must be {self.type.arity} (or None) for" + f" type {self.type!r}, but it was {nargs}." + ) + + # Skip no default or callable default. + check_default = default if not callable(default) else None + + if check_default is not None: + if multiple: + try: + # Only check the first value against nargs. + check_default = next(_check_iter(check_default), None) + except TypeError: + raise ValueError( + "'default' must be a list when 'multiple' is true." + ) from None + + # Can be None for multiple with empty default. + if nargs != 1 and check_default is not None: + try: + _check_iter(check_default) + except TypeError: + if multiple: + message = ( + "'default' must be a list of lists when 'multiple' is" + " true and 'nargs' != 1." + ) + else: + message = "'default' must be a list when 'nargs' != 1." + + raise ValueError(message) from None + + if nargs > 1 and len(check_default) != nargs: + subject = "item length" if multiple else "length" + raise ValueError( + f"'default' {subject} must match nargs={nargs}." + ) + + def to_info_dict(self) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. + + Use :meth:`click.Context.to_info_dict` to traverse the entire + CLI structure. + + .. versionadded:: 8.0 + """ + return { + "name": self.name, + "param_type_name": self.param_type_name, + "opts": self.opts, + "secondary_opts": self.secondary_opts, + "type": self.type.to_info_dict(), + "required": self.required, + "nargs": self.nargs, + "multiple": self.multiple, + "default": self.default, + "envvar": self.envvar, + } + + def __repr__(self) -> str: + return f"<{self.__class__.__name__} {self.name}>" + + def _parse_decls( + self, decls: t.Sequence[str], expose_value: bool + ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: + raise NotImplementedError() + + @property + def human_readable_name(self) -> str: + """Returns the human readable name of this parameter. This is the + same as the name for options, but the metavar for arguments. + """ + return self.name # type: ignore + + def make_metavar(self) -> str: + if self.metavar is not None: + return self.metavar + + metavar = self.type.get_metavar(self) + + if metavar is None: + metavar = self.type.name.upper() + + if self.nargs != 1: + metavar += "..." + + return metavar + + @t.overload + def get_default( + self, ctx: Context, call: "te.Literal[True]" = True + ) -> t.Optional[t.Any]: + ... + + @t.overload + def get_default( + self, ctx: Context, call: bool = ... + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + ... + + def get_default( + self, ctx: Context, call: bool = True + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + """Get the default for the parameter. Tries + :meth:`Context.lookup_default` first, then the local default. + + :param ctx: Current context. + :param call: If the default is a callable, call it. Disable to + return the callable instead. + + .. versionchanged:: 8.0.2 + Type casting is no longer performed when getting a default. + + .. versionchanged:: 8.0.1 + Type casting can fail in resilient parsing mode. Invalid + defaults will not prevent showing help text. + + .. versionchanged:: 8.0 + Looks at ``ctx.default_map`` first. + + .. versionchanged:: 8.0 + Added the ``call`` parameter. + """ + value = ctx.lookup_default(self.name, call=False) # type: ignore + + if value is None: + value = self.default + + if call and callable(value): + value = value() + + return value + + def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: + raise NotImplementedError() + + def consume_value( + self, ctx: Context, opts: t.Mapping[str, t.Any] + ) -> t.Tuple[t.Any, ParameterSource]: + value = opts.get(self.name) # type: ignore + source = ParameterSource.COMMANDLINE + + if value is None: + value = self.value_from_envvar(ctx) + source = ParameterSource.ENVIRONMENT + + if value is None: + value = ctx.lookup_default(self.name) # type: ignore + source = ParameterSource.DEFAULT_MAP + + if value is None: + value = self.get_default(ctx) + source = ParameterSource.DEFAULT + + return value, source + + def type_cast_value(self, ctx: Context, value: t.Any) -> t.Any: + """Convert and validate a value against the option's + :attr:`type`, :attr:`multiple`, and :attr:`nargs`. + """ + if value is None: + return () if self.multiple or self.nargs == -1 else None + + def check_iter(value: t.Any) -> t.Iterator[t.Any]: + try: + return _check_iter(value) + except TypeError: + # This should only happen when passing in args manually, + # the parser should construct an iterable when parsing + # the command line. + raise BadParameter( + _("Value must be an iterable."), ctx=ctx, param=self + ) from None + + if self.nargs == 1 or self.type.is_composite: + + def convert(value: t.Any) -> t.Any: + return self.type(value, param=self, ctx=ctx) + + elif self.nargs == -1: + + def convert(value: t.Any) -> t.Any: # t.Tuple[t.Any, ...] + return tuple(self.type(x, self, ctx) for x in check_iter(value)) + + else: # nargs > 1 + + def convert(value: t.Any) -> t.Any: # t.Tuple[t.Any, ...] + value = tuple(check_iter(value)) + + if len(value) != self.nargs: + raise BadParameter( + ngettext( + "Takes {nargs} values but 1 was given.", + "Takes {nargs} values but {len} were given.", + len(value), + ).format(nargs=self.nargs, len=len(value)), + ctx=ctx, + param=self, + ) + + return tuple(self.type(x, self, ctx) for x in value) + + if self.multiple: + return tuple(convert(x) for x in check_iter(value)) + + return convert(value) + + def value_is_missing(self, value: t.Any) -> bool: + if value is None: + return True + + if (self.nargs != 1 or self.multiple) and value == (): + return True + + return False + + def process_value(self, ctx: Context, value: t.Any) -> t.Any: + value = self.type_cast_value(ctx, value) + + if self.required and self.value_is_missing(value): + raise MissingParameter(ctx=ctx, param=self) + + if self.callback is not None: + value = self.callback(ctx, self, value) + + return value + + def resolve_envvar_value(self, ctx: Context) -> t.Optional[str]: + if self.envvar is None: + return None + + if isinstance(self.envvar, str): + rv = os.environ.get(self.envvar) + + if rv: + return rv + else: + for envvar in self.envvar: + rv = os.environ.get(envvar) + + if rv: + return rv + + return None + + def value_from_envvar(self, ctx: Context) -> t.Optional[t.Any]: + rv: t.Optional[t.Any] = self.resolve_envvar_value(ctx) + + if rv is not None and self.nargs != 1: + rv = self.type.split_envvar_value(rv) + + return rv + + def handle_parse_result( + self, ctx: Context, opts: t.Mapping[str, t.Any], args: t.List[str] + ) -> t.Tuple[t.Any, t.List[str]]: + with augment_usage_errors(ctx, param=self): + value, source = self.consume_value(ctx, opts) + ctx.set_parameter_source(self.name, source) # type: ignore + + try: + value = self.process_value(ctx, value) + except Exception: + if not ctx.resilient_parsing: + raise + + value = None + + if self.expose_value: + ctx.params[self.name] = value # type: ignore + + return value, args + + def get_help_record(self, ctx: Context) -> t.Optional[t.Tuple[str, str]]: + pass + + def get_usage_pieces(self, ctx: Context) -> t.List[str]: + return [] + + def get_error_hint(self, ctx: Context) -> str: + """Get a stringified version of the param for use in error messages to + indicate which param caused the error. + """ + hint_list = self.opts or [self.human_readable_name] + return " / ".join(f"'{x}'" for x in hint_list) + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. If a + ``shell_complete`` function was given during init, it is used. + Otherwise, the :attr:`type` + :meth:`~click.types.ParamType.shell_complete` function is used. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + if self._custom_shell_complete is not None: + results = self._custom_shell_complete(ctx, self, incomplete) + + if results and isinstance(results[0], str): + from click.shell_completion import CompletionItem + + results = [CompletionItem(c) for c in results] + + return t.cast(t.List["CompletionItem"], results) + + return self.type.shell_complete(ctx, self, incomplete) + + +class Option(Parameter): + """Options are usually optional values on the command line and + have some extra features that arguments don't have. + + All other parameters are passed onwards to the parameter constructor. + + :param show_default: Show the default value for this option in its + help text. Values are not shown by default, unless + :attr:`Context.show_default` is ``True``. If this value is a + string, it shows that string in parentheses instead of the + actual value. This is particularly useful for dynamic options. + For single option boolean flags, the default remains hidden if + its value is ``False``. + :param show_envvar: Controls if an environment variable should be + shown on the help page. Normally, environment variables are not + shown. + :param prompt: If set to ``True`` or a non empty string then the + user will be prompted for input. If set to ``True`` the prompt + will be the option name capitalized. + :param confirmation_prompt: Prompt a second time to confirm the + value if it was prompted for. Can be set to a string instead of + ``True`` to customize the message. + :param prompt_required: If set to ``False``, the user will be + prompted for input only when the option was specified as a flag + without a value. + :param hide_input: If this is ``True`` then the input on the prompt + will be hidden from the user. This is useful for password input. + :param is_flag: forces this option to act as a flag. The default is + auto detection. + :param flag_value: which value should be used for this flag if it's + enabled. This is set to a boolean automatically if + the option string contains a slash to mark two options. + :param multiple: if this is set to `True` then the argument is accepted + multiple times and recorded. This is similar to ``nargs`` + in how it works but supports arbitrary number of + arguments. + :param count: this flag makes an option increment an integer. + :param allow_from_autoenv: if this is enabled then the value of this + parameter will be pulled from an environment + variable in case a prefix is defined on the + context. + :param help: the help string. + :param hidden: hide this option from help outputs. + :param attrs: Other command arguments described in :class:`Parameter`. + + .. versionchanged:: 8.1.0 + Help text indentation is cleaned here instead of only in the + ``@option`` decorator. + + .. versionchanged:: 8.1.0 + The ``show_default`` parameter overrides + ``Context.show_default``. + + .. versionchanged:: 8.1.0 + The default of a single option boolean flag is not shown if the + default value is ``False``. + + .. versionchanged:: 8.0.1 + ``type`` is detected from ``flag_value`` if given. + """ + + param_type_name = "option" + + def __init__( + self, + param_decls: t.Optional[t.Sequence[str]] = None, + show_default: t.Union[bool, str, None] = None, + prompt: t.Union[bool, str] = False, + confirmation_prompt: t.Union[bool, str] = False, + prompt_required: bool = True, + hide_input: bool = False, + is_flag: t.Optional[bool] = None, + flag_value: t.Optional[t.Any] = None, + multiple: bool = False, + count: bool = False, + allow_from_autoenv: bool = True, + type: t.Optional[t.Union[types.ParamType, t.Any]] = None, + help: t.Optional[str] = None, + hidden: bool = False, + show_choices: bool = True, + show_envvar: bool = False, + **attrs: t.Any, + ) -> None: + if help: + help = inspect.cleandoc(help) + + default_is_missing = "default" not in attrs + super().__init__(param_decls, type=type, multiple=multiple, **attrs) + + if prompt is True: + if self.name is None: + raise TypeError("'name' is required with 'prompt=True'.") + + prompt_text: t.Optional[str] = self.name.replace("_", " ").capitalize() + elif prompt is False: + prompt_text = None + else: + prompt_text = prompt + + self.prompt = prompt_text + self.confirmation_prompt = confirmation_prompt + self.prompt_required = prompt_required + self.hide_input = hide_input + self.hidden = hidden + + # If prompt is enabled but not required, then the option can be + # used as a flag to indicate using prompt or flag_value. + self._flag_needs_value = self.prompt is not None and not self.prompt_required + + if is_flag is None: + if flag_value is not None: + # Implicitly a flag because flag_value was set. + is_flag = True + elif self._flag_needs_value: + # Not a flag, but when used as a flag it shows a prompt. + is_flag = False + else: + # Implicitly a flag because flag options were given. + is_flag = bool(self.secondary_opts) + elif is_flag is False and not self._flag_needs_value: + # Not a flag, and prompt is not enabled, can be used as a + # flag if flag_value is set. + self._flag_needs_value = flag_value is not None + + self.default: t.Union[t.Any, t.Callable[[], t.Any]] + + if is_flag and default_is_missing and not self.required: + if multiple: + self.default = () + else: + self.default = False + + if flag_value is None: + flag_value = not self.default + + self.type: types.ParamType + if is_flag and type is None: + # Re-guess the type from the flag value instead of the + # default. + self.type = types.convert_type(None, flag_value) + + self.is_flag: bool = is_flag + self.is_bool_flag: bool = is_flag and isinstance(self.type, types.BoolParamType) + self.flag_value: t.Any = flag_value + + # Counting + self.count = count + if count: + if type is None: + self.type = types.IntRange(min=0) + if default_is_missing: + self.default = 0 + + self.allow_from_autoenv = allow_from_autoenv + self.help = help + self.show_default = show_default + self.show_choices = show_choices + self.show_envvar = show_envvar + + if __debug__: + if self.nargs == -1: + raise TypeError("nargs=-1 is not supported for options.") + + if self.prompt and self.is_flag and not self.is_bool_flag: + raise TypeError("'prompt' is not valid for non-boolean flag.") + + if not self.is_bool_flag and self.secondary_opts: + raise TypeError("Secondary flag is not valid for non-boolean flag.") + + if self.is_bool_flag and self.hide_input and self.prompt is not None: + raise TypeError( + "'prompt' with 'hide_input' is not valid for boolean flag." + ) + + if self.count: + if self.multiple: + raise TypeError("'count' is not valid with 'multiple'.") + + if self.is_flag: + raise TypeError("'count' is not valid with 'is_flag'.") + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update( + help=self.help, + prompt=self.prompt, + is_flag=self.is_flag, + flag_value=self.flag_value, + count=self.count, + hidden=self.hidden, + ) + return info_dict + + def _parse_decls( + self, decls: t.Sequence[str], expose_value: bool + ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: + opts = [] + secondary_opts = [] + name = None + possible_names = [] + + for decl in decls: + if decl.isidentifier(): + if name is not None: + raise TypeError(f"Name '{name}' defined twice") + name = decl + else: + split_char = ";" if decl[:1] == "/" else "/" + if split_char in decl: + first, second = decl.split(split_char, 1) + first = first.rstrip() + if first: + possible_names.append(split_opt(first)) + opts.append(first) + second = second.lstrip() + if second: + secondary_opts.append(second.lstrip()) + if first == second: + raise ValueError( + f"Boolean option {decl!r} cannot use the" + " same flag for true/false." + ) + else: + possible_names.append(split_opt(decl)) + opts.append(decl) + + if name is None and possible_names: + possible_names.sort(key=lambda x: -len(x[0])) # group long options first + name = possible_names[0][1].replace("-", "_").lower() + if not name.isidentifier(): + name = None + + if name is None: + if not expose_value: + return None, opts, secondary_opts + raise TypeError("Could not determine name for option") + + if not opts and not secondary_opts: + raise TypeError( + f"No options defined but a name was passed ({name})." + " Did you mean to declare an argument instead? Did" + f" you mean to pass '--{name}'?" + ) + + return name, opts, secondary_opts + + def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: + if self.multiple: + action = "append" + elif self.count: + action = "count" + else: + action = "store" + + if self.is_flag: + action = f"{action}_const" + + if self.is_bool_flag and self.secondary_opts: + parser.add_option( + obj=self, opts=self.opts, dest=self.name, action=action, const=True + ) + parser.add_option( + obj=self, + opts=self.secondary_opts, + dest=self.name, + action=action, + const=False, + ) + else: + parser.add_option( + obj=self, + opts=self.opts, + dest=self.name, + action=action, + const=self.flag_value, + ) + else: + parser.add_option( + obj=self, + opts=self.opts, + dest=self.name, + action=action, + nargs=self.nargs, + ) + + def get_help_record(self, ctx: Context) -> t.Optional[t.Tuple[str, str]]: + if self.hidden: + return None + + any_prefix_is_slash = False + + def _write_opts(opts: t.Sequence[str]) -> str: + nonlocal any_prefix_is_slash + + rv, any_slashes = join_options(opts) + + if any_slashes: + any_prefix_is_slash = True + + if not self.is_flag and not self.count: + rv += f" {self.make_metavar()}" + + return rv + + rv = [_write_opts(self.opts)] + + if self.secondary_opts: + rv.append(_write_opts(self.secondary_opts)) + + help = self.help or "" + extra = [] + + if self.show_envvar: + envvar = self.envvar + + if envvar is None: + if ( + self.allow_from_autoenv + and ctx.auto_envvar_prefix is not None + and self.name is not None + ): + envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" + + if envvar is not None: + var_str = ( + envvar + if isinstance(envvar, str) + else ", ".join(str(d) for d in envvar) + ) + extra.append(_("env var: {var}").format(var=var_str)) + + # Temporarily enable resilient parsing to avoid type casting + # failing for the default. Might be possible to extend this to + # help formatting in general. + resilient = ctx.resilient_parsing + ctx.resilient_parsing = True + + try: + default_value = self.get_default(ctx, call=False) + finally: + ctx.resilient_parsing = resilient + + show_default = False + show_default_is_str = False + + if self.show_default is not None: + if isinstance(self.show_default, str): + show_default_is_str = show_default = True + else: + show_default = self.show_default + elif ctx.show_default is not None: + show_default = ctx.show_default + + if show_default_is_str or (show_default and (default_value is not None)): + if show_default_is_str: + default_string = f"({self.show_default})" + elif isinstance(default_value, (list, tuple)): + default_string = ", ".join(str(d) for d in default_value) + elif inspect.isfunction(default_value): + default_string = _("(dynamic)") + elif self.is_bool_flag and self.secondary_opts: + # For boolean flags that have distinct True/False opts, + # use the opt without prefix instead of the value. + default_string = split_opt( + (self.opts if self.default else self.secondary_opts)[0] + )[1] + elif self.is_bool_flag and not self.secondary_opts and not default_value: + default_string = "" + else: + default_string = str(default_value) + + if default_string: + extra.append(_("default: {default}").format(default=default_string)) + + if ( + isinstance(self.type, types._NumberRangeBase) + # skip count with default range type + and not (self.count and self.type.min == 0 and self.type.max is None) + ): + range_str = self.type._describe_range() + + if range_str: + extra.append(range_str) + + if self.required: + extra.append(_("required")) + + if extra: + extra_str = "; ".join(extra) + help = f"{help} [{extra_str}]" if help else f"[{extra_str}]" + + return ("; " if any_prefix_is_slash else " / ").join(rv), help + + @t.overload + def get_default( + self, ctx: Context, call: "te.Literal[True]" = True + ) -> t.Optional[t.Any]: + ... + + @t.overload + def get_default( + self, ctx: Context, call: bool = ... + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + ... + + def get_default( + self, ctx: Context, call: bool = True + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + # If we're a non boolean flag our default is more complex because + # we need to look at all flags in the same group to figure out + # if we're the default one in which case we return the flag + # value as default. + if self.is_flag and not self.is_bool_flag: + for param in ctx.command.params: + if param.name == self.name and param.default: + return t.cast(Option, param).flag_value + + return None + + return super().get_default(ctx, call=call) + + def prompt_for_value(self, ctx: Context) -> t.Any: + """This is an alternative flow that can be activated in the full + value processing if a value does not exist. It will prompt the + user until a valid value exists and then returns the processed + value as result. + """ + assert self.prompt is not None + + # Calculate the default before prompting anything to be stable. + default = self.get_default(ctx) + + # If this is a prompt for a flag we need to handle this + # differently. + if self.is_bool_flag: + return confirm(self.prompt, default) + + return prompt( + self.prompt, + default=default, + type=self.type, + hide_input=self.hide_input, + show_choices=self.show_choices, + confirmation_prompt=self.confirmation_prompt, + value_proc=lambda x: self.process_value(ctx, x), + ) + + def resolve_envvar_value(self, ctx: Context) -> t.Optional[str]: + rv = super().resolve_envvar_value(ctx) + + if rv is not None: + return rv + + if ( + self.allow_from_autoenv + and ctx.auto_envvar_prefix is not None + and self.name is not None + ): + envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" + rv = os.environ.get(envvar) + + if rv: + return rv + + return None + + def value_from_envvar(self, ctx: Context) -> t.Optional[t.Any]: + rv: t.Optional[t.Any] = self.resolve_envvar_value(ctx) + + if rv is None: + return None + + value_depth = (self.nargs != 1) + bool(self.multiple) + + if value_depth > 0: + rv = self.type.split_envvar_value(rv) + + if self.multiple and self.nargs != 1: + rv = batch(rv, self.nargs) + + return rv + + def consume_value( + self, ctx: Context, opts: t.Mapping[str, "Parameter"] + ) -> t.Tuple[t.Any, ParameterSource]: + value, source = super().consume_value(ctx, opts) + + # The parser will emit a sentinel value if the option can be + # given as a flag without a value. This is different from None + # to distinguish from the flag not being given at all. + if value is _flag_needs_value: + if self.prompt is not None and not ctx.resilient_parsing: + value = self.prompt_for_value(ctx) + source = ParameterSource.PROMPT + else: + value = self.flag_value + source = ParameterSource.COMMANDLINE + + elif ( + self.multiple + and value is not None + and any(v is _flag_needs_value for v in value) + ): + value = [self.flag_value if v is _flag_needs_value else v for v in value] + source = ParameterSource.COMMANDLINE + + # The value wasn't set, or used the param's default, prompt if + # prompting is enabled. + elif ( + source in {None, ParameterSource.DEFAULT} + and self.prompt is not None + and (self.required or self.prompt_required) + and not ctx.resilient_parsing + ): + value = self.prompt_for_value(ctx) + source = ParameterSource.PROMPT + + return value, source + + +class Argument(Parameter): + """Arguments are positional parameters to a command. They generally + provide fewer features than options but can have infinite ``nargs`` + and are required by default. + + All parameters are passed onwards to the constructor of :class:`Parameter`. + """ + + param_type_name = "argument" + + def __init__( + self, + param_decls: t.Sequence[str], + required: t.Optional[bool] = None, + **attrs: t.Any, + ) -> None: + if required is None: + if attrs.get("default") is not None: + required = False + else: + required = attrs.get("nargs", 1) > 0 + + if "multiple" in attrs: + raise TypeError("__init__() got an unexpected keyword argument 'multiple'.") + + super().__init__(param_decls, required=required, **attrs) + + if __debug__: + if self.default is not None and self.nargs == -1: + raise TypeError("'default' is not supported for nargs=-1.") + + @property + def human_readable_name(self) -> str: + if self.metavar is not None: + return self.metavar + return self.name.upper() # type: ignore + + def make_metavar(self) -> str: + if self.metavar is not None: + return self.metavar + var = self.type.get_metavar(self) + if not var: + var = self.name.upper() # type: ignore + if not self.required: + var = f"[{var}]" + if self.nargs != 1: + var += "..." + return var + + def _parse_decls( + self, decls: t.Sequence[str], expose_value: bool + ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: + if not decls: + if not expose_value: + return None, [], [] + raise TypeError("Could not determine name for argument") + if len(decls) == 1: + name = arg = decls[0] + name = name.replace("-", "_").lower() + else: + raise TypeError( + "Arguments take exactly one parameter declaration, got" + f" {len(decls)}." + ) + return name, [arg], [] + + def get_usage_pieces(self, ctx: Context) -> t.List[str]: + return [self.make_metavar()] + + def get_error_hint(self, ctx: Context) -> str: + return f"'{self.make_metavar()}'" + + def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: + parser.add_argument(dest=self.name, nargs=self.nargs, obj=self) diff --git a/billinglayer/python/click/decorators.py b/billinglayer/python/click/decorators.py new file mode 100644 index 0000000..d9bba95 --- /dev/null +++ b/billinglayer/python/click/decorators.py @@ -0,0 +1,561 @@ +import inspect +import types +import typing as t +from functools import update_wrapper +from gettext import gettext as _ + +from .core import Argument +from .core import Command +from .core import Context +from .core import Group +from .core import Option +from .core import Parameter +from .globals import get_current_context +from .utils import echo + +if t.TYPE_CHECKING: + import typing_extensions as te + + P = te.ParamSpec("P") + +R = t.TypeVar("R") +T = t.TypeVar("T") +_AnyCallable = t.Callable[..., t.Any] +FC = t.TypeVar("FC", bound=t.Union[_AnyCallable, Command]) + + +def pass_context(f: "t.Callable[te.Concatenate[Context, P], R]") -> "t.Callable[P, R]": + """Marks a callback as wanting to receive the current context + object as first argument. + """ + + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R": + return f(get_current_context(), *args, **kwargs) + + return update_wrapper(new_func, f) + + +def pass_obj(f: "t.Callable[te.Concatenate[t.Any, P], R]") -> "t.Callable[P, R]": + """Similar to :func:`pass_context`, but only pass the object on the + context onwards (:attr:`Context.obj`). This is useful if that object + represents the state of a nested system. + """ + + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R": + return f(get_current_context().obj, *args, **kwargs) + + return update_wrapper(new_func, f) + + +def make_pass_decorator( + object_type: t.Type[T], ensure: bool = False +) -> t.Callable[["t.Callable[te.Concatenate[T, P], R]"], "t.Callable[P, R]"]: + """Given an object type this creates a decorator that will work + similar to :func:`pass_obj` but instead of passing the object of the + current context, it will find the innermost context of type + :func:`object_type`. + + This generates a decorator that works roughly like this:: + + from functools import update_wrapper + + def decorator(f): + @pass_context + def new_func(ctx, *args, **kwargs): + obj = ctx.find_object(object_type) + return ctx.invoke(f, obj, *args, **kwargs) + return update_wrapper(new_func, f) + return decorator + + :param object_type: the type of the object to pass. + :param ensure: if set to `True`, a new object will be created and + remembered on the context if it's not there yet. + """ + + def decorator(f: "t.Callable[te.Concatenate[T, P], R]") -> "t.Callable[P, R]": + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R": + ctx = get_current_context() + + obj: t.Optional[T] + if ensure: + obj = ctx.ensure_object(object_type) + else: + obj = ctx.find_object(object_type) + + if obj is None: + raise RuntimeError( + "Managed to invoke callback without a context" + f" object of type {object_type.__name__!r}" + " existing." + ) + + return ctx.invoke(f, obj, *args, **kwargs) + + return update_wrapper(new_func, f) + + return decorator # type: ignore[return-value] + + +def pass_meta_key( + key: str, *, doc_description: t.Optional[str] = None +) -> "t.Callable[[t.Callable[te.Concatenate[t.Any, P], R]], t.Callable[P, R]]": + """Create a decorator that passes a key from + :attr:`click.Context.meta` as the first argument to the decorated + function. + + :param key: Key in ``Context.meta`` to pass. + :param doc_description: Description of the object being passed, + inserted into the decorator's docstring. Defaults to "the 'key' + key from Context.meta". + + .. versionadded:: 8.0 + """ + + def decorator(f: "t.Callable[te.Concatenate[t.Any, P], R]") -> "t.Callable[P, R]": + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> R: + ctx = get_current_context() + obj = ctx.meta[key] + return ctx.invoke(f, obj, *args, **kwargs) + + return update_wrapper(new_func, f) + + if doc_description is None: + doc_description = f"the {key!r} key from :attr:`click.Context.meta`" + + decorator.__doc__ = ( + f"Decorator that passes {doc_description} as the first argument" + " to the decorated function." + ) + return decorator # type: ignore[return-value] + + +CmdType = t.TypeVar("CmdType", bound=Command) + + +# variant: no call, directly as decorator for a function. +@t.overload +def command(name: _AnyCallable) -> Command: + ... + + +# variant: with positional name and with positional or keyword cls argument: +# @command(namearg, CommandCls, ...) or @command(namearg, cls=CommandCls, ...) +@t.overload +def command( + name: t.Optional[str], + cls: t.Type[CmdType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], CmdType]: + ... + + +# variant: name omitted, cls _must_ be a keyword argument, @command(cls=CommandCls, ...) +@t.overload +def command( + name: None = None, + *, + cls: t.Type[CmdType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], CmdType]: + ... + + +# variant: with optional string name, no cls argument provided. +@t.overload +def command( + name: t.Optional[str] = ..., cls: None = None, **attrs: t.Any +) -> t.Callable[[_AnyCallable], Command]: + ... + + +def command( + name: t.Union[t.Optional[str], _AnyCallable] = None, + cls: t.Optional[t.Type[CmdType]] = None, + **attrs: t.Any, +) -> t.Union[Command, t.Callable[[_AnyCallable], t.Union[Command, CmdType]]]: + r"""Creates a new :class:`Command` and uses the decorated function as + callback. This will also automatically attach all decorated + :func:`option`\s and :func:`argument`\s as parameters to the command. + + The name of the command defaults to the name of the function with + underscores replaced by dashes. If you want to change that, you can + pass the intended name as the first argument. + + All keyword arguments are forwarded to the underlying command class. + For the ``params`` argument, any decorated params are appended to + the end of the list. + + Once decorated the function turns into a :class:`Command` instance + that can be invoked as a command line utility or be attached to a + command :class:`Group`. + + :param name: the name of the command. This defaults to the function + name with underscores replaced by dashes. + :param cls: the command class to instantiate. This defaults to + :class:`Command`. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + + .. versionchanged:: 8.1 + The ``params`` argument can be used. Decorated params are + appended to the end of the list. + """ + + func: t.Optional[t.Callable[[_AnyCallable], t.Any]] = None + + if callable(name): + func = name + name = None + assert cls is None, "Use 'command(cls=cls)(callable)' to specify a class." + assert not attrs, "Use 'command(**kwargs)(callable)' to provide arguments." + + if cls is None: + cls = t.cast(t.Type[CmdType], Command) + + def decorator(f: _AnyCallable) -> CmdType: + if isinstance(f, Command): + raise TypeError("Attempted to convert a callback into a command twice.") + + attr_params = attrs.pop("params", None) + params = attr_params if attr_params is not None else [] + + try: + decorator_params = f.__click_params__ # type: ignore + except AttributeError: + pass + else: + del f.__click_params__ # type: ignore + params.extend(reversed(decorator_params)) + + if attrs.get("help") is None: + attrs["help"] = f.__doc__ + + if t.TYPE_CHECKING: + assert cls is not None + assert not callable(name) + + cmd = cls( + name=name or f.__name__.lower().replace("_", "-"), + callback=f, + params=params, + **attrs, + ) + cmd.__doc__ = f.__doc__ + return cmd + + if func is not None: + return decorator(func) + + return decorator + + +GrpType = t.TypeVar("GrpType", bound=Group) + + +# variant: no call, directly as decorator for a function. +@t.overload +def group(name: _AnyCallable) -> Group: + ... + + +# variant: with positional name and with positional or keyword cls argument: +# @group(namearg, GroupCls, ...) or @group(namearg, cls=GroupCls, ...) +@t.overload +def group( + name: t.Optional[str], + cls: t.Type[GrpType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], GrpType]: + ... + + +# variant: name omitted, cls _must_ be a keyword argument, @group(cmd=GroupCls, ...) +@t.overload +def group( + name: None = None, + *, + cls: t.Type[GrpType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], GrpType]: + ... + + +# variant: with optional string name, no cls argument provided. +@t.overload +def group( + name: t.Optional[str] = ..., cls: None = None, **attrs: t.Any +) -> t.Callable[[_AnyCallable], Group]: + ... + + +def group( + name: t.Union[str, _AnyCallable, None] = None, + cls: t.Optional[t.Type[GrpType]] = None, + **attrs: t.Any, +) -> t.Union[Group, t.Callable[[_AnyCallable], t.Union[Group, GrpType]]]: + """Creates a new :class:`Group` with a function as callback. This + works otherwise the same as :func:`command` just that the `cls` + parameter is set to :class:`Group`. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + """ + if cls is None: + cls = t.cast(t.Type[GrpType], Group) + + if callable(name): + return command(cls=cls, **attrs)(name) + + return command(name, cls, **attrs) + + +def _param_memo(f: t.Callable[..., t.Any], param: Parameter) -> None: + if isinstance(f, Command): + f.params.append(param) + else: + if not hasattr(f, "__click_params__"): + f.__click_params__ = [] # type: ignore + + f.__click_params__.append(param) # type: ignore + + +def argument( + *param_decls: str, cls: t.Optional[t.Type[Argument]] = None, **attrs: t.Any +) -> t.Callable[[FC], FC]: + """Attaches an argument to the command. All positional arguments are + passed as parameter declarations to :class:`Argument`; all keyword + arguments are forwarded unchanged (except ``cls``). + This is equivalent to creating an :class:`Argument` instance manually + and attaching it to the :attr:`Command.params` list. + + For the default argument class, refer to :class:`Argument` and + :class:`Parameter` for descriptions of parameters. + + :param cls: the argument class to instantiate. This defaults to + :class:`Argument`. + :param param_decls: Passed as positional arguments to the constructor of + ``cls``. + :param attrs: Passed as keyword arguments to the constructor of ``cls``. + """ + if cls is None: + cls = Argument + + def decorator(f: FC) -> FC: + _param_memo(f, cls(param_decls, **attrs)) + return f + + return decorator + + +def option( + *param_decls: str, cls: t.Optional[t.Type[Option]] = None, **attrs: t.Any +) -> t.Callable[[FC], FC]: + """Attaches an option to the command. All positional arguments are + passed as parameter declarations to :class:`Option`; all keyword + arguments are forwarded unchanged (except ``cls``). + This is equivalent to creating an :class:`Option` instance manually + and attaching it to the :attr:`Command.params` list. + + For the default option class, refer to :class:`Option` and + :class:`Parameter` for descriptions of parameters. + + :param cls: the option class to instantiate. This defaults to + :class:`Option`. + :param param_decls: Passed as positional arguments to the constructor of + ``cls``. + :param attrs: Passed as keyword arguments to the constructor of ``cls``. + """ + if cls is None: + cls = Option + + def decorator(f: FC) -> FC: + _param_memo(f, cls(param_decls, **attrs)) + return f + + return decorator + + +def confirmation_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: + """Add a ``--yes`` option which shows a prompt before continuing if + not passed. If the prompt is declined, the program will exit. + + :param param_decls: One or more option names. Defaults to the single + value ``"--yes"``. + :param kwargs: Extra arguments are passed to :func:`option`. + """ + + def callback(ctx: Context, param: Parameter, value: bool) -> None: + if not value: + ctx.abort() + + if not param_decls: + param_decls = ("--yes",) + + kwargs.setdefault("is_flag", True) + kwargs.setdefault("callback", callback) + kwargs.setdefault("expose_value", False) + kwargs.setdefault("prompt", "Do you want to continue?") + kwargs.setdefault("help", "Confirm the action without prompting.") + return option(*param_decls, **kwargs) + + +def password_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: + """Add a ``--password`` option which prompts for a password, hiding + input and asking to enter the value again for confirmation. + + :param param_decls: One or more option names. Defaults to the single + value ``"--password"``. + :param kwargs: Extra arguments are passed to :func:`option`. + """ + if not param_decls: + param_decls = ("--password",) + + kwargs.setdefault("prompt", True) + kwargs.setdefault("confirmation_prompt", True) + kwargs.setdefault("hide_input", True) + return option(*param_decls, **kwargs) + + +def version_option( + version: t.Optional[str] = None, + *param_decls: str, + package_name: t.Optional[str] = None, + prog_name: t.Optional[str] = None, + message: t.Optional[str] = None, + **kwargs: t.Any, +) -> t.Callable[[FC], FC]: + """Add a ``--version`` option which immediately prints the version + number and exits the program. + + If ``version`` is not provided, Click will try to detect it using + :func:`importlib.metadata.version` to get the version for the + ``package_name``. On Python < 3.8, the ``importlib_metadata`` + backport must be installed. + + If ``package_name`` is not provided, Click will try to detect it by + inspecting the stack frames. This will be used to detect the + version, so it must match the name of the installed package. + + :param version: The version number to show. If not provided, Click + will try to detect it. + :param param_decls: One or more option names. Defaults to the single + value ``"--version"``. + :param package_name: The package name to detect the version from. If + not provided, Click will try to detect it. + :param prog_name: The name of the CLI to show in the message. If not + provided, it will be detected from the command. + :param message: The message to show. The values ``%(prog)s``, + ``%(package)s``, and ``%(version)s`` are available. Defaults to + ``"%(prog)s, version %(version)s"``. + :param kwargs: Extra arguments are passed to :func:`option`. + :raise RuntimeError: ``version`` could not be detected. + + .. versionchanged:: 8.0 + Add the ``package_name`` parameter, and the ``%(package)s`` + value for messages. + + .. versionchanged:: 8.0 + Use :mod:`importlib.metadata` instead of ``pkg_resources``. The + version is detected based on the package name, not the entry + point name. The Python package name must match the installed + package name, or be passed with ``package_name=``. + """ + if message is None: + message = _("%(prog)s, version %(version)s") + + if version is None and package_name is None: + frame = inspect.currentframe() + f_back = frame.f_back if frame is not None else None + f_globals = f_back.f_globals if f_back is not None else None + # break reference cycle + # https://docs.python.org/3/library/inspect.html#the-interpreter-stack + del frame + + if f_globals is not None: + package_name = f_globals.get("__name__") + + if package_name == "__main__": + package_name = f_globals.get("__package__") + + if package_name: + package_name = package_name.partition(".")[0] + + def callback(ctx: Context, param: Parameter, value: bool) -> None: + if not value or ctx.resilient_parsing: + return + + nonlocal prog_name + nonlocal version + + if prog_name is None: + prog_name = ctx.find_root().info_name + + if version is None and package_name is not None: + metadata: t.Optional[types.ModuleType] + + try: + from importlib import metadata # type: ignore + except ImportError: + # Python < 3.8 + import importlib_metadata as metadata # type: ignore + + try: + version = metadata.version(package_name) # type: ignore + except metadata.PackageNotFoundError: # type: ignore + raise RuntimeError( + f"{package_name!r} is not installed. Try passing" + " 'package_name' instead." + ) from None + + if version is None: + raise RuntimeError( + f"Could not determine the version for {package_name!r} automatically." + ) + + echo( + message % {"prog": prog_name, "package": package_name, "version": version}, + color=ctx.color, + ) + ctx.exit() + + if not param_decls: + param_decls = ("--version",) + + kwargs.setdefault("is_flag", True) + kwargs.setdefault("expose_value", False) + kwargs.setdefault("is_eager", True) + kwargs.setdefault("help", _("Show the version and exit.")) + kwargs["callback"] = callback + return option(*param_decls, **kwargs) + + +def help_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: + """Add a ``--help`` option which immediately prints the help page + and exits the program. + + This is usually unnecessary, as the ``--help`` option is added to + each command automatically unless ``add_help_option=False`` is + passed. + + :param param_decls: One or more option names. Defaults to the single + value ``"--help"``. + :param kwargs: Extra arguments are passed to :func:`option`. + """ + + def callback(ctx: Context, param: Parameter, value: bool) -> None: + if not value or ctx.resilient_parsing: + return + + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + if not param_decls: + param_decls = ("--help",) + + kwargs.setdefault("is_flag", True) + kwargs.setdefault("expose_value", False) + kwargs.setdefault("is_eager", True) + kwargs.setdefault("help", _("Show this message and exit.")) + kwargs["callback"] = callback + return option(*param_decls, **kwargs) diff --git a/billinglayer/python/click/exceptions.py b/billinglayer/python/click/exceptions.py new file mode 100644 index 0000000..fe68a36 --- /dev/null +++ b/billinglayer/python/click/exceptions.py @@ -0,0 +1,288 @@ +import typing as t +from gettext import gettext as _ +from gettext import ngettext + +from ._compat import get_text_stderr +from .utils import echo +from .utils import format_filename + +if t.TYPE_CHECKING: + from .core import Command + from .core import Context + from .core import Parameter + + +def _join_param_hints( + param_hint: t.Optional[t.Union[t.Sequence[str], str]] +) -> t.Optional[str]: + if param_hint is not None and not isinstance(param_hint, str): + return " / ".join(repr(x) for x in param_hint) + + return param_hint + + +class ClickException(Exception): + """An exception that Click can handle and show to the user.""" + + #: The exit code for this exception. + exit_code = 1 + + def __init__(self, message: str) -> None: + super().__init__(message) + self.message = message + + def format_message(self) -> str: + return self.message + + def __str__(self) -> str: + return self.message + + def show(self, file: t.Optional[t.IO[t.Any]] = None) -> None: + if file is None: + file = get_text_stderr() + + echo(_("Error: {message}").format(message=self.format_message()), file=file) + + +class UsageError(ClickException): + """An internal exception that signals a usage error. This typically + aborts any further handling. + + :param message: the error message to display. + :param ctx: optionally the context that caused this error. Click will + fill in the context automatically in some situations. + """ + + exit_code = 2 + + def __init__(self, message: str, ctx: t.Optional["Context"] = None) -> None: + super().__init__(message) + self.ctx = ctx + self.cmd: t.Optional["Command"] = self.ctx.command if self.ctx else None + + def show(self, file: t.Optional[t.IO[t.Any]] = None) -> None: + if file is None: + file = get_text_stderr() + color = None + hint = "" + if ( + self.ctx is not None + and self.ctx.command.get_help_option(self.ctx) is not None + ): + hint = _("Try '{command} {option}' for help.").format( + command=self.ctx.command_path, option=self.ctx.help_option_names[0] + ) + hint = f"{hint}\n" + if self.ctx is not None: + color = self.ctx.color + echo(f"{self.ctx.get_usage()}\n{hint}", file=file, color=color) + echo( + _("Error: {message}").format(message=self.format_message()), + file=file, + color=color, + ) + + +class BadParameter(UsageError): + """An exception that formats out a standardized error message for a + bad parameter. This is useful when thrown from a callback or type as + Click will attach contextual information to it (for instance, which + parameter it is). + + .. versionadded:: 2.0 + + :param param: the parameter object that caused this error. This can + be left out, and Click will attach this info itself + if possible. + :param param_hint: a string that shows up as parameter name. This + can be used as alternative to `param` in cases + where custom validation should happen. If it is + a string it's used as such, if it's a list then + each item is quoted and separated. + """ + + def __init__( + self, + message: str, + ctx: t.Optional["Context"] = None, + param: t.Optional["Parameter"] = None, + param_hint: t.Optional[str] = None, + ) -> None: + super().__init__(message, ctx) + self.param = param + self.param_hint = param_hint + + def format_message(self) -> str: + if self.param_hint is not None: + param_hint = self.param_hint + elif self.param is not None: + param_hint = self.param.get_error_hint(self.ctx) # type: ignore + else: + return _("Invalid value: {message}").format(message=self.message) + + return _("Invalid value for {param_hint}: {message}").format( + param_hint=_join_param_hints(param_hint), message=self.message + ) + + +class MissingParameter(BadParameter): + """Raised if click required an option or argument but it was not + provided when invoking the script. + + .. versionadded:: 4.0 + + :param param_type: a string that indicates the type of the parameter. + The default is to inherit the parameter type from + the given `param`. Valid values are ``'parameter'``, + ``'option'`` or ``'argument'``. + """ + + def __init__( + self, + message: t.Optional[str] = None, + ctx: t.Optional["Context"] = None, + param: t.Optional["Parameter"] = None, + param_hint: t.Optional[str] = None, + param_type: t.Optional[str] = None, + ) -> None: + super().__init__(message or "", ctx, param, param_hint) + self.param_type = param_type + + def format_message(self) -> str: + if self.param_hint is not None: + param_hint: t.Optional[str] = self.param_hint + elif self.param is not None: + param_hint = self.param.get_error_hint(self.ctx) # type: ignore + else: + param_hint = None + + param_hint = _join_param_hints(param_hint) + param_hint = f" {param_hint}" if param_hint else "" + + param_type = self.param_type + if param_type is None and self.param is not None: + param_type = self.param.param_type_name + + msg = self.message + if self.param is not None: + msg_extra = self.param.type.get_missing_message(self.param) + if msg_extra: + if msg: + msg += f". {msg_extra}" + else: + msg = msg_extra + + msg = f" {msg}" if msg else "" + + # Translate param_type for known types. + if param_type == "argument": + missing = _("Missing argument") + elif param_type == "option": + missing = _("Missing option") + elif param_type == "parameter": + missing = _("Missing parameter") + else: + missing = _("Missing {param_type}").format(param_type=param_type) + + return f"{missing}{param_hint}.{msg}" + + def __str__(self) -> str: + if not self.message: + param_name = self.param.name if self.param else None + return _("Missing parameter: {param_name}").format(param_name=param_name) + else: + return self.message + + +class NoSuchOption(UsageError): + """Raised if click attempted to handle an option that does not + exist. + + .. versionadded:: 4.0 + """ + + def __init__( + self, + option_name: str, + message: t.Optional[str] = None, + possibilities: t.Optional[t.Sequence[str]] = None, + ctx: t.Optional["Context"] = None, + ) -> None: + if message is None: + message = _("No such option: {name}").format(name=option_name) + + super().__init__(message, ctx) + self.option_name = option_name + self.possibilities = possibilities + + def format_message(self) -> str: + if not self.possibilities: + return self.message + + possibility_str = ", ".join(sorted(self.possibilities)) + suggest = ngettext( + "Did you mean {possibility}?", + "(Possible options: {possibilities})", + len(self.possibilities), + ).format(possibility=possibility_str, possibilities=possibility_str) + return f"{self.message} {suggest}" + + +class BadOptionUsage(UsageError): + """Raised if an option is generally supplied but the use of the option + was incorrect. This is for instance raised if the number of arguments + for an option is not correct. + + .. versionadded:: 4.0 + + :param option_name: the name of the option being used incorrectly. + """ + + def __init__( + self, option_name: str, message: str, ctx: t.Optional["Context"] = None + ) -> None: + super().__init__(message, ctx) + self.option_name = option_name + + +class BadArgumentUsage(UsageError): + """Raised if an argument is generally supplied but the use of the argument + was incorrect. This is for instance raised if the number of values + for an argument is not correct. + + .. versionadded:: 6.0 + """ + + +class FileError(ClickException): + """Raised if a file cannot be opened.""" + + def __init__(self, filename: str, hint: t.Optional[str] = None) -> None: + if hint is None: + hint = _("unknown error") + + super().__init__(hint) + self.ui_filename: str = format_filename(filename) + self.filename = filename + + def format_message(self) -> str: + return _("Could not open file {filename!r}: {message}").format( + filename=self.ui_filename, message=self.message + ) + + +class Abort(RuntimeError): + """An internal signalling exception that signals Click to abort.""" + + +class Exit(RuntimeError): + """An exception that indicates that the application should exit with some + status code. + + :param code: the status code to exit with. + """ + + __slots__ = ("exit_code",) + + def __init__(self, code: int = 0) -> None: + self.exit_code: int = code diff --git a/billinglayer/python/click/formatting.py b/billinglayer/python/click/formatting.py new file mode 100644 index 0000000..ddd2a2f --- /dev/null +++ b/billinglayer/python/click/formatting.py @@ -0,0 +1,301 @@ +import typing as t +from contextlib import contextmanager +from gettext import gettext as _ + +from ._compat import term_len +from .parser import split_opt + +# Can force a width. This is used by the test system +FORCED_WIDTH: t.Optional[int] = None + + +def measure_table(rows: t.Iterable[t.Tuple[str, str]]) -> t.Tuple[int, ...]: + widths: t.Dict[int, int] = {} + + for row in rows: + for idx, col in enumerate(row): + widths[idx] = max(widths.get(idx, 0), term_len(col)) + + return tuple(y for x, y in sorted(widths.items())) + + +def iter_rows( + rows: t.Iterable[t.Tuple[str, str]], col_count: int +) -> t.Iterator[t.Tuple[str, ...]]: + for row in rows: + yield row + ("",) * (col_count - len(row)) + + +def wrap_text( + text: str, + width: int = 78, + initial_indent: str = "", + subsequent_indent: str = "", + preserve_paragraphs: bool = False, +) -> str: + """A helper function that intelligently wraps text. By default, it + assumes that it operates on a single paragraph of text but if the + `preserve_paragraphs` parameter is provided it will intelligently + handle paragraphs (defined by two empty lines). + + If paragraphs are handled, a paragraph can be prefixed with an empty + line containing the ``\\b`` character (``\\x08``) to indicate that + no rewrapping should happen in that block. + + :param text: the text that should be rewrapped. + :param width: the maximum width for the text. + :param initial_indent: the initial indent that should be placed on the + first line as a string. + :param subsequent_indent: the indent string that should be placed on + each consecutive line. + :param preserve_paragraphs: if this flag is set then the wrapping will + intelligently handle paragraphs. + """ + from ._textwrap import TextWrapper + + text = text.expandtabs() + wrapper = TextWrapper( + width, + initial_indent=initial_indent, + subsequent_indent=subsequent_indent, + replace_whitespace=False, + ) + if not preserve_paragraphs: + return wrapper.fill(text) + + p: t.List[t.Tuple[int, bool, str]] = [] + buf: t.List[str] = [] + indent = None + + def _flush_par() -> None: + if not buf: + return + if buf[0].strip() == "\b": + p.append((indent or 0, True, "\n".join(buf[1:]))) + else: + p.append((indent or 0, False, " ".join(buf))) + del buf[:] + + for line in text.splitlines(): + if not line: + _flush_par() + indent = None + else: + if indent is None: + orig_len = term_len(line) + line = line.lstrip() + indent = orig_len - term_len(line) + buf.append(line) + _flush_par() + + rv = [] + for indent, raw, text in p: + with wrapper.extra_indent(" " * indent): + if raw: + rv.append(wrapper.indent_only(text)) + else: + rv.append(wrapper.fill(text)) + + return "\n\n".join(rv) + + +class HelpFormatter: + """This class helps with formatting text-based help pages. It's + usually just needed for very special internal cases, but it's also + exposed so that developers can write their own fancy outputs. + + At present, it always writes into memory. + + :param indent_increment: the additional increment for each level. + :param width: the width for the text. This defaults to the terminal + width clamped to a maximum of 78. + """ + + def __init__( + self, + indent_increment: int = 2, + width: t.Optional[int] = None, + max_width: t.Optional[int] = None, + ) -> None: + import shutil + + self.indent_increment = indent_increment + if max_width is None: + max_width = 80 + if width is None: + width = FORCED_WIDTH + if width is None: + width = max(min(shutil.get_terminal_size().columns, max_width) - 2, 50) + self.width = width + self.current_indent = 0 + self.buffer: t.List[str] = [] + + def write(self, string: str) -> None: + """Writes a unicode string into the internal buffer.""" + self.buffer.append(string) + + def indent(self) -> None: + """Increases the indentation.""" + self.current_indent += self.indent_increment + + def dedent(self) -> None: + """Decreases the indentation.""" + self.current_indent -= self.indent_increment + + def write_usage( + self, prog: str, args: str = "", prefix: t.Optional[str] = None + ) -> None: + """Writes a usage line into the buffer. + + :param prog: the program name. + :param args: whitespace separated list of arguments. + :param prefix: The prefix for the first line. Defaults to + ``"Usage: "``. + """ + if prefix is None: + prefix = f"{_('Usage:')} " + + usage_prefix = f"{prefix:>{self.current_indent}}{prog} " + text_width = self.width - self.current_indent + + if text_width >= (term_len(usage_prefix) + 20): + # The arguments will fit to the right of the prefix. + indent = " " * term_len(usage_prefix) + self.write( + wrap_text( + args, + text_width, + initial_indent=usage_prefix, + subsequent_indent=indent, + ) + ) + else: + # The prefix is too long, put the arguments on the next line. + self.write(usage_prefix) + self.write("\n") + indent = " " * (max(self.current_indent, term_len(prefix)) + 4) + self.write( + wrap_text( + args, text_width, initial_indent=indent, subsequent_indent=indent + ) + ) + + self.write("\n") + + def write_heading(self, heading: str) -> None: + """Writes a heading into the buffer.""" + self.write(f"{'':>{self.current_indent}}{heading}:\n") + + def write_paragraph(self) -> None: + """Writes a paragraph into the buffer.""" + if self.buffer: + self.write("\n") + + def write_text(self, text: str) -> None: + """Writes re-indented text into the buffer. This rewraps and + preserves paragraphs. + """ + indent = " " * self.current_indent + self.write( + wrap_text( + text, + self.width, + initial_indent=indent, + subsequent_indent=indent, + preserve_paragraphs=True, + ) + ) + self.write("\n") + + def write_dl( + self, + rows: t.Sequence[t.Tuple[str, str]], + col_max: int = 30, + col_spacing: int = 2, + ) -> None: + """Writes a definition list into the buffer. This is how options + and commands are usually formatted. + + :param rows: a list of two item tuples for the terms and values. + :param col_max: the maximum width of the first column. + :param col_spacing: the number of spaces between the first and + second column. + """ + rows = list(rows) + widths = measure_table(rows) + if len(widths) != 2: + raise TypeError("Expected two columns for definition list") + + first_col = min(widths[0], col_max) + col_spacing + + for first, second in iter_rows(rows, len(widths)): + self.write(f"{'':>{self.current_indent}}{first}") + if not second: + self.write("\n") + continue + if term_len(first) <= first_col - col_spacing: + self.write(" " * (first_col - term_len(first))) + else: + self.write("\n") + self.write(" " * (first_col + self.current_indent)) + + text_width = max(self.width - first_col - 2, 10) + wrapped_text = wrap_text(second, text_width, preserve_paragraphs=True) + lines = wrapped_text.splitlines() + + if lines: + self.write(f"{lines[0]}\n") + + for line in lines[1:]: + self.write(f"{'':>{first_col + self.current_indent}}{line}\n") + else: + self.write("\n") + + @contextmanager + def section(self, name: str) -> t.Iterator[None]: + """Helpful context manager that writes a paragraph, a heading, + and the indents. + + :param name: the section name that is written as heading. + """ + self.write_paragraph() + self.write_heading(name) + self.indent() + try: + yield + finally: + self.dedent() + + @contextmanager + def indentation(self) -> t.Iterator[None]: + """A context manager that increases the indentation.""" + self.indent() + try: + yield + finally: + self.dedent() + + def getvalue(self) -> str: + """Returns the buffer contents.""" + return "".join(self.buffer) + + +def join_options(options: t.Sequence[str]) -> t.Tuple[str, bool]: + """Given a list of option strings this joins them in the most appropriate + way and returns them in the form ``(formatted_string, + any_prefix_is_slash)`` where the second item in the tuple is a flag that + indicates if any of the option prefixes was a slash. + """ + rv = [] + any_prefix_is_slash = False + + for opt in options: + prefix = split_opt(opt)[0] + + if prefix == "/": + any_prefix_is_slash = True + + rv.append((len(prefix), opt)) + + rv.sort(key=lambda x: x[0]) + return ", ".join(x[1] for x in rv), any_prefix_is_slash diff --git a/billinglayer/python/click/globals.py b/billinglayer/python/click/globals.py new file mode 100644 index 0000000..480058f --- /dev/null +++ b/billinglayer/python/click/globals.py @@ -0,0 +1,68 @@ +import typing as t +from threading import local + +if t.TYPE_CHECKING: + import typing_extensions as te + from .core import Context + +_local = local() + + +@t.overload +def get_current_context(silent: "te.Literal[False]" = False) -> "Context": + ... + + +@t.overload +def get_current_context(silent: bool = ...) -> t.Optional["Context"]: + ... + + +def get_current_context(silent: bool = False) -> t.Optional["Context"]: + """Returns the current click context. This can be used as a way to + access the current context object from anywhere. This is a more implicit + alternative to the :func:`pass_context` decorator. This function is + primarily useful for helpers such as :func:`echo` which might be + interested in changing its behavior based on the current context. + + To push the current context, :meth:`Context.scope` can be used. + + .. versionadded:: 5.0 + + :param silent: if set to `True` the return value is `None` if no context + is available. The default behavior is to raise a + :exc:`RuntimeError`. + """ + try: + return t.cast("Context", _local.stack[-1]) + except (AttributeError, IndexError) as e: + if not silent: + raise RuntimeError("There is no active click context.") from e + + return None + + +def push_context(ctx: "Context") -> None: + """Pushes a new context to the current stack.""" + _local.__dict__.setdefault("stack", []).append(ctx) + + +def pop_context() -> None: + """Removes the top level from the stack.""" + _local.stack.pop() + + +def resolve_color_default(color: t.Optional[bool] = None) -> t.Optional[bool]: + """Internal helper to get the default value of the color flag. If a + value is passed it's returned unchanged, otherwise it's looked up from + the current context. + """ + if color is not None: + return color + + ctx = get_current_context(silent=True) + + if ctx is not None: + return ctx.color + + return None diff --git a/billinglayer/python/click/parser.py b/billinglayer/python/click/parser.py new file mode 100644 index 0000000..5fa7adf --- /dev/null +++ b/billinglayer/python/click/parser.py @@ -0,0 +1,529 @@ +""" +This module started out as largely a copy paste from the stdlib's +optparse module with the features removed that we do not need from +optparse because we implement them in Click on a higher level (for +instance type handling, help formatting and a lot more). + +The plan is to remove more and more from here over time. + +The reason this is a different module and not optparse from the stdlib +is that there are differences in 2.x and 3.x about the error messages +generated and optparse in the stdlib uses gettext for no good reason +and might cause us issues. + +Click uses parts of optparse written by Gregory P. Ward and maintained +by the Python Software Foundation. This is limited to code in parser.py. + +Copyright 2001-2006 Gregory P. Ward. All rights reserved. +Copyright 2002-2006 Python Software Foundation. All rights reserved. +""" +# This code uses parts of optparse written by Gregory P. Ward and +# maintained by the Python Software Foundation. +# Copyright 2001-2006 Gregory P. Ward +# Copyright 2002-2006 Python Software Foundation +import typing as t +from collections import deque +from gettext import gettext as _ +from gettext import ngettext + +from .exceptions import BadArgumentUsage +from .exceptions import BadOptionUsage +from .exceptions import NoSuchOption +from .exceptions import UsageError + +if t.TYPE_CHECKING: + import typing_extensions as te + from .core import Argument as CoreArgument + from .core import Context + from .core import Option as CoreOption + from .core import Parameter as CoreParameter + +V = t.TypeVar("V") + +# Sentinel value that indicates an option was passed as a flag without a +# value but is not a flag option. Option.consume_value uses this to +# prompt or use the flag_value. +_flag_needs_value = object() + + +def _unpack_args( + args: t.Sequence[str], nargs_spec: t.Sequence[int] +) -> t.Tuple[t.Sequence[t.Union[str, t.Sequence[t.Optional[str]], None]], t.List[str]]: + """Given an iterable of arguments and an iterable of nargs specifications, + it returns a tuple with all the unpacked arguments at the first index + and all remaining arguments as the second. + + The nargs specification is the number of arguments that should be consumed + or `-1` to indicate that this position should eat up all the remainders. + + Missing items are filled with `None`. + """ + args = deque(args) + nargs_spec = deque(nargs_spec) + rv: t.List[t.Union[str, t.Tuple[t.Optional[str], ...], None]] = [] + spos: t.Optional[int] = None + + def _fetch(c: "te.Deque[V]") -> t.Optional[V]: + try: + if spos is None: + return c.popleft() + else: + return c.pop() + except IndexError: + return None + + while nargs_spec: + nargs = _fetch(nargs_spec) + + if nargs is None: + continue + + if nargs == 1: + rv.append(_fetch(args)) + elif nargs > 1: + x = [_fetch(args) for _ in range(nargs)] + + # If we're reversed, we're pulling in the arguments in reverse, + # so we need to turn them around. + if spos is not None: + x.reverse() + + rv.append(tuple(x)) + elif nargs < 0: + if spos is not None: + raise TypeError("Cannot have two nargs < 0") + + spos = len(rv) + rv.append(None) + + # spos is the position of the wildcard (star). If it's not `None`, + # we fill it with the remainder. + if spos is not None: + rv[spos] = tuple(args) + args = [] + rv[spos + 1 :] = reversed(rv[spos + 1 :]) + + return tuple(rv), list(args) + + +def split_opt(opt: str) -> t.Tuple[str, str]: + first = opt[:1] + if first.isalnum(): + return "", opt + if opt[1:2] == first: + return opt[:2], opt[2:] + return first, opt[1:] + + +def normalize_opt(opt: str, ctx: t.Optional["Context"]) -> str: + if ctx is None or ctx.token_normalize_func is None: + return opt + prefix, opt = split_opt(opt) + return f"{prefix}{ctx.token_normalize_func(opt)}" + + +def split_arg_string(string: str) -> t.List[str]: + """Split an argument string as with :func:`shlex.split`, but don't + fail if the string is incomplete. Ignores a missing closing quote or + incomplete escape sequence and uses the partial token as-is. + + .. code-block:: python + + split_arg_string("example 'my file") + ["example", "my file"] + + split_arg_string("example my\\") + ["example", "my"] + + :param string: String to split. + """ + import shlex + + lex = shlex.shlex(string, posix=True) + lex.whitespace_split = True + lex.commenters = "" + out = [] + + try: + for token in lex: + out.append(token) + except ValueError: + # Raised when end-of-string is reached in an invalid state. Use + # the partial token as-is. The quote or escape character is in + # lex.state, not lex.token. + out.append(lex.token) + + return out + + +class Option: + def __init__( + self, + obj: "CoreOption", + opts: t.Sequence[str], + dest: t.Optional[str], + action: t.Optional[str] = None, + nargs: int = 1, + const: t.Optional[t.Any] = None, + ): + self._short_opts = [] + self._long_opts = [] + self.prefixes: t.Set[str] = set() + + for opt in opts: + prefix, value = split_opt(opt) + if not prefix: + raise ValueError(f"Invalid start character for option ({opt})") + self.prefixes.add(prefix[0]) + if len(prefix) == 1 and len(value) == 1: + self._short_opts.append(opt) + else: + self._long_opts.append(opt) + self.prefixes.add(prefix) + + if action is None: + action = "store" + + self.dest = dest + self.action = action + self.nargs = nargs + self.const = const + self.obj = obj + + @property + def takes_value(self) -> bool: + return self.action in ("store", "append") + + def process(self, value: t.Any, state: "ParsingState") -> None: + if self.action == "store": + state.opts[self.dest] = value # type: ignore + elif self.action == "store_const": + state.opts[self.dest] = self.const # type: ignore + elif self.action == "append": + state.opts.setdefault(self.dest, []).append(value) # type: ignore + elif self.action == "append_const": + state.opts.setdefault(self.dest, []).append(self.const) # type: ignore + elif self.action == "count": + state.opts[self.dest] = state.opts.get(self.dest, 0) + 1 # type: ignore + else: + raise ValueError(f"unknown action '{self.action}'") + state.order.append(self.obj) + + +class Argument: + def __init__(self, obj: "CoreArgument", dest: t.Optional[str], nargs: int = 1): + self.dest = dest + self.nargs = nargs + self.obj = obj + + def process( + self, + value: t.Union[t.Optional[str], t.Sequence[t.Optional[str]]], + state: "ParsingState", + ) -> None: + if self.nargs > 1: + assert value is not None + holes = sum(1 for x in value if x is None) + if holes == len(value): + value = None + elif holes != 0: + raise BadArgumentUsage( + _("Argument {name!r} takes {nargs} values.").format( + name=self.dest, nargs=self.nargs + ) + ) + + if self.nargs == -1 and self.obj.envvar is not None and value == (): + # Replace empty tuple with None so that a value from the + # environment may be tried. + value = None + + state.opts[self.dest] = value # type: ignore + state.order.append(self.obj) + + +class ParsingState: + def __init__(self, rargs: t.List[str]) -> None: + self.opts: t.Dict[str, t.Any] = {} + self.largs: t.List[str] = [] + self.rargs = rargs + self.order: t.List["CoreParameter"] = [] + + +class OptionParser: + """The option parser is an internal class that is ultimately used to + parse options and arguments. It's modelled after optparse and brings + a similar but vastly simplified API. It should generally not be used + directly as the high level Click classes wrap it for you. + + It's not nearly as extensible as optparse or argparse as it does not + implement features that are implemented on a higher level (such as + types or defaults). + + :param ctx: optionally the :class:`~click.Context` where this parser + should go with. + """ + + def __init__(self, ctx: t.Optional["Context"] = None) -> None: + #: The :class:`~click.Context` for this parser. This might be + #: `None` for some advanced use cases. + self.ctx = ctx + #: This controls how the parser deals with interspersed arguments. + #: If this is set to `False`, the parser will stop on the first + #: non-option. Click uses this to implement nested subcommands + #: safely. + self.allow_interspersed_args: bool = True + #: This tells the parser how to deal with unknown options. By + #: default it will error out (which is sensible), but there is a + #: second mode where it will ignore it and continue processing + #: after shifting all the unknown options into the resulting args. + self.ignore_unknown_options: bool = False + + if ctx is not None: + self.allow_interspersed_args = ctx.allow_interspersed_args + self.ignore_unknown_options = ctx.ignore_unknown_options + + self._short_opt: t.Dict[str, Option] = {} + self._long_opt: t.Dict[str, Option] = {} + self._opt_prefixes = {"-", "--"} + self._args: t.List[Argument] = [] + + def add_option( + self, + obj: "CoreOption", + opts: t.Sequence[str], + dest: t.Optional[str], + action: t.Optional[str] = None, + nargs: int = 1, + const: t.Optional[t.Any] = None, + ) -> None: + """Adds a new option named `dest` to the parser. The destination + is not inferred (unlike with optparse) and needs to be explicitly + provided. Action can be any of ``store``, ``store_const``, + ``append``, ``append_const`` or ``count``. + + The `obj` can be used to identify the option in the order list + that is returned from the parser. + """ + opts = [normalize_opt(opt, self.ctx) for opt in opts] + option = Option(obj, opts, dest, action=action, nargs=nargs, const=const) + self._opt_prefixes.update(option.prefixes) + for opt in option._short_opts: + self._short_opt[opt] = option + for opt in option._long_opts: + self._long_opt[opt] = option + + def add_argument( + self, obj: "CoreArgument", dest: t.Optional[str], nargs: int = 1 + ) -> None: + """Adds a positional argument named `dest` to the parser. + + The `obj` can be used to identify the option in the order list + that is returned from the parser. + """ + self._args.append(Argument(obj, dest=dest, nargs=nargs)) + + def parse_args( + self, args: t.List[str] + ) -> t.Tuple[t.Dict[str, t.Any], t.List[str], t.List["CoreParameter"]]: + """Parses positional arguments and returns ``(values, args, order)`` + for the parsed options and arguments as well as the leftover + arguments if there are any. The order is a list of objects as they + appear on the command line. If arguments appear multiple times they + will be memorized multiple times as well. + """ + state = ParsingState(args) + try: + self._process_args_for_options(state) + self._process_args_for_args(state) + except UsageError: + if self.ctx is None or not self.ctx.resilient_parsing: + raise + return state.opts, state.largs, state.order + + def _process_args_for_args(self, state: ParsingState) -> None: + pargs, args = _unpack_args( + state.largs + state.rargs, [x.nargs for x in self._args] + ) + + for idx, arg in enumerate(self._args): + arg.process(pargs[idx], state) + + state.largs = args + state.rargs = [] + + def _process_args_for_options(self, state: ParsingState) -> None: + while state.rargs: + arg = state.rargs.pop(0) + arglen = len(arg) + # Double dashes always handled explicitly regardless of what + # prefixes are valid. + if arg == "--": + return + elif arg[:1] in self._opt_prefixes and arglen > 1: + self._process_opts(arg, state) + elif self.allow_interspersed_args: + state.largs.append(arg) + else: + state.rargs.insert(0, arg) + return + + # Say this is the original argument list: + # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)] + # ^ + # (we are about to process arg(i)). + # + # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of + # [arg0, ..., arg(i-1)] (any options and their arguments will have + # been removed from largs). + # + # The while loop will usually consume 1 or more arguments per pass. + # If it consumes 1 (eg. arg is an option that takes no arguments), + # then after _process_arg() is done the situation is: + # + # largs = subset of [arg0, ..., arg(i)] + # rargs = [arg(i+1), ..., arg(N-1)] + # + # If allow_interspersed_args is false, largs will always be + # *empty* -- still a subset of [arg0, ..., arg(i-1)], but + # not a very interesting subset! + + def _match_long_opt( + self, opt: str, explicit_value: t.Optional[str], state: ParsingState + ) -> None: + if opt not in self._long_opt: + from difflib import get_close_matches + + possibilities = get_close_matches(opt, self._long_opt) + raise NoSuchOption(opt, possibilities=possibilities, ctx=self.ctx) + + option = self._long_opt[opt] + if option.takes_value: + # At this point it's safe to modify rargs by injecting the + # explicit value, because no exception is raised in this + # branch. This means that the inserted value will be fully + # consumed. + if explicit_value is not None: + state.rargs.insert(0, explicit_value) + + value = self._get_value_from_state(opt, option, state) + + elif explicit_value is not None: + raise BadOptionUsage( + opt, _("Option {name!r} does not take a value.").format(name=opt) + ) + + else: + value = None + + option.process(value, state) + + def _match_short_opt(self, arg: str, state: ParsingState) -> None: + stop = False + i = 1 + prefix = arg[0] + unknown_options = [] + + for ch in arg[1:]: + opt = normalize_opt(f"{prefix}{ch}", self.ctx) + option = self._short_opt.get(opt) + i += 1 + + if not option: + if self.ignore_unknown_options: + unknown_options.append(ch) + continue + raise NoSuchOption(opt, ctx=self.ctx) + if option.takes_value: + # Any characters left in arg? Pretend they're the + # next arg, and stop consuming characters of arg. + if i < len(arg): + state.rargs.insert(0, arg[i:]) + stop = True + + value = self._get_value_from_state(opt, option, state) + + else: + value = None + + option.process(value, state) + + if stop: + break + + # If we got any unknown options we recombine the string of the + # remaining options and re-attach the prefix, then report that + # to the state as new larg. This way there is basic combinatorics + # that can be achieved while still ignoring unknown arguments. + if self.ignore_unknown_options and unknown_options: + state.largs.append(f"{prefix}{''.join(unknown_options)}") + + def _get_value_from_state( + self, option_name: str, option: Option, state: ParsingState + ) -> t.Any: + nargs = option.nargs + + if len(state.rargs) < nargs: + if option.obj._flag_needs_value: + # Option allows omitting the value. + value = _flag_needs_value + else: + raise BadOptionUsage( + option_name, + ngettext( + "Option {name!r} requires an argument.", + "Option {name!r} requires {nargs} arguments.", + nargs, + ).format(name=option_name, nargs=nargs), + ) + elif nargs == 1: + next_rarg = state.rargs[0] + + if ( + option.obj._flag_needs_value + and isinstance(next_rarg, str) + and next_rarg[:1] in self._opt_prefixes + and len(next_rarg) > 1 + ): + # The next arg looks like the start of an option, don't + # use it as the value if omitting the value is allowed. + value = _flag_needs_value + else: + value = state.rargs.pop(0) + else: + value = tuple(state.rargs[:nargs]) + del state.rargs[:nargs] + + return value + + def _process_opts(self, arg: str, state: ParsingState) -> None: + explicit_value = None + # Long option handling happens in two parts. The first part is + # supporting explicitly attached values. In any case, we will try + # to long match the option first. + if "=" in arg: + long_opt, explicit_value = arg.split("=", 1) + else: + long_opt = arg + norm_long_opt = normalize_opt(long_opt, self.ctx) + + # At this point we will match the (assumed) long option through + # the long option matching code. Note that this allows options + # like "-foo" to be matched as long options. + try: + self._match_long_opt(norm_long_opt, explicit_value, state) + except NoSuchOption: + # At this point the long option matching failed, and we need + # to try with short options. However there is a special rule + # which says, that if we have a two character options prefix + # (applies to "--foo" for instance), we do not dispatch to the + # short option code and will instead raise the no option + # error. + if arg[:2] not in self._opt_prefixes: + self._match_short_opt(arg, state) + return + + if not self.ignore_unknown_options: + raise + + state.largs.append(arg) diff --git a/billinglayer/python/click/py.typed b/billinglayer/python/click/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/click/shell_completion.py b/billinglayer/python/click/shell_completion.py new file mode 100644 index 0000000..dc9e00b --- /dev/null +++ b/billinglayer/python/click/shell_completion.py @@ -0,0 +1,596 @@ +import os +import re +import typing as t +from gettext import gettext as _ + +from .core import Argument +from .core import BaseCommand +from .core import Context +from .core import MultiCommand +from .core import Option +from .core import Parameter +from .core import ParameterSource +from .parser import split_arg_string +from .utils import echo + + +def shell_complete( + cli: BaseCommand, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + complete_var: str, + instruction: str, +) -> int: + """Perform shell completion for the given CLI program. + + :param cli: Command being called. + :param ctx_args: Extra arguments to pass to + ``cli.make_context``. + :param prog_name: Name of the executable in the shell. + :param complete_var: Name of the environment variable that holds + the completion instruction. + :param instruction: Value of ``complete_var`` with the completion + instruction and shell, in the form ``instruction_shell``. + :return: Status code to exit with. + """ + shell, _, instruction = instruction.partition("_") + comp_cls = get_completion_class(shell) + + if comp_cls is None: + return 1 + + comp = comp_cls(cli, ctx_args, prog_name, complete_var) + + if instruction == "source": + echo(comp.source()) + return 0 + + if instruction == "complete": + echo(comp.complete()) + return 0 + + return 1 + + +class CompletionItem: + """Represents a completion value and metadata about the value. The + default metadata is ``type`` to indicate special shell handling, + and ``help`` if a shell supports showing a help string next to the + value. + + Arbitrary parameters can be passed when creating the object, and + accessed using ``item.attr``. If an attribute wasn't passed, + accessing it returns ``None``. + + :param value: The completion suggestion. + :param type: Tells the shell script to provide special completion + support for the type. Click uses ``"dir"`` and ``"file"``. + :param help: String shown next to the value if supported. + :param kwargs: Arbitrary metadata. The built-in implementations + don't use this, but custom type completions paired with custom + shell support could use it. + """ + + __slots__ = ("value", "type", "help", "_info") + + def __init__( + self, + value: t.Any, + type: str = "plain", + help: t.Optional[str] = None, + **kwargs: t.Any, + ) -> None: + self.value: t.Any = value + self.type: str = type + self.help: t.Optional[str] = help + self._info = kwargs + + def __getattr__(self, name: str) -> t.Any: + return self._info.get(name) + + +# Only Bash >= 4.4 has the nosort option. +_SOURCE_BASH = """\ +%(complete_func)s() { + local IFS=$'\\n' + local response + + response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD \ +%(complete_var)s=bash_complete $1) + + for completion in $response; do + IFS=',' read type value <<< "$completion" + + if [[ $type == 'dir' ]]; then + COMPREPLY=() + compopt -o dirnames + elif [[ $type == 'file' ]]; then + COMPREPLY=() + compopt -o default + elif [[ $type == 'plain' ]]; then + COMPREPLY+=($value) + fi + done + + return 0 +} + +%(complete_func)s_setup() { + complete -o nosort -F %(complete_func)s %(prog_name)s +} + +%(complete_func)s_setup; +""" + +_SOURCE_ZSH = """\ +#compdef %(prog_name)s + +%(complete_func)s() { + local -a completions + local -a completions_with_descriptions + local -a response + (( ! $+commands[%(prog_name)s] )) && return 1 + + response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) \ +%(complete_var)s=zsh_complete %(prog_name)s)}") + + for type key descr in ${response}; do + if [[ "$type" == "plain" ]]; then + if [[ "$descr" == "_" ]]; then + completions+=("$key") + else + completions_with_descriptions+=("$key":"$descr") + fi + elif [[ "$type" == "dir" ]]; then + _path_files -/ + elif [[ "$type" == "file" ]]; then + _path_files -f + fi + done + + if [ -n "$completions_with_descriptions" ]; then + _describe -V unsorted completions_with_descriptions -U + fi + + if [ -n "$completions" ]; then + compadd -U -V unsorted -a completions + fi +} + +if [[ $zsh_eval_context[-1] == loadautofunc ]]; then + # autoload from fpath, call function directly + %(complete_func)s "$@" +else + # eval/source/. command, register function for later + compdef %(complete_func)s %(prog_name)s +fi +""" + +_SOURCE_FISH = """\ +function %(complete_func)s; + set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) \ +COMP_CWORD=(commandline -t) %(prog_name)s); + + for completion in $response; + set -l metadata (string split "," $completion); + + if test $metadata[1] = "dir"; + __fish_complete_directories $metadata[2]; + else if test $metadata[1] = "file"; + __fish_complete_path $metadata[2]; + else if test $metadata[1] = "plain"; + echo $metadata[2]; + end; + end; +end; + +complete --no-files --command %(prog_name)s --arguments \ +"(%(complete_func)s)"; +""" + + +class ShellComplete: + """Base class for providing shell completion support. A subclass for + a given shell will override attributes and methods to implement the + completion instructions (``source`` and ``complete``). + + :param cli: Command being called. + :param prog_name: Name of the executable in the shell. + :param complete_var: Name of the environment variable that holds + the completion instruction. + + .. versionadded:: 8.0 + """ + + name: t.ClassVar[str] + """Name to register the shell as with :func:`add_completion_class`. + This is used in completion instructions (``{name}_source`` and + ``{name}_complete``). + """ + + source_template: t.ClassVar[str] + """Completion script template formatted by :meth:`source`. This must + be provided by subclasses. + """ + + def __init__( + self, + cli: BaseCommand, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + complete_var: str, + ) -> None: + self.cli = cli + self.ctx_args = ctx_args + self.prog_name = prog_name + self.complete_var = complete_var + + @property + def func_name(self) -> str: + """The name of the shell function defined by the completion + script. + """ + safe_name = re.sub(r"\W*", "", self.prog_name.replace("-", "_"), flags=re.ASCII) + return f"_{safe_name}_completion" + + def source_vars(self) -> t.Dict[str, t.Any]: + """Vars for formatting :attr:`source_template`. + + By default this provides ``complete_func``, ``complete_var``, + and ``prog_name``. + """ + return { + "complete_func": self.func_name, + "complete_var": self.complete_var, + "prog_name": self.prog_name, + } + + def source(self) -> str: + """Produce the shell script that defines the completion + function. By default this ``%``-style formats + :attr:`source_template` with the dict returned by + :meth:`source_vars`. + """ + return self.source_template % self.source_vars() + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + """Use the env vars defined by the shell script to return a + tuple of ``args, incomplete``. This must be implemented by + subclasses. + """ + raise NotImplementedError + + def get_completions( + self, args: t.List[str], incomplete: str + ) -> t.List[CompletionItem]: + """Determine the context and last complete command or parameter + from the complete args. Call that object's ``shell_complete`` + method to get the completions for the incomplete value. + + :param args: List of complete args before the incomplete value. + :param incomplete: Value being completed. May be empty. + """ + ctx = _resolve_context(self.cli, self.ctx_args, self.prog_name, args) + obj, incomplete = _resolve_incomplete(ctx, args, incomplete) + return obj.shell_complete(ctx, incomplete) + + def format_completion(self, item: CompletionItem) -> str: + """Format a completion item into the form recognized by the + shell script. This must be implemented by subclasses. + + :param item: Completion item to format. + """ + raise NotImplementedError + + def complete(self) -> str: + """Produce the completion data to send back to the shell. + + By default this calls :meth:`get_completion_args`, gets the + completions, then calls :meth:`format_completion` for each + completion. + """ + args, incomplete = self.get_completion_args() + completions = self.get_completions(args, incomplete) + out = [self.format_completion(item) for item in completions] + return "\n".join(out) + + +class BashComplete(ShellComplete): + """Shell completion for Bash.""" + + name = "bash" + source_template = _SOURCE_BASH + + @staticmethod + def _check_version() -> None: + import subprocess + + output = subprocess.run( + ["bash", "-c", 'echo "${BASH_VERSION}"'], stdout=subprocess.PIPE + ) + match = re.search(r"^(\d+)\.(\d+)\.\d+", output.stdout.decode()) + + if match is not None: + major, minor = match.groups() + + if major < "4" or major == "4" and minor < "4": + echo( + _( + "Shell completion is not supported for Bash" + " versions older than 4.4." + ), + err=True, + ) + else: + echo( + _("Couldn't detect Bash version, shell completion is not supported."), + err=True, + ) + + def source(self) -> str: + self._check_version() + return super().source() + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + cwords = split_arg_string(os.environ["COMP_WORDS"]) + cword = int(os.environ["COMP_CWORD"]) + args = cwords[1:cword] + + try: + incomplete = cwords[cword] + except IndexError: + incomplete = "" + + return args, incomplete + + def format_completion(self, item: CompletionItem) -> str: + return f"{item.type},{item.value}" + + +class ZshComplete(ShellComplete): + """Shell completion for Zsh.""" + + name = "zsh" + source_template = _SOURCE_ZSH + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + cwords = split_arg_string(os.environ["COMP_WORDS"]) + cword = int(os.environ["COMP_CWORD"]) + args = cwords[1:cword] + + try: + incomplete = cwords[cword] + except IndexError: + incomplete = "" + + return args, incomplete + + def format_completion(self, item: CompletionItem) -> str: + return f"{item.type}\n{item.value}\n{item.help if item.help else '_'}" + + +class FishComplete(ShellComplete): + """Shell completion for Fish.""" + + name = "fish" + source_template = _SOURCE_FISH + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + cwords = split_arg_string(os.environ["COMP_WORDS"]) + incomplete = os.environ["COMP_CWORD"] + args = cwords[1:] + + # Fish stores the partial word in both COMP_WORDS and + # COMP_CWORD, remove it from complete args. + if incomplete and args and args[-1] == incomplete: + args.pop() + + return args, incomplete + + def format_completion(self, item: CompletionItem) -> str: + if item.help: + return f"{item.type},{item.value}\t{item.help}" + + return f"{item.type},{item.value}" + + +ShellCompleteType = t.TypeVar("ShellCompleteType", bound=t.Type[ShellComplete]) + + +_available_shells: t.Dict[str, t.Type[ShellComplete]] = { + "bash": BashComplete, + "fish": FishComplete, + "zsh": ZshComplete, +} + + +def add_completion_class( + cls: ShellCompleteType, name: t.Optional[str] = None +) -> ShellCompleteType: + """Register a :class:`ShellComplete` subclass under the given name. + The name will be provided by the completion instruction environment + variable during completion. + + :param cls: The completion class that will handle completion for the + shell. + :param name: Name to register the class under. Defaults to the + class's ``name`` attribute. + """ + if name is None: + name = cls.name + + _available_shells[name] = cls + + return cls + + +def get_completion_class(shell: str) -> t.Optional[t.Type[ShellComplete]]: + """Look up a registered :class:`ShellComplete` subclass by the name + provided by the completion instruction environment variable. If the + name isn't registered, returns ``None``. + + :param shell: Name the class is registered under. + """ + return _available_shells.get(shell) + + +def _is_incomplete_argument(ctx: Context, param: Parameter) -> bool: + """Determine if the given parameter is an argument that can still + accept values. + + :param ctx: Invocation context for the command represented by the + parsed complete args. + :param param: Argument object being checked. + """ + if not isinstance(param, Argument): + return False + + assert param.name is not None + # Will be None if expose_value is False. + value = ctx.params.get(param.name) + return ( + param.nargs == -1 + or ctx.get_parameter_source(param.name) is not ParameterSource.COMMANDLINE + or ( + param.nargs > 1 + and isinstance(value, (tuple, list)) + and len(value) < param.nargs + ) + ) + + +def _start_of_option(ctx: Context, value: str) -> bool: + """Check if the value looks like the start of an option.""" + if not value: + return False + + c = value[0] + return c in ctx._opt_prefixes + + +def _is_incomplete_option(ctx: Context, args: t.List[str], param: Parameter) -> bool: + """Determine if the given parameter is an option that needs a value. + + :param args: List of complete args before the incomplete value. + :param param: Option object being checked. + """ + if not isinstance(param, Option): + return False + + if param.is_flag or param.count: + return False + + last_option = None + + for index, arg in enumerate(reversed(args)): + if index + 1 > param.nargs: + break + + if _start_of_option(ctx, arg): + last_option = arg + + return last_option is not None and last_option in param.opts + + +def _resolve_context( + cli: BaseCommand, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + args: t.List[str], +) -> Context: + """Produce the context hierarchy starting with the command and + traversing the complete arguments. This only follows the commands, + it doesn't trigger input prompts or callbacks. + + :param cli: Command being called. + :param prog_name: Name of the executable in the shell. + :param args: List of complete args before the incomplete value. + """ + ctx_args["resilient_parsing"] = True + ctx = cli.make_context(prog_name, args.copy(), **ctx_args) + args = ctx.protected_args + ctx.args + + while args: + command = ctx.command + + if isinstance(command, MultiCommand): + if not command.chain: + name, cmd, args = command.resolve_command(ctx, args) + + if cmd is None: + return ctx + + ctx = cmd.make_context(name, args, parent=ctx, resilient_parsing=True) + args = ctx.protected_args + ctx.args + else: + sub_ctx = ctx + + while args: + name, cmd, args = command.resolve_command(ctx, args) + + if cmd is None: + return ctx + + sub_ctx = cmd.make_context( + name, + args, + parent=ctx, + allow_extra_args=True, + allow_interspersed_args=False, + resilient_parsing=True, + ) + args = sub_ctx.args + + ctx = sub_ctx + args = [*sub_ctx.protected_args, *sub_ctx.args] + else: + break + + return ctx + + +def _resolve_incomplete( + ctx: Context, args: t.List[str], incomplete: str +) -> t.Tuple[t.Union[BaseCommand, Parameter], str]: + """Find the Click object that will handle the completion of the + incomplete value. Return the object and the incomplete value. + + :param ctx: Invocation context for the command represented by + the parsed complete args. + :param args: List of complete args before the incomplete value. + :param incomplete: Value being completed. May be empty. + """ + # Different shells treat an "=" between a long option name and + # value differently. Might keep the value joined, return the "=" + # as a separate item, or return the split name and value. Always + # split and discard the "=" to make completion easier. + if incomplete == "=": + incomplete = "" + elif "=" in incomplete and _start_of_option(ctx, incomplete): + name, _, incomplete = incomplete.partition("=") + args.append(name) + + # The "--" marker tells Click to stop treating values as options + # even if they start with the option character. If it hasn't been + # given and the incomplete arg looks like an option, the current + # command will provide option name completions. + if "--" not in args and _start_of_option(ctx, incomplete): + return ctx.command, incomplete + + params = ctx.command.get_params(ctx) + + # If the last complete arg is an option name with an incomplete + # value, the option will provide value completions. + for param in params: + if _is_incomplete_option(ctx, args, param): + return param, incomplete + + # It's not an option name or value. The first argument without a + # parsed value will provide value completions. + for param in params: + if _is_incomplete_argument(ctx, param): + return param, incomplete + + # There were no unparsed arguments, the command may be a group that + # will provide command name completions. + return ctx.command, incomplete diff --git a/billinglayer/python/click/termui.py b/billinglayer/python/click/termui.py new file mode 100644 index 0000000..db7a4b2 --- /dev/null +++ b/billinglayer/python/click/termui.py @@ -0,0 +1,784 @@ +import inspect +import io +import itertools +import sys +import typing as t +from gettext import gettext as _ + +from ._compat import isatty +from ._compat import strip_ansi +from .exceptions import Abort +from .exceptions import UsageError +from .globals import resolve_color_default +from .types import Choice +from .types import convert_type +from .types import ParamType +from .utils import echo +from .utils import LazyFile + +if t.TYPE_CHECKING: + from ._termui_impl import ProgressBar + +V = t.TypeVar("V") + +# The prompt functions to use. The doc tools currently override these +# functions to customize how they work. +visible_prompt_func: t.Callable[[str], str] = input + +_ansi_colors = { + "black": 30, + "red": 31, + "green": 32, + "yellow": 33, + "blue": 34, + "magenta": 35, + "cyan": 36, + "white": 37, + "reset": 39, + "bright_black": 90, + "bright_red": 91, + "bright_green": 92, + "bright_yellow": 93, + "bright_blue": 94, + "bright_magenta": 95, + "bright_cyan": 96, + "bright_white": 97, +} +_ansi_reset_all = "\033[0m" + + +def hidden_prompt_func(prompt: str) -> str: + import getpass + + return getpass.getpass(prompt) + + +def _build_prompt( + text: str, + suffix: str, + show_default: bool = False, + default: t.Optional[t.Any] = None, + show_choices: bool = True, + type: t.Optional[ParamType] = None, +) -> str: + prompt = text + if type is not None and show_choices and isinstance(type, Choice): + prompt += f" ({', '.join(map(str, type.choices))})" + if default is not None and show_default: + prompt = f"{prompt} [{_format_default(default)}]" + return f"{prompt}{suffix}" + + +def _format_default(default: t.Any) -> t.Any: + if isinstance(default, (io.IOBase, LazyFile)) and hasattr(default, "name"): + return default.name + + return default + + +def prompt( + text: str, + default: t.Optional[t.Any] = None, + hide_input: bool = False, + confirmation_prompt: t.Union[bool, str] = False, + type: t.Optional[t.Union[ParamType, t.Any]] = None, + value_proc: t.Optional[t.Callable[[str], t.Any]] = None, + prompt_suffix: str = ": ", + show_default: bool = True, + err: bool = False, + show_choices: bool = True, +) -> t.Any: + """Prompts a user for input. This is a convenience function that can + be used to prompt a user for input later. + + If the user aborts the input by sending an interrupt signal, this + function will catch it and raise a :exc:`Abort` exception. + + :param text: the text to show for the prompt. + :param default: the default value to use if no input happens. If this + is not given it will prompt until it's aborted. + :param hide_input: if this is set to true then the input value will + be hidden. + :param confirmation_prompt: Prompt a second time to confirm the + value. Can be set to a string instead of ``True`` to customize + the message. + :param type: the type to use to check the value against. + :param value_proc: if this parameter is provided it's a function that + is invoked instead of the type conversion to + convert a value. + :param prompt_suffix: a suffix that should be added to the prompt. + :param show_default: shows or hides the default value in the prompt. + :param err: if set to true the file defaults to ``stderr`` instead of + ``stdout``, the same as with echo. + :param show_choices: Show or hide choices if the passed type is a Choice. + For example if type is a Choice of either day or week, + show_choices is true and text is "Group by" then the + prompt will be "Group by (day, week): ". + + .. versionadded:: 8.0 + ``confirmation_prompt`` can be a custom string. + + .. versionadded:: 7.0 + Added the ``show_choices`` parameter. + + .. versionadded:: 6.0 + Added unicode support for cmd.exe on Windows. + + .. versionadded:: 4.0 + Added the `err` parameter. + + """ + + def prompt_func(text: str) -> str: + f = hidden_prompt_func if hide_input else visible_prompt_func + try: + # Write the prompt separately so that we get nice + # coloring through colorama on Windows + echo(text.rstrip(" "), nl=False, err=err) + # Echo a space to stdout to work around an issue where + # readline causes backspace to clear the whole line. + return f(" ") + except (KeyboardInterrupt, EOFError): + # getpass doesn't print a newline if the user aborts input with ^C. + # Allegedly this behavior is inherited from getpass(3). + # A doc bug has been filed at https://bugs.python.org/issue24711 + if hide_input: + echo(None, err=err) + raise Abort() from None + + if value_proc is None: + value_proc = convert_type(type, default) + + prompt = _build_prompt( + text, prompt_suffix, show_default, default, show_choices, type + ) + + if confirmation_prompt: + if confirmation_prompt is True: + confirmation_prompt = _("Repeat for confirmation") + + confirmation_prompt = _build_prompt(confirmation_prompt, prompt_suffix) + + while True: + while True: + value = prompt_func(prompt) + if value: + break + elif default is not None: + value = default + break + try: + result = value_proc(value) + except UsageError as e: + if hide_input: + echo(_("Error: The value you entered was invalid."), err=err) + else: + echo(_("Error: {e.message}").format(e=e), err=err) # noqa: B306 + continue + if not confirmation_prompt: + return result + while True: + value2 = prompt_func(confirmation_prompt) + is_empty = not value and not value2 + if value2 or is_empty: + break + if value == value2: + return result + echo(_("Error: The two entered values do not match."), err=err) + + +def confirm( + text: str, + default: t.Optional[bool] = False, + abort: bool = False, + prompt_suffix: str = ": ", + show_default: bool = True, + err: bool = False, +) -> bool: + """Prompts for confirmation (yes/no question). + + If the user aborts the input by sending a interrupt signal this + function will catch it and raise a :exc:`Abort` exception. + + :param text: the question to ask. + :param default: The default value to use when no input is given. If + ``None``, repeat until input is given. + :param abort: if this is set to `True` a negative answer aborts the + exception by raising :exc:`Abort`. + :param prompt_suffix: a suffix that should be added to the prompt. + :param show_default: shows or hides the default value in the prompt. + :param err: if set to true the file defaults to ``stderr`` instead of + ``stdout``, the same as with echo. + + .. versionchanged:: 8.0 + Repeat until input is given if ``default`` is ``None``. + + .. versionadded:: 4.0 + Added the ``err`` parameter. + """ + prompt = _build_prompt( + text, + prompt_suffix, + show_default, + "y/n" if default is None else ("Y/n" if default else "y/N"), + ) + + while True: + try: + # Write the prompt separately so that we get nice + # coloring through colorama on Windows + echo(prompt.rstrip(" "), nl=False, err=err) + # Echo a space to stdout to work around an issue where + # readline causes backspace to clear the whole line. + value = visible_prompt_func(" ").lower().strip() + except (KeyboardInterrupt, EOFError): + raise Abort() from None + if value in ("y", "yes"): + rv = True + elif value in ("n", "no"): + rv = False + elif default is not None and value == "": + rv = default + else: + echo(_("Error: invalid input"), err=err) + continue + break + if abort and not rv: + raise Abort() + return rv + + +def echo_via_pager( + text_or_generator: t.Union[t.Iterable[str], t.Callable[[], t.Iterable[str]], str], + color: t.Optional[bool] = None, +) -> None: + """This function takes a text and shows it via an environment specific + pager on stdout. + + .. versionchanged:: 3.0 + Added the `color` flag. + + :param text_or_generator: the text to page, or alternatively, a + generator emitting the text to page. + :param color: controls if the pager supports ANSI colors or not. The + default is autodetection. + """ + color = resolve_color_default(color) + + if inspect.isgeneratorfunction(text_or_generator): + i = t.cast(t.Callable[[], t.Iterable[str]], text_or_generator)() + elif isinstance(text_or_generator, str): + i = [text_or_generator] + else: + i = iter(t.cast(t.Iterable[str], text_or_generator)) + + # convert every element of i to a text type if necessary + text_generator = (el if isinstance(el, str) else str(el) for el in i) + + from ._termui_impl import pager + + return pager(itertools.chain(text_generator, "\n"), color) + + +def progressbar( + iterable: t.Optional[t.Iterable[V]] = None, + length: t.Optional[int] = None, + label: t.Optional[str] = None, + show_eta: bool = True, + show_percent: t.Optional[bool] = None, + show_pos: bool = False, + item_show_func: t.Optional[t.Callable[[t.Optional[V]], t.Optional[str]]] = None, + fill_char: str = "#", + empty_char: str = "-", + bar_template: str = "%(label)s [%(bar)s] %(info)s", + info_sep: str = " ", + width: int = 36, + file: t.Optional[t.TextIO] = None, + color: t.Optional[bool] = None, + update_min_steps: int = 1, +) -> "ProgressBar[V]": + """This function creates an iterable context manager that can be used + to iterate over something while showing a progress bar. It will + either iterate over the `iterable` or `length` items (that are counted + up). While iteration happens, this function will print a rendered + progress bar to the given `file` (defaults to stdout) and will attempt + to calculate remaining time and more. By default, this progress bar + will not be rendered if the file is not a terminal. + + The context manager creates the progress bar. When the context + manager is entered the progress bar is already created. With every + iteration over the progress bar, the iterable passed to the bar is + advanced and the bar is updated. When the context manager exits, + a newline is printed and the progress bar is finalized on screen. + + Note: The progress bar is currently designed for use cases where the + total progress can be expected to take at least several seconds. + Because of this, the ProgressBar class object won't display + progress that is considered too fast, and progress where the time + between steps is less than a second. + + No printing must happen or the progress bar will be unintentionally + destroyed. + + Example usage:: + + with progressbar(items) as bar: + for item in bar: + do_something_with(item) + + Alternatively, if no iterable is specified, one can manually update the + progress bar through the `update()` method instead of directly + iterating over the progress bar. The update method accepts the number + of steps to increment the bar with:: + + with progressbar(length=chunks.total_bytes) as bar: + for chunk in chunks: + process_chunk(chunk) + bar.update(chunks.bytes) + + The ``update()`` method also takes an optional value specifying the + ``current_item`` at the new position. This is useful when used + together with ``item_show_func`` to customize the output for each + manual step:: + + with click.progressbar( + length=total_size, + label='Unzipping archive', + item_show_func=lambda a: a.filename + ) as bar: + for archive in zip_file: + archive.extract() + bar.update(archive.size, archive) + + :param iterable: an iterable to iterate over. If not provided the length + is required. + :param length: the number of items to iterate over. By default the + progressbar will attempt to ask the iterator about its + length, which might or might not work. If an iterable is + also provided this parameter can be used to override the + length. If an iterable is not provided the progress bar + will iterate over a range of that length. + :param label: the label to show next to the progress bar. + :param show_eta: enables or disables the estimated time display. This is + automatically disabled if the length cannot be + determined. + :param show_percent: enables or disables the percentage display. The + default is `True` if the iterable has a length or + `False` if not. + :param show_pos: enables or disables the absolute position display. The + default is `False`. + :param item_show_func: A function called with the current item which + can return a string to show next to the progress bar. If the + function returns ``None`` nothing is shown. The current item can + be ``None``, such as when entering and exiting the bar. + :param fill_char: the character to use to show the filled part of the + progress bar. + :param empty_char: the character to use to show the non-filled part of + the progress bar. + :param bar_template: the format string to use as template for the bar. + The parameters in it are ``label`` for the label, + ``bar`` for the progress bar and ``info`` for the + info section. + :param info_sep: the separator between multiple info items (eta etc.) + :param width: the width of the progress bar in characters, 0 means full + terminal width + :param file: The file to write to. If this is not a terminal then + only the label is printed. + :param color: controls if the terminal supports ANSI colors or not. The + default is autodetection. This is only needed if ANSI + codes are included anywhere in the progress bar output + which is not the case by default. + :param update_min_steps: Render only when this many updates have + completed. This allows tuning for very fast iterators. + + .. versionchanged:: 8.0 + Output is shown even if execution time is less than 0.5 seconds. + + .. versionchanged:: 8.0 + ``item_show_func`` shows the current item, not the previous one. + + .. versionchanged:: 8.0 + Labels are echoed if the output is not a TTY. Reverts a change + in 7.0 that removed all output. + + .. versionadded:: 8.0 + Added the ``update_min_steps`` parameter. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. Added the ``update`` method to + the object. + + .. versionadded:: 2.0 + """ + from ._termui_impl import ProgressBar + + color = resolve_color_default(color) + return ProgressBar( + iterable=iterable, + length=length, + show_eta=show_eta, + show_percent=show_percent, + show_pos=show_pos, + item_show_func=item_show_func, + fill_char=fill_char, + empty_char=empty_char, + bar_template=bar_template, + info_sep=info_sep, + file=file, + label=label, + width=width, + color=color, + update_min_steps=update_min_steps, + ) + + +def clear() -> None: + """Clears the terminal screen. This will have the effect of clearing + the whole visible space of the terminal and moving the cursor to the + top left. This does not do anything if not connected to a terminal. + + .. versionadded:: 2.0 + """ + if not isatty(sys.stdout): + return + + # ANSI escape \033[2J clears the screen, \033[1;1H moves the cursor + echo("\033[2J\033[1;1H", nl=False) + + +def _interpret_color( + color: t.Union[int, t.Tuple[int, int, int], str], offset: int = 0 +) -> str: + if isinstance(color, int): + return f"{38 + offset};5;{color:d}" + + if isinstance(color, (tuple, list)): + r, g, b = color + return f"{38 + offset};2;{r:d};{g:d};{b:d}" + + return str(_ansi_colors[color] + offset) + + +def style( + text: t.Any, + fg: t.Optional[t.Union[int, t.Tuple[int, int, int], str]] = None, + bg: t.Optional[t.Union[int, t.Tuple[int, int, int], str]] = None, + bold: t.Optional[bool] = None, + dim: t.Optional[bool] = None, + underline: t.Optional[bool] = None, + overline: t.Optional[bool] = None, + italic: t.Optional[bool] = None, + blink: t.Optional[bool] = None, + reverse: t.Optional[bool] = None, + strikethrough: t.Optional[bool] = None, + reset: bool = True, +) -> str: + """Styles a text with ANSI styles and returns the new string. By + default the styling is self contained which means that at the end + of the string a reset code is issued. This can be prevented by + passing ``reset=False``. + + Examples:: + + click.echo(click.style('Hello World!', fg='green')) + click.echo(click.style('ATTENTION!', blink=True)) + click.echo(click.style('Some things', reverse=True, fg='cyan')) + click.echo(click.style('More colors', fg=(255, 12, 128), bg=117)) + + Supported color names: + + * ``black`` (might be a gray) + * ``red`` + * ``green`` + * ``yellow`` (might be an orange) + * ``blue`` + * ``magenta`` + * ``cyan`` + * ``white`` (might be light gray) + * ``bright_black`` + * ``bright_red`` + * ``bright_green`` + * ``bright_yellow`` + * ``bright_blue`` + * ``bright_magenta`` + * ``bright_cyan`` + * ``bright_white`` + * ``reset`` (reset the color code only) + + If the terminal supports it, color may also be specified as: + + - An integer in the interval [0, 255]. The terminal must support + 8-bit/256-color mode. + - An RGB tuple of three integers in [0, 255]. The terminal must + support 24-bit/true-color mode. + + See https://en.wikipedia.org/wiki/ANSI_color and + https://gist.github.com/XVilka/8346728 for more information. + + :param text: the string to style with ansi codes. + :param fg: if provided this will become the foreground color. + :param bg: if provided this will become the background color. + :param bold: if provided this will enable or disable bold mode. + :param dim: if provided this will enable or disable dim mode. This is + badly supported. + :param underline: if provided this will enable or disable underline. + :param overline: if provided this will enable or disable overline. + :param italic: if provided this will enable or disable italic. + :param blink: if provided this will enable or disable blinking. + :param reverse: if provided this will enable or disable inverse + rendering (foreground becomes background and the + other way round). + :param strikethrough: if provided this will enable or disable + striking through text. + :param reset: by default a reset-all code is added at the end of the + string which means that styles do not carry over. This + can be disabled to compose styles. + + .. versionchanged:: 8.0 + A non-string ``message`` is converted to a string. + + .. versionchanged:: 8.0 + Added support for 256 and RGB color codes. + + .. versionchanged:: 8.0 + Added the ``strikethrough``, ``italic``, and ``overline`` + parameters. + + .. versionchanged:: 7.0 + Added support for bright colors. + + .. versionadded:: 2.0 + """ + if not isinstance(text, str): + text = str(text) + + bits = [] + + if fg: + try: + bits.append(f"\033[{_interpret_color(fg)}m") + except KeyError: + raise TypeError(f"Unknown color {fg!r}") from None + + if bg: + try: + bits.append(f"\033[{_interpret_color(bg, 10)}m") + except KeyError: + raise TypeError(f"Unknown color {bg!r}") from None + + if bold is not None: + bits.append(f"\033[{1 if bold else 22}m") + if dim is not None: + bits.append(f"\033[{2 if dim else 22}m") + if underline is not None: + bits.append(f"\033[{4 if underline else 24}m") + if overline is not None: + bits.append(f"\033[{53 if overline else 55}m") + if italic is not None: + bits.append(f"\033[{3 if italic else 23}m") + if blink is not None: + bits.append(f"\033[{5 if blink else 25}m") + if reverse is not None: + bits.append(f"\033[{7 if reverse else 27}m") + if strikethrough is not None: + bits.append(f"\033[{9 if strikethrough else 29}m") + bits.append(text) + if reset: + bits.append(_ansi_reset_all) + return "".join(bits) + + +def unstyle(text: str) -> str: + """Removes ANSI styling information from a string. Usually it's not + necessary to use this function as Click's echo function will + automatically remove styling if necessary. + + .. versionadded:: 2.0 + + :param text: the text to remove style information from. + """ + return strip_ansi(text) + + +def secho( + message: t.Optional[t.Any] = None, + file: t.Optional[t.IO[t.AnyStr]] = None, + nl: bool = True, + err: bool = False, + color: t.Optional[bool] = None, + **styles: t.Any, +) -> None: + """This function combines :func:`echo` and :func:`style` into one + call. As such the following two calls are the same:: + + click.secho('Hello World!', fg='green') + click.echo(click.style('Hello World!', fg='green')) + + All keyword arguments are forwarded to the underlying functions + depending on which one they go with. + + Non-string types will be converted to :class:`str`. However, + :class:`bytes` are passed directly to :meth:`echo` without applying + style. If you want to style bytes that represent text, call + :meth:`bytes.decode` first. + + .. versionchanged:: 8.0 + A non-string ``message`` is converted to a string. Bytes are + passed through without style applied. + + .. versionadded:: 2.0 + """ + if message is not None and not isinstance(message, (bytes, bytearray)): + message = style(message, **styles) + + return echo(message, file=file, nl=nl, err=err, color=color) + + +def edit( + text: t.Optional[t.AnyStr] = None, + editor: t.Optional[str] = None, + env: t.Optional[t.Mapping[str, str]] = None, + require_save: bool = True, + extension: str = ".txt", + filename: t.Optional[str] = None, +) -> t.Optional[t.AnyStr]: + r"""Edits the given text in the defined editor. If an editor is given + (should be the full path to the executable but the regular operating + system search path is used for finding the executable) it overrides + the detected editor. Optionally, some environment variables can be + used. If the editor is closed without changes, `None` is returned. In + case a file is edited directly the return value is always `None` and + `require_save` and `extension` are ignored. + + If the editor cannot be opened a :exc:`UsageError` is raised. + + Note for Windows: to simplify cross-platform usage, the newlines are + automatically converted from POSIX to Windows and vice versa. As such, + the message here will have ``\n`` as newline markers. + + :param text: the text to edit. + :param editor: optionally the editor to use. Defaults to automatic + detection. + :param env: environment variables to forward to the editor. + :param require_save: if this is true, then not saving in the editor + will make the return value become `None`. + :param extension: the extension to tell the editor about. This defaults + to `.txt` but changing this might change syntax + highlighting. + :param filename: if provided it will edit this file instead of the + provided text contents. It will not use a temporary + file as an indirection in that case. + """ + from ._termui_impl import Editor + + ed = Editor(editor=editor, env=env, require_save=require_save, extension=extension) + + if filename is None: + return ed.edit(text) + + ed.edit_file(filename) + return None + + +def launch(url: str, wait: bool = False, locate: bool = False) -> int: + """This function launches the given URL (or filename) in the default + viewer application for this file type. If this is an executable, it + might launch the executable in a new session. The return value is + the exit code of the launched application. Usually, ``0`` indicates + success. + + Examples:: + + click.launch('https://click.palletsprojects.com/') + click.launch('/my/downloaded/file', locate=True) + + .. versionadded:: 2.0 + + :param url: URL or filename of the thing to launch. + :param wait: Wait for the program to exit before returning. This + only works if the launched program blocks. In particular, + ``xdg-open`` on Linux does not block. + :param locate: if this is set to `True` then instead of launching the + application associated with the URL it will attempt to + launch a file manager with the file located. This + might have weird effects if the URL does not point to + the filesystem. + """ + from ._termui_impl import open_url + + return open_url(url, wait=wait, locate=locate) + + +# If this is provided, getchar() calls into this instead. This is used +# for unittesting purposes. +_getchar: t.Optional[t.Callable[[bool], str]] = None + + +def getchar(echo: bool = False) -> str: + """Fetches a single character from the terminal and returns it. This + will always return a unicode character and under certain rare + circumstances this might return more than one character. The + situations which more than one character is returned is when for + whatever reason multiple characters end up in the terminal buffer or + standard input was not actually a terminal. + + Note that this will always read from the terminal, even if something + is piped into the standard input. + + Note for Windows: in rare cases when typing non-ASCII characters, this + function might wait for a second character and then return both at once. + This is because certain Unicode characters look like special-key markers. + + .. versionadded:: 2.0 + + :param echo: if set to `True`, the character read will also show up on + the terminal. The default is to not show it. + """ + global _getchar + + if _getchar is None: + from ._termui_impl import getchar as f + + _getchar = f + + return _getchar(echo) + + +def raw_terminal() -> t.ContextManager[int]: + from ._termui_impl import raw_terminal as f + + return f() + + +def pause(info: t.Optional[str] = None, err: bool = False) -> None: + """This command stops execution and waits for the user to press any + key to continue. This is similar to the Windows batch "pause" + command. If the program is not run through a terminal, this command + will instead do nothing. + + .. versionadded:: 2.0 + + .. versionadded:: 4.0 + Added the `err` parameter. + + :param info: The message to print before pausing. Defaults to + ``"Press any key to continue..."``. + :param err: if set to message goes to ``stderr`` instead of + ``stdout``, the same as with echo. + """ + if not isatty(sys.stdin) or not isatty(sys.stdout): + return + + if info is None: + info = _("Press any key to continue...") + + try: + if info: + echo(info, nl=False, err=err) + try: + getchar() + except (KeyboardInterrupt, EOFError): + pass + finally: + if info: + echo(err=err) diff --git a/billinglayer/python/click/testing.py b/billinglayer/python/click/testing.py new file mode 100644 index 0000000..e0df0d2 --- /dev/null +++ b/billinglayer/python/click/testing.py @@ -0,0 +1,479 @@ +import contextlib +import io +import os +import shlex +import shutil +import sys +import tempfile +import typing as t +from types import TracebackType + +from . import formatting +from . import termui +from . import utils +from ._compat import _find_binary_reader + +if t.TYPE_CHECKING: + from .core import BaseCommand + + +class EchoingStdin: + def __init__(self, input: t.BinaryIO, output: t.BinaryIO) -> None: + self._input = input + self._output = output + self._paused = False + + def __getattr__(self, x: str) -> t.Any: + return getattr(self._input, x) + + def _echo(self, rv: bytes) -> bytes: + if not self._paused: + self._output.write(rv) + + return rv + + def read(self, n: int = -1) -> bytes: + return self._echo(self._input.read(n)) + + def read1(self, n: int = -1) -> bytes: + return self._echo(self._input.read1(n)) # type: ignore + + def readline(self, n: int = -1) -> bytes: + return self._echo(self._input.readline(n)) + + def readlines(self) -> t.List[bytes]: + return [self._echo(x) for x in self._input.readlines()] + + def __iter__(self) -> t.Iterator[bytes]: + return iter(self._echo(x) for x in self._input) + + def __repr__(self) -> str: + return repr(self._input) + + +@contextlib.contextmanager +def _pause_echo(stream: t.Optional[EchoingStdin]) -> t.Iterator[None]: + if stream is None: + yield + else: + stream._paused = True + yield + stream._paused = False + + +class _NamedTextIOWrapper(io.TextIOWrapper): + def __init__( + self, buffer: t.BinaryIO, name: str, mode: str, **kwargs: t.Any + ) -> None: + super().__init__(buffer, **kwargs) + self._name = name + self._mode = mode + + @property + def name(self) -> str: + return self._name + + @property + def mode(self) -> str: + return self._mode + + +def make_input_stream( + input: t.Optional[t.Union[str, bytes, t.IO[t.Any]]], charset: str +) -> t.BinaryIO: + # Is already an input stream. + if hasattr(input, "read"): + rv = _find_binary_reader(t.cast(t.IO[t.Any], input)) + + if rv is not None: + return rv + + raise TypeError("Could not find binary reader for input stream.") + + if input is None: + input = b"" + elif isinstance(input, str): + input = input.encode(charset) + + return io.BytesIO(input) + + +class Result: + """Holds the captured result of an invoked CLI script.""" + + def __init__( + self, + runner: "CliRunner", + stdout_bytes: bytes, + stderr_bytes: t.Optional[bytes], + return_value: t.Any, + exit_code: int, + exception: t.Optional[BaseException], + exc_info: t.Optional[ + t.Tuple[t.Type[BaseException], BaseException, TracebackType] + ] = None, + ): + #: The runner that created the result + self.runner = runner + #: The standard output as bytes. + self.stdout_bytes = stdout_bytes + #: The standard error as bytes, or None if not available + self.stderr_bytes = stderr_bytes + #: The value returned from the invoked command. + #: + #: .. versionadded:: 8.0 + self.return_value = return_value + #: The exit code as integer. + self.exit_code = exit_code + #: The exception that happened if one did. + self.exception = exception + #: The traceback + self.exc_info = exc_info + + @property + def output(self) -> str: + """The (standard) output as unicode string.""" + return self.stdout + + @property + def stdout(self) -> str: + """The standard output as unicode string.""" + return self.stdout_bytes.decode(self.runner.charset, "replace").replace( + "\r\n", "\n" + ) + + @property + def stderr(self) -> str: + """The standard error as unicode string.""" + if self.stderr_bytes is None: + raise ValueError("stderr not separately captured") + return self.stderr_bytes.decode(self.runner.charset, "replace").replace( + "\r\n", "\n" + ) + + def __repr__(self) -> str: + exc_str = repr(self.exception) if self.exception else "okay" + return f"<{type(self).__name__} {exc_str}>" + + +class CliRunner: + """The CLI runner provides functionality to invoke a Click command line + script for unittesting purposes in a isolated environment. This only + works in single-threaded systems without any concurrency as it changes the + global interpreter state. + + :param charset: the character set for the input and output data. + :param env: a dictionary with environment variables for overriding. + :param echo_stdin: if this is set to `True`, then reading from stdin writes + to stdout. This is useful for showing examples in + some circumstances. Note that regular prompts + will automatically echo the input. + :param mix_stderr: if this is set to `False`, then stdout and stderr are + preserved as independent streams. This is useful for + Unix-philosophy apps that have predictable stdout and + noisy stderr, such that each may be measured + independently + """ + + def __init__( + self, + charset: str = "utf-8", + env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, + echo_stdin: bool = False, + mix_stderr: bool = True, + ) -> None: + self.charset = charset + self.env: t.Mapping[str, t.Optional[str]] = env or {} + self.echo_stdin = echo_stdin + self.mix_stderr = mix_stderr + + def get_default_prog_name(self, cli: "BaseCommand") -> str: + """Given a command object it will return the default program name + for it. The default is the `name` attribute or ``"root"`` if not + set. + """ + return cli.name or "root" + + def make_env( + self, overrides: t.Optional[t.Mapping[str, t.Optional[str]]] = None + ) -> t.Mapping[str, t.Optional[str]]: + """Returns the environment overrides for invoking a script.""" + rv = dict(self.env) + if overrides: + rv.update(overrides) + return rv + + @contextlib.contextmanager + def isolation( + self, + input: t.Optional[t.Union[str, bytes, t.IO[t.Any]]] = None, + env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, + color: bool = False, + ) -> t.Iterator[t.Tuple[io.BytesIO, t.Optional[io.BytesIO]]]: + """A context manager that sets up the isolation for invoking of a + command line tool. This sets up stdin with the given input data + and `os.environ` with the overrides from the given dictionary. + This also rebinds some internals in Click to be mocked (like the + prompt functionality). + + This is automatically done in the :meth:`invoke` method. + + :param input: the input stream to put into sys.stdin. + :param env: the environment overrides as dictionary. + :param color: whether the output should contain color codes. The + application can still override this explicitly. + + .. versionchanged:: 8.0 + ``stderr`` is opened with ``errors="backslashreplace"`` + instead of the default ``"strict"``. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. + """ + bytes_input = make_input_stream(input, self.charset) + echo_input = None + + old_stdin = sys.stdin + old_stdout = sys.stdout + old_stderr = sys.stderr + old_forced_width = formatting.FORCED_WIDTH + formatting.FORCED_WIDTH = 80 + + env = self.make_env(env) + + bytes_output = io.BytesIO() + + if self.echo_stdin: + bytes_input = echo_input = t.cast( + t.BinaryIO, EchoingStdin(bytes_input, bytes_output) + ) + + sys.stdin = text_input = _NamedTextIOWrapper( + bytes_input, encoding=self.charset, name="", mode="r" + ) + + if self.echo_stdin: + # Force unbuffered reads, otherwise TextIOWrapper reads a + # large chunk which is echoed early. + text_input._CHUNK_SIZE = 1 # type: ignore + + sys.stdout = _NamedTextIOWrapper( + bytes_output, encoding=self.charset, name="", mode="w" + ) + + bytes_error = None + if self.mix_stderr: + sys.stderr = sys.stdout + else: + bytes_error = io.BytesIO() + sys.stderr = _NamedTextIOWrapper( + bytes_error, + encoding=self.charset, + name="", + mode="w", + errors="backslashreplace", + ) + + @_pause_echo(echo_input) # type: ignore + def visible_input(prompt: t.Optional[str] = None) -> str: + sys.stdout.write(prompt or "") + val = text_input.readline().rstrip("\r\n") + sys.stdout.write(f"{val}\n") + sys.stdout.flush() + return val + + @_pause_echo(echo_input) # type: ignore + def hidden_input(prompt: t.Optional[str] = None) -> str: + sys.stdout.write(f"{prompt or ''}\n") + sys.stdout.flush() + return text_input.readline().rstrip("\r\n") + + @_pause_echo(echo_input) # type: ignore + def _getchar(echo: bool) -> str: + char = sys.stdin.read(1) + + if echo: + sys.stdout.write(char) + + sys.stdout.flush() + return char + + default_color = color + + def should_strip_ansi( + stream: t.Optional[t.IO[t.Any]] = None, color: t.Optional[bool] = None + ) -> bool: + if color is None: + return not default_color + return not color + + old_visible_prompt_func = termui.visible_prompt_func + old_hidden_prompt_func = termui.hidden_prompt_func + old__getchar_func = termui._getchar + old_should_strip_ansi = utils.should_strip_ansi # type: ignore + termui.visible_prompt_func = visible_input + termui.hidden_prompt_func = hidden_input + termui._getchar = _getchar + utils.should_strip_ansi = should_strip_ansi # type: ignore + + old_env = {} + try: + for key, value in env.items(): + old_env[key] = os.environ.get(key) + if value is None: + try: + del os.environ[key] + except Exception: + pass + else: + os.environ[key] = value + yield (bytes_output, bytes_error) + finally: + for key, value in old_env.items(): + if value is None: + try: + del os.environ[key] + except Exception: + pass + else: + os.environ[key] = value + sys.stdout = old_stdout + sys.stderr = old_stderr + sys.stdin = old_stdin + termui.visible_prompt_func = old_visible_prompt_func + termui.hidden_prompt_func = old_hidden_prompt_func + termui._getchar = old__getchar_func + utils.should_strip_ansi = old_should_strip_ansi # type: ignore + formatting.FORCED_WIDTH = old_forced_width + + def invoke( + self, + cli: "BaseCommand", + args: t.Optional[t.Union[str, t.Sequence[str]]] = None, + input: t.Optional[t.Union[str, bytes, t.IO[t.Any]]] = None, + env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, + catch_exceptions: bool = True, + color: bool = False, + **extra: t.Any, + ) -> Result: + """Invokes a command in an isolated environment. The arguments are + forwarded directly to the command line script, the `extra` keyword + arguments are passed to the :meth:`~clickpkg.Command.main` function of + the command. + + This returns a :class:`Result` object. + + :param cli: the command to invoke + :param args: the arguments to invoke. It may be given as an iterable + or a string. When given as string it will be interpreted + as a Unix shell command. More details at + :func:`shlex.split`. + :param input: the input data for `sys.stdin`. + :param env: the environment overrides. + :param catch_exceptions: Whether to catch any other exceptions than + ``SystemExit``. + :param extra: the keyword arguments to pass to :meth:`main`. + :param color: whether the output should contain color codes. The + application can still override this explicitly. + + .. versionchanged:: 8.0 + The result object has the ``return_value`` attribute with + the value returned from the invoked command. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. + + .. versionchanged:: 3.0 + Added the ``catch_exceptions`` parameter. + + .. versionchanged:: 3.0 + The result object has the ``exc_info`` attribute with the + traceback if available. + """ + exc_info = None + with self.isolation(input=input, env=env, color=color) as outstreams: + return_value = None + exception: t.Optional[BaseException] = None + exit_code = 0 + + if isinstance(args, str): + args = shlex.split(args) + + try: + prog_name = extra.pop("prog_name") + except KeyError: + prog_name = self.get_default_prog_name(cli) + + try: + return_value = cli.main(args=args or (), prog_name=prog_name, **extra) + except SystemExit as e: + exc_info = sys.exc_info() + e_code = t.cast(t.Optional[t.Union[int, t.Any]], e.code) + + if e_code is None: + e_code = 0 + + if e_code != 0: + exception = e + + if not isinstance(e_code, int): + sys.stdout.write(str(e_code)) + sys.stdout.write("\n") + e_code = 1 + + exit_code = e_code + + except Exception as e: + if not catch_exceptions: + raise + exception = e + exit_code = 1 + exc_info = sys.exc_info() + finally: + sys.stdout.flush() + stdout = outstreams[0].getvalue() + if self.mix_stderr: + stderr = None + else: + stderr = outstreams[1].getvalue() # type: ignore + + return Result( + runner=self, + stdout_bytes=stdout, + stderr_bytes=stderr, + return_value=return_value, + exit_code=exit_code, + exception=exception, + exc_info=exc_info, # type: ignore + ) + + @contextlib.contextmanager + def isolated_filesystem( + self, temp_dir: t.Optional[t.Union[str, "os.PathLike[str]"]] = None + ) -> t.Iterator[str]: + """A context manager that creates a temporary directory and + changes the current working directory to it. This isolates tests + that affect the contents of the CWD to prevent them from + interfering with each other. + + :param temp_dir: Create the temporary directory under this + directory. If given, the created directory is not removed + when exiting. + + .. versionchanged:: 8.0 + Added the ``temp_dir`` parameter. + """ + cwd = os.getcwd() + dt = tempfile.mkdtemp(dir=temp_dir) + os.chdir(dt) + + try: + yield dt + finally: + os.chdir(cwd) + + if temp_dir is None: + try: + shutil.rmtree(dt) + except OSError: # noqa: B014 + pass diff --git a/billinglayer/python/click/types.py b/billinglayer/python/click/types.py new file mode 100644 index 0000000..2b1d179 --- /dev/null +++ b/billinglayer/python/click/types.py @@ -0,0 +1,1089 @@ +import os +import stat +import sys +import typing as t +from datetime import datetime +from gettext import gettext as _ +from gettext import ngettext + +from ._compat import _get_argv_encoding +from ._compat import open_stream +from .exceptions import BadParameter +from .utils import format_filename +from .utils import LazyFile +from .utils import safecall + +if t.TYPE_CHECKING: + import typing_extensions as te + from .core import Context + from .core import Parameter + from .shell_completion import CompletionItem + + +class ParamType: + """Represents the type of a parameter. Validates and converts values + from the command line or Python into the correct type. + + To implement a custom type, subclass and implement at least the + following: + + - The :attr:`name` class attribute must be set. + - Calling an instance of the type with ``None`` must return + ``None``. This is already implemented by default. + - :meth:`convert` must convert string values to the correct type. + - :meth:`convert` must accept values that are already the correct + type. + - It must be able to convert a value if the ``ctx`` and ``param`` + arguments are ``None``. This can occur when converting prompt + input. + """ + + is_composite: t.ClassVar[bool] = False + arity: t.ClassVar[int] = 1 + + #: the descriptive name of this type + name: str + + #: if a list of this type is expected and the value is pulled from a + #: string environment variable, this is what splits it up. `None` + #: means any whitespace. For all parameters the general rule is that + #: whitespace splits them up. The exception are paths and files which + #: are split by ``os.path.pathsep`` by default (":" on Unix and ";" on + #: Windows). + envvar_list_splitter: t.ClassVar[t.Optional[str]] = None + + def to_info_dict(self) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. + + Use :meth:`click.Context.to_info_dict` to traverse the entire + CLI structure. + + .. versionadded:: 8.0 + """ + # The class name without the "ParamType" suffix. + param_type = type(self).__name__.partition("ParamType")[0] + param_type = param_type.partition("ParameterType")[0] + + # Custom subclasses might not remember to set a name. + if hasattr(self, "name"): + name = self.name + else: + name = param_type + + return {"param_type": param_type, "name": name} + + def __call__( + self, + value: t.Any, + param: t.Optional["Parameter"] = None, + ctx: t.Optional["Context"] = None, + ) -> t.Any: + if value is not None: + return self.convert(value, param, ctx) + + def get_metavar(self, param: "Parameter") -> t.Optional[str]: + """Returns the metavar default for this param if it provides one.""" + + def get_missing_message(self, param: "Parameter") -> t.Optional[str]: + """Optionally might return extra information about a missing + parameter. + + .. versionadded:: 2.0 + """ + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + """Convert the value to the correct type. This is not called if + the value is ``None`` (the missing value). + + This must accept string values from the command line, as well as + values that are already the correct type. It may also convert + other compatible types. + + The ``param`` and ``ctx`` arguments may be ``None`` in certain + situations, such as when converting prompt input. + + If the value cannot be converted, call :meth:`fail` with a + descriptive message. + + :param value: The value to convert. + :param param: The parameter that is using this type to convert + its value. May be ``None``. + :param ctx: The current context that arrived at this value. May + be ``None``. + """ + return value + + def split_envvar_value(self, rv: str) -> t.Sequence[str]: + """Given a value from an environment variable this splits it up + into small chunks depending on the defined envvar list splitter. + + If the splitter is set to `None`, which means that whitespace splits, + then leading and trailing whitespace is ignored. Otherwise, leading + and trailing splitters usually lead to empty items being included. + """ + return (rv or "").split(self.envvar_list_splitter) + + def fail( + self, + message: str, + param: t.Optional["Parameter"] = None, + ctx: t.Optional["Context"] = None, + ) -> "t.NoReturn": + """Helper method to fail with an invalid value message.""" + raise BadParameter(message, ctx=ctx, param=param) + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Return a list of + :class:`~click.shell_completion.CompletionItem` objects for the + incomplete value. Most types do not provide completions, but + some do, and this allows custom types to provide custom + completions as well. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + return [] + + +class CompositeParamType(ParamType): + is_composite = True + + @property + def arity(self) -> int: # type: ignore + raise NotImplementedError() + + +class FuncParamType(ParamType): + def __init__(self, func: t.Callable[[t.Any], t.Any]) -> None: + self.name: str = func.__name__ + self.func = func + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["func"] = self.func + return info_dict + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + try: + return self.func(value) + except ValueError: + try: + value = str(value) + except UnicodeError: + value = value.decode("utf-8", "replace") + + self.fail(value, param, ctx) + + +class UnprocessedParamType(ParamType): + name = "text" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + return value + + def __repr__(self) -> str: + return "UNPROCESSED" + + +class StringParamType(ParamType): + name = "text" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + if isinstance(value, bytes): + enc = _get_argv_encoding() + try: + value = value.decode(enc) + except UnicodeError: + fs_enc = sys.getfilesystemencoding() + if fs_enc != enc: + try: + value = value.decode(fs_enc) + except UnicodeError: + value = value.decode("utf-8", "replace") + else: + value = value.decode("utf-8", "replace") + return value + return str(value) + + def __repr__(self) -> str: + return "STRING" + + +class Choice(ParamType): + """The choice type allows a value to be checked against a fixed set + of supported values. All of these values have to be strings. + + You should only pass a list or tuple of choices. Other iterables + (like generators) may lead to surprising results. + + The resulting value will always be one of the originally passed choices + regardless of ``case_sensitive`` or any ``ctx.token_normalize_func`` + being specified. + + See :ref:`choice-opts` for an example. + + :param case_sensitive: Set to false to make choices case + insensitive. Defaults to true. + """ + + name = "choice" + + def __init__(self, choices: t.Sequence[str], case_sensitive: bool = True) -> None: + self.choices = choices + self.case_sensitive = case_sensitive + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["choices"] = self.choices + info_dict["case_sensitive"] = self.case_sensitive + return info_dict + + def get_metavar(self, param: "Parameter") -> str: + choices_str = "|".join(self.choices) + + # Use curly braces to indicate a required argument. + if param.required and param.param_type_name == "argument": + return f"{{{choices_str}}}" + + # Use square braces to indicate an option or optional argument. + return f"[{choices_str}]" + + def get_missing_message(self, param: "Parameter") -> str: + return _("Choose from:\n\t{choices}").format(choices=",\n\t".join(self.choices)) + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + # Match through normalization and case sensitivity + # first do token_normalize_func, then lowercase + # preserve original `value` to produce an accurate message in + # `self.fail` + normed_value = value + normed_choices = {choice: choice for choice in self.choices} + + if ctx is not None and ctx.token_normalize_func is not None: + normed_value = ctx.token_normalize_func(value) + normed_choices = { + ctx.token_normalize_func(normed_choice): original + for normed_choice, original in normed_choices.items() + } + + if not self.case_sensitive: + normed_value = normed_value.casefold() + normed_choices = { + normed_choice.casefold(): original + for normed_choice, original in normed_choices.items() + } + + if normed_value in normed_choices: + return normed_choices[normed_value] + + choices_str = ", ".join(map(repr, self.choices)) + self.fail( + ngettext( + "{value!r} is not {choice}.", + "{value!r} is not one of {choices}.", + len(self.choices), + ).format(value=value, choice=choices_str, choices=choices_str), + param, + ctx, + ) + + def __repr__(self) -> str: + return f"Choice({list(self.choices)})" + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Complete choices that start with the incomplete value. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + str_choices = map(str, self.choices) + + if self.case_sensitive: + matched = (c for c in str_choices if c.startswith(incomplete)) + else: + incomplete = incomplete.lower() + matched = (c for c in str_choices if c.lower().startswith(incomplete)) + + return [CompletionItem(c) for c in matched] + + +class DateTime(ParamType): + """The DateTime type converts date strings into `datetime` objects. + + The format strings which are checked are configurable, but default to some + common (non-timezone aware) ISO 8601 formats. + + When specifying *DateTime* formats, you should only pass a list or a tuple. + Other iterables, like generators, may lead to surprising results. + + The format strings are processed using ``datetime.strptime``, and this + consequently defines the format strings which are allowed. + + Parsing is tried using each format, in order, and the first format which + parses successfully is used. + + :param formats: A list or tuple of date format strings, in the order in + which they should be tried. Defaults to + ``'%Y-%m-%d'``, ``'%Y-%m-%dT%H:%M:%S'``, + ``'%Y-%m-%d %H:%M:%S'``. + """ + + name = "datetime" + + def __init__(self, formats: t.Optional[t.Sequence[str]] = None): + self.formats: t.Sequence[str] = formats or [ + "%Y-%m-%d", + "%Y-%m-%dT%H:%M:%S", + "%Y-%m-%d %H:%M:%S", + ] + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["formats"] = self.formats + return info_dict + + def get_metavar(self, param: "Parameter") -> str: + return f"[{'|'.join(self.formats)}]" + + def _try_to_convert_date(self, value: t.Any, format: str) -> t.Optional[datetime]: + try: + return datetime.strptime(value, format) + except ValueError: + return None + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + if isinstance(value, datetime): + return value + + for format in self.formats: + converted = self._try_to_convert_date(value, format) + + if converted is not None: + return converted + + formats_str = ", ".join(map(repr, self.formats)) + self.fail( + ngettext( + "{value!r} does not match the format {format}.", + "{value!r} does not match the formats {formats}.", + len(self.formats), + ).format(value=value, format=formats_str, formats=formats_str), + param, + ctx, + ) + + def __repr__(self) -> str: + return "DateTime" + + +class _NumberParamTypeBase(ParamType): + _number_class: t.ClassVar[t.Type[t.Any]] + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + try: + return self._number_class(value) + except ValueError: + self.fail( + _("{value!r} is not a valid {number_type}.").format( + value=value, number_type=self.name + ), + param, + ctx, + ) + + +class _NumberRangeBase(_NumberParamTypeBase): + def __init__( + self, + min: t.Optional[float] = None, + max: t.Optional[float] = None, + min_open: bool = False, + max_open: bool = False, + clamp: bool = False, + ) -> None: + self.min = min + self.max = max + self.min_open = min_open + self.max_open = max_open + self.clamp = clamp + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update( + min=self.min, + max=self.max, + min_open=self.min_open, + max_open=self.max_open, + clamp=self.clamp, + ) + return info_dict + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + import operator + + rv = super().convert(value, param, ctx) + lt_min: bool = self.min is not None and ( + operator.le if self.min_open else operator.lt + )(rv, self.min) + gt_max: bool = self.max is not None and ( + operator.ge if self.max_open else operator.gt + )(rv, self.max) + + if self.clamp: + if lt_min: + return self._clamp(self.min, 1, self.min_open) # type: ignore + + if gt_max: + return self._clamp(self.max, -1, self.max_open) # type: ignore + + if lt_min or gt_max: + self.fail( + _("{value} is not in the range {range}.").format( + value=rv, range=self._describe_range() + ), + param, + ctx, + ) + + return rv + + def _clamp(self, bound: float, dir: "te.Literal[1, -1]", open: bool) -> float: + """Find the valid value to clamp to bound in the given + direction. + + :param bound: The boundary value. + :param dir: 1 or -1 indicating the direction to move. + :param open: If true, the range does not include the bound. + """ + raise NotImplementedError + + def _describe_range(self) -> str: + """Describe the range for use in help text.""" + if self.min is None: + op = "<" if self.max_open else "<=" + return f"x{op}{self.max}" + + if self.max is None: + op = ">" if self.min_open else ">=" + return f"x{op}{self.min}" + + lop = "<" if self.min_open else "<=" + rop = "<" if self.max_open else "<=" + return f"{self.min}{lop}x{rop}{self.max}" + + def __repr__(self) -> str: + clamp = " clamped" if self.clamp else "" + return f"<{type(self).__name__} {self._describe_range()}{clamp}>" + + +class IntParamType(_NumberParamTypeBase): + name = "integer" + _number_class = int + + def __repr__(self) -> str: + return "INT" + + +class IntRange(_NumberRangeBase, IntParamType): + """Restrict an :data:`click.INT` value to a range of accepted + values. See :ref:`ranges`. + + If ``min`` or ``max`` are not passed, any value is accepted in that + direction. If ``min_open`` or ``max_open`` are enabled, the + corresponding boundary is not included in the range. + + If ``clamp`` is enabled, a value outside the range is clamped to the + boundary instead of failing. + + .. versionchanged:: 8.0 + Added the ``min_open`` and ``max_open`` parameters. + """ + + name = "integer range" + + def _clamp( # type: ignore + self, bound: int, dir: "te.Literal[1, -1]", open: bool + ) -> int: + if not open: + return bound + + return bound + dir + + +class FloatParamType(_NumberParamTypeBase): + name = "float" + _number_class = float + + def __repr__(self) -> str: + return "FLOAT" + + +class FloatRange(_NumberRangeBase, FloatParamType): + """Restrict a :data:`click.FLOAT` value to a range of accepted + values. See :ref:`ranges`. + + If ``min`` or ``max`` are not passed, any value is accepted in that + direction. If ``min_open`` or ``max_open`` are enabled, the + corresponding boundary is not included in the range. + + If ``clamp`` is enabled, a value outside the range is clamped to the + boundary instead of failing. This is not supported if either + boundary is marked ``open``. + + .. versionchanged:: 8.0 + Added the ``min_open`` and ``max_open`` parameters. + """ + + name = "float range" + + def __init__( + self, + min: t.Optional[float] = None, + max: t.Optional[float] = None, + min_open: bool = False, + max_open: bool = False, + clamp: bool = False, + ) -> None: + super().__init__( + min=min, max=max, min_open=min_open, max_open=max_open, clamp=clamp + ) + + if (min_open or max_open) and clamp: + raise TypeError("Clamping is not supported for open bounds.") + + def _clamp(self, bound: float, dir: "te.Literal[1, -1]", open: bool) -> float: + if not open: + return bound + + # Could use Python 3.9's math.nextafter here, but clamping an + # open float range doesn't seem to be particularly useful. It's + # left up to the user to write a callback to do it if needed. + raise RuntimeError("Clamping is not supported for open bounds.") + + +class BoolParamType(ParamType): + name = "boolean" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + if value in {False, True}: + return bool(value) + + norm = value.strip().lower() + + if norm in {"1", "true", "t", "yes", "y", "on"}: + return True + + if norm in {"0", "false", "f", "no", "n", "off"}: + return False + + self.fail( + _("{value!r} is not a valid boolean.").format(value=value), param, ctx + ) + + def __repr__(self) -> str: + return "BOOL" + + +class UUIDParameterType(ParamType): + name = "uuid" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + import uuid + + if isinstance(value, uuid.UUID): + return value + + value = value.strip() + + try: + return uuid.UUID(value) + except ValueError: + self.fail( + _("{value!r} is not a valid UUID.").format(value=value), param, ctx + ) + + def __repr__(self) -> str: + return "UUID" + + +class File(ParamType): + """Declares a parameter to be a file for reading or writing. The file + is automatically closed once the context tears down (after the command + finished working). + + Files can be opened for reading or writing. The special value ``-`` + indicates stdin or stdout depending on the mode. + + By default, the file is opened for reading text data, but it can also be + opened in binary mode or for writing. The encoding parameter can be used + to force a specific encoding. + + The `lazy` flag controls if the file should be opened immediately or upon + first IO. The default is to be non-lazy for standard input and output + streams as well as files opened for reading, `lazy` otherwise. When opening a + file lazily for reading, it is still opened temporarily for validation, but + will not be held open until first IO. lazy is mainly useful when opening + for writing to avoid creating the file until it is needed. + + Starting with Click 2.0, files can also be opened atomically in which + case all writes go into a separate file in the same folder and upon + completion the file will be moved over to the original location. This + is useful if a file regularly read by other users is modified. + + See :ref:`file-args` for more information. + """ + + name = "filename" + envvar_list_splitter: t.ClassVar[str] = os.path.pathsep + + def __init__( + self, + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + lazy: t.Optional[bool] = None, + atomic: bool = False, + ) -> None: + self.mode = mode + self.encoding = encoding + self.errors = errors + self.lazy = lazy + self.atomic = atomic + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update(mode=self.mode, encoding=self.encoding) + return info_dict + + def resolve_lazy_flag(self, value: "t.Union[str, os.PathLike[str]]") -> bool: + if self.lazy is not None: + return self.lazy + if os.fspath(value) == "-": + return False + elif "w" in self.mode: + return True + return False + + def convert( + self, + value: t.Union[str, "os.PathLike[str]", t.IO[t.Any]], + param: t.Optional["Parameter"], + ctx: t.Optional["Context"], + ) -> t.IO[t.Any]: + if _is_file_like(value): + return value + + value = t.cast("t.Union[str, os.PathLike[str]]", value) + + try: + lazy = self.resolve_lazy_flag(value) + + if lazy: + lf = LazyFile( + value, self.mode, self.encoding, self.errors, atomic=self.atomic + ) + + if ctx is not None: + ctx.call_on_close(lf.close_intelligently) + + return t.cast(t.IO[t.Any], lf) + + f, should_close = open_stream( + value, self.mode, self.encoding, self.errors, atomic=self.atomic + ) + + # If a context is provided, we automatically close the file + # at the end of the context execution (or flush out). If a + # context does not exist, it's the caller's responsibility to + # properly close the file. This for instance happens when the + # type is used with prompts. + if ctx is not None: + if should_close: + ctx.call_on_close(safecall(f.close)) + else: + ctx.call_on_close(safecall(f.flush)) + + return f + except OSError as e: # noqa: B014 + self.fail(f"'{format_filename(value)}': {e.strerror}", param, ctx) + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Return a special completion marker that tells the completion + system to use the shell to provide file path completions. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + return [CompletionItem(incomplete, type="file")] + + +def _is_file_like(value: t.Any) -> "te.TypeGuard[t.IO[t.Any]]": + return hasattr(value, "read") or hasattr(value, "write") + + +class Path(ParamType): + """The ``Path`` type is similar to the :class:`File` type, but + returns the filename instead of an open file. Various checks can be + enabled to validate the type of file and permissions. + + :param exists: The file or directory needs to exist for the value to + be valid. If this is not set to ``True``, and the file does not + exist, then all further checks are silently skipped. + :param file_okay: Allow a file as a value. + :param dir_okay: Allow a directory as a value. + :param readable: if true, a readable check is performed. + :param writable: if true, a writable check is performed. + :param executable: if true, an executable check is performed. + :param resolve_path: Make the value absolute and resolve any + symlinks. A ``~`` is not expanded, as this is supposed to be + done by the shell only. + :param allow_dash: Allow a single dash as a value, which indicates + a standard stream (but does not open it). Use + :func:`~click.open_file` to handle opening this value. + :param path_type: Convert the incoming path value to this type. If + ``None``, keep Python's default, which is ``str``. Useful to + convert to :class:`pathlib.Path`. + + .. versionchanged:: 8.1 + Added the ``executable`` parameter. + + .. versionchanged:: 8.0 + Allow passing ``path_type=pathlib.Path``. + + .. versionchanged:: 6.0 + Added the ``allow_dash`` parameter. + """ + + envvar_list_splitter: t.ClassVar[str] = os.path.pathsep + + def __init__( + self, + exists: bool = False, + file_okay: bool = True, + dir_okay: bool = True, + writable: bool = False, + readable: bool = True, + resolve_path: bool = False, + allow_dash: bool = False, + path_type: t.Optional[t.Type[t.Any]] = None, + executable: bool = False, + ): + self.exists = exists + self.file_okay = file_okay + self.dir_okay = dir_okay + self.readable = readable + self.writable = writable + self.executable = executable + self.resolve_path = resolve_path + self.allow_dash = allow_dash + self.type = path_type + + if self.file_okay and not self.dir_okay: + self.name: str = _("file") + elif self.dir_okay and not self.file_okay: + self.name = _("directory") + else: + self.name = _("path") + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update( + exists=self.exists, + file_okay=self.file_okay, + dir_okay=self.dir_okay, + writable=self.writable, + readable=self.readable, + allow_dash=self.allow_dash, + ) + return info_dict + + def coerce_path_result( + self, value: "t.Union[str, os.PathLike[str]]" + ) -> "t.Union[str, bytes, os.PathLike[str]]": + if self.type is not None and not isinstance(value, self.type): + if self.type is str: + return os.fsdecode(value) + elif self.type is bytes: + return os.fsencode(value) + else: + return t.cast("os.PathLike[str]", self.type(value)) + + return value + + def convert( + self, + value: "t.Union[str, os.PathLike[str]]", + param: t.Optional["Parameter"], + ctx: t.Optional["Context"], + ) -> "t.Union[str, bytes, os.PathLike[str]]": + rv = value + + is_dash = self.file_okay and self.allow_dash and rv in (b"-", "-") + + if not is_dash: + if self.resolve_path: + # os.path.realpath doesn't resolve symlinks on Windows + # until Python 3.8. Use pathlib for now. + import pathlib + + rv = os.fsdecode(pathlib.Path(rv).resolve()) + + try: + st = os.stat(rv) + except OSError: + if not self.exists: + return self.coerce_path_result(rv) + self.fail( + _("{name} {filename!r} does not exist.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if not self.file_okay and stat.S_ISREG(st.st_mode): + self.fail( + _("{name} {filename!r} is a file.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + if not self.dir_okay and stat.S_ISDIR(st.st_mode): + self.fail( + _("{name} '{filename}' is a directory.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if self.readable and not os.access(rv, os.R_OK): + self.fail( + _("{name} {filename!r} is not readable.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if self.writable and not os.access(rv, os.W_OK): + self.fail( + _("{name} {filename!r} is not writable.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if self.executable and not os.access(value, os.X_OK): + self.fail( + _("{name} {filename!r} is not executable.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + return self.coerce_path_result(rv) + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Return a special completion marker that tells the completion + system to use the shell to provide path completions for only + directories or any paths. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + type = "dir" if self.dir_okay and not self.file_okay else "file" + return [CompletionItem(incomplete, type=type)] + + +class Tuple(CompositeParamType): + """The default behavior of Click is to apply a type on a value directly. + This works well in most cases, except for when `nargs` is set to a fixed + count and different types should be used for different items. In this + case the :class:`Tuple` type can be used. This type can only be used + if `nargs` is set to a fixed number. + + For more information see :ref:`tuple-type`. + + This can be selected by using a Python tuple literal as a type. + + :param types: a list of types that should be used for the tuple items. + """ + + def __init__(self, types: t.Sequence[t.Union[t.Type[t.Any], ParamType]]) -> None: + self.types: t.Sequence[ParamType] = [convert_type(ty) for ty in types] + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["types"] = [t.to_info_dict() for t in self.types] + return info_dict + + @property + def name(self) -> str: # type: ignore + return f"<{' '.join(ty.name for ty in self.types)}>" + + @property + def arity(self) -> int: # type: ignore + return len(self.types) + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + len_type = len(self.types) + len_value = len(value) + + if len_value != len_type: + self.fail( + ngettext( + "{len_type} values are required, but {len_value} was given.", + "{len_type} values are required, but {len_value} were given.", + len_value, + ).format(len_type=len_type, len_value=len_value), + param=param, + ctx=ctx, + ) + + return tuple(ty(x, param, ctx) for ty, x in zip(self.types, value)) + + +def convert_type(ty: t.Optional[t.Any], default: t.Optional[t.Any] = None) -> ParamType: + """Find the most appropriate :class:`ParamType` for the given Python + type. If the type isn't provided, it can be inferred from a default + value. + """ + guessed_type = False + + if ty is None and default is not None: + if isinstance(default, (tuple, list)): + # If the default is empty, ty will remain None and will + # return STRING. + if default: + item = default[0] + + # A tuple of tuples needs to detect the inner types. + # Can't call convert recursively because that would + # incorrectly unwind the tuple to a single type. + if isinstance(item, (tuple, list)): + ty = tuple(map(type, item)) + else: + ty = type(item) + else: + ty = type(default) + + guessed_type = True + + if isinstance(ty, tuple): + return Tuple(ty) + + if isinstance(ty, ParamType): + return ty + + if ty is str or ty is None: + return STRING + + if ty is int: + return INT + + if ty is float: + return FLOAT + + if ty is bool: + return BOOL + + if guessed_type: + return STRING + + if __debug__: + try: + if issubclass(ty, ParamType): + raise AssertionError( + f"Attempted to use an uninstantiated parameter type ({ty})." + ) + except TypeError: + # ty is an instance (correct), so issubclass fails. + pass + + return FuncParamType(ty) + + +#: A dummy parameter type that just does nothing. From a user's +#: perspective this appears to just be the same as `STRING` but +#: internally no string conversion takes place if the input was bytes. +#: This is usually useful when working with file paths as they can +#: appear in bytes and unicode. +#: +#: For path related uses the :class:`Path` type is a better choice but +#: there are situations where an unprocessed type is useful which is why +#: it is is provided. +#: +#: .. versionadded:: 4.0 +UNPROCESSED = UnprocessedParamType() + +#: A unicode string parameter type which is the implicit default. This +#: can also be selected by using ``str`` as type. +STRING = StringParamType() + +#: An integer parameter. This can also be selected by using ``int`` as +#: type. +INT = IntParamType() + +#: A floating point value parameter. This can also be selected by using +#: ``float`` as type. +FLOAT = FloatParamType() + +#: A boolean parameter. This is the default for boolean flags. This can +#: also be selected by using ``bool`` as a type. +BOOL = BoolParamType() + +#: A UUID parameter. +UUID = UUIDParameterType() diff --git a/billinglayer/python/click/utils.py b/billinglayer/python/click/utils.py new file mode 100644 index 0000000..d536434 --- /dev/null +++ b/billinglayer/python/click/utils.py @@ -0,0 +1,624 @@ +import os +import re +import sys +import typing as t +from functools import update_wrapper +from types import ModuleType +from types import TracebackType + +from ._compat import _default_text_stderr +from ._compat import _default_text_stdout +from ._compat import _find_binary_writer +from ._compat import auto_wrap_for_ansi +from ._compat import binary_streams +from ._compat import open_stream +from ._compat import should_strip_ansi +from ._compat import strip_ansi +from ._compat import text_streams +from ._compat import WIN +from .globals import resolve_color_default + +if t.TYPE_CHECKING: + import typing_extensions as te + + P = te.ParamSpec("P") + +R = t.TypeVar("R") + + +def _posixify(name: str) -> str: + return "-".join(name.split()).lower() + + +def safecall(func: "t.Callable[P, R]") -> "t.Callable[P, t.Optional[R]]": + """Wraps a function so that it swallows exceptions.""" + + def wrapper(*args: "P.args", **kwargs: "P.kwargs") -> t.Optional[R]: + try: + return func(*args, **kwargs) + except Exception: + pass + return None + + return update_wrapper(wrapper, func) + + +def make_str(value: t.Any) -> str: + """Converts a value into a valid string.""" + if isinstance(value, bytes): + try: + return value.decode(sys.getfilesystemencoding()) + except UnicodeError: + return value.decode("utf-8", "replace") + return str(value) + + +def make_default_short_help(help: str, max_length: int = 45) -> str: + """Returns a condensed version of help string.""" + # Consider only the first paragraph. + paragraph_end = help.find("\n\n") + + if paragraph_end != -1: + help = help[:paragraph_end] + + # Collapse newlines, tabs, and spaces. + words = help.split() + + if not words: + return "" + + # The first paragraph started with a "no rewrap" marker, ignore it. + if words[0] == "\b": + words = words[1:] + + total_length = 0 + last_index = len(words) - 1 + + for i, word in enumerate(words): + total_length += len(word) + (i > 0) + + if total_length > max_length: # too long, truncate + break + + if word[-1] == ".": # sentence end, truncate without "..." + return " ".join(words[: i + 1]) + + if total_length == max_length and i != last_index: + break # not at sentence end, truncate with "..." + else: + return " ".join(words) # no truncation needed + + # Account for the length of the suffix. + total_length += len("...") + + # remove words until the length is short enough + while i > 0: + total_length -= len(words[i]) + (i > 0) + + if total_length <= max_length: + break + + i -= 1 + + return " ".join(words[:i]) + "..." + + +class LazyFile: + """A lazy file works like a regular file but it does not fully open + the file but it does perform some basic checks early to see if the + filename parameter does make sense. This is useful for safely opening + files for writing. + """ + + def __init__( + self, + filename: t.Union[str, "os.PathLike[str]"], + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + atomic: bool = False, + ): + self.name: str = os.fspath(filename) + self.mode = mode + self.encoding = encoding + self.errors = errors + self.atomic = atomic + self._f: t.Optional[t.IO[t.Any]] + self.should_close: bool + + if self.name == "-": + self._f, self.should_close = open_stream(filename, mode, encoding, errors) + else: + if "r" in mode: + # Open and close the file in case we're opening it for + # reading so that we can catch at least some errors in + # some cases early. + open(filename, mode).close() + self._f = None + self.should_close = True + + def __getattr__(self, name: str) -> t.Any: + return getattr(self.open(), name) + + def __repr__(self) -> str: + if self._f is not None: + return repr(self._f) + return f"" + + def open(self) -> t.IO[t.Any]: + """Opens the file if it's not yet open. This call might fail with + a :exc:`FileError`. Not handling this error will produce an error + that Click shows. + """ + if self._f is not None: + return self._f + try: + rv, self.should_close = open_stream( + self.name, self.mode, self.encoding, self.errors, atomic=self.atomic + ) + except OSError as e: # noqa: E402 + from .exceptions import FileError + + raise FileError(self.name, hint=e.strerror) from e + self._f = rv + return rv + + def close(self) -> None: + """Closes the underlying file, no matter what.""" + if self._f is not None: + self._f.close() + + def close_intelligently(self) -> None: + """This function only closes the file if it was opened by the lazy + file wrapper. For instance this will never close stdin. + """ + if self.should_close: + self.close() + + def __enter__(self) -> "LazyFile": + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + self.close_intelligently() + + def __iter__(self) -> t.Iterator[t.AnyStr]: + self.open() + return iter(self._f) # type: ignore + + +class KeepOpenFile: + def __init__(self, file: t.IO[t.Any]) -> None: + self._file: t.IO[t.Any] = file + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._file, name) + + def __enter__(self) -> "KeepOpenFile": + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + pass + + def __repr__(self) -> str: + return repr(self._file) + + def __iter__(self) -> t.Iterator[t.AnyStr]: + return iter(self._file) + + +def echo( + message: t.Optional[t.Any] = None, + file: t.Optional[t.IO[t.Any]] = None, + nl: bool = True, + err: bool = False, + color: t.Optional[bool] = None, +) -> None: + """Print a message and newline to stdout or a file. This should be + used instead of :func:`print` because it provides better support + for different data, files, and environments. + + Compared to :func:`print`, this does the following: + + - Ensures that the output encoding is not misconfigured on Linux. + - Supports Unicode in the Windows console. + - Supports writing to binary outputs, and supports writing bytes + to text outputs. + - Supports colors and styles on Windows. + - Removes ANSI color and style codes if the output does not look + like an interactive terminal. + - Always flushes the output. + + :param message: The string or bytes to output. Other objects are + converted to strings. + :param file: The file to write to. Defaults to ``stdout``. + :param err: Write to ``stderr`` instead of ``stdout``. + :param nl: Print a newline after the message. Enabled by default. + :param color: Force showing or hiding colors and other styles. By + default Click will remove color if the output does not look like + an interactive terminal. + + .. versionchanged:: 6.0 + Support Unicode output on the Windows console. Click does not + modify ``sys.stdout``, so ``sys.stdout.write()`` and ``print()`` + will still not support Unicode. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. + + .. versionadded:: 3.0 + Added the ``err`` parameter. + + .. versionchanged:: 2.0 + Support colors on Windows if colorama is installed. + """ + if file is None: + if err: + file = _default_text_stderr() + else: + file = _default_text_stdout() + + # There are no standard streams attached to write to. For example, + # pythonw on Windows. + if file is None: + return + + # Convert non bytes/text into the native string type. + if message is not None and not isinstance(message, (str, bytes, bytearray)): + out: t.Optional[t.Union[str, bytes]] = str(message) + else: + out = message + + if nl: + out = out or "" + if isinstance(out, str): + out += "\n" + else: + out += b"\n" + + if not out: + file.flush() + return + + # If there is a message and the value looks like bytes, we manually + # need to find the binary stream and write the message in there. + # This is done separately so that most stream types will work as you + # would expect. Eg: you can write to StringIO for other cases. + if isinstance(out, (bytes, bytearray)): + binary_file = _find_binary_writer(file) + + if binary_file is not None: + file.flush() + binary_file.write(out) + binary_file.flush() + return + + # ANSI style code support. For no message or bytes, nothing happens. + # When outputting to a file instead of a terminal, strip codes. + else: + color = resolve_color_default(color) + + if should_strip_ansi(file, color): + out = strip_ansi(out) + elif WIN: + if auto_wrap_for_ansi is not None: + file = auto_wrap_for_ansi(file) # type: ignore + elif not color: + out = strip_ansi(out) + + file.write(out) # type: ignore + file.flush() + + +def get_binary_stream(name: "te.Literal['stdin', 'stdout', 'stderr']") -> t.BinaryIO: + """Returns a system stream for byte processing. + + :param name: the name of the stream to open. Valid names are ``'stdin'``, + ``'stdout'`` and ``'stderr'`` + """ + opener = binary_streams.get(name) + if opener is None: + raise TypeError(f"Unknown standard stream '{name}'") + return opener() + + +def get_text_stream( + name: "te.Literal['stdin', 'stdout', 'stderr']", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", +) -> t.TextIO: + """Returns a system stream for text processing. This usually returns + a wrapped stream around a binary stream returned from + :func:`get_binary_stream` but it also can take shortcuts for already + correctly configured streams. + + :param name: the name of the stream to open. Valid names are ``'stdin'``, + ``'stdout'`` and ``'stderr'`` + :param encoding: overrides the detected default encoding. + :param errors: overrides the default error mode. + """ + opener = text_streams.get(name) + if opener is None: + raise TypeError(f"Unknown standard stream '{name}'") + return opener(encoding, errors) + + +def open_file( + filename: str, + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + lazy: bool = False, + atomic: bool = False, +) -> t.IO[t.Any]: + """Open a file, with extra behavior to handle ``'-'`` to indicate + a standard stream, lazy open on write, and atomic write. Similar to + the behavior of the :class:`~click.File` param type. + + If ``'-'`` is given to open ``stdout`` or ``stdin``, the stream is + wrapped so that using it in a context manager will not close it. + This makes it possible to use the function without accidentally + closing a standard stream: + + .. code-block:: python + + with open_file(filename) as f: + ... + + :param filename: The name of the file to open, or ``'-'`` for + ``stdin``/``stdout``. + :param mode: The mode in which to open the file. + :param encoding: The encoding to decode or encode a file opened in + text mode. + :param errors: The error handling mode. + :param lazy: Wait to open the file until it is accessed. For read + mode, the file is temporarily opened to raise access errors + early, then closed until it is read again. + :param atomic: Write to a temporary file and replace the given file + on close. + + .. versionadded:: 3.0 + """ + if lazy: + return t.cast( + t.IO[t.Any], LazyFile(filename, mode, encoding, errors, atomic=atomic) + ) + + f, should_close = open_stream(filename, mode, encoding, errors, atomic=atomic) + + if not should_close: + f = t.cast(t.IO[t.Any], KeepOpenFile(f)) + + return f + + +def format_filename( + filename: "t.Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]", + shorten: bool = False, +) -> str: + """Format a filename as a string for display. Ensures the filename can be + displayed by replacing any invalid bytes or surrogate escapes in the name + with the replacement character ``�``. + + Invalid bytes or surrogate escapes will raise an error when written to a + stream with ``errors="strict". This will typically happen with ``stdout`` + when the locale is something like ``en_GB.UTF-8``. + + Many scenarios *are* safe to write surrogates though, due to PEP 538 and + PEP 540, including: + + - Writing to ``stderr``, which uses ``errors="backslashreplace"``. + - The system has ``LANG=C.UTF-8``, ``C``, or ``POSIX``. Python opens + stdout and stderr with ``errors="surrogateescape"``. + - None of ``LANG/LC_*`` are set. Python assumes ``LANG=C.UTF-8``. + - Python is started in UTF-8 mode with ``PYTHONUTF8=1`` or ``-X utf8``. + Python opens stdout and stderr with ``errors="surrogateescape"``. + + :param filename: formats a filename for UI display. This will also convert + the filename into unicode without failing. + :param shorten: this optionally shortens the filename to strip of the + path that leads up to it. + """ + if shorten: + filename = os.path.basename(filename) + else: + filename = os.fspath(filename) + + if isinstance(filename, bytes): + filename = filename.decode(sys.getfilesystemencoding(), "replace") + else: + filename = filename.encode("utf-8", "surrogateescape").decode( + "utf-8", "replace" + ) + + return filename + + +def get_app_dir(app_name: str, roaming: bool = True, force_posix: bool = False) -> str: + r"""Returns the config folder for the application. The default behavior + is to return whatever is most appropriate for the operating system. + + To give you an idea, for an app called ``"Foo Bar"``, something like + the following folders could be returned: + + Mac OS X: + ``~/Library/Application Support/Foo Bar`` + Mac OS X (POSIX): + ``~/.foo-bar`` + Unix: + ``~/.config/foo-bar`` + Unix (POSIX): + ``~/.foo-bar`` + Windows (roaming): + ``C:\Users\\AppData\Roaming\Foo Bar`` + Windows (not roaming): + ``C:\Users\\AppData\Local\Foo Bar`` + + .. versionadded:: 2.0 + + :param app_name: the application name. This should be properly capitalized + and can contain whitespace. + :param roaming: controls if the folder should be roaming or not on Windows. + Has no effect otherwise. + :param force_posix: if this is set to `True` then on any POSIX system the + folder will be stored in the home folder with a leading + dot instead of the XDG config home or darwin's + application support folder. + """ + if WIN: + key = "APPDATA" if roaming else "LOCALAPPDATA" + folder = os.environ.get(key) + if folder is None: + folder = os.path.expanduser("~") + return os.path.join(folder, app_name) + if force_posix: + return os.path.join(os.path.expanduser(f"~/.{_posixify(app_name)}")) + if sys.platform == "darwin": + return os.path.join( + os.path.expanduser("~/Library/Application Support"), app_name + ) + return os.path.join( + os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), + _posixify(app_name), + ) + + +class PacifyFlushWrapper: + """This wrapper is used to catch and suppress BrokenPipeErrors resulting + from ``.flush()`` being called on broken pipe during the shutdown/final-GC + of the Python interpreter. Notably ``.flush()`` is always called on + ``sys.stdout`` and ``sys.stderr``. So as to have minimal impact on any + other cleanup code, and the case where the underlying file is not a broken + pipe, all calls and attributes are proxied. + """ + + def __init__(self, wrapped: t.IO[t.Any]) -> None: + self.wrapped = wrapped + + def flush(self) -> None: + try: + self.wrapped.flush() + except OSError as e: + import errno + + if e.errno != errno.EPIPE: + raise + + def __getattr__(self, attr: str) -> t.Any: + return getattr(self.wrapped, attr) + + +def _detect_program_name( + path: t.Optional[str] = None, _main: t.Optional[ModuleType] = None +) -> str: + """Determine the command used to run the program, for use in help + text. If a file or entry point was executed, the file name is + returned. If ``python -m`` was used to execute a module or package, + ``python -m name`` is returned. + + This doesn't try to be too precise, the goal is to give a concise + name for help text. Files are only shown as their name without the + path. ``python`` is only shown for modules, and the full path to + ``sys.executable`` is not shown. + + :param path: The Python file being executed. Python puts this in + ``sys.argv[0]``, which is used by default. + :param _main: The ``__main__`` module. This should only be passed + during internal testing. + + .. versionadded:: 8.0 + Based on command args detection in the Werkzeug reloader. + + :meta private: + """ + if _main is None: + _main = sys.modules["__main__"] + + if not path: + path = sys.argv[0] + + # The value of __package__ indicates how Python was called. It may + # not exist if a setuptools script is installed as an egg. It may be + # set incorrectly for entry points created with pip on Windows. + # It is set to "" inside a Shiv or PEX zipapp. + if getattr(_main, "__package__", None) in {None, ""} or ( + os.name == "nt" + and _main.__package__ == "" + and not os.path.exists(path) + and os.path.exists(f"{path}.exe") + ): + # Executed a file, like "python app.py". + return os.path.basename(path) + + # Executed a module, like "python -m example". + # Rewritten by Python from "-m script" to "/path/to/script.py". + # Need to look at main module to determine how it was executed. + py_module = t.cast(str, _main.__package__) + name = os.path.splitext(os.path.basename(path))[0] + + # A submodule like "example.cli". + if name != "__main__": + py_module = f"{py_module}.{name}" + + return f"python -m {py_module.lstrip('.')}" + + +def _expand_args( + args: t.Iterable[str], + *, + user: bool = True, + env: bool = True, + glob_recursive: bool = True, +) -> t.List[str]: + """Simulate Unix shell expansion with Python functions. + + See :func:`glob.glob`, :func:`os.path.expanduser`, and + :func:`os.path.expandvars`. + + This is intended for use on Windows, where the shell does not do any + expansion. It may not exactly match what a Unix shell would do. + + :param args: List of command line arguments to expand. + :param user: Expand user home directory. + :param env: Expand environment variables. + :param glob_recursive: ``**`` matches directories recursively. + + .. versionchanged:: 8.1 + Invalid glob patterns are treated as empty expansions rather + than raising an error. + + .. versionadded:: 8.0 + + :meta private: + """ + from glob import glob + + out = [] + + for arg in args: + if user: + arg = os.path.expanduser(arg) + + if env: + arg = os.path.expandvars(arg) + + try: + matches = glob(arg, recursive=glob_recursive) + except re.error: + matches = [] + + if not matches: + out.append(arg) + else: + out.extend(matches) + + return out diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/INSTALLER b/billinglayer/python/cryptography-41.0.3.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE b/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE new file mode 100644 index 0000000..b11f379 --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the licenses +found in LICENSE.APACHE or LICENSE.BSD. Contributions to cryptography are made +under the terms of *both* these licenses. diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE.APACHE b/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE.APACHE new file mode 100644 index 0000000..62589ed --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE.APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE.BSD b/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE.BSD new file mode 100644 index 0000000..ec1a29d --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/LICENSE.BSD @@ -0,0 +1,27 @@ +Copyright (c) Individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of PyCA Cryptography nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/METADATA b/billinglayer/python/cryptography-41.0.3.dist-info/METADATA new file mode 100644 index 0000000..1eba09c --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/METADATA @@ -0,0 +1,133 @@ +Metadata-Version: 2.1 +Name: cryptography +Version: 41.0.3 +Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers. +Author-email: The Python Cryptographic Authority and individual contributors +License: Apache-2.0 OR BSD-3-Clause +Project-URL: homepage, https://github.com/pyca/cryptography +Project-URL: documentation, https://cryptography.io/ +Project-URL: source, https://github.com/pyca/cryptography/ +Project-URL: issues, https://github.com/pyca/cryptography/issues +Project-URL: changelog, https://cryptography.io/en/latest/changelog/ +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: License :: OSI Approved :: BSD License +Classifier: Natural Language :: English +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: POSIX +Classifier: Operating System :: POSIX :: BSD +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Security :: Cryptography +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENSE +License-File: LICENSE.APACHE +License-File: LICENSE.BSD +Requires-Dist: cffi (>=1.12) +Provides-Extra: docs +Requires-Dist: sphinx (>=5.3.0) ; extra == 'docs' +Requires-Dist: sphinx-rtd-theme (>=1.1.1) ; extra == 'docs' +Provides-Extra: docstest +Requires-Dist: pyenchant (>=1.6.11) ; extra == 'docstest' +Requires-Dist: twine (>=1.12.0) ; extra == 'docstest' +Requires-Dist: sphinxcontrib-spelling (>=4.0.1) ; extra == 'docstest' +Provides-Extra: nox +Requires-Dist: nox ; extra == 'nox' +Provides-Extra: pep8test +Requires-Dist: black ; extra == 'pep8test' +Requires-Dist: ruff ; extra == 'pep8test' +Requires-Dist: mypy ; extra == 'pep8test' +Requires-Dist: check-sdist ; extra == 'pep8test' +Provides-Extra: sdist +Requires-Dist: build ; extra == 'sdist' +Provides-Extra: ssh +Requires-Dist: bcrypt (>=3.1.5) ; extra == 'ssh' +Provides-Extra: test +Requires-Dist: pytest (>=6.2.0) ; extra == 'test' +Requires-Dist: pytest-benchmark ; extra == 'test' +Requires-Dist: pytest-cov ; extra == 'test' +Requires-Dist: pytest-xdist ; extra == 'test' +Requires-Dist: pretend ; extra == 'test' +Provides-Extra: test-randomorder +Requires-Dist: pytest-randomly ; extra == 'test-randomorder' + +pyca/cryptography +================= + +.. image:: https://img.shields.io/pypi/v/cryptography.svg + :target: https://pypi.org/project/cryptography/ + :alt: Latest Version + +.. image:: https://readthedocs.org/projects/cryptography/badge/?version=latest + :target: https://cryptography.io + :alt: Latest Docs + +.. image:: https://github.com/pyca/cryptography/workflows/CI/badge.svg?branch=main + :target: https://github.com/pyca/cryptography/actions?query=workflow%3ACI+branch%3Amain + + +``cryptography`` is a package which provides cryptographic recipes and +primitives to Python developers. Our goal is for it to be your "cryptographic +standard library". It supports Python 3.7+ and PyPy3 7.3.10+. + +``cryptography`` includes both high level recipes and low level interfaces to +common cryptographic algorithms such as symmetric ciphers, message digests, and +key derivation functions. For example, to encrypt something with +``cryptography``'s high level symmetric encryption recipe: + +.. code-block:: pycon + + >>> from cryptography.fernet import Fernet + >>> # Put this somewhere safe! + >>> key = Fernet.generate_key() + >>> f = Fernet(key) + >>> token = f.encrypt(b"A really secret message. Not for prying eyes.") + >>> token + b'...' + >>> f.decrypt(token) + b'A really secret message. Not for prying eyes.' + +You can find more information in the `documentation`_. + +You can install ``cryptography`` with: + +.. code-block:: console + + $ pip install cryptography + +For full details see `the installation documentation`_. + +Discussion +~~~~~~~~~~ + +If you run into bugs, you can file them in our `issue tracker`_. + +We maintain a `cryptography-dev`_ mailing list for development discussion. + +You can also join ``#pyca`` on ``irc.libera.chat`` to ask questions or get +involved. + +Security +~~~~~~~~ + +Need to report a security issue? Please consult our `security reporting`_ +documentation. + + +.. _`documentation`: https://cryptography.io/ +.. _`the installation documentation`: https://cryptography.io/en/latest/installation/ +.. _`issue tracker`: https://github.com/pyca/cryptography/issues +.. _`cryptography-dev`: https://mail.python.org/mailman/listinfo/cryptography-dev +.. _`security reporting`: https://cryptography.io/en/latest/security/ diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/RECORD b/billinglayer/python/cryptography-41.0.3.dist-info/RECORD new file mode 100644 index 0000000..452f033 --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/RECORD @@ -0,0 +1,172 @@ +cryptography-41.0.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +cryptography-41.0.3.dist-info/LICENSE,sha256=Pgx8CRqUi4JTO6mP18u0BDLW8amsv4X1ki0vmak65rs,197 +cryptography-41.0.3.dist-info/LICENSE.APACHE,sha256=qsc7MUj20dcRHbyjIJn2jSbGRMaBOuHk8F9leaomY_4,11360 +cryptography-41.0.3.dist-info/LICENSE.BSD,sha256=YCxMdILeZHndLpeTzaJ15eY9dz2s0eymiSMqtwCPtPs,1532 +cryptography-41.0.3.dist-info/METADATA,sha256=fGKXAMLFFzeETs2WZI8i9seJnNtvEsWWxLx6Fk3sBTM,5175 +cryptography-41.0.3.dist-info/RECORD,, +cryptography-41.0.3.dist-info/WHEEL,sha256=E44f5mm0c9FVszd8tVo9b_r3SFjxQ7VIZjTMBOg4nG0,148 +cryptography-41.0.3.dist-info/top_level.txt,sha256=KNaT-Sn2K4uxNaEbe6mYdDn3qWDMlp4y-MtWfB73nJc,13 +cryptography/__about__.py,sha256=QMP22GBLX29OFkJ9LPAingf-MaCOruWiMbxHS1BLIXo,445 +cryptography/__init__.py,sha256=iVPlBlXWTJyiFeRedxcbMPhyHB34viOM10d72vGnWuE,364 +cryptography/__pycache__/__about__.cpython-311.pyc,, +cryptography/__pycache__/__init__.cpython-311.pyc,, +cryptography/__pycache__/exceptions.cpython-311.pyc,, +cryptography/__pycache__/fernet.cpython-311.pyc,, +cryptography/__pycache__/utils.cpython-311.pyc,, +cryptography/exceptions.py,sha256=EHe7XM2_OtdOM1bZE0ci-4GUhtOlEQ6fQXhK2Igf0qA,1118 +cryptography/fernet.py,sha256=TVZy4Dtkpl7kWIpvuKcNldE95IEjTQ0MfHgRsLdnDSM,6886 +cryptography/hazmat/__init__.py,sha256=5IwrLWrVp0AjEr_4FdWG_V057NSJGY_W4egNNsuct0g,455 +cryptography/hazmat/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/__pycache__/_oid.cpython-311.pyc,, +cryptography/hazmat/_oid.py,sha256=gxhMHKpu9Xsi6uHCGZ_-soYMXj_izOIFaxjUKWbCPeE,14441 +cryptography/hazmat/backends/__init__.py,sha256=O5jvKFQdZnXhKeqJ-HtulaEL9Ni7mr1mDzZY5kHlYhI,361 +cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__init__.py,sha256=p3jmJfnCag9iE5sdMrN6VvVEu55u46xaS_IjoI0SrmA,305 +cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/aead.py,sha256=s3zXcVQf0COIOuOzI8usebWpznGnyZ7GhnmlJYu7QXA,15967 +cryptography/hazmat/backends/openssl/backend.py,sha256=sNMXDL0YPS9vdXFoufEDFOQJh_uMfpUnErd1j1Rdzf0,73231 +cryptography/hazmat/backends/openssl/ciphers.py,sha256=lxWrvnufudsDI2bpwNs2c8XLILbAE2j2rMSD1nhnPVg,10358 +cryptography/hazmat/backends/openssl/cmac.py,sha256=pHgQOIRfR4cIDa5ltcKFtgjqPTXbOLyRQmmqv9JlbUk,3035 +cryptography/hazmat/backends/openssl/decode_asn1.py,sha256=kz6gys8wuJhrx4QyU6enYx7UatNHr0LB3TI1jH3oQ54,1148 +cryptography/hazmat/backends/openssl/ec.py,sha256=GKzh3mZKvgsM1jqM88-4XikHHalpV-Efyskclt8yxYg,11474 +cryptography/hazmat/backends/openssl/rsa.py,sha256=P_ak-2zvA6VBt_P0ldzTSCUkcjo2GhYt_HLn8CVvWtE,21825 +cryptography/hazmat/backends/openssl/utils.py,sha256=UoguO26QzwN4lsMAltsIrgAlbi3SOeSrexZs1-QPNu8,2190 +cryptography/hazmat/bindings/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/bindings/_rust.abi3.so,sha256=NoXkkoRL2bk3270hxaqUPt4KO9kC0ZEQcNte-_H6N_4,13435728 +cryptography/hazmat/bindings/_rust/__init__.pyi,sha256=IumK7zP9Ko3HjLLb5hwZiY2rbfmfsuyTZLLcHOMvSdk,981 +cryptography/hazmat/bindings/_rust/_openssl.pyi,sha256=mpNJLuYLbCVrd5i33FBTmWwL_55Dw7JPkSLlSX9Q7oI,230 +cryptography/hazmat/bindings/_rust/asn1.pyi,sha256=9CyI-grOsLQB_hfnhJPoG9dNOdJ7Zg6B0iUpzCowh44,592 +cryptography/hazmat/bindings/_rust/exceptions.pyi,sha256=exXr2xw_0pB1kk93cYbM3MohbzoUkjOms1ZMUi0uQZE,640 +cryptography/hazmat/bindings/_rust/ocsp.pyi,sha256=RzVaLkY0y9L8W8opAL_uVD8bySKxP23pSQtEbLOStXI,905 +cryptography/hazmat/bindings/_rust/openssl/__init__.pyi,sha256=j764U4RRBZbDuOfjQxRqU7rCf74kgM-3AnTIjLdRy3E,970 +cryptography/hazmat/bindings/_rust/openssl/dh.pyi,sha256=0FVY1t5qM9HV_ZKDIcdJI2a72i1fHKyTvYIJb5UnH4M,896 +cryptography/hazmat/bindings/_rust/openssl/dsa.pyi,sha256=43in4PCsm2kz_H7RQFLBKqhDsUmb4yWop6dpYeVDg-4,764 +cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi,sha256=E2GXAgibfRGqKxskH8MfZI8gHFoMJJOTjG7Elg2gOww,629 +cryptography/hazmat/bindings/_rust/openssl/ed448.pyi,sha256=pk_kx5Biq8O53d2joOT-cXuwCrbFPicV7iaqYdeiIAI,603 +cryptography/hazmat/bindings/_rust/openssl/hashes.pyi,sha256=J8HoN0GdtPcjRAfNHr5Elva_nkmQfq63L75_z9dd8Uc,573 +cryptography/hazmat/bindings/_rust/openssl/hmac.pyi,sha256=ZmLJ73pmxcZFC1XosWEiXMRYtvJJor3ZLdCQOJu85Cw,662 +cryptography/hazmat/bindings/_rust/openssl/kdf.pyi,sha256=wPS5c7NLspM2632II0I4iH1RSxZvSRtBOVqmpyQATfk,544 +cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi,sha256=9iogF7Q4i81IkOS-IMXp6HvxFF_3cNy_ucrAjVQnn14,540 +cryptography/hazmat/bindings/_rust/openssl/x25519.pyi,sha256=-1F5QDZfrdhmDLKTeSERuuDUHBTV-EhxIYk9mjpwcG4,616 +cryptography/hazmat/bindings/_rust/openssl/x448.pyi,sha256=SdL4blscYBEvuWY4SuNAY1s5zFaGj38eQ-bulVBZvFg,590 +cryptography/hazmat/bindings/_rust/pkcs7.pyi,sha256=VkTC78wjJgb_qrboOYIFPuFZ3W46zsr6zsxnlrOMwao,460 +cryptography/hazmat/bindings/_rust/x509.pyi,sha256=j6AbXBZSXeJHLSrXnaapbiPfle-znfk9uJUa_zqxgy4,1878 +cryptography/hazmat/bindings/openssl/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc,, +cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc,, +cryptography/hazmat/bindings/openssl/_conditional.py,sha256=DeECq7AKguhs390ZmxgItdqPLzyrKGJk-3KlHJMkXoY,9098 +cryptography/hazmat/bindings/openssl/binding.py,sha256=0x3kzvq2grHu4gbbgEIzEVrX6unp71EEs1hx0o-uuOM,6696 +cryptography/hazmat/primitives/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc,, +cryptography/hazmat/primitives/_asymmetric.py,sha256=RhgcouUB6HTiFDBrR1LxqkMjpUxIiNvQ1r_zJjRG6qQ,532 +cryptography/hazmat/primitives/_cipheralgorithm.py,sha256=7LPkpw-DrgyvmBMUjvXeBvojVZPtXhFgfelUftnxPGw,1093 +cryptography/hazmat/primitives/_serialization.py,sha256=U0DU0ZzOLJppCQsh9EJH6vGYoHotBolfNyRyx3wr1l0,5216 +cryptography/hazmat/primitives/asymmetric/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/dh.py,sha256=XsthqjvExWWOyePs0PxT4MestU9QeGuL-Hx7fWzTguQ,7013 +cryptography/hazmat/primitives/asymmetric/dsa.py,sha256=aaTY7EMLTzaWs-jhOMpMAfa2GnfhoqsCKZPKAs35L40,8263 +cryptography/hazmat/primitives/asymmetric/ec.py,sha256=L1WoWPYevJ6Pk2T1etbnHbvr6AeXFccckPNNiyUVoNM,12867 +cryptography/hazmat/primitives/asymmetric/ed25519.py,sha256=wl2NCCP4bZdUCqZGMkOOd6eaxjU1vXPAIwzUuFPE__w,3489 +cryptography/hazmat/primitives/asymmetric/ed448.py,sha256=2MCJ87qcyCCsjj0OvrfWFxPX8CgaC3d0mr78bt_vDIY,3440 +cryptography/hazmat/primitives/asymmetric/padding.py,sha256=6p8Ojiax_2tcm1aTnNOAkinriCJ67nSTxugg34f-hzk,2717 +cryptography/hazmat/primitives/asymmetric/rsa.py,sha256=vxvOryF00WL8mZQv9bs_-LlgobYLiPYfX246_j_ICtA,11623 +cryptography/hazmat/primitives/asymmetric/types.py,sha256=LnsOJym-wmPUJ7Knu_7bCNU3kIiELCd6krOaW_JU08I,2996 +cryptography/hazmat/primitives/asymmetric/utils.py,sha256=DPTs6T4F-UhwzFQTh-1fSEpQzazH2jf2xpIro3ItF4o,790 +cryptography/hazmat/primitives/asymmetric/x25519.py,sha256=8YJAIaU7w09jTnPU_cLwd98fMHIECgfA3R7P3Ktv-CA,3437 +cryptography/hazmat/primitives/asymmetric/x448.py,sha256=y-Yj-rgciiuH1g6FJLZftvAqgOnzT1on9gCisru7vBc,3358 +cryptography/hazmat/primitives/ciphers/__init__.py,sha256=kAyb9NSczqTrCWj0HEoVp3Cxo7AHW8ibPFQz-ZHsOtA,680 +cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/aead.py,sha256=DY7qKmbt0bgB1GB7i-fQrbjEfwFG8wfUfVHvc7DA2YY,12067 +cryptography/hazmat/primitives/ciphers/algorithms.py,sha256=SCDskXc9xyzsz0NjND6tAX8t17jYTbUB2sww1ub9GuY,5000 +cryptography/hazmat/primitives/ciphers/base.py,sha256=PqNDltHdDxBhLhgtfO707H07sSOLA6ZVwjZlalOJTAo,8286 +cryptography/hazmat/primitives/ciphers/modes.py,sha256=YJQXi4PJGIIZ1rgchbMH47Ed-YiUcUSjLPEOuV8rgGE,8361 +cryptography/hazmat/primitives/cmac.py,sha256=YaeWksCYaqVoqf9zHRThAJ95ZvPUioAOfXwZUWiPzD8,2065 +cryptography/hazmat/primitives/constant_time.py,sha256=xdunWT0nf8OvKdcqUhhlFKayGp4_PgVJRU2W1wLSr_A,422 +cryptography/hazmat/primitives/hashes.py,sha256=VJpnbK2sQN2bEqwRTOoCB4nuxYx5CnqFiScMJNyhsrI,5115 +cryptography/hazmat/primitives/hmac.py,sha256=RpB3z9z5skirCQrm7zQbtnp9pLMnAjrlTUvKqF5aDDc,423 +cryptography/hazmat/primitives/kdf/__init__.py,sha256=4XibZnrYq4hh5xBjWiIXzaYW6FKx8hPbVaa_cB9zS64,750 +cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/concatkdf.py,sha256=wGYWgILmxQWnCPkbAH1RpsCHrdKgmYrCEVrCvXVGCo8,3726 +cryptography/hazmat/primitives/kdf/hkdf.py,sha256=bBYr1yUIbOlJIEd6ZoLYcXm_yd-H54An9kNcFIJ3kbo,3045 +cryptography/hazmat/primitives/kdf/kbkdf.py,sha256=qPL6TmDUmkus6CW3ylTJfG8N8egZhjQOyXrSyLLpnak,9232 +cryptography/hazmat/primitives/kdf/pbkdf2.py,sha256=1CCH9Q5gXUpnZd3c8d8bCXgpJ3s2hZZGBnuG7FH1waM,2012 +cryptography/hazmat/primitives/kdf/scrypt.py,sha256=4QONhjxA_ZtuQtQ7QV3FnbB8ftrFnM52B4HPfV7hFys,2354 +cryptography/hazmat/primitives/kdf/x963kdf.py,sha256=S3B4Enk2Yxj9txpairotaXkavuZqQ6t6MB5a28U02ek,2002 +cryptography/hazmat/primitives/keywrap.py,sha256=Qb_N2V_E1Dti5VtDXnrtTYtJDZ8aMpur8BY5yxrXclg,5678 +cryptography/hazmat/primitives/padding.py,sha256=8pCeLaqwQPSGf51j06U5C_INvgYWVWPv3m9mxUERGmU,6242 +cryptography/hazmat/primitives/poly1305.py,sha256=P5EPQV-RB_FJPahpg01u0Ts4S_PnAmsroxIGXbGeRRo,355 +cryptography/hazmat/primitives/serialization/__init__.py,sha256=6ZlL3EicEzoGdMOat86w8y_XICCnlHdCjFI97rMxRDg,1653 +cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/base.py,sha256=VZjIIqnbb-x38qpg2Wf_IxZvqjsgcEzNQtQoeJiQfpw,1986 +cryptography/hazmat/primitives/serialization/pkcs12.py,sha256=NOzFxArlZhdjfgfugs8nERho1eyaxujXKGUKINchek4,6767 +cryptography/hazmat/primitives/serialization/pkcs7.py,sha256=BCvlPubXQOunb76emISK89PX9qXcBQI2CRPNe85VTZk,7392 +cryptography/hazmat/primitives/serialization/ssh.py,sha256=aLCYLPY3W1kerfCwadn5aYNzwcwIQl9c7RcsB8CKfuc,51027 +cryptography/hazmat/primitives/twofactor/__init__.py,sha256=tmMZGB-g4IU1r7lIFqASU019zr0uPp_wEBYcwdDCKCA,258 +cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc,, +cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc,, +cryptography/hazmat/primitives/twofactor/hotp.py,sha256=uZ0PSKYDZOL0aAobiw1Zd2HD0W2Ei1niUNC2v7Tnpc8,3010 +cryptography/hazmat/primitives/twofactor/totp.py,sha256=cMbWlAapOM1SfezEx9MoMHpCW9ingNXCg6OsGv4T8jc,1473 +cryptography/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cryptography/utils.py,sha256=DfdXc9M4kmAboE2a0pPiISt5LVnW-jhhXURy8nDHae0,4018 +cryptography/x509/__init__.py,sha256=DzZE8bR-3iiVi3Wrcq7-g5Pm64fCr5aqsTNyi_rjJu0,7870 +cryptography/x509/__pycache__/__init__.cpython-311.pyc,, +cryptography/x509/__pycache__/base.cpython-311.pyc,, +cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc,, +cryptography/x509/__pycache__/extensions.cpython-311.pyc,, +cryptography/x509/__pycache__/general_name.cpython-311.pyc,, +cryptography/x509/__pycache__/name.cpython-311.pyc,, +cryptography/x509/__pycache__/ocsp.cpython-311.pyc,, +cryptography/x509/__pycache__/oid.cpython-311.pyc,, +cryptography/x509/base.py,sha256=FbS6EFE3uJ3O-zbFPRjsO6DckrNSN5TJNZMJcnzUWFQ,35677 +cryptography/x509/certificate_transparency.py,sha256=6HvzAD0dlSQVxy6tnDhGj0-pisp1MaJ9bxQNRr92inI,2261 +cryptography/x509/extensions.py,sha256=rFEcfZiFvcONs1ot03d68dAMK2U75w0s3g9mhyWBRcI,68365 +cryptography/x509/general_name.py,sha256=zm8GxNgVJuLD6rN488c5zdHhxp5gUxeRzw8enZMWDQ0,7868 +cryptography/x509/name.py,sha256=aZ2dpsinhkza3eTxT1vNmWuFMQ7fmcA0hs4npgnkf9Q,14855 +cryptography/x509/ocsp.py,sha256=48iW7xbZ9mZLELSEl7Wwjb4vYhOQ3KcNtqgKsAb_UD0,18534 +cryptography/x509/oid.py,sha256=fFosjGsnIB_w_0YrzZv1ggkSVwZl7xmY0zofKZNZkDA,829 diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/WHEEL b/billinglayer/python/cryptography-41.0.3.dist-info/WHEEL new file mode 100644 index 0000000..9aa479e --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.41.0) +Root-Is-Purelib: false +Tag: cp37-abi3-manylinux_2_17_x86_64 +Tag: cp37-abi3-manylinux2014_x86_64 + diff --git a/billinglayer/python/cryptography-41.0.3.dist-info/top_level.txt b/billinglayer/python/cryptography-41.0.3.dist-info/top_level.txt new file mode 100644 index 0000000..0d38bc5 --- /dev/null +++ b/billinglayer/python/cryptography-41.0.3.dist-info/top_level.txt @@ -0,0 +1 @@ +cryptography diff --git a/billinglayer/python/cryptography/__about__.py b/billinglayer/python/cryptography/__about__.py new file mode 100644 index 0000000..27273ef --- /dev/null +++ b/billinglayer/python/cryptography/__about__.py @@ -0,0 +1,17 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +__all__ = [ + "__version__", + "__author__", + "__copyright__", +] + +__version__ = "41.0.3" + + +__author__ = "The Python Cryptographic Authority and individual contributors" +__copyright__ = f"Copyright 2013-2023 {__author__}" diff --git a/billinglayer/python/cryptography/__init__.py b/billinglayer/python/cryptography/__init__.py new file mode 100644 index 0000000..86b9a25 --- /dev/null +++ b/billinglayer/python/cryptography/__init__.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.__about__ import __author__, __copyright__, __version__ + +__all__ = [ + "__version__", + "__author__", + "__copyright__", +] diff --git a/billinglayer/python/cryptography/__pycache__/__about__.cpython-311.pyc b/billinglayer/python/cryptography/__pycache__/__about__.cpython-311.pyc new file mode 100644 index 0000000..2f43a0d Binary files /dev/null and b/billinglayer/python/cryptography/__pycache__/__about__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..ac92a4d Binary files /dev/null and b/billinglayer/python/cryptography/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/__pycache__/exceptions.cpython-311.pyc b/billinglayer/python/cryptography/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..1600a94 Binary files /dev/null and b/billinglayer/python/cryptography/__pycache__/exceptions.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/__pycache__/fernet.cpython-311.pyc b/billinglayer/python/cryptography/__pycache__/fernet.cpython-311.pyc new file mode 100644 index 0000000..de22a49 Binary files /dev/null and b/billinglayer/python/cryptography/__pycache__/fernet.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/__pycache__/utils.cpython-311.pyc b/billinglayer/python/cryptography/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..1b11710 Binary files /dev/null and b/billinglayer/python/cryptography/__pycache__/utils.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/exceptions.py b/billinglayer/python/cryptography/exceptions.py new file mode 100644 index 0000000..47fdd18 --- /dev/null +++ b/billinglayer/python/cryptography/exceptions.py @@ -0,0 +1,54 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions + +if typing.TYPE_CHECKING: + from cryptography.hazmat.bindings._rust import openssl as rust_openssl + +_Reasons = rust_exceptions._Reasons + + +class UnsupportedAlgorithm(Exception): + def __init__( + self, message: str, reason: typing.Optional[_Reasons] = None + ) -> None: + super().__init__(message) + self._reason = reason + + +class AlreadyFinalized(Exception): + pass + + +class AlreadyUpdated(Exception): + pass + + +class NotYetFinalized(Exception): + pass + + +class InvalidTag(Exception): + pass + + +class InvalidSignature(Exception): + pass + + +class InternalError(Exception): + def __init__( + self, msg: str, err_code: typing.List[rust_openssl.OpenSSLError] + ) -> None: + super().__init__(msg) + self.err_code = err_code + + +class InvalidKey(Exception): + pass diff --git a/billinglayer/python/cryptography/fernet.py b/billinglayer/python/cryptography/fernet.py new file mode 100644 index 0000000..ad8fb40 --- /dev/null +++ b/billinglayer/python/cryptography/fernet.py @@ -0,0 +1,221 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import base64 +import binascii +import os +import time +import typing + +from cryptography import utils +from cryptography.exceptions import InvalidSignature +from cryptography.hazmat.primitives import hashes, padding +from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes +from cryptography.hazmat.primitives.hmac import HMAC + + +class InvalidToken(Exception): + pass + + +_MAX_CLOCK_SKEW = 60 + + +class Fernet: + def __init__( + self, + key: typing.Union[bytes, str], + backend: typing.Any = None, + ) -> None: + try: + key = base64.urlsafe_b64decode(key) + except binascii.Error as exc: + raise ValueError( + "Fernet key must be 32 url-safe base64-encoded bytes." + ) from exc + if len(key) != 32: + raise ValueError( + "Fernet key must be 32 url-safe base64-encoded bytes." + ) + + self._signing_key = key[:16] + self._encryption_key = key[16:] + + @classmethod + def generate_key(cls) -> bytes: + return base64.urlsafe_b64encode(os.urandom(32)) + + def encrypt(self, data: bytes) -> bytes: + return self.encrypt_at_time(data, int(time.time())) + + def encrypt_at_time(self, data: bytes, current_time: int) -> bytes: + iv = os.urandom(16) + return self._encrypt_from_parts(data, current_time, iv) + + def _encrypt_from_parts( + self, data: bytes, current_time: int, iv: bytes + ) -> bytes: + utils._check_bytes("data", data) + + padder = padding.PKCS7(algorithms.AES.block_size).padder() + padded_data = padder.update(data) + padder.finalize() + encryptor = Cipher( + algorithms.AES(self._encryption_key), + modes.CBC(iv), + ).encryptor() + ciphertext = encryptor.update(padded_data) + encryptor.finalize() + + basic_parts = ( + b"\x80" + + current_time.to_bytes(length=8, byteorder="big") + + iv + + ciphertext + ) + + h = HMAC(self._signing_key, hashes.SHA256()) + h.update(basic_parts) + hmac = h.finalize() + return base64.urlsafe_b64encode(basic_parts + hmac) + + def decrypt( + self, token: typing.Union[bytes, str], ttl: typing.Optional[int] = None + ) -> bytes: + timestamp, data = Fernet._get_unverified_token_data(token) + if ttl is None: + time_info = None + else: + time_info = (ttl, int(time.time())) + return self._decrypt_data(data, timestamp, time_info) + + def decrypt_at_time( + self, token: typing.Union[bytes, str], ttl: int, current_time: int + ) -> bytes: + if ttl is None: + raise ValueError( + "decrypt_at_time() can only be used with a non-None ttl" + ) + timestamp, data = Fernet._get_unverified_token_data(token) + return self._decrypt_data(data, timestamp, (ttl, current_time)) + + def extract_timestamp(self, token: typing.Union[bytes, str]) -> int: + timestamp, data = Fernet._get_unverified_token_data(token) + # Verify the token was not tampered with. + self._verify_signature(data) + return timestamp + + @staticmethod + def _get_unverified_token_data( + token: typing.Union[bytes, str] + ) -> typing.Tuple[int, bytes]: + if not isinstance(token, (str, bytes)): + raise TypeError("token must be bytes or str") + + try: + data = base64.urlsafe_b64decode(token) + except (TypeError, binascii.Error): + raise InvalidToken + + if not data or data[0] != 0x80: + raise InvalidToken + + if len(data) < 9: + raise InvalidToken + + timestamp = int.from_bytes(data[1:9], byteorder="big") + return timestamp, data + + def _verify_signature(self, data: bytes) -> None: + h = HMAC(self._signing_key, hashes.SHA256()) + h.update(data[:-32]) + try: + h.verify(data[-32:]) + except InvalidSignature: + raise InvalidToken + + def _decrypt_data( + self, + data: bytes, + timestamp: int, + time_info: typing.Optional[typing.Tuple[int, int]], + ) -> bytes: + if time_info is not None: + ttl, current_time = time_info + if timestamp + ttl < current_time: + raise InvalidToken + + if current_time + _MAX_CLOCK_SKEW < timestamp: + raise InvalidToken + + self._verify_signature(data) + + iv = data[9:25] + ciphertext = data[25:-32] + decryptor = Cipher( + algorithms.AES(self._encryption_key), modes.CBC(iv) + ).decryptor() + plaintext_padded = decryptor.update(ciphertext) + try: + plaintext_padded += decryptor.finalize() + except ValueError: + raise InvalidToken + unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder() + + unpadded = unpadder.update(plaintext_padded) + try: + unpadded += unpadder.finalize() + except ValueError: + raise InvalidToken + return unpadded + + +class MultiFernet: + def __init__(self, fernets: typing.Iterable[Fernet]): + fernets = list(fernets) + if not fernets: + raise ValueError( + "MultiFernet requires at least one Fernet instance" + ) + self._fernets = fernets + + def encrypt(self, msg: bytes) -> bytes: + return self.encrypt_at_time(msg, int(time.time())) + + def encrypt_at_time(self, msg: bytes, current_time: int) -> bytes: + return self._fernets[0].encrypt_at_time(msg, current_time) + + def rotate(self, msg: typing.Union[bytes, str]) -> bytes: + timestamp, data = Fernet._get_unverified_token_data(msg) + for f in self._fernets: + try: + p = f._decrypt_data(data, timestamp, None) + break + except InvalidToken: + pass + else: + raise InvalidToken + + iv = os.urandom(16) + return self._fernets[0]._encrypt_from_parts(p, timestamp, iv) + + def decrypt( + self, msg: typing.Union[bytes, str], ttl: typing.Optional[int] = None + ) -> bytes: + for f in self._fernets: + try: + return f.decrypt(msg, ttl) + except InvalidToken: + pass + raise InvalidToken + + def decrypt_at_time( + self, msg: typing.Union[bytes, str], ttl: int, current_time: int + ) -> bytes: + for f in self._fernets: + try: + return f.decrypt_at_time(msg, ttl, current_time) + except InvalidToken: + pass + raise InvalidToken diff --git a/billinglayer/python/cryptography/hazmat/__init__.py b/billinglayer/python/cryptography/hazmat/__init__.py new file mode 100644 index 0000000..b9f1187 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/__init__.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +""" +Hazardous Materials + +This is a "Hazardous Materials" module. You should ONLY use it if you're +100% absolutely sure that you know what you're doing because this module +is full of land mines, dragons, and dinosaurs with laser guns. +""" diff --git a/billinglayer/python/cryptography/hazmat/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b645fd3 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/__pycache__/_oid.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/__pycache__/_oid.cpython-311.pyc new file mode 100644 index 0000000..92ac8f5 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/__pycache__/_oid.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/_oid.py b/billinglayer/python/cryptography/hazmat/_oid.py new file mode 100644 index 0000000..01d4b34 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/_oid.py @@ -0,0 +1,299 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.bindings._rust import ( + ObjectIdentifier as ObjectIdentifier, +) +from cryptography.hazmat.primitives import hashes + + +class ExtensionOID: + SUBJECT_DIRECTORY_ATTRIBUTES = ObjectIdentifier("2.5.29.9") + SUBJECT_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.14") + KEY_USAGE = ObjectIdentifier("2.5.29.15") + SUBJECT_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.17") + ISSUER_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.18") + BASIC_CONSTRAINTS = ObjectIdentifier("2.5.29.19") + NAME_CONSTRAINTS = ObjectIdentifier("2.5.29.30") + CRL_DISTRIBUTION_POINTS = ObjectIdentifier("2.5.29.31") + CERTIFICATE_POLICIES = ObjectIdentifier("2.5.29.32") + POLICY_MAPPINGS = ObjectIdentifier("2.5.29.33") + AUTHORITY_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.35") + POLICY_CONSTRAINTS = ObjectIdentifier("2.5.29.36") + EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37") + FRESHEST_CRL = ObjectIdentifier("2.5.29.46") + INHIBIT_ANY_POLICY = ObjectIdentifier("2.5.29.54") + ISSUING_DISTRIBUTION_POINT = ObjectIdentifier("2.5.29.28") + AUTHORITY_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.1") + SUBJECT_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.11") + OCSP_NO_CHECK = ObjectIdentifier("1.3.6.1.5.5.7.48.1.5") + TLS_FEATURE = ObjectIdentifier("1.3.6.1.5.5.7.1.24") + CRL_NUMBER = ObjectIdentifier("2.5.29.20") + DELTA_CRL_INDICATOR = ObjectIdentifier("2.5.29.27") + PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier( + "1.3.6.1.4.1.11129.2.4.2" + ) + PRECERT_POISON = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.3") + SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.5") + MS_CERTIFICATE_TEMPLATE = ObjectIdentifier("1.3.6.1.4.1.311.21.7") + + +class OCSPExtensionOID: + NONCE = ObjectIdentifier("1.3.6.1.5.5.7.48.1.2") + ACCEPTABLE_RESPONSES = ObjectIdentifier("1.3.6.1.5.5.7.48.1.4") + + +class CRLEntryExtensionOID: + CERTIFICATE_ISSUER = ObjectIdentifier("2.5.29.29") + CRL_REASON = ObjectIdentifier("2.5.29.21") + INVALIDITY_DATE = ObjectIdentifier("2.5.29.24") + + +class NameOID: + COMMON_NAME = ObjectIdentifier("2.5.4.3") + COUNTRY_NAME = ObjectIdentifier("2.5.4.6") + LOCALITY_NAME = ObjectIdentifier("2.5.4.7") + STATE_OR_PROVINCE_NAME = ObjectIdentifier("2.5.4.8") + STREET_ADDRESS = ObjectIdentifier("2.5.4.9") + ORGANIZATION_NAME = ObjectIdentifier("2.5.4.10") + ORGANIZATIONAL_UNIT_NAME = ObjectIdentifier("2.5.4.11") + SERIAL_NUMBER = ObjectIdentifier("2.5.4.5") + SURNAME = ObjectIdentifier("2.5.4.4") + GIVEN_NAME = ObjectIdentifier("2.5.4.42") + TITLE = ObjectIdentifier("2.5.4.12") + INITIALS = ObjectIdentifier("2.5.4.43") + GENERATION_QUALIFIER = ObjectIdentifier("2.5.4.44") + X500_UNIQUE_IDENTIFIER = ObjectIdentifier("2.5.4.45") + DN_QUALIFIER = ObjectIdentifier("2.5.4.46") + PSEUDONYM = ObjectIdentifier("2.5.4.65") + USER_ID = ObjectIdentifier("0.9.2342.19200300.100.1.1") + DOMAIN_COMPONENT = ObjectIdentifier("0.9.2342.19200300.100.1.25") + EMAIL_ADDRESS = ObjectIdentifier("1.2.840.113549.1.9.1") + JURISDICTION_COUNTRY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.3") + JURISDICTION_LOCALITY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.1") + JURISDICTION_STATE_OR_PROVINCE_NAME = ObjectIdentifier( + "1.3.6.1.4.1.311.60.2.1.2" + ) + BUSINESS_CATEGORY = ObjectIdentifier("2.5.4.15") + POSTAL_ADDRESS = ObjectIdentifier("2.5.4.16") + POSTAL_CODE = ObjectIdentifier("2.5.4.17") + INN = ObjectIdentifier("1.2.643.3.131.1.1") + OGRN = ObjectIdentifier("1.2.643.100.1") + SNILS = ObjectIdentifier("1.2.643.100.3") + UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2") + + +class SignatureAlgorithmOID: + RSA_WITH_MD5 = ObjectIdentifier("1.2.840.113549.1.1.4") + RSA_WITH_SHA1 = ObjectIdentifier("1.2.840.113549.1.1.5") + # This is an alternate OID for RSA with SHA1 that is occasionally seen + _RSA_WITH_SHA1 = ObjectIdentifier("1.3.14.3.2.29") + RSA_WITH_SHA224 = ObjectIdentifier("1.2.840.113549.1.1.14") + RSA_WITH_SHA256 = ObjectIdentifier("1.2.840.113549.1.1.11") + RSA_WITH_SHA384 = ObjectIdentifier("1.2.840.113549.1.1.12") + RSA_WITH_SHA512 = ObjectIdentifier("1.2.840.113549.1.1.13") + RSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.13") + RSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.14") + RSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.15") + RSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.16") + RSASSA_PSS = ObjectIdentifier("1.2.840.113549.1.1.10") + ECDSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10045.4.1") + ECDSA_WITH_SHA224 = ObjectIdentifier("1.2.840.10045.4.3.1") + ECDSA_WITH_SHA256 = ObjectIdentifier("1.2.840.10045.4.3.2") + ECDSA_WITH_SHA384 = ObjectIdentifier("1.2.840.10045.4.3.3") + ECDSA_WITH_SHA512 = ObjectIdentifier("1.2.840.10045.4.3.4") + ECDSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.9") + ECDSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.10") + ECDSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.11") + ECDSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.12") + DSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10040.4.3") + DSA_WITH_SHA224 = ObjectIdentifier("2.16.840.1.101.3.4.3.1") + DSA_WITH_SHA256 = ObjectIdentifier("2.16.840.1.101.3.4.3.2") + DSA_WITH_SHA384 = ObjectIdentifier("2.16.840.1.101.3.4.3.3") + DSA_WITH_SHA512 = ObjectIdentifier("2.16.840.1.101.3.4.3.4") + ED25519 = ObjectIdentifier("1.3.101.112") + ED448 = ObjectIdentifier("1.3.101.113") + GOSTR3411_94_WITH_3410_2001 = ObjectIdentifier("1.2.643.2.2.3") + GOSTR3410_2012_WITH_3411_2012_256 = ObjectIdentifier("1.2.643.7.1.1.3.2") + GOSTR3410_2012_WITH_3411_2012_512 = ObjectIdentifier("1.2.643.7.1.1.3.3") + + +_SIG_OIDS_TO_HASH: typing.Dict[ + ObjectIdentifier, typing.Optional[hashes.HashAlgorithm] +] = { + SignatureAlgorithmOID.RSA_WITH_MD5: hashes.MD5(), + SignatureAlgorithmOID.RSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID._RSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID.RSA_WITH_SHA224: hashes.SHA224(), + SignatureAlgorithmOID.RSA_WITH_SHA256: hashes.SHA256(), + SignatureAlgorithmOID.RSA_WITH_SHA384: hashes.SHA384(), + SignatureAlgorithmOID.RSA_WITH_SHA512: hashes.SHA512(), + SignatureAlgorithmOID.RSA_WITH_SHA3_224: hashes.SHA3_224(), + SignatureAlgorithmOID.RSA_WITH_SHA3_256: hashes.SHA3_256(), + SignatureAlgorithmOID.RSA_WITH_SHA3_384: hashes.SHA3_384(), + SignatureAlgorithmOID.RSA_WITH_SHA3_512: hashes.SHA3_512(), + SignatureAlgorithmOID.ECDSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID.ECDSA_WITH_SHA224: hashes.SHA224(), + SignatureAlgorithmOID.ECDSA_WITH_SHA256: hashes.SHA256(), + SignatureAlgorithmOID.ECDSA_WITH_SHA384: hashes.SHA384(), + SignatureAlgorithmOID.ECDSA_WITH_SHA512: hashes.SHA512(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_224: hashes.SHA3_224(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_256: hashes.SHA3_256(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_384: hashes.SHA3_384(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_512: hashes.SHA3_512(), + SignatureAlgorithmOID.DSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID.DSA_WITH_SHA224: hashes.SHA224(), + SignatureAlgorithmOID.DSA_WITH_SHA256: hashes.SHA256(), + SignatureAlgorithmOID.ED25519: None, + SignatureAlgorithmOID.ED448: None, + SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: None, + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: None, + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: None, +} + + +class ExtendedKeyUsageOID: + SERVER_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.1") + CLIENT_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.2") + CODE_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.3") + EMAIL_PROTECTION = ObjectIdentifier("1.3.6.1.5.5.7.3.4") + TIME_STAMPING = ObjectIdentifier("1.3.6.1.5.5.7.3.8") + OCSP_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.9") + ANY_EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37.0") + SMARTCARD_LOGON = ObjectIdentifier("1.3.6.1.4.1.311.20.2.2") + KERBEROS_PKINIT_KDC = ObjectIdentifier("1.3.6.1.5.2.3.5") + IPSEC_IKE = ObjectIdentifier("1.3.6.1.5.5.7.3.17") + CERTIFICATE_TRANSPARENCY = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.4") + + +class AuthorityInformationAccessOID: + CA_ISSUERS = ObjectIdentifier("1.3.6.1.5.5.7.48.2") + OCSP = ObjectIdentifier("1.3.6.1.5.5.7.48.1") + + +class SubjectInformationAccessOID: + CA_REPOSITORY = ObjectIdentifier("1.3.6.1.5.5.7.48.5") + + +class CertificatePoliciesOID: + CPS_QUALIFIER = ObjectIdentifier("1.3.6.1.5.5.7.2.1") + CPS_USER_NOTICE = ObjectIdentifier("1.3.6.1.5.5.7.2.2") + ANY_POLICY = ObjectIdentifier("2.5.29.32.0") + + +class AttributeOID: + CHALLENGE_PASSWORD = ObjectIdentifier("1.2.840.113549.1.9.7") + UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2") + + +_OID_NAMES = { + NameOID.COMMON_NAME: "commonName", + NameOID.COUNTRY_NAME: "countryName", + NameOID.LOCALITY_NAME: "localityName", + NameOID.STATE_OR_PROVINCE_NAME: "stateOrProvinceName", + NameOID.STREET_ADDRESS: "streetAddress", + NameOID.ORGANIZATION_NAME: "organizationName", + NameOID.ORGANIZATIONAL_UNIT_NAME: "organizationalUnitName", + NameOID.SERIAL_NUMBER: "serialNumber", + NameOID.SURNAME: "surname", + NameOID.GIVEN_NAME: "givenName", + NameOID.TITLE: "title", + NameOID.GENERATION_QUALIFIER: "generationQualifier", + NameOID.X500_UNIQUE_IDENTIFIER: "x500UniqueIdentifier", + NameOID.DN_QUALIFIER: "dnQualifier", + NameOID.PSEUDONYM: "pseudonym", + NameOID.USER_ID: "userID", + NameOID.DOMAIN_COMPONENT: "domainComponent", + NameOID.EMAIL_ADDRESS: "emailAddress", + NameOID.JURISDICTION_COUNTRY_NAME: "jurisdictionCountryName", + NameOID.JURISDICTION_LOCALITY_NAME: "jurisdictionLocalityName", + NameOID.JURISDICTION_STATE_OR_PROVINCE_NAME: ( + "jurisdictionStateOrProvinceName" + ), + NameOID.BUSINESS_CATEGORY: "businessCategory", + NameOID.POSTAL_ADDRESS: "postalAddress", + NameOID.POSTAL_CODE: "postalCode", + NameOID.INN: "INN", + NameOID.OGRN: "OGRN", + NameOID.SNILS: "SNILS", + NameOID.UNSTRUCTURED_NAME: "unstructuredName", + SignatureAlgorithmOID.RSA_WITH_MD5: "md5WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA1: "sha1WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA224: "sha224WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA256: "sha256WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA384: "sha384WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA512: "sha512WithRSAEncryption", + SignatureAlgorithmOID.RSASSA_PSS: "RSASSA-PSS", + SignatureAlgorithmOID.ECDSA_WITH_SHA1: "ecdsa-with-SHA1", + SignatureAlgorithmOID.ECDSA_WITH_SHA224: "ecdsa-with-SHA224", + SignatureAlgorithmOID.ECDSA_WITH_SHA256: "ecdsa-with-SHA256", + SignatureAlgorithmOID.ECDSA_WITH_SHA384: "ecdsa-with-SHA384", + SignatureAlgorithmOID.ECDSA_WITH_SHA512: "ecdsa-with-SHA512", + SignatureAlgorithmOID.DSA_WITH_SHA1: "dsa-with-sha1", + SignatureAlgorithmOID.DSA_WITH_SHA224: "dsa-with-sha224", + SignatureAlgorithmOID.DSA_WITH_SHA256: "dsa-with-sha256", + SignatureAlgorithmOID.ED25519: "ed25519", + SignatureAlgorithmOID.ED448: "ed448", + SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: ( + "GOST R 34.11-94 with GOST R 34.10-2001" + ), + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: ( + "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" + ), + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: ( + "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" + ), + ExtendedKeyUsageOID.SERVER_AUTH: "serverAuth", + ExtendedKeyUsageOID.CLIENT_AUTH: "clientAuth", + ExtendedKeyUsageOID.CODE_SIGNING: "codeSigning", + ExtendedKeyUsageOID.EMAIL_PROTECTION: "emailProtection", + ExtendedKeyUsageOID.TIME_STAMPING: "timeStamping", + ExtendedKeyUsageOID.OCSP_SIGNING: "OCSPSigning", + ExtendedKeyUsageOID.SMARTCARD_LOGON: "msSmartcardLogin", + ExtendedKeyUsageOID.KERBEROS_PKINIT_KDC: "pkInitKDC", + ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES: "subjectDirectoryAttributes", + ExtensionOID.SUBJECT_KEY_IDENTIFIER: "subjectKeyIdentifier", + ExtensionOID.KEY_USAGE: "keyUsage", + ExtensionOID.SUBJECT_ALTERNATIVE_NAME: "subjectAltName", + ExtensionOID.ISSUER_ALTERNATIVE_NAME: "issuerAltName", + ExtensionOID.BASIC_CONSTRAINTS: "basicConstraints", + ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS: ( + "signedCertificateTimestampList" + ), + ExtensionOID.SIGNED_CERTIFICATE_TIMESTAMPS: ( + "signedCertificateTimestampList" + ), + ExtensionOID.PRECERT_POISON: "ctPoison", + ExtensionOID.MS_CERTIFICATE_TEMPLATE: "msCertificateTemplate", + CRLEntryExtensionOID.CRL_REASON: "cRLReason", + CRLEntryExtensionOID.INVALIDITY_DATE: "invalidityDate", + CRLEntryExtensionOID.CERTIFICATE_ISSUER: "certificateIssuer", + ExtensionOID.NAME_CONSTRAINTS: "nameConstraints", + ExtensionOID.CRL_DISTRIBUTION_POINTS: "cRLDistributionPoints", + ExtensionOID.CERTIFICATE_POLICIES: "certificatePolicies", + ExtensionOID.POLICY_MAPPINGS: "policyMappings", + ExtensionOID.AUTHORITY_KEY_IDENTIFIER: "authorityKeyIdentifier", + ExtensionOID.POLICY_CONSTRAINTS: "policyConstraints", + ExtensionOID.EXTENDED_KEY_USAGE: "extendedKeyUsage", + ExtensionOID.FRESHEST_CRL: "freshestCRL", + ExtensionOID.INHIBIT_ANY_POLICY: "inhibitAnyPolicy", + ExtensionOID.ISSUING_DISTRIBUTION_POINT: ("issuingDistributionPoint"), + ExtensionOID.AUTHORITY_INFORMATION_ACCESS: "authorityInfoAccess", + ExtensionOID.SUBJECT_INFORMATION_ACCESS: "subjectInfoAccess", + ExtensionOID.OCSP_NO_CHECK: "OCSPNoCheck", + ExtensionOID.CRL_NUMBER: "cRLNumber", + ExtensionOID.DELTA_CRL_INDICATOR: "deltaCRLIndicator", + ExtensionOID.TLS_FEATURE: "TLSFeature", + AuthorityInformationAccessOID.OCSP: "OCSP", + AuthorityInformationAccessOID.CA_ISSUERS: "caIssuers", + SubjectInformationAccessOID.CA_REPOSITORY: "caRepository", + CertificatePoliciesOID.CPS_QUALIFIER: "id-qt-cps", + CertificatePoliciesOID.CPS_USER_NOTICE: "id-qt-unotice", + OCSPExtensionOID.NONCE: "OCSPNonce", + AttributeOID.CHALLENGE_PASSWORD: "challengePassword", +} diff --git a/billinglayer/python/cryptography/hazmat/backends/__init__.py b/billinglayer/python/cryptography/hazmat/backends/__init__.py new file mode 100644 index 0000000..b4400aa --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/__init__.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from typing import Any + + +def default_backend() -> Any: + from cryptography.hazmat.backends.openssl.backend import backend + + return backend diff --git a/billinglayer/python/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..f474f9f Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__init__.py b/billinglayer/python/cryptography/hazmat/backends/openssl/__init__.py new file mode 100644 index 0000000..51b0447 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/__init__.py @@ -0,0 +1,9 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.backends.openssl.backend import backend + +__all__ = ["backend"] diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e860eba Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc new file mode 100644 index 0000000..7d21854 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc new file mode 100644 index 0000000..39613a8 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc new file mode 100644 index 0000000..b27709b Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc new file mode 100644 index 0000000..bba7f38 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc new file mode 100644 index 0000000..6e95d5b Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc new file mode 100644 index 0000000..dc39362 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc new file mode 100644 index 0000000..74a1dd7 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..a62b70b Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/aead.py b/billinglayer/python/cryptography/hazmat/backends/openssl/aead.py new file mode 100644 index 0000000..b36f535 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/aead.py @@ -0,0 +1,527 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import InvalidTag + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + from cryptography.hazmat.primitives.ciphers.aead import ( + AESCCM, + AESGCM, + AESOCB3, + AESSIV, + ChaCha20Poly1305, + ) + + _AEADTypes = typing.Union[ + AESCCM, AESGCM, AESOCB3, AESSIV, ChaCha20Poly1305 + ] + + +def _is_evp_aead_supported_cipher( + backend: Backend, cipher: _AEADTypes +) -> bool: + """ + Checks whether the given cipher is supported through + EVP_AEAD rather than the normal OpenSSL EVP_CIPHER API. + """ + from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305 + + return backend._lib.Cryptography_HAS_EVP_AEAD and isinstance( + cipher, ChaCha20Poly1305 + ) + + +def _aead_cipher_supported(backend: Backend, cipher: _AEADTypes) -> bool: + if _is_evp_aead_supported_cipher(backend, cipher): + return True + else: + cipher_name = _evp_cipher_cipher_name(cipher) + if backend._fips_enabled and cipher_name not in backend._fips_aead: + return False + # SIV isn't loaded through get_cipherbyname but instead a new fetch API + # only available in 3.0+. But if we know we're on 3.0+ then we know + # it's supported. + if cipher_name.endswith(b"-siv"): + return backend._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER == 1 + else: + return ( + backend._lib.EVP_get_cipherbyname(cipher_name) + != backend._ffi.NULL + ) + + +def _aead_create_ctx( + backend: Backend, + cipher: _AEADTypes, + key: bytes, +): + if _is_evp_aead_supported_cipher(backend, cipher): + return _evp_aead_create_ctx(backend, cipher, key) + else: + return _evp_cipher_create_ctx(backend, cipher, key) + + +def _encrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + if _is_evp_aead_supported_cipher(backend, cipher): + return _evp_aead_encrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + else: + return _evp_cipher_encrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + + +def _decrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + if _is_evp_aead_supported_cipher(backend, cipher): + return _evp_aead_decrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + else: + return _evp_cipher_decrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + + +def _evp_aead_create_ctx( + backend: Backend, + cipher: _AEADTypes, + key: bytes, + tag_len: typing.Optional[int] = None, +): + aead_cipher = _evp_aead_get_cipher(backend, cipher) + assert aead_cipher is not None + key_ptr = backend._ffi.from_buffer(key) + tag_len = ( + backend._lib.EVP_AEAD_DEFAULT_TAG_LENGTH + if tag_len is None + else tag_len + ) + ctx = backend._lib.Cryptography_EVP_AEAD_CTX_new( + aead_cipher, key_ptr, len(key), tag_len + ) + backend.openssl_assert(ctx != backend._ffi.NULL) + ctx = backend._ffi.gc(ctx, backend._lib.EVP_AEAD_CTX_free) + return ctx + + +def _evp_aead_get_cipher(backend: Backend, cipher: _AEADTypes): + from cryptography.hazmat.primitives.ciphers.aead import ( + ChaCha20Poly1305, + ) + + # Currently only ChaCha20-Poly1305 is supported using this API + assert isinstance(cipher, ChaCha20Poly1305) + return backend._lib.EVP_aead_chacha20_poly1305() + + +def _evp_aead_encrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any, +) -> bytes: + assert ctx is not None + + aead_cipher = _evp_aead_get_cipher(backend, cipher) + assert aead_cipher is not None + + out_len = backend._ffi.new("size_t *") + # max_out_len should be in_len plus the result of + # EVP_AEAD_max_overhead. + max_out_len = len(data) + backend._lib.EVP_AEAD_max_overhead(aead_cipher) + out_buf = backend._ffi.new("uint8_t[]", max_out_len) + data_ptr = backend._ffi.from_buffer(data) + nonce_ptr = backend._ffi.from_buffer(nonce) + aad = b"".join(associated_data) + aad_ptr = backend._ffi.from_buffer(aad) + + res = backend._lib.EVP_AEAD_CTX_seal( + ctx, + out_buf, + out_len, + max_out_len, + nonce_ptr, + len(nonce), + data_ptr, + len(data), + aad_ptr, + len(aad), + ) + backend.openssl_assert(res == 1) + encrypted_data = backend._ffi.buffer(out_buf, out_len[0])[:] + return encrypted_data + + +def _evp_aead_decrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any, +) -> bytes: + if len(data) < tag_length: + raise InvalidTag + + assert ctx is not None + + out_len = backend._ffi.new("size_t *") + # max_out_len should at least in_len + max_out_len = len(data) + out_buf = backend._ffi.new("uint8_t[]", max_out_len) + data_ptr = backend._ffi.from_buffer(data) + nonce_ptr = backend._ffi.from_buffer(nonce) + aad = b"".join(associated_data) + aad_ptr = backend._ffi.from_buffer(aad) + + res = backend._lib.EVP_AEAD_CTX_open( + ctx, + out_buf, + out_len, + max_out_len, + nonce_ptr, + len(nonce), + data_ptr, + len(data), + aad_ptr, + len(aad), + ) + + if res == 0: + backend._consume_errors() + raise InvalidTag + + decrypted_data = backend._ffi.buffer(out_buf, out_len[0])[:] + return decrypted_data + + +_ENCRYPT = 1 +_DECRYPT = 0 + + +def _evp_cipher_cipher_name(cipher: _AEADTypes) -> bytes: + from cryptography.hazmat.primitives.ciphers.aead import ( + AESCCM, + AESGCM, + AESOCB3, + AESSIV, + ChaCha20Poly1305, + ) + + if isinstance(cipher, ChaCha20Poly1305): + return b"chacha20-poly1305" + elif isinstance(cipher, AESCCM): + return f"aes-{len(cipher._key) * 8}-ccm".encode("ascii") + elif isinstance(cipher, AESOCB3): + return f"aes-{len(cipher._key) * 8}-ocb".encode("ascii") + elif isinstance(cipher, AESSIV): + return f"aes-{len(cipher._key) * 8 // 2}-siv".encode("ascii") + else: + assert isinstance(cipher, AESGCM) + return f"aes-{len(cipher._key) * 8}-gcm".encode("ascii") + + +def _evp_cipher(cipher_name: bytes, backend: Backend): + if cipher_name.endswith(b"-siv"): + evp_cipher = backend._lib.EVP_CIPHER_fetch( + backend._ffi.NULL, + cipher_name, + backend._ffi.NULL, + ) + backend.openssl_assert(evp_cipher != backend._ffi.NULL) + evp_cipher = backend._ffi.gc(evp_cipher, backend._lib.EVP_CIPHER_free) + else: + evp_cipher = backend._lib.EVP_get_cipherbyname(cipher_name) + backend.openssl_assert(evp_cipher != backend._ffi.NULL) + + return evp_cipher + + +def _evp_cipher_create_ctx( + backend: Backend, + cipher: _AEADTypes, + key: bytes, +): + ctx = backend._lib.EVP_CIPHER_CTX_new() + backend.openssl_assert(ctx != backend._ffi.NULL) + ctx = backend._ffi.gc(ctx, backend._lib.EVP_CIPHER_CTX_free) + cipher_name = _evp_cipher_cipher_name(cipher) + evp_cipher = _evp_cipher(cipher_name, backend) + key_ptr = backend._ffi.from_buffer(key) + res = backend._lib.EVP_CipherInit_ex( + ctx, + evp_cipher, + backend._ffi.NULL, + key_ptr, + backend._ffi.NULL, + 0, + ) + backend.openssl_assert(res != 0) + return ctx + + +def _evp_cipher_aead_setup( + backend: Backend, + cipher_name: bytes, + key: bytes, + nonce: bytes, + tag: typing.Optional[bytes], + tag_len: int, + operation: int, +): + evp_cipher = _evp_cipher(cipher_name, backend) + ctx = backend._lib.EVP_CIPHER_CTX_new() + ctx = backend._ffi.gc(ctx, backend._lib.EVP_CIPHER_CTX_free) + res = backend._lib.EVP_CipherInit_ex( + ctx, + evp_cipher, + backend._ffi.NULL, + backend._ffi.NULL, + backend._ffi.NULL, + int(operation == _ENCRYPT), + ) + backend.openssl_assert(res != 0) + # CCM requires the IVLEN to be set before calling SET_TAG on decrypt + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + backend._lib.EVP_CTRL_AEAD_SET_IVLEN, + len(nonce), + backend._ffi.NULL, + ) + backend.openssl_assert(res != 0) + if operation == _DECRYPT: + assert tag is not None + _evp_cipher_set_tag(backend, ctx, tag) + elif cipher_name.endswith(b"-ccm"): + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + backend._lib.EVP_CTRL_AEAD_SET_TAG, + tag_len, + backend._ffi.NULL, + ) + backend.openssl_assert(res != 0) + + nonce_ptr = backend._ffi.from_buffer(nonce) + key_ptr = backend._ffi.from_buffer(key) + res = backend._lib.EVP_CipherInit_ex( + ctx, + backend._ffi.NULL, + backend._ffi.NULL, + key_ptr, + nonce_ptr, + int(operation == _ENCRYPT), + ) + backend.openssl_assert(res != 0) + return ctx + + +def _evp_cipher_set_tag(backend, ctx, tag: bytes) -> None: + tag_ptr = backend._ffi.from_buffer(tag) + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag_ptr + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_set_nonce_operation( + backend, ctx, nonce: bytes, operation: int +) -> None: + nonce_ptr = backend._ffi.from_buffer(nonce) + res = backend._lib.EVP_CipherInit_ex( + ctx, + backend._ffi.NULL, + backend._ffi.NULL, + backend._ffi.NULL, + nonce_ptr, + int(operation == _ENCRYPT), + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_set_length(backend: Backend, ctx, data_len: int) -> None: + intptr = backend._ffi.new("int *") + res = backend._lib.EVP_CipherUpdate( + ctx, backend._ffi.NULL, intptr, backend._ffi.NULL, data_len + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_process_aad( + backend: Backend, ctx, associated_data: bytes +) -> None: + outlen = backend._ffi.new("int *") + a_data_ptr = backend._ffi.from_buffer(associated_data) + res = backend._lib.EVP_CipherUpdate( + ctx, backend._ffi.NULL, outlen, a_data_ptr, len(associated_data) + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_process_data(backend: Backend, ctx, data: bytes) -> bytes: + outlen = backend._ffi.new("int *") + buf = backend._ffi.new("unsigned char[]", len(data)) + data_ptr = backend._ffi.from_buffer(data) + res = backend._lib.EVP_CipherUpdate(ctx, buf, outlen, data_ptr, len(data)) + if res == 0: + # AES SIV can error here if the data is invalid on decrypt + backend._consume_errors() + raise InvalidTag + return backend._ffi.buffer(buf, outlen[0])[:] + + +def _evp_cipher_encrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + from cryptography.hazmat.primitives.ciphers.aead import AESCCM, AESSIV + + if ctx is None: + cipher_name = _evp_cipher_cipher_name(cipher) + ctx = _evp_cipher_aead_setup( + backend, + cipher_name, + cipher._key, + nonce, + None, + tag_length, + _ENCRYPT, + ) + else: + _evp_cipher_set_nonce_operation(backend, ctx, nonce, _ENCRYPT) + + # CCM requires us to pass the length of the data before processing + # anything. + # However calling this with any other AEAD results in an error + if isinstance(cipher, AESCCM): + _evp_cipher_set_length(backend, ctx, len(data)) + + for ad in associated_data: + _evp_cipher_process_aad(backend, ctx, ad) + processed_data = _evp_cipher_process_data(backend, ctx, data) + outlen = backend._ffi.new("int *") + # All AEADs we support besides OCB are streaming so they return nothing + # in finalization. OCB can return up to (16 byte block - 1) bytes so + # we need a buffer here too. + buf = backend._ffi.new("unsigned char[]", 16) + res = backend._lib.EVP_CipherFinal_ex(ctx, buf, outlen) + backend.openssl_assert(res != 0) + processed_data += backend._ffi.buffer(buf, outlen[0])[:] + tag_buf = backend._ffi.new("unsigned char[]", tag_length) + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, backend._lib.EVP_CTRL_AEAD_GET_TAG, tag_length, tag_buf + ) + backend.openssl_assert(res != 0) + tag = backend._ffi.buffer(tag_buf)[:] + + if isinstance(cipher, AESSIV): + # RFC 5297 defines the output as IV || C, where the tag we generate + # is the "IV" and C is the ciphertext. This is the opposite of our + # other AEADs, which are Ciphertext || Tag + backend.openssl_assert(len(tag) == 16) + return tag + processed_data + else: + return processed_data + tag + + +def _evp_cipher_decrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + from cryptography.hazmat.primitives.ciphers.aead import AESCCM, AESSIV + + if len(data) < tag_length: + raise InvalidTag + + if isinstance(cipher, AESSIV): + # RFC 5297 defines the output as IV || C, where the tag we generate + # is the "IV" and C is the ciphertext. This is the opposite of our + # other AEADs, which are Ciphertext || Tag + tag = data[:tag_length] + data = data[tag_length:] + else: + tag = data[-tag_length:] + data = data[:-tag_length] + if ctx is None: + cipher_name = _evp_cipher_cipher_name(cipher) + ctx = _evp_cipher_aead_setup( + backend, + cipher_name, + cipher._key, + nonce, + tag, + tag_length, + _DECRYPT, + ) + else: + _evp_cipher_set_nonce_operation(backend, ctx, nonce, _DECRYPT) + _evp_cipher_set_tag(backend, ctx, tag) + + # CCM requires us to pass the length of the data before processing + # anything. + # However calling this with any other AEAD results in an error + if isinstance(cipher, AESCCM): + _evp_cipher_set_length(backend, ctx, len(data)) + + for ad in associated_data: + _evp_cipher_process_aad(backend, ctx, ad) + # CCM has a different error path if the tag doesn't match. Errors are + # raised in Update and Final is irrelevant. + if isinstance(cipher, AESCCM): + outlen = backend._ffi.new("int *") + buf = backend._ffi.new("unsigned char[]", len(data)) + d_ptr = backend._ffi.from_buffer(data) + res = backend._lib.EVP_CipherUpdate(ctx, buf, outlen, d_ptr, len(data)) + if res != 1: + backend._consume_errors() + raise InvalidTag + + processed_data = backend._ffi.buffer(buf, outlen[0])[:] + else: + processed_data = _evp_cipher_process_data(backend, ctx, data) + outlen = backend._ffi.new("int *") + # OCB can return up to 15 bytes (16 byte block - 1) in finalization + buf = backend._ffi.new("unsigned char[]", 16) + res = backend._lib.EVP_CipherFinal_ex(ctx, buf, outlen) + processed_data += backend._ffi.buffer(buf, outlen[0])[:] + if res == 0: + backend._consume_errors() + raise InvalidTag + + return processed_data diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/backend.py b/billinglayer/python/cryptography/hazmat/backends/openssl/backend.py new file mode 100644 index 0000000..02d5109 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/backend.py @@ -0,0 +1,1935 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import collections +import contextlib +import itertools +import typing +from contextlib import contextmanager + +from cryptography import utils, x509 +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.backends.openssl import aead +from cryptography.hazmat.backends.openssl.ciphers import _CipherContext +from cryptography.hazmat.backends.openssl.cmac import _CMACContext +from cryptography.hazmat.backends.openssl.ec import ( + _EllipticCurvePrivateKey, + _EllipticCurvePublicKey, +) +from cryptography.hazmat.backends.openssl.rsa import ( + _RSAPrivateKey, + _RSAPublicKey, +) +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.bindings.openssl import binding +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives._asymmetric import AsymmetricPadding +from cryptography.hazmat.primitives.asymmetric import ( + dh, + dsa, + ec, + ed448, + ed25519, + rsa, + x448, + x25519, +) +from cryptography.hazmat.primitives.asymmetric.padding import ( + MGF1, + OAEP, + PSS, + PKCS1v15, +) +from cryptography.hazmat.primitives.asymmetric.types import ( + PrivateKeyTypes, + PublicKeyTypes, +) +from cryptography.hazmat.primitives.ciphers import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) +from cryptography.hazmat.primitives.ciphers.algorithms import ( + AES, + AES128, + AES256, + ARC4, + SM4, + Camellia, + ChaCha20, + TripleDES, + _BlowfishInternal, + _CAST5Internal, + _IDEAInternal, + _SEEDInternal, +) +from cryptography.hazmat.primitives.ciphers.modes import ( + CBC, + CFB, + CFB8, + CTR, + ECB, + GCM, + OFB, + XTS, + Mode, +) +from cryptography.hazmat.primitives.serialization import ssh +from cryptography.hazmat.primitives.serialization.pkcs12 import ( + PBES, + PKCS12Certificate, + PKCS12KeyAndCertificates, + PKCS12PrivateKeyTypes, + _PKCS12CATypes, +) + +_MemoryBIO = collections.namedtuple("_MemoryBIO", ["bio", "char_ptr"]) + + +# Not actually supported, just used as a marker for some serialization tests. +class _RC2: + pass + + +class Backend: + """ + OpenSSL API binding interfaces. + """ + + name = "openssl" + + # FIPS has opinions about acceptable algorithms and key sizes, but the + # disallowed algorithms are still present in OpenSSL. They just error if + # you try to use them. To avoid that we allowlist the algorithms in + # FIPS 140-3. This isn't ideal, but FIPS 140-3 is trash so here we are. + _fips_aead = { + b"aes-128-ccm", + b"aes-192-ccm", + b"aes-256-ccm", + b"aes-128-gcm", + b"aes-192-gcm", + b"aes-256-gcm", + } + # TripleDES encryption is disallowed/deprecated throughout 2023 in + # FIPS 140-3. To keep it simple we denylist any use of TripleDES (TDEA). + _fips_ciphers = (AES,) + # Sometimes SHA1 is still permissible. That logic is contained + # within the various *_supported methods. + _fips_hashes = ( + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + hashes.SHA512_224, + hashes.SHA512_256, + hashes.SHA3_224, + hashes.SHA3_256, + hashes.SHA3_384, + hashes.SHA3_512, + hashes.SHAKE128, + hashes.SHAKE256, + ) + _fips_ecdh_curves = ( + ec.SECP224R1, + ec.SECP256R1, + ec.SECP384R1, + ec.SECP521R1, + ) + _fips_rsa_min_key_size = 2048 + _fips_rsa_min_public_exponent = 65537 + _fips_dsa_min_modulus = 1 << 2048 + _fips_dh_min_key_size = 2048 + _fips_dh_min_modulus = 1 << _fips_dh_min_key_size + + def __init__(self) -> None: + self._binding = binding.Binding() + self._ffi = self._binding.ffi + self._lib = self._binding.lib + self._fips_enabled = rust_openssl.is_fips_enabled() + + self._cipher_registry: typing.Dict[ + typing.Tuple[typing.Type[CipherAlgorithm], typing.Type[Mode]], + typing.Callable, + ] = {} + self._register_default_ciphers() + self._dh_types = [self._lib.EVP_PKEY_DH] + if self._lib.Cryptography_HAS_EVP_PKEY_DHX: + self._dh_types.append(self._lib.EVP_PKEY_DHX) + + def __repr__(self) -> str: + return "".format( + self.openssl_version_text(), + self._fips_enabled, + self._binding._legacy_provider_loaded, + ) + + def openssl_assert( + self, + ok: bool, + errors: typing.Optional[typing.List[rust_openssl.OpenSSLError]] = None, + ) -> None: + return binding._openssl_assert(self._lib, ok, errors=errors) + + def _enable_fips(self) -> None: + # This function enables FIPS mode for OpenSSL 3.0.0 on installs that + # have the FIPS provider installed properly. + self._binding._enable_fips() + assert rust_openssl.is_fips_enabled() + self._fips_enabled = rust_openssl.is_fips_enabled() + + def openssl_version_text(self) -> str: + """ + Friendly string name of the loaded OpenSSL library. This is not + necessarily the same version as it was compiled against. + + Example: OpenSSL 1.1.1d 10 Sep 2019 + """ + return self._ffi.string( + self._lib.OpenSSL_version(self._lib.OPENSSL_VERSION) + ).decode("ascii") + + def openssl_version_number(self) -> int: + return self._lib.OpenSSL_version_num() + + def _evp_md_from_algorithm(self, algorithm: hashes.HashAlgorithm): + if algorithm.name == "blake2b" or algorithm.name == "blake2s": + alg = "{}{}".format( + algorithm.name, algorithm.digest_size * 8 + ).encode("ascii") + else: + alg = algorithm.name.encode("ascii") + + evp_md = self._lib.EVP_get_digestbyname(alg) + return evp_md + + def _evp_md_non_null_from_algorithm(self, algorithm: hashes.HashAlgorithm): + evp_md = self._evp_md_from_algorithm(algorithm) + self.openssl_assert(evp_md != self._ffi.NULL) + return evp_md + + def hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + if self._fips_enabled and not isinstance(algorithm, self._fips_hashes): + return False + + evp_md = self._evp_md_from_algorithm(algorithm) + return evp_md != self._ffi.NULL + + def signature_hash_supported( + self, algorithm: hashes.HashAlgorithm + ) -> bool: + # Dedicated check for hashing algorithm use in message digest for + # signatures, e.g. RSA PKCS#1 v1.5 SHA1 (sha1WithRSAEncryption). + if self._fips_enabled and isinstance(algorithm, hashes.SHA1): + return False + return self.hash_supported(algorithm) + + def scrypt_supported(self) -> bool: + if self._fips_enabled: + return False + else: + return self._lib.Cryptography_HAS_SCRYPT == 1 + + def hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + # FIPS mode still allows SHA1 for HMAC + if self._fips_enabled and isinstance(algorithm, hashes.SHA1): + return True + + return self.hash_supported(algorithm) + + def cipher_supported(self, cipher: CipherAlgorithm, mode: Mode) -> bool: + if self._fips_enabled: + # FIPS mode requires AES. TripleDES is disallowed/deprecated in + # FIPS 140-3. + if not isinstance(cipher, self._fips_ciphers): + return False + + try: + adapter = self._cipher_registry[type(cipher), type(mode)] + except KeyError: + return False + evp_cipher = adapter(self, cipher, mode) + return self._ffi.NULL != evp_cipher + + def register_cipher_adapter(self, cipher_cls, mode_cls, adapter) -> None: + if (cipher_cls, mode_cls) in self._cipher_registry: + raise ValueError( + "Duplicate registration for: {} {}.".format( + cipher_cls, mode_cls + ) + ) + self._cipher_registry[cipher_cls, mode_cls] = adapter + + def _register_default_ciphers(self) -> None: + for cipher_cls in [AES, AES128, AES256]: + for mode_cls in [CBC, CTR, ECB, OFB, CFB, CFB8, GCM]: + self.register_cipher_adapter( + cipher_cls, + mode_cls, + GetCipherByName( + "{cipher.name}-{cipher.key_size}-{mode.name}" + ), + ) + for mode_cls in [CBC, CTR, ECB, OFB, CFB]: + self.register_cipher_adapter( + Camellia, + mode_cls, + GetCipherByName("{cipher.name}-{cipher.key_size}-{mode.name}"), + ) + for mode_cls in [CBC, CFB, CFB8, OFB]: + self.register_cipher_adapter( + TripleDES, mode_cls, GetCipherByName("des-ede3-{mode.name}") + ) + self.register_cipher_adapter( + TripleDES, ECB, GetCipherByName("des-ede3") + ) + self.register_cipher_adapter( + ChaCha20, type(None), GetCipherByName("chacha20") + ) + self.register_cipher_adapter(AES, XTS, _get_xts_cipher) + for mode_cls in [ECB, CBC, OFB, CFB, CTR]: + self.register_cipher_adapter( + SM4, mode_cls, GetCipherByName("sm4-{mode.name}") + ) + # Don't register legacy ciphers if they're unavailable. Hypothetically + # this wouldn't be necessary because we test availability by seeing if + # we get an EVP_CIPHER * in the _CipherContext __init__, but OpenSSL 3 + # will return a valid pointer even though the cipher is unavailable. + if ( + self._binding._legacy_provider_loaded + or not self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER + ): + for mode_cls in [CBC, CFB, OFB, ECB]: + self.register_cipher_adapter( + _BlowfishInternal, + mode_cls, + GetCipherByName("bf-{mode.name}"), + ) + for mode_cls in [CBC, CFB, OFB, ECB]: + self.register_cipher_adapter( + _SEEDInternal, + mode_cls, + GetCipherByName("seed-{mode.name}"), + ) + for cipher_cls, mode_cls in itertools.product( + [_CAST5Internal, _IDEAInternal], + [CBC, OFB, CFB, ECB], + ): + self.register_cipher_adapter( + cipher_cls, + mode_cls, + GetCipherByName("{cipher.name}-{mode.name}"), + ) + self.register_cipher_adapter( + ARC4, type(None), GetCipherByName("rc4") + ) + # We don't actually support RC2, this is just used by some tests. + self.register_cipher_adapter( + _RC2, type(None), GetCipherByName("rc2") + ) + + def create_symmetric_encryption_ctx( + self, cipher: CipherAlgorithm, mode: Mode + ) -> _CipherContext: + return _CipherContext(self, cipher, mode, _CipherContext._ENCRYPT) + + def create_symmetric_decryption_ctx( + self, cipher: CipherAlgorithm, mode: Mode + ) -> _CipherContext: + return _CipherContext(self, cipher, mode, _CipherContext._DECRYPT) + + def pbkdf2_hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + return self.hmac_supported(algorithm) + + def _consume_errors(self) -> typing.List[rust_openssl.OpenSSLError]: + return rust_openssl.capture_error_stack() + + def _bn_to_int(self, bn) -> int: + assert bn != self._ffi.NULL + self.openssl_assert(not self._lib.BN_is_negative(bn)) + + bn_num_bytes = self._lib.BN_num_bytes(bn) + bin_ptr = self._ffi.new("unsigned char[]", bn_num_bytes) + bin_len = self._lib.BN_bn2bin(bn, bin_ptr) + # A zero length means the BN has value 0 + self.openssl_assert(bin_len >= 0) + val = int.from_bytes(self._ffi.buffer(bin_ptr)[:bin_len], "big") + return val + + def _int_to_bn(self, num: int): + """ + Converts a python integer to a BIGNUM. The returned BIGNUM will not + be garbage collected (to support adding them to structs that take + ownership of the object). Be sure to register it for GC if it will + be discarded after use. + """ + binary = num.to_bytes(int(num.bit_length() / 8.0 + 1), "big") + bn_ptr = self._lib.BN_bin2bn(binary, len(binary), self._ffi.NULL) + self.openssl_assert(bn_ptr != self._ffi.NULL) + return bn_ptr + + def generate_rsa_private_key( + self, public_exponent: int, key_size: int + ) -> rsa.RSAPrivateKey: + rsa._verify_rsa_parameters(public_exponent, key_size) + + rsa_cdata = self._lib.RSA_new() + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + + bn = self._int_to_bn(public_exponent) + bn = self._ffi.gc(bn, self._lib.BN_free) + + res = self._lib.RSA_generate_key_ex( + rsa_cdata, key_size, bn, self._ffi.NULL + ) + self.openssl_assert(res == 1) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + + # We can skip RSA key validation here since we just generated the key + return _RSAPrivateKey( + self, rsa_cdata, evp_pkey, unsafe_skip_rsa_key_validation=True + ) + + def generate_rsa_parameters_supported( + self, public_exponent: int, key_size: int + ) -> bool: + return ( + public_exponent >= 3 + and public_exponent & 1 != 0 + and key_size >= 512 + ) + + def load_rsa_private_numbers( + self, + numbers: rsa.RSAPrivateNumbers, + unsafe_skip_rsa_key_validation: bool, + ) -> rsa.RSAPrivateKey: + rsa._check_private_key_components( + numbers.p, + numbers.q, + numbers.d, + numbers.dmp1, + numbers.dmq1, + numbers.iqmp, + numbers.public_numbers.e, + numbers.public_numbers.n, + ) + rsa_cdata = self._lib.RSA_new() + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + p = self._int_to_bn(numbers.p) + q = self._int_to_bn(numbers.q) + d = self._int_to_bn(numbers.d) + dmp1 = self._int_to_bn(numbers.dmp1) + dmq1 = self._int_to_bn(numbers.dmq1) + iqmp = self._int_to_bn(numbers.iqmp) + e = self._int_to_bn(numbers.public_numbers.e) + n = self._int_to_bn(numbers.public_numbers.n) + res = self._lib.RSA_set0_factors(rsa_cdata, p, q) + self.openssl_assert(res == 1) + res = self._lib.RSA_set0_key(rsa_cdata, n, e, d) + self.openssl_assert(res == 1) + res = self._lib.RSA_set0_crt_params(rsa_cdata, dmp1, dmq1, iqmp) + self.openssl_assert(res == 1) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + + return _RSAPrivateKey( + self, + rsa_cdata, + evp_pkey, + unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation, + ) + + def load_rsa_public_numbers( + self, numbers: rsa.RSAPublicNumbers + ) -> rsa.RSAPublicKey: + rsa._check_public_key_components(numbers.e, numbers.n) + rsa_cdata = self._lib.RSA_new() + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + e = self._int_to_bn(numbers.e) + n = self._int_to_bn(numbers.n) + res = self._lib.RSA_set0_key(rsa_cdata, n, e, self._ffi.NULL) + self.openssl_assert(res == 1) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + + def _create_evp_pkey_gc(self): + evp_pkey = self._lib.EVP_PKEY_new() + self.openssl_assert(evp_pkey != self._ffi.NULL) + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + return evp_pkey + + def _rsa_cdata_to_evp_pkey(self, rsa_cdata): + evp_pkey = self._create_evp_pkey_gc() + res = self._lib.EVP_PKEY_set1_RSA(evp_pkey, rsa_cdata) + self.openssl_assert(res == 1) + return evp_pkey + + def _bytes_to_bio(self, data: bytes) -> _MemoryBIO: + """ + Return a _MemoryBIO namedtuple of (BIO, char*). + + The char* is the storage for the BIO and it must stay alive until the + BIO is finished with. + """ + data_ptr = self._ffi.from_buffer(data) + bio = self._lib.BIO_new_mem_buf(data_ptr, len(data)) + self.openssl_assert(bio != self._ffi.NULL) + + return _MemoryBIO(self._ffi.gc(bio, self._lib.BIO_free), data_ptr) + + def _create_mem_bio_gc(self): + """ + Creates an empty memory BIO. + """ + bio_method = self._lib.BIO_s_mem() + self.openssl_assert(bio_method != self._ffi.NULL) + bio = self._lib.BIO_new(bio_method) + self.openssl_assert(bio != self._ffi.NULL) + bio = self._ffi.gc(bio, self._lib.BIO_free) + return bio + + def _read_mem_bio(self, bio) -> bytes: + """ + Reads a memory BIO. This only works on memory BIOs. + """ + buf = self._ffi.new("char **") + buf_len = self._lib.BIO_get_mem_data(bio, buf) + self.openssl_assert(buf_len > 0) + self.openssl_assert(buf[0] != self._ffi.NULL) + bio_data = self._ffi.buffer(buf[0], buf_len)[:] + return bio_data + + def _evp_pkey_to_private_key( + self, evp_pkey, unsafe_skip_rsa_key_validation: bool + ) -> PrivateKeyTypes: + """ + Return the appropriate type of PrivateKey given an evp_pkey cdata + pointer. + """ + + key_type = self._lib.EVP_PKEY_id(evp_pkey) + + if key_type == self._lib.EVP_PKEY_RSA: + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + return _RSAPrivateKey( + self, + rsa_cdata, + evp_pkey, + unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation, + ) + elif ( + key_type == self._lib.EVP_PKEY_RSA_PSS + and not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + and not self._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E + ): + # At the moment the way we handle RSA PSS keys is to strip the + # PSS constraints from them and treat them as normal RSA keys + # Unfortunately the RSA * itself tracks this data so we need to + # extract, serialize, and reload it without the constraints. + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + bio = self._create_mem_bio_gc() + res = self._lib.i2d_RSAPrivateKey_bio(bio, rsa_cdata) + self.openssl_assert(res == 1) + return self.load_der_private_key( + self._read_mem_bio(bio), + password=None, + unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation, + ) + elif key_type == self._lib.EVP_PKEY_DSA: + return rust_openssl.dsa.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_EC: + ec_cdata = self._lib.EVP_PKEY_get1_EC_KEY(evp_pkey) + self.openssl_assert(ec_cdata != self._ffi.NULL) + ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free) + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + elif key_type in self._dh_types: + return rust_openssl.dh.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED25519", None): + # EVP_PKEY_ED25519 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed25519.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_X448", None): + # EVP_PKEY_X448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.x448.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_X25519: + return rust_openssl.x25519.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED448", None): + # EVP_PKEY_ED448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed448.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + else: + raise UnsupportedAlgorithm("Unsupported key type.") + + def _evp_pkey_to_public_key(self, evp_pkey) -> PublicKeyTypes: + """ + Return the appropriate type of PublicKey given an evp_pkey cdata + pointer. + """ + + key_type = self._lib.EVP_PKEY_id(evp_pkey) + + if key_type == self._lib.EVP_PKEY_RSA: + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + elif ( + key_type == self._lib.EVP_PKEY_RSA_PSS + and not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + and not self._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E + ): + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + bio = self._create_mem_bio_gc() + res = self._lib.i2d_RSAPublicKey_bio(bio, rsa_cdata) + self.openssl_assert(res == 1) + return self.load_der_public_key(self._read_mem_bio(bio)) + elif key_type == self._lib.EVP_PKEY_DSA: + return rust_openssl.dsa.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_EC: + ec_cdata = self._lib.EVP_PKEY_get1_EC_KEY(evp_pkey) + if ec_cdata == self._ffi.NULL: + errors = self._consume_errors() + raise ValueError("Unable to load EC key", errors) + ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free) + return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey) + elif key_type in self._dh_types: + return rust_openssl.dh.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED25519", None): + # EVP_PKEY_ED25519 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed25519.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_X448", None): + # EVP_PKEY_X448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.x448.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_X25519: + return rust_openssl.x25519.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED448", None): + # EVP_PKEY_ED448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed448.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + else: + raise UnsupportedAlgorithm("Unsupported key type.") + + def _oaep_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + if self._fips_enabled and isinstance(algorithm, hashes.SHA1): + return False + + return isinstance( + algorithm, + ( + hashes.SHA1, + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + ), + ) + + def rsa_padding_supported(self, padding: AsymmetricPadding) -> bool: + if isinstance(padding, PKCS1v15): + return True + elif isinstance(padding, PSS) and isinstance(padding._mgf, MGF1): + # SHA1 is permissible in MGF1 in FIPS even when SHA1 is blocked + # as signature algorithm. + if self._fips_enabled and isinstance( + padding._mgf._algorithm, hashes.SHA1 + ): + return True + else: + return self.hash_supported(padding._mgf._algorithm) + elif isinstance(padding, OAEP) and isinstance(padding._mgf, MGF1): + return self._oaep_hash_supported( + padding._mgf._algorithm + ) and self._oaep_hash_supported(padding._algorithm) + else: + return False + + def rsa_encryption_supported(self, padding: AsymmetricPadding) -> bool: + if self._fips_enabled and isinstance(padding, PKCS1v15): + return False + else: + return self.rsa_padding_supported(padding) + + def generate_dsa_parameters(self, key_size: int) -> dsa.DSAParameters: + if key_size not in (1024, 2048, 3072, 4096): + raise ValueError( + "Key size must be 1024, 2048, 3072, or 4096 bits." + ) + + return rust_openssl.dsa.generate_parameters(key_size) + + def generate_dsa_private_key( + self, parameters: dsa.DSAParameters + ) -> dsa.DSAPrivateKey: + return parameters.generate_private_key() + + def generate_dsa_private_key_and_parameters( + self, key_size: int + ) -> dsa.DSAPrivateKey: + parameters = self.generate_dsa_parameters(key_size) + return self.generate_dsa_private_key(parameters) + + def load_dsa_private_numbers( + self, numbers: dsa.DSAPrivateNumbers + ) -> dsa.DSAPrivateKey: + dsa._check_dsa_private_numbers(numbers) + return rust_openssl.dsa.from_private_numbers(numbers) + + def load_dsa_public_numbers( + self, numbers: dsa.DSAPublicNumbers + ) -> dsa.DSAPublicKey: + dsa._check_dsa_parameters(numbers.parameter_numbers) + return rust_openssl.dsa.from_public_numbers(numbers) + + def load_dsa_parameter_numbers( + self, numbers: dsa.DSAParameterNumbers + ) -> dsa.DSAParameters: + dsa._check_dsa_parameters(numbers) + return rust_openssl.dsa.from_parameter_numbers(numbers) + + def dsa_supported(self) -> bool: + return ( + not self._lib.CRYPTOGRAPHY_IS_BORINGSSL and not self._fips_enabled + ) + + def dsa_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + if not self.dsa_supported(): + return False + return self.signature_hash_supported(algorithm) + + def cmac_algorithm_supported(self, algorithm) -> bool: + return self.cipher_supported( + algorithm, CBC(b"\x00" * algorithm.block_size) + ) + + def create_cmac_ctx(self, algorithm: BlockCipherAlgorithm) -> _CMACContext: + return _CMACContext(self, algorithm) + + def load_pem_private_key( + self, + data: bytes, + password: typing.Optional[bytes], + unsafe_skip_rsa_key_validation: bool, + ) -> PrivateKeyTypes: + return self._load_key( + self._lib.PEM_read_bio_PrivateKey, + data, + password, + unsafe_skip_rsa_key_validation, + ) + + def load_pem_public_key(self, data: bytes) -> PublicKeyTypes: + mem_bio = self._bytes_to_bio(data) + # In OpenSSL 3.0.x the PEM_read_bio_PUBKEY function will invoke + # the default password callback if you pass an encrypted private + # key. This is very, very, very bad as the default callback can + # trigger an interactive console prompt, which will hang the + # Python process. We therefore provide our own callback to + # catch this and error out properly. + userdata = self._ffi.new("CRYPTOGRAPHY_PASSWORD_DATA *") + evp_pkey = self._lib.PEM_read_bio_PUBKEY( + mem_bio.bio, + self._ffi.NULL, + self._ffi.addressof( + self._lib._original_lib, "Cryptography_pem_password_cb" + ), + userdata, + ) + if evp_pkey != self._ffi.NULL: + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + return self._evp_pkey_to_public_key(evp_pkey) + else: + # It's not a (RSA/DSA/ECDSA) subjectPublicKeyInfo, but we still + # need to check to see if it is a pure PKCS1 RSA public key (not + # embedded in a subjectPublicKeyInfo) + self._consume_errors() + res = self._lib.BIO_reset(mem_bio.bio) + self.openssl_assert(res == 1) + rsa_cdata = self._lib.PEM_read_bio_RSAPublicKey( + mem_bio.bio, + self._ffi.NULL, + self._ffi.addressof( + self._lib._original_lib, "Cryptography_pem_password_cb" + ), + userdata, + ) + if rsa_cdata != self._ffi.NULL: + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + else: + self._handle_key_loading_error() + + def load_pem_parameters(self, data: bytes) -> dh.DHParameters: + return rust_openssl.dh.from_pem_parameters(data) + + def load_der_private_key( + self, + data: bytes, + password: typing.Optional[bytes], + unsafe_skip_rsa_key_validation: bool, + ) -> PrivateKeyTypes: + # OpenSSL has a function called d2i_AutoPrivateKey that in theory + # handles this automatically, however it doesn't handle encrypted + # private keys. Instead we try to load the key two different ways. + # First we'll try to load it as a traditional key. + bio_data = self._bytes_to_bio(data) + key = self._evp_pkey_from_der_traditional_key(bio_data, password) + if key: + return self._evp_pkey_to_private_key( + key, unsafe_skip_rsa_key_validation + ) + else: + # Finally we try to load it with the method that handles encrypted + # PKCS8 properly. + return self._load_key( + self._lib.d2i_PKCS8PrivateKey_bio, + data, + password, + unsafe_skip_rsa_key_validation, + ) + + def _evp_pkey_from_der_traditional_key(self, bio_data, password): + key = self._lib.d2i_PrivateKey_bio(bio_data.bio, self._ffi.NULL) + if key != self._ffi.NULL: + key = self._ffi.gc(key, self._lib.EVP_PKEY_free) + if password is not None: + raise TypeError( + "Password was given but private key is not encrypted." + ) + + return key + else: + self._consume_errors() + return None + + def load_der_public_key(self, data: bytes) -> PublicKeyTypes: + mem_bio = self._bytes_to_bio(data) + evp_pkey = self._lib.d2i_PUBKEY_bio(mem_bio.bio, self._ffi.NULL) + if evp_pkey != self._ffi.NULL: + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + return self._evp_pkey_to_public_key(evp_pkey) + else: + # It's not a (RSA/DSA/ECDSA) subjectPublicKeyInfo, but we still + # need to check to see if it is a pure PKCS1 RSA public key (not + # embedded in a subjectPublicKeyInfo) + self._consume_errors() + res = self._lib.BIO_reset(mem_bio.bio) + self.openssl_assert(res == 1) + rsa_cdata = self._lib.d2i_RSAPublicKey_bio( + mem_bio.bio, self._ffi.NULL + ) + if rsa_cdata != self._ffi.NULL: + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + else: + self._handle_key_loading_error() + + def load_der_parameters(self, data: bytes) -> dh.DHParameters: + return rust_openssl.dh.from_der_parameters(data) + + def _cert2ossl(self, cert: x509.Certificate) -> typing.Any: + data = cert.public_bytes(serialization.Encoding.DER) + mem_bio = self._bytes_to_bio(data) + x509 = self._lib.d2i_X509_bio(mem_bio.bio, self._ffi.NULL) + self.openssl_assert(x509 != self._ffi.NULL) + x509 = self._ffi.gc(x509, self._lib.X509_free) + return x509 + + def _ossl2cert(self, x509_ptr: typing.Any) -> x509.Certificate: + bio = self._create_mem_bio_gc() + res = self._lib.i2d_X509_bio(bio, x509_ptr) + self.openssl_assert(res == 1) + return x509.load_der_x509_certificate(self._read_mem_bio(bio)) + + def _key2ossl(self, key: PKCS12PrivateKeyTypes) -> typing.Any: + data = key.private_bytes( + serialization.Encoding.DER, + serialization.PrivateFormat.PKCS8, + serialization.NoEncryption(), + ) + mem_bio = self._bytes_to_bio(data) + + evp_pkey = self._lib.d2i_PrivateKey_bio( + mem_bio.bio, + self._ffi.NULL, + ) + self.openssl_assert(evp_pkey != self._ffi.NULL) + return self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + + def _load_key( + self, openssl_read_func, data, password, unsafe_skip_rsa_key_validation + ) -> PrivateKeyTypes: + mem_bio = self._bytes_to_bio(data) + + userdata = self._ffi.new("CRYPTOGRAPHY_PASSWORD_DATA *") + if password is not None: + utils._check_byteslike("password", password) + password_ptr = self._ffi.from_buffer(password) + userdata.password = password_ptr + userdata.length = len(password) + + evp_pkey = openssl_read_func( + mem_bio.bio, + self._ffi.NULL, + self._ffi.addressof( + self._lib._original_lib, "Cryptography_pem_password_cb" + ), + userdata, + ) + + if evp_pkey == self._ffi.NULL: + if userdata.error != 0: + self._consume_errors() + if userdata.error == -1: + raise TypeError( + "Password was not given but private key is encrypted" + ) + else: + assert userdata.error == -2 + raise ValueError( + "Passwords longer than {} bytes are not supported " + "by this backend.".format(userdata.maxsize - 1) + ) + else: + self._handle_key_loading_error() + + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + + if password is not None and userdata.called == 0: + raise TypeError( + "Password was given but private key is not encrypted." + ) + + assert ( + password is not None and userdata.called == 1 + ) or password is None + + return self._evp_pkey_to_private_key( + evp_pkey, unsafe_skip_rsa_key_validation + ) + + def _handle_key_loading_error(self) -> typing.NoReturn: + errors = self._consume_errors() + + if not errors: + raise ValueError( + "Could not deserialize key data. The data may be in an " + "incorrect format or it may be encrypted with an unsupported " + "algorithm." + ) + + elif ( + errors[0]._lib_reason_match( + self._lib.ERR_LIB_EVP, self._lib.EVP_R_BAD_DECRYPT + ) + or errors[0]._lib_reason_match( + self._lib.ERR_LIB_PKCS12, + self._lib.PKCS12_R_PKCS12_CIPHERFINAL_ERROR, + ) + or ( + self._lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + self._lib.ERR_LIB_PROV, + self._lib.PROV_R_BAD_DECRYPT, + ) + ) + ): + raise ValueError("Bad decrypt. Incorrect password?") + + elif any( + error._lib_reason_match( + self._lib.ERR_LIB_EVP, + self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM, + ) + for error in errors + ): + raise ValueError("Unsupported public key algorithm.") + + else: + raise ValueError( + "Could not deserialize key data. The data may be in an " + "incorrect format, it may be encrypted with an unsupported " + "algorithm, or it may be an unsupported key type (e.g. EC " + "curves with explicit parameters).", + errors, + ) + + def elliptic_curve_supported(self, curve: ec.EllipticCurve) -> bool: + try: + curve_nid = self._elliptic_curve_to_nid(curve) + except UnsupportedAlgorithm: + curve_nid = self._lib.NID_undef + + group = self._lib.EC_GROUP_new_by_curve_name(curve_nid) + + if group == self._ffi.NULL: + self._consume_errors() + return False + else: + self.openssl_assert(curve_nid != self._lib.NID_undef) + self._lib.EC_GROUP_free(group) + return True + + def elliptic_curve_signature_algorithm_supported( + self, + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, + curve: ec.EllipticCurve, + ) -> bool: + # We only support ECDSA right now. + if not isinstance(signature_algorithm, ec.ECDSA): + return False + + return self.elliptic_curve_supported(curve) + + def generate_elliptic_curve_private_key( + self, curve: ec.EllipticCurve + ) -> ec.EllipticCurvePrivateKey: + """ + Generate a new private key on the named curve. + """ + + if self.elliptic_curve_supported(curve): + ec_cdata = self._ec_key_new_by_curve(curve) + + res = self._lib.EC_KEY_generate_key(ec_cdata) + self.openssl_assert(res == 1) + + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + else: + raise UnsupportedAlgorithm( + f"Backend object does not support {curve.name}.", + _Reasons.UNSUPPORTED_ELLIPTIC_CURVE, + ) + + def load_elliptic_curve_private_numbers( + self, numbers: ec.EllipticCurvePrivateNumbers + ) -> ec.EllipticCurvePrivateKey: + public = numbers.public_numbers + + ec_cdata = self._ec_key_new_by_curve(public.curve) + + private_value = self._ffi.gc( + self._int_to_bn(numbers.private_value), self._lib.BN_clear_free + ) + res = self._lib.EC_KEY_set_private_key(ec_cdata, private_value) + if res != 1: + self._consume_errors() + raise ValueError("Invalid EC key.") + + with self._tmp_bn_ctx() as bn_ctx: + self._ec_key_set_public_key_affine_coordinates( + ec_cdata, public.x, public.y, bn_ctx + ) + # derive the expected public point and compare it to the one we + # just set based on the values we were given. If they don't match + # this isn't a valid key pair. + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + set_point = backend._lib.EC_KEY_get0_public_key(ec_cdata) + self.openssl_assert(set_point != self._ffi.NULL) + computed_point = self._lib.EC_POINT_new(group) + self.openssl_assert(computed_point != self._ffi.NULL) + computed_point = self._ffi.gc( + computed_point, self._lib.EC_POINT_free + ) + res = self._lib.EC_POINT_mul( + group, + computed_point, + private_value, + self._ffi.NULL, + self._ffi.NULL, + bn_ctx, + ) + self.openssl_assert(res == 1) + if ( + self._lib.EC_POINT_cmp( + group, set_point, computed_point, bn_ctx + ) + != 0 + ): + raise ValueError("Invalid EC key.") + + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + + def load_elliptic_curve_public_numbers( + self, numbers: ec.EllipticCurvePublicNumbers + ) -> ec.EllipticCurvePublicKey: + ec_cdata = self._ec_key_new_by_curve(numbers.curve) + with self._tmp_bn_ctx() as bn_ctx: + self._ec_key_set_public_key_affine_coordinates( + ec_cdata, numbers.x, numbers.y, bn_ctx + ) + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey) + + def load_elliptic_curve_public_bytes( + self, curve: ec.EllipticCurve, point_bytes: bytes + ) -> ec.EllipticCurvePublicKey: + ec_cdata = self._ec_key_new_by_curve(curve) + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + point = self._lib.EC_POINT_new(group) + self.openssl_assert(point != self._ffi.NULL) + point = self._ffi.gc(point, self._lib.EC_POINT_free) + with self._tmp_bn_ctx() as bn_ctx: + res = self._lib.EC_POINT_oct2point( + group, point, point_bytes, len(point_bytes), bn_ctx + ) + if res != 1: + self._consume_errors() + raise ValueError("Invalid public bytes for the given curve") + + res = self._lib.EC_KEY_set_public_key(ec_cdata, point) + self.openssl_assert(res == 1) + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey) + + def derive_elliptic_curve_private_key( + self, private_value: int, curve: ec.EllipticCurve + ) -> ec.EllipticCurvePrivateKey: + ec_cdata = self._ec_key_new_by_curve(curve) + + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + + point = self._lib.EC_POINT_new(group) + self.openssl_assert(point != self._ffi.NULL) + point = self._ffi.gc(point, self._lib.EC_POINT_free) + + value = self._int_to_bn(private_value) + value = self._ffi.gc(value, self._lib.BN_clear_free) + + with self._tmp_bn_ctx() as bn_ctx: + res = self._lib.EC_POINT_mul( + group, point, value, self._ffi.NULL, self._ffi.NULL, bn_ctx + ) + self.openssl_assert(res == 1) + + bn_x = self._lib.BN_CTX_get(bn_ctx) + bn_y = self._lib.BN_CTX_get(bn_ctx) + + res = self._lib.EC_POINT_get_affine_coordinates( + group, point, bn_x, bn_y, bn_ctx + ) + if res != 1: + self._consume_errors() + raise ValueError("Unable to derive key from private_value") + + res = self._lib.EC_KEY_set_public_key(ec_cdata, point) + self.openssl_assert(res == 1) + private = self._int_to_bn(private_value) + private = self._ffi.gc(private, self._lib.BN_clear_free) + res = self._lib.EC_KEY_set_private_key(ec_cdata, private) + self.openssl_assert(res == 1) + + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + + def _ec_key_new_by_curve(self, curve: ec.EllipticCurve): + curve_nid = self._elliptic_curve_to_nid(curve) + return self._ec_key_new_by_curve_nid(curve_nid) + + def _ec_key_new_by_curve_nid(self, curve_nid: int): + ec_cdata = self._lib.EC_KEY_new_by_curve_name(curve_nid) + self.openssl_assert(ec_cdata != self._ffi.NULL) + return self._ffi.gc(ec_cdata, self._lib.EC_KEY_free) + + def elliptic_curve_exchange_algorithm_supported( + self, algorithm: ec.ECDH, curve: ec.EllipticCurve + ) -> bool: + if self._fips_enabled and not isinstance( + curve, self._fips_ecdh_curves + ): + return False + + return self.elliptic_curve_supported(curve) and isinstance( + algorithm, ec.ECDH + ) + + def _ec_cdata_to_evp_pkey(self, ec_cdata): + evp_pkey = self._create_evp_pkey_gc() + res = self._lib.EVP_PKEY_set1_EC_KEY(evp_pkey, ec_cdata) + self.openssl_assert(res == 1) + return evp_pkey + + def _elliptic_curve_to_nid(self, curve: ec.EllipticCurve) -> int: + """ + Get the NID for a curve name. + """ + + curve_aliases = {"secp192r1": "prime192v1", "secp256r1": "prime256v1"} + + curve_name = curve_aliases.get(curve.name, curve.name) + + curve_nid = self._lib.OBJ_sn2nid(curve_name.encode()) + if curve_nid == self._lib.NID_undef: + raise UnsupportedAlgorithm( + f"{curve.name} is not a supported elliptic curve", + _Reasons.UNSUPPORTED_ELLIPTIC_CURVE, + ) + return curve_nid + + @contextmanager + def _tmp_bn_ctx(self): + bn_ctx = self._lib.BN_CTX_new() + self.openssl_assert(bn_ctx != self._ffi.NULL) + bn_ctx = self._ffi.gc(bn_ctx, self._lib.BN_CTX_free) + self._lib.BN_CTX_start(bn_ctx) + try: + yield bn_ctx + finally: + self._lib.BN_CTX_end(bn_ctx) + + def _ec_key_set_public_key_affine_coordinates( + self, + ec_cdata, + x: int, + y: int, + bn_ctx, + ) -> None: + """ + Sets the public key point in the EC_KEY context to the affine x and y + values. + """ + + if x < 0 or y < 0: + raise ValueError( + "Invalid EC key. Both x and y must be non-negative." + ) + + x = self._ffi.gc(self._int_to_bn(x), self._lib.BN_free) + y = self._ffi.gc(self._int_to_bn(y), self._lib.BN_free) + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + point = self._lib.EC_POINT_new(group) + self.openssl_assert(point != self._ffi.NULL) + point = self._ffi.gc(point, self._lib.EC_POINT_free) + res = self._lib.EC_POINT_set_affine_coordinates( + group, point, x, y, bn_ctx + ) + if res != 1: + self._consume_errors() + raise ValueError("Invalid EC key.") + res = self._lib.EC_KEY_set_public_key(ec_cdata, point) + self.openssl_assert(res == 1) + + def _private_key_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PrivateFormat, + encryption_algorithm: serialization.KeySerializationEncryption, + key, + evp_pkey, + cdata, + ) -> bytes: + # validate argument types + if not isinstance(encoding, serialization.Encoding): + raise TypeError("encoding must be an item from the Encoding enum") + if not isinstance(format, serialization.PrivateFormat): + raise TypeError( + "format must be an item from the PrivateFormat enum" + ) + if not isinstance( + encryption_algorithm, serialization.KeySerializationEncryption + ): + raise TypeError( + "Encryption algorithm must be a KeySerializationEncryption " + "instance" + ) + + # validate password + if isinstance(encryption_algorithm, serialization.NoEncryption): + password = b"" + elif isinstance( + encryption_algorithm, serialization.BestAvailableEncryption + ): + password = encryption_algorithm.password + if len(password) > 1023: + raise ValueError( + "Passwords longer than 1023 bytes are not supported by " + "this backend" + ) + elif ( + isinstance( + encryption_algorithm, serialization._KeySerializationEncryption + ) + and encryption_algorithm._format + is format + is serialization.PrivateFormat.OpenSSH + ): + password = encryption_algorithm.password + else: + raise ValueError("Unsupported encryption type") + + # PKCS8 + PEM/DER + if format is serialization.PrivateFormat.PKCS8: + if encoding is serialization.Encoding.PEM: + write_bio = self._lib.PEM_write_bio_PKCS8PrivateKey + elif encoding is serialization.Encoding.DER: + write_bio = self._lib.i2d_PKCS8PrivateKey_bio + else: + raise ValueError("Unsupported encoding for PKCS8") + return self._private_key_bytes_via_bio( + write_bio, evp_pkey, password + ) + + # TraditionalOpenSSL + PEM/DER + if format is serialization.PrivateFormat.TraditionalOpenSSL: + if self._fips_enabled and not isinstance( + encryption_algorithm, serialization.NoEncryption + ): + raise ValueError( + "Encrypted traditional OpenSSL format is not " + "supported in FIPS mode." + ) + key_type = self._lib.EVP_PKEY_id(evp_pkey) + + if encoding is serialization.Encoding.PEM: + if key_type == self._lib.EVP_PKEY_RSA: + write_bio = self._lib.PEM_write_bio_RSAPrivateKey + else: + assert key_type == self._lib.EVP_PKEY_EC + write_bio = self._lib.PEM_write_bio_ECPrivateKey + return self._private_key_bytes_via_bio( + write_bio, cdata, password + ) + + if encoding is serialization.Encoding.DER: + if password: + raise ValueError( + "Encryption is not supported for DER encoded " + "traditional OpenSSL keys" + ) + if key_type == self._lib.EVP_PKEY_RSA: + write_bio = self._lib.i2d_RSAPrivateKey_bio + else: + assert key_type == self._lib.EVP_PKEY_EC + write_bio = self._lib.i2d_ECPrivateKey_bio + return self._bio_func_output(write_bio, cdata) + + raise ValueError("Unsupported encoding for TraditionalOpenSSL") + + # OpenSSH + PEM + if format is serialization.PrivateFormat.OpenSSH: + if encoding is serialization.Encoding.PEM: + return ssh._serialize_ssh_private_key( + key, password, encryption_algorithm + ) + + raise ValueError( + "OpenSSH private key format can only be used" + " with PEM encoding" + ) + + # Anything that key-specific code was supposed to handle earlier, + # like Raw. + raise ValueError("format is invalid with this key") + + def _private_key_bytes_via_bio( + self, write_bio, evp_pkey, password + ) -> bytes: + if not password: + evp_cipher = self._ffi.NULL + else: + # This is a curated value that we will update over time. + evp_cipher = self._lib.EVP_get_cipherbyname(b"aes-256-cbc") + + return self._bio_func_output( + write_bio, + evp_pkey, + evp_cipher, + password, + len(password), + self._ffi.NULL, + self._ffi.NULL, + ) + + def _bio_func_output(self, write_bio, *args) -> bytes: + bio = self._create_mem_bio_gc() + res = write_bio(bio, *args) + self.openssl_assert(res == 1) + return self._read_mem_bio(bio) + + def _public_key_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PublicFormat, + key, + evp_pkey, + cdata, + ) -> bytes: + if not isinstance(encoding, serialization.Encoding): + raise TypeError("encoding must be an item from the Encoding enum") + if not isinstance(format, serialization.PublicFormat): + raise TypeError( + "format must be an item from the PublicFormat enum" + ) + + # SubjectPublicKeyInfo + PEM/DER + if format is serialization.PublicFormat.SubjectPublicKeyInfo: + if encoding is serialization.Encoding.PEM: + write_bio = self._lib.PEM_write_bio_PUBKEY + elif encoding is serialization.Encoding.DER: + write_bio = self._lib.i2d_PUBKEY_bio + else: + raise ValueError( + "SubjectPublicKeyInfo works only with PEM or DER encoding" + ) + return self._bio_func_output(write_bio, evp_pkey) + + # PKCS1 + PEM/DER + if format is serialization.PublicFormat.PKCS1: + # Only RSA is supported here. + key_type = self._lib.EVP_PKEY_id(evp_pkey) + if key_type != self._lib.EVP_PKEY_RSA: + raise ValueError("PKCS1 format is supported only for RSA keys") + + if encoding is serialization.Encoding.PEM: + write_bio = self._lib.PEM_write_bio_RSAPublicKey + elif encoding is serialization.Encoding.DER: + write_bio = self._lib.i2d_RSAPublicKey_bio + else: + raise ValueError("PKCS1 works only with PEM or DER encoding") + return self._bio_func_output(write_bio, cdata) + + # OpenSSH + OpenSSH + if format is serialization.PublicFormat.OpenSSH: + if encoding is serialization.Encoding.OpenSSH: + return ssh.serialize_ssh_public_key(key) + + raise ValueError( + "OpenSSH format must be used with OpenSSH encoding" + ) + + # Anything that key-specific code was supposed to handle earlier, + # like Raw, CompressedPoint, UncompressedPoint + raise ValueError("format is invalid with this key") + + def dh_supported(self) -> bool: + return not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + + def generate_dh_parameters( + self, generator: int, key_size: int + ) -> dh.DHParameters: + return rust_openssl.dh.generate_parameters(generator, key_size) + + def generate_dh_private_key( + self, parameters: dh.DHParameters + ) -> dh.DHPrivateKey: + return parameters.generate_private_key() + + def generate_dh_private_key_and_parameters( + self, generator: int, key_size: int + ) -> dh.DHPrivateKey: + return self.generate_dh_private_key( + self.generate_dh_parameters(generator, key_size) + ) + + def load_dh_private_numbers( + self, numbers: dh.DHPrivateNumbers + ) -> dh.DHPrivateKey: + return rust_openssl.dh.from_private_numbers(numbers) + + def load_dh_public_numbers( + self, numbers: dh.DHPublicNumbers + ) -> dh.DHPublicKey: + return rust_openssl.dh.from_public_numbers(numbers) + + def load_dh_parameter_numbers( + self, numbers: dh.DHParameterNumbers + ) -> dh.DHParameters: + return rust_openssl.dh.from_parameter_numbers(numbers) + + def dh_parameters_supported( + self, p: int, g: int, q: typing.Optional[int] = None + ) -> bool: + try: + rust_openssl.dh.from_parameter_numbers( + dh.DHParameterNumbers(p=p, g=g, q=q) + ) + except ValueError: + return False + else: + return True + + def dh_x942_serialization_supported(self) -> bool: + return self._lib.Cryptography_HAS_EVP_PKEY_DHX == 1 + + def x25519_load_public_bytes(self, data: bytes) -> x25519.X25519PublicKey: + return rust_openssl.x25519.from_public_bytes(data) + + def x25519_load_private_bytes( + self, data: bytes + ) -> x25519.X25519PrivateKey: + return rust_openssl.x25519.from_private_bytes(data) + + def x25519_generate_key(self) -> x25519.X25519PrivateKey: + return rust_openssl.x25519.generate_key() + + def x25519_supported(self) -> bool: + if self._fips_enabled: + return False + return not self._lib.CRYPTOGRAPHY_LIBRESSL_LESS_THAN_370 + + def x448_load_public_bytes(self, data: bytes) -> x448.X448PublicKey: + return rust_openssl.x448.from_public_bytes(data) + + def x448_load_private_bytes(self, data: bytes) -> x448.X448PrivateKey: + return rust_openssl.x448.from_private_bytes(data) + + def x448_generate_key(self) -> x448.X448PrivateKey: + return rust_openssl.x448.generate_key() + + def x448_supported(self) -> bool: + if self._fips_enabled: + return False + return ( + not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + ) + + def ed25519_supported(self) -> bool: + if self._fips_enabled: + return False + return self._lib.CRYPTOGRAPHY_HAS_WORKING_ED25519 + + def ed25519_load_public_bytes( + self, data: bytes + ) -> ed25519.Ed25519PublicKey: + return rust_openssl.ed25519.from_public_bytes(data) + + def ed25519_load_private_bytes( + self, data: bytes + ) -> ed25519.Ed25519PrivateKey: + return rust_openssl.ed25519.from_private_bytes(data) + + def ed25519_generate_key(self) -> ed25519.Ed25519PrivateKey: + return rust_openssl.ed25519.generate_key() + + def ed448_supported(self) -> bool: + if self._fips_enabled: + return False + return ( + not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + ) + + def ed448_load_public_bytes(self, data: bytes) -> ed448.Ed448PublicKey: + return rust_openssl.ed448.from_public_bytes(data) + + def ed448_load_private_bytes(self, data: bytes) -> ed448.Ed448PrivateKey: + return rust_openssl.ed448.from_private_bytes(data) + + def ed448_generate_key(self) -> ed448.Ed448PrivateKey: + return rust_openssl.ed448.generate_key() + + def aead_cipher_supported(self, cipher) -> bool: + return aead._aead_cipher_supported(self, cipher) + + def _zero_data(self, data, length: int) -> None: + # We clear things this way because at the moment we're not + # sure of a better way that can guarantee it overwrites the + # memory of a bytearray and doesn't just replace the underlying char *. + for i in range(length): + data[i] = 0 + + @contextlib.contextmanager + def _zeroed_null_terminated_buf(self, data): + """ + This method takes bytes, which can be a bytestring or a mutable + buffer like a bytearray, and yields a null-terminated version of that + data. This is required because PKCS12_parse doesn't take a length with + its password char * and ffi.from_buffer doesn't provide null + termination. So, to support zeroing the data via bytearray we + need to build this ridiculous construct that copies the memory, but + zeroes it after use. + """ + if data is None: + yield self._ffi.NULL + else: + data_len = len(data) + buf = self._ffi.new("char[]", data_len + 1) + self._ffi.memmove(buf, data, data_len) + try: + yield buf + finally: + # Cast to a uint8_t * so we can assign by integer + self._zero_data(self._ffi.cast("uint8_t *", buf), data_len) + + def load_key_and_certificates_from_pkcs12( + self, data: bytes, password: typing.Optional[bytes] + ) -> typing.Tuple[ + typing.Optional[PrivateKeyTypes], + typing.Optional[x509.Certificate], + typing.List[x509.Certificate], + ]: + pkcs12 = self.load_pkcs12(data, password) + return ( + pkcs12.key, + pkcs12.cert.certificate if pkcs12.cert else None, + [cert.certificate for cert in pkcs12.additional_certs], + ) + + def load_pkcs12( + self, data: bytes, password: typing.Optional[bytes] + ) -> PKCS12KeyAndCertificates: + if password is not None: + utils._check_byteslike("password", password) + + bio = self._bytes_to_bio(data) + p12 = self._lib.d2i_PKCS12_bio(bio.bio, self._ffi.NULL) + if p12 == self._ffi.NULL: + self._consume_errors() + raise ValueError("Could not deserialize PKCS12 data") + + p12 = self._ffi.gc(p12, self._lib.PKCS12_free) + evp_pkey_ptr = self._ffi.new("EVP_PKEY **") + x509_ptr = self._ffi.new("X509 **") + sk_x509_ptr = self._ffi.new("Cryptography_STACK_OF_X509 **") + with self._zeroed_null_terminated_buf(password) as password_buf: + res = self._lib.PKCS12_parse( + p12, password_buf, evp_pkey_ptr, x509_ptr, sk_x509_ptr + ) + if res == 0: + self._consume_errors() + raise ValueError("Invalid password or PKCS12 data") + + cert = None + key = None + additional_certificates = [] + + if evp_pkey_ptr[0] != self._ffi.NULL: + evp_pkey = self._ffi.gc(evp_pkey_ptr[0], self._lib.EVP_PKEY_free) + # We don't support turning off RSA key validation when loading + # PKCS12 keys + key = self._evp_pkey_to_private_key( + evp_pkey, unsafe_skip_rsa_key_validation=False + ) + + if x509_ptr[0] != self._ffi.NULL: + x509 = self._ffi.gc(x509_ptr[0], self._lib.X509_free) + cert_obj = self._ossl2cert(x509) + name = None + maybe_name = self._lib.X509_alias_get0(x509, self._ffi.NULL) + if maybe_name != self._ffi.NULL: + name = self._ffi.string(maybe_name) + cert = PKCS12Certificate(cert_obj, name) + + if sk_x509_ptr[0] != self._ffi.NULL: + sk_x509 = self._ffi.gc(sk_x509_ptr[0], self._lib.sk_X509_free) + num = self._lib.sk_X509_num(sk_x509_ptr[0]) + + # In OpenSSL < 3.0.0 PKCS12 parsing reverses the order of the + # certificates. + indices: typing.Iterable[int] + if ( + self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER + or self._lib.CRYPTOGRAPHY_IS_BORINGSSL + ): + indices = range(num) + else: + indices = reversed(range(num)) + + for i in indices: + x509 = self._lib.sk_X509_value(sk_x509, i) + self.openssl_assert(x509 != self._ffi.NULL) + x509 = self._ffi.gc(x509, self._lib.X509_free) + addl_cert = self._ossl2cert(x509) + addl_name = None + maybe_name = self._lib.X509_alias_get0(x509, self._ffi.NULL) + if maybe_name != self._ffi.NULL: + addl_name = self._ffi.string(maybe_name) + additional_certificates.append( + PKCS12Certificate(addl_cert, addl_name) + ) + + return PKCS12KeyAndCertificates(key, cert, additional_certificates) + + def serialize_key_and_certificates_to_pkcs12( + self, + name: typing.Optional[bytes], + key: typing.Optional[PKCS12PrivateKeyTypes], + cert: typing.Optional[x509.Certificate], + cas: typing.Optional[typing.List[_PKCS12CATypes]], + encryption_algorithm: serialization.KeySerializationEncryption, + ) -> bytes: + password = None + if name is not None: + utils._check_bytes("name", name) + + if isinstance(encryption_algorithm, serialization.NoEncryption): + nid_cert = -1 + nid_key = -1 + pkcs12_iter = 0 + mac_iter = 0 + mac_alg = self._ffi.NULL + elif isinstance( + encryption_algorithm, serialization.BestAvailableEncryption + ): + # PKCS12 encryption is hopeless trash and can never be fixed. + # OpenSSL 3 supports PBESv2, but Libre and Boring do not, so + # we use PBESv1 with 3DES on the older paths. + if self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER: + nid_cert = self._lib.NID_aes_256_cbc + nid_key = self._lib.NID_aes_256_cbc + else: + nid_cert = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + nid_key = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + # At least we can set this higher than OpenSSL's default + pkcs12_iter = 20000 + # mac_iter chosen for compatibility reasons, see: + # https://www.openssl.org/docs/man1.1.1/man3/PKCS12_create.html + # Did we mention how lousy PKCS12 encryption is? + mac_iter = 1 + # MAC algorithm can only be set on OpenSSL 3.0.0+ + mac_alg = self._ffi.NULL + password = encryption_algorithm.password + elif ( + isinstance( + encryption_algorithm, serialization._KeySerializationEncryption + ) + and encryption_algorithm._format + is serialization.PrivateFormat.PKCS12 + ): + # Default to OpenSSL's defaults. Behavior will vary based on the + # version of OpenSSL cryptography is compiled against. + nid_cert = 0 + nid_key = 0 + # Use the default iters we use in best available + pkcs12_iter = 20000 + # See the Best Available comment for why this is 1 + mac_iter = 1 + password = encryption_algorithm.password + keycertalg = encryption_algorithm._key_cert_algorithm + if keycertalg is PBES.PBESv1SHA1And3KeyTripleDESCBC: + nid_cert = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + nid_key = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + elif keycertalg is PBES.PBESv2SHA256AndAES256CBC: + if not self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER: + raise UnsupportedAlgorithm( + "PBESv2 is not supported by this version of OpenSSL" + ) + nid_cert = self._lib.NID_aes_256_cbc + nid_key = self._lib.NID_aes_256_cbc + else: + assert keycertalg is None + # We use OpenSSL's defaults + + if encryption_algorithm._hmac_hash is not None: + if not self._lib.Cryptography_HAS_PKCS12_SET_MAC: + raise UnsupportedAlgorithm( + "Setting MAC algorithm is not supported by this " + "version of OpenSSL." + ) + mac_alg = self._evp_md_non_null_from_algorithm( + encryption_algorithm._hmac_hash + ) + self.openssl_assert(mac_alg != self._ffi.NULL) + else: + mac_alg = self._ffi.NULL + + if encryption_algorithm._kdf_rounds is not None: + pkcs12_iter = encryption_algorithm._kdf_rounds + + else: + raise ValueError("Unsupported key encryption type") + + if cas is None or len(cas) == 0: + sk_x509 = self._ffi.NULL + else: + sk_x509 = self._lib.sk_X509_new_null() + sk_x509 = self._ffi.gc(sk_x509, self._lib.sk_X509_free) + + # This list is to keep the x509 values alive until end of function + ossl_cas = [] + for ca in cas: + if isinstance(ca, PKCS12Certificate): + ca_alias = ca.friendly_name + ossl_ca = self._cert2ossl(ca.certificate) + if ca_alias is None: + res = self._lib.X509_alias_set1( + ossl_ca, self._ffi.NULL, -1 + ) + else: + res = self._lib.X509_alias_set1( + ossl_ca, ca_alias, len(ca_alias) + ) + self.openssl_assert(res == 1) + else: + ossl_ca = self._cert2ossl(ca) + ossl_cas.append(ossl_ca) + res = self._lib.sk_X509_push(sk_x509, ossl_ca) + backend.openssl_assert(res >= 1) + + with self._zeroed_null_terminated_buf(password) as password_buf: + with self._zeroed_null_terminated_buf(name) as name_buf: + ossl_cert = self._cert2ossl(cert) if cert else self._ffi.NULL + ossl_pkey = ( + self._key2ossl(key) if key is not None else self._ffi.NULL + ) + + p12 = self._lib.PKCS12_create( + password_buf, + name_buf, + ossl_pkey, + ossl_cert, + sk_x509, + nid_key, + nid_cert, + pkcs12_iter, + mac_iter, + 0, + ) + + if ( + self._lib.Cryptography_HAS_PKCS12_SET_MAC + and mac_alg != self._ffi.NULL + ): + self._lib.PKCS12_set_mac( + p12, + password_buf, + -1, + self._ffi.NULL, + 0, + mac_iter, + mac_alg, + ) + + self.openssl_assert(p12 != self._ffi.NULL) + p12 = self._ffi.gc(p12, self._lib.PKCS12_free) + + bio = self._create_mem_bio_gc() + res = self._lib.i2d_PKCS12_bio(bio, p12) + self.openssl_assert(res > 0) + return self._read_mem_bio(bio) + + def poly1305_supported(self) -> bool: + if self._fips_enabled: + return False + return self._lib.Cryptography_HAS_POLY1305 == 1 + + def pkcs7_supported(self) -> bool: + return not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + + def load_pem_pkcs7_certificates( + self, data: bytes + ) -> typing.List[x509.Certificate]: + utils._check_bytes("data", data) + bio = self._bytes_to_bio(data) + p7 = self._lib.PEM_read_bio_PKCS7( + bio.bio, self._ffi.NULL, self._ffi.NULL, self._ffi.NULL + ) + if p7 == self._ffi.NULL: + self._consume_errors() + raise ValueError("Unable to parse PKCS7 data") + + p7 = self._ffi.gc(p7, self._lib.PKCS7_free) + return self._load_pkcs7_certificates(p7) + + def load_der_pkcs7_certificates( + self, data: bytes + ) -> typing.List[x509.Certificate]: + utils._check_bytes("data", data) + bio = self._bytes_to_bio(data) + p7 = self._lib.d2i_PKCS7_bio(bio.bio, self._ffi.NULL) + if p7 == self._ffi.NULL: + self._consume_errors() + raise ValueError("Unable to parse PKCS7 data") + + p7 = self._ffi.gc(p7, self._lib.PKCS7_free) + return self._load_pkcs7_certificates(p7) + + def _load_pkcs7_certificates(self, p7) -> typing.List[x509.Certificate]: + nid = self._lib.OBJ_obj2nid(p7.type) + self.openssl_assert(nid != self._lib.NID_undef) + if nid != self._lib.NID_pkcs7_signed: + raise UnsupportedAlgorithm( + "Only basic signed structures are currently supported. NID" + " for this data was {}".format(nid), + _Reasons.UNSUPPORTED_SERIALIZATION, + ) + + sk_x509 = p7.d.sign.cert + num = self._lib.sk_X509_num(sk_x509) + certs = [] + for i in range(num): + x509 = self._lib.sk_X509_value(sk_x509, i) + self.openssl_assert(x509 != self._ffi.NULL) + cert = self._ossl2cert(x509) + certs.append(cert) + + return certs + + +class GetCipherByName: + def __init__(self, fmt: str): + self._fmt = fmt + + def __call__(self, backend: Backend, cipher: CipherAlgorithm, mode: Mode): + cipher_name = self._fmt.format(cipher=cipher, mode=mode).lower() + evp_cipher = backend._lib.EVP_get_cipherbyname( + cipher_name.encode("ascii") + ) + + # try EVP_CIPHER_fetch if present + if ( + evp_cipher == backend._ffi.NULL + and backend._lib.Cryptography_HAS_300_EVP_CIPHER + ): + evp_cipher = backend._lib.EVP_CIPHER_fetch( + backend._ffi.NULL, + cipher_name.encode("ascii"), + backend._ffi.NULL, + ) + + backend._consume_errors() + return evp_cipher + + +def _get_xts_cipher(backend: Backend, cipher: AES, mode): + cipher_name = f"aes-{cipher.key_size // 2}-xts" + return backend._lib.EVP_get_cipherbyname(cipher_name.encode("ascii")) + + +backend = Backend() diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/ciphers.py b/billinglayer/python/cryptography/hazmat/backends/openssl/ciphers.py new file mode 100644 index 0000000..bc42adb --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/ciphers.py @@ -0,0 +1,281 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import InvalidTag, UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.primitives import ciphers +from cryptography.hazmat.primitives.ciphers import algorithms, modes + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +class _CipherContext: + _ENCRYPT = 1 + _DECRYPT = 0 + _MAX_CHUNK_SIZE = 2**30 - 1 + + def __init__(self, backend: Backend, cipher, mode, operation: int) -> None: + self._backend = backend + self._cipher = cipher + self._mode = mode + self._operation = operation + self._tag: typing.Optional[bytes] = None + + if isinstance(self._cipher, ciphers.BlockCipherAlgorithm): + self._block_size_bytes = self._cipher.block_size // 8 + else: + self._block_size_bytes = 1 + + ctx = self._backend._lib.EVP_CIPHER_CTX_new() + ctx = self._backend._ffi.gc( + ctx, self._backend._lib.EVP_CIPHER_CTX_free + ) + + registry = self._backend._cipher_registry + try: + adapter = registry[type(cipher), type(mode)] + except KeyError: + raise UnsupportedAlgorithm( + "cipher {} in {} mode is not supported " + "by this backend.".format( + cipher.name, mode.name if mode else mode + ), + _Reasons.UNSUPPORTED_CIPHER, + ) + + evp_cipher = adapter(self._backend, cipher, mode) + if evp_cipher == self._backend._ffi.NULL: + msg = f"cipher {cipher.name} " + if mode is not None: + msg += f"in {mode.name} mode " + msg += ( + "is not supported by this backend (Your version of OpenSSL " + "may be too old. Current version: {}.)" + ).format(self._backend.openssl_version_text()) + raise UnsupportedAlgorithm(msg, _Reasons.UNSUPPORTED_CIPHER) + + if isinstance(mode, modes.ModeWithInitializationVector): + iv_nonce = self._backend._ffi.from_buffer( + mode.initialization_vector + ) + elif isinstance(mode, modes.ModeWithTweak): + iv_nonce = self._backend._ffi.from_buffer(mode.tweak) + elif isinstance(mode, modes.ModeWithNonce): + iv_nonce = self._backend._ffi.from_buffer(mode.nonce) + elif isinstance(cipher, algorithms.ChaCha20): + iv_nonce = self._backend._ffi.from_buffer(cipher.nonce) + else: + iv_nonce = self._backend._ffi.NULL + # begin init with cipher and operation type + res = self._backend._lib.EVP_CipherInit_ex( + ctx, + evp_cipher, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + operation, + ) + self._backend.openssl_assert(res != 0) + # set the key length to handle variable key ciphers + res = self._backend._lib.EVP_CIPHER_CTX_set_key_length( + ctx, len(cipher.key) + ) + self._backend.openssl_assert(res != 0) + if isinstance(mode, modes.GCM): + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + self._backend._lib.EVP_CTRL_AEAD_SET_IVLEN, + len(iv_nonce), + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(res != 0) + if mode.tag is not None: + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + self._backend._lib.EVP_CTRL_AEAD_SET_TAG, + len(mode.tag), + mode.tag, + ) + self._backend.openssl_assert(res != 0) + self._tag = mode.tag + + # pass key/iv + res = self._backend._lib.EVP_CipherInit_ex( + ctx, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + self._backend._ffi.from_buffer(cipher.key), + iv_nonce, + operation, + ) + + # Check for XTS mode duplicate keys error + errors = self._backend._consume_errors() + lib = self._backend._lib + if res == 0 and ( + ( + not lib.CRYPTOGRAPHY_IS_LIBRESSL + and errors[0]._lib_reason_match( + lib.ERR_LIB_EVP, lib.EVP_R_XTS_DUPLICATED_KEYS + ) + ) + or ( + lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + lib.ERR_LIB_PROV, lib.PROV_R_XTS_DUPLICATED_KEYS + ) + ) + ): + raise ValueError("In XTS mode duplicated keys are not allowed") + + self._backend.openssl_assert(res != 0, errors=errors) + + # We purposely disable padding here as it's handled higher up in the + # API. + self._backend._lib.EVP_CIPHER_CTX_set_padding(ctx, 0) + self._ctx = ctx + + def update(self, data: bytes) -> bytes: + buf = bytearray(len(data) + self._block_size_bytes - 1) + n = self.update_into(data, buf) + return bytes(buf[:n]) + + def update_into(self, data: bytes, buf: bytes) -> int: + total_data_len = len(data) + if len(buf) < (total_data_len + self._block_size_bytes - 1): + raise ValueError( + "buffer must be at least {} bytes for this " + "payload".format(len(data) + self._block_size_bytes - 1) + ) + + data_processed = 0 + total_out = 0 + outlen = self._backend._ffi.new("int *") + baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True) + baseinbuf = self._backend._ffi.from_buffer(data) + + while data_processed != total_data_len: + outbuf = baseoutbuf + total_out + inbuf = baseinbuf + data_processed + inlen = min(self._MAX_CHUNK_SIZE, total_data_len - data_processed) + + res = self._backend._lib.EVP_CipherUpdate( + self._ctx, outbuf, outlen, inbuf, inlen + ) + if res == 0 and isinstance(self._mode, modes.XTS): + self._backend._consume_errors() + raise ValueError( + "In XTS mode you must supply at least a full block in the " + "first update call. For AES this is 16 bytes." + ) + else: + self._backend.openssl_assert(res != 0) + data_processed += inlen + total_out += outlen[0] + + return total_out + + def finalize(self) -> bytes: + if ( + self._operation == self._DECRYPT + and isinstance(self._mode, modes.ModeWithAuthenticationTag) + and self.tag is None + ): + raise ValueError( + "Authentication tag must be provided when decrypting." + ) + + buf = self._backend._ffi.new("unsigned char[]", self._block_size_bytes) + outlen = self._backend._ffi.new("int *") + res = self._backend._lib.EVP_CipherFinal_ex(self._ctx, buf, outlen) + if res == 0: + errors = self._backend._consume_errors() + + if not errors and isinstance(self._mode, modes.GCM): + raise InvalidTag + + lib = self._backend._lib + self._backend.openssl_assert( + errors[0]._lib_reason_match( + lib.ERR_LIB_EVP, + lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH, + ) + or ( + lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + lib.ERR_LIB_PROV, + lib.PROV_R_WRONG_FINAL_BLOCK_LENGTH, + ) + ) + or ( + lib.CRYPTOGRAPHY_IS_BORINGSSL + and errors[0].reason + == lib.CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH + ), + errors=errors, + ) + raise ValueError( + "The length of the provided data is not a multiple of " + "the block length." + ) + + if ( + isinstance(self._mode, modes.GCM) + and self._operation == self._ENCRYPT + ): + tag_buf = self._backend._ffi.new( + "unsigned char[]", self._block_size_bytes + ) + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + self._ctx, + self._backend._lib.EVP_CTRL_AEAD_GET_TAG, + self._block_size_bytes, + tag_buf, + ) + self._backend.openssl_assert(res != 0) + self._tag = self._backend._ffi.buffer(tag_buf)[:] + + res = self._backend._lib.EVP_CIPHER_CTX_reset(self._ctx) + self._backend.openssl_assert(res == 1) + return self._backend._ffi.buffer(buf)[: outlen[0]] + + def finalize_with_tag(self, tag: bytes) -> bytes: + tag_len = len(tag) + if tag_len < self._mode._min_tag_length: + raise ValueError( + "Authentication tag must be {} bytes or longer.".format( + self._mode._min_tag_length + ) + ) + elif tag_len > self._block_size_bytes: + raise ValueError( + "Authentication tag cannot be more than {} bytes.".format( + self._block_size_bytes + ) + ) + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + self._ctx, self._backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag + ) + self._backend.openssl_assert(res != 0) + self._tag = tag + return self.finalize() + + def authenticate_additional_data(self, data: bytes) -> None: + outlen = self._backend._ffi.new("int *") + res = self._backend._lib.EVP_CipherUpdate( + self._ctx, + self._backend._ffi.NULL, + outlen, + self._backend._ffi.from_buffer(data), + len(data), + ) + self._backend.openssl_assert(res != 0) + + @property + def tag(self) -> typing.Optional[bytes]: + return self._tag diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/cmac.py b/billinglayer/python/cryptography/hazmat/backends/openssl/cmac.py new file mode 100644 index 0000000..bdd7fec --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/cmac.py @@ -0,0 +1,89 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import ( + InvalidSignature, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.primitives import constant_time +from cryptography.hazmat.primitives.ciphers.modes import CBC + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + from cryptography.hazmat.primitives import ciphers + + +class _CMACContext: + def __init__( + self, + backend: Backend, + algorithm: ciphers.BlockCipherAlgorithm, + ctx=None, + ) -> None: + if not backend.cmac_algorithm_supported(algorithm): + raise UnsupportedAlgorithm( + "This backend does not support CMAC.", + _Reasons.UNSUPPORTED_CIPHER, + ) + + self._backend = backend + self._key = algorithm.key + self._algorithm = algorithm + self._output_length = algorithm.block_size // 8 + + if ctx is None: + registry = self._backend._cipher_registry + adapter = registry[type(algorithm), CBC] + + evp_cipher = adapter(self._backend, algorithm, CBC) + + ctx = self._backend._lib.CMAC_CTX_new() + + self._backend.openssl_assert(ctx != self._backend._ffi.NULL) + ctx = self._backend._ffi.gc(ctx, self._backend._lib.CMAC_CTX_free) + + key_ptr = self._backend._ffi.from_buffer(self._key) + res = self._backend._lib.CMAC_Init( + ctx, + key_ptr, + len(self._key), + evp_cipher, + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(res == 1) + + self._ctx = ctx + + def update(self, data: bytes) -> None: + res = self._backend._lib.CMAC_Update(self._ctx, data, len(data)) + self._backend.openssl_assert(res == 1) + + def finalize(self) -> bytes: + buf = self._backend._ffi.new("unsigned char[]", self._output_length) + length = self._backend._ffi.new("size_t *", self._output_length) + res = self._backend._lib.CMAC_Final(self._ctx, buf, length) + self._backend.openssl_assert(res == 1) + + self._ctx = None + + return self._backend._ffi.buffer(buf)[:] + + def copy(self) -> _CMACContext: + copied_ctx = self._backend._lib.CMAC_CTX_new() + copied_ctx = self._backend._ffi.gc( + copied_ctx, self._backend._lib.CMAC_CTX_free + ) + res = self._backend._lib.CMAC_CTX_copy(copied_ctx, self._ctx) + self._backend.openssl_assert(res == 1) + return _CMACContext(self._backend, self._algorithm, ctx=copied_ctx) + + def verify(self, signature: bytes) -> None: + digest = self.finalize() + if not constant_time.bytes_eq(digest, signature): + raise InvalidSignature("Signature did not match digest.") diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/decode_asn1.py b/billinglayer/python/cryptography/hazmat/backends/openssl/decode_asn1.py new file mode 100644 index 0000000..bf123b6 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/decode_asn1.py @@ -0,0 +1,32 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography import x509 + +# CRLReason ::= ENUMERATED { +# unspecified (0), +# keyCompromise (1), +# cACompromise (2), +# affiliationChanged (3), +# superseded (4), +# cessationOfOperation (5), +# certificateHold (6), +# -- value 7 is not used +# removeFromCRL (8), +# privilegeWithdrawn (9), +# aACompromise (10) } +_CRL_ENTRY_REASON_ENUM_TO_CODE = { + x509.ReasonFlags.unspecified: 0, + x509.ReasonFlags.key_compromise: 1, + x509.ReasonFlags.ca_compromise: 2, + x509.ReasonFlags.affiliation_changed: 3, + x509.ReasonFlags.superseded: 4, + x509.ReasonFlags.cessation_of_operation: 5, + x509.ReasonFlags.certificate_hold: 6, + x509.ReasonFlags.remove_from_crl: 8, + x509.ReasonFlags.privilege_withdrawn: 9, + x509.ReasonFlags.aa_compromise: 10, +} diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/ec.py b/billinglayer/python/cryptography/hazmat/backends/openssl/ec.py new file mode 100644 index 0000000..9821bd1 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/ec.py @@ -0,0 +1,328 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import ( + InvalidSignature, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.backends.openssl.utils import ( + _calculate_digest_and_algorithm, + _evp_pkey_derive, +) +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives.asymmetric import ec + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +def _check_signature_algorithm( + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, +) -> None: + if not isinstance(signature_algorithm, ec.ECDSA): + raise UnsupportedAlgorithm( + "Unsupported elliptic curve signature algorithm.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + +def _ec_key_curve_sn(backend: Backend, ec_key) -> str: + group = backend._lib.EC_KEY_get0_group(ec_key) + backend.openssl_assert(group != backend._ffi.NULL) + + nid = backend._lib.EC_GROUP_get_curve_name(group) + # The following check is to find EC keys with unnamed curves and raise + # an error for now. + if nid == backend._lib.NID_undef: + raise ValueError( + "ECDSA keys with explicit parameters are unsupported at this time" + ) + + # This is like the above check, but it also catches the case where you + # explicitly encoded a curve with the same parameters as a named curve. + # Don't do that. + if ( + not backend._lib.CRYPTOGRAPHY_IS_LIBRESSL + and backend._lib.EC_GROUP_get_asn1_flag(group) == 0 + ): + raise ValueError( + "ECDSA keys with explicit parameters are unsupported at this time" + ) + + curve_name = backend._lib.OBJ_nid2sn(nid) + backend.openssl_assert(curve_name != backend._ffi.NULL) + + sn = backend._ffi.string(curve_name).decode("ascii") + return sn + + +def _mark_asn1_named_ec_curve(backend: Backend, ec_cdata): + """ + Set the named curve flag on the EC_KEY. This causes OpenSSL to + serialize EC keys along with their curve OID which makes + deserialization easier. + """ + + backend._lib.EC_KEY_set_asn1_flag( + ec_cdata, backend._lib.OPENSSL_EC_NAMED_CURVE + ) + + +def _check_key_infinity(backend: Backend, ec_cdata) -> None: + point = backend._lib.EC_KEY_get0_public_key(ec_cdata) + backend.openssl_assert(point != backend._ffi.NULL) + group = backend._lib.EC_KEY_get0_group(ec_cdata) + backend.openssl_assert(group != backend._ffi.NULL) + if backend._lib.EC_POINT_is_at_infinity(group, point): + raise ValueError( + "Cannot load an EC public key where the point is at infinity" + ) + + +def _sn_to_elliptic_curve(backend: Backend, sn: str) -> ec.EllipticCurve: + try: + return ec._CURVE_TYPES[sn]() + except KeyError: + raise UnsupportedAlgorithm( + f"{sn} is not a supported elliptic curve", + _Reasons.UNSUPPORTED_ELLIPTIC_CURVE, + ) + + +def _ecdsa_sig_sign( + backend: Backend, private_key: _EllipticCurvePrivateKey, data: bytes +) -> bytes: + max_size = backend._lib.ECDSA_size(private_key._ec_key) + backend.openssl_assert(max_size > 0) + + sigbuf = backend._ffi.new("unsigned char[]", max_size) + siglen_ptr = backend._ffi.new("unsigned int[]", 1) + res = backend._lib.ECDSA_sign( + 0, data, len(data), sigbuf, siglen_ptr, private_key._ec_key + ) + backend.openssl_assert(res == 1) + return backend._ffi.buffer(sigbuf)[: siglen_ptr[0]] + + +def _ecdsa_sig_verify( + backend: Backend, + public_key: _EllipticCurvePublicKey, + signature: bytes, + data: bytes, +) -> None: + res = backend._lib.ECDSA_verify( + 0, data, len(data), signature, len(signature), public_key._ec_key + ) + if res != 1: + backend._consume_errors() + raise InvalidSignature + + +class _EllipticCurvePrivateKey(ec.EllipticCurvePrivateKey): + def __init__(self, backend: Backend, ec_key_cdata, evp_pkey): + self._backend = backend + self._ec_key = ec_key_cdata + self._evp_pkey = evp_pkey + + sn = _ec_key_curve_sn(backend, ec_key_cdata) + self._curve = _sn_to_elliptic_curve(backend, sn) + _mark_asn1_named_ec_curve(backend, ec_key_cdata) + _check_key_infinity(backend, ec_key_cdata) + + @property + def curve(self) -> ec.EllipticCurve: + return self._curve + + @property + def key_size(self) -> int: + return self.curve.key_size + + def exchange( + self, algorithm: ec.ECDH, peer_public_key: ec.EllipticCurvePublicKey + ) -> bytes: + if not ( + self._backend.elliptic_curve_exchange_algorithm_supported( + algorithm, self.curve + ) + ): + raise UnsupportedAlgorithm( + "This backend does not support the ECDH algorithm.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + if peer_public_key.curve.name != self.curve.name: + raise ValueError( + "peer_public_key and self are not on the same curve" + ) + + return _evp_pkey_derive(self._backend, self._evp_pkey, peer_public_key) + + def public_key(self) -> ec.EllipticCurvePublicKey: + group = self._backend._lib.EC_KEY_get0_group(self._ec_key) + self._backend.openssl_assert(group != self._backend._ffi.NULL) + + curve_nid = self._backend._lib.EC_GROUP_get_curve_name(group) + public_ec_key = self._backend._ec_key_new_by_curve_nid(curve_nid) + + point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key) + self._backend.openssl_assert(point != self._backend._ffi.NULL) + + res = self._backend._lib.EC_KEY_set_public_key(public_ec_key, point) + self._backend.openssl_assert(res == 1) + + evp_pkey = self._backend._ec_cdata_to_evp_pkey(public_ec_key) + + return _EllipticCurvePublicKey(self._backend, public_ec_key, evp_pkey) + + def private_numbers(self) -> ec.EllipticCurvePrivateNumbers: + bn = self._backend._lib.EC_KEY_get0_private_key(self._ec_key) + private_value = self._backend._bn_to_int(bn) + return ec.EllipticCurvePrivateNumbers( + private_value=private_value, + public_numbers=self.public_key().public_numbers(), + ) + + def private_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PrivateFormat, + encryption_algorithm: serialization.KeySerializationEncryption, + ) -> bytes: + return self._backend._private_key_bytes( + encoding, + format, + encryption_algorithm, + self, + self._evp_pkey, + self._ec_key, + ) + + def sign( + self, + data: bytes, + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, + ) -> bytes: + _check_signature_algorithm(signature_algorithm) + data, _ = _calculate_digest_and_algorithm( + data, + signature_algorithm.algorithm, + ) + return _ecdsa_sig_sign(self._backend, self, data) + + +class _EllipticCurvePublicKey(ec.EllipticCurvePublicKey): + def __init__(self, backend: Backend, ec_key_cdata, evp_pkey): + self._backend = backend + self._ec_key = ec_key_cdata + self._evp_pkey = evp_pkey + + sn = _ec_key_curve_sn(backend, ec_key_cdata) + self._curve = _sn_to_elliptic_curve(backend, sn) + _mark_asn1_named_ec_curve(backend, ec_key_cdata) + _check_key_infinity(backend, ec_key_cdata) + + @property + def curve(self) -> ec.EllipticCurve: + return self._curve + + @property + def key_size(self) -> int: + return self.curve.key_size + + def __eq__(self, other: object) -> bool: + if not isinstance(other, _EllipticCurvePublicKey): + return NotImplemented + + return ( + self._backend._lib.EVP_PKEY_cmp(self._evp_pkey, other._evp_pkey) + == 1 + ) + + def public_numbers(self) -> ec.EllipticCurvePublicNumbers: + group = self._backend._lib.EC_KEY_get0_group(self._ec_key) + self._backend.openssl_assert(group != self._backend._ffi.NULL) + + point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key) + self._backend.openssl_assert(point != self._backend._ffi.NULL) + + with self._backend._tmp_bn_ctx() as bn_ctx: + bn_x = self._backend._lib.BN_CTX_get(bn_ctx) + bn_y = self._backend._lib.BN_CTX_get(bn_ctx) + + res = self._backend._lib.EC_POINT_get_affine_coordinates( + group, point, bn_x, bn_y, bn_ctx + ) + self._backend.openssl_assert(res == 1) + + x = self._backend._bn_to_int(bn_x) + y = self._backend._bn_to_int(bn_y) + + return ec.EllipticCurvePublicNumbers(x=x, y=y, curve=self._curve) + + def _encode_point(self, format: serialization.PublicFormat) -> bytes: + if format is serialization.PublicFormat.CompressedPoint: + conversion = self._backend._lib.POINT_CONVERSION_COMPRESSED + else: + assert format is serialization.PublicFormat.UncompressedPoint + conversion = self._backend._lib.POINT_CONVERSION_UNCOMPRESSED + + group = self._backend._lib.EC_KEY_get0_group(self._ec_key) + self._backend.openssl_assert(group != self._backend._ffi.NULL) + point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key) + self._backend.openssl_assert(point != self._backend._ffi.NULL) + with self._backend._tmp_bn_ctx() as bn_ctx: + buflen = self._backend._lib.EC_POINT_point2oct( + group, point, conversion, self._backend._ffi.NULL, 0, bn_ctx + ) + self._backend.openssl_assert(buflen > 0) + buf = self._backend._ffi.new("char[]", buflen) + res = self._backend._lib.EC_POINT_point2oct( + group, point, conversion, buf, buflen, bn_ctx + ) + self._backend.openssl_assert(buflen == res) + + return self._backend._ffi.buffer(buf)[:] + + def public_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PublicFormat, + ) -> bytes: + if ( + encoding is serialization.Encoding.X962 + or format is serialization.PublicFormat.CompressedPoint + or format is serialization.PublicFormat.UncompressedPoint + ): + if encoding is not serialization.Encoding.X962 or format not in ( + serialization.PublicFormat.CompressedPoint, + serialization.PublicFormat.UncompressedPoint, + ): + raise ValueError( + "X962 encoding must be used with CompressedPoint or " + "UncompressedPoint format" + ) + + return self._encode_point(format) + else: + return self._backend._public_key_bytes( + encoding, format, self, self._evp_pkey, None + ) + + def verify( + self, + signature: bytes, + data: bytes, + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, + ) -> None: + _check_signature_algorithm(signature_algorithm) + data, _ = _calculate_digest_and_algorithm( + data, + signature_algorithm.algorithm, + ) + _ecdsa_sig_verify(self._backend, self, signature, data) diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/rsa.py b/billinglayer/python/cryptography/hazmat/backends/openssl/rsa.py new file mode 100644 index 0000000..ef27d4e --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/rsa.py @@ -0,0 +1,599 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import threading +import typing + +from cryptography.exceptions import ( + InvalidSignature, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.backends.openssl.utils import ( + _calculate_digest_and_algorithm, +) +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils +from cryptography.hazmat.primitives.asymmetric.padding import ( + MGF1, + OAEP, + PSS, + AsymmetricPadding, + PKCS1v15, + _Auto, + _DigestLength, + _MaxLength, + calculate_max_pss_salt_length, +) +from cryptography.hazmat.primitives.asymmetric.rsa import ( + RSAPrivateKey, + RSAPrivateNumbers, + RSAPublicKey, + RSAPublicNumbers, +) + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +def _get_rsa_pss_salt_length( + backend: Backend, + pss: PSS, + key: typing.Union[RSAPrivateKey, RSAPublicKey], + hash_algorithm: hashes.HashAlgorithm, +) -> int: + salt = pss._salt_length + + if isinstance(salt, _MaxLength): + return calculate_max_pss_salt_length(key, hash_algorithm) + elif isinstance(salt, _DigestLength): + return hash_algorithm.digest_size + elif isinstance(salt, _Auto): + if isinstance(key, RSAPrivateKey): + raise ValueError( + "PSS salt length can only be set to AUTO when verifying" + ) + return backend._lib.RSA_PSS_SALTLEN_AUTO + else: + return salt + + +def _enc_dec_rsa( + backend: Backend, + key: typing.Union[_RSAPrivateKey, _RSAPublicKey], + data: bytes, + padding: AsymmetricPadding, +) -> bytes: + if not isinstance(padding, AsymmetricPadding): + raise TypeError("Padding must be an instance of AsymmetricPadding.") + + if isinstance(padding, PKCS1v15): + padding_enum = backend._lib.RSA_PKCS1_PADDING + elif isinstance(padding, OAEP): + padding_enum = backend._lib.RSA_PKCS1_OAEP_PADDING + + if not isinstance(padding._mgf, MGF1): + raise UnsupportedAlgorithm( + "Only MGF1 is supported by this backend.", + _Reasons.UNSUPPORTED_MGF, + ) + + if not backend.rsa_padding_supported(padding): + raise UnsupportedAlgorithm( + "This combination of padding and hash algorithm is not " + "supported by this backend.", + _Reasons.UNSUPPORTED_PADDING, + ) + + else: + raise UnsupportedAlgorithm( + f"{padding.name} is not supported by this backend.", + _Reasons.UNSUPPORTED_PADDING, + ) + + return _enc_dec_rsa_pkey_ctx(backend, key, data, padding_enum, padding) + + +def _enc_dec_rsa_pkey_ctx( + backend: Backend, + key: typing.Union[_RSAPrivateKey, _RSAPublicKey], + data: bytes, + padding_enum: int, + padding: AsymmetricPadding, +) -> bytes: + init: typing.Callable[[typing.Any], int] + crypt: typing.Callable[[typing.Any, typing.Any, int, bytes, int], int] + if isinstance(key, _RSAPublicKey): + init = backend._lib.EVP_PKEY_encrypt_init + crypt = backend._lib.EVP_PKEY_encrypt + else: + init = backend._lib.EVP_PKEY_decrypt_init + crypt = backend._lib.EVP_PKEY_decrypt + + pkey_ctx = backend._lib.EVP_PKEY_CTX_new(key._evp_pkey, backend._ffi.NULL) + backend.openssl_assert(pkey_ctx != backend._ffi.NULL) + pkey_ctx = backend._ffi.gc(pkey_ctx, backend._lib.EVP_PKEY_CTX_free) + res = init(pkey_ctx) + backend.openssl_assert(res == 1) + res = backend._lib.EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, padding_enum) + backend.openssl_assert(res > 0) + buf_size = backend._lib.EVP_PKEY_size(key._evp_pkey) + backend.openssl_assert(buf_size > 0) + if isinstance(padding, OAEP): + mgf1_md = backend._evp_md_non_null_from_algorithm( + padding._mgf._algorithm + ) + res = backend._lib.EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, mgf1_md) + backend.openssl_assert(res > 0) + oaep_md = backend._evp_md_non_null_from_algorithm(padding._algorithm) + res = backend._lib.EVP_PKEY_CTX_set_rsa_oaep_md(pkey_ctx, oaep_md) + backend.openssl_assert(res > 0) + + if ( + isinstance(padding, OAEP) + and padding._label is not None + and len(padding._label) > 0 + ): + # set0_rsa_oaep_label takes ownership of the char * so we need to + # copy it into some new memory + labelptr = backend._lib.OPENSSL_malloc(len(padding._label)) + backend.openssl_assert(labelptr != backend._ffi.NULL) + backend._ffi.memmove(labelptr, padding._label, len(padding._label)) + res = backend._lib.EVP_PKEY_CTX_set0_rsa_oaep_label( + pkey_ctx, labelptr, len(padding._label) + ) + backend.openssl_assert(res == 1) + + outlen = backend._ffi.new("size_t *", buf_size) + buf = backend._ffi.new("unsigned char[]", buf_size) + # Everything from this line onwards is written with the goal of being as + # constant-time as is practical given the constraints of Python and our + # API. See Bleichenbacher's '98 attack on RSA, and its many many variants. + # As such, you should not attempt to change this (particularly to "clean it + # up") without understanding why it was written this way (see + # Chesterton's Fence), and without measuring to verify you have not + # introduced observable time differences. + res = crypt(pkey_ctx, buf, outlen, data, len(data)) + resbuf = backend._ffi.buffer(buf)[: outlen[0]] + backend._lib.ERR_clear_error() + if res <= 0: + raise ValueError("Encryption/decryption failed.") + return resbuf + + +def _rsa_sig_determine_padding( + backend: Backend, + key: typing.Union[_RSAPrivateKey, _RSAPublicKey], + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], +) -> int: + if not isinstance(padding, AsymmetricPadding): + raise TypeError("Expected provider of AsymmetricPadding.") + + pkey_size = backend._lib.EVP_PKEY_size(key._evp_pkey) + backend.openssl_assert(pkey_size > 0) + + if isinstance(padding, PKCS1v15): + # Hash algorithm is ignored for PKCS1v15-padding, may be None. + padding_enum = backend._lib.RSA_PKCS1_PADDING + elif isinstance(padding, PSS): + if not isinstance(padding._mgf, MGF1): + raise UnsupportedAlgorithm( + "Only MGF1 is supported by this backend.", + _Reasons.UNSUPPORTED_MGF, + ) + + # PSS padding requires a hash algorithm + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of hashes.HashAlgorithm.") + + # Size of key in bytes - 2 is the maximum + # PSS signature length (salt length is checked later) + if pkey_size - algorithm.digest_size - 2 < 0: + raise ValueError( + "Digest too large for key size. Use a larger " + "key or different digest." + ) + + padding_enum = backend._lib.RSA_PKCS1_PSS_PADDING + else: + raise UnsupportedAlgorithm( + f"{padding.name} is not supported by this backend.", + _Reasons.UNSUPPORTED_PADDING, + ) + + return padding_enum + + +# Hash algorithm can be absent (None) to initialize the context without setting +# any message digest algorithm. This is currently only valid for the PKCS1v15 +# padding type, where it means that the signature data is encoded/decoded +# as provided, without being wrapped in a DigestInfo structure. +def _rsa_sig_setup( + backend: Backend, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + key: typing.Union[_RSAPublicKey, _RSAPrivateKey], + init_func: typing.Callable[[typing.Any], int], +): + padding_enum = _rsa_sig_determine_padding(backend, key, padding, algorithm) + pkey_ctx = backend._lib.EVP_PKEY_CTX_new(key._evp_pkey, backend._ffi.NULL) + backend.openssl_assert(pkey_ctx != backend._ffi.NULL) + pkey_ctx = backend._ffi.gc(pkey_ctx, backend._lib.EVP_PKEY_CTX_free) + res = init_func(pkey_ctx) + if res != 1: + errors = backend._consume_errors() + raise ValueError("Unable to sign/verify with this key", errors) + + if algorithm is not None: + evp_md = backend._evp_md_non_null_from_algorithm(algorithm) + res = backend._lib.EVP_PKEY_CTX_set_signature_md(pkey_ctx, evp_md) + if res <= 0: + backend._consume_errors() + raise UnsupportedAlgorithm( + "{} is not supported by this backend for RSA signing.".format( + algorithm.name + ), + _Reasons.UNSUPPORTED_HASH, + ) + res = backend._lib.EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, padding_enum) + if res <= 0: + backend._consume_errors() + raise UnsupportedAlgorithm( + "{} is not supported for the RSA signature operation.".format( + padding.name + ), + _Reasons.UNSUPPORTED_PADDING, + ) + if isinstance(padding, PSS): + assert isinstance(algorithm, hashes.HashAlgorithm) + res = backend._lib.EVP_PKEY_CTX_set_rsa_pss_saltlen( + pkey_ctx, + _get_rsa_pss_salt_length(backend, padding, key, algorithm), + ) + backend.openssl_assert(res > 0) + + mgf1_md = backend._evp_md_non_null_from_algorithm( + padding._mgf._algorithm + ) + res = backend._lib.EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, mgf1_md) + backend.openssl_assert(res > 0) + + return pkey_ctx + + +def _rsa_sig_sign( + backend: Backend, + padding: AsymmetricPadding, + algorithm: hashes.HashAlgorithm, + private_key: _RSAPrivateKey, + data: bytes, +) -> bytes: + pkey_ctx = _rsa_sig_setup( + backend, + padding, + algorithm, + private_key, + backend._lib.EVP_PKEY_sign_init, + ) + buflen = backend._ffi.new("size_t *") + res = backend._lib.EVP_PKEY_sign( + pkey_ctx, backend._ffi.NULL, buflen, data, len(data) + ) + backend.openssl_assert(res == 1) + buf = backend._ffi.new("unsigned char[]", buflen[0]) + res = backend._lib.EVP_PKEY_sign(pkey_ctx, buf, buflen, data, len(data)) + if res != 1: + errors = backend._consume_errors() + raise ValueError( + "Digest or salt length too long for key size. Use a larger key " + "or shorter salt length if you are specifying a PSS salt", + errors, + ) + + return backend._ffi.buffer(buf)[:] + + +def _rsa_sig_verify( + backend: Backend, + padding: AsymmetricPadding, + algorithm: hashes.HashAlgorithm, + public_key: _RSAPublicKey, + signature: bytes, + data: bytes, +) -> None: + pkey_ctx = _rsa_sig_setup( + backend, + padding, + algorithm, + public_key, + backend._lib.EVP_PKEY_verify_init, + ) + res = backend._lib.EVP_PKEY_verify( + pkey_ctx, signature, len(signature), data, len(data) + ) + # The previous call can return negative numbers in the event of an + # error. This is not a signature failure but we need to fail if it + # occurs. + backend.openssl_assert(res >= 0) + if res == 0: + backend._consume_errors() + raise InvalidSignature + + +def _rsa_sig_recover( + backend: Backend, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + public_key: _RSAPublicKey, + signature: bytes, +) -> bytes: + pkey_ctx = _rsa_sig_setup( + backend, + padding, + algorithm, + public_key, + backend._lib.EVP_PKEY_verify_recover_init, + ) + + # Attempt to keep the rest of the code in this function as constant/time + # as possible. See the comment in _enc_dec_rsa_pkey_ctx. Note that the + # buflen parameter is used even though its value may be undefined in the + # error case. Due to the tolerant nature of Python slicing this does not + # trigger any exceptions. + maxlen = backend._lib.EVP_PKEY_size(public_key._evp_pkey) + backend.openssl_assert(maxlen > 0) + buf = backend._ffi.new("unsigned char[]", maxlen) + buflen = backend._ffi.new("size_t *", maxlen) + res = backend._lib.EVP_PKEY_verify_recover( + pkey_ctx, buf, buflen, signature, len(signature) + ) + resbuf = backend._ffi.buffer(buf)[: buflen[0]] + backend._lib.ERR_clear_error() + # Assume that all parameter errors are handled during the setup phase and + # any error here is due to invalid signature. + if res != 1: + raise InvalidSignature + return resbuf + + +class _RSAPrivateKey(RSAPrivateKey): + _evp_pkey: object + _rsa_cdata: object + _key_size: int + + def __init__( + self, + backend: Backend, + rsa_cdata, + evp_pkey, + *, + unsafe_skip_rsa_key_validation: bool, + ): + res: int + # RSA_check_key is slower in OpenSSL 3.0.0 due to improved + # primality checking. In normal use this is unlikely to be a problem + # since users don't load new keys constantly, but for TESTING we've + # added an init arg that allows skipping the checks. You should not + # use this in production code unless you understand the consequences. + if not unsafe_skip_rsa_key_validation: + res = backend._lib.RSA_check_key(rsa_cdata) + if res != 1: + errors = backend._consume_errors() + raise ValueError("Invalid private key", errors) + # 2 is prime and passes an RSA key check, so we also check + # if p and q are odd just to be safe. + p = backend._ffi.new("BIGNUM **") + q = backend._ffi.new("BIGNUM **") + backend._lib.RSA_get0_factors(rsa_cdata, p, q) + backend.openssl_assert(p[0] != backend._ffi.NULL) + backend.openssl_assert(q[0] != backend._ffi.NULL) + p_odd = backend._lib.BN_is_odd(p[0]) + q_odd = backend._lib.BN_is_odd(q[0]) + if p_odd != 1 or q_odd != 1: + errors = backend._consume_errors() + raise ValueError("Invalid private key", errors) + + self._backend = backend + self._rsa_cdata = rsa_cdata + self._evp_pkey = evp_pkey + # Used for lazy blinding + self._blinded = False + self._blinding_lock = threading.Lock() + + n = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key( + self._rsa_cdata, + n, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._key_size = self._backend._lib.BN_num_bits(n[0]) + + def _enable_blinding(self) -> None: + # If you call blind on an already blinded RSA key OpenSSL will turn + # it off and back on, which is a performance hit we want to avoid. + if not self._blinded: + with self._blinding_lock: + self._non_threadsafe_enable_blinding() + + def _non_threadsafe_enable_blinding(self) -> None: + # This is only a separate function to allow for testing to cover both + # branches. It should never be invoked except through _enable_blinding. + # Check if it's not True again in case another thread raced past the + # first non-locked check. + if not self._blinded: + res = self._backend._lib.RSA_blinding_on( + self._rsa_cdata, self._backend._ffi.NULL + ) + self._backend.openssl_assert(res == 1) + self._blinded = True + + @property + def key_size(self) -> int: + return self._key_size + + def decrypt(self, ciphertext: bytes, padding: AsymmetricPadding) -> bytes: + self._enable_blinding() + key_size_bytes = (self.key_size + 7) // 8 + if key_size_bytes != len(ciphertext): + raise ValueError("Ciphertext length must be equal to key size.") + + return _enc_dec_rsa(self._backend, self, ciphertext, padding) + + def public_key(self) -> RSAPublicKey: + ctx = self._backend._lib.RSAPublicKey_dup(self._rsa_cdata) + self._backend.openssl_assert(ctx != self._backend._ffi.NULL) + ctx = self._backend._ffi.gc(ctx, self._backend._lib.RSA_free) + evp_pkey = self._backend._rsa_cdata_to_evp_pkey(ctx) + return _RSAPublicKey(self._backend, ctx, evp_pkey) + + def private_numbers(self) -> RSAPrivateNumbers: + n = self._backend._ffi.new("BIGNUM **") + e = self._backend._ffi.new("BIGNUM **") + d = self._backend._ffi.new("BIGNUM **") + p = self._backend._ffi.new("BIGNUM **") + q = self._backend._ffi.new("BIGNUM **") + dmp1 = self._backend._ffi.new("BIGNUM **") + dmq1 = self._backend._ffi.new("BIGNUM **") + iqmp = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key(self._rsa_cdata, n, e, d) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(e[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(d[0] != self._backend._ffi.NULL) + self._backend._lib.RSA_get0_factors(self._rsa_cdata, p, q) + self._backend.openssl_assert(p[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(q[0] != self._backend._ffi.NULL) + self._backend._lib.RSA_get0_crt_params( + self._rsa_cdata, dmp1, dmq1, iqmp + ) + self._backend.openssl_assert(dmp1[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(dmq1[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(iqmp[0] != self._backend._ffi.NULL) + return RSAPrivateNumbers( + p=self._backend._bn_to_int(p[0]), + q=self._backend._bn_to_int(q[0]), + d=self._backend._bn_to_int(d[0]), + dmp1=self._backend._bn_to_int(dmp1[0]), + dmq1=self._backend._bn_to_int(dmq1[0]), + iqmp=self._backend._bn_to_int(iqmp[0]), + public_numbers=RSAPublicNumbers( + e=self._backend._bn_to_int(e[0]), + n=self._backend._bn_to_int(n[0]), + ), + ) + + def private_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PrivateFormat, + encryption_algorithm: serialization.KeySerializationEncryption, + ) -> bytes: + return self._backend._private_key_bytes( + encoding, + format, + encryption_algorithm, + self, + self._evp_pkey, + self._rsa_cdata, + ) + + def sign( + self, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> bytes: + self._enable_blinding() + data, algorithm = _calculate_digest_and_algorithm(data, algorithm) + return _rsa_sig_sign(self._backend, padding, algorithm, self, data) + + +class _RSAPublicKey(RSAPublicKey): + _evp_pkey: object + _rsa_cdata: object + _key_size: int + + def __init__(self, backend: Backend, rsa_cdata, evp_pkey): + self._backend = backend + self._rsa_cdata = rsa_cdata + self._evp_pkey = evp_pkey + + n = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key( + self._rsa_cdata, + n, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._key_size = self._backend._lib.BN_num_bits(n[0]) + + @property + def key_size(self) -> int: + return self._key_size + + def __eq__(self, other: object) -> bool: + if not isinstance(other, _RSAPublicKey): + return NotImplemented + + return ( + self._backend._lib.EVP_PKEY_cmp(self._evp_pkey, other._evp_pkey) + == 1 + ) + + def encrypt(self, plaintext: bytes, padding: AsymmetricPadding) -> bytes: + return _enc_dec_rsa(self._backend, self, plaintext, padding) + + def public_numbers(self) -> RSAPublicNumbers: + n = self._backend._ffi.new("BIGNUM **") + e = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key( + self._rsa_cdata, n, e, self._backend._ffi.NULL + ) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(e[0] != self._backend._ffi.NULL) + return RSAPublicNumbers( + e=self._backend._bn_to_int(e[0]), + n=self._backend._bn_to_int(n[0]), + ) + + def public_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PublicFormat, + ) -> bytes: + return self._backend._public_key_bytes( + encoding, format, self, self._evp_pkey, self._rsa_cdata + ) + + def verify( + self, + signature: bytes, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> None: + data, algorithm = _calculate_digest_and_algorithm(data, algorithm) + _rsa_sig_verify( + self._backend, padding, algorithm, self, signature, data + ) + + def recover_data_from_signature( + self, + signature: bytes, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + ) -> bytes: + if isinstance(algorithm, asym_utils.Prehashed): + raise TypeError( + "Prehashed is only supported in the sign and verify methods. " + "It cannot be used with recover_data_from_signature." + ) + return _rsa_sig_recover( + self._backend, padding, algorithm, self, signature + ) diff --git a/billinglayer/python/cryptography/hazmat/backends/openssl/utils.py b/billinglayer/python/cryptography/hazmat/backends/openssl/utils.py new file mode 100644 index 0000000..5b404de --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/backends/openssl/utils.py @@ -0,0 +1,63 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric.utils import Prehashed + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +def _evp_pkey_derive(backend: Backend, evp_pkey, peer_public_key) -> bytes: + ctx = backend._lib.EVP_PKEY_CTX_new(evp_pkey, backend._ffi.NULL) + backend.openssl_assert(ctx != backend._ffi.NULL) + ctx = backend._ffi.gc(ctx, backend._lib.EVP_PKEY_CTX_free) + res = backend._lib.EVP_PKEY_derive_init(ctx) + backend.openssl_assert(res == 1) + + if backend._lib.Cryptography_HAS_EVP_PKEY_SET_PEER_EX: + res = backend._lib.EVP_PKEY_derive_set_peer_ex( + ctx, peer_public_key._evp_pkey, 0 + ) + else: + res = backend._lib.EVP_PKEY_derive_set_peer( + ctx, peer_public_key._evp_pkey + ) + backend.openssl_assert(res == 1) + + keylen = backend._ffi.new("size_t *") + res = backend._lib.EVP_PKEY_derive(ctx, backend._ffi.NULL, keylen) + backend.openssl_assert(res == 1) + backend.openssl_assert(keylen[0] > 0) + buf = backend._ffi.new("unsigned char[]", keylen[0]) + res = backend._lib.EVP_PKEY_derive(ctx, buf, keylen) + if res != 1: + errors = backend._consume_errors() + raise ValueError("Error computing shared key.", errors) + + return backend._ffi.buffer(buf, keylen[0])[:] + + +def _calculate_digest_and_algorithm( + data: bytes, + algorithm: typing.Union[Prehashed, hashes.HashAlgorithm], +) -> typing.Tuple[bytes, hashes.HashAlgorithm]: + if not isinstance(algorithm, Prehashed): + hash_ctx = hashes.Hash(algorithm) + hash_ctx.update(data) + data = hash_ctx.finalize() + else: + algorithm = algorithm._algorithm + + if len(data) != algorithm.digest_size: + raise ValueError( + "The provided data must be the same length as the hash " + "algorithm's digest size." + ) + + return (data, algorithm) diff --git a/billinglayer/python/cryptography/hazmat/bindings/__init__.py b/billinglayer/python/cryptography/hazmat/bindings/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/billinglayer/python/cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..6d0ef6b Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust.abi3.so b/billinglayer/python/cryptography/hazmat/bindings/_rust.abi3.so new file mode 100755 index 0000000..b5f12d9 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/bindings/_rust.abi3.so differ diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/__init__.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/__init__.pyi new file mode 100644 index 0000000..94a37a2 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/__init__.pyi @@ -0,0 +1,34 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import types +import typing + +def check_pkcs7_padding(data: bytes) -> bool: ... +def check_ansix923_padding(data: bytes) -> bool: ... + +class ObjectIdentifier: + def __init__(self, val: str) -> None: ... + @property + def dotted_string(self) -> str: ... + @property + def _name(self) -> str: ... + +T = typing.TypeVar("T") + +class FixedPool(typing.Generic[T]): + def __init__( + self, + create: typing.Callable[[], T], + ) -> None: ... + def acquire(self) -> PoolAcquisition[T]: ... + +class PoolAcquisition(typing.Generic[T]): + def __enter__(self) -> T: ... + def __exit__( + self, + exc_type: typing.Optional[typing.Type[BaseException]], + exc_value: typing.Optional[BaseException], + exc_tb: typing.Optional[types.TracebackType], + ) -> None: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/_openssl.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/_openssl.pyi new file mode 100644 index 0000000..8010008 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/_openssl.pyi @@ -0,0 +1,8 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +lib = typing.Any +ffi = typing.Any diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/asn1.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/asn1.pyi new file mode 100644 index 0000000..a8369ba --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/asn1.pyi @@ -0,0 +1,16 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +class TestCertificate: + not_after_tag: int + not_before_tag: int + issuer_value_tags: typing.List[int] + subject_value_tags: typing.List[int] + +def decode_dss_signature(signature: bytes) -> typing.Tuple[int, int]: ... +def encode_dss_signature(r: int, s: int) -> bytes: ... +def parse_spki_for_data(data: bytes) -> bytes: ... +def test_parse_certificate(data: bytes) -> TestCertificate: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/exceptions.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/exceptions.pyi new file mode 100644 index 0000000..09f46b1 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/exceptions.pyi @@ -0,0 +1,17 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +class _Reasons: + BACKEND_MISSING_INTERFACE: _Reasons + UNSUPPORTED_HASH: _Reasons + UNSUPPORTED_CIPHER: _Reasons + UNSUPPORTED_PADDING: _Reasons + UNSUPPORTED_MGF: _Reasons + UNSUPPORTED_PUBLIC_KEY_ALGORITHM: _Reasons + UNSUPPORTED_ELLIPTIC_CURVE: _Reasons + UNSUPPORTED_SERIALIZATION: _Reasons + UNSUPPORTED_X509: _Reasons + UNSUPPORTED_EXCHANGE_ALGORITHM: _Reasons + UNSUPPORTED_DIFFIE_HELLMAN: _Reasons + UNSUPPORTED_MAC: _Reasons diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/ocsp.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/ocsp.pyi new file mode 100644 index 0000000..4671eb9 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/ocsp.pyi @@ -0,0 +1,25 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes +from cryptography.x509.ocsp import ( + OCSPRequest, + OCSPRequestBuilder, + OCSPResponse, + OCSPResponseBuilder, + OCSPResponseStatus, +) + +def load_der_ocsp_request(data: bytes) -> OCSPRequest: ... +def load_der_ocsp_response(data: bytes) -> OCSPResponse: ... +def create_ocsp_request(builder: OCSPRequestBuilder) -> OCSPRequest: ... +def create_ocsp_response( + status: OCSPResponseStatus, + builder: typing.Optional[OCSPResponseBuilder], + private_key: typing.Optional[PrivateKeyTypes], + hash_algorithm: typing.Optional[hashes.HashAlgorithm], +) -> OCSPResponse: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi new file mode 100644 index 0000000..82f30d2 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi @@ -0,0 +1,47 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.bindings._rust.openssl import ( + dh, + dsa, + ed448, + ed25519, + hashes, + hmac, + kdf, + poly1305, + x448, + x25519, +) + +__all__ = [ + "openssl_version", + "raise_openssl_error", + "dh", + "dsa", + "hashes", + "hmac", + "kdf", + "ed448", + "ed25519", + "poly1305", + "x448", + "x25519", +] + +def openssl_version() -> int: ... +def raise_openssl_error() -> typing.NoReturn: ... +def capture_error_stack() -> typing.List[OpenSSLError]: ... +def is_fips_enabled() -> bool: ... + +class OpenSSLError: + @property + def lib(self) -> int: ... + @property + def reason(self) -> int: ... + @property + def reason_text(self) -> bytes: ... + def _lib_reason_match(self, lib: int, reason: int) -> bool: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/dh.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/dh.pyi new file mode 100644 index 0000000..bfd005d --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/dh.pyi @@ -0,0 +1,22 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import dh + +MIN_MODULUS_SIZE: int + +class DHPrivateKey: ... +class DHPublicKey: ... +class DHParameters: ... + +def generate_parameters(generator: int, key_size: int) -> dh.DHParameters: ... +def private_key_from_ptr(ptr: int) -> dh.DHPrivateKey: ... +def public_key_from_ptr(ptr: int) -> dh.DHPublicKey: ... +def from_pem_parameters(data: bytes) -> dh.DHParameters: ... +def from_der_parameters(data: bytes) -> dh.DHParameters: ... +def from_private_numbers(numbers: dh.DHPrivateNumbers) -> dh.DHPrivateKey: ... +def from_public_numbers(numbers: dh.DHPublicNumbers) -> dh.DHPublicKey: ... +def from_parameter_numbers( + numbers: dh.DHParameterNumbers, +) -> dh.DHParameters: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi new file mode 100644 index 0000000..5a56f25 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi @@ -0,0 +1,20 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import dsa + +class DSAPrivateKey: ... +class DSAPublicKey: ... +class DSAParameters: ... + +def generate_parameters(key_size: int) -> dsa.DSAParameters: ... +def private_key_from_ptr(ptr: int) -> dsa.DSAPrivateKey: ... +def public_key_from_ptr(ptr: int) -> dsa.DSAPublicKey: ... +def from_private_numbers( + numbers: dsa.DSAPrivateNumbers, +) -> dsa.DSAPrivateKey: ... +def from_public_numbers(numbers: dsa.DSAPublicNumbers) -> dsa.DSAPublicKey: ... +def from_parameter_numbers( + numbers: dsa.DSAParameterNumbers, +) -> dsa.DSAParameters: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi new file mode 100644 index 0000000..c7f127f --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import ed25519 + +class Ed25519PrivateKey: ... +class Ed25519PublicKey: ... + +def generate_key() -> ed25519.Ed25519PrivateKey: ... +def private_key_from_ptr(ptr: int) -> ed25519.Ed25519PrivateKey: ... +def public_key_from_ptr(ptr: int) -> ed25519.Ed25519PublicKey: ... +def from_private_bytes(data: bytes) -> ed25519.Ed25519PrivateKey: ... +def from_public_bytes(data: bytes) -> ed25519.Ed25519PublicKey: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi new file mode 100644 index 0000000..1cf5f17 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import ed448 + +class Ed448PrivateKey: ... +class Ed448PublicKey: ... + +def generate_key() -> ed448.Ed448PrivateKey: ... +def private_key_from_ptr(ptr: int) -> ed448.Ed448PrivateKey: ... +def public_key_from_ptr(ptr: int) -> ed448.Ed448PublicKey: ... +def from_private_bytes(data: bytes) -> ed448.Ed448PrivateKey: ... +def from_public_bytes(data: bytes) -> ed448.Ed448PublicKey: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi new file mode 100644 index 0000000..ca5f42a --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi @@ -0,0 +1,17 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.primitives import hashes + +class Hash(hashes.HashContext): + def __init__( + self, algorithm: hashes.HashAlgorithm, backend: typing.Any = None + ) -> None: ... + @property + def algorithm(self) -> hashes.HashAlgorithm: ... + def update(self, data: bytes) -> None: ... + def finalize(self) -> bytes: ... + def copy(self) -> Hash: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi new file mode 100644 index 0000000..e38d9b5 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi @@ -0,0 +1,21 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.primitives import hashes + +class HMAC(hashes.HashContext): + def __init__( + self, + key: bytes, + algorithm: hashes.HashAlgorithm, + backend: typing.Any = None, + ) -> None: ... + @property + def algorithm(self) -> hashes.HashAlgorithm: ... + def update(self, data: bytes) -> None: ... + def finalize(self) -> bytes: ... + def verify(self, signature: bytes) -> None: ... + def copy(self) -> HMAC: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi new file mode 100644 index 0000000..034a8fe --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi @@ -0,0 +1,22 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.hashes import HashAlgorithm + +def derive_pbkdf2_hmac( + key_material: bytes, + algorithm: HashAlgorithm, + salt: bytes, + iterations: int, + length: int, +) -> bytes: ... +def derive_scrypt( + key_material: bytes, + salt: bytes, + n: int, + r: int, + p: int, + max_mem: int, + length: int, +) -> bytes: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi new file mode 100644 index 0000000..2e9b0a9 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +class Poly1305: + def __init__(self, key: bytes) -> None: ... + @staticmethod + def generate_tag(key: bytes, data: bytes) -> bytes: ... + @staticmethod + def verify_tag(key: bytes, data: bytes, tag: bytes) -> None: ... + def update(self, data: bytes) -> None: ... + def finalize(self) -> bytes: ... + def verify(self, tag: bytes) -> None: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi new file mode 100644 index 0000000..90f7cbd --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import x25519 + +class X25519PrivateKey: ... +class X25519PublicKey: ... + +def generate_key() -> x25519.X25519PrivateKey: ... +def private_key_from_ptr(ptr: int) -> x25519.X25519PrivateKey: ... +def public_key_from_ptr(ptr: int) -> x25519.X25519PublicKey: ... +def from_private_bytes(data: bytes) -> x25519.X25519PrivateKey: ... +def from_public_bytes(data: bytes) -> x25519.X25519PublicKey: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/x448.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/x448.pyi new file mode 100644 index 0000000..d326c8d --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/openssl/x448.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import x448 + +class X448PrivateKey: ... +class X448PublicKey: ... + +def generate_key() -> x448.X448PrivateKey: ... +def private_key_from_ptr(ptr: int) -> x448.X448PrivateKey: ... +def public_key_from_ptr(ptr: int) -> x448.X448PublicKey: ... +def from_private_bytes(data: bytes) -> x448.X448PrivateKey: ... +def from_public_bytes(data: bytes) -> x448.X448PublicKey: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/pkcs7.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/pkcs7.pyi new file mode 100644 index 0000000..66bd850 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/pkcs7.pyi @@ -0,0 +1,15 @@ +import typing + +from cryptography import x509 +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives.serialization import pkcs7 + +def serialize_certificates( + certs: typing.List[x509.Certificate], + encoding: serialization.Encoding, +) -> bytes: ... +def sign_and_serialize( + builder: pkcs7.PKCS7SignatureBuilder, + encoding: serialization.Encoding, + options: typing.Iterable[pkcs7.PKCS7Options], +) -> bytes: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/_rust/x509.pyi b/billinglayer/python/cryptography/hazmat/bindings/_rust/x509.pyi new file mode 100644 index 0000000..24b2f5e --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/_rust/x509.pyi @@ -0,0 +1,44 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography import x509 +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric.padding import PSS, PKCS1v15 +from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes + +def load_pem_x509_certificate(data: bytes) -> x509.Certificate: ... +def load_pem_x509_certificates( + data: bytes, +) -> typing.List[x509.Certificate]: ... +def load_der_x509_certificate(data: bytes) -> x509.Certificate: ... +def load_pem_x509_crl(data: bytes) -> x509.CertificateRevocationList: ... +def load_der_x509_crl(data: bytes) -> x509.CertificateRevocationList: ... +def load_pem_x509_csr(data: bytes) -> x509.CertificateSigningRequest: ... +def load_der_x509_csr(data: bytes) -> x509.CertificateSigningRequest: ... +def encode_name_bytes(name: x509.Name) -> bytes: ... +def encode_extension_value(extension: x509.ExtensionType) -> bytes: ... +def create_x509_certificate( + builder: x509.CertificateBuilder, + private_key: PrivateKeyTypes, + hash_algorithm: typing.Optional[hashes.HashAlgorithm], + padding: typing.Optional[typing.Union[PKCS1v15, PSS]], +) -> x509.Certificate: ... +def create_x509_csr( + builder: x509.CertificateSigningRequestBuilder, + private_key: PrivateKeyTypes, + hash_algorithm: typing.Optional[hashes.HashAlgorithm], +) -> x509.CertificateSigningRequest: ... +def create_x509_crl( + builder: x509.CertificateRevocationListBuilder, + private_key: PrivateKeyTypes, + hash_algorithm: typing.Optional[hashes.HashAlgorithm], +) -> x509.CertificateRevocationList: ... + +class Sct: ... +class Certificate: ... +class RevokedCertificate: ... +class CertificateRevocationList: ... +class CertificateSigningRequest: ... diff --git a/billinglayer/python/cryptography/hazmat/bindings/openssl/__init__.py b/billinglayer/python/cryptography/hazmat/bindings/openssl/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/openssl/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d985039 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc new file mode 100644 index 0000000..a0f7c39 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc new file mode 100644 index 0000000..0e26694 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/bindings/openssl/_conditional.py b/billinglayer/python/cryptography/hazmat/bindings/openssl/_conditional.py new file mode 100644 index 0000000..5e8ecd0 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/openssl/_conditional.py @@ -0,0 +1,329 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + + +def cryptography_has_set_cert_cb() -> typing.List[str]: + return [ + "SSL_CTX_set_cert_cb", + "SSL_set_cert_cb", + ] + + +def cryptography_has_ssl_st() -> typing.List[str]: + return [ + "SSL_ST_BEFORE", + "SSL_ST_OK", + "SSL_ST_INIT", + "SSL_ST_RENEGOTIATE", + ] + + +def cryptography_has_tls_st() -> typing.List[str]: + return [ + "TLS_ST_BEFORE", + "TLS_ST_OK", + ] + + +def cryptography_has_evp_pkey_dhx() -> typing.List[str]: + return [ + "EVP_PKEY_DHX", + ] + + +def cryptography_has_mem_functions() -> typing.List[str]: + return [ + "Cryptography_CRYPTO_set_mem_functions", + ] + + +def cryptography_has_x509_store_ctx_get_issuer() -> typing.List[str]: + return [ + "X509_STORE_set_get_issuer", + ] + + +def cryptography_has_ed448() -> typing.List[str]: + return [ + "EVP_PKEY_ED448", + "NID_ED448", + ] + + +def cryptography_has_ed25519() -> typing.List[str]: + return [ + "NID_ED25519", + "EVP_PKEY_ED25519", + ] + + +def cryptography_has_poly1305() -> typing.List[str]: + return [ + "NID_poly1305", + "EVP_PKEY_POLY1305", + ] + + +def cryptography_has_evp_digestfinal_xof() -> typing.List[str]: + return [ + "EVP_DigestFinalXOF", + ] + + +def cryptography_has_fips() -> typing.List[str]: + return [ + "FIPS_mode_set", + "FIPS_mode", + ] + + +def cryptography_has_ssl_sigalgs() -> typing.List[str]: + return [ + "SSL_CTX_set1_sigalgs_list", + ] + + +def cryptography_has_psk() -> typing.List[str]: + return [ + "SSL_CTX_use_psk_identity_hint", + "SSL_CTX_set_psk_server_callback", + "SSL_CTX_set_psk_client_callback", + ] + + +def cryptography_has_psk_tlsv13() -> typing.List[str]: + return [ + "SSL_CTX_set_psk_find_session_callback", + "SSL_CTX_set_psk_use_session_callback", + "Cryptography_SSL_SESSION_new", + "SSL_CIPHER_find", + "SSL_SESSION_set1_master_key", + "SSL_SESSION_set_cipher", + "SSL_SESSION_set_protocol_version", + ] + + +def cryptography_has_custom_ext() -> typing.List[str]: + return [ + "SSL_CTX_add_client_custom_ext", + "SSL_CTX_add_server_custom_ext", + "SSL_extension_supported", + ] + + +def cryptography_has_tlsv13_functions() -> typing.List[str]: + return [ + "SSL_VERIFY_POST_HANDSHAKE", + "SSL_CTX_set_ciphersuites", + "SSL_verify_client_post_handshake", + "SSL_CTX_set_post_handshake_auth", + "SSL_set_post_handshake_auth", + "SSL_SESSION_get_max_early_data", + "SSL_write_early_data", + "SSL_read_early_data", + "SSL_CTX_set_max_early_data", + ] + + +def cryptography_has_raw_key() -> typing.List[str]: + return [ + "EVP_PKEY_new_raw_private_key", + "EVP_PKEY_new_raw_public_key", + "EVP_PKEY_get_raw_private_key", + "EVP_PKEY_get_raw_public_key", + ] + + +def cryptography_has_engine() -> typing.List[str]: + return [ + "ENGINE_by_id", + "ENGINE_init", + "ENGINE_finish", + "ENGINE_get_default_RAND", + "ENGINE_set_default_RAND", + "ENGINE_unregister_RAND", + "ENGINE_ctrl_cmd", + "ENGINE_free", + "ENGINE_get_name", + "ENGINE_ctrl_cmd_string", + "ENGINE_load_builtin_engines", + "ENGINE_load_private_key", + "ENGINE_load_public_key", + "SSL_CTX_set_client_cert_engine", + ] + + +def cryptography_has_verified_chain() -> typing.List[str]: + return [ + "SSL_get0_verified_chain", + ] + + +def cryptography_has_srtp() -> typing.List[str]: + return [ + "SSL_CTX_set_tlsext_use_srtp", + "SSL_set_tlsext_use_srtp", + "SSL_get_selected_srtp_profile", + ] + + +def cryptography_has_providers() -> typing.List[str]: + return [ + "OSSL_PROVIDER_load", + "OSSL_PROVIDER_unload", + "ERR_LIB_PROV", + "PROV_R_WRONG_FINAL_BLOCK_LENGTH", + "PROV_R_BAD_DECRYPT", + ] + + +def cryptography_has_op_no_renegotiation() -> typing.List[str]: + return [ + "SSL_OP_NO_RENEGOTIATION", + ] + + +def cryptography_has_dtls_get_data_mtu() -> typing.List[str]: + return [ + "DTLS_get_data_mtu", + ] + + +def cryptography_has_300_fips() -> typing.List[str]: + return [ + "EVP_default_properties_is_fips_enabled", + "EVP_default_properties_enable_fips", + ] + + +def cryptography_has_ssl_cookie() -> typing.List[str]: + return [ + "SSL_OP_COOKIE_EXCHANGE", + "DTLSv1_listen", + "SSL_CTX_set_cookie_generate_cb", + "SSL_CTX_set_cookie_verify_cb", + ] + + +def cryptography_has_pkcs7_funcs() -> typing.List[str]: + return [ + "SMIME_write_PKCS7", + "PEM_write_bio_PKCS7_stream", + "PKCS7_sign_add_signer", + "PKCS7_final", + "PKCS7_verify", + "SMIME_read_PKCS7", + "PKCS7_get0_signers", + ] + + +def cryptography_has_bn_flags() -> typing.List[str]: + return [ + "BN_FLG_CONSTTIME", + "BN_set_flags", + "BN_prime_checks_for_size", + ] + + +def cryptography_has_evp_pkey_dh() -> typing.List[str]: + return [ + "EVP_PKEY_set1_DH", + ] + + +def cryptography_has_300_evp_cipher() -> typing.List[str]: + return ["EVP_CIPHER_fetch", "EVP_CIPHER_free"] + + +def cryptography_has_unexpected_eof_while_reading() -> typing.List[str]: + return ["SSL_R_UNEXPECTED_EOF_WHILE_READING"] + + +def cryptography_has_pkcs12_set_mac() -> typing.List[str]: + return ["PKCS12_set_mac"] + + +def cryptography_has_ssl_op_ignore_unexpected_eof() -> typing.List[str]: + return [ + "SSL_OP_IGNORE_UNEXPECTED_EOF", + ] + + +def cryptography_has_get_extms_support() -> typing.List[str]: + return ["SSL_get_extms_support"] + + +def cryptography_has_evp_pkey_set_peer_ex() -> typing.List[str]: + return ["EVP_PKEY_derive_set_peer_ex"] + + +def cryptography_has_evp_aead() -> typing.List[str]: + return [ + "EVP_aead_chacha20_poly1305", + "EVP_AEAD_CTX_free", + "EVP_AEAD_CTX_seal", + "EVP_AEAD_CTX_open", + "EVP_AEAD_max_overhead", + "Cryptography_EVP_AEAD_CTX_new", + ] + + +# This is a mapping of +# {condition: function-returning-names-dependent-on-that-condition} so we can +# loop over them and delete unsupported names at runtime. It will be removed +# when cffi supports #if in cdef. We use functions instead of just a dict of +# lists so we can use coverage to measure which are used. +CONDITIONAL_NAMES = { + "Cryptography_HAS_SET_CERT_CB": cryptography_has_set_cert_cb, + "Cryptography_HAS_SSL_ST": cryptography_has_ssl_st, + "Cryptography_HAS_TLS_ST": cryptography_has_tls_st, + "Cryptography_HAS_EVP_PKEY_DHX": cryptography_has_evp_pkey_dhx, + "Cryptography_HAS_MEM_FUNCTIONS": cryptography_has_mem_functions, + "Cryptography_HAS_X509_STORE_CTX_GET_ISSUER": ( + cryptography_has_x509_store_ctx_get_issuer + ), + "Cryptography_HAS_ED448": cryptography_has_ed448, + "Cryptography_HAS_ED25519": cryptography_has_ed25519, + "Cryptography_HAS_POLY1305": cryptography_has_poly1305, + "Cryptography_HAS_FIPS": cryptography_has_fips, + "Cryptography_HAS_SIGALGS": cryptography_has_ssl_sigalgs, + "Cryptography_HAS_PSK": cryptography_has_psk, + "Cryptography_HAS_PSK_TLSv1_3": cryptography_has_psk_tlsv13, + "Cryptography_HAS_CUSTOM_EXT": cryptography_has_custom_ext, + "Cryptography_HAS_TLSv1_3_FUNCTIONS": cryptography_has_tlsv13_functions, + "Cryptography_HAS_RAW_KEY": cryptography_has_raw_key, + "Cryptography_HAS_EVP_DIGESTFINAL_XOF": ( + cryptography_has_evp_digestfinal_xof + ), + "Cryptography_HAS_ENGINE": cryptography_has_engine, + "Cryptography_HAS_VERIFIED_CHAIN": cryptography_has_verified_chain, + "Cryptography_HAS_SRTP": cryptography_has_srtp, + "Cryptography_HAS_PROVIDERS": cryptography_has_providers, + "Cryptography_HAS_OP_NO_RENEGOTIATION": ( + cryptography_has_op_no_renegotiation + ), + "Cryptography_HAS_DTLS_GET_DATA_MTU": cryptography_has_dtls_get_data_mtu, + "Cryptography_HAS_300_FIPS": cryptography_has_300_fips, + "Cryptography_HAS_SSL_COOKIE": cryptography_has_ssl_cookie, + "Cryptography_HAS_PKCS7_FUNCS": cryptography_has_pkcs7_funcs, + "Cryptography_HAS_BN_FLAGS": cryptography_has_bn_flags, + "Cryptography_HAS_EVP_PKEY_DH": cryptography_has_evp_pkey_dh, + "Cryptography_HAS_300_EVP_CIPHER": cryptography_has_300_evp_cipher, + "Cryptography_HAS_UNEXPECTED_EOF_WHILE_READING": ( + cryptography_has_unexpected_eof_while_reading + ), + "Cryptography_HAS_PKCS12_SET_MAC": cryptography_has_pkcs12_set_mac, + "Cryptography_HAS_SSL_OP_IGNORE_UNEXPECTED_EOF": ( + cryptography_has_ssl_op_ignore_unexpected_eof + ), + "Cryptography_HAS_GET_EXTMS_SUPPORT": cryptography_has_get_extms_support, + "Cryptography_HAS_EVP_PKEY_SET_PEER_EX": ( + cryptography_has_evp_pkey_set_peer_ex + ), + "Cryptography_HAS_EVP_AEAD": (cryptography_has_evp_aead), +} diff --git a/billinglayer/python/cryptography/hazmat/bindings/openssl/binding.py b/billinglayer/python/cryptography/hazmat/bindings/openssl/binding.py new file mode 100644 index 0000000..b50d631 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/bindings/openssl/binding.py @@ -0,0 +1,179 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import os +import sys +import threading +import types +import typing +import warnings + +import cryptography +from cryptography.exceptions import InternalError +from cryptography.hazmat.bindings._rust import _openssl, openssl +from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES + + +def _openssl_assert( + lib, + ok: bool, + errors: typing.Optional[typing.List[openssl.OpenSSLError]] = None, +) -> None: + if not ok: + if errors is None: + errors = openssl.capture_error_stack() + + raise InternalError( + "Unknown OpenSSL error. This error is commonly encountered when " + "another library is not cleaning up the OpenSSL error stack. If " + "you are using cryptography with another library that uses " + "OpenSSL try disabling it before reporting a bug. Otherwise " + "please file an issue at https://github.com/pyca/cryptography/" + "issues with information on how to reproduce " + "this. ({!r})".format(errors), + errors, + ) + + +def _legacy_provider_error(loaded: bool) -> None: + if not loaded: + raise RuntimeError( + "OpenSSL 3.0's legacy provider failed to load. This is a fatal " + "error by default, but cryptography supports running without " + "legacy algorithms by setting the environment variable " + "CRYPTOGRAPHY_OPENSSL_NO_LEGACY. If you did not expect this error," + " you have likely made a mistake with your OpenSSL configuration." + ) + + +def build_conditional_library( + lib: typing.Any, + conditional_names: typing.Dict[str, typing.Callable[[], typing.List[str]]], +) -> typing.Any: + conditional_lib = types.ModuleType("lib") + conditional_lib._original_lib = lib # type: ignore[attr-defined] + excluded_names = set() + for condition, names_cb in conditional_names.items(): + if not getattr(lib, condition): + excluded_names.update(names_cb()) + + for attr in dir(lib): + if attr not in excluded_names: + setattr(conditional_lib, attr, getattr(lib, attr)) + + return conditional_lib + + +class Binding: + """ + OpenSSL API wrapper. + """ + + lib: typing.ClassVar = None + ffi = _openssl.ffi + _lib_loaded = False + _init_lock = threading.Lock() + _legacy_provider: typing.Any = ffi.NULL + _legacy_provider_loaded = False + _default_provider: typing.Any = ffi.NULL + + def __init__(self) -> None: + self._ensure_ffi_initialized() + + def _enable_fips(self) -> None: + # This function enables FIPS mode for OpenSSL 3.0.0 on installs that + # have the FIPS provider installed properly. + _openssl_assert(self.lib, self.lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER) + self._base_provider = self.lib.OSSL_PROVIDER_load( + self.ffi.NULL, b"base" + ) + _openssl_assert(self.lib, self._base_provider != self.ffi.NULL) + self.lib._fips_provider = self.lib.OSSL_PROVIDER_load( + self.ffi.NULL, b"fips" + ) + _openssl_assert(self.lib, self.lib._fips_provider != self.ffi.NULL) + + res = self.lib.EVP_default_properties_enable_fips(self.ffi.NULL, 1) + _openssl_assert(self.lib, res == 1) + + @classmethod + def _ensure_ffi_initialized(cls) -> None: + with cls._init_lock: + if not cls._lib_loaded: + cls.lib = build_conditional_library( + _openssl.lib, CONDITIONAL_NAMES + ) + cls._lib_loaded = True + # As of OpenSSL 3.0.0 we must register a legacy cipher provider + # to get RC2 (needed for junk asymmetric private key + # serialization), RC4, Blowfish, IDEA, SEED, etc. These things + # are ugly legacy, but we aren't going to get rid of them + # any time soon. + if cls.lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER: + if not os.environ.get("CRYPTOGRAPHY_OPENSSL_NO_LEGACY"): + cls._legacy_provider = cls.lib.OSSL_PROVIDER_load( + cls.ffi.NULL, b"legacy" + ) + cls._legacy_provider_loaded = ( + cls._legacy_provider != cls.ffi.NULL + ) + _legacy_provider_error(cls._legacy_provider_loaded) + + cls._default_provider = cls.lib.OSSL_PROVIDER_load( + cls.ffi.NULL, b"default" + ) + _openssl_assert( + cls.lib, cls._default_provider != cls.ffi.NULL + ) + + @classmethod + def init_static_locks(cls) -> None: + cls._ensure_ffi_initialized() + + +def _verify_package_version(version: str) -> None: + # Occasionally we run into situations where the version of the Python + # package does not match the version of the shared object that is loaded. + # This may occur in environments where multiple versions of cryptography + # are installed and available in the python path. To avoid errors cropping + # up later this code checks that the currently imported package and the + # shared object that were loaded have the same version and raise an + # ImportError if they do not + so_package_version = _openssl.ffi.string( + _openssl.lib.CRYPTOGRAPHY_PACKAGE_VERSION + ) + if version.encode("ascii") != so_package_version: + raise ImportError( + "The version of cryptography does not match the loaded " + "shared object. This can happen if you have multiple copies of " + "cryptography installed in your Python path. Please try creating " + "a new virtual environment to resolve this issue. " + "Loaded python version: {}, shared object version: {}".format( + version, so_package_version + ) + ) + + _openssl_assert( + _openssl.lib, + _openssl.lib.OpenSSL_version_num() == openssl.openssl_version(), + ) + + +_verify_package_version(cryptography.__version__) + +Binding.init_static_locks() + +if ( + sys.platform == "win32" + and os.environ.get("PROCESSOR_ARCHITEW6432") is not None +): + warnings.warn( + "You are using cryptography on a 32-bit Python on a 64-bit Windows " + "Operating System. Cryptography will be significantly faster if you " + "switch to using a 64-bit Python.", + UserWarning, + stacklevel=2, + ) diff --git a/billinglayer/python/cryptography/hazmat/primitives/__init__.py b/billinglayer/python/cryptography/hazmat/primitives/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1a59cde Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc new file mode 100644 index 0000000..aac4fad Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc new file mode 100644 index 0000000..e061f96 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc new file mode 100644 index 0000000..010c1ef Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc new file mode 100644 index 0000000..bb43fd6 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc new file mode 100644 index 0000000..32c2408 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc new file mode 100644 index 0000000..eb71d3c Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc new file mode 100644 index 0000000..674ee64 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc new file mode 100644 index 0000000..5d67e36 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc new file mode 100644 index 0000000..e85b7e8 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc new file mode 100644 index 0000000..a0927fc Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/_asymmetric.py b/billinglayer/python/cryptography/hazmat/primitives/_asymmetric.py new file mode 100644 index 0000000..ea55ffd --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/_asymmetric.py @@ -0,0 +1,19 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +# This exists to break an import cycle. It is normally accessible from the +# asymmetric padding module. + + +class AsymmetricPadding(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this padding (e.g. "PSS", "PKCS1"). + """ diff --git a/billinglayer/python/cryptography/hazmat/primitives/_cipheralgorithm.py b/billinglayer/python/cryptography/hazmat/primitives/_cipheralgorithm.py new file mode 100644 index 0000000..3b880b6 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/_cipheralgorithm.py @@ -0,0 +1,45 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +# This exists to break an import cycle. It is normally accessible from the +# ciphers module. + + +class CipherAlgorithm(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this mode (e.g. "AES", "Camellia"). + """ + + @property + @abc.abstractmethod + def key_sizes(self) -> typing.FrozenSet[int]: + """ + Valid key sizes for this algorithm in bits + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The size of the key being used as an integer in bits (e.g. 128, 256). + """ + + +class BlockCipherAlgorithm(CipherAlgorithm): + key: bytes + + @property + @abc.abstractmethod + def block_size(self) -> int: + """ + The size of a block as an integer in bits (e.g. 64, 128). + """ diff --git a/billinglayer/python/cryptography/hazmat/primitives/_serialization.py b/billinglayer/python/cryptography/hazmat/primitives/_serialization.py new file mode 100644 index 0000000..34f3fbc --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/_serialization.py @@ -0,0 +1,170 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.hazmat.primitives.hashes import HashAlgorithm + +# This exists to break an import cycle. These classes are normally accessible +# from the serialization module. + + +class PBES(utils.Enum): + PBESv1SHA1And3KeyTripleDESCBC = "PBESv1 using SHA1 and 3-Key TripleDES" + PBESv2SHA256AndAES256CBC = "PBESv2 using SHA256 PBKDF2 and AES256 CBC" + + +class Encoding(utils.Enum): + PEM = "PEM" + DER = "DER" + OpenSSH = "OpenSSH" + Raw = "Raw" + X962 = "ANSI X9.62" + SMIME = "S/MIME" + + +class PrivateFormat(utils.Enum): + PKCS8 = "PKCS8" + TraditionalOpenSSL = "TraditionalOpenSSL" + Raw = "Raw" + OpenSSH = "OpenSSH" + PKCS12 = "PKCS12" + + def encryption_builder(self) -> KeySerializationEncryptionBuilder: + if self not in (PrivateFormat.OpenSSH, PrivateFormat.PKCS12): + raise ValueError( + "encryption_builder only supported with PrivateFormat.OpenSSH" + " and PrivateFormat.PKCS12" + ) + return KeySerializationEncryptionBuilder(self) + + +class PublicFormat(utils.Enum): + SubjectPublicKeyInfo = "X.509 subjectPublicKeyInfo with PKCS#1" + PKCS1 = "Raw PKCS#1" + OpenSSH = "OpenSSH" + Raw = "Raw" + CompressedPoint = "X9.62 Compressed Point" + UncompressedPoint = "X9.62 Uncompressed Point" + + +class ParameterFormat(utils.Enum): + PKCS3 = "PKCS3" + + +class KeySerializationEncryption(metaclass=abc.ABCMeta): + pass + + +class BestAvailableEncryption(KeySerializationEncryption): + def __init__(self, password: bytes): + if not isinstance(password, bytes) or len(password) == 0: + raise ValueError("Password must be 1 or more bytes.") + + self.password = password + + +class NoEncryption(KeySerializationEncryption): + pass + + +class KeySerializationEncryptionBuilder: + def __init__( + self, + format: PrivateFormat, + *, + _kdf_rounds: typing.Optional[int] = None, + _hmac_hash: typing.Optional[HashAlgorithm] = None, + _key_cert_algorithm: typing.Optional[PBES] = None, + ) -> None: + self._format = format + + self._kdf_rounds = _kdf_rounds + self._hmac_hash = _hmac_hash + self._key_cert_algorithm = _key_cert_algorithm + + def kdf_rounds(self, rounds: int) -> KeySerializationEncryptionBuilder: + if self._kdf_rounds is not None: + raise ValueError("kdf_rounds already set") + + if not isinstance(rounds, int): + raise TypeError("kdf_rounds must be an integer") + + if rounds < 1: + raise ValueError("kdf_rounds must be a positive integer") + + return KeySerializationEncryptionBuilder( + self._format, + _kdf_rounds=rounds, + _hmac_hash=self._hmac_hash, + _key_cert_algorithm=self._key_cert_algorithm, + ) + + def hmac_hash( + self, algorithm: HashAlgorithm + ) -> KeySerializationEncryptionBuilder: + if self._format is not PrivateFormat.PKCS12: + raise TypeError( + "hmac_hash only supported with PrivateFormat.PKCS12" + ) + + if self._hmac_hash is not None: + raise ValueError("hmac_hash already set") + return KeySerializationEncryptionBuilder( + self._format, + _kdf_rounds=self._kdf_rounds, + _hmac_hash=algorithm, + _key_cert_algorithm=self._key_cert_algorithm, + ) + + def key_cert_algorithm( + self, algorithm: PBES + ) -> KeySerializationEncryptionBuilder: + if self._format is not PrivateFormat.PKCS12: + raise TypeError( + "key_cert_algorithm only supported with " + "PrivateFormat.PKCS12" + ) + if self._key_cert_algorithm is not None: + raise ValueError("key_cert_algorithm already set") + return KeySerializationEncryptionBuilder( + self._format, + _kdf_rounds=self._kdf_rounds, + _hmac_hash=self._hmac_hash, + _key_cert_algorithm=algorithm, + ) + + def build(self, password: bytes) -> KeySerializationEncryption: + if not isinstance(password, bytes) or len(password) == 0: + raise ValueError("Password must be 1 or more bytes.") + + return _KeySerializationEncryption( + self._format, + password, + kdf_rounds=self._kdf_rounds, + hmac_hash=self._hmac_hash, + key_cert_algorithm=self._key_cert_algorithm, + ) + + +class _KeySerializationEncryption(KeySerializationEncryption): + def __init__( + self, + format: PrivateFormat, + password: bytes, + *, + kdf_rounds: typing.Optional[int], + hmac_hash: typing.Optional[HashAlgorithm], + key_cert_algorithm: typing.Optional[PBES], + ): + self._format = format + self.password = password + + self._kdf_rounds = kdf_rounds + self._hmac_hash = hmac_hash + self._key_cert_algorithm = key_cert_algorithm diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__init__.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..ede5f72 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc new file mode 100644 index 0000000..e08ec6b Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc new file mode 100644 index 0000000..ee12879 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc new file mode 100644 index 0000000..d27ca2e Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc new file mode 100644 index 0000000..e669f30 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc new file mode 100644 index 0000000..ec4d488 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc new file mode 100644 index 0000000..0a57226 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc new file mode 100644 index 0000000..90e4359 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc new file mode 100644 index 0000000..a9a09f0 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..ef1acfb Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc new file mode 100644 index 0000000..197f16e Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc new file mode 100644 index 0000000..d01d6c0 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/dh.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/dh.py new file mode 100644 index 0000000..751bcc4 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/dh.py @@ -0,0 +1,261 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +def generate_parameters( + generator: int, key_size: int, backend: typing.Any = None +) -> DHParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_dh_parameters(generator, key_size) + + +class DHParameterNumbers: + def __init__(self, p: int, g: int, q: typing.Optional[int] = None) -> None: + if not isinstance(p, int) or not isinstance(g, int): + raise TypeError("p and g must be integers") + if q is not None and not isinstance(q, int): + raise TypeError("q must be integer or None") + + if g < 2: + raise ValueError("DH generator must be 2 or greater") + + if p.bit_length() < rust_openssl.dh.MIN_MODULUS_SIZE: + raise ValueError( + f"p (modulus) must be at least " + f"{rust_openssl.dh.MIN_MODULUS_SIZE}-bit" + ) + + self._p = p + self._g = g + self._q = q + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DHParameterNumbers): + return NotImplemented + + return ( + self._p == other._p and self._g == other._g and self._q == other._q + ) + + def parameters(self, backend: typing.Any = None) -> DHParameters: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dh_parameter_numbers(self) + + @property + def p(self) -> int: + return self._p + + @property + def g(self) -> int: + return self._g + + @property + def q(self) -> typing.Optional[int]: + return self._q + + +class DHPublicNumbers: + def __init__(self, y: int, parameter_numbers: DHParameterNumbers) -> None: + if not isinstance(y, int): + raise TypeError("y must be an integer.") + + if not isinstance(parameter_numbers, DHParameterNumbers): + raise TypeError( + "parameters must be an instance of DHParameterNumbers." + ) + + self._y = y + self._parameter_numbers = parameter_numbers + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DHPublicNumbers): + return NotImplemented + + return ( + self._y == other._y + and self._parameter_numbers == other._parameter_numbers + ) + + def public_key(self, backend: typing.Any = None) -> DHPublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dh_public_numbers(self) + + @property + def y(self) -> int: + return self._y + + @property + def parameter_numbers(self) -> DHParameterNumbers: + return self._parameter_numbers + + +class DHPrivateNumbers: + def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None: + if not isinstance(x, int): + raise TypeError("x must be an integer.") + + if not isinstance(public_numbers, DHPublicNumbers): + raise TypeError( + "public_numbers must be an instance of " "DHPublicNumbers." + ) + + self._x = x + self._public_numbers = public_numbers + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DHPrivateNumbers): + return NotImplemented + + return ( + self._x == other._x + and self._public_numbers == other._public_numbers + ) + + def private_key(self, backend: typing.Any = None) -> DHPrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dh_private_numbers(self) + + @property + def public_numbers(self) -> DHPublicNumbers: + return self._public_numbers + + @property + def x(self) -> int: + return self._x + + +class DHParameters(metaclass=abc.ABCMeta): + @abc.abstractmethod + def generate_private_key(self) -> DHPrivateKey: + """ + Generates and returns a DHPrivateKey. + """ + + @abc.abstractmethod + def parameter_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.ParameterFormat, + ) -> bytes: + """ + Returns the parameters serialized as bytes. + """ + + @abc.abstractmethod + def parameter_numbers(self) -> DHParameterNumbers: + """ + Returns a DHParameterNumbers. + """ + + +DHParametersWithSerialization = DHParameters +DHParameters.register(rust_openssl.dh.DHParameters) + + +class DHPublicKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def parameters(self) -> DHParameters: + """ + The DHParameters object associated with this public key. + """ + + @abc.abstractmethod + def public_numbers(self) -> DHPublicNumbers: + """ + Returns a DHPublicNumbers. + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +DHPublicKeyWithSerialization = DHPublicKey +DHPublicKey.register(rust_openssl.dh.DHPublicKey) + + +class DHPrivateKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def public_key(self) -> DHPublicKey: + """ + The DHPublicKey associated with this private key. + """ + + @abc.abstractmethod + def parameters(self) -> DHParameters: + """ + The DHParameters object associated with this private key. + """ + + @abc.abstractmethod + def exchange(self, peer_public_key: DHPublicKey) -> bytes: + """ + Given peer's DHPublicKey, carry out the key exchange and + return shared key as bytes. + """ + + @abc.abstractmethod + def private_numbers(self) -> DHPrivateNumbers: + """ + Returns a DHPrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +DHPrivateKeyWithSerialization = DHPrivateKey +DHPrivateKey.register(rust_openssl.dh.DHPrivateKey) diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/dsa.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/dsa.py new file mode 100644 index 0000000..a8c52de --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/dsa.py @@ -0,0 +1,299 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization, hashes +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils + + +class DSAParameters(metaclass=abc.ABCMeta): + @abc.abstractmethod + def generate_private_key(self) -> DSAPrivateKey: + """ + Generates and returns a DSAPrivateKey. + """ + + @abc.abstractmethod + def parameter_numbers(self) -> DSAParameterNumbers: + """ + Returns a DSAParameterNumbers. + """ + + +DSAParametersWithNumbers = DSAParameters +DSAParameters.register(rust_openssl.dsa.DSAParameters) + + +class DSAPrivateKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def public_key(self) -> DSAPublicKey: + """ + The DSAPublicKey associated with this private key. + """ + + @abc.abstractmethod + def parameters(self) -> DSAParameters: + """ + The DSAParameters object associated with this private key. + """ + + @abc.abstractmethod + def sign( + self, + data: bytes, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> bytes: + """ + Signs the data + """ + + @abc.abstractmethod + def private_numbers(self) -> DSAPrivateNumbers: + """ + Returns a DSAPrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +DSAPrivateKeyWithSerialization = DSAPrivateKey +DSAPrivateKey.register(rust_openssl.dsa.DSAPrivateKey) + + +class DSAPublicKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def parameters(self) -> DSAParameters: + """ + The DSAParameters object associated with this public key. + """ + + @abc.abstractmethod + def public_numbers(self) -> DSAPublicNumbers: + """ + Returns a DSAPublicNumbers. + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def verify( + self, + signature: bytes, + data: bytes, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> None: + """ + Verifies the signature of the data. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +DSAPublicKeyWithSerialization = DSAPublicKey +DSAPublicKey.register(rust_openssl.dsa.DSAPublicKey) + + +class DSAParameterNumbers: + def __init__(self, p: int, q: int, g: int): + if ( + not isinstance(p, int) + or not isinstance(q, int) + or not isinstance(g, int) + ): + raise TypeError( + "DSAParameterNumbers p, q, and g arguments must be integers." + ) + + self._p = p + self._q = q + self._g = g + + @property + def p(self) -> int: + return self._p + + @property + def q(self) -> int: + return self._q + + @property + def g(self) -> int: + return self._g + + def parameters(self, backend: typing.Any = None) -> DSAParameters: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dsa_parameter_numbers(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DSAParameterNumbers): + return NotImplemented + + return self.p == other.p and self.q == other.q and self.g == other.g + + def __repr__(self) -> str: + return ( + "".format(self=self) + ) + + +class DSAPublicNumbers: + def __init__(self, y: int, parameter_numbers: DSAParameterNumbers): + if not isinstance(y, int): + raise TypeError("DSAPublicNumbers y argument must be an integer.") + + if not isinstance(parameter_numbers, DSAParameterNumbers): + raise TypeError( + "parameter_numbers must be a DSAParameterNumbers instance." + ) + + self._y = y + self._parameter_numbers = parameter_numbers + + @property + def y(self) -> int: + return self._y + + @property + def parameter_numbers(self) -> DSAParameterNumbers: + return self._parameter_numbers + + def public_key(self, backend: typing.Any = None) -> DSAPublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dsa_public_numbers(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DSAPublicNumbers): + return NotImplemented + + return ( + self.y == other.y + and self.parameter_numbers == other.parameter_numbers + ) + + def __repr__(self) -> str: + return ( + "".format(self=self) + ) + + +class DSAPrivateNumbers: + def __init__(self, x: int, public_numbers: DSAPublicNumbers): + if not isinstance(x, int): + raise TypeError("DSAPrivateNumbers x argument must be an integer.") + + if not isinstance(public_numbers, DSAPublicNumbers): + raise TypeError( + "public_numbers must be a DSAPublicNumbers instance." + ) + self._public_numbers = public_numbers + self._x = x + + @property + def x(self) -> int: + return self._x + + @property + def public_numbers(self) -> DSAPublicNumbers: + return self._public_numbers + + def private_key(self, backend: typing.Any = None) -> DSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dsa_private_numbers(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DSAPrivateNumbers): + return NotImplemented + + return ( + self.x == other.x and self.public_numbers == other.public_numbers + ) + + +def generate_parameters( + key_size: int, backend: typing.Any = None +) -> DSAParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_dsa_parameters(key_size) + + +def generate_private_key( + key_size: int, backend: typing.Any = None +) -> DSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_dsa_private_key_and_parameters(key_size) + + +def _check_dsa_parameters(parameters: DSAParameterNumbers) -> None: + if parameters.p.bit_length() not in [1024, 2048, 3072, 4096]: + raise ValueError( + "p must be exactly 1024, 2048, 3072, or 4096 bits long" + ) + if parameters.q.bit_length() not in [160, 224, 256]: + raise ValueError("q must be exactly 160, 224, or 256 bits long") + + if not (1 < parameters.g < parameters.p): + raise ValueError("g, p don't satisfy 1 < g < p.") + + +def _check_dsa_private_numbers(numbers: DSAPrivateNumbers) -> None: + parameters = numbers.public_numbers.parameter_numbers + _check_dsa_parameters(parameters) + if numbers.x <= 0 or numbers.x >= parameters.q: + raise ValueError("x must be > 0 and < q.") + + if numbers.public_numbers.y != pow(parameters.g, numbers.x, parameters.p): + raise ValueError("y must be equal to (g ** x % p).") diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ec.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ec.py new file mode 100644 index 0000000..ddfaabf --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ec.py @@ -0,0 +1,490 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.hazmat._oid import ObjectIdentifier +from cryptography.hazmat.primitives import _serialization, hashes +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils + + +class EllipticCurveOID: + SECP192R1 = ObjectIdentifier("1.2.840.10045.3.1.1") + SECP224R1 = ObjectIdentifier("1.3.132.0.33") + SECP256K1 = ObjectIdentifier("1.3.132.0.10") + SECP256R1 = ObjectIdentifier("1.2.840.10045.3.1.7") + SECP384R1 = ObjectIdentifier("1.3.132.0.34") + SECP521R1 = ObjectIdentifier("1.3.132.0.35") + BRAINPOOLP256R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.7") + BRAINPOOLP384R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.11") + BRAINPOOLP512R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.13") + SECT163K1 = ObjectIdentifier("1.3.132.0.1") + SECT163R2 = ObjectIdentifier("1.3.132.0.15") + SECT233K1 = ObjectIdentifier("1.3.132.0.26") + SECT233R1 = ObjectIdentifier("1.3.132.0.27") + SECT283K1 = ObjectIdentifier("1.3.132.0.16") + SECT283R1 = ObjectIdentifier("1.3.132.0.17") + SECT409K1 = ObjectIdentifier("1.3.132.0.36") + SECT409R1 = ObjectIdentifier("1.3.132.0.37") + SECT571K1 = ObjectIdentifier("1.3.132.0.38") + SECT571R1 = ObjectIdentifier("1.3.132.0.39") + + +class EllipticCurve(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + The name of the curve. e.g. secp256r1. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + Bit size of a secret scalar for the curve. + """ + + +class EllipticCurveSignatureAlgorithm(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def algorithm( + self, + ) -> typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm]: + """ + The digest algorithm used with this signature. + """ + + +class EllipticCurvePrivateKey(metaclass=abc.ABCMeta): + @abc.abstractmethod + def exchange( + self, algorithm: ECDH, peer_public_key: EllipticCurvePublicKey + ) -> bytes: + """ + Performs a key exchange operation using the provided algorithm with the + provided peer's public key. + """ + + @abc.abstractmethod + def public_key(self) -> EllipticCurvePublicKey: + """ + The EllipticCurvePublicKey for this private key. + """ + + @property + @abc.abstractmethod + def curve(self) -> EllipticCurve: + """ + The EllipticCurve that this key is on. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + Bit size of a secret scalar for the curve. + """ + + @abc.abstractmethod + def sign( + self, + data: bytes, + signature_algorithm: EllipticCurveSignatureAlgorithm, + ) -> bytes: + """ + Signs the data + """ + + @abc.abstractmethod + def private_numbers(self) -> EllipticCurvePrivateNumbers: + """ + Returns an EllipticCurvePrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +EllipticCurvePrivateKeyWithSerialization = EllipticCurvePrivateKey + + +class EllipticCurvePublicKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def curve(self) -> EllipticCurve: + """ + The EllipticCurve that this key is on. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + Bit size of a secret scalar for the curve. + """ + + @abc.abstractmethod + def public_numbers(self) -> EllipticCurvePublicNumbers: + """ + Returns an EllipticCurvePublicNumbers. + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def verify( + self, + signature: bytes, + data: bytes, + signature_algorithm: EllipticCurveSignatureAlgorithm, + ) -> None: + """ + Verifies the signature of the data. + """ + + @classmethod + def from_encoded_point( + cls, curve: EllipticCurve, data: bytes + ) -> EllipticCurvePublicKey: + utils._check_bytes("data", data) + + if not isinstance(curve, EllipticCurve): + raise TypeError("curve must be an EllipticCurve instance") + + if len(data) == 0: + raise ValueError("data must not be an empty byte string") + + if data[0] not in [0x02, 0x03, 0x04]: + raise ValueError("Unsupported elliptic curve point type") + + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.load_elliptic_curve_public_bytes(curve, data) + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +EllipticCurvePublicKeyWithSerialization = EllipticCurvePublicKey + + +class SECT571R1(EllipticCurve): + name = "sect571r1" + key_size = 570 + + +class SECT409R1(EllipticCurve): + name = "sect409r1" + key_size = 409 + + +class SECT283R1(EllipticCurve): + name = "sect283r1" + key_size = 283 + + +class SECT233R1(EllipticCurve): + name = "sect233r1" + key_size = 233 + + +class SECT163R2(EllipticCurve): + name = "sect163r2" + key_size = 163 + + +class SECT571K1(EllipticCurve): + name = "sect571k1" + key_size = 571 + + +class SECT409K1(EllipticCurve): + name = "sect409k1" + key_size = 409 + + +class SECT283K1(EllipticCurve): + name = "sect283k1" + key_size = 283 + + +class SECT233K1(EllipticCurve): + name = "sect233k1" + key_size = 233 + + +class SECT163K1(EllipticCurve): + name = "sect163k1" + key_size = 163 + + +class SECP521R1(EllipticCurve): + name = "secp521r1" + key_size = 521 + + +class SECP384R1(EllipticCurve): + name = "secp384r1" + key_size = 384 + + +class SECP256R1(EllipticCurve): + name = "secp256r1" + key_size = 256 + + +class SECP256K1(EllipticCurve): + name = "secp256k1" + key_size = 256 + + +class SECP224R1(EllipticCurve): + name = "secp224r1" + key_size = 224 + + +class SECP192R1(EllipticCurve): + name = "secp192r1" + key_size = 192 + + +class BrainpoolP256R1(EllipticCurve): + name = "brainpoolP256r1" + key_size = 256 + + +class BrainpoolP384R1(EllipticCurve): + name = "brainpoolP384r1" + key_size = 384 + + +class BrainpoolP512R1(EllipticCurve): + name = "brainpoolP512r1" + key_size = 512 + + +_CURVE_TYPES: typing.Dict[str, typing.Type[EllipticCurve]] = { + "prime192v1": SECP192R1, + "prime256v1": SECP256R1, + "secp192r1": SECP192R1, + "secp224r1": SECP224R1, + "secp256r1": SECP256R1, + "secp384r1": SECP384R1, + "secp521r1": SECP521R1, + "secp256k1": SECP256K1, + "sect163k1": SECT163K1, + "sect233k1": SECT233K1, + "sect283k1": SECT283K1, + "sect409k1": SECT409K1, + "sect571k1": SECT571K1, + "sect163r2": SECT163R2, + "sect233r1": SECT233R1, + "sect283r1": SECT283R1, + "sect409r1": SECT409R1, + "sect571r1": SECT571R1, + "brainpoolP256r1": BrainpoolP256R1, + "brainpoolP384r1": BrainpoolP384R1, + "brainpoolP512r1": BrainpoolP512R1, +} + + +class ECDSA(EllipticCurveSignatureAlgorithm): + def __init__( + self, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ): + self._algorithm = algorithm + + @property + def algorithm( + self, + ) -> typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm]: + return self._algorithm + + +def generate_private_key( + curve: EllipticCurve, backend: typing.Any = None +) -> EllipticCurvePrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_elliptic_curve_private_key(curve) + + +def derive_private_key( + private_value: int, + curve: EllipticCurve, + backend: typing.Any = None, +) -> EllipticCurvePrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + if not isinstance(private_value, int): + raise TypeError("private_value must be an integer type.") + + if private_value <= 0: + raise ValueError("private_value must be a positive integer.") + + if not isinstance(curve, EllipticCurve): + raise TypeError("curve must provide the EllipticCurve interface.") + + return ossl.derive_elliptic_curve_private_key(private_value, curve) + + +class EllipticCurvePublicNumbers: + def __init__(self, x: int, y: int, curve: EllipticCurve): + if not isinstance(x, int) or not isinstance(y, int): + raise TypeError("x and y must be integers.") + + if not isinstance(curve, EllipticCurve): + raise TypeError("curve must provide the EllipticCurve interface.") + + self._y = y + self._x = x + self._curve = curve + + def public_key(self, backend: typing.Any = None) -> EllipticCurvePublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_elliptic_curve_public_numbers(self) + + @property + def curve(self) -> EllipticCurve: + return self._curve + + @property + def x(self) -> int: + return self._x + + @property + def y(self) -> int: + return self._y + + def __eq__(self, other: object) -> bool: + if not isinstance(other, EllipticCurvePublicNumbers): + return NotImplemented + + return ( + self.x == other.x + and self.y == other.y + and self.curve.name == other.curve.name + and self.curve.key_size == other.curve.key_size + ) + + def __hash__(self) -> int: + return hash((self.x, self.y, self.curve.name, self.curve.key_size)) + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + +class EllipticCurvePrivateNumbers: + def __init__( + self, private_value: int, public_numbers: EllipticCurvePublicNumbers + ): + if not isinstance(private_value, int): + raise TypeError("private_value must be an integer.") + + if not isinstance(public_numbers, EllipticCurvePublicNumbers): + raise TypeError( + "public_numbers must be an EllipticCurvePublicNumbers " + "instance." + ) + + self._private_value = private_value + self._public_numbers = public_numbers + + def private_key( + self, backend: typing.Any = None + ) -> EllipticCurvePrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_elliptic_curve_private_numbers(self) + + @property + def private_value(self) -> int: + return self._private_value + + @property + def public_numbers(self) -> EllipticCurvePublicNumbers: + return self._public_numbers + + def __eq__(self, other: object) -> bool: + if not isinstance(other, EllipticCurvePrivateNumbers): + return NotImplemented + + return ( + self.private_value == other.private_value + and self.public_numbers == other.public_numbers + ) + + def __hash__(self) -> int: + return hash((self.private_value, self.public_numbers)) + + +class ECDH: + pass + + +_OID_TO_CURVE = { + EllipticCurveOID.SECP192R1: SECP192R1, + EllipticCurveOID.SECP224R1: SECP224R1, + EllipticCurveOID.SECP256K1: SECP256K1, + EllipticCurveOID.SECP256R1: SECP256R1, + EllipticCurveOID.SECP384R1: SECP384R1, + EllipticCurveOID.SECP521R1: SECP521R1, + EllipticCurveOID.BRAINPOOLP256R1: BrainpoolP256R1, + EllipticCurveOID.BRAINPOOLP384R1: BrainpoolP384R1, + EllipticCurveOID.BRAINPOOLP512R1: BrainpoolP512R1, + EllipticCurveOID.SECT163K1: SECT163K1, + EllipticCurveOID.SECT163R2: SECT163R2, + EllipticCurveOID.SECT233K1: SECT233K1, + EllipticCurveOID.SECT233R1: SECT233R1, + EllipticCurveOID.SECT283K1: SECT283K1, + EllipticCurveOID.SECT283R1: SECT283R1, + EllipticCurveOID.SECT409K1: SECT409K1, + EllipticCurveOID.SECT409R1: SECT409R1, + EllipticCurveOID.SECT571K1: SECT571K1, + EllipticCurveOID.SECT571R1: SECT571R1, +} + + +def get_curve_for_oid(oid: ObjectIdentifier) -> typing.Type[EllipticCurve]: + try: + return _OID_TO_CURVE[oid] + except KeyError: + raise LookupError( + "The provided object identifier has no matching elliptic " + "curve class" + ) diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ed25519.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ed25519.py new file mode 100644 index 0000000..f26e54d --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ed25519.py @@ -0,0 +1,118 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class Ed25519PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> Ed25519PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed25519_supported(): + raise UnsupportedAlgorithm( + "ed25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed25519_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def verify(self, signature: bytes, data: bytes) -> None: + """ + Verify the signature. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +if hasattr(rust_openssl, "ed25519"): + Ed25519PublicKey.register(rust_openssl.ed25519.Ed25519PublicKey) + + +class Ed25519PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> Ed25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed25519_supported(): + raise UnsupportedAlgorithm( + "ed25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed25519_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> Ed25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed25519_supported(): + raise UnsupportedAlgorithm( + "ed25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed25519_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> Ed25519PublicKey: + """ + The Ed25519PublicKey derived from the private key. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + @abc.abstractmethod + def sign(self, data: bytes) -> bytes: + """ + Signs the data. + """ + + +if hasattr(rust_openssl, "x25519"): + Ed25519PrivateKey.register(rust_openssl.ed25519.Ed25519PrivateKey) diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ed448.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ed448.py new file mode 100644 index 0000000..a9a34b2 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/ed448.py @@ -0,0 +1,117 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class Ed448PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> Ed448PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed448_supported(): + raise UnsupportedAlgorithm( + "ed448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed448_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def verify(self, signature: bytes, data: bytes) -> None: + """ + Verify the signature. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +if hasattr(rust_openssl, "ed448"): + Ed448PublicKey.register(rust_openssl.ed448.Ed448PublicKey) + + +class Ed448PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> Ed448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed448_supported(): + raise UnsupportedAlgorithm( + "ed448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + return backend.ed448_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> Ed448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed448_supported(): + raise UnsupportedAlgorithm( + "ed448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed448_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> Ed448PublicKey: + """ + The Ed448PublicKey derived from the private key. + """ + + @abc.abstractmethod + def sign(self, data: bytes) -> bytes: + """ + Signs the data. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + +if hasattr(rust_openssl, "x448"): + Ed448PrivateKey.register(rust_openssl.ed448.Ed448PrivateKey) diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/padding.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/padding.py new file mode 100644 index 0000000..7198808 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/padding.py @@ -0,0 +1,102 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives._asymmetric import ( + AsymmetricPadding as AsymmetricPadding, +) +from cryptography.hazmat.primitives.asymmetric import rsa + + +class PKCS1v15(AsymmetricPadding): + name = "EMSA-PKCS1-v1_5" + + +class _MaxLength: + "Sentinel value for `MAX_LENGTH`." + + +class _Auto: + "Sentinel value for `AUTO`." + + +class _DigestLength: + "Sentinel value for `DIGEST_LENGTH`." + + +class PSS(AsymmetricPadding): + MAX_LENGTH = _MaxLength() + AUTO = _Auto() + DIGEST_LENGTH = _DigestLength() + name = "EMSA-PSS" + _salt_length: typing.Union[int, _MaxLength, _Auto, _DigestLength] + + def __init__( + self, + mgf: MGF, + salt_length: typing.Union[int, _MaxLength, _Auto, _DigestLength], + ) -> None: + self._mgf = mgf + + if not isinstance( + salt_length, (int, _MaxLength, _Auto, _DigestLength) + ): + raise TypeError( + "salt_length must be an integer, MAX_LENGTH, " + "DIGEST_LENGTH, or AUTO" + ) + + if isinstance(salt_length, int) and salt_length < 0: + raise ValueError("salt_length must be zero or greater.") + + self._salt_length = salt_length + + +class OAEP(AsymmetricPadding): + name = "EME-OAEP" + + def __init__( + self, + mgf: MGF, + algorithm: hashes.HashAlgorithm, + label: typing.Optional[bytes], + ): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of hashes.HashAlgorithm.") + + self._mgf = mgf + self._algorithm = algorithm + self._label = label + + +class MGF(metaclass=abc.ABCMeta): + _algorithm: hashes.HashAlgorithm + + +class MGF1(MGF): + MAX_LENGTH = _MaxLength() + + def __init__(self, algorithm: hashes.HashAlgorithm): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of hashes.HashAlgorithm.") + + self._algorithm = algorithm + + +def calculate_max_pss_salt_length( + key: typing.Union[rsa.RSAPrivateKey, rsa.RSAPublicKey], + hash_algorithm: hashes.HashAlgorithm, +) -> int: + if not isinstance(key, (rsa.RSAPrivateKey, rsa.RSAPublicKey)): + raise TypeError("key must be an RSA public or private key") + # bit length - 1 per RFC 3447 + emlen = (key.key_size + 6) // 8 + salt_length = emlen - hash_algorithm.digest_size - 2 + assert salt_length >= 0 + return salt_length diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/rsa.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/rsa.py new file mode 100644 index 0000000..b740f01 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/rsa.py @@ -0,0 +1,439 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing +from math import gcd + +from cryptography.hazmat.primitives import _serialization, hashes +from cryptography.hazmat.primitives._asymmetric import AsymmetricPadding +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils + + +class RSAPrivateKey(metaclass=abc.ABCMeta): + @abc.abstractmethod + def decrypt(self, ciphertext: bytes, padding: AsymmetricPadding) -> bytes: + """ + Decrypts the provided ciphertext. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the public modulus. + """ + + @abc.abstractmethod + def public_key(self) -> RSAPublicKey: + """ + The RSAPublicKey associated with this private key. + """ + + @abc.abstractmethod + def sign( + self, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> bytes: + """ + Signs the data. + """ + + @abc.abstractmethod + def private_numbers(self) -> RSAPrivateNumbers: + """ + Returns an RSAPrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +RSAPrivateKeyWithSerialization = RSAPrivateKey + + +class RSAPublicKey(metaclass=abc.ABCMeta): + @abc.abstractmethod + def encrypt(self, plaintext: bytes, padding: AsymmetricPadding) -> bytes: + """ + Encrypts the given plaintext. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the public modulus. + """ + + @abc.abstractmethod + def public_numbers(self) -> RSAPublicNumbers: + """ + Returns an RSAPublicNumbers + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def verify( + self, + signature: bytes, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> None: + """ + Verifies the signature of the data. + """ + + @abc.abstractmethod + def recover_data_from_signature( + self, + signature: bytes, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + ) -> bytes: + """ + Recovers the original data from the signature. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +RSAPublicKeyWithSerialization = RSAPublicKey + + +def generate_private_key( + public_exponent: int, + key_size: int, + backend: typing.Any = None, +) -> RSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + _verify_rsa_parameters(public_exponent, key_size) + return ossl.generate_rsa_private_key(public_exponent, key_size) + + +def _verify_rsa_parameters(public_exponent: int, key_size: int) -> None: + if public_exponent not in (3, 65537): + raise ValueError( + "public_exponent must be either 3 (for legacy compatibility) or " + "65537. Almost everyone should choose 65537 here!" + ) + + if key_size < 512: + raise ValueError("key_size must be at least 512-bits.") + + +def _check_private_key_components( + p: int, + q: int, + private_exponent: int, + dmp1: int, + dmq1: int, + iqmp: int, + public_exponent: int, + modulus: int, +) -> None: + if modulus < 3: + raise ValueError("modulus must be >= 3.") + + if p >= modulus: + raise ValueError("p must be < modulus.") + + if q >= modulus: + raise ValueError("q must be < modulus.") + + if dmp1 >= modulus: + raise ValueError("dmp1 must be < modulus.") + + if dmq1 >= modulus: + raise ValueError("dmq1 must be < modulus.") + + if iqmp >= modulus: + raise ValueError("iqmp must be < modulus.") + + if private_exponent >= modulus: + raise ValueError("private_exponent must be < modulus.") + + if public_exponent < 3 or public_exponent >= modulus: + raise ValueError("public_exponent must be >= 3 and < modulus.") + + if public_exponent & 1 == 0: + raise ValueError("public_exponent must be odd.") + + if dmp1 & 1 == 0: + raise ValueError("dmp1 must be odd.") + + if dmq1 & 1 == 0: + raise ValueError("dmq1 must be odd.") + + if p * q != modulus: + raise ValueError("p*q must equal modulus.") + + +def _check_public_key_components(e: int, n: int) -> None: + if n < 3: + raise ValueError("n must be >= 3.") + + if e < 3 or e >= n: + raise ValueError("e must be >= 3 and < n.") + + if e & 1 == 0: + raise ValueError("e must be odd.") + + +def _modinv(e: int, m: int) -> int: + """ + Modular Multiplicative Inverse. Returns x such that: (x*e) mod m == 1 + """ + x1, x2 = 1, 0 + a, b = e, m + while b > 0: + q, r = divmod(a, b) + xn = x1 - q * x2 + a, b, x1, x2 = b, r, x2, xn + return x1 % m + + +def rsa_crt_iqmp(p: int, q: int) -> int: + """ + Compute the CRT (q ** -1) % p value from RSA primes p and q. + """ + return _modinv(q, p) + + +def rsa_crt_dmp1(private_exponent: int, p: int) -> int: + """ + Compute the CRT private_exponent % (p - 1) value from the RSA + private_exponent (d) and p. + """ + return private_exponent % (p - 1) + + +def rsa_crt_dmq1(private_exponent: int, q: int) -> int: + """ + Compute the CRT private_exponent % (q - 1) value from the RSA + private_exponent (d) and q. + """ + return private_exponent % (q - 1) + + +# Controls the number of iterations rsa_recover_prime_factors will perform +# to obtain the prime factors. Each iteration increments by 2 so the actual +# maximum attempts is half this number. +_MAX_RECOVERY_ATTEMPTS = 1000 + + +def rsa_recover_prime_factors( + n: int, e: int, d: int +) -> typing.Tuple[int, int]: + """ + Compute factors p and q from the private exponent d. We assume that n has + no more than two factors. This function is adapted from code in PyCrypto. + """ + # See 8.2.2(i) in Handbook of Applied Cryptography. + ktot = d * e - 1 + # The quantity d*e-1 is a multiple of phi(n), even, + # and can be represented as t*2^s. + t = ktot + while t % 2 == 0: + t = t // 2 + # Cycle through all multiplicative inverses in Zn. + # The algorithm is non-deterministic, but there is a 50% chance + # any candidate a leads to successful factoring. + # See "Digitalized Signatures and Public Key Functions as Intractable + # as Factorization", M. Rabin, 1979 + spotted = False + a = 2 + while not spotted and a < _MAX_RECOVERY_ATTEMPTS: + k = t + # Cycle through all values a^{t*2^i}=a^k + while k < ktot: + cand = pow(a, k, n) + # Check if a^k is a non-trivial root of unity (mod n) + if cand != 1 and cand != (n - 1) and pow(cand, 2, n) == 1: + # We have found a number such that (cand-1)(cand+1)=0 (mod n). + # Either of the terms divides n. + p = gcd(cand + 1, n) + spotted = True + break + k *= 2 + # This value was not any good... let's try another! + a += 2 + if not spotted: + raise ValueError("Unable to compute factors p and q from exponent d.") + # Found ! + q, r = divmod(n, p) + assert r == 0 + p, q = sorted((p, q), reverse=True) + return (p, q) + + +class RSAPrivateNumbers: + def __init__( + self, + p: int, + q: int, + d: int, + dmp1: int, + dmq1: int, + iqmp: int, + public_numbers: RSAPublicNumbers, + ): + if ( + not isinstance(p, int) + or not isinstance(q, int) + or not isinstance(d, int) + or not isinstance(dmp1, int) + or not isinstance(dmq1, int) + or not isinstance(iqmp, int) + ): + raise TypeError( + "RSAPrivateNumbers p, q, d, dmp1, dmq1, iqmp arguments must" + " all be an integers." + ) + + if not isinstance(public_numbers, RSAPublicNumbers): + raise TypeError( + "RSAPrivateNumbers public_numbers must be an RSAPublicNumbers" + " instance." + ) + + self._p = p + self._q = q + self._d = d + self._dmp1 = dmp1 + self._dmq1 = dmq1 + self._iqmp = iqmp + self._public_numbers = public_numbers + + @property + def p(self) -> int: + return self._p + + @property + def q(self) -> int: + return self._q + + @property + def d(self) -> int: + return self._d + + @property + def dmp1(self) -> int: + return self._dmp1 + + @property + def dmq1(self) -> int: + return self._dmq1 + + @property + def iqmp(self) -> int: + return self._iqmp + + @property + def public_numbers(self) -> RSAPublicNumbers: + return self._public_numbers + + def private_key( + self, + backend: typing.Any = None, + *, + unsafe_skip_rsa_key_validation: bool = False, + ) -> RSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_rsa_private_numbers( + self, unsafe_skip_rsa_key_validation + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RSAPrivateNumbers): + return NotImplemented + + return ( + self.p == other.p + and self.q == other.q + and self.d == other.d + and self.dmp1 == other.dmp1 + and self.dmq1 == other.dmq1 + and self.iqmp == other.iqmp + and self.public_numbers == other.public_numbers + ) + + def __hash__(self) -> int: + return hash( + ( + self.p, + self.q, + self.d, + self.dmp1, + self.dmq1, + self.iqmp, + self.public_numbers, + ) + ) + + +class RSAPublicNumbers: + def __init__(self, e: int, n: int): + if not isinstance(e, int) or not isinstance(n, int): + raise TypeError("RSAPublicNumbers arguments must be integers.") + + self._e = e + self._n = n + + @property + def e(self) -> int: + return self._e + + @property + def n(self) -> int: + return self._n + + def public_key(self, backend: typing.Any = None) -> RSAPublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_rsa_public_numbers(self) + + def __repr__(self) -> str: + return "".format(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RSAPublicNumbers): + return NotImplemented + + return self.e == other.e and self.n == other.n + + def __hash__(self) -> int: + return hash((self.e, self.n)) diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/types.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/types.py new file mode 100644 index 0000000..1fe4eaf --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/types.py @@ -0,0 +1,111 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.hazmat.primitives.asymmetric import ( + dh, + dsa, + ec, + ed448, + ed25519, + rsa, + x448, + x25519, +) + +# Every asymmetric key type +PublicKeyTypes = typing.Union[ + dh.DHPublicKey, + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, + x25519.X25519PublicKey, + x448.X448PublicKey, +] +PUBLIC_KEY_TYPES = PublicKeyTypes +utils.deprecated( + PUBLIC_KEY_TYPES, + __name__, + "Use PublicKeyTypes instead", + utils.DeprecatedIn40, + name="PUBLIC_KEY_TYPES", +) +# Every asymmetric key type +PrivateKeyTypes = typing.Union[ + dh.DHPrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + x25519.X25519PrivateKey, + x448.X448PrivateKey, +] +PRIVATE_KEY_TYPES = PrivateKeyTypes +utils.deprecated( + PRIVATE_KEY_TYPES, + __name__, + "Use PrivateKeyTypes instead", + utils.DeprecatedIn40, + name="PRIVATE_KEY_TYPES", +) +# Just the key types we allow to be used for x509 signing. This mirrors +# the certificate public key types +CertificateIssuerPrivateKeyTypes = typing.Union[ + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, +] +CERTIFICATE_PRIVATE_KEY_TYPES = CertificateIssuerPrivateKeyTypes +utils.deprecated( + CERTIFICATE_PRIVATE_KEY_TYPES, + __name__, + "Use CertificateIssuerPrivateKeyTypes instead", + utils.DeprecatedIn40, + name="CERTIFICATE_PRIVATE_KEY_TYPES", +) +# Just the key types we allow to be used for x509 signing. This mirrors +# the certificate private key types +CertificateIssuerPublicKeyTypes = typing.Union[ + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, +] +CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES = CertificateIssuerPublicKeyTypes +utils.deprecated( + CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES, + __name__, + "Use CertificateIssuerPublicKeyTypes instead", + utils.DeprecatedIn40, + name="CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES", +) +# This type removes DHPublicKey. x448/x25519 can be a public key +# but cannot be used in signing so they are allowed here. +CertificatePublicKeyTypes = typing.Union[ + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, + x25519.X25519PublicKey, + x448.X448PublicKey, +] +CERTIFICATE_PUBLIC_KEY_TYPES = CertificatePublicKeyTypes +utils.deprecated( + CERTIFICATE_PUBLIC_KEY_TYPES, + __name__, + "Use CertificatePublicKeyTypes instead", + utils.DeprecatedIn40, + name="CERTIFICATE_PUBLIC_KEY_TYPES", +) diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/utils.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/utils.py new file mode 100644 index 0000000..826b956 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/utils.py @@ -0,0 +1,24 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.bindings._rust import asn1 +from cryptography.hazmat.primitives import hashes + +decode_dss_signature = asn1.decode_dss_signature +encode_dss_signature = asn1.encode_dss_signature + + +class Prehashed: + def __init__(self, algorithm: hashes.HashAlgorithm): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of HashAlgorithm.") + + self._algorithm = algorithm + self._digest_size = algorithm.digest_size + + @property + def digest_size(self) -> int: + return self._digest_size diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/x25519.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/x25519.py new file mode 100644 index 0000000..699054c --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/x25519.py @@ -0,0 +1,113 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class X25519PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> X25519PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x25519_supported(): + raise UnsupportedAlgorithm( + "X25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x25519_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +# For LibreSSL +if hasattr(rust_openssl, "x25519"): + X25519PublicKey.register(rust_openssl.x25519.X25519PublicKey) + + +class X25519PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> X25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x25519_supported(): + raise UnsupportedAlgorithm( + "X25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + return backend.x25519_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> X25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x25519_supported(): + raise UnsupportedAlgorithm( + "X25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x25519_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> X25519PublicKey: + """ + Returns the public key assosciated with this private key + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + @abc.abstractmethod + def exchange(self, peer_public_key: X25519PublicKey) -> bytes: + """ + Performs a key exchange operation using the provided peer's public key. + """ + + +# For LibreSSL +if hasattr(rust_openssl, "x25519"): + X25519PrivateKey.register(rust_openssl.x25519.X25519PrivateKey) diff --git a/billinglayer/python/cryptography/hazmat/primitives/asymmetric/x448.py b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/x448.py new file mode 100644 index 0000000..abf7848 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/asymmetric/x448.py @@ -0,0 +1,111 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class X448PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> X448PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x448_supported(): + raise UnsupportedAlgorithm( + "X448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x448_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +if hasattr(rust_openssl, "x448"): + X448PublicKey.register(rust_openssl.x448.X448PublicKey) + + +class X448PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> X448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x448_supported(): + raise UnsupportedAlgorithm( + "X448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + return backend.x448_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> X448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x448_supported(): + raise UnsupportedAlgorithm( + "X448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x448_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> X448PublicKey: + """ + Returns the public key associated with this private key + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + @abc.abstractmethod + def exchange(self, peer_public_key: X448PublicKey) -> bytes: + """ + Performs a key exchange operation using the provided peer's public key. + """ + + +if hasattr(rust_openssl, "x448"): + X448PrivateKey.register(rust_openssl.x448.X448PrivateKey) diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/__init__.py b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__init__.py new file mode 100644 index 0000000..cc88fbf --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__init__.py @@ -0,0 +1,27 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.primitives._cipheralgorithm import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) +from cryptography.hazmat.primitives.ciphers.base import ( + AEADCipherContext, + AEADDecryptionContext, + AEADEncryptionContext, + Cipher, + CipherContext, +) + +__all__ = [ + "Cipher", + "CipherAlgorithm", + "BlockCipherAlgorithm", + "CipherContext", + "AEADCipherContext", + "AEADDecryptionContext", + "AEADEncryptionContext", +] diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b958ad0 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc new file mode 100644 index 0000000..c0a7b5b Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc new file mode 100644 index 0000000..511cf81 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..8910d4a Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc new file mode 100644 index 0000000..a2e7eae Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/aead.py b/billinglayer/python/cryptography/hazmat/primitives/ciphers/aead.py new file mode 100644 index 0000000..957b2d2 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/ciphers/aead.py @@ -0,0 +1,378 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import os +import typing + +from cryptography import exceptions, utils +from cryptography.hazmat.backends.openssl import aead +from cryptography.hazmat.backends.openssl.backend import backend +from cryptography.hazmat.bindings._rust import FixedPool + + +class ChaCha20Poly1305: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "ChaCha20Poly1305 is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + utils._check_byteslike("key", key) + + if len(key) != 32: + raise ValueError("ChaCha20Poly1305 key must be 32 bytes.") + + self._key = key + self._pool = FixedPool(self._create_fn) + + @classmethod + def generate_key(cls) -> bytes: + return os.urandom(32) + + def _create_fn(self): + return aead._aead_create_ctx(backend, self, self._key) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + with self._pool.acquire() as ctx: + return aead._encrypt( + backend, self, nonce, data, [associated_data], 16, ctx + ) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + with self._pool.acquire() as ctx: + return aead._decrypt( + backend, self, nonce, data, [associated_data], 16, ctx + ) + + def _check_params( + self, + nonce: bytes, + data: bytes, + associated_data: bytes, + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if len(nonce) != 12: + raise ValueError("Nonce must be 12 bytes") + + +class AESCCM: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes, tag_length: int = 16): + utils._check_byteslike("key", key) + if len(key) not in (16, 24, 32): + raise ValueError("AESCCM key must be 128, 192, or 256 bits.") + + self._key = key + if not isinstance(tag_length, int): + raise TypeError("tag_length must be an integer") + + if tag_length not in (4, 6, 8, 10, 12, 14, 16): + raise ValueError("Invalid tag_length") + + self._tag_length = tag_length + + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "AESCCM is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (128, 192, 256): + raise ValueError("bit_length must be 128, 192, or 256") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + self._validate_lengths(nonce, len(data)) + return aead._encrypt( + backend, self, nonce, data, [associated_data], self._tag_length + ) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + return aead._decrypt( + backend, self, nonce, data, [associated_data], self._tag_length + ) + + def _validate_lengths(self, nonce: bytes, data_len: int) -> None: + # For information about computing this, see + # https://tools.ietf.org/html/rfc3610#section-2.1 + l_val = 15 - len(nonce) + if 2 ** (8 * l_val) < data_len: + raise ValueError("Data too long for nonce") + + def _check_params( + self, nonce: bytes, data: bytes, associated_data: bytes + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if not 7 <= len(nonce) <= 13: + raise ValueError("Nonce must be between 7 and 13 bytes") + + +class AESGCM: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + utils._check_byteslike("key", key) + if len(key) not in (16, 24, 32): + raise ValueError("AESGCM key must be 128, 192, or 256 bits.") + + self._key = key + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (128, 192, 256): + raise ValueError("bit_length must be 128, 192, or 256") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + return aead._encrypt(backend, self, nonce, data, [associated_data], 16) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + return aead._decrypt(backend, self, nonce, data, [associated_data], 16) + + def _check_params( + self, + nonce: bytes, + data: bytes, + associated_data: bytes, + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if len(nonce) < 8 or len(nonce) > 128: + raise ValueError("Nonce must be between 8 and 128 bytes") + + +class AESOCB3: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + utils._check_byteslike("key", key) + if len(key) not in (16, 24, 32): + raise ValueError("AESOCB3 key must be 128, 192, or 256 bits.") + + self._key = key + + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "OCB3 is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (128, 192, 256): + raise ValueError("bit_length must be 128, 192, or 256") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + return aead._encrypt(backend, self, nonce, data, [associated_data], 16) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + return aead._decrypt(backend, self, nonce, data, [associated_data], 16) + + def _check_params( + self, + nonce: bytes, + data: bytes, + associated_data: bytes, + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if len(nonce) < 12 or len(nonce) > 15: + raise ValueError("Nonce must be between 12 and 15 bytes") + + +class AESSIV: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + utils._check_byteslike("key", key) + if len(key) not in (32, 48, 64): + raise ValueError("AESSIV key must be 256, 384, or 512 bits.") + + self._key = key + + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "AES-SIV is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (256, 384, 512): + raise ValueError("bit_length must be 256, 384, or 512") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + data: bytes, + associated_data: typing.Optional[typing.List[bytes]], + ) -> bytes: + if associated_data is None: + associated_data = [] + + self._check_params(data, associated_data) + + if len(data) > self._MAX_SIZE or any( + len(ad) > self._MAX_SIZE for ad in associated_data + ): + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + return aead._encrypt(backend, self, b"", data, associated_data, 16) + + def decrypt( + self, + data: bytes, + associated_data: typing.Optional[typing.List[bytes]], + ) -> bytes: + if associated_data is None: + associated_data = [] + + self._check_params(data, associated_data) + + return aead._decrypt(backend, self, b"", data, associated_data, 16) + + def _check_params( + self, + data: bytes, + associated_data: typing.List[bytes], + ) -> None: + utils._check_byteslike("data", data) + if len(data) == 0: + raise ValueError("data must not be zero length") + + if not isinstance(associated_data, list): + raise TypeError( + "associated_data must be a list of bytes-like objects or None" + ) + for x in associated_data: + utils._check_byteslike("associated_data elements", x) diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/algorithms.py b/billinglayer/python/cryptography/hazmat/primitives/ciphers/algorithms.py new file mode 100644 index 0000000..4bfc5d8 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/ciphers/algorithms.py @@ -0,0 +1,228 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography import utils +from cryptography.hazmat.primitives.ciphers import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) + + +def _verify_key_size(algorithm: CipherAlgorithm, key: bytes) -> bytes: + # Verify that the key is instance of bytes + utils._check_byteslike("key", key) + + # Verify that the key size matches the expected key size + if len(key) * 8 not in algorithm.key_sizes: + raise ValueError( + "Invalid key size ({}) for {}.".format( + len(key) * 8, algorithm.name + ) + ) + return key + + +class AES(BlockCipherAlgorithm): + name = "AES" + block_size = 128 + # 512 added to support AES-256-XTS, which uses 512-bit keys + key_sizes = frozenset([128, 192, 256, 512]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class AES128(BlockCipherAlgorithm): + name = "AES" + block_size = 128 + key_sizes = frozenset([128]) + key_size = 128 + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + +class AES256(BlockCipherAlgorithm): + name = "AES" + block_size = 128 + key_sizes = frozenset([256]) + key_size = 256 + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + +class Camellia(BlockCipherAlgorithm): + name = "camellia" + block_size = 128 + key_sizes = frozenset([128, 192, 256]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class TripleDES(BlockCipherAlgorithm): + name = "3DES" + block_size = 64 + key_sizes = frozenset([64, 128, 192]) + + def __init__(self, key: bytes): + if len(key) == 8: + key += key + key + elif len(key) == 16: + key += key[:8] + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class Blowfish(BlockCipherAlgorithm): + name = "Blowfish" + block_size = 64 + key_sizes = frozenset(range(32, 449, 8)) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_BlowfishInternal = Blowfish +utils.deprecated( + Blowfish, + __name__, + "Blowfish has been deprecated", + utils.DeprecatedIn37, + name="Blowfish", +) + + +class CAST5(BlockCipherAlgorithm): + name = "CAST5" + block_size = 64 + key_sizes = frozenset(range(40, 129, 8)) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_CAST5Internal = CAST5 +utils.deprecated( + CAST5, + __name__, + "CAST5 has been deprecated", + utils.DeprecatedIn37, + name="CAST5", +) + + +class ARC4(CipherAlgorithm): + name = "RC4" + key_sizes = frozenset([40, 56, 64, 80, 128, 160, 192, 256]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class IDEA(BlockCipherAlgorithm): + name = "IDEA" + block_size = 64 + key_sizes = frozenset([128]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_IDEAInternal = IDEA +utils.deprecated( + IDEA, + __name__, + "IDEA has been deprecated", + utils.DeprecatedIn37, + name="IDEA", +) + + +class SEED(BlockCipherAlgorithm): + name = "SEED" + block_size = 128 + key_sizes = frozenset([128]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_SEEDInternal = SEED +utils.deprecated( + SEED, + __name__, + "SEED has been deprecated", + utils.DeprecatedIn37, + name="SEED", +) + + +class ChaCha20(CipherAlgorithm): + name = "ChaCha20" + key_sizes = frozenset([256]) + + def __init__(self, key: bytes, nonce: bytes): + self.key = _verify_key_size(self, key) + utils._check_byteslike("nonce", nonce) + + if len(nonce) != 16: + raise ValueError("nonce must be 128-bits (16 bytes)") + + self._nonce = nonce + + @property + def nonce(self) -> bytes: + return self._nonce + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class SM4(BlockCipherAlgorithm): + name = "SM4" + block_size = 128 + key_sizes = frozenset([128]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/base.py b/billinglayer/python/cryptography/hazmat/primitives/ciphers/base.py new file mode 100644 index 0000000..38a2ebb --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/ciphers/base.py @@ -0,0 +1,269 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.exceptions import ( + AlreadyFinalized, + AlreadyUpdated, + NotYetFinalized, +) +from cryptography.hazmat.primitives._cipheralgorithm import CipherAlgorithm +from cryptography.hazmat.primitives.ciphers import modes + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.ciphers import ( + _CipherContext as _BackendCipherContext, + ) + + +class CipherContext(metaclass=abc.ABCMeta): + @abc.abstractmethod + def update(self, data: bytes) -> bytes: + """ + Processes the provided bytes through the cipher and returns the results + as bytes. + """ + + @abc.abstractmethod + def update_into(self, data: bytes, buf: bytes) -> int: + """ + Processes the provided bytes and writes the resulting data into the + provided buffer. Returns the number of bytes written. + """ + + @abc.abstractmethod + def finalize(self) -> bytes: + """ + Returns the results of processing the final block as bytes. + """ + + +class AEADCipherContext(CipherContext, metaclass=abc.ABCMeta): + @abc.abstractmethod + def authenticate_additional_data(self, data: bytes) -> None: + """ + Authenticates the provided bytes. + """ + + +class AEADDecryptionContext(AEADCipherContext, metaclass=abc.ABCMeta): + @abc.abstractmethod + def finalize_with_tag(self, tag: bytes) -> bytes: + """ + Returns the results of processing the final block as bytes and allows + delayed passing of the authentication tag. + """ + + +class AEADEncryptionContext(AEADCipherContext, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def tag(self) -> bytes: + """ + Returns tag bytes. This is only available after encryption is + finalized. + """ + + +Mode = typing.TypeVar( + "Mode", bound=typing.Optional[modes.Mode], covariant=True +) + + +class Cipher(typing.Generic[Mode]): + def __init__( + self, + algorithm: CipherAlgorithm, + mode: Mode, + backend: typing.Any = None, + ) -> None: + if not isinstance(algorithm, CipherAlgorithm): + raise TypeError("Expected interface of CipherAlgorithm.") + + if mode is not None: + # mypy needs this assert to narrow the type from our generic + # type. Maybe it won't some time in the future. + assert isinstance(mode, modes.Mode) + mode.validate_for_algorithm(algorithm) + + self.algorithm = algorithm + self.mode = mode + + @typing.overload + def encryptor( + self: Cipher[modes.ModeWithAuthenticationTag], + ) -> AEADEncryptionContext: + ... + + @typing.overload + def encryptor( + self: _CIPHER_TYPE, + ) -> CipherContext: + ... + + def encryptor(self): + if isinstance(self.mode, modes.ModeWithAuthenticationTag): + if self.mode.tag is not None: + raise ValueError( + "Authentication tag must be None when encrypting." + ) + from cryptography.hazmat.backends.openssl.backend import backend + + ctx = backend.create_symmetric_encryption_ctx( + self.algorithm, self.mode + ) + return self._wrap_ctx(ctx, encrypt=True) + + @typing.overload + def decryptor( + self: Cipher[modes.ModeWithAuthenticationTag], + ) -> AEADDecryptionContext: + ... + + @typing.overload + def decryptor( + self: _CIPHER_TYPE, + ) -> CipherContext: + ... + + def decryptor(self): + from cryptography.hazmat.backends.openssl.backend import backend + + ctx = backend.create_symmetric_decryption_ctx( + self.algorithm, self.mode + ) + return self._wrap_ctx(ctx, encrypt=False) + + def _wrap_ctx( + self, ctx: _BackendCipherContext, encrypt: bool + ) -> typing.Union[ + AEADEncryptionContext, AEADDecryptionContext, CipherContext + ]: + if isinstance(self.mode, modes.ModeWithAuthenticationTag): + if encrypt: + return _AEADEncryptionContext(ctx) + else: + return _AEADDecryptionContext(ctx) + else: + return _CipherContext(ctx) + + +_CIPHER_TYPE = Cipher[ + typing.Union[ + modes.ModeWithNonce, + modes.ModeWithTweak, + None, + modes.ECB, + modes.ModeWithInitializationVector, + ] +] + + +class _CipherContext(CipherContext): + _ctx: typing.Optional[_BackendCipherContext] + + def __init__(self, ctx: _BackendCipherContext) -> None: + self._ctx = ctx + + def update(self, data: bytes) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return self._ctx.update(data) + + def update_into(self, data: bytes, buf: bytes) -> int: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return self._ctx.update_into(data, buf) + + def finalize(self) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + data = self._ctx.finalize() + self._ctx = None + return data + + +class _AEADCipherContext(AEADCipherContext): + _ctx: typing.Optional[_BackendCipherContext] + _tag: typing.Optional[bytes] + + def __init__(self, ctx: _BackendCipherContext) -> None: + self._ctx = ctx + self._bytes_processed = 0 + self._aad_bytes_processed = 0 + self._tag = None + self._updated = False + + def _check_limit(self, data_size: int) -> None: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + self._updated = True + self._bytes_processed += data_size + if self._bytes_processed > self._ctx._mode._MAX_ENCRYPTED_BYTES: + raise ValueError( + "{} has a maximum encrypted byte limit of {}".format( + self._ctx._mode.name, self._ctx._mode._MAX_ENCRYPTED_BYTES + ) + ) + + def update(self, data: bytes) -> bytes: + self._check_limit(len(data)) + # mypy needs this assert even though _check_limit already checked + assert self._ctx is not None + return self._ctx.update(data) + + def update_into(self, data: bytes, buf: bytes) -> int: + self._check_limit(len(data)) + # mypy needs this assert even though _check_limit already checked + assert self._ctx is not None + return self._ctx.update_into(data, buf) + + def finalize(self) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + data = self._ctx.finalize() + self._tag = self._ctx.tag + self._ctx = None + return data + + def authenticate_additional_data(self, data: bytes) -> None: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + if self._updated: + raise AlreadyUpdated("Update has been called on this context.") + + self._aad_bytes_processed += len(data) + if self._aad_bytes_processed > self._ctx._mode._MAX_AAD_BYTES: + raise ValueError( + "{} has a maximum AAD byte limit of {}".format( + self._ctx._mode.name, self._ctx._mode._MAX_AAD_BYTES + ) + ) + + self._ctx.authenticate_additional_data(data) + + +class _AEADDecryptionContext(_AEADCipherContext, AEADDecryptionContext): + def finalize_with_tag(self, tag: bytes) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + data = self._ctx.finalize_with_tag(tag) + self._tag = self._ctx.tag + self._ctx = None + return data + + +class _AEADEncryptionContext(_AEADCipherContext, AEADEncryptionContext): + @property + def tag(self) -> bytes: + if self._ctx is not None: + raise NotYetFinalized( + "You must finalize encryption before " "getting the tag." + ) + assert self._tag is not None + return self._tag diff --git a/billinglayer/python/cryptography/hazmat/primitives/ciphers/modes.py b/billinglayer/python/cryptography/hazmat/primitives/ciphers/modes.py new file mode 100644 index 0000000..d8ea188 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/ciphers/modes.py @@ -0,0 +1,274 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.primitives._cipheralgorithm import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) +from cryptography.hazmat.primitives.ciphers import algorithms + + +class Mode(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this mode (e.g. "ECB", "CBC"). + """ + + @abc.abstractmethod + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + """ + Checks that all the necessary invariants of this (mode, algorithm) + combination are met. + """ + + +class ModeWithInitializationVector(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def initialization_vector(self) -> bytes: + """ + The value of the initialization vector for this mode as bytes. + """ + + +class ModeWithTweak(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def tweak(self) -> bytes: + """ + The value of the tweak for this mode as bytes. + """ + + +class ModeWithNonce(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def nonce(self) -> bytes: + """ + The value of the nonce for this mode as bytes. + """ + + +class ModeWithAuthenticationTag(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def tag(self) -> typing.Optional[bytes]: + """ + The value of the tag supplied to the constructor of this mode. + """ + + +def _check_aes_key_length(self: Mode, algorithm: CipherAlgorithm) -> None: + if algorithm.key_size > 256 and algorithm.name == "AES": + raise ValueError( + "Only 128, 192, and 256 bit keys are allowed for this AES mode" + ) + + +def _check_iv_length( + self: ModeWithInitializationVector, algorithm: BlockCipherAlgorithm +) -> None: + if len(self.initialization_vector) * 8 != algorithm.block_size: + raise ValueError( + "Invalid IV size ({}) for {}.".format( + len(self.initialization_vector), self.name + ) + ) + + +def _check_nonce_length( + nonce: bytes, name: str, algorithm: CipherAlgorithm +) -> None: + if not isinstance(algorithm, BlockCipherAlgorithm): + raise UnsupportedAlgorithm( + f"{name} requires a block cipher algorithm", + _Reasons.UNSUPPORTED_CIPHER, + ) + if len(nonce) * 8 != algorithm.block_size: + raise ValueError(f"Invalid nonce size ({len(nonce)}) for {name}.") + + +def _check_iv_and_key_length( + self: ModeWithInitializationVector, algorithm: CipherAlgorithm +) -> None: + if not isinstance(algorithm, BlockCipherAlgorithm): + raise UnsupportedAlgorithm( + f"{self} requires a block cipher algorithm", + _Reasons.UNSUPPORTED_CIPHER, + ) + _check_aes_key_length(self, algorithm) + _check_iv_length(self, algorithm) + + +class CBC(ModeWithInitializationVector): + name = "CBC" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class XTS(ModeWithTweak): + name = "XTS" + + def __init__(self, tweak: bytes): + utils._check_byteslike("tweak", tweak) + + if len(tweak) != 16: + raise ValueError("tweak must be 128-bits (16 bytes)") + + self._tweak = tweak + + @property + def tweak(self) -> bytes: + return self._tweak + + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + if isinstance(algorithm, (algorithms.AES128, algorithms.AES256)): + raise TypeError( + "The AES128 and AES256 classes do not support XTS, please use " + "the standard AES class instead." + ) + + if algorithm.key_size not in (256, 512): + raise ValueError( + "The XTS specification requires a 256-bit key for AES-128-XTS" + " and 512-bit key for AES-256-XTS" + ) + + +class ECB(Mode): + name = "ECB" + + validate_for_algorithm = _check_aes_key_length + + +class OFB(ModeWithInitializationVector): + name = "OFB" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class CFB(ModeWithInitializationVector): + name = "CFB" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class CFB8(ModeWithInitializationVector): + name = "CFB8" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class CTR(ModeWithNonce): + name = "CTR" + + def __init__(self, nonce: bytes): + utils._check_byteslike("nonce", nonce) + self._nonce = nonce + + @property + def nonce(self) -> bytes: + return self._nonce + + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + _check_aes_key_length(self, algorithm) + _check_nonce_length(self.nonce, self.name, algorithm) + + +class GCM(ModeWithInitializationVector, ModeWithAuthenticationTag): + name = "GCM" + _MAX_ENCRYPTED_BYTES = (2**39 - 256) // 8 + _MAX_AAD_BYTES = (2**64) // 8 + + def __init__( + self, + initialization_vector: bytes, + tag: typing.Optional[bytes] = None, + min_tag_length: int = 16, + ): + # OpenSSL 3.0.0 constrains GCM IVs to [64, 1024] bits inclusive + # This is a sane limit anyway so we'll enforce it here. + utils._check_byteslike("initialization_vector", initialization_vector) + if len(initialization_vector) < 8 or len(initialization_vector) > 128: + raise ValueError( + "initialization_vector must be between 8 and 128 bytes (64 " + "and 1024 bits)." + ) + self._initialization_vector = initialization_vector + if tag is not None: + utils._check_bytes("tag", tag) + if min_tag_length < 4: + raise ValueError("min_tag_length must be >= 4") + if len(tag) < min_tag_length: + raise ValueError( + "Authentication tag must be {} bytes or longer.".format( + min_tag_length + ) + ) + self._tag = tag + self._min_tag_length = min_tag_length + + @property + def tag(self) -> typing.Optional[bytes]: + return self._tag + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + _check_aes_key_length(self, algorithm) + if not isinstance(algorithm, BlockCipherAlgorithm): + raise UnsupportedAlgorithm( + "GCM requires a block cipher algorithm", + _Reasons.UNSUPPORTED_CIPHER, + ) + block_size_bytes = algorithm.block_size // 8 + if self._tag is not None and len(self._tag) > block_size_bytes: + raise ValueError( + "Authentication tag cannot be more than {} bytes.".format( + block_size_bytes + ) + ) diff --git a/billinglayer/python/cryptography/hazmat/primitives/cmac.py b/billinglayer/python/cryptography/hazmat/primitives/cmac.py new file mode 100644 index 0000000..8aa1d79 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/cmac.py @@ -0,0 +1,65 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized +from cryptography.hazmat.primitives import ciphers + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.cmac import _CMACContext + + +class CMAC: + _ctx: typing.Optional[_CMACContext] + _algorithm: ciphers.BlockCipherAlgorithm + + def __init__( + self, + algorithm: ciphers.BlockCipherAlgorithm, + backend: typing.Any = None, + ctx: typing.Optional[_CMACContext] = None, + ) -> None: + if not isinstance(algorithm, ciphers.BlockCipherAlgorithm): + raise TypeError("Expected instance of BlockCipherAlgorithm.") + self._algorithm = algorithm + + if ctx is None: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + self._ctx = ossl.create_cmac_ctx(self._algorithm) + else: + self._ctx = ctx + + def update(self, data: bytes) -> None: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + + utils._check_bytes("data", data) + self._ctx.update(data) + + def finalize(self) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + digest = self._ctx.finalize() + self._ctx = None + return digest + + def verify(self, signature: bytes) -> None: + utils._check_bytes("signature", signature) + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + + ctx, self._ctx = self._ctx, None + ctx.verify(signature) + + def copy(self) -> CMAC: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return CMAC(self._algorithm, ctx=self._ctx.copy()) diff --git a/billinglayer/python/cryptography/hazmat/primitives/constant_time.py b/billinglayer/python/cryptography/hazmat/primitives/constant_time.py new file mode 100644 index 0000000..3975c71 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/constant_time.py @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import hmac + + +def bytes_eq(a: bytes, b: bytes) -> bool: + if not isinstance(a, bytes) or not isinstance(b, bytes): + raise TypeError("a and b must be bytes.") + + return hmac.compare_digest(a, b) diff --git a/billinglayer/python/cryptography/hazmat/primitives/hashes.py b/billinglayer/python/cryptography/hazmat/primitives/hashes.py new file mode 100644 index 0000000..b6a7ff1 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/hashes.py @@ -0,0 +1,243 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl + +__all__ = [ + "HashAlgorithm", + "HashContext", + "Hash", + "ExtendableOutputFunction", + "SHA1", + "SHA512_224", + "SHA512_256", + "SHA224", + "SHA256", + "SHA384", + "SHA512", + "SHA3_224", + "SHA3_256", + "SHA3_384", + "SHA3_512", + "SHAKE128", + "SHAKE256", + "MD5", + "BLAKE2b", + "BLAKE2s", + "SM3", +] + + +class HashAlgorithm(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this algorithm (e.g. "sha256", "md5"). + """ + + @property + @abc.abstractmethod + def digest_size(self) -> int: + """ + The size of the resulting digest in bytes. + """ + + @property + @abc.abstractmethod + def block_size(self) -> typing.Optional[int]: + """ + The internal block size of the hash function, or None if the hash + function does not use blocks internally (e.g. SHA3). + """ + + +class HashContext(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def algorithm(self) -> HashAlgorithm: + """ + A HashAlgorithm that will be used by this context. + """ + + @abc.abstractmethod + def update(self, data: bytes) -> None: + """ + Processes the provided bytes through the hash. + """ + + @abc.abstractmethod + def finalize(self) -> bytes: + """ + Finalizes the hash context and returns the hash digest as bytes. + """ + + @abc.abstractmethod + def copy(self) -> HashContext: + """ + Return a HashContext that is a copy of the current context. + """ + + +Hash = rust_openssl.hashes.Hash +HashContext.register(Hash) + + +class ExtendableOutputFunction(metaclass=abc.ABCMeta): + """ + An interface for extendable output functions. + """ + + +class SHA1(HashAlgorithm): + name = "sha1" + digest_size = 20 + block_size = 64 + + +class SHA512_224(HashAlgorithm): # noqa: N801 + name = "sha512-224" + digest_size = 28 + block_size = 128 + + +class SHA512_256(HashAlgorithm): # noqa: N801 + name = "sha512-256" + digest_size = 32 + block_size = 128 + + +class SHA224(HashAlgorithm): + name = "sha224" + digest_size = 28 + block_size = 64 + + +class SHA256(HashAlgorithm): + name = "sha256" + digest_size = 32 + block_size = 64 + + +class SHA384(HashAlgorithm): + name = "sha384" + digest_size = 48 + block_size = 128 + + +class SHA512(HashAlgorithm): + name = "sha512" + digest_size = 64 + block_size = 128 + + +class SHA3_224(HashAlgorithm): # noqa: N801 + name = "sha3-224" + digest_size = 28 + block_size = None + + +class SHA3_256(HashAlgorithm): # noqa: N801 + name = "sha3-256" + digest_size = 32 + block_size = None + + +class SHA3_384(HashAlgorithm): # noqa: N801 + name = "sha3-384" + digest_size = 48 + block_size = None + + +class SHA3_512(HashAlgorithm): # noqa: N801 + name = "sha3-512" + digest_size = 64 + block_size = None + + +class SHAKE128(HashAlgorithm, ExtendableOutputFunction): + name = "shake128" + block_size = None + + def __init__(self, digest_size: int): + if not isinstance(digest_size, int): + raise TypeError("digest_size must be an integer") + + if digest_size < 1: + raise ValueError("digest_size must be a positive integer") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class SHAKE256(HashAlgorithm, ExtendableOutputFunction): + name = "shake256" + block_size = None + + def __init__(self, digest_size: int): + if not isinstance(digest_size, int): + raise TypeError("digest_size must be an integer") + + if digest_size < 1: + raise ValueError("digest_size must be a positive integer") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class MD5(HashAlgorithm): + name = "md5" + digest_size = 16 + block_size = 64 + + +class BLAKE2b(HashAlgorithm): + name = "blake2b" + _max_digest_size = 64 + _min_digest_size = 1 + block_size = 128 + + def __init__(self, digest_size: int): + if digest_size != 64: + raise ValueError("Digest size must be 64") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class BLAKE2s(HashAlgorithm): + name = "blake2s" + block_size = 64 + _max_digest_size = 32 + _min_digest_size = 1 + + def __init__(self, digest_size: int): + if digest_size != 32: + raise ValueError("Digest size must be 32") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class SM3(HashAlgorithm): + name = "sm3" + digest_size = 32 + block_size = 64 diff --git a/billinglayer/python/cryptography/hazmat/primitives/hmac.py b/billinglayer/python/cryptography/hazmat/primitives/hmac.py new file mode 100644 index 0000000..a9442d5 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/hmac.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import hashes + +__all__ = ["HMAC"] + +HMAC = rust_openssl.hmac.HMAC +hashes.HashContext.register(HMAC) diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__init__.py b/billinglayer/python/cryptography/hazmat/primitives/kdf/__init__.py new file mode 100644 index 0000000..79bb459 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/kdf/__init__.py @@ -0,0 +1,23 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + + +class KeyDerivationFunction(metaclass=abc.ABCMeta): + @abc.abstractmethod + def derive(self, key_material: bytes) -> bytes: + """ + Deterministically generates and returns a new key based on the existing + key material. + """ + + @abc.abstractmethod + def verify(self, key_material: bytes, expected_key: bytes) -> None: + """ + Checks whether the key generated by the key material matches the + expected derived key. Raises an exception if they do not match. + """ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..7eb3b69 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc new file mode 100644 index 0000000..14bfc96 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc new file mode 100644 index 0000000..e00178f Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc new file mode 100644 index 0000000..6a9c0ff Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc new file mode 100644 index 0000000..c232dda Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc new file mode 100644 index 0000000..80ff4bb Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc new file mode 100644 index 0000000..a99ac91 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/concatkdf.py b/billinglayer/python/cryptography/hazmat/primitives/kdf/concatkdf.py new file mode 100644 index 0000000..d5ea58a --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/kdf/concatkdf.py @@ -0,0 +1,124 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized, InvalidKey +from cryptography.hazmat.primitives import constant_time, hashes, hmac +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +def _int_to_u32be(n: int) -> bytes: + return n.to_bytes(length=4, byteorder="big") + + +def _common_args_checks( + algorithm: hashes.HashAlgorithm, + length: int, + otherinfo: typing.Optional[bytes], +) -> None: + max_length = algorithm.digest_size * (2**32 - 1) + if length > max_length: + raise ValueError(f"Cannot derive keys larger than {max_length} bits.") + if otherinfo is not None: + utils._check_bytes("otherinfo", otherinfo) + + +def _concatkdf_derive( + key_material: bytes, + length: int, + auxfn: typing.Callable[[], hashes.HashContext], + otherinfo: bytes, +) -> bytes: + utils._check_byteslike("key_material", key_material) + output = [b""] + outlen = 0 + counter = 1 + + while length > outlen: + h = auxfn() + h.update(_int_to_u32be(counter)) + h.update(key_material) + h.update(otherinfo) + output.append(h.finalize()) + outlen += len(output[-1]) + counter += 1 + + return b"".join(output)[:length] + + +class ConcatKDFHash(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + otherinfo: typing.Optional[bytes], + backend: typing.Any = None, + ): + _common_args_checks(algorithm, length, otherinfo) + self._algorithm = algorithm + self._length = length + self._otherinfo: bytes = otherinfo if otherinfo is not None else b"" + + self._used = False + + def _hash(self) -> hashes.Hash: + return hashes.Hash(self._algorithm) + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized + self._used = True + return _concatkdf_derive( + key_material, self._length, self._hash, self._otherinfo + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey + + +class ConcatKDFHMAC(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + salt: typing.Optional[bytes], + otherinfo: typing.Optional[bytes], + backend: typing.Any = None, + ): + _common_args_checks(algorithm, length, otherinfo) + self._algorithm = algorithm + self._length = length + self._otherinfo: bytes = otherinfo if otherinfo is not None else b"" + + if algorithm.block_size is None: + raise TypeError(f"{algorithm.name} is unsupported for ConcatKDF") + + if salt is None: + salt = b"\x00" * algorithm.block_size + else: + utils._check_bytes("salt", salt) + + self._salt = salt + + self._used = False + + def _hmac(self) -> hmac.HMAC: + return hmac.HMAC(self._salt, self._algorithm) + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized + self._used = True + return _concatkdf_derive( + key_material, self._length, self._hmac, self._otherinfo + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/hkdf.py b/billinglayer/python/cryptography/hazmat/primitives/kdf/hkdf.py new file mode 100644 index 0000000..d476894 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/kdf/hkdf.py @@ -0,0 +1,101 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized, InvalidKey +from cryptography.hazmat.primitives import constant_time, hashes, hmac +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +class HKDF(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + salt: typing.Optional[bytes], + info: typing.Optional[bytes], + backend: typing.Any = None, + ): + self._algorithm = algorithm + + if salt is None: + salt = b"\x00" * self._algorithm.digest_size + else: + utils._check_bytes("salt", salt) + + self._salt = salt + + self._hkdf_expand = HKDFExpand(self._algorithm, length, info) + + def _extract(self, key_material: bytes) -> bytes: + h = hmac.HMAC(self._salt, self._algorithm) + h.update(key_material) + return h.finalize() + + def derive(self, key_material: bytes) -> bytes: + utils._check_byteslike("key_material", key_material) + return self._hkdf_expand.derive(self._extract(key_material)) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey + + +class HKDFExpand(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + info: typing.Optional[bytes], + backend: typing.Any = None, + ): + self._algorithm = algorithm + + max_length = 255 * algorithm.digest_size + + if length > max_length: + raise ValueError( + f"Cannot derive keys larger than {max_length} octets." + ) + + self._length = length + + if info is None: + info = b"" + else: + utils._check_bytes("info", info) + + self._info = info + + self._used = False + + def _expand(self, key_material: bytes) -> bytes: + output = [b""] + counter = 1 + + while self._algorithm.digest_size * (len(output) - 1) < self._length: + h = hmac.HMAC(key_material, self._algorithm) + h.update(output[-1]) + h.update(self._info) + h.update(bytes([counter])) + output.append(h.finalize()) + counter += 1 + + return b"".join(output)[: self._length] + + def derive(self, key_material: bytes) -> bytes: + utils._check_byteslike("key_material", key_material) + if self._used: + raise AlreadyFinalized + + self._used = True + return self._expand(key_material) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/kbkdf.py b/billinglayer/python/cryptography/hazmat/primitives/kdf/kbkdf.py new file mode 100644 index 0000000..9677638 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/kdf/kbkdf.py @@ -0,0 +1,299 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import ( + AlreadyFinalized, + InvalidKey, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.primitives import ( + ciphers, + cmac, + constant_time, + hashes, + hmac, +) +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +class Mode(utils.Enum): + CounterMode = "ctr" + + +class CounterLocation(utils.Enum): + BeforeFixed = "before_fixed" + AfterFixed = "after_fixed" + MiddleFixed = "middle_fixed" + + +class _KBKDFDeriver: + def __init__( + self, + prf: typing.Callable, + mode: Mode, + length: int, + rlen: int, + llen: typing.Optional[int], + location: CounterLocation, + break_location: typing.Optional[int], + label: typing.Optional[bytes], + context: typing.Optional[bytes], + fixed: typing.Optional[bytes], + ): + assert callable(prf) + + if not isinstance(mode, Mode): + raise TypeError("mode must be of type Mode") + + if not isinstance(location, CounterLocation): + raise TypeError("location must be of type CounterLocation") + + if break_location is None and location is CounterLocation.MiddleFixed: + raise ValueError("Please specify a break_location") + + if ( + break_location is not None + and location != CounterLocation.MiddleFixed + ): + raise ValueError( + "break_location is ignored when location is not" + " CounterLocation.MiddleFixed" + ) + + if break_location is not None and not isinstance(break_location, int): + raise TypeError("break_location must be an integer") + + if break_location is not None and break_location < 0: + raise ValueError("break_location must be a positive integer") + + if (label or context) and fixed: + raise ValueError( + "When supplying fixed data, " "label and context are ignored." + ) + + if rlen is None or not self._valid_byte_length(rlen): + raise ValueError("rlen must be between 1 and 4") + + if llen is None and fixed is None: + raise ValueError("Please specify an llen") + + if llen is not None and not isinstance(llen, int): + raise TypeError("llen must be an integer") + + if label is None: + label = b"" + + if context is None: + context = b"" + + utils._check_bytes("label", label) + utils._check_bytes("context", context) + self._prf = prf + self._mode = mode + self._length = length + self._rlen = rlen + self._llen = llen + self._location = location + self._break_location = break_location + self._label = label + self._context = context + self._used = False + self._fixed_data = fixed + + @staticmethod + def _valid_byte_length(value: int) -> bool: + if not isinstance(value, int): + raise TypeError("value must be of type int") + + value_bin = utils.int_to_bytes(1, value) + if not 1 <= len(value_bin) <= 4: + return False + return True + + def derive(self, key_material: bytes, prf_output_size: int) -> bytes: + if self._used: + raise AlreadyFinalized + + utils._check_byteslike("key_material", key_material) + self._used = True + + # inverse floor division (equivalent to ceiling) + rounds = -(-self._length // prf_output_size) + + output = [b""] + + # For counter mode, the number of iterations shall not be + # larger than 2^r-1, where r <= 32 is the binary length of the counter + # This ensures that the counter values used as an input to the + # PRF will not repeat during a particular call to the KDF function. + r_bin = utils.int_to_bytes(1, self._rlen) + if rounds > pow(2, len(r_bin) * 8) - 1: + raise ValueError("There are too many iterations.") + + fixed = self._generate_fixed_input() + + if self._location == CounterLocation.BeforeFixed: + data_before_ctr = b"" + data_after_ctr = fixed + elif self._location == CounterLocation.AfterFixed: + data_before_ctr = fixed + data_after_ctr = b"" + else: + if isinstance( + self._break_location, int + ) and self._break_location > len(fixed): + raise ValueError("break_location offset > len(fixed)") + data_before_ctr = fixed[: self._break_location] + data_after_ctr = fixed[self._break_location :] + + for i in range(1, rounds + 1): + h = self._prf(key_material) + + counter = utils.int_to_bytes(i, self._rlen) + input_data = data_before_ctr + counter + data_after_ctr + + h.update(input_data) + + output.append(h.finalize()) + + return b"".join(output)[: self._length] + + def _generate_fixed_input(self) -> bytes: + if self._fixed_data and isinstance(self._fixed_data, bytes): + return self._fixed_data + + l_val = utils.int_to_bytes(self._length * 8, self._llen) + + return b"".join([self._label, b"\x00", self._context, l_val]) + + +class KBKDFHMAC(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + mode: Mode, + length: int, + rlen: int, + llen: typing.Optional[int], + location: CounterLocation, + label: typing.Optional[bytes], + context: typing.Optional[bytes], + fixed: typing.Optional[bytes], + backend: typing.Any = None, + *, + break_location: typing.Optional[int] = None, + ): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported hash algorithm.", + _Reasons.UNSUPPORTED_HASH, + ) + + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.hmac_supported(algorithm): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported hmac algorithm.", + _Reasons.UNSUPPORTED_HASH, + ) + + self._algorithm = algorithm + + self._deriver = _KBKDFDeriver( + self._prf, + mode, + length, + rlen, + llen, + location, + break_location, + label, + context, + fixed, + ) + + def _prf(self, key_material: bytes) -> hmac.HMAC: + return hmac.HMAC(key_material, self._algorithm) + + def derive(self, key_material: bytes) -> bytes: + return self._deriver.derive(key_material, self._algorithm.digest_size) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey + + +class KBKDFCMAC(KeyDerivationFunction): + def __init__( + self, + algorithm, + mode: Mode, + length: int, + rlen: int, + llen: typing.Optional[int], + location: CounterLocation, + label: typing.Optional[bytes], + context: typing.Optional[bytes], + fixed: typing.Optional[bytes], + backend: typing.Any = None, + *, + break_location: typing.Optional[int] = None, + ): + if not issubclass( + algorithm, ciphers.BlockCipherAlgorithm + ) or not issubclass(algorithm, ciphers.CipherAlgorithm): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported cipher algorithm.", + _Reasons.UNSUPPORTED_CIPHER, + ) + + self._algorithm = algorithm + self._cipher: typing.Optional[ciphers.BlockCipherAlgorithm] = None + + self._deriver = _KBKDFDeriver( + self._prf, + mode, + length, + rlen, + llen, + location, + break_location, + label, + context, + fixed, + ) + + def _prf(self, _: bytes) -> cmac.CMAC: + assert self._cipher is not None + + return cmac.CMAC(self._cipher) + + def derive(self, key_material: bytes) -> bytes: + self._cipher = self._algorithm(key_material) + + assert self._cipher is not None + + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.cmac_algorithm_supported(self._cipher): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported cipher algorithm.", + _Reasons.UNSUPPORTED_CIPHER, + ) + + return self._deriver.derive(key_material, self._cipher.block_size // 8) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/pbkdf2.py b/billinglayer/python/cryptography/hazmat/primitives/kdf/pbkdf2.py new file mode 100644 index 0000000..623e1ca --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/kdf/pbkdf2.py @@ -0,0 +1,64 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import ( + AlreadyFinalized, + InvalidKey, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import constant_time, hashes +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +class PBKDF2HMAC(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + salt: bytes, + iterations: int, + backend: typing.Any = None, + ): + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.pbkdf2_hmac_supported(algorithm): + raise UnsupportedAlgorithm( + "{} is not supported for PBKDF2 by this backend.".format( + algorithm.name + ), + _Reasons.UNSUPPORTED_HASH, + ) + self._used = False + self._algorithm = algorithm + self._length = length + utils._check_bytes("salt", salt) + self._salt = salt + self._iterations = iterations + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized("PBKDF2 instances can only be used once.") + self._used = True + + return rust_openssl.kdf.derive_pbkdf2_hmac( + key_material, + self._algorithm, + self._salt, + self._iterations, + self._length, + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + derived_key = self.derive(key_material) + if not constant_time.bytes_eq(derived_key, expected_key): + raise InvalidKey("Keys do not match.") diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/scrypt.py b/billinglayer/python/cryptography/hazmat/primitives/kdf/scrypt.py new file mode 100644 index 0000000..05a4f67 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/kdf/scrypt.py @@ -0,0 +1,80 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import sys +import typing + +from cryptography import utils +from cryptography.exceptions import ( + AlreadyFinalized, + InvalidKey, + UnsupportedAlgorithm, +) +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import constant_time +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + +# This is used by the scrypt tests to skip tests that require more memory +# than the MEM_LIMIT +_MEM_LIMIT = sys.maxsize // 2 + + +class Scrypt(KeyDerivationFunction): + def __init__( + self, + salt: bytes, + length: int, + n: int, + r: int, + p: int, + backend: typing.Any = None, + ): + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.scrypt_supported(): + raise UnsupportedAlgorithm( + "This version of OpenSSL does not support scrypt" + ) + self._length = length + utils._check_bytes("salt", salt) + if n < 2 or (n & (n - 1)) != 0: + raise ValueError("n must be greater than 1 and be a power of 2.") + + if r < 1: + raise ValueError("r must be greater than or equal to 1.") + + if p < 1: + raise ValueError("p must be greater than or equal to 1.") + + self._used = False + self._salt = salt + self._n = n + self._r = r + self._p = p + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized("Scrypt instances can only be used once.") + self._used = True + + utils._check_byteslike("key_material", key_material) + + return rust_openssl.kdf.derive_scrypt( + key_material, + self._salt, + self._n, + self._r, + self._p, + _MEM_LIMIT, + self._length, + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + derived_key = self.derive(key_material) + if not constant_time.bytes_eq(derived_key, expected_key): + raise InvalidKey("Keys do not match.") diff --git a/billinglayer/python/cryptography/hazmat/primitives/kdf/x963kdf.py b/billinglayer/python/cryptography/hazmat/primitives/kdf/x963kdf.py new file mode 100644 index 0000000..17acc51 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/kdf/x963kdf.py @@ -0,0 +1,61 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized, InvalidKey +from cryptography.hazmat.primitives import constant_time, hashes +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +def _int_to_u32be(n: int) -> bytes: + return n.to_bytes(length=4, byteorder="big") + + +class X963KDF(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + sharedinfo: typing.Optional[bytes], + backend: typing.Any = None, + ): + max_len = algorithm.digest_size * (2**32 - 1) + if length > max_len: + raise ValueError(f"Cannot derive keys larger than {max_len} bits.") + if sharedinfo is not None: + utils._check_bytes("sharedinfo", sharedinfo) + + self._algorithm = algorithm + self._length = length + self._sharedinfo = sharedinfo + self._used = False + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized + self._used = True + utils._check_byteslike("key_material", key_material) + output = [b""] + outlen = 0 + counter = 1 + + while self._length > outlen: + h = hashes.Hash(self._algorithm) + h.update(key_material) + h.update(_int_to_u32be(counter)) + if self._sharedinfo is not None: + h.update(self._sharedinfo) + output.append(h.finalize()) + outlen += len(output[-1]) + counter += 1 + + return b"".join(output)[: self._length] + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/billinglayer/python/cryptography/hazmat/primitives/keywrap.py b/billinglayer/python/cryptography/hazmat/primitives/keywrap.py new file mode 100644 index 0000000..59b0326 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/keywrap.py @@ -0,0 +1,177 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives.ciphers import Cipher +from cryptography.hazmat.primitives.ciphers.algorithms import AES +from cryptography.hazmat.primitives.ciphers.modes import ECB +from cryptography.hazmat.primitives.constant_time import bytes_eq + + +def _wrap_core( + wrapping_key: bytes, + a: bytes, + r: typing.List[bytes], +) -> bytes: + # RFC 3394 Key Wrap - 2.2.1 (index method) + encryptor = Cipher(AES(wrapping_key), ECB()).encryptor() + n = len(r) + for j in range(6): + for i in range(n): + # every encryption operation is a discrete 16 byte chunk (because + # AES has a 128-bit block size) and since we're using ECB it is + # safe to reuse the encryptor for the entire operation + b = encryptor.update(a + r[i]) + a = ( + int.from_bytes(b[:8], byteorder="big") ^ ((n * j) + i + 1) + ).to_bytes(length=8, byteorder="big") + r[i] = b[-8:] + + assert encryptor.finalize() == b"" + + return a + b"".join(r) + + +def aes_key_wrap( + wrapping_key: bytes, + key_to_wrap: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + if len(key_to_wrap) < 16: + raise ValueError("The key to wrap must be at least 16 bytes") + + if len(key_to_wrap) % 8 != 0: + raise ValueError("The key to wrap must be a multiple of 8 bytes") + + a = b"\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6" + r = [key_to_wrap[i : i + 8] for i in range(0, len(key_to_wrap), 8)] + return _wrap_core(wrapping_key, a, r) + + +def _unwrap_core( + wrapping_key: bytes, + a: bytes, + r: typing.List[bytes], +) -> typing.Tuple[bytes, typing.List[bytes]]: + # Implement RFC 3394 Key Unwrap - 2.2.2 (index method) + decryptor = Cipher(AES(wrapping_key), ECB()).decryptor() + n = len(r) + for j in reversed(range(6)): + for i in reversed(range(n)): + atr = ( + int.from_bytes(a, byteorder="big") ^ ((n * j) + i + 1) + ).to_bytes(length=8, byteorder="big") + r[i] + # every decryption operation is a discrete 16 byte chunk so + # it is safe to reuse the decryptor for the entire operation + b = decryptor.update(atr) + a = b[:8] + r[i] = b[-8:] + + assert decryptor.finalize() == b"" + return a, r + + +def aes_key_wrap_with_padding( + wrapping_key: bytes, + key_to_wrap: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + aiv = b"\xA6\x59\x59\xA6" + len(key_to_wrap).to_bytes( + length=4, byteorder="big" + ) + # pad the key to wrap if necessary + pad = (8 - (len(key_to_wrap) % 8)) % 8 + key_to_wrap = key_to_wrap + b"\x00" * pad + if len(key_to_wrap) == 8: + # RFC 5649 - 4.1 - exactly 8 octets after padding + encryptor = Cipher(AES(wrapping_key), ECB()).encryptor() + b = encryptor.update(aiv + key_to_wrap) + assert encryptor.finalize() == b"" + return b + else: + r = [key_to_wrap[i : i + 8] for i in range(0, len(key_to_wrap), 8)] + return _wrap_core(wrapping_key, aiv, r) + + +def aes_key_unwrap_with_padding( + wrapping_key: bytes, + wrapped_key: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapped_key) < 16: + raise InvalidUnwrap("Must be at least 16 bytes") + + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + if len(wrapped_key) == 16: + # RFC 5649 - 4.2 - exactly two 64-bit blocks + decryptor = Cipher(AES(wrapping_key), ECB()).decryptor() + out = decryptor.update(wrapped_key) + assert decryptor.finalize() == b"" + a = out[:8] + data = out[8:] + n = 1 + else: + r = [wrapped_key[i : i + 8] for i in range(0, len(wrapped_key), 8)] + encrypted_aiv = r.pop(0) + n = len(r) + a, r = _unwrap_core(wrapping_key, encrypted_aiv, r) + data = b"".join(r) + + # 1) Check that MSB(32,A) = A65959A6. + # 2) Check that 8*(n-1) < LSB(32,A) <= 8*n. If so, let + # MLI = LSB(32,A). + # 3) Let b = (8*n)-MLI, and then check that the rightmost b octets of + # the output data are zero. + mli = int.from_bytes(a[4:], byteorder="big") + b = (8 * n) - mli + if ( + not bytes_eq(a[:4], b"\xa6\x59\x59\xa6") + or not 8 * (n - 1) < mli <= 8 * n + or (b != 0 and not bytes_eq(data[-b:], b"\x00" * b)) + ): + raise InvalidUnwrap() + + if b == 0: + return data + else: + return data[:-b] + + +def aes_key_unwrap( + wrapping_key: bytes, + wrapped_key: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapped_key) < 24: + raise InvalidUnwrap("Must be at least 24 bytes") + + if len(wrapped_key) % 8 != 0: + raise InvalidUnwrap("The wrapped key must be a multiple of 8 bytes") + + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + aiv = b"\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6" + r = [wrapped_key[i : i + 8] for i in range(0, len(wrapped_key), 8)] + a = r.pop(0) + a, r = _unwrap_core(wrapping_key, a, r) + if not bytes_eq(a, aiv): + raise InvalidUnwrap() + + return b"".join(r) + + +class InvalidUnwrap(Exception): + pass diff --git a/billinglayer/python/cryptography/hazmat/primitives/padding.py b/billinglayer/python/cryptography/hazmat/primitives/padding.py new file mode 100644 index 0000000..fde3094 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/padding.py @@ -0,0 +1,225 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized +from cryptography.hazmat.bindings._rust import ( + check_ansix923_padding, + check_pkcs7_padding, +) + + +class PaddingContext(metaclass=abc.ABCMeta): + @abc.abstractmethod + def update(self, data: bytes) -> bytes: + """ + Pads the provided bytes and returns any available data as bytes. + """ + + @abc.abstractmethod + def finalize(self) -> bytes: + """ + Finalize the padding, returns bytes. + """ + + +def _byte_padding_check(block_size: int) -> None: + if not (0 <= block_size <= 2040): + raise ValueError("block_size must be in range(0, 2041).") + + if block_size % 8 != 0: + raise ValueError("block_size must be a multiple of 8.") + + +def _byte_padding_update( + buffer_: typing.Optional[bytes], data: bytes, block_size: int +) -> typing.Tuple[bytes, bytes]: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + utils._check_byteslike("data", data) + + buffer_ += bytes(data) + + finished_blocks = len(buffer_) // (block_size // 8) + + result = buffer_[: finished_blocks * (block_size // 8)] + buffer_ = buffer_[finished_blocks * (block_size // 8) :] + + return buffer_, result + + +def _byte_padding_pad( + buffer_: typing.Optional[bytes], + block_size: int, + paddingfn: typing.Callable[[int], bytes], +) -> bytes: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + pad_size = block_size // 8 - len(buffer_) + return buffer_ + paddingfn(pad_size) + + +def _byte_unpadding_update( + buffer_: typing.Optional[bytes], data: bytes, block_size: int +) -> typing.Tuple[bytes, bytes]: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + utils._check_byteslike("data", data) + + buffer_ += bytes(data) + + finished_blocks = max(len(buffer_) // (block_size // 8) - 1, 0) + + result = buffer_[: finished_blocks * (block_size // 8)] + buffer_ = buffer_[finished_blocks * (block_size // 8) :] + + return buffer_, result + + +def _byte_unpadding_check( + buffer_: typing.Optional[bytes], + block_size: int, + checkfn: typing.Callable[[bytes], int], +) -> bytes: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + if len(buffer_) != block_size // 8: + raise ValueError("Invalid padding bytes.") + + valid = checkfn(buffer_) + + if not valid: + raise ValueError("Invalid padding bytes.") + + pad_size = buffer_[-1] + return buffer_[:-pad_size] + + +class PKCS7: + def __init__(self, block_size: int): + _byte_padding_check(block_size) + self.block_size = block_size + + def padder(self) -> PaddingContext: + return _PKCS7PaddingContext(self.block_size) + + def unpadder(self) -> PaddingContext: + return _PKCS7UnpaddingContext(self.block_size) + + +class _PKCS7PaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_padding_update( + self._buffer, data, self.block_size + ) + return result + + def _padding(self, size: int) -> bytes: + return bytes([size]) * size + + def finalize(self) -> bytes: + result = _byte_padding_pad( + self._buffer, self.block_size, self._padding + ) + self._buffer = None + return result + + +class _PKCS7UnpaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_unpadding_update( + self._buffer, data, self.block_size + ) + return result + + def finalize(self) -> bytes: + result = _byte_unpadding_check( + self._buffer, self.block_size, check_pkcs7_padding + ) + self._buffer = None + return result + + +class ANSIX923: + def __init__(self, block_size: int): + _byte_padding_check(block_size) + self.block_size = block_size + + def padder(self) -> PaddingContext: + return _ANSIX923PaddingContext(self.block_size) + + def unpadder(self) -> PaddingContext: + return _ANSIX923UnpaddingContext(self.block_size) + + +class _ANSIX923PaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_padding_update( + self._buffer, data, self.block_size + ) + return result + + def _padding(self, size: int) -> bytes: + return bytes([0]) * (size - 1) + bytes([size]) + + def finalize(self) -> bytes: + result = _byte_padding_pad( + self._buffer, self.block_size, self._padding + ) + self._buffer = None + return result + + +class _ANSIX923UnpaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_unpadding_update( + self._buffer, data, self.block_size + ) + return result + + def finalize(self) -> bytes: + result = _byte_unpadding_check( + self._buffer, + self.block_size, + check_ansix923_padding, + ) + self._buffer = None + return result diff --git a/billinglayer/python/cryptography/hazmat/primitives/poly1305.py b/billinglayer/python/cryptography/hazmat/primitives/poly1305.py new file mode 100644 index 0000000..7f5a77a --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/poly1305.py @@ -0,0 +1,11 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl + +__all__ = ["Poly1305"] + +Poly1305 = rust_openssl.poly1305.Poly1305 diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/__init__.py b/billinglayer/python/cryptography/hazmat/primitives/serialization/__init__.py new file mode 100644 index 0000000..b6c9a5c --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/serialization/__init__.py @@ -0,0 +1,63 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.primitives._serialization import ( + BestAvailableEncryption, + Encoding, + KeySerializationEncryption, + NoEncryption, + ParameterFormat, + PrivateFormat, + PublicFormat, + _KeySerializationEncryption, +) +from cryptography.hazmat.primitives.serialization.base import ( + load_der_parameters, + load_der_private_key, + load_der_public_key, + load_pem_parameters, + load_pem_private_key, + load_pem_public_key, +) +from cryptography.hazmat.primitives.serialization.ssh import ( + SSHCertificate, + SSHCertificateBuilder, + SSHCertificateType, + SSHCertPrivateKeyTypes, + SSHCertPublicKeyTypes, + SSHPrivateKeyTypes, + SSHPublicKeyTypes, + load_ssh_private_key, + load_ssh_public_identity, + load_ssh_public_key, +) + +__all__ = [ + "load_der_parameters", + "load_der_private_key", + "load_der_public_key", + "load_pem_parameters", + "load_pem_private_key", + "load_pem_public_key", + "load_ssh_private_key", + "load_ssh_public_identity", + "load_ssh_public_key", + "Encoding", + "PrivateFormat", + "PublicFormat", + "ParameterFormat", + "KeySerializationEncryption", + "BestAvailableEncryption", + "NoEncryption", + "_KeySerializationEncryption", + "SSHCertificateBuilder", + "SSHCertificate", + "SSHCertificateType", + "SSHCertPublicKeyTypes", + "SSHCertPrivateKeyTypes", + "SSHPrivateKeyTypes", + "SSHPublicKeyTypes", +] diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..774a7ac Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..d8ac2b2 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc new file mode 100644 index 0000000..4003b12 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc new file mode 100644 index 0000000..f55a23c Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc new file mode 100644 index 0000000..5f23e8c Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/base.py b/billinglayer/python/cryptography/hazmat/primitives/serialization/base.py new file mode 100644 index 0000000..18a96cc --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/serialization/base.py @@ -0,0 +1,73 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives.asymmetric import dh +from cryptography.hazmat.primitives.asymmetric.types import ( + PrivateKeyTypes, + PublicKeyTypes, +) + + +def load_pem_private_key( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, + *, + unsafe_skip_rsa_key_validation: bool = False, +) -> PrivateKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pem_private_key( + data, password, unsafe_skip_rsa_key_validation + ) + + +def load_pem_public_key( + data: bytes, backend: typing.Any = None +) -> PublicKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pem_public_key(data) + + +def load_pem_parameters( + data: bytes, backend: typing.Any = None +) -> dh.DHParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pem_parameters(data) + + +def load_der_private_key( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, + *, + unsafe_skip_rsa_key_validation: bool = False, +) -> PrivateKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_der_private_key( + data, password, unsafe_skip_rsa_key_validation + ) + + +def load_der_public_key( + data: bytes, backend: typing.Any = None +) -> PublicKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_der_public_key(data) + + +def load_der_parameters( + data: bytes, backend: typing.Any = None +) -> dh.DHParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_der_parameters(data) diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/pkcs12.py b/billinglayer/python/cryptography/hazmat/primitives/serialization/pkcs12.py new file mode 100644 index 0000000..27133a3 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/serialization/pkcs12.py @@ -0,0 +1,229 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import x509 +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives._serialization import PBES as PBES +from cryptography.hazmat.primitives.asymmetric import ( + dsa, + ec, + ed448, + ed25519, + rsa, +) +from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes + +__all__ = [ + "PBES", + "PKCS12PrivateKeyTypes", + "PKCS12Certificate", + "PKCS12KeyAndCertificates", + "load_key_and_certificates", + "load_pkcs12", + "serialize_key_and_certificates", +] + +PKCS12PrivateKeyTypes = typing.Union[ + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, +] + + +class PKCS12Certificate: + def __init__( + self, + cert: x509.Certificate, + friendly_name: typing.Optional[bytes], + ): + if not isinstance(cert, x509.Certificate): + raise TypeError("Expecting x509.Certificate object") + if friendly_name is not None and not isinstance(friendly_name, bytes): + raise TypeError("friendly_name must be bytes or None") + self._cert = cert + self._friendly_name = friendly_name + + @property + def friendly_name(self) -> typing.Optional[bytes]: + return self._friendly_name + + @property + def certificate(self) -> x509.Certificate: + return self._cert + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PKCS12Certificate): + return NotImplemented + + return ( + self.certificate == other.certificate + and self.friendly_name == other.friendly_name + ) + + def __hash__(self) -> int: + return hash((self.certificate, self.friendly_name)) + + def __repr__(self) -> str: + return "".format( + self.certificate, self.friendly_name + ) + + +class PKCS12KeyAndCertificates: + def __init__( + self, + key: typing.Optional[PrivateKeyTypes], + cert: typing.Optional[PKCS12Certificate], + additional_certs: typing.List[PKCS12Certificate], + ): + if key is not None and not isinstance( + key, + ( + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + ), + ): + raise TypeError( + "Key must be RSA, DSA, EllipticCurve, ED25519, or ED448" + " private key, or None." + ) + if cert is not None and not isinstance(cert, PKCS12Certificate): + raise TypeError("cert must be a PKCS12Certificate object or None") + if not all( + isinstance(add_cert, PKCS12Certificate) + for add_cert in additional_certs + ): + raise TypeError( + "all values in additional_certs must be PKCS12Certificate" + " objects" + ) + self._key = key + self._cert = cert + self._additional_certs = additional_certs + + @property + def key(self) -> typing.Optional[PrivateKeyTypes]: + return self._key + + @property + def cert(self) -> typing.Optional[PKCS12Certificate]: + return self._cert + + @property + def additional_certs(self) -> typing.List[PKCS12Certificate]: + return self._additional_certs + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PKCS12KeyAndCertificates): + return NotImplemented + + return ( + self.key == other.key + and self.cert == other.cert + and self.additional_certs == other.additional_certs + ) + + def __hash__(self) -> int: + return hash((self.key, self.cert, tuple(self.additional_certs))) + + def __repr__(self) -> str: + fmt = ( + "" + ) + return fmt.format(self.key, self.cert, self.additional_certs) + + +def load_key_and_certificates( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, +) -> typing.Tuple[ + typing.Optional[PrivateKeyTypes], + typing.Optional[x509.Certificate], + typing.List[x509.Certificate], +]: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_key_and_certificates_from_pkcs12(data, password) + + +def load_pkcs12( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, +) -> PKCS12KeyAndCertificates: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pkcs12(data, password) + + +_PKCS12CATypes = typing.Union[ + x509.Certificate, + PKCS12Certificate, +] + + +def serialize_key_and_certificates( + name: typing.Optional[bytes], + key: typing.Optional[PKCS12PrivateKeyTypes], + cert: typing.Optional[x509.Certificate], + cas: typing.Optional[typing.Iterable[_PKCS12CATypes]], + encryption_algorithm: serialization.KeySerializationEncryption, +) -> bytes: + if key is not None and not isinstance( + key, + ( + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + ), + ): + raise TypeError( + "Key must be RSA, DSA, EllipticCurve, ED25519, or ED448" + " private key, or None." + ) + if cert is not None and not isinstance(cert, x509.Certificate): + raise TypeError("cert must be a certificate or None") + + if cas is not None: + cas = list(cas) + if not all( + isinstance( + val, + ( + x509.Certificate, + PKCS12Certificate, + ), + ) + for val in cas + ): + raise TypeError("all values in cas must be certificates") + + if not isinstance( + encryption_algorithm, serialization.KeySerializationEncryption + ): + raise TypeError( + "Key encryption algorithm must be a " + "KeySerializationEncryption instance" + ) + + if key is None and cert is None and not cas: + raise ValueError("You must supply at least one of key, cert, or cas") + + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.serialize_key_and_certificates_to_pkcs12( + name, key, cert, cas, encryption_algorithm + ) diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/pkcs7.py b/billinglayer/python/cryptography/hazmat/primitives/serialization/pkcs7.py new file mode 100644 index 0000000..9998bca --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/serialization/pkcs7.py @@ -0,0 +1,235 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import email.base64mime +import email.generator +import email.message +import email.policy +import io +import typing + +from cryptography import utils, x509 +from cryptography.hazmat.bindings._rust import pkcs7 as rust_pkcs7 +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import ec, rsa +from cryptography.utils import _check_byteslike + + +def load_pem_pkcs7_certificates(data: bytes) -> typing.List[x509.Certificate]: + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.load_pem_pkcs7_certificates(data) + + +def load_der_pkcs7_certificates(data: bytes) -> typing.List[x509.Certificate]: + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.load_der_pkcs7_certificates(data) + + +def serialize_certificates( + certs: typing.List[x509.Certificate], + encoding: serialization.Encoding, +) -> bytes: + return rust_pkcs7.serialize_certificates(certs, encoding) + + +PKCS7HashTypes = typing.Union[ + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, +] + +PKCS7PrivateKeyTypes = typing.Union[ + rsa.RSAPrivateKey, ec.EllipticCurvePrivateKey +] + + +class PKCS7Options(utils.Enum): + Text = "Add text/plain MIME type" + Binary = "Don't translate input data into canonical MIME format" + DetachedSignature = "Don't embed data in the PKCS7 structure" + NoCapabilities = "Don't embed SMIME capabilities" + NoAttributes = "Don't embed authenticatedAttributes" + NoCerts = "Don't embed signer certificate" + + +class PKCS7SignatureBuilder: + def __init__( + self, + data: typing.Optional[bytes] = None, + signers: typing.List[ + typing.Tuple[ + x509.Certificate, + PKCS7PrivateKeyTypes, + PKCS7HashTypes, + ] + ] = [], + additional_certs: typing.List[x509.Certificate] = [], + ): + self._data = data + self._signers = signers + self._additional_certs = additional_certs + + def set_data(self, data: bytes) -> PKCS7SignatureBuilder: + _check_byteslike("data", data) + if self._data is not None: + raise ValueError("data may only be set once") + + return PKCS7SignatureBuilder(data, self._signers) + + def add_signer( + self, + certificate: x509.Certificate, + private_key: PKCS7PrivateKeyTypes, + hash_algorithm: PKCS7HashTypes, + ) -> PKCS7SignatureBuilder: + if not isinstance( + hash_algorithm, + ( + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + ), + ): + raise TypeError( + "hash_algorithm must be one of hashes.SHA224, " + "SHA256, SHA384, or SHA512" + ) + if not isinstance(certificate, x509.Certificate): + raise TypeError("certificate must be a x509.Certificate") + + if not isinstance( + private_key, (rsa.RSAPrivateKey, ec.EllipticCurvePrivateKey) + ): + raise TypeError("Only RSA & EC keys are supported at this time.") + + return PKCS7SignatureBuilder( + self._data, + self._signers + [(certificate, private_key, hash_algorithm)], + ) + + def add_certificate( + self, certificate: x509.Certificate + ) -> PKCS7SignatureBuilder: + if not isinstance(certificate, x509.Certificate): + raise TypeError("certificate must be a x509.Certificate") + + return PKCS7SignatureBuilder( + self._data, self._signers, self._additional_certs + [certificate] + ) + + def sign( + self, + encoding: serialization.Encoding, + options: typing.Iterable[PKCS7Options], + backend: typing.Any = None, + ) -> bytes: + if len(self._signers) == 0: + raise ValueError("Must have at least one signer") + if self._data is None: + raise ValueError("You must add data to sign") + options = list(options) + if not all(isinstance(x, PKCS7Options) for x in options): + raise ValueError("options must be from the PKCS7Options enum") + if encoding not in ( + serialization.Encoding.PEM, + serialization.Encoding.DER, + serialization.Encoding.SMIME, + ): + raise ValueError( + "Must be PEM, DER, or SMIME from the Encoding enum" + ) + + # Text is a meaningless option unless it is accompanied by + # DetachedSignature + if ( + PKCS7Options.Text in options + and PKCS7Options.DetachedSignature not in options + ): + raise ValueError( + "When passing the Text option you must also pass " + "DetachedSignature" + ) + + if PKCS7Options.Text in options and encoding in ( + serialization.Encoding.DER, + serialization.Encoding.PEM, + ): + raise ValueError( + "The Text option is only available for SMIME serialization" + ) + + # No attributes implies no capabilities so we'll error if you try to + # pass both. + if ( + PKCS7Options.NoAttributes in options + and PKCS7Options.NoCapabilities in options + ): + raise ValueError( + "NoAttributes is a superset of NoCapabilities. Do not pass " + "both values." + ) + + return rust_pkcs7.sign_and_serialize(self, encoding, options) + + +def _smime_encode( + data: bytes, signature: bytes, micalg: str, text_mode: bool +) -> bytes: + # This function works pretty hard to replicate what OpenSSL does + # precisely. For good and for ill. + + m = email.message.Message() + m.add_header("MIME-Version", "1.0") + m.add_header( + "Content-Type", + "multipart/signed", + protocol="application/x-pkcs7-signature", + micalg=micalg, + ) + + m.preamble = "This is an S/MIME signed message\n" + + msg_part = OpenSSLMimePart() + msg_part.set_payload(data) + if text_mode: + msg_part.add_header("Content-Type", "text/plain") + m.attach(msg_part) + + sig_part = email.message.MIMEPart() + sig_part.add_header( + "Content-Type", "application/x-pkcs7-signature", name="smime.p7s" + ) + sig_part.add_header("Content-Transfer-Encoding", "base64") + sig_part.add_header( + "Content-Disposition", "attachment", filename="smime.p7s" + ) + sig_part.set_payload( + email.base64mime.body_encode(signature, maxlinelen=65) + ) + del sig_part["MIME-Version"] + m.attach(sig_part) + + fp = io.BytesIO() + g = email.generator.BytesGenerator( + fp, + maxheaderlen=0, + mangle_from_=False, + policy=m.policy.clone(linesep="\r\n"), + ) + g.flatten(m) + return fp.getvalue() + + +class OpenSSLMimePart(email.message.MIMEPart): + # A MIMEPart subclass that replicates OpenSSL's behavior of not including + # a newline if there are no headers. + def _write_headers(self, generator) -> None: + if list(self.raw_items()): + generator._write_headers(self) diff --git a/billinglayer/python/cryptography/hazmat/primitives/serialization/ssh.py b/billinglayer/python/cryptography/hazmat/primitives/serialization/ssh.py new file mode 100644 index 0000000..35e53c1 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/serialization/ssh.py @@ -0,0 +1,1534 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import binascii +import enum +import os +import re +import typing +import warnings +from base64 import encodebytes as _base64_encode +from dataclasses import dataclass + +from cryptography import utils +from cryptography.exceptions import UnsupportedAlgorithm +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric import ( + dsa, + ec, + ed25519, + padding, + rsa, +) +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils +from cryptography.hazmat.primitives.ciphers import ( + AEADDecryptionContext, + Cipher, + algorithms, + modes, +) +from cryptography.hazmat.primitives.serialization import ( + Encoding, + KeySerializationEncryption, + NoEncryption, + PrivateFormat, + PublicFormat, + _KeySerializationEncryption, +) + +try: + from bcrypt import kdf as _bcrypt_kdf + + _bcrypt_supported = True +except ImportError: + _bcrypt_supported = False + + def _bcrypt_kdf( + password: bytes, + salt: bytes, + desired_key_bytes: int, + rounds: int, + ignore_few_rounds: bool = False, + ) -> bytes: + raise UnsupportedAlgorithm("Need bcrypt module") + + +_SSH_ED25519 = b"ssh-ed25519" +_SSH_RSA = b"ssh-rsa" +_SSH_DSA = b"ssh-dss" +_ECDSA_NISTP256 = b"ecdsa-sha2-nistp256" +_ECDSA_NISTP384 = b"ecdsa-sha2-nistp384" +_ECDSA_NISTP521 = b"ecdsa-sha2-nistp521" +_CERT_SUFFIX = b"-cert-v01@openssh.com" + +# These are not key types, only algorithms, so they cannot appear +# as a public key type +_SSH_RSA_SHA256 = b"rsa-sha2-256" +_SSH_RSA_SHA512 = b"rsa-sha2-512" + +_SSH_PUBKEY_RC = re.compile(rb"\A(\S+)[ \t]+(\S+)") +_SK_MAGIC = b"openssh-key-v1\0" +_SK_START = b"-----BEGIN OPENSSH PRIVATE KEY-----" +_SK_END = b"-----END OPENSSH PRIVATE KEY-----" +_BCRYPT = b"bcrypt" +_NONE = b"none" +_DEFAULT_CIPHER = b"aes256-ctr" +_DEFAULT_ROUNDS = 16 + +# re is only way to work on bytes-like data +_PEM_RC = re.compile(_SK_START + b"(.*?)" + _SK_END, re.DOTALL) + +# padding for max blocksize +_PADDING = memoryview(bytearray(range(1, 1 + 16))) + + +@dataclass +class _SSHCipher: + alg: typing.Type[algorithms.AES] + key_len: int + mode: typing.Union[ + typing.Type[modes.CTR], + typing.Type[modes.CBC], + typing.Type[modes.GCM], + ] + block_len: int + iv_len: int + tag_len: typing.Optional[int] + is_aead: bool + + +# ciphers that are actually used in key wrapping +_SSH_CIPHERS: typing.Dict[bytes, _SSHCipher] = { + b"aes256-ctr": _SSHCipher( + alg=algorithms.AES, + key_len=32, + mode=modes.CTR, + block_len=16, + iv_len=16, + tag_len=None, + is_aead=False, + ), + b"aes256-cbc": _SSHCipher( + alg=algorithms.AES, + key_len=32, + mode=modes.CBC, + block_len=16, + iv_len=16, + tag_len=None, + is_aead=False, + ), + b"aes256-gcm@openssh.com": _SSHCipher( + alg=algorithms.AES, + key_len=32, + mode=modes.GCM, + block_len=16, + iv_len=12, + tag_len=16, + is_aead=True, + ), +} + +# map local curve name to key type +_ECDSA_KEY_TYPE = { + "secp256r1": _ECDSA_NISTP256, + "secp384r1": _ECDSA_NISTP384, + "secp521r1": _ECDSA_NISTP521, +} + + +def _get_ssh_key_type( + key: typing.Union[SSHPrivateKeyTypes, SSHPublicKeyTypes] +) -> bytes: + if isinstance(key, ec.EllipticCurvePrivateKey): + key_type = _ecdsa_key_type(key.public_key()) + elif isinstance(key, ec.EllipticCurvePublicKey): + key_type = _ecdsa_key_type(key) + elif isinstance(key, (rsa.RSAPrivateKey, rsa.RSAPublicKey)): + key_type = _SSH_RSA + elif isinstance(key, (dsa.DSAPrivateKey, dsa.DSAPublicKey)): + key_type = _SSH_DSA + elif isinstance( + key, (ed25519.Ed25519PrivateKey, ed25519.Ed25519PublicKey) + ): + key_type = _SSH_ED25519 + else: + raise ValueError("Unsupported key type") + + return key_type + + +def _ecdsa_key_type(public_key: ec.EllipticCurvePublicKey) -> bytes: + """Return SSH key_type and curve_name for private key.""" + curve = public_key.curve + if curve.name not in _ECDSA_KEY_TYPE: + raise ValueError( + f"Unsupported curve for ssh private key: {curve.name!r}" + ) + return _ECDSA_KEY_TYPE[curve.name] + + +def _ssh_pem_encode( + data: bytes, + prefix: bytes = _SK_START + b"\n", + suffix: bytes = _SK_END + b"\n", +) -> bytes: + return b"".join([prefix, _base64_encode(data), suffix]) + + +def _check_block_size(data: bytes, block_len: int) -> None: + """Require data to be full blocks""" + if not data or len(data) % block_len != 0: + raise ValueError("Corrupt data: missing padding") + + +def _check_empty(data: bytes) -> None: + """All data should have been parsed.""" + if data: + raise ValueError("Corrupt data: unparsed data") + + +def _init_cipher( + ciphername: bytes, + password: typing.Optional[bytes], + salt: bytes, + rounds: int, +) -> Cipher[typing.Union[modes.CBC, modes.CTR, modes.GCM]]: + """Generate key + iv and return cipher.""" + if not password: + raise ValueError("Key is password-protected.") + + ciph = _SSH_CIPHERS[ciphername] + seed = _bcrypt_kdf( + password, salt, ciph.key_len + ciph.iv_len, rounds, True + ) + return Cipher( + ciph.alg(seed[: ciph.key_len]), + ciph.mode(seed[ciph.key_len :]), + ) + + +def _get_u32(data: memoryview) -> typing.Tuple[int, memoryview]: + """Uint32""" + if len(data) < 4: + raise ValueError("Invalid data") + return int.from_bytes(data[:4], byteorder="big"), data[4:] + + +def _get_u64(data: memoryview) -> typing.Tuple[int, memoryview]: + """Uint64""" + if len(data) < 8: + raise ValueError("Invalid data") + return int.from_bytes(data[:8], byteorder="big"), data[8:] + + +def _get_sshstr(data: memoryview) -> typing.Tuple[memoryview, memoryview]: + """Bytes with u32 length prefix""" + n, data = _get_u32(data) + if n > len(data): + raise ValueError("Invalid data") + return data[:n], data[n:] + + +def _get_mpint(data: memoryview) -> typing.Tuple[int, memoryview]: + """Big integer.""" + val, data = _get_sshstr(data) + if val and val[0] > 0x7F: + raise ValueError("Invalid data") + return int.from_bytes(val, "big"), data + + +def _to_mpint(val: int) -> bytes: + """Storage format for signed bigint.""" + if val < 0: + raise ValueError("negative mpint not allowed") + if not val: + return b"" + nbytes = (val.bit_length() + 8) // 8 + return utils.int_to_bytes(val, nbytes) + + +class _FragList: + """Build recursive structure without data copy.""" + + flist: typing.List[bytes] + + def __init__( + self, init: typing.Optional[typing.List[bytes]] = None + ) -> None: + self.flist = [] + if init: + self.flist.extend(init) + + def put_raw(self, val: bytes) -> None: + """Add plain bytes""" + self.flist.append(val) + + def put_u32(self, val: int) -> None: + """Big-endian uint32""" + self.flist.append(val.to_bytes(length=4, byteorder="big")) + + def put_u64(self, val: int) -> None: + """Big-endian uint64""" + self.flist.append(val.to_bytes(length=8, byteorder="big")) + + def put_sshstr(self, val: typing.Union[bytes, _FragList]) -> None: + """Bytes prefixed with u32 length""" + if isinstance(val, (bytes, memoryview, bytearray)): + self.put_u32(len(val)) + self.flist.append(val) + else: + self.put_u32(val.size()) + self.flist.extend(val.flist) + + def put_mpint(self, val: int) -> None: + """Big-endian bigint prefixed with u32 length""" + self.put_sshstr(_to_mpint(val)) + + def size(self) -> int: + """Current number of bytes""" + return sum(map(len, self.flist)) + + def render(self, dstbuf: memoryview, pos: int = 0) -> int: + """Write into bytearray""" + for frag in self.flist: + flen = len(frag) + start, pos = pos, pos + flen + dstbuf[start:pos] = frag + return pos + + def tobytes(self) -> bytes: + """Return as bytes""" + buf = memoryview(bytearray(self.size())) + self.render(buf) + return buf.tobytes() + + +class _SSHFormatRSA: + """Format for RSA keys. + + Public: + mpint e, n + Private: + mpint n, e, d, iqmp, p, q + """ + + def get_public(self, data: memoryview): + """RSA public fields""" + e, data = _get_mpint(data) + n, data = _get_mpint(data) + return (e, n), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[rsa.RSAPublicKey, memoryview]: + """Make RSA public key from data.""" + (e, n), data = self.get_public(data) + public_numbers = rsa.RSAPublicNumbers(e, n) + public_key = public_numbers.public_key() + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[rsa.RSAPrivateKey, memoryview]: + """Make RSA private key from data.""" + n, data = _get_mpint(data) + e, data = _get_mpint(data) + d, data = _get_mpint(data) + iqmp, data = _get_mpint(data) + p, data = _get_mpint(data) + q, data = _get_mpint(data) + + if (e, n) != pubfields: + raise ValueError("Corrupt data: rsa field mismatch") + dmp1 = rsa.rsa_crt_dmp1(d, p) + dmq1 = rsa.rsa_crt_dmq1(d, q) + public_numbers = rsa.RSAPublicNumbers(e, n) + private_numbers = rsa.RSAPrivateNumbers( + p, q, d, dmp1, dmq1, iqmp, public_numbers + ) + private_key = private_numbers.private_key() + return private_key, data + + def encode_public( + self, public_key: rsa.RSAPublicKey, f_pub: _FragList + ) -> None: + """Write RSA public key""" + pubn = public_key.public_numbers() + f_pub.put_mpint(pubn.e) + f_pub.put_mpint(pubn.n) + + def encode_private( + self, private_key: rsa.RSAPrivateKey, f_priv: _FragList + ) -> None: + """Write RSA private key""" + private_numbers = private_key.private_numbers() + public_numbers = private_numbers.public_numbers + + f_priv.put_mpint(public_numbers.n) + f_priv.put_mpint(public_numbers.e) + + f_priv.put_mpint(private_numbers.d) + f_priv.put_mpint(private_numbers.iqmp) + f_priv.put_mpint(private_numbers.p) + f_priv.put_mpint(private_numbers.q) + + +class _SSHFormatDSA: + """Format for DSA keys. + + Public: + mpint p, q, g, y + Private: + mpint p, q, g, y, x + """ + + def get_public( + self, data: memoryview + ) -> typing.Tuple[typing.Tuple, memoryview]: + """DSA public fields""" + p, data = _get_mpint(data) + q, data = _get_mpint(data) + g, data = _get_mpint(data) + y, data = _get_mpint(data) + return (p, q, g, y), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[dsa.DSAPublicKey, memoryview]: + """Make DSA public key from data.""" + (p, q, g, y), data = self.get_public(data) + parameter_numbers = dsa.DSAParameterNumbers(p, q, g) + public_numbers = dsa.DSAPublicNumbers(y, parameter_numbers) + self._validate(public_numbers) + public_key = public_numbers.public_key() + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[dsa.DSAPrivateKey, memoryview]: + """Make DSA private key from data.""" + (p, q, g, y), data = self.get_public(data) + x, data = _get_mpint(data) + + if (p, q, g, y) != pubfields: + raise ValueError("Corrupt data: dsa field mismatch") + parameter_numbers = dsa.DSAParameterNumbers(p, q, g) + public_numbers = dsa.DSAPublicNumbers(y, parameter_numbers) + self._validate(public_numbers) + private_numbers = dsa.DSAPrivateNumbers(x, public_numbers) + private_key = private_numbers.private_key() + return private_key, data + + def encode_public( + self, public_key: dsa.DSAPublicKey, f_pub: _FragList + ) -> None: + """Write DSA public key""" + public_numbers = public_key.public_numbers() + parameter_numbers = public_numbers.parameter_numbers + self._validate(public_numbers) + + f_pub.put_mpint(parameter_numbers.p) + f_pub.put_mpint(parameter_numbers.q) + f_pub.put_mpint(parameter_numbers.g) + f_pub.put_mpint(public_numbers.y) + + def encode_private( + self, private_key: dsa.DSAPrivateKey, f_priv: _FragList + ) -> None: + """Write DSA private key""" + self.encode_public(private_key.public_key(), f_priv) + f_priv.put_mpint(private_key.private_numbers().x) + + def _validate(self, public_numbers: dsa.DSAPublicNumbers) -> None: + parameter_numbers = public_numbers.parameter_numbers + if parameter_numbers.p.bit_length() != 1024: + raise ValueError("SSH supports only 1024 bit DSA keys") + + +class _SSHFormatECDSA: + """Format for ECDSA keys. + + Public: + str curve + bytes point + Private: + str curve + bytes point + mpint secret + """ + + def __init__(self, ssh_curve_name: bytes, curve: ec.EllipticCurve): + self.ssh_curve_name = ssh_curve_name + self.curve = curve + + def get_public( + self, data: memoryview + ) -> typing.Tuple[typing.Tuple, memoryview]: + """ECDSA public fields""" + curve, data = _get_sshstr(data) + point, data = _get_sshstr(data) + if curve != self.ssh_curve_name: + raise ValueError("Curve name mismatch") + if point[0] != 4: + raise NotImplementedError("Need uncompressed point") + return (curve, point), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[ec.EllipticCurvePublicKey, memoryview]: + """Make ECDSA public key from data.""" + (curve_name, point), data = self.get_public(data) + public_key = ec.EllipticCurvePublicKey.from_encoded_point( + self.curve, point.tobytes() + ) + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[ec.EllipticCurvePrivateKey, memoryview]: + """Make ECDSA private key from data.""" + (curve_name, point), data = self.get_public(data) + secret, data = _get_mpint(data) + + if (curve_name, point) != pubfields: + raise ValueError("Corrupt data: ecdsa field mismatch") + private_key = ec.derive_private_key(secret, self.curve) + return private_key, data + + def encode_public( + self, public_key: ec.EllipticCurvePublicKey, f_pub: _FragList + ) -> None: + """Write ECDSA public key""" + point = public_key.public_bytes( + Encoding.X962, PublicFormat.UncompressedPoint + ) + f_pub.put_sshstr(self.ssh_curve_name) + f_pub.put_sshstr(point) + + def encode_private( + self, private_key: ec.EllipticCurvePrivateKey, f_priv: _FragList + ) -> None: + """Write ECDSA private key""" + public_key = private_key.public_key() + private_numbers = private_key.private_numbers() + + self.encode_public(public_key, f_priv) + f_priv.put_mpint(private_numbers.private_value) + + +class _SSHFormatEd25519: + """Format for Ed25519 keys. + + Public: + bytes point + Private: + bytes point + bytes secret_and_point + """ + + def get_public( + self, data: memoryview + ) -> typing.Tuple[typing.Tuple, memoryview]: + """Ed25519 public fields""" + point, data = _get_sshstr(data) + return (point,), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[ed25519.Ed25519PublicKey, memoryview]: + """Make Ed25519 public key from data.""" + (point,), data = self.get_public(data) + public_key = ed25519.Ed25519PublicKey.from_public_bytes( + point.tobytes() + ) + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[ed25519.Ed25519PrivateKey, memoryview]: + """Make Ed25519 private key from data.""" + (point,), data = self.get_public(data) + keypair, data = _get_sshstr(data) + + secret = keypair[:32] + point2 = keypair[32:] + if point != point2 or (point,) != pubfields: + raise ValueError("Corrupt data: ed25519 field mismatch") + private_key = ed25519.Ed25519PrivateKey.from_private_bytes(secret) + return private_key, data + + def encode_public( + self, public_key: ed25519.Ed25519PublicKey, f_pub: _FragList + ) -> None: + """Write Ed25519 public key""" + raw_public_key = public_key.public_bytes( + Encoding.Raw, PublicFormat.Raw + ) + f_pub.put_sshstr(raw_public_key) + + def encode_private( + self, private_key: ed25519.Ed25519PrivateKey, f_priv: _FragList + ) -> None: + """Write Ed25519 private key""" + public_key = private_key.public_key() + raw_private_key = private_key.private_bytes( + Encoding.Raw, PrivateFormat.Raw, NoEncryption() + ) + raw_public_key = public_key.public_bytes( + Encoding.Raw, PublicFormat.Raw + ) + f_keypair = _FragList([raw_private_key, raw_public_key]) + + self.encode_public(public_key, f_priv) + f_priv.put_sshstr(f_keypair) + + +_KEY_FORMATS = { + _SSH_RSA: _SSHFormatRSA(), + _SSH_DSA: _SSHFormatDSA(), + _SSH_ED25519: _SSHFormatEd25519(), + _ECDSA_NISTP256: _SSHFormatECDSA(b"nistp256", ec.SECP256R1()), + _ECDSA_NISTP384: _SSHFormatECDSA(b"nistp384", ec.SECP384R1()), + _ECDSA_NISTP521: _SSHFormatECDSA(b"nistp521", ec.SECP521R1()), +} + + +def _lookup_kformat(key_type: bytes): + """Return valid format or throw error""" + if not isinstance(key_type, bytes): + key_type = memoryview(key_type).tobytes() + if key_type in _KEY_FORMATS: + return _KEY_FORMATS[key_type] + raise UnsupportedAlgorithm(f"Unsupported key type: {key_type!r}") + + +SSHPrivateKeyTypes = typing.Union[ + ec.EllipticCurvePrivateKey, + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ed25519.Ed25519PrivateKey, +] + + +def load_ssh_private_key( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, +) -> SSHPrivateKeyTypes: + """Load private key from OpenSSH custom encoding.""" + utils._check_byteslike("data", data) + if password is not None: + utils._check_bytes("password", password) + + m = _PEM_RC.search(data) + if not m: + raise ValueError("Not OpenSSH private key format") + p1 = m.start(1) + p2 = m.end(1) + data = binascii.a2b_base64(memoryview(data)[p1:p2]) + if not data.startswith(_SK_MAGIC): + raise ValueError("Not OpenSSH private key format") + data = memoryview(data)[len(_SK_MAGIC) :] + + # parse header + ciphername, data = _get_sshstr(data) + kdfname, data = _get_sshstr(data) + kdfoptions, data = _get_sshstr(data) + nkeys, data = _get_u32(data) + if nkeys != 1: + raise ValueError("Only one key supported") + + # load public key data + pubdata, data = _get_sshstr(data) + pub_key_type, pubdata = _get_sshstr(pubdata) + kformat = _lookup_kformat(pub_key_type) + pubfields, pubdata = kformat.get_public(pubdata) + _check_empty(pubdata) + + if (ciphername, kdfname) != (_NONE, _NONE): + ciphername_bytes = ciphername.tobytes() + if ciphername_bytes not in _SSH_CIPHERS: + raise UnsupportedAlgorithm( + f"Unsupported cipher: {ciphername_bytes!r}" + ) + if kdfname != _BCRYPT: + raise UnsupportedAlgorithm(f"Unsupported KDF: {kdfname!r}") + blklen = _SSH_CIPHERS[ciphername_bytes].block_len + tag_len = _SSH_CIPHERS[ciphername_bytes].tag_len + # load secret data + edata, data = _get_sshstr(data) + # see https://bugzilla.mindrot.org/show_bug.cgi?id=3553 for + # information about how OpenSSH handles AEAD tags + if _SSH_CIPHERS[ciphername_bytes].is_aead: + tag = bytes(data) + if len(tag) != tag_len: + raise ValueError("Corrupt data: invalid tag length for cipher") + else: + _check_empty(data) + _check_block_size(edata, blklen) + salt, kbuf = _get_sshstr(kdfoptions) + rounds, kbuf = _get_u32(kbuf) + _check_empty(kbuf) + ciph = _init_cipher(ciphername_bytes, password, salt.tobytes(), rounds) + dec = ciph.decryptor() + edata = memoryview(dec.update(edata)) + if _SSH_CIPHERS[ciphername_bytes].is_aead: + assert isinstance(dec, AEADDecryptionContext) + _check_empty(dec.finalize_with_tag(tag)) + else: + # _check_block_size requires data to be a full block so there + # should be no output from finalize + _check_empty(dec.finalize()) + else: + # load secret data + edata, data = _get_sshstr(data) + _check_empty(data) + blklen = 8 + _check_block_size(edata, blklen) + ck1, edata = _get_u32(edata) + ck2, edata = _get_u32(edata) + if ck1 != ck2: + raise ValueError("Corrupt data: broken checksum") + + # load per-key struct + key_type, edata = _get_sshstr(edata) + if key_type != pub_key_type: + raise ValueError("Corrupt data: key type mismatch") + private_key, edata = kformat.load_private(edata, pubfields) + comment, edata = _get_sshstr(edata) + + # yes, SSH does padding check *after* all other parsing is done. + # need to follow as it writes zero-byte padding too. + if edata != _PADDING[: len(edata)]: + raise ValueError("Corrupt data: invalid padding") + + if isinstance(private_key, dsa.DSAPrivateKey): + warnings.warn( + "SSH DSA keys are deprecated and will be removed in a future " + "release.", + utils.DeprecatedIn40, + stacklevel=2, + ) + + return private_key + + +def _serialize_ssh_private_key( + private_key: SSHPrivateKeyTypes, + password: bytes, + encryption_algorithm: KeySerializationEncryption, +) -> bytes: + """Serialize private key with OpenSSH custom encoding.""" + utils._check_bytes("password", password) + if isinstance(private_key, dsa.DSAPrivateKey): + warnings.warn( + "SSH DSA key support is deprecated and will be " + "removed in a future release", + utils.DeprecatedIn40, + stacklevel=4, + ) + + key_type = _get_ssh_key_type(private_key) + kformat = _lookup_kformat(key_type) + + # setup parameters + f_kdfoptions = _FragList() + if password: + ciphername = _DEFAULT_CIPHER + blklen = _SSH_CIPHERS[ciphername].block_len + kdfname = _BCRYPT + rounds = _DEFAULT_ROUNDS + if ( + isinstance(encryption_algorithm, _KeySerializationEncryption) + and encryption_algorithm._kdf_rounds is not None + ): + rounds = encryption_algorithm._kdf_rounds + salt = os.urandom(16) + f_kdfoptions.put_sshstr(salt) + f_kdfoptions.put_u32(rounds) + ciph = _init_cipher(ciphername, password, salt, rounds) + else: + ciphername = kdfname = _NONE + blklen = 8 + ciph = None + nkeys = 1 + checkval = os.urandom(4) + comment = b"" + + # encode public and private parts together + f_public_key = _FragList() + f_public_key.put_sshstr(key_type) + kformat.encode_public(private_key.public_key(), f_public_key) + + f_secrets = _FragList([checkval, checkval]) + f_secrets.put_sshstr(key_type) + kformat.encode_private(private_key, f_secrets) + f_secrets.put_sshstr(comment) + f_secrets.put_raw(_PADDING[: blklen - (f_secrets.size() % blklen)]) + + # top-level structure + f_main = _FragList() + f_main.put_raw(_SK_MAGIC) + f_main.put_sshstr(ciphername) + f_main.put_sshstr(kdfname) + f_main.put_sshstr(f_kdfoptions) + f_main.put_u32(nkeys) + f_main.put_sshstr(f_public_key) + f_main.put_sshstr(f_secrets) + + # copy result info bytearray + slen = f_secrets.size() + mlen = f_main.size() + buf = memoryview(bytearray(mlen + blklen)) + f_main.render(buf) + ofs = mlen - slen + + # encrypt in-place + if ciph is not None: + ciph.encryptor().update_into(buf[ofs:mlen], buf[ofs:]) + + return _ssh_pem_encode(buf[:mlen]) + + +SSHPublicKeyTypes = typing.Union[ + ec.EllipticCurvePublicKey, + rsa.RSAPublicKey, + dsa.DSAPublicKey, + ed25519.Ed25519PublicKey, +] + +SSHCertPublicKeyTypes = typing.Union[ + ec.EllipticCurvePublicKey, + rsa.RSAPublicKey, + ed25519.Ed25519PublicKey, +] + + +class SSHCertificateType(enum.Enum): + USER = 1 + HOST = 2 + + +class SSHCertificate: + def __init__( + self, + _nonce: memoryview, + _public_key: SSHPublicKeyTypes, + _serial: int, + _cctype: int, + _key_id: memoryview, + _valid_principals: typing.List[bytes], + _valid_after: int, + _valid_before: int, + _critical_options: typing.Dict[bytes, bytes], + _extensions: typing.Dict[bytes, bytes], + _sig_type: memoryview, + _sig_key: memoryview, + _inner_sig_type: memoryview, + _signature: memoryview, + _tbs_cert_body: memoryview, + _cert_key_type: bytes, + _cert_body: memoryview, + ): + self._nonce = _nonce + self._public_key = _public_key + self._serial = _serial + try: + self._type = SSHCertificateType(_cctype) + except ValueError: + raise ValueError("Invalid certificate type") + self._key_id = _key_id + self._valid_principals = _valid_principals + self._valid_after = _valid_after + self._valid_before = _valid_before + self._critical_options = _critical_options + self._extensions = _extensions + self._sig_type = _sig_type + self._sig_key = _sig_key + self._inner_sig_type = _inner_sig_type + self._signature = _signature + self._cert_key_type = _cert_key_type + self._cert_body = _cert_body + self._tbs_cert_body = _tbs_cert_body + + @property + def nonce(self) -> bytes: + return bytes(self._nonce) + + def public_key(self) -> SSHCertPublicKeyTypes: + # make mypy happy until we remove DSA support entirely and + # the underlying union won't have a disallowed type + return typing.cast(SSHCertPublicKeyTypes, self._public_key) + + @property + def serial(self) -> int: + return self._serial + + @property + def type(self) -> SSHCertificateType: + return self._type + + @property + def key_id(self) -> bytes: + return bytes(self._key_id) + + @property + def valid_principals(self) -> typing.List[bytes]: + return self._valid_principals + + @property + def valid_before(self) -> int: + return self._valid_before + + @property + def valid_after(self) -> int: + return self._valid_after + + @property + def critical_options(self) -> typing.Dict[bytes, bytes]: + return self._critical_options + + @property + def extensions(self) -> typing.Dict[bytes, bytes]: + return self._extensions + + def signature_key(self) -> SSHCertPublicKeyTypes: + sigformat = _lookup_kformat(self._sig_type) + signature_key, sigkey_rest = sigformat.load_public(self._sig_key) + _check_empty(sigkey_rest) + return signature_key + + def public_bytes(self) -> bytes: + return ( + bytes(self._cert_key_type) + + b" " + + binascii.b2a_base64(bytes(self._cert_body), newline=False) + ) + + def verify_cert_signature(self) -> None: + signature_key = self.signature_key() + if isinstance(signature_key, ed25519.Ed25519PublicKey): + signature_key.verify( + bytes(self._signature), bytes(self._tbs_cert_body) + ) + elif isinstance(signature_key, ec.EllipticCurvePublicKey): + # The signature is encoded as a pair of big-endian integers + r, data = _get_mpint(self._signature) + s, data = _get_mpint(data) + _check_empty(data) + computed_sig = asym_utils.encode_dss_signature(r, s) + hash_alg = _get_ec_hash_alg(signature_key.curve) + signature_key.verify( + computed_sig, bytes(self._tbs_cert_body), ec.ECDSA(hash_alg) + ) + else: + assert isinstance(signature_key, rsa.RSAPublicKey) + if self._inner_sig_type == _SSH_RSA: + hash_alg = hashes.SHA1() + elif self._inner_sig_type == _SSH_RSA_SHA256: + hash_alg = hashes.SHA256() + else: + assert self._inner_sig_type == _SSH_RSA_SHA512 + hash_alg = hashes.SHA512() + signature_key.verify( + bytes(self._signature), + bytes(self._tbs_cert_body), + padding.PKCS1v15(), + hash_alg, + ) + + +def _get_ec_hash_alg(curve: ec.EllipticCurve) -> hashes.HashAlgorithm: + if isinstance(curve, ec.SECP256R1): + return hashes.SHA256() + elif isinstance(curve, ec.SECP384R1): + return hashes.SHA384() + else: + assert isinstance(curve, ec.SECP521R1) + return hashes.SHA512() + + +def _load_ssh_public_identity( + data: bytes, + _legacy_dsa_allowed=False, +) -> typing.Union[SSHCertificate, SSHPublicKeyTypes]: + utils._check_byteslike("data", data) + + m = _SSH_PUBKEY_RC.match(data) + if not m: + raise ValueError("Invalid line format") + key_type = orig_key_type = m.group(1) + key_body = m.group(2) + with_cert = False + if key_type.endswith(_CERT_SUFFIX): + with_cert = True + key_type = key_type[: -len(_CERT_SUFFIX)] + if key_type == _SSH_DSA and not _legacy_dsa_allowed: + raise UnsupportedAlgorithm( + "DSA keys aren't supported in SSH certificates" + ) + kformat = _lookup_kformat(key_type) + + try: + rest = memoryview(binascii.a2b_base64(key_body)) + except (TypeError, binascii.Error): + raise ValueError("Invalid format") + + if with_cert: + cert_body = rest + inner_key_type, rest = _get_sshstr(rest) + if inner_key_type != orig_key_type: + raise ValueError("Invalid key format") + if with_cert: + nonce, rest = _get_sshstr(rest) + public_key, rest = kformat.load_public(rest) + if with_cert: + serial, rest = _get_u64(rest) + cctype, rest = _get_u32(rest) + key_id, rest = _get_sshstr(rest) + principals, rest = _get_sshstr(rest) + valid_principals = [] + while principals: + principal, principals = _get_sshstr(principals) + valid_principals.append(bytes(principal)) + valid_after, rest = _get_u64(rest) + valid_before, rest = _get_u64(rest) + crit_options, rest = _get_sshstr(rest) + critical_options = _parse_exts_opts(crit_options) + exts, rest = _get_sshstr(rest) + extensions = _parse_exts_opts(exts) + # Get the reserved field, which is unused. + _, rest = _get_sshstr(rest) + sig_key_raw, rest = _get_sshstr(rest) + sig_type, sig_key = _get_sshstr(sig_key_raw) + if sig_type == _SSH_DSA and not _legacy_dsa_allowed: + raise UnsupportedAlgorithm( + "DSA signatures aren't supported in SSH certificates" + ) + # Get the entire cert body and subtract the signature + tbs_cert_body = cert_body[: -len(rest)] + signature_raw, rest = _get_sshstr(rest) + _check_empty(rest) + inner_sig_type, sig_rest = _get_sshstr(signature_raw) + # RSA certs can have multiple algorithm types + if ( + sig_type == _SSH_RSA + and inner_sig_type + not in [_SSH_RSA_SHA256, _SSH_RSA_SHA512, _SSH_RSA] + ) or (sig_type != _SSH_RSA and inner_sig_type != sig_type): + raise ValueError("Signature key type does not match") + signature, sig_rest = _get_sshstr(sig_rest) + _check_empty(sig_rest) + return SSHCertificate( + nonce, + public_key, + serial, + cctype, + key_id, + valid_principals, + valid_after, + valid_before, + critical_options, + extensions, + sig_type, + sig_key, + inner_sig_type, + signature, + tbs_cert_body, + orig_key_type, + cert_body, + ) + else: + _check_empty(rest) + return public_key + + +def load_ssh_public_identity( + data: bytes, +) -> typing.Union[SSHCertificate, SSHPublicKeyTypes]: + return _load_ssh_public_identity(data) + + +def _parse_exts_opts(exts_opts: memoryview) -> typing.Dict[bytes, bytes]: + result: typing.Dict[bytes, bytes] = {} + last_name = None + while exts_opts: + name, exts_opts = _get_sshstr(exts_opts) + bname: bytes = bytes(name) + if bname in result: + raise ValueError("Duplicate name") + if last_name is not None and bname < last_name: + raise ValueError("Fields not lexically sorted") + value, exts_opts = _get_sshstr(exts_opts) + if len(value) > 0: + try: + value, extra = _get_sshstr(value) + except ValueError: + warnings.warn( + "This certificate has an incorrect encoding for critical " + "options or extensions. This will be an exception in " + "cryptography 42", + utils.DeprecatedIn41, + stacklevel=4, + ) + else: + if len(extra) > 0: + raise ValueError("Unexpected extra data after value") + result[bname] = bytes(value) + last_name = bname + return result + + +def load_ssh_public_key( + data: bytes, backend: typing.Any = None +) -> SSHPublicKeyTypes: + cert_or_key = _load_ssh_public_identity(data, _legacy_dsa_allowed=True) + public_key: SSHPublicKeyTypes + if isinstance(cert_or_key, SSHCertificate): + public_key = cert_or_key.public_key() + else: + public_key = cert_or_key + + if isinstance(public_key, dsa.DSAPublicKey): + warnings.warn( + "SSH DSA keys are deprecated and will be removed in a future " + "release.", + utils.DeprecatedIn40, + stacklevel=2, + ) + return public_key + + +def serialize_ssh_public_key(public_key: SSHPublicKeyTypes) -> bytes: + """One-line public key format for OpenSSH""" + if isinstance(public_key, dsa.DSAPublicKey): + warnings.warn( + "SSH DSA key support is deprecated and will be " + "removed in a future release", + utils.DeprecatedIn40, + stacklevel=4, + ) + key_type = _get_ssh_key_type(public_key) + kformat = _lookup_kformat(key_type) + + f_pub = _FragList() + f_pub.put_sshstr(key_type) + kformat.encode_public(public_key, f_pub) + + pub = binascii.b2a_base64(f_pub.tobytes()).strip() + return b"".join([key_type, b" ", pub]) + + +SSHCertPrivateKeyTypes = typing.Union[ + ec.EllipticCurvePrivateKey, + rsa.RSAPrivateKey, + ed25519.Ed25519PrivateKey, +] + + +# This is an undocumented limit enforced in the openssh codebase for sshd and +# ssh-keygen, but it is undefined in the ssh certificates spec. +_SSHKEY_CERT_MAX_PRINCIPALS = 256 + + +class SSHCertificateBuilder: + def __init__( + self, + _public_key: typing.Optional[SSHCertPublicKeyTypes] = None, + _serial: typing.Optional[int] = None, + _type: typing.Optional[SSHCertificateType] = None, + _key_id: typing.Optional[bytes] = None, + _valid_principals: typing.List[bytes] = [], + _valid_for_all_principals: bool = False, + _valid_before: typing.Optional[int] = None, + _valid_after: typing.Optional[int] = None, + _critical_options: typing.List[typing.Tuple[bytes, bytes]] = [], + _extensions: typing.List[typing.Tuple[bytes, bytes]] = [], + ): + self._public_key = _public_key + self._serial = _serial + self._type = _type + self._key_id = _key_id + self._valid_principals = _valid_principals + self._valid_for_all_principals = _valid_for_all_principals + self._valid_before = _valid_before + self._valid_after = _valid_after + self._critical_options = _critical_options + self._extensions = _extensions + + def public_key( + self, public_key: SSHCertPublicKeyTypes + ) -> SSHCertificateBuilder: + if not isinstance( + public_key, + ( + ec.EllipticCurvePublicKey, + rsa.RSAPublicKey, + ed25519.Ed25519PublicKey, + ), + ): + raise TypeError("Unsupported key type") + if self._public_key is not None: + raise ValueError("public_key already set") + + return SSHCertificateBuilder( + _public_key=public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def serial(self, serial: int) -> SSHCertificateBuilder: + if not isinstance(serial, int): + raise TypeError("serial must be an integer") + if not 0 <= serial < 2**64: + raise ValueError("serial must be between 0 and 2**64") + if self._serial is not None: + raise ValueError("serial already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def type(self, type: SSHCertificateType) -> SSHCertificateBuilder: + if not isinstance(type, SSHCertificateType): + raise TypeError("type must be an SSHCertificateType") + if self._type is not None: + raise ValueError("type already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def key_id(self, key_id: bytes) -> SSHCertificateBuilder: + if not isinstance(key_id, bytes): + raise TypeError("key_id must be bytes") + if self._key_id is not None: + raise ValueError("key_id already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_principals( + self, valid_principals: typing.List[bytes] + ) -> SSHCertificateBuilder: + if self._valid_for_all_principals: + raise ValueError( + "Principals can't be set because the cert is valid " + "for all principals" + ) + if ( + not all(isinstance(x, bytes) for x in valid_principals) + or not valid_principals + ): + raise TypeError( + "principals must be a list of bytes and can't be empty" + ) + if self._valid_principals: + raise ValueError("valid_principals already set") + + if len(valid_principals) > _SSHKEY_CERT_MAX_PRINCIPALS: + raise ValueError( + "Reached or exceeded the maximum number of valid_principals" + ) + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_for_all_principals(self): + if self._valid_principals: + raise ValueError( + "valid_principals already set, can't set " + "valid_for_all_principals" + ) + if self._valid_for_all_principals: + raise ValueError("valid_for_all_principals already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=True, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_before( + self, valid_before: typing.Union[int, float] + ) -> SSHCertificateBuilder: + if not isinstance(valid_before, (int, float)): + raise TypeError("valid_before must be an int or float") + valid_before = int(valid_before) + if valid_before < 0 or valid_before >= 2**64: + raise ValueError("valid_before must [0, 2**64)") + if self._valid_before is not None: + raise ValueError("valid_before already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_after( + self, valid_after: typing.Union[int, float] + ) -> SSHCertificateBuilder: + if not isinstance(valid_after, (int, float)): + raise TypeError("valid_after must be an int or float") + valid_after = int(valid_after) + if valid_after < 0 or valid_after >= 2**64: + raise ValueError("valid_after must [0, 2**64)") + if self._valid_after is not None: + raise ValueError("valid_after already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def add_critical_option( + self, name: bytes, value: bytes + ) -> SSHCertificateBuilder: + if not isinstance(name, bytes) or not isinstance(value, bytes): + raise TypeError("name and value must be bytes") + # This is O(n**2) + if name in [name for name, _ in self._critical_options]: + raise ValueError("Duplicate critical option name") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options + [(name, value)], + _extensions=self._extensions, + ) + + def add_extension( + self, name: bytes, value: bytes + ) -> SSHCertificateBuilder: + if not isinstance(name, bytes) or not isinstance(value, bytes): + raise TypeError("name and value must be bytes") + # This is O(n**2) + if name in [name for name, _ in self._extensions]: + raise ValueError("Duplicate extension name") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions + [(name, value)], + ) + + def sign(self, private_key: SSHCertPrivateKeyTypes) -> SSHCertificate: + if not isinstance( + private_key, + ( + ec.EllipticCurvePrivateKey, + rsa.RSAPrivateKey, + ed25519.Ed25519PrivateKey, + ), + ): + raise TypeError("Unsupported private key type") + + if self._public_key is None: + raise ValueError("public_key must be set") + + # Not required + serial = 0 if self._serial is None else self._serial + + if self._type is None: + raise ValueError("type must be set") + + # Not required + key_id = b"" if self._key_id is None else self._key_id + + # A zero length list is valid, but means the certificate + # is valid for any principal of the specified type. We require + # the user to explicitly set valid_for_all_principals to get + # that behavior. + if not self._valid_principals and not self._valid_for_all_principals: + raise ValueError( + "valid_principals must be set if valid_for_all_principals " + "is False" + ) + + if self._valid_before is None: + raise ValueError("valid_before must be set") + + if self._valid_after is None: + raise ValueError("valid_after must be set") + + if self._valid_after > self._valid_before: + raise ValueError("valid_after must be earlier than valid_before") + + # lexically sort our byte strings + self._critical_options.sort(key=lambda x: x[0]) + self._extensions.sort(key=lambda x: x[0]) + + key_type = _get_ssh_key_type(self._public_key) + cert_prefix = key_type + _CERT_SUFFIX + + # Marshal the bytes to be signed + nonce = os.urandom(32) + kformat = _lookup_kformat(key_type) + f = _FragList() + f.put_sshstr(cert_prefix) + f.put_sshstr(nonce) + kformat.encode_public(self._public_key, f) + f.put_u64(serial) + f.put_u32(self._type.value) + f.put_sshstr(key_id) + fprincipals = _FragList() + for p in self._valid_principals: + fprincipals.put_sshstr(p) + f.put_sshstr(fprincipals.tobytes()) + f.put_u64(self._valid_after) + f.put_u64(self._valid_before) + fcrit = _FragList() + for name, value in self._critical_options: + fcrit.put_sshstr(name) + if len(value) > 0: + foptval = _FragList() + foptval.put_sshstr(value) + fcrit.put_sshstr(foptval.tobytes()) + else: + fcrit.put_sshstr(value) + f.put_sshstr(fcrit.tobytes()) + fext = _FragList() + for name, value in self._extensions: + fext.put_sshstr(name) + if len(value) > 0: + fextval = _FragList() + fextval.put_sshstr(value) + fext.put_sshstr(fextval.tobytes()) + else: + fext.put_sshstr(value) + f.put_sshstr(fext.tobytes()) + f.put_sshstr(b"") # RESERVED FIELD + # encode CA public key + ca_type = _get_ssh_key_type(private_key) + caformat = _lookup_kformat(ca_type) + caf = _FragList() + caf.put_sshstr(ca_type) + caformat.encode_public(private_key.public_key(), caf) + f.put_sshstr(caf.tobytes()) + # Sigs according to the rules defined for the CA's public key + # (RFC4253 section 6.6 for ssh-rsa, RFC5656 for ECDSA, + # and RFC8032 for Ed25519). + if isinstance(private_key, ed25519.Ed25519PrivateKey): + signature = private_key.sign(f.tobytes()) + fsig = _FragList() + fsig.put_sshstr(ca_type) + fsig.put_sshstr(signature) + f.put_sshstr(fsig.tobytes()) + elif isinstance(private_key, ec.EllipticCurvePrivateKey): + hash_alg = _get_ec_hash_alg(private_key.curve) + signature = private_key.sign(f.tobytes(), ec.ECDSA(hash_alg)) + r, s = asym_utils.decode_dss_signature(signature) + fsig = _FragList() + fsig.put_sshstr(ca_type) + fsigblob = _FragList() + fsigblob.put_mpint(r) + fsigblob.put_mpint(s) + fsig.put_sshstr(fsigblob.tobytes()) + f.put_sshstr(fsig.tobytes()) + + else: + assert isinstance(private_key, rsa.RSAPrivateKey) + # Just like Golang, we're going to use SHA512 for RSA + # https://cs.opensource.google/go/x/crypto/+/refs/tags/ + # v0.4.0:ssh/certs.go;l=445 + # RFC 8332 defines SHA256 and 512 as options + fsig = _FragList() + fsig.put_sshstr(_SSH_RSA_SHA512) + signature = private_key.sign( + f.tobytes(), padding.PKCS1v15(), hashes.SHA512() + ) + fsig.put_sshstr(signature) + f.put_sshstr(fsig.tobytes()) + + cert_data = binascii.b2a_base64(f.tobytes()).strip() + # load_ssh_public_identity returns a union, but this is + # guaranteed to be an SSHCertificate, so we cast to make + # mypy happy. + return typing.cast( + SSHCertificate, + load_ssh_public_identity(b"".join([cert_prefix, b" ", cert_data])), + ) diff --git a/billinglayer/python/cryptography/hazmat/primitives/twofactor/__init__.py b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__init__.py new file mode 100644 index 0000000..c1af423 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__init__.py @@ -0,0 +1,9 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + + +class InvalidToken(Exception): + pass diff --git a/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..92a3399 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc new file mode 100644 index 0000000..65bbc66 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc new file mode 100644 index 0000000..f6204f2 Binary files /dev/null and b/billinglayer/python/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/hazmat/primitives/twofactor/hotp.py b/billinglayer/python/cryptography/hazmat/primitives/twofactor/hotp.py new file mode 100644 index 0000000..2067108 --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/twofactor/hotp.py @@ -0,0 +1,92 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import base64 +import typing +from urllib.parse import quote, urlencode + +from cryptography.hazmat.primitives import constant_time, hmac +from cryptography.hazmat.primitives.hashes import SHA1, SHA256, SHA512 +from cryptography.hazmat.primitives.twofactor import InvalidToken + +HOTPHashTypes = typing.Union[SHA1, SHA256, SHA512] + + +def _generate_uri( + hotp: HOTP, + type_name: str, + account_name: str, + issuer: typing.Optional[str], + extra_parameters: typing.List[typing.Tuple[str, int]], +) -> str: + parameters = [ + ("digits", hotp._length), + ("secret", base64.b32encode(hotp._key)), + ("algorithm", hotp._algorithm.name.upper()), + ] + + if issuer is not None: + parameters.append(("issuer", issuer)) + + parameters.extend(extra_parameters) + + label = ( + f"{quote(issuer)}:{quote(account_name)}" + if issuer + else quote(account_name) + ) + return f"otpauth://{type_name}/{label}?{urlencode(parameters)}" + + +class HOTP: + def __init__( + self, + key: bytes, + length: int, + algorithm: HOTPHashTypes, + backend: typing.Any = None, + enforce_key_length: bool = True, + ) -> None: + if len(key) < 16 and enforce_key_length is True: + raise ValueError("Key length has to be at least 128 bits.") + + if not isinstance(length, int): + raise TypeError("Length parameter must be an integer type.") + + if length < 6 or length > 8: + raise ValueError("Length of HOTP has to be between 6 and 8.") + + if not isinstance(algorithm, (SHA1, SHA256, SHA512)): + raise TypeError("Algorithm must be SHA1, SHA256 or SHA512.") + + self._key = key + self._length = length + self._algorithm = algorithm + + def generate(self, counter: int) -> bytes: + truncated_value = self._dynamic_truncate(counter) + hotp = truncated_value % (10**self._length) + return "{0:0{1}}".format(hotp, self._length).encode() + + def verify(self, hotp: bytes, counter: int) -> None: + if not constant_time.bytes_eq(self.generate(counter), hotp): + raise InvalidToken("Supplied HOTP value does not match.") + + def _dynamic_truncate(self, counter: int) -> int: + ctx = hmac.HMAC(self._key, self._algorithm) + ctx.update(counter.to_bytes(length=8, byteorder="big")) + hmac_value = ctx.finalize() + + offset = hmac_value[len(hmac_value) - 1] & 0b1111 + p = hmac_value[offset : offset + 4] + return int.from_bytes(p, byteorder="big") & 0x7FFFFFFF + + def get_provisioning_uri( + self, account_name: str, counter: int, issuer: typing.Optional[str] + ) -> str: + return _generate_uri( + self, "hotp", account_name, issuer, [("counter", int(counter))] + ) diff --git a/billinglayer/python/cryptography/hazmat/primitives/twofactor/totp.py b/billinglayer/python/cryptography/hazmat/primitives/twofactor/totp.py new file mode 100644 index 0000000..daddcea --- /dev/null +++ b/billinglayer/python/cryptography/hazmat/primitives/twofactor/totp.py @@ -0,0 +1,50 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives import constant_time +from cryptography.hazmat.primitives.twofactor import InvalidToken +from cryptography.hazmat.primitives.twofactor.hotp import ( + HOTP, + HOTPHashTypes, + _generate_uri, +) + + +class TOTP: + def __init__( + self, + key: bytes, + length: int, + algorithm: HOTPHashTypes, + time_step: int, + backend: typing.Any = None, + enforce_key_length: bool = True, + ): + self._time_step = time_step + self._hotp = HOTP( + key, length, algorithm, enforce_key_length=enforce_key_length + ) + + def generate(self, time: typing.Union[int, float]) -> bytes: + counter = int(time / self._time_step) + return self._hotp.generate(counter) + + def verify(self, totp: bytes, time: int) -> None: + if not constant_time.bytes_eq(self.generate(time), totp): + raise InvalidToken("Supplied TOTP value does not match.") + + def get_provisioning_uri( + self, account_name: str, issuer: typing.Optional[str] + ) -> str: + return _generate_uri( + self._hotp, + "totp", + account_name, + issuer, + [("period", int(self._time_step))], + ) diff --git a/billinglayer/python/cryptography/py.typed b/billinglayer/python/cryptography/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/cryptography/utils.py b/billinglayer/python/cryptography/utils.py new file mode 100644 index 0000000..7191681 --- /dev/null +++ b/billinglayer/python/cryptography/utils.py @@ -0,0 +1,130 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import enum +import sys +import types +import typing +import warnings + + +# We use a UserWarning subclass, instead of DeprecationWarning, because CPython +# decided deprecation warnings should be invisble by default. +class CryptographyDeprecationWarning(UserWarning): + pass + + +# Several APIs were deprecated with no specific end-of-life date because of the +# ubiquity of their use. They should not be removed until we agree on when that +# cycle ends. +DeprecatedIn36 = CryptographyDeprecationWarning +DeprecatedIn37 = CryptographyDeprecationWarning +DeprecatedIn40 = CryptographyDeprecationWarning +DeprecatedIn41 = CryptographyDeprecationWarning + + +def _check_bytes(name: str, value: bytes) -> None: + if not isinstance(value, bytes): + raise TypeError(f"{name} must be bytes") + + +def _check_byteslike(name: str, value: bytes) -> None: + try: + memoryview(value) + except TypeError: + raise TypeError(f"{name} must be bytes-like") + + +def int_to_bytes(integer: int, length: typing.Optional[int] = None) -> bytes: + return integer.to_bytes( + length or (integer.bit_length() + 7) // 8 or 1, "big" + ) + + +def _extract_buffer_length(obj: typing.Any) -> typing.Tuple[typing.Any, int]: + from cryptography.hazmat.bindings._rust import _openssl + + buf = _openssl.ffi.from_buffer(obj) + return buf, int(_openssl.ffi.cast("uintptr_t", buf)) + + +class InterfaceNotImplemented(Exception): + pass + + +class _DeprecatedValue: + def __init__(self, value: object, message: str, warning_class): + self.value = value + self.message = message + self.warning_class = warning_class + + +class _ModuleWithDeprecations(types.ModuleType): + def __init__(self, module: types.ModuleType): + super().__init__(module.__name__) + self.__dict__["_module"] = module + + def __getattr__(self, attr: str) -> object: + obj = getattr(self._module, attr) + if isinstance(obj, _DeprecatedValue): + warnings.warn(obj.message, obj.warning_class, stacklevel=2) + obj = obj.value + return obj + + def __setattr__(self, attr: str, value: object) -> None: + setattr(self._module, attr, value) + + def __delattr__(self, attr: str) -> None: + obj = getattr(self._module, attr) + if isinstance(obj, _DeprecatedValue): + warnings.warn(obj.message, obj.warning_class, stacklevel=2) + + delattr(self._module, attr) + + def __dir__(self) -> typing.Sequence[str]: + return ["_module"] + dir(self._module) + + +def deprecated( + value: object, + module_name: str, + message: str, + warning_class: typing.Type[Warning], + name: typing.Optional[str] = None, +) -> _DeprecatedValue: + module = sys.modules[module_name] + if not isinstance(module, _ModuleWithDeprecations): + sys.modules[module_name] = module = _ModuleWithDeprecations(module) + dv = _DeprecatedValue(value, message, warning_class) + # Maintain backwards compatibility with `name is None` for pyOpenSSL. + if name is not None: + setattr(module, name, dv) + return dv + + +def cached_property(func: typing.Callable) -> property: + cached_name = f"_cached_{func}" + sentinel = object() + + def inner(instance: object): + cache = getattr(instance, cached_name, sentinel) + if cache is not sentinel: + return cache + result = func(instance) + setattr(instance, cached_name, result) + return result + + return property(inner) + + +# Python 3.10 changed representation of enums. We use well-defined object +# representation and string representation from Python 3.9. +class Enum(enum.Enum): + def __repr__(self) -> str: + return f"<{self.__class__.__name__}.{self._name_}: {self._value_!r}>" + + def __str__(self) -> str: + return f"{self.__class__.__name__}.{self._name_}" diff --git a/billinglayer/python/cryptography/x509/__init__.py b/billinglayer/python/cryptography/x509/__init__.py new file mode 100644 index 0000000..d77694a --- /dev/null +++ b/billinglayer/python/cryptography/x509/__init__.py @@ -0,0 +1,255 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.x509 import certificate_transparency +from cryptography.x509.base import ( + Attribute, + AttributeNotFound, + Attributes, + Certificate, + CertificateBuilder, + CertificateRevocationList, + CertificateRevocationListBuilder, + CertificateSigningRequest, + CertificateSigningRequestBuilder, + InvalidVersion, + RevokedCertificate, + RevokedCertificateBuilder, + Version, + load_der_x509_certificate, + load_der_x509_crl, + load_der_x509_csr, + load_pem_x509_certificate, + load_pem_x509_certificates, + load_pem_x509_crl, + load_pem_x509_csr, + random_serial_number, +) +from cryptography.x509.extensions import ( + AccessDescription, + AuthorityInformationAccess, + AuthorityKeyIdentifier, + BasicConstraints, + CertificateIssuer, + CertificatePolicies, + CRLDistributionPoints, + CRLNumber, + CRLReason, + DeltaCRLIndicator, + DistributionPoint, + DuplicateExtension, + ExtendedKeyUsage, + Extension, + ExtensionNotFound, + Extensions, + ExtensionType, + FreshestCRL, + GeneralNames, + InhibitAnyPolicy, + InvalidityDate, + IssuerAlternativeName, + IssuingDistributionPoint, + KeyUsage, + MSCertificateTemplate, + NameConstraints, + NoticeReference, + OCSPAcceptableResponses, + OCSPNoCheck, + OCSPNonce, + PolicyConstraints, + PolicyInformation, + PrecertificateSignedCertificateTimestamps, + PrecertPoison, + ReasonFlags, + SignedCertificateTimestamps, + SubjectAlternativeName, + SubjectInformationAccess, + SubjectKeyIdentifier, + TLSFeature, + TLSFeatureType, + UnrecognizedExtension, + UserNotice, +) +from cryptography.x509.general_name import ( + DirectoryName, + DNSName, + GeneralName, + IPAddress, + OtherName, + RegisteredID, + RFC822Name, + UniformResourceIdentifier, + UnsupportedGeneralNameType, +) +from cryptography.x509.name import ( + Name, + NameAttribute, + RelativeDistinguishedName, +) +from cryptography.x509.oid import ( + AuthorityInformationAccessOID, + CertificatePoliciesOID, + CRLEntryExtensionOID, + ExtendedKeyUsageOID, + ExtensionOID, + NameOID, + ObjectIdentifier, + SignatureAlgorithmOID, +) + +OID_AUTHORITY_INFORMATION_ACCESS = ExtensionOID.AUTHORITY_INFORMATION_ACCESS +OID_AUTHORITY_KEY_IDENTIFIER = ExtensionOID.AUTHORITY_KEY_IDENTIFIER +OID_BASIC_CONSTRAINTS = ExtensionOID.BASIC_CONSTRAINTS +OID_CERTIFICATE_POLICIES = ExtensionOID.CERTIFICATE_POLICIES +OID_CRL_DISTRIBUTION_POINTS = ExtensionOID.CRL_DISTRIBUTION_POINTS +OID_EXTENDED_KEY_USAGE = ExtensionOID.EXTENDED_KEY_USAGE +OID_FRESHEST_CRL = ExtensionOID.FRESHEST_CRL +OID_INHIBIT_ANY_POLICY = ExtensionOID.INHIBIT_ANY_POLICY +OID_ISSUER_ALTERNATIVE_NAME = ExtensionOID.ISSUER_ALTERNATIVE_NAME +OID_KEY_USAGE = ExtensionOID.KEY_USAGE +OID_NAME_CONSTRAINTS = ExtensionOID.NAME_CONSTRAINTS +OID_OCSP_NO_CHECK = ExtensionOID.OCSP_NO_CHECK +OID_POLICY_CONSTRAINTS = ExtensionOID.POLICY_CONSTRAINTS +OID_POLICY_MAPPINGS = ExtensionOID.POLICY_MAPPINGS +OID_SUBJECT_ALTERNATIVE_NAME = ExtensionOID.SUBJECT_ALTERNATIVE_NAME +OID_SUBJECT_DIRECTORY_ATTRIBUTES = ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES +OID_SUBJECT_INFORMATION_ACCESS = ExtensionOID.SUBJECT_INFORMATION_ACCESS +OID_SUBJECT_KEY_IDENTIFIER = ExtensionOID.SUBJECT_KEY_IDENTIFIER + +OID_DSA_WITH_SHA1 = SignatureAlgorithmOID.DSA_WITH_SHA1 +OID_DSA_WITH_SHA224 = SignatureAlgorithmOID.DSA_WITH_SHA224 +OID_DSA_WITH_SHA256 = SignatureAlgorithmOID.DSA_WITH_SHA256 +OID_ECDSA_WITH_SHA1 = SignatureAlgorithmOID.ECDSA_WITH_SHA1 +OID_ECDSA_WITH_SHA224 = SignatureAlgorithmOID.ECDSA_WITH_SHA224 +OID_ECDSA_WITH_SHA256 = SignatureAlgorithmOID.ECDSA_WITH_SHA256 +OID_ECDSA_WITH_SHA384 = SignatureAlgorithmOID.ECDSA_WITH_SHA384 +OID_ECDSA_WITH_SHA512 = SignatureAlgorithmOID.ECDSA_WITH_SHA512 +OID_RSA_WITH_MD5 = SignatureAlgorithmOID.RSA_WITH_MD5 +OID_RSA_WITH_SHA1 = SignatureAlgorithmOID.RSA_WITH_SHA1 +OID_RSA_WITH_SHA224 = SignatureAlgorithmOID.RSA_WITH_SHA224 +OID_RSA_WITH_SHA256 = SignatureAlgorithmOID.RSA_WITH_SHA256 +OID_RSA_WITH_SHA384 = SignatureAlgorithmOID.RSA_WITH_SHA384 +OID_RSA_WITH_SHA512 = SignatureAlgorithmOID.RSA_WITH_SHA512 +OID_RSASSA_PSS = SignatureAlgorithmOID.RSASSA_PSS + +OID_COMMON_NAME = NameOID.COMMON_NAME +OID_COUNTRY_NAME = NameOID.COUNTRY_NAME +OID_DOMAIN_COMPONENT = NameOID.DOMAIN_COMPONENT +OID_DN_QUALIFIER = NameOID.DN_QUALIFIER +OID_EMAIL_ADDRESS = NameOID.EMAIL_ADDRESS +OID_GENERATION_QUALIFIER = NameOID.GENERATION_QUALIFIER +OID_GIVEN_NAME = NameOID.GIVEN_NAME +OID_LOCALITY_NAME = NameOID.LOCALITY_NAME +OID_ORGANIZATIONAL_UNIT_NAME = NameOID.ORGANIZATIONAL_UNIT_NAME +OID_ORGANIZATION_NAME = NameOID.ORGANIZATION_NAME +OID_PSEUDONYM = NameOID.PSEUDONYM +OID_SERIAL_NUMBER = NameOID.SERIAL_NUMBER +OID_STATE_OR_PROVINCE_NAME = NameOID.STATE_OR_PROVINCE_NAME +OID_SURNAME = NameOID.SURNAME +OID_TITLE = NameOID.TITLE + +OID_CLIENT_AUTH = ExtendedKeyUsageOID.CLIENT_AUTH +OID_CODE_SIGNING = ExtendedKeyUsageOID.CODE_SIGNING +OID_EMAIL_PROTECTION = ExtendedKeyUsageOID.EMAIL_PROTECTION +OID_OCSP_SIGNING = ExtendedKeyUsageOID.OCSP_SIGNING +OID_SERVER_AUTH = ExtendedKeyUsageOID.SERVER_AUTH +OID_TIME_STAMPING = ExtendedKeyUsageOID.TIME_STAMPING + +OID_ANY_POLICY = CertificatePoliciesOID.ANY_POLICY +OID_CPS_QUALIFIER = CertificatePoliciesOID.CPS_QUALIFIER +OID_CPS_USER_NOTICE = CertificatePoliciesOID.CPS_USER_NOTICE + +OID_CERTIFICATE_ISSUER = CRLEntryExtensionOID.CERTIFICATE_ISSUER +OID_CRL_REASON = CRLEntryExtensionOID.CRL_REASON +OID_INVALIDITY_DATE = CRLEntryExtensionOID.INVALIDITY_DATE + +OID_CA_ISSUERS = AuthorityInformationAccessOID.CA_ISSUERS +OID_OCSP = AuthorityInformationAccessOID.OCSP + +__all__ = [ + "certificate_transparency", + "load_pem_x509_certificate", + "load_pem_x509_certificates", + "load_der_x509_certificate", + "load_pem_x509_csr", + "load_der_x509_csr", + "load_pem_x509_crl", + "load_der_x509_crl", + "random_serial_number", + "Attribute", + "AttributeNotFound", + "Attributes", + "InvalidVersion", + "DeltaCRLIndicator", + "DuplicateExtension", + "ExtensionNotFound", + "UnsupportedGeneralNameType", + "NameAttribute", + "Name", + "RelativeDistinguishedName", + "ObjectIdentifier", + "ExtensionType", + "Extensions", + "Extension", + "ExtendedKeyUsage", + "FreshestCRL", + "IssuingDistributionPoint", + "TLSFeature", + "TLSFeatureType", + "OCSPAcceptableResponses", + "OCSPNoCheck", + "BasicConstraints", + "CRLNumber", + "KeyUsage", + "AuthorityInformationAccess", + "SubjectInformationAccess", + "AccessDescription", + "CertificatePolicies", + "PolicyInformation", + "UserNotice", + "NoticeReference", + "SubjectKeyIdentifier", + "NameConstraints", + "CRLDistributionPoints", + "DistributionPoint", + "ReasonFlags", + "InhibitAnyPolicy", + "SubjectAlternativeName", + "IssuerAlternativeName", + "AuthorityKeyIdentifier", + "GeneralNames", + "GeneralName", + "RFC822Name", + "DNSName", + "UniformResourceIdentifier", + "RegisteredID", + "DirectoryName", + "IPAddress", + "OtherName", + "Certificate", + "CertificateRevocationList", + "CertificateRevocationListBuilder", + "CertificateSigningRequest", + "RevokedCertificate", + "RevokedCertificateBuilder", + "CertificateSigningRequestBuilder", + "CertificateBuilder", + "Version", + "OID_CA_ISSUERS", + "OID_OCSP", + "CertificateIssuer", + "CRLReason", + "InvalidityDate", + "UnrecognizedExtension", + "PolicyConstraints", + "PrecertificateSignedCertificateTimestamps", + "PrecertPoison", + "OCSPNonce", + "SignedCertificateTimestamps", + "SignatureAlgorithmOID", + "NameOID", + "MSCertificateTemplate", +] diff --git a/billinglayer/python/cryptography/x509/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..c0d1de4 Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/__pycache__/base.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..69ca8ab Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/base.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc new file mode 100644 index 0000000..b1e8141 Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/__pycache__/extensions.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/extensions.cpython-311.pyc new file mode 100644 index 0000000..571e3b5 Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/extensions.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/__pycache__/general_name.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/general_name.cpython-311.pyc new file mode 100644 index 0000000..57d9f7e Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/general_name.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/__pycache__/name.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/name.cpython-311.pyc new file mode 100644 index 0000000..b75d69b Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/name.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/__pycache__/ocsp.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/ocsp.cpython-311.pyc new file mode 100644 index 0000000..6e81399 Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/ocsp.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/__pycache__/oid.cpython-311.pyc b/billinglayer/python/cryptography/x509/__pycache__/oid.cpython-311.pyc new file mode 100644 index 0000000..df28d31 Binary files /dev/null and b/billinglayer/python/cryptography/x509/__pycache__/oid.cpython-311.pyc differ diff --git a/billinglayer/python/cryptography/x509/base.py b/billinglayer/python/cryptography/x509/base.py new file mode 100644 index 0000000..576385e --- /dev/null +++ b/billinglayer/python/cryptography/x509/base.py @@ -0,0 +1,1173 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime +import os +import typing + +from cryptography import utils +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import ( + dsa, + ec, + ed448, + ed25519, + padding, + rsa, + x448, + x25519, +) +from cryptography.hazmat.primitives.asymmetric.types import ( + CertificateIssuerPrivateKeyTypes, + CertificateIssuerPublicKeyTypes, + CertificatePublicKeyTypes, +) +from cryptography.x509.extensions import ( + Extension, + Extensions, + ExtensionType, + _make_sequence_methods, +) +from cryptography.x509.name import Name, _ASN1Type +from cryptography.x509.oid import ObjectIdentifier + +_EARLIEST_UTC_TIME = datetime.datetime(1950, 1, 1) + +# This must be kept in sync with sign.rs's list of allowable types in +# identify_hash_type +_AllowedHashTypes = typing.Union[ + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + hashes.SHA3_224, + hashes.SHA3_256, + hashes.SHA3_384, + hashes.SHA3_512, +] + + +class AttributeNotFound(Exception): + def __init__(self, msg: str, oid: ObjectIdentifier) -> None: + super().__init__(msg) + self.oid = oid + + +def _reject_duplicate_extension( + extension: Extension[ExtensionType], + extensions: typing.List[Extension[ExtensionType]], +) -> None: + # This is quadratic in the number of extensions + for e in extensions: + if e.oid == extension.oid: + raise ValueError("This extension has already been set.") + + +def _reject_duplicate_attribute( + oid: ObjectIdentifier, + attributes: typing.List[ + typing.Tuple[ObjectIdentifier, bytes, typing.Optional[int]] + ], +) -> None: + # This is quadratic in the number of attributes + for attr_oid, _, _ in attributes: + if attr_oid == oid: + raise ValueError("This attribute has already been set.") + + +def _convert_to_naive_utc_time(time: datetime.datetime) -> datetime.datetime: + """Normalizes a datetime to a naive datetime in UTC. + + time -- datetime to normalize. Assumed to be in UTC if not timezone + aware. + """ + if time.tzinfo is not None: + offset = time.utcoffset() + offset = offset if offset else datetime.timedelta() + return time.replace(tzinfo=None) - offset + else: + return time + + +class Attribute: + def __init__( + self, + oid: ObjectIdentifier, + value: bytes, + _type: int = _ASN1Type.UTF8String.value, + ) -> None: + self._oid = oid + self._value = value + self._type = _type + + @property + def oid(self) -> ObjectIdentifier: + return self._oid + + @property + def value(self) -> bytes: + return self._value + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Attribute): + return NotImplemented + + return ( + self.oid == other.oid + and self.value == other.value + and self._type == other._type + ) + + def __hash__(self) -> int: + return hash((self.oid, self.value, self._type)) + + +class Attributes: + def __init__( + self, + attributes: typing.Iterable[Attribute], + ) -> None: + self._attributes = list(attributes) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_attributes") + + def __repr__(self) -> str: + return f"" + + def get_attribute_for_oid(self, oid: ObjectIdentifier) -> Attribute: + for attr in self: + if attr.oid == oid: + return attr + + raise AttributeNotFound(f"No {oid} attribute was found", oid) + + +class Version(utils.Enum): + v1 = 0 + v3 = 2 + + +class InvalidVersion(Exception): + def __init__(self, msg: str, parsed_version: int) -> None: + super().__init__(msg) + self.parsed_version = parsed_version + + +class Certificate(metaclass=abc.ABCMeta): + @abc.abstractmethod + def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes: + """ + Returns bytes using digest passed. + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + Returns certificate serial number + """ + + @property + @abc.abstractmethod + def version(self) -> Version: + """ + Returns the certificate version + """ + + @abc.abstractmethod + def public_key(self) -> CertificatePublicKeyTypes: + """ + Returns the public key + """ + + @property + @abc.abstractmethod + def not_valid_before(self) -> datetime.datetime: + """ + Not before time (represented as UTC datetime) + """ + + @property + @abc.abstractmethod + def not_valid_after(self) -> datetime.datetime: + """ + Not after time (represented as UTC datetime) + """ + + @property + @abc.abstractmethod + def issuer(self) -> Name: + """ + Returns the issuer name object. + """ + + @property + @abc.abstractmethod + def subject(self) -> Name: + """ + Returns the subject name object. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + in the certificate. + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> ObjectIdentifier: + """ + Returns the ObjectIdentifier of the signature algorithm. + """ + + @property + @abc.abstractmethod + def signature_algorithm_parameters( + self, + ) -> typing.Union[None, padding.PSS, padding.PKCS1v15, ec.ECDSA]: + """ + Returns the signature algorithm parameters. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns an Extensions object. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature bytes. + """ + + @property + @abc.abstractmethod + def tbs_certificate_bytes(self) -> bytes: + """ + Returns the tbsCertificate payload bytes as defined in RFC 5280. + """ + + @property + @abc.abstractmethod + def tbs_precertificate_bytes(self) -> bytes: + """ + Returns the tbsCertificate payload bytes with the SCT list extension + stripped. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + @abc.abstractmethod + def __hash__(self) -> int: + """ + Computes a hash. + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the certificate to PEM or DER format. + """ + + @abc.abstractmethod + def verify_directly_issued_by(self, issuer: Certificate) -> None: + """ + This method verifies that certificate issuer name matches the + issuer subject name and that the certificate is signed by the + issuer's private key. No other validation is performed. + """ + + +# Runtime isinstance checks need this since the rust class is not a subclass. +Certificate.register(rust_x509.Certificate) + + +class RevokedCertificate(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + Returns the serial number of the revoked certificate. + """ + + @property + @abc.abstractmethod + def revocation_date(self) -> datetime.datetime: + """ + Returns the date of when this certificate was revoked. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns an Extensions object containing a list of Revoked extensions. + """ + + +# Runtime isinstance checks need this since the rust class is not a subclass. +RevokedCertificate.register(rust_x509.RevokedCertificate) + + +class _RawRevokedCertificate(RevokedCertificate): + def __init__( + self, + serial_number: int, + revocation_date: datetime.datetime, + extensions: Extensions, + ): + self._serial_number = serial_number + self._revocation_date = revocation_date + self._extensions = extensions + + @property + def serial_number(self) -> int: + return self._serial_number + + @property + def revocation_date(self) -> datetime.datetime: + return self._revocation_date + + @property + def extensions(self) -> Extensions: + return self._extensions + + +class CertificateRevocationList(metaclass=abc.ABCMeta): + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the CRL to PEM or DER format. + """ + + @abc.abstractmethod + def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes: + """ + Returns bytes using digest passed. + """ + + @abc.abstractmethod + def get_revoked_certificate_by_serial_number( + self, serial_number: int + ) -> typing.Optional[RevokedCertificate]: + """ + Returns an instance of RevokedCertificate or None if the serial_number + is not in the CRL. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + in the certificate. + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> ObjectIdentifier: + """ + Returns the ObjectIdentifier of the signature algorithm. + """ + + @property + @abc.abstractmethod + def issuer(self) -> Name: + """ + Returns the X509Name with the issuer of this CRL. + """ + + @property + @abc.abstractmethod + def next_update(self) -> typing.Optional[datetime.datetime]: + """ + Returns the date of next update for this CRL. + """ + + @property + @abc.abstractmethod + def last_update(self) -> datetime.datetime: + """ + Returns the date of last update for this CRL. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns an Extensions object containing a list of CRL extensions. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature bytes. + """ + + @property + @abc.abstractmethod + def tbs_certlist_bytes(self) -> bytes: + """ + Returns the tbsCertList payload bytes as defined in RFC 5280. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + @abc.abstractmethod + def __len__(self) -> int: + """ + Number of revoked certificates in the CRL. + """ + + @typing.overload + def __getitem__(self, idx: int) -> RevokedCertificate: + ... + + @typing.overload + def __getitem__(self, idx: slice) -> typing.List[RevokedCertificate]: + ... + + @abc.abstractmethod + def __getitem__( + self, idx: typing.Union[int, slice] + ) -> typing.Union[RevokedCertificate, typing.List[RevokedCertificate]]: + """ + Returns a revoked certificate (or slice of revoked certificates). + """ + + @abc.abstractmethod + def __iter__(self) -> typing.Iterator[RevokedCertificate]: + """ + Iterator over the revoked certificates + """ + + @abc.abstractmethod + def is_signature_valid( + self, public_key: CertificateIssuerPublicKeyTypes + ) -> bool: + """ + Verifies signature of revocation list against given public key. + """ + + +CertificateRevocationList.register(rust_x509.CertificateRevocationList) + + +class CertificateSigningRequest(metaclass=abc.ABCMeta): + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + @abc.abstractmethod + def __hash__(self) -> int: + """ + Computes a hash. + """ + + @abc.abstractmethod + def public_key(self) -> CertificatePublicKeyTypes: + """ + Returns the public key + """ + + @property + @abc.abstractmethod + def subject(self) -> Name: + """ + Returns the subject name object. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + in the certificate. + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> ObjectIdentifier: + """ + Returns the ObjectIdentifier of the signature algorithm. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns the extensions in the signing request. + """ + + @property + @abc.abstractmethod + def attributes(self) -> Attributes: + """ + Returns an Attributes object. + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Encodes the request to PEM or DER format. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature bytes. + """ + + @property + @abc.abstractmethod + def tbs_certrequest_bytes(self) -> bytes: + """ + Returns the PKCS#10 CertificationRequestInfo bytes as defined in RFC + 2986. + """ + + @property + @abc.abstractmethod + def is_signature_valid(self) -> bool: + """ + Verifies signature of signing request. + """ + + @abc.abstractmethod + def get_attribute_for_oid(self, oid: ObjectIdentifier) -> bytes: + """ + Get the attribute value for a given OID. + """ + + +# Runtime isinstance checks need this since the rust class is not a subclass. +CertificateSigningRequest.register(rust_x509.CertificateSigningRequest) + + +# Backend argument preserved for API compatibility, but ignored. +def load_pem_x509_certificate( + data: bytes, backend: typing.Any = None +) -> Certificate: + return rust_x509.load_pem_x509_certificate(data) + + +def load_pem_x509_certificates(data: bytes) -> typing.List[Certificate]: + return rust_x509.load_pem_x509_certificates(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_der_x509_certificate( + data: bytes, backend: typing.Any = None +) -> Certificate: + return rust_x509.load_der_x509_certificate(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_pem_x509_csr( + data: bytes, backend: typing.Any = None +) -> CertificateSigningRequest: + return rust_x509.load_pem_x509_csr(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_der_x509_csr( + data: bytes, backend: typing.Any = None +) -> CertificateSigningRequest: + return rust_x509.load_der_x509_csr(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_pem_x509_crl( + data: bytes, backend: typing.Any = None +) -> CertificateRevocationList: + return rust_x509.load_pem_x509_crl(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_der_x509_crl( + data: bytes, backend: typing.Any = None +) -> CertificateRevocationList: + return rust_x509.load_der_x509_crl(data) + + +class CertificateSigningRequestBuilder: + def __init__( + self, + subject_name: typing.Optional[Name] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + attributes: typing.List[ + typing.Tuple[ObjectIdentifier, bytes, typing.Optional[int]] + ] = [], + ): + """ + Creates an empty X.509 certificate request (v1). + """ + self._subject_name = subject_name + self._extensions = extensions + self._attributes = attributes + + def subject_name(self, name: Name) -> CertificateSigningRequestBuilder: + """ + Sets the certificate requestor's distinguished name. + """ + if not isinstance(name, Name): + raise TypeError("Expecting x509.Name object.") + if self._subject_name is not None: + raise ValueError("The subject name may only be set once.") + return CertificateSigningRequestBuilder( + name, self._extensions, self._attributes + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> CertificateSigningRequestBuilder: + """ + Adds an X.509 extension to the certificate request. + """ + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return CertificateSigningRequestBuilder( + self._subject_name, + self._extensions + [extension], + self._attributes, + ) + + def add_attribute( + self, + oid: ObjectIdentifier, + value: bytes, + *, + _tag: typing.Optional[_ASN1Type] = None, + ) -> CertificateSigningRequestBuilder: + """ + Adds an X.509 attribute with an OID and associated value. + """ + if not isinstance(oid, ObjectIdentifier): + raise TypeError("oid must be an ObjectIdentifier") + + if not isinstance(value, bytes): + raise TypeError("value must be bytes") + + if _tag is not None and not isinstance(_tag, _ASN1Type): + raise TypeError("tag must be _ASN1Type") + + _reject_duplicate_attribute(oid, self._attributes) + + if _tag is not None: + tag = _tag.value + else: + tag = None + + return CertificateSigningRequestBuilder( + self._subject_name, + self._extensions, + self._attributes + [(oid, value, tag)], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[_AllowedHashTypes], + backend: typing.Any = None, + ) -> CertificateSigningRequest: + """ + Signs the request using the requestor's private key. + """ + if self._subject_name is None: + raise ValueError("A CertificateSigningRequest must have a subject") + return rust_x509.create_x509_csr(self, private_key, algorithm) + + +class CertificateBuilder: + _extensions: typing.List[Extension[ExtensionType]] + + def __init__( + self, + issuer_name: typing.Optional[Name] = None, + subject_name: typing.Optional[Name] = None, + public_key: typing.Optional[CertificatePublicKeyTypes] = None, + serial_number: typing.Optional[int] = None, + not_valid_before: typing.Optional[datetime.datetime] = None, + not_valid_after: typing.Optional[datetime.datetime] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + ) -> None: + self._version = Version.v3 + self._issuer_name = issuer_name + self._subject_name = subject_name + self._public_key = public_key + self._serial_number = serial_number + self._not_valid_before = not_valid_before + self._not_valid_after = not_valid_after + self._extensions = extensions + + def issuer_name(self, name: Name) -> CertificateBuilder: + """ + Sets the CA's distinguished name. + """ + if not isinstance(name, Name): + raise TypeError("Expecting x509.Name object.") + if self._issuer_name is not None: + raise ValueError("The issuer name may only be set once.") + return CertificateBuilder( + name, + self._subject_name, + self._public_key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def subject_name(self, name: Name) -> CertificateBuilder: + """ + Sets the requestor's distinguished name. + """ + if not isinstance(name, Name): + raise TypeError("Expecting x509.Name object.") + if self._subject_name is not None: + raise ValueError("The subject name may only be set once.") + return CertificateBuilder( + self._issuer_name, + name, + self._public_key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def public_key( + self, + key: CertificatePublicKeyTypes, + ) -> CertificateBuilder: + """ + Sets the requestor's public key (as found in the signing request). + """ + if not isinstance( + key, + ( + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, + x25519.X25519PublicKey, + x448.X448PublicKey, + ), + ): + raise TypeError( + "Expecting one of DSAPublicKey, RSAPublicKey," + " EllipticCurvePublicKey, Ed25519PublicKey," + " Ed448PublicKey, X25519PublicKey, or " + "X448PublicKey." + ) + if self._public_key is not None: + raise ValueError("The public key may only be set once.") + return CertificateBuilder( + self._issuer_name, + self._subject_name, + key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def serial_number(self, number: int) -> CertificateBuilder: + """ + Sets the certificate serial number. + """ + if not isinstance(number, int): + raise TypeError("Serial number must be of integral type.") + if self._serial_number is not None: + raise ValueError("The serial number may only be set once.") + if number <= 0: + raise ValueError("The serial number should be positive.") + + # ASN.1 integers are always signed, so most significant bit must be + # zero. + if number.bit_length() >= 160: # As defined in RFC 5280 + raise ValueError( + "The serial number should not be more than 159 " "bits." + ) + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def not_valid_before(self, time: datetime.datetime) -> CertificateBuilder: + """ + Sets the certificate activation time. + """ + if not isinstance(time, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._not_valid_before is not None: + raise ValueError("The not valid before may only be set once.") + time = _convert_to_naive_utc_time(time) + if time < _EARLIEST_UTC_TIME: + raise ValueError( + "The not valid before date must be on or after" + " 1950 January 1)." + ) + if self._not_valid_after is not None and time > self._not_valid_after: + raise ValueError( + "The not valid before date must be before the not valid after " + "date." + ) + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + self._serial_number, + time, + self._not_valid_after, + self._extensions, + ) + + def not_valid_after(self, time: datetime.datetime) -> CertificateBuilder: + """ + Sets the certificate expiration time. + """ + if not isinstance(time, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._not_valid_after is not None: + raise ValueError("The not valid after may only be set once.") + time = _convert_to_naive_utc_time(time) + if time < _EARLIEST_UTC_TIME: + raise ValueError( + "The not valid after date must be on or after" + " 1950 January 1." + ) + if ( + self._not_valid_before is not None + and time < self._not_valid_before + ): + raise ValueError( + "The not valid after date must be after the not valid before " + "date." + ) + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + self._serial_number, + self._not_valid_before, + time, + self._extensions, + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> CertificateBuilder: + """ + Adds an X.509 extension to the certificate. + """ + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions + [extension], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[_AllowedHashTypes], + backend: typing.Any = None, + *, + rsa_padding: typing.Optional[ + typing.Union[padding.PSS, padding.PKCS1v15] + ] = None, + ) -> Certificate: + """ + Signs the certificate using the CA's private key. + """ + if self._subject_name is None: + raise ValueError("A certificate must have a subject name") + + if self._issuer_name is None: + raise ValueError("A certificate must have an issuer name") + + if self._serial_number is None: + raise ValueError("A certificate must have a serial number") + + if self._not_valid_before is None: + raise ValueError("A certificate must have a not valid before time") + + if self._not_valid_after is None: + raise ValueError("A certificate must have a not valid after time") + + if self._public_key is None: + raise ValueError("A certificate must have a public key") + + if rsa_padding is not None: + if not isinstance(rsa_padding, (padding.PSS, padding.PKCS1v15)): + raise TypeError("Padding must be PSS or PKCS1v15") + if not isinstance(private_key, rsa.RSAPrivateKey): + raise TypeError("Padding is only supported for RSA keys") + + return rust_x509.create_x509_certificate( + self, private_key, algorithm, rsa_padding + ) + + +class CertificateRevocationListBuilder: + _extensions: typing.List[Extension[ExtensionType]] + _revoked_certificates: typing.List[RevokedCertificate] + + def __init__( + self, + issuer_name: typing.Optional[Name] = None, + last_update: typing.Optional[datetime.datetime] = None, + next_update: typing.Optional[datetime.datetime] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + revoked_certificates: typing.List[RevokedCertificate] = [], + ): + self._issuer_name = issuer_name + self._last_update = last_update + self._next_update = next_update + self._extensions = extensions + self._revoked_certificates = revoked_certificates + + def issuer_name( + self, issuer_name: Name + ) -> CertificateRevocationListBuilder: + if not isinstance(issuer_name, Name): + raise TypeError("Expecting x509.Name object.") + if self._issuer_name is not None: + raise ValueError("The issuer name may only be set once.") + return CertificateRevocationListBuilder( + issuer_name, + self._last_update, + self._next_update, + self._extensions, + self._revoked_certificates, + ) + + def last_update( + self, last_update: datetime.datetime + ) -> CertificateRevocationListBuilder: + if not isinstance(last_update, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._last_update is not None: + raise ValueError("Last update may only be set once.") + last_update = _convert_to_naive_utc_time(last_update) + if last_update < _EARLIEST_UTC_TIME: + raise ValueError( + "The last update date must be on or after" " 1950 January 1." + ) + if self._next_update is not None and last_update > self._next_update: + raise ValueError( + "The last update date must be before the next update date." + ) + return CertificateRevocationListBuilder( + self._issuer_name, + last_update, + self._next_update, + self._extensions, + self._revoked_certificates, + ) + + def next_update( + self, next_update: datetime.datetime + ) -> CertificateRevocationListBuilder: + if not isinstance(next_update, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._next_update is not None: + raise ValueError("Last update may only be set once.") + next_update = _convert_to_naive_utc_time(next_update) + if next_update < _EARLIEST_UTC_TIME: + raise ValueError( + "The last update date must be on or after" " 1950 January 1." + ) + if self._last_update is not None and next_update < self._last_update: + raise ValueError( + "The next update date must be after the last update date." + ) + return CertificateRevocationListBuilder( + self._issuer_name, + self._last_update, + next_update, + self._extensions, + self._revoked_certificates, + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> CertificateRevocationListBuilder: + """ + Adds an X.509 extension to the certificate revocation list. + """ + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + return CertificateRevocationListBuilder( + self._issuer_name, + self._last_update, + self._next_update, + self._extensions + [extension], + self._revoked_certificates, + ) + + def add_revoked_certificate( + self, revoked_certificate: RevokedCertificate + ) -> CertificateRevocationListBuilder: + """ + Adds a revoked certificate to the CRL. + """ + if not isinstance(revoked_certificate, RevokedCertificate): + raise TypeError("Must be an instance of RevokedCertificate") + + return CertificateRevocationListBuilder( + self._issuer_name, + self._last_update, + self._next_update, + self._extensions, + self._revoked_certificates + [revoked_certificate], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[_AllowedHashTypes], + backend: typing.Any = None, + ) -> CertificateRevocationList: + if self._issuer_name is None: + raise ValueError("A CRL must have an issuer name") + + if self._last_update is None: + raise ValueError("A CRL must have a last update time") + + if self._next_update is None: + raise ValueError("A CRL must have a next update time") + + return rust_x509.create_x509_crl(self, private_key, algorithm) + + +class RevokedCertificateBuilder: + def __init__( + self, + serial_number: typing.Optional[int] = None, + revocation_date: typing.Optional[datetime.datetime] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + ): + self._serial_number = serial_number + self._revocation_date = revocation_date + self._extensions = extensions + + def serial_number(self, number: int) -> RevokedCertificateBuilder: + if not isinstance(number, int): + raise TypeError("Serial number must be of integral type.") + if self._serial_number is not None: + raise ValueError("The serial number may only be set once.") + if number <= 0: + raise ValueError("The serial number should be positive") + + # ASN.1 integers are always signed, so most significant bit must be + # zero. + if number.bit_length() >= 160: # As defined in RFC 5280 + raise ValueError( + "The serial number should not be more than 159 " "bits." + ) + return RevokedCertificateBuilder( + number, self._revocation_date, self._extensions + ) + + def revocation_date( + self, time: datetime.datetime + ) -> RevokedCertificateBuilder: + if not isinstance(time, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._revocation_date is not None: + raise ValueError("The revocation date may only be set once.") + time = _convert_to_naive_utc_time(time) + if time < _EARLIEST_UTC_TIME: + raise ValueError( + "The revocation date must be on or after" " 1950 January 1." + ) + return RevokedCertificateBuilder( + self._serial_number, time, self._extensions + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> RevokedCertificateBuilder: + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + return RevokedCertificateBuilder( + self._serial_number, + self._revocation_date, + self._extensions + [extension], + ) + + def build(self, backend: typing.Any = None) -> RevokedCertificate: + if self._serial_number is None: + raise ValueError("A revoked certificate must have a serial number") + if self._revocation_date is None: + raise ValueError( + "A revoked certificate must have a revocation date" + ) + return _RawRevokedCertificate( + self._serial_number, + self._revocation_date, + Extensions(self._extensions), + ) + + +def random_serial_number() -> int: + return int.from_bytes(os.urandom(20), "big") >> 1 diff --git a/billinglayer/python/cryptography/x509/certificate_transparency.py b/billinglayer/python/cryptography/x509/certificate_transparency.py new file mode 100644 index 0000000..73647ee --- /dev/null +++ b/billinglayer/python/cryptography/x509/certificate_transparency.py @@ -0,0 +1,97 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime + +from cryptography import utils +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.hazmat.primitives.hashes import HashAlgorithm + + +class LogEntryType(utils.Enum): + X509_CERTIFICATE = 0 + PRE_CERTIFICATE = 1 + + +class Version(utils.Enum): + v1 = 0 + + +class SignatureAlgorithm(utils.Enum): + """ + Signature algorithms that are valid for SCTs. + + These are exactly the same as SignatureAlgorithm in RFC 5246 (TLS 1.2). + + See: + """ + + ANONYMOUS = 0 + RSA = 1 + DSA = 2 + ECDSA = 3 + + +class SignedCertificateTimestamp(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def version(self) -> Version: + """ + Returns the SCT version. + """ + + @property + @abc.abstractmethod + def log_id(self) -> bytes: + """ + Returns an identifier indicating which log this SCT is for. + """ + + @property + @abc.abstractmethod + def timestamp(self) -> datetime.datetime: + """ + Returns the timestamp for this SCT. + """ + + @property + @abc.abstractmethod + def entry_type(self) -> LogEntryType: + """ + Returns whether this is an SCT for a certificate or pre-certificate. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm(self) -> HashAlgorithm: + """ + Returns the hash algorithm used for the SCT's signature. + """ + + @property + @abc.abstractmethod + def signature_algorithm(self) -> SignatureAlgorithm: + """ + Returns the signing algorithm used for the SCT's signature. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature for this SCT. + """ + + @property + @abc.abstractmethod + def extension_bytes(self) -> bytes: + """ + Returns the raw bytes of any extensions for this SCT. + """ + + +SignedCertificateTimestamp.register(rust_x509.Sct) diff --git a/billinglayer/python/cryptography/x509/extensions.py b/billinglayer/python/cryptography/x509/extensions.py new file mode 100644 index 0000000..ac99592 --- /dev/null +++ b/billinglayer/python/cryptography/x509/extensions.py @@ -0,0 +1,2215 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime +import hashlib +import ipaddress +import typing + +from cryptography import utils +from cryptography.hazmat.bindings._rust import asn1 +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.hazmat.primitives import constant_time, serialization +from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePublicKey +from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey +from cryptography.hazmat.primitives.asymmetric.types import ( + CertificateIssuerPublicKeyTypes, + CertificatePublicKeyTypes, +) +from cryptography.x509.certificate_transparency import ( + SignedCertificateTimestamp, +) +from cryptography.x509.general_name import ( + DirectoryName, + DNSName, + GeneralName, + IPAddress, + OtherName, + RegisteredID, + RFC822Name, + UniformResourceIdentifier, + _IPAddressTypes, +) +from cryptography.x509.name import Name, RelativeDistinguishedName +from cryptography.x509.oid import ( + CRLEntryExtensionOID, + ExtensionOID, + ObjectIdentifier, + OCSPExtensionOID, +) + +ExtensionTypeVar = typing.TypeVar( + "ExtensionTypeVar", bound="ExtensionType", covariant=True +) + + +def _key_identifier_from_public_key( + public_key: CertificatePublicKeyTypes, +) -> bytes: + if isinstance(public_key, RSAPublicKey): + data = public_key.public_bytes( + serialization.Encoding.DER, + serialization.PublicFormat.PKCS1, + ) + elif isinstance(public_key, EllipticCurvePublicKey): + data = public_key.public_bytes( + serialization.Encoding.X962, + serialization.PublicFormat.UncompressedPoint, + ) + else: + # This is a very slow way to do this. + serialized = public_key.public_bytes( + serialization.Encoding.DER, + serialization.PublicFormat.SubjectPublicKeyInfo, + ) + data = asn1.parse_spki_for_data(serialized) + + return hashlib.sha1(data).digest() + + +def _make_sequence_methods(field_name: str): + def len_method(self) -> int: + return len(getattr(self, field_name)) + + def iter_method(self): + return iter(getattr(self, field_name)) + + def getitem_method(self, idx): + return getattr(self, field_name)[idx] + + return len_method, iter_method, getitem_method + + +class DuplicateExtension(Exception): + def __init__(self, msg: str, oid: ObjectIdentifier) -> None: + super().__init__(msg) + self.oid = oid + + +class ExtensionNotFound(Exception): + def __init__(self, msg: str, oid: ObjectIdentifier) -> None: + super().__init__(msg) + self.oid = oid + + +class ExtensionType(metaclass=abc.ABCMeta): + oid: typing.ClassVar[ObjectIdentifier] + + def public_bytes(self) -> bytes: + """ + Serializes the extension type to DER. + """ + raise NotImplementedError( + "public_bytes is not implemented for extension type {!r}".format( + self + ) + ) + + +class Extensions: + def __init__( + self, extensions: typing.Iterable[Extension[ExtensionType]] + ) -> None: + self._extensions = list(extensions) + + def get_extension_for_oid( + self, oid: ObjectIdentifier + ) -> Extension[ExtensionType]: + for ext in self: + if ext.oid == oid: + return ext + + raise ExtensionNotFound(f"No {oid} extension was found", oid) + + def get_extension_for_class( + self, extclass: typing.Type[ExtensionTypeVar] + ) -> Extension[ExtensionTypeVar]: + if extclass is UnrecognizedExtension: + raise TypeError( + "UnrecognizedExtension can't be used with " + "get_extension_for_class because more than one instance of the" + " class may be present." + ) + + for ext in self: + if isinstance(ext.value, extclass): + return ext + + raise ExtensionNotFound( + f"No {extclass} extension was found", extclass.oid + ) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_extensions") + + def __repr__(self) -> str: + return f"" + + +class CRLNumber(ExtensionType): + oid = ExtensionOID.CRL_NUMBER + + def __init__(self, crl_number: int) -> None: + if not isinstance(crl_number, int): + raise TypeError("crl_number must be an integer") + + self._crl_number = crl_number + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CRLNumber): + return NotImplemented + + return self.crl_number == other.crl_number + + def __hash__(self) -> int: + return hash(self.crl_number) + + def __repr__(self) -> str: + return f"" + + @property + def crl_number(self) -> int: + return self._crl_number + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class AuthorityKeyIdentifier(ExtensionType): + oid = ExtensionOID.AUTHORITY_KEY_IDENTIFIER + + def __init__( + self, + key_identifier: typing.Optional[bytes], + authority_cert_issuer: typing.Optional[typing.Iterable[GeneralName]], + authority_cert_serial_number: typing.Optional[int], + ) -> None: + if (authority_cert_issuer is None) != ( + authority_cert_serial_number is None + ): + raise ValueError( + "authority_cert_issuer and authority_cert_serial_number " + "must both be present or both None" + ) + + if authority_cert_issuer is not None: + authority_cert_issuer = list(authority_cert_issuer) + if not all( + isinstance(x, GeneralName) for x in authority_cert_issuer + ): + raise TypeError( + "authority_cert_issuer must be a list of GeneralName " + "objects" + ) + + if authority_cert_serial_number is not None and not isinstance( + authority_cert_serial_number, int + ): + raise TypeError("authority_cert_serial_number must be an integer") + + self._key_identifier = key_identifier + self._authority_cert_issuer = authority_cert_issuer + self._authority_cert_serial_number = authority_cert_serial_number + + # This takes a subset of CertificatePublicKeyTypes because an issuer + # cannot have an X25519/X448 key. This introduces some unfortunate + # asymmetry that requires typing users to explicitly + # narrow their type, but we should make this accurate and not just + # convenient. + @classmethod + def from_issuer_public_key( + cls, public_key: CertificateIssuerPublicKeyTypes + ) -> AuthorityKeyIdentifier: + digest = _key_identifier_from_public_key(public_key) + return cls( + key_identifier=digest, + authority_cert_issuer=None, + authority_cert_serial_number=None, + ) + + @classmethod + def from_issuer_subject_key_identifier( + cls, ski: SubjectKeyIdentifier + ) -> AuthorityKeyIdentifier: + return cls( + key_identifier=ski.digest, + authority_cert_issuer=None, + authority_cert_serial_number=None, + ) + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, AuthorityKeyIdentifier): + return NotImplemented + + return ( + self.key_identifier == other.key_identifier + and self.authority_cert_issuer == other.authority_cert_issuer + and self.authority_cert_serial_number + == other.authority_cert_serial_number + ) + + def __hash__(self) -> int: + if self.authority_cert_issuer is None: + aci = None + else: + aci = tuple(self.authority_cert_issuer) + return hash( + (self.key_identifier, aci, self.authority_cert_serial_number) + ) + + @property + def key_identifier(self) -> typing.Optional[bytes]: + return self._key_identifier + + @property + def authority_cert_issuer( + self, + ) -> typing.Optional[typing.List[GeneralName]]: + return self._authority_cert_issuer + + @property + def authority_cert_serial_number(self) -> typing.Optional[int]: + return self._authority_cert_serial_number + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class SubjectKeyIdentifier(ExtensionType): + oid = ExtensionOID.SUBJECT_KEY_IDENTIFIER + + def __init__(self, digest: bytes) -> None: + self._digest = digest + + @classmethod + def from_public_key( + cls, public_key: CertificatePublicKeyTypes + ) -> SubjectKeyIdentifier: + return cls(_key_identifier_from_public_key(public_key)) + + @property + def digest(self) -> bytes: + return self._digest + + @property + def key_identifier(self) -> bytes: + return self._digest + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SubjectKeyIdentifier): + return NotImplemented + + return constant_time.bytes_eq(self.digest, other.digest) + + def __hash__(self) -> int: + return hash(self.digest) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class AuthorityInformationAccess(ExtensionType): + oid = ExtensionOID.AUTHORITY_INFORMATION_ACCESS + + def __init__( + self, descriptions: typing.Iterable[AccessDescription] + ) -> None: + descriptions = list(descriptions) + if not all(isinstance(x, AccessDescription) for x in descriptions): + raise TypeError( + "Every item in the descriptions list must be an " + "AccessDescription" + ) + + self._descriptions = descriptions + + __len__, __iter__, __getitem__ = _make_sequence_methods("_descriptions") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, AuthorityInformationAccess): + return NotImplemented + + return self._descriptions == other._descriptions + + def __hash__(self) -> int: + return hash(tuple(self._descriptions)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class SubjectInformationAccess(ExtensionType): + oid = ExtensionOID.SUBJECT_INFORMATION_ACCESS + + def __init__( + self, descriptions: typing.Iterable[AccessDescription] + ) -> None: + descriptions = list(descriptions) + if not all(isinstance(x, AccessDescription) for x in descriptions): + raise TypeError( + "Every item in the descriptions list must be an " + "AccessDescription" + ) + + self._descriptions = descriptions + + __len__, __iter__, __getitem__ = _make_sequence_methods("_descriptions") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SubjectInformationAccess): + return NotImplemented + + return self._descriptions == other._descriptions + + def __hash__(self) -> int: + return hash(tuple(self._descriptions)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class AccessDescription: + def __init__( + self, access_method: ObjectIdentifier, access_location: GeneralName + ) -> None: + if not isinstance(access_method, ObjectIdentifier): + raise TypeError("access_method must be an ObjectIdentifier") + + if not isinstance(access_location, GeneralName): + raise TypeError("access_location must be a GeneralName") + + self._access_method = access_method + self._access_location = access_location + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, AccessDescription): + return NotImplemented + + return ( + self.access_method == other.access_method + and self.access_location == other.access_location + ) + + def __hash__(self) -> int: + return hash((self.access_method, self.access_location)) + + @property + def access_method(self) -> ObjectIdentifier: + return self._access_method + + @property + def access_location(self) -> GeneralName: + return self._access_location + + +class BasicConstraints(ExtensionType): + oid = ExtensionOID.BASIC_CONSTRAINTS + + def __init__(self, ca: bool, path_length: typing.Optional[int]) -> None: + if not isinstance(ca, bool): + raise TypeError("ca must be a boolean value") + + if path_length is not None and not ca: + raise ValueError("path_length must be None when ca is False") + + if path_length is not None and ( + not isinstance(path_length, int) or path_length < 0 + ): + raise TypeError( + "path_length must be a non-negative integer or None" + ) + + self._ca = ca + self._path_length = path_length + + @property + def ca(self) -> bool: + return self._ca + + @property + def path_length(self) -> typing.Optional[int]: + return self._path_length + + def __repr__(self) -> str: + return ( + "" + ).format(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, BasicConstraints): + return NotImplemented + + return self.ca == other.ca and self.path_length == other.path_length + + def __hash__(self) -> int: + return hash((self.ca, self.path_length)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class DeltaCRLIndicator(ExtensionType): + oid = ExtensionOID.DELTA_CRL_INDICATOR + + def __init__(self, crl_number: int) -> None: + if not isinstance(crl_number, int): + raise TypeError("crl_number must be an integer") + + self._crl_number = crl_number + + @property + def crl_number(self) -> int: + return self._crl_number + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DeltaCRLIndicator): + return NotImplemented + + return self.crl_number == other.crl_number + + def __hash__(self) -> int: + return hash(self.crl_number) + + def __repr__(self) -> str: + return f"" + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CRLDistributionPoints(ExtensionType): + oid = ExtensionOID.CRL_DISTRIBUTION_POINTS + + def __init__( + self, distribution_points: typing.Iterable[DistributionPoint] + ) -> None: + distribution_points = list(distribution_points) + if not all( + isinstance(x, DistributionPoint) for x in distribution_points + ): + raise TypeError( + "distribution_points must be a list of DistributionPoint " + "objects" + ) + + self._distribution_points = distribution_points + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_distribution_points" + ) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CRLDistributionPoints): + return NotImplemented + + return self._distribution_points == other._distribution_points + + def __hash__(self) -> int: + return hash(tuple(self._distribution_points)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class FreshestCRL(ExtensionType): + oid = ExtensionOID.FRESHEST_CRL + + def __init__( + self, distribution_points: typing.Iterable[DistributionPoint] + ) -> None: + distribution_points = list(distribution_points) + if not all( + isinstance(x, DistributionPoint) for x in distribution_points + ): + raise TypeError( + "distribution_points must be a list of DistributionPoint " + "objects" + ) + + self._distribution_points = distribution_points + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_distribution_points" + ) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, FreshestCRL): + return NotImplemented + + return self._distribution_points == other._distribution_points + + def __hash__(self) -> int: + return hash(tuple(self._distribution_points)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class DistributionPoint: + def __init__( + self, + full_name: typing.Optional[typing.Iterable[GeneralName]], + relative_name: typing.Optional[RelativeDistinguishedName], + reasons: typing.Optional[typing.FrozenSet[ReasonFlags]], + crl_issuer: typing.Optional[typing.Iterable[GeneralName]], + ) -> None: + if full_name and relative_name: + raise ValueError( + "You cannot provide both full_name and relative_name, at " + "least one must be None." + ) + if not full_name and not relative_name and not crl_issuer: + raise ValueError( + "Either full_name, relative_name or crl_issuer must be " + "provided." + ) + + if full_name is not None: + full_name = list(full_name) + if not all(isinstance(x, GeneralName) for x in full_name): + raise TypeError( + "full_name must be a list of GeneralName objects" + ) + + if relative_name: + if not isinstance(relative_name, RelativeDistinguishedName): + raise TypeError( + "relative_name must be a RelativeDistinguishedName" + ) + + if crl_issuer is not None: + crl_issuer = list(crl_issuer) + if not all(isinstance(x, GeneralName) for x in crl_issuer): + raise TypeError( + "crl_issuer must be None or a list of general names" + ) + + if reasons and ( + not isinstance(reasons, frozenset) + or not all(isinstance(x, ReasonFlags) for x in reasons) + ): + raise TypeError("reasons must be None or frozenset of ReasonFlags") + + if reasons and ( + ReasonFlags.unspecified in reasons + or ReasonFlags.remove_from_crl in reasons + ): + raise ValueError( + "unspecified and remove_from_crl are not valid reasons in a " + "DistributionPoint" + ) + + self._full_name = full_name + self._relative_name = relative_name + self._reasons = reasons + self._crl_issuer = crl_issuer + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DistributionPoint): + return NotImplemented + + return ( + self.full_name == other.full_name + and self.relative_name == other.relative_name + and self.reasons == other.reasons + and self.crl_issuer == other.crl_issuer + ) + + def __hash__(self) -> int: + if self.full_name is not None: + fn: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple( + self.full_name + ) + else: + fn = None + + if self.crl_issuer is not None: + crl_issuer: typing.Optional[ + typing.Tuple[GeneralName, ...] + ] = tuple(self.crl_issuer) + else: + crl_issuer = None + + return hash((fn, self.relative_name, self.reasons, crl_issuer)) + + @property + def full_name(self) -> typing.Optional[typing.List[GeneralName]]: + return self._full_name + + @property + def relative_name(self) -> typing.Optional[RelativeDistinguishedName]: + return self._relative_name + + @property + def reasons(self) -> typing.Optional[typing.FrozenSet[ReasonFlags]]: + return self._reasons + + @property + def crl_issuer(self) -> typing.Optional[typing.List[GeneralName]]: + return self._crl_issuer + + +class ReasonFlags(utils.Enum): + unspecified = "unspecified" + key_compromise = "keyCompromise" + ca_compromise = "cACompromise" + affiliation_changed = "affiliationChanged" + superseded = "superseded" + cessation_of_operation = "cessationOfOperation" + certificate_hold = "certificateHold" + privilege_withdrawn = "privilegeWithdrawn" + aa_compromise = "aACompromise" + remove_from_crl = "removeFromCRL" + + +# These are distribution point bit string mappings. Not to be confused with +# CRLReason reason flags bit string mappings. +# ReasonFlags ::= BIT STRING { +# unused (0), +# keyCompromise (1), +# cACompromise (2), +# affiliationChanged (3), +# superseded (4), +# cessationOfOperation (5), +# certificateHold (6), +# privilegeWithdrawn (7), +# aACompromise (8) } +_REASON_BIT_MAPPING = { + 1: ReasonFlags.key_compromise, + 2: ReasonFlags.ca_compromise, + 3: ReasonFlags.affiliation_changed, + 4: ReasonFlags.superseded, + 5: ReasonFlags.cessation_of_operation, + 6: ReasonFlags.certificate_hold, + 7: ReasonFlags.privilege_withdrawn, + 8: ReasonFlags.aa_compromise, +} + +_CRLREASONFLAGS = { + ReasonFlags.key_compromise: 1, + ReasonFlags.ca_compromise: 2, + ReasonFlags.affiliation_changed: 3, + ReasonFlags.superseded: 4, + ReasonFlags.cessation_of_operation: 5, + ReasonFlags.certificate_hold: 6, + ReasonFlags.privilege_withdrawn: 7, + ReasonFlags.aa_compromise: 8, +} + + +class PolicyConstraints(ExtensionType): + oid = ExtensionOID.POLICY_CONSTRAINTS + + def __init__( + self, + require_explicit_policy: typing.Optional[int], + inhibit_policy_mapping: typing.Optional[int], + ) -> None: + if require_explicit_policy is not None and not isinstance( + require_explicit_policy, int + ): + raise TypeError( + "require_explicit_policy must be a non-negative integer or " + "None" + ) + + if inhibit_policy_mapping is not None and not isinstance( + inhibit_policy_mapping, int + ): + raise TypeError( + "inhibit_policy_mapping must be a non-negative integer or None" + ) + + if inhibit_policy_mapping is None and require_explicit_policy is None: + raise ValueError( + "At least one of require_explicit_policy and " + "inhibit_policy_mapping must not be None" + ) + + self._require_explicit_policy = require_explicit_policy + self._inhibit_policy_mapping = inhibit_policy_mapping + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PolicyConstraints): + return NotImplemented + + return ( + self.require_explicit_policy == other.require_explicit_policy + and self.inhibit_policy_mapping == other.inhibit_policy_mapping + ) + + def __hash__(self) -> int: + return hash( + (self.require_explicit_policy, self.inhibit_policy_mapping) + ) + + @property + def require_explicit_policy(self) -> typing.Optional[int]: + return self._require_explicit_policy + + @property + def inhibit_policy_mapping(self) -> typing.Optional[int]: + return self._inhibit_policy_mapping + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CertificatePolicies(ExtensionType): + oid = ExtensionOID.CERTIFICATE_POLICIES + + def __init__(self, policies: typing.Iterable[PolicyInformation]) -> None: + policies = list(policies) + if not all(isinstance(x, PolicyInformation) for x in policies): + raise TypeError( + "Every item in the policies list must be a " + "PolicyInformation" + ) + + self._policies = policies + + __len__, __iter__, __getitem__ = _make_sequence_methods("_policies") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CertificatePolicies): + return NotImplemented + + return self._policies == other._policies + + def __hash__(self) -> int: + return hash(tuple(self._policies)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class PolicyInformation: + def __init__( + self, + policy_identifier: ObjectIdentifier, + policy_qualifiers: typing.Optional[ + typing.Iterable[typing.Union[str, UserNotice]] + ], + ) -> None: + if not isinstance(policy_identifier, ObjectIdentifier): + raise TypeError("policy_identifier must be an ObjectIdentifier") + + self._policy_identifier = policy_identifier + + if policy_qualifiers is not None: + policy_qualifiers = list(policy_qualifiers) + if not all( + isinstance(x, (str, UserNotice)) for x in policy_qualifiers + ): + raise TypeError( + "policy_qualifiers must be a list of strings and/or " + "UserNotice objects or None" + ) + + self._policy_qualifiers = policy_qualifiers + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PolicyInformation): + return NotImplemented + + return ( + self.policy_identifier == other.policy_identifier + and self.policy_qualifiers == other.policy_qualifiers + ) + + def __hash__(self) -> int: + if self.policy_qualifiers is not None: + pq: typing.Optional[ + typing.Tuple[typing.Union[str, UserNotice], ...] + ] = tuple(self.policy_qualifiers) + else: + pq = None + + return hash((self.policy_identifier, pq)) + + @property + def policy_identifier(self) -> ObjectIdentifier: + return self._policy_identifier + + @property + def policy_qualifiers( + self, + ) -> typing.Optional[typing.List[typing.Union[str, UserNotice]]]: + return self._policy_qualifiers + + +class UserNotice: + def __init__( + self, + notice_reference: typing.Optional[NoticeReference], + explicit_text: typing.Optional[str], + ) -> None: + if notice_reference and not isinstance( + notice_reference, NoticeReference + ): + raise TypeError( + "notice_reference must be None or a NoticeReference" + ) + + self._notice_reference = notice_reference + self._explicit_text = explicit_text + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, UserNotice): + return NotImplemented + + return ( + self.notice_reference == other.notice_reference + and self.explicit_text == other.explicit_text + ) + + def __hash__(self) -> int: + return hash((self.notice_reference, self.explicit_text)) + + @property + def notice_reference(self) -> typing.Optional[NoticeReference]: + return self._notice_reference + + @property + def explicit_text(self) -> typing.Optional[str]: + return self._explicit_text + + +class NoticeReference: + def __init__( + self, + organization: typing.Optional[str], + notice_numbers: typing.Iterable[int], + ) -> None: + self._organization = organization + notice_numbers = list(notice_numbers) + if not all(isinstance(x, int) for x in notice_numbers): + raise TypeError("notice_numbers must be a list of integers") + + self._notice_numbers = notice_numbers + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, NoticeReference): + return NotImplemented + + return ( + self.organization == other.organization + and self.notice_numbers == other.notice_numbers + ) + + def __hash__(self) -> int: + return hash((self.organization, tuple(self.notice_numbers))) + + @property + def organization(self) -> typing.Optional[str]: + return self._organization + + @property + def notice_numbers(self) -> typing.List[int]: + return self._notice_numbers + + +class ExtendedKeyUsage(ExtensionType): + oid = ExtensionOID.EXTENDED_KEY_USAGE + + def __init__(self, usages: typing.Iterable[ObjectIdentifier]) -> None: + usages = list(usages) + if not all(isinstance(x, ObjectIdentifier) for x in usages): + raise TypeError( + "Every item in the usages list must be an ObjectIdentifier" + ) + + self._usages = usages + + __len__, __iter__, __getitem__ = _make_sequence_methods("_usages") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, ExtendedKeyUsage): + return NotImplemented + + return self._usages == other._usages + + def __hash__(self) -> int: + return hash(tuple(self._usages)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class OCSPNoCheck(ExtensionType): + oid = ExtensionOID.OCSP_NO_CHECK + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OCSPNoCheck): + return NotImplemented + + return True + + def __hash__(self) -> int: + return hash(OCSPNoCheck) + + def __repr__(self) -> str: + return "" + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class PrecertPoison(ExtensionType): + oid = ExtensionOID.PRECERT_POISON + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PrecertPoison): + return NotImplemented + + return True + + def __hash__(self) -> int: + return hash(PrecertPoison) + + def __repr__(self) -> str: + return "" + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class TLSFeature(ExtensionType): + oid = ExtensionOID.TLS_FEATURE + + def __init__(self, features: typing.Iterable[TLSFeatureType]) -> None: + features = list(features) + if ( + not all(isinstance(x, TLSFeatureType) for x in features) + or len(features) == 0 + ): + raise TypeError( + "features must be a list of elements from the TLSFeatureType " + "enum" + ) + + self._features = features + + __len__, __iter__, __getitem__ = _make_sequence_methods("_features") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, TLSFeature): + return NotImplemented + + return self._features == other._features + + def __hash__(self) -> int: + return hash(tuple(self._features)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class TLSFeatureType(utils.Enum): + # status_request is defined in RFC 6066 and is used for what is commonly + # called OCSP Must-Staple when present in the TLS Feature extension in an + # X.509 certificate. + status_request = 5 + # status_request_v2 is defined in RFC 6961 and allows multiple OCSP + # responses to be provided. It is not currently in use by clients or + # servers. + status_request_v2 = 17 + + +_TLS_FEATURE_TYPE_TO_ENUM = {x.value: x for x in TLSFeatureType} + + +class InhibitAnyPolicy(ExtensionType): + oid = ExtensionOID.INHIBIT_ANY_POLICY + + def __init__(self, skip_certs: int) -> None: + if not isinstance(skip_certs, int): + raise TypeError("skip_certs must be an integer") + + if skip_certs < 0: + raise ValueError("skip_certs must be a non-negative integer") + + self._skip_certs = skip_certs + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, InhibitAnyPolicy): + return NotImplemented + + return self.skip_certs == other.skip_certs + + def __hash__(self) -> int: + return hash(self.skip_certs) + + @property + def skip_certs(self) -> int: + return self._skip_certs + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class KeyUsage(ExtensionType): + oid = ExtensionOID.KEY_USAGE + + def __init__( + self, + digital_signature: bool, + content_commitment: bool, + key_encipherment: bool, + data_encipherment: bool, + key_agreement: bool, + key_cert_sign: bool, + crl_sign: bool, + encipher_only: bool, + decipher_only: bool, + ) -> None: + if not key_agreement and (encipher_only or decipher_only): + raise ValueError( + "encipher_only and decipher_only can only be true when " + "key_agreement is true" + ) + + self._digital_signature = digital_signature + self._content_commitment = content_commitment + self._key_encipherment = key_encipherment + self._data_encipherment = data_encipherment + self._key_agreement = key_agreement + self._key_cert_sign = key_cert_sign + self._crl_sign = crl_sign + self._encipher_only = encipher_only + self._decipher_only = decipher_only + + @property + def digital_signature(self) -> bool: + return self._digital_signature + + @property + def content_commitment(self) -> bool: + return self._content_commitment + + @property + def key_encipherment(self) -> bool: + return self._key_encipherment + + @property + def data_encipherment(self) -> bool: + return self._data_encipherment + + @property + def key_agreement(self) -> bool: + return self._key_agreement + + @property + def key_cert_sign(self) -> bool: + return self._key_cert_sign + + @property + def crl_sign(self) -> bool: + return self._crl_sign + + @property + def encipher_only(self) -> bool: + if not self.key_agreement: + raise ValueError( + "encipher_only is undefined unless key_agreement is true" + ) + else: + return self._encipher_only + + @property + def decipher_only(self) -> bool: + if not self.key_agreement: + raise ValueError( + "decipher_only is undefined unless key_agreement is true" + ) + else: + return self._decipher_only + + def __repr__(self) -> str: + try: + encipher_only = self.encipher_only + decipher_only = self.decipher_only + except ValueError: + # Users found None confusing because even though encipher/decipher + # have no meaning unless key_agreement is true, to construct an + # instance of the class you still need to pass False. + encipher_only = False + decipher_only = False + + return ( + "" + ).format(self, encipher_only, decipher_only) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, KeyUsage): + return NotImplemented + + return ( + self.digital_signature == other.digital_signature + and self.content_commitment == other.content_commitment + and self.key_encipherment == other.key_encipherment + and self.data_encipherment == other.data_encipherment + and self.key_agreement == other.key_agreement + and self.key_cert_sign == other.key_cert_sign + and self.crl_sign == other.crl_sign + and self._encipher_only == other._encipher_only + and self._decipher_only == other._decipher_only + ) + + def __hash__(self) -> int: + return hash( + ( + self.digital_signature, + self.content_commitment, + self.key_encipherment, + self.data_encipherment, + self.key_agreement, + self.key_cert_sign, + self.crl_sign, + self._encipher_only, + self._decipher_only, + ) + ) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class NameConstraints(ExtensionType): + oid = ExtensionOID.NAME_CONSTRAINTS + + def __init__( + self, + permitted_subtrees: typing.Optional[typing.Iterable[GeneralName]], + excluded_subtrees: typing.Optional[typing.Iterable[GeneralName]], + ) -> None: + if permitted_subtrees is not None: + permitted_subtrees = list(permitted_subtrees) + if not permitted_subtrees: + raise ValueError( + "permitted_subtrees must be a non-empty list or None" + ) + if not all(isinstance(x, GeneralName) for x in permitted_subtrees): + raise TypeError( + "permitted_subtrees must be a list of GeneralName objects " + "or None" + ) + + self._validate_tree(permitted_subtrees) + + if excluded_subtrees is not None: + excluded_subtrees = list(excluded_subtrees) + if not excluded_subtrees: + raise ValueError( + "excluded_subtrees must be a non-empty list or None" + ) + if not all(isinstance(x, GeneralName) for x in excluded_subtrees): + raise TypeError( + "excluded_subtrees must be a list of GeneralName objects " + "or None" + ) + + self._validate_tree(excluded_subtrees) + + if permitted_subtrees is None and excluded_subtrees is None: + raise ValueError( + "At least one of permitted_subtrees and excluded_subtrees " + "must not be None" + ) + + self._permitted_subtrees = permitted_subtrees + self._excluded_subtrees = excluded_subtrees + + def __eq__(self, other: object) -> bool: + if not isinstance(other, NameConstraints): + return NotImplemented + + return ( + self.excluded_subtrees == other.excluded_subtrees + and self.permitted_subtrees == other.permitted_subtrees + ) + + def _validate_tree(self, tree: typing.Iterable[GeneralName]) -> None: + self._validate_ip_name(tree) + self._validate_dns_name(tree) + + def _validate_ip_name(self, tree: typing.Iterable[GeneralName]) -> None: + if any( + isinstance(name, IPAddress) + and not isinstance( + name.value, (ipaddress.IPv4Network, ipaddress.IPv6Network) + ) + for name in tree + ): + raise TypeError( + "IPAddress name constraints must be an IPv4Network or" + " IPv6Network object" + ) + + def _validate_dns_name(self, tree: typing.Iterable[GeneralName]) -> None: + if any( + isinstance(name, DNSName) and "*" in name.value for name in tree + ): + raise ValueError( + "DNSName name constraints must not contain the '*' wildcard" + " character" + ) + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __hash__(self) -> int: + if self.permitted_subtrees is not None: + ps: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple( + self.permitted_subtrees + ) + else: + ps = None + + if self.excluded_subtrees is not None: + es: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple( + self.excluded_subtrees + ) + else: + es = None + + return hash((ps, es)) + + @property + def permitted_subtrees( + self, + ) -> typing.Optional[typing.List[GeneralName]]: + return self._permitted_subtrees + + @property + def excluded_subtrees( + self, + ) -> typing.Optional[typing.List[GeneralName]]: + return self._excluded_subtrees + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class Extension(typing.Generic[ExtensionTypeVar]): + def __init__( + self, oid: ObjectIdentifier, critical: bool, value: ExtensionTypeVar + ) -> None: + if not isinstance(oid, ObjectIdentifier): + raise TypeError( + "oid argument must be an ObjectIdentifier instance." + ) + + if not isinstance(critical, bool): + raise TypeError("critical must be a boolean value") + + self._oid = oid + self._critical = critical + self._value = value + + @property + def oid(self) -> ObjectIdentifier: + return self._oid + + @property + def critical(self) -> bool: + return self._critical + + @property + def value(self) -> ExtensionTypeVar: + return self._value + + def __repr__(self) -> str: + return ( + "" + ).format(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Extension): + return NotImplemented + + return ( + self.oid == other.oid + and self.critical == other.critical + and self.value == other.value + ) + + def __hash__(self) -> int: + return hash((self.oid, self.critical, self.value)) + + +class GeneralNames: + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + general_names = list(general_names) + if not all(isinstance(x, GeneralName) for x in general_names): + raise TypeError( + "Every item in the general_names list must be an " + "object conforming to the GeneralName interface" + ) + + self._general_names = general_names + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + # Return the value of each GeneralName, except for OtherName instances + # which we return directly because it has two important properties not + # just one value. + objs = (i for i in self if isinstance(i, type)) + if type != OtherName: + return [i.value for i in objs] + return list(objs) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, GeneralNames): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(tuple(self._general_names)) + + +class SubjectAlternativeName(ExtensionType): + oid = ExtensionOID.SUBJECT_ALTERNATIVE_NAME + + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + self._general_names = GeneralNames(general_names) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + return self._general_names.get_values_for_type(type) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SubjectAlternativeName): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(self._general_names) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class IssuerAlternativeName(ExtensionType): + oid = ExtensionOID.ISSUER_ALTERNATIVE_NAME + + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + self._general_names = GeneralNames(general_names) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + return self._general_names.get_values_for_type(type) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, IssuerAlternativeName): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(self._general_names) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CertificateIssuer(ExtensionType): + oid = CRLEntryExtensionOID.CERTIFICATE_ISSUER + + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + self._general_names = GeneralNames(general_names) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + return self._general_names.get_values_for_type(type) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CertificateIssuer): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(self._general_names) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CRLReason(ExtensionType): + oid = CRLEntryExtensionOID.CRL_REASON + + def __init__(self, reason: ReasonFlags) -> None: + if not isinstance(reason, ReasonFlags): + raise TypeError("reason must be an element from ReasonFlags") + + self._reason = reason + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CRLReason): + return NotImplemented + + return self.reason == other.reason + + def __hash__(self) -> int: + return hash(self.reason) + + @property + def reason(self) -> ReasonFlags: + return self._reason + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class InvalidityDate(ExtensionType): + oid = CRLEntryExtensionOID.INVALIDITY_DATE + + def __init__(self, invalidity_date: datetime.datetime) -> None: + if not isinstance(invalidity_date, datetime.datetime): + raise TypeError("invalidity_date must be a datetime.datetime") + + self._invalidity_date = invalidity_date + + def __repr__(self) -> str: + return "".format( + self._invalidity_date + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, InvalidityDate): + return NotImplemented + + return self.invalidity_date == other.invalidity_date + + def __hash__(self) -> int: + return hash(self.invalidity_date) + + @property + def invalidity_date(self) -> datetime.datetime: + return self._invalidity_date + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class PrecertificateSignedCertificateTimestamps(ExtensionType): + oid = ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS + + def __init__( + self, + signed_certificate_timestamps: typing.Iterable[ + SignedCertificateTimestamp + ], + ) -> None: + signed_certificate_timestamps = list(signed_certificate_timestamps) + if not all( + isinstance(sct, SignedCertificateTimestamp) + for sct in signed_certificate_timestamps + ): + raise TypeError( + "Every item in the signed_certificate_timestamps list must be " + "a SignedCertificateTimestamp" + ) + self._signed_certificate_timestamps = signed_certificate_timestamps + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_signed_certificate_timestamps" + ) + + def __repr__(self) -> str: + return "".format( + list(self) + ) + + def __hash__(self) -> int: + return hash(tuple(self._signed_certificate_timestamps)) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PrecertificateSignedCertificateTimestamps): + return NotImplemented + + return ( + self._signed_certificate_timestamps + == other._signed_certificate_timestamps + ) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class SignedCertificateTimestamps(ExtensionType): + oid = ExtensionOID.SIGNED_CERTIFICATE_TIMESTAMPS + + def __init__( + self, + signed_certificate_timestamps: typing.Iterable[ + SignedCertificateTimestamp + ], + ) -> None: + signed_certificate_timestamps = list(signed_certificate_timestamps) + if not all( + isinstance(sct, SignedCertificateTimestamp) + for sct in signed_certificate_timestamps + ): + raise TypeError( + "Every item in the signed_certificate_timestamps list must be " + "a SignedCertificateTimestamp" + ) + self._signed_certificate_timestamps = signed_certificate_timestamps + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_signed_certificate_timestamps" + ) + + def __repr__(self) -> str: + return f"" + + def __hash__(self) -> int: + return hash(tuple(self._signed_certificate_timestamps)) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SignedCertificateTimestamps): + return NotImplemented + + return ( + self._signed_certificate_timestamps + == other._signed_certificate_timestamps + ) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class OCSPNonce(ExtensionType): + oid = OCSPExtensionOID.NONCE + + def __init__(self, nonce: bytes) -> None: + if not isinstance(nonce, bytes): + raise TypeError("nonce must be bytes") + + self._nonce = nonce + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OCSPNonce): + return NotImplemented + + return self.nonce == other.nonce + + def __hash__(self) -> int: + return hash(self.nonce) + + def __repr__(self) -> str: + return f"" + + @property + def nonce(self) -> bytes: + return self._nonce + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class OCSPAcceptableResponses(ExtensionType): + oid = OCSPExtensionOID.ACCEPTABLE_RESPONSES + + def __init__(self, responses: typing.Iterable[ObjectIdentifier]) -> None: + responses = list(responses) + if any(not isinstance(r, ObjectIdentifier) for r in responses): + raise TypeError("All responses must be ObjectIdentifiers") + + self._responses = responses + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OCSPAcceptableResponses): + return NotImplemented + + return self._responses == other._responses + + def __hash__(self) -> int: + return hash(tuple(self._responses)) + + def __repr__(self) -> str: + return f"" + + def __iter__(self) -> typing.Iterator[ObjectIdentifier]: + return iter(self._responses) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class IssuingDistributionPoint(ExtensionType): + oid = ExtensionOID.ISSUING_DISTRIBUTION_POINT + + def __init__( + self, + full_name: typing.Optional[typing.Iterable[GeneralName]], + relative_name: typing.Optional[RelativeDistinguishedName], + only_contains_user_certs: bool, + only_contains_ca_certs: bool, + only_some_reasons: typing.Optional[typing.FrozenSet[ReasonFlags]], + indirect_crl: bool, + only_contains_attribute_certs: bool, + ) -> None: + if full_name is not None: + full_name = list(full_name) + + if only_some_reasons and ( + not isinstance(only_some_reasons, frozenset) + or not all(isinstance(x, ReasonFlags) for x in only_some_reasons) + ): + raise TypeError( + "only_some_reasons must be None or frozenset of ReasonFlags" + ) + + if only_some_reasons and ( + ReasonFlags.unspecified in only_some_reasons + or ReasonFlags.remove_from_crl in only_some_reasons + ): + raise ValueError( + "unspecified and remove_from_crl are not valid reasons in an " + "IssuingDistributionPoint" + ) + + if not ( + isinstance(only_contains_user_certs, bool) + and isinstance(only_contains_ca_certs, bool) + and isinstance(indirect_crl, bool) + and isinstance(only_contains_attribute_certs, bool) + ): + raise TypeError( + "only_contains_user_certs, only_contains_ca_certs, " + "indirect_crl and only_contains_attribute_certs " + "must all be boolean." + ) + + crl_constraints = [ + only_contains_user_certs, + only_contains_ca_certs, + indirect_crl, + only_contains_attribute_certs, + ] + + if len([x for x in crl_constraints if x]) > 1: + raise ValueError( + "Only one of the following can be set to True: " + "only_contains_user_certs, only_contains_ca_certs, " + "indirect_crl, only_contains_attribute_certs" + ) + + if not any( + [ + only_contains_user_certs, + only_contains_ca_certs, + indirect_crl, + only_contains_attribute_certs, + full_name, + relative_name, + only_some_reasons, + ] + ): + raise ValueError( + "Cannot create empty extension: " + "if only_contains_user_certs, only_contains_ca_certs, " + "indirect_crl, and only_contains_attribute_certs are all False" + ", then either full_name, relative_name, or only_some_reasons " + "must have a value." + ) + + self._only_contains_user_certs = only_contains_user_certs + self._only_contains_ca_certs = only_contains_ca_certs + self._indirect_crl = indirect_crl + self._only_contains_attribute_certs = only_contains_attribute_certs + self._only_some_reasons = only_some_reasons + self._full_name = full_name + self._relative_name = relative_name + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, IssuingDistributionPoint): + return NotImplemented + + return ( + self.full_name == other.full_name + and self.relative_name == other.relative_name + and self.only_contains_user_certs == other.only_contains_user_certs + and self.only_contains_ca_certs == other.only_contains_ca_certs + and self.only_some_reasons == other.only_some_reasons + and self.indirect_crl == other.indirect_crl + and self.only_contains_attribute_certs + == other.only_contains_attribute_certs + ) + + def __hash__(self) -> int: + return hash( + ( + self.full_name, + self.relative_name, + self.only_contains_user_certs, + self.only_contains_ca_certs, + self.only_some_reasons, + self.indirect_crl, + self.only_contains_attribute_certs, + ) + ) + + @property + def full_name(self) -> typing.Optional[typing.List[GeneralName]]: + return self._full_name + + @property + def relative_name(self) -> typing.Optional[RelativeDistinguishedName]: + return self._relative_name + + @property + def only_contains_user_certs(self) -> bool: + return self._only_contains_user_certs + + @property + def only_contains_ca_certs(self) -> bool: + return self._only_contains_ca_certs + + @property + def only_some_reasons( + self, + ) -> typing.Optional[typing.FrozenSet[ReasonFlags]]: + return self._only_some_reasons + + @property + def indirect_crl(self) -> bool: + return self._indirect_crl + + @property + def only_contains_attribute_certs(self) -> bool: + return self._only_contains_attribute_certs + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class MSCertificateTemplate(ExtensionType): + oid = ExtensionOID.MS_CERTIFICATE_TEMPLATE + + def __init__( + self, + template_id: ObjectIdentifier, + major_version: typing.Optional[int], + minor_version: typing.Optional[int], + ) -> None: + if not isinstance(template_id, ObjectIdentifier): + raise TypeError("oid must be an ObjectIdentifier") + self._template_id = template_id + if ( + major_version is not None and not isinstance(major_version, int) + ) or ( + minor_version is not None and not isinstance(minor_version, int) + ): + raise TypeError( + "major_version and minor_version must be integers or None" + ) + self._major_version = major_version + self._minor_version = minor_version + + @property + def template_id(self) -> ObjectIdentifier: + return self._template_id + + @property + def major_version(self) -> typing.Optional[int]: + return self._major_version + + @property + def minor_version(self) -> typing.Optional[int]: + return self._minor_version + + def __repr__(self) -> str: + return ( + f"" + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, MSCertificateTemplate): + return NotImplemented + + return ( + self.template_id == other.template_id + and self.major_version == other.major_version + and self.minor_version == other.minor_version + ) + + def __hash__(self) -> int: + return hash((self.template_id, self.major_version, self.minor_version)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class UnrecognizedExtension(ExtensionType): + def __init__(self, oid: ObjectIdentifier, value: bytes) -> None: + if not isinstance(oid, ObjectIdentifier): + raise TypeError("oid must be an ObjectIdentifier") + self._oid = oid + self._value = value + + @property + def oid(self) -> ObjectIdentifier: # type: ignore[override] + return self._oid + + @property + def value(self) -> bytes: + return self._value + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, UnrecognizedExtension): + return NotImplemented + + return self.oid == other.oid and self.value == other.value + + def __hash__(self) -> int: + return hash((self.oid, self.value)) + + def public_bytes(self) -> bytes: + return self.value diff --git a/billinglayer/python/cryptography/x509/general_name.py b/billinglayer/python/cryptography/x509/general_name.py new file mode 100644 index 0000000..79271af --- /dev/null +++ b/billinglayer/python/cryptography/x509/general_name.py @@ -0,0 +1,283 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import ipaddress +import typing +from email.utils import parseaddr + +from cryptography.x509.name import Name +from cryptography.x509.oid import ObjectIdentifier + +_IPAddressTypes = typing.Union[ + ipaddress.IPv4Address, + ipaddress.IPv6Address, + ipaddress.IPv4Network, + ipaddress.IPv6Network, +] + + +class UnsupportedGeneralNameType(Exception): + pass + + +class GeneralName(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def value(self) -> typing.Any: + """ + Return the value of the object + """ + + +class RFC822Name(GeneralName): + def __init__(self, value: str) -> None: + if isinstance(value, str): + try: + value.encode("ascii") + except UnicodeEncodeError: + raise ValueError( + "RFC822Name values should be passed as an A-label string. " + "This means unicode characters should be encoded via " + "a library like idna." + ) + else: + raise TypeError("value must be string") + + name, address = parseaddr(value) + if name or not address: + # parseaddr has found a name (e.g. Name ) or the entire + # value is an empty string. + raise ValueError("Invalid rfc822name value") + + self._value = value + + @property + def value(self) -> str: + return self._value + + @classmethod + def _init_without_validation(cls, value: str) -> RFC822Name: + instance = cls.__new__(cls) + instance._value = value + return instance + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RFC822Name): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class DNSName(GeneralName): + def __init__(self, value: str) -> None: + if isinstance(value, str): + try: + value.encode("ascii") + except UnicodeEncodeError: + raise ValueError( + "DNSName values should be passed as an A-label string. " + "This means unicode characters should be encoded via " + "a library like idna." + ) + else: + raise TypeError("value must be string") + + self._value = value + + @property + def value(self) -> str: + return self._value + + @classmethod + def _init_without_validation(cls, value: str) -> DNSName: + instance = cls.__new__(cls) + instance._value = value + return instance + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DNSName): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class UniformResourceIdentifier(GeneralName): + def __init__(self, value: str) -> None: + if isinstance(value, str): + try: + value.encode("ascii") + except UnicodeEncodeError: + raise ValueError( + "URI values should be passed as an A-label string. " + "This means unicode characters should be encoded via " + "a library like idna." + ) + else: + raise TypeError("value must be string") + + self._value = value + + @property + def value(self) -> str: + return self._value + + @classmethod + def _init_without_validation(cls, value: str) -> UniformResourceIdentifier: + instance = cls.__new__(cls) + instance._value = value + return instance + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, UniformResourceIdentifier): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class DirectoryName(GeneralName): + def __init__(self, value: Name) -> None: + if not isinstance(value, Name): + raise TypeError("value must be a Name") + + self._value = value + + @property + def value(self) -> Name: + return self._value + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DirectoryName): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class RegisteredID(GeneralName): + def __init__(self, value: ObjectIdentifier) -> None: + if not isinstance(value, ObjectIdentifier): + raise TypeError("value must be an ObjectIdentifier") + + self._value = value + + @property + def value(self) -> ObjectIdentifier: + return self._value + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RegisteredID): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class IPAddress(GeneralName): + def __init__(self, value: _IPAddressTypes) -> None: + if not isinstance( + value, + ( + ipaddress.IPv4Address, + ipaddress.IPv6Address, + ipaddress.IPv4Network, + ipaddress.IPv6Network, + ), + ): + raise TypeError( + "value must be an instance of ipaddress.IPv4Address, " + "ipaddress.IPv6Address, ipaddress.IPv4Network, or " + "ipaddress.IPv6Network" + ) + + self._value = value + + @property + def value(self) -> _IPAddressTypes: + return self._value + + def _packed(self) -> bytes: + if isinstance( + self.value, (ipaddress.IPv4Address, ipaddress.IPv6Address) + ): + return self.value.packed + else: + return ( + self.value.network_address.packed + self.value.netmask.packed + ) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, IPAddress): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class OtherName(GeneralName): + def __init__(self, type_id: ObjectIdentifier, value: bytes) -> None: + if not isinstance(type_id, ObjectIdentifier): + raise TypeError("type_id must be an ObjectIdentifier") + if not isinstance(value, bytes): + raise TypeError("value must be a binary string") + + self._type_id = type_id + self._value = value + + @property + def type_id(self) -> ObjectIdentifier: + return self._type_id + + @property + def value(self) -> bytes: + return self._value + + def __repr__(self) -> str: + return "".format( + self.type_id, self.value + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OtherName): + return NotImplemented + + return self.type_id == other.type_id and self.value == other.value + + def __hash__(self) -> int: + return hash((self.type_id, self.value)) diff --git a/billinglayer/python/cryptography/x509/name.py b/billinglayer/python/cryptography/x509/name.py new file mode 100644 index 0000000..ff98e87 --- /dev/null +++ b/billinglayer/python/cryptography/x509/name.py @@ -0,0 +1,462 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import binascii +import re +import sys +import typing +import warnings + +from cryptography import utils +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.x509.oid import NameOID, ObjectIdentifier + + +class _ASN1Type(utils.Enum): + BitString = 3 + OctetString = 4 + UTF8String = 12 + NumericString = 18 + PrintableString = 19 + T61String = 20 + IA5String = 22 + UTCTime = 23 + GeneralizedTime = 24 + VisibleString = 26 + UniversalString = 28 + BMPString = 30 + + +_ASN1_TYPE_TO_ENUM = {i.value: i for i in _ASN1Type} +_NAMEOID_DEFAULT_TYPE: typing.Dict[ObjectIdentifier, _ASN1Type] = { + NameOID.COUNTRY_NAME: _ASN1Type.PrintableString, + NameOID.JURISDICTION_COUNTRY_NAME: _ASN1Type.PrintableString, + NameOID.SERIAL_NUMBER: _ASN1Type.PrintableString, + NameOID.DN_QUALIFIER: _ASN1Type.PrintableString, + NameOID.EMAIL_ADDRESS: _ASN1Type.IA5String, + NameOID.DOMAIN_COMPONENT: _ASN1Type.IA5String, +} + +# Type alias +_OidNameMap = typing.Mapping[ObjectIdentifier, str] +_NameOidMap = typing.Mapping[str, ObjectIdentifier] + +#: Short attribute names from RFC 4514: +#: https://tools.ietf.org/html/rfc4514#page-7 +_NAMEOID_TO_NAME: _OidNameMap = { + NameOID.COMMON_NAME: "CN", + NameOID.LOCALITY_NAME: "L", + NameOID.STATE_OR_PROVINCE_NAME: "ST", + NameOID.ORGANIZATION_NAME: "O", + NameOID.ORGANIZATIONAL_UNIT_NAME: "OU", + NameOID.COUNTRY_NAME: "C", + NameOID.STREET_ADDRESS: "STREET", + NameOID.DOMAIN_COMPONENT: "DC", + NameOID.USER_ID: "UID", +} +_NAME_TO_NAMEOID = {v: k for k, v in _NAMEOID_TO_NAME.items()} + + +def _escape_dn_value(val: typing.Union[str, bytes]) -> str: + """Escape special characters in RFC4514 Distinguished Name value.""" + + if not val: + return "" + + # RFC 4514 Section 2.4 defines the value as being the # (U+0023) character + # followed by the hexadecimal encoding of the octets. + if isinstance(val, bytes): + return "#" + binascii.hexlify(val).decode("utf8") + + # See https://tools.ietf.org/html/rfc4514#section-2.4 + val = val.replace("\\", "\\\\") + val = val.replace('"', '\\"') + val = val.replace("+", "\\+") + val = val.replace(",", "\\,") + val = val.replace(";", "\\;") + val = val.replace("<", "\\<") + val = val.replace(">", "\\>") + val = val.replace("\0", "\\00") + + if val[0] in ("#", " "): + val = "\\" + val + if val[-1] == " ": + val = val[:-1] + "\\ " + + return val + + +def _unescape_dn_value(val: str) -> str: + if not val: + return "" + + # See https://tools.ietf.org/html/rfc4514#section-3 + + # special = escaped / SPACE / SHARP / EQUALS + # escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE + def sub(m): + val = m.group(1) + # Regular escape + if len(val) == 1: + return val + # Hex-value scape + return chr(int(val, 16)) + + return _RFC4514NameParser._PAIR_RE.sub(sub, val) + + +class NameAttribute: + def __init__( + self, + oid: ObjectIdentifier, + value: typing.Union[str, bytes], + _type: typing.Optional[_ASN1Type] = None, + *, + _validate: bool = True, + ) -> None: + if not isinstance(oid, ObjectIdentifier): + raise TypeError( + "oid argument must be an ObjectIdentifier instance." + ) + if _type == _ASN1Type.BitString: + if oid != NameOID.X500_UNIQUE_IDENTIFIER: + raise TypeError( + "oid must be X500_UNIQUE_IDENTIFIER for BitString type." + ) + if not isinstance(value, bytes): + raise TypeError("value must be bytes for BitString") + else: + if not isinstance(value, str): + raise TypeError("value argument must be a str") + + if ( + oid == NameOID.COUNTRY_NAME + or oid == NameOID.JURISDICTION_COUNTRY_NAME + ): + assert isinstance(value, str) + c_len = len(value.encode("utf8")) + if c_len != 2 and _validate is True: + raise ValueError( + "Country name must be a 2 character country code" + ) + elif c_len != 2: + warnings.warn( + "Country names should be two characters, but the " + "attribute is {} characters in length.".format(c_len), + stacklevel=2, + ) + + # The appropriate ASN1 string type varies by OID and is defined across + # multiple RFCs including 2459, 3280, and 5280. In general UTF8String + # is preferred (2459), but 3280 and 5280 specify several OIDs with + # alternate types. This means when we see the sentinel value we need + # to look up whether the OID has a non-UTF8 type. If it does, set it + # to that. Otherwise, UTF8! + if _type is None: + _type = _NAMEOID_DEFAULT_TYPE.get(oid, _ASN1Type.UTF8String) + + if not isinstance(_type, _ASN1Type): + raise TypeError("_type must be from the _ASN1Type enum") + + self._oid = oid + self._value = value + self._type = _type + + @property + def oid(self) -> ObjectIdentifier: + return self._oid + + @property + def value(self) -> typing.Union[str, bytes]: + return self._value + + @property + def rfc4514_attribute_name(self) -> str: + """ + The short attribute name (for example "CN") if available, + otherwise the OID dotted string. + """ + return _NAMEOID_TO_NAME.get(self.oid, self.oid.dotted_string) + + def rfc4514_string( + self, attr_name_overrides: typing.Optional[_OidNameMap] = None + ) -> str: + """ + Format as RFC4514 Distinguished Name string. + + Use short attribute name if available, otherwise fall back to OID + dotted string. + """ + attr_name = ( + attr_name_overrides.get(self.oid) if attr_name_overrides else None + ) + if attr_name is None: + attr_name = self.rfc4514_attribute_name + + return f"{attr_name}={_escape_dn_value(self.value)}" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, NameAttribute): + return NotImplemented + + return self.oid == other.oid and self.value == other.value + + def __hash__(self) -> int: + return hash((self.oid, self.value)) + + def __repr__(self) -> str: + return "".format(self) + + +class RelativeDistinguishedName: + def __init__(self, attributes: typing.Iterable[NameAttribute]): + attributes = list(attributes) + if not attributes: + raise ValueError("a relative distinguished name cannot be empty") + if not all(isinstance(x, NameAttribute) for x in attributes): + raise TypeError("attributes must be an iterable of NameAttribute") + + # Keep list and frozenset to preserve attribute order where it matters + self._attributes = attributes + self._attribute_set = frozenset(attributes) + + if len(self._attribute_set) != len(attributes): + raise ValueError("duplicate attributes are not allowed") + + def get_attributes_for_oid( + self, oid: ObjectIdentifier + ) -> typing.List[NameAttribute]: + return [i for i in self if i.oid == oid] + + def rfc4514_string( + self, attr_name_overrides: typing.Optional[_OidNameMap] = None + ) -> str: + """ + Format as RFC4514 Distinguished Name string. + + Within each RDN, attributes are joined by '+', although that is rarely + used in certificates. + """ + return "+".join( + attr.rfc4514_string(attr_name_overrides) + for attr in self._attributes + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RelativeDistinguishedName): + return NotImplemented + + return self._attribute_set == other._attribute_set + + def __hash__(self) -> int: + return hash(self._attribute_set) + + def __iter__(self) -> typing.Iterator[NameAttribute]: + return iter(self._attributes) + + def __len__(self) -> int: + return len(self._attributes) + + def __repr__(self) -> str: + return f"" + + +class Name: + @typing.overload + def __init__(self, attributes: typing.Iterable[NameAttribute]) -> None: + ... + + @typing.overload + def __init__( + self, attributes: typing.Iterable[RelativeDistinguishedName] + ) -> None: + ... + + def __init__( + self, + attributes: typing.Iterable[ + typing.Union[NameAttribute, RelativeDistinguishedName] + ], + ) -> None: + attributes = list(attributes) + if all(isinstance(x, NameAttribute) for x in attributes): + self._attributes = [ + RelativeDistinguishedName([typing.cast(NameAttribute, x)]) + for x in attributes + ] + elif all(isinstance(x, RelativeDistinguishedName) for x in attributes): + self._attributes = typing.cast( + typing.List[RelativeDistinguishedName], attributes + ) + else: + raise TypeError( + "attributes must be a list of NameAttribute" + " or a list RelativeDistinguishedName" + ) + + @classmethod + def from_rfc4514_string( + cls, + data: str, + attr_name_overrides: typing.Optional[_NameOidMap] = None, + ) -> Name: + return _RFC4514NameParser(data, attr_name_overrides or {}).parse() + + def rfc4514_string( + self, attr_name_overrides: typing.Optional[_OidNameMap] = None + ) -> str: + """ + Format as RFC4514 Distinguished Name string. + For example 'CN=foobar.com,O=Foo Corp,C=US' + + An X.509 name is a two-level structure: a list of sets of attributes. + Each list element is separated by ',' and within each list element, set + elements are separated by '+'. The latter is almost never used in + real world certificates. According to RFC4514 section 2.1 the + RDNSequence must be reversed when converting to string representation. + """ + return ",".join( + attr.rfc4514_string(attr_name_overrides) + for attr in reversed(self._attributes) + ) + + def get_attributes_for_oid( + self, oid: ObjectIdentifier + ) -> typing.List[NameAttribute]: + return [i for i in self if i.oid == oid] + + @property + def rdns(self) -> typing.List[RelativeDistinguishedName]: + return self._attributes + + def public_bytes(self, backend: typing.Any = None) -> bytes: + return rust_x509.encode_name_bytes(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Name): + return NotImplemented + + return self._attributes == other._attributes + + def __hash__(self) -> int: + # TODO: this is relatively expensive, if this looks like a bottleneck + # for you, consider optimizing! + return hash(tuple(self._attributes)) + + def __iter__(self) -> typing.Iterator[NameAttribute]: + for rdn in self._attributes: + for ava in rdn: + yield ava + + def __len__(self) -> int: + return sum(len(rdn) for rdn in self._attributes) + + def __repr__(self) -> str: + rdns = ",".join(attr.rfc4514_string() for attr in self._attributes) + return f"" + + +class _RFC4514NameParser: + _OID_RE = re.compile(r"(0|([1-9]\d*))(\.(0|([1-9]\d*)))+") + _DESCR_RE = re.compile(r"[a-zA-Z][a-zA-Z\d-]*") + + _PAIR = r"\\([\\ #=\"\+,;<>]|[\da-zA-Z]{2})" + _PAIR_RE = re.compile(_PAIR) + _LUTF1 = r"[\x01-\x1f\x21\x24-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]" + _SUTF1 = r"[\x01-\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]" + _TUTF1 = r"[\x01-\x1F\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]" + _UTFMB = rf"[\x80-{chr(sys.maxunicode)}]" + _LEADCHAR = rf"{_LUTF1}|{_UTFMB}" + _STRINGCHAR = rf"{_SUTF1}|{_UTFMB}" + _TRAILCHAR = rf"{_TUTF1}|{_UTFMB}" + _STRING_RE = re.compile( + rf""" + ( + ({_LEADCHAR}|{_PAIR}) + ( + ({_STRINGCHAR}|{_PAIR})* + ({_TRAILCHAR}|{_PAIR}) + )? + )? + """, + re.VERBOSE, + ) + _HEXSTRING_RE = re.compile(r"#([\da-zA-Z]{2})+") + + def __init__(self, data: str, attr_name_overrides: _NameOidMap) -> None: + self._data = data + self._idx = 0 + + self._attr_name_overrides = attr_name_overrides + + def _has_data(self) -> bool: + return self._idx < len(self._data) + + def _peek(self) -> typing.Optional[str]: + if self._has_data(): + return self._data[self._idx] + return None + + def _read_char(self, ch: str) -> None: + if self._peek() != ch: + raise ValueError + self._idx += 1 + + def _read_re(self, pat) -> str: + match = pat.match(self._data, pos=self._idx) + if match is None: + raise ValueError + val = match.group() + self._idx += len(val) + return val + + def parse(self) -> Name: + """ + Parses the `data` string and converts it to a Name. + + According to RFC4514 section 2.1 the RDNSequence must be + reversed when converting to string representation. So, when + we parse it, we need to reverse again to get the RDNs on the + correct order. + """ + rdns = [self._parse_rdn()] + + while self._has_data(): + self._read_char(",") + rdns.append(self._parse_rdn()) + + return Name(reversed(rdns)) + + def _parse_rdn(self) -> RelativeDistinguishedName: + nas = [self._parse_na()] + while self._peek() == "+": + self._read_char("+") + nas.append(self._parse_na()) + + return RelativeDistinguishedName(nas) + + def _parse_na(self) -> NameAttribute: + try: + oid_value = self._read_re(self._OID_RE) + except ValueError: + name = self._read_re(self._DESCR_RE) + oid = self._attr_name_overrides.get( + name, _NAME_TO_NAMEOID.get(name) + ) + if oid is None: + raise ValueError + else: + oid = ObjectIdentifier(oid_value) + + self._read_char("=") + if self._peek() == "#": + value = self._read_re(self._HEXSTRING_RE) + value = binascii.unhexlify(value[1:]).decode() + else: + raw_value = self._read_re(self._STRING_RE) + value = _unescape_dn_value(raw_value) + + return NameAttribute(oid, value) diff --git a/billinglayer/python/cryptography/x509/ocsp.py b/billinglayer/python/cryptography/x509/ocsp.py new file mode 100644 index 0000000..7054795 --- /dev/null +++ b/billinglayer/python/cryptography/x509/ocsp.py @@ -0,0 +1,622 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime +import typing + +from cryptography import utils, x509 +from cryptography.hazmat.bindings._rust import ocsp +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric.types import ( + CertificateIssuerPrivateKeyTypes, +) +from cryptography.x509.base import ( + _EARLIEST_UTC_TIME, + _convert_to_naive_utc_time, + _reject_duplicate_extension, +) + + +class OCSPResponderEncoding(utils.Enum): + HASH = "By Hash" + NAME = "By Name" + + +class OCSPResponseStatus(utils.Enum): + SUCCESSFUL = 0 + MALFORMED_REQUEST = 1 + INTERNAL_ERROR = 2 + TRY_LATER = 3 + SIG_REQUIRED = 5 + UNAUTHORIZED = 6 + + +_ALLOWED_HASHES = ( + hashes.SHA1, + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, +) + + +def _verify_algorithm(algorithm: hashes.HashAlgorithm) -> None: + if not isinstance(algorithm, _ALLOWED_HASHES): + raise ValueError( + "Algorithm must be SHA1, SHA224, SHA256, SHA384, or SHA512" + ) + + +class OCSPCertStatus(utils.Enum): + GOOD = 0 + REVOKED = 1 + UNKNOWN = 2 + + +class _SingleResponse: + def __init__( + self, + cert: x509.Certificate, + issuer: x509.Certificate, + algorithm: hashes.HashAlgorithm, + cert_status: OCSPCertStatus, + this_update: datetime.datetime, + next_update: typing.Optional[datetime.datetime], + revocation_time: typing.Optional[datetime.datetime], + revocation_reason: typing.Optional[x509.ReasonFlags], + ): + if not isinstance(cert, x509.Certificate) or not isinstance( + issuer, x509.Certificate + ): + raise TypeError("cert and issuer must be a Certificate") + + _verify_algorithm(algorithm) + if not isinstance(this_update, datetime.datetime): + raise TypeError("this_update must be a datetime object") + if next_update is not None and not isinstance( + next_update, datetime.datetime + ): + raise TypeError("next_update must be a datetime object or None") + + self._cert = cert + self._issuer = issuer + self._algorithm = algorithm + self._this_update = this_update + self._next_update = next_update + + if not isinstance(cert_status, OCSPCertStatus): + raise TypeError( + "cert_status must be an item from the OCSPCertStatus enum" + ) + if cert_status is not OCSPCertStatus.REVOKED: + if revocation_time is not None: + raise ValueError( + "revocation_time can only be provided if the certificate " + "is revoked" + ) + if revocation_reason is not None: + raise ValueError( + "revocation_reason can only be provided if the certificate" + " is revoked" + ) + else: + if not isinstance(revocation_time, datetime.datetime): + raise TypeError("revocation_time must be a datetime object") + + revocation_time = _convert_to_naive_utc_time(revocation_time) + if revocation_time < _EARLIEST_UTC_TIME: + raise ValueError( + "The revocation_time must be on or after" + " 1950 January 1." + ) + + if revocation_reason is not None and not isinstance( + revocation_reason, x509.ReasonFlags + ): + raise TypeError( + "revocation_reason must be an item from the ReasonFlags " + "enum or None" + ) + + self._cert_status = cert_status + self._revocation_time = revocation_time + self._revocation_reason = revocation_reason + + +class OCSPRequest(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def issuer_key_hash(self) -> bytes: + """ + The hash of the issuer public key + """ + + @property + @abc.abstractmethod + def issuer_name_hash(self) -> bytes: + """ + The hash of the issuer name + """ + + @property + @abc.abstractmethod + def hash_algorithm(self) -> hashes.HashAlgorithm: + """ + The hash algorithm used in the issuer name and key hashes + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + The serial number of the cert whose status is being checked + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the request to DER + """ + + @property + @abc.abstractmethod + def extensions(self) -> x509.Extensions: + """ + The list of request extensions. Not single request extensions. + """ + + +class OCSPSingleResponse(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def certificate_status(self) -> OCSPCertStatus: + """ + The status of the certificate (an element from the OCSPCertStatus enum) + """ + + @property + @abc.abstractmethod + def revocation_time(self) -> typing.Optional[datetime.datetime]: + """ + The date of when the certificate was revoked or None if not + revoked. + """ + + @property + @abc.abstractmethod + def revocation_reason(self) -> typing.Optional[x509.ReasonFlags]: + """ + The reason the certificate was revoked or None if not specified or + not revoked. + """ + + @property + @abc.abstractmethod + def this_update(self) -> datetime.datetime: + """ + The most recent time at which the status being indicated is known by + the responder to have been correct + """ + + @property + @abc.abstractmethod + def next_update(self) -> typing.Optional[datetime.datetime]: + """ + The time when newer information will be available + """ + + @property + @abc.abstractmethod + def issuer_key_hash(self) -> bytes: + """ + The hash of the issuer public key + """ + + @property + @abc.abstractmethod + def issuer_name_hash(self) -> bytes: + """ + The hash of the issuer name + """ + + @property + @abc.abstractmethod + def hash_algorithm(self) -> hashes.HashAlgorithm: + """ + The hash algorithm used in the issuer name and key hashes + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + The serial number of the cert whose status is being checked + """ + + +class OCSPResponse(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def responses(self) -> typing.Iterator[OCSPSingleResponse]: + """ + An iterator over the individual SINGLERESP structures in the + response + """ + + @property + @abc.abstractmethod + def response_status(self) -> OCSPResponseStatus: + """ + The status of the response. This is a value from the OCSPResponseStatus + enumeration + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> x509.ObjectIdentifier: + """ + The ObjectIdentifier of the signature algorithm + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + The signature bytes + """ + + @property + @abc.abstractmethod + def tbs_response_bytes(self) -> bytes: + """ + The tbsResponseData bytes + """ + + @property + @abc.abstractmethod + def certificates(self) -> typing.List[x509.Certificate]: + """ + A list of certificates used to help build a chain to verify the OCSP + response. This situation occurs when the OCSP responder uses a delegate + certificate. + """ + + @property + @abc.abstractmethod + def responder_key_hash(self) -> typing.Optional[bytes]: + """ + The responder's key hash or None + """ + + @property + @abc.abstractmethod + def responder_name(self) -> typing.Optional[x509.Name]: + """ + The responder's Name or None + """ + + @property + @abc.abstractmethod + def produced_at(self) -> datetime.datetime: + """ + The time the response was produced + """ + + @property + @abc.abstractmethod + def certificate_status(self) -> OCSPCertStatus: + """ + The status of the certificate (an element from the OCSPCertStatus enum) + """ + + @property + @abc.abstractmethod + def revocation_time(self) -> typing.Optional[datetime.datetime]: + """ + The date of when the certificate was revoked or None if not + revoked. + """ + + @property + @abc.abstractmethod + def revocation_reason(self) -> typing.Optional[x509.ReasonFlags]: + """ + The reason the certificate was revoked or None if not specified or + not revoked. + """ + + @property + @abc.abstractmethod + def this_update(self) -> datetime.datetime: + """ + The most recent time at which the status being indicated is known by + the responder to have been correct + """ + + @property + @abc.abstractmethod + def next_update(self) -> typing.Optional[datetime.datetime]: + """ + The time when newer information will be available + """ + + @property + @abc.abstractmethod + def issuer_key_hash(self) -> bytes: + """ + The hash of the issuer public key + """ + + @property + @abc.abstractmethod + def issuer_name_hash(self) -> bytes: + """ + The hash of the issuer name + """ + + @property + @abc.abstractmethod + def hash_algorithm(self) -> hashes.HashAlgorithm: + """ + The hash algorithm used in the issuer name and key hashes + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + The serial number of the cert whose status is being checked + """ + + @property + @abc.abstractmethod + def extensions(self) -> x509.Extensions: + """ + The list of response extensions. Not single response extensions. + """ + + @property + @abc.abstractmethod + def single_extensions(self) -> x509.Extensions: + """ + The list of single response extensions. Not response extensions. + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the response to DER + """ + + +class OCSPRequestBuilder: + def __init__( + self, + request: typing.Optional[ + typing.Tuple[ + x509.Certificate, x509.Certificate, hashes.HashAlgorithm + ] + ] = None, + request_hash: typing.Optional[ + typing.Tuple[bytes, bytes, int, hashes.HashAlgorithm] + ] = None, + extensions: typing.List[x509.Extension[x509.ExtensionType]] = [], + ) -> None: + self._request = request + self._request_hash = request_hash + self._extensions = extensions + + def add_certificate( + self, + cert: x509.Certificate, + issuer: x509.Certificate, + algorithm: hashes.HashAlgorithm, + ) -> OCSPRequestBuilder: + if self._request is not None or self._request_hash is not None: + raise ValueError("Only one certificate can be added to a request") + + _verify_algorithm(algorithm) + if not isinstance(cert, x509.Certificate) or not isinstance( + issuer, x509.Certificate + ): + raise TypeError("cert and issuer must be a Certificate") + + return OCSPRequestBuilder( + (cert, issuer, algorithm), self._request_hash, self._extensions + ) + + def add_certificate_by_hash( + self, + issuer_name_hash: bytes, + issuer_key_hash: bytes, + serial_number: int, + algorithm: hashes.HashAlgorithm, + ) -> OCSPRequestBuilder: + if self._request is not None or self._request_hash is not None: + raise ValueError("Only one certificate can be added to a request") + + if not isinstance(serial_number, int): + raise TypeError("serial_number must be an integer") + + _verify_algorithm(algorithm) + utils._check_bytes("issuer_name_hash", issuer_name_hash) + utils._check_bytes("issuer_key_hash", issuer_key_hash) + if algorithm.digest_size != len( + issuer_name_hash + ) or algorithm.digest_size != len(issuer_key_hash): + raise ValueError( + "issuer_name_hash and issuer_key_hash must be the same length " + "as the digest size of the algorithm" + ) + + return OCSPRequestBuilder( + self._request, + (issuer_name_hash, issuer_key_hash, serial_number, algorithm), + self._extensions, + ) + + def add_extension( + self, extval: x509.ExtensionType, critical: bool + ) -> OCSPRequestBuilder: + if not isinstance(extval, x509.ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = x509.Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return OCSPRequestBuilder( + self._request, self._request_hash, self._extensions + [extension] + ) + + def build(self) -> OCSPRequest: + if self._request is None and self._request_hash is None: + raise ValueError("You must add a certificate before building") + + return ocsp.create_ocsp_request(self) + + +class OCSPResponseBuilder: + def __init__( + self, + response: typing.Optional[_SingleResponse] = None, + responder_id: typing.Optional[ + typing.Tuple[x509.Certificate, OCSPResponderEncoding] + ] = None, + certs: typing.Optional[typing.List[x509.Certificate]] = None, + extensions: typing.List[x509.Extension[x509.ExtensionType]] = [], + ): + self._response = response + self._responder_id = responder_id + self._certs = certs + self._extensions = extensions + + def add_response( + self, + cert: x509.Certificate, + issuer: x509.Certificate, + algorithm: hashes.HashAlgorithm, + cert_status: OCSPCertStatus, + this_update: datetime.datetime, + next_update: typing.Optional[datetime.datetime], + revocation_time: typing.Optional[datetime.datetime], + revocation_reason: typing.Optional[x509.ReasonFlags], + ) -> OCSPResponseBuilder: + if self._response is not None: + raise ValueError("Only one response per OCSPResponse.") + + singleresp = _SingleResponse( + cert, + issuer, + algorithm, + cert_status, + this_update, + next_update, + revocation_time, + revocation_reason, + ) + return OCSPResponseBuilder( + singleresp, + self._responder_id, + self._certs, + self._extensions, + ) + + def responder_id( + self, encoding: OCSPResponderEncoding, responder_cert: x509.Certificate + ) -> OCSPResponseBuilder: + if self._responder_id is not None: + raise ValueError("responder_id can only be set once") + if not isinstance(responder_cert, x509.Certificate): + raise TypeError("responder_cert must be a Certificate") + if not isinstance(encoding, OCSPResponderEncoding): + raise TypeError( + "encoding must be an element from OCSPResponderEncoding" + ) + + return OCSPResponseBuilder( + self._response, + (responder_cert, encoding), + self._certs, + self._extensions, + ) + + def certificates( + self, certs: typing.Iterable[x509.Certificate] + ) -> OCSPResponseBuilder: + if self._certs is not None: + raise ValueError("certificates may only be set once") + certs = list(certs) + if len(certs) == 0: + raise ValueError("certs must not be an empty list") + if not all(isinstance(x, x509.Certificate) for x in certs): + raise TypeError("certs must be a list of Certificates") + return OCSPResponseBuilder( + self._response, + self._responder_id, + certs, + self._extensions, + ) + + def add_extension( + self, extval: x509.ExtensionType, critical: bool + ) -> OCSPResponseBuilder: + if not isinstance(extval, x509.ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = x509.Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return OCSPResponseBuilder( + self._response, + self._responder_id, + self._certs, + self._extensions + [extension], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[hashes.HashAlgorithm], + ) -> OCSPResponse: + if self._response is None: + raise ValueError("You must add a response before signing") + if self._responder_id is None: + raise ValueError("You must add a responder_id before signing") + + return ocsp.create_ocsp_response( + OCSPResponseStatus.SUCCESSFUL, self, private_key, algorithm + ) + + @classmethod + def build_unsuccessful( + cls, response_status: OCSPResponseStatus + ) -> OCSPResponse: + if not isinstance(response_status, OCSPResponseStatus): + raise TypeError( + "response_status must be an item from OCSPResponseStatus" + ) + if response_status is OCSPResponseStatus.SUCCESSFUL: + raise ValueError("response_status cannot be SUCCESSFUL") + + return ocsp.create_ocsp_response(response_status, None, None, None) + + +def load_der_ocsp_request(data: bytes) -> OCSPRequest: + return ocsp.load_der_ocsp_request(data) + + +def load_der_ocsp_response(data: bytes) -> OCSPResponse: + return ocsp.load_der_ocsp_response(data) diff --git a/billinglayer/python/cryptography/x509/oid.py b/billinglayer/python/cryptography/x509/oid.py new file mode 100644 index 0000000..cda50cc --- /dev/null +++ b/billinglayer/python/cryptography/x509/oid.py @@ -0,0 +1,33 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat._oid import ( + AttributeOID, + AuthorityInformationAccessOID, + CertificatePoliciesOID, + CRLEntryExtensionOID, + ExtendedKeyUsageOID, + ExtensionOID, + NameOID, + ObjectIdentifier, + OCSPExtensionOID, + SignatureAlgorithmOID, + SubjectInformationAccessOID, +) + +__all__ = [ + "AttributeOID", + "AuthorityInformationAccessOID", + "CRLEntryExtensionOID", + "CertificatePoliciesOID", + "ExtendedKeyUsageOID", + "ExtensionOID", + "NameOID", + "OCSPExtensionOID", + "ObjectIdentifier", + "SignatureAlgorithmOID", + "SubjectInformationAccessOID", +] diff --git a/billinglayer/python/idna-3.4.dist-info/INSTALLER b/billinglayer/python/idna-3.4.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/idna-3.4.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/idna-3.4.dist-info/LICENSE.md b/billinglayer/python/idna-3.4.dist-info/LICENSE.md new file mode 100644 index 0000000..b6f8732 --- /dev/null +++ b/billinglayer/python/idna-3.4.dist-info/LICENSE.md @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2013-2021, Kim Davies +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/billinglayer/python/idna-3.4.dist-info/METADATA b/billinglayer/python/idna-3.4.dist-info/METADATA new file mode 100644 index 0000000..07f6193 --- /dev/null +++ b/billinglayer/python/idna-3.4.dist-info/METADATA @@ -0,0 +1,242 @@ +Metadata-Version: 2.1 +Name: idna +Version: 3.4 +Summary: Internationalized Domain Names in Applications (IDNA) +Author-email: Kim Davies +Requires-Python: >=3.5 +Description-Content-Type: text/x-rst +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: System Administrators +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: Name Service (DNS) +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Utilities +Project-URL: Changelog, https://github.com/kjd/idna/blob/master/HISTORY.rst +Project-URL: Issue tracker, https://github.com/kjd/idna/issues +Project-URL: Source, https://github.com/kjd/idna + +Internationalized Domain Names in Applications (IDNA) +===================================================== + +Support for the Internationalized Domain Names in +Applications (IDNA) protocol as specified in `RFC 5891 +`_. This is the latest version of +the protocol and is sometimes referred to as “IDNA 2008”. + +This library also provides support for Unicode Technical +Standard 46, `Unicode IDNA Compatibility Processing +`_. + +This acts as a suitable replacement for the “encodings.idna” +module that comes with the Python standard library, but which +only supports the older superseded IDNA specification (`RFC 3490 +`_). + +Basic functions are simply executed: + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('ドメイン.テスト') + b'xn--eckwd4c7c.xn--zckzah' + >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) + ドメイン.テスト + + +Installation +------------ + +This package is available for installation from PyPI: + +.. code-block:: bash + + $ python3 -m pip install idna + + +Usage +----- + +For typical usage, the ``encode`` and ``decode`` functions will take a +domain name argument and perform a conversion to A-labels or U-labels +respectively. + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('ドメイン.テスト') + b'xn--eckwd4c7c.xn--zckzah' + >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) + ドメイン.テスト + +You may use the codec encoding and decoding methods using the +``idna.codec`` module: + +.. code-block:: pycon + + >>> import idna.codec + >>> print('домен.испытание'.encode('idna')) + b'xn--d1acufc.xn--80akhbyknj4f' + >>> print(b'xn--d1acufc.xn--80akhbyknj4f'.decode('idna')) + домен.испытание + +Conversions can be applied at a per-label basis using the ``ulabel`` or +``alabel`` functions if necessary: + +.. code-block:: pycon + + >>> idna.alabel('测试') + b'xn--0zwm56d' + +Compatibility Mapping (UTS #46) ++++++++++++++++++++++++++++++++ + +As described in `RFC 5895 `_, the +IDNA specification does not normalize input from different potential +ways a user may input a domain name. This functionality, known as +a “mapping”, is considered by the specification to be a local +user-interface issue distinct from IDNA conversion functionality. + +This library provides one such mapping, that was developed by the +Unicode Consortium. Known as `Unicode IDNA Compatibility Processing +`_, it provides for both a regular +mapping for typical applications, as well as a transitional mapping to +help migrate from older IDNA 2003 applications. + +For example, “Königsgäßchen” is not a permissible label as *LATIN +CAPITAL LETTER K* is not allowed (nor are capital letters in general). +UTS 46 will convert this into lower case prior to applying the IDNA +conversion. + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('Königsgäßchen') + ... + idna.core.InvalidCodepoint: Codepoint U+004B at position 1 of 'Königsgäßchen' not allowed + >>> idna.encode('Königsgäßchen', uts46=True) + b'xn--knigsgchen-b4a3dun' + >>> print(idna.decode('xn--knigsgchen-b4a3dun')) + königsgäßchen + +Transitional processing provides conversions to help transition from +the older 2003 standard to the current standard. For example, in the +original IDNA specification, the *LATIN SMALL LETTER SHARP S* (ß) was +converted into two *LATIN SMALL LETTER S* (ss), whereas in the current +IDNA specification this conversion is not performed. + +.. code-block:: pycon + + >>> idna.encode('Königsgäßchen', uts46=True, transitional=True) + 'xn--knigsgsschen-lcb0w' + +Implementors should use transitional processing with caution, only in +rare cases where conversion from legacy labels to current labels must be +performed (i.e. IDNA implementations that pre-date 2008). For typical +applications that just need to convert labels, transitional processing +is unlikely to be beneficial and could produce unexpected incompatible +results. + +``encodings.idna`` Compatibility +++++++++++++++++++++++++++++++++ + +Function calls from the Python built-in ``encodings.idna`` module are +mapped to their IDNA 2008 equivalents using the ``idna.compat`` module. +Simply substitute the ``import`` clause in your code to refer to the new +module name. + +Exceptions +---------- + +All errors raised during the conversion following the specification +should raise an exception derived from the ``idna.IDNAError`` base +class. + +More specific exceptions that may be generated as ``idna.IDNABidiError`` +when the error reflects an illegal combination of left-to-right and +right-to-left characters in a label; ``idna.InvalidCodepoint`` when +a specific codepoint is an illegal character in an IDN label (i.e. +INVALID); and ``idna.InvalidCodepointContext`` when the codepoint is +illegal based on its positional context (i.e. it is CONTEXTO or CONTEXTJ +but the contextual requirements are not satisfied.) + +Building and Diagnostics +------------------------ + +The IDNA and UTS 46 functionality relies upon pre-calculated lookup +tables for performance. These tables are derived from computing against +eligibility criteria in the respective standards. These tables are +computed using the command-line script ``tools/idna-data``. + +This tool will fetch relevant codepoint data from the Unicode repository +and perform the required calculations to identify eligibility. There are +three main modes: + +* ``idna-data make-libdata``. Generates ``idnadata.py`` and + ``uts46data.py``, the pre-calculated lookup tables using for IDNA and + UTS 46 conversions. Implementors who wish to track this library against + a different Unicode version may use this tool to manually generate a + different version of the ``idnadata.py`` and ``uts46data.py`` files. + +* ``idna-data make-table``. Generate a table of the IDNA disposition + (e.g. PVALID, CONTEXTJ, CONTEXTO) in the format found in Appendix + B.1 of RFC 5892 and the pre-computed tables published by `IANA + `_. + +* ``idna-data U+0061``. Prints debugging output on the various + properties associated with an individual Unicode codepoint (in this + case, U+0061), that are used to assess the IDNA and UTS 46 status of a + codepoint. This is helpful in debugging or analysis. + +The tool accepts a number of arguments, described using ``idna-data +-h``. Most notably, the ``--version`` argument allows the specification +of the version of Unicode to use in computing the table data. For +example, ``idna-data --version 9.0.0 make-libdata`` will generate +library data against Unicode 9.0.0. + + +Additional Notes +---------------- + +* **Packages**. The latest tagged release version is published in the + `Python Package Index `_. + +* **Version support**. This library supports Python 3.5 and higher. + As this library serves as a low-level toolkit for a variety of + applications, many of which strive for broad compatibility with older + Python versions, there is no rush to remove older intepreter support. + Removing support for older versions should be well justified in that the + maintenance burden has become too high. + +* **Python 2**. Python 2 is supported by version 2.x of this library. + While active development of the version 2.x series has ended, notable + issues being corrected may be backported to 2.x. Use "idna<3" in your + requirements file if you need this library for a Python 2 application. + +* **Testing**. The library has a test suite based on each rule of the + IDNA specification, as well as tests that are provided as part of the + Unicode Technical Standard 46, `Unicode IDNA Compatibility Processing + `_. + +* **Emoji**. It is an occasional request to support emoji domains in + this library. Encoding of symbols like emoji is expressly prohibited by + the technical standard IDNA 2008 and emoji domains are broadly phased + out across the domain industry due to associated security risks. For + now, applications that wish need to support these non-compliant labels + may wish to consider trying the encode/decode operation in this library + first, and then falling back to using `encodings.idna`. See `the Github + project `_ for more discussion. + diff --git a/billinglayer/python/idna-3.4.dist-info/RECORD b/billinglayer/python/idna-3.4.dist-info/RECORD new file mode 100644 index 0000000..5da1ae1 --- /dev/null +++ b/billinglayer/python/idna-3.4.dist-info/RECORD @@ -0,0 +1,22 @@ +idna-3.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +idna-3.4.dist-info/LICENSE.md,sha256=otbk2UC9JNvnuWRc3hmpeSzFHbeuDVrNMBrIYMqj6DY,1523 +idna-3.4.dist-info/METADATA,sha256=8aLSf9MFS7oB26pZh2hprg7eJp0UJSc-3rpf_evp4DA,9830 +idna-3.4.dist-info/RECORD,, +idna-3.4.dist-info/WHEEL,sha256=4TfKIB_xu-04bc2iKz6_zFt-gEFEEDU_31HGhqzOCE8,81 +idna/__init__.py,sha256=KJQN1eQBr8iIK5SKrJ47lXvxG0BJ7Lm38W4zT0v_8lk,849 +idna/__pycache__/__init__.cpython-311.pyc,, +idna/__pycache__/codec.cpython-311.pyc,, +idna/__pycache__/compat.cpython-311.pyc,, +idna/__pycache__/core.cpython-311.pyc,, +idna/__pycache__/idnadata.cpython-311.pyc,, +idna/__pycache__/intranges.cpython-311.pyc,, +idna/__pycache__/package_data.cpython-311.pyc,, +idna/__pycache__/uts46data.cpython-311.pyc,, +idna/codec.py,sha256=6ly5odKfqrytKT9_7UrlGklHnf1DSK2r9C6cSM4sa28,3374 +idna/compat.py,sha256=0_sOEUMT4CVw9doD3vyRhX80X19PwqFoUBs7gWsFME4,321 +idna/core.py,sha256=1JxchwKzkxBSn7R_oCE12oBu3eVux0VzdxolmIad24M,12950 +idna/idnadata.py,sha256=xUjqKqiJV8Ho_XzBpAtv5JFoVPSupK-SUXvtjygUHqw,44375 +idna/intranges.py,sha256=YBr4fRYuWH7kTKS2tXlFjM24ZF1Pdvcir-aywniInqg,1881 +idna/package_data.py,sha256=C_jHJzmX8PI4xq0jpzmcTMxpb5lDsq4o5VyxQzlVrZE,21 +idna/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +idna/uts46data.py,sha256=zvjZU24s58_uAS850Mcd0NnD0X7_gCMAMjzWNIeUJdc,206539 diff --git a/billinglayer/python/idna-3.4.dist-info/WHEEL b/billinglayer/python/idna-3.4.dist-info/WHEEL new file mode 100644 index 0000000..668ba4d --- /dev/null +++ b/billinglayer/python/idna-3.4.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.7.1 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/billinglayer/python/idna/__init__.py b/billinglayer/python/idna/__init__.py new file mode 100644 index 0000000..a40eeaf --- /dev/null +++ b/billinglayer/python/idna/__init__.py @@ -0,0 +1,44 @@ +from .package_data import __version__ +from .core import ( + IDNABidiError, + IDNAError, + InvalidCodepoint, + InvalidCodepointContext, + alabel, + check_bidi, + check_hyphen_ok, + check_initial_combiner, + check_label, + check_nfc, + decode, + encode, + ulabel, + uts46_remap, + valid_contextj, + valid_contexto, + valid_label_length, + valid_string_length, +) +from .intranges import intranges_contain + +__all__ = [ + "IDNABidiError", + "IDNAError", + "InvalidCodepoint", + "InvalidCodepointContext", + "alabel", + "check_bidi", + "check_hyphen_ok", + "check_initial_combiner", + "check_label", + "check_nfc", + "decode", + "encode", + "intranges_contain", + "ulabel", + "uts46_remap", + "valid_contextj", + "valid_contexto", + "valid_label_length", + "valid_string_length", +] diff --git a/billinglayer/python/idna/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/idna/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1e3e2e1 Binary files /dev/null and b/billinglayer/python/idna/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/idna/__pycache__/codec.cpython-311.pyc b/billinglayer/python/idna/__pycache__/codec.cpython-311.pyc new file mode 100644 index 0000000..c65aab9 Binary files /dev/null and b/billinglayer/python/idna/__pycache__/codec.cpython-311.pyc differ diff --git a/billinglayer/python/idna/__pycache__/compat.cpython-311.pyc b/billinglayer/python/idna/__pycache__/compat.cpython-311.pyc new file mode 100644 index 0000000..68ee71b Binary files /dev/null and b/billinglayer/python/idna/__pycache__/compat.cpython-311.pyc differ diff --git a/billinglayer/python/idna/__pycache__/core.cpython-311.pyc b/billinglayer/python/idna/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..1bd0f9d Binary files /dev/null and b/billinglayer/python/idna/__pycache__/core.cpython-311.pyc differ diff --git a/billinglayer/python/idna/__pycache__/idnadata.cpython-311.pyc b/billinglayer/python/idna/__pycache__/idnadata.cpython-311.pyc new file mode 100644 index 0000000..dd314e7 Binary files /dev/null and b/billinglayer/python/idna/__pycache__/idnadata.cpython-311.pyc differ diff --git a/billinglayer/python/idna/__pycache__/intranges.cpython-311.pyc b/billinglayer/python/idna/__pycache__/intranges.cpython-311.pyc new file mode 100644 index 0000000..7536a50 Binary files /dev/null and b/billinglayer/python/idna/__pycache__/intranges.cpython-311.pyc differ diff --git a/billinglayer/python/idna/__pycache__/package_data.cpython-311.pyc b/billinglayer/python/idna/__pycache__/package_data.cpython-311.pyc new file mode 100644 index 0000000..a6f1dd9 Binary files /dev/null and b/billinglayer/python/idna/__pycache__/package_data.cpython-311.pyc differ diff --git a/billinglayer/python/idna/__pycache__/uts46data.cpython-311.pyc b/billinglayer/python/idna/__pycache__/uts46data.cpython-311.pyc new file mode 100644 index 0000000..6cb226b Binary files /dev/null and b/billinglayer/python/idna/__pycache__/uts46data.cpython-311.pyc differ diff --git a/billinglayer/python/idna/codec.py b/billinglayer/python/idna/codec.py new file mode 100644 index 0000000..1ca9ba6 --- /dev/null +++ b/billinglayer/python/idna/codec.py @@ -0,0 +1,112 @@ +from .core import encode, decode, alabel, ulabel, IDNAError +import codecs +import re +from typing import Tuple, Optional + +_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]') + +class Codec(codecs.Codec): + + def encode(self, data: str, errors: str = 'strict') -> Tuple[bytes, int]: + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return b"", 0 + + return encode(data), len(data) + + def decode(self, data: bytes, errors: str = 'strict') -> Tuple[str, int]: + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return '', 0 + + return decode(data), len(data) + +class IncrementalEncoder(codecs.BufferedIncrementalEncoder): + def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[str, int]: # type: ignore + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return "", 0 + + labels = _unicode_dots_re.split(data) + trailing_dot = '' + if labels: + if not labels[-1]: + trailing_dot = '.' + del labels[-1] + elif not final: + # Keep potentially unfinished label until the next call + del labels[-1] + if labels: + trailing_dot = '.' + + result = [] + size = 0 + for label in labels: + result.append(alabel(label)) + if size: + size += 1 + size += len(label) + + # Join with U+002E + result_str = '.'.join(result) + trailing_dot # type: ignore + size += len(trailing_dot) + return result_str, size + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def _buffer_decode(self, data: str, errors: str, final: bool) -> Tuple[str, int]: # type: ignore + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return ('', 0) + + labels = _unicode_dots_re.split(data) + trailing_dot = '' + if labels: + if not labels[-1]: + trailing_dot = '.' + del labels[-1] + elif not final: + # Keep potentially unfinished label until the next call + del labels[-1] + if labels: + trailing_dot = '.' + + result = [] + size = 0 + for label in labels: + result.append(ulabel(label)) + if size: + size += 1 + size += len(label) + + result_str = '.'.join(result) + trailing_dot + size += len(trailing_dot) + return (result_str, size) + + +class StreamWriter(Codec, codecs.StreamWriter): + pass + + +class StreamReader(Codec, codecs.StreamReader): + pass + + +def getregentry() -> codecs.CodecInfo: + # Compatibility as a search_function for codecs.register() + return codecs.CodecInfo( + name='idna', + encode=Codec().encode, # type: ignore + decode=Codec().decode, # type: ignore + incrementalencoder=IncrementalEncoder, + incrementaldecoder=IncrementalDecoder, + streamwriter=StreamWriter, + streamreader=StreamReader, + ) diff --git a/billinglayer/python/idna/compat.py b/billinglayer/python/idna/compat.py new file mode 100644 index 0000000..786e6bd --- /dev/null +++ b/billinglayer/python/idna/compat.py @@ -0,0 +1,13 @@ +from .core import * +from .codec import * +from typing import Any, Union + +def ToASCII(label: str) -> bytes: + return encode(label) + +def ToUnicode(label: Union[bytes, bytearray]) -> str: + return decode(label) + +def nameprep(s: Any) -> None: + raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol') + diff --git a/billinglayer/python/idna/core.py b/billinglayer/python/idna/core.py new file mode 100644 index 0000000..4f30037 --- /dev/null +++ b/billinglayer/python/idna/core.py @@ -0,0 +1,400 @@ +from . import idnadata +import bisect +import unicodedata +import re +from typing import Union, Optional +from .intranges import intranges_contain + +_virama_combining_class = 9 +_alabel_prefix = b'xn--' +_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]') + +class IDNAError(UnicodeError): + """ Base exception for all IDNA-encoding related problems """ + pass + + +class IDNABidiError(IDNAError): + """ Exception when bidirectional requirements are not satisfied """ + pass + + +class InvalidCodepoint(IDNAError): + """ Exception when a disallowed or unallocated codepoint is used """ + pass + + +class InvalidCodepointContext(IDNAError): + """ Exception when the codepoint is not valid in the context it is used """ + pass + + +def _combining_class(cp: int) -> int: + v = unicodedata.combining(chr(cp)) + if v == 0: + if not unicodedata.name(chr(cp)): + raise ValueError('Unknown character in unicodedata') + return v + +def _is_script(cp: str, script: str) -> bool: + return intranges_contain(ord(cp), idnadata.scripts[script]) + +def _punycode(s: str) -> bytes: + return s.encode('punycode') + +def _unot(s: int) -> str: + return 'U+{:04X}'.format(s) + + +def valid_label_length(label: Union[bytes, str]) -> bool: + if len(label) > 63: + return False + return True + + +def valid_string_length(label: Union[bytes, str], trailing_dot: bool) -> bool: + if len(label) > (254 if trailing_dot else 253): + return False + return True + + +def check_bidi(label: str, check_ltr: bool = False) -> bool: + # Bidi rules should only be applied if string contains RTL characters + bidi_label = False + for (idx, cp) in enumerate(label, 1): + direction = unicodedata.bidirectional(cp) + if direction == '': + # String likely comes from a newer version of Unicode + raise IDNABidiError('Unknown directionality in label {} at position {}'.format(repr(label), idx)) + if direction in ['R', 'AL', 'AN']: + bidi_label = True + if not bidi_label and not check_ltr: + return True + + # Bidi rule 1 + direction = unicodedata.bidirectional(label[0]) + if direction in ['R', 'AL']: + rtl = True + elif direction == 'L': + rtl = False + else: + raise IDNABidiError('First codepoint in label {} must be directionality L, R or AL'.format(repr(label))) + + valid_ending = False + number_type = None # type: Optional[str] + for (idx, cp) in enumerate(label, 1): + direction = unicodedata.bidirectional(cp) + + if rtl: + # Bidi rule 2 + if not direction in ['R', 'AL', 'AN', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: + raise IDNABidiError('Invalid direction for codepoint at position {} in a right-to-left label'.format(idx)) + # Bidi rule 3 + if direction in ['R', 'AL', 'EN', 'AN']: + valid_ending = True + elif direction != 'NSM': + valid_ending = False + # Bidi rule 4 + if direction in ['AN', 'EN']: + if not number_type: + number_type = direction + else: + if number_type != direction: + raise IDNABidiError('Can not mix numeral types in a right-to-left label') + else: + # Bidi rule 5 + if not direction in ['L', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: + raise IDNABidiError('Invalid direction for codepoint at position {} in a left-to-right label'.format(idx)) + # Bidi rule 6 + if direction in ['L', 'EN']: + valid_ending = True + elif direction != 'NSM': + valid_ending = False + + if not valid_ending: + raise IDNABidiError('Label ends with illegal codepoint directionality') + + return True + + +def check_initial_combiner(label: str) -> bool: + if unicodedata.category(label[0])[0] == 'M': + raise IDNAError('Label begins with an illegal combining character') + return True + + +def check_hyphen_ok(label: str) -> bool: + if label[2:4] == '--': + raise IDNAError('Label has disallowed hyphens in 3rd and 4th position') + if label[0] == '-' or label[-1] == '-': + raise IDNAError('Label must not start or end with a hyphen') + return True + + +def check_nfc(label: str) -> None: + if unicodedata.normalize('NFC', label) != label: + raise IDNAError('Label must be in Normalization Form C') + + +def valid_contextj(label: str, pos: int) -> bool: + cp_value = ord(label[pos]) + + if cp_value == 0x200c: + + if pos > 0: + if _combining_class(ord(label[pos - 1])) == _virama_combining_class: + return True + + ok = False + for i in range(pos-1, -1, -1): + joining_type = idnadata.joining_types.get(ord(label[i])) + if joining_type == ord('T'): + continue + if joining_type in [ord('L'), ord('D')]: + ok = True + break + + if not ok: + return False + + ok = False + for i in range(pos+1, len(label)): + joining_type = idnadata.joining_types.get(ord(label[i])) + if joining_type == ord('T'): + continue + if joining_type in [ord('R'), ord('D')]: + ok = True + break + return ok + + if cp_value == 0x200d: + + if pos > 0: + if _combining_class(ord(label[pos - 1])) == _virama_combining_class: + return True + return False + + else: + + return False + + +def valid_contexto(label: str, pos: int, exception: bool = False) -> bool: + cp_value = ord(label[pos]) + + if cp_value == 0x00b7: + if 0 < pos < len(label)-1: + if ord(label[pos - 1]) == 0x006c and ord(label[pos + 1]) == 0x006c: + return True + return False + + elif cp_value == 0x0375: + if pos < len(label)-1 and len(label) > 1: + return _is_script(label[pos + 1], 'Greek') + return False + + elif cp_value == 0x05f3 or cp_value == 0x05f4: + if pos > 0: + return _is_script(label[pos - 1], 'Hebrew') + return False + + elif cp_value == 0x30fb: + for cp in label: + if cp == '\u30fb': + continue + if _is_script(cp, 'Hiragana') or _is_script(cp, 'Katakana') or _is_script(cp, 'Han'): + return True + return False + + elif 0x660 <= cp_value <= 0x669: + for cp in label: + if 0x6f0 <= ord(cp) <= 0x06f9: + return False + return True + + elif 0x6f0 <= cp_value <= 0x6f9: + for cp in label: + if 0x660 <= ord(cp) <= 0x0669: + return False + return True + + return False + + +def check_label(label: Union[str, bytes, bytearray]) -> None: + if isinstance(label, (bytes, bytearray)): + label = label.decode('utf-8') + if len(label) == 0: + raise IDNAError('Empty Label') + + check_nfc(label) + check_hyphen_ok(label) + check_initial_combiner(label) + + for (pos, cp) in enumerate(label): + cp_value = ord(cp) + if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']): + continue + elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']): + try: + if not valid_contextj(label, pos): + raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format( + _unot(cp_value), pos+1, repr(label))) + except ValueError: + raise IDNAError('Unknown codepoint adjacent to joiner {} at position {} in {}'.format( + _unot(cp_value), pos+1, repr(label))) + elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']): + if not valid_contexto(label, pos): + raise InvalidCodepointContext('Codepoint {} not allowed at position {} in {}'.format(_unot(cp_value), pos+1, repr(label))) + else: + raise InvalidCodepoint('Codepoint {} at position {} of {} not allowed'.format(_unot(cp_value), pos+1, repr(label))) + + check_bidi(label) + + +def alabel(label: str) -> bytes: + try: + label_bytes = label.encode('ascii') + ulabel(label_bytes) + if not valid_label_length(label_bytes): + raise IDNAError('Label too long') + return label_bytes + except UnicodeEncodeError: + pass + + if not label: + raise IDNAError('No Input') + + label = str(label) + check_label(label) + label_bytes = _punycode(label) + label_bytes = _alabel_prefix + label_bytes + + if not valid_label_length(label_bytes): + raise IDNAError('Label too long') + + return label_bytes + + +def ulabel(label: Union[str, bytes, bytearray]) -> str: + if not isinstance(label, (bytes, bytearray)): + try: + label_bytes = label.encode('ascii') + except UnicodeEncodeError: + check_label(label) + return label + else: + label_bytes = label + + label_bytes = label_bytes.lower() + if label_bytes.startswith(_alabel_prefix): + label_bytes = label_bytes[len(_alabel_prefix):] + if not label_bytes: + raise IDNAError('Malformed A-label, no Punycode eligible content found') + if label_bytes.decode('ascii')[-1] == '-': + raise IDNAError('A-label must not end with a hyphen') + else: + check_label(label_bytes) + return label_bytes.decode('ascii') + + try: + label = label_bytes.decode('punycode') + except UnicodeError: + raise IDNAError('Invalid A-label') + check_label(label) + return label + + +def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False) -> str: + """Re-map the characters in the string according to UTS46 processing.""" + from .uts46data import uts46data + output = '' + + for pos, char in enumerate(domain): + code_point = ord(char) + try: + uts46row = uts46data[code_point if code_point < 256 else + bisect.bisect_left(uts46data, (code_point, 'Z')) - 1] + status = uts46row[1] + replacement = None # type: Optional[str] + if len(uts46row) == 3: + replacement = uts46row[2] # type: ignore + if (status == 'V' or + (status == 'D' and not transitional) or + (status == '3' and not std3_rules and replacement is None)): + output += char + elif replacement is not None and (status == 'M' or + (status == '3' and not std3_rules) or + (status == 'D' and transitional)): + output += replacement + elif status != 'I': + raise IndexError() + except IndexError: + raise InvalidCodepoint( + 'Codepoint {} not allowed at position {} in {}'.format( + _unot(code_point), pos + 1, repr(domain))) + + return unicodedata.normalize('NFC', output) + + +def encode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False, transitional: bool = False) -> bytes: + if isinstance(s, (bytes, bytearray)): + try: + s = s.decode('ascii') + except UnicodeDecodeError: + raise IDNAError('should pass a unicode string to the function rather than a byte string.') + if uts46: + s = uts46_remap(s, std3_rules, transitional) + trailing_dot = False + result = [] + if strict: + labels = s.split('.') + else: + labels = _unicode_dots_re.split(s) + if not labels or labels == ['']: + raise IDNAError('Empty domain') + if labels[-1] == '': + del labels[-1] + trailing_dot = True + for label in labels: + s = alabel(label) + if s: + result.append(s) + else: + raise IDNAError('Empty label') + if trailing_dot: + result.append(b'') + s = b'.'.join(result) + if not valid_string_length(s, trailing_dot): + raise IDNAError('Domain too long') + return s + + +def decode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False) -> str: + try: + if isinstance(s, (bytes, bytearray)): + s = s.decode('ascii') + except UnicodeDecodeError: + raise IDNAError('Invalid ASCII in A-label') + if uts46: + s = uts46_remap(s, std3_rules, False) + trailing_dot = False + result = [] + if not strict: + labels = _unicode_dots_re.split(s) + else: + labels = s.split('.') + if not labels or labels == ['']: + raise IDNAError('Empty domain') + if not labels[-1]: + del labels[-1] + trailing_dot = True + for label in labels: + s = ulabel(label) + if s: + result.append(s) + else: + raise IDNAError('Empty label') + if trailing_dot: + result.append('') + return '.'.join(result) diff --git a/billinglayer/python/idna/idnadata.py b/billinglayer/python/idna/idnadata.py new file mode 100644 index 0000000..67db462 --- /dev/null +++ b/billinglayer/python/idna/idnadata.py @@ -0,0 +1,2151 @@ +# This file is automatically generated by tools/idna-data + +__version__ = '15.0.0' +scripts = { + 'Greek': ( + 0x37000000374, + 0x37500000378, + 0x37a0000037e, + 0x37f00000380, + 0x38400000385, + 0x38600000387, + 0x3880000038b, + 0x38c0000038d, + 0x38e000003a2, + 0x3a3000003e2, + 0x3f000000400, + 0x1d2600001d2b, + 0x1d5d00001d62, + 0x1d6600001d6b, + 0x1dbf00001dc0, + 0x1f0000001f16, + 0x1f1800001f1e, + 0x1f2000001f46, + 0x1f4800001f4e, + 0x1f5000001f58, + 0x1f5900001f5a, + 0x1f5b00001f5c, + 0x1f5d00001f5e, + 0x1f5f00001f7e, + 0x1f8000001fb5, + 0x1fb600001fc5, + 0x1fc600001fd4, + 0x1fd600001fdc, + 0x1fdd00001ff0, + 0x1ff200001ff5, + 0x1ff600001fff, + 0x212600002127, + 0xab650000ab66, + 0x101400001018f, + 0x101a0000101a1, + 0x1d2000001d246, + ), + 'Han': ( + 0x2e8000002e9a, + 0x2e9b00002ef4, + 0x2f0000002fd6, + 0x300500003006, + 0x300700003008, + 0x30210000302a, + 0x30380000303c, + 0x340000004dc0, + 0x4e000000a000, + 0xf9000000fa6e, + 0xfa700000fada, + 0x16fe200016fe4, + 0x16ff000016ff2, + 0x200000002a6e0, + 0x2a7000002b73a, + 0x2b7400002b81e, + 0x2b8200002cea2, + 0x2ceb00002ebe1, + 0x2f8000002fa1e, + 0x300000003134b, + 0x31350000323b0, + ), + 'Hebrew': ( + 0x591000005c8, + 0x5d0000005eb, + 0x5ef000005f5, + 0xfb1d0000fb37, + 0xfb380000fb3d, + 0xfb3e0000fb3f, + 0xfb400000fb42, + 0xfb430000fb45, + 0xfb460000fb50, + ), + 'Hiragana': ( + 0x304100003097, + 0x309d000030a0, + 0x1b0010001b120, + 0x1b1320001b133, + 0x1b1500001b153, + 0x1f2000001f201, + ), + 'Katakana': ( + 0x30a1000030fb, + 0x30fd00003100, + 0x31f000003200, + 0x32d0000032ff, + 0x330000003358, + 0xff660000ff70, + 0xff710000ff9e, + 0x1aff00001aff4, + 0x1aff50001affc, + 0x1affd0001afff, + 0x1b0000001b001, + 0x1b1200001b123, + 0x1b1550001b156, + 0x1b1640001b168, + ), +} +joining_types = { + 0x600: 85, + 0x601: 85, + 0x602: 85, + 0x603: 85, + 0x604: 85, + 0x605: 85, + 0x608: 85, + 0x60b: 85, + 0x620: 68, + 0x621: 85, + 0x622: 82, + 0x623: 82, + 0x624: 82, + 0x625: 82, + 0x626: 68, + 0x627: 82, + 0x628: 68, + 0x629: 82, + 0x62a: 68, + 0x62b: 68, + 0x62c: 68, + 0x62d: 68, + 0x62e: 68, + 0x62f: 82, + 0x630: 82, + 0x631: 82, + 0x632: 82, + 0x633: 68, + 0x634: 68, + 0x635: 68, + 0x636: 68, + 0x637: 68, + 0x638: 68, + 0x639: 68, + 0x63a: 68, + 0x63b: 68, + 0x63c: 68, + 0x63d: 68, + 0x63e: 68, + 0x63f: 68, + 0x640: 67, + 0x641: 68, + 0x642: 68, + 0x643: 68, + 0x644: 68, + 0x645: 68, + 0x646: 68, + 0x647: 68, + 0x648: 82, + 0x649: 68, + 0x64a: 68, + 0x66e: 68, + 0x66f: 68, + 0x671: 82, + 0x672: 82, + 0x673: 82, + 0x674: 85, + 0x675: 82, + 0x676: 82, + 0x677: 82, + 0x678: 68, + 0x679: 68, + 0x67a: 68, + 0x67b: 68, + 0x67c: 68, + 0x67d: 68, + 0x67e: 68, + 0x67f: 68, + 0x680: 68, + 0x681: 68, + 0x682: 68, + 0x683: 68, + 0x684: 68, + 0x685: 68, + 0x686: 68, + 0x687: 68, + 0x688: 82, + 0x689: 82, + 0x68a: 82, + 0x68b: 82, + 0x68c: 82, + 0x68d: 82, + 0x68e: 82, + 0x68f: 82, + 0x690: 82, + 0x691: 82, + 0x692: 82, + 0x693: 82, + 0x694: 82, + 0x695: 82, + 0x696: 82, + 0x697: 82, + 0x698: 82, + 0x699: 82, + 0x69a: 68, + 0x69b: 68, + 0x69c: 68, + 0x69d: 68, + 0x69e: 68, + 0x69f: 68, + 0x6a0: 68, + 0x6a1: 68, + 0x6a2: 68, + 0x6a3: 68, + 0x6a4: 68, + 0x6a5: 68, + 0x6a6: 68, + 0x6a7: 68, + 0x6a8: 68, + 0x6a9: 68, + 0x6aa: 68, + 0x6ab: 68, + 0x6ac: 68, + 0x6ad: 68, + 0x6ae: 68, + 0x6af: 68, + 0x6b0: 68, + 0x6b1: 68, + 0x6b2: 68, + 0x6b3: 68, + 0x6b4: 68, + 0x6b5: 68, + 0x6b6: 68, + 0x6b7: 68, + 0x6b8: 68, + 0x6b9: 68, + 0x6ba: 68, + 0x6bb: 68, + 0x6bc: 68, + 0x6bd: 68, + 0x6be: 68, + 0x6bf: 68, + 0x6c0: 82, + 0x6c1: 68, + 0x6c2: 68, + 0x6c3: 82, + 0x6c4: 82, + 0x6c5: 82, + 0x6c6: 82, + 0x6c7: 82, + 0x6c8: 82, + 0x6c9: 82, + 0x6ca: 82, + 0x6cb: 82, + 0x6cc: 68, + 0x6cd: 82, + 0x6ce: 68, + 0x6cf: 82, + 0x6d0: 68, + 0x6d1: 68, + 0x6d2: 82, + 0x6d3: 82, + 0x6d5: 82, + 0x6dd: 85, + 0x6ee: 82, + 0x6ef: 82, + 0x6fa: 68, + 0x6fb: 68, + 0x6fc: 68, + 0x6ff: 68, + 0x70f: 84, + 0x710: 82, + 0x712: 68, + 0x713: 68, + 0x714: 68, + 0x715: 82, + 0x716: 82, + 0x717: 82, + 0x718: 82, + 0x719: 82, + 0x71a: 68, + 0x71b: 68, + 0x71c: 68, + 0x71d: 68, + 0x71e: 82, + 0x71f: 68, + 0x720: 68, + 0x721: 68, + 0x722: 68, + 0x723: 68, + 0x724: 68, + 0x725: 68, + 0x726: 68, + 0x727: 68, + 0x728: 82, + 0x729: 68, + 0x72a: 82, + 0x72b: 68, + 0x72c: 82, + 0x72d: 68, + 0x72e: 68, + 0x72f: 82, + 0x74d: 82, + 0x74e: 68, + 0x74f: 68, + 0x750: 68, + 0x751: 68, + 0x752: 68, + 0x753: 68, + 0x754: 68, + 0x755: 68, + 0x756: 68, + 0x757: 68, + 0x758: 68, + 0x759: 82, + 0x75a: 82, + 0x75b: 82, + 0x75c: 68, + 0x75d: 68, + 0x75e: 68, + 0x75f: 68, + 0x760: 68, + 0x761: 68, + 0x762: 68, + 0x763: 68, + 0x764: 68, + 0x765: 68, + 0x766: 68, + 0x767: 68, + 0x768: 68, + 0x769: 68, + 0x76a: 68, + 0x76b: 82, + 0x76c: 82, + 0x76d: 68, + 0x76e: 68, + 0x76f: 68, + 0x770: 68, + 0x771: 82, + 0x772: 68, + 0x773: 82, + 0x774: 82, + 0x775: 68, + 0x776: 68, + 0x777: 68, + 0x778: 82, + 0x779: 82, + 0x77a: 68, + 0x77b: 68, + 0x77c: 68, + 0x77d: 68, + 0x77e: 68, + 0x77f: 68, + 0x7ca: 68, + 0x7cb: 68, + 0x7cc: 68, + 0x7cd: 68, + 0x7ce: 68, + 0x7cf: 68, + 0x7d0: 68, + 0x7d1: 68, + 0x7d2: 68, + 0x7d3: 68, + 0x7d4: 68, + 0x7d5: 68, + 0x7d6: 68, + 0x7d7: 68, + 0x7d8: 68, + 0x7d9: 68, + 0x7da: 68, + 0x7db: 68, + 0x7dc: 68, + 0x7dd: 68, + 0x7de: 68, + 0x7df: 68, + 0x7e0: 68, + 0x7e1: 68, + 0x7e2: 68, + 0x7e3: 68, + 0x7e4: 68, + 0x7e5: 68, + 0x7e6: 68, + 0x7e7: 68, + 0x7e8: 68, + 0x7e9: 68, + 0x7ea: 68, + 0x7fa: 67, + 0x840: 82, + 0x841: 68, + 0x842: 68, + 0x843: 68, + 0x844: 68, + 0x845: 68, + 0x846: 82, + 0x847: 82, + 0x848: 68, + 0x849: 82, + 0x84a: 68, + 0x84b: 68, + 0x84c: 68, + 0x84d: 68, + 0x84e: 68, + 0x84f: 68, + 0x850: 68, + 0x851: 68, + 0x852: 68, + 0x853: 68, + 0x854: 82, + 0x855: 68, + 0x856: 82, + 0x857: 82, + 0x858: 82, + 0x860: 68, + 0x861: 85, + 0x862: 68, + 0x863: 68, + 0x864: 68, + 0x865: 68, + 0x866: 85, + 0x867: 82, + 0x868: 68, + 0x869: 82, + 0x86a: 82, + 0x870: 82, + 0x871: 82, + 0x872: 82, + 0x873: 82, + 0x874: 82, + 0x875: 82, + 0x876: 82, + 0x877: 82, + 0x878: 82, + 0x879: 82, + 0x87a: 82, + 0x87b: 82, + 0x87c: 82, + 0x87d: 82, + 0x87e: 82, + 0x87f: 82, + 0x880: 82, + 0x881: 82, + 0x882: 82, + 0x883: 67, + 0x884: 67, + 0x885: 67, + 0x886: 68, + 0x887: 85, + 0x888: 85, + 0x889: 68, + 0x88a: 68, + 0x88b: 68, + 0x88c: 68, + 0x88d: 68, + 0x88e: 82, + 0x890: 85, + 0x891: 85, + 0x8a0: 68, + 0x8a1: 68, + 0x8a2: 68, + 0x8a3: 68, + 0x8a4: 68, + 0x8a5: 68, + 0x8a6: 68, + 0x8a7: 68, + 0x8a8: 68, + 0x8a9: 68, + 0x8aa: 82, + 0x8ab: 82, + 0x8ac: 82, + 0x8ad: 85, + 0x8ae: 82, + 0x8af: 68, + 0x8b0: 68, + 0x8b1: 82, + 0x8b2: 82, + 0x8b3: 68, + 0x8b4: 68, + 0x8b5: 68, + 0x8b6: 68, + 0x8b7: 68, + 0x8b8: 68, + 0x8b9: 82, + 0x8ba: 68, + 0x8bb: 68, + 0x8bc: 68, + 0x8bd: 68, + 0x8be: 68, + 0x8bf: 68, + 0x8c0: 68, + 0x8c1: 68, + 0x8c2: 68, + 0x8c3: 68, + 0x8c4: 68, + 0x8c5: 68, + 0x8c6: 68, + 0x8c7: 68, + 0x8c8: 68, + 0x8e2: 85, + 0x1806: 85, + 0x1807: 68, + 0x180a: 67, + 0x180e: 85, + 0x1820: 68, + 0x1821: 68, + 0x1822: 68, + 0x1823: 68, + 0x1824: 68, + 0x1825: 68, + 0x1826: 68, + 0x1827: 68, + 0x1828: 68, + 0x1829: 68, + 0x182a: 68, + 0x182b: 68, + 0x182c: 68, + 0x182d: 68, + 0x182e: 68, + 0x182f: 68, + 0x1830: 68, + 0x1831: 68, + 0x1832: 68, + 0x1833: 68, + 0x1834: 68, + 0x1835: 68, + 0x1836: 68, + 0x1837: 68, + 0x1838: 68, + 0x1839: 68, + 0x183a: 68, + 0x183b: 68, + 0x183c: 68, + 0x183d: 68, + 0x183e: 68, + 0x183f: 68, + 0x1840: 68, + 0x1841: 68, + 0x1842: 68, + 0x1843: 68, + 0x1844: 68, + 0x1845: 68, + 0x1846: 68, + 0x1847: 68, + 0x1848: 68, + 0x1849: 68, + 0x184a: 68, + 0x184b: 68, + 0x184c: 68, + 0x184d: 68, + 0x184e: 68, + 0x184f: 68, + 0x1850: 68, + 0x1851: 68, + 0x1852: 68, + 0x1853: 68, + 0x1854: 68, + 0x1855: 68, + 0x1856: 68, + 0x1857: 68, + 0x1858: 68, + 0x1859: 68, + 0x185a: 68, + 0x185b: 68, + 0x185c: 68, + 0x185d: 68, + 0x185e: 68, + 0x185f: 68, + 0x1860: 68, + 0x1861: 68, + 0x1862: 68, + 0x1863: 68, + 0x1864: 68, + 0x1865: 68, + 0x1866: 68, + 0x1867: 68, + 0x1868: 68, + 0x1869: 68, + 0x186a: 68, + 0x186b: 68, + 0x186c: 68, + 0x186d: 68, + 0x186e: 68, + 0x186f: 68, + 0x1870: 68, + 0x1871: 68, + 0x1872: 68, + 0x1873: 68, + 0x1874: 68, + 0x1875: 68, + 0x1876: 68, + 0x1877: 68, + 0x1878: 68, + 0x1880: 85, + 0x1881: 85, + 0x1882: 85, + 0x1883: 85, + 0x1884: 85, + 0x1885: 84, + 0x1886: 84, + 0x1887: 68, + 0x1888: 68, + 0x1889: 68, + 0x188a: 68, + 0x188b: 68, + 0x188c: 68, + 0x188d: 68, + 0x188e: 68, + 0x188f: 68, + 0x1890: 68, + 0x1891: 68, + 0x1892: 68, + 0x1893: 68, + 0x1894: 68, + 0x1895: 68, + 0x1896: 68, + 0x1897: 68, + 0x1898: 68, + 0x1899: 68, + 0x189a: 68, + 0x189b: 68, + 0x189c: 68, + 0x189d: 68, + 0x189e: 68, + 0x189f: 68, + 0x18a0: 68, + 0x18a1: 68, + 0x18a2: 68, + 0x18a3: 68, + 0x18a4: 68, + 0x18a5: 68, + 0x18a6: 68, + 0x18a7: 68, + 0x18a8: 68, + 0x18aa: 68, + 0x200c: 85, + 0x200d: 67, + 0x202f: 85, + 0x2066: 85, + 0x2067: 85, + 0x2068: 85, + 0x2069: 85, + 0xa840: 68, + 0xa841: 68, + 0xa842: 68, + 0xa843: 68, + 0xa844: 68, + 0xa845: 68, + 0xa846: 68, + 0xa847: 68, + 0xa848: 68, + 0xa849: 68, + 0xa84a: 68, + 0xa84b: 68, + 0xa84c: 68, + 0xa84d: 68, + 0xa84e: 68, + 0xa84f: 68, + 0xa850: 68, + 0xa851: 68, + 0xa852: 68, + 0xa853: 68, + 0xa854: 68, + 0xa855: 68, + 0xa856: 68, + 0xa857: 68, + 0xa858: 68, + 0xa859: 68, + 0xa85a: 68, + 0xa85b: 68, + 0xa85c: 68, + 0xa85d: 68, + 0xa85e: 68, + 0xa85f: 68, + 0xa860: 68, + 0xa861: 68, + 0xa862: 68, + 0xa863: 68, + 0xa864: 68, + 0xa865: 68, + 0xa866: 68, + 0xa867: 68, + 0xa868: 68, + 0xa869: 68, + 0xa86a: 68, + 0xa86b: 68, + 0xa86c: 68, + 0xa86d: 68, + 0xa86e: 68, + 0xa86f: 68, + 0xa870: 68, + 0xa871: 68, + 0xa872: 76, + 0xa873: 85, + 0x10ac0: 68, + 0x10ac1: 68, + 0x10ac2: 68, + 0x10ac3: 68, + 0x10ac4: 68, + 0x10ac5: 82, + 0x10ac6: 85, + 0x10ac7: 82, + 0x10ac8: 85, + 0x10ac9: 82, + 0x10aca: 82, + 0x10acb: 85, + 0x10acc: 85, + 0x10acd: 76, + 0x10ace: 82, + 0x10acf: 82, + 0x10ad0: 82, + 0x10ad1: 82, + 0x10ad2: 82, + 0x10ad3: 68, + 0x10ad4: 68, + 0x10ad5: 68, + 0x10ad6: 68, + 0x10ad7: 76, + 0x10ad8: 68, + 0x10ad9: 68, + 0x10ada: 68, + 0x10adb: 68, + 0x10adc: 68, + 0x10add: 82, + 0x10ade: 68, + 0x10adf: 68, + 0x10ae0: 68, + 0x10ae1: 82, + 0x10ae2: 85, + 0x10ae3: 85, + 0x10ae4: 82, + 0x10aeb: 68, + 0x10aec: 68, + 0x10aed: 68, + 0x10aee: 68, + 0x10aef: 82, + 0x10b80: 68, + 0x10b81: 82, + 0x10b82: 68, + 0x10b83: 82, + 0x10b84: 82, + 0x10b85: 82, + 0x10b86: 68, + 0x10b87: 68, + 0x10b88: 68, + 0x10b89: 82, + 0x10b8a: 68, + 0x10b8b: 68, + 0x10b8c: 82, + 0x10b8d: 68, + 0x10b8e: 82, + 0x10b8f: 82, + 0x10b90: 68, + 0x10b91: 82, + 0x10ba9: 82, + 0x10baa: 82, + 0x10bab: 82, + 0x10bac: 82, + 0x10bad: 68, + 0x10bae: 68, + 0x10baf: 85, + 0x10d00: 76, + 0x10d01: 68, + 0x10d02: 68, + 0x10d03: 68, + 0x10d04: 68, + 0x10d05: 68, + 0x10d06: 68, + 0x10d07: 68, + 0x10d08: 68, + 0x10d09: 68, + 0x10d0a: 68, + 0x10d0b: 68, + 0x10d0c: 68, + 0x10d0d: 68, + 0x10d0e: 68, + 0x10d0f: 68, + 0x10d10: 68, + 0x10d11: 68, + 0x10d12: 68, + 0x10d13: 68, + 0x10d14: 68, + 0x10d15: 68, + 0x10d16: 68, + 0x10d17: 68, + 0x10d18: 68, + 0x10d19: 68, + 0x10d1a: 68, + 0x10d1b: 68, + 0x10d1c: 68, + 0x10d1d: 68, + 0x10d1e: 68, + 0x10d1f: 68, + 0x10d20: 68, + 0x10d21: 68, + 0x10d22: 82, + 0x10d23: 68, + 0x10f30: 68, + 0x10f31: 68, + 0x10f32: 68, + 0x10f33: 82, + 0x10f34: 68, + 0x10f35: 68, + 0x10f36: 68, + 0x10f37: 68, + 0x10f38: 68, + 0x10f39: 68, + 0x10f3a: 68, + 0x10f3b: 68, + 0x10f3c: 68, + 0x10f3d: 68, + 0x10f3e: 68, + 0x10f3f: 68, + 0x10f40: 68, + 0x10f41: 68, + 0x10f42: 68, + 0x10f43: 68, + 0x10f44: 68, + 0x10f45: 85, + 0x10f51: 68, + 0x10f52: 68, + 0x10f53: 68, + 0x10f54: 82, + 0x10f70: 68, + 0x10f71: 68, + 0x10f72: 68, + 0x10f73: 68, + 0x10f74: 82, + 0x10f75: 82, + 0x10f76: 68, + 0x10f77: 68, + 0x10f78: 68, + 0x10f79: 68, + 0x10f7a: 68, + 0x10f7b: 68, + 0x10f7c: 68, + 0x10f7d: 68, + 0x10f7e: 68, + 0x10f7f: 68, + 0x10f80: 68, + 0x10f81: 68, + 0x10fb0: 68, + 0x10fb1: 85, + 0x10fb2: 68, + 0x10fb3: 68, + 0x10fb4: 82, + 0x10fb5: 82, + 0x10fb6: 82, + 0x10fb7: 85, + 0x10fb8: 68, + 0x10fb9: 82, + 0x10fba: 82, + 0x10fbb: 68, + 0x10fbc: 68, + 0x10fbd: 82, + 0x10fbe: 68, + 0x10fbf: 68, + 0x10fc0: 85, + 0x10fc1: 68, + 0x10fc2: 82, + 0x10fc3: 82, + 0x10fc4: 68, + 0x10fc5: 85, + 0x10fc6: 85, + 0x10fc7: 85, + 0x10fc8: 85, + 0x10fc9: 82, + 0x10fca: 68, + 0x10fcb: 76, + 0x110bd: 85, + 0x110cd: 85, + 0x1e900: 68, + 0x1e901: 68, + 0x1e902: 68, + 0x1e903: 68, + 0x1e904: 68, + 0x1e905: 68, + 0x1e906: 68, + 0x1e907: 68, + 0x1e908: 68, + 0x1e909: 68, + 0x1e90a: 68, + 0x1e90b: 68, + 0x1e90c: 68, + 0x1e90d: 68, + 0x1e90e: 68, + 0x1e90f: 68, + 0x1e910: 68, + 0x1e911: 68, + 0x1e912: 68, + 0x1e913: 68, + 0x1e914: 68, + 0x1e915: 68, + 0x1e916: 68, + 0x1e917: 68, + 0x1e918: 68, + 0x1e919: 68, + 0x1e91a: 68, + 0x1e91b: 68, + 0x1e91c: 68, + 0x1e91d: 68, + 0x1e91e: 68, + 0x1e91f: 68, + 0x1e920: 68, + 0x1e921: 68, + 0x1e922: 68, + 0x1e923: 68, + 0x1e924: 68, + 0x1e925: 68, + 0x1e926: 68, + 0x1e927: 68, + 0x1e928: 68, + 0x1e929: 68, + 0x1e92a: 68, + 0x1e92b: 68, + 0x1e92c: 68, + 0x1e92d: 68, + 0x1e92e: 68, + 0x1e92f: 68, + 0x1e930: 68, + 0x1e931: 68, + 0x1e932: 68, + 0x1e933: 68, + 0x1e934: 68, + 0x1e935: 68, + 0x1e936: 68, + 0x1e937: 68, + 0x1e938: 68, + 0x1e939: 68, + 0x1e93a: 68, + 0x1e93b: 68, + 0x1e93c: 68, + 0x1e93d: 68, + 0x1e93e: 68, + 0x1e93f: 68, + 0x1e940: 68, + 0x1e941: 68, + 0x1e942: 68, + 0x1e943: 68, + 0x1e94b: 84, +} +codepoint_classes = { + 'PVALID': ( + 0x2d0000002e, + 0x300000003a, + 0x610000007b, + 0xdf000000f7, + 0xf800000100, + 0x10100000102, + 0x10300000104, + 0x10500000106, + 0x10700000108, + 0x1090000010a, + 0x10b0000010c, + 0x10d0000010e, + 0x10f00000110, + 0x11100000112, + 0x11300000114, + 0x11500000116, + 0x11700000118, + 0x1190000011a, + 0x11b0000011c, + 0x11d0000011e, + 0x11f00000120, + 0x12100000122, + 0x12300000124, + 0x12500000126, + 0x12700000128, + 0x1290000012a, + 0x12b0000012c, + 0x12d0000012e, + 0x12f00000130, + 0x13100000132, + 0x13500000136, + 0x13700000139, + 0x13a0000013b, + 0x13c0000013d, + 0x13e0000013f, + 0x14200000143, + 0x14400000145, + 0x14600000147, + 0x14800000149, + 0x14b0000014c, + 0x14d0000014e, + 0x14f00000150, + 0x15100000152, + 0x15300000154, + 0x15500000156, + 0x15700000158, + 0x1590000015a, + 0x15b0000015c, + 0x15d0000015e, + 0x15f00000160, + 0x16100000162, + 0x16300000164, + 0x16500000166, + 0x16700000168, + 0x1690000016a, + 0x16b0000016c, + 0x16d0000016e, + 0x16f00000170, + 0x17100000172, + 0x17300000174, + 0x17500000176, + 0x17700000178, + 0x17a0000017b, + 0x17c0000017d, + 0x17e0000017f, + 0x18000000181, + 0x18300000184, + 0x18500000186, + 0x18800000189, + 0x18c0000018e, + 0x19200000193, + 0x19500000196, + 0x1990000019c, + 0x19e0000019f, + 0x1a1000001a2, + 0x1a3000001a4, + 0x1a5000001a6, + 0x1a8000001a9, + 0x1aa000001ac, + 0x1ad000001ae, + 0x1b0000001b1, + 0x1b4000001b5, + 0x1b6000001b7, + 0x1b9000001bc, + 0x1bd000001c4, + 0x1ce000001cf, + 0x1d0000001d1, + 0x1d2000001d3, + 0x1d4000001d5, + 0x1d6000001d7, + 0x1d8000001d9, + 0x1da000001db, + 0x1dc000001de, + 0x1df000001e0, + 0x1e1000001e2, + 0x1e3000001e4, + 0x1e5000001e6, + 0x1e7000001e8, + 0x1e9000001ea, + 0x1eb000001ec, + 0x1ed000001ee, + 0x1ef000001f1, + 0x1f5000001f6, + 0x1f9000001fa, + 0x1fb000001fc, + 0x1fd000001fe, + 0x1ff00000200, + 0x20100000202, + 0x20300000204, + 0x20500000206, + 0x20700000208, + 0x2090000020a, + 0x20b0000020c, + 0x20d0000020e, + 0x20f00000210, + 0x21100000212, + 0x21300000214, + 0x21500000216, + 0x21700000218, + 0x2190000021a, + 0x21b0000021c, + 0x21d0000021e, + 0x21f00000220, + 0x22100000222, + 0x22300000224, + 0x22500000226, + 0x22700000228, + 0x2290000022a, + 0x22b0000022c, + 0x22d0000022e, + 0x22f00000230, + 0x23100000232, + 0x2330000023a, + 0x23c0000023d, + 0x23f00000241, + 0x24200000243, + 0x24700000248, + 0x2490000024a, + 0x24b0000024c, + 0x24d0000024e, + 0x24f000002b0, + 0x2b9000002c2, + 0x2c6000002d2, + 0x2ec000002ed, + 0x2ee000002ef, + 0x30000000340, + 0x34200000343, + 0x3460000034f, + 0x35000000370, + 0x37100000372, + 0x37300000374, + 0x37700000378, + 0x37b0000037e, + 0x39000000391, + 0x3ac000003cf, + 0x3d7000003d8, + 0x3d9000003da, + 0x3db000003dc, + 0x3dd000003de, + 0x3df000003e0, + 0x3e1000003e2, + 0x3e3000003e4, + 0x3e5000003e6, + 0x3e7000003e8, + 0x3e9000003ea, + 0x3eb000003ec, + 0x3ed000003ee, + 0x3ef000003f0, + 0x3f3000003f4, + 0x3f8000003f9, + 0x3fb000003fd, + 0x43000000460, + 0x46100000462, + 0x46300000464, + 0x46500000466, + 0x46700000468, + 0x4690000046a, + 0x46b0000046c, + 0x46d0000046e, + 0x46f00000470, + 0x47100000472, + 0x47300000474, + 0x47500000476, + 0x47700000478, + 0x4790000047a, + 0x47b0000047c, + 0x47d0000047e, + 0x47f00000480, + 0x48100000482, + 0x48300000488, + 0x48b0000048c, + 0x48d0000048e, + 0x48f00000490, + 0x49100000492, + 0x49300000494, + 0x49500000496, + 0x49700000498, + 0x4990000049a, + 0x49b0000049c, + 0x49d0000049e, + 0x49f000004a0, + 0x4a1000004a2, + 0x4a3000004a4, + 0x4a5000004a6, + 0x4a7000004a8, + 0x4a9000004aa, + 0x4ab000004ac, + 0x4ad000004ae, + 0x4af000004b0, + 0x4b1000004b2, + 0x4b3000004b4, + 0x4b5000004b6, + 0x4b7000004b8, + 0x4b9000004ba, + 0x4bb000004bc, + 0x4bd000004be, + 0x4bf000004c0, + 0x4c2000004c3, + 0x4c4000004c5, + 0x4c6000004c7, + 0x4c8000004c9, + 0x4ca000004cb, + 0x4cc000004cd, + 0x4ce000004d0, + 0x4d1000004d2, + 0x4d3000004d4, + 0x4d5000004d6, + 0x4d7000004d8, + 0x4d9000004da, + 0x4db000004dc, + 0x4dd000004de, + 0x4df000004e0, + 0x4e1000004e2, + 0x4e3000004e4, + 0x4e5000004e6, + 0x4e7000004e8, + 0x4e9000004ea, + 0x4eb000004ec, + 0x4ed000004ee, + 0x4ef000004f0, + 0x4f1000004f2, + 0x4f3000004f4, + 0x4f5000004f6, + 0x4f7000004f8, + 0x4f9000004fa, + 0x4fb000004fc, + 0x4fd000004fe, + 0x4ff00000500, + 0x50100000502, + 0x50300000504, + 0x50500000506, + 0x50700000508, + 0x5090000050a, + 0x50b0000050c, + 0x50d0000050e, + 0x50f00000510, + 0x51100000512, + 0x51300000514, + 0x51500000516, + 0x51700000518, + 0x5190000051a, + 0x51b0000051c, + 0x51d0000051e, + 0x51f00000520, + 0x52100000522, + 0x52300000524, + 0x52500000526, + 0x52700000528, + 0x5290000052a, + 0x52b0000052c, + 0x52d0000052e, + 0x52f00000530, + 0x5590000055a, + 0x56000000587, + 0x58800000589, + 0x591000005be, + 0x5bf000005c0, + 0x5c1000005c3, + 0x5c4000005c6, + 0x5c7000005c8, + 0x5d0000005eb, + 0x5ef000005f3, + 0x6100000061b, + 0x62000000640, + 0x64100000660, + 0x66e00000675, + 0x679000006d4, + 0x6d5000006dd, + 0x6df000006e9, + 0x6ea000006f0, + 0x6fa00000700, + 0x7100000074b, + 0x74d000007b2, + 0x7c0000007f6, + 0x7fd000007fe, + 0x8000000082e, + 0x8400000085c, + 0x8600000086b, + 0x87000000888, + 0x8890000088f, + 0x898000008e2, + 0x8e300000958, + 0x96000000964, + 0x96600000970, + 0x97100000984, + 0x9850000098d, + 0x98f00000991, + 0x993000009a9, + 0x9aa000009b1, + 0x9b2000009b3, + 0x9b6000009ba, + 0x9bc000009c5, + 0x9c7000009c9, + 0x9cb000009cf, + 0x9d7000009d8, + 0x9e0000009e4, + 0x9e6000009f2, + 0x9fc000009fd, + 0x9fe000009ff, + 0xa0100000a04, + 0xa0500000a0b, + 0xa0f00000a11, + 0xa1300000a29, + 0xa2a00000a31, + 0xa3200000a33, + 0xa3500000a36, + 0xa3800000a3a, + 0xa3c00000a3d, + 0xa3e00000a43, + 0xa4700000a49, + 0xa4b00000a4e, + 0xa5100000a52, + 0xa5c00000a5d, + 0xa6600000a76, + 0xa8100000a84, + 0xa8500000a8e, + 0xa8f00000a92, + 0xa9300000aa9, + 0xaaa00000ab1, + 0xab200000ab4, + 0xab500000aba, + 0xabc00000ac6, + 0xac700000aca, + 0xacb00000ace, + 0xad000000ad1, + 0xae000000ae4, + 0xae600000af0, + 0xaf900000b00, + 0xb0100000b04, + 0xb0500000b0d, + 0xb0f00000b11, + 0xb1300000b29, + 0xb2a00000b31, + 0xb3200000b34, + 0xb3500000b3a, + 0xb3c00000b45, + 0xb4700000b49, + 0xb4b00000b4e, + 0xb5500000b58, + 0xb5f00000b64, + 0xb6600000b70, + 0xb7100000b72, + 0xb8200000b84, + 0xb8500000b8b, + 0xb8e00000b91, + 0xb9200000b96, + 0xb9900000b9b, + 0xb9c00000b9d, + 0xb9e00000ba0, + 0xba300000ba5, + 0xba800000bab, + 0xbae00000bba, + 0xbbe00000bc3, + 0xbc600000bc9, + 0xbca00000bce, + 0xbd000000bd1, + 0xbd700000bd8, + 0xbe600000bf0, + 0xc0000000c0d, + 0xc0e00000c11, + 0xc1200000c29, + 0xc2a00000c3a, + 0xc3c00000c45, + 0xc4600000c49, + 0xc4a00000c4e, + 0xc5500000c57, + 0xc5800000c5b, + 0xc5d00000c5e, + 0xc6000000c64, + 0xc6600000c70, + 0xc8000000c84, + 0xc8500000c8d, + 0xc8e00000c91, + 0xc9200000ca9, + 0xcaa00000cb4, + 0xcb500000cba, + 0xcbc00000cc5, + 0xcc600000cc9, + 0xcca00000cce, + 0xcd500000cd7, + 0xcdd00000cdf, + 0xce000000ce4, + 0xce600000cf0, + 0xcf100000cf4, + 0xd0000000d0d, + 0xd0e00000d11, + 0xd1200000d45, + 0xd4600000d49, + 0xd4a00000d4f, + 0xd5400000d58, + 0xd5f00000d64, + 0xd6600000d70, + 0xd7a00000d80, + 0xd8100000d84, + 0xd8500000d97, + 0xd9a00000db2, + 0xdb300000dbc, + 0xdbd00000dbe, + 0xdc000000dc7, + 0xdca00000dcb, + 0xdcf00000dd5, + 0xdd600000dd7, + 0xdd800000de0, + 0xde600000df0, + 0xdf200000df4, + 0xe0100000e33, + 0xe3400000e3b, + 0xe4000000e4f, + 0xe5000000e5a, + 0xe8100000e83, + 0xe8400000e85, + 0xe8600000e8b, + 0xe8c00000ea4, + 0xea500000ea6, + 0xea700000eb3, + 0xeb400000ebe, + 0xec000000ec5, + 0xec600000ec7, + 0xec800000ecf, + 0xed000000eda, + 0xede00000ee0, + 0xf0000000f01, + 0xf0b00000f0c, + 0xf1800000f1a, + 0xf2000000f2a, + 0xf3500000f36, + 0xf3700000f38, + 0xf3900000f3a, + 0xf3e00000f43, + 0xf4400000f48, + 0xf4900000f4d, + 0xf4e00000f52, + 0xf5300000f57, + 0xf5800000f5c, + 0xf5d00000f69, + 0xf6a00000f6d, + 0xf7100000f73, + 0xf7400000f75, + 0xf7a00000f81, + 0xf8200000f85, + 0xf8600000f93, + 0xf9400000f98, + 0xf9900000f9d, + 0xf9e00000fa2, + 0xfa300000fa7, + 0xfa800000fac, + 0xfad00000fb9, + 0xfba00000fbd, + 0xfc600000fc7, + 0x10000000104a, + 0x10500000109e, + 0x10d0000010fb, + 0x10fd00001100, + 0x120000001249, + 0x124a0000124e, + 0x125000001257, + 0x125800001259, + 0x125a0000125e, + 0x126000001289, + 0x128a0000128e, + 0x1290000012b1, + 0x12b2000012b6, + 0x12b8000012bf, + 0x12c0000012c1, + 0x12c2000012c6, + 0x12c8000012d7, + 0x12d800001311, + 0x131200001316, + 0x13180000135b, + 0x135d00001360, + 0x138000001390, + 0x13a0000013f6, + 0x14010000166d, + 0x166f00001680, + 0x16810000169b, + 0x16a0000016eb, + 0x16f1000016f9, + 0x170000001716, + 0x171f00001735, + 0x174000001754, + 0x17600000176d, + 0x176e00001771, + 0x177200001774, + 0x1780000017b4, + 0x17b6000017d4, + 0x17d7000017d8, + 0x17dc000017de, + 0x17e0000017ea, + 0x18100000181a, + 0x182000001879, + 0x1880000018ab, + 0x18b0000018f6, + 0x19000000191f, + 0x19200000192c, + 0x19300000193c, + 0x19460000196e, + 0x197000001975, + 0x1980000019ac, + 0x19b0000019ca, + 0x19d0000019da, + 0x1a0000001a1c, + 0x1a2000001a5f, + 0x1a6000001a7d, + 0x1a7f00001a8a, + 0x1a9000001a9a, + 0x1aa700001aa8, + 0x1ab000001abe, + 0x1abf00001acf, + 0x1b0000001b4d, + 0x1b5000001b5a, + 0x1b6b00001b74, + 0x1b8000001bf4, + 0x1c0000001c38, + 0x1c4000001c4a, + 0x1c4d00001c7e, + 0x1cd000001cd3, + 0x1cd400001cfb, + 0x1d0000001d2c, + 0x1d2f00001d30, + 0x1d3b00001d3c, + 0x1d4e00001d4f, + 0x1d6b00001d78, + 0x1d7900001d9b, + 0x1dc000001e00, + 0x1e0100001e02, + 0x1e0300001e04, + 0x1e0500001e06, + 0x1e0700001e08, + 0x1e0900001e0a, + 0x1e0b00001e0c, + 0x1e0d00001e0e, + 0x1e0f00001e10, + 0x1e1100001e12, + 0x1e1300001e14, + 0x1e1500001e16, + 0x1e1700001e18, + 0x1e1900001e1a, + 0x1e1b00001e1c, + 0x1e1d00001e1e, + 0x1e1f00001e20, + 0x1e2100001e22, + 0x1e2300001e24, + 0x1e2500001e26, + 0x1e2700001e28, + 0x1e2900001e2a, + 0x1e2b00001e2c, + 0x1e2d00001e2e, + 0x1e2f00001e30, + 0x1e3100001e32, + 0x1e3300001e34, + 0x1e3500001e36, + 0x1e3700001e38, + 0x1e3900001e3a, + 0x1e3b00001e3c, + 0x1e3d00001e3e, + 0x1e3f00001e40, + 0x1e4100001e42, + 0x1e4300001e44, + 0x1e4500001e46, + 0x1e4700001e48, + 0x1e4900001e4a, + 0x1e4b00001e4c, + 0x1e4d00001e4e, + 0x1e4f00001e50, + 0x1e5100001e52, + 0x1e5300001e54, + 0x1e5500001e56, + 0x1e5700001e58, + 0x1e5900001e5a, + 0x1e5b00001e5c, + 0x1e5d00001e5e, + 0x1e5f00001e60, + 0x1e6100001e62, + 0x1e6300001e64, + 0x1e6500001e66, + 0x1e6700001e68, + 0x1e6900001e6a, + 0x1e6b00001e6c, + 0x1e6d00001e6e, + 0x1e6f00001e70, + 0x1e7100001e72, + 0x1e7300001e74, + 0x1e7500001e76, + 0x1e7700001e78, + 0x1e7900001e7a, + 0x1e7b00001e7c, + 0x1e7d00001e7e, + 0x1e7f00001e80, + 0x1e8100001e82, + 0x1e8300001e84, + 0x1e8500001e86, + 0x1e8700001e88, + 0x1e8900001e8a, + 0x1e8b00001e8c, + 0x1e8d00001e8e, + 0x1e8f00001e90, + 0x1e9100001e92, + 0x1e9300001e94, + 0x1e9500001e9a, + 0x1e9c00001e9e, + 0x1e9f00001ea0, + 0x1ea100001ea2, + 0x1ea300001ea4, + 0x1ea500001ea6, + 0x1ea700001ea8, + 0x1ea900001eaa, + 0x1eab00001eac, + 0x1ead00001eae, + 0x1eaf00001eb0, + 0x1eb100001eb2, + 0x1eb300001eb4, + 0x1eb500001eb6, + 0x1eb700001eb8, + 0x1eb900001eba, + 0x1ebb00001ebc, + 0x1ebd00001ebe, + 0x1ebf00001ec0, + 0x1ec100001ec2, + 0x1ec300001ec4, + 0x1ec500001ec6, + 0x1ec700001ec8, + 0x1ec900001eca, + 0x1ecb00001ecc, + 0x1ecd00001ece, + 0x1ecf00001ed0, + 0x1ed100001ed2, + 0x1ed300001ed4, + 0x1ed500001ed6, + 0x1ed700001ed8, + 0x1ed900001eda, + 0x1edb00001edc, + 0x1edd00001ede, + 0x1edf00001ee0, + 0x1ee100001ee2, + 0x1ee300001ee4, + 0x1ee500001ee6, + 0x1ee700001ee8, + 0x1ee900001eea, + 0x1eeb00001eec, + 0x1eed00001eee, + 0x1eef00001ef0, + 0x1ef100001ef2, + 0x1ef300001ef4, + 0x1ef500001ef6, + 0x1ef700001ef8, + 0x1ef900001efa, + 0x1efb00001efc, + 0x1efd00001efe, + 0x1eff00001f08, + 0x1f1000001f16, + 0x1f2000001f28, + 0x1f3000001f38, + 0x1f4000001f46, + 0x1f5000001f58, + 0x1f6000001f68, + 0x1f7000001f71, + 0x1f7200001f73, + 0x1f7400001f75, + 0x1f7600001f77, + 0x1f7800001f79, + 0x1f7a00001f7b, + 0x1f7c00001f7d, + 0x1fb000001fb2, + 0x1fb600001fb7, + 0x1fc600001fc7, + 0x1fd000001fd3, + 0x1fd600001fd8, + 0x1fe000001fe3, + 0x1fe400001fe8, + 0x1ff600001ff7, + 0x214e0000214f, + 0x218400002185, + 0x2c3000002c60, + 0x2c6100002c62, + 0x2c6500002c67, + 0x2c6800002c69, + 0x2c6a00002c6b, + 0x2c6c00002c6d, + 0x2c7100002c72, + 0x2c7300002c75, + 0x2c7600002c7c, + 0x2c8100002c82, + 0x2c8300002c84, + 0x2c8500002c86, + 0x2c8700002c88, + 0x2c8900002c8a, + 0x2c8b00002c8c, + 0x2c8d00002c8e, + 0x2c8f00002c90, + 0x2c9100002c92, + 0x2c9300002c94, + 0x2c9500002c96, + 0x2c9700002c98, + 0x2c9900002c9a, + 0x2c9b00002c9c, + 0x2c9d00002c9e, + 0x2c9f00002ca0, + 0x2ca100002ca2, + 0x2ca300002ca4, + 0x2ca500002ca6, + 0x2ca700002ca8, + 0x2ca900002caa, + 0x2cab00002cac, + 0x2cad00002cae, + 0x2caf00002cb0, + 0x2cb100002cb2, + 0x2cb300002cb4, + 0x2cb500002cb6, + 0x2cb700002cb8, + 0x2cb900002cba, + 0x2cbb00002cbc, + 0x2cbd00002cbe, + 0x2cbf00002cc0, + 0x2cc100002cc2, + 0x2cc300002cc4, + 0x2cc500002cc6, + 0x2cc700002cc8, + 0x2cc900002cca, + 0x2ccb00002ccc, + 0x2ccd00002cce, + 0x2ccf00002cd0, + 0x2cd100002cd2, + 0x2cd300002cd4, + 0x2cd500002cd6, + 0x2cd700002cd8, + 0x2cd900002cda, + 0x2cdb00002cdc, + 0x2cdd00002cde, + 0x2cdf00002ce0, + 0x2ce100002ce2, + 0x2ce300002ce5, + 0x2cec00002ced, + 0x2cee00002cf2, + 0x2cf300002cf4, + 0x2d0000002d26, + 0x2d2700002d28, + 0x2d2d00002d2e, + 0x2d3000002d68, + 0x2d7f00002d97, + 0x2da000002da7, + 0x2da800002daf, + 0x2db000002db7, + 0x2db800002dbf, + 0x2dc000002dc7, + 0x2dc800002dcf, + 0x2dd000002dd7, + 0x2dd800002ddf, + 0x2de000002e00, + 0x2e2f00002e30, + 0x300500003008, + 0x302a0000302e, + 0x303c0000303d, + 0x304100003097, + 0x30990000309b, + 0x309d0000309f, + 0x30a1000030fb, + 0x30fc000030ff, + 0x310500003130, + 0x31a0000031c0, + 0x31f000003200, + 0x340000004dc0, + 0x4e000000a48d, + 0xa4d00000a4fe, + 0xa5000000a60d, + 0xa6100000a62c, + 0xa6410000a642, + 0xa6430000a644, + 0xa6450000a646, + 0xa6470000a648, + 0xa6490000a64a, + 0xa64b0000a64c, + 0xa64d0000a64e, + 0xa64f0000a650, + 0xa6510000a652, + 0xa6530000a654, + 0xa6550000a656, + 0xa6570000a658, + 0xa6590000a65a, + 0xa65b0000a65c, + 0xa65d0000a65e, + 0xa65f0000a660, + 0xa6610000a662, + 0xa6630000a664, + 0xa6650000a666, + 0xa6670000a668, + 0xa6690000a66a, + 0xa66b0000a66c, + 0xa66d0000a670, + 0xa6740000a67e, + 0xa67f0000a680, + 0xa6810000a682, + 0xa6830000a684, + 0xa6850000a686, + 0xa6870000a688, + 0xa6890000a68a, + 0xa68b0000a68c, + 0xa68d0000a68e, + 0xa68f0000a690, + 0xa6910000a692, + 0xa6930000a694, + 0xa6950000a696, + 0xa6970000a698, + 0xa6990000a69a, + 0xa69b0000a69c, + 0xa69e0000a6e6, + 0xa6f00000a6f2, + 0xa7170000a720, + 0xa7230000a724, + 0xa7250000a726, + 0xa7270000a728, + 0xa7290000a72a, + 0xa72b0000a72c, + 0xa72d0000a72e, + 0xa72f0000a732, + 0xa7330000a734, + 0xa7350000a736, + 0xa7370000a738, + 0xa7390000a73a, + 0xa73b0000a73c, + 0xa73d0000a73e, + 0xa73f0000a740, + 0xa7410000a742, + 0xa7430000a744, + 0xa7450000a746, + 0xa7470000a748, + 0xa7490000a74a, + 0xa74b0000a74c, + 0xa74d0000a74e, + 0xa74f0000a750, + 0xa7510000a752, + 0xa7530000a754, + 0xa7550000a756, + 0xa7570000a758, + 0xa7590000a75a, + 0xa75b0000a75c, + 0xa75d0000a75e, + 0xa75f0000a760, + 0xa7610000a762, + 0xa7630000a764, + 0xa7650000a766, + 0xa7670000a768, + 0xa7690000a76a, + 0xa76b0000a76c, + 0xa76d0000a76e, + 0xa76f0000a770, + 0xa7710000a779, + 0xa77a0000a77b, + 0xa77c0000a77d, + 0xa77f0000a780, + 0xa7810000a782, + 0xa7830000a784, + 0xa7850000a786, + 0xa7870000a789, + 0xa78c0000a78d, + 0xa78e0000a790, + 0xa7910000a792, + 0xa7930000a796, + 0xa7970000a798, + 0xa7990000a79a, + 0xa79b0000a79c, + 0xa79d0000a79e, + 0xa79f0000a7a0, + 0xa7a10000a7a2, + 0xa7a30000a7a4, + 0xa7a50000a7a6, + 0xa7a70000a7a8, + 0xa7a90000a7aa, + 0xa7af0000a7b0, + 0xa7b50000a7b6, + 0xa7b70000a7b8, + 0xa7b90000a7ba, + 0xa7bb0000a7bc, + 0xa7bd0000a7be, + 0xa7bf0000a7c0, + 0xa7c10000a7c2, + 0xa7c30000a7c4, + 0xa7c80000a7c9, + 0xa7ca0000a7cb, + 0xa7d10000a7d2, + 0xa7d30000a7d4, + 0xa7d50000a7d6, + 0xa7d70000a7d8, + 0xa7d90000a7da, + 0xa7f20000a7f5, + 0xa7f60000a7f8, + 0xa7fa0000a828, + 0xa82c0000a82d, + 0xa8400000a874, + 0xa8800000a8c6, + 0xa8d00000a8da, + 0xa8e00000a8f8, + 0xa8fb0000a8fc, + 0xa8fd0000a92e, + 0xa9300000a954, + 0xa9800000a9c1, + 0xa9cf0000a9da, + 0xa9e00000a9ff, + 0xaa000000aa37, + 0xaa400000aa4e, + 0xaa500000aa5a, + 0xaa600000aa77, + 0xaa7a0000aac3, + 0xaadb0000aade, + 0xaae00000aaf0, + 0xaaf20000aaf7, + 0xab010000ab07, + 0xab090000ab0f, + 0xab110000ab17, + 0xab200000ab27, + 0xab280000ab2f, + 0xab300000ab5b, + 0xab600000ab69, + 0xabc00000abeb, + 0xabec0000abee, + 0xabf00000abfa, + 0xac000000d7a4, + 0xfa0e0000fa10, + 0xfa110000fa12, + 0xfa130000fa15, + 0xfa1f0000fa20, + 0xfa210000fa22, + 0xfa230000fa25, + 0xfa270000fa2a, + 0xfb1e0000fb1f, + 0xfe200000fe30, + 0xfe730000fe74, + 0x100000001000c, + 0x1000d00010027, + 0x100280001003b, + 0x1003c0001003e, + 0x1003f0001004e, + 0x100500001005e, + 0x10080000100fb, + 0x101fd000101fe, + 0x102800001029d, + 0x102a0000102d1, + 0x102e0000102e1, + 0x1030000010320, + 0x1032d00010341, + 0x103420001034a, + 0x103500001037b, + 0x103800001039e, + 0x103a0000103c4, + 0x103c8000103d0, + 0x104280001049e, + 0x104a0000104aa, + 0x104d8000104fc, + 0x1050000010528, + 0x1053000010564, + 0x10597000105a2, + 0x105a3000105b2, + 0x105b3000105ba, + 0x105bb000105bd, + 0x1060000010737, + 0x1074000010756, + 0x1076000010768, + 0x1078000010786, + 0x10787000107b1, + 0x107b2000107bb, + 0x1080000010806, + 0x1080800010809, + 0x1080a00010836, + 0x1083700010839, + 0x1083c0001083d, + 0x1083f00010856, + 0x1086000010877, + 0x108800001089f, + 0x108e0000108f3, + 0x108f4000108f6, + 0x1090000010916, + 0x109200001093a, + 0x10980000109b8, + 0x109be000109c0, + 0x10a0000010a04, + 0x10a0500010a07, + 0x10a0c00010a14, + 0x10a1500010a18, + 0x10a1900010a36, + 0x10a3800010a3b, + 0x10a3f00010a40, + 0x10a6000010a7d, + 0x10a8000010a9d, + 0x10ac000010ac8, + 0x10ac900010ae7, + 0x10b0000010b36, + 0x10b4000010b56, + 0x10b6000010b73, + 0x10b8000010b92, + 0x10c0000010c49, + 0x10cc000010cf3, + 0x10d0000010d28, + 0x10d3000010d3a, + 0x10e8000010eaa, + 0x10eab00010ead, + 0x10eb000010eb2, + 0x10efd00010f1d, + 0x10f2700010f28, + 0x10f3000010f51, + 0x10f7000010f86, + 0x10fb000010fc5, + 0x10fe000010ff7, + 0x1100000011047, + 0x1106600011076, + 0x1107f000110bb, + 0x110c2000110c3, + 0x110d0000110e9, + 0x110f0000110fa, + 0x1110000011135, + 0x1113600011140, + 0x1114400011148, + 0x1115000011174, + 0x1117600011177, + 0x11180000111c5, + 0x111c9000111cd, + 0x111ce000111db, + 0x111dc000111dd, + 0x1120000011212, + 0x1121300011238, + 0x1123e00011242, + 0x1128000011287, + 0x1128800011289, + 0x1128a0001128e, + 0x1128f0001129e, + 0x1129f000112a9, + 0x112b0000112eb, + 0x112f0000112fa, + 0x1130000011304, + 0x113050001130d, + 0x1130f00011311, + 0x1131300011329, + 0x1132a00011331, + 0x1133200011334, + 0x113350001133a, + 0x1133b00011345, + 0x1134700011349, + 0x1134b0001134e, + 0x1135000011351, + 0x1135700011358, + 0x1135d00011364, + 0x113660001136d, + 0x1137000011375, + 0x114000001144b, + 0x114500001145a, + 0x1145e00011462, + 0x11480000114c6, + 0x114c7000114c8, + 0x114d0000114da, + 0x11580000115b6, + 0x115b8000115c1, + 0x115d8000115de, + 0x1160000011641, + 0x1164400011645, + 0x116500001165a, + 0x11680000116b9, + 0x116c0000116ca, + 0x117000001171b, + 0x1171d0001172c, + 0x117300001173a, + 0x1174000011747, + 0x118000001183b, + 0x118c0000118ea, + 0x118ff00011907, + 0x119090001190a, + 0x1190c00011914, + 0x1191500011917, + 0x1191800011936, + 0x1193700011939, + 0x1193b00011944, + 0x119500001195a, + 0x119a0000119a8, + 0x119aa000119d8, + 0x119da000119e2, + 0x119e3000119e5, + 0x11a0000011a3f, + 0x11a4700011a48, + 0x11a5000011a9a, + 0x11a9d00011a9e, + 0x11ab000011af9, + 0x11c0000011c09, + 0x11c0a00011c37, + 0x11c3800011c41, + 0x11c5000011c5a, + 0x11c7200011c90, + 0x11c9200011ca8, + 0x11ca900011cb7, + 0x11d0000011d07, + 0x11d0800011d0a, + 0x11d0b00011d37, + 0x11d3a00011d3b, + 0x11d3c00011d3e, + 0x11d3f00011d48, + 0x11d5000011d5a, + 0x11d6000011d66, + 0x11d6700011d69, + 0x11d6a00011d8f, + 0x11d9000011d92, + 0x11d9300011d99, + 0x11da000011daa, + 0x11ee000011ef7, + 0x11f0000011f11, + 0x11f1200011f3b, + 0x11f3e00011f43, + 0x11f5000011f5a, + 0x11fb000011fb1, + 0x120000001239a, + 0x1248000012544, + 0x12f9000012ff1, + 0x1300000013430, + 0x1344000013456, + 0x1440000014647, + 0x1680000016a39, + 0x16a4000016a5f, + 0x16a6000016a6a, + 0x16a7000016abf, + 0x16ac000016aca, + 0x16ad000016aee, + 0x16af000016af5, + 0x16b0000016b37, + 0x16b4000016b44, + 0x16b5000016b5a, + 0x16b6300016b78, + 0x16b7d00016b90, + 0x16e6000016e80, + 0x16f0000016f4b, + 0x16f4f00016f88, + 0x16f8f00016fa0, + 0x16fe000016fe2, + 0x16fe300016fe5, + 0x16ff000016ff2, + 0x17000000187f8, + 0x1880000018cd6, + 0x18d0000018d09, + 0x1aff00001aff4, + 0x1aff50001affc, + 0x1affd0001afff, + 0x1b0000001b123, + 0x1b1320001b133, + 0x1b1500001b153, + 0x1b1550001b156, + 0x1b1640001b168, + 0x1b1700001b2fc, + 0x1bc000001bc6b, + 0x1bc700001bc7d, + 0x1bc800001bc89, + 0x1bc900001bc9a, + 0x1bc9d0001bc9f, + 0x1cf000001cf2e, + 0x1cf300001cf47, + 0x1da000001da37, + 0x1da3b0001da6d, + 0x1da750001da76, + 0x1da840001da85, + 0x1da9b0001daa0, + 0x1daa10001dab0, + 0x1df000001df1f, + 0x1df250001df2b, + 0x1e0000001e007, + 0x1e0080001e019, + 0x1e01b0001e022, + 0x1e0230001e025, + 0x1e0260001e02b, + 0x1e0300001e06e, + 0x1e08f0001e090, + 0x1e1000001e12d, + 0x1e1300001e13e, + 0x1e1400001e14a, + 0x1e14e0001e14f, + 0x1e2900001e2af, + 0x1e2c00001e2fa, + 0x1e4d00001e4fa, + 0x1e7e00001e7e7, + 0x1e7e80001e7ec, + 0x1e7ed0001e7ef, + 0x1e7f00001e7ff, + 0x1e8000001e8c5, + 0x1e8d00001e8d7, + 0x1e9220001e94c, + 0x1e9500001e95a, + 0x200000002a6e0, + 0x2a7000002b73a, + 0x2b7400002b81e, + 0x2b8200002cea2, + 0x2ceb00002ebe1, + 0x300000003134b, + 0x31350000323b0, + ), + 'CONTEXTJ': ( + 0x200c0000200e, + ), + 'CONTEXTO': ( + 0xb7000000b8, + 0x37500000376, + 0x5f3000005f5, + 0x6600000066a, + 0x6f0000006fa, + 0x30fb000030fc, + ), +} diff --git a/billinglayer/python/idna/intranges.py b/billinglayer/python/idna/intranges.py new file mode 100644 index 0000000..6a43b04 --- /dev/null +++ b/billinglayer/python/idna/intranges.py @@ -0,0 +1,54 @@ +""" +Given a list of integers, made up of (hopefully) a small number of long runs +of consecutive integers, compute a representation of the form +((start1, end1), (start2, end2) ...). Then answer the question "was x present +in the original list?" in time O(log(# runs)). +""" + +import bisect +from typing import List, Tuple + +def intranges_from_list(list_: List[int]) -> Tuple[int, ...]: + """Represent a list of integers as a sequence of ranges: + ((start_0, end_0), (start_1, end_1), ...), such that the original + integers are exactly those x such that start_i <= x < end_i for some i. + + Ranges are encoded as single integers (start << 32 | end), not as tuples. + """ + + sorted_list = sorted(list_) + ranges = [] + last_write = -1 + for i in range(len(sorted_list)): + if i+1 < len(sorted_list): + if sorted_list[i] == sorted_list[i+1]-1: + continue + current_range = sorted_list[last_write+1:i+1] + ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) + last_write = i + + return tuple(ranges) + +def _encode_range(start: int, end: int) -> int: + return (start << 32) | end + +def _decode_range(r: int) -> Tuple[int, int]: + return (r >> 32), (r & ((1 << 32) - 1)) + + +def intranges_contain(int_: int, ranges: Tuple[int, ...]) -> bool: + """Determine if `int_` falls into one of the ranges in `ranges`.""" + tuple_ = _encode_range(int_, 0) + pos = bisect.bisect_left(ranges, tuple_) + # we could be immediately ahead of a tuple (start, end) + # with start < int_ <= end + if pos > 0: + left, right = _decode_range(ranges[pos-1]) + if left <= int_ < right: + return True + # or we could be immediately behind a tuple (int_, end) + if pos < len(ranges): + left, _ = _decode_range(ranges[pos]) + if left == int_: + return True + return False diff --git a/billinglayer/python/idna/package_data.py b/billinglayer/python/idna/package_data.py new file mode 100644 index 0000000..8501893 --- /dev/null +++ b/billinglayer/python/idna/package_data.py @@ -0,0 +1,2 @@ +__version__ = '3.4' + diff --git a/billinglayer/python/idna/py.typed b/billinglayer/python/idna/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/idna/uts46data.py b/billinglayer/python/idna/uts46data.py new file mode 100644 index 0000000..186796c --- /dev/null +++ b/billinglayer/python/idna/uts46data.py @@ -0,0 +1,8600 @@ +# This file is automatically generated by tools/idna-data +# vim: set fileencoding=utf-8 : + +from typing import List, Tuple, Union + + +"""IDNA Mapping Table from UTS46.""" + + +__version__ = '15.0.0' +def _seg_0() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x0, '3'), + (0x1, '3'), + (0x2, '3'), + (0x3, '3'), + (0x4, '3'), + (0x5, '3'), + (0x6, '3'), + (0x7, '3'), + (0x8, '3'), + (0x9, '3'), + (0xA, '3'), + (0xB, '3'), + (0xC, '3'), + (0xD, '3'), + (0xE, '3'), + (0xF, '3'), + (0x10, '3'), + (0x11, '3'), + (0x12, '3'), + (0x13, '3'), + (0x14, '3'), + (0x15, '3'), + (0x16, '3'), + (0x17, '3'), + (0x18, '3'), + (0x19, '3'), + (0x1A, '3'), + (0x1B, '3'), + (0x1C, '3'), + (0x1D, '3'), + (0x1E, '3'), + (0x1F, '3'), + (0x20, '3'), + (0x21, '3'), + (0x22, '3'), + (0x23, '3'), + (0x24, '3'), + (0x25, '3'), + (0x26, '3'), + (0x27, '3'), + (0x28, '3'), + (0x29, '3'), + (0x2A, '3'), + (0x2B, '3'), + (0x2C, '3'), + (0x2D, 'V'), + (0x2E, 'V'), + (0x2F, '3'), + (0x30, 'V'), + (0x31, 'V'), + (0x32, 'V'), + (0x33, 'V'), + (0x34, 'V'), + (0x35, 'V'), + (0x36, 'V'), + (0x37, 'V'), + (0x38, 'V'), + (0x39, 'V'), + (0x3A, '3'), + (0x3B, '3'), + (0x3C, '3'), + (0x3D, '3'), + (0x3E, '3'), + (0x3F, '3'), + (0x40, '3'), + (0x41, 'M', 'a'), + (0x42, 'M', 'b'), + (0x43, 'M', 'c'), + (0x44, 'M', 'd'), + (0x45, 'M', 'e'), + (0x46, 'M', 'f'), + (0x47, 'M', 'g'), + (0x48, 'M', 'h'), + (0x49, 'M', 'i'), + (0x4A, 'M', 'j'), + (0x4B, 'M', 'k'), + (0x4C, 'M', 'l'), + (0x4D, 'M', 'm'), + (0x4E, 'M', 'n'), + (0x4F, 'M', 'o'), + (0x50, 'M', 'p'), + (0x51, 'M', 'q'), + (0x52, 'M', 'r'), + (0x53, 'M', 's'), + (0x54, 'M', 't'), + (0x55, 'M', 'u'), + (0x56, 'M', 'v'), + (0x57, 'M', 'w'), + (0x58, 'M', 'x'), + (0x59, 'M', 'y'), + (0x5A, 'M', 'z'), + (0x5B, '3'), + (0x5C, '3'), + (0x5D, '3'), + (0x5E, '3'), + (0x5F, '3'), + (0x60, '3'), + (0x61, 'V'), + (0x62, 'V'), + (0x63, 'V'), + ] + +def _seg_1() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x64, 'V'), + (0x65, 'V'), + (0x66, 'V'), + (0x67, 'V'), + (0x68, 'V'), + (0x69, 'V'), + (0x6A, 'V'), + (0x6B, 'V'), + (0x6C, 'V'), + (0x6D, 'V'), + (0x6E, 'V'), + (0x6F, 'V'), + (0x70, 'V'), + (0x71, 'V'), + (0x72, 'V'), + (0x73, 'V'), + (0x74, 'V'), + (0x75, 'V'), + (0x76, 'V'), + (0x77, 'V'), + (0x78, 'V'), + (0x79, 'V'), + (0x7A, 'V'), + (0x7B, '3'), + (0x7C, '3'), + (0x7D, '3'), + (0x7E, '3'), + (0x7F, '3'), + (0x80, 'X'), + (0x81, 'X'), + (0x82, 'X'), + (0x83, 'X'), + (0x84, 'X'), + (0x85, 'X'), + (0x86, 'X'), + (0x87, 'X'), + (0x88, 'X'), + (0x89, 'X'), + (0x8A, 'X'), + (0x8B, 'X'), + (0x8C, 'X'), + (0x8D, 'X'), + (0x8E, 'X'), + (0x8F, 'X'), + (0x90, 'X'), + (0x91, 'X'), + (0x92, 'X'), + (0x93, 'X'), + (0x94, 'X'), + (0x95, 'X'), + (0x96, 'X'), + (0x97, 'X'), + (0x98, 'X'), + (0x99, 'X'), + (0x9A, 'X'), + (0x9B, 'X'), + (0x9C, 'X'), + (0x9D, 'X'), + (0x9E, 'X'), + (0x9F, 'X'), + (0xA0, '3', ' '), + (0xA1, 'V'), + (0xA2, 'V'), + (0xA3, 'V'), + (0xA4, 'V'), + (0xA5, 'V'), + (0xA6, 'V'), + (0xA7, 'V'), + (0xA8, '3', ' ̈'), + (0xA9, 'V'), + (0xAA, 'M', 'a'), + (0xAB, 'V'), + (0xAC, 'V'), + (0xAD, 'I'), + (0xAE, 'V'), + (0xAF, '3', ' ̄'), + (0xB0, 'V'), + (0xB1, 'V'), + (0xB2, 'M', '2'), + (0xB3, 'M', '3'), + (0xB4, '3', ' ́'), + (0xB5, 'M', 'μ'), + (0xB6, 'V'), + (0xB7, 'V'), + (0xB8, '3', ' ̧'), + (0xB9, 'M', '1'), + (0xBA, 'M', 'o'), + (0xBB, 'V'), + (0xBC, 'M', '1⁄4'), + (0xBD, 'M', '1⁄2'), + (0xBE, 'M', '3⁄4'), + (0xBF, 'V'), + (0xC0, 'M', 'à'), + (0xC1, 'M', 'á'), + (0xC2, 'M', 'â'), + (0xC3, 'M', 'ã'), + (0xC4, 'M', 'ä'), + (0xC5, 'M', 'å'), + (0xC6, 'M', 'æ'), + (0xC7, 'M', 'ç'), + ] + +def _seg_2() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xC8, 'M', 'è'), + (0xC9, 'M', 'é'), + (0xCA, 'M', 'ê'), + (0xCB, 'M', 'ë'), + (0xCC, 'M', 'ì'), + (0xCD, 'M', 'í'), + (0xCE, 'M', 'î'), + (0xCF, 'M', 'ï'), + (0xD0, 'M', 'ð'), + (0xD1, 'M', 'ñ'), + (0xD2, 'M', 'ò'), + (0xD3, 'M', 'ó'), + (0xD4, 'M', 'ô'), + (0xD5, 'M', 'õ'), + (0xD6, 'M', 'ö'), + (0xD7, 'V'), + (0xD8, 'M', 'ø'), + (0xD9, 'M', 'ù'), + (0xDA, 'M', 'ú'), + (0xDB, 'M', 'û'), + (0xDC, 'M', 'ü'), + (0xDD, 'M', 'ý'), + (0xDE, 'M', 'þ'), + (0xDF, 'D', 'ss'), + (0xE0, 'V'), + (0xE1, 'V'), + (0xE2, 'V'), + (0xE3, 'V'), + (0xE4, 'V'), + (0xE5, 'V'), + (0xE6, 'V'), + (0xE7, 'V'), + (0xE8, 'V'), + (0xE9, 'V'), + (0xEA, 'V'), + (0xEB, 'V'), + (0xEC, 'V'), + (0xED, 'V'), + (0xEE, 'V'), + (0xEF, 'V'), + (0xF0, 'V'), + (0xF1, 'V'), + (0xF2, 'V'), + (0xF3, 'V'), + (0xF4, 'V'), + (0xF5, 'V'), + (0xF6, 'V'), + (0xF7, 'V'), + (0xF8, 'V'), + (0xF9, 'V'), + (0xFA, 'V'), + (0xFB, 'V'), + (0xFC, 'V'), + (0xFD, 'V'), + (0xFE, 'V'), + (0xFF, 'V'), + (0x100, 'M', 'ā'), + (0x101, 'V'), + (0x102, 'M', 'ă'), + (0x103, 'V'), + (0x104, 'M', 'ą'), + (0x105, 'V'), + (0x106, 'M', 'ć'), + (0x107, 'V'), + (0x108, 'M', 'ĉ'), + (0x109, 'V'), + (0x10A, 'M', 'ċ'), + (0x10B, 'V'), + (0x10C, 'M', 'č'), + (0x10D, 'V'), + (0x10E, 'M', 'ď'), + (0x10F, 'V'), + (0x110, 'M', 'đ'), + (0x111, 'V'), + (0x112, 'M', 'ē'), + (0x113, 'V'), + (0x114, 'M', 'ĕ'), + (0x115, 'V'), + (0x116, 'M', 'ė'), + (0x117, 'V'), + (0x118, 'M', 'ę'), + (0x119, 'V'), + (0x11A, 'M', 'ě'), + (0x11B, 'V'), + (0x11C, 'M', 'ĝ'), + (0x11D, 'V'), + (0x11E, 'M', 'ğ'), + (0x11F, 'V'), + (0x120, 'M', 'ġ'), + (0x121, 'V'), + (0x122, 'M', 'ģ'), + (0x123, 'V'), + (0x124, 'M', 'ĥ'), + (0x125, 'V'), + (0x126, 'M', 'ħ'), + (0x127, 'V'), + (0x128, 'M', 'ĩ'), + (0x129, 'V'), + (0x12A, 'M', 'ī'), + (0x12B, 'V'), + ] + +def _seg_3() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x12C, 'M', 'ĭ'), + (0x12D, 'V'), + (0x12E, 'M', 'į'), + (0x12F, 'V'), + (0x130, 'M', 'i̇'), + (0x131, 'V'), + (0x132, 'M', 'ij'), + (0x134, 'M', 'ĵ'), + (0x135, 'V'), + (0x136, 'M', 'ķ'), + (0x137, 'V'), + (0x139, 'M', 'ĺ'), + (0x13A, 'V'), + (0x13B, 'M', 'ļ'), + (0x13C, 'V'), + (0x13D, 'M', 'ľ'), + (0x13E, 'V'), + (0x13F, 'M', 'l·'), + (0x141, 'M', 'ł'), + (0x142, 'V'), + (0x143, 'M', 'ń'), + (0x144, 'V'), + (0x145, 'M', 'ņ'), + (0x146, 'V'), + (0x147, 'M', 'ň'), + (0x148, 'V'), + (0x149, 'M', 'ʼn'), + (0x14A, 'M', 'ŋ'), + (0x14B, 'V'), + (0x14C, 'M', 'ō'), + (0x14D, 'V'), + (0x14E, 'M', 'ŏ'), + (0x14F, 'V'), + (0x150, 'M', 'ő'), + (0x151, 'V'), + (0x152, 'M', 'œ'), + (0x153, 'V'), + (0x154, 'M', 'ŕ'), + (0x155, 'V'), + (0x156, 'M', 'ŗ'), + (0x157, 'V'), + (0x158, 'M', 'ř'), + (0x159, 'V'), + (0x15A, 'M', 'ś'), + (0x15B, 'V'), + (0x15C, 'M', 'ŝ'), + (0x15D, 'V'), + (0x15E, 'M', 'ş'), + (0x15F, 'V'), + (0x160, 'M', 'š'), + (0x161, 'V'), + (0x162, 'M', 'ţ'), + (0x163, 'V'), + (0x164, 'M', 'ť'), + (0x165, 'V'), + (0x166, 'M', 'ŧ'), + (0x167, 'V'), + (0x168, 'M', 'ũ'), + (0x169, 'V'), + (0x16A, 'M', 'ū'), + (0x16B, 'V'), + (0x16C, 'M', 'ŭ'), + (0x16D, 'V'), + (0x16E, 'M', 'ů'), + (0x16F, 'V'), + (0x170, 'M', 'ű'), + (0x171, 'V'), + (0x172, 'M', 'ų'), + (0x173, 'V'), + (0x174, 'M', 'ŵ'), + (0x175, 'V'), + (0x176, 'M', 'ŷ'), + (0x177, 'V'), + (0x178, 'M', 'ÿ'), + (0x179, 'M', 'ź'), + (0x17A, 'V'), + (0x17B, 'M', 'ż'), + (0x17C, 'V'), + (0x17D, 'M', 'ž'), + (0x17E, 'V'), + (0x17F, 'M', 's'), + (0x180, 'V'), + (0x181, 'M', 'ɓ'), + (0x182, 'M', 'ƃ'), + (0x183, 'V'), + (0x184, 'M', 'ƅ'), + (0x185, 'V'), + (0x186, 'M', 'ɔ'), + (0x187, 'M', 'ƈ'), + (0x188, 'V'), + (0x189, 'M', 'ɖ'), + (0x18A, 'M', 'ɗ'), + (0x18B, 'M', 'ƌ'), + (0x18C, 'V'), + (0x18E, 'M', 'ǝ'), + (0x18F, 'M', 'ə'), + (0x190, 'M', 'ɛ'), + (0x191, 'M', 'ƒ'), + (0x192, 'V'), + (0x193, 'M', 'ɠ'), + ] + +def _seg_4() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x194, 'M', 'ɣ'), + (0x195, 'V'), + (0x196, 'M', 'ɩ'), + (0x197, 'M', 'ɨ'), + (0x198, 'M', 'ƙ'), + (0x199, 'V'), + (0x19C, 'M', 'ɯ'), + (0x19D, 'M', 'ɲ'), + (0x19E, 'V'), + (0x19F, 'M', 'ɵ'), + (0x1A0, 'M', 'ơ'), + (0x1A1, 'V'), + (0x1A2, 'M', 'ƣ'), + (0x1A3, 'V'), + (0x1A4, 'M', 'ƥ'), + (0x1A5, 'V'), + (0x1A6, 'M', 'ʀ'), + (0x1A7, 'M', 'ƨ'), + (0x1A8, 'V'), + (0x1A9, 'M', 'ʃ'), + (0x1AA, 'V'), + (0x1AC, 'M', 'ƭ'), + (0x1AD, 'V'), + (0x1AE, 'M', 'ʈ'), + (0x1AF, 'M', 'ư'), + (0x1B0, 'V'), + (0x1B1, 'M', 'ʊ'), + (0x1B2, 'M', 'ʋ'), + (0x1B3, 'M', 'ƴ'), + (0x1B4, 'V'), + (0x1B5, 'M', 'ƶ'), + (0x1B6, 'V'), + (0x1B7, 'M', 'ʒ'), + (0x1B8, 'M', 'ƹ'), + (0x1B9, 'V'), + (0x1BC, 'M', 'ƽ'), + (0x1BD, 'V'), + (0x1C4, 'M', 'dž'), + (0x1C7, 'M', 'lj'), + (0x1CA, 'M', 'nj'), + (0x1CD, 'M', 'ǎ'), + (0x1CE, 'V'), + (0x1CF, 'M', 'ǐ'), + (0x1D0, 'V'), + (0x1D1, 'M', 'ǒ'), + (0x1D2, 'V'), + (0x1D3, 'M', 'ǔ'), + (0x1D4, 'V'), + (0x1D5, 'M', 'ǖ'), + (0x1D6, 'V'), + (0x1D7, 'M', 'ǘ'), + (0x1D8, 'V'), + (0x1D9, 'M', 'ǚ'), + (0x1DA, 'V'), + (0x1DB, 'M', 'ǜ'), + (0x1DC, 'V'), + (0x1DE, 'M', 'ǟ'), + (0x1DF, 'V'), + (0x1E0, 'M', 'ǡ'), + (0x1E1, 'V'), + (0x1E2, 'M', 'ǣ'), + (0x1E3, 'V'), + (0x1E4, 'M', 'ǥ'), + (0x1E5, 'V'), + (0x1E6, 'M', 'ǧ'), + (0x1E7, 'V'), + (0x1E8, 'M', 'ǩ'), + (0x1E9, 'V'), + (0x1EA, 'M', 'ǫ'), + (0x1EB, 'V'), + (0x1EC, 'M', 'ǭ'), + (0x1ED, 'V'), + (0x1EE, 'M', 'ǯ'), + (0x1EF, 'V'), + (0x1F1, 'M', 'dz'), + (0x1F4, 'M', 'ǵ'), + (0x1F5, 'V'), + (0x1F6, 'M', 'ƕ'), + (0x1F7, 'M', 'ƿ'), + (0x1F8, 'M', 'ǹ'), + (0x1F9, 'V'), + (0x1FA, 'M', 'ǻ'), + (0x1FB, 'V'), + (0x1FC, 'M', 'ǽ'), + (0x1FD, 'V'), + (0x1FE, 'M', 'ǿ'), + (0x1FF, 'V'), + (0x200, 'M', 'ȁ'), + (0x201, 'V'), + (0x202, 'M', 'ȃ'), + (0x203, 'V'), + (0x204, 'M', 'ȅ'), + (0x205, 'V'), + (0x206, 'M', 'ȇ'), + (0x207, 'V'), + (0x208, 'M', 'ȉ'), + (0x209, 'V'), + (0x20A, 'M', 'ȋ'), + (0x20B, 'V'), + (0x20C, 'M', 'ȍ'), + ] + +def _seg_5() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x20D, 'V'), + (0x20E, 'M', 'ȏ'), + (0x20F, 'V'), + (0x210, 'M', 'ȑ'), + (0x211, 'V'), + (0x212, 'M', 'ȓ'), + (0x213, 'V'), + (0x214, 'M', 'ȕ'), + (0x215, 'V'), + (0x216, 'M', 'ȗ'), + (0x217, 'V'), + (0x218, 'M', 'ș'), + (0x219, 'V'), + (0x21A, 'M', 'ț'), + (0x21B, 'V'), + (0x21C, 'M', 'ȝ'), + (0x21D, 'V'), + (0x21E, 'M', 'ȟ'), + (0x21F, 'V'), + (0x220, 'M', 'ƞ'), + (0x221, 'V'), + (0x222, 'M', 'ȣ'), + (0x223, 'V'), + (0x224, 'M', 'ȥ'), + (0x225, 'V'), + (0x226, 'M', 'ȧ'), + (0x227, 'V'), + (0x228, 'M', 'ȩ'), + (0x229, 'V'), + (0x22A, 'M', 'ȫ'), + (0x22B, 'V'), + (0x22C, 'M', 'ȭ'), + (0x22D, 'V'), + (0x22E, 'M', 'ȯ'), + (0x22F, 'V'), + (0x230, 'M', 'ȱ'), + (0x231, 'V'), + (0x232, 'M', 'ȳ'), + (0x233, 'V'), + (0x23A, 'M', 'ⱥ'), + (0x23B, 'M', 'ȼ'), + (0x23C, 'V'), + (0x23D, 'M', 'ƚ'), + (0x23E, 'M', 'ⱦ'), + (0x23F, 'V'), + (0x241, 'M', 'ɂ'), + (0x242, 'V'), + (0x243, 'M', 'ƀ'), + (0x244, 'M', 'ʉ'), + (0x245, 'M', 'ʌ'), + (0x246, 'M', 'ɇ'), + (0x247, 'V'), + (0x248, 'M', 'ɉ'), + (0x249, 'V'), + (0x24A, 'M', 'ɋ'), + (0x24B, 'V'), + (0x24C, 'M', 'ɍ'), + (0x24D, 'V'), + (0x24E, 'M', 'ɏ'), + (0x24F, 'V'), + (0x2B0, 'M', 'h'), + (0x2B1, 'M', 'ɦ'), + (0x2B2, 'M', 'j'), + (0x2B3, 'M', 'r'), + (0x2B4, 'M', 'ɹ'), + (0x2B5, 'M', 'ɻ'), + (0x2B6, 'M', 'ʁ'), + (0x2B7, 'M', 'w'), + (0x2B8, 'M', 'y'), + (0x2B9, 'V'), + (0x2D8, '3', ' ̆'), + (0x2D9, '3', ' ̇'), + (0x2DA, '3', ' ̊'), + (0x2DB, '3', ' ̨'), + (0x2DC, '3', ' ̃'), + (0x2DD, '3', ' ̋'), + (0x2DE, 'V'), + (0x2E0, 'M', 'ɣ'), + (0x2E1, 'M', 'l'), + (0x2E2, 'M', 's'), + (0x2E3, 'M', 'x'), + (0x2E4, 'M', 'ʕ'), + (0x2E5, 'V'), + (0x340, 'M', '̀'), + (0x341, 'M', '́'), + (0x342, 'V'), + (0x343, 'M', '̓'), + (0x344, 'M', '̈́'), + (0x345, 'M', 'ι'), + (0x346, 'V'), + (0x34F, 'I'), + (0x350, 'V'), + (0x370, 'M', 'ͱ'), + (0x371, 'V'), + (0x372, 'M', 'ͳ'), + (0x373, 'V'), + (0x374, 'M', 'ʹ'), + (0x375, 'V'), + (0x376, 'M', 'ͷ'), + (0x377, 'V'), + ] + +def _seg_6() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x378, 'X'), + (0x37A, '3', ' ι'), + (0x37B, 'V'), + (0x37E, '3', ';'), + (0x37F, 'M', 'ϳ'), + (0x380, 'X'), + (0x384, '3', ' ́'), + (0x385, '3', ' ̈́'), + (0x386, 'M', 'ά'), + (0x387, 'M', '·'), + (0x388, 'M', 'έ'), + (0x389, 'M', 'ή'), + (0x38A, 'M', 'ί'), + (0x38B, 'X'), + (0x38C, 'M', 'ό'), + (0x38D, 'X'), + (0x38E, 'M', 'ύ'), + (0x38F, 'M', 'ώ'), + (0x390, 'V'), + (0x391, 'M', 'α'), + (0x392, 'M', 'β'), + (0x393, 'M', 'γ'), + (0x394, 'M', 'δ'), + (0x395, 'M', 'ε'), + (0x396, 'M', 'ζ'), + (0x397, 'M', 'η'), + (0x398, 'M', 'θ'), + (0x399, 'M', 'ι'), + (0x39A, 'M', 'κ'), + (0x39B, 'M', 'λ'), + (0x39C, 'M', 'μ'), + (0x39D, 'M', 'ν'), + (0x39E, 'M', 'ξ'), + (0x39F, 'M', 'ο'), + (0x3A0, 'M', 'π'), + (0x3A1, 'M', 'ρ'), + (0x3A2, 'X'), + (0x3A3, 'M', 'σ'), + (0x3A4, 'M', 'τ'), + (0x3A5, 'M', 'υ'), + (0x3A6, 'M', 'φ'), + (0x3A7, 'M', 'χ'), + (0x3A8, 'M', 'ψ'), + (0x3A9, 'M', 'ω'), + (0x3AA, 'M', 'ϊ'), + (0x3AB, 'M', 'ϋ'), + (0x3AC, 'V'), + (0x3C2, 'D', 'σ'), + (0x3C3, 'V'), + (0x3CF, 'M', 'ϗ'), + (0x3D0, 'M', 'β'), + (0x3D1, 'M', 'θ'), + (0x3D2, 'M', 'υ'), + (0x3D3, 'M', 'ύ'), + (0x3D4, 'M', 'ϋ'), + (0x3D5, 'M', 'φ'), + (0x3D6, 'M', 'π'), + (0x3D7, 'V'), + (0x3D8, 'M', 'ϙ'), + (0x3D9, 'V'), + (0x3DA, 'M', 'ϛ'), + (0x3DB, 'V'), + (0x3DC, 'M', 'ϝ'), + (0x3DD, 'V'), + (0x3DE, 'M', 'ϟ'), + (0x3DF, 'V'), + (0x3E0, 'M', 'ϡ'), + (0x3E1, 'V'), + (0x3E2, 'M', 'ϣ'), + (0x3E3, 'V'), + (0x3E4, 'M', 'ϥ'), + (0x3E5, 'V'), + (0x3E6, 'M', 'ϧ'), + (0x3E7, 'V'), + (0x3E8, 'M', 'ϩ'), + (0x3E9, 'V'), + (0x3EA, 'M', 'ϫ'), + (0x3EB, 'V'), + (0x3EC, 'M', 'ϭ'), + (0x3ED, 'V'), + (0x3EE, 'M', 'ϯ'), + (0x3EF, 'V'), + (0x3F0, 'M', 'κ'), + (0x3F1, 'M', 'ρ'), + (0x3F2, 'M', 'σ'), + (0x3F3, 'V'), + (0x3F4, 'M', 'θ'), + (0x3F5, 'M', 'ε'), + (0x3F6, 'V'), + (0x3F7, 'M', 'ϸ'), + (0x3F8, 'V'), + (0x3F9, 'M', 'σ'), + (0x3FA, 'M', 'ϻ'), + (0x3FB, 'V'), + (0x3FD, 'M', 'ͻ'), + (0x3FE, 'M', 'ͼ'), + (0x3FF, 'M', 'ͽ'), + (0x400, 'M', 'ѐ'), + (0x401, 'M', 'ё'), + (0x402, 'M', 'ђ'), + ] + +def _seg_7() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x403, 'M', 'ѓ'), + (0x404, 'M', 'є'), + (0x405, 'M', 'ѕ'), + (0x406, 'M', 'і'), + (0x407, 'M', 'ї'), + (0x408, 'M', 'ј'), + (0x409, 'M', 'љ'), + (0x40A, 'M', 'њ'), + (0x40B, 'M', 'ћ'), + (0x40C, 'M', 'ќ'), + (0x40D, 'M', 'ѝ'), + (0x40E, 'M', 'ў'), + (0x40F, 'M', 'џ'), + (0x410, 'M', 'а'), + (0x411, 'M', 'б'), + (0x412, 'M', 'в'), + (0x413, 'M', 'г'), + (0x414, 'M', 'д'), + (0x415, 'M', 'е'), + (0x416, 'M', 'ж'), + (0x417, 'M', 'з'), + (0x418, 'M', 'и'), + (0x419, 'M', 'й'), + (0x41A, 'M', 'к'), + (0x41B, 'M', 'л'), + (0x41C, 'M', 'м'), + (0x41D, 'M', 'н'), + (0x41E, 'M', 'о'), + (0x41F, 'M', 'п'), + (0x420, 'M', 'р'), + (0x421, 'M', 'с'), + (0x422, 'M', 'т'), + (0x423, 'M', 'у'), + (0x424, 'M', 'ф'), + (0x425, 'M', 'х'), + (0x426, 'M', 'ц'), + (0x427, 'M', 'ч'), + (0x428, 'M', 'ш'), + (0x429, 'M', 'щ'), + (0x42A, 'M', 'ъ'), + (0x42B, 'M', 'ы'), + (0x42C, 'M', 'ь'), + (0x42D, 'M', 'э'), + (0x42E, 'M', 'ю'), + (0x42F, 'M', 'я'), + (0x430, 'V'), + (0x460, 'M', 'ѡ'), + (0x461, 'V'), + (0x462, 'M', 'ѣ'), + (0x463, 'V'), + (0x464, 'M', 'ѥ'), + (0x465, 'V'), + (0x466, 'M', 'ѧ'), + (0x467, 'V'), + (0x468, 'M', 'ѩ'), + (0x469, 'V'), + (0x46A, 'M', 'ѫ'), + (0x46B, 'V'), + (0x46C, 'M', 'ѭ'), + (0x46D, 'V'), + (0x46E, 'M', 'ѯ'), + (0x46F, 'V'), + (0x470, 'M', 'ѱ'), + (0x471, 'V'), + (0x472, 'M', 'ѳ'), + (0x473, 'V'), + (0x474, 'M', 'ѵ'), + (0x475, 'V'), + (0x476, 'M', 'ѷ'), + (0x477, 'V'), + (0x478, 'M', 'ѹ'), + (0x479, 'V'), + (0x47A, 'M', 'ѻ'), + (0x47B, 'V'), + (0x47C, 'M', 'ѽ'), + (0x47D, 'V'), + (0x47E, 'M', 'ѿ'), + (0x47F, 'V'), + (0x480, 'M', 'ҁ'), + (0x481, 'V'), + (0x48A, 'M', 'ҋ'), + (0x48B, 'V'), + (0x48C, 'M', 'ҍ'), + (0x48D, 'V'), + (0x48E, 'M', 'ҏ'), + (0x48F, 'V'), + (0x490, 'M', 'ґ'), + (0x491, 'V'), + (0x492, 'M', 'ғ'), + (0x493, 'V'), + (0x494, 'M', 'ҕ'), + (0x495, 'V'), + (0x496, 'M', 'җ'), + (0x497, 'V'), + (0x498, 'M', 'ҙ'), + (0x499, 'V'), + (0x49A, 'M', 'қ'), + (0x49B, 'V'), + (0x49C, 'M', 'ҝ'), + (0x49D, 'V'), + ] + +def _seg_8() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x49E, 'M', 'ҟ'), + (0x49F, 'V'), + (0x4A0, 'M', 'ҡ'), + (0x4A1, 'V'), + (0x4A2, 'M', 'ң'), + (0x4A3, 'V'), + (0x4A4, 'M', 'ҥ'), + (0x4A5, 'V'), + (0x4A6, 'M', 'ҧ'), + (0x4A7, 'V'), + (0x4A8, 'M', 'ҩ'), + (0x4A9, 'V'), + (0x4AA, 'M', 'ҫ'), + (0x4AB, 'V'), + (0x4AC, 'M', 'ҭ'), + (0x4AD, 'V'), + (0x4AE, 'M', 'ү'), + (0x4AF, 'V'), + (0x4B0, 'M', 'ұ'), + (0x4B1, 'V'), + (0x4B2, 'M', 'ҳ'), + (0x4B3, 'V'), + (0x4B4, 'M', 'ҵ'), + (0x4B5, 'V'), + (0x4B6, 'M', 'ҷ'), + (0x4B7, 'V'), + (0x4B8, 'M', 'ҹ'), + (0x4B9, 'V'), + (0x4BA, 'M', 'һ'), + (0x4BB, 'V'), + (0x4BC, 'M', 'ҽ'), + (0x4BD, 'V'), + (0x4BE, 'M', 'ҿ'), + (0x4BF, 'V'), + (0x4C0, 'X'), + (0x4C1, 'M', 'ӂ'), + (0x4C2, 'V'), + (0x4C3, 'M', 'ӄ'), + (0x4C4, 'V'), + (0x4C5, 'M', 'ӆ'), + (0x4C6, 'V'), + (0x4C7, 'M', 'ӈ'), + (0x4C8, 'V'), + (0x4C9, 'M', 'ӊ'), + (0x4CA, 'V'), + (0x4CB, 'M', 'ӌ'), + (0x4CC, 'V'), + (0x4CD, 'M', 'ӎ'), + (0x4CE, 'V'), + (0x4D0, 'M', 'ӑ'), + (0x4D1, 'V'), + (0x4D2, 'M', 'ӓ'), + (0x4D3, 'V'), + (0x4D4, 'M', 'ӕ'), + (0x4D5, 'V'), + (0x4D6, 'M', 'ӗ'), + (0x4D7, 'V'), + (0x4D8, 'M', 'ә'), + (0x4D9, 'V'), + (0x4DA, 'M', 'ӛ'), + (0x4DB, 'V'), + (0x4DC, 'M', 'ӝ'), + (0x4DD, 'V'), + (0x4DE, 'M', 'ӟ'), + (0x4DF, 'V'), + (0x4E0, 'M', 'ӡ'), + (0x4E1, 'V'), + (0x4E2, 'M', 'ӣ'), + (0x4E3, 'V'), + (0x4E4, 'M', 'ӥ'), + (0x4E5, 'V'), + (0x4E6, 'M', 'ӧ'), + (0x4E7, 'V'), + (0x4E8, 'M', 'ө'), + (0x4E9, 'V'), + (0x4EA, 'M', 'ӫ'), + (0x4EB, 'V'), + (0x4EC, 'M', 'ӭ'), + (0x4ED, 'V'), + (0x4EE, 'M', 'ӯ'), + (0x4EF, 'V'), + (0x4F0, 'M', 'ӱ'), + (0x4F1, 'V'), + (0x4F2, 'M', 'ӳ'), + (0x4F3, 'V'), + (0x4F4, 'M', 'ӵ'), + (0x4F5, 'V'), + (0x4F6, 'M', 'ӷ'), + (0x4F7, 'V'), + (0x4F8, 'M', 'ӹ'), + (0x4F9, 'V'), + (0x4FA, 'M', 'ӻ'), + (0x4FB, 'V'), + (0x4FC, 'M', 'ӽ'), + (0x4FD, 'V'), + (0x4FE, 'M', 'ӿ'), + (0x4FF, 'V'), + (0x500, 'M', 'ԁ'), + (0x501, 'V'), + (0x502, 'M', 'ԃ'), + ] + +def _seg_9() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x503, 'V'), + (0x504, 'M', 'ԅ'), + (0x505, 'V'), + (0x506, 'M', 'ԇ'), + (0x507, 'V'), + (0x508, 'M', 'ԉ'), + (0x509, 'V'), + (0x50A, 'M', 'ԋ'), + (0x50B, 'V'), + (0x50C, 'M', 'ԍ'), + (0x50D, 'V'), + (0x50E, 'M', 'ԏ'), + (0x50F, 'V'), + (0x510, 'M', 'ԑ'), + (0x511, 'V'), + (0x512, 'M', 'ԓ'), + (0x513, 'V'), + (0x514, 'M', 'ԕ'), + (0x515, 'V'), + (0x516, 'M', 'ԗ'), + (0x517, 'V'), + (0x518, 'M', 'ԙ'), + (0x519, 'V'), + (0x51A, 'M', 'ԛ'), + (0x51B, 'V'), + (0x51C, 'M', 'ԝ'), + (0x51D, 'V'), + (0x51E, 'M', 'ԟ'), + (0x51F, 'V'), + (0x520, 'M', 'ԡ'), + (0x521, 'V'), + (0x522, 'M', 'ԣ'), + (0x523, 'V'), + (0x524, 'M', 'ԥ'), + (0x525, 'V'), + (0x526, 'M', 'ԧ'), + (0x527, 'V'), + (0x528, 'M', 'ԩ'), + (0x529, 'V'), + (0x52A, 'M', 'ԫ'), + (0x52B, 'V'), + (0x52C, 'M', 'ԭ'), + (0x52D, 'V'), + (0x52E, 'M', 'ԯ'), + (0x52F, 'V'), + (0x530, 'X'), + (0x531, 'M', 'ա'), + (0x532, 'M', 'բ'), + (0x533, 'M', 'գ'), + (0x534, 'M', 'դ'), + (0x535, 'M', 'ե'), + (0x536, 'M', 'զ'), + (0x537, 'M', 'է'), + (0x538, 'M', 'ը'), + (0x539, 'M', 'թ'), + (0x53A, 'M', 'ժ'), + (0x53B, 'M', 'ի'), + (0x53C, 'M', 'լ'), + (0x53D, 'M', 'խ'), + (0x53E, 'M', 'ծ'), + (0x53F, 'M', 'կ'), + (0x540, 'M', 'հ'), + (0x541, 'M', 'ձ'), + (0x542, 'M', 'ղ'), + (0x543, 'M', 'ճ'), + (0x544, 'M', 'մ'), + (0x545, 'M', 'յ'), + (0x546, 'M', 'ն'), + (0x547, 'M', 'շ'), + (0x548, 'M', 'ո'), + (0x549, 'M', 'չ'), + (0x54A, 'M', 'պ'), + (0x54B, 'M', 'ջ'), + (0x54C, 'M', 'ռ'), + (0x54D, 'M', 'ս'), + (0x54E, 'M', 'վ'), + (0x54F, 'M', 'տ'), + (0x550, 'M', 'ր'), + (0x551, 'M', 'ց'), + (0x552, 'M', 'ւ'), + (0x553, 'M', 'փ'), + (0x554, 'M', 'ք'), + (0x555, 'M', 'օ'), + (0x556, 'M', 'ֆ'), + (0x557, 'X'), + (0x559, 'V'), + (0x587, 'M', 'եւ'), + (0x588, 'V'), + (0x58B, 'X'), + (0x58D, 'V'), + (0x590, 'X'), + (0x591, 'V'), + (0x5C8, 'X'), + (0x5D0, 'V'), + (0x5EB, 'X'), + (0x5EF, 'V'), + (0x5F5, 'X'), + (0x606, 'V'), + (0x61C, 'X'), + (0x61D, 'V'), + ] + +def _seg_10() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x675, 'M', 'اٴ'), + (0x676, 'M', 'وٴ'), + (0x677, 'M', 'ۇٴ'), + (0x678, 'M', 'يٴ'), + (0x679, 'V'), + (0x6DD, 'X'), + (0x6DE, 'V'), + (0x70E, 'X'), + (0x710, 'V'), + (0x74B, 'X'), + (0x74D, 'V'), + (0x7B2, 'X'), + (0x7C0, 'V'), + (0x7FB, 'X'), + (0x7FD, 'V'), + (0x82E, 'X'), + (0x830, 'V'), + (0x83F, 'X'), + (0x840, 'V'), + (0x85C, 'X'), + (0x85E, 'V'), + (0x85F, 'X'), + (0x860, 'V'), + (0x86B, 'X'), + (0x870, 'V'), + (0x88F, 'X'), + (0x898, 'V'), + (0x8E2, 'X'), + (0x8E3, 'V'), + (0x958, 'M', 'क़'), + (0x959, 'M', 'ख़'), + (0x95A, 'M', 'ग़'), + (0x95B, 'M', 'ज़'), + (0x95C, 'M', 'ड़'), + (0x95D, 'M', 'ढ़'), + (0x95E, 'M', 'फ़'), + (0x95F, 'M', 'य़'), + (0x960, 'V'), + (0x984, 'X'), + (0x985, 'V'), + (0x98D, 'X'), + (0x98F, 'V'), + (0x991, 'X'), + (0x993, 'V'), + (0x9A9, 'X'), + (0x9AA, 'V'), + (0x9B1, 'X'), + (0x9B2, 'V'), + (0x9B3, 'X'), + (0x9B6, 'V'), + (0x9BA, 'X'), + (0x9BC, 'V'), + (0x9C5, 'X'), + (0x9C7, 'V'), + (0x9C9, 'X'), + (0x9CB, 'V'), + (0x9CF, 'X'), + (0x9D7, 'V'), + (0x9D8, 'X'), + (0x9DC, 'M', 'ড়'), + (0x9DD, 'M', 'ঢ়'), + (0x9DE, 'X'), + (0x9DF, 'M', 'য়'), + (0x9E0, 'V'), + (0x9E4, 'X'), + (0x9E6, 'V'), + (0x9FF, 'X'), + (0xA01, 'V'), + (0xA04, 'X'), + (0xA05, 'V'), + (0xA0B, 'X'), + (0xA0F, 'V'), + (0xA11, 'X'), + (0xA13, 'V'), + (0xA29, 'X'), + (0xA2A, 'V'), + (0xA31, 'X'), + (0xA32, 'V'), + (0xA33, 'M', 'ਲ਼'), + (0xA34, 'X'), + (0xA35, 'V'), + (0xA36, 'M', 'ਸ਼'), + (0xA37, 'X'), + (0xA38, 'V'), + (0xA3A, 'X'), + (0xA3C, 'V'), + (0xA3D, 'X'), + (0xA3E, 'V'), + (0xA43, 'X'), + (0xA47, 'V'), + (0xA49, 'X'), + (0xA4B, 'V'), + (0xA4E, 'X'), + (0xA51, 'V'), + (0xA52, 'X'), + (0xA59, 'M', 'ਖ਼'), + (0xA5A, 'M', 'ਗ਼'), + (0xA5B, 'M', 'ਜ਼'), + (0xA5C, 'V'), + (0xA5D, 'X'), + ] + +def _seg_11() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA5E, 'M', 'ਫ਼'), + (0xA5F, 'X'), + (0xA66, 'V'), + (0xA77, 'X'), + (0xA81, 'V'), + (0xA84, 'X'), + (0xA85, 'V'), + (0xA8E, 'X'), + (0xA8F, 'V'), + (0xA92, 'X'), + (0xA93, 'V'), + (0xAA9, 'X'), + (0xAAA, 'V'), + (0xAB1, 'X'), + (0xAB2, 'V'), + (0xAB4, 'X'), + (0xAB5, 'V'), + (0xABA, 'X'), + (0xABC, 'V'), + (0xAC6, 'X'), + (0xAC7, 'V'), + (0xACA, 'X'), + (0xACB, 'V'), + (0xACE, 'X'), + (0xAD0, 'V'), + (0xAD1, 'X'), + (0xAE0, 'V'), + (0xAE4, 'X'), + (0xAE6, 'V'), + (0xAF2, 'X'), + (0xAF9, 'V'), + (0xB00, 'X'), + (0xB01, 'V'), + (0xB04, 'X'), + (0xB05, 'V'), + (0xB0D, 'X'), + (0xB0F, 'V'), + (0xB11, 'X'), + (0xB13, 'V'), + (0xB29, 'X'), + (0xB2A, 'V'), + (0xB31, 'X'), + (0xB32, 'V'), + (0xB34, 'X'), + (0xB35, 'V'), + (0xB3A, 'X'), + (0xB3C, 'V'), + (0xB45, 'X'), + (0xB47, 'V'), + (0xB49, 'X'), + (0xB4B, 'V'), + (0xB4E, 'X'), + (0xB55, 'V'), + (0xB58, 'X'), + (0xB5C, 'M', 'ଡ଼'), + (0xB5D, 'M', 'ଢ଼'), + (0xB5E, 'X'), + (0xB5F, 'V'), + (0xB64, 'X'), + (0xB66, 'V'), + (0xB78, 'X'), + (0xB82, 'V'), + (0xB84, 'X'), + (0xB85, 'V'), + (0xB8B, 'X'), + (0xB8E, 'V'), + (0xB91, 'X'), + (0xB92, 'V'), + (0xB96, 'X'), + (0xB99, 'V'), + (0xB9B, 'X'), + (0xB9C, 'V'), + (0xB9D, 'X'), + (0xB9E, 'V'), + (0xBA0, 'X'), + (0xBA3, 'V'), + (0xBA5, 'X'), + (0xBA8, 'V'), + (0xBAB, 'X'), + (0xBAE, 'V'), + (0xBBA, 'X'), + (0xBBE, 'V'), + (0xBC3, 'X'), + (0xBC6, 'V'), + (0xBC9, 'X'), + (0xBCA, 'V'), + (0xBCE, 'X'), + (0xBD0, 'V'), + (0xBD1, 'X'), + (0xBD7, 'V'), + (0xBD8, 'X'), + (0xBE6, 'V'), + (0xBFB, 'X'), + (0xC00, 'V'), + (0xC0D, 'X'), + (0xC0E, 'V'), + (0xC11, 'X'), + (0xC12, 'V'), + (0xC29, 'X'), + (0xC2A, 'V'), + ] + +def _seg_12() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xC3A, 'X'), + (0xC3C, 'V'), + (0xC45, 'X'), + (0xC46, 'V'), + (0xC49, 'X'), + (0xC4A, 'V'), + (0xC4E, 'X'), + (0xC55, 'V'), + (0xC57, 'X'), + (0xC58, 'V'), + (0xC5B, 'X'), + (0xC5D, 'V'), + (0xC5E, 'X'), + (0xC60, 'V'), + (0xC64, 'X'), + (0xC66, 'V'), + (0xC70, 'X'), + (0xC77, 'V'), + (0xC8D, 'X'), + (0xC8E, 'V'), + (0xC91, 'X'), + (0xC92, 'V'), + (0xCA9, 'X'), + (0xCAA, 'V'), + (0xCB4, 'X'), + (0xCB5, 'V'), + (0xCBA, 'X'), + (0xCBC, 'V'), + (0xCC5, 'X'), + (0xCC6, 'V'), + (0xCC9, 'X'), + (0xCCA, 'V'), + (0xCCE, 'X'), + (0xCD5, 'V'), + (0xCD7, 'X'), + (0xCDD, 'V'), + (0xCDF, 'X'), + (0xCE0, 'V'), + (0xCE4, 'X'), + (0xCE6, 'V'), + (0xCF0, 'X'), + (0xCF1, 'V'), + (0xCF4, 'X'), + (0xD00, 'V'), + (0xD0D, 'X'), + (0xD0E, 'V'), + (0xD11, 'X'), + (0xD12, 'V'), + (0xD45, 'X'), + (0xD46, 'V'), + (0xD49, 'X'), + (0xD4A, 'V'), + (0xD50, 'X'), + (0xD54, 'V'), + (0xD64, 'X'), + (0xD66, 'V'), + (0xD80, 'X'), + (0xD81, 'V'), + (0xD84, 'X'), + (0xD85, 'V'), + (0xD97, 'X'), + (0xD9A, 'V'), + (0xDB2, 'X'), + (0xDB3, 'V'), + (0xDBC, 'X'), + (0xDBD, 'V'), + (0xDBE, 'X'), + (0xDC0, 'V'), + (0xDC7, 'X'), + (0xDCA, 'V'), + (0xDCB, 'X'), + (0xDCF, 'V'), + (0xDD5, 'X'), + (0xDD6, 'V'), + (0xDD7, 'X'), + (0xDD8, 'V'), + (0xDE0, 'X'), + (0xDE6, 'V'), + (0xDF0, 'X'), + (0xDF2, 'V'), + (0xDF5, 'X'), + (0xE01, 'V'), + (0xE33, 'M', 'ํา'), + (0xE34, 'V'), + (0xE3B, 'X'), + (0xE3F, 'V'), + (0xE5C, 'X'), + (0xE81, 'V'), + (0xE83, 'X'), + (0xE84, 'V'), + (0xE85, 'X'), + (0xE86, 'V'), + (0xE8B, 'X'), + (0xE8C, 'V'), + (0xEA4, 'X'), + (0xEA5, 'V'), + (0xEA6, 'X'), + (0xEA7, 'V'), + (0xEB3, 'M', 'ໍາ'), + (0xEB4, 'V'), + ] + +def _seg_13() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xEBE, 'X'), + (0xEC0, 'V'), + (0xEC5, 'X'), + (0xEC6, 'V'), + (0xEC7, 'X'), + (0xEC8, 'V'), + (0xECF, 'X'), + (0xED0, 'V'), + (0xEDA, 'X'), + (0xEDC, 'M', 'ຫນ'), + (0xEDD, 'M', 'ຫມ'), + (0xEDE, 'V'), + (0xEE0, 'X'), + (0xF00, 'V'), + (0xF0C, 'M', '་'), + (0xF0D, 'V'), + (0xF43, 'M', 'གྷ'), + (0xF44, 'V'), + (0xF48, 'X'), + (0xF49, 'V'), + (0xF4D, 'M', 'ཌྷ'), + (0xF4E, 'V'), + (0xF52, 'M', 'དྷ'), + (0xF53, 'V'), + (0xF57, 'M', 'བྷ'), + (0xF58, 'V'), + (0xF5C, 'M', 'ཛྷ'), + (0xF5D, 'V'), + (0xF69, 'M', 'ཀྵ'), + (0xF6A, 'V'), + (0xF6D, 'X'), + (0xF71, 'V'), + (0xF73, 'M', 'ཱི'), + (0xF74, 'V'), + (0xF75, 'M', 'ཱུ'), + (0xF76, 'M', 'ྲྀ'), + (0xF77, 'M', 'ྲཱྀ'), + (0xF78, 'M', 'ླྀ'), + (0xF79, 'M', 'ླཱྀ'), + (0xF7A, 'V'), + (0xF81, 'M', 'ཱྀ'), + (0xF82, 'V'), + (0xF93, 'M', 'ྒྷ'), + (0xF94, 'V'), + (0xF98, 'X'), + (0xF99, 'V'), + (0xF9D, 'M', 'ྜྷ'), + (0xF9E, 'V'), + (0xFA2, 'M', 'ྡྷ'), + (0xFA3, 'V'), + (0xFA7, 'M', 'ྦྷ'), + (0xFA8, 'V'), + (0xFAC, 'M', 'ྫྷ'), + (0xFAD, 'V'), + (0xFB9, 'M', 'ྐྵ'), + (0xFBA, 'V'), + (0xFBD, 'X'), + (0xFBE, 'V'), + (0xFCD, 'X'), + (0xFCE, 'V'), + (0xFDB, 'X'), + (0x1000, 'V'), + (0x10A0, 'X'), + (0x10C7, 'M', 'ⴧ'), + (0x10C8, 'X'), + (0x10CD, 'M', 'ⴭ'), + (0x10CE, 'X'), + (0x10D0, 'V'), + (0x10FC, 'M', 'ნ'), + (0x10FD, 'V'), + (0x115F, 'X'), + (0x1161, 'V'), + (0x1249, 'X'), + (0x124A, 'V'), + (0x124E, 'X'), + (0x1250, 'V'), + (0x1257, 'X'), + (0x1258, 'V'), + (0x1259, 'X'), + (0x125A, 'V'), + (0x125E, 'X'), + (0x1260, 'V'), + (0x1289, 'X'), + (0x128A, 'V'), + (0x128E, 'X'), + (0x1290, 'V'), + (0x12B1, 'X'), + (0x12B2, 'V'), + (0x12B6, 'X'), + (0x12B8, 'V'), + (0x12BF, 'X'), + (0x12C0, 'V'), + (0x12C1, 'X'), + (0x12C2, 'V'), + (0x12C6, 'X'), + (0x12C8, 'V'), + (0x12D7, 'X'), + (0x12D8, 'V'), + (0x1311, 'X'), + (0x1312, 'V'), + ] + +def _seg_14() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1316, 'X'), + (0x1318, 'V'), + (0x135B, 'X'), + (0x135D, 'V'), + (0x137D, 'X'), + (0x1380, 'V'), + (0x139A, 'X'), + (0x13A0, 'V'), + (0x13F6, 'X'), + (0x13F8, 'M', 'Ᏸ'), + (0x13F9, 'M', 'Ᏹ'), + (0x13FA, 'M', 'Ᏺ'), + (0x13FB, 'M', 'Ᏻ'), + (0x13FC, 'M', 'Ᏼ'), + (0x13FD, 'M', 'Ᏽ'), + (0x13FE, 'X'), + (0x1400, 'V'), + (0x1680, 'X'), + (0x1681, 'V'), + (0x169D, 'X'), + (0x16A0, 'V'), + (0x16F9, 'X'), + (0x1700, 'V'), + (0x1716, 'X'), + (0x171F, 'V'), + (0x1737, 'X'), + (0x1740, 'V'), + (0x1754, 'X'), + (0x1760, 'V'), + (0x176D, 'X'), + (0x176E, 'V'), + (0x1771, 'X'), + (0x1772, 'V'), + (0x1774, 'X'), + (0x1780, 'V'), + (0x17B4, 'X'), + (0x17B6, 'V'), + (0x17DE, 'X'), + (0x17E0, 'V'), + (0x17EA, 'X'), + (0x17F0, 'V'), + (0x17FA, 'X'), + (0x1800, 'V'), + (0x1806, 'X'), + (0x1807, 'V'), + (0x180B, 'I'), + (0x180E, 'X'), + (0x180F, 'I'), + (0x1810, 'V'), + (0x181A, 'X'), + (0x1820, 'V'), + (0x1879, 'X'), + (0x1880, 'V'), + (0x18AB, 'X'), + (0x18B0, 'V'), + (0x18F6, 'X'), + (0x1900, 'V'), + (0x191F, 'X'), + (0x1920, 'V'), + (0x192C, 'X'), + (0x1930, 'V'), + (0x193C, 'X'), + (0x1940, 'V'), + (0x1941, 'X'), + (0x1944, 'V'), + (0x196E, 'X'), + (0x1970, 'V'), + (0x1975, 'X'), + (0x1980, 'V'), + (0x19AC, 'X'), + (0x19B0, 'V'), + (0x19CA, 'X'), + (0x19D0, 'V'), + (0x19DB, 'X'), + (0x19DE, 'V'), + (0x1A1C, 'X'), + (0x1A1E, 'V'), + (0x1A5F, 'X'), + (0x1A60, 'V'), + (0x1A7D, 'X'), + (0x1A7F, 'V'), + (0x1A8A, 'X'), + (0x1A90, 'V'), + (0x1A9A, 'X'), + (0x1AA0, 'V'), + (0x1AAE, 'X'), + (0x1AB0, 'V'), + (0x1ACF, 'X'), + (0x1B00, 'V'), + (0x1B4D, 'X'), + (0x1B50, 'V'), + (0x1B7F, 'X'), + (0x1B80, 'V'), + (0x1BF4, 'X'), + (0x1BFC, 'V'), + (0x1C38, 'X'), + (0x1C3B, 'V'), + (0x1C4A, 'X'), + (0x1C4D, 'V'), + (0x1C80, 'M', 'в'), + ] + +def _seg_15() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1C81, 'M', 'д'), + (0x1C82, 'M', 'о'), + (0x1C83, 'M', 'с'), + (0x1C84, 'M', 'т'), + (0x1C86, 'M', 'ъ'), + (0x1C87, 'M', 'ѣ'), + (0x1C88, 'M', 'ꙋ'), + (0x1C89, 'X'), + (0x1C90, 'M', 'ა'), + (0x1C91, 'M', 'ბ'), + (0x1C92, 'M', 'გ'), + (0x1C93, 'M', 'დ'), + (0x1C94, 'M', 'ე'), + (0x1C95, 'M', 'ვ'), + (0x1C96, 'M', 'ზ'), + (0x1C97, 'M', 'თ'), + (0x1C98, 'M', 'ი'), + (0x1C99, 'M', 'კ'), + (0x1C9A, 'M', 'ლ'), + (0x1C9B, 'M', 'მ'), + (0x1C9C, 'M', 'ნ'), + (0x1C9D, 'M', 'ო'), + (0x1C9E, 'M', 'პ'), + (0x1C9F, 'M', 'ჟ'), + (0x1CA0, 'M', 'რ'), + (0x1CA1, 'M', 'ს'), + (0x1CA2, 'M', 'ტ'), + (0x1CA3, 'M', 'უ'), + (0x1CA4, 'M', 'ფ'), + (0x1CA5, 'M', 'ქ'), + (0x1CA6, 'M', 'ღ'), + (0x1CA7, 'M', 'ყ'), + (0x1CA8, 'M', 'შ'), + (0x1CA9, 'M', 'ჩ'), + (0x1CAA, 'M', 'ც'), + (0x1CAB, 'M', 'ძ'), + (0x1CAC, 'M', 'წ'), + (0x1CAD, 'M', 'ჭ'), + (0x1CAE, 'M', 'ხ'), + (0x1CAF, 'M', 'ჯ'), + (0x1CB0, 'M', 'ჰ'), + (0x1CB1, 'M', 'ჱ'), + (0x1CB2, 'M', 'ჲ'), + (0x1CB3, 'M', 'ჳ'), + (0x1CB4, 'M', 'ჴ'), + (0x1CB5, 'M', 'ჵ'), + (0x1CB6, 'M', 'ჶ'), + (0x1CB7, 'M', 'ჷ'), + (0x1CB8, 'M', 'ჸ'), + (0x1CB9, 'M', 'ჹ'), + (0x1CBA, 'M', 'ჺ'), + (0x1CBB, 'X'), + (0x1CBD, 'M', 'ჽ'), + (0x1CBE, 'M', 'ჾ'), + (0x1CBF, 'M', 'ჿ'), + (0x1CC0, 'V'), + (0x1CC8, 'X'), + (0x1CD0, 'V'), + (0x1CFB, 'X'), + (0x1D00, 'V'), + (0x1D2C, 'M', 'a'), + (0x1D2D, 'M', 'æ'), + (0x1D2E, 'M', 'b'), + (0x1D2F, 'V'), + (0x1D30, 'M', 'd'), + (0x1D31, 'M', 'e'), + (0x1D32, 'M', 'ǝ'), + (0x1D33, 'M', 'g'), + (0x1D34, 'M', 'h'), + (0x1D35, 'M', 'i'), + (0x1D36, 'M', 'j'), + (0x1D37, 'M', 'k'), + (0x1D38, 'M', 'l'), + (0x1D39, 'M', 'm'), + (0x1D3A, 'M', 'n'), + (0x1D3B, 'V'), + (0x1D3C, 'M', 'o'), + (0x1D3D, 'M', 'ȣ'), + (0x1D3E, 'M', 'p'), + (0x1D3F, 'M', 'r'), + (0x1D40, 'M', 't'), + (0x1D41, 'M', 'u'), + (0x1D42, 'M', 'w'), + (0x1D43, 'M', 'a'), + (0x1D44, 'M', 'ɐ'), + (0x1D45, 'M', 'ɑ'), + (0x1D46, 'M', 'ᴂ'), + (0x1D47, 'M', 'b'), + (0x1D48, 'M', 'd'), + (0x1D49, 'M', 'e'), + (0x1D4A, 'M', 'ə'), + (0x1D4B, 'M', 'ɛ'), + (0x1D4C, 'M', 'ɜ'), + (0x1D4D, 'M', 'g'), + (0x1D4E, 'V'), + (0x1D4F, 'M', 'k'), + (0x1D50, 'M', 'm'), + (0x1D51, 'M', 'ŋ'), + (0x1D52, 'M', 'o'), + (0x1D53, 'M', 'ɔ'), + ] + +def _seg_16() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D54, 'M', 'ᴖ'), + (0x1D55, 'M', 'ᴗ'), + (0x1D56, 'M', 'p'), + (0x1D57, 'M', 't'), + (0x1D58, 'M', 'u'), + (0x1D59, 'M', 'ᴝ'), + (0x1D5A, 'M', 'ɯ'), + (0x1D5B, 'M', 'v'), + (0x1D5C, 'M', 'ᴥ'), + (0x1D5D, 'M', 'β'), + (0x1D5E, 'M', 'γ'), + (0x1D5F, 'M', 'δ'), + (0x1D60, 'M', 'φ'), + (0x1D61, 'M', 'χ'), + (0x1D62, 'M', 'i'), + (0x1D63, 'M', 'r'), + (0x1D64, 'M', 'u'), + (0x1D65, 'M', 'v'), + (0x1D66, 'M', 'β'), + (0x1D67, 'M', 'γ'), + (0x1D68, 'M', 'ρ'), + (0x1D69, 'M', 'φ'), + (0x1D6A, 'M', 'χ'), + (0x1D6B, 'V'), + (0x1D78, 'M', 'н'), + (0x1D79, 'V'), + (0x1D9B, 'M', 'ɒ'), + (0x1D9C, 'M', 'c'), + (0x1D9D, 'M', 'ɕ'), + (0x1D9E, 'M', 'ð'), + (0x1D9F, 'M', 'ɜ'), + (0x1DA0, 'M', 'f'), + (0x1DA1, 'M', 'ɟ'), + (0x1DA2, 'M', 'ɡ'), + (0x1DA3, 'M', 'ɥ'), + (0x1DA4, 'M', 'ɨ'), + (0x1DA5, 'M', 'ɩ'), + (0x1DA6, 'M', 'ɪ'), + (0x1DA7, 'M', 'ᵻ'), + (0x1DA8, 'M', 'ʝ'), + (0x1DA9, 'M', 'ɭ'), + (0x1DAA, 'M', 'ᶅ'), + (0x1DAB, 'M', 'ʟ'), + (0x1DAC, 'M', 'ɱ'), + (0x1DAD, 'M', 'ɰ'), + (0x1DAE, 'M', 'ɲ'), + (0x1DAF, 'M', 'ɳ'), + (0x1DB0, 'M', 'ɴ'), + (0x1DB1, 'M', 'ɵ'), + (0x1DB2, 'M', 'ɸ'), + (0x1DB3, 'M', 'ʂ'), + (0x1DB4, 'M', 'ʃ'), + (0x1DB5, 'M', 'ƫ'), + (0x1DB6, 'M', 'ʉ'), + (0x1DB7, 'M', 'ʊ'), + (0x1DB8, 'M', 'ᴜ'), + (0x1DB9, 'M', 'ʋ'), + (0x1DBA, 'M', 'ʌ'), + (0x1DBB, 'M', 'z'), + (0x1DBC, 'M', 'ʐ'), + (0x1DBD, 'M', 'ʑ'), + (0x1DBE, 'M', 'ʒ'), + (0x1DBF, 'M', 'θ'), + (0x1DC0, 'V'), + (0x1E00, 'M', 'ḁ'), + (0x1E01, 'V'), + (0x1E02, 'M', 'ḃ'), + (0x1E03, 'V'), + (0x1E04, 'M', 'ḅ'), + (0x1E05, 'V'), + (0x1E06, 'M', 'ḇ'), + (0x1E07, 'V'), + (0x1E08, 'M', 'ḉ'), + (0x1E09, 'V'), + (0x1E0A, 'M', 'ḋ'), + (0x1E0B, 'V'), + (0x1E0C, 'M', 'ḍ'), + (0x1E0D, 'V'), + (0x1E0E, 'M', 'ḏ'), + (0x1E0F, 'V'), + (0x1E10, 'M', 'ḑ'), + (0x1E11, 'V'), + (0x1E12, 'M', 'ḓ'), + (0x1E13, 'V'), + (0x1E14, 'M', 'ḕ'), + (0x1E15, 'V'), + (0x1E16, 'M', 'ḗ'), + (0x1E17, 'V'), + (0x1E18, 'M', 'ḙ'), + (0x1E19, 'V'), + (0x1E1A, 'M', 'ḛ'), + (0x1E1B, 'V'), + (0x1E1C, 'M', 'ḝ'), + (0x1E1D, 'V'), + (0x1E1E, 'M', 'ḟ'), + (0x1E1F, 'V'), + (0x1E20, 'M', 'ḡ'), + (0x1E21, 'V'), + (0x1E22, 'M', 'ḣ'), + (0x1E23, 'V'), + ] + +def _seg_17() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E24, 'M', 'ḥ'), + (0x1E25, 'V'), + (0x1E26, 'M', 'ḧ'), + (0x1E27, 'V'), + (0x1E28, 'M', 'ḩ'), + (0x1E29, 'V'), + (0x1E2A, 'M', 'ḫ'), + (0x1E2B, 'V'), + (0x1E2C, 'M', 'ḭ'), + (0x1E2D, 'V'), + (0x1E2E, 'M', 'ḯ'), + (0x1E2F, 'V'), + (0x1E30, 'M', 'ḱ'), + (0x1E31, 'V'), + (0x1E32, 'M', 'ḳ'), + (0x1E33, 'V'), + (0x1E34, 'M', 'ḵ'), + (0x1E35, 'V'), + (0x1E36, 'M', 'ḷ'), + (0x1E37, 'V'), + (0x1E38, 'M', 'ḹ'), + (0x1E39, 'V'), + (0x1E3A, 'M', 'ḻ'), + (0x1E3B, 'V'), + (0x1E3C, 'M', 'ḽ'), + (0x1E3D, 'V'), + (0x1E3E, 'M', 'ḿ'), + (0x1E3F, 'V'), + (0x1E40, 'M', 'ṁ'), + (0x1E41, 'V'), + (0x1E42, 'M', 'ṃ'), + (0x1E43, 'V'), + (0x1E44, 'M', 'ṅ'), + (0x1E45, 'V'), + (0x1E46, 'M', 'ṇ'), + (0x1E47, 'V'), + (0x1E48, 'M', 'ṉ'), + (0x1E49, 'V'), + (0x1E4A, 'M', 'ṋ'), + (0x1E4B, 'V'), + (0x1E4C, 'M', 'ṍ'), + (0x1E4D, 'V'), + (0x1E4E, 'M', 'ṏ'), + (0x1E4F, 'V'), + (0x1E50, 'M', 'ṑ'), + (0x1E51, 'V'), + (0x1E52, 'M', 'ṓ'), + (0x1E53, 'V'), + (0x1E54, 'M', 'ṕ'), + (0x1E55, 'V'), + (0x1E56, 'M', 'ṗ'), + (0x1E57, 'V'), + (0x1E58, 'M', 'ṙ'), + (0x1E59, 'V'), + (0x1E5A, 'M', 'ṛ'), + (0x1E5B, 'V'), + (0x1E5C, 'M', 'ṝ'), + (0x1E5D, 'V'), + (0x1E5E, 'M', 'ṟ'), + (0x1E5F, 'V'), + (0x1E60, 'M', 'ṡ'), + (0x1E61, 'V'), + (0x1E62, 'M', 'ṣ'), + (0x1E63, 'V'), + (0x1E64, 'M', 'ṥ'), + (0x1E65, 'V'), + (0x1E66, 'M', 'ṧ'), + (0x1E67, 'V'), + (0x1E68, 'M', 'ṩ'), + (0x1E69, 'V'), + (0x1E6A, 'M', 'ṫ'), + (0x1E6B, 'V'), + (0x1E6C, 'M', 'ṭ'), + (0x1E6D, 'V'), + (0x1E6E, 'M', 'ṯ'), + (0x1E6F, 'V'), + (0x1E70, 'M', 'ṱ'), + (0x1E71, 'V'), + (0x1E72, 'M', 'ṳ'), + (0x1E73, 'V'), + (0x1E74, 'M', 'ṵ'), + (0x1E75, 'V'), + (0x1E76, 'M', 'ṷ'), + (0x1E77, 'V'), + (0x1E78, 'M', 'ṹ'), + (0x1E79, 'V'), + (0x1E7A, 'M', 'ṻ'), + (0x1E7B, 'V'), + (0x1E7C, 'M', 'ṽ'), + (0x1E7D, 'V'), + (0x1E7E, 'M', 'ṿ'), + (0x1E7F, 'V'), + (0x1E80, 'M', 'ẁ'), + (0x1E81, 'V'), + (0x1E82, 'M', 'ẃ'), + (0x1E83, 'V'), + (0x1E84, 'M', 'ẅ'), + (0x1E85, 'V'), + (0x1E86, 'M', 'ẇ'), + (0x1E87, 'V'), + ] + +def _seg_18() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E88, 'M', 'ẉ'), + (0x1E89, 'V'), + (0x1E8A, 'M', 'ẋ'), + (0x1E8B, 'V'), + (0x1E8C, 'M', 'ẍ'), + (0x1E8D, 'V'), + (0x1E8E, 'M', 'ẏ'), + (0x1E8F, 'V'), + (0x1E90, 'M', 'ẑ'), + (0x1E91, 'V'), + (0x1E92, 'M', 'ẓ'), + (0x1E93, 'V'), + (0x1E94, 'M', 'ẕ'), + (0x1E95, 'V'), + (0x1E9A, 'M', 'aʾ'), + (0x1E9B, 'M', 'ṡ'), + (0x1E9C, 'V'), + (0x1E9E, 'M', 'ss'), + (0x1E9F, 'V'), + (0x1EA0, 'M', 'ạ'), + (0x1EA1, 'V'), + (0x1EA2, 'M', 'ả'), + (0x1EA3, 'V'), + (0x1EA4, 'M', 'ấ'), + (0x1EA5, 'V'), + (0x1EA6, 'M', 'ầ'), + (0x1EA7, 'V'), + (0x1EA8, 'M', 'ẩ'), + (0x1EA9, 'V'), + (0x1EAA, 'M', 'ẫ'), + (0x1EAB, 'V'), + (0x1EAC, 'M', 'ậ'), + (0x1EAD, 'V'), + (0x1EAE, 'M', 'ắ'), + (0x1EAF, 'V'), + (0x1EB0, 'M', 'ằ'), + (0x1EB1, 'V'), + (0x1EB2, 'M', 'ẳ'), + (0x1EB3, 'V'), + (0x1EB4, 'M', 'ẵ'), + (0x1EB5, 'V'), + (0x1EB6, 'M', 'ặ'), + (0x1EB7, 'V'), + (0x1EB8, 'M', 'ẹ'), + (0x1EB9, 'V'), + (0x1EBA, 'M', 'ẻ'), + (0x1EBB, 'V'), + (0x1EBC, 'M', 'ẽ'), + (0x1EBD, 'V'), + (0x1EBE, 'M', 'ế'), + (0x1EBF, 'V'), + (0x1EC0, 'M', 'ề'), + (0x1EC1, 'V'), + (0x1EC2, 'M', 'ể'), + (0x1EC3, 'V'), + (0x1EC4, 'M', 'ễ'), + (0x1EC5, 'V'), + (0x1EC6, 'M', 'ệ'), + (0x1EC7, 'V'), + (0x1EC8, 'M', 'ỉ'), + (0x1EC9, 'V'), + (0x1ECA, 'M', 'ị'), + (0x1ECB, 'V'), + (0x1ECC, 'M', 'ọ'), + (0x1ECD, 'V'), + (0x1ECE, 'M', 'ỏ'), + (0x1ECF, 'V'), + (0x1ED0, 'M', 'ố'), + (0x1ED1, 'V'), + (0x1ED2, 'M', 'ồ'), + (0x1ED3, 'V'), + (0x1ED4, 'M', 'ổ'), + (0x1ED5, 'V'), + (0x1ED6, 'M', 'ỗ'), + (0x1ED7, 'V'), + (0x1ED8, 'M', 'ộ'), + (0x1ED9, 'V'), + (0x1EDA, 'M', 'ớ'), + (0x1EDB, 'V'), + (0x1EDC, 'M', 'ờ'), + (0x1EDD, 'V'), + (0x1EDE, 'M', 'ở'), + (0x1EDF, 'V'), + (0x1EE0, 'M', 'ỡ'), + (0x1EE1, 'V'), + (0x1EE2, 'M', 'ợ'), + (0x1EE3, 'V'), + (0x1EE4, 'M', 'ụ'), + (0x1EE5, 'V'), + (0x1EE6, 'M', 'ủ'), + (0x1EE7, 'V'), + (0x1EE8, 'M', 'ứ'), + (0x1EE9, 'V'), + (0x1EEA, 'M', 'ừ'), + (0x1EEB, 'V'), + (0x1EEC, 'M', 'ử'), + (0x1EED, 'V'), + (0x1EEE, 'M', 'ữ'), + (0x1EEF, 'V'), + (0x1EF0, 'M', 'ự'), + ] + +def _seg_19() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1EF1, 'V'), + (0x1EF2, 'M', 'ỳ'), + (0x1EF3, 'V'), + (0x1EF4, 'M', 'ỵ'), + (0x1EF5, 'V'), + (0x1EF6, 'M', 'ỷ'), + (0x1EF7, 'V'), + (0x1EF8, 'M', 'ỹ'), + (0x1EF9, 'V'), + (0x1EFA, 'M', 'ỻ'), + (0x1EFB, 'V'), + (0x1EFC, 'M', 'ỽ'), + (0x1EFD, 'V'), + (0x1EFE, 'M', 'ỿ'), + (0x1EFF, 'V'), + (0x1F08, 'M', 'ἀ'), + (0x1F09, 'M', 'ἁ'), + (0x1F0A, 'M', 'ἂ'), + (0x1F0B, 'M', 'ἃ'), + (0x1F0C, 'M', 'ἄ'), + (0x1F0D, 'M', 'ἅ'), + (0x1F0E, 'M', 'ἆ'), + (0x1F0F, 'M', 'ἇ'), + (0x1F10, 'V'), + (0x1F16, 'X'), + (0x1F18, 'M', 'ἐ'), + (0x1F19, 'M', 'ἑ'), + (0x1F1A, 'M', 'ἒ'), + (0x1F1B, 'M', 'ἓ'), + (0x1F1C, 'M', 'ἔ'), + (0x1F1D, 'M', 'ἕ'), + (0x1F1E, 'X'), + (0x1F20, 'V'), + (0x1F28, 'M', 'ἠ'), + (0x1F29, 'M', 'ἡ'), + (0x1F2A, 'M', 'ἢ'), + (0x1F2B, 'M', 'ἣ'), + (0x1F2C, 'M', 'ἤ'), + (0x1F2D, 'M', 'ἥ'), + (0x1F2E, 'M', 'ἦ'), + (0x1F2F, 'M', 'ἧ'), + (0x1F30, 'V'), + (0x1F38, 'M', 'ἰ'), + (0x1F39, 'M', 'ἱ'), + (0x1F3A, 'M', 'ἲ'), + (0x1F3B, 'M', 'ἳ'), + (0x1F3C, 'M', 'ἴ'), + (0x1F3D, 'M', 'ἵ'), + (0x1F3E, 'M', 'ἶ'), + (0x1F3F, 'M', 'ἷ'), + (0x1F40, 'V'), + (0x1F46, 'X'), + (0x1F48, 'M', 'ὀ'), + (0x1F49, 'M', 'ὁ'), + (0x1F4A, 'M', 'ὂ'), + (0x1F4B, 'M', 'ὃ'), + (0x1F4C, 'M', 'ὄ'), + (0x1F4D, 'M', 'ὅ'), + (0x1F4E, 'X'), + (0x1F50, 'V'), + (0x1F58, 'X'), + (0x1F59, 'M', 'ὑ'), + (0x1F5A, 'X'), + (0x1F5B, 'M', 'ὓ'), + (0x1F5C, 'X'), + (0x1F5D, 'M', 'ὕ'), + (0x1F5E, 'X'), + (0x1F5F, 'M', 'ὗ'), + (0x1F60, 'V'), + (0x1F68, 'M', 'ὠ'), + (0x1F69, 'M', 'ὡ'), + (0x1F6A, 'M', 'ὢ'), + (0x1F6B, 'M', 'ὣ'), + (0x1F6C, 'M', 'ὤ'), + (0x1F6D, 'M', 'ὥ'), + (0x1F6E, 'M', 'ὦ'), + (0x1F6F, 'M', 'ὧ'), + (0x1F70, 'V'), + (0x1F71, 'M', 'ά'), + (0x1F72, 'V'), + (0x1F73, 'M', 'έ'), + (0x1F74, 'V'), + (0x1F75, 'M', 'ή'), + (0x1F76, 'V'), + (0x1F77, 'M', 'ί'), + (0x1F78, 'V'), + (0x1F79, 'M', 'ό'), + (0x1F7A, 'V'), + (0x1F7B, 'M', 'ύ'), + (0x1F7C, 'V'), + (0x1F7D, 'M', 'ώ'), + (0x1F7E, 'X'), + (0x1F80, 'M', 'ἀι'), + (0x1F81, 'M', 'ἁι'), + (0x1F82, 'M', 'ἂι'), + (0x1F83, 'M', 'ἃι'), + (0x1F84, 'M', 'ἄι'), + (0x1F85, 'M', 'ἅι'), + (0x1F86, 'M', 'ἆι'), + (0x1F87, 'M', 'ἇι'), + ] + +def _seg_20() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1F88, 'M', 'ἀι'), + (0x1F89, 'M', 'ἁι'), + (0x1F8A, 'M', 'ἂι'), + (0x1F8B, 'M', 'ἃι'), + (0x1F8C, 'M', 'ἄι'), + (0x1F8D, 'M', 'ἅι'), + (0x1F8E, 'M', 'ἆι'), + (0x1F8F, 'M', 'ἇι'), + (0x1F90, 'M', 'ἠι'), + (0x1F91, 'M', 'ἡι'), + (0x1F92, 'M', 'ἢι'), + (0x1F93, 'M', 'ἣι'), + (0x1F94, 'M', 'ἤι'), + (0x1F95, 'M', 'ἥι'), + (0x1F96, 'M', 'ἦι'), + (0x1F97, 'M', 'ἧι'), + (0x1F98, 'M', 'ἠι'), + (0x1F99, 'M', 'ἡι'), + (0x1F9A, 'M', 'ἢι'), + (0x1F9B, 'M', 'ἣι'), + (0x1F9C, 'M', 'ἤι'), + (0x1F9D, 'M', 'ἥι'), + (0x1F9E, 'M', 'ἦι'), + (0x1F9F, 'M', 'ἧι'), + (0x1FA0, 'M', 'ὠι'), + (0x1FA1, 'M', 'ὡι'), + (0x1FA2, 'M', 'ὢι'), + (0x1FA3, 'M', 'ὣι'), + (0x1FA4, 'M', 'ὤι'), + (0x1FA5, 'M', 'ὥι'), + (0x1FA6, 'M', 'ὦι'), + (0x1FA7, 'M', 'ὧι'), + (0x1FA8, 'M', 'ὠι'), + (0x1FA9, 'M', 'ὡι'), + (0x1FAA, 'M', 'ὢι'), + (0x1FAB, 'M', 'ὣι'), + (0x1FAC, 'M', 'ὤι'), + (0x1FAD, 'M', 'ὥι'), + (0x1FAE, 'M', 'ὦι'), + (0x1FAF, 'M', 'ὧι'), + (0x1FB0, 'V'), + (0x1FB2, 'M', 'ὰι'), + (0x1FB3, 'M', 'αι'), + (0x1FB4, 'M', 'άι'), + (0x1FB5, 'X'), + (0x1FB6, 'V'), + (0x1FB7, 'M', 'ᾶι'), + (0x1FB8, 'M', 'ᾰ'), + (0x1FB9, 'M', 'ᾱ'), + (0x1FBA, 'M', 'ὰ'), + (0x1FBB, 'M', 'ά'), + (0x1FBC, 'M', 'αι'), + (0x1FBD, '3', ' ̓'), + (0x1FBE, 'M', 'ι'), + (0x1FBF, '3', ' ̓'), + (0x1FC0, '3', ' ͂'), + (0x1FC1, '3', ' ̈͂'), + (0x1FC2, 'M', 'ὴι'), + (0x1FC3, 'M', 'ηι'), + (0x1FC4, 'M', 'ήι'), + (0x1FC5, 'X'), + (0x1FC6, 'V'), + (0x1FC7, 'M', 'ῆι'), + (0x1FC8, 'M', 'ὲ'), + (0x1FC9, 'M', 'έ'), + (0x1FCA, 'M', 'ὴ'), + (0x1FCB, 'M', 'ή'), + (0x1FCC, 'M', 'ηι'), + (0x1FCD, '3', ' ̓̀'), + (0x1FCE, '3', ' ̓́'), + (0x1FCF, '3', ' ̓͂'), + (0x1FD0, 'V'), + (0x1FD3, 'M', 'ΐ'), + (0x1FD4, 'X'), + (0x1FD6, 'V'), + (0x1FD8, 'M', 'ῐ'), + (0x1FD9, 'M', 'ῑ'), + (0x1FDA, 'M', 'ὶ'), + (0x1FDB, 'M', 'ί'), + (0x1FDC, 'X'), + (0x1FDD, '3', ' ̔̀'), + (0x1FDE, '3', ' ̔́'), + (0x1FDF, '3', ' ̔͂'), + (0x1FE0, 'V'), + (0x1FE3, 'M', 'ΰ'), + (0x1FE4, 'V'), + (0x1FE8, 'M', 'ῠ'), + (0x1FE9, 'M', 'ῡ'), + (0x1FEA, 'M', 'ὺ'), + (0x1FEB, 'M', 'ύ'), + (0x1FEC, 'M', 'ῥ'), + (0x1FED, '3', ' ̈̀'), + (0x1FEE, '3', ' ̈́'), + (0x1FEF, '3', '`'), + (0x1FF0, 'X'), + (0x1FF2, 'M', 'ὼι'), + (0x1FF3, 'M', 'ωι'), + (0x1FF4, 'M', 'ώι'), + (0x1FF5, 'X'), + (0x1FF6, 'V'), + ] + +def _seg_21() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1FF7, 'M', 'ῶι'), + (0x1FF8, 'M', 'ὸ'), + (0x1FF9, 'M', 'ό'), + (0x1FFA, 'M', 'ὼ'), + (0x1FFB, 'M', 'ώ'), + (0x1FFC, 'M', 'ωι'), + (0x1FFD, '3', ' ́'), + (0x1FFE, '3', ' ̔'), + (0x1FFF, 'X'), + (0x2000, '3', ' '), + (0x200B, 'I'), + (0x200C, 'D', ''), + (0x200E, 'X'), + (0x2010, 'V'), + (0x2011, 'M', '‐'), + (0x2012, 'V'), + (0x2017, '3', ' ̳'), + (0x2018, 'V'), + (0x2024, 'X'), + (0x2027, 'V'), + (0x2028, 'X'), + (0x202F, '3', ' '), + (0x2030, 'V'), + (0x2033, 'M', '′′'), + (0x2034, 'M', '′′′'), + (0x2035, 'V'), + (0x2036, 'M', '‵‵'), + (0x2037, 'M', '‵‵‵'), + (0x2038, 'V'), + (0x203C, '3', '!!'), + (0x203D, 'V'), + (0x203E, '3', ' ̅'), + (0x203F, 'V'), + (0x2047, '3', '??'), + (0x2048, '3', '?!'), + (0x2049, '3', '!?'), + (0x204A, 'V'), + (0x2057, 'M', '′′′′'), + (0x2058, 'V'), + (0x205F, '3', ' '), + (0x2060, 'I'), + (0x2061, 'X'), + (0x2064, 'I'), + (0x2065, 'X'), + (0x2070, 'M', '0'), + (0x2071, 'M', 'i'), + (0x2072, 'X'), + (0x2074, 'M', '4'), + (0x2075, 'M', '5'), + (0x2076, 'M', '6'), + (0x2077, 'M', '7'), + (0x2078, 'M', '8'), + (0x2079, 'M', '9'), + (0x207A, '3', '+'), + (0x207B, 'M', '−'), + (0x207C, '3', '='), + (0x207D, '3', '('), + (0x207E, '3', ')'), + (0x207F, 'M', 'n'), + (0x2080, 'M', '0'), + (0x2081, 'M', '1'), + (0x2082, 'M', '2'), + (0x2083, 'M', '3'), + (0x2084, 'M', '4'), + (0x2085, 'M', '5'), + (0x2086, 'M', '6'), + (0x2087, 'M', '7'), + (0x2088, 'M', '8'), + (0x2089, 'M', '9'), + (0x208A, '3', '+'), + (0x208B, 'M', '−'), + (0x208C, '3', '='), + (0x208D, '3', '('), + (0x208E, '3', ')'), + (0x208F, 'X'), + (0x2090, 'M', 'a'), + (0x2091, 'M', 'e'), + (0x2092, 'M', 'o'), + (0x2093, 'M', 'x'), + (0x2094, 'M', 'ə'), + (0x2095, 'M', 'h'), + (0x2096, 'M', 'k'), + (0x2097, 'M', 'l'), + (0x2098, 'M', 'm'), + (0x2099, 'M', 'n'), + (0x209A, 'M', 'p'), + (0x209B, 'M', 's'), + (0x209C, 'M', 't'), + (0x209D, 'X'), + (0x20A0, 'V'), + (0x20A8, 'M', 'rs'), + (0x20A9, 'V'), + (0x20C1, 'X'), + (0x20D0, 'V'), + (0x20F1, 'X'), + (0x2100, '3', 'a/c'), + (0x2101, '3', 'a/s'), + (0x2102, 'M', 'c'), + (0x2103, 'M', '°c'), + (0x2104, 'V'), + ] + +def _seg_22() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2105, '3', 'c/o'), + (0x2106, '3', 'c/u'), + (0x2107, 'M', 'ɛ'), + (0x2108, 'V'), + (0x2109, 'M', '°f'), + (0x210A, 'M', 'g'), + (0x210B, 'M', 'h'), + (0x210F, 'M', 'ħ'), + (0x2110, 'M', 'i'), + (0x2112, 'M', 'l'), + (0x2114, 'V'), + (0x2115, 'M', 'n'), + (0x2116, 'M', 'no'), + (0x2117, 'V'), + (0x2119, 'M', 'p'), + (0x211A, 'M', 'q'), + (0x211B, 'M', 'r'), + (0x211E, 'V'), + (0x2120, 'M', 'sm'), + (0x2121, 'M', 'tel'), + (0x2122, 'M', 'tm'), + (0x2123, 'V'), + (0x2124, 'M', 'z'), + (0x2125, 'V'), + (0x2126, 'M', 'ω'), + (0x2127, 'V'), + (0x2128, 'M', 'z'), + (0x2129, 'V'), + (0x212A, 'M', 'k'), + (0x212B, 'M', 'å'), + (0x212C, 'M', 'b'), + (0x212D, 'M', 'c'), + (0x212E, 'V'), + (0x212F, 'M', 'e'), + (0x2131, 'M', 'f'), + (0x2132, 'X'), + (0x2133, 'M', 'm'), + (0x2134, 'M', 'o'), + (0x2135, 'M', 'א'), + (0x2136, 'M', 'ב'), + (0x2137, 'M', 'ג'), + (0x2138, 'M', 'ד'), + (0x2139, 'M', 'i'), + (0x213A, 'V'), + (0x213B, 'M', 'fax'), + (0x213C, 'M', 'π'), + (0x213D, 'M', 'γ'), + (0x213F, 'M', 'π'), + (0x2140, 'M', '∑'), + (0x2141, 'V'), + (0x2145, 'M', 'd'), + (0x2147, 'M', 'e'), + (0x2148, 'M', 'i'), + (0x2149, 'M', 'j'), + (0x214A, 'V'), + (0x2150, 'M', '1⁄7'), + (0x2151, 'M', '1⁄9'), + (0x2152, 'M', '1⁄10'), + (0x2153, 'M', '1⁄3'), + (0x2154, 'M', '2⁄3'), + (0x2155, 'M', '1⁄5'), + (0x2156, 'M', '2⁄5'), + (0x2157, 'M', '3⁄5'), + (0x2158, 'M', '4⁄5'), + (0x2159, 'M', '1⁄6'), + (0x215A, 'M', '5⁄6'), + (0x215B, 'M', '1⁄8'), + (0x215C, 'M', '3⁄8'), + (0x215D, 'M', '5⁄8'), + (0x215E, 'M', '7⁄8'), + (0x215F, 'M', '1⁄'), + (0x2160, 'M', 'i'), + (0x2161, 'M', 'ii'), + (0x2162, 'M', 'iii'), + (0x2163, 'M', 'iv'), + (0x2164, 'M', 'v'), + (0x2165, 'M', 'vi'), + (0x2166, 'M', 'vii'), + (0x2167, 'M', 'viii'), + (0x2168, 'M', 'ix'), + (0x2169, 'M', 'x'), + (0x216A, 'M', 'xi'), + (0x216B, 'M', 'xii'), + (0x216C, 'M', 'l'), + (0x216D, 'M', 'c'), + (0x216E, 'M', 'd'), + (0x216F, 'M', 'm'), + (0x2170, 'M', 'i'), + (0x2171, 'M', 'ii'), + (0x2172, 'M', 'iii'), + (0x2173, 'M', 'iv'), + (0x2174, 'M', 'v'), + (0x2175, 'M', 'vi'), + (0x2176, 'M', 'vii'), + (0x2177, 'M', 'viii'), + (0x2178, 'M', 'ix'), + (0x2179, 'M', 'x'), + (0x217A, 'M', 'xi'), + (0x217B, 'M', 'xii'), + (0x217C, 'M', 'l'), + ] + +def _seg_23() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x217D, 'M', 'c'), + (0x217E, 'M', 'd'), + (0x217F, 'M', 'm'), + (0x2180, 'V'), + (0x2183, 'X'), + (0x2184, 'V'), + (0x2189, 'M', '0⁄3'), + (0x218A, 'V'), + (0x218C, 'X'), + (0x2190, 'V'), + (0x222C, 'M', '∫∫'), + (0x222D, 'M', '∫∫∫'), + (0x222E, 'V'), + (0x222F, 'M', '∮∮'), + (0x2230, 'M', '∮∮∮'), + (0x2231, 'V'), + (0x2260, '3'), + (0x2261, 'V'), + (0x226E, '3'), + (0x2270, 'V'), + (0x2329, 'M', '〈'), + (0x232A, 'M', '〉'), + (0x232B, 'V'), + (0x2427, 'X'), + (0x2440, 'V'), + (0x244B, 'X'), + (0x2460, 'M', '1'), + (0x2461, 'M', '2'), + (0x2462, 'M', '3'), + (0x2463, 'M', '4'), + (0x2464, 'M', '5'), + (0x2465, 'M', '6'), + (0x2466, 'M', '7'), + (0x2467, 'M', '8'), + (0x2468, 'M', '9'), + (0x2469, 'M', '10'), + (0x246A, 'M', '11'), + (0x246B, 'M', '12'), + (0x246C, 'M', '13'), + (0x246D, 'M', '14'), + (0x246E, 'M', '15'), + (0x246F, 'M', '16'), + (0x2470, 'M', '17'), + (0x2471, 'M', '18'), + (0x2472, 'M', '19'), + (0x2473, 'M', '20'), + (0x2474, '3', '(1)'), + (0x2475, '3', '(2)'), + (0x2476, '3', '(3)'), + (0x2477, '3', '(4)'), + (0x2478, '3', '(5)'), + (0x2479, '3', '(6)'), + (0x247A, '3', '(7)'), + (0x247B, '3', '(8)'), + (0x247C, '3', '(9)'), + (0x247D, '3', '(10)'), + (0x247E, '3', '(11)'), + (0x247F, '3', '(12)'), + (0x2480, '3', '(13)'), + (0x2481, '3', '(14)'), + (0x2482, '3', '(15)'), + (0x2483, '3', '(16)'), + (0x2484, '3', '(17)'), + (0x2485, '3', '(18)'), + (0x2486, '3', '(19)'), + (0x2487, '3', '(20)'), + (0x2488, 'X'), + (0x249C, '3', '(a)'), + (0x249D, '3', '(b)'), + (0x249E, '3', '(c)'), + (0x249F, '3', '(d)'), + (0x24A0, '3', '(e)'), + (0x24A1, '3', '(f)'), + (0x24A2, '3', '(g)'), + (0x24A3, '3', '(h)'), + (0x24A4, '3', '(i)'), + (0x24A5, '3', '(j)'), + (0x24A6, '3', '(k)'), + (0x24A7, '3', '(l)'), + (0x24A8, '3', '(m)'), + (0x24A9, '3', '(n)'), + (0x24AA, '3', '(o)'), + (0x24AB, '3', '(p)'), + (0x24AC, '3', '(q)'), + (0x24AD, '3', '(r)'), + (0x24AE, '3', '(s)'), + (0x24AF, '3', '(t)'), + (0x24B0, '3', '(u)'), + (0x24B1, '3', '(v)'), + (0x24B2, '3', '(w)'), + (0x24B3, '3', '(x)'), + (0x24B4, '3', '(y)'), + (0x24B5, '3', '(z)'), + (0x24B6, 'M', 'a'), + (0x24B7, 'M', 'b'), + (0x24B8, 'M', 'c'), + (0x24B9, 'M', 'd'), + (0x24BA, 'M', 'e'), + (0x24BB, 'M', 'f'), + (0x24BC, 'M', 'g'), + ] + +def _seg_24() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x24BD, 'M', 'h'), + (0x24BE, 'M', 'i'), + (0x24BF, 'M', 'j'), + (0x24C0, 'M', 'k'), + (0x24C1, 'M', 'l'), + (0x24C2, 'M', 'm'), + (0x24C3, 'M', 'n'), + (0x24C4, 'M', 'o'), + (0x24C5, 'M', 'p'), + (0x24C6, 'M', 'q'), + (0x24C7, 'M', 'r'), + (0x24C8, 'M', 's'), + (0x24C9, 'M', 't'), + (0x24CA, 'M', 'u'), + (0x24CB, 'M', 'v'), + (0x24CC, 'M', 'w'), + (0x24CD, 'M', 'x'), + (0x24CE, 'M', 'y'), + (0x24CF, 'M', 'z'), + (0x24D0, 'M', 'a'), + (0x24D1, 'M', 'b'), + (0x24D2, 'M', 'c'), + (0x24D3, 'M', 'd'), + (0x24D4, 'M', 'e'), + (0x24D5, 'M', 'f'), + (0x24D6, 'M', 'g'), + (0x24D7, 'M', 'h'), + (0x24D8, 'M', 'i'), + (0x24D9, 'M', 'j'), + (0x24DA, 'M', 'k'), + (0x24DB, 'M', 'l'), + (0x24DC, 'M', 'm'), + (0x24DD, 'M', 'n'), + (0x24DE, 'M', 'o'), + (0x24DF, 'M', 'p'), + (0x24E0, 'M', 'q'), + (0x24E1, 'M', 'r'), + (0x24E2, 'M', 's'), + (0x24E3, 'M', 't'), + (0x24E4, 'M', 'u'), + (0x24E5, 'M', 'v'), + (0x24E6, 'M', 'w'), + (0x24E7, 'M', 'x'), + (0x24E8, 'M', 'y'), + (0x24E9, 'M', 'z'), + (0x24EA, 'M', '0'), + (0x24EB, 'V'), + (0x2A0C, 'M', '∫∫∫∫'), + (0x2A0D, 'V'), + (0x2A74, '3', '::='), + (0x2A75, '3', '=='), + (0x2A76, '3', '==='), + (0x2A77, 'V'), + (0x2ADC, 'M', '⫝̸'), + (0x2ADD, 'V'), + (0x2B74, 'X'), + (0x2B76, 'V'), + (0x2B96, 'X'), + (0x2B97, 'V'), + (0x2C00, 'M', 'ⰰ'), + (0x2C01, 'M', 'ⰱ'), + (0x2C02, 'M', 'ⰲ'), + (0x2C03, 'M', 'ⰳ'), + (0x2C04, 'M', 'ⰴ'), + (0x2C05, 'M', 'ⰵ'), + (0x2C06, 'M', 'ⰶ'), + (0x2C07, 'M', 'ⰷ'), + (0x2C08, 'M', 'ⰸ'), + (0x2C09, 'M', 'ⰹ'), + (0x2C0A, 'M', 'ⰺ'), + (0x2C0B, 'M', 'ⰻ'), + (0x2C0C, 'M', 'ⰼ'), + (0x2C0D, 'M', 'ⰽ'), + (0x2C0E, 'M', 'ⰾ'), + (0x2C0F, 'M', 'ⰿ'), + (0x2C10, 'M', 'ⱀ'), + (0x2C11, 'M', 'ⱁ'), + (0x2C12, 'M', 'ⱂ'), + (0x2C13, 'M', 'ⱃ'), + (0x2C14, 'M', 'ⱄ'), + (0x2C15, 'M', 'ⱅ'), + (0x2C16, 'M', 'ⱆ'), + (0x2C17, 'M', 'ⱇ'), + (0x2C18, 'M', 'ⱈ'), + (0x2C19, 'M', 'ⱉ'), + (0x2C1A, 'M', 'ⱊ'), + (0x2C1B, 'M', 'ⱋ'), + (0x2C1C, 'M', 'ⱌ'), + (0x2C1D, 'M', 'ⱍ'), + (0x2C1E, 'M', 'ⱎ'), + (0x2C1F, 'M', 'ⱏ'), + (0x2C20, 'M', 'ⱐ'), + (0x2C21, 'M', 'ⱑ'), + (0x2C22, 'M', 'ⱒ'), + (0x2C23, 'M', 'ⱓ'), + (0x2C24, 'M', 'ⱔ'), + (0x2C25, 'M', 'ⱕ'), + (0x2C26, 'M', 'ⱖ'), + (0x2C27, 'M', 'ⱗ'), + (0x2C28, 'M', 'ⱘ'), + ] + +def _seg_25() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2C29, 'M', 'ⱙ'), + (0x2C2A, 'M', 'ⱚ'), + (0x2C2B, 'M', 'ⱛ'), + (0x2C2C, 'M', 'ⱜ'), + (0x2C2D, 'M', 'ⱝ'), + (0x2C2E, 'M', 'ⱞ'), + (0x2C2F, 'M', 'ⱟ'), + (0x2C30, 'V'), + (0x2C60, 'M', 'ⱡ'), + (0x2C61, 'V'), + (0x2C62, 'M', 'ɫ'), + (0x2C63, 'M', 'ᵽ'), + (0x2C64, 'M', 'ɽ'), + (0x2C65, 'V'), + (0x2C67, 'M', 'ⱨ'), + (0x2C68, 'V'), + (0x2C69, 'M', 'ⱪ'), + (0x2C6A, 'V'), + (0x2C6B, 'M', 'ⱬ'), + (0x2C6C, 'V'), + (0x2C6D, 'M', 'ɑ'), + (0x2C6E, 'M', 'ɱ'), + (0x2C6F, 'M', 'ɐ'), + (0x2C70, 'M', 'ɒ'), + (0x2C71, 'V'), + (0x2C72, 'M', 'ⱳ'), + (0x2C73, 'V'), + (0x2C75, 'M', 'ⱶ'), + (0x2C76, 'V'), + (0x2C7C, 'M', 'j'), + (0x2C7D, 'M', 'v'), + (0x2C7E, 'M', 'ȿ'), + (0x2C7F, 'M', 'ɀ'), + (0x2C80, 'M', 'ⲁ'), + (0x2C81, 'V'), + (0x2C82, 'M', 'ⲃ'), + (0x2C83, 'V'), + (0x2C84, 'M', 'ⲅ'), + (0x2C85, 'V'), + (0x2C86, 'M', 'ⲇ'), + (0x2C87, 'V'), + (0x2C88, 'M', 'ⲉ'), + (0x2C89, 'V'), + (0x2C8A, 'M', 'ⲋ'), + (0x2C8B, 'V'), + (0x2C8C, 'M', 'ⲍ'), + (0x2C8D, 'V'), + (0x2C8E, 'M', 'ⲏ'), + (0x2C8F, 'V'), + (0x2C90, 'M', 'ⲑ'), + (0x2C91, 'V'), + (0x2C92, 'M', 'ⲓ'), + (0x2C93, 'V'), + (0x2C94, 'M', 'ⲕ'), + (0x2C95, 'V'), + (0x2C96, 'M', 'ⲗ'), + (0x2C97, 'V'), + (0x2C98, 'M', 'ⲙ'), + (0x2C99, 'V'), + (0x2C9A, 'M', 'ⲛ'), + (0x2C9B, 'V'), + (0x2C9C, 'M', 'ⲝ'), + (0x2C9D, 'V'), + (0x2C9E, 'M', 'ⲟ'), + (0x2C9F, 'V'), + (0x2CA0, 'M', 'ⲡ'), + (0x2CA1, 'V'), + (0x2CA2, 'M', 'ⲣ'), + (0x2CA3, 'V'), + (0x2CA4, 'M', 'ⲥ'), + (0x2CA5, 'V'), + (0x2CA6, 'M', 'ⲧ'), + (0x2CA7, 'V'), + (0x2CA8, 'M', 'ⲩ'), + (0x2CA9, 'V'), + (0x2CAA, 'M', 'ⲫ'), + (0x2CAB, 'V'), + (0x2CAC, 'M', 'ⲭ'), + (0x2CAD, 'V'), + (0x2CAE, 'M', 'ⲯ'), + (0x2CAF, 'V'), + (0x2CB0, 'M', 'ⲱ'), + (0x2CB1, 'V'), + (0x2CB2, 'M', 'ⲳ'), + (0x2CB3, 'V'), + (0x2CB4, 'M', 'ⲵ'), + (0x2CB5, 'V'), + (0x2CB6, 'M', 'ⲷ'), + (0x2CB7, 'V'), + (0x2CB8, 'M', 'ⲹ'), + (0x2CB9, 'V'), + (0x2CBA, 'M', 'ⲻ'), + (0x2CBB, 'V'), + (0x2CBC, 'M', 'ⲽ'), + (0x2CBD, 'V'), + (0x2CBE, 'M', 'ⲿ'), + (0x2CBF, 'V'), + (0x2CC0, 'M', 'ⳁ'), + (0x2CC1, 'V'), + (0x2CC2, 'M', 'ⳃ'), + ] + +def _seg_26() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2CC3, 'V'), + (0x2CC4, 'M', 'ⳅ'), + (0x2CC5, 'V'), + (0x2CC6, 'M', 'ⳇ'), + (0x2CC7, 'V'), + (0x2CC8, 'M', 'ⳉ'), + (0x2CC9, 'V'), + (0x2CCA, 'M', 'ⳋ'), + (0x2CCB, 'V'), + (0x2CCC, 'M', 'ⳍ'), + (0x2CCD, 'V'), + (0x2CCE, 'M', 'ⳏ'), + (0x2CCF, 'V'), + (0x2CD0, 'M', 'ⳑ'), + (0x2CD1, 'V'), + (0x2CD2, 'M', 'ⳓ'), + (0x2CD3, 'V'), + (0x2CD4, 'M', 'ⳕ'), + (0x2CD5, 'V'), + (0x2CD6, 'M', 'ⳗ'), + (0x2CD7, 'V'), + (0x2CD8, 'M', 'ⳙ'), + (0x2CD9, 'V'), + (0x2CDA, 'M', 'ⳛ'), + (0x2CDB, 'V'), + (0x2CDC, 'M', 'ⳝ'), + (0x2CDD, 'V'), + (0x2CDE, 'M', 'ⳟ'), + (0x2CDF, 'V'), + (0x2CE0, 'M', 'ⳡ'), + (0x2CE1, 'V'), + (0x2CE2, 'M', 'ⳣ'), + (0x2CE3, 'V'), + (0x2CEB, 'M', 'ⳬ'), + (0x2CEC, 'V'), + (0x2CED, 'M', 'ⳮ'), + (0x2CEE, 'V'), + (0x2CF2, 'M', 'ⳳ'), + (0x2CF3, 'V'), + (0x2CF4, 'X'), + (0x2CF9, 'V'), + (0x2D26, 'X'), + (0x2D27, 'V'), + (0x2D28, 'X'), + (0x2D2D, 'V'), + (0x2D2E, 'X'), + (0x2D30, 'V'), + (0x2D68, 'X'), + (0x2D6F, 'M', 'ⵡ'), + (0x2D70, 'V'), + (0x2D71, 'X'), + (0x2D7F, 'V'), + (0x2D97, 'X'), + (0x2DA0, 'V'), + (0x2DA7, 'X'), + (0x2DA8, 'V'), + (0x2DAF, 'X'), + (0x2DB0, 'V'), + (0x2DB7, 'X'), + (0x2DB8, 'V'), + (0x2DBF, 'X'), + (0x2DC0, 'V'), + (0x2DC7, 'X'), + (0x2DC8, 'V'), + (0x2DCF, 'X'), + (0x2DD0, 'V'), + (0x2DD7, 'X'), + (0x2DD8, 'V'), + (0x2DDF, 'X'), + (0x2DE0, 'V'), + (0x2E5E, 'X'), + (0x2E80, 'V'), + (0x2E9A, 'X'), + (0x2E9B, 'V'), + (0x2E9F, 'M', '母'), + (0x2EA0, 'V'), + (0x2EF3, 'M', '龟'), + (0x2EF4, 'X'), + (0x2F00, 'M', '一'), + (0x2F01, 'M', '丨'), + (0x2F02, 'M', '丶'), + (0x2F03, 'M', '丿'), + (0x2F04, 'M', '乙'), + (0x2F05, 'M', '亅'), + (0x2F06, 'M', '二'), + (0x2F07, 'M', '亠'), + (0x2F08, 'M', '人'), + (0x2F09, 'M', '儿'), + (0x2F0A, 'M', '入'), + (0x2F0B, 'M', '八'), + (0x2F0C, 'M', '冂'), + (0x2F0D, 'M', '冖'), + (0x2F0E, 'M', '冫'), + (0x2F0F, 'M', '几'), + (0x2F10, 'M', '凵'), + (0x2F11, 'M', '刀'), + (0x2F12, 'M', '力'), + (0x2F13, 'M', '勹'), + (0x2F14, 'M', '匕'), + (0x2F15, 'M', '匚'), + ] + +def _seg_27() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F16, 'M', '匸'), + (0x2F17, 'M', '十'), + (0x2F18, 'M', '卜'), + (0x2F19, 'M', '卩'), + (0x2F1A, 'M', '厂'), + (0x2F1B, 'M', '厶'), + (0x2F1C, 'M', '又'), + (0x2F1D, 'M', '口'), + (0x2F1E, 'M', '囗'), + (0x2F1F, 'M', '土'), + (0x2F20, 'M', '士'), + (0x2F21, 'M', '夂'), + (0x2F22, 'M', '夊'), + (0x2F23, 'M', '夕'), + (0x2F24, 'M', '大'), + (0x2F25, 'M', '女'), + (0x2F26, 'M', '子'), + (0x2F27, 'M', '宀'), + (0x2F28, 'M', '寸'), + (0x2F29, 'M', '小'), + (0x2F2A, 'M', '尢'), + (0x2F2B, 'M', '尸'), + (0x2F2C, 'M', '屮'), + (0x2F2D, 'M', '山'), + (0x2F2E, 'M', '巛'), + (0x2F2F, 'M', '工'), + (0x2F30, 'M', '己'), + (0x2F31, 'M', '巾'), + (0x2F32, 'M', '干'), + (0x2F33, 'M', '幺'), + (0x2F34, 'M', '广'), + (0x2F35, 'M', '廴'), + (0x2F36, 'M', '廾'), + (0x2F37, 'M', '弋'), + (0x2F38, 'M', '弓'), + (0x2F39, 'M', '彐'), + (0x2F3A, 'M', '彡'), + (0x2F3B, 'M', '彳'), + (0x2F3C, 'M', '心'), + (0x2F3D, 'M', '戈'), + (0x2F3E, 'M', '戶'), + (0x2F3F, 'M', '手'), + (0x2F40, 'M', '支'), + (0x2F41, 'M', '攴'), + (0x2F42, 'M', '文'), + (0x2F43, 'M', '斗'), + (0x2F44, 'M', '斤'), + (0x2F45, 'M', '方'), + (0x2F46, 'M', '无'), + (0x2F47, 'M', '日'), + (0x2F48, 'M', '曰'), + (0x2F49, 'M', '月'), + (0x2F4A, 'M', '木'), + (0x2F4B, 'M', '欠'), + (0x2F4C, 'M', '止'), + (0x2F4D, 'M', '歹'), + (0x2F4E, 'M', '殳'), + (0x2F4F, 'M', '毋'), + (0x2F50, 'M', '比'), + (0x2F51, 'M', '毛'), + (0x2F52, 'M', '氏'), + (0x2F53, 'M', '气'), + (0x2F54, 'M', '水'), + (0x2F55, 'M', '火'), + (0x2F56, 'M', '爪'), + (0x2F57, 'M', '父'), + (0x2F58, 'M', '爻'), + (0x2F59, 'M', '爿'), + (0x2F5A, 'M', '片'), + (0x2F5B, 'M', '牙'), + (0x2F5C, 'M', '牛'), + (0x2F5D, 'M', '犬'), + (0x2F5E, 'M', '玄'), + (0x2F5F, 'M', '玉'), + (0x2F60, 'M', '瓜'), + (0x2F61, 'M', '瓦'), + (0x2F62, 'M', '甘'), + (0x2F63, 'M', '生'), + (0x2F64, 'M', '用'), + (0x2F65, 'M', '田'), + (0x2F66, 'M', '疋'), + (0x2F67, 'M', '疒'), + (0x2F68, 'M', '癶'), + (0x2F69, 'M', '白'), + (0x2F6A, 'M', '皮'), + (0x2F6B, 'M', '皿'), + (0x2F6C, 'M', '目'), + (0x2F6D, 'M', '矛'), + (0x2F6E, 'M', '矢'), + (0x2F6F, 'M', '石'), + (0x2F70, 'M', '示'), + (0x2F71, 'M', '禸'), + (0x2F72, 'M', '禾'), + (0x2F73, 'M', '穴'), + (0x2F74, 'M', '立'), + (0x2F75, 'M', '竹'), + (0x2F76, 'M', '米'), + (0x2F77, 'M', '糸'), + (0x2F78, 'M', '缶'), + (0x2F79, 'M', '网'), + ] + +def _seg_28() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F7A, 'M', '羊'), + (0x2F7B, 'M', '羽'), + (0x2F7C, 'M', '老'), + (0x2F7D, 'M', '而'), + (0x2F7E, 'M', '耒'), + (0x2F7F, 'M', '耳'), + (0x2F80, 'M', '聿'), + (0x2F81, 'M', '肉'), + (0x2F82, 'M', '臣'), + (0x2F83, 'M', '自'), + (0x2F84, 'M', '至'), + (0x2F85, 'M', '臼'), + (0x2F86, 'M', '舌'), + (0x2F87, 'M', '舛'), + (0x2F88, 'M', '舟'), + (0x2F89, 'M', '艮'), + (0x2F8A, 'M', '色'), + (0x2F8B, 'M', '艸'), + (0x2F8C, 'M', '虍'), + (0x2F8D, 'M', '虫'), + (0x2F8E, 'M', '血'), + (0x2F8F, 'M', '行'), + (0x2F90, 'M', '衣'), + (0x2F91, 'M', '襾'), + (0x2F92, 'M', '見'), + (0x2F93, 'M', '角'), + (0x2F94, 'M', '言'), + (0x2F95, 'M', '谷'), + (0x2F96, 'M', '豆'), + (0x2F97, 'M', '豕'), + (0x2F98, 'M', '豸'), + (0x2F99, 'M', '貝'), + (0x2F9A, 'M', '赤'), + (0x2F9B, 'M', '走'), + (0x2F9C, 'M', '足'), + (0x2F9D, 'M', '身'), + (0x2F9E, 'M', '車'), + (0x2F9F, 'M', '辛'), + (0x2FA0, 'M', '辰'), + (0x2FA1, 'M', '辵'), + (0x2FA2, 'M', '邑'), + (0x2FA3, 'M', '酉'), + (0x2FA4, 'M', '釆'), + (0x2FA5, 'M', '里'), + (0x2FA6, 'M', '金'), + (0x2FA7, 'M', '長'), + (0x2FA8, 'M', '門'), + (0x2FA9, 'M', '阜'), + (0x2FAA, 'M', '隶'), + (0x2FAB, 'M', '隹'), + (0x2FAC, 'M', '雨'), + (0x2FAD, 'M', '靑'), + (0x2FAE, 'M', '非'), + (0x2FAF, 'M', '面'), + (0x2FB0, 'M', '革'), + (0x2FB1, 'M', '韋'), + (0x2FB2, 'M', '韭'), + (0x2FB3, 'M', '音'), + (0x2FB4, 'M', '頁'), + (0x2FB5, 'M', '風'), + (0x2FB6, 'M', '飛'), + (0x2FB7, 'M', '食'), + (0x2FB8, 'M', '首'), + (0x2FB9, 'M', '香'), + (0x2FBA, 'M', '馬'), + (0x2FBB, 'M', '骨'), + (0x2FBC, 'M', '高'), + (0x2FBD, 'M', '髟'), + (0x2FBE, 'M', '鬥'), + (0x2FBF, 'M', '鬯'), + (0x2FC0, 'M', '鬲'), + (0x2FC1, 'M', '鬼'), + (0x2FC2, 'M', '魚'), + (0x2FC3, 'M', '鳥'), + (0x2FC4, 'M', '鹵'), + (0x2FC5, 'M', '鹿'), + (0x2FC6, 'M', '麥'), + (0x2FC7, 'M', '麻'), + (0x2FC8, 'M', '黃'), + (0x2FC9, 'M', '黍'), + (0x2FCA, 'M', '黑'), + (0x2FCB, 'M', '黹'), + (0x2FCC, 'M', '黽'), + (0x2FCD, 'M', '鼎'), + (0x2FCE, 'M', '鼓'), + (0x2FCF, 'M', '鼠'), + (0x2FD0, 'M', '鼻'), + (0x2FD1, 'M', '齊'), + (0x2FD2, 'M', '齒'), + (0x2FD3, 'M', '龍'), + (0x2FD4, 'M', '龜'), + (0x2FD5, 'M', '龠'), + (0x2FD6, 'X'), + (0x3000, '3', ' '), + (0x3001, 'V'), + (0x3002, 'M', '.'), + (0x3003, 'V'), + (0x3036, 'M', '〒'), + (0x3037, 'V'), + (0x3038, 'M', '十'), + ] + +def _seg_29() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3039, 'M', '卄'), + (0x303A, 'M', '卅'), + (0x303B, 'V'), + (0x3040, 'X'), + (0x3041, 'V'), + (0x3097, 'X'), + (0x3099, 'V'), + (0x309B, '3', ' ゙'), + (0x309C, '3', ' ゚'), + (0x309D, 'V'), + (0x309F, 'M', 'より'), + (0x30A0, 'V'), + (0x30FF, 'M', 'コト'), + (0x3100, 'X'), + (0x3105, 'V'), + (0x3130, 'X'), + (0x3131, 'M', 'ᄀ'), + (0x3132, 'M', 'ᄁ'), + (0x3133, 'M', 'ᆪ'), + (0x3134, 'M', 'ᄂ'), + (0x3135, 'M', 'ᆬ'), + (0x3136, 'M', 'ᆭ'), + (0x3137, 'M', 'ᄃ'), + (0x3138, 'M', 'ᄄ'), + (0x3139, 'M', 'ᄅ'), + (0x313A, 'M', 'ᆰ'), + (0x313B, 'M', 'ᆱ'), + (0x313C, 'M', 'ᆲ'), + (0x313D, 'M', 'ᆳ'), + (0x313E, 'M', 'ᆴ'), + (0x313F, 'M', 'ᆵ'), + (0x3140, 'M', 'ᄚ'), + (0x3141, 'M', 'ᄆ'), + (0x3142, 'M', 'ᄇ'), + (0x3143, 'M', 'ᄈ'), + (0x3144, 'M', 'ᄡ'), + (0x3145, 'M', 'ᄉ'), + (0x3146, 'M', 'ᄊ'), + (0x3147, 'M', 'ᄋ'), + (0x3148, 'M', 'ᄌ'), + (0x3149, 'M', 'ᄍ'), + (0x314A, 'M', 'ᄎ'), + (0x314B, 'M', 'ᄏ'), + (0x314C, 'M', 'ᄐ'), + (0x314D, 'M', 'ᄑ'), + (0x314E, 'M', 'ᄒ'), + (0x314F, 'M', 'ᅡ'), + (0x3150, 'M', 'ᅢ'), + (0x3151, 'M', 'ᅣ'), + (0x3152, 'M', 'ᅤ'), + (0x3153, 'M', 'ᅥ'), + (0x3154, 'M', 'ᅦ'), + (0x3155, 'M', 'ᅧ'), + (0x3156, 'M', 'ᅨ'), + (0x3157, 'M', 'ᅩ'), + (0x3158, 'M', 'ᅪ'), + (0x3159, 'M', 'ᅫ'), + (0x315A, 'M', 'ᅬ'), + (0x315B, 'M', 'ᅭ'), + (0x315C, 'M', 'ᅮ'), + (0x315D, 'M', 'ᅯ'), + (0x315E, 'M', 'ᅰ'), + (0x315F, 'M', 'ᅱ'), + (0x3160, 'M', 'ᅲ'), + (0x3161, 'M', 'ᅳ'), + (0x3162, 'M', 'ᅴ'), + (0x3163, 'M', 'ᅵ'), + (0x3164, 'X'), + (0x3165, 'M', 'ᄔ'), + (0x3166, 'M', 'ᄕ'), + (0x3167, 'M', 'ᇇ'), + (0x3168, 'M', 'ᇈ'), + (0x3169, 'M', 'ᇌ'), + (0x316A, 'M', 'ᇎ'), + (0x316B, 'M', 'ᇓ'), + (0x316C, 'M', 'ᇗ'), + (0x316D, 'M', 'ᇙ'), + (0x316E, 'M', 'ᄜ'), + (0x316F, 'M', 'ᇝ'), + (0x3170, 'M', 'ᇟ'), + (0x3171, 'M', 'ᄝ'), + (0x3172, 'M', 'ᄞ'), + (0x3173, 'M', 'ᄠ'), + (0x3174, 'M', 'ᄢ'), + (0x3175, 'M', 'ᄣ'), + (0x3176, 'M', 'ᄧ'), + (0x3177, 'M', 'ᄩ'), + (0x3178, 'M', 'ᄫ'), + (0x3179, 'M', 'ᄬ'), + (0x317A, 'M', 'ᄭ'), + (0x317B, 'M', 'ᄮ'), + (0x317C, 'M', 'ᄯ'), + (0x317D, 'M', 'ᄲ'), + (0x317E, 'M', 'ᄶ'), + (0x317F, 'M', 'ᅀ'), + (0x3180, 'M', 'ᅇ'), + (0x3181, 'M', 'ᅌ'), + (0x3182, 'M', 'ᇱ'), + (0x3183, 'M', 'ᇲ'), + (0x3184, 'M', 'ᅗ'), + ] + +def _seg_30() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3185, 'M', 'ᅘ'), + (0x3186, 'M', 'ᅙ'), + (0x3187, 'M', 'ᆄ'), + (0x3188, 'M', 'ᆅ'), + (0x3189, 'M', 'ᆈ'), + (0x318A, 'M', 'ᆑ'), + (0x318B, 'M', 'ᆒ'), + (0x318C, 'M', 'ᆔ'), + (0x318D, 'M', 'ᆞ'), + (0x318E, 'M', 'ᆡ'), + (0x318F, 'X'), + (0x3190, 'V'), + (0x3192, 'M', '一'), + (0x3193, 'M', '二'), + (0x3194, 'M', '三'), + (0x3195, 'M', '四'), + (0x3196, 'M', '上'), + (0x3197, 'M', '中'), + (0x3198, 'M', '下'), + (0x3199, 'M', '甲'), + (0x319A, 'M', '乙'), + (0x319B, 'M', '丙'), + (0x319C, 'M', '丁'), + (0x319D, 'M', '天'), + (0x319E, 'M', '地'), + (0x319F, 'M', '人'), + (0x31A0, 'V'), + (0x31E4, 'X'), + (0x31F0, 'V'), + (0x3200, '3', '(ᄀ)'), + (0x3201, '3', '(ᄂ)'), + (0x3202, '3', '(ᄃ)'), + (0x3203, '3', '(ᄅ)'), + (0x3204, '3', '(ᄆ)'), + (0x3205, '3', '(ᄇ)'), + (0x3206, '3', '(ᄉ)'), + (0x3207, '3', '(ᄋ)'), + (0x3208, '3', '(ᄌ)'), + (0x3209, '3', '(ᄎ)'), + (0x320A, '3', '(ᄏ)'), + (0x320B, '3', '(ᄐ)'), + (0x320C, '3', '(ᄑ)'), + (0x320D, '3', '(ᄒ)'), + (0x320E, '3', '(가)'), + (0x320F, '3', '(나)'), + (0x3210, '3', '(다)'), + (0x3211, '3', '(라)'), + (0x3212, '3', '(마)'), + (0x3213, '3', '(바)'), + (0x3214, '3', '(사)'), + (0x3215, '3', '(아)'), + (0x3216, '3', '(자)'), + (0x3217, '3', '(차)'), + (0x3218, '3', '(카)'), + (0x3219, '3', '(타)'), + (0x321A, '3', '(파)'), + (0x321B, '3', '(하)'), + (0x321C, '3', '(주)'), + (0x321D, '3', '(오전)'), + (0x321E, '3', '(오후)'), + (0x321F, 'X'), + (0x3220, '3', '(一)'), + (0x3221, '3', '(二)'), + (0x3222, '3', '(三)'), + (0x3223, '3', '(四)'), + (0x3224, '3', '(五)'), + (0x3225, '3', '(六)'), + (0x3226, '3', '(七)'), + (0x3227, '3', '(八)'), + (0x3228, '3', '(九)'), + (0x3229, '3', '(十)'), + (0x322A, '3', '(月)'), + (0x322B, '3', '(火)'), + (0x322C, '3', '(水)'), + (0x322D, '3', '(木)'), + (0x322E, '3', '(金)'), + (0x322F, '3', '(土)'), + (0x3230, '3', '(日)'), + (0x3231, '3', '(株)'), + (0x3232, '3', '(有)'), + (0x3233, '3', '(社)'), + (0x3234, '3', '(名)'), + (0x3235, '3', '(特)'), + (0x3236, '3', '(財)'), + (0x3237, '3', '(祝)'), + (0x3238, '3', '(労)'), + (0x3239, '3', '(代)'), + (0x323A, '3', '(呼)'), + (0x323B, '3', '(学)'), + (0x323C, '3', '(監)'), + (0x323D, '3', '(企)'), + (0x323E, '3', '(資)'), + (0x323F, '3', '(協)'), + (0x3240, '3', '(祭)'), + (0x3241, '3', '(休)'), + (0x3242, '3', '(自)'), + (0x3243, '3', '(至)'), + (0x3244, 'M', '問'), + (0x3245, 'M', '幼'), + (0x3246, 'M', '文'), + ] + +def _seg_31() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3247, 'M', '箏'), + (0x3248, 'V'), + (0x3250, 'M', 'pte'), + (0x3251, 'M', '21'), + (0x3252, 'M', '22'), + (0x3253, 'M', '23'), + (0x3254, 'M', '24'), + (0x3255, 'M', '25'), + (0x3256, 'M', '26'), + (0x3257, 'M', '27'), + (0x3258, 'M', '28'), + (0x3259, 'M', '29'), + (0x325A, 'M', '30'), + (0x325B, 'M', '31'), + (0x325C, 'M', '32'), + (0x325D, 'M', '33'), + (0x325E, 'M', '34'), + (0x325F, 'M', '35'), + (0x3260, 'M', 'ᄀ'), + (0x3261, 'M', 'ᄂ'), + (0x3262, 'M', 'ᄃ'), + (0x3263, 'M', 'ᄅ'), + (0x3264, 'M', 'ᄆ'), + (0x3265, 'M', 'ᄇ'), + (0x3266, 'M', 'ᄉ'), + (0x3267, 'M', 'ᄋ'), + (0x3268, 'M', 'ᄌ'), + (0x3269, 'M', 'ᄎ'), + (0x326A, 'M', 'ᄏ'), + (0x326B, 'M', 'ᄐ'), + (0x326C, 'M', 'ᄑ'), + (0x326D, 'M', 'ᄒ'), + (0x326E, 'M', '가'), + (0x326F, 'M', '나'), + (0x3270, 'M', '다'), + (0x3271, 'M', '라'), + (0x3272, 'M', '마'), + (0x3273, 'M', '바'), + (0x3274, 'M', '사'), + (0x3275, 'M', '아'), + (0x3276, 'M', '자'), + (0x3277, 'M', '차'), + (0x3278, 'M', '카'), + (0x3279, 'M', '타'), + (0x327A, 'M', '파'), + (0x327B, 'M', '하'), + (0x327C, 'M', '참고'), + (0x327D, 'M', '주의'), + (0x327E, 'M', '우'), + (0x327F, 'V'), + (0x3280, 'M', '一'), + (0x3281, 'M', '二'), + (0x3282, 'M', '三'), + (0x3283, 'M', '四'), + (0x3284, 'M', '五'), + (0x3285, 'M', '六'), + (0x3286, 'M', '七'), + (0x3287, 'M', '八'), + (0x3288, 'M', '九'), + (0x3289, 'M', '十'), + (0x328A, 'M', '月'), + (0x328B, 'M', '火'), + (0x328C, 'M', '水'), + (0x328D, 'M', '木'), + (0x328E, 'M', '金'), + (0x328F, 'M', '土'), + (0x3290, 'M', '日'), + (0x3291, 'M', '株'), + (0x3292, 'M', '有'), + (0x3293, 'M', '社'), + (0x3294, 'M', '名'), + (0x3295, 'M', '特'), + (0x3296, 'M', '財'), + (0x3297, 'M', '祝'), + (0x3298, 'M', '労'), + (0x3299, 'M', '秘'), + (0x329A, 'M', '男'), + (0x329B, 'M', '女'), + (0x329C, 'M', '適'), + (0x329D, 'M', '優'), + (0x329E, 'M', '印'), + (0x329F, 'M', '注'), + (0x32A0, 'M', '項'), + (0x32A1, 'M', '休'), + (0x32A2, 'M', '写'), + (0x32A3, 'M', '正'), + (0x32A4, 'M', '上'), + (0x32A5, 'M', '中'), + (0x32A6, 'M', '下'), + (0x32A7, 'M', '左'), + (0x32A8, 'M', '右'), + (0x32A9, 'M', '医'), + (0x32AA, 'M', '宗'), + (0x32AB, 'M', '学'), + (0x32AC, 'M', '監'), + (0x32AD, 'M', '企'), + (0x32AE, 'M', '資'), + (0x32AF, 'M', '協'), + (0x32B0, 'M', '夜'), + (0x32B1, 'M', '36'), + ] + +def _seg_32() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x32B2, 'M', '37'), + (0x32B3, 'M', '38'), + (0x32B4, 'M', '39'), + (0x32B5, 'M', '40'), + (0x32B6, 'M', '41'), + (0x32B7, 'M', '42'), + (0x32B8, 'M', '43'), + (0x32B9, 'M', '44'), + (0x32BA, 'M', '45'), + (0x32BB, 'M', '46'), + (0x32BC, 'M', '47'), + (0x32BD, 'M', '48'), + (0x32BE, 'M', '49'), + (0x32BF, 'M', '50'), + (0x32C0, 'M', '1月'), + (0x32C1, 'M', '2月'), + (0x32C2, 'M', '3月'), + (0x32C3, 'M', '4月'), + (0x32C4, 'M', '5月'), + (0x32C5, 'M', '6月'), + (0x32C6, 'M', '7月'), + (0x32C7, 'M', '8月'), + (0x32C8, 'M', '9月'), + (0x32C9, 'M', '10月'), + (0x32CA, 'M', '11月'), + (0x32CB, 'M', '12月'), + (0x32CC, 'M', 'hg'), + (0x32CD, 'M', 'erg'), + (0x32CE, 'M', 'ev'), + (0x32CF, 'M', 'ltd'), + (0x32D0, 'M', 'ア'), + (0x32D1, 'M', 'イ'), + (0x32D2, 'M', 'ウ'), + (0x32D3, 'M', 'エ'), + (0x32D4, 'M', 'オ'), + (0x32D5, 'M', 'カ'), + (0x32D6, 'M', 'キ'), + (0x32D7, 'M', 'ク'), + (0x32D8, 'M', 'ケ'), + (0x32D9, 'M', 'コ'), + (0x32DA, 'M', 'サ'), + (0x32DB, 'M', 'シ'), + (0x32DC, 'M', 'ス'), + (0x32DD, 'M', 'セ'), + (0x32DE, 'M', 'ソ'), + (0x32DF, 'M', 'タ'), + (0x32E0, 'M', 'チ'), + (0x32E1, 'M', 'ツ'), + (0x32E2, 'M', 'テ'), + (0x32E3, 'M', 'ト'), + (0x32E4, 'M', 'ナ'), + (0x32E5, 'M', 'ニ'), + (0x32E6, 'M', 'ヌ'), + (0x32E7, 'M', 'ネ'), + (0x32E8, 'M', 'ノ'), + (0x32E9, 'M', 'ハ'), + (0x32EA, 'M', 'ヒ'), + (0x32EB, 'M', 'フ'), + (0x32EC, 'M', 'ヘ'), + (0x32ED, 'M', 'ホ'), + (0x32EE, 'M', 'マ'), + (0x32EF, 'M', 'ミ'), + (0x32F0, 'M', 'ム'), + (0x32F1, 'M', 'メ'), + (0x32F2, 'M', 'モ'), + (0x32F3, 'M', 'ヤ'), + (0x32F4, 'M', 'ユ'), + (0x32F5, 'M', 'ヨ'), + (0x32F6, 'M', 'ラ'), + (0x32F7, 'M', 'リ'), + (0x32F8, 'M', 'ル'), + (0x32F9, 'M', 'レ'), + (0x32FA, 'M', 'ロ'), + (0x32FB, 'M', 'ワ'), + (0x32FC, 'M', 'ヰ'), + (0x32FD, 'M', 'ヱ'), + (0x32FE, 'M', 'ヲ'), + (0x32FF, 'M', '令和'), + (0x3300, 'M', 'アパート'), + (0x3301, 'M', 'アルファ'), + (0x3302, 'M', 'アンペア'), + (0x3303, 'M', 'アール'), + (0x3304, 'M', 'イニング'), + (0x3305, 'M', 'インチ'), + (0x3306, 'M', 'ウォン'), + (0x3307, 'M', 'エスクード'), + (0x3308, 'M', 'エーカー'), + (0x3309, 'M', 'オンス'), + (0x330A, 'M', 'オーム'), + (0x330B, 'M', 'カイリ'), + (0x330C, 'M', 'カラット'), + (0x330D, 'M', 'カロリー'), + (0x330E, 'M', 'ガロン'), + (0x330F, 'M', 'ガンマ'), + (0x3310, 'M', 'ギガ'), + (0x3311, 'M', 'ギニー'), + (0x3312, 'M', 'キュリー'), + (0x3313, 'M', 'ギルダー'), + (0x3314, 'M', 'キロ'), + (0x3315, 'M', 'キログラム'), + ] + +def _seg_33() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3316, 'M', 'キロメートル'), + (0x3317, 'M', 'キロワット'), + (0x3318, 'M', 'グラム'), + (0x3319, 'M', 'グラムトン'), + (0x331A, 'M', 'クルゼイロ'), + (0x331B, 'M', 'クローネ'), + (0x331C, 'M', 'ケース'), + (0x331D, 'M', 'コルナ'), + (0x331E, 'M', 'コーポ'), + (0x331F, 'M', 'サイクル'), + (0x3320, 'M', 'サンチーム'), + (0x3321, 'M', 'シリング'), + (0x3322, 'M', 'センチ'), + (0x3323, 'M', 'セント'), + (0x3324, 'M', 'ダース'), + (0x3325, 'M', 'デシ'), + (0x3326, 'M', 'ドル'), + (0x3327, 'M', 'トン'), + (0x3328, 'M', 'ナノ'), + (0x3329, 'M', 'ノット'), + (0x332A, 'M', 'ハイツ'), + (0x332B, 'M', 'パーセント'), + (0x332C, 'M', 'パーツ'), + (0x332D, 'M', 'バーレル'), + (0x332E, 'M', 'ピアストル'), + (0x332F, 'M', 'ピクル'), + (0x3330, 'M', 'ピコ'), + (0x3331, 'M', 'ビル'), + (0x3332, 'M', 'ファラッド'), + (0x3333, 'M', 'フィート'), + (0x3334, 'M', 'ブッシェル'), + (0x3335, 'M', 'フラン'), + (0x3336, 'M', 'ヘクタール'), + (0x3337, 'M', 'ペソ'), + (0x3338, 'M', 'ペニヒ'), + (0x3339, 'M', 'ヘルツ'), + (0x333A, 'M', 'ペンス'), + (0x333B, 'M', 'ページ'), + (0x333C, 'M', 'ベータ'), + (0x333D, 'M', 'ポイント'), + (0x333E, 'M', 'ボルト'), + (0x333F, 'M', 'ホン'), + (0x3340, 'M', 'ポンド'), + (0x3341, 'M', 'ホール'), + (0x3342, 'M', 'ホーン'), + (0x3343, 'M', 'マイクロ'), + (0x3344, 'M', 'マイル'), + (0x3345, 'M', 'マッハ'), + (0x3346, 'M', 'マルク'), + (0x3347, 'M', 'マンション'), + (0x3348, 'M', 'ミクロン'), + (0x3349, 'M', 'ミリ'), + (0x334A, 'M', 'ミリバール'), + (0x334B, 'M', 'メガ'), + (0x334C, 'M', 'メガトン'), + (0x334D, 'M', 'メートル'), + (0x334E, 'M', 'ヤード'), + (0x334F, 'M', 'ヤール'), + (0x3350, 'M', 'ユアン'), + (0x3351, 'M', 'リットル'), + (0x3352, 'M', 'リラ'), + (0x3353, 'M', 'ルピー'), + (0x3354, 'M', 'ルーブル'), + (0x3355, 'M', 'レム'), + (0x3356, 'M', 'レントゲン'), + (0x3357, 'M', 'ワット'), + (0x3358, 'M', '0点'), + (0x3359, 'M', '1点'), + (0x335A, 'M', '2点'), + (0x335B, 'M', '3点'), + (0x335C, 'M', '4点'), + (0x335D, 'M', '5点'), + (0x335E, 'M', '6点'), + (0x335F, 'M', '7点'), + (0x3360, 'M', '8点'), + (0x3361, 'M', '9点'), + (0x3362, 'M', '10点'), + (0x3363, 'M', '11点'), + (0x3364, 'M', '12点'), + (0x3365, 'M', '13点'), + (0x3366, 'M', '14点'), + (0x3367, 'M', '15点'), + (0x3368, 'M', '16点'), + (0x3369, 'M', '17点'), + (0x336A, 'M', '18点'), + (0x336B, 'M', '19点'), + (0x336C, 'M', '20点'), + (0x336D, 'M', '21点'), + (0x336E, 'M', '22点'), + (0x336F, 'M', '23点'), + (0x3370, 'M', '24点'), + (0x3371, 'M', 'hpa'), + (0x3372, 'M', 'da'), + (0x3373, 'M', 'au'), + (0x3374, 'M', 'bar'), + (0x3375, 'M', 'ov'), + (0x3376, 'M', 'pc'), + (0x3377, 'M', 'dm'), + (0x3378, 'M', 'dm2'), + (0x3379, 'M', 'dm3'), + ] + +def _seg_34() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x337A, 'M', 'iu'), + (0x337B, 'M', '平成'), + (0x337C, 'M', '昭和'), + (0x337D, 'M', '大正'), + (0x337E, 'M', '明治'), + (0x337F, 'M', '株式会社'), + (0x3380, 'M', 'pa'), + (0x3381, 'M', 'na'), + (0x3382, 'M', 'μa'), + (0x3383, 'M', 'ma'), + (0x3384, 'M', 'ka'), + (0x3385, 'M', 'kb'), + (0x3386, 'M', 'mb'), + (0x3387, 'M', 'gb'), + (0x3388, 'M', 'cal'), + (0x3389, 'M', 'kcal'), + (0x338A, 'M', 'pf'), + (0x338B, 'M', 'nf'), + (0x338C, 'M', 'μf'), + (0x338D, 'M', 'μg'), + (0x338E, 'M', 'mg'), + (0x338F, 'M', 'kg'), + (0x3390, 'M', 'hz'), + (0x3391, 'M', 'khz'), + (0x3392, 'M', 'mhz'), + (0x3393, 'M', 'ghz'), + (0x3394, 'M', 'thz'), + (0x3395, 'M', 'μl'), + (0x3396, 'M', 'ml'), + (0x3397, 'M', 'dl'), + (0x3398, 'M', 'kl'), + (0x3399, 'M', 'fm'), + (0x339A, 'M', 'nm'), + (0x339B, 'M', 'μm'), + (0x339C, 'M', 'mm'), + (0x339D, 'M', 'cm'), + (0x339E, 'M', 'km'), + (0x339F, 'M', 'mm2'), + (0x33A0, 'M', 'cm2'), + (0x33A1, 'M', 'm2'), + (0x33A2, 'M', 'km2'), + (0x33A3, 'M', 'mm3'), + (0x33A4, 'M', 'cm3'), + (0x33A5, 'M', 'm3'), + (0x33A6, 'M', 'km3'), + (0x33A7, 'M', 'm∕s'), + (0x33A8, 'M', 'm∕s2'), + (0x33A9, 'M', 'pa'), + (0x33AA, 'M', 'kpa'), + (0x33AB, 'M', 'mpa'), + (0x33AC, 'M', 'gpa'), + (0x33AD, 'M', 'rad'), + (0x33AE, 'M', 'rad∕s'), + (0x33AF, 'M', 'rad∕s2'), + (0x33B0, 'M', 'ps'), + (0x33B1, 'M', 'ns'), + (0x33B2, 'M', 'μs'), + (0x33B3, 'M', 'ms'), + (0x33B4, 'M', 'pv'), + (0x33B5, 'M', 'nv'), + (0x33B6, 'M', 'μv'), + (0x33B7, 'M', 'mv'), + (0x33B8, 'M', 'kv'), + (0x33B9, 'M', 'mv'), + (0x33BA, 'M', 'pw'), + (0x33BB, 'M', 'nw'), + (0x33BC, 'M', 'μw'), + (0x33BD, 'M', 'mw'), + (0x33BE, 'M', 'kw'), + (0x33BF, 'M', 'mw'), + (0x33C0, 'M', 'kω'), + (0x33C1, 'M', 'mω'), + (0x33C2, 'X'), + (0x33C3, 'M', 'bq'), + (0x33C4, 'M', 'cc'), + (0x33C5, 'M', 'cd'), + (0x33C6, 'M', 'c∕kg'), + (0x33C7, 'X'), + (0x33C8, 'M', 'db'), + (0x33C9, 'M', 'gy'), + (0x33CA, 'M', 'ha'), + (0x33CB, 'M', 'hp'), + (0x33CC, 'M', 'in'), + (0x33CD, 'M', 'kk'), + (0x33CE, 'M', 'km'), + (0x33CF, 'M', 'kt'), + (0x33D0, 'M', 'lm'), + (0x33D1, 'M', 'ln'), + (0x33D2, 'M', 'log'), + (0x33D3, 'M', 'lx'), + (0x33D4, 'M', 'mb'), + (0x33D5, 'M', 'mil'), + (0x33D6, 'M', 'mol'), + (0x33D7, 'M', 'ph'), + (0x33D8, 'X'), + (0x33D9, 'M', 'ppm'), + (0x33DA, 'M', 'pr'), + (0x33DB, 'M', 'sr'), + (0x33DC, 'M', 'sv'), + (0x33DD, 'M', 'wb'), + ] + +def _seg_35() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x33DE, 'M', 'v∕m'), + (0x33DF, 'M', 'a∕m'), + (0x33E0, 'M', '1日'), + (0x33E1, 'M', '2日'), + (0x33E2, 'M', '3日'), + (0x33E3, 'M', '4日'), + (0x33E4, 'M', '5日'), + (0x33E5, 'M', '6日'), + (0x33E6, 'M', '7日'), + (0x33E7, 'M', '8日'), + (0x33E8, 'M', '9日'), + (0x33E9, 'M', '10日'), + (0x33EA, 'M', '11日'), + (0x33EB, 'M', '12日'), + (0x33EC, 'M', '13日'), + (0x33ED, 'M', '14日'), + (0x33EE, 'M', '15日'), + (0x33EF, 'M', '16日'), + (0x33F0, 'M', '17日'), + (0x33F1, 'M', '18日'), + (0x33F2, 'M', '19日'), + (0x33F3, 'M', '20日'), + (0x33F4, 'M', '21日'), + (0x33F5, 'M', '22日'), + (0x33F6, 'M', '23日'), + (0x33F7, 'M', '24日'), + (0x33F8, 'M', '25日'), + (0x33F9, 'M', '26日'), + (0x33FA, 'M', '27日'), + (0x33FB, 'M', '28日'), + (0x33FC, 'M', '29日'), + (0x33FD, 'M', '30日'), + (0x33FE, 'M', '31日'), + (0x33FF, 'M', 'gal'), + (0x3400, 'V'), + (0xA48D, 'X'), + (0xA490, 'V'), + (0xA4C7, 'X'), + (0xA4D0, 'V'), + (0xA62C, 'X'), + (0xA640, 'M', 'ꙁ'), + (0xA641, 'V'), + (0xA642, 'M', 'ꙃ'), + (0xA643, 'V'), + (0xA644, 'M', 'ꙅ'), + (0xA645, 'V'), + (0xA646, 'M', 'ꙇ'), + (0xA647, 'V'), + (0xA648, 'M', 'ꙉ'), + (0xA649, 'V'), + (0xA64A, 'M', 'ꙋ'), + (0xA64B, 'V'), + (0xA64C, 'M', 'ꙍ'), + (0xA64D, 'V'), + (0xA64E, 'M', 'ꙏ'), + (0xA64F, 'V'), + (0xA650, 'M', 'ꙑ'), + (0xA651, 'V'), + (0xA652, 'M', 'ꙓ'), + (0xA653, 'V'), + (0xA654, 'M', 'ꙕ'), + (0xA655, 'V'), + (0xA656, 'M', 'ꙗ'), + (0xA657, 'V'), + (0xA658, 'M', 'ꙙ'), + (0xA659, 'V'), + (0xA65A, 'M', 'ꙛ'), + (0xA65B, 'V'), + (0xA65C, 'M', 'ꙝ'), + (0xA65D, 'V'), + (0xA65E, 'M', 'ꙟ'), + (0xA65F, 'V'), + (0xA660, 'M', 'ꙡ'), + (0xA661, 'V'), + (0xA662, 'M', 'ꙣ'), + (0xA663, 'V'), + (0xA664, 'M', 'ꙥ'), + (0xA665, 'V'), + (0xA666, 'M', 'ꙧ'), + (0xA667, 'V'), + (0xA668, 'M', 'ꙩ'), + (0xA669, 'V'), + (0xA66A, 'M', 'ꙫ'), + (0xA66B, 'V'), + (0xA66C, 'M', 'ꙭ'), + (0xA66D, 'V'), + (0xA680, 'M', 'ꚁ'), + (0xA681, 'V'), + (0xA682, 'M', 'ꚃ'), + (0xA683, 'V'), + (0xA684, 'M', 'ꚅ'), + (0xA685, 'V'), + (0xA686, 'M', 'ꚇ'), + (0xA687, 'V'), + (0xA688, 'M', 'ꚉ'), + (0xA689, 'V'), + (0xA68A, 'M', 'ꚋ'), + (0xA68B, 'V'), + (0xA68C, 'M', 'ꚍ'), + (0xA68D, 'V'), + ] + +def _seg_36() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA68E, 'M', 'ꚏ'), + (0xA68F, 'V'), + (0xA690, 'M', 'ꚑ'), + (0xA691, 'V'), + (0xA692, 'M', 'ꚓ'), + (0xA693, 'V'), + (0xA694, 'M', 'ꚕ'), + (0xA695, 'V'), + (0xA696, 'M', 'ꚗ'), + (0xA697, 'V'), + (0xA698, 'M', 'ꚙ'), + (0xA699, 'V'), + (0xA69A, 'M', 'ꚛ'), + (0xA69B, 'V'), + (0xA69C, 'M', 'ъ'), + (0xA69D, 'M', 'ь'), + (0xA69E, 'V'), + (0xA6F8, 'X'), + (0xA700, 'V'), + (0xA722, 'M', 'ꜣ'), + (0xA723, 'V'), + (0xA724, 'M', 'ꜥ'), + (0xA725, 'V'), + (0xA726, 'M', 'ꜧ'), + (0xA727, 'V'), + (0xA728, 'M', 'ꜩ'), + (0xA729, 'V'), + (0xA72A, 'M', 'ꜫ'), + (0xA72B, 'V'), + (0xA72C, 'M', 'ꜭ'), + (0xA72D, 'V'), + (0xA72E, 'M', 'ꜯ'), + (0xA72F, 'V'), + (0xA732, 'M', 'ꜳ'), + (0xA733, 'V'), + (0xA734, 'M', 'ꜵ'), + (0xA735, 'V'), + (0xA736, 'M', 'ꜷ'), + (0xA737, 'V'), + (0xA738, 'M', 'ꜹ'), + (0xA739, 'V'), + (0xA73A, 'M', 'ꜻ'), + (0xA73B, 'V'), + (0xA73C, 'M', 'ꜽ'), + (0xA73D, 'V'), + (0xA73E, 'M', 'ꜿ'), + (0xA73F, 'V'), + (0xA740, 'M', 'ꝁ'), + (0xA741, 'V'), + (0xA742, 'M', 'ꝃ'), + (0xA743, 'V'), + (0xA744, 'M', 'ꝅ'), + (0xA745, 'V'), + (0xA746, 'M', 'ꝇ'), + (0xA747, 'V'), + (0xA748, 'M', 'ꝉ'), + (0xA749, 'V'), + (0xA74A, 'M', 'ꝋ'), + (0xA74B, 'V'), + (0xA74C, 'M', 'ꝍ'), + (0xA74D, 'V'), + (0xA74E, 'M', 'ꝏ'), + (0xA74F, 'V'), + (0xA750, 'M', 'ꝑ'), + (0xA751, 'V'), + (0xA752, 'M', 'ꝓ'), + (0xA753, 'V'), + (0xA754, 'M', 'ꝕ'), + (0xA755, 'V'), + (0xA756, 'M', 'ꝗ'), + (0xA757, 'V'), + (0xA758, 'M', 'ꝙ'), + (0xA759, 'V'), + (0xA75A, 'M', 'ꝛ'), + (0xA75B, 'V'), + (0xA75C, 'M', 'ꝝ'), + (0xA75D, 'V'), + (0xA75E, 'M', 'ꝟ'), + (0xA75F, 'V'), + (0xA760, 'M', 'ꝡ'), + (0xA761, 'V'), + (0xA762, 'M', 'ꝣ'), + (0xA763, 'V'), + (0xA764, 'M', 'ꝥ'), + (0xA765, 'V'), + (0xA766, 'M', 'ꝧ'), + (0xA767, 'V'), + (0xA768, 'M', 'ꝩ'), + (0xA769, 'V'), + (0xA76A, 'M', 'ꝫ'), + (0xA76B, 'V'), + (0xA76C, 'M', 'ꝭ'), + (0xA76D, 'V'), + (0xA76E, 'M', 'ꝯ'), + (0xA76F, 'V'), + (0xA770, 'M', 'ꝯ'), + (0xA771, 'V'), + (0xA779, 'M', 'ꝺ'), + (0xA77A, 'V'), + (0xA77B, 'M', 'ꝼ'), + ] + +def _seg_37() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA77C, 'V'), + (0xA77D, 'M', 'ᵹ'), + (0xA77E, 'M', 'ꝿ'), + (0xA77F, 'V'), + (0xA780, 'M', 'ꞁ'), + (0xA781, 'V'), + (0xA782, 'M', 'ꞃ'), + (0xA783, 'V'), + (0xA784, 'M', 'ꞅ'), + (0xA785, 'V'), + (0xA786, 'M', 'ꞇ'), + (0xA787, 'V'), + (0xA78B, 'M', 'ꞌ'), + (0xA78C, 'V'), + (0xA78D, 'M', 'ɥ'), + (0xA78E, 'V'), + (0xA790, 'M', 'ꞑ'), + (0xA791, 'V'), + (0xA792, 'M', 'ꞓ'), + (0xA793, 'V'), + (0xA796, 'M', 'ꞗ'), + (0xA797, 'V'), + (0xA798, 'M', 'ꞙ'), + (0xA799, 'V'), + (0xA79A, 'M', 'ꞛ'), + (0xA79B, 'V'), + (0xA79C, 'M', 'ꞝ'), + (0xA79D, 'V'), + (0xA79E, 'M', 'ꞟ'), + (0xA79F, 'V'), + (0xA7A0, 'M', 'ꞡ'), + (0xA7A1, 'V'), + (0xA7A2, 'M', 'ꞣ'), + (0xA7A3, 'V'), + (0xA7A4, 'M', 'ꞥ'), + (0xA7A5, 'V'), + (0xA7A6, 'M', 'ꞧ'), + (0xA7A7, 'V'), + (0xA7A8, 'M', 'ꞩ'), + (0xA7A9, 'V'), + (0xA7AA, 'M', 'ɦ'), + (0xA7AB, 'M', 'ɜ'), + (0xA7AC, 'M', 'ɡ'), + (0xA7AD, 'M', 'ɬ'), + (0xA7AE, 'M', 'ɪ'), + (0xA7AF, 'V'), + (0xA7B0, 'M', 'ʞ'), + (0xA7B1, 'M', 'ʇ'), + (0xA7B2, 'M', 'ʝ'), + (0xA7B3, 'M', 'ꭓ'), + (0xA7B4, 'M', 'ꞵ'), + (0xA7B5, 'V'), + (0xA7B6, 'M', 'ꞷ'), + (0xA7B7, 'V'), + (0xA7B8, 'M', 'ꞹ'), + (0xA7B9, 'V'), + (0xA7BA, 'M', 'ꞻ'), + (0xA7BB, 'V'), + (0xA7BC, 'M', 'ꞽ'), + (0xA7BD, 'V'), + (0xA7BE, 'M', 'ꞿ'), + (0xA7BF, 'V'), + (0xA7C0, 'M', 'ꟁ'), + (0xA7C1, 'V'), + (0xA7C2, 'M', 'ꟃ'), + (0xA7C3, 'V'), + (0xA7C4, 'M', 'ꞔ'), + (0xA7C5, 'M', 'ʂ'), + (0xA7C6, 'M', 'ᶎ'), + (0xA7C7, 'M', 'ꟈ'), + (0xA7C8, 'V'), + (0xA7C9, 'M', 'ꟊ'), + (0xA7CA, 'V'), + (0xA7CB, 'X'), + (0xA7D0, 'M', 'ꟑ'), + (0xA7D1, 'V'), + (0xA7D2, 'X'), + (0xA7D3, 'V'), + (0xA7D4, 'X'), + (0xA7D5, 'V'), + (0xA7D6, 'M', 'ꟗ'), + (0xA7D7, 'V'), + (0xA7D8, 'M', 'ꟙ'), + (0xA7D9, 'V'), + (0xA7DA, 'X'), + (0xA7F2, 'M', 'c'), + (0xA7F3, 'M', 'f'), + (0xA7F4, 'M', 'q'), + (0xA7F5, 'M', 'ꟶ'), + (0xA7F6, 'V'), + (0xA7F8, 'M', 'ħ'), + (0xA7F9, 'M', 'œ'), + (0xA7FA, 'V'), + (0xA82D, 'X'), + (0xA830, 'V'), + (0xA83A, 'X'), + (0xA840, 'V'), + (0xA878, 'X'), + (0xA880, 'V'), + (0xA8C6, 'X'), + ] + +def _seg_38() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA8CE, 'V'), + (0xA8DA, 'X'), + (0xA8E0, 'V'), + (0xA954, 'X'), + (0xA95F, 'V'), + (0xA97D, 'X'), + (0xA980, 'V'), + (0xA9CE, 'X'), + (0xA9CF, 'V'), + (0xA9DA, 'X'), + (0xA9DE, 'V'), + (0xA9FF, 'X'), + (0xAA00, 'V'), + (0xAA37, 'X'), + (0xAA40, 'V'), + (0xAA4E, 'X'), + (0xAA50, 'V'), + (0xAA5A, 'X'), + (0xAA5C, 'V'), + (0xAAC3, 'X'), + (0xAADB, 'V'), + (0xAAF7, 'X'), + (0xAB01, 'V'), + (0xAB07, 'X'), + (0xAB09, 'V'), + (0xAB0F, 'X'), + (0xAB11, 'V'), + (0xAB17, 'X'), + (0xAB20, 'V'), + (0xAB27, 'X'), + (0xAB28, 'V'), + (0xAB2F, 'X'), + (0xAB30, 'V'), + (0xAB5C, 'M', 'ꜧ'), + (0xAB5D, 'M', 'ꬷ'), + (0xAB5E, 'M', 'ɫ'), + (0xAB5F, 'M', 'ꭒ'), + (0xAB60, 'V'), + (0xAB69, 'M', 'ʍ'), + (0xAB6A, 'V'), + (0xAB6C, 'X'), + (0xAB70, 'M', 'Ꭰ'), + (0xAB71, 'M', 'Ꭱ'), + (0xAB72, 'M', 'Ꭲ'), + (0xAB73, 'M', 'Ꭳ'), + (0xAB74, 'M', 'Ꭴ'), + (0xAB75, 'M', 'Ꭵ'), + (0xAB76, 'M', 'Ꭶ'), + (0xAB77, 'M', 'Ꭷ'), + (0xAB78, 'M', 'Ꭸ'), + (0xAB79, 'M', 'Ꭹ'), + (0xAB7A, 'M', 'Ꭺ'), + (0xAB7B, 'M', 'Ꭻ'), + (0xAB7C, 'M', 'Ꭼ'), + (0xAB7D, 'M', 'Ꭽ'), + (0xAB7E, 'M', 'Ꭾ'), + (0xAB7F, 'M', 'Ꭿ'), + (0xAB80, 'M', 'Ꮀ'), + (0xAB81, 'M', 'Ꮁ'), + (0xAB82, 'M', 'Ꮂ'), + (0xAB83, 'M', 'Ꮃ'), + (0xAB84, 'M', 'Ꮄ'), + (0xAB85, 'M', 'Ꮅ'), + (0xAB86, 'M', 'Ꮆ'), + (0xAB87, 'M', 'Ꮇ'), + (0xAB88, 'M', 'Ꮈ'), + (0xAB89, 'M', 'Ꮉ'), + (0xAB8A, 'M', 'Ꮊ'), + (0xAB8B, 'M', 'Ꮋ'), + (0xAB8C, 'M', 'Ꮌ'), + (0xAB8D, 'M', 'Ꮍ'), + (0xAB8E, 'M', 'Ꮎ'), + (0xAB8F, 'M', 'Ꮏ'), + (0xAB90, 'M', 'Ꮐ'), + (0xAB91, 'M', 'Ꮑ'), + (0xAB92, 'M', 'Ꮒ'), + (0xAB93, 'M', 'Ꮓ'), + (0xAB94, 'M', 'Ꮔ'), + (0xAB95, 'M', 'Ꮕ'), + (0xAB96, 'M', 'Ꮖ'), + (0xAB97, 'M', 'Ꮗ'), + (0xAB98, 'M', 'Ꮘ'), + (0xAB99, 'M', 'Ꮙ'), + (0xAB9A, 'M', 'Ꮚ'), + (0xAB9B, 'M', 'Ꮛ'), + (0xAB9C, 'M', 'Ꮜ'), + (0xAB9D, 'M', 'Ꮝ'), + (0xAB9E, 'M', 'Ꮞ'), + (0xAB9F, 'M', 'Ꮟ'), + (0xABA0, 'M', 'Ꮠ'), + (0xABA1, 'M', 'Ꮡ'), + (0xABA2, 'M', 'Ꮢ'), + (0xABA3, 'M', 'Ꮣ'), + (0xABA4, 'M', 'Ꮤ'), + (0xABA5, 'M', 'Ꮥ'), + (0xABA6, 'M', 'Ꮦ'), + (0xABA7, 'M', 'Ꮧ'), + (0xABA8, 'M', 'Ꮨ'), + (0xABA9, 'M', 'Ꮩ'), + (0xABAA, 'M', 'Ꮪ'), + ] + +def _seg_39() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xABAB, 'M', 'Ꮫ'), + (0xABAC, 'M', 'Ꮬ'), + (0xABAD, 'M', 'Ꮭ'), + (0xABAE, 'M', 'Ꮮ'), + (0xABAF, 'M', 'Ꮯ'), + (0xABB0, 'M', 'Ꮰ'), + (0xABB1, 'M', 'Ꮱ'), + (0xABB2, 'M', 'Ꮲ'), + (0xABB3, 'M', 'Ꮳ'), + (0xABB4, 'M', 'Ꮴ'), + (0xABB5, 'M', 'Ꮵ'), + (0xABB6, 'M', 'Ꮶ'), + (0xABB7, 'M', 'Ꮷ'), + (0xABB8, 'M', 'Ꮸ'), + (0xABB9, 'M', 'Ꮹ'), + (0xABBA, 'M', 'Ꮺ'), + (0xABBB, 'M', 'Ꮻ'), + (0xABBC, 'M', 'Ꮼ'), + (0xABBD, 'M', 'Ꮽ'), + (0xABBE, 'M', 'Ꮾ'), + (0xABBF, 'M', 'Ꮿ'), + (0xABC0, 'V'), + (0xABEE, 'X'), + (0xABF0, 'V'), + (0xABFA, 'X'), + (0xAC00, 'V'), + (0xD7A4, 'X'), + (0xD7B0, 'V'), + (0xD7C7, 'X'), + (0xD7CB, 'V'), + (0xD7FC, 'X'), + (0xF900, 'M', '豈'), + (0xF901, 'M', '更'), + (0xF902, 'M', '車'), + (0xF903, 'M', '賈'), + (0xF904, 'M', '滑'), + (0xF905, 'M', '串'), + (0xF906, 'M', '句'), + (0xF907, 'M', '龜'), + (0xF909, 'M', '契'), + (0xF90A, 'M', '金'), + (0xF90B, 'M', '喇'), + (0xF90C, 'M', '奈'), + (0xF90D, 'M', '懶'), + (0xF90E, 'M', '癩'), + (0xF90F, 'M', '羅'), + (0xF910, 'M', '蘿'), + (0xF911, 'M', '螺'), + (0xF912, 'M', '裸'), + (0xF913, 'M', '邏'), + (0xF914, 'M', '樂'), + (0xF915, 'M', '洛'), + (0xF916, 'M', '烙'), + (0xF917, 'M', '珞'), + (0xF918, 'M', '落'), + (0xF919, 'M', '酪'), + (0xF91A, 'M', '駱'), + (0xF91B, 'M', '亂'), + (0xF91C, 'M', '卵'), + (0xF91D, 'M', '欄'), + (0xF91E, 'M', '爛'), + (0xF91F, 'M', '蘭'), + (0xF920, 'M', '鸞'), + (0xF921, 'M', '嵐'), + (0xF922, 'M', '濫'), + (0xF923, 'M', '藍'), + (0xF924, 'M', '襤'), + (0xF925, 'M', '拉'), + (0xF926, 'M', '臘'), + (0xF927, 'M', '蠟'), + (0xF928, 'M', '廊'), + (0xF929, 'M', '朗'), + (0xF92A, 'M', '浪'), + (0xF92B, 'M', '狼'), + (0xF92C, 'M', '郎'), + (0xF92D, 'M', '來'), + (0xF92E, 'M', '冷'), + (0xF92F, 'M', '勞'), + (0xF930, 'M', '擄'), + (0xF931, 'M', '櫓'), + (0xF932, 'M', '爐'), + (0xF933, 'M', '盧'), + (0xF934, 'M', '老'), + (0xF935, 'M', '蘆'), + (0xF936, 'M', '虜'), + (0xF937, 'M', '路'), + (0xF938, 'M', '露'), + (0xF939, 'M', '魯'), + (0xF93A, 'M', '鷺'), + (0xF93B, 'M', '碌'), + (0xF93C, 'M', '祿'), + (0xF93D, 'M', '綠'), + (0xF93E, 'M', '菉'), + (0xF93F, 'M', '錄'), + (0xF940, 'M', '鹿'), + (0xF941, 'M', '論'), + (0xF942, 'M', '壟'), + (0xF943, 'M', '弄'), + (0xF944, 'M', '籠'), + (0xF945, 'M', '聾'), + ] + +def _seg_40() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xF946, 'M', '牢'), + (0xF947, 'M', '磊'), + (0xF948, 'M', '賂'), + (0xF949, 'M', '雷'), + (0xF94A, 'M', '壘'), + (0xF94B, 'M', '屢'), + (0xF94C, 'M', '樓'), + (0xF94D, 'M', '淚'), + (0xF94E, 'M', '漏'), + (0xF94F, 'M', '累'), + (0xF950, 'M', '縷'), + (0xF951, 'M', '陋'), + (0xF952, 'M', '勒'), + (0xF953, 'M', '肋'), + (0xF954, 'M', '凜'), + (0xF955, 'M', '凌'), + (0xF956, 'M', '稜'), + (0xF957, 'M', '綾'), + (0xF958, 'M', '菱'), + (0xF959, 'M', '陵'), + (0xF95A, 'M', '讀'), + (0xF95B, 'M', '拏'), + (0xF95C, 'M', '樂'), + (0xF95D, 'M', '諾'), + (0xF95E, 'M', '丹'), + (0xF95F, 'M', '寧'), + (0xF960, 'M', '怒'), + (0xF961, 'M', '率'), + (0xF962, 'M', '異'), + (0xF963, 'M', '北'), + (0xF964, 'M', '磻'), + (0xF965, 'M', '便'), + (0xF966, 'M', '復'), + (0xF967, 'M', '不'), + (0xF968, 'M', '泌'), + (0xF969, 'M', '數'), + (0xF96A, 'M', '索'), + (0xF96B, 'M', '參'), + (0xF96C, 'M', '塞'), + (0xF96D, 'M', '省'), + (0xF96E, 'M', '葉'), + (0xF96F, 'M', '說'), + (0xF970, 'M', '殺'), + (0xF971, 'M', '辰'), + (0xF972, 'M', '沈'), + (0xF973, 'M', '拾'), + (0xF974, 'M', '若'), + (0xF975, 'M', '掠'), + (0xF976, 'M', '略'), + (0xF977, 'M', '亮'), + (0xF978, 'M', '兩'), + (0xF979, 'M', '凉'), + (0xF97A, 'M', '梁'), + (0xF97B, 'M', '糧'), + (0xF97C, 'M', '良'), + (0xF97D, 'M', '諒'), + (0xF97E, 'M', '量'), + (0xF97F, 'M', '勵'), + (0xF980, 'M', '呂'), + (0xF981, 'M', '女'), + (0xF982, 'M', '廬'), + (0xF983, 'M', '旅'), + (0xF984, 'M', '濾'), + (0xF985, 'M', '礪'), + (0xF986, 'M', '閭'), + (0xF987, 'M', '驪'), + (0xF988, 'M', '麗'), + (0xF989, 'M', '黎'), + (0xF98A, 'M', '力'), + (0xF98B, 'M', '曆'), + (0xF98C, 'M', '歷'), + (0xF98D, 'M', '轢'), + (0xF98E, 'M', '年'), + (0xF98F, 'M', '憐'), + (0xF990, 'M', '戀'), + (0xF991, 'M', '撚'), + (0xF992, 'M', '漣'), + (0xF993, 'M', '煉'), + (0xF994, 'M', '璉'), + (0xF995, 'M', '秊'), + (0xF996, 'M', '練'), + (0xF997, 'M', '聯'), + (0xF998, 'M', '輦'), + (0xF999, 'M', '蓮'), + (0xF99A, 'M', '連'), + (0xF99B, 'M', '鍊'), + (0xF99C, 'M', '列'), + (0xF99D, 'M', '劣'), + (0xF99E, 'M', '咽'), + (0xF99F, 'M', '烈'), + (0xF9A0, 'M', '裂'), + (0xF9A1, 'M', '說'), + (0xF9A2, 'M', '廉'), + (0xF9A3, 'M', '念'), + (0xF9A4, 'M', '捻'), + (0xF9A5, 'M', '殮'), + (0xF9A6, 'M', '簾'), + (0xF9A7, 'M', '獵'), + (0xF9A8, 'M', '令'), + (0xF9A9, 'M', '囹'), + ] + +def _seg_41() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xF9AA, 'M', '寧'), + (0xF9AB, 'M', '嶺'), + (0xF9AC, 'M', '怜'), + (0xF9AD, 'M', '玲'), + (0xF9AE, 'M', '瑩'), + (0xF9AF, 'M', '羚'), + (0xF9B0, 'M', '聆'), + (0xF9B1, 'M', '鈴'), + (0xF9B2, 'M', '零'), + (0xF9B3, 'M', '靈'), + (0xF9B4, 'M', '領'), + (0xF9B5, 'M', '例'), + (0xF9B6, 'M', '禮'), + (0xF9B7, 'M', '醴'), + (0xF9B8, 'M', '隸'), + (0xF9B9, 'M', '惡'), + (0xF9BA, 'M', '了'), + (0xF9BB, 'M', '僚'), + (0xF9BC, 'M', '寮'), + (0xF9BD, 'M', '尿'), + (0xF9BE, 'M', '料'), + (0xF9BF, 'M', '樂'), + (0xF9C0, 'M', '燎'), + (0xF9C1, 'M', '療'), + (0xF9C2, 'M', '蓼'), + (0xF9C3, 'M', '遼'), + (0xF9C4, 'M', '龍'), + (0xF9C5, 'M', '暈'), + (0xF9C6, 'M', '阮'), + (0xF9C7, 'M', '劉'), + (0xF9C8, 'M', '杻'), + (0xF9C9, 'M', '柳'), + (0xF9CA, 'M', '流'), + (0xF9CB, 'M', '溜'), + (0xF9CC, 'M', '琉'), + (0xF9CD, 'M', '留'), + (0xF9CE, 'M', '硫'), + (0xF9CF, 'M', '紐'), + (0xF9D0, 'M', '類'), + (0xF9D1, 'M', '六'), + (0xF9D2, 'M', '戮'), + (0xF9D3, 'M', '陸'), + (0xF9D4, 'M', '倫'), + (0xF9D5, 'M', '崙'), + (0xF9D6, 'M', '淪'), + (0xF9D7, 'M', '輪'), + (0xF9D8, 'M', '律'), + (0xF9D9, 'M', '慄'), + (0xF9DA, 'M', '栗'), + (0xF9DB, 'M', '率'), + (0xF9DC, 'M', '隆'), + (0xF9DD, 'M', '利'), + (0xF9DE, 'M', '吏'), + (0xF9DF, 'M', '履'), + (0xF9E0, 'M', '易'), + (0xF9E1, 'M', '李'), + (0xF9E2, 'M', '梨'), + (0xF9E3, 'M', '泥'), + (0xF9E4, 'M', '理'), + (0xF9E5, 'M', '痢'), + (0xF9E6, 'M', '罹'), + (0xF9E7, 'M', '裏'), + (0xF9E8, 'M', '裡'), + (0xF9E9, 'M', '里'), + (0xF9EA, 'M', '離'), + (0xF9EB, 'M', '匿'), + (0xF9EC, 'M', '溺'), + (0xF9ED, 'M', '吝'), + (0xF9EE, 'M', '燐'), + (0xF9EF, 'M', '璘'), + (0xF9F0, 'M', '藺'), + (0xF9F1, 'M', '隣'), + (0xF9F2, 'M', '鱗'), + (0xF9F3, 'M', '麟'), + (0xF9F4, 'M', '林'), + (0xF9F5, 'M', '淋'), + (0xF9F6, 'M', '臨'), + (0xF9F7, 'M', '立'), + (0xF9F8, 'M', '笠'), + (0xF9F9, 'M', '粒'), + (0xF9FA, 'M', '狀'), + (0xF9FB, 'M', '炙'), + (0xF9FC, 'M', '識'), + (0xF9FD, 'M', '什'), + (0xF9FE, 'M', '茶'), + (0xF9FF, 'M', '刺'), + (0xFA00, 'M', '切'), + (0xFA01, 'M', '度'), + (0xFA02, 'M', '拓'), + (0xFA03, 'M', '糖'), + (0xFA04, 'M', '宅'), + (0xFA05, 'M', '洞'), + (0xFA06, 'M', '暴'), + (0xFA07, 'M', '輻'), + (0xFA08, 'M', '行'), + (0xFA09, 'M', '降'), + (0xFA0A, 'M', '見'), + (0xFA0B, 'M', '廓'), + (0xFA0C, 'M', '兀'), + (0xFA0D, 'M', '嗀'), + ] + +def _seg_42() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFA0E, 'V'), + (0xFA10, 'M', '塚'), + (0xFA11, 'V'), + (0xFA12, 'M', '晴'), + (0xFA13, 'V'), + (0xFA15, 'M', '凞'), + (0xFA16, 'M', '猪'), + (0xFA17, 'M', '益'), + (0xFA18, 'M', '礼'), + (0xFA19, 'M', '神'), + (0xFA1A, 'M', '祥'), + (0xFA1B, 'M', '福'), + (0xFA1C, 'M', '靖'), + (0xFA1D, 'M', '精'), + (0xFA1E, 'M', '羽'), + (0xFA1F, 'V'), + (0xFA20, 'M', '蘒'), + (0xFA21, 'V'), + (0xFA22, 'M', '諸'), + (0xFA23, 'V'), + (0xFA25, 'M', '逸'), + (0xFA26, 'M', '都'), + (0xFA27, 'V'), + (0xFA2A, 'M', '飯'), + (0xFA2B, 'M', '飼'), + (0xFA2C, 'M', '館'), + (0xFA2D, 'M', '鶴'), + (0xFA2E, 'M', '郞'), + (0xFA2F, 'M', '隷'), + (0xFA30, 'M', '侮'), + (0xFA31, 'M', '僧'), + (0xFA32, 'M', '免'), + (0xFA33, 'M', '勉'), + (0xFA34, 'M', '勤'), + (0xFA35, 'M', '卑'), + (0xFA36, 'M', '喝'), + (0xFA37, 'M', '嘆'), + (0xFA38, 'M', '器'), + (0xFA39, 'M', '塀'), + (0xFA3A, 'M', '墨'), + (0xFA3B, 'M', '層'), + (0xFA3C, 'M', '屮'), + (0xFA3D, 'M', '悔'), + (0xFA3E, 'M', '慨'), + (0xFA3F, 'M', '憎'), + (0xFA40, 'M', '懲'), + (0xFA41, 'M', '敏'), + (0xFA42, 'M', '既'), + (0xFA43, 'M', '暑'), + (0xFA44, 'M', '梅'), + (0xFA45, 'M', '海'), + (0xFA46, 'M', '渚'), + (0xFA47, 'M', '漢'), + (0xFA48, 'M', '煮'), + (0xFA49, 'M', '爫'), + (0xFA4A, 'M', '琢'), + (0xFA4B, 'M', '碑'), + (0xFA4C, 'M', '社'), + (0xFA4D, 'M', '祉'), + (0xFA4E, 'M', '祈'), + (0xFA4F, 'M', '祐'), + (0xFA50, 'M', '祖'), + (0xFA51, 'M', '祝'), + (0xFA52, 'M', '禍'), + (0xFA53, 'M', '禎'), + (0xFA54, 'M', '穀'), + (0xFA55, 'M', '突'), + (0xFA56, 'M', '節'), + (0xFA57, 'M', '練'), + (0xFA58, 'M', '縉'), + (0xFA59, 'M', '繁'), + (0xFA5A, 'M', '署'), + (0xFA5B, 'M', '者'), + (0xFA5C, 'M', '臭'), + (0xFA5D, 'M', '艹'), + (0xFA5F, 'M', '著'), + (0xFA60, 'M', '褐'), + (0xFA61, 'M', '視'), + (0xFA62, 'M', '謁'), + (0xFA63, 'M', '謹'), + (0xFA64, 'M', '賓'), + (0xFA65, 'M', '贈'), + (0xFA66, 'M', '辶'), + (0xFA67, 'M', '逸'), + (0xFA68, 'M', '難'), + (0xFA69, 'M', '響'), + (0xFA6A, 'M', '頻'), + (0xFA6B, 'M', '恵'), + (0xFA6C, 'M', '𤋮'), + (0xFA6D, 'M', '舘'), + (0xFA6E, 'X'), + (0xFA70, 'M', '並'), + (0xFA71, 'M', '况'), + (0xFA72, 'M', '全'), + (0xFA73, 'M', '侀'), + (0xFA74, 'M', '充'), + (0xFA75, 'M', '冀'), + (0xFA76, 'M', '勇'), + (0xFA77, 'M', '勺'), + (0xFA78, 'M', '喝'), + ] + +def _seg_43() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFA79, 'M', '啕'), + (0xFA7A, 'M', '喙'), + (0xFA7B, 'M', '嗢'), + (0xFA7C, 'M', '塚'), + (0xFA7D, 'M', '墳'), + (0xFA7E, 'M', '奄'), + (0xFA7F, 'M', '奔'), + (0xFA80, 'M', '婢'), + (0xFA81, 'M', '嬨'), + (0xFA82, 'M', '廒'), + (0xFA83, 'M', '廙'), + (0xFA84, 'M', '彩'), + (0xFA85, 'M', '徭'), + (0xFA86, 'M', '惘'), + (0xFA87, 'M', '慎'), + (0xFA88, 'M', '愈'), + (0xFA89, 'M', '憎'), + (0xFA8A, 'M', '慠'), + (0xFA8B, 'M', '懲'), + (0xFA8C, 'M', '戴'), + (0xFA8D, 'M', '揄'), + (0xFA8E, 'M', '搜'), + (0xFA8F, 'M', '摒'), + (0xFA90, 'M', '敖'), + (0xFA91, 'M', '晴'), + (0xFA92, 'M', '朗'), + (0xFA93, 'M', '望'), + (0xFA94, 'M', '杖'), + (0xFA95, 'M', '歹'), + (0xFA96, 'M', '殺'), + (0xFA97, 'M', '流'), + (0xFA98, 'M', '滛'), + (0xFA99, 'M', '滋'), + (0xFA9A, 'M', '漢'), + (0xFA9B, 'M', '瀞'), + (0xFA9C, 'M', '煮'), + (0xFA9D, 'M', '瞧'), + (0xFA9E, 'M', '爵'), + (0xFA9F, 'M', '犯'), + (0xFAA0, 'M', '猪'), + (0xFAA1, 'M', '瑱'), + (0xFAA2, 'M', '甆'), + (0xFAA3, 'M', '画'), + (0xFAA4, 'M', '瘝'), + (0xFAA5, 'M', '瘟'), + (0xFAA6, 'M', '益'), + (0xFAA7, 'M', '盛'), + (0xFAA8, 'M', '直'), + (0xFAA9, 'M', '睊'), + (0xFAAA, 'M', '着'), + (0xFAAB, 'M', '磌'), + (0xFAAC, 'M', '窱'), + (0xFAAD, 'M', '節'), + (0xFAAE, 'M', '类'), + (0xFAAF, 'M', '絛'), + (0xFAB0, 'M', '練'), + (0xFAB1, 'M', '缾'), + (0xFAB2, 'M', '者'), + (0xFAB3, 'M', '荒'), + (0xFAB4, 'M', '華'), + (0xFAB5, 'M', '蝹'), + (0xFAB6, 'M', '襁'), + (0xFAB7, 'M', '覆'), + (0xFAB8, 'M', '視'), + (0xFAB9, 'M', '調'), + (0xFABA, 'M', '諸'), + (0xFABB, 'M', '請'), + (0xFABC, 'M', '謁'), + (0xFABD, 'M', '諾'), + (0xFABE, 'M', '諭'), + (0xFABF, 'M', '謹'), + (0xFAC0, 'M', '變'), + (0xFAC1, 'M', '贈'), + (0xFAC2, 'M', '輸'), + (0xFAC3, 'M', '遲'), + (0xFAC4, 'M', '醙'), + (0xFAC5, 'M', '鉶'), + (0xFAC6, 'M', '陼'), + (0xFAC7, 'M', '難'), + (0xFAC8, 'M', '靖'), + (0xFAC9, 'M', '韛'), + (0xFACA, 'M', '響'), + (0xFACB, 'M', '頋'), + (0xFACC, 'M', '頻'), + (0xFACD, 'M', '鬒'), + (0xFACE, 'M', '龜'), + (0xFACF, 'M', '𢡊'), + (0xFAD0, 'M', '𢡄'), + (0xFAD1, 'M', '𣏕'), + (0xFAD2, 'M', '㮝'), + (0xFAD3, 'M', '䀘'), + (0xFAD4, 'M', '䀹'), + (0xFAD5, 'M', '𥉉'), + (0xFAD6, 'M', '𥳐'), + (0xFAD7, 'M', '𧻓'), + (0xFAD8, 'M', '齃'), + (0xFAD9, 'M', '龎'), + (0xFADA, 'X'), + (0xFB00, 'M', 'ff'), + (0xFB01, 'M', 'fi'), + ] + +def _seg_44() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFB02, 'M', 'fl'), + (0xFB03, 'M', 'ffi'), + (0xFB04, 'M', 'ffl'), + (0xFB05, 'M', 'st'), + (0xFB07, 'X'), + (0xFB13, 'M', 'մն'), + (0xFB14, 'M', 'մե'), + (0xFB15, 'M', 'մի'), + (0xFB16, 'M', 'վն'), + (0xFB17, 'M', 'մխ'), + (0xFB18, 'X'), + (0xFB1D, 'M', 'יִ'), + (0xFB1E, 'V'), + (0xFB1F, 'M', 'ײַ'), + (0xFB20, 'M', 'ע'), + (0xFB21, 'M', 'א'), + (0xFB22, 'M', 'ד'), + (0xFB23, 'M', 'ה'), + (0xFB24, 'M', 'כ'), + (0xFB25, 'M', 'ל'), + (0xFB26, 'M', 'ם'), + (0xFB27, 'M', 'ר'), + (0xFB28, 'M', 'ת'), + (0xFB29, '3', '+'), + (0xFB2A, 'M', 'שׁ'), + (0xFB2B, 'M', 'שׂ'), + (0xFB2C, 'M', 'שּׁ'), + (0xFB2D, 'M', 'שּׂ'), + (0xFB2E, 'M', 'אַ'), + (0xFB2F, 'M', 'אָ'), + (0xFB30, 'M', 'אּ'), + (0xFB31, 'M', 'בּ'), + (0xFB32, 'M', 'גּ'), + (0xFB33, 'M', 'דּ'), + (0xFB34, 'M', 'הּ'), + (0xFB35, 'M', 'וּ'), + (0xFB36, 'M', 'זּ'), + (0xFB37, 'X'), + (0xFB38, 'M', 'טּ'), + (0xFB39, 'M', 'יּ'), + (0xFB3A, 'M', 'ךּ'), + (0xFB3B, 'M', 'כּ'), + (0xFB3C, 'M', 'לּ'), + (0xFB3D, 'X'), + (0xFB3E, 'M', 'מּ'), + (0xFB3F, 'X'), + (0xFB40, 'M', 'נּ'), + (0xFB41, 'M', 'סּ'), + (0xFB42, 'X'), + (0xFB43, 'M', 'ףּ'), + (0xFB44, 'M', 'פּ'), + (0xFB45, 'X'), + (0xFB46, 'M', 'צּ'), + (0xFB47, 'M', 'קּ'), + (0xFB48, 'M', 'רּ'), + (0xFB49, 'M', 'שּ'), + (0xFB4A, 'M', 'תּ'), + (0xFB4B, 'M', 'וֹ'), + (0xFB4C, 'M', 'בֿ'), + (0xFB4D, 'M', 'כֿ'), + (0xFB4E, 'M', 'פֿ'), + (0xFB4F, 'M', 'אל'), + (0xFB50, 'M', 'ٱ'), + (0xFB52, 'M', 'ٻ'), + (0xFB56, 'M', 'پ'), + (0xFB5A, 'M', 'ڀ'), + (0xFB5E, 'M', 'ٺ'), + (0xFB62, 'M', 'ٿ'), + (0xFB66, 'M', 'ٹ'), + (0xFB6A, 'M', 'ڤ'), + (0xFB6E, 'M', 'ڦ'), + (0xFB72, 'M', 'ڄ'), + (0xFB76, 'M', 'ڃ'), + (0xFB7A, 'M', 'چ'), + (0xFB7E, 'M', 'ڇ'), + (0xFB82, 'M', 'ڍ'), + (0xFB84, 'M', 'ڌ'), + (0xFB86, 'M', 'ڎ'), + (0xFB88, 'M', 'ڈ'), + (0xFB8A, 'M', 'ژ'), + (0xFB8C, 'M', 'ڑ'), + (0xFB8E, 'M', 'ک'), + (0xFB92, 'M', 'گ'), + (0xFB96, 'M', 'ڳ'), + (0xFB9A, 'M', 'ڱ'), + (0xFB9E, 'M', 'ں'), + (0xFBA0, 'M', 'ڻ'), + (0xFBA4, 'M', 'ۀ'), + (0xFBA6, 'M', 'ہ'), + (0xFBAA, 'M', 'ھ'), + (0xFBAE, 'M', 'ے'), + (0xFBB0, 'M', 'ۓ'), + (0xFBB2, 'V'), + (0xFBC3, 'X'), + (0xFBD3, 'M', 'ڭ'), + (0xFBD7, 'M', 'ۇ'), + (0xFBD9, 'M', 'ۆ'), + (0xFBDB, 'M', 'ۈ'), + (0xFBDD, 'M', 'ۇٴ'), + (0xFBDE, 'M', 'ۋ'), + ] + +def _seg_45() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFBE0, 'M', 'ۅ'), + (0xFBE2, 'M', 'ۉ'), + (0xFBE4, 'M', 'ې'), + (0xFBE8, 'M', 'ى'), + (0xFBEA, 'M', 'ئا'), + (0xFBEC, 'M', 'ئە'), + (0xFBEE, 'M', 'ئو'), + (0xFBF0, 'M', 'ئۇ'), + (0xFBF2, 'M', 'ئۆ'), + (0xFBF4, 'M', 'ئۈ'), + (0xFBF6, 'M', 'ئې'), + (0xFBF9, 'M', 'ئى'), + (0xFBFC, 'M', 'ی'), + (0xFC00, 'M', 'ئج'), + (0xFC01, 'M', 'ئح'), + (0xFC02, 'M', 'ئم'), + (0xFC03, 'M', 'ئى'), + (0xFC04, 'M', 'ئي'), + (0xFC05, 'M', 'بج'), + (0xFC06, 'M', 'بح'), + (0xFC07, 'M', 'بخ'), + (0xFC08, 'M', 'بم'), + (0xFC09, 'M', 'بى'), + (0xFC0A, 'M', 'بي'), + (0xFC0B, 'M', 'تج'), + (0xFC0C, 'M', 'تح'), + (0xFC0D, 'M', 'تخ'), + (0xFC0E, 'M', 'تم'), + (0xFC0F, 'M', 'تى'), + (0xFC10, 'M', 'تي'), + (0xFC11, 'M', 'ثج'), + (0xFC12, 'M', 'ثم'), + (0xFC13, 'M', 'ثى'), + (0xFC14, 'M', 'ثي'), + (0xFC15, 'M', 'جح'), + (0xFC16, 'M', 'جم'), + (0xFC17, 'M', 'حج'), + (0xFC18, 'M', 'حم'), + (0xFC19, 'M', 'خج'), + (0xFC1A, 'M', 'خح'), + (0xFC1B, 'M', 'خم'), + (0xFC1C, 'M', 'سج'), + (0xFC1D, 'M', 'سح'), + (0xFC1E, 'M', 'سخ'), + (0xFC1F, 'M', 'سم'), + (0xFC20, 'M', 'صح'), + (0xFC21, 'M', 'صم'), + (0xFC22, 'M', 'ضج'), + (0xFC23, 'M', 'ضح'), + (0xFC24, 'M', 'ضخ'), + (0xFC25, 'M', 'ضم'), + (0xFC26, 'M', 'طح'), + (0xFC27, 'M', 'طم'), + (0xFC28, 'M', 'ظم'), + (0xFC29, 'M', 'عج'), + (0xFC2A, 'M', 'عم'), + (0xFC2B, 'M', 'غج'), + (0xFC2C, 'M', 'غم'), + (0xFC2D, 'M', 'فج'), + (0xFC2E, 'M', 'فح'), + (0xFC2F, 'M', 'فخ'), + (0xFC30, 'M', 'فم'), + (0xFC31, 'M', 'فى'), + (0xFC32, 'M', 'في'), + (0xFC33, 'M', 'قح'), + (0xFC34, 'M', 'قم'), + (0xFC35, 'M', 'قى'), + (0xFC36, 'M', 'قي'), + (0xFC37, 'M', 'كا'), + (0xFC38, 'M', 'كج'), + (0xFC39, 'M', 'كح'), + (0xFC3A, 'M', 'كخ'), + (0xFC3B, 'M', 'كل'), + (0xFC3C, 'M', 'كم'), + (0xFC3D, 'M', 'كى'), + (0xFC3E, 'M', 'كي'), + (0xFC3F, 'M', 'لج'), + (0xFC40, 'M', 'لح'), + (0xFC41, 'M', 'لخ'), + (0xFC42, 'M', 'لم'), + (0xFC43, 'M', 'لى'), + (0xFC44, 'M', 'لي'), + (0xFC45, 'M', 'مج'), + (0xFC46, 'M', 'مح'), + (0xFC47, 'M', 'مخ'), + (0xFC48, 'M', 'مم'), + (0xFC49, 'M', 'مى'), + (0xFC4A, 'M', 'مي'), + (0xFC4B, 'M', 'نج'), + (0xFC4C, 'M', 'نح'), + (0xFC4D, 'M', 'نخ'), + (0xFC4E, 'M', 'نم'), + (0xFC4F, 'M', 'نى'), + (0xFC50, 'M', 'ني'), + (0xFC51, 'M', 'هج'), + (0xFC52, 'M', 'هم'), + (0xFC53, 'M', 'هى'), + (0xFC54, 'M', 'هي'), + (0xFC55, 'M', 'يج'), + (0xFC56, 'M', 'يح'), + ] + +def _seg_46() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFC57, 'M', 'يخ'), + (0xFC58, 'M', 'يم'), + (0xFC59, 'M', 'يى'), + (0xFC5A, 'M', 'يي'), + (0xFC5B, 'M', 'ذٰ'), + (0xFC5C, 'M', 'رٰ'), + (0xFC5D, 'M', 'ىٰ'), + (0xFC5E, '3', ' ٌّ'), + (0xFC5F, '3', ' ٍّ'), + (0xFC60, '3', ' َّ'), + (0xFC61, '3', ' ُّ'), + (0xFC62, '3', ' ِّ'), + (0xFC63, '3', ' ّٰ'), + (0xFC64, 'M', 'ئر'), + (0xFC65, 'M', 'ئز'), + (0xFC66, 'M', 'ئم'), + (0xFC67, 'M', 'ئن'), + (0xFC68, 'M', 'ئى'), + (0xFC69, 'M', 'ئي'), + (0xFC6A, 'M', 'بر'), + (0xFC6B, 'M', 'بز'), + (0xFC6C, 'M', 'بم'), + (0xFC6D, 'M', 'بن'), + (0xFC6E, 'M', 'بى'), + (0xFC6F, 'M', 'بي'), + (0xFC70, 'M', 'تر'), + (0xFC71, 'M', 'تز'), + (0xFC72, 'M', 'تم'), + (0xFC73, 'M', 'تن'), + (0xFC74, 'M', 'تى'), + (0xFC75, 'M', 'تي'), + (0xFC76, 'M', 'ثر'), + (0xFC77, 'M', 'ثز'), + (0xFC78, 'M', 'ثم'), + (0xFC79, 'M', 'ثن'), + (0xFC7A, 'M', 'ثى'), + (0xFC7B, 'M', 'ثي'), + (0xFC7C, 'M', 'فى'), + (0xFC7D, 'M', 'في'), + (0xFC7E, 'M', 'قى'), + (0xFC7F, 'M', 'قي'), + (0xFC80, 'M', 'كا'), + (0xFC81, 'M', 'كل'), + (0xFC82, 'M', 'كم'), + (0xFC83, 'M', 'كى'), + (0xFC84, 'M', 'كي'), + (0xFC85, 'M', 'لم'), + (0xFC86, 'M', 'لى'), + (0xFC87, 'M', 'لي'), + (0xFC88, 'M', 'ما'), + (0xFC89, 'M', 'مم'), + (0xFC8A, 'M', 'نر'), + (0xFC8B, 'M', 'نز'), + (0xFC8C, 'M', 'نم'), + (0xFC8D, 'M', 'نن'), + (0xFC8E, 'M', 'نى'), + (0xFC8F, 'M', 'ني'), + (0xFC90, 'M', 'ىٰ'), + (0xFC91, 'M', 'ير'), + (0xFC92, 'M', 'يز'), + (0xFC93, 'M', 'يم'), + (0xFC94, 'M', 'ين'), + (0xFC95, 'M', 'يى'), + (0xFC96, 'M', 'يي'), + (0xFC97, 'M', 'ئج'), + (0xFC98, 'M', 'ئح'), + (0xFC99, 'M', 'ئخ'), + (0xFC9A, 'M', 'ئم'), + (0xFC9B, 'M', 'ئه'), + (0xFC9C, 'M', 'بج'), + (0xFC9D, 'M', 'بح'), + (0xFC9E, 'M', 'بخ'), + (0xFC9F, 'M', 'بم'), + (0xFCA0, 'M', 'به'), + (0xFCA1, 'M', 'تج'), + (0xFCA2, 'M', 'تح'), + (0xFCA3, 'M', 'تخ'), + (0xFCA4, 'M', 'تم'), + (0xFCA5, 'M', 'ته'), + (0xFCA6, 'M', 'ثم'), + (0xFCA7, 'M', 'جح'), + (0xFCA8, 'M', 'جم'), + (0xFCA9, 'M', 'حج'), + (0xFCAA, 'M', 'حم'), + (0xFCAB, 'M', 'خج'), + (0xFCAC, 'M', 'خم'), + (0xFCAD, 'M', 'سج'), + (0xFCAE, 'M', 'سح'), + (0xFCAF, 'M', 'سخ'), + (0xFCB0, 'M', 'سم'), + (0xFCB1, 'M', 'صح'), + (0xFCB2, 'M', 'صخ'), + (0xFCB3, 'M', 'صم'), + (0xFCB4, 'M', 'ضج'), + (0xFCB5, 'M', 'ضح'), + (0xFCB6, 'M', 'ضخ'), + (0xFCB7, 'M', 'ضم'), + (0xFCB8, 'M', 'طح'), + (0xFCB9, 'M', 'ظم'), + (0xFCBA, 'M', 'عج'), + ] + +def _seg_47() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFCBB, 'M', 'عم'), + (0xFCBC, 'M', 'غج'), + (0xFCBD, 'M', 'غم'), + (0xFCBE, 'M', 'فج'), + (0xFCBF, 'M', 'فح'), + (0xFCC0, 'M', 'فخ'), + (0xFCC1, 'M', 'فم'), + (0xFCC2, 'M', 'قح'), + (0xFCC3, 'M', 'قم'), + (0xFCC4, 'M', 'كج'), + (0xFCC5, 'M', 'كح'), + (0xFCC6, 'M', 'كخ'), + (0xFCC7, 'M', 'كل'), + (0xFCC8, 'M', 'كم'), + (0xFCC9, 'M', 'لج'), + (0xFCCA, 'M', 'لح'), + (0xFCCB, 'M', 'لخ'), + (0xFCCC, 'M', 'لم'), + (0xFCCD, 'M', 'له'), + (0xFCCE, 'M', 'مج'), + (0xFCCF, 'M', 'مح'), + (0xFCD0, 'M', 'مخ'), + (0xFCD1, 'M', 'مم'), + (0xFCD2, 'M', 'نج'), + (0xFCD3, 'M', 'نح'), + (0xFCD4, 'M', 'نخ'), + (0xFCD5, 'M', 'نم'), + (0xFCD6, 'M', 'نه'), + (0xFCD7, 'M', 'هج'), + (0xFCD8, 'M', 'هم'), + (0xFCD9, 'M', 'هٰ'), + (0xFCDA, 'M', 'يج'), + (0xFCDB, 'M', 'يح'), + (0xFCDC, 'M', 'يخ'), + (0xFCDD, 'M', 'يم'), + (0xFCDE, 'M', 'يه'), + (0xFCDF, 'M', 'ئم'), + (0xFCE0, 'M', 'ئه'), + (0xFCE1, 'M', 'بم'), + (0xFCE2, 'M', 'به'), + (0xFCE3, 'M', 'تم'), + (0xFCE4, 'M', 'ته'), + (0xFCE5, 'M', 'ثم'), + (0xFCE6, 'M', 'ثه'), + (0xFCE7, 'M', 'سم'), + (0xFCE8, 'M', 'سه'), + (0xFCE9, 'M', 'شم'), + (0xFCEA, 'M', 'شه'), + (0xFCEB, 'M', 'كل'), + (0xFCEC, 'M', 'كم'), + (0xFCED, 'M', 'لم'), + (0xFCEE, 'M', 'نم'), + (0xFCEF, 'M', 'نه'), + (0xFCF0, 'M', 'يم'), + (0xFCF1, 'M', 'يه'), + (0xFCF2, 'M', 'ـَّ'), + (0xFCF3, 'M', 'ـُّ'), + (0xFCF4, 'M', 'ـِّ'), + (0xFCF5, 'M', 'طى'), + (0xFCF6, 'M', 'طي'), + (0xFCF7, 'M', 'عى'), + (0xFCF8, 'M', 'عي'), + (0xFCF9, 'M', 'غى'), + (0xFCFA, 'M', 'غي'), + (0xFCFB, 'M', 'سى'), + (0xFCFC, 'M', 'سي'), + (0xFCFD, 'M', 'شى'), + (0xFCFE, 'M', 'شي'), + (0xFCFF, 'M', 'حى'), + (0xFD00, 'M', 'حي'), + (0xFD01, 'M', 'جى'), + (0xFD02, 'M', 'جي'), + (0xFD03, 'M', 'خى'), + (0xFD04, 'M', 'خي'), + (0xFD05, 'M', 'صى'), + (0xFD06, 'M', 'صي'), + (0xFD07, 'M', 'ضى'), + (0xFD08, 'M', 'ضي'), + (0xFD09, 'M', 'شج'), + (0xFD0A, 'M', 'شح'), + (0xFD0B, 'M', 'شخ'), + (0xFD0C, 'M', 'شم'), + (0xFD0D, 'M', 'شر'), + (0xFD0E, 'M', 'سر'), + (0xFD0F, 'M', 'صر'), + (0xFD10, 'M', 'ضر'), + (0xFD11, 'M', 'طى'), + (0xFD12, 'M', 'طي'), + (0xFD13, 'M', 'عى'), + (0xFD14, 'M', 'عي'), + (0xFD15, 'M', 'غى'), + (0xFD16, 'M', 'غي'), + (0xFD17, 'M', 'سى'), + (0xFD18, 'M', 'سي'), + (0xFD19, 'M', 'شى'), + (0xFD1A, 'M', 'شي'), + (0xFD1B, 'M', 'حى'), + (0xFD1C, 'M', 'حي'), + (0xFD1D, 'M', 'جى'), + (0xFD1E, 'M', 'جي'), + ] + +def _seg_48() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFD1F, 'M', 'خى'), + (0xFD20, 'M', 'خي'), + (0xFD21, 'M', 'صى'), + (0xFD22, 'M', 'صي'), + (0xFD23, 'M', 'ضى'), + (0xFD24, 'M', 'ضي'), + (0xFD25, 'M', 'شج'), + (0xFD26, 'M', 'شح'), + (0xFD27, 'M', 'شخ'), + (0xFD28, 'M', 'شم'), + (0xFD29, 'M', 'شر'), + (0xFD2A, 'M', 'سر'), + (0xFD2B, 'M', 'صر'), + (0xFD2C, 'M', 'ضر'), + (0xFD2D, 'M', 'شج'), + (0xFD2E, 'M', 'شح'), + (0xFD2F, 'M', 'شخ'), + (0xFD30, 'M', 'شم'), + (0xFD31, 'M', 'سه'), + (0xFD32, 'M', 'شه'), + (0xFD33, 'M', 'طم'), + (0xFD34, 'M', 'سج'), + (0xFD35, 'M', 'سح'), + (0xFD36, 'M', 'سخ'), + (0xFD37, 'M', 'شج'), + (0xFD38, 'M', 'شح'), + (0xFD39, 'M', 'شخ'), + (0xFD3A, 'M', 'طم'), + (0xFD3B, 'M', 'ظم'), + (0xFD3C, 'M', 'اً'), + (0xFD3E, 'V'), + (0xFD50, 'M', 'تجم'), + (0xFD51, 'M', 'تحج'), + (0xFD53, 'M', 'تحم'), + (0xFD54, 'M', 'تخم'), + (0xFD55, 'M', 'تمج'), + (0xFD56, 'M', 'تمح'), + (0xFD57, 'M', 'تمخ'), + (0xFD58, 'M', 'جمح'), + (0xFD5A, 'M', 'حمي'), + (0xFD5B, 'M', 'حمى'), + (0xFD5C, 'M', 'سحج'), + (0xFD5D, 'M', 'سجح'), + (0xFD5E, 'M', 'سجى'), + (0xFD5F, 'M', 'سمح'), + (0xFD61, 'M', 'سمج'), + (0xFD62, 'M', 'سمم'), + (0xFD64, 'M', 'صحح'), + (0xFD66, 'M', 'صمم'), + (0xFD67, 'M', 'شحم'), + (0xFD69, 'M', 'شجي'), + (0xFD6A, 'M', 'شمخ'), + (0xFD6C, 'M', 'شمم'), + (0xFD6E, 'M', 'ضحى'), + (0xFD6F, 'M', 'ضخم'), + (0xFD71, 'M', 'طمح'), + (0xFD73, 'M', 'طمم'), + (0xFD74, 'M', 'طمي'), + (0xFD75, 'M', 'عجم'), + (0xFD76, 'M', 'عمم'), + (0xFD78, 'M', 'عمى'), + (0xFD79, 'M', 'غمم'), + (0xFD7A, 'M', 'غمي'), + (0xFD7B, 'M', 'غمى'), + (0xFD7C, 'M', 'فخم'), + (0xFD7E, 'M', 'قمح'), + (0xFD7F, 'M', 'قمم'), + (0xFD80, 'M', 'لحم'), + (0xFD81, 'M', 'لحي'), + (0xFD82, 'M', 'لحى'), + (0xFD83, 'M', 'لجج'), + (0xFD85, 'M', 'لخم'), + (0xFD87, 'M', 'لمح'), + (0xFD89, 'M', 'محج'), + (0xFD8A, 'M', 'محم'), + (0xFD8B, 'M', 'محي'), + (0xFD8C, 'M', 'مجح'), + (0xFD8D, 'M', 'مجم'), + (0xFD8E, 'M', 'مخج'), + (0xFD8F, 'M', 'مخم'), + (0xFD90, 'X'), + (0xFD92, 'M', 'مجخ'), + (0xFD93, 'M', 'همج'), + (0xFD94, 'M', 'همم'), + (0xFD95, 'M', 'نحم'), + (0xFD96, 'M', 'نحى'), + (0xFD97, 'M', 'نجم'), + (0xFD99, 'M', 'نجى'), + (0xFD9A, 'M', 'نمي'), + (0xFD9B, 'M', 'نمى'), + (0xFD9C, 'M', 'يمم'), + (0xFD9E, 'M', 'بخي'), + (0xFD9F, 'M', 'تجي'), + (0xFDA0, 'M', 'تجى'), + (0xFDA1, 'M', 'تخي'), + (0xFDA2, 'M', 'تخى'), + (0xFDA3, 'M', 'تمي'), + (0xFDA4, 'M', 'تمى'), + (0xFDA5, 'M', 'جمي'), + (0xFDA6, 'M', 'جحى'), + ] + +def _seg_49() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFDA7, 'M', 'جمى'), + (0xFDA8, 'M', 'سخى'), + (0xFDA9, 'M', 'صحي'), + (0xFDAA, 'M', 'شحي'), + (0xFDAB, 'M', 'ضحي'), + (0xFDAC, 'M', 'لجي'), + (0xFDAD, 'M', 'لمي'), + (0xFDAE, 'M', 'يحي'), + (0xFDAF, 'M', 'يجي'), + (0xFDB0, 'M', 'يمي'), + (0xFDB1, 'M', 'ممي'), + (0xFDB2, 'M', 'قمي'), + (0xFDB3, 'M', 'نحي'), + (0xFDB4, 'M', 'قمح'), + (0xFDB5, 'M', 'لحم'), + (0xFDB6, 'M', 'عمي'), + (0xFDB7, 'M', 'كمي'), + (0xFDB8, 'M', 'نجح'), + (0xFDB9, 'M', 'مخي'), + (0xFDBA, 'M', 'لجم'), + (0xFDBB, 'M', 'كمم'), + (0xFDBC, 'M', 'لجم'), + (0xFDBD, 'M', 'نجح'), + (0xFDBE, 'M', 'جحي'), + (0xFDBF, 'M', 'حجي'), + (0xFDC0, 'M', 'مجي'), + (0xFDC1, 'M', 'فمي'), + (0xFDC2, 'M', 'بحي'), + (0xFDC3, 'M', 'كمم'), + (0xFDC4, 'M', 'عجم'), + (0xFDC5, 'M', 'صمم'), + (0xFDC6, 'M', 'سخي'), + (0xFDC7, 'M', 'نجي'), + (0xFDC8, 'X'), + (0xFDCF, 'V'), + (0xFDD0, 'X'), + (0xFDF0, 'M', 'صلے'), + (0xFDF1, 'M', 'قلے'), + (0xFDF2, 'M', 'الله'), + (0xFDF3, 'M', 'اكبر'), + (0xFDF4, 'M', 'محمد'), + (0xFDF5, 'M', 'صلعم'), + (0xFDF6, 'M', 'رسول'), + (0xFDF7, 'M', 'عليه'), + (0xFDF8, 'M', 'وسلم'), + (0xFDF9, 'M', 'صلى'), + (0xFDFA, '3', 'صلى الله عليه وسلم'), + (0xFDFB, '3', 'جل جلاله'), + (0xFDFC, 'M', 'ریال'), + (0xFDFD, 'V'), + (0xFE00, 'I'), + (0xFE10, '3', ','), + (0xFE11, 'M', '、'), + (0xFE12, 'X'), + (0xFE13, '3', ':'), + (0xFE14, '3', ';'), + (0xFE15, '3', '!'), + (0xFE16, '3', '?'), + (0xFE17, 'M', '〖'), + (0xFE18, 'M', '〗'), + (0xFE19, 'X'), + (0xFE20, 'V'), + (0xFE30, 'X'), + (0xFE31, 'M', '—'), + (0xFE32, 'M', '–'), + (0xFE33, '3', '_'), + (0xFE35, '3', '('), + (0xFE36, '3', ')'), + (0xFE37, '3', '{'), + (0xFE38, '3', '}'), + (0xFE39, 'M', '〔'), + (0xFE3A, 'M', '〕'), + (0xFE3B, 'M', '【'), + (0xFE3C, 'M', '】'), + (0xFE3D, 'M', '《'), + (0xFE3E, 'M', '》'), + (0xFE3F, 'M', '〈'), + (0xFE40, 'M', '〉'), + (0xFE41, 'M', '「'), + (0xFE42, 'M', '」'), + (0xFE43, 'M', '『'), + (0xFE44, 'M', '』'), + (0xFE45, 'V'), + (0xFE47, '3', '['), + (0xFE48, '3', ']'), + (0xFE49, '3', ' ̅'), + (0xFE4D, '3', '_'), + (0xFE50, '3', ','), + (0xFE51, 'M', '、'), + (0xFE52, 'X'), + (0xFE54, '3', ';'), + (0xFE55, '3', ':'), + (0xFE56, '3', '?'), + (0xFE57, '3', '!'), + (0xFE58, 'M', '—'), + (0xFE59, '3', '('), + (0xFE5A, '3', ')'), + (0xFE5B, '3', '{'), + (0xFE5C, '3', '}'), + (0xFE5D, 'M', '〔'), + ] + +def _seg_50() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFE5E, 'M', '〕'), + (0xFE5F, '3', '#'), + (0xFE60, '3', '&'), + (0xFE61, '3', '*'), + (0xFE62, '3', '+'), + (0xFE63, 'M', '-'), + (0xFE64, '3', '<'), + (0xFE65, '3', '>'), + (0xFE66, '3', '='), + (0xFE67, 'X'), + (0xFE68, '3', '\\'), + (0xFE69, '3', '$'), + (0xFE6A, '3', '%'), + (0xFE6B, '3', '@'), + (0xFE6C, 'X'), + (0xFE70, '3', ' ً'), + (0xFE71, 'M', 'ـً'), + (0xFE72, '3', ' ٌ'), + (0xFE73, 'V'), + (0xFE74, '3', ' ٍ'), + (0xFE75, 'X'), + (0xFE76, '3', ' َ'), + (0xFE77, 'M', 'ـَ'), + (0xFE78, '3', ' ُ'), + (0xFE79, 'M', 'ـُ'), + (0xFE7A, '3', ' ِ'), + (0xFE7B, 'M', 'ـِ'), + (0xFE7C, '3', ' ّ'), + (0xFE7D, 'M', 'ـّ'), + (0xFE7E, '3', ' ْ'), + (0xFE7F, 'M', 'ـْ'), + (0xFE80, 'M', 'ء'), + (0xFE81, 'M', 'آ'), + (0xFE83, 'M', 'أ'), + (0xFE85, 'M', 'ؤ'), + (0xFE87, 'M', 'إ'), + (0xFE89, 'M', 'ئ'), + (0xFE8D, 'M', 'ا'), + (0xFE8F, 'M', 'ب'), + (0xFE93, 'M', 'ة'), + (0xFE95, 'M', 'ت'), + (0xFE99, 'M', 'ث'), + (0xFE9D, 'M', 'ج'), + (0xFEA1, 'M', 'ح'), + (0xFEA5, 'M', 'خ'), + (0xFEA9, 'M', 'د'), + (0xFEAB, 'M', 'ذ'), + (0xFEAD, 'M', 'ر'), + (0xFEAF, 'M', 'ز'), + (0xFEB1, 'M', 'س'), + (0xFEB5, 'M', 'ش'), + (0xFEB9, 'M', 'ص'), + (0xFEBD, 'M', 'ض'), + (0xFEC1, 'M', 'ط'), + (0xFEC5, 'M', 'ظ'), + (0xFEC9, 'M', 'ع'), + (0xFECD, 'M', 'غ'), + (0xFED1, 'M', 'ف'), + (0xFED5, 'M', 'ق'), + (0xFED9, 'M', 'ك'), + (0xFEDD, 'M', 'ل'), + (0xFEE1, 'M', 'م'), + (0xFEE5, 'M', 'ن'), + (0xFEE9, 'M', 'ه'), + (0xFEED, 'M', 'و'), + (0xFEEF, 'M', 'ى'), + (0xFEF1, 'M', 'ي'), + (0xFEF5, 'M', 'لآ'), + (0xFEF7, 'M', 'لأ'), + (0xFEF9, 'M', 'لإ'), + (0xFEFB, 'M', 'لا'), + (0xFEFD, 'X'), + (0xFEFF, 'I'), + (0xFF00, 'X'), + (0xFF01, '3', '!'), + (0xFF02, '3', '"'), + (0xFF03, '3', '#'), + (0xFF04, '3', '$'), + (0xFF05, '3', '%'), + (0xFF06, '3', '&'), + (0xFF07, '3', '\''), + (0xFF08, '3', '('), + (0xFF09, '3', ')'), + (0xFF0A, '3', '*'), + (0xFF0B, '3', '+'), + (0xFF0C, '3', ','), + (0xFF0D, 'M', '-'), + (0xFF0E, 'M', '.'), + (0xFF0F, '3', '/'), + (0xFF10, 'M', '0'), + (0xFF11, 'M', '1'), + (0xFF12, 'M', '2'), + (0xFF13, 'M', '3'), + (0xFF14, 'M', '4'), + (0xFF15, 'M', '5'), + (0xFF16, 'M', '6'), + (0xFF17, 'M', '7'), + (0xFF18, 'M', '8'), + (0xFF19, 'M', '9'), + (0xFF1A, '3', ':'), + ] + +def _seg_51() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFF1B, '3', ';'), + (0xFF1C, '3', '<'), + (0xFF1D, '3', '='), + (0xFF1E, '3', '>'), + (0xFF1F, '3', '?'), + (0xFF20, '3', '@'), + (0xFF21, 'M', 'a'), + (0xFF22, 'M', 'b'), + (0xFF23, 'M', 'c'), + (0xFF24, 'M', 'd'), + (0xFF25, 'M', 'e'), + (0xFF26, 'M', 'f'), + (0xFF27, 'M', 'g'), + (0xFF28, 'M', 'h'), + (0xFF29, 'M', 'i'), + (0xFF2A, 'M', 'j'), + (0xFF2B, 'M', 'k'), + (0xFF2C, 'M', 'l'), + (0xFF2D, 'M', 'm'), + (0xFF2E, 'M', 'n'), + (0xFF2F, 'M', 'o'), + (0xFF30, 'M', 'p'), + (0xFF31, 'M', 'q'), + (0xFF32, 'M', 'r'), + (0xFF33, 'M', 's'), + (0xFF34, 'M', 't'), + (0xFF35, 'M', 'u'), + (0xFF36, 'M', 'v'), + (0xFF37, 'M', 'w'), + (0xFF38, 'M', 'x'), + (0xFF39, 'M', 'y'), + (0xFF3A, 'M', 'z'), + (0xFF3B, '3', '['), + (0xFF3C, '3', '\\'), + (0xFF3D, '3', ']'), + (0xFF3E, '3', '^'), + (0xFF3F, '3', '_'), + (0xFF40, '3', '`'), + (0xFF41, 'M', 'a'), + (0xFF42, 'M', 'b'), + (0xFF43, 'M', 'c'), + (0xFF44, 'M', 'd'), + (0xFF45, 'M', 'e'), + (0xFF46, 'M', 'f'), + (0xFF47, 'M', 'g'), + (0xFF48, 'M', 'h'), + (0xFF49, 'M', 'i'), + (0xFF4A, 'M', 'j'), + (0xFF4B, 'M', 'k'), + (0xFF4C, 'M', 'l'), + (0xFF4D, 'M', 'm'), + (0xFF4E, 'M', 'n'), + (0xFF4F, 'M', 'o'), + (0xFF50, 'M', 'p'), + (0xFF51, 'M', 'q'), + (0xFF52, 'M', 'r'), + (0xFF53, 'M', 's'), + (0xFF54, 'M', 't'), + (0xFF55, 'M', 'u'), + (0xFF56, 'M', 'v'), + (0xFF57, 'M', 'w'), + (0xFF58, 'M', 'x'), + (0xFF59, 'M', 'y'), + (0xFF5A, 'M', 'z'), + (0xFF5B, '3', '{'), + (0xFF5C, '3', '|'), + (0xFF5D, '3', '}'), + (0xFF5E, '3', '~'), + (0xFF5F, 'M', '⦅'), + (0xFF60, 'M', '⦆'), + (0xFF61, 'M', '.'), + (0xFF62, 'M', '「'), + (0xFF63, 'M', '」'), + (0xFF64, 'M', '、'), + (0xFF65, 'M', '・'), + (0xFF66, 'M', 'ヲ'), + (0xFF67, 'M', 'ァ'), + (0xFF68, 'M', 'ィ'), + (0xFF69, 'M', 'ゥ'), + (0xFF6A, 'M', 'ェ'), + (0xFF6B, 'M', 'ォ'), + (0xFF6C, 'M', 'ャ'), + (0xFF6D, 'M', 'ュ'), + (0xFF6E, 'M', 'ョ'), + (0xFF6F, 'M', 'ッ'), + (0xFF70, 'M', 'ー'), + (0xFF71, 'M', 'ア'), + (0xFF72, 'M', 'イ'), + (0xFF73, 'M', 'ウ'), + (0xFF74, 'M', 'エ'), + (0xFF75, 'M', 'オ'), + (0xFF76, 'M', 'カ'), + (0xFF77, 'M', 'キ'), + (0xFF78, 'M', 'ク'), + (0xFF79, 'M', 'ケ'), + (0xFF7A, 'M', 'コ'), + (0xFF7B, 'M', 'サ'), + (0xFF7C, 'M', 'シ'), + (0xFF7D, 'M', 'ス'), + (0xFF7E, 'M', 'セ'), + ] + +def _seg_52() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFF7F, 'M', 'ソ'), + (0xFF80, 'M', 'タ'), + (0xFF81, 'M', 'チ'), + (0xFF82, 'M', 'ツ'), + (0xFF83, 'M', 'テ'), + (0xFF84, 'M', 'ト'), + (0xFF85, 'M', 'ナ'), + (0xFF86, 'M', 'ニ'), + (0xFF87, 'M', 'ヌ'), + (0xFF88, 'M', 'ネ'), + (0xFF89, 'M', 'ノ'), + (0xFF8A, 'M', 'ハ'), + (0xFF8B, 'M', 'ヒ'), + (0xFF8C, 'M', 'フ'), + (0xFF8D, 'M', 'ヘ'), + (0xFF8E, 'M', 'ホ'), + (0xFF8F, 'M', 'マ'), + (0xFF90, 'M', 'ミ'), + (0xFF91, 'M', 'ム'), + (0xFF92, 'M', 'メ'), + (0xFF93, 'M', 'モ'), + (0xFF94, 'M', 'ヤ'), + (0xFF95, 'M', 'ユ'), + (0xFF96, 'M', 'ヨ'), + (0xFF97, 'M', 'ラ'), + (0xFF98, 'M', 'リ'), + (0xFF99, 'M', 'ル'), + (0xFF9A, 'M', 'レ'), + (0xFF9B, 'M', 'ロ'), + (0xFF9C, 'M', 'ワ'), + (0xFF9D, 'M', 'ン'), + (0xFF9E, 'M', '゙'), + (0xFF9F, 'M', '゚'), + (0xFFA0, 'X'), + (0xFFA1, 'M', 'ᄀ'), + (0xFFA2, 'M', 'ᄁ'), + (0xFFA3, 'M', 'ᆪ'), + (0xFFA4, 'M', 'ᄂ'), + (0xFFA5, 'M', 'ᆬ'), + (0xFFA6, 'M', 'ᆭ'), + (0xFFA7, 'M', 'ᄃ'), + (0xFFA8, 'M', 'ᄄ'), + (0xFFA9, 'M', 'ᄅ'), + (0xFFAA, 'M', 'ᆰ'), + (0xFFAB, 'M', 'ᆱ'), + (0xFFAC, 'M', 'ᆲ'), + (0xFFAD, 'M', 'ᆳ'), + (0xFFAE, 'M', 'ᆴ'), + (0xFFAF, 'M', 'ᆵ'), + (0xFFB0, 'M', 'ᄚ'), + (0xFFB1, 'M', 'ᄆ'), + (0xFFB2, 'M', 'ᄇ'), + (0xFFB3, 'M', 'ᄈ'), + (0xFFB4, 'M', 'ᄡ'), + (0xFFB5, 'M', 'ᄉ'), + (0xFFB6, 'M', 'ᄊ'), + (0xFFB7, 'M', 'ᄋ'), + (0xFFB8, 'M', 'ᄌ'), + (0xFFB9, 'M', 'ᄍ'), + (0xFFBA, 'M', 'ᄎ'), + (0xFFBB, 'M', 'ᄏ'), + (0xFFBC, 'M', 'ᄐ'), + (0xFFBD, 'M', 'ᄑ'), + (0xFFBE, 'M', 'ᄒ'), + (0xFFBF, 'X'), + (0xFFC2, 'M', 'ᅡ'), + (0xFFC3, 'M', 'ᅢ'), + (0xFFC4, 'M', 'ᅣ'), + (0xFFC5, 'M', 'ᅤ'), + (0xFFC6, 'M', 'ᅥ'), + (0xFFC7, 'M', 'ᅦ'), + (0xFFC8, 'X'), + (0xFFCA, 'M', 'ᅧ'), + (0xFFCB, 'M', 'ᅨ'), + (0xFFCC, 'M', 'ᅩ'), + (0xFFCD, 'M', 'ᅪ'), + (0xFFCE, 'M', 'ᅫ'), + (0xFFCF, 'M', 'ᅬ'), + (0xFFD0, 'X'), + (0xFFD2, 'M', 'ᅭ'), + (0xFFD3, 'M', 'ᅮ'), + (0xFFD4, 'M', 'ᅯ'), + (0xFFD5, 'M', 'ᅰ'), + (0xFFD6, 'M', 'ᅱ'), + (0xFFD7, 'M', 'ᅲ'), + (0xFFD8, 'X'), + (0xFFDA, 'M', 'ᅳ'), + (0xFFDB, 'M', 'ᅴ'), + (0xFFDC, 'M', 'ᅵ'), + (0xFFDD, 'X'), + (0xFFE0, 'M', '¢'), + (0xFFE1, 'M', '£'), + (0xFFE2, 'M', '¬'), + (0xFFE3, '3', ' ̄'), + (0xFFE4, 'M', '¦'), + (0xFFE5, 'M', '¥'), + (0xFFE6, 'M', '₩'), + (0xFFE7, 'X'), + (0xFFE8, 'M', '│'), + (0xFFE9, 'M', '←'), + ] + +def _seg_53() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFFEA, 'M', '↑'), + (0xFFEB, 'M', '→'), + (0xFFEC, 'M', '↓'), + (0xFFED, 'M', '■'), + (0xFFEE, 'M', '○'), + (0xFFEF, 'X'), + (0x10000, 'V'), + (0x1000C, 'X'), + (0x1000D, 'V'), + (0x10027, 'X'), + (0x10028, 'V'), + (0x1003B, 'X'), + (0x1003C, 'V'), + (0x1003E, 'X'), + (0x1003F, 'V'), + (0x1004E, 'X'), + (0x10050, 'V'), + (0x1005E, 'X'), + (0x10080, 'V'), + (0x100FB, 'X'), + (0x10100, 'V'), + (0x10103, 'X'), + (0x10107, 'V'), + (0x10134, 'X'), + (0x10137, 'V'), + (0x1018F, 'X'), + (0x10190, 'V'), + (0x1019D, 'X'), + (0x101A0, 'V'), + (0x101A1, 'X'), + (0x101D0, 'V'), + (0x101FE, 'X'), + (0x10280, 'V'), + (0x1029D, 'X'), + (0x102A0, 'V'), + (0x102D1, 'X'), + (0x102E0, 'V'), + (0x102FC, 'X'), + (0x10300, 'V'), + (0x10324, 'X'), + (0x1032D, 'V'), + (0x1034B, 'X'), + (0x10350, 'V'), + (0x1037B, 'X'), + (0x10380, 'V'), + (0x1039E, 'X'), + (0x1039F, 'V'), + (0x103C4, 'X'), + (0x103C8, 'V'), + (0x103D6, 'X'), + (0x10400, 'M', '𐐨'), + (0x10401, 'M', '𐐩'), + (0x10402, 'M', '𐐪'), + (0x10403, 'M', '𐐫'), + (0x10404, 'M', '𐐬'), + (0x10405, 'M', '𐐭'), + (0x10406, 'M', '𐐮'), + (0x10407, 'M', '𐐯'), + (0x10408, 'M', '𐐰'), + (0x10409, 'M', '𐐱'), + (0x1040A, 'M', '𐐲'), + (0x1040B, 'M', '𐐳'), + (0x1040C, 'M', '𐐴'), + (0x1040D, 'M', '𐐵'), + (0x1040E, 'M', '𐐶'), + (0x1040F, 'M', '𐐷'), + (0x10410, 'M', '𐐸'), + (0x10411, 'M', '𐐹'), + (0x10412, 'M', '𐐺'), + (0x10413, 'M', '𐐻'), + (0x10414, 'M', '𐐼'), + (0x10415, 'M', '𐐽'), + (0x10416, 'M', '𐐾'), + (0x10417, 'M', '𐐿'), + (0x10418, 'M', '𐑀'), + (0x10419, 'M', '𐑁'), + (0x1041A, 'M', '𐑂'), + (0x1041B, 'M', '𐑃'), + (0x1041C, 'M', '𐑄'), + (0x1041D, 'M', '𐑅'), + (0x1041E, 'M', '𐑆'), + (0x1041F, 'M', '𐑇'), + (0x10420, 'M', '𐑈'), + (0x10421, 'M', '𐑉'), + (0x10422, 'M', '𐑊'), + (0x10423, 'M', '𐑋'), + (0x10424, 'M', '𐑌'), + (0x10425, 'M', '𐑍'), + (0x10426, 'M', '𐑎'), + (0x10427, 'M', '𐑏'), + (0x10428, 'V'), + (0x1049E, 'X'), + (0x104A0, 'V'), + (0x104AA, 'X'), + (0x104B0, 'M', '𐓘'), + (0x104B1, 'M', '𐓙'), + (0x104B2, 'M', '𐓚'), + (0x104B3, 'M', '𐓛'), + (0x104B4, 'M', '𐓜'), + (0x104B5, 'M', '𐓝'), + ] + +def _seg_54() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x104B6, 'M', '𐓞'), + (0x104B7, 'M', '𐓟'), + (0x104B8, 'M', '𐓠'), + (0x104B9, 'M', '𐓡'), + (0x104BA, 'M', '𐓢'), + (0x104BB, 'M', '𐓣'), + (0x104BC, 'M', '𐓤'), + (0x104BD, 'M', '𐓥'), + (0x104BE, 'M', '𐓦'), + (0x104BF, 'M', '𐓧'), + (0x104C0, 'M', '𐓨'), + (0x104C1, 'M', '𐓩'), + (0x104C2, 'M', '𐓪'), + (0x104C3, 'M', '𐓫'), + (0x104C4, 'M', '𐓬'), + (0x104C5, 'M', '𐓭'), + (0x104C6, 'M', '𐓮'), + (0x104C7, 'M', '𐓯'), + (0x104C8, 'M', '𐓰'), + (0x104C9, 'M', '𐓱'), + (0x104CA, 'M', '𐓲'), + (0x104CB, 'M', '𐓳'), + (0x104CC, 'M', '𐓴'), + (0x104CD, 'M', '𐓵'), + (0x104CE, 'M', '𐓶'), + (0x104CF, 'M', '𐓷'), + (0x104D0, 'M', '𐓸'), + (0x104D1, 'M', '𐓹'), + (0x104D2, 'M', '𐓺'), + (0x104D3, 'M', '𐓻'), + (0x104D4, 'X'), + (0x104D8, 'V'), + (0x104FC, 'X'), + (0x10500, 'V'), + (0x10528, 'X'), + (0x10530, 'V'), + (0x10564, 'X'), + (0x1056F, 'V'), + (0x10570, 'M', '𐖗'), + (0x10571, 'M', '𐖘'), + (0x10572, 'M', '𐖙'), + (0x10573, 'M', '𐖚'), + (0x10574, 'M', '𐖛'), + (0x10575, 'M', '𐖜'), + (0x10576, 'M', '𐖝'), + (0x10577, 'M', '𐖞'), + (0x10578, 'M', '𐖟'), + (0x10579, 'M', '𐖠'), + (0x1057A, 'M', '𐖡'), + (0x1057B, 'X'), + (0x1057C, 'M', '𐖣'), + (0x1057D, 'M', '𐖤'), + (0x1057E, 'M', '𐖥'), + (0x1057F, 'M', '𐖦'), + (0x10580, 'M', '𐖧'), + (0x10581, 'M', '𐖨'), + (0x10582, 'M', '𐖩'), + (0x10583, 'M', '𐖪'), + (0x10584, 'M', '𐖫'), + (0x10585, 'M', '𐖬'), + (0x10586, 'M', '𐖭'), + (0x10587, 'M', '𐖮'), + (0x10588, 'M', '𐖯'), + (0x10589, 'M', '𐖰'), + (0x1058A, 'M', '𐖱'), + (0x1058B, 'X'), + (0x1058C, 'M', '𐖳'), + (0x1058D, 'M', '𐖴'), + (0x1058E, 'M', '𐖵'), + (0x1058F, 'M', '𐖶'), + (0x10590, 'M', '𐖷'), + (0x10591, 'M', '𐖸'), + (0x10592, 'M', '𐖹'), + (0x10593, 'X'), + (0x10594, 'M', '𐖻'), + (0x10595, 'M', '𐖼'), + (0x10596, 'X'), + (0x10597, 'V'), + (0x105A2, 'X'), + (0x105A3, 'V'), + (0x105B2, 'X'), + (0x105B3, 'V'), + (0x105BA, 'X'), + (0x105BB, 'V'), + (0x105BD, 'X'), + (0x10600, 'V'), + (0x10737, 'X'), + (0x10740, 'V'), + (0x10756, 'X'), + (0x10760, 'V'), + (0x10768, 'X'), + (0x10780, 'V'), + (0x10781, 'M', 'ː'), + (0x10782, 'M', 'ˑ'), + (0x10783, 'M', 'æ'), + (0x10784, 'M', 'ʙ'), + (0x10785, 'M', 'ɓ'), + (0x10786, 'X'), + (0x10787, 'M', 'ʣ'), + (0x10788, 'M', 'ꭦ'), + ] + +def _seg_55() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x10789, 'M', 'ʥ'), + (0x1078A, 'M', 'ʤ'), + (0x1078B, 'M', 'ɖ'), + (0x1078C, 'M', 'ɗ'), + (0x1078D, 'M', 'ᶑ'), + (0x1078E, 'M', 'ɘ'), + (0x1078F, 'M', 'ɞ'), + (0x10790, 'M', 'ʩ'), + (0x10791, 'M', 'ɤ'), + (0x10792, 'M', 'ɢ'), + (0x10793, 'M', 'ɠ'), + (0x10794, 'M', 'ʛ'), + (0x10795, 'M', 'ħ'), + (0x10796, 'M', 'ʜ'), + (0x10797, 'M', 'ɧ'), + (0x10798, 'M', 'ʄ'), + (0x10799, 'M', 'ʪ'), + (0x1079A, 'M', 'ʫ'), + (0x1079B, 'M', 'ɬ'), + (0x1079C, 'M', '𝼄'), + (0x1079D, 'M', 'ꞎ'), + (0x1079E, 'M', 'ɮ'), + (0x1079F, 'M', '𝼅'), + (0x107A0, 'M', 'ʎ'), + (0x107A1, 'M', '𝼆'), + (0x107A2, 'M', 'ø'), + (0x107A3, 'M', 'ɶ'), + (0x107A4, 'M', 'ɷ'), + (0x107A5, 'M', 'q'), + (0x107A6, 'M', 'ɺ'), + (0x107A7, 'M', '𝼈'), + (0x107A8, 'M', 'ɽ'), + (0x107A9, 'M', 'ɾ'), + (0x107AA, 'M', 'ʀ'), + (0x107AB, 'M', 'ʨ'), + (0x107AC, 'M', 'ʦ'), + (0x107AD, 'M', 'ꭧ'), + (0x107AE, 'M', 'ʧ'), + (0x107AF, 'M', 'ʈ'), + (0x107B0, 'M', 'ⱱ'), + (0x107B1, 'X'), + (0x107B2, 'M', 'ʏ'), + (0x107B3, 'M', 'ʡ'), + (0x107B4, 'M', 'ʢ'), + (0x107B5, 'M', 'ʘ'), + (0x107B6, 'M', 'ǀ'), + (0x107B7, 'M', 'ǁ'), + (0x107B8, 'M', 'ǂ'), + (0x107B9, 'M', '𝼊'), + (0x107BA, 'M', '𝼞'), + (0x107BB, 'X'), + (0x10800, 'V'), + (0x10806, 'X'), + (0x10808, 'V'), + (0x10809, 'X'), + (0x1080A, 'V'), + (0x10836, 'X'), + (0x10837, 'V'), + (0x10839, 'X'), + (0x1083C, 'V'), + (0x1083D, 'X'), + (0x1083F, 'V'), + (0x10856, 'X'), + (0x10857, 'V'), + (0x1089F, 'X'), + (0x108A7, 'V'), + (0x108B0, 'X'), + (0x108E0, 'V'), + (0x108F3, 'X'), + (0x108F4, 'V'), + (0x108F6, 'X'), + (0x108FB, 'V'), + (0x1091C, 'X'), + (0x1091F, 'V'), + (0x1093A, 'X'), + (0x1093F, 'V'), + (0x10940, 'X'), + (0x10980, 'V'), + (0x109B8, 'X'), + (0x109BC, 'V'), + (0x109D0, 'X'), + (0x109D2, 'V'), + (0x10A04, 'X'), + (0x10A05, 'V'), + (0x10A07, 'X'), + (0x10A0C, 'V'), + (0x10A14, 'X'), + (0x10A15, 'V'), + (0x10A18, 'X'), + (0x10A19, 'V'), + (0x10A36, 'X'), + (0x10A38, 'V'), + (0x10A3B, 'X'), + (0x10A3F, 'V'), + (0x10A49, 'X'), + (0x10A50, 'V'), + (0x10A59, 'X'), + (0x10A60, 'V'), + (0x10AA0, 'X'), + (0x10AC0, 'V'), + ] + +def _seg_56() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x10AE7, 'X'), + (0x10AEB, 'V'), + (0x10AF7, 'X'), + (0x10B00, 'V'), + (0x10B36, 'X'), + (0x10B39, 'V'), + (0x10B56, 'X'), + (0x10B58, 'V'), + (0x10B73, 'X'), + (0x10B78, 'V'), + (0x10B92, 'X'), + (0x10B99, 'V'), + (0x10B9D, 'X'), + (0x10BA9, 'V'), + (0x10BB0, 'X'), + (0x10C00, 'V'), + (0x10C49, 'X'), + (0x10C80, 'M', '𐳀'), + (0x10C81, 'M', '𐳁'), + (0x10C82, 'M', '𐳂'), + (0x10C83, 'M', '𐳃'), + (0x10C84, 'M', '𐳄'), + (0x10C85, 'M', '𐳅'), + (0x10C86, 'M', '𐳆'), + (0x10C87, 'M', '𐳇'), + (0x10C88, 'M', '𐳈'), + (0x10C89, 'M', '𐳉'), + (0x10C8A, 'M', '𐳊'), + (0x10C8B, 'M', '𐳋'), + (0x10C8C, 'M', '𐳌'), + (0x10C8D, 'M', '𐳍'), + (0x10C8E, 'M', '𐳎'), + (0x10C8F, 'M', '𐳏'), + (0x10C90, 'M', '𐳐'), + (0x10C91, 'M', '𐳑'), + (0x10C92, 'M', '𐳒'), + (0x10C93, 'M', '𐳓'), + (0x10C94, 'M', '𐳔'), + (0x10C95, 'M', '𐳕'), + (0x10C96, 'M', '𐳖'), + (0x10C97, 'M', '𐳗'), + (0x10C98, 'M', '𐳘'), + (0x10C99, 'M', '𐳙'), + (0x10C9A, 'M', '𐳚'), + (0x10C9B, 'M', '𐳛'), + (0x10C9C, 'M', '𐳜'), + (0x10C9D, 'M', '𐳝'), + (0x10C9E, 'M', '𐳞'), + (0x10C9F, 'M', '𐳟'), + (0x10CA0, 'M', '𐳠'), + (0x10CA1, 'M', '𐳡'), + (0x10CA2, 'M', '𐳢'), + (0x10CA3, 'M', '𐳣'), + (0x10CA4, 'M', '𐳤'), + (0x10CA5, 'M', '𐳥'), + (0x10CA6, 'M', '𐳦'), + (0x10CA7, 'M', '𐳧'), + (0x10CA8, 'M', '𐳨'), + (0x10CA9, 'M', '𐳩'), + (0x10CAA, 'M', '𐳪'), + (0x10CAB, 'M', '𐳫'), + (0x10CAC, 'M', '𐳬'), + (0x10CAD, 'M', '𐳭'), + (0x10CAE, 'M', '𐳮'), + (0x10CAF, 'M', '𐳯'), + (0x10CB0, 'M', '𐳰'), + (0x10CB1, 'M', '𐳱'), + (0x10CB2, 'M', '𐳲'), + (0x10CB3, 'X'), + (0x10CC0, 'V'), + (0x10CF3, 'X'), + (0x10CFA, 'V'), + (0x10D28, 'X'), + (0x10D30, 'V'), + (0x10D3A, 'X'), + (0x10E60, 'V'), + (0x10E7F, 'X'), + (0x10E80, 'V'), + (0x10EAA, 'X'), + (0x10EAB, 'V'), + (0x10EAE, 'X'), + (0x10EB0, 'V'), + (0x10EB2, 'X'), + (0x10EFD, 'V'), + (0x10F28, 'X'), + (0x10F30, 'V'), + (0x10F5A, 'X'), + (0x10F70, 'V'), + (0x10F8A, 'X'), + (0x10FB0, 'V'), + (0x10FCC, 'X'), + (0x10FE0, 'V'), + (0x10FF7, 'X'), + (0x11000, 'V'), + (0x1104E, 'X'), + (0x11052, 'V'), + (0x11076, 'X'), + (0x1107F, 'V'), + (0x110BD, 'X'), + (0x110BE, 'V'), + ] + +def _seg_57() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x110C3, 'X'), + (0x110D0, 'V'), + (0x110E9, 'X'), + (0x110F0, 'V'), + (0x110FA, 'X'), + (0x11100, 'V'), + (0x11135, 'X'), + (0x11136, 'V'), + (0x11148, 'X'), + (0x11150, 'V'), + (0x11177, 'X'), + (0x11180, 'V'), + (0x111E0, 'X'), + (0x111E1, 'V'), + (0x111F5, 'X'), + (0x11200, 'V'), + (0x11212, 'X'), + (0x11213, 'V'), + (0x11242, 'X'), + (0x11280, 'V'), + (0x11287, 'X'), + (0x11288, 'V'), + (0x11289, 'X'), + (0x1128A, 'V'), + (0x1128E, 'X'), + (0x1128F, 'V'), + (0x1129E, 'X'), + (0x1129F, 'V'), + (0x112AA, 'X'), + (0x112B0, 'V'), + (0x112EB, 'X'), + (0x112F0, 'V'), + (0x112FA, 'X'), + (0x11300, 'V'), + (0x11304, 'X'), + (0x11305, 'V'), + (0x1130D, 'X'), + (0x1130F, 'V'), + (0x11311, 'X'), + (0x11313, 'V'), + (0x11329, 'X'), + (0x1132A, 'V'), + (0x11331, 'X'), + (0x11332, 'V'), + (0x11334, 'X'), + (0x11335, 'V'), + (0x1133A, 'X'), + (0x1133B, 'V'), + (0x11345, 'X'), + (0x11347, 'V'), + (0x11349, 'X'), + (0x1134B, 'V'), + (0x1134E, 'X'), + (0x11350, 'V'), + (0x11351, 'X'), + (0x11357, 'V'), + (0x11358, 'X'), + (0x1135D, 'V'), + (0x11364, 'X'), + (0x11366, 'V'), + (0x1136D, 'X'), + (0x11370, 'V'), + (0x11375, 'X'), + (0x11400, 'V'), + (0x1145C, 'X'), + (0x1145D, 'V'), + (0x11462, 'X'), + (0x11480, 'V'), + (0x114C8, 'X'), + (0x114D0, 'V'), + (0x114DA, 'X'), + (0x11580, 'V'), + (0x115B6, 'X'), + (0x115B8, 'V'), + (0x115DE, 'X'), + (0x11600, 'V'), + (0x11645, 'X'), + (0x11650, 'V'), + (0x1165A, 'X'), + (0x11660, 'V'), + (0x1166D, 'X'), + (0x11680, 'V'), + (0x116BA, 'X'), + (0x116C0, 'V'), + (0x116CA, 'X'), + (0x11700, 'V'), + (0x1171B, 'X'), + (0x1171D, 'V'), + (0x1172C, 'X'), + (0x11730, 'V'), + (0x11747, 'X'), + (0x11800, 'V'), + (0x1183C, 'X'), + (0x118A0, 'M', '𑣀'), + (0x118A1, 'M', '𑣁'), + (0x118A2, 'M', '𑣂'), + (0x118A3, 'M', '𑣃'), + (0x118A4, 'M', '𑣄'), + (0x118A5, 'M', '𑣅'), + (0x118A6, 'M', '𑣆'), + ] + +def _seg_58() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x118A7, 'M', '𑣇'), + (0x118A8, 'M', '𑣈'), + (0x118A9, 'M', '𑣉'), + (0x118AA, 'M', '𑣊'), + (0x118AB, 'M', '𑣋'), + (0x118AC, 'M', '𑣌'), + (0x118AD, 'M', '𑣍'), + (0x118AE, 'M', '𑣎'), + (0x118AF, 'M', '𑣏'), + (0x118B0, 'M', '𑣐'), + (0x118B1, 'M', '𑣑'), + (0x118B2, 'M', '𑣒'), + (0x118B3, 'M', '𑣓'), + (0x118B4, 'M', '𑣔'), + (0x118B5, 'M', '𑣕'), + (0x118B6, 'M', '𑣖'), + (0x118B7, 'M', '𑣗'), + (0x118B8, 'M', '𑣘'), + (0x118B9, 'M', '𑣙'), + (0x118BA, 'M', '𑣚'), + (0x118BB, 'M', '𑣛'), + (0x118BC, 'M', '𑣜'), + (0x118BD, 'M', '𑣝'), + (0x118BE, 'M', '𑣞'), + (0x118BF, 'M', '𑣟'), + (0x118C0, 'V'), + (0x118F3, 'X'), + (0x118FF, 'V'), + (0x11907, 'X'), + (0x11909, 'V'), + (0x1190A, 'X'), + (0x1190C, 'V'), + (0x11914, 'X'), + (0x11915, 'V'), + (0x11917, 'X'), + (0x11918, 'V'), + (0x11936, 'X'), + (0x11937, 'V'), + (0x11939, 'X'), + (0x1193B, 'V'), + (0x11947, 'X'), + (0x11950, 'V'), + (0x1195A, 'X'), + (0x119A0, 'V'), + (0x119A8, 'X'), + (0x119AA, 'V'), + (0x119D8, 'X'), + (0x119DA, 'V'), + (0x119E5, 'X'), + (0x11A00, 'V'), + (0x11A48, 'X'), + (0x11A50, 'V'), + (0x11AA3, 'X'), + (0x11AB0, 'V'), + (0x11AF9, 'X'), + (0x11B00, 'V'), + (0x11B0A, 'X'), + (0x11C00, 'V'), + (0x11C09, 'X'), + (0x11C0A, 'V'), + (0x11C37, 'X'), + (0x11C38, 'V'), + (0x11C46, 'X'), + (0x11C50, 'V'), + (0x11C6D, 'X'), + (0x11C70, 'V'), + (0x11C90, 'X'), + (0x11C92, 'V'), + (0x11CA8, 'X'), + (0x11CA9, 'V'), + (0x11CB7, 'X'), + (0x11D00, 'V'), + (0x11D07, 'X'), + (0x11D08, 'V'), + (0x11D0A, 'X'), + (0x11D0B, 'V'), + (0x11D37, 'X'), + (0x11D3A, 'V'), + (0x11D3B, 'X'), + (0x11D3C, 'V'), + (0x11D3E, 'X'), + (0x11D3F, 'V'), + (0x11D48, 'X'), + (0x11D50, 'V'), + (0x11D5A, 'X'), + (0x11D60, 'V'), + (0x11D66, 'X'), + (0x11D67, 'V'), + (0x11D69, 'X'), + (0x11D6A, 'V'), + (0x11D8F, 'X'), + (0x11D90, 'V'), + (0x11D92, 'X'), + (0x11D93, 'V'), + (0x11D99, 'X'), + (0x11DA0, 'V'), + (0x11DAA, 'X'), + (0x11EE0, 'V'), + (0x11EF9, 'X'), + (0x11F00, 'V'), + ] + +def _seg_59() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x11F11, 'X'), + (0x11F12, 'V'), + (0x11F3B, 'X'), + (0x11F3E, 'V'), + (0x11F5A, 'X'), + (0x11FB0, 'V'), + (0x11FB1, 'X'), + (0x11FC0, 'V'), + (0x11FF2, 'X'), + (0x11FFF, 'V'), + (0x1239A, 'X'), + (0x12400, 'V'), + (0x1246F, 'X'), + (0x12470, 'V'), + (0x12475, 'X'), + (0x12480, 'V'), + (0x12544, 'X'), + (0x12F90, 'V'), + (0x12FF3, 'X'), + (0x13000, 'V'), + (0x13430, 'X'), + (0x13440, 'V'), + (0x13456, 'X'), + (0x14400, 'V'), + (0x14647, 'X'), + (0x16800, 'V'), + (0x16A39, 'X'), + (0x16A40, 'V'), + (0x16A5F, 'X'), + (0x16A60, 'V'), + (0x16A6A, 'X'), + (0x16A6E, 'V'), + (0x16ABF, 'X'), + (0x16AC0, 'V'), + (0x16ACA, 'X'), + (0x16AD0, 'V'), + (0x16AEE, 'X'), + (0x16AF0, 'V'), + (0x16AF6, 'X'), + (0x16B00, 'V'), + (0x16B46, 'X'), + (0x16B50, 'V'), + (0x16B5A, 'X'), + (0x16B5B, 'V'), + (0x16B62, 'X'), + (0x16B63, 'V'), + (0x16B78, 'X'), + (0x16B7D, 'V'), + (0x16B90, 'X'), + (0x16E40, 'M', '𖹠'), + (0x16E41, 'M', '𖹡'), + (0x16E42, 'M', '𖹢'), + (0x16E43, 'M', '𖹣'), + (0x16E44, 'M', '𖹤'), + (0x16E45, 'M', '𖹥'), + (0x16E46, 'M', '𖹦'), + (0x16E47, 'M', '𖹧'), + (0x16E48, 'M', '𖹨'), + (0x16E49, 'M', '𖹩'), + (0x16E4A, 'M', '𖹪'), + (0x16E4B, 'M', '𖹫'), + (0x16E4C, 'M', '𖹬'), + (0x16E4D, 'M', '𖹭'), + (0x16E4E, 'M', '𖹮'), + (0x16E4F, 'M', '𖹯'), + (0x16E50, 'M', '𖹰'), + (0x16E51, 'M', '𖹱'), + (0x16E52, 'M', '𖹲'), + (0x16E53, 'M', '𖹳'), + (0x16E54, 'M', '𖹴'), + (0x16E55, 'M', '𖹵'), + (0x16E56, 'M', '𖹶'), + (0x16E57, 'M', '𖹷'), + (0x16E58, 'M', '𖹸'), + (0x16E59, 'M', '𖹹'), + (0x16E5A, 'M', '𖹺'), + (0x16E5B, 'M', '𖹻'), + (0x16E5C, 'M', '𖹼'), + (0x16E5D, 'M', '𖹽'), + (0x16E5E, 'M', '𖹾'), + (0x16E5F, 'M', '𖹿'), + (0x16E60, 'V'), + (0x16E9B, 'X'), + (0x16F00, 'V'), + (0x16F4B, 'X'), + (0x16F4F, 'V'), + (0x16F88, 'X'), + (0x16F8F, 'V'), + (0x16FA0, 'X'), + (0x16FE0, 'V'), + (0x16FE5, 'X'), + (0x16FF0, 'V'), + (0x16FF2, 'X'), + (0x17000, 'V'), + (0x187F8, 'X'), + (0x18800, 'V'), + (0x18CD6, 'X'), + (0x18D00, 'V'), + (0x18D09, 'X'), + (0x1AFF0, 'V'), + ] + +def _seg_60() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1AFF4, 'X'), + (0x1AFF5, 'V'), + (0x1AFFC, 'X'), + (0x1AFFD, 'V'), + (0x1AFFF, 'X'), + (0x1B000, 'V'), + (0x1B123, 'X'), + (0x1B132, 'V'), + (0x1B133, 'X'), + (0x1B150, 'V'), + (0x1B153, 'X'), + (0x1B155, 'V'), + (0x1B156, 'X'), + (0x1B164, 'V'), + (0x1B168, 'X'), + (0x1B170, 'V'), + (0x1B2FC, 'X'), + (0x1BC00, 'V'), + (0x1BC6B, 'X'), + (0x1BC70, 'V'), + (0x1BC7D, 'X'), + (0x1BC80, 'V'), + (0x1BC89, 'X'), + (0x1BC90, 'V'), + (0x1BC9A, 'X'), + (0x1BC9C, 'V'), + (0x1BCA0, 'I'), + (0x1BCA4, 'X'), + (0x1CF00, 'V'), + (0x1CF2E, 'X'), + (0x1CF30, 'V'), + (0x1CF47, 'X'), + (0x1CF50, 'V'), + (0x1CFC4, 'X'), + (0x1D000, 'V'), + (0x1D0F6, 'X'), + (0x1D100, 'V'), + (0x1D127, 'X'), + (0x1D129, 'V'), + (0x1D15E, 'M', '𝅗𝅥'), + (0x1D15F, 'M', '𝅘𝅥'), + (0x1D160, 'M', '𝅘𝅥𝅮'), + (0x1D161, 'M', '𝅘𝅥𝅯'), + (0x1D162, 'M', '𝅘𝅥𝅰'), + (0x1D163, 'M', '𝅘𝅥𝅱'), + (0x1D164, 'M', '𝅘𝅥𝅲'), + (0x1D165, 'V'), + (0x1D173, 'X'), + (0x1D17B, 'V'), + (0x1D1BB, 'M', '𝆹𝅥'), + (0x1D1BC, 'M', '𝆺𝅥'), + (0x1D1BD, 'M', '𝆹𝅥𝅮'), + (0x1D1BE, 'M', '𝆺𝅥𝅮'), + (0x1D1BF, 'M', '𝆹𝅥𝅯'), + (0x1D1C0, 'M', '𝆺𝅥𝅯'), + (0x1D1C1, 'V'), + (0x1D1EB, 'X'), + (0x1D200, 'V'), + (0x1D246, 'X'), + (0x1D2C0, 'V'), + (0x1D2D4, 'X'), + (0x1D2E0, 'V'), + (0x1D2F4, 'X'), + (0x1D300, 'V'), + (0x1D357, 'X'), + (0x1D360, 'V'), + (0x1D379, 'X'), + (0x1D400, 'M', 'a'), + (0x1D401, 'M', 'b'), + (0x1D402, 'M', 'c'), + (0x1D403, 'M', 'd'), + (0x1D404, 'M', 'e'), + (0x1D405, 'M', 'f'), + (0x1D406, 'M', 'g'), + (0x1D407, 'M', 'h'), + (0x1D408, 'M', 'i'), + (0x1D409, 'M', 'j'), + (0x1D40A, 'M', 'k'), + (0x1D40B, 'M', 'l'), + (0x1D40C, 'M', 'm'), + (0x1D40D, 'M', 'n'), + (0x1D40E, 'M', 'o'), + (0x1D40F, 'M', 'p'), + (0x1D410, 'M', 'q'), + (0x1D411, 'M', 'r'), + (0x1D412, 'M', 's'), + (0x1D413, 'M', 't'), + (0x1D414, 'M', 'u'), + (0x1D415, 'M', 'v'), + (0x1D416, 'M', 'w'), + (0x1D417, 'M', 'x'), + (0x1D418, 'M', 'y'), + (0x1D419, 'M', 'z'), + (0x1D41A, 'M', 'a'), + (0x1D41B, 'M', 'b'), + (0x1D41C, 'M', 'c'), + (0x1D41D, 'M', 'd'), + (0x1D41E, 'M', 'e'), + (0x1D41F, 'M', 'f'), + (0x1D420, 'M', 'g'), + ] + +def _seg_61() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D421, 'M', 'h'), + (0x1D422, 'M', 'i'), + (0x1D423, 'M', 'j'), + (0x1D424, 'M', 'k'), + (0x1D425, 'M', 'l'), + (0x1D426, 'M', 'm'), + (0x1D427, 'M', 'n'), + (0x1D428, 'M', 'o'), + (0x1D429, 'M', 'p'), + (0x1D42A, 'M', 'q'), + (0x1D42B, 'M', 'r'), + (0x1D42C, 'M', 's'), + (0x1D42D, 'M', 't'), + (0x1D42E, 'M', 'u'), + (0x1D42F, 'M', 'v'), + (0x1D430, 'M', 'w'), + (0x1D431, 'M', 'x'), + (0x1D432, 'M', 'y'), + (0x1D433, 'M', 'z'), + (0x1D434, 'M', 'a'), + (0x1D435, 'M', 'b'), + (0x1D436, 'M', 'c'), + (0x1D437, 'M', 'd'), + (0x1D438, 'M', 'e'), + (0x1D439, 'M', 'f'), + (0x1D43A, 'M', 'g'), + (0x1D43B, 'M', 'h'), + (0x1D43C, 'M', 'i'), + (0x1D43D, 'M', 'j'), + (0x1D43E, 'M', 'k'), + (0x1D43F, 'M', 'l'), + (0x1D440, 'M', 'm'), + (0x1D441, 'M', 'n'), + (0x1D442, 'M', 'o'), + (0x1D443, 'M', 'p'), + (0x1D444, 'M', 'q'), + (0x1D445, 'M', 'r'), + (0x1D446, 'M', 's'), + (0x1D447, 'M', 't'), + (0x1D448, 'M', 'u'), + (0x1D449, 'M', 'v'), + (0x1D44A, 'M', 'w'), + (0x1D44B, 'M', 'x'), + (0x1D44C, 'M', 'y'), + (0x1D44D, 'M', 'z'), + (0x1D44E, 'M', 'a'), + (0x1D44F, 'M', 'b'), + (0x1D450, 'M', 'c'), + (0x1D451, 'M', 'd'), + (0x1D452, 'M', 'e'), + (0x1D453, 'M', 'f'), + (0x1D454, 'M', 'g'), + (0x1D455, 'X'), + (0x1D456, 'M', 'i'), + (0x1D457, 'M', 'j'), + (0x1D458, 'M', 'k'), + (0x1D459, 'M', 'l'), + (0x1D45A, 'M', 'm'), + (0x1D45B, 'M', 'n'), + (0x1D45C, 'M', 'o'), + (0x1D45D, 'M', 'p'), + (0x1D45E, 'M', 'q'), + (0x1D45F, 'M', 'r'), + (0x1D460, 'M', 's'), + (0x1D461, 'M', 't'), + (0x1D462, 'M', 'u'), + (0x1D463, 'M', 'v'), + (0x1D464, 'M', 'w'), + (0x1D465, 'M', 'x'), + (0x1D466, 'M', 'y'), + (0x1D467, 'M', 'z'), + (0x1D468, 'M', 'a'), + (0x1D469, 'M', 'b'), + (0x1D46A, 'M', 'c'), + (0x1D46B, 'M', 'd'), + (0x1D46C, 'M', 'e'), + (0x1D46D, 'M', 'f'), + (0x1D46E, 'M', 'g'), + (0x1D46F, 'M', 'h'), + (0x1D470, 'M', 'i'), + (0x1D471, 'M', 'j'), + (0x1D472, 'M', 'k'), + (0x1D473, 'M', 'l'), + (0x1D474, 'M', 'm'), + (0x1D475, 'M', 'n'), + (0x1D476, 'M', 'o'), + (0x1D477, 'M', 'p'), + (0x1D478, 'M', 'q'), + (0x1D479, 'M', 'r'), + (0x1D47A, 'M', 's'), + (0x1D47B, 'M', 't'), + (0x1D47C, 'M', 'u'), + (0x1D47D, 'M', 'v'), + (0x1D47E, 'M', 'w'), + (0x1D47F, 'M', 'x'), + (0x1D480, 'M', 'y'), + (0x1D481, 'M', 'z'), + (0x1D482, 'M', 'a'), + (0x1D483, 'M', 'b'), + (0x1D484, 'M', 'c'), + ] + +def _seg_62() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D485, 'M', 'd'), + (0x1D486, 'M', 'e'), + (0x1D487, 'M', 'f'), + (0x1D488, 'M', 'g'), + (0x1D489, 'M', 'h'), + (0x1D48A, 'M', 'i'), + (0x1D48B, 'M', 'j'), + (0x1D48C, 'M', 'k'), + (0x1D48D, 'M', 'l'), + (0x1D48E, 'M', 'm'), + (0x1D48F, 'M', 'n'), + (0x1D490, 'M', 'o'), + (0x1D491, 'M', 'p'), + (0x1D492, 'M', 'q'), + (0x1D493, 'M', 'r'), + (0x1D494, 'M', 's'), + (0x1D495, 'M', 't'), + (0x1D496, 'M', 'u'), + (0x1D497, 'M', 'v'), + (0x1D498, 'M', 'w'), + (0x1D499, 'M', 'x'), + (0x1D49A, 'M', 'y'), + (0x1D49B, 'M', 'z'), + (0x1D49C, 'M', 'a'), + (0x1D49D, 'X'), + (0x1D49E, 'M', 'c'), + (0x1D49F, 'M', 'd'), + (0x1D4A0, 'X'), + (0x1D4A2, 'M', 'g'), + (0x1D4A3, 'X'), + (0x1D4A5, 'M', 'j'), + (0x1D4A6, 'M', 'k'), + (0x1D4A7, 'X'), + (0x1D4A9, 'M', 'n'), + (0x1D4AA, 'M', 'o'), + (0x1D4AB, 'M', 'p'), + (0x1D4AC, 'M', 'q'), + (0x1D4AD, 'X'), + (0x1D4AE, 'M', 's'), + (0x1D4AF, 'M', 't'), + (0x1D4B0, 'M', 'u'), + (0x1D4B1, 'M', 'v'), + (0x1D4B2, 'M', 'w'), + (0x1D4B3, 'M', 'x'), + (0x1D4B4, 'M', 'y'), + (0x1D4B5, 'M', 'z'), + (0x1D4B6, 'M', 'a'), + (0x1D4B7, 'M', 'b'), + (0x1D4B8, 'M', 'c'), + (0x1D4B9, 'M', 'd'), + (0x1D4BA, 'X'), + (0x1D4BB, 'M', 'f'), + (0x1D4BC, 'X'), + (0x1D4BD, 'M', 'h'), + (0x1D4BE, 'M', 'i'), + (0x1D4BF, 'M', 'j'), + (0x1D4C0, 'M', 'k'), + (0x1D4C1, 'M', 'l'), + (0x1D4C2, 'M', 'm'), + (0x1D4C3, 'M', 'n'), + (0x1D4C4, 'X'), + (0x1D4C5, 'M', 'p'), + (0x1D4C6, 'M', 'q'), + (0x1D4C7, 'M', 'r'), + (0x1D4C8, 'M', 's'), + (0x1D4C9, 'M', 't'), + (0x1D4CA, 'M', 'u'), + (0x1D4CB, 'M', 'v'), + (0x1D4CC, 'M', 'w'), + (0x1D4CD, 'M', 'x'), + (0x1D4CE, 'M', 'y'), + (0x1D4CF, 'M', 'z'), + (0x1D4D0, 'M', 'a'), + (0x1D4D1, 'M', 'b'), + (0x1D4D2, 'M', 'c'), + (0x1D4D3, 'M', 'd'), + (0x1D4D4, 'M', 'e'), + (0x1D4D5, 'M', 'f'), + (0x1D4D6, 'M', 'g'), + (0x1D4D7, 'M', 'h'), + (0x1D4D8, 'M', 'i'), + (0x1D4D9, 'M', 'j'), + (0x1D4DA, 'M', 'k'), + (0x1D4DB, 'M', 'l'), + (0x1D4DC, 'M', 'm'), + (0x1D4DD, 'M', 'n'), + (0x1D4DE, 'M', 'o'), + (0x1D4DF, 'M', 'p'), + (0x1D4E0, 'M', 'q'), + (0x1D4E1, 'M', 'r'), + (0x1D4E2, 'M', 's'), + (0x1D4E3, 'M', 't'), + (0x1D4E4, 'M', 'u'), + (0x1D4E5, 'M', 'v'), + (0x1D4E6, 'M', 'w'), + (0x1D4E7, 'M', 'x'), + (0x1D4E8, 'M', 'y'), + (0x1D4E9, 'M', 'z'), + (0x1D4EA, 'M', 'a'), + (0x1D4EB, 'M', 'b'), + ] + +def _seg_63() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D4EC, 'M', 'c'), + (0x1D4ED, 'M', 'd'), + (0x1D4EE, 'M', 'e'), + (0x1D4EF, 'M', 'f'), + (0x1D4F0, 'M', 'g'), + (0x1D4F1, 'M', 'h'), + (0x1D4F2, 'M', 'i'), + (0x1D4F3, 'M', 'j'), + (0x1D4F4, 'M', 'k'), + (0x1D4F5, 'M', 'l'), + (0x1D4F6, 'M', 'm'), + (0x1D4F7, 'M', 'n'), + (0x1D4F8, 'M', 'o'), + (0x1D4F9, 'M', 'p'), + (0x1D4FA, 'M', 'q'), + (0x1D4FB, 'M', 'r'), + (0x1D4FC, 'M', 's'), + (0x1D4FD, 'M', 't'), + (0x1D4FE, 'M', 'u'), + (0x1D4FF, 'M', 'v'), + (0x1D500, 'M', 'w'), + (0x1D501, 'M', 'x'), + (0x1D502, 'M', 'y'), + (0x1D503, 'M', 'z'), + (0x1D504, 'M', 'a'), + (0x1D505, 'M', 'b'), + (0x1D506, 'X'), + (0x1D507, 'M', 'd'), + (0x1D508, 'M', 'e'), + (0x1D509, 'M', 'f'), + (0x1D50A, 'M', 'g'), + (0x1D50B, 'X'), + (0x1D50D, 'M', 'j'), + (0x1D50E, 'M', 'k'), + (0x1D50F, 'M', 'l'), + (0x1D510, 'M', 'm'), + (0x1D511, 'M', 'n'), + (0x1D512, 'M', 'o'), + (0x1D513, 'M', 'p'), + (0x1D514, 'M', 'q'), + (0x1D515, 'X'), + (0x1D516, 'M', 's'), + (0x1D517, 'M', 't'), + (0x1D518, 'M', 'u'), + (0x1D519, 'M', 'v'), + (0x1D51A, 'M', 'w'), + (0x1D51B, 'M', 'x'), + (0x1D51C, 'M', 'y'), + (0x1D51D, 'X'), + (0x1D51E, 'M', 'a'), + (0x1D51F, 'M', 'b'), + (0x1D520, 'M', 'c'), + (0x1D521, 'M', 'd'), + (0x1D522, 'M', 'e'), + (0x1D523, 'M', 'f'), + (0x1D524, 'M', 'g'), + (0x1D525, 'M', 'h'), + (0x1D526, 'M', 'i'), + (0x1D527, 'M', 'j'), + (0x1D528, 'M', 'k'), + (0x1D529, 'M', 'l'), + (0x1D52A, 'M', 'm'), + (0x1D52B, 'M', 'n'), + (0x1D52C, 'M', 'o'), + (0x1D52D, 'M', 'p'), + (0x1D52E, 'M', 'q'), + (0x1D52F, 'M', 'r'), + (0x1D530, 'M', 's'), + (0x1D531, 'M', 't'), + (0x1D532, 'M', 'u'), + (0x1D533, 'M', 'v'), + (0x1D534, 'M', 'w'), + (0x1D535, 'M', 'x'), + (0x1D536, 'M', 'y'), + (0x1D537, 'M', 'z'), + (0x1D538, 'M', 'a'), + (0x1D539, 'M', 'b'), + (0x1D53A, 'X'), + (0x1D53B, 'M', 'd'), + (0x1D53C, 'M', 'e'), + (0x1D53D, 'M', 'f'), + (0x1D53E, 'M', 'g'), + (0x1D53F, 'X'), + (0x1D540, 'M', 'i'), + (0x1D541, 'M', 'j'), + (0x1D542, 'M', 'k'), + (0x1D543, 'M', 'l'), + (0x1D544, 'M', 'm'), + (0x1D545, 'X'), + (0x1D546, 'M', 'o'), + (0x1D547, 'X'), + (0x1D54A, 'M', 's'), + (0x1D54B, 'M', 't'), + (0x1D54C, 'M', 'u'), + (0x1D54D, 'M', 'v'), + (0x1D54E, 'M', 'w'), + (0x1D54F, 'M', 'x'), + (0x1D550, 'M', 'y'), + (0x1D551, 'X'), + (0x1D552, 'M', 'a'), + ] + +def _seg_64() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D553, 'M', 'b'), + (0x1D554, 'M', 'c'), + (0x1D555, 'M', 'd'), + (0x1D556, 'M', 'e'), + (0x1D557, 'M', 'f'), + (0x1D558, 'M', 'g'), + (0x1D559, 'M', 'h'), + (0x1D55A, 'M', 'i'), + (0x1D55B, 'M', 'j'), + (0x1D55C, 'M', 'k'), + (0x1D55D, 'M', 'l'), + (0x1D55E, 'M', 'm'), + (0x1D55F, 'M', 'n'), + (0x1D560, 'M', 'o'), + (0x1D561, 'M', 'p'), + (0x1D562, 'M', 'q'), + (0x1D563, 'M', 'r'), + (0x1D564, 'M', 's'), + (0x1D565, 'M', 't'), + (0x1D566, 'M', 'u'), + (0x1D567, 'M', 'v'), + (0x1D568, 'M', 'w'), + (0x1D569, 'M', 'x'), + (0x1D56A, 'M', 'y'), + (0x1D56B, 'M', 'z'), + (0x1D56C, 'M', 'a'), + (0x1D56D, 'M', 'b'), + (0x1D56E, 'M', 'c'), + (0x1D56F, 'M', 'd'), + (0x1D570, 'M', 'e'), + (0x1D571, 'M', 'f'), + (0x1D572, 'M', 'g'), + (0x1D573, 'M', 'h'), + (0x1D574, 'M', 'i'), + (0x1D575, 'M', 'j'), + (0x1D576, 'M', 'k'), + (0x1D577, 'M', 'l'), + (0x1D578, 'M', 'm'), + (0x1D579, 'M', 'n'), + (0x1D57A, 'M', 'o'), + (0x1D57B, 'M', 'p'), + (0x1D57C, 'M', 'q'), + (0x1D57D, 'M', 'r'), + (0x1D57E, 'M', 's'), + (0x1D57F, 'M', 't'), + (0x1D580, 'M', 'u'), + (0x1D581, 'M', 'v'), + (0x1D582, 'M', 'w'), + (0x1D583, 'M', 'x'), + (0x1D584, 'M', 'y'), + (0x1D585, 'M', 'z'), + (0x1D586, 'M', 'a'), + (0x1D587, 'M', 'b'), + (0x1D588, 'M', 'c'), + (0x1D589, 'M', 'd'), + (0x1D58A, 'M', 'e'), + (0x1D58B, 'M', 'f'), + (0x1D58C, 'M', 'g'), + (0x1D58D, 'M', 'h'), + (0x1D58E, 'M', 'i'), + (0x1D58F, 'M', 'j'), + (0x1D590, 'M', 'k'), + (0x1D591, 'M', 'l'), + (0x1D592, 'M', 'm'), + (0x1D593, 'M', 'n'), + (0x1D594, 'M', 'o'), + (0x1D595, 'M', 'p'), + (0x1D596, 'M', 'q'), + (0x1D597, 'M', 'r'), + (0x1D598, 'M', 's'), + (0x1D599, 'M', 't'), + (0x1D59A, 'M', 'u'), + (0x1D59B, 'M', 'v'), + (0x1D59C, 'M', 'w'), + (0x1D59D, 'M', 'x'), + (0x1D59E, 'M', 'y'), + (0x1D59F, 'M', 'z'), + (0x1D5A0, 'M', 'a'), + (0x1D5A1, 'M', 'b'), + (0x1D5A2, 'M', 'c'), + (0x1D5A3, 'M', 'd'), + (0x1D5A4, 'M', 'e'), + (0x1D5A5, 'M', 'f'), + (0x1D5A6, 'M', 'g'), + (0x1D5A7, 'M', 'h'), + (0x1D5A8, 'M', 'i'), + (0x1D5A9, 'M', 'j'), + (0x1D5AA, 'M', 'k'), + (0x1D5AB, 'M', 'l'), + (0x1D5AC, 'M', 'm'), + (0x1D5AD, 'M', 'n'), + (0x1D5AE, 'M', 'o'), + (0x1D5AF, 'M', 'p'), + (0x1D5B0, 'M', 'q'), + (0x1D5B1, 'M', 'r'), + (0x1D5B2, 'M', 's'), + (0x1D5B3, 'M', 't'), + (0x1D5B4, 'M', 'u'), + (0x1D5B5, 'M', 'v'), + (0x1D5B6, 'M', 'w'), + ] + +def _seg_65() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D5B7, 'M', 'x'), + (0x1D5B8, 'M', 'y'), + (0x1D5B9, 'M', 'z'), + (0x1D5BA, 'M', 'a'), + (0x1D5BB, 'M', 'b'), + (0x1D5BC, 'M', 'c'), + (0x1D5BD, 'M', 'd'), + (0x1D5BE, 'M', 'e'), + (0x1D5BF, 'M', 'f'), + (0x1D5C0, 'M', 'g'), + (0x1D5C1, 'M', 'h'), + (0x1D5C2, 'M', 'i'), + (0x1D5C3, 'M', 'j'), + (0x1D5C4, 'M', 'k'), + (0x1D5C5, 'M', 'l'), + (0x1D5C6, 'M', 'm'), + (0x1D5C7, 'M', 'n'), + (0x1D5C8, 'M', 'o'), + (0x1D5C9, 'M', 'p'), + (0x1D5CA, 'M', 'q'), + (0x1D5CB, 'M', 'r'), + (0x1D5CC, 'M', 's'), + (0x1D5CD, 'M', 't'), + (0x1D5CE, 'M', 'u'), + (0x1D5CF, 'M', 'v'), + (0x1D5D0, 'M', 'w'), + (0x1D5D1, 'M', 'x'), + (0x1D5D2, 'M', 'y'), + (0x1D5D3, 'M', 'z'), + (0x1D5D4, 'M', 'a'), + (0x1D5D5, 'M', 'b'), + (0x1D5D6, 'M', 'c'), + (0x1D5D7, 'M', 'd'), + (0x1D5D8, 'M', 'e'), + (0x1D5D9, 'M', 'f'), + (0x1D5DA, 'M', 'g'), + (0x1D5DB, 'M', 'h'), + (0x1D5DC, 'M', 'i'), + (0x1D5DD, 'M', 'j'), + (0x1D5DE, 'M', 'k'), + (0x1D5DF, 'M', 'l'), + (0x1D5E0, 'M', 'm'), + (0x1D5E1, 'M', 'n'), + (0x1D5E2, 'M', 'o'), + (0x1D5E3, 'M', 'p'), + (0x1D5E4, 'M', 'q'), + (0x1D5E5, 'M', 'r'), + (0x1D5E6, 'M', 's'), + (0x1D5E7, 'M', 't'), + (0x1D5E8, 'M', 'u'), + (0x1D5E9, 'M', 'v'), + (0x1D5EA, 'M', 'w'), + (0x1D5EB, 'M', 'x'), + (0x1D5EC, 'M', 'y'), + (0x1D5ED, 'M', 'z'), + (0x1D5EE, 'M', 'a'), + (0x1D5EF, 'M', 'b'), + (0x1D5F0, 'M', 'c'), + (0x1D5F1, 'M', 'd'), + (0x1D5F2, 'M', 'e'), + (0x1D5F3, 'M', 'f'), + (0x1D5F4, 'M', 'g'), + (0x1D5F5, 'M', 'h'), + (0x1D5F6, 'M', 'i'), + (0x1D5F7, 'M', 'j'), + (0x1D5F8, 'M', 'k'), + (0x1D5F9, 'M', 'l'), + (0x1D5FA, 'M', 'm'), + (0x1D5FB, 'M', 'n'), + (0x1D5FC, 'M', 'o'), + (0x1D5FD, 'M', 'p'), + (0x1D5FE, 'M', 'q'), + (0x1D5FF, 'M', 'r'), + (0x1D600, 'M', 's'), + (0x1D601, 'M', 't'), + (0x1D602, 'M', 'u'), + (0x1D603, 'M', 'v'), + (0x1D604, 'M', 'w'), + (0x1D605, 'M', 'x'), + (0x1D606, 'M', 'y'), + (0x1D607, 'M', 'z'), + (0x1D608, 'M', 'a'), + (0x1D609, 'M', 'b'), + (0x1D60A, 'M', 'c'), + (0x1D60B, 'M', 'd'), + (0x1D60C, 'M', 'e'), + (0x1D60D, 'M', 'f'), + (0x1D60E, 'M', 'g'), + (0x1D60F, 'M', 'h'), + (0x1D610, 'M', 'i'), + (0x1D611, 'M', 'j'), + (0x1D612, 'M', 'k'), + (0x1D613, 'M', 'l'), + (0x1D614, 'M', 'm'), + (0x1D615, 'M', 'n'), + (0x1D616, 'M', 'o'), + (0x1D617, 'M', 'p'), + (0x1D618, 'M', 'q'), + (0x1D619, 'M', 'r'), + (0x1D61A, 'M', 's'), + ] + +def _seg_66() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D61B, 'M', 't'), + (0x1D61C, 'M', 'u'), + (0x1D61D, 'M', 'v'), + (0x1D61E, 'M', 'w'), + (0x1D61F, 'M', 'x'), + (0x1D620, 'M', 'y'), + (0x1D621, 'M', 'z'), + (0x1D622, 'M', 'a'), + (0x1D623, 'M', 'b'), + (0x1D624, 'M', 'c'), + (0x1D625, 'M', 'd'), + (0x1D626, 'M', 'e'), + (0x1D627, 'M', 'f'), + (0x1D628, 'M', 'g'), + (0x1D629, 'M', 'h'), + (0x1D62A, 'M', 'i'), + (0x1D62B, 'M', 'j'), + (0x1D62C, 'M', 'k'), + (0x1D62D, 'M', 'l'), + (0x1D62E, 'M', 'm'), + (0x1D62F, 'M', 'n'), + (0x1D630, 'M', 'o'), + (0x1D631, 'M', 'p'), + (0x1D632, 'M', 'q'), + (0x1D633, 'M', 'r'), + (0x1D634, 'M', 's'), + (0x1D635, 'M', 't'), + (0x1D636, 'M', 'u'), + (0x1D637, 'M', 'v'), + (0x1D638, 'M', 'w'), + (0x1D639, 'M', 'x'), + (0x1D63A, 'M', 'y'), + (0x1D63B, 'M', 'z'), + (0x1D63C, 'M', 'a'), + (0x1D63D, 'M', 'b'), + (0x1D63E, 'M', 'c'), + (0x1D63F, 'M', 'd'), + (0x1D640, 'M', 'e'), + (0x1D641, 'M', 'f'), + (0x1D642, 'M', 'g'), + (0x1D643, 'M', 'h'), + (0x1D644, 'M', 'i'), + (0x1D645, 'M', 'j'), + (0x1D646, 'M', 'k'), + (0x1D647, 'M', 'l'), + (0x1D648, 'M', 'm'), + (0x1D649, 'M', 'n'), + (0x1D64A, 'M', 'o'), + (0x1D64B, 'M', 'p'), + (0x1D64C, 'M', 'q'), + (0x1D64D, 'M', 'r'), + (0x1D64E, 'M', 's'), + (0x1D64F, 'M', 't'), + (0x1D650, 'M', 'u'), + (0x1D651, 'M', 'v'), + (0x1D652, 'M', 'w'), + (0x1D653, 'M', 'x'), + (0x1D654, 'M', 'y'), + (0x1D655, 'M', 'z'), + (0x1D656, 'M', 'a'), + (0x1D657, 'M', 'b'), + (0x1D658, 'M', 'c'), + (0x1D659, 'M', 'd'), + (0x1D65A, 'M', 'e'), + (0x1D65B, 'M', 'f'), + (0x1D65C, 'M', 'g'), + (0x1D65D, 'M', 'h'), + (0x1D65E, 'M', 'i'), + (0x1D65F, 'M', 'j'), + (0x1D660, 'M', 'k'), + (0x1D661, 'M', 'l'), + (0x1D662, 'M', 'm'), + (0x1D663, 'M', 'n'), + (0x1D664, 'M', 'o'), + (0x1D665, 'M', 'p'), + (0x1D666, 'M', 'q'), + (0x1D667, 'M', 'r'), + (0x1D668, 'M', 's'), + (0x1D669, 'M', 't'), + (0x1D66A, 'M', 'u'), + (0x1D66B, 'M', 'v'), + (0x1D66C, 'M', 'w'), + (0x1D66D, 'M', 'x'), + (0x1D66E, 'M', 'y'), + (0x1D66F, 'M', 'z'), + (0x1D670, 'M', 'a'), + (0x1D671, 'M', 'b'), + (0x1D672, 'M', 'c'), + (0x1D673, 'M', 'd'), + (0x1D674, 'M', 'e'), + (0x1D675, 'M', 'f'), + (0x1D676, 'M', 'g'), + (0x1D677, 'M', 'h'), + (0x1D678, 'M', 'i'), + (0x1D679, 'M', 'j'), + (0x1D67A, 'M', 'k'), + (0x1D67B, 'M', 'l'), + (0x1D67C, 'M', 'm'), + (0x1D67D, 'M', 'n'), + (0x1D67E, 'M', 'o'), + ] + +def _seg_67() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D67F, 'M', 'p'), + (0x1D680, 'M', 'q'), + (0x1D681, 'M', 'r'), + (0x1D682, 'M', 's'), + (0x1D683, 'M', 't'), + (0x1D684, 'M', 'u'), + (0x1D685, 'M', 'v'), + (0x1D686, 'M', 'w'), + (0x1D687, 'M', 'x'), + (0x1D688, 'M', 'y'), + (0x1D689, 'M', 'z'), + (0x1D68A, 'M', 'a'), + (0x1D68B, 'M', 'b'), + (0x1D68C, 'M', 'c'), + (0x1D68D, 'M', 'd'), + (0x1D68E, 'M', 'e'), + (0x1D68F, 'M', 'f'), + (0x1D690, 'M', 'g'), + (0x1D691, 'M', 'h'), + (0x1D692, 'M', 'i'), + (0x1D693, 'M', 'j'), + (0x1D694, 'M', 'k'), + (0x1D695, 'M', 'l'), + (0x1D696, 'M', 'm'), + (0x1D697, 'M', 'n'), + (0x1D698, 'M', 'o'), + (0x1D699, 'M', 'p'), + (0x1D69A, 'M', 'q'), + (0x1D69B, 'M', 'r'), + (0x1D69C, 'M', 's'), + (0x1D69D, 'M', 't'), + (0x1D69E, 'M', 'u'), + (0x1D69F, 'M', 'v'), + (0x1D6A0, 'M', 'w'), + (0x1D6A1, 'M', 'x'), + (0x1D6A2, 'M', 'y'), + (0x1D6A3, 'M', 'z'), + (0x1D6A4, 'M', 'ı'), + (0x1D6A5, 'M', 'ȷ'), + (0x1D6A6, 'X'), + (0x1D6A8, 'M', 'α'), + (0x1D6A9, 'M', 'β'), + (0x1D6AA, 'M', 'γ'), + (0x1D6AB, 'M', 'δ'), + (0x1D6AC, 'M', 'ε'), + (0x1D6AD, 'M', 'ζ'), + (0x1D6AE, 'M', 'η'), + (0x1D6AF, 'M', 'θ'), + (0x1D6B0, 'M', 'ι'), + (0x1D6B1, 'M', 'κ'), + (0x1D6B2, 'M', 'λ'), + (0x1D6B3, 'M', 'μ'), + (0x1D6B4, 'M', 'ν'), + (0x1D6B5, 'M', 'ξ'), + (0x1D6B6, 'M', 'ο'), + (0x1D6B7, 'M', 'π'), + (0x1D6B8, 'M', 'ρ'), + (0x1D6B9, 'M', 'θ'), + (0x1D6BA, 'M', 'σ'), + (0x1D6BB, 'M', 'τ'), + (0x1D6BC, 'M', 'υ'), + (0x1D6BD, 'M', 'φ'), + (0x1D6BE, 'M', 'χ'), + (0x1D6BF, 'M', 'ψ'), + (0x1D6C0, 'M', 'ω'), + (0x1D6C1, 'M', '∇'), + (0x1D6C2, 'M', 'α'), + (0x1D6C3, 'M', 'β'), + (0x1D6C4, 'M', 'γ'), + (0x1D6C5, 'M', 'δ'), + (0x1D6C6, 'M', 'ε'), + (0x1D6C7, 'M', 'ζ'), + (0x1D6C8, 'M', 'η'), + (0x1D6C9, 'M', 'θ'), + (0x1D6CA, 'M', 'ι'), + (0x1D6CB, 'M', 'κ'), + (0x1D6CC, 'M', 'λ'), + (0x1D6CD, 'M', 'μ'), + (0x1D6CE, 'M', 'ν'), + (0x1D6CF, 'M', 'ξ'), + (0x1D6D0, 'M', 'ο'), + (0x1D6D1, 'M', 'π'), + (0x1D6D2, 'M', 'ρ'), + (0x1D6D3, 'M', 'σ'), + (0x1D6D5, 'M', 'τ'), + (0x1D6D6, 'M', 'υ'), + (0x1D6D7, 'M', 'φ'), + (0x1D6D8, 'M', 'χ'), + (0x1D6D9, 'M', 'ψ'), + (0x1D6DA, 'M', 'ω'), + (0x1D6DB, 'M', '∂'), + (0x1D6DC, 'M', 'ε'), + (0x1D6DD, 'M', 'θ'), + (0x1D6DE, 'M', 'κ'), + (0x1D6DF, 'M', 'φ'), + (0x1D6E0, 'M', 'ρ'), + (0x1D6E1, 'M', 'π'), + (0x1D6E2, 'M', 'α'), + (0x1D6E3, 'M', 'β'), + (0x1D6E4, 'M', 'γ'), + ] + +def _seg_68() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D6E5, 'M', 'δ'), + (0x1D6E6, 'M', 'ε'), + (0x1D6E7, 'M', 'ζ'), + (0x1D6E8, 'M', 'η'), + (0x1D6E9, 'M', 'θ'), + (0x1D6EA, 'M', 'ι'), + (0x1D6EB, 'M', 'κ'), + (0x1D6EC, 'M', 'λ'), + (0x1D6ED, 'M', 'μ'), + (0x1D6EE, 'M', 'ν'), + (0x1D6EF, 'M', 'ξ'), + (0x1D6F0, 'M', 'ο'), + (0x1D6F1, 'M', 'π'), + (0x1D6F2, 'M', 'ρ'), + (0x1D6F3, 'M', 'θ'), + (0x1D6F4, 'M', 'σ'), + (0x1D6F5, 'M', 'τ'), + (0x1D6F6, 'M', 'υ'), + (0x1D6F7, 'M', 'φ'), + (0x1D6F8, 'M', 'χ'), + (0x1D6F9, 'M', 'ψ'), + (0x1D6FA, 'M', 'ω'), + (0x1D6FB, 'M', '∇'), + (0x1D6FC, 'M', 'α'), + (0x1D6FD, 'M', 'β'), + (0x1D6FE, 'M', 'γ'), + (0x1D6FF, 'M', 'δ'), + (0x1D700, 'M', 'ε'), + (0x1D701, 'M', 'ζ'), + (0x1D702, 'M', 'η'), + (0x1D703, 'M', 'θ'), + (0x1D704, 'M', 'ι'), + (0x1D705, 'M', 'κ'), + (0x1D706, 'M', 'λ'), + (0x1D707, 'M', 'μ'), + (0x1D708, 'M', 'ν'), + (0x1D709, 'M', 'ξ'), + (0x1D70A, 'M', 'ο'), + (0x1D70B, 'M', 'π'), + (0x1D70C, 'M', 'ρ'), + (0x1D70D, 'M', 'σ'), + (0x1D70F, 'M', 'τ'), + (0x1D710, 'M', 'υ'), + (0x1D711, 'M', 'φ'), + (0x1D712, 'M', 'χ'), + (0x1D713, 'M', 'ψ'), + (0x1D714, 'M', 'ω'), + (0x1D715, 'M', '∂'), + (0x1D716, 'M', 'ε'), + (0x1D717, 'M', 'θ'), + (0x1D718, 'M', 'κ'), + (0x1D719, 'M', 'φ'), + (0x1D71A, 'M', 'ρ'), + (0x1D71B, 'M', 'π'), + (0x1D71C, 'M', 'α'), + (0x1D71D, 'M', 'β'), + (0x1D71E, 'M', 'γ'), + (0x1D71F, 'M', 'δ'), + (0x1D720, 'M', 'ε'), + (0x1D721, 'M', 'ζ'), + (0x1D722, 'M', 'η'), + (0x1D723, 'M', 'θ'), + (0x1D724, 'M', 'ι'), + (0x1D725, 'M', 'κ'), + (0x1D726, 'M', 'λ'), + (0x1D727, 'M', 'μ'), + (0x1D728, 'M', 'ν'), + (0x1D729, 'M', 'ξ'), + (0x1D72A, 'M', 'ο'), + (0x1D72B, 'M', 'π'), + (0x1D72C, 'M', 'ρ'), + (0x1D72D, 'M', 'θ'), + (0x1D72E, 'M', 'σ'), + (0x1D72F, 'M', 'τ'), + (0x1D730, 'M', 'υ'), + (0x1D731, 'M', 'φ'), + (0x1D732, 'M', 'χ'), + (0x1D733, 'M', 'ψ'), + (0x1D734, 'M', 'ω'), + (0x1D735, 'M', '∇'), + (0x1D736, 'M', 'α'), + (0x1D737, 'M', 'β'), + (0x1D738, 'M', 'γ'), + (0x1D739, 'M', 'δ'), + (0x1D73A, 'M', 'ε'), + (0x1D73B, 'M', 'ζ'), + (0x1D73C, 'M', 'η'), + (0x1D73D, 'M', 'θ'), + (0x1D73E, 'M', 'ι'), + (0x1D73F, 'M', 'κ'), + (0x1D740, 'M', 'λ'), + (0x1D741, 'M', 'μ'), + (0x1D742, 'M', 'ν'), + (0x1D743, 'M', 'ξ'), + (0x1D744, 'M', 'ο'), + (0x1D745, 'M', 'π'), + (0x1D746, 'M', 'ρ'), + (0x1D747, 'M', 'σ'), + (0x1D749, 'M', 'τ'), + (0x1D74A, 'M', 'υ'), + ] + +def _seg_69() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D74B, 'M', 'φ'), + (0x1D74C, 'M', 'χ'), + (0x1D74D, 'M', 'ψ'), + (0x1D74E, 'M', 'ω'), + (0x1D74F, 'M', '∂'), + (0x1D750, 'M', 'ε'), + (0x1D751, 'M', 'θ'), + (0x1D752, 'M', 'κ'), + (0x1D753, 'M', 'φ'), + (0x1D754, 'M', 'ρ'), + (0x1D755, 'M', 'π'), + (0x1D756, 'M', 'α'), + (0x1D757, 'M', 'β'), + (0x1D758, 'M', 'γ'), + (0x1D759, 'M', 'δ'), + (0x1D75A, 'M', 'ε'), + (0x1D75B, 'M', 'ζ'), + (0x1D75C, 'M', 'η'), + (0x1D75D, 'M', 'θ'), + (0x1D75E, 'M', 'ι'), + (0x1D75F, 'M', 'κ'), + (0x1D760, 'M', 'λ'), + (0x1D761, 'M', 'μ'), + (0x1D762, 'M', 'ν'), + (0x1D763, 'M', 'ξ'), + (0x1D764, 'M', 'ο'), + (0x1D765, 'M', 'π'), + (0x1D766, 'M', 'ρ'), + (0x1D767, 'M', 'θ'), + (0x1D768, 'M', 'σ'), + (0x1D769, 'M', 'τ'), + (0x1D76A, 'M', 'υ'), + (0x1D76B, 'M', 'φ'), + (0x1D76C, 'M', 'χ'), + (0x1D76D, 'M', 'ψ'), + (0x1D76E, 'M', 'ω'), + (0x1D76F, 'M', '∇'), + (0x1D770, 'M', 'α'), + (0x1D771, 'M', 'β'), + (0x1D772, 'M', 'γ'), + (0x1D773, 'M', 'δ'), + (0x1D774, 'M', 'ε'), + (0x1D775, 'M', 'ζ'), + (0x1D776, 'M', 'η'), + (0x1D777, 'M', 'θ'), + (0x1D778, 'M', 'ι'), + (0x1D779, 'M', 'κ'), + (0x1D77A, 'M', 'λ'), + (0x1D77B, 'M', 'μ'), + (0x1D77C, 'M', 'ν'), + (0x1D77D, 'M', 'ξ'), + (0x1D77E, 'M', 'ο'), + (0x1D77F, 'M', 'π'), + (0x1D780, 'M', 'ρ'), + (0x1D781, 'M', 'σ'), + (0x1D783, 'M', 'τ'), + (0x1D784, 'M', 'υ'), + (0x1D785, 'M', 'φ'), + (0x1D786, 'M', 'χ'), + (0x1D787, 'M', 'ψ'), + (0x1D788, 'M', 'ω'), + (0x1D789, 'M', '∂'), + (0x1D78A, 'M', 'ε'), + (0x1D78B, 'M', 'θ'), + (0x1D78C, 'M', 'κ'), + (0x1D78D, 'M', 'φ'), + (0x1D78E, 'M', 'ρ'), + (0x1D78F, 'M', 'π'), + (0x1D790, 'M', 'α'), + (0x1D791, 'M', 'β'), + (0x1D792, 'M', 'γ'), + (0x1D793, 'M', 'δ'), + (0x1D794, 'M', 'ε'), + (0x1D795, 'M', 'ζ'), + (0x1D796, 'M', 'η'), + (0x1D797, 'M', 'θ'), + (0x1D798, 'M', 'ι'), + (0x1D799, 'M', 'κ'), + (0x1D79A, 'M', 'λ'), + (0x1D79B, 'M', 'μ'), + (0x1D79C, 'M', 'ν'), + (0x1D79D, 'M', 'ξ'), + (0x1D79E, 'M', 'ο'), + (0x1D79F, 'M', 'π'), + (0x1D7A0, 'M', 'ρ'), + (0x1D7A1, 'M', 'θ'), + (0x1D7A2, 'M', 'σ'), + (0x1D7A3, 'M', 'τ'), + (0x1D7A4, 'M', 'υ'), + (0x1D7A5, 'M', 'φ'), + (0x1D7A6, 'M', 'χ'), + (0x1D7A7, 'M', 'ψ'), + (0x1D7A8, 'M', 'ω'), + (0x1D7A9, 'M', '∇'), + (0x1D7AA, 'M', 'α'), + (0x1D7AB, 'M', 'β'), + (0x1D7AC, 'M', 'γ'), + (0x1D7AD, 'M', 'δ'), + (0x1D7AE, 'M', 'ε'), + (0x1D7AF, 'M', 'ζ'), + ] + +def _seg_70() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D7B0, 'M', 'η'), + (0x1D7B1, 'M', 'θ'), + (0x1D7B2, 'M', 'ι'), + (0x1D7B3, 'M', 'κ'), + (0x1D7B4, 'M', 'λ'), + (0x1D7B5, 'M', 'μ'), + (0x1D7B6, 'M', 'ν'), + (0x1D7B7, 'M', 'ξ'), + (0x1D7B8, 'M', 'ο'), + (0x1D7B9, 'M', 'π'), + (0x1D7BA, 'M', 'ρ'), + (0x1D7BB, 'M', 'σ'), + (0x1D7BD, 'M', 'τ'), + (0x1D7BE, 'M', 'υ'), + (0x1D7BF, 'M', 'φ'), + (0x1D7C0, 'M', 'χ'), + (0x1D7C1, 'M', 'ψ'), + (0x1D7C2, 'M', 'ω'), + (0x1D7C3, 'M', '∂'), + (0x1D7C4, 'M', 'ε'), + (0x1D7C5, 'M', 'θ'), + (0x1D7C6, 'M', 'κ'), + (0x1D7C7, 'M', 'φ'), + (0x1D7C8, 'M', 'ρ'), + (0x1D7C9, 'M', 'π'), + (0x1D7CA, 'M', 'ϝ'), + (0x1D7CC, 'X'), + (0x1D7CE, 'M', '0'), + (0x1D7CF, 'M', '1'), + (0x1D7D0, 'M', '2'), + (0x1D7D1, 'M', '3'), + (0x1D7D2, 'M', '4'), + (0x1D7D3, 'M', '5'), + (0x1D7D4, 'M', '6'), + (0x1D7D5, 'M', '7'), + (0x1D7D6, 'M', '8'), + (0x1D7D7, 'M', '9'), + (0x1D7D8, 'M', '0'), + (0x1D7D9, 'M', '1'), + (0x1D7DA, 'M', '2'), + (0x1D7DB, 'M', '3'), + (0x1D7DC, 'M', '4'), + (0x1D7DD, 'M', '5'), + (0x1D7DE, 'M', '6'), + (0x1D7DF, 'M', '7'), + (0x1D7E0, 'M', '8'), + (0x1D7E1, 'M', '9'), + (0x1D7E2, 'M', '0'), + (0x1D7E3, 'M', '1'), + (0x1D7E4, 'M', '2'), + (0x1D7E5, 'M', '3'), + (0x1D7E6, 'M', '4'), + (0x1D7E7, 'M', '5'), + (0x1D7E8, 'M', '6'), + (0x1D7E9, 'M', '7'), + (0x1D7EA, 'M', '8'), + (0x1D7EB, 'M', '9'), + (0x1D7EC, 'M', '0'), + (0x1D7ED, 'M', '1'), + (0x1D7EE, 'M', '2'), + (0x1D7EF, 'M', '3'), + (0x1D7F0, 'M', '4'), + (0x1D7F1, 'M', '5'), + (0x1D7F2, 'M', '6'), + (0x1D7F3, 'M', '7'), + (0x1D7F4, 'M', '8'), + (0x1D7F5, 'M', '9'), + (0x1D7F6, 'M', '0'), + (0x1D7F7, 'M', '1'), + (0x1D7F8, 'M', '2'), + (0x1D7F9, 'M', '3'), + (0x1D7FA, 'M', '4'), + (0x1D7FB, 'M', '5'), + (0x1D7FC, 'M', '6'), + (0x1D7FD, 'M', '7'), + (0x1D7FE, 'M', '8'), + (0x1D7FF, 'M', '9'), + (0x1D800, 'V'), + (0x1DA8C, 'X'), + (0x1DA9B, 'V'), + (0x1DAA0, 'X'), + (0x1DAA1, 'V'), + (0x1DAB0, 'X'), + (0x1DF00, 'V'), + (0x1DF1F, 'X'), + (0x1DF25, 'V'), + (0x1DF2B, 'X'), + (0x1E000, 'V'), + (0x1E007, 'X'), + (0x1E008, 'V'), + (0x1E019, 'X'), + (0x1E01B, 'V'), + (0x1E022, 'X'), + (0x1E023, 'V'), + (0x1E025, 'X'), + (0x1E026, 'V'), + (0x1E02B, 'X'), + (0x1E030, 'M', 'а'), + (0x1E031, 'M', 'б'), + (0x1E032, 'M', 'в'), + ] + +def _seg_71() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E033, 'M', 'г'), + (0x1E034, 'M', 'д'), + (0x1E035, 'M', 'е'), + (0x1E036, 'M', 'ж'), + (0x1E037, 'M', 'з'), + (0x1E038, 'M', 'и'), + (0x1E039, 'M', 'к'), + (0x1E03A, 'M', 'л'), + (0x1E03B, 'M', 'м'), + (0x1E03C, 'M', 'о'), + (0x1E03D, 'M', 'п'), + (0x1E03E, 'M', 'р'), + (0x1E03F, 'M', 'с'), + (0x1E040, 'M', 'т'), + (0x1E041, 'M', 'у'), + (0x1E042, 'M', 'ф'), + (0x1E043, 'M', 'х'), + (0x1E044, 'M', 'ц'), + (0x1E045, 'M', 'ч'), + (0x1E046, 'M', 'ш'), + (0x1E047, 'M', 'ы'), + (0x1E048, 'M', 'э'), + (0x1E049, 'M', 'ю'), + (0x1E04A, 'M', 'ꚉ'), + (0x1E04B, 'M', 'ә'), + (0x1E04C, 'M', 'і'), + (0x1E04D, 'M', 'ј'), + (0x1E04E, 'M', 'ө'), + (0x1E04F, 'M', 'ү'), + (0x1E050, 'M', 'ӏ'), + (0x1E051, 'M', 'а'), + (0x1E052, 'M', 'б'), + (0x1E053, 'M', 'в'), + (0x1E054, 'M', 'г'), + (0x1E055, 'M', 'д'), + (0x1E056, 'M', 'е'), + (0x1E057, 'M', 'ж'), + (0x1E058, 'M', 'з'), + (0x1E059, 'M', 'и'), + (0x1E05A, 'M', 'к'), + (0x1E05B, 'M', 'л'), + (0x1E05C, 'M', 'о'), + (0x1E05D, 'M', 'п'), + (0x1E05E, 'M', 'с'), + (0x1E05F, 'M', 'у'), + (0x1E060, 'M', 'ф'), + (0x1E061, 'M', 'х'), + (0x1E062, 'M', 'ц'), + (0x1E063, 'M', 'ч'), + (0x1E064, 'M', 'ш'), + (0x1E065, 'M', 'ъ'), + (0x1E066, 'M', 'ы'), + (0x1E067, 'M', 'ґ'), + (0x1E068, 'M', 'і'), + (0x1E069, 'M', 'ѕ'), + (0x1E06A, 'M', 'џ'), + (0x1E06B, 'M', 'ҫ'), + (0x1E06C, 'M', 'ꙑ'), + (0x1E06D, 'M', 'ұ'), + (0x1E06E, 'X'), + (0x1E08F, 'V'), + (0x1E090, 'X'), + (0x1E100, 'V'), + (0x1E12D, 'X'), + (0x1E130, 'V'), + (0x1E13E, 'X'), + (0x1E140, 'V'), + (0x1E14A, 'X'), + (0x1E14E, 'V'), + (0x1E150, 'X'), + (0x1E290, 'V'), + (0x1E2AF, 'X'), + (0x1E2C0, 'V'), + (0x1E2FA, 'X'), + (0x1E2FF, 'V'), + (0x1E300, 'X'), + (0x1E4D0, 'V'), + (0x1E4FA, 'X'), + (0x1E7E0, 'V'), + (0x1E7E7, 'X'), + (0x1E7E8, 'V'), + (0x1E7EC, 'X'), + (0x1E7ED, 'V'), + (0x1E7EF, 'X'), + (0x1E7F0, 'V'), + (0x1E7FF, 'X'), + (0x1E800, 'V'), + (0x1E8C5, 'X'), + (0x1E8C7, 'V'), + (0x1E8D7, 'X'), + (0x1E900, 'M', '𞤢'), + (0x1E901, 'M', '𞤣'), + (0x1E902, 'M', '𞤤'), + (0x1E903, 'M', '𞤥'), + (0x1E904, 'M', '𞤦'), + (0x1E905, 'M', '𞤧'), + (0x1E906, 'M', '𞤨'), + (0x1E907, 'M', '𞤩'), + (0x1E908, 'M', '𞤪'), + (0x1E909, 'M', '𞤫'), + ] + +def _seg_72() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E90A, 'M', '𞤬'), + (0x1E90B, 'M', '𞤭'), + (0x1E90C, 'M', '𞤮'), + (0x1E90D, 'M', '𞤯'), + (0x1E90E, 'M', '𞤰'), + (0x1E90F, 'M', '𞤱'), + (0x1E910, 'M', '𞤲'), + (0x1E911, 'M', '𞤳'), + (0x1E912, 'M', '𞤴'), + (0x1E913, 'M', '𞤵'), + (0x1E914, 'M', '𞤶'), + (0x1E915, 'M', '𞤷'), + (0x1E916, 'M', '𞤸'), + (0x1E917, 'M', '𞤹'), + (0x1E918, 'M', '𞤺'), + (0x1E919, 'M', '𞤻'), + (0x1E91A, 'M', '𞤼'), + (0x1E91B, 'M', '𞤽'), + (0x1E91C, 'M', '𞤾'), + (0x1E91D, 'M', '𞤿'), + (0x1E91E, 'M', '𞥀'), + (0x1E91F, 'M', '𞥁'), + (0x1E920, 'M', '𞥂'), + (0x1E921, 'M', '𞥃'), + (0x1E922, 'V'), + (0x1E94C, 'X'), + (0x1E950, 'V'), + (0x1E95A, 'X'), + (0x1E95E, 'V'), + (0x1E960, 'X'), + (0x1EC71, 'V'), + (0x1ECB5, 'X'), + (0x1ED01, 'V'), + (0x1ED3E, 'X'), + (0x1EE00, 'M', 'ا'), + (0x1EE01, 'M', 'ب'), + (0x1EE02, 'M', 'ج'), + (0x1EE03, 'M', 'د'), + (0x1EE04, 'X'), + (0x1EE05, 'M', 'و'), + (0x1EE06, 'M', 'ز'), + (0x1EE07, 'M', 'ح'), + (0x1EE08, 'M', 'ط'), + (0x1EE09, 'M', 'ي'), + (0x1EE0A, 'M', 'ك'), + (0x1EE0B, 'M', 'ل'), + (0x1EE0C, 'M', 'م'), + (0x1EE0D, 'M', 'ن'), + (0x1EE0E, 'M', 'س'), + (0x1EE0F, 'M', 'ع'), + (0x1EE10, 'M', 'ف'), + (0x1EE11, 'M', 'ص'), + (0x1EE12, 'M', 'ق'), + (0x1EE13, 'M', 'ر'), + (0x1EE14, 'M', 'ش'), + (0x1EE15, 'M', 'ت'), + (0x1EE16, 'M', 'ث'), + (0x1EE17, 'M', 'خ'), + (0x1EE18, 'M', 'ذ'), + (0x1EE19, 'M', 'ض'), + (0x1EE1A, 'M', 'ظ'), + (0x1EE1B, 'M', 'غ'), + (0x1EE1C, 'M', 'ٮ'), + (0x1EE1D, 'M', 'ں'), + (0x1EE1E, 'M', 'ڡ'), + (0x1EE1F, 'M', 'ٯ'), + (0x1EE20, 'X'), + (0x1EE21, 'M', 'ب'), + (0x1EE22, 'M', 'ج'), + (0x1EE23, 'X'), + (0x1EE24, 'M', 'ه'), + (0x1EE25, 'X'), + (0x1EE27, 'M', 'ح'), + (0x1EE28, 'X'), + (0x1EE29, 'M', 'ي'), + (0x1EE2A, 'M', 'ك'), + (0x1EE2B, 'M', 'ل'), + (0x1EE2C, 'M', 'م'), + (0x1EE2D, 'M', 'ن'), + (0x1EE2E, 'M', 'س'), + (0x1EE2F, 'M', 'ع'), + (0x1EE30, 'M', 'ف'), + (0x1EE31, 'M', 'ص'), + (0x1EE32, 'M', 'ق'), + (0x1EE33, 'X'), + (0x1EE34, 'M', 'ش'), + (0x1EE35, 'M', 'ت'), + (0x1EE36, 'M', 'ث'), + (0x1EE37, 'M', 'خ'), + (0x1EE38, 'X'), + (0x1EE39, 'M', 'ض'), + (0x1EE3A, 'X'), + (0x1EE3B, 'M', 'غ'), + (0x1EE3C, 'X'), + (0x1EE42, 'M', 'ج'), + (0x1EE43, 'X'), + (0x1EE47, 'M', 'ح'), + (0x1EE48, 'X'), + (0x1EE49, 'M', 'ي'), + (0x1EE4A, 'X'), + ] + +def _seg_73() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1EE4B, 'M', 'ل'), + (0x1EE4C, 'X'), + (0x1EE4D, 'M', 'ن'), + (0x1EE4E, 'M', 'س'), + (0x1EE4F, 'M', 'ع'), + (0x1EE50, 'X'), + (0x1EE51, 'M', 'ص'), + (0x1EE52, 'M', 'ق'), + (0x1EE53, 'X'), + (0x1EE54, 'M', 'ش'), + (0x1EE55, 'X'), + (0x1EE57, 'M', 'خ'), + (0x1EE58, 'X'), + (0x1EE59, 'M', 'ض'), + (0x1EE5A, 'X'), + (0x1EE5B, 'M', 'غ'), + (0x1EE5C, 'X'), + (0x1EE5D, 'M', 'ں'), + (0x1EE5E, 'X'), + (0x1EE5F, 'M', 'ٯ'), + (0x1EE60, 'X'), + (0x1EE61, 'M', 'ب'), + (0x1EE62, 'M', 'ج'), + (0x1EE63, 'X'), + (0x1EE64, 'M', 'ه'), + (0x1EE65, 'X'), + (0x1EE67, 'M', 'ح'), + (0x1EE68, 'M', 'ط'), + (0x1EE69, 'M', 'ي'), + (0x1EE6A, 'M', 'ك'), + (0x1EE6B, 'X'), + (0x1EE6C, 'M', 'م'), + (0x1EE6D, 'M', 'ن'), + (0x1EE6E, 'M', 'س'), + (0x1EE6F, 'M', 'ع'), + (0x1EE70, 'M', 'ف'), + (0x1EE71, 'M', 'ص'), + (0x1EE72, 'M', 'ق'), + (0x1EE73, 'X'), + (0x1EE74, 'M', 'ش'), + (0x1EE75, 'M', 'ت'), + (0x1EE76, 'M', 'ث'), + (0x1EE77, 'M', 'خ'), + (0x1EE78, 'X'), + (0x1EE79, 'M', 'ض'), + (0x1EE7A, 'M', 'ظ'), + (0x1EE7B, 'M', 'غ'), + (0x1EE7C, 'M', 'ٮ'), + (0x1EE7D, 'X'), + (0x1EE7E, 'M', 'ڡ'), + (0x1EE7F, 'X'), + (0x1EE80, 'M', 'ا'), + (0x1EE81, 'M', 'ب'), + (0x1EE82, 'M', 'ج'), + (0x1EE83, 'M', 'د'), + (0x1EE84, 'M', 'ه'), + (0x1EE85, 'M', 'و'), + (0x1EE86, 'M', 'ز'), + (0x1EE87, 'M', 'ح'), + (0x1EE88, 'M', 'ط'), + (0x1EE89, 'M', 'ي'), + (0x1EE8A, 'X'), + (0x1EE8B, 'M', 'ل'), + (0x1EE8C, 'M', 'م'), + (0x1EE8D, 'M', 'ن'), + (0x1EE8E, 'M', 'س'), + (0x1EE8F, 'M', 'ع'), + (0x1EE90, 'M', 'ف'), + (0x1EE91, 'M', 'ص'), + (0x1EE92, 'M', 'ق'), + (0x1EE93, 'M', 'ر'), + (0x1EE94, 'M', 'ش'), + (0x1EE95, 'M', 'ت'), + (0x1EE96, 'M', 'ث'), + (0x1EE97, 'M', 'خ'), + (0x1EE98, 'M', 'ذ'), + (0x1EE99, 'M', 'ض'), + (0x1EE9A, 'M', 'ظ'), + (0x1EE9B, 'M', 'غ'), + (0x1EE9C, 'X'), + (0x1EEA1, 'M', 'ب'), + (0x1EEA2, 'M', 'ج'), + (0x1EEA3, 'M', 'د'), + (0x1EEA4, 'X'), + (0x1EEA5, 'M', 'و'), + (0x1EEA6, 'M', 'ز'), + (0x1EEA7, 'M', 'ح'), + (0x1EEA8, 'M', 'ط'), + (0x1EEA9, 'M', 'ي'), + (0x1EEAA, 'X'), + (0x1EEAB, 'M', 'ل'), + (0x1EEAC, 'M', 'م'), + (0x1EEAD, 'M', 'ن'), + (0x1EEAE, 'M', 'س'), + (0x1EEAF, 'M', 'ع'), + (0x1EEB0, 'M', 'ف'), + (0x1EEB1, 'M', 'ص'), + (0x1EEB2, 'M', 'ق'), + (0x1EEB3, 'M', 'ر'), + (0x1EEB4, 'M', 'ش'), + ] + +def _seg_74() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1EEB5, 'M', 'ت'), + (0x1EEB6, 'M', 'ث'), + (0x1EEB7, 'M', 'خ'), + (0x1EEB8, 'M', 'ذ'), + (0x1EEB9, 'M', 'ض'), + (0x1EEBA, 'M', 'ظ'), + (0x1EEBB, 'M', 'غ'), + (0x1EEBC, 'X'), + (0x1EEF0, 'V'), + (0x1EEF2, 'X'), + (0x1F000, 'V'), + (0x1F02C, 'X'), + (0x1F030, 'V'), + (0x1F094, 'X'), + (0x1F0A0, 'V'), + (0x1F0AF, 'X'), + (0x1F0B1, 'V'), + (0x1F0C0, 'X'), + (0x1F0C1, 'V'), + (0x1F0D0, 'X'), + (0x1F0D1, 'V'), + (0x1F0F6, 'X'), + (0x1F101, '3', '0,'), + (0x1F102, '3', '1,'), + (0x1F103, '3', '2,'), + (0x1F104, '3', '3,'), + (0x1F105, '3', '4,'), + (0x1F106, '3', '5,'), + (0x1F107, '3', '6,'), + (0x1F108, '3', '7,'), + (0x1F109, '3', '8,'), + (0x1F10A, '3', '9,'), + (0x1F10B, 'V'), + (0x1F110, '3', '(a)'), + (0x1F111, '3', '(b)'), + (0x1F112, '3', '(c)'), + (0x1F113, '3', '(d)'), + (0x1F114, '3', '(e)'), + (0x1F115, '3', '(f)'), + (0x1F116, '3', '(g)'), + (0x1F117, '3', '(h)'), + (0x1F118, '3', '(i)'), + (0x1F119, '3', '(j)'), + (0x1F11A, '3', '(k)'), + (0x1F11B, '3', '(l)'), + (0x1F11C, '3', '(m)'), + (0x1F11D, '3', '(n)'), + (0x1F11E, '3', '(o)'), + (0x1F11F, '3', '(p)'), + (0x1F120, '3', '(q)'), + (0x1F121, '3', '(r)'), + (0x1F122, '3', '(s)'), + (0x1F123, '3', '(t)'), + (0x1F124, '3', '(u)'), + (0x1F125, '3', '(v)'), + (0x1F126, '3', '(w)'), + (0x1F127, '3', '(x)'), + (0x1F128, '3', '(y)'), + (0x1F129, '3', '(z)'), + (0x1F12A, 'M', '〔s〕'), + (0x1F12B, 'M', 'c'), + (0x1F12C, 'M', 'r'), + (0x1F12D, 'M', 'cd'), + (0x1F12E, 'M', 'wz'), + (0x1F12F, 'V'), + (0x1F130, 'M', 'a'), + (0x1F131, 'M', 'b'), + (0x1F132, 'M', 'c'), + (0x1F133, 'M', 'd'), + (0x1F134, 'M', 'e'), + (0x1F135, 'M', 'f'), + (0x1F136, 'M', 'g'), + (0x1F137, 'M', 'h'), + (0x1F138, 'M', 'i'), + (0x1F139, 'M', 'j'), + (0x1F13A, 'M', 'k'), + (0x1F13B, 'M', 'l'), + (0x1F13C, 'M', 'm'), + (0x1F13D, 'M', 'n'), + (0x1F13E, 'M', 'o'), + (0x1F13F, 'M', 'p'), + (0x1F140, 'M', 'q'), + (0x1F141, 'M', 'r'), + (0x1F142, 'M', 's'), + (0x1F143, 'M', 't'), + (0x1F144, 'M', 'u'), + (0x1F145, 'M', 'v'), + (0x1F146, 'M', 'w'), + (0x1F147, 'M', 'x'), + (0x1F148, 'M', 'y'), + (0x1F149, 'M', 'z'), + (0x1F14A, 'M', 'hv'), + (0x1F14B, 'M', 'mv'), + (0x1F14C, 'M', 'sd'), + (0x1F14D, 'M', 'ss'), + (0x1F14E, 'M', 'ppv'), + (0x1F14F, 'M', 'wc'), + (0x1F150, 'V'), + (0x1F16A, 'M', 'mc'), + (0x1F16B, 'M', 'md'), + ] + +def _seg_75() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1F16C, 'M', 'mr'), + (0x1F16D, 'V'), + (0x1F190, 'M', 'dj'), + (0x1F191, 'V'), + (0x1F1AE, 'X'), + (0x1F1E6, 'V'), + (0x1F200, 'M', 'ほか'), + (0x1F201, 'M', 'ココ'), + (0x1F202, 'M', 'サ'), + (0x1F203, 'X'), + (0x1F210, 'M', '手'), + (0x1F211, 'M', '字'), + (0x1F212, 'M', '双'), + (0x1F213, 'M', 'デ'), + (0x1F214, 'M', '二'), + (0x1F215, 'M', '多'), + (0x1F216, 'M', '解'), + (0x1F217, 'M', '天'), + (0x1F218, 'M', '交'), + (0x1F219, 'M', '映'), + (0x1F21A, 'M', '無'), + (0x1F21B, 'M', '料'), + (0x1F21C, 'M', '前'), + (0x1F21D, 'M', '後'), + (0x1F21E, 'M', '再'), + (0x1F21F, 'M', '新'), + (0x1F220, 'M', '初'), + (0x1F221, 'M', '終'), + (0x1F222, 'M', '生'), + (0x1F223, 'M', '販'), + (0x1F224, 'M', '声'), + (0x1F225, 'M', '吹'), + (0x1F226, 'M', '演'), + (0x1F227, 'M', '投'), + (0x1F228, 'M', '捕'), + (0x1F229, 'M', '一'), + (0x1F22A, 'M', '三'), + (0x1F22B, 'M', '遊'), + (0x1F22C, 'M', '左'), + (0x1F22D, 'M', '中'), + (0x1F22E, 'M', '右'), + (0x1F22F, 'M', '指'), + (0x1F230, 'M', '走'), + (0x1F231, 'M', '打'), + (0x1F232, 'M', '禁'), + (0x1F233, 'M', '空'), + (0x1F234, 'M', '合'), + (0x1F235, 'M', '満'), + (0x1F236, 'M', '有'), + (0x1F237, 'M', '月'), + (0x1F238, 'M', '申'), + (0x1F239, 'M', '割'), + (0x1F23A, 'M', '営'), + (0x1F23B, 'M', '配'), + (0x1F23C, 'X'), + (0x1F240, 'M', '〔本〕'), + (0x1F241, 'M', '〔三〕'), + (0x1F242, 'M', '〔二〕'), + (0x1F243, 'M', '〔安〕'), + (0x1F244, 'M', '〔点〕'), + (0x1F245, 'M', '〔打〕'), + (0x1F246, 'M', '〔盗〕'), + (0x1F247, 'M', '〔勝〕'), + (0x1F248, 'M', '〔敗〕'), + (0x1F249, 'X'), + (0x1F250, 'M', '得'), + (0x1F251, 'M', '可'), + (0x1F252, 'X'), + (0x1F260, 'V'), + (0x1F266, 'X'), + (0x1F300, 'V'), + (0x1F6D8, 'X'), + (0x1F6DC, 'V'), + (0x1F6ED, 'X'), + (0x1F6F0, 'V'), + (0x1F6FD, 'X'), + (0x1F700, 'V'), + (0x1F777, 'X'), + (0x1F77B, 'V'), + (0x1F7DA, 'X'), + (0x1F7E0, 'V'), + (0x1F7EC, 'X'), + (0x1F7F0, 'V'), + (0x1F7F1, 'X'), + (0x1F800, 'V'), + (0x1F80C, 'X'), + (0x1F810, 'V'), + (0x1F848, 'X'), + (0x1F850, 'V'), + (0x1F85A, 'X'), + (0x1F860, 'V'), + (0x1F888, 'X'), + (0x1F890, 'V'), + (0x1F8AE, 'X'), + (0x1F8B0, 'V'), + (0x1F8B2, 'X'), + (0x1F900, 'V'), + (0x1FA54, 'X'), + (0x1FA60, 'V'), + (0x1FA6E, 'X'), + ] + +def _seg_76() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1FA70, 'V'), + (0x1FA7D, 'X'), + (0x1FA80, 'V'), + (0x1FA89, 'X'), + (0x1FA90, 'V'), + (0x1FABE, 'X'), + (0x1FABF, 'V'), + (0x1FAC6, 'X'), + (0x1FACE, 'V'), + (0x1FADC, 'X'), + (0x1FAE0, 'V'), + (0x1FAE9, 'X'), + (0x1FAF0, 'V'), + (0x1FAF9, 'X'), + (0x1FB00, 'V'), + (0x1FB93, 'X'), + (0x1FB94, 'V'), + (0x1FBCB, 'X'), + (0x1FBF0, 'M', '0'), + (0x1FBF1, 'M', '1'), + (0x1FBF2, 'M', '2'), + (0x1FBF3, 'M', '3'), + (0x1FBF4, 'M', '4'), + (0x1FBF5, 'M', '5'), + (0x1FBF6, 'M', '6'), + (0x1FBF7, 'M', '7'), + (0x1FBF8, 'M', '8'), + (0x1FBF9, 'M', '9'), + (0x1FBFA, 'X'), + (0x20000, 'V'), + (0x2A6E0, 'X'), + (0x2A700, 'V'), + (0x2B73A, 'X'), + (0x2B740, 'V'), + (0x2B81E, 'X'), + (0x2B820, 'V'), + (0x2CEA2, 'X'), + (0x2CEB0, 'V'), + (0x2EBE1, 'X'), + (0x2F800, 'M', '丽'), + (0x2F801, 'M', '丸'), + (0x2F802, 'M', '乁'), + (0x2F803, 'M', '𠄢'), + (0x2F804, 'M', '你'), + (0x2F805, 'M', '侮'), + (0x2F806, 'M', '侻'), + (0x2F807, 'M', '倂'), + (0x2F808, 'M', '偺'), + (0x2F809, 'M', '備'), + (0x2F80A, 'M', '僧'), + (0x2F80B, 'M', '像'), + (0x2F80C, 'M', '㒞'), + (0x2F80D, 'M', '𠘺'), + (0x2F80E, 'M', '免'), + (0x2F80F, 'M', '兔'), + (0x2F810, 'M', '兤'), + (0x2F811, 'M', '具'), + (0x2F812, 'M', '𠔜'), + (0x2F813, 'M', '㒹'), + (0x2F814, 'M', '內'), + (0x2F815, 'M', '再'), + (0x2F816, 'M', '𠕋'), + (0x2F817, 'M', '冗'), + (0x2F818, 'M', '冤'), + (0x2F819, 'M', '仌'), + (0x2F81A, 'M', '冬'), + (0x2F81B, 'M', '况'), + (0x2F81C, 'M', '𩇟'), + (0x2F81D, 'M', '凵'), + (0x2F81E, 'M', '刃'), + (0x2F81F, 'M', '㓟'), + (0x2F820, 'M', '刻'), + (0x2F821, 'M', '剆'), + (0x2F822, 'M', '割'), + (0x2F823, 'M', '剷'), + (0x2F824, 'M', '㔕'), + (0x2F825, 'M', '勇'), + (0x2F826, 'M', '勉'), + (0x2F827, 'M', '勤'), + (0x2F828, 'M', '勺'), + (0x2F829, 'M', '包'), + (0x2F82A, 'M', '匆'), + (0x2F82B, 'M', '北'), + (0x2F82C, 'M', '卉'), + (0x2F82D, 'M', '卑'), + (0x2F82E, 'M', '博'), + (0x2F82F, 'M', '即'), + (0x2F830, 'M', '卽'), + (0x2F831, 'M', '卿'), + (0x2F834, 'M', '𠨬'), + (0x2F835, 'M', '灰'), + (0x2F836, 'M', '及'), + (0x2F837, 'M', '叟'), + (0x2F838, 'M', '𠭣'), + (0x2F839, 'M', '叫'), + (0x2F83A, 'M', '叱'), + (0x2F83B, 'M', '吆'), + (0x2F83C, 'M', '咞'), + (0x2F83D, 'M', '吸'), + (0x2F83E, 'M', '呈'), + ] + +def _seg_77() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F83F, 'M', '周'), + (0x2F840, 'M', '咢'), + (0x2F841, 'M', '哶'), + (0x2F842, 'M', '唐'), + (0x2F843, 'M', '啓'), + (0x2F844, 'M', '啣'), + (0x2F845, 'M', '善'), + (0x2F847, 'M', '喙'), + (0x2F848, 'M', '喫'), + (0x2F849, 'M', '喳'), + (0x2F84A, 'M', '嗂'), + (0x2F84B, 'M', '圖'), + (0x2F84C, 'M', '嘆'), + (0x2F84D, 'M', '圗'), + (0x2F84E, 'M', '噑'), + (0x2F84F, 'M', '噴'), + (0x2F850, 'M', '切'), + (0x2F851, 'M', '壮'), + (0x2F852, 'M', '城'), + (0x2F853, 'M', '埴'), + (0x2F854, 'M', '堍'), + (0x2F855, 'M', '型'), + (0x2F856, 'M', '堲'), + (0x2F857, 'M', '報'), + (0x2F858, 'M', '墬'), + (0x2F859, 'M', '𡓤'), + (0x2F85A, 'M', '売'), + (0x2F85B, 'M', '壷'), + (0x2F85C, 'M', '夆'), + (0x2F85D, 'M', '多'), + (0x2F85E, 'M', '夢'), + (0x2F85F, 'M', '奢'), + (0x2F860, 'M', '𡚨'), + (0x2F861, 'M', '𡛪'), + (0x2F862, 'M', '姬'), + (0x2F863, 'M', '娛'), + (0x2F864, 'M', '娧'), + (0x2F865, 'M', '姘'), + (0x2F866, 'M', '婦'), + (0x2F867, 'M', '㛮'), + (0x2F868, 'X'), + (0x2F869, 'M', '嬈'), + (0x2F86A, 'M', '嬾'), + (0x2F86C, 'M', '𡧈'), + (0x2F86D, 'M', '寃'), + (0x2F86E, 'M', '寘'), + (0x2F86F, 'M', '寧'), + (0x2F870, 'M', '寳'), + (0x2F871, 'M', '𡬘'), + (0x2F872, 'M', '寿'), + (0x2F873, 'M', '将'), + (0x2F874, 'X'), + (0x2F875, 'M', '尢'), + (0x2F876, 'M', '㞁'), + (0x2F877, 'M', '屠'), + (0x2F878, 'M', '屮'), + (0x2F879, 'M', '峀'), + (0x2F87A, 'M', '岍'), + (0x2F87B, 'M', '𡷤'), + (0x2F87C, 'M', '嵃'), + (0x2F87D, 'M', '𡷦'), + (0x2F87E, 'M', '嵮'), + (0x2F87F, 'M', '嵫'), + (0x2F880, 'M', '嵼'), + (0x2F881, 'M', '巡'), + (0x2F882, 'M', '巢'), + (0x2F883, 'M', '㠯'), + (0x2F884, 'M', '巽'), + (0x2F885, 'M', '帨'), + (0x2F886, 'M', '帽'), + (0x2F887, 'M', '幩'), + (0x2F888, 'M', '㡢'), + (0x2F889, 'M', '𢆃'), + (0x2F88A, 'M', '㡼'), + (0x2F88B, 'M', '庰'), + (0x2F88C, 'M', '庳'), + (0x2F88D, 'M', '庶'), + (0x2F88E, 'M', '廊'), + (0x2F88F, 'M', '𪎒'), + (0x2F890, 'M', '廾'), + (0x2F891, 'M', '𢌱'), + (0x2F893, 'M', '舁'), + (0x2F894, 'M', '弢'), + (0x2F896, 'M', '㣇'), + (0x2F897, 'M', '𣊸'), + (0x2F898, 'M', '𦇚'), + (0x2F899, 'M', '形'), + (0x2F89A, 'M', '彫'), + (0x2F89B, 'M', '㣣'), + (0x2F89C, 'M', '徚'), + (0x2F89D, 'M', '忍'), + (0x2F89E, 'M', '志'), + (0x2F89F, 'M', '忹'), + (0x2F8A0, 'M', '悁'), + (0x2F8A1, 'M', '㤺'), + (0x2F8A2, 'M', '㤜'), + (0x2F8A3, 'M', '悔'), + (0x2F8A4, 'M', '𢛔'), + (0x2F8A5, 'M', '惇'), + (0x2F8A6, 'M', '慈'), + ] + +def _seg_78() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F8A7, 'M', '慌'), + (0x2F8A8, 'M', '慎'), + (0x2F8A9, 'M', '慌'), + (0x2F8AA, 'M', '慺'), + (0x2F8AB, 'M', '憎'), + (0x2F8AC, 'M', '憲'), + (0x2F8AD, 'M', '憤'), + (0x2F8AE, 'M', '憯'), + (0x2F8AF, 'M', '懞'), + (0x2F8B0, 'M', '懲'), + (0x2F8B1, 'M', '懶'), + (0x2F8B2, 'M', '成'), + (0x2F8B3, 'M', '戛'), + (0x2F8B4, 'M', '扝'), + (0x2F8B5, 'M', '抱'), + (0x2F8B6, 'M', '拔'), + (0x2F8B7, 'M', '捐'), + (0x2F8B8, 'M', '𢬌'), + (0x2F8B9, 'M', '挽'), + (0x2F8BA, 'M', '拼'), + (0x2F8BB, 'M', '捨'), + (0x2F8BC, 'M', '掃'), + (0x2F8BD, 'M', '揤'), + (0x2F8BE, 'M', '𢯱'), + (0x2F8BF, 'M', '搢'), + (0x2F8C0, 'M', '揅'), + (0x2F8C1, 'M', '掩'), + (0x2F8C2, 'M', '㨮'), + (0x2F8C3, 'M', '摩'), + (0x2F8C4, 'M', '摾'), + (0x2F8C5, 'M', '撝'), + (0x2F8C6, 'M', '摷'), + (0x2F8C7, 'M', '㩬'), + (0x2F8C8, 'M', '敏'), + (0x2F8C9, 'M', '敬'), + (0x2F8CA, 'M', '𣀊'), + (0x2F8CB, 'M', '旣'), + (0x2F8CC, 'M', '書'), + (0x2F8CD, 'M', '晉'), + (0x2F8CE, 'M', '㬙'), + (0x2F8CF, 'M', '暑'), + (0x2F8D0, 'M', '㬈'), + (0x2F8D1, 'M', '㫤'), + (0x2F8D2, 'M', '冒'), + (0x2F8D3, 'M', '冕'), + (0x2F8D4, 'M', '最'), + (0x2F8D5, 'M', '暜'), + (0x2F8D6, 'M', '肭'), + (0x2F8D7, 'M', '䏙'), + (0x2F8D8, 'M', '朗'), + (0x2F8D9, 'M', '望'), + (0x2F8DA, 'M', '朡'), + (0x2F8DB, 'M', '杞'), + (0x2F8DC, 'M', '杓'), + (0x2F8DD, 'M', '𣏃'), + (0x2F8DE, 'M', '㭉'), + (0x2F8DF, 'M', '柺'), + (0x2F8E0, 'M', '枅'), + (0x2F8E1, 'M', '桒'), + (0x2F8E2, 'M', '梅'), + (0x2F8E3, 'M', '𣑭'), + (0x2F8E4, 'M', '梎'), + (0x2F8E5, 'M', '栟'), + (0x2F8E6, 'M', '椔'), + (0x2F8E7, 'M', '㮝'), + (0x2F8E8, 'M', '楂'), + (0x2F8E9, 'M', '榣'), + (0x2F8EA, 'M', '槪'), + (0x2F8EB, 'M', '檨'), + (0x2F8EC, 'M', '𣚣'), + (0x2F8ED, 'M', '櫛'), + (0x2F8EE, 'M', '㰘'), + (0x2F8EF, 'M', '次'), + (0x2F8F0, 'M', '𣢧'), + (0x2F8F1, 'M', '歔'), + (0x2F8F2, 'M', '㱎'), + (0x2F8F3, 'M', '歲'), + (0x2F8F4, 'M', '殟'), + (0x2F8F5, 'M', '殺'), + (0x2F8F6, 'M', '殻'), + (0x2F8F7, 'M', '𣪍'), + (0x2F8F8, 'M', '𡴋'), + (0x2F8F9, 'M', '𣫺'), + (0x2F8FA, 'M', '汎'), + (0x2F8FB, 'M', '𣲼'), + (0x2F8FC, 'M', '沿'), + (0x2F8FD, 'M', '泍'), + (0x2F8FE, 'M', '汧'), + (0x2F8FF, 'M', '洖'), + (0x2F900, 'M', '派'), + (0x2F901, 'M', '海'), + (0x2F902, 'M', '流'), + (0x2F903, 'M', '浩'), + (0x2F904, 'M', '浸'), + (0x2F905, 'M', '涅'), + (0x2F906, 'M', '𣴞'), + (0x2F907, 'M', '洴'), + (0x2F908, 'M', '港'), + (0x2F909, 'M', '湮'), + (0x2F90A, 'M', '㴳'), + ] + +def _seg_79() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F90B, 'M', '滋'), + (0x2F90C, 'M', '滇'), + (0x2F90D, 'M', '𣻑'), + (0x2F90E, 'M', '淹'), + (0x2F90F, 'M', '潮'), + (0x2F910, 'M', '𣽞'), + (0x2F911, 'M', '𣾎'), + (0x2F912, 'M', '濆'), + (0x2F913, 'M', '瀹'), + (0x2F914, 'M', '瀞'), + (0x2F915, 'M', '瀛'), + (0x2F916, 'M', '㶖'), + (0x2F917, 'M', '灊'), + (0x2F918, 'M', '災'), + (0x2F919, 'M', '灷'), + (0x2F91A, 'M', '炭'), + (0x2F91B, 'M', '𠔥'), + (0x2F91C, 'M', '煅'), + (0x2F91D, 'M', '𤉣'), + (0x2F91E, 'M', '熜'), + (0x2F91F, 'X'), + (0x2F920, 'M', '爨'), + (0x2F921, 'M', '爵'), + (0x2F922, 'M', '牐'), + (0x2F923, 'M', '𤘈'), + (0x2F924, 'M', '犀'), + (0x2F925, 'M', '犕'), + (0x2F926, 'M', '𤜵'), + (0x2F927, 'M', '𤠔'), + (0x2F928, 'M', '獺'), + (0x2F929, 'M', '王'), + (0x2F92A, 'M', '㺬'), + (0x2F92B, 'M', '玥'), + (0x2F92C, 'M', '㺸'), + (0x2F92E, 'M', '瑇'), + (0x2F92F, 'M', '瑜'), + (0x2F930, 'M', '瑱'), + (0x2F931, 'M', '璅'), + (0x2F932, 'M', '瓊'), + (0x2F933, 'M', '㼛'), + (0x2F934, 'M', '甤'), + (0x2F935, 'M', '𤰶'), + (0x2F936, 'M', '甾'), + (0x2F937, 'M', '𤲒'), + (0x2F938, 'M', '異'), + (0x2F939, 'M', '𢆟'), + (0x2F93A, 'M', '瘐'), + (0x2F93B, 'M', '𤾡'), + (0x2F93C, 'M', '𤾸'), + (0x2F93D, 'M', '𥁄'), + (0x2F93E, 'M', '㿼'), + (0x2F93F, 'M', '䀈'), + (0x2F940, 'M', '直'), + (0x2F941, 'M', '𥃳'), + (0x2F942, 'M', '𥃲'), + (0x2F943, 'M', '𥄙'), + (0x2F944, 'M', '𥄳'), + (0x2F945, 'M', '眞'), + (0x2F946, 'M', '真'), + (0x2F948, 'M', '睊'), + (0x2F949, 'M', '䀹'), + (0x2F94A, 'M', '瞋'), + (0x2F94B, 'M', '䁆'), + (0x2F94C, 'M', '䂖'), + (0x2F94D, 'M', '𥐝'), + (0x2F94E, 'M', '硎'), + (0x2F94F, 'M', '碌'), + (0x2F950, 'M', '磌'), + (0x2F951, 'M', '䃣'), + (0x2F952, 'M', '𥘦'), + (0x2F953, 'M', '祖'), + (0x2F954, 'M', '𥚚'), + (0x2F955, 'M', '𥛅'), + (0x2F956, 'M', '福'), + (0x2F957, 'M', '秫'), + (0x2F958, 'M', '䄯'), + (0x2F959, 'M', '穀'), + (0x2F95A, 'M', '穊'), + (0x2F95B, 'M', '穏'), + (0x2F95C, 'M', '𥥼'), + (0x2F95D, 'M', '𥪧'), + (0x2F95F, 'X'), + (0x2F960, 'M', '䈂'), + (0x2F961, 'M', '𥮫'), + (0x2F962, 'M', '篆'), + (0x2F963, 'M', '築'), + (0x2F964, 'M', '䈧'), + (0x2F965, 'M', '𥲀'), + (0x2F966, 'M', '糒'), + (0x2F967, 'M', '䊠'), + (0x2F968, 'M', '糨'), + (0x2F969, 'M', '糣'), + (0x2F96A, 'M', '紀'), + (0x2F96B, 'M', '𥾆'), + (0x2F96C, 'M', '絣'), + (0x2F96D, 'M', '䌁'), + (0x2F96E, 'M', '緇'), + (0x2F96F, 'M', '縂'), + (0x2F970, 'M', '繅'), + (0x2F971, 'M', '䌴'), + ] + +def _seg_80() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F972, 'M', '𦈨'), + (0x2F973, 'M', '𦉇'), + (0x2F974, 'M', '䍙'), + (0x2F975, 'M', '𦋙'), + (0x2F976, 'M', '罺'), + (0x2F977, 'M', '𦌾'), + (0x2F978, 'M', '羕'), + (0x2F979, 'M', '翺'), + (0x2F97A, 'M', '者'), + (0x2F97B, 'M', '𦓚'), + (0x2F97C, 'M', '𦔣'), + (0x2F97D, 'M', '聠'), + (0x2F97E, 'M', '𦖨'), + (0x2F97F, 'M', '聰'), + (0x2F980, 'M', '𣍟'), + (0x2F981, 'M', '䏕'), + (0x2F982, 'M', '育'), + (0x2F983, 'M', '脃'), + (0x2F984, 'M', '䐋'), + (0x2F985, 'M', '脾'), + (0x2F986, 'M', '媵'), + (0x2F987, 'M', '𦞧'), + (0x2F988, 'M', '𦞵'), + (0x2F989, 'M', '𣎓'), + (0x2F98A, 'M', '𣎜'), + (0x2F98B, 'M', '舁'), + (0x2F98C, 'M', '舄'), + (0x2F98D, 'M', '辞'), + (0x2F98E, 'M', '䑫'), + (0x2F98F, 'M', '芑'), + (0x2F990, 'M', '芋'), + (0x2F991, 'M', '芝'), + (0x2F992, 'M', '劳'), + (0x2F993, 'M', '花'), + (0x2F994, 'M', '芳'), + (0x2F995, 'M', '芽'), + (0x2F996, 'M', '苦'), + (0x2F997, 'M', '𦬼'), + (0x2F998, 'M', '若'), + (0x2F999, 'M', '茝'), + (0x2F99A, 'M', '荣'), + (0x2F99B, 'M', '莭'), + (0x2F99C, 'M', '茣'), + (0x2F99D, 'M', '莽'), + (0x2F99E, 'M', '菧'), + (0x2F99F, 'M', '著'), + (0x2F9A0, 'M', '荓'), + (0x2F9A1, 'M', '菊'), + (0x2F9A2, 'M', '菌'), + (0x2F9A3, 'M', '菜'), + (0x2F9A4, 'M', '𦰶'), + (0x2F9A5, 'M', '𦵫'), + (0x2F9A6, 'M', '𦳕'), + (0x2F9A7, 'M', '䔫'), + (0x2F9A8, 'M', '蓱'), + (0x2F9A9, 'M', '蓳'), + (0x2F9AA, 'M', '蔖'), + (0x2F9AB, 'M', '𧏊'), + (0x2F9AC, 'M', '蕤'), + (0x2F9AD, 'M', '𦼬'), + (0x2F9AE, 'M', '䕝'), + (0x2F9AF, 'M', '䕡'), + (0x2F9B0, 'M', '𦾱'), + (0x2F9B1, 'M', '𧃒'), + (0x2F9B2, 'M', '䕫'), + (0x2F9B3, 'M', '虐'), + (0x2F9B4, 'M', '虜'), + (0x2F9B5, 'M', '虧'), + (0x2F9B6, 'M', '虩'), + (0x2F9B7, 'M', '蚩'), + (0x2F9B8, 'M', '蚈'), + (0x2F9B9, 'M', '蜎'), + (0x2F9BA, 'M', '蛢'), + (0x2F9BB, 'M', '蝹'), + (0x2F9BC, 'M', '蜨'), + (0x2F9BD, 'M', '蝫'), + (0x2F9BE, 'M', '螆'), + (0x2F9BF, 'X'), + (0x2F9C0, 'M', '蟡'), + (0x2F9C1, 'M', '蠁'), + (0x2F9C2, 'M', '䗹'), + (0x2F9C3, 'M', '衠'), + (0x2F9C4, 'M', '衣'), + (0x2F9C5, 'M', '𧙧'), + (0x2F9C6, 'M', '裗'), + (0x2F9C7, 'M', '裞'), + (0x2F9C8, 'M', '䘵'), + (0x2F9C9, 'M', '裺'), + (0x2F9CA, 'M', '㒻'), + (0x2F9CB, 'M', '𧢮'), + (0x2F9CC, 'M', '𧥦'), + (0x2F9CD, 'M', '䚾'), + (0x2F9CE, 'M', '䛇'), + (0x2F9CF, 'M', '誠'), + (0x2F9D0, 'M', '諭'), + (0x2F9D1, 'M', '變'), + (0x2F9D2, 'M', '豕'), + (0x2F9D3, 'M', '𧲨'), + (0x2F9D4, 'M', '貫'), + (0x2F9D5, 'M', '賁'), + ] + +def _seg_81() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F9D6, 'M', '贛'), + (0x2F9D7, 'M', '起'), + (0x2F9D8, 'M', '𧼯'), + (0x2F9D9, 'M', '𠠄'), + (0x2F9DA, 'M', '跋'), + (0x2F9DB, 'M', '趼'), + (0x2F9DC, 'M', '跰'), + (0x2F9DD, 'M', '𠣞'), + (0x2F9DE, 'M', '軔'), + (0x2F9DF, 'M', '輸'), + (0x2F9E0, 'M', '𨗒'), + (0x2F9E1, 'M', '𨗭'), + (0x2F9E2, 'M', '邔'), + (0x2F9E3, 'M', '郱'), + (0x2F9E4, 'M', '鄑'), + (0x2F9E5, 'M', '𨜮'), + (0x2F9E6, 'M', '鄛'), + (0x2F9E7, 'M', '鈸'), + (0x2F9E8, 'M', '鋗'), + (0x2F9E9, 'M', '鋘'), + (0x2F9EA, 'M', '鉼'), + (0x2F9EB, 'M', '鏹'), + (0x2F9EC, 'M', '鐕'), + (0x2F9ED, 'M', '𨯺'), + (0x2F9EE, 'M', '開'), + (0x2F9EF, 'M', '䦕'), + (0x2F9F0, 'M', '閷'), + (0x2F9F1, 'M', '𨵷'), + (0x2F9F2, 'M', '䧦'), + (0x2F9F3, 'M', '雃'), + (0x2F9F4, 'M', '嶲'), + (0x2F9F5, 'M', '霣'), + (0x2F9F6, 'M', '𩅅'), + (0x2F9F7, 'M', '𩈚'), + (0x2F9F8, 'M', '䩮'), + (0x2F9F9, 'M', '䩶'), + (0x2F9FA, 'M', '韠'), + (0x2F9FB, 'M', '𩐊'), + (0x2F9FC, 'M', '䪲'), + (0x2F9FD, 'M', '𩒖'), + (0x2F9FE, 'M', '頋'), + (0x2FA00, 'M', '頩'), + (0x2FA01, 'M', '𩖶'), + (0x2FA02, 'M', '飢'), + (0x2FA03, 'M', '䬳'), + (0x2FA04, 'M', '餩'), + (0x2FA05, 'M', '馧'), + (0x2FA06, 'M', '駂'), + (0x2FA07, 'M', '駾'), + (0x2FA08, 'M', '䯎'), + (0x2FA09, 'M', '𩬰'), + (0x2FA0A, 'M', '鬒'), + (0x2FA0B, 'M', '鱀'), + (0x2FA0C, 'M', '鳽'), + (0x2FA0D, 'M', '䳎'), + (0x2FA0E, 'M', '䳭'), + (0x2FA0F, 'M', '鵧'), + (0x2FA10, 'M', '𪃎'), + (0x2FA11, 'M', '䳸'), + (0x2FA12, 'M', '𪄅'), + (0x2FA13, 'M', '𪈎'), + (0x2FA14, 'M', '𪊑'), + (0x2FA15, 'M', '麻'), + (0x2FA16, 'M', '䵖'), + (0x2FA17, 'M', '黹'), + (0x2FA18, 'M', '黾'), + (0x2FA19, 'M', '鼅'), + (0x2FA1A, 'M', '鼏'), + (0x2FA1B, 'M', '鼖'), + (0x2FA1C, 'M', '鼻'), + (0x2FA1D, 'M', '𪘀'), + (0x2FA1E, 'X'), + (0x30000, 'V'), + (0x3134B, 'X'), + (0x31350, 'V'), + (0x323B0, 'X'), + (0xE0100, 'I'), + (0xE01F0, 'X'), + ] + +uts46data = tuple( + _seg_0() + + _seg_1() + + _seg_2() + + _seg_3() + + _seg_4() + + _seg_5() + + _seg_6() + + _seg_7() + + _seg_8() + + _seg_9() + + _seg_10() + + _seg_11() + + _seg_12() + + _seg_13() + + _seg_14() + + _seg_15() + + _seg_16() + + _seg_17() + + _seg_18() + + _seg_19() + + _seg_20() + + _seg_21() + + _seg_22() + + _seg_23() + + _seg_24() + + _seg_25() + + _seg_26() + + _seg_27() + + _seg_28() + + _seg_29() + + _seg_30() + + _seg_31() + + _seg_32() + + _seg_33() + + _seg_34() + + _seg_35() + + _seg_36() + + _seg_37() + + _seg_38() + + _seg_39() + + _seg_40() + + _seg_41() + + _seg_42() + + _seg_43() + + _seg_44() + + _seg_45() + + _seg_46() + + _seg_47() + + _seg_48() + + _seg_49() + + _seg_50() + + _seg_51() + + _seg_52() + + _seg_53() + + _seg_54() + + _seg_55() + + _seg_56() + + _seg_57() + + _seg_58() + + _seg_59() + + _seg_60() + + _seg_61() + + _seg_62() + + _seg_63() + + _seg_64() + + _seg_65() + + _seg_66() + + _seg_67() + + _seg_68() + + _seg_69() + + _seg_70() + + _seg_71() + + _seg_72() + + _seg_73() + + _seg_74() + + _seg_75() + + _seg_76() + + _seg_77() + + _seg_78() + + _seg_79() + + _seg_80() + + _seg_81() +) # type: Tuple[Union[Tuple[int, str], Tuple[int, str, str]], ...] diff --git a/billinglayer/python/jwt-1.3.1.dist-info/INSTALLER b/billinglayer/python/jwt-1.3.1.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/jwt-1.3.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/jwt-1.3.1.dist-info/LICENSE b/billinglayer/python/jwt-1.3.1.dist-info/LICENSE new file mode 100644 index 0000000..9cf69c1 --- /dev/null +++ b/billinglayer/python/jwt-1.3.1.dist-info/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017 Gehirn Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/billinglayer/python/jwt-1.3.1.dist-info/METADATA b/billinglayer/python/jwt-1.3.1.dist-info/METADATA new file mode 100644 index 0000000..1d222a8 --- /dev/null +++ b/billinglayer/python/jwt-1.3.1.dist-info/METADATA @@ -0,0 +1,146 @@ +Metadata-Version: 2.1 +Name: jwt +Version: 1.3.1 +Summary: JSON Web Token library for Python 3. +Home-page: https://github.com/GehirnInc/python-jwt +Author: Kohei YOSHIDA +Author-email: kohei.yoshida@gehirn.co.jp +License: UNKNOWN +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Security +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >= 3.6 +Requires-Dist: cryptography (!=3.4.0,>=3.1) + +.. image:: https://travis-ci.org/GehirnInc/python-jwt.svg?branch=master + :target: https://travis-ci.org/GehirnInc/python-jwt +.. image:: https://coveralls.io/repos/GehirnInc/python-jwt/badge.png?branch=master + :target: https://coveralls.io/r/GehirnInc/python-jwt?branch=master +.. image:: https://badge.fury.io/py/jwt.svg?dummy + :target: http://badge.fury.io/py/jwt + +python-jwt +========== + +*python-jwt* is a JSON Web Token (JWT) implementation in Python developed by `Gehirn Inc`_. + + +Examples +-------- + +.. code-block:: python + + import json + from datetime import datetime, timedelta, timezone + + from jwt import ( + JWT, + jwk_from_dict, + jwk_from_pem, + ) + from jwt.utils import get_int_from_datetime + + + instance = JWT() + + message = { + 'iss': 'https://example.com/', + 'sub': 'yosida95', + 'iat': get_int_from_datetime(datetime.now(timezone.utc)), + 'exp': get_int_from_datetime( + datetime.now(timezone.utc) + timedelta(hours=1)), + } + + """ + Encode the message to JWT(JWS). + """ + + # Load a RSA key from a JWK dict. + signing_key = jwk_from_dict({ + 'kty': 'RSA', + 'e': 'AQAB', + 'n': '...', + 'd': '...'}) + # Or load a RSA key from a PEM file. + with open('rsa_private_key.pem', 'rb') as fh: + signing_key = jwk_from_pem(fh.read()) + # You can also load an octet key in the same manner as the RSA. + # signing_key = jwk_from_dict({'kty': 'oct', 'k': '...'}) + + compact_jws = instance.encode(message, signing_key, alg='RS256') + + """ + Decode the JWT with verifying the signature. + """ + + # Load a public key from PEM file corresponding to the signing private key. + with open('rsa_public_key.json', 'r') as fh: + verifying_key = jwk_from_dict(json.load(fh)) + + message_received = instance.decode( + compact_jws, verifying_key, do_time_check=True) + + """ + Successfuly retrieved the `message` from the `compact_jws` + """ + assert message == message_received + + +Installation +------------ + +You can install python-jwt with pip. + +.. code-block:: shell + + $ pip install jwt + + +Implementation Details +------------------------- + +Supported Algorithms +~~~~~~~~~~~~~~~~~~~~ + +- Unsecured + + - none (disabled by default for security) + +- Symmetric + + - HS256 + - HS384 + - HS512 + +- Asymmetric + + - PS256 + - PS384 + - PS512 + - RS256 + - RS384 + - RS512 + +Supported Python Versions +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Python 3.6+ + + +License +------- +python-jwt is licensed under the Apache License version 2. See ./LICENSE.rst. + + +.. _Gehirn Inc: http://www.gehirn.co.jp/ + + diff --git a/billinglayer/python/jwt-1.3.1.dist-info/RECORD b/billinglayer/python/jwt-1.3.1.dist-info/RECORD new file mode 100644 index 0000000..cece7fd --- /dev/null +++ b/billinglayer/python/jwt-1.3.1.dist-info/RECORD @@ -0,0 +1,24 @@ +jwt-1.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +jwt-1.3.1.dist-info/LICENSE,sha256=k8azE68RcLJ3OnQA3SRI1ebXxCDW2EAO_HhROs6xuzE,11341 +jwt-1.3.1.dist-info/METADATA,sha256=Symw7Jt6qIHlxr29twpnSLA-lh9nZHgdcwIxEanHe-M,3439 +jwt-1.3.1.dist-info/RECORD,, +jwt-1.3.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +jwt-1.3.1.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 +jwt-1.3.1.dist-info/top_level.txt,sha256=RP5DHNyJbMq2ka0FmfTgoSaQzh7e3r5XuCWCO8a00k8,4 +jwt/__init__.py,sha256=_fcS7PLAyhWBShVlSGKYcmUNBTcRFDEymTG6ROXahac,1233 +jwt/__pycache__/__init__.cpython-311.pyc,, +jwt/__pycache__/exceptions.cpython-311.pyc,, +jwt/__pycache__/jwa.cpython-311.pyc,, +jwt/__pycache__/jwk.cpython-311.pyc,, +jwt/__pycache__/jwkset.cpython-311.pyc,, +jwt/__pycache__/jws.cpython-311.pyc,, +jwt/__pycache__/jwt.cpython-311.pyc,, +jwt/__pycache__/utils.cpython-311.pyc,, +jwt/exceptions.py,sha256=IbWr8886syf-DdCHKmS6leAN1zHh6Jx9iBhFE4G47VU,1056 +jwt/jwa.py,sha256=0oN1ymjHOqNl6gMpBlPd07-Am2ZCejSf3Btgn4CINdA,6003 +jwt/jwk.py,sha256=P-HBDICpGDyROp8jZGIr5jzFxBkB9NnLaWg1s1SxH30,13549 +jwt/jwkset.py,sha256=fKnzEkf0j6D0qt0z5qTbfl7JV0a9tHqBWc6LmO7CL38,1895 +jwt/jws.py,sha256=_ZcFxpXXPKWtkTI2YTMPoWo8IfKO_WpFmxOYObxyeY8,3445 +jwt/jwt.py,sha256=MuIyOXudmNruv-lXVfYKUOVD2yKVSI3Q9VJ4HxApT6M,4693 +jwt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +jwt/utils.py,sha256=4bwUBehyYzHJwTokeTXmSs_GRh59zmZf1-cPS9sbHgI,2050 diff --git a/billinglayer/python/jwt-1.3.1.dist-info/REQUESTED b/billinglayer/python/jwt-1.3.1.dist-info/REQUESTED new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/jwt-1.3.1.dist-info/WHEEL b/billinglayer/python/jwt-1.3.1.dist-info/WHEEL new file mode 100644 index 0000000..5bad85f --- /dev/null +++ b/billinglayer/python/jwt-1.3.1.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/billinglayer/python/jwt-1.3.1.dist-info/top_level.txt b/billinglayer/python/jwt-1.3.1.dist-info/top_level.txt new file mode 100644 index 0000000..27ccc9b --- /dev/null +++ b/billinglayer/python/jwt-1.3.1.dist-info/top_level.txt @@ -0,0 +1 @@ +jwt diff --git a/billinglayer/python/jwt/__init__.py b/billinglayer/python/jwt/__init__.py new file mode 100644 index 0000000..3ce590c --- /dev/null +++ b/billinglayer/python/jwt/__init__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .jwa import std_hash_by_alg +from .jwk import ( + AbstractJWKBase, + jwk_from_dict, + jwk_from_bytes, + jwk_from_pem, + jwk_from_der, + supported_key_types, +) +from .jwkset import JWKSet +from .jwa import ( + AbstractSigningAlgorithm, + supported_signing_algorithms, +) +from .jwt import JWT + + +__all__ = [ + # .jwa + 'std_hash_by_alg', + # .jwk + 'AbstractJWKBase', + 'jwk_from_bytes', + 'jwk_from_dict', + 'jwk_from_pem', + 'jwk_from_der', + 'supported_key_types', + # .jwkset + 'JWKSet', + # .jws + 'AbstractSigningAlgorithm', + 'supported_signing_algorithms', + # .jwt + 'JWT', +] diff --git a/billinglayer/python/jwt/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..3745ab4 Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/__pycache__/exceptions.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..f10fc6d Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/exceptions.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/__pycache__/jwa.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/jwa.cpython-311.pyc new file mode 100644 index 0000000..647f42f Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/jwa.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/__pycache__/jwk.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/jwk.cpython-311.pyc new file mode 100644 index 0000000..4e4449c Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/jwk.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/__pycache__/jwkset.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/jwkset.cpython-311.pyc new file mode 100644 index 0000000..29b0057 Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/jwkset.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/__pycache__/jws.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/jws.cpython-311.pyc new file mode 100644 index 0000000..b0dca9a Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/jws.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/__pycache__/jwt.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/jwt.cpython-311.pyc new file mode 100644 index 0000000..8ac8ed9 Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/jwt.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/__pycache__/utils.cpython-311.pyc b/billinglayer/python/jwt/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..9b9105d Binary files /dev/null and b/billinglayer/python/jwt/__pycache__/utils.cpython-311.pyc differ diff --git a/billinglayer/python/jwt/exceptions.py b/billinglayer/python/jwt/exceptions.py new file mode 100644 index 0000000..ec4b9e1 --- /dev/null +++ b/billinglayer/python/jwt/exceptions.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +class JWTException(Exception): + """ + common base class for all exceptions used in python-jwt + """ + + +class MalformedJWKError(JWTException): + pass + + +class UnsupportedKeyTypeError(JWTException): + pass + + +class InvalidKeyTypeError(JWTException): + pass + + +class JWSEncodeError(JWTException): + pass + + +class JWSDecodeError(JWTException): + pass + + +class JWTEncodeError(JWTException): + pass + + +class JWTDecodeError(JWTException): + pass diff --git a/billinglayer/python/jwt/jwa.py b/billinglayer/python/jwt/jwa.py new file mode 100644 index 0000000..f5986cd --- /dev/null +++ b/billinglayer/python/jwt/jwa.py @@ -0,0 +1,198 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import hashlib +import hmac +from typing import ( + Any, + Dict, + Callable, + Optional, +) + +from cryptography.hazmat.primitives.asymmetric import padding +from cryptography.hazmat.primitives.hashes import ( + SHA256, + SHA384, + SHA512, +) + +from .exceptions import InvalidKeyTypeError +from .jwk import AbstractJWKBase + + +def std_hash_by_alg(alg: str) -> Callable[[bytes], object]: + if alg.endswith('S256'): + return hashlib.sha256 + if alg.endswith('S384'): + return hashlib.sha384 + if alg.endswith('S512'): + return hashlib.sha512 + raise ValueError('{} is not supported'.format(alg)) + + +class AbstractSigningAlgorithm: + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + raise NotImplementedError() # pragma: no cover + + def verify(self, message: bytes, key: Optional[AbstractJWKBase], + signature: bytes) -> bool: + raise NotImplementedError() # pragma: no cover + + +class NoneAlgorithm(AbstractSigningAlgorithm): + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + return b'' + + def verify(self, message: bytes, key: Optional[AbstractJWKBase], + signature: bytes) -> bool: + return hmac.compare_digest(signature, b'') + + +none = NoneAlgorithm() + + +class HMACAlgorithm(AbstractSigningAlgorithm): + + def __init__(self, hash_fun: Callable[[], object]) -> None: + self.hash_fun = hash_fun + + def _check_key(self, key: Optional[AbstractJWKBase]) -> AbstractJWKBase: + if not key or key.get_kty() != 'oct': + raise InvalidKeyTypeError('Octet key is required') + return key + + def _sign(self, message: bytes, key: bytes) -> bytes: + return hmac.new(key, message, self.hash_fun).digest() + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + key = self._check_key(key) + return key.sign(message, signer=self._sign) + + def verify(self, message: bytes, key: Optional[AbstractJWKBase], + signature: bytes) -> bool: + key = self._check_key(key) + return key.verify(message, signature, signer=self._sign) + + +HS256 = HMACAlgorithm(hashlib.sha256) +HS384 = HMACAlgorithm(hashlib.sha384) +HS512 = HMACAlgorithm(hashlib.sha512) + + +class RSAAlgorithm(AbstractSigningAlgorithm): + + def __init__(self, hash_fun: object) -> None: + self.hash_fun = hash_fun + + def _check_key( + self, + key: Optional[AbstractJWKBase], + must_sign_key: bool = False, + ) -> AbstractJWKBase: + if not key or key.get_kty() != 'RSA': + raise InvalidKeyTypeError('RSA key is required') + if must_sign_key and not key.is_sign_key(): + raise InvalidKeyTypeError( + 'a RSA private key is required, but passed is RSA public key') + return key + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + key = self._check_key(key, must_sign_key=True) + return key.sign(message, hash_fun=self.hash_fun, + padding=padding.PKCS1v15()) + + def verify( + self, + message: bytes, + key: Optional[AbstractJWKBase], + signature: bytes, + ) -> bool: + key = self._check_key(key) + return key.verify(message, signature, hash_fun=self.hash_fun, + padding=padding.PKCS1v15()) + + +RS256 = RSAAlgorithm(SHA256) +RS384 = RSAAlgorithm(SHA384) +RS512 = RSAAlgorithm(SHA512) + + +class PSSRSAAlgorithm(AbstractSigningAlgorithm): + def __init__(self, hash_fun: Callable[[], Any]) -> None: + self.hash_fun = hash_fun + + def _check_key( + self, + key: Optional[AbstractJWKBase], + must_sign_key: bool = False, + ) -> AbstractJWKBase: + if not key or key.get_kty() != 'RSA': + raise InvalidKeyTypeError('RSA key is required') + if must_sign_key and not key.is_sign_key(): + raise InvalidKeyTypeError( + 'a RSA private key is required, but passed is RSA public key') + return key + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + key = self._check_key(key, must_sign_key=True) + return key.sign( + message, + hash_fun=self.hash_fun, + padding=padding.PSS( # type: ignore[no-untyped-call] + mgf=padding.MGF1(self.hash_fun()), + salt_length=self.hash_fun().digest_size, + ), + ) + + def verify( + self, + message: bytes, + key: Optional[AbstractJWKBase], + signature: bytes + ) -> bool: + key = self._check_key(key) + return key.verify( + message, + signature, + hash_fun=self.hash_fun, + padding=padding.PSS( # type: ignore[no-untyped-call] + mgf=padding.MGF1(self.hash_fun()), + salt_length=self.hash_fun().digest_size, + ), + ) + + +PS256 = PSSRSAAlgorithm(SHA256) +PS384 = PSSRSAAlgorithm(SHA384) +PS512 = PSSRSAAlgorithm(SHA512) + + +def supported_signing_algorithms() -> Dict[str, AbstractSigningAlgorithm]: + # NOTE(yosida95): exclude vulnerable 'none' algorithm by default. + return { + 'HS256': HS256, + 'HS384': HS384, + 'HS512': HS512, + 'RS256': RS256, + 'RS384': RS384, + 'RS512': RS512, + 'PS256': PS256, + 'PS384': PS384, + 'PS512': PS512, + } diff --git a/billinglayer/python/jwt/jwk.py b/billinglayer/python/jwt/jwk.py new file mode 100644 index 0000000..e1a4936 --- /dev/null +++ b/billinglayer/python/jwt/jwk.py @@ -0,0 +1,427 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import hmac +from warnings import warn +from abc import ( + ABC, + abstractmethod, +) +from typing import ( + Any, + Callable, + Dict, + Mapping, + Type, + TypeVar, + Union, + Optional +) +from functools import wraps + +import cryptography.hazmat.primitives.serialization as serialization_module +from cryptography.exceptions import InvalidSignature +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives.asymmetric import padding +from cryptography.hazmat.primitives.asymmetric.rsa import ( + rsa_crt_dmp1, + rsa_crt_dmq1, + rsa_crt_iqmp, + rsa_recover_prime_factors, + RSAPrivateKey, + RSAPrivateNumbers, + RSAPublicKey, + RSAPublicNumbers, +) +from cryptography.hazmat.primitives.hashes import HashAlgorithm + +from .exceptions import ( + MalformedJWKError, + UnsupportedKeyTypeError, +) +from .utils import ( + b64encode, + b64decode, + uint_b64encode, + uint_b64decode, +) + +_AJWK = TypeVar("_AJWK", bound="AbstractJWKBase") +_T = TypeVar("_T") + + +class AbstractJWKBase(ABC): + + @abstractmethod + def get_kty(self) -> str: + pass # pragma: no cover + + @abstractmethod + def get_kid(self) -> str: + pass # pragma: no cover + + @abstractmethod + def is_sign_key(self) -> bool: + pass # pragma: no cover + + @abstractmethod + def sign(self, message: bytes, **options) -> bytes: + pass # pragma: no cover + + @abstractmethod + def verify(self, message: bytes, signature: bytes, **options) -> bool: + pass # pragma: no cover + + @abstractmethod + def to_dict(self, public_only: bool = True) -> Dict[str, str]: + pass # pragma: no cover + + @classmethod + @abstractmethod + def from_dict(cls: Type[_AJWK], dct: Dict[str, object]) -> _AJWK: + pass # pragma: no cover + + +class OctetJWK(AbstractJWKBase): + + def __init__(self, key: bytes, kid=None, **options) -> None: + super(AbstractJWKBase, self).__init__() + self.key = key + self.kid = kid + + optnames = {'use', 'key_ops', 'alg', 'x5u', 'x5c', 'x5t', 'x5t#s256'} + self.options = {k: v for k, v in options.items() if k in optnames} + + def get_kty(self): + return 'oct' + + def get_kid(self): + return self.kid + + def is_sign_key(self) -> bool: + return True + + def _get_signer(self, options) -> Callable[[bytes, bytes], bytes]: + return options['signer'] + + def sign(self, message: bytes, **options) -> bytes: + signer = self._get_signer(options) + return signer(message, self.key) + + def verify(self, message: bytes, signature: bytes, **options) -> bool: + signer = self._get_signer(options) + return hmac.compare_digest(signature, signer(message, self.key)) + + def to_dict(self, public_only=True): + dct = { + 'kty': 'oct', + 'k': b64encode(self.key), + } + dct.update(self.options) + if self.kid: + dct['kid'] = self.kid + return dct + + @classmethod + def from_dict(cls, dct): + try: + return cls(b64decode(dct['k']), **dct) + except KeyError as why: + raise MalformedJWKError('k is required') from why + + +class RSAJWK(AbstractJWKBase): + """ + https://tools.ietf.org/html/rfc7518.html#section-6.3.1 + """ + + def __init__(self, keyobj: Union[RSAPrivateKey, RSAPublicKey], + **options) -> None: + super(AbstractJWKBase, self).__init__() + self.keyobj = keyobj + + optnames = {'use', 'key_ops', 'alg', 'kid', + 'x5u', 'x5c', 'x5t', 'x5t#s256', } + self.options = {k: v for k, v in options.items() if k in optnames} + + def is_sign_key(self) -> bool: + return isinstance(self.keyobj, RSAPrivateKey) + + def _get_hash_fun(self, options) -> Callable[[], HashAlgorithm]: + return options['hash_fun'] + + def _get_padding(self, options) -> padding.AsymmetricPadding: + try: + return options['padding'] + except KeyError: + warn('you should not use RSAJWK.verify/sign without jwa ' + 'intermiediary, used legacy padding') + return padding.PKCS1v15() + + def sign(self, message: bytes, **options) -> bytes: + if isinstance(self.keyobj, RSAPublicKey): + raise ValueError("Requires a private key.") + hash_fun = self._get_hash_fun(options) + _padding = self._get_padding(options) + return self.keyobj.sign(message, _padding, hash_fun()) + + def verify(self, message: bytes, signature: bytes, **options) -> bool: + hash_fun = self._get_hash_fun(options) + _padding = self._get_padding(options) + if isinstance(self.keyobj, RSAPrivateKey): + pubkey = self.keyobj.public_key() + else: + pubkey = self.keyobj + try: + pubkey.verify(signature, message, _padding, hash_fun()) + return True + except InvalidSignature: + return False + + def get_kty(self): + return 'RSA' + + def get_kid(self): + return self.options.get('kid') + + def to_dict(self, public_only=True): + dct = { + 'kty': 'RSA', + } + dct.update(self.options) + + if isinstance(self.keyobj, RSAPrivateKey): + priv_numbers = self.keyobj.private_numbers() + pub_numbers = priv_numbers.public_numbers + dct.update({ + 'e': uint_b64encode(pub_numbers.e), + 'n': uint_b64encode(pub_numbers.n), + }) + if not public_only: + dct.update({ + 'e': uint_b64encode(pub_numbers.e), + 'n': uint_b64encode(pub_numbers.n), + 'd': uint_b64encode(priv_numbers.d), + 'p': uint_b64encode(priv_numbers.p), + 'q': uint_b64encode(priv_numbers.q), + 'dp': uint_b64encode(priv_numbers.dmp1), + 'dq': uint_b64encode(priv_numbers.dmq1), + 'qi': uint_b64encode(priv_numbers.iqmp), + }) + return dct + pub_numbers = self.keyobj.public_numbers() + dct.update({ + 'e': uint_b64encode(pub_numbers.e), + 'n': uint_b64encode(pub_numbers.n), + }) + return dct + + @classmethod + def from_dict(cls, dct): + if 'oth' in dct: + raise UnsupportedKeyTypeError( + 'RSA keys with multiples primes are not supported') + + try: + e = uint_b64decode(dct['e']) + n = uint_b64decode(dct['n']) + except KeyError as why: + raise MalformedJWKError('e and n are required') from why + pub_numbers = RSAPublicNumbers(e, n) + if 'd' not in dct: + return cls( + pub_numbers.public_key(backend=default_backend()), **dct) + d = uint_b64decode(dct['d']) + + privparams = {'p', 'q', 'dp', 'dq', 'qi'} + product = set(dct.keys()) & privparams + if len(product) == 0: + p, q = rsa_recover_prime_factors(n, e, d) + priv_numbers = RSAPrivateNumbers( + d=d, + p=p, + q=q, + dmp1=rsa_crt_dmp1(d, p), + dmq1=rsa_crt_dmq1(d, q), + iqmp=rsa_crt_iqmp(p, q), + public_numbers=pub_numbers) + elif product == privparams: + priv_numbers = RSAPrivateNumbers( + d=d, + p=uint_b64decode(dct['p']), + q=uint_b64decode(dct['q']), + dmp1=uint_b64decode(dct['dp']), + dmq1=uint_b64decode(dct['dq']), + iqmp=uint_b64decode(dct['qi']), + public_numbers=pub_numbers) + else: + # If the producer includes any of the other private key parameters, + # then all of the others MUST be present, with the exception of + # "oth", which MUST only be present when more than two prime + # factors were used. + raise MalformedJWKError( + 'p, q, dp, dq, qi MUST be present or' + 'all of them MUST be absent') + return cls(priv_numbers.private_key(backend=default_backend()), **dct) + + +def supported_key_types() -> Dict[str, Type[AbstractJWKBase]]: + return { + 'oct': OctetJWK, + 'RSA': RSAJWK, + } + + +def jwk_from_dict(dct: Mapping[str, Any]) -> AbstractJWKBase: + if not isinstance(dct, dict): # pragma: no cover + raise TypeError('dct must be a dict') + if 'kty' not in dct: + raise MalformedJWKError('kty MUST be present') + + supported = supported_key_types() + kty = dct['kty'] + if kty not in supported: + raise UnsupportedKeyTypeError('unsupported key type: {}'.format(kty)) + return supported[kty].from_dict(dct) + + +PublicKeyLoaderT = Union[str, Callable[[bytes, object], object]] +PrivateKeyLoaderT = Union[ + str, + Callable[[bytes, Optional[str], object], object]] +_Loader = TypeVar("_Loader", PublicKeyLoaderT, PrivateKeyLoaderT) +_C = TypeVar("_C", bound=Callable[..., Any]) + + +# The above LoaderTs should actually not be Union, and this function should be +# typed something like this. But, this will lose any kwargs from the typing +# information. Probably needs: https://github.com/python/mypy/issues/3157 +# (func: Callable[[bytes, _Loader], _T]) +# -> Callable[[bytes, Union[str, _Loader]], _T] +def jwk_from_bytes_argument_conversion(func: _C) -> _C: + if not ('private' in func.__name__ or 'public' in func.__name__): + raise Exception("the wrapped function must have either public" + " or private in it's name") + + @wraps(func) + def wrapper(content, loader, **kwargs): + # now convert it to a Callable if it's a string + if isinstance(loader, str): + loader = getattr(serialization_module, loader) + + if kwargs.get('options') is None: + kwargs['options'] = {} + + return func(content, loader, **kwargs) + return wrapper # type: ignore[return-value] + + +@jwk_from_bytes_argument_conversion +def jwk_from_private_bytes( + content: bytes, + private_loader: PrivateKeyLoaderT, + *, + password: Optional[str] = None, + backend: Optional[object] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + """This function is meant to be called from jwk_from_bytes""" + if options is None: + options = {} + try: + privkey = private_loader(content, password, backend) # type: ignore[operator] # noqa: E501 + if isinstance(privkey, RSAPrivateKey): + return RSAJWK(privkey, **options) + raise UnsupportedKeyTypeError('unsupported key type') + except ValueError as ex: + raise UnsupportedKeyTypeError('this is probably a public key') from ex + + +@jwk_from_bytes_argument_conversion +def jwk_from_public_bytes( + content: bytes, + public_loader: PublicKeyLoaderT, + *, + backend: Optional[object] = None, + options: Optional[Mapping[str, object]] = None +) -> AbstractJWKBase: + """This function is meant to be called from jwk_from_bytes""" + if options is None: + options = {} + try: + pubkey = public_loader(content, backend) # type: ignore[operator] + if isinstance(pubkey, RSAPublicKey): + return RSAJWK(pubkey, **options) + raise UnsupportedKeyTypeError( + 'unsupported key type') # pragma: no cover + except ValueError as why: + raise UnsupportedKeyTypeError('could not deserialize') from why + + +def jwk_from_bytes( + content: bytes, + private_loader: PrivateKeyLoaderT, + public_loader: PublicKeyLoaderT, + *, + private_password: Optional[str] = None, + backend: Optional[object] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + try: + return jwk_from_private_bytes( + content, + private_loader, + password=private_password, + backend=backend, + options=options, + ) + except UnsupportedKeyTypeError: + return jwk_from_public_bytes( + content, + public_loader, + backend=backend, + options=options, + ) + + +def jwk_from_pem( + pem_content: bytes, + private_password: Optional[str] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + return jwk_from_bytes( + pem_content, + private_loader='load_pem_private_key', + public_loader='load_pem_public_key', + private_password=private_password, + backend=None, + options=options, + ) + + +def jwk_from_der( + der_content: bytes, + private_password: Optional[str] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + return jwk_from_bytes( + der_content, + private_loader='load_der_private_key', + public_loader='load_der_public_key', + private_password=private_password, + backend=None, + options=options, + ) diff --git a/billinglayer/python/jwt/jwkset.py b/billinglayer/python/jwt/jwkset.py new file mode 100644 index 0000000..4c7056f --- /dev/null +++ b/billinglayer/python/jwt/jwkset.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from collections import UserList +from typing import TYPE_CHECKING + +from .jwk import AbstractJWKBase, jwk_from_dict + +if TYPE_CHECKING: + UserListBase = UserList[AbstractJWKBase] +else: + UserListBase = UserList + + +class JWKSet(UserListBase): + + def filter_keys(self, kid=None, kty=None): + # When "kid" values are used within a JWK Set, different + # keys within the JWK Set SHOULD use distinct "kid" values. (One + # example in which different keys might use the same "kid" value is if + # they have different "kty" (key type) values but are considered to be + # equivalent alternatives by the application using them.) + + if kid and kty: + return [key for key in self.data + if key.get_kty() == kty and key.get_kid() == kid] + if kid: + return [key for key in self.data if key.get_kid() == kid] + if kty: + return [key for key in self.data if key.get_kty() == kty] + + return self.data.copy() + + def to_dict(self, public_only=True): + keys = [key.to_dict(public_only=public_only) for key in self.data] + return {'keys': keys} + + @classmethod + def from_dict(cls, dct): + keys = [jwk_from_dict(key_dct) for key_dct in dct.get('keys', [])] + return cls(keys) diff --git a/billinglayer/python/jwt/jws.py b/billinglayer/python/jwt/jws.py new file mode 100644 index 0000000..18367b6 --- /dev/null +++ b/billinglayer/python/jwt/jws.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from typing import ( + AbstractSet, + Dict, + Optional, + Tuple, +) + +from .exceptions import ( + JWSEncodeError, + JWSDecodeError, +) +from .jwa import ( + supported_signing_algorithms, + AbstractSigningAlgorithm, +) +from .jwk import AbstractJWKBase +from .utils import ( + b64encode, + b64decode, +) + +__all__ = ['JWS'] + + +class JWS: + + def __init__(self) -> None: + self._supported_algs = supported_signing_algorithms() + + def _retrieve_alg(self, alg: str) -> AbstractSigningAlgorithm: + try: + return self._supported_algs[alg] + except KeyError: + raise JWSDecodeError('Unsupported signing algorithm.') + + def encode(self, message: bytes, key: Optional[AbstractJWKBase] = None, + alg='HS256', + optional_headers: Optional[Dict[str, str]] = None) -> str: + if alg not in self._supported_algs: # pragma: no cover + raise JWSEncodeError('unsupported algorithm: {}'.format(alg)) + alg_impl = self._retrieve_alg(alg) + + header = optional_headers.copy() if optional_headers else {} + header['alg'] = alg + + header_b64 = b64encode( + json.dumps(header, separators=(',', ':')).encode('ascii')) + message_b64 = b64encode(message) + signing_message = header_b64 + '.' + message_b64 + + signature = alg_impl.sign(signing_message.encode('ascii'), key) + signature_b64 = b64encode(signature) + + return signing_message + '.' + signature_b64 + + def _decode_segments( + self, message: str) -> Tuple[Dict[str, str], bytes, bytes, str]: + try: + signing_message, signature_b64 = message.rsplit('.', 1) + header_b64, message_b64 = signing_message.split('.') + except ValueError: + raise JWSDecodeError('malformed JWS payload') + + header = json.loads(b64decode(header_b64).decode('ascii')) + message_bin = b64decode(message_b64) + signature = b64decode(signature_b64) + return header, message_bin, signature, signing_message + + def decode(self, message: str, key: Optional[AbstractJWKBase] = None, + do_verify=True, + algorithms: Optional[AbstractSet[str]] = None) -> bytes: + if algorithms is None: + algorithms = set(supported_signing_algorithms().keys()) + + header, message_bin, signature, signing_message = \ + self._decode_segments(message) + + alg_value = header['alg'] + if alg_value not in algorithms: + raise JWSDecodeError('Unsupported signing algorithm.') + + alg_impl = self._retrieve_alg(alg_value) + if do_verify and not alg_impl.verify( + signing_message.encode('ascii'), key, signature): + raise JWSDecodeError('JWS passed could not be validated') + + return message_bin diff --git a/billinglayer/python/jwt/jwt.py b/billinglayer/python/jwt/jwt.py new file mode 100644 index 0000000..1c15b1a --- /dev/null +++ b/billinglayer/python/jwt/jwt.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from datetime import datetime, timezone +from typing import AbstractSet, Any, Dict, Optional + +from jwt.utils import ( + get_time_from_int, +) +from .exceptions import ( + JWSEncodeError, + JWSDecodeError, + JWTEncodeError, + JWTDecodeError, +) +from .jwk import AbstractJWKBase +from .jws import JWS + + +class JWT: + + def __init__(self): + self._jws = JWS() + + def encode(self, payload: Dict[str, Any], + key: Optional[AbstractJWKBase] = None, alg='HS256', + optional_headers: Optional[Dict[str, str]] = None) -> str: + if not isinstance(self, JWT): # pragma: no cover + # https://github.com/GehirnInc/python-jwt/issues/15 + raise RuntimeError( + 'encode must be called on a jwt.JWT() instance. ' + 'Do jwt.JWT().encode(...)') + if not isinstance(payload, dict): # pragma: no cover + raise TypeError('payload must be a dict') + if not (key is None + or isinstance(key, AbstractJWKBase)): # pragma: no cover + raise TypeError( + 'key must be an instance of a class implements ' + 'jwt.AbstractJWKBase') + if not (optional_headers is None + or isinstance(optional_headers, dict)): # pragma: no cover + raise TypeError('optional_headers must be a dict') + + try: + message = json.dumps(payload).encode('utf-8') + except ValueError as why: + raise JWTEncodeError( + 'payload must be able to be encoded to JSON') from why + + optional_headers = optional_headers and optional_headers.copy() or {} + optional_headers['typ'] = 'JWT' + try: + return self._jws.encode(message, key, alg, optional_headers) + except JWSEncodeError as why: + raise JWTEncodeError('failed to encode to JWT') from why + + def decode(self, message: str, key: Optional[AbstractJWKBase] = None, + do_verify=True, algorithms: Optional[AbstractSet[str]] = None, + do_time_check: bool = True) -> Dict[str, Any]: + if not isinstance(self, JWT): # pragma: no cover + # https://github.com/GehirnInc/python-jwt/issues/15 + raise RuntimeError( + 'decode must be called on a jwt.JWT() instance. ' + 'Do jwt.JWT().decode(...)') + if not isinstance(message, str): # pragma: no cover + raise TypeError('message must be a str') + if not (key is None + or isinstance(key, AbstractJWKBase)): # pragma: no cover + raise TypeError( + 'key must be an instance of a class implements ' + 'jwt.AbstractJWKBase') + + # utc now with timezone + now = datetime.now(timezone.utc) + try: + message_bin = self._jws.decode(message, key, do_verify, algorithms) + except JWSDecodeError as why: + raise JWTDecodeError('failed to decode JWT') from why + try: + payload = json.loads(message_bin.decode('utf-8')) + except ValueError as why: + raise JWTDecodeError( + 'a payload of the JWT is not valid JSON') from why + + # The "exp" (expiration time) claim identifies the expiration time on + # or after which the JWT MUST NOT be accepted for processing. + if 'exp' in payload and do_time_check: + try: + exp = get_time_from_int(payload['exp']) + except TypeError: + raise JWTDecodeError("Invalid Expired value") + if now >= exp: + raise JWTDecodeError("JWT Expired") + + # The "nbf" (not before) claim identifies the time before which the JWT + # MUST NOT be accepted for processing. + if 'nbf' in payload and do_time_check: + try: + nbf = get_time_from_int(payload['nbf']) + except TypeError: + raise JWTDecodeError('Invalid "Not valid yet" value') + if now < nbf: + raise JWTDecodeError("JWT Not valid yet") + + return payload diff --git a/billinglayer/python/jwt/py.typed b/billinglayer/python/jwt/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/jwt/utils.py b/billinglayer/python/jwt/utils.py new file mode 100644 index 0000000..48f139f --- /dev/null +++ b/billinglayer/python/jwt/utils.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from base64 import ( + urlsafe_b64encode, + urlsafe_b64decode, +) +from datetime import datetime, timezone + + +def b64encode(s: bytes) -> str: + s_bin = urlsafe_b64encode(s) + s_bin = s_bin.replace(b'=', b'') + return s_bin.decode('ascii') + + +def b64decode(s: str) -> bytes: + s_bin = s.encode('ascii') + s_bin += b'=' * (4 - len(s_bin) % 4) + return urlsafe_b64decode(s_bin) + + +def uint_b64encode(value: int) -> str: + length = 1 + rem = value >> 8 + while rem: + length += 1 + rem >>= 8 + + uint_bin = value.to_bytes(length, 'big', signed=False) + return b64encode(uint_bin) + + +def uint_b64decode(uint_b64: str) -> int: + uint_bin = b64decode(uint_b64) + + value = 0 + for b in uint_bin: + value <<= 8 + value += int(b) + return value + + +def get_time_from_int(value: int) -> datetime: + """ + :param value: seconds since the Epoch + :return: datetime + """ + if not isinstance(value, int): # pragma: no cover + raise TypeError('an int is required') + return datetime.fromtimestamp(value, timezone.utc) + + +def get_int_from_datetime(value: datetime) -> int: + """ + :param value: datetime with or without timezone, if don't contains timezone + it will managed as it is UTC + :return: Seconds since the Epoch + """ + if not isinstance(value, datetime): # pragma: no cover + raise TypeError('a datetime is required') + return int(value.timestamp()) diff --git a/billinglayer/python/lattice.py b/billinglayer/python/lattice.py new file mode 100644 index 0000000..bc901bd --- /dev/null +++ b/billinglayer/python/lattice.py @@ -0,0 +1,419 @@ +"""Query Meshify for data.""" +import json +import csv +from os import getenv +import getpass +import pickle +from pathlib import Path +import requests +import click + + +MESHIFY_BASE_URL = "https://194.p2121.net/api/" #getenv("MESHIFY_BASE_URL") +MESHIFY_USERNAME = "reportuser@henrypump.com" #getenv("MESHIFY_USERNAME") +MESHIFY_PASSWORD = "Kk8kMU2cc6vqVy" #getenv("MESHIFY_PASSWORD") +MESHIFY_AUTH = None + + +class NameNotFound(Exception): + """Thrown when a name is not found in a list of stuff.""" + + def __init__(self, message, name, list_of_stuff, *args): + """Initialize the NameNotFound Exception.""" + self.message = message + self.name = name + self.list_of_stuff = list_of_stuff + super(NameNotFound, self).__init__(message, name, list_of_stuff, *args) + + +def dict_filter(it, *keys): + """Filter dictionary results.""" + for d in it: + yield dict((k, d[k]) for k in keys) + + +def check_setup(): + """Check the global parameters.""" + global MESHIFY_USERNAME, MESHIFY_PASSWORD, MESHIFY_AUTH, MESHIFY_BASE_URL + if not MESHIFY_USERNAME or not MESHIFY_PASSWORD: + print("Simplify the usage by setting the meshify username and password as environment variables MESHIFY_USERNAME and MESHIFY_PASSWORD") + MESHIFY_USERNAME = input("Meshify Username: ") + MESHIFY_PASSWORD = getpass.getpass("Meshify Password: ") + + MESHIFY_AUTH = requests.auth.HTTPBasicAuth(MESHIFY_USERNAME, MESHIFY_PASSWORD) + + if not MESHIFY_BASE_URL: + print("Simplify the usage by setting the environment variable MESHIFY_BASE_URL") + MESHIFY_BASE_URL = input("Meshify Base URL: ") + + +def find_by_name(name, list_of_stuff): + """Find an object in a list of stuff by its name parameter.""" + for x in list_of_stuff: + if x['name'] == name: + return x + raise NameNotFound("Name not found!", name, list_of_stuff) + + +def GET(endpoint): + """Make a query to the meshify API.""" + check_setup() + if endpoint[0] == "/": + endpoint = endpoint[1:] + q_url = MESHIFY_BASE_URL + endpoint + q_req = requests.get(q_url, auth=MESHIFY_AUTH) + return json.loads(q_req.text) if q_req.status_code == 200 else [] + + +def post_meshify_api(endpoint, data): + """Post data to the meshify API.""" + check_setup() + q_url = MESHIFY_BASE_URL + endpoint + q_req = requests.post(q_url, data=json.dumps(data), auth=MESHIFY_AUTH) + if q_req.status_code != 200: + print(q_req.status_code) + return json.loads(q_req.text) if q_req.status_code == 200 else [] + + +def getNodeTypes(): + return GET("nodetypes") + +def getNodes(): + return GET("nodes") + +def getFolders(): + return GET("folders") + +def getChannelValues(nodeId): + return GET("data/current?nodeId={}".format(nodeId)) + +def getUsers(): + return GET("users") + +def decode_channel_parameters(channel): + """Decode a channel object's parameters into human-readable format.""" + channel_types = { + 1: 'device', + 5: 'static', + 6: 'user input', + 7: 'system' + } + + io_options = { + 0: 'readonly', + 1: 'readwrite' + } + + datatype_options = { + 1: "float", + 2: 'string', + 3: 'integer', + 4: 'boolean', + 5: 'datetime', + 6: 'timespan', + 7: 'file', + 8: 'latlng' + } + + channel['channelType'] = channel_types[channel['channelType']] + channel['io'] = io_options[channel['io']] + channel['dataType'] = datatype_options[channel['dataType']] + return channel + + +def encode_channel_parameters(channel): + """Encode a channel object from human-readable format.""" + channel_types = { + 'device': 1, + 'static': 5, + 'user input': 6, + 'system': 7 + } + + io_options = { + 'readonly': False, + 'readwrite': True + } + + datatype_options = { + "float": 1, + 'string': 2, + 'integer': 3, + 'boolean': 4, + 'datetime': 5, + 'timespan': 6, + 'file': 7, + 'latlng': 8 + } + try: + channel['deviceTypeId'] = int(channel['deviceTypeId']) + channel['fromMe'] = channel['fromMe'].lower() == 'true' + channel['channelType'] = channel_types[channel['channelType'].lower()] + channel['io'] = io_options[channel['io'].lower()] + channel['dataType'] = datatype_options[channel['dataType'].lower()] + # channel['id'] = 1 + return channel + except KeyError as e: + click.echo("Unable to convert channel {} due to bad key: {}".format(channel['name'], e)) + + +def make_modbusmap_channel(i, chan, device_type_name): + """Make a channel object for a row in the CSV.""" + json_obj = { + "ah": "", + "bytary": None, + "al": "", + "vn": chan['subTitle'], # Name + "ct": "number", # ChangeType + "le": "16", # Length(16 or 32) + "grp": str(chan['guaranteedReportPeriod']), # GuaranteedReportPeriod + "la": None, + "chn": chan['name'], # ChannelName + "un": "1", # DeviceNumber + "dn": device_type_name, # deviceName + "vm": None, + "lrt": "0", + "da": "300", # DeviceAddress + "a": chan['helpExplanation'], # TagName + "c": str(chan['change']), # Change + "misc_u": str(chan['units']), # Units + "f": "1", # FunctionCode + "mrt": str(chan['minReportTime']), # MinimumReportTime + "m": "none", # multiplier + "m1ch": "2-{}".format(i), + "mv": "0", # MultiplierValue + "s": "On", + "r": "{}-{}".format(chan['min'], chan['max']), # range + "t": "int" # type + } + return json_obj + + +def combine_modbusmap_and_channel(channel_obj, modbus_map): + """Add the parameters from the modbus map to the channel object.""" + channel_part = modbus_map["1"]["addresses"]["300"] + for c in channel_part: + if channel_part[c]["chn"] == channel_obj['name']: + channel_obj['units'] = channel_part[c]["misc_u"] + try: + min_max_range = channel_part[c]["r"].split("-") + channel_obj['min'] = int(min_max_range[0]) + channel_obj['max'] = int(min_max_range[1]) + except Exception: + channel_obj['min'] = None + channel_obj['max'] = None + + channel_obj['change'] = float(channel_part[c]["c"]) + channel_obj['guaranteedReportPeriod'] = int(channel_part[c]["grp"]) + channel_obj['minReportTime'] = int(channel_part[c]["mrt"]) + return channel_obj + return False + + +@click.group() +def cli(): + """Command Line Interface.""" + pass + + +@click.command() +@click.argument("device_type_name") +@click.option("-o", '--output-file', default=None, help="Where to put the CSV of channels.") +@click.option("-m", '--modbusmap-file', default="modbusMap.p", help="The location of the modbusMap.p file") +def get_channel_csv(device_type_name, output_file, modbusmap_file): + """Query the meshify API and create a CSV of the current channels.""" + channel_fieldnames = [ + 'id', + 'name', + 'deviceTypeId', + 'fromMe', + 'io', + 'subTitle', + 'helpExplanation', + 'channelType', + 'dataType', + 'defaultValue', + 'regex', + 'regexErrMsg', + 'units', + 'min', + 'max', + 'change', + 'guaranteedReportPeriod', + 'minReportTime' + ] + devicetypes = GET('devicetypes') + this_devicetype = find_by_name(device_type_name, devicetypes) + channels = GET('devicetypes/{}/channels'.format(this_devicetype['id'])) + modbus_map = None + + if Path(modbusmap_file).exists(): + with open(modbusmap_file, 'rb') as open_mbs_file: + modbus_map = pickle.load(open_mbs_file) + + if not output_file: + output_file = 'channels_{}.csv'.format(device_type_name) + + with open(output_file, 'w') as csvfile: + writer = csv.DictWriter(csvfile, fieldnames=channel_fieldnames) + + writer.writeheader() + for ch in channels: + if not modbus_map: + ch['units'] = None + ch['min'] = None + ch['max'] = None + ch['change'] = None + ch['guaranteedReportPeriod'] = None + ch['minReportTime'] = None + else: + combined = combine_modbusmap_and_channel(ch, modbus_map) + if combined: + ch = combined + writer.writerow(decode_channel_parameters(ch)) + + click.echo("Wrote channels to {}".format(output_file)) + + +@click.command() +@click.argument("device_type_name") +@click.argument("csv_file") +def post_channel_csv(device_type_name, csv_file): + """Post values from a CSV to Meshify Channel API.""" + devicetypes = GET('devicetypes') + this_devicetype = find_by_name(device_type_name, devicetypes) + + with open(csv_file, 'r') as inp_file: + reader = csv.DictReader(inp_file) + for row in dict_filter(reader, 'name', + 'deviceTypeId', + 'fromMe', + 'io', + 'subTitle', + 'helpExplanation', + 'channelType', + 'dataType', + 'defaultValue', + 'regex', + 'regexErrMsg'): + # print(row) + # print(encode_channel_parameters(row)) + # click.echo(json.dumps(encode_channel_parameters(row), indent=4)) + if post_meshify_api('devicetypes/{}/channels'.format(this_devicetype['id']), encode_channel_parameters(row)): + click.echo("Successfully added channel {}".format(row['name'])) + else: + click.echo("Unable to add channel {}".format(row['name'])) + + +@click.command() +def print_channel_options(): + """Print channel options for use with the csv files.""" + channel_types = ['device', 'static', 'user input', 'system'] + io_options = ['readonly', 'readwrite'] + datatype_options = [ + "float", + 'string', + 'integer', + 'boolean', + 'datetime', + 'timespan', + 'file', + 'latlng' + ] + + click.echo("\n\nchannelType options") + click.echo("===================") + for chan in channel_types: + click.echo(chan) + + click.echo("\n\nio options") + click.echo("==========") + for i in io_options: + click.echo(i) + + click.echo("\n\ndataType options") + click.echo("================") + for d in datatype_options: + click.echo(d) + + +@click.command() +@click.argument("device_type_name") +@click.argument("csv_file") +def create_modbusMap(device_type_name, csv_file): + """Create modbusMap.p from channel csv file.""" + modbusMap = { + "1": { + "c": "ETHERNET/IP", + "b": "192.168.1.10", + "addresses": { + "300": {} + }, + "f": "Off", + "p": "", + "s": "1" + }, + "2": { + "c": "M1-485", + "b": "9600", + "addresses": {}, + "f": "Off", + "p": "None", + "s": "1" + } + } + ind = 1 + with open(csv_file, 'r') as inp_file: + reader = csv.DictReader(inp_file) + for row in reader: + modbusMap["1"]["addresses"]["300"]["2-{}".format(ind)] = make_modbusmap_channel(ind, row, device_type_name) + ind += 1 + with open("modbusMap.p", 'wb') as mod_map_file: + pickle.dump(modbusMap, mod_map_file, protocol=0) + + with open("modbusMap.json", 'w') as json_file: + json.dump(modbusMap, json_file, indent=4) + + +@click.command() +@click.option("-i", "--input-file", default="modbusMap.p", help="The modbus map pickle file to convert.") +@click.option("-o", "--output", default="modbusMap.json", help="The modbus map json file output filename.") +def pickle_to_json(input_file, output): + """Convert a pickle file to a json file.""" + if not Path(input_file).exists(): + click.echo("Pickle file {} does not exist".format(input_file)) + return + + with open(input_file, 'rb') as picklefile: + input_contents = pickle.load(picklefile) + + with open(output, 'w') as outfile: + json.dump(input_contents, outfile, indent=4) + click.echo("Wrote from {} to {}.".format(input_file, output)) + +@click.command() +@click.option("-i", "--input-file", default="modbusMap.json", help="The modbus map json file to convert.") +@click.option("-o", "--output", default="modbusMap.p", help="The modbus map pickle file output filename.") +def json_to_pickle(input_file, output): + """Convert a pickle file to a json file.""" + if not Path(input_file).exists(): + click.echo("JSON file {} does not exist".format(input_file)) + return + + with open(input_file, 'rb') as json_file: + input_contents = json.load(json_file) + + with open(output, 'wb') as outfile: + pickle.dump(input_contents, outfile, protocol=0) + click.echo("Wrote from {} to {}.".format(input_file, output)) + + +cli.add_command(get_channel_csv) +cli.add_command(post_channel_csv) +cli.add_command(print_channel_options) +cli.add_command(create_modbusMap) +cli.add_command(pickle_to_json) +cli.add_command(json_to_pickle) + +if __name__ == '__main__': + cli() diff --git a/billinglayer/python/pycparser-2.21.dist-info/INSTALLER b/billinglayer/python/pycparser-2.21.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/pycparser-2.21.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/pycparser-2.21.dist-info/LICENSE b/billinglayer/python/pycparser-2.21.dist-info/LICENSE new file mode 100644 index 0000000..ea215f2 --- /dev/null +++ b/billinglayer/python/pycparser-2.21.dist-info/LICENSE @@ -0,0 +1,27 @@ +pycparser -- A C parser in Python + +Copyright (c) 2008-2020, Eli Bendersky +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of Eli Bendersky nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/billinglayer/python/pycparser-2.21.dist-info/METADATA b/billinglayer/python/pycparser-2.21.dist-info/METADATA new file mode 100644 index 0000000..1d0fbd6 --- /dev/null +++ b/billinglayer/python/pycparser-2.21.dist-info/METADATA @@ -0,0 +1,31 @@ +Metadata-Version: 2.1 +Name: pycparser +Version: 2.21 +Summary: C parser in Python +Home-page: https://github.com/eliben/pycparser +Author: Eli Bendersky +Author-email: eliben@gmail.com +Maintainer: Eli Bendersky +License: BSD +Platform: Cross Platform +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* + + +pycparser is a complete parser of the C language, written in +pure Python using the PLY parsing library. +It parses C code into an AST and can serve as a front-end for +C compilers or analysis tools. + + diff --git a/billinglayer/python/pycparser-2.21.dist-info/RECORD b/billinglayer/python/pycparser-2.21.dist-info/RECORD new file mode 100644 index 0000000..2049707 --- /dev/null +++ b/billinglayer/python/pycparser-2.21.dist-info/RECORD @@ -0,0 +1,41 @@ +pycparser-2.21.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +pycparser-2.21.dist-info/LICENSE,sha256=Pn3yW437ZYyakVAZMNTZQ7BQh6g0fH4rQyVhavU1BHs,1536 +pycparser-2.21.dist-info/METADATA,sha256=GvTEQA9yKj0nvP4mknfoGpMvjaJXCQjQANcQHrRrAxc,1108 +pycparser-2.21.dist-info/RECORD,, +pycparser-2.21.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110 +pycparser-2.21.dist-info/top_level.txt,sha256=c-lPcS74L_8KoH7IE6PQF5ofyirRQNV4VhkbSFIPeWM,10 +pycparser/__init__.py,sha256=WUEp5D0fuHBH9Q8c1fYvR2eKWfj-CNghLf2MMlQLI1I,2815 +pycparser/__pycache__/__init__.cpython-311.pyc,, +pycparser/__pycache__/_ast_gen.cpython-311.pyc,, +pycparser/__pycache__/_build_tables.cpython-311.pyc,, +pycparser/__pycache__/ast_transforms.cpython-311.pyc,, +pycparser/__pycache__/c_ast.cpython-311.pyc,, +pycparser/__pycache__/c_generator.cpython-311.pyc,, +pycparser/__pycache__/c_lexer.cpython-311.pyc,, +pycparser/__pycache__/c_parser.cpython-311.pyc,, +pycparser/__pycache__/lextab.cpython-311.pyc,, +pycparser/__pycache__/plyparser.cpython-311.pyc,, +pycparser/__pycache__/yacctab.cpython-311.pyc,, +pycparser/_ast_gen.py,sha256=0JRVnDW-Jw-3IjVlo8je9rbAcp6Ko7toHAnB5zi7h0Q,10555 +pycparser/_build_tables.py,sha256=oZCd3Plhq-vkV-QuEsaahcf-jUI6-HgKsrAL9gvFzuU,1039 +pycparser/_c_ast.cfg,sha256=ld5ezE9yzIJFIVAUfw7ezJSlMi4nXKNCzfmqjOyQTNo,4255 +pycparser/ast_transforms.py,sha256=GTMYlUgWmXd5wJVyovXY1qzzAqjxzCpVVg0664dKGBs,5691 +pycparser/c_ast.py,sha256=HWeOrfYdCY0u5XaYhE1i60uVyE3yMWdcxzECUX-DqJw,31445 +pycparser/c_generator.py,sha256=yi6Mcqxv88J5ue8k5-mVGxh3iJ37iD4QyF-sWcGjC-8,17772 +pycparser/c_lexer.py,sha256=xCpjIb6vOUebBJpdifidb08y7XgAsO3T1gNGXJT93-w,17167 +pycparser/c_parser.py,sha256=_8y3i52bL6SUK21KmEEl0qzHxe-0eZRzjZGkWg8gQ4A,73680 +pycparser/lextab.py,sha256=fIxBAHYRC418oKF52M7xb8_KMj3K-tHx0TzZiKwxjPM,8504 +pycparser/ply/__init__.py,sha256=q4s86QwRsYRa20L9ueSxfh-hPihpftBjDOvYa2_SS2Y,102 +pycparser/ply/__pycache__/__init__.cpython-311.pyc,, +pycparser/ply/__pycache__/cpp.cpython-311.pyc,, +pycparser/ply/__pycache__/ctokens.cpython-311.pyc,, +pycparser/ply/__pycache__/lex.cpython-311.pyc,, +pycparser/ply/__pycache__/yacc.cpython-311.pyc,, +pycparser/ply/__pycache__/ygen.cpython-311.pyc,, +pycparser/ply/cpp.py,sha256=UtC3ylTWp5_1MKA-PLCuwKQR8zSOnlGuGGIdzj8xS98,33282 +pycparser/ply/ctokens.py,sha256=MKksnN40TehPhgVfxCJhjj_BjL943apreABKYz-bl0Y,3177 +pycparser/ply/lex.py,sha256=7Qol57x702HZwjA3ZLp-84CUEWq1EehW-N67Wzghi-M,42918 +pycparser/ply/yacc.py,sha256=eatSDkRLgRr6X3-hoDk_SQQv065R0BdL2K7fQ54CgVM,137323 +pycparser/ply/ygen.py,sha256=2JYNeYtrPz1JzLSLO3d4GsS8zJU8jY_I_CR1VI9gWrA,2251 +pycparser/plyparser.py,sha256=8tLOoEytcapvWrr1JfCf7Dog-wulBtS1YrDs8S7JfMo,4875 +pycparser/yacctab.py,sha256=j_fVNIyDWDRVk7eWMqQtlBw2AwUSV5JTrtT58l7zis0,205652 diff --git a/billinglayer/python/pycparser-2.21.dist-info/WHEEL b/billinglayer/python/pycparser-2.21.dist-info/WHEEL new file mode 100644 index 0000000..ef99c6c --- /dev/null +++ b/billinglayer/python/pycparser-2.21.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.34.2) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/billinglayer/python/pycparser-2.21.dist-info/top_level.txt b/billinglayer/python/pycparser-2.21.dist-info/top_level.txt new file mode 100644 index 0000000..dc1c9e1 --- /dev/null +++ b/billinglayer/python/pycparser-2.21.dist-info/top_level.txt @@ -0,0 +1 @@ +pycparser diff --git a/billinglayer/python/pycparser/__init__.py b/billinglayer/python/pycparser/__init__.py new file mode 100644 index 0000000..d82eb2d --- /dev/null +++ b/billinglayer/python/pycparser/__init__.py @@ -0,0 +1,90 @@ +#----------------------------------------------------------------- +# pycparser: __init__.py +# +# This package file exports some convenience functions for +# interacting with pycparser +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- +__all__ = ['c_lexer', 'c_parser', 'c_ast'] +__version__ = '2.21' + +import io +from subprocess import check_output +from .c_parser import CParser + + +def preprocess_file(filename, cpp_path='cpp', cpp_args=''): + """ Preprocess a file using cpp. + + filename: + Name of the file you want to preprocess. + + cpp_path: + cpp_args: + Refer to the documentation of parse_file for the meaning of these + arguments. + + When successful, returns the preprocessed file's contents. + Errors from cpp will be printed out. + """ + path_list = [cpp_path] + if isinstance(cpp_args, list): + path_list += cpp_args + elif cpp_args != '': + path_list += [cpp_args] + path_list += [filename] + + try: + # Note the use of universal_newlines to treat all newlines + # as \n for Python's purpose + text = check_output(path_list, universal_newlines=True) + except OSError as e: + raise RuntimeError("Unable to invoke 'cpp'. " + + 'Make sure its path was passed correctly\n' + + ('Original error: %s' % e)) + + return text + + +def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='', + parser=None): + """ Parse a C file using pycparser. + + filename: + Name of the file you want to parse. + + use_cpp: + Set to True if you want to execute the C pre-processor + on the file prior to parsing it. + + cpp_path: + If use_cpp is True, this is the path to 'cpp' on your + system. If no path is provided, it attempts to just + execute 'cpp', so it must be in your PATH. + + cpp_args: + If use_cpp is True, set this to the command line arguments strings + to cpp. Be careful with quotes - it's best to pass a raw string + (r'') here. For example: + r'-I../utils/fake_libc_include' + If several arguments are required, pass a list of strings. + + parser: + Optional parser object to be used instead of the default CParser + + When successful, an AST is returned. ParseError can be + thrown if the file doesn't parse successfully. + + Errors from cpp will be printed out. + """ + if use_cpp: + text = preprocess_file(filename, cpp_path, cpp_args) + else: + with io.open(filename) as f: + text = f.read() + + if parser is None: + parser = CParser() + return parser.parse(text, filename) diff --git a/billinglayer/python/pycparser/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..cf8e2c8 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/_ast_gen.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/_ast_gen.cpython-311.pyc new file mode 100644 index 0000000..b8849f7 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/_ast_gen.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/_build_tables.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/_build_tables.cpython-311.pyc new file mode 100644 index 0000000..cebb5e6 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/_build_tables.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/ast_transforms.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/ast_transforms.cpython-311.pyc new file mode 100644 index 0000000..aed4851 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/ast_transforms.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/c_ast.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/c_ast.cpython-311.pyc new file mode 100644 index 0000000..c8878db Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/c_ast.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/c_generator.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/c_generator.cpython-311.pyc new file mode 100644 index 0000000..9df5995 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/c_generator.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/c_lexer.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/c_lexer.cpython-311.pyc new file mode 100644 index 0000000..4b107a9 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/c_lexer.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/c_parser.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/c_parser.cpython-311.pyc new file mode 100644 index 0000000..b3ddea3 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/c_parser.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/lextab.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/lextab.cpython-311.pyc new file mode 100644 index 0000000..c67e313 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/lextab.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/plyparser.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/plyparser.cpython-311.pyc new file mode 100644 index 0000000..d3bba7f Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/plyparser.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/__pycache__/yacctab.cpython-311.pyc b/billinglayer/python/pycparser/__pycache__/yacctab.cpython-311.pyc new file mode 100644 index 0000000..42a0f32 Binary files /dev/null and b/billinglayer/python/pycparser/__pycache__/yacctab.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/_ast_gen.py b/billinglayer/python/pycparser/_ast_gen.py new file mode 100644 index 0000000..0f7d330 --- /dev/null +++ b/billinglayer/python/pycparser/_ast_gen.py @@ -0,0 +1,336 @@ +#----------------------------------------------------------------- +# _ast_gen.py +# +# Generates the AST Node classes from a specification given in +# a configuration file +# +# The design of this module was inspired by astgen.py from the +# Python 2.5 code-base. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- +from string import Template + + +class ASTCodeGenerator(object): + def __init__(self, cfg_filename='_c_ast.cfg'): + """ Initialize the code generator from a configuration + file. + """ + self.cfg_filename = cfg_filename + self.node_cfg = [NodeCfg(name, contents) + for (name, contents) in self.parse_cfgfile(cfg_filename)] + + def generate(self, file=None): + """ Generates the code into file, an open file buffer. + """ + src = Template(_PROLOGUE_COMMENT).substitute( + cfg_filename=self.cfg_filename) + + src += _PROLOGUE_CODE + for node_cfg in self.node_cfg: + src += node_cfg.generate_source() + '\n\n' + + file.write(src) + + def parse_cfgfile(self, filename): + """ Parse the configuration file and yield pairs of + (name, contents) for each node. + """ + with open(filename, "r") as f: + for line in f: + line = line.strip() + if not line or line.startswith('#'): + continue + colon_i = line.find(':') + lbracket_i = line.find('[') + rbracket_i = line.find(']') + if colon_i < 1 or lbracket_i <= colon_i or rbracket_i <= lbracket_i: + raise RuntimeError("Invalid line in %s:\n%s\n" % (filename, line)) + + name = line[:colon_i] + val = line[lbracket_i + 1:rbracket_i] + vallist = [v.strip() for v in val.split(',')] if val else [] + yield name, vallist + + +class NodeCfg(object): + """ Node configuration. + + name: node name + contents: a list of contents - attributes and child nodes + See comment at the top of the configuration file for details. + """ + + def __init__(self, name, contents): + self.name = name + self.all_entries = [] + self.attr = [] + self.child = [] + self.seq_child = [] + + for entry in contents: + clean_entry = entry.rstrip('*') + self.all_entries.append(clean_entry) + + if entry.endswith('**'): + self.seq_child.append(clean_entry) + elif entry.endswith('*'): + self.child.append(clean_entry) + else: + self.attr.append(entry) + + def generate_source(self): + src = self._gen_init() + src += '\n' + self._gen_children() + src += '\n' + self._gen_iter() + src += '\n' + self._gen_attr_names() + return src + + def _gen_init(self): + src = "class %s(Node):\n" % self.name + + if self.all_entries: + args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" + arglist = '(self, %s, coord=None)' % args + else: + slots = "'coord', '__weakref__'" + arglist = '(self, coord=None)' + + src += " __slots__ = (%s)\n" % slots + src += " def __init__%s:\n" % arglist + + for name in self.all_entries + ['coord']: + src += " self.%s = %s\n" % (name, name) + + return src + + def _gen_children(self): + src = ' def children(self):\n' + + if self.all_entries: + src += ' nodelist = []\n' + + for child in self.child: + src += ( + ' if self.%(child)s is not None:' + + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( + dict(child=child)) + + for seq_child in self.seq_child: + src += ( + ' for i, child in enumerate(self.%(child)s or []):\n' + ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( + dict(child=seq_child)) + + src += ' return tuple(nodelist)\n' + else: + src += ' return ()\n' + + return src + + def _gen_iter(self): + src = ' def __iter__(self):\n' + + if self.all_entries: + for child in self.child: + src += ( + ' if self.%(child)s is not None:\n' + + ' yield self.%(child)s\n') % (dict(child=child)) + + for seq_child in self.seq_child: + src += ( + ' for child in (self.%(child)s or []):\n' + ' yield child\n') % (dict(child=seq_child)) + + if not (self.child or self.seq_child): + # Empty generator + src += ( + ' return\n' + + ' yield\n') + else: + # Empty generator + src += ( + ' return\n' + + ' yield\n') + + return src + + def _gen_attr_names(self): + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' + return src + + +_PROLOGUE_COMMENT = \ +r'''#----------------------------------------------------------------- +# ** ATTENTION ** +# This code was automatically generated from the file: +# $cfg_filename +# +# Do not modify it directly. Modify the configuration file and +# run the generator again. +# ** ** *** ** ** +# +# pycparser: c_ast.py +# +# AST Node classes. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +''' + +_PROLOGUE_CODE = r''' +import sys + +def _repr(obj): + """ + Get the representation of an object, with dedicated pprint-like format for lists. + """ + if isinstance(obj, list): + return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]' + else: + return repr(obj) + +class Node(object): + __slots__ = () + """ Abstract base class for AST nodes. + """ + def __repr__(self): + """ Generates a python representation of the current node + """ + result = self.__class__.__name__ + '(' + + indent = '' + separator = '' + for name in self.__slots__[:-2]: + result += separator + result += indent + result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__))))) + + separator = ',' + indent = '\n ' + (' ' * len(self.__class__.__name__)) + + result += indent + ')' + + return result + + def children(self): + """ A sequence of all children that are Nodes + """ + pass + + def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): + """ Pretty print the Node and all its attributes and + children (recursively) to a buffer. + + buf: + Open IO buffer into which the Node is printed. + + offset: + Initial offset (amount of leading spaces) + + attrnames: + True if you want to see the attribute names in + name=value pairs. False to only see the values. + + nodenames: + True if you want to see the actual node names + within their parents. + + showcoord: + Do you want the coordinates of each Node to be + displayed. + """ + lead = ' ' * offset + if nodenames and _my_node_name is not None: + buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ') + else: + buf.write(lead + self.__class__.__name__+ ': ') + + if self.attr_names: + if attrnames: + nvlist = [(n, getattr(self,n)) for n in self.attr_names] + attrstr = ', '.join('%s=%s' % nv for nv in nvlist) + else: + vlist = [getattr(self, n) for n in self.attr_names] + attrstr = ', '.join('%s' % v for v in vlist) + buf.write(attrstr) + + if showcoord: + buf.write(' (at %s)' % self.coord) + buf.write('\n') + + for (child_name, child) in self.children(): + child.show( + buf, + offset=offset + 2, + attrnames=attrnames, + nodenames=nodenames, + showcoord=showcoord, + _my_node_name=child_name) + + +class NodeVisitor(object): + """ A base NodeVisitor class for visiting c_ast nodes. + Subclass it and define your own visit_XXX methods, where + XXX is the class name you want to visit with these + methods. + + For example: + + class ConstantVisitor(NodeVisitor): + def __init__(self): + self.values = [] + + def visit_Constant(self, node): + self.values.append(node.value) + + Creates a list of values of all the constant nodes + encountered below the given node. To use it: + + cv = ConstantVisitor() + cv.visit(node) + + Notes: + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was + defined will not be visited - if you need this, call + generic_visit() on the node. + You can use: + NodeVisitor.generic_visit(self, node) + * Modeled after Python's own AST visiting facilities + (the ast module of Python 3.0) + """ + + _method_cache = None + + def visit(self, node): + """ Visit a node. + """ + + if self._method_cache is None: + self._method_cache = {} + + visitor = self._method_cache.get(node.__class__.__name__, None) + if visitor is None: + method = 'visit_' + node.__class__.__name__ + visitor = getattr(self, method, self.generic_visit) + self._method_cache[node.__class__.__name__] = visitor + + return visitor(node) + + def generic_visit(self, node): + """ Called if no explicit visitor function exists for a + node. Implements preorder visiting of the node. + """ + for c in node: + self.visit(c) + +''' diff --git a/billinglayer/python/pycparser/_build_tables.py b/billinglayer/python/pycparser/_build_tables.py new file mode 100644 index 0000000..958381a --- /dev/null +++ b/billinglayer/python/pycparser/_build_tables.py @@ -0,0 +1,37 @@ +#----------------------------------------------------------------- +# pycparser: _build_tables.py +# +# A dummy for generating the lexing/parsing tables and and +# compiling them into .pyc for faster execution in optimized mode. +# Also generates AST code from the configuration file. +# Should be called from the pycparser directory. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +# Insert '.' and '..' as first entries to the search path for modules. +# Restricted environments like embeddable python do not include the +# current working directory on startup. +import sys +sys.path[0:0] = ['.', '..'] + +# Generate c_ast.py +from _ast_gen import ASTCodeGenerator +ast_gen = ASTCodeGenerator('_c_ast.cfg') +ast_gen.generate(open('c_ast.py', 'w')) + +from pycparser import c_parser + +# Generates the tables +# +c_parser.CParser( + lex_optimize=True, + yacc_debug=False, + yacc_optimize=True) + +# Load to compile into .pyc +# +import lextab +import yacctab +import c_ast diff --git a/billinglayer/python/pycparser/_c_ast.cfg b/billinglayer/python/pycparser/_c_ast.cfg new file mode 100644 index 0000000..0626533 --- /dev/null +++ b/billinglayer/python/pycparser/_c_ast.cfg @@ -0,0 +1,195 @@ +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +Alignas: [alignment*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, string, etc. +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, align, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +StaticAssert: [cond*, message*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, align, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, align, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] + +Pragma: [string] diff --git a/billinglayer/python/pycparser/ast_transforms.py b/billinglayer/python/pycparser/ast_transforms.py new file mode 100644 index 0000000..367dcf5 --- /dev/null +++ b/billinglayer/python/pycparser/ast_transforms.py @@ -0,0 +1,164 @@ +#------------------------------------------------------------------------------ +# pycparser: ast_transforms.py +# +# Some utilities used by the parser to create a friendlier AST. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ + +from . import c_ast + + +def fix_switch_cases(switch_node): + """ The 'case' statements in a 'switch' come out of parsing with one + child node, so subsequent statements are just tucked to the parent + Compound. Additionally, consecutive (fall-through) case statements + come out messy. This is a peculiarity of the C grammar. The following: + + switch (myvar) { + case 10: + k = 10; + p = k + 1; + return 10; + case 20: + case 30: + return 20; + default: + break; + } + + Creates this tree (pseudo-dump): + + Switch + ID: myvar + Compound: + Case 10: + k = 10 + p = k + 1 + return 10 + Case 20: + Case 30: + return 20 + Default: + break + + The goal of this transform is to fix this mess, turning it into the + following: + + Switch + ID: myvar + Compound: + Case 10: + k = 10 + p = k + 1 + return 10 + Case 20: + Case 30: + return 20 + Default: + break + + A fixed AST node is returned. The argument may be modified. + """ + assert isinstance(switch_node, c_ast.Switch) + if not isinstance(switch_node.stmt, c_ast.Compound): + return switch_node + + # The new Compound child for the Switch, which will collect children in the + # correct order + new_compound = c_ast.Compound([], switch_node.stmt.coord) + + # The last Case/Default node + last_case = None + + # Goes over the children of the Compound below the Switch, adding them + # either directly below new_compound or below the last Case as appropriate + # (for `switch(cond) {}`, block_items would have been None) + for child in (switch_node.stmt.block_items or []): + if isinstance(child, (c_ast.Case, c_ast.Default)): + # If it's a Case/Default: + # 1. Add it to the Compound and mark as "last case" + # 2. If its immediate child is also a Case or Default, promote it + # to a sibling. + new_compound.block_items.append(child) + _extract_nested_case(child, new_compound.block_items) + last_case = new_compound.block_items[-1] + else: + # Other statements are added as children to the last case, if it + # exists. + if last_case is None: + new_compound.block_items.append(child) + else: + last_case.stmts.append(child) + + switch_node.stmt = new_compound + return switch_node + + +def _extract_nested_case(case_node, stmts_list): + """ Recursively extract consecutive Case statements that are made nested + by the parser and add them to the stmts_list. + """ + if isinstance(case_node.stmts[0], (c_ast.Case, c_ast.Default)): + stmts_list.append(case_node.stmts.pop()) + _extract_nested_case(stmts_list[-1], stmts_list) + + +def fix_atomic_specifiers(decl): + """ Atomic specifiers like _Atomic(type) are unusually structured, + conferring a qualifier upon the contained type. + + This function fixes a decl with atomic specifiers to have a sane AST + structure, by removing spurious Typename->TypeDecl pairs and attaching + the _Atomic qualifier in the right place. + """ + # There can be multiple levels of _Atomic in a decl; fix them until a + # fixed point is reached. + while True: + decl, found = _fix_atomic_specifiers_once(decl) + if not found: + break + + # Make sure to add an _Atomic qual on the topmost decl if needed. Also + # restore the declname on the innermost TypeDecl (it gets placed in the + # wrong place during construction). + typ = decl + while not isinstance(typ, c_ast.TypeDecl): + try: + typ = typ.type + except AttributeError: + return decl + if '_Atomic' in typ.quals and '_Atomic' not in decl.quals: + decl.quals.append('_Atomic') + if typ.declname is None: + typ.declname = decl.name + + return decl + + +def _fix_atomic_specifiers_once(decl): + """ Performs one 'fix' round of atomic specifiers. + Returns (modified_decl, found) where found is True iff a fix was made. + """ + parent = decl + grandparent = None + node = decl.type + while node is not None: + if isinstance(node, c_ast.Typename) and '_Atomic' in node.quals: + break + try: + grandparent = parent + parent = node + node = node.type + except AttributeError: + # If we've reached a node without a `type` field, it means we won't + # find what we're looking for at this point; give up the search + # and return the original decl unmodified. + return decl, False + + assert isinstance(parent, c_ast.TypeDecl) + grandparent.type = node.type + if '_Atomic' not in node.type.quals: + node.type.quals.append('_Atomic') + return decl, True diff --git a/billinglayer/python/pycparser/c_ast.py b/billinglayer/python/pycparser/c_ast.py new file mode 100644 index 0000000..6575a2a --- /dev/null +++ b/billinglayer/python/pycparser/c_ast.py @@ -0,0 +1,1125 @@ +#----------------------------------------------------------------- +# ** ATTENTION ** +# This code was automatically generated from the file: +# _c_ast.cfg +# +# Do not modify it directly. Modify the configuration file and +# run the generator again. +# ** ** *** ** ** +# +# pycparser: c_ast.py +# +# AST Node classes. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + + +import sys + +def _repr(obj): + """ + Get the representation of an object, with dedicated pprint-like format for lists. + """ + if isinstance(obj, list): + return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]' + else: + return repr(obj) + +class Node(object): + __slots__ = () + """ Abstract base class for AST nodes. + """ + def __repr__(self): + """ Generates a python representation of the current node + """ + result = self.__class__.__name__ + '(' + + indent = '' + separator = '' + for name in self.__slots__[:-2]: + result += separator + result += indent + result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__))))) + + separator = ',' + indent = '\n ' + (' ' * len(self.__class__.__name__)) + + result += indent + ')' + + return result + + def children(self): + """ A sequence of all children that are Nodes + """ + pass + + def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): + """ Pretty print the Node and all its attributes and + children (recursively) to a buffer. + + buf: + Open IO buffer into which the Node is printed. + + offset: + Initial offset (amount of leading spaces) + + attrnames: + True if you want to see the attribute names in + name=value pairs. False to only see the values. + + nodenames: + True if you want to see the actual node names + within their parents. + + showcoord: + Do you want the coordinates of each Node to be + displayed. + """ + lead = ' ' * offset + if nodenames and _my_node_name is not None: + buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ') + else: + buf.write(lead + self.__class__.__name__+ ': ') + + if self.attr_names: + if attrnames: + nvlist = [(n, getattr(self,n)) for n in self.attr_names] + attrstr = ', '.join('%s=%s' % nv for nv in nvlist) + else: + vlist = [getattr(self, n) for n in self.attr_names] + attrstr = ', '.join('%s' % v for v in vlist) + buf.write(attrstr) + + if showcoord: + buf.write(' (at %s)' % self.coord) + buf.write('\n') + + for (child_name, child) in self.children(): + child.show( + buf, + offset=offset + 2, + attrnames=attrnames, + nodenames=nodenames, + showcoord=showcoord, + _my_node_name=child_name) + + +class NodeVisitor(object): + """ A base NodeVisitor class for visiting c_ast nodes. + Subclass it and define your own visit_XXX methods, where + XXX is the class name you want to visit with these + methods. + + For example: + + class ConstantVisitor(NodeVisitor): + def __init__(self): + self.values = [] + + def visit_Constant(self, node): + self.values.append(node.value) + + Creates a list of values of all the constant nodes + encountered below the given node. To use it: + + cv = ConstantVisitor() + cv.visit(node) + + Notes: + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was + defined will not be visited - if you need this, call + generic_visit() on the node. + You can use: + NodeVisitor.generic_visit(self, node) + * Modeled after Python's own AST visiting facilities + (the ast module of Python 3.0) + """ + + _method_cache = None + + def visit(self, node): + """ Visit a node. + """ + + if self._method_cache is None: + self._method_cache = {} + + visitor = self._method_cache.get(node.__class__.__name__, None) + if visitor is None: + method = 'visit_' + node.__class__.__name__ + visitor = getattr(self, method, self.generic_visit) + self._method_cache[node.__class__.__name__] = visitor + + return visitor(node) + + def generic_visit(self, node): + """ Called if no explicit visitor function exists for a + node. Implements preorder visiting of the node. + """ + for c in node: + self.visit(c) + +class ArrayDecl(Node): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): + self.type = type + self.dim = dim + self.dim_quals = dim_quals + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + if self.dim is not None: nodelist.append(("dim", self.dim)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + if self.dim is not None: + yield self.dim + + attr_names = ('dim_quals', ) + +class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') + def __init__(self, name, subscript, coord=None): + self.name = name + self.subscript = subscript + self.coord = coord + + def children(self): + nodelist = [] + if self.name is not None: nodelist.append(("name", self.name)) + if self.subscript is not None: nodelist.append(("subscript", self.subscript)) + return tuple(nodelist) + + def __iter__(self): + if self.name is not None: + yield self.name + if self.subscript is not None: + yield self.subscript + + attr_names = () + +class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') + def __init__(self, op, lvalue, rvalue, coord=None): + self.op = op + self.lvalue = lvalue + self.rvalue = rvalue + self.coord = coord + + def children(self): + nodelist = [] + if self.lvalue is not None: nodelist.append(("lvalue", self.lvalue)) + if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) + return tuple(nodelist) + + def __iter__(self): + if self.lvalue is not None: + yield self.lvalue + if self.rvalue is not None: + yield self.rvalue + + attr_names = ('op', ) + +class Alignas(Node): + __slots__ = ('alignment', 'coord', '__weakref__') + def __init__(self, alignment, coord=None): + self.alignment = alignment + self.coord = coord + + def children(self): + nodelist = [] + if self.alignment is not None: nodelist.append(("alignment", self.alignment)) + return tuple(nodelist) + + def __iter__(self): + if self.alignment is not None: + yield self.alignment + + attr_names = () + +class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') + def __init__(self, op, left, right, coord=None): + self.op = op + self.left = left + self.right = right + self.coord = coord + + def children(self): + nodelist = [] + if self.left is not None: nodelist.append(("left", self.left)) + if self.right is not None: nodelist.append(("right", self.right)) + return tuple(nodelist) + + def __iter__(self): + if self.left is not None: + yield self.left + if self.right is not None: + yield self.right + + attr_names = ('op', ) + +class Break(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') + def __init__(self, expr, stmts, coord=None): + self.expr = expr + self.stmts = stmts + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + for i, child in enumerate(self.stmts or []): + nodelist.append(("stmts[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + for child in (self.stmts or []): + yield child + + attr_names = () + +class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') + def __init__(self, to_type, expr, coord=None): + self.to_type = to_type + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.to_type is not None: nodelist.append(("to_type", self.to_type)) + if self.expr is not None: nodelist.append(("expr", self.expr)) + return tuple(nodelist) + + def __iter__(self): + if self.to_type is not None: + yield self.to_type + if self.expr is not None: + yield self.expr + + attr_names = () + +class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') + def __init__(self, block_items, coord=None): + self.block_items = block_items + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.block_items or []): + nodelist.append(("block_items[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.block_items or []): + yield child + + attr_names = () + +class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') + def __init__(self, type, init, coord=None): + self.type = type + self.init = init + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + if self.init is not None: nodelist.append(("init", self.init)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + if self.init is not None: + yield self.init + + attr_names = () + +class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') + def __init__(self, type, value, coord=None): + self.type = type + self.value = value + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('type', 'value', ) + +class Continue(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class Decl(Node): + __slots__ = ('name', 'quals', 'align', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') + def __init__(self, name, quals, align, storage, funcspec, type, init, bitsize, coord=None): + self.name = name + self.quals = quals + self.align = align + self.storage = storage + self.funcspec = funcspec + self.type = type + self.init = init + self.bitsize = bitsize + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + if self.init is not None: nodelist.append(("init", self.init)) + if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + if self.init is not None: + yield self.init + if self.bitsize is not None: + yield self.bitsize + + attr_names = ('name', 'quals', 'align', 'storage', 'funcspec', ) + +class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') + def __init__(self, decls, coord=None): + self.decls = decls + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.decls or []): + nodelist.append(("decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.decls or []): + yield child + + attr_names = () + +class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') + def __init__(self, stmts, coord=None): + self.stmts = stmts + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.stmts or []): + nodelist.append(("stmts[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.stmts or []): + yield child + + attr_names = () + +class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') + def __init__(self, cond, stmt, coord=None): + self.cond = cond + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') + def __init__(self, name, values, coord=None): + self.name = name + self.values = values + self.coord = coord + + def children(self): + nodelist = [] + if self.values is not None: nodelist.append(("values", self.values)) + return tuple(nodelist) + + def __iter__(self): + if self.values is not None: + yield self.values + + attr_names = ('name', ) + +class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') + def __init__(self, name, value, coord=None): + self.name = name + self.value = value + self.coord = coord + + def children(self): + nodelist = [] + if self.value is not None: nodelist.append(("value", self.value)) + return tuple(nodelist) + + def __iter__(self): + if self.value is not None: + yield self.value + + attr_names = ('name', ) + +class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') + def __init__(self, enumerators, coord=None): + self.enumerators = enumerators + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.enumerators or []): + nodelist.append(("enumerators[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.enumerators or []): + yield child + + attr_names = () + +class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') + def __init__(self, exprs, coord=None): + self.exprs = exprs + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.exprs or []): + nodelist.append(("exprs[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.exprs or []): + yield child + + attr_names = () + +class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') + def __init__(self, ext, coord=None): + self.ext = ext + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.ext or []): + nodelist.append(("ext[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.ext or []): + yield child + + attr_names = () + +class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') + def __init__(self, init, cond, next, stmt, coord=None): + self.init = init + self.cond = cond + self.next = next + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.init is not None: nodelist.append(("init", self.init)) + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.next is not None: nodelist.append(("next", self.next)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.init is not None: + yield self.init + if self.cond is not None: + yield self.cond + if self.next is not None: + yield self.next + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') + def __init__(self, name, args, coord=None): + self.name = name + self.args = args + self.coord = coord + + def children(self): + nodelist = [] + if self.name is not None: nodelist.append(("name", self.name)) + if self.args is not None: nodelist.append(("args", self.args)) + return tuple(nodelist) + + def __iter__(self): + if self.name is not None: + yield self.name + if self.args is not None: + yield self.args + + attr_names = () + +class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') + def __init__(self, args, type, coord=None): + self.args = args + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.args is not None: nodelist.append(("args", self.args)) + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.args is not None: + yield self.args + if self.type is not None: + yield self.type + + attr_names = () + +class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') + def __init__(self, decl, param_decls, body, coord=None): + self.decl = decl + self.param_decls = param_decls + self.body = body + self.coord = coord + + def children(self): + nodelist = [] + if self.decl is not None: nodelist.append(("decl", self.decl)) + if self.body is not None: nodelist.append(("body", self.body)) + for i, child in enumerate(self.param_decls or []): + nodelist.append(("param_decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + if self.decl is not None: + yield self.decl + if self.body is not None: + yield self.body + for child in (self.param_decls or []): + yield child + + attr_names = () + +class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') + def __init__(self, name, coord=None): + self.name = name + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('name', ) + +class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') + def __init__(self, name, coord=None): + self.name = name + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('name', ) + +class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') + def __init__(self, names, coord=None): + self.names = names + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('names', ) + +class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') + def __init__(self, cond, iftrue, iffalse, coord=None): + self.cond = cond + self.iftrue = iftrue + self.iffalse = iffalse + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue)) + if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.iftrue is not None: + yield self.iftrue + if self.iffalse is not None: + yield self.iffalse + + attr_names = () + +class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') + def __init__(self, exprs, coord=None): + self.exprs = exprs + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.exprs or []): + nodelist.append(("exprs[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.exprs or []): + yield child + + attr_names = () + +class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') + def __init__(self, name, stmt, coord=None): + self.name = name + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.stmt is not None: + yield self.stmt + + attr_names = ('name', ) + +class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') + def __init__(self, name, expr, coord=None): + self.name = name + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + for i, child in enumerate(self.name or []): + nodelist.append(("name[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + for child in (self.name or []): + yield child + + attr_names = () + +class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') + def __init__(self, params, coord=None): + self.params = params + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.params or []): + nodelist.append(("params[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.params or []): + yield child + + attr_names = () + +class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') + def __init__(self, quals, type, coord=None): + self.quals = quals + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('quals', ) + +class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') + def __init__(self, expr, coord=None): + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + + attr_names = () + +class StaticAssert(Node): + __slots__ = ('cond', 'message', 'coord', '__weakref__') + def __init__(self, cond, message, coord=None): + self.cond = cond + self.message = message + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.message is not None: nodelist.append(("message", self.message)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.message is not None: + yield self.message + + attr_names = () + +class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') + def __init__(self, name, decls, coord=None): + self.name = name + self.decls = decls + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.decls or []): + nodelist.append(("decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.decls or []): + yield child + + attr_names = ('name', ) + +class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') + def __init__(self, name, type, field, coord=None): + self.name = name + self.type = type + self.field = field + self.coord = coord + + def children(self): + nodelist = [] + if self.name is not None: nodelist.append(("name", self.name)) + if self.field is not None: nodelist.append(("field", self.field)) + return tuple(nodelist) + + def __iter__(self): + if self.name is not None: + yield self.name + if self.field is not None: + yield self.field + + attr_names = ('type', ) + +class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') + def __init__(self, cond, stmt, coord=None): + self.cond = cond + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') + def __init__(self, cond, iftrue, iffalse, coord=None): + self.cond = cond + self.iftrue = iftrue + self.iffalse = iffalse + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue)) + if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.iftrue is not None: + yield self.iftrue + if self.iffalse is not None: + yield self.iffalse + + attr_names = () + +class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'align', 'type', 'coord', '__weakref__') + def __init__(self, declname, quals, align, type, coord=None): + self.declname = declname + self.quals = quals + self.align = align + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('declname', 'quals', 'align', ) + +class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, storage, type, coord=None): + self.name = name + self.quals = quals + self.storage = storage + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('name', 'quals', 'storage', ) + +class Typename(Node): + __slots__ = ('name', 'quals', 'align', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, align, type, coord=None): + self.name = name + self.quals = quals + self.align = align + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('name', 'quals', 'align', ) + +class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') + def __init__(self, op, expr, coord=None): + self.op = op + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + + attr_names = ('op', ) + +class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') + def __init__(self, name, decls, coord=None): + self.name = name + self.decls = decls + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.decls or []): + nodelist.append(("decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.decls or []): + yield child + + attr_names = ('name', ) + +class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') + def __init__(self, cond, stmt, coord=None): + self.cond = cond + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class Pragma(Node): + __slots__ = ('string', 'coord', '__weakref__') + def __init__(self, string, coord=None): + self.string = string + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('string', ) + diff --git a/billinglayer/python/pycparser/c_generator.py b/billinglayer/python/pycparser/c_generator.py new file mode 100644 index 0000000..1057b2c --- /dev/null +++ b/billinglayer/python/pycparser/c_generator.py @@ -0,0 +1,502 @@ +#------------------------------------------------------------------------------ +# pycparser: c_generator.py +# +# C code generator from pycparser AST nodes. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ +from . import c_ast + + +class CGenerator(object): + """ Uses the same visitor pattern as c_ast.NodeVisitor, but modified to + return a value from each visit method, using string accumulation in + generic_visit. + """ + def __init__(self, reduce_parentheses=False): + """ Constructs C-code generator + + reduce_parentheses: + if True, eliminates needless parentheses on binary operators + """ + # Statements start with indentation of self.indent_level spaces, using + # the _make_indent method. + self.indent_level = 0 + self.reduce_parentheses = reduce_parentheses + + def _make_indent(self): + return ' ' * self.indent_level + + def visit(self, node): + method = 'visit_' + node.__class__.__name__ + return getattr(self, method, self.generic_visit)(node) + + def generic_visit(self, node): + if node is None: + return '' + else: + return ''.join(self.visit(c) for c_name, c in node.children()) + + def visit_Constant(self, n): + return n.value + + def visit_ID(self, n): + return n.name + + def visit_Pragma(self, n): + ret = '#pragma' + if n.string: + ret += ' ' + n.string + return ret + + def visit_ArrayRef(self, n): + arrref = self._parenthesize_unless_simple(n.name) + return arrref + '[' + self.visit(n.subscript) + ']' + + def visit_StructRef(self, n): + sref = self._parenthesize_unless_simple(n.name) + return sref + n.type + self.visit(n.field) + + def visit_FuncCall(self, n): + fref = self._parenthesize_unless_simple(n.name) + return fref + '(' + self.visit(n.args) + ')' + + def visit_UnaryOp(self, n): + if n.op == 'sizeof': + # Always parenthesize the argument of sizeof since it can be + # a name. + return 'sizeof(%s)' % self.visit(n.expr) + else: + operand = self._parenthesize_unless_simple(n.expr) + if n.op == 'p++': + return '%s++' % operand + elif n.op == 'p--': + return '%s--' % operand + else: + return '%s%s' % (n.op, operand) + + # Precedence map of binary operators: + precedence_map = { + # Should be in sync with c_parser.CParser.precedence + # Higher numbers are stronger binding + '||': 0, # weakest binding + '&&': 1, + '|': 2, + '^': 3, + '&': 4, + '==': 5, '!=': 5, + '>': 6, '>=': 6, '<': 6, '<=': 6, + '>>': 7, '<<': 7, + '+': 8, '-': 8, + '*': 9, '/': 9, '%': 9 # strongest binding + } + + def visit_BinaryOp(self, n): + # Note: all binary operators are left-to-right associative + # + # If `n.left.op` has a stronger or equally binding precedence in + # comparison to `n.op`, no parenthesis are needed for the left: + # e.g., `(a*b) + c` is equivalent to `a*b + c`, as well as + # `(a+b) - c` is equivalent to `a+b - c` (same precedence). + # If the left operator is weaker binding than the current, then + # parentheses are necessary: + # e.g., `(a+b) * c` is NOT equivalent to `a+b * c`. + lval_str = self._parenthesize_if( + n.left, + lambda d: not (self._is_simple_node(d) or + self.reduce_parentheses and isinstance(d, c_ast.BinaryOp) and + self.precedence_map[d.op] >= self.precedence_map[n.op])) + # If `n.right.op` has a stronger -but not equal- binding precedence, + # parenthesis can be omitted on the right: + # e.g., `a + (b*c)` is equivalent to `a + b*c`. + # If the right operator is weaker or equally binding, then parentheses + # are necessary: + # e.g., `a * (b+c)` is NOT equivalent to `a * b+c` and + # `a - (b+c)` is NOT equivalent to `a - b+c` (same precedence). + rval_str = self._parenthesize_if( + n.right, + lambda d: not (self._is_simple_node(d) or + self.reduce_parentheses and isinstance(d, c_ast.BinaryOp) and + self.precedence_map[d.op] > self.precedence_map[n.op])) + return '%s %s %s' % (lval_str, n.op, rval_str) + + def visit_Assignment(self, n): + rval_str = self._parenthesize_if( + n.rvalue, + lambda n: isinstance(n, c_ast.Assignment)) + return '%s %s %s' % (self.visit(n.lvalue), n.op, rval_str) + + def visit_IdentifierType(self, n): + return ' '.join(n.names) + + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + + def visit_Decl(self, n, no_type=False): + # no_type is used when a Decl is part of a DeclList, where the type is + # explicitly only for the first declaration in a list. + # + s = n.name if no_type else self._generate_decl(n) + if n.bitsize: s += ' : ' + self.visit(n.bitsize) + if n.init: + s += ' = ' + self._visit_expr(n.init) + return s + + def visit_DeclList(self, n): + s = self.visit(n.decls[0]) + if len(n.decls) > 1: + s += ', ' + ', '.join(self.visit_Decl(decl, no_type=True) + for decl in n.decls[1:]) + return s + + def visit_Typedef(self, n): + s = '' + if n.storage: s += ' '.join(n.storage) + ' ' + s += self._generate_type(n.type) + return s + + def visit_Cast(self, n): + s = '(' + self._generate_type(n.to_type, emit_declname=False) + ')' + return s + ' ' + self._parenthesize_unless_simple(n.expr) + + def visit_ExprList(self, n): + visited_subexprs = [] + for expr in n.exprs: + visited_subexprs.append(self._visit_expr(expr)) + return ', '.join(visited_subexprs) + + def visit_InitList(self, n): + visited_subexprs = [] + for expr in n.exprs: + visited_subexprs.append(self._visit_expr(expr)) + return ', '.join(visited_subexprs) + + def visit_Enum(self, n): + return self._generate_struct_union_enum(n, name='enum') + + def visit_Alignas(self, n): + return '_Alignas({})'.format(self.visit(n.alignment)) + + def visit_Enumerator(self, n): + if not n.value: + return '{indent}{name},\n'.format( + indent=self._make_indent(), + name=n.name, + ) + else: + return '{indent}{name} = {value},\n'.format( + indent=self._make_indent(), + name=n.name, + value=self.visit(n.value), + ) + + def visit_FuncDef(self, n): + decl = self.visit(n.decl) + self.indent_level = 0 + body = self.visit(n.body) + if n.param_decls: + knrdecls = ';\n'.join(self.visit(p) for p in n.param_decls) + return decl + '\n' + knrdecls + ';\n' + body + '\n' + else: + return decl + '\n' + body + '\n' + + def visit_FileAST(self, n): + s = '' + for ext in n.ext: + if isinstance(ext, c_ast.FuncDef): + s += self.visit(ext) + elif isinstance(ext, c_ast.Pragma): + s += self.visit(ext) + '\n' + else: + s += self.visit(ext) + ';\n' + return s + + def visit_Compound(self, n): + s = self._make_indent() + '{\n' + self.indent_level += 2 + if n.block_items: + s += ''.join(self._generate_stmt(stmt) for stmt in n.block_items) + self.indent_level -= 2 + s += self._make_indent() + '}\n' + return s + + def visit_CompoundLiteral(self, n): + return '(' + self.visit(n.type) + '){' + self.visit(n.init) + '}' + + + def visit_EmptyStatement(self, n): + return ';' + + def visit_ParamList(self, n): + return ', '.join(self.visit(param) for param in n.params) + + def visit_Return(self, n): + s = 'return' + if n.expr: s += ' ' + self.visit(n.expr) + return s + ';' + + def visit_Break(self, n): + return 'break;' + + def visit_Continue(self, n): + return 'continue;' + + def visit_TernaryOp(self, n): + s = '(' + self._visit_expr(n.cond) + ') ? ' + s += '(' + self._visit_expr(n.iftrue) + ') : ' + s += '(' + self._visit_expr(n.iffalse) + ')' + return s + + def visit_If(self, n): + s = 'if (' + if n.cond: s += self.visit(n.cond) + s += ')\n' + s += self._generate_stmt(n.iftrue, add_indent=True) + if n.iffalse: + s += self._make_indent() + 'else\n' + s += self._generate_stmt(n.iffalse, add_indent=True) + return s + + def visit_For(self, n): + s = 'for (' + if n.init: s += self.visit(n.init) + s += ';' + if n.cond: s += ' ' + self.visit(n.cond) + s += ';' + if n.next: s += ' ' + self.visit(n.next) + s += ')\n' + s += self._generate_stmt(n.stmt, add_indent=True) + return s + + def visit_While(self, n): + s = 'while (' + if n.cond: s += self.visit(n.cond) + s += ')\n' + s += self._generate_stmt(n.stmt, add_indent=True) + return s + + def visit_DoWhile(self, n): + s = 'do\n' + s += self._generate_stmt(n.stmt, add_indent=True) + s += self._make_indent() + 'while (' + if n.cond: s += self.visit(n.cond) + s += ');' + return s + + def visit_StaticAssert(self, n): + s = '_Static_assert(' + s += self.visit(n.cond) + if n.message: + s += ',' + s += self.visit(n.message) + s += ')' + return s + + def visit_Switch(self, n): + s = 'switch (' + self.visit(n.cond) + ')\n' + s += self._generate_stmt(n.stmt, add_indent=True) + return s + + def visit_Case(self, n): + s = 'case ' + self.visit(n.expr) + ':\n' + for stmt in n.stmts: + s += self._generate_stmt(stmt, add_indent=True) + return s + + def visit_Default(self, n): + s = 'default:\n' + for stmt in n.stmts: + s += self._generate_stmt(stmt, add_indent=True) + return s + + def visit_Label(self, n): + return n.name + ':\n' + self._generate_stmt(n.stmt) + + def visit_Goto(self, n): + return 'goto ' + n.name + ';' + + def visit_EllipsisParam(self, n): + return '...' + + def visit_Struct(self, n): + return self._generate_struct_union_enum(n, 'struct') + + def visit_Typename(self, n): + return self._generate_type(n.type) + + def visit_Union(self, n): + return self._generate_struct_union_enum(n, 'union') + + def visit_NamedInitializer(self, n): + s = '' + for name in n.name: + if isinstance(name, c_ast.ID): + s += '.' + name.name + else: + s += '[' + self.visit(name) + ']' + s += ' = ' + self._visit_expr(n.expr) + return s + + def visit_FuncDecl(self, n): + return self._generate_type(n) + + def visit_ArrayDecl(self, n): + return self._generate_type(n, emit_declname=False) + + def visit_TypeDecl(self, n): + return self._generate_type(n, emit_declname=False) + + def visit_PtrDecl(self, n): + return self._generate_type(n, emit_declname=False) + + def _generate_struct_union_enum(self, n, name): + """ Generates code for structs, unions, and enums. name should be + 'struct', 'union', or 'enum'. + """ + if name in ('struct', 'union'): + members = n.decls + body_function = self._generate_struct_union_body + else: + assert name == 'enum' + members = None if n.values is None else n.values.enumerators + body_function = self._generate_enum_body + s = name + ' ' + (n.name or '') + if members is not None: + # None means no members + # Empty sequence means an empty list of members + s += '\n' + s += self._make_indent() + self.indent_level += 2 + s += '{\n' + s += body_function(members) + self.indent_level -= 2 + s += self._make_indent() + '}' + return s + + def _generate_struct_union_body(self, members): + return ''.join(self._generate_stmt(decl) for decl in members) + + def _generate_enum_body(self, members): + # `[:-2] + '\n'` removes the final `,` from the enumerator list + return ''.join(self.visit(value) for value in members)[:-2] + '\n' + + def _generate_stmt(self, n, add_indent=False): + """ Generation from a statement node. This method exists as a wrapper + for individual visit_* methods to handle different treatment of + some statements in this context. + """ + typ = type(n) + if add_indent: self.indent_level += 2 + indent = self._make_indent() + if add_indent: self.indent_level -= 2 + + if typ in ( + c_ast.Decl, c_ast.Assignment, c_ast.Cast, c_ast.UnaryOp, + c_ast.BinaryOp, c_ast.TernaryOp, c_ast.FuncCall, c_ast.ArrayRef, + c_ast.StructRef, c_ast.Constant, c_ast.ID, c_ast.Typedef, + c_ast.ExprList): + # These can also appear in an expression context so no semicolon + # is added to them automatically + # + return indent + self.visit(n) + ';\n' + elif typ in (c_ast.Compound,): + # No extra indentation required before the opening brace of a + # compound - because it consists of multiple lines it has to + # compute its own indentation. + # + return self.visit(n) + elif typ in (c_ast.If,): + return indent + self.visit(n) + else: + return indent + self.visit(n) + '\n' + + def _generate_decl(self, n): + """ Generation from a Decl node. + """ + s = '' + if n.funcspec: s = ' '.join(n.funcspec) + ' ' + if n.storage: s += ' '.join(n.storage) + ' ' + if n.align: s += self.visit(n.align[0]) + ' ' + s += self._generate_type(n.type) + return s + + def _generate_type(self, n, modifiers=[], emit_declname = True): + """ Recursive generation from a type node. n is the type node. + modifiers collects the PtrDecl, ArrayDecl and FuncDecl modifiers + encountered on the way down to a TypeDecl, to allow proper + generation from it. + """ + typ = type(n) + #~ print(n, modifiers) + + if typ == c_ast.TypeDecl: + s = '' + if n.quals: s += ' '.join(n.quals) + ' ' + s += self.visit(n.type) + + nstr = n.declname if n.declname and emit_declname else '' + # Resolve modifiers. + # Wrap in parens to distinguish pointer to array and pointer to + # function syntax. + # + for i, modifier in enumerate(modifiers): + if isinstance(modifier, c_ast.ArrayDecl): + if (i != 0 and + isinstance(modifiers[i - 1], c_ast.PtrDecl)): + nstr = '(' + nstr + ')' + nstr += '[' + if modifier.dim_quals: + nstr += ' '.join(modifier.dim_quals) + ' ' + nstr += self.visit(modifier.dim) + ']' + elif isinstance(modifier, c_ast.FuncDecl): + if (i != 0 and + isinstance(modifiers[i - 1], c_ast.PtrDecl)): + nstr = '(' + nstr + ')' + nstr += '(' + self.visit(modifier.args) + ')' + elif isinstance(modifier, c_ast.PtrDecl): + if modifier.quals: + nstr = '* %s%s' % (' '.join(modifier.quals), + ' ' + nstr if nstr else '') + else: + nstr = '*' + nstr + if nstr: s += ' ' + nstr + return s + elif typ == c_ast.Decl: + return self._generate_decl(n.type) + elif typ == c_ast.Typename: + return self._generate_type(n.type, emit_declname = emit_declname) + elif typ == c_ast.IdentifierType: + return ' '.join(n.names) + ' ' + elif typ in (c_ast.ArrayDecl, c_ast.PtrDecl, c_ast.FuncDecl): + return self._generate_type(n.type, modifiers + [n], + emit_declname = emit_declname) + else: + return self.visit(n) + + def _parenthesize_if(self, n, condition): + """ Visits 'n' and returns its string representation, parenthesized + if the condition function applied to the node returns True. + """ + s = self._visit_expr(n) + if condition(n): + return '(' + s + ')' + else: + return s + + def _parenthesize_unless_simple(self, n): + """ Common use case for _parenthesize_if + """ + return self._parenthesize_if(n, lambda d: not self._is_simple_node(d)) + + def _is_simple_node(self, n): + """ Returns True for nodes that are "simple" - i.e. nodes that always + have higher precedence than operators. + """ + return isinstance(n, (c_ast.Constant, c_ast.ID, c_ast.ArrayRef, + c_ast.StructRef, c_ast.FuncCall)) diff --git a/billinglayer/python/pycparser/c_lexer.py b/billinglayer/python/pycparser/c_lexer.py new file mode 100644 index 0000000..d68d8eb --- /dev/null +++ b/billinglayer/python/pycparser/c_lexer.py @@ -0,0 +1,554 @@ +#------------------------------------------------------------------------------ +# pycparser: c_lexer.py +# +# CLexer class: lexer for the C language +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ +import re + +from .ply import lex +from .ply.lex import TOKEN + + +class CLexer(object): + """ A lexer for the C language. After building it, set the + input text with input(), and call token() to get new + tokens. + + The public attribute filename can be set to an initial + filename, but the lexer will update it upon #line + directives. + """ + def __init__(self, error_func, on_lbrace_func, on_rbrace_func, + type_lookup_func): + """ Create a new Lexer. + + error_func: + An error function. Will be called with an error + message, line and column as arguments, in case of + an error during lexing. + + on_lbrace_func, on_rbrace_func: + Called when an LBRACE or RBRACE is encountered + (likely to push/pop type_lookup_func's scope) + + type_lookup_func: + A type lookup function. Given a string, it must + return True IFF this string is a name of a type + that was defined with a typedef earlier. + """ + self.error_func = error_func + self.on_lbrace_func = on_lbrace_func + self.on_rbrace_func = on_rbrace_func + self.type_lookup_func = type_lookup_func + self.filename = '' + + # Keeps track of the last token returned from self.token() + self.last_token = None + + # Allow either "# line" or "# " to support GCC's + # cpp output + # + self.line_pattern = re.compile(r'([ \t]*line\W)|([ \t]*\d+)') + self.pragma_pattern = re.compile(r'[ \t]*pragma\W') + + def build(self, **kwargs): + """ Builds the lexer from the specification. Must be + called after the lexer object is created. + + This method exists separately, because the PLY + manual warns against calling lex.lex inside + __init__ + """ + self.lexer = lex.lex(object=self, **kwargs) + + def reset_lineno(self): + """ Resets the internal line number counter of the lexer. + """ + self.lexer.lineno = 1 + + def input(self, text): + self.lexer.input(text) + + def token(self): + self.last_token = self.lexer.token() + return self.last_token + + def find_tok_column(self, token): + """ Find the column of the token in its line. + """ + last_cr = self.lexer.lexdata.rfind('\n', 0, token.lexpos) + return token.lexpos - last_cr + + ######################-- PRIVATE --###################### + + ## + ## Internal auxiliary methods + ## + def _error(self, msg, token): + location = self._make_tok_location(token) + self.error_func(msg, location[0], location[1]) + self.lexer.skip(1) + + def _make_tok_location(self, token): + return (token.lineno, self.find_tok_column(token)) + + ## + ## Reserved keywords + ## + keywords = ( + 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', + 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', + 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', + 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', + 'VOLATILE', 'WHILE', '__INT128', + ) + + keywords_new = ( + '_BOOL', '_COMPLEX', + '_NORETURN', '_THREAD_LOCAL', '_STATIC_ASSERT', + '_ATOMIC', '_ALIGNOF', '_ALIGNAS', + ) + + keyword_map = {} + + for keyword in keywords: + keyword_map[keyword.lower()] = keyword + + for keyword in keywords_new: + keyword_map[keyword[:2].upper() + keyword[2:].lower()] = keyword + + ## + ## All the tokens recognized by the lexer + ## + tokens = keywords + keywords_new + ( + # Identifiers + 'ID', + + # Type identifiers (identifiers previously defined as + # types with typedef) + 'TYPEID', + + # constants + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'INT_CONST_CHAR', + 'FLOAT_CONST', 'HEX_FLOAT_CONST', + 'CHAR_CONST', + 'WCHAR_CONST', + 'U8CHAR_CONST', + 'U16CHAR_CONST', + 'U32CHAR_CONST', + + # String literals + 'STRING_LITERAL', + 'WSTRING_LITERAL', + 'U8STRING_LITERAL', + 'U16STRING_LITERAL', + 'U32STRING_LITERAL', + + # Operators + 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD', + 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', + 'LOR', 'LAND', 'LNOT', + 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', + + # Assignment + 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', + 'PLUSEQUAL', 'MINUSEQUAL', + 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', + 'OREQUAL', + + # Increment/decrement + 'PLUSPLUS', 'MINUSMINUS', + + # Structure dereference (->) + 'ARROW', + + # Conditional operator (?) + 'CONDOP', + + # Delimiters + 'LPAREN', 'RPAREN', # ( ) + 'LBRACKET', 'RBRACKET', # [ ] + 'LBRACE', 'RBRACE', # { } + 'COMMA', 'PERIOD', # . , + 'SEMI', 'COLON', # ; : + + # Ellipsis (...) + 'ELLIPSIS', + + # pre-processor + 'PPHASH', # '#' + 'PPPRAGMA', # 'pragma' + 'PPPRAGMASTR', + ) + + ## + ## Regexes for use in tokens + ## + ## + + # valid C identifiers (K&R2: A.2.3), plus '$' (supported by some compilers) + identifier = r'[a-zA-Z_$][0-9a-zA-Z_$]*' + + hex_prefix = '0[xX]' + hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' + + # integer constants (K&R2: A.2.5.1) + integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' + decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' + octal_constant = '0[0-7]*'+integer_suffix_opt + hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt + + bad_octal_constant = '0[0-7]*[89]' + + # character constants (K&R2: A.2.5.2) + # Note: a-zA-Z and '.-~^_!=&;,' are allowed as escape chars to support #line + # directives with Windows paths as filenames (..\..\dir\file) + # For the same reason, decimal_escape allows all digit sequences. We want to + # parse all correct code, even if it means to sometimes parse incorrect + # code. + # + # The original regexes were taken verbatim from the C syntax definition, + # and were later modified to avoid worst-case exponential running time. + # + # simple_escape = r"""([a-zA-Z._~!=&\^\-\\?'"])""" + # decimal_escape = r"""(\d+)""" + # hex_escape = r"""(x[0-9a-fA-F]+)""" + # bad_escape = r"""([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-7])""" + # + # The following modifications were made to avoid the ambiguity that allowed backtracking: + # (https://github.com/eliben/pycparser/issues/61) + # + # - \x was removed from simple_escape, unless it was not followed by a hex digit, to avoid ambiguity with hex_escape. + # - hex_escape allows one or more hex characters, but requires that the next character(if any) is not hex + # - decimal_escape allows one or more decimal characters, but requires that the next character(if any) is not a decimal + # - bad_escape does not allow any decimals (8-9), to avoid conflicting with the permissive decimal_escape. + # + # Without this change, python's `re` module would recursively try parsing each ambiguous escape sequence in multiple ways. + # e.g. `\123` could be parsed as `\1`+`23`, `\12`+`3`, and `\123`. + + simple_escape = r"""([a-wyzA-Z._~!=&\^\-\\?'"]|x(?![0-9a-fA-F]))""" + decimal_escape = r"""(\d+)(?!\d)""" + hex_escape = r"""(x[0-9a-fA-F]+)(?![0-9a-fA-F])""" + bad_escape = r"""([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-9])""" + + escape_sequence = r"""(\\("""+simple_escape+'|'+decimal_escape+'|'+hex_escape+'))' + + # This complicated regex with lookahead might be slow for strings, so because all of the valid escapes (including \x) allowed + # 0 or more non-escaped characters after the first character, simple_escape+decimal_escape+hex_escape got simplified to + + escape_sequence_start_in_string = r"""(\\[0-9a-zA-Z._~!=&\^\-\\?'"])""" + + cconst_char = r"""([^'\\\n]|"""+escape_sequence+')' + char_const = "'"+cconst_char+"'" + wchar_const = 'L'+char_const + u8char_const = 'u8'+char_const + u16char_const = 'u'+char_const + u32char_const = 'U'+char_const + multicharacter_constant = "'"+cconst_char+"{2,4}'" + unmatched_quote = "('"+cconst_char+"*\\n)|('"+cconst_char+"*$)" + bad_char_const = r"""('"""+cconst_char+"""[^'\n]+')|('')|('"""+bad_escape+r"""[^'\n]*')""" + + # string literals (K&R2: A.2.6) + string_char = r"""([^"\\\n]|"""+escape_sequence_start_in_string+')' + string_literal = '"'+string_char+'*"' + wstring_literal = 'L'+string_literal + u8string_literal = 'u8'+string_literal + u16string_literal = 'u'+string_literal + u32string_literal = 'U'+string_literal + bad_string_literal = '"'+string_char+'*'+bad_escape+string_char+'*"' + + # floating constants (K&R2: A.2.5.3) + exponent_part = r"""([eE][-+]?[0-9]+)""" + fractional_constant = r"""([0-9]*\.[0-9]+)|([0-9]+\.)""" + floating_constant = '(((('+fractional_constant+')'+exponent_part+'?)|([0-9]+'+exponent_part+'))[FfLl]?)' + binary_exponent_part = r'''([pP][+-]?[0-9]+)''' + hex_fractional_constant = '((('+hex_digits+r""")?\."""+hex_digits+')|('+hex_digits+r"""\.))""" + hex_floating_constant = '('+hex_prefix+'('+hex_digits+'|'+hex_fractional_constant+')'+binary_exponent_part+'[FfLl]?)' + + ## + ## Lexer states: used for preprocessor \n-terminated directives + ## + states = ( + # ppline: preprocessor line directives + # + ('ppline', 'exclusive'), + + # pppragma: pragma + # + ('pppragma', 'exclusive'), + ) + + def t_PPHASH(self, t): + r'[ \t]*\#' + if self.line_pattern.match(t.lexer.lexdata, pos=t.lexer.lexpos): + t.lexer.begin('ppline') + self.pp_line = self.pp_filename = None + elif self.pragma_pattern.match(t.lexer.lexdata, pos=t.lexer.lexpos): + t.lexer.begin('pppragma') + else: + t.type = 'PPHASH' + return t + + ## + ## Rules for the ppline state + ## + @TOKEN(string_literal) + def t_ppline_FILENAME(self, t): + if self.pp_line is None: + self._error('filename before line number in #line', t) + else: + self.pp_filename = t.value.lstrip('"').rstrip('"') + + @TOKEN(decimal_constant) + def t_ppline_LINE_NUMBER(self, t): + if self.pp_line is None: + self.pp_line = t.value + else: + # Ignore: GCC's cpp sometimes inserts a numeric flag + # after the file name + pass + + def t_ppline_NEWLINE(self, t): + r'\n' + if self.pp_line is None: + self._error('line number missing in #line', t) + else: + self.lexer.lineno = int(self.pp_line) + + if self.pp_filename is not None: + self.filename = self.pp_filename + + t.lexer.begin('INITIAL') + + def t_ppline_PPLINE(self, t): + r'line' + pass + + t_ppline_ignore = ' \t' + + def t_ppline_error(self, t): + self._error('invalid #line directive', t) + + ## + ## Rules for the pppragma state + ## + def t_pppragma_NEWLINE(self, t): + r'\n' + t.lexer.lineno += 1 + t.lexer.begin('INITIAL') + + def t_pppragma_PPPRAGMA(self, t): + r'pragma' + return t + + t_pppragma_ignore = ' \t' + + def t_pppragma_STR(self, t): + '.+' + t.type = 'PPPRAGMASTR' + return t + + def t_pppragma_error(self, t): + self._error('invalid #pragma directive', t) + + ## + ## Rules for the normal state + ## + t_ignore = ' \t' + + # Newlines + def t_NEWLINE(self, t): + r'\n+' + t.lexer.lineno += t.value.count("\n") + + # Operators + t_PLUS = r'\+' + t_MINUS = r'-' + t_TIMES = r'\*' + t_DIVIDE = r'/' + t_MOD = r'%' + t_OR = r'\|' + t_AND = r'&' + t_NOT = r'~' + t_XOR = r'\^' + t_LSHIFT = r'<<' + t_RSHIFT = r'>>' + t_LOR = r'\|\|' + t_LAND = r'&&' + t_LNOT = r'!' + t_LT = r'<' + t_GT = r'>' + t_LE = r'<=' + t_GE = r'>=' + t_EQ = r'==' + t_NE = r'!=' + + # Assignment operators + t_EQUALS = r'=' + t_TIMESEQUAL = r'\*=' + t_DIVEQUAL = r'/=' + t_MODEQUAL = r'%=' + t_PLUSEQUAL = r'\+=' + t_MINUSEQUAL = r'-=' + t_LSHIFTEQUAL = r'<<=' + t_RSHIFTEQUAL = r'>>=' + t_ANDEQUAL = r'&=' + t_OREQUAL = r'\|=' + t_XOREQUAL = r'\^=' + + # Increment/decrement + t_PLUSPLUS = r'\+\+' + t_MINUSMINUS = r'--' + + # -> + t_ARROW = r'->' + + # ? + t_CONDOP = r'\?' + + # Delimiters + t_LPAREN = r'\(' + t_RPAREN = r'\)' + t_LBRACKET = r'\[' + t_RBRACKET = r'\]' + t_COMMA = r',' + t_PERIOD = r'\.' + t_SEMI = r';' + t_COLON = r':' + t_ELLIPSIS = r'\.\.\.' + + # Scope delimiters + # To see why on_lbrace_func is needed, consider: + # typedef char TT; + # void foo(int TT) { TT = 10; } + # TT x = 5; + # Outside the function, TT is a typedef, but inside (starting and ending + # with the braces) it's a parameter. The trouble begins with yacc's + # lookahead token. If we open a new scope in brace_open, then TT has + # already been read and incorrectly interpreted as TYPEID. So, we need + # to open and close scopes from within the lexer. + # Similar for the TT immediately outside the end of the function. + # + @TOKEN(r'\{') + def t_LBRACE(self, t): + self.on_lbrace_func() + return t + @TOKEN(r'\}') + def t_RBRACE(self, t): + self.on_rbrace_func() + return t + + t_STRING_LITERAL = string_literal + + # The following floating and integer constants are defined as + # functions to impose a strict order (otherwise, decimal + # is placed before the others because its regex is longer, + # and this is bad) + # + @TOKEN(floating_constant) + def t_FLOAT_CONST(self, t): + return t + + @TOKEN(hex_floating_constant) + def t_HEX_FLOAT_CONST(self, t): + return t + + @TOKEN(hex_constant) + def t_INT_CONST_HEX(self, t): + return t + + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + + @TOKEN(bad_octal_constant) + def t_BAD_CONST_OCT(self, t): + msg = "Invalid octal constant" + self._error(msg, t) + + @TOKEN(octal_constant) + def t_INT_CONST_OCT(self, t): + return t + + @TOKEN(decimal_constant) + def t_INT_CONST_DEC(self, t): + return t + + # Must come before bad_char_const, to prevent it from + # catching valid char constants as invalid + # + @TOKEN(multicharacter_constant) + def t_INT_CONST_CHAR(self, t): + return t + + @TOKEN(char_const) + def t_CHAR_CONST(self, t): + return t + + @TOKEN(wchar_const) + def t_WCHAR_CONST(self, t): + return t + + @TOKEN(u8char_const) + def t_U8CHAR_CONST(self, t): + return t + + @TOKEN(u16char_const) + def t_U16CHAR_CONST(self, t): + return t + + @TOKEN(u32char_const) + def t_U32CHAR_CONST(self, t): + return t + + @TOKEN(unmatched_quote) + def t_UNMATCHED_QUOTE(self, t): + msg = "Unmatched '" + self._error(msg, t) + + @TOKEN(bad_char_const) + def t_BAD_CHAR_CONST(self, t): + msg = "Invalid char constant %s" % t.value + self._error(msg, t) + + @TOKEN(wstring_literal) + def t_WSTRING_LITERAL(self, t): + return t + + @TOKEN(u8string_literal) + def t_U8STRING_LITERAL(self, t): + return t + + @TOKEN(u16string_literal) + def t_U16STRING_LITERAL(self, t): + return t + + @TOKEN(u32string_literal) + def t_U32STRING_LITERAL(self, t): + return t + + # unmatched string literals are caught by the preprocessor + + @TOKEN(bad_string_literal) + def t_BAD_STRING_LITERAL(self, t): + msg = "String contains invalid escape code" + self._error(msg, t) + + @TOKEN(identifier) + def t_ID(self, t): + t.type = self.keyword_map.get(t.value, "ID") + if t.type == 'ID' and self.type_lookup_func(t.value): + t.type = "TYPEID" + return t + + def t_error(self, t): + msg = 'Illegal character %s' % repr(t.value[0]) + self._error(msg, t) diff --git a/billinglayer/python/pycparser/c_parser.py b/billinglayer/python/pycparser/c_parser.py new file mode 100644 index 0000000..640a759 --- /dev/null +++ b/billinglayer/python/pycparser/c_parser.py @@ -0,0 +1,1936 @@ +#------------------------------------------------------------------------------ +# pycparser: c_parser.py +# +# CParser class: Parser and AST builder for the C language +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ +from .ply import yacc + +from . import c_ast +from .c_lexer import CLexer +from .plyparser import PLYParser, ParseError, parameterized, template +from .ast_transforms import fix_switch_cases, fix_atomic_specifiers + + +@template +class CParser(PLYParser): + def __init__( + self, + lex_optimize=True, + lexer=CLexer, + lextab='pycparser.lextab', + yacc_optimize=True, + yacctab='pycparser.yacctab', + yacc_debug=False, + taboutputdir=''): + """ Create a new CParser. + + Some arguments for controlling the debug/optimization + level of the parser are provided. The defaults are + tuned for release/performance mode. + The simple rules for using them are: + *) When tweaking CParser/CLexer, set these to False + *) When releasing a stable parser, set to True + + lex_optimize: + Set to False when you're modifying the lexer. + Otherwise, changes in the lexer won't be used, if + some lextab.py file exists. + When releasing with a stable lexer, set to True + to save the re-generation of the lexer table on + each run. + + lexer: + Set this parameter to define the lexer to use if + you're not using the default CLexer. + + lextab: + Points to the lex table that's used for optimized + mode. Only if you're modifying the lexer and want + some tests to avoid re-generating the table, make + this point to a local lex table file (that's been + earlier generated with lex_optimize=True) + + yacc_optimize: + Set to False when you're modifying the parser. + Otherwise, changes in the parser won't be used, if + some parsetab.py file exists. + When releasing with a stable parser, set to True + to save the re-generation of the parser table on + each run. + + yacctab: + Points to the yacc table that's used for optimized + mode. Only if you're modifying the parser, make + this point to a local yacc table file + + yacc_debug: + Generate a parser.out file that explains how yacc + built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. + """ + self.clex = lexer( + error_func=self._lex_error_func, + on_lbrace_func=self._lex_on_lbrace_func, + on_rbrace_func=self._lex_on_rbrace_func, + type_lookup_func=self._lex_type_lookup_func) + + self.clex.build( + optimize=lex_optimize, + lextab=lextab, + outputdir=taboutputdir) + self.tokens = self.clex.tokens + + rules_with_opt = [ + 'abstract_declarator', + 'assignment_expression', + 'declaration_list', + 'declaration_specifiers_no_type', + 'designation', + 'expression', + 'identifier_list', + 'init_declarator_list', + 'id_init_declarator_list', + 'initializer_list', + 'parameter_type_list', + 'block_item_list', + 'type_qualifier_list', + 'struct_declarator_list' + ] + + for rule in rules_with_opt: + self._create_opt_rule(rule) + + self.cparser = yacc.yacc( + module=self, + start='translation_unit_or_empty', + debug=yacc_debug, + optimize=yacc_optimize, + tabmodule=yacctab, + outputdir=taboutputdir) + + # Stack of scopes for keeping track of symbols. _scope_stack[-1] is + # the current (topmost) scope. Each scope is a dictionary that + # specifies whether a name is a type. If _scope_stack[n][name] is + # True, 'name' is currently a type in the scope. If it's False, + # 'name' is used in the scope but not as a type (for instance, if we + # saw: int name; + # If 'name' is not a key in _scope_stack[n] then 'name' was not defined + # in this scope at all. + self._scope_stack = [dict()] + + # Keeps track of the last token given to yacc (the lookahead token) + self._last_yielded_token = None + + def parse(self, text, filename='', debug=False): + """ Parses C code and returns an AST. + + text: + A string containing the C source code + + filename: + Name of the file being parsed (for meaningful + error messages) + + debug: + Debug flag to YACC + """ + self.clex.filename = filename + self.clex.reset_lineno() + self._scope_stack = [dict()] + self._last_yielded_token = None + return self.cparser.parse( + input=text, + lexer=self.clex, + debug=debug) + + ######################-- PRIVATE --###################### + + def _push_scope(self): + self._scope_stack.append(dict()) + + def _pop_scope(self): + assert len(self._scope_stack) > 1 + self._scope_stack.pop() + + def _add_typedef_name(self, name, coord): + """ Add a new typedef name (ie a TYPEID) to the current scope + """ + if not self._scope_stack[-1].get(name, True): + self._parse_error( + "Typedef %r previously declared as non-typedef " + "in this scope" % name, coord) + self._scope_stack[-1][name] = True + + def _add_identifier(self, name, coord): + """ Add a new object, function, or enum member name (ie an ID) to the + current scope + """ + if self._scope_stack[-1].get(name, False): + self._parse_error( + "Non-typedef %r previously declared as typedef " + "in this scope" % name, coord) + self._scope_stack[-1][name] = False + + def _is_type_in_scope(self, name): + """ Is *name* a typedef-name in the current scope? + """ + for scope in reversed(self._scope_stack): + # If name is an identifier in this scope it shadows typedefs in + # higher scopes. + in_scope = scope.get(name) + if in_scope is not None: return in_scope + return False + + def _lex_error_func(self, msg, line, column): + self._parse_error(msg, self._coord(line, column)) + + def _lex_on_lbrace_func(self): + self._push_scope() + + def _lex_on_rbrace_func(self): + self._pop_scope() + + def _lex_type_lookup_func(self, name): + """ Looks up types that were previously defined with + typedef. + Passed to the lexer for recognizing identifiers that + are types. + """ + is_type = self._is_type_in_scope(name) + return is_type + + def _get_yacc_lookahead_token(self): + """ We need access to yacc's lookahead token in certain cases. + This is the last token yacc requested from the lexer, so we + ask the lexer. + """ + return self.clex.last_token + + # To understand what's going on here, read sections A.8.5 and + # A.8.6 of K&R2 very carefully. + # + # A C type consists of a basic type declaration, with a list + # of modifiers. For example: + # + # int *c[5]; + # + # The basic declaration here is 'int c', and the pointer and + # the array are the modifiers. + # + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. + # + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: + # + # K&R2 A.8.6.2: Array Declarators + # + # In a declaration T D where D has the form + # D1 [constant-expression-opt] + # and the type of the identifier in the declaration T D1 is + # "type-modifier T", the type of the + # identifier of D is "type-modifier array of T" + # + # This is what this method does. The declarator it receives + # can be a list of declarators ending with TypeDecl. It + # tacks the modifier to the end of this list, just before + # the TypeDecl. + # + # Additionally, the modifier may be a list itself. This is + # useful for pointers, that can come as a chain from the rule + # p_pointer. In this case, the whole modifier list is spliced + # into the new location. + def _type_modify_decl(self, decl, modifier): + """ Tacks a type modifier on a declarator, and returns + the modified declarator. + + Note: the declarator and modifier may be modified + """ + #~ print '****' + #~ decl.show(offset=3) + #~ modifier.show(offset=3) + #~ print '****' + + modifier_head = modifier + modifier_tail = modifier + + # The modifier may be a nested list. Reach its tail. + while modifier_tail.type: + modifier_tail = modifier_tail.type + + # If the decl is a basic type, just tack the modifier onto it. + if isinstance(decl, c_ast.TypeDecl): + modifier_tail.type = decl + return modifier + else: + # Otherwise, the decl is a list of modifiers. Reach + # its tail and splice the modifier onto the tail, + # pointing to the underlying basic type. + decl_tail = decl + + while not isinstance(decl_tail.type, c_ast.TypeDecl): + decl_tail = decl_tail.type + + modifier_tail.type = decl_tail.type + decl_tail.type = modifier_head + return decl + + # Due to the order in which declarators are constructed, + # they have to be fixed in order to look like a normal AST. + # + # When a declaration arrives from syntax construction, it has + # these problems: + # * The innermost TypeDecl has no type (because the basic + # type is only known at the uppermost declaration level) + # * The declaration has no variable name, since that is saved + # in the innermost TypeDecl + # * The typename of the declaration is a list of type + # specifiers, and not a node. Here, basic identifier types + # should be separated from more complex types like enums + # and structs. + # + # This method fixes these problems. + def _fix_decl_name_type(self, decl, typename): + """ Fixes a declaration. Modifies decl. + """ + # Reach the underlying basic type + # + type = decl + while not isinstance(type, c_ast.TypeDecl): + type = type.type + + decl.name = type.declname + type.quals = decl.quals[:] + + # The typename is a list of types. If any type in this + # list isn't an IdentifierType, it must be the only + # type in the list (it's illegal to declare "int enum ..") + # If all the types are basic, they're collected in the + # IdentifierType holder. + for tn in typename: + if not isinstance(tn, c_ast.IdentifierType): + if len(typename) > 1: + self._parse_error( + "Invalid multiple types specified", tn.coord) + else: + type.type = tn + return decl + + if not typename: + # Functions default to returning int + # + if not isinstance(decl.type, c_ast.FuncDecl): + self._parse_error( + "Missing type in declaration", decl.coord) + type.type = c_ast.IdentifierType( + ['int'], + coord=decl.coord) + else: + # At this point, we know that typename is a list of IdentifierType + # nodes. Concatenate all the names into a single list. + # + type.type = c_ast.IdentifierType( + [name for id in typename for name in id.names], + coord=typename[0].coord) + return decl + + def _add_declaration_specifier(self, declspec, newspec, kind, append=False): + """ Declaration specifiers are represented by a dictionary + with the entries: + * qual: a list of type qualifiers + * storage: a list of storage type qualifiers + * type: a list of type specifiers + * function: a list of function specifiers + * alignment: a list of alignment specifiers + + This method is given a declaration specifier, and a + new specifier of a given kind. + If `append` is True, the new specifier is added to the end of + the specifiers list, otherwise it's added at the beginning. + Returns the declaration specifier, with the new + specifier incorporated. + """ + spec = declspec or dict(qual=[], storage=[], type=[], function=[], alignment=[]) + + if append: + spec[kind].append(newspec) + else: + spec[kind].insert(0, newspec) + + return spec + + def _build_declarations(self, spec, decls, typedef_namespace=False): + """ Builds a list of declarations all sharing the given specifiers. + If typedef_namespace is true, each declared name is added + to the "typedef namespace", which also includes objects, + functions, and enum constants. + """ + is_typedef = 'typedef' in spec['storage'] + declarations = [] + + # Bit-fields are allowed to be unnamed. + if decls[0].get('bitsize') is not None: + pass + + # When redeclaring typedef names as identifiers in inner scopes, a + # problem can occur where the identifier gets grouped into + # spec['type'], leaving decl as None. This can only occur for the + # first declarator. + elif decls[0]['decl'] is None: + if len(spec['type']) < 2 or len(spec['type'][-1].names) != 1 or \ + not self._is_type_in_scope(spec['type'][-1].names[0]): + coord = '?' + for t in spec['type']: + if hasattr(t, 'coord'): + coord = t.coord + break + self._parse_error('Invalid declaration', coord) + + # Make this look as if it came from "direct_declarator:ID" + decls[0]['decl'] = c_ast.TypeDecl( + declname=spec['type'][-1].names[0], + type=None, + quals=None, + align=spec['alignment'], + coord=spec['type'][-1].coord) + # Remove the "new" type's name from the end of spec['type'] + del spec['type'][-1] + + # A similar problem can occur where the declaration ends up looking + # like an abstract declarator. Give it a name if this is the case. + elif not isinstance(decls[0]['decl'], ( + c_ast.Enum, c_ast.Struct, c_ast.Union, c_ast.IdentifierType)): + decls_0_tail = decls[0]['decl'] + while not isinstance(decls_0_tail, c_ast.TypeDecl): + decls_0_tail = decls_0_tail.type + if decls_0_tail.declname is None: + decls_0_tail.declname = spec['type'][-1].names[0] + del spec['type'][-1] + + for decl in decls: + assert decl['decl'] is not None + if is_typedef: + declaration = c_ast.Typedef( + name=None, + quals=spec['qual'], + storage=spec['storage'], + type=decl['decl'], + coord=decl['decl'].coord) + else: + declaration = c_ast.Decl( + name=None, + quals=spec['qual'], + align=spec['alignment'], + storage=spec['storage'], + funcspec=spec['function'], + type=decl['decl'], + init=decl.get('init'), + bitsize=decl.get('bitsize'), + coord=decl['decl'].coord) + + if isinstance(declaration.type, ( + c_ast.Enum, c_ast.Struct, c_ast.Union, + c_ast.IdentifierType)): + fixed_decl = declaration + else: + fixed_decl = self._fix_decl_name_type(declaration, spec['type']) + + # Add the type name defined by typedef to a + # symbol table (for usage in the lexer) + if typedef_namespace: + if is_typedef: + self._add_typedef_name(fixed_decl.name, fixed_decl.coord) + else: + self._add_identifier(fixed_decl.name, fixed_decl.coord) + + fixed_decl = fix_atomic_specifiers(fixed_decl) + declarations.append(fixed_decl) + + return declarations + + def _build_function_definition(self, spec, decl, param_decls, body): + """ Builds a function definition. + """ + if 'typedef' in spec['storage']: + self._parse_error("Invalid typedef", decl.coord) + + declaration = self._build_declarations( + spec=spec, + decls=[dict(decl=decl, init=None)], + typedef_namespace=True)[0] + + return c_ast.FuncDef( + decl=declaration, + param_decls=param_decls, + body=body, + coord=decl.coord) + + def _select_struct_union_class(self, token): + """ Given a token (either STRUCT or UNION), selects the + appropriate AST class. + """ + if token == 'struct': + return c_ast.Struct + else: + return c_ast.Union + + ## + ## Precedence and associativity of operators + ## + # If this changes, c_generator.CGenerator.precedence_map needs to change as + # well + precedence = ( + ('left', 'LOR'), + ('left', 'LAND'), + ('left', 'OR'), + ('left', 'XOR'), + ('left', 'AND'), + ('left', 'EQ', 'NE'), + ('left', 'GT', 'GE', 'LT', 'LE'), + ('left', 'RSHIFT', 'LSHIFT'), + ('left', 'PLUS', 'MINUS'), + ('left', 'TIMES', 'DIVIDE', 'MOD') + ) + + ## + ## Grammar productions + ## Implementation of the BNF defined in K&R2 A.13 + ## + + # Wrapper around a translation unit, to allow for empty input. + # Not strictly part of the C99 Grammar, but useful in practice. + def p_translation_unit_or_empty(self, p): + """ translation_unit_or_empty : translation_unit + | empty + """ + if p[1] is None: + p[0] = c_ast.FileAST([]) + else: + p[0] = c_ast.FileAST(p[1]) + + def p_translation_unit_1(self, p): + """ translation_unit : external_declaration + """ + # Note: external_declaration is already a list + p[0] = p[1] + + def p_translation_unit_2(self, p): + """ translation_unit : translation_unit external_declaration + """ + p[1].extend(p[2]) + p[0] = p[1] + + # Declarations always come as lists (because they can be + # several in one line), so we wrap the function definition + # into a list as well, to make the return value of + # external_declaration homogeneous. + def p_external_declaration_1(self, p): + """ external_declaration : function_definition + """ + p[0] = [p[1]] + + def p_external_declaration_2(self, p): + """ external_declaration : declaration + """ + p[0] = p[1] + + def p_external_declaration_3(self, p): + """ external_declaration : pp_directive + | pppragma_directive + """ + p[0] = [p[1]] + + def p_external_declaration_4(self, p): + """ external_declaration : SEMI + """ + p[0] = [] + + def p_external_declaration_5(self, p): + """ external_declaration : static_assert + """ + p[0] = p[1] + + def p_static_assert_declaration(self, p): + """ static_assert : _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN + | _STATIC_ASSERT LPAREN constant_expression RPAREN + """ + if len(p) == 5: + p[0] = [c_ast.StaticAssert(p[3], None, self._token_coord(p, 1))] + else: + p[0] = [c_ast.StaticAssert(p[3], p[5], self._token_coord(p, 1))] + + def p_pp_directive(self, p): + """ pp_directive : PPHASH + """ + self._parse_error('Directives not supported yet', + self._token_coord(p, 1)) + + def p_pppragma_directive(self, p): + """ pppragma_directive : PPPRAGMA + | PPPRAGMA PPPRAGMASTR + """ + if len(p) == 3: + p[0] = c_ast.Pragma(p[2], self._token_coord(p, 2)) + else: + p[0] = c_ast.Pragma("", self._token_coord(p, 1)) + + # In function definitions, the declarator can be followed by + # a declaration list, for old "K&R style" function definitios. + def p_function_definition_1(self, p): + """ function_definition : id_declarator declaration_list_opt compound_statement + """ + # no declaration specifiers - 'int' becomes the default type + spec = dict( + qual=[], + alignment=[], + storage=[], + type=[c_ast.IdentifierType(['int'], + coord=self._token_coord(p, 1))], + function=[]) + + p[0] = self._build_function_definition( + spec=spec, + decl=p[1], + param_decls=p[2], + body=p[3]) + + def p_function_definition_2(self, p): + """ function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement + """ + spec = p[1] + + p[0] = self._build_function_definition( + spec=spec, + decl=p[2], + param_decls=p[3], + body=p[4]) + + # Note, according to C18 A.2.2 6.7.10 static_assert-declaration _Static_assert + # is a declaration, not a statement. We additionally recognise it as a statement + # to fix parsing of _Static_assert inside the functions. + # + def p_statement(self, p): + """ statement : labeled_statement + | expression_statement + | compound_statement + | selection_statement + | iteration_statement + | jump_statement + | pppragma_directive + | static_assert + """ + p[0] = p[1] + + # A pragma is generally considered a decorator rather than an actual + # statement. Still, for the purposes of analyzing an abstract syntax tree of + # C code, pragma's should not be ignored and were previously treated as a + # statement. This presents a problem for constructs that take a statement + # such as labeled_statements, selection_statements, and + # iteration_statements, causing a misleading structure in the AST. For + # example, consider the following C code. + # + # for (int i = 0; i < 3; i++) + # #pragma omp critical + # sum += 1; + # + # This code will compile and execute "sum += 1;" as the body of the for + # loop. Previous implementations of PyCParser would render the AST for this + # block of code as follows: + # + # For: + # DeclList: + # Decl: i, [], [], [] + # TypeDecl: i, [] + # IdentifierType: ['int'] + # Constant: int, 0 + # BinaryOp: < + # ID: i + # Constant: int, 3 + # UnaryOp: p++ + # ID: i + # Pragma: omp critical + # Assignment: += + # ID: sum + # Constant: int, 1 + # + # This AST misleadingly takes the Pragma as the body of the loop and the + # assignment then becomes a sibling of the loop. + # + # To solve edge cases like these, the pragmacomp_or_statement rule groups + # a pragma and its following statement (which would otherwise be orphaned) + # using a compound block, effectively turning the above code into: + # + # for (int i = 0; i < 3; i++) { + # #pragma omp critical + # sum += 1; + # } + def p_pragmacomp_or_statement(self, p): + """ pragmacomp_or_statement : pppragma_directive statement + | statement + """ + if isinstance(p[1], c_ast.Pragma) and len(p) == 3: + p[0] = c_ast.Compound( + block_items=[p[1], p[2]], + coord=self._token_coord(p, 1)) + else: + p[0] = p[1] + + # In C, declarations can come several in a line: + # int x, *px, romulo = 5; + # + # However, for the AST, we will split them to separate Decl + # nodes. + # + # This rule splits its declarations and always returns a list + # of Decl nodes, even if it's one element long. + # + def p_decl_body(self, p): + """ decl_body : declaration_specifiers init_declarator_list_opt + | declaration_specifiers_no_type id_init_declarator_list_opt + """ + spec = p[1] + + # p[2] (init_declarator_list_opt) is either a list or None + # + if p[2] is None: + # By the standard, you must have at least one declarator unless + # declaring a structure tag, a union tag, or the members of an + # enumeration. + # + ty = spec['type'] + s_u_or_e = (c_ast.Struct, c_ast.Union, c_ast.Enum) + if len(ty) == 1 and isinstance(ty[0], s_u_or_e): + decls = [c_ast.Decl( + name=None, + quals=spec['qual'], + align=spec['alignment'], + storage=spec['storage'], + funcspec=spec['function'], + type=ty[0], + init=None, + bitsize=None, + coord=ty[0].coord)] + + # However, this case can also occur on redeclared identifiers in + # an inner scope. The trouble is that the redeclared type's name + # gets grouped into declaration_specifiers; _build_declarations + # compensates for this. + # + else: + decls = self._build_declarations( + spec=spec, + decls=[dict(decl=None, init=None)], + typedef_namespace=True) + + else: + decls = self._build_declarations( + spec=spec, + decls=p[2], + typedef_namespace=True) + + p[0] = decls + + # The declaration has been split to a decl_body sub-rule and + # SEMI, because having them in a single rule created a problem + # for defining typedefs. + # + # If a typedef line was directly followed by a line using the + # type defined with the typedef, the type would not be + # recognized. This is because to reduce the declaration rule, + # the parser's lookahead asked for the token after SEMI, which + # was the type from the next line, and the lexer had no chance + # to see the updated type symbol table. + # + # Splitting solves this problem, because after seeing SEMI, + # the parser reduces decl_body, which actually adds the new + # type into the table to be seen by the lexer before the next + # line is reached. + def p_declaration(self, p): + """ declaration : decl_body SEMI + """ + p[0] = p[1] + + # Since each declaration is a list of declarations, this + # rule will combine all the declarations and return a single + # list + # + def p_declaration_list(self, p): + """ declaration_list : declaration + | declaration_list declaration + """ + p[0] = p[1] if len(p) == 2 else p[1] + p[2] + + # To know when declaration-specifiers end and declarators begin, + # we require declaration-specifiers to have at least one + # type-specifier, and disallow typedef-names after we've seen any + # type-specifier. These are both required by the spec. + # + def p_declaration_specifiers_no_type_1(self, p): + """ declaration_specifiers_no_type : type_qualifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'qual') + + def p_declaration_specifiers_no_type_2(self, p): + """ declaration_specifiers_no_type : storage_class_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'storage') + + def p_declaration_specifiers_no_type_3(self, p): + """ declaration_specifiers_no_type : function_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'function') + + # Without this, `typedef _Atomic(T) U` will parse incorrectly because the + # _Atomic qualifier will match, instead of the specifier. + def p_declaration_specifiers_no_type_4(self, p): + """ declaration_specifiers_no_type : atomic_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'type') + + def p_declaration_specifiers_no_type_5(self, p): + """ declaration_specifiers_no_type : alignment_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'alignment') + + def p_declaration_specifiers_1(self, p): + """ declaration_specifiers : declaration_specifiers type_qualifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'qual', append=True) + + def p_declaration_specifiers_2(self, p): + """ declaration_specifiers : declaration_specifiers storage_class_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'storage', append=True) + + def p_declaration_specifiers_3(self, p): + """ declaration_specifiers : declaration_specifiers function_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'function', append=True) + + def p_declaration_specifiers_4(self, p): + """ declaration_specifiers : declaration_specifiers type_specifier_no_typeid + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True) + + def p_declaration_specifiers_5(self, p): + """ declaration_specifiers : type_specifier + """ + p[0] = self._add_declaration_specifier(None, p[1], 'type') + + def p_declaration_specifiers_6(self, p): + """ declaration_specifiers : declaration_specifiers_no_type type_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True) + + def p_declaration_specifiers_7(self, p): + """ declaration_specifiers : declaration_specifiers alignment_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'alignment', append=True) + + def p_storage_class_specifier(self, p): + """ storage_class_specifier : AUTO + | REGISTER + | STATIC + | EXTERN + | TYPEDEF + | _THREAD_LOCAL + """ + p[0] = p[1] + + def p_function_specifier(self, p): + """ function_specifier : INLINE + | _NORETURN + """ + p[0] = p[1] + + def p_type_specifier_no_typeid(self, p): + """ type_specifier_no_typeid : VOID + | _BOOL + | CHAR + | SHORT + | INT + | LONG + | FLOAT + | DOUBLE + | _COMPLEX + | SIGNED + | UNSIGNED + | __INT128 + """ + p[0] = c_ast.IdentifierType([p[1]], coord=self._token_coord(p, 1)) + + def p_type_specifier(self, p): + """ type_specifier : typedef_name + | enum_specifier + | struct_or_union_specifier + | type_specifier_no_typeid + | atomic_specifier + """ + p[0] = p[1] + + # See section 6.7.2.4 of the C11 standard. + def p_atomic_specifier(self, p): + """ atomic_specifier : _ATOMIC LPAREN type_name RPAREN + """ + typ = p[3] + typ.quals.append('_Atomic') + p[0] = typ + + def p_type_qualifier(self, p): + """ type_qualifier : CONST + | RESTRICT + | VOLATILE + | _ATOMIC + """ + p[0] = p[1] + + def p_init_declarator_list(self, p): + """ init_declarator_list : init_declarator + | init_declarator_list COMMA init_declarator + """ + p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]] + + # Returns a {decl= : init=} dictionary + # If there's no initializer, uses None + # + def p_init_declarator(self, p): + """ init_declarator : declarator + | declarator EQUALS initializer + """ + p[0] = dict(decl=p[1], init=(p[3] if len(p) > 2 else None)) + + def p_id_init_declarator_list(self, p): + """ id_init_declarator_list : id_init_declarator + | id_init_declarator_list COMMA init_declarator + """ + p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]] + + def p_id_init_declarator(self, p): + """ id_init_declarator : id_declarator + | id_declarator EQUALS initializer + """ + p[0] = dict(decl=p[1], init=(p[3] if len(p) > 2 else None)) + + # Require at least one type specifier in a specifier-qualifier-list + # + def p_specifier_qualifier_list_1(self, p): + """ specifier_qualifier_list : specifier_qualifier_list type_specifier_no_typeid + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True) + + def p_specifier_qualifier_list_2(self, p): + """ specifier_qualifier_list : specifier_qualifier_list type_qualifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'qual', append=True) + + def p_specifier_qualifier_list_3(self, p): + """ specifier_qualifier_list : type_specifier + """ + p[0] = self._add_declaration_specifier(None, p[1], 'type') + + def p_specifier_qualifier_list_4(self, p): + """ specifier_qualifier_list : type_qualifier_list type_specifier + """ + p[0] = dict(qual=p[1], alignment=[], storage=[], type=[p[2]], function=[]) + + def p_specifier_qualifier_list_5(self, p): + """ specifier_qualifier_list : alignment_specifier + """ + p[0] = dict(qual=[], alignment=[p[1]], storage=[], type=[], function=[]) + + def p_specifier_qualifier_list_6(self, p): + """ specifier_qualifier_list : specifier_qualifier_list alignment_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'alignment') + + # TYPEID is allowed here (and in other struct/enum related tag names), because + # struct/enum tags reside in their own namespace and can be named the same as types + # + def p_struct_or_union_specifier_1(self, p): + """ struct_or_union_specifier : struct_or_union ID + | struct_or_union TYPEID + """ + klass = self._select_struct_union_class(p[1]) + # None means no list of members + p[0] = klass( + name=p[2], + decls=None, + coord=self._token_coord(p, 2)) + + def p_struct_or_union_specifier_2(self, p): + """ struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close + | struct_or_union brace_open brace_close + """ + klass = self._select_struct_union_class(p[1]) + if len(p) == 4: + # Empty sequence means an empty list of members + p[0] = klass( + name=None, + decls=[], + coord=self._token_coord(p, 2)) + else: + p[0] = klass( + name=None, + decls=p[3], + coord=self._token_coord(p, 2)) + + + def p_struct_or_union_specifier_3(self, p): + """ struct_or_union_specifier : struct_or_union ID brace_open struct_declaration_list brace_close + | struct_or_union ID brace_open brace_close + | struct_or_union TYPEID brace_open struct_declaration_list brace_close + | struct_or_union TYPEID brace_open brace_close + """ + klass = self._select_struct_union_class(p[1]) + if len(p) == 5: + # Empty sequence means an empty list of members + p[0] = klass( + name=p[2], + decls=[], + coord=self._token_coord(p, 2)) + else: + p[0] = klass( + name=p[2], + decls=p[4], + coord=self._token_coord(p, 2)) + + def p_struct_or_union(self, p): + """ struct_or_union : STRUCT + | UNION + """ + p[0] = p[1] + + # Combine all declarations into a single list + # + def p_struct_declaration_list(self, p): + """ struct_declaration_list : struct_declaration + | struct_declaration_list struct_declaration + """ + if len(p) == 2: + p[0] = p[1] or [] + else: + p[0] = p[1] + (p[2] or []) + + def p_struct_declaration_1(self, p): + """ struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI + """ + spec = p[1] + assert 'typedef' not in spec['storage'] + + if p[2] is not None: + decls = self._build_declarations( + spec=spec, + decls=p[2]) + + elif len(spec['type']) == 1: + # Anonymous struct/union, gcc extension, C1x feature. + # Although the standard only allows structs/unions here, I see no + # reason to disallow other types since some compilers have typedefs + # here, and pycparser isn't about rejecting all invalid code. + # + node = spec['type'][0] + if isinstance(node, c_ast.Node): + decl_type = node + else: + decl_type = c_ast.IdentifierType(node) + + decls = self._build_declarations( + spec=spec, + decls=[dict(decl=decl_type)]) + + else: + # Structure/union members can have the same names as typedefs. + # The trouble is that the member's name gets grouped into + # specifier_qualifier_list; _build_declarations compensates. + # + decls = self._build_declarations( + spec=spec, + decls=[dict(decl=None, init=None)]) + + p[0] = decls + + def p_struct_declaration_2(self, p): + """ struct_declaration : SEMI + """ + p[0] = None + + def p_struct_declaration_3(self, p): + """ struct_declaration : pppragma_directive + """ + p[0] = [p[1]] + + def p_struct_declarator_list(self, p): + """ struct_declarator_list : struct_declarator + | struct_declarator_list COMMA struct_declarator + """ + p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]] + + # struct_declarator passes up a dict with the keys: decl (for + # the underlying declarator) and bitsize (for the bitsize) + # + def p_struct_declarator_1(self, p): + """ struct_declarator : declarator + """ + p[0] = {'decl': p[1], 'bitsize': None} + + def p_struct_declarator_2(self, p): + """ struct_declarator : declarator COLON constant_expression + | COLON constant_expression + """ + if len(p) > 3: + p[0] = {'decl': p[1], 'bitsize': p[3]} + else: + p[0] = {'decl': c_ast.TypeDecl(None, None, None, None), 'bitsize': p[2]} + + def p_enum_specifier_1(self, p): + """ enum_specifier : ENUM ID + | ENUM TYPEID + """ + p[0] = c_ast.Enum(p[2], None, self._token_coord(p, 1)) + + def p_enum_specifier_2(self, p): + """ enum_specifier : ENUM brace_open enumerator_list brace_close + """ + p[0] = c_ast.Enum(None, p[3], self._token_coord(p, 1)) + + def p_enum_specifier_3(self, p): + """ enum_specifier : ENUM ID brace_open enumerator_list brace_close + | ENUM TYPEID brace_open enumerator_list brace_close + """ + p[0] = c_ast.Enum(p[2], p[4], self._token_coord(p, 1)) + + def p_enumerator_list(self, p): + """ enumerator_list : enumerator + | enumerator_list COMMA + | enumerator_list COMMA enumerator + """ + if len(p) == 2: + p[0] = c_ast.EnumeratorList([p[1]], p[1].coord) + elif len(p) == 3: + p[0] = p[1] + else: + p[1].enumerators.append(p[3]) + p[0] = p[1] + + def p_alignment_specifier(self, p): + """ alignment_specifier : _ALIGNAS LPAREN type_name RPAREN + | _ALIGNAS LPAREN constant_expression RPAREN + """ + p[0] = c_ast.Alignas(p[3], self._token_coord(p, 1)) + + def p_enumerator(self, p): + """ enumerator : ID + | ID EQUALS constant_expression + """ + if len(p) == 2: + enumerator = c_ast.Enumerator( + p[1], None, + self._token_coord(p, 1)) + else: + enumerator = c_ast.Enumerator( + p[1], p[3], + self._token_coord(p, 1)) + self._add_identifier(enumerator.name, enumerator.coord) + + p[0] = enumerator + + def p_declarator(self, p): + """ declarator : id_declarator + | typeid_declarator + """ + p[0] = p[1] + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_xxx_declarator_1(self, p): + """ xxx_declarator : direct_xxx_declarator + """ + p[0] = p[1] + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_xxx_declarator_2(self, p): + """ xxx_declarator : pointer direct_xxx_declarator + """ + p[0] = self._type_modify_decl(p[2], p[1]) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_1(self, p): + """ direct_xxx_declarator : yyy + """ + p[0] = c_ast.TypeDecl( + declname=p[1], + type=None, + quals=None, + align=None, + coord=self._token_coord(p, 1)) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID')) + def p_direct_xxx_declarator_2(self, p): + """ direct_xxx_declarator : LPAREN xxx_declarator RPAREN + """ + p[0] = p[2] + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_3(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET + """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 + arr = c_ast.ArrayDecl( + type=None, + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_4(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_xxx_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + # Special for VLAs + # + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_5(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET + """ + arr = c_ast.ArrayDecl( + type=None, + dim=c_ast.ID(p[4], self._token_coord(p, 4)), + dim_quals=p[3] if p[3] is not None else [], + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_6(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LPAREN parameter_type_list RPAREN + | direct_xxx_declarator LPAREN identifier_list_opt RPAREN + """ + func = c_ast.FuncDecl( + args=p[3], + type=None, + coord=p[1].coord) + + # To see why _get_yacc_lookahead_token is needed, consider: + # typedef char TT; + # void foo(int TT) { TT = 10; } + # Outside the function, TT is a typedef, but inside (starting and + # ending with the braces) it's a parameter. The trouble begins with + # yacc's lookahead token. We don't know if we're declaring or + # defining a function until we see LBRACE, but if we wait for yacc to + # trigger a rule on that token, then TT will have already been read + # and incorrectly interpreted as TYPEID. We need to add the + # parameters to the scope the moment the lexer sees LBRACE. + # + if self._get_yacc_lookahead_token().type == "LBRACE": + if func.args is not None: + for param in func.args.params: + if isinstance(param, c_ast.EllipsisParam): break + self._add_identifier(param.name, param.coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=func) + + def p_pointer(self, p): + """ pointer : TIMES type_qualifier_list_opt + | TIMES type_qualifier_list_opt pointer + """ + coord = self._token_coord(p, 1) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type + + def p_type_qualifier_list(self, p): + """ type_qualifier_list : type_qualifier + | type_qualifier_list type_qualifier + """ + p[0] = [p[1]] if len(p) == 2 else p[1] + [p[2]] + + def p_parameter_type_list(self, p): + """ parameter_type_list : parameter_list + | parameter_list COMMA ELLIPSIS + """ + if len(p) > 2: + p[1].params.append(c_ast.EllipsisParam(self._token_coord(p, 3))) + + p[0] = p[1] + + def p_parameter_list(self, p): + """ parameter_list : parameter_declaration + | parameter_list COMMA parameter_declaration + """ + if len(p) == 2: # single parameter + p[0] = c_ast.ParamList([p[1]], p[1].coord) + else: + p[1].params.append(p[3]) + p[0] = p[1] + + # From ISO/IEC 9899:TC2, 6.7.5.3.11: + # "If, in a parameter declaration, an identifier can be treated either + # as a typedef name or as a parameter name, it shall be taken as a + # typedef name." + # + # Inside a parameter declaration, once we've reduced declaration specifiers, + # if we shift in an LPAREN and see a TYPEID, it could be either an abstract + # declarator or a declarator nested inside parens. This rule tells us to + # always treat it as an abstract declarator. Therefore, we only accept + # `id_declarator`s and `typeid_noparen_declarator`s. + def p_parameter_declaration_1(self, p): + """ parameter_declaration : declaration_specifiers id_declarator + | declaration_specifiers typeid_noparen_declarator + """ + spec = p[1] + if not spec['type']: + spec['type'] = [c_ast.IdentifierType(['int'], + coord=self._token_coord(p, 1))] + p[0] = self._build_declarations( + spec=spec, + decls=[dict(decl=p[2])])[0] + + def p_parameter_declaration_2(self, p): + """ parameter_declaration : declaration_specifiers abstract_declarator_opt + """ + spec = p[1] + if not spec['type']: + spec['type'] = [c_ast.IdentifierType(['int'], + coord=self._token_coord(p, 1))] + + # Parameters can have the same names as typedefs. The trouble is that + # the parameter's name gets grouped into declaration_specifiers, making + # it look like an old-style declaration; compensate. + # + if len(spec['type']) > 1 and len(spec['type'][-1].names) == 1 and \ + self._is_type_in_scope(spec['type'][-1].names[0]): + decl = self._build_declarations( + spec=spec, + decls=[dict(decl=p[2], init=None)])[0] + + # This truly is an old-style parameter declaration + # + else: + decl = c_ast.Typename( + name='', + quals=spec['qual'], + align=None, + type=p[2] or c_ast.TypeDecl(None, None, None, None), + coord=self._token_coord(p, 2)) + typename = spec['type'] + decl = self._fix_decl_name_type(decl, typename) + + p[0] = decl + + def p_identifier_list(self, p): + """ identifier_list : identifier + | identifier_list COMMA identifier + """ + if len(p) == 2: # single parameter + p[0] = c_ast.ParamList([p[1]], p[1].coord) + else: + p[1].params.append(p[3]) + p[0] = p[1] + + def p_initializer_1(self, p): + """ initializer : assignment_expression + """ + p[0] = p[1] + + def p_initializer_2(self, p): + """ initializer : brace_open initializer_list_opt brace_close + | brace_open initializer_list COMMA brace_close + """ + if p[2] is None: + p[0] = c_ast.InitList([], self._token_coord(p, 1)) + else: + p[0] = p[2] + + def p_initializer_list(self, p): + """ initializer_list : designation_opt initializer + | initializer_list COMMA designation_opt initializer + """ + if len(p) == 3: # single initializer + init = p[2] if p[1] is None else c_ast.NamedInitializer(p[1], p[2]) + p[0] = c_ast.InitList([init], p[2].coord) + else: + init = p[4] if p[3] is None else c_ast.NamedInitializer(p[3], p[4]) + p[1].exprs.append(init) + p[0] = p[1] + + def p_designation(self, p): + """ designation : designator_list EQUALS + """ + p[0] = p[1] + + # Designators are represented as a list of nodes, in the order in which + # they're written in the code. + # + def p_designator_list(self, p): + """ designator_list : designator + | designator_list designator + """ + p[0] = [p[1]] if len(p) == 2 else p[1] + [p[2]] + + def p_designator(self, p): + """ designator : LBRACKET constant_expression RBRACKET + | PERIOD identifier + """ + p[0] = p[2] + + def p_type_name(self, p): + """ type_name : specifier_qualifier_list abstract_declarator_opt + """ + typename = c_ast.Typename( + name='', + quals=p[1]['qual'][:], + align=None, + type=p[2] or c_ast.TypeDecl(None, None, None, None), + coord=self._token_coord(p, 2)) + + p[0] = self._fix_decl_name_type(typename, p[1]['type']) + + def p_abstract_declarator_1(self, p): + """ abstract_declarator : pointer + """ + dummytype = c_ast.TypeDecl(None, None, None, None) + p[0] = self._type_modify_decl( + decl=dummytype, + modifier=p[1]) + + def p_abstract_declarator_2(self, p): + """ abstract_declarator : pointer direct_abstract_declarator + """ + p[0] = self._type_modify_decl(p[2], p[1]) + + def p_abstract_declarator_3(self, p): + """ abstract_declarator : direct_abstract_declarator + """ + p[0] = p[1] + + # Creating and using direct_abstract_declarator_opt here + # instead of listing both direct_abstract_declarator and the + # lack of it in the beginning of _1 and _2 caused two + # shift/reduce errors. + # + def p_direct_abstract_declarator_1(self, p): + """ direct_abstract_declarator : LPAREN abstract_declarator RPAREN """ + p[0] = p[2] + + def p_direct_abstract_declarator_2(self, p): + """ direct_abstract_declarator : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET + """ + arr = c_ast.ArrayDecl( + type=None, + dim=p[3], + dim_quals=[], + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_abstract_declarator_3(self, p): + """ direct_abstract_declarator : LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET + """ + quals = (p[2] if len(p) > 4 else []) or [] + p[0] = c_ast.ArrayDecl( + type=c_ast.TypeDecl(None, None, None, None), + dim=p[3] if len(p) > 4 else p[2], + dim_quals=quals, + coord=self._token_coord(p, 1)) + + def p_direct_abstract_declarator_4(self, p): + """ direct_abstract_declarator : direct_abstract_declarator LBRACKET TIMES RBRACKET + """ + arr = c_ast.ArrayDecl( + type=None, + dim=c_ast.ID(p[3], self._token_coord(p, 3)), + dim_quals=[], + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_abstract_declarator_5(self, p): + """ direct_abstract_declarator : LBRACKET TIMES RBRACKET + """ + p[0] = c_ast.ArrayDecl( + type=c_ast.TypeDecl(None, None, None, None), + dim=c_ast.ID(p[3], self._token_coord(p, 3)), + dim_quals=[], + coord=self._token_coord(p, 1)) + + def p_direct_abstract_declarator_6(self, p): + """ direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN + """ + func = c_ast.FuncDecl( + args=p[3], + type=None, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=func) + + def p_direct_abstract_declarator_7(self, p): + """ direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN + """ + p[0] = c_ast.FuncDecl( + args=p[2], + type=c_ast.TypeDecl(None, None, None, None), + coord=self._token_coord(p, 1)) + + # declaration is a list, statement isn't. To make it consistent, block_item + # will always be a list + # + def p_block_item(self, p): + """ block_item : declaration + | statement + """ + p[0] = p[1] if isinstance(p[1], list) else [p[1]] + + # Since we made block_item a list, this just combines lists + # + def p_block_item_list(self, p): + """ block_item_list : block_item + | block_item_list block_item + """ + # Empty block items (plain ';') produce [None], so ignore them + p[0] = p[1] if (len(p) == 2 or p[2] == [None]) else p[1] + p[2] + + def p_compound_statement_1(self, p): + """ compound_statement : brace_open block_item_list_opt brace_close """ + p[0] = c_ast.Compound( + block_items=p[2], + coord=self._token_coord(p, 1)) + + def p_labeled_statement_1(self, p): + """ labeled_statement : ID COLON pragmacomp_or_statement """ + p[0] = c_ast.Label(p[1], p[3], self._token_coord(p, 1)) + + def p_labeled_statement_2(self, p): + """ labeled_statement : CASE constant_expression COLON pragmacomp_or_statement """ + p[0] = c_ast.Case(p[2], [p[4]], self._token_coord(p, 1)) + + def p_labeled_statement_3(self, p): + """ labeled_statement : DEFAULT COLON pragmacomp_or_statement """ + p[0] = c_ast.Default([p[3]], self._token_coord(p, 1)) + + def p_selection_statement_1(self, p): + """ selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement """ + p[0] = c_ast.If(p[3], p[5], None, self._token_coord(p, 1)) + + def p_selection_statement_2(self, p): + """ selection_statement : IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement """ + p[0] = c_ast.If(p[3], p[5], p[7], self._token_coord(p, 1)) + + def p_selection_statement_3(self, p): + """ selection_statement : SWITCH LPAREN expression RPAREN pragmacomp_or_statement """ + p[0] = fix_switch_cases( + c_ast.Switch(p[3], p[5], self._token_coord(p, 1))) + + def p_iteration_statement_1(self, p): + """ iteration_statement : WHILE LPAREN expression RPAREN pragmacomp_or_statement """ + p[0] = c_ast.While(p[3], p[5], self._token_coord(p, 1)) + + def p_iteration_statement_2(self, p): + """ iteration_statement : DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI """ + p[0] = c_ast.DoWhile(p[5], p[2], self._token_coord(p, 1)) + + def p_iteration_statement_3(self, p): + """ iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement """ + p[0] = c_ast.For(p[3], p[5], p[7], p[9], self._token_coord(p, 1)) + + def p_iteration_statement_4(self, p): + """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement """ + p[0] = c_ast.For(c_ast.DeclList(p[3], self._token_coord(p, 1)), + p[4], p[6], p[8], self._token_coord(p, 1)) + + def p_jump_statement_1(self, p): + """ jump_statement : GOTO ID SEMI """ + p[0] = c_ast.Goto(p[2], self._token_coord(p, 1)) + + def p_jump_statement_2(self, p): + """ jump_statement : BREAK SEMI """ + p[0] = c_ast.Break(self._token_coord(p, 1)) + + def p_jump_statement_3(self, p): + """ jump_statement : CONTINUE SEMI """ + p[0] = c_ast.Continue(self._token_coord(p, 1)) + + def p_jump_statement_4(self, p): + """ jump_statement : RETURN expression SEMI + | RETURN SEMI + """ + p[0] = c_ast.Return(p[2] if len(p) == 4 else None, self._token_coord(p, 1)) + + def p_expression_statement(self, p): + """ expression_statement : expression_opt SEMI """ + if p[1] is None: + p[0] = c_ast.EmptyStatement(self._token_coord(p, 2)) + else: + p[0] = p[1] + + def p_expression(self, p): + """ expression : assignment_expression + | expression COMMA assignment_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + if not isinstance(p[1], c_ast.ExprList): + p[1] = c_ast.ExprList([p[1]], p[1].coord) + + p[1].exprs.append(p[3]) + p[0] = p[1] + + def p_parenthesized_compound_expression(self, p): + """ assignment_expression : LPAREN compound_statement RPAREN """ + p[0] = p[2] + + def p_typedef_name(self, p): + """ typedef_name : TYPEID """ + p[0] = c_ast.IdentifierType([p[1]], coord=self._token_coord(p, 1)) + + def p_assignment_expression(self, p): + """ assignment_expression : conditional_expression + | unary_expression assignment_operator assignment_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + p[0] = c_ast.Assignment(p[2], p[1], p[3], p[1].coord) + + # K&R2 defines these as many separate rules, to encode + # precedence and associativity. Why work hard ? I'll just use + # the built in precedence/associativity specification feature + # of PLY. (see precedence declaration above) + # + def p_assignment_operator(self, p): + """ assignment_operator : EQUALS + | XOREQUAL + | TIMESEQUAL + | DIVEQUAL + | MODEQUAL + | PLUSEQUAL + | MINUSEQUAL + | LSHIFTEQUAL + | RSHIFTEQUAL + | ANDEQUAL + | OREQUAL + """ + p[0] = p[1] + + def p_constant_expression(self, p): + """ constant_expression : conditional_expression """ + p[0] = p[1] + + def p_conditional_expression(self, p): + """ conditional_expression : binary_expression + | binary_expression CONDOP expression COLON conditional_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + p[0] = c_ast.TernaryOp(p[1], p[3], p[5], p[1].coord) + + def p_binary_expression(self, p): + """ binary_expression : cast_expression + | binary_expression TIMES binary_expression + | binary_expression DIVIDE binary_expression + | binary_expression MOD binary_expression + | binary_expression PLUS binary_expression + | binary_expression MINUS binary_expression + | binary_expression RSHIFT binary_expression + | binary_expression LSHIFT binary_expression + | binary_expression LT binary_expression + | binary_expression LE binary_expression + | binary_expression GE binary_expression + | binary_expression GT binary_expression + | binary_expression EQ binary_expression + | binary_expression NE binary_expression + | binary_expression AND binary_expression + | binary_expression OR binary_expression + | binary_expression XOR binary_expression + | binary_expression LAND binary_expression + | binary_expression LOR binary_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + p[0] = c_ast.BinaryOp(p[2], p[1], p[3], p[1].coord) + + def p_cast_expression_1(self, p): + """ cast_expression : unary_expression """ + p[0] = p[1] + + def p_cast_expression_2(self, p): + """ cast_expression : LPAREN type_name RPAREN cast_expression """ + p[0] = c_ast.Cast(p[2], p[4], self._token_coord(p, 1)) + + def p_unary_expression_1(self, p): + """ unary_expression : postfix_expression """ + p[0] = p[1] + + def p_unary_expression_2(self, p): + """ unary_expression : PLUSPLUS unary_expression + | MINUSMINUS unary_expression + | unary_operator cast_expression + """ + p[0] = c_ast.UnaryOp(p[1], p[2], p[2].coord) + + def p_unary_expression_3(self, p): + """ unary_expression : SIZEOF unary_expression + | SIZEOF LPAREN type_name RPAREN + | _ALIGNOF LPAREN type_name RPAREN + """ + p[0] = c_ast.UnaryOp( + p[1], + p[2] if len(p) == 3 else p[3], + self._token_coord(p, 1)) + + def p_unary_operator(self, p): + """ unary_operator : AND + | TIMES + | PLUS + | MINUS + | NOT + | LNOT + """ + p[0] = p[1] + + def p_postfix_expression_1(self, p): + """ postfix_expression : primary_expression """ + p[0] = p[1] + + def p_postfix_expression_2(self, p): + """ postfix_expression : postfix_expression LBRACKET expression RBRACKET """ + p[0] = c_ast.ArrayRef(p[1], p[3], p[1].coord) + + def p_postfix_expression_3(self, p): + """ postfix_expression : postfix_expression LPAREN argument_expression_list RPAREN + | postfix_expression LPAREN RPAREN + """ + p[0] = c_ast.FuncCall(p[1], p[3] if len(p) == 5 else None, p[1].coord) + + def p_postfix_expression_4(self, p): + """ postfix_expression : postfix_expression PERIOD ID + | postfix_expression PERIOD TYPEID + | postfix_expression ARROW ID + | postfix_expression ARROW TYPEID + """ + field = c_ast.ID(p[3], self._token_coord(p, 3)) + p[0] = c_ast.StructRef(p[1], p[2], field, p[1].coord) + + def p_postfix_expression_5(self, p): + """ postfix_expression : postfix_expression PLUSPLUS + | postfix_expression MINUSMINUS + """ + p[0] = c_ast.UnaryOp('p' + p[2], p[1], p[1].coord) + + def p_postfix_expression_6(self, p): + """ postfix_expression : LPAREN type_name RPAREN brace_open initializer_list brace_close + | LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close + """ + p[0] = c_ast.CompoundLiteral(p[2], p[5]) + + def p_primary_expression_1(self, p): + """ primary_expression : identifier """ + p[0] = p[1] + + def p_primary_expression_2(self, p): + """ primary_expression : constant """ + p[0] = p[1] + + def p_primary_expression_3(self, p): + """ primary_expression : unified_string_literal + | unified_wstring_literal + """ + p[0] = p[1] + + def p_primary_expression_4(self, p): + """ primary_expression : LPAREN expression RPAREN """ + p[0] = p[2] + + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN + """ + coord = self._token_coord(p, 1) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + + def p_offsetof_member_designator(self, p): + """ offsetof_member_designator : identifier + | offsetof_member_designator PERIOD identifier + | offsetof_member_designator LBRACKET expression RBRACKET + """ + if len(p) == 2: + p[0] = p[1] + elif len(p) == 4: + p[0] = c_ast.StructRef(p[1], p[2], p[3], p[1].coord) + elif len(p) == 5: + p[0] = c_ast.ArrayRef(p[1], p[3], p[1].coord) + else: + raise NotImplementedError("Unexpected parsing state. len(p): %u" % len(p)) + + def p_argument_expression_list(self, p): + """ argument_expression_list : assignment_expression + | argument_expression_list COMMA assignment_expression + """ + if len(p) == 2: # single expr + p[0] = c_ast.ExprList([p[1]], p[1].coord) + else: + p[1].exprs.append(p[3]) + p[0] = p[1] + + def p_identifier(self, p): + """ identifier : ID """ + p[0] = c_ast.ID(p[1], self._token_coord(p, 1)) + + def p_constant_1(self, p): + """ constant : INT_CONST_DEC + | INT_CONST_OCT + | INT_CONST_HEX + | INT_CONST_BIN + | INT_CONST_CHAR + """ + uCount = 0 + lCount = 0 + for x in p[1][-3:]: + if x in ('l', 'L'): + lCount += 1 + elif x in ('u', 'U'): + uCount += 1 + t = '' + if uCount > 1: + raise ValueError('Constant cannot have more than one u/U suffix.') + elif lCount > 2: + raise ValueError('Constant cannot have more than two l/L suffix.') + prefix = 'unsigned ' * uCount + 'long ' * lCount + p[0] = c_ast.Constant( + prefix + 'int', p[1], self._token_coord(p, 1)) + + def p_constant_2(self, p): + """ constant : FLOAT_CONST + | HEX_FLOAT_CONST + """ + if 'x' in p[1].lower(): + t = 'float' + else: + if p[1][-1] in ('f', 'F'): + t = 'float' + elif p[1][-1] in ('l', 'L'): + t = 'long double' + else: + t = 'double' + + p[0] = c_ast.Constant( + t, p[1], self._token_coord(p, 1)) + + def p_constant_3(self, p): + """ constant : CHAR_CONST + | WCHAR_CONST + | U8CHAR_CONST + | U16CHAR_CONST + | U32CHAR_CONST + """ + p[0] = c_ast.Constant( + 'char', p[1], self._token_coord(p, 1)) + + # The "unified" string and wstring literal rules are for supporting + # concatenation of adjacent string literals. + # I.e. "hello " "world" is seen by the C compiler as a single string literal + # with the value "hello world" + # + def p_unified_string_literal(self, p): + """ unified_string_literal : STRING_LITERAL + | unified_string_literal STRING_LITERAL + """ + if len(p) == 2: # single literal + p[0] = c_ast.Constant( + 'string', p[1], self._token_coord(p, 1)) + else: + p[1].value = p[1].value[:-1] + p[2][1:] + p[0] = p[1] + + def p_unified_wstring_literal(self, p): + """ unified_wstring_literal : WSTRING_LITERAL + | U8STRING_LITERAL + | U16STRING_LITERAL + | U32STRING_LITERAL + | unified_wstring_literal WSTRING_LITERAL + | unified_wstring_literal U8STRING_LITERAL + | unified_wstring_literal U16STRING_LITERAL + | unified_wstring_literal U32STRING_LITERAL + """ + if len(p) == 2: # single literal + p[0] = c_ast.Constant( + 'string', p[1], self._token_coord(p, 1)) + else: + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] + p[0] = p[1] + + def p_brace_open(self, p): + """ brace_open : LBRACE + """ + p[0] = p[1] + p.set_lineno(0, p.lineno(1)) + + def p_brace_close(self, p): + """ brace_close : RBRACE + """ + p[0] = p[1] + p.set_lineno(0, p.lineno(1)) + + def p_empty(self, p): + 'empty : ' + p[0] = None + + def p_error(self, p): + # If error recovery is added here in the future, make sure + # _get_yacc_lookahead_token still works! + # + if p: + self._parse_error( + 'before: %s' % p.value, + self._coord(lineno=p.lineno, + column=self.clex.find_tok_column(p))) + else: + self._parse_error('At end of input', self.clex.filename) diff --git a/billinglayer/python/pycparser/lextab.py b/billinglayer/python/pycparser/lextab.py new file mode 100644 index 0000000..444b465 --- /dev/null +++ b/billinglayer/python/pycparser/lextab.py @@ -0,0 +1,10 @@ +# lextab.py. This file automatically created by PLY (version 3.10). Don't edit! +_tabversion = '3.10' +_lextokens = set(('INT_CONST_CHAR', 'VOID', 'LBRACKET', 'WCHAR_CONST', 'FLOAT_CONST', 'MINUS', 'RPAREN', 'STRUCT', 'LONG', 'PLUS', 'ELLIPSIS', 'U32STRING_LITERAL', 'GT', 'GOTO', 'ENUM', 'PERIOD', 'GE', 'INT_CONST_DEC', 'ARROW', '_STATIC_ASSERT', '__INT128', 'HEX_FLOAT_CONST', 'DOUBLE', 'MINUSEQUAL', 'INT_CONST_OCT', 'TIMESEQUAL', 'OR', 'SHORT', 'RETURN', 'RSHIFTEQUAL', '_ALIGNAS', 'RESTRICT', 'STATIC', 'SIZEOF', 'UNSIGNED', 'PLUSPLUS', 'COLON', 'WSTRING_LITERAL', 'DIVIDE', 'FOR', 'UNION', 'EQUALS', 'ELSE', 'ANDEQUAL', 'EQ', 'AND', 'TYPEID', 'LBRACE', 'PPHASH', 'INT', 'SIGNED', 'CONTINUE', 'NOT', 'OREQUAL', 'MOD', 'RSHIFT', 'DEFAULT', '_NORETURN', 'CHAR', 'WHILE', 'DIVEQUAL', '_ALIGNOF', 'EXTERN', 'LNOT', 'CASE', 'LAND', 'REGISTER', 'MODEQUAL', 'NE', 'SWITCH', 'INT_CONST_HEX', '_COMPLEX', 'PPPRAGMASTR', 'PLUSEQUAL', 'U32CHAR_CONST', 'CONDOP', 'U8STRING_LITERAL', 'BREAK', 'VOLATILE', 'PPPRAGMA', 'INLINE', 'INT_CONST_BIN', 'DO', 'U8CHAR_CONST', 'CONST', 'U16STRING_LITERAL', 'LOR', 'CHAR_CONST', 'LSHIFT', 'RBRACE', '_BOOL', 'LE', 'SEMI', '_THREAD_LOCAL', 'LT', 'COMMA', 'U16CHAR_CONST', 'OFFSETOF', '_ATOMIC', 'TYPEDEF', 'XOR', 'AUTO', 'TIMES', 'LPAREN', 'MINUSMINUS', 'ID', 'IF', 'STRING_LITERAL', 'FLOAT', 'XOREQUAL', 'LSHIFTEQUAL', 'RBRACKET')) +_lexreflags = 64 +_lexliterals = '' +_lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P.+)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX'), None, None, None, None, None, None, None, ('t_INT_CONST_BIN', 'INT_CONST_BIN')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F])))){2,4}\')|(?P\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?Pu8\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?Pu\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?PU\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_INT_CONST_CHAR', 'INT_CONST_CHAR'), None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_U8CHAR_CONST', 'U8CHAR_CONST'), None, None, None, None, None, None, ('t_U16CHAR_CONST', 'U16CHAR_CONST'), None, None, None, None, None, None, ('t_U32CHAR_CONST', 'U32CHAR_CONST')]), ('(?P(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?Pu8"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?Pu"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?PU"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)', [None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, ('t_U8STRING_LITERAL', 'U8STRING_LITERAL'), None, None, ('t_U16STRING_LITERAL', 'U16STRING_LITERAL'), None, None, ('t_U32STRING_LITERAL', 'U32STRING_LITERAL'), None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL')]), ('(?P\\+)|(?P%=)|(?P/=)|(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t', 'INITIAL': ' \t'} +_lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} +_lexstateeoff = {} diff --git a/billinglayer/python/pycparser/ply/__init__.py b/billinglayer/python/pycparser/ply/__init__.py new file mode 100644 index 0000000..6e53cdd --- /dev/null +++ b/billinglayer/python/pycparser/ply/__init__.py @@ -0,0 +1,5 @@ +# PLY package +# Author: David Beazley (dave@dabeaz.com) + +__version__ = '3.9' +__all__ = ['lex','yacc'] diff --git a/billinglayer/python/pycparser/ply/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/pycparser/ply/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..0ebdac1 Binary files /dev/null and b/billinglayer/python/pycparser/ply/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/ply/__pycache__/cpp.cpython-311.pyc b/billinglayer/python/pycparser/ply/__pycache__/cpp.cpython-311.pyc new file mode 100644 index 0000000..28f4f3e Binary files /dev/null and b/billinglayer/python/pycparser/ply/__pycache__/cpp.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/ply/__pycache__/ctokens.cpython-311.pyc b/billinglayer/python/pycparser/ply/__pycache__/ctokens.cpython-311.pyc new file mode 100644 index 0000000..08f64a8 Binary files /dev/null and b/billinglayer/python/pycparser/ply/__pycache__/ctokens.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/ply/__pycache__/lex.cpython-311.pyc b/billinglayer/python/pycparser/ply/__pycache__/lex.cpython-311.pyc new file mode 100644 index 0000000..b4e8537 Binary files /dev/null and b/billinglayer/python/pycparser/ply/__pycache__/lex.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/ply/__pycache__/yacc.cpython-311.pyc b/billinglayer/python/pycparser/ply/__pycache__/yacc.cpython-311.pyc new file mode 100644 index 0000000..eadaca8 Binary files /dev/null and b/billinglayer/python/pycparser/ply/__pycache__/yacc.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/ply/__pycache__/ygen.cpython-311.pyc b/billinglayer/python/pycparser/ply/__pycache__/ygen.cpython-311.pyc new file mode 100644 index 0000000..4427edf Binary files /dev/null and b/billinglayer/python/pycparser/ply/__pycache__/ygen.cpython-311.pyc differ diff --git a/billinglayer/python/pycparser/ply/cpp.py b/billinglayer/python/pycparser/ply/cpp.py new file mode 100644 index 0000000..86273ea --- /dev/null +++ b/billinglayer/python/pycparser/ply/cpp.py @@ -0,0 +1,905 @@ +# ----------------------------------------------------------------------------- +# cpp.py +# +# Author: David Beazley (http://www.dabeaz.com) +# Copyright (C) 2017 +# All rights reserved +# +# This module implements an ANSI-C style lexical preprocessor for PLY. +# ----------------------------------------------------------------------------- +import sys + +# Some Python 3 compatibility shims +if sys.version_info.major < 3: + STRING_TYPES = (str, unicode) +else: + STRING_TYPES = str + xrange = range + +# ----------------------------------------------------------------------------- +# Default preprocessor lexer definitions. These tokens are enough to get +# a basic preprocessor working. Other modules may import these if they want +# ----------------------------------------------------------------------------- + +tokens = ( + 'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT1', 'CPP_COMMENT2', 'CPP_POUND','CPP_DPOUND' +) + +literals = "+-*/%|&~^<>=!?()[]{}.,;:\\\'\"" + +# Whitespace +def t_CPP_WS(t): + r'\s+' + t.lexer.lineno += t.value.count("\n") + return t + +t_CPP_POUND = r'\#' +t_CPP_DPOUND = r'\#\#' + +# Identifier +t_CPP_ID = r'[A-Za-z_][\w_]*' + +# Integer literal +def CPP_INTEGER(t): + r'(((((0x)|(0X))[0-9a-fA-F]+)|(\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)' + return t + +t_CPP_INTEGER = CPP_INTEGER + +# Floating literal +t_CPP_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' + +# String literal +def t_CPP_STRING(t): + r'\"([^\\\n]|(\\(.|\n)))*?\"' + t.lexer.lineno += t.value.count("\n") + return t + +# Character constant 'c' or L'c' +def t_CPP_CHAR(t): + r'(L)?\'([^\\\n]|(\\(.|\n)))*?\'' + t.lexer.lineno += t.value.count("\n") + return t + +# Comment +def t_CPP_COMMENT1(t): + r'(/\*(.|\n)*?\*/)' + ncr = t.value.count("\n") + t.lexer.lineno += ncr + # replace with one space or a number of '\n' + t.type = 'CPP_WS'; t.value = '\n' * ncr if ncr else ' ' + return t + +# Line comment +def t_CPP_COMMENT2(t): + r'(//.*?(\n|$))' + # replace with '/n' + t.type = 'CPP_WS'; t.value = '\n' + return t + +def t_error(t): + t.type = t.value[0] + t.value = t.value[0] + t.lexer.skip(1) + return t + +import re +import copy +import time +import os.path + +# ----------------------------------------------------------------------------- +# trigraph() +# +# Given an input string, this function replaces all trigraph sequences. +# The following mapping is used: +# +# ??= # +# ??/ \ +# ??' ^ +# ??( [ +# ??) ] +# ??! | +# ??< { +# ??> } +# ??- ~ +# ----------------------------------------------------------------------------- + +_trigraph_pat = re.compile(r'''\?\?[=/\'\(\)\!<>\-]''') +_trigraph_rep = { + '=':'#', + '/':'\\', + "'":'^', + '(':'[', + ')':']', + '!':'|', + '<':'{', + '>':'}', + '-':'~' +} + +def trigraph(input): + return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input) + +# ------------------------------------------------------------------ +# Macro object +# +# This object holds information about preprocessor macros +# +# .name - Macro name (string) +# .value - Macro value (a list of tokens) +# .arglist - List of argument names +# .variadic - Boolean indicating whether or not variadic macro +# .vararg - Name of the variadic parameter +# +# When a macro is created, the macro replacement token sequence is +# pre-scanned and used to create patch lists that are later used +# during macro expansion +# ------------------------------------------------------------------ + +class Macro(object): + def __init__(self,name,value,arglist=None,variadic=False): + self.name = name + self.value = value + self.arglist = arglist + self.variadic = variadic + if variadic: + self.vararg = arglist[-1] + self.source = None + +# ------------------------------------------------------------------ +# Preprocessor object +# +# Object representing a preprocessor. Contains macro definitions, +# include directories, and other information +# ------------------------------------------------------------------ + +class Preprocessor(object): + def __init__(self,lexer=None): + if lexer is None: + lexer = lex.lexer + self.lexer = lexer + self.macros = { } + self.path = [] + self.temp_path = [] + + # Probe the lexer for selected tokens + self.lexprobe() + + tm = time.localtime() + self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm)) + self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm)) + self.parser = None + + # ----------------------------------------------------------------------------- + # tokenize() + # + # Utility function. Given a string of text, tokenize into a list of tokens + # ----------------------------------------------------------------------------- + + def tokenize(self,text): + tokens = [] + self.lexer.input(text) + while True: + tok = self.lexer.token() + if not tok: break + tokens.append(tok) + return tokens + + # --------------------------------------------------------------------- + # error() + # + # Report a preprocessor error/warning of some kind + # ---------------------------------------------------------------------- + + def error(self,file,line,msg): + print("%s:%d %s" % (file,line,msg)) + + # ---------------------------------------------------------------------- + # lexprobe() + # + # This method probes the preprocessor lexer object to discover + # the token types of symbols that are important to the preprocessor. + # If this works right, the preprocessor will simply "work" + # with any suitable lexer regardless of how tokens have been named. + # ---------------------------------------------------------------------- + + def lexprobe(self): + + # Determine the token type for identifiers + self.lexer.input("identifier") + tok = self.lexer.token() + if not tok or tok.value != "identifier": + print("Couldn't determine identifier type") + else: + self.t_ID = tok.type + + # Determine the token type for integers + self.lexer.input("12345") + tok = self.lexer.token() + if not tok or int(tok.value) != 12345: + print("Couldn't determine integer type") + else: + self.t_INTEGER = tok.type + self.t_INTEGER_TYPE = type(tok.value) + + # Determine the token type for strings enclosed in double quotes + self.lexer.input("\"filename\"") + tok = self.lexer.token() + if not tok or tok.value != "\"filename\"": + print("Couldn't determine string type") + else: + self.t_STRING = tok.type + + # Determine the token type for whitespace--if any + self.lexer.input(" ") + tok = self.lexer.token() + if not tok or tok.value != " ": + self.t_SPACE = None + else: + self.t_SPACE = tok.type + + # Determine the token type for newlines + self.lexer.input("\n") + tok = self.lexer.token() + if not tok or tok.value != "\n": + self.t_NEWLINE = None + print("Couldn't determine token for newlines") + else: + self.t_NEWLINE = tok.type + + self.t_WS = (self.t_SPACE, self.t_NEWLINE) + + # Check for other characters used by the preprocessor + chars = [ '<','>','#','##','\\','(',')',',','.'] + for c in chars: + self.lexer.input(c) + tok = self.lexer.token() + if not tok or tok.value != c: + print("Unable to lex '%s' required for preprocessor" % c) + + # ---------------------------------------------------------------------- + # add_path() + # + # Adds a search path to the preprocessor. + # ---------------------------------------------------------------------- + + def add_path(self,path): + self.path.append(path) + + # ---------------------------------------------------------------------- + # group_lines() + # + # Given an input string, this function splits it into lines. Trailing whitespace + # is removed. Any line ending with \ is grouped with the next line. This + # function forms the lowest level of the preprocessor---grouping into text into + # a line-by-line format. + # ---------------------------------------------------------------------- + + def group_lines(self,input): + lex = self.lexer.clone() + lines = [x.rstrip() for x in input.splitlines()] + for i in xrange(len(lines)): + j = i+1 + while lines[i].endswith('\\') and (j < len(lines)): + lines[i] = lines[i][:-1]+lines[j] + lines[j] = "" + j += 1 + + input = "\n".join(lines) + lex.input(input) + lex.lineno = 1 + + current_line = [] + while True: + tok = lex.token() + if not tok: + break + current_line.append(tok) + if tok.type in self.t_WS and '\n' in tok.value: + yield current_line + current_line = [] + + if current_line: + yield current_line + + # ---------------------------------------------------------------------- + # tokenstrip() + # + # Remove leading/trailing whitespace tokens from a token list + # ---------------------------------------------------------------------- + + def tokenstrip(self,tokens): + i = 0 + while i < len(tokens) and tokens[i].type in self.t_WS: + i += 1 + del tokens[:i] + i = len(tokens)-1 + while i >= 0 and tokens[i].type in self.t_WS: + i -= 1 + del tokens[i+1:] + return tokens + + + # ---------------------------------------------------------------------- + # collect_args() + # + # Collects comma separated arguments from a list of tokens. The arguments + # must be enclosed in parenthesis. Returns a tuple (tokencount,args,positions) + # where tokencount is the number of tokens consumed, args is a list of arguments, + # and positions is a list of integers containing the starting index of each + # argument. Each argument is represented by a list of tokens. + # + # When collecting arguments, leading and trailing whitespace is removed + # from each argument. + # + # This function properly handles nested parenthesis and commas---these do not + # define new arguments. + # ---------------------------------------------------------------------- + + def collect_args(self,tokenlist): + args = [] + positions = [] + current_arg = [] + nesting = 1 + tokenlen = len(tokenlist) + + # Search for the opening '('. + i = 0 + while (i < tokenlen) and (tokenlist[i].type in self.t_WS): + i += 1 + + if (i < tokenlen) and (tokenlist[i].value == '('): + positions.append(i+1) + else: + self.error(self.source,tokenlist[0].lineno,"Missing '(' in macro arguments") + return 0, [], [] + + i += 1 + + while i < tokenlen: + t = tokenlist[i] + if t.value == '(': + current_arg.append(t) + nesting += 1 + elif t.value == ')': + nesting -= 1 + if nesting == 0: + if current_arg: + args.append(self.tokenstrip(current_arg)) + positions.append(i) + return i+1,args,positions + current_arg.append(t) + elif t.value == ',' and nesting == 1: + args.append(self.tokenstrip(current_arg)) + positions.append(i+1) + current_arg = [] + else: + current_arg.append(t) + i += 1 + + # Missing end argument + self.error(self.source,tokenlist[-1].lineno,"Missing ')' in macro arguments") + return 0, [],[] + + # ---------------------------------------------------------------------- + # macro_prescan() + # + # Examine the macro value (token sequence) and identify patch points + # This is used to speed up macro expansion later on---we'll know + # right away where to apply patches to the value to form the expansion + # ---------------------------------------------------------------------- + + def macro_prescan(self,macro): + macro.patch = [] # Standard macro arguments + macro.str_patch = [] # String conversion expansion + macro.var_comma_patch = [] # Variadic macro comma patch + i = 0 + while i < len(macro.value): + if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist: + argnum = macro.arglist.index(macro.value[i].value) + # Conversion of argument to a string + if i > 0 and macro.value[i-1].value == '#': + macro.value[i] = copy.copy(macro.value[i]) + macro.value[i].type = self.t_STRING + del macro.value[i-1] + macro.str_patch.append((argnum,i-1)) + continue + # Concatenation + elif (i > 0 and macro.value[i-1].value == '##'): + macro.patch.append(('c',argnum,i-1)) + del macro.value[i-1] + continue + elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'): + macro.patch.append(('c',argnum,i)) + i += 1 + continue + # Standard expansion + else: + macro.patch.append(('e',argnum,i)) + elif macro.value[i].value == '##': + if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \ + ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \ + (macro.value[i+1].value == macro.vararg): + macro.var_comma_patch.append(i-1) + i += 1 + macro.patch.sort(key=lambda x: x[2],reverse=True) + + # ---------------------------------------------------------------------- + # macro_expand_args() + # + # Given a Macro and list of arguments (each a token list), this method + # returns an expanded version of a macro. The return value is a token sequence + # representing the replacement macro tokens + # ---------------------------------------------------------------------- + + def macro_expand_args(self,macro,args): + # Make a copy of the macro token sequence + rep = [copy.copy(_x) for _x in macro.value] + + # Make string expansion patches. These do not alter the length of the replacement sequence + + str_expansion = {} + for argnum, i in macro.str_patch: + if argnum not in str_expansion: + str_expansion[argnum] = ('"%s"' % "".join([x.value for x in args[argnum]])).replace("\\","\\\\") + rep[i] = copy.copy(rep[i]) + rep[i].value = str_expansion[argnum] + + # Make the variadic macro comma patch. If the variadic macro argument is empty, we get rid + comma_patch = False + if macro.variadic and not args[-1]: + for i in macro.var_comma_patch: + rep[i] = None + comma_patch = True + + # Make all other patches. The order of these matters. It is assumed that the patch list + # has been sorted in reverse order of patch location since replacements will cause the + # size of the replacement sequence to expand from the patch point. + + expanded = { } + for ptype, argnum, i in macro.patch: + # Concatenation. Argument is left unexpanded + if ptype == 'c': + rep[i:i+1] = args[argnum] + # Normal expansion. Argument is macro expanded first + elif ptype == 'e': + if argnum not in expanded: + expanded[argnum] = self.expand_macros(args[argnum]) + rep[i:i+1] = expanded[argnum] + + # Get rid of removed comma if necessary + if comma_patch: + rep = [_i for _i in rep if _i] + + return rep + + + # ---------------------------------------------------------------------- + # expand_macros() + # + # Given a list of tokens, this function performs macro expansion. + # The expanded argument is a dictionary that contains macros already + # expanded. This is used to prevent infinite recursion. + # ---------------------------------------------------------------------- + + def expand_macros(self,tokens,expanded=None): + if expanded is None: + expanded = {} + i = 0 + while i < len(tokens): + t = tokens[i] + if t.type == self.t_ID: + if t.value in self.macros and t.value not in expanded: + # Yes, we found a macro match + expanded[t.value] = True + + m = self.macros[t.value] + if not m.arglist: + # A simple macro + ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded) + for e in ex: + e.lineno = t.lineno + tokens[i:i+1] = ex + i += len(ex) + else: + # A macro with arguments + j = i + 1 + while j < len(tokens) and tokens[j].type in self.t_WS: + j += 1 + if tokens[j].value == '(': + tokcount,args,positions = self.collect_args(tokens[j:]) + if not m.variadic and len(args) != len(m.arglist): + self.error(self.source,t.lineno,"Macro %s requires %d arguments" % (t.value,len(m.arglist))) + i = j + tokcount + elif m.variadic and len(args) < len(m.arglist)-1: + if len(m.arglist) > 2: + self.error(self.source,t.lineno,"Macro %s must have at least %d arguments" % (t.value, len(m.arglist)-1)) + else: + self.error(self.source,t.lineno,"Macro %s must have at least %d argument" % (t.value, len(m.arglist)-1)) + i = j + tokcount + else: + if m.variadic: + if len(args) == len(m.arglist)-1: + args.append([]) + else: + args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1] + del args[len(m.arglist):] + + # Get macro replacement text + rep = self.macro_expand_args(m,args) + rep = self.expand_macros(rep,expanded) + for r in rep: + r.lineno = t.lineno + tokens[i:j+tokcount] = rep + i += len(rep) + del expanded[t.value] + continue + elif t.value == '__LINE__': + t.type = self.t_INTEGER + t.value = self.t_INTEGER_TYPE(t.lineno) + + i += 1 + return tokens + + # ---------------------------------------------------------------------- + # evalexpr() + # + # Evaluate an expression token sequence for the purposes of evaluating + # integral expressions. + # ---------------------------------------------------------------------- + + def evalexpr(self,tokens): + # tokens = tokenize(line) + # Search for defined macros + i = 0 + while i < len(tokens): + if tokens[i].type == self.t_ID and tokens[i].value == 'defined': + j = i + 1 + needparen = False + result = "0L" + while j < len(tokens): + if tokens[j].type in self.t_WS: + j += 1 + continue + elif tokens[j].type == self.t_ID: + if tokens[j].value in self.macros: + result = "1L" + else: + result = "0L" + if not needparen: break + elif tokens[j].value == '(': + needparen = True + elif tokens[j].value == ')': + break + else: + self.error(self.source,tokens[i].lineno,"Malformed defined()") + j += 1 + tokens[i].type = self.t_INTEGER + tokens[i].value = self.t_INTEGER_TYPE(result) + del tokens[i+1:j+1] + i += 1 + tokens = self.expand_macros(tokens) + for i,t in enumerate(tokens): + if t.type == self.t_ID: + tokens[i] = copy.copy(t) + tokens[i].type = self.t_INTEGER + tokens[i].value = self.t_INTEGER_TYPE("0L") + elif t.type == self.t_INTEGER: + tokens[i] = copy.copy(t) + # Strip off any trailing suffixes + tokens[i].value = str(tokens[i].value) + while tokens[i].value[-1] not in "0123456789abcdefABCDEF": + tokens[i].value = tokens[i].value[:-1] + + expr = "".join([str(x.value) for x in tokens]) + expr = expr.replace("&&"," and ") + expr = expr.replace("||"," or ") + expr = expr.replace("!"," not ") + try: + result = eval(expr) + except Exception: + self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression") + result = 0 + return result + + # ---------------------------------------------------------------------- + # parsegen() + # + # Parse an input string/ + # ---------------------------------------------------------------------- + def parsegen(self,input,source=None): + + # Replace trigraph sequences + t = trigraph(input) + lines = self.group_lines(t) + + if not source: + source = "" + + self.define("__FILE__ \"%s\"" % source) + + self.source = source + chunk = [] + enable = True + iftrigger = False + ifstack = [] + + for x in lines: + for i,tok in enumerate(x): + if tok.type not in self.t_WS: break + if tok.value == '#': + # Preprocessor directive + + # insert necessary whitespace instead of eaten tokens + for tok in x: + if tok.type in self.t_WS and '\n' in tok.value: + chunk.append(tok) + + dirtokens = self.tokenstrip(x[i+1:]) + if dirtokens: + name = dirtokens[0].value + args = self.tokenstrip(dirtokens[1:]) + else: + name = "" + args = [] + + if name == 'define': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + self.define(args) + elif name == 'include': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + oldfile = self.macros['__FILE__'] + for tok in self.include(args): + yield tok + self.macros['__FILE__'] = oldfile + self.source = source + elif name == 'undef': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + self.undef(args) + elif name == 'ifdef': + ifstack.append((enable,iftrigger)) + if enable: + if not args[0].value in self.macros: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'ifndef': + ifstack.append((enable,iftrigger)) + if enable: + if args[0].value in self.macros: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'if': + ifstack.append((enable,iftrigger)) + if enable: + result = self.evalexpr(args) + if not result: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'elif': + if ifstack: + if ifstack[-1][0]: # We only pay attention if outer "if" allows this + if enable: # If already true, we flip enable False + enable = False + elif not iftrigger: # If False, but not triggered yet, we'll check expression + result = self.evalexpr(args) + if result: + enable = True + iftrigger = True + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #elif") + + elif name == 'else': + if ifstack: + if ifstack[-1][0]: + if enable: + enable = False + elif not iftrigger: + enable = True + iftrigger = True + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #else") + + elif name == 'endif': + if ifstack: + enable,iftrigger = ifstack.pop() + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #endif") + else: + # Unknown preprocessor directive + pass + + else: + # Normal text + if enable: + chunk.extend(x) + + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + + # ---------------------------------------------------------------------- + # include() + # + # Implementation of file-inclusion + # ---------------------------------------------------------------------- + + def include(self,tokens): + # Try to extract the filename and then process an include file + if not tokens: + return + if tokens: + if tokens[0].value != '<' and tokens[0].type != self.t_STRING: + tokens = self.expand_macros(tokens) + + if tokens[0].value == '<': + # Include <...> + i = 1 + while i < len(tokens): + if tokens[i].value == '>': + break + i += 1 + else: + print("Malformed #include <...>") + return + filename = "".join([x.value for x in tokens[1:i]]) + path = self.path + [""] + self.temp_path + elif tokens[0].type == self.t_STRING: + filename = tokens[0].value[1:-1] + path = self.temp_path + [""] + self.path + else: + print("Malformed #include statement") + return + for p in path: + iname = os.path.join(p,filename) + try: + data = open(iname,"r").read() + dname = os.path.dirname(iname) + if dname: + self.temp_path.insert(0,dname) + for tok in self.parsegen(data,filename): + yield tok + if dname: + del self.temp_path[0] + break + except IOError: + pass + else: + print("Couldn't find '%s'" % filename) + + # ---------------------------------------------------------------------- + # define() + # + # Define a new macro + # ---------------------------------------------------------------------- + + def define(self,tokens): + if isinstance(tokens,STRING_TYPES): + tokens = self.tokenize(tokens) + + linetok = tokens + try: + name = linetok[0] + if len(linetok) > 1: + mtype = linetok[1] + else: + mtype = None + if not mtype: + m = Macro(name.value,[]) + self.macros[name.value] = m + elif mtype.type in self.t_WS: + # A normal macro + m = Macro(name.value,self.tokenstrip(linetok[2:])) + self.macros[name.value] = m + elif mtype.value == '(': + # A macro with arguments + tokcount, args, positions = self.collect_args(linetok[1:]) + variadic = False + for a in args: + if variadic: + print("No more arguments may follow a variadic argument") + break + astr = "".join([str(_i.value) for _i in a]) + if astr == "...": + variadic = True + a[0].type = self.t_ID + a[0].value = '__VA_ARGS__' + variadic = True + del a[1:] + continue + elif astr[-3:] == "..." and a[0].type == self.t_ID: + variadic = True + del a[1:] + # If, for some reason, "." is part of the identifier, strip off the name for the purposes + # of macro expansion + if a[0].value[-3:] == '...': + a[0].value = a[0].value[:-3] + continue + if len(a) > 1 or a[0].type != self.t_ID: + print("Invalid macro argument") + break + else: + mvalue = self.tokenstrip(linetok[1+tokcount:]) + i = 0 + while i < len(mvalue): + if i+1 < len(mvalue): + if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##': + del mvalue[i] + continue + elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS: + del mvalue[i+1] + i += 1 + m = Macro(name.value,mvalue,[x[0].value for x in args],variadic) + self.macro_prescan(m) + self.macros[name.value] = m + else: + print("Bad macro definition") + except LookupError: + print("Bad macro definition") + + # ---------------------------------------------------------------------- + # undef() + # + # Undefine a macro + # ---------------------------------------------------------------------- + + def undef(self,tokens): + id = tokens[0].value + try: + del self.macros[id] + except LookupError: + pass + + # ---------------------------------------------------------------------- + # parse() + # + # Parse input text. + # ---------------------------------------------------------------------- + def parse(self,input,source=None,ignore={}): + self.ignore = ignore + self.parser = self.parsegen(input,source) + + # ---------------------------------------------------------------------- + # token() + # + # Method to return individual tokens + # ---------------------------------------------------------------------- + def token(self): + try: + while True: + tok = next(self.parser) + if tok.type not in self.ignore: return tok + except StopIteration: + self.parser = None + return None + +if __name__ == '__main__': + import ply.lex as lex + lexer = lex.lex() + + # Run a preprocessor + import sys + f = open(sys.argv[1]) + input = f.read() + + p = Preprocessor(lexer) + p.parse(input,sys.argv[1]) + while True: + tok = p.token() + if not tok: break + print(p.source, tok) diff --git a/billinglayer/python/pycparser/ply/ctokens.py b/billinglayer/python/pycparser/ply/ctokens.py new file mode 100644 index 0000000..f6f6952 --- /dev/null +++ b/billinglayer/python/pycparser/ply/ctokens.py @@ -0,0 +1,133 @@ +# ---------------------------------------------------------------------- +# ctokens.py +# +# Token specifications for symbols in ANSI C and C++. This file is +# meant to be used as a library in other tokenizers. +# ---------------------------------------------------------------------- + +# Reserved words + +tokens = [ + # Literals (identifier, integer constant, float constant, string constant, char const) + 'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER', + + # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=) + 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO', + 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', + 'LOR', 'LAND', 'LNOT', + 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', + + # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=) + 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL', + 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL', + + # Increment/decrement (++,--) + 'INCREMENT', 'DECREMENT', + + # Structure dereference (->) + 'ARROW', + + # Ternary operator (?) + 'TERNARY', + + # Delimeters ( ) [ ] { } , . ; : + 'LPAREN', 'RPAREN', + 'LBRACKET', 'RBRACKET', + 'LBRACE', 'RBRACE', + 'COMMA', 'PERIOD', 'SEMI', 'COLON', + + # Ellipsis (...) + 'ELLIPSIS', +] + +# Operators +t_PLUS = r'\+' +t_MINUS = r'-' +t_TIMES = r'\*' +t_DIVIDE = r'/' +t_MODULO = r'%' +t_OR = r'\|' +t_AND = r'&' +t_NOT = r'~' +t_XOR = r'\^' +t_LSHIFT = r'<<' +t_RSHIFT = r'>>' +t_LOR = r'\|\|' +t_LAND = r'&&' +t_LNOT = r'!' +t_LT = r'<' +t_GT = r'>' +t_LE = r'<=' +t_GE = r'>=' +t_EQ = r'==' +t_NE = r'!=' + +# Assignment operators + +t_EQUALS = r'=' +t_TIMESEQUAL = r'\*=' +t_DIVEQUAL = r'/=' +t_MODEQUAL = r'%=' +t_PLUSEQUAL = r'\+=' +t_MINUSEQUAL = r'-=' +t_LSHIFTEQUAL = r'<<=' +t_RSHIFTEQUAL = r'>>=' +t_ANDEQUAL = r'&=' +t_OREQUAL = r'\|=' +t_XOREQUAL = r'\^=' + +# Increment/decrement +t_INCREMENT = r'\+\+' +t_DECREMENT = r'--' + +# -> +t_ARROW = r'->' + +# ? +t_TERNARY = r'\?' + +# Delimeters +t_LPAREN = r'\(' +t_RPAREN = r'\)' +t_LBRACKET = r'\[' +t_RBRACKET = r'\]' +t_LBRACE = r'\{' +t_RBRACE = r'\}' +t_COMMA = r',' +t_PERIOD = r'\.' +t_SEMI = r';' +t_COLON = r':' +t_ELLIPSIS = r'\.\.\.' + +# Identifiers +t_ID = r'[A-Za-z_][A-Za-z0-9_]*' + +# Integer literal +t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?' + +# Floating literal +t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' + +# String literal +t_STRING = r'\"([^\\\n]|(\\.))*?\"' + +# Character constant 'c' or L'c' +t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\'' + +# Comment (C-Style) +def t_COMMENT(t): + r'/\*(.|\n)*?\*/' + t.lexer.lineno += t.value.count('\n') + return t + +# Comment (C++-Style) +def t_CPPCOMMENT(t): + r'//.*\n' + t.lexer.lineno += 1 + return t + + + + + + diff --git a/billinglayer/python/pycparser/ply/lex.py b/billinglayer/python/pycparser/ply/lex.py new file mode 100644 index 0000000..4bdd76c --- /dev/null +++ b/billinglayer/python/pycparser/ply/lex.py @@ -0,0 +1,1099 @@ +# ----------------------------------------------------------------------------- +# ply: lex.py +# +# Copyright (C) 2001-2017 +# David M. Beazley (Dabeaz LLC) +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the David Beazley or Dabeaz LLC may be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------------------------- + +__version__ = '3.10' +__tabversion__ = '3.10' + +import re +import sys +import types +import copy +import os +import inspect + +# This tuple contains known string types +try: + # Python 2.6 + StringTypes = (types.StringType, types.UnicodeType) +except AttributeError: + # Python 3.0 + StringTypes = (str, bytes) + +# This regular expression is used to match valid token names +_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$') + +# Exception thrown when invalid token encountered and no default error +# handler is defined. +class LexError(Exception): + def __init__(self, message, s): + self.args = (message,) + self.text = s + + +# Token class. This class is used to represent the tokens produced. +class LexToken(object): + def __str__(self): + return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos) + + def __repr__(self): + return str(self) + + +# This object is a stand-in for a logging object created by the +# logging module. + +class PlyLogger(object): + def __init__(self, f): + self.f = f + + def critical(self, msg, *args, **kwargs): + self.f.write((msg % args) + '\n') + + def warning(self, msg, *args, **kwargs): + self.f.write('WARNING: ' + (msg % args) + '\n') + + def error(self, msg, *args, **kwargs): + self.f.write('ERROR: ' + (msg % args) + '\n') + + info = critical + debug = critical + + +# Null logger is used when no output is generated. Does nothing. +class NullLogger(object): + def __getattribute__(self, name): + return self + + def __call__(self, *args, **kwargs): + return self + + +# ----------------------------------------------------------------------------- +# === Lexing Engine === +# +# The following Lexer class implements the lexer runtime. There are only +# a few public methods and attributes: +# +# input() - Store a new string in the lexer +# token() - Get the next token +# clone() - Clone the lexer +# +# lineno - Current line number +# lexpos - Current position in the input string +# ----------------------------------------------------------------------------- + +class Lexer: + def __init__(self): + self.lexre = None # Master regular expression. This is a list of + # tuples (re, findex) where re is a compiled + # regular expression and findex is a list + # mapping regex group numbers to rules + self.lexretext = None # Current regular expression strings + self.lexstatere = {} # Dictionary mapping lexer states to master regexs + self.lexstateretext = {} # Dictionary mapping lexer states to regex strings + self.lexstaterenames = {} # Dictionary mapping lexer states to symbol names + self.lexstate = 'INITIAL' # Current lexer state + self.lexstatestack = [] # Stack of lexer states + self.lexstateinfo = None # State information + self.lexstateignore = {} # Dictionary of ignored characters for each state + self.lexstateerrorf = {} # Dictionary of error functions for each state + self.lexstateeoff = {} # Dictionary of eof functions for each state + self.lexreflags = 0 # Optional re compile flags + self.lexdata = None # Actual input data (as a string) + self.lexpos = 0 # Current position in input text + self.lexlen = 0 # Length of the input text + self.lexerrorf = None # Error rule (if any) + self.lexeoff = None # EOF rule (if any) + self.lextokens = None # List of valid tokens + self.lexignore = '' # Ignored characters + self.lexliterals = '' # Literal characters that can be passed through + self.lexmodule = None # Module + self.lineno = 1 # Current line number + self.lexoptimize = False # Optimized mode + + def clone(self, object=None): + c = copy.copy(self) + + # If the object parameter has been supplied, it means we are attaching the + # lexer to a new object. In this case, we have to rebind all methods in + # the lexstatere and lexstateerrorf tables. + + if object: + newtab = {} + for key, ritem in self.lexstatere.items(): + newre = [] + for cre, findex in ritem: + newfindex = [] + for f in findex: + if not f or not f[0]: + newfindex.append(f) + continue + newfindex.append((getattr(object, f[0].__name__), f[1])) + newre.append((cre, newfindex)) + newtab[key] = newre + c.lexstatere = newtab + c.lexstateerrorf = {} + for key, ef in self.lexstateerrorf.items(): + c.lexstateerrorf[key] = getattr(object, ef.__name__) + c.lexmodule = object + return c + + # ------------------------------------------------------------ + # writetab() - Write lexer information to a table file + # ------------------------------------------------------------ + def writetab(self, lextab, outputdir=''): + if isinstance(lextab, types.ModuleType): + raise IOError("Won't overwrite existing lextab module") + basetabmodule = lextab.split('.')[-1] + filename = os.path.join(outputdir, basetabmodule) + '.py' + with open(filename, 'w') as tf: + tf.write('# %s.py. This file automatically created by PLY (version %s). Don\'t edit!\n' % (basetabmodule, __version__)) + tf.write('_tabversion = %s\n' % repr(__tabversion__)) + tf.write('_lextokens = set(%s)\n' % repr(tuple(self.lextokens))) + tf.write('_lexreflags = %s\n' % repr(self.lexreflags)) + tf.write('_lexliterals = %s\n' % repr(self.lexliterals)) + tf.write('_lexstateinfo = %s\n' % repr(self.lexstateinfo)) + + # Rewrite the lexstatere table, replacing function objects with function names + tabre = {} + for statename, lre in self.lexstatere.items(): + titem = [] + for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]): + titem.append((retext, _funcs_to_names(func, renames))) + tabre[statename] = titem + + tf.write('_lexstatere = %s\n' % repr(tabre)) + tf.write('_lexstateignore = %s\n' % repr(self.lexstateignore)) + + taberr = {} + for statename, ef in self.lexstateerrorf.items(): + taberr[statename] = ef.__name__ if ef else None + tf.write('_lexstateerrorf = %s\n' % repr(taberr)) + + tabeof = {} + for statename, ef in self.lexstateeoff.items(): + tabeof[statename] = ef.__name__ if ef else None + tf.write('_lexstateeoff = %s\n' % repr(tabeof)) + + # ------------------------------------------------------------ + # readtab() - Read lexer information from a tab file + # ------------------------------------------------------------ + def readtab(self, tabfile, fdict): + if isinstance(tabfile, types.ModuleType): + lextab = tabfile + else: + exec('import %s' % tabfile) + lextab = sys.modules[tabfile] + + if getattr(lextab, '_tabversion', '0.0') != __tabversion__: + raise ImportError('Inconsistent PLY version') + + self.lextokens = lextab._lextokens + self.lexreflags = lextab._lexreflags + self.lexliterals = lextab._lexliterals + self.lextokens_all = self.lextokens | set(self.lexliterals) + self.lexstateinfo = lextab._lexstateinfo + self.lexstateignore = lextab._lexstateignore + self.lexstatere = {} + self.lexstateretext = {} + for statename, lre in lextab._lexstatere.items(): + titem = [] + txtitem = [] + for pat, func_name in lre: + titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict))) + + self.lexstatere[statename] = titem + self.lexstateretext[statename] = txtitem + + self.lexstateerrorf = {} + for statename, ef in lextab._lexstateerrorf.items(): + self.lexstateerrorf[statename] = fdict[ef] + + self.lexstateeoff = {} + for statename, ef in lextab._lexstateeoff.items(): + self.lexstateeoff[statename] = fdict[ef] + + self.begin('INITIAL') + + # ------------------------------------------------------------ + # input() - Push a new string into the lexer + # ------------------------------------------------------------ + def input(self, s): + # Pull off the first character to see if s looks like a string + c = s[:1] + if not isinstance(c, StringTypes): + raise ValueError('Expected a string') + self.lexdata = s + self.lexpos = 0 + self.lexlen = len(s) + + # ------------------------------------------------------------ + # begin() - Changes the lexing state + # ------------------------------------------------------------ + def begin(self, state): + if state not in self.lexstatere: + raise ValueError('Undefined state') + self.lexre = self.lexstatere[state] + self.lexretext = self.lexstateretext[state] + self.lexignore = self.lexstateignore.get(state, '') + self.lexerrorf = self.lexstateerrorf.get(state, None) + self.lexeoff = self.lexstateeoff.get(state, None) + self.lexstate = state + + # ------------------------------------------------------------ + # push_state() - Changes the lexing state and saves old on stack + # ------------------------------------------------------------ + def push_state(self, state): + self.lexstatestack.append(self.lexstate) + self.begin(state) + + # ------------------------------------------------------------ + # pop_state() - Restores the previous state + # ------------------------------------------------------------ + def pop_state(self): + self.begin(self.lexstatestack.pop()) + + # ------------------------------------------------------------ + # current_state() - Returns the current lexing state + # ------------------------------------------------------------ + def current_state(self): + return self.lexstate + + # ------------------------------------------------------------ + # skip() - Skip ahead n characters + # ------------------------------------------------------------ + def skip(self, n): + self.lexpos += n + + # ------------------------------------------------------------ + # opttoken() - Return the next token from the Lexer + # + # Note: This function has been carefully implemented to be as fast + # as possible. Don't make changes unless you really know what + # you are doing + # ------------------------------------------------------------ + def token(self): + # Make local copies of frequently referenced attributes + lexpos = self.lexpos + lexlen = self.lexlen + lexignore = self.lexignore + lexdata = self.lexdata + + while lexpos < lexlen: + # This code provides some short-circuit code for whitespace, tabs, and other ignored characters + if lexdata[lexpos] in lexignore: + lexpos += 1 + continue + + # Look for a regular expression match + for lexre, lexindexfunc in self.lexre: + m = lexre.match(lexdata, lexpos) + if not m: + continue + + # Create a token for return + tok = LexToken() + tok.value = m.group() + tok.lineno = self.lineno + tok.lexpos = lexpos + + i = m.lastindex + func, tok.type = lexindexfunc[i] + + if not func: + # If no token type was set, it's an ignored token + if tok.type: + self.lexpos = m.end() + return tok + else: + lexpos = m.end() + break + + lexpos = m.end() + + # If token is processed by a function, call it + + tok.lexer = self # Set additional attributes useful in token rules + self.lexmatch = m + self.lexpos = lexpos + + newtok = func(tok) + + # Every function must return a token, if nothing, we just move to next token + if not newtok: + lexpos = self.lexpos # This is here in case user has updated lexpos. + lexignore = self.lexignore # This is here in case there was a state change + break + + # Verify type of the token. If not in the token map, raise an error + if not self.lexoptimize: + if newtok.type not in self.lextokens_all: + raise LexError("%s:%d: Rule '%s' returned an unknown token type '%s'" % ( + func.__code__.co_filename, func.__code__.co_firstlineno, + func.__name__, newtok.type), lexdata[lexpos:]) + + return newtok + else: + # No match, see if in literals + if lexdata[lexpos] in self.lexliterals: + tok = LexToken() + tok.value = lexdata[lexpos] + tok.lineno = self.lineno + tok.type = tok.value + tok.lexpos = lexpos + self.lexpos = lexpos + 1 + return tok + + # No match. Call t_error() if defined. + if self.lexerrorf: + tok = LexToken() + tok.value = self.lexdata[lexpos:] + tok.lineno = self.lineno + tok.type = 'error' + tok.lexer = self + tok.lexpos = lexpos + self.lexpos = lexpos + newtok = self.lexerrorf(tok) + if lexpos == self.lexpos: + # Error method didn't change text position at all. This is an error. + raise LexError("Scanning error. Illegal character '%s'" % (lexdata[lexpos]), lexdata[lexpos:]) + lexpos = self.lexpos + if not newtok: + continue + return newtok + + self.lexpos = lexpos + raise LexError("Illegal character '%s' at index %d" % (lexdata[lexpos], lexpos), lexdata[lexpos:]) + + if self.lexeoff: + tok = LexToken() + tok.type = 'eof' + tok.value = '' + tok.lineno = self.lineno + tok.lexpos = lexpos + tok.lexer = self + self.lexpos = lexpos + newtok = self.lexeoff(tok) + return newtok + + self.lexpos = lexpos + 1 + if self.lexdata is None: + raise RuntimeError('No input string given with input()') + return None + + # Iterator interface + def __iter__(self): + return self + + def next(self): + t = self.token() + if t is None: + raise StopIteration + return t + + __next__ = next + +# ----------------------------------------------------------------------------- +# ==== Lex Builder === +# +# The functions and classes below are used to collect lexing information +# and build a Lexer object from it. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# _get_regex(func) +# +# Returns the regular expression assigned to a function either as a doc string +# or as a .regex attribute attached by the @TOKEN decorator. +# ----------------------------------------------------------------------------- +def _get_regex(func): + return getattr(func, 'regex', func.__doc__) + +# ----------------------------------------------------------------------------- +# get_caller_module_dict() +# +# This function returns a dictionary containing all of the symbols defined within +# a caller further down the call stack. This is used to get the environment +# associated with the yacc() call if none was provided. +# ----------------------------------------------------------------------------- +def get_caller_module_dict(levels): + f = sys._getframe(levels) + ldict = f.f_globals.copy() + if f.f_globals != f.f_locals: + ldict.update(f.f_locals) + return ldict + +# ----------------------------------------------------------------------------- +# _funcs_to_names() +# +# Given a list of regular expression functions, this converts it to a list +# suitable for output to a table file +# ----------------------------------------------------------------------------- +def _funcs_to_names(funclist, namelist): + result = [] + for f, name in zip(funclist, namelist): + if f and f[0]: + result.append((name, f[1])) + else: + result.append(f) + return result + +# ----------------------------------------------------------------------------- +# _names_to_funcs() +# +# Given a list of regular expression function names, this converts it back to +# functions. +# ----------------------------------------------------------------------------- +def _names_to_funcs(namelist, fdict): + result = [] + for n in namelist: + if n and n[0]: + result.append((fdict[n[0]], n[1])) + else: + result.append(n) + return result + +# ----------------------------------------------------------------------------- +# _form_master_re() +# +# This function takes a list of all of the regex components and attempts to +# form the master regular expression. Given limitations in the Python re +# module, it may be necessary to break the master regex into separate expressions. +# ----------------------------------------------------------------------------- +def _form_master_re(relist, reflags, ldict, toknames): + if not relist: + return [] + regex = '|'.join(relist) + try: + lexre = re.compile(regex, reflags) + + # Build the index to function map for the matching engine + lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1) + lexindexnames = lexindexfunc[:] + + for f, i in lexre.groupindex.items(): + handle = ldict.get(f, None) + if type(handle) in (types.FunctionType, types.MethodType): + lexindexfunc[i] = (handle, toknames[f]) + lexindexnames[i] = f + elif handle is not None: + lexindexnames[i] = f + if f.find('ignore_') > 0: + lexindexfunc[i] = (None, None) + else: + lexindexfunc[i] = (None, toknames[f]) + + return [(lexre, lexindexfunc)], [regex], [lexindexnames] + except Exception: + m = int(len(relist)/2) + if m == 0: + m = 1 + llist, lre, lnames = _form_master_re(relist[:m], reflags, ldict, toknames) + rlist, rre, rnames = _form_master_re(relist[m:], reflags, ldict, toknames) + return (llist+rlist), (lre+rre), (lnames+rnames) + +# ----------------------------------------------------------------------------- +# def _statetoken(s,names) +# +# Given a declaration name s of the form "t_" and a dictionary whose keys are +# state names, this function returns a tuple (states,tokenname) where states +# is a tuple of state names and tokenname is the name of the token. For example, +# calling this with s = "t_foo_bar_SPAM" might return (('foo','bar'),'SPAM') +# ----------------------------------------------------------------------------- +def _statetoken(s, names): + nonstate = 1 + parts = s.split('_') + for i, part in enumerate(parts[1:], 1): + if part not in names and part != 'ANY': + break + + if i > 1: + states = tuple(parts[1:i]) + else: + states = ('INITIAL',) + + if 'ANY' in states: + states = tuple(names) + + tokenname = '_'.join(parts[i:]) + return (states, tokenname) + + +# ----------------------------------------------------------------------------- +# LexerReflect() +# +# This class represents information needed to build a lexer as extracted from a +# user's input file. +# ----------------------------------------------------------------------------- +class LexerReflect(object): + def __init__(self, ldict, log=None, reflags=0): + self.ldict = ldict + self.error_func = None + self.tokens = [] + self.reflags = reflags + self.stateinfo = {'INITIAL': 'inclusive'} + self.modules = set() + self.error = False + self.log = PlyLogger(sys.stderr) if log is None else log + + # Get all of the basic information + def get_all(self): + self.get_tokens() + self.get_literals() + self.get_states() + self.get_rules() + + # Validate all of the information + def validate_all(self): + self.validate_tokens() + self.validate_literals() + self.validate_rules() + return self.error + + # Get the tokens map + def get_tokens(self): + tokens = self.ldict.get('tokens', None) + if not tokens: + self.log.error('No token list is defined') + self.error = True + return + + if not isinstance(tokens, (list, tuple)): + self.log.error('tokens must be a list or tuple') + self.error = True + return + + if not tokens: + self.log.error('tokens is empty') + self.error = True + return + + self.tokens = tokens + + # Validate the tokens + def validate_tokens(self): + terminals = {} + for n in self.tokens: + if not _is_identifier.match(n): + self.log.error("Bad token name '%s'", n) + self.error = True + if n in terminals: + self.log.warning("Token '%s' multiply defined", n) + terminals[n] = 1 + + # Get the literals specifier + def get_literals(self): + self.literals = self.ldict.get('literals', '') + if not self.literals: + self.literals = '' + + # Validate literals + def validate_literals(self): + try: + for c in self.literals: + if not isinstance(c, StringTypes) or len(c) > 1: + self.log.error('Invalid literal %s. Must be a single character', repr(c)) + self.error = True + + except TypeError: + self.log.error('Invalid literals specification. literals must be a sequence of characters') + self.error = True + + def get_states(self): + self.states = self.ldict.get('states', None) + # Build statemap + if self.states: + if not isinstance(self.states, (tuple, list)): + self.log.error('states must be defined as a tuple or list') + self.error = True + else: + for s in self.states: + if not isinstance(s, tuple) or len(s) != 2: + self.log.error("Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')", repr(s)) + self.error = True + continue + name, statetype = s + if not isinstance(name, StringTypes): + self.log.error('State name %s must be a string', repr(name)) + self.error = True + continue + if not (statetype == 'inclusive' or statetype == 'exclusive'): + self.log.error("State type for state %s must be 'inclusive' or 'exclusive'", name) + self.error = True + continue + if name in self.stateinfo: + self.log.error("State '%s' already defined", name) + self.error = True + continue + self.stateinfo[name] = statetype + + # Get all of the symbols with a t_ prefix and sort them into various + # categories (functions, strings, error functions, and ignore characters) + + def get_rules(self): + tsymbols = [f for f in self.ldict if f[:2] == 't_'] + + # Now build up a list of functions and a list of strings + self.toknames = {} # Mapping of symbols to token names + self.funcsym = {} # Symbols defined as functions + self.strsym = {} # Symbols defined as strings + self.ignore = {} # Ignore strings by state + self.errorf = {} # Error functions by state + self.eoff = {} # EOF functions by state + + for s in self.stateinfo: + self.funcsym[s] = [] + self.strsym[s] = [] + + if len(tsymbols) == 0: + self.log.error('No rules of the form t_rulename are defined') + self.error = True + return + + for f in tsymbols: + t = self.ldict[f] + states, tokname = _statetoken(f, self.stateinfo) + self.toknames[f] = tokname + + if hasattr(t, '__call__'): + if tokname == 'error': + for s in states: + self.errorf[s] = t + elif tokname == 'eof': + for s in states: + self.eoff[s] = t + elif tokname == 'ignore': + line = t.__code__.co_firstlineno + file = t.__code__.co_filename + self.log.error("%s:%d: Rule '%s' must be defined as a string", file, line, t.__name__) + self.error = True + else: + for s in states: + self.funcsym[s].append((f, t)) + elif isinstance(t, StringTypes): + if tokname == 'ignore': + for s in states: + self.ignore[s] = t + if '\\' in t: + self.log.warning("%s contains a literal backslash '\\'", f) + + elif tokname == 'error': + self.log.error("Rule '%s' must be defined as a function", f) + self.error = True + else: + for s in states: + self.strsym[s].append((f, t)) + else: + self.log.error('%s not defined as a function or string', f) + self.error = True + + # Sort the functions by line number + for f in self.funcsym.values(): + f.sort(key=lambda x: x[1].__code__.co_firstlineno) + + # Sort the strings by regular expression length + for s in self.strsym.values(): + s.sort(key=lambda x: len(x[1]), reverse=True) + + # Validate all of the t_rules collected + def validate_rules(self): + for state in self.stateinfo: + # Validate all rules defined by functions + + for fname, f in self.funcsym[state]: + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + module = inspect.getmodule(f) + self.modules.add(module) + + tokname = self.toknames[fname] + if isinstance(f, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + nargs = f.__code__.co_argcount + if nargs > reqargs: + self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__) + self.error = True + continue + + if nargs < reqargs: + self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__) + self.error = True + continue + + if not _get_regex(f): + self.log.error("%s:%d: No regular expression defined for rule '%s'", file, line, f.__name__) + self.error = True + continue + + try: + c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags) + if c.match(''): + self.log.error("%s:%d: Regular expression for rule '%s' matches empty string", file, line, f.__name__) + self.error = True + except re.error as e: + self.log.error("%s:%d: Invalid regular expression for rule '%s'. %s", file, line, f.__name__, e) + if '#' in _get_regex(f): + self.log.error("%s:%d. Make sure '#' in rule '%s' is escaped with '\\#'", file, line, f.__name__) + self.error = True + + # Validate all rules defined by strings + for name, r in self.strsym[state]: + tokname = self.toknames[name] + if tokname == 'error': + self.log.error("Rule '%s' must be defined as a function", name) + self.error = True + continue + + if tokname not in self.tokens and tokname.find('ignore_') < 0: + self.log.error("Rule '%s' defined for an unspecified token %s", name, tokname) + self.error = True + continue + + try: + c = re.compile('(?P<%s>%s)' % (name, r), self.reflags) + if (c.match('')): + self.log.error("Regular expression for rule '%s' matches empty string", name) + self.error = True + except re.error as e: + self.log.error("Invalid regular expression for rule '%s'. %s", name, e) + if '#' in r: + self.log.error("Make sure '#' in rule '%s' is escaped with '\\#'", name) + self.error = True + + if not self.funcsym[state] and not self.strsym[state]: + self.log.error("No rules defined for state '%s'", state) + self.error = True + + # Validate the error function + efunc = self.errorf.get(state, None) + if efunc: + f = efunc + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + module = inspect.getmodule(f) + self.modules.add(module) + + if isinstance(f, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + nargs = f.__code__.co_argcount + if nargs > reqargs: + self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__) + self.error = True + + if nargs < reqargs: + self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__) + self.error = True + + for module in self.modules: + self.validate_module(module) + + # ----------------------------------------------------------------------------- + # validate_module() + # + # This checks to see if there are duplicated t_rulename() functions or strings + # in the parser input file. This is done using a simple regular expression + # match on each line in the source code of the given module. + # ----------------------------------------------------------------------------- + + def validate_module(self, module): + try: + lines, linen = inspect.getsourcelines(module) + except IOError: + return + + fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(') + sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=') + + counthash = {} + linen += 1 + for line in lines: + m = fre.match(line) + if not m: + m = sre.match(line) + if m: + name = m.group(1) + prev = counthash.get(name) + if not prev: + counthash[name] = linen + else: + filename = inspect.getsourcefile(module) + self.log.error('%s:%d: Rule %s redefined. Previously defined on line %d', filename, linen, name, prev) + self.error = True + linen += 1 + +# ----------------------------------------------------------------------------- +# lex(module) +# +# Build all of the regular expression rules from definitions in the supplied module +# ----------------------------------------------------------------------------- +def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab', + reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None): + + if lextab is None: + lextab = 'lextab' + + global lexer + + ldict = None + stateinfo = {'INITIAL': 'inclusive'} + lexobj = Lexer() + lexobj.lexoptimize = optimize + global token, input + + if errorlog is None: + errorlog = PlyLogger(sys.stderr) + + if debug: + if debuglog is None: + debuglog = PlyLogger(sys.stderr) + + # Get the module dictionary used for the lexer + if object: + module = object + + # Get the module dictionary used for the parser + if module: + _items = [(k, getattr(module, k)) for k in dir(module)] + ldict = dict(_items) + # If no __file__ attribute is available, try to obtain it from the __module__ instead + if '__file__' not in ldict: + ldict['__file__'] = sys.modules[ldict['__module__']].__file__ + else: + ldict = get_caller_module_dict(2) + + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = ldict.get('__package__') + if pkg and isinstance(lextab, str): + if '.' not in lextab: + lextab = pkg + '.' + lextab + + # Collect parser information from the dictionary + linfo = LexerReflect(ldict, log=errorlog, reflags=reflags) + linfo.get_all() + if not optimize: + if linfo.validate_all(): + raise SyntaxError("Can't build lexer") + + if optimize and lextab: + try: + lexobj.readtab(lextab, ldict) + token = lexobj.token + input = lexobj.input + lexer = lexobj + return lexobj + + except ImportError: + pass + + # Dump some basic debugging information + if debug: + debuglog.info('lex: tokens = %r', linfo.tokens) + debuglog.info('lex: literals = %r', linfo.literals) + debuglog.info('lex: states = %r', linfo.stateinfo) + + # Build a dictionary of valid token names + lexobj.lextokens = set() + for n in linfo.tokens: + lexobj.lextokens.add(n) + + # Get literals specification + if isinstance(linfo.literals, (list, tuple)): + lexobj.lexliterals = type(linfo.literals[0])().join(linfo.literals) + else: + lexobj.lexliterals = linfo.literals + + lexobj.lextokens_all = lexobj.lextokens | set(lexobj.lexliterals) + + # Get the stateinfo dictionary + stateinfo = linfo.stateinfo + + regexs = {} + # Build the master regular expressions + for state in stateinfo: + regex_list = [] + + # Add rules defined by functions first + for fname, f in linfo.funcsym[state]: + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + regex_list.append('(?P<%s>%s)' % (fname, _get_regex(f))) + if debug: + debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", fname, _get_regex(f), state) + + # Now add all of the simple rules + for name, r in linfo.strsym[state]: + regex_list.append('(?P<%s>%s)' % (name, r)) + if debug: + debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", name, r, state) + + regexs[state] = regex_list + + # Build the master regular expressions + + if debug: + debuglog.info('lex: ==== MASTER REGEXS FOLLOW ====') + + for state in regexs: + lexre, re_text, re_names = _form_master_re(regexs[state], reflags, ldict, linfo.toknames) + lexobj.lexstatere[state] = lexre + lexobj.lexstateretext[state] = re_text + lexobj.lexstaterenames[state] = re_names + if debug: + for i, text in enumerate(re_text): + debuglog.info("lex: state '%s' : regex[%d] = '%s'", state, i, text) + + # For inclusive states, we need to add the regular expressions from the INITIAL state + for state, stype in stateinfo.items(): + if state != 'INITIAL' and stype == 'inclusive': + lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL']) + lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL']) + lexobj.lexstaterenames[state].extend(lexobj.lexstaterenames['INITIAL']) + + lexobj.lexstateinfo = stateinfo + lexobj.lexre = lexobj.lexstatere['INITIAL'] + lexobj.lexretext = lexobj.lexstateretext['INITIAL'] + lexobj.lexreflags = reflags + + # Set up ignore variables + lexobj.lexstateignore = linfo.ignore + lexobj.lexignore = lexobj.lexstateignore.get('INITIAL', '') + + # Set up error functions + lexobj.lexstateerrorf = linfo.errorf + lexobj.lexerrorf = linfo.errorf.get('INITIAL', None) + if not lexobj.lexerrorf: + errorlog.warning('No t_error rule is defined') + + # Set up eof functions + lexobj.lexstateeoff = linfo.eoff + lexobj.lexeoff = linfo.eoff.get('INITIAL', None) + + # Check state information for ignore and error rules + for s, stype in stateinfo.items(): + if stype == 'exclusive': + if s not in linfo.errorf: + errorlog.warning("No error rule is defined for exclusive state '%s'", s) + if s not in linfo.ignore and lexobj.lexignore: + errorlog.warning("No ignore rule is defined for exclusive state '%s'", s) + elif stype == 'inclusive': + if s not in linfo.errorf: + linfo.errorf[s] = linfo.errorf.get('INITIAL', None) + if s not in linfo.ignore: + linfo.ignore[s] = linfo.ignore.get('INITIAL', '') + + # Create global versions of the token() and input() functions + token = lexobj.token + input = lexobj.input + lexer = lexobj + + # If in optimize mode, we write the lextab + if lextab and optimize: + if outputdir is None: + # If no output directory is set, the location of the output files + # is determined according to the following rules: + # - If lextab specifies a package, files go into that package directory + # - Otherwise, files go in the same directory as the specifying module + if isinstance(lextab, types.ModuleType): + srcfile = lextab.__file__ + else: + if '.' not in lextab: + srcfile = ldict['__file__'] + else: + parts = lextab.split('.') + pkgname = '.'.join(parts[:-1]) + exec('import %s' % pkgname) + srcfile = getattr(sys.modules[pkgname], '__file__', '') + outputdir = os.path.dirname(srcfile) + try: + lexobj.writetab(lextab, outputdir) + except IOError as e: + errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e)) + + return lexobj + +# ----------------------------------------------------------------------------- +# runmain() +# +# This runs the lexer as a main program +# ----------------------------------------------------------------------------- + +def runmain(lexer=None, data=None): + if not data: + try: + filename = sys.argv[1] + f = open(filename) + data = f.read() + f.close() + except IndexError: + sys.stdout.write('Reading from standard input (type EOF to end):\n') + data = sys.stdin.read() + + if lexer: + _input = lexer.input + else: + _input = input + _input(data) + if lexer: + _token = lexer.token + else: + _token = token + + while True: + tok = _token() + if not tok: + break + sys.stdout.write('(%s,%r,%d,%d)\n' % (tok.type, tok.value, tok.lineno, tok.lexpos)) + +# ----------------------------------------------------------------------------- +# @TOKEN(regex) +# +# This decorator function can be used to set the regex expression on a function +# when its docstring might need to be set in an alternative way +# ----------------------------------------------------------------------------- + +def TOKEN(r): + def set_regex(f): + if hasattr(r, '__call__'): + f.regex = _get_regex(r) + else: + f.regex = r + return f + return set_regex + +# Alternative spelling of the TOKEN decorator +Token = TOKEN diff --git a/billinglayer/python/pycparser/ply/yacc.py b/billinglayer/python/pycparser/ply/yacc.py new file mode 100644 index 0000000..20b4f28 --- /dev/null +++ b/billinglayer/python/pycparser/ply/yacc.py @@ -0,0 +1,3494 @@ +# ----------------------------------------------------------------------------- +# ply: yacc.py +# +# Copyright (C) 2001-2017 +# David M. Beazley (Dabeaz LLC) +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the David Beazley or Dabeaz LLC may be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------------------------- +# +# This implements an LR parser that is constructed from grammar rules defined +# as Python functions. The grammer is specified by supplying the BNF inside +# Python documentation strings. The inspiration for this technique was borrowed +# from John Aycock's Spark parsing system. PLY might be viewed as cross between +# Spark and the GNU bison utility. +# +# The current implementation is only somewhat object-oriented. The +# LR parser itself is defined in terms of an object (which allows multiple +# parsers to co-exist). However, most of the variables used during table +# construction are defined in terms of global variables. Users shouldn't +# notice unless they are trying to define multiple parsers at the same +# time using threads (in which case they should have their head examined). +# +# This implementation supports both SLR and LALR(1) parsing. LALR(1) +# support was originally implemented by Elias Ioup (ezioup@alumni.uchicago.edu), +# using the algorithm found in Aho, Sethi, and Ullman "Compilers: Principles, +# Techniques, and Tools" (The Dragon Book). LALR(1) has since been replaced +# by the more efficient DeRemer and Pennello algorithm. +# +# :::::::: WARNING ::::::: +# +# Construction of LR parsing tables is fairly complicated and expensive. +# To make this module run fast, a *LOT* of work has been put into +# optimization---often at the expensive of readability and what might +# consider to be good Python "coding style." Modify the code at your +# own risk! +# ---------------------------------------------------------------------------- + +import re +import types +import sys +import os.path +import inspect +import base64 +import warnings + +__version__ = '3.10' +__tabversion__ = '3.10' + +#----------------------------------------------------------------------------- +# === User configurable parameters === +# +# Change these to modify the default behavior of yacc (if you wish) +#----------------------------------------------------------------------------- + +yaccdebug = True # Debugging mode. If set, yacc generates a + # a 'parser.out' file in the current directory + +debug_file = 'parser.out' # Default name of the debugging file +tab_module = 'parsetab' # Default name of the table module +default_lr = 'LALR' # Default LR table generation method + +error_count = 3 # Number of symbols that must be shifted to leave recovery mode + +yaccdevel = False # Set to True if developing yacc. This turns off optimized + # implementations of certain functions. + +resultlimit = 40 # Size limit of results when running in debug mode. + +pickle_protocol = 0 # Protocol to use when writing pickle files + +# String type-checking compatibility +if sys.version_info[0] < 3: + string_types = basestring +else: + string_types = str + +MAXINT = sys.maxsize + +# This object is a stand-in for a logging object created by the +# logging module. PLY will use this by default to create things +# such as the parser.out file. If a user wants more detailed +# information, they can create their own logging object and pass +# it into PLY. + +class PlyLogger(object): + def __init__(self, f): + self.f = f + + def debug(self, msg, *args, **kwargs): + self.f.write((msg % args) + '\n') + + info = debug + + def warning(self, msg, *args, **kwargs): + self.f.write('WARNING: ' + (msg % args) + '\n') + + def error(self, msg, *args, **kwargs): + self.f.write('ERROR: ' + (msg % args) + '\n') + + critical = debug + +# Null logger is used when no output is generated. Does nothing. +class NullLogger(object): + def __getattribute__(self, name): + return self + + def __call__(self, *args, **kwargs): + return self + +# Exception raised for yacc-related errors +class YaccError(Exception): + pass + +# Format the result message that the parser produces when running in debug mode. +def format_result(r): + repr_str = repr(r) + if '\n' in repr_str: + repr_str = repr(repr_str) + if len(repr_str) > resultlimit: + repr_str = repr_str[:resultlimit] + ' ...' + result = '<%s @ 0x%x> (%s)' % (type(r).__name__, id(r), repr_str) + return result + +# Format stack entries when the parser is running in debug mode +def format_stack_entry(r): + repr_str = repr(r) + if '\n' in repr_str: + repr_str = repr(repr_str) + if len(repr_str) < 16: + return repr_str + else: + return '<%s @ 0x%x>' % (type(r).__name__, id(r)) + +# Panic mode error recovery support. This feature is being reworked--much of the +# code here is to offer a deprecation/backwards compatible transition + +_errok = None +_token = None +_restart = None +_warnmsg = '''PLY: Don't use global functions errok(), token(), and restart() in p_error(). +Instead, invoke the methods on the associated parser instance: + + def p_error(p): + ... + # Use parser.errok(), parser.token(), parser.restart() + ... + + parser = yacc.yacc() +''' + +def errok(): + warnings.warn(_warnmsg) + return _errok() + +def restart(): + warnings.warn(_warnmsg) + return _restart() + +def token(): + warnings.warn(_warnmsg) + return _token() + +# Utility function to call the p_error() function with some deprecation hacks +def call_errorfunc(errorfunc, token, parser): + global _errok, _token, _restart + _errok = parser.errok + _token = parser.token + _restart = parser.restart + r = errorfunc(token) + try: + del _errok, _token, _restart + except NameError: + pass + return r + +#----------------------------------------------------------------------------- +# === LR Parsing Engine === +# +# The following classes are used for the LR parser itself. These are not +# used during table construction and are independent of the actual LR +# table generation algorithm +#----------------------------------------------------------------------------- + +# This class is used to hold non-terminal grammar symbols during parsing. +# It normally has the following attributes set: +# .type = Grammar symbol type +# .value = Symbol value +# .lineno = Starting line number +# .endlineno = Ending line number (optional, set automatically) +# .lexpos = Starting lex position +# .endlexpos = Ending lex position (optional, set automatically) + +class YaccSymbol: + def __str__(self): + return self.type + + def __repr__(self): + return str(self) + +# This class is a wrapper around the objects actually passed to each +# grammar rule. Index lookup and assignment actually assign the +# .value attribute of the underlying YaccSymbol object. +# The lineno() method returns the line number of a given +# item (or 0 if not defined). The linespan() method returns +# a tuple of (startline,endline) representing the range of lines +# for a symbol. The lexspan() method returns a tuple (lexpos,endlexpos) +# representing the range of positional information for a symbol. + +class YaccProduction: + def __init__(self, s, stack=None): + self.slice = s + self.stack = stack + self.lexer = None + self.parser = None + + def __getitem__(self, n): + if isinstance(n, slice): + return [s.value for s in self.slice[n]] + elif n >= 0: + return self.slice[n].value + else: + return self.stack[n].value + + def __setitem__(self, n, v): + self.slice[n].value = v + + def __getslice__(self, i, j): + return [s.value for s in self.slice[i:j]] + + def __len__(self): + return len(self.slice) + + def lineno(self, n): + return getattr(self.slice[n], 'lineno', 0) + + def set_lineno(self, n, lineno): + self.slice[n].lineno = lineno + + def linespan(self, n): + startline = getattr(self.slice[n], 'lineno', 0) + endline = getattr(self.slice[n], 'endlineno', startline) + return startline, endline + + def lexpos(self, n): + return getattr(self.slice[n], 'lexpos', 0) + + def lexspan(self, n): + startpos = getattr(self.slice[n], 'lexpos', 0) + endpos = getattr(self.slice[n], 'endlexpos', startpos) + return startpos, endpos + + def error(self): + raise SyntaxError + +# ----------------------------------------------------------------------------- +# == LRParser == +# +# The LR Parsing engine. +# ----------------------------------------------------------------------------- + +class LRParser: + def __init__(self, lrtab, errorf): + self.productions = lrtab.lr_productions + self.action = lrtab.lr_action + self.goto = lrtab.lr_goto + self.errorfunc = errorf + self.set_defaulted_states() + self.errorok = True + + def errok(self): + self.errorok = True + + def restart(self): + del self.statestack[:] + del self.symstack[:] + sym = YaccSymbol() + sym.type = '$end' + self.symstack.append(sym) + self.statestack.append(0) + + # Defaulted state support. + # This method identifies parser states where there is only one possible reduction action. + # For such states, the parser can make a choose to make a rule reduction without consuming + # the next look-ahead token. This delayed invocation of the tokenizer can be useful in + # certain kinds of advanced parsing situations where the lexer and parser interact with + # each other or change states (i.e., manipulation of scope, lexer states, etc.). + # + # See: https://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions + def set_defaulted_states(self): + self.defaulted_states = {} + for state, actions in self.action.items(): + rules = list(actions.values()) + if len(rules) == 1 and rules[0] < 0: + self.defaulted_states[state] = rules[0] + + def disable_defaulted_states(self): + self.defaulted_states = {} + + def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + if debug or yaccdevel: + if isinstance(debug, int): + debug = PlyLogger(sys.stderr) + return self.parsedebug(input, lexer, debug, tracking, tokenfunc) + elif tracking: + return self.parseopt(input, lexer, debug, tracking, tokenfunc) + else: + return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) + + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parsedebug(). + # + # This is the debugging enabled version of parse(). All changes made to the + # parsing engine should be made here. Optimized versions of this function + # are automatically created by the ply/ygen.py script. This script cuts out + # sections enclosed in markers such as this: + # + # #--! DEBUG + # statements + # #--! DEBUG + # + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parsedebug-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + #--! DEBUG + debug.info('PLY: PARSE DEBUG START') + #--! DEBUG + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + #--! DEBUG + debug.debug('') + debug.debug('State : %s', state) + #--! DEBUG + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + #--! DEBUG + debug.debug('Defaulted state %s: Reduce using %d', state, -t) + #--! DEBUG + + #--! DEBUG + debug.debug('Stack : %s', + ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) + #--! DEBUG + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + #--! DEBUG + debug.debug('Action : Shift and goto state %s', t) + #--! DEBUG + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + #--! DEBUG + if plen: + debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, + '['+','.join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+']', + goto[statestack[-1-plen]][pname]) + else: + debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, [], + goto[statestack[-1]][pname]) + + #--! DEBUG + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + #--! TRACKING + if tracking: + t1 = targ[1] + sym.lineno = t1.lineno + sym.lexpos = t1.lexpos + t1 = targ[-1] + sym.endlineno = getattr(t1, 'endlineno', t1.lineno) + sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos) + #--! TRACKING + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + #--! DEBUG + debug.info('Result : %s', format_result(pslice[0])) + #--! DEBUG + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + #--! TRACKING + if tracking: + sym.lineno = lexer.lineno + sym.lexpos = lexer.lexpos + #--! TRACKING + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + #--! DEBUG + debug.info('Result : %s', format_result(pslice[0])) + #--! DEBUG + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + #--! DEBUG + debug.info('Done : Returning %s', format_result(result)) + debug.info('PLY: PARSE DEBUG END') + #--! DEBUG + return result + + if t is None: + + #--! DEBUG + debug.error('Error : %s', + ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) + #--! DEBUG + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + #--! TRACKING + if tracking: + sym.endlineno = getattr(lookahead, 'lineno', sym.lineno) + sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos) + #--! TRACKING + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + #--! TRACKING + if tracking: + lookahead.lineno = sym.lineno + lookahead.lexpos = sym.lexpos + #--! TRACKING + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parsedebug-end + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parseopt(). + # + # Optimized version of parse() method. DO NOT EDIT THIS CODE DIRECTLY! + # This code is automatically generated by the ply/ygen.py script. Make + # changes to the parsedebug() method instead. + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parseopt-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + #--! TRACKING + if tracking: + t1 = targ[1] + sym.lineno = t1.lineno + sym.lexpos = t1.lexpos + t1 = targ[-1] + sym.endlineno = getattr(t1, 'endlineno', t1.lineno) + sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos) + #--! TRACKING + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + #--! TRACKING + if tracking: + sym.lineno = lexer.lineno + sym.lexpos = lexer.lexpos + #--! TRACKING + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + return result + + if t is None: + + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + #--! TRACKING + if tracking: + sym.endlineno = getattr(lookahead, 'lineno', sym.lineno) + sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos) + #--! TRACKING + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + #--! TRACKING + if tracking: + lookahead.lineno = sym.lineno + lookahead.lexpos = sym.lexpos + #--! TRACKING + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parseopt-end + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parseopt_notrack(). + # + # Optimized version of parseopt() with line number tracking removed. + # DO NOT EDIT THIS CODE DIRECTLY. This code is automatically generated + # by the ply/ygen.py script. Make changes to the parsedebug() method instead. + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parseopt-notrack-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + return result + + if t is None: + + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parseopt-notrack-end + +# ----------------------------------------------------------------------------- +# === Grammar Representation === +# +# The following functions, classes, and variables are used to represent and +# manipulate the rules that make up a grammar. +# ----------------------------------------------------------------------------- + +# regex matching identifiers +_is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$') + +# ----------------------------------------------------------------------------- +# class Production: +# +# This class stores the raw information about a single production or grammar rule. +# A grammar rule refers to a specification such as this: +# +# expr : expr PLUS term +# +# Here are the basic attributes defined on all productions +# +# name - Name of the production. For example 'expr' +# prod - A list of symbols on the right side ['expr','PLUS','term'] +# prec - Production precedence level +# number - Production number. +# func - Function that executes on reduce +# file - File where production function is defined +# lineno - Line number where production function is defined +# +# The following attributes are defined or optional. +# +# len - Length of the production (number of symbols on right hand side) +# usyms - Set of unique symbols found in the production +# ----------------------------------------------------------------------------- + +class Production(object): + reduced = 0 + def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0): + self.name = name + self.prod = tuple(prod) + self.number = number + self.func = func + self.callable = None + self.file = file + self.line = line + self.prec = precedence + + # Internal settings used during table construction + + self.len = len(self.prod) # Length of the production + + # Create a list of unique production symbols used in the production + self.usyms = [] + for s in self.prod: + if s not in self.usyms: + self.usyms.append(s) + + # List of all LR items for the production + self.lr_items = [] + self.lr_next = None + + # Create a string representation + if self.prod: + self.str = '%s -> %s' % (self.name, ' '.join(self.prod)) + else: + self.str = '%s -> ' % self.name + + def __str__(self): + return self.str + + def __repr__(self): + return 'Production(' + str(self) + ')' + + def __len__(self): + return len(self.prod) + + def __nonzero__(self): + return 1 + + def __getitem__(self, index): + return self.prod[index] + + # Return the nth lr_item from the production (or None if at the end) + def lr_item(self, n): + if n > len(self.prod): + return None + p = LRItem(self, n) + # Precompute the list of productions immediately following. + try: + p.lr_after = Prodnames[p.prod[n+1]] + except (IndexError, KeyError): + p.lr_after = [] + try: + p.lr_before = p.prod[n-1] + except IndexError: + p.lr_before = None + return p + + # Bind the production function name to a callable + def bind(self, pdict): + if self.func: + self.callable = pdict[self.func] + +# This class serves as a minimal standin for Production objects when +# reading table data from files. It only contains information +# actually used by the LR parsing engine, plus some additional +# debugging information. +class MiniProduction(object): + def __init__(self, str, name, len, func, file, line): + self.name = name + self.len = len + self.func = func + self.callable = None + self.file = file + self.line = line + self.str = str + + def __str__(self): + return self.str + + def __repr__(self): + return 'MiniProduction(%s)' % self.str + + # Bind the production function name to a callable + def bind(self, pdict): + if self.func: + self.callable = pdict[self.func] + + +# ----------------------------------------------------------------------------- +# class LRItem +# +# This class represents a specific stage of parsing a production rule. For +# example: +# +# expr : expr . PLUS term +# +# In the above, the "." represents the current location of the parse. Here +# basic attributes: +# +# name - Name of the production. For example 'expr' +# prod - A list of symbols on the right side ['expr','.', 'PLUS','term'] +# number - Production number. +# +# lr_next Next LR item. Example, if we are ' expr -> expr . PLUS term' +# then lr_next refers to 'expr -> expr PLUS . term' +# lr_index - LR item index (location of the ".") in the prod list. +# lookaheads - LALR lookahead symbols for this item +# len - Length of the production (number of symbols on right hand side) +# lr_after - List of all productions that immediately follow +# lr_before - Grammar symbol immediately before +# ----------------------------------------------------------------------------- + +class LRItem(object): + def __init__(self, p, n): + self.name = p.name + self.prod = list(p.prod) + self.number = p.number + self.lr_index = n + self.lookaheads = {} + self.prod.insert(n, '.') + self.prod = tuple(self.prod) + self.len = len(self.prod) + self.usyms = p.usyms + + def __str__(self): + if self.prod: + s = '%s -> %s' % (self.name, ' '.join(self.prod)) + else: + s = '%s -> ' % self.name + return s + + def __repr__(self): + return 'LRItem(' + str(self) + ')' + +# ----------------------------------------------------------------------------- +# rightmost_terminal() +# +# Return the rightmost terminal from a list of symbols. Used in add_production() +# ----------------------------------------------------------------------------- +def rightmost_terminal(symbols, terminals): + i = len(symbols) - 1 + while i >= 0: + if symbols[i] in terminals: + return symbols[i] + i -= 1 + return None + +# ----------------------------------------------------------------------------- +# === GRAMMAR CLASS === +# +# The following class represents the contents of the specified grammar along +# with various computed properties such as first sets, follow sets, LR items, etc. +# This data is used for critical parts of the table generation process later. +# ----------------------------------------------------------------------------- + +class GrammarError(YaccError): + pass + +class Grammar(object): + def __init__(self, terminals): + self.Productions = [None] # A list of all of the productions. The first + # entry is always reserved for the purpose of + # building an augmented grammar + + self.Prodnames = {} # A dictionary mapping the names of nonterminals to a list of all + # productions of that nonterminal. + + self.Prodmap = {} # A dictionary that is only used to detect duplicate + # productions. + + self.Terminals = {} # A dictionary mapping the names of terminal symbols to a + # list of the rules where they are used. + + for term in terminals: + self.Terminals[term] = [] + + self.Terminals['error'] = [] + + self.Nonterminals = {} # A dictionary mapping names of nonterminals to a list + # of rule numbers where they are used. + + self.First = {} # A dictionary of precomputed FIRST(x) symbols + + self.Follow = {} # A dictionary of precomputed FOLLOW(x) symbols + + self.Precedence = {} # Precedence rules for each terminal. Contains tuples of the + # form ('right',level) or ('nonassoc', level) or ('left',level) + + self.UsedPrecedence = set() # Precedence rules that were actually used by the grammer. + # This is only used to provide error checking and to generate + # a warning about unused precedence rules. + + self.Start = None # Starting symbol for the grammar + + + def __len__(self): + return len(self.Productions) + + def __getitem__(self, index): + return self.Productions[index] + + # ----------------------------------------------------------------------------- + # set_precedence() + # + # Sets the precedence for a given terminal. assoc is the associativity such as + # 'left','right', or 'nonassoc'. level is a numeric level. + # + # ----------------------------------------------------------------------------- + + def set_precedence(self, term, assoc, level): + assert self.Productions == [None], 'Must call set_precedence() before add_production()' + if term in self.Precedence: + raise GrammarError('Precedence already specified for terminal %r' % term) + if assoc not in ['left', 'right', 'nonassoc']: + raise GrammarError("Associativity must be one of 'left','right', or 'nonassoc'") + self.Precedence[term] = (assoc, level) + + # ----------------------------------------------------------------------------- + # add_production() + # + # Given an action function, this function assembles a production rule and + # computes its precedence level. + # + # The production rule is supplied as a list of symbols. For example, + # a rule such as 'expr : expr PLUS term' has a production name of 'expr' and + # symbols ['expr','PLUS','term']. + # + # Precedence is determined by the precedence of the right-most non-terminal + # or the precedence of a terminal specified by %prec. + # + # A variety of error checks are performed to make sure production symbols + # are valid and that %prec is used correctly. + # ----------------------------------------------------------------------------- + + def add_production(self, prodname, syms, func=None, file='', line=0): + + if prodname in self.Terminals: + raise GrammarError('%s:%d: Illegal rule name %r. Already defined as a token' % (file, line, prodname)) + if prodname == 'error': + raise GrammarError('%s:%d: Illegal rule name %r. error is a reserved word' % (file, line, prodname)) + if not _is_identifier.match(prodname): + raise GrammarError('%s:%d: Illegal rule name %r' % (file, line, prodname)) + + # Look for literal tokens + for n, s in enumerate(syms): + if s[0] in "'\"": + try: + c = eval(s) + if (len(c) > 1): + raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' % + (file, line, s, prodname)) + if c not in self.Terminals: + self.Terminals[c] = [] + syms[n] = c + continue + except SyntaxError: + pass + if not _is_identifier.match(s) and s != '%prec': + raise GrammarError('%s:%d: Illegal name %r in rule %r' % (file, line, s, prodname)) + + # Determine the precedence level + if '%prec' in syms: + if syms[-1] == '%prec': + raise GrammarError('%s:%d: Syntax error. Nothing follows %%prec' % (file, line)) + if syms[-2] != '%prec': + raise GrammarError('%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule' % + (file, line)) + precname = syms[-1] + prodprec = self.Precedence.get(precname) + if not prodprec: + raise GrammarError('%s:%d: Nothing known about the precedence of %r' % (file, line, precname)) + else: + self.UsedPrecedence.add(precname) + del syms[-2:] # Drop %prec from the rule + else: + # If no %prec, precedence is determined by the rightmost terminal symbol + precname = rightmost_terminal(syms, self.Terminals) + prodprec = self.Precedence.get(precname, ('right', 0)) + + # See if the rule is already in the rulemap + map = '%s -> %s' % (prodname, syms) + if map in self.Prodmap: + m = self.Prodmap[map] + raise GrammarError('%s:%d: Duplicate rule %s. ' % (file, line, m) + + 'Previous definition at %s:%d' % (m.file, m.line)) + + # From this point on, everything is valid. Create a new Production instance + pnumber = len(self.Productions) + if prodname not in self.Nonterminals: + self.Nonterminals[prodname] = [] + + # Add the production number to Terminals and Nonterminals + for t in syms: + if t in self.Terminals: + self.Terminals[t].append(pnumber) + else: + if t not in self.Nonterminals: + self.Nonterminals[t] = [] + self.Nonterminals[t].append(pnumber) + + # Create a production and add it to the list of productions + p = Production(pnumber, prodname, syms, prodprec, func, file, line) + self.Productions.append(p) + self.Prodmap[map] = p + + # Add to the global productions list + try: + self.Prodnames[prodname].append(p) + except KeyError: + self.Prodnames[prodname] = [p] + + # ----------------------------------------------------------------------------- + # set_start() + # + # Sets the starting symbol and creates the augmented grammar. Production + # rule 0 is S' -> start where start is the start symbol. + # ----------------------------------------------------------------------------- + + def set_start(self, start=None): + if not start: + start = self.Productions[1].name + if start not in self.Nonterminals: + raise GrammarError('start symbol %s undefined' % start) + self.Productions[0] = Production(0, "S'", [start]) + self.Nonterminals[start].append(0) + self.Start = start + + # ----------------------------------------------------------------------------- + # find_unreachable() + # + # Find all of the nonterminal symbols that can't be reached from the starting + # symbol. Returns a list of nonterminals that can't be reached. + # ----------------------------------------------------------------------------- + + def find_unreachable(self): + + # Mark all symbols that are reachable from a symbol s + def mark_reachable_from(s): + if s in reachable: + return + reachable.add(s) + for p in self.Prodnames.get(s, []): + for r in p.prod: + mark_reachable_from(r) + + reachable = set() + mark_reachable_from(self.Productions[0].prod[0]) + return [s for s in self.Nonterminals if s not in reachable] + + # ----------------------------------------------------------------------------- + # infinite_cycles() + # + # This function looks at the various parsing rules and tries to detect + # infinite recursion cycles (grammar rules where there is no possible way + # to derive a string of only terminals). + # ----------------------------------------------------------------------------- + + def infinite_cycles(self): + terminates = {} + + # Terminals: + for t in self.Terminals: + terminates[t] = True + + terminates['$end'] = True + + # Nonterminals: + + # Initialize to false: + for n in self.Nonterminals: + terminates[n] = False + + # Then propagate termination until no change: + while True: + some_change = False + for (n, pl) in self.Prodnames.items(): + # Nonterminal n terminates iff any of its productions terminates. + for p in pl: + # Production p terminates iff all of its rhs symbols terminate. + for s in p.prod: + if not terminates[s]: + # The symbol s does not terminate, + # so production p does not terminate. + p_terminates = False + break + else: + # didn't break from the loop, + # so every symbol s terminates + # so production p terminates. + p_terminates = True + + if p_terminates: + # symbol n terminates! + if not terminates[n]: + terminates[n] = True + some_change = True + # Don't need to consider any more productions for this n. + break + + if not some_change: + break + + infinite = [] + for (s, term) in terminates.items(): + if not term: + if s not in self.Prodnames and s not in self.Terminals and s != 'error': + # s is used-but-not-defined, and we've already warned of that, + # so it would be overkill to say that it's also non-terminating. + pass + else: + infinite.append(s) + + return infinite + + # ----------------------------------------------------------------------------- + # undefined_symbols() + # + # Find all symbols that were used the grammar, but not defined as tokens or + # grammar rules. Returns a list of tuples (sym, prod) where sym in the symbol + # and prod is the production where the symbol was used. + # ----------------------------------------------------------------------------- + def undefined_symbols(self): + result = [] + for p in self.Productions: + if not p: + continue + + for s in p.prod: + if s not in self.Prodnames and s not in self.Terminals and s != 'error': + result.append((s, p)) + return result + + # ----------------------------------------------------------------------------- + # unused_terminals() + # + # Find all terminals that were defined, but not used by the grammar. Returns + # a list of all symbols. + # ----------------------------------------------------------------------------- + def unused_terminals(self): + unused_tok = [] + for s, v in self.Terminals.items(): + if s != 'error' and not v: + unused_tok.append(s) + + return unused_tok + + # ------------------------------------------------------------------------------ + # unused_rules() + # + # Find all grammar rules that were defined, but not used (maybe not reachable) + # Returns a list of productions. + # ------------------------------------------------------------------------------ + + def unused_rules(self): + unused_prod = [] + for s, v in self.Nonterminals.items(): + if not v: + p = self.Prodnames[s][0] + unused_prod.append(p) + return unused_prod + + # ----------------------------------------------------------------------------- + # unused_precedence() + # + # Returns a list of tuples (term,precedence) corresponding to precedence + # rules that were never used by the grammar. term is the name of the terminal + # on which precedence was applied and precedence is a string such as 'left' or + # 'right' corresponding to the type of precedence. + # ----------------------------------------------------------------------------- + + def unused_precedence(self): + unused = [] + for termname in self.Precedence: + if not (termname in self.Terminals or termname in self.UsedPrecedence): + unused.append((termname, self.Precedence[termname][0])) + + return unused + + # ------------------------------------------------------------------------- + # _first() + # + # Compute the value of FIRST1(beta) where beta is a tuple of symbols. + # + # During execution of compute_first1, the result may be incomplete. + # Afterward (e.g., when called from compute_follow()), it will be complete. + # ------------------------------------------------------------------------- + def _first(self, beta): + + # We are computing First(x1,x2,x3,...,xn) + result = [] + for x in beta: + x_produces_empty = False + + # Add all the non- symbols of First[x] to the result. + for f in self.First[x]: + if f == '': + x_produces_empty = True + else: + if f not in result: + result.append(f) + + if x_produces_empty: + # We have to consider the next x in beta, + # i.e. stay in the loop. + pass + else: + # We don't have to consider any further symbols in beta. + break + else: + # There was no 'break' from the loop, + # so x_produces_empty was true for all x in beta, + # so beta produces empty as well. + result.append('') + + return result + + # ------------------------------------------------------------------------- + # compute_first() + # + # Compute the value of FIRST1(X) for all symbols + # ------------------------------------------------------------------------- + def compute_first(self): + if self.First: + return self.First + + # Terminals: + for t in self.Terminals: + self.First[t] = [t] + + self.First['$end'] = ['$end'] + + # Nonterminals: + + # Initialize to the empty set: + for n in self.Nonterminals: + self.First[n] = [] + + # Then propagate symbols until no change: + while True: + some_change = False + for n in self.Nonterminals: + for p in self.Prodnames[n]: + for f in self._first(p.prod): + if f not in self.First[n]: + self.First[n].append(f) + some_change = True + if not some_change: + break + + return self.First + + # --------------------------------------------------------------------- + # compute_follow() + # + # Computes all of the follow sets for every non-terminal symbol. The + # follow set is the set of all symbols that might follow a given + # non-terminal. See the Dragon book, 2nd Ed. p. 189. + # --------------------------------------------------------------------- + def compute_follow(self, start=None): + # If already computed, return the result + if self.Follow: + return self.Follow + + # If first sets not computed yet, do that first. + if not self.First: + self.compute_first() + + # Add '$end' to the follow list of the start symbol + for k in self.Nonterminals: + self.Follow[k] = [] + + if not start: + start = self.Productions[1].name + + self.Follow[start] = ['$end'] + + while True: + didadd = False + for p in self.Productions[1:]: + # Here is the production set + for i, B in enumerate(p.prod): + if B in self.Nonterminals: + # Okay. We got a non-terminal in a production + fst = self._first(p.prod[i+1:]) + hasempty = False + for f in fst: + if f != '' and f not in self.Follow[B]: + self.Follow[B].append(f) + didadd = True + if f == '': + hasempty = True + if hasempty or i == (len(p.prod)-1): + # Add elements of follow(a) to follow(b) + for f in self.Follow[p.name]: + if f not in self.Follow[B]: + self.Follow[B].append(f) + didadd = True + if not didadd: + break + return self.Follow + + + # ----------------------------------------------------------------------------- + # build_lritems() + # + # This function walks the list of productions and builds a complete set of the + # LR items. The LR items are stored in two ways: First, they are uniquely + # numbered and placed in the list _lritems. Second, a linked list of LR items + # is built for each production. For example: + # + # E -> E PLUS E + # + # Creates the list + # + # [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ] + # ----------------------------------------------------------------------------- + + def build_lritems(self): + for p in self.Productions: + lastlri = p + i = 0 + lr_items = [] + while True: + if i > len(p): + lri = None + else: + lri = LRItem(p, i) + # Precompute the list of productions immediately following + try: + lri.lr_after = self.Prodnames[lri.prod[i+1]] + except (IndexError, KeyError): + lri.lr_after = [] + try: + lri.lr_before = lri.prod[i-1] + except IndexError: + lri.lr_before = None + + lastlri.lr_next = lri + if not lri: + break + lr_items.append(lri) + lastlri = lri + i += 1 + p.lr_items = lr_items + +# ----------------------------------------------------------------------------- +# == Class LRTable == +# +# This basic class represents a basic table of LR parsing information. +# Methods for generating the tables are not defined here. They are defined +# in the derived class LRGeneratedTable. +# ----------------------------------------------------------------------------- + +class VersionError(YaccError): + pass + +class LRTable(object): + def __init__(self): + self.lr_action = None + self.lr_goto = None + self.lr_productions = None + self.lr_method = None + + def read_table(self, module): + if isinstance(module, types.ModuleType): + parsetab = module + else: + exec('import %s' % module) + parsetab = sys.modules[module] + + if parsetab._tabversion != __tabversion__: + raise VersionError('yacc table file version is out of date') + + self.lr_action = parsetab._lr_action + self.lr_goto = parsetab._lr_goto + + self.lr_productions = [] + for p in parsetab._lr_productions: + self.lr_productions.append(MiniProduction(*p)) + + self.lr_method = parsetab._lr_method + return parsetab._lr_signature + + def read_pickle(self, filename): + try: + import cPickle as pickle + except ImportError: + import pickle + + if not os.path.exists(filename): + raise ImportError + + in_f = open(filename, 'rb') + + tabversion = pickle.load(in_f) + if tabversion != __tabversion__: + raise VersionError('yacc table file version is out of date') + self.lr_method = pickle.load(in_f) + signature = pickle.load(in_f) + self.lr_action = pickle.load(in_f) + self.lr_goto = pickle.load(in_f) + productions = pickle.load(in_f) + + self.lr_productions = [] + for p in productions: + self.lr_productions.append(MiniProduction(*p)) + + in_f.close() + return signature + + # Bind all production function names to callable objects in pdict + def bind_callables(self, pdict): + for p in self.lr_productions: + p.bind(pdict) + + +# ----------------------------------------------------------------------------- +# === LR Generator === +# +# The following classes and functions are used to generate LR parsing tables on +# a grammar. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# digraph() +# traverse() +# +# The following two functions are used to compute set valued functions +# of the form: +# +# F(x) = F'(x) U U{F(y) | x R y} +# +# This is used to compute the values of Read() sets as well as FOLLOW sets +# in LALR(1) generation. +# +# Inputs: X - An input set +# R - A relation +# FP - Set-valued function +# ------------------------------------------------------------------------------ + +def digraph(X, R, FP): + N = {} + for x in X: + N[x] = 0 + stack = [] + F = {} + for x in X: + if N[x] == 0: + traverse(x, N, stack, F, X, R, FP) + return F + +def traverse(x, N, stack, F, X, R, FP): + stack.append(x) + d = len(stack) + N[x] = d + F[x] = FP(x) # F(X) <- F'(x) + + rel = R(x) # Get y's related to x + for y in rel: + if N[y] == 0: + traverse(y, N, stack, F, X, R, FP) + N[x] = min(N[x], N[y]) + for a in F.get(y, []): + if a not in F[x]: + F[x].append(a) + if N[x] == d: + N[stack[-1]] = MAXINT + F[stack[-1]] = F[x] + element = stack.pop() + while element != x: + N[stack[-1]] = MAXINT + F[stack[-1]] = F[x] + element = stack.pop() + +class LALRError(YaccError): + pass + +# ----------------------------------------------------------------------------- +# == LRGeneratedTable == +# +# This class implements the LR table generation algorithm. There are no +# public methods except for write() +# ----------------------------------------------------------------------------- + +class LRGeneratedTable(LRTable): + def __init__(self, grammar, method='LALR', log=None): + if method not in ['SLR', 'LALR']: + raise LALRError('Unsupported method %s' % method) + + self.grammar = grammar + self.lr_method = method + + # Set up the logger + if not log: + log = NullLogger() + self.log = log + + # Internal attributes + self.lr_action = {} # Action table + self.lr_goto = {} # Goto table + self.lr_productions = grammar.Productions # Copy of grammar Production array + self.lr_goto_cache = {} # Cache of computed gotos + self.lr0_cidhash = {} # Cache of closures + + self._add_count = 0 # Internal counter used to detect cycles + + # Diagonistic information filled in by the table generator + self.sr_conflict = 0 + self.rr_conflict = 0 + self.conflicts = [] # List of conflicts + + self.sr_conflicts = [] + self.rr_conflicts = [] + + # Build the tables + self.grammar.build_lritems() + self.grammar.compute_first() + self.grammar.compute_follow() + self.lr_parse_table() + + # Compute the LR(0) closure operation on I, where I is a set of LR(0) items. + + def lr0_closure(self, I): + self._add_count += 1 + + # Add everything in I to J + J = I[:] + didadd = True + while didadd: + didadd = False + for j in J: + for x in j.lr_after: + if getattr(x, 'lr0_added', 0) == self._add_count: + continue + # Add B --> .G to J + J.append(x.lr_next) + x.lr0_added = self._add_count + didadd = True + + return J + + # Compute the LR(0) goto function goto(I,X) where I is a set + # of LR(0) items and X is a grammar symbol. This function is written + # in a way that guarantees uniqueness of the generated goto sets + # (i.e. the same goto set will never be returned as two different Python + # objects). With uniqueness, we can later do fast set comparisons using + # id(obj) instead of element-wise comparison. + + def lr0_goto(self, I, x): + # First we look for a previously cached entry + g = self.lr_goto_cache.get((id(I), x)) + if g: + return g + + # Now we generate the goto set in a way that guarantees uniqueness + # of the result + + s = self.lr_goto_cache.get(x) + if not s: + s = {} + self.lr_goto_cache[x] = s + + gs = [] + for p in I: + n = p.lr_next + if n and n.lr_before == x: + s1 = s.get(id(n)) + if not s1: + s1 = {} + s[id(n)] = s1 + gs.append(n) + s = s1 + g = s.get('$end') + if not g: + if gs: + g = self.lr0_closure(gs) + s['$end'] = g + else: + s['$end'] = gs + self.lr_goto_cache[(id(I), x)] = g + return g + + # Compute the LR(0) sets of item function + def lr0_items(self): + C = [self.lr0_closure([self.grammar.Productions[0].lr_next])] + i = 0 + for I in C: + self.lr0_cidhash[id(I)] = i + i += 1 + + # Loop over the items in C and each grammar symbols + i = 0 + while i < len(C): + I = C[i] + i += 1 + + # Collect all of the symbols that could possibly be in the goto(I,X) sets + asyms = {} + for ii in I: + for s in ii.usyms: + asyms[s] = None + + for x in asyms: + g = self.lr0_goto(I, x) + if not g or id(g) in self.lr0_cidhash: + continue + self.lr0_cidhash[id(g)] = len(C) + C.append(g) + + return C + + # ----------------------------------------------------------------------------- + # ==== LALR(1) Parsing ==== + # + # LALR(1) parsing is almost exactly the same as SLR except that instead of + # relying upon Follow() sets when performing reductions, a more selective + # lookahead set that incorporates the state of the LR(0) machine is utilized. + # Thus, we mainly just have to focus on calculating the lookahead sets. + # + # The method used here is due to DeRemer and Pennelo (1982). + # + # DeRemer, F. L., and T. J. Pennelo: "Efficient Computation of LALR(1) + # Lookahead Sets", ACM Transactions on Programming Languages and Systems, + # Vol. 4, No. 4, Oct. 1982, pp. 615-649 + # + # Further details can also be found in: + # + # J. Tremblay and P. Sorenson, "The Theory and Practice of Compiler Writing", + # McGraw-Hill Book Company, (1985). + # + # ----------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------- + # compute_nullable_nonterminals() + # + # Creates a dictionary containing all of the non-terminals that might produce + # an empty production. + # ----------------------------------------------------------------------------- + + def compute_nullable_nonterminals(self): + nullable = set() + num_nullable = 0 + while True: + for p in self.grammar.Productions[1:]: + if p.len == 0: + nullable.add(p.name) + continue + for t in p.prod: + if t not in nullable: + break + else: + nullable.add(p.name) + if len(nullable) == num_nullable: + break + num_nullable = len(nullable) + return nullable + + # ----------------------------------------------------------------------------- + # find_nonterminal_trans(C) + # + # Given a set of LR(0) items, this functions finds all of the non-terminal + # transitions. These are transitions in which a dot appears immediately before + # a non-terminal. Returns a list of tuples of the form (state,N) where state + # is the state number and N is the nonterminal symbol. + # + # The input C is the set of LR(0) items. + # ----------------------------------------------------------------------------- + + def find_nonterminal_transitions(self, C): + trans = [] + for stateno, state in enumerate(C): + for p in state: + if p.lr_index < p.len - 1: + t = (stateno, p.prod[p.lr_index+1]) + if t[1] in self.grammar.Nonterminals: + if t not in trans: + trans.append(t) + return trans + + # ----------------------------------------------------------------------------- + # dr_relation() + # + # Computes the DR(p,A) relationships for non-terminal transitions. The input + # is a tuple (state,N) where state is a number and N is a nonterminal symbol. + # + # Returns a list of terminals. + # ----------------------------------------------------------------------------- + + def dr_relation(self, C, trans, nullable): + dr_set = {} + state, N = trans + terms = [] + + g = self.lr0_goto(C[state], N) + for p in g: + if p.lr_index < p.len - 1: + a = p.prod[p.lr_index+1] + if a in self.grammar.Terminals: + if a not in terms: + terms.append(a) + + # This extra bit is to handle the start state + if state == 0 and N == self.grammar.Productions[0].prod[0]: + terms.append('$end') + + return terms + + # ----------------------------------------------------------------------------- + # reads_relation() + # + # Computes the READS() relation (p,A) READS (t,C). + # ----------------------------------------------------------------------------- + + def reads_relation(self, C, trans, empty): + # Look for empty transitions + rel = [] + state, N = trans + + g = self.lr0_goto(C[state], N) + j = self.lr0_cidhash.get(id(g), -1) + for p in g: + if p.lr_index < p.len - 1: + a = p.prod[p.lr_index + 1] + if a in empty: + rel.append((j, a)) + + return rel + + # ----------------------------------------------------------------------------- + # compute_lookback_includes() + # + # Determines the lookback and includes relations + # + # LOOKBACK: + # + # This relation is determined by running the LR(0) state machine forward. + # For example, starting with a production "N : . A B C", we run it forward + # to obtain "N : A B C ." We then build a relationship between this final + # state and the starting state. These relationships are stored in a dictionary + # lookdict. + # + # INCLUDES: + # + # Computes the INCLUDE() relation (p,A) INCLUDES (p',B). + # + # This relation is used to determine non-terminal transitions that occur + # inside of other non-terminal transition states. (p,A) INCLUDES (p', B) + # if the following holds: + # + # B -> LAT, where T -> epsilon and p' -L-> p + # + # L is essentially a prefix (which may be empty), T is a suffix that must be + # able to derive an empty string. State p' must lead to state p with the string L. + # + # ----------------------------------------------------------------------------- + + def compute_lookback_includes(self, C, trans, nullable): + lookdict = {} # Dictionary of lookback relations + includedict = {} # Dictionary of include relations + + # Make a dictionary of non-terminal transitions + dtrans = {} + for t in trans: + dtrans[t] = 1 + + # Loop over all transitions and compute lookbacks and includes + for state, N in trans: + lookb = [] + includes = [] + for p in C[state]: + if p.name != N: + continue + + # Okay, we have a name match. We now follow the production all the way + # through the state machine until we get the . on the right hand side + + lr_index = p.lr_index + j = state + while lr_index < p.len - 1: + lr_index = lr_index + 1 + t = p.prod[lr_index] + + # Check to see if this symbol and state are a non-terminal transition + if (j, t) in dtrans: + # Yes. Okay, there is some chance that this is an includes relation + # the only way to know for certain is whether the rest of the + # production derives empty + + li = lr_index + 1 + while li < p.len: + if p.prod[li] in self.grammar.Terminals: + break # No forget it + if p.prod[li] not in nullable: + break + li = li + 1 + else: + # Appears to be a relation between (j,t) and (state,N) + includes.append((j, t)) + + g = self.lr0_goto(C[j], t) # Go to next set + j = self.lr0_cidhash.get(id(g), -1) # Go to next state + + # When we get here, j is the final state, now we have to locate the production + for r in C[j]: + if r.name != p.name: + continue + if r.len != p.len: + continue + i = 0 + # This look is comparing a production ". A B C" with "A B C ." + while i < r.lr_index: + if r.prod[i] != p.prod[i+1]: + break + i = i + 1 + else: + lookb.append((j, r)) + for i in includes: + if i not in includedict: + includedict[i] = [] + includedict[i].append((state, N)) + lookdict[(state, N)] = lookb + + return lookdict, includedict + + # ----------------------------------------------------------------------------- + # compute_read_sets() + # + # Given a set of LR(0) items, this function computes the read sets. + # + # Inputs: C = Set of LR(0) items + # ntrans = Set of nonterminal transitions + # nullable = Set of empty transitions + # + # Returns a set containing the read sets + # ----------------------------------------------------------------------------- + + def compute_read_sets(self, C, ntrans, nullable): + FP = lambda x: self.dr_relation(C, x, nullable) + R = lambda x: self.reads_relation(C, x, nullable) + F = digraph(ntrans, R, FP) + return F + + # ----------------------------------------------------------------------------- + # compute_follow_sets() + # + # Given a set of LR(0) items, a set of non-terminal transitions, a readset, + # and an include set, this function computes the follow sets + # + # Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)} + # + # Inputs: + # ntrans = Set of nonterminal transitions + # readsets = Readset (previously computed) + # inclsets = Include sets (previously computed) + # + # Returns a set containing the follow sets + # ----------------------------------------------------------------------------- + + def compute_follow_sets(self, ntrans, readsets, inclsets): + FP = lambda x: readsets[x] + R = lambda x: inclsets.get(x, []) + F = digraph(ntrans, R, FP) + return F + + # ----------------------------------------------------------------------------- + # add_lookaheads() + # + # Attaches the lookahead symbols to grammar rules. + # + # Inputs: lookbacks - Set of lookback relations + # followset - Computed follow set + # + # This function directly attaches the lookaheads to productions contained + # in the lookbacks set + # ----------------------------------------------------------------------------- + + def add_lookaheads(self, lookbacks, followset): + for trans, lb in lookbacks.items(): + # Loop over productions in lookback + for state, p in lb: + if state not in p.lookaheads: + p.lookaheads[state] = [] + f = followset.get(trans, []) + for a in f: + if a not in p.lookaheads[state]: + p.lookaheads[state].append(a) + + # ----------------------------------------------------------------------------- + # add_lalr_lookaheads() + # + # This function does all of the work of adding lookahead information for use + # with LALR parsing + # ----------------------------------------------------------------------------- + + def add_lalr_lookaheads(self, C): + # Determine all of the nullable nonterminals + nullable = self.compute_nullable_nonterminals() + + # Find all non-terminal transitions + trans = self.find_nonterminal_transitions(C) + + # Compute read sets + readsets = self.compute_read_sets(C, trans, nullable) + + # Compute lookback/includes relations + lookd, included = self.compute_lookback_includes(C, trans, nullable) + + # Compute LALR FOLLOW sets + followsets = self.compute_follow_sets(trans, readsets, included) + + # Add all of the lookaheads + self.add_lookaheads(lookd, followsets) + + # ----------------------------------------------------------------------------- + # lr_parse_table() + # + # This function constructs the parse tables for SLR or LALR + # ----------------------------------------------------------------------------- + def lr_parse_table(self): + Productions = self.grammar.Productions + Precedence = self.grammar.Precedence + goto = self.lr_goto # Goto array + action = self.lr_action # Action array + log = self.log # Logger for output + + actionp = {} # Action production array (temporary) + + log.info('Parsing method: %s', self.lr_method) + + # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items + # This determines the number of states + + C = self.lr0_items() + + if self.lr_method == 'LALR': + self.add_lalr_lookaheads(C) + + # Build the parser table, state by state + st = 0 + for I in C: + # Loop over each production in I + actlist = [] # List of actions + st_action = {} + st_actionp = {} + st_goto = {} + log.info('') + log.info('state %d', st) + log.info('') + for p in I: + log.info(' (%d) %s', p.number, p) + log.info('') + + for p in I: + if p.len == p.lr_index + 1: + if p.name == "S'": + # Start symbol. Accept! + st_action['$end'] = 0 + st_actionp['$end'] = p + else: + # We are at the end of a production. Reduce! + if self.lr_method == 'LALR': + laheads = p.lookaheads[st] + else: + laheads = self.grammar.Follow[p.name] + for a in laheads: + actlist.append((a, p, 'reduce using rule %d (%s)' % (p.number, p))) + r = st_action.get(a) + if r is not None: + # Whoa. Have a shift/reduce or reduce/reduce conflict + if r > 0: + # Need to decide on shift or reduce here + # By default we favor shifting. Need to add + # some precedence rules here. + + # Shift precedence comes from the token + sprec, slevel = Precedence.get(a, ('right', 0)) + + # Reduce precedence comes from rule being reduced (p) + rprec, rlevel = Productions[p.number].prec + + if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')): + # We really need to reduce here. + st_action[a] = -p.number + st_actionp[a] = p + if not slevel and not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as reduce', a) + self.sr_conflicts.append((st, a, 'reduce')) + Productions[p.number].reduced += 1 + elif (slevel == rlevel) and (rprec == 'nonassoc'): + st_action[a] = None + else: + # Hmmm. Guess we'll keep the shift + if not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as shift', a) + self.sr_conflicts.append((st, a, 'shift')) + elif r < 0: + # Reduce/reduce conflict. In this case, we favor the rule + # that was defined first in the grammar file + oldp = Productions[-r] + pp = Productions[p.number] + if oldp.line > pp.line: + st_action[a] = -p.number + st_actionp[a] = p + chosenp, rejectp = pp, oldp + Productions[p.number].reduced += 1 + Productions[oldp.number].reduced -= 1 + else: + chosenp, rejectp = oldp, pp + self.rr_conflicts.append((st, chosenp, rejectp)) + log.info(' ! reduce/reduce conflict for %s resolved using rule %d (%s)', + a, st_actionp[a].number, st_actionp[a]) + else: + raise LALRError('Unknown conflict in state %d' % st) + else: + st_action[a] = -p.number + st_actionp[a] = p + Productions[p.number].reduced += 1 + else: + i = p.lr_index + a = p.prod[i+1] # Get symbol right after the "." + if a in self.grammar.Terminals: + g = self.lr0_goto(I, a) + j = self.lr0_cidhash.get(id(g), -1) + if j >= 0: + # We are in a shift state + actlist.append((a, p, 'shift and go to state %d' % j)) + r = st_action.get(a) + if r is not None: + # Whoa have a shift/reduce or shift/shift conflict + if r > 0: + if r != j: + raise LALRError('Shift/shift conflict in state %d' % st) + elif r < 0: + # Do a precedence check. + # - if precedence of reduce rule is higher, we reduce. + # - if precedence of reduce is same and left assoc, we reduce. + # - otherwise we shift + + # Shift precedence comes from the token + sprec, slevel = Precedence.get(a, ('right', 0)) + + # Reduce precedence comes from the rule that could have been reduced + rprec, rlevel = Productions[st_actionp[a].number].prec + + if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')): + # We decide to shift here... highest precedence to shift + Productions[st_actionp[a].number].reduced -= 1 + st_action[a] = j + st_actionp[a] = p + if not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as shift', a) + self.sr_conflicts.append((st, a, 'shift')) + elif (slevel == rlevel) and (rprec == 'nonassoc'): + st_action[a] = None + else: + # Hmmm. Guess we'll keep the reduce + if not slevel and not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as reduce', a) + self.sr_conflicts.append((st, a, 'reduce')) + + else: + raise LALRError('Unknown conflict in state %d' % st) + else: + st_action[a] = j + st_actionp[a] = p + + # Print the actions associated with each terminal + _actprint = {} + for a, p, m in actlist: + if a in st_action: + if p is st_actionp[a]: + log.info(' %-15s %s', a, m) + _actprint[(a, m)] = 1 + log.info('') + # Print the actions that were not used. (debugging) + not_used = 0 + for a, p, m in actlist: + if a in st_action: + if p is not st_actionp[a]: + if not (a, m) in _actprint: + log.debug(' ! %-15s [ %s ]', a, m) + not_used = 1 + _actprint[(a, m)] = 1 + if not_used: + log.debug('') + + # Construct the goto table for this state + + nkeys = {} + for ii in I: + for s in ii.usyms: + if s in self.grammar.Nonterminals: + nkeys[s] = None + for n in nkeys: + g = self.lr0_goto(I, n) + j = self.lr0_cidhash.get(id(g), -1) + if j >= 0: + st_goto[n] = j + log.info(' %-30s shift and go to state %d', n, j) + + action[st] = st_action + actionp[st] = st_actionp + goto[st] = st_goto + st += 1 + + # ----------------------------------------------------------------------------- + # write() + # + # This function writes the LR parsing tables to a file + # ----------------------------------------------------------------------------- + + def write_table(self, tabmodule, outputdir='', signature=''): + if isinstance(tabmodule, types.ModuleType): + raise IOError("Won't overwrite existing tabmodule") + + basemodulename = tabmodule.split('.')[-1] + filename = os.path.join(outputdir, basemodulename) + '.py' + try: + f = open(filename, 'w') + + f.write(''' +# %s +# This file is automatically generated. Do not edit. +_tabversion = %r + +_lr_method = %r + +_lr_signature = %r + ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature)) + + # Change smaller to 0 to go back to original tables + smaller = 1 + + # Factor out names to try and make smaller + if smaller: + items = {} + + for s, nd in self.lr_action.items(): + for name, v in nd.items(): + i = items.get(name) + if not i: + i = ([], []) + items[name] = i + i[0].append(s) + i[1].append(v) + + f.write('\n_lr_action_items = {') + for k, v in items.items(): + f.write('%r:([' % k) + for i in v[0]: + f.write('%r,' % i) + f.write('],[') + for i in v[1]: + f.write('%r,' % i) + + f.write(']),') + f.write('}\n') + + f.write(''' +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items +''') + + else: + f.write('\n_lr_action = { ') + for k, v in self.lr_action.items(): + f.write('(%r,%r):%r,' % (k[0], k[1], v)) + f.write('}\n') + + if smaller: + # Factor out names to try and make smaller + items = {} + + for s, nd in self.lr_goto.items(): + for name, v in nd.items(): + i = items.get(name) + if not i: + i = ([], []) + items[name] = i + i[0].append(s) + i[1].append(v) + + f.write('\n_lr_goto_items = {') + for k, v in items.items(): + f.write('%r:([' % k) + for i in v[0]: + f.write('%r,' % i) + f.write('],[') + for i in v[1]: + f.write('%r,' % i) + + f.write(']),') + f.write('}\n') + + f.write(''' +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +''') + else: + f.write('\n_lr_goto = { ') + for k, v in self.lr_goto.items(): + f.write('(%r,%r):%r,' % (k[0], k[1], v)) + f.write('}\n') + + # Write production table + f.write('_lr_productions = [\n') + for p in self.lr_productions: + if p.func: + f.write(' (%r,%r,%d,%r,%r,%d),\n' % (p.str, p.name, p.len, + p.func, os.path.basename(p.file), p.line)) + else: + f.write(' (%r,%r,%d,None,None,None),\n' % (str(p), p.name, p.len)) + f.write(']\n') + f.close() + + except IOError as e: + raise + + + # ----------------------------------------------------------------------------- + # pickle_table() + # + # This function pickles the LR parsing tables to a supplied file object + # ----------------------------------------------------------------------------- + + def pickle_table(self, filename, signature=''): + try: + import cPickle as pickle + except ImportError: + import pickle + with open(filename, 'wb') as outf: + pickle.dump(__tabversion__, outf, pickle_protocol) + pickle.dump(self.lr_method, outf, pickle_protocol) + pickle.dump(signature, outf, pickle_protocol) + pickle.dump(self.lr_action, outf, pickle_protocol) + pickle.dump(self.lr_goto, outf, pickle_protocol) + + outp = [] + for p in self.lr_productions: + if p.func: + outp.append((p.str, p.name, p.len, p.func, os.path.basename(p.file), p.line)) + else: + outp.append((str(p), p.name, p.len, None, None, None)) + pickle.dump(outp, outf, pickle_protocol) + +# ----------------------------------------------------------------------------- +# === INTROSPECTION === +# +# The following functions and classes are used to implement the PLY +# introspection features followed by the yacc() function itself. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# get_caller_module_dict() +# +# This function returns a dictionary containing all of the symbols defined within +# a caller further down the call stack. This is used to get the environment +# associated with the yacc() call if none was provided. +# ----------------------------------------------------------------------------- + +def get_caller_module_dict(levels): + f = sys._getframe(levels) + ldict = f.f_globals.copy() + if f.f_globals != f.f_locals: + ldict.update(f.f_locals) + return ldict + +# ----------------------------------------------------------------------------- +# parse_grammar() +# +# This takes a raw grammar rule string and parses it into production data +# ----------------------------------------------------------------------------- +def parse_grammar(doc, file, line): + grammar = [] + # Split the doc string into lines + pstrings = doc.splitlines() + lastp = None + dline = line + for ps in pstrings: + dline += 1 + p = ps.split() + if not p: + continue + try: + if p[0] == '|': + # This is a continuation of a previous rule + if not lastp: + raise SyntaxError("%s:%d: Misplaced '|'" % (file, dline)) + prodname = lastp + syms = p[1:] + else: + prodname = p[0] + lastp = prodname + syms = p[2:] + assign = p[1] + if assign != ':' and assign != '::=': + raise SyntaxError("%s:%d: Syntax error. Expected ':'" % (file, dline)) + + grammar.append((file, dline, prodname, syms)) + except SyntaxError: + raise + except Exception: + raise SyntaxError('%s:%d: Syntax error in rule %r' % (file, dline, ps.strip())) + + return grammar + +# ----------------------------------------------------------------------------- +# ParserReflect() +# +# This class represents information extracted for building a parser including +# start symbol, error function, tokens, precedence list, action functions, +# etc. +# ----------------------------------------------------------------------------- +class ParserReflect(object): + def __init__(self, pdict, log=None): + self.pdict = pdict + self.start = None + self.error_func = None + self.tokens = None + self.modules = set() + self.grammar = [] + self.error = False + + if log is None: + self.log = PlyLogger(sys.stderr) + else: + self.log = log + + # Get all of the basic information + def get_all(self): + self.get_start() + self.get_error_func() + self.get_tokens() + self.get_precedence() + self.get_pfunctions() + + # Validate all of the information + def validate_all(self): + self.validate_start() + self.validate_error_func() + self.validate_tokens() + self.validate_precedence() + self.validate_pfunctions() + self.validate_modules() + return self.error + + # Compute a signature over the grammar + def signature(self): + parts = [] + try: + if self.start: + parts.append(self.start) + if self.prec: + parts.append(''.join([''.join(p) for p in self.prec])) + if self.tokens: + parts.append(' '.join(self.tokens)) + for f in self.pfuncs: + if f[3]: + parts.append(f[3]) + except (TypeError, ValueError): + pass + return ''.join(parts) + + # ----------------------------------------------------------------------------- + # validate_modules() + # + # This method checks to see if there are duplicated p_rulename() functions + # in the parser module file. Without this function, it is really easy for + # users to make mistakes by cutting and pasting code fragments (and it's a real + # bugger to try and figure out why the resulting parser doesn't work). Therefore, + # we just do a little regular expression pattern matching of def statements + # to try and detect duplicates. + # ----------------------------------------------------------------------------- + + def validate_modules(self): + # Match def p_funcname( + fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(') + + for module in self.modules: + try: + lines, linen = inspect.getsourcelines(module) + except IOError: + continue + + counthash = {} + for linen, line in enumerate(lines): + linen += 1 + m = fre.match(line) + if m: + name = m.group(1) + prev = counthash.get(name) + if not prev: + counthash[name] = linen + else: + filename = inspect.getsourcefile(module) + self.log.warning('%s:%d: Function %s redefined. Previously defined on line %d', + filename, linen, name, prev) + + # Get the start symbol + def get_start(self): + self.start = self.pdict.get('start') + + # Validate the start symbol + def validate_start(self): + if self.start is not None: + if not isinstance(self.start, string_types): + self.log.error("'start' must be a string") + + # Look for error handler + def get_error_func(self): + self.error_func = self.pdict.get('p_error') + + # Validate the error function + def validate_error_func(self): + if self.error_func: + if isinstance(self.error_func, types.FunctionType): + ismethod = 0 + elif isinstance(self.error_func, types.MethodType): + ismethod = 1 + else: + self.log.error("'p_error' defined, but is not a function or method") + self.error = True + return + + eline = self.error_func.__code__.co_firstlineno + efile = self.error_func.__code__.co_filename + module = inspect.getmodule(self.error_func) + self.modules.add(module) + + argcount = self.error_func.__code__.co_argcount - ismethod + if argcount != 1: + self.log.error('%s:%d: p_error() requires 1 argument', efile, eline) + self.error = True + + # Get the tokens map + def get_tokens(self): + tokens = self.pdict.get('tokens') + if not tokens: + self.log.error('No token list is defined') + self.error = True + return + + if not isinstance(tokens, (list, tuple)): + self.log.error('tokens must be a list or tuple') + self.error = True + return + + if not tokens: + self.log.error('tokens is empty') + self.error = True + return + + self.tokens = tokens + + # Validate the tokens + def validate_tokens(self): + # Validate the tokens. + if 'error' in self.tokens: + self.log.error("Illegal token name 'error'. Is a reserved word") + self.error = True + return + + terminals = set() + for n in self.tokens: + if n in terminals: + self.log.warning('Token %r multiply defined', n) + terminals.add(n) + + # Get the precedence map (if any) + def get_precedence(self): + self.prec = self.pdict.get('precedence') + + # Validate and parse the precedence map + def validate_precedence(self): + preclist = [] + if self.prec: + if not isinstance(self.prec, (list, tuple)): + self.log.error('precedence must be a list or tuple') + self.error = True + return + for level, p in enumerate(self.prec): + if not isinstance(p, (list, tuple)): + self.log.error('Bad precedence table') + self.error = True + return + + if len(p) < 2: + self.log.error('Malformed precedence entry %s. Must be (assoc, term, ..., term)', p) + self.error = True + return + assoc = p[0] + if not isinstance(assoc, string_types): + self.log.error('precedence associativity must be a string') + self.error = True + return + for term in p[1:]: + if not isinstance(term, string_types): + self.log.error('precedence items must be strings') + self.error = True + return + preclist.append((term, assoc, level+1)) + self.preclist = preclist + + # Get all p_functions from the grammar + def get_pfunctions(self): + p_functions = [] + for name, item in self.pdict.items(): + if not name.startswith('p_') or name == 'p_error': + continue + if isinstance(item, (types.FunctionType, types.MethodType)): + line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno) + module = inspect.getmodule(item) + p_functions.append((line, module, name, item.__doc__)) + + # Sort all of the actions by line number; make sure to stringify + # modules to make them sortable, since `line` may not uniquely sort all + # p functions + p_functions.sort(key=lambda p_function: ( + p_function[0], + str(p_function[1]), + p_function[2], + p_function[3])) + self.pfuncs = p_functions + + # Validate all of the p_functions + def validate_pfunctions(self): + grammar = [] + # Check for non-empty symbols + if len(self.pfuncs) == 0: + self.log.error('no rules of the form p_rulename are defined') + self.error = True + return + + for line, module, name, doc in self.pfuncs: + file = inspect.getsourcefile(module) + func = self.pdict[name] + if isinstance(func, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + if func.__code__.co_argcount > reqargs: + self.log.error('%s:%d: Rule %r has too many arguments', file, line, func.__name__) + self.error = True + elif func.__code__.co_argcount < reqargs: + self.log.error('%s:%d: Rule %r requires an argument', file, line, func.__name__) + self.error = True + elif not func.__doc__: + self.log.warning('%s:%d: No documentation string specified in function %r (ignored)', + file, line, func.__name__) + else: + try: + parsed_g = parse_grammar(doc, file, line) + for g in parsed_g: + grammar.append((name, g)) + except SyntaxError as e: + self.log.error(str(e)) + self.error = True + + # Looks like a valid grammar rule + # Mark the file in which defined. + self.modules.add(module) + + # Secondary validation step that looks for p_ definitions that are not functions + # or functions that look like they might be grammar rules. + + for n, v in self.pdict.items(): + if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)): + continue + if n.startswith('t_'): + continue + if n.startswith('p_') and n != 'p_error': + self.log.warning('%r not defined as a function', n) + if ((isinstance(v, types.FunctionType) and v.__code__.co_argcount == 1) or + (isinstance(v, types.MethodType) and v.__func__.__code__.co_argcount == 2)): + if v.__doc__: + try: + doc = v.__doc__.split(' ') + if doc[1] == ':': + self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix', + v.__code__.co_filename, v.__code__.co_firstlineno, n) + except IndexError: + pass + + self.grammar = grammar + +# ----------------------------------------------------------------------------- +# yacc(module) +# +# Build a parser +# ----------------------------------------------------------------------------- + +def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None, + check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file, + outputdir=None, debuglog=None, errorlog=None, picklefile=None): + + if tabmodule is None: + tabmodule = tab_module + + # Reference to the parsing method of the last built parser + global parse + + # If pickling is enabled, table files are not created + if picklefile: + write_tables = 0 + + if errorlog is None: + errorlog = PlyLogger(sys.stderr) + + # Get the module dictionary used for the parser + if module: + _items = [(k, getattr(module, k)) for k in dir(module)] + pdict = dict(_items) + # If no __file__ attribute is available, try to obtain it from the __module__ instead + if '__file__' not in pdict: + pdict['__file__'] = sys.modules[pdict['__module__']].__file__ + else: + pdict = get_caller_module_dict(2) + + if outputdir is None: + # If no output directory is set, the location of the output files + # is determined according to the following rules: + # - If tabmodule specifies a package, files go into that package directory + # - Otherwise, files go in the same directory as the specifying module + if isinstance(tabmodule, types.ModuleType): + srcfile = tabmodule.__file__ + else: + if '.' not in tabmodule: + srcfile = pdict['__file__'] + else: + parts = tabmodule.split('.') + pkgname = '.'.join(parts[:-1]) + exec('import %s' % pkgname) + srcfile = getattr(sys.modules[pkgname], '__file__', '') + outputdir = os.path.dirname(srcfile) + + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = pdict.get('__package__') + if pkg and isinstance(tabmodule, str): + if '.' not in tabmodule: + tabmodule = pkg + '.' + tabmodule + + + + # Set start symbol if it's specified directly using an argument + if start is not None: + pdict['start'] = start + + # Collect parser information from the dictionary + pinfo = ParserReflect(pdict, log=errorlog) + pinfo.get_all() + + if pinfo.error: + raise YaccError('Unable to build parser') + + # Check signature against table files (if any) + signature = pinfo.signature() + + # Read the tables + try: + lr = LRTable() + if picklefile: + read_signature = lr.read_pickle(picklefile) + else: + read_signature = lr.read_table(tabmodule) + if optimize or (read_signature == signature): + try: + lr.bind_callables(pinfo.pdict) + parser = LRParser(lr, pinfo.error_func) + parse = parser.parse + return parser + except Exception as e: + errorlog.warning('There was a problem loading the table file: %r', e) + except VersionError as e: + errorlog.warning(str(e)) + except ImportError: + pass + + if debuglog is None: + if debug: + try: + debuglog = PlyLogger(open(os.path.join(outputdir, debugfile), 'w')) + except IOError as e: + errorlog.warning("Couldn't open %r. %s" % (debugfile, e)) + debuglog = NullLogger() + else: + debuglog = NullLogger() + + debuglog.info('Created by PLY version %s (http://www.dabeaz.com/ply)', __version__) + + errors = False + + # Validate the parser information + if pinfo.validate_all(): + raise YaccError('Unable to build parser') + + if not pinfo.error_func: + errorlog.warning('no p_error() function is defined') + + # Create a grammar object + grammar = Grammar(pinfo.tokens) + + # Set precedence level for terminals + for term, assoc, level in pinfo.preclist: + try: + grammar.set_precedence(term, assoc, level) + except GrammarError as e: + errorlog.warning('%s', e) + + # Add productions to the grammar + for funcname, gram in pinfo.grammar: + file, line, prodname, syms = gram + try: + grammar.add_production(prodname, syms, funcname, file, line) + except GrammarError as e: + errorlog.error('%s', e) + errors = True + + # Set the grammar start symbols + try: + if start is None: + grammar.set_start(pinfo.start) + else: + grammar.set_start(start) + except GrammarError as e: + errorlog.error(str(e)) + errors = True + + if errors: + raise YaccError('Unable to build parser') + + # Verify the grammar structure + undefined_symbols = grammar.undefined_symbols() + for sym, prod in undefined_symbols: + errorlog.error('%s:%d: Symbol %r used, but not defined as a token or a rule', prod.file, prod.line, sym) + errors = True + + unused_terminals = grammar.unused_terminals() + if unused_terminals: + debuglog.info('') + debuglog.info('Unused terminals:') + debuglog.info('') + for term in unused_terminals: + errorlog.warning('Token %r defined, but not used', term) + debuglog.info(' %s', term) + + # Print out all productions to the debug log + if debug: + debuglog.info('') + debuglog.info('Grammar') + debuglog.info('') + for n, p in enumerate(grammar.Productions): + debuglog.info('Rule %-5d %s', n, p) + + # Find unused non-terminals + unused_rules = grammar.unused_rules() + for prod in unused_rules: + errorlog.warning('%s:%d: Rule %r defined, but not used', prod.file, prod.line, prod.name) + + if len(unused_terminals) == 1: + errorlog.warning('There is 1 unused token') + if len(unused_terminals) > 1: + errorlog.warning('There are %d unused tokens', len(unused_terminals)) + + if len(unused_rules) == 1: + errorlog.warning('There is 1 unused rule') + if len(unused_rules) > 1: + errorlog.warning('There are %d unused rules', len(unused_rules)) + + if debug: + debuglog.info('') + debuglog.info('Terminals, with rules where they appear') + debuglog.info('') + terms = list(grammar.Terminals) + terms.sort() + for term in terms: + debuglog.info('%-20s : %s', term, ' '.join([str(s) for s in grammar.Terminals[term]])) + + debuglog.info('') + debuglog.info('Nonterminals, with rules where they appear') + debuglog.info('') + nonterms = list(grammar.Nonterminals) + nonterms.sort() + for nonterm in nonterms: + debuglog.info('%-20s : %s', nonterm, ' '.join([str(s) for s in grammar.Nonterminals[nonterm]])) + debuglog.info('') + + if check_recursion: + unreachable = grammar.find_unreachable() + for u in unreachable: + errorlog.warning('Symbol %r is unreachable', u) + + infinite = grammar.infinite_cycles() + for inf in infinite: + errorlog.error('Infinite recursion detected for symbol %r', inf) + errors = True + + unused_prec = grammar.unused_precedence() + for term, assoc in unused_prec: + errorlog.error('Precedence rule %r defined for unknown symbol %r', assoc, term) + errors = True + + if errors: + raise YaccError('Unable to build parser') + + # Run the LRGeneratedTable on the grammar + if debug: + errorlog.debug('Generating %s tables', method) + + lr = LRGeneratedTable(grammar, method, debuglog) + + if debug: + num_sr = len(lr.sr_conflicts) + + # Report shift/reduce and reduce/reduce conflicts + if num_sr == 1: + errorlog.warning('1 shift/reduce conflict') + elif num_sr > 1: + errorlog.warning('%d shift/reduce conflicts', num_sr) + + num_rr = len(lr.rr_conflicts) + if num_rr == 1: + errorlog.warning('1 reduce/reduce conflict') + elif num_rr > 1: + errorlog.warning('%d reduce/reduce conflicts', num_rr) + + # Write out conflicts to the output file + if debug and (lr.sr_conflicts or lr.rr_conflicts): + debuglog.warning('') + debuglog.warning('Conflicts:') + debuglog.warning('') + + for state, tok, resolution in lr.sr_conflicts: + debuglog.warning('shift/reduce conflict for %s in state %d resolved as %s', tok, state, resolution) + + already_reported = set() + for state, rule, rejected in lr.rr_conflicts: + if (state, id(rule), id(rejected)) in already_reported: + continue + debuglog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule) + debuglog.warning('rejected rule (%s) in state %d', rejected, state) + errorlog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule) + errorlog.warning('rejected rule (%s) in state %d', rejected, state) + already_reported.add((state, id(rule), id(rejected))) + + warned_never = [] + for state, rule, rejected in lr.rr_conflicts: + if not rejected.reduced and (rejected not in warned_never): + debuglog.warning('Rule (%s) is never reduced', rejected) + errorlog.warning('Rule (%s) is never reduced', rejected) + warned_never.append(rejected) + + # Write the table file if requested + if write_tables: + try: + lr.write_table(tabmodule, outputdir, signature) + except IOError as e: + errorlog.warning("Couldn't create %r. %s" % (tabmodule, e)) + + # Write a pickled version of the tables + if picklefile: + try: + lr.pickle_table(picklefile, signature) + except IOError as e: + errorlog.warning("Couldn't create %r. %s" % (picklefile, e)) + + # Build the parser + lr.bind_callables(pinfo.pdict) + parser = LRParser(lr, pinfo.error_func) + + parse = parser.parse + return parser diff --git a/billinglayer/python/pycparser/ply/ygen.py b/billinglayer/python/pycparser/ply/ygen.py new file mode 100644 index 0000000..acf5ca1 --- /dev/null +++ b/billinglayer/python/pycparser/ply/ygen.py @@ -0,0 +1,74 @@ +# ply: ygen.py +# +# This is a support program that auto-generates different versions of the YACC parsing +# function with different features removed for the purposes of performance. +# +# Users should edit the method LParser.parsedebug() in yacc.py. The source code +# for that method is then used to create the other methods. See the comments in +# yacc.py for further details. + +import os.path +import shutil + +def get_source_range(lines, tag): + srclines = enumerate(lines) + start_tag = '#--! %s-start' % tag + end_tag = '#--! %s-end' % tag + + for start_index, line in srclines: + if line.strip().startswith(start_tag): + break + + for end_index, line in srclines: + if line.strip().endswith(end_tag): + break + + return (start_index + 1, end_index) + +def filter_section(lines, tag): + filtered_lines = [] + include = True + tag_text = '#--! %s' % tag + for line in lines: + if line.strip().startswith(tag_text): + include = not include + elif include: + filtered_lines.append(line) + return filtered_lines + +def main(): + dirname = os.path.dirname(__file__) + shutil.copy2(os.path.join(dirname, 'yacc.py'), os.path.join(dirname, 'yacc.py.bak')) + with open(os.path.join(dirname, 'yacc.py'), 'r') as f: + lines = f.readlines() + + parse_start, parse_end = get_source_range(lines, 'parsedebug') + parseopt_start, parseopt_end = get_source_range(lines, 'parseopt') + parseopt_notrack_start, parseopt_notrack_end = get_source_range(lines, 'parseopt-notrack') + + # Get the original source + orig_lines = lines[parse_start:parse_end] + + # Filter the DEBUG sections out + parseopt_lines = filter_section(orig_lines, 'DEBUG') + + # Filter the TRACKING sections out + parseopt_notrack_lines = filter_section(parseopt_lines, 'TRACKING') + + # Replace the parser source sections with updated versions + lines[parseopt_notrack_start:parseopt_notrack_end] = parseopt_notrack_lines + lines[parseopt_start:parseopt_end] = parseopt_lines + + lines = [line.rstrip()+'\n' for line in lines] + with open(os.path.join(dirname, 'yacc.py'), 'w') as f: + f.writelines(lines) + + print('Updated yacc.py') + +if __name__ == '__main__': + main() + + + + + diff --git a/billinglayer/python/pycparser/plyparser.py b/billinglayer/python/pycparser/plyparser.py new file mode 100644 index 0000000..b8f4c43 --- /dev/null +++ b/billinglayer/python/pycparser/plyparser.py @@ -0,0 +1,133 @@ +#----------------------------------------------------------------- +# plyparser.py +# +# PLYParser class and other utilities for simplifying programming +# parsers with PLY +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +import warnings + +class Coord(object): + """ Coordinates of a syntactic element. Consists of: + - File name + - Line number + - (optional) column number, for the Lexer + """ + __slots__ = ('file', 'line', 'column', '__weakref__') + def __init__(self, file, line, column=None): + self.file = file + self.line = line + self.column = column + + def __str__(self): + str = "%s:%s" % (self.file, self.line) + if self.column: str += ":%s" % self.column + return str + + +class ParseError(Exception): pass + + +class PLYParser(object): + def _create_opt_rule(self, rulename): + """ Given a rule name, creates an optional ply.yacc rule + for it. The name of the optional rule is + _opt + """ + optname = rulename + '_opt' + + def optrule(self, p): + p[0] = p[1] + + optrule.__doc__ = '%s : empty\n| %s' % (optname, rulename) + optrule.__name__ = 'p_%s' % optname + setattr(self.__class__, optrule.__name__, optrule) + + def _coord(self, lineno, column=None): + return Coord( + file=self.clex.filename, + line=lineno, + column=column) + + def _token_coord(self, p, token_idx): + """ Returns the coordinates for the YaccProduction object 'p' indexed + with 'token_idx'. The coordinate includes the 'lineno' and + 'column'. Both follow the lex semantic, starting from 1. + """ + last_cr = p.lexer.lexer.lexdata.rfind('\n', 0, p.lexpos(token_idx)) + if last_cr < 0: + last_cr = -1 + column = (p.lexpos(token_idx) - (last_cr)) + return self._coord(p.lineno(token_idx), column) + + def _parse_error(self, msg, coord): + raise ParseError("%s: %s" % (coord, msg)) + + +def parameterized(*params): + """ Decorator to create parameterized rules. + + Parameterized rule methods must be named starting with 'p_' and contain + 'xxx', and their docstrings may contain 'xxx' and 'yyy'. These will be + replaced by the given parameter tuples. For example, ``p_xxx_rule()`` with + docstring 'xxx_rule : yyy' when decorated with + ``@parameterized(('id', 'ID'))`` produces ``p_id_rule()`` with the docstring + 'id_rule : ID'. Using multiple tuples produces multiple rules. + """ + def decorate(rule_func): + rule_func._params = params + return rule_func + return decorate + + +def template(cls): + """ Class decorator to generate rules from parameterized rule templates. + + See `parameterized` for more information on parameterized rules. + """ + issued_nodoc_warning = False + for attr_name in dir(cls): + if attr_name.startswith('p_'): + method = getattr(cls, attr_name) + if hasattr(method, '_params'): + # Remove the template method + delattr(cls, attr_name) + # Create parameterized rules from this method; only run this if + # the method has a docstring. This is to address an issue when + # pycparser's users are installed in -OO mode which strips + # docstrings away. + # See: https://github.com/eliben/pycparser/pull/198/ and + # https://github.com/eliben/pycparser/issues/197 + # for discussion. + if method.__doc__ is not None: + _create_param_rules(cls, method) + elif not issued_nodoc_warning: + warnings.warn( + 'parsing methods must have __doc__ for pycparser to work properly', + RuntimeWarning, + stacklevel=2) + issued_nodoc_warning = True + return cls + + +def _create_param_rules(cls, func): + """ Create ply.yacc rules based on a parameterized rule function + + Generates new methods (one per each pair of parameters) based on the + template rule function `func`, and attaches them to `cls`. The rule + function's parameters must be accessible via its `_params` attribute. + """ + for xxx, yyy in func._params: + # Use the template method's body for each new method + def param_rule(self, p): + func(self, p) + + # Substitute in the params for the grammar rule and function name + param_rule.__doc__ = func.__doc__.replace('xxx', xxx).replace('yyy', yyy) + param_rule.__name__ = func.__name__.replace('xxx', xxx) + + # Attach the new method to the class + setattr(cls, param_rule.__name__, param_rule) diff --git a/billinglayer/python/pycparser/yacctab.py b/billinglayer/python/pycparser/yacctab.py new file mode 100644 index 0000000..0622c36 --- /dev/null +++ b/billinglayer/python/pycparser/yacctab.py @@ -0,0 +1,366 @@ + +# yacctab.py +# This file is automatically generated. Do not edit. +_tabversion = '3.10' + +_lr_method = 'LALR' + +_lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EXTERN FLOAT FOR GOTO IF INLINE INT LONG REGISTER OFFSETOF RESTRICT RETURN SHORT SIGNED SIZEOF STATIC STRUCT SWITCH TYPEDEF UNION UNSIGNED VOID VOLATILE WHILE __INT128 _BOOL _COMPLEX _NORETURN _THREAD_LOCAL _STATIC_ASSERT _ATOMIC _ALIGNOF _ALIGNAS ID TYPEID INT_CONST_DEC INT_CONST_OCT INT_CONST_HEX INT_CONST_BIN INT_CONST_CHAR FLOAT_CONST HEX_FLOAT_CONST CHAR_CONST WCHAR_CONST U8CHAR_CONST U16CHAR_CONST U32CHAR_CONST STRING_LITERAL WSTRING_LITERAL U8STRING_LITERAL U16STRING_LITERAL U32STRING_LITERAL PLUS MINUS TIMES DIVIDE MOD OR AND NOT XOR LSHIFT RSHIFT LOR LAND LNOT LT LE GT GE EQ NE EQUALS TIMESEQUAL DIVEQUAL MODEQUAL PLUSEQUAL MINUSEQUAL LSHIFTEQUAL RSHIFTEQUAL ANDEQUAL XOREQUAL OREQUAL PLUSPLUS MINUSMINUS ARROW CONDOP LPAREN RPAREN LBRACKET RBRACKET LBRACE RBRACE COMMA PERIOD SEMI COLON ELLIPSIS PPHASH PPPRAGMA PPPRAGMASTRabstract_declarator_opt : empty\n| abstract_declaratorassignment_expression_opt : empty\n| assignment_expressionblock_item_list_opt : empty\n| block_item_listdeclaration_list_opt : empty\n| declaration_listdeclaration_specifiers_no_type_opt : empty\n| declaration_specifiers_no_typedesignation_opt : empty\n| designationexpression_opt : empty\n| expressionid_init_declarator_list_opt : empty\n| id_init_declarator_listidentifier_list_opt : empty\n| identifier_listinit_declarator_list_opt : empty\n| init_declarator_listinitializer_list_opt : empty\n| initializer_listparameter_type_list_opt : empty\n| parameter_type_liststruct_declarator_list_opt : empty\n| struct_declarator_listtype_qualifier_list_opt : empty\n| type_qualifier_list direct_id_declarator : ID\n direct_id_declarator : LPAREN id_declarator RPAREN\n direct_id_declarator : direct_id_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_id_declarator : direct_id_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n | direct_id_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n direct_id_declarator : direct_id_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n direct_id_declarator : direct_id_declarator LPAREN parameter_type_list RPAREN\n | direct_id_declarator LPAREN identifier_list_opt RPAREN\n direct_typeid_declarator : TYPEID\n direct_typeid_declarator : LPAREN typeid_declarator RPAREN\n direct_typeid_declarator : direct_typeid_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_typeid_declarator : direct_typeid_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n | direct_typeid_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n direct_typeid_declarator : direct_typeid_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n direct_typeid_declarator : direct_typeid_declarator LPAREN parameter_type_list RPAREN\n | direct_typeid_declarator LPAREN identifier_list_opt RPAREN\n direct_typeid_noparen_declarator : TYPEID\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n | direct_typeid_noparen_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LPAREN parameter_type_list RPAREN\n | direct_typeid_noparen_declarator LPAREN identifier_list_opt RPAREN\n id_declarator : direct_id_declarator\n id_declarator : pointer direct_id_declarator\n typeid_declarator : direct_typeid_declarator\n typeid_declarator : pointer direct_typeid_declarator\n typeid_noparen_declarator : direct_typeid_noparen_declarator\n typeid_noparen_declarator : pointer direct_typeid_noparen_declarator\n translation_unit_or_empty : translation_unit\n | empty\n translation_unit : external_declaration\n translation_unit : translation_unit external_declaration\n external_declaration : function_definition\n external_declaration : declaration\n external_declaration : pp_directive\n | pppragma_directive\n external_declaration : SEMI\n external_declaration : static_assert\n static_assert : _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN\n | _STATIC_ASSERT LPAREN constant_expression RPAREN\n pp_directive : PPHASH\n pppragma_directive : PPPRAGMA\n | PPPRAGMA PPPRAGMASTR\n function_definition : id_declarator declaration_list_opt compound_statement\n function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement\n statement : labeled_statement\n | expression_statement\n | compound_statement\n | selection_statement\n | iteration_statement\n | jump_statement\n | pppragma_directive\n | static_assert\n pragmacomp_or_statement : pppragma_directive statement\n | statement\n decl_body : declaration_specifiers init_declarator_list_opt\n | declaration_specifiers_no_type id_init_declarator_list_opt\n declaration : decl_body SEMI\n declaration_list : declaration\n | declaration_list declaration\n declaration_specifiers_no_type : type_qualifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : storage_class_specifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : function_specifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : atomic_specifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : alignment_specifier declaration_specifiers_no_type_opt\n declaration_specifiers : declaration_specifiers type_qualifier\n declaration_specifiers : declaration_specifiers storage_class_specifier\n declaration_specifiers : declaration_specifiers function_specifier\n declaration_specifiers : declaration_specifiers type_specifier_no_typeid\n declaration_specifiers : type_specifier\n declaration_specifiers : declaration_specifiers_no_type type_specifier\n declaration_specifiers : declaration_specifiers alignment_specifier\n storage_class_specifier : AUTO\n | REGISTER\n | STATIC\n | EXTERN\n | TYPEDEF\n | _THREAD_LOCAL\n function_specifier : INLINE\n | _NORETURN\n type_specifier_no_typeid : VOID\n | _BOOL\n | CHAR\n | SHORT\n | INT\n | LONG\n | FLOAT\n | DOUBLE\n | _COMPLEX\n | SIGNED\n | UNSIGNED\n | __INT128\n type_specifier : typedef_name\n | enum_specifier\n | struct_or_union_specifier\n | type_specifier_no_typeid\n | atomic_specifier\n atomic_specifier : _ATOMIC LPAREN type_name RPAREN\n type_qualifier : CONST\n | RESTRICT\n | VOLATILE\n | _ATOMIC\n init_declarator_list : init_declarator\n | init_declarator_list COMMA init_declarator\n init_declarator : declarator\n | declarator EQUALS initializer\n id_init_declarator_list : id_init_declarator\n | id_init_declarator_list COMMA init_declarator\n id_init_declarator : id_declarator\n | id_declarator EQUALS initializer\n specifier_qualifier_list : specifier_qualifier_list type_specifier_no_typeid\n specifier_qualifier_list : specifier_qualifier_list type_qualifier\n specifier_qualifier_list : type_specifier\n specifier_qualifier_list : type_qualifier_list type_specifier\n specifier_qualifier_list : alignment_specifier\n specifier_qualifier_list : specifier_qualifier_list alignment_specifier\n struct_or_union_specifier : struct_or_union ID\n | struct_or_union TYPEID\n struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close\n | struct_or_union brace_open brace_close\n struct_or_union_specifier : struct_or_union ID brace_open struct_declaration_list brace_close\n | struct_or_union ID brace_open brace_close\n | struct_or_union TYPEID brace_open struct_declaration_list brace_close\n | struct_or_union TYPEID brace_open brace_close\n struct_or_union : STRUCT\n | UNION\n struct_declaration_list : struct_declaration\n | struct_declaration_list struct_declaration\n struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI\n struct_declaration : SEMI\n struct_declaration : pppragma_directive\n struct_declarator_list : struct_declarator\n | struct_declarator_list COMMA struct_declarator\n struct_declarator : declarator\n struct_declarator : declarator COLON constant_expression\n | COLON constant_expression\n enum_specifier : ENUM ID\n | ENUM TYPEID\n enum_specifier : ENUM brace_open enumerator_list brace_close\n enum_specifier : ENUM ID brace_open enumerator_list brace_close\n | ENUM TYPEID brace_open enumerator_list brace_close\n enumerator_list : enumerator\n | enumerator_list COMMA\n | enumerator_list COMMA enumerator\n alignment_specifier : _ALIGNAS LPAREN type_name RPAREN\n | _ALIGNAS LPAREN constant_expression RPAREN\n enumerator : ID\n | ID EQUALS constant_expression\n declarator : id_declarator\n | typeid_declarator\n pointer : TIMES type_qualifier_list_opt\n | TIMES type_qualifier_list_opt pointer\n type_qualifier_list : type_qualifier\n | type_qualifier_list type_qualifier\n parameter_type_list : parameter_list\n | parameter_list COMMA ELLIPSIS\n parameter_list : parameter_declaration\n | parameter_list COMMA parameter_declaration\n parameter_declaration : declaration_specifiers id_declarator\n | declaration_specifiers typeid_noparen_declarator\n parameter_declaration : declaration_specifiers abstract_declarator_opt\n identifier_list : identifier\n | identifier_list COMMA identifier\n initializer : assignment_expression\n initializer : brace_open initializer_list_opt brace_close\n | brace_open initializer_list COMMA brace_close\n initializer_list : designation_opt initializer\n | initializer_list COMMA designation_opt initializer\n designation : designator_list EQUALS\n designator_list : designator\n | designator_list designator\n designator : LBRACKET constant_expression RBRACKET\n | PERIOD identifier\n type_name : specifier_qualifier_list abstract_declarator_opt\n abstract_declarator : pointer\n abstract_declarator : pointer direct_abstract_declarator\n abstract_declarator : direct_abstract_declarator\n direct_abstract_declarator : LPAREN abstract_declarator RPAREN direct_abstract_declarator : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET\n direct_abstract_declarator : LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_abstract_declarator : direct_abstract_declarator LBRACKET TIMES RBRACKET\n direct_abstract_declarator : LBRACKET TIMES RBRACKET\n direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN\n direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN\n block_item : declaration\n | statement\n block_item_list : block_item\n | block_item_list block_item\n compound_statement : brace_open block_item_list_opt brace_close labeled_statement : ID COLON pragmacomp_or_statement labeled_statement : CASE constant_expression COLON pragmacomp_or_statement labeled_statement : DEFAULT COLON pragmacomp_or_statement selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement selection_statement : IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement selection_statement : SWITCH LPAREN expression RPAREN pragmacomp_or_statement iteration_statement : WHILE LPAREN expression RPAREN pragmacomp_or_statement iteration_statement : DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement jump_statement : GOTO ID SEMI jump_statement : BREAK SEMI jump_statement : CONTINUE SEMI jump_statement : RETURN expression SEMI\n | RETURN SEMI\n expression_statement : expression_opt SEMI expression : assignment_expression\n | expression COMMA assignment_expression\n assignment_expression : LPAREN compound_statement RPAREN typedef_name : TYPEID assignment_expression : conditional_expression\n | unary_expression assignment_operator assignment_expression\n assignment_operator : EQUALS\n | XOREQUAL\n | TIMESEQUAL\n | DIVEQUAL\n | MODEQUAL\n | PLUSEQUAL\n | MINUSEQUAL\n | LSHIFTEQUAL\n | RSHIFTEQUAL\n | ANDEQUAL\n | OREQUAL\n constant_expression : conditional_expression conditional_expression : binary_expression\n | binary_expression CONDOP expression COLON conditional_expression\n binary_expression : cast_expression\n | binary_expression TIMES binary_expression\n | binary_expression DIVIDE binary_expression\n | binary_expression MOD binary_expression\n | binary_expression PLUS binary_expression\n | binary_expression MINUS binary_expression\n | binary_expression RSHIFT binary_expression\n | binary_expression LSHIFT binary_expression\n | binary_expression LT binary_expression\n | binary_expression LE binary_expression\n | binary_expression GE binary_expression\n | binary_expression GT binary_expression\n | binary_expression EQ binary_expression\n | binary_expression NE binary_expression\n | binary_expression AND binary_expression\n | binary_expression OR binary_expression\n | binary_expression XOR binary_expression\n | binary_expression LAND binary_expression\n | binary_expression LOR binary_expression\n cast_expression : unary_expression cast_expression : LPAREN type_name RPAREN cast_expression unary_expression : postfix_expression unary_expression : PLUSPLUS unary_expression\n | MINUSMINUS unary_expression\n | unary_operator cast_expression\n unary_expression : SIZEOF unary_expression\n | SIZEOF LPAREN type_name RPAREN\n | _ALIGNOF LPAREN type_name RPAREN\n unary_operator : AND\n | TIMES\n | PLUS\n | MINUS\n | NOT\n | LNOT\n postfix_expression : primary_expression postfix_expression : postfix_expression LBRACKET expression RBRACKET postfix_expression : postfix_expression LPAREN argument_expression_list RPAREN\n | postfix_expression LPAREN RPAREN\n postfix_expression : postfix_expression PERIOD ID\n | postfix_expression PERIOD TYPEID\n | postfix_expression ARROW ID\n | postfix_expression ARROW TYPEID\n postfix_expression : postfix_expression PLUSPLUS\n | postfix_expression MINUSMINUS\n postfix_expression : LPAREN type_name RPAREN brace_open initializer_list brace_close\n | LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close\n primary_expression : identifier primary_expression : constant primary_expression : unified_string_literal\n | unified_wstring_literal\n primary_expression : LPAREN expression RPAREN primary_expression : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN\n offsetof_member_designator : identifier\n | offsetof_member_designator PERIOD identifier\n | offsetof_member_designator LBRACKET expression RBRACKET\n argument_expression_list : assignment_expression\n | argument_expression_list COMMA assignment_expression\n identifier : ID constant : INT_CONST_DEC\n | INT_CONST_OCT\n | INT_CONST_HEX\n | INT_CONST_BIN\n | INT_CONST_CHAR\n constant : FLOAT_CONST\n | HEX_FLOAT_CONST\n constant : CHAR_CONST\n | WCHAR_CONST\n | U8CHAR_CONST\n | U16CHAR_CONST\n | U32CHAR_CONST\n unified_string_literal : STRING_LITERAL\n | unified_string_literal STRING_LITERAL\n unified_wstring_literal : WSTRING_LITERAL\n | U8STRING_LITERAL\n | U16STRING_LITERAL\n | U32STRING_LITERAL\n | unified_wstring_literal WSTRING_LITERAL\n | unified_wstring_literal U8STRING_LITERAL\n | unified_wstring_literal U16STRING_LITERAL\n | unified_wstring_literal U32STRING_LITERAL\n brace_open : LBRACE\n brace_close : RBRACE\n empty : ' + +_lr_action_items = {'INT_CONST_CHAR':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,132,-335,-28,-182,-27,132,-337,-87,-72,-337,132,-286,-285,132,132,-283,-287,-288,132,-284,132,132,132,-336,-183,132,132,-28,-337,132,-28,-337,-337,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,-337,-76,-79,-82,-75,132,-77,132,132,-81,-215,-214,-80,-216,132,-78,132,132,-69,-284,132,132,-284,132,132,-244,-247,-245,-241,-242,-246,-248,132,-250,-251,-243,-249,-12,132,132,-11,132,132,132,132,-234,-233,132,-231,132,132,-217,132,-230,132,-84,-218,132,132,132,-337,-337,-198,132,132,132,-337,-284,-229,-232,132,-221,132,-83,-219,-68,132,-28,-337,132,-11,132,132,-220,132,132,132,-284,132,132,132,-337,132,-225,-224,-222,-84,132,132,132,-226,-223,132,-228,-227,]),'VOID':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[6,-337,-113,-128,6,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,6,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,6,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,6,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,6,-131,-95,-101,-97,6,-53,-126,6,-88,6,6,-93,6,-147,-335,-146,6,-167,-166,-182,-100,-126,6,-87,-90,-94,-92,-61,-72,6,-144,-142,6,6,6,-73,6,-89,6,6,6,-149,-159,-160,-156,-336,6,-183,-30,6,6,-74,6,6,6,6,-174,-175,6,-143,-140,6,-141,-145,-76,-79,-82,-75,-77,6,-81,-215,-214,-80,-216,-78,-127,6,-153,6,-151,-148,-157,-168,-69,-36,-35,6,6,6,-234,-233,6,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,6,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LBRACKET':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,71,73,76,77,80,81,82,86,96,97,98,100,101,103,104,105,106,109,111,127,132,133,134,136,138,139,140,141,142,143,145,147,148,152,153,154,156,160,161,163,164,166,167,168,169,176,177,187,191,198,199,200,211,216,227,230,235,236,237,238,240,241,261,263,269,275,276,278,279,280,283,310,312,314,316,317,328,340,341,342,344,345,347,355,356,371,376,402,403,404,405,407,411,414,442,443,448,449,453,454,457,458,464,465,470,472,474,482,483,488,489,490,492,511,512,518,519,520,526,527,529,530,531,532,544,545,547,550,551,559,560,563,565,570,571,572,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,117,-123,-117,-119,-114,-130,-118,-103,-96,-98,128,-131,-37,-95,-101,-97,117,-147,-335,-146,-167,-166,-28,-180,-182,-27,-100,-126,128,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-314,-142,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,265,-323,-312,282,-149,-336,-183,-181,-30,282,-38,373,-326,-334,-332,-331,-333,-174,-175,-298,-297,-143,-140,282,282,-141,-145,421,-312,-127,-153,-151,-148,-168,-36,-35,282,282,459,-45,-44,-43,-199,373,-296,-295,-294,-293,-292,-305,421,-152,-150,-170,-169,-31,-34,282,459,-39,-42,-202,373,-200,-290,-291,373,-213,-207,-211,-33,-32,-41,-40,-201,549,-307,-209,-208,-210,-212,-51,-50,-306,373,-299,-46,-49,-308,-300,-48,-47,-309,]),'WCHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,133,-335,-28,-182,-27,133,-337,-87,-72,-337,133,-286,-285,133,133,-283,-287,-288,133,-284,133,133,133,-336,-183,133,133,-28,-337,133,-28,-337,-337,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-337,-76,-79,-82,-75,133,-77,133,133,-81,-215,-214,-80,-216,133,-78,133,133,-69,-284,133,133,-284,133,133,-244,-247,-245,-241,-242,-246,-248,133,-250,-251,-243,-249,-12,133,133,-11,133,133,133,133,-234,-233,133,-231,133,133,-217,133,-230,133,-84,-218,133,133,133,-337,-337,-198,133,133,133,-337,-284,-229,-232,133,-221,133,-83,-219,-68,133,-28,-337,133,-11,133,133,-220,133,133,133,-284,133,133,133,-337,133,-225,-224,-222,-84,133,133,133,-226,-223,133,-228,-227,]),'FLOAT_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,134,-335,-28,-182,-27,134,-337,-87,-72,-337,134,-286,-285,134,134,-283,-287,-288,134,-284,134,134,134,-336,-183,134,134,-28,-337,134,-28,-337,-337,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,-337,-76,-79,-82,-75,134,-77,134,134,-81,-215,-214,-80,-216,134,-78,134,134,-69,-284,134,134,-284,134,134,-244,-247,-245,-241,-242,-246,-248,134,-250,-251,-243,-249,-12,134,134,-11,134,134,134,134,-234,-233,134,-231,134,134,-217,134,-230,134,-84,-218,134,134,134,-337,-337,-198,134,134,134,-337,-284,-229,-232,134,-221,134,-83,-219,-68,134,-28,-337,134,-11,134,134,-220,134,134,134,-284,134,134,134,-337,134,-225,-224,-222,-84,134,134,134,-226,-223,134,-228,-227,]),'MINUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,135,-335,-28,-182,-27,135,-337,-87,-72,-337,135,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,135,-327,135,-283,-287,-325,-304,-322,-302,-255,-315,-289,245,-328,-316,-288,-329,-320,-276,-323,135,-284,135,135,-312,135,-336,-183,135,135,-28,-337,135,-28,-337,-274,-337,135,-326,135,-280,135,-277,-334,-332,-331,-333,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-298,-297,135,135,-279,-278,-337,-76,-79,-82,-75,135,-77,135,135,-81,-215,-214,-80,-216,135,-78,-312,135,135,-69,-284,135,135,-284,135,135,-244,-247,-245,-241,-242,-246,-248,135,-250,-251,-243,-249,-12,135,135,-11,245,245,245,-260,245,245,245,-259,245,245,-257,-256,245,245,245,245,245,-258,-296,-295,-294,-293,-292,-305,135,135,135,135,-234,-233,135,-231,135,135,-217,135,-230,135,-84,-218,135,135,135,-337,-337,-198,135,-281,-282,135,-290,-291,135,-275,-337,-284,-229,-232,135,-221,135,-83,-219,-68,135,-28,-337,135,-11,135,135,-220,135,135,135,-284,135,135,-306,135,-337,-299,135,-225,-224,-222,-84,-300,135,135,135,-226,-223,135,-228,-227,]),'RPAREN':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,71,73,76,77,80,81,82,86,96,98,100,101,103,104,105,106,107,109,111,118,125,127,129,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,157,158,159,160,161,162,163,164,166,167,168,169,176,177,178,183,187,191,198,199,200,203,207,208,209,210,211,212,213,215,216,221,222,224,225,230,232,234,235,236,237,238,240,241,261,263,266,268,269,270,271,272,273,274,275,276,277,278,279,280,281,283,294,312,314,316,317,328,340,341,342,343,344,345,346,347,348,355,356,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,408,409,411,414,415,416,417,418,422,433,439,442,443,448,449,452,453,454,457,458,460,461,462,463,464,465,468,476,478,480,482,483,486,487,489,490,492,495,501,503,507,511,512,516,517,518,519,524,525,526,527,529,530,531,532,544,545,547,551,553,556,559,560,563,565,566,567,570,571,572,573,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-103,-96,-98,-54,-131,-37,-95,-101,-97,-53,-147,-146,-167,-166,-28,-180,-182,-27,200,-100,-126,-337,216,-55,-337,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,240,-255,241,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-337,-252,312,-149,-336,-183,-181,-30,332,340,-17,341,-186,-337,-18,-184,-191,-38,355,356,-274,-239,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,407,-279,-143,411,413,-235,-278,-203,-140,-204,-1,-337,-141,-145,-2,-206,-14,-127,-153,-151,-148,-168,-36,-35,-337,-190,-204,-56,-188,-45,-189,-44,-43,476,477,478,479,480,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-310,483,-305,-205,-23,-24,489,490,-337,-13,-218,-152,-150,-170,-169,510,-31,-34,-204,-57,-337,-192,-185,-187,-39,-42,-240,-237,-281,-282,-290,-291,-236,-275,-213,-207,-211,532,535,537,539,-33,-32,544,545,-41,-40,-254,-311,547,-307,-209,-208,-210,-212,-51,-50,-306,-299,-337,568,-46,-49,-308,-300,-337,574,-48,-47,-309,577,]),'STRUCT':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[24,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,24,-65,-102,-337,-131,-108,-63,-129,24,-29,-62,-70,-52,-337,-337,-337,-130,24,-71,-103,-337,-9,-131,-91,-10,24,24,-53,-337,-88,24,24,-93,24,-335,24,-182,24,-87,-90,-94,-92,-61,-72,24,24,24,-73,24,-89,24,24,24,-159,-160,-156,-336,-183,-30,24,-74,24,24,24,24,-174,-175,24,24,-76,-79,-82,-75,-77,24,-81,-215,-214,-80,-216,-78,-127,24,24,-157,-69,-36,-35,24,24,24,-234,-233,24,-231,-217,-230,-81,-84,-218,-158,-31,-34,24,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LONG':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[23,-337,-113,-128,23,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,23,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,23,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,23,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,23,-131,-95,-101,-97,23,-53,-126,23,-88,23,23,-93,23,-147,-335,-146,23,-167,-166,-182,-100,-126,23,-87,-90,-94,-92,-61,-72,23,-144,-142,23,23,23,-73,23,-89,23,23,23,-149,-159,-160,-156,-336,23,-183,-30,23,23,-74,23,23,23,23,-174,-175,23,-143,-140,23,-141,-145,-76,-79,-82,-75,-77,23,-81,-215,-214,-80,-216,-78,-127,23,-153,23,-151,-148,-157,-168,-69,-36,-35,23,23,23,-234,-233,23,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,23,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PLUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,137,-335,-28,-182,-27,137,-337,-87,-72,-337,137,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,137,-327,137,-283,-287,-325,-304,-322,-302,-255,-315,-289,249,-328,-316,-288,-329,-320,-276,-323,137,-284,137,137,-312,137,-336,-183,137,137,-28,-337,137,-28,-337,-274,-337,137,-326,137,-280,137,-277,-334,-332,-331,-333,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-298,-297,137,137,-279,-278,-337,-76,-79,-82,-75,137,-77,137,137,-81,-215,-214,-80,-216,137,-78,-312,137,137,-69,-284,137,137,-284,137,137,-244,-247,-245,-241,-242,-246,-248,137,-250,-251,-243,-249,-12,137,137,-11,249,249,249,-260,249,249,249,-259,249,249,-257,-256,249,249,249,249,249,-258,-296,-295,-294,-293,-292,-305,137,137,137,137,-234,-233,137,-231,137,137,-217,137,-230,137,-84,-218,137,137,137,-337,-337,-198,137,-281,-282,137,-290,-291,137,-275,-337,-284,-229,-232,137,-221,137,-83,-219,-68,137,-28,-337,137,-11,137,137,-220,137,137,137,-284,137,137,-306,137,-337,-299,137,-225,-224,-222,-84,-300,137,137,137,-226,-223,137,-228,-227,]),'ELLIPSIS':([350,],[462,]),'U32STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,139,-335,-28,-182,-27,139,-337,-87,-72,-337,139,-286,-285,-330,139,-327,139,-283,-287,235,-328,-288,-329,139,-284,139,139,139,-336,-183,139,139,-28,-337,139,-28,-337,-337,139,139,139,-334,-332,-331,-333,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,-337,-76,-79,-82,-75,139,-77,139,139,-81,-215,-214,-80,-216,139,-78,139,139,-69,-284,139,139,-284,139,139,-244,-247,-245,-241,-242,-246,-248,139,-250,-251,-243,-249,-12,139,139,-11,139,139,139,139,-234,-233,139,-231,139,139,-217,139,-230,139,-84,-218,139,139,139,-337,-337,-198,139,139,139,-337,-284,-229,-232,139,-221,139,-83,-219,-68,139,-28,-337,139,-11,139,139,-220,139,139,139,-284,139,139,139,-337,139,-225,-224,-222,-84,139,139,139,-226,-223,139,-228,-227,]),'GT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,250,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,250,-262,-260,-264,250,-263,-259,-266,250,-257,-256,-265,250,250,250,250,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'GOTO':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,287,-336,-76,-79,-82,-75,-77,287,-81,-215,-214,-80,-216,287,-78,-69,-234,-233,-231,287,-217,-230,287,-84,-218,287,-229,-232,-221,287,-83,-219,-68,287,-220,287,287,-225,-224,-222,-84,287,287,-226,-223,287,-228,-227,]),'ENUM':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[32,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,32,-65,-102,-337,-131,-108,-63,-129,32,-29,-62,-70,-52,-337,-337,-337,-130,32,-71,-103,-337,-9,-131,-91,-10,32,32,-53,-337,-88,32,32,-93,32,-335,32,-182,32,-87,-90,-94,-92,-61,-72,32,32,32,-73,32,-89,32,32,32,-159,-160,-156,-336,-183,-30,32,-74,32,32,32,32,-174,-175,32,32,-76,-79,-82,-75,-77,32,-81,-215,-214,-80,-216,-78,-127,32,32,-157,-69,-36,-35,32,32,32,-234,-233,32,-231,-217,-230,-81,-84,-218,-158,-31,-34,32,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PERIOD':([97,132,133,134,136,138,139,140,141,143,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,227,230,235,236,237,238,261,263,310,371,376,402,403,404,405,407,411,470,472,474,482,483,488,520,526,527,547,550,551,563,565,572,],[-335,-317,-321,-318,-303,-324,-330,-313,-319,-301,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,264,-323,-312,-336,372,-326,-334,-332,-331,-333,-298,-297,-312,-199,372,-296,-295,-294,-293,-292,-305,-202,372,-200,-290,-291,372,-201,548,-307,-306,372,-299,-308,-300,-309,]),'GE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,254,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,254,-262,-260,-264,254,-263,-259,-266,254,-257,-256,-265,254,254,254,254,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'INT_CONST_DEC':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,140,-335,-28,-182,-27,140,-337,-87,-72,-337,140,-286,-285,140,140,-283,-287,-288,140,-284,140,140,140,-336,-183,140,140,-28,-337,140,-28,-337,-337,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,-337,-76,-79,-82,-75,140,-77,140,140,-81,-215,-214,-80,-216,140,-78,140,140,-69,-284,140,140,-284,140,140,-244,-247,-245,-241,-242,-246,-248,140,-250,-251,-243,-249,-12,140,140,-11,140,140,140,140,-234,-233,140,-231,140,140,-217,140,-230,140,-84,-218,140,140,140,-337,-337,-198,140,140,140,-337,-284,-229,-232,140,-221,140,-83,-219,-68,140,-28,-337,140,-11,140,140,-220,140,140,140,-284,140,140,140,-337,140,-225,-224,-222,-84,140,140,140,-226,-223,140,-228,-227,]),'ARROW':([132,133,134,136,138,139,140,141,143,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,230,235,236,237,238,261,263,310,402,403,404,405,407,411,482,483,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,262,-323,-312,-336,-326,-334,-332,-331,-333,-298,-297,-312,-296,-295,-294,-293,-292,-305,-290,-291,-306,-299,-300,]),'_STATIC_ASSERT':([0,14,16,17,19,25,38,45,47,59,61,97,119,123,124,180,181,191,223,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[41,-64,-60,-67,-66,-65,-63,-62,-70,41,-71,-335,-87,-61,-72,-73,41,-336,-74,-76,-79,-82,-75,-77,41,-81,-215,-214,-80,-216,41,-78,-69,-234,-233,-231,41,-217,-230,41,-84,-218,41,-229,-232,-221,41,-83,-219,-68,41,-220,41,41,-225,-224,-222,-84,41,41,-226,-223,41,-228,-227,]),'CHAR':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[46,-337,-113,-128,46,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,46,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,46,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,46,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,46,-131,-95,-101,-97,46,-53,-126,46,-88,46,46,-93,46,-147,-335,-146,46,-167,-166,-182,-100,-126,46,-87,-90,-94,-92,-61,-72,46,-144,-142,46,46,46,-73,46,-89,46,46,46,-149,-159,-160,-156,-336,46,-183,-30,46,46,-74,46,46,46,46,-174,-175,46,-143,-140,46,-141,-145,-76,-79,-82,-75,-77,46,-81,-215,-214,-80,-216,-78,-127,46,-153,46,-151,-148,-157,-168,-69,-36,-35,46,46,46,-234,-233,46,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,46,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'HEX_FLOAT_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,141,-335,-28,-182,-27,141,-337,-87,-72,-337,141,-286,-285,141,141,-283,-287,-288,141,-284,141,141,141,-336,-183,141,141,-28,-337,141,-28,-337,-337,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,-337,-76,-79,-82,-75,141,-77,141,141,-81,-215,-214,-80,-216,141,-78,141,141,-69,-284,141,141,-284,141,141,-244,-247,-245,-241,-242,-246,-248,141,-250,-251,-243,-249,-12,141,141,-11,141,141,141,141,-234,-233,141,-231,141,141,-217,141,-230,141,-84,-218,141,141,141,-337,-337,-198,141,141,141,-337,-284,-229,-232,141,-221,141,-83,-219,-68,141,-28,-337,141,-11,141,141,-220,141,141,141,-284,141,141,141,-337,141,-225,-224,-222,-84,141,141,141,-226,-223,141,-228,-227,]),'DOUBLE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[50,-337,-113,-128,50,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,50,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,50,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,50,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,50,-131,-95,-101,-97,50,-53,-126,50,-88,50,50,-93,50,-147,-335,-146,50,-167,-166,-182,-100,-126,50,-87,-90,-94,-92,-61,-72,50,-144,-142,50,50,50,-73,50,-89,50,50,50,-149,-159,-160,-156,-336,50,-183,-30,50,50,-74,50,50,50,50,-174,-175,50,-143,-140,50,-141,-145,-76,-79,-82,-75,-77,50,-81,-215,-214,-80,-216,-78,-127,50,-153,50,-151,-148,-157,-168,-69,-36,-35,50,50,50,-234,-233,50,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,50,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'MINUSEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,358,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'INT_CONST_OCT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,145,-335,-28,-182,-27,145,-337,-87,-72,-337,145,-286,-285,145,145,-283,-287,-288,145,-284,145,145,145,-336,-183,145,145,-28,-337,145,-28,-337,-337,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-337,-76,-79,-82,-75,145,-77,145,145,-81,-215,-214,-80,-216,145,-78,145,145,-69,-284,145,145,-284,145,145,-244,-247,-245,-241,-242,-246,-248,145,-250,-251,-243,-249,-12,145,145,-11,145,145,145,145,-234,-233,145,-231,145,145,-217,145,-230,145,-84,-218,145,145,145,-337,-337,-198,145,145,145,-337,-284,-229,-232,145,-221,145,-83,-219,-68,145,-28,-337,145,-11,145,145,-220,145,145,145,-284,145,145,145,-337,145,-225,-224,-222,-84,145,145,145,-226,-223,145,-228,-227,]),'TIMESEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,367,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'OR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,259,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,259,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,259,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SHORT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[2,-337,-113,-128,2,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,2,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,2,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,2,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,2,-131,-95,-101,-97,2,-53,-126,2,-88,2,2,-93,2,-147,-335,-146,2,-167,-166,-182,-100,-126,2,-87,-90,-94,-92,-61,-72,2,-144,-142,2,2,2,-73,2,-89,2,2,2,-149,-159,-160,-156,-336,2,-183,-30,2,2,-74,2,2,2,2,-174,-175,2,-143,-140,2,-141,-145,-76,-79,-82,-75,-77,2,-81,-215,-214,-80,-216,-78,-127,2,-153,2,-151,-148,-157,-168,-69,-36,-35,2,2,2,-234,-233,2,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,2,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'RETURN':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,290,-336,-76,-79,-82,-75,-77,290,-81,-215,-214,-80,-216,290,-78,-69,-234,-233,-231,290,-217,-230,290,-84,-218,290,-229,-232,-221,290,-83,-219,-68,290,-220,290,290,-225,-224,-222,-84,290,290,-226,-223,290,-228,-227,]),'RSHIFTEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,368,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'_ALIGNAS':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,109,111,118,119,123,124,129,142,147,174,177,180,181,182,184,185,186,187,188,189,190,191,192,200,211,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[8,8,-113,-128,8,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,8,-120,-115,-65,-102,8,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,8,8,-119,8,-114,-130,8,-118,-71,-103,8,-131,-96,-98,8,-131,-95,-101,-97,8,-53,8,8,-88,8,8,-147,-335,-146,8,-167,-166,-100,-126,8,-87,-61,-72,8,-144,-142,8,8,-73,8,-89,8,8,8,-149,-159,-160,-156,-336,8,-30,8,-74,8,8,8,8,-174,-175,8,-143,-140,8,-141,-145,-76,-79,-82,-75,-77,8,-81,-215,-214,-80,-216,-78,-127,8,-153,8,-151,-148,-157,-168,-69,-36,-35,8,8,8,-234,-233,8,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,8,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'RESTRICT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[39,39,-113,-128,39,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,39,-120,-115,-65,-102,39,-131,-108,-238,-111,39,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,39,39,-119,39,-114,-130,39,-118,-71,-103,39,-131,-96,-98,39,-131,-95,-101,-97,39,-53,39,39,-88,39,39,-147,-335,-146,39,-167,-166,39,-182,-100,-126,39,39,-87,-61,-72,39,39,-144,-142,39,39,39,-73,39,-89,39,39,39,-149,-159,-160,-156,-336,39,-183,-30,39,39,39,39,39,-74,39,39,39,39,-174,-175,39,-143,-140,39,-141,-145,39,-76,-79,-82,-75,-77,39,-81,-215,-214,-80,-216,-78,-127,39,-153,39,-151,-148,-157,-168,-69,-36,-35,39,39,39,-234,-233,39,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,39,39,-229,-232,-221,-83,-219,-68,-33,-32,39,39,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'STATIC':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,105,109,111,117,118,119,123,124,128,129,180,181,182,187,191,198,200,205,211,219,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,536,554,555,557,558,575,576,578,579,],[10,10,-113,-128,10,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,10,-120,-115,-65,-102,10,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,10,10,-119,10,-114,-130,10,-118,-71,-103,10,-131,-96,-98,10,-131,-95,-101,-97,-53,10,10,-88,10,-147,-335,-146,-167,-166,-182,-100,-126,206,10,-87,-61,-72,220,10,-73,10,-89,-149,-336,-183,-30,338,10,353,-74,-174,-175,10,-76,-79,-82,-75,-77,10,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,10,10,10,-234,-233,10,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,515,10,-229,-232,-221,-83,-219,-68,-33,-32,542,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'SIZEOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,146,-335,-28,-182,-27,146,-337,-87,-72,-337,146,-286,-285,146,146,-283,-287,-288,146,-284,146,146,146,-336,-183,146,146,-28,-337,146,-28,-337,-337,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,-337,-76,-79,-82,-75,146,-77,146,146,-81,-215,-214,-80,-216,146,-78,146,146,-69,-284,146,146,-284,146,146,-244,-247,-245,-241,-242,-246,-248,146,-250,-251,-243,-249,-12,146,146,-11,146,146,146,146,-234,-233,146,-231,146,146,-217,146,-230,146,-84,-218,146,146,146,-337,-337,-198,146,146,146,-337,-284,-229,-232,146,-221,146,-83,-219,-68,146,-28,-337,146,-11,146,146,-220,146,146,146,-284,146,146,146,-337,146,-225,-224,-222,-84,146,146,146,-226,-223,146,-228,-227,]),'UNSIGNED':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[22,-337,-113,-128,22,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,22,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,22,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,22,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,22,-131,-95,-101,-97,22,-53,-126,22,-88,22,22,-93,22,-147,-335,-146,22,-167,-166,-182,-100,-126,22,-87,-90,-94,-92,-61,-72,22,-144,-142,22,22,22,-73,22,-89,22,22,22,-149,-159,-160,-156,-336,22,-183,-30,22,22,-74,22,22,22,22,-174,-175,22,-143,-140,22,-141,-145,-76,-79,-82,-75,-77,22,-81,-215,-214,-80,-216,-78,-127,22,-153,22,-151,-148,-157,-168,-69,-36,-35,22,22,22,-234,-233,22,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,22,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'UNION':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[28,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,28,-65,-102,-337,-131,-108,-63,-129,28,-29,-62,-70,-52,-337,-337,-337,-130,28,-71,-103,-337,-9,-131,-91,-10,28,28,-53,-337,-88,28,28,-93,28,-335,28,-182,28,-87,-90,-94,-92,-61,-72,28,28,28,-73,28,-89,28,28,28,-159,-160,-156,-336,-183,-30,28,-74,28,28,28,28,-174,-175,28,28,-76,-79,-82,-75,-77,28,-81,-215,-214,-80,-216,-78,-127,28,28,-157,-69,-36,-35,28,28,28,-234,-233,28,-231,-217,-230,-81,-84,-218,-158,-31,-34,28,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'COLON':([2,3,5,6,12,22,23,33,34,36,39,42,43,44,46,48,49,50,54,56,58,60,73,74,76,77,86,96,98,100,101,111,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,179,187,191,192,200,216,224,225,230,232,234,235,236,237,238,240,241,261,263,268,269,272,273,275,279,280,295,310,312,314,316,317,324,328,340,341,355,356,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,407,411,431,442,443,445,448,449,453,454,464,465,468,476,478,480,482,483,486,487,511,512,518,519,524,547,551,565,],[-113,-128,-124,-110,-125,-120,-115,-238,-111,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-54,-179,-131,-37,-53,-147,-146,-167,-166,-126,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-178,-149,-336,319,-30,-38,-274,-239,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,-235,-278,-140,-141,-145,429,440,-127,-153,-151,-148,447,-168,-36,-35,-44,-43,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,481,-270,-258,-296,-295,-294,-293,-292,-305,502,-152,-150,319,-170,-169,-31,-34,-39,-42,-240,-237,-281,-282,-290,-291,-236,-275,-33,-32,-41,-40,-254,-306,-299,-300,]),'$end':([0,9,14,16,17,19,25,38,45,47,57,59,61,119,123,124,180,191,223,332,439,510,],[-337,0,-64,-60,-67,-66,-65,-63,-62,-70,-59,-58,-71,-87,-61,-72,-73,-336,-74,-69,-218,-68,]),'WSTRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,148,-335,-28,-182,-27,148,-337,-87,-72,-337,148,-286,-285,-330,148,-327,148,-283,-287,237,-328,-288,-329,148,-284,148,148,148,-336,-183,148,148,-28,-337,148,-28,-337,-337,148,148,148,-334,-332,-331,-333,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-337,-76,-79,-82,-75,148,-77,148,148,-81,-215,-214,-80,-216,148,-78,148,148,-69,-284,148,148,-284,148,148,-244,-247,-245,-241,-242,-246,-248,148,-250,-251,-243,-249,-12,148,148,-11,148,148,148,148,-234,-233,148,-231,148,148,-217,148,-230,148,-84,-218,148,148,148,-337,-337,-198,148,148,148,-337,-284,-229,-232,148,-221,148,-83,-219,-68,148,-28,-337,148,-11,148,148,-220,148,148,148,-284,148,148,148,-337,148,-225,-224,-222,-84,148,148,148,-226,-223,148,-228,-227,]),'DIVIDE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,252,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,252,252,252,252,252,252,252,252,252,252,-257,-256,252,252,252,252,252,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'FOR':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,292,-336,-76,-79,-82,-75,-77,292,-81,-215,-214,-80,-216,292,-78,-69,-234,-233,-231,292,-217,-230,292,-84,-218,292,-229,-232,-221,292,-83,-219,-68,292,-220,292,292,-225,-224,-222,-84,292,292,-226,-223,292,-228,-227,]),'PLUSPLUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,145,146,148,149,150,151,152,153,154,156,160,161,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,482,483,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,149,-335,-28,-182,-27,149,-337,-87,-72,-337,149,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-314,149,-327,149,-283,-287,-325,-304,-322,-302,-315,-289,-328,-316,-288,-329,-320,263,-323,149,-284,149,149,-312,149,-336,-183,149,149,-28,-337,149,-28,-337,-337,149,-326,149,149,-334,-332,-331,-333,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-298,-297,149,149,-337,-76,-79,-82,-75,149,-77,149,149,-81,-215,-214,-80,-216,149,-78,-312,149,149,-69,-284,149,149,-284,149,149,-244,-247,-245,-241,-242,-246,-248,149,-250,-251,-243,-249,-12,149,149,-11,-296,-295,-294,-293,-292,-305,149,149,149,149,-234,-233,149,-231,149,149,-217,149,-230,149,-84,-218,149,149,149,-337,-337,-198,149,149,-290,-291,149,-337,-284,-229,-232,149,-221,149,-83,-219,-68,149,-28,-337,149,-11,149,149,-220,149,149,149,-284,149,149,-306,149,-337,-299,149,-225,-224,-222,-84,-300,149,149,149,-226,-223,149,-228,-227,]),'EQUALS':([42,48,73,74,75,77,78,86,110,127,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,179,191,197,200,216,224,230,232,234,235,236,237,238,261,263,268,273,310,340,341,355,356,371,376,402,403,404,405,407,411,453,454,464,465,470,474,478,480,482,483,487,511,512,518,519,520,547,551,565,],[-29,-52,-54,-179,-178,-37,131,-53,201,-55,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-178,-336,329,-30,-38,360,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-36,-35,-44,-43,-199,475,-296,-295,-294,-293,-292,-305,-31,-34,-39,-42,-202,-200,-281,-282,-290,-291,-275,-33,-32,-41,-40,-201,-306,-299,-300,]),'ELSE':([61,124,191,284,285,286,289,291,300,303,308,332,424,425,428,435,437,438,439,496,497,500,505,506,510,536,554,555,557,558,575,576,578,579,],[-71,-72,-336,-76,-79,-82,-75,-77,-81,-80,-78,-69,-234,-233,-231,-230,-81,-84,-218,-229,-232,-221,-83,-219,-68,-220,-225,-224,-222,569,-226,-223,-228,-227,]),'ANDEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,365,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'EQ':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,256,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,256,-262,-260,-264,-268,-263,-259,-266,256,-257,-256,-265,256,-267,256,256,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'AND':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,150,-335,-28,-182,-27,150,-337,-87,-72,-337,150,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,150,-327,150,-283,-287,-325,-304,-322,-302,-255,-315,-289,257,-328,-316,-288,-329,-320,-276,-323,150,-284,150,150,-312,150,-336,-183,150,150,-28,-337,150,-28,-337,-274,-337,150,-326,150,-280,150,-277,-334,-332,-331,-333,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,-298,-297,150,150,-279,-278,-337,-76,-79,-82,-75,150,-77,150,150,-81,-215,-214,-80,-216,150,-78,-312,150,150,-69,-284,150,150,-284,150,150,-244,-247,-245,-241,-242,-246,-248,150,-250,-251,-243,-249,-12,150,150,-11,-261,257,-262,-260,-264,-268,-263,-259,-266,257,-257,-256,-265,257,-267,-269,257,-258,-296,-295,-294,-293,-292,-305,150,150,150,150,-234,-233,150,-231,150,150,-217,150,-230,150,-84,-218,150,150,150,-337,-337,-198,150,-281,-282,150,-290,-291,150,-275,-337,-284,-229,-232,150,-221,150,-83,-219,-68,150,-28,-337,150,-11,150,150,-220,150,150,150,-284,150,150,-306,150,-337,-299,150,-225,-224,-222,-84,-300,150,150,150,-226,-223,150,-228,-227,]),'TYPEID':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,103,104,105,106,109,111,118,119,120,121,122,123,124,126,129,142,147,172,174,180,181,182,184,185,186,187,188,189,190,191,192,198,199,200,202,211,214,223,229,231,233,239,240,241,262,264,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,344,350,422,424,425,427,428,432,435,437,438,439,442,443,445,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[33,-337,-113,-128,77,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,33,-120,-115,-154,-65,-102,-126,-155,-131,-108,96,100,-238,-111,-337,-122,-63,-129,33,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,33,-118,-71,-103,-337,-9,-131,-91,-10,-96,77,-98,77,33,-131,-95,-101,-97,33,-53,-126,77,-88,33,33,-93,33,-147,-335,-146,33,-167,-166,-28,-180,-182,-27,-100,-126,33,-87,-90,-94,-92,-61,-72,77,33,-144,-142,33,33,-73,33,-89,33,33,33,-149,-159,-160,-156,-336,77,-183,-181,-30,77,347,33,-74,33,33,33,33,-174,-175,402,404,33,-143,-140,33,-141,-145,-76,-79,-82,-75,-77,33,-81,-215,-214,-80,-216,-78,-127,33,-153,33,-151,-148,-157,-168,-69,-36,-35,33,347,33,33,-234,-233,33,-231,-217,-230,-81,-84,-218,-152,-150,77,-158,-170,-169,-31,-34,33,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LBRACE':([21,24,28,31,32,42,48,61,75,86,88,90,92,93,96,97,98,100,101,119,124,130,131,181,182,191,200,201,227,229,284,285,286,289,291,298,300,301,302,303,305,307,308,332,340,341,369,375,377,413,424,425,428,429,432,435,437,438,439,440,453,454,472,475,477,478,479,488,496,497,500,502,505,506,510,511,512,521,522,535,536,537,539,550,554,555,557,558,569,574,575,576,577,578,579,],[-337,-154,-155,97,97,-29,-52,-71,-337,-53,-7,-88,97,-8,97,-335,97,97,97,-87,-72,97,97,97,-89,-336,-30,97,-337,97,-76,-79,-82,-75,-77,97,-81,-215,-214,-80,-216,97,-78,-69,-36,-35,-12,97,-11,97,-234,-233,-231,97,-217,-230,97,-84,-218,97,-31,-34,-337,-198,97,97,97,-337,-229,-232,-221,97,-83,-219,-68,-33,-32,97,-11,97,-220,97,97,-337,-225,-224,-222,-84,97,97,-226,-223,97,-228,-227,]),'PPHASH':([0,14,16,17,19,25,38,45,47,59,61,119,123,124,180,191,223,332,439,510,],[47,-64,-60,-67,-66,-65,-63,-62,-70,47,-71,-87,-61,-72,-73,-336,-74,-69,-218,-68,]),'INT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[56,-337,-113,-128,56,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,56,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,56,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,56,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,56,-131,-95,-101,-97,56,-53,-126,56,-88,56,56,-93,56,-147,-335,-146,56,-167,-166,-182,-100,-126,56,-87,-90,-94,-92,-61,-72,56,-144,-142,56,56,56,-73,56,-89,56,56,56,-149,-159,-160,-156,-336,56,-183,-30,56,56,-74,56,56,56,56,-174,-175,56,-143,-140,56,-141,-145,-76,-79,-82,-75,-77,56,-81,-215,-214,-80,-216,-78,-127,56,-153,56,-151,-148,-157,-168,-69,-36,-35,56,56,56,-234,-233,56,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,56,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'SIGNED':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[54,-337,-113,-128,54,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,54,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,54,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,54,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,54,-131,-95,-101,-97,54,-53,-126,54,-88,54,54,-93,54,-147,-335,-146,54,-167,-166,-182,-100,-126,54,-87,-90,-94,-92,-61,-72,54,-144,-142,54,54,54,-73,54,-89,54,54,54,-149,-159,-160,-156,-336,54,-183,-30,54,54,-74,54,54,54,54,-174,-175,54,-143,-140,54,-141,-145,-76,-79,-82,-75,-77,54,-81,-215,-214,-80,-216,-78,-127,54,-153,54,-151,-148,-157,-168,-69,-36,-35,54,54,54,-234,-233,54,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,54,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'CONTINUE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,293,-336,-76,-79,-82,-75,-77,293,-81,-215,-214,-80,-216,293,-78,-69,-234,-233,-231,293,-217,-230,293,-84,-218,293,-229,-232,-221,293,-83,-219,-68,293,-220,293,293,-225,-224,-222,-84,293,293,-226,-223,293,-228,-227,]),'NOT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,151,-335,-28,-182,-27,151,-337,-87,-72,-337,151,-286,-285,151,151,-283,-287,-288,151,-284,151,151,151,-336,-183,151,151,-28,-337,151,-28,-337,-337,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,-337,-76,-79,-82,-75,151,-77,151,151,-81,-215,-214,-80,-216,151,-78,151,151,-69,-284,151,151,-284,151,151,-244,-247,-245,-241,-242,-246,-248,151,-250,-251,-243,-249,-12,151,151,-11,151,151,151,151,-234,-233,151,-231,151,151,-217,151,-230,151,-84,-218,151,151,151,-337,-337,-198,151,151,151,-337,-284,-229,-232,151,-221,151,-83,-219,-68,151,-28,-337,151,-11,151,151,-220,151,151,151,-284,151,151,151,-337,151,-225,-224,-222,-84,151,151,151,-226,-223,151,-228,-227,]),'OREQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,366,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'MOD':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,260,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,260,260,260,260,260,260,260,260,260,260,-257,-256,260,260,260,260,260,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'RSHIFT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,242,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,242,-262,-260,242,242,242,-259,242,242,-257,-256,242,242,242,242,242,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'DEFAULT':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,295,-336,-76,-79,-82,-75,-77,295,-81,-215,-214,-80,-216,295,-78,-69,-234,-233,-231,295,-217,-230,295,-84,-218,295,-229,-232,-221,295,-83,-219,-68,295,-220,295,295,-225,-224,-222,-84,295,295,-226,-223,295,-228,-227,]),'_NORETURN':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[20,20,-113,-128,20,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,20,-120,-115,-65,-102,20,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,20,20,-119,20,-114,-130,20,-118,-71,-103,20,-131,-96,-98,20,-131,-95,-101,-97,-53,20,20,-88,20,-147,-335,-146,-167,-166,-100,-126,20,-87,-61,-72,20,-73,20,-89,-149,-336,-30,20,-74,-174,-175,20,-76,-79,-82,-75,-77,20,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,20,20,20,-234,-233,20,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,20,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'__INT128':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[43,-337,-113,-128,43,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,43,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,43,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,43,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,43,-131,-95,-101,-97,43,-53,-126,43,-88,43,43,-93,43,-147,-335,-146,43,-167,-166,-182,-100,-126,43,-87,-90,-94,-92,-61,-72,43,-144,-142,43,43,43,-73,43,-89,43,43,43,-149,-159,-160,-156,-336,43,-183,-30,43,43,-74,43,43,43,43,-174,-175,43,-143,-140,43,-141,-145,-76,-79,-82,-75,-77,43,-81,-215,-214,-80,-216,-78,-127,43,-153,43,-151,-148,-157,-168,-69,-36,-35,43,43,43,-234,-233,43,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,43,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'WHILE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,436,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,296,-336,-76,-79,-82,-75,-77,296,-81,-215,-214,-80,-216,296,-78,-69,-234,-233,-231,296,-217,-230,504,296,-84,-218,296,-229,-232,-221,296,-83,-219,-68,296,-220,296,296,-225,-224,-222,-84,296,296,-226,-223,296,-228,-227,]),'U8CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,154,-335,-28,-182,-27,154,-337,-87,-72,-337,154,-286,-285,154,154,-283,-287,-288,154,-284,154,154,154,-336,-183,154,154,-28,-337,154,-28,-337,-337,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,-337,-76,-79,-82,-75,154,-77,154,154,-81,-215,-214,-80,-216,154,-78,154,154,-69,-284,154,154,-284,154,154,-244,-247,-245,-241,-242,-246,-248,154,-250,-251,-243,-249,-12,154,154,-11,154,154,154,154,-234,-233,154,-231,154,154,-217,154,-230,154,-84,-218,154,154,154,-337,-337,-198,154,154,154,-337,-284,-229,-232,154,-221,154,-83,-219,-68,154,-28,-337,154,-11,154,154,-220,154,154,154,-284,154,154,154,-337,154,-225,-224,-222,-84,154,154,154,-226,-223,154,-228,-227,]),'_ALIGNOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,155,-335,-28,-182,-27,155,-337,-87,-72,-337,155,-286,-285,155,155,-283,-287,-288,155,-284,155,155,155,-336,-183,155,155,-28,-337,155,-28,-337,-337,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,-337,-76,-79,-82,-75,155,-77,155,155,-81,-215,-214,-80,-216,155,-78,155,155,-69,-284,155,155,-284,155,155,-244,-247,-245,-241,-242,-246,-248,155,-250,-251,-243,-249,-12,155,155,-11,155,155,155,155,-234,-233,155,-231,155,155,-217,155,-230,155,-84,-218,155,155,155,-337,-337,-198,155,155,155,-337,-284,-229,-232,155,-221,155,-83,-219,-68,155,-28,-337,155,-11,155,155,-220,155,155,155,-284,155,155,155,-337,155,-225,-224,-222,-84,155,155,155,-226,-223,155,-228,-227,]),'EXTERN':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[13,13,-113,-128,13,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,13,-120,-115,-65,-102,13,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,13,13,-119,13,-114,-130,13,-118,-71,-103,13,-131,-96,-98,13,-131,-95,-101,-97,-53,13,13,-88,13,-147,-335,-146,-167,-166,-100,-126,13,-87,-61,-72,13,-73,13,-89,-149,-336,-30,13,-74,-174,-175,13,-76,-79,-82,-75,-77,13,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,13,13,13,-234,-233,13,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,13,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'CASE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,297,-336,-76,-79,-82,-75,-77,297,-81,-215,-214,-80,-216,297,-78,-69,-234,-233,-231,297,-217,-230,297,-84,-218,297,-229,-232,-221,297,-83,-219,-68,297,-220,297,297,-225,-224,-222,-84,297,297,-226,-223,297,-228,-227,]),'LAND':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,255,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,255,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'REGISTER':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[62,62,-113,-128,62,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,62,-120,-115,-65,-102,62,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,62,62,-119,62,-114,-130,62,-118,-71,-103,62,-131,-96,-98,62,-131,-95,-101,-97,-53,62,62,-88,62,-147,-335,-146,-167,-166,-100,-126,62,-87,-61,-72,62,-73,62,-89,-149,-336,-30,62,-74,-174,-175,62,-76,-79,-82,-75,-77,62,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,62,62,62,-234,-233,62,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,62,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'MODEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,359,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'NE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,247,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,247,-262,-260,-264,-268,-263,-259,-266,247,-257,-256,-265,247,-267,247,247,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SWITCH':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,299,-336,-76,-79,-82,-75,-77,299,-81,-215,-214,-80,-216,299,-78,-69,-234,-233,-231,299,-217,-230,299,-84,-218,299,-229,-232,-221,299,-83,-219,-68,299,-220,299,299,-225,-224,-222,-84,299,299,-226,-223,299,-228,-227,]),'INT_CONST_HEX':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,160,-335,-28,-182,-27,160,-337,-87,-72,-337,160,-286,-285,160,160,-283,-287,-288,160,-284,160,160,160,-336,-183,160,160,-28,-337,160,-28,-337,-337,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,-337,-76,-79,-82,-75,160,-77,160,160,-81,-215,-214,-80,-216,160,-78,160,160,-69,-284,160,160,-284,160,160,-244,-247,-245,-241,-242,-246,-248,160,-250,-251,-243,-249,-12,160,160,-11,160,160,160,160,-234,-233,160,-231,160,160,-217,160,-230,160,-84,-218,160,160,160,-337,-337,-198,160,160,160,-337,-284,-229,-232,160,-221,160,-83,-219,-68,160,-28,-337,160,-11,160,160,-220,160,160,160,-284,160,160,160,-337,160,-225,-224,-222,-84,160,160,160,-226,-223,160,-228,-227,]),'_COMPLEX':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[60,-337,-113,-128,60,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,60,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,60,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,60,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,60,-131,-95,-101,-97,60,-53,-126,60,-88,60,60,-93,60,-147,-335,-146,60,-167,-166,-182,-100,-126,60,-87,-90,-94,-92,-61,-72,60,-144,-142,60,60,60,-73,60,-89,60,60,60,-149,-159,-160,-156,-336,60,-183,-30,60,60,-74,60,60,60,60,-174,-175,60,-143,-140,60,-141,-145,-76,-79,-82,-75,-77,60,-81,-215,-214,-80,-216,-78,-127,60,-153,60,-151,-148,-157,-168,-69,-36,-35,60,60,60,-234,-233,60,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,60,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PPPRAGMASTR':([61,],[124,]),'PLUSEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,362,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'U32CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,138,-335,-28,-182,-27,138,-337,-87,-72,-337,138,-286,-285,138,138,-283,-287,-288,138,-284,138,138,138,-336,-183,138,138,-28,-337,138,-28,-337,-337,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-337,-76,-79,-82,-75,138,-77,138,138,-81,-215,-214,-80,-216,138,-78,138,138,-69,-284,138,138,-284,138,138,-244,-247,-245,-241,-242,-246,-248,138,-250,-251,-243,-249,-12,138,138,-11,138,138,138,138,-234,-233,138,-231,138,138,-217,138,-230,138,-84,-218,138,138,138,-337,-337,-198,138,138,138,-337,-284,-229,-232,138,-221,138,-83,-219,-68,138,-28,-337,138,-11,138,138,-220,138,138,138,-284,138,138,138,-337,138,-225,-224,-222,-84,138,138,138,-226,-223,138,-228,-227,]),'CONDOP':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,258,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'U8STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,163,-335,-28,-182,-27,163,-337,-87,-72,-337,163,-286,-285,-330,163,-327,163,-283,-287,236,-328,-288,-329,163,-284,163,163,163,-336,-183,163,163,-28,-337,163,-28,-337,-337,163,163,163,-334,-332,-331,-333,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,-337,-76,-79,-82,-75,163,-77,163,163,-81,-215,-214,-80,-216,163,-78,163,163,-69,-284,163,163,-284,163,163,-244,-247,-245,-241,-242,-246,-248,163,-250,-251,-243,-249,-12,163,163,-11,163,163,163,163,-234,-233,163,-231,163,163,-217,163,-230,163,-84,-218,163,163,163,-337,-337,-198,163,163,163,-337,-284,-229,-232,163,-221,163,-83,-219,-68,163,-28,-337,163,-11,163,163,-220,163,163,163,-284,163,163,163,-337,163,-225,-224,-222,-84,163,163,163,-226,-223,163,-228,-227,]),'BREAK':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,304,-336,-76,-79,-82,-75,-77,304,-81,-215,-214,-80,-216,304,-78,-69,-234,-233,-231,304,-217,-230,304,-84,-218,304,-229,-232,-221,304,-83,-219,-68,304,-220,304,304,-225,-224,-222,-84,304,304,-226,-223,304,-228,-227,]),'VOLATILE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[58,58,-113,-128,58,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,58,-120,-115,-65,-102,58,-131,-108,-238,-111,58,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,58,58,-119,58,-114,-130,58,-118,-71,-103,58,-131,-96,-98,58,-131,-95,-101,-97,58,-53,58,58,-88,58,58,-147,-335,-146,58,-167,-166,58,-182,-100,-126,58,58,-87,-61,-72,58,58,-144,-142,58,58,58,-73,58,-89,58,58,58,-149,-159,-160,-156,-336,58,-183,-30,58,58,58,58,58,-74,58,58,58,58,-174,-175,58,-143,-140,58,-141,-145,58,-76,-79,-82,-75,-77,58,-81,-215,-214,-80,-216,-78,-127,58,-153,58,-151,-148,-157,-168,-69,-36,-35,58,58,58,-234,-233,58,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,58,58,-229,-232,-221,-83,-219,-68,-33,-32,58,58,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PPPRAGMA':([0,14,16,17,19,25,38,45,47,59,61,97,99,119,123,124,180,181,184,185,186,188,189,190,191,223,284,285,286,289,291,298,300,301,302,303,305,307,308,313,315,318,332,424,425,428,429,432,435,437,438,439,440,446,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[61,-64,-60,-67,-66,-65,-63,-62,-70,61,-71,-335,61,-87,-61,-72,-73,61,61,61,61,-159,-160,-156,-336,-74,-76,-79,-82,-75,-77,61,-81,-215,-214,-80,-216,61,-78,61,61,-157,-69,-234,-233,-231,61,-217,-230,61,-84,-218,61,-158,-229,-232,-221,61,-83,-219,-68,61,-220,61,61,-225,-224,-222,-84,61,61,-226,-223,61,-228,-227,]),'INLINE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[30,30,-113,-128,30,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,30,-120,-115,-65,-102,30,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,30,30,-119,30,-114,-130,30,-118,-71,-103,30,-131,-96,-98,30,-131,-95,-101,-97,-53,30,30,-88,30,-147,-335,-146,-167,-166,-100,-126,30,-87,-61,-72,30,-73,30,-89,-149,-336,-30,30,-74,-174,-175,30,-76,-79,-82,-75,-77,30,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,30,30,30,-234,-233,30,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,30,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'INT_CONST_BIN':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,164,-335,-28,-182,-27,164,-337,-87,-72,-337,164,-286,-285,164,164,-283,-287,-288,164,-284,164,164,164,-336,-183,164,164,-28,-337,164,-28,-337,-337,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,-337,-76,-79,-82,-75,164,-77,164,164,-81,-215,-214,-80,-216,164,-78,164,164,-69,-284,164,164,-284,164,164,-244,-247,-245,-241,-242,-246,-248,164,-250,-251,-243,-249,-12,164,164,-11,164,164,164,164,-234,-233,164,-231,164,164,-217,164,-230,164,-84,-218,164,164,164,-337,-337,-198,164,164,164,-337,-284,-229,-232,164,-221,164,-83,-219,-68,164,-28,-337,164,-11,164,164,-220,164,164,164,-284,164,164,164,-337,164,-225,-224,-222,-84,164,164,164,-226,-223,164,-228,-227,]),'DO':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,307,-336,-76,-79,-82,-75,-77,307,-81,-215,-214,-80,-216,307,-78,-69,-234,-233,-231,307,-217,-230,307,-84,-218,307,-229,-232,-221,307,-83,-219,-68,307,-220,307,307,-225,-224,-222,-84,307,307,-226,-223,307,-228,-227,]),'LNOT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,165,-335,-28,-182,-27,165,-337,-87,-72,-337,165,-286,-285,165,165,-283,-287,-288,165,-284,165,165,165,-336,-183,165,165,-28,-337,165,-28,-337,-337,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,-337,-76,-79,-82,-75,165,-77,165,165,-81,-215,-214,-80,-216,165,-78,165,165,-69,-284,165,165,-284,165,165,-244,-247,-245,-241,-242,-246,-248,165,-250,-251,-243,-249,-12,165,165,-11,165,165,165,165,-234,-233,165,-231,165,165,-217,165,-230,165,-84,-218,165,165,165,-337,-337,-198,165,165,165,-337,-284,-229,-232,165,-221,165,-83,-219,-68,165,-28,-337,165,-11,165,165,-220,165,165,165,-284,165,165,165,-337,165,-225,-224,-222,-84,165,165,165,-226,-223,165,-228,-227,]),'CONST':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[3,3,-113,-128,3,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,3,-120,-115,-65,-102,3,-131,-108,-238,-111,3,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,3,3,-119,3,-114,-130,3,-118,-71,-103,3,-131,-96,-98,3,-131,-95,-101,-97,3,-53,3,3,-88,3,3,-147,-335,-146,3,-167,-166,3,-182,-100,-126,3,3,-87,-61,-72,3,3,-144,-142,3,3,3,-73,3,-89,3,3,3,-149,-159,-160,-156,-336,3,-183,-30,3,3,3,3,3,-74,3,3,3,3,-174,-175,3,-143,-140,3,-141,-145,3,-76,-79,-82,-75,-77,3,-81,-215,-214,-80,-216,-78,-127,3,-153,3,-151,-148,-157,-168,-69,-36,-35,3,3,3,-234,-233,3,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,3,3,-229,-232,-221,-83,-219,-68,-33,-32,3,3,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LSHIFT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,244,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,244,-262,-260,244,244,244,-259,244,244,-257,-256,244,244,244,244,244,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'LOR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,243,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,167,-335,-28,-182,-27,167,-337,-87,-72,-337,167,-286,-285,167,167,-283,-287,-288,167,-284,167,167,167,-336,-183,167,167,-28,-337,167,-28,-337,-337,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,-337,-76,-79,-82,-75,167,-77,167,167,-81,-215,-214,-80,-216,167,-78,167,167,-69,-284,167,167,-284,167,167,-244,-247,-245,-241,-242,-246,-248,167,-250,-251,-243,-249,-12,167,167,-11,167,167,167,167,-234,-233,167,-231,167,167,-217,167,-230,167,-84,-218,167,167,167,-337,-337,-198,167,167,167,-337,-284,-229,-232,167,-221,167,-83,-219,-68,167,-28,-337,167,-11,167,167,-220,167,167,167,-284,167,167,167,-337,167,-225,-224,-222,-84,167,167,167,-226,-223,167,-228,-227,]),'U16STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,166,-335,-28,-182,-27,166,-337,-87,-72,-337,166,-286,-285,-330,166,-327,166,-283,-287,238,-328,-288,-329,166,-284,166,166,166,-336,-183,166,166,-28,-337,166,-28,-337,-337,166,166,166,-334,-332,-331,-333,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,-337,-76,-79,-82,-75,166,-77,166,166,-81,-215,-214,-80,-216,166,-78,166,166,-69,-284,166,166,-284,166,166,-244,-247,-245,-241,-242,-246,-248,166,-250,-251,-243,-249,-12,166,166,-11,166,166,166,166,-234,-233,166,-231,166,166,-217,166,-230,166,-84,-218,166,166,166,-337,-337,-198,166,166,166,-337,-284,-229,-232,166,-221,166,-83,-219,-68,166,-28,-337,166,-11,166,166,-220,166,166,166,-284,166,166,166,-337,166,-225,-224,-222,-84,166,166,166,-226,-223,166,-228,-227,]),'RBRACE':([61,97,99,119,124,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,181,184,185,186,188,189,190,191,195,196,197,224,225,227,228,230,232,234,235,236,237,238,261,263,268,273,284,285,286,289,291,298,300,301,302,303,305,306,308,309,313,315,318,325,326,327,332,370,374,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,424,425,428,432,435,437,438,439,446,450,451,468,469,472,473,476,478,480,482,483,487,496,497,500,505,506,510,523,524,528,536,546,547,550,551,554,555,557,558,565,575,576,578,579,],[-71,-335,191,-87,-72,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-337,191,191,191,-159,-160,-156,-336,-171,191,-176,-274,-239,-337,-193,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-76,-79,-82,-75,-77,-6,-81,-215,-214,-80,-216,-5,-78,191,191,191,-157,191,191,-172,-69,191,-22,-21,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-234,-233,-231,-217,-230,-81,-84,-218,-158,-173,-177,-240,-194,191,-196,-237,-281,-282,-290,-291,-275,-229,-232,-221,-83,-219,-68,-195,-254,191,-220,-197,-306,191,-299,-225,-224,-222,-84,-300,-226,-223,-228,-227,]),'_BOOL':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[34,-337,-113,-128,34,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,34,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,34,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,34,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,34,-131,-95,-101,-97,34,-53,-126,34,-88,34,34,-93,34,-147,-335,-146,34,-167,-166,-182,-100,-126,34,-87,-90,-94,-92,-61,-72,34,-144,-142,34,34,34,-73,34,-89,34,34,34,-149,-159,-160,-156,-336,34,-183,-30,34,34,-74,34,34,34,34,-174,-175,34,-143,-140,34,-141,-145,-76,-79,-82,-75,-77,34,-81,-215,-214,-80,-216,-78,-127,34,-153,34,-151,-148,-157,-168,-69,-36,-35,34,34,34,-234,-233,34,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,34,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,246,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,246,-262,-260,-264,246,-263,-259,-266,246,-257,-256,-265,246,246,246,246,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SEMI':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,86,87,89,91,94,96,97,98,99,100,101,108,109,110,111,113,114,115,119,120,121,122,123,124,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,179,180,181,184,185,186,187,188,189,190,191,192,200,216,217,223,224,225,226,228,230,232,234,235,236,237,238,240,241,261,263,268,269,272,273,275,279,280,284,285,286,288,289,290,291,293,294,298,300,301,302,303,304,305,306,307,308,310,312,313,314,315,316,317,318,320,321,322,323,324,328,330,331,332,340,341,355,356,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,423,424,425,426,427,428,429,432,433,435,437,438,439,440,442,443,444,446,448,449,453,454,464,465,468,469,476,478,480,482,483,486,487,496,497,498,499,500,502,505,506,508,509,510,511,512,518,519,523,524,533,534,535,536,537,539,547,551,552,554,555,557,558,565,568,569,574,575,576,577,578,579,],[19,-337,-113,-128,-337,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,-337,-29,-121,-116,-62,-112,-70,-52,-123,-117,119,-337,-337,-119,-337,-114,-130,19,-118,-71,-103,-337,-9,-131,-91,-10,-96,-20,-98,-54,-179,-178,-131,-37,-134,-85,-95,-101,-97,-19,-132,-53,-126,-337,-337,-93,-147,-335,-146,188,-167,-166,-136,-100,-138,-126,-16,-86,-15,-87,-90,-94,-92,-61,-72,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-178,-73,-337,188,188,188,-149,-159,-160,-156,-336,-337,-30,-38,-133,-74,-274,-239,-135,-193,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,-235,-278,-140,-141,-145,-76,-79,-82,424,-75,425,-77,428,-14,-337,-81,-215,-214,-80,435,-216,-13,-337,-78,-312,-127,188,-153,188,-151,-148,-157,-26,-25,446,-161,-163,-168,-139,-137,-69,-36,-35,-44,-43,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,496,-234,-233,497,-337,-231,-337,-217,-13,-230,-81,-84,-218,-337,-152,-150,-165,-158,-170,-169,-31,-34,-39,-42,-240,-194,-237,-281,-282,-290,-291,-236,-275,-229,-232,533,-337,-221,-337,-83,-219,-162,-164,-68,-33,-32,-41,-40,-195,-254,-337,553,-337,-220,-337,-337,-306,-299,566,-225,-224,-222,-84,-300,575,-337,-337,-226,-223,-337,-228,-227,]),'_THREAD_LOCAL':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[11,11,-113,-128,11,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,11,-120,-115,-65,-102,11,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,11,11,-119,11,-114,-130,11,-118,-71,-103,11,-131,-96,-98,11,-131,-95,-101,-97,-53,11,11,-88,11,-147,-335,-146,-167,-166,-100,-126,11,-87,-61,-72,11,-73,11,-89,-149,-336,-30,11,-74,-174,-175,11,-76,-79,-82,-75,-77,11,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,11,11,11,-234,-233,11,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,11,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,248,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,248,-262,-260,-264,248,-263,-259,-266,248,-257,-256,-265,248,248,248,248,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'COMMA':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,70,71,73,74,75,76,77,78,80,81,82,84,86,96,98,100,101,103,104,105,106,108,109,110,111,113,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,177,178,179,187,191,195,196,197,198,199,200,203,210,211,212,213,215,216,217,224,225,226,228,230,232,234,235,236,237,238,240,241,261,263,268,269,270,272,273,274,275,276,277,279,280,281,283,294,310,312,314,316,317,320,323,324,325,326,327,328,330,331,340,341,343,344,345,346,347,348,355,356,374,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,414,426,442,443,444,448,449,450,451,453,454,458,461,463,464,465,468,469,473,476,478,480,482,483,486,487,489,490,492,501,503,507,508,509,511,512,518,519,523,524,525,528,529,530,531,532,544,545,546,547,551,556,559,560,564,565,570,571,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-103,-96,126,-98,-54,-179,-178,-131,-37,-134,-95,-101,-97,-132,-53,-147,-146,-167,-166,-28,-180,-182,-27,-136,-100,-138,-126,202,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-337,-252,-178,-149,-336,-171,327,-176,-183,-181,-30,333,-186,-337,349,350,-191,-38,-133,-274,-239,-135,-193,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,412,-235,-278,-203,-140,-204,-1,-141,-145,-2,-206,412,-312,-127,-153,-151,-148,445,-161,-163,327,327,-172,-168,-139,-137,-36,-35,-190,-204,-56,-188,-45,-189,-44,-43,472,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,412,-270,-258,-296,-295,-294,-293,412,-292,-310,484,485,-305,-205,412,-152,-150,-165,-170,-169,-173,-177,-31,-34,-57,-192,-187,-39,-42,-240,-194,-196,-237,-281,-282,-290,-291,-236,-275,-213,-207,-211,412,412,412,-162,-164,-33,-32,-41,-40,-195,-254,-311,550,-209,-208,-210,-212,-51,-50,-197,-306,-299,412,-46,-49,412,-300,-48,-47,]),'U16CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,169,-335,-28,-182,-27,169,-337,-87,-72,-337,169,-286,-285,169,169,-283,-287,-288,169,-284,169,169,169,-336,-183,169,169,-28,-337,169,-28,-337,-337,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,-337,-76,-79,-82,-75,169,-77,169,169,-81,-215,-214,-80,-216,169,-78,169,169,-69,-284,169,169,-284,169,169,-244,-247,-245,-241,-242,-246,-248,169,-250,-251,-243,-249,-12,169,169,-11,169,169,169,169,-234,-233,169,-231,169,169,-217,169,-230,169,-84,-218,169,169,169,-337,-337,-198,169,169,169,-337,-284,-229,-232,169,-221,169,-83,-219,-68,169,-28,-337,169,-11,169,169,-220,169,169,169,-284,169,169,169,-337,169,-225,-224,-222,-84,169,169,169,-226,-223,169,-228,-227,]),'OFFSETOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,170,-335,-28,-182,-27,170,-337,-87,-72,-337,170,-286,-285,170,170,-283,-287,-288,170,-284,170,170,170,-336,-183,170,170,-28,-337,170,-28,-337,-337,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,-337,-76,-79,-82,-75,170,-77,170,170,-81,-215,-214,-80,-216,170,-78,170,170,-69,-284,170,170,-284,170,170,-244,-247,-245,-241,-242,-246,-248,170,-250,-251,-243,-249,-12,170,170,-11,170,170,170,170,-234,-233,170,-231,170,170,-217,170,-230,170,-84,-218,170,170,170,-337,-337,-198,170,170,170,-337,-284,-229,-232,170,-221,170,-83,-219,-68,170,-28,-337,170,-11,170,170,-220,170,170,170,-284,170,170,170,-337,170,-225,-224,-222,-84,170,170,170,-226,-223,170,-228,-227,]),'_ATOMIC':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,103,105,109,111,117,118,119,120,121,122,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,214,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[29,65,-113,-128,76,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,65,-120,-115,-65,-102,65,-131,-108,-238,-111,76,-122,-63,-129,112,-29,-121,-116,-62,-112,-70,-52,-123,-117,65,65,-119,65,-114,-130,29,-118,-71,-103,65,-9,-131,-91,-10,-96,-98,65,-131,-95,-101,-97,29,-53,65,76,-88,112,65,-93,29,-147,-335,-146,29,-167,-166,76,-182,-100,-126,76,29,-87,-90,-94,-92,-61,-72,76,29,-144,-142,65,29,76,-73,65,-89,29,29,29,-149,-159,-160,-156,-336,76,-183,-30,76,76,76,112,76,76,-74,29,29,29,29,-174,-175,29,-143,-140,29,-141,-145,76,-76,-79,-82,-75,-77,65,-81,-215,-214,-80,-216,-78,-127,29,-153,29,-151,-148,-157,-168,-69,-36,-35,29,29,29,-234,-233,65,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,76,29,-229,-232,-221,-83,-219,-68,-33,-32,76,76,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'TYPEDEF':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[7,7,-113,-128,7,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,7,-120,-115,-65,-102,7,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,7,7,-119,7,-114,-130,7,-118,-71,-103,7,-131,-96,-98,7,-131,-95,-101,-97,-53,7,7,-88,7,-147,-335,-146,-167,-166,-100,-126,7,-87,-61,-72,7,-73,7,-89,-149,-336,-30,7,-74,-174,-175,7,-76,-79,-82,-75,-77,7,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,7,7,7,-234,-233,7,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,7,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'XOR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,251,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,251,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,251,-267,-269,251,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'AUTO':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[26,26,-113,-128,26,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,26,-120,-115,-65,-102,26,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,26,26,-119,26,-114,-130,26,-118,-71,-103,26,-131,-96,-98,26,-131,-95,-101,-97,-53,26,26,-88,26,-147,-335,-146,-167,-166,-100,-126,26,-87,-61,-72,26,-73,26,-89,-149,-336,-30,26,-74,-174,-175,26,-76,-79,-82,-75,-77,26,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,26,26,26,-234,-233,26,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,26,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'DIVEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,357,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'TIMES':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,22,23,25,26,27,29,30,33,34,35,36,37,38,39,40,43,44,45,46,47,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,76,80,81,82,85,87,89,91,94,96,97,98,100,101,103,104,105,106,109,111,116,117,119,120,121,122,123,124,126,128,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,177,180,181,187,191,192,198,201,202,204,205,206,211,218,219,220,223,224,227,229,230,231,232,233,234,235,236,237,238,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,269,273,275,278,279,280,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,312,314,316,317,319,328,329,332,336,338,339,342,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[35,-337,-113,-128,35,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,-131,-108,-238,-111,-337,-122,35,-63,-129,35,-121,-116,-62,-112,-70,-123,-117,-337,-337,-119,-337,-114,-130,35,-118,-71,-103,-337,-9,-131,-91,-10,-96,35,-98,-131,-95,-101,-97,173,-126,35,35,-93,-147,-335,-146,-167,-166,-28,35,-182,-27,-100,-126,173,-337,-87,-90,-94,-92,-61,-72,35,-337,173,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-144,-301,-274,-314,173,-142,-327,173,-283,-287,-325,-304,-322,-302,-255,-315,-289,253,-328,-316,-288,-329,-320,-276,-323,173,-284,173,173,-312,35,-73,173,-149,-336,35,-183,173,35,336,-28,-337,35,352,-28,-337,-74,-274,-337,173,-326,173,-280,173,-277,-334,-332,-331,-333,-174,-175,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,-298,-297,173,173,-279,-143,-278,-140,35,-141,-145,420,-76,-79,-82,-75,173,-77,173,173,-81,-215,-214,-80,-216,173,-78,-312,-127,-153,-151,-148,173,-168,173,-69,-284,173,173,35,-284,173,173,-244,-247,-245,-241,-242,-246,-248,173,-250,-251,-243,-249,-12,173,173,-11,253,253,253,253,253,253,253,253,253,253,-257,-256,253,253,253,253,253,-258,-296,-295,-294,-293,-292,-305,173,173,173,494,-234,-233,173,-231,173,173,-217,173,-230,173,-84,-218,173,173,-152,-150,35,173,-170,-169,-337,-337,-198,173,-281,-282,173,-290,-291,173,-275,-337,-284,-229,-232,173,-221,173,-83,-219,-68,541,-28,-337,173,-11,173,173,-220,173,173,173,-284,173,173,-306,173,-337,-299,173,-225,-224,-222,-84,-300,173,173,173,-226,-223,173,-228,-227,]),'LPAREN':([0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,22,23,25,26,27,29,30,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,73,76,77,80,81,82,85,86,87,89,91,94,96,97,98,100,101,103,104,105,106,109,111,112,116,117,119,120,121,122,123,124,126,127,128,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,160,161,163,164,165,166,167,168,169,170,171,173,174,175,176,177,180,181,187,191,192,198,199,200,201,202,204,205,206,211,216,218,219,220,223,227,229,230,231,233,235,236,237,238,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,269,275,276,278,279,280,282,283,284,285,286,289,290,291,292,296,297,298,299,300,301,302,303,305,307,308,310,311,312,314,316,317,319,328,329,332,336,338,339,340,341,342,344,345,347,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,414,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,453,454,457,458,459,464,465,472,475,477,481,482,483,484,488,489,490,492,494,496,497,499,500,502,504,505,506,510,511,512,513,514,515,518,519,521,522,529,530,531,532,533,535,536,537,538,539,541,542,543,544,545,547,549,550,551,553,554,555,557,558,559,560,565,566,569,570,571,574,575,576,577,578,579,],[37,-337,-113,-128,69,-124,-110,-106,85,-104,-107,-125,-105,-64,37,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,95,-108,-238,-111,-337,-122,37,-63,-129,37,116,-29,-121,-116,-62,-112,-70,118,-123,-117,-337,-337,-119,-337,-114,-130,37,-118,-71,-103,-337,-9,95,-91,-10,-96,69,-98,69,129,-131,-37,-95,-101,-97,174,118,-126,69,37,-93,-147,-335,-146,-167,-166,-28,-180,-182,-27,-100,-126,95,174,-337,-87,-90,-94,-92,-61,-72,69,129,-337,229,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-144,-301,-314,231,-142,-327,233,-283,-287,-325,-304,-322,239,-302,-315,-289,-328,-316,-288,-329,-320,266,-323,267,174,-284,229,233,-312,278,-73,229,-149,-336,69,-183,-181,-30,229,69,229,-28,-337,342,-38,229,-28,-337,-74,-337,229,-326,229,229,-334,-332,-331,-333,-174,-175,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,229,174,174,-298,-297,229,229,-143,-140,278,278,-141,-145,-337,422,-76,-79,-82,-75,229,-77,427,430,174,229,434,-81,-215,-214,-80,-216,229,-78,-312,441,-127,-153,-151,-148,174,-168,174,-69,-284,229,229,-36,-35,342,342,460,-45,-284,229,229,-44,-43,-244,-247,-245,-241,-242,-246,-248,229,-250,-251,-243,-249,-12,174,229,-11,-296,-295,-294,-293,-292,-305,229,174,422,229,229,-234,-233,229,-231,229,229,-217,229,-230,229,-84,-218,229,229,-152,-150,69,174,-170,-169,-31,-34,342,460,-337,-39,-42,-337,-198,174,174,-290,-291,229,-337,-213,-207,-211,-284,-229,-232,229,-221,229,538,-83,-219,-68,-33,-32,229,-28,-337,-41,-40,229,-11,-209,-208,-210,-212,229,229,-220,229,229,229,-284,229,229,-51,-50,-306,229,-337,-299,229,-225,-224,-222,-84,-46,-49,-300,229,229,-48,-47,229,-226,-223,229,-228,-227,]),'MINUSMINUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,145,146,148,149,150,151,152,153,154,156,160,161,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,482,483,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,175,-335,-28,-182,-27,175,-337,-87,-72,-337,175,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-314,175,-327,175,-283,-287,-325,-304,-322,-302,-315,-289,-328,-316,-288,-329,-320,261,-323,175,-284,175,175,-312,175,-336,-183,175,175,-28,-337,175,-28,-337,-337,175,-326,175,175,-334,-332,-331,-333,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,-298,-297,175,175,-337,-76,-79,-82,-75,175,-77,175,175,-81,-215,-214,-80,-216,175,-78,-312,175,175,-69,-284,175,175,-284,175,175,-244,-247,-245,-241,-242,-246,-248,175,-250,-251,-243,-249,-12,175,175,-11,-296,-295,-294,-293,-292,-305,175,175,175,175,-234,-233,175,-231,175,175,-217,175,-230,175,-84,-218,175,175,175,-337,-337,-198,175,175,-290,-291,175,-337,-284,-229,-232,175,-221,175,-83,-219,-68,175,-28,-337,175,-11,175,175,-220,175,175,175,-284,175,175,-306,175,-337,-299,175,-225,-224,-222,-84,-300,175,175,175,-226,-223,175,-228,-227,]),'ID':([0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,43,44,45,46,47,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,76,80,81,82,85,87,89,91,94,96,97,98,100,101,102,103,104,105,106,109,111,116,117,118,119,120,121,122,123,124,126,128,129,131,135,137,142,146,147,149,150,151,165,171,173,174,175,180,181,187,191,192,193,194,198,199,201,202,204,205,206,211,218,219,220,223,227,229,231,233,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,262,264,265,266,269,275,279,280,282,284,285,286,287,289,290,291,297,298,300,301,302,303,305,307,308,312,314,316,317,319,327,328,329,332,336,338,339,342,344,349,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,372,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,457,459,460,472,475,477,481,484,485,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,548,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[42,-337,-113,-128,42,-124,-110,-106,-104,-107,-125,-105,-64,42,-60,-67,-99,-66,-109,-120,-115,-154,-65,-102,-126,-155,-131,-108,98,101,-238,-111,-337,-122,42,-63,-129,42,-121,-116,-62,-112,-70,-123,-117,-337,-337,-119,-337,-114,-130,42,-118,-71,-103,-337,-9,-131,-91,-10,-96,42,-98,42,-131,-95,-101,-97,176,-126,42,42,-93,-147,-335,-146,-167,-166,197,-28,-180,-182,-27,-100,-126,176,-337,176,-87,-90,-94,-92,-61,-72,42,-337,176,176,-286,-285,-144,176,-142,176,-283,-287,-288,176,-284,176,176,-73,310,-149,-336,42,197,197,-183,-181,176,42,176,-28,-337,42,176,-28,-337,-74,-337,176,176,176,-174,-175,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,403,405,176,176,-143,-140,-141,-145,-337,-76,-79,-82,423,-75,176,-77,176,310,-81,-215,-214,-80,-216,310,-78,-127,-153,-151,-148,176,197,-168,176,-69,-284,176,176,42,42,176,-284,176,176,-244,-247,-245,-241,-242,-246,-248,176,-250,-251,-243,-249,-12,176,176,176,-11,176,176,176,176,-234,-233,176,-231,310,176,-217,176,-230,310,-84,-218,310,176,-152,-150,42,176,-170,-169,42,-337,176,-337,-198,176,176,176,176,-337,-284,-229,-232,176,-221,310,-83,-219,-68,176,-28,-337,176,-11,176,310,-220,310,176,310,-284,176,176,176,176,-337,176,-225,-224,-222,-84,176,310,310,-226,-223,310,-228,-227,]),'IF':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,311,-336,-76,-79,-82,-75,-77,311,-81,-215,-214,-80,-216,311,-78,-69,-234,-233,-231,311,-217,-230,311,-84,-218,311,-229,-232,-221,311,-83,-219,-68,311,-220,311,311,-225,-224,-222,-84,311,311,-226,-223,311,-228,-227,]),'STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,136,137,146,149,150,151,152,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,333,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,452,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,152,-335,-28,-182,-27,152,-337,-87,-72,-337,152,-286,230,-285,152,152,-283,-287,-325,-288,152,-284,152,152,152,-336,-183,152,152,-28,-337,152,-28,-337,-337,152,-326,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-337,-76,-79,-82,-75,152,-77,152,152,-81,-215,-214,-80,-216,152,-78,152,152,-69,152,-284,152,152,-284,152,152,-244,-247,-245,-241,-242,-246,-248,152,-250,-251,-243,-249,-12,152,152,-11,152,152,152,152,-234,-233,152,-231,152,152,-217,152,-230,152,-84,-218,152,152,152,230,-337,-337,-198,152,152,152,-337,-284,-229,-232,152,-221,152,-83,-219,-68,152,-28,-337,152,-11,152,152,-220,152,152,152,-284,152,152,152,-337,152,-225,-224,-222,-84,152,152,152,-226,-223,152,-228,-227,]),'FLOAT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[44,-337,-113,-128,44,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,44,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,44,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,44,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,44,-131,-95,-101,-97,44,-53,-126,44,-88,44,44,-93,44,-147,-335,-146,44,-167,-166,-182,-100,-126,44,-87,-90,-94,-92,-61,-72,44,-144,-142,44,44,44,-73,44,-89,44,44,44,-149,-159,-160,-156,-336,44,-183,-30,44,44,-74,44,44,44,44,-174,-175,44,-143,-140,44,-141,-145,-76,-79,-82,-75,-77,44,-81,-215,-214,-80,-216,-78,-127,44,-153,44,-151,-148,-157,-168,-69,-36,-35,44,44,44,-234,-233,44,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,44,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'XOREQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,361,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'LSHIFTEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,363,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'RBRACKET':([3,39,58,76,103,105,106,117,128,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,191,198,204,205,218,219,224,225,230,232,234,235,236,237,238,261,263,268,272,273,282,334,335,336,337,351,352,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,406,407,411,419,420,421,455,456,459,466,467,468,471,476,478,480,482,483,486,487,491,493,494,513,514,524,540,541,547,551,561,562,564,565,],[-128,-129,-130,-131,-28,-182,-27,-337,-337,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-336,-183,-337,-28,-337,-28,-274,-239,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-235,-278,-337,453,-4,454,-3,464,465,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,482,-292,-305,-337,492,-337,511,512,-337,518,519,-240,520,-237,-281,-282,-290,-291,-236,-275,529,530,531,-337,-28,-254,559,560,-306,-299,570,571,572,-300,]),} + +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items + +_lr_goto_items = {'expression_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[284,284,284,284,284,284,284,284,284,284,284,284,284,]),'struct_or_union_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'init_declarator_list':([4,89,],[70,70,]),'init_declarator_list_opt':([4,89,],[79,79,]),'iteration_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[285,285,285,285,285,285,285,285,285,285,285,285,285,]),'static_assert':([0,59,181,298,307,429,437,440,502,535,537,539,569,574,577,],[17,17,286,286,286,286,286,286,286,286,286,286,286,286,286,]),'unified_string_literal':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,333,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,452,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,]),'assignment_expression_opt':([204,218,419,421,513,],[334,351,491,493,540,]),'brace_open':([31,32,92,96,98,100,101,130,131,181,201,229,298,307,375,413,429,437,440,477,478,479,502,521,535,537,539,569,574,577,],[99,102,181,184,185,193,194,181,227,181,227,181,181,181,227,488,181,181,181,488,488,488,181,227,181,181,181,181,181,181,]),'enumerator':([102,193,194,327,],[195,195,195,450,]),'typeid_noparen_declarator':([211,],[348,]),'type_qualifier_list_opt':([35,117,128,206,220,282,459,515,],[104,204,218,339,354,419,513,543,]),'declaration_specifiers_no_type_opt':([1,27,52,53,55,63,87,],[66,94,120,121,122,94,94,]),'expression_opt':([181,298,307,427,429,437,440,499,502,533,535,537,539,553,566,569,574,577,],[288,288,288,498,288,288,288,534,288,552,288,288,288,567,573,288,288,288,]),'designation':([227,472,488,550,],[369,369,369,369,]),'parameter_list':([118,129,278,342,422,460,],[213,213,213,213,213,213,]),'alignment_specifier':([0,1,4,21,27,52,53,55,59,63,75,85,87,89,93,95,99,118,129,174,177,181,184,185,186,192,211,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[53,53,81,53,53,53,53,53,53,53,53,142,53,81,53,142,142,53,53,142,280,53,142,142,142,280,81,142,142,142,142,142,53,53,142,142,53,53,53,53,53,]),'labeled_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[289,289,289,289,289,289,289,289,289,289,289,289,289,]),'abstract_declarator':([177,211,278,342,],[281,281,418,418,]),'translation_unit':([0,],[59,]),'init_declarator':([4,89,126,202,],[84,84,217,331,]),'direct_abstract_declarator':([177,211,276,278,342,344,457,],[283,283,414,283,283,414,414,]),'designator_list':([227,472,488,550,],[376,376,376,376,]),'identifier':([85,116,118,129,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,349,353,354,364,372,373,375,412,413,419,421,427,429,430,434,437,440,441,447,460,477,481,484,485,499,502,513,521,533,535,537,538,539,542,543,548,549,553,566,569,574,577,],[143,143,215,215,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,461,143,143,143,470,143,143,143,143,143,143,143,143,143,143,143,143,143,143,215,143,143,143,527,143,143,143,143,143,143,143,143,143,143,143,563,143,143,143,143,143,143,]),'offsetof_member_designator':([485,],[526,]),'unary_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[144,144,224,232,234,144,224,273,224,224,224,224,224,224,224,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,224,144,144,224,224,224,144,224,224,144,144,224,224,224,224,224,144,224,224,144,224,224,224,224,224,224,224,224,224,144,144,144,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,]),'abstract_declarator_opt':([177,211,],[274,343,]),'initializer':([131,201,375,521,],[226,330,473,546,]),'direct_id_declarator':([0,4,15,37,40,59,69,72,89,91,126,192,202,211,342,344,445,457,],[48,48,86,48,48,48,48,86,48,48,48,48,48,48,48,86,48,86,]),'struct_declaration_list':([99,184,185,],[186,313,315,]),'pp_directive':([0,59,],[14,14,]),'declaration_list':([21,75,],[93,93,]),'id_init_declarator':([40,91,],[108,108,]),'type_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[18,18,109,18,18,147,109,18,147,147,18,18,269,147,18,147,147,147,109,147,147,147,147,147,18,18,147,147,18,18,18,18,18,]),'compound_statement':([92,130,181,229,298,307,429,437,440,502,535,537,539,569,574,577,],[180,223,291,378,291,291,291,291,291,291,291,291,291,291,291,291,]),'pointer':([0,4,37,40,59,69,89,91,104,126,177,192,202,211,278,342,445,],[15,72,15,15,15,72,72,15,199,72,276,72,72,344,276,457,72,]),'typeid_declarator':([4,69,89,126,192,202,445,],[74,125,74,74,74,74,74,]),'id_init_declarator_list':([40,91,],[113,113,]),'declarator':([4,89,126,192,202,445,],[78,78,78,324,78,324,]),'argument_expression_list':([266,],[409,]),'struct_declarator_list_opt':([192,],[322,]),'block_item_list':([181,],[298,]),'parameter_type_list_opt':([278,342,422,],[417,417,495,]),'struct_declarator':([192,445,],[323,508,]),'type_qualifier':([0,1,4,21,27,35,52,53,55,59,63,75,85,87,89,93,95,99,103,117,118,128,129,172,174,177,181,184,185,186,192,205,206,211,219,220,229,231,233,239,267,278,282,298,313,315,342,350,422,427,459,460,514,515,],[52,52,80,52,52,105,52,52,52,52,52,52,105,52,80,52,105,105,198,105,52,105,52,198,105,279,52,105,105,105,279,198,105,80,198,105,105,105,105,105,105,52,105,52,105,105,52,52,52,52,105,52,198,105,]),'assignment_operator':([224,],[364,]),'expression':([174,181,229,231,233,258,265,290,298,307,427,429,430,434,437,440,441,499,502,533,535,537,538,539,549,553,566,569,574,577,],[270,294,270,270,270,399,406,426,294,294,294,294,501,503,294,294,507,294,294,294,294,294,556,294,564,294,294,294,294,294,]),'storage_class_specifier':([0,1,4,21,27,52,53,55,59,63,75,87,89,93,118,129,181,211,278,298,342,350,422,427,460,],[1,1,68,1,1,1,1,1,1,1,1,1,68,1,1,1,1,68,1,1,1,1,1,1,1,]),'unified_wstring_literal':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,]),'translation_unit_or_empty':([0,],[9,]),'initializer_list_opt':([227,],[370,]),'brace_close':([99,184,185,186,196,309,313,315,325,326,370,472,528,550,],[187,314,316,317,328,439,442,443,448,449,469,523,551,565,]),'direct_typeid_declarator':([4,69,72,89,126,192,202,445,],[73,73,127,73,73,73,73,73,]),'external_declaration':([0,59,],[16,123,]),'pragmacomp_or_statement':([307,429,440,502,535,537,539,569,574,577,],[436,500,506,536,554,555,557,576,578,579,]),'type_name':([85,95,174,229,231,233,239,267,],[157,183,271,379,380,381,382,410,]),'typedef_name':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,]),'pppragma_directive':([0,59,99,181,184,185,186,298,307,313,315,429,437,440,502,535,537,539,569,574,577,],[25,25,189,300,189,189,189,300,437,189,189,437,300,437,437,437,437,437,437,437,437,]),'statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[301,301,438,438,505,438,438,438,438,558,438,438,438,]),'cast_expression':([85,116,131,171,174,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[158,158,158,268,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,487,158,158,158,158,158,158,158,158,158,158,487,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,]),'atomic_specifier':([0,1,21,27,40,52,53,55,59,63,75,85,87,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[27,63,87,63,111,63,63,63,27,63,87,111,63,111,87,111,111,27,27,111,111,87,111,111,111,111,111,111,111,111,111,27,87,111,111,27,27,27,87,27,]),'struct_declarator_list':([192,],[320,]),'empty':([0,1,4,21,27,35,40,52,53,55,63,75,87,89,91,117,118,128,129,177,181,192,204,206,211,218,220,227,278,282,298,307,342,419,421,422,427,429,437,440,459,460,472,488,499,502,513,515,533,535,537,539,550,553,566,569,574,577,],[57,64,83,88,64,106,115,64,64,64,64,88,64,83,115,106,208,106,208,277,306,321,337,106,277,337,106,377,415,106,433,433,415,337,337,415,433,433,433,433,106,208,522,522,433,433,337,106,433,433,433,433,522,433,433,433,433,433,]),'parameter_declaration':([118,129,278,342,350,422,460,],[210,210,210,210,463,210,210,]),'primary_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,]),'declaration':([0,21,59,75,93,181,298,427,],[38,90,38,90,182,302,302,499,]),'declaration_specifiers_no_type':([0,1,21,27,52,53,55,59,63,75,87,93,118,129,181,278,298,342,350,422,427,460,],[40,67,91,67,67,67,67,40,67,91,67,91,214,214,91,214,91,214,214,214,91,214,]),'jump_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[303,303,303,303,303,303,303,303,303,303,303,303,303,]),'enumerator_list':([102,193,194,],[196,325,326,]),'block_item':([181,298,],[305,432,]),'constant_expression':([85,116,297,319,329,373,447,],[159,203,431,444,451,471,509,]),'identifier_list_opt':([118,129,460,],[207,221,516,]),'constant':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,]),'type_specifier_no_typeid':([0,4,21,40,59,75,85,89,91,93,95,99,118,129,172,174,177,181,184,185,186,192,211,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[12,71,12,12,12,12,12,71,12,12,12,12,12,12,12,12,275,12,12,12,12,275,71,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,]),'struct_declaration':([99,184,185,186,313,315,],[190,190,190,318,318,318,]),'direct_typeid_noparen_declarator':([211,344,],[345,458,]),'id_declarator':([0,4,37,40,59,69,89,91,126,192,202,211,342,445,],[21,75,107,110,21,107,179,110,179,179,179,346,107,179,]),'selection_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[308,308,308,308,308,308,308,308,308,308,308,308,308,]),'postfix_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,]),'initializer_list':([227,488,],[374,528,]),'unary_operator':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,]),'struct_or_union':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,]),'block_item_list_opt':([181,],[309,]),'assignment_expression':([131,174,181,201,204,218,229,231,233,258,265,266,290,298,307,338,339,353,354,364,375,412,419,421,427,429,430,434,437,440,441,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[228,272,272,228,335,335,272,272,272,272,272,408,272,272,272,455,456,466,467,468,228,486,335,335,272,272,272,272,272,272,272,525,272,272,335,228,272,272,272,272,272,561,562,272,272,272,272,272,272,]),'designation_opt':([227,472,488,550,],[375,521,375,521,]),'parameter_type_list':([118,129,278,342,422,460,],[209,222,416,416,416,517,]),'type_qualifier_list':([35,85,95,99,117,128,174,184,185,186,206,220,229,231,233,239,267,282,313,315,459,515,],[103,172,172,172,205,219,172,172,172,172,103,103,172,172,172,172,172,103,172,172,514,103,]),'designator':([227,376,472,488,550,],[371,474,371,371,371,]),'id_init_declarator_list_opt':([40,91,],[114,114,]),'declaration_specifiers':([0,21,59,75,93,118,129,181,278,298,342,350,422,427,460,],[4,89,4,89,89,211,211,89,211,89,211,211,211,89,211,]),'identifier_list':([118,129,460,],[212,212,212,]),'declaration_list_opt':([21,75,],[92,130,]),'function_definition':([0,59,],[45,45,]),'binary_expression':([85,116,131,174,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,419,421,427,429,430,434,437,440,441,447,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[162,162,162,162,162,162,162,162,162,162,162,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,162,400,401,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,]),'enum_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,]),'decl_body':([0,21,59,75,93,181,298,427,],[51,51,51,51,51,51,51,51,]),'function_specifier':([0,1,4,21,27,52,53,55,59,63,75,87,89,93,118,129,181,211,278,298,342,350,422,427,460,],[55,55,82,55,55,55,55,55,55,55,55,55,82,55,55,55,55,82,55,55,55,55,55,55,55,]),'specifier_qualifier_list':([85,95,99,174,184,185,186,229,231,233,239,267,313,315,],[177,177,192,177,192,192,192,177,177,177,177,177,192,192,]),'conditional_expression':([85,116,131,174,181,201,204,218,229,231,233,258,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,419,421,427,429,430,434,437,440,441,447,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[178,178,225,225,225,225,225,225,225,225,225,225,225,225,225,178,225,225,178,178,225,225,225,225,225,178,225,225,225,225,225,225,225,225,225,225,225,178,524,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,]),} + +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +_lr_productions = [ + ("S' -> translation_unit_or_empty","S'",1,None,None,None), + ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','plyparser.py',43), + ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','plyparser.py',44), + ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','plyparser.py',43), + ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','plyparser.py',44), + ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','plyparser.py',43), + ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','plyparser.py',44), + ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','plyparser.py',43), + ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','plyparser.py',44), + ('declaration_specifiers_no_type_opt -> empty','declaration_specifiers_no_type_opt',1,'p_declaration_specifiers_no_type_opt','plyparser.py',43), + ('declaration_specifiers_no_type_opt -> declaration_specifiers_no_type','declaration_specifiers_no_type_opt',1,'p_declaration_specifiers_no_type_opt','plyparser.py',44), + ('designation_opt -> empty','designation_opt',1,'p_designation_opt','plyparser.py',43), + ('designation_opt -> designation','designation_opt',1,'p_designation_opt','plyparser.py',44), + ('expression_opt -> empty','expression_opt',1,'p_expression_opt','plyparser.py',43), + ('expression_opt -> expression','expression_opt',1,'p_expression_opt','plyparser.py',44), + ('id_init_declarator_list_opt -> empty','id_init_declarator_list_opt',1,'p_id_init_declarator_list_opt','plyparser.py',43), + ('id_init_declarator_list_opt -> id_init_declarator_list','id_init_declarator_list_opt',1,'p_id_init_declarator_list_opt','plyparser.py',44), + ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','plyparser.py',43), + ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','plyparser.py',44), + ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','plyparser.py',43), + ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','plyparser.py',44), + ('initializer_list_opt -> empty','initializer_list_opt',1,'p_initializer_list_opt','plyparser.py',43), + ('initializer_list_opt -> initializer_list','initializer_list_opt',1,'p_initializer_list_opt','plyparser.py',44), + ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','plyparser.py',43), + ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','plyparser.py',44), + ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','plyparser.py',43), + ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','plyparser.py',44), + ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','plyparser.py',43), + ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','plyparser.py',44), + ('direct_id_declarator -> ID','direct_id_declarator',1,'p_direct_id_declarator_1','plyparser.py',126), + ('direct_id_declarator -> LPAREN id_declarator RPAREN','direct_id_declarator',3,'p_direct_id_declarator_2','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_id_declarator',5,'p_direct_id_declarator_3','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_id_declarator',6,'p_direct_id_declarator_4','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_id_declarator',6,'p_direct_id_declarator_4','plyparser.py',127), + ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_id_declarator',5,'p_direct_id_declarator_5','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LPAREN parameter_type_list RPAREN','direct_id_declarator',4,'p_direct_id_declarator_6','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LPAREN identifier_list_opt RPAREN','direct_id_declarator',4,'p_direct_id_declarator_6','plyparser.py',127), + ('direct_typeid_declarator -> TYPEID','direct_typeid_declarator',1,'p_direct_typeid_declarator_1','plyparser.py',126), + ('direct_typeid_declarator -> LPAREN typeid_declarator RPAREN','direct_typeid_declarator',3,'p_direct_typeid_declarator_2','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_typeid_declarator',5,'p_direct_typeid_declarator_3','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_typeid_declarator',6,'p_direct_typeid_declarator_4','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_typeid_declarator',6,'p_direct_typeid_declarator_4','plyparser.py',127), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_typeid_declarator',5,'p_direct_typeid_declarator_5','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LPAREN parameter_type_list RPAREN','direct_typeid_declarator',4,'p_direct_typeid_declarator_6','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LPAREN identifier_list_opt RPAREN','direct_typeid_declarator',4,'p_direct_typeid_declarator_6','plyparser.py',127), + ('direct_typeid_noparen_declarator -> TYPEID','direct_typeid_noparen_declarator',1,'p_direct_typeid_noparen_declarator_1','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_typeid_noparen_declarator',5,'p_direct_typeid_noparen_declarator_3','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_typeid_noparen_declarator',6,'p_direct_typeid_noparen_declarator_4','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_typeid_noparen_declarator',6,'p_direct_typeid_noparen_declarator_4','plyparser.py',127), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_typeid_noparen_declarator',5,'p_direct_typeid_noparen_declarator_5','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LPAREN parameter_type_list RPAREN','direct_typeid_noparen_declarator',4,'p_direct_typeid_noparen_declarator_6','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LPAREN identifier_list_opt RPAREN','direct_typeid_noparen_declarator',4,'p_direct_typeid_noparen_declarator_6','plyparser.py',127), + ('id_declarator -> direct_id_declarator','id_declarator',1,'p_id_declarator_1','plyparser.py',126), + ('id_declarator -> pointer direct_id_declarator','id_declarator',2,'p_id_declarator_2','plyparser.py',126), + ('typeid_declarator -> direct_typeid_declarator','typeid_declarator',1,'p_typeid_declarator_1','plyparser.py',126), + ('typeid_declarator -> pointer direct_typeid_declarator','typeid_declarator',2,'p_typeid_declarator_2','plyparser.py',126), + ('typeid_noparen_declarator -> direct_typeid_noparen_declarator','typeid_noparen_declarator',1,'p_typeid_noparen_declarator_1','plyparser.py',126), + ('typeid_noparen_declarator -> pointer direct_typeid_noparen_declarator','typeid_noparen_declarator',2,'p_typeid_noparen_declarator_2','plyparser.py',126), + ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','c_parser.py',509), + ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','c_parser.py',510), + ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','c_parser.py',518), + ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','c_parser.py',524), + ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','c_parser.py',534), + ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','c_parser.py',539), + ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','c_parser.py',544), + ('external_declaration -> pppragma_directive','external_declaration',1,'p_external_declaration_3','c_parser.py',545), + ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','c_parser.py',550), + ('external_declaration -> static_assert','external_declaration',1,'p_external_declaration_5','c_parser.py',555), + ('static_assert -> _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN','static_assert',6,'p_static_assert_declaration','c_parser.py',560), + ('static_assert -> _STATIC_ASSERT LPAREN constant_expression RPAREN','static_assert',4,'p_static_assert_declaration','c_parser.py',561), + ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','c_parser.py',569), + ('pppragma_directive -> PPPRAGMA','pppragma_directive',1,'p_pppragma_directive','c_parser.py',575), + ('pppragma_directive -> PPPRAGMA PPPRAGMASTR','pppragma_directive',2,'p_pppragma_directive','c_parser.py',576), + ('function_definition -> id_declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','c_parser.py',586), + ('function_definition -> declaration_specifiers id_declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','c_parser.py',604), + ('statement -> labeled_statement','statement',1,'p_statement','c_parser.py',619), + ('statement -> expression_statement','statement',1,'p_statement','c_parser.py',620), + ('statement -> compound_statement','statement',1,'p_statement','c_parser.py',621), + ('statement -> selection_statement','statement',1,'p_statement','c_parser.py',622), + ('statement -> iteration_statement','statement',1,'p_statement','c_parser.py',623), + ('statement -> jump_statement','statement',1,'p_statement','c_parser.py',624), + ('statement -> pppragma_directive','statement',1,'p_statement','c_parser.py',625), + ('statement -> static_assert','statement',1,'p_statement','c_parser.py',626), + ('pragmacomp_or_statement -> pppragma_directive statement','pragmacomp_or_statement',2,'p_pragmacomp_or_statement','c_parser.py',674), + ('pragmacomp_or_statement -> statement','pragmacomp_or_statement',1,'p_pragmacomp_or_statement','c_parser.py',675), + ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','c_parser.py',694), + ('decl_body -> declaration_specifiers_no_type id_init_declarator_list_opt','decl_body',2,'p_decl_body','c_parser.py',695), + ('declaration -> decl_body SEMI','declaration',2,'p_declaration','c_parser.py',755), + ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','c_parser.py',764), + ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','c_parser.py',765), + ('declaration_specifiers_no_type -> type_qualifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_1','c_parser.py',775), + ('declaration_specifiers_no_type -> storage_class_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_2','c_parser.py',780), + ('declaration_specifiers_no_type -> function_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_3','c_parser.py',785), + ('declaration_specifiers_no_type -> atomic_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_4','c_parser.py',792), + ('declaration_specifiers_no_type -> alignment_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_5','c_parser.py',797), + ('declaration_specifiers -> declaration_specifiers type_qualifier','declaration_specifiers',2,'p_declaration_specifiers_1','c_parser.py',802), + ('declaration_specifiers -> declaration_specifiers storage_class_specifier','declaration_specifiers',2,'p_declaration_specifiers_2','c_parser.py',807), + ('declaration_specifiers -> declaration_specifiers function_specifier','declaration_specifiers',2,'p_declaration_specifiers_3','c_parser.py',812), + ('declaration_specifiers -> declaration_specifiers type_specifier_no_typeid','declaration_specifiers',2,'p_declaration_specifiers_4','c_parser.py',817), + ('declaration_specifiers -> type_specifier','declaration_specifiers',1,'p_declaration_specifiers_5','c_parser.py',822), + ('declaration_specifiers -> declaration_specifiers_no_type type_specifier','declaration_specifiers',2,'p_declaration_specifiers_6','c_parser.py',827), + ('declaration_specifiers -> declaration_specifiers alignment_specifier','declaration_specifiers',2,'p_declaration_specifiers_7','c_parser.py',832), + ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',837), + ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',838), + ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',839), + ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',840), + ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',841), + ('storage_class_specifier -> _THREAD_LOCAL','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',842), + ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','c_parser.py',847), + ('function_specifier -> _NORETURN','function_specifier',1,'p_function_specifier','c_parser.py',848), + ('type_specifier_no_typeid -> VOID','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',853), + ('type_specifier_no_typeid -> _BOOL','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',854), + ('type_specifier_no_typeid -> CHAR','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',855), + ('type_specifier_no_typeid -> SHORT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',856), + ('type_specifier_no_typeid -> INT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',857), + ('type_specifier_no_typeid -> LONG','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',858), + ('type_specifier_no_typeid -> FLOAT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',859), + ('type_specifier_no_typeid -> DOUBLE','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',860), + ('type_specifier_no_typeid -> _COMPLEX','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',861), + ('type_specifier_no_typeid -> SIGNED','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',862), + ('type_specifier_no_typeid -> UNSIGNED','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',863), + ('type_specifier_no_typeid -> __INT128','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',864), + ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier','c_parser.py',869), + ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier','c_parser.py',870), + ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier','c_parser.py',871), + ('type_specifier -> type_specifier_no_typeid','type_specifier',1,'p_type_specifier','c_parser.py',872), + ('type_specifier -> atomic_specifier','type_specifier',1,'p_type_specifier','c_parser.py',873), + ('atomic_specifier -> _ATOMIC LPAREN type_name RPAREN','atomic_specifier',4,'p_atomic_specifier','c_parser.py',879), + ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','c_parser.py',886), + ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','c_parser.py',887), + ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','c_parser.py',888), + ('type_qualifier -> _ATOMIC','type_qualifier',1,'p_type_qualifier','c_parser.py',889), + ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list','c_parser.py',894), + ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list','c_parser.py',895), + ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','c_parser.py',903), + ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','c_parser.py',904), + ('id_init_declarator_list -> id_init_declarator','id_init_declarator_list',1,'p_id_init_declarator_list','c_parser.py',909), + ('id_init_declarator_list -> id_init_declarator_list COMMA init_declarator','id_init_declarator_list',3,'p_id_init_declarator_list','c_parser.py',910), + ('id_init_declarator -> id_declarator','id_init_declarator',1,'p_id_init_declarator','c_parser.py',915), + ('id_init_declarator -> id_declarator EQUALS initializer','id_init_declarator',3,'p_id_init_declarator','c_parser.py',916), + ('specifier_qualifier_list -> specifier_qualifier_list type_specifier_no_typeid','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','c_parser.py',923), + ('specifier_qualifier_list -> specifier_qualifier_list type_qualifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','c_parser.py',928), + ('specifier_qualifier_list -> type_specifier','specifier_qualifier_list',1,'p_specifier_qualifier_list_3','c_parser.py',933), + ('specifier_qualifier_list -> type_qualifier_list type_specifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_4','c_parser.py',938), + ('specifier_qualifier_list -> alignment_specifier','specifier_qualifier_list',1,'p_specifier_qualifier_list_5','c_parser.py',943), + ('specifier_qualifier_list -> specifier_qualifier_list alignment_specifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_6','c_parser.py',948), + ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','c_parser.py',956), + ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','c_parser.py',957), + ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','c_parser.py',967), + ('struct_or_union_specifier -> struct_or_union brace_open brace_close','struct_or_union_specifier',3,'p_struct_or_union_specifier_2','c_parser.py',968), + ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','c_parser.py',985), + ('struct_or_union_specifier -> struct_or_union ID brace_open brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_3','c_parser.py',986), + ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','c_parser.py',987), + ('struct_or_union_specifier -> struct_or_union TYPEID brace_open brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_3','c_parser.py',988), + ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','c_parser.py',1004), + ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','c_parser.py',1005), + ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','c_parser.py',1012), + ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','c_parser.py',1013), + ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','c_parser.py',1021), + ('struct_declaration -> SEMI','struct_declaration',1,'p_struct_declaration_2','c_parser.py',1059), + ('struct_declaration -> pppragma_directive','struct_declaration',1,'p_struct_declaration_3','c_parser.py',1064), + ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','c_parser.py',1069), + ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','c_parser.py',1070), + ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','c_parser.py',1078), + ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','c_parser.py',1083), + ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','c_parser.py',1084), + ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','c_parser.py',1092), + ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','c_parser.py',1093), + ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','c_parser.py',1098), + ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','c_parser.py',1103), + ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','c_parser.py',1104), + ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','c_parser.py',1109), + ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','c_parser.py',1110), + ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','c_parser.py',1111), + ('alignment_specifier -> _ALIGNAS LPAREN type_name RPAREN','alignment_specifier',4,'p_alignment_specifier','c_parser.py',1122), + ('alignment_specifier -> _ALIGNAS LPAREN constant_expression RPAREN','alignment_specifier',4,'p_alignment_specifier','c_parser.py',1123), + ('enumerator -> ID','enumerator',1,'p_enumerator','c_parser.py',1128), + ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','c_parser.py',1129), + ('declarator -> id_declarator','declarator',1,'p_declarator','c_parser.py',1144), + ('declarator -> typeid_declarator','declarator',1,'p_declarator','c_parser.py',1145), + ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','c_parser.py',1257), + ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','c_parser.py',1258), + ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','c_parser.py',1287), + ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','c_parser.py',1288), + ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','c_parser.py',1293), + ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','c_parser.py',1294), + ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','c_parser.py',1302), + ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','c_parser.py',1303), + ('parameter_declaration -> declaration_specifiers id_declarator','parameter_declaration',2,'p_parameter_declaration_1','c_parser.py',1322), + ('parameter_declaration -> declaration_specifiers typeid_noparen_declarator','parameter_declaration',2,'p_parameter_declaration_1','c_parser.py',1323), + ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','c_parser.py',1334), + ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','c_parser.py',1366), + ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','c_parser.py',1367), + ('initializer -> assignment_expression','initializer',1,'p_initializer_1','c_parser.py',1376), + ('initializer -> brace_open initializer_list_opt brace_close','initializer',3,'p_initializer_2','c_parser.py',1381), + ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','c_parser.py',1382), + ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','c_parser.py',1390), + ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','c_parser.py',1391), + ('designation -> designator_list EQUALS','designation',2,'p_designation','c_parser.py',1402), + ('designator_list -> designator','designator_list',1,'p_designator_list','c_parser.py',1410), + ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','c_parser.py',1411), + ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','c_parser.py',1416), + ('designator -> PERIOD identifier','designator',2,'p_designator','c_parser.py',1417), + ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','c_parser.py',1422), + ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','c_parser.py',1434), + ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','c_parser.py',1442), + ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','c_parser.py',1447), + ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','c_parser.py',1457), + ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','c_parser.py',1461), + ('direct_abstract_declarator -> LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_3','c_parser.py',1472), + ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','c_parser.py',1482), + ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','c_parser.py',1493), + ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','c_parser.py',1502), + ('direct_abstract_declarator -> LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_7','c_parser.py',1512), + ('block_item -> declaration','block_item',1,'p_block_item','c_parser.py',1523), + ('block_item -> statement','block_item',1,'p_block_item','c_parser.py',1524), + ('block_item_list -> block_item','block_item_list',1,'p_block_item_list','c_parser.py',1531), + ('block_item_list -> block_item_list block_item','block_item_list',2,'p_block_item_list','c_parser.py',1532), + ('compound_statement -> brace_open block_item_list_opt brace_close','compound_statement',3,'p_compound_statement_1','c_parser.py',1538), + ('labeled_statement -> ID COLON pragmacomp_or_statement','labeled_statement',3,'p_labeled_statement_1','c_parser.py',1544), + ('labeled_statement -> CASE constant_expression COLON pragmacomp_or_statement','labeled_statement',4,'p_labeled_statement_2','c_parser.py',1548), + ('labeled_statement -> DEFAULT COLON pragmacomp_or_statement','labeled_statement',3,'p_labeled_statement_3','c_parser.py',1552), + ('selection_statement -> IF LPAREN expression RPAREN pragmacomp_or_statement','selection_statement',5,'p_selection_statement_1','c_parser.py',1556), + ('selection_statement -> IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement','selection_statement',7,'p_selection_statement_2','c_parser.py',1560), + ('selection_statement -> SWITCH LPAREN expression RPAREN pragmacomp_or_statement','selection_statement',5,'p_selection_statement_3','c_parser.py',1564), + ('iteration_statement -> WHILE LPAREN expression RPAREN pragmacomp_or_statement','iteration_statement',5,'p_iteration_statement_1','c_parser.py',1569), + ('iteration_statement -> DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI','iteration_statement',7,'p_iteration_statement_2','c_parser.py',1573), + ('iteration_statement -> FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement','iteration_statement',9,'p_iteration_statement_3','c_parser.py',1577), + ('iteration_statement -> FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement','iteration_statement',8,'p_iteration_statement_4','c_parser.py',1581), + ('jump_statement -> GOTO ID SEMI','jump_statement',3,'p_jump_statement_1','c_parser.py',1586), + ('jump_statement -> BREAK SEMI','jump_statement',2,'p_jump_statement_2','c_parser.py',1590), + ('jump_statement -> CONTINUE SEMI','jump_statement',2,'p_jump_statement_3','c_parser.py',1594), + ('jump_statement -> RETURN expression SEMI','jump_statement',3,'p_jump_statement_4','c_parser.py',1598), + ('jump_statement -> RETURN SEMI','jump_statement',2,'p_jump_statement_4','c_parser.py',1599), + ('expression_statement -> expression_opt SEMI','expression_statement',2,'p_expression_statement','c_parser.py',1604), + ('expression -> assignment_expression','expression',1,'p_expression','c_parser.py',1611), + ('expression -> expression COMMA assignment_expression','expression',3,'p_expression','c_parser.py',1612), + ('assignment_expression -> LPAREN compound_statement RPAREN','assignment_expression',3,'p_parenthesized_compound_expression','c_parser.py',1624), + ('typedef_name -> TYPEID','typedef_name',1,'p_typedef_name','c_parser.py',1628), + ('assignment_expression -> conditional_expression','assignment_expression',1,'p_assignment_expression','c_parser.py',1632), + ('assignment_expression -> unary_expression assignment_operator assignment_expression','assignment_expression',3,'p_assignment_expression','c_parser.py',1633), + ('assignment_operator -> EQUALS','assignment_operator',1,'p_assignment_operator','c_parser.py',1646), + ('assignment_operator -> XOREQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1647), + ('assignment_operator -> TIMESEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1648), + ('assignment_operator -> DIVEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1649), + ('assignment_operator -> MODEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1650), + ('assignment_operator -> PLUSEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1651), + ('assignment_operator -> MINUSEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1652), + ('assignment_operator -> LSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1653), + ('assignment_operator -> RSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1654), + ('assignment_operator -> ANDEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1655), + ('assignment_operator -> OREQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1656), + ('constant_expression -> conditional_expression','constant_expression',1,'p_constant_expression','c_parser.py',1661), + ('conditional_expression -> binary_expression','conditional_expression',1,'p_conditional_expression','c_parser.py',1665), + ('conditional_expression -> binary_expression CONDOP expression COLON conditional_expression','conditional_expression',5,'p_conditional_expression','c_parser.py',1666), + ('binary_expression -> cast_expression','binary_expression',1,'p_binary_expression','c_parser.py',1674), + ('binary_expression -> binary_expression TIMES binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1675), + ('binary_expression -> binary_expression DIVIDE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1676), + ('binary_expression -> binary_expression MOD binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1677), + ('binary_expression -> binary_expression PLUS binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1678), + ('binary_expression -> binary_expression MINUS binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1679), + ('binary_expression -> binary_expression RSHIFT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1680), + ('binary_expression -> binary_expression LSHIFT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1681), + ('binary_expression -> binary_expression LT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1682), + ('binary_expression -> binary_expression LE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1683), + ('binary_expression -> binary_expression GE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1684), + ('binary_expression -> binary_expression GT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1685), + ('binary_expression -> binary_expression EQ binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1686), + ('binary_expression -> binary_expression NE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1687), + ('binary_expression -> binary_expression AND binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1688), + ('binary_expression -> binary_expression OR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1689), + ('binary_expression -> binary_expression XOR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1690), + ('binary_expression -> binary_expression LAND binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1691), + ('binary_expression -> binary_expression LOR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1692), + ('cast_expression -> unary_expression','cast_expression',1,'p_cast_expression_1','c_parser.py',1700), + ('cast_expression -> LPAREN type_name RPAREN cast_expression','cast_expression',4,'p_cast_expression_2','c_parser.py',1704), + ('unary_expression -> postfix_expression','unary_expression',1,'p_unary_expression_1','c_parser.py',1708), + ('unary_expression -> PLUSPLUS unary_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1712), + ('unary_expression -> MINUSMINUS unary_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1713), + ('unary_expression -> unary_operator cast_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1714), + ('unary_expression -> SIZEOF unary_expression','unary_expression',2,'p_unary_expression_3','c_parser.py',1719), + ('unary_expression -> SIZEOF LPAREN type_name RPAREN','unary_expression',4,'p_unary_expression_3','c_parser.py',1720), + ('unary_expression -> _ALIGNOF LPAREN type_name RPAREN','unary_expression',4,'p_unary_expression_3','c_parser.py',1721), + ('unary_operator -> AND','unary_operator',1,'p_unary_operator','c_parser.py',1729), + ('unary_operator -> TIMES','unary_operator',1,'p_unary_operator','c_parser.py',1730), + ('unary_operator -> PLUS','unary_operator',1,'p_unary_operator','c_parser.py',1731), + ('unary_operator -> MINUS','unary_operator',1,'p_unary_operator','c_parser.py',1732), + ('unary_operator -> NOT','unary_operator',1,'p_unary_operator','c_parser.py',1733), + ('unary_operator -> LNOT','unary_operator',1,'p_unary_operator','c_parser.py',1734), + ('postfix_expression -> primary_expression','postfix_expression',1,'p_postfix_expression_1','c_parser.py',1739), + ('postfix_expression -> postfix_expression LBRACKET expression RBRACKET','postfix_expression',4,'p_postfix_expression_2','c_parser.py',1743), + ('postfix_expression -> postfix_expression LPAREN argument_expression_list RPAREN','postfix_expression',4,'p_postfix_expression_3','c_parser.py',1747), + ('postfix_expression -> postfix_expression LPAREN RPAREN','postfix_expression',3,'p_postfix_expression_3','c_parser.py',1748), + ('postfix_expression -> postfix_expression PERIOD ID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1753), + ('postfix_expression -> postfix_expression PERIOD TYPEID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1754), + ('postfix_expression -> postfix_expression ARROW ID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1755), + ('postfix_expression -> postfix_expression ARROW TYPEID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1756), + ('postfix_expression -> postfix_expression PLUSPLUS','postfix_expression',2,'p_postfix_expression_5','c_parser.py',1762), + ('postfix_expression -> postfix_expression MINUSMINUS','postfix_expression',2,'p_postfix_expression_5','c_parser.py',1763), + ('postfix_expression -> LPAREN type_name RPAREN brace_open initializer_list brace_close','postfix_expression',6,'p_postfix_expression_6','c_parser.py',1768), + ('postfix_expression -> LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close','postfix_expression',7,'p_postfix_expression_6','c_parser.py',1769), + ('primary_expression -> identifier','primary_expression',1,'p_primary_expression_1','c_parser.py',1774), + ('primary_expression -> constant','primary_expression',1,'p_primary_expression_2','c_parser.py',1778), + ('primary_expression -> unified_string_literal','primary_expression',1,'p_primary_expression_3','c_parser.py',1782), + ('primary_expression -> unified_wstring_literal','primary_expression',1,'p_primary_expression_3','c_parser.py',1783), + ('primary_expression -> LPAREN expression RPAREN','primary_expression',3,'p_primary_expression_4','c_parser.py',1788), + ('primary_expression -> OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN','primary_expression',6,'p_primary_expression_5','c_parser.py',1792), + ('offsetof_member_designator -> identifier','offsetof_member_designator',1,'p_offsetof_member_designator','c_parser.py',1800), + ('offsetof_member_designator -> offsetof_member_designator PERIOD identifier','offsetof_member_designator',3,'p_offsetof_member_designator','c_parser.py',1801), + ('offsetof_member_designator -> offsetof_member_designator LBRACKET expression RBRACKET','offsetof_member_designator',4,'p_offsetof_member_designator','c_parser.py',1802), + ('argument_expression_list -> assignment_expression','argument_expression_list',1,'p_argument_expression_list','c_parser.py',1814), + ('argument_expression_list -> argument_expression_list COMMA assignment_expression','argument_expression_list',3,'p_argument_expression_list','c_parser.py',1815), + ('identifier -> ID','identifier',1,'p_identifier','c_parser.py',1824), + ('constant -> INT_CONST_DEC','constant',1,'p_constant_1','c_parser.py',1828), + ('constant -> INT_CONST_OCT','constant',1,'p_constant_1','c_parser.py',1829), + ('constant -> INT_CONST_HEX','constant',1,'p_constant_1','c_parser.py',1830), + ('constant -> INT_CONST_BIN','constant',1,'p_constant_1','c_parser.py',1831), + ('constant -> INT_CONST_CHAR','constant',1,'p_constant_1','c_parser.py',1832), + ('constant -> FLOAT_CONST','constant',1,'p_constant_2','c_parser.py',1851), + ('constant -> HEX_FLOAT_CONST','constant',1,'p_constant_2','c_parser.py',1852), + ('constant -> CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1868), + ('constant -> WCHAR_CONST','constant',1,'p_constant_3','c_parser.py',1869), + ('constant -> U8CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1870), + ('constant -> U16CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1871), + ('constant -> U32CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1872), + ('unified_string_literal -> STRING_LITERAL','unified_string_literal',1,'p_unified_string_literal','c_parser.py',1883), + ('unified_string_literal -> unified_string_literal STRING_LITERAL','unified_string_literal',2,'p_unified_string_literal','c_parser.py',1884), + ('unified_wstring_literal -> WSTRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1894), + ('unified_wstring_literal -> U8STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1895), + ('unified_wstring_literal -> U16STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1896), + ('unified_wstring_literal -> U32STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1897), + ('unified_wstring_literal -> unified_wstring_literal WSTRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1898), + ('unified_wstring_literal -> unified_wstring_literal U8STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1899), + ('unified_wstring_literal -> unified_wstring_literal U16STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1900), + ('unified_wstring_literal -> unified_wstring_literal U32STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1901), + ('brace_open -> LBRACE','brace_open',1,'p_brace_open','c_parser.py',1911), + ('brace_close -> RBRACE','brace_close',1,'p_brace_close','c_parser.py',1917), + ('empty -> ','empty',0,'p_empty','c_parser.py',1923), +] diff --git a/billinglayer/python/requests-2.31.0.dist-info/INSTALLER b/billinglayer/python/requests-2.31.0.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/requests-2.31.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/requests-2.31.0.dist-info/LICENSE b/billinglayer/python/requests-2.31.0.dist-info/LICENSE new file mode 100644 index 0000000..67db858 --- /dev/null +++ b/billinglayer/python/requests-2.31.0.dist-info/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/billinglayer/python/requests-2.31.0.dist-info/METADATA b/billinglayer/python/requests-2.31.0.dist-info/METADATA new file mode 100644 index 0000000..05779fa --- /dev/null +++ b/billinglayer/python/requests-2.31.0.dist-info/METADATA @@ -0,0 +1,122 @@ +Metadata-Version: 2.1 +Name: requests +Version: 2.31.0 +Summary: Python HTTP for Humans. +Home-page: https://requests.readthedocs.io +Author: Kenneth Reitz +Author-email: me@kennethreitz.org +License: Apache 2.0 +Project-URL: Documentation, https://requests.readthedocs.io +Project-URL: Source, https://github.com/psf/requests +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: charset-normalizer (<4,>=2) +Requires-Dist: idna (<4,>=2.5) +Requires-Dist: urllib3 (<3,>=1.21.1) +Requires-Dist: certifi (>=2017.4.17) +Provides-Extra: security +Provides-Extra: socks +Requires-Dist: PySocks (!=1.5.7,>=1.5.6) ; extra == 'socks' +Provides-Extra: use_chardet_on_py3 +Requires-Dist: chardet (<6,>=3.0.2) ; extra == 'use_chardet_on_py3' + +# Requests + +**Requests** is a simple, yet elegant, HTTP library. + +```python +>>> import requests +>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass')) +>>> r.status_code +200 +>>> r.headers['content-type'] +'application/json; charset=utf8' +>>> r.encoding +'utf-8' +>>> r.text +'{"authenticated": true, ...' +>>> r.json() +{'authenticated': True, ...} +``` + +Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your `PUT` & `POST` data — but nowadays, just use the `json` method! + +Requests is one of the most downloaded Python packages today, pulling in around `30M downloads / week`— according to GitHub, Requests is currently [depended upon](https://github.com/psf/requests/network/dependents?package_id=UGFja2FnZS01NzA4OTExNg%3D%3D) by `1,000,000+` repositories. You may certainly put your trust in this code. + +[![Downloads](https://pepy.tech/badge/requests/month)](https://pepy.tech/project/requests) +[![Supported Versions](https://img.shields.io/pypi/pyversions/requests.svg)](https://pypi.org/project/requests) +[![Contributors](https://img.shields.io/github/contributors/psf/requests.svg)](https://github.com/psf/requests/graphs/contributors) + +## Installing Requests and Supported Versions + +Requests is available on PyPI: + +```console +$ python -m pip install requests +``` + +Requests officially supports Python 3.7+. + +## Supported Features & Best–Practices + +Requests is ready for the demands of building robust and reliable HTTP–speaking applications, for the needs of today. + +- Keep-Alive & Connection Pooling +- International Domains and URLs +- Sessions with Cookie Persistence +- Browser-style TLS/SSL Verification +- Basic & Digest Authentication +- Familiar `dict`–like Cookies +- Automatic Content Decompression and Decoding +- Multi-part File Uploads +- SOCKS Proxy Support +- Connection Timeouts +- Streaming Downloads +- Automatic honoring of `.netrc` +- Chunked HTTP Requests + +## API Reference and User Guide available on [Read the Docs](https://requests.readthedocs.io) + +[![Read the Docs](https://raw.githubusercontent.com/psf/requests/main/ext/ss.png)](https://requests.readthedocs.io) + +## Cloning the repository + +When cloning the Requests repository, you may need to add the `-c +fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad commit (see +[this issue](https://github.com/psf/requests/issues/2690) for more background): + +```shell +git clone -c fetch.fsck.badTimezone=ignore https://github.com/psf/requests.git +``` + +You can also apply this setting to your global Git config: + +```shell +git config --global fetch.fsck.badTimezone ignore +``` + +--- + +[![Kenneth Reitz](https://raw.githubusercontent.com/psf/requests/main/ext/kr.png)](https://kennethreitz.org) [![Python Software Foundation](https://raw.githubusercontent.com/psf/requests/main/ext/psf.png)](https://www.python.org/psf) + + diff --git a/billinglayer/python/requests-2.31.0.dist-info/RECORD b/billinglayer/python/requests-2.31.0.dist-info/RECORD new file mode 100644 index 0000000..abb6ac6 --- /dev/null +++ b/billinglayer/python/requests-2.31.0.dist-info/RECORD @@ -0,0 +1,43 @@ +requests-2.31.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +requests-2.31.0.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142 +requests-2.31.0.dist-info/METADATA,sha256=eCPokOnbb0FROLrfl0R5EpDvdufsb9CaN4noJH__54I,4634 +requests-2.31.0.dist-info/RECORD,, +requests-2.31.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +requests-2.31.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92 +requests-2.31.0.dist-info/top_level.txt,sha256=fMSVmHfb5rbGOo6xv-O_tUX6j-WyixssE-SnwcDRxNQ,9 +requests/__init__.py,sha256=LvmKhjIz8mHaKXthC2Mv5ykZ1d92voyf3oJpd-VuAig,4963 +requests/__pycache__/__init__.cpython-311.pyc,, +requests/__pycache__/__version__.cpython-311.pyc,, +requests/__pycache__/_internal_utils.cpython-311.pyc,, +requests/__pycache__/adapters.cpython-311.pyc,, +requests/__pycache__/api.cpython-311.pyc,, +requests/__pycache__/auth.cpython-311.pyc,, +requests/__pycache__/certs.cpython-311.pyc,, +requests/__pycache__/compat.cpython-311.pyc,, +requests/__pycache__/cookies.cpython-311.pyc,, +requests/__pycache__/exceptions.cpython-311.pyc,, +requests/__pycache__/help.cpython-311.pyc,, +requests/__pycache__/hooks.cpython-311.pyc,, +requests/__pycache__/models.cpython-311.pyc,, +requests/__pycache__/packages.cpython-311.pyc,, +requests/__pycache__/sessions.cpython-311.pyc,, +requests/__pycache__/status_codes.cpython-311.pyc,, +requests/__pycache__/structures.cpython-311.pyc,, +requests/__pycache__/utils.cpython-311.pyc,, +requests/__version__.py,sha256=ssI3Ezt7PaxgkOW45GhtwPUclo_SO_ygtIm4A74IOfw,435 +requests/_internal_utils.py,sha256=nMQymr4hs32TqVo5AbCrmcJEhvPUh7xXlluyqwslLiQ,1495 +requests/adapters.py,sha256=v_FmjU5KZ76k-YttShZYB5RprIzhhL8Y3zgW9p4eBQ8,19553 +requests/api.py,sha256=q61xcXq4tmiImrvcSVLTbFyCiD2F-L_-hWKGbz4y8vg,6449 +requests/auth.py,sha256=h-HLlVx9j8rKV5hfSAycP2ApOSglTz77R0tz7qCbbEE,10187 +requests/certs.py,sha256=Z9Sb410Anv6jUFTyss0jFFhU6xst8ctELqfy8Ev23gw,429 +requests/compat.py,sha256=yxntVOSEHGMrn7FNr_32EEam1ZNAdPRdSE13_yaHzTk,1451 +requests/cookies.py,sha256=kD3kNEcCj-mxbtf5fJsSaT86eGoEYpD3X0CSgpzl7BM,18560 +requests/exceptions.py,sha256=DhveFBclVjTRxhRduVpO-GbMYMID2gmjdLfNEqNpI_U,3811 +requests/help.py,sha256=gPX5d_H7Xd88aDABejhqGgl9B1VFRTt5BmiYvL3PzIQ,3875 +requests/hooks.py,sha256=CiuysiHA39V5UfcCBXFIx83IrDpuwfN9RcTUgv28ftQ,733 +requests/models.py,sha256=-DlKi0or8gFAM6VzutobXvvBW_2wrJuOF5NfndTIddA,35223 +requests/packages.py,sha256=DXgv-FJIczZITmv0vEBAhWj4W-5CGCIN_ksvgR17Dvs,957 +requests/sessions.py,sha256=-LvTzrPtetSTrR3buxu4XhdgMrJFLB1q5D7P--L2Xhw,30373 +requests/status_codes.py,sha256=FvHmT5uH-_uimtRz5hH9VCbt7VV-Nei2J9upbej6j8g,4235 +requests/structures.py,sha256=-IbmhVz06S-5aPSZuUthZ6-6D9XOjRuTXHOabY041XM,2912 +requests/utils.py,sha256=6sx2X3cIVA8BgWOg8odxFy-_lbWDFETU8HI4fU4Rmqw,33448 diff --git a/billinglayer/python/requests-2.31.0.dist-info/REQUESTED b/billinglayer/python/requests-2.31.0.dist-info/REQUESTED new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/requests-2.31.0.dist-info/WHEEL b/billinglayer/python/requests-2.31.0.dist-info/WHEEL new file mode 100644 index 0000000..1f37c02 --- /dev/null +++ b/billinglayer/python/requests-2.31.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.40.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/billinglayer/python/requests-2.31.0.dist-info/top_level.txt b/billinglayer/python/requests-2.31.0.dist-info/top_level.txt new file mode 100644 index 0000000..f229360 --- /dev/null +++ b/billinglayer/python/requests-2.31.0.dist-info/top_level.txt @@ -0,0 +1 @@ +requests diff --git a/billinglayer/python/requests/__init__.py b/billinglayer/python/requests/__init__.py new file mode 100644 index 0000000..300a16c --- /dev/null +++ b/billinglayer/python/requests/__init__.py @@ -0,0 +1,180 @@ +# __ +# /__) _ _ _ _ _/ _ +# / ( (- (/ (/ (- _) / _) +# / + +""" +Requests HTTP Library +~~~~~~~~~~~~~~~~~~~~~ + +Requests is an HTTP library, written in Python, for human beings. +Basic GET usage: + + >>> import requests + >>> r = requests.get('https://www.python.org') + >>> r.status_code + 200 + >>> b'Python is a programming language' in r.content + True + +... or POST: + + >>> payload = dict(key1='value1', key2='value2') + >>> r = requests.post('https://httpbin.org/post', data=payload) + >>> print(r.text) + { + ... + "form": { + "key1": "value1", + "key2": "value2" + }, + ... + } + +The other HTTP methods are supported - see `requests.api`. Full documentation +is at . + +:copyright: (c) 2017 by Kenneth Reitz. +:license: Apache 2.0, see LICENSE for more details. +""" + +import warnings + +import urllib3 + +from .exceptions import RequestsDependencyWarning + +try: + from charset_normalizer import __version__ as charset_normalizer_version +except ImportError: + charset_normalizer_version = None + +try: + from chardet import __version__ as chardet_version +except ImportError: + chardet_version = None + + +def check_compatibility(urllib3_version, chardet_version, charset_normalizer_version): + urllib3_version = urllib3_version.split(".") + assert urllib3_version != ["dev"] # Verify urllib3 isn't installed from git. + + # Sometimes, urllib3 only reports its version as 16.1. + if len(urllib3_version) == 2: + urllib3_version.append("0") + + # Check urllib3 for compatibility. + major, minor, patch = urllib3_version # noqa: F811 + major, minor, patch = int(major), int(minor), int(patch) + # urllib3 >= 1.21.1 + assert major >= 1 + if major == 1: + assert minor >= 21 + + # Check charset_normalizer for compatibility. + if chardet_version: + major, minor, patch = chardet_version.split(".")[:3] + major, minor, patch = int(major), int(minor), int(patch) + # chardet_version >= 3.0.2, < 6.0.0 + assert (3, 0, 2) <= (major, minor, patch) < (6, 0, 0) + elif charset_normalizer_version: + major, minor, patch = charset_normalizer_version.split(".")[:3] + major, minor, patch = int(major), int(minor), int(patch) + # charset_normalizer >= 2.0.0 < 4.0.0 + assert (2, 0, 0) <= (major, minor, patch) < (4, 0, 0) + else: + raise Exception("You need either charset_normalizer or chardet installed") + + +def _check_cryptography(cryptography_version): + # cryptography < 1.3.4 + try: + cryptography_version = list(map(int, cryptography_version.split("."))) + except ValueError: + return + + if cryptography_version < [1, 3, 4]: + warning = "Old version of cryptography ({}) may cause slowdown.".format( + cryptography_version + ) + warnings.warn(warning, RequestsDependencyWarning) + + +# Check imported dependencies for compatibility. +try: + check_compatibility( + urllib3.__version__, chardet_version, charset_normalizer_version + ) +except (AssertionError, ValueError): + warnings.warn( + "urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " + "version!".format( + urllib3.__version__, chardet_version, charset_normalizer_version + ), + RequestsDependencyWarning, + ) + +# Attempt to enable urllib3's fallback for SNI support +# if the standard library doesn't support SNI or the +# 'ssl' library isn't available. +try: + try: + import ssl + except ImportError: + ssl = None + + if not getattr(ssl, "HAS_SNI", False): + from urllib3.contrib import pyopenssl + + pyopenssl.inject_into_urllib3() + + # Check cryptography version + from cryptography import __version__ as cryptography_version + + _check_cryptography(cryptography_version) +except ImportError: + pass + +# urllib3's DependencyWarnings should be silenced. +from urllib3.exceptions import DependencyWarning + +warnings.simplefilter("ignore", DependencyWarning) + +# Set default logging handler to avoid "No handler found" warnings. +import logging +from logging import NullHandler + +from . import packages, utils +from .__version__ import ( + __author__, + __author_email__, + __build__, + __cake__, + __copyright__, + __description__, + __license__, + __title__, + __url__, + __version__, +) +from .api import delete, get, head, options, patch, post, put, request +from .exceptions import ( + ConnectionError, + ConnectTimeout, + FileModeWarning, + HTTPError, + JSONDecodeError, + ReadTimeout, + RequestException, + Timeout, + TooManyRedirects, + URLRequired, +) +from .models import PreparedRequest, Request, Response +from .sessions import Session, session +from .status_codes import codes + +logging.getLogger(__name__).addHandler(NullHandler()) + +# FileModeWarnings go off per the default. +warnings.simplefilter("default", FileModeWarning, append=True) diff --git a/billinglayer/python/requests/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/requests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e541c98 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/__version__.cpython-311.pyc b/billinglayer/python/requests/__pycache__/__version__.cpython-311.pyc new file mode 100644 index 0000000..e0e072c Binary files /dev/null and b/billinglayer/python/requests/__pycache__/__version__.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/_internal_utils.cpython-311.pyc b/billinglayer/python/requests/__pycache__/_internal_utils.cpython-311.pyc new file mode 100644 index 0000000..8492ba0 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/_internal_utils.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/adapters.cpython-311.pyc b/billinglayer/python/requests/__pycache__/adapters.cpython-311.pyc new file mode 100644 index 0000000..b9bf20b Binary files /dev/null and b/billinglayer/python/requests/__pycache__/adapters.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/api.cpython-311.pyc b/billinglayer/python/requests/__pycache__/api.cpython-311.pyc new file mode 100644 index 0000000..fe789a7 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/api.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/auth.cpython-311.pyc b/billinglayer/python/requests/__pycache__/auth.cpython-311.pyc new file mode 100644 index 0000000..4097e67 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/auth.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/certs.cpython-311.pyc b/billinglayer/python/requests/__pycache__/certs.cpython-311.pyc new file mode 100644 index 0000000..13ffd8f Binary files /dev/null and b/billinglayer/python/requests/__pycache__/certs.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/compat.cpython-311.pyc b/billinglayer/python/requests/__pycache__/compat.cpython-311.pyc new file mode 100644 index 0000000..fe1bbb2 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/compat.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/cookies.cpython-311.pyc b/billinglayer/python/requests/__pycache__/cookies.cpython-311.pyc new file mode 100644 index 0000000..5d56ea1 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/cookies.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/exceptions.cpython-311.pyc b/billinglayer/python/requests/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..fc56679 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/exceptions.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/help.cpython-311.pyc b/billinglayer/python/requests/__pycache__/help.cpython-311.pyc new file mode 100644 index 0000000..f6e4071 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/help.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/hooks.cpython-311.pyc b/billinglayer/python/requests/__pycache__/hooks.cpython-311.pyc new file mode 100644 index 0000000..8c8e15e Binary files /dev/null and b/billinglayer/python/requests/__pycache__/hooks.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/models.cpython-311.pyc b/billinglayer/python/requests/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..1bfe1da Binary files /dev/null and b/billinglayer/python/requests/__pycache__/models.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/packages.cpython-311.pyc b/billinglayer/python/requests/__pycache__/packages.cpython-311.pyc new file mode 100644 index 0000000..c9d92d4 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/packages.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/sessions.cpython-311.pyc b/billinglayer/python/requests/__pycache__/sessions.cpython-311.pyc new file mode 100644 index 0000000..81b900b Binary files /dev/null and b/billinglayer/python/requests/__pycache__/sessions.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/status_codes.cpython-311.pyc b/billinglayer/python/requests/__pycache__/status_codes.cpython-311.pyc new file mode 100644 index 0000000..fd03f8a Binary files /dev/null and b/billinglayer/python/requests/__pycache__/status_codes.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/structures.cpython-311.pyc b/billinglayer/python/requests/__pycache__/structures.cpython-311.pyc new file mode 100644 index 0000000..846abbe Binary files /dev/null and b/billinglayer/python/requests/__pycache__/structures.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__pycache__/utils.cpython-311.pyc b/billinglayer/python/requests/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..4178568 Binary files /dev/null and b/billinglayer/python/requests/__pycache__/utils.cpython-311.pyc differ diff --git a/billinglayer/python/requests/__version__.py b/billinglayer/python/requests/__version__.py new file mode 100644 index 0000000..5063c3f --- /dev/null +++ b/billinglayer/python/requests/__version__.py @@ -0,0 +1,14 @@ +# .-. .-. .-. . . .-. .-. .-. .-. +# |( |- |.| | | |- `-. | `-. +# ' ' `-' `-`.`-' `-' `-' ' `-' + +__title__ = "requests" +__description__ = "Python HTTP for Humans." +__url__ = "https://requests.readthedocs.io" +__version__ = "2.31.0" +__build__ = 0x023100 +__author__ = "Kenneth Reitz" +__author_email__ = "me@kennethreitz.org" +__license__ = "Apache 2.0" +__copyright__ = "Copyright Kenneth Reitz" +__cake__ = "\u2728 \U0001f370 \u2728" diff --git a/billinglayer/python/requests/_internal_utils.py b/billinglayer/python/requests/_internal_utils.py new file mode 100644 index 0000000..f2cf635 --- /dev/null +++ b/billinglayer/python/requests/_internal_utils.py @@ -0,0 +1,50 @@ +""" +requests._internal_utils +~~~~~~~~~~~~~~ + +Provides utility functions that are consumed internally by Requests +which depend on extremely few external helpers (such as compat) +""" +import re + +from .compat import builtin_str + +_VALID_HEADER_NAME_RE_BYTE = re.compile(rb"^[^:\s][^:\r\n]*$") +_VALID_HEADER_NAME_RE_STR = re.compile(r"^[^:\s][^:\r\n]*$") +_VALID_HEADER_VALUE_RE_BYTE = re.compile(rb"^\S[^\r\n]*$|^$") +_VALID_HEADER_VALUE_RE_STR = re.compile(r"^\S[^\r\n]*$|^$") + +_HEADER_VALIDATORS_STR = (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR) +_HEADER_VALIDATORS_BYTE = (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE) +HEADER_VALIDATORS = { + bytes: _HEADER_VALIDATORS_BYTE, + str: _HEADER_VALIDATORS_STR, +} + + +def to_native_string(string, encoding="ascii"): + """Given a string object, regardless of type, returns a representation of + that string in the native string type, encoding and decoding where + necessary. This assumes ASCII unless told otherwise. + """ + if isinstance(string, builtin_str): + out = string + else: + out = string.decode(encoding) + + return out + + +def unicode_is_ascii(u_string): + """Determine if unicode string only contains ASCII characters. + + :param str u_string: unicode string to check. Must be unicode + and not Python 2 `str`. + :rtype: bool + """ + assert isinstance(u_string, str) + try: + u_string.encode("ascii") + return True + except UnicodeEncodeError: + return False diff --git a/billinglayer/python/requests/adapters.py b/billinglayer/python/requests/adapters.py new file mode 100644 index 0000000..78e3bb6 --- /dev/null +++ b/billinglayer/python/requests/adapters.py @@ -0,0 +1,538 @@ +""" +requests.adapters +~~~~~~~~~~~~~~~~~ + +This module contains the transport adapters that Requests uses to define +and maintain connections. +""" + +import os.path +import socket # noqa: F401 + +from urllib3.exceptions import ClosedPoolError, ConnectTimeoutError +from urllib3.exceptions import HTTPError as _HTTPError +from urllib3.exceptions import InvalidHeader as _InvalidHeader +from urllib3.exceptions import ( + LocationValueError, + MaxRetryError, + NewConnectionError, + ProtocolError, +) +from urllib3.exceptions import ProxyError as _ProxyError +from urllib3.exceptions import ReadTimeoutError, ResponseError +from urllib3.exceptions import SSLError as _SSLError +from urllib3.poolmanager import PoolManager, proxy_from_url +from urllib3.util import Timeout as TimeoutSauce +from urllib3.util import parse_url +from urllib3.util.retry import Retry + +from .auth import _basic_auth_str +from .compat import basestring, urlparse +from .cookies import extract_cookies_to_jar +from .exceptions import ( + ConnectionError, + ConnectTimeout, + InvalidHeader, + InvalidProxyURL, + InvalidSchema, + InvalidURL, + ProxyError, + ReadTimeout, + RetryError, + SSLError, +) +from .models import Response +from .structures import CaseInsensitiveDict +from .utils import ( + DEFAULT_CA_BUNDLE_PATH, + extract_zipped_paths, + get_auth_from_url, + get_encoding_from_headers, + prepend_scheme_if_needed, + select_proxy, + urldefragauth, +) + +try: + from urllib3.contrib.socks import SOCKSProxyManager +except ImportError: + + def SOCKSProxyManager(*args, **kwargs): + raise InvalidSchema("Missing dependencies for SOCKS support.") + + +DEFAULT_POOLBLOCK = False +DEFAULT_POOLSIZE = 10 +DEFAULT_RETRIES = 0 +DEFAULT_POOL_TIMEOUT = None + + +class BaseAdapter: + """The Base Transport Adapter""" + + def __init__(self): + super().__init__() + + def send( + self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None + ): + """Sends PreparedRequest object. Returns Response object. + + :param request: The :class:`PreparedRequest ` being sent. + :param stream: (optional) Whether to stream the request content. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use + :param cert: (optional) Any user-provided SSL certificate to be trusted. + :param proxies: (optional) The proxies dictionary to apply to the request. + """ + raise NotImplementedError + + def close(self): + """Cleans up adapter specific items.""" + raise NotImplementedError + + +class HTTPAdapter(BaseAdapter): + """The built-in HTTP Adapter for urllib3. + + Provides a general-case interface for Requests sessions to contact HTTP and + HTTPS urls by implementing the Transport Adapter interface. This class will + usually be created by the :class:`Session ` class under the + covers. + + :param pool_connections: The number of urllib3 connection pools to cache. + :param pool_maxsize: The maximum number of connections to save in the pool. + :param max_retries: The maximum number of retries each connection + should attempt. Note, this applies only to failed DNS lookups, socket + connections and connection timeouts, never to requests where data has + made it to the server. By default, Requests does not retry failed + connections. If you need granular control over the conditions under + which we retry a request, import urllib3's ``Retry`` class and pass + that instead. + :param pool_block: Whether the connection pool should block for connections. + + Usage:: + + >>> import requests + >>> s = requests.Session() + >>> a = requests.adapters.HTTPAdapter(max_retries=3) + >>> s.mount('http://', a) + """ + + __attrs__ = [ + "max_retries", + "config", + "_pool_connections", + "_pool_maxsize", + "_pool_block", + ] + + def __init__( + self, + pool_connections=DEFAULT_POOLSIZE, + pool_maxsize=DEFAULT_POOLSIZE, + max_retries=DEFAULT_RETRIES, + pool_block=DEFAULT_POOLBLOCK, + ): + if max_retries == DEFAULT_RETRIES: + self.max_retries = Retry(0, read=False) + else: + self.max_retries = Retry.from_int(max_retries) + self.config = {} + self.proxy_manager = {} + + super().__init__() + + self._pool_connections = pool_connections + self._pool_maxsize = pool_maxsize + self._pool_block = pool_block + + self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block) + + def __getstate__(self): + return {attr: getattr(self, attr, None) for attr in self.__attrs__} + + def __setstate__(self, state): + # Can't handle by adding 'proxy_manager' to self.__attrs__ because + # self.poolmanager uses a lambda function, which isn't pickleable. + self.proxy_manager = {} + self.config = {} + + for attr, value in state.items(): + setattr(self, attr, value) + + self.init_poolmanager( + self._pool_connections, self._pool_maxsize, block=self._pool_block + ) + + def init_poolmanager( + self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs + ): + """Initializes a urllib3 PoolManager. + + This method should not be called from user code, and is only + exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param connections: The number of urllib3 connection pools to cache. + :param maxsize: The maximum number of connections to save in the pool. + :param block: Block when no free connections are available. + :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. + """ + # save these values for pickling + self._pool_connections = connections + self._pool_maxsize = maxsize + self._pool_block = block + + self.poolmanager = PoolManager( + num_pools=connections, + maxsize=maxsize, + block=block, + **pool_kwargs, + ) + + def proxy_manager_for(self, proxy, **proxy_kwargs): + """Return urllib3 ProxyManager for the given proxy. + + This method should not be called from user code, and is only + exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param proxy: The proxy to return a urllib3 ProxyManager for. + :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. + :returns: ProxyManager + :rtype: urllib3.ProxyManager + """ + if proxy in self.proxy_manager: + manager = self.proxy_manager[proxy] + elif proxy.lower().startswith("socks"): + username, password = get_auth_from_url(proxy) + manager = self.proxy_manager[proxy] = SOCKSProxyManager( + proxy, + username=username, + password=password, + num_pools=self._pool_connections, + maxsize=self._pool_maxsize, + block=self._pool_block, + **proxy_kwargs, + ) + else: + proxy_headers = self.proxy_headers(proxy) + manager = self.proxy_manager[proxy] = proxy_from_url( + proxy, + proxy_headers=proxy_headers, + num_pools=self._pool_connections, + maxsize=self._pool_maxsize, + block=self._pool_block, + **proxy_kwargs, + ) + + return manager + + def cert_verify(self, conn, url, verify, cert): + """Verify a SSL certificate. This method should not be called from user + code, and is only exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param conn: The urllib3 connection object associated with the cert. + :param url: The requested URL. + :param verify: Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use + :param cert: The SSL certificate to verify. + """ + if url.lower().startswith("https") and verify: + + cert_loc = None + + # Allow self-specified cert location. + if verify is not True: + cert_loc = verify + + if not cert_loc: + cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH) + + if not cert_loc or not os.path.exists(cert_loc): + raise OSError( + f"Could not find a suitable TLS CA certificate bundle, " + f"invalid path: {cert_loc}" + ) + + conn.cert_reqs = "CERT_REQUIRED" + + if not os.path.isdir(cert_loc): + conn.ca_certs = cert_loc + else: + conn.ca_cert_dir = cert_loc + else: + conn.cert_reqs = "CERT_NONE" + conn.ca_certs = None + conn.ca_cert_dir = None + + if cert: + if not isinstance(cert, basestring): + conn.cert_file = cert[0] + conn.key_file = cert[1] + else: + conn.cert_file = cert + conn.key_file = None + if conn.cert_file and not os.path.exists(conn.cert_file): + raise OSError( + f"Could not find the TLS certificate file, " + f"invalid path: {conn.cert_file}" + ) + if conn.key_file and not os.path.exists(conn.key_file): + raise OSError( + f"Could not find the TLS key file, invalid path: {conn.key_file}" + ) + + def build_response(self, req, resp): + """Builds a :class:`Response ` object from a urllib3 + response. This should not be called from user code, and is only exposed + for use when subclassing the + :class:`HTTPAdapter ` + + :param req: The :class:`PreparedRequest ` used to generate the response. + :param resp: The urllib3 response object. + :rtype: requests.Response + """ + response = Response() + + # Fallback to None if there's no status_code, for whatever reason. + response.status_code = getattr(resp, "status", None) + + # Make headers case-insensitive. + response.headers = CaseInsensitiveDict(getattr(resp, "headers", {})) + + # Set encoding. + response.encoding = get_encoding_from_headers(response.headers) + response.raw = resp + response.reason = response.raw.reason + + if isinstance(req.url, bytes): + response.url = req.url.decode("utf-8") + else: + response.url = req.url + + # Add new cookies from the server. + extract_cookies_to_jar(response.cookies, req, resp) + + # Give the Response some context. + response.request = req + response.connection = self + + return response + + def get_connection(self, url, proxies=None): + """Returns a urllib3 connection for the given URL. This should not be + called from user code, and is only exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param url: The URL to connect to. + :param proxies: (optional) A Requests-style dictionary of proxies used on this request. + :rtype: urllib3.ConnectionPool + """ + proxy = select_proxy(url, proxies) + + if proxy: + proxy = prepend_scheme_if_needed(proxy, "http") + proxy_url = parse_url(proxy) + if not proxy_url.host: + raise InvalidProxyURL( + "Please check proxy URL. It is malformed " + "and could be missing the host." + ) + proxy_manager = self.proxy_manager_for(proxy) + conn = proxy_manager.connection_from_url(url) + else: + # Only scheme should be lower case + parsed = urlparse(url) + url = parsed.geturl() + conn = self.poolmanager.connection_from_url(url) + + return conn + + def close(self): + """Disposes of any internal state. + + Currently, this closes the PoolManager and any active ProxyManager, + which closes any pooled connections. + """ + self.poolmanager.clear() + for proxy in self.proxy_manager.values(): + proxy.clear() + + def request_url(self, request, proxies): + """Obtain the url to use when making the final request. + + If the message is being sent through a HTTP proxy, the full URL has to + be used. Otherwise, we should only use the path portion of the URL. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param request: The :class:`PreparedRequest ` being sent. + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. + :rtype: str + """ + proxy = select_proxy(request.url, proxies) + scheme = urlparse(request.url).scheme + + is_proxied_http_request = proxy and scheme != "https" + using_socks_proxy = False + if proxy: + proxy_scheme = urlparse(proxy).scheme.lower() + using_socks_proxy = proxy_scheme.startswith("socks") + + url = request.path_url + if is_proxied_http_request and not using_socks_proxy: + url = urldefragauth(request.url) + + return url + + def add_headers(self, request, **kwargs): + """Add any headers needed by the connection. As of v2.0 this does + nothing by default, but is left for overriding by users that subclass + the :class:`HTTPAdapter `. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param request: The :class:`PreparedRequest ` to add headers to. + :param kwargs: The keyword arguments from the call to send(). + """ + pass + + def proxy_headers(self, proxy): + """Returns a dictionary of the headers to add to any request sent + through a proxy. This works with urllib3 magic to ensure that they are + correctly sent to the proxy, rather than in a tunnelled request if + CONNECT is being used. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param proxy: The url of the proxy being used for this request. + :rtype: dict + """ + headers = {} + username, password = get_auth_from_url(proxy) + + if username: + headers["Proxy-Authorization"] = _basic_auth_str(username, password) + + return headers + + def send( + self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None + ): + """Sends PreparedRequest object. Returns Response object. + + :param request: The :class:`PreparedRequest ` being sent. + :param stream: (optional) Whether to stream the request content. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple or urllib3 Timeout object + :param verify: (optional) Either a boolean, in which case it controls whether + we verify the server's TLS certificate, or a string, in which case it + must be a path to a CA bundle to use + :param cert: (optional) Any user-provided SSL certificate to be trusted. + :param proxies: (optional) The proxies dictionary to apply to the request. + :rtype: requests.Response + """ + + try: + conn = self.get_connection(request.url, proxies) + except LocationValueError as e: + raise InvalidURL(e, request=request) + + self.cert_verify(conn, request.url, verify, cert) + url = self.request_url(request, proxies) + self.add_headers( + request, + stream=stream, + timeout=timeout, + verify=verify, + cert=cert, + proxies=proxies, + ) + + chunked = not (request.body is None or "Content-Length" in request.headers) + + if isinstance(timeout, tuple): + try: + connect, read = timeout + timeout = TimeoutSauce(connect=connect, read=read) + except ValueError: + raise ValueError( + f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " + f"or a single float to set both timeouts to the same value." + ) + elif isinstance(timeout, TimeoutSauce): + pass + else: + timeout = TimeoutSauce(connect=timeout, read=timeout) + + try: + resp = conn.urlopen( + method=request.method, + url=url, + body=request.body, + headers=request.headers, + redirect=False, + assert_same_host=False, + preload_content=False, + decode_content=False, + retries=self.max_retries, + timeout=timeout, + chunked=chunked, + ) + + except (ProtocolError, OSError) as err: + raise ConnectionError(err, request=request) + + except MaxRetryError as e: + if isinstance(e.reason, ConnectTimeoutError): + # TODO: Remove this in 3.0.0: see #2811 + if not isinstance(e.reason, NewConnectionError): + raise ConnectTimeout(e, request=request) + + if isinstance(e.reason, ResponseError): + raise RetryError(e, request=request) + + if isinstance(e.reason, _ProxyError): + raise ProxyError(e, request=request) + + if isinstance(e.reason, _SSLError): + # This branch is for urllib3 v1.22 and later. + raise SSLError(e, request=request) + + raise ConnectionError(e, request=request) + + except ClosedPoolError as e: + raise ConnectionError(e, request=request) + + except _ProxyError as e: + raise ProxyError(e) + + except (_SSLError, _HTTPError) as e: + if isinstance(e, _SSLError): + # This branch is for urllib3 versions earlier than v1.22 + raise SSLError(e, request=request) + elif isinstance(e, ReadTimeoutError): + raise ReadTimeout(e, request=request) + elif isinstance(e, _InvalidHeader): + raise InvalidHeader(e, request=request) + else: + raise + + return self.build_response(request, resp) diff --git a/billinglayer/python/requests/api.py b/billinglayer/python/requests/api.py new file mode 100644 index 0000000..cd0b3ee --- /dev/null +++ b/billinglayer/python/requests/api.py @@ -0,0 +1,157 @@ +""" +requests.api +~~~~~~~~~~~~ + +This module implements the Requests API. + +:copyright: (c) 2012 by Kenneth Reitz. +:license: Apache2, see LICENSE for more details. +""" + +from . import sessions + + +def request(method, url, **kwargs): + """Constructs and sends a :class:`Request `. + + :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the query string for the :class:`Request`. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. + :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. + :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. + ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` + or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string + defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers + to add for the file. + :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. + :param timeout: (optional) How many seconds to wait for the server to send data + before giving up, as a float, or a :ref:`(connect timeout, read + timeout) ` tuple. + :type timeout: float or tuple + :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. + :type allow_redirects: bool + :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use. Defaults to ``True``. + :param stream: (optional) if ``False``, the response content will be immediately downloaded. + :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. + :return: :class:`Response ` object + :rtype: requests.Response + + Usage:: + + >>> import requests + >>> req = requests.request('GET', 'https://httpbin.org/get') + >>> req + + """ + + # By using the 'with' statement we are sure the session is closed, thus we + # avoid leaving sockets open which can trigger a ResourceWarning in some + # cases, and look like a memory leak in others. + with sessions.Session() as session: + return session.request(method=method, url=url, **kwargs) + + +def get(url, params=None, **kwargs): + r"""Sends a GET request. + + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the query string for the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("get", url, params=params, **kwargs) + + +def options(url, **kwargs): + r"""Sends an OPTIONS request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("options", url, **kwargs) + + +def head(url, **kwargs): + r"""Sends a HEAD request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. If + `allow_redirects` is not provided, it will be set to `False` (as + opposed to the default :meth:`request` behavior). + :return: :class:`Response ` object + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", False) + return request("head", url, **kwargs) + + +def post(url, data=None, json=None, **kwargs): + r"""Sends a POST request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("post", url, data=data, json=json, **kwargs) + + +def put(url, data=None, **kwargs): + r"""Sends a PUT request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("put", url, data=data, **kwargs) + + +def patch(url, data=None, **kwargs): + r"""Sends a PATCH request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("patch", url, data=data, **kwargs) + + +def delete(url, **kwargs): + r"""Sends a DELETE request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("delete", url, **kwargs) diff --git a/billinglayer/python/requests/auth.py b/billinglayer/python/requests/auth.py new file mode 100644 index 0000000..9733686 --- /dev/null +++ b/billinglayer/python/requests/auth.py @@ -0,0 +1,315 @@ +""" +requests.auth +~~~~~~~~~~~~~ + +This module contains the authentication handlers for Requests. +""" + +import hashlib +import os +import re +import threading +import time +import warnings +from base64 import b64encode + +from ._internal_utils import to_native_string +from .compat import basestring, str, urlparse +from .cookies import extract_cookies_to_jar +from .utils import parse_dict_header + +CONTENT_TYPE_FORM_URLENCODED = "application/x-www-form-urlencoded" +CONTENT_TYPE_MULTI_PART = "multipart/form-data" + + +def _basic_auth_str(username, password): + """Returns a Basic Auth string.""" + + # "I want us to put a big-ol' comment on top of it that + # says that this behaviour is dumb but we need to preserve + # it because people are relying on it." + # - Lukasa + # + # These are here solely to maintain backwards compatibility + # for things like ints. This will be removed in 3.0.0. + if not isinstance(username, basestring): + warnings.warn( + "Non-string usernames will no longer be supported in Requests " + "3.0.0. Please convert the object you've passed in ({!r}) to " + "a string or bytes object in the near future to avoid " + "problems.".format(username), + category=DeprecationWarning, + ) + username = str(username) + + if not isinstance(password, basestring): + warnings.warn( + "Non-string passwords will no longer be supported in Requests " + "3.0.0. Please convert the object you've passed in ({!r}) to " + "a string or bytes object in the near future to avoid " + "problems.".format(type(password)), + category=DeprecationWarning, + ) + password = str(password) + # -- End Removal -- + + if isinstance(username, str): + username = username.encode("latin1") + + if isinstance(password, str): + password = password.encode("latin1") + + authstr = "Basic " + to_native_string( + b64encode(b":".join((username, password))).strip() + ) + + return authstr + + +class AuthBase: + """Base class that all auth implementations derive from""" + + def __call__(self, r): + raise NotImplementedError("Auth hooks must be callable.") + + +class HTTPBasicAuth(AuthBase): + """Attaches HTTP Basic Authentication to the given Request object.""" + + def __init__(self, username, password): + self.username = username + self.password = password + + def __eq__(self, other): + return all( + [ + self.username == getattr(other, "username", None), + self.password == getattr(other, "password", None), + ] + ) + + def __ne__(self, other): + return not self == other + + def __call__(self, r): + r.headers["Authorization"] = _basic_auth_str(self.username, self.password) + return r + + +class HTTPProxyAuth(HTTPBasicAuth): + """Attaches HTTP Proxy Authentication to a given Request object.""" + + def __call__(self, r): + r.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) + return r + + +class HTTPDigestAuth(AuthBase): + """Attaches HTTP Digest Authentication to the given Request object.""" + + def __init__(self, username, password): + self.username = username + self.password = password + # Keep state in per-thread local storage + self._thread_local = threading.local() + + def init_per_thread_state(self): + # Ensure state is initialized just once per-thread + if not hasattr(self._thread_local, "init"): + self._thread_local.init = True + self._thread_local.last_nonce = "" + self._thread_local.nonce_count = 0 + self._thread_local.chal = {} + self._thread_local.pos = None + self._thread_local.num_401_calls = None + + def build_digest_header(self, method, url): + """ + :rtype: str + """ + + realm = self._thread_local.chal["realm"] + nonce = self._thread_local.chal["nonce"] + qop = self._thread_local.chal.get("qop") + algorithm = self._thread_local.chal.get("algorithm") + opaque = self._thread_local.chal.get("opaque") + hash_utf8 = None + + if algorithm is None: + _algorithm = "MD5" + else: + _algorithm = algorithm.upper() + # lambdas assume digest modules are imported at the top level + if _algorithm == "MD5" or _algorithm == "MD5-SESS": + + def md5_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.md5(x).hexdigest() + + hash_utf8 = md5_utf8 + elif _algorithm == "SHA": + + def sha_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha1(x).hexdigest() + + hash_utf8 = sha_utf8 + elif _algorithm == "SHA-256": + + def sha256_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha256(x).hexdigest() + + hash_utf8 = sha256_utf8 + elif _algorithm == "SHA-512": + + def sha512_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha512(x).hexdigest() + + hash_utf8 = sha512_utf8 + + KD = lambda s, d: hash_utf8(f"{s}:{d}") # noqa:E731 + + if hash_utf8 is None: + return None + + # XXX not implemented yet + entdig = None + p_parsed = urlparse(url) + #: path is request-uri defined in RFC 2616 which should not be empty + path = p_parsed.path or "/" + if p_parsed.query: + path += f"?{p_parsed.query}" + + A1 = f"{self.username}:{realm}:{self.password}" + A2 = f"{method}:{path}" + + HA1 = hash_utf8(A1) + HA2 = hash_utf8(A2) + + if nonce == self._thread_local.last_nonce: + self._thread_local.nonce_count += 1 + else: + self._thread_local.nonce_count = 1 + ncvalue = f"{self._thread_local.nonce_count:08x}" + s = str(self._thread_local.nonce_count).encode("utf-8") + s += nonce.encode("utf-8") + s += time.ctime().encode("utf-8") + s += os.urandom(8) + + cnonce = hashlib.sha1(s).hexdigest()[:16] + if _algorithm == "MD5-SESS": + HA1 = hash_utf8(f"{HA1}:{nonce}:{cnonce}") + + if not qop: + respdig = KD(HA1, f"{nonce}:{HA2}") + elif qop == "auth" or "auth" in qop.split(","): + noncebit = f"{nonce}:{ncvalue}:{cnonce}:auth:{HA2}" + respdig = KD(HA1, noncebit) + else: + # XXX handle auth-int. + return None + + self._thread_local.last_nonce = nonce + + # XXX should the partial digests be encoded too? + base = ( + f'username="{self.username}", realm="{realm}", nonce="{nonce}", ' + f'uri="{path}", response="{respdig}"' + ) + if opaque: + base += f', opaque="{opaque}"' + if algorithm: + base += f', algorithm="{algorithm}"' + if entdig: + base += f', digest="{entdig}"' + if qop: + base += f', qop="auth", nc={ncvalue}, cnonce="{cnonce}"' + + return f"Digest {base}" + + def handle_redirect(self, r, **kwargs): + """Reset num_401_calls counter on redirects.""" + if r.is_redirect: + self._thread_local.num_401_calls = 1 + + def handle_401(self, r, **kwargs): + """ + Takes the given response and tries digest-auth, if needed. + + :rtype: requests.Response + """ + + # If response is not 4xx, do not auth + # See https://github.com/psf/requests/issues/3772 + if not 400 <= r.status_code < 500: + self._thread_local.num_401_calls = 1 + return r + + if self._thread_local.pos is not None: + # Rewind the file position indicator of the body to where + # it was to resend the request. + r.request.body.seek(self._thread_local.pos) + s_auth = r.headers.get("www-authenticate", "") + + if "digest" in s_auth.lower() and self._thread_local.num_401_calls < 2: + + self._thread_local.num_401_calls += 1 + pat = re.compile(r"digest ", flags=re.IGNORECASE) + self._thread_local.chal = parse_dict_header(pat.sub("", s_auth, count=1)) + + # Consume content and release the original connection + # to allow our new request to reuse the same one. + r.content + r.close() + prep = r.request.copy() + extract_cookies_to_jar(prep._cookies, r.request, r.raw) + prep.prepare_cookies(prep._cookies) + + prep.headers["Authorization"] = self.build_digest_header( + prep.method, prep.url + ) + _r = r.connection.send(prep, **kwargs) + _r.history.append(r) + _r.request = prep + + return _r + + self._thread_local.num_401_calls = 1 + return r + + def __call__(self, r): + # Initialize per-thread state, if needed + self.init_per_thread_state() + # If we have a saved nonce, skip the 401 + if self._thread_local.last_nonce: + r.headers["Authorization"] = self.build_digest_header(r.method, r.url) + try: + self._thread_local.pos = r.body.tell() + except AttributeError: + # In the case of HTTPDigestAuth being reused and the body of + # the previous request was a file-like object, pos has the + # file position of the previous body. Ensure it's set to + # None. + self._thread_local.pos = None + r.register_hook("response", self.handle_401) + r.register_hook("response", self.handle_redirect) + self._thread_local.num_401_calls = 1 + + return r + + def __eq__(self, other): + return all( + [ + self.username == getattr(other, "username", None), + self.password == getattr(other, "password", None), + ] + ) + + def __ne__(self, other): + return not self == other diff --git a/billinglayer/python/requests/certs.py b/billinglayer/python/requests/certs.py new file mode 100644 index 0000000..be422c3 --- /dev/null +++ b/billinglayer/python/requests/certs.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +""" +requests.certs +~~~~~~~~~~~~~~ + +This module returns the preferred default CA certificate bundle. There is +only one — the one from the certifi package. + +If you are packaging Requests, e.g., for a Linux distribution or a managed +environment, you can change the definition of where() to return a separately +packaged CA bundle. +""" +from certifi import where + +if __name__ == "__main__": + print(where()) diff --git a/billinglayer/python/requests/compat.py b/billinglayer/python/requests/compat.py new file mode 100644 index 0000000..6776163 --- /dev/null +++ b/billinglayer/python/requests/compat.py @@ -0,0 +1,79 @@ +""" +requests.compat +~~~~~~~~~~~~~~~ + +This module previously handled import compatibility issues +between Python 2 and Python 3. It remains for backwards +compatibility until the next major version. +""" + +try: + import chardet +except ImportError: + import charset_normalizer as chardet + +import sys + +# ------- +# Pythons +# ------- + +# Syntax sugar. +_ver = sys.version_info + +#: Python 2.x? +is_py2 = _ver[0] == 2 + +#: Python 3.x? +is_py3 = _ver[0] == 3 + +# json/simplejson module import resolution +has_simplejson = False +try: + import simplejson as json + + has_simplejson = True +except ImportError: + import json + +if has_simplejson: + from simplejson import JSONDecodeError +else: + from json import JSONDecodeError + +# Keep OrderedDict for backwards compatibility. +from collections import OrderedDict +from collections.abc import Callable, Mapping, MutableMapping +from http import cookiejar as cookielib +from http.cookies import Morsel +from io import StringIO + +# -------------- +# Legacy Imports +# -------------- +from urllib.parse import ( + quote, + quote_plus, + unquote, + unquote_plus, + urldefrag, + urlencode, + urljoin, + urlparse, + urlsplit, + urlunparse, +) +from urllib.request import ( + getproxies, + getproxies_environment, + parse_http_list, + proxy_bypass, + proxy_bypass_environment, +) + +builtin_str = str +str = str +bytes = bytes +basestring = (str, bytes) +numeric_types = (int, float) +integer_types = (int,) diff --git a/billinglayer/python/requests/cookies.py b/billinglayer/python/requests/cookies.py new file mode 100644 index 0000000..bf54ab2 --- /dev/null +++ b/billinglayer/python/requests/cookies.py @@ -0,0 +1,561 @@ +""" +requests.cookies +~~~~~~~~~~~~~~~~ + +Compatibility code to be able to use `cookielib.CookieJar` with requests. + +requests.utils imports from here, so be careful with imports. +""" + +import calendar +import copy +import time + +from ._internal_utils import to_native_string +from .compat import Morsel, MutableMapping, cookielib, urlparse, urlunparse + +try: + import threading +except ImportError: + import dummy_threading as threading + + +class MockRequest: + """Wraps a `requests.Request` to mimic a `urllib2.Request`. + + The code in `cookielib.CookieJar` expects this interface in order to correctly + manage cookie policies, i.e., determine whether a cookie can be set, given the + domains of the request and the cookie. + + The original request object is read-only. The client is responsible for collecting + the new headers via `get_new_headers()` and interpreting them appropriately. You + probably want `get_cookie_header`, defined below. + """ + + def __init__(self, request): + self._r = request + self._new_headers = {} + self.type = urlparse(self._r.url).scheme + + def get_type(self): + return self.type + + def get_host(self): + return urlparse(self._r.url).netloc + + def get_origin_req_host(self): + return self.get_host() + + def get_full_url(self): + # Only return the response's URL if the user hadn't set the Host + # header + if not self._r.headers.get("Host"): + return self._r.url + # If they did set it, retrieve it and reconstruct the expected domain + host = to_native_string(self._r.headers["Host"], encoding="utf-8") + parsed = urlparse(self._r.url) + # Reconstruct the URL as we expect it + return urlunparse( + [ + parsed.scheme, + host, + parsed.path, + parsed.params, + parsed.query, + parsed.fragment, + ] + ) + + def is_unverifiable(self): + return True + + def has_header(self, name): + return name in self._r.headers or name in self._new_headers + + def get_header(self, name, default=None): + return self._r.headers.get(name, self._new_headers.get(name, default)) + + def add_header(self, key, val): + """cookielib has no legitimate use for this method; add it back if you find one.""" + raise NotImplementedError( + "Cookie headers should be added with add_unredirected_header()" + ) + + def add_unredirected_header(self, name, value): + self._new_headers[name] = value + + def get_new_headers(self): + return self._new_headers + + @property + def unverifiable(self): + return self.is_unverifiable() + + @property + def origin_req_host(self): + return self.get_origin_req_host() + + @property + def host(self): + return self.get_host() + + +class MockResponse: + """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. + + ...what? Basically, expose the parsed HTTP headers from the server response + the way `cookielib` expects to see them. + """ + + def __init__(self, headers): + """Make a MockResponse for `cookielib` to read. + + :param headers: a httplib.HTTPMessage or analogous carrying the headers + """ + self._headers = headers + + def info(self): + return self._headers + + def getheaders(self, name): + self._headers.getheaders(name) + + +def extract_cookies_to_jar(jar, request, response): + """Extract the cookies from the response into a CookieJar. + + :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) + :param request: our own requests.Request object + :param response: urllib3.HTTPResponse object + """ + if not (hasattr(response, "_original_response") and response._original_response): + return + # the _original_response field is the wrapped httplib.HTTPResponse object, + req = MockRequest(request) + # pull out the HTTPMessage with the headers and put it in the mock: + res = MockResponse(response._original_response.msg) + jar.extract_cookies(res, req) + + +def get_cookie_header(jar, request): + """ + Produce an appropriate Cookie header string to be sent with `request`, or None. + + :rtype: str + """ + r = MockRequest(request) + jar.add_cookie_header(r) + return r.get_new_headers().get("Cookie") + + +def remove_cookie_by_name(cookiejar, name, domain=None, path=None): + """Unsets a cookie by name, by default over all domains and paths. + + Wraps CookieJar.clear(), is O(n). + """ + clearables = [] + for cookie in cookiejar: + if cookie.name != name: + continue + if domain is not None and domain != cookie.domain: + continue + if path is not None and path != cookie.path: + continue + clearables.append((cookie.domain, cookie.path, cookie.name)) + + for domain, path, name in clearables: + cookiejar.clear(domain, path, name) + + +class CookieConflictError(RuntimeError): + """There are two cookies that meet the criteria specified in the cookie jar. + Use .get and .set and include domain and path args in order to be more specific. + """ + + +class RequestsCookieJar(cookielib.CookieJar, MutableMapping): + """Compatibility class; is a cookielib.CookieJar, but exposes a dict + interface. + + This is the CookieJar we create by default for requests and sessions that + don't specify one, since some clients may expect response.cookies and + session.cookies to support dict operations. + + Requests does not use the dict interface internally; it's just for + compatibility with external client code. All requests code should work + out of the box with externally provided instances of ``CookieJar``, e.g. + ``LWPCookieJar`` and ``FileCookieJar``. + + Unlike a regular CookieJar, this class is pickleable. + + .. warning:: dictionary operations that are normally O(1) may be O(n). + """ + + def get(self, name, default=None, domain=None, path=None): + """Dict-like get() that also supports optional domain and path args in + order to resolve naming collisions from using one cookie jar over + multiple domains. + + .. warning:: operation is O(n), not O(1). + """ + try: + return self._find_no_duplicates(name, domain, path) + except KeyError: + return default + + def set(self, name, value, **kwargs): + """Dict-like set() that also supports optional domain and path args in + order to resolve naming collisions from using one cookie jar over + multiple domains. + """ + # support client code that unsets cookies by assignment of a None value: + if value is None: + remove_cookie_by_name( + self, name, domain=kwargs.get("domain"), path=kwargs.get("path") + ) + return + + if isinstance(value, Morsel): + c = morsel_to_cookie(value) + else: + c = create_cookie(name, value, **kwargs) + self.set_cookie(c) + return c + + def iterkeys(self): + """Dict-like iterkeys() that returns an iterator of names of cookies + from the jar. + + .. seealso:: itervalues() and iteritems(). + """ + for cookie in iter(self): + yield cookie.name + + def keys(self): + """Dict-like keys() that returns a list of names of cookies from the + jar. + + .. seealso:: values() and items(). + """ + return list(self.iterkeys()) + + def itervalues(self): + """Dict-like itervalues() that returns an iterator of values of cookies + from the jar. + + .. seealso:: iterkeys() and iteritems(). + """ + for cookie in iter(self): + yield cookie.value + + def values(self): + """Dict-like values() that returns a list of values of cookies from the + jar. + + .. seealso:: keys() and items(). + """ + return list(self.itervalues()) + + def iteritems(self): + """Dict-like iteritems() that returns an iterator of name-value tuples + from the jar. + + .. seealso:: iterkeys() and itervalues(). + """ + for cookie in iter(self): + yield cookie.name, cookie.value + + def items(self): + """Dict-like items() that returns a list of name-value tuples from the + jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a + vanilla python dict of key value pairs. + + .. seealso:: keys() and values(). + """ + return list(self.iteritems()) + + def list_domains(self): + """Utility method to list all the domains in the jar.""" + domains = [] + for cookie in iter(self): + if cookie.domain not in domains: + domains.append(cookie.domain) + return domains + + def list_paths(self): + """Utility method to list all the paths in the jar.""" + paths = [] + for cookie in iter(self): + if cookie.path not in paths: + paths.append(cookie.path) + return paths + + def multiple_domains(self): + """Returns True if there are multiple domains in the jar. + Returns False otherwise. + + :rtype: bool + """ + domains = [] + for cookie in iter(self): + if cookie.domain is not None and cookie.domain in domains: + return True + domains.append(cookie.domain) + return False # there is only one domain in jar + + def get_dict(self, domain=None, path=None): + """Takes as an argument an optional domain and path and returns a plain + old Python dict of name-value pairs of cookies that meet the + requirements. + + :rtype: dict + """ + dictionary = {} + for cookie in iter(self): + if (domain is None or cookie.domain == domain) and ( + path is None or cookie.path == path + ): + dictionary[cookie.name] = cookie.value + return dictionary + + def __contains__(self, name): + try: + return super().__contains__(name) + except CookieConflictError: + return True + + def __getitem__(self, name): + """Dict-like __getitem__() for compatibility with client code. Throws + exception if there are more than one cookie with name. In that case, + use the more explicit get() method instead. + + .. warning:: operation is O(n), not O(1). + """ + return self._find_no_duplicates(name) + + def __setitem__(self, name, value): + """Dict-like __setitem__ for compatibility with client code. Throws + exception if there is already a cookie of that name in the jar. In that + case, use the more explicit set() method instead. + """ + self.set(name, value) + + def __delitem__(self, name): + """Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s + ``remove_cookie_by_name()``. + """ + remove_cookie_by_name(self, name) + + def set_cookie(self, cookie, *args, **kwargs): + if ( + hasattr(cookie.value, "startswith") + and cookie.value.startswith('"') + and cookie.value.endswith('"') + ): + cookie.value = cookie.value.replace('\\"', "") + return super().set_cookie(cookie, *args, **kwargs) + + def update(self, other): + """Updates this jar with cookies from another CookieJar or dict-like""" + if isinstance(other, cookielib.CookieJar): + for cookie in other: + self.set_cookie(copy.copy(cookie)) + else: + super().update(other) + + def _find(self, name, domain=None, path=None): + """Requests uses this method internally to get cookie values. + + If there are conflicting cookies, _find arbitrarily chooses one. + See _find_no_duplicates if you want an exception thrown if there are + conflicting cookies. + + :param name: a string containing name of cookie + :param domain: (optional) string containing domain of cookie + :param path: (optional) string containing path of cookie + :return: cookie.value + """ + for cookie in iter(self): + if cookie.name == name: + if domain is None or cookie.domain == domain: + if path is None or cookie.path == path: + return cookie.value + + raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") + + def _find_no_duplicates(self, name, domain=None, path=None): + """Both ``__get_item__`` and ``get`` call this function: it's never + used elsewhere in Requests. + + :param name: a string containing name of cookie + :param domain: (optional) string containing domain of cookie + :param path: (optional) string containing path of cookie + :raises KeyError: if cookie is not found + :raises CookieConflictError: if there are multiple cookies + that match name and optionally domain and path + :return: cookie.value + """ + toReturn = None + for cookie in iter(self): + if cookie.name == name: + if domain is None or cookie.domain == domain: + if path is None or cookie.path == path: + if toReturn is not None: + # if there are multiple cookies that meet passed in criteria + raise CookieConflictError( + f"There are multiple cookies with name, {name!r}" + ) + # we will eventually return this as long as no cookie conflict + toReturn = cookie.value + + if toReturn: + return toReturn + raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") + + def __getstate__(self): + """Unlike a normal CookieJar, this class is pickleable.""" + state = self.__dict__.copy() + # remove the unpickleable RLock object + state.pop("_cookies_lock") + return state + + def __setstate__(self, state): + """Unlike a normal CookieJar, this class is pickleable.""" + self.__dict__.update(state) + if "_cookies_lock" not in self.__dict__: + self._cookies_lock = threading.RLock() + + def copy(self): + """Return a copy of this RequestsCookieJar.""" + new_cj = RequestsCookieJar() + new_cj.set_policy(self.get_policy()) + new_cj.update(self) + return new_cj + + def get_policy(self): + """Return the CookiePolicy instance used.""" + return self._policy + + +def _copy_cookie_jar(jar): + if jar is None: + return None + + if hasattr(jar, "copy"): + # We're dealing with an instance of RequestsCookieJar + return jar.copy() + # We're dealing with a generic CookieJar instance + new_jar = copy.copy(jar) + new_jar.clear() + for cookie in jar: + new_jar.set_cookie(copy.copy(cookie)) + return new_jar + + +def create_cookie(name, value, **kwargs): + """Make a cookie from underspecified parameters. + + By default, the pair of `name` and `value` will be set for the domain '' + and sent on every request (this is sometimes called a "supercookie"). + """ + result = { + "version": 0, + "name": name, + "value": value, + "port": None, + "domain": "", + "path": "/", + "secure": False, + "expires": None, + "discard": True, + "comment": None, + "comment_url": None, + "rest": {"HttpOnly": None}, + "rfc2109": False, + } + + badargs = set(kwargs) - set(result) + if badargs: + raise TypeError( + f"create_cookie() got unexpected keyword arguments: {list(badargs)}" + ) + + result.update(kwargs) + result["port_specified"] = bool(result["port"]) + result["domain_specified"] = bool(result["domain"]) + result["domain_initial_dot"] = result["domain"].startswith(".") + result["path_specified"] = bool(result["path"]) + + return cookielib.Cookie(**result) + + +def morsel_to_cookie(morsel): + """Convert a Morsel object into a Cookie containing the one k/v pair.""" + + expires = None + if morsel["max-age"]: + try: + expires = int(time.time() + int(morsel["max-age"])) + except ValueError: + raise TypeError(f"max-age: {morsel['max-age']} must be integer") + elif morsel["expires"]: + time_template = "%a, %d-%b-%Y %H:%M:%S GMT" + expires = calendar.timegm(time.strptime(morsel["expires"], time_template)) + return create_cookie( + comment=morsel["comment"], + comment_url=bool(morsel["comment"]), + discard=False, + domain=morsel["domain"], + expires=expires, + name=morsel.key, + path=morsel["path"], + port=None, + rest={"HttpOnly": morsel["httponly"]}, + rfc2109=False, + secure=bool(morsel["secure"]), + value=morsel.value, + version=morsel["version"] or 0, + ) + + +def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): + """Returns a CookieJar from a key/value dictionary. + + :param cookie_dict: Dict of key/values to insert into CookieJar. + :param cookiejar: (optional) A cookiejar to add the cookies to. + :param overwrite: (optional) If False, will not replace cookies + already in the jar with new ones. + :rtype: CookieJar + """ + if cookiejar is None: + cookiejar = RequestsCookieJar() + + if cookie_dict is not None: + names_from_jar = [cookie.name for cookie in cookiejar] + for name in cookie_dict: + if overwrite or (name not in names_from_jar): + cookiejar.set_cookie(create_cookie(name, cookie_dict[name])) + + return cookiejar + + +def merge_cookies(cookiejar, cookies): + """Add cookies to cookiejar and returns a merged CookieJar. + + :param cookiejar: CookieJar object to add the cookies to. + :param cookies: Dictionary or CookieJar object to be added. + :rtype: CookieJar + """ + if not isinstance(cookiejar, cookielib.CookieJar): + raise ValueError("You can only merge into CookieJar") + + if isinstance(cookies, dict): + cookiejar = cookiejar_from_dict(cookies, cookiejar=cookiejar, overwrite=False) + elif isinstance(cookies, cookielib.CookieJar): + try: + cookiejar.update(cookies) + except AttributeError: + for cookie_in_jar in cookies: + cookiejar.set_cookie(cookie_in_jar) + + return cookiejar diff --git a/billinglayer/python/requests/exceptions.py b/billinglayer/python/requests/exceptions.py new file mode 100644 index 0000000..e1cedf8 --- /dev/null +++ b/billinglayer/python/requests/exceptions.py @@ -0,0 +1,141 @@ +""" +requests.exceptions +~~~~~~~~~~~~~~~~~~~ + +This module contains the set of Requests' exceptions. +""" +from urllib3.exceptions import HTTPError as BaseHTTPError + +from .compat import JSONDecodeError as CompatJSONDecodeError + + +class RequestException(IOError): + """There was an ambiguous exception that occurred while handling your + request. + """ + + def __init__(self, *args, **kwargs): + """Initialize RequestException with `request` and `response` objects.""" + response = kwargs.pop("response", None) + self.response = response + self.request = kwargs.pop("request", None) + if response is not None and not self.request and hasattr(response, "request"): + self.request = self.response.request + super().__init__(*args, **kwargs) + + +class InvalidJSONError(RequestException): + """A JSON error occurred.""" + + +class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError): + """Couldn't decode the text into json""" + + def __init__(self, *args, **kwargs): + """ + Construct the JSONDecodeError instance first with all + args. Then use it's args to construct the IOError so that + the json specific args aren't used as IOError specific args + and the error message from JSONDecodeError is preserved. + """ + CompatJSONDecodeError.__init__(self, *args) + InvalidJSONError.__init__(self, *self.args, **kwargs) + + +class HTTPError(RequestException): + """An HTTP error occurred.""" + + +class ConnectionError(RequestException): + """A Connection error occurred.""" + + +class ProxyError(ConnectionError): + """A proxy error occurred.""" + + +class SSLError(ConnectionError): + """An SSL error occurred.""" + + +class Timeout(RequestException): + """The request timed out. + + Catching this error will catch both + :exc:`~requests.exceptions.ConnectTimeout` and + :exc:`~requests.exceptions.ReadTimeout` errors. + """ + + +class ConnectTimeout(ConnectionError, Timeout): + """The request timed out while trying to connect to the remote server. + + Requests that produced this error are safe to retry. + """ + + +class ReadTimeout(Timeout): + """The server did not send any data in the allotted amount of time.""" + + +class URLRequired(RequestException): + """A valid URL is required to make a request.""" + + +class TooManyRedirects(RequestException): + """Too many redirects.""" + + +class MissingSchema(RequestException, ValueError): + """The URL scheme (e.g. http or https) is missing.""" + + +class InvalidSchema(RequestException, ValueError): + """The URL scheme provided is either invalid or unsupported.""" + + +class InvalidURL(RequestException, ValueError): + """The URL provided was somehow invalid.""" + + +class InvalidHeader(RequestException, ValueError): + """The header value provided was somehow invalid.""" + + +class InvalidProxyURL(InvalidURL): + """The proxy URL provided is invalid.""" + + +class ChunkedEncodingError(RequestException): + """The server declared chunked encoding but sent an invalid chunk.""" + + +class ContentDecodingError(RequestException, BaseHTTPError): + """Failed to decode response content.""" + + +class StreamConsumedError(RequestException, TypeError): + """The content for this response was already consumed.""" + + +class RetryError(RequestException): + """Custom retries logic failed""" + + +class UnrewindableBodyError(RequestException): + """Requests encountered an error when trying to rewind a body.""" + + +# Warnings + + +class RequestsWarning(Warning): + """Base warning for Requests.""" + + +class FileModeWarning(RequestsWarning, DeprecationWarning): + """A file was opened in text mode, but Requests determined its binary length.""" + + +class RequestsDependencyWarning(RequestsWarning): + """An imported dependency doesn't match the expected version range.""" diff --git a/billinglayer/python/requests/help.py b/billinglayer/python/requests/help.py new file mode 100644 index 0000000..8fbcd65 --- /dev/null +++ b/billinglayer/python/requests/help.py @@ -0,0 +1,134 @@ +"""Module containing bug report helper(s).""" + +import json +import platform +import ssl +import sys + +import idna +import urllib3 + +from . import __version__ as requests_version + +try: + import charset_normalizer +except ImportError: + charset_normalizer = None + +try: + import chardet +except ImportError: + chardet = None + +try: + from urllib3.contrib import pyopenssl +except ImportError: + pyopenssl = None + OpenSSL = None + cryptography = None +else: + import cryptography + import OpenSSL + + +def _implementation(): + """Return a dict with the Python implementation and version. + + Provide both the name and the version of the Python implementation + currently running. For example, on CPython 3.10.3 it will return + {'name': 'CPython', 'version': '3.10.3'}. + + This function works best on CPython and PyPy: in particular, it probably + doesn't work for Jython or IronPython. Future investigation should be done + to work out the correct shape of the code for those platforms. + """ + implementation = platform.python_implementation() + + if implementation == "CPython": + implementation_version = platform.python_version() + elif implementation == "PyPy": + implementation_version = "{}.{}.{}".format( + sys.pypy_version_info.major, + sys.pypy_version_info.minor, + sys.pypy_version_info.micro, + ) + if sys.pypy_version_info.releaselevel != "final": + implementation_version = "".join( + [implementation_version, sys.pypy_version_info.releaselevel] + ) + elif implementation == "Jython": + implementation_version = platform.python_version() # Complete Guess + elif implementation == "IronPython": + implementation_version = platform.python_version() # Complete Guess + else: + implementation_version = "Unknown" + + return {"name": implementation, "version": implementation_version} + + +def info(): + """Generate information for a bug report.""" + try: + platform_info = { + "system": platform.system(), + "release": platform.release(), + } + except OSError: + platform_info = { + "system": "Unknown", + "release": "Unknown", + } + + implementation_info = _implementation() + urllib3_info = {"version": urllib3.__version__} + charset_normalizer_info = {"version": None} + chardet_info = {"version": None} + if charset_normalizer: + charset_normalizer_info = {"version": charset_normalizer.__version__} + if chardet: + chardet_info = {"version": chardet.__version__} + + pyopenssl_info = { + "version": None, + "openssl_version": "", + } + if OpenSSL: + pyopenssl_info = { + "version": OpenSSL.__version__, + "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", + } + cryptography_info = { + "version": getattr(cryptography, "__version__", ""), + } + idna_info = { + "version": getattr(idna, "__version__", ""), + } + + system_ssl = ssl.OPENSSL_VERSION_NUMBER + system_ssl_info = {"version": f"{system_ssl:x}" if system_ssl is not None else ""} + + return { + "platform": platform_info, + "implementation": implementation_info, + "system_ssl": system_ssl_info, + "using_pyopenssl": pyopenssl is not None, + "using_charset_normalizer": chardet is None, + "pyOpenSSL": pyopenssl_info, + "urllib3": urllib3_info, + "chardet": chardet_info, + "charset_normalizer": charset_normalizer_info, + "cryptography": cryptography_info, + "idna": idna_info, + "requests": { + "version": requests_version, + }, + } + + +def main(): + """Pretty-print the bug information as JSON.""" + print(json.dumps(info(), sort_keys=True, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/billinglayer/python/requests/hooks.py b/billinglayer/python/requests/hooks.py new file mode 100644 index 0000000..d181ba2 --- /dev/null +++ b/billinglayer/python/requests/hooks.py @@ -0,0 +1,33 @@ +""" +requests.hooks +~~~~~~~~~~~~~~ + +This module provides the capabilities for the Requests hooks system. + +Available hooks: + +``response``: + The response generated from a Request. +""" +HOOKS = ["response"] + + +def default_hooks(): + return {event: [] for event in HOOKS} + + +# TODO: response is the only one + + +def dispatch_hook(key, hooks, hook_data, **kwargs): + """Dispatches a hook dictionary on a given piece of data.""" + hooks = hooks or {} + hooks = hooks.get(key) + if hooks: + if hasattr(hooks, "__call__"): + hooks = [hooks] + for hook in hooks: + _hook_data = hook(hook_data, **kwargs) + if _hook_data is not None: + hook_data = _hook_data + return hook_data diff --git a/billinglayer/python/requests/models.py b/billinglayer/python/requests/models.py new file mode 100644 index 0000000..617a413 --- /dev/null +++ b/billinglayer/python/requests/models.py @@ -0,0 +1,1034 @@ +""" +requests.models +~~~~~~~~~~~~~~~ + +This module contains the primary objects that power Requests. +""" + +import datetime + +# Import encoding now, to avoid implicit import later. +# Implicit import within threads may cause LookupError when standard library is in a ZIP, +# such as in Embedded Python. See https://github.com/psf/requests/issues/3578. +import encodings.idna # noqa: F401 +from io import UnsupportedOperation + +from urllib3.exceptions import ( + DecodeError, + LocationParseError, + ProtocolError, + ReadTimeoutError, + SSLError, +) +from urllib3.fields import RequestField +from urllib3.filepost import encode_multipart_formdata +from urllib3.util import parse_url + +from ._internal_utils import to_native_string, unicode_is_ascii +from .auth import HTTPBasicAuth +from .compat import ( + Callable, + JSONDecodeError, + Mapping, + basestring, + builtin_str, + chardet, + cookielib, +) +from .compat import json as complexjson +from .compat import urlencode, urlsplit, urlunparse +from .cookies import _copy_cookie_jar, cookiejar_from_dict, get_cookie_header +from .exceptions import ( + ChunkedEncodingError, + ConnectionError, + ContentDecodingError, + HTTPError, + InvalidJSONError, + InvalidURL, +) +from .exceptions import JSONDecodeError as RequestsJSONDecodeError +from .exceptions import MissingSchema +from .exceptions import SSLError as RequestsSSLError +from .exceptions import StreamConsumedError +from .hooks import default_hooks +from .status_codes import codes +from .structures import CaseInsensitiveDict +from .utils import ( + check_header_validity, + get_auth_from_url, + guess_filename, + guess_json_utf, + iter_slices, + parse_header_links, + requote_uri, + stream_decode_response_unicode, + super_len, + to_key_val_list, +) + +#: The set of HTTP status codes that indicate an automatically +#: processable redirect. +REDIRECT_STATI = ( + codes.moved, # 301 + codes.found, # 302 + codes.other, # 303 + codes.temporary_redirect, # 307 + codes.permanent_redirect, # 308 +) + +DEFAULT_REDIRECT_LIMIT = 30 +CONTENT_CHUNK_SIZE = 10 * 1024 +ITER_CHUNK_SIZE = 512 + + +class RequestEncodingMixin: + @property + def path_url(self): + """Build the path URL to use.""" + + url = [] + + p = urlsplit(self.url) + + path = p.path + if not path: + path = "/" + + url.append(path) + + query = p.query + if query: + url.append("?") + url.append(query) + + return "".join(url) + + @staticmethod + def _encode_params(data): + """Encode parameters in a piece of data. + + Will successfully encode parameters when passed as a dict or a list of + 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary + if parameters are supplied as a dict. + """ + + if isinstance(data, (str, bytes)): + return data + elif hasattr(data, "read"): + return data + elif hasattr(data, "__iter__"): + result = [] + for k, vs in to_key_val_list(data): + if isinstance(vs, basestring) or not hasattr(vs, "__iter__"): + vs = [vs] + for v in vs: + if v is not None: + result.append( + ( + k.encode("utf-8") if isinstance(k, str) else k, + v.encode("utf-8") if isinstance(v, str) else v, + ) + ) + return urlencode(result, doseq=True) + else: + return data + + @staticmethod + def _encode_files(files, data): + """Build the body for a multipart/form-data request. + + Will successfully encode files when passed as a dict or a list of + tuples. Order is retained if data is a list of tuples but arbitrary + if parameters are supplied as a dict. + The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) + or 4-tuples (filename, fileobj, contentype, custom_headers). + """ + if not files: + raise ValueError("Files must be provided.") + elif isinstance(data, basestring): + raise ValueError("Data must not be a string.") + + new_fields = [] + fields = to_key_val_list(data or {}) + files = to_key_val_list(files or {}) + + for field, val in fields: + if isinstance(val, basestring) or not hasattr(val, "__iter__"): + val = [val] + for v in val: + if v is not None: + # Don't call str() on bytestrings: in Py3 it all goes wrong. + if not isinstance(v, bytes): + v = str(v) + + new_fields.append( + ( + field.decode("utf-8") + if isinstance(field, bytes) + else field, + v.encode("utf-8") if isinstance(v, str) else v, + ) + ) + + for (k, v) in files: + # support for explicit filename + ft = None + fh = None + if isinstance(v, (tuple, list)): + if len(v) == 2: + fn, fp = v + elif len(v) == 3: + fn, fp, ft = v + else: + fn, fp, ft, fh = v + else: + fn = guess_filename(v) or k + fp = v + + if isinstance(fp, (str, bytes, bytearray)): + fdata = fp + elif hasattr(fp, "read"): + fdata = fp.read() + elif fp is None: + continue + else: + fdata = fp + + rf = RequestField(name=k, data=fdata, filename=fn, headers=fh) + rf.make_multipart(content_type=ft) + new_fields.append(rf) + + body, content_type = encode_multipart_formdata(new_fields) + + return body, content_type + + +class RequestHooksMixin: + def register_hook(self, event, hook): + """Properly register a hook.""" + + if event not in self.hooks: + raise ValueError(f'Unsupported event specified, with event name "{event}"') + + if isinstance(hook, Callable): + self.hooks[event].append(hook) + elif hasattr(hook, "__iter__"): + self.hooks[event].extend(h for h in hook if isinstance(h, Callable)) + + def deregister_hook(self, event, hook): + """Deregister a previously registered hook. + Returns True if the hook existed, False if not. + """ + + try: + self.hooks[event].remove(hook) + return True + except ValueError: + return False + + +class Request(RequestHooksMixin): + """A user-created :class:`Request ` object. + + Used to prepare a :class:`PreparedRequest `, which is sent to the server. + + :param method: HTTP method to use. + :param url: URL to send. + :param headers: dictionary of headers to send. + :param files: dictionary of {filename: fileobject} files to multipart upload. + :param data: the body to attach to the request. If a dictionary or + list of tuples ``[(key, value)]`` is provided, form-encoding will + take place. + :param json: json for the body to attach to the request (if files or data is not specified). + :param params: URL parameters to append to the URL. If a dictionary or + list of tuples ``[(key, value)]`` is provided, form-encoding will + take place. + :param auth: Auth handler or (user, pass) tuple. + :param cookies: dictionary or CookieJar of cookies to attach to this request. + :param hooks: dictionary of callback hooks, for internal usage. + + Usage:: + + >>> import requests + >>> req = requests.Request('GET', 'https://httpbin.org/get') + >>> req.prepare() + + """ + + def __init__( + self, + method=None, + url=None, + headers=None, + files=None, + data=None, + params=None, + auth=None, + cookies=None, + hooks=None, + json=None, + ): + + # Default empty dicts for dict params. + data = [] if data is None else data + files = [] if files is None else files + headers = {} if headers is None else headers + params = {} if params is None else params + hooks = {} if hooks is None else hooks + + self.hooks = default_hooks() + for (k, v) in list(hooks.items()): + self.register_hook(event=k, hook=v) + + self.method = method + self.url = url + self.headers = headers + self.files = files + self.data = data + self.json = json + self.params = params + self.auth = auth + self.cookies = cookies + + def __repr__(self): + return f"" + + def prepare(self): + """Constructs a :class:`PreparedRequest ` for transmission and returns it.""" + p = PreparedRequest() + p.prepare( + method=self.method, + url=self.url, + headers=self.headers, + files=self.files, + data=self.data, + json=self.json, + params=self.params, + auth=self.auth, + cookies=self.cookies, + hooks=self.hooks, + ) + return p + + +class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): + """The fully mutable :class:`PreparedRequest ` object, + containing the exact bytes that will be sent to the server. + + Instances are generated from a :class:`Request ` object, and + should not be instantiated manually; doing so may produce undesirable + effects. + + Usage:: + + >>> import requests + >>> req = requests.Request('GET', 'https://httpbin.org/get') + >>> r = req.prepare() + >>> r + + + >>> s = requests.Session() + >>> s.send(r) + + """ + + def __init__(self): + #: HTTP verb to send to the server. + self.method = None + #: HTTP URL to send the request to. + self.url = None + #: dictionary of HTTP headers. + self.headers = None + # The `CookieJar` used to create the Cookie header will be stored here + # after prepare_cookies is called + self._cookies = None + #: request body to send to the server. + self.body = None + #: dictionary of callback hooks, for internal usage. + self.hooks = default_hooks() + #: integer denoting starting position of a readable file-like body. + self._body_position = None + + def prepare( + self, + method=None, + url=None, + headers=None, + files=None, + data=None, + params=None, + auth=None, + cookies=None, + hooks=None, + json=None, + ): + """Prepares the entire request with the given parameters.""" + + self.prepare_method(method) + self.prepare_url(url, params) + self.prepare_headers(headers) + self.prepare_cookies(cookies) + self.prepare_body(data, files, json) + self.prepare_auth(auth, url) + + # Note that prepare_auth must be last to enable authentication schemes + # such as OAuth to work on a fully prepared request. + + # This MUST go after prepare_auth. Authenticators could add a hook + self.prepare_hooks(hooks) + + def __repr__(self): + return f"" + + def copy(self): + p = PreparedRequest() + p.method = self.method + p.url = self.url + p.headers = self.headers.copy() if self.headers is not None else None + p._cookies = _copy_cookie_jar(self._cookies) + p.body = self.body + p.hooks = self.hooks + p._body_position = self._body_position + return p + + def prepare_method(self, method): + """Prepares the given HTTP method.""" + self.method = method + if self.method is not None: + self.method = to_native_string(self.method.upper()) + + @staticmethod + def _get_idna_encoded_host(host): + import idna + + try: + host = idna.encode(host, uts46=True).decode("utf-8") + except idna.IDNAError: + raise UnicodeError + return host + + def prepare_url(self, url, params): + """Prepares the given HTTP URL.""" + #: Accept objects that have string representations. + #: We're unable to blindly call unicode/str functions + #: as this will include the bytestring indicator (b'') + #: on python 3.x. + #: https://github.com/psf/requests/pull/2238 + if isinstance(url, bytes): + url = url.decode("utf8") + else: + url = str(url) + + # Remove leading whitespaces from url + url = url.lstrip() + + # Don't do any URL preparation for non-HTTP schemes like `mailto`, + # `data` etc to work around exceptions from `url_parse`, which + # handles RFC 3986 only. + if ":" in url and not url.lower().startswith("http"): + self.url = url + return + + # Support for unicode domain names and paths. + try: + scheme, auth, host, port, path, query, fragment = parse_url(url) + except LocationParseError as e: + raise InvalidURL(*e.args) + + if not scheme: + raise MissingSchema( + f"Invalid URL {url!r}: No scheme supplied. " + f"Perhaps you meant https://{url}?" + ) + + if not host: + raise InvalidURL(f"Invalid URL {url!r}: No host supplied") + + # In general, we want to try IDNA encoding the hostname if the string contains + # non-ASCII characters. This allows users to automatically get the correct IDNA + # behaviour. For strings containing only ASCII characters, we need to also verify + # it doesn't start with a wildcard (*), before allowing the unencoded hostname. + if not unicode_is_ascii(host): + try: + host = self._get_idna_encoded_host(host) + except UnicodeError: + raise InvalidURL("URL has an invalid label.") + elif host.startswith(("*", ".")): + raise InvalidURL("URL has an invalid label.") + + # Carefully reconstruct the network location + netloc = auth or "" + if netloc: + netloc += "@" + netloc += host + if port: + netloc += f":{port}" + + # Bare domains aren't valid URLs. + if not path: + path = "/" + + if isinstance(params, (str, bytes)): + params = to_native_string(params) + + enc_params = self._encode_params(params) + if enc_params: + if query: + query = f"{query}&{enc_params}" + else: + query = enc_params + + url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment])) + self.url = url + + def prepare_headers(self, headers): + """Prepares the given HTTP headers.""" + + self.headers = CaseInsensitiveDict() + if headers: + for header in headers.items(): + # Raise exception on invalid header value. + check_header_validity(header) + name, value = header + self.headers[to_native_string(name)] = value + + def prepare_body(self, data, files, json=None): + """Prepares the given HTTP body data.""" + + # Check if file, fo, generator, iterator. + # If not, run through normal process. + + # Nottin' on you. + body = None + content_type = None + + if not data and json is not None: + # urllib3 requires a bytes-like body. Python 2's json.dumps + # provides this natively, but Python 3 gives a Unicode string. + content_type = "application/json" + + try: + body = complexjson.dumps(json, allow_nan=False) + except ValueError as ve: + raise InvalidJSONError(ve, request=self) + + if not isinstance(body, bytes): + body = body.encode("utf-8") + + is_stream = all( + [ + hasattr(data, "__iter__"), + not isinstance(data, (basestring, list, tuple, Mapping)), + ] + ) + + if is_stream: + try: + length = super_len(data) + except (TypeError, AttributeError, UnsupportedOperation): + length = None + + body = data + + if getattr(body, "tell", None) is not None: + # Record the current file position before reading. + # This will allow us to rewind a file in the event + # of a redirect. + try: + self._body_position = body.tell() + except OSError: + # This differentiates from None, allowing us to catch + # a failed `tell()` later when trying to rewind the body + self._body_position = object() + + if files: + raise NotImplementedError( + "Streamed bodies and files are mutually exclusive." + ) + + if length: + self.headers["Content-Length"] = builtin_str(length) + else: + self.headers["Transfer-Encoding"] = "chunked" + else: + # Multi-part file uploads. + if files: + (body, content_type) = self._encode_files(files, data) + else: + if data: + body = self._encode_params(data) + if isinstance(data, basestring) or hasattr(data, "read"): + content_type = None + else: + content_type = "application/x-www-form-urlencoded" + + self.prepare_content_length(body) + + # Add content-type if it wasn't explicitly provided. + if content_type and ("content-type" not in self.headers): + self.headers["Content-Type"] = content_type + + self.body = body + + def prepare_content_length(self, body): + """Prepare Content-Length header based on request method and body""" + if body is not None: + length = super_len(body) + if length: + # If length exists, set it. Otherwise, we fallback + # to Transfer-Encoding: chunked. + self.headers["Content-Length"] = builtin_str(length) + elif ( + self.method not in ("GET", "HEAD") + and self.headers.get("Content-Length") is None + ): + # Set Content-Length to 0 for methods that can have a body + # but don't provide one. (i.e. not GET or HEAD) + self.headers["Content-Length"] = "0" + + def prepare_auth(self, auth, url=""): + """Prepares the given HTTP auth data.""" + + # If no Auth is explicitly provided, extract it from the URL first. + if auth is None: + url_auth = get_auth_from_url(self.url) + auth = url_auth if any(url_auth) else None + + if auth: + if isinstance(auth, tuple) and len(auth) == 2: + # special-case basic HTTP auth + auth = HTTPBasicAuth(*auth) + + # Allow auth to make its changes. + r = auth(self) + + # Update self to reflect the auth changes. + self.__dict__.update(r.__dict__) + + # Recompute Content-Length + self.prepare_content_length(self.body) + + def prepare_cookies(self, cookies): + """Prepares the given HTTP cookie data. + + This function eventually generates a ``Cookie`` header from the + given cookies using cookielib. Due to cookielib's design, the header + will not be regenerated if it already exists, meaning this function + can only be called once for the life of the + :class:`PreparedRequest ` object. Any subsequent calls + to ``prepare_cookies`` will have no actual effect, unless the "Cookie" + header is removed beforehand. + """ + if isinstance(cookies, cookielib.CookieJar): + self._cookies = cookies + else: + self._cookies = cookiejar_from_dict(cookies) + + cookie_header = get_cookie_header(self._cookies, self) + if cookie_header is not None: + self.headers["Cookie"] = cookie_header + + def prepare_hooks(self, hooks): + """Prepares the given hooks.""" + # hooks can be passed as None to the prepare method and to this + # method. To prevent iterating over None, simply use an empty list + # if hooks is False-y + hooks = hooks or [] + for event in hooks: + self.register_hook(event, hooks[event]) + + +class Response: + """The :class:`Response ` object, which contains a + server's response to an HTTP request. + """ + + __attrs__ = [ + "_content", + "status_code", + "headers", + "url", + "history", + "encoding", + "reason", + "cookies", + "elapsed", + "request", + ] + + def __init__(self): + self._content = False + self._content_consumed = False + self._next = None + + #: Integer Code of responded HTTP Status, e.g. 404 or 200. + self.status_code = None + + #: Case-insensitive Dictionary of Response Headers. + #: For example, ``headers['content-encoding']`` will return the + #: value of a ``'Content-Encoding'`` response header. + self.headers = CaseInsensitiveDict() + + #: File-like object representation of response (for advanced usage). + #: Use of ``raw`` requires that ``stream=True`` be set on the request. + #: This requirement does not apply for use internally to Requests. + self.raw = None + + #: Final URL location of Response. + self.url = None + + #: Encoding to decode with when accessing r.text. + self.encoding = None + + #: A list of :class:`Response ` objects from + #: the history of the Request. Any redirect responses will end + #: up here. The list is sorted from the oldest to the most recent request. + self.history = [] + + #: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK". + self.reason = None + + #: A CookieJar of Cookies the server sent back. + self.cookies = cookiejar_from_dict({}) + + #: The amount of time elapsed between sending the request + #: and the arrival of the response (as a timedelta). + #: This property specifically measures the time taken between sending + #: the first byte of the request and finishing parsing the headers. It + #: is therefore unaffected by consuming the response content or the + #: value of the ``stream`` keyword argument. + self.elapsed = datetime.timedelta(0) + + #: The :class:`PreparedRequest ` object to which this + #: is a response. + self.request = None + + def __enter__(self): + return self + + def __exit__(self, *args): + self.close() + + def __getstate__(self): + # Consume everything; accessing the content attribute makes + # sure the content has been fully read. + if not self._content_consumed: + self.content + + return {attr: getattr(self, attr, None) for attr in self.__attrs__} + + def __setstate__(self, state): + for name, value in state.items(): + setattr(self, name, value) + + # pickled objects do not have .raw + setattr(self, "_content_consumed", True) + setattr(self, "raw", None) + + def __repr__(self): + return f"" + + def __bool__(self): + """Returns True if :attr:`status_code` is less than 400. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code, is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + return self.ok + + def __nonzero__(self): + """Returns True if :attr:`status_code` is less than 400. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code, is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + return self.ok + + def __iter__(self): + """Allows you to use a response as an iterator.""" + return self.iter_content(128) + + @property + def ok(self): + """Returns True if :attr:`status_code` is less than 400, False if not. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + try: + self.raise_for_status() + except HTTPError: + return False + return True + + @property + def is_redirect(self): + """True if this Response is a well-formed HTTP redirect that could have + been processed automatically (by :meth:`Session.resolve_redirects`). + """ + return "location" in self.headers and self.status_code in REDIRECT_STATI + + @property + def is_permanent_redirect(self): + """True if this Response one of the permanent versions of redirect.""" + return "location" in self.headers and self.status_code in ( + codes.moved_permanently, + codes.permanent_redirect, + ) + + @property + def next(self): + """Returns a PreparedRequest for the next request in a redirect chain, if there is one.""" + return self._next + + @property + def apparent_encoding(self): + """The apparent encoding, provided by the charset_normalizer or chardet libraries.""" + return chardet.detect(self.content)["encoding"] + + def iter_content(self, chunk_size=1, decode_unicode=False): + """Iterates over the response data. When stream=True is set on the + request, this avoids reading the content at once into memory for + large responses. The chunk size is the number of bytes it should + read into memory. This is not necessarily the length of each item + returned as decoding can take place. + + chunk_size must be of type int or None. A value of None will + function differently depending on the value of `stream`. + stream=True will read data as it arrives in whatever size the + chunks are received. If stream=False, data is returned as + a single chunk. + + If decode_unicode is True, content will be decoded using the best + available encoding based on the response. + """ + + def generate(): + # Special case for urllib3. + if hasattr(self.raw, "stream"): + try: + yield from self.raw.stream(chunk_size, decode_content=True) + except ProtocolError as e: + raise ChunkedEncodingError(e) + except DecodeError as e: + raise ContentDecodingError(e) + except ReadTimeoutError as e: + raise ConnectionError(e) + except SSLError as e: + raise RequestsSSLError(e) + else: + # Standard file-like object. + while True: + chunk = self.raw.read(chunk_size) + if not chunk: + break + yield chunk + + self._content_consumed = True + + if self._content_consumed and isinstance(self._content, bool): + raise StreamConsumedError() + elif chunk_size is not None and not isinstance(chunk_size, int): + raise TypeError( + f"chunk_size must be an int, it is instead a {type(chunk_size)}." + ) + # simulate reading small chunks of the content + reused_chunks = iter_slices(self._content, chunk_size) + + stream_chunks = generate() + + chunks = reused_chunks if self._content_consumed else stream_chunks + + if decode_unicode: + chunks = stream_decode_response_unicode(chunks, self) + + return chunks + + def iter_lines( + self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=False, delimiter=None + ): + """Iterates over the response data, one line at a time. When + stream=True is set on the request, this avoids reading the + content at once into memory for large responses. + + .. note:: This method is not reentrant safe. + """ + + pending = None + + for chunk in self.iter_content( + chunk_size=chunk_size, decode_unicode=decode_unicode + ): + + if pending is not None: + chunk = pending + chunk + + if delimiter: + lines = chunk.split(delimiter) + else: + lines = chunk.splitlines() + + if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]: + pending = lines.pop() + else: + pending = None + + yield from lines + + if pending is not None: + yield pending + + @property + def content(self): + """Content of the response, in bytes.""" + + if self._content is False: + # Read the contents. + if self._content_consumed: + raise RuntimeError("The content for this response was already consumed") + + if self.status_code == 0 or self.raw is None: + self._content = None + else: + self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b"" + + self._content_consumed = True + # don't need to release the connection; that's been handled by urllib3 + # since we exhausted the data. + return self._content + + @property + def text(self): + """Content of the response, in unicode. + + If Response.encoding is None, encoding will be guessed using + ``charset_normalizer`` or ``chardet``. + + The encoding of the response content is determined based solely on HTTP + headers, following RFC 2616 to the letter. If you can take advantage of + non-HTTP knowledge to make a better guess at the encoding, you should + set ``r.encoding`` appropriately before accessing this property. + """ + + # Try charset from content-type + content = None + encoding = self.encoding + + if not self.content: + return "" + + # Fallback to auto-detected encoding. + if self.encoding is None: + encoding = self.apparent_encoding + + # Decode unicode from given encoding. + try: + content = str(self.content, encoding, errors="replace") + except (LookupError, TypeError): + # A LookupError is raised if the encoding was not found which could + # indicate a misspelling or similar mistake. + # + # A TypeError can be raised if encoding is None + # + # So we try blindly encoding. + content = str(self.content, errors="replace") + + return content + + def json(self, **kwargs): + r"""Returns the json-encoded content of a response, if any. + + :param \*\*kwargs: Optional arguments that ``json.loads`` takes. + :raises requests.exceptions.JSONDecodeError: If the response body does not + contain valid json. + """ + + if not self.encoding and self.content and len(self.content) > 3: + # No encoding set. JSON RFC 4627 section 3 states we should expect + # UTF-8, -16 or -32. Detect which one to use; If the detection or + # decoding fails, fall back to `self.text` (using charset_normalizer to make + # a best guess). + encoding = guess_json_utf(self.content) + if encoding is not None: + try: + return complexjson.loads(self.content.decode(encoding), **kwargs) + except UnicodeDecodeError: + # Wrong UTF codec detected; usually because it's not UTF-8 + # but some other 8-bit codec. This is an RFC violation, + # and the server didn't bother to tell us what codec *was* + # used. + pass + except JSONDecodeError as e: + raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) + + try: + return complexjson.loads(self.text, **kwargs) + except JSONDecodeError as e: + # Catch JSON-related errors and raise as requests.JSONDecodeError + # This aliases json.JSONDecodeError and simplejson.JSONDecodeError + raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) + + @property + def links(self): + """Returns the parsed header links of the response, if any.""" + + header = self.headers.get("link") + + resolved_links = {} + + if header: + links = parse_header_links(header) + + for link in links: + key = link.get("rel") or link.get("url") + resolved_links[key] = link + + return resolved_links + + def raise_for_status(self): + """Raises :class:`HTTPError`, if one occurred.""" + + http_error_msg = "" + if isinstance(self.reason, bytes): + # We attempt to decode utf-8 first because some servers + # choose to localize their reason strings. If the string + # isn't utf-8, we fall back to iso-8859-1 for all other + # encodings. (See PR #3538) + try: + reason = self.reason.decode("utf-8") + except UnicodeDecodeError: + reason = self.reason.decode("iso-8859-1") + else: + reason = self.reason + + if 400 <= self.status_code < 500: + http_error_msg = ( + f"{self.status_code} Client Error: {reason} for url: {self.url}" + ) + + elif 500 <= self.status_code < 600: + http_error_msg = ( + f"{self.status_code} Server Error: {reason} for url: {self.url}" + ) + + if http_error_msg: + raise HTTPError(http_error_msg, response=self) + + def close(self): + """Releases the connection back to the pool. Once this method has been + called the underlying ``raw`` object must not be accessed again. + + *Note: Should not normally need to be called explicitly.* + """ + if not self._content_consumed: + self.raw.close() + + release_conn = getattr(self.raw, "release_conn", None) + if release_conn is not None: + release_conn() diff --git a/billinglayer/python/requests/packages.py b/billinglayer/python/requests/packages.py new file mode 100644 index 0000000..77c45c9 --- /dev/null +++ b/billinglayer/python/requests/packages.py @@ -0,0 +1,28 @@ +import sys + +try: + import chardet +except ImportError: + import warnings + + import charset_normalizer as chardet + + warnings.filterwarnings("ignore", "Trying to detect", module="charset_normalizer") + +# This code exists for backwards compatibility reasons. +# I don't like it either. Just look the other way. :) + +for package in ("urllib3", "idna"): + locals()[package] = __import__(package) + # This traversal is apparently necessary such that the identities are + # preserved (requests.packages.urllib3.* is urllib3.*) + for mod in list(sys.modules): + if mod == package or mod.startswith(f"{package}."): + sys.modules[f"requests.packages.{mod}"] = sys.modules[mod] + +target = chardet.__name__ +for mod in list(sys.modules): + if mod == target or mod.startswith(f"{target}."): + target = target.replace(target, "chardet") + sys.modules[f"requests.packages.{target}"] = sys.modules[mod] +# Kinda cool, though, right? diff --git a/billinglayer/python/requests/sessions.py b/billinglayer/python/requests/sessions.py new file mode 100644 index 0000000..dbcf2a7 --- /dev/null +++ b/billinglayer/python/requests/sessions.py @@ -0,0 +1,833 @@ +""" +requests.sessions +~~~~~~~~~~~~~~~~~ + +This module provides a Session object to manage and persist settings across +requests (cookies, auth, proxies). +""" +import os +import sys +import time +from collections import OrderedDict +from datetime import timedelta + +from ._internal_utils import to_native_string +from .adapters import HTTPAdapter +from .auth import _basic_auth_str +from .compat import Mapping, cookielib, urljoin, urlparse +from .cookies import ( + RequestsCookieJar, + cookiejar_from_dict, + extract_cookies_to_jar, + merge_cookies, +) +from .exceptions import ( + ChunkedEncodingError, + ContentDecodingError, + InvalidSchema, + TooManyRedirects, +) +from .hooks import default_hooks, dispatch_hook + +# formerly defined here, reexposed here for backward compatibility +from .models import ( # noqa: F401 + DEFAULT_REDIRECT_LIMIT, + REDIRECT_STATI, + PreparedRequest, + Request, +) +from .status_codes import codes +from .structures import CaseInsensitiveDict +from .utils import ( # noqa: F401 + DEFAULT_PORTS, + default_headers, + get_auth_from_url, + get_environ_proxies, + get_netrc_auth, + requote_uri, + resolve_proxies, + rewind_body, + should_bypass_proxies, + to_key_val_list, +) + +# Preferred clock, based on which one is more accurate on a given system. +if sys.platform == "win32": + preferred_clock = time.perf_counter +else: + preferred_clock = time.time + + +def merge_setting(request_setting, session_setting, dict_class=OrderedDict): + """Determines appropriate setting for a given request, taking into account + the explicit setting on that request, and the setting in the session. If a + setting is a dictionary, they will be merged together using `dict_class` + """ + + if session_setting is None: + return request_setting + + if request_setting is None: + return session_setting + + # Bypass if not a dictionary (e.g. verify) + if not ( + isinstance(session_setting, Mapping) and isinstance(request_setting, Mapping) + ): + return request_setting + + merged_setting = dict_class(to_key_val_list(session_setting)) + merged_setting.update(to_key_val_list(request_setting)) + + # Remove keys that are set to None. Extract keys first to avoid altering + # the dictionary during iteration. + none_keys = [k for (k, v) in merged_setting.items() if v is None] + for key in none_keys: + del merged_setting[key] + + return merged_setting + + +def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict): + """Properly merges both requests and session hooks. + + This is necessary because when request_hooks == {'response': []}, the + merge breaks Session hooks entirely. + """ + if session_hooks is None or session_hooks.get("response") == []: + return request_hooks + + if request_hooks is None or request_hooks.get("response") == []: + return session_hooks + + return merge_setting(request_hooks, session_hooks, dict_class) + + +class SessionRedirectMixin: + def get_redirect_target(self, resp): + """Receives a Response. Returns a redirect URI or ``None``""" + # Due to the nature of how requests processes redirects this method will + # be called at least once upon the original response and at least twice + # on each subsequent redirect response (if any). + # If a custom mixin is used to handle this logic, it may be advantageous + # to cache the redirect location onto the response object as a private + # attribute. + if resp.is_redirect: + location = resp.headers["location"] + # Currently the underlying http module on py3 decode headers + # in latin1, but empirical evidence suggests that latin1 is very + # rarely used with non-ASCII characters in HTTP headers. + # It is more likely to get UTF8 header rather than latin1. + # This causes incorrect handling of UTF8 encoded location headers. + # To solve this, we re-encode the location in latin1. + location = location.encode("latin1") + return to_native_string(location, "utf8") + return None + + def should_strip_auth(self, old_url, new_url): + """Decide whether Authorization header should be removed when redirecting""" + old_parsed = urlparse(old_url) + new_parsed = urlparse(new_url) + if old_parsed.hostname != new_parsed.hostname: + return True + # Special case: allow http -> https redirect when using the standard + # ports. This isn't specified by RFC 7235, but is kept to avoid + # breaking backwards compatibility with older versions of requests + # that allowed any redirects on the same host. + if ( + old_parsed.scheme == "http" + and old_parsed.port in (80, None) + and new_parsed.scheme == "https" + and new_parsed.port in (443, None) + ): + return False + + # Handle default port usage corresponding to scheme. + changed_port = old_parsed.port != new_parsed.port + changed_scheme = old_parsed.scheme != new_parsed.scheme + default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None) + if ( + not changed_scheme + and old_parsed.port in default_port + and new_parsed.port in default_port + ): + return False + + # Standard case: root URI must match + return changed_port or changed_scheme + + def resolve_redirects( + self, + resp, + req, + stream=False, + timeout=None, + verify=True, + cert=None, + proxies=None, + yield_requests=False, + **adapter_kwargs, + ): + """Receives a Response. Returns a generator of Responses or Requests.""" + + hist = [] # keep track of history + + url = self.get_redirect_target(resp) + previous_fragment = urlparse(req.url).fragment + while url: + prepared_request = req.copy() + + # Update history and keep track of redirects. + # resp.history must ignore the original request in this loop + hist.append(resp) + resp.history = hist[1:] + + try: + resp.content # Consume socket so it can be released + except (ChunkedEncodingError, ContentDecodingError, RuntimeError): + resp.raw.read(decode_content=False) + + if len(resp.history) >= self.max_redirects: + raise TooManyRedirects( + f"Exceeded {self.max_redirects} redirects.", response=resp + ) + + # Release the connection back into the pool. + resp.close() + + # Handle redirection without scheme (see: RFC 1808 Section 4) + if url.startswith("//"): + parsed_rurl = urlparse(resp.url) + url = ":".join([to_native_string(parsed_rurl.scheme), url]) + + # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2) + parsed = urlparse(url) + if parsed.fragment == "" and previous_fragment: + parsed = parsed._replace(fragment=previous_fragment) + elif parsed.fragment: + previous_fragment = parsed.fragment + url = parsed.geturl() + + # Facilitate relative 'location' headers, as allowed by RFC 7231. + # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') + # Compliant with RFC3986, we percent encode the url. + if not parsed.netloc: + url = urljoin(resp.url, requote_uri(url)) + else: + url = requote_uri(url) + + prepared_request.url = to_native_string(url) + + self.rebuild_method(prepared_request, resp) + + # https://github.com/psf/requests/issues/1084 + if resp.status_code not in ( + codes.temporary_redirect, + codes.permanent_redirect, + ): + # https://github.com/psf/requests/issues/3490 + purged_headers = ("Content-Length", "Content-Type", "Transfer-Encoding") + for header in purged_headers: + prepared_request.headers.pop(header, None) + prepared_request.body = None + + headers = prepared_request.headers + headers.pop("Cookie", None) + + # Extract any cookies sent on the response to the cookiejar + # in the new request. Because we've mutated our copied prepared + # request, use the old one that we haven't yet touched. + extract_cookies_to_jar(prepared_request._cookies, req, resp.raw) + merge_cookies(prepared_request._cookies, self.cookies) + prepared_request.prepare_cookies(prepared_request._cookies) + + # Rebuild auth and proxy information. + proxies = self.rebuild_proxies(prepared_request, proxies) + self.rebuild_auth(prepared_request, resp) + + # A failed tell() sets `_body_position` to `object()`. This non-None + # value ensures `rewindable` will be True, allowing us to raise an + # UnrewindableBodyError, instead of hanging the connection. + rewindable = prepared_request._body_position is not None and ( + "Content-Length" in headers or "Transfer-Encoding" in headers + ) + + # Attempt to rewind consumed file-like object. + if rewindable: + rewind_body(prepared_request) + + # Override the original request. + req = prepared_request + + if yield_requests: + yield req + else: + + resp = self.send( + req, + stream=stream, + timeout=timeout, + verify=verify, + cert=cert, + proxies=proxies, + allow_redirects=False, + **adapter_kwargs, + ) + + extract_cookies_to_jar(self.cookies, prepared_request, resp.raw) + + # extract redirect url, if any, for the next loop + url = self.get_redirect_target(resp) + yield resp + + def rebuild_auth(self, prepared_request, response): + """When being redirected we may want to strip authentication from the + request to avoid leaking credentials. This method intelligently removes + and reapplies authentication where possible to avoid credential loss. + """ + headers = prepared_request.headers + url = prepared_request.url + + if "Authorization" in headers and self.should_strip_auth( + response.request.url, url + ): + # If we get redirected to a new host, we should strip out any + # authentication headers. + del headers["Authorization"] + + # .netrc might have more auth for us on our new host. + new_auth = get_netrc_auth(url) if self.trust_env else None + if new_auth is not None: + prepared_request.prepare_auth(new_auth) + + def rebuild_proxies(self, prepared_request, proxies): + """This method re-evaluates the proxy configuration by considering the + environment variables. If we are redirected to a URL covered by + NO_PROXY, we strip the proxy configuration. Otherwise, we set missing + proxy keys for this URL (in case they were stripped by a previous + redirect). + + This method also replaces the Proxy-Authorization header where + necessary. + + :rtype: dict + """ + headers = prepared_request.headers + scheme = urlparse(prepared_request.url).scheme + new_proxies = resolve_proxies(prepared_request, proxies, self.trust_env) + + if "Proxy-Authorization" in headers: + del headers["Proxy-Authorization"] + + try: + username, password = get_auth_from_url(new_proxies[scheme]) + except KeyError: + username, password = None, None + + # urllib3 handles proxy authorization for us in the standard adapter. + # Avoid appending this to TLS tunneled requests where it may be leaked. + if not scheme.startswith('https') and username and password: + headers["Proxy-Authorization"] = _basic_auth_str(username, password) + + return new_proxies + + def rebuild_method(self, prepared_request, response): + """When being redirected we may want to change the method of the request + based on certain specs or browser behavior. + """ + method = prepared_request.method + + # https://tools.ietf.org/html/rfc7231#section-6.4.4 + if response.status_code == codes.see_other and method != "HEAD": + method = "GET" + + # Do what the browsers do, despite standards... + # First, turn 302s into GETs. + if response.status_code == codes.found and method != "HEAD": + method = "GET" + + # Second, if a POST is responded to with a 301, turn it into a GET. + # This bizarre behaviour is explained in Issue 1704. + if response.status_code == codes.moved and method == "POST": + method = "GET" + + prepared_request.method = method + + +class Session(SessionRedirectMixin): + """A Requests session. + + Provides cookie persistence, connection-pooling, and configuration. + + Basic Usage:: + + >>> import requests + >>> s = requests.Session() + >>> s.get('https://httpbin.org/get') + + + Or as a context manager:: + + >>> with requests.Session() as s: + ... s.get('https://httpbin.org/get') + + """ + + __attrs__ = [ + "headers", + "cookies", + "auth", + "proxies", + "hooks", + "params", + "verify", + "cert", + "adapters", + "stream", + "trust_env", + "max_redirects", + ] + + def __init__(self): + + #: A case-insensitive dictionary of headers to be sent on each + #: :class:`Request ` sent from this + #: :class:`Session `. + self.headers = default_headers() + + #: Default Authentication tuple or object to attach to + #: :class:`Request `. + self.auth = None + + #: Dictionary mapping protocol or protocol and host to the URL of the proxy + #: (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to + #: be used on each :class:`Request `. + self.proxies = {} + + #: Event-handling hooks. + self.hooks = default_hooks() + + #: Dictionary of querystring data to attach to each + #: :class:`Request `. The dictionary values may be lists for + #: representing multivalued query parameters. + self.params = {} + + #: Stream response content default. + self.stream = False + + #: SSL Verification default. + #: Defaults to `True`, requiring requests to verify the TLS certificate at the + #: remote end. + #: If verify is set to `False`, requests will accept any TLS certificate + #: presented by the server, and will ignore hostname mismatches and/or + #: expired certificates, which will make your application vulnerable to + #: man-in-the-middle (MitM) attacks. + #: Only set this to `False` for testing. + self.verify = True + + #: SSL client certificate default, if String, path to ssl client + #: cert file (.pem). If Tuple, ('cert', 'key') pair. + self.cert = None + + #: Maximum number of redirects allowed. If the request exceeds this + #: limit, a :class:`TooManyRedirects` exception is raised. + #: This defaults to requests.models.DEFAULT_REDIRECT_LIMIT, which is + #: 30. + self.max_redirects = DEFAULT_REDIRECT_LIMIT + + #: Trust environment settings for proxy configuration, default + #: authentication and similar. + self.trust_env = True + + #: A CookieJar containing all currently outstanding cookies set on this + #: session. By default it is a + #: :class:`RequestsCookieJar `, but + #: may be any other ``cookielib.CookieJar`` compatible object. + self.cookies = cookiejar_from_dict({}) + + # Default connection adapters. + self.adapters = OrderedDict() + self.mount("https://", HTTPAdapter()) + self.mount("http://", HTTPAdapter()) + + def __enter__(self): + return self + + def __exit__(self, *args): + self.close() + + def prepare_request(self, request): + """Constructs a :class:`PreparedRequest ` for + transmission and returns it. The :class:`PreparedRequest` has settings + merged from the :class:`Request ` instance and those of the + :class:`Session`. + + :param request: :class:`Request` instance to prepare with this + session's settings. + :rtype: requests.PreparedRequest + """ + cookies = request.cookies or {} + + # Bootstrap CookieJar. + if not isinstance(cookies, cookielib.CookieJar): + cookies = cookiejar_from_dict(cookies) + + # Merge with session cookies + merged_cookies = merge_cookies( + merge_cookies(RequestsCookieJar(), self.cookies), cookies + ) + + # Set environment's basic authentication if not explicitly set. + auth = request.auth + if self.trust_env and not auth and not self.auth: + auth = get_netrc_auth(request.url) + + p = PreparedRequest() + p.prepare( + method=request.method.upper(), + url=request.url, + files=request.files, + data=request.data, + json=request.json, + headers=merge_setting( + request.headers, self.headers, dict_class=CaseInsensitiveDict + ), + params=merge_setting(request.params, self.params), + auth=merge_setting(auth, self.auth), + cookies=merged_cookies, + hooks=merge_hooks(request.hooks, self.hooks), + ) + return p + + def request( + self, + method, + url, + params=None, + data=None, + headers=None, + cookies=None, + files=None, + auth=None, + timeout=None, + allow_redirects=True, + proxies=None, + hooks=None, + stream=None, + verify=None, + cert=None, + json=None, + ): + """Constructs a :class:`Request `, prepares it and sends it. + Returns :class:`Response ` object. + + :param method: method for the new :class:`Request` object. + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary or bytes to be sent in the query + string for the :class:`Request`. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) json to send in the body of the + :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the + :class:`Request`. + :param cookies: (optional) Dict or CookieJar object to send with the + :class:`Request`. + :param files: (optional) Dictionary of ``'filename': file-like-objects`` + for multipart encoding upload. + :param auth: (optional) Auth tuple or callable to enable + Basic/Digest/Custom HTTP Auth. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple + :param allow_redirects: (optional) Set to True by default. + :type allow_redirects: bool + :param proxies: (optional) Dictionary mapping protocol or protocol and + hostname to the URL of the proxy. + :param stream: (optional) whether to immediately download the response + content. Defaults to ``False``. + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use. Defaults to ``True``. When set to + ``False``, requests will accept any TLS certificate presented by + the server, and will ignore hostname mismatches and/or expired + certificates, which will make your application vulnerable to + man-in-the-middle (MitM) attacks. Setting verify to ``False`` + may be useful during local development or testing. + :param cert: (optional) if String, path to ssl client cert file (.pem). + If Tuple, ('cert', 'key') pair. + :rtype: requests.Response + """ + # Create the Request. + req = Request( + method=method.upper(), + url=url, + headers=headers, + files=files, + data=data or {}, + json=json, + params=params or {}, + auth=auth, + cookies=cookies, + hooks=hooks, + ) + prep = self.prepare_request(req) + + proxies = proxies or {} + + settings = self.merge_environment_settings( + prep.url, proxies, stream, verify, cert + ) + + # Send the request. + send_kwargs = { + "timeout": timeout, + "allow_redirects": allow_redirects, + } + send_kwargs.update(settings) + resp = self.send(prep, **send_kwargs) + + return resp + + def get(self, url, **kwargs): + r"""Sends a GET request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", True) + return self.request("GET", url, **kwargs) + + def options(self, url, **kwargs): + r"""Sends a OPTIONS request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", True) + return self.request("OPTIONS", url, **kwargs) + + def head(self, url, **kwargs): + r"""Sends a HEAD request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", False) + return self.request("HEAD", url, **kwargs) + + def post(self, url, data=None, json=None, **kwargs): + r"""Sends a POST request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) json to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("POST", url, data=data, json=json, **kwargs) + + def put(self, url, data=None, **kwargs): + r"""Sends a PUT request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("PUT", url, data=data, **kwargs) + + def patch(self, url, data=None, **kwargs): + r"""Sends a PATCH request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("PATCH", url, data=data, **kwargs) + + def delete(self, url, **kwargs): + r"""Sends a DELETE request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("DELETE", url, **kwargs) + + def send(self, request, **kwargs): + """Send a given PreparedRequest. + + :rtype: requests.Response + """ + # Set defaults that the hooks can utilize to ensure they always have + # the correct parameters to reproduce the previous request. + kwargs.setdefault("stream", self.stream) + kwargs.setdefault("verify", self.verify) + kwargs.setdefault("cert", self.cert) + if "proxies" not in kwargs: + kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env) + + # It's possible that users might accidentally send a Request object. + # Guard against that specific failure case. + if isinstance(request, Request): + raise ValueError("You can only send PreparedRequests.") + + # Set up variables needed for resolve_redirects and dispatching of hooks + allow_redirects = kwargs.pop("allow_redirects", True) + stream = kwargs.get("stream") + hooks = request.hooks + + # Get the appropriate adapter to use + adapter = self.get_adapter(url=request.url) + + # Start time (approximately) of the request + start = preferred_clock() + + # Send the request + r = adapter.send(request, **kwargs) + + # Total elapsed time of the request (approximately) + elapsed = preferred_clock() - start + r.elapsed = timedelta(seconds=elapsed) + + # Response manipulation hooks + r = dispatch_hook("response", hooks, r, **kwargs) + + # Persist cookies + if r.history: + + # If the hooks create history then we want those cookies too + for resp in r.history: + extract_cookies_to_jar(self.cookies, resp.request, resp.raw) + + extract_cookies_to_jar(self.cookies, request, r.raw) + + # Resolve redirects if allowed. + if allow_redirects: + # Redirect resolving generator. + gen = self.resolve_redirects(r, request, **kwargs) + history = [resp for resp in gen] + else: + history = [] + + # Shuffle things around if there's history. + if history: + # Insert the first (original) request at the start + history.insert(0, r) + # Get the last request made + r = history.pop() + r.history = history + + # If redirects aren't being followed, store the response on the Request for Response.next(). + if not allow_redirects: + try: + r._next = next( + self.resolve_redirects(r, request, yield_requests=True, **kwargs) + ) + except StopIteration: + pass + + if not stream: + r.content + + return r + + def merge_environment_settings(self, url, proxies, stream, verify, cert): + """ + Check the environment and merge it with some settings. + + :rtype: dict + """ + # Gather clues from the surrounding environment. + if self.trust_env: + # Set environment's proxies. + no_proxy = proxies.get("no_proxy") if proxies is not None else None + env_proxies = get_environ_proxies(url, no_proxy=no_proxy) + for (k, v) in env_proxies.items(): + proxies.setdefault(k, v) + + # Look for requests environment configuration + # and be compatible with cURL. + if verify is True or verify is None: + verify = ( + os.environ.get("REQUESTS_CA_BUNDLE") + or os.environ.get("CURL_CA_BUNDLE") + or verify + ) + + # Merge all the kwargs. + proxies = merge_setting(proxies, self.proxies) + stream = merge_setting(stream, self.stream) + verify = merge_setting(verify, self.verify) + cert = merge_setting(cert, self.cert) + + return {"proxies": proxies, "stream": stream, "verify": verify, "cert": cert} + + def get_adapter(self, url): + """ + Returns the appropriate connection adapter for the given URL. + + :rtype: requests.adapters.BaseAdapter + """ + for (prefix, adapter) in self.adapters.items(): + + if url.lower().startswith(prefix.lower()): + return adapter + + # Nothing matches :-/ + raise InvalidSchema(f"No connection adapters were found for {url!r}") + + def close(self): + """Closes all adapters and as such the session""" + for v in self.adapters.values(): + v.close() + + def mount(self, prefix, adapter): + """Registers a connection adapter to a prefix. + + Adapters are sorted in descending order by prefix length. + """ + self.adapters[prefix] = adapter + keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] + + for key in keys_to_move: + self.adapters[key] = self.adapters.pop(key) + + def __getstate__(self): + state = {attr: getattr(self, attr, None) for attr in self.__attrs__} + return state + + def __setstate__(self, state): + for attr, value in state.items(): + setattr(self, attr, value) + + +def session(): + """ + Returns a :class:`Session` for context-management. + + .. deprecated:: 1.0.0 + + This method has been deprecated since version 1.0.0 and is only kept for + backwards compatibility. New code should use :class:`~requests.sessions.Session` + to create a session. This may be removed at a future date. + + :rtype: Session + """ + return Session() diff --git a/billinglayer/python/requests/status_codes.py b/billinglayer/python/requests/status_codes.py new file mode 100644 index 0000000..4bd072b --- /dev/null +++ b/billinglayer/python/requests/status_codes.py @@ -0,0 +1,128 @@ +r""" +The ``codes`` object defines a mapping from common names for HTTP statuses +to their numerical codes, accessible either as attributes or as dictionary +items. + +Example:: + + >>> import requests + >>> requests.codes['temporary_redirect'] + 307 + >>> requests.codes.teapot + 418 + >>> requests.codes['\o/'] + 200 + +Some codes have multiple names, and both upper- and lower-case versions of +the names are allowed. For example, ``codes.ok``, ``codes.OK``, and +``codes.okay`` all correspond to the HTTP status code 200. +""" + +from .structures import LookupDict + +_codes = { + # Informational. + 100: ("continue",), + 101: ("switching_protocols",), + 102: ("processing",), + 103: ("checkpoint",), + 122: ("uri_too_long", "request_uri_too_long"), + 200: ("ok", "okay", "all_ok", "all_okay", "all_good", "\\o/", "✓"), + 201: ("created",), + 202: ("accepted",), + 203: ("non_authoritative_info", "non_authoritative_information"), + 204: ("no_content",), + 205: ("reset_content", "reset"), + 206: ("partial_content", "partial"), + 207: ("multi_status", "multiple_status", "multi_stati", "multiple_stati"), + 208: ("already_reported",), + 226: ("im_used",), + # Redirection. + 300: ("multiple_choices",), + 301: ("moved_permanently", "moved", "\\o-"), + 302: ("found",), + 303: ("see_other", "other"), + 304: ("not_modified",), + 305: ("use_proxy",), + 306: ("switch_proxy",), + 307: ("temporary_redirect", "temporary_moved", "temporary"), + 308: ( + "permanent_redirect", + "resume_incomplete", + "resume", + ), # "resume" and "resume_incomplete" to be removed in 3.0 + # Client Error. + 400: ("bad_request", "bad"), + 401: ("unauthorized",), + 402: ("payment_required", "payment"), + 403: ("forbidden",), + 404: ("not_found", "-o-"), + 405: ("method_not_allowed", "not_allowed"), + 406: ("not_acceptable",), + 407: ("proxy_authentication_required", "proxy_auth", "proxy_authentication"), + 408: ("request_timeout", "timeout"), + 409: ("conflict",), + 410: ("gone",), + 411: ("length_required",), + 412: ("precondition_failed", "precondition"), + 413: ("request_entity_too_large",), + 414: ("request_uri_too_large",), + 415: ("unsupported_media_type", "unsupported_media", "media_type"), + 416: ( + "requested_range_not_satisfiable", + "requested_range", + "range_not_satisfiable", + ), + 417: ("expectation_failed",), + 418: ("im_a_teapot", "teapot", "i_am_a_teapot"), + 421: ("misdirected_request",), + 422: ("unprocessable_entity", "unprocessable"), + 423: ("locked",), + 424: ("failed_dependency", "dependency"), + 425: ("unordered_collection", "unordered"), + 426: ("upgrade_required", "upgrade"), + 428: ("precondition_required", "precondition"), + 429: ("too_many_requests", "too_many"), + 431: ("header_fields_too_large", "fields_too_large"), + 444: ("no_response", "none"), + 449: ("retry_with", "retry"), + 450: ("blocked_by_windows_parental_controls", "parental_controls"), + 451: ("unavailable_for_legal_reasons", "legal_reasons"), + 499: ("client_closed_request",), + # Server Error. + 500: ("internal_server_error", "server_error", "/o\\", "✗"), + 501: ("not_implemented",), + 502: ("bad_gateway",), + 503: ("service_unavailable", "unavailable"), + 504: ("gateway_timeout",), + 505: ("http_version_not_supported", "http_version"), + 506: ("variant_also_negotiates",), + 507: ("insufficient_storage",), + 509: ("bandwidth_limit_exceeded", "bandwidth"), + 510: ("not_extended",), + 511: ("network_authentication_required", "network_auth", "network_authentication"), +} + +codes = LookupDict(name="status_codes") + + +def _init(): + for code, titles in _codes.items(): + for title in titles: + setattr(codes, title, code) + if not title.startswith(("\\", "/")): + setattr(codes, title.upper(), code) + + def doc(code): + names = ", ".join(f"``{n}``" for n in _codes[code]) + return "* %d: %s" % (code, names) + + global __doc__ + __doc__ = ( + __doc__ + "\n" + "\n".join(doc(code) for code in sorted(_codes)) + if __doc__ is not None + else None + ) + + +_init() diff --git a/billinglayer/python/requests/structures.py b/billinglayer/python/requests/structures.py new file mode 100644 index 0000000..188e13e --- /dev/null +++ b/billinglayer/python/requests/structures.py @@ -0,0 +1,99 @@ +""" +requests.structures +~~~~~~~~~~~~~~~~~~~ + +Data structures that power Requests. +""" + +from collections import OrderedDict + +from .compat import Mapping, MutableMapping + + +class CaseInsensitiveDict(MutableMapping): + """A case-insensitive ``dict``-like object. + + Implements all methods and operations of + ``MutableMapping`` as well as dict's ``copy``. Also + provides ``lower_items``. + + All keys are expected to be strings. The structure remembers the + case of the last key to be set, and ``iter(instance)``, + ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` + will contain case-sensitive keys. However, querying and contains + testing is case insensitive:: + + cid = CaseInsensitiveDict() + cid['Accept'] = 'application/json' + cid['aCCEPT'] == 'application/json' # True + list(cid) == ['Accept'] # True + + For example, ``headers['content-encoding']`` will return the + value of a ``'Content-Encoding'`` response header, regardless + of how the header name was originally stored. + + If the constructor, ``.update``, or equality comparison + operations are given keys that have equal ``.lower()``s, the + behavior is undefined. + """ + + def __init__(self, data=None, **kwargs): + self._store = OrderedDict() + if data is None: + data = {} + self.update(data, **kwargs) + + def __setitem__(self, key, value): + # Use the lowercased key for lookups, but store the actual + # key alongside the value. + self._store[key.lower()] = (key, value) + + def __getitem__(self, key): + return self._store[key.lower()][1] + + def __delitem__(self, key): + del self._store[key.lower()] + + def __iter__(self): + return (casedkey for casedkey, mappedvalue in self._store.values()) + + def __len__(self): + return len(self._store) + + def lower_items(self): + """Like iteritems(), but with all lowercase keys.""" + return ((lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items()) + + def __eq__(self, other): + if isinstance(other, Mapping): + other = CaseInsensitiveDict(other) + else: + return NotImplemented + # Compare insensitively + return dict(self.lower_items()) == dict(other.lower_items()) + + # Copy is required + def copy(self): + return CaseInsensitiveDict(self._store.values()) + + def __repr__(self): + return str(dict(self.items())) + + +class LookupDict(dict): + """Dictionary lookup object.""" + + def __init__(self, name=None): + self.name = name + super().__init__() + + def __repr__(self): + return f"" + + def __getitem__(self, key): + # We allow fall-through here, so values default to None + + return self.__dict__.get(key, None) + + def get(self, key, default=None): + return self.__dict__.get(key, default) diff --git a/billinglayer/python/requests/utils.py b/billinglayer/python/requests/utils.py new file mode 100644 index 0000000..a367417 --- /dev/null +++ b/billinglayer/python/requests/utils.py @@ -0,0 +1,1094 @@ +""" +requests.utils +~~~~~~~~~~~~~~ + +This module provides utility functions that are used within Requests +that are also useful for external consumption. +""" + +import codecs +import contextlib +import io +import os +import re +import socket +import struct +import sys +import tempfile +import warnings +import zipfile +from collections import OrderedDict + +from urllib3.util import make_headers, parse_url + +from . import certs +from .__version__ import __version__ + +# to_native_string is unused here, but imported here for backwards compatibility +from ._internal_utils import ( # noqa: F401 + _HEADER_VALIDATORS_BYTE, + _HEADER_VALIDATORS_STR, + HEADER_VALIDATORS, + to_native_string, +) +from .compat import ( + Mapping, + basestring, + bytes, + getproxies, + getproxies_environment, + integer_types, +) +from .compat import parse_http_list as _parse_list_header +from .compat import ( + proxy_bypass, + proxy_bypass_environment, + quote, + str, + unquote, + urlparse, + urlunparse, +) +from .cookies import cookiejar_from_dict +from .exceptions import ( + FileModeWarning, + InvalidHeader, + InvalidURL, + UnrewindableBodyError, +) +from .structures import CaseInsensitiveDict + +NETRC_FILES = (".netrc", "_netrc") + +DEFAULT_CA_BUNDLE_PATH = certs.where() + +DEFAULT_PORTS = {"http": 80, "https": 443} + +# Ensure that ', ' is used to preserve previous delimiter behavior. +DEFAULT_ACCEPT_ENCODING = ", ".join( + re.split(r",\s*", make_headers(accept_encoding=True)["accept-encoding"]) +) + + +if sys.platform == "win32": + # provide a proxy_bypass version on Windows without DNS lookups + + def proxy_bypass_registry(host): + try: + import winreg + except ImportError: + return False + + try: + internetSettings = winreg.OpenKey( + winreg.HKEY_CURRENT_USER, + r"Software\Microsoft\Windows\CurrentVersion\Internet Settings", + ) + # ProxyEnable could be REG_SZ or REG_DWORD, normalizing it + proxyEnable = int(winreg.QueryValueEx(internetSettings, "ProxyEnable")[0]) + # ProxyOverride is almost always a string + proxyOverride = winreg.QueryValueEx(internetSettings, "ProxyOverride")[0] + except (OSError, ValueError): + return False + if not proxyEnable or not proxyOverride: + return False + + # make a check value list from the registry entry: replace the + # '' string by the localhost entry and the corresponding + # canonical entry. + proxyOverride = proxyOverride.split(";") + # now check if we match one of the registry values. + for test in proxyOverride: + if test == "": + if "." not in host: + return True + test = test.replace(".", r"\.") # mask dots + test = test.replace("*", r".*") # change glob sequence + test = test.replace("?", r".") # change glob char + if re.match(test, host, re.I): + return True + return False + + def proxy_bypass(host): # noqa + """Return True, if the host should be bypassed. + + Checks proxy settings gathered from the environment, if specified, + or the registry. + """ + if getproxies_environment(): + return proxy_bypass_environment(host) + else: + return proxy_bypass_registry(host) + + +def dict_to_sequence(d): + """Returns an internal sequence dictionary update.""" + + if hasattr(d, "items"): + d = d.items() + + return d + + +def super_len(o): + total_length = None + current_position = 0 + + if hasattr(o, "__len__"): + total_length = len(o) + + elif hasattr(o, "len"): + total_length = o.len + + elif hasattr(o, "fileno"): + try: + fileno = o.fileno() + except (io.UnsupportedOperation, AttributeError): + # AttributeError is a surprising exception, seeing as how we've just checked + # that `hasattr(o, 'fileno')`. It happens for objects obtained via + # `Tarfile.extractfile()`, per issue 5229. + pass + else: + total_length = os.fstat(fileno).st_size + + # Having used fstat to determine the file length, we need to + # confirm that this file was opened up in binary mode. + if "b" not in o.mode: + warnings.warn( + ( + "Requests has determined the content-length for this " + "request using the binary size of the file: however, the " + "file has been opened in text mode (i.e. without the 'b' " + "flag in the mode). This may lead to an incorrect " + "content-length. In Requests 3.0, support will be removed " + "for files in text mode." + ), + FileModeWarning, + ) + + if hasattr(o, "tell"): + try: + current_position = o.tell() + except OSError: + # This can happen in some weird situations, such as when the file + # is actually a special file descriptor like stdin. In this + # instance, we don't know what the length is, so set it to zero and + # let requests chunk it instead. + if total_length is not None: + current_position = total_length + else: + if hasattr(o, "seek") and total_length is None: + # StringIO and BytesIO have seek but no usable fileno + try: + # seek to end of file + o.seek(0, 2) + total_length = o.tell() + + # seek back to current position to support + # partially read file-like objects + o.seek(current_position or 0) + except OSError: + total_length = 0 + + if total_length is None: + total_length = 0 + + return max(0, total_length - current_position) + + +def get_netrc_auth(url, raise_errors=False): + """Returns the Requests tuple auth for a given url from netrc.""" + + netrc_file = os.environ.get("NETRC") + if netrc_file is not None: + netrc_locations = (netrc_file,) + else: + netrc_locations = (f"~/{f}" for f in NETRC_FILES) + + try: + from netrc import NetrcParseError, netrc + + netrc_path = None + + for f in netrc_locations: + try: + loc = os.path.expanduser(f) + except KeyError: + # os.path.expanduser can fail when $HOME is undefined and + # getpwuid fails. See https://bugs.python.org/issue20164 & + # https://github.com/psf/requests/issues/1846 + return + + if os.path.exists(loc): + netrc_path = loc + break + + # Abort early if there isn't one. + if netrc_path is None: + return + + ri = urlparse(url) + + # Strip port numbers from netloc. This weird `if...encode`` dance is + # used for Python 3.2, which doesn't support unicode literals. + splitstr = b":" + if isinstance(url, str): + splitstr = splitstr.decode("ascii") + host = ri.netloc.split(splitstr)[0] + + try: + _netrc = netrc(netrc_path).authenticators(host) + if _netrc: + # Return with login / password + login_i = 0 if _netrc[0] else 1 + return (_netrc[login_i], _netrc[2]) + except (NetrcParseError, OSError): + # If there was a parsing error or a permissions issue reading the file, + # we'll just skip netrc auth unless explicitly asked to raise errors. + if raise_errors: + raise + + # App Engine hackiness. + except (ImportError, AttributeError): + pass + + +def guess_filename(obj): + """Tries to guess the filename of the given object.""" + name = getattr(obj, "name", None) + if name and isinstance(name, basestring) and name[0] != "<" and name[-1] != ">": + return os.path.basename(name) + + +def extract_zipped_paths(path): + """Replace nonexistent paths that look like they refer to a member of a zip + archive with the location of an extracted copy of the target, or else + just return the provided path unchanged. + """ + if os.path.exists(path): + # this is already a valid path, no need to do anything further + return path + + # find the first valid part of the provided path and treat that as a zip archive + # assume the rest of the path is the name of a member in the archive + archive, member = os.path.split(path) + while archive and not os.path.exists(archive): + archive, prefix = os.path.split(archive) + if not prefix: + # If we don't check for an empty prefix after the split (in other words, archive remains unchanged after the split), + # we _can_ end up in an infinite loop on a rare corner case affecting a small number of users + break + member = "/".join([prefix, member]) + + if not zipfile.is_zipfile(archive): + return path + + zip_file = zipfile.ZipFile(archive) + if member not in zip_file.namelist(): + return path + + # we have a valid zip archive and a valid member of that archive + tmp = tempfile.gettempdir() + extracted_path = os.path.join(tmp, member.split("/")[-1]) + if not os.path.exists(extracted_path): + # use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition + with atomic_open(extracted_path) as file_handler: + file_handler.write(zip_file.read(member)) + return extracted_path + + +@contextlib.contextmanager +def atomic_open(filename): + """Write a file to the disk in an atomic fashion""" + tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename)) + try: + with os.fdopen(tmp_descriptor, "wb") as tmp_handler: + yield tmp_handler + os.replace(tmp_name, filename) + except BaseException: + os.remove(tmp_name) + raise + + +def from_key_val_list(value): + """Take an object and test to see if it can be represented as a + dictionary. Unless it can not be represented as such, return an + OrderedDict, e.g., + + :: + + >>> from_key_val_list([('key', 'val')]) + OrderedDict([('key', 'val')]) + >>> from_key_val_list('string') + Traceback (most recent call last): + ... + ValueError: cannot encode objects that are not 2-tuples + >>> from_key_val_list({'key': 'val'}) + OrderedDict([('key', 'val')]) + + :rtype: OrderedDict + """ + if value is None: + return None + + if isinstance(value, (str, bytes, bool, int)): + raise ValueError("cannot encode objects that are not 2-tuples") + + return OrderedDict(value) + + +def to_key_val_list(value): + """Take an object and test to see if it can be represented as a + dictionary. If it can be, return a list of tuples, e.g., + + :: + + >>> to_key_val_list([('key', 'val')]) + [('key', 'val')] + >>> to_key_val_list({'key': 'val'}) + [('key', 'val')] + >>> to_key_val_list('string') + Traceback (most recent call last): + ... + ValueError: cannot encode objects that are not 2-tuples + + :rtype: list + """ + if value is None: + return None + + if isinstance(value, (str, bytes, bool, int)): + raise ValueError("cannot encode objects that are not 2-tuples") + + if isinstance(value, Mapping): + value = value.items() + + return list(value) + + +# From mitsuhiko/werkzeug (used with permission). +def parse_list_header(value): + """Parse lists as described by RFC 2068 Section 2. + + In particular, parse comma-separated lists where the elements of + the list may include quoted-strings. A quoted-string could + contain a comma. A non-quoted string could have quotes in the + middle. Quotes are removed automatically after parsing. + + It basically works like :func:`parse_set_header` just that items + may appear multiple times and case sensitivity is preserved. + + The return value is a standard :class:`list`: + + >>> parse_list_header('token, "quoted value"') + ['token', 'quoted value'] + + To create a header from the :class:`list` again, use the + :func:`dump_header` function. + + :param value: a string with a list header. + :return: :class:`list` + :rtype: list + """ + result = [] + for item in _parse_list_header(value): + if item[:1] == item[-1:] == '"': + item = unquote_header_value(item[1:-1]) + result.append(item) + return result + + +# From mitsuhiko/werkzeug (used with permission). +def parse_dict_header(value): + """Parse lists of key, value pairs as described by RFC 2068 Section 2 and + convert them into a python dict: + + >>> d = parse_dict_header('foo="is a fish", bar="as well"') + >>> type(d) is dict + True + >>> sorted(d.items()) + [('bar', 'as well'), ('foo', 'is a fish')] + + If there is no value for a key it will be `None`: + + >>> parse_dict_header('key_without_value') + {'key_without_value': None} + + To create a header from the :class:`dict` again, use the + :func:`dump_header` function. + + :param value: a string with a dict header. + :return: :class:`dict` + :rtype: dict + """ + result = {} + for item in _parse_list_header(value): + if "=" not in item: + result[item] = None + continue + name, value = item.split("=", 1) + if value[:1] == value[-1:] == '"': + value = unquote_header_value(value[1:-1]) + result[name] = value + return result + + +# From mitsuhiko/werkzeug (used with permission). +def unquote_header_value(value, is_filename=False): + r"""Unquotes a header value. (Reversal of :func:`quote_header_value`). + This does not use the real unquoting but what browsers are actually + using for quoting. + + :param value: the header value to unquote. + :rtype: str + """ + if value and value[0] == value[-1] == '"': + # this is not the real unquoting, but fixing this so that the + # RFC is met will result in bugs with internet explorer and + # probably some other browsers as well. IE for example is + # uploading files with "C:\foo\bar.txt" as filename + value = value[1:-1] + + # if this is a filename and the starting characters look like + # a UNC path, then just return the value without quotes. Using the + # replace sequence below on a UNC path has the effect of turning + # the leading double slash into a single slash and then + # _fix_ie_filename() doesn't work correctly. See #458. + if not is_filename or value[:2] != "\\\\": + return value.replace("\\\\", "\\").replace('\\"', '"') + return value + + +def dict_from_cookiejar(cj): + """Returns a key/value dictionary from a CookieJar. + + :param cj: CookieJar object to extract cookies from. + :rtype: dict + """ + + cookie_dict = {} + + for cookie in cj: + cookie_dict[cookie.name] = cookie.value + + return cookie_dict + + +def add_dict_to_cookiejar(cj, cookie_dict): + """Returns a CookieJar from a key/value dictionary. + + :param cj: CookieJar to insert cookies into. + :param cookie_dict: Dict of key/values to insert into CookieJar. + :rtype: CookieJar + """ + + return cookiejar_from_dict(cookie_dict, cj) + + +def get_encodings_from_content(content): + """Returns encodings from given content string. + + :param content: bytestring to extract encodings from. + """ + warnings.warn( + ( + "In requests 3.0, get_encodings_from_content will be removed. For " + "more information, please see the discussion on issue #2266. (This" + " warning should only appear once.)" + ), + DeprecationWarning, + ) + + charset_re = re.compile(r']', flags=re.I) + pragma_re = re.compile(r']', flags=re.I) + xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]') + + return ( + charset_re.findall(content) + + pragma_re.findall(content) + + xml_re.findall(content) + ) + + +def _parse_content_type_header(header): + """Returns content type and parameters from given header + + :param header: string + :return: tuple containing content type and dictionary of + parameters + """ + + tokens = header.split(";") + content_type, params = tokens[0].strip(), tokens[1:] + params_dict = {} + items_to_strip = "\"' " + + for param in params: + param = param.strip() + if param: + key, value = param, True + index_of_equals = param.find("=") + if index_of_equals != -1: + key = param[:index_of_equals].strip(items_to_strip) + value = param[index_of_equals + 1 :].strip(items_to_strip) + params_dict[key.lower()] = value + return content_type, params_dict + + +def get_encoding_from_headers(headers): + """Returns encodings from given HTTP Header Dict. + + :param headers: dictionary to extract encoding from. + :rtype: str + """ + + content_type = headers.get("content-type") + + if not content_type: + return None + + content_type, params = _parse_content_type_header(content_type) + + if "charset" in params: + return params["charset"].strip("'\"") + + if "text" in content_type: + return "ISO-8859-1" + + if "application/json" in content_type: + # Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset + return "utf-8" + + +def stream_decode_response_unicode(iterator, r): + """Stream decodes an iterator.""" + + if r.encoding is None: + yield from iterator + return + + decoder = codecs.getincrementaldecoder(r.encoding)(errors="replace") + for chunk in iterator: + rv = decoder.decode(chunk) + if rv: + yield rv + rv = decoder.decode(b"", final=True) + if rv: + yield rv + + +def iter_slices(string, slice_length): + """Iterate over slices of a string.""" + pos = 0 + if slice_length is None or slice_length <= 0: + slice_length = len(string) + while pos < len(string): + yield string[pos : pos + slice_length] + pos += slice_length + + +def get_unicode_from_response(r): + """Returns the requested content back in unicode. + + :param r: Response object to get unicode content from. + + Tried: + + 1. charset from content-type + 2. fall back and replace all unicode characters + + :rtype: str + """ + warnings.warn( + ( + "In requests 3.0, get_unicode_from_response will be removed. For " + "more information, please see the discussion on issue #2266. (This" + " warning should only appear once.)" + ), + DeprecationWarning, + ) + + tried_encodings = [] + + # Try charset from content-type + encoding = get_encoding_from_headers(r.headers) + + if encoding: + try: + return str(r.content, encoding) + except UnicodeError: + tried_encodings.append(encoding) + + # Fall back: + try: + return str(r.content, encoding, errors="replace") + except TypeError: + return r.content + + +# The unreserved URI characters (RFC 3986) +UNRESERVED_SET = frozenset( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~" +) + + +def unquote_unreserved(uri): + """Un-escape any percent-escape sequences in a URI that are unreserved + characters. This leaves all reserved, illegal and non-ASCII bytes encoded. + + :rtype: str + """ + parts = uri.split("%") + for i in range(1, len(parts)): + h = parts[i][0:2] + if len(h) == 2 and h.isalnum(): + try: + c = chr(int(h, 16)) + except ValueError: + raise InvalidURL(f"Invalid percent-escape sequence: '{h}'") + + if c in UNRESERVED_SET: + parts[i] = c + parts[i][2:] + else: + parts[i] = f"%{parts[i]}" + else: + parts[i] = f"%{parts[i]}" + return "".join(parts) + + +def requote_uri(uri): + """Re-quote the given URI. + + This function passes the given URI through an unquote/quote cycle to + ensure that it is fully and consistently quoted. + + :rtype: str + """ + safe_with_percent = "!#$%&'()*+,/:;=?@[]~" + safe_without_percent = "!#$&'()*+,/:;=?@[]~" + try: + # Unquote only the unreserved characters + # Then quote only illegal characters (do not quote reserved, + # unreserved, or '%') + return quote(unquote_unreserved(uri), safe=safe_with_percent) + except InvalidURL: + # We couldn't unquote the given URI, so let's try quoting it, but + # there may be unquoted '%'s in the URI. We need to make sure they're + # properly quoted so they do not cause issues elsewhere. + return quote(uri, safe=safe_without_percent) + + +def address_in_network(ip, net): + """This function allows you to check if an IP belongs to a network subnet + + Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 + returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 + + :rtype: bool + """ + ipaddr = struct.unpack("=L", socket.inet_aton(ip))[0] + netaddr, bits = net.split("/") + netmask = struct.unpack("=L", socket.inet_aton(dotted_netmask(int(bits))))[0] + network = struct.unpack("=L", socket.inet_aton(netaddr))[0] & netmask + return (ipaddr & netmask) == (network & netmask) + + +def dotted_netmask(mask): + """Converts mask from /xx format to xxx.xxx.xxx.xxx + + Example: if mask is 24 function returns 255.255.255.0 + + :rtype: str + """ + bits = 0xFFFFFFFF ^ (1 << 32 - mask) - 1 + return socket.inet_ntoa(struct.pack(">I", bits)) + + +def is_ipv4_address(string_ip): + """ + :rtype: bool + """ + try: + socket.inet_aton(string_ip) + except OSError: + return False + return True + + +def is_valid_cidr(string_network): + """ + Very simple check of the cidr format in no_proxy variable. + + :rtype: bool + """ + if string_network.count("/") == 1: + try: + mask = int(string_network.split("/")[1]) + except ValueError: + return False + + if mask < 1 or mask > 32: + return False + + try: + socket.inet_aton(string_network.split("/")[0]) + except OSError: + return False + else: + return False + return True + + +@contextlib.contextmanager +def set_environ(env_name, value): + """Set the environment variable 'env_name' to 'value' + + Save previous value, yield, and then restore the previous value stored in + the environment variable 'env_name'. + + If 'value' is None, do nothing""" + value_changed = value is not None + if value_changed: + old_value = os.environ.get(env_name) + os.environ[env_name] = value + try: + yield + finally: + if value_changed: + if old_value is None: + del os.environ[env_name] + else: + os.environ[env_name] = old_value + + +def should_bypass_proxies(url, no_proxy): + """ + Returns whether we should bypass proxies or not. + + :rtype: bool + """ + # Prioritize lowercase environment variables over uppercase + # to keep a consistent behaviour with other http projects (curl, wget). + def get_proxy(key): + return os.environ.get(key) or os.environ.get(key.upper()) + + # First check whether no_proxy is defined. If it is, check that the URL + # we're getting isn't in the no_proxy list. + no_proxy_arg = no_proxy + if no_proxy is None: + no_proxy = get_proxy("no_proxy") + parsed = urlparse(url) + + if parsed.hostname is None: + # URLs don't always have hostnames, e.g. file:/// urls. + return True + + if no_proxy: + # We need to check whether we match here. We need to see if we match + # the end of the hostname, both with and without the port. + no_proxy = (host for host in no_proxy.replace(" ", "").split(",") if host) + + if is_ipv4_address(parsed.hostname): + for proxy_ip in no_proxy: + if is_valid_cidr(proxy_ip): + if address_in_network(parsed.hostname, proxy_ip): + return True + elif parsed.hostname == proxy_ip: + # If no_proxy ip was defined in plain IP notation instead of cidr notation & + # matches the IP of the index + return True + else: + host_with_port = parsed.hostname + if parsed.port: + host_with_port += f":{parsed.port}" + + for host in no_proxy: + if parsed.hostname.endswith(host) or host_with_port.endswith(host): + # The URL does match something in no_proxy, so we don't want + # to apply the proxies on this URL. + return True + + with set_environ("no_proxy", no_proxy_arg): + # parsed.hostname can be `None` in cases such as a file URI. + try: + bypass = proxy_bypass(parsed.hostname) + except (TypeError, socket.gaierror): + bypass = False + + if bypass: + return True + + return False + + +def get_environ_proxies(url, no_proxy=None): + """ + Return a dict of environment proxies. + + :rtype: dict + """ + if should_bypass_proxies(url, no_proxy=no_proxy): + return {} + else: + return getproxies() + + +def select_proxy(url, proxies): + """Select a proxy for the url, if applicable. + + :param url: The url being for the request + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs + """ + proxies = proxies or {} + urlparts = urlparse(url) + if urlparts.hostname is None: + return proxies.get(urlparts.scheme, proxies.get("all")) + + proxy_keys = [ + urlparts.scheme + "://" + urlparts.hostname, + urlparts.scheme, + "all://" + urlparts.hostname, + "all", + ] + proxy = None + for proxy_key in proxy_keys: + if proxy_key in proxies: + proxy = proxies[proxy_key] + break + + return proxy + + +def resolve_proxies(request, proxies, trust_env=True): + """This method takes proxy information from a request and configuration + input to resolve a mapping of target proxies. This will consider settings + such a NO_PROXY to strip proxy configurations. + + :param request: Request or PreparedRequest + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs + :param trust_env: Boolean declaring whether to trust environment configs + + :rtype: dict + """ + proxies = proxies if proxies is not None else {} + url = request.url + scheme = urlparse(url).scheme + no_proxy = proxies.get("no_proxy") + new_proxies = proxies.copy() + + if trust_env and not should_bypass_proxies(url, no_proxy=no_proxy): + environ_proxies = get_environ_proxies(url, no_proxy=no_proxy) + + proxy = environ_proxies.get(scheme, environ_proxies.get("all")) + + if proxy: + new_proxies.setdefault(scheme, proxy) + return new_proxies + + +def default_user_agent(name="python-requests"): + """ + Return a string representing the default user agent. + + :rtype: str + """ + return f"{name}/{__version__}" + + +def default_headers(): + """ + :rtype: requests.structures.CaseInsensitiveDict + """ + return CaseInsensitiveDict( + { + "User-Agent": default_user_agent(), + "Accept-Encoding": DEFAULT_ACCEPT_ENCODING, + "Accept": "*/*", + "Connection": "keep-alive", + } + ) + + +def parse_header_links(value): + """Return a list of parsed link headers proxies. + + i.e. Link: ; rel=front; type="image/jpeg",; rel=back;type="image/jpeg" + + :rtype: list + """ + + links = [] + + replace_chars = " '\"" + + value = value.strip(replace_chars) + if not value: + return links + + for val in re.split(", *<", value): + try: + url, params = val.split(";", 1) + except ValueError: + url, params = val, "" + + link = {"url": url.strip("<> '\"")} + + for param in params.split(";"): + try: + key, value = param.split("=") + except ValueError: + break + + link[key.strip(replace_chars)] = value.strip(replace_chars) + + links.append(link) + + return links + + +# Null bytes; no need to recreate these on each call to guess_json_utf +_null = "\x00".encode("ascii") # encoding to ASCII for Python 3 +_null2 = _null * 2 +_null3 = _null * 3 + + +def guess_json_utf(data): + """ + :rtype: str + """ + # JSON always starts with two ASCII characters, so detection is as + # easy as counting the nulls and from their location and count + # determine the encoding. Also detect a BOM, if present. + sample = data[:4] + if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE): + return "utf-32" # BOM included + if sample[:3] == codecs.BOM_UTF8: + return "utf-8-sig" # BOM included, MS style (discouraged) + if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE): + return "utf-16" # BOM included + nullcount = sample.count(_null) + if nullcount == 0: + return "utf-8" + if nullcount == 2: + if sample[::2] == _null2: # 1st and 3rd are null + return "utf-16-be" + if sample[1::2] == _null2: # 2nd and 4th are null + return "utf-16-le" + # Did not detect 2 valid UTF-16 ascii-range characters + if nullcount == 3: + if sample[:3] == _null3: + return "utf-32-be" + if sample[1:] == _null3: + return "utf-32-le" + # Did not detect a valid UTF-32 ascii-range character + return None + + +def prepend_scheme_if_needed(url, new_scheme): + """Given a URL that may or may not have a scheme, prepend the given scheme. + Does not replace a present scheme with the one provided as an argument. + + :rtype: str + """ + parsed = parse_url(url) + scheme, auth, host, port, path, query, fragment = parsed + + # A defect in urlparse determines that there isn't a netloc present in some + # urls. We previously assumed parsing was overly cautious, and swapped the + # netloc and path. Due to a lack of tests on the original defect, this is + # maintained with parse_url for backwards compatibility. + netloc = parsed.netloc + if not netloc: + netloc, path = path, netloc + + if auth: + # parse_url doesn't provide the netloc with auth + # so we'll add it ourselves. + netloc = "@".join([auth, netloc]) + if scheme is None: + scheme = new_scheme + if path is None: + path = "" + + return urlunparse((scheme, netloc, path, "", query, fragment)) + + +def get_auth_from_url(url): + """Given a url with authentication components, extract them into a tuple of + username,password. + + :rtype: (str,str) + """ + parsed = urlparse(url) + + try: + auth = (unquote(parsed.username), unquote(parsed.password)) + except (AttributeError, TypeError): + auth = ("", "") + + return auth + + +def check_header_validity(header): + """Verifies that header parts don't contain leading whitespace + reserved characters, or return characters. + + :param header: tuple, in the format (name, value). + """ + name, value = header + _validate_header_part(header, name, 0) + _validate_header_part(header, value, 1) + + +def _validate_header_part(header, header_part, header_validator_index): + if isinstance(header_part, str): + validator = _HEADER_VALIDATORS_STR[header_validator_index] + elif isinstance(header_part, bytes): + validator = _HEADER_VALIDATORS_BYTE[header_validator_index] + else: + raise InvalidHeader( + f"Header part ({header_part!r}) from {header} " + f"must be of type str or bytes, not {type(header_part)}" + ) + + if not validator.match(header_part): + header_kind = "name" if header_validator_index == 0 else "value" + raise InvalidHeader( + f"Invalid leading whitespace, reserved character(s), or return" + f"character(s) in header {header_kind}: {header_part!r}" + ) + + +def urldefragauth(url): + """ + Given a url remove the fragment and the authentication part. + + :rtype: str + """ + scheme, netloc, path, params, query, fragment = urlparse(url) + + # see func:`prepend_scheme_if_needed` + if not netloc: + netloc, path = path, netloc + + netloc = netloc.rsplit("@", 1)[-1] + + return urlunparse((scheme, netloc, path, params, query, "")) + + +def rewind_body(prepared_request): + """Move file pointer back to its recorded starting position + so it can be read again on redirect. + """ + body_seek = getattr(prepared_request.body, "seek", None) + if body_seek is not None and isinstance( + prepared_request._body_position, integer_types + ): + try: + body_seek(prepared_request._body_position) + except OSError: + raise UnrewindableBodyError( + "An error occurred when rewinding request body for redirect." + ) + else: + raise UnrewindableBodyError("Unable to rewind request body for redirect.") diff --git a/billinglayer/python/shapely.libs/libgeos-ee7a1634.so.3.11.1 b/billinglayer/python/shapely.libs/libgeos-ee7a1634.so.3.11.1 new file mode 100755 index 0000000..43b8646 Binary files /dev/null and b/billinglayer/python/shapely.libs/libgeos-ee7a1634.so.3.11.1 differ diff --git a/billinglayer/python/shapely.libs/libgeos_c-5ef8a841.so.1.17.1 b/billinglayer/python/shapely.libs/libgeos_c-5ef8a841.so.1.17.1 new file mode 100755 index 0000000..6a848df Binary files /dev/null and b/billinglayer/python/shapely.libs/libgeos_c-5ef8a841.so.1.17.1 differ diff --git a/billinglayer/python/shapely/.DS_Store b/billinglayer/python/shapely/.DS_Store new file mode 100644 index 0000000..c3b716b Binary files /dev/null and b/billinglayer/python/shapely/.DS_Store differ diff --git a/billinglayer/python/shapely/__init__.py b/billinglayer/python/shapely/__init__.py new file mode 100644 index 0000000..5341ddf --- /dev/null +++ b/billinglayer/python/shapely/__init__.py @@ -0,0 +1,33 @@ +from .lib import GEOSException # NOQA +from .lib import Geometry # NOQA +from .lib import geos_version, geos_version_string # NOQA +from .lib import geos_capi_version, geos_capi_version_string # NOQA +from .errors import setup_signal_checks # NOQA +from ._geometry import * # NOQA +from .creation import * # NOQA +from .constructive import * # NOQA +from .predicates import * # NOQA +from .measurement import * # NOQA +from .set_operations import * # NOQA +from .linear import * # NOQA +from .coordinates import * # NOQA +from .strtree import * # NOQA +from .io import * # NOQA + +# Submodule always needs to be imported to ensure Geometry subclasses are registered +from shapely.geometry import ( # NOQA + Point, + LineString, + Polygon, + MultiPoint, + MultiLineString, + MultiPolygon, + GeometryCollection, + LinearRing, +) + +from . import _version + +__version__ = _version.get_versions()["version"] + +setup_signal_checks() diff --git a/billinglayer/python/shapely/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..5c062bf Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/_enum.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/_enum.cpython-311.pyc new file mode 100644 index 0000000..38059d3 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/_enum.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/_geometry.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/_geometry.cpython-311.pyc new file mode 100644 index 0000000..3cfa625 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/_geometry.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/_ragged_array.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/_ragged_array.cpython-311.pyc new file mode 100644 index 0000000..6440efb Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/_ragged_array.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/_version.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/_version.cpython-311.pyc new file mode 100644 index 0000000..35df216 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/_version.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/affinity.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/affinity.cpython-311.pyc new file mode 100644 index 0000000..515972b Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/affinity.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/constructive.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/constructive.cpython-311.pyc new file mode 100644 index 0000000..d9f799e Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/constructive.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/coordinates.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/coordinates.cpython-311.pyc new file mode 100644 index 0000000..53a6c8b Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/coordinates.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/coords.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/coords.cpython-311.pyc new file mode 100644 index 0000000..f518bc6 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/coords.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/creation.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/creation.cpython-311.pyc new file mode 100644 index 0000000..ac4b357 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/creation.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/decorators.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/decorators.cpython-311.pyc new file mode 100644 index 0000000..783ca97 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/decorators.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/errors.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/errors.cpython-311.pyc new file mode 100644 index 0000000..b9cf7f8 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/errors.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/geos.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/geos.cpython-311.pyc new file mode 100644 index 0000000..50b458d Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/geos.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/io.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/io.cpython-311.pyc new file mode 100644 index 0000000..6c84e63 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/io.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/linear.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/linear.cpython-311.pyc new file mode 100644 index 0000000..6e34e08 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/linear.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/measurement.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/measurement.cpython-311.pyc new file mode 100644 index 0000000..6428206 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/measurement.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/ops.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/ops.cpython-311.pyc new file mode 100644 index 0000000..66541a9 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/ops.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/plotting.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/plotting.cpython-311.pyc new file mode 100644 index 0000000..2b6d594 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/plotting.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/predicates.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/predicates.cpython-311.pyc new file mode 100644 index 0000000..1fd02c8 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/predicates.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/prepared.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/prepared.cpython-311.pyc new file mode 100644 index 0000000..beb0d91 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/prepared.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/set_operations.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/set_operations.cpython-311.pyc new file mode 100644 index 0000000..7e2f63a Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/set_operations.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/speedups.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/speedups.cpython-311.pyc new file mode 100644 index 0000000..9557d09 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/speedups.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/strtree.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/strtree.cpython-311.pyc new file mode 100644 index 0000000..0a37ea1 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/strtree.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/testing.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/testing.cpython-311.pyc new file mode 100644 index 0000000..ebc31b9 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/testing.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/validation.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/validation.cpython-311.pyc new file mode 100644 index 0000000..2031395 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/validation.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/wkb.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/wkb.cpython-311.pyc new file mode 100644 index 0000000..a43a142 Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/wkb.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/__pycache__/wkt.cpython-311.pyc b/billinglayer/python/shapely/__pycache__/wkt.cpython-311.pyc new file mode 100644 index 0000000..064341f Binary files /dev/null and b/billinglayer/python/shapely/__pycache__/wkt.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/_enum.py b/billinglayer/python/shapely/_enum.py new file mode 100644 index 0000000..c5cdb5a --- /dev/null +++ b/billinglayer/python/shapely/_enum.py @@ -0,0 +1,23 @@ +from enum import IntEnum + + +class ParamEnum(IntEnum): + """Wraps IntEnum to provide validation of a requested item. + + Intended for enums used for function parameters. + + Use enum.get_value(item) for this behavior instead of builtin enum[item]. + """ + + @classmethod + def get_value(cls, item): + """Validate incoming item and raise a ValueError with valid options if not present.""" + try: + return cls[item].value + except KeyError: + valid_options = {e.name for e in cls} + raise ValueError( + "'{}' is not a valid option, must be one of '{}'".format( + item, "', '".join(valid_options) + ) + ) diff --git a/billinglayer/python/shapely/_geometry.py b/billinglayer/python/shapely/_geometry.py new file mode 100644 index 0000000..50f7efa --- /dev/null +++ b/billinglayer/python/shapely/_geometry.py @@ -0,0 +1,886 @@ +import warnings +from enum import IntEnum + +import numpy as np + +from . import _geometry_helpers, geos_version, lib +from ._enum import ParamEnum +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "GeometryType", + "get_type_id", + "get_dimensions", + "get_coordinate_dimension", + "get_num_coordinates", + "get_srid", + "set_srid", + "get_x", + "get_y", + "get_z", + "get_exterior_ring", + "get_num_points", + "get_num_interior_rings", + "get_num_geometries", + "get_point", + "get_interior_ring", + "get_geometry", + "get_parts", + "get_rings", + "get_precision", + "set_precision", + "force_2d", + "force_3d", +] + + +class GeometryType(IntEnum): + """The enumeration of GEOS geometry types""" + + MISSING = -1 + POINT = 0 + LINESTRING = 1 + LINEARRING = 2 + POLYGON = 3 + MULTIPOINT = 4 + MULTILINESTRING = 5 + MULTIPOLYGON = 6 + GEOMETRYCOLLECTION = 7 + + +# generic + + +@multithreading_enabled +def get_type_id(geometry, **kwargs): + """Returns the type ID of a geometry. + + - None (missing) is -1 + - POINT is 0 + - LINESTRING is 1 + - LINEARRING is 2 + - POLYGON is 3 + - MULTIPOINT is 4 + - MULTILINESTRING is 5 + - MULTIPOLYGON is 6 + - GEOMETRYCOLLECTION is 7 + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + GeometryType + + Examples + -------- + >>> from shapely import LineString, Point + >>> get_type_id(LineString([(0, 0), (1, 1), (2, 2), (3, 3)])) + 1 + >>> get_type_id([Point(1, 2), Point(2, 3)]).tolist() + [0, 0] + """ + return lib.get_type_id(geometry, **kwargs) + + +@multithreading_enabled +def get_dimensions(geometry, **kwargs): + """Returns the inherent dimensionality of a geometry. + + The inherent dimension is 0 for points, 1 for linestrings and linearrings, + and 2 for polygons. For geometrycollections it is the max of the containing + elements. Empty collections and None values return -1. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, Point, Polygon + >>> point = Point(0, 0) + >>> get_dimensions(point) + 0 + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> get_dimensions(polygon) + 2 + >>> get_dimensions(GeometryCollection([point, polygon])) + 2 + >>> get_dimensions(GeometryCollection([])) + -1 + >>> get_dimensions(None) + -1 + """ + return lib.get_dimensions(geometry, **kwargs) + + +@multithreading_enabled +def get_coordinate_dimension(geometry, **kwargs): + """Returns the dimensionality of the coordinates in a geometry (2 or 3). + + Returns -1 for missing geometries (``None`` values). Note that if the first Z + coordinate equals ``nan``, this function will return ``2``. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> get_coordinate_dimension(Point(0, 0)) + 2 + >>> get_coordinate_dimension(Point(0, 0, 1)) + 3 + >>> get_coordinate_dimension(None) + -1 + >>> get_coordinate_dimension(Point(0, 0, float("nan"))) + 2 + """ + return lib.get_coordinate_dimension(geometry, **kwargs) + + +@multithreading_enabled +def get_num_coordinates(geometry, **kwargs): + """Returns the total number of coordinates in a geometry. + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Point + >>> point = Point(0, 0) + >>> get_num_coordinates(point) + 1 + >>> get_num_coordinates(Point(0, 0, 0)) + 1 + >>> line = LineString([(0, 0), (1, 1)]) + >>> get_num_coordinates(line) + 2 + >>> get_num_coordinates(GeometryCollection([point, line])) + 3 + >>> get_num_coordinates(None) + 0 + """ + return lib.get_num_coordinates(geometry, **kwargs) + + +@multithreading_enabled +def get_srid(geometry, **kwargs): + """Returns the SRID of a geometry. + + Returns -1 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + set_srid + + Examples + -------- + >>> from shapely import Point + >>> point = Point(0, 0) + >>> get_srid(point) + 0 + >>> with_srid = set_srid(point, 4326) + >>> get_srid(with_srid) + 4326 + """ + return lib.get_srid(geometry, **kwargs) + + +@multithreading_enabled +def set_srid(geometry, srid, **kwargs): + """Returns a geometry with its SRID set. + + Parameters + ---------- + geometry : Geometry or array_like + srid : int + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_srid + + Examples + -------- + >>> from shapely import Point + >>> point = Point(0, 0) + >>> get_srid(point) + 0 + >>> with_srid = set_srid(point, 4326) + >>> get_srid(with_srid) + 4326 + """ + return lib.set_srid(geometry, np.intc(srid), **kwargs) + + +# points + + +@multithreading_enabled +def get_x(point, **kwargs): + """Returns the x-coordinate of a point + + Parameters + ---------- + point : Geometry or array_like + Non-point geometries will result in NaN being returned. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_y, get_z + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_x(Point(1, 2)) + 1.0 + >>> get_x(MultiPoint([(1, 1), (1, 2)])) + nan + """ + return lib.get_x(point, **kwargs) + + +@multithreading_enabled +def get_y(point, **kwargs): + """Returns the y-coordinate of a point + + Parameters + ---------- + point : Geometry or array_like + Non-point geometries will result in NaN being returned. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_x, get_z + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_y(Point(1, 2)) + 2.0 + >>> get_y(MultiPoint([(1, 1), (1, 2)])) + nan + """ + return lib.get_y(point, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def get_z(point, **kwargs): + """Returns the z-coordinate of a point. + + Parameters + ---------- + point : Geometry or array_like + Non-point geometries or geometries without 3rd dimension will result + in NaN being returned. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_x, get_y + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_z(Point(1, 2, 3)) + 3.0 + >>> get_z(Point(1, 2)) + nan + >>> get_z(MultiPoint([(1, 1, 1), (2, 2, 2)])) + nan + """ + return lib.get_z(point, **kwargs) + + +# linestrings + + +@multithreading_enabled +def get_point(geometry, index, **kwargs): + """Returns the nth point of a linestring or linearring. + + Parameters + ---------- + geometry : Geometry or array_like + index : int or array_like + Negative values count from the end of the linestring backwards. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_num_points + + Examples + -------- + >>> from shapely import LinearRing, LineString, MultiPoint, Point + >>> line = LineString([(0, 0), (1, 1), (2, 2), (3, 3)]) + >>> get_point(line, 1) + + >>> get_point(line, -2) + + >>> get_point(line, [0, 3]).tolist() + [, ] + + The functcion works the same for LinearRing input: + + >>> get_point(LinearRing([(0, 0), (1, 1), (2, 2), (0, 0)]), 1) + + + For non-linear geometries it returns None: + + >>> get_point(MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)]), 1) is None + True + >>> get_point(Point(1, 1), 0) is None + True + """ + return lib.get_point(geometry, np.intc(index), **kwargs) + + +@multithreading_enabled +def get_num_points(geometry, **kwargs): + """Returns number of points in a linestring or linearring. + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + The number of points in geometries other than linestring or linearring + equals zero. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_point + get_num_geometries + + Examples + -------- + >>> from shapely import LineString, MultiPoint + >>> get_num_points(LineString([(0, 0), (1, 1), (2, 2), (3, 3)])) + 4 + >>> get_num_points(MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)])) + 0 + >>> get_num_points(None) + 0 + """ + return lib.get_num_points(geometry, **kwargs) + + +# polygons + + +@multithreading_enabled +def get_exterior_ring(geometry, **kwargs): + """Returns the exterior ring of a polygon. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_interior_ring + + Examples + -------- + >>> from shapely import Point, Polygon + >>> get_exterior_ring(Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])) + + >>> get_exterior_ring(Point(1, 1)) is None + True + """ + return lib.get_exterior_ring(geometry, **kwargs) + + +@multithreading_enabled +def get_interior_ring(geometry, index, **kwargs): + """Returns the nth interior ring of a polygon. + + Parameters + ---------- + geometry : Geometry or array_like + index : int or array_like + Negative values count from the end of the interior rings backwards. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_exterior_ring + get_num_interior_rings + + Examples + -------- + >>> from shapely import Point, Polygon + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> get_interior_ring(polygon_with_hole, 0) + + >>> get_interior_ring(polygon_with_hole, 1) is None + True + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> get_interior_ring(polygon, 0) is None + True + >>> get_interior_ring(Point(0, 0), 0) is None + True + """ + return lib.get_interior_ring(geometry, np.intc(index), **kwargs) + + +@multithreading_enabled +def get_num_interior_rings(geometry, **kwargs): + """Returns number of internal rings in a polygon + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + The number of interior rings in non-polygons equals zero. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_exterior_ring + get_interior_ring + + Examples + -------- + >>> from shapely import Point, Polygon + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> get_num_interior_rings(polygon) + 0 + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> get_num_interior_rings(polygon_with_hole) + 1 + >>> get_num_interior_rings(Point(0, 0)) + 0 + >>> get_num_interior_rings(None) + 0 + """ + return lib.get_num_interior_rings(geometry, **kwargs) + + +# collections + + +@multithreading_enabled +def get_geometry(geometry, index, **kwargs): + """Returns the nth geometry from a collection of geometries. + + Parameters + ---------- + geometry : Geometry or array_like + index : int or array_like + Negative values count from the end of the collection backwards. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Notes + ----- + - simple geometries act as length-1 collections + - out-of-range values return None + + See also + -------- + get_num_geometries, get_parts + + Examples + -------- + >>> from shapely import Point, MultiPoint + >>> multipoint = MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)]) + >>> get_geometry(multipoint, 1) + + >>> get_geometry(multipoint, -1) + + >>> get_geometry(multipoint, 5) is None + True + >>> get_geometry(Point(1, 1), 0) + + >>> get_geometry(Point(1, 1), 1) is None + True + """ + return lib.get_geometry(geometry, np.intc(index), **kwargs) + + +def get_parts(geometry, return_index=False): + """Gets parts of each GeometryCollection or Multi* geometry object; returns + a copy of each geometry in the GeometryCollection or Multi* geometry object. + + Note: This does not return the individual parts of Multi* geometry objects in + a GeometryCollection. You may need to call this function multiple times to + return individual parts of Multi* geometry objects in a GeometryCollection. + + Parameters + ---------- + geometry : Geometry or array_like + return_index : bool, default False + If True, will return a tuple of ndarrays of (parts, indexes), where indexes + are the indexes of the original geometries in the source array. + + Returns + ------- + ndarray of parts or tuple of (parts, indexes) + + See also + -------- + get_geometry, get_rings + + Examples + -------- + >>> from shapely import MultiPoint + >>> get_parts(MultiPoint([(0, 1), (2, 3)])).tolist() + [, ] + >>> parts, index = get_parts([MultiPoint([(0, 1)]), MultiPoint([(4, 5), (6, 7)])], \ +return_index=True) + >>> parts.tolist() + [, , ] + >>> index.tolist() + [0, 1, 1] + """ + geometry = np.asarray(geometry, dtype=np.object_) + geometry = np.atleast_1d(geometry) + + if geometry.ndim != 1: + raise ValueError("Array should be one dimensional") + + if return_index: + return _geometry_helpers.get_parts(geometry) + + return _geometry_helpers.get_parts(geometry)[0] + + +def get_rings(geometry, return_index=False): + """Gets rings of Polygon geometry object. + + For each Polygon, the first returned ring is always the exterior ring + and potential subsequent rings are interior rings. + + If the geometry is not a Polygon, nothing is returned (empty array for + scalar geometry input or no element in output array for array input). + + Parameters + ---------- + geometry : Geometry or array_like + return_index : bool, default False + If True, will return a tuple of ndarrays of (rings, indexes), where + indexes are the indexes of the original geometries in the source array. + + Returns + ------- + ndarray of rings or tuple of (rings, indexes) + + See also + -------- + get_exterior_ring, get_interior_ring, get_parts + + Examples + -------- + >>> from shapely import Polygon + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> get_rings(polygon_with_hole).tolist() + [, + ] + + With ``return_index=True``: + + >>> polygon = Polygon([(0, 0), (2, 0), (2, 2), (0, 2), (0, 0)]) + >>> rings, index = get_rings([polygon, polygon_with_hole], return_index=True) + >>> rings.tolist() + [, + , + ] + >>> index.tolist() + [0, 1, 1] + """ + geometry = np.asarray(geometry, dtype=np.object_) + geometry = np.atleast_1d(geometry) + + if geometry.ndim != 1: + raise ValueError("Array should be one dimensional") + + if return_index: + return _geometry_helpers.get_parts(geometry, extract_rings=True) + + return _geometry_helpers.get_parts(geometry, extract_rings=True)[0] + + +@multithreading_enabled +def get_num_geometries(geometry, **kwargs): + """Returns number of geometries in a collection. + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + The number of geometries in points, linestrings, linearrings and + polygons equals one. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_num_points + get_geometry + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_num_geometries(MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)])) + 4 + >>> get_num_geometries(Point(1, 1)) + 1 + >>> get_num_geometries(None) + 0 + """ + return lib.get_num_geometries(geometry, **kwargs) + + +@requires_geos("3.6.0") +@multithreading_enabled +def get_precision(geometry, **kwargs): + """Get the precision of a geometry. + + If a precision has not been previously set, it will be 0 (double + precision). Otherwise, it will return the precision grid size that was + set on a geometry. + + Returns NaN for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + set_precision + + Examples + -------- + >>> from shapely import Point + >>> point = Point(1, 1) + >>> get_precision(point) + 0.0 + >>> geometry = set_precision(point, 1.0) + >>> get_precision(geometry) + 1.0 + >>> get_precision(None) + nan + """ + return lib.get_precision(geometry, **kwargs) + + +class SetPrecisionMode(ParamEnum): + valid_output = 0 + pointwise = 1 + keep_collapsed = 2 + + +@requires_geos("3.6.0") +@multithreading_enabled +def set_precision(geometry, grid_size, mode="valid_output", **kwargs): + """Returns geometry with the precision set to a precision grid size. + + By default, geometries use double precision coordinates (grid_size = 0). + + Coordinates will be rounded if a precision grid is less precise than the + input geometry. Duplicated vertices will be dropped from lines and + polygons for grid sizes greater than 0. Line and polygon geometries may + collapse to empty geometries if all vertices are closer together than + grid_size. Z values, if present, will not be modified. + + Note: subsequent operations will always be performed in the precision of + the geometry with higher precision (smaller "grid_size"). That same + precision will be attached to the operation outputs. + + Also note: input geometries should be geometrically valid; unexpected + results may occur if input geometries are not. + + Returns None if geometry is None. + + Parameters + ---------- + geometry : Geometry or array_like + grid_size : float + Precision grid size. If 0, will use double precision (will not modify + geometry if precision grid size was not previously set). If this + value is more precise than input geometry, the input geometry will + not be modified. + mode : {'valid_output', 'pointwise', 'keep_collapsed'}, default 'valid_output' + This parameter determines how to handle invalid output geometries. There are three modes: + + 1. `'valid_output'` (default): The output is always valid. Collapsed geometry elements + (including both polygons and lines) are removed. Duplicate vertices are removed. + 2. `'pointwise'`: Precision reduction is performed pointwise. Output geometry + may be invalid due to collapse or self-intersection. Duplicate vertices are not + removed. In GEOS this option is called NO_TOPO. + + .. note:: + + 'pointwise' mode requires at least GEOS 3.10. It is accepted in earlier versions, + but the results may be unexpected. + 3. `'keep_collapsed'`: Like the default mode, except that collapsed linear geometry + elements are preserved. Collapsed polygonal input elements are removed. Duplicate + vertices are removed. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_precision + + Examples + -------- + >>> from shapely import LineString, Point + >>> set_precision(Point(0.9, 0.9), 1.0) + + >>> set_precision(Point(0.9, 0.9, 0.9), 1.0) + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0, 1), (1, 1)]), 1.0) + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0.1, 0.1)]), 1.0, mode="valid_output") + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0.1, 0.1)]), 1.0, mode="pointwise") + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0.1, 0.1)]), 1.0, mode="keep_collapsed") + + >>> set_precision(None, 1.0) is None + True + """ + if isinstance(mode, str): + mode = SetPrecisionMode.get_value(mode) + elif not np.isscalar(mode): + raise TypeError("mode only accepts scalar values") + if mode == SetPrecisionMode.pointwise and geos_version < (3, 10, 0): + warnings.warn( + "'pointwise' is only supported for GEOS 3.10", + UserWarning, + stacklevel=2, + ) + return lib.set_precision(geometry, grid_size, np.intc(mode), **kwargs) + + +@multithreading_enabled +def force_2d(geometry, **kwargs): + """Forces the dimensionality of a geometry to 2D. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon, from_wkt + >>> force_2d(Point(0, 0, 1)) + + >>> force_2d(Point(0, 0)) + + >>> force_2d(LineString([(0, 0, 0), (0, 1, 1), (1, 1, 2)])) + + >>> force_2d(from_wkt("POLYGON Z EMPTY")) + + >>> force_2d(None) is None + True + """ + return lib.force_2d(geometry, **kwargs) + + +@multithreading_enabled +def force_3d(geometry, z=0.0, **kwargs): + """Forces the dimensionality of a geometry to 3D. + + 2D geometries will get the provided Z coordinate; Z coordinates of 3D geometries + are unchanged (unless they are nan). + + Note that for empty geometries, 3D is only supported since GEOS 3.9 and then + still only for simple geometries (non-collections). + + Parameters + ---------- + geometry : Geometry or array_like + z : float or array_like, default 0.0 + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> force_3d(Point(0, 0), z=3) + + >>> force_3d(Point(0, 0, 0), z=3) + + >>> force_3d(LineString([(0, 0), (0, 1), (1, 1)])) + + >>> force_3d(None) is None + True + """ + if np.isnan(z).any(): + raise ValueError("It is not allowed to set the Z coordinate to NaN.") + return lib.force_3d(geometry, z, **kwargs) diff --git a/billinglayer/python/shapely/_geometry_helpers.cpython-311-x86_64-linux-gnu.so b/billinglayer/python/shapely/_geometry_helpers.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..1285b17 Binary files /dev/null and b/billinglayer/python/shapely/_geometry_helpers.cpython-311-x86_64-linux-gnu.so differ diff --git a/billinglayer/python/shapely/_geos.cpython-311-x86_64-linux-gnu.so b/billinglayer/python/shapely/_geos.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..5f5494f Binary files /dev/null and b/billinglayer/python/shapely/_geos.cpython-311-x86_64-linux-gnu.so differ diff --git a/billinglayer/python/shapely/_geos.pxd b/billinglayer/python/shapely/_geos.pxd new file mode 100644 index 0000000..0374690 --- /dev/null +++ b/billinglayer/python/shapely/_geos.pxd @@ -0,0 +1,51 @@ +""" +Provides a wrapper for GEOS types and functions. + +Note: GEOS functions in Cython must be called using the get_geos_handle context manager. +Example: + with get_geos_handle() as geos_handle: + SomeGEOSFunc(geos_handle, ...) +""" + +cdef extern from "geos_c.h": + # Types + ctypedef void *GEOSContextHandle_t + ctypedef struct GEOSGeometry + ctypedef struct GEOSCoordSequence + ctypedef void (*GEOSMessageHandler_r)(const char *message, void *userdata) + + # GEOS Context & Messaging + GEOSContextHandle_t GEOS_init_r() nogil + void GEOS_finish_r(GEOSContextHandle_t handle) nogil + void GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t handle, GEOSMessageHandler_r ef, void* userData) nogil + void GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t handle, GEOSMessageHandler_r nf, void* userData) nogil + + # Geometry functions + const GEOSGeometry* GEOSGetGeometryN_r(GEOSContextHandle_t handle, const GEOSGeometry* g, int n) nogil + const GEOSGeometry* GEOSGetExteriorRing_r(GEOSContextHandle_t handle, const GEOSGeometry* g) nogil + const GEOSGeometry* GEOSGetInteriorRingN_r(GEOSContextHandle_t handle, const GEOSGeometry* g, int n) nogil + int GEOSGeomTypeId_r(GEOSContextHandle_t handle, GEOSGeometry* g) nogil + + # Geometry creation / destruction + GEOSGeometry* GEOSGeom_clone_r(GEOSContextHandle_t handle, const GEOSGeometry* g) nogil + GEOSGeometry* GEOSGeom_createPoint_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + GEOSGeometry* GEOSGeom_createLineString_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + GEOSGeometry* GEOSGeom_createLinearRing_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + GEOSGeometry* GEOSGeom_createEmptyPolygon_r(GEOSContextHandle_t handle) nogil + GEOSGeometry* GEOSGeom_createPolygon_r(GEOSContextHandle_t handle, GEOSGeometry* shell, GEOSGeometry** holes, unsigned int nholes) nogil + GEOSGeometry* GEOSGeom_createCollection_r(GEOSContextHandle_t handle, int type, GEOSGeometry** geoms, unsigned int ngeoms) nogil + void GEOSGeom_destroy_r(GEOSContextHandle_t handle, GEOSGeometry* g) nogil + + # Coordinate sequences + GEOSCoordSequence* GEOSCoordSeq_create_r(GEOSContextHandle_t handle, unsigned int size, unsigned int dims) nogil + void GEOSCoordSeq_destroy_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + int GEOSCoordSeq_setX_r(GEOSContextHandle_t handle, GEOSCoordSequence* s, unsigned int idx, double val) nogil + int GEOSCoordSeq_setY_r(GEOSContextHandle_t handle, GEOSCoordSequence* s, unsigned int idx, double val) nogil + int GEOSCoordSeq_setZ_r(GEOSContextHandle_t handle, GEOSCoordSequence* s, unsigned int idx, double val) nogil + + +cdef class get_geos_handle: + cdef GEOSContextHandle_t handle + cdef char* last_error + cdef char* last_warning + cdef GEOSContextHandle_t __enter__(self) diff --git a/billinglayer/python/shapely/_pygeos_api.pxd b/billinglayer/python/shapely/_pygeos_api.pxd new file mode 100644 index 0000000..d15acdd --- /dev/null +++ b/billinglayer/python/shapely/_pygeos_api.pxd @@ -0,0 +1,35 @@ +""" +Provides a wrapper for the shapely.lib C API for use in Cython. +Internally, the shapely C extension uses a PyCapsule to provide run-time access +to function pointers within the C API. + +To use these functions, you must first call the following function in each Cython module: +`import_shapely_c_api()` + +This uses a macro to dynamically load the functions from pointers in the PyCapsule. +Each C function in shapely.lib exposed in the C API must be specially-wrapped to enable +this capability. + +Segfaults will occur if the C API is not imported properly. +""" + +cimport numpy as np +from cpython.ref cimport PyObject + +from shapely._geos cimport GEOSContextHandle_t, GEOSCoordSequence, GEOSGeometry + + +cdef extern from "c_api.h": + # shapely.lib C API loader; returns -1 on error + # MUST be called before calling other C API functions + int import_shapely_c_api() except -1 + + # C functions provided by the shapely.lib C API + # Note: GeometryObjects are always managed as Python objects + # in Cython to avoid memory leaks, not PyObject* (even though + # they are declared that way in the header file). + object PyGEOS_CreateGeometry(GEOSGeometry *ptr, GEOSContextHandle_t ctx) + char PyGEOS_GetGEOSGeometry(PyObject *obj, GEOSGeometry **out) nogil + GEOSCoordSequence* PyGEOS_CoordSeq_FromBuffer(GEOSContextHandle_t ctx, const double* buf, + unsigned int size, unsigned int dims, + char ring_closure) nogil diff --git a/billinglayer/python/shapely/_ragged_array.py b/billinglayer/python/shapely/_ragged_array.py new file mode 100644 index 0000000..933c47b --- /dev/null +++ b/billinglayer/python/shapely/_ragged_array.py @@ -0,0 +1,452 @@ +""" +This modules provides a conversion to / from a ragged (or "jagged") array +representation of the geometries. + +A ragged array is an irregular array of arrays of which each element can have +a different length. As a result, such an array cannot be represented as a +standard, rectangular nD array. +The coordinates of geometries can be represented as arrays of arrays of +coordinate pairs (possibly multiple levels of nesting, depending on the +geometry type). + + +Geometries, as a ragged array of coordinates, can be efficiently represented +as contiguous arrays of coordinates provided that there is another data +structure that keeps track of which range of coordinate values corresponds +to a given geometry. This can be done using offsets, counts, or indices. + +This module currently implements offsets into the coordinates array. This +is the ragged array representation defined by the the Apache Arrow project +as "variable size list array" (https://arrow.apache.org/docs/format/Columnar.html#variable-size-list-layout). +See for example https://cfconventions.org/Data/cf-conventions/cf-conventions-1.9/cf-conventions.html#representations-features +for different options. + +The exact usage of the Arrow list array with varying degrees of nesting for the +different geometry types is defined by the GeoArrow project: +https://github.com/geoarrow/geoarrow + +""" +import numpy as np + +from . import creation +from ._geometry import ( + GeometryType, + get_coordinate_dimension, + get_parts, + get_rings, + get_type_id, +) +from .coordinates import get_coordinates +from .predicates import is_empty + +__all__ = ["to_ragged_array", "from_ragged_array"] + + +# # GEOS -> coords/offset arrays (to_ragged_array) + + +def _get_arrays_point(arr, include_z): + # only one array of coordinates + coords = get_coordinates(arr, include_z=include_z) + + # empty points are represented by NaNs + empties = is_empty(arr) + if empties.any(): + indices = np.nonzero(empties)[0] + indices = indices - np.arange(len(indices)) + coords = np.insert(coords, indices, np.nan, axis=0) + + return coords, () + + +def _indices_to_offsets(indices, n): + offsets = np.insert(np.bincount(indices).cumsum(), 0, 0) + if len(offsets) != n + 1: + # last geometries might be empty or missing + offsets = np.pad( + offsets, + (0, n + 1 - len(offsets)), + "constant", + constant_values=offsets[-1], + ) + return offsets + + +def _get_arrays_multipoint(arr, include_z): + # explode/flatten the MultiPoints + _, part_indices = get_parts(arr, return_index=True) + # the offsets into the multipoint parts + offsets = _indices_to_offsets(part_indices, len(arr)) + + # only one array of coordinates + coords = get_coordinates(arr, include_z=include_z) + + return coords, (offsets,) + + +def _get_arrays_linestring(arr, include_z): + # the coords and offsets into the coordinates of the linestrings + coords, indices = get_coordinates(arr, return_index=True, include_z=include_z) + offsets = _indices_to_offsets(indices, len(arr)) + + return coords, (offsets,) + + +def _get_arrays_multilinestring(arr, include_z): + # explode/flatten the MultiLineStrings + arr_flat, part_indices = get_parts(arr, return_index=True) + # the offsets into the multilinestring parts + offsets2 = _indices_to_offsets(part_indices, len(arr)) + + # the coords and offsets into the coordinates of the linestrings + coords, indices = get_coordinates(arr_flat, return_index=True, include_z=include_z) + offsets1 = np.insert(np.bincount(indices).cumsum(), 0, 0) + + return coords, (offsets1, offsets2) + + +def _get_arrays_polygon(arr, include_z): + # explode/flatten the Polygons into Rings + arr_flat, ring_indices = get_rings(arr, return_index=True) + # the offsets into the exterior/interior rings of the multipolygon parts + offsets2 = _indices_to_offsets(ring_indices, len(arr)) + + # the coords and offsets into the coordinates of the rings + coords, indices = get_coordinates(arr_flat, return_index=True, include_z=include_z) + offsets1 = np.insert(np.bincount(indices).cumsum(), 0, 0) + + return coords, (offsets1, offsets2) + + +def _get_arrays_multipolygon(arr, include_z): + # explode/flatten the MultiPolygons + arr_flat, part_indices = get_parts(arr, return_index=True) + # the offsets into the multipolygon parts + offsets3 = _indices_to_offsets(part_indices, len(arr)) + + # explode/flatten the Polygons into Rings + arr_flat2, ring_indices = get_rings(arr_flat, return_index=True) + # the offsets into the exterior/interior rings of the multipolygon parts + offsets2 = np.insert(np.bincount(ring_indices).cumsum(), 0, 0) + + # the coords and offsets into the coordinates of the rings + coords, indices = get_coordinates(arr_flat2, return_index=True, include_z=include_z) + offsets1 = np.insert(np.bincount(indices).cumsum(), 0, 0) + + return coords, (offsets1, offsets2, offsets3) + + +def to_ragged_array(geometries, include_z=None): + """ + Converts geometries to a ragged array representation using a contiguous + array of coordinates and offset arrays. + + This function converts an array of geometries to a ragged array + (i.e. irregular array of arrays) of coordinates, represented in memory + using a single contiguous array of the coordinates, and + up to 3 offset arrays that keep track where each sub-array + starts and ends. + + This follows the in-memory layout of the variable size list arrays defined + by Apache Arrow, as specified for geometries by the GeoArrow project: + https://github.com/geoarrow/geoarrow. + + Parameters + ---------- + geometries : array_like + Array of geometries (1-dimensional). + include_z : bool, default None + If False, return 2D geometries. If True, include the third dimension + in the output (if a geometry has no third dimension, the z-coordinates + will be NaN). By default, will infer the dimensionality from the + input geometries. Note that this inference can be unreliable with + empty geometries (for a guaranteed result, it is recommended to + specify the keyword). + + Returns + ------- + tuple of (geometry_type, coords, offsets) + geometry_type : GeometryType + The type of the input geometries (required information for + roundtrip). + coords : np.ndarray + Contiguous array of shape (n, 2) or (n, 3) of all coordinates + of all input geometries. + offsets: tuple of np.ndarray + Offset arrays that make it possible to reconstruct the + geometries from the flat coordinates array. The number of + offset arrays depends on the geometry type. See + https://github.com/geoarrow/geoarrow/blob/main/format.md + for details. + + Notes + ----- + Mixed singular and multi geometry types of the same basic type are + allowed (e.g., Point and MultiPoint) and all singular types will be + treated as multi types. + GeometryCollections and other mixed geometry types are not supported. + + See also + -------- + from_ragged_array + + Examples + -------- + Consider a Polygon with one hole (interior ring): + + >>> import shapely + >>> polygon = shapely.Polygon( + ... [(0, 0), (10, 0), (10, 10), (0, 10)], + ... holes=[[(2, 2), (3, 2), (2, 3)]] + ... ) + >>> polygon + + + This polygon can be thought of as a list of rings (first ring is the + exterior ring, subsequent rings are the interior rings), and each ring + as a list of coordinate pairs. This is very similar to how GeoJSON + represents the coordinates: + + >>> import json + >>> json.loads(shapely.to_geojson(polygon))["coordinates"] + [[[0.0, 0.0], [10.0, 0.0], [10.0, 10.0], [0.0, 10.0], [0.0, 0.0]], + [[2.0, 2.0], [3.0, 2.0], [2.0, 3.0], [2.0, 2.0]]] + + This function will return a similar list of lists of lists, but + using a single contiguous array of coordinates, and multiple arrays of + offsets: + + >>> geometry_type, coords, offsets = shapely.to_ragged_array([polygon]) + >>> geometry_type + + >>> coords + array([[ 0., 0.], + [10., 0.], + [10., 10.], + [ 0., 10.], + [ 0., 0.], + [ 2., 2.], + [ 3., 2.], + [ 2., 3.], + [ 2., 2.]]) + + >>> offsets + (array([0, 5, 9]), array([0, 2])) + + As an example how to interpret the offsets: the i-th ring in the + coordinates is represented by ``offsets[0][i]`` to ``offsets[0][i+1]``: + + >>> exterior_ring_start, exterior_ring_end = offsets[0][0], offsets[0][1] + >>> coords[exterior_ring_start:exterior_ring_end] + array([[ 0., 0.], + [10., 0.], + [10., 10.], + [ 0., 10.], + [ 0., 0.]]) + + """ + geometries = np.asarray(geometries) + if include_z is None: + include_z = np.any( + get_coordinate_dimension(geometries[~is_empty(geometries)]) == 3 + ) + + geom_types = np.unique(get_type_id(geometries)) + # ignore missing values (type of -1) + geom_types = geom_types[geom_types >= 0] + + if len(geom_types) == 1: + typ = GeometryType(geom_types[0]) + if typ == GeometryType.POINT: + coords, offsets = _get_arrays_point(geometries, include_z) + elif typ == GeometryType.LINESTRING: + coords, offsets = _get_arrays_linestring(geometries, include_z) + elif typ == GeometryType.POLYGON: + coords, offsets = _get_arrays_polygon(geometries, include_z) + elif typ == GeometryType.MULTIPOINT: + coords, offsets = _get_arrays_multipoint(geometries, include_z) + elif typ == GeometryType.MULTILINESTRING: + coords, offsets = _get_arrays_multilinestring(geometries, include_z) + elif typ == GeometryType.MULTIPOLYGON: + coords, offsets = _get_arrays_multipolygon(geometries, include_z) + else: + raise ValueError(f"Geometry type {typ.name} is not supported") + + elif len(geom_types) == 2: + if set(geom_types) == {GeometryType.POINT, GeometryType.MULTIPOINT}: + typ = GeometryType.MULTIPOINT + coords, offsets = _get_arrays_multipoint(geometries, include_z) + elif set(geom_types) == {GeometryType.LINESTRING, GeometryType.MULTILINESTRING}: + typ = GeometryType.MULTILINESTRING + coords, offsets = _get_arrays_multilinestring(geometries, include_z) + elif set(geom_types) == {GeometryType.POLYGON, GeometryType.MULTIPOLYGON}: + typ = GeometryType.MULTIPOLYGON + coords, offsets = _get_arrays_multipolygon(geometries, include_z) + else: + raise ValueError( + "Geometry type combination is not supported " + f"({[GeometryType(t).name for t in geom_types]})" + ) + else: + raise ValueError( + "Geometry type combination is not supported " + f"({[GeometryType(t).name for t in geom_types]})" + ) + + return typ, coords, offsets + + +# # coords/offset arrays -> GEOS (from_ragged_array) + + +def _point_from_flatcoords(coords): + result = creation.points(coords) + + # Older versions of GEOS (<= 3.9) don't automatically convert NaNs + # to empty points -> do manually + empties = np.isnan(coords).all(axis=1) + if empties.any(): + result[empties] = creation.empty(1, geom_type=GeometryType.POINT).item() + + return result + + +def _multipoint_from_flatcoords(coords, offsets): + # recreate points + points = creation.points(coords) + + # recreate multipoints + multipoint_parts = np.diff(offsets) + multipoint_indices = np.repeat(np.arange(len(multipoint_parts)), multipoint_parts) + + result = np.empty(len(offsets) - 1, dtype=object) + result = creation.multipoints(points, indices=multipoint_indices, out=result) + result[multipoint_parts == 0] = creation.empty( + 1, geom_type=GeometryType.MULTIPOINT + ).item() + + return result + + +def _linestring_from_flatcoords(coords, offsets): + # recreate linestrings + linestring_n = np.diff(offsets) + linestring_indices = np.repeat(np.arange(len(linestring_n)), linestring_n) + + result = np.empty(len(offsets) - 1, dtype=object) + result = creation.linestrings(coords, indices=linestring_indices, out=result) + result[linestring_n == 0] = creation.empty( + 1, geom_type=GeometryType.LINESTRING + ).item() + return result + + +def _multilinestrings_from_flatcoords(coords, offsets1, offsets2): + # recreate linestrings + linestrings = _linestring_from_flatcoords(coords, offsets1) + + # recreate multilinestrings + multilinestring_parts = np.diff(offsets2) + multilinestring_indices = np.repeat( + np.arange(len(multilinestring_parts)), multilinestring_parts + ) + + result = np.empty(len(offsets2) - 1, dtype=object) + result = creation.multilinestrings( + linestrings, indices=multilinestring_indices, out=result + ) + result[multilinestring_parts == 0] = creation.empty( + 1, geom_type=GeometryType.MULTILINESTRING + ).item() + + return result + + +def _polygon_from_flatcoords(coords, offsets1, offsets2): + # recreate rings + ring_lengths = np.diff(offsets1) + ring_indices = np.repeat(np.arange(len(ring_lengths)), ring_lengths) + rings = creation.linearrings(coords, indices=ring_indices) + + # recreate polygons + polygon_rings_n = np.diff(offsets2) + polygon_indices = np.repeat(np.arange(len(polygon_rings_n)), polygon_rings_n) + result = np.empty(len(offsets2) - 1, dtype=object) + result = creation.polygons(rings, indices=polygon_indices, out=result) + result[polygon_rings_n == 0] = creation.empty( + 1, geom_type=GeometryType.POLYGON + ).item() + + return result + + +def _multipolygons_from_flatcoords(coords, offsets1, offsets2, offsets3): + # recreate polygons + polygons = _polygon_from_flatcoords(coords, offsets1, offsets2) + + # recreate multipolygons + multipolygon_parts = np.diff(offsets3) + multipolygon_indices = np.repeat( + np.arange(len(multipolygon_parts)), multipolygon_parts + ) + result = np.empty(len(offsets3) - 1, dtype=object) + result = creation.multipolygons(polygons, indices=multipolygon_indices, out=result) + result[multipolygon_parts == 0] = creation.empty( + 1, geom_type=GeometryType.MULTIPOLYGON + ).item() + + return result + + +def from_ragged_array(geometry_type, coords, offsets=None): + """ + Creates geometries from a contiguous array of coordinates + and offset arrays. + + This function creates geometries from the ragged array representation + as returned by ``to_ragged_array``. + + This follows the in-memory layout of the variable size list arrays defined + by Apache Arrow, as specified for geometries by the GeoArrow project: + https://github.com/geoarrow/geoarrow. + + See :func:`to_ragged_array` for more details. + + Parameters + ---------- + geometry_type : GeometryType + The type of geometry to create. + coords : np.ndarray + Contiguous array of shape (n, 2) or (n, 3) of all coordinates + for the geometries. + offsets: tuple of np.ndarray + Offset arrays that allow to reconstruct the geometries based on the + flat coordinates array. The number of offset arrays depends on the + geometry type. See + https://github.com/geoarrow/geoarrow/blob/main/format.md for details. + + Returns + ------- + np.ndarray + Array of geometries (1-dimensional). + + See Also + -------- + to_ragged_array + + """ + if geometry_type == GeometryType.POINT: + assert offsets is None or len(offsets) == 0 + return _point_from_flatcoords(coords) + if geometry_type == GeometryType.LINESTRING: + return _linestring_from_flatcoords(coords, *offsets) + if geometry_type == GeometryType.POLYGON: + return _polygon_from_flatcoords(coords, *offsets) + elif geometry_type == GeometryType.MULTIPOINT: + return _multipoint_from_flatcoords(coords, *offsets) + elif geometry_type == GeometryType.MULTILINESTRING: + return _multilinestrings_from_flatcoords(coords, *offsets) + elif geometry_type == GeometryType.MULTIPOLYGON: + return _multipolygons_from_flatcoords(coords, *offsets) + else: + raise ValueError(f"Geometry type {geometry_type.name} is not supported") diff --git a/billinglayer/python/shapely/_version.py b/billinglayer/python/shapely/_version.py new file mode 100644 index 0000000..8e42307 --- /dev/null +++ b/billinglayer/python/shapely/_version.py @@ -0,0 +1,21 @@ + +# This file was generated by 'versioneer.py' (0.28) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. + +import json + +version_json = ''' +{ + "date": "2023-01-30T08:49:38+0100", + "dirty": false, + "error": null, + "full-revisionid": "5f0352897968e82283a61fe6b201df87993628fb", + "version": "2.0.1" +} +''' # END VERSION_JSON + + +def get_versions(): + return json.loads(version_json) diff --git a/billinglayer/python/shapely/affinity.py b/billinglayer/python/shapely/affinity.py new file mode 100644 index 0000000..d71caaf --- /dev/null +++ b/billinglayer/python/shapely/affinity.py @@ -0,0 +1,250 @@ +"""Affine transforms, both in general and specific, named transforms.""" + +from math import cos, pi, sin, tan + +import numpy as np + +import shapely + +__all__ = ["affine_transform", "rotate", "scale", "skew", "translate"] + + +def affine_transform(geom, matrix): + r"""Return a transformed geometry using an affine transformation matrix. + + The coefficient matrix is provided as a list or tuple with 6 or 12 items + for 2D or 3D transformations, respectively. + + For 2D affine transformations, the 6 parameter matrix is:: + + [a, b, d, e, xoff, yoff] + + which represents the augmented matrix:: + + [x'] / a b xoff \ [x] + [y'] = | d e yoff | [y] + [1 ] \ 0 0 1 / [1] + + or the equations for the transformed coordinates:: + + x' = a * x + b * y + xoff + y' = d * x + e * y + yoff + + For 3D affine transformations, the 12 parameter matrix is:: + + [a, b, c, d, e, f, g, h, i, xoff, yoff, zoff] + + which represents the augmented matrix:: + + [x'] / a b c xoff \ [x] + [y'] = | d e f yoff | [y] + [z'] | g h i zoff | [z] + [1 ] \ 0 0 0 1 / [1] + + or the equations for the transformed coordinates:: + + x' = a * x + b * y + c * z + xoff + y' = d * x + e * y + f * z + yoff + z' = g * x + h * y + i * z + zoff + """ + if len(matrix) == 6: + ndim = 2 + a, b, d, e, xoff, yoff = matrix + if geom.has_z: + ndim = 3 + i = 1.0 + c = f = g = h = zoff = 0.0 + elif len(matrix) == 12: + ndim = 3 + a, b, c, d, e, f, g, h, i, xoff, yoff, zoff = matrix + if not geom.has_z: + ndim = 2 + else: + raise ValueError("'matrix' expects either 6 or 12 coefficients") + if ndim == 2: + A = np.array([[a, b], [d, e]], dtype=float) + off = np.array([xoff, yoff], dtype=float) + else: + A = np.array([[a, b, c], [d, e, f], [g, h, i]], dtype=float) + off = np.array([xoff, yoff, zoff], dtype=float) + + def _affine_coords(coords): + return np.matmul(A, coords.T).T + off + + return shapely.transform(geom, _affine_coords, include_z=ndim == 3) + + +def interpret_origin(geom, origin, ndim): + """Returns interpreted coordinate tuple for origin parameter. + + This is a helper function for other transform functions. + + The point of origin can be a keyword 'center' for the 2D bounding box + center, 'centroid' for the geometry's 2D centroid, a Point object or a + coordinate tuple (x0, y0, z0). + """ + # get coordinate tuple from 'origin' from keyword or Point type + if origin == "center": + # bounding box center + minx, miny, maxx, maxy = geom.bounds + origin = ((maxx + minx) / 2.0, (maxy + miny) / 2.0) + elif origin == "centroid": + origin = geom.centroid.coords[0] + elif isinstance(origin, str): + raise ValueError(f"'origin' keyword {origin!r} is not recognized") + elif getattr(origin, "geom_type", None) == "Point": + origin = origin.coords[0] + + # origin should now be tuple-like + if len(origin) not in (2, 3): + raise ValueError("Expected number of items in 'origin' to be " "either 2 or 3") + if ndim == 2: + return origin[0:2] + else: # 3D coordinate + if len(origin) == 2: + return origin + (0.0,) + else: + return origin + + +def rotate(geom, angle, origin="center", use_radians=False): + r"""Returns a rotated geometry on a 2D plane. + + The angle of rotation can be specified in either degrees (default) or + radians by setting ``use_radians=True``. Positive angles are + counter-clockwise and negative are clockwise rotations. + + The point of origin can be a keyword 'center' for the bounding box + center (default), 'centroid' for the geometry's centroid, a Point object + or a coordinate tuple (x0, y0). + + The affine transformation matrix for 2D rotation is: + + / cos(r) -sin(r) xoff \ + | sin(r) cos(r) yoff | + \ 0 0 1 / + + where the offsets are calculated from the origin Point(x0, y0): + + xoff = x0 - x0 * cos(r) + y0 * sin(r) + yoff = y0 - x0 * sin(r) - y0 * cos(r) + """ + if geom.is_empty: + return geom + if not use_radians: # convert from degrees + angle = angle * pi / 180.0 + cosp = cos(angle) + sinp = sin(angle) + if abs(cosp) < 2.5e-16: + cosp = 0.0 + if abs(sinp) < 2.5e-16: + sinp = 0.0 + x0, y0 = interpret_origin(geom, origin, 2) + + # fmt: off + matrix = (cosp, -sinp, 0.0, + sinp, cosp, 0.0, + 0.0, 0.0, 1.0, + x0 - x0 * cosp + y0 * sinp, y0 - x0 * sinp - y0 * cosp, 0.0) + # fmt: on + return affine_transform(geom, matrix) + + +def scale(geom, xfact=1.0, yfact=1.0, zfact=1.0, origin="center"): + r"""Returns a scaled geometry, scaled by factors along each dimension. + + The point of origin can be a keyword 'center' for the 2D bounding box + center (default), 'centroid' for the geometry's 2D centroid, a Point + object or a coordinate tuple (x0, y0, z0). + + Negative scale factors will mirror or reflect coordinates. + + The general 3D affine transformation matrix for scaling is: + + / xfact 0 0 xoff \ + | 0 yfact 0 yoff | + | 0 0 zfact zoff | + \ 0 0 0 1 / + + where the offsets are calculated from the origin Point(x0, y0, z0): + + xoff = x0 - x0 * xfact + yoff = y0 - y0 * yfact + zoff = z0 - z0 * zfact + """ + if geom.is_empty: + return geom + x0, y0, z0 = interpret_origin(geom, origin, 3) + + # fmt: off + matrix = (xfact, 0.0, 0.0, + 0.0, yfact, 0.0, + 0.0, 0.0, zfact, + x0 - x0 * xfact, y0 - y0 * yfact, z0 - z0 * zfact) + # fmt: on + return affine_transform(geom, matrix) + + +def skew(geom, xs=0.0, ys=0.0, origin="center", use_radians=False): + r"""Returns a skewed geometry, sheared by angles along x and y dimensions. + + The shear angle can be specified in either degrees (default) or radians + by setting ``use_radians=True``. + + The point of origin can be a keyword 'center' for the bounding box + center (default), 'centroid' for the geometry's centroid, a Point object + or a coordinate tuple (x0, y0). + + The general 2D affine transformation matrix for skewing is: + + / 1 tan(xs) xoff \ + | tan(ys) 1 yoff | + \ 0 0 1 / + + where the offsets are calculated from the origin Point(x0, y0): + + xoff = -y0 * tan(xs) + yoff = -x0 * tan(ys) + """ + if geom.is_empty: + return geom + if not use_radians: # convert from degrees + xs = xs * pi / 180.0 + ys = ys * pi / 180.0 + tanx = tan(xs) + tany = tan(ys) + if abs(tanx) < 2.5e-16: + tanx = 0.0 + if abs(tany) < 2.5e-16: + tany = 0.0 + x0, y0 = interpret_origin(geom, origin, 2) + + # fmt: off + matrix = (1.0, tanx, 0.0, + tany, 1.0, 0.0, + 0.0, 0.0, 1.0, + -y0 * tanx, -x0 * tany, 0.0) + # fmt: on + return affine_transform(geom, matrix) + + +def translate(geom, xoff=0.0, yoff=0.0, zoff=0.0): + r"""Returns a translated geometry shifted by offsets along each dimension. + + The general 3D affine transformation matrix for translation is: + + / 1 0 0 xoff \ + | 0 1 0 yoff | + | 0 0 1 zoff | + \ 0 0 0 1 / + """ + if geom.is_empty: + return geom + + # fmt: off + matrix = (1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + xoff, yoff, zoff) + # fmt: on + return affine_transform(geom, matrix) diff --git a/billinglayer/python/shapely/algorithms/__init__.py b/billinglayer/python/shapely/algorithms/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/shapely/algorithms/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/shapely/algorithms/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..f0fdb20 Binary files /dev/null and b/billinglayer/python/shapely/algorithms/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/algorithms/__pycache__/cga.cpython-311.pyc b/billinglayer/python/shapely/algorithms/__pycache__/cga.cpython-311.pyc new file mode 100644 index 0000000..8381e8a Binary files /dev/null and b/billinglayer/python/shapely/algorithms/__pycache__/cga.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/algorithms/__pycache__/polylabel.cpython-311.pyc b/billinglayer/python/shapely/algorithms/__pycache__/polylabel.cpython-311.pyc new file mode 100644 index 0000000..a1b7d7f Binary files /dev/null and b/billinglayer/python/shapely/algorithms/__pycache__/polylabel.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/algorithms/cga.py b/billinglayer/python/shapely/algorithms/cga.py new file mode 100644 index 0000000..2b78652 --- /dev/null +++ b/billinglayer/python/shapely/algorithms/cga.py @@ -0,0 +1,24 @@ +import numpy as np + +import shapely + + +def signed_area(ring): + """Return the signed area enclosed by a ring in linear time using the + algorithm at: https://web.archive.org/web/20080209143651/http://cgafaq.info:80/wiki/Polygon_Area + """ + coords = np.array(ring.coords)[:, :2] + xs, ys = np.vstack([coords, coords[1]]).T + return np.sum(xs[1:-1] * (ys[2:] - ys[:-2])) / 2.0 + + +def is_ccw_impl(name=None): + """Predicate implementation""" + + def is_ccw_op(ring): + return signed_area(ring) >= 0.0 + + if shapely.geos_version >= (3, 7, 0): + return shapely.is_ccw + else: + return is_ccw_op diff --git a/billinglayer/python/shapely/algorithms/polylabel.py b/billinglayer/python/shapely/algorithms/polylabel.py new file mode 100644 index 0000000..d72ffbe --- /dev/null +++ b/billinglayer/python/shapely/algorithms/polylabel.py @@ -0,0 +1,139 @@ +from heapq import heappop, heappush + +from ..errors import TopologicalError +from ..geometry import Point + + +class Cell: + """A `Cell`'s centroid property is a potential solution to finding the pole + of inaccessibility for a given polygon. Rich comparison operators are used + for sorting `Cell` objects in a priority queue based on the potential + maximum distance of any theoretical point within a cell to a given + polygon's exterior boundary. + """ + + def __init__(self, x, y, h, polygon): + self.x = x + self.y = y + self.h = h # half of cell size + self.centroid = Point(x, y) # cell centroid, potential solution + + # distance from cell centroid to polygon exterior + self.distance = self._dist(polygon) + + # max distance to polygon exterior within a cell + self.max_distance = self.distance + h * 1.4142135623730951 # sqrt(2) + + # rich comparison operators for sorting in minimum priority queue + def __lt__(self, other): + return self.max_distance > other.max_distance + + def __le__(self, other): + return self.max_distance >= other.max_distance + + def __eq__(self, other): + return self.max_distance == other.max_distance + + def __ne__(self, other): + return self.max_distance != other.max_distance + + def __gt__(self, other): + return self.max_distance < other.max_distance + + def __ge__(self, other): + return self.max_distance <= other.max_distance + + def _dist(self, polygon): + """Signed distance from Cell centroid to polygon outline. The returned + value is negative if the point is outside of the polygon exterior + boundary. + """ + inside = polygon.contains(self.centroid) + distance = self.centroid.distance(polygon.exterior) + for interior in polygon.interiors: + distance = min(distance, self.centroid.distance(interior)) + if inside: + return distance + return -distance + + +def polylabel(polygon, tolerance=1.0): + """Finds pole of inaccessibility for a given polygon. Based on + Vladimir Agafonkin's https://github.com/mapbox/polylabel + + Parameters + ---------- + polygon : shapely.geometry.Polygon + tolerance : int or float, optional + `tolerance` represents the highest resolution in units of the + input geometry that will be considered for a solution. (default + value is 1.0). + + Returns + ------- + shapely.geometry.Point + A point representing the pole of inaccessibility for the given input + polygon. + + Raises + ------ + shapely.errors.TopologicalError + If the input polygon is not a valid geometry. + + Example + ------- + >>> from shapely import LineString + >>> polygon = LineString([(0, 0), (50, 200), (100, 100), (20, 50), + ... (-100, -20), (-150, -200)]).buffer(100) + >>> polylabel(polygon, tolerance=10).wkt + 'POINT (59.35615556364569 121.83919629746435)' + """ + if not polygon.is_valid: + raise TopologicalError("Invalid polygon") + minx, miny, maxx, maxy = polygon.bounds + width = maxx - minx + height = maxy - miny + cell_size = min(width, height) + h = cell_size / 2.0 + cell_queue = [] + + # First best cell approximation is one constructed from the centroid + # of the polygon + x, y = polygon.centroid.coords[0] + best_cell = Cell(x, y, 0, polygon) + + # Special case for rectangular polygons avoiding floating point error + bbox_cell = Cell(minx + width / 2.0, miny + height / 2, 0, polygon) + if bbox_cell.distance > best_cell.distance: + best_cell = bbox_cell + + # build a regular square grid covering the polygon + x = minx + while x < maxx: + y = miny + while y < maxy: + heappush(cell_queue, Cell(x + h, y + h, h, polygon)) + y += cell_size + x += cell_size + + # minimum priority queue + while cell_queue: + cell = heappop(cell_queue) + + # update the best cell if we find a better one + if cell.distance > best_cell.distance: + best_cell = cell + + # continue to the next iteration if we can't find a better solution + # based on tolerance + if cell.max_distance - best_cell.distance <= tolerance: + continue + + # split the cell into quadrants + h = cell.h / 2.0 + heappush(cell_queue, Cell(cell.x - h, cell.y - h, h, polygon)) + heappush(cell_queue, Cell(cell.x + h, cell.y - h, h, polygon)) + heappush(cell_queue, Cell(cell.x - h, cell.y + h, h, polygon)) + heappush(cell_queue, Cell(cell.x + h, cell.y + h, h, polygon)) + + return best_cell.centroid diff --git a/billinglayer/python/shapely/constructive.py b/billinglayer/python/shapely/constructive.py new file mode 100644 index 0000000..bda4be3 --- /dev/null +++ b/billinglayer/python/shapely/constructive.py @@ -0,0 +1,1036 @@ +import numpy as np + +from . import lib +from ._enum import ParamEnum +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "BufferCapStyle", + "BufferJoinStyle", + "boundary", + "buffer", + "offset_curve", + "centroid", + "clip_by_rect", + "concave_hull", + "convex_hull", + "delaunay_triangles", + "segmentize", + "envelope", + "extract_unique_points", + "build_area", + "make_valid", + "normalize", + "node", + "point_on_surface", + "polygonize", + "polygonize_full", + "remove_repeated_points", + "reverse", + "simplify", + "snap", + "voronoi_polygons", + "oriented_envelope", + "minimum_rotated_rectangle", + "minimum_bounding_circle", +] + + +class BufferCapStyle(ParamEnum): + round = 1 + flat = 2 + square = 3 + + +class BufferJoinStyle(ParamEnum): + round = 1 + mitre = 2 + bevel = 3 + + +@multithreading_enabled +def boundary(geometry, **kwargs): + """Returns the topological boundary of a geometry. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return None for geometrycollections. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LinearRing, LineString, \ +MultiLineString, MultiPoint, Point, Polygon + >>> boundary(Point(0, 0)) + + >>> boundary(LineString([(0, 0), (1, 1), (1, 2)])) + + >>> boundary(LinearRing([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> boundary(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> boundary(MultiPoint([(0, 0), (1, 2)])) + + >>> boundary(MultiLineString([[(0, 0), (1, 1)], [(0, 1), (1, 0)]])) + + >>> boundary(GeometryCollection([Point(0, 0)])) is None + True + """ + return lib.boundary(geometry, **kwargs) + + +@multithreading_enabled +def buffer( + geometry, + distance, + quad_segs=8, + cap_style="round", + join_style="round", + mitre_limit=5.0, + single_sided=False, + **kwargs +): + """ + Computes the buffer of a geometry for positive and negative buffer distance. + + The buffer of a geometry is defined as the Minkowski sum (or difference, + for negative distance) of the geometry with a circle with radius equal + to the absolute value of the buffer distance. + + The buffer operation always returns a polygonal result. The negative + or zero-distance buffer of lines and points is always empty. + + Parameters + ---------- + geometry : Geometry or array_like + distance : float or array_like + Specifies the circle radius in the Minkowski sum (or difference). + quad_segs : int, default 8 + Specifies the number of linear segments in a quarter circle in the + approximation of circular arcs. + cap_style : shapely.BufferCapStyle or {'round', 'square', 'flat'}, default 'round' + Specifies the shape of buffered line endings. BufferCapStyle.round ('round') + results in circular line endings (see ``quad_segs``). Both BufferCapStyle.square + ('square') and BufferCapStyle.flat ('flat') result in rectangular line endings, + only BufferCapStyle.flat ('flat') will end at the original vertex, + while BufferCapStyle.square ('square') involves adding the buffer width. + join_style : shapely.BufferJoinStyle or {'round', 'mitre', 'bevel'}, default 'round' + Specifies the shape of buffered line midpoints. BufferJoinStyle.round ('round') + results in rounded shapes. BufferJoinStyle.bevel ('bevel') results in a beveled + edge that touches the original vertex. BufferJoinStyle.mitre ('mitre') results + in a single vertex that is beveled depending on the ``mitre_limit`` parameter. + mitre_limit : float, default 5.0 + Crops of 'mitre'-style joins if the point is displaced from the + buffered vertex by more than this limit. + single_sided : bool, default False + Only buffer at one side of the geometry. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon, BufferCapStyle, BufferJoinStyle + >>> buffer(Point(10, 10), 2, quad_segs=1) + + >>> buffer(Point(10, 10), 2, quad_segs=2) + + >>> buffer(Point(10, 10), -2, quad_segs=1) + + >>> line = LineString([(10, 10), (20, 10)]) + >>> buffer(line, 2, cap_style="square") + + >>> buffer(line, 2, cap_style="flat") + + >>> buffer(line, 2, single_sided=True, cap_style="flat") + + >>> line2 = LineString([(10, 10), (20, 10), (20, 20)]) + >>> buffer(line2, 2, cap_style="flat", join_style="bevel") + + >>> buffer(line2, 2, cap_style="flat", join_style="mitre") + + >>> buffer(line2, 2, cap_style="flat", join_style="mitre", mitre_limit=1) + + >>> square = Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]) + >>> buffer(square, 2, join_style="mitre") + + >>> buffer(square, -2, join_style="mitre") + + >>> buffer(square, -5, join_style="mitre") + + >>> buffer(line, float("nan")) is None + True + """ + if isinstance(cap_style, str): + cap_style = BufferCapStyle.get_value(cap_style) + if isinstance(join_style, str): + join_style = BufferJoinStyle.get_value(join_style) + if not np.isscalar(quad_segs): + raise TypeError("quad_segs only accepts scalar values") + if not np.isscalar(cap_style): + raise TypeError("cap_style only accepts scalar values") + if not np.isscalar(join_style): + raise TypeError("join_style only accepts scalar values") + if not np.isscalar(mitre_limit): + raise TypeError("mitre_limit only accepts scalar values") + if not np.isscalar(single_sided): + raise TypeError("single_sided only accepts scalar values") + return lib.buffer( + geometry, + distance, + np.intc(quad_segs), + np.intc(cap_style), + np.intc(join_style), + mitre_limit, + np.bool_(single_sided), + **kwargs + ) + + +@multithreading_enabled +def offset_curve( + geometry, distance, quad_segs=8, join_style="round", mitre_limit=5.0, **kwargs +): + """ + Returns a (Multi)LineString at a distance from the object + on its right or its left side. + + For positive distance the offset will be at the left side of the input + line. For a negative distance it will be at the right side. In general, + this function tries to preserve the direction of the input. + + Note: the behaviour regarding orientation of the resulting line depends + on the GEOS version. With GEOS < 3.11, the line retains the same + direction for a left offset (positive distance) or has opposite direction + for a right offset (negative distance), and this behaviour was documented + as such in previous Shapely versions. Starting with GEOS 3.11, the + function tries to preserve the orientation of the original line. + + Parameters + ---------- + geometry : Geometry or array_like + distance : float or array_like + Specifies the offset distance from the input geometry. Negative + for right side offset, positive for left side offset. + quad_segs : int, default 8 + Specifies the number of linear segments in a quarter circle in the + approximation of circular arcs. + join_style : {'round', 'bevel', 'mitre'}, default 'round' + Specifies the shape of outside corners. 'round' results in + rounded shapes. 'bevel' results in a beveled edge that touches the + original vertex. 'mitre' results in a single vertex that is beveled + depending on the ``mitre_limit`` parameter. + mitre_limit : float, default 5.0 + Crops of 'mitre'-style joins if the point is displaced from the + buffered vertex by more than this limit. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line = LineString([(0, 0), (0, 2)]) + >>> offset_curve(line, 2) + + >>> offset_curve(line, -2) + + """ + if isinstance(join_style, str): + join_style = BufferJoinStyle.get_value(join_style) + if not np.isscalar(quad_segs): + raise TypeError("quad_segs only accepts scalar values") + if not np.isscalar(join_style): + raise TypeError("join_style only accepts scalar values") + if not np.isscalar(mitre_limit): + raise TypeError("mitre_limit only accepts scalar values") + return lib.offset_curve( + geometry, + distance, + np.intc(quad_segs), + np.intc(join_style), + np.double(mitre_limit), + **kwargs + ) + + +@multithreading_enabled +def centroid(geometry, **kwargs): + """Computes the geometric center (center-of-mass) of a geometry. + + For multipoints this is computed as the mean of the input coordinates. + For multilinestrings the centroid is weighted by the length of each + line segment. For multipolygons the centroid is weighted by the area of + each polygon. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Polygon + >>> centroid(Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)])) + + >>> centroid(LineString([(0, 0), (2, 2), (10, 10)])) + + >>> centroid(MultiPoint([(0, 0), (10, 10)])) + + >>> centroid(Polygon()) + + """ + return lib.centroid(geometry, **kwargs) + + +@multithreading_enabled +def clip_by_rect(geometry, xmin, ymin, xmax, ymax, **kwargs): + """ + Returns the portion of a geometry within a rectangle. + + The geometry is clipped in a fast but possibly dirty way. The output is + not guaranteed to be valid. No exceptions will be raised for topological + errors. + + Note: empty geometries or geometries that do not overlap with the + specified bounds will result in GEOMETRYCOLLECTION EMPTY. + + Parameters + ---------- + geometry : Geometry or array_like + The geometry to be clipped + xmin : float + Minimum x value of the rectangle + ymin : float + Minimum y value of the rectangle + xmax : float + Maximum x value of the rectangle + ymax : float + Maximum y value of the rectangle + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> line = LineString([(0, 0), (10, 10)]) + >>> clip_by_rect(line, 0., 0., 1., 1.) + + >>> polygon = Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]) + >>> clip_by_rect(polygon, 0., 0., 1., 1.) + + """ + if not all(np.isscalar(val) for val in [xmin, ymin, xmax, ymax]): + raise TypeError("xmin/ymin/xmax/ymax only accepts scalar values") + return lib.clip_by_rect( + geometry, + np.double(xmin), + np.double(ymin), + np.double(xmax), + np.double(ymax), + **kwargs + ) + + +@requires_geos("3.11.0") +@multithreading_enabled +def concave_hull(geometry, ratio=0.0, allow_holes=False, **kwargs): + """Computes a concave geometry that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + ratio : float, default 0.0 + Number in the range [0, 1]. Higher numbers will include fewer vertices + in the hull. + allow_holes : bool, default False + If set to True, the concave hull may have holes. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiPoint, Polygon + >>> concave_hull(MultiPoint([(0, 0), (0, 3), (1, 1), (3, 0), (3, 3)]), ratio=0.1) + + >>> concave_hull(MultiPoint([(0, 0), (0, 3), (1, 1), (3, 0), (3, 3)]), ratio=1.0) + + >>> concave_hull(Polygon()) + + """ + if not np.isscalar(ratio): + raise TypeError("ratio must be scalar") + if not np.isscalar(allow_holes): + raise TypeError("allow_holes must be scalar") + return lib.concave_hull(geometry, np.double(ratio), np.bool_(allow_holes), **kwargs) + + +@multithreading_enabled +def convex_hull(geometry, **kwargs): + """Computes the minimum convex geometry that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiPoint, Polygon + >>> convex_hull(MultiPoint([(0, 0), (10, 0), (10, 10)])) + + >>> convex_hull(Polygon()) + + """ + return lib.convex_hull(geometry, **kwargs) + + +@multithreading_enabled +def delaunay_triangles(geometry, tolerance=0.0, only_edges=False, **kwargs): + """Computes a Delaunay triangulation around the vertices of an input + geometry. + + The output is a geometrycollection containing polygons (default) + or linestrings (see only_edges). Returns an None if an input geometry + contains less than 3 vertices. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like, default 0.0 + Snap input vertices together if their distance is less than this value. + only_edges : bool or array_like, default False + If set to True, the triangulation will return a collection of + linestrings instead of polygons. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Polygon + >>> points = MultiPoint([(50, 30), (60, 30), (100, 100)]) + >>> delaunay_triangles(points) + + >>> delaunay_triangles(points, only_edges=True) + + >>> delaunay_triangles(MultiPoint([(50, 30), (51, 30), (60, 30), (100, 100)]), \ +tolerance=2) + + >>> delaunay_triangles(Polygon([(50, 30), (60, 30), (100, 100), (50, 30)])) + + >>> delaunay_triangles(LineString([(50, 30), (60, 30), (100, 100)])) + + >>> delaunay_triangles(GeometryCollection([])) + + """ + return lib.delaunay_triangles(geometry, tolerance, only_edges, **kwargs) + + +@multithreading_enabled +def envelope(geometry, **kwargs): + """Computes the minimum bounding box that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point + >>> envelope(LineString([(0, 0), (10, 10)])) + + >>> envelope(MultiPoint([(0, 0), (10, 10)])) + + >>> envelope(Point(0, 0)) + + >>> envelope(GeometryCollection([])) + + """ + return lib.envelope(geometry, **kwargs) + + +@multithreading_enabled +def extract_unique_points(geometry, **kwargs): + """Returns all distinct vertices of an input geometry as a multipoint. + + Note that only 2 dimensions of the vertices are considered when testing + for equality. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Point, Polygon + >>> extract_unique_points(Point(0, 0)) + + >>> extract_unique_points(LineString([(0, 0), (1, 1), (1, 1)])) + + >>> extract_unique_points(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> extract_unique_points(MultiPoint([(0, 0), (1, 1), (0, 0)])) + + >>> extract_unique_points(LineString()) + + """ + return lib.extract_unique_points(geometry, **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def build_area(geometry, **kwargs): + """Creates an areal geometry formed by the constituent linework of given geometry. + + Equivalent of the PostGIS ST_BuildArea() function. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, Polygon + >>> polygon1 = Polygon([(0, 0), (3, 0), (3, 3), (0, 3), (0, 0)]) + >>> polygon2 = Polygon([(1, 1), (1, 2), (2, 2), (1, 1)]) + >>> build_area(GeometryCollection([polygon1, polygon2])) + + """ + return lib.build_area(geometry, **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def make_valid(geometry, **kwargs): + """Repairs invalid geometries. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import is_valid, Polygon + >>> polygon = Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)]) + >>> is_valid(polygon) + False + >>> make_valid(polygon) + + """ + return lib.make_valid(geometry, **kwargs) + + +@multithreading_enabled +def normalize(geometry, **kwargs): + """Converts Geometry to normal form (or canonical form). + + This method orders the coordinates, rings of a polygon and parts of + multi geometries consistently. Typically useful for testing purposes + (for example in combination with ``equals_exact``). + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiLineString + >>> line = MultiLineString([[(0, 0), (1, 1)], [(2, 2), (3, 3)]]) + >>> normalize(line) + + """ + return lib.normalize(geometry, **kwargs) + + +@multithreading_enabled +def point_on_surface(geometry, **kwargs): + """Returns a point that intersects an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Polygon + >>> point_on_surface(Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)])) + + >>> point_on_surface(LineString([(0, 0), (2, 2), (10, 10)])) + + >>> point_on_surface(MultiPoint([(0, 0), (10, 10)])) + + >>> point_on_surface(Polygon()) + + """ + return lib.point_on_surface(geometry, **kwargs) + + +@multithreading_enabled +def node(geometry, **kwargs): + """ + Returns the fully noded version of the linear input as MultiLineString. + + Given a linear input geometry, this function returns a new MultiLineString + in which no lines cross each other but only touch at and points. To + obtain this, all intersections between segments are computed and added + to the segments, and duplicate segments are removed. + + Non-linear input (points) will result in an empty MultiLineString. + + This function can for example be used to create a fully-noded linework + suitable to passed as input to ``polygonize``. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 0), (1,1), (0, 1), (1, 0)]) + >>> node(line) + + >>> node(Point(1, 1)) + + """ + return lib.node(geometry, **kwargs) + + +def polygonize(geometries, **kwargs): + """Creates polygons formed from the linework of a set of Geometries. + + Polygonizes an array of Geometries that contain linework which + represents the edges of a planar graph. Any type of Geometry may be + provided as input; only the constituent lines and rings will be used to + create the output polygons. + + Lines or rings that when combined do not completely close a polygon + will result in an empty GeometryCollection. Duplicate segments are + ignored. + + This function returns the polygons within a GeometryCollection. + Individual Polygons can be obtained using ``get_geometry`` to get + a single polygon or ``get_parts`` to get an array of polygons. + MultiPolygons can be constructed from the output using + ``shapely.multipolygons(shapely.get_parts(shapely.polygonize(geometries)))``. + + Parameters + ---------- + geometries : array_like + An array of geometries. + axis : int + Axis along which the geometries are polygonized. + The default is to perform a reduction over the last dimension + of the input array. A 1D array results in a scalar geometry. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Returns + ------- + GeometryCollection or array of GeometryCollections + + See Also + -------- + get_parts, get_geometry + polygonize_full + node + + Examples + -------- + >>> from shapely import LineString + >>> lines = [ + ... LineString([(0, 0), (1, 1)]), + ... LineString([(0, 0), (0, 1)]), + ... LineString([(0, 1), (1, 1)]) + ... ] + >>> polygonize(lines) + + """ + return lib.polygonize(geometries, **kwargs) + + +def polygonize_full(geometries, **kwargs): + """Creates polygons formed from the linework of a set of Geometries and + return all extra outputs as well. + + Polygonizes an array of Geometries that contain linework which + represents the edges of a planar graph. Any type of Geometry may be + provided as input; only the constituent lines and rings will be used to + create the output polygons. + + This function performs the same polygonization as ``polygonize`` but does + not only return the polygonal result but all extra outputs as well. The + return value consists of 4 elements: + + * The polygonal valid output + * **Cut edges**: edges connected on both ends but not part of polygonal output + * **dangles**: edges connected on one end but not part of polygonal output + * **invalid rings**: polygons formed but which are not valid + + This function returns the geometries within GeometryCollections. + Individual geometries can be obtained using ``get_geometry`` to get + a single geometry or ``get_parts`` to get an array of geometries. + + Parameters + ---------- + geometries : array_like + An array of geometries. + axis : int + Axis along which the geometries are polygonized. + The default is to perform a reduction over the last dimension + of the input array. A 1D array results in a scalar geometry. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Returns + ------- + (polygons, cuts, dangles, invalid) + tuple of 4 GeometryCollections or arrays of GeometryCollections + + See Also + -------- + polygonize + + Examples + -------- + >>> from shapely import LineString + >>> lines = [ + ... LineString([(0, 0), (1, 1)]), + ... LineString([(0, 0), (0, 1), (1, 1)]), + ... LineString([(0, 1), (1, 1)]) + ... ] + >>> polygonize_full(lines) # doctest: +NORMALIZE_WHITESPACE + (, + , + , + ) + """ + return lib.polygonize_full(geometries, **kwargs) + + +@requires_geos("3.11.0") +@multithreading_enabled +def remove_repeated_points(geometry, tolerance=0.0, **kwargs): + """Returns a copy of a Geometry with repeated points removed. + + From the start of the coordinate sequence, each next point within the + tolerance is removed. + + Removing repeated points with a non-zero tolerance may result in an invalid + geometry being returned. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like, default=0.0 + Use 0.0 to remove only exactly repeated points. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> remove_repeated_points(LineString([(0,0), (0,0), (1,0)]), tolerance=0) + + >>> remove_repeated_points(Polygon([(0, 0), (0, .5), (0, 1), (.5, 1), (0,0)]), tolerance=.5) + + """ + return lib.remove_repeated_points(geometry, tolerance, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def reverse(geometry, **kwargs): + """Returns a copy of a Geometry with the order of coordinates reversed. + + If a Geometry is a polygon with interior rings, the interior rings are also + reversed. + + Points are unchanged. None is returned where Geometry is None. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_ccw : Checks if a Geometry is clockwise. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> reverse(LineString([(0, 0), (1, 2)])) + + >>> reverse(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> reverse(None) is None + True + """ + + return lib.reverse(geometry, **kwargs) + + +@requires_geos("3.10.0") +@multithreading_enabled +def segmentize(geometry, max_segment_length, **kwargs): + """Adds vertices to line segments based on maximum segment length. + + Additional vertices will be added to every line segment in an input geometry + so that segments are no longer than the provided maximum segment length. New + vertices will evenly subdivide each segment. + + Only linear components of input geometries are densified; other geometries + are returned unmodified. + + Parameters + ---------- + geometry : Geometry or array_like + max_segment_length : float or array_like + Additional vertices will be added so that all line segments are no + longer than this value. Must be greater than 0. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> line = LineString([(0, 0), (0, 10)]) + >>> segmentize(line, max_segment_length=5) + + >>> polygon = Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]) + >>> segmentize(polygon, max_segment_length=5) + + >>> segmentize(None, max_segment_length=5) is None + True + """ + return lib.segmentize(geometry, max_segment_length, **kwargs) + + +@multithreading_enabled +def simplify(geometry, tolerance, preserve_topology=True, **kwargs): + """Returns a simplified version of an input geometry using the + Douglas-Peucker algorithm. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like + The maximum allowed geometry displacement. The higher this value, the + smaller the number of vertices in the resulting geometry. + preserve_topology : bool, default True + By default (True), the operation will avoid creating invalid + geometries (checking for collapses, ring-intersections, etc), but + this is computationally more expensive. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> line = LineString([(0, 0), (1, 10), (0, 20)]) + >>> simplify(line, tolerance=0.9) + + >>> simplify(line, tolerance=1) + + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> simplify(polygon_with_hole, tolerance=4, preserve_topology=True) + + >>> simplify(polygon_with_hole, tolerance=4, preserve_topology=False) + + """ + if preserve_topology: + return lib.simplify_preserve_topology(geometry, tolerance, **kwargs) + else: + return lib.simplify(geometry, tolerance, **kwargs) + + +@multithreading_enabled +def snap(geometry, reference, tolerance, **kwargs): + """Snaps an input geometry to reference geometry's vertices. + + The tolerance is used to control where snapping is performed. + The result geometry is the input geometry with the vertices snapped. + If no snapping occurs then the input geometry is returned unchanged. + + Parameters + ---------- + geometry : Geometry or array_like + reference : Geometry or array_like + tolerance : float or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> point = Point(0.5, 2.5) + >>> target_point = Point(0, 2) + >>> snap(point, target_point, tolerance=1) + + >>> snap(point, target_point, tolerance=0.49) + + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> snap(polygon, Point(8, 10), tolerance=5) + + >>> snap(polygon, LineString([(8, 10), (8, 0)]), tolerance=5) + + """ + return lib.snap(geometry, reference, tolerance, **kwargs) + + +@multithreading_enabled +def voronoi_polygons( + geometry, tolerance=0.0, extend_to=None, only_edges=False, **kwargs +): + """Computes a Voronoi diagram from the vertices of an input geometry. + + The output is a geometrycollection containing polygons (default) + or linestrings (see only_edges). Returns empty if an input geometry + contains less than 2 vertices or if the provided extent has zero area. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like, default 0.0 + Snap input vertices together if their distance is less than this value. + extend_to : Geometry or array_like, optional + If provided, the diagram will be extended to cover the envelope of this + geometry (unless this envelope is smaller than the input geometry). + only_edges : bool or array_like, default False + If set to True, the triangulation will return a collection of + linestrings instead of polygons. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, normalize, Point + >>> points = MultiPoint([(2, 2), (4, 2)]) + >>> normalize(voronoi_polygons(points)) + + >>> voronoi_polygons(points, only_edges=True) + + >>> voronoi_polygons(MultiPoint([(2, 2), (4, 2), (4.2, 2)]), 0.5, only_edges=True) + + >>> voronoi_polygons(points, extend_to=LineString([(0, 0), (10, 10)]), only_edges=True) + + >>> voronoi_polygons(LineString([(2, 2), (4, 2)]), only_edges=True) + + >>> voronoi_polygons(Point(2, 2)) + + """ + return lib.voronoi_polygons(geometry, tolerance, extend_to, only_edges, **kwargs) + + +@requires_geos("3.6.0") +@multithreading_enabled +def oriented_envelope(geometry, **kwargs): + """ + Computes the oriented envelope (minimum rotated rectangle) + that encloses an input geometry. + + Unlike envelope this rectangle is not constrained to be parallel to the + coordinate axes. If the convex hull of the object is a degenerate (line + or point) this degenerate is returned. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + >>> oriented_envelope(MultiPoint([(0, 0), (10, 0), (10, 10)])) + + >>> oriented_envelope(LineString([(1, 1), (5, 1), (10, 10)])) + + >>> oriented_envelope(Polygon([(1, 1), (15, 1), (5, 10), (1, 1)])) + + >>> oriented_envelope(LineString([(1, 1), (10, 1)])) + + >>> oriented_envelope(Point(2, 2)) + + >>> oriented_envelope(GeometryCollection([])) + + """ + return lib.oriented_envelope(geometry, **kwargs) + + +minimum_rotated_rectangle = oriented_envelope + + +@requires_geos("3.8.0") +@multithreading_enabled +def minimum_bounding_circle(geometry, **kwargs): + """Computes the minimum bounding circle that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + >>> minimum_bounding_circle(Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])) + + >>> minimum_bounding_circle(LineString([(1, 1), (10, 10)])) + + >>> minimum_bounding_circle(MultiPoint([(2, 2), (4, 2)])) + + >>> minimum_bounding_circle(Point(0, 1)) + + >>> minimum_bounding_circle(GeometryCollection([])) + + + See also + -------- + minimum_bounding_radius + """ + return lib.minimum_bounding_circle(geometry, **kwargs) diff --git a/billinglayer/python/shapely/coordinates.py b/billinglayer/python/shapely/coordinates.py new file mode 100644 index 0000000..e453c9c --- /dev/null +++ b/billinglayer/python/shapely/coordinates.py @@ -0,0 +1,198 @@ +import numpy as np + +from . import lib + +__all__ = ["transform", "count_coordinates", "get_coordinates", "set_coordinates"] + + +def transform(geometry, transformation, include_z=False): + """Returns a copy of a geometry array with a function applied to its + coordinates. + + With the default of ``include_z=False``, all returned geometries will be + two-dimensional; the third dimension will be discarded, if present. + When specifying ``include_z=True``, the returned geometries preserve + the dimensionality of the respective input geometries. + + Parameters + ---------- + geometry : Geometry or array_like + transformation : function + A function that transforms a (N, 2) or (N, 3) ndarray of float64 to + another (N, 2) or (N, 3) ndarray of float64. + include_z : bool, default False + If True, include the third dimension in the coordinates array + that is passed to the ``transformation`` function. If a + geometry has no third dimension, the z-coordinates passed to the + function will be NaN. + + Examples + -------- + >>> from shapely import LineString, Point + >>> transform(Point(0, 0), lambda x: x + 1) + + >>> transform(LineString([(2, 2), (4, 4)]), lambda x: x * [2, 3]) + + >>> transform(None, lambda x: x) is None + True + >>> transform([Point(0, 0), None], lambda x: x).tolist() + [, None] + + By default, the third dimension is ignored: + + >>> transform(Point(0, 0, 0), lambda x: x + 1) + + >>> transform(Point(0, 0, 0), lambda x: x + 1, include_z=True) + + """ + geometry_arr = np.array(geometry, dtype=np.object_) # makes a copy + coordinates = lib.get_coordinates(geometry_arr, include_z, False) + new_coordinates = transformation(coordinates) + # check the array to yield understandable error messages + if not isinstance(new_coordinates, np.ndarray): + raise ValueError("The provided transformation did not return a numpy array") + if new_coordinates.dtype != np.float64: + raise ValueError( + "The provided transformation returned an array with an unexpected " + f"dtype ({new_coordinates.dtype})" + ) + if new_coordinates.shape != coordinates.shape: + # if the shape is too small we will get a segfault + raise ValueError( + "The provided transformation returned an array with an unexpected " + f"shape ({new_coordinates.shape})" + ) + geometry_arr = lib.set_coordinates(geometry_arr, new_coordinates) + if geometry_arr.ndim == 0 and not isinstance(geometry, np.ndarray): + return geometry_arr.item() + return geometry_arr + + +def count_coordinates(geometry): + """Counts the number of coordinate pairs in a geometry array. + + Parameters + ---------- + geometry : Geometry or array_like + + Examples + -------- + >>> from shapely import LineString, Point + >>> count_coordinates(Point(0, 0)) + 1 + >>> count_coordinates(LineString([(2, 2), (4, 2)])) + 2 + >>> count_coordinates(None) + 0 + >>> count_coordinates([Point(0, 0), None]) + 1 + """ + return lib.count_coordinates(np.asarray(geometry, dtype=np.object_)) + + +def get_coordinates(geometry, include_z=False, return_index=False): + """Gets coordinates from a geometry array as an array of floats. + + The shape of the returned array is (N, 2), with N being the number of + coordinate pairs. With the default of ``include_z=False``, three-dimensional + data is ignored. When specifying ``include_z=True``, the shape of the + returned array is (N, 3). + + Parameters + ---------- + geometry : Geometry or array_like + include_z : bool, default False + If, True include the third dimension in the output. If a geometry + has no third dimension, the z-coordinates will be NaN. + return_index : bool, default False + If True, also return the index of each returned geometry as a separate + ndarray of integers. For multidimensional arrays, this indexes into the + flattened array (in C contiguous order). + + Examples + -------- + >>> from shapely import LineString, Point + >>> get_coordinates(Point(0, 0)).tolist() + [[0.0, 0.0]] + >>> get_coordinates(LineString([(2, 2), (4, 4)])).tolist() + [[2.0, 2.0], [4.0, 4.0]] + >>> get_coordinates(None) + array([], shape=(0, 2), dtype=float64) + + By default the third dimension is ignored: + + >>> get_coordinates(Point(0, 0, 0)).tolist() + [[0.0, 0.0]] + >>> get_coordinates(Point(0, 0, 0), include_z=True).tolist() + [[0.0, 0.0, 0.0]] + + When return_index=True, indexes are returned also: + + >>> geometries = [LineString([(2, 2), (4, 4)]), Point(0, 0)] + >>> coordinates, index = get_coordinates(geometries, return_index=True) + >>> coordinates.tolist(), index.tolist() + ([[2.0, 2.0], [4.0, 4.0], [0.0, 0.0]], [0, 0, 1]) + """ + return lib.get_coordinates( + np.asarray(geometry, dtype=np.object_), include_z, return_index + ) + + +def set_coordinates(geometry, coordinates): + """Adapts the coordinates of a geometry array in-place. + + If the coordinates array has shape (N, 2), all returned geometries + will be two-dimensional, and the third dimension will be discarded, + if present. If the coordinates array has shape (N, 3), the returned + geometries preserve the dimensionality of the input geometries. + + .. warning:: + + The geometry array is modified in-place! If you do not want to + modify the original array, you can do + ``set_coordinates(arr.copy(), newcoords)``. + + Parameters + ---------- + geometry : Geometry or array_like + coordinates: array_like + + See Also + -------- + transform : Returns a copy of a geometry array with a function applied to its + coordinates. + + Examples + -------- + >>> from shapely import LineString, Point + >>> set_coordinates(Point(0, 0), [[1, 1]]) + + >>> set_coordinates([Point(0, 0), LineString([(0, 0), (0, 0)])], [[1, 2], [3, 4], [5, 6]]).tolist() + [, ] + >>> set_coordinates([None, Point(0, 0)], [[1, 2]]).tolist() + [None, ] + + Third dimension of input geometry is discarded if coordinates array does + not include one: + + >>> set_coordinates(Point(0, 0, 0), [[1, 1]]) + + >>> set_coordinates(Point(0, 0, 0), [[1, 1, 1]]) + + """ + geometry_arr = np.asarray(geometry, dtype=np.object_) + coordinates = np.atleast_2d(np.asarray(coordinates)).astype(np.float64) + if coordinates.ndim != 2: + raise ValueError( + "The coordinate array should have dimension of 2 " + f"(has {coordinates.ndim})" + ) + n_coords = lib.count_coordinates(geometry_arr) + if (coordinates.shape[0] != n_coords) or (coordinates.shape[1] not in {2, 3}): + raise ValueError( + f"The coordinate array has an invalid shape {coordinates.shape}" + ) + lib.set_coordinates(geometry_arr, coordinates) + if geometry_arr.ndim == 0 and not isinstance(geometry, np.ndarray): + return geometry_arr.item() + return geometry_arr diff --git a/billinglayer/python/shapely/coords.py b/billinglayer/python/shapely/coords.py new file mode 100644 index 0000000..9056f2a --- /dev/null +++ b/billinglayer/python/shapely/coords.py @@ -0,0 +1,62 @@ +"""Coordinate sequence utilities +""" +from array import array + + +class CoordinateSequence: + """ + Iterative access to coordinate tuples from the parent geometry's coordinate + sequence. + + Example: + + >>> from shapely.wkt import loads + >>> g = loads('POINT (0.0 0.0)') + >>> list(g.coords) + [(0.0, 0.0)] + + """ + + def __init__(self, coords): + self._coords = coords + + def __len__(self): + return self._coords.shape[0] + + def __iter__(self): + for i in range(self.__len__()): + yield tuple(self._coords[i].tolist()) + + def __getitem__(self, key): + m = self.__len__() + if isinstance(key, int): + if key + m < 0 or key >= m: + raise IndexError("index out of range") + if key < 0: + i = m + key + else: + i = key + return tuple(self._coords[i].tolist()) + elif isinstance(key, slice): + res = [] + start, stop, stride = key.indices(m) + for i in range(start, stop, stride): + res.append(tuple(self._coords[i].tolist())) + return res + else: + raise TypeError("key must be an index or slice") + + def __array__(self, dtype=None): + return self._coords + + @property + def xy(self): + """X and Y arrays""" + m = self.__len__() + x = array("d") + y = array("d") + for i in range(m): + xy = self._coords[i].tolist() + x.append(xy[0]) + y.append(xy[1]) + return x, y diff --git a/billinglayer/python/shapely/creation.py b/billinglayer/python/shapely/creation.py new file mode 100644 index 0000000..8592c6e --- /dev/null +++ b/billinglayer/python/shapely/creation.py @@ -0,0 +1,565 @@ +import numpy as np + +from . import Geometry, GeometryType, lib +from ._geometry_helpers import collections_1d, simple_geometries_1d +from .decorators import multithreading_enabled +from .io import from_wkt + +__all__ = [ + "points", + "linestrings", + "linearrings", + "polygons", + "multipoints", + "multilinestrings", + "multipolygons", + "geometrycollections", + "box", + "prepare", + "destroy_prepared", + "empty", +] + + +def _xyz_to_coords(x, y, z): + if y is None: + return x + if z is None: + coords = np.broadcast_arrays(x, y) + else: + coords = np.broadcast_arrays(x, y, z) + return np.stack(coords, axis=-1) + + +@multithreading_enabled +def points(coords, y=None, z=None, indices=None, out=None, **kwargs): + """Create an array of points. + + Parameters + ---------- + coords : array_like + An array of coordinate tuples (2- or 3-dimensional) or, if ``y`` is + provided, an array of x coordinates. + y : array_like, optional + z : array_like, optional + indices : array_like, optional + Indices into the target array where input coordinates belong. If + provided, the coords should be 2D with shape (N, 2) or (N, 3) and + indices should be an array of shape (N,) with integers in increasing + order. Missing indices result in a ValueError unless ``out`` is + provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + >>> points([[0, 1], [4, 5]]).tolist() + [, ] + >>> points([0, 1, 2]) + + + Notes + ----- + + - GEOS >=3.10 automatically converts POINT (nan nan) to POINT EMPTY. + - Usage of the ``y`` and ``z`` arguments will prevents lazy evaluation in ``dask``. + Instead provide the coordinates as an array with shape ``(..., 2)`` or ``(..., 3)`` using only the ``coords`` argument. + """ + coords = _xyz_to_coords(coords, y, z) + if indices is None: + return lib.points(coords, out=out, **kwargs) + else: + return simple_geometries_1d(coords, indices, GeometryType.POINT, out=out) + + +@multithreading_enabled +def linestrings(coords, y=None, z=None, indices=None, out=None, **kwargs): + """Create an array of linestrings. + + This function will raise an exception if a linestring contains less than + two points. + + Parameters + ---------- + coords : array_like + An array of lists of coordinate tuples (2- or 3-dimensional) or, if ``y`` + is provided, an array of lists of x coordinates + y : array_like, optional + z : array_like, optional + indices : array_like, optional + Indices into the target array where input coordinates belong. If + provided, the coords should be 2D with shape (N, 2) or (N, 3) and + indices should be an array of shape (N,) with integers in increasing + order. Missing indices result in a ValueError unless ``out`` is + provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + >>> linestrings([[[0, 1], [4, 5]], [[2, 3], [5, 6]]]).tolist() + [, ] + >>> linestrings([[0, 1], [4, 5], [2, 3], [5, 6], [7, 8]], indices=[0, 0, 1, 1, 1]).tolist() + [, ] + + Notes + ----- + - Usage of the ``y`` and ``z`` arguments will prevents lazy evaluation in ``dask``. + Instead provide the coordinates as a ``(..., 2)`` or ``(..., 3)`` array using only ``coords``. + """ + coords = _xyz_to_coords(coords, y, z) + if indices is None: + return lib.linestrings(coords, out=out, **kwargs) + else: + return simple_geometries_1d(coords, indices, GeometryType.LINESTRING, out=out) + + +@multithreading_enabled +def linearrings(coords, y=None, z=None, indices=None, out=None, **kwargs): + """Create an array of linearrings. + + If the provided coords do not constitute a closed linestring, or if there + are only 3 provided coords, the first + coordinate is duplicated at the end to close the ring. This function will + raise an exception if a linearring contains less than three points or if + the terminal coordinates contain NaN (not-a-number). + + Parameters + ---------- + coords : array_like + An array of lists of coordinate tuples (2- or 3-dimensional) or, if ``y`` + is provided, an array of lists of x coordinates + y : array_like, optional + z : array_like, optional + indices : array_like, optional + Indices into the target array where input coordinates belong. If + provided, the coords should be 2D with shape (N, 2) or (N, 3) and + indices should be an array of shape (N,) with integers in increasing + order. Missing indices result in a ValueError unless ``out`` is + provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + linestrings + + Examples + -------- + >>> linearrings([[0, 0], [0, 1], [1, 1], [0, 0]]) + + >>> linearrings([[0, 0], [0, 1], [1, 1]]) + + + Notes + ----- + - Usage of the ``y`` and ``z`` arguments will prevents lazy evaluation in ``dask``. + Instead provide the coordinates as a ``(..., 2)`` or ``(..., 3)`` array using only ``coords``. + """ + coords = _xyz_to_coords(coords, y, z) + if indices is None: + return lib.linearrings(coords, out=out, **kwargs) + else: + return simple_geometries_1d(coords, indices, GeometryType.LINEARRING, out=out) + + +@multithreading_enabled +def polygons(geometries, holes=None, indices=None, out=None, **kwargs): + """Create an array of polygons. + + Parameters + ---------- + geometries : array_like + An array of linearrings or coordinates (see linearrings). + Unless ``indices`` are given (see description below), this + include the outer shells only. The ``holes`` argument should be used + to create polygons with holes. + holes : array_like, optional + An array of lists of linearrings that constitute holes for each shell. + Not to be used in combination with ``indices``. + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, the holes are expected to be present inside ``geometries``; + the first geometry for each index is the outer shell + and all subsequent geometries in that index are the holes. + Both geometries and indices should be 1D and have matching sizes. + Indices should be in increasing order. Missing indices result in a ValueError + unless ``out`` is provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + Polygons are constructed from rings: + + >>> ring_1 = linearrings([[0, 0], [0, 10], [10, 10], [10, 0]]) + >>> ring_2 = linearrings([[2, 6], [2, 7], [3, 7], [3, 6]]) + >>> polygons([ring_1, ring_2])[0] + + >>> polygons([ring_1, ring_2])[1] + + + Or from coordinates directly: + + >>> polygons([[0, 0], [0, 10], [10, 10], [10, 0]]) + + + Adding holes can be done using the ``holes`` keyword argument: + + >>> polygons(ring_1, holes=[ring_2]) + + + Or using the ``indices`` argument: + + >>> polygons([ring_1, ring_2], indices=[0, 1])[0] + + >>> polygons([ring_1, ring_2], indices=[0, 1])[1] + + >>> polygons([ring_1, ring_2], indices=[0, 0])[0] + + + Missing input values (``None``) are ignored and may result in an + empty polygon: + + >>> polygons(None) + + >>> polygons(ring_1, holes=[None]) + + >>> polygons([ring_1, None], indices=[0, 0])[0] + + """ + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = linearrings(geometries) + + if indices is not None: + if holes is not None: + raise TypeError("Cannot specify separate holes array when using indices.") + return collections_1d(geometries, indices, GeometryType.POLYGON, out=out) + + if holes is None: + # no holes provided: initialize an empty holes array matching shells + shape = geometries.shape + (0,) if isinstance(geometries, np.ndarray) else (0,) + holes = np.empty(shape, dtype=object) + else: + holes = np.asarray(holes) + # convert holes coordinates into linearrings + if np.issubdtype(holes.dtype, np.number): + holes = linearrings(holes) + + return lib.polygons(geometries, holes, out=out, **kwargs) + + +@multithreading_enabled +def box(xmin, ymin, xmax, ymax, ccw=True, **kwargs): + """Create box polygons. + + Parameters + ---------- + xmin : array_like + ymin : array_like + xmax : array_like + ymax : array_like + ccw : bool, default True + If True, box will be created in counterclockwise direction starting + from bottom right coordinate (xmax, ymin). + If False, box will be created in clockwise direction starting from + bottom left coordinate (xmin, ymin). + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> box(0, 0, 1, 1) + + >>> box(0, 0, 1, 1, ccw=False) + + + """ + return lib.box(xmin, ymin, xmax, ymax, ccw, **kwargs) + + +@multithreading_enabled +def multipoints(geometries, indices=None, out=None, **kwargs): + """Create multipoints from arrays of points + + Parameters + ---------- + geometries : array_like + An array of points or coordinates (see points). + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + Multipoints are constructed from points: + + >>> point_1 = points([1, 1]) + >>> point_2 = points([2, 2]) + >>> multipoints([point_1, point_2]) + + >>> multipoints([[point_1, point_2], [point_2, None]]).tolist() + [, ] + + Or from coordinates directly: + + >>> multipoints([[0, 0], [2, 2], [3, 3]]) + + + Multiple multipoints of different sizes can be constructed efficiently using the + ``indices`` keyword argument: + + >>> multipoints([point_1, point_2, point_2], indices=[0, 0, 1]).tolist() + [, ] + + Missing input values (``None``) are ignored and may result in an + empty multipoint: + + >>> multipoints([None]) + + >>> multipoints([point_1, None], indices=[0, 0]).tolist() + [] + >>> multipoints([point_1, None], indices=[0, 1]).tolist() + [, ] + """ + typ = GeometryType.MULTIPOINT + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = points(geometries) + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +@multithreading_enabled +def multilinestrings(geometries, indices=None, out=None, **kwargs): + """Create multilinestrings from arrays of linestrings + + Parameters + ---------- + geometries : array_like + An array of linestrings or coordinates (see linestrings). + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + multipoints + """ + typ = GeometryType.MULTILINESTRING + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = linestrings(geometries) + + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +@multithreading_enabled +def multipolygons(geometries, indices=None, out=None, **kwargs): + """Create multipolygons from arrays of polygons + + Parameters + ---------- + geometries : array_like + An array of polygons or coordinates (see polygons). + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + multipoints + """ + typ = GeometryType.MULTIPOLYGON + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = polygons(geometries) + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +@multithreading_enabled +def geometrycollections(geometries, indices=None, out=None, **kwargs): + """Create geometrycollections from arrays of geometries + + Parameters + ---------- + geometries : array_like + An array of geometries + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + multipoints + """ + typ = GeometryType.GEOMETRYCOLLECTION + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +def prepare(geometry, **kwargs): + """Prepare a geometry, improving performance of other operations. + + A prepared geometry is a normal geometry with added information such as an + index on the line segments. This improves the performance of the following operations: + contains, contains_properly, covered_by, covers, crosses, disjoint, intersects, + overlaps, touches, and within. + + Note that if a prepared geometry is modified, the newly created Geometry object is + not prepared. In that case, ``prepare`` should be called again. + + This function does not recompute previously prepared geometries; + it is efficient to call this function on an array that partially contains prepared geometries. + + This function does not return any values; geometries are modified in place. + + Parameters + ---------- + geometry : Geometry or array_like + Geometries are changed in place + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_prepared : Identify whether a geometry is prepared already. + destroy_prepared : Destroy the prepared part of a geometry. + + Examples + -------- + >>> from shapely import Point, buffer, prepare, contains_properly + >>> poly = buffer(Point(1.0, 1.0), 1) + >>> prepare(poly) + >>> contains_properly(poly, [Point(0.0, 0.0), Point(0.5, 0.5)]).tolist() + [False, True] + """ + lib.prepare(geometry, **kwargs) + + +def destroy_prepared(geometry, **kwargs): + """Destroy the prepared part of a geometry, freeing up memory. + + Note that the prepared geometry will always be cleaned up if the geometry itself + is dereferenced. This function needs only be called in very specific circumstances, + such as freeing up memory without losing the geometries, or benchmarking. + + Parameters + ---------- + geometry : Geometry or array_like + Geometries are changed inplace + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare + """ + lib.destroy_prepared(geometry, **kwargs) + + +def empty(shape, geom_type=None, order="C"): + """Create a geometry array prefilled with None or with empty geometries. + + Parameters + ---------- + shape : int or tuple of int + Shape of the empty array, e.g., ``(2, 3)`` or ``2``. + geom_type : shapely.GeometryType, optional + The desired geometry type in case the array should be prefilled + with empty geometries. Default ``None``. + order : {'C', 'F'}, optional, default: 'C' + Whether to store multi-dimensional data in row-major + (C-style) or column-major (Fortran-style) order in + memory. + + Examples + -------- + >>> empty((2, 3)).tolist() + [[None, None, None], [None, None, None]] + >>> empty(2, geom_type=GeometryType.POINT).tolist() + [, ] + """ + if geom_type is None: + return np.empty(shape, dtype=object, order=order) + + geom_type = GeometryType(geom_type) # cast int to GeometryType + if geom_type is GeometryType.MISSING: + return np.empty(shape, dtype=object, order=order) + + fill_value = from_wkt(geom_type.name + " EMPTY") + return np.full(shape, fill_value, dtype=object, order=order) diff --git a/billinglayer/python/shapely/decorators.py b/billinglayer/python/shapely/decorators.py new file mode 100644 index 0000000..cae6a0d --- /dev/null +++ b/billinglayer/python/shapely/decorators.py @@ -0,0 +1,82 @@ +import os +from functools import wraps + +import numpy as np + +from . import lib +from .errors import UnsupportedGEOSVersionError + + +class requires_geos: + def __init__(self, version): + if version.count(".") != 2: + raise ValueError("Version must be .. format") + self.version = tuple(int(x) for x in version.split(".")) + + def __call__(self, func): + is_compatible = lib.geos_version >= self.version + is_doc_build = os.environ.get("SPHINX_DOC_BUILD") == "1" # set in docs/conf.py + if is_compatible and not is_doc_build: + return func # return directly, do not change the docstring + + msg = "'{}' requires at least GEOS {}.{}.{}.".format( + func.__name__, *self.version + ) + if is_compatible: + + @wraps(func) + def wrapped(*args, **kwargs): + return func(*args, **kwargs) + + else: + + @wraps(func) + def wrapped(*args, **kwargs): + raise UnsupportedGEOSVersionError(msg) + + doc = wrapped.__doc__ + if doc: + # Insert the message at the first double newline + position = doc.find("\n\n") + 2 + # Figure out the indentation level + indent = 2 + while True: + if doc[position + indent] == " ": + indent += 1 + else: + break + wrapped.__doc__ = doc.replace( + "\n\n", "\n\n{}.. note:: {}\n\n".format(" " * indent, msg), 1 + ) + + return wrapped + + +def multithreading_enabled(func): + """Prepare multithreading by setting the writable flags of object type + ndarrays to False. + + NB: multithreading also requires the GIL to be released, which is done in + the C extension (ufuncs.c).""" + + @wraps(func) + def wrapped(*args, **kwargs): + array_args = [ + arg for arg in args if isinstance(arg, np.ndarray) and arg.dtype == object + ] + [ + arg + for name, arg in kwargs.items() + if name not in {"where", "out"} + and isinstance(arg, np.ndarray) + and arg.dtype == object + ] + old_flags = [arr.flags.writeable for arr in array_args] + try: + for arr in array_args: + arr.flags.writeable = False + return func(*args, **kwargs) + finally: + for arr, old_flag in zip(array_args, old_flags): + arr.flags.writeable = old_flag + + return wrapped diff --git a/billinglayer/python/shapely/errors.py b/billinglayer/python/shapely/errors.py new file mode 100644 index 0000000..8610472 --- /dev/null +++ b/billinglayer/python/shapely/errors.py @@ -0,0 +1,81 @@ +"""Shapely errors.""" +import threading + +from shapely.lib import _setup_signal_checks, GEOSException, ShapelyError # NOQA + + +def setup_signal_checks(interval=10000): + """This enables Python signal checks in the ufunc inner loops. + + Doing so allows termination (using CTRL+C) of operations on large arrays of vectors. + + Parameters + ---------- + interval : int, default 10000 + Check for interrupts every x iterations. The higher the number, the slower + shapely will respond to a signal. However, at low values there will be a negative effect + on performance. The default of 10000 does not have any measureable effects on performance. + + Notes + ----- + For more information on signals consult the Python docs: + + https://docs.python.org/3/library/signal.html + """ + if interval <= 0: + raise ValueError("Signal checks interval must be greater than zero.") + + _setup_signal_checks(interval, threading.main_thread().ident) + + +class UnsupportedGEOSVersionError(ShapelyError): + """Raised when the GEOS library version does not support a certain operation.""" + + +class DimensionError(ShapelyError): + """An error in the number of coordinate dimensions.""" + + +class TopologicalError(ShapelyError): + """A geometry is invalid or topologically incorrect.""" + + +class ShapelyDeprecationWarning(FutureWarning): + """ + Warning for features that will be removed or behaviour that will be + changed in a future release. + """ + + +class EmptyPartError(ShapelyError): + """An error signifying an empty part was encountered when creating a multi-part.""" + + +class GeometryTypeError(ShapelyError): + """ + An error raised when the type of the geometry in question is + unrecognized or inappropriate. + """ + + +def __getattr__(name): + import warnings + + # Alias Shapely 1.8 error classes to ShapelyError with deprecation warning + if name in [ + "ReadingError", + "WKBReadingError", + "WKTReadingError", + "PredicateError", + "InvalidGeometryError", + ]: + warnings.warn( + f"{name} is deprecated and will be removed in a future version. " + "Use ShapelyError instead (functions previously raising {name} " + "will now raise a ShapelyError instead).", + DeprecationWarning, + stacklevel=2, + ) + return ShapelyError + + raise AttributeError(f"module 'shapely.errors' has no attribute '{name}'") diff --git a/billinglayer/python/shapely/geometry/__init__.py b/billinglayer/python/shapely/geometry/__init__.py new file mode 100644 index 0000000..dd92266 --- /dev/null +++ b/billinglayer/python/shapely/geometry/__init__.py @@ -0,0 +1,28 @@ +"""Geometry classes and factories +""" + +from .base import CAP_STYLE, JOIN_STYLE +from .collection import GeometryCollection +from .geo import box, mapping, shape +from .linestring import LineString +from .multilinestring import MultiLineString +from .multipoint import MultiPoint +from .multipolygon import MultiPolygon +from .point import Point +from .polygon import LinearRing, Polygon + +__all__ = [ + "box", + "shape", + "mapping", + "Point", + "LineString", + "Polygon", + "MultiPoint", + "MultiLineString", + "MultiPolygon", + "GeometryCollection", + "LinearRing", + "CAP_STYLE", + "JOIN_STYLE", +] diff --git a/billinglayer/python/shapely/geometry/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b292376 Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/base.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..003cff6 Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/base.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/collection.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/collection.cpython-311.pyc new file mode 100644 index 0000000..8083e7f Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/collection.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/conftest.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/conftest.cpython-311.pyc new file mode 100644 index 0000000..709317e Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/conftest.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/geo.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/geo.cpython-311.pyc new file mode 100644 index 0000000..bbe648d Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/geo.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/linestring.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/linestring.cpython-311.pyc new file mode 100644 index 0000000..9c8f36b Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/linestring.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/multilinestring.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/multilinestring.cpython-311.pyc new file mode 100644 index 0000000..3241902 Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/multilinestring.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/multipoint.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/multipoint.cpython-311.pyc new file mode 100644 index 0000000..f436d01 Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/multipoint.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/multipolygon.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/multipolygon.cpython-311.pyc new file mode 100644 index 0000000..c6d9a8b Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/multipolygon.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/point.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/point.cpython-311.pyc new file mode 100644 index 0000000..693a2fc Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/point.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/__pycache__/polygon.cpython-311.pyc b/billinglayer/python/shapely/geometry/__pycache__/polygon.cpython-311.pyc new file mode 100644 index 0000000..7f86f1e Binary files /dev/null and b/billinglayer/python/shapely/geometry/__pycache__/polygon.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/geometry/base.py b/billinglayer/python/shapely/geometry/base.py new file mode 100644 index 0000000..a035570 --- /dev/null +++ b/billinglayer/python/shapely/geometry/base.py @@ -0,0 +1,994 @@ +"""Base geometry class and utilities + +Note: a third, z, coordinate value may be used when constructing +geometry objects, but has no effect on geometric analysis. All +operations are performed in the x-y plane. Thus, geometries with +different z values may intersect or be equal. +""" +import re +from warnings import warn + +import numpy as np + +import shapely +from shapely._geometry_helpers import _geom_factory +from shapely.constructive import BufferCapStyle, BufferJoinStyle +from shapely.coords import CoordinateSequence +from shapely.errors import GeometryTypeError, GEOSException, ShapelyDeprecationWarning + +GEOMETRY_TYPES = [ + "Point", + "LineString", + "LinearRing", + "Polygon", + "MultiPoint", + "MultiLineString", + "MultiPolygon", + "GeometryCollection", +] + + +def geom_factory(g, parent=None): + """ + Creates a Shapely geometry instance from a pointer to a GEOS geometry. + + .. warning:: + The GEOS library used to create the the GEOS geometry pointer + and the GEOS library used by Shapely must be exactly the same, or + unexpected results or segfaults may occur. + + .. deprecated:: 2.0 + Deprecated in Shapely 2.0, and will be removed in a future version. + """ + warn( + "The 'geom_factory' function is deprecated in Shapely 2.0, and will be " + "removed in a future version", + DeprecationWarning, + stacklevel=2, + ) + return _geom_factory(g) + + +def dump_coords(geom): + """Dump coordinates of a geometry in the same order as data packing""" + if not isinstance(geom, BaseGeometry): + raise ValueError( + "Must be instance of a geometry class; found " + geom.__class__.__name__ + ) + elif geom.geom_type in ("Point", "LineString", "LinearRing"): + return geom.coords[:] + elif geom.geom_type == "Polygon": + return geom.exterior.coords[:] + [i.coords[:] for i in geom.interiors] + elif geom.geom_type.startswith("Multi") or geom.geom_type == "GeometryCollection": + # Recursive call + return [dump_coords(part) for part in geom.geoms] + else: + raise GeometryTypeError("Unhandled geometry type: " + repr(geom.geom_type)) + + +def _maybe_unpack(result): + if result.ndim == 0: + # convert numpy 0-d array / scalar to python scalar + return result.item() + else: + # >=1 dim array + return result + + +class CAP_STYLE: + round = BufferCapStyle.round + flat = BufferCapStyle.flat + square = BufferCapStyle.square + + +class JOIN_STYLE: + round = BufferJoinStyle.round + mitre = BufferJoinStyle.mitre + bevel = BufferJoinStyle.bevel + + +class BaseGeometry(shapely.Geometry): + """ + Provides GEOS spatial predicates and topological operations. + + """ + + __slots__ = [] + + def __new__(self): + warn( + "Directly calling the base class 'BaseGeometry()' is deprecated, and " + "will raise an error in the future. To create an empty geometry, " + "use one of the subclasses instead, for example 'GeometryCollection()'.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") + + @property + def _ndim(self): + return shapely.get_coordinate_dimension(self) + + def __bool__(self): + return self.is_empty is False + + def __nonzero__(self): + return self.__bool__() + + def __format__(self, format_spec): + """Format a geometry using a format specification.""" + # bypass regexp for simple cases + if format_spec == "": + return shapely.to_wkt(self, rounding_precision=-1) + elif format_spec == "x": + return shapely.to_wkb(self, hex=True).lower() + elif format_spec == "X": + return shapely.to_wkb(self, hex=True) + + # fmt: off + format_spec_regexp = ( + "(?:0?\\.(?P[0-9]+))?" + "(?P[fFgGxX]?)" + ) + # fmt: on + match = re.fullmatch(format_spec_regexp, format_spec) + if match is None: + raise ValueError(f"invalid format specifier: {format_spec}") + + prec, fmt_code = match.groups() + + if prec: + prec = int(prec) + else: + # GEOS has a default rounding_precision -1 + prec = -1 + + if not fmt_code: + fmt_code = "g" + + if fmt_code in ("g", "G"): + res = shapely.to_wkt(self, rounding_precision=prec, trim=True) + elif fmt_code in ("f", "F"): + res = shapely.to_wkt(self, rounding_precision=prec, trim=False) + elif fmt_code in ("x", "X"): + raise ValueError("hex representation does not specify precision") + else: + raise NotImplementedError(f"unhandled fmt_code: {fmt_code}") + + if fmt_code.isupper(): + return res.upper() + else: + return res + + def __repr__(self): + try: + wkt = super().__str__() + except (GEOSException, ValueError): + # we never want a repr() to fail; that can be very confusing + return "".format( + self.__class__.__name__ + ) + + # the total length is limited to 80 characters including brackets + max_length = 78 + if len(wkt) > max_length: + return f"<{wkt[: max_length - 3]}...>" + + return f"<{wkt}>" + + def __str__(self): + return self.wkt + + def __reduce__(self): + return (shapely.from_wkb, (shapely.to_wkb(self, include_srid=True),)) + + # Operators + # --------- + + def __and__(self, other): + return self.intersection(other) + + def __or__(self, other): + return self.union(other) + + def __sub__(self, other): + return self.difference(other) + + def __xor__(self, other): + return self.symmetric_difference(other) + + # Coordinate access + # ----------------- + + @property + def coords(self): + """Access to geometry's coordinates (CoordinateSequence)""" + coords_array = shapely.get_coordinates(self, include_z=self.has_z) + return CoordinateSequence(coords_array) + + @property + def xy(self): + """Separate arrays of X and Y coordinate values""" + raise NotImplementedError + + # Python feature protocol + + @property + def __geo_interface__(self): + """Dictionary representation of the geometry""" + raise NotImplementedError + + # Type of geometry and its representations + # ---------------------------------------- + + def geometryType(self): + warn( + "The 'GeometryType()' method is deprecated, and will be removed in " + "the future. You can use the 'geom_type' attribute instead.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return self.geom_type + + @property + def type(self): + warn( + "The 'type' attribute is deprecated, and will be removed in " + "the future. You can use the 'geom_type' attribute instead.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return self.geom_type + + @property + def wkt(self): + """WKT representation of the geometry""" + # TODO(shapely-2.0) keep default of not trimming? + return shapely.to_wkt(self, rounding_precision=-1) + + @property + def wkb(self): + """WKB representation of the geometry""" + return shapely.to_wkb(self) + + @property + def wkb_hex(self): + """WKB hex representation of the geometry""" + return shapely.to_wkb(self, hex=True) + + def svg(self, scale_factor=1.0, **kwargs): + """Raises NotImplementedError""" + raise NotImplementedError + + def _repr_svg_(self): + """SVG representation for iPython notebook""" + svg_top = ( + '" + else: + # Establish SVG canvas that will fit all the data + small space + xmin, ymin, xmax, ymax = self.bounds + if xmin == xmax and ymin == ymax: + # This is a point; buffer using an arbitrary size + xmin, ymin, xmax, ymax = self.buffer(1).bounds + else: + # Expand bounds by a fraction of the data ranges + expand = 0.04 # or 4%, same as R plots + widest_part = max([xmax - xmin, ymax - ymin]) + expand_amount = widest_part * expand + xmin -= expand_amount + ymin -= expand_amount + xmax += expand_amount + ymax += expand_amount + dx = xmax - xmin + dy = ymax - ymin + width = min([max([100.0, dx]), 300]) + height = min([max([100.0, dy]), 300]) + try: + scale_factor = max([dx, dy]) / max([width, height]) + except ZeroDivisionError: + scale_factor = 1.0 + view_box = f"{xmin} {ymin} {dx} {dy}" + transform = f"matrix(1,0,0,-1,0,{ymax + ymin})" + return svg_top + ( + 'width="{1}" height="{2}" viewBox="{0}" ' + 'preserveAspectRatio="xMinYMin meet">' + '{4}' + ).format(view_box, width, height, transform, self.svg(scale_factor)) + + @property + def geom_type(self): + """Name of the geometry's type, such as 'Point'""" + return GEOMETRY_TYPES[shapely.get_type_id(self)] + + # Real-valued properties and methods + # ---------------------------------- + + @property + def area(self): + """Unitless area of the geometry (float)""" + return float(shapely.area(self)) + + def distance(self, other): + """Unitless distance to other geometry (float)""" + return _maybe_unpack(shapely.distance(self, other)) + + def hausdorff_distance(self, other): + """Unitless hausdorff distance to other geometry (float)""" + return _maybe_unpack(shapely.hausdorff_distance(self, other)) + + @property + def length(self): + """Unitless length of the geometry (float)""" + return float(shapely.length(self)) + + @property + def minimum_clearance(self): + """Unitless distance by which a node could be moved to produce an invalid geometry (float)""" + return float(shapely.minimum_clearance(self)) + + # Topological properties + # ---------------------- + + @property + def boundary(self): + """Returns a lower dimension geometry that bounds the object + + The boundary of a polygon is a line, the boundary of a line is a + collection of points. The boundary of a point is an empty (null) + collection. + """ + return shapely.boundary(self) + + @property + def bounds(self): + """Returns minimum bounding region (minx, miny, maxx, maxy)""" + return tuple(shapely.bounds(self).tolist()) + + @property + def centroid(self): + """Returns the geometric center of the object""" + return shapely.centroid(self) + + def point_on_surface(self): + """Returns a point guaranteed to be within the object, cheaply. + + Alias of `representative_point`. + """ + return shapely.point_on_surface(self) + + def representative_point(self): + """Returns a point guaranteed to be within the object, cheaply. + + Alias of `point_on_surface`. + """ + return shapely.point_on_surface(self) + + @property + def convex_hull(self): + """Imagine an elastic band stretched around the geometry: that's a + convex hull, more or less + + The convex hull of a three member multipoint, for example, is a + triangular polygon. + """ + return shapely.convex_hull(self) + + @property + def envelope(self): + """A figure that envelopes the geometry""" + return shapely.envelope(self) + + @property + def oriented_envelope(self): + """ + Returns the oriented envelope (minimum rotated rectangle) that + encloses the geometry. + + Unlike envelope this rectangle is not constrained to be parallel to the + coordinate axes. If the convex hull of the object is a degenerate (line + or point) this degenerate is returned. + + Alias of `minimum_rotated_rectangle`. + """ + return shapely.oriented_envelope(self) + + @property + def minimum_rotated_rectangle(self): + """ + Returns the oriented envelope (minimum rotated rectangle) that + encloses the geometry. + + Unlike `envelope` this rectangle is not constrained to be parallel to the + coordinate axes. If the convex hull of the object is a degenerate (line + or point) this degenerate is returned. + + Alias of `oriented_envelope`. + """ + return shapely.oriented_envelope(self) + + def buffer( + self, + distance, + quad_segs=16, + cap_style="round", + join_style="round", + mitre_limit=5.0, + single_sided=False, + **kwargs, + ): + """Get a geometry that represents all points within a distance + of this geometry. + + A positive distance produces a dilation, a negative distance an + erosion. A very small or zero distance may sometimes be used to + "tidy" a polygon. + + Parameters + ---------- + distance : float + The distance to buffer around the object. + resolution : int, optional + The resolution of the buffer around each vertex of the + object. + quad_segs : int, optional + Sets the number of line segments used to approximate an + angle fillet. + cap_style : shapely.BufferCapStyle or {'round', 'square', 'flat'}, default 'round' + Specifies the shape of buffered line endings. BufferCapStyle.round ('round') + results in circular line endings (see ``quad_segs``). Both BufferCapStyle.square + ('square') and BufferCapStyle.flat ('flat') result in rectangular line endings, + only BufferCapStyle.flat ('flat') will end at the original vertex, + while BufferCapStyle.square ('square') involves adding the buffer width. + join_style : shapely.BufferJoinStyle or {'round', 'mitre', 'bevel'}, default 'round' + Specifies the shape of buffered line midpoints. BufferJoinStyle.ROUND ('round') + results in rounded shapes. BufferJoinStyle.bevel ('bevel') results in a beveled + edge that touches the original vertex. BufferJoinStyle.mitre ('mitre') results + in a single vertex that is beveled depending on the ``mitre_limit`` parameter. + mitre_limit : float, optional + The mitre limit ratio is used for very sharp corners. The + mitre ratio is the ratio of the distance from the corner to + the end of the mitred offset corner. When two line segments + meet at a sharp angle, a miter join will extend the original + geometry. To prevent unreasonable geometry, the mitre limit + allows controlling the maximum length of the join corner. + Corners with a ratio which exceed the limit will be beveled. + single_side : bool, optional + The side used is determined by the sign of the buffer + distance: + + a positive distance indicates the left-hand side + a negative distance indicates the right-hand side + + The single-sided buffer of point geometries is the same as + the regular buffer. The End Cap Style for single-sided + buffers is always ignored, and forced to the equivalent of + CAP_FLAT. + quadsegs : int, optional + Deprecated alias for `quad_segs`. + + Returns + ------- + Geometry + + Notes + ----- + The return value is a strictly two-dimensional geometry. All + Z coordinates of the original geometry will be ignored. + + Examples + -------- + >>> from shapely.wkt import loads + >>> g = loads('POINT (0.0 0.0)') + + 16-gon approx of a unit radius circle: + + >>> g.buffer(1.0).area # doctest: +ELLIPSIS + 3.1365484905459... + + 128-gon approximation: + + >>> g.buffer(1.0, 128).area # doctest: +ELLIPSIS + 3.141513801144... + + triangle approximation: + + >>> g.buffer(1.0, 3).area + 3.0 + >>> list(g.buffer(1.0, cap_style=BufferCapStyle.square).exterior.coords) + [(1.0, 1.0), (1.0, -1.0), (-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0)] + >>> g.buffer(1.0, cap_style=BufferCapStyle.square).area + 4.0 + + """ + quadsegs = kwargs.pop("quadsegs", None) + if quadsegs is not None: + warn( + "The `quadsegs` argument is deprecated. Use `quad_segs` instead.", + FutureWarning, + ) + quad_segs = quadsegs + + # TODO deprecate `resolution` keyword for shapely 2.1 + resolution = kwargs.pop("resolution", None) + if resolution is not None: + quad_segs = resolution + if kwargs: + kwarg = list(kwargs.keys())[0] # noqa + raise TypeError(f"buffer() got an unexpected keyword argument '{kwarg}'") + + if mitre_limit == 0.0: + raise ValueError("Cannot compute offset from zero-length line segment") + elif not np.isfinite(distance).all(): + raise ValueError("buffer distance must be finite") + + return shapely.buffer( + self, + distance, + quad_segs=quad_segs, + cap_style=cap_style, + join_style=join_style, + mitre_limit=mitre_limit, + single_sided=single_sided, + ) + + def simplify(self, tolerance, preserve_topology=True): + """Returns a simplified geometry produced by the Douglas-Peucker + algorithm + + Coordinates of the simplified geometry will be no more than the + tolerance distance from the original. Unless the topology preserving + option is used, the algorithm may produce self-intersecting or + otherwise invalid geometries. + """ + return shapely.simplify(self, tolerance, preserve_topology=preserve_topology) + + def normalize(self): + """Converts geometry to normal form (or canonical form). + + This method orders the coordinates, rings of a polygon and parts of + multi geometries consistently. Typically useful for testing purposes + (for example in combination with `equals_exact`). + + Examples + -------- + >>> from shapely import MultiLineString + >>> line = MultiLineString([[(0, 0), (1, 1)], [(3, 3), (2, 2)]]) + >>> line.normalize() + + """ + return shapely.normalize(self) + + # Overlay operations + # --------------------------- + + def difference(self, other, grid_size=None): + """ + Returns the difference of the geometries. + + Refer to `shapely.difference` for full documentation. + """ + return shapely.difference(self, other, grid_size=grid_size) + + def intersection(self, other, grid_size=None): + """ + Returns the intersection of the geometries. + + Refer to `shapely.intersection` for full documentation. + """ + return shapely.intersection(self, other, grid_size=grid_size) + + def symmetric_difference(self, other, grid_size=None): + """ + Returns the symmetric difference of the geometries. + + Refer to `shapely.symmetric_difference` for full documentation. + """ + return shapely.symmetric_difference(self, other, grid_size=grid_size) + + def union(self, other, grid_size=None): + """ + Returns the union of the geometries. + + Refer to `shapely.union` for full documentation. + """ + return shapely.union(self, other, grid_size=grid_size) + + # Unary predicates + # ---------------- + + @property + def has_z(self): + """True if the geometry's coordinate sequence(s) have z values (are + 3-dimensional)""" + return bool(shapely.has_z(self)) + + @property + def is_empty(self): + """True if the set of points in this geometry is empty, else False""" + return bool(shapely.is_empty(self)) + + @property + def is_ring(self): + """True if the geometry is a closed ring, else False""" + return bool(shapely.is_ring(self)) + + @property + def is_closed(self): + """True if the geometry is closed, else False + + Applicable only to 1-D geometries.""" + if self.geom_type == "LinearRing": + return True + return bool(shapely.is_closed(self)) + + @property + def is_simple(self): + """True if the geometry is simple, meaning that any self-intersections + are only at boundary points, else False""" + return bool(shapely.is_simple(self)) + + @property + def is_valid(self): + """True if the geometry is valid (definition depends on sub-class), + else False""" + return bool(shapely.is_valid(self)) + + # Binary predicates + # ----------------- + + def relate(self, other): + """Returns the DE-9IM intersection matrix for the two geometries + (string)""" + return shapely.relate(self, other) + + def covers(self, other): + """Returns True if the geometry covers the other, else False""" + return _maybe_unpack(shapely.covers(self, other)) + + def covered_by(self, other): + """Returns True if the geometry is covered by the other, else False""" + return _maybe_unpack(shapely.covered_by(self, other)) + + def contains(self, other): + """Returns True if the geometry contains the other, else False""" + return _maybe_unpack(shapely.contains(self, other)) + + def contains_properly(self, other): + """ + Returns True if the geometry completely contains the other, with no + common boundary points, else False + + Refer to `shapely.contains_properly` for full documentation. + """ + return _maybe_unpack(shapely.contains_properly(self, other)) + + def crosses(self, other): + """Returns True if the geometries cross, else False""" + return _maybe_unpack(shapely.crosses(self, other)) + + def disjoint(self, other): + """Returns True if geometries are disjoint, else False""" + return _maybe_unpack(shapely.disjoint(self, other)) + + def equals(self, other): + """Returns True if geometries are equal, else False. + + This method considers point-set equality (or topological + equality), and is equivalent to (self.within(other) & + self.contains(other)). + + Examples + -------- + >>> LineString( + ... [(0, 0), (2, 2)] + ... ).equals( + ... LineString([(0, 0), (1, 1), (2, 2)]) + ... ) + True + + Returns + ------- + bool + + """ + return _maybe_unpack(shapely.equals(self, other)) + + def intersects(self, other): + """Returns True if geometries intersect, else False""" + return _maybe_unpack(shapely.intersects(self, other)) + + def overlaps(self, other): + """Returns True if geometries overlap, else False""" + return _maybe_unpack(shapely.overlaps(self, other)) + + def touches(self, other): + """Returns True if geometries touch, else False""" + return _maybe_unpack(shapely.touches(self, other)) + + def within(self, other): + """Returns True if geometry is within the other, else False""" + return _maybe_unpack(shapely.within(self, other)) + + def dwithin(self, other, distance): + """ + Returns True if geometry is within a given distance from the other, else False. + + Refer to `shapely.dwithin` for full documentation. + """ + return _maybe_unpack(shapely.dwithin(self, other, distance)) + + def equals_exact(self, other, tolerance): + """True if geometries are equal to within a specified + tolerance. + + Parameters + ---------- + other : BaseGeometry + The other geometry object in this comparison. + tolerance : float + Absolute tolerance in the same units as coordinates. + + This method considers coordinate equality, which requires + coordinates to be equal and in the same order for all components + of a geometry. + + Because of this it is possible for "equals()" to be True for two + geometries and "equals_exact()" to be False. + + Examples + -------- + >>> LineString( + ... [(0, 0), (2, 2)] + ... ).equals_exact( + ... LineString([(0, 0), (1, 1), (2, 2)]), + ... 1e-6 + ... ) + False + + Returns + ------- + bool + + """ + return _maybe_unpack(shapely.equals_exact(self, other, tolerance)) + + def almost_equals(self, other, decimal=6): + """True if geometries are equal at all coordinates to a + specified decimal place. + + .. deprecated:: 1.8.0 + The 'almost_equals()' method is deprecated + and will be removed in Shapely 2.1 because the name is + confusing. The 'equals_exact()' method should be used + instead. + + Refers to approximate coordinate equality, which requires + coordinates to be approximately equal and in the same order for + all components of a geometry. + + Because of this it is possible for "equals()" to be True for two + geometries and "almost_equals()" to be False. + + Examples + -------- + >>> LineString( + ... [(0, 0), (2, 2)] + ... ).equals_exact( + ... LineString([(0, 0), (1, 1), (2, 2)]), + ... 1e-6 + ... ) + False + + Returns + ------- + bool + + """ + warn( + "The 'almost_equals()' method is deprecated and will be " + "removed in Shapely 2.1; use 'equals_exact()' instead", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return self.equals_exact(other, 0.5 * 10 ** (-decimal)) + + def relate_pattern(self, other, pattern): + """Returns True if the DE-9IM string code for the relationship between + the geometries satisfies the pattern, else False""" + return _maybe_unpack(shapely.relate_pattern(self, other, pattern)) + + # Linear referencing + # ------------------ + + def line_locate_point(self, other, normalized=False): + """Returns the distance along this geometry to a point nearest the + specified point + + If the normalized arg is True, return the distance normalized to the + length of the linear geometry. + + Alias of `project`. + """ + return shapely.line_locate_point(self, other, normalized=normalized) + + def project(self, other, normalized=False): + """Returns the distance along this geometry to a point nearest the + specified point + + If the normalized arg is True, return the distance normalized to the + length of the linear geometry. + + Alias of `line_locate_point`. + """ + return shapely.line_locate_point(self, other, normalized=normalized) + + def line_interpolate_point(self, distance, normalized=False): + """Return a point at the specified distance along a linear geometry + + Negative length values are taken as measured in the reverse + direction from the end of the geometry. Out-of-range index + values are handled by clamping them to the valid range of values. + If the normalized arg is True, the distance will be interpreted as a + fraction of the geometry's length. + + Alias of `interpolate`. + """ + return shapely.line_interpolate_point(self, distance, normalized=normalized) + + def interpolate(self, distance, normalized=False): + """Return a point at the specified distance along a linear geometry + + Negative length values are taken as measured in the reverse + direction from the end of the geometry. Out-of-range index + values are handled by clamping them to the valid range of values. + If the normalized arg is True, the distance will be interpreted as a + fraction of the geometry's length. + + Alias of `line_interpolate_point`. + """ + return shapely.line_interpolate_point(self, distance, normalized=normalized) + + def segmentize(self, max_segment_length): + """Adds vertices to line segments based on maximum segment length. + + Additional vertices will be added to every line segment in an input geometry + so that segments are no longer than the provided maximum segment length. New + vertices will evenly subdivide each segment. + + Only linear components of input geometries are densified; other geometries + are returned unmodified. + + Parameters + ---------- + max_segment_length : float or array_like + Additional vertices will be added so that all line segments are no + longer this value. Must be greater than 0. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> LineString([(0, 0), (0, 10)]).segmentize(max_segment_length=5) + + >>> Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]).segmentize(max_segment_length=5) + + """ + return shapely.segmentize(self, max_segment_length) + + def reverse(self): + """Returns a copy of this geometry with the order of coordinates reversed. + + If the geometry is a polygon with interior rings, the interior rings are also + reversed. + + Points are unchanged. + + See also + -------- + is_ccw : Checks if a geometry is clockwise. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> LineString([(0, 0), (1, 2)]).reverse() + + >>> Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]).reverse() + + """ + return shapely.reverse(self) + + +class BaseMultipartGeometry(BaseGeometry): + + __slots__ = [] + + @property + def coords(self): + raise NotImplementedError( + "Sub-geometries may have coordinate sequences, " + "but multi-part geometries do not" + ) + + @property + def geoms(self): + return GeometrySequence(self) + + def __bool__(self): + return self.is_empty is False + + def svg(self, scale_factor=1.0, color=None): + """Returns a group of SVG elements for the multipart geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + color : str, optional + Hex string for stroke or fill color. Default is to use "#66cc99" + if geometry is valid, and "#ff3333" if invalid. + """ + if self.is_empty: + return "" + if color is None: + color = "#66cc99" if self.is_valid else "#ff3333" + return "" + "".join(p.svg(scale_factor, color) for p in self.geoms) + "" + + +class GeometrySequence: + """ + Iterative access to members of a homogeneous multipart geometry. + """ + + # Attributes + # ---------- + # _parent : object + # Parent (Shapely) geometry + _parent = None + + def __init__(self, parent): + self._parent = parent + + def _get_geom_item(self, i): + return shapely.get_geometry(self._parent, i) + + def __iter__(self): + for i in range(self.__len__()): + yield self._get_geom_item(i) + + def __len__(self): + return shapely.get_num_geometries(self._parent) + + def __getitem__(self, key): + m = self.__len__() + if isinstance(key, (int, np.integer)): + if key + m < 0 or key >= m: + raise IndexError("index out of range") + if key < 0: + i = m + key + else: + i = key + return self._get_geom_item(i) + elif isinstance(key, slice): + res = [] + start, stop, stride = key.indices(m) + for i in range(start, stop, stride): + res.append(self._get_geom_item(i)) + return type(self._parent)(res or None) + else: + raise TypeError("key must be an index or slice") + + +class EmptyGeometry(BaseGeometry): + def __new__(self): + """Create an empty geometry.""" + warn( + "The 'EmptyGeometry()' constructor to create an empty geometry is " + "deprecated, and will raise an error in the future. Use one of the " + "geometry subclasses instead, for example 'GeometryCollection()'.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") diff --git a/billinglayer/python/shapely/geometry/collection.py b/billinglayer/python/shapely/geometry/collection.py new file mode 100644 index 0000000..83a85bc --- /dev/null +++ b/billinglayer/python/shapely/geometry/collection.py @@ -0,0 +1,58 @@ +"""Multi-part collections of geometries +""" + +import shapely +from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry + + +class GeometryCollection(BaseMultipartGeometry): + """ + A collection of one or more geometries that may contain more than one type + of geometry. + + Parameters + ---------- + geoms : list + A list of shapely geometry instances, which may be of varying + geometry types. + + Attributes + ---------- + geoms : sequence + A sequence of Shapely geometry instances + + Examples + -------- + Create a GeometryCollection with a Point and a LineString + + >>> from shapely import LineString, Point + >>> p = Point(51, -1) + >>> l = LineString([(52, -1), (49, 2)]) + >>> gc = GeometryCollection([p, l]) + """ + + __slots__ = [] + + def __new__(self, geoms=None): + if not geoms: + # TODO better empty constructor + return shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") + if isinstance(geoms, BaseGeometry): + # TODO(shapely-2.0) do we actually want to split Multi-part geometries? + # this is needed for the split() tests + if hasattr(geoms, "geoms"): + geoms = geoms.geoms + else: + geoms = [geoms] + + return shapely.geometrycollections(geoms) + + @property + def __geo_interface__(self): + geometries = [] + for geom in self.geoms: + geometries.append(geom.__geo_interface__) + return dict(type="GeometryCollection", geometries=geometries) + + +shapely.lib.registry[7] = GeometryCollection diff --git a/billinglayer/python/shapely/geometry/conftest.py b/billinglayer/python/shapely/geometry/conftest.py new file mode 100644 index 0000000..e248019 --- /dev/null +++ b/billinglayer/python/shapely/geometry/conftest.py @@ -0,0 +1,10 @@ +"""Autouse fixtures for doctests.""" + +import pytest + +from .linestring import LineString + + +@pytest.fixture(autouse=True) +def add_linestring(doctest_namespace): + doctest_namespace["LineString"] = LineString diff --git a/billinglayer/python/shapely/geometry/geo.py b/billinglayer/python/shapely/geometry/geo.py new file mode 100644 index 0000000..aec2827 --- /dev/null +++ b/billinglayer/python/shapely/geometry/geo.py @@ -0,0 +1,136 @@ +""" +Geometry factories based on the geo interface +""" +import numpy as np + +from shapely.errors import GeometryTypeError + +from .collection import GeometryCollection +from .linestring import LineString +from .multilinestring import MultiLineString +from .multipoint import MultiPoint +from .multipolygon import MultiPolygon +from .point import Point +from .polygon import LinearRing, Polygon + + +def _is_coordinates_empty(coordinates): + """Helper to identify if coordinates or subset of coordinates are empty""" + + if coordinates is None: + return True + + if isinstance(coordinates, (list, tuple, np.ndarray)): + if len(coordinates) == 0: + return True + return all(map(_is_coordinates_empty, coordinates)) + else: + return False + + +def _empty_shape_for_no_coordinates(geom_type): + """Return empty counterpart for geom_type""" + if geom_type == "point": + return Point() + elif geom_type == "multipoint": + return MultiPoint() + elif geom_type == "linestring": + return LineString() + elif geom_type == "multilinestring": + return MultiLineString() + elif geom_type == "polygon": + return Polygon() + elif geom_type == "multipolygon": + return MultiPolygon() + else: + raise GeometryTypeError(f"Unknown geometry type: {geom_type!r}") + + +def box(minx, miny, maxx, maxy, ccw=True): + """Returns a rectangular polygon with configurable normal vector""" + coords = [(maxx, miny), (maxx, maxy), (minx, maxy), (minx, miny)] + if not ccw: + coords = coords[::-1] + return Polygon(coords) + + +def shape(context): + """ + Returns a new, independent geometry with coordinates *copied* from the + context. Changes to the original context will not be reflected in the + geometry object. + + Parameters + ---------- + context : + a GeoJSON-like dict, which provides a "type" member describing the type + of the geometry and "coordinates" member providing a list of coordinates, + or an object which implements __geo_interface__. + + Returns + ------- + Geometry object + + Examples + -------- + Create a Point from GeoJSON, and then create a copy using __geo_interface__. + + >>> context = {'type': 'Point', 'coordinates': [0, 1]} + >>> geom = shape(context) + >>> geom.geom_type == 'Point' + True + >>> geom.wkt + 'POINT (0 1)' + >>> geom2 = shape(geom) + >>> geom == geom2 + True + """ + if hasattr(context, "__geo_interface__"): + ob = context.__geo_interface__ + else: + ob = context + geom_type = ob.get("type").lower() + if "coordinates" in ob and _is_coordinates_empty(ob["coordinates"]): + return _empty_shape_for_no_coordinates(geom_type) + elif geom_type == "point": + return Point(ob["coordinates"]) + elif geom_type == "linestring": + return LineString(ob["coordinates"]) + elif geom_type == "linearring": + return LinearRing(ob["coordinates"]) + elif geom_type == "polygon": + return Polygon(ob["coordinates"][0], ob["coordinates"][1:]) + elif geom_type == "multipoint": + return MultiPoint(ob["coordinates"]) + elif geom_type == "multilinestring": + return MultiLineString(ob["coordinates"]) + elif geom_type == "multipolygon": + return MultiPolygon([[c[0], c[1:]] for c in ob["coordinates"]]) + elif geom_type == "geometrycollection": + geoms = [shape(g) for g in ob.get("geometries", [])] + return GeometryCollection(geoms) + else: + raise GeometryTypeError(f"Unknown geometry type: {geom_type!r}") + + +def mapping(ob): + """ + Returns a GeoJSON-like mapping from a Geometry or any + object which implements __geo_interface__ + + Parameters + ---------- + ob : + An object which implements __geo_interface__. + + Returns + ------- + dict + + Examples + -------- + >>> pt = Point(0, 0) + >>> mapping(pt) + {'type': 'Point', 'coordinates': (0.0, 0.0)} + """ + return ob.__geo_interface__ diff --git a/billinglayer/python/shapely/geometry/linestring.py b/billinglayer/python/shapely/geometry/linestring.py new file mode 100644 index 0000000..fdb7936 --- /dev/null +++ b/billinglayer/python/shapely/geometry/linestring.py @@ -0,0 +1,188 @@ +"""Line strings and related utilities +""" +import numpy as np + +import shapely +from shapely.geometry.base import BaseGeometry, JOIN_STYLE +from shapely.geometry.point import Point + +__all__ = ["LineString"] + + +class LineString(BaseGeometry): + """ + A geometry type composed of one or more line segments. + + A LineString is a one-dimensional feature and has a non-zero length but + zero area. It may approximate a curve and need not be straight. Unlike a + LinearRing, a LineString is not closed. + + Parameters + ---------- + coordinates : sequence + A sequence of (x, y, [,z]) numeric coordinate pairs or triples, or + an array-like with shape (N, 2) or (N, 3). + Also can be a sequence of Point objects. + + Examples + -------- + Create a LineString with two segments + + >>> a = LineString([[0, 0], [1, 0], [1, 1]]) + >>> a.length + 2.0 + """ + + __slots__ = [] + + def __new__(self, coordinates=None): + if coordinates is None: + # empty geometry + # TODO better constructor + return shapely.from_wkt("LINESTRING EMPTY") + elif isinstance(coordinates, LineString): + if type(coordinates) == LineString: + # return original objects since geometries are immutable + return coordinates + else: + # LinearRing + # TODO convert LinearRing to LineString more directly + coordinates = coordinates.coords + else: + if hasattr(coordinates, "__array__"): + coordinates = np.asarray(coordinates) + if isinstance(coordinates, np.ndarray) and np.issubdtype( + coordinates.dtype, np.number + ): + pass + else: + # check coordinates on points + def _coords(o): + if isinstance(o, Point): + return o.coords[0] + else: + return [float(c) for c in o] + + coordinates = [_coords(o) for o in coordinates] + + if len(coordinates) == 0: + # empty geometry + # TODO better constructor + should shapely.linestrings handle this? + return shapely.from_wkt("LINESTRING EMPTY") + + geom = shapely.linestrings(coordinates) + if not isinstance(geom, LineString): + raise ValueError("Invalid values passed to LineString constructor") + return geom + + @property + def __geo_interface__(self): + return {"type": "LineString", "coordinates": tuple(self.coords)} + + def svg(self, scale_factor=1.0, stroke_color=None, opacity=None): + """Returns SVG polyline element for the LineString geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + stroke_color : str, optional + Hex string for stroke color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.8 + """ + if self.is_empty: + return "" + if stroke_color is None: + stroke_color = "#66cc99" if self.is_valid else "#ff3333" + if opacity is None: + opacity = 0.8 + pnt_format = " ".join(["{},{}".format(*c) for c in self.coords]) + return ( + '' + ).format(pnt_format, 2.0 * scale_factor, stroke_color, opacity) + + @property + def xy(self): + """Separate arrays of X and Y coordinate values + + Example: + + >>> x, y = LineString([(0, 0), (1, 1)]).xy + >>> list(x) + [0.0, 1.0] + >>> list(y) + [0.0, 1.0] + """ + return self.coords.xy + + def offset_curve( + self, + distance, + quad_segs=16, + join_style=JOIN_STYLE.round, + mitre_limit=5.0, + ): + """Returns a LineString or MultiLineString geometry at a distance from + the object on its right or its left side. + + The side is determined by the sign of the `distance` parameter + (negative for right side offset, positive for left side offset). The + resolution of the buffer around each vertex of the object increases + by increasing the `quad_segs` keyword parameter. + + The join style is for outside corners between line segments. Accepted + values are JOIN_STYLE.round (1), JOIN_STYLE.mitre (2), and + JOIN_STYLE.bevel (3). + + The mitre ratio limit is used for very sharp corners. It is the ratio + of the distance from the corner to the end of the mitred offset corner. + When two line segments meet at a sharp angle, a miter join will extend + far beyond the original geometry. To prevent unreasonable geometry, the + mitre limit allows controlling the maximum length of the join corner. + Corners with a ratio which exceed the limit will be beveled. + + Note: the behaviour regarding orientation of the resulting line + depends on the GEOS version. With GEOS < 3.11, the line retains the + same direction for a left offset (positive distance) or has reverse + direction for a right offset (negative distance), and this behaviour + was documented as such in previous Shapely versions. Starting with + GEOS 3.11, the function tries to preserve the orientation of the + original line. + """ + if mitre_limit == 0.0: + raise ValueError("Cannot compute offset from zero-length line segment") + elif not np.isfinite(distance): + raise ValueError("offset_curve distance must be finite") + return shapely.offset_curve(self, distance, quad_segs, join_style, mitre_limit) + + def parallel_offset( + self, + distance, + side="right", + resolution=16, + join_style=JOIN_STYLE.round, + mitre_limit=5.0, + ): + """ + Alternative method to :meth:`offset_curve` method. + + Older alternative method to the :meth:`offset_curve` method, but uses + ``resolution`` instead of ``quad_segs`` and a ``side`` keyword + ('left' or 'right') instead of sign of the distance. This method is + kept for backwards compatibility for now, but is is recommended to + use :meth:`offset_curve` instead. + """ + if side == "right": + distance *= -1 + return self.offset_curve( + distance, + quad_segs=resolution, + join_style=join_style, + mitre_limit=mitre_limit, + ) + + +shapely.lib.registry[1] = LineString diff --git a/billinglayer/python/shapely/geometry/multilinestring.py b/billinglayer/python/shapely/geometry/multilinestring.py new file mode 100644 index 0000000..8138220 --- /dev/null +++ b/billinglayer/python/shapely/geometry/multilinestring.py @@ -0,0 +1,93 @@ +"""Collections of linestrings and related utilities +""" + +import shapely +from shapely.errors import EmptyPartError +from shapely.geometry import linestring +from shapely.geometry.base import BaseMultipartGeometry + +__all__ = ["MultiLineString"] + + +class MultiLineString(BaseMultipartGeometry): + """ + A collection of one or more LineStrings. + + A MultiLineString has non-zero length and zero area. + + Parameters + ---------- + lines : sequence + A sequence LineStrings, or a sequence of line-like coordinate + sequences or array-likes (see accepted input for LineString). + + Attributes + ---------- + geoms : sequence + A sequence of LineStrings + + Examples + -------- + Construct a MultiLineString containing two LineStrings. + + >>> lines = MultiLineString([[[0, 0], [1, 2]], [[4, 4], [5, 6]]]) + """ + + __slots__ = [] + + def __new__(self, lines=None): + if not lines: + # allow creation of empty multilinestrings, to support unpickling + # TODO better empty constructor + return shapely.from_wkt("MULTILINESTRING EMPTY") + elif isinstance(lines, MultiLineString): + return lines + + lines = getattr(lines, "geoms", lines) + m = len(lines) + subs = [] + for i in range(m): + line = linestring.LineString(lines[i]) + if line.is_empty: + raise EmptyPartError( + "Can't create MultiLineString with empty component" + ) + subs.append(line) + + if len(lines) == 0: + return shapely.from_wkt("MULTILINESTRING EMPTY") + + return shapely.multilinestrings(subs) + + @property + def __geo_interface__(self): + return { + "type": "MultiLineString", + "coordinates": tuple(tuple(c for c in g.coords) for g in self.geoms), + } + + def svg(self, scale_factor=1.0, stroke_color=None, opacity=None): + """Returns a group of SVG polyline elements for the LineString geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + stroke_color : str, optional + Hex string for stroke color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.8 + """ + if self.is_empty: + return "" + if stroke_color is None: + stroke_color = "#66cc99" if self.is_valid else "#ff3333" + return ( + "" + + "".join(p.svg(scale_factor, stroke_color, opacity) for p in self.geoms) + + "" + ) + + +shapely.lib.registry[5] = MultiLineString diff --git a/billinglayer/python/shapely/geometry/multipoint.py b/billinglayer/python/shapely/geometry/multipoint.py new file mode 100644 index 0000000..f08486d --- /dev/null +++ b/billinglayer/python/shapely/geometry/multipoint.py @@ -0,0 +1,95 @@ +"""Collections of points and related utilities +""" + +import shapely +from shapely.errors import EmptyPartError +from shapely.geometry import point +from shapely.geometry.base import BaseMultipartGeometry + +__all__ = ["MultiPoint"] + + +class MultiPoint(BaseMultipartGeometry): + """ + A collection of one or more Points. + + A MultiPoint has zero area and zero length. + + Parameters + ---------- + points : sequence + A sequence of Points, or a sequence of (x, y [,z]) numeric coordinate + pairs or triples, or an array-like of shape (N, 2) or (N, 3). + + Attributes + ---------- + geoms : sequence + A sequence of Points + + Examples + -------- + Construct a MultiPoint containing two Points + + >>> from shapely import Point + >>> ob = MultiPoint([[0.0, 0.0], [1.0, 2.0]]) + >>> len(ob.geoms) + 2 + >>> type(ob.geoms[0]) == Point + True + """ + + __slots__ = [] + + def __new__(self, points=None): + if points is None: + # allow creation of empty multipoints, to support unpickling + # TODO better empty constructor + return shapely.from_wkt("MULTIPOINT EMPTY") + elif isinstance(points, MultiPoint): + return points + + m = len(points) + subs = [] + for i in range(m): + p = point.Point(points[i]) + if p.is_empty: + raise EmptyPartError("Can't create MultiPoint with empty component") + subs.append(p) + + if len(points) == 0: + return shapely.from_wkt("MULTIPOINT EMPTY") + + return shapely.multipoints(subs) + + @property + def __geo_interface__(self): + return { + "type": "MultiPoint", + "coordinates": tuple(g.coords[0] for g in self.geoms), + } + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns a group of SVG circle elements for the MultiPoint geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG circle diameters. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + return ( + "" + + "".join(p.svg(scale_factor, fill_color, opacity) for p in self.geoms) + + "" + ) + + +shapely.lib.registry[4] = MultiPoint diff --git a/billinglayer/python/shapely/geometry/multipolygon.py b/billinglayer/python/shapely/geometry/multipolygon.py new file mode 100644 index 0000000..394ac7f --- /dev/null +++ b/billinglayer/python/shapely/geometry/multipolygon.py @@ -0,0 +1,123 @@ +"""Collections of polygons and related utilities +""" + +import shapely +from shapely.geometry import polygon +from shapely.geometry.base import BaseMultipartGeometry + +__all__ = ["MultiPolygon"] + + +class MultiPolygon(BaseMultipartGeometry): + """ + A collection of one or more Polygons. + + If component polygons overlap the collection is invalid and some + operations on it may fail. + + Parameters + ---------- + polygons : sequence + A sequence of Polygons, or a sequence of (shell, holes) tuples + where shell is the sequence representation of a linear ring + (see LinearRing) and holes is a sequence of such linear rings. + + Attributes + ---------- + geoms : sequence + A sequence of `Polygon` instances + + Examples + -------- + Construct a MultiPolygon from a sequence of coordinate tuples + + >>> from shapely import Polygon + >>> ob = MultiPolygon([ + ... ( + ... ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + ... [((0.1,0.1), (0.1,0.2), (0.2,0.2), (0.2,0.1))] + ... ) + ... ]) + >>> len(ob.geoms) + 1 + >>> type(ob.geoms[0]) == Polygon + True + """ + + __slots__ = [] + + def __new__(self, polygons=None): + if not polygons: + # allow creation of empty multipolygons, to support unpickling + # TODO better empty constructor + return shapely.from_wkt("MULTIPOLYGON EMPTY") + elif isinstance(polygons, MultiPolygon): + return polygons + + polygons = getattr(polygons, "geoms", polygons) + polygons = [ + p + for p in polygons + if p and not (isinstance(p, polygon.Polygon) and p.is_empty) + ] + + L = len(polygons) + + # Bail immediately if we have no input points. + if L == 0: + return shapely.from_wkt("MULTIPOLYGON EMPTY") + + # This function does not accept sequences of MultiPolygons: there is + # no implicit flattening. + if isinstance(polygons[0], MultiPolygon): + raise ValueError("Sequences of multi-polygons are not valid arguments") + + subs = [] + for i in range(L): + ob = polygons[i] + if not isinstance(ob, polygon.Polygon): + shell = ob[0] + holes = ob[1] + p = polygon.Polygon(shell, holes) + else: + p = polygon.Polygon(ob) + subs.append(p) + + return shapely.multipolygons(subs) + + @property + def __geo_interface__(self): + allcoords = [] + for geom in self.geoms: + coords = [] + coords.append(tuple(geom.exterior.coords)) + for hole in geom.interiors: + coords.append(tuple(hole.coords)) + allcoords.append(tuple(coords)) + return {"type": "MultiPolygon", "coordinates": allcoords} + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns group of SVG path elements for the MultiPolygon geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + return ( + "" + + "".join(p.svg(scale_factor, fill_color, opacity) for p in self.geoms) + + "" + ) + + +shapely.lib.registry[6] = MultiPolygon diff --git a/billinglayer/python/shapely/geometry/point.py b/billinglayer/python/shapely/geometry/point.py new file mode 100644 index 0000000..982c639 --- /dev/null +++ b/billinglayer/python/shapely/geometry/point.py @@ -0,0 +1,145 @@ +"""Points and related utilities +""" +import numpy as np + +import shapely +from shapely.errors import DimensionError +from shapely.geometry.base import BaseGeometry + +__all__ = ["Point"] + + +class Point(BaseGeometry): + """ + A geometry type that represents a single coordinate with + x,y and possibly z values. + + A point is a zero-dimensional feature and has zero length and zero area. + + Parameters + ---------- + args : float, or sequence of floats + The coordinates can either be passed as a single parameter, or as + individual float values using multiple parameters: + + 1) 1 parameter: a sequence or array-like of with 2 or 3 values. + 2) 2 or 3 parameters (float): x, y, and possibly z. + + Attributes + ---------- + x, y, z : float + Coordinate values + + Examples + -------- + Constructing the Point using separate parameters for x and y: + + >>> p = Point(1.0, -1.0) + + Constructing the Point using a list of x, y coordinates: + + >>> p = Point([1.0, -1.0]) + >>> print(p) + POINT (1 -1) + >>> p.y + -1.0 + >>> p.x + 1.0 + """ + + __slots__ = [] + + def __new__(self, *args): + if len(args) == 0: + # empty geometry + # TODO better constructor + return shapely.from_wkt("POINT EMPTY") + elif len(args) > 3: + raise TypeError(f"Point() takes at most 3 arguments ({len(args)} given)") + elif len(args) == 1: + coords = args[0] + if isinstance(coords, Point): + return coords + + # Accept either (x, y) or [(x, y)] + if not hasattr(coords, "__getitem__"): # generators + coords = list(coords) + coords = np.asarray(coords).squeeze() + else: + # 2 or 3 args + coords = np.array(args).squeeze() + + if coords.ndim > 1: + raise ValueError( + f"Point() takes only scalar or 1-size vector arguments, got {args}" + ) + if not np.issubdtype(coords.dtype, np.number): + coords = [float(c) for c in coords] + geom = shapely.points(coords) + if not isinstance(geom, Point): + raise ValueError("Invalid values passed to Point constructor") + return geom + + # Coordinate getters and setters + + @property + def x(self): + """Return x coordinate.""" + return shapely.get_x(self) + + @property + def y(self): + """Return y coordinate.""" + return shapely.get_y(self) + + @property + def z(self): + """Return z coordinate.""" + if not shapely.has_z(self): + raise DimensionError("This point has no z coordinate.") + # return shapely.get_z(self) -> get_z only supported for GEOS 3.7+ + return self.coords[0][2] + + @property + def __geo_interface__(self): + return {"type": "Point", "coordinates": self.coords[0]} + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns SVG circle element for the Point geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG circle diameter. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + if opacity is None: + opacity = 0.6 + return ( + '' + ).format(self, 3.0 * scale_factor, 1.0 * scale_factor, fill_color, opacity) + + @property + def xy(self): + """Separate arrays of X and Y coordinate values + + Example: + >>> x, y = Point(0, 0).xy + >>> list(x) + [0.0] + >>> list(y) + [0.0] + """ + return self.coords.xy + + +shapely.lib.registry[0] = Point diff --git a/billinglayer/python/shapely/geometry/polygon.py b/billinglayer/python/shapely/geometry/polygon.py new file mode 100644 index 0000000..9e0abce --- /dev/null +++ b/billinglayer/python/shapely/geometry/polygon.py @@ -0,0 +1,326 @@ +"""Polygons and their linear ring components +""" + +import numpy as np + +import shapely +from shapely.algorithms.cga import is_ccw_impl, signed_area +from shapely.errors import TopologicalError +from shapely.geometry.base import BaseGeometry +from shapely.geometry.linestring import LineString +from shapely.geometry.point import Point + +__all__ = ["Polygon", "LinearRing"] + + +def _unpickle_linearring(wkb): + linestring = shapely.from_wkb(wkb) + srid = shapely.get_srid(linestring) + linearring = shapely.linearrings(shapely.get_coordinates(linestring)) + if srid: + linearring = shapely.set_srid(linearring, srid) + return linearring + + +class LinearRing(LineString): + """ + A geometry type composed of one or more line segments + that forms a closed loop. + + A LinearRing is a closed, one-dimensional feature. + A LinearRing that crosses itself or touches itself at a single point is + invalid and operations on it may fail. + + Parameters + ---------- + coordinates : sequence + A sequence of (x, y [,z]) numeric coordinate pairs or triples, or + an array-like with shape (N, 2) or (N, 3). + Also can be a sequence of Point objects. + + Notes + ----- + Rings are automatically closed. There is no need to specify a final + coordinate pair identical to the first. + + Examples + -------- + Construct a square ring. + + >>> ring = LinearRing( ((0, 0), (0, 1), (1 ,1 ), (1 , 0)) ) + >>> ring.is_closed + True + >>> list(ring.coords) + [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)] + >>> ring.length + 4.0 + + """ + + __slots__ = [] + + def __new__(self, coordinates=None): + if coordinates is None: + # empty geometry + # TODO better way? + return shapely.from_wkt("LINEARRING EMPTY") + elif isinstance(coordinates, LineString): + if type(coordinates) == LinearRing: + # return original objects since geometries are immutable + return coordinates + elif not coordinates.is_valid: + raise TopologicalError("An input LineString must be valid.") + else: + # LineString + # TODO convert LineString to LinearRing more directly? + coordinates = coordinates.coords + + else: + if hasattr(coordinates, "__array__"): + coordinates = np.asarray(coordinates) + if isinstance(coordinates, np.ndarray) and np.issubdtype( + coordinates.dtype, np.number + ): + pass + else: + # check coordinates on points + def _coords(o): + if isinstance(o, Point): + return o.coords[0] + else: + return [float(c) for c in o] + + coordinates = np.array([_coords(o) for o in coordinates]) + if not np.issubdtype(coordinates.dtype, np.number): + # conversion of coords to 2D array failed, this might be due + # to inconsistent coordinate dimensionality + raise ValueError("Inconsistent coordinate dimensionality") + + if len(coordinates) == 0: + # empty geometry + # TODO better constructor + should shapely.linearrings handle this? + return shapely.from_wkt("LINEARRING EMPTY") + + geom = shapely.linearrings(coordinates) + if not isinstance(geom, LinearRing): + raise ValueError("Invalid values passed to LinearRing constructor") + return geom + + @property + def __geo_interface__(self): + return {"type": "LinearRing", "coordinates": tuple(self.coords)} + + def __reduce__(self): + """WKB doesn't differentiate between LineString and LinearRing so we + need to move the coordinate sequence into the correct geometry type""" + return (_unpickle_linearring, (shapely.to_wkb(self, include_srid=True),)) + + @property + def is_ccw(self): + """True is the ring is oriented counter clock-wise""" + return bool(is_ccw_impl()(self)) + + @property + def is_simple(self): + """True if the geometry is simple, meaning that any self-intersections + are only at boundary points, else False""" + return bool(shapely.is_simple(self)) + + +shapely.lib.registry[2] = LinearRing + + +class InteriorRingSequence: + + _parent = None + _ndim = None + _index = 0 + _length = 0 + + def __init__(self, parent): + self._parent = parent + self._ndim = parent._ndim + + def __iter__(self): + self._index = 0 + self._length = self.__len__() + return self + + def __next__(self): + if self._index < self._length: + ring = self._get_ring(self._index) + self._index += 1 + return ring + else: + raise StopIteration + + def __len__(self): + return shapely.get_num_interior_rings(self._parent) + + def __getitem__(self, key): + m = self.__len__() + if isinstance(key, int): + if key + m < 0 or key >= m: + raise IndexError("index out of range") + if key < 0: + i = m + key + else: + i = key + return self._get_ring(i) + elif isinstance(key, slice): + res = [] + start, stop, stride = key.indices(m) + for i in range(start, stop, stride): + res.append(self._get_ring(i)) + return res + else: + raise TypeError("key must be an index or slice") + + def _get_ring(self, i): + return shapely.get_interior_ring(self._parent, i) + + +class Polygon(BaseGeometry): + """ + A geometry type representing an area that is enclosed by a linear ring. + + A polygon is a two-dimensional feature and has a non-zero area. It may + have one or more negative-space "holes" which are also bounded by linear + rings. If any rings cross each other, the feature is invalid and + operations on it may fail. + + Parameters + ---------- + shell : sequence + A sequence of (x, y [,z]) numeric coordinate pairs or triples, or + an array-like with shape (N, 2) or (N, 3). + Also can be a sequence of Point objects. + holes : sequence + A sequence of objects which satisfy the same requirements as the + shell parameters above + + Attributes + ---------- + exterior : LinearRing + The ring which bounds the positive space of the polygon. + interiors : sequence + A sequence of rings which bound all existing holes. + + Examples + -------- + Create a square polygon with no holes + + >>> coords = ((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.)) + >>> polygon = Polygon(coords) + >>> polygon.area + 1.0 + """ + + __slots__ = [] + + def __new__(self, shell=None, holes=None): + if shell is None: + # empty geometry + # TODO better way? + return shapely.from_wkt("POLYGON EMPTY") + elif isinstance(shell, Polygon): + # return original objects since geometries are immutable + return shell + else: + shell = LinearRing(shell) + + if holes is not None: + if len(holes) == 0: + # shapely constructor cannot handle holes=[] + holes = None + else: + holes = [LinearRing(ring) for ring in holes] + + geom = shapely.polygons(shell, holes=holes) + if not isinstance(geom, Polygon): + raise ValueError("Invalid values passed to Polygon constructor") + return geom + + @property + def exterior(self): + return shapely.get_exterior_ring(self) + + @property + def interiors(self): + if self.is_empty: + return [] + return InteriorRingSequence(self) + + @property + def coords(self): + raise NotImplementedError( + "Component rings have coordinate sequences, but the polygon does not" + ) + + @property + def __geo_interface__(self): + if self.exterior == LinearRing(): + coords = [] + else: + coords = [tuple(self.exterior.coords)] + for hole in self.interiors: + coords.append(tuple(hole.coords)) + return {"type": "Polygon", "coordinates": tuple(coords)} + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns SVG path element for the Polygon geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + if opacity is None: + opacity = 0.6 + exterior_coords = [["{},{}".format(*c) for c in self.exterior.coords]] + interior_coords = [ + ["{},{}".format(*c) for c in interior.coords] for interior in self.interiors + ] + path = " ".join( + [ + "M {} L {} z".format(coords[0], " L ".join(coords[1:])) + for coords in exterior_coords + interior_coords + ] + ) + return ( + '' + ).format(2.0 * scale_factor, path, fill_color, opacity) + + @classmethod + def from_bounds(cls, xmin, ymin, xmax, ymax): + """Construct a `Polygon()` from spatial bounds.""" + return cls([(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)]) + + +shapely.lib.registry[3] = Polygon + + +def orient(polygon, sign=1.0): + s = float(sign) + rings = [] + ring = polygon.exterior + if signed_area(ring) / s >= 0.0: + rings.append(ring) + else: + rings.append(list(ring.coords)[::-1]) + for ring in polygon.interiors: + if signed_area(ring) / s <= 0.0: + rings.append(ring) + else: + rings.append(list(ring.coords)[::-1]) + return Polygon(rings[0], rings[1:]) diff --git a/billinglayer/python/shapely/geos.py b/billinglayer/python/shapely/geos.py new file mode 100644 index 0000000..3648d0d --- /dev/null +++ b/billinglayer/python/shapely/geos.py @@ -0,0 +1,8 @@ +""" +Proxies for libgeos, GEOS-specific exceptions, and utilities +""" +import shapely + +geos_version_string = shapely.geos_capi_version_string +geos_version = shapely.geos_version +geos_capi_version = shapely.geos_capi_version diff --git a/billinglayer/python/shapely/io.py b/billinglayer/python/shapely/io.py new file mode 100644 index 0000000..705fe57 --- /dev/null +++ b/billinglayer/python/shapely/io.py @@ -0,0 +1,378 @@ +import numpy as np + +from . import lib +from ._enum import ParamEnum + +# include ragged array functions here for reference documentation purpose +from ._ragged_array import from_ragged_array, to_ragged_array +from .decorators import requires_geos +from .errors import UnsupportedGEOSVersionError + +__all__ = [ + "from_geojson", + "from_ragged_array", + "from_wkb", + "from_wkt", + "to_geojson", + "to_ragged_array", + "to_wkb", + "to_wkt", +] + + +# Allowed options for handling WKB/WKT decoding errors +# Note: cannot use standard constructor since "raise" is a keyword +DecodingErrorOptions = ParamEnum( + "DecodingErrorOptions", {"ignore": 0, "warn": 1, "raise": 2} +) + +WKBFlavorOptions = ParamEnum("WKBFlavorOptions", {"extended": 1, "iso": 2}) + + +def to_wkt( + geometry, + rounding_precision=6, + trim=True, + output_dimension=3, + old_3d=False, + **kwargs, +): + """ + Converts to the Well-Known Text (WKT) representation of a Geometry. + + The Well-known Text format is defined in the `OGC Simple Features + Specification for SQL `__. + + The following limitations apply to WKT serialization: + + - for GEOS <= 3.8 a multipoint with an empty sub-geometry will raise an exception + - for GEOS <= 3.8 empty geometries are always serialized to 2D + - for GEOS >= 3.9 only simple empty geometries can be 3D, collections are still + always 2D + + Parameters + ---------- + geometry : Geometry or array_like + rounding_precision : int, default 6 + The rounding precision when writing the WKT string. Set to a value of + -1 to indicate the full precision. + trim : bool, default True + If True, trim unnecessary decimals (trailing zeros). + output_dimension : int, default 3 + The output dimension for the WKT string. Supported values are 2 and 3. + Specifying 3 means that up to 3 dimensions will be written but 2D + geometries will still be represented as 2D in the WKT string. + old_3d : bool, default False + Enable old style 3D/4D WKT generation. By default, new style 3D/4D WKT + (ie. "POINT Z (10 20 30)") is returned, but with ``old_3d=True`` + the WKT will be formatted in the style "POINT (10 20 30)". + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> to_wkt(Point(0, 0)) + 'POINT (0 0)' + >>> to_wkt(Point(0, 0), rounding_precision=3, trim=False) + 'POINT (0.000 0.000)' + >>> to_wkt(Point(0, 0), rounding_precision=-1, trim=False) + 'POINT (0.0000000000000000 0.0000000000000000)' + >>> to_wkt(Point(1, 2, 3), trim=True) + 'POINT Z (1 2 3)' + >>> to_wkt(Point(1, 2, 3), trim=True, output_dimension=2) + 'POINT (1 2)' + >>> to_wkt(Point(1, 2, 3), trim=True, old_3d=True) + 'POINT (1 2 3)' + + Notes + ----- + The defaults differ from the default of the GEOS library. To mimic this, + use:: + + to_wkt(geometry, rounding_precision=-1, trim=False, output_dimension=2) + + """ + if not np.isscalar(rounding_precision): + raise TypeError("rounding_precision only accepts scalar values") + if not np.isscalar(trim): + raise TypeError("trim only accepts scalar values") + if not np.isscalar(output_dimension): + raise TypeError("output_dimension only accepts scalar values") + if not np.isscalar(old_3d): + raise TypeError("old_3d only accepts scalar values") + + return lib.to_wkt( + geometry, + np.intc(rounding_precision), + np.bool_(trim), + np.intc(output_dimension), + np.bool_(old_3d), + **kwargs, + ) + + +def to_wkb( + geometry, + hex=False, + output_dimension=3, + byte_order=-1, + include_srid=False, + flavor="extended", + **kwargs, +): + r""" + Converts to the Well-Known Binary (WKB) representation of a Geometry. + + The Well-Known Binary format is defined in the `OGC Simple Features + Specification for SQL `__. + + The following limitations apply to WKB serialization: + + - linearrings will be converted to linestrings + - a point with only NaN coordinates is converted to an empty point + - for GEOS <= 3.7, empty points are always serialized to 3D if + output_dimension=3, and to 2D if output_dimension=2 + - for GEOS == 3.8, empty points are always serialized to 2D + + Parameters + ---------- + geometry : Geometry or array_like + hex : bool, default False + If true, export the WKB as a hexidecimal string. The default is to + return a binary bytes object. + output_dimension : int, default 3 + The output dimension for the WKB. Supported values are 2 and 3. + Specifying 3 means that up to 3 dimensions will be written but 2D + geometries will still be represented as 2D in the WKB represenation. + byte_order : int, default -1 + Defaults to native machine byte order (-1). Use 0 to force big endian + and 1 for little endian. + include_srid : bool, default False + If True, the SRID is be included in WKB (this is an extension + to the OGC WKB specification). Not allowed when flavor is "iso". + flavor : {"iso", "extended"}, default "extended" + Which flavor of WKB will be returned. The flavor determines how + extra dimensionality is encoded with the type number, and whether + SRID can be included in the WKB. ISO flavor is "more standard" for + 3D output, and does not support SRID embedding. + Both flavors are equivalent when ``output_dimension=2`` (or with 2D + geometries) and ``include_srid=False``. + The `from_wkb` function can read both flavors. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> point = Point(1, 1) + >>> to_wkb(point, byte_order=1) + b'\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?' + >>> to_wkb(point, hex=True, byte_order=1) + '0101000000000000000000F03F000000000000F03F' + """ + if not np.isscalar(hex): + raise TypeError("hex only accepts scalar values") + if not np.isscalar(output_dimension): + raise TypeError("output_dimension only accepts scalar values") + if not np.isscalar(byte_order): + raise TypeError("byte_order only accepts scalar values") + if not np.isscalar(include_srid): + raise TypeError("include_srid only accepts scalar values") + if not np.isscalar(flavor): + raise TypeError("flavor only accepts scalar values") + if lib.geos_version < (3, 10, 0) and flavor == "iso": + raise UnsupportedGEOSVersionError( + 'The "iso" option requires at least GEOS 3.10.0' + ) + if flavor == "iso" and include_srid: + raise ValueError('flavor="iso" and include_srid=True cannot be used together') + flavor = WKBFlavorOptions.get_value(flavor) + + return lib.to_wkb( + geometry, + np.bool_(hex), + np.intc(output_dimension), + np.intc(byte_order), + np.bool_(include_srid), + np.intc(flavor), + **kwargs, + ) + + +@requires_geos("3.10.0") +def to_geojson(geometry, indent=None, **kwargs): + """Converts to the GeoJSON representation of a Geometry. + + The GeoJSON format is defined in the `RFC 7946 `__. + NaN (not-a-number) coordinates will be written as 'null'. + + The following are currently unsupported: + + - Geometries of type LINEARRING: these are output as 'null'. + - Three-dimensional geometries: the third dimension is ignored. + + Parameters + ---------- + geometry : str, bytes or array_like + indent : int, optional + If indent is a non-negative integer, then GeoJSON will be formatted. + An indent level of 0 will only insert newlines. None (the default) + selects the most compact representation. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> point = Point(1, 1) + >>> to_geojson(point) + '{"type":"Point","coordinates":[1.0,1.0]}' + >>> print(to_geojson(point, indent=2)) + { + "type": "Point", + "coordinates": [ + 1.0, + 1.0 + ] + } + """ + # GEOS Tickets: + # - handle linearrings: https://trac.osgeo.org/geos/ticket/1140 + # - support 3D: https://trac.osgeo.org/geos/ticket/1141 + if indent is None: + indent = -1 + elif not np.isscalar(indent): + raise TypeError("indent only accepts scalar values") + elif indent < 0: + raise ValueError("indent cannot be negative") + + return lib.to_geojson(geometry, np.intc(indent), **kwargs) + + +def from_wkt(geometry, on_invalid="raise", **kwargs): + """ + Creates geometries from the Well-Known Text (WKT) representation. + + The Well-known Text format is defined in the `OGC Simple Features + Specification for SQL `__. + + Parameters + ---------- + geometry : str or array_like + The WKT string(s) to convert. + on_invalid : {"raise", "warn", "ignore"}, default "raise" + - raise: an exception will be raised if WKT input geometries are invalid. + - warn: a warning will be raised and invalid WKT geometries will be + returned as ``None``. + - ignore: invalid WKT geometries will be returned as ``None`` without a warning. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from_wkt('POINT (0 0)') + + """ + if not np.isscalar(on_invalid): + raise TypeError("on_invalid only accepts scalar values") + + invalid_handler = np.uint8(DecodingErrorOptions.get_value(on_invalid)) + + return lib.from_wkt(geometry, invalid_handler, **kwargs) + + +def from_wkb(geometry, on_invalid="raise", **kwargs): + r""" + Creates geometries from the Well-Known Binary (WKB) representation. + + The Well-Known Binary format is defined in the `OGC Simple Features + Specification for SQL `__. + + + Parameters + ---------- + geometry : str or array_like + The WKB byte object(s) to convert. + on_invalid : {"raise", "warn", "ignore"}, default "raise" + - raise: an exception will be raised if a WKB input geometry is invalid. + - warn: a warning will be raised and invalid WKB geometries will be + returned as ``None``. + - ignore: invalid WKB geometries will be returned as ``None`` without a warning. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from_wkb(b'\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?') + + """ + + if not np.isscalar(on_invalid): + raise TypeError("on_invalid only accepts scalar values") + + invalid_handler = np.uint8(DecodingErrorOptions.get_value(on_invalid)) + + # ensure the input has object dtype, to avoid numpy inferring it as a + # fixed-length string dtype (which removes trailing null bytes upon access + # of array elements) + geometry = np.asarray(geometry, dtype=object) + return lib.from_wkb(geometry, invalid_handler, **kwargs) + + +@requires_geos("3.10.1") +def from_geojson(geometry, on_invalid="raise", **kwargs): + """Creates geometries from GeoJSON representations (strings). + + If a GeoJSON is a FeatureCollection, it is read as a single geometry + (with type GEOMETRYCOLLECTION). This may be unpacked using the ``pygeos.get_parts``. + Properties are not read. + + The GeoJSON format is defined in `RFC 7946 `__. + + The following are currently unsupported: + + - Three-dimensional geometries: the third dimension is ignored. + - Geometries having 'null' in the coordinates. + + Parameters + ---------- + geometry : str, bytes or array_like + The GeoJSON string or byte object(s) to convert. + on_invalid : {"raise", "warn", "ignore"}, default "raise" + - raise: an exception will be raised if an input GeoJSON is invalid. + - warn: a warning will be raised and invalid input geometries will be + returned as ``None``. + - ignore: invalid input geometries will be returned as ``None`` without a warning. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_parts + + Examples + -------- + >>> from_geojson('{"type": "Point","coordinates": [1, 2]}') + + """ + # GEOS Tickets: + # - support 3D: https://trac.osgeo.org/geos/ticket/1141 + # - handle null coordinates: https://trac.osgeo.org/geos/ticket/1142 + if not np.isscalar(on_invalid): + raise TypeError("on_invalid only accepts scalar values") + + invalid_handler = np.uint8(DecodingErrorOptions.get_value(on_invalid)) + + # ensure the input has object dtype, to avoid numpy inferring it as a + # fixed-length string dtype (which removes trailing null bytes upon access + # of array elements) + geometry = np.asarray(geometry, dtype=object) + + return lib.from_geojson(geometry, invalid_handler, **kwargs) diff --git a/billinglayer/python/shapely/lib.cpython-311-x86_64-linux-gnu.so b/billinglayer/python/shapely/lib.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..009a7e0 Binary files /dev/null and b/billinglayer/python/shapely/lib.cpython-311-x86_64-linux-gnu.so differ diff --git a/billinglayer/python/shapely/linear.py b/billinglayer/python/shapely/linear.py new file mode 100644 index 0000000..6512dd5 --- /dev/null +++ b/billinglayer/python/shapely/linear.py @@ -0,0 +1,208 @@ +from . import lib +from .decorators import multithreading_enabled +from .errors import UnsupportedGEOSVersionError + +__all__ = [ + "line_interpolate_point", + "line_locate_point", + "line_merge", + "shared_paths", + "shortest_line", +] + + +@multithreading_enabled +def line_interpolate_point(line, distance, normalized=False, **kwargs): + """Returns a point interpolated at given distance on a line. + + Parameters + ---------- + line : Geometry or array_like + For multilinestrings or geometrycollections, the first geometry is taken + and the rest is ignored. This function raises a TypeError for non-linear + geometries. For empty linear geometries, empty points are returned. + distance : float or array_like + Negative values measure distance from the end of the line. Out-of-range + values will be clipped to the line endings. + normalized : bool, default False + If True, the distance is a fraction of the total + line length instead of the absolute distance. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 2), (0, 10)]) + >>> line_interpolate_point(line, 2) + + >>> line_interpolate_point(line, 100) + + >>> line_interpolate_point(line, -2) + + >>> line_interpolate_point(line, [0.25, -0.25], normalized=True).tolist() + [, ] + >>> line_interpolate_point(LineString(), 1) + + """ + if normalized: + return lib.line_interpolate_point_normalized(line, distance) + else: + return lib.line_interpolate_point(line, distance) + + +@multithreading_enabled +def line_locate_point(line, other, normalized=False, **kwargs): + """Returns the distance to the line origin of given point. + + If given point does not intersect with the line, the point will first be + projected onto the line after which the distance is taken. + + Parameters + ---------- + line : Geometry or array_like + point : Geometry or array_like + normalized : bool, default False + If True, the distance is a fraction of the total + line length instead of the absolute distance. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 2), (0, 10)]) + >>> point = Point(4, 4) + >>> line_locate_point(line, point) + 2.0 + >>> line_locate_point(line, point, normalized=True) + 0.25 + >>> line_locate_point(line, Point(0, 18)) + 8.0 + >>> line_locate_point(LineString(), point) + nan + """ + if normalized: + return lib.line_locate_point_normalized(line, other) + else: + return lib.line_locate_point(line, other) + + +@multithreading_enabled +def line_merge(line, directed=False, **kwargs): + """Returns (Multi)LineStrings formed by combining the lines in a + MultiLineString. + + Lines are joined together at their endpoints in case two lines are + intersecting. Lines are not joined when 3 or more lines are intersecting at + the endpoints. Line elements that cannot be joined are kept as is in the + resulting MultiLineString. + + The direction of each merged LineString will be that of the majority of the + LineStrings from which it was derived. Except if ``directed=True`` is + specified, then the operation will not change the order of points within + lines and so only lines which can be joined with no change in direction + are merged. + + Parameters + ---------- + line : Geometry or array_like + directed : bool, default False + Only combine lines if possible without changing point order. + Requires GEOS >= 3.11.0 + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiLineString + >>> line_merge(MultiLineString([[(0, 2), (0, 10)], [(0, 10), (5, 10)]])) + + >>> line_merge(MultiLineString([[(0, 2), (0, 10)], [(0, 11), (5, 10)]])) + + >>> line_merge(MultiLineString()) + + >>> line_merge(MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]])) + + >>> line_merge(MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]]), directed=True) + + """ + if directed: + if lib.geos_version < (3, 11, 0): + raise UnsupportedGEOSVersionError( + "'{}' requires at least GEOS {}.{}.{}.".format( + "line_merge", *(3, 11, 0) + ) + ) + return lib.line_merge_directed(line, **kwargs) + return lib.line_merge(line, **kwargs) + + +@multithreading_enabled +def shared_paths(a, b, **kwargs): + """Returns the shared paths between geom1 and geom2. + + Both geometries should be linestrings or arrays of linestrings. + A geometrycollection or array of geometrycollections is returned + with two elements in each geometrycollection. The first element is a + multilinestring containing shared paths with the same direction + for both inputs. The second element is a multilinestring containing + shared paths with the opposite direction for the two inputs. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> line2 = LineString([(1, 0), (2, 0), (2, 1), (1, 1), (1, 0)]) + >>> shared_paths(line1, line2).wkt + 'GEOMETRYCOLLECTION (MULTILINESTRING EMPTY, MULTILINESTRING ((1 0, 1 1)))' + >>> line3 = LineString([(1, 1), (0, 1)]) + >>> shared_paths(line1, line3).wkt + 'GEOMETRYCOLLECTION (MULTILINESTRING ((1 1, 0 1)), MULTILINESTRING EMPTY)' + """ + return lib.shared_paths(a, b, **kwargs) + + +@multithreading_enabled +def shortest_line(a, b, **kwargs): + """ + Returns the shortest line between two geometries. + + The resulting line consists of two points, representing the nearest + points between the geometry pair. The line always starts in the first + geometry `a` and ends in he second geometry `b`. The endpoints of the + line will not necessarily be existing vertices of the input geometries + `a` and `b`, but can also be a point along a line segment. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) (for GEOS>=3.9) + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> line2 = LineString([(0, 3), (3, 0), (5, 3)]) + >>> shortest_line(line1, line2) + + """ + return lib.shortest_line(a, b, **kwargs) diff --git a/billinglayer/python/shapely/measurement.py b/billinglayer/python/shapely/measurement.py new file mode 100644 index 0000000..ccecd3e --- /dev/null +++ b/billinglayer/python/shapely/measurement.py @@ -0,0 +1,335 @@ +import warnings + +import numpy as np + +from . import lib +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "area", + "distance", + "bounds", + "total_bounds", + "length", + "hausdorff_distance", + "frechet_distance", + "minimum_clearance", + "minimum_bounding_radius", +] + + +@multithreading_enabled +def area(geometry, **kwargs): + """Computes the area of a (multi)polygon. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiPolygon, Polygon + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> area(polygon) + 100.0 + >>> area(MultiPolygon([polygon, Polygon([(10, 10), (10, 20), (20, 20), (20, 10), (10, 10)])])) + 200.0 + >>> area(Polygon()) + 0.0 + >>> area(None) + nan + """ + return lib.area(geometry, **kwargs) + + +@multithreading_enabled +def distance(a, b, **kwargs): + """Computes the Cartesian distance between two geometries. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> point = Point(0, 0) + >>> distance(Point(10, 0), point) + 10.0 + >>> distance(LineString([(1, 1), (1, -1)]), point) + 1.0 + >>> distance(Polygon([(3, 0), (5, 0), (5, 5), (3, 5), (3, 0)]), point) + 3.0 + >>> distance(Point(), point) + nan + >>> distance(None, point) + nan + """ + return lib.distance(a, b, **kwargs) + + +@multithreading_enabled +def bounds(geometry, **kwargs): + """Computes the bounds (extent) of a geometry. + + For each geometry these 4 numbers are returned: min x, min y, max x, max y. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> bounds(Point(2, 3)).tolist() + [2.0, 3.0, 2.0, 3.0] + >>> bounds(LineString([(0, 0), (0, 2), (3, 2)])).tolist() + [0.0, 0.0, 3.0, 2.0] + >>> bounds(Polygon()).tolist() + [nan, nan, nan, nan] + >>> bounds(None).tolist() + [nan, nan, nan, nan] + """ + # We need to provide the `out` argument here for compatibility with + # numpy < 1.16. See https://github.com/numpy/numpy/issues/14949 + geometry_arr = np.asarray(geometry, dtype=np.object_) + out = np.empty(geometry_arr.shape + (4,), dtype="float64") + return lib.bounds(geometry_arr, out=out, **kwargs) + + +def total_bounds(geometry, **kwargs): + """Computes the total bounds (extent) of the geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Returns + ------- + numpy ndarray of [xmin, ymin, xmax, ymax] + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> total_bounds(Point(2, 3)).tolist() + [2.0, 3.0, 2.0, 3.0] + >>> total_bounds([Point(2, 3), Point(4, 5)]).tolist() + [2.0, 3.0, 4.0, 5.0] + >>> total_bounds([ + ... LineString([(0, 1), (0, 2), (3, 2)]), + ... LineString([(4, 4), (4, 6), (6, 7)]) + ... ]).tolist() + [0.0, 1.0, 6.0, 7.0] + >>> total_bounds(Polygon()).tolist() + [nan, nan, nan, nan] + >>> total_bounds([Polygon(), Point(2, 3)]).tolist() + [2.0, 3.0, 2.0, 3.0] + >>> total_bounds(None).tolist() + [nan, nan, nan, nan] + """ + b = bounds(geometry, **kwargs) + if b.ndim == 1: + return b + + with warnings.catch_warnings(): + # ignore 'All-NaN slice encountered' warnings + warnings.simplefilter("ignore", RuntimeWarning) + return np.array( + [ + np.nanmin(b[..., 0]), + np.nanmin(b[..., 1]), + np.nanmax(b[..., 2]), + np.nanmax(b[..., 3]), + ] + ) + + +@multithreading_enabled +def length(geometry, **kwargs): + """Computes the length of a (multi)linestring or polygon perimeter. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiLineString, Polygon + >>> length(LineString([(0, 0), (0, 2), (3, 2)])) + 5.0 + >>> length(MultiLineString([ + ... LineString([(0, 0), (1, 0)]), + ... LineString([(1, 0), (2, 0)]) + ... ])) + 2.0 + >>> length(Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])) + 40.0 + >>> length(LineString()) + 0.0 + >>> length(None) + nan + """ + return lib.length(geometry, **kwargs) + + +@multithreading_enabled +def hausdorff_distance(a, b, densify=None, **kwargs): + """Compute the discrete Hausdorff distance between two geometries. + + The Hausdorff distance is a measure of similarity: it is the greatest + distance between any point in A and the closest point in B. The discrete + distance is an approximation of this metric: only vertices are considered. + The parameter 'densify' makes this approximation less coarse by splitting + the line segments between vertices before computing the distance. + + Parameters + ---------- + a, b : Geometry or array_like + densify : float or array_like, optional + The value of densify is required to be between 0 and 1. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(130, 0), (0, 0), (0, 150)]) + >>> line2 = LineString([(10, 10), (10, 150), (130, 10)]) + >>> hausdorff_distance(line1, line2) # doctest: +ELLIPSIS + 14.14... + >>> hausdorff_distance(line1, line2, densify=0.5) + 70.0 + >>> hausdorff_distance(line1, LineString()) + nan + >>> hausdorff_distance(line1, None) + nan + """ + if densify is None: + return lib.hausdorff_distance(a, b, **kwargs) + else: + return lib.hausdorff_distance_densify(a, b, densify, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def frechet_distance(a, b, densify=None, **kwargs): + """Compute the discrete Fréchet distance between two geometries. + + The Fréchet distance is a measure of similarity: it is the greatest + distance between any point in A and the closest point in B. The discrete + distance is an approximation of this metric: only vertices are considered. + The parameter 'densify' makes this approximation less coarse by splitting + the line segments between vertices before computing the distance. + + Fréchet distance sweep continuously along their respective curves + and the direction of curves is significant. This makes it a better measure + of similarity than Hausdorff distance for curve or surface matching. + + Parameters + ---------- + a, b : Geometry or array_like + densify : float or array_like, optional + The value of densify is required to be between 0 and 1. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (100, 0)]) + >>> line2 = LineString([(0, 0), (50, 50), (100, 0)]) + >>> frechet_distance(line1, line2) # doctest: +ELLIPSIS + 70.71... + >>> frechet_distance(line1, line2, densify=0.5) + 50.0 + >>> frechet_distance(line1, LineString()) + nan + >>> frechet_distance(line1, None) + nan + """ + if densify is None: + return lib.frechet_distance(a, b, **kwargs) + return lib.frechet_distance_densify(a, b, densify, **kwargs) + + +@requires_geos("3.6.0") +@multithreading_enabled +def minimum_clearance(geometry, **kwargs): + """Computes the Minimum Clearance distance. + + A geometry's "minimum clearance" is the smallest distance by which + a vertex of the geometry could be moved to produce an invalid geometry. + + If no minimum clearance exists for a geometry (for example, a single + point, or an empty geometry), infinity is returned. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Polygon + >>> polygon = Polygon([(0, 0), (0, 10), (5, 6), (10, 10), (10, 0), (5, 4), (0, 0)]) + >>> minimum_clearance(polygon) + 2.0 + >>> minimum_clearance(Polygon()) + inf + >>> minimum_clearance(None) + nan + """ + return lib.minimum_clearance(geometry, **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def minimum_bounding_radius(geometry, **kwargs): + """Computes the radius of the minimum bounding circle that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + >>> minimum_bounding_radius(Polygon([(0, 5), (5, 10), (10, 5), (5, 0), (0, 5)])) + 5.0 + >>> minimum_bounding_radius(LineString([(1, 1), (1, 10)])) + 4.5 + >>> minimum_bounding_radius(MultiPoint([(2, 2), (4, 2)])) + 1.0 + >>> minimum_bounding_radius(Point(0, 1)) + 0.0 + >>> minimum_bounding_radius(GeometryCollection()) + 0.0 + + See also + -------- + minimum_bounding_circle + """ + return lib.minimum_bounding_radius(geometry, **kwargs) diff --git a/billinglayer/python/shapely/ops.py b/billinglayer/python/shapely/ops.py new file mode 100644 index 0000000..3d20ee0 --- /dev/null +++ b/billinglayer/python/shapely/ops.py @@ -0,0 +1,746 @@ +"""Support for various GEOS geometry operations +""" + +from warnings import warn + +import shapely +from shapely.algorithms.polylabel import polylabel # noqa +from shapely.errors import GeometryTypeError, ShapelyDeprecationWarning +from shapely.geometry import ( + GeometryCollection, + LineString, + MultiLineString, + MultiPoint, + Point, + Polygon, + shape, +) +from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry +from shapely.geometry.polygon import orient as orient_ +from shapely.prepared import prep + +__all__ = [ + "cascaded_union", + "linemerge", + "operator", + "polygonize", + "polygonize_full", + "transform", + "unary_union", + "triangulate", + "voronoi_diagram", + "split", + "nearest_points", + "validate", + "snap", + "shared_paths", + "clip_by_rect", + "orient", + "substring", +] + + +class CollectionOperator: + def shapeup(self, ob): + if isinstance(ob, BaseGeometry): + return ob + else: + try: + return shape(ob) + except (ValueError, AttributeError): + return LineString(ob) + + def polygonize(self, lines): + """Creates polygons from a source of lines + + The source may be a MultiLineString, a sequence of LineString objects, + or a sequence of objects than can be adapted to LineStrings. + """ + source = getattr(lines, "geoms", None) or lines + try: + source = iter(source) + except TypeError: + source = [source] + finally: + obs = [self.shapeup(line) for line in source] + collection = shapely.polygonize(obs) + return collection.geoms + + def polygonize_full(self, lines): + """Creates polygons from a source of lines, returning the polygons + and leftover geometries. + + The source may be a MultiLineString, a sequence of LineString objects, + or a sequence of objects than can be adapted to LineStrings. + + Returns a tuple of objects: (polygons, cut edges, dangles, invalid ring + lines). Each are a geometry collection. + + Dangles are edges which have one or both ends which are not incident on + another edge endpoint. Cut edges are connected at both ends but do not + form part of polygon. Invalid ring lines form rings which are invalid + (bowties, etc). + """ + source = getattr(lines, "geoms", None) or lines + try: + source = iter(source) + except TypeError: + source = [source] + finally: + obs = [self.shapeup(line) for line in source] + return shapely.polygonize_full(obs) + + def linemerge(self, lines, directed=False): + """Merges all connected lines from a source + + The source may be a MultiLineString, a sequence of LineString objects, + or a sequence of objects than can be adapted to LineStrings. Returns a + LineString or MultiLineString when lines are not contiguous. + """ + source = None + if getattr(lines, "geom_type", None) == "MultiLineString": + source = lines + elif hasattr(lines, "geoms"): + # other Multi geometries + source = MultiLineString([ls.coords for ls in lines.geoms]) + elif hasattr(lines, "__iter__"): + try: + source = MultiLineString([ls.coords for ls in lines]) + except AttributeError: + source = MultiLineString(lines) + if source is None: + raise ValueError(f"Cannot linemerge {lines}") + return shapely.line_merge(source, directed=directed) + + def cascaded_union(self, geoms): + """Returns the union of a sequence of geometries + + .. deprecated:: 1.8 + This function was superseded by :meth:`unary_union`. + """ + warn( + "The 'cascaded_union()' function is deprecated. " + "Use 'unary_union()' instead.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return shapely.union_all(geoms, axis=None) + + def unary_union(self, geoms): + """Returns the union of a sequence of geometries + + Usually used to convert a collection into the smallest set of polygons + that cover the same area. + """ + return shapely.union_all(geoms, axis=None) + + +operator = CollectionOperator() +polygonize = operator.polygonize +polygonize_full = operator.polygonize_full +linemerge = operator.linemerge +cascaded_union = operator.cascaded_union +unary_union = operator.unary_union + + +def triangulate(geom, tolerance=0.0, edges=False): + """Creates the Delaunay triangulation and returns a list of geometries + + The source may be any geometry type. All vertices of the geometry will be + used as the points of the triangulation. + + From the GEOS documentation: + tolerance is the snapping tolerance used to improve the robustness of + the triangulation computation. A tolerance of 0.0 specifies that no + snapping will take place. + + If edges is False, a list of Polygons (triangles) will be returned. + Otherwise the list of LineString edges is returned. + + """ + collection = shapely.delaunay_triangles(geom, tolerance=tolerance, only_edges=edges) + return [g for g in collection.geoms] + + +def voronoi_diagram(geom, envelope=None, tolerance=0.0, edges=False): + """ + Constructs a Voronoi Diagram [1] from the given geometry. + Returns a list of geometries. + + Parameters + ---------- + geom: geometry + the input geometry whose vertices will be used to calculate + the final diagram. + envelope: geometry, None + clipping envelope for the returned diagram, automatically + determined if None. The diagram will be clipped to the larger + of this envelope or an envelope surrounding the sites. + tolerance: float, 0.0 + sets the snapping tolerance used to improve the robustness + of the computation. A tolerance of 0.0 specifies that no + snapping will take place. + edges: bool, False + If False, return regions as polygons. Else, return only + edges e.g. LineStrings. + + GEOS documentation can be found at [2] + + Returns + ------- + GeometryCollection + geometries representing the Voronoi regions. + + Notes + ----- + The tolerance `argument` can be finicky and is known to cause the + algorithm to fail in several cases. If you're using `tolerance` + and getting a failure, try removing it. The test cases in + tests/test_voronoi_diagram.py show more details. + + + References + ---------- + [1] https://en.wikipedia.org/wiki/Voronoi_diagram + [2] https://geos.osgeo.org/doxygen/geos__c_8h_source.html (line 730) + """ + try: + result = shapely.voronoi_polygons( + geom, tolerance=tolerance, extend_to=envelope, only_edges=edges + ) + except shapely.GEOSException as err: + errstr = "Could not create Voronoi Diagram with the specified inputs " + errstr += f"({err!s})." + if tolerance: + errstr += " Try running again with default tolerance value." + raise ValueError(errstr) from err + + if result.geom_type != "GeometryCollection": + return GeometryCollection([result]) + return result + + +def validate(geom): + return shapely.is_valid_reason(geom) + + +def transform(func, geom): + """Applies `func` to all coordinates of `geom` and returns a new + geometry of the same type from the transformed coordinates. + + `func` maps x, y, and optionally z to output xp, yp, zp. The input + parameters may iterable types like lists or arrays or single values. + The output shall be of the same type. Scalars in, scalars out. + Lists in, lists out. + + For example, here is an identity function applicable to both types + of input. + + def id_func(x, y, z=None): + return tuple(filter(None, [x, y, z])) + + g2 = transform(id_func, g1) + + Using pyproj >= 2.1, this example will accurately project Shapely geometries: + + import pyproj + + wgs84 = pyproj.CRS('EPSG:4326') + utm = pyproj.CRS('EPSG:32618') + + project = pyproj.Transformer.from_crs(wgs84, utm, always_xy=True).transform + + g2 = transform(project, g1) + + Note that the always_xy kwarg is required here as Shapely geometries only support + X,Y coordinate ordering. + + Lambda expressions such as the one in + + g2 = transform(lambda x, y, z=None: (x+1.0, y+1.0), g1) + + also satisfy the requirements for `func`. + """ + if geom.is_empty: + return geom + if geom.geom_type in ("Point", "LineString", "LinearRing", "Polygon"): + + # First we try to apply func to x, y, z sequences. When func is + # optimized for sequences, this is the fastest, though zipping + # the results up to go back into the geometry constructors adds + # extra cost. + try: + if geom.geom_type in ("Point", "LineString", "LinearRing"): + return type(geom)(zip(*func(*zip(*geom.coords)))) + elif geom.geom_type == "Polygon": + shell = type(geom.exterior)(zip(*func(*zip(*geom.exterior.coords)))) + holes = list( + type(ring)(zip(*func(*zip(*ring.coords)))) + for ring in geom.interiors + ) + return type(geom)(shell, holes) + + # A func that assumes x, y, z are single values will likely raise a + # TypeError, in which case we'll try again. + except TypeError: + if geom.geom_type in ("Point", "LineString", "LinearRing"): + return type(geom)([func(*c) for c in geom.coords]) + elif geom.geom_type == "Polygon": + shell = type(geom.exterior)([func(*c) for c in geom.exterior.coords]) + holes = list( + type(ring)([func(*c) for c in ring.coords]) + for ring in geom.interiors + ) + return type(geom)(shell, holes) + + elif geom.geom_type.startswith("Multi") or geom.geom_type == "GeometryCollection": + return type(geom)([transform(func, part) for part in geom.geoms]) + else: + raise GeometryTypeError(f"Type {geom.geom_type!r} not recognized") + + +def nearest_points(g1, g2): + """Returns the calculated nearest points in the input geometries + + The points are returned in the same order as the input geometries. + """ + seq = shapely.shortest_line(g1, g2) + if seq is None: + if g1.is_empty: + raise ValueError("The first input geometry is empty") + else: + raise ValueError("The second input geometry is empty") + + p1 = shapely.get_point(seq, 0) + p2 = shapely.get_point(seq, 1) + return (p1, p2) + + +def snap(g1, g2, tolerance): + """Snap one geometry to another with a given tolerance + + Vertices of the first geometry are snapped to vertices of the second + geometry. The resulting snapped geometry is returned. The input geometries + are not modified. + + Parameters + ---------- + g1 : geometry + The first geometry + g2 : geometry + The second geometry + tolerance : float + The snapping tolerance + + Example + ------- + >>> square = Polygon([(1,1), (2, 1), (2, 2), (1, 2), (1, 1)]) + >>> line = LineString([(0,0), (0.8, 0.8), (1.8, 0.95), (2.6, 0.5)]) + >>> result = snap(line, square, 0.5) + >>> result.wkt + 'LINESTRING (0 0, 1 1, 2 1, 2.6 0.5)' + """ + return shapely.snap(g1, g2, tolerance) + + +def shared_paths(g1, g2): + """Find paths shared between the two given lineal geometries + + Returns a GeometryCollection with two elements: + - First element is a MultiLineString containing shared paths with the + same direction for both inputs. + - Second element is a MultiLineString containing shared paths with the + opposite direction for the two inputs. + + Parameters + ---------- + g1 : geometry + The first geometry + g2 : geometry + The second geometry + """ + if not isinstance(g1, LineString): + raise GeometryTypeError("First geometry must be a LineString") + if not isinstance(g2, LineString): + raise GeometryTypeError("Second geometry must be a LineString") + return shapely.shared_paths(g1, g2) + + +class SplitOp: + @staticmethod + def _split_polygon_with_line(poly, splitter): + """Split a Polygon with a LineString""" + if not isinstance(poly, Polygon): + raise GeometryTypeError("First argument must be a Polygon") + if not isinstance(splitter, LineString): + raise GeometryTypeError("Second argument must be a LineString") + + union = poly.boundary.union(splitter) + + # greatly improves split performance for big geometries with many + # holes (the following contains checks) with minimal overhead + # for common cases + poly = prep(poly) + + # some polygonized geometries may be holes, we do not want them + # that's why we test if the original polygon (poly) contains + # an inner point of polygonized geometry (pg) + return [ + pg for pg in polygonize(union) if poly.contains(pg.representative_point()) + ] + + @staticmethod + def _split_line_with_line(line, splitter): + """Split a LineString with another (Multi)LineString or (Multi)Polygon""" + + # if splitter is a polygon, pick it's boundary + if splitter.geom_type in ("Polygon", "MultiPolygon"): + splitter = splitter.boundary + + if not isinstance(line, LineString): + raise GeometryTypeError("First argument must be a LineString") + if not isinstance(splitter, LineString) and not isinstance( + splitter, MultiLineString + ): + raise GeometryTypeError( + "Second argument must be either a LineString or a MultiLineString" + ) + + # | s\l | Interior | Boundary | Exterior | + # |----------|----------|----------|----------| + # | Interior | 0 or F | * | * | At least one of these two must be 0 + # | Boundary | 0 or F | * | * | So either '0********' or '[0F]**0*****' + # | Exterior | * | * | * | No overlapping interiors ('1********') + relation = splitter.relate(line) + if relation[0] == "1": + # The lines overlap at some segment (linear intersection of interiors) + raise ValueError("Input geometry segment overlaps with the splitter.") + elif relation[0] == "0" or relation[3] == "0": + # The splitter crosses or touches the line's interior --> return multilinestring from the split + return line.difference(splitter) + else: + # The splitter does not cross or touch the line's interior --> return collection with identity line + return [line] + + @staticmethod + def _split_line_with_point(line, splitter): + """Split a LineString with a Point""" + if not isinstance(line, LineString): + raise GeometryTypeError("First argument must be a LineString") + if not isinstance(splitter, Point): + raise GeometryTypeError("Second argument must be a Point") + + # check if point is in the interior of the line + if not line.relate_pattern(splitter, "0********"): + # point not on line interior --> return collection with single identity line + # (REASONING: Returning a list with the input line reference and creating a + # GeometryCollection at the general split function prevents unnecessary copying + # of linestrings in multipoint splitting function) + return [line] + elif line.coords[0] == splitter.coords[0]: + # if line is a closed ring the previous test doesn't behave as desired + return [line] + + # point is on line, get the distance from the first point on line + distance_on_line = line.project(splitter) + coords = list(line.coords) + # split the line at the point and create two new lines + current_position = 0.0 + for i in range(len(coords) - 1): + point1 = coords[i] + point2 = coords[i + 1] + dx = point1[0] - point2[0] + dy = point1[1] - point2[1] + segment_length = (dx**2 + dy**2) ** 0.5 + current_position += segment_length + if distance_on_line == current_position: + # splitter is exactly on a vertex + return [LineString(coords[: i + 2]), LineString(coords[i + 1 :])] + elif distance_on_line < current_position: + # splitter is between two vertices + return [ + LineString(coords[: i + 1] + [splitter.coords[0]]), + LineString([splitter.coords[0]] + coords[i + 1 :]), + ] + return [line] + + @staticmethod + def _split_line_with_multipoint(line, splitter): + """Split a LineString with a MultiPoint""" + + if not isinstance(line, LineString): + raise GeometryTypeError("First argument must be a LineString") + if not isinstance(splitter, MultiPoint): + raise GeometryTypeError("Second argument must be a MultiPoint") + + chunks = [line] + for pt in splitter.geoms: + new_chunks = [] + for chunk in filter(lambda x: not x.is_empty, chunks): + # add the newly split 2 lines or the same line if not split + new_chunks.extend(SplitOp._split_line_with_point(chunk, pt)) + chunks = new_chunks + + return chunks + + @staticmethod + def split(geom, splitter): + """ + Splits a geometry by another geometry and returns a collection of geometries. This function is the theoretical + opposite of the union of the split geometry parts. If the splitter does not split the geometry, a collection + with a single geometry equal to the input geometry is returned. + The function supports: + - Splitting a (Multi)LineString by a (Multi)Point or (Multi)LineString or (Multi)Polygon + - Splitting a (Multi)Polygon by a LineString + + It may be convenient to snap the splitter with low tolerance to the geometry. For example in the case + of splitting a line by a point, the point must be exactly on the line, for the line to be correctly split. + When splitting a line by a polygon, the boundary of the polygon is used for the operation. + When splitting a line by another line, a ValueError is raised if the two overlap at some segment. + + Parameters + ---------- + geom : geometry + The geometry to be split + splitter : geometry + The geometry that will split the input geom + + Example + ------- + >>> pt = Point((1, 1)) + >>> line = LineString([(0,0), (2,2)]) + >>> result = split(line, pt) + >>> result.wkt + 'GEOMETRYCOLLECTION (LINESTRING (0 0, 1 1), LINESTRING (1 1, 2 2))' + """ + + if geom.geom_type in ("MultiLineString", "MultiPolygon"): + return GeometryCollection( + [i for part in geom.geoms for i in SplitOp.split(part, splitter).geoms] + ) + + elif geom.geom_type == "LineString": + if splitter.geom_type in ( + "LineString", + "MultiLineString", + "Polygon", + "MultiPolygon", + ): + split_func = SplitOp._split_line_with_line + elif splitter.geom_type == "Point": + split_func = SplitOp._split_line_with_point + elif splitter.geom_type == "MultiPoint": + split_func = SplitOp._split_line_with_multipoint + else: + raise GeometryTypeError( + f"Splitting a LineString with a {splitter.geom_type} is not supported" + ) + + elif geom.geom_type == "Polygon": + if splitter.geom_type == "LineString": + split_func = SplitOp._split_polygon_with_line + else: + raise GeometryTypeError( + f"Splitting a Polygon with a {splitter.geom_type} is not supported" + ) + + else: + raise GeometryTypeError( + f"Splitting {geom.geom_type} geometry is not supported" + ) + + return GeometryCollection(split_func(geom, splitter)) + + +split = SplitOp.split + + +def substring(geom, start_dist, end_dist, normalized=False): + """Return a line segment between specified distances along a LineString + + Negative distance values are taken as measured in the reverse + direction from the end of the geometry. Out-of-range index + values are handled by clamping them to the valid range of values. + + If the start distance equals the end distance, a Point is returned. + + If the start distance is actually beyond the end distance, then the + reversed substring is returned such that the start distance is + at the first coordinate. + + Parameters + ---------- + geom : LineString + The geometry to get a substring of. + start_dist : float + The distance along `geom` of the start of the substring. + end_dist : float + The distance along `geom` of the end of the substring. + normalized : bool, False + Whether the distance parameters are interpreted as a + fraction of the geometry's length. + + Returns + ------- + Union[Point, LineString] + The substring between `start_dist` and `end_dist` or a Point + if they are at the same location. + + Raises + ------ + TypeError + If `geom` is not a LineString. + + Examples + -------- + >>> from shapely.geometry import LineString + >>> from shapely.ops import substring + >>> ls = LineString((i, 0) for i in range(6)) + >>> ls.wkt + 'LINESTRING (0 0, 1 0, 2 0, 3 0, 4 0, 5 0)' + >>> substring(ls, start_dist=1, end_dist=3).wkt + 'LINESTRING (1 0, 2 0, 3 0)' + >>> substring(ls, start_dist=3, end_dist=1).wkt + 'LINESTRING (3 0, 2 0, 1 0)' + >>> substring(ls, start_dist=1, end_dist=-3).wkt + 'LINESTRING (1 0, 2 0)' + >>> substring(ls, start_dist=0.2, end_dist=-0.6, normalized=True).wkt + 'LINESTRING (1 0, 2 0)' + + Returning a `Point` when `start_dist` and `end_dist` are at the + same location. + + >>> substring(ls, 2.5, -2.5).wkt + 'POINT (2.5 0)' + """ + + if not isinstance(geom, LineString): + raise GeometryTypeError( + "Can only calculate a substring of LineString geometries. " + f"A {geom.geom_type} was provided." + ) + + # Filter out cases in which to return a point + if start_dist == end_dist: + return geom.interpolate(start_dist, normalized) + elif not normalized and start_dist >= geom.length and end_dist >= geom.length: + return geom.interpolate(geom.length, normalized) + elif not normalized and -start_dist >= geom.length and -end_dist >= geom.length: + return geom.interpolate(0, normalized) + elif normalized and start_dist >= 1 and end_dist >= 1: + return geom.interpolate(1, normalized) + elif normalized and -start_dist >= 1 and -end_dist >= 1: + return geom.interpolate(0, normalized) + + if normalized: + start_dist *= geom.length + end_dist *= geom.length + + # Filter out cases where distances meet at a middle point from opposite ends. + if start_dist < 0 < end_dist and abs(start_dist) + end_dist == geom.length: + return geom.interpolate(end_dist) + elif end_dist < 0 < start_dist and abs(end_dist) + start_dist == geom.length: + return geom.interpolate(start_dist) + + start_point = geom.interpolate(start_dist) + end_point = geom.interpolate(end_dist) + + if start_dist < 0: + start_dist = geom.length + start_dist # Values may still be negative, + if end_dist < 0: # but only in the out-of-range + end_dist = geom.length + end_dist # sense, not the wrap-around sense. + + reverse = start_dist > end_dist + if reverse: + start_dist, end_dist = end_dist, start_dist + + if start_dist < 0: + start_dist = 0 # to avoid duplicating the first vertex + + if reverse: + vertex_list = [(end_point.x, end_point.y)] + else: + vertex_list = [(start_point.x, start_point.y)] + + coords = list(geom.coords) + current_distance = 0 + for p1, p2 in zip(coords, coords[1:]): + if start_dist < current_distance < end_dist: + vertex_list.append(p1) + elif current_distance >= end_dist: + break + + current_distance += ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5 + + if reverse: + vertex_list.append((start_point.x, start_point.y)) + # reverse direction result + vertex_list = reversed(vertex_list) + else: + vertex_list.append((end_point.x, end_point.y)) + + return LineString(vertex_list) + + +def clip_by_rect(geom, xmin, ymin, xmax, ymax): + """Returns the portion of a geometry within a rectangle + + The geometry is clipped in a fast but possibly dirty way. The output is + not guaranteed to be valid. No exceptions will be raised for topological + errors. + + Parameters + ---------- + geom : geometry + The geometry to be clipped + xmin : float + Minimum x value of the rectangle + ymin : float + Minimum y value of the rectangle + xmax : float + Maximum x value of the rectangle + ymax : float + Maximum y value of the rectangle + + Notes + ----- + Requires GEOS >= 3.5.0 + New in 1.7. + """ + if geom.is_empty: + return geom + return shapely.clip_by_rect(geom, xmin, ymin, xmax, ymax) + + +def orient(geom, sign=1.0): + """A properly oriented copy of the given geometry. + + The signed area of the result will have the given sign. A sign of + 1.0 means that the coordinates of the product's exterior rings will + be oriented counter-clockwise. + + Parameters + ---------- + geom : Geometry + The original geometry. May be a Polygon, MultiPolygon, or + GeometryCollection. + sign : float, optional. + The sign of the result's signed area. + + Returns + ------- + Geometry + + """ + if isinstance(geom, BaseMultipartGeometry): + return geom.__class__( + list( + map( + lambda geom: orient(geom, sign), + geom.geoms, + ) + ) + ) + if isinstance(geom, (Polygon,)): + return orient_(geom, sign) + return geom diff --git a/billinglayer/python/shapely/plotting.py b/billinglayer/python/shapely/plotting.py new file mode 100644 index 0000000..02169fd --- /dev/null +++ b/billinglayer/python/shapely/plotting.py @@ -0,0 +1,217 @@ +""" +Plot single geometries using Matplotlib. + +Note: this module is experimental, and mainly targetting (interactive) +exploration, debugging and illustration purposes. + +""" + +import numpy as np + +import shapely + + +def _default_ax(): + import matplotlib.pyplot as plt + + ax = plt.gca() + ax.grid(True) + ax.set_aspect("equal") + return ax + + +def _path_from_polygon(polygon): + from matplotlib.path import Path + + if isinstance(polygon, shapely.MultiPolygon): + return Path.make_compound_path( + *[_path_from_polygon(poly) for poly in polygon.geoms] + ) + else: + return Path.make_compound_path( + Path(np.asarray(polygon.exterior.coords)[:, :2]), + *[Path(np.asarray(ring.coords)[:, :2]) for ring in polygon.interiors], + ) + + +def patch_from_polygon(polygon, **kwargs): + """ + Gets a Matplotlib patch from a (Multi)Polygon. + + Note: this function is experimental, and mainly targetting (interactive) + exploration, debugging and illustration purposes. + + Parameters + ---------- + polygon : shapely.Polygon or shapely.MultiPolygon + **kwargs + Additional keyword arguments passed to the matplotlib Patch. + + Returns + ------- + Matplotlib artist (PathPatch) + """ + from matplotlib.patches import PathPatch + + return PathPatch(_path_from_polygon(polygon), **kwargs) + + +def plot_polygon( + polygon, + ax=None, + add_points=True, + color=None, + facecolor=None, + edgecolor=None, + linewidth=None, + **kwargs +): + """ + Plot a (Multi)Polygon. + + Note: this function is experimental, and mainly targetting (interactive) + exploration, debugging and illustration purposes. + + Parameters + ---------- + polygon : shapely.Polygon or shapely.MultiPolygon + ax : matplotlib Axes, default None + The axes on which to draw the plot. If not specified, will get the + current active axes or create a new figure. + add_points : bool, default True + If True, also plot the coordinates (vertices) as points. + color : matplotlib color specification + Color for both the polygon fill (face) and boundary (edge). By default, + the fill is using an alpha of 0.3. You can specify `facecolor` and + `edgecolor` separately for greater control. + facecolor : matplotlib color specification + Color for the polygon fill. + edgecolor : matplotlib color specification + Color for the polygon boundary. + linewidth : float + The line width for the polygon boundary. + **kwargs + Additional keyword arguments passed to the matplotlib Patch. + + Returns + ------- + Matplotlib artist (PathPatch), if `add_points` is false. + A tuple of Matplotlib artists (PathPatch, Line2D), if `add_points` is true. + """ + from matplotlib import colors + + if ax is None: + ax = _default_ax() + + if color is None: + color = "C0" + color = colors.to_rgba(color) + + if facecolor is None: + facecolor = list(color) + facecolor[-1] = 0.3 + facecolor = tuple(facecolor) + + if edgecolor is None: + edgecolor = color + + patch = patch_from_polygon( + polygon, facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth, **kwargs + ) + ax.add_patch(patch) + ax.autoscale_view() + + if add_points: + line = plot_points(polygon, ax=ax, color=color) + return patch, line + + return patch + + +def plot_line(line, ax=None, add_points=True, color=None, linewidth=2, **kwargs): + """ + Plot a (Multi)LineString/LinearRing. + + Note: this function is experimental, and mainly targetting (interactive) + exploration, debugging and illustration purposes. + + Parameters + ---------- + line : shapely.LineString or shapely.LinearRing + ax : matplotlib Axes, default None + The axes on which to draw the plot. If not specified, will get the + current active axes or create a new figure. + add_points : bool, default True + If True, also plot the coordinates (vertices) as points. + color : matplotlib color specification + Color for the line (edgecolor under the hood) and pointes. + linewidth : float, default 2 + The line width for the polygon boundary. + **kwargs + Additional keyword arguments passed to the matplotlib Patch. + + Returns + ------- + Matplotlib artist (PathPatch) + """ + from matplotlib.patches import PathPatch + from matplotlib.path import Path + + if ax is None: + ax = _default_ax() + + if color is None: + color = "C0" + + if isinstance(line, shapely.MultiLineString): + path = Path.make_compound_path( + *[Path(np.asarray(mline.coords)[:, :2]) for mline in line.geoms] + ) + else: + path = Path(np.asarray(line.coords)[:, :2]) + + patch = PathPatch( + path, facecolor="none", edgecolor=color, linewidth=linewidth, **kwargs + ) + ax.add_patch(patch) + ax.autoscale_view() + + if add_points: + line = plot_points(line, ax=ax, color=color) + return patch, line + + return patch + + +def plot_points(geom, ax=None, color=None, marker="o", **kwargs): + """ + Plot a Point/MultiPoint or the vertices of any other geometry type. + + Parameters + ---------- + geom : shapely.Geometry + Any shapely Geometry object, from which all vertices are extracted + and plotted. + ax : matplotlib Axes, default None + The axes on which to draw the plot. If not specified, will get the + current active axes or create a new figure. + color : matplotlib color specification + Color for the filled points. You can use `markeredgecolor` and + `markeredgecolor` to have different edge and fill colors. + marker : str, default "o" + The matplotlib marker for the points. + **kwargs + Additional keyword arguments passed to matplotlib `plot` (Line2D). + + Returns + ------- + Matplotlib artist (Line2D) + """ + if ax is None: + ax = _default_ax() + + coords = shapely.get_coordinates(geom) + (line,) = ax.plot( + coords[:, 0], coords[:, 1], linestyle="", marker=marker, color=color, **kwargs + ) + return line diff --git a/billinglayer/python/shapely/predicates.py b/billinglayer/python/shapely/predicates.py new file mode 100644 index 0000000..52732ea --- /dev/null +++ b/billinglayer/python/shapely/predicates.py @@ -0,0 +1,1184 @@ +import warnings + +import numpy as np + +from . import lib +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "has_z", + "is_ccw", + "is_closed", + "is_empty", + "is_geometry", + "is_missing", + "is_prepared", + "is_ring", + "is_simple", + "is_valid", + "is_valid_input", + "is_valid_reason", + "crosses", + "contains", + "contains_xy", + "contains_properly", + "covered_by", + "covers", + "disjoint", + "dwithin", + "equals", + "intersects", + "intersects_xy", + "overlaps", + "touches", + "within", + "equals_exact", + "relate", + "relate_pattern", +] + + +@multithreading_enabled +def has_z(geometry, **kwargs): + """Returns True if a geometry has a Z coordinate. + + Note that this function returns False if the (first) Z coordinate equals NaN or + if the geometry is empty. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_coordinate_dimension + + Examples + -------- + >>> from shapely import Point + >>> has_z(Point(0, 0)) + False + >>> has_z(Point(0, 0, 0)) + True + >>> has_z(Point(0, 0, float("nan"))) + False + """ + return lib.has_z(geometry, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def is_ccw(geometry, **kwargs): + """Returns True if a linestring or linearring is counterclockwise. + + Note that there are no checks on whether lines are actually closed and + not self-intersecting, while this is a requirement for is_ccw. The recommended + usage of this function for linestrings is ``is_ccw(g) & is_simple(g)`` and for + linearrings ``is_ccw(g) & is_valid(g)``. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for non-linear goemetries and for + lines with fewer than 4 points (including the closing point). + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_simple : Checks if a linestring is closed and simple. + is_valid : Checks additionally if the geometry is simple. + + Examples + -------- + >>> from shapely import LinearRing, LineString, Point + >>> is_ccw(LinearRing([(0, 0), (0, 1), (1, 1), (0, 0)])) + False + >>> is_ccw(LinearRing([(0, 0), (1, 1), (0, 1), (0, 0)])) + True + >>> is_ccw(LineString([(0, 0), (1, 1), (0, 1)])) + False + >>> is_ccw(Point(0, 0)) + False + """ + return lib.is_ccw(geometry, **kwargs) + + +@multithreading_enabled +def is_closed(geometry, **kwargs): + """Returns True if a linestring's first and last points are equal. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for non-linestrings. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_ring : Checks additionally if the geometry is simple. + + Examples + -------- + >>> from shapely import LineString, Point + >>> is_closed(LineString([(0, 0), (1, 1)])) + False + >>> is_closed(LineString([(0, 0), (0, 1), (1, 1), (0, 0)])) + True + >>> is_closed(Point(0, 0)) + False + """ + return lib.is_closed(geometry, **kwargs) + + +@multithreading_enabled +def is_empty(geometry, **kwargs): + """Returns True if a geometry is an empty point, polygon, etc. + + Parameters + ---------- + geometry : Geometry or array_like + Any geometry type is accepted. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_missing : checks if the object is a geometry + + Examples + -------- + >>> from shapely import Point + >>> is_empty(Point()) + True + >>> is_empty(Point(0, 0)) + False + >>> is_empty(None) + False + """ + return lib.is_empty(geometry, **kwargs) + + +@multithreading_enabled +def is_geometry(geometry, **kwargs): + """Returns True if the object is a geometry + + Parameters + ---------- + geometry : any object or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_missing : check if an object is missing (None) + is_valid_input : check if an object is a geometry or None + + Examples + -------- + >>> from shapely import GeometryCollection, Point + >>> is_geometry(Point(0, 0)) + True + >>> is_geometry(GeometryCollection()) + True + >>> is_geometry(None) + False + >>> is_geometry("text") + False + """ + return lib.is_geometry(geometry, **kwargs) + + +@multithreading_enabled +def is_missing(geometry, **kwargs): + """Returns True if the object is not a geometry (None) + + Parameters + ---------- + geometry : any object or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_geometry : check if an object is a geometry + is_valid_input : check if an object is a geometry or None + is_empty : checks if the object is an empty geometry + + Examples + -------- + >>> from shapely import GeometryCollection, Point + >>> is_missing(Point(0, 0)) + False + >>> is_missing(GeometryCollection()) + False + >>> is_missing(None) + True + >>> is_missing("text") + False + """ + return lib.is_missing(geometry, **kwargs) + + +@multithreading_enabled +def is_prepared(geometry, **kwargs): + """Returns True if a Geometry is prepared. + + Note that it is not necessary to check if a geometry is already prepared + before preparing it. It is more efficient to call ``prepare`` directly + because it will skip geometries that are already prepared. + + This function will return False for missing geometries (None). + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_valid_input : check if an object is a geometry or None + prepare : prepare a geometry + + Examples + -------- + >>> from shapely import Point, prepare + >>> geometry = Point(0, 0) + >>> is_prepared(Point(0, 0)) + False + >>> prepare(geometry) + >>> is_prepared(geometry) + True + >>> is_prepared(None) + False + """ + return lib.is_prepared(geometry, **kwargs) + + +@multithreading_enabled +def is_valid_input(geometry, **kwargs): + """Returns True if the object is a geometry or None + + Parameters + ---------- + geometry : any object or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_geometry : checks if an object is a geometry + is_missing : checks if an object is None + + Examples + -------- + >>> from shapely import GeometryCollection, Point + >>> is_valid_input(Point(0, 0)) + True + >>> is_valid_input(GeometryCollection()) + True + >>> is_valid_input(None) + True + >>> is_valid_input(1.0) + False + >>> is_valid_input("text") + False + """ + return lib.is_valid_input(geometry, **kwargs) + + +@multithreading_enabled +def is_ring(geometry, **kwargs): + """Returns True if a linestring is closed and simple. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for non-linestrings. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_closed : Checks only if the geometry is closed. + is_simple : Checks only if the geometry is simple. + + Examples + -------- + >>> from shapely import LineString, Point + >>> is_ring(Point(0, 0)) + False + >>> geom = LineString([(0, 0), (1, 1)]) + >>> is_closed(geom), is_simple(geom), is_ring(geom) + (False, True, False) + >>> geom = LineString([(0, 0), (0, 1), (1, 1), (0, 0)]) + >>> is_closed(geom), is_simple(geom), is_ring(geom) + (True, True, True) + >>> geom = LineString([(0, 0), (1, 1), (0, 1), (1, 0), (0, 0)]) + >>> is_closed(geom), is_simple(geom), is_ring(geom) + (True, False, False) + """ + return lib.is_ring(geometry, **kwargs) + + +@multithreading_enabled +def is_simple(geometry, **kwargs): + """Returns True if a Geometry has no anomalous geometric points, such as + self-intersections or self tangency. + + Note that polygons and linearrings are assumed to be simple. Use is_valid + to check these kind of geometries for self-intersections. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for geometrycollections. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_ring : Checks additionally if the geometry is closed. + is_valid : Checks whether a geometry is well formed. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> is_simple(Polygon([(1, 1), (2, 1), (2, 2), (1, 1)])) + True + >>> is_simple(LineString([(0, 0), (1, 1), (0, 1), (1, 0), (0, 0)])) + False + >>> is_simple(None) + False + """ + return lib.is_simple(geometry, **kwargs) + + +@multithreading_enabled +def is_valid(geometry, **kwargs): + """Returns True if a geometry is well formed. + + Parameters + ---------- + geometry : Geometry or array_like + Any geometry type is accepted. Returns False for missing values. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_valid_reason : Returns the reason in case of invalid. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Polygon + >>> is_valid(LineString([(0, 0), (1, 1)])) + True + >>> is_valid(Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)])) + False + >>> is_valid(GeometryCollection()) + True + >>> is_valid(None) + False + """ + # GEOS is valid will emit warnings for invalid geometries. Suppress them. + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + result = lib.is_valid(geometry, **kwargs) + return result + + +def is_valid_reason(geometry, **kwargs): + """Returns a string stating if a geometry is valid and if not, why. + + Parameters + ---------- + geometry : Geometry or array_like + Any geometry type is accepted. Returns None for missing values. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_valid : returns True or False + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> is_valid_reason(LineString([(0, 0), (1, 1)])) + 'Valid Geometry' + >>> is_valid_reason(Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)])) + 'Ring Self-intersection[1 1]' + >>> is_valid_reason(None) is None + True + """ + return lib.is_valid_reason(geometry, **kwargs) + + +@multithreading_enabled +def crosses(a, b, **kwargs): + """Returns True if A and B spatially cross. + + A crosses B if they have some but not all interior points in common, + the intersection is one dimension less than the maximum dimension of A or B, + and the intersection is not equal to either A or B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> # A contains B: + >>> crosses(line, Point(0.5, 0.5)) + False + >>> # A and B intersect at a point but do not share all points: + >>> crosses(line, MultiPoint([(0, 1), (0.5, 0.5)])) + True + >>> crosses(line, LineString([(0, 1), (1, 0)])) + True + >>> # A is contained by B; their intersection is a line (same dimension): + >>> crosses(line, LineString([(0, 0), (2, 2)])) + False + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> # A contains B: + >>> crosses(area, line) + False + >>> # A and B intersect with a line (lower dimension) but do not share all points: + >>> crosses(area, LineString([(0, 0), (2, 2)])) + True + >>> # A contains B: + >>> crosses(area, Point(0.5, 0.5)) + False + >>> # A contains some but not all points of B; they intersect at a point: + >>> crosses(area, MultiPoint([(2, 2), (0.5, 0.5)])) + True + """ + return lib.crosses(a, b, **kwargs) + + +@multithreading_enabled +def contains(a, b, **kwargs): + """Returns True if geometry B is completely inside geometry A. + + A contains B if no points of B lie in the exterior of A and at least one + point of the interior of B lies in the interior of A. + + Note: following this definition, a geometry does not contain its boundary, + but it does contain itself. See ``contains_properly`` for a version where + a geometry does not contain itself. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + within : ``contains(A, B) == within(B, A)`` + contains_properly : contains with no common boundary points + prepare : improve performance by preparing ``a`` (the first argument) + contains_xy : variant for checking against a Point with x, y coordinates + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> contains(line, Point(0, 0)) + False + >>> contains(line, Point(0.5, 0.5)) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> contains(area, Point(0, 0)) + False + >>> contains(area, line) + True + >>> contains(area, LineString([(0, 0), (2, 2)])) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> contains(polygon_with_hole, Point(1, 1)) + True + >>> contains(polygon_with_hole, Point(2, 2)) + False + >>> contains(polygon_with_hole, LineString([(1, 1), (5, 5)])) + False + >>> contains(area, area) + True + >>> contains(area, None) + False + """ + return lib.contains(a, b, **kwargs) + + +@multithreading_enabled +def contains_properly(a, b, **kwargs): + """Returns True if geometry B is completely inside geometry A, with no + common boundary points. + + A contains B properly if B intersects the interior of A but not the + boundary (or exterior). This means that a geometry A does not + "contain properly" itself, which contrasts with the ``contains`` function, + where common points on the boundary are allowed. + + Note: this function will prepare the geometries under the hood if needed. + You can prepare the geometries in advance to avoid repeated preparation + when calling this function multiple times. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + contains : contains which allows common boundary points + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import Polygon + >>> area1 = Polygon([(0, 0), (3, 0), (3, 3), (0, 3), (0, 0)]) + >>> area2 = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> area3 = Polygon([(1, 1), (2, 1), (2, 2), (1, 2), (1, 1)]) + + ``area1`` and ``area2`` have a common border: + + >>> contains(area1, area2) + True + >>> contains_properly(area1, area2) + False + + ``area3`` is completely inside ``area1`` with no common border: + + >>> contains(area1, area3) + True + >>> contains_properly(area1, area3) + True + """ + return lib.contains_properly(a, b, **kwargs) + + +@multithreading_enabled +def covered_by(a, b, **kwargs): + """Returns True if no point in geometry A is outside geometry B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + covers : ``covered_by(A, B) == covers(B, A)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> covered_by(Point(0, 0), line) + True + >>> covered_by(Point(0.5, 0.5), line) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> covered_by(Point(0, 0), area) + True + >>> covered_by(line, area) + True + >>> covered_by(LineString([(0, 0), (2, 2)]), area) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> covered_by(Point(1, 1), polygon_with_hole) + True + >>> covered_by(Point(2, 2), polygon_with_hole) + True + >>> covered_by(LineString([(1, 1), (5, 5)]), polygon_with_hole) + False + >>> covered_by(area, area) + True + >>> covered_by(None, area) + False + """ + return lib.covered_by(a, b, **kwargs) + + +@multithreading_enabled +def covers(a, b, **kwargs): + """Returns True if no point in geometry B is outside geometry A. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + covered_by : ``covers(A, B) == covered_by(B, A)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> covers(line, Point(0, 0)) + True + >>> covers(line, Point(0.5, 0.5)) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> covers(area, Point(0, 0)) + True + >>> covers(area, line) + True + >>> covers(area, LineString([(0, 0), (2, 2)])) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> covers(polygon_with_hole, Point(1, 1)) + True + >>> covers(polygon_with_hole, Point(2, 2)) + True + >>> covers(polygon_with_hole, LineString([(1, 1), (5, 5)])) + False + >>> covers(area, area) + True + >>> covers(area, None) + False + """ + return lib.covers(a, b, **kwargs) + + +@multithreading_enabled +def disjoint(a, b, **kwargs): + """Returns True if A and B do not share any point in space. + + Disjoint implies that overlaps, touches, within, and intersects are False. + Note missing (None) values are never disjoint. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + intersects : ``disjoint(A, B) == ~intersects(A, B)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Point + >>> line = LineString([(0, 0), (1, 1)]) + >>> disjoint(line, Point(0, 0)) + False + >>> disjoint(line, Point(0, 1)) + True + >>> disjoint(line, LineString([(0, 2), (2, 0)])) + False + >>> empty = GeometryCollection() + >>> disjoint(line, empty) + True + >>> disjoint(empty, empty) + True + >>> disjoint(empty, None) + False + >>> disjoint(None, None) + False + """ + return lib.disjoint(a, b, **kwargs) + + +@multithreading_enabled +def equals(a, b, **kwargs): + """Returns True if A and B are spatially equal. + + If A is within B and B is within A, A and B are considered equal. The + ordering of points can be different. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See Also + -------- + equals_exact : Check if A and B are structurally equal given a specified + tolerance. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Polygon + >>> line = LineString([(0, 0), (5, 5), (10, 10)]) + >>> equals(line, LineString([(0, 0), (10, 10)])) + True + >>> equals(Polygon(), GeometryCollection()) + True + >>> equals(None, None) + False + """ + return lib.equals(a, b, **kwargs) + + +@multithreading_enabled +def intersects(a, b, **kwargs): + """Returns True if A and B share any portion of space. + + Intersects implies that overlaps, touches and within are True. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + disjoint : ``intersects(A, B) == ~disjoint(A, B)`` + prepare : improve performance by preparing ``a`` (the first argument) + intersects_xy : variant for checking against a Point with x, y coordinates + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 0), (1, 1)]) + >>> intersects(line, Point(0, 0)) + True + >>> intersects(line, Point(0, 1)) + False + >>> intersects(line, LineString([(0, 2), (2, 0)])) + True + >>> intersects(None, None) + False + """ + return lib.intersects(a, b, **kwargs) + + +@multithreading_enabled +def overlaps(a, b, **kwargs): + """Returns True if A and B spatially overlap. + + A and B overlap if they have some but not all points in common, have the + same dimension, and the intersection of the interiors of the two geometries + has the same dimension as the geometries themselves. That is, only polyons + can overlap other polygons and only lines can overlap other lines. + + If either A or B are None, the output is always False. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> poly = Polygon([(0, 0), (0, 4), (4, 4), (4, 0), (0, 0)]) + >>> # A and B share all points (are spatially equal): + >>> overlaps(poly, poly) + False + >>> # A contains B; all points of B are within A: + >>> overlaps(poly, Polygon([(0, 0), (0, 2), (2, 2), (2, 0), (0, 0)])) + False + >>> # A partially overlaps with B: + >>> overlaps(poly, Polygon([(2, 2), (2, 6), (6, 6), (6, 2), (2, 2)])) + True + >>> line = LineString([(2, 2), (6, 6)]) + >>> # A and B are different dimensions; they cannot overlap: + >>> overlaps(poly, line) + False + >>> overlaps(poly, Point(2, 2)) + False + >>> # A and B share some but not all points: + >>> overlaps(line, LineString([(0, 0), (4, 4)])) + True + >>> # A and B intersect only at a point (lower dimension); they do not overlap + >>> overlaps(line, LineString([(6, 0), (0, 6)])) + False + >>> overlaps(poly, None) + False + >>> overlaps(None, None) + False + """ + return lib.overlaps(a, b, **kwargs) + + +@multithreading_enabled +def touches(a, b, **kwargs): + """Returns True if the only points shared between A and B are on the + boundary of A and B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 2), (2, 0)]) + >>> touches(line, Point(0, 2)) + True + >>> touches(line, Point(1, 1)) + False + >>> touches(line, LineString([(0, 0), (1, 1)])) + True + >>> touches(line, LineString([(0, 0), (2, 2)])) + False + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> touches(area, Point(0.5, 0)) + True + >>> touches(area, Point(0.5, 0.5)) + False + >>> touches(area, line) + True + >>> touches(area, Polygon([(0, 1), (1, 1), (1, 2), (0, 2), (0, 1)])) + True + """ + return lib.touches(a, b, **kwargs) + + +@multithreading_enabled +def within(a, b, **kwargs): + """Returns True if geometry A is completely inside geometry B. + + A is within B if no points of A lie in the exterior of B and at least one + point of the interior of A lies in the interior of B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + contains : ``within(A, B) == contains(B, A)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> within(Point(0, 0), line) + False + >>> within(Point(0.5, 0.5), line) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> within(Point(0, 0), area) + False + >>> within(line, area) + True + >>> within(LineString([(0, 0), (2, 2)]), area) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> within(Point(1, 1), polygon_with_hole) + True + >>> within(Point(2, 2), polygon_with_hole) + False + >>> within(LineString([(1, 1), (5, 5)]), polygon_with_hole) + False + >>> within(area, area) + True + >>> within(None, area) + False + """ + return lib.within(a, b, **kwargs) + + +@multithreading_enabled +def equals_exact(a, b, tolerance=0.0, **kwargs): + """Returns True if A and B are structurally equal. + + This method uses exact coordinate equality, which requires coordinates + to be equal (within specified tolerance) and and in the same order for all + components of a geometry. This is in contrast with the ``equals`` function + which uses spatial (topological) equality. + + Parameters + ---------- + a, b : Geometry or array_like + tolerance : float or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See Also + -------- + equals : Check if A and B are spatially equal. + + Examples + -------- + >>> from shapely import Point, Polygon + >>> point1 = Point(50, 50) + >>> point2 = Point(50.1, 50.1) + >>> equals_exact(point1, point2) + False + >>> equals_exact(point1, point2, tolerance=0.2) + True + >>> equals_exact(point1, None, tolerance=0.2) + False + + Difference between structucal and spatial equality: + + >>> polygon1 = Polygon([(0, 0), (1, 1), (0, 1), (0, 0)]) + >>> polygon2 = Polygon([(0, 0), (0, 1), (1, 1), (0, 0)]) + >>> equals_exact(polygon1, polygon2) + False + >>> equals(polygon1, polygon2) + True + """ + return lib.equals_exact(a, b, tolerance, **kwargs) + + +def relate(a, b, **kwargs): + """ + Returns a string representation of the DE-9IM intersection matrix. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> point = Point(0, 0) + >>> line = LineString([(0, 0), (1, 1)]) + >>> relate(point, line) + 'F0FFFF102' + """ + return lib.relate(a, b, **kwargs) + + +@multithreading_enabled +def relate_pattern(a, b, pattern, **kwargs): + """ + Returns True if the DE-9IM string code for the relationship between + the geometries satisfies the pattern, else False. + + This function compares the DE-9IM code string for two geometries + against a specified pattern. If the string matches the pattern then + ``True`` is returned, otherwise ``False``. The pattern specified can + be an exact match (``0``, ``1`` or ``2``), a boolean match + (uppercase ``T`` or ``F``), or a wildcard (``*``). For example, + the pattern for the ``within`` predicate is ``'T*F**F***'``. + + Parameters + ---------- + a, b : Geometry or array_like + pattern : string + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point, Polygon + >>> point = Point(0.5, 0.5) + >>> square = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + >>> relate(point, square) + '0FFFFF212' + >>> relate_pattern(point, square, "T*F**F***") + True + """ + return lib.relate_pattern(a, b, pattern, **kwargs) + + +@multithreading_enabled +@requires_geos("3.10.0") +def dwithin(a, b, distance, **kwargs): + """ + Returns True if the geometries are within a given distance. + + Using this function is more efficient than computing the distance and + comparing the result. + + Parameters + ---------- + a, b : Geometry or array_like + distance : float + Negative distances always return False. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + distance : compute the actual distance between A and B + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import Point + >>> point = Point(0.5, 0.5) + >>> dwithin(point, Point(2, 0.5), 2) + True + >>> dwithin(point, Point(2, 0.5), [2, 1.5, 1]).tolist() + [True, True, False] + >>> dwithin(point, Point(0.5, 0.5), 0) + True + >>> dwithin(point, None, 100) + False + """ + return lib.dwithin(a, b, distance, **kwargs) + + +@multithreading_enabled +def contains_xy(geom, x, y=None, **kwargs): + """ + Returns True if the Point (x, y) is completely inside geometry A. + + This is a special-case (and faster) variant of the `contains` function + which avoids having to create a Point object if you start from x/y + coordinates. + + Note that in the case of points, the `contains_properly` predicate is + equivalent to `contains`. + + See the docstring of `contains` for more details about the predicate. + + Parameters + ---------- + geom : Geometry or array_like + x, y : float or array_like + Coordinates as separate x and y arrays, or a single array of + coordinate x, y tuples. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + contains : variant taking two geometries as input + + Notes + ----- + If you compare a small number of polygons or lines with many points, + it can be beneficial to prepare the geometries in advance using + :func:`shapely.prepare`. + + Examples + -------- + >>> from shapely import Point, Polygon + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> contains(area, Point(0.5, 0.5)) + True + >>> contains_xy(area, 0.5, 0.5) + True + """ + if y is None: + coords = np.asarray(x) + x, y = coords[:, 0], coords[:, 1] + return lib.contains_xy(geom, x, y, **kwargs) + + +@multithreading_enabled +def intersects_xy(geom, x, y=None, **kwargs): + """ + Returns True if A and the Point (x, y) share any portion of space. + + This is a special-case (and faster) variant of the `intersects` function + which avoids having to create a Point object if you start from x/y + coordinates. + + See the docstring of `intersects` for more details about the predicate. + + Parameters + ---------- + geom : Geometry or array_like + x, y : float or array_like + Coordinates as separate x and y arrays, or a single array of + coordinate x, y tuples. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + intersects : variant taking two geometries as input + + Notes + ----- + If you compare a single or few geometries with many points, it can be + beneficial to prepare the geometries in advance using + :func:`shapely.prepare`. + + The `touches` predicate can be determined with this function by getting + the boundary of the geometries: ``intersects_xy(boundary(geom), x, y)``. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 0), (1, 1)]) + >>> intersects(line, Point(0, 0)) + True + >>> intersects_xy(line, 0, 0) + True + """ + if y is None: + coords = np.asarray(x) + x, y = coords[:, 0], coords[:, 1] + return lib.intersects_xy(geom, x, y, **kwargs) diff --git a/billinglayer/python/shapely/prepared.py b/billinglayer/python/shapely/prepared.py new file mode 100644 index 0000000..1070da7 --- /dev/null +++ b/billinglayer/python/shapely/prepared.py @@ -0,0 +1,77 @@ +""" +Support for GEOS prepared geometry operations. +""" +from pickle import PicklingError + +import shapely + + +class PreparedGeometry: + """ + A geometry prepared for efficient comparison to a set of other geometries. + + Example: + + >>> from shapely.geometry import Point, Polygon + >>> triangle = Polygon([(0.0, 0.0), (1.0, 1.0), (1.0, -1.0)]) + >>> p = prep(triangle) + >>> p.intersects(Point(0.5, 0.5)) + True + """ + + def __init__(self, context): + if isinstance(context, PreparedGeometry): + self.context = context.context + else: + shapely.prepare(context) + self.context = context + self.prepared = True + + def contains(self, other): + """Returns True if the geometry contains the other, else False""" + return self.context.contains(other) + + def contains_properly(self, other): + """Returns True if the geometry properly contains the other, else False""" + # TODO temporary hack until shapely exposes contains properly as predicate function + from shapely import STRtree + + tree = STRtree([other]) + idx = tree.query(self.context, predicate="contains_properly") + return bool(len(idx)) + + def covers(self, other): + """Returns True if the geometry covers the other, else False""" + return self.context.covers(other) + + def crosses(self, other): + """Returns True if the geometries cross, else False""" + return self.context.crosses(other) + + def disjoint(self, other): + """Returns True if geometries are disjoint, else False""" + return self.context.disjoint(other) + + def intersects(self, other): + """Returns True if geometries intersect, else False""" + return self.context.intersects(other) + + def overlaps(self, other): + """Returns True if geometries overlap, else False""" + return self.context.overlaps(other) + + def touches(self, other): + """Returns True if geometries touch, else False""" + return self.context.touches(other) + + def within(self, other): + """Returns True if geometry is within the other, else False""" + return self.context.within(other) + + def __reduce__(self): + raise PicklingError("Prepared geometries cannot be pickled.") + + +def prep(ob): + """Creates and returns a prepared geometric object.""" + return PreparedGeometry(ob) diff --git a/billinglayer/python/shapely/set_operations.py b/billinglayer/python/shapely/set_operations.py new file mode 100644 index 0000000..ffb42fd --- /dev/null +++ b/billinglayer/python/shapely/set_operations.py @@ -0,0 +1,514 @@ +import numpy as np + +from . import GeometryType, lib +from .decorators import multithreading_enabled, requires_geos +from .errors import UnsupportedGEOSVersionError + +__all__ = [ + "difference", + "intersection", + "intersection_all", + "symmetric_difference", + "symmetric_difference_all", + "unary_union", + "union", + "union_all", + "coverage_union", + "coverage_union_all", +] + + +@multithreading_enabled +def difference(a, b, grid_size=None, **kwargs): + """Returns the part of geometry A that does not intersect with geometry B. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize, Polygon + >>> line = LineString([(0, 0), (2, 2)]) + >>> difference(line, LineString([(1, 1), (3, 3)])) + + >>> difference(line, LineString()) + + >>> difference(line, None) is None + True + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(difference(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> difference(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.difference_prec(a, b, grid_size, **kwargs) + + return lib.difference(a, b, **kwargs) + + +@multithreading_enabled +def intersection(a, b, grid_size=None, **kwargs): + """Returns the geometry that is shared between input geometries. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + intersection_all + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize, Polygon + >>> line = LineString([(0, 0), (2, 2)]) + >>> intersection(line, LineString([(1, 1), (3, 3)])) + + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(intersection(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> intersection(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.intersection_prec(a, b, grid_size, **kwargs) + + return lib.intersection(a, b, **kwargs) + + +@multithreading_enabled +def intersection_all(geometries, axis=None, **kwargs): + """Returns the intersection of multiple geometries. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None, an empty GeometryCollection is + returned. + + Parameters + ---------- + geometries : array_like + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc.reduce docs `_. + + See also + -------- + intersection + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (2, 2)]) + >>> line2 = LineString([(1, 1), (3, 3)]) + >>> intersection_all([line1, line2]) + + >>> intersection_all([[line1, line2, None]], axis=1).tolist() + [] + >>> intersection_all([line1, None]) + + """ + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis(geometries, axis=axis, start=geometries.ndim) + + return lib.intersection_all(geometries, **kwargs) + + +@multithreading_enabled +def symmetric_difference(a, b, grid_size=None, **kwargs): + """Returns the geometry that represents the portions of input geometries + that do not intersect. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + symmetric_difference_all + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize + >>> line = LineString([(0, 0), (2, 2)]) + >>> symmetric_difference(line, LineString([(1, 1), (3, 3)])) + + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(symmetric_difference(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> symmetric_difference(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.symmetric_difference_prec(a, b, grid_size, **kwargs) + + return lib.symmetric_difference(a, b, **kwargs) + + +@multithreading_enabled +def symmetric_difference_all(geometries, axis=None, **kwargs): + """Returns the symmetric difference of multiple geometries. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None an empty GeometryCollection is + returned. + + Parameters + ---------- + geometries : array_like + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc.reduce docs `_. + + See also + -------- + symmetric_difference + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (2, 2)]) + >>> line2 = LineString([(1, 1), (3, 3)]) + >>> symmetric_difference_all([line1, line2]) + + >>> symmetric_difference_all([[line1, line2, None]], axis=1).tolist() + [] + >>> symmetric_difference_all([line1, None]) + + >>> symmetric_difference_all([None, None]) + + """ + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis(geometries, axis=axis, start=geometries.ndim) + + return lib.symmetric_difference_all(geometries, **kwargs) + + +@multithreading_enabled +def union(a, b, grid_size=None, **kwargs): + """Merges geometries into one. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + union_all + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize + >>> line = LineString([(0, 0), (2, 2)]) + >>> union(line, LineString([(2, 2), (3, 3)])) + + >>> union(line, None) is None + True + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(union(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> union(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.union_prec(a, b, grid_size, **kwargs) + + return lib.union(a, b, **kwargs) + + +@multithreading_enabled +def union_all(geometries, grid_size=None, axis=None, **kwargs): + """Returns the union of multiple geometries. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None an empty GeometryCollection is + returned. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + `unary_union` is an alias of `union_all`. + + Parameters + ---------- + geometries : array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + union + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize, Point + >>> line1 = LineString([(0, 0), (2, 2)]) + >>> line2 = LineString([(2, 2), (3, 3)]) + >>> union_all([line1, line2]) + + >>> union_all([[line1, line2, None]], axis=1).tolist() + [] + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(union_all([box1, box2])) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> union_all([box1, box2], grid_size=1) + + >>> union_all([None, Point(0, 1)]) + + >>> union_all([None, None]) + + >>> union_all([]) + + """ + # for union_all, GEOS provides an efficient route through first creating + # GeometryCollections + # first roll the aggregation axis backwards + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis(geometries, axis=axis, start=geometries.ndim) + + # create_collection acts on the inner axis + collections = lib.create_collection(geometries, GeometryType.GEOMETRYCOLLECTION) + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.unary_union_prec(collections, grid_size, **kwargs) + + return lib.unary_union(collections, **kwargs) + + +unary_union = union_all + + +@requires_geos("3.8.0") +@multithreading_enabled +def coverage_union(a, b, **kwargs): + """Merges multiple polygons into one. This is an optimized version of + union which assumes the polygons to be non-overlapping. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + coverage_union_all + + Examples + -------- + >>> from shapely import normalize, Polygon + >>> polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + >>> normalize(coverage_union(polygon, Polygon([(1, 0), (1, 1), (2, 1), (2, 0), (1, 0)]))) + + + Union with None returns same polygon + >>> normalize(coverage_union(polygon, None)) + + """ + return coverage_union_all([a, b], **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def coverage_union_all(geometries, axis=None, **kwargs): + """Returns the union of multiple polygons of a geometry collection. + This is an optimized version of union which assumes the polygons + to be non-overlapping. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None, an empty MultiPolygon is + returned. + + Parameters + ---------- + geometries : array_like + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + coverage_union + + Examples + -------- + >>> from shapely import normalize, Polygon + >>> polygon_1 = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + >>> polygon_2 = Polygon([(1, 0), (1, 1), (2, 1), (2, 0), (1, 0)]) + >>> normalize(coverage_union_all([polygon_1, polygon_2])) + + >>> normalize(coverage_union_all([polygon_1, None])) + + >>> normalize(coverage_union_all([None, None])) + + """ + # coverage union in GEOS works over GeometryCollections + # first roll the aggregation axis backwards + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis( + np.asarray(geometries), axis=axis, start=geometries.ndim + ) + # create_collection acts on the inner axis + collections = lib.create_collection(geometries, GeometryType.GEOMETRYCOLLECTION) + return lib.coverage_union(collections, **kwargs) diff --git a/billinglayer/python/shapely/speedups.py b/billinglayer/python/shapely/speedups.py new file mode 100644 index 0000000..0f33d5a --- /dev/null +++ b/billinglayer/python/shapely/speedups.py @@ -0,0 +1,36 @@ +import warnings + +__all__ = ["available", "enable", "disable", "enabled"] + + +available = True +enabled = True + + +_MSG = ( + "This function has no longer any effect, and will be removed in a " + "future release. Starting with Shapely 2.0, equivalent speedups are " + "always available" +) + + +def enable(): + """ + This function has no longer any effect, and will be removed in a future + release. + + Previously, this function enabled cython-based speedups. Starting with + Shapely 2.0, equivalent speedups are available in every installation. + """ + warnings.warn(_MSG, DeprecationWarning, stacklevel=2) + + +def disable(): + """ + This function has no longer any effect, and will be removed in a future + release. + + Previously, this function enabled cython-based speedups. Starting with + Shapely 2.0, equivalent speedups are available in every installation. + """ + warnings.warn(_MSG, DeprecationWarning, stacklevel=2) diff --git a/billinglayer/python/shapely/strtree.py b/billinglayer/python/shapely/strtree.py new file mode 100644 index 0000000..d582cd5 --- /dev/null +++ b/billinglayer/python/shapely/strtree.py @@ -0,0 +1,544 @@ +from typing import Any, Iterable, Union + +import numpy as np + +from . import lib +from ._enum import ParamEnum +from .decorators import requires_geos, UnsupportedGEOSVersionError +from .geometry.base import BaseGeometry +from .predicates import is_empty, is_missing + +__all__ = ["STRtree"] + + +class BinaryPredicate(ParamEnum): + """The enumeration of GEOS binary predicates types""" + + intersects = 1 + within = 2 + contains = 3 + overlaps = 4 + crosses = 5 + touches = 6 + covers = 7 + covered_by = 8 + contains_properly = 9 + + +class STRtree: + """ + A query-only R-tree spatial index created using the + Sort-Tile-Recursive (STR) [1]_ algorithm. + + The tree indexes the bounding boxes of each geometry. The tree is + constructed directly at initialization and nodes cannot be added or + removed after it has been created. + + All operations return indices of the input geometries. These indices + can be used to index into anything associated with the input geometries, + including the input geometries themselves, or custom items stored in + another object of the same length as the geometries. + + Bounding boxes limited to two dimensions and are axis-aligned (equivalent to + the ``bounds`` property of a geometry); any Z values present in geometries + are ignored for purposes of indexing within the tree. + + Any mixture of geometry types may be stored in the tree. + + Note: the tree is more efficient for querying when there are fewer + geometries that have overlapping bounding boxes and where there is greater + similarity between the outer boundary of a geometry and its bounding box. + For example, a MultiPolygon composed of widely-spaced individual Polygons + will have a large overall bounding box compared to the boundaries of its + individual Polygons, and the bounding box may also potentially overlap many + other geometries within the tree. This means that the resulting tree may be + less efficient to query than a tree constructed from individual Polygons. + + Parameters + ---------- + geoms : sequence + A sequence of geometry objects. + node_capacity : int, default 10 + The maximum number of child nodes per parent node in the tree. + + References + ---------- + .. [1] Leutenegger, Scott T.; Edgington, Jeffrey M.; Lopez, Mario A. + (February 1997). "STR: A Simple and Efficient Algorithm for + R-Tree Packing". + https://ia600900.us.archive.org/27/items/nasa_techdoc_19970016975/19970016975.pdf + """ + + def __init__( + self, + geoms: Iterable[BaseGeometry], + node_capacity: int = 10, + ): + # Keep references to geoms in a copied array so that this array is not + # modified while the tree depends on it remaining the same + self._geometries = np.array(geoms, dtype=np.object_, copy=True) + + # initialize GEOS STRtree + self._tree = lib.STRtree(self.geometries, node_capacity) + + def __len__(self): + return self._tree.count + + def __reduce__(self): + return (STRtree, (self.geometries,)) + + @property + def geometries(self): + """ + Geometries stored in the tree in the order used to construct the tree. + + The order of this array corresponds to the tree indices returned by + other STRtree methods. + + Do not attempt to modify items in the returned array. + + Returns + ------- + ndarray of Geometry objects + """ + return self._geometries + + def query(self, geometry, predicate=None, distance=None): + """ + Return the integer indices of all combinations of each input geometry + and tree geometries where the bounding box of each input geometry + intersects the bounding box of a tree geometry. + + If the input geometry is a scalar, this returns an array of shape (n, ) with + the indices of the matching tree geometries. If the input geometry is an + array_like, this returns an array with shape (2,n) where the subarrays + correspond to the indices of the input geometries and indices of the + tree geometries associated with each. To generate an array of pairs of + input geometry index and tree geometry index, simply transpose the + result. + + If a predicate is provided, the tree geometries are first queried based + on the bounding box of the input geometry and then are further filtered + to those that meet the predicate when comparing the input geometry to + the tree geometry: + predicate(geometry, tree_geometry) + + The 'dwithin' predicate requires GEOS >= 3.10. + + Bounding boxes are limited to two dimensions and are axis-aligned + (equivalent to the ``bounds`` property of a geometry); any Z values + present in input geometries are ignored when querying the tree. + + Any input geometry that is None or empty will never match geometries in + the tree. + + Parameters + ---------- + geometry : Geometry or array_like + Input geometries to query the tree and filter results using the + optional predicate. + predicate : {None, 'intersects', 'within', 'contains', 'overlaps', 'crosses',\ +'touches', 'covers', 'covered_by', 'contains_properly', 'dwithin'}, optional + The predicate to use for testing geometries from the tree + that are within the input geometry's bounding box. + distance : number or array_like, optional + Distances around each input geometry within which to query the tree + for the 'dwithin' predicate. If array_like, shape must be + broadcastable to shape of geometry. Required if predicate='dwithin'. + + Returns + ------- + ndarray with shape (n,) if geometry is a scalar + Contains tree geometry indices. + + OR + + ndarray with shape (2, n) if geometry is an array_like + The first subarray contains input geometry indices. + The second subarray contains tree geometry indices. + + Examples + -------- + >>> from shapely import box, Point + >>> import numpy as np + >>> points = [Point(0, 0), Point(1, 1), Point(2,2), Point(3, 3)] + >>> tree = STRtree(points) + + Query the tree using a scalar geometry: + + >>> indices = tree.query(box(0, 0, 1, 1)) + >>> indices.tolist() + [0, 1] + + Query using an array of geometries: + + >>> boxes = np.array([box(0, 0, 1, 1), box(2, 2, 3, 3)]) + >>> arr_indices = tree.query(boxes) + >>> arr_indices.tolist() + [[0, 0, 1, 1], [0, 1, 2, 3]] + + Or transpose to get all pairs of input and tree indices: + + >>> arr_indices.T.tolist() + [[0, 0], [0, 1], [1, 2], [1, 3]] + + Retrieve the tree geometries by results of query: + + >>> tree.geometries.take(indices).tolist() + [, ] + + Retrieve all pairs of input and tree geometries: + + >>> np.array([boxes.take(arr_indices[0]),\ +tree.geometries.take(arr_indices[1])]).T.tolist() + [[, ], + [, ], + [, ], + [, ]] + + Query using a predicate: + + >>> tree = STRtree([box(0, 0, 0.5, 0.5), box(0.5, 0.5, 1, 1), box(1, 1, 2, 2)]) + >>> tree.query(box(0, 0, 1, 1), predicate="contains").tolist() + [0, 1] + >>> tree.query(Point(0.75, 0.75), predicate="dwithin", distance=0.5).tolist() + [0, 1, 2] + + >>> tree.query(boxes, predicate="contains").tolist() + [[0, 0], [0, 1]] + >>> tree.query(boxes, predicate="dwithin", distance=0.5).tolist() + [[0, 0, 0, 1], [0, 1, 2, 2]] + + Retrieve custom items associated with tree geometries (records can + be in whatever data structure so long as geometries and custom data + can be extracted into arrays of the same length and order): + + >>> records = [ + ... {"geometry": Point(0, 0), "value": "A"}, + ... {"geometry": Point(2, 2), "value": "B"} + ... ] + >>> tree = STRtree([record["geometry"] for record in records]) + >>> items = np.array([record["value"] for record in records]) + >>> items.take(tree.query(box(0, 0, 1, 1))).tolist() + ['A'] + + + Notes + ----- + In the context of a spatial join, input geometries are the "left" + geometries that determine the order of the results, and tree geometries + are "right" geometries that are joined against the left geometries. This + effectively performs an inner join, where only those combinations of + geometries that can be joined based on overlapping bounding boxes or + optional predicate are returned. + """ + + geometry = np.asarray(geometry) + is_scalar = False + if geometry.ndim == 0: + geometry = np.expand_dims(geometry, 0) + is_scalar = True + + if predicate is None: + indices = self._tree.query(geometry, 0) + return indices[1] if is_scalar else indices + + # Requires GEOS >= 3.10 + elif predicate == "dwithin": + if lib.geos_version < (3, 10, 0): + raise UnsupportedGEOSVersionError( + "dwithin predicate requires GEOS >= 3.10" + ) + if distance is None: + raise ValueError( + "distance parameter must be provided for dwithin predicate" + ) + distance = np.asarray(distance, dtype="float64") + if distance.ndim > 1: + raise ValueError("Distance array should be one dimensional") + + try: + distance = np.broadcast_to(distance, geometry.shape) + except ValueError: + raise ValueError("Could not broadcast distance to match geometry") + + indices = self._tree.dwithin(geometry, distance) + return indices[1] if is_scalar else indices + + predicate = BinaryPredicate.get_value(predicate) + indices = self._tree.query(geometry, predicate) + return indices[1] if is_scalar else indices + + @requires_geos("3.6.0") + def nearest(self, geometry) -> Union[Any, None]: + """ + Return the index of the nearest geometry in the tree for each input + geometry based on distance within two-dimensional Cartesian space. + + This distance will be 0 when input geometries intersect tree geometries. + + If there are multiple equidistant or intersected geometries in the tree, + only a single result is returned for each input geometry, based on the + order that tree geometries are visited; this order may be + nondeterministic. + + If any input geometry is None or empty, an error is raised. Any Z + values present in input geometries are ignored when finding nearest + tree geometries. + + Parameters + ---------- + geometry : Geometry or array_like + Input geometries to query the tree. + + Returns + ------- + scalar or ndarray + Indices of geometries in tree. Return value will have the same shape + as the input. + + None is returned if this index is empty. This may change in + version 2.0. + + See also + -------- + query_nearest: returns all equidistant geometries, exclusive geometries, \ +and optional distances + + Examples + -------- + >>> from shapely.geometry import Point + >>> tree = STRtree([Point(i, i) for i in range(10)]) + + Query the tree for nearest using a scalar geometry: + + >>> index = tree.nearest(Point(2.2, 2.2)) + >>> index + 2 + >>> tree.geometries.take(index) + + + Query the tree for nearest using an array of geometries: + + >>> indices = tree.nearest([Point(2.2, 2.2), Point(4.4, 4.4)]) + >>> indices.tolist() + [2, 4] + >>> tree.geometries.take(indices).tolist() + [, ] + + Nearest only return one object if there are multiple equidistant results: + + >>> tree = STRtree ([Point(0, 0), Point(0, 0)]) + >>> tree.nearest(Point(0, 0)) + 0 + """ + if self._tree.count == 0: + return None + + geometry_arr = np.asarray(geometry, dtype=object) + if is_missing(geometry_arr).any() or is_empty(geometry_arr).any(): + raise ValueError( + "Cannot determine nearest geometry for empty geometry or " + "missing value (None)." + ) + # _tree.nearest returns ndarray with shape (2, 1) -> index in input + # geometries and index into tree geometries + indices = self._tree.nearest(np.atleast_1d(geometry_arr))[1] + + if geometry_arr.ndim == 0: + return indices[0] + else: + return indices + + @requires_geos("3.6.0") + def query_nearest( + self, + geometry, + max_distance=None, + return_distance=False, + exclusive=False, + all_matches=True, + ): + """Return the index of the nearest geometries in the tree for each input + geometry based on distance within two-dimensional Cartesian space. + + This distance will be 0 when input geometries intersect tree geometries. + + If there are multiple equidistant or intersected geometries in tree and + `all_matches` is True (the default), all matching tree geometries are + returned; otherwise only the first matching tree geometry is returned. + Tree indices are returned in the order they are visited for each input + geometry and may not be in ascending index order; no meaningful order is + implied. + + The max_distance used to search for nearest items in the tree may have a + significant impact on performance by reducing the number of input + geometries that are evaluated for nearest items in the tree. Only those + input geometries with at least one tree geometry within +/- max_distance + beyond their envelope will be evaluated. However, using a large + max_distance may have a negative performance impact because many tree + geometries will be queried for each input geometry. + + The distance, if returned, will be 0 for any intersected geometries in + the tree. + + Any geometry that is None or empty in the input geometries is omitted + from the output. Any Z values present in input geometries are ignored + when finding nearest tree geometries. + + Parameters + ---------- + geometry : Geometry or array_like + Input geometries to query the tree. + max_distance : float, optional + Maximum distance within which to query for nearest items in tree. + Must be greater than 0. + return_distance : bool, default False + If True, will return distances in addition to indices. + exclusive : bool, default False + If True, the nearest tree geometries that are equal to the input + geometry will not be returned. + all_matches : bool, default True + If True, all equidistant and intersected geometries will be returned + for each input geometry. + If False, only the first nearest geometry will be returned. + + Returns + ------- + tree indices or tuple of (tree indices, distances) if geometry is a scalar + indices is an ndarray of shape (n, ) and distances (if present) an + ndarray of shape (n, ) + + OR + + indices or tuple of (indices, distances) + indices is an ndarray of shape (2,n) and distances (if present) an + ndarray of shape (n). + The first subarray of indices contains input geometry indices. + The second subarray of indices contains tree geometry indices. + + See also + -------- + nearest: returns singular nearest geometry for each input + + Examples + -------- + >>> import numpy as np + >>> from shapely import box, Point + >>> points = [Point(0, 0), Point(1, 1), Point(2,2), Point(3, 3)] + >>> tree = STRtree(points) + + Find the nearest tree geometries to a scalar geometry: + + >>> indices = tree.query_nearest(Point(0.25, 0.25)) + >>> indices.tolist() + [0] + + Retrieve the tree geometries by results of query: + + >>> tree.geometries.take(indices).tolist() + [] + + Find the nearest tree geometries to an array of geometries: + + >>> query_points = np.array([Point(2.25, 2.25), Point(1, 1)]) + >>> arr_indices = tree.query_nearest(query_points) + >>> arr_indices.tolist() + [[0, 1], [2, 1]] + + Or transpose to get all pairs of input and tree indices: + + >>> arr_indices.T.tolist() + [[0, 2], [1, 1]] + + Retrieve all pairs of input and tree geometries: + + >>> list(zip(query_points.take(arr_indices[0]), tree.geometries.take(arr_indices[1]))) + [(, ), (, )] + + All intersecting geometries in the tree are returned by default: + + >>> tree.query_nearest(box(1,1,3,3)).tolist() + [1, 2, 3] + + Set all_matches to False to to return a single match per input geometry: + + >>> tree.query_nearest(box(1,1,3,3), all_matches=False).tolist() + [1] + + Return the distance to each nearest tree geometry: + + >>> index, distance = tree.query_nearest(Point(0.5, 0.5), return_distance=True) + >>> index.tolist() + [0, 1] + >>> distance.round(4).tolist() + [0.7071, 0.7071] + + Return the distance for each input and nearest tree geometry for an array + of geometries: + + >>> indices, distance = tree.query_nearest([Point(0.5, 0.5), Point(1, 1)], return_distance=True) + >>> indices.tolist() + [[0, 0, 1], [0, 1, 1]] + >>> distance.round(4).tolist() + [0.7071, 0.7071, 0.0] + + Retrieve custom items associated with tree geometries (records can + be in whatever data structure so long as geometries and custom data + can be extracted into arrays of the same length and order): + + >>> records = [ + ... {"geometry": Point(0, 0), "value": "A"}, + ... {"geometry": Point(2, 2), "value": "B"} + ... ] + >>> tree = STRtree([record["geometry"] for record in records]) + >>> items = np.array([record["value"] for record in records]) + >>> items.take(tree.query_nearest(Point(0.5, 0.5))).tolist() + ['A'] + """ + + geometry = np.asarray(geometry, dtype=object) + is_scalar = False + if geometry.ndim == 0: + geometry = np.expand_dims(geometry, 0) + is_scalar = True + + if max_distance is not None: + if not np.isscalar(max_distance): + raise ValueError("max_distance parameter only accepts scalar values") + + if max_distance <= 0: + raise ValueError("max_distance must be greater than 0") + + # a distance of 0 means no max_distance is used + max_distance = max_distance or 0 + + if not np.isscalar(exclusive): + raise ValueError("exclusive parameter only accepts scalar values") + + if exclusive not in {True, False}: + raise ValueError("exclusive parameter must be boolean") + + if not np.isscalar(all_matches): + raise ValueError("all_matches parameter only accepts scalar values") + + if all_matches not in {True, False}: + raise ValueError("all_matches parameter must be boolean") + + results = self._tree.query_nearest( + geometry, max_distance, exclusive, all_matches + ) + + # output indices are shape (n, ) + if is_scalar: + if not return_distance: + return results[0][1] + + else: + return (results[0][1], results[1]) + + # output indices are shape (2, n) + if not return_distance: + return results[0] + + return results diff --git a/billinglayer/python/shapely/testing.py b/billinglayer/python/shapely/testing.py new file mode 100644 index 0000000..e98ac5a --- /dev/null +++ b/billinglayer/python/shapely/testing.py @@ -0,0 +1,204 @@ +from functools import partial + +import numpy as np + +import shapely + +__all__ = ["assert_geometries_equal"] + + +def _equals_exact_with_ndim(x, y, tolerance): + dimension_equals = shapely.get_coordinate_dimension( + x + ) == shapely.get_coordinate_dimension(y) + with np.errstate(invalid="ignore"): + # Suppress 'invalid value encountered in equals_exact' with nan coordinates + geometry_equals = shapely.equals_exact(x, y, tolerance=tolerance) + return dimension_equals & geometry_equals + + +def _replace_nan(arr): + return np.where(np.isnan(arr), 0.0, arr) + + +def _assert_nan_coords_same(x, y, tolerance, err_msg, verbose): + x, y = np.broadcast_arrays(x, y) + x_coords = shapely.get_coordinates(x, include_z=True) + y_coords = shapely.get_coordinates(y, include_z=True) + + # Check the shapes (condition is copied from numpy test_array_equal) + if x_coords.shape != y_coords.shape: + return False + + # Check NaN positional equality + x_id = np.isnan(x_coords) + y_id = np.isnan(y_coords) + if not (x_id == y_id).all(): + msg = build_err_msg( + [x, y], + err_msg + "\nx and y nan coordinate location mismatch:", + verbose=verbose, + ) + raise AssertionError(msg) + + # If this passed, replace NaN with a number to be able to use equals_exact + x_no_nan = shapely.transform(x, _replace_nan, include_z=True) + y_no_nan = shapely.transform(y, _replace_nan, include_z=True) + + return _equals_exact_with_ndim(x_no_nan, y_no_nan, tolerance=tolerance) + + +def _assert_none_same(x, y, err_msg, verbose): + x_id = shapely.is_missing(x) + y_id = shapely.is_missing(y) + + if not (x_id == y_id).all(): + msg = build_err_msg( + [x, y], + err_msg + "\nx and y None location mismatch:", + verbose=verbose, + ) + raise AssertionError(msg) + + # If there is a scalar, then here we know the array has the same + # flag as it everywhere, so we should return the scalar flag. + if x.ndim == 0: + return bool(x_id) + elif y.ndim == 0: + return bool(y_id) + else: + return y_id + + +def assert_geometries_equal( + x, + y, + tolerance=1e-7, + equal_none=True, + equal_nan=True, + normalize=False, + err_msg="", + verbose=True, +): + """Raises an AssertionError if two geometry array_like objects are not equal. + + Given two array_like objects, check that the shape is equal and all elements of + these objects are equal. An exception is raised at shape mismatch or conflicting + values. In contrast to the standard usage in shapely, no assertion is raised if + both objects have NaNs/Nones in the same positions. + + Parameters + ---------- + x : Geometry or array_like + y : Geometry or array_like + equal_none : bool, default True + Whether to consider None elements equal to other None elements. + equal_nan : bool, default True + Whether to consider nan coordinates as equal to other nan coordinates. + normalize : bool, default False + Whether to normalize geometries prior to comparison. + err_msg : str, optional + The error message to be printed in case of failure. + verbose : bool, optional + If True, the conflicting values are appended to the error message. + """ + __tracebackhide__ = True # Hide traceback for py.test + if normalize: + x = shapely.normalize(x) + y = shapely.normalize(y) + x = np.array(x, copy=False) + y = np.array(y, copy=False) + + is_scalar = x.ndim == 0 or y.ndim == 0 + + # Check the shapes (condition is copied from numpy test_array_equal) + if not (is_scalar or x.shape == y.shape): + msg = build_err_msg( + [x, y], + err_msg + f"\n(shapes {x.shape}, {y.shape} mismatch)", + verbose=verbose, + ) + raise AssertionError(msg) + + flagged = False + if equal_none: + flagged = _assert_none_same(x, y, err_msg, verbose) + + if not np.isscalar(flagged): + x, y = x[~flagged], y[~flagged] + # Only do the comparison if actual values are left + if x.size == 0: + return + elif flagged: + # no sense doing comparison if everything is flagged. + return + + is_equal = _equals_exact_with_ndim(x, y, tolerance=tolerance) + if is_scalar and not np.isscalar(is_equal): + is_equal = bool(is_equal[0]) + + if np.all(is_equal): + return + elif not equal_nan: + msg = build_err_msg( + [x, y], + err_msg + f"\nNot equal to tolerance {tolerance:g}", + verbose=verbose, + ) + raise AssertionError(msg) + + # Optionally refine failing elements if NaN should be considered equal + if not np.isscalar(is_equal): + x, y = x[~is_equal], y[~is_equal] + # Only do the NaN check if actual values are left + if x.size == 0: + return + elif is_equal: + # no sense in checking for NaN if everything is equal. + return + + is_equal = _assert_nan_coords_same(x, y, tolerance, err_msg, verbose) + if not np.all(is_equal): + msg = build_err_msg( + [x, y], + err_msg + f"\nNot equal to tolerance {tolerance:g}", + verbose=verbose, + ) + raise AssertionError(msg) + + +## BELOW A COPY FROM numpy.testing._private.utils (numpy version 1.20.2) + + +def build_err_msg( + arrays, + err_msg, + header="Geometries are not equal:", + verbose=True, + names=("x", "y"), + precision=8, +): + msg = ["\n" + header] + if err_msg: + if err_msg.find("\n") == -1 and len(err_msg) < 79 - len(header): + msg = [msg[0] + " " + err_msg] + else: + msg.append(err_msg) + if verbose: + for i, a in enumerate(arrays): + + if isinstance(a, np.ndarray): + # precision argument is only needed if the objects are ndarrays + r_func = partial(np.array_repr, precision=precision) + else: + r_func = repr + + try: + r = r_func(a) + except Exception as exc: + r = f"[repr failed for <{type(a).__name__}>: {exc}]" + if r.count("\n") > 3: + r = "\n".join(r.splitlines()[:3]) + r += "..." + msg.append(f" {names[i]}: {r}") + return "\n".join(msg) diff --git a/billinglayer/python/shapely/tests/__init__.py b/billinglayer/python/shapely/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/shapely/tests/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..26f3f7a Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/common.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/common.cpython-311.pyc new file mode 100644 index 0000000..49a063d Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/common.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_constructive.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_constructive.cpython-311.pyc new file mode 100644 index 0000000..115b9f0 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_constructive.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_coordinates.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_coordinates.cpython-311.pyc new file mode 100644 index 0000000..8a312ea Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_coordinates.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_creation.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_creation.cpython-311.pyc new file mode 100644 index 0000000..4baef47 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_creation.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_creation_indices.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_creation_indices.cpython-311.pyc new file mode 100644 index 0000000..852b3f8 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_creation_indices.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_geometry.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_geometry.cpython-311.pyc new file mode 100644 index 0000000..f95272a Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_geometry.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_io.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_io.cpython-311.pyc new file mode 100644 index 0000000..e1297c9 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_io.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_linear.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_linear.cpython-311.pyc new file mode 100644 index 0000000..8e2fd74 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_linear.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_measurement.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_measurement.cpython-311.pyc new file mode 100644 index 0000000..d005ce4 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_measurement.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_misc.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_misc.cpython-311.pyc new file mode 100644 index 0000000..ed25284 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_misc.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_plotting.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_plotting.cpython-311.pyc new file mode 100644 index 0000000..48d905f Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_plotting.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_predicates.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_predicates.cpython-311.pyc new file mode 100644 index 0000000..c45d2ec Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_predicates.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_ragged_array.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_ragged_array.cpython-311.pyc new file mode 100644 index 0000000..785f085 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_ragged_array.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_set_operations.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_set_operations.cpython-311.pyc new file mode 100644 index 0000000..04ebf18 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_set_operations.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_strtree.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_strtree.cpython-311.pyc new file mode 100644 index 0000000..bf3b036 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_strtree.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/__pycache__/test_testing.cpython-311.pyc b/billinglayer/python/shapely/tests/__pycache__/test_testing.cpython-311.pyc new file mode 100644 index 0000000..0031218 Binary files /dev/null and b/billinglayer/python/shapely/tests/__pycache__/test_testing.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/common.py b/billinglayer/python/shapely/tests/common.py new file mode 100644 index 0000000..14eb5c9 --- /dev/null +++ b/billinglayer/python/shapely/tests/common.py @@ -0,0 +1,78 @@ +from contextlib import contextmanager + +import numpy as np +import pytest + +import shapely + +shapely20_todo = pytest.mark.xfail( + strict=False, reason="Not yet implemented for Shapely 2.0" +) + +point_polygon_testdata = ( + shapely.points(np.arange(6), np.arange(6)), + shapely.box(2, 2, 4, 4), +) +point = shapely.Point(2, 3) +line_string = shapely.LineString([(0, 0), (1, 0), (1, 1)]) +linear_ring = shapely.LinearRing([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) +polygon = shapely.Polygon([(0, 0), (2, 0), (2, 2), (0, 2), (0, 0)]) +multi_point = shapely.MultiPoint([(0, 0), (1, 2)]) +multi_line_string = shapely.MultiLineString([[(0, 0), (1, 2)]]) +multi_polygon = shapely.multipolygons( + [ + [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], + [(2.1, 2.1), (2.2, 2.1), (2.2, 2.2), (2.1, 2.2), (2.1, 2.1)], + ] +) +geometry_collection = shapely.GeometryCollection( + [shapely.Point(51, -1), shapely.LineString([(52, -1), (49, 2)])] +) +point_z = shapely.Point(2, 3, 4) +line_string_z = shapely.LineString([(0, 0, 4), (1, 0, 4), (1, 1, 4)]) +polygon_z = shapely.Polygon([(0, 0, 4), (2, 0, 4), (2, 2, 4), (0, 2, 4), (0, 0, 4)]) +geometry_collection_z = shapely.GeometryCollection([point_z, line_string_z]) +polygon_with_hole = shapely.Polygon( + [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], +) +empty_point = shapely.from_wkt("POINT EMPTY") +empty_point_z = shapely.from_wkt("POINT Z EMPTY") +empty_line_string = shapely.from_wkt("LINESTRING EMPTY") +empty_line_string_z = shapely.from_wkt("LINESTRING Z EMPTY") +empty_polygon = shapely.from_wkt("POLYGON EMPTY") +empty = shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") +line_string_nan = shapely.LineString([(np.nan, np.nan), (np.nan, np.nan)]) +multi_point_z = shapely.MultiPoint([(0, 0, 4), (1, 2, 4)]) +multi_line_string_z = shapely.MultiLineString([[(0, 0, 4), (1, 2, 4)]]) +multi_polygon_z = shapely.multipolygons( + [ + [(0, 0, 4), (1, 0, 4), (1, 1, 4), (0, 1, 4), (0, 0, 4)], + [(2.1, 2.1, 4), (2.2, 2.1, 4), (2.2, 2.2, 4), (2.1, 2.2, 4), (2.1, 2.1, 4)], + ] +) +polygon_with_hole_z = shapely.Polygon( + [(0, 0, 4), (0, 10, 4), (10, 10, 4), (10, 0, 4), (0, 0, 4)], + holes=[[(2, 2, 4), (2, 4, 4), (4, 4, 4), (4, 2, 4), (2, 2, 4)]], +) + +all_types = ( + point, + line_string, + linear_ring, + polygon, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + empty, +) + + +@contextmanager +def ignore_invalid(condition=True): + if condition: + with np.errstate(invalid="ignore"): + yield + else: + yield diff --git a/billinglayer/python/shapely/tests/geometry/__init__.py b/billinglayer/python/shapely/tests/geometry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e38643b Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_collection.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_collection.cpython-311.pyc new file mode 100644 index 0000000..c47f6c8 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_collection.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_coords.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_coords.cpython-311.pyc new file mode 100644 index 0000000..d569e09 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_coords.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_decimal.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_decimal.cpython-311.pyc new file mode 100644 index 0000000..a3d9671 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_decimal.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_emptiness.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_emptiness.cpython-311.pyc new file mode 100644 index 0000000..378dc7b Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_emptiness.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_format.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_format.cpython-311.pyc new file mode 100644 index 0000000..d9bb778 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_format.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_geometry_base.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_geometry_base.cpython-311.pyc new file mode 100644 index 0000000..758ad81 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_geometry_base.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_hash.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_hash.cpython-311.pyc new file mode 100644 index 0000000..f1ccd10 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_hash.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_linestring.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_linestring.cpython-311.pyc new file mode 100644 index 0000000..440cb67 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_linestring.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_multi.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multi.cpython-311.pyc new file mode 100644 index 0000000..f35149f Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multi.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_multilinestring.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multilinestring.cpython-311.pyc new file mode 100644 index 0000000..3c28739 Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multilinestring.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_multipoint.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multipoint.cpython-311.pyc new file mode 100644 index 0000000..f1db6de Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multipoint.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_multipolygon.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multipolygon.cpython-311.pyc new file mode 100644 index 0000000..0ef9a0a Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_multipolygon.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_point.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_point.cpython-311.pyc new file mode 100644 index 0000000..c8c6fad Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_point.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/__pycache__/test_polygon.cpython-311.pyc b/billinglayer/python/shapely/tests/geometry/__pycache__/test_polygon.cpython-311.pyc new file mode 100644 index 0000000..227045f Binary files /dev/null and b/billinglayer/python/shapely/tests/geometry/__pycache__/test_polygon.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/tests/geometry/test_collection.py b/billinglayer/python/shapely/tests/geometry/test_collection.py new file mode 100644 index 0000000..606a667 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_collection.py @@ -0,0 +1,82 @@ +import numpy as np +import pytest + +from shapely import GeometryCollection, LineString, Point, wkt +from shapely.geometry import shape + + +@pytest.fixture() +def geometrycollection_geojson(): + return { + "type": "GeometryCollection", + "geometries": [ + {"type": "Point", "coordinates": (0, 3, 0)}, + {"type": "LineString", "coordinates": ((2, 0), (1, 0))}, + ], + } + + +@pytest.mark.parametrize( + "geom", + [ + GeometryCollection(), + shape({"type": "GeometryCollection", "geometries": []}), + wkt.loads("GEOMETRYCOLLECTION EMPTY"), + ], +) +def test_empty(geom): + assert geom.geom_type == "GeometryCollection" + assert geom.is_empty + assert len(geom.geoms) == 0 + assert list(geom.geoms) == [] + + +def test_empty_subgeoms(): + geom = GeometryCollection([Point(), LineString()]) + assert geom.geom_type == "GeometryCollection" + assert geom.is_empty + assert len(geom.geoms) == 2 + assert list(geom.geoms) == [Point(), LineString()] + + +def test_child_with_deleted_parent(): + # test that we can remove a collection while keeping + # children around + a = LineString([(0, 0), (1, 1), (1, 2), (2, 2)]) + b = LineString([(0, 0), (1, 1), (2, 1), (2, 2)]) + collection = a.intersection(b) + + child = collection.geoms[0] + # delete parent of child + del collection + + # access geometry, this should not seg fault as 1.2.15 did + assert child.wkt is not None + + +def test_from_geojson(geometrycollection_geojson): + geom = shape(geometrycollection_geojson) + assert geom.geom_type == "GeometryCollection" + assert len(geom.geoms) == 2 + + geom_types = [g.geom_type for g in geom.geoms] + assert "Point" in geom_types + assert "LineString" in geom_types + + +def test_geointerface(geometrycollection_geojson): + geom = shape(geometrycollection_geojson) + assert geom.__geo_interface__ == geometrycollection_geojson + + +def test_len_raises(geometrycollection_geojson): + geom = shape(geometrycollection_geojson) + with pytest.raises(TypeError): + len(geom) + + +def test_numpy_object_array(): + geom = GeometryCollection([LineString([(0, 0), (1, 1)])]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/billinglayer/python/shapely/tests/geometry/test_coords.py b/billinglayer/python/shapely/tests/geometry/test_coords.py new file mode 100644 index 0000000..6aa0d41 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_coords.py @@ -0,0 +1,86 @@ +import numpy as np +import pytest + +from shapely import LineString + + +class TestCoords: + """ + Shapely assumes contiguous C-order float64 data for internal ops. + Data should be converted to contiguous float64 if numpy exists. + c9a0707 broke this a little bit. + """ + + def test_data_promotion(self): + coords = np.array([[12, 34], [56, 78]], dtype=np.float32) + processed_coords = np.array(LineString(coords).coords) + + assert coords.tolist() == processed_coords.tolist() + + def test_data_destriding(self): + coords = np.array([[12, 34], [56, 78]], dtype=np.float32) + + # Easy way to introduce striding: reverse list order + processed_coords = np.array(LineString(coords[::-1]).coords) + + assert coords[::-1].tolist() == processed_coords.tolist() + + +class TestCoordsGetItem: + def test_index_2d_coords(self): + c = [(float(x), float(-x)) for x in range(4)] + g = LineString(c) + for i in range(-4, 4): + assert g.coords[i] == c[i] + with pytest.raises(IndexError): + g.coords[4] + with pytest.raises(IndexError): + g.coords[-5] + + def test_index_3d_coords(self): + c = [(float(x), float(-x), float(x * 2)) for x in range(4)] + g = LineString(c) + for i in range(-4, 4): + assert g.coords[i] == c[i] + with pytest.raises(IndexError): + g.coords[4] + with pytest.raises(IndexError): + g.coords[-5] + + def test_index_coords_misc(self): + g = LineString() # empty + with pytest.raises(IndexError): + g.coords[0] + with pytest.raises(TypeError): + g.coords[0.0] + + def test_slice_2d_coords(self): + c = [(float(x), float(-x)) for x in range(4)] + g = LineString(c) + assert g.coords[1:] == c[1:] + assert g.coords[:-1] == c[:-1] + assert g.coords[::-1] == c[::-1] + assert g.coords[::2] == c[::2] + assert g.coords[:4] == c[:4] + assert g.coords[4:] == c[4:] == [] + + def test_slice_3d_coords(self): + c = [(float(x), float(-x), float(x * 2)) for x in range(4)] + g = LineString(c) + assert g.coords[1:] == c[1:] + assert g.coords[:-1] == c[:-1] + assert g.coords[::-1] == c[::-1] + assert g.coords[::2] == c[::2] + assert g.coords[:4] == c[:4] + assert g.coords[4:] == c[4:] == [] + + +class TestXY: + """New geometry/coordseq method 'xy' makes numpy interop easier""" + + def test_arrays(self): + x, y = LineString([(0, 0), (1, 1)]).xy + assert len(x) == 2 + assert list(x) == [0.0, 1.0] + assert len(y) == 2 + assert list(y) == [0.0, 1.0] diff --git a/billinglayer/python/shapely/tests/geometry/test_decimal.py b/billinglayer/python/shapely/tests/geometry/test_decimal.py new file mode 100644 index 0000000..7c4317b --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_decimal.py @@ -0,0 +1,117 @@ +from decimal import Decimal + +import pytest + +from shapely import ( + GeometryCollection, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) + +items2d = [ + [(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)], + [(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)], +] + +items2d_mixed = [ + [ + (Decimal(0.0), Decimal(0.0)), + (Decimal(70.0), 120.0), + (140.0, Decimal(0.0)), + (0.0, 0.0), + ], + [ + (Decimal(60.0), Decimal(80.0)), + (Decimal(80.0), 80.0), + (70.0, Decimal(60.0)), + (60.0, 80.0), + ], +] + +items2d_decimal = [ + [ + (Decimal(0.0), Decimal(0.0)), + (Decimal(70.0), Decimal(120.0)), + (Decimal(140.0), Decimal(0.0)), + (Decimal(0.0), Decimal(0.0)), + ], + [ + (Decimal(60.0), Decimal(80.0)), + (Decimal(80.0), Decimal(80.0)), + (Decimal(70.0), Decimal(60.0)), + (Decimal(60.0), Decimal(80.0)), + ], +] + +items3d = [ + [(0.0, 0.0, 1), (70.0, 120.0, 2), (140.0, 0.0, 3), (0.0, 0.0, 1)], + [(60.0, 80.0, 1), (80.0, 80.0, 2), (70.0, 60.0, 3), (60.0, 80.0, 1)], +] + +items3d_mixed = [ + [ + (Decimal(0.0), Decimal(0.0), Decimal(1)), + (Decimal(70.0), 120.0, Decimal(2)), + (140.0, Decimal(0.0), 3), + (0.0, 0.0, 1), + ], + [ + (Decimal(60.0), Decimal(80.0), Decimal(1)), + (Decimal(80.0), 80.0, 2), + (70.0, Decimal(60.0), Decimal(3)), + (60.0, 80.0, 1), + ], +] + +items3d_decimal = [ + [ + (Decimal(0.0), Decimal(0.0), Decimal(1)), + (Decimal(70.0), Decimal(120.0), Decimal(2)), + (Decimal(140.0), Decimal(0.0), Decimal(3)), + (Decimal(0.0), Decimal(0.0), Decimal(1)), + ], + [ + (Decimal(60.0), Decimal(80.0), Decimal(1)), + (Decimal(80.0), Decimal(80.0), Decimal(2)), + (Decimal(70.0), Decimal(60.0), Decimal(3)), + (Decimal(60.0), Decimal(80.0), Decimal(1)), + ], +] + +all_geoms = [ + [ + Point(items[0][0]), + Point(*items[0][0]), + MultiPoint(items[0]), + LinearRing(items[0]), + LineString(items[0]), + MultiLineString(items), + Polygon(items[0]), + MultiPolygon( + [ + Polygon(items[1]), + Polygon(items[0], holes=items[1:]), + ] + ), + GeometryCollection([Point(items[0][0]), Polygon(items[0])]), + ] + for items in [ + items2d, + items2d_mixed, + items2d_decimal, + items3d, + items3d_mixed, + items3d_decimal, + ] +] + + +@pytest.mark.parametrize("geoms", list(zip(*all_geoms))) +def test_decimal(geoms): + assert geoms[0] == geoms[1] == geoms[2] + assert geoms[3] == geoms[4] == geoms[5] diff --git a/billinglayer/python/shapely/tests/geometry/test_emptiness.py b/billinglayer/python/shapely/tests/geometry/test_emptiness.py new file mode 100644 index 0000000..005b2b8 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_emptiness.py @@ -0,0 +1,98 @@ +import math + +import numpy as np +import pytest + +from shapely import ( + GeometryCollection, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) +from shapely.geometry import mapping, shape +from shapely.geometry.base import BaseGeometry, EmptyGeometry + + +def empty_generator(): + return iter([]) + + +class TestEmptiness: + def test_empty_class(self): + with pytest.warns(FutureWarning): + g = EmptyGeometry() + assert g.is_empty + + def test_empty_base(self): + with pytest.warns(FutureWarning): + g = BaseGeometry() + assert g.is_empty + + def test_empty_point(self): + assert Point().is_empty + + def test_empty_multipoint(self): + assert MultiPoint().is_empty + + def test_empty_geometry_collection(self): + assert GeometryCollection().is_empty + + def test_empty_linestring(self): + assert LineString().is_empty + assert LineString(None).is_empty + assert LineString([]).is_empty + assert LineString(empty_generator()).is_empty + + def test_empty_multilinestring(self): + assert MultiLineString([]).is_empty + + def test_empty_polygon(self): + assert Polygon().is_empty + assert Polygon(None).is_empty + assert Polygon([]).is_empty + assert Polygon(empty_generator()).is_empty + + def test_empty_multipolygon(self): + assert MultiPolygon([]).is_empty + + def test_empty_linear_ring(self): + assert LinearRing().is_empty + assert LinearRing(None).is_empty + assert LinearRing([]).is_empty + assert LinearRing(empty_generator()).is_empty + + +def test_numpy_object_array(): + geoms = [Point(), GeometryCollection()] + arr = np.empty(2, object) + arr[:] = geoms + + +def test_shape_empty(): + empty_mp = MultiPolygon() + empty_json = mapping(empty_mp) + empty_shape = shape(empty_json) + assert empty_shape.is_empty + + +@pytest.mark.parametrize( + "geom", + [ + Point(), + LineString(), + Polygon(), + MultiPoint(), + MultiLineString(), + MultiPolygon(), + GeometryCollection(), + LinearRing(), + ], +) +def test_empty_geometry_bounds(geom): + """The bounds of an empty geometry is a tuple of NaNs""" + assert len(geom.bounds) == 4 + assert all(math.isnan(v) for v in geom.bounds) diff --git a/billinglayer/python/shapely/tests/geometry/test_format.py b/billinglayer/python/shapely/tests/geometry/test_format.py new file mode 100644 index 0000000..6ae61a3 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_format.py @@ -0,0 +1,111 @@ +import pytest + +from shapely import Point, Polygon +from shapely.geos import geos_version + + +def test_format_invalid(): + # check invalid spec formats + pt = Point(1, 2) + test_list = [ + ("5G", ValueError, "invalid format specifier"), + (".f", ValueError, "invalid format specifier"), + ("0.2e", ValueError, "invalid format specifier"), + (".1x", ValueError, "hex representation does not specify precision"), + ] + for format_spec, err, match in test_list: + with pytest.raises(err, match=match): + format(pt, format_spec) + + +def test_format_point(): + # example coordinate data + xy1 = (0.12345678901234567, 1.2345678901234567e10) + xy2 = (-169.910918, -18.997564) + xyz3 = (630084, 4833438, 76) + + # list of tuples to test; see structure at top of the for-loop + test_list = [ + (".0f", xy1, "POINT (0 12345678901)", True), + (".1f", xy1, "POINT (0.1 12345678901.2)", True), + ("0.2f", xy2, "POINT (-169.91 -19.00)", True), + (".3F", (float("inf"), -float("inf")), "POINT (INF -INF)", True), + ] + if geos_version < (3, 10, 0): + # 'g' format varies depending on GEOS version + test_list += [ + (".1g", xy1, "POINT (0.1 1e+10)", True), + (".6G", xy1, "POINT (0.123457 1.23457E+10)", True), + ("0.12g", xy1, "POINT (0.123456789012 12345678901.2)", True), + ("0.4g", xy2, "POINT (-169.9 -19)", True), + ] + else: + test_list += [ + (".1g", xy1, "POINT (0.1 12345678901.2)", False), + (".6G", xy1, "POINT (0.123457 12345678901.234568)", False), + ("0.12g", xy1, "POINT (0.123456789012 12345678901.234568)", False), + ("g", xy2, "POINT (-169.910918 -18.997564)", False), + ("0.2g", xy2, "POINT (-169.91 -19)", False), + ] + # without precsions test GEOS rounding_precision=-1; different than Python + test_list += [ + ("f", (1, 2), f"POINT ({1:.16f} {2:.16f})", False), + ("F", xyz3, "POINT Z ({:.16f} {:.16f} {:.16f})".format(*xyz3), False), + ("g", xyz3, "POINT Z (630084 4833438 76)", False), + ] + for format_spec, coords, expt_wkt, same_python_float in test_list: + pt = Point(*coords) + # basic checks + assert f"{pt}" == pt.wkt + assert format(pt, "") == pt.wkt + assert format(pt, "x") == pt.wkb_hex.lower() + assert format(pt, "X") == pt.wkb_hex + # check formatted WKT to expected + assert format(pt, format_spec) == expt_wkt, format_spec + # check Python's format consistency + text_coords = expt_wkt[expt_wkt.index("(") + 1 : expt_wkt.index(")")] + is_same = [] + for coord, expt_coord in zip(coords, text_coords.split()): + py_fmt_float = format(float(coord), format_spec) + if same_python_float: + assert py_fmt_float == expt_coord, format_spec + else: + is_same.append(py_fmt_float == expt_coord) + if not same_python_float: + assert not all(is_same), f"{format_spec!r} with {expt_wkt}" + + +def test_format_polygon(): + # check basic cases + poly = Point(0, 0).buffer(10, 2) + assert f"{poly}" == poly.wkt + assert format(poly, "") == poly.wkt + assert format(poly, "x") == poly.wkb_hex.lower() + assert format(poly, "X") == poly.wkb_hex + + # Use f-strings with extra characters and rounding precision + assert f"<{poly:.2f}>" == ( + "" + ) + + # 'g' format varies depending on GEOS version + if geos_version < (3, 10, 0): + expected_2G = ( + "POLYGON ((10 0, 7.1 -7.1, 1.6E-14 -10, -7.1 -7.1, " + "-10 -3.2E-14, -7.1 7.1, -4.6E-14 10, 7.1 7.1, 10 0))" + ) + else: + expected_2G = ( + "POLYGON ((10 0, 7.07 -7.07, 0 -10, -7.07 -7.07, " + "-10 0, -7.07 7.07, 0 10, 7.07 7.07, 10 0))" + ) + assert f"{poly:.2G}" == expected_2G + + # check empty + empty = Polygon() + assert f"{empty}" == "POLYGON EMPTY" + assert format(empty, "") == empty.wkt + assert format(empty, ".2G") == empty.wkt + assert format(empty, "x") == empty.wkb_hex.lower() + assert format(empty, "X") == empty.wkb_hex diff --git a/billinglayer/python/shapely/tests/geometry/test_geometry_base.py b/billinglayer/python/shapely/tests/geometry/test_geometry_base.py new file mode 100644 index 0000000..526f6ea --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_geometry_base.py @@ -0,0 +1,274 @@ +import platform +import weakref + +import numpy as np +import pytest + +import shapely +from shapely import ( + GeometryCollection, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) +from shapely.errors import ShapelyDeprecationWarning +from shapely.testing import assert_geometries_equal + + +def test_polygon(): + assert bool(Polygon()) is False + + +def test_linestring(): + assert bool(LineString()) is False + + +def test_point(): + assert bool(Point()) is False + + +def test_geometry_collection(): + assert bool(GeometryCollection()) is False + + +geometries_all_types = [ + Point(1, 1), + LinearRing([(0, 0), (1, 1), (0, 1), (0, 0)]), + LineString([(0, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(0, 0), (1, 1), (0, 1), (0, 0)]), + MultiPoint([(1, 1)]), + MultiLineString([[(0, 0), (1, 1), (0, 1), (0, 0)]]), + MultiPolygon([Polygon([(0, 0), (1, 1), (0, 1), (0, 0)])]), + GeometryCollection([Point(1, 1)]), +] + + +@pytest.mark.skipif( + platform.python_implementation() == "PyPy", + reason="Setting custom attributes doesn't fail on PyPy", +) +@pytest.mark.parametrize("geom", geometries_all_types) +def test_setattr_disallowed(geom): + with pytest.raises(AttributeError): + geom.name = "test" + + +@pytest.mark.parametrize("geom", geometries_all_types) +def test_weakrefable(geom): + _ = weakref.ref(geom) + + +@pytest.mark.parametrize("geom", geometries_all_types) +def test_comparison_notimplemented(geom): + # comparing to a non-geometry class should return NotImplemented in __eq__ + # to ensure proper delegation to other (eg to ensure comparison of scalar + # with array works) + # https://github.com/shapely/shapely/issues/1056 + assert geom.__eq__(1) is NotImplemented + + # with array + arr = np.array([geom, geom], dtype=object) + + result = arr == geom + assert isinstance(result, np.ndarray) + assert result.all() + + result = geom == arr + assert isinstance(result, np.ndarray) + assert result.all() + + result = arr != geom + assert isinstance(result, np.ndarray) + assert not result.any() + + result = geom != arr + assert isinstance(result, np.ndarray) + assert not result.any() + + +def test_base_class_not_callable(): + with pytest.raises(TypeError): + shapely.Geometry("POINT (1 1)") + + +def test_GeometryType_deprecated(): + geom = Point(1, 1) + + with pytest.warns(ShapelyDeprecationWarning): + geom_type = geom.geometryType() + + assert geom_type == geom.geom_type + + +def test_type_deprecated(): + geom = Point(1, 1) + + with pytest.warns(ShapelyDeprecationWarning): + geom_type = geom.type + + assert geom_type == geom.geom_type + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_segmentize(): + line = LineString([(0, 0), (0, 10)]) + result = line.segmentize(max_segment_length=5) + assert result.equals(LineString([(0, 0), (0, 5), (0, 10)])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_reverse(): + coords = [(0, 0), (1, 2)] + line = LineString(coords) + result = line.reverse() + assert result.coords[:] == coords[::-1] + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize( + "op", ["union", "intersection", "difference", "symmetric_difference"] +) +@pytest.mark.parametrize("grid_size", [0, 1, 2]) +def test_binary_op_grid_size(op, grid_size): + geom1 = shapely.box(0, 0, 2.5, 2.5) + geom2 = shapely.box(2, 2, 3, 3) + + result = getattr(geom1, op)(geom2, grid_size=grid_size) + expected = getattr(shapely, op)(geom1, geom2, grid_size=grid_size) + assert result == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_dwithin(): + point = Point(1, 1) + line = LineString([(0, 0), (0, 10)]) + assert point.dwithin(line, 0.5) is False + assert point.dwithin(line, 1.5) is True + + +def test_contains_properly(): + polygon = Polygon([(0, 0), (10, 10), (10, -10)]) + line = LineString([(0, 0), (10, 0)]) + assert polygon.contains_properly(line) is False + assert polygon.contains(line) is True + + +@pytest.mark.parametrize( + "op", ["convex_hull", "envelope", "oriented_envelope", "minimum_rotated_rectangle"] +) +def test_constructive_properties(op): + geom = LineString([(0, 0), (0, 10), (10, 10)]) + result = getattr(geom, op) + expected = getattr(shapely, op)(geom) + assert result == expected + + +@pytest.mark.parametrize( + "op", + [ + "crosses", + "contains", + "contains_properly", + "covered_by", + "covers", + "disjoint", + "equals", + "intersects", + "overlaps", + "touches", + "within", + ], +) +def test_array_argument_binary_predicates(op): + polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + + result = getattr(polygon, op)(points) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(polygon, op)(p) for p in points], dtype=bool) + np.testing.assert_array_equal(result, expected) + + +@pytest.mark.parametrize( + "op, kwargs", + [ + pytest.param( + "dwithin", + dict(distance=0.5), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10" + ), + ), + ("equals_exact", dict(tolerance=0.01)), + ("relate_pattern", dict(pattern="T*F**F***")), + ], +) +def test_array_argument_binary_predicates2(op, kwargs): + polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + + result = getattr(polygon, op)(points, **kwargs) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(polygon, op)(p, **kwargs) for p in points], dtype=bool) + np.testing.assert_array_equal(result, expected) + + +@pytest.mark.parametrize( + "op", + [ + "difference", + "intersection", + "symmetric_difference", + "union", + ], +) +def test_array_argument_binary_geo(op): + box = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + polygons = shapely.buffer(shapely.points([(0, 0), (0.5, 0.5), (1, 1)]), 0.5) + + result = getattr(box, op)(polygons) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(box, op)(g) for g in polygons], dtype=object) + assert_geometries_equal(result, expected) + + +@pytest.mark.parametrize("op", ["distance", "hausdorff_distance"]) +def test_array_argument_float(op): + polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + + result = getattr(polygon, op)(points) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(polygon, op)(p) for p in points], dtype="float64") + np.testing.assert_array_equal(result, expected) + + +def test_array_argument_linear(): + line = LineString([(0, 0), (0, 1), (1, 1)]) + distances = np.array([0, 0.5, 1]) + result = line.line_interpolate_point(distances) + assert isinstance(result, np.ndarray) + expected = np.array( + [line.line_interpolate_point(d) for d in distances], dtype=object + ) + assert_geometries_equal(result, expected) + + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + result = line.line_locate_point(points) + assert isinstance(result, np.ndarray) + expected = np.array([line.line_locate_point(p) for p in points], dtype="float64") + np.testing.assert_array_equal(result, expected) + + +def test_array_argument_buffer(): + point = Point(1, 1) + distances = np.array([0, 0.5, 1]) + + result = point.buffer(distances) + assert isinstance(result, np.ndarray) + expected = np.array([point.buffer(d) for d in distances], dtype=object) + assert_geometries_equal(result, expected) diff --git a/billinglayer/python/shapely/tests/geometry/test_hash.py b/billinglayer/python/shapely/tests/geometry/test_hash.py new file mode 100644 index 0000000..f54f885 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_hash.py @@ -0,0 +1,28 @@ +import pytest + +import shapely +from shapely.affinity import translate +from shapely.geometry import GeometryCollection, LineString, MultiPoint, Point + + +@pytest.mark.parametrize( + "geom", + [ + Point(1, 2), + MultiPoint([(1, 2), (3, 4)]), + LineString([(1, 2), (3, 4)]), + Point(0, 0).buffer(1.0), + GeometryCollection([Point(1, 2), LineString([(1, 2), (3, 4)])]), + ], + ids=[ + "Point", + "MultiPoint", + "LineString", + "Polygon", + "GeometryCollection", + ], +) +def test_hash(geom): + h1 = hash(geom) + assert h1 == hash(shapely.from_wkb(geom.wkb)) + assert h1 != hash(translate(geom, 1.0, 2.0)) diff --git a/billinglayer/python/shapely/tests/geometry/test_linestring.py b/billinglayer/python/shapely/tests/geometry/test_linestring.py new file mode 100644 index 0000000..adf0ec2 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_linestring.py @@ -0,0 +1,213 @@ +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, LineString, Point +from shapely.coords import CoordinateSequence + + +def test_from_coordinate_sequence(): + # From coordinate tuples + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + assert len(line.coords) == 2 + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_from_coordinate_sequence_3D(): + line = LineString([(1.0, 2.0, 3.0), (3.0, 4.0, 5.0)]) + assert line.has_z + assert line.coords[:] == [(1.0, 2.0, 3.0), (3.0, 4.0, 5.0)] + + +def test_from_points(): + # From Points + line = LineString([Point(1.0, 2.0), Point(3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + line = LineString([Point(1.0, 2.0), Point(3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_from_mix(): + # From mix of tuples and Points + line = LineString([Point(1.0, 2.0), (2.0, 3.0), Point(3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (2.0, 3.0), (3.0, 4.0)] + + +def test_from_linestring(): + # From another linestring + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + copy = LineString(line) + assert copy.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + assert copy.geom_type == "LineString" + + +def test_from_linearring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + ring = LinearRing(coords) + copy = LineString(ring) + assert copy.coords[:] == coords + assert copy.geom_type == "LineString" + + +def test_from_linestring_z(): + coords = [(1.0, 2.0, 3.0), (4.0, 5.0, 6.0)] + line = LineString(coords) + copy = LineString(line) + assert copy.coords[:] == coords + assert copy.geom_type == "LineString" + + +def test_from_generator(): + gen = (coord for coord in [(1.0, 2.0), (3.0, 4.0)]) + line = LineString(gen) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_from_empty(): + line = LineString() + assert line.is_empty + assert isinstance(line.coords, CoordinateSequence) + assert line.coords[:] == [] + + line = LineString([]) + assert line.is_empty + assert isinstance(line.coords, CoordinateSequence) + assert line.coords[:] == [] + + +def test_from_numpy(): + # Construct from a numpy array + line = LineString(np.array([[1.0, 2.0], [3.0, 4.0]])) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_numpy_empty_linestring_coords(): + # Check empty + line = LineString([]) + la = np.asarray(line.coords) + + assert la.shape == (0, 2) + + +def test_numpy_object_array(): + geom = LineString([(0.0, 0.0), (0.0, 1.0)]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom + + +@pytest.mark.filterwarnings("ignore:Creating an ndarray from ragged nested sequences:") +def test_from_invalid_dim(): + # TODO(shapely-2.0) better error message? + # pytest.raises(ValueError, match="at least 2 coordinate tuples|at least 2 coordinates"): + with pytest.raises(shapely.GEOSException): + LineString([(1, 2)]) + + # exact error depends on numpy version + with pytest.raises((ValueError, TypeError)): + LineString([(1, 2, 3), (4, 5)]) + + with pytest.raises((ValueError, TypeError)): + LineString([(1, 2), (3, 4, 5)]) + + msg = r"The ordinate \(last\) dimension should be 2 or 3, got {}" + with pytest.raises(ValueError, match=msg.format(4)): + LineString([(1, 2, 3, 4), (4, 5, 6, 7)]) + + with pytest.raises(ValueError, match=msg.format(1)): + LineString([(1,), (4,)]) + + +def test_from_single_coordinate(): + """Test for issue #486""" + coords = [[-122.185933073564, 37.3629353839073]] + with pytest.raises(shapely.GEOSException): + ls = LineString(coords) + ls.geom_type # caused segfault before fix + + +class TestLineString: + def test_linestring(self): + + # From coordinate tuples + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + assert len(line.coords) == 2 + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + # Bounds + assert line.bounds == (1.0, 2.0, 3.0, 4.0) + + # Coordinate access + assert tuple(line.coords) == ((1.0, 2.0), (3.0, 4.0)) + assert line.coords[0] == (1.0, 2.0) + assert line.coords[1] == (3.0, 4.0) + with pytest.raises(IndexError): + line.coords[2] # index out of range + + # Geo interface + assert line.__geo_interface__ == { + "type": "LineString", + "coordinates": ((1.0, 2.0), (3.0, 4.0)), + } + + def test_linestring_empty(self): + # Test Non-operability of Null geometry + l_null = LineString() + assert l_null.wkt == "LINESTRING EMPTY" + assert l_null.length == 0.0 + + def test_equals_argument_order(self): + """ + Test equals predicate functions correctly regardless of the order + of the inputs. See issue #317. + """ + coords = ((0, 0), (1, 0), (1, 1), (0, 0)) + ls = LineString(coords) + lr = LinearRing(coords) + + assert ls.__eq__(lr) is False # previously incorrectly returned True + assert lr.__eq__(ls) is False + assert (ls == lr) is False + assert (lr == ls) is False + + ls_clone = LineString(coords) + lr_clone = LinearRing(coords) + + assert ls.__eq__(ls_clone) is True + assert lr.__eq__(lr_clone) is True + assert (ls == ls_clone) is True + assert (lr == lr_clone) is True + + def test_numpy_linestring_coords(self): + from numpy.testing import assert_array_equal + + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + expected = np.array([[1.0, 2.0], [3.0, 4.0]]) + + # Coordinate sequences can be adapted as well + la = np.asarray(line.coords) + assert_array_equal(la, expected) + + +def test_linestring_immutable(): + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + + with pytest.raises(AttributeError): + line.coords = [(-1.0, -1.0), (1.0, 1.0)] + + with pytest.raises(TypeError): + line.coords[0] = (-1.0, -1.0) + + +def test_linestring_array_coercion(): + # don't convert to array of coordinates, keep objects + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + arr = np.array(line) + assert arr.ndim == 0 + assert arr.size == 1 + assert arr.dtype == np.dtype("object") + assert arr.item() == line diff --git a/billinglayer/python/shapely/tests/geometry/test_multi.py b/billinglayer/python/shapely/tests/geometry/test_multi.py new file mode 100644 index 0000000..08d4666 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_multi.py @@ -0,0 +1,11 @@ +import numpy as np + +test_int_types = [int, np.int16, np.int32, np.int64] + + +class MultiGeometryTestCase: + def subgeom_access_test(self, cls, geoms): + geom = cls(geoms) + for t in test_int_types: + for i, g in enumerate(geoms): + assert geom.geoms[t(i)] == geoms[i] diff --git a/billinglayer/python/shapely/tests/geometry/test_multilinestring.py b/billinglayer/python/shapely/tests/geometry/test_multilinestring.py new file mode 100644 index 0000000..f7545fa --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_multilinestring.py @@ -0,0 +1,79 @@ +import numpy as np +import pytest + +from shapely import LineString, MultiLineString +from shapely.errors import EmptyPartError +from shapely.geometry.base import dump_coords + +from .test_multi import MultiGeometryTestCase + + +class TestMultiLineString(MultiGeometryTestCase): + def test_multilinestring(self): + + # From coordinate tuples + geom = MultiLineString([[(1.0, 2.0), (3.0, 4.0)]]) + assert isinstance(geom, MultiLineString) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [[(1.0, 2.0), (3.0, 4.0)]] + + # From lines + a = LineString([(1.0, 2.0), (3.0, 4.0)]) + ml = MultiLineString([a]) + assert len(ml.geoms) == 1 + assert dump_coords(ml) == [[(1.0, 2.0), (3.0, 4.0)]] + + # From another multi-line + ml2 = MultiLineString(ml) + assert len(ml2.geoms) == 1 + assert dump_coords(ml2) == [[(1.0, 2.0), (3.0, 4.0)]] + + # Sub-geometry Access + geom = MultiLineString([(((0.0, 0.0), (1.0, 2.0)))]) + assert isinstance(geom.geoms[0], LineString) + assert dump_coords(geom.geoms[0]) == [(0.0, 0.0), (1.0, 2.0)] + with pytest.raises(IndexError): # index out of range + geom.geoms[1] + + # Geo interface + assert geom.__geo_interface__ == { + "type": "MultiLineString", + "coordinates": (((0.0, 0.0), (1.0, 2.0)),), + } + + def test_from_multilinestring_z(self): + coords1 = [(0.0, 1.0, 2.0), (3.0, 4.0, 5.0)] + coords2 = [(6.0, 7.0, 8.0), (9.0, 10.0, 11.0)] + + # From coordinate tuples + ml = MultiLineString([coords1, coords2]) + copy = MultiLineString(ml) + assert isinstance(copy, MultiLineString) + assert copy.geom_type == "MultiLineString" + assert len(copy.geoms) == 2 + assert dump_coords(copy.geoms[0]) == coords1 + assert dump_coords(copy.geoms[1]) == coords2 + + def test_numpy(self): + # Construct from a numpy array + geom = MultiLineString([np.array(((0.0, 0.0), (1.0, 2.0)))]) + assert isinstance(geom, MultiLineString) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [[(0.0, 0.0), (1.0, 2.0)]] + + def test_subgeom_access(self): + line0 = LineString([(0.0, 1.0), (2.0, 3.0)]) + line1 = LineString([(4.0, 5.0), (6.0, 7.0)]) + self.subgeom_access_test(MultiLineString, [line0, line1]) + + def test_create_multi_with_empty_component(self): + msg = "Can't create MultiLineString with empty component" + with pytest.raises(EmptyPartError, match=msg): + MultiLineString([LineString([(0, 0), (1, 1), (2, 2)]), LineString()]).wkt + + +def test_numpy_object_array(): + geom = MultiLineString([[[5.0, 6.0], [7.0, 8.0]]]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/billinglayer/python/shapely/tests/geometry/test_multipoint.py b/billinglayer/python/shapely/tests/geometry/test_multipoint.py new file mode 100644 index 0000000..ef039cf --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_multipoint.py @@ -0,0 +1,79 @@ +import numpy as np +import pytest + +from shapely import MultiPoint, Point +from shapely.errors import EmptyPartError +from shapely.geometry.base import dump_coords + +from .test_multi import MultiGeometryTestCase + + +class TestMultiPoint(MultiGeometryTestCase): + def test_multipoint(self): + + # From coordinate tuples + geom = MultiPoint([(1.0, 2.0), (3.0, 4.0)]) + assert len(geom.geoms) == 2 + assert dump_coords(geom) == [[(1.0, 2.0)], [(3.0, 4.0)]] + + # From points + geom = MultiPoint([Point(1.0, 2.0), Point(3.0, 4.0)]) + assert len(geom.geoms) == 2 + assert dump_coords(geom) == [[(1.0, 2.0)], [(3.0, 4.0)]] + + # From another multi-point + geom2 = MultiPoint(geom) + assert len(geom2.geoms) == 2 + assert dump_coords(geom2) == [[(1.0, 2.0)], [(3.0, 4.0)]] + + # Sub-geometry Access + assert isinstance(geom.geoms[0], Point) + assert geom.geoms[0].x == 1.0 + assert geom.geoms[0].y == 2.0 + with pytest.raises(IndexError): # index out of range + geom.geoms[2] + + # Geo interface + assert geom.__geo_interface__ == { + "type": "MultiPoint", + "coordinates": ((1.0, 2.0), (3.0, 4.0)), + } + + def test_multipoint_from_numpy(self): + # Construct from a numpy array + geom = MultiPoint(np.array([[0.0, 0.0], [1.0, 2.0]])) + assert isinstance(geom, MultiPoint) + assert len(geom.geoms) == 2 + assert dump_coords(geom) == [[(0.0, 0.0)], [(1.0, 2.0)]] + + def test_subgeom_access(self): + p0 = Point(1.0, 2.0) + p1 = Point(3.0, 4.0) + self.subgeom_access_test(MultiPoint, [p0, p1]) + + def test_create_multi_with_empty_component(self): + msg = "Can't create MultiPoint with empty component" + with pytest.raises(EmptyPartError, match=msg): + MultiPoint([Point(0, 0), Point()]).wkt + + +def test_multipoint_array_coercion(): + geom = MultiPoint([(1.0, 2.0), (3.0, 4.0)]) + arr = np.array(geom) + assert arr.ndim == 0 + assert arr.size == 1 + assert arr.dtype == np.dtype("object") + assert arr.item() == geom + + +def test_numpy_object_array(): + geom = MultiPoint([(1.0, 2.0), (3.0, 4.0)]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom + + +def test_len_raises(): + geom = MultiPoint([[5.0, 6.0], [7.0, 8.0]]) + with pytest.raises(TypeError): + len(geom) diff --git a/billinglayer/python/shapely/tests/geometry/test_multipolygon.py b/billinglayer/python/shapely/tests/geometry/test_multipolygon.py new file mode 100644 index 0000000..6ba3ae4 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_multipolygon.py @@ -0,0 +1,121 @@ +import numpy as np +import pytest + +from shapely import MultiPolygon, Polygon +from shapely.geometry.base import dump_coords + +from .test_multi import MultiGeometryTestCase + + +class TestMultiPolygon(MultiGeometryTestCase): + def test_multipolygon(self): + + # From coordinate tuples + coords = [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + ] + geom = MultiPolygon(coords) + assert isinstance(geom, MultiPolygon) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [ + [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + ] + + # Or from polygons + p = Polygon( + ((0, 0), (0, 1), (1, 1), (1, 0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + geom = MultiPolygon([p]) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [ + [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + ] + + # Or from another multi-polygon + geom2 = MultiPolygon(geom) + assert len(geom2.geoms) == 1 + assert dump_coords(geom2) == [ + [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + ] + + # Sub-geometry Access + assert isinstance(geom.geoms[0], Polygon) + assert dump_coords(geom.geoms[0]) == [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + with pytest.raises(IndexError): # index out of range + geom.geoms[1] + + # Geo interface + assert geom.__geo_interface__ == { + "type": "MultiPolygon", + "coordinates": [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)), + ((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)), + ) + ], + } + + def test_subgeom_access(self): + poly0 = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)]) + poly1 = Polygon([(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25)]) + self.subgeom_access_test(MultiPolygon, [poly0, poly1]) + + +def test_fail_list_of_multipolygons(): + """A list of multipolygons is not a valid multipolygon ctor argument""" + multi = MultiPolygon( + [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + ] + ) + with pytest.raises(ValueError): + MultiPolygon([multi]) + + +def test_numpy_object_array(): + geom = MultiPolygon( + [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + ] + ) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/billinglayer/python/shapely/tests/geometry/test_point.py b/billinglayer/python/shapely/tests/geometry/test_point.py new file mode 100644 index 0000000..5edbcc4 --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_point.py @@ -0,0 +1,185 @@ +import numpy as np +import pytest + +from shapely import Point +from shapely.coords import CoordinateSequence +from shapely.errors import DimensionError + + +def test_from_coordinates(): + # 2D points + p = Point(1.0, 2.0) + assert p.coords[:] == [(1.0, 2.0)] + assert p.has_z is False + + # 3D Point + p = Point(1.0, 2.0, 3.0) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + assert p.has_z + + # empty + p = Point() + assert p.is_empty + assert isinstance(p.coords, CoordinateSequence) + assert p.coords[:] == [] + + +def test_from_sequence(): + # From single coordinate pair + p = Point((3.0, 4.0)) + assert p.coords[:] == [(3.0, 4.0)] + p = Point([3.0, 4.0]) + assert p.coords[:] == [(3.0, 4.0)] + + # From coordinate sequence + p = Point([(3.0, 4.0)]) + assert p.coords[:] == [(3.0, 4.0)] + p = Point([[3.0, 4.0]]) + assert p.coords[:] == [(3.0, 4.0)] + + # 3D + p = Point((3.0, 4.0, 5.0)) + assert p.coords[:] == [(3.0, 4.0, 5.0)] + p = Point([3.0, 4.0, 5.0]) + assert p.coords[:] == [(3.0, 4.0, 5.0)] + p = Point([(3.0, 4.0, 5.0)]) + assert p.coords[:] == [(3.0, 4.0, 5.0)] + + +def test_from_numpy(): + # Construct from a numpy array + p = Point(np.array([1.0, 2.0])) + assert p.coords[:] == [(1.0, 2.0)] + + p = Point(np.array([1.0, 2.0, 3.0])) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + + +def test_from_numpy_xy(): + # Construct from separate x, y numpy arrays - if those are length 1, + # this is allowed for compat with shapely 1.8 + # (https://github.com/shapely/shapely/issues/1587) + p = Point(np.array([1.0]), np.array([2.0])) + assert p.coords[:] == [(1.0, 2.0)] + + p = Point(np.array([1.0]), np.array([2.0]), np.array([3.0])) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + + +def test_from_point(): + # From another point + p = Point(3.0, 4.0) + q = Point(p) + assert q.coords[:] == [(3.0, 4.0)] + + p = Point(3.0, 4.0, 5.0) + q = Point(p) + assert q.coords[:] == [(3.0, 4.0, 5.0)] + + +def test_from_generator(): + gen = (coord for coord in [(1.0, 2.0)]) + p = Point(gen) + assert p.coords[:] == [(1.0, 2.0)] + + +def test_from_invalid(): + + with pytest.raises(TypeError, match="takes at most 3 arguments"): + Point(1, 2, 3, 4) + + # this worked in shapely 1.x, just ignoring the other coords + with pytest.raises( + ValueError, match="takes only scalar or 1-size vector arguments" + ): + Point([(2, 3), (11, 4)]) + + +class TestPoint: + def test_point(self): + + # Test 2D points + p = Point(1.0, 2.0) + assert p.x == 1.0 + assert p.y == 2.0 + assert p.coords[:] == [(1.0, 2.0)] + assert str(p) == p.wkt + assert p.has_z is False + with pytest.raises(DimensionError): + p.z + + # Check 3D + p = Point(1.0, 2.0, 3.0) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + assert str(p) == p.wkt + assert p.has_z is True + assert p.z == 3.0 + + # Coordinate access + p = Point((3.0, 4.0)) + assert p.x == 3.0 + assert p.y == 4.0 + assert tuple(p.coords) == ((3.0, 4.0),) + assert p.coords[0] == (3.0, 4.0) + with pytest.raises(IndexError): # index out of range + p.coords[1] + + # Bounds + assert p.bounds == (3.0, 4.0, 3.0, 4.0) + + # Geo interface + assert p.__geo_interface__ == {"type": "Point", "coordinates": (3.0, 4.0)} + + def test_point_empty(self): + # Test Non-operability of Null geometry + p_null = Point() + assert p_null.wkt == "POINT EMPTY" + assert p_null.coords[:] == [] + assert p_null.area == 0.0 + + def test_coords(self): + # From Array.txt + p = Point(0.0, 0.0, 1.0) + coords = p.coords[0] + assert coords == (0.0, 0.0, 1.0) + + # Convert to Numpy array, passing through Python sequence + a = np.asarray(coords) + assert a.ndim == 1 + assert a.size == 3 + assert a.shape == (3,) + + +def test_point_immutable(): + p = Point(3.0, 4.0) + + with pytest.raises(AttributeError): + p.coords = (2.0, 1.0) + + with pytest.raises(TypeError): + p.coords[0] = (2.0, 1.0) + + +def test_point_array_coercion(): + # don't convert to array of coordinates, keep objects + p = Point(3.0, 4.0) + arr = np.array(p) + assert arr.ndim == 0 + assert arr.size == 1 + assert arr.dtype == np.dtype("object") + assert arr.item() == p + + +def test_numpy_empty_point_coords(): + pe = Point() + + # Access the coords + a = np.asarray(pe.coords) + assert a.shape == (0, 2) + + +def test_numpy_object_array(): + geom = Point(3.0, 4.0) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/billinglayer/python/shapely/tests/geometry/test_polygon.py b/billinglayer/python/shapely/tests/geometry/test_polygon.py new file mode 100644 index 0000000..60ed11b --- /dev/null +++ b/billinglayer/python/shapely/tests/geometry/test_polygon.py @@ -0,0 +1,463 @@ +"""Polygons and Linear Rings +""" +import numpy as np +import pytest + +from shapely import LinearRing, LineString, Point, Polygon +from shapely.coords import CoordinateSequence +from shapely.errors import TopologicalError +from shapely.wkb import loads as load_wkb + + +def test_empty_linearring_coords(): + assert LinearRing().coords[:] == [] + + +def test_linearring_from_coordinate_sequence(): + expected_coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert ring.coords[:] == expected_coords + + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert ring.coords[:] == expected_coords + + +def test_linearring_from_points(): + # From Points + expected_coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + ring = LinearRing([Point(0.0, 0.0), Point(0.0, 1.0), Point(1.0, 1.0)]) + assert ring.coords[:] == expected_coords + + +def test_linearring_from_closed_linestring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + line = LineString(coords) + ring = LinearRing(line) + assert len(ring.coords) == 4 + assert ring.coords[:] == coords + assert ring.geom_type == "LinearRing" + + +def test_linearring_from_unclosed_linestring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + line = LineString(coords[:-1]) # Pass in unclosed line + ring = LinearRing(line) + assert len(ring.coords) == 4 + assert ring.coords[:] == coords + assert ring.geom_type == "LinearRing" + + +def test_linearring_from_invalid(): + coords = [(0.0, 0.0), (0.0, 0.0), (0.0, 0.0)] + line = LineString(coords) + assert not line.is_valid + with pytest.raises(TopologicalError): + LinearRing(line) + + +def test_linearring_from_too_short_linestring(): + # Creation of LinearRing request at least 3 coordinates (unclosed) or + # 4 coordinates (closed) + coords = [(0.0, 0.0), (1.0, 1.0)] + line = LineString(coords) + with pytest.raises(ValueError, match="requires at least 4 coordinates"): + LinearRing(line) + + +def test_linearring_from_linearring(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + ring = LinearRing(coords) + assert ring.coords[:] == coords + + +def test_linearring_from_generator(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + gen = (coord for coord in coords) + ring = LinearRing(gen) + assert ring.coords[:] == coords + + +def test_linearring_from_empty(): + ring = LinearRing() + assert ring.is_empty + assert isinstance(ring.coords, CoordinateSequence) + assert ring.coords[:] == [] + + ring = LinearRing([]) + assert ring.is_empty + assert isinstance(ring.coords, CoordinateSequence) + assert ring.coords[:] == [] + + +def test_linearring_from_numpy(): + # Construct from a numpy array + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + + ring = LinearRing(np.array(coords)) + assert ring.coords[:] == [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + + +def test_numpy_linearring_coords(): + from numpy.testing import assert_array_equal + + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + ra = np.asarray(ring.coords) + expected = np.asarray([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)]) + assert_array_equal(ra, expected) + + +def test_numpy_empty_linearring_coords(): + ring = LinearRing() + assert np.asarray(ring.coords).shape == (0, 2) + + +def test_numpy_object_array(): + geom = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom + + +def test_polygon_from_coordinate_sequence(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + # Construct a polygon, exterior ring only + polygon = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 0 + + polygon = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 0 + + +def test_polygon_from_coordinate_sequence_with_holes(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + # Interior rings (holes) + polygon = Polygon(coords, [[(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25)]]) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 1 + assert len(polygon.interiors[0].coords) == 5 + + # Multiple interior rings with different length + coords = [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)] + holes = [ + [(1, 1), (2, 1), (2, 2), (1, 2), (1, 1)], + [(3, 3), (3, 4), (4, 5), (5, 4), (5, 3), (3, 3)], + ] + polygon = Polygon(coords, holes) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 2 + assert len(polygon.interiors[0].coords) == 5 + assert len(polygon.interiors[1].coords) == 6 + + +def test_polygon_from_linearring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + ring = LinearRing(coords) + + polygon = Polygon(ring) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 0 + + # from shell and holes linearrings + shell = LinearRing([(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)]) + holes = [ + LinearRing([(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)]), + LinearRing([(30.0, 10.0), (50.0, 10.0), (40.0, 30.0), (30.0, 10.0)]), + LinearRing([(90.0, 10), (110.0, 10.0), (100.0, 30.0), (90.0, 10.0)]), + ] + polygon = Polygon(shell, holes) + assert polygon.exterior.coords[:] == shell.coords[:] + assert len(polygon.interiors) == 3 + for i in range(3): + assert polygon.interiors[i].coords[:] == holes[i].coords[:] + + +def test_polygon_from_linestring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + line = LineString(coords) + polygon = Polygon(line) + assert polygon.exterior.coords[:] == coords + + # from unclosed linestring + line = LineString(coords[:-1]) + polygon = Polygon(line) + assert polygon.exterior.coords[:] == coords + + +def test_polygon_from_points(): + polygon = Polygon([Point(0.0, 0.0), Point(0.0, 1.0), Point(1.0, 1.0)]) + expected_coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + assert polygon.exterior.coords[:] == expected_coords + + +def test_polygon_from_polygon(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)] + polygon = Polygon(coords, [[(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25)]]) + + # Test from another Polygon + copy = Polygon(polygon) + assert len(copy.exterior.coords) == 5 + assert len(copy.interiors) == 1 + assert len(copy.interiors[0].coords) == 5 + + +def test_polygon_from_invalid(): + # Error handling + with pytest.raises(ValueError): + # A LinearRing must have at least 3 coordinate tuples + Polygon([[1, 2], [2, 3]]) + + +def test_polygon_from_empty(): + polygon = Polygon() + assert polygon.is_empty + assert polygon.exterior.coords[:] == [] + + polygon = Polygon([]) + assert polygon.is_empty + assert polygon.exterior.coords[:] == [] + + +def test_polygon_from_numpy(): + a = np.array(((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0))) + polygon = Polygon(a) + assert len(polygon.exterior.coords) == 5 + assert polygon.exterior.coords[:] == [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + ] + assert len(polygon.interiors) == 0 + + +def test_polygon_from_generator(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + gen = (coord for coord in coords) + polygon = Polygon(gen) + assert polygon.exterior.coords[:] == coords + + +class TestPolygon: + def test_linearring(self): + + # Initialization + # Linear rings won't usually be created by users, but by polygons + coords = ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)) + ring = LinearRing(coords) + assert len(ring.coords) == 5 + assert ring.coords[0] == ring.coords[4] + assert ring.coords[0] == ring.coords[-1] + assert ring.is_ring is True + + def test_polygon(self): + coords = ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)) + + # Construct a polygon, exterior ring only + polygon = Polygon(coords) + assert len(polygon.exterior.coords) == 5 + + # Ring Access + assert isinstance(polygon.exterior, LinearRing) + ring = polygon.exterior + assert len(ring.coords) == 5 + assert ring.coords[0] == ring.coords[4] + assert ring.coords[0] == (0.0, 0.0) + assert ring.is_ring is True + assert len(polygon.interiors) == 0 + + # Create a new polygon from WKB + data = polygon.wkb + polygon = None + ring = None + polygon = load_wkb(data) + ring = polygon.exterior + assert len(ring.coords) == 5 + assert ring.coords[0] == ring.coords[4] + assert ring.coords[0] == (0.0, 0.0) + assert ring.is_ring is True + polygon = None + + # Interior rings (holes) + polygon = Polygon( + coords, [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))] + ) + assert len(polygon.exterior.coords) == 5 + assert len(polygon.interiors[0].coords) == 5 + with pytest.raises(IndexError): # index out of range + polygon.interiors[1] + + # Coordinate getter raises exceptions + with pytest.raises(NotImplementedError): + polygon.coords + + # Geo interface + assert polygon.__geo_interface__ == { + "type": "Polygon", + "coordinates": ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)), + ((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)), + ), + } + + def test_linearring_empty(self): + # Test Non-operability of Null rings + r_null = LinearRing() + assert r_null.wkt == "LINEARRING EMPTY" + assert r_null.length == 0.0 + + def test_dimensions(self): + + # Background: see http://trac.gispython.org/lab/ticket/168 + # http://lists.gispython.org/pipermail/community/2008-August/001859.html + + coords = ((0.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0), (1.0, 0.0, 0.0)) + polygon = Polygon(coords) + assert polygon._ndim == 3 + gi = polygon.__geo_interface__ + assert gi["coordinates"] == ( + ( + (0.0, 0.0, 0.0), + (0.0, 1.0, 0.0), + (1.0, 1.0, 0.0), + (1.0, 0.0, 0.0), + (0.0, 0.0, 0.0), + ), + ) + + e = polygon.exterior + assert e._ndim == 3 + gi = e.__geo_interface__ + assert gi["coordinates"] == ( + (0.0, 0.0, 0.0), + (0.0, 1.0, 0.0), + (1.0, 1.0, 0.0), + (1.0, 0.0, 0.0), + (0.0, 0.0, 0.0), + ) + + def test_attribute_chains(self): + + # Attribute Chaining + # See also ticket #151. + p = Polygon([(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)]) + assert list(p.boundary.coords) == [ + (0.0, 0.0), + (0.0, 1.0), + (-1.0, 1.0), + (-1.0, 0.0), + (0.0, 0.0), + ] + + ec = list(Point(0.0, 0.0).buffer(1.0, 1).exterior.coords) + assert isinstance(ec, list) # TODO: this is a poor test + + # Test chained access to interiors + p = Polygon( + [(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)], + [[(-0.25, 0.25), (-0.25, 0.75), (-0.75, 0.75), (-0.75, 0.25)]], + ) + assert p.area == 0.75 + + """Not so much testing the exact values here, which are the + responsibility of the geometry engine (GEOS), but that we can get + chain functions and properties using anonymous references. + """ + assert list(p.interiors[0].coords) == [ + (-0.25, 0.25), + (-0.25, 0.75), + (-0.75, 0.75), + (-0.75, 0.25), + (-0.25, 0.25), + ] + xy = list(p.interiors[0].buffer(1).exterior.coords)[0] + assert len(xy) == 2 + + # Test multiple operators, boundary of a buffer + ec = list(p.buffer(1).boundary.coords) + assert isinstance(ec, list) # TODO: this is a poor test + + def test_empty_equality(self): + # Test equals operator, including empty geometries + # see issue #338 + + point1 = Point(0, 0) + polygon1 = Polygon([(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)]) + polygon2 = Polygon([(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)]) + polygon_empty1 = Polygon() + polygon_empty2 = Polygon() + + assert point1 != polygon1 + assert polygon_empty1 == polygon_empty2 + assert polygon1 != polygon_empty1 + assert polygon1 == polygon2 + assert polygon_empty1 is not None + + def test_from_bounds(self): + xmin, ymin, xmax, ymax = -180, -90, 180, 90 + coords = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)] + assert Polygon(coords) == Polygon.from_bounds(xmin, ymin, xmax, ymax) + + def test_empty_polygon_exterior(self): + p = Polygon() + assert p.exterior == LinearRing() + + +def test_linearring_immutable(): + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)]) + + with pytest.raises(AttributeError): + ring.coords = [(1.0, 1.0), (2.0, 2.0), (1.0, 2.0)] + + with pytest.raises(TypeError): + ring.coords[0] = (1.0, 1.0) + + +class TestLinearRingGetItem: + def test_index_linearring(self): + shell = LinearRing([(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)]) + holes = [ + LinearRing([(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)]), + LinearRing([(30.0, 10.0), (50.0, 10.0), (40.0, 30.0), (30.0, 10.0)]), + LinearRing([(90.0, 10), (110.0, 10.0), (100.0, 30.0), (90.0, 10.0)]), + ] + g = Polygon(shell, holes) + for i in range(-3, 3): + assert g.interiors[i].equals(holes[i]) + with pytest.raises(IndexError): + g.interiors[3] + with pytest.raises(IndexError): + g.interiors[-4] + + def test_index_linearring_misc(self): + g = Polygon() # empty + with pytest.raises(IndexError): + g.interiors[0] + with pytest.raises(TypeError): + g.interiors[0.0] + + def test_slice_linearring(self): + shell = LinearRing([(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)]) + holes = [ + LinearRing([(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)]), + LinearRing([(30.0, 10.0), (50.0, 10.0), (40.0, 30.0), (30.0, 10.0)]), + LinearRing([(90.0, 10), (110.0, 10.0), (100.0, 30.0), (90.0, 10.0)]), + ] + g = Polygon(shell, holes) + t = [a.equals(b) for (a, b) in zip(g.interiors[1:], holes[1:])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[:-1], holes[:-1])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[::-1], holes[::-1])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[::2], holes[::2])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[:3], holes[:3])] + assert all(t) + assert g.interiors[3:] == holes[3:] == [] diff --git a/billinglayer/python/shapely/tests/test_constructive.py b/billinglayer/python/shapely/tests/test_constructive.py new file mode 100644 index 0000000..279cd33 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_constructive.py @@ -0,0 +1,986 @@ +import numpy as np +import pytest + +import shapely +from shapely import ( + Geometry, + GeometryCollection, + GEOSException, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) +from shapely.testing import assert_geometries_equal + +from .common import ( + all_types, + empty, + empty_line_string, + empty_point, + empty_polygon, + ignore_invalid, + line_string, + multi_point, + point, + point_z, +) + +CONSTRUCTIVE_NO_ARGS = ( + shapely.boundary, + shapely.centroid, + shapely.convex_hull, + pytest.param( + shapely.concave_hull, + marks=pytest.mark.skipif( + shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11" + ), + ), + shapely.envelope, + shapely.extract_unique_points, + shapely.node, + shapely.normalize, + shapely.point_on_surface, +) + +CONSTRUCTIVE_FLOAT_ARG = ( + shapely.buffer, + shapely.offset_curve, + shapely.delaunay_triangles, + shapely.simplify, + shapely.voronoi_polygons, +) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", CONSTRUCTIVE_NO_ARGS) +def test_no_args_array(geometry, func): + actual = func([geometry, geometry]) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", CONSTRUCTIVE_FLOAT_ARG) +def test_float_arg_array(geometry, func): + if ( + func is shapely.offset_curve + and shapely.get_type_id(geometry) not in [1, 2] + and shapely.geos_version < (3, 11, 0) + ): + with pytest.raises(GEOSException, match="only accept linestrings"): + func([geometry, geometry], 0.0) + return + # voronoi_polygons emits an "invalid" warning when supplied with an empty + # point (see https://github.com/libgeos/geos/issues/515) + with ignore_invalid( + func is shapely.voronoi_polygons + and shapely.get_type_id(geometry) == 0 + and shapely.geos_version < (3, 12, 0) + ): + actual = func([geometry, geometry], 0.0) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("reference", all_types) +def test_snap_array(geometry, reference): + actual = shapely.snap([geometry, geometry], [reference, reference], tolerance=1.0) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + +@pytest.mark.parametrize("func", CONSTRUCTIVE_NO_ARGS) +def test_no_args_missing(func): + actual = func(None) + assert actual is None + + +@pytest.mark.parametrize("func", CONSTRUCTIVE_FLOAT_ARG) +def test_float_arg_missing(func): + actual = func(None, 1.0) + assert actual is None + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", CONSTRUCTIVE_FLOAT_ARG) +def test_float_arg_nan(geometry, func): + actual = func(geometry, float("nan")) + assert actual is None + + +def test_buffer_cap_style_invalid(): + with pytest.raises(ValueError, match="'invalid' is not a valid option"): + shapely.buffer(point, 1, cap_style="invalid") + + +def test_buffer_join_style_invalid(): + with pytest.raises(ValueError, match="'invalid' is not a valid option"): + shapely.buffer(point, 1, join_style="invalid") + + +def test_snap_none(): + actual = shapely.snap(None, point, tolerance=1.0) + assert actual is None + + +@pytest.mark.parametrize("geometry", all_types) +def test_snap_nan_float(geometry): + actual = shapely.snap(geometry, point, tolerance=np.nan) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_build_area_none(): + actual = shapely.build_area(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom,expected", + [ + (point, empty), # a point has no area + (line_string, empty), # a line string has no area + # geometry collection of two polygons are combined into one + ( + GeometryCollection( + [ + Polygon([(0, 0), (0, 3), (3, 3), (3, 0), (0, 0)]), + Polygon([(1, 1), (2, 2), (1, 2), (1, 1)]), + ] + ), + Polygon( + [(0, 0), (0, 3), (3, 3), (3, 0), (0, 0)], + holes=[[(1, 1), (2, 2), (1, 2), (1, 1)]], + ), + ), + (empty, empty), + ([empty], [empty]), + ], +) +def test_build_area(geom, expected): + actual = shapely.build_area(geom) + assert actual is not expected + assert actual == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_make_valid_none(): + actual = shapely.make_valid(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point), # a valid geometry stays the same (but is copied) + # an L shaped polygon without area is converted to a multilinestring + ( + Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)]), + MultiLineString([((1, 1), (1, 2)), ((0, 0), (1, 1))]), + ), + # a polygon with self-intersection (bowtie) is converted into polygons + ( + Polygon([(0, 0), (2, 2), (2, 0), (0, 2), (0, 0)]), + MultiPolygon( + [ + Polygon([(1, 1), (2, 2), (2, 0), (1, 1)]), + Polygon([(0, 0), (0, 2), (1, 1), (0, 0)]), + ] + ), + ), + (empty, empty), + ([empty], [empty]), + ], +) +def test_make_valid(geom, expected): + actual = shapely.make_valid(geom) + assert actual is not expected + # normalize needed to handle variation in output across GEOS versions + assert shapely.normalize(actual) == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom,expected", + [ + (all_types, all_types), + # first polygon is valid, second polygon has self-intersection + ( + [ + Polygon([(0, 0), (2, 2), (0, 2), (0, 0)]), + Polygon([(0, 0), (2, 2), (2, 0), (0, 2), (0, 0)]), + ], + [ + Polygon([(0, 0), (2, 2), (0, 2), (0, 0)]), + MultiPolygon( + [ + Polygon([(1, 1), (0, 0), (0, 2), (1, 1)]), + Polygon([(1, 1), (2, 2), (2, 0), (1, 1)]), + ] + ), + ], + ), + ([point, None, empty], [point, None, empty]), + ], +) +def test_make_valid_1d(geom, expected): + actual = shapely.make_valid(geom) + # normalize needed to handle variation in output across GEOS versions + assert np.all(shapely.normalize(actual) == shapely.normalize(expected)) + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point), # a point is always in normalized form + # order coordinates of linestrings and parts of multi-linestring + ( + MultiLineString([((1, 1), (0, 0)), ((1, 1), (1, 2))]), + MultiLineString([((1, 1), (1, 2)), ((0, 0), (1, 1))]), + ), + ], +) +def test_normalize(geom, expected): + actual = shapely.normalize(geom) + assert actual == expected + + +def test_offset_curve_empty(): + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Empty geometries emit an "invalid" warning + # (see https://github.com/libgeos/geos/issues/515) + actual = shapely.offset_curve(empty_line_string, 2.0) + assert shapely.is_empty(actual) + + +def test_offset_curve_distance_array(): + # check that kwargs are passed through + result = shapely.offset_curve([line_string, line_string], [-2.0, -3.0]) + assert result[0] == shapely.offset_curve(line_string, -2.0) + assert result[1] == shapely.offset_curve(line_string, -3.0) + + +def test_offset_curve_kwargs(): + # check that kwargs are passed through + result1 = shapely.offset_curve( + line_string, -2.0, quad_segs=2, join_style="mitre", mitre_limit=2.0 + ) + result2 = shapely.offset_curve(line_string, -2.0) + assert result1 != result2 + + +def test_offset_curve_non_scalar_kwargs(): + msg = "only accepts scalar values" + with pytest.raises(TypeError, match=msg): + shapely.offset_curve([line_string, line_string], 1, quad_segs=np.array([8, 9])) + + with pytest.raises(TypeError, match=msg): + shapely.offset_curve( + [line_string, line_string], 1, join_style=["round", "bevel"] + ) + + with pytest.raises(TypeError, match=msg): + shapely.offset_curve([line_string, line_string], 1, mitre_limit=[5.0, 6.0]) + + +def test_offset_curve_join_style_invalid(): + with pytest.raises(ValueError, match="'invalid' is not a valid option"): + shapely.offset_curve(line_string, 1.0, join_style="invalid") + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +@pytest.mark.parametrize( + "geom,expected", + [ + (LineString([(0, 0), (0, 0), (1, 0)]), LineString([(0, 0), (1, 0)])), + ( + LinearRing([(0, 0), (1, 2), (1, 2), (1, 3), (0, 0)]), + LinearRing([(0, 0), (1, 2), (1, 3), (0, 0)]), + ), + ( + Polygon([(0, 0), (0, 0), (1, 0), (1, 1), (1, 0), (0, 0)]), + Polygon([(0, 0), (1, 0), (1, 1), (1, 0), (0, 0)]), + ), + ( + Polygon( + [(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)], + holes=[[(2, 2), (2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], + ), + Polygon( + [(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)], + holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], + ), + ), + ( + MultiPolygon( + [ + Polygon([(0, 0), (0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(2, 2), (2, 2), (2, 3), (3, 3), (3, 2), (2, 2)]), + ] + ), + MultiPolygon( + [ + Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(2, 2), (2, 3), (3, 3), (3, 2), (2, 2)]), + ] + ), + ), + # points are unchanged + (point, point), + (point_z, point_z), + (multi_point, multi_point), + # empty geometries are unchanged + (empty_point, empty_point), + (empty_line_string, empty_line_string), + (empty, empty), + (empty_polygon, empty_polygon), + ], +) +def test_remove_repeated_points(geom, expected): + assert_geometries_equal(shapely.remove_repeated_points(geom, 0), expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 12, 0), reason="GEOS < 3.12") +@pytest.mark.parametrize( + "geom, tolerance", [[Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), 2]] +) +def test_remove_repeated_points_invalid_result(geom, tolerance): + # Requiring GEOS 3.12 instead of 3.11 + # (GEOS 3.11 had a bug causing this to intermittently not fail) + with pytest.raises(shapely.GEOSException, match="Invalid number of points"): + shapely.remove_repeated_points(geom, tolerance) + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +def test_remove_repeated_points_none(): + assert shapely.remove_repeated_points(None, 1) is None + assert shapely.remove_repeated_points([None], 1).tolist() == [None] + + geometry = LineString([(0, 0), (0, 0), (1, 1)]) + expected = LineString([(0, 0), (1, 1)]) + result = shapely.remove_repeated_points([None, geometry], 1) + assert result[0] is None + assert_geometries_equal(result[1], expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +@pytest.mark.parametrize("geom, tolerance", [("Not a geometry", 1), (1, 1)]) +def test_remove_repeated_points_invalid_type(geom, tolerance): + with pytest.raises(TypeError, match="One of the arguments is of incorrect type"): + shapely.remove_repeated_points(geom, tolerance) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom,expected", + [ + (LineString([(0, 0), (1, 2)]), LineString([(1, 2), (0, 0)])), + ( + LinearRing([(0, 0), (1, 2), (1, 3), (0, 0)]), + LinearRing([(0, 0), (1, 3), (1, 2), (0, 0)]), + ), + ( + Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]), + ), + ( + Polygon( + [(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)], + holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], + ), + Polygon( + [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + holes=[[(2, 2), (4, 2), (4, 4), (2, 4), (2, 2)]], + ), + ), + pytest.param( + MultiLineString([[(0, 0), (1, 2)], [(3, 3), (4, 4)]]), + MultiLineString([[(1, 2), (0, 0)], [(4, 4), (3, 3)]]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 8, 1), reason="GEOS < 3.8.1" + ), + ), + ( + MultiPolygon( + [ + Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(2, 2), (2, 3), (3, 3), (3, 2), (2, 2)]), + ] + ), + MultiPolygon( + [ + Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]), + Polygon([(2, 2), (3, 2), (3, 3), (2, 3), (2, 2)]), + ] + ), + ), + # points are unchanged + (point, point), + (point_z, point_z), + (multi_point, multi_point), + # empty geometries are unchanged + (empty_point, empty_point), + (empty_line_string, empty_line_string), + (empty, empty), + (empty_polygon, empty_polygon), + ], +) +def test_reverse(geom, expected): + assert_geometries_equal(shapely.reverse(geom), expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_reverse_none(): + assert shapely.reverse(None) is None + assert shapely.reverse([None]).tolist() == [None] + + geometry = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + expected = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + result = shapely.reverse([None, geometry]) + assert result[0] is None + assert_geometries_equal(result[1], expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize("geom", ["Not a geometry", 1]) +def test_reverse_invalid_type(geom): + with pytest.raises(TypeError, match="One of the arguments is of incorrect type"): + shapely.reverse(geom) + + +@pytest.mark.parametrize( + "geom,expected", + [ + # Point outside + (Point(0, 0), GeometryCollection()), + # Point inside + (Point(15, 15), Point(15, 15)), + # Point on boundary + (Point(15, 10), GeometryCollection()), + # Line outside + (LineString([(0, 0), (-5, 5)]), GeometryCollection()), + # Line inside + (LineString([(15, 15), (16, 15)]), LineString([(15, 15), (16, 15)])), + # Line on boundary + (LineString([(10, 15), (10, 10), (15, 10)]), GeometryCollection()), + # Line splitting rectangle + (LineString([(10, 5), (25, 20)]), LineString([(15, 10), (20, 15)])), + ], +) +def test_clip_by_rect(geom, expected): + actual = shapely.clip_by_rect(geom, 10, 10, 20, 20) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "geom, rect, expected", + [ + # Polygon hole (CCW) fully on rectangle boundary""" + ( + Polygon( + ((0, 0), (0, 30), (30, 30), (30, 0), (0, 0)), + holes=[((10, 10), (20, 10), (20, 20), (10, 20), (10, 10))], + ), + (10, 10, 20, 20), + GeometryCollection(), + ), + # Polygon hole (CW) fully on rectangle boundary""" + ( + Polygon( + ((0, 0), (0, 30), (30, 30), (30, 0), (0, 0)), + holes=[((10, 10), (10, 20), (20, 20), (20, 10), (10, 10))], + ), + (10, 10, 20, 20), + GeometryCollection(), + ), + # Polygon fully within rectangle""" + ( + Polygon( + ((1, 1), (1, 30), (30, 30), (30, 1), (1, 1)), + holes=[((10, 10), (20, 10), (20, 20), (10, 20), (10, 10))], + ), + (0, 0, 40, 40), + Polygon( + ((1, 1), (1, 30), (30, 30), (30, 1), (1, 1)), + holes=[((10, 10), (20, 10), (20, 20), (10, 20), (10, 10))], + ), + ), + # Polygon overlapping rectanglez + ( + Polygon( + [(0, 0), (0, 30), (30, 30), (30, 0), (0, 0)], + holes=[[(10, 10), (20, 10), (20, 20), (10, 20), (10, 10)]], + ), + (5, 5, 15, 15), + Polygon([(5, 5), (5, 15), (10, 15), (10, 10), (15, 10), (15, 5), (5, 5)]), + ), + ], +) +def test_clip_by_rect_polygon(geom, rect, expected): + actual = shapely.clip_by_rect(geom, *rect) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize("geometry", all_types) +def test_clip_by_rect_array(geometry): + actual = shapely.clip_by_rect([geometry, geometry], 0.0, 0.0, 1.0, 1.0) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + +def test_clip_by_rect_missing(): + actual = shapely.clip_by_rect(None, 0, 0, 1, 1) + assert actual is None + + +@pytest.mark.parametrize("geom", [empty, empty_line_string, empty_polygon]) +def test_clip_by_rect_empty(geom): + # TODO empty point + actual = shapely.clip_by_rect(geom, 0, 0, 1, 1) + assert actual == GeometryCollection() + + +def test_clip_by_rect_non_scalar_kwargs(): + msg = "only accepts scalar values" + with pytest.raises(TypeError, match=msg): + shapely.clip_by_rect([line_string, line_string], 0, 0, 1, np.array([0, 1])) + + +def test_polygonize(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + LineString([(1, 1), (1, 0)]), + LineString([(1, 0), (0, 0)]), + LineString([(5, 5), (6, 6)]), + Point(0, 0), + None, + ] + result = shapely.polygonize(lines) + assert shapely.get_type_id(result) == 7 # GeometryCollection + expected = GeometryCollection( + [ + Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]), + Polygon([(1, 1), (0, 0), (0, 1), (1, 1)]), + ] + ) + assert result == expected + + +def test_polygonize_array(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + expected = GeometryCollection([Polygon([(1, 1), (0, 0), (0, 1), (1, 1)])]) + result = shapely.polygonize(np.array(lines)) + assert isinstance(result, shapely.Geometry) + assert result == expected + + result = shapely.polygonize(np.array([lines])) + assert isinstance(result, np.ndarray) + assert result.shape == (1,) + assert result[0] == expected + + arr = np.array([lines, lines]) + assert arr.shape == (2, 3) + result = shapely.polygonize(arr) + assert isinstance(result, np.ndarray) + assert result.shape == (2,) + assert result[0] == expected + assert result[1] == expected + + arr = np.array([[lines, lines], [lines, lines], [lines, lines]]) + assert arr.shape == (3, 2, 3) + result = shapely.polygonize(arr) + assert isinstance(result, np.ndarray) + assert result.shape == (3, 2) + for res in result.flatten(): + assert res == expected + + +@pytest.mark.skipif( + np.__version__ < "1.15", + reason="axis keyword for generalized ufunc introduced in np 1.15", +) +def test_polygonize_array_axis(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + arr = np.array([lines, lines]) # shape (2, 3) + result = shapely.polygonize(arr, axis=1) + assert result.shape == (2,) + result = shapely.polygonize(arr, axis=0) + assert result.shape == (3,) + + +def test_polygonize_missing(): + # set of geometries that is all missing + result = shapely.polygonize([None, None]) + assert result == GeometryCollection() + + +def test_polygonize_full(): + lines = [ + None, + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + LineString([(1, 1), (1, 0)]), + None, + LineString([(1, 0), (0, 0)]), + LineString([(5, 5), (6, 6)]), + LineString([(1, 1), (100, 100)]), + Point(0, 0), + None, + ] + result = shapely.polygonize_full(lines) + assert len(result) == 4 + assert all(shapely.get_type_id(geom) == 7 for geom in result) # GeometryCollection + polygons, cuts, dangles, invalid = result + expected_polygons = GeometryCollection( + [ + Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]), + Polygon([(1, 1), (0, 0), (0, 1), (1, 1)]), + ] + ) + assert polygons == expected_polygons + assert cuts == GeometryCollection() + expected_dangles = GeometryCollection( + [LineString([(1, 1), (100, 100)]), LineString([(5, 5), (6, 6)])] + ) + assert dangles == expected_dangles + assert invalid == GeometryCollection() + + +def test_polygonize_full_array(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + expected = GeometryCollection([Polygon([(1, 1), (0, 0), (0, 1), (1, 1)])]) + result = shapely.polygonize_full(np.array(lines)) + assert len(result) == 4 + assert all(isinstance(geom, shapely.Geometry) for geom in result) + assert result[0] == expected + assert all(geom == GeometryCollection() for geom in result[1:]) + + result = shapely.polygonize_full(np.array([lines])) + assert len(result) == 4 + assert all(isinstance(geom, np.ndarray) for geom in result) + assert all(geom.shape == (1,) for geom in result) + assert result[0][0] == expected + assert all(geom[0] == GeometryCollection() for geom in result[1:]) + + arr = np.array([lines, lines]) + assert arr.shape == (2, 3) + result = shapely.polygonize_full(arr) + assert len(result) == 4 + assert all(isinstance(arr, np.ndarray) for arr in result) + assert all(arr.shape == (2,) for arr in result) + assert result[0][0] == expected + assert result[0][1] == expected + assert all(g == GeometryCollection() for geom in result[1:] for g in geom) + + arr = np.array([[lines, lines], [lines, lines], [lines, lines]]) + assert arr.shape == (3, 2, 3) + result = shapely.polygonize_full(arr) + assert len(result) == 4 + assert all(isinstance(arr, np.ndarray) for arr in result) + assert all(arr.shape == (3, 2) for arr in result) + for res in result[0].flatten(): + assert res == expected + for arr in result[1:]: + for res in arr.flatten(): + assert res == GeometryCollection() + + +@pytest.mark.skipif( + np.__version__ < "1.15", + reason="axis keyword for generalized ufunc introduced in np 1.15", +) +def test_polygonize_full_array_axis(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + arr = np.array([lines, lines]) # shape (2, 3) + result = shapely.polygonize_full(arr, axis=1) + assert len(result) == 4 + assert all(arr.shape == (2,) for arr in result) + result = shapely.polygonize_full(arr, axis=0) + assert len(result) == 4 + assert all(arr.shape == (3,) for arr in result) + + +def test_polygonize_full_missing(): + # set of geometries that is all missing + result = shapely.polygonize_full([None, None]) + assert len(result) == 4 + assert all(geom == GeometryCollection() for geom in result) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("max_segment_length", [-1, 0]) +def test_segmentize_invalid_max_segment_length(geometry, max_segment_length): + with pytest.raises(GEOSException, match="IllegalArgumentException"): + shapely.segmentize(geometry, max_segment_length=max_segment_length) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("geometry", all_types) +def test_segmentize_max_segment_length_nan(geometry): + actual = shapely.segmentize(geometry, max_segment_length=np.nan) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry", [empty, empty_point, empty_line_string, empty_polygon] +) +def test_segmentize_empty(geometry): + actual = shapely.segmentize(geometry, max_segment_length=5) + assert_geometries_equal(actual, geometry) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("geometry", [point, point_z, multi_point]) +def test_segmentize_no_change(geometry): + actual = shapely.segmentize(geometry, max_segment_length=5) + assert_geometries_equal(actual, geometry) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_segmentize_none(): + assert shapely.segmentize(None, max_segment_length=5) is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,tolerance, expected", + [ + # tolerance greater than max edge length, no change + ( + LineString([(0, 0), (0, 10)]), + 20, + LineString([(0, 0), (0, 10)]), + ), + ( + Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]), + 20, + Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]), + ), + # tolerance causes one vertex per segment + ( + LineString([(0, 0), (0, 10)]), + 5, + LineString([(0, 0), (0, 5), (0, 10)]), + ), + ( + Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]), + 5, + Polygon( + [ + (0, 0), + (5, 0), + (10, 0), + (10, 5), + (10, 10), + (5, 10), + (0, 10), + (0, 5), + (0, 0), + ] + ), + ), + # ensure input arrays are broadcast correctly + ( + [ + LineString([(0, 0), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + 5, + [ + LineString([(0, 0), (0, 5), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + ), + ( + [ + LineString([(0, 0), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + [5], + [ + LineString([(0, 0), (0, 5), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + ), + ( + [ + LineString([(0, 0), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + [5, 1.5], + [ + LineString([(0, 0), (0, 5), (0, 10)]), + LineString([(0, 0), (0, 1), (0, 2)]), + ], + ), + ], +) +def test_segmentize(geometry, tolerance, expected): + actual = shapely.segmentize(geometry, tolerance) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize("geometry", all_types) +def test_minimum_bounding_circle_all_types(geometry): + actual = shapely.minimum_bounding_circle([geometry, geometry]) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + actual = shapely.minimum_bounding_circle(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + Polygon([(0, 5), (5, 10), (10, 5), (5, 0), (0, 5)]), + shapely.buffer(Point(5, 5), 5), + ), + ( + LineString([(1, 0), (1, 10)]), + shapely.buffer(Point(1, 5), 5), + ), + ( + MultiPoint([(2, 2), (4, 2)]), + shapely.buffer(Point(3, 2), 1), + ), + ( + Point(2, 2), + Point(2, 2), + ), + ( + GeometryCollection(), + Polygon(), + ), + ], +) +def test_minimum_bounding_circle(geometry, expected): + actual = shapely.minimum_bounding_circle(geometry) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("geometry", all_types) +def test_oriented_envelope_all_types(geometry): + actual = shapely.oriented_envelope([geometry, geometry]) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + actual = shapely.oriented_envelope(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + MultiPoint([(0, 0), (10, 0), (10, 10)]), + Polygon([(0, 0), (5, -5), (15, 5), (10, 10), (0, 0)]), + ), + ( + LineString([(1, 1), (5, 1), (10, 10)]), + Polygon([(1, 1), (3, -1), (12, 8), (10, 10), (1, 1)]), + ), + ( + Polygon([(1, 1), (15, 1), (5, 10), (1, 1)]), + Polygon([(15, 1), (15, 10), (1, 10), (1, 1), (15, 1)]), + ), + ( + LineString([(1, 1), (10, 1)]), + LineString([(1, 1), (10, 1)]), + ), + ( + Point(2, 2), + Point(2, 2), + ), + ( + GeometryCollection(), + Polygon(), + ), + ], +) +def test_oriented_envelope(geometry, expected): + actual = shapely.oriented_envelope(geometry) + assert shapely.equals(actual, expected).all() + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + MultiPoint([(0, 0), (10, 0), (10, 10)]), + Polygon([(0, 0), (5, -5), (15, 5), (10, 10), (0, 0)]), + ), + ( + LineString([(1, 1), (5, 1), (10, 10)]), + Polygon([(1, 1), (3, -1), (12, 8), (10, 10), (1, 1)]), + ), + ( + Polygon([(1, 1), (15, 1), (5, 10), (1, 1)]), + Polygon([(15, 1), (15, 10), (1, 10), (1, 1), (15, 1)]), + ), + ( + LineString([(1, 1), (10, 1)]), + LineString([(1, 1), (10, 1)]), + ), + ( + Point(2, 2), + Point(2, 2), + ), + ( + GeometryCollection(), + Polygon(), + ), + ], +) +def test_minimum_rotated_rectangle(geometry, expected): + actual = shapely.minimum_rotated_rectangle(geometry) + assert shapely.equals(actual, expected).all() + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +def test_concave_hull_kwargs(): + p = Point(10, 10) + mp = MultiPoint(p.buffer(5).exterior.coords[:] + p.buffer(4).exterior.coords[:]) + + result1 = shapely.concave_hull(mp, ratio=0.5) + assert len(result1.interiors) == 0 + result2 = shapely.concave_hull(mp, ratio=0.5, allow_holes=True) + assert len(result2.interiors) == 1 + + result3 = shapely.concave_hull(mp, ratio=0) + result4 = shapely.concave_hull(mp, ratio=1) + assert shapely.get_num_coordinates(result4) < shapely.get_num_coordinates(result3) diff --git a/billinglayer/python/shapely/tests/test_coordinates.py b/billinglayer/python/shapely/tests/test_coordinates.py new file mode 100644 index 0000000..d9decc5 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_coordinates.py @@ -0,0 +1,267 @@ +import numpy as np +import pytest +from numpy.testing import assert_allclose, assert_equal + +import shapely +from shapely import count_coordinates, get_coordinates, set_coordinates, transform + +from .common import ( + empty, + empty_line_string_z, + empty_point, + empty_point_z, + geometry_collection, + geometry_collection_z, + line_string, + line_string_z, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + point_z, + polygon, + polygon_with_hole, + polygon_z, +) + +nested_2 = shapely.geometrycollections([geometry_collection, point]) +nested_3 = shapely.geometrycollections([nested_2, point]) + + +@pytest.mark.parametrize( + "geoms,count", + [ + ([], 0), + ([empty], 0), + ([point, empty], 1), + ([empty, point, empty], 1), + ([point, None], 1), + ([None, point, None], 1), + ([point, point], 2), + ([point, point_z], 2), + ([line_string, linear_ring], 8), + ([polygon], 5), + ([polygon_with_hole], 10), + ([multi_point, multi_line_string], 4), + ([multi_polygon], 10), + ([geometry_collection], 3), + ([nested_2], 4), + ([nested_3], 5), + ], +) +def test_count_coords(geoms, count): + actual = count_coordinates(np.array(geoms, np.object_)) + assert actual == count + + +# fmt: off +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms,x,y", + [ + ([], [], []), + ([empty], [], []), + ([point, empty], [2], [3]), + ([empty, point, empty], [2], [3]), + ([point, None], [2], [3]), + ([None, point, None], [2], [3]), + ([point, point], [2, 2], [3, 3]), + ([line_string, linear_ring], [0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0]), + ([polygon], [0, 2, 2, 0, 0], [0, 0, 2, 2, 0]), + ([polygon_with_hole], [0, 0, 10, 10, 0, 2, 2, 4, 4, 2], [0, 10, 10, 0, 0, 2, 4, 4, 2, 2]), + ([multi_point, multi_line_string], [0, 1, 0, 1], [0, 2, 0, 2]), + ([multi_polygon], [0, 1, 1, 0, 0, 2.1, 2.2, 2.2, 2.1, 2.1], [0, 0, 1, 1, 0, 2.1, 2.1, 2.2, 2.2, 2.1]), + ([geometry_collection], [51, 52, 49], [-1, -1, 2]), + ([nested_2], [51, 52, 49, 2], [-1, -1, 2, 3]), + ([nested_3], [51, 52, 49, 2, 2], [-1, -1, 2, 3, 3]), + ], +) # fmt: on +def test_get_coords(geoms, x, y, include_z): + actual = get_coordinates(np.array(geoms, np.object_), include_z=include_z) + if not include_z: + expected = np.array([x, y], np.float64).T + else: + expected = np.array([x, y, [np.nan] * len(x)], np.float64).T + assert_equal(actual, expected) + + +# fmt: off +@pytest.mark.parametrize( + "geoms,index", + [ + ([], []), + ([empty], []), + ([point, empty], [0]), + ([empty, point, empty], [1]), + ([point, None], [0]), + ([None, point, None], [1]), + ([point, point], [0, 1]), + ([point, line_string], [0, 1, 1, 1]), + ([line_string, point], [0, 0, 0, 1]), + ([line_string, linear_ring], [0, 0, 0, 1, 1, 1, 1, 1]), + ], +) # fmt: on +def test_get_coords_index(geoms, index): + _, actual = get_coordinates(np.array(geoms, np.object_), return_index=True) + expected = np.array(index, dtype=np.intp) + assert_equal(actual, expected) + + +@pytest.mark.parametrize("order", ["C", "F"]) +def test_get_coords_index_multidim(order): + geometry = np.array([[point, line_string], [empty, empty]], order=order) + expected = [0, 1, 1, 1] # would be [0, 2, 2, 2] with fortran order + _, actual = get_coordinates(geometry, return_index=True) + assert_equal(actual, expected) + + +# fmt: off +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms,x,y,z", + [ + ([point, point_z], [2, 2], [3, 3], [np.nan, 4]), + ([line_string_z], [0, 1, 1], [0, 0, 1], [4, 4, 4]), + ([polygon_z], [0, 2, 2, 0, 0], [0, 0, 2, 2, 0], [4, 4, 4, 4, 4]), + ([geometry_collection_z], [2, 0, 1, 1], [3, 0, 0, 1], [4, 4, 4, 4]), + ([point, empty_point], [2], [3], [np.nan]), + ], +) # fmt: on +def test_get_coords_3d(geoms, x, y, z, include_z): + actual = get_coordinates(np.array(geoms, np.object_), include_z=include_z) + if include_z: + expected = np.array([x, y, z], np.float64).T + else: + expected = np.array([x, y], np.float64).T + assert_equal(actual, expected) + + +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms,count,has_ring", + [ + ([], 0, False), + ([empty], 0, False), + ([empty_point], 0, False), + ([point, empty], 1, False), + ([empty, point, empty], 1, False), + ([point, None], 1, False), + ([None, point, None], 1, False), + ([point, point], 2, False), + ([point, point_z], 2, False), + ([line_string, linear_ring], 8, True), + ([line_string_z], 3, True), + ([polygon], 5, True), + ([polygon_z], 5, True), + ([polygon_with_hole], 10, True), + ([multi_point, multi_line_string], 4, False), + ([multi_polygon], 10, True), + ([geometry_collection], 3, False), + ([geometry_collection_z], 3, False), + ([nested_2], 4, False), + ([nested_3], 5, False), + ], +) +def test_set_coords(geoms, count, has_ring, include_z): + arr_geoms = np.array(geoms, np.object_) + n = 3 if include_z else 2 + coords = get_coordinates(arr_geoms, include_z=include_z) + np.random.random((1, n)) + new_geoms = set_coordinates(arr_geoms, coords) + assert_equal(coords, get_coordinates(new_geoms, include_z=include_z)) + + +def test_set_coords_nan(): + geoms = np.array([point]) + coords = np.array([[np.nan, np.inf]]) + new_geoms = set_coordinates(geoms, coords) + assert_equal(coords, get_coordinates(new_geoms)) + + +def test_set_coords_breaks_ring(): + with pytest.raises(shapely.GEOSException): + set_coordinates(linear_ring, np.random.random((5, 2))) + + +def test_set_coords_0dim(): + # a geometry input returns a geometry + actual = set_coordinates(point, [[1, 1]]) + assert isinstance(actual, shapely.Geometry) + # a 0-dim array input returns a 0-dim array + actual = set_coordinates(np.asarray(point), [[1, 1]]) + assert isinstance(actual, np.ndarray) + assert actual.ndim == 0 + + +@pytest.mark.parametrize("include_z", [True, False]) +def test_set_coords_mixed_dimension(include_z): + geoms = np.array([point, point_z], dtype=object) + coords = get_coordinates(geoms, include_z=include_z) + new_geoms = set_coordinates(geoms, coords * 2) + if include_z: + # preserve original dimensionality + assert not shapely.has_z(new_geoms[0]) + assert shapely.has_z(new_geoms[1]) + else: + # all 2D + assert not shapely.has_z(new_geoms).any() + + +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms", + [[], [empty], [None, point, None], [nested_3], [point, point_z], [line_string_z]], +) +def test_transform(geoms, include_z): + geoms = np.array(geoms, np.object_) + coordinates_before = get_coordinates(geoms, include_z=include_z) + new_geoms = transform(geoms, lambda x: x + 1, include_z=include_z) + assert new_geoms is not geoms + coordinates_after = get_coordinates(new_geoms, include_z=include_z) + assert_allclose(coordinates_before + 1, coordinates_after, equal_nan=True) + + +def test_transform_0dim(): + # a geometry input returns a geometry + actual = transform(point, lambda x: x + 1) + assert isinstance(actual, shapely.Geometry) + # a 0-dim array input returns a 0-dim array + actual = transform(np.asarray(point), lambda x: x + 1) + assert isinstance(actual, np.ndarray) + assert actual.ndim == 0 + + +def test_transform_check_shape(): + def remove_coord(arr): + return arr[:-1] + + with pytest.raises(ValueError): + transform(linear_ring, remove_coord) + + +def test_transform_correct_coordinate_dimension(): + # ensure that new geometry is 2D with include_z=False + geom = line_string_z + assert shapely.get_coordinate_dimension(geom) == 3 + new_geom = transform(geom, lambda x: x + 1, include_z=False) + assert shapely.get_coordinate_dimension(new_geom) == 2 + + +@pytest.mark.parametrize("geom", [ + pytest.param(empty_point_z, marks=pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="Empty points don't have a dimensionality before GEOS 3.9")), + empty_line_string_z, +]) +def test_transform_empty_preserve_z(geom): + assert shapely.get_coordinate_dimension(geom) == 3 + new_geom = transform(geom, lambda x: x + 1, include_z=True) + assert shapely.get_coordinate_dimension(new_geom) == 3 + + +@pytest.mark.parametrize("geom", [ + pytest.param(empty_point_z, marks=pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="Empty points don't have a dimensionality before GEOS 3.9")), + empty_line_string_z, +]) +def test_transform_remove_z(geom): + assert shapely.get_coordinate_dimension(geom) == 3 + new_geom = transform(geom, lambda x: x + 1, include_z=False) + assert shapely.get_coordinate_dimension(new_geom) == 2 diff --git a/billinglayer/python/shapely/tests/test_creation.py b/billinglayer/python/shapely/tests/test_creation.py new file mode 100644 index 0000000..88a54c7 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_creation.py @@ -0,0 +1,548 @@ +import numpy as np +import pytest + +import shapely + +# Note: Point is not imported because it is overridden for testing +from shapely import ( + GeometryCollection, + GeometryType, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Polygon, +) +from shapely.testing import assert_geometries_equal + +from .common import ( + empty_polygon, + geometry_collection, + line_string, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + polygon, +) + + +def box_tpl(x1, y1, x2, y2): + return (x2, y1), (x2, y2), (x1, y2), (x1, y1), (x2, y1) + + +def test_points_from_coords(): + actual = shapely.points([[0, 0], [2, 2]]) + assert_geometries_equal(actual, [shapely.Point(0, 0), shapely.Point(2, 2)]) + + +def test_points_from_xy(): + actual = shapely.points(2, [0, 1]) + assert_geometries_equal(actual, [shapely.Point(2, 0), shapely.Point(2, 1)]) + + +def test_points_from_xyz(): + actual = shapely.points(1, 1, [0, 1]) + assert_geometries_equal(actual, [shapely.Point(1, 1, 0), shapely.Point(1, 1, 1)]) + + +def test_points_invalid_ndim(): + with pytest.raises(ValueError, match="dimension should be 2 or 3, got 4"): + shapely.points([0, 1, 2, 3]) + + with pytest.raises(ValueError, match="dimension should be 2 or 3, got 1"): + shapely.points([0]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_points_nan_becomes_empty(): + actual = shapely.points(np.nan, np.nan) + assert_geometries_equal(actual, shapely.Point()) + + +def test_linestrings_from_coords(): + actual = shapely.linestrings([[[0, 0], [1, 1]], [[0, 0], [2, 2]]]) + assert_geometries_equal( + actual, + [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (2, 2)]), + ], + ) + + +def test_linestrings_from_xy(): + actual = shapely.linestrings([0, 1], [2, 3]) + assert_geometries_equal(actual, LineString([(0, 2), (1, 3)])) + + +def test_linestrings_from_xy_broadcast(): + x = [0, 1] # the same X coordinates for both linestrings + y = [2, 3], [4, 5] # each linestring has a different set of Y coordinates + actual = shapely.linestrings(x, y) + assert_geometries_equal( + actual, + [ + LineString([(0, 2), (1, 3)]), + LineString([(0, 4), (1, 5)]), + ], + ) + + +def test_linestrings_from_xyz(): + actual = shapely.linestrings([0, 1], [2, 3], 0) + assert_geometries_equal(actual, LineString([(0, 2, 0), (1, 3, 0)])) + + +@pytest.mark.parametrize("dim", [2, 3]) +def test_linestrings_buffer(dim): + coords = np.random.randn(10, 3, dim) + coords1 = np.asarray(coords, order="C") + result1 = shapely.linestrings(coords1) + + coords2 = np.asarray(coords1, order="F") + result2 = shapely.linestrings(coords2) + assert_geometries_equal(result1, result2) + + # creating (.., 8, 8*3) strided array so it uses copyFromArrays + coords3 = np.asarray(np.swapaxes(np.swapaxes(coords, 0, 2), 1, 0), order="F") + coords3 = np.swapaxes(np.swapaxes(coords3, 0, 2), 1, 2) + result3 = shapely.linestrings(coords3) + assert_geometries_equal(result1, result3) + + +def test_linestrings_invalid_shape_scalar(): + with pytest.raises(ValueError): + shapely.linestrings((1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linestrings of 1 2D point + (1, 1, 2), # 1 linestring of 1 2D point + (1, 2), # 1 linestring of 1 2D point (scalar) + ], +) +def test_linestrings_invalid_shape(shape): + with pytest.raises(shapely.GEOSException): + shapely.linestrings(np.ones(shape)) + + +def test_linestrings_invalid_ndim(): + msg = r"The ordinate \(last\) dimension should be 2 or 3, got {}" + + coords = np.ones((10, 2, 4), order="C") + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linestrings(coords) + + coords = np.ones((10, 2, 4), order="F") + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linestrings(coords) + + coords = np.swapaxes(np.swapaxes(np.ones((10, 2, 4)), 0, 2), 1, 0) + coords = np.swapaxes(np.swapaxes(np.asarray(coords, order="F"), 0, 2), 1, 2) + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linestrings(coords) + + # too few ordinates + coords = np.ones((10, 2, 1)) + with pytest.raises(ValueError, match=msg.format(1)): + shapely.linestrings(coords) + + +def test_linearrings(): + actual = shapely.linearrings(box_tpl(0, 0, 1, 1)) + assert_geometries_equal( + actual, LinearRing([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]) + ) + + +def test_linearrings_from_xy(): + actual = shapely.linearrings([0, 1, 2, 0], [3, 4, 5, 3]) + assert_geometries_equal(actual, LinearRing([(0, 3), (1, 4), (2, 5), (0, 3)])) + + +def test_linearrings_unclosed(): + actual = shapely.linearrings(box_tpl(0, 0, 1, 1)[:-1]) + assert_geometries_equal( + actual, LinearRing([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]) + ) + + +def test_linearrings_unclosed_all_coords_equal(): + actual = shapely.linearrings([(0, 0), (0, 0), (0, 0)]) + assert_geometries_equal(actual, LinearRing([(0, 0), (0, 0), (0, 0), (0, 0)])) + + +def test_linearrings_invalid_shape_scalar(): + with pytest.raises(ValueError): + shapely.linearrings((1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linearrings of 1 2D point + (1, 1, 2), # 1 linearring of 1 2D point + (1, 2), # 1 linearring of 1 2D point (scalar) + (2, 2, 2), # 2 linearrings of 2 2D points + (1, 2, 2), # 1 linearring of 2 2D points + (2, 2), # 1 linearring of 2 2D points (scalar) + ], +) +def test_linearrings_invalid_shape(shape): + coords = np.ones(shape) + with pytest.raises(ValueError): + shapely.linearrings(coords) + + # make sure the first coordinate != second coordinate + coords[..., 1] += 1 + with pytest.raises(ValueError): + shapely.linearrings(coords) + + +def test_linearrings_invalid_ndim(): + msg = r"The ordinate \(last\) dimension should be 2 or 3, got {}" + + coords1 = np.random.randn(10, 3, 4) + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linearrings(coords1) + + coords2 = np.hstack((coords1, coords1[:, [0], :])) + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linearrings(coords2) + + # too few ordinates + coords3 = np.random.randn(10, 3, 1) + with pytest.raises(ValueError, match=msg.format(1)): + shapely.linestrings(coords3) + + +def test_linearrings_all_nan(): + coords = np.full((4, 2), np.nan) + with pytest.raises(shapely.GEOSException): + shapely.linearrings(coords) + + +@pytest.mark.parametrize("dim", [2, 3]) +@pytest.mark.parametrize("order", ["C", "F"]) +def test_linearrings_buffer(dim, order): + coords1 = np.random.randn(10, 4, dim) + coords1 = np.asarray(coords1, order=order) + result1 = shapely.linearrings(coords1) + + # with manual closure -> can directly copy from buffer if C order + coords2 = np.hstack((coords1, coords1[:, [0], :])) + coords2 = np.asarray(coords2, order=order) + result2 = shapely.linearrings(coords2) + assert_geometries_equal(result1, result2) + + # create scalar -> can also directly copy from buffer if F order + coords3 = np.asarray(coords2[0], order=order) + result3 = shapely.linearrings(coords3) + assert_geometries_equal(result3, result1[0]) + + +def test_polygon_from_linearring(): + actual = shapely.polygons(shapely.linearrings(box_tpl(0, 0, 1, 1))) + assert_geometries_equal(actual, Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)])) + + +def test_polygons_none(): + assert_geometries_equal(shapely.polygons(None), empty_polygon) + assert_geometries_equal(shapely.polygons(None, holes=[linear_ring]), empty_polygon) + + +def test_polygons(): + actual = shapely.polygons(box_tpl(0, 0, 1, 1)) + assert_geometries_equal(actual, Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)])) + + +def test_polygon_no_hole_list_raises(): + with pytest.raises(ValueError): + shapely.polygons(box_tpl(0, 0, 10, 10), box_tpl(1, 1, 2, 2)) + + +def test_polygon_no_hole_wrong_type(): + with pytest.raises((TypeError, shapely.GEOSException)): + shapely.polygons(point) + + +def test_polygon_with_hole_wrong_type(): + with pytest.raises((TypeError, shapely.GEOSException)): + shapely.polygons(point, [linear_ring]) + + +def test_polygon_wrong_hole_type(): + with pytest.raises((TypeError, shapely.GEOSException)): + shapely.polygons(linear_ring, [point]) + + +def test_polygon_with_1_hole(): + actual = shapely.polygons(box_tpl(0, 0, 10, 10), [box_tpl(1, 1, 2, 2)]) + assert shapely.area(actual) == 99.0 + + +def test_polygon_with_2_holes(): + actual = shapely.polygons( + box_tpl(0, 0, 10, 10), [box_tpl(1, 1, 2, 2), box_tpl(3, 3, 4, 4)] + ) + assert shapely.area(actual) == 98.0 + + +def test_polygon_with_none_hole(): + actual = shapely.polygons( + shapely.linearrings(box_tpl(0, 0, 10, 10)), + [ + shapely.linearrings(box_tpl(1, 1, 2, 2)), + None, + shapely.linearrings(box_tpl(3, 3, 4, 4)), + ], + ) + assert shapely.area(actual) == 98.0 + + +def test_2_polygons_with_same_hole(): + actual = shapely.polygons( + [box_tpl(0, 0, 10, 10), box_tpl(0, 0, 5, 5)], [box_tpl(1, 1, 2, 2)] + ) + assert shapely.area(actual).tolist() == [99.0, 24.0] + + +def test_2_polygons_with_2_same_holes(): + actual = shapely.polygons( + [box_tpl(0, 0, 10, 10), box_tpl(0, 0, 5, 5)], + [box_tpl(1, 1, 2, 2), box_tpl(3, 3, 4, 4)], + ) + assert shapely.area(actual).tolist() == [98.0, 23.0] + + +def test_2_polygons_with_different_holes(): + actual = shapely.polygons( + [box_tpl(0, 0, 10, 10), box_tpl(0, 0, 5, 5)], + [[box_tpl(1, 1, 3, 3)], [box_tpl(1, 1, 2, 2)]], + ) + assert shapely.area(actual).tolist() == [96.0, 24.0] + + +def test_polygons_not_enough_points_in_shell_scalar(): + with pytest.raises(ValueError): + shapely.polygons((1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linearrings of 1 2D point + (1, 1, 2), # 1 linearring of 1 2D point + (1, 2), # 1 linearring of 1 2D point (scalar) + (2, 2, 2), # 2 linearrings of 2 2D points + (1, 2, 2), # 1 linearring of 2 2D points + (2, 2), # 1 linearring of 2 2D points (scalar) + ], +) +def test_polygons_not_enough_points_in_shell(shape): + coords = np.ones(shape) + with pytest.raises(ValueError): + shapely.polygons(coords) + + # make sure the first coordinate != second coordinate + coords[..., 1] += 1 + with pytest.raises(ValueError): + shapely.polygons(coords) + + +def test_polygons_not_enough_points_in_holes_scalar(): + with pytest.raises(ValueError): + shapely.polygons(np.ones((1, 4, 2)), (1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linearrings of 1 2D point + (1, 1, 2), # 1 linearring of 1 2D point + (1, 2), # 1 linearring of 1 2D point (scalar) + (2, 2, 2), # 2 linearrings of 2 2D points + (1, 2, 2), # 1 linearring of 2 2D points + (2, 2), # 1 linearring of 2 2D points (scalar) + ], +) +def test_polygons_not_enough_points_in_holes(shape): + coords = np.ones(shape) + with pytest.raises(ValueError): + shapely.polygons(np.ones((1, 4, 2)), coords) + + # make sure the first coordinate != second coordinate + coords[..., 1] += 1 + with pytest.raises(ValueError): + shapely.polygons(np.ones((1, 4, 2)), coords) + + +@pytest.mark.parametrize( + "func,expected", + [ + (shapely.multipoints, MultiPoint()), + (shapely.multilinestrings, MultiLineString()), + (shapely.multipolygons, MultiPolygon()), + (shapely.geometrycollections, GeometryCollection()), + ], +) +def test_create_collection_only_none(func, expected): + actual = func(np.array([None], dtype=object)) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "func,sub_geom", + [ + (shapely.multipoints, point), + (shapely.multilinestrings, line_string), + (shapely.multilinestrings, linear_ring), + (shapely.multipolygons, polygon), + (shapely.geometrycollections, point), + (shapely.geometrycollections, line_string), + (shapely.geometrycollections, linear_ring), + (shapely.geometrycollections, polygon), + (shapely.geometrycollections, multi_point), + (shapely.geometrycollections, multi_line_string), + (shapely.geometrycollections, multi_polygon), + (shapely.geometrycollections, geometry_collection), + ], +) +def test_create_collection(func, sub_geom): + actual = func([sub_geom, sub_geom]) + assert shapely.get_num_geometries(actual) == 2 + + +@pytest.mark.parametrize( + "func,sub_geom", + [ + (shapely.multipoints, point), + (shapely.multilinestrings, line_string), + (shapely.multipolygons, polygon), + (shapely.geometrycollections, polygon), + ], +) +def test_create_collection_skips_none(func, sub_geom): + actual = func([sub_geom, None, None, sub_geom]) + assert shapely.get_num_geometries(actual) == 2 + + +@pytest.mark.parametrize( + "func,sub_geom", + [ + (shapely.multipoints, line_string), + (shapely.multipoints, geometry_collection), + (shapely.multipoints, multi_point), + (shapely.multilinestrings, point), + (shapely.multilinestrings, polygon), + (shapely.multilinestrings, multi_line_string), + (shapely.multipolygons, linear_ring), + (shapely.multipolygons, multi_point), + (shapely.multipolygons, multi_polygon), + ], +) +def test_create_collection_wrong_geom_type(func, sub_geom): + with pytest.raises(TypeError): + func([sub_geom]) + + +@pytest.mark.parametrize( + "coords,ccw,expected", + [ + ((0, 0, 1, 1), True, Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)])), + ( + (0, 0, 1, 1), + False, + Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]), + ), + ], +) +def test_box(coords, ccw, expected): + actual = shapely.box(*coords, ccw=ccw) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "coords,ccw,expected", + [ + ( + (0, 0, [1, 2], [1, 2]), + True, + [ + Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]), + Polygon([(2, 0), (2, 2), (0, 2), (0, 0), (2, 0)]), + ], + ), + ( + (0, 0, [1, 2], [1, 2]), + [True, False], + [ + Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]), + Polygon([(0, 0), (0, 2), (2, 2), (2, 0), (0, 0)]), + ], + ), + ], +) +def test_box_array(coords, ccw, expected): + actual = shapely.box(*coords, ccw=ccw) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "coords", + [ + [np.nan, np.nan, np.nan, np.nan], + [np.nan, 0, 1, 1], + [0, np.nan, 1, 1], + [0, 0, np.nan, 1], + [0, 0, 1, np.nan], + ], +) +def test_box_nan(coords): + assert shapely.box(*coords) is None + + +def test_prepare(): + arr = np.array([shapely.points(1, 1), None, shapely.box(0, 0, 1, 1)]) + assert arr[0]._geom_prepared == 0 + assert arr[2]._geom_prepared == 0 + shapely.prepare(arr) + assert arr[0]._geom_prepared != 0 + assert arr[1] is None + assert arr[2]._geom_prepared != 0 + + # preparing again actually does nothing + original = arr[0]._geom_prepared + shapely.prepare(arr) + assert arr[0]._geom_prepared == original + + +def test_destroy_prepared(): + arr = np.array([shapely.points(1, 1), None, shapely.box(0, 0, 1, 1)]) + shapely.prepare(arr) + assert arr[0]._geom_prepared != 0 + assert arr[2]._geom_prepared != 0 + shapely.destroy_prepared(arr) + assert arr[0]._geom_prepared == 0 + assert arr[1] is None + assert arr[2]._geom_prepared == 0 + shapely.destroy_prepared(arr) # does not error + + +@pytest.mark.parametrize("geom_type", [None, GeometryType.MISSING, -1]) +def test_empty_missing(geom_type): + actual = shapely.empty((2,), geom_type=geom_type) + assert shapely.is_missing(actual).all() + + +@pytest.mark.parametrize("geom_type", range(8)) +def test_empty(geom_type): + actual = shapely.empty((2,), geom_type=geom_type) + assert (~shapely.is_missing(actual)).all() + assert shapely.is_empty(actual).all() + assert (shapely.get_type_id(actual) == geom_type).all() diff --git a/billinglayer/python/shapely/tests/test_creation_indices.py b/billinglayer/python/shapely/tests/test_creation_indices.py new file mode 100644 index 0000000..de652fd --- /dev/null +++ b/billinglayer/python/shapely/tests/test_creation_indices.py @@ -0,0 +1,419 @@ +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, Polygon +from shapely.testing import assert_geometries_equal + +from .common import empty_point, line_string, linear_ring, point, polygon + +pnts = shapely.points +lstrs = shapely.linestrings +geom_coll = shapely.geometrycollections + + +@pytest.mark.parametrize( + "func", [shapely.points, shapely.linestrings, shapely.linearrings] +) +@pytest.mark.parametrize( + "coordinates", + [ + np.empty((2,)), # not enough dimensions + np.empty((2, 4, 1)), # too many dimensions + np.empty((2, 4)), # wrong inner dimension size + None, + np.full((2, 2), "foo", dtype=object), # wrong type + ], +) +def test_invalid_coordinates(func, coordinates): + with pytest.raises((TypeError, ValueError)): + func(coordinates, indices=[0, 1]) + + +@pytest.mark.parametrize( + "func", + [ + shapely.multipoints, + shapely.multilinestrings, + shapely.multipolygons, + shapely.geometrycollections, + ], +) +@pytest.mark.parametrize( + "geometries", [np.array([1, 2], dtype=np.intp), None, np.array([[point]]), "hello"] +) +def test_invalid_geometries(func, geometries): + with pytest.raises((TypeError, ValueError)): + func(geometries, indices=[0, 1]) + + +@pytest.mark.parametrize( + "func", [shapely.points, shapely.linestrings, shapely.linearrings] +) +@pytest.mark.parametrize("indices", [[point], " hello", [0, 1], [-1]]) +def test_invalid_indices_simple(func, indices): + with pytest.raises((TypeError, ValueError)): + func([[0.2, 0.3]], indices=indices) + + +non_writeable = np.empty(3, dtype=object) +non_writeable.flags.writeable = False + + +@pytest.mark.parametrize( + "func", [shapely.points, shapely.linestrings, shapely.geometrycollections] +) +@pytest.mark.parametrize( + "out", + [ + [None, None, None], # not an ndarray + np.empty(3), # wrong dtype + non_writeable, # not writeable + np.empty((3, 2), dtype=object), # too many dimensions + np.empty((), dtype=object), # too few dimensions + np.empty((2,), dtype=object), # too small + ], +) +def test_invalid_out(func, out): + if func is shapely.points: + x = [[0.2, 0.3], [0.4, 0.5]] + indices = [0, 2] + elif func is shapely.linestrings: + x = [[1, 1], [2, 1], [2, 2], [3, 3], [3, 4], [4, 4]] + indices = [0, 0, 0, 2, 2, 2] + else: + x = [point, line_string] + indices = [0, 2] + with pytest.raises((TypeError, ValueError)): + func(x, indices=indices, out=out) + + +def test_points_invalid(): + # attempt to construct a point with 2 coordinates + with pytest.raises(shapely.GEOSException): + shapely.points([[1, 1], [2, 2]], indices=[0, 0]) + + +def test_points(): + actual = shapely.points( + np.array([[2, 3], [2, 3]], dtype=float), + indices=np.array([0, 1], dtype=np.intp), + ) + assert_geometries_equal(actual, [point, point]) + + +def test_points_no_index_raises(): + with pytest.raises(ValueError): + shapely.points( + np.array([[2, 3], [2, 3]], dtype=float), + indices=np.array([0, 2], dtype=np.intp), + ) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 1], [point, point, empty_point, None]), + ([0, 3], [point, None, empty_point, point]), + ([2, 3], [None, None, point, point]), + ], +) +def test_points_out(indices, expected): + out = np.empty(4, dtype=object) + out[2] = empty_point + actual = shapely.points( + [[2, 3], [2, 3]], + indices=indices, + out=out, + ) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize( + "coordinates,indices,expected", + [ + ([[1, 1], [2, 2]], [0, 0], [lstrs([[1, 1], [2, 2]])]), + ([[1, 1, 1], [2, 2, 2]], [0, 0], [lstrs([[1, 1, 1], [2, 2, 2]])]), + ( + [[1, 1], [2, 2], [2, 2], [3, 3]], + [0, 0, 1, 1], + [lstrs([[1, 1], [2, 2]]), lstrs([[2, 2], [3, 3]])], + ), + ], +) +def test_linestrings(coordinates, indices, expected): + actual = shapely.linestrings( + np.array(coordinates, dtype=float), indices=np.array(indices, dtype=np.intp) + ) + assert_geometries_equal(actual, expected) + + +def test_linestrings_invalid(): + # attempt to construct linestrings with 1 coordinate + with pytest.raises(shapely.GEOSException): + shapely.linestrings([[1, 1], [2, 2]], indices=[0, 1]) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 0, 0, 1, 1, 1], [line_string, line_string, empty_point, None]), + ([0, 0, 0, 3, 3, 3], [line_string, None, empty_point, line_string]), + ([2, 2, 2, 3, 3, 3], [None, None, line_string, line_string]), + ], +) +def test_linestrings_out(indices, expected): + out = np.empty(4, dtype=object) + out[2] = empty_point + actual = shapely.linestrings( + [(0, 0), (1, 0), (1, 1), (0, 0), (1, 0), (1, 1)], + indices=indices, + out=out, + ) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize( + "coordinates", [([[1, 1], [2, 1], [2, 2], [1, 1]]), ([[1, 1], [2, 1], [2, 2]])] +) +def test_linearrings(coordinates): + actual = shapely.linearrings( + np.array(coordinates, dtype=np.float64), + indices=np.zeros(len(coordinates), dtype=np.intp), + ) + assert_geometries_equal(actual, shapely.linearrings(coordinates)) + + +@pytest.mark.parametrize( + "coordinates", + [ + ([[1, np.nan], [2, 1], [2, 2], [1, 1]]), # starting with nan + ], +) +def test_linearrings_invalid(coordinates): + # attempt to construct linestrings with 1 coordinate + with pytest.raises((shapely.GEOSException, ValueError)): + shapely.linearrings(coordinates, indices=np.zeros(len(coordinates))) + + +def test_linearrings_unclosed_all_coords_equal(): + actual = shapely.linearrings([(0, 0), (0, 0), (0, 0)], indices=np.zeros(3)) + assert_geometries_equal(actual, LinearRing([(0, 0), (0, 0), (0, 0), (0, 0)])) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 0, 0, 0, 0], [linear_ring, None, None, empty_point]), + ([1, 1, 1, 1, 1], [None, linear_ring, None, empty_point]), + ([3, 3, 3, 3, 3], [None, None, None, linear_ring]), + ], +) +def test_linearrings_out(indices, expected): + out = np.empty(4, dtype=object) + out[3] = empty_point + actual = shapely.linearrings( + [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], + indices=indices, + out=out, + ) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize("dim", [2, 3]) +@pytest.mark.parametrize("order", ["C", "F"]) +def test_linearrings_buffer(dim, order): + coords = np.random.randn(10, 4, dim) + coords1 = np.asarray(coords.reshape(10 * 4, dim), order=order) + indices1 = np.repeat(range(10), 4) + result1 = shapely.linearrings(coords1, indices=indices1) + + # with manual closure -> can directly copy from buffer if C order + coords2 = np.hstack((coords, coords[:, [0], :])) + coords2 = np.asarray(coords2.reshape(10 * 5, dim), order=order) + indices2 = np.repeat(range(10), 5) + result2 = shapely.linearrings(coords2, indices=indices2) + assert_geometries_equal(result1, result2) + + +hole_1 = shapely.linearrings([(0.2, 0.2), (0.2, 0.4), (0.4, 0.4)]) +hole_2 = shapely.linearrings([(0.6, 0.6), (0.6, 0.8), (0.8, 0.8)]) +poly = shapely.polygons(linear_ring) +poly_empty = Polygon() +poly_hole_1 = shapely.polygons(linear_ring, holes=[hole_1]) +poly_hole_2 = shapely.polygons(linear_ring, holes=[hole_2]) +poly_hole_1_2 = shapely.polygons(linear_ring, holes=[hole_1, hole_2]) + + +@pytest.mark.parametrize( + "rings,indices,expected", + [ + ([linear_ring, linear_ring], [0, 1], [poly, poly]), + ([None, linear_ring], [0, 1], [poly_empty, poly]), + ([None, linear_ring, None, None], [0, 0, 1, 1], [poly, poly_empty]), + ([linear_ring, hole_1, linear_ring], [0, 0, 1], [poly_hole_1, poly]), + ([linear_ring, linear_ring, hole_1], [0, 1, 1], [poly, poly_hole_1]), + ([None, linear_ring, linear_ring, hole_1], [0, 0, 1, 1], [poly, poly_hole_1]), + ([linear_ring, None, linear_ring, hole_1], [0, 0, 1, 1], [poly, poly_hole_1]), + ([linear_ring, None, linear_ring, hole_1], [0, 1, 1, 1], [poly, poly_hole_1]), + ([linear_ring, linear_ring, None, hole_1], [0, 1, 1, 1], [poly, poly_hole_1]), + ([linear_ring, linear_ring, hole_1, None], [0, 1, 1, 1], [poly, poly_hole_1]), + ( + [linear_ring, hole_1, hole_2, linear_ring], + [0, 0, 0, 1], + [poly_hole_1_2, poly], + ), + ( + [linear_ring, hole_1, linear_ring, hole_2], + [0, 0, 1, 1], + [poly_hole_1, poly_hole_2], + ), + ( + [linear_ring, linear_ring, hole_1, hole_2], + [0, 1, 1, 1], + [poly, poly_hole_1_2], + ), + ( + [linear_ring, hole_1, None, hole_2, linear_ring], + [0, 0, 0, 0, 1], + [poly_hole_1_2, poly], + ), + ( + [linear_ring, hole_1, None, linear_ring, hole_2], + [0, 0, 0, 1, 1], + [poly_hole_1, poly_hole_2], + ), + ( + [linear_ring, hole_1, linear_ring, None, hole_2], + [0, 0, 1, 1, 1], + [poly_hole_1, poly_hole_2], + ), + ], +) +def test_polygons(rings, indices, expected): + actual = shapely.polygons( + np.array(rings, dtype=object), indices=np.array(indices, dtype=np.intp) + ) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 1], [poly, poly, empty_point, None]), + ([0, 3], [poly, None, empty_point, poly]), + ([2, 3], [None, None, poly, poly]), + ], +) +def test_polygons_out(indices, expected): + out = np.empty(4, dtype=object) + out[2] = empty_point + actual = shapely.polygons([linear_ring, linear_ring], indices=indices, out=out) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize( + "func", + [ + shapely.polygons, + shapely.multipoints, + shapely.multilinestrings, + shapely.multipolygons, + shapely.geometrycollections, + ], +) +@pytest.mark.parametrize("indices", [np.array([point]), " hello", [0, 1], [-1]]) +def test_invalid_indices_collections(func, indices): + with pytest.raises((TypeError, ValueError)): + func([point], indices=indices) + + +@pytest.mark.parametrize( + "geometries,indices,expected", + [ + ([point, line_string], [0, 0], [geom_coll([point, line_string])]), + ([point, line_string], [0, 1], [geom_coll([point]), geom_coll([line_string])]), + ([point, None], [0, 0], [geom_coll([point])]), + ([point, None], [0, 1], [geom_coll([point]), geom_coll([])]), + ([None, point, None, None], [0, 0, 1, 1], [geom_coll([point]), geom_coll([])]), + ([point, None, line_string], [0, 0, 0], [geom_coll([point, line_string])]), + ], +) +def test_geometrycollections(geometries, indices, expected): + actual = shapely.geometrycollections( + np.array(geometries, dtype=object), indices=indices + ) + assert_geometries_equal(actual, expected) + + +def test_geometrycollections_no_index_raises(): + with pytest.raises(ValueError): + shapely.geometrycollections( + np.array([point, line_string], dtype=object), indices=[0, 2] + ) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 0], [geom_coll([point, line_string]), None, None, empty_point]), + ([3, 3], [None, None, None, geom_coll([point, line_string])]), + ], +) +def test_geometrycollections_out(indices, expected): + out = np.empty(4, dtype=object) + out[3] = empty_point + actual = shapely.geometrycollections([point, line_string], indices=indices, out=out) + assert_geometries_equal(out, expected) + assert actual is out + + +def test_multipoints(): + actual = shapely.multipoints( + np.array([point], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multipoints([point])) + + +def test_multilinestrings(): + actual = shapely.multilinestrings( + np.array([line_string], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multilinestrings([line_string])) + + +def test_multilinearrings(): + actual = shapely.multilinestrings( + np.array([linear_ring], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multilinestrings([linear_ring])) + + +def test_multipolygons(): + actual = shapely.multipolygons( + np.array([polygon], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multipolygons([polygon])) + + +@pytest.mark.parametrize( + "geometries,func", + [ + ([point], shapely.polygons), + ([line_string], shapely.polygons), + ([polygon], shapely.polygons), + ([line_string], shapely.multipoints), + ([polygon], shapely.multipoints), + ([point], shapely.multilinestrings), + ([polygon], shapely.multilinestrings), + ([point], shapely.multipolygons), + ([line_string], shapely.multipolygons), + ], +) +def test_incompatible_types(geometries, func): + with pytest.raises(TypeError): + func(geometries, indices=[0]) diff --git a/billinglayer/python/shapely/tests/test_geometry.py b/billinglayer/python/shapely/tests/test_geometry.py new file mode 100644 index 0000000..3aac086 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_geometry.py @@ -0,0 +1,745 @@ +import warnings + +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, LineString, MultiPolygon, Point, Polygon +from shapely.testing import assert_geometries_equal + +from .common import all_types +from .common import empty as empty_geometry_collection +from .common import ( + empty_line_string, + empty_line_string_z, + empty_point, + empty_point_z, + empty_polygon, + geometry_collection, + geometry_collection_z, + line_string, + line_string_nan, + line_string_z, + linear_ring, + multi_line_string, + multi_line_string_z, + multi_point, + multi_point_z, + multi_polygon, + multi_polygon_z, + point, + point_z, + polygon, + polygon_with_hole, + polygon_with_hole_z, + polygon_z, +) + + +def test_get_num_points(): + actual = shapely.get_num_points(all_types + (None,)).tolist() + assert actual == [0, 3, 5, 0, 0, 0, 0, 0, 0, 0] + + +def test_get_num_interior_rings(): + actual = shapely.get_num_interior_rings(all_types + (polygon_with_hole, None)) + assert actual.tolist() == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] + + +def test_get_num_geometries(): + actual = shapely.get_num_geometries(all_types + (None,)).tolist() + assert actual == [1, 1, 1, 1, 2, 1, 2, 2, 0, 0] + + +@pytest.mark.parametrize( + "geom", + [ + point, + polygon, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + ], +) +def test_get_point_non_linestring(geom): + actual = shapely.get_point(geom, [0, 2, -1]) + assert shapely.is_missing(actual).all() + + +@pytest.mark.parametrize("geom", [line_string, linear_ring]) +def test_get_point(geom): + n = shapely.get_num_points(geom) + actual = shapely.get_point(geom, [0, -n, n, -(n + 1)]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +@pytest.mark.parametrize( + "geom", + [ + point, + line_string, + linear_ring, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + ], +) +def test_get_exterior_ring_non_polygon(geom): + actual = shapely.get_exterior_ring(geom) + assert shapely.is_missing(actual).all() + + +def test_get_exterior_ring(): + actual = shapely.get_exterior_ring([polygon, polygon_with_hole]) + assert (shapely.get_type_id(actual) == 2).all() + + +@pytest.mark.parametrize( + "geom", + [ + point, + line_string, + linear_ring, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + ], +) +def test_get_interior_ring_non_polygon(geom): + actual = shapely.get_interior_ring(geom, [0, 2, -1]) + assert shapely.is_missing(actual).all() + + +def test_get_interior_ring(): + actual = shapely.get_interior_ring(polygon_with_hole, [0, -1, 1, -2]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +@pytest.mark.parametrize("geom", [point, line_string, linear_ring, polygon]) +def test_get_geometry_simple(geom): + actual = shapely.get_geometry(geom, [0, -1, 1, -2]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +@pytest.mark.parametrize( + "geom", [multi_point, multi_line_string, multi_polygon, geometry_collection] +) +def test_get_geometry_collection(geom): + n = shapely.get_num_geometries(geom) + actual = shapely.get_geometry(geom, [0, -n, n, -(n + 1)]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +def test_get_type_id(): + actual = shapely.get_type_id(all_types).tolist() + assert actual == [0, 1, 2, 3, 4, 5, 6, 7, 7] + + +def test_get_dimensions(): + actual = shapely.get_dimensions(all_types).tolist() + assert actual == [0, 1, 1, 2, 0, 1, 2, 1, -1] + + +def test_get_coordinate_dimension(): + actual = shapely.get_coordinate_dimension([point, point_z, None]).tolist() + assert actual == [2, 3, -1] + + +def test_get_num_coordinates(): + actual = shapely.get_num_coordinates(all_types + (None,)).tolist() + assert actual == [1, 3, 5, 5, 2, 2, 10, 3, 0, 0] + + +def test_get_srid(): + """All geometry types have no SRID by default; None returns -1""" + actual = shapely.get_srid(all_types + (None,)).tolist() + assert actual == [0, 0, 0, 0, 0, 0, 0, 0, 0, -1] + + +def test_get_set_srid(): + actual = shapely.set_srid(point, 4326) + assert shapely.get_srid(point) == 0 + assert shapely.get_srid(actual) == 4326 + + +@pytest.mark.parametrize( + "func", + [ + shapely.get_x, + shapely.get_y, + pytest.param( + shapely.get_z, + marks=pytest.mark.skipif( + shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7" + ), + ), + ], +) +@pytest.mark.parametrize("geom", all_types[1:]) +def test_get_xyz_no_point(func, geom): + assert np.isnan(func(geom)) + + +def test_get_x(): + assert shapely.get_x([point, point_z]).tolist() == [2.0, 2.0] + + +def test_get_y(): + assert shapely.get_y([point, point_z]).tolist() == [3.0, 3.0] + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_get_z(): + assert shapely.get_z([point_z]).tolist() == [4.0] + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_get_z_2d(): + assert np.isnan(shapely.get_z(point)) + + +@pytest.mark.parametrize("geom", all_types) +def test_new_from_wkt(geom): + actual = shapely.from_wkt(str(geom)) + assert_geometries_equal(actual, geom) + + +def test_adapt_ptr_raises(): + point = Point(2, 2) + with pytest.raises(AttributeError): + point._geom += 1 + + +@pytest.mark.parametrize( + "geom", all_types + (shapely.points(np.nan, np.nan), empty_point) +) +def test_hash_same_equal(geom): + assert hash(geom) == hash(shapely.transform(geom, lambda x: x)) + + +@pytest.mark.parametrize("geom", all_types[:-1]) +def test_hash_same_not_equal(geom): + assert hash(geom) != hash(shapely.transform(geom, lambda x: x + 1)) + + +@pytest.mark.parametrize("geom", all_types) +def test_eq(geom): + assert geom == shapely.transform(geom, lambda x: x) + + +@pytest.mark.parametrize("geom", all_types[:-1]) +def test_neq(geom): + assert geom != shapely.transform(geom, lambda x: x + 1) + + +@pytest.mark.parametrize("geom", all_types) +def test_set_unique(geom): + a = {geom, shapely.transform(geom, lambda x: x)} + assert len(a) == 1 + + +def test_eq_nan(): + assert line_string_nan != line_string_nan + + +def test_neq_nan(): + assert not (line_string_nan == line_string_nan) + + +def test_set_nan(): + # As NaN != NaN, you can have multiple "NaN" points in a set + # set([float("nan"), float("nan")]) also returns a set with 2 elements + a = set(shapely.linestrings([[[np.nan, np.nan], [np.nan, np.nan]]] * 10)) + assert len(a) == 10 # different objects: NaN != NaN + + +def test_set_nan_same_objects(): + # You can't put identical objects in a set. + # x = float("nan"); set([x, x]) also retuns a set with 1 element + a = set([line_string_nan] * 10) + assert len(a) == 1 + + +@pytest.mark.parametrize( + "geom", + [ + point, + multi_point, + line_string, + multi_line_string, + polygon, + multi_polygon, + geometry_collection, + empty_point, + empty_line_string, + empty_polygon, + empty_geometry_collection, + np.array([None]), + np.empty_like(np.array([None])), + ], +) +def test_get_parts(geom): + expected_num_parts = shapely.get_num_geometries(geom) + if expected_num_parts == 0: + expected_parts = [] + else: + expected_parts = shapely.get_geometry(geom, range(0, expected_num_parts)) + + parts = shapely.get_parts(geom) + assert len(parts) == expected_num_parts + assert_geometries_equal(parts, expected_parts) + + +def test_get_parts_array(): + # note: this also verifies that None is handled correctly + # in the mix; internally it returns -1 for count of geometries + geom = np.array([None, empty_line_string, multi_point, point, multi_polygon]) + expected_parts = [] + for g in geom: + for i in range(0, shapely.get_num_geometries(g)): + expected_parts.append(shapely.get_geometry(g, i)) + + parts = shapely.get_parts(geom) + assert len(parts) == len(expected_parts) + assert_geometries_equal(parts, expected_parts) + + +def test_get_parts_geometry_collection_multi(): + """On the first pass, the individual Multi* geometry objects are returned + from the collection. On the second pass, the individual singular geometry + objects within those are returned. + """ + geom = shapely.geometrycollections([multi_point, multi_line_string, multi_polygon]) + expected_num_parts = shapely.get_num_geometries(geom) + expected_parts = shapely.get_geometry(geom, range(0, expected_num_parts)) + + parts = shapely.get_parts(geom) + assert len(parts) == expected_num_parts + assert_geometries_equal(parts, expected_parts) + + expected_subparts = [] + for g in np.asarray(expected_parts): + for i in range(0, shapely.get_num_geometries(g)): + expected_subparts.append(shapely.get_geometry(g, i)) + + subparts = shapely.get_parts(parts) + assert len(subparts) == len(expected_subparts) + assert_geometries_equal(subparts, expected_subparts) + + +def test_get_parts_return_index(): + geom = np.array([multi_point, point, multi_polygon]) + expected_parts = [] + expected_index = [] + for i, g in enumerate(geom): + for j in range(0, shapely.get_num_geometries(g)): + expected_parts.append(shapely.get_geometry(g, j)) + expected_index.append(i) + + parts, index = shapely.get_parts(geom, return_index=True) + assert len(parts) == len(expected_parts) + assert_geometries_equal(parts, expected_parts) + assert np.array_equal(index, expected_index) + + +@pytest.mark.parametrize( + "geom", + ([[None]], [[empty_point]], [[multi_point]], [[multi_point, multi_line_string]]), +) +def test_get_parts_invalid_dimensions(geom): + """Only 1D inputs are supported""" + with pytest.raises(ValueError, match="Array should be one dimensional"): + shapely.get_parts(geom) + + +@pytest.mark.parametrize("geom", [point, line_string, polygon]) +def test_get_parts_non_multi(geom): + """Non-multipart geometries should be returned identical to inputs""" + assert_geometries_equal(geom, shapely.get_parts(geom)) + + +@pytest.mark.parametrize("geom", [None, [None], []]) +def test_get_parts_None(geom): + assert len(shapely.get_parts(geom)) == 0 + + +@pytest.mark.parametrize("geom", ["foo", ["foo"], 42]) +def test_get_parts_invalid_geometry(geom): + with pytest.raises(TypeError, match="One of the arguments is of incorrect type."): + shapely.get_parts(geom) + + +@pytest.mark.parametrize( + "geom", + [ + point, + multi_point, + line_string, + multi_line_string, + polygon, + multi_polygon, + geometry_collection, + empty_point, + empty_line_string, + empty_polygon, + empty_geometry_collection, + None, + ], +) +def test_get_rings(geom): + if (shapely.get_type_id(geom) != shapely.GeometryType.POLYGON) or shapely.is_empty( + geom + ): + rings = shapely.get_rings(geom) + assert len(rings) == 0 + else: + rings = shapely.get_rings(geom) + assert len(rings) == 1 + assert rings[0] == shapely.get_exterior_ring(geom) + + +def test_get_rings_holes(): + rings = shapely.get_rings(polygon_with_hole) + assert len(rings) == 2 + assert rings[0] == shapely.get_exterior_ring(polygon_with_hole) + assert rings[1] == shapely.get_interior_ring(polygon_with_hole, 0) + + +def test_get_rings_return_index(): + geom = np.array([polygon, None, empty_polygon, polygon_with_hole]) + expected_parts = [] + expected_index = [] + for i, g in enumerate(geom): + if g is None or shapely.is_empty(g): + continue + expected_parts.append(shapely.get_exterior_ring(g)) + expected_index.append(i) + for j in range(0, shapely.get_num_interior_rings(g)): + expected_parts.append(shapely.get_interior_ring(g, j)) + expected_index.append(i) + + parts, index = shapely.get_rings(geom, return_index=True) + assert len(parts) == len(expected_parts) + assert_geometries_equal(parts, expected_parts) + assert np.array_equal(index, expected_index) + + +@pytest.mark.parametrize("geom", [[[None]], [[polygon]]]) +def test_get_rings_invalid_dimensions(geom): + """Only 1D inputs are supported""" + with pytest.raises(ValueError, match="Array should be one dimensional"): + shapely.get_parts(geom) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_get_precision(): + geometries = all_types + (point_z, empty_point, empty_line_string, empty_polygon) + # default is 0 + actual = shapely.get_precision(geometries).tolist() + assert actual == [0] * len(geometries) + + geometry = shapely.set_precision(geometries, 1) + actual = shapely.get_precision(geometry).tolist() + assert actual == [1] * len(geometries) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_get_precision_none(): + assert np.all(np.isnan(shapely.get_precision([None]))) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("mode", ("valid_output", "pointwise", "keep_collapsed")) +def test_set_precision(mode): + initial_geometry = Point(0.9, 0.9) + assert shapely.get_precision(initial_geometry) == 0 + + geometry = shapely.set_precision(initial_geometry, 0, mode=mode) + assert shapely.get_precision(geometry) == 0 + assert_geometries_equal(geometry, initial_geometry) + + geometry = shapely.set_precision(initial_geometry, 1, mode=mode) + assert shapely.get_precision(geometry) == 1 + assert_geometries_equal(geometry, Point(1, 1)) + # original should remain unchanged + assert_geometries_equal(initial_geometry, Point(0.9, 0.9)) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_drop_coords(): + # setting precision of 0 will not drop duplicated points in original + geometry = shapely.set_precision(LineString([(0, 0), (0, 0), (0, 1), (1, 1)]), 0) + assert_geometries_equal(geometry, LineString([(0, 0), (0, 0), (0, 1), (1, 1)])) + + # setting precision will remove duplicated points + geometry = shapely.set_precision(geometry, 1) + assert_geometries_equal(geometry, LineString([(0, 0), (0, 1), (1, 1)])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("mode", ("valid_output", "pointwise", "keep_collapsed")) +def test_set_precision_z(mode): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") # GEOS <= 3.9 emits warning for 'pointwise' + geometry = shapely.set_precision(Point(0.9, 0.9, 0.9), 1, mode=mode) + assert shapely.get_precision(geometry) == 1 + assert_geometries_equal(geometry, Point(1, 1, 0.9)) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("mode", ("valid_output", "pointwise", "keep_collapsed")) +def test_set_precision_nan(mode): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") # GEOS <= 3.9 emits warning for 'pointwise' + actual = shapely.set_precision(line_string_nan, 1, mode=mode) + assert_geometries_equal(actual, line_string_nan) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_none(): + assert shapely.set_precision(None, 0) is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_grid_size_nan(): + assert shapely.set_precision(Point(0.9, 0.9), np.nan) is None + + +@pytest.mark.parametrize( + "geometry,mode,expected", + [ + ( + Polygon([(2, 2), (4, 2), (3.2, 3), (4, 4), (2, 4), (2.8, 3), (2, 2)]), + "valid_output", + MultiPolygon( + [ + Polygon([(4, 2), (2, 2), (3, 3), (4, 2)]), + Polygon([(2, 4), (4, 4), (3, 3), (2, 4)]), + ] + ), + ), + pytest.param( + Polygon([(2, 2), (4, 2), (3.2, 3), (4, 4), (2, 4), (2.8, 3), (2, 2)]), + "pointwise", + Polygon([(2, 2), (4, 2), (3, 3), (4, 4), (2, 4), (3, 3), (2, 2)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + ( + Polygon([(2, 2), (4, 2), (3.2, 3), (4, 4), (2, 4), (2.8, 3), (2, 2)]), + "keep_collapsed", + MultiPolygon( + [ + Polygon([(4, 2), (2, 2), (3, 3), (4, 2)]), + Polygon([(2, 4), (4, 4), (3, 3), (2, 4)]), + ] + ), + ), + (LineString([(0, 0), (0.1, 0.1)]), "valid_output", LineString()), + pytest.param( + LineString([(0, 0), (0.1, 0.1)]), + "pointwise", + LineString([(0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + ( + LineString([(0, 0), (0.1, 0.1)]), + "keep_collapsed", + LineString([(0, 0), (0, 0)]), + ), + pytest.param( + LinearRing([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "valid_output", + LinearRing(), + marks=pytest.mark.skipif( + shapely.geos_version == (3, 10, 0), reason="Segfaults on GEOS 3.10.0" + ), + ), + pytest.param( + LinearRing([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "pointwise", + LinearRing([(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + pytest.param( + LinearRing([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "keep_collapsed", + # See https://trac.osgeo.org/geos/ticket/1135#comment:5 + LineString([(0, 0), (0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="this collapsed into an invalid linearring pre-GEOS 3.10", + ), + ), + ( + Polygon([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "valid_output", + Polygon(), + ), + pytest.param( + Polygon([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "pointwise", + Polygon([(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + ( + Polygon([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "keep_collapsed", + Polygon(), + ), + ], +) +def test_set_precision_collapse(geometry, mode, expected): + """Lines and polygons collapse to empty geometries if vertices are too close""" + actual = shapely.set_precision(geometry, 1, mode=mode) + if shapely.geos_version < (3, 9, 0): + # pre GEOS 3.9 has difficulty comparing empty geometries exactly + # normalize and compare by WKT instead + assert shapely.to_wkt(shapely.normalize(actual)) == shapely.to_wkt( + shapely.normalize(expected) + ) + else: + # force to 2D because GEOS 3.10 yields 3D geometries when they are empty. + assert_geometries_equal(shapely.force_2d(actual), expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_intersection(): + """Operations should use the most precise presision grid size of the inputs""" + + box1 = shapely.normalize(shapely.box(0, 0, 0.9, 0.9)) + box2 = shapely.normalize(shapely.box(0.75, 0, 1.75, 0.75)) + + assert shapely.get_precision(shapely.intersection(box1, box2)) == 0 + + # GEOS will use and keep the most precise precision grid size + box1 = shapely.set_precision(box1, 0.5) + box2 = shapely.set_precision(box2, 1) + out = shapely.intersection(box1, box2) + assert shapely.get_precision(out) == 0.5 + assert_geometries_equal(out, LineString([(1, 1), (1, 0)])) + + +@pytest.mark.parametrize("preserve_topology", [False, True]) +def set_precision_preserve_topology(preserve_topology): + # the preserve_topology kwarg is deprecated (ignored) + with pytest.warns(UserWarning): + actual = shapely.set_precision( + LineString([(0, 0), (0.1, 0.1)]), + 1.0, + preserve_topology=preserve_topology, + ) + assert_geometries_equal(shapely.force_2d(actual), LineString()) + + +@pytest.mark.skipif(shapely.geos_version >= (3, 10, 0), reason="GEOS >= 3.10") +def set_precision_pointwise_pre_310(): + # using 'pointwise' emits a warning + with pytest.warns(UserWarning): + actual = shapely.set_precision( + LineString([(0, 0), (0.1, 0.1)]), + 1.0, + mode="pointwise", + ) + assert_geometries_equal(shapely.force_2d(actual), LineString()) + + +@pytest.mark.parametrize("flags", [np.array([0, 1]), 4, "foo"]) +def set_precision_illegal_flags(flags): + # the preserve_topology kwarg is deprecated (ignored) + with pytest.raises((ValueError, TypeError)): + shapely.lib.set_precision(line_string, 1.0, flags) + + +def test_empty(): + """Compatibility with empty_like, see GH373""" + g = np.empty_like(np.array([None, None])) + assert shapely.is_missing(g).all() + + +# corresponding to geometry_collection_z: +geometry_collection_2 = shapely.geometrycollections([point, line_string]) +empty_geom_mark = pytest.mark.skipif( + shapely.geos_version < (3, 9, 0), + reason="Empty points don't have a dimensionality before GEOS 3.9", +) + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point), + (point_z, point), + pytest.param(empty_point, empty_point, marks=empty_geom_mark), + pytest.param(empty_point_z, empty_point, marks=empty_geom_mark), + (line_string, line_string), + (line_string_z, line_string), + pytest.param(empty_line_string, empty_line_string, marks=empty_geom_mark), + pytest.param(empty_line_string_z, empty_line_string, marks=empty_geom_mark), + (polygon, polygon), + (polygon_z, polygon), + (polygon_with_hole, polygon_with_hole), + (polygon_with_hole_z, polygon_with_hole), + (multi_point, multi_point), + (multi_point_z, multi_point), + (multi_line_string, multi_line_string), + (multi_line_string_z, multi_line_string), + (multi_polygon, multi_polygon), + (multi_polygon_z, multi_polygon), + (geometry_collection_2, geometry_collection_2), + (geometry_collection_z, geometry_collection_2), + ], +) +def test_force_2d(geom, expected): + actual = shapely.force_2d(geom) + assert shapely.get_coordinate_dimension(actual) == 2 + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point_z), + (point_z, point_z), + pytest.param(empty_point, empty_point_z, marks=empty_geom_mark), + pytest.param(empty_point_z, empty_point_z, marks=empty_geom_mark), + (line_string, line_string_z), + (line_string_z, line_string_z), + pytest.param(empty_line_string, empty_line_string_z, marks=empty_geom_mark), + pytest.param(empty_line_string_z, empty_line_string_z, marks=empty_geom_mark), + (polygon, polygon_z), + (polygon_z, polygon_z), + (polygon_with_hole, polygon_with_hole_z), + (polygon_with_hole_z, polygon_with_hole_z), + (multi_point, multi_point_z), + (multi_point_z, multi_point_z), + (multi_line_string, multi_line_string_z), + (multi_line_string_z, multi_line_string_z), + (multi_polygon, multi_polygon_z), + (multi_polygon_z, multi_polygon_z), + (geometry_collection_2, geometry_collection_z), + (geometry_collection_z, geometry_collection_z), + ], +) +def test_force_3d(geom, expected): + actual = shapely.force_3d(geom, z=4) + assert shapely.get_coordinate_dimension(actual) == 3 + assert_geometries_equal(actual, expected) diff --git a/billinglayer/python/shapely/tests/test_io.py b/billinglayer/python/shapely/tests/test_io.py new file mode 100644 index 0000000..48e61cd --- /dev/null +++ b/billinglayer/python/shapely/tests/test_io.py @@ -0,0 +1,722 @@ +import json +import pickle +import struct +import warnings + +import numpy as np +import pytest + +import shapely +from shapely import GeometryCollection, LineString, Point, Polygon +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import all_types, empty_point, empty_point_z, point, point_z + +# fmt: off +POINT11_WKB = b"\x01\x01\x00\x00\x00" + struct.pack("<2d", 1.0, 1.0) +NAN = struct.pack("= (3, 9, 0), + reason="MULTIPOINT (EMPTY, 2 3) gives ValueError on GEOS < 3.9", +) +def test_to_wkt_multipoint_with_point_empty_errors(): + # test if segfault is prevented + geom = shapely.multipoints([empty_point, point]) + with pytest.raises(ValueError): + shapely.to_wkt(geom) + + +def test_repr(): + assert repr(point) == "" + + +def test_repr_max_length(): + # the repr is limited to 80 characters + geom = shapely.linestrings(np.arange(1000), np.arange(1000)) + representation = repr(geom) + assert len(representation) == 80 + assert representation.endswith("...>") + + +@pytest.mark.skipif( + shapely.geos_version >= (3, 9, 0), + reason="MULTIPOINT (EMPTY, 2 3) gives Exception on GEOS < 3.9", +) +def test_repr_multipoint_with_point_empty(): + # Test if segfault is prevented + geom = shapely.multipoints([point, empty_point]) + assert repr(geom) == "" + + +@pytest.mark.skipif( + shapely.geos_version < (3, 9, 0), + reason="Empty geometries have no dimensionality on GEOS < 3.9", +) +def test_repr_point_z_empty(): + assert repr(empty_point_z) == "" + + +def test_to_wkb(): + point = shapely.points(1, 1) + actual = shapely.to_wkb(point, byte_order=1) + assert actual == POINT11_WKB + + +def test_to_wkb_hex(): + point = shapely.points(1, 1) + actual = shapely.to_wkb(point, hex=True, byte_order=1) + le = "01" + point_type = "01000000" + coord = "000000000000F03F" # 1.0 as double (LE) + assert actual == le + point_type + 2 * coord + + +def test_to_wkb_3D(): + point_z = shapely.points(1, 1, 1) + actual = shapely.to_wkb(point_z, byte_order=1) + # fmt: off + assert actual == b"\x01\x01\x00\x00\x80\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?" # noqa + # fmt: on + actual = shapely.to_wkb(point_z, output_dimension=2, byte_order=1) + assert actual == POINT11_WKB + + +def test_to_wkb_none(): + # None propagates + assert shapely.to_wkb(None) is None + + +def test_to_wkb_exceptions(): + with pytest.raises(TypeError): + shapely.to_wkb(1) + + with pytest.raises(shapely.GEOSException): + shapely.to_wkb(point, output_dimension=5) + + with pytest.raises(ValueError): + shapely.to_wkb(point, flavor="other") + + +def test_to_wkb_byte_order(): + point = shapely.points(1.0, 1.0) + be = b"\x00" + le = b"\x01" + point_type = b"\x01\x00\x00\x00" # 1 as 32-bit uint (LE) + coord = b"\x00\x00\x00\x00\x00\x00\xf0?" # 1.0 as double (LE) + + assert shapely.to_wkb(point, byte_order=1) == le + point_type + 2 * coord + assert ( + shapely.to_wkb(point, byte_order=0) == be + point_type[::-1] + 2 * coord[::-1] + ) + + +def test_to_wkb_srid(): + # hex representation of POINT (0 0) with SRID=4 + ewkb = "01010000200400000000000000000000000000000000000000" + wkb = "010100000000000000000000000000000000000000" + + actual = shapely.from_wkb(ewkb) + assert shapely.to_wkt(actual, trim=True) == "POINT (0 0)" + + assert shapely.to_wkb(actual, hex=True, byte_order=1) == wkb + assert shapely.to_wkb(actual, hex=True, include_srid=True, byte_order=1) == ewkb + + point = shapely.points(1, 1) + point_with_srid = shapely.set_srid(point, np.int32(4326)) + result = shapely.to_wkb(point_with_srid, include_srid=True, byte_order=1) + assert np.frombuffer(result[5:9], "= (3, 10, 0), reason="GEOS < 3.10.0") +def test_to_wkb_flavor_unsupported_geos(): + with pytest.raises(UnsupportedGEOSVersionError): + shapely.to_wkb(point_z, flavor="iso") + + +@pytest.mark.parametrize( + "geom,expected", + [ + (empty_point, POINT_NAN_WKB), + (empty_point_z, POINT_NAN_WKB), + (shapely.multipoints([empty_point]), MULTIPOINT_NAN_WKB), + (shapely.multipoints([empty_point_z]), MULTIPOINT_NAN_WKB), + (shapely.geometrycollections([empty_point]), GEOMETRYCOLLECTION_NAN_WKB), + (shapely.geometrycollections([empty_point_z]), GEOMETRYCOLLECTION_NAN_WKB), + ( + shapely.geometrycollections([shapely.multipoints([empty_point])]), + NESTED_COLLECTION_NAN_WKB, + ), + ( + shapely.geometrycollections([shapely.multipoints([empty_point_z])]), + NESTED_COLLECTION_NAN_WKB, + ), + ], +) +def test_to_wkb_point_empty_2d(geom, expected): + actual = shapely.to_wkb(geom, output_dimension=2, byte_order=1) + # Split 'actual' into header and coordinates + coordinate_length = 16 + header_length = len(expected) - coordinate_length + # Check the total length (this checks the correct dimensionality) + assert len(actual) == header_length + coordinate_length + # Check the header + assert actual[:header_length] == expected[:header_length] + # Check the coordinates (using numpy.isnan; there are many byte representations for NaN) + assert np.isnan(struct.unpack("<2d", actual[header_length:])).all() + + +@pytest.mark.xfail( + shapely.geos_version[:2] == (3, 8), reason="GEOS==3.8 never outputs 3D empty points" +) +@pytest.mark.parametrize( + "geom,expected", + [ + (empty_point_z, POINTZ_NAN_WKB), + (shapely.multipoints([empty_point_z]), MULTIPOINTZ_NAN_WKB), + (shapely.geometrycollections([empty_point_z]), GEOMETRYCOLLECTIONZ_NAN_WKB), + ( + shapely.geometrycollections([shapely.multipoints([empty_point_z])]), + NESTED_COLLECTIONZ_NAN_WKB, + ), + ], +) +def test_to_wkb_point_empty_3d(geom, expected): + actual = shapely.to_wkb(geom, output_dimension=3, byte_order=1) + # Split 'actual' into header and coordinates + coordinate_length = 24 + header_length = len(expected) - coordinate_length + # Check the total length (this checks the correct dimensionality) + assert len(actual) == header_length + coordinate_length + # Check the header + assert actual[:header_length] == expected[:header_length] + # Check the coordinates (using numpy.isnan; there are many byte representations for NaN) + assert np.isnan(struct.unpack("<3d", actual[header_length:])).all() + + +@pytest.mark.xfail( + shapely.geos_version < (3, 8, 0), + reason="GEOS<3.8 always outputs 3D empty points if output_dimension=3", +) +@pytest.mark.parametrize( + "geom,expected", + [ + (empty_point, POINT_NAN_WKB), + (shapely.multipoints([empty_point]), MULTIPOINT_NAN_WKB), + (shapely.geometrycollections([empty_point]), GEOMETRYCOLLECTION_NAN_WKB), + ( + shapely.geometrycollections([shapely.multipoints([empty_point])]), + NESTED_COLLECTION_NAN_WKB, + ), + ], +) +def test_to_wkb_point_empty_2d_output_dim_3(geom, expected): + actual = shapely.to_wkb(geom, output_dimension=3, byte_order=1) + # Split 'actual' into header and coordinates + coordinate_length = 16 + header_length = len(expected) - coordinate_length + # Check the total length (this checks the correct dimensionality) + assert len(actual) == header_length + coordinate_length + # Check the header + assert actual[:header_length] == expected[:header_length] + # Check the coordinates (using numpy.isnan; there are many byte representations for NaN) + assert np.isnan(struct.unpack("<2d", actual[header_length:])).all() + + +@pytest.mark.parametrize( + "wkb,expected_type,expected_dim", + [ + (POINT_NAN_WKB, 0, 2), + (POINTZ_NAN_WKB, 0, 3), + (MULTIPOINT_NAN_WKB, 4, 2), + (MULTIPOINTZ_NAN_WKB, 4, 3), + (GEOMETRYCOLLECTION_NAN_WKB, 7, 2), + (GEOMETRYCOLLECTIONZ_NAN_WKB, 7, 3), + (NESTED_COLLECTION_NAN_WKB, 7, 2), + (NESTED_COLLECTIONZ_NAN_WKB, 7, 3), + ], +) +def test_from_wkb_point_empty(wkb, expected_type, expected_dim): + geom = shapely.from_wkb(wkb) + # POINT (nan nan) transforms to an empty point + assert shapely.is_empty(geom) + assert shapely.get_type_id(geom) == expected_type + # The dimensionality (2D/3D) is only read correctly for GEOS >= 3.9.0 + if shapely.geos_version >= (3, 9, 0): + assert shapely.get_coordinate_dimension(geom) == expected_dim + + +def test_to_wkb_point_empty_srid(): + expected = shapely.set_srid(empty_point, 4236) + wkb = shapely.to_wkb(expected, include_srid=True) + actual = shapely.from_wkb(wkb) + assert shapely.get_srid(actual) == 4236 + + +@pytest.mark.parametrize("geom", all_types + (point_z, empty_point)) +def test_pickle(geom): + pickled = pickle.dumps(geom) + assert_geometries_equal(pickle.loads(pickled), geom, tolerance=0) + + +@pytest.mark.parametrize("geom", all_types + (point_z, empty_point)) +def test_pickle_with_srid(geom): + geom = shapely.set_srid(geom, 4326) + pickled = pickle.dumps(geom) + assert shapely.get_srid(pickle.loads(pickled)) == 4326 + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +@pytest.mark.parametrize( + "geojson,expected", + [ + (GEOJSON_GEOMETRY, GEOJSON_GEOMETRY_EXPECTED), + (GEOJSON_FEATURE, GEOJSON_GEOMETRY_EXPECTED), + ( + GEOJSON_FEATURECOLECTION, + shapely.geometrycollections(GEOJSON_COLLECTION_EXPECTED), + ), + ([GEOJSON_GEOMETRY] * 2, [GEOJSON_GEOMETRY_EXPECTED] * 2), + (None, None), + ([GEOJSON_GEOMETRY, None], [GEOJSON_GEOMETRY_EXPECTED, None]), + ], +) +def test_from_geojson(geojson, expected): + actual = shapely.from_geojson(geojson) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_exceptions(): + with pytest.raises(TypeError, match="Expected bytes or string, got int"): + shapely.from_geojson(1) + + with pytest.raises(shapely.GEOSException, match="Error parsing JSON"): + shapely.from_geojson("") + + with pytest.raises(shapely.GEOSException, match="Unknown geometry type"): + shapely.from_geojson('{"type": "NoGeometry", "coordinates": []}') + + with pytest.raises(shapely.GEOSException, match="type must be array, but is null"): + shapely.from_geojson('{"type": "LineString", "coordinates": null}') + + # Note: The two below tests are the reason that from_geojson is disabled for + # GEOS 3.10.0 See https://trac.osgeo.org/geos/ticket/1138 + with pytest.raises(shapely.GEOSException, match="key 'type' not found"): + shapely.from_geojson('{"geometry": null, "properties": []}') + + with pytest.raises(shapely.GEOSException, match="key 'type' not found"): + shapely.from_geojson('{"no": "geojson"}') + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_warn_on_invalid(): + with pytest.warns(Warning, match="Invalid GeoJSON"): + assert shapely.from_geojson("", on_invalid="warn") is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_ignore_on_invalid(): + with warnings.catch_warnings(): + warnings.simplefilter("error") + assert shapely.from_geojson("", on_invalid="ignore") is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_on_invalid_unsupported_option(): + with pytest.raises(ValueError, match="not a valid option"): + shapely.from_geojson(GEOJSON_GEOMETRY, on_invalid="unsupported_option") + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "expected,geometry", + [ + (GEOJSON_GEOMETRY, GEOJSON_GEOMETRY_EXPECTED), + ([GEOJSON_GEOMETRY] * 2, [GEOJSON_GEOMETRY_EXPECTED] * 2), + (None, None), + ([GEOJSON_GEOMETRY, None], [GEOJSON_GEOMETRY_EXPECTED, None]), + ], +) +def test_to_geojson(geometry, expected): + actual = shapely.to_geojson(geometry, indent=4) + assert np.all(actual == np.asarray(expected)) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("indent", [None, 0, 4]) +def test_to_geojson_indent(indent): + separators = (",", ":") if indent is None else (",", ": ") + expected = json.dumps( + json.loads(GEOJSON_GEOMETRY), indent=indent, separators=separators + ) + actual = shapely.to_geojson(GEOJSON_GEOMETRY_EXPECTED, indent=indent) + assert actual == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_to_geojson_exceptions(): + with pytest.raises(TypeError): + shapely.to_geojson(1) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geom", + [ + empty_point, + shapely.multipoints([empty_point, point]), + shapely.geometrycollections([empty_point, point]), + shapely.geometrycollections( + [shapely.geometrycollections([empty_point]), point] + ), + ], +) +def test_to_geojson_point_empty(geom): + # Pending GEOS ticket: https://trac.osgeo.org/geos/ticket/1139 + with pytest.raises(ValueError): + assert shapely.to_geojson(geom) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +@pytest.mark.parametrize("geom", all_types) +def test_geojson_all_types(geom): + if shapely.get_type_id(geom) == shapely.GeometryType.LINEARRING: + pytest.skip("Linearrings are not preserved in GeoJSON") + geojson = shapely.to_geojson(geom) + actual = shapely.from_geojson(geojson) + assert_geometries_equal(actual, geom) diff --git a/billinglayer/python/shapely/tests/test_linear.py b/billinglayer/python/shapely/tests/test_linear.py new file mode 100644 index 0000000..05fd651 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_linear.py @@ -0,0 +1,213 @@ +import numpy as np +import pytest + +import shapely +from shapely import GeometryCollection, LinearRing, LineString, MultiLineString, Point +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import ( + empty_line_string, + empty_point, + line_string, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + polygon, +) + + +def test_line_interpolate_point_geom_array(): + actual = shapely.line_interpolate_point( + [line_string, linear_ring, multi_line_string], -1 + ) + assert_geometries_equal(actual[0], Point(1, 0)) + assert_geometries_equal(actual[1], Point(0, 1)) + assert_geometries_equal(actual[2], Point(0.5528, 1.1056), tolerance=0.001) + + +def test_line_interpolate_point_geom_array_normalized(): + actual = shapely.line_interpolate_point( + [line_string, linear_ring, multi_line_string], 1, normalized=True + ) + assert_geometries_equal(actual[0], Point(1, 1)) + assert_geometries_equal(actual[1], Point(0, 0)) + assert_geometries_equal(actual[2], Point(1, 2)) + + +def test_line_interpolate_point_float_array(): + actual = shapely.line_interpolate_point(line_string, [0.2, 1.5, -0.2]) + assert_geometries_equal(actual[0], Point(0.2, 0)) + assert_geometries_equal(actual[1], Point(1, 0.5)) + assert_geometries_equal(actual[2], Point(1, 0.8)) + + +@pytest.mark.parametrize("normalized", [False, True]) +@pytest.mark.parametrize( + "geom", + [ + LineString(), + LinearRing(), + MultiLineString(), + shapely.from_wkt("MULTILINESTRING (EMPTY, (0 0, 1 1))"), + GeometryCollection(), + GeometryCollection([LineString(), Point(1, 1)]), + ], +) +def test_line_interpolate_point_empty(geom, normalized): + # These geometries segfault in some versions of GEOS (in 3.8.0, still + # some of them segfault). Instead, we patched this to return POINT EMPTY. + # This matches GEOS 3.8.0 behavior on simple empty geometries. + assert_geometries_equal( + shapely.line_interpolate_point(geom, 0.2, normalized=normalized), empty_point + ) + + +@pytest.mark.parametrize("normalized", [False, True]) +@pytest.mark.parametrize( + "geom", + [ + empty_point, + point, + polygon, + multi_point, + multi_polygon, + shapely.geometrycollections([point]), + shapely.geometrycollections([polygon]), + shapely.geometrycollections([multi_line_string]), + shapely.geometrycollections([multi_point]), + shapely.geometrycollections([multi_polygon]), + ], +) +def test_line_interpolate_point_invalid_type(geom, normalized): + with pytest.raises(TypeError): + assert shapely.line_interpolate_point(geom, 0.2, normalized=normalized) + + +def test_line_interpolate_point_none(): + assert shapely.line_interpolate_point(None, 0.2) is None + + +def test_line_interpolate_point_nan(): + assert shapely.line_interpolate_point(line_string, np.nan) is None + + +def test_line_locate_point_geom_array(): + point = shapely.points(0, 1) + actual = shapely.line_locate_point([line_string, linear_ring], point) + np.testing.assert_allclose(actual, [0.0, 3.0]) + + +def test_line_locate_point_geom_array2(): + points = shapely.points([[0, 0], [1, 0]]) + actual = shapely.line_locate_point(line_string, points) + np.testing.assert_allclose(actual, [0.0, 1.0]) + + +@pytest.mark.parametrize("normalized", [False, True]) +def test_line_locate_point_none(normalized): + assert np.isnan(shapely.line_locate_point(line_string, None, normalized=normalized)) + assert np.isnan(shapely.line_locate_point(None, point, normalized=normalized)) + + +@pytest.mark.parametrize("normalized", [False, True]) +def test_line_locate_point_empty(normalized): + assert np.isnan( + shapely.line_locate_point(line_string, empty_point, normalized=normalized) + ) + assert np.isnan( + shapely.line_locate_point(empty_line_string, point, normalized=normalized) + ) + + +@pytest.mark.parametrize("normalized", [False, True]) +def test_line_locate_point_invalid_geometry(normalized): + with pytest.raises(shapely.GEOSException): + shapely.line_locate_point(line_string, line_string, normalized=normalized) + + with pytest.raises(shapely.GEOSException): + shapely.line_locate_point(polygon, point, normalized=normalized) + + +def test_line_merge_geom_array(): + actual = shapely.line_merge([line_string, multi_line_string]) + assert_geometries_equal(actual[0], line_string) + assert_geometries_equal(actual[1], LineString([(0, 0), (1, 2)])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11.0") +def test_line_merge_directed(): + lines = MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]]) + # Merge lines without directed, this requires changing the vertex ordering + result = shapely.line_merge(lines) + assert_geometries_equal(result, LineString([(1, 0), (0, 0), (3, 0)])) + # Since the lines can't be merged when directed is specified + # the original geometry is returned + result = shapely.line_merge(lines, directed=True) + assert_geometries_equal(result, lines) + + +@pytest.mark.skipif(shapely.geos_version >= (3, 11, 0), reason="GEOS >= 3.11.0") +def test_line_merge_error(): + lines = MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]]) + with pytest.raises(UnsupportedGEOSVersionError): + shapely.line_merge(lines, directed=True) + + +def test_shared_paths_linestring(): + g1 = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + g2 = shapely.linestrings([(0, 0), (1, 0)]) + actual1 = shapely.shared_paths(g1, g2) + assert_geometries_equal( + shapely.get_geometry(actual1, 0), shapely.multilinestrings([g2]) + ) + + +def test_shared_paths_none(): + assert shapely.shared_paths(line_string, None) is None + assert shapely.shared_paths(None, line_string) is None + assert shapely.shared_paths(None, None) is None + + +def test_shared_paths_non_linestring(): + g1 = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + g2 = shapely.points(0, 1) + with pytest.raises(shapely.GEOSException): + shapely.shared_paths(g1, g2) + + +def _prepare_input(geometry, prepare): + """Prepare without modifying inplace""" + if prepare: + geometry = shapely.transform(geometry, lambda x: x) # makes a copy + shapely.prepare(geometry) + return geometry + else: + return geometry + + +@pytest.mark.parametrize("prepare", [True, False]) +def test_shortest_line(prepare): + g1 = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + g2 = shapely.linestrings([(0, 3), (3, 0)]) + actual = shapely.shortest_line(_prepare_input(g1, prepare), g2) + expected = shapely.linestrings([(1, 1), (1.5, 1.5)]) + assert shapely.equals(actual, expected) + + +@pytest.mark.parametrize("prepare", [True, False]) +def test_shortest_line_none(prepare): + assert shapely.shortest_line(_prepare_input(line_string, prepare), None) is None + assert shapely.shortest_line(None, line_string) is None + assert shapely.shortest_line(None, None) is None + + +@pytest.mark.parametrize("prepare", [True, False]) +def test_shortest_line_empty(prepare): + g1 = _prepare_input(line_string, prepare) + assert shapely.shortest_line(g1, empty_line_string) is None + g1_empty = _prepare_input(empty_line_string, prepare) + assert shapely.shortest_line(g1_empty, line_string) is None + assert shapely.shortest_line(g1_empty, empty_line_string) is None diff --git a/billinglayer/python/shapely/tests/test_measurement.py b/billinglayer/python/shapely/tests/test_measurement.py new file mode 100644 index 0000000..db85791 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_measurement.py @@ -0,0 +1,356 @@ +import numpy as np +import pytest +from numpy.testing import assert_allclose, assert_array_equal + +import shapely +from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + +from .common import ( + empty, + geometry_collection, + ignore_invalid, + line_string, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + point_polygon_testdata, + polygon, + polygon_with_hole, +) + + +@pytest.mark.parametrize( + "geom", + [ + point, + line_string, + linear_ring, + multi_point, + multi_line_string, + geometry_collection, + ], +) +def test_area_non_polygon(geom): + assert shapely.area(geom) == 0.0 + + +def test_area(): + actual = shapely.area([polygon, polygon_with_hole, multi_polygon]) + assert actual.tolist() == [4.0, 96.0, 1.01] + + +def test_distance(): + actual = shapely.distance(*point_polygon_testdata) + expected = [2 * 2**0.5, 2**0.5, 0, 0, 0, 2**0.5] + np.testing.assert_allclose(actual, expected) + + +def test_distance_missing(): + actual = shapely.distance(point, None) + assert np.isnan(actual) + + +def test_distance_duplicated(): + a = Point(1, 2) + b = LineString([(0, 0), (0, 0), (1, 1)]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # https://github.com/shapely/shapely/issues/1552 + # GEOS < 3.12 raises "invalid" floating point errors + actual = shapely.distance(a, b) + assert actual == 1.0 + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, [2, 3, 2, 3]), + ([point, multi_point], [[2, 3, 2, 3], [0, 0, 1, 2]]), + (shapely.linestrings([[0, 0], [0, 1]]), [0, 0, 0, 1]), + (shapely.linestrings([[0, 0], [1, 0]]), [0, 0, 1, 0]), + (multi_point, [0, 0, 1, 2]), + (multi_polygon, [0, 0, 2.2, 2.2]), + (geometry_collection, [49, -1, 52, 2]), + (empty, [np.nan, np.nan, np.nan, np.nan]), + (None, [np.nan, np.nan, np.nan, np.nan]), + ], +) +def test_bounds(geom, expected): + assert_array_equal(shapely.bounds(geom), expected) + + +@pytest.mark.parametrize( + "geom,shape", + [ + (point, (4,)), + (None, (4,)), + ([point, multi_point], (2, 4)), + ([[point, multi_point], [polygon, point]], (2, 2, 4)), + ([[[point, multi_point]], [[polygon, point]]], (2, 1, 2, 4)), + ], +) +def test_bounds_dimensions(geom, shape): + assert shapely.bounds(geom).shape == shape + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, [2, 3, 2, 3]), + (shapely.linestrings([[0, 0], [0, 1]]), [0, 0, 0, 1]), + (shapely.linestrings([[0, 0], [1, 0]]), [0, 0, 1, 0]), + (multi_point, [0, 0, 1, 2]), + (multi_polygon, [0, 0, 2.2, 2.2]), + (geometry_collection, [49, -1, 52, 2]), + (empty, [np.nan, np.nan, np.nan, np.nan]), + (None, [np.nan, np.nan, np.nan, np.nan]), + ([empty, empty, None], [np.nan, np.nan, np.nan, np.nan]), + # mixed missing and non-missing coordinates + ([point, None], [2, 3, 2, 3]), + ([point, empty], [2, 3, 2, 3]), + ([point, empty, None], [2, 3, 2, 3]), + ([point, empty, None, multi_point], [0, 0, 2, 3]), + ], +) +def test_total_bounds(geom, expected): + assert_array_equal(shapely.total_bounds(geom), expected) + + +@pytest.mark.parametrize( + "geom", + [ + point, + None, + [point, multi_point], + [[point, multi_point], [polygon, point]], + [[[point, multi_point]], [[polygon, point]]], + ], +) +def test_total_bounds_dimensions(geom): + assert shapely.total_bounds(geom).shape == (4,) + + +def test_length(): + actual = shapely.length( + [ + point, + line_string, + linear_ring, + polygon, + polygon_with_hole, + multi_point, + multi_polygon, + ] + ) + assert actual.tolist() == [0.0, 2.0, 4.0, 8.0, 48.0, 0.0, 4.4] + + +def test_length_missing(): + actual = shapely.length(None) + assert np.isnan(actual) + + +def test_hausdorff_distance(): + # example from GEOS docs + a = shapely.linestrings([[0, 0], [100, 0], [10, 100], [10, 100]]) + b = shapely.linestrings([[0, 100], [0, 10], [80, 10]]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Hausdorff distance emits "invalid value encountered" + # (see https://github.com/libgeos/geos/issues/515) + actual = shapely.hausdorff_distance(a, b) + assert actual == pytest.approx(22.360679775, abs=1e-7) + + +def test_hausdorff_distance_densify(): + # example from GEOS docs + a = shapely.linestrings([[0, 0], [100, 0], [10, 100], [10, 100]]) + b = shapely.linestrings([[0, 100], [0, 10], [80, 10]]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Hausdorff distance emits "invalid value encountered" + # (see https://github.com/libgeos/geos/issues/515) + actual = shapely.hausdorff_distance(a, b, densify=0.001) + assert actual == pytest.approx(47.8, abs=0.1) + + +def test_hausdorff_distance_missing(): + actual = shapely.hausdorff_distance(point, None) + assert np.isnan(actual) + actual = shapely.hausdorff_distance(point, None, densify=0.001) + assert np.isnan(actual) + + +def test_hausdorff_densify_nan(): + actual = shapely.hausdorff_distance(point, point, densify=np.nan) + assert np.isnan(actual) + + +def test_distance_empty(): + actual = shapely.distance(point, empty) + assert np.isnan(actual) + + +def test_hausdorff_distance_empty(): + actual = shapely.hausdorff_distance(point, empty) + assert np.isnan(actual) + + +def test_hausdorff_distance_densify_empty(): + actual = shapely.hausdorff_distance(point, empty, densify=0.2) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom1, geom2, expected", + [ + # identical geometries should have 0 distance + ( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [100, 0]]), + 0, + ), + # example from GEOS docs + ( + shapely.linestrings([[0, 0], [50, 200], [100, 0], [150, 200], [200, 0]]), + shapely.linestrings([[0, 200], [200, 150], [0, 100], [200, 50], [0, 0]]), + 200, + ), + # same geometries but different curve direction results in maximum + # distance between vertices on the lines. + ( + shapely.linestrings([[0, 0], [50, 200], [100, 0], [150, 200], [200, 0]]), + shapely.linestrings([[200, 0], [150, 200], [100, 0], [50, 200], [0, 0]]), + 200, + ), + # another example from GEOS docs + ( + shapely.linestrings([[0, 0], [50, 200], [100, 0], [150, 200], [200, 0]]), + shapely.linestrings([[0, 0], [200, 50], [0, 100], [200, 150], [0, 200]]), + 282.842712474619, + ), + # example from GEOS tests + ( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [50, 50], [100, 0]]), + 70.7106781186548, + ), + ], +) +def test_frechet_distance(geom1, geom2, expected): + actual = shapely.frechet_distance(geom1, geom2) + assert actual == pytest.approx(expected, abs=1e-12) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom1, geom2, densify, expected", + [ + # example from GEOS tests + ( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [50, 50], [100, 0]]), + 0.001, + 50, + ) + ], +) +def test_frechet_distance_densify(geom1, geom2, densify, expected): + actual = shapely.frechet_distance(geom1, geom2, densify=densify) + assert actual == pytest.approx(expected, abs=1e-12) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom1, geom2", + [ + (line_string, None), + (None, line_string), + (None, None), + (line_string, empty), + (empty, line_string), + (empty, empty), + ], +) +def test_frechet_distance_nan_for_invalid_geometry_inputs(geom1, geom2): + actual = shapely.frechet_distance(geom1, geom2) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_frechet_densify_ndarray(): + actual = shapely.frechet_distance( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [50, 50], [100, 0]]), + densify=[0.1, 0.2, 1], + ) + expected = np.array([50, 50.99019514, 70.7106781186548]) + np.testing.assert_array_almost_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_frechet_densify_nan(): + actual = shapely.frechet_distance(line_string, line_string, densify=np.nan) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize("densify", [0, -1, 2]) +def test_frechet_densify_invalid_values(densify): + with pytest.raises(shapely.GEOSException, match="Fraction is not in range"): + shapely.frechet_distance(line_string, line_string, densify=densify) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_frechet_distance_densify_empty(): + actual = shapely.frechet_distance(line_string, empty, densify=0.2) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_minimum_clearance(): + actual = shapely.minimum_clearance([polygon, polygon_with_hole, multi_polygon]) + assert_allclose(actual, [2.0, 2.0, 0.1]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_minimum_clearance_nonexistent(): + actual = shapely.minimum_clearance([point, empty]) + assert np.isinf(actual).all() + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_minimum_clearance_missing(): + actual = shapely.minimum_clearance(None) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + Polygon([(0, 5), (5, 10), (10, 5), (5, 0), (0, 5)]), + 5, + ), + ( + LineString([(1, 0), (1, 10)]), + 5, + ), + ( + MultiPoint([(2, 2), (4, 2)]), + 1, + ), + ( + Point(2, 2), + 0, + ), + ( + GeometryCollection(), + 0, + ), + ], +) +def test_minimum_bounding_radius(geometry, expected): + actual = shapely.minimum_bounding_radius(geometry) + assert actual == pytest.approx(expected, abs=1e-12) diff --git a/billinglayer/python/shapely/tests/test_misc.py b/billinglayer/python/shapely/tests/test_misc.py new file mode 100644 index 0000000..aad4870 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_misc.py @@ -0,0 +1,184 @@ +import os +import sys +from itertools import chain +from string import ascii_letters, digits +from unittest import mock + +import numpy as np +import pytest + +import shapely +from shapely.decorators import multithreading_enabled, requires_geos + + +@pytest.fixture +def mocked_geos_version(): + with mock.patch.object(shapely.lib, "geos_version", new=(3, 7, 1)): + yield "3.7.1" + + +@pytest.fixture +def sphinx_doc_build(): + os.environ["SPHINX_DOC_BUILD"] = "1" + yield + del os.environ["SPHINX_DOC_BUILD"] + + +def test_version(): + assert isinstance(shapely.__version__, str) + + +def test_geos_version(): + expected = "{}.{}.{}".format(*shapely.geos_version) + actual = shapely.geos_version_string + + # strip any beta / dev qualifiers + if any(c.isalpha() for c in actual): + if actual[-1].isnumeric(): + actual = actual.rstrip(digits) + actual = actual.rstrip(ascii_letters) + + assert actual == expected + + +@pytest.mark.skipif( + sys.platform.startswith("win") and shapely.geos_version[:2] == (3, 7), + reason="GEOS_C_API_VERSION broken for GEOS 3.7.x on Windows", +) +def test_geos_capi_version(): + expected = "{}.{}.{}-CAPI-{}.{}.{}".format( + *(shapely.geos_version + shapely.geos_capi_version) + ) + + # split into component parts and strip any beta / dev qualifiers + ( + actual_geos_version, + actual_geos_api_version, + ) = shapely.geos_capi_version_string.split("-CAPI-") + + if any(c.isalpha() for c in actual_geos_version): + if actual_geos_version[-1].isnumeric(): + actual_geos_version = actual_geos_version.rstrip(digits) + actual_geos_version = actual_geos_version.rstrip(ascii_letters) + actual_geos_version = actual_geos_version.rstrip(ascii_letters) + + assert f"{actual_geos_version}-CAPI-{actual_geos_api_version}" == expected + + +def func(): + """Docstring that will be mocked. + A multiline. + + Some description. + """ + + +class SomeClass: + def func(self): + """Docstring that will be mocked. + A multiline. + + Some description. + """ + + +expected_docstring = """Docstring that will be mocked. +{indent}A multiline. + +{indent}.. note:: 'func' requires at least GEOS {version}. + +{indent}Some description. +{indent}""" + + +@pytest.mark.parametrize("version", ["3.7.0", "3.7.1", "3.6.2"]) +def test_requires_geos_ok(version, mocked_geos_version): + wrapped = requires_geos(version)(func) + assert wrapped is func + + +@pytest.mark.parametrize("version", ["3.7.2", "3.8.0", "3.8.1"]) +def test_requires_geos_not_ok(version, mocked_geos_version): + wrapped = requires_geos(version)(func) + with pytest.raises(shapely.errors.UnsupportedGEOSVersionError): + wrapped() + + assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 4) + + +@pytest.mark.parametrize("version", ["3.6.0", "3.8.0"]) +def test_requires_geos_doc_build(version, mocked_geos_version, sphinx_doc_build): + """The requires_geos decorator always adapts the docstring.""" + wrapped = requires_geos(version)(func) + + assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 4) + + +@pytest.mark.parametrize("version", ["3.6.0", "3.8.0"]) +def test_requires_geos_method(version, mocked_geos_version, sphinx_doc_build): + """The requires_geos decorator adjusts methods docstrings correctly""" + wrapped = requires_geos(version)(SomeClass.func) + + assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 8) + + +@multithreading_enabled +def set_first_element(value, *args, **kwargs): + for arg in chain(args, kwargs.values()): + if hasattr(arg, "__setitem__"): + arg[0] = value + return arg + + +def test_multithreading_enabled_raises_arg(): + arr = np.empty((1,), dtype=object) + + # set_first_element cannot change the input array + with pytest.raises(ValueError): + set_first_element(42, arr) + + # afterwards, we can + arr[0] = 42 + assert arr[0] == 42 + + +def test_multithreading_enabled_raises_kwarg(): + arr = np.empty((1,), dtype=object) + + # set_first_element cannot change the input array + with pytest.raises(ValueError): + set_first_element(42, arr=arr) + + # writable flag goes to original state + assert arr.flags.writeable + + +def test_multithreading_enabled_preserves_flag(): + arr = np.empty((1,), dtype=object) + arr.flags.writeable = False + + # set_first_element cannot change the input array + with pytest.raises(ValueError): + set_first_element(42, arr) + + # writable flag goes to original state + assert not arr.flags.writeable + + +@pytest.mark.parametrize( + "args,kwargs", + [ + ((np.empty((1,), dtype=float),), {}), # float-dtype ndarray is untouched + ((), {"a": np.empty((1,), dtype=float)}), + (([1],), {}), # non-ndarray is untouched + ((), {"a": [1]}), + ((), {"out": np.empty((1,), dtype=object)}), # ufunc kwarg 'out' is untouched + ( + (), + {"where": np.empty((1,), dtype=object)}, + ), # ufunc kwarg 'where' is untouched + ], +) +def test_multithreading_enabled_ok(args, kwargs): + result = set_first_element(42, *args, **kwargs) + assert result[0] == 42 diff --git a/billinglayer/python/shapely/tests/test_plotting.py b/billinglayer/python/shapely/tests/test_plotting.py new file mode 100644 index 0000000..f06bec2 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_plotting.py @@ -0,0 +1,103 @@ +import pytest +from numpy.testing import assert_allclose + +from shapely import box, get_coordinates, LineString, MultiLineString, Point +from shapely.plotting import patch_from_polygon, plot_line, plot_points, plot_polygon + +pytest.importorskip("matplotlib") + + +def test_patch_from_polygon(): + poly = box(0, 0, 1, 1) + artist = patch_from_polygon(poly, facecolor="red", edgecolor="blue", linewidth=3) + assert equal_color(artist.get_facecolor(), "red") + assert equal_color(artist.get_edgecolor(), "blue") + assert artist.get_linewidth() == 3 + + +def test_patch_from_polygon_with_interior(): + poly = box(0, 0, 1, 1).difference(box(0.2, 0.2, 0.5, 0.5)) + artist = patch_from_polygon(poly, facecolor="red", edgecolor="blue", linewidth=3) + assert equal_color(artist.get_facecolor(), "red") + assert equal_color(artist.get_edgecolor(), "blue") + assert artist.get_linewidth() == 3 + + +def test_patch_from_multipolygon(): + poly = box(0, 0, 1, 1).union(box(2, 2, 3, 3)) + artist = patch_from_polygon(poly, facecolor="red", edgecolor="blue", linewidth=3) + assert equal_color(artist.get_facecolor(), "red") + assert equal_color(artist.get_edgecolor(), "blue") + assert artist.get_linewidth() == 3 + + +def test_plot_polygon(): + poly = box(0, 0, 1, 1) + artist, _ = plot_polygon(poly) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(poly)) + + # overriding default styling + artist = plot_polygon(poly, add_points=False, color="red", linewidth=3) + assert equal_color(artist.get_facecolor(), "red", alpha=0.3) + assert equal_color(artist.get_edgecolor(), "red", alpha=1.0) + assert artist.get_linewidth() == 3 + + +def test_plot_polygon_with_interior(): + poly = box(0, 0, 1, 1).difference(box(0.2, 0.2, 0.5, 0.5)) + artist, _ = plot_polygon(poly) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(poly)) + + +def test_plot_multipolygon(): + poly = box(0, 0, 1, 1).union(box(2, 2, 3, 3)) + artist, _ = plot_polygon(poly) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(poly)) + + +def test_plot_line(): + line = LineString([(0, 0), (1, 0), (1, 1)]) + artist, _ = plot_line(line) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(line)) + + # overriding default styling + artist = plot_line(line, add_points=False, color="red", linewidth=3) + assert equal_color(artist.get_edgecolor(), "red") + assert equal_color(artist.get_facecolor(), "none") + assert artist.get_linewidth() == 3 + + +def test_plot_multilinestring(): + line = MultiLineString( + [LineString([(0, 0), (1, 0), (1, 1)]), LineString([(2, 2), (3, 3)])] + ) + artist, _ = plot_line(line) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(line)) + + +def test_plot_points(): + for geom in [Point(0, 0), LineString([(0, 0), (1, 0), (1, 1)]), box(0, 0, 1, 1)]: + artist = plot_points(geom) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(geom)) + assert artist.get_linestyle() == "None" + + # overriding default styling + geom = Point(0, 0) + artist = plot_points(geom, color="red", marker="+", fillstyle="top") + assert artist.get_color() == "red" + assert artist.get_marker() == "+" + assert artist.get_fillstyle() == "top" + + +def equal_color(actual, expected, alpha=None): + import matplotlib.colors as colors + + conv = colors.colorConverter + + return actual == conv.to_rgba(expected, alpha=alpha) diff --git a/billinglayer/python/shapely/tests/test_predicates.py b/billinglayer/python/shapely/tests/test_predicates.py new file mode 100644 index 0000000..ffdafb1 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_predicates.py @@ -0,0 +1,332 @@ +from functools import partial + +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, LineString, Point + +from .common import ( + all_types, + empty, + geometry_collection, + ignore_invalid, + line_string, + linear_ring, + point, + polygon, +) + +UNARY_PREDICATES = ( + shapely.is_empty, + shapely.is_simple, + shapely.is_ring, + shapely.is_closed, + shapely.is_valid, + shapely.is_missing, + shapely.is_geometry, + shapely.is_valid_input, + shapely.is_prepared, + pytest.param( + shapely.is_ccw, + marks=pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7"), + ), +) + +BINARY_PREDICATES = ( + shapely.disjoint, + shapely.touches, + shapely.intersects, + shapely.crosses, + shapely.within, + shapely.contains, + shapely.contains_properly, + shapely.overlaps, + shapely.covers, + shapely.covered_by, + pytest.param( + partial(shapely.dwithin, distance=1.0), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10" + ), + ), + shapely.equals, + shapely.equals_exact, +) + +BINARY_PREPARED_PREDICATES = BINARY_PREDICATES[:-2] + +XY_PREDICATES = ( + (shapely.contains_xy, shapely.contains), + (shapely.intersects_xy, shapely.intersects), +) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", UNARY_PREDICATES) +def test_unary_array(geometry, func): + actual = func([geometry, geometry]) + assert actual.shape == (2,) + assert actual.dtype == np.bool_ + + +@pytest.mark.parametrize("func", UNARY_PREDICATES) +def test_unary_with_kwargs(func): + out = np.empty((), dtype=np.uint8) + actual = func(point, out=out) + assert actual is out + assert actual.dtype == np.uint8 + + +@pytest.mark.parametrize("func", UNARY_PREDICATES) +def test_unary_missing(func): + if func in (shapely.is_valid_input, shapely.is_missing): + assert func(None) + else: + assert not func(None) + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func", BINARY_PREDICATES) +def test_binary_array(a, func): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func([a, a], point) + assert actual.shape == (2,) + assert actual.dtype == np.bool_ + + +@pytest.mark.parametrize("func", BINARY_PREDICATES) +def test_binary_with_kwargs(func): + out = np.empty((), dtype=np.uint8) + actual = func(point, point, out=out) + assert actual is out + assert actual.dtype == np.uint8 + + +@pytest.mark.parametrize("func", BINARY_PREDICATES) +def test_binary_missing(func): + actual = func(np.array([point, None, None]), np.array([None, point, None])) + assert (~actual).all() + + +def test_binary_empty_result(): + a = LineString([(0, 0), (3, 0), (3, 3), (0, 3)]) + b = LineString([(5, 1), (6, 1)]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Intersection resulting in empty geometries give 'invalid value encountered' + # (https://github.com/shapely/shapely/issues/1345) + assert shapely.intersection(a, b).is_empty + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func, func_bin", XY_PREDICATES) +def test_xy_array(a, func, func_bin): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func([a, a], 2, 3) + expected = func_bin([a, a], Point(2, 3)) + assert actual.shape == (2,) + assert actual.dtype == np.bool_ + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func, func_bin", XY_PREDICATES) +def test_xy_array_broadcast(a, func, func_bin): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func(a, [0, 1, 2], [1, 2, 3]) + expected = func_bin(a, [Point(0, 1), Point(1, 2), Point(2, 3)]) + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("func", [funcs[0] for funcs in XY_PREDICATES]) +def test_xy_array_2D(func): + actual = func(polygon, [0, 1, 2], [1, 2, 3]) + expected = func(polygon, [[0, 1], [1, 2], [2, 3]]) + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("func, func_bin", XY_PREDICATES) +def test_xy_prepared(func, func_bin): + actual = func(_prepare_with_copy([polygon, line_string]), 2, 3) + expected = func_bin([polygon, line_string], Point(2, 3)) + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("func", [funcs[0] for funcs in XY_PREDICATES]) +def test_xy_with_kwargs(func): + out = np.empty((), dtype=np.uint8) + actual = func(point, point.x, point.y, out=out) + assert actual is out + assert actual.dtype == np.uint8 + + +@pytest.mark.parametrize("func", [funcs[0] for funcs in XY_PREDICATES]) +def test_xy_missing(func): + actual = func( + np.array([point, point, point, None]), + np.array([point.x, np.nan, point.x, point.x]), + np.array([point.y, point.y, np.nan, point.y]), + ) + np.testing.assert_allclose(actual, [True, False, False, False]) + + +def test_equals_exact_tolerance(): + # specifying tolerance + p1 = shapely.points(50, 4) + p2 = shapely.points(50.1, 4.1) + actual = shapely.equals_exact([p1, p2, None], p1, tolerance=0.05) + np.testing.assert_allclose(actual, [True, False, False]) + assert actual.dtype == np.bool_ + actual = shapely.equals_exact([p1, p2, None], p1, tolerance=0.2) + np.testing.assert_allclose(actual, [True, True, False]) + assert actual.dtype == np.bool_ + + # default value for tolerance + assert shapely.equals_exact(p1, p1).item() is True + assert shapely.equals_exact(p1, p2).item() is False + + # an array of tolerances + actual = shapely.equals_exact(p1, p2, tolerance=[0.05, 0.2, np.nan]) + np.testing.assert_allclose(actual, [False, True, False]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_dwithin(): + p1 = shapely.points(50, 4) + p2 = shapely.points(50.1, 4.1) + actual = shapely.dwithin([p1, p2, None], p1, distance=0.05) + np.testing.assert_equal(actual, [True, False, False]) + assert actual.dtype == np.bool_ + actual = shapely.dwithin([p1, p2, None], p1, distance=0.2) + np.testing.assert_allclose(actual, [True, True, False]) + assert actual.dtype == np.bool_ + + # an array of distances + actual = shapely.dwithin(p1, p2, distance=[0.05, 0.2, np.nan]) + np.testing.assert_allclose(actual, [False, True, False]) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (point, False), + (line_string, False), + (linear_ring, True), + (empty, False), + ], +) +def test_is_closed(geometry, expected): + assert shapely.is_closed(geometry) == expected + + +def test_relate(): + p1 = shapely.points(0, 0) + p2 = shapely.points(1, 1) + actual = shapely.relate(p1, p2) + assert isinstance(actual, str) + assert actual == "FF0FFF0F2" + + +@pytest.mark.parametrize("g1, g2", [(point, None), (None, point), (None, None)]) +def test_relate_none(g1, g2): + assert shapely.relate(g1, g2) is None + + +def test_relate_pattern(): + g = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + polygon = shapely.box(0, 0, 2, 2) + assert shapely.relate(g, polygon) == "11F00F212" + assert shapely.relate_pattern(g, polygon, "11F00F212") + assert shapely.relate_pattern(g, polygon, "*********") + assert not shapely.relate_pattern(g, polygon, "F********") + + +def test_relate_pattern_empty(): + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + assert shapely.relate_pattern(empty, empty, "*" * 9).item() is True + + +@pytest.mark.parametrize("g1, g2", [(point, None), (None, point), (None, None)]) +def test_relate_pattern_none(g1, g2): + assert shapely.relate_pattern(g1, g2, "*" * 9).item() is False + + +def test_relate_pattern_incorrect_length(): + with pytest.raises(shapely.GEOSException, match="Should be length 9"): + shapely.relate_pattern(point, polygon, "**") + + with pytest.raises(shapely.GEOSException, match="Should be length 9"): + shapely.relate_pattern(point, polygon, "**********") + + +@pytest.mark.parametrize("pattern", [b"*********", 10, None]) +def test_relate_pattern_non_string(pattern): + with pytest.raises(TypeError, match="expected string"): + shapely.relate_pattern(point, polygon, pattern) + + +def test_relate_pattern_non_scalar(): + with pytest.raises(ValueError, match="only supports scalar"): + shapely.relate_pattern([point] * 2, polygon, ["*********"] * 2) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom, expected", + [ + (LinearRing([(0, 0), (0, 1), (1, 1), (0, 0)]), False), + (LinearRing([(0, 0), (1, 1), (0, 1), (0, 0)]), True), + (LineString([(0, 0), (0, 1), (1, 1), (0, 0)]), False), + (LineString([(0, 0), (1, 1), (0, 1), (0, 0)]), True), + (LineString([(0, 0), (1, 1), (0, 1)]), False), + (LineString([(0, 0), (0, 1), (1, 1)]), False), + (point, False), + (polygon, False), + (geometry_collection, False), + (None, False), + ], +) +def test_is_ccw(geom, expected): + assert shapely.is_ccw(geom) == expected + + +def _prepare_with_copy(geometry): + """Prepare without modifying inplace""" + geometry = shapely.transform(geometry, lambda x: x) # makes a copy + shapely.prepare(geometry) + return geometry + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func", BINARY_PREPARED_PREDICATES) +def test_binary_prepared(a, func): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func(a, point) + result = func(_prepare_with_copy(a), point) + assert actual == result + + +@pytest.mark.parametrize("geometry", all_types + (empty,)) +def test_is_prepared_true(geometry): + assert shapely.is_prepared(_prepare_with_copy(geometry)) + + +@pytest.mark.parametrize("geometry", all_types + (empty, None)) +def test_is_prepared_false(geometry): + assert not shapely.is_prepared(geometry) + + +def test_contains_properly(): + # polygon contains itself, but does not properly contains itself + assert shapely.contains(polygon, polygon).item() is True + assert shapely.contains_properly(polygon, polygon).item() is False diff --git a/billinglayer/python/shapely/tests/test_ragged_array.py b/billinglayer/python/shapely/tests/test_ragged_array.py new file mode 100644 index 0000000..2fbc2dc --- /dev/null +++ b/billinglayer/python/shapely/tests/test_ragged_array.py @@ -0,0 +1,362 @@ +import numpy as np +import pytest +from numpy.testing import assert_allclose + +import shapely +from shapely import MultiLineString, MultiPoint, MultiPolygon +from shapely.testing import assert_geometries_equal + +from .common import ( + empty_line_string, + empty_line_string_z, + geometry_collection, + line_string, + line_string_z, + linear_ring, + multi_line_string, + multi_line_string_z, + multi_point, + multi_point_z, + multi_polygon, + multi_polygon_z, + point, + point_z, + polygon, + polygon_z, +) + +all_types = ( + point, + line_string, + polygon, + multi_point, + multi_line_string, + multi_polygon, +) + +all_types_3d = ( + point_z, + line_string_z, + polygon_z, + multi_point_z, + multi_line_string_z, + multi_polygon_z, +) + +all_types_not_supported = ( + linear_ring, + geometry_collection, +) + + +@pytest.mark.parametrize("geom", all_types + all_types_3d) +def test_roundtrip(geom): + actual = shapely.from_ragged_array(*shapely.to_ragged_array([geom, geom])) + assert_geometries_equal(actual, [geom, geom]) + + +@pytest.mark.parametrize("geom", all_types) +def test_include_z(geom): + _, coords, _ = shapely.to_ragged_array([geom, geom], include_z=True) + # For 2D geoms, z coords are filled in with NaN + assert np.isnan(coords[:, 2]).all() + + +@pytest.mark.parametrize("geom", all_types_3d) +def test_include_z_false(geom): + _, coords, _ = shapely.to_ragged_array([geom, geom], include_z=False) + # For 3D geoms, z coords are dropped + assert coords.shape[1] == 2 + + +def test_include_z_default(): + # corner cases for inferring dimensionality + + # mixed 2D and 3D -> 3D + _, coords, _ = shapely.to_ragged_array([line_string, line_string_z]) + assert coords.shape[1] == 3 + + # only empties -> always 2D + _, coords, _ = shapely.to_ragged_array([empty_line_string]) + assert coords.shape[1] == 2 + _, coords, _ = shapely.to_ragged_array([empty_line_string_z]) + assert coords.shape[1] == 2 + # empty collection -> GEOS indicates 2D + _, coords, _ = shapely.to_ragged_array(shapely.from_wkt(["MULTIPOLYGON Z EMPTY"])) + assert coords.shape[1] == 2 + + +@pytest.mark.parametrize("geom", all_types_not_supported) +def test_raise_geometry_type(geom): + with pytest.raises(ValueError): + shapely.to_ragged_array([geom, geom]) + + +def test_points(): + arr = shapely.from_wkt( + [ + "POINT (0 0)", + "POINT (1 1)", + "POINT EMPTY", + "POINT EMPTY", + "POINT (4 4)", + "POINT EMPTY", + ] + ) + typ, result, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [[0, 0], [1, 1], [np.nan, np.nan], [np.nan, np.nan], [4, 4], [np.nan, np.nan]] + ) + assert typ == shapely.GeometryType.POINT + assert_allclose(result, expected) + assert len(offsets) == 0 + + geoms = shapely.from_ragged_array(typ, result) + assert_geometries_equal(geoms, arr) + + +def test_linestrings(): + arr = shapely.from_wkt( + [ + "LINESTRING (30 10, 10 30, 40 40)", + "LINESTRING (40 40, 30 30, 40 20, 30 10)", + "LINESTRING EMPTY", + "LINESTRING EMPTY", + "LINESTRING (10 10, 20 20, 10 40)", + "LINESTRING EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + [40.0, 40.0], + [30.0, 30.0], + [40.0, 20.0], + [30.0, 10.0], + [10.0, 10.0], + [20.0, 20.0], + [10.0, 40.0], + ] + ) + expected_offsets = np.array([0, 3, 7, 7, 7, 10, 10]) + assert typ == shapely.GeometryType.LINESTRING + assert_allclose(coords, expected) + assert len(offsets) == 1 + assert_allclose(offsets[0], expected_offsets) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_polygons(): + arr = shapely.from_wkt( + [ + "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))", + "POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))", + "POLYGON EMPTY", + "POLYGON EMPTY", + "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))", + "POLYGON EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [30.0, 10.0], + [40.0, 40.0], + [20.0, 40.0], + [10.0, 20.0], + [30.0, 10.0], + [35.0, 10.0], + [45.0, 45.0], + [15.0, 40.0], + [10.0, 20.0], + [35.0, 10.0], + [20.0, 30.0], + [35.0, 35.0], + [30.0, 20.0], + [20.0, 30.0], + [30.0, 10.0], + [40.0, 40.0], + [20.0, 40.0], + [10.0, 20.0], + [30.0, 10.0], + ] + ) + expected_offsets1 = np.array([0, 5, 10, 14, 19]) + expected_offsets2 = np.array([0, 1, 3, 3, 3, 4, 4]) + + assert typ == shapely.GeometryType.POLYGON + assert_allclose(coords, expected) + assert len(offsets) == 2 + assert_allclose(offsets[0], expected_offsets1) + assert_allclose(offsets[1], expected_offsets2) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_multipoints(): + arr = shapely.from_wkt( + [ + "MULTIPOINT (10 40, 40 30, 20 20, 30 10)", + "MULTIPOINT (30 10)", + "MULTIPOINT EMPTY", + "MULTIPOINT EMPTY", + "MULTIPOINT (30 10, 10 30, 40 40)", + "MULTIPOINT EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [10.0, 40.0], + [40.0, 30.0], + [20.0, 20.0], + [30.0, 10.0], + [30.0, 10.0], + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + ] + ) + expected_offsets = np.array([0, 4, 5, 5, 5, 8, 8]) + + assert typ == shapely.GeometryType.MULTIPOINT + assert_allclose(coords, expected) + assert len(offsets) == 1 + assert_allclose(offsets[0], expected_offsets) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_multilinestrings(): + arr = shapely.from_wkt( + [ + "MULTILINESTRING ((30 10, 10 30, 40 40))", + "MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))", + "MULTILINESTRING EMPTY", + "MULTILINESTRING EMPTY", + "MULTILINESTRING ((35 10, 45 45), (15 40, 10 20), (30 10, 10 30, 40 40))", + "MULTILINESTRING EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + [10.0, 10.0], + [20.0, 20.0], + [10.0, 40.0], + [40.0, 40.0], + [30.0, 30.0], + [40.0, 20.0], + [30.0, 10.0], + [35.0, 10.0], + [45.0, 45.0], + [15.0, 40.0], + [10.0, 20.0], + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + ] + ) + expected_offsets1 = np.array([0, 3, 6, 10, 12, 14, 17]) + expected_offsets2 = np.array([0, 1, 3, 3, 3, 6, 6]) + + assert typ == shapely.GeometryType.MULTILINESTRING + assert_allclose(coords, expected) + assert len(offsets) == 2 + assert_allclose(offsets[0], expected_offsets1) + assert_allclose(offsets[1], expected_offsets2) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_multipolygons(): + arr = shapely.from_wkt( + [ + "MULTIPOLYGON (((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30)))", + "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20)))", + "MULTIPOLYGON EMPTY", + "MULTIPOLYGON EMPTY", + "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)))", + "MULTIPOLYGON EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [35.0, 10.0], + [45.0, 45.0], + [15.0, 40.0], + [10.0, 20.0], + [35.0, 10.0], + [20.0, 30.0], + [35.0, 35.0], + [30.0, 20.0], + [20.0, 30.0], + [40.0, 40.0], + [20.0, 45.0], + [45.0, 30.0], + [40.0, 40.0], + [20.0, 35.0], + [10.0, 30.0], + [10.0, 10.0], + [30.0, 5.0], + [45.0, 20.0], + [20.0, 35.0], + [30.0, 20.0], + [20.0, 15.0], + [20.0, 25.0], + [30.0, 20.0], + [40.0, 40.0], + [20.0, 45.0], + [45.0, 30.0], + [40.0, 40.0], + ] + ) + expected_offsets1 = np.array([0, 5, 9, 13, 19, 23, 27]) + expected_offsets2 = np.array([0, 2, 3, 5, 6]) + expected_offsets3 = np.array([0, 1, 3, 3, 3, 4, 4]) + + assert typ == shapely.GeometryType.MULTIPOLYGON + assert_allclose(coords, expected) + assert len(offsets) == 3 + assert_allclose(offsets[0], expected_offsets1) + assert_allclose(offsets[1], expected_offsets2) + assert_allclose(offsets[2], expected_offsets3) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_mixture_point_multipoint(): + typ, coords, offsets = shapely.to_ragged_array([point, multi_point]) + assert typ == shapely.GeometryType.MULTIPOINT + result = shapely.from_ragged_array(typ, coords, offsets) + expected = np.array([MultiPoint([point]), multi_point]) + assert_geometries_equal(result, expected) + + +def test_mixture_linestring_multilinestring(): + typ, coords, offsets = shapely.to_ragged_array([line_string, multi_line_string]) + assert typ == shapely.GeometryType.MULTILINESTRING + result = shapely.from_ragged_array(typ, coords, offsets) + expected = np.array([MultiLineString([line_string]), multi_line_string]) + assert_geometries_equal(result, expected) + + +def test_mixture_polygon_multipolygon(): + typ, coords, offsets = shapely.to_ragged_array([polygon, multi_polygon]) + assert typ == shapely.GeometryType.MULTIPOLYGON + result = shapely.from_ragged_array(typ, coords, offsets) + expected = np.array([MultiPolygon([polygon]), multi_polygon]) + assert_geometries_equal(result, expected) diff --git a/billinglayer/python/shapely/tests/test_set_operations.py b/billinglayer/python/shapely/tests/test_set_operations.py new file mode 100644 index 0000000..c4bdb7e --- /dev/null +++ b/billinglayer/python/shapely/tests/test_set_operations.py @@ -0,0 +1,411 @@ +import numpy as np +import pytest + +import shapely +from shapely import Geometry, GeometryCollection, Polygon +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import all_types, empty, geometry_collection, multi_polygon, point, polygon + +# fixed-precision operations raise GEOS exceptions on mixed dimension geometry collections +all_single_types = [g for g in all_types if not shapely.get_type_id(g) == 7] + +SET_OPERATIONS = ( + shapely.difference, + shapely.intersection, + shapely.symmetric_difference, + shapely.union, + # shapely.coverage_union is tested seperately +) + +REDUCE_SET_OPERATIONS = ( + (shapely.intersection_all, shapely.intersection), + (shapely.symmetric_difference_all, shapely.symmetric_difference), + (shapely.union_all, shapely.union), + # shapely.coverage_union_all, shapely.coverage_union) is tested seperately +) + +# operations that support fixed precision +REDUCE_SET_OPERATIONS_PREC = ((shapely.union_all, shapely.union),) + + +reduce_test_data = [ + shapely.box(0, 0, 5, 5), + shapely.box(2, 2, 7, 7), + shapely.box(4, 4, 9, 9), + shapely.box(5, 5, 10, 10), +] + +non_polygon_types = [ + geom + for geom in all_types + if (not shapely.is_empty(geom) and geom not in (polygon, multi_polygon)) +] + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func", SET_OPERATIONS) +def test_set_operation_array(request, a, func): + if ( + func == shapely.difference + and a == geometry_collection + and shapely.geos_version >= (3, 12, 0) + ): + request.node.add_marker( + pytest.mark.xfail(reason="https://github.com/libgeos/geos/issues/797") + ) + actual = func(a, point) + assert isinstance(actual, Geometry) + + actual = func([a, a], point) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + +@pytest.mark.skipif(shapely.geos_version >= (3, 9, 0), reason="GEOS >= 3.9") +@pytest.mark.parametrize("func", SET_OPERATIONS) +@pytest.mark.parametrize("grid_size", [0, 1]) +def test_set_operations_prec_not_supported(func, grid_size): + with pytest.raises( + UnsupportedGEOSVersionError, match="grid_size parameter requires GEOS >= 3.9.0" + ): + func(point, point, grid_size) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func", SET_OPERATIONS) +def test_set_operation_prec_nonscalar_grid_size(func): + with pytest.raises( + ValueError, match="grid_size parameter only accepts scalar values" + ): + func(point, point, grid_size=[1]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("a", all_single_types) +@pytest.mark.parametrize("func", SET_OPERATIONS) +@pytest.mark.parametrize("grid_size", [0, 1, 2]) +def test_set_operation_prec_array(a, func, grid_size): + actual = func([a, a], point, grid_size=grid_size) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + # results should match the operation when the precision is previously set + # to same grid_size + b = shapely.set_precision(a, grid_size=grid_size) + point2 = shapely.set_precision(point, grid_size=grid_size) + expected = func([b, b], point2) + + assert shapely.equals(shapely.normalize(actual), shapely.normalize(expected)).all() + + +@pytest.mark.parametrize("n", range(1, 5)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_1dim(n, func, related_func): + actual = func(reduce_test_data[:n]) + # perform the reduction in a python loop and compare + expected = reduce_test_data[0] + for i in range(1, n): + expected = related_func(expected, reduce_test_data[i]) + assert shapely.equals(actual, expected) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_single_geom(func, related_func): + geom = shapely.Point(1, 1) + actual = func([geom, None, None]) + assert shapely.equals(actual, geom) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_axis(func, related_func): + data = [[point] * 2] * 3 # shape = (3, 2) + actual = func(data, axis=None) # default + assert isinstance(actual, Geometry) # scalar output + actual = func(data, axis=0) + assert actual.shape == (2,) + actual = func(data, axis=1) + assert actual.shape == (3,) + actual = func(data, axis=-1) + assert actual.shape == (3,) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_empty(func, related_func): + assert func(np.empty((0,), dtype=object)) == empty + arr_empty_2D = np.empty((0, 2), dtype=object) + assert func(arr_empty_2D) == empty + assert func(arr_empty_2D, axis=0).tolist() == [empty] * 2 + assert func(arr_empty_2D, axis=1).tolist() == [] + + +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_one_none(func, related_func, none_position): + # API change: before, intersection_all and symmetric_difference_all returned + # None if any input geometry was None. + # The new behaviour is to ignore None values. + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + actual = func(test_data) + expected = related_func(reduce_test_data[0], reduce_test_data[1]) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_two_none(func, related_func, none_position): + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + test_data.insert(none_position, None) + actual = func(test_data) + expected = related_func(reduce_test_data[0], reduce_test_data[1]) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_some_none_len2(func, related_func): + # in a previous implementation, this would take a different code path + # and return wrong result + assert func([empty, None]) == empty + + +@pytest.mark.parametrize("n", range(1, 3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_all_none(n, func, related_func): + assert_geometries_equal(func([None] * n), GeometryCollection([])) + + +@pytest.mark.parametrize("n", range(1, 3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_all_none_arr(n, func, related_func): + assert func([[None] * n] * 2, axis=1).tolist() == [empty, empty] + assert func([[None] * 2] * n, axis=0).tolist() == [empty, empty] + + +@pytest.mark.skipif(shapely.geos_version >= (3, 9, 0), reason="GEOS >= 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +@pytest.mark.parametrize("grid_size", [0, 1]) +def test_set_operation_prec_reduce_not_supported(func, related_func, grid_size): + with pytest.raises( + UnsupportedGEOSVersionError, match="grid_size parameter requires GEOS >= 3.9.0" + ): + func([point, point], grid_size) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_nonscalar_grid_size(func, related_func): + with pytest.raises( + ValueError, match="grid_size parameter only accepts scalar values" + ): + func([point, point], grid_size=[1]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_grid_size_nan(func, related_func): + actual = func([point, point], grid_size=np.nan) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("n", range(1, 5)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +@pytest.mark.parametrize("grid_size", [0, 1]) +def test_set_operation_prec_reduce_1dim(n, func, related_func, grid_size): + actual = func(reduce_test_data[:n], grid_size=grid_size) + # perform the reduction in a python loop and compare + expected = reduce_test_data[0] + for i in range(1, n): + expected = related_func(expected, reduce_test_data[i], grid_size=grid_size) + + assert shapely.equals(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_axis(func, related_func): + data = [[point] * 2] * 3 # shape = (3, 2) + actual = func(data, grid_size=1, axis=None) # default + assert isinstance(actual, Geometry) # scalar output + actual = func(data, grid_size=1, axis=0) + assert actual.shape == (2,) + actual = func(data, grid_size=1, axis=1) + assert actual.shape == (3,) + actual = func(data, grid_size=1, axis=-1) + assert actual.shape == (3,) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_one_none(func, related_func, none_position): + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + actual = func(test_data, grid_size=1) + expected = related_func(reduce_test_data[0], reduce_test_data[1], grid_size=1) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_two_none(func, related_func, none_position): + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + test_data.insert(none_position, None) + actual = func(test_data, grid_size=1) + expected = related_func(reduce_test_data[0], reduce_test_data[1], grid_size=1) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("n", range(1, 3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_all_none(n, func, related_func): + assert_geometries_equal(func([None] * n, grid_size=1), GeometryCollection([])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize("n", range(1, 4)) +def test_coverage_union_reduce_1dim(n): + """ + This is tested seperately from other set operations as it differs in two ways: + 1. It expects only non-overlapping polygons + 2. It expects GEOS 3.8.0+ + """ + test_data = [ + shapely.box(0, 0, 1, 1), + shapely.box(1, 0, 2, 1), + shapely.box(2, 0, 3, 1), + ] + actual = shapely.coverage_union_all(test_data[:n]) + # perform the reduction in a python loop and compare + expected = test_data[0] + for i in range(1, n): + expected = shapely.coverage_union(expected, test_data[i]) + assert_geometries_equal(actual, expected, normalize=True) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_coverage_union_reduce_axis(): + # shape = (3, 2), all polygons - none of them overlapping + data = [[shapely.box(i, j, i + 1, j + 1) for i in range(2)] for j in range(3)] + actual = shapely.coverage_union_all(data, axis=None) # default + assert isinstance(actual, Geometry) + actual = shapely.coverage_union_all(data, axis=0) + assert actual.shape == (2,) + actual = shapely.coverage_union_all(data, axis=1) + assert actual.shape == (3,) + actual = shapely.coverage_union_all(data, axis=-1) + assert actual.shape == (3,) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_coverage_union_overlapping_inputs(): + polygon = Polygon([(1, 1), (1, 0), (0, 0), (0, 1), (1, 1)]) + + # Overlapping polygons raise an error + with pytest.raises( + shapely.GEOSException, + match="CoverageUnion cannot process incorrectly noded inputs.", + ): + shapely.coverage_union( + polygon, Polygon([(1, 0), (0.9, 1), (2, 1), (2, 0), (1, 0)]) + ) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom_1, geom_2", + # All possible polygon, non_polygon combinations + [[polygon, non_polygon] for non_polygon in non_polygon_types] + # All possible non_polygon, non_polygon combinations + + [ + [non_polygon_1, non_polygon_2] + for non_polygon_1 in non_polygon_types + for non_polygon_2 in non_polygon_types + ], +) +def test_coverage_union_non_polygon_inputs(geom_1, geom_2): + # Non polygon geometries raise an error + with pytest.raises( + shapely.GEOSException, match="Unhandled geometry type in CoverageUnion." + ): + shapely.coverage_union(geom_1, geom_2) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize( + "geom,grid_size,expected", + [ + # floating point precision, expect no change + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 0, + Polygon( + ( + (0, 0.2), + (0, 10), + (5.1, 10), + (5.1, 0.2), + (5, 0.2), + (5, 0.1), + (0.1, 0.1), + (0.1, 0.2), + (0, 0.2), + ) + ), + ), + # grid_size is at effective precision, expect no change + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 0.1, + Polygon( + ( + (0, 0.2), + (0, 10), + (5.1, 10), + (5.1, 0.2), + (5, 0.2), + (5, 0.1), + (0.1, 0.1), + (0.1, 0.2), + (0, 0.2), + ) + ), + ), + # grid_size forces rounding to nearest integer + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 1, + Polygon([(0, 5), (0, 10), (5, 10), (5, 5), (5, 0), (0, 0), (0, 5)]), + ), + # grid_size much larger than effective precision causes rounding to nearest + # multiple of 10 + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 10, + Polygon([(0, 10), (10, 10), (10, 0), (0, 0), (0, 10)]), + ), + # grid_size is so large that polygons collapse to empty + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 100, + Polygon(), + ), + ], +) +def test_union_all_prec(geom, grid_size, expected): + actual = shapely.union_all(geom, grid_size=grid_size) + assert shapely.equals(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +def test_uary_union_alias(): + geoms = [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)] + actual = shapely.unary_union(geoms, grid_size=1) + expected = shapely.union_all(geoms, grid_size=1) + assert shapely.equals(actual, expected) diff --git a/billinglayer/python/shapely/tests/test_strtree.py b/billinglayer/python/shapely/tests/test_strtree.py new file mode 100644 index 0000000..5769ed2 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_strtree.py @@ -0,0 +1,1967 @@ +import itertools +import math +import pickle +import subprocess +import sys +from concurrent.futures import ThreadPoolExecutor + +import numpy as np +import pytest +from numpy.testing import assert_array_equal + +import shapely +from shapely import box, geos_version, MultiPoint, Point, STRtree +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import empty, empty_line_string, empty_point, point + +# the distance between 2 points spaced at whole numbers along a diagonal +HALF_UNIT_DIAG = math.sqrt(2) / 2 +EPS = 1e-9 + + +@pytest.fixture(scope="session") +def tree(): + geoms = shapely.points(np.arange(10), np.arange(10)) + yield STRtree(geoms) + + +@pytest.fixture(scope="session") +def line_tree(): + x = np.arange(10) + y = np.arange(10) + offset = 1 + geoms = shapely.linestrings(np.array([[x, x + offset], [y, y + offset]]).T) + yield STRtree(geoms) + + +@pytest.fixture(scope="session") +def poly_tree(): + # create buffers so that midpoint between two buffers intersects + # each buffer. NOTE: add EPS to help mitigate rounding errors at midpoint. + geoms = shapely.buffer( + shapely.points(np.arange(10), np.arange(10)), HALF_UNIT_DIAG + EPS, quad_segs=32 + ) + yield STRtree(geoms) + + +@pytest.mark.parametrize( + "geometry,count, hits", + [ + # Empty array produces empty tree + ([], 0, 0), + ([point], 1, 1), + # None geometries are ignored when creating tree + ([None], 0, 0), + ([point, None], 1, 1), + # empty geometries are ignored when creating tree + ([empty, empty_point, empty_line_string], 0, 0), + # only the valid geometry should have a hit + ([empty, point, empty_point, empty_line_string], 1, 1), + ], +) +def test_init(geometry, count, hits): + tree = STRtree(geometry) + assert len(tree) == count + assert tree.query(box(0, 0, 100, 100)).size == hits + + +def test_init_with_invalid_geometry(): + with pytest.raises(TypeError): + STRtree(["Not a geometry"]) + + +def test_references(): + point1 = Point() + point2 = Point(0, 1) + + geoms = [point1, point2] + tree = STRtree(geoms) + + point1 = None + point2 = None + + import gc + + gc.collect() + + # query after freeing geometries does not lead to segfault + assert tree.query(box(0, 0, 1, 1)).tolist() == [1] + + +def test_flush_geometries(): + arr = shapely.points(np.arange(10), np.arange(10)) + tree = STRtree(arr) + + # Dereference geometries + arr[:] = None + import gc + + gc.collect() + # Still it does not lead to a segfault + tree.query(point) + + +def test_geometries_property(): + arr = np.array([point]) + tree = STRtree(arr) + assert_geometries_equal(arr, tree.geometries) + + # modifying elements of input should not modify tree.geometries + arr[0] = shapely.Point(0, 0) + assert_geometries_equal(point, tree.geometries[0]) + + +# TODO(shapely-2.0) this fails on Appveyor, see +# https://github.com/shapely/shapely/pull/983#issuecomment-718557666 +@pytest.mark.skipif(sys.platform.startswith("win32"), reason="does not run on Appveyor") +def test_pickle_persistence(tmp_path): + # write the pickeled tree to another process; the process should not crash + tree = STRtree([Point(i, i).buffer(0.1) for i in range(3)]) + + pickled_strtree = pickle.dumps(tree) + unpickle_script = """ +import pickle +import sys + +from shapely import Point, geos_version + +pickled_strtree = sys.stdin.buffer.read() +print("received pickled strtree:", repr(pickled_strtree)) +tree = pickle.loads(pickled_strtree) + +tree.query(Point(0, 0)) +if geos_version >= (3, 6, 0): + tree.nearest(Point(0, 0)) +print("done") +""" + + filename = tmp_path / "unpickle-strtree.py" + with open(filename, "w") as out: + out.write(unpickle_script) + + proc = subprocess.Popen( + [sys.executable, str(filename)], + stdin=subprocess.PIPE, + ) + proc.communicate(input=pickled_strtree) + proc.wait() + assert proc.returncode == 0 + + +@pytest.mark.parametrize( + "geometry", + [ + "I am not a geometry", + ["I am not a geometry"], + [Point(0, 0), "still not a geometry"], + [[], "in a mixed array", 1], + ], +) +@pytest.mark.filterwarnings("ignore:Creating an ndarray from ragged nested sequences:") +def test_query_invalid_geometry(tree, geometry): + with pytest.raises((TypeError, ValueError)): + tree.query(geometry) + + +def test_query_invalid_dimension(tree): + with pytest.raises(TypeError, match="Array should be one dimensional"): + tree.query([[Point(0.5, 0.5)]]) + + +@pytest.mark.parametrize( + "tree_geometry, geometry,expected", + [ + # Empty tree returns no results + ([], point, []), + ([], [point], [[], []]), + ([], None, []), + ([], [None], [[], []]), + # Tree with only None returns no results + ([None], point, []), + ([None], [point], [[], []]), + ([None], None, []), + ([None], [None], [[], []]), + # querying with None returns no results + ([point], None, []), + ([point], [None], [[], []]), + # Empty is included in the tree, but ignored when querying the tree + ([empty], empty, []), + ([empty], [empty], [[], []]), + ([empty], point, []), + ([empty], [point], [[], []]), + ([point, empty], empty, []), + ([point, empty], [empty], [[], []]), + # None and empty are ignored in the tree, but the index of the valid + # geometry should be retained. + ([None, point], box(0, 0, 10, 10), [1]), + ([None, point], [box(0, 0, 10, 10)], [[0], [1]]), + ([None, empty, point], box(0, 0, 10, 10), [2]), + ([point, None, point], box(0, 0, 10, 10), [0, 2]), + ([point, None, point], [box(0, 0, 10, 10)], [[0, 0], [0, 2]]), + # Only the non-empty query geometry gets hits + ([empty, point], [empty, point], [[1], [1]]), + ( + [empty, empty_point, empty_line_string, point], + [empty, empty_point, empty_line_string, point], + [[3], [3]], + ), + ], +) +def test_query_with_none_and_empty(tree_geometry, geometry, expected): + tree = STRtree(tree_geometry) + assert_array_equal(tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # first and last points intersect + ( + [Point(1, 1), Point(-1, -1), Point(2, 2)], + [[0, 2], [1, 2]], + ), + # box contains points + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # bigger box contains more points + (box(5, 5, 15, 15), [5, 6, 7, 8, 9]), + ([box(5, 5, 15, 15)], [[0, 0, 0, 0, 0], [5, 6, 7, 8, 9]]), + # first and last boxes contains points + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(5, 5, 15, 15)], + [[0, 0, 2, 2, 2, 2, 2], [0, 1, 5, 6, 7, 8, 9]], + ), + # envelope of buffer contains points + (shapely.buffer(Point(3, 3), 1), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 1)], [[0, 0, 0], [2, 3, 4]]), + # envelope of points contains points + (MultiPoint([[5, 7], [7, 5]]), [5, 6, 7]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0, 0], [5, 6, 7]]), + ], +) +def test_query_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + # point at shared vertex between 2 lines + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # box overlaps envelope of first 2 lines (touches edge of 1) + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # envelope of buffer overlaps envelope of 2 lines + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # envelope of points overlaps 5 lines (touches edge of 2 envelopes) + (MultiPoint([[5, 7], [7, 5]]), [4, 5, 6, 7]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0, 0, 0], [4, 5, 6, 7]]), + ], +) +def test_query_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects edge of envelopes of 2 polygons + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # point intersects single polygon + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box overlaps envelope of 2 polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # larger box overlaps envelope of 3 polygons + (box(0, 0, 1.5, 1.5), [0, 1, 2]), + ([box(0, 0, 1.5, 1.5)], [[0, 0, 0], [0, 1, 2]]), + # first and last boxes overlap envelope of 2 polyons + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(2, 2, 3, 3)], + [[0, 0, 2, 2], [0, 1, 2, 3]], + ), + # envelope of buffer overlaps envelope of 3 polygons + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + ( + [shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], + [[0, 0, 0], [2, 3, 4]], + ), + # envelope of larger buffer overlaps envelope of 6 polygons + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [1, 2, 3, 4, 5]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0, 0, 0], [1, 2, 3, 4, 5]], + ), + # envelope of points overlaps 3 polygons + (MultiPoint([[5, 7], [7, 5]]), [5, 6, 7]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0, 0], [5, 6, 7]]), + ], +) +def test_query_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "predicate", + [ + "bad_predicate", + # disjoint is a valid GEOS binary predicate, but not supported for query + "disjoint", + ], +) +def test_query_invalid_predicate(tree, predicate): + with pytest.raises(ValueError, match="is not a valid option"): + tree.query(Point(1, 1), predicate=predicate) + + +@pytest.mark.parametrize( + "predicate,expected", + [ + ("intersects", [0, 1, 2]), + ("within", []), + ("contains", [1]), + ("overlaps", []), + ("crosses", []), + ("covers", [0, 1, 2]), + ("covered_by", []), + ("contains_properly", [1]), + ], +) +def test_query_prepared_inputs(tree, predicate, expected): + geom = box(0, 0, 2, 2) + shapely.prepare(geom) + assert_array_equal(tree.query(geom, predicate=predicate), expected) + + +def test_query_with_partially_prepared_inputs(tree): + geom = np.array([box(0, 0, 1, 1), box(3, 3, 5, 5)]) + expected = tree.query(geom, predicate="intersects") + + # test with array of partially prepared geometries + shapely.prepare(geom[0]) + assert_array_equal(expected, tree.query(geom, predicate="intersects")) + + +@pytest.mark.parametrize( + "predicate", + [ + # intersects is intentionally omitted; it does not raise an exception + pytest.param( + "within", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + pytest.param( + "contains", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + "overlaps", + "crosses", + "touches", + pytest.param( + "covers", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + pytest.param( + "covered_by", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + pytest.param( + "contains_properly", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + ], +) +def test_query_predicate_errors(tree, predicate): + with pytest.raises(shapely.GEOSException): + tree.query(shapely.linestrings([1, 1], [1, float("nan")]), predicate=predicate) + + +### predicate == 'intersects' + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box contains points + (box(3, 3, 6, 6), [3, 4, 5, 6]), + ([box(3, 3, 6, 6)], [[0, 0, 0, 0], [3, 4, 5, 6]]), + # first and last boxes contain points + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(3, 3, 6, 6)], + [[0, 0, 2, 2, 2, 2], [0, 1, 3, 4, 5, 6]], + ), + # envelope of buffer contains more points than intersect buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0], [2, 3, 4]], + ), + # multipoints intersect + ( + MultiPoint([[5, 5], [7, 7]]), + [5, 7], + ), + ( + [MultiPoint([[5, 5], [7, 7]])], + [[0, 0], [5, 7]], + ), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + ( + MultiPoint([[5, 7], [7, 7]]), + [7], + ), + ( + [MultiPoint([[5, 7], [7, 7]])], + [[0], [7]], + ), + ], +) +def test_query_intersects_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="intersects"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line but does not intersect + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point at shared vertex between 2 lines + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # box overlaps envelope of first 2 lines (touches edge of 1) + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # first and last boxes overlap multiple lines each + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(2, 2, 3, 3)], + [[0, 0, 2, 2, 2], [0, 1, 1, 2, 3]], + ), + # buffer intersects 2 lines + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # buffer intersects midpoint of line at tangent + (shapely.buffer(Point(2, 1), HALF_UNIT_DIAG), [1]), + ([shapely.buffer(Point(2, 1), HALF_UNIT_DIAG)], [[0], [1]]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [6, 7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0, 0], [6, 7]]), + ], +) +def test_query_intersects_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="intersects"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + (Point(0.5, 0), [0]), + ([Point(0.5, 0)], [[0], [0]]), + # midpoint between two polygons intersects both + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # point intersects single polygon + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box overlaps envelope of 2 polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # larger box intersects 3 polygons + (box(0, 0, 1.5, 1.5), [0, 1, 2]), + ([box(0, 0, 1.5, 1.5)], [[0, 0, 0], [0, 1, 2]]), + # first and last boxes overlap + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(2, 2, 3, 3)], + [[0, 0, 2, 2], [0, 1, 2, 3]], + ), + # buffer overlaps 3 polygons + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + ( + [shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], + [[0, 0, 0], [2, 3, 4]], + ), + # larger buffer overlaps 6 polygons (touches midpoints) + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [1, 2, 3, 4, 5]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0, 0, 0], [1, 2, 3, 4, 5]], + ), + # envelope of points overlaps polygons, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint within polygon + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_intersects_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="intersects"), expected) + + +### predicate == 'within' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box not within points + (box(3, 3, 6, 6), []), + ([box(3, 3, 6, 6)], [[], []]), + # envelope of buffer not within points + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # multipoints intersect but are not within points in tree + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + # only one point of multipoint intersects, but multipoints are not + # within any points in tree + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_within_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="within"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # endpoint not within first line + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # point within first line + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line but does not intersect + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point at shared vertex between 2 lines (but within neither) + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + # box not within line + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # buffer intersects 2 lines but not within either + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects, but both are not within line + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + (MultiPoint([[6.5, 6.5], [7, 7]]), [6]), + ([MultiPoint([[6.5, 6.5], [7, 7]])], [[0], [6]]), + ], +) +def test_query_within_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="within"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + (Point(0.5, 0), [0]), + ([Point(0.5, 0)], [[0], [0]]), + # midpoint between two polygons intersects both + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # point intersects single polygon + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box overlaps envelope of 2 polygons but within neither + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # box within polygon + (box(0, 0, 0.5, 0.5), [0]), + ([box(0, 0, 0.5, 0.5)], [[0], [0]]), + # larger box intersects 3 polygons but within none + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer intersects 3 polygons but only within one + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0], [3]]), + # larger buffer overlaps 6 polygons (touches midpoints) but within none + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[], []]), + # envelope of points overlaps polygons, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint within polygon + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points in multipoint within polygon + (MultiPoint([[5.25, 5.5], [5.25, 5.0]]), [5]), + ([MultiPoint([[5.25, 5.5], [5.25, 5.0]])], [[0], [5]]), + ], +) +def test_query_within_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="within"), expected) + + +### predicate == 'contains' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box contains points (2 are at edges and not contained) + (box(3, 3, 6, 6), [4, 5]), + ([box(3, 3, 6, 6)], [[0, 0], [4, 5]]), + # envelope of buffer contains more points than within buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # multipoints intersect + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_contains_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="contains"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not contain any lines (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box contains first line (touches edge of 1 but does not contain it) + (box(0, 0, 1, 1), [0]), + ([box(0, 0, 1, 1)], [[0], [0]]), + # buffer intersects 2 lines but contains neither + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points intersect but do not contain any lines (not valid relation) + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + ], +) +def test_query_contains_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="contains"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not contain any polygons (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps envelope of 2 polygons but contains neither + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # larger box intersects 3 polygons but contains only one + (box(0, 0, 2, 2), [1]), + ([box(0, 0, 2, 2)], [[0], [1]]), + # buffer overlaps 3 polygons but contains none + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # larger buffer overlaps 6 polygons (touches midpoints) but contains one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0], [3]]), + # envelope of points overlaps polygons, but points do not intersect + # (not valid relation) + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_contains_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="contains"), expected) + + +### predicate == 'overlaps' +# Overlaps only returns results where geometries are of same dimensions +# and do not completely contain each other. +# See: https://postgis.net/docs/ST_Overlaps.html +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect but do not overlap + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + # box overlaps points including those at edge but does not overlap + # (completely contains all points) + (box(3, 3, 6, 6), []), + ([box(3, 3, 6, 6)], [[], []]), + # envelope of buffer contains points, but does not overlap + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # multipoints intersect but do not overlap (both completely contain each other) + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + # envelope of points contains points in tree, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects but does not overlap + # the intersecting point from multipoint completely contains point in tree + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + ], +) +def test_query_overlaps_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="overlaps"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects line but is completely contained by it + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps second line (contains first line) + # but of different dimensions so does not overlap + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer intersects 2 lines but of different dimensions so does not overlap + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points intersect but different dimensions + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + ], +) +def test_query_overlaps_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="overlaps"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not overlap any polygons (different dimensions) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps 2 polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # larger box intersects 3 polygons and contains one + (box(0, 0, 2, 2), [0, 2]), + ([box(0, 0, 2, 2)], [[0, 0], [0, 2]]), + # buffer overlaps 3 polygons and contains 1 + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 4]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0, 0], [2, 4]]), + # larger buffer overlaps 6 polygons (touches midpoints) but contains one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [1, 2, 4, 5]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0, 0], [1, 2, 4, 5]], + ), + # one of two points intersects but different dimensions + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + ], +) +def test_query_overlaps_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="overlaps"), expected) + + +### predicate == 'crosses' +# Only valid for certain geometry combinations +# See: https://postgis.net/docs/ST_Crosses.html +@pytest.mark.parametrize( + "geometry,expected", + [ + # points intersect but not valid relation + (Point(1, 1), []), + # all points of result from tree are in common with box + (box(3, 3, 6, 6), []), + # all points of result from tree are in common with buffer + (shapely.buffer(Point(3, 3), 1), []), + # only one point of multipoint intersects but not valid relation + (MultiPoint([[5, 7], [7, 7]]), []), + ], +) +def test_query_crosses_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="crosses"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line but is completely in common with line + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps envelope of first 2 lines, contains first and crosses second + (box(0, 0, 1.5, 1.5), [1]), + ([box(0, 0, 1.5, 1.5)], [[0], [1]]), + # buffer intersects 2 lines + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # line crosses line + (shapely.linestrings([(1, 0), (0, 1)]), [0]), + ([shapely.linestrings([(1, 0), (0, 1)])], [[0], [0]]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7], [7, 8]]), []), + ([MultiPoint([[5, 7], [7, 7], [7, 8]])], [[], []]), + ], +) +def test_query_crosses_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="crosses"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon but not valid relation + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # box overlaps 2 polygons but not valid relation + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer overlaps 3 polygons but not valid relation + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # only one point of multipoint within + (MultiPoint([[5, 7], [7, 7], [7, 8]]), [7]), + ([MultiPoint([[5, 7], [7, 7], [7, 8]])], [[0], [7]]), + ], +) +def test_query_crosses_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="crosses"), expected) + + +### predicate == 'touches' +# See: https://postgis.net/docs/ST_Touches.html +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect but not valid relation + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + # box contains points but touches only those at edges + (box(3, 3, 6, 6), [3, 6]), + ([box(3, 3, 6, 6)], [[0, 0], [3, 6]]), + # buffer completely contains point in tree + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # buffer intersects 2 points but touches only one + (shapely.buffer(Point(0, 1), 1), [1]), + ([shapely.buffer(Point(0, 1), 1)], [[0], [1]]), + # multipoints intersect but not valid relation + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + ], +) +def test_query_touches_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="touches"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + # point is within line + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # point at shared vertex between 2 lines + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # box overlaps envelope of first 2 lines (touches edge of 1) + (box(0, 0, 1, 1), [1]), + ([box(0, 0, 1, 1)], [[0], [1]]), + # buffer intersects 2 lines but does not touch edges of either + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # buffer intersects midpoint of line at tangent but there is a little overlap + # due to precision issues + (shapely.buffer(Point(2, 1), HALF_UNIT_DIAG + 1e-7), []), + ([shapely.buffer(Point(2, 1), HALF_UNIT_DIAG + 1e-7)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects at vertex between lines + (MultiPoint([[5, 7], [7, 7], [7, 8]]), [6, 7]), + ([MultiPoint([[5, 7], [7, 7], [7, 8]])], [[0, 0], [6, 7]]), + ], +) +def test_query_touches_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="touches"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point is at edge of first polygon + (Point(HALF_UNIT_DIAG + EPS, 0), [0]), + ([Point(HALF_UNIT_DIAG + EPS, 0)], [[0], [0]]), + # box overlaps envelope of 2 polygons does not touch any at edge + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # box overlaps 2 polygons and touches edge of first + (box(HALF_UNIT_DIAG + EPS, 0, 2, 2), [0]), + ([box(HALF_UNIT_DIAG + EPS, 0, 2, 2)], [[0], [0]]), + # buffer overlaps 3 polygons but does not touch any at edge + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG + EPS), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG + EPS)], [[], []]), + # only one point of multipoint within polygon but does not touch + (MultiPoint([[0, 0], [7, 7], [7, 8]]), []), + ([MultiPoint([[0, 0], [7, 7], [7, 8]])], [[], []]), + ], +) +def test_query_touches_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="touches"), expected) + + +### predicate == 'covers' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect and thus no point is outside the other + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box covers any points that intersect or are within + (box(3, 3, 6, 6), [3, 4, 5, 6]), + ([box(3, 3, 6, 6)], [[0, 0, 0, 0], [3, 4, 5, 6]]), + # envelope of buffer covers more points than are covered by buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # multipoints intersect and thus no point is outside the other + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_covers_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="covers"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not cover any lines (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box covers first line (intersects another does not contain it) + (box(0, 0, 1.5, 1.5), [0]), + ([box(0, 0, 1.5, 1.5)], [[0], [0]]), + # box completely covers 2 lines (touches edges of 2 others) + (box(1, 1, 3, 3), [1, 2]), + ([box(1, 1, 3, 3)], [[0, 0], [1, 2]]), + # buffer intersects 2 lines but does not completely cover either + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects a line, but does not completely cover it + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points intersect but do not cover any lines (not valid relation) + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + ], +) +def test_query_covers_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="covers"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not cover any polygons (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps envelope of 2 polygons but does not completely cover either + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # larger box intersects 3 polygons but covers only one + (box(0, 0, 2, 2), [1]), + ([box(0, 0, 2, 2)], [[0], [1]]), + # buffer overlaps 3 polygons but does not completely cover any + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # larger buffer overlaps 6 polygons (touches midpoints) but covers only one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0], [3]]), + # envelope of points overlaps polygons, but points do not intersect + # (not valid relation) + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_covers_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="covers"), expected) + + +### predicate == 'covered_by' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box not covered by points + (box(3, 3, 6, 6), []), + ([box(3, 3, 6, 6)], [[], []]), + # envelope of buffer not covered by points + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # multipoints intersect but are not covered by points in tree + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + # only one point of multipoint intersects, but multipoints are not + # covered by any points in tree + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # envelope of points overlaps points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_covered_by_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="covered_by"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # endpoint is covered by first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + # point covered by first line + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line but does not intersect + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point at shared vertex between 2 lines and is covered by both + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # line intersects 3 lines, but is covered by only one + (shapely.linestrings([[1, 1], [2, 2]]), [1]), + ([shapely.linestrings([[1, 1], [2, 2]])], [[0], [1]]), + # line intersects 2 lines, but is covered by neither + (shapely.linestrings([[1.5, 1.5], [2.5, 2.5]]), []), + ([shapely.linestrings([[1.5, 1.5], [2.5, 2.5]])], [[], []]), + # box not covered by line (not valid geometric relation) + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # buffer intersects 2 lines but not within either (not valid geometric relation) + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects, but both are not covered by line + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points are covered by a line + (MultiPoint([[6.5, 6.5], [7, 7]]), [6]), + ([MultiPoint([[6.5, 6.5], [7, 7]])], [[0], [6]]), + ], +) +def test_query_covered_by_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="covered_by"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point covered by polygon + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + (Point(0.5, 0), [0]), + ([Point(0.5, 0)], [[0], [0]]), + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # midpoint between two polygons is covered by both + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # line intersects multiple polygons but is not covered by any + (shapely.linestrings([[0, 0], [2, 2]]), []), + ([shapely.linestrings([[0, 0], [2, 2]])], [[], []]), + # line intersects multiple polygons but is covered by only one + (shapely.linestrings([[1.5, 1.5], [2.5, 2.5]]), [2]), + ([shapely.linestrings([[1.5, 1.5], [2.5, 2.5]])], [[0], [2]]), + # box overlaps envelope of 2 polygons but not covered by either + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # box covered by polygon + (box(0, 0, 0.5, 0.5), [0]), + ([box(0, 0, 0.5, 0.5)], [[0], [0]]), + # larger box intersects 3 polygons but not covered by any + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer intersects 3 polygons but only within one + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0], [3]]), + # larger buffer overlaps 6 polygons (touches midpoints) but within none + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[], []]), + # envelope of points overlaps polygons, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint within polygon + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points in multipoint within polygon + (MultiPoint([[5.25, 5.5], [5.25, 5.0]]), [5]), + ([MultiPoint([[5.25, 5.5], [5.25, 5.0]])], [[0], [5]]), + ], +) +def test_query_covered_by_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="covered_by"), expected) + + +### predicate == 'contains_properly' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # line contains every point that is not on its first or last coordinate + # these are on the "exterior" of the line + (shapely.linestrings([[0, 0], [2, 2]]), [1]), + ([shapely.linestrings([[0, 0], [2, 2]])], [[0], [1]]), + # slightly longer line contains multiple points + (shapely.linestrings([[0.5, 0.5], [2.5, 2.5]]), [1, 2]), + ([shapely.linestrings([[0.5, 0.5], [2.5, 2.5]])], [[0, 0], [1, 2]]), + # line intersects and contains one point + (shapely.linestrings([[0, 2], [2, 0]]), [1]), + ([shapely.linestrings([[0, 2], [2, 0]])], [[0], [1]]), + # box contains points (2 are at edges and not contained) + (box(3, 3, 6, 6), [4, 5]), + ([box(3, 3, 6, 6)], [[0, 0], [4, 5]]), + # envelope of buffer contains more points than within buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # multipoints intersect + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_contains_properly_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="contains_properly"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # None of the following conditions satisfy the relation for linestrings + # because they have no interior: + # "a contains b if no points of b lie in the exterior of a, and at least one + # point of the interior of b lies in the interior of a" + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + (shapely.linestrings([[0, 0], [1, 1]]), []), + ([shapely.linestrings([[0, 0], [1, 1]])], [[], []]), + (shapely.linestrings([[0, 0], [2, 2]]), []), + ([shapely.linestrings([[0, 0], [2, 2]])], [[], []]), + (shapely.linestrings([[0, 2], [2, 0]]), []), + ([shapely.linestrings([[0, 2], [2, 0]])], [[], []]), + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + (box(0, 0, 2, 2), []), + ([box(0, 0, 2, 2)], [[], []]), + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + ], +) +def test_query_contains_properly_lines(line_tree, geometry, expected): + assert_array_equal( + line_tree.query(geometry, predicate="contains_properly"), expected + ) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not contain any polygons (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # line intersects multiple polygons but does not contain any (not valid relation) + (shapely.linestrings([[0, 0], [2, 2]]), []), + ([shapely.linestrings([[0, 0], [2, 2]])], [[], []]), + # box overlaps envelope of 2 polygons but contains neither + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # larger box intersects 3 polygons but contains only one + (box(0, 0, 2, 2), [1]), + ([box(0, 0, 2, 2)], [[0], [1]]), + # buffer overlaps 3 polygons but contains none + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # larger buffer overlaps 6 polygons (touches midpoints) but contains one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0], [3]]), + # envelope of points overlaps polygons, but points do not intersect + # (not valid relation) + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_contains_properly_polygons(poly_tree, geometry, expected): + assert_array_equal( + poly_tree.query(geometry, predicate="contains_properly"), expected + ) + + +### predicate = 'dwithin' + + +@pytest.mark.skipif(geos_version >= (3, 10, 0), reason="GEOS >= 3.10") +@pytest.mark.parametrize( + "geometry", [Point(0, 0), [Point(0, 0)], None, [None], empty, [empty]] +) +def test_query_dwithin_geos_version(tree, geometry): + with pytest.raises(UnsupportedGEOSVersionError, match="requires GEOS >= 3.10"): + tree.query(geometry, predicate="dwithin", distance=1) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,match", + [ + (Point(0, 0), None, "distance parameter must be provided"), + ([Point(0, 0)], None, "distance parameter must be provided"), + (Point(0, 0), "foo", "could not convert string to float"), + ([Point(0, 0)], "foo", "could not convert string to float"), + ([Point(0, 0)], ["foo"], "could not convert string to float"), + (Point(0, 0), [0, 1], "Could not broadcast distance to match geometry"), + ([Point(0, 0)], [0, 1], "Could not broadcast distance to match geometry"), + (Point(0, 0), [[1.0]], "should be one dimensional"), + ([Point(0, 0)], [[1.0]], "should be one dimensional"), + ], +) +def test_query_dwithin_invalid_distance(tree, geometry, distance, match): + with pytest.raises(ValueError, match=match): + tree.query(geometry, predicate="dwithin", distance=distance) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,expected", + [ + (None, 1.0, []), + ([None], 1.0, [[], []]), + (Point(0.25, 0.25), 0, []), + ([Point(0.25, 0.25)], 0, [[], []]), + (Point(0.25, 0.25), -1, []), + ([Point(0.25, 0.25)], -1, [[], []]), + (Point(0.25, 0.25), np.nan, []), + ([Point(0.25, 0.25)], np.nan, [[], []]), + (Point(), 1, []), + ([Point()], 1, [[], []]), + (Point(0.25, 0.25), 0.5, [0]), + ([Point(0.25, 0.25)], 0.5, [[0], [0]]), + (Point(0.25, 0.25), 2.5, [0, 1, 2]), + ([Point(0.25, 0.25)], 2.5, [[0, 0, 0], [0, 1, 2]]), + (Point(3, 3), 1.5, [2, 3, 4]), + ([Point(3, 3)], 1.5, [[0, 0, 0], [2, 3, 4]]), + # 2 equidistant points in tree + (Point(0.5, 0.5), 0.75, [0, 1]), + ([Point(0.5, 0.5)], 0.75, [[0, 0], [0, 1]]), + ( + [None, Point(0.5, 0.5)], + 0.75, + [ + [ + 1, + 1, + ], + [0, 1], + ], + ), + ( + [Point(0.5, 0.5), Point(0.25, 0.25)], + 0.75, + [[0, 0, 1], [0, 1, 0]], + ), + ( + [Point(0, 0.2), Point(1.75, 1.75)], + [0.25, 2], + [[0, 1, 1, 1], [0, 1, 2, 3]], + ), + # all points intersect box + (box(0, 0, 3, 3), 0, [0, 1, 2, 3]), + ([box(0, 0, 3, 3)], 0, [[0, 0, 0, 0], [0, 1, 2, 3]]), + (box(0, 0, 3, 3), 0.25, [0, 1, 2, 3]), + ([box(0, 0, 3, 3)], 0.25, [[0, 0, 0, 0], [0, 1, 2, 3]]), + # intersecting and nearby points + (box(1, 1, 2, 2), 1.5, [0, 1, 2, 3]), + ([box(1, 1, 2, 2)], 1.5, [[0, 0, 0, 0], [0, 1, 2, 3]]), + # # return nearest point in tree for each point in multipoint + (MultiPoint([[0.25, 0.25], [1.5, 1.5]]), 0.75, [0, 1, 2]), + ([MultiPoint([[0.25, 0.25], [1.5, 1.5]])], 0.75, [[0, 0, 0], [0, 1, 2]]), + # 2 equidistant points per point in multipoint + ( + MultiPoint([[0.5, 0.5], [3.5, 3.5]]), + 0.75, + [0, 1, 3, 4], + ), + ( + [MultiPoint([[0.5, 0.5], [3.5, 3.5]])], + 0.75, + [[0, 0, 0, 0], [0, 1, 3, 4]], + ), + ], +) +def test_query_dwithin_points(tree, geometry, distance, expected): + assert_array_equal( + tree.query(geometry, predicate="dwithin", distance=distance), expected + ) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,expected", + [ + (None, 1.0, []), + ([None], 1.0, [[], []]), + (Point(0.5, 0.5), 0, [0]), + ([Point(0.5, 0.5)], 0, [[0], [0]]), + (Point(0.5, 0.5), 1.0, [0, 1]), + ([Point(0.5, 0.5)], 1.0, [[0, 0], [0, 1]]), + (Point(2, 2), 0.5, [1, 2]), + ([Point(2, 2)], 0.5, [[0, 0], [1, 2]]), + (box(0, 0, 1, 1), 0.5, [0, 1]), + ([box(0, 0, 1, 1)], 0.5, [[0, 0], [0, 1]]), + (box(0.5, 0.5, 1.5, 1.5), 0.5, [0, 1]), + ([box(0.5, 0.5, 1.5, 1.5)], 0.5, [[0, 0], [0, 1]]), + # multipoints at endpoints of 2 lines each + (MultiPoint([[5, 5], [7, 7]]), 0.5, [4, 5, 6, 7]), + ([MultiPoint([[5, 5], [7, 7]])], 0.5, [[0, 0, 0, 0], [4, 5, 6, 7]]), + # multipoints are equidistant from 2 lines + (MultiPoint([[5, 7], [7, 5]]), 1.5, [5, 6]), + ([MultiPoint([[5, 7], [7, 5]])], 1.5, [[0, 0], [5, 6]]), + ], +) +def test_query_dwithin_lines(line_tree, geometry, distance, expected): + assert_array_equal( + line_tree.query(geometry, predicate="dwithin", distance=distance), + expected, + ) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,expected", + [ + (Point(0, 0), 0, [0]), + ([Point(0, 0)], 0, [[0], [0]]), + (Point(0, 0), 0.5, [0]), + ([Point(0, 0)], 0.5, [[0], [0]]), + (Point(0, 0), 1.5, [0, 1]), + ([Point(0, 0)], 1.5, [[0, 0], [0, 1]]), + (Point(0.5, 0.5), 1, [0, 1]), + ([Point(0.5, 0.5)], 1, [[0, 0], [0, 1]]), + (Point(0.5, 0.5), 0.5, [0, 1]), + ([Point(0.5, 0.5)], 0.5, [[0, 0], [0, 1]]), + (box(0, 0, 1, 1), 0, [0, 1]), + ([box(0, 0, 1, 1)], 0, [[0, 0], [0, 1]]), + (box(0, 0, 1, 1), 2, [0, 1, 2]), + ([box(0, 0, 1, 1)], 2, [[0, 0, 0], [0, 1, 2]]), + (MultiPoint([[5, 5], [7, 7]]), 0.5, [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], 0.5, [[0, 0], [5, 7]]), + ( + MultiPoint([[5, 5], [7, 7]]), + 2.5, + [3, 4, 5, 6, 7, 8, 9], + ), + ( + [MultiPoint([[5, 5], [7, 7]])], + 2.5, + [[0, 0, 0, 0, 0, 0, 0], [3, 4, 5, 6, 7, 8, 9]], + ), + ], +) +def test_query_dwithin_polygons(poly_tree, geometry, distance, expected): + assert_array_equal( + poly_tree.query(geometry, predicate="dwithin", distance=distance), + expected, + ) + + +### STRtree nearest + + +def test_nearest_empty_tree(): + tree = STRtree([]) + assert tree.nearest(point) is None + + +@pytest.mark.parametrize("geometry", ["I am not a geometry"]) +def test_nearest_invalid_geom(tree, geometry): + with pytest.raises(TypeError): + tree.nearest(geometry) + + +@pytest.mark.parametrize("geometry", [None, [None], [Point(1, 1), None]]) +def test_nearest_none(tree, geometry): + with pytest.raises(ValueError): + tree.nearest(geometry) + + +@pytest.mark.parametrize( + "geometry", [empty_point, [empty_point], [Point(1, 1), empty_point]] +) +def test_nearest_empty(tree, geometry): + with pytest.raises(ValueError): + tree.nearest(geometry) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.25, 0.25), 0), + (Point(0.75, 0.75), 1), + (Point(1, 1), 1), + ([Point(1, 1), Point(0, 0)], [1, 0]), + ([Point(1, 1), Point(0.25, 1)], [1, 1]), + ([Point(-10, -10), Point(100, 100)], [0, 9]), + (box(0.5, 0.5, 0.75, 0.75), 1), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), 2), + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), 3), + (MultiPoint([[5.5, 5], [7, 7]]), 7), + (MultiPoint([[5, 7], [7, 5]]), 6), + ], +) +def test_nearest_points(tree, geometry, expected): + assert_array_equal(tree.nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # 2 equidistant points in tree + (Point(0.5, 0.5), [0, 1]), + # multiple points in box + (box(0, 0, 3, 3), [0, 1, 2, 3]), + # return nearest point in tree for each point in multipoint + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ], +) +def test_nearest_points_equidistant(tree, geometry, expected): + # results are returned in order they are traversed when searching the tree, + # which can vary between GEOS versions, so we test that one of the valid + # results is present + result = tree.nearest(geometry) + assert result in expected + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.5, 0.5), 0), + (Point(1.5, 0.5), 0), + (shapely.box(0.5, 1.5, 1, 2), 1), + (shapely.linestrings([[0, 0.5], [1, 2.5]]), 0), + ], +) +def test_nearest_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # at junction between 2 lines + (Point(2, 2), [1, 2]), + # contains one line, intersects with another + (box(0, 0, 1, 1), [0, 1]), + # overlaps 2 lines + (box(0.5, 0.5, 1.5, 1.5), [0, 1]), + # box overlaps 2 lines and intersects endpoints of 2 more + (box(3, 3, 5, 5), [2, 3, 4, 5]), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), [1, 2]), + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3]), + # multipoints at endpoints of 2 lines each + (MultiPoint([[5, 5], [7, 7]]), [4, 5, 6, 7]), + # second point in multipoint at endpoints of 2 lines + (MultiPoint([[5.5, 5], [7, 7]]), [6, 7]), + # multipoints are equidistant from 2 lines + (MultiPoint([[5, 7], [7, 5]]), [5, 6]), + ], +) +def test_nearest_lines_equidistant(line_tree, geometry, expected): + # results are returned in order they are traversed when searching the tree, + # which can vary between GEOS versions, so we test that one of the valid + # results is present + result = line_tree.nearest(geometry) + assert result in expected + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0, 0), 0), + (Point(2, 2), 2), + (shapely.box(0, 5, 1, 6), 3), + (MultiPoint([[5, 7], [7, 5]]), 6), + ], +) +def test_nearest_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # 2 polygons in tree overlap point + (Point(0.5, 0.5), [0, 1]), + # box overlaps multiple polygons + (box(0, 0, 1, 1), [0, 1]), + (box(0.5, 0.5, 1.5, 1.5), [0, 1, 2]), + (box(3, 3, 5, 5), [3, 4, 5]), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), [2, 3]), + # completely overlaps one polygon, touches 2 others + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + # each point in multi point intersects a polygon in tree + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + (MultiPoint([[5.5, 5], [7, 7]]), [5, 7]), + ], +) +def test_nearest_polygons_equidistant(poly_tree, geometry, expected): + # results are returned in order they are traversed when searching the tree, + # which can vary between GEOS versions, so we test that one of the valid + # results is present + result = poly_tree.nearest(geometry) + assert result in expected + + +def test_query_nearest_empty_tree(): + tree = STRtree([]) + assert_array_equal(tree.query_nearest(point), []) + assert_array_equal(tree.query_nearest([point]), [[], []]) + + +@pytest.mark.parametrize("geometry", ["I am not a geometry", ["still not a geometry"]]) +def test_query_nearest_invalid_geom(tree, geometry): + with pytest.raises(TypeError): + tree.query_nearest(geometry) + + +@pytest.mark.parametrize( + "geometry,return_distance,expected", + [ + (None, False, []), + ([None], False, [[], []]), + (None, True, ([], [])), + ([None], True, ([[], []], [])), + ], +) +def test_query_nearest_none(tree, geometry, return_distance, expected): + if return_distance: + index, distance = tree.query_nearest(geometry, return_distance=True) + assert_array_equal(index, expected[0]) + assert_array_equal(distance, expected[1]) + + else: + assert_array_equal(tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [(empty, []), ([empty], [[], []]), ([empty, point], [[1, 1], [2, 3]])], +) +def test_query_nearest_empty_geom(tree, geometry, expected): + assert_array_equal(tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.25, 0.25), [0]), + ([Point(0.25, 0.25)], [[0], [0]]), + (Point(0.75, 0.75), [1]), + ([Point(0.75, 0.75)], [[0], [1]]), + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # 2 equidistant points in tree + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + ([Point(1, 1), Point(0, 0)], [[0, 1], [1, 0]]), + ([Point(1, 1), Point(0.25, 1)], [[0, 1], [1, 1]]), + ([Point(-10, -10), Point(100, 100)], [[0, 1], [0, 9]]), + (box(0.5, 0.5, 0.75, 0.75), [1]), + ([box(0.5, 0.5, 0.75, 0.75)], [[0], [1]]), + # multiple points in box + (box(0, 0, 3, 3), [0, 1, 2, 3]), + ([box(0, 0, 3, 3)], [[0, 0, 0, 0], [0, 1, 2, 3]]), + (shapely.buffer(Point(2.5, 2.5), 1), [2, 3]), + ([shapely.buffer(Point(2.5, 2.5), 1)], [[0, 0], [2, 3]]), + (shapely.buffer(Point(3, 3), 0.5), [3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0], [3]]), + (MultiPoint([[5.5, 5], [7, 7]]), [7]), + ([MultiPoint([[5.5, 5], [7, 7]])], [[0], [7]]), + (MultiPoint([[5, 7], [7, 5]]), [6]), + ([MultiPoint([[5, 7], [7, 5]])], [[0], [6]]), + # return nearest point in tree for each point in multipoint + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # 2 equidistant points per point in multipoint + (MultiPoint([[0.5, 0.5], [3.5, 3.5]]), [0, 1, 3, 4]), + ([MultiPoint([[0.5, 0.5], [3.5, 3.5]])], [[0, 0, 0, 0], [0, 1, 3, 4]]), + ], +) +def test_query_nearest_points(tree, geometry, expected): + assert_array_equal(tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # at junction between 2 lines, will return both + (Point(2, 2), [1, 2]), + ([Point(2, 2)], [[0, 0], [1, 2]]), + # contains one line, intersects with another + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # overlaps 2 lines + (box(0.5, 0.5, 1.5, 1.5), [0, 1]), + ([box(0.5, 0.5, 1.5, 1.5)], [[0, 0], [0, 1]]), + # second box overlaps 2 lines and intersects endpoints of 2 more + ([box(0, 0, 0.5, 0.5), box(3, 3, 5, 5)], [[0, 1, 1, 1, 1], [0, 2, 3, 4, 5]]), + (shapely.buffer(Point(2.5, 2.5), 1), [1, 2, 3]), + ([shapely.buffer(Point(2.5, 2.5), 1)], [[0, 0, 0], [1, 2, 3]]), + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # multipoints at endpoints of 2 lines each + (MultiPoint([[5, 5], [7, 7]]), [4, 5, 6, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0, 0, 0], [4, 5, 6, 7]]), + # second point in multipoint at endpoints of 2 lines + (MultiPoint([[5.5, 5], [7, 7]]), [6, 7]), + ([MultiPoint([[5.5, 5], [7, 7]])], [[0, 0], [6, 7]]), + # multipoints are equidistant from 2 lines + (MultiPoint([[5, 7], [7, 5]]), [5, 6]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0], [5, 6]]), + ], +) +def test_query_nearest_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + (Point(2, 2), [2]), + ([Point(2, 2)], [[0], [2]]), + # 2 polygons in tree overlap point + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # box overlaps multiple polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + (box(0.5, 0.5, 1.5, 1.5), [0, 1, 2]), + ([box(0.5, 0.5, 1.5, 1.5)], [[0, 0, 0], [0, 1, 2]]), + ([box(0, 0, 1, 1), box(3, 3, 5, 5)], [[0, 0, 1, 1, 1], [0, 1, 3, 4, 5]]), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), [2, 3]), + ([shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG)], [[0, 0], [2, 3]]), + # completely overlaps one polygon, touches 2 others + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # each point in multi point intersects a polygon in tree + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + (MultiPoint([[5.5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5.5, 5], [7, 7]])], [[0, 0], [5, 7]]), + (MultiPoint([[5, 7], [7, 5]]), [6]), + ([MultiPoint([[5, 7], [7, 5]])], [[0], [6]]), + ], +) +def test_query_nearest_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,max_distance,expected", + [ + # using unset max_distance should return all nearest + (Point(0.5, 0.5), None, [0, 1]), + ([Point(0.5, 0.5)], None, [[0, 0], [0, 1]]), + # using large max_distance should return all nearest + (Point(0.5, 0.5), 10, [0, 1]), + ([Point(0.5, 0.5)], 10, [[0, 0], [0, 1]]), + # using small max_distance should return no results + (Point(0.5, 0.5), 0.1, []), + ([Point(0.5, 0.5)], 0.1, [[], []]), + # using small max_distance should only return results in that distance + ([Point(0.5, 0.5), Point(0, 0)], 0.1, [[1], [0]]), + ], +) +def test_query_nearest_max_distance(tree, geometry, max_distance, expected): + assert_array_equal( + tree.query_nearest(geometry, max_distance=max_distance), expected + ) + + +@pytest.mark.parametrize( + "geometry,max_distance", + [ + (Point(0.5, 0.5), 0), + ([Point(0.5, 0.5)], 0), + (Point(0.5, 0.5), -1), + ([Point(0.5, 0.5)], -1), + ], +) +def test_query_nearest_invalid_max_distance(tree, geometry, max_distance): + with pytest.raises(ValueError, match="max_distance must be greater than 0"): + tree.query_nearest(geometry, max_distance=max_distance) + + +def test_query_nearest_nonscalar_max_distance(tree): + with pytest.raises(ValueError, match="parameter only accepts scalar values"): + tree.query_nearest(Point(0.5, 0.5), max_distance=[1]) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0, 0), ([0], [0.0])), + ([Point(0, 0)], ([[0], [0]], [0.0])), + (Point(0.5, 0.5), ([0, 1], [0.7071, 0.7071])), + ([Point(0.5, 0.5)], ([[0, 0], [0, 1]], [0.7071, 0.7071])), + (box(0, 0, 1, 1), ([0, 1], [0.0, 0.0])), + ([box(0, 0, 1, 1)], ([[0, 0], [0, 1]], [0.0, 0.0])), + ], +) +def test_query_nearest_return_distance(tree, geometry, expected): + expected_indices, expected_dist = expected + + actual_indices, actual_dist = tree.query_nearest(geometry, return_distance=True) + + assert_array_equal(actual_indices, expected_indices) + assert_array_equal(np.round(actual_dist, 4), expected_dist) + + +@pytest.mark.parametrize( + "geometry,exclusive,expected", + [ + (Point(1, 1), False, [1]), + ([Point(1, 1)], False, [[0], [1]]), + (Point(1, 1), True, [0, 2]), + ([Point(1, 1)], True, [[0, 0], [0, 2]]), + ([Point(1, 1), Point(2, 2)], True, [[0, 0, 1, 1], [0, 2, 1, 3]]), + ], +) +def test_query_nearest_exclusive(tree, geometry, exclusive, expected): + assert_array_equal(tree.query_nearest(geometry, exclusive=exclusive), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + ], +) +def test_query_nearest_exclusive_no_results(tree, geometry, expected): + tree = STRtree([Point(1, 1)]) + assert_array_equal(tree.query_nearest(geometry, exclusive=True), expected) + + +@pytest.mark.parametrize( + "geometry,exclusive", + [ + (Point(1, 1), "invalid"), + # non-scalar exclusive parameter not allowed + (Point(1, 1), ["also invalid"]), + ([Point(1, 1)], []), + ([Point(1, 1)], [False]), + ], +) +def test_query_nearest_invalid_exclusive(tree, geometry, exclusive): + with pytest.raises(ValueError): + tree.query_nearest(geometry, exclusive=exclusive) + + +@pytest.mark.parametrize( + "geometry,all_matches", + [ + (Point(1, 1), "invalid"), + # non-scalar all_matches parameter not allowed + (Point(1, 1), ["also invalid"]), + ([Point(1, 1)], []), + ([Point(1, 1)], [False]), + ], +) +def test_query_nearest_invalid_all_matches(tree, geometry, all_matches): + with pytest.raises(ValueError): + tree.query_nearest(geometry, all_matches=all_matches) + + +def test_query_nearest_all_matches(tree): + point = Point(0.5, 0.5) + assert_array_equal(tree.query_nearest(point, all_matches=True), [0, 1]) + + indices = tree.query_nearest(point, all_matches=False) + # result is dependent on tree traversal order; may vary across test runs + assert np.array_equal(indices, [0]) or np.array_equal(indices, [1]) + + +def test_strtree_threaded_query(): + ## Create data + polygons = shapely.polygons(np.random.randn(1000, 3, 2)) + # needs to be big enough to trigger the segfault + N = 100_000 + points = shapely.points(4 * np.random.random(N) - 2, 4 * np.random.random(N) - 2) + + ## Slice parts of the arrays -> 4x4 => 16 combinations + n = int(len(polygons) / 4) + polygons_parts = [ + polygons[:n], + polygons[n : 2 * n], + polygons[2 * n : 3 * n], + polygons[3 * n :], + ] + n = int(len(points) / 4) + points_parts = [ + points[:n], + points[n : 2 * n], + points[2 * n : 3 * n], + points[3 * n :], + ] + + ## Creating the trees in advance + trees = [] + for i in range(4): + left = points_parts[i] + tree = STRtree(left) + trees.append(tree) + + ## The function querying the trees in parallel + + def thread_func(idxs): + i, j = idxs + tree = trees[i] + right = polygons_parts[j] + return tree.query(right, predicate="contains") + + with ThreadPoolExecutor() as pool: + list(pool.map(thread_func, itertools.product(range(4), range(4)))) diff --git a/billinglayer/python/shapely/tests/test_testing.py b/billinglayer/python/shapely/tests/test_testing.py new file mode 100644 index 0000000..4880d92 --- /dev/null +++ b/billinglayer/python/shapely/tests/test_testing.py @@ -0,0 +1,104 @@ +import numpy as np +import pytest + +import shapely +from shapely.testing import assert_geometries_equal + +from .common import ( + all_types, + empty, + empty_line_string, + empty_line_string_z, + empty_point, + empty_point_z, + empty_polygon, + line_string, + line_string_nan, + line_string_z, + point, +) + +EMPTY_GEOMS = ( + empty_point, + empty_point_z, + empty_line_string, + empty_line_string_z, + empty_polygon, + empty, +) + +line_string_reversed = shapely.linestrings([(0, 0), (1, 0), (1, 1)][::-1]) + + +PRE_GEOS_390 = pytest.mark.skipif( + shapely.geos_version < (3, 9, 0), + reason="2D and 3D empty geometries did not have dimensionality before GEOS 3.9", +) + + +def make_array(left, right, use_array): + if use_array in ("left", "both"): + left = np.array([left] * 3, dtype=object) + if use_array in ("right", "both"): + right = np.array([right] * 3, dtype=object) + return left, right + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +@pytest.mark.parametrize("geom", all_types + EMPTY_GEOMS) +def test_assert_geometries_equal(geom, use_array): + assert_geometries_equal(*make_array(geom, geom, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +@pytest.mark.parametrize( + "geom1,geom2", + [ + (point, line_string), + (line_string, line_string_z), + (empty_point, empty_polygon), + pytest.param(empty_point, empty_point_z, marks=PRE_GEOS_390), + pytest.param(empty_line_string, empty_line_string_z, marks=PRE_GEOS_390), + ], +) +def test_assert_geometries_not_equal(geom1, geom2, use_array): + with pytest.raises(AssertionError): + assert_geometries_equal(*make_array(geom1, geom2, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_none_equal(use_array): + assert_geometries_equal(*make_array(None, None, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_none_not_equal(use_array): + with pytest.raises(AssertionError): + assert_geometries_equal(*make_array(None, None, use_array), equal_none=False) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_nan_equal(use_array): + assert_geometries_equal(*make_array(line_string_nan, line_string_nan, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_nan_not_equal(use_array): + with pytest.raises(AssertionError): + assert_geometries_equal( + *make_array(line_string_nan, line_string_nan, use_array), equal_nan=False + ) + + +def test_normalize_true(): + assert_geometries_equal(line_string_reversed, line_string, normalize=True) + + +def test_normalize_default(): + with pytest.raises(AssertionError): + assert_geometries_equal(line_string_reversed, line_string) + + +def test_normalize_false(): + with pytest.raises(AssertionError): + assert_geometries_equal(line_string_reversed, line_string, normalize=False) diff --git a/billinglayer/python/shapely/validation.py b/billinglayer/python/shapely/validation.py new file mode 100644 index 0000000..571b9bd --- /dev/null +++ b/billinglayer/python/shapely/validation.py @@ -0,0 +1,55 @@ +# TODO: allow for implementations using other than GEOS + +import shapely + +__all__ = ["explain_validity", "make_valid"] + + +def explain_validity(ob): + """ + Explain the validity of the input geometry, if it is invalid. + This will describe why the geometry is invalid, and might + include a location if there is a self-intersection or a + ring self-intersection. + + Parameters + ---------- + ob: Geometry + A shapely geometry object + + Returns + ------- + str + A string describing the reason the geometry is invalid. + + """ + return shapely.is_valid_reason(ob) + + +def make_valid(ob): + """ + Make the input geometry valid according to the GEOS MakeValid algorithm. + + If the input geometry is already valid, then it will be returned. + + If the geometry must be split into multiple parts of the same type to be made valid, + then a multi-part geometry will be returned. + + If the geometry must be split into multiple parts of different types to be made valid, + then a GeometryCollection will be returned. + + Parameters + ---------- + ob : Geometry + A shapely geometry object which should be made valid. If the object is already valid, + it will be returned as-is. + + Returns + ------- + Geometry + The input geometry, made valid according to the GEOS MakeValid algorithm. + + """ + if ob.is_valid: + return ob + return shapely.make_valid(ob) diff --git a/billinglayer/python/shapely/vectorized/__init__.py b/billinglayer/python/shapely/vectorized/__init__.py new file mode 100644 index 0000000..5ca5ec1 --- /dev/null +++ b/billinglayer/python/shapely/vectorized/__init__.py @@ -0,0 +1,75 @@ +"""Provides multi-point element-wise operations such as ``contains``.""" + +import numpy as np + +import shapely +from shapely.prepared import PreparedGeometry + + +def _construct_points(x, y): + x, y = np.asanyarray(x), np.asanyarray(y) + if x.shape != y.shape: + raise ValueError("X and Y shapes must be equivalent.") + + if x.dtype != np.float64: + x = x.astype(np.float64) + if y.dtype != np.float64: + y = y.astype(np.float64) + + return shapely.points(x, y) + + +def contains(geometry, x, y): + """ + Vectorized (element-wise) version of `contains` which checks whether + multiple points are contained by a single geometry. + + Parameters + ---------- + geometry : PreparedGeometry or subclass of BaseGeometry + The geometry which is to be checked to see whether each point is + contained within. The geometry will be "prepared" if it is not already + a PreparedGeometry instance. + x : array + The x coordinates of the points to check. + y : array + The y coordinates of the points to check. + + Returns + ------- + Mask of points contained by the given `geometry`. + + """ + if isinstance(geometry, PreparedGeometry): + geometry = geometry.context + shapely.prepare(geometry) + return shapely.contains_xy(geometry, x, y) + + +def touches(geometry, x, y): + """ + Vectorized (element-wise) version of `touches` which checks whether + multiple points touch the exterior of a single geometry. + + Parameters + ---------- + geometry : PreparedGeometry or subclass of BaseGeometry + The geometry which is to be checked to see whether each point is + contained within. The geometry will be "prepared" if it is not already + a PreparedGeometry instance. + x : array + The x coordinates of the points to check. + y : array + The y coordinates of the points to check. + + Returns + ------- + Mask of points which touch the exterior of the given `geometry`. + + """ + if isinstance(geometry, PreparedGeometry): + geometry = geometry.context + # Touches(geom, point) == Intersects(Boundary(geom), point) + boundary = geometry.boundary + shapely.prepare(boundary) + return shapely.intersects_xy(boundary, x, y) diff --git a/billinglayer/python/shapely/vectorized/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/shapely/vectorized/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..21ed558 Binary files /dev/null and b/billinglayer/python/shapely/vectorized/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/shapely/wkb.py b/billinglayer/python/shapely/wkb.py new file mode 100644 index 0000000..c47b424 --- /dev/null +++ b/billinglayer/python/shapely/wkb.py @@ -0,0 +1,64 @@ +"""Load/dump geometries using the well-known binary (WKB) format. + +Also provides pickle-like convenience functions. +""" +import shapely + + +def loads(data, hex=False): + """Load a geometry from a WKB byte string, or hex-encoded string if + ``hex=True``. + + Raises + ------ + GEOSException, UnicodeDecodeError + If ``data`` contains an invalid geometry. + """ + return shapely.from_wkb(data) + + +def load(fp, hex=False): + """Load a geometry from an open file. + + Raises + ------ + GEOSException, UnicodeDecodeError + If the given file contains an invalid geometry. + """ + data = fp.read() + return loads(data, hex=hex) + + +def dumps(ob, hex=False, srid=None, **kw): + """Dump a WKB representation of a geometry to a byte string, or a + hex-encoded string if ``hex=True``. + + Parameters + ---------- + ob : geometry + The geometry to export to well-known binary (WKB) representation + hex : bool + If true, export the WKB as a hexadecimal string. The default is to + return a binary string/bytes object. + srid : int + Spatial reference system ID to include in the output. The default value + means no SRID is included. + **kw : kwargs, optional + Keyword output options passed to :func:`~shapely.to_wkb`. + """ + if srid is not None: + # clone the object and set the SRID before dumping + ob = shapely.set_srid(ob, srid) + kw["include_srid"] = True + if "big_endian" in kw: + # translate big_endian=True/False into byte_order=0/1 + # but if not specified, keep the default of byte_order=-1 (native) + big_endian = kw.pop("big_endian") + byte_order = 0 if big_endian else 1 + kw.update(byte_order=byte_order) + return shapely.to_wkb(ob, hex=hex, **kw) + + +def dump(ob, fp, hex=False, **kw): + """Dump a geometry to an open file.""" + fp.write(dumps(ob, hex=hex, **kw)) diff --git a/billinglayer/python/shapely/wkt.py b/billinglayer/python/shapely/wkt.py new file mode 100644 index 0000000..d496ff2 --- /dev/null +++ b/billinglayer/python/shapely/wkt.py @@ -0,0 +1,87 @@ +"""Load/dump geometries using the well-known text (WKT) format + +Also provides pickle-like convenience functions. +""" + +import shapely + + +def loads(data): + """ + Load a geometry from a WKT string. + + Parameters + ---------- + data : str + A WKT string + + Returns + ------- + Shapely geometry object + """ + return shapely.from_wkt(data) + + +def load(fp): + """ + Load a geometry from an open file. + + Parameters + ---------- + fp : + A file-like object which implements a `read` method. + + Returns + ------- + Shapely geometry object + """ + data = fp.read() + return loads(data) + + +def dumps(ob, trim=False, rounding_precision=-1, **kw): + """ + Dump a WKT representation of a geometry to a string. + + Parameters + ---------- + ob : + A geometry object of any type to be dumped to WKT. + trim : bool, default False + Remove excess decimals from the WKT. + rounding_precision : int + Round output to the specified number of digits. + Default behavior returns full precision. + output_dimension : int, default 3 + Force removal of dimensions above the one specified. + + Returns + ------- + input geometry as WKT string + """ + return shapely.to_wkt(ob, trim=trim, rounding_precision=rounding_precision, **kw) + + +def dump(ob, fp, **settings): + """ + Dump a geometry to an open file. + + Parameters + ---------- + ob : + A geometry object of any type to be dumped to WKT. + fp : + A file-like object which implements a `write` method. + trim : bool, default False + Remove excess decimals from the WKT. + rounding_precision : int + Round output to the specified number of digits. + Default behavior returns full precision. + output_dimension : int, default 3 + Force removal of dimensions above the one specified. + + Returns + ------- + None + """ + fp.write(dumps(ob, **settings)) diff --git a/billinglayer/python/tb_rest_client/__init__.py b/billinglayer/python/tb_rest_client/__init__.py new file mode 100644 index 0000000..d3af56e --- /dev/null +++ b/billinglayer/python/tb_rest_client/__init__.py @@ -0,0 +1,16 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .rest_client_ce import RestClientCE +from .rest_client_pe import RestClientPE diff --git a/billinglayer/python/tb_rest_client/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/tb_rest_client/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..6942306 Binary files /dev/null and b/billinglayer/python/tb_rest_client/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/__pycache__/api_client.cpython-311.pyc b/billinglayer/python/tb_rest_client/__pycache__/api_client.cpython-311.pyc new file mode 100644 index 0000000..c3c3d4a Binary files /dev/null and b/billinglayer/python/tb_rest_client/__pycache__/api_client.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/__pycache__/configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/__pycache__/configuration.cpython-311.pyc new file mode 100644 index 0000000..34c1a26 Binary files /dev/null and b/billinglayer/python/tb_rest_client/__pycache__/configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/__pycache__/rest.cpython-311.pyc b/billinglayer/python/tb_rest_client/__pycache__/rest.cpython-311.pyc new file mode 100644 index 0000000..4a450a6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/__pycache__/rest.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/__pycache__/rest_client_base.cpython-311.pyc b/billinglayer/python/tb_rest_client/__pycache__/rest_client_base.cpython-311.pyc new file mode 100644 index 0000000..7f7b66a Binary files /dev/null and b/billinglayer/python/tb_rest_client/__pycache__/rest_client_base.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/__pycache__/rest_client_ce.cpython-311.pyc b/billinglayer/python/tb_rest_client/__pycache__/rest_client_ce.cpython-311.pyc new file mode 100644 index 0000000..920f68a Binary files /dev/null and b/billinglayer/python/tb_rest_client/__pycache__/rest_client_ce.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/__pycache__/rest_client_pe.cpython-311.pyc b/billinglayer/python/tb_rest_client/__pycache__/rest_client_pe.cpython-311.pyc new file mode 100644 index 0000000..b72c99e Binary files /dev/null and b/billinglayer/python/tb_rest_client/__pycache__/rest_client_pe.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/__init__.py b/billinglayer/python/tb_rest_client/api/__init__.py new file mode 100644 index 0000000..5154646 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/billinglayer/python/tb_rest_client/api/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..ace2ab5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__init__.py b/billinglayer/python/tb_rest_client/api/api_ce/__init__.py new file mode 100644 index 0000000..282107c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/__init__.py @@ -0,0 +1,56 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .o_auth_2_config_template_controller_api import OAuth2ConfigTemplateControllerApi +from .asset_controller_api import AssetControllerApi +from .rule_chain_controller_api import RuleChainControllerApi +from .auth_controller_api import AuthControllerApi +from .event_controller_api import EventControllerApi +from .telemetry_controller_api import TelemetryControllerApi +from .alarm_controller_api import AlarmControllerApi +from .edge_controller_api import EdgeControllerApi +from .rpc_v_2_controller_api import RpcV2ControllerApi +from .edge_event_controller_api import EdgeEventControllerApi +from .customer_controller_api import CustomerControllerApi +from .user_controller_api import UserControllerApi +from .queue_controller_api import QueueControllerApi +from .rpc_v_1_controller_api import RpcV1ControllerApi +from .device_controller_api import DeviceControllerApi +from .entity_relation_controller_api import EntityRelationControllerApi +from .entity_view_controller_api import EntityViewControllerApi +from .admin_controller_api import AdminControllerApi +from .tb_resource_controller_api import TbResourceControllerApi +from .o_auth_2_controller_api import OAuth2ControllerApi +from .tenant_profile_controller_api import TenantProfileControllerApi +from .widgets_bundle_controller_api import WidgetsBundleControllerApi +from .device_profile_controller_api import DeviceProfileControllerApi +from .dashboard_controller_api import DashboardControllerApi +from .entity_query_controller_api import EntityQueryControllerApi +from .widget_type_controller_api import WidgetTypeControllerApi +from .audit_log_controller_api import AuditLogControllerApi +from .lwm_2m_controller_api import Lwm2mControllerApi +from .component_descriptor_controller_api import ComponentDescriptorControllerApi +from .tenant_controller_api import TenantControllerApi +from .ota_package_controller_api import OtaPackageControllerApi +from .entities_version_control_controller_api import EntitiesVersionControlControllerApi +from .device_api_controller_api import DeviceApiControllerApi +from .two_factor_auth_controller_api import TwoFactorAuthControllerApi +from .alarm_comment_controller_api import AlarmCommentControllerApi +from .asset_profile_controller_api import AssetProfileControllerApi +from .notification_controller_api import NotificationControllerApi +from .notification_rule_controller_api import NotificationRuleControllerApi +from .notification_target_controller_api import NotificationTargetControllerApi +from .notification_template_controller_api import NotificationTemplateControllerApi +from .usage_info_controller_api import UsageInfoControllerApi +from .two_factor_auth_config_controller_api import TwoFactorAuthConfigControllerApi diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d7891d2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/admin_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/admin_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d03c6db Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/admin_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/alarm_comment_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/alarm_comment_controller_api.cpython-311.pyc new file mode 100644 index 0000000..16cbdce Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/alarm_comment_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/alarm_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/alarm_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e5f588a Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/alarm_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/asset_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/asset_controller_api.cpython-311.pyc new file mode 100644 index 0000000..81dce6b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/asset_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/asset_profile_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/asset_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d27e48d Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/asset_profile_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/audit_log_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/audit_log_controller_api.cpython-311.pyc new file mode 100644 index 0000000..94ae442 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/audit_log_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/auth_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..277f42e Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/auth_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/component_descriptor_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/component_descriptor_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4f110d1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/component_descriptor_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/customer_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/customer_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f104843 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/customer_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/dashboard_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/dashboard_controller_api.cpython-311.pyc new file mode 100644 index 0000000..db49d3f Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/dashboard_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_api_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_api_controller_api.cpython-311.pyc new file mode 100644 index 0000000..3c00723 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_api_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_controller_api.cpython-311.pyc new file mode 100644 index 0000000..095e294 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_profile_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..52d9c93 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/device_profile_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/edge_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/edge_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2176d4c Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/edge_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/edge_event_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/edge_event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..58331a1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/edge_event_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entities_version_control_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entities_version_control_controller_api.cpython-311.pyc new file mode 100644 index 0000000..89708a7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entities_version_control_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_query_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_query_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9974be8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_query_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_relation_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_relation_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e329a71 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_relation_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_view_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_view_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5f06532 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/entity_view_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/event_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..dd0e5f8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/event_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/login_endpoint_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/login_endpoint_api.cpython-311.pyc new file mode 100644 index 0000000..876d8cf Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/login_endpoint_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/lwm_2m_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/lwm_2m_controller_api.cpython-311.pyc new file mode 100644 index 0000000..621345f Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/lwm_2m_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b90b75b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_rule_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_rule_controller_api.cpython-311.pyc new file mode 100644 index 0000000..6fd32ee Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_rule_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_target_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_target_controller_api.cpython-311.pyc new file mode 100644 index 0000000..14c5a20 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_target_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_template_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..65ae5d7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/notification_template_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5fe908a Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0f1b39d Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/ota_package_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/ota_package_controller_api.cpython-311.pyc new file mode 100644 index 0000000..629035e Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/ota_package_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/queue_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/queue_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e4abfb8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/queue_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_1_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_1_controller_api.cpython-311.pyc new file mode 100644 index 0000000..526a95c Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_1_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_2_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4ec009b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_2_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rule_chain_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rule_chain_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9bf30bb Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/rule_chain_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tb_resource_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tb_resource_controller_api.cpython-311.pyc new file mode 100644 index 0000000..03f105e Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tb_resource_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/telemetry_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/telemetry_controller_api.cpython-311.pyc new file mode 100644 index 0000000..a985111 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/telemetry_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tenant_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tenant_controller_api.cpython-311.pyc new file mode 100644 index 0000000..be3f48c Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tenant_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tenant_profile_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tenant_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..449795e Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/tenant_profile_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc new file mode 100644 index 0000000..cf4c600 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e044c1b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/ui_settings_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/ui_settings_controller_api.cpython-311.pyc new file mode 100644 index 0000000..dd7eee3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/ui_settings_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/usage_info_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/usage_info_controller_api.cpython-311.pyc new file mode 100644 index 0000000..ab95830 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/usage_info_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/user_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/user_controller_api.cpython-311.pyc new file mode 100644 index 0000000..8423982 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/user_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/widget_type_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/widget_type_controller_api.cpython-311.pyc new file mode 100644 index 0000000..14935f8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/widget_type_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/widgets_bundle_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/widgets_bundle_controller_api.cpython-311.pyc new file mode 100644 index 0000000..ad5b585 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_ce/__pycache__/widgets_bundle_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_ce/admin_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/admin_controller_api.py new file mode 100644 index 0000000..17a3a6a --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/admin_controller_api.py @@ -0,0 +1,1944 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AdminControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def auto_commit_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def auto_commit_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method auto_commit_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_repository_access_using_post(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_repository_access_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_repository_access_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/checkAccess', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_updates_using_get(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def check_updates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_updates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UpdateMessage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_auto_commit_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_auto_commit_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_auto_commit_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_repository_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_repository_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_repository_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_admin_settings_using_get(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + else: + (data) = self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + return data + + def get_admin_settings_using_get_with_http_info(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get_with_http_info(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_admin_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'key' is set + if ('key' not in params or + params['key'] is None): + raise ValueError("Missing the required parameter `key` when calling `get_admin_settings_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'key' in params: + path_params['key'] = params['key'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/{key}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_commit_settings_using_get(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_commit_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_commit_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_features_info_using_get(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_features_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_features_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/featuresInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FeaturesInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_jwt_settings_using_get(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_jwt_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_jwt_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_info_using_get(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettingsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_using_get(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_security_settings_using_get(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_security_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_security_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_system_info_using_get(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_system_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_system_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/systemInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SystemInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def repository_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def repository_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method repository_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_admin_settings_using_post(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_admin_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_admin_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_auto_commit_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_auto_commit_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_auto_commit_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_jwt_settings_using_post(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_jwt_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_jwt_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_repository_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_repository_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_repository_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultRepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_security_settings_using_post(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_security_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_security_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_mail_using_post(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. You may change the 'To' email in the user profile of the System Administrator. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_mail_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. You may change the 'To' email in the user profile of the System Administrator. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_mail_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testMail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_sms_using_post(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_sms_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_sms_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testSms', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/alarm_comment_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/alarm_comment_controller_api.py new file mode 100644 index 0000000..9f65853 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/alarm_comment_controller_api.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmCommentControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_alarm_comment_using_delete(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_comment_using_delete_with_http_info(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'comment_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_comment_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + # verify the required parameter 'comment_id' is set + if ('comment_id' not in params or + params['comment_id'] is None): + raise ValueError("Missing the required parameter `comment_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'comment_id' in params: + path_params['commentId'] = params['comment_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment/{commentId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_comments_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarm_comments_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_comments_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarm_comments_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment{?page,pageSize,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmCommentInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_comment_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def save_alarm_comment_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_comment_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `save_alarm_comment_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmComment', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/alarm_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/alarm_controller_api.py new file mode 100644 index 0000000..4739127 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/alarm_controller_api.py @@ -0,0 +1,1518 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def ack_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def ack_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method ack_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `ack_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/ack', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_alarm_using_post(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + return data + + def assign_alarm_using_post_with_http_info(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `assign_alarm_using_post`") # noqa: E501 + # verify the required parameter 'assignee_id' is set + if ('assignee_id' not in params or + params['assignee_id'] is None): + raise ValueError("Missing the required parameter `assignee_id` when calling `assign_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'assignee_id' in params: + path_params['assigneeId'] = params['assignee_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign/{assigneeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def clear_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def clear_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `clear_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/clear', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_info_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_info_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/info/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{entityType}/{entityId}{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_v2_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_v2_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarm/{entityType}/{entityId}{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarms{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_v2_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_v2_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarms{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_highest_alarm_severity_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_highest_alarm_severity_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'search_status', 'status', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_highest_alarm_severity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/highestSeverity/{entityType}/{entityId}{?assigneeId,searchStatus,status}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_using_post(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_alarm_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def unassign_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `unassign_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/asset_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/asset_controller_api.py new file mode 100644 index 0000000..12d7142 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/asset_controller_api.py @@ -0,0 +1,2028 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_asset_to_customer_using_post(self, customer_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to customer (assignAssetToCustomer) # noqa: E501 + + Creates assignment of the asset to customer. Customer will be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_customer_using_post(customer_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_asset_to_customer_using_post_with_http_info(customer_id, asset_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_asset_to_customer_using_post_with_http_info(customer_id, asset_id, **kwargs) # noqa: E501 + return data + + def assign_asset_to_customer_using_post_with_http_info(self, customer_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to customer (assignAssetToCustomer) # noqa: E501 + + Creates assignment of the asset to customer. Customer will be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_customer_using_post_with_http_info(customer_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_asset_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_asset_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `assign_asset_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/asset/{assetId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_asset_to_edge_using_post(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to edge (assignAssetToEdge) # noqa: E501 + + Creates assignment of an existing asset to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once asset will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_edge_using_post(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_asset_to_edge_using_post_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_asset_to_edge_using_post_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + return data + + def assign_asset_to_edge_using_post_with_http_info(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to edge (assignAssetToEdge) # noqa: E501 + + Creates assignment of an existing asset to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once asset will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_edge_using_post_with_http_info(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_asset_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_asset_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `assign_asset_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/asset/{assetId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_asset_to_public_customer_using_post(self, asset_id, **kwargs): # noqa: E501 + """Make asset publicly available (assignAssetToPublicCustomer) # noqa: E501 + + Asset will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_public_customer_using_post(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_asset_to_public_customer_using_post_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_asset_to_public_customer_using_post_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def assign_asset_to_public_customer_using_post_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Make asset publicly available (assignAssetToPublicCustomer) # noqa: E501 + + Asset will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_public_customer_using_post_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_asset_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `assign_asset_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/asset/{assetId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_asset_using_delete(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def delete_asset_using_delete_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `delete_asset_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_info_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_info_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/info/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_types_using_get(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_asset_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_assets_by_ids_using_get(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing 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 = api.get_assets_by_ids_using_get(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of assets ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + return data + + def get_assets_by_ids_using_get_with_http_info(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing 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 = api.get_assets_by_ids_using_get_with_http_info(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of assets ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_assets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_ids' is set + if ('asset_ids' not in params or + params['asset_ids'] is None): + raise ValueError("Missing the required parameter `asset_ids` when calling `get_assets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_ids' in params: + query_params.append(('assetIds', params['asset_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets{?assetIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_asset_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of assets info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_asset_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of assets info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assetInfos{?assetProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_assets_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_assets_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_assets_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get assets assigned to edge (getEdgeAssets) # noqa: E501 + + Returns a page of assets assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_assets_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Assets with creation time before it won't be queried + :param int end_time: Timestamp. Assets with creation time after it won't be queried + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_assets_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_assets_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_assets_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get assets assigned to edge (getEdgeAssets) # noqa: E501 + + Returns a page of assets assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_assets_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Assets with creation time before it won't be queried + :param int end_time: Timestamp. Assets with creation time after it won't be queried + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_assets_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/assets{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_asset_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Asset Infos (getTenantAssetInfos) # noqa: E501 + + Returns a page of assets info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_asset_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Asset Infos (getTenantAssetInfos) # noqa: E501 + + Returns a page of assets info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assetInfos{?assetProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_asset_using_get(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + return data + + def get_tenant_asset_using_get_with_http_info(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get_with_http_info(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_asset_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_name' is set + if ('asset_name' not in params or + params['asset_name'] is None): + raise ValueError("Missing the required parameter `asset_name` when calling `get_tenant_asset_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_name' in params: + query_params.append(('assetName', params['asset_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?assetName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_assets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_assets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_assets_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_assets_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_assets_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_assets_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_assets_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_assets_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_assets_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_asset_from_customer_using_delete(self, asset_id, **kwargs): # noqa: E501 + """Unassign asset from customer (unassignAssetFromCustomer) # noqa: E501 + + Clears assignment of the asset to customer. Customer will not be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_customer_using_delete(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_asset_from_customer_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_asset_from_customer_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def unassign_asset_from_customer_using_delete_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Unassign asset from customer (unassignAssetFromCustomer) # noqa: E501 + + Clears assignment of the asset to customer. Customer will not be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_customer_using_delete_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_asset_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `unassign_asset_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_asset_from_edge_using_delete(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Unassign asset from edge (unassignAssetFromEdge) # noqa: E501 + + Clears assignment of the asset to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove asset locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_edge_using_delete(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_asset_from_edge_using_delete_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_asset_from_edge_using_delete_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + return data + + def unassign_asset_from_edge_using_delete_with_http_info(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Unassign asset from edge (unassignAssetFromEdge) # noqa: E501 + + Clears assignment of the asset to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove asset locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_edge_using_delete_with_http_info(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_asset_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_asset_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `unassign_asset_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/asset_profile_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/asset_profile_controller_api.py new file mode 100644 index 0000000..3203879 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/asset_profile_controller_api.py @@ -0,0 +1,839 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_asset_profile_using_delete(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def delete_asset_profile_using_delete_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `delete_asset_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_info_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_info_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_asset_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_asset_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_asset_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_asset_profile_using_post(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_asset_profile_using_post_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `set_default_asset_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/audit_log_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/audit_log_controller_api.py new file mode 100644 index 0000000..84c91fd --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/audit_log_controller_api.py @@ -0,0 +1,587 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuditLogControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_audit_logs_by_customer_id_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_customer_id_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_customer_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/customer/{customerId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_entity_id_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_entity_id_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_entity_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/entity/{entityType}/{entityId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_user_id_using_get(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_user_id_using_get_with_http_info(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_user_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/user/{userId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/auth_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/auth_controller_api.py new file mode 100644 index 0000000..816f026 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/auth_controller_api.py @@ -0,0 +1,882 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def activate_user_using_post(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def activate_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def change_password_using_post(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def change_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/changePassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ObjectNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_activate_token_using_get(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + else: + (data) = self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + return data + + def check_activate_token_using_get_with_http_info(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get_with_http_info(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['activate_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_activate_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'activate_token' is set + if ('activate_token' not in params or + params['activate_token'] is None): + raise ValueError("Missing the required parameter `activate_token` when calling `check_activate_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'activate_token' in params: + query_params.append(('activateToken', params['activate_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?activateToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_reset_token_using_get(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + else: + (data) = self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + return data + + def check_reset_token_using_get_with_http_info(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get_with_http_info(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['reset_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_reset_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'reset_token' is set + if ('reset_token' not in params or + params['reset_token'] is None): + raise ValueError("Missing the required parameter `reset_token` when calling `check_reset_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'reset_token' in params: + query_params.append(('resetToken', params['reset_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword{?resetToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_password_policy_using_get(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_password_policy_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_password_policy_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/userPasswordPolicy', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserPasswordPolicy', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_using_get(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/user', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def logout_using_post(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def logout_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/logout', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_reset_password_by_email_using_post(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def request_reset_password_by_email_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_reset_password_by_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPasswordByEmail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reset_password_using_post(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def reset_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reset_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/component_descriptor_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/component_descriptor_controller_api.py new file mode 100644 index 0000000..bb75454 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/component_descriptor_controller_api.py @@ -0,0 +1,340 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ComponentDescriptorControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_component_descriptor_by_clazz_using_get(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + return data + + def get_component_descriptor_by_clazz_using_get_with_http_info(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_descriptor_clazz'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptor_by_clazz_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_descriptor_clazz' is set + if ('component_descriptor_clazz' not in params or + params['component_descriptor_clazz'] is None): + raise ValueError("Missing the required parameter `component_descriptor_clazz` when calling `get_component_descriptor_by_clazz_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_descriptor_clazz' in params: + path_params['componentDescriptorClazz'] = params['component_descriptor_clazz'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/component/{componentDescriptorClazz}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ComponentDescriptor', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_type_using_get(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_type_using_get_with_http_info(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get_with_http_info(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_type', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_type' is set + if ('component_type' not in params or + params['component_type'] is None): + raise ValueError("Missing the required parameter `component_type` when calling `get_component_descriptors_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_type' in params: + path_params['componentType'] = params['component_type'] # noqa: E501 + + query_params = [] + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components/{componentType}{?ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_types_using_get(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_types_using_get_with_http_info(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get_with_http_info(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_types', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_types' is set + if ('component_types' not in params or + params['component_types'] is None): + raise ValueError("Missing the required parameter `component_types` when calling `get_component_descriptors_by_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'component_types' in params: + query_params.append(('componentTypes', params['component_types'])) # noqa: E501 + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components{?componentTypes,ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/customer_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/customer_controller_api.py new file mode 100644 index 0000000..cc5c37a --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/customer_controller_api.py @@ -0,0 +1,731 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomerControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_customer_using_delete(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def delete_customer_using_delete_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `delete_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_title_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_title_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_title_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_title_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/text']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/title', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_customers_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customers_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customers_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_short_customer_info_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_short_customer_info_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_short_customer_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_short_customer_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/shortInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_customer_using_get(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + return data + + def get_tenant_customer_using_get_with_http_info(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get_with_http_info(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_title'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_customer_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_title' is set + if ('customer_title' not in params or + params['customer_title'] is None): + raise ValueError("Missing the required parameter `customer_title` when calling `get_tenant_customer_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'customer_title' in params: + query_params.append(('customerTitle', params['customer_title'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/customers{?customerTitle}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_customer_using_post(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_customer_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/dashboard_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/dashboard_controller_api.py new file mode 100644 index 0000000..265dd6c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/dashboard_controller_api.py @@ -0,0 +1,2360 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DashboardControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_dashboard_customers_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Adds the Dashboard Customers (addDashboardCustomers) # noqa: E501 + + Adds the list of Customers to the existing list of assignments for the Dashboard. Keeps previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dashboard_customers_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.add_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.add_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def add_dashboard_customers_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Adds the Dashboard Customers (addDashboardCustomers) # noqa: E501 + + Adds the list of Customers to the existing list of assignments for the Dashboard. Keeps previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dashboard_customers_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_dashboard_customers_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `add_dashboard_customers_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}/customers/add', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_dashboard_to_customer_using_post(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard (assignDashboardToCustomer) # noqa: E501 + + Assign the Dashboard to specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_customer_using_post(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_dashboard_to_customer_using_post_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_dashboard_to_customer_using_post_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def assign_dashboard_to_customer_using_post_with_http_info(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard (assignDashboardToCustomer) # noqa: E501 + + Assign the Dashboard to specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_customer_using_post_with_http_info(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_dashboard_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_dashboard_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `assign_dashboard_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboard/{dashboardId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_dashboard_to_edge_using_post(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Assign dashboard to edge (assignDashboardToEdge) # noqa: E501 + + Creates assignment of an existing dashboard to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once dashboard will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_edge_using_post(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_dashboard_to_edge_using_post_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_dashboard_to_edge_using_post_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def assign_dashboard_to_edge_using_post_with_http_info(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Assign dashboard to edge (assignDashboardToEdge) # noqa: E501 + + Creates assignment of an existing dashboard to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once dashboard will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_edge_using_post_with_http_info(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_dashboard_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_dashboard_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `assign_dashboard_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/dashboard/{dashboardId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_dashboard_to_public_customer_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard to Public Customer (assignDashboardToPublicCustomer) # noqa: E501 + + Assigns the dashboard to a special, auto-generated 'Public' Customer. Once assigned, unauthenticated users may browse the dashboard. This method is useful if you like to embed the dashboard on public web pages to be available for users that are not logged in. Be aware that making the dashboard public does not mean that it automatically makes all devices and assets you use in the dashboard to be public.Use [assign Asset to Public Customer](#!/asset-controller/assignAssetToPublicCustomerUsingPOST) and [assign Device to Public Customer](#!/device-controller/assignDeviceToPublicCustomerUsingPOST) for this purpose. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_public_customer_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_dashboard_to_public_customer_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_dashboard_to_public_customer_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def assign_dashboard_to_public_customer_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard to Public Customer (assignDashboardToPublicCustomer) # noqa: E501 + + Assigns the dashboard to a special, auto-generated 'Public' Customer. Once assigned, unauthenticated users may browse the dashboard. This method is useful if you like to embed the dashboard on public web pages to be available for users that are not logged in. Be aware that making the dashboard public does not mean that it automatically makes all devices and assets you use in the dashboard to be public.Use [assign Asset to Public Customer](#!/asset-controller/assignAssetToPublicCustomerUsingPOST) and [assign Device to Public Customer](#!/device-controller/assignDeviceToPublicCustomerUsingPOST) for this purpose. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_public_customer_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_dashboard_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `assign_dashboard_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/dashboard/{dashboardId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_dashboard_using_delete(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def delete_dashboard_using_delete_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_dashboard_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `delete_dashboard_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_dashboards_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_dashboards_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboards{?mobile,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_info_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_info_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/info/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_dashboards_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Dashboards (getEdgeDashboards) # noqa: E501 + + Returns a page of dashboard info objects assigned to the specified edge. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_dashboards_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_dashboards_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_dashboards_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_dashboards_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Dashboards (getEdgeDashboards) # noqa: E501 + + Returns a page of dashboard info objects assigned to the specified edge. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_dashboards_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_max_datapoints_limit_using_get(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_max_datapoints_limit_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_max_datapoints_limit_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/maxDatapointsLimit', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_server_time_using_get(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_server_time_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_server_time_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/serverTime', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboards{?mobile,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get1(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get1_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_dashboard_customers_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Remove the Dashboard Customers (removeDashboardCustomers) # noqa: E501 + + Removes the list of Customers from the existing list of assignments for the Dashboard. Keeps other assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dashboard_customers_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.remove_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.remove_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def remove_dashboard_customers_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Remove the Dashboard Customers (removeDashboardCustomers) # noqa: E501 + + Removes the list of Customers from the existing list of assignments for the Dashboard. Keeps other assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dashboard_customers_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_dashboard_customers_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `remove_dashboard_customers_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}/customers/remove', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_dashboard_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_dashboard_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_dashboard_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_tenant_home_dashboard_info_using_post(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def set_tenant_home_dashboard_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_tenant_home_dashboard_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_dashboard_from_customer_using_delete(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard (unassignDashboardFromCustomer) # noqa: E501 + + Unassign the Dashboard from specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_customer_using_delete(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_dashboard_from_customer_using_delete_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_dashboard_from_customer_using_delete_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def unassign_dashboard_from_customer_using_delete_with_http_info(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard (unassignDashboardFromCustomer) # noqa: E501 + + Unassign the Dashboard from specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_customer_using_delete_with_http_info(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_dashboard_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `unassign_dashboard_from_customer_using_delete`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `unassign_dashboard_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_dashboard_from_edge_using_delete(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign dashboard from edge (unassignDashboardFromEdge) # noqa: E501 + + Clears assignment of the dashboard to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove dashboard locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_edge_using_delete(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_dashboard_from_edge_using_delete_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_dashboard_from_edge_using_delete_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def unassign_dashboard_from_edge_using_delete_with_http_info(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign dashboard from edge (unassignDashboardFromEdge) # noqa: E501 + + Clears assignment of the dashboard to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove dashboard locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_edge_using_delete_with_http_info(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_dashboard_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_dashboard_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `unassign_dashboard_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_dashboard_from_public_customer_using_delete(self, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard from Public Customer (unassignDashboardFromPublicCustomer) # noqa: E501 + + Unassigns the dashboard from a special, auto-generated 'Public' Customer. Once unassigned, unauthenticated users may no longer browse the dashboard. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_public_customer_using_delete(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_dashboard_from_public_customer_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_dashboard_from_public_customer_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def unassign_dashboard_from_public_customer_using_delete_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard from Public Customer (unassignDashboardFromPublicCustomer) # noqa: E501 + + Unassigns the dashboard from a special, auto-generated 'Public' Customer. Once unassigned, unauthenticated users may no longer browse the dashboard. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_public_customer_using_delete_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_dashboard_from_public_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `unassign_dashboard_from_public_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_dashboard_customers_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Update the Dashboard Customers (updateDashboardCustomers) # noqa: E501 + + Updates the list of Customers that this Dashboard is assigned to. Removes previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_dashboard_customers_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.update_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def update_dashboard_customers_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Update the Dashboard Customers (updateDashboardCustomers) # noqa: E501 + + Updates the list of Customers that this Dashboard is assigned to. Removes previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_dashboard_customers_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_dashboard_customers_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `update_dashboard_customers_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}/customers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/device_api_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/device_api_controller_api.py new file mode 100644 index 0000000..0379c8b --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/device_api_controller_api.py @@ -0,0 +1,1212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceApiControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def claim_device_using_post(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def claim_device_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `claim_device_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/claim', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_attributes_using_get(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + else: + (data) = self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + return data + + def get_device_attributes_using_get_with_http_info(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'client_keys', 'shared_keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'client_keys' is set + if ('client_keys' not in params or + params['client_keys'] is None): + raise ValueError("Missing the required parameter `client_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'shared_keys' is set + if ('shared_keys' not in params or + params['shared_keys'] is None): + raise ValueError("Missing the required parameter `shared_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'client_keys' in params: + query_params.append(('clientKeys', params['client_keys'])) # noqa: E501 + if 'shared_keys' in params: + query_params.append(('sharedKeys', params['shared_keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes{?clientKeys,sharedKeys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_firmware_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_firmware_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_firmware_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_firmware_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/firmware{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_software_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_software_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_software_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_software_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/software{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_device_attributes_using_post(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_device_attributes_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_rpc_request_using_post(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_rpc_request_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_telemetry_using_post(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_telemetry_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/telemetry', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def provision_device_using_post(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def provision_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method provision_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/provision', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reply_to_command_using_post(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + else: + (data) = self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + return data + + def reply_to_command_using_post_with_http_info(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post_with_http_info(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'request_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reply_to_command_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `reply_to_command_using_post`") # noqa: E501 + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `reply_to_command_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc/{requestId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_attributes_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_attributes_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes/updates{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_commands_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_commands_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_commands_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_commands_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/device_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/device_controller_api.py new file mode 100644 index 0000000..8c37513 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/device_controller_api.py @@ -0,0 +1,2737 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_device_to_customer_using_post(self, customer_id, device_id, **kwargs): # noqa: E501 + """Assign device to customer (assignDeviceToCustomer) # noqa: E501 + + Creates assignment of the device to customer. Customer will be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_customer_using_post(customer_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_customer_using_post_with_http_info(customer_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_customer_using_post_with_http_info(customer_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_customer_using_post_with_http_info(self, customer_id, device_id, **kwargs): # noqa: E501 + """Assign device to customer (assignDeviceToCustomer) # noqa: E501 + + Creates assignment of the device to customer. Customer will be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_customer_using_post_with_http_info(customer_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_device_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_device_to_edge_using_post(self, edge_id, device_id, **kwargs): # noqa: E501 + """Assign device to edge (assignDeviceToEdge) # noqa: E501 + + Creates assignment of an existing device to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once device will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_edge_using_post(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_edge_using_post_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_edge_using_post_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_edge_using_post_with_http_info(self, edge_id, device_id, **kwargs): # noqa: E501 + """Assign device to edge (assignDeviceToEdge) # noqa: E501 + + Creates assignment of an existing device to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once device will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_edge_using_post_with_http_info(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_device_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_device_to_public_customer_using_post(self, device_id, **kwargs): # noqa: E501 + """Make device publicly available (assignDeviceToPublicCustomer) # noqa: E501 + + Device will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_public_customer_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_public_customer_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_public_customer_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_public_customer_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Make device publicly available (assignDeviceToPublicCustomer) # noqa: E501 + + Device will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_public_customer_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_device_to_tenant_using_post(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_tenant_using_post_with_http_info(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def claim_device_using_post1(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def claim_device_using_post1_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `claim_device_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_by_device_profile_and_empty_ota_package_using_get(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + return data + + def count_by_device_profile_and_empty_ota_package_using_get_with_http_info(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_type', 'device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_by_device_profile_and_empty_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_type' is set + if ('ota_package_type' not in params or + params['ota_package_type'] is None): + raise ValueError("Missing the required parameter `ota_package_type` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_type' in params: + path_params['otaPackageType'] = params['ota_package_type'] # noqa: E501 + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices/count/{otaPackageType}/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_device_using_delete(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def delete_device_using_delete_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post1(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_device_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of devices info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_device_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of devices info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/deviceInfos{?active,deviceProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_devices_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_devices_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. If the user has the authority of 'TENANT_ADMIN', the server checks that the device is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the device is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. If the user has the authority of 'TENANT_ADMIN', the server checks that the device is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the device is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_credentials_by_device_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_credentials_by_device_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_credentials_by_device_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_credentials_by_device_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}/credentials', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_info_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device Info (getDeviceInfoById) # noqa: E501 + + Fetch the Device Info object based on the provided Device Id. If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_info_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device Info (getDeviceInfoById) # noqa: E501 + + Fetch the Device Info object based on the provided Device Id. If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/info/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_types_using_get(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_device_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_devices_by_ids_using_get(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + return data + + def get_devices_by_ids_using_get_with_http_info(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get_with_http_info(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_devices_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_ids' is set + if ('device_ids' not in params or + params['device_ids'] is None): + raise ValueError("Missing the required parameter `device_ids` when calling `get_devices_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_ids' in params: + query_params.append(('deviceIds', params['device_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices{?deviceIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_devices_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get devices assigned to edge (getEdgeDevices) # noqa: E501 + + Returns a page of devices assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_devices_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Devices with creation time before it won't be queried + :param int end_time: Timestamp. Devices with creation time after it won't be queried + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_devices_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_devices_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_devices_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get devices assigned to edge (getEdgeDevices) # noqa: E501 + + Returns a page of devices assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_devices_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Devices with creation time before it won't be queried + :param int end_time: Timestamp. Devices with creation time after it won't be queried + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'type', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_devices_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/devices{?active,deviceProfileId,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_device_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Device Infos (getTenantDeviceInfos) # noqa: E501 + + Returns a page of devices info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_device_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Device Infos (getTenantDeviceInfos) # noqa: E501 + + Returns a page of devices info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/deviceInfos{?active,deviceProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_device_using_get(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def get_tenant_device_using_get_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `get_tenant_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_name' in params: + query_params.append(('deviceName', params['device_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?deviceName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_devices_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_devices_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_devices_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_devices_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_devices_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def re_claim_device_using_delete(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def re_claim_device_using_delete_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method re_claim_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `re_claim_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'access_token' in params: + query_params.append(('accessToken', params['access_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device{?accessToken}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_with_credentials_using_post(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_with_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_with_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device-with-credentials', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_device_from_customer_using_delete(self, device_id, **kwargs): # noqa: E501 + """Unassign device from customer (unassignDeviceFromCustomer) # noqa: E501 + + Clears assignment of the device to customer. Customer will not be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_customer_using_delete(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_device_from_customer_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_device_from_customer_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def unassign_device_from_customer_using_delete_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Unassign device from customer (unassignDeviceFromCustomer) # noqa: E501 + + Clears assignment of the device to customer. Customer will not be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_customer_using_delete_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_device_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `unassign_device_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_device_from_edge_using_delete(self, edge_id, device_id, **kwargs): # noqa: E501 + """Unassign device from edge (unassignDeviceFromEdge) # noqa: E501 + + Clears assignment of the device to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove device locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_edge_using_delete(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_device_from_edge_using_delete_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_device_from_edge_using_delete_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + return data + + def unassign_device_from_edge_using_delete_with_http_info(self, edge_id, device_id, **kwargs): # noqa: E501 + """Unassign device from edge (unassignDeviceFromEdge) # noqa: E501 + + Clears assignment of the device to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove device locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_edge_using_delete_with_http_info(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_device_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_device_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `unassign_device_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_device_credentials_using_post(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def update_device_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_device_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/credentials', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/device_profile_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/device_profile_controller_api.py new file mode 100644 index 0000000..f7d31c0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/device_profile_controller_api.py @@ -0,0 +1,1025 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_profile_using_delete(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def delete_device_profile_using_delete_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `delete_device_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_keys_using_get(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_attributes_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/attributes{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_device_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_device_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_device_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_info_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_info_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'transport_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'transport_type' in params: + query_params.append(('transportType', params['transport_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch,transportType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/timeseries{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_device_profile_using_post(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_device_profile_using_post_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `set_default_device_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/edge_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/edge_controller_api.py new file mode 100644 index 0000000..e5459e3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/edge_controller_api.py @@ -0,0 +1,2269 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_edge_to_customer_using_post(self, customer_id, edge_id, **kwargs): # noqa: E501 + """Assign edge to customer (assignEdgeToCustomer) # noqa: E501 + + Creates assignment of the edge to customer. Customer will be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_customer_using_post(customer_id, edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_edge_to_customer_using_post_with_http_info(customer_id, edge_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_edge_to_customer_using_post_with_http_info(customer_id, edge_id, **kwargs) # noqa: E501 + return data + + def assign_edge_to_customer_using_post_with_http_info(self, customer_id, edge_id, **kwargs): # noqa: E501 + """Assign edge to customer (assignEdgeToCustomer) # noqa: E501 + + Creates assignment of the edge to customer. Customer will be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_customer_using_post_with_http_info(customer_id, edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_edge_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_edge_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_edge_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edge/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_edge_to_public_customer_using_post(self, edge_id, **kwargs): # noqa: E501 + """Make edge publicly available (assignEdgeToPublicCustomer) # noqa: E501 + + Edge will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_public_customer_using_post(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_edge_to_public_customer_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_edge_to_public_customer_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def assign_edge_to_public_customer_using_post_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Make edge publicly available (assignEdgeToPublicCustomer) # noqa: E501 + + Edge will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_public_customer_using_post_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_edge_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_edge_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/edge/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_edge_using_delete(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def delete_edge_using_delete_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `delete_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post2(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post2_with_http_info(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post2" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_missing_to_related_rule_chains_using_get(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def find_missing_to_related_rule_chains_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_missing_to_related_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `find_missing_to_related_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/missingToRelatedRuleChains/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edge_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edges info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edge_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edges info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edgeInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edges_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edges_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_docker_install_instructions_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_docker_install_instructions_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_docker_install_instructions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_docker_install_instructions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/instructions/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInstallInstructions', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_info_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge Info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_info_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge Info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/info/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_types_using_get(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_edge_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_by_ids_using_get(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + return data + + def get_edges_by_ids_using_get_with_http_info(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get_with_http_info(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_ids' is set + if ('edge_ids' not in params or + params['edge_ids'] is None): + raise ValueError("Missing the required parameter `edge_ids` when calling `get_edges_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_ids' in params: + query_params.append(('edgeIds', params['edge_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?edgeIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edge_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edge Infos (getTenantEdgeInfos) # noqa: E501 + + Returns a page of edges info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_edge_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edge Infos (getTenantEdgeInfos) # noqa: E501 + + Returns a page of edges info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edgeInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edge_using_get(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + return data + + def get_tenant_edge_using_get_with_http_info(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get_with_http_info(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edge_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_name' is set + if ('edge_name' not in params or + params['edge_name'] is None): + raise ValueError("Missing the required parameter `edge_name` when calling `get_tenant_edge_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_name' in params: + query_params.append(('edgeName', params['edge_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?edgeName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_edges_support_enabled_using_get(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_edges_support_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_edges_support_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges/enabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_edges_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_edges_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_edges_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_edge_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_edge_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_root_rule_chain_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_root_rule_chain_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def sync_edge_using_post(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def sync_edge_using_post_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method sync_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `sync_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/sync/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_edge_from_customer_using_delete(self, edge_id, **kwargs): # noqa: E501 + """Unassign edge from customer (unassignEdgeFromCustomer) # noqa: E501 + + Clears assignment of the edge to customer. Customer will not be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_edge_from_customer_using_delete(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_edge_from_customer_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_edge_from_customer_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def unassign_edge_from_customer_using_delete_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Unassign edge from customer (unassignEdgeFromCustomer) # noqa: E501 + + Clears assignment of the edge to customer. Customer will not be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_edge_from_customer_using_delete_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_edge_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_edge_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/edge/{edgeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/edge_event_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/edge_event_controller_api.py new file mode 100644 index 0000000..d005dee --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/edge_event_controller_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeEventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_edge_events_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_events_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/events{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/entities_version_control_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/entities_version_control_controller_api.py new file mode 100644 index 0000000..db55a3c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/entities_version_control_controller_api.py @@ -0,0 +1,1327 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntitiesVersionControlControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def compare_entity_data_to_version_using_get(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + else: + (data) = self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + return data + + def compare_entity_data_to_version_using_get_with_http_info(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'internal_entity_uuid', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method compare_entity_data_to_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'internal_entity_uuid' is set + if ('internal_entity_uuid' not in params or + params['internal_entity_uuid'] is None): + raise ValueError("Missing the required parameter `internal_entity_uuid` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'internal_entity_uuid' in params: + path_params['internalEntityUuid'] = params['internal_entity_uuid'] # noqa: E501 + + query_params = [] + if 'version_id' in params: + query_params.append(('versionId', params['version_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/diff/{entityType}/{internalEntityUuid}{?versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataDiff', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_data_info_using_get(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes) and `hasCredentials` (whether stored device data has credentials). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + return data + + def get_entity_data_info_using_get_with_http_info(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes) and `hasCredentials` (whether stored device data has credentials). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id', 'entity_type', 'external_entity_uuid'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_data_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `get_entity_data_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/info/{versionId}/{entityType}/{externalEntityUuid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_create_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_create_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_create_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_create_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionCreationResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_load_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_load_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_load_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_load_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionLoadResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_all_entities_at_version_using_get(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + return data + + def list_all_entities_at_version_using_get_with_http_info(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get_with_http_info(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_all_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_all_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_branches_using_get(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def list_branches_using_get_with_http_info(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_branches_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/branches', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListBranchInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entities_at_version_using_get(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + return data + + def list_entities_at_version_using_get_with_http_info(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get_with_http_info(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entities_at_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{entityType}/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_type_versions_using_get(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_type_versions_using_get_with_http_info(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_type_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_type_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_versions_using_get(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_versions_using_get_with_http_info(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'external_entity_uuid', 'branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}/{externalEntityUuid}?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_versions_using_get(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_versions_using_get_with_http_info(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get_with_http_info(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def load_entities_version_using_post(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation). An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def load_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation). An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method load_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entities_version_using_post(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify the list of specific entities (`entityIds`); - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify the list of specific entities (`entityIds`); - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultuuid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/entity_query_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/entity_query_controller_api.py new file mode 100644 index 0000000..d03683f --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/entity_query_controller_api.py @@ -0,0 +1,538 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityQueryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def count_alarms_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_alarms_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_alarms_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_entities_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_entities_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_entities_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_alarm_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_alarm_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_alarm_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_entity_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_timeseries_and_attributes_keys_by_query_using_post(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + else: + (data) = self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + return data + + def find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['timeseries', 'attributes', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_timeseries_and_attributes_keys_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'timeseries' is set + if ('timeseries' not in params or + params['timeseries'] is None): + raise ValueError("Missing the required parameter `timeseries` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + # verify the required parameter 'attributes' is set + if ('attributes' not in params or + params['attributes'] is None): + raise ValueError("Missing the required parameter `attributes` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'timeseries' in params: + query_params.append(('timeseries', params['timeseries'])) # noqa: E501 + if 'attributes' in params: + query_params.append(('attributes', params['attributes'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find/keys{?attributes,timeseries}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/entity_relation_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/entity_relation_controller_api.py new file mode 100644 index 0000000..90f7257 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/entity_relation_controller_api.py @@ -0,0 +1,1355 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityRelationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_relation_using_delete(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def delete_relation_using_delete_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relation_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `delete_relation_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_relations_using_delete(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + return data + + def delete_relations_using_delete_with_http_info(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete_with_http_info(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_id', 'entity_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relations_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_relations_using_delete`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_relations_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_id' in params: + query_params.append(('entityId', params['entity_id'])) # noqa: E501 + if 'entity_type' in params: + query_params.append(('entityType', params['entity_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?entityId,entityType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get_with_http_info(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get1(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get1_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get1`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post3(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post3_with_http_info(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post3" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get_with_http_info(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get1(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get1_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get1`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_from_using_get(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_info_by_from_using_get_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_info_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_info_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_info_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_to_using_get(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_info_by_to_using_get_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_info_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_info_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_relation_using_get(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def get_relation_using_get_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_relation_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `get_relation_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityRelation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_relation_using_post(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_relation_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_relation_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/entity_view_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/entity_view_controller_api.py new file mode 100644 index 0000000..fb567b9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/entity_view_controller_api.py @@ -0,0 +1,1828 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityViewControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_entity_view_to_customer_using_post(self, customer_id, entity_view_id, **kwargs): # noqa: E501 + """Assign Entity View to customer (assignEntityViewToCustomer) # noqa: E501 + + Creates assignment of the Entity View to customer. Customer will be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_customer_using_post(customer_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_view_to_customer_using_post_with_http_info(customer_id, entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_view_to_customer_using_post_with_http_info(customer_id, entity_view_id, **kwargs) # noqa: E501 + return data + + def assign_entity_view_to_customer_using_post_with_http_info(self, customer_id, entity_view_id, **kwargs): # noqa: E501 + """Assign Entity View to customer (assignEntityViewToCustomer) # noqa: E501 + + Creates assignment of the Entity View to customer. Customer will be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_customer_using_post_with_http_info(customer_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_view_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_entity_view_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `assign_entity_view_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityView/{entityViewId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_entity_view_to_edge_using_post(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Assign entity view to edge (assignEntityViewToEdge) # noqa: E501 + + Creates assignment of an existing entity view to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity view will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_edge_using_post(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_view_to_edge_using_post_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_view_to_edge_using_post_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + return data + + def assign_entity_view_to_edge_using_post_with_http_info(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Assign entity view to edge (assignEntityViewToEdge) # noqa: E501 + + Creates assignment of an existing entity view to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity view will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_edge_using_post_with_http_info(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_view_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_entity_view_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `assign_entity_view_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityView/{entityViewId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_entity_view_to_public_customer_using_post(self, entity_view_id, **kwargs): # noqa: E501 + """Make entity view publicly available (assignEntityViewToPublicCustomer) # noqa: E501 + + Entity View will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the entity view. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_public_customer_using_post(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_view_to_public_customer_using_post_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_view_to_public_customer_using_post_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def assign_entity_view_to_public_customer_using_post_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Make entity view publicly available (assignEntityViewToPublicCustomer) # noqa: E501 + + Entity View will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the entity view. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_public_customer_using_post_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_view_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `assign_entity_view_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/entityView/{entityViewId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_view_using_delete(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def delete_entity_view_using_delete_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_view_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `delete_entity_view_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post4(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post4_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post4" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViews', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityView]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_view_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View info (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of Entity View info objects assigned to customer. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_view_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View info (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of Entity View info objects assigned to customer. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViewInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_views_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_views_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_entity_views_using_get(self, edge_id, page, page_size, **kwargs): # noqa: E501 + """getEdgeEntityViews # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_views_using_get(edge_id, page, page_size, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str page: page (required) + :param str page_size: pageSize (required) + :param str type: type + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :param int start_time: startTime + :param int end_time: endTime + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_entity_views_using_get_with_http_info(edge_id, page, page_size, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_entity_views_using_get_with_http_info(edge_id, page, page_size, **kwargs) # noqa: E501 + return data + + def get_edge_entity_views_using_get_with_http_info(self, edge_id, page, page_size, **kwargs): # noqa: E501 + """getEdgeEntityViews # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_views_using_get_with_http_info(edge_id, page, page_size, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str page: page (required) + :param str page_size: pageSize (required) + :param str type: type + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :param int start_time: startTime + :param int end_time: endTime + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page', 'page_size', 'type', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityViews{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_info_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get Entity View info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided Entity View Id. Entity Views Info extends the Entity View with customer title and 'is public' flag. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_info_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get Entity View info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided Entity View Id. Entity Views Info extends the Entity View with customer title and 'is public' flag. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/info/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_types_using_get(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_entity_view_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_view_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views info owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_view_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views info owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViewInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_view_using_get(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_view_using_get_with_http_info(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get_with_http_info(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_view_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_name' is set + if ('entity_view_name' not in params or + params['entity_view_name'] is None): + raise ValueError("Missing the required parameter `entity_view_name` when calling `get_tenant_entity_view_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_view_name' in params: + query_params.append(('entityViewName', params['entity_view_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?entityViewName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_views_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_views_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_view_using_post(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entity_view_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_view_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_entity_view_from_customer_using_delete(self, entity_view_id, **kwargs): # noqa: E501 + """Unassign Entity View from customer (unassignEntityViewFromCustomer) # noqa: E501 + + Clears assignment of the Entity View to customer. Customer will not be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_customer_using_delete(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_entity_view_from_customer_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_entity_view_from_customer_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def unassign_entity_view_from_customer_using_delete_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Unassign Entity View from customer (unassignEntityViewFromCustomer) # noqa: E501 + + Clears assignment of the Entity View to customer. Customer will not be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_customer_using_delete_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_entity_view_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `unassign_entity_view_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_entity_view_from_edge_using_delete(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Unassign entity view from edge (unassignEntityViewFromEdge) # noqa: E501 + + Clears assignment of the entity view to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity view locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_edge_using_delete(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_entity_view_from_edge_using_delete_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_entity_view_from_edge_using_delete_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + return data + + def unassign_entity_view_from_edge_using_delete_with_http_info(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Unassign entity view from edge (unassignEntityViewFromEdge) # noqa: E501 + + Clears assignment of the entity view to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity view locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_edge_using_delete_with_http_info(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_entity_view_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_entity_view_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `unassign_entity_view_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/event_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/event_controller_api.py new file mode 100644 index 0000000..a160e18 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/event_controller_api.py @@ -0,0 +1,623 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def clear_events_using_post(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def clear_events_using_post_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'body', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `clear_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `clear_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/clear{?endTime,startTime}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get_with_http_info(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get1(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get1_with_http_info(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'event_type', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'event_type' is set + if ('event_type' not in params or + params['event_type'] is None): + raise ValueError("Missing the required parameter `event_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'event_type' in params: + path_params['eventType'] = params['event_type'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/{eventType}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_post(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_events_using_post_with_http_info(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'entity_type', 'entity_id', 'body', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/login_endpoint_api.py b/billinglayer/python/tb_rest_client/api/api_ce/login_endpoint_api.py new file mode 100644 index 0000000..4542027 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/login_endpoint_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class LoginEndpointApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def login_post(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.login_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.login_post_with_http_info(**kwargs) # noqa: E501 + return data + + def login_post_with_http_info(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method login_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/login', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/lwm_2m_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/lwm_2m_controller_api.py new file mode 100644 index 0000000..0e14c4a --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/lwm_2m_controller_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class Lwm2mControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_lwm2m_bootstrap_security_info_using_get(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + return data + + def get_lwm2m_bootstrap_security_info_using_get_with_http_info(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_bootstrap_server'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_bootstrap_security_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_bootstrap_server' is set + if ('is_bootstrap_server' not in params or + params['is_bootstrap_server'] is None): + raise ValueError("Missing the required parameter `is_bootstrap_server` when calling `get_lwm2m_bootstrap_security_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'is_bootstrap_server' in params: + path_params['isBootstrapServer'] = params['is_bootstrap_server'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/lwm2m/deviceProfile/bootstrap/{isBootstrapServer}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LwM2MServerSecurityConfigDefault', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/notification_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/notification_controller_api.py new file mode 100644 index 0000000..9843459 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/notification_controller_api.py @@ -0,0 +1,1203 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_notification_request_using_post(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def create_notification_request_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_notification_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequest', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_request_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_request_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_request_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_request_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_delivery_methods_using_get(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_delivery_methods_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_delivery_methods_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/deliveryMethods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_request_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_request_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_preview_using_post(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_request_preview_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'recipients_preview_size'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_preview_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'recipients_preview_size' in params: + query_params.append(('recipientsPreviewSize', params['recipients_preview_size'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/preview{?recipientsPreviewSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestPreview', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_requests_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_requests_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_requests_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_requests_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_requests_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/requests{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_settings_using_get(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notifications_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notifications_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'unread_only'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notifications_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notifications_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notifications_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'unread_only' in params: + query_params.append(('unreadOnly', params['unread_only'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications{?page,pageSize,sortOrder,sortProperty,textSearch,unreadOnly}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotification', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_all_notifications_as_read_using_put(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def mark_all_notifications_as_read_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_all_notifications_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_notification_as_read_using_put(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + return data + + def mark_notification_as_read_using_put_with_http_info(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_notification_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `mark_notification_as_read_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_settings_using_post(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/notification_rule_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/notification_rule_controller_api.py new file mode 100644 index 0000000..f58c6d8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/notification_rule_controller_api.py @@ -0,0 +1,447 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationRuleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_rule_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_rule_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_rule_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_rule_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rule_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_rule_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rule_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_rule_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rules_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_rules_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rules_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_rules_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_rules_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rules{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_rule_using_post(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_rule_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_rule_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRule', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/notification_target_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/notification_target_controller_api.py new file mode 100644 index 0000000..caedf71 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/notification_target_controller_api.py @@ -0,0 +1,776 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTargetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_target_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_target_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_target_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_target_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_target_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_target_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_target_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_target_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_notification_targets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[NotificationTarget]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_supported_notification_type_using_get(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_supported_notification_type_using_get_with_http_info(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['notification_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_supported_notification_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'notification_type' is set + if ('notification_type' not in params or + params['notification_type'] is None): + raise ValueError("Missing the required parameter `notification_type` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'notification_type' in params: + query_params.append(('notificationType', params['notification_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?notificationType,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_recipients_for_notification_target_config_using_post(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_recipients_for_notification_target_config_using_post_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_recipients_for_notification_target_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/recipients{?page,pageSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_target_using_post(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `TENANT_ADMINISTRATORS`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_target_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `TENANT_ADMINISTRATORS`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_target_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/notification_template_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/notification_template_controller_api.py new file mode 100644 index 0000000..ea7e344 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/notification_template_controller_api.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_template_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_template_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_template_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_template_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_template_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_template_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_template_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_template_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_templates_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_templates_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'notification_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_templates_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_templates_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'notification_types' in params: + query_params.append(('notificationTypes', params['notification_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/templates{?notificationTypes,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_slack_conversations_using_get(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + return data + + def list_slack_conversations_using_get_with_http_info(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_slack_conversations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `list_slack_conversations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'token' in params: + query_params.append(('token', params['token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/slack/conversations{?token,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SlackConversation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_template_using_post(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/o_auth_2_config_template_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/o_auth_2_config_template_controller_api.py new file mode 100644 index 0000000..226eb2c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/o_auth_2_config_template_controller_api.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ConfigTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_client_registration_template_using_delete(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + return data + + def delete_client_registration_template_using_delete_with_http_info(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['client_registration_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_client_registration_template_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'client_registration_template_id' is set + if ('client_registration_template_id' not in params or + params['client_registration_template_id'] is None): + raise ValueError("Missing the required parameter `client_registration_template_id` when calling `delete_client_registration_template_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'client_registration_template_id' in params: + path_params['clientRegistrationTemplateId'] = params['client_registration_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template/{clientRegistrationTemplateId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_client_registration_templates_using_get(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_client_registration_templates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_client_registration_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientRegistrationTemplate]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_client_registration_template_using_post(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_client_registration_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_client_registration_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2ClientRegistrationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/o_auth_2_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/o_auth_2_controller_api.py new file mode 100644 index 0000000..8e3b9f1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/o_auth_2_controller_api.py @@ -0,0 +1,411 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_o_auth2_info_using_get(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_o_auth2_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_o_auth2_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_login_processing_url_using_get(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_login_processing_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_login_processing_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/loginProcessingUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_o_auth2_clients_using_post(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_o_auth2_clients_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name', 'platform'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_o_auth2_clients_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + if 'platform' in params: + query_params.append(('platform', params['platform'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/oauth2Clients{?pkgName,platform}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_o_auth2_info_using_post(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_o_auth2_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_o_auth2_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/ota_package_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/ota_package_controller_api.py new file mode 100644 index 0000000..9d0717b --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/ota_package_controller_api.py @@ -0,0 +1,879 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OtaPackageControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_ota_package_using_delete(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def delete_ota_package_using_delete_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_ota_package_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `delete_ota_package_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_ota_package_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def download_ota_package_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `download_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_info_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_info_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/info/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get1(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get1_with_http_info(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id', 'type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages/{deviceProfileId}/{type}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_data_using_post(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def save_ota_package_data_using_post_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id', 'checksum', 'checksum_algorithm', 'file'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `save_ota_package_data_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'checksum' in params: + form_params.append(('checksum', params['checksum'])) # noqa: E501 + if 'checksum_algorithm' in params: + form_params.append(('checksumAlgorithm', params['checksum_algorithm'])) # noqa: E501 + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', 'multipart/form-data']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_info_using_post(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_ota_package_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/queue_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/queue_controller_api.py new file mode 100644 index 0000000..f6d6cfa --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/queue_controller_api.py @@ -0,0 +1,558 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class QueueControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_queue_using_delete(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def delete_queue_using_delete_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_queue_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `delete_queue_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_id_using_get(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def get_queue_by_id_using_get_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `get_queue_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_name_using_get(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + return data + + def get_queue_by_name_using_get_with_http_info(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get_with_http_info(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_name_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_name' is set + if ('queue_name' not in params or + params['queue_name'] is None): + raise ValueError("Missing the required parameter `queue_name` when calling `get_queue_by_name_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_name' in params: + path_params['queueName'] = params['queue_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/name/{queueName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_queues_by_service_type_using_get(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_queues_by_service_type_using_get_with_http_info(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_queues_by_service_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?page,pageSize,serviceType,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataQueue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_queue_using_post(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + else: + (data) = self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + return data + + def save_queue_using_post_with_http_info(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post_with_http_info(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_queue_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `save_queue_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?serviceType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/rpc_v_1_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/rpc_v_1_controller_api.py new file mode 100644 index 0000000..7d97a65 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/rpc_v_1_controller_api.py @@ -0,0 +1,253 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV1ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_one_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/rpc_v_2_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/rpc_v_2_controller_api.py new file mode 100644 index 0000000..7dce21e --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/rpc_v_2_controller_api.py @@ -0,0 +1,570 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_rpc_using_delete(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def delete_rpc_using_delete_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rpc_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `delete_rpc_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_by_device_using_get(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_by_device_using_get_with_http_info(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'page_size', 'page', 'rpc_status', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_by_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'rpc_status' in params: + query_params.append(('rpcStatus', params['rpc_status'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/device/{deviceId}{?page,pageSize,rpcStatus,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_using_get(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_using_get_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `get_persisted_rpc_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Rpc', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_one_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/rule_chain_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/rule_chain_controller_api.py new file mode 100644 index 0000000..60c64f2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/rule_chain_controller_api.py @@ -0,0 +1,2201 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RuleChainControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_rule_chain_to_edge_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def assign_rule_chain_to_edge_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_rule_chain_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def delete_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `delete_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def export_rule_chains_using_get(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + else: + (data) = self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + return data + + def export_rule_chains_using_get_with_http_info(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get_with_http_info(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['limit'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method export_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'limit' is set + if ('limit' not in params or + params['limit'] is None): + raise ValueError("Missing the required parameter `limit` when calling `export_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/export{?limit}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_assign_to_edge_rule_chains_using_get(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_assign_to_edge_rule_chains_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_assign_to_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/autoAssignToEdgeRuleChains', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChain]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_rule_chains_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_rule_chains_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_rule_node_debug_input_using_get(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + return data + + def get_latest_rule_node_debug_input_using_get_with_http_info(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_node_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_rule_node_debug_input_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_node_id' is set + if ('rule_node_id' not in params or + params['rule_node_id'] is None): + raise ValueError("Missing the required parameter `rule_node_id` when calling `get_latest_rule_node_debug_input_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_node_id' in params: + path_params['ruleNodeId'] = params['rule_node_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleNode/{ruleNodeId}/debugIn', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_by_id_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_by_id_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_meta_data_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_meta_data_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_meta_data_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_meta_data_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/metadata', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_usage_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_usage_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_usage_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_usage_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainOutputLabelsUsage]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chains_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_rule_chains_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def import_rule_chains_using_post(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def import_rule_chains_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'overwrite'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method import_rule_chains_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'overwrite' in params: + query_params.append(('overwrite', params['overwrite'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/import{?overwrite}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainImportResult]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_tbel_enabled_using_get(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_tbel_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_tbel_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/tbelEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_meta_data_using_post(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_meta_data_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'update_related'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_meta_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'update_related' in params: + query_params.append(('updateRelated', params['update_related'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/metadata{?updateRelated}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/device/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post1(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_auto_assign_to_edge_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_auto_assign_to_edge_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_auto_assign_to_edge_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_auto_assign_to_edge_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_template_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_template_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_template_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_template_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/edgeTemplateRoot', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_script_using_post(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_script_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_script_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/testScript{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_rule_chain_from_edge_using_delete(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def unassign_rule_chain_from_edge_using_delete_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_rule_chain_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unset_auto_assign_to_edge_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unset_auto_assign_to_edge_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unset_auto_assign_to_edge_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/tb_resource_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/tb_resource_controller_api.py new file mode 100644 index 0000000..d4ce57c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/tb_resource_controller_api.py @@ -0,0 +1,863 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TbResourceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_resource_using_delete(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def delete_resource_using_delete_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_resource_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `delete_resource_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_resource_using_get(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def download_resource_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_resource_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `download_resource_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_page_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_page_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_page_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m/page{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_using_get(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_using_get_with_http_info(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['sort_order', 'sort_property', 'object_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'sort_order' is set + if ('sort_order' not in params or + params['sort_order'] is None): + raise ValueError("Missing the required parameter `sort_order` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'sort_property' is set + if ('sort_property' not in params or + params['sort_property'] is None): + raise ValueError("Missing the required parameter `sort_property` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'object_ids' is set + if ('object_ids' not in params or + params['object_ids'] is None): + raise ValueError("Missing the required parameter `object_ids` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'object_ids' in params: + query_params.append(('objectIds', params['object_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m{?objectIds,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_info_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_info_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/info/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resources_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_resources_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resources_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_resources_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_resources_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_resource_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_resource_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_resource_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/telemetry_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/telemetry_controller_api.py new file mode 100644 index 0000000..de6bb8b --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/telemetry_controller_api.py @@ -0,0 +1,1796 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TelemetryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_attributes_using_delete(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_device_attributes_using_delete_with_http_info(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_device_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_attributes_using_delete(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_attributes_using_delete_with_http_info(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_timeseries_using_delete(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_timeseries_using_delete_with_http_info(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'delete_all_data_for_keys', 'start_ts', 'end_ts', 'rewrite_latest_if_deleted'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_timeseries_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'delete_all_data_for_keys' in params: + query_params.append(('deleteAllDataForKeys', params['delete_all_data_for_keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'rewrite_latest_if_deleted' in params: + query_params.append(('rewriteLatestIfDeleted', params['rewrite_latest_if_deleted'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/delete{?deleteAllDataForKeys,endTs,keys,rewriteLatestIfDeleted,startTs}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes/{scope}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attributes_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes/{scope}{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attributes_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_timeseries_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_latest_timeseries_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_latest_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_latest_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?keys,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get1(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get1_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/timeseries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_using_get(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + return data + + def get_timeseries_using_get_with_http_info(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'start_ts', 'end_ts', 'interval', 'limit', 'agg', 'order_by', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'start_ts' is set + if ('start_ts' not in params or + params['start_ts'] is None): + raise ValueError("Missing the required parameter `start_ts` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'end_ts' is set + if ('end_ts' not in params or + params['end_ts'] is None): + raise ValueError("Missing the required parameter `end_ts` when calling `get_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'interval' in params: + query_params.append(('interval', params['interval'])) # noqa: E501 + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + if 'agg' in params: + query_params.append(('agg', params['agg'])) # noqa: E501 + if 'order_by' in params: + query_params.append(('orderBy', params['order_by'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?agg,endTs,interval,keys,limit,orderBy,startTs,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_attributes_using_post(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + return data + + def save_device_attributes_using_post_with_http_info(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post_with_http_info(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `save_device_attributes_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v1_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v1_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v1_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v2_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v2_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v2_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/attributes/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_with_ttl_using_post(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_with_ttl_using_post_with_http_info(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'ttl', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_with_ttl_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'ttl' is set + if ('ttl' not in params or + params['ttl'] is None): + raise ValueError("Missing the required parameter `ttl` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + if 'ttl' in params: + path_params['ttl'] = params['ttl'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}/{ttl}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/tenant_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/tenant_controller_api.py new file mode 100644 index 0000000..d392b8c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/tenant_controller_api.py @@ -0,0 +1,657 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_using_delete(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_using_delete_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `delete_tenant_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_info_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_info_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/info/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenants_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenants_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenants_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenants_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenants_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenants{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/tenant_profile_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/tenant_profile_controller_api.py new file mode 100644 index 0000000..d9697cc --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/tenant_profile_controller_api.py @@ -0,0 +1,932 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_profile_using_delete(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_profile_using_delete_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `delete_tenant_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_tenant_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_tenant_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_tenant_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_info_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_info_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_tenant_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TenantProfile]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_tenant_profile_using_post(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_tenant_profile_using_post_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `set_default_tenant_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/two_factor_auth_config_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/two_factor_auth_config_controller_api.py new file mode 100644 index 0000000..d3540f7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/two_factor_auth_config_controller_api.py @@ -0,0 +1,890 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthConfigControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_two_fa_account_config_using_delete(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def delete_two_fa_account_config_using_delete_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_two_fa_account_config_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `delete_two_fa_account_config_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def generate_two_fa_account_config_using_post(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def generate_two_fa_account_config_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method generate_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `generate_two_fa_account_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/generate{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TwoFaAccountConfig', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_account_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_account_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_account_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_platform_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_platform_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_platform_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_platform_two_fa_settings_using_post(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_platform_two_fa_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_platform_two_fa_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def submit_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def submit_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method submit_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/submit', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_two_fa_account_config_using_put(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def update_two_fa_account_config_using_put_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_two_fa_account_config_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `update_two_fa_account_config_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def verify_and_save_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def verify_and_save_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method verify_and_save_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/two_factor_auth_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/two_factor_auth_controller_api.py new file mode 100644 index 0000000..9ef1d61 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/two_factor_auth_controller_api.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_two_fa_verification_code_using_post(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + else: + (data) = self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + return data + + def check_two_fa_verification_code_using_post_with_http_info(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + # verify the required parameter 'verification_code' is set + if ('verification_code' not in params or + params['verification_code'] is None): + raise ValueError("Missing the required parameter `verification_code` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/check{?providerType,verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get1(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get1_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TwoFaProviderInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_two_fa_verification_code_using_post(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def request_two_fa_verification_code_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `request_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/send{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/ui_settings_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/ui_settings_controller_api.py new file mode 100644 index 0000000..65e045e --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/ui_settings_controller_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UiSettingsControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_help_base_url_using_get(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_help_base_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_help_base_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/uiSettings/helpBaseUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/usage_info_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/usage_info_controller_api.py new file mode 100644 index 0000000..9bdff35 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/usage_info_controller_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UsageInfoControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_tenant_usage_info_using_get(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_usage_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_usage_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UsageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/user_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/user_controller_api.py new file mode 100644 index 0000000..fe91132 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/user_controller_api.py @@ -0,0 +1,2261 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UserControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_user_settings_using_delete(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete_with_http_info(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete_with_http_info(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths', 'type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `delete_user_settings_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_settings_using_delete1(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete1_with_http_info(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1_with_http_info(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_using_delete(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def delete_user_using_delete_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `delete_user_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_users_by_query_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def find_users_by_query_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_users_by_query_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `find_users_by_query_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `find_users_by_query_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/info{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_activation_link_using_get(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_activation_link_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_activation_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_activation_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/activationLink', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_users_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_users_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_admins_using_get(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_admins_using_get_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_admins_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_admins_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_by_id_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_by_id_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_dashboards_info_using_get(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_dashboards_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_dashboards_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get1(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def get_user_settings_using_get1_with_http_info(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_user_settings_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_token_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_token_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/token', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_for_assign_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_for_assign_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_for_assign_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_for_assign_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/assign/{alarmId}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of users owned by tenant or customer. The scope depends on authority of the user that performs the request.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of users owned by tenant or customer. The scope depends on authority of the user that performs the request.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_user_token_access_enabled_using_get(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_user_token_access_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_user_token_access_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/tokenAccessEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def put_user_settings_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put1(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def put_user_settings_using_put1_with_http_info(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `put_user_settings_using_put1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def report_user_dashboard_action_using_get(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + else: + (data) = self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + return data + + def report_user_dashboard_action_using_get_with_http_info(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'action'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method report_user_dashboard_action_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + # verify the required parameter 'action' is set + if ('action' not in params or + params['action'] is None): + raise ValueError("Missing the required parameter `action` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + if 'action' in params: + path_params['action'] = params['action'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards/{dashboardId}/{action}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_settings_using_post(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_using_post(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Available for users with 'SYS_ADMIN', 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Available for users with 'SYS_ADMIN', 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user{?sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_activation_email_using_post(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + else: + (data) = self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + return data + + def send_activation_email_using_post_with_http_info(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post_with_http_info(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_activation_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email' is set + if ('email' not in params or + params['email'] is None): + raise ValueError("Missing the required parameter `email` when calling `send_activation_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email' in params: + query_params.append(('email', params['email'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/sendActivationMail{?email}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_user_credentials_enabled_using_post(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def set_user_credentials_enabled_using_post_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'user_credentials_enabled'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_user_credentials_enabled_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `set_user_credentials_enabled_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'user_credentials_enabled' in params: + query_params.append(('userCredentialsEnabled', params['user_credentials_enabled'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/userCredentialsEnabled{?userCredentialsEnabled}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/widget_type_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/widget_type_controller_api.py new file mode 100644 index 0000000..3f8a322 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/widget_type_controller_api.py @@ -0,0 +1,752 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetTypeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widget_type_using_delete(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def delete_widget_type_using_delete_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widget_type_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `delete_widget_type_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_details_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_details_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_details_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesDetails{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeDetails]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_infos_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_infos_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesInfos{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypes{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetType]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_by_id_using_get(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def get_widget_type_by_id_using_get_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `get_widget_type_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_using_get(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + return data + + def get_widget_type_using_get_with_http_info(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias', 'alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'alias' is set + if ('alias' not in params or + params['alias'] is None): + raise ValueError("Missing the required parameter `alias` when calling `get_widget_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + if 'alias' in params: + query_params.append(('alias', params['alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType{?alias,bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetType', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widget_type_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widget_type_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widget_type_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_ce/widgets_bundle_controller_api.py b/billinglayer/python/tb_rest_client/api/api_ce/widgets_bundle_controller_api.py new file mode 100644 index 0000000..cd5ace3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_ce/widgets_bundle_controller_api.py @@ -0,0 +1,534 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetsBundleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widgets_bundle_using_delete(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def delete_widgets_bundle_using_delete_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widgets_bundle_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `delete_widgets_bundle_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundle_by_id_using_get(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def get_widgets_bundle_by_id_using_get_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundle_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `get_widgets_bundle_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetsBundle]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get1(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get1_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataWidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widgets_bundle_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widgets_bundle_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widgets_bundle_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__init__.py b/billinglayer/python/tb_rest_client/api/api_pe/__init__.py new file mode 100644 index 0000000..65fff6f --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/__init__.py @@ -0,0 +1,57 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .self_registration_controller_api import SelfRegistrationControllerApi +from .http_integration_controller_api import HttpIntegrationControllerApi +from .asset_controller_api import AssetControllerApi +from .device_group_ota_package_controller_api import DeviceGroupOtaPackageControllerApi +from .edge_controller_api import EdgeControllerApi +from .ocean_connect_integration_controller_api import OceanConnectIntegrationControllerApi +from .user_permissions_controller_api import UserPermissionsControllerApi +from .owner_controller_api import OwnerControllerApi +from .rpc_v_2_controller_api import RpcV2ControllerApi +from .edge_event_controller_api import EdgeEventControllerApi +from .customer_controller_api import CustomerControllerApi +from .user_controller_api import UserControllerApi +from .group_permission_controller_api import GroupPermissionControllerApi +from .device_controller_api import DeviceControllerApi +from .converter_controller_api import ConverterControllerApi +from .entity_view_controller_api import EntityViewControllerApi +from .rule_engine_controller_api import RuleEngineControllerApi +from .admin_controller_api import AdminControllerApi +from .t_mobile_iot_cdp_integration_controller_api import TMobileIotCdpIntegrationControllerApi +from .sign_up_controller_api import SignUpControllerApi +from .trail_controller_api import TrailControllerApi +from .thing_park_integration_controller_api import ThingParkIntegrationControllerApi +from .sig_fox_integration_controller_api import SigFoxIntegrationControllerApi +from .scheduler_event_controller_api import SchedulerEventControllerApi +from .report_controller_api import ReportControllerApi +from .dashboard_controller_api import DashboardControllerApi +from .integration_controller_api import IntegrationControllerApi +from .custom_menu_controller_api import CustomMenuControllerApi +from .lwm_2m_controller_api import Lwm2mControllerApi +from .custom_translation_controller_api import CustomTranslationControllerApi +from .role_controller_api import RoleControllerApi +from .blob_entity_controller_api import BlobEntityControllerApi +from .loriot_integration_controller_api import LoriotIntegrationControllerApi +from .tenant_controller_api import TenantControllerApi +from .chirp_stack_integration_controller_api import ChirpStackIntegrationControllerApi +from .white_labeling_controller_api import WhiteLabelingControllerApi +from .ota_package_controller_api import OtaPackageControllerApi +from .entity_group_controller_api import EntityGroupControllerApi +from .subscription_controller_api import SubscriptionControllerApi +from .solution_controller_api import SolutionControllerApi +from .device_profile_controller_api import DeviceProfileControllerApi +from .asset_profile_controller_api import AssetProfileControllerApi +from .two_factor_auth_controller_api import TwoFactorAuthControllerApi diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..3eec950 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/admin_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/admin_controller_api.cpython-311.pyc new file mode 100644 index 0000000..8052a79 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/admin_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/alarm_comment_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/alarm_comment_controller_api.cpython-311.pyc new file mode 100644 index 0000000..67b9214 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/alarm_comment_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/alarm_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/alarm_controller_api.cpython-311.pyc new file mode 100644 index 0000000..40a5995 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/alarm_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/asset_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/asset_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2f96bf2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/asset_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/asset_profile_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/asset_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4294ff6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/asset_profile_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/audit_log_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/audit_log_controller_api.cpython-311.pyc new file mode 100644 index 0000000..265b55b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/audit_log_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/auth_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2b7a9b2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/auth_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/billing_endpoint_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/billing_endpoint_controller_api.cpython-311.pyc new file mode 100644 index 0000000..1fb5e87 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/billing_endpoint_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/blob_entity_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/blob_entity_controller_api.cpython-311.pyc new file mode 100644 index 0000000..cc664e2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/blob_entity_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/chirp_stack_integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/chirp_stack_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..c1321ce Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/chirp_stack_integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/cloud_endpoint_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/cloud_endpoint_controller_api.cpython-311.pyc new file mode 100644 index 0000000..bf28c5d Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/cloud_endpoint_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/component_descriptor_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/component_descriptor_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e1a974f Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/component_descriptor_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/converter_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/converter_controller_api.cpython-311.pyc new file mode 100644 index 0000000..afbffc8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/converter_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/custom_menu_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/custom_menu_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4deb54c Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/custom_menu_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/custom_translation_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/custom_translation_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7eac00b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/custom_translation_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/customer_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/customer_controller_api.cpython-311.pyc new file mode 100644 index 0000000..25ae0c6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/customer_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/dashboard_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/dashboard_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f955f5c Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/dashboard_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_api_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_api_controller_api.cpython-311.pyc new file mode 100644 index 0000000..6e96c38 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_api_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f92f55d Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_group_ota_package_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_group_ota_package_controller_api.cpython-311.pyc new file mode 100644 index 0000000..78dac05 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_group_ota_package_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_profile_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d09b1d4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/device_profile_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/edge_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/edge_controller_api.cpython-311.pyc new file mode 100644 index 0000000..54a8e48 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/edge_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/edge_event_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/edge_event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d56b4b0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/edge_event_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entities_version_control_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entities_version_control_controller_api.cpython-311.pyc new file mode 100644 index 0000000..19a3531 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entities_version_control_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_group_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_group_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0d0c896 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_group_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_query_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_query_controller_api.cpython-311.pyc new file mode 100644 index 0000000..21041e6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_query_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_relation_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_relation_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0e4230c Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_relation_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_view_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_view_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b8ac2b8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/entity_view_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/event_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..bd34baa Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/event_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/group_permission_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/group_permission_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5bf6c12 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/group_permission_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/http_integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/http_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..35cf38f Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/http_integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7ff5170 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/login_endpoint_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/login_endpoint_api.cpython-311.pyc new file mode 100644 index 0000000..e28fdc1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/login_endpoint_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/loriot_integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/loriot_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..c7b14c0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/loriot_integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/lwm_2m_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/lwm_2m_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d8871a3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/lwm_2m_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_controller_api.cpython-311.pyc new file mode 100644 index 0000000..bcc53fc Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_rule_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_rule_controller_api.cpython-311.pyc new file mode 100644 index 0000000..654ec61 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_rule_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_target_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_target_controller_api.cpython-311.pyc new file mode 100644 index 0000000..be4332e Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_target_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_template_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e930e71 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/notification_template_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f2448cd Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f5e51bf Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ocean_connect_integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ocean_connect_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9fa48a0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ocean_connect_integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ota_package_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ota_package_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f5ad7fd Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ota_package_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/owner_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/owner_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f3ed45a Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/owner_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/queue_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/queue_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7b1b065 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/queue_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/report_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/report_controller_api.cpython-311.pyc new file mode 100644 index 0000000..dc78ca7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/report_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/role_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/role_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7cb97d0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/role_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_controller_api.cpython-311.pyc new file mode 100644 index 0000000..824c7f9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_1_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_1_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5c046f8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_1_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_2_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d02c70b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_2_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rule_chain_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rule_chain_controller_api.cpython-311.pyc new file mode 100644 index 0000000..af71716 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rule_chain_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rule_engine_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rule_engine_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b878097 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/rule_engine_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/scheduler_event_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/scheduler_event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..a7a3bb8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/scheduler_event_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/self_registration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/self_registration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..1ac69fb Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/self_registration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/sig_fox_integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/sig_fox_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..8803fef Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/sig_fox_integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/sign_up_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/sign_up_controller_api.cpython-311.pyc new file mode 100644 index 0000000..710d565 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/sign_up_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/solution_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/solution_controller_api.cpython-311.pyc new file mode 100644 index 0000000..22f5ce4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/solution_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/subscription_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/subscription_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5b729db Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/subscription_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/t_mobile_iot_cdp_integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/t_mobile_iot_cdp_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9fee41f Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/t_mobile_iot_cdp_integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tb_resource_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tb_resource_controller_api.cpython-311.pyc new file mode 100644 index 0000000..6f03a67 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tb_resource_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/telemetry_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/telemetry_controller_api.cpython-311.pyc new file mode 100644 index 0000000..03cb1a4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/telemetry_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tenant_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tenant_controller_api.cpython-311.pyc new file mode 100644 index 0000000..606c03d Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tenant_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tenant_profile_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tenant_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0623f4c Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/tenant_profile_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/thing_park_integration_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/thing_park_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..08e43b9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/thing_park_integration_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/trail_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/trail_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b0c2c36 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/trail_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc new file mode 100644 index 0000000..055fac6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b341eee Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ui_settings_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ui_settings_controller_api.cpython-311.pyc new file mode 100644 index 0000000..04f8a0d Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/ui_settings_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/usage_info_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/usage_info_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9040e4b Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/usage_info_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/user_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/user_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e1d7d13 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/user_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/user_permissions_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/user_permissions_controller_api.cpython-311.pyc new file mode 100644 index 0000000..77ba4b0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/user_permissions_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/white_labeling_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/white_labeling_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2c2f529 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/white_labeling_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/widget_type_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/widget_type_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b91ec91 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/widget_type_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/widgets_bundle_controller_api.cpython-311.pyc b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/widgets_bundle_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0601c02 Binary files /dev/null and b/billinglayer/python/tb_rest_client/api/api_pe/__pycache__/widgets_bundle_controller_api.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/api/api_pe/admin_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/admin_controller_api.py new file mode 100644 index 0000000..8f5a05b --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/admin_controller_api.py @@ -0,0 +1,2035 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AdminControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def auto_commit_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def auto_commit_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method auto_commit_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_repository_access_using_post(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_repository_access_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_repository_access_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/checkAccess', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_updates_using_get(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def check_updates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_updates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UpdateMessage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_auto_commit_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_auto_commit_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_auto_commit_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_repository_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_repository_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_repository_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_admin_settings_using_get(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :param bool system_by_default: Use system settings if settings are not defined on tenant level. + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + else: + (data) = self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + return data + + def get_admin_settings_using_get_with_http_info(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get_with_http_info(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :param bool system_by_default: Use system settings if settings are not defined on tenant level. + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['key', 'system_by_default'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_admin_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'key' is set + if ('key' not in params or + params['key'] is None): + raise ValueError("Missing the required parameter `key` when calling `get_admin_settings_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'key' in params: + path_params['key'] = params['key'] # noqa: E501 + + query_params = [] + if 'system_by_default' in params: + query_params.append(('systemByDefault', params['system_by_default'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/{key}{?systemByDefault}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_commit_settings_using_get(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_commit_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_commit_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_features_info_using_get(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_features_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_features_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/featuresInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FeaturesInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_jwt_settings_using_get(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_jwt_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_jwt_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_license_usage_info_using_get(self, **kwargs): # noqa: E501 + """Get license usage info (getLicenseUsageInfo) # noqa: E501 + + Get license usage info. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_license_usage_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LicenseUsageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_license_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_license_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_license_usage_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get license usage info (getLicenseUsageInfo) # noqa: E501 + + Get license usage info. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_license_usage_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LicenseUsageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_license_usage_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/licenseUsageInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LicenseUsageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_info_using_get(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettingsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_using_get(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_security_settings_using_get(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_security_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_security_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_system_info_using_get(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_system_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_system_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/systemInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SystemInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def repository_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def repository_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method repository_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_admin_settings_using_post(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_admin_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_admin_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_auto_commit_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_auto_commit_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_auto_commit_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_jwt_settings_using_post(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_jwt_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_jwt_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_repository_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_repository_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_repository_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultRepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_security_settings_using_post(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_security_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_security_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_mail_using_post(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email using Mail Settings provided as a parameter. Email is sent to the address specified in the profile of user who is performing the requestYou may change the 'To' email in the user profile of the System/Tenant Administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_mail_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email using Mail Settings provided as a parameter. Email is sent to the address specified in the profile of user who is performing the requestYou may change the 'To' email in the user profile of the System/Tenant Administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_mail_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testMail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_sms_using_post(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_sms_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_sms_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testSms', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/alarm_comment_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/alarm_comment_controller_api.py new file mode 100644 index 0000000..49145cd --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/alarm_comment_controller_api.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmCommentControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_alarm_comment_using_delete(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_comment_using_delete_with_http_info(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'comment_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_comment_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + # verify the required parameter 'comment_id' is set + if ('comment_id' not in params or + params['comment_id'] is None): + raise ValueError("Missing the required parameter `comment_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'comment_id' in params: + path_params['commentId'] = params['comment_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment/{commentId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_comments_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarm_comments_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_comments_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarm_comments_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment{?page,pageSize,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmCommentInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_comment_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def save_alarm_comment_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_comment_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `save_alarm_comment_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmComment', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/alarm_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/alarm_controller_api.py new file mode 100644 index 0000000..aed42b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/alarm_controller_api.py @@ -0,0 +1,1518 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def ack_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def ack_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method ack_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `ack_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/ack', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_alarm_using_post(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + return data + + def assign_alarm_using_post_with_http_info(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `assign_alarm_using_post`") # noqa: E501 + # verify the required parameter 'assignee_id' is set + if ('assignee_id' not in params or + params['assignee_id'] is None): + raise ValueError("Missing the required parameter `assignee_id` when calling `assign_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'assignee_id' in params: + path_params['assigneeId'] = params['assignee_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign/{assigneeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def clear_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def clear_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `clear_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/clear', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_info_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_info_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/info/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{entityType}/{entityId}{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_v2_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_v2_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarm/{entityType}/{entityId}{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarms{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_v2_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_v2_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarms{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_highest_alarm_severity_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_highest_alarm_severity_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'search_status', 'status', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_highest_alarm_severity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/highestSeverity/{entityType}/{entityId}{?assigneeId,searchStatus,status}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_using_post(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_alarm_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def unassign_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `unassign_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/asset_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/asset_controller_api.py new file mode 100644 index 0000000..30b9eb3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/asset_controller_api.py @@ -0,0 +1,1648 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_asset_using_delete(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def delete_asset_using_delete_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `delete_asset_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_asset_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Asset Infos for current user (getAllAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the tenant or the customer of a current user. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_asset_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_asset_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Asset Infos for current user (getAllAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the tenant or the customer of a current user. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_asset_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetInfos/all{?assetProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_info_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer.Asset Info is an extension of the default Asset object that contains information about the owner name. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_info_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer.Asset Info is an extension of the default Asset object that contains information about the owner name. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/info/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_types_using_get(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_asset_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_assets_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get assets by Entity Group Id (getAssetsByEntityGroupId) # noqa: E501 + + Returns a page of asset objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_assets_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_assets_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_assets_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get assets by Entity Group Id (getAssetsByEntityGroupId) # noqa: E501 + + Returns a page of asset objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_assets_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_assets_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_assets_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_assets_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/assets{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_assets_by_ids_using_get(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_ids_using_get(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of asset ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + return data + + def get_assets_by_ids_using_get_with_http_info(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_ids_using_get_with_http_info(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of asset ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_assets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_ids' is set + if ('asset_ids' not in params or + params['asset_ids'] is None): + raise ValueError("Missing the required parameter `asset_ids` when calling `get_assets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_ids' in params: + query_params.append(('assetIds', params['asset_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets{?assetIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_asset_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the specified customer. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_asset_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the specified customer. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assetInfos{?assetProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_assets_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_assets_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_asset_using_get(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + return data + + def get_tenant_asset_using_get_with_http_info(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get_with_http_info(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_asset_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_name' is set + if ('asset_name' not in params or + params['asset_name'] is None): + raise ValueError("Missing the required parameter `asset_name` when calling `get_tenant_asset_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_name' in params: + query_params.append(('assetName', params['asset_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?assetName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_assets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_assets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_assets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Assets (getUserAssets) # noqa: E501 + + Returns a page of assets objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_assets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_assets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Assets (getUserAssets) # noqa: E501 + + Returns a page of assets objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_assets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/assets{?assetProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_asset_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_asset_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_asset_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_asset_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_asset_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_asset_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_asset_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/asset_profile_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/asset_profile_controller_api.py new file mode 100644 index 0000000..b16bd3d --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/asset_profile_controller_api.py @@ -0,0 +1,934 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_asset_profile_using_delete(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def delete_asset_profile_using_delete_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `delete_asset_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_info_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_info_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profiles_by_ids_using_get(self, asset_profile_ids, **kwargs): # noqa: E501 + """Get Asset Profiles By Ids (getAssetProfilesByIds) # noqa: E501 + + Requested asset profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_by_ids_using_get(asset_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_ids: A list of asset profile ids, separated by comma ',' (required) + :return: list[AssetProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profiles_by_ids_using_get_with_http_info(asset_profile_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profiles_by_ids_using_get_with_http_info(asset_profile_ids, **kwargs) # noqa: E501 + return data + + def get_asset_profiles_by_ids_using_get_with_http_info(self, asset_profile_ids, **kwargs): # noqa: E501 + """Get Asset Profiles By Ids (getAssetProfilesByIds) # noqa: E501 + + Requested asset profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_by_ids_using_get_with_http_info(asset_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_ids: A list of asset profile ids, separated by comma ',' (required) + :return: list[AssetProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_ids' is set + if ('asset_profile_ids' not in params or + params['asset_profile_ids'] is None): + raise ValueError("Missing the required parameter `asset_profile_ids` when calling `get_asset_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_profile_ids' in params: + query_params.append(('assetProfileIds', params['asset_profile_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfos{?assetProfileIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[AssetProfileInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_asset_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_asset_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_asset_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_asset_profile_using_post(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_asset_profile_using_post_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `set_default_asset_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/audit_log_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/audit_log_controller_api.py new file mode 100644 index 0000000..93e2106 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/audit_log_controller_api.py @@ -0,0 +1,587 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuditLogControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_audit_logs_by_customer_id_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_customer_id_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_customer_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/customer/{customerId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_entity_id_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_entity_id_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_entity_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/entity/{entityType}/{entityId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_user_id_using_get(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_user_id_using_get_with_http_info(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_user_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/user/{userId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/auth_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/auth_controller_api.py new file mode 100644 index 0000000..5f7e9b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/auth_controller_api.py @@ -0,0 +1,882 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def activate_user_using_post(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def activate_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def change_password_using_post(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def change_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/changePassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ObjectNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_activate_token_using_get(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + else: + (data) = self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + return data + + def check_activate_token_using_get_with_http_info(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get_with_http_info(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['activate_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_activate_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'activate_token' is set + if ('activate_token' not in params or + params['activate_token'] is None): + raise ValueError("Missing the required parameter `activate_token` when calling `check_activate_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'activate_token' in params: + query_params.append(('activateToken', params['activate_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?activateToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_reset_token_using_get(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + else: + (data) = self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + return data + + def check_reset_token_using_get_with_http_info(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get_with_http_info(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['reset_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_reset_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'reset_token' is set + if ('reset_token' not in params or + params['reset_token'] is None): + raise ValueError("Missing the required parameter `reset_token` when calling `check_reset_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'reset_token' in params: + query_params.append(('resetToken', params['reset_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword{?resetToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_password_policy_using_get(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_password_policy_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_password_policy_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/userPasswordPolicy', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserPasswordPolicy', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_using_get(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/user', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def logout_using_post(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def logout_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/logout', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_reset_password_by_email_using_post(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def request_reset_password_by_email_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_reset_password_by_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPasswordByEmail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reset_password_using_post(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def reset_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reset_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/billing_endpoint_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/billing_endpoint_controller_api.py new file mode 100644 index 0000000..9a11d22 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/billing_endpoint_controller_api.py @@ -0,0 +1,868 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class BillingEndpointControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_tenant_can_update_plan_using_post(self, body, **kwargs): # noqa: E501 + """checkTenantCanUpdatePlan # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_tenant_can_update_plan_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: canUpdatePlanRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_tenant_can_update_plan_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.check_tenant_can_update_plan_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def check_tenant_can_update_plan_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """checkTenantCanUpdatePlan # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_tenant_can_update_plan_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: canUpdatePlanRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_tenant_can_update_plan_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `check_tenant_can_update_plan_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenantCanUpdatePlan', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def notify_tenant_plan_changed_using_post(self, body, **kwargs): # noqa: E501 + """notifyTenantPlanChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_plan_changed_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantPlanChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.notify_tenant_plan_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.notify_tenant_plan_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def notify_tenant_plan_changed_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """notifyTenantPlanChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_plan_changed_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantPlanChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method notify_tenant_plan_changed_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `notify_tenant_plan_changed_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenantPlanChanged', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def notify_tenant_state_changed_using_post(self, body, **kwargs): # noqa: E501 + """notifyTenantStateChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_state_changed_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantStateChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.notify_tenant_state_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.notify_tenant_state_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def notify_tenant_state_changed_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """notifyTenantStateChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_state_changed_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantStateChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method notify_tenant_state_changed_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `notify_tenant_state_changed_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenantStateChanged', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_account_activated_email_using_post(self, body, **kwargs): # noqa: E501 + """sendAccountActivatedEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_account_activated_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendAccountActivatedEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_account_activated_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_account_activated_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_account_activated_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendAccountActivatedEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_account_activated_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendAccountActivatedEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_account_activated_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_account_activated_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendAccountActivated', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_activation_email_using_post(self, body, **kwargs): # noqa: E501 + """sendActivationEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendActivationEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_activation_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_activation_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_activation_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendActivationEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendActivationEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_activation_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_activation_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendActivation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_password_was_reset_email_using_post(self, body, **kwargs): # noqa: E501 + """sendPasswordWasResetEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_password_was_reset_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendPassowordWasResetEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_password_was_reset_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_password_was_reset_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_password_was_reset_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendPasswordWasResetEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_password_was_reset_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendPassowordWasResetEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_password_was_reset_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_password_was_reset_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendPasswordWasReset', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_reset_password_email_using_post(self, body, **kwargs): # noqa: E501 + """sendResetPasswordEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_reset_password_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendResetPasswordEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_reset_password_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_reset_password_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_reset_password_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendResetPasswordEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_reset_password_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendResetPasswordEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_reset_password_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_reset_password_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendResetPassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_has_billing_read_using_get(self, **kwargs): # noqa: E501 + """tenantHasBillingRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_read_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_billing_read_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_billing_read_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_billing_read_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasBillingRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_read_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_billing_read_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenant/permission/billing/read', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_has_billing_write_using_get(self, **kwargs): # noqa: E501 + """tenantHasBillingWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_write_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_billing_write_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_billing_write_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_billing_write_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasBillingWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_write_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_billing_write_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenant/permission/billing/write', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/blob_entity_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/blob_entity_controller_api.py new file mode 100644 index 0000000..da293ee --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/blob_entity_controller_api.py @@ -0,0 +1,554 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class BlobEntityControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_blob_entity_using_delete(self, blob_entity_id, **kwargs): # noqa: E501 + """Delete Blob Entity (deleteBlobEntity) # noqa: E501 + + Delete Blob entity based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_blob_entity_using_delete(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_blob_entity_using_delete_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_blob_entity_using_delete_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + return data + + def delete_blob_entity_using_delete_with_http_info(self, blob_entity_id, **kwargs): # noqa: E501 + """Delete Blob Entity (deleteBlobEntity) # noqa: E501 + + Delete Blob entity based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_blob_entity_using_delete_with_http_info(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_blob_entity_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_id' is set + if ('blob_entity_id' not in params or + params['blob_entity_id'] is None): + raise ValueError("Missing the required parameter `blob_entity_id` when calling `delete_blob_entity_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'blob_entity_id' in params: + path_params['blobEntityId'] = params['blob_entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntity/{blobEntityId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_blob_entity_using_get(self, blob_entity_id, **kwargs): # noqa: E501 + """Download Blob Entity By Id (downloadBlobEntity) # noqa: E501 + + Download report file based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_blob_entity_using_get(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_blob_entity_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + else: + (data) = self.download_blob_entity_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + return data + + def download_blob_entity_using_get_with_http_info(self, blob_entity_id, **kwargs): # noqa: E501 + """Download Blob Entity By Id (downloadBlobEntity) # noqa: E501 + + Download report file based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_blob_entity_using_get_with_http_info(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_blob_entity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_id' is set + if ('blob_entity_id' not in params or + params['blob_entity_id'] is None): + raise ValueError("Missing the required parameter `blob_entity_id` when calling `download_blob_entity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'blob_entity_id' in params: + path_params['blobEntityId'] = params['blob_entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntity/{blobEntityId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_blob_entities_by_ids_using_get(self, blob_entity_ids, **kwargs): # noqa: E501 + """Get Blob Entities By Ids (getBlobEntitiesByIds) # noqa: E501 + + Requested blob entities must be owned by tenant or assigned to customer which user is performing the request. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.). See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_by_ids_using_get(blob_entity_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_ids: A list of blob entity ids, separated by comma ',' (required) + :return: list[BlobEntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_blob_entities_by_ids_using_get_with_http_info(blob_entity_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_blob_entities_by_ids_using_get_with_http_info(blob_entity_ids, **kwargs) # noqa: E501 + return data + + def get_blob_entities_by_ids_using_get_with_http_info(self, blob_entity_ids, **kwargs): # noqa: E501 + """Get Blob Entities By Ids (getBlobEntitiesByIds) # noqa: E501 + + Requested blob entities must be owned by tenant or assigned to customer which user is performing the request. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.). See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_by_ids_using_get_with_http_info(blob_entity_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_ids: A list of blob entity ids, separated by comma ',' (required) + :return: list[BlobEntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_blob_entities_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_ids' is set + if ('blob_entity_ids' not in params or + params['blob_entity_ids'] is None): + raise ValueError("Missing the required parameter `blob_entity_ids` when calling `get_blob_entities_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'blob_entity_ids' in params: + query_params.append(('blobEntityIds', params['blob_entity_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntities{?blobEntityIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[BlobEntityInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_blob_entities_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Blob Entities (getBlobEntities) # noqa: E501 + + Returns a page of BlobEntityWithCustomerInfo object that are available for the current user. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the blob entity type. For example, 'report' + :param str text_search: The case insensitive 'startsWith' filter based on the blob entity name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :return: PageDataBlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_blob_entities_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_blob_entities_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_blob_entities_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Blob Entities (getBlobEntities) # noqa: E501 + + Returns a page of BlobEntityWithCustomerInfo object that are available for the current user. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the blob entity type. For example, 'report' + :param str text_search: The case insensitive 'startsWith' filter based on the blob entity name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :return: PageDataBlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_blob_entities_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_blob_entities_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_blob_entities_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntities{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataBlobEntityWithCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_blob_entity_info_by_id_using_get(self, blob_entity_id, **kwargs): # noqa: E501 + """Get Blob Entity With Customer Info (getBlobEntityInfoById) # noqa: E501 + + Fetch the BlobEntityWithCustomerInfo object based on the provided Blob entity Id. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entity_info_by_id_using_get(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: BlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_blob_entity_info_by_id_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_blob_entity_info_by_id_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + return data + + def get_blob_entity_info_by_id_using_get_with_http_info(self, blob_entity_id, **kwargs): # noqa: E501 + """Get Blob Entity With Customer Info (getBlobEntityInfoById) # noqa: E501 + + Fetch the BlobEntityWithCustomerInfo object based on the provided Blob entity Id. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entity_info_by_id_using_get_with_http_info(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: BlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_blob_entity_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_id' is set + if ('blob_entity_id' not in params or + params['blob_entity_id'] is None): + raise ValueError("Missing the required parameter `blob_entity_id` when calling `get_blob_entity_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'blob_entity_id' in params: + path_params['blobEntityId'] = params['blob_entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntity/info/{blobEntityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BlobEntityWithCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/chirp_stack_integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/chirp_stack_integration_controller_api.py new file mode 100644 index 0000000..04e9156 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/chirp_stack_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ChirpStackIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/cloud_endpoint_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/cloud_endpoint_controller_api.py new file mode 100644 index 0000000..bedf6e6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/cloud_endpoint_controller_api.py @@ -0,0 +1,298 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CloudEndpointControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def tenant_has_white_label_read_using_get(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_read_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_white_label_read_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_white_label_read_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_white_label_read_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_read_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_white_label_read_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/cloudEndpoint/tenant/permission/whiteLabel/read', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_has_white_label_write_using_get(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_write_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_white_label_write_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_white_label_write_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_white_label_write_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_write_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_white_label_write_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/cloudEndpoint/tenant/permission/whiteLabel/write', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_white_labeling_allowed_using_get(self, **kwargs): # noqa: E501 + """tenantWhiteLabelingAllowed # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_white_labeling_allowed_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_white_labeling_allowed_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantWhiteLabelingAllowed # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_white_labeling_allowed_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_white_labeling_allowed_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/cloudEndpoint/tenant/permission/whiteLabelingAllowed', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/component_descriptor_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/component_descriptor_controller_api.py new file mode 100644 index 0000000..c445505 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/component_descriptor_controller_api.py @@ -0,0 +1,340 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ComponentDescriptorControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_component_descriptor_by_clazz_using_get(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + return data + + def get_component_descriptor_by_clazz_using_get_with_http_info(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_descriptor_clazz'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptor_by_clazz_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_descriptor_clazz' is set + if ('component_descriptor_clazz' not in params or + params['component_descriptor_clazz'] is None): + raise ValueError("Missing the required parameter `component_descriptor_clazz` when calling `get_component_descriptor_by_clazz_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_descriptor_clazz' in params: + path_params['componentDescriptorClazz'] = params['component_descriptor_clazz'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/component/{componentDescriptorClazz}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ComponentDescriptor', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_type_using_get(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_type_using_get_with_http_info(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get_with_http_info(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_type', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_type' is set + if ('component_type' not in params or + params['component_type'] is None): + raise ValueError("Missing the required parameter `component_type` when calling `get_component_descriptors_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_type' in params: + path_params['componentType'] = params['component_type'] # noqa: E501 + + query_params = [] + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components/{componentType}{?ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_types_using_get(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_types_using_get_with_http_info(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get_with_http_info(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_types', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_types' is set + if ('component_types' not in params or + params['component_types'] is None): + raise ValueError("Missing the required parameter `component_types` when calling `get_component_descriptors_by_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'component_types' in params: + query_params.append(('componentTypes', params['component_types'])) # noqa: E501 + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components{?componentTypes,ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/converter_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/converter_controller_api.py new file mode 100644 index 0000000..70f8d79 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/converter_controller_api.py @@ -0,0 +1,839 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ConverterControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_converter_using_delete(self, converter_id, **kwargs): # noqa: E501 + """Delete converter (deleteConverter) # noqa: E501 + + Deletes the converter and all the relations (from and to the converter). Referencing non-existing converter Id will cause an error. If the converter is associated with the integration, it will not be allowed for deletion. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_converter_using_delete(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_converter_using_delete_with_http_info(converter_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_converter_using_delete_with_http_info(converter_id, **kwargs) # noqa: E501 + return data + + def delete_converter_using_delete_with_http_info(self, converter_id, **kwargs): # noqa: E501 + """Delete converter (deleteConverter) # noqa: E501 + + Deletes the converter and all the relations (from and to the converter). Referencing non-existing converter Id will cause an error. If the converter is associated with the integration, it will not be allowed for deletion. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_converter_using_delete_with_http_info(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_converter_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_id' is set + if ('converter_id' not in params or + params['converter_id'] is None): + raise ValueError("Missing the required parameter `converter_id` when calling `delete_converter_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'converter_id' in params: + path_params['converterId'] = params['converter_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/{converterId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_converter_by_id_using_get(self, converter_id, **kwargs): # noqa: E501 + """Get Converter (getConverterById) # noqa: E501 + + Fetch the Converter object based on the provided Converter Id. The server checks that the converter is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converter_by_id_using_get(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_converter_by_id_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + else: + (data) = self.get_converter_by_id_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + return data + + def get_converter_by_id_using_get_with_http_info(self, converter_id, **kwargs): # noqa: E501 + """Get Converter (getConverterById) # noqa: E501 + + Fetch the Converter object based on the provided Converter Id. The server checks that the converter is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converter_by_id_using_get_with_http_info(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_converter_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_id' is set + if ('converter_id' not in params or + params['converter_id'] is None): + raise ValueError("Missing the required parameter `converter_id` when calling `get_converter_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'converter_id' in params: + path_params['converterId'] = params['converter_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/{converterId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Converter', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_converters_by_ids_using_get(self, converter_ids, **kwargs): # noqa: E501 + """Get Converters By Ids (getConvertersByIds) # noqa: E501 + + Requested converters must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_by_ids_using_get(converter_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_ids: A list of converter ids, separated by comma ',' (required) + :return: list[Converter] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_converters_by_ids_using_get_with_http_info(converter_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_converters_by_ids_using_get_with_http_info(converter_ids, **kwargs) # noqa: E501 + return data + + def get_converters_by_ids_using_get_with_http_info(self, converter_ids, **kwargs): # noqa: E501 + """Get Converters By Ids (getConvertersByIds) # noqa: E501 + + Requested converters must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_by_ids_using_get_with_http_info(converter_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_ids: A list of converter ids, separated by comma ',' (required) + :return: list[Converter] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_converters_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_ids' is set + if ('converter_ids' not in params or + params['converter_ids'] is None): + raise ValueError("Missing the required parameter `converter_ids` when calling `get_converters_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'converter_ids' in params: + query_params.append(('converterIds', params['converter_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converters{?converterIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Converter]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_converters_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Converters (getConverters) # noqa: E501 + + Returns a page of converters owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template converters + :param str text_search: The case insensitive 'startsWith' filter based on the converter name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataConverter + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_converters_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_converters_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_converters_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Converters (getConverters) # noqa: E501 + + Returns a page of converters owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template converters + :param str text_search: The case insensitive 'startsWith' filter based on the converter name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataConverter + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'is_edge_template', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_converters_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_converters_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_converters_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_edge_template' in params: + query_params.append(('isEdgeTemplate', params['is_edge_template'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converters{?isEdgeTemplate,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataConverter', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_converter_debug_input_using_get(self, converter_id, **kwargs): # noqa: E501 + """Get latest debug input event (getLatestConverterDebugInput) # noqa: E501 + + Returns a JSON object of the latest debug event representing the input message the converter processed. ## Uplink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":40}\", \"inMetadata\":\"{\\\"Header:sec-ch-ua\\\":\\\"\\\\\\\"Chromium\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\"Google Chrome\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\";Not A Brand\\\\\\\";v=\\\\\\\"99\\\\\\\"\\\",\\\"Header:user-agent\\\":\\\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36\\\",\\\"integrationName\\\":\\\"Integration\\\",\\\"Header:cookie\\\":\\\"GUID=zYSs8hymSwZKv8kHALKY; redirect_to=%2F; JSESSIONID=B0A7C8E481409CE7924E738DB04F62F9\\\",\\\"Header:sec-ch-ua-platform\\\":\\\"\\\\\\\"Linux\\\\\\\"\\\",\\\"Header:accept\\\":\\\"*/*\\\",\\\"Header:origin\\\":\\\"http://localhost:8080\\\",\\\"Header:sec-fetch-site\\\":\\\"same-origin\\\",\\\"Header:connection\\\":\\\"keep-alive\\\",\\\"Header:accept-encoding\\\":\\\"gzip, deflate, br\\\",\\\"Header:content-type\\\":\\\"application/json\\\",\\\"Header:content-length\\\":\\\"16\\\",\\\"Header:sec-fetch-mode\\\":\\\"cors\\\",\\\"Header:sec-ch-ua-mobile\\\":\\\"?0\\\",\\\"Header:sec-fetch-dest\\\":\\\"empty\\\",\\\"Header:host\\\":\\\"localhost:8080\\\",\\\"Header:referer\\\":\\\"http://localhost:8080/swagger-ui.html\\\",\\\"Header:accept-language\\\":\\\"en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,uk;q=0.6,und;q=0.5\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - message data received; * 'inMetadata' - integration metadata (e.g. headers). ## Downlink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":42,\\\"humidity\\\":77}\", \"inMsgType\":\"POST_TELEMETRY_REQUEST\", \"inMetadata\":\"{\\\"data\\\":\\\"40\\\"}\", \"inIntegrationMetadata\":\"{\\\"integrationName\\\":\\\"Integration\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - content of the message pushed from the rule engine; * 'inMsgType' - type of the message pushed from the rule engine; * 'inMetadata' - content of the message metadata pushed from the rule engine; * 'inIntegrationMetadata' - integration metadata. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_converter_debug_input_using_get(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_converter_debug_input_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_converter_debug_input_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + return data + + def get_latest_converter_debug_input_using_get_with_http_info(self, converter_id, **kwargs): # noqa: E501 + """Get latest debug input event (getLatestConverterDebugInput) # noqa: E501 + + Returns a JSON object of the latest debug event representing the input message the converter processed. ## Uplink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":40}\", \"inMetadata\":\"{\\\"Header:sec-ch-ua\\\":\\\"\\\\\\\"Chromium\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\"Google Chrome\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\";Not A Brand\\\\\\\";v=\\\\\\\"99\\\\\\\"\\\",\\\"Header:user-agent\\\":\\\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36\\\",\\\"integrationName\\\":\\\"Integration\\\",\\\"Header:cookie\\\":\\\"GUID=zYSs8hymSwZKv8kHALKY; redirect_to=%2F; JSESSIONID=B0A7C8E481409CE7924E738DB04F62F9\\\",\\\"Header:sec-ch-ua-platform\\\":\\\"\\\\\\\"Linux\\\\\\\"\\\",\\\"Header:accept\\\":\\\"*/*\\\",\\\"Header:origin\\\":\\\"http://localhost:8080\\\",\\\"Header:sec-fetch-site\\\":\\\"same-origin\\\",\\\"Header:connection\\\":\\\"keep-alive\\\",\\\"Header:accept-encoding\\\":\\\"gzip, deflate, br\\\",\\\"Header:content-type\\\":\\\"application/json\\\",\\\"Header:content-length\\\":\\\"16\\\",\\\"Header:sec-fetch-mode\\\":\\\"cors\\\",\\\"Header:sec-ch-ua-mobile\\\":\\\"?0\\\",\\\"Header:sec-fetch-dest\\\":\\\"empty\\\",\\\"Header:host\\\":\\\"localhost:8080\\\",\\\"Header:referer\\\":\\\"http://localhost:8080/swagger-ui.html\\\",\\\"Header:accept-language\\\":\\\"en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,uk;q=0.6,und;q=0.5\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - message data received; * 'inMetadata' - integration metadata (e.g. headers). ## Downlink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":42,\\\"humidity\\\":77}\", \"inMsgType\":\"POST_TELEMETRY_REQUEST\", \"inMetadata\":\"{\\\"data\\\":\\\"40\\\"}\", \"inIntegrationMetadata\":\"{\\\"integrationName\\\":\\\"Integration\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - content of the message pushed from the rule engine; * 'inMsgType' - type of the message pushed from the rule engine; * 'inMetadata' - content of the message metadata pushed from the rule engine; * 'inIntegrationMetadata' - integration metadata. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_converter_debug_input_using_get_with_http_info(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_converter_debug_input_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_id' is set + if ('converter_id' not in params or + params['converter_id'] is None): + raise ValueError("Missing the required parameter `converter_id` when calling `get_latest_converter_debug_input_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'converter_id' in params: + path_params['converterId'] = params['converter_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/{converterId}/debugIn', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_converter_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Converter (saveConverter) # noqa: E501 + + Create or update the Converter. When creating converter, platform generates Converter Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created converter id will be present in the response. Specify existing Converter id to update the converter. Referencing non-existing converter Id will cause 'Not Found' error. Converter name is unique in the scope of tenant. # Converter Configuration Converter configuration (**'configuration'** field) is the JSON object that should contain one of two possible fields: **'decoder'** or **'encoder'**. The former is used when the converter has UPLINK type, the latter is used - when DOWNLINK type. It can contain both 'decoder' and 'encoder' fields, when the correct one is specified for the appropriate converter type, another one can be set to 'null'. See the examples of each one below. ## Uplink Converter Configuration ```json { \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\", \"encoder\":null } ``` Decoder field in the more readable form: ```text // Decode an uplink message from a buffer // payload - array of bytes // metadata - key/value object /** Decoder **/ // decode payload to string var payloadStr = decodeToString(payload); // decode payload to JSON // var data = decodeToJson(payload); var deviceName = 'Device A'; var deviceType = 'thermostat'; var customerName = 'customer'; var groupName = 'thermostat devices'; // use assetName and assetType instead of deviceName and deviceType // to automatically create assets instead of devices. // var assetName = 'Asset A'; // var assetType = 'building'; // Result object with device/asset attributes/telemetry data var result = { // Use deviceName and deviceType or assetName and assetType, but not both. deviceName: deviceName, deviceType: deviceType, // assetName: assetName, // assetType: assetType, customerName: customerName, groupName: groupName, attributes: { model: 'Model A', serialNumber: 'SN111', integrationName: metadata['integrationName'] }, telemetry: { temperature: 42, humidity: 80, rawData: payloadStr } }; /** Helper functions **/ function decodeToString(payload) { return String.fromCharCode.apply(String, payload); } function decodeToJson(payload) { // covert payload to string. var str = decodeToString(payload); // parse string to JSON var data = JSON.parse(str); return data; } return result; ``` ## Downlink Converter Configuration ```json { \"decoder\":null, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempFreq = msg.temperatureUploadFrequency;\\ndata.humFreq = msg.humidityUploadFrequency;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` Encoder field in the more readable form: ```text // Encode downlink data from incoming Rule Engine message // msg - JSON message payload downlink message json // msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. // metadata - list of key-value pairs with additional data about the message // integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter /** Encoder **/ var data = {}; // Process data from incoming message and metadata data.tempFreq = msg.temperatureUploadFrequency; data.humFreq = msg.humidityUploadFrequency; data.devSerialNumber = metadata['ss_serialNumber']; // Result object with encoded downlink payload var result = { // downlink data content type: JSON, TEXT or BINARY (base64 format) contentType: \"JSON\", // downlink data data: JSON.stringify(data), // Optional metadata object presented in key/value format metadata: { topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload' } }; return result; ``` Remove 'id', 'tenantId' from the request body example (below) to create new converter entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_converter_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Converter body: + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_converter_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_converter_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_converter_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Converter (saveConverter) # noqa: E501 + + Create or update the Converter. When creating converter, platform generates Converter Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created converter id will be present in the response. Specify existing Converter id to update the converter. Referencing non-existing converter Id will cause 'Not Found' error. Converter name is unique in the scope of tenant. # Converter Configuration Converter configuration (**'configuration'** field) is the JSON object that should contain one of two possible fields: **'decoder'** or **'encoder'**. The former is used when the converter has UPLINK type, the latter is used - when DOWNLINK type. It can contain both 'decoder' and 'encoder' fields, when the correct one is specified for the appropriate converter type, another one can be set to 'null'. See the examples of each one below. ## Uplink Converter Configuration ```json { \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\", \"encoder\":null } ``` Decoder field in the more readable form: ```text // Decode an uplink message from a buffer // payload - array of bytes // metadata - key/value object /** Decoder **/ // decode payload to string var payloadStr = decodeToString(payload); // decode payload to JSON // var data = decodeToJson(payload); var deviceName = 'Device A'; var deviceType = 'thermostat'; var customerName = 'customer'; var groupName = 'thermostat devices'; // use assetName and assetType instead of deviceName and deviceType // to automatically create assets instead of devices. // var assetName = 'Asset A'; // var assetType = 'building'; // Result object with device/asset attributes/telemetry data var result = { // Use deviceName and deviceType or assetName and assetType, but not both. deviceName: deviceName, deviceType: deviceType, // assetName: assetName, // assetType: assetType, customerName: customerName, groupName: groupName, attributes: { model: 'Model A', serialNumber: 'SN111', integrationName: metadata['integrationName'] }, telemetry: { temperature: 42, humidity: 80, rawData: payloadStr } }; /** Helper functions **/ function decodeToString(payload) { return String.fromCharCode.apply(String, payload); } function decodeToJson(payload) { // covert payload to string. var str = decodeToString(payload); // parse string to JSON var data = JSON.parse(str); return data; } return result; ``` ## Downlink Converter Configuration ```json { \"decoder\":null, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempFreq = msg.temperatureUploadFrequency;\\ndata.humFreq = msg.humidityUploadFrequency;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` Encoder field in the more readable form: ```text // Encode downlink data from incoming Rule Engine message // msg - JSON message payload downlink message json // msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. // metadata - list of key-value pairs with additional data about the message // integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter /** Encoder **/ var data = {}; // Process data from incoming message and metadata data.tempFreq = msg.temperatureUploadFrequency; data.humFreq = msg.humidityUploadFrequency; data.devSerialNumber = metadata['ss_serialNumber']; // Result object with encoded downlink payload var result = { // downlink data content type: JSON, TEXT or BINARY (base64 format) contentType: \"JSON\", // downlink data data: JSON.stringify(data), // Optional metadata object presented in key/value format metadata: { topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload' } }; return result; ``` Remove 'id', 'tenantId' from the request body example (below) to create new converter entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_converter_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Converter body: + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_converter_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Converter', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_down_link_converter_using_post(self, **kwargs): # noqa: E501 + """Test converter function (testDownLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ \"data\":\"40\" }, \"msg\":\"{\\n \\\"temp\\\": 42,\\n \\\"humidity\\\": 77\\n}\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"integrationMetadata\":{ \"integrationName\":\"Integration\" }, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempValue = msg.temp;\\ndata.humValue = msg.humidity;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` * 'metadata' - message metadata pushed from the rule engine; * 'msg' - message data pushed from the rule engine; * 'msgType' - type of the message pushed from the rule engine; * 'integrationMetadata' - integration metadata object; * 'encoder' - string representation of the encoder configuration. ## Response Body Example ```json { \"contentType\":\"JSON\", \"data\":\"{\\\"tempValue\\\":42,\\\"humValue\\\":77}\", \"metadata\":{ \"topic\":\"sensor/Temp Sensor/upload\" } } ``` * 'contentType' - downlink data content type; * 'data' - downlink data; * 'metadata' - optional metadata object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_down_link_converter_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_down_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_down_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_down_link_converter_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test converter function (testDownLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ \"data\":\"40\" }, \"msg\":\"{\\n \\\"temp\\\": 42,\\n \\\"humidity\\\": 77\\n}\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"integrationMetadata\":{ \"integrationName\":\"Integration\" }, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempValue = msg.temp;\\ndata.humValue = msg.humidity;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` * 'metadata' - message metadata pushed from the rule engine; * 'msg' - message data pushed from the rule engine; * 'msgType' - type of the message pushed from the rule engine; * 'integrationMetadata' - integration metadata object; * 'encoder' - string representation of the encoder configuration. ## Response Body Example ```json { \"contentType\":\"JSON\", \"data\":\"{\\\"tempValue\\\":42,\\\"humValue\\\":77}\", \"metadata\":{ \"topic\":\"sensor/Temp Sensor/upload\" } } ``` * 'contentType' - downlink data content type; * 'data' - downlink data; * 'metadata' - optional metadata object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_down_link_converter_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_down_link_converter_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/testDownLink{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_up_link_converter_using_post(self, **kwargs): # noqa: E501 + """Test converter function (testUpLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ }, \"payload\":\"ewogICAgImRhdGEiOiAiZGF0YSIKfQ==\", \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\" } ``` * 'metadata' - integration metadata; * 'payload' - base64 string representation of the data; * 'decoder' - string representation of the decoder configuration. ## Response Body Example ```json { \"output\":\"{\\\"deviceName\\\":\\\"Device A\\\",\\\"deviceType\\\":\\\"thermostat\\\",\\\"customerName\\\":\\\"customer\\\",\\\"groupName\\\":\\\"thermostat devices\\\",\\\"attributes\\\":{\\\"model\\\":\\\"Model A\\\",\\\"serialNumber\\\":\\\"SN111\\\"},\\\"telemetry\\\":{\\\"temperature\\\":42,\\\"humidity\\\":80,\\\"rawData\\\":\\\"{\\\\n \\\\\\\"data\\\\\\\": \\\\\\\"data\\\\\\\"\\\\n}\\\"}}\", \"error\":\"\" } ``` * 'output' - string representation of the output message; * 'error' - string representation of the error message. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_up_link_converter_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_up_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_up_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_up_link_converter_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test converter function (testUpLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ }, \"payload\":\"ewogICAgImRhdGEiOiAiZGF0YSIKfQ==\", \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\" } ``` * 'metadata' - integration metadata; * 'payload' - base64 string representation of the data; * 'decoder' - string representation of the decoder configuration. ## Response Body Example ```json { \"output\":\"{\\\"deviceName\\\":\\\"Device A\\\",\\\"deviceType\\\":\\\"thermostat\\\",\\\"customerName\\\":\\\"customer\\\",\\\"groupName\\\":\\\"thermostat devices\\\",\\\"attributes\\\":{\\\"model\\\":\\\"Model A\\\",\\\"serialNumber\\\":\\\"SN111\\\"},\\\"telemetry\\\":{\\\"temperature\\\":42,\\\"humidity\\\":80,\\\"rawData\\\":\\\"{\\\\n \\\\\\\"data\\\\\\\": \\\\\\\"data\\\\\\\"\\\\n}\\\"}}\", \"error\":\"\" } ``` * 'output' - string representation of the output message; * 'error' - string representation of the error message. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_up_link_converter_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_up_link_converter_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/testUpLink{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/custom_menu_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/custom_menu_controller_api.py new file mode 100644 index 0000000..9af438e --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/custom_menu_controller_api.py @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomMenuControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_custom_menu_using_get(self, **kwargs): # noqa: E501 + """Get Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object that corresponds to the authority of the user. The API call is designed to load the custom menu items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom menu configured on a system level. And there is no custom menu items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_menu_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_custom_menu_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object that corresponds to the authority of the user. The API call is designed to load the custom menu items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom menu configured on a system level. And there is no custom menu items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_menu_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_custom_menu_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customMenu/currentCustomMenu', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomMenu', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_custom_menu_using_get(self, **kwargs): # noqa: E501 + """Get end-user Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object for the end user. The custom menu is configured in the white labeling parameters. If custom menu configuration on the tenant level is present, it overrides the menu configuration of the system level. Similar, if the custom menu configuration on the customer level is present, it overrides the menu configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_menu_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_custom_menu_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get end-user Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object for the end user. The custom menu is configured in the white labeling parameters. If custom menu configuration on the tenant level is present, it overrides the menu configuration of the system level. Similar, if the custom menu configuration on the customer level is present, it overrides the menu configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_menu_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_menu_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customMenu/customMenu', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomMenu', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_custom_menu_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Custom Menu (saveCustomMenu) # noqa: E501 + + Creates or Updates the Custom Menu configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_menu_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomMenu body: + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_custom_menu_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_custom_menu_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_custom_menu_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Custom Menu (saveCustomMenu) # noqa: E501 + + Creates or Updates the Custom Menu configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_menu_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomMenu body: + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_custom_menu_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customMenu/customMenu', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomMenu', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/custom_translation_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/custom_translation_controller_api.py new file mode 100644 index 0000000..6a5885c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/custom_translation_controller_api.py @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomTranslationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_custom_translation_using_get(self, **kwargs): # noqa: E501 + """Get Custom Translation configuration (getCurrentCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map that corresponds to the authority of the user. The API call is designed to load the custom translation items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom translation configured on a system level. And there is no custom translation items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Response example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_translation_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_custom_translation_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Custom Translation configuration (getCurrentCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map that corresponds to the authority of the user. The API call is designed to load the custom translation items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom translation configured on a system level. And there is no custom translation items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Response example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_translation_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_custom_translation_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customTranslation/currentCustomTranslation', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomTranslation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_custom_translation_using_get(self, **kwargs): # noqa: E501 + """Get end-user Custom Translation configuration (getCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map for the end user. The custom translation is configured in the white labeling parameters. If custom translation translation is defined on the tenant level, it overrides the custom translation of the system level. Similar, if the custom translation is defined on the customer level, it overrides the translation configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_translation_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_custom_translation_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get end-user Custom Translation configuration (getCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map for the end user. The custom translation is configured in the white labeling parameters. If custom translation translation is defined on the tenant level, it overrides the custom translation of the system level. Similar, if the custom translation is defined on the customer level, it overrides the translation configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_translation_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_translation_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customTranslation/customTranslation', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomTranslation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_custom_translation_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Custom Translation (saveCustomTranslation) # noqa: E501 + + Creates or Updates the Custom Translation map. Request example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_translation_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomTranslation body: + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_custom_translation_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_custom_translation_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_custom_translation_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Custom Translation (saveCustomTranslation) # noqa: E501 + + Creates or Updates the Custom Translation map. Request example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_translation_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomTranslation body: + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_custom_translation_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customTranslation/customTranslation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomTranslation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/customer_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/customer_controller_api.py new file mode 100644 index 0000000..6b64dfa --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/customer_controller_api.py @@ -0,0 +1,1413 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomerControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_customer_using_delete(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def delete_customer_using_delete_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `delete_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_customer_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Customer Infos for current user (getAllCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_customer_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_customer_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_customer_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Customer Infos for current user (getAllCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_customer_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_customer_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_customer_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customerInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_customer_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer sub-customers Infos (getCustomerCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_customer_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_customer_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_customer_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_customer_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer sub-customers Infos (getCustomerCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_customer_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_customer_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_customer_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_customer_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_customer_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/customerInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_info_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer info (getCustomerInfoById) # noqa: E501 + + Get the Customer info object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_info_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: CustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_info_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer info (getCustomerInfoById) # noqa: E501 + + Get the Customer info object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_info_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: CustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/info/{customerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_title_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_title_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_title_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_title_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/text']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/title', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get customers by Entity Group Id (getCustomersByEntityGroupId) # noqa: E501 + + Returns a page of Customer objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customers_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get customers by Entity Group Id (getCustomersByEntityGroupId) # noqa: E501 + + Returns a page of Customer objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_customers_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customers_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customers_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_by_ids_using_get(self, customer_ids, **kwargs): # noqa: E501 + """Get customers by Customer Ids (getCustomersByEntityGroupId) # noqa: E501 + + Returns a list of Customer objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_ids_using_get(customer_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_ids: A list of customer ids, separated by comma ',' (required) + :return: list[Customer] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_by_ids_using_get_with_http_info(customer_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_by_ids_using_get_with_http_info(customer_ids, **kwargs) # noqa: E501 + return data + + def get_customers_by_ids_using_get_with_http_info(self, customer_ids, **kwargs): # noqa: E501 + """Get customers by Customer Ids (getCustomersByEntityGroupId) # noqa: E501 + + Returns a list of Customer objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_ids_using_get_with_http_info(customer_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_ids: A list of customer ids, separated by comma ',' (required) + :return: list[Customer] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_ids' is set + if ('customer_ids' not in params or + params['customer_ids'] is None): + raise ValueError("Missing the required parameter `customer_ids` when calling `get_customers_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'customer_ids' in params: + query_params.append(('customerIds', params['customer_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customers{?customerIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Customer]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_customers_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customers_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customers_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_short_customer_info_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_short_customer_info_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_short_customer_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_short_customer_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/shortInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_customer_using_get(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + return data + + def get_tenant_customer_using_get_with_http_info(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get_with_http_info(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_title'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_customer_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_title' is set + if ('customer_title' not in params or + params['customer_title'] is None): + raise ValueError("Missing the required parameter `customer_title` when calling `get_tenant_customer_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'customer_title' in params: + query_params.append(('customerTitle', params['customer_title'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/customers{?customerTitle}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_customers_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Customers (getUserCustomers) # noqa: E501 + + Returns a page of customers available for the user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_customers_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_customers_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Customers (getUserCustomers) # noqa: E501 + + Returns a page of customers available for the user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_customers_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_customers_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_customers_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_customers_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_customer_using_post(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_customer_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/dashboard_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/dashboard_controller_api.py new file mode 100644 index 0000000..5f08bb0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/dashboard_controller_api.py @@ -0,0 +1,2190 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DashboardControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_dashboard_using_delete(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Only users with 'TENANT_ADMIN') authority may delete the dashboards. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def delete_dashboard_using_delete_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Only users with 'TENANT_ADMIN') authority may delete the dashboards. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_dashboard_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `delete_dashboard_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def export_group_dashboards_using_get(self, entity_group_id, limit, **kwargs): # noqa: E501 + """Export Dashboards (exportGroupDashboards) # noqa: E501 + + Export the dashboards that belong to specified group id.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_group_dashboards_using_get(entity_group_id, limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int limit: Limit of the entities to export (required) + :return: list[Dashboard] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.export_group_dashboards_using_get_with_http_info(entity_group_id, limit, **kwargs) # noqa: E501 + else: + (data) = self.export_group_dashboards_using_get_with_http_info(entity_group_id, limit, **kwargs) # noqa: E501 + return data + + def export_group_dashboards_using_get_with_http_info(self, entity_group_id, limit, **kwargs): # noqa: E501 + """Export Dashboards (exportGroupDashboards) # noqa: E501 + + Export the dashboards that belong to specified group id.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_group_dashboards_using_get_with_http_info(entity_group_id, limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int limit: Limit of the entities to export (required) + :return: list[Dashboard] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'limit'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method export_group_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `export_group_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'limit' is set + if ('limit' not in params or + params['limit'] is None): + raise ValueError("Missing the required parameter `limit` when calling `export_group_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/dashboards/export{?limit}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Dashboard]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Dashboards for current user (getAllDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant or the customer of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Dashboards for current user (getAllDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant or the customer of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboards/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_dashboards_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_dashboards_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboards{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Customer Home Dashboard Info (getCustomerHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_customer_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_customer_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Customer Home Dashboard Info (getCustomerHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_info_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_info_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/info/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboards_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get dashboards by Entity Group Id (getDashboardsByEntityGroupId) # noqa: E501 + + Returns a page of Dashboard objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboards_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboards_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_dashboards_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get dashboards by Entity Group Id (getDashboardsByEntityGroupId) # noqa: E501 + + Returns a page of Dashboard objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboards_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_dashboards_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_dashboards_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_dashboards_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboards_by_ids_using_get(self, dashboard_ids, **kwargs): # noqa: E501 + """Get dashboards by Dashboard Ids (getDashboardsByIds) # noqa: E501 + + Returns a list of DashboardInfo objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_ids_using_get(dashboard_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_ids: A list of dashboard ids, separated by comma ',' (required) + :return: list[DashboardInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboards_by_ids_using_get_with_http_info(dashboard_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboards_by_ids_using_get_with_http_info(dashboard_ids, **kwargs) # noqa: E501 + return data + + def get_dashboards_by_ids_using_get_with_http_info(self, dashboard_ids, **kwargs): # noqa: E501 + """Get dashboards by Dashboard Ids (getDashboardsByIds) # noqa: E501 + + Returns a list of DashboardInfo objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_ids_using_get_with_http_info(dashboard_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_ids: A list of dashboard ids, separated by comma ',' (required) + :return: list[DashboardInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboards_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_ids' is set + if ('dashboard_ids' not in params or + params['dashboard_ids'] is None): + raise ValueError("Missing the required parameter `dashboard_ids` when calling `get_dashboards_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'dashboard_ids' in params: + query_params.append(('dashboardIds', params['dashboard_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboards{?dashboardIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[DashboardInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_max_datapoints_limit_using_get(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_max_datapoints_limit_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_max_datapoints_limit_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/maxDatapointsLimit', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_server_time_using_get(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_server_time_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_server_time_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/serverTime', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboards{?mobile,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get1(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get1_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Dashboards (getUserDashboards) # noqa: E501 + + Returns a page of Dashboard Info objects available for specified or current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str operation: Filter by allowed operations for the current user + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Dashboards (getUserDashboards) # noqa: E501 + + Returns a page of Dashboard Info objects available for specified or current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str operation: Filter by allowed operations for the current user + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order', 'operation', 'user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'operation' in params: + query_params.append(('operation', params['operation'])) # noqa: E501 + if 'user_id' in params: + query_params.append(('userId', params['user_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards{?mobile,operation,page,pageSize,sortOrder,sortProperty,textSearch,userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def import_group_dashboards_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Import Dashboards (importGroupDashboards) # noqa: E501 + + Import the dashboards to specified group.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_group_dashboards_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[Dashboard] body: + :param bool overwrite: Overwrite dashboards with the same name + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.import_group_dashboards_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.import_group_dashboards_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def import_group_dashboards_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Import Dashboards (importGroupDashboards) # noqa: E501 + + Import the dashboards to specified group.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_group_dashboards_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[Dashboard] body: + :param bool overwrite: Overwrite dashboards with the same name + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body', 'overwrite'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method import_group_dashboards_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `import_group_dashboards_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'overwrite' in params: + query_params.append(('overwrite', params['overwrite'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/dashboards/import{?overwrite}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_dashboard_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Only users with 'TENANT_ADMIN') authority may create the dashboards.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_dashboard_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Only users with 'TENANT_ADMIN') authority may create the dashboards.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_dashboard_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_customer_home_dashboard_info_using_post(self, **kwargs): # noqa: E501 + """Update Customer Home Dashboard Info (setCustomerHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_customer_home_dashboard_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_customer_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.set_customer_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def set_customer_home_dashboard_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Customer Home Dashboard Info (setCustomerHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_customer_home_dashboard_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_customer_home_dashboard_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/dashboard/home/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_tenant_home_dashboard_info_using_post(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def set_tenant_home_dashboard_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_tenant_home_dashboard_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/device_api_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/device_api_controller_api.py new file mode 100644 index 0000000..ddec496 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/device_api_controller_api.py @@ -0,0 +1,1212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceApiControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def claim_device_using_post(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def claim_device_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `claim_device_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/claim', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_attributes_using_get(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + else: + (data) = self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + return data + + def get_device_attributes_using_get_with_http_info(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'client_keys', 'shared_keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'client_keys' is set + if ('client_keys' not in params or + params['client_keys'] is None): + raise ValueError("Missing the required parameter `client_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'shared_keys' is set + if ('shared_keys' not in params or + params['shared_keys'] is None): + raise ValueError("Missing the required parameter `shared_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'client_keys' in params: + query_params.append(('clientKeys', params['client_keys'])) # noqa: E501 + if 'shared_keys' in params: + query_params.append(('sharedKeys', params['shared_keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes{?clientKeys,sharedKeys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_firmware_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_firmware_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_firmware_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_firmware_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/firmware{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_software_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_software_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_software_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_software_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/software{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_device_attributes_using_post(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_device_attributes_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_rpc_request_using_post(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_rpc_request_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_telemetry_using_post(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_telemetry_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/telemetry', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def provision_device_using_post(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def provision_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method provision_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/provision', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reply_to_command_using_post(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + else: + (data) = self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + return data + + def reply_to_command_using_post_with_http_info(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post_with_http_info(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'request_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reply_to_command_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `reply_to_command_using_post`") # noqa: E501 + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `reply_to_command_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc/{requestId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_attributes_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_attributes_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes/updates{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_commands_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_commands_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_commands_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_commands_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/device_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/device_controller_api.py new file mode 100644 index 0000000..4724478 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/device_controller_api.py @@ -0,0 +1,2464 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_device_to_tenant_using_post(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'ASSIGN_TO_TENANT' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_tenant_using_post_with_http_info(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'ASSIGN_TO_TENANT' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def claim_device_using_post1(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :param str sub_customer_id: subCustomerId + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def claim_device_using_post1_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :param str sub_customer_id: subCustomerId + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name', 'body', 'sub_customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `claim_device_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + if 'sub_customer_id' in params: + query_params.append(('subCustomerId', params['sub_customer_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim{?subCustomerId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_by_device_group_and_empty_ota_package_using_get(self, ota_package_type, ota_package_id, entity_group_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_group_and_empty_ota_package_using_get(ota_package_type, ota_package_id, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str ota_package_id: otaPackageId (required) + :param str entity_group_id: entityGroupId (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_by_device_group_and_empty_ota_package_using_get_with_http_info(ota_package_type, ota_package_id, entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.count_by_device_group_and_empty_ota_package_using_get_with_http_info(ota_package_type, ota_package_id, entity_group_id, **kwargs) # noqa: E501 + return data + + def count_by_device_group_and_empty_ota_package_using_get_with_http_info(self, ota_package_type, ota_package_id, entity_group_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_group_and_empty_ota_package_using_get_with_http_info(ota_package_type, ota_package_id, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str ota_package_id: otaPackageId (required) + :param str entity_group_id: entityGroupId (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_type', 'ota_package_id', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_by_device_group_and_empty_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_type' is set + if ('ota_package_type' not in params or + params['ota_package_type'] is None): + raise ValueError("Missing the required parameter `ota_package_type` when calling `count_by_device_group_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `count_by_device_group_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `count_by_device_group_and_empty_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_type' in params: + path_params['otaPackageType'] = params['ota_package_type'] # noqa: E501 + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices/count/{otaPackageType}/{otaPackageId}/{entityGroupId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_by_device_profile_and_empty_ota_package_using_get(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + return data + + def count_by_device_profile_and_empty_ota_package_using_get_with_http_info(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_type', 'device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_by_device_profile_and_empty_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_type' is set + if ('ota_package_type' not in params or + params['ota_package_type'] is None): + raise ValueError("Missing the required parameter `ota_package_type` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_type' in params: + path_params['otaPackageType'] = params['ota_package_type'] # noqa: E501 + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices/count/{otaPackageType}/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_device_using_delete(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def delete_device_using_delete_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post1(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_device_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Device Infos for current user (getAllDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the tenant or the customer of a current user. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_device_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_device_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Device Infos for current user (getAllDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the tenant or the customer of a current user. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_device_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceInfos/all{?active,deviceProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_device_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the specified customer. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_device_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the specified customer. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/deviceInfos{?active,deviceProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_devices_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_devices_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_credentials_by_device_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_credentials_by_device_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_credentials_by_device_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_credentials_by_device_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}/credentials', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_info_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceInfoById) # noqa: E501 + + Fetch the Device info object based on the provided Device Id. Device Info is an extension of the default Device object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_info_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceInfoById) # noqa: E501 + + Fetch the Device info object based on the provided Device Id. Device Info is an extension of the default Device object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/info/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_types_using_get(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_device_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_devices_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get devices by Entity Group Id (getDevicesByEntityGroupId) # noqa: E501 + + Returns a page of Device objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_devices_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_devices_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_devices_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get devices by Entity Group Id (getDevicesByEntityGroupId) # noqa: E501 + + Returns a page of Device objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_devices_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_devices_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_devices_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_devices_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/devices{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_devices_by_ids_using_get(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + return data + + def get_devices_by_ids_using_get_with_http_info(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get_with_http_info(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_devices_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_ids' is set + if ('device_ids' not in params or + params['device_ids'] is None): + raise ValueError("Missing the required parameter `device_ids` when calling `get_devices_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_ids' in params: + query_params.append(('deviceIds', params['device_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices{?deviceIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_device_using_get(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def get_tenant_device_using_get_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `get_tenant_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_name' in params: + query_params.append(('deviceName', params['device_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?deviceName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_devices_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_devices_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_devices_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Devices (getUserDevices) # noqa: E501 + + Returns a page of devices that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_devices_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_devices_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Devices (getUserDevices) # noqa: E501 + + Returns a page of devices that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_devices_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_devices_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_devices_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_devices_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def re_claim_device_using_delete(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def re_claim_device_using_delete_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method re_claim_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `re_claim_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'access_token', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'access_token' in params: + query_params.append(('accessToken', params['access_token'])) # noqa: E501 + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device{?accessToken,entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_with_credentials_using_post(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :param str entity_group_id: entityGroupId + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_with_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :param str entity_group_id: entityGroupId + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_with_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device-with-credentials{?entityGroupId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_device_credentials_using_post(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def update_device_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_device_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/credentials', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/device_group_ota_package_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/device_group_ota_package_controller_api.py new file mode 100644 index 0000000..4da166b --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/device_group_ota_package_controller_api.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceGroupOtaPackageControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_group_ota_package_using_delete(self, id, **kwargs): # noqa: E501 + """deleteDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_group_ota_package_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_group_ota_package_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_group_ota_package_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_device_group_ota_package_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """deleteDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_group_ota_package_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_group_ota_package_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_device_group_ota_package_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceGroupOtaPackage/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_firmware_by_id_using_get(self, group_id, firmware_type, **kwargs): # noqa: E501 + """getFirmwareById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_by_id_using_get(group_id, firmware_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: groupId (required) + :param str firmware_type: firmwareType (required) + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_firmware_by_id_using_get_with_http_info(group_id, firmware_type, **kwargs) # noqa: E501 + else: + (data) = self.get_firmware_by_id_using_get_with_http_info(group_id, firmware_type, **kwargs) # noqa: E501 + return data + + def get_firmware_by_id_using_get_with_http_info(self, group_id, firmware_type, **kwargs): # noqa: E501 + """getFirmwareById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_by_id_using_get_with_http_info(group_id, firmware_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: groupId (required) + :param str firmware_type: firmwareType (required) + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_id', 'firmware_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_firmware_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_id' is set + if ('group_id' not in params or + params['group_id'] is None): + raise ValueError("Missing the required parameter `group_id` when calling `get_firmware_by_id_using_get`") # noqa: E501 + # verify the required parameter 'firmware_type' is set + if ('firmware_type' not in params or + params['firmware_type'] is None): + raise ValueError("Missing the required parameter `firmware_type` when calling `get_firmware_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_id' in params: + path_params['groupId'] = params['group_id'] # noqa: E501 + if 'firmware_type' in params: + path_params['firmwareType'] = params['firmware_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceGroupOtaPackage/{groupId}/{firmwareType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceGroupOtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_group_ota_package_using_post(self, **kwargs): # noqa: E501 + """saveDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_group_ota_package_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceGroupOtaPackage body: + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_group_ota_package_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_group_ota_package_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_group_ota_package_using_post_with_http_info(self, **kwargs): # noqa: E501 + """saveDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_group_ota_package_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceGroupOtaPackage body: + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_group_ota_package_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceGroupOtaPackage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceGroupOtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/device_profile_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/device_profile_controller_api.py new file mode 100644 index 0000000..d70a614 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/device_profile_controller_api.py @@ -0,0 +1,1120 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_profile_using_delete(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def delete_device_profile_using_delete_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `delete_device_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_keys_using_get(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_attributes_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/attributes{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_device_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_device_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_device_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_info_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_info_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'transport_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'transport_type' in params: + query_params.append(('transportType', params['transport_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch,transportType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profiles_by_ids_using_get(self, device_profile_ids, **kwargs): # noqa: E501 + """Get Device Profiles By Ids (getDeviceProfilesByIds) # noqa: E501 + + Requested device profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_by_ids_using_get(device_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_ids: A list of device profile ids, separated by comma ',' (required) + :return: list[DeviceProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profiles_by_ids_using_get_with_http_info(device_profile_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profiles_by_ids_using_get_with_http_info(device_profile_ids, **kwargs) # noqa: E501 + return data + + def get_device_profiles_by_ids_using_get_with_http_info(self, device_profile_ids, **kwargs): # noqa: E501 + """Get Device Profiles By Ids (getDeviceProfilesByIds) # noqa: E501 + + Requested device profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_by_ids_using_get_with_http_info(device_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_ids: A list of device profile ids, separated by comma ',' (required) + :return: list[DeviceProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_ids' is set + if ('device_profile_ids' not in params or + params['device_profile_ids'] is None): + raise ValueError("Missing the required parameter `device_profile_ids` when calling `get_device_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_ids' in params: + query_params.append(('deviceProfileIds', params['device_profile_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfos{?deviceProfileIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[DeviceProfileInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/timeseries{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_device_profile_using_post(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_device_profile_using_post_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `set_default_device_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/edge_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/edge_controller_api.py new file mode 100644 index 0000000..5a76956 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/edge_controller_api.py @@ -0,0 +1,2432 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def activate_instance_using_post(self, license_secret, release_date, **kwargs): # noqa: E501 + """Activate edge instance (activateInstance) # noqa: E501 + + Activates edge license on license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_instance_using_post(license_secret, release_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str license_secret: licenseSecret (required) + :param str release_date: releaseDate (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_instance_using_post_with_http_info(license_secret, release_date, **kwargs) # noqa: E501 + else: + (data) = self.activate_instance_using_post_with_http_info(license_secret, release_date, **kwargs) # noqa: E501 + return data + + def activate_instance_using_post_with_http_info(self, license_secret, release_date, **kwargs): # noqa: E501 + """Activate edge instance (activateInstance) # noqa: E501 + + Activates edge license on license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_instance_using_post_with_http_info(license_secret, release_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str license_secret: licenseSecret (required) + :param str release_date: releaseDate (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['license_secret', 'release_date'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_instance_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'license_secret' is set + if ('license_secret' not in params or + params['license_secret'] is None): + raise ValueError("Missing the required parameter `license_secret` when calling `activate_instance_using_post`") # noqa: E501 + # verify the required parameter 'release_date' is set + if ('release_date' not in params or + params['release_date'] is None): + raise ValueError("Missing the required parameter `release_date` when calling `activate_instance_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'license_secret' in params: + query_params.append(('licenseSecret', params['license_secret'])) # noqa: E501 + if 'release_date' in params: + query_params.append(('releaseDate', params['release_date'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/license/activateInstance{?licenseSecret,releaseDate}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_instance_using_post(self, **kwargs): # noqa: E501 + """Check edge license (checkInstance) # noqa: E501 + + Checks license request from edge service by forwarding request to license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_instance_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_instance_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_instance_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_instance_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check edge license (checkInstance) # noqa: E501 + + Checks license request from edge service by forwarding request to license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_instance_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_instance_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/license/checkInstance', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_edge_using_delete(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def delete_edge_using_delete_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `delete_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post2(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post2_with_http_info(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post2" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_missing_to_related_rule_chains_using_get(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def find_missing_to_related_rule_chains_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_missing_to_related_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `find_missing_to_related_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/missingToRelatedRuleChains/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_edge_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Edge Infos for current user (getAllEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_edge_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Edge Infos for current user (getAllEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edgeInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edge_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edge_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edgeInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edges_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edges_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_docker_install_instructions_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id.If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_docker_install_instructions_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id.If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_docker_install_instructions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_docker_install_instructions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/instructions/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInstallInstructions', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_info_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_info_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/info/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_types_using_get(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_edge_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get edges by Entity Group Id (getEdgesByEntityGroupId) # noqa: E501 + + Returns a page of Edge objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edges_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get edges by Entity Group Id (getEdgesByEntityGroupId) # noqa: E501 + + Returns a page of Edge objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_edges_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edges_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edges_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/edges{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_by_ids_using_get(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + return data + + def get_edges_by_ids_using_get_with_http_info(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get_with_http_info(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_ids' is set + if ('edge_ids' not in params or + params['edge_ids'] is None): + raise ValueError("Missing the required parameter `edge_ids` when calling `get_edges_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_ids' in params: + query_params.append(('edgeIds', params['edge_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?edgeIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edge_using_get(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + return data + + def get_tenant_edge_using_get_with_http_info(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get_with_http_info(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edge_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_name' is set + if ('edge_name' not in params or + params['edge_name'] is None): + raise ValueError("Missing the required parameter `edge_name` when calling `get_tenant_edge_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_name' in params: + query_params.append(('edgeName', params['edge_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?edgeName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Edges (getUserEdges) # noqa: E501 + + Returns a page of edges available for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Edges (getUserEdges) # noqa: E501 + + Returns a page of edges available for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_edges_support_enabled_using_get(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_edges_support_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_edges_support_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges/enabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_edges_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_edges_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_edges_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_edge_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_edge_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_root_rule_chain_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_root_rule_chain_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def sync_edge_using_post(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def sync_edge_using_post_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method sync_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `sync_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/sync/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/edge_event_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/edge_event_controller_api.py new file mode 100644 index 0000000..02e58a8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/edge_event_controller_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeEventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_edge_events_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_events_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/events{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/entities_version_control_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/entities_version_control_controller_api.py new file mode 100644 index 0000000..cd2e2ac --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/entities_version_control_controller_api.py @@ -0,0 +1,1335 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntitiesVersionControlControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def compare_entity_data_to_version_using_get(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + else: + (data) = self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + return data + + def compare_entity_data_to_version_using_get_with_http_info(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'internal_entity_uuid', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method compare_entity_data_to_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'internal_entity_uuid' is set + if ('internal_entity_uuid' not in params or + params['internal_entity_uuid'] is None): + raise ValueError("Missing the required parameter `internal_entity_uuid` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'internal_entity_uuid' in params: + path_params['internalEntityUuid'] = params['internal_entity_uuid'] # noqa: E501 + + query_params = [] + if 'version_id' in params: + query_params.append(('versionId', params['version_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/diff/{entityType}/{internalEntityUuid}{?versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataDiff', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_data_info_using_get(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes), `hasCredentials` (whether stored device data has credentials), `hasPermissions` (user group data contains group permission list) and `hasGroupEntities` (entity group data contains group entities). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :param str internal_entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + return data + + def get_entity_data_info_using_get_with_http_info(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes), `hasCredentials` (whether stored device data has credentials), `hasPermissions` (user group data contains group permission list) and `hasGroupEntities` (entity group data contains group entities). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :param str internal_entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id', 'entity_type', 'external_entity_uuid', 'internal_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_data_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `get_entity_data_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + if 'internal_entity_id' in params: + query_params.append(('internalEntityId', params['internal_entity_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/info/{versionId}/{entityType}/{externalEntityUuid}{?internalEntityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_create_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_create_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_create_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_create_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionCreationResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_load_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count; - `groupsCreated` - created entity groups count; - `groupsUpdated` - updated entity groups count; - `groupsDeleted` - removed entity groups count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5, \"groupsCreated\": 1, \"groupsUpdated\": 1, \"groupsDeleted\": 1 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8, \"groupsCreated\": 1, \"groupsUpdated\": 0, \"groupsDeleted\": 2 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_load_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count; - `groupsCreated` - created entity groups count; - `groupsUpdated` - updated entity groups count; - `groupsDeleted` - removed entity groups count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5, \"groupsCreated\": 1, \"groupsUpdated\": 1, \"groupsDeleted\": 1 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8, \"groupsCreated\": 1, \"groupsUpdated\": 0, \"groupsDeleted\": 2 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_load_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_load_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionLoadResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_all_entities_at_version_using_get(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + return data + + def list_all_entities_at_version_using_get_with_http_info(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get_with_http_info(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_all_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_all_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_branches_using_get(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def list_branches_using_get_with_http_info(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_branches_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/branches', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListBranchInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entities_at_version_using_get(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + return data + + def list_entities_at_version_using_get_with_http_info(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get_with_http_info(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entities_at_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{entityType}/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_type_versions_using_get(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_type_versions_using_get_with_http_info(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_type_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_type_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_versions_using_get(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str internal_entity_id: internalEntityId + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_versions_using_get_with_http_info(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str internal_entity_id: internalEntityId + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'external_entity_uuid', 'branch', 'page_size', 'page', 'internal_entity_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'internal_entity_id' in params: + query_params.append(('internalEntityId', params['internal_entity_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}/{externalEntityUuid}?sortProperty=timestamp{&branch,internalEntityId,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_versions_using_get(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_versions_using_get_with_http_info(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get_with_http_info(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def load_entities_version_using_post(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`), internal entity id (`internalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation); - `loadPermissions` - when loading user group, to update group permission list; - `loadGroupEntities` - when loading an entity group, to load its entities as well; - `autoGenerateIntegrationKey` - if loading integration version, to autogenerate routing key. An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def load_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`), internal entity id (`internalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation); - `loadPermissions` - when loading user group, to update group permission list; - `loadGroupEntities` - when loading an entity group, to load its entities as well; - `autoGenerateIntegrationKey` - if loading integration version, to autogenerate routing key. An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method load_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entities_version_using_post(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version; - `savePermissions` - when saving a user group - to save group permission list; - `saveGroupEntities` - when saving an entity group - to save its entities as well. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify `entityIds` - in case entity type is group entity, list of specific entity groups, or if not - list of entities; - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version; - `savePermissions` - when saving a user group - to save group permission list; - `saveGroupEntities` - when saving an entity group - to save its entities as well. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify `entityIds` - in case entity type is group entity, list of specific entity groups, or if not - list of entities; - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultuuid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/entity_group_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/entity_group_controller_api.py new file mode 100644 index 0000000..f399795 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/entity_group_controller_api.py @@ -0,0 +1,3936 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityGroupControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_entities_to_entity_group_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Add entities to the group (addEntitiesToEntityGroup) # noqa: E501 + + Add entities to the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'ADD_TO_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_entities_to_entity_group_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.add_entities_to_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.add_entities_to_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def add_entities_to_entity_group_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Add entities to the group (addEntitiesToEntityGroup) # noqa: E501 + + Add entities to the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'ADD_TO_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_entities_to_entity_group_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_entities_to_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `add_entities_to_entity_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/addEntities', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_entity_group_to_edge_using_post(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Assign entity group to edge (assignEntityGroupToEdge) # noqa: E501 + + Creates assignment of an existing entity group to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity group will be delivered to edge service, edge will request entities of this group to be send to edge. Once entities will be delivered to edge service, they are going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_group_to_edge_using_post(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_group_to_edge_using_post_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_group_to_edge_using_post_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + return data + + def assign_entity_group_to_edge_using_post_with_http_info(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Assign entity group to edge (assignEntityGroupToEdge) # noqa: E501 + + Creates assignment of an existing entity group to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity group will be delivered to edge service, edge will request entities of this group to be send to edge. Once entities will be delivered to edge service, they are going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_group_to_edge_using_post_with_http_info(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_group_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_entity_group_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `assign_entity_group_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `assign_entity_group_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityGroup/{entityGroupId}/{groupType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroup', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_group_using_delete(self, entity_group_id, **kwargs): # noqa: E501 + """Delete Entity Group (deleteEntityGroup) # noqa: E501 + + Deletes the entity group but does not delete the entities in the group, since they are also present in reserved group 'All'. Referencing non-existing Entity Group Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_group_using_delete(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_group_using_delete_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_group_using_delete_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def delete_entity_group_using_delete_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Delete Entity Group (deleteEntityGroup) # noqa: E501 + + Deletes the entity group but does not delete the entities in the group, since they are also present in reserved group 'All'. Referencing non-existing Entity Group Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_group_using_delete_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_group_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `delete_entity_group_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_edge_entity_groups_using_get(self, edge_id, group_type, **kwargs): # noqa: E501 + """Get All Edge Entity Groups by entity type (getAllEdgeEntityGroups) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_entity_groups_using_get(edge_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_edge_entity_groups_using_get_with_http_info(edge_id, group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_all_edge_entity_groups_using_get_with_http_info(edge_id, group_type, **kwargs) # noqa: E501 + return data + + def get_all_edge_entity_groups_using_get_with_http_info(self, edge_id, group_type, **kwargs): # noqa: E501 + """Get All Edge Entity Groups by entity type (getAllEdgeEntityGroups) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_entity_groups_using_get_with_http_info(edge_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_edge_entity_groups_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_all_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_all_edge_entity_groups_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/allEntityGroups/edge/{edgeId}/{groupType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_entity_groups_using_get(self, edge_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Edge Entity Groups by entity type (getEdgeEntityGroups) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_groups_using_get(edge_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_entity_groups_using_get_with_http_info(edge_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_entity_groups_using_get_with_http_info(edge_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_entity_groups_using_get_with_http_info(self, edge_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Edge Entity Groups by entity type (getEdgeEntityGroups) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_groups_using_get_with_http_info(edge_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_entity_groups_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/edge/{edgeId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entities_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get Group Entities (getEntities) # noqa: E501 + + Returns a page of Short Entity View objects that belongs to specified Entity Group Id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entities_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entities_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entities_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entities_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get Group Entities (getEntities) # noqa: E501 + + Returns a page of Short Entity View objects that belongs to specified Entity Group Id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entities_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entities_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entities_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entities_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entities_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/entities{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataShortEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_all_by_owner_and_type_using_get(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get special group All by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch reserved group 'All' based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_all_by_owner_and_type_using_get(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_all_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_all_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + return data + + def get_entity_group_all_by_owner_and_type_using_get_with_http_info(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get special group All by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch reserved group 'All' based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_all_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_all_by_owner_and_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_all_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_all_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_all_by_owner_and_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/all/{ownerType}/{ownerId}/{groupType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_by_id_using_get(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Info (getEntityGroupById) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_id_using_get(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def get_entity_group_by_id_using_get_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Info (getEntityGroupById) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_id_using_get_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_group_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_by_owner_and_name_and_type_using_get(self, owner_type, owner_id, group_type, group_name, **kwargs): # noqa: E501 + """Get Entity Group by owner, type and name (getEntityGroupByOwnerAndNameAndType) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_owner_and_name_and_type_using_get(owner_type, owner_id, group_type, group_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param str group_name: Entity Group name (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(owner_type, owner_id, group_type, group_name, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(owner_type, owner_id, group_type, group_name, **kwargs) # noqa: E501 + return data + + def get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(self, owner_type, owner_id, group_type, group_name, **kwargs): # noqa: E501 + """Get Entity Group by owner, type and name (getEntityGroupByOwnerAndNameAndType) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(owner_type, owner_id, group_type, group_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param str group_name: Entity Group name (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'group_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_by_owner_and_name_and_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_name' is set + if ('group_name' not in params or + params['group_name'] is None): + raise ValueError("Missing the required parameter `group_name` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + if 'group_name' in params: + path_params['groupName'] = params['group_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{ownerType}/{ownerId}/{groupType}/{groupName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_info_by_id_using_get(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Entity Info (getEntityGroupEntityInfoById) # noqa: E501 + + Fetch the Entity Group Entity Info object based on the provided Entity Group Id. Entity Info is a lightweight object that contains only id and name of the entity group. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_info_by_id_using_get(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_info_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_info_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_info_by_id_using_get_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Entity Info (getEntityGroupEntityInfoById) # noqa: E501 + + Fetch the Entity Group Entity Info object based on the provided Entity Group Id. Entity Info is a lightweight object that contains only id and name of the entity group. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_info_by_id_using_get_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_group_entity_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfo/{entityGroupId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_by_ids_using_get(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by Ids (getEntityGroupEntityInfosByIds) # noqa: E501 + + Fetch the list of Entity Group Entity Info objects based on the provided entity group ids list. Entity Info is a lightweight object that contains only id and name of the entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_ids_using_get(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_by_ids_using_get_with_http_info(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by Ids (getEntityGroupEntityInfosByIds) # noqa: E501 + + Fetch the list of Entity Group Entity Info objects based on the provided entity group ids list. Entity Info is a lightweight object that contains only id and name of the entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_ids_using_get_with_http_info(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_ids' is set + if ('entity_group_ids' not in params or + params['entity_group_ids'] is None): + raise ValueError("Missing the required parameter `entity_group_ids` when calling `get_entity_group_entity_infos_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos{?entityGroupIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by owner and entity type and page link (getEntityGroupEntityInfosByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by owner and entity type and page link (getEntityGroupEntityInfosByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by entity type and page link (getEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by entity type and page link (getEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'include_shared', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'include_shared' in params: + query_params.append(('includeShared', params['include_shared'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos/{groupType}{?includeShared,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos for all owners starting from specified than ending with owner of current user (getEntityGroupEntityInfosHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos for all owners starting from specified than ending with owner of current user (getEntityGroupEntityInfosHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfosHierarchy/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_ids_using_get(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Groups by Ids (getEntityGroupsByIds) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided entity group ids list. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_ids_using_get(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_ids_using_get_with_http_info(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Groups by Ids (getEntityGroupsByIds) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided entity group ids list. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_ids_using_get_with_http_info(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_ids' is set + if ('entity_group_ids' not in params or + params['entity_group_ids'] is None): + raise ValueError("Missing the required parameter `entity_group_ids` when calling `get_entity_groups_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups{?entityGroupIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type and page link (getEntityGroupsByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type and page link (getEntityGroupsByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_owner_and_type_using_get(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_using_get(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_owner_and_type_using_get_with_http_info(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_owner_and_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_groups_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_groups_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_owner_and_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{ownerType}/{ownerId}/{groupType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by entity type and page link (getEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by entity type and page link (getEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'include_shared', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'include_shared' in params: + query_params.append(('includeShared', params['include_shared'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}{?includeShared,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_type_using_get(self, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by entity type (getEntityGroupsByType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_using_get(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param bool include_shared: Whether to include shared entity groups. + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_type_using_get_with_http_info(self, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by entity type (getEntityGroupsByType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_using_get_with_http_info(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param bool include_shared: Whether to include shared entity groups. + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'include_shared'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'include_shared' in params: + query_params.append(('includeShared', params['include_shared'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}{?includeShared}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_for_entity_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Entity Groups by Entity Id (getEntityGroupsForEntity) # noqa: E501 + + Returns a list of groups that contain the specified Entity Id. For example, all device groups that contain specific device. The list always contain at least one element - special group 'All'.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_for_entity_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: Entity Group type (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[EntityGroupId] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_for_entity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_for_entity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_entity_groups_for_entity_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Entity Groups by Entity Id (getEntityGroupsForEntity) # noqa: E501 + + Returns a list of groups that contain the specified Entity Id. For example, all device groups that contain specific device. The list always contain at least one element - special group 'All'.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_for_entity_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: Entity Group type (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[EntityGroupId] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_for_entity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_entity_groups_for_entity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_entity_groups_for_entity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{entityType}/{entityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupId]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups for all owners starting from specified than ending with owner of current user (getEntityGroupsHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups for all owners starting from specified than ending with owner of current user (getEntityGroupsHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupsHierarchy/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_entity_using_get(self, entity_group_id, entity_id, **kwargs): # noqa: E501 + """Get Group Entity (getGroupEntity) # noqa: E501 + + Fetch the Short Entity View object based on the group and entity id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_entity_using_get(entity_group_id, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: ShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_entity_using_get_with_http_info(entity_group_id, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_group_entity_using_get_with_http_info(entity_group_id, entity_id, **kwargs) # noqa: E501 + return data + + def get_group_entity_using_get_with_http_info(self, entity_group_id, entity_id, **kwargs): # noqa: E501 + """Get Group Entity (getGroupEntity) # noqa: E501 + + Fetch the Short Entity View object based on the group and entity id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_entity_using_get_with_http_info(entity_group_id, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: ShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_entity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_group_entity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_group_entity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/{entityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ShortEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_owner_info_using_get(self, owner_type, owner_id, **kwargs): # noqa: E501 + """Get Owner Info (getOwnerInfo) # noqa: E501 + + Fetch the owner info (tenant or customer) presented as Entity Info object based on the provided owner Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_info_using_get(owner_type, owner_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_owner_info_using_get_with_http_info(owner_type, owner_id, **kwargs) # noqa: E501 + else: + (data) = self.get_owner_info_using_get_with_http_info(owner_type, owner_id, **kwargs) # noqa: E501 + return data + + def get_owner_info_using_get_with_http_info(self, owner_type, owner_id, **kwargs): # noqa: E501 + """Get Owner Info (getOwnerInfo) # noqa: E501 + + Fetch the owner info (tenant or customer) presented as Entity Info object based on the provided owner Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_info_using_get_with_http_info(owner_type, owner_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_owner_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_owner_info_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_owner_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ownerInfo/{ownerType}/{ownerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_owner_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Owner Infos (getOwnerInfos) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_owner_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_owner_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_owner_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Owner Infos (getOwnerInfos) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_owner_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_owner_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_owner_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ownerInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_owners_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Owners (getOwners) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owners_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataContactBasedobject + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_owners_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_owners_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_owners_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Owners (getOwners) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owners_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataContactBasedobject + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_owners_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_owners_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_owners_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/owners{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataContactBasedobject', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_shared_entity_group_entity_infos_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Group Entity Infos by entity type and page link (getSharedEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Group Entity Infos by entity type and page link (getSharedEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_entity_group_entity_infos_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_shared_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_shared_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_shared_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos/{groupType}/shared{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_shared_entity_groups_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type and page link (getSharedEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type and page link (getSharedEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_entity_groups_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_shared_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_shared_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_shared_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}/shared{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_shared_entity_groups_by_type_using_get(self, group_type, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type (getSharedEntityGroupsByType) # noqa: E501 + + Fetch the list of Shared Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_using_get(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_shared_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_shared_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + return data + + def get_shared_entity_groups_by_type_using_get_with_http_info(self, group_type, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type (getSharedEntityGroupsByType) # noqa: E501 + + Fetch the list of Shared Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_using_get_with_http_info(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_entity_groups_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_shared_entity_groups_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}/shared', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def make_entity_group_private_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Private (makeEntityGroupPrivate) # noqa: E501 + + Make the entity group not available for non authorized users. Every group is private by default. This call is useful to hide the group that was previously made public. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_private_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.make_entity_group_private_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.make_entity_group_private_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def make_entity_group_private_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Private (makeEntityGroupPrivate) # noqa: E501 + + Make the entity group not available for non authorized users. Every group is private by default. This call is useful to hide the group that was previously made public. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_private_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method make_entity_group_private_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `make_entity_group_private_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/makePrivate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def make_entity_group_public_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Publicly available (makeEntityGroupPublic) # noqa: E501 + + Make the entity group available for non authorized users. Useful for public dashboards that will be embedded into the public websites. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_public_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.make_entity_group_public_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.make_entity_group_public_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def make_entity_group_public_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Publicly available (makeEntityGroupPublic) # noqa: E501 + + Make the entity group available for non authorized users. Useful for public dashboards that will be embedded into the public websites. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_public_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method make_entity_group_public_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `make_entity_group_public_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/makePublic', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_entities_from_entity_group_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Remove entities from the group (removeEntitiesFromEntityGroup) # noqa: E501 + + Removes entities from the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'REMOVE_FROM_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_entities_from_entity_group_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.remove_entities_from_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.remove_entities_from_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def remove_entities_from_entity_group_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Remove entities from the group (removeEntitiesFromEntityGroup) # noqa: E501 + + Removes entities from the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'REMOVE_FROM_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_entities_from_entity_group_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_entities_from_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `remove_entities_from_entity_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/deleteEntities', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_group_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Entity Group (saveEntityGroup) # noqa: E501 + + Create or update the Entity Group. When creating Entity Group, platform generates Entity Group Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Entity Group Id will be present in the response. Specify existing Entity Group Id to update the group. Referencing non-existing Entity Group Id will cause 'Not Found' error.Remove 'id', 'tenantId' and optionally 'ownerId' from the request body example (below) to create new Entity Group entity. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_group_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityGroup body: + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_group_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entity_group_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entity_group_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Entity Group (saveEntityGroup) # noqa: E501 + + Create or update the Entity Group. When creating Entity Group, platform generates Entity Group Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Entity Group Id will be present in the response. Specify existing Entity Group Id to update the group. Referencing non-existing Entity Group Id will cause 'Not Found' error.Remove 'id', 'tenantId' and optionally 'ownerId' from the request body example (below) to create new Entity Group entity. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_group_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityGroup body: + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def share_entity_group_to_child_owner_user_group_using_post(self, entity_group_id, user_group_id, role_id, **kwargs): # noqa: E501 + """Share the Entity Group with User group (shareEntityGroupToChildOwnerUserGroup) # noqa: E501 + + Share the entity group with specified user group using specified role. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_to_child_owner_user_group_using_post(entity_group_id, user_group_id, role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id that you would like to share. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str user_group_id: A string value representing the Entity(User) Group Id that you would like to share with. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str role_id: A string value representing the Role Id that describes set of permissions you would like to share (read, write, etc). For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.share_entity_group_to_child_owner_user_group_using_post_with_http_info(entity_group_id, user_group_id, role_id, **kwargs) # noqa: E501 + else: + (data) = self.share_entity_group_to_child_owner_user_group_using_post_with_http_info(entity_group_id, user_group_id, role_id, **kwargs) # noqa: E501 + return data + + def share_entity_group_to_child_owner_user_group_using_post_with_http_info(self, entity_group_id, user_group_id, role_id, **kwargs): # noqa: E501 + """Share the Entity Group with User group (shareEntityGroupToChildOwnerUserGroup) # noqa: E501 + + Share the entity group with specified user group using specified role. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_to_child_owner_user_group_using_post_with_http_info(entity_group_id, user_group_id, role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id that you would like to share. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str user_group_id: A string value representing the Entity(User) Group Id that you would like to share with. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str role_id: A string value representing the Role Id that describes set of permissions you would like to share (read, write, etc). For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'user_group_id', 'role_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method share_entity_group_to_child_owner_user_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `share_entity_group_to_child_owner_user_group_using_post`") # noqa: E501 + # verify the required parameter 'user_group_id' is set + if ('user_group_id' not in params or + params['user_group_id'] is None): + raise ValueError("Missing the required parameter `user_group_id` when calling `share_entity_group_to_child_owner_user_group_using_post`") # noqa: E501 + # verify the required parameter 'role_id' is set + if ('role_id' not in params or + params['role_id'] is None): + raise ValueError("Missing the required parameter `role_id` when calling `share_entity_group_to_child_owner_user_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + if 'user_group_id' in params: + path_params['userGroupId'] = params['user_group_id'] # noqa: E501 + if 'role_id' in params: + path_params['roleId'] = params['role_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/{userGroupId}/{roleId}/share', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def share_entity_group_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Share the Entity Group (shareEntityGroup) # noqa: E501 + + Share the entity group with certain user group based on the provided Share Group Request. The request is quite flexible and processing of the request involves multiple security checks using platform RBAC feature. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param ShareGroupRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.share_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.share_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def share_entity_group_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Share the Entity Group (shareEntityGroup) # noqa: E501 + + Share the entity group with certain user group based on the provided Share Group Request. The request is quite flexible and processing of the request involves multiple security checks using platform RBAC feature. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param ShareGroupRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method share_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `share_entity_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/share', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_entity_group_from_edge_using_delete(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Unassign entity group from edge (unassignEntityGroupFromEdge) # noqa: E501 + + Clears assignment of the entity group to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_group_from_edge_using_delete(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_entity_group_from_edge_using_delete_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_entity_group_from_edge_using_delete_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + return data + + def unassign_entity_group_from_edge_using_delete_with_http_info(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Unassign entity group from edge (unassignEntityGroupFromEdge) # noqa: E501 + + Clears assignment of the entity group to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_group_from_edge_using_delete_with_http_info(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_entity_group_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_entity_group_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `unassign_entity_group_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `unassign_entity_group_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityGroup/{entityGroupId}/{groupType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroup', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/entity_query_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/entity_query_controller_api.py new file mode 100644 index 0000000..52f62b2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/entity_query_controller_api.py @@ -0,0 +1,538 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityQueryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def count_alarms_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_alarms_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_alarms_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_entities_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_entities_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_entities_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_alarm_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_alarm_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_alarm_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_entity_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_timeseries_and_attributes_keys_by_query_using_post(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + else: + (data) = self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + return data + + def find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['timeseries', 'attributes', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_timeseries_and_attributes_keys_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'timeseries' is set + if ('timeseries' not in params or + params['timeseries'] is None): + raise ValueError("Missing the required parameter `timeseries` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + # verify the required parameter 'attributes' is set + if ('attributes' not in params or + params['attributes'] is None): + raise ValueError("Missing the required parameter `attributes` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'timeseries' in params: + query_params.append(('timeseries', params['timeseries'])) # noqa: E501 + if 'attributes' in params: + query_params.append(('attributes', params['attributes'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find/keys{?attributes,timeseries}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/entity_relation_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/entity_relation_controller_api.py new file mode 100644 index 0000000..761a99e --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/entity_relation_controller_api.py @@ -0,0 +1,1355 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityRelationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_relation_using_delete(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def delete_relation_using_delete_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relation_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `delete_relation_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_relations_using_delete(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + return data + + def delete_relations_using_delete_with_http_info(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete_with_http_info(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_id', 'entity_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relations_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_relations_using_delete`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_relations_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_id' in params: + query_params.append(('entityId', params['entity_id'])) # noqa: E501 + if 'entity_type' in params: + query_params.append(('entityType', params['entity_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?entityId,entityType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get_with_http_info(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get1(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get1_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get1`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post3(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post3_with_http_info(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post3" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get_with_http_info(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get1(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get1_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get1`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_from_using_get(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_info_by_from_using_get_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_info_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_info_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_info_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_to_using_get(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_info_by_to_using_get_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_info_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_info_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_relation_using_get(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def get_relation_using_get_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_relation_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `get_relation_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityRelation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_relation_using_post(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_relation_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_relation_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/entity_view_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/entity_view_controller_api.py new file mode 100644 index 0000000..3a516b9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/entity_view_controller_api.py @@ -0,0 +1,1549 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityViewControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_entity_view_using_delete(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def delete_entity_view_using_delete_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_view_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `delete_entity_view_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post4(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post4_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post4" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViews', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityView]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_entity_view_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Entity View Infos for current user (getAllEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the tenant or the customer of a current user. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_entity_view_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_entity_view_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Entity View Infos for current user (getAllEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the tenant or the customer of a current user. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_entity_view_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViewInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_view_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View Infos (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the specified customer. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_view_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View Infos (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the specified customer. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViewInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_views_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_views_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_info_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided entity view id. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_info_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided entity view id. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/info/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_types_using_get(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_entity_view_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_views_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get entity views by Entity Group Id (getEntityViewsByEntityGroupId) # noqa: E501 + + Returns a page of Entity View objects that belongs to specified Entity View Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_views_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_views_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_views_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get entity views by Entity Group Id (getEntityViewsByEntityGroupId) # noqa: E501 + + Returns a page of Entity View objects that belongs to specified Entity View Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_views_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_views_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_views_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_views_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_views_by_ids_using_get(self, entity_view_ids, **kwargs): # noqa: E501 + """Get Entity Views By Ids (getEntityViewsByIds) # noqa: E501 + + Requested entity views must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_ids_using_get(entity_view_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_ids: A list of entity view ids, separated by comma ',' (required) + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_views_by_ids_using_get_with_http_info(entity_view_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_views_by_ids_using_get_with_http_info(entity_view_ids, **kwargs) # noqa: E501 + return data + + def get_entity_views_by_ids_using_get_with_http_info(self, entity_view_ids, **kwargs): # noqa: E501 + """Get Entity Views By Ids (getEntityViewsByIds) # noqa: E501 + + Requested entity views must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_ids_using_get_with_http_info(entity_view_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_ids: A list of entity view ids, separated by comma ',' (required) + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_views_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_ids' is set + if ('entity_view_ids' not in params or + params['entity_view_ids'] is None): + raise ValueError("Missing the required parameter `entity_view_ids` when calling `get_entity_views_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_view_ids' in params: + query_params.append(('entityViewIds', params['entity_view_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViews{?entityViewIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityView]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_view_using_get(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_view_using_get_with_http_info(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get_with_http_info(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_view_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_name' is set + if ('entity_view_name' not in params or + params['entity_view_name'] is None): + raise ValueError("Missing the required parameter `entity_view_name` when calling `get_tenant_entity_view_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_view_name' in params: + query_params.append(('entityViewName', params['entity_view_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?entityViewName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_views_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_views_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_entity_views_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Entity Views (getUserEntityViews) # noqa: E501 + + Returns a page of entity views that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_entity_views_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_entity_views_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Entity Views (getUserEntityViews) # noqa: E501 + + Returns a page of entity views that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_entity_views_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_view_using_post(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entity_view_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_view_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/event_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/event_controller_api.py new file mode 100644 index 0000000..3ca1aa8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/event_controller_api.py @@ -0,0 +1,623 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def clear_events_using_post(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def clear_events_using_post_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'body', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `clear_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `clear_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/clear{?endTime,startTime}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get_with_http_info(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get1(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get1_with_http_info(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'event_type', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'event_type' is set + if ('event_type' not in params or + params['event_type'] is None): + raise ValueError("Missing the required parameter `event_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'event_type' in params: + path_params['eventType'] = params['event_type'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/{eventType}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_post(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_events_using_post_with_http_info(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'entity_type', 'entity_id', 'body', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/group_permission_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/group_permission_controller_api.py new file mode 100644 index 0000000..1f1c1e9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/group_permission_controller_api.py @@ -0,0 +1,720 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class GroupPermissionControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_group_permission_using_delete(self, group_permission_id, **kwargs): # noqa: E501 + """Delete group permission (deleteGroupPermission) # noqa: E501 + + Deletes the group permission. Referencing non-existing group permission Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_group_permission_using_delete(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_group_permission_using_delete_with_http_info(group_permission_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_group_permission_using_delete_with_http_info(group_permission_id, **kwargs) # noqa: E501 + return data + + def delete_group_permission_using_delete_with_http_info(self, group_permission_id, **kwargs): # noqa: E501 + """Delete group permission (deleteGroupPermission) # noqa: E501 + + Deletes the group permission. Referencing non-existing group permission Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_group_permission_using_delete_with_http_info(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_permission_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_group_permission_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_permission_id' is set + if ('group_permission_id' not in params or + params['group_permission_id'] is None): + raise ValueError("Missing the required parameter `group_permission_id` when calling `delete_group_permission_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_permission_id' in params: + path_params['groupPermissionId'] = params['group_permission_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission/{groupPermissionId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_permissions_using_get(self, entity_group_id, **kwargs): # noqa: E501 + """Get group permissions by Entity Group Id (getEntityGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that is assigned for the specified Entity Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_permissions_using_get(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_permissions_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_permissions_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def get_entity_group_permissions_using_get_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Get group permissions by Entity Group Id (getEntityGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that is assigned for the specified Entity Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_permissions_using_get_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_permissions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_group_permissions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/groupPermissions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[GroupPermissionInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_permission_by_id_using_get(self, group_permission_id, **kwargs): # noqa: E501 + """Get Group Permission (getGroupPermissionById) # noqa: E501 + + Fetch the Group Permission object based on the provided Group Permission Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_by_id_using_get(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_permission_by_id_using_get_with_http_info(group_permission_id, **kwargs) # noqa: E501 + else: + (data) = self.get_group_permission_by_id_using_get_with_http_info(group_permission_id, **kwargs) # noqa: E501 + return data + + def get_group_permission_by_id_using_get_with_http_info(self, group_permission_id, **kwargs): # noqa: E501 + """Get Group Permission (getGroupPermissionById) # noqa: E501 + + Fetch the Group Permission object based on the provided Group Permission Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_by_id_using_get_with_http_info(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_permission_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_permission_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_permission_id' is set + if ('group_permission_id' not in params or + params['group_permission_id'] is None): + raise ValueError("Missing the required parameter `group_permission_id` when calling `get_group_permission_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_permission_id' in params: + path_params['groupPermissionId'] = params['group_permission_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission/{groupPermissionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GroupPermission', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_permission_info_by_id_using_get(self, group_permission_id, is_user_group, **kwargs): # noqa: E501 + """Get Group Permission Info (getGroupPermissionInfoById) # noqa: E501 + + Fetch the Group Permission Info object based on the provided Group Permission Id and the flag that controls what additional information to load: User or Entity Group. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_info_by_id_using_get(group_permission_id, is_user_group, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool is_user_group: Load additional information about User('true') or Entity Group('false). (required) + :return: GroupPermissionInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_permission_info_by_id_using_get_with_http_info(group_permission_id, is_user_group, **kwargs) # noqa: E501 + else: + (data) = self.get_group_permission_info_by_id_using_get_with_http_info(group_permission_id, is_user_group, **kwargs) # noqa: E501 + return data + + def get_group_permission_info_by_id_using_get_with_http_info(self, group_permission_id, is_user_group, **kwargs): # noqa: E501 + """Get Group Permission Info (getGroupPermissionInfoById) # noqa: E501 + + Fetch the Group Permission Info object based on the provided Group Permission Id and the flag that controls what additional information to load: User or Entity Group. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_info_by_id_using_get_with_http_info(group_permission_id, is_user_group, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool is_user_group: Load additional information about User('true') or Entity Group('false). (required) + :return: GroupPermissionInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_permission_id', 'is_user_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_permission_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_permission_id' is set + if ('group_permission_id' not in params or + params['group_permission_id'] is None): + raise ValueError("Missing the required parameter `group_permission_id` when calling `get_group_permission_info_by_id_using_get`") # noqa: E501 + # verify the required parameter 'is_user_group' is set + if ('is_user_group' not in params or + params['is_user_group'] is None): + raise ValueError("Missing the required parameter `is_user_group` when calling `get_group_permission_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_permission_id' in params: + path_params['groupPermissionId'] = params['group_permission_id'] # noqa: E501 + + query_params = [] + if 'is_user_group' in params: + query_params.append(('isUserGroup', params['is_user_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission/info/{groupPermissionId}{?isUserGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GroupPermissionInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_group_permissions_using_get(self, user_group_id, **kwargs): # noqa: E501 + """Get group permissions by User Group Id (getUserGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that belongs to specified User Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_group_permissions_using_get(user_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_group_permissions_using_get_with_http_info(user_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_group_permissions_using_get_with_http_info(user_group_id, **kwargs) # noqa: E501 + return data + + def get_user_group_permissions_using_get_with_http_info(self, user_group_id, **kwargs): # noqa: E501 + """Get group permissions by User Group Id (getUserGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that belongs to specified User Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_group_permissions_using_get_with_http_info(user_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_group_permissions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_group_id' is set + if ('user_group_id' not in params or + params['user_group_id'] is None): + raise ValueError("Missing the required parameter `user_group_id` when calling `get_user_group_permissions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_group_id' in params: + path_params['userGroupId'] = params['user_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/userGroup/{userGroupId}/groupPermissions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[GroupPermissionInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def load_user_group_permission_infos_using_post(self, **kwargs): # noqa: E501 + """Load User Group Permissions (loadUserGroupPermissionInfos) # noqa: E501 + + Enrich a list of group permission objects with the information about Role, User and Entity Groups. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_user_group_permission_infos_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[GroupPermission] body: + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.load_user_group_permission_infos_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.load_user_group_permission_infos_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def load_user_group_permission_infos_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Load User Group Permissions (loadUserGroupPermissionInfos) # noqa: E501 + + Enrich a list of group permission objects with the information about Role, User and Entity Groups. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_user_group_permission_infos_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[GroupPermission] body: + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method load_user_group_permission_infos_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/userGroup/groupPermissions/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[GroupPermissionInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_group_permission_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Group Permission (saveGroupPermission) # noqa: E501 + + Creates or Updates the Group Permission. When creating group permission, platform generates Group Permission Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Group Permission id will be present in the response. Specify existing Group Permission id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_group_permission_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param GroupPermission body: + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_group_permission_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_group_permission_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_group_permission_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Group Permission (saveGroupPermission) # noqa: E501 + + Creates or Updates the Group Permission. When creating group permission, platform generates Group Permission Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Group Permission id will be present in the response. Specify existing Group Permission id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_group_permission_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param GroupPermission body: + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_group_permission_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GroupPermission', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/http_integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/http_integration_controller_api.py new file mode 100644 index 0000000..d2b3b15 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/http_integration_controller_api.py @@ -0,0 +1,358 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class HttpIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_status_using_get(self, routing_key, request_params, request_headers, **kwargs): # noqa: E501 + """checkStatus # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_status_using_get(routing_key, request_params, request_headers, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param Object request_params: requestParams (required) + :param Object request_headers: requestHeaders (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_status_using_get_with_http_info(routing_key, request_params, request_headers, **kwargs) # noqa: E501 + else: + (data) = self.check_status_using_get_with_http_info(routing_key, request_params, request_headers, **kwargs) # noqa: E501 + return data + + def check_status_using_get_with_http_info(self, routing_key, request_params, request_headers, **kwargs): # noqa: E501 + """checkStatus # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_status_using_get_with_http_info(routing_key, request_params, request_headers, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param Object request_params: requestParams (required) + :param Object request_headers: requestHeaders (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key', 'request_params', 'request_headers'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `check_status_using_get`") # noqa: E501 + # verify the required parameter 'request_params' is set + if ('request_params' not in params or + params['request_params'] is None): + raise ValueError("Missing the required parameter `request_params` when calling `check_status_using_get`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `check_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'request_params' in params: + query_params.append(('requestParams', params['request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/http/{routingKey}{?requestParams}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post1(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post1(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post1_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post1_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + return data + + def process_request_using_post1_with_http_info(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post1_with_http_info(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key', 'suffix'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post1`") # noqa: E501 + # verify the required parameter 'suffix' is set + if ('suffix' not in params or + params['suffix'] is None): + raise ValueError("Missing the required parameter `suffix` when calling `process_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + if 'suffix' in params: + path_params['suffix'] = params['suffix'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/http/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post2(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post2(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post2_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post2_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + return data + + def process_request_using_post2_with_http_info(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post2_with_http_info(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key', 'suffix'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post2`") # noqa: E501 + # verify the required parameter 'suffix' is set + if ('suffix' not in params or + params['suffix'] is None): + raise ValueError("Missing the required parameter `suffix` when calling `process_request_using_post2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + if 'suffix' in params: + path_params['suffix'] = params['suffix'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/http/{routingKey}/{suffix}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/integration_controller_api.py new file mode 100644 index 0000000..26a6dae --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/integration_controller_api.py @@ -0,0 +1,1505 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class IntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_integration_to_edge_using_post(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Assign integration to edge (assignIntegrationToEdge) # noqa: E501 + + Creates assignment of an existing integration edge template to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once integration will be delivered to edge service, it's going to start locally. Only integration edge template can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_integration_to_edge_using_post(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_integration_to_edge_using_post_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_integration_to_edge_using_post_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + return data + + def assign_integration_to_edge_using_post_with_http_info(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Assign integration to edge (assignIntegrationToEdge) # noqa: E501 + + Creates assignment of an existing integration edge template to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once integration will be delivered to edge service, it's going to start locally. Only integration edge template can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_integration_to_edge_using_post_with_http_info(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_integration_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_integration_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `assign_integration_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integration/{integrationId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_integration_connection_using_post(self, **kwargs): # noqa: E501 + """Check integration connectivity (checkIntegrationConnection) # noqa: E501 + + Checks if the connection to the integration is established. Throws an error if the connection is not established. Example: Failed to connect to MQTT broker at host:port. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_integration_connection_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_integration_connection_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_integration_connection_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_integration_connection_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check integration connectivity (checkIntegrationConnection) # noqa: E501 + + Checks if the connection to the integration is established. Throws an error if the connection is not established. Example: Failed to connect to MQTT broker at host:port. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_integration_connection_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_integration_connection_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/check', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_integration_using_delete(self, integration_id, **kwargs): # noqa: E501 + """Delete integration (deleteIntegration) # noqa: E501 + + Deletes the integration and all the relations (from and to the integration). Referencing non-existing integration Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_integration_using_delete(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_integration_using_delete_with_http_info(integration_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_integration_using_delete_with_http_info(integration_id, **kwargs) # noqa: E501 + return data + + def delete_integration_using_delete_with_http_info(self, integration_id, **kwargs): # noqa: E501 + """Delete integration (deleteIntegration) # noqa: E501 + + Deletes the integration and all the relations (from and to the integration). Referencing non-existing integration Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_integration_using_delete_with_http_info(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_integration_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `delete_integration_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/{integrationId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_all_related_edges_missing_attributes_using_get(self, integration_id, **kwargs): # noqa: E501 + """Find missing attributes for all related edges (findAllRelatedEdgesMissingAttributes) # noqa: E501 + + Returns list of attribute names of all related edges that are missing in the integration configuration. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_all_related_edges_missing_attributes_using_get(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_all_related_edges_missing_attributes_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + else: + (data) = self.find_all_related_edges_missing_attributes_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + return data + + def find_all_related_edges_missing_attributes_using_get_with_http_info(self, integration_id, **kwargs): # noqa: E501 + """Find missing attributes for all related edges (findAllRelatedEdgesMissingAttributes) # noqa: E501 + + Returns list of attribute names of all related edges that are missing in the integration configuration. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_all_related_edges_missing_attributes_using_get_with_http_info(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_all_related_edges_missing_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `find_all_related_edges_missing_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/integration/{integrationId}/allMissingAttributes', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_edge_missing_attributes_using_get(self, edge_id, integration_ids, **kwargs): # noqa: E501 + """Find edge missing attributes for assigned integrations (findEdgeMissingAttributes) # noqa: E501 + + Returns list of edge attribute names that are missing in assigned integrations. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_edge_missing_attributes_using_get(edge_id, integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str integration_ids: A list of assigned integration ids, separated by comma ',' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_edge_missing_attributes_using_get_with_http_info(edge_id, integration_ids, **kwargs) # noqa: E501 + else: + (data) = self.find_edge_missing_attributes_using_get_with_http_info(edge_id, integration_ids, **kwargs) # noqa: E501 + return data + + def find_edge_missing_attributes_using_get_with_http_info(self, edge_id, integration_ids, **kwargs): # noqa: E501 + """Find edge missing attributes for assigned integrations (findEdgeMissingAttributes) # noqa: E501 + + Returns list of edge attribute names that are missing in assigned integrations. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_edge_missing_attributes_using_get_with_http_info(edge_id, integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str integration_ids: A list of assigned integration ids, separated by comma ',' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'integration_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_edge_missing_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `find_edge_missing_attributes_using_get`") # noqa: E501 + # verify the required parameter 'integration_ids' is set + if ('integration_ids' not in params or + params['integration_ids'] is None): + raise ValueError("Missing the required parameter `integration_ids` when calling `find_edge_missing_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'integration_ids' in params: + query_params.append(('integrationIds', params['integration_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/integration/{edgeId}/missingAttributes{?integrationIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_integration_infos_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrationInfos) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integration_infos_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_integration_infos_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_integration_infos_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_integration_infos_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrationInfos) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integration_infos_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_integration_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_integration_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_integration_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_integration_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integrationInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegrationInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_integrations_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrations) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integrations_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_integrations_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_integrations_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_integrations_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrations) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integrations_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_integrations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_integrations_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_integrations_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_integrations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integrations{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integration_by_id_using_get(self, integration_id, **kwargs): # noqa: E501 + """Get Integration (getIntegrationById) # noqa: E501 + + Fetch the Integration object based on the provided Integration Id. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_id_using_get(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integration_by_id_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + else: + (data) = self.get_integration_by_id_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + return data + + def get_integration_by_id_using_get_with_http_info(self, integration_id, **kwargs): # noqa: E501 + """Get Integration (getIntegrationById) # noqa: E501 + + Fetch the Integration object based on the provided Integration Id. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_id_using_get_with_http_info(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integration_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `get_integration_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/{integrationId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integration_by_routing_key_using_get(self, routing_key, **kwargs): # noqa: E501 + """Get Integration by Routing Key (getIntegrationByRoutingKey) # noqa: E501 + + Fetch the Integration object based on the provided routing key. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_routing_key_using_get(routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: A string value representing the integration routing key. For example, '542047e6-c1b2-112e-a87e-e49247c09d4b' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integration_by_routing_key_using_get_with_http_info(routing_key, **kwargs) # noqa: E501 + else: + (data) = self.get_integration_by_routing_key_using_get_with_http_info(routing_key, **kwargs) # noqa: E501 + return data + + def get_integration_by_routing_key_using_get_with_http_info(self, routing_key, **kwargs): # noqa: E501 + """Get Integration by Routing Key (getIntegrationByRoutingKey) # noqa: E501 + + Fetch the Integration object based on the provided routing key. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_routing_key_using_get_with_http_info(routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: A string value representing the integration routing key. For example, '542047e6-c1b2-112e-a87e-e49247c09d4b' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integration_by_routing_key_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `get_integration_by_routing_key_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/routingKey/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integration_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Integration Infos (getIntegrationInfos) # noqa: E501 + + Returns a page of integration infos owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integration_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_integration_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_integration_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Integration Infos (getIntegrationInfos) # noqa: E501 + + Returns a page of integration infos owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'is_edge_template', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integration_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_integration_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_integration_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_edge_template' in params: + query_params.append(('isEdgeTemplate', params['is_edge_template'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integrationInfos{?isEdgeTemplate,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegrationInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integrations_by_ids_using_get(self, integration_ids, **kwargs): # noqa: E501 + """Get Integrations By Ids (getIntegrationsByIds) # noqa: E501 + + Requested integrations must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_by_ids_using_get(integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_ids: A list of integration ids, separated by comma ',' (required) + :return: list[Integration] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integrations_by_ids_using_get_with_http_info(integration_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_integrations_by_ids_using_get_with_http_info(integration_ids, **kwargs) # noqa: E501 + return data + + def get_integrations_by_ids_using_get_with_http_info(self, integration_ids, **kwargs): # noqa: E501 + """Get Integrations By Ids (getIntegrationsByIds) # noqa: E501 + + Requested integrations must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_by_ids_using_get_with_http_info(integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_ids: A list of integration ids, separated by comma ',' (required) + :return: list[Integration] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integrations_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_ids' is set + if ('integration_ids' not in params or + params['integration_ids'] is None): + raise ValueError("Missing the required parameter `integration_ids` when calling `get_integrations_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'integration_ids' in params: + query_params.append(('integrationIds', params['integration_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integrations{?integrationIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Integration]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integrations_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Integrations (getIntegrations) # noqa: E501 + + Returns a page of integrations owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integrations_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_integrations_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_integrations_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Integrations (getIntegrations) # noqa: E501 + + Returns a page of integrations owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'is_edge_template', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integrations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_integrations_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_integrations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_edge_template' in params: + query_params.append(('isEdgeTemplate', params['is_edge_template'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integrations{?isEdgeTemplate,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_integration_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Integration (saveIntegration) # noqa: E501 + + Create or update the Integration. When creating integration, platform generates Integration Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created integration id will be present in the response. Specify existing Integration id to update the integration. Referencing non-existing integration Id will cause 'Not Found' error. Integration configuration is validated for each type of the integration before it can be created. # Integration Configuration Integration configuration (**'configuration'** field) is the JSON object representing the special configuration per integration type with the connectivity fields and other important parameters dependent on the specific integration type. Let's review the configuration object for the MQTT Integration type below. ```json { \"clientConfiguration\":{ \"host\":\"broker.hivemq.com\", \"port\":1883, \"cleanSession\":false, \"ssl\":false, \"connectTimeoutSec\":10, \"clientId\":\"\", \"maxBytesInMessage\":32368, \"credentials\":{ \"type\":\"anonymous\" } }, \"downlinkTopicPattern\":\"${topic}\", \"topicFilters\":[ { \"filter\":\"tb/mqtt-integration-tutorial/sensors/+/temperature\", \"qos\":0 } ], \"metadata\":{ } } ``` Remove 'id', 'tenantId' from the request body example (below) to create new Integration entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_integration_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_integration_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_integration_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_integration_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Integration (saveIntegration) # noqa: E501 + + Create or update the Integration. When creating integration, platform generates Integration Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created integration id will be present in the response. Specify existing Integration id to update the integration. Referencing non-existing integration Id will cause 'Not Found' error. Integration configuration is validated for each type of the integration before it can be created. # Integration Configuration Integration configuration (**'configuration'** field) is the JSON object representing the special configuration per integration type with the connectivity fields and other important parameters dependent on the specific integration type. Let's review the configuration object for the MQTT Integration type below. ```json { \"clientConfiguration\":{ \"host\":\"broker.hivemq.com\", \"port\":1883, \"cleanSession\":false, \"ssl\":false, \"connectTimeoutSec\":10, \"clientId\":\"\", \"maxBytesInMessage\":32368, \"credentials\":{ \"type\":\"anonymous\" } }, \"downlinkTopicPattern\":\"${topic}\", \"topicFilters\":[ { \"filter\":\"tb/mqtt-integration-tutorial/sensors/+/temperature\", \"qos\":0 } ], \"metadata\":{ } } ``` Remove 'id', 'tenantId' from the request body example (below) to create new Integration entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_integration_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_integration_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_integration_from_edge_using_delete(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Unassign integration from edge (unassignIntegrationFromEdge) # noqa: E501 + + Clears assignment of the integration to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove integration locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_integration_from_edge_using_delete(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_integration_from_edge_using_delete_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_integration_from_edge_using_delete_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + return data + + def unassign_integration_from_edge_using_delete_with_http_info(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Unassign integration from edge (unassignIntegrationFromEdge) # noqa: E501 + + Clears assignment of the integration to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove integration locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_integration_from_edge_using_delete_with_http_info(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_integration_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_integration_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `unassign_integration_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integration/{integrationId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/login_endpoint_api.py b/billinglayer/python/tb_rest_client/api/api_pe/login_endpoint_api.py new file mode 100644 index 0000000..f3a3fb7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/login_endpoint_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class LoginEndpointApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def login_post(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.login_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.login_post_with_http_info(**kwargs) # noqa: E501 + return data + + def login_post_with_http_info(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method login_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/login', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/loriot_integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/loriot_integration_controller_api.py new file mode 100644 index 0000000..049026a --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/loriot_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class LoriotIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post9(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post9(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post9_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post9_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post9_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post9_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post9" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post9`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post9`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post9`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/lwm_2m_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/lwm_2m_controller_api.py new file mode 100644 index 0000000..ce9ec84 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/lwm_2m_controller_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class Lwm2mControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_lwm2m_bootstrap_security_info_using_get(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + return data + + def get_lwm2m_bootstrap_security_info_using_get_with_http_info(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_bootstrap_server'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_bootstrap_security_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_bootstrap_server' is set + if ('is_bootstrap_server' not in params or + params['is_bootstrap_server'] is None): + raise ValueError("Missing the required parameter `is_bootstrap_server` when calling `get_lwm2m_bootstrap_security_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'is_bootstrap_server' in params: + path_params['isBootstrapServer'] = params['is_bootstrap_server'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/lwm2m/deviceProfile/bootstrap/{isBootstrapServer}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LwM2MServerSecurityConfigDefault', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/notification_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/notification_controller_api.py new file mode 100644 index 0000000..cc841a9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/notification_controller_api.py @@ -0,0 +1,1203 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_notification_request_using_post(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def create_notification_request_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_notification_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequest', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_request_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_request_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_request_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_request_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_delivery_methods_using_get(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_delivery_methods_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_delivery_methods_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/deliveryMethods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_request_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_request_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_preview_using_post(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_request_preview_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'recipients_preview_size'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_preview_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'recipients_preview_size' in params: + query_params.append(('recipientsPreviewSize', params['recipients_preview_size'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/preview{?recipientsPreviewSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestPreview', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_requests_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_requests_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_requests_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_requests_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_requests_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/requests{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_settings_using_get(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notifications_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notifications_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'unread_only'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notifications_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notifications_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notifications_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'unread_only' in params: + query_params.append(('unreadOnly', params['unread_only'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications{?page,pageSize,sortOrder,sortProperty,textSearch,unreadOnly}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotification', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_all_notifications_as_read_using_put(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def mark_all_notifications_as_read_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_all_notifications_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_notification_as_read_using_put(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + return data + + def mark_notification_as_read_using_put_with_http_info(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_notification_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `mark_notification_as_read_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_settings_using_post(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/notification_rule_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/notification_rule_controller_api.py new file mode 100644 index 0000000..972b61c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/notification_rule_controller_api.py @@ -0,0 +1,447 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationRuleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_rule_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_rule_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_rule_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_rule_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rule_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_rule_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rule_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_rule_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rules_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_rules_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rules_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_rules_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_rules_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rules{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_rule_using_post(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_rule_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_rule_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRule', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/notification_target_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/notification_target_controller_api.py new file mode 100644 index 0000000..c5b3f7d --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/notification_target_controller_api.py @@ -0,0 +1,776 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTargetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_target_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_target_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_target_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_target_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_target_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_target_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_target_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_target_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_notification_targets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[NotificationTarget]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_supported_notification_type_using_get(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_supported_notification_type_using_get_with_http_info(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['notification_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_supported_notification_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'notification_type' is set + if ('notification_type' not in params or + params['notification_type'] is None): + raise ValueError("Missing the required parameter `notification_type` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'notification_type' in params: + query_params.append(('notificationType', params['notification_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?notificationType,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_recipients_for_notification_target_config_using_post(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_recipients_for_notification_target_config_using_post_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_recipients_for_notification_target_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/recipients{?page,pageSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_target_using_post(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `USER_GROUP_LIST`, `TENANT_ADMINISTRATORS`, `USER_ROLE`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_target_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `USER_GROUP_LIST`, `TENANT_ADMINISTRATORS`, `USER_ROLE`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_target_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/notification_template_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/notification_template_controller_api.py new file mode 100644 index 0000000..54a77d2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/notification_template_controller_api.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_template_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_template_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_template_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_template_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_template_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_template_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_template_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_template_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_templates_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_templates_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'notification_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_templates_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_templates_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'notification_types' in params: + query_params.append(('notificationTypes', params['notification_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/templates{?notificationTypes,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_slack_conversations_using_get(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + return data + + def list_slack_conversations_using_get_with_http_info(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_slack_conversations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `list_slack_conversations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'token' in params: + query_params.append(('token', params['token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/slack/conversations{?token,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SlackConversation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_template_using_post(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/o_auth_2_config_template_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/o_auth_2_config_template_controller_api.py new file mode 100644 index 0000000..24cae4f --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/o_auth_2_config_template_controller_api.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ConfigTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_client_registration_template_using_delete(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + return data + + def delete_client_registration_template_using_delete_with_http_info(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['client_registration_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_client_registration_template_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'client_registration_template_id' is set + if ('client_registration_template_id' not in params or + params['client_registration_template_id'] is None): + raise ValueError("Missing the required parameter `client_registration_template_id` when calling `delete_client_registration_template_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'client_registration_template_id' in params: + path_params['clientRegistrationTemplateId'] = params['client_registration_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template/{clientRegistrationTemplateId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_client_registration_templates_using_get(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_client_registration_templates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_client_registration_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientRegistrationTemplate]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_client_registration_template_using_post(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_client_registration_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_client_registration_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2ClientRegistrationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/o_auth_2_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/o_auth_2_controller_api.py new file mode 100644 index 0000000..ba4841f --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/o_auth_2_controller_api.py @@ -0,0 +1,411 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_o_auth2_info_using_get(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_o_auth2_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_o_auth2_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_login_processing_url_using_get(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_login_processing_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_login_processing_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/loginProcessingUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_o_auth2_clients_using_post(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_o_auth2_clients_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name', 'platform'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_o_auth2_clients_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + if 'platform' in params: + query_params.append(('platform', params['platform'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/oauth2Clients{?pkgName,platform}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_o_auth2_info_using_post(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_o_auth2_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_o_auth2_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/ocean_connect_integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/ocean_connect_integration_controller_api.py new file mode 100644 index 0000000..e70406f --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/ocean_connect_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OceanConnectIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post10(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post10(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post10_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post10_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post10_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post10_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post10" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post10`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post10`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post10`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/ota_package_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/ota_package_controller_api.py new file mode 100644 index 0000000..555b529 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/ota_package_controller_api.py @@ -0,0 +1,1010 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OtaPackageControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_ota_package_using_delete(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def delete_ota_package_using_delete_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_ota_package_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `delete_ota_package_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_ota_package_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def download_ota_package_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `download_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_ota_packages_using_get(self, group_id, type, page_size, page, **kwargs): # noqa: E501 + """Get group OTA Package Infos (getGroupOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant, and by entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_ota_packages_using_get(group_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_ota_packages_using_get_with_http_info(group_id, type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_group_ota_packages_using_get_with_http_info(group_id, type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_group_ota_packages_using_get_with_http_info(self, group_id, type, page_size, page, **kwargs): # noqa: E501 + """Get group OTA Package Infos (getGroupOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant, and by entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_ota_packages_using_get_with_http_info(group_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_id', 'type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_ota_packages_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_id' is set + if ('group_id' not in params or + params['group_id'] is None): + raise ValueError("Missing the required parameter `group_id` when calling `get_group_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_group_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_group_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_group_ota_packages_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_id' in params: + path_params['groupId'] = params['group_id'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages/group/{groupId}/{type}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_info_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_info_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/info/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get1(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get1_with_http_info(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id', 'type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages/{deviceProfileId}/{type}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_data_using_post(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def save_ota_package_data_using_post_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id', 'checksum', 'checksum_algorithm', 'file'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `save_ota_package_data_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'checksum' in params: + form_params.append(('checksum', params['checksum'])) # noqa: E501 + if 'checksum_algorithm' in params: + form_params.append(('checksumAlgorithm', params['checksum_algorithm'])) # noqa: E501 + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', 'multipart/form-data']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_info_using_post(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_ota_package_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/owner_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/owner_controller_api.py new file mode 100644 index 0000000..c775274 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/owner_controller_api.py @@ -0,0 +1,285 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OwnerControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def change_owner_to_customer_using_post(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to customer (changeOwnerToCustomer) # noqa: E501 + + Tenant/Customer changes Owner to Customer or sub-Customer. Sub-Customer can`t perform this operation! Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_customer_using_post(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_owner_to_customer_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.change_owner_to_customer_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def change_owner_to_customer_using_post_with_http_info(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to customer (changeOwnerToCustomer) # noqa: E501 + + Tenant/Customer changes Owner to Customer or sub-Customer. Sub-Customer can`t perform this operation! Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_customer_using_post_with_http_info(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_id', 'entity_type', 'entity_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_owner_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `change_owner_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `change_owner_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `change_owner_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/owner/CUSTOMER/{ownerId}/{entityType}/{entityId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def change_owner_to_tenant_using_post(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to tenant (changeOwnerToTenant) # noqa: E501 + + Tenant changes Owner from Customer or sub-Customer to Tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_tenant_using_post(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_owner_to_tenant_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.change_owner_to_tenant_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def change_owner_to_tenant_using_post_with_http_info(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to tenant (changeOwnerToTenant) # noqa: E501 + + Tenant changes Owner from Customer or sub-Customer to Tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_tenant_using_post_with_http_info(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_id', 'entity_type', 'entity_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_owner_to_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `change_owner_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `change_owner_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `change_owner_to_tenant_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/owner/TENANT/{ownerId}/{entityType}/{entityId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/queue_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/queue_controller_api.py new file mode 100644 index 0000000..40831df --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/queue_controller_api.py @@ -0,0 +1,558 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class QueueControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_queue_using_delete(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def delete_queue_using_delete_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_queue_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `delete_queue_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_id_using_get(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def get_queue_by_id_using_get_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `get_queue_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_name_using_get(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + return data + + def get_queue_by_name_using_get_with_http_info(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get_with_http_info(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_name_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_name' is set + if ('queue_name' not in params or + params['queue_name'] is None): + raise ValueError("Missing the required parameter `queue_name` when calling `get_queue_by_name_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_name' in params: + path_params['queueName'] = params['queue_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/name/{queueName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_queues_by_service_type_using_get(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_queues_by_service_type_using_get_with_http_info(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_queues_by_service_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?page,pageSize,serviceType,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataQueue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_queue_using_post(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + else: + (data) = self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + return data + + def save_queue_using_post_with_http_info(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post_with_http_info(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_queue_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `save_queue_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?serviceType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/report_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/report_controller_api.py new file mode 100644 index 0000000..268a779 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/report_controller_api.py @@ -0,0 +1,245 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ReportControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def download_dashboard_report_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """downloadDashboardReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_dashboard_report_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: dashboardId (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_dashboard_report_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.download_dashboard_report_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def download_dashboard_report_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """downloadDashboardReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_dashboard_report_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: dashboardId (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_dashboard_report_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `download_dashboard_report_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/report/{dashboardId}/download', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_test_report_using_post(self, **kwargs): # noqa: E501 + """downloadTestReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_test_report_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ReportConfig body: + :param str reports_server_endpoint_url: reportsServerEndpointUrl + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_test_report_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.download_test_report_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def download_test_report_using_post_with_http_info(self, **kwargs): # noqa: E501 + """downloadTestReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_test_report_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ReportConfig body: + :param str reports_server_endpoint_url: reportsServerEndpointUrl + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'reports_server_endpoint_url'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_test_report_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'reports_server_endpoint_url' in params: + query_params.append(('reportsServerEndpointUrl', params['reports_server_endpoint_url'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/report/test{?reportsServerEndpointUrl}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/role_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/role_controller_api.py new file mode 100644 index 0000000..55d402f --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/role_controller_api.py @@ -0,0 +1,546 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RoleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_role_using_delete(self, role_id, **kwargs): # noqa: E501 + """Delete role (deleteRole) # noqa: E501 + + Deletes the role. Referencing non-existing role Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_role_using_delete(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_role_using_delete_with_http_info(role_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_role_using_delete_with_http_info(role_id, **kwargs) # noqa: E501 + return data + + def delete_role_using_delete_with_http_info(self, role_id, **kwargs): # noqa: E501 + """Delete role (deleteRole) # noqa: E501 + + Deletes the role. Referencing non-existing role Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_role_using_delete_with_http_info(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['role_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_role_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'role_id' is set + if ('role_id' not in params or + params['role_id'] is None): + raise ValueError("Missing the required parameter `role_id` when calling `delete_role_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'role_id' in params: + path_params['roleId'] = params['role_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/role/{roleId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_role_by_id_using_get(self, role_id, **kwargs): # noqa: E501 + """Get Role by Id (getRoleById) # noqa: E501 + + Fetch the Role object based on the provided Role Id. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_role_by_id_using_get(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_role_by_id_using_get_with_http_info(role_id, **kwargs) # noqa: E501 + else: + (data) = self.get_role_by_id_using_get_with_http_info(role_id, **kwargs) # noqa: E501 + return data + + def get_role_by_id_using_get_with_http_info(self, role_id, **kwargs): # noqa: E501 + """Get Role by Id (getRoleById) # noqa: E501 + + Fetch the Role object based on the provided Role Id. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_role_by_id_using_get_with_http_info(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['role_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_role_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'role_id' is set + if ('role_id' not in params or + params['role_id'] is None): + raise ValueError("Missing the required parameter `role_id` when calling `get_role_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'role_id' in params: + path_params['roleId'] = params['role_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/role/{roleId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Role', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_roles_by_ids_using_get(self, role_ids, **kwargs): # noqa: E501 + """Get Roles By Ids (getRolesByIds) # noqa: E501 + + Returns the list of rows based on their ids. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_by_ids_using_get(role_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_ids: A list of role ids, separated by comma ',' (required) + :return: list[Role] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_roles_by_ids_using_get_with_http_info(role_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_roles_by_ids_using_get_with_http_info(role_ids, **kwargs) # noqa: E501 + return data + + def get_roles_by_ids_using_get_with_http_info(self, role_ids, **kwargs): # noqa: E501 + """Get Roles By Ids (getRolesByIds) # noqa: E501 + + Returns the list of rows based on their ids. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_by_ids_using_get_with_http_info(role_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_ids: A list of role ids, separated by comma ',' (required) + :return: list[Role] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['role_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_roles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'role_ids' is set + if ('role_ids' not in params or + params['role_ids'] is None): + raise ValueError("Missing the required parameter `role_ids` when calling `get_roles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'role_ids' in params: + query_params.append(('roleIds', params['role_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/roles{?roleIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Role]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_roles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Roles (getRoles) # noqa: E501 + + Returns a page of roles that are available for the current user. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller).You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Type of the role + :param str text_search: The case insensitive 'substring' filter based on the role name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRole + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_roles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_roles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_roles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Roles (getRoles) # noqa: E501 + + Returns a page of roles that are available for the current user. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller).You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Type of the role + :param str text_search: The case insensitive 'substring' filter based on the role name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRole + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_roles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_roles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_roles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/roles{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRole', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_role_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Role (saveRole) # noqa: E501 + + Creates or Updates the Role. When creating Role, platform generates Role Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Role id will be present in the response. Specify existing Role id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Example of Generic Role with read-only permissions for any resource and all permissions for the 'DEVICE' and 'PROFILE' resources is listed below: ```json { \"name\": \"Read-Only User\", \"type\": \"GENERIC\", \"permissions\": { \"ALL\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"DEVICE\": [ \"ALL\" ] \"PROFILE\": [ \"ALL\" ] }, \"additionalInfo\": { \"description\": \"Read-only permissions for everything, Write permissions for devices and own profile.\" } } ``` Example of Group Role with read-only permissions. Note that the group role has no association with the resources. The type of the resource is taken from the entity group that this role is assigned to: ```json { \"name\": \"Entity Group Read-only User\", \"type\": \"GROUP\", \"permissions\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"additionalInfo\": { \"description\": \"Read-only permissions.\" } } ``` Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_role_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Role body: + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_role_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_role_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_role_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Role (saveRole) # noqa: E501 + + Creates or Updates the Role. When creating Role, platform generates Role Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Role id will be present in the response. Specify existing Role id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Example of Generic Role with read-only permissions for any resource and all permissions for the 'DEVICE' and 'PROFILE' resources is listed below: ```json { \"name\": \"Read-Only User\", \"type\": \"GENERIC\", \"permissions\": { \"ALL\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"DEVICE\": [ \"ALL\" ] \"PROFILE\": [ \"ALL\" ] }, \"additionalInfo\": { \"description\": \"Read-only permissions for everything, Write permissions for devices and own profile.\" } } ``` Example of Group Role with read-only permissions. Note that the group role has no association with the resources. The type of the resource is taken from the entity group that this role is assigned to: ```json { \"name\": \"Entity Group Read-only User\", \"type\": \"GROUP\", \"permissions\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"additionalInfo\": { \"description\": \"Read-only permissions.\" } } ``` Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_role_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Role body: + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_role_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/role', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Role', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/rpc_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/rpc_controller_api.py new file mode 100644 index 0000000..c976b0b --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/rpc_controller_api.py @@ -0,0 +1,257 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_one_way_device_rpc_request_using_post(self, body, device_id, **kwargs): # noqa: E501 + """handleOneWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post_with_http_info(self, body, device_id, **kwargs): # noqa: E501 + """handleOneWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post_with_http_info(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post(self, body, device_id, **kwargs): # noqa: E501 + """handleTwoWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post_with_http_info(self, body, device_id, **kwargs): # noqa: E501 + """handleTwoWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post_with_http_info(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/rpc_v_1_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/rpc_v_1_controller_api.py new file mode 100644 index 0000000..0f5c352 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/rpc_v_1_controller_api.py @@ -0,0 +1,253 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV1ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_one_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/rpc_v_2_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/rpc_v_2_controller_api.py new file mode 100644 index 0000000..481f70f --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/rpc_v_2_controller_api.py @@ -0,0 +1,570 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_rpc_using_delete(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def delete_rpc_using_delete_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rpc_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `delete_rpc_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_by_device_using_get(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_by_device_using_get_with_http_info(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'page_size', 'page', 'rpc_status', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_by_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'rpc_status' in params: + query_params.append(('rpcStatus', params['rpc_status'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/device/{deviceId}{?page,pageSize,rpcStatus,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_using_get(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_using_get_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `get_persisted_rpc_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Rpc', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_one_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/rule_chain_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/rule_chain_controller_api.py new file mode 100644 index 0000000..51c7ab7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/rule_chain_controller_api.py @@ -0,0 +1,2201 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RuleChainControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_rule_chain_to_edge_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def assign_rule_chain_to_edge_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_rule_chain_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def delete_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `delete_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def export_rule_chains_using_get(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + else: + (data) = self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + return data + + def export_rule_chains_using_get_with_http_info(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get_with_http_info(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['limit'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method export_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'limit' is set + if ('limit' not in params or + params['limit'] is None): + raise ValueError("Missing the required parameter `limit` when calling `export_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/export{?limit}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_assign_to_edge_rule_chains_using_get(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_assign_to_edge_rule_chains_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_assign_to_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/autoAssignToEdgeRuleChains', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChain]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_rule_chains_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_rule_chains_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_rule_node_debug_input_using_get(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + return data + + def get_latest_rule_node_debug_input_using_get_with_http_info(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_node_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_rule_node_debug_input_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_node_id' is set + if ('rule_node_id' not in params or + params['rule_node_id'] is None): + raise ValueError("Missing the required parameter `rule_node_id` when calling `get_latest_rule_node_debug_input_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_node_id' in params: + path_params['ruleNodeId'] = params['rule_node_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleNode/{ruleNodeId}/debugIn', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_by_id_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_by_id_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_meta_data_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_meta_data_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_meta_data_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_meta_data_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/metadata', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_usage_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_usage_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_usage_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_usage_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainOutputLabelsUsage]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chains_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_rule_chains_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def import_rule_chains_using_post(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def import_rule_chains_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'overwrite'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method import_rule_chains_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'overwrite' in params: + query_params.append(('overwrite', params['overwrite'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/import{?overwrite}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainImportResult]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_tbel_enabled_using_get(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_tbel_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_tbel_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/tbelEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_meta_data_using_post(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_meta_data_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'update_related'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_meta_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'update_related' in params: + query_params.append(('updateRelated', params['update_related'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/metadata{?updateRelated}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/device/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post1(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_auto_assign_to_edge_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_auto_assign_to_edge_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_auto_assign_to_edge_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_auto_assign_to_edge_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_template_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_template_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_template_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_template_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/edgeTemplateRoot', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_script_using_post(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_script_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_script_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/testScript{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_rule_chain_from_edge_using_delete(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def unassign_rule_chain_from_edge_using_delete_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_rule_chain_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unset_auto_assign_to_edge_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unset_auto_assign_to_edge_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unset_auto_assign_to_edge_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/rule_engine_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/rule_engine_controller_api.py new file mode 100644 index 0000000..6b374cd --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/rule_engine_controller_api.py @@ -0,0 +1,499 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RuleEngineControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_rule_engine_request_using_post(self, entity_type, entity_id, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post(entity_type, entity_id, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post_with_http_info(entity_type, entity_id, timeout, **kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post_with_http_info(entity_type, entity_id, timeout, **kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post_with_http_info(self, entity_type, entity_id, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post_with_http_info(entity_type, entity_id, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'timeout', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `handle_rule_engine_request_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `handle_rule_engine_request_using_post`") # noqa: E501 + # verify the required parameter 'timeout' is set + if ('timeout' not in params or + params['timeout'] is None): + raise ValueError("Missing the required parameter `timeout` when calling `handle_rule_engine_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'timeout' in params: + path_params['timeout'] = params['timeout'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/{entityType}/{entityId}/{timeout}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_rule_engine_request_using_post1(self, entity_type, entity_id, queue_name, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout and specified queue to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. If request sent for Device/Device Profile or Asset/Asset Profile entity, specified queue will be used instead of the queue selected in the device or asset profile. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post1(entity_type, entity_id, queue_name, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str queue_name: Queue name to process the request in the rule engine (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post1_with_http_info(entity_type, entity_id, queue_name, timeout, **kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post1_with_http_info(entity_type, entity_id, queue_name, timeout, **kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post1_with_http_info(self, entity_type, entity_id, queue_name, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout and specified queue to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. If request sent for Device/Device Profile or Asset/Asset Profile entity, specified queue will be used instead of the queue selected in the device or asset profile. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post1_with_http_info(entity_type, entity_id, queue_name, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str queue_name: Queue name to process the request in the rule engine (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'queue_name', 'timeout', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + # verify the required parameter 'queue_name' is set + if ('queue_name' not in params or + params['queue_name'] is None): + raise ValueError("Missing the required parameter `queue_name` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + # verify the required parameter 'timeout' is set + if ('timeout' not in params or + params['timeout'] is None): + raise ValueError("Missing the required parameter `timeout` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'queue_name' in params: + path_params['queueName'] = params['queue_name'] # noqa: E501 + if 'timeout' in params: + path_params['timeout'] = params['timeout'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/{entityType}/{entityId}/{queueName}/{timeout}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_rule_engine_request_using_post2(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Push entity message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post2(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post2_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post2_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post2_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Push entity message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post2_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `handle_rule_engine_request_using_post2`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `handle_rule_engine_request_using_post2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/{entityType}/{entityId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_rule_engine_request_using_post3(self, **kwargs): # noqa: E501 + """Push user message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses current User Id ( the one which credentials is used to perform the request) as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post3(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post3_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post3_with_http_info(**kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post3_with_http_info(self, **kwargs): # noqa: E501 + """Push user message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses current User Id ( the one which credentials is used to perform the request) as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post3_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post3" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/scheduler_event_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/scheduler_event_controller_api.py new file mode 100644 index 0000000..5beeedb --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/scheduler_event_controller_api.py @@ -0,0 +1,1037 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SchedulerEventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_scheduler_event_to_edge_using_post(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Assign scheduler event to edge (assignSchedulerEventToEdge) # noqa: E501 + + Creates assignment of an existing scheduler event to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment scheduler event (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once scheduler event will be delivered to edge service, it is going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_scheduler_event_to_edge_using_post(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_scheduler_event_to_edge_using_post_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_scheduler_event_to_edge_using_post_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + return data + + def assign_scheduler_event_to_edge_using_post_with_http_info(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Assign scheduler event to edge (assignSchedulerEventToEdge) # noqa: E501 + + Creates assignment of an existing scheduler event to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment scheduler event (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once scheduler event will be delivered to edge service, it is going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_scheduler_event_to_edge_using_post_with_http_info(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_scheduler_event_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_scheduler_event_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `assign_scheduler_event_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/schedulerEvent/{schedulerEventId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_scheduler_event_using_delete(self, scheduler_event_id, **kwargs): # noqa: E501 + """Delete Scheduler Event (deleteSchedulerEvent) # noqa: E501 + + Deletes the scheduler event. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_scheduler_event_using_delete(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_scheduler_event_using_delete_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_scheduler_event_using_delete_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + return data + + def delete_scheduler_event_using_delete_with_http_info(self, scheduler_event_id, **kwargs): # noqa: E501 + """Delete Scheduler Event (deleteSchedulerEvent) # noqa: E501 + + Deletes the scheduler event. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_scheduler_event_using_delete_with_http_info(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_scheduler_event_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `delete_scheduler_event_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent/{schedulerEventId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_scheduler_events_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get All Edge Scheduler Events (getAllSchedulerEvents) # noqa: E501 + + Fetch the list of Scheduler Event Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_scheduler_events_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_scheduler_events_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_all_scheduler_events_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_all_scheduler_events_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get All Edge Scheduler Events (getAllSchedulerEvents) # noqa: E501 + + Fetch the list of Scheduler Event Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_scheduler_events_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_scheduler_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_all_scheduler_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/allSchedulerEvents', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SchedulerEventInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_scheduler_events_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Scheduler Events (getEdgeSchedulerEvents) # noqa: E501 + + Returns a page of Scheduler Events Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_scheduler_events_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the scheduler event name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataSchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_scheduler_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_scheduler_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_scheduler_events_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Scheduler Events (getEdgeSchedulerEvents) # noqa: E501 + + Returns a page of Scheduler Events Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_scheduler_events_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the scheduler event name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataSchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_scheduler_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_scheduler_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_scheduler_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_scheduler_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/schedulerEvents{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataSchedulerEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_event_by_id_using_get(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event (getSchedulerEventById) # noqa: E501 + + Fetch the SchedulerEvent object based on the provided scheduler event Id. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_by_id_using_get(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_event_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_event_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + return data + + def get_scheduler_event_by_id_using_get_with_http_info(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event (getSchedulerEventById) # noqa: E501 + + Fetch the SchedulerEvent object based on the provided scheduler event Id. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_by_id_using_get_with_http_info(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_event_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `get_scheduler_event_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent/{schedulerEventId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_event_info_by_id_using_get(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event With Customer Info (getSchedulerEventInfoById) # noqa: E501 + + Fetch the SchedulerEventWithCustomerInfo object based on the provided scheduler event Id. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_info_by_id_using_get(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_event_info_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_event_info_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + return data + + def get_scheduler_event_info_by_id_using_get_with_http_info(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event With Customer Info (getSchedulerEventInfoById) # noqa: E501 + + Fetch the SchedulerEventWithCustomerInfo object based on the provided scheduler event Id. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_info_by_id_using_get_with_http_info(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_event_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `get_scheduler_event_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent/info/{schedulerEventId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEventWithCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_events_by_ids_using_get(self, scheduler_event_ids, **kwargs): # noqa: E501 + """Get Scheduler Events By Ids (getSchedulerEventsByIds) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_by_ids_using_get(scheduler_event_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_ids: A list of scheduler event ids, separated by comma ',' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_events_by_ids_using_get_with_http_info(scheduler_event_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_events_by_ids_using_get_with_http_info(scheduler_event_ids, **kwargs) # noqa: E501 + return data + + def get_scheduler_events_by_ids_using_get_with_http_info(self, scheduler_event_ids, **kwargs): # noqa: E501 + """Get Scheduler Events By Ids (getSchedulerEventsByIds) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_by_ids_using_get_with_http_info(scheduler_event_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_ids: A list of scheduler event ids, separated by comma ',' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_events_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_ids' is set + if ('scheduler_event_ids' not in params or + params['scheduler_event_ids'] is None): + raise ValueError("Missing the required parameter `scheduler_event_ids` when calling `get_scheduler_events_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'scheduler_event_ids' in params: + query_params.append(('schedulerEventIds', params['scheduler_event_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvents{?schedulerEventIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SchedulerEventInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_events_using_get(self, **kwargs): # noqa: E501 + """Get Scheduler Events By Type (getSchedulerEvents) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: A string value representing the scheduler type. For example, 'generateReport' + :return: list[SchedulerEventWithCustomerInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_events_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_events_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_scheduler_events_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Scheduler Events By Type (getSchedulerEvents) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: A string value representing the scheduler type. For example, 'generateReport' + :return: list[SchedulerEventWithCustomerInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvents{?type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SchedulerEventWithCustomerInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_scheduler_event_using_post(self, **kwargs): # noqa: E501 + """Save Scheduler Event (saveSchedulerEvent) # noqa: E501 + + Creates or Updates scheduler event. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. When creating scheduler event, platform generates scheduler event Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created scheduler event id will be present in the response. Specify existing scheduler event id to update the scheduler event. Referencing non-existing scheduler event Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Scheduler Event entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_scheduler_event_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SchedulerEvent body: + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_scheduler_event_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_scheduler_event_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_scheduler_event_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save Scheduler Event (saveSchedulerEvent) # noqa: E501 + + Creates or Updates scheduler event. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. When creating scheduler event, platform generates scheduler event Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created scheduler event id will be present in the response. Specify existing scheduler event id to update the scheduler event. Referencing non-existing scheduler event Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Scheduler Event entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_scheduler_event_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SchedulerEvent body: + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_scheduler_event_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_scheduler_event_from_edge_using_delete(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Unassign scheduler event from edge (unassignSchedulerEventFromEdge) # noqa: E501 + + Clears assignment of the scheduler event to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_scheduler_event_from_edge_using_delete(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_scheduler_event_from_edge_using_delete_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_scheduler_event_from_edge_using_delete_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + return data + + def unassign_scheduler_event_from_edge_using_delete_with_http_info(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Unassign scheduler event from edge (unassignSchedulerEventFromEdge) # noqa: E501 + + Clears assignment of the scheduler event to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_scheduler_event_from_edge_using_delete_with_http_info(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_scheduler_event_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_scheduler_event_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `unassign_scheduler_event_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/schedulerEvent/{schedulerEventId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/self_registration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/self_registration_controller_api.py new file mode 100644 index 0000000..8d1f697 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/self_registration_controller_api.py @@ -0,0 +1,587 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SelfRegistrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_self_registration_params_using_delete(self, domain_name, **kwargs): # noqa: E501 + """deleteSelfRegistrationParams # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_self_registration_params_using_delete(domain_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str domain_name: domainName (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_self_registration_params_using_delete_with_http_info(domain_name, **kwargs) # noqa: E501 + else: + (data) = self.delete_self_registration_params_using_delete_with_http_info(domain_name, **kwargs) # noqa: E501 + return data + + def delete_self_registration_params_using_delete_with_http_info(self, domain_name, **kwargs): # noqa: E501 + """deleteSelfRegistrationParams # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_self_registration_params_using_delete_with_http_info(domain_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str domain_name: domainName (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['domain_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_self_registration_params_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'domain_name' is set + if ('domain_name' not in params or + params['domain_name'] is None): + raise ValueError("Missing the required parameter `domain_name` when calling `delete_self_registration_params_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'domain_name' in params: + path_params['domainName'] = params['domain_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/selfRegistration/selfRegistrationParams/{domainName}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_privacy_policy_using_get(self, **kwargs): # noqa: E501 + """Get Privacy Policy for Self Registration form (getPrivacyPolicy) # noqa: E501 + + Fetch the Privacy Policy based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_privacy_policy_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_privacy_policy_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_privacy_policy_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_privacy_policy_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Privacy Policy for Self Registration form (getPrivacyPolicy) # noqa: E501 + + Fetch the Privacy Policy based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_privacy_policy_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_privacy_policy_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/selfRegistration/privacyPolicy', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_self_registration_params_using_get(self, **kwargs): # noqa: E501 + """Get Self Registration parameters (getSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters object for the tenant of the current user. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_self_registration_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_self_registration_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Self Registration parameters (getSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters object for the tenant of the current user. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_self_registration_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_self_registration_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/selfRegistration/selfRegistrationParams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SelfRegistrationParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_sign_up_self_registration_params_using_get(self, **kwargs): # noqa: E501 + """Get Self Registration form parameters without authentication (getSignUpSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters based on the domain name from the request. Available for non-authorized users. Contains the information to customize the sign-up form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sign_up_self_registration_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: pkgName + :return: SignUpSelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_sign_up_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_sign_up_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_sign_up_self_registration_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Self Registration form parameters without authentication (getSignUpSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters based on the domain name from the request. Available for non-authorized users. Contains the information to customize the sign-up form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sign_up_self_registration_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: pkgName + :return: SignUpSelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_sign_up_self_registration_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/selfRegistration/signUpSelfRegistrationParams{?pkgName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SignUpSelfRegistrationParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_terms_of_use_using_get(self, **kwargs): # noqa: E501 + """Get Terms of Use for Self Registration form (getTermsOfUse) # noqa: E501 + + Fetch the Terms of Use based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_terms_of_use_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_terms_of_use_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_terms_of_use_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_terms_of_use_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Terms of Use for Self Registration form (getTermsOfUse) # noqa: E501 + + Fetch the Terms of Use based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_terms_of_use_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_terms_of_use_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/selfRegistration/termsOfUse', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_self_registration_params_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Self Registration parameters (saveSelfRegistrationParams) # noqa: E501 + + Creates or Updates the Self Registration parameters. When creating, platform generates Admin Settings Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Admin Settings Id will be present in the response. Specify existing Admin Settings Id to update the Self Registration parameters. Referencing non-existing Admin Settings Id will cause 'Not Found' error. Self Registration allows users to signup for using the platform and automatically create a Customer account for them. You may configure default dashboard and user roles that will be assigned for this Customer. This allows you to build out-of-the-box solutions for customers. Ability to white-label the login and main pages helps to brand the platform. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_self_registration_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SelfRegistrationParams body: + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_self_registration_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_self_registration_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_self_registration_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Self Registration parameters (saveSelfRegistrationParams) # noqa: E501 + + Creates or Updates the Self Registration parameters. When creating, platform generates Admin Settings Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Admin Settings Id will be present in the response. Specify existing Admin Settings Id to update the Self Registration parameters. Referencing non-existing Admin Settings Id will cause 'Not Found' error. Self Registration allows users to signup for using the platform and automatically create a Customer account for them. You may configure default dashboard and user roles that will be assigned for this Customer. This allows you to build out-of-the-box solutions for customers. Ability to white-label the login and main pages helps to brand the platform. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_self_registration_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SelfRegistrationParams body: + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_self_registration_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/selfRegistration/selfRegistrationParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SelfRegistrationParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/sig_fox_integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/sig_fox_integration_controller_api.py new file mode 100644 index 0000000..70e41df --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/sig_fox_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SigFoxIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post11(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post11(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post11_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post11_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post11_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post11_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post11" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post11`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post11`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post11`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/sign_up_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/sign_up_controller_api.py new file mode 100644 index 0000000..4b58910 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/sign_up_controller_api.py @@ -0,0 +1,882 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SignUpControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def accept_privacy_policy_using_post(self, **kwargs): # noqa: E501 + """Accept privacy policy (acceptPrivacyPolicy) # noqa: E501 + + Accept privacy policy by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_privacy_policy_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.accept_privacy_policy_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.accept_privacy_policy_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def accept_privacy_policy_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Accept privacy policy (acceptPrivacyPolicy) # noqa: E501 + + Accept privacy policy by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_privacy_policy_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method accept_privacy_policy_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/acceptPrivacyPolicy', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def accept_terms_of_use_using_post(self, **kwargs): # noqa: E501 + """Accept Terms of Use (acceptTermsOfUse) # noqa: E501 + + Accept Terms of Use by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_terms_of_use_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.accept_terms_of_use_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.accept_terms_of_use_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def accept_terms_of_use_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Accept Terms of Use (acceptTermsOfUse) # noqa: E501 + + Accept Terms of Use by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_terms_of_use_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method accept_terms_of_use_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/acceptTermsOfUse', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def activate_email_using_get(self, email_code, **kwargs): # noqa: E501 + """Activate User using code from Email (activateEmail) # noqa: E501 + + Activate the user using code(link) from the activation email. Validates the code an redirects according to the signup flow. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_email_using_get(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_email_using_get_with_http_info(email_code, **kwargs) # noqa: E501 + else: + (data) = self.activate_email_using_get_with_http_info(email_code, **kwargs) # noqa: E501 + return data + + def activate_email_using_get_with_http_info(self, email_code, **kwargs): # noqa: E501 + """Activate User using code from Email (activateEmail) # noqa: E501 + + Activate the user using code(link) from the activation email. Validates the code an redirects according to the signup flow. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_email_using_get_with_http_info(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email_code', 'pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_email_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email_code' is set + if ('email_code' not in params or + params['email_code'] is None): + raise ValueError("Missing the required parameter `email_code` when calling `activate_email_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email_code' in params: + query_params.append(('emailCode', params['email_code'])) # noqa: E501 + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activateEmail{?emailCode,pkgName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def activate_user_by_email_code_using_post(self, email_code, **kwargs): # noqa: E501 + """Activate and login using code from Email (activateUserByEmailCode) # noqa: E501 + + Activate the user using code(link) from the activation email and return the JWT Token. Sends the notification and email about user activation. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_by_email_code_using_post(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_user_by_email_code_using_post_with_http_info(email_code, **kwargs) # noqa: E501 + else: + (data) = self.activate_user_by_email_code_using_post_with_http_info(email_code, **kwargs) # noqa: E501 + return data + + def activate_user_by_email_code_using_post_with_http_info(self, email_code, **kwargs): # noqa: E501 + """Activate and login using code from Email (activateUserByEmailCode) # noqa: E501 + + Activate the user using code(link) from the activation email and return the JWT Token. Sends the notification and email about user activation. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_by_email_code_using_post_with_http_info(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email_code', 'pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_user_by_email_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email_code' is set + if ('email_code' not in params or + params['email_code'] is None): + raise ValueError("Missing the required parameter `email_code` when calling `activate_user_by_email_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email_code' in params: + query_params.append(('emailCode', params['email_code'])) # noqa: E501 + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activateByEmailCode{?emailCode,pkgName}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mobile_login_using_get(self, pkg_name, **kwargs): # noqa: E501 + """Mobile Login redirect (mobileLogin) # noqa: E501 + + This method generates redirect to the special link that is handled by mobile application. Useful for email verification flow on mobile app. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mobile_login_using_get(pkg_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile app package name. Used to identify the application and build the redirect link. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mobile_login_using_get_with_http_info(pkg_name, **kwargs) # noqa: E501 + else: + (data) = self.mobile_login_using_get_with_http_info(pkg_name, **kwargs) # noqa: E501 + return data + + def mobile_login_using_get_with_http_info(self, pkg_name, **kwargs): # noqa: E501 + """Mobile Login redirect (mobileLogin) # noqa: E501 + + This method generates redirect to the special link that is handled by mobile application. Useful for email verification flow on mobile app. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mobile_login_using_get_with_http_info(pkg_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile app package name. Used to identify the application and build the redirect link. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mobile_login_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'pkg_name' is set + if ('pkg_name' not in params or + params['pkg_name'] is None): + raise ValueError("Missing the required parameter `pkg_name` when calling `mobile_login_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/login{?pkgName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def privacy_policy_accepted_using_get(self, **kwargs): # noqa: E501 + """Check privacy policy (privacyPolicyAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.privacy_policy_accepted_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.privacy_policy_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.privacy_policy_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def privacy_policy_accepted_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check privacy policy (privacyPolicyAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.privacy_policy_accepted_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method privacy_policy_accepted_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/privacyPolicyAccepted', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def resend_email_activation_using_post(self, email, **kwargs): # noqa: E501 + """Resend Activation Email (resendEmailActivation) # noqa: E501 + + Request to resend the activation email for the user. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.resend_email_activation_using_post(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.resend_email_activation_using_post_with_http_info(email, **kwargs) # noqa: E501 + else: + (data) = self.resend_email_activation_using_post_with_http_info(email, **kwargs) # noqa: E501 + return data + + def resend_email_activation_using_post_with_http_info(self, email, **kwargs): # noqa: E501 + """Resend Activation Email (resendEmailActivation) # noqa: E501 + + Request to resend the activation email for the user. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.resend_email_activation_using_post_with_http_info(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email', 'pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method resend_email_activation_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email' is set + if ('email' not in params or + params['email'] is None): + raise ValueError("Missing the required parameter `email` when calling `resend_email_activation_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email' in params: + query_params.append(('email', params['email'])) # noqa: E501 + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resendEmailActivation{?email,pkgName}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def sign_up_using_post(self, **kwargs): # noqa: E501 + """User Sign Up (signUp) # noqa: E501 + + Process user sign up request. Creates the Customer and corresponding User based on self Registration parameters for the domain. See [Self Registration Controller](/swagger-ui.html#/self-registration-controller) for more details. The result is either 'SUCCESS' or 'INACTIVE_USER_EXISTS'. If Success, the user will receive an email with instruction to activate the account. The content of the email is customizable via the mail templates. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sign_up_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SignUpRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.sign_up_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.sign_up_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def sign_up_using_post_with_http_info(self, **kwargs): # noqa: E501 + """User Sign Up (signUp) # noqa: E501 + + Process user sign up request. Creates the Customer and corresponding User based on self Registration parameters for the domain. See [Self Registration Controller](/swagger-ui.html#/self-registration-controller) for more details. The result is either 'SUCCESS' or 'INACTIVE_USER_EXISTS'. If Success, the user will receive an email with instruction to activate the account. The content of the email is customizable via the mail templates. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sign_up_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SignUpRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method sign_up_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/signup', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def terms_of_use_accepted_using_get(self, **kwargs): # noqa: E501 + """Check Terms Of User (termsOfUseAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.terms_of_use_accepted_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.terms_of_use_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.terms_of_use_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def terms_of_use_accepted_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Terms Of User (termsOfUseAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.terms_of_use_accepted_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method terms_of_use_accepted_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/termsOfUseAccepted', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/solution_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/solution_controller_api.py new file mode 100644 index 0000000..3f5b348 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/solution_controller_api.py @@ -0,0 +1,514 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SolutionControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_solution_template_details_using_get(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution template details (getSolutionTemplateDetails) # noqa: E501 + + Get a solution template details based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_details_using_get(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_solution_template_details_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.get_solution_template_details_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def get_solution_template_details_using_get_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution template details (getSolutionTemplateDetails) # noqa: E501 + + Get a solution template details based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_details_using_get_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_solution_template_details_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `get_solution_template_details_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/details/{solutionTemplateId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantSolutionTemplateDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_solution_template_infos_using_get(self, **kwargs): # noqa: E501 + """Get Solution templates (getSolutionTemplateInfos) # noqa: E501 + + Get a list of solution template descriptors Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_infos_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TenantSolutionTemplateInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_solution_template_infos_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_solution_template_infos_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_solution_template_infos_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Solution templates (getSolutionTemplateInfos) # noqa: E501 + + Get a list of solution template descriptors Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_infos_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TenantSolutionTemplateInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_solution_template_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/infos', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TenantSolutionTemplateInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_solution_template_instructions_using_get(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution Template Instructions (getSolutionTemplateInstructions) # noqa: E501 + + Get a solution template instructions based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_instructions_using_get(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateInstructions + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_solution_template_instructions_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.get_solution_template_instructions_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def get_solution_template_instructions_using_get_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution Template Instructions (getSolutionTemplateInstructions) # noqa: E501 + + Get a solution template instructions based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_instructions_using_get_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateInstructions + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_solution_template_instructions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `get_solution_template_instructions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/instructions/{solutionTemplateId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantSolutionTemplateInstructions', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def install_solution_template_using_post(self, solution_template_id, **kwargs): # noqa: E501 + """Install Solution Template (installSolutionTemplate) # noqa: E501 + + Install solution template based on the provided id Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.install_solution_template_using_post(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SolutionInstallResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.install_solution_template_using_post_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.install_solution_template_using_post_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def install_solution_template_using_post_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Install Solution Template (installSolutionTemplate) # noqa: E501 + + Install solution template based on the provided id Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.install_solution_template_using_post_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SolutionInstallResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method install_solution_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `install_solution_template_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/{solutionTemplateId}/install', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SolutionInstallResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def uninstall_solution_template_using_delete(self, solution_template_id, **kwargs): # noqa: E501 + """Uninstall Solution Template (uninstallSolutionTemplate) # noqa: E501 + + Uninstall solution template based on the provided id Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.uninstall_solution_template_using_delete(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.uninstall_solution_template_using_delete_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.uninstall_solution_template_using_delete_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def uninstall_solution_template_using_delete_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Uninstall Solution Template (uninstallSolutionTemplate) # noqa: E501 + + Uninstall solution template based on the provided id Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.uninstall_solution_template_using_delete_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method uninstall_solution_template_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `uninstall_solution_template_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/{solutionTemplateId}/delete', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/subscription_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/subscription_controller_api.py new file mode 100644 index 0000000..1ee2b1c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/subscription_controller_api.py @@ -0,0 +1,310 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SubscriptionControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_tenant_profile_data_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """getTenantProfileDataById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: tenantProfileId (required) + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_data_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_data_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_data_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """getTenantProfileDataById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: tenantProfileId (required) + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_data_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_data_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}/data', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfileData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_data_using_get(self, **kwargs): # noqa: E501 + """getTenantProfileData # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_data_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_data_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_profile_data_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantProfileData # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_data_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/subscription/data', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfileData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_subscription_usage_using_get(self, **kwargs): # noqa: E501 + """getTenantSubscriptionUsage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_subscription_usage_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SubscriptionUsage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_subscription_usage_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_subscription_usage_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_subscription_usage_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantSubscriptionUsage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_subscription_usage_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SubscriptionUsage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_subscription_usage_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/subscription/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SubscriptionUsage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/t_mobile_iot_cdp_integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/t_mobile_iot_cdp_integration_controller_api.py new file mode 100644 index 0000000..b23267d --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/t_mobile_iot_cdp_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TMobileIotCdpIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post12(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post12(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post12_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post12_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post12_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post12_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post12" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post12`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post12`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post12`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/tb_resource_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/tb_resource_controller_api.py new file mode 100644 index 0000000..1f9c440 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/tb_resource_controller_api.py @@ -0,0 +1,863 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TbResourceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_resource_using_delete(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def delete_resource_using_delete_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_resource_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `delete_resource_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_resource_using_get(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def download_resource_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_resource_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `download_resource_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_page_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_page_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_page_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m/page{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_using_get(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_using_get_with_http_info(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['sort_order', 'sort_property', 'object_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'sort_order' is set + if ('sort_order' not in params or + params['sort_order'] is None): + raise ValueError("Missing the required parameter `sort_order` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'sort_property' is set + if ('sort_property' not in params or + params['sort_property'] is None): + raise ValueError("Missing the required parameter `sort_property` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'object_ids' is set + if ('object_ids' not in params or + params['object_ids'] is None): + raise ValueError("Missing the required parameter `object_ids` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'object_ids' in params: + query_params.append(('objectIds', params['object_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m{?objectIds,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_info_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_info_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/info/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resources_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_resources_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resources_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_resources_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_resources_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_resource_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_resource_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_resource_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/telemetry_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/telemetry_controller_api.py new file mode 100644 index 0000000..cec8f67 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/telemetry_controller_api.py @@ -0,0 +1,1796 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TelemetryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_attributes_using_delete(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_device_attributes_using_delete_with_http_info(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_device_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_attributes_using_delete(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_attributes_using_delete_with_http_info(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_timeseries_using_delete(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_timeseries_using_delete_with_http_info(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'delete_all_data_for_keys', 'start_ts', 'end_ts', 'rewrite_latest_if_deleted'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_timeseries_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'delete_all_data_for_keys' in params: + query_params.append(('deleteAllDataForKeys', params['delete_all_data_for_keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'rewrite_latest_if_deleted' in params: + query_params.append(('rewriteLatestIfDeleted', params['rewrite_latest_if_deleted'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/delete{?deleteAllDataForKeys,endTs,keys,rewriteLatestIfDeleted,startTs}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes/{scope}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attributes_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes/{scope}{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attributes_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_timeseries_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_latest_timeseries_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_latest_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_latest_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?keys,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get1(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get1_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/timeseries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_using_get(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + return data + + def get_timeseries_using_get_with_http_info(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'start_ts', 'end_ts', 'interval', 'limit', 'agg', 'order_by', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'start_ts' is set + if ('start_ts' not in params or + params['start_ts'] is None): + raise ValueError("Missing the required parameter `start_ts` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'end_ts' is set + if ('end_ts' not in params or + params['end_ts'] is None): + raise ValueError("Missing the required parameter `end_ts` when calling `get_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'interval' in params: + query_params.append(('interval', params['interval'])) # noqa: E501 + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + if 'agg' in params: + query_params.append(('agg', params['agg'])) # noqa: E501 + if 'order_by' in params: + query_params.append(('orderBy', params['order_by'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?agg,endTs,interval,keys,limit,orderBy,startTs,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_attributes_using_post(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + return data + + def save_device_attributes_using_post_with_http_info(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post_with_http_info(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `save_device_attributes_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v1_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v1_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v1_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v2_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v2_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v2_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/attributes/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_with_ttl_using_post(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_with_ttl_using_post_with_http_info(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'ttl', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_with_ttl_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'ttl' is set + if ('ttl' not in params or + params['ttl'] is None): + raise ValueError("Missing the required parameter `ttl` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + if 'ttl' in params: + path_params['ttl'] = params['ttl'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}/{ttl}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/tenant_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/tenant_controller_api.py new file mode 100644 index 0000000..5924894 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/tenant_controller_api.py @@ -0,0 +1,750 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_using_delete(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_using_delete_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `delete_tenant_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_info_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_info_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/info/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenants_by_ids_using_get(self, tenant_ids, **kwargs): # noqa: E501 + """getTenantsByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_by_ids_using_get(tenant_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_ids: tenantIds (required) + :return: list[Tenant] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenants_by_ids_using_get_with_http_info(tenant_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_tenants_by_ids_using_get_with_http_info(tenant_ids, **kwargs) # noqa: E501 + return data + + def get_tenants_by_ids_using_get_with_http_info(self, tenant_ids, **kwargs): # noqa: E501 + """getTenantsByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_by_ids_using_get_with_http_info(tenant_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_ids: tenantIds (required) + :return: list[Tenant] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenants_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_ids' is set + if ('tenant_ids' not in params or + params['tenant_ids'] is None): + raise ValueError("Missing the required parameter `tenant_ids` when calling `get_tenants_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'tenant_ids' in params: + query_params.append(('tenantIds', params['tenant_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenants{?tenantIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Tenant]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenants_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenants_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenants_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenants_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenants_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenants{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/tenant_profile_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/tenant_profile_controller_api.py new file mode 100644 index 0000000..9a7c72b --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/tenant_profile_controller_api.py @@ -0,0 +1,932 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_profile_using_delete(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_profile_using_delete_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `delete_tenant_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_tenant_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_tenant_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_tenant_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_info_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_info_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_tenant_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TenantProfile]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_tenant_profile_using_post(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_tenant_profile_using_post_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `set_default_tenant_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/thing_park_integration_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/thing_park_integration_controller_api.py new file mode 100644 index 0000000..c1fb571 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/thing_park_integration_controller_api.py @@ -0,0 +1,1741 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ThingParkIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_tpe_using_delete(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_delete(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_delete_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_delete_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_delete_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_delete_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_delete`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_delete`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_delete`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_get(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_get(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_get_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_get_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_get_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_get_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_get`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_get`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_get`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_head(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_head(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_head_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_head_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_head_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_head_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_head" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_head`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_head`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_head`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_head`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_options(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_options(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_options_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_options_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_options_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_options_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_options" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_options`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_options`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_options`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_options`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_patch(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_patch(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_patch_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_patch_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_patch_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_patch_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_patch" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_patch`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_patch`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_patch`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_patch`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_post(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_post(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_post_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_post_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_post_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_post_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_post`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_post`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_post`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_put(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_put(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_put_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_put_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_put_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_put_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_put`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_put`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_put`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_delete5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_delete5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_get5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_head5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_options5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_patch5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post13(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post13(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post13_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post13_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post13_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post13_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post13" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post13`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post13`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_post13`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post13`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_put5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/trail_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/trail_controller_api.py new file mode 100644 index 0000000..c34bc74 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/trail_controller_api.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TrailControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_using_delete1(self, **kwargs): # noqa: E501 + """deleteDevice # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_using_delete1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_device_using_delete1_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_device_using_delete1_with_http_info(self, **kwargs): # noqa: E501 + """deleteDevice # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/trail/invalidateCache', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/two_factor_auth_config_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/two_factor_auth_config_controller_api.py new file mode 100644 index 0000000..7831403 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/two_factor_auth_config_controller_api.py @@ -0,0 +1,890 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthConfigControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_two_fa_account_config_using_delete(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def delete_two_fa_account_config_using_delete_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_two_fa_account_config_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `delete_two_fa_account_config_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def generate_two_fa_account_config_using_post(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def generate_two_fa_account_config_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method generate_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `generate_two_fa_account_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/generate{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TwoFaAccountConfig', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_account_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_account_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_account_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_platform_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_platform_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_platform_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_platform_two_fa_settings_using_post(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `useSystemTwoFactorAuthSettings` - option for tenant admins to use 2FA settings configured by sysadmin. If this param is set to true, then the settings will not be validated for constraints (if it is a tenant admin; for sysadmin this param is ignored). - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"useSystemTwoFactorAuthSettings\": false, \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_platform_two_fa_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `useSystemTwoFactorAuthSettings` - option for tenant admins to use 2FA settings configured by sysadmin. If this param is set to true, then the settings will not be validated for constraints (if it is a tenant admin; for sysadmin this param is ignored). - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"useSystemTwoFactorAuthSettings\": false, \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_platform_two_fa_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def submit_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def submit_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method submit_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/submit', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_two_fa_account_config_using_put(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def update_two_fa_account_config_using_put_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_two_fa_account_config_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `update_two_fa_account_config_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def verify_and_save_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def verify_and_save_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method verify_and_save_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/two_factor_auth_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/two_factor_auth_controller_api.py new file mode 100644 index 0000000..344b072 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/two_factor_auth_controller_api.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_two_fa_verification_code_using_post(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + else: + (data) = self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + return data + + def check_two_fa_verification_code_using_post_with_http_info(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + # verify the required parameter 'verification_code' is set + if ('verification_code' not in params or + params['verification_code'] is None): + raise ValueError("Missing the required parameter `verification_code` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/check{?providerType,verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get1(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get1_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TwoFaProviderInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_two_fa_verification_code_using_post(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def request_two_fa_verification_code_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `request_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/send{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/ui_settings_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/ui_settings_controller_api.py new file mode 100644 index 0000000..54b6959 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/ui_settings_controller_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UiSettingsControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_help_base_url_using_get(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_help_base_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_help_base_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/uiSettings/helpBaseUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/usage_info_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/usage_info_controller_api.py new file mode 100644 index 0000000..998b596 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/usage_info_controller_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UsageInfoControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_tenant_usage_info_using_get(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_usage_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_usage_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UsageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/user_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/user_controller_api.py new file mode 100644 index 0000000..36b6ebc --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/user_controller_api.py @@ -0,0 +1,2942 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UserControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_user_settings_using_delete(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete_with_http_info(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete_with_http_info(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths', 'type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `delete_user_settings_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_settings_using_delete1(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete1_with_http_info(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1_with_http_info(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_using_delete(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def delete_user_using_delete_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `delete_user_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_users_by_query_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def find_users_by_query_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_users_by_query_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `find_users_by_query_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `find_users_by_query_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/info{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_activation_link_using_get(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_activation_link_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_activation_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_activation_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['text/plain']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/activationLink', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_customer_users_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users for the current tenant with authority 'CUSTOMER_USER'. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_users_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_customer_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_customer_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_customer_users_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users for the current tenant with authority 'CUSTOMER_USER'. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_users_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_customer_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_customer_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_user_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All User Infos for current user (getAllUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_user_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_user_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_user_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_user_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All User Infos for current user (getAllUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_user_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_user_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_user_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_user_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/userInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_user_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer user Infos (getCustomerUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_user_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_user_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_user_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_user_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer user Infos (getCustomerUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_user_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_user_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_user_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_user_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_user_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/userInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_users_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_users_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_admins_using_get(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_admins_using_get_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_admins_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_admins_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_by_id_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_by_id_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_dashboards_info_using_get(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_dashboards_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_dashboards_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_info_by_id_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User info (getUserInfoById) # noqa: E501 + + Fetch the User info object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_info_by_id_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: UserInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_info_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_info_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_info_by_id_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User info (getUserInfoById) # noqa: E501 + + Fetch the User info object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_info_by_id_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: UserInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/info/{userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get1(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def get_user_settings_using_get1_with_http_info(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_user_settings_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_token_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_token_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/token', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_users_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of user objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_users_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_users_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of user objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_users_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get users by Entity Group Id (getUsersByEntityGroupId) # noqa: E501 + + Returns a page of user objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get users by Entity Group Id (getUsersByEntityGroupId) # noqa: E501 + + Returns a page of user objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_users_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_by_ids_using_get(self, user_ids, **kwargs): # noqa: E501 + """Get Users By Ids (getUsersByIds) # noqa: E501 + + Requested users must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_ids_using_get(user_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_ids: A list of user ids, separated by comma ',' (required) + :return: list[User] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_by_ids_using_get_with_http_info(user_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_users_by_ids_using_get_with_http_info(user_ids, **kwargs) # noqa: E501 + return data + + def get_users_by_ids_using_get_with_http_info(self, user_ids, **kwargs): # noqa: E501 + """Get Users By Ids (getUsersByIds) # noqa: E501 + + Requested users must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_ids_using_get_with_http_info(user_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_ids: A list of user ids, separated by comma ',' (required) + :return: list[User] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_ids' is set + if ('user_ids' not in params or + params['user_ids'] is None): + raise ValueError("Missing the required parameter `user_ids` when calling `get_users_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'user_ids' in params: + query_params.append(('userIds', params['user_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users{?userIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[User]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_for_assign_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_for_assign_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_for_assign_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_for_assign_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/assign/{alarmId}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_user_token_access_enabled_using_get(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_user_token_access_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_user_token_access_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/tokenAccessEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def put_user_settings_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put1(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def put_user_settings_using_put1_with_http_info(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `put_user_settings_using_put1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def report_user_dashboard_action_using_get(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + else: + (data) = self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + return data + + def report_user_dashboard_action_using_get_with_http_info(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'action'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method report_user_dashboard_action_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + # verify the required parameter 'action' is set + if ('action' not in params or + params['action'] is None): + raise ValueError("Missing the required parameter `action` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + if 'action' in params: + path_params['action'] = params['action'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards/{dashboardId}/{action}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_settings_using_post(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_using_post(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user{?entityGroupId,entityGroupIds,sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_activation_email_using_post(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + else: + (data) = self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + return data + + def send_activation_email_using_post_with_http_info(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post_with_http_info(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_activation_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email' is set + if ('email' not in params or + params['email'] is None): + raise ValueError("Missing the required parameter `email` when calling `send_activation_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email' in params: + query_params.append(('email', params['email'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/sendActivationMail{?email}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_user_credentials_enabled_using_post(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def set_user_credentials_enabled_using_post_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'user_credentials_enabled'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_user_credentials_enabled_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `set_user_credentials_enabled_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'user_credentials_enabled' in params: + query_params.append(('userCredentialsEnabled', params['user_credentials_enabled'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/userCredentialsEnabled{?userCredentialsEnabled}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/user_permissions_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/user_permissions_controller_api.py new file mode 100644 index 0000000..8ea1681 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/user_permissions_controller_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UserPermissionsControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_allowed_permissions_using_get(self, **kwargs): # noqa: E501 + """Get Permissions (getAllowedPermissions) # noqa: E501 + + Returns a complex object that describes: * all possible (both granted and not granted) permissions for the authority of the user (Tenant or Customer); * all granted permissions for the user; The result impacts UI behavior and hides certain UI elements if user has no permissions to invoke the related operations. Nevertheless, all API calls check the permissions each time they are executed on the server side.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_allowed_permissions_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AllowedPermissionsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_allowed_permissions_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_allowed_permissions_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_allowed_permissions_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Permissions (getAllowedPermissions) # noqa: E501 + + Returns a complex object that describes: * all possible (both granted and not granted) permissions for the authority of the user (Tenant or Customer); * all granted permissions for the user; The result impacts UI behavior and hides certain UI elements if user has no permissions to invoke the related operations. Nevertheless, all API calls check the permissions each time they are executed on the server side.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_allowed_permissions_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AllowedPermissionsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_allowed_permissions_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/permissions/allowedPermissions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AllowedPermissionsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/white_labeling_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/white_labeling_controller_api.py new file mode 100644 index 0000000..336f83c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/white_labeling_controller_api.py @@ -0,0 +1,870 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WhiteLabelingControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_login_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get Login White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the Login White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the Login White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_login_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_login_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Login White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the Login White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the Login White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_login_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_login_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/currentLoginWhiteLabelParams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginWhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_current_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/currentWhiteLabelParams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_login_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get Login White Labeling parameters # noqa: E501 + + Returns login white-labeling parameters based on the hostname from request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_login_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Login White Labeling parameters # noqa: E501 + + Returns login white-labeling parameters based on the hostname from request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['logo_image_checksum', 'favicon_checksum'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_login_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'logo_image_checksum' in params: + query_params.append(('logoImageChecksum', params['logo_image_checksum'])) # noqa: E501 + if 'favicon_checksum' in params: + query_params.append(('faviconChecksum', params['favicon_checksum'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/whiteLabel/loginWhiteLabelParams{?faviconChecksum,logoImageChecksum}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginWhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get White Labeling parameters # noqa: E501 + + Returns white-labeling parameters for the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get White Labeling parameters # noqa: E501 + + Returns white-labeling parameters for the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['logo_image_checksum', 'favicon_checksum'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'logo_image_checksum' in params: + query_params.append(('logoImageChecksum', params['logo_image_checksum'])) # noqa: E501 + if 'favicon_checksum' in params: + query_params.append(('faviconChecksum', params['favicon_checksum'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/whiteLabelParams{?faviconChecksum,logoImageChecksum}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_customer_white_labeling_allowed_using_get(self, **kwargs): # noqa: E501 + """Check Customer White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the customers of the current tenant Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_customer_white_labeling_allowed_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_customer_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_customer_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_customer_white_labeling_allowed_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Customer White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the customers of the current tenant Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_customer_white_labeling_allowed_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_customer_white_labeling_allowed_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/isCustomerWhiteLabelingAllowed', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_white_labeling_allowed_using_get(self, **kwargs): # noqa: E501 + """Check White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the current user owner (tenant or customer) Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_white_labeling_allowed_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_white_labeling_allowed_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the current user owner (tenant or customer) Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_white_labeling_allowed_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_white_labeling_allowed_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/isWhiteLabelingAllowed', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def preview_white_label_params_using_post(self, **kwargs): # noqa: E501 + """Preview Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Merge the White Labeling configuration with the parent configuration and return the result. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.preview_white_label_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.preview_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.preview_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def preview_white_label_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Preview Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Merge the White Labeling configuration with the parent configuration and return the result. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.preview_white_label_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method preview_white_label_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/previewWhiteLabelParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_login_white_label_params_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_login_white_label_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginWhiteLabelingParams body: + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_login_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_login_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_login_white_label_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_login_white_label_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginWhiteLabelingParams body: + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_login_white_label_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/loginWhiteLabelParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginWhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_white_label_params_using_post(self, **kwargs): # noqa: E501 + """Create Or Update White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_white_label_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_white_label_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_white_label_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_white_label_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/whiteLabelParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/widget_type_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/widget_type_controller_api.py new file mode 100644 index 0000000..de5b239 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/widget_type_controller_api.py @@ -0,0 +1,752 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetTypeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widget_type_using_delete(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def delete_widget_type_using_delete_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widget_type_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `delete_widget_type_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_details_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_details_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_details_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesDetails{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeDetails]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_infos_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_infos_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesInfos{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypes{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetType]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_by_id_using_get(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def get_widget_type_by_id_using_get_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `get_widget_type_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_using_get(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + return data + + def get_widget_type_using_get_with_http_info(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias', 'alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'alias' is set + if ('alias' not in params or + params['alias'] is None): + raise ValueError("Missing the required parameter `alias` when calling `get_widget_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + if 'alias' in params: + query_params.append(('alias', params['alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType{?alias,bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetType', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widget_type_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widget_type_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widget_type_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api/api_pe/widgets_bundle_controller_api.py b/billinglayer/python/tb_rest_client/api/api_pe/widgets_bundle_controller_api.py new file mode 100644 index 0000000..b47738c --- /dev/null +++ b/billinglayer/python/tb_rest_client/api/api_pe/widgets_bundle_controller_api.py @@ -0,0 +1,629 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetsBundleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widgets_bundle_using_delete(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def delete_widgets_bundle_using_delete_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widgets_bundle_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `delete_widgets_bundle_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundle_by_id_using_get(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def get_widgets_bundle_by_id_using_get_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundle_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `get_widgets_bundle_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_by_ids_using_get(self, widgets_bundle_ids, **kwargs): # noqa: E501 + """Get Widgets Bundles By Ids (getWidgetsBundlesByIds) # noqa: E501 + + Requested widgets bundles must be system level or owned by tenant of the user which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_by_ids_using_get(widgets_bundle_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_ids: A list of widgets bundle ids, separated by comma ',' (required) + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_by_ids_using_get_with_http_info(widgets_bundle_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_by_ids_using_get_with_http_info(widgets_bundle_ids, **kwargs) # noqa: E501 + return data + + def get_widgets_bundles_by_ids_using_get_with_http_info(self, widgets_bundle_ids, **kwargs): # noqa: E501 + """Get Widgets Bundles By Ids (getWidgetsBundlesByIds) # noqa: E501 + + Requested widgets bundles must be system level or owned by tenant of the user which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_by_ids_using_get_with_http_info(widgets_bundle_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_ids: A list of widgets bundle ids, separated by comma ',' (required) + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_ids' is set + if ('widgets_bundle_ids' not in params or + params['widgets_bundle_ids'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_ids` when calling `get_widgets_bundles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'widgets_bundle_ids' in params: + query_params.append(('widgetsBundleIds', params['widgets_bundle_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles{?widgetsBundleIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetsBundle]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetsBundle]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get1(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get1_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataWidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widgets_bundle_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widgets_bundle_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widgets_bundle_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/billinglayer/python/tb_rest_client/api_client.py b/billinglayer/python/tb_rest_client/api_client.py new file mode 100644 index 0000000..d9512b8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/api_client.py @@ -0,0 +1,705 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import + +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from tb_rest_client.configuration import Configuration +import tb_rest_client.models.models_ce +import tb_rest_client.models.models_pe +from tb_rest_client import rest + + +class ApiClient(object): + """ + :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 + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + # Use the pool property to lazily initialize the ThreadPool. + self._pool = None + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/1.0.0/python' + + def __del__(self): + if self._pool is not None: + self._pool.close() + self._pool.join() + + @property + def pool(self): + if self._pool is None: + self._pool = ThreadPool() + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + 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)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + if isinstance(v, dict) and v.get("entityType") is not None and v.get('id') is not None: + v = v["id"] + # specified safe chars, encode everything + if v is not None: + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + '{?%s}' % k, + quote(str("?"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + '{?%s,' % k, + quote(str("?"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + ',%s' % k, + quote(str("&"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + ',?%s' % k, + quote(str("&"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + ',%s}' % k, + quote("}" + str(v) if v is not None else "", safe=config.safe_chars_for_path_param) + ) + # resource_path = resource_path.replace( + # '{%s}' % k, + # quote(str(k+"="+v), safe=config.safe_chars_for_path_param) + # ).replace( + # '{?%s}' % k, + # quote(str("?"+k+"="+v), safe=config.safe_chars_for_path_param) + # ).replace( + # '{?%s,' % k, + # quote(str("?"+k+"="+v) + "{", safe=config.safe_chars_for_path_param) + # ).replace( + # ',%s,' % k, + # quote("}" + str("&"+k+"="+v) + "{", safe=config.safe_chars_for_path_param) + # ).replace( + # ',?%s,' % k, + # quote("}" + str("&"+k+"="+v) + "{", safe=config.safe_chars_for_path_param) + # ).replace( + # ',%s}' % k, + # 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 = [param for param in query_params if (isinstance(param, tuple) and len(param) > 1 and param[1] is not None) or not isinstance(param, tuple)] + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = [param for param in post_params if (isinstance(param, tuple) and len(param) > 1 and param[1] is not None) or not isinstance(param, tuple)] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + clean_path = self.sanitize_path(resource_path) + url = self.configuration.host + clean_path + + # perform request and return response + response_data = 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) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_path(self, url): + pattern = r'(\{[\?a-zA-Z,]{1,}\})' + matching = re.search(pattern, url) + if matching is not None and len(matching.groups()) > 0: + for match in matching.groups(): + clean_url = url.replace(match, "") + else: + clean_url = url + return clean_url + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + If obj is None, return None. + 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 list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + 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() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + 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 data is None: + return None + + if "Deferred" in str(klass): + return self.__deserialize(data, type(data)) + # + # elif type(klass) == str: + # # convert str to class + elif klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + elif klass == list: + return_data = [self.__deserialize(sub_data, type(sub_data)) + for sub_data in data] + return return_data + + elif klass == dict: + return_data = {k: self.__deserialize(v, type(v)) + for k, v in six.iteritems(data)} + return return_data + elif type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + try: + found_class = getattr(tb_rest_client.models.models_pe, klass) + if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())): + klass = found_class + + # if all(attr in list(found_class.attribute_map.values()) for attr in list(data.keys())): + # klass = found_class + else: + found_class = getattr(tb_rest_client.models.models_ce, klass) + # if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())): + klass = found_class + + except AttributeError: + try: + found_class = getattr(tb_rest_client.models.models_ce, klass) + # if all(attr in list(found_class.attribute_map.values()) for attr in list(data.keys())): + # if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())): + klass = found_class + except AttributeError: + print('WARNING: received data fields not the same as in the {0} model (dyn fields problem)'.format( + klass)) + found_class = getattr(tb_rest_client.models.models_pe, klass) + klass = found_class + # else: + # return self.__deserialize(data, type(data)) + return self.__deserialize_data(data, klass) + + def __deserialize_data(self, data, klass): + try: + 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_datatime(data) + else: + return self.__deserialize_model(data, klass) + except Exception as e: + return e + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + To make an async request, set the async_req parameter. + :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: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :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. + """ + 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) + else: + thread = 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)) + return thread + + 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) + else: + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, 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(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """Builds form parameters. + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in six.iteritems(files): + if not v or k in ['attribute_map', 'discriminator']: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + 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): + """Returns `Accept` based on an array of accepts provided. + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + 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. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + :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: + 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: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + :param data: str. + :param klass: class literal. + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + 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) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + The string should be in iso8601 datetime format. + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + 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 __hasattr(self, object, name): + return name in object.__class__.__dict__ + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if (not klass.swagger_types and + not self.__hasattr(klass, 'get_real_child_model')): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in six.iteritems(klass.swagger_types): + if (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if (isinstance(instance, dict) and + klass.swagger_types is not None and + isinstance(data, dict)): + for key, value in data.items(): + if key not in klass.swagger_types: + instance[key] = value + if self.__hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance \ No newline at end of file diff --git a/billinglayer/python/tb_rest_client/configuration.py b/billinglayer/python/tb_rest_client/configuration.py new file mode 100644 index 0000000..b7d8846 --- /dev/null +++ b/billinglayer/python/tb_rest_client/configuration.py @@ -0,0 +1,234 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import six +from six.moves import http_client as httplib + + +class Configuration(object): + _default = None + + def __init__(self): + """Constructor""" + if self._default: + for key in self._default.__dict__.keys(): + self.__dict__[key] = copy.copy(self._default.__dict__[key]) + return + + # Default Base url + self.host = "http://127.0.0.1:8080" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # function to refresh API key if expired + self.refresh_api_key_hook = None + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("tb_rest_client") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API + # from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # 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 = multiprocessing.cpu_count() * 5 + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + @classmethod + def set_default(cls, default): + cls._default = default + + @property + def logger_file(self): + """The logger file. + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # 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 six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + The logger_formatter will be updated when sets logger_format. + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + The logger_formatter will be updated when sets logger_format. + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + :param identifier: The identifier of apiKey. + :return: The token for api_pe key authentication. + """ + + if self.refresh_api_key_hook: + self.refresh_api_key_hook(self) + + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api_pe client. + :return: The Auth Settings information dict. + """ + return { + 'X-Authorization': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'X-Authorization', + 'value': self.get_api_key_with_prefix('X-Authorization') + }, + + } + + def to_debug_report(self): + """Gets the essential information for debugging. + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n" \ + "OS: {env}\n" \ + "Python Version: {pyversion}\n" \ + "Version of the API: 2.0\n" \ + "SDK Package Version: 1.0.0". \ + format(env=sys.platform, pyversion=sys.version) diff --git a/billinglayer/python/tb_rest_client/models/__init__.py b/billinglayer/python/tb_rest_client/models/__init__.py new file mode 100644 index 0000000..5154646 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/billinglayer/python/tb_rest_client/models/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..92cf407 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__init__.py b/billinglayer/python/tb_rest_client/models/models_ce/__init__.py new file mode 100644 index 0000000..261f5c6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/__init__.py @@ -0,0 +1,394 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .default_device_profile_transport_configuration import DefaultDeviceProfileTransportConfiguration +from .json_node import JsonNode +from .page_data_edge import PageDataEdge +from .tenant_info import TenantInfo +from .admin_settings_id import AdminSettingsId +from .entity_data import EntityData +from .page_data_device import PageDataDevice +from .home_dashboard_info import HomeDashboardInfo +from .login_response import LoginResponse +from .widget_type import WidgetType +from .event_id import EventId +from .test_sms_request import TestSmsRequest +from .ota_package import OtaPackage +from .user import User +from .o_auth2_mobile_info import OAuth2MobileInfo +from .numeric_filter_predicate import NumericFilterPredicate +from .device_profile_alarm import DeviceProfileAlarm +from .ota_package_info import OtaPackageInfo +from .alarm_data import AlarmData +from .entity_id import EntityId +from .event import Event +from .complex_filter_predicate import ComplexFilterPredicate +from .edge_id import EdgeId +from .device_profile_data import DeviceProfileData +from .page_data_customer import PageDataCustomer +from .sign_up_request import SignUpRequest +from .save_ota_package_info_request import SaveOtaPackageInfoRequest +from .mqtt_device_transport_configuration import MqttDeviceTransportConfiguration +from .page_data_tb_resource_info import PageDataTbResourceInfo +from .home_dashboard import HomeDashboard +from .bulk_import_result_device import BulkImportResultDevice +from .device_search_query_filter import DeviceSearchQueryFilter +from .page_data_device_profile import PageDataDeviceProfile +from .dashboard_info import DashboardInfo +from .byte_buffer import ByteBuffer +from .entity_info import EntityInfo +from .edge import Edge +from .tenant import Tenant +from .entity_relations_query import EntityRelationsQuery +from .sms_provider_configuration import SmsProviderConfiguration +from .entity_relation_info import EntityRelationInfo +from .tenant_id import TenantId +from .filter_predicate_valueboolean import FilterPredicateValueboolean +from .component_descriptor import ComponentDescriptor +from .short_customer_info import ShortCustomerInfo +from .device_profile_info import DeviceProfileInfo +from .duration_alarm_condition_spec import DurationAlarmConditionSpec +from .o_auth2_registration_info import OAuth2RegistrationInfo +from .twilio_sms_provider_configuration import TwilioSmsProviderConfiguration +from .device_profile import DeviceProfile +from .lw_m2m_resource_observe import LwM2mResourceObserve +from .default_tenant_profile_configuration import DefaultTenantProfileConfiguration +from .check_pre_provisioned_devices_device_profile_provision_configuration import \ + CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration +from .page_data_dashboard_info import PageDataDashboardInfo +from .alarm_info import AlarmInfo +from .asset import Asset +from .o_auth2_client_info import OAuth2ClientInfo +from .page_data_user import PageDataUser +from .boolean_filter_predicate import BooleanFilterPredicate +from .rule_chain_id import RuleChainId +from .admin_settings import AdminSettings +from .o_auth2_client_registration_template import OAuth2ClientRegistrationTemplate +from .rule_node import RuleNode +from .other_configuration import OtherConfiguration +from .device_data import DeviceData +from .proto_transport_payload_configuration import ProtoTransportPayloadConfiguration +from .dashboard_id import DashboardId +from .change_password_request import ChangePasswordRequest +from .tenant_profile_data import TenantProfileData +from .device import Device +from .shared_attributes_setting_snmp_communication_config import SharedAttributesSettingSnmpCommunicationConfig +from .o_auth2_custom_mapper_config import OAuth2CustomMapperConfig +from .update_message import UpdateMessage +from .power_saving_configuration import PowerSavingConfiguration +from .ota_package_id import OtaPackageId +from .error_event_filter import ErrorEventFilter +from .alarm_schedule import AlarmSchedule +from .user_id import UserId +from .asset_type_filter import AssetTypeFilter +from .statistics_event_filter import StatisticsEventFilter +from .api_usage_state_filter import ApiUsageStateFilter +from .widgets_bundle_id import WidgetsBundleId +from .atomic_integer import AtomicInteger +from .security_settings import SecuritySettings +from .event_filter import EventFilter +from .lw_m2m_object import LwM2mObject +from .edge_search_query import EdgeSearchQuery +from .o_auth2_params_info import OAuth2ParamsInfo +from .entity_view_id import EntityViewId +from .alarm_condition_filter_key import AlarmConditionFilterKey +from .device_transport_configuration import DeviceTransportConfiguration +from .filter_predicate_valuedouble import FilterPredicateValuedouble +from .filter_predicate_valuestring import FilterPredicateValuestring +from .alarm_condition_filter import AlarmConditionFilter +from .alarm import Alarm +from .attributes_entity_view import AttributesEntityView +from .login_request import LoginRequest +from .entity_view import EntityView +from .page_data_device_profile_info import PageDataDeviceProfileInfo +from .device_profile_provision_configuration import DeviceProfileProvisionConfiguration +from .specific_time_schedule import SpecificTimeSchedule +from .o_auth2_info import OAuth2Info +from .activate_user_request import ActivateUserRequest +from .resource import Resource +from .default_device_transport_configuration import DefaultDeviceTransportConfiguration +from .telemetry_mapping_configuration import TelemetryMappingConfiguration +from .default_device_profile_configuration import DefaultDeviceProfileConfiguration +from .any_time_schedule import AnyTimeSchedule +from .page_data_tenant import PageDataTenant +from .allow_create_new_devices_device_profile_provision_configuration import \ + AllowCreateNewDevicesDeviceProfileProvisionConfiguration +from .to_device_rpc_request_snmp_communication_config import ToDeviceRpcRequestSnmpCommunicationConfig +from .default_device_configuration import DefaultDeviceConfiguration +from .widget_type_info import WidgetTypeInfo +from .entity_name_filter import EntityNameFilter +from .tb_resource_id import TbResourceId +from .efento_coap_device_type_configuration import EfentoCoapDeviceTypeConfiguration +from .edge_event import EdgeEvent +from .page_data_rule_chain import PageDataRuleChain +from .customer_id import CustomerId +from .snmp_device_transport_configuration import SnmpDeviceTransportConfiguration +from .alarm_rule import AlarmRule +from .key_filter import KeyFilter +from .client_attributes_querying_snmp_communication_config import ClientAttributesQueryingSnmpCommunicationConfig +from .rule_chain_import_result import RuleChainImportResult +from .input_stream import InputStream +from .edge_type_filter import EdgeTypeFilter +from .object_node import ObjectNode +from .device_configuration import DeviceConfiguration +from .entity_subtype import EntitySubtype +from .entity_key import EntityKey +from .device_type_filter import DeviceTypeFilter +from .edge_search_query_filter import EdgeSearchQueryFilter +from .save_device_with_credentials_request import SaveDeviceWithCredentialsRequest +from .bulk_import_result_edge import BulkImportResultEdge +from .lwm2m_device_transport_configuration import Lwm2mDeviceTransportConfiguration +from .response_entity import ResponseEntity +from .page_data_event import PageDataEvent +from .entity_list_filter import EntityListFilter +from .deferred_result_response_entity import DeferredResultResponseEntity +from .entity_type_filter import EntityTypeFilter +from .custom_time_schedule import CustomTimeSchedule +from .snmp_communication_config import SnmpCommunicationConfig +from .dashboard import Dashboard +from .rule_chain_meta_data import RuleChainMetaData +from .filter_predicate_valueint import FilterPredicateValueint +from .bulk_import_result_asset import BulkImportResultAsset +from .edge_event_id import EdgeEventId +from .column_mapping import ColumnMapping +from .claim_request import ClaimRequest +from .filter_predicate_valuelong import FilterPredicateValuelong +from .widget_type_id import WidgetTypeId +from .relations_search_parameters import RelationsSearchParameters +from .thingsboard_credentials_expired_response import ThingsboardCredentialsExpiredResponse +from .o_auth2_basic_mapper_config import OAuth2BasicMapperConfig +from .page_data_widgets_bundle import PageDataWidgetsBundle +from .simple_alarm_condition_spec import SimpleAlarmConditionSpec +from .rpc import Rpc +from .widgets_bundle import WidgetsBundle +from .rpc_id import RpcId +from .page_data_entity_info import PageDataEntityInfo +from .page_data_alarm_data import PageDataAlarmData +from .default_rule_chain_create_request import DefaultRuleChainCreateRequest +from .transport_payload_type_configuration import TransportPayloadTypeConfiguration +from .ts_value import TsValue +from .telemetry_querying_snmp_communication_config import TelemetryQueryingSnmpCommunicationConfig +from .device_profile_configuration import DeviceProfileConfiguration +from .page_data_asset import PageDataAsset +from .entity_data_query import EntityDataQuery +from .entity_count_query import EntityCountQuery +from .entity_view_search_query import EntityViewSearchQuery +from .o_auth2_domain_info import OAuth2DomainInfo +from .bulk_import_request import BulkImportRequest +from .node_connection_info import NodeConnectionInfo +from .entity_data_page_link import EntityDataPageLink +from .dynamic_valueint import DynamicValueint +from .thingsboard_error_response import ThingsboardErrorResponse +from .coap_device_transport_configuration import CoapDeviceTransportConfiguration +from .string_filter_predicate import StringFilterPredicate +from .snmp_mapping import SnmpMapping +from .mqtt_device_profile_transport_configuration import MqttDeviceProfileTransportConfiguration +from .device_credentials import DeviceCredentials +from .telemetry_entity_view import TelemetryEntityView +from .single_entity_filter import SingleEntityFilter +from .entity_view_search_query_filter import EntityViewSearchQueryFilter +from .disabled_device_profile_provision_configuration import DisabledDeviceProfileProvisionConfiguration +from .asset_search_query import AssetSearchQuery +from .entity_filter import EntityFilter +from .entity_view_type_filter import EntityViewTypeFilter +from .page_data_alarm_info import PageDataAlarmInfo +from .page_data_entity_data import PageDataEntityData +from .dynamic_valueboolean import DynamicValueboolean +from .page_data_tenant_info import PageDataTenantInfo +from .page_data_audit_log import PageDataAuditLog +from .tenant_profile_configuration import TenantProfileConfiguration +from .customer import Customer +from .dynamic_valuelong import DynamicValuelong +from .device_profile_transport_configuration import DeviceProfileTransportConfiguration +from .tb_resource_info import TbResourceInfo +from .widget_type_details import WidgetTypeDetails +from .object_attributes import ObjectAttributes +from .relation_entity_type_filter import RelationEntityTypeFilter +from .asset_search_query_filter import AssetSearchQueryFilter +from .reset_password_email_request import ResetPasswordEmailRequest +from .tenant_profile_id import TenantProfileId +from .tenant_profile import TenantProfile +from .key_filter_predicate import KeyFilterPredicate +from .o_auth2_mapper_config import OAuth2MapperConfig +from .default_coap_device_type_configuration import DefaultCoapDeviceTypeConfiguration +from .snmp_device_profile_transport_configuration import SnmpDeviceProfileTransportConfiguration +from .life_cycle_event_filter import LifeCycleEventFilter +from .relations_query_filter import RelationsQueryFilter +from .alarm_condition import AlarmCondition +from .rule_chain_data import RuleChainData +from .dynamic_valuedouble import DynamicValuedouble +from .dynamic_valuestring import DynamicValuestring +from .lw_m2m_instance import LwM2mInstance +from .repeating_alarm_condition_spec import RepeatingAlarmConditionSpec +from .page_data_tenant_profile import PageDataTenantProfile +from .custom_time_schedule_item import CustomTimeScheduleItem +from .mapping import Mapping +from .page_data_entity_view import PageDataEntityView +from .user_password_policy import UserPasswordPolicy +from .page_data_edge_event import PageDataEdgeEvent +from .device_id import DeviceId +from .aws_sns_sms_provider_configuration import AwsSnsSmsProviderConfiguration +from .lwm2m_device_profile_transport_configuration import Lwm2mDeviceProfileTransportConfiguration +from .component_descriptor_id import ComponentDescriptorId +from .entity_relation import EntityRelation +from .o_auth2_client_registration_template_id import OAuth2ClientRegistrationTemplateId +from .alarm_id import AlarmId +from .audit_log import AuditLog +from .alarm_data_page_link import AlarmDataPageLink +from .device_search_query import DeviceSearchQuery +from .debug_rule_chain_event_filter import DebugRuleChainEventFilter +from .alarm_data_query import AlarmDataQuery +from .alarm_condition_spec import AlarmConditionSpec +from .coap_device_type_configuration import CoapDeviceTypeConfiguration +from .reset_password_request import ResetPasswordRequest +from .asset_id import AssetId +from .tb_resource import TbResource +from .device_credentials_id import DeviceCredentialsId +from .rule_node_id import RuleNodeId +from .rule_chain_connection_info import RuleChainConnectionInfo +from .audit_log_id import AuditLogId +from .device_profile_id import DeviceProfileId +from .coap_device_profile_transport_configuration import CoapDeviceProfileTransportConfiguration +from .json_transport_payload_configuration import JsonTransportPayloadConfiguration +from .entity_data_sort_order import EntityDataSortOrder +from .page_data_ota_package_info import PageDataOtaPackageInfo +from .rule_chain import RuleChain +from .page_data_asset_info import PageDataAssetInfo +from .device_info import DeviceInfo +from .edge_info import EdgeInfo +from .page_data_entity_view_info import PageDataEntityViewInfo +from .page_data_edge_info import PageDataEdgeInfo +from .lw_m2_m_server_security_config_default import LwM2MServerSecurityConfigDefault +from .server_security_config import ServerSecurityConfig +from .no_sec_lw_m2_m_bootstrap_server_credential import NoSecLwM2MBootstrapServerCredential +from .rule_chain_output_labels_usage import RuleChainOutputLabelsUsage +from .asset_info import AssetInfo +from .page_data_device_info import PageDataDeviceInfo +from .entity_view_info import EntityViewInfo +from .x509_lw_m2_m_bootstrap_server_credential import X509LwM2MBootstrapServerCredential +from .lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential +from .queue import Queue +from .queue_id import QueueId +from .version_load_request import VersionLoadRequest +from .version_create_request import VersionCreateRequest +from .entity_export_dataobject import EntityExportDataobject +from .two_fa_account_config import TwoFaAccountConfig +from .two_fa_provider_config import TwoFaProviderConfig +from .transport_payload_type_configuration import TransportPayloadTypeConfiguration +from .version_creation_result import VersionCreationResult +from .entity_version import EntityVersion +from .version_load_result import VersionLoadResult +from .entity_type_load_result import EntityTypeLoadResult +from .entity_version import EntityVersion +from .complex_version_create_request import ComplexVersionCreateRequest +from .version_load_config import VersionLoadConfig +from .single_entity_version_load_request import SingleEntityVersionLoadRequest +from .entity_type_version_load_request import EntityTypeVersionLoadRequest +from .version_create_config import VersionCreateConfig +from .single_entity_version_create_request import SingleEntityVersionCreateRequest +from .entity_type_version_create_config import EntityTypeVersionCreateConfig +from .entity_type_version_load_config import EntityTypeVersionLoadConfig +from .repository_settings import RepositorySettings +from .deferred_result_repository_settings import DeferredResultRepositorySettings +from .deferred_result_void import DeferredResultVoid +from .auto_version_create_config import AutoVersionCreateConfig +from .platform_two_fa_settings import PlatformTwoFaSettings +from .account_two_fa_settings import AccountTwoFaSettings +from .two_fa_account_config_update_request import TwoFaAccountConfigUpdateRequest +from .two_fa_provider_info import TwoFaProviderInfo +from .entity_load_error import EntityLoadError +from .jwt_settings import JWTSettings +from .jwt_pair import JWTPair +from .alarm_comment import AlarmComment +from .alarm_comment_id import AlarmCommentId +from .alarm_comment_info import AlarmCommentInfo +from .alarm_assignee import AlarmAssignee +from .alarm_assignment_notification_rule_trigger_config import AlarmAssignmentNotificationRuleTriggerConfig +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .alarm_count_query import AlarmCountQuery +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .all_users_filter import AllUsersFilter +from .api_usage_limit_notification_rule_trigger_config import ApiUsageLimitNotificationRuleTriggerConfig +from .asset_profile import AssetProfile +from .asset_profile_id import AssetProfileId +from .asset_profile_info import AssetProfileInfo +from .clear_rule import ClearRule +from .comparison_ts_value import ComparisonTsValue +from .customer_users_filter import CustomerUsersFilter +from .delivery_method_notification_template import DeliveryMethodNotificationTemplate +from .device_activity_notification_rule_trigger_config import DeviceActivityNotificationRuleTriggerConfig +from .edge_install_instructions import EdgeInstallInstructions +from .email_delivery_method_notification_template import EmailDeliveryMethodNotificationTemplate +from .entities_limit_notification_rule_trigger_config import EntitiesLimitNotificationRuleTriggerConfig +from .entity_action_notification_rule_trigger_config import EntityActionNotificationRuleTriggerConfig +from .escalated_notification_rule_recipients_config import EscalatedNotificationRuleRecipientsConfig +from .event_info import EventInfo +from .features_info import FeaturesInfo +from .last_visited_dashboard_info import LastVisitedDashboardInfo +from .new_platform_version_notification_rule_trigger_config import NewPlatformVersionNotificationRuleTriggerConfig +from .notification import Notification +from .notification_delivery_method_config import NotificationDeliveryMethodConfig +from .notification_id import NotificationId +from .notification_info import NotificationInfo +from .notification_request import NotificationRequest +from .notification_request_config import NotificationRequestConfig +from .notification_request_id import NotificationRequestId +from .notification_request_info import NotificationRequestInfo +from .notification_request_preview import NotificationRequestPreview +from .notification_request_stats import NotificationRequestStats +from .notification_rule import NotificationRule +from .notification_rule_config import NotificationRuleConfig +from .notification_rule_id import NotificationRuleId +from .notification_rule_info import NotificationRuleInfo +from .notification_rule_recipients_config import NotificationRuleRecipientsConfig +from .notification_rule_trigger_config import NotificationRuleTriggerConfig +from .notification_settings import NotificationSettings +from .notification_target import NotificationTarget +from .notification_target_config import NotificationTargetConfig +from .notification_target_id import NotificationTargetId +from .notification_template import NotificationTemplate +from .notification_template_config import NotificationTemplateConfig +from .notification_template_id import NotificationTemplateId +from .originator_entity_owner_users_filter import OriginatorEntityOwnerUsersFilter +from .page_data_alarm_comment_info import PageDataAlarmCommentInfo +from .page_data_asset_profile import PageDataAssetProfile +from .page_data_asset_profile_info import PageDataAssetProfileInfo +from .page_data_event_info import PageDataEventInfo +from .page_data_notification import PageDataNotification +from .page_data_notification_request_info import PageDataNotificationRequestInfo +from .page_data_notification_rule_info import PageDataNotificationRuleInfo +from .page_data_notification_target import PageDataNotificationTarget +from .page_data_notification_template import PageDataNotificationTemplate +from .page_data_user_email_info import PageDataUserEmailInfo +from .platform_users_notification_target_config import PlatformUsersNotificationTargetConfig +from .repository_settings_info import RepositorySettingsInfo +from .rule_chain_debug_event_filter import RuleChainDebugEventFilter +from .rule_engine_component_lifecycle_event_notification_rule_trigger_config import RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig +from .slack_conversation import SlackConversation +from .slack_delivery_method_notification_template import SlackDeliveryMethodNotificationTemplate +from .slack_notification_delivery_method_config import SlackNotificationDeliveryMethodConfig +from .slack_notification_target_config import SlackNotificationTargetConfig +from .sms_delivery_method_notification_template import SmsDeliveryMethodNotificationTemplate +from .starred_dashboard_info import StarredDashboardInfo +from .system_administrators_filter import SystemAdministratorsFilter +from .system_info import SystemInfo +from .system_info_data import SystemInfoData +from .tenant_administrators_filter import TenantAdministratorsFilter +from .usage_info import UsageInfo +from .user_dashboards_info import UserDashboardsInfo +from .user_email_info import UserEmailInfo +from .user_list_filter import UserListFilter +from .users_filter import UsersFilter +from .web_delivery_method_notification_template import WebDeliveryMethodNotificationTemplate +from .x509_certificate_chain_provision_configuration import X509CertificateChainProvisionConfiguration diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1e8e07d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/account_two_fa_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/account_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..c4a408e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/account_two_fa_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/activate_user_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/activate_user_request.cpython-311.pyc new file mode 100644 index 0000000..289c9f8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/activate_user_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/admin_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/admin_settings.cpython-311.pyc new file mode 100644 index 0000000..8738ce4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/admin_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/admin_settings_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/admin_settings_id.cpython-311.pyc new file mode 100644 index 0000000..49c2067 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/admin_settings_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..7332586 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/affected_user_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/affected_user_filter.cpython-311.pyc new file mode 100644 index 0000000..a3e4ec8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/affected_user_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm.cpython-311.pyc new file mode 100644 index 0000000..8b5bb3b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignee.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignee.cpython-311.pyc new file mode 100644 index 0000000..20f8ba7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignee.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..ae29854 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment.cpython-311.pyc new file mode 100644 index 0000000..cc4883a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_id.cpython-311.pyc new file mode 100644 index 0000000..7ee5846 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_info.cpython-311.pyc new file mode 100644 index 0000000..9606541 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..49ea9a6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition.cpython-311.pyc new file mode 100644 index 0000000..23cb9eb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter.cpython-311.pyc new file mode 100644 index 0000000..af996dc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter_key.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter_key.cpython-311.pyc new file mode 100644 index 0000000..3c59f43 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter_key.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..3150e3d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_count_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_count_query.cpython-311.pyc new file mode 100644 index 0000000..65ee186 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_count_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data.cpython-311.pyc new file mode 100644 index 0000000..8bdd333 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_page_link.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..289937c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_page_link.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_query.cpython-311.pyc new file mode 100644 index 0000000..bfe3a5c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_id.cpython-311.pyc new file mode 100644 index 0000000..d7d72f5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_info.cpython-311.pyc new file mode 100644 index 0000000..793d62a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..4a1212f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_rule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_rule.cpython-311.pyc new file mode 100644 index 0000000..17a02e8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_rule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_schedule.cpython-311.pyc new file mode 100644 index 0000000..31bbbc9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/alarm_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/all_users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/all_users_filter.cpython-311.pyc new file mode 100644 index 0000000..22cd746 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/all_users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..6658623 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/any_time_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/any_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..dbe0645 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/any_time_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..14159c6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/api_usage_state_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/api_usage_state_filter.cpython-311.pyc new file mode 100644 index 0000000..59996be Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/api_usage_state_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset.cpython-311.pyc new file mode 100644 index 0000000..d7753ea Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_id.cpython-311.pyc new file mode 100644 index 0000000..f511ec6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_info.cpython-311.pyc new file mode 100644 index 0000000..2b7813a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile.cpython-311.pyc new file mode 100644 index 0000000..5d19f9c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_id.cpython-311.pyc new file mode 100644 index 0000000..438f66c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_info.cpython-311.pyc new file mode 100644 index 0000000..adb7518 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query.cpython-311.pyc new file mode 100644 index 0000000..2e27852 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..fa7b7bd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_type_filter.cpython-311.pyc new file mode 100644 index 0000000..71ddb4c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/asset_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/atomic_integer.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/atomic_integer.cpython-311.pyc new file mode 100644 index 0000000..af118d4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/atomic_integer.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/attribute_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/attribute_export_data.cpython-311.pyc new file mode 100644 index 0000000..8b346ce Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/attribute_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/attributes_entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/attributes_entity_view.cpython-311.pyc new file mode 100644 index 0000000..1183a27 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/attributes_entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/audit_log.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/audit_log.cpython-311.pyc new file mode 100644 index 0000000..009f432 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/audit_log.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/audit_log_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/audit_log_id.cpython-311.pyc new file mode 100644 index 0000000..a992eff Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/audit_log_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/auto_version_create_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/auto_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..b65d714 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/auto_version_create_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..22a29cc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..49c18ce Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..adf7bbd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/boolean_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/boolean_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..4002c8a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/boolean_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/branch_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/branch_info.cpython-311.pyc new file mode 100644 index 0000000..ca0a865 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/branch_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_request.cpython-311.pyc new file mode 100644 index 0000000..2a1dcdc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_asset.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_asset.cpython-311.pyc new file mode 100644 index 0000000..0497ae5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_asset.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_device.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_device.cpython-311.pyc new file mode 100644 index 0000000..5156e13 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_device.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_edge.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_edge.cpython-311.pyc new file mode 100644 index 0000000..d2c407f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_edge.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/byte_buffer.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/byte_buffer.cpython-311.pyc new file mode 100644 index 0000000..dc9184d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/byte_buffer.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/change_password_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/change_password_request.cpython-311.pyc new file mode 100644 index 0000000..2f1c285 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/change_password_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..685599d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/claim_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/claim_request.cpython-311.pyc new file mode 100644 index 0000000..a65ca84 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/claim_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/clear_rule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/clear_rule.cpython-311.pyc new file mode 100644 index 0000000..03920d9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/clear_rule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..a86a239 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..29bbfae Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..5cad3f2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..182a8ac Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/coap_device_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/column_mapping.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/column_mapping.cpython-311.pyc new file mode 100644 index 0000000..129b4b6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/column_mapping.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/comparison_ts_value.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/comparison_ts_value.cpython-311.pyc new file mode 100644 index 0000000..f56161e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/comparison_ts_value.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/complex_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/complex_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..9ebdef8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/complex_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/complex_version_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/complex_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..0f9d77a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/complex_version_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor.cpython-311.pyc new file mode 100644 index 0000000..08132ff Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor_id.cpython-311.pyc new file mode 100644 index 0000000..b90286b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..5dc61a9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule_item.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule_item.cpython-311.pyc new file mode 100644 index 0000000..573c2ae Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule_item.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer.cpython-311.pyc new file mode 100644 index 0000000..9c6b316 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer_id.cpython-311.pyc new file mode 100644 index 0000000..a66c174 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer_users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer_users_filter.cpython-311.pyc new file mode 100644 index 0000000..0a80373 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/customer_users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard.cpython-311.pyc new file mode 100644 index 0000000..21f2cab Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard_id.cpython-311.pyc new file mode 100644 index 0000000..a241185 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..201c854 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc new file mode 100644 index 0000000..893eee1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_coap_device_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..229d6db Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_coap_device_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_configuration.cpython-311.pyc new file mode 100644 index 0000000..cb64bb4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..ca4cc75 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..3afca08 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..a22b075 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_rule_chain_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_rule_chain_create_request.cpython-311.pyc new file mode 100644 index 0000000..c9f4f1b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_rule_chain_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_tenant_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..54bdcec Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/default_tenant_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..0637fa0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..83d590e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_branch_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_branch_info.cpython-311.pyc new file mode 100644 index 0000000..5aa9b67 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_branch_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..0fde29c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..5a0a653 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_repository_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_repository_settings.cpython-311.pyc new file mode 100644 index 0000000..a32380c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_repository_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_response_entity.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_response_entity.cpython-311.pyc new file mode 100644 index 0000000..6982c03 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_response_entity.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_void.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_void.cpython-311.pyc new file mode 100644 index 0000000..c9d262b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_void.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_resultuuid.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_resultuuid.cpython-311.pyc new file mode 100644 index 0000000..887551a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/deferred_resultuuid.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..b476e55 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device.cpython-311.pyc new file mode 100644 index 0000000..b36efce Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..9a66e67 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_configuration.cpython-311.pyc new file mode 100644 index 0000000..ae30aac Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_credentials.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_credentials.cpython-311.pyc new file mode 100644 index 0000000..3809188 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_credentials.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_credentials_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_credentials_id.cpython-311.pyc new file mode 100644 index 0000000..0f05acb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_credentials_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_data.cpython-311.pyc new file mode 100644 index 0000000..c302390 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_export_data.cpython-311.pyc new file mode 100644 index 0000000..e7a1e2a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_id.cpython-311.pyc new file mode 100644 index 0000000..2f5b16c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_info.cpython-311.pyc new file mode 100644 index 0000000..aeee6eb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile.cpython-311.pyc new file mode 100644 index 0000000..72bcb17 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_alarm.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_alarm.cpython-311.pyc new file mode 100644 index 0000000..9aaa0ad Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_alarm.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..1512a7b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_data.cpython-311.pyc new file mode 100644 index 0000000..281f071 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_id.cpython-311.pyc new file mode 100644 index 0000000..ffd1789 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_info.cpython-311.pyc new file mode 100644 index 0000000..f01e2ee Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..26e8800 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..ea18df2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_search_query.cpython-311.pyc new file mode 100644 index 0000000..220c027 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..983ba87 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..9e6e6dd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_type_filter.cpython-311.pyc new file mode 100644 index 0000000..73b94b4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/device_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..eb386b5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/duration_alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/duration_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..77d5838 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/duration_alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueboolean.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..bce6b43 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueboolean.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuedouble.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..51ad1ef Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuedouble.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueint.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueint.cpython-311.pyc new file mode 100644 index 0000000..23d5c48 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueint.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuelong.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuelong.cpython-311.pyc new file mode 100644 index 0000000..0bb8cc7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuelong.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuestring.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuestring.cpython-311.pyc new file mode 100644 index 0000000..0c2a3b6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuestring.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge.cpython-311.pyc new file mode 100644 index 0000000..649da58 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_event.cpython-311.pyc new file mode 100644 index 0000000..bd50d4c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_event_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_event_id.cpython-311.pyc new file mode 100644 index 0000000..2a841ad Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_event_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_id.cpython-311.pyc new file mode 100644 index 0000000..1997dc2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_info.cpython-311.pyc new file mode 100644 index 0000000..5afa302 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_install_instructions.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_install_instructions.cpython-311.pyc new file mode 100644 index 0000000..1a96d24 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_install_instructions.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query.cpython-311.pyc new file mode 100644 index 0000000..7e56e05 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..434b1be Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_type_filter.cpython-311.pyc new file mode 100644 index 0000000..42efea5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/edge_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..32cc376 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..67fbe82 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..05cb743 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..6c14c5f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..8d97501 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..b0c259b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_count_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_count_query.cpython-311.pyc new file mode 100644 index 0000000..defbb24 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_count_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data.cpython-311.pyc new file mode 100644 index 0000000..dff458c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_diff.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..811af34 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_diff.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..b9864bf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_page_link.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..6142904 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_page_link.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_query.cpython-311.pyc new file mode 100644 index 0000000..d916cfd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_sort_order.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_sort_order.cpython-311.pyc new file mode 100644 index 0000000..a480658 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_data_sort_order.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_export_dataobject.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_export_dataobject.cpython-311.pyc new file mode 100644 index 0000000..0eb3dfb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_export_dataobject.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_filter.cpython-311.pyc new file mode 100644 index 0000000..9fb45eb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_id.cpython-311.pyc new file mode 100644 index 0000000..aa9e44c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_info.cpython-311.pyc new file mode 100644 index 0000000..6d0e9bb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_key.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_key.cpython-311.pyc new file mode 100644 index 0000000..ad0b1cc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_key.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_list_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_list_filter.cpython-311.pyc new file mode 100644 index 0000000..ae26d30 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_list_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_load_error.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_load_error.cpython-311.pyc new file mode 100644 index 0000000..b1a169f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_load_error.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_name_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_name_filter.cpython-311.pyc new file mode 100644 index 0000000..d3933a1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_name_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relation.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relation.cpython-311.pyc new file mode 100644 index 0000000..3df8294 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relation.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relation_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relation_info.cpython-311.pyc new file mode 100644 index 0000000..d7da184 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relation_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relations_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relations_query.cpython-311.pyc new file mode 100644 index 0000000..18b8a13 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_relations_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_subtype.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_subtype.cpython-311.pyc new file mode 100644 index 0000000..f55664e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_subtype.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..4ce8067 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_load_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_load_result.cpython-311.pyc new file mode 100644 index 0000000..7bfd0c1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_load_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_create_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..2b6561d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_create_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_config.cpython-311.pyc new file mode 100644 index 0000000..c8bcdcf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..cc22e28 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_version.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_version.cpython-311.pyc new file mode 100644 index 0000000..c3a6713 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_version.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view.cpython-311.pyc new file mode 100644 index 0000000..b64380f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_id.cpython-311.pyc new file mode 100644 index 0000000..412c0b8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..59c08bf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query.cpython-311.pyc new file mode 100644 index 0000000..4880957 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..88077a0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_type_filter.cpython-311.pyc new file mode 100644 index 0000000..4dc283d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/entity_view_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/error_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/error_event_filter.cpython-311.pyc new file mode 100644 index 0000000..8ddaa5e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/error_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..cd90df9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event.cpython-311.pyc new file mode 100644 index 0000000..35f4d2b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_filter.cpython-311.pyc new file mode 100644 index 0000000..2ef10f3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_id.cpython-311.pyc new file mode 100644 index 0000000..99c1f6d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_info.cpython-311.pyc new file mode 100644 index 0000000..f9e2bd1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/event_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/features_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/features_info.cpython-311.pyc new file mode 100644 index 0000000..92b6b70 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/features_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/file.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/file.cpython-311.pyc new file mode 100644 index 0000000..f77d736 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/file.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueboolean.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..ab876fc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueboolean.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuedouble.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..3a1c91b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuedouble.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueint.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueint.cpython-311.pyc new file mode 100644 index 0000000..218cff3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueint.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuelong.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuelong.cpython-311.pyc new file mode 100644 index 0000000..5850a49 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuelong.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuestring.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuestring.cpython-311.pyc new file mode 100644 index 0000000..9bd71b7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuestring.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard.cpython-311.pyc new file mode 100644 index 0000000..89d9083 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..0071fa0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/input_stream.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/input_stream.cpython-311.pyc new file mode 100644 index 0000000..5378a2d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/input_stream.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/json_node.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/json_node.cpython-311.pyc new file mode 100644 index 0000000..9447d60 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/json_node.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/json_transport_payload_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/json_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..b854a0b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/json_transport_payload_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/jwt_pair.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/jwt_pair.cpython-311.pyc new file mode 100644 index 0000000..8fc5b3c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/jwt_pair.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/jwt_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/jwt_settings.cpython-311.pyc new file mode 100644 index 0000000..aa19f3e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/jwt_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/key_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/key_filter.cpython-311.pyc new file mode 100644 index 0000000..0408a97 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/key_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/key_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/key_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..d9362df Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/key_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/last_visited_dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/last_visited_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..01e9857 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/last_visited_dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/life_cycle_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/life_cycle_event_filter.cpython-311.pyc new file mode 100644 index 0000000..3c55e2f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/life_cycle_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/login_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/login_request.cpython-311.pyc new file mode 100644 index 0000000..68f15d6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/login_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/login_response.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/login_response.cpython-311.pyc new file mode 100644 index 0000000..412761f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/login_response.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..b7d3904 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc new file mode 100644 index 0000000..80ab5ef Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_instance.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_instance.cpython-311.pyc new file mode 100644 index 0000000..c3b18d0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_instance.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_object.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_object.cpython-311.pyc new file mode 100644 index 0000000..139223c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_object.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_resource_observe.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_resource_observe.cpython-311.pyc new file mode 100644 index 0000000..b5a1468 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_resource_observe.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..991a8ed Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..903322c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mapping.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mapping.cpython-311.pyc new file mode 100644 index 0000000..73706d6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mapping.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..b210a59 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..ba6a827 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..2ea08a8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..4c0b69f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/node_connection_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/node_connection_info.cpython-311.pyc new file mode 100644 index 0000000..450092a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/node_connection_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification.cpython-311.pyc new file mode 100644 index 0000000..35074b5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_delivery_method_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..5ccf63b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_delivery_method_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_id.cpython-311.pyc new file mode 100644 index 0000000..038e040 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_info.cpython-311.pyc new file mode 100644 index 0000000..0bbbdc8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request.cpython-311.pyc new file mode 100644 index 0000000..43e9f08 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_config.cpython-311.pyc new file mode 100644 index 0000000..4b3c4ed Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_id.cpython-311.pyc new file mode 100644 index 0000000..ddf6aab Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_info.cpython-311.pyc new file mode 100644 index 0000000..b5ed4a3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_preview.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_preview.cpython-311.pyc new file mode 100644 index 0000000..54dbbad Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_preview.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_stats.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_stats.cpython-311.pyc new file mode 100644 index 0000000..d292e6e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_request_stats.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule.cpython-311.pyc new file mode 100644 index 0000000..fd56464 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_config.cpython-311.pyc new file mode 100644 index 0000000..8166417 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_id.cpython-311.pyc new file mode 100644 index 0000000..45298f7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_info.cpython-311.pyc new file mode 100644 index 0000000..8fc3011 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_recipients_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..bcfd11c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_recipients_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..1ba61a0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_settings.cpython-311.pyc new file mode 100644 index 0000000..43c302e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target.cpython-311.pyc new file mode 100644 index 0000000..6d6a296 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..6669ed6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target_id.cpython-311.pyc new file mode 100644 index 0000000..64a05d9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_target_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template.cpython-311.pyc new file mode 100644 index 0000000..91a6216 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template_config.cpython-311.pyc new file mode 100644 index 0000000..e3fda7e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template_id.cpython-311.pyc new file mode 100644 index 0000000..25a5e21 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/notification_template_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/numeric_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/numeric_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..bc82d40 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/numeric_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..d9881cc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_info.cpython-311.pyc new file mode 100644 index 0000000..793107e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template.cpython-311.pyc new file mode 100644 index 0000000..32f4b28 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc new file mode 100644 index 0000000..994b3b6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..3fb1ae4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_domain_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_domain_info.cpython-311.pyc new file mode 100644 index 0000000..497c13c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_domain_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_info.cpython-311.pyc new file mode 100644 index 0000000..7e51415 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mapper_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..e1a873a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mapper_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mobile_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mobile_info.cpython-311.pyc new file mode 100644 index 0000000..4e893f9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mobile_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_params_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_params_info.cpython-311.pyc new file mode 100644 index 0000000..e705c27 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_params_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_registration_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_registration_info.cpython-311.pyc new file mode 100644 index 0000000..bb9871f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_registration_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/object_attributes.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/object_attributes.cpython-311.pyc new file mode 100644 index 0000000..d5ba532 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/object_attributes.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/object_node.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/object_node.cpython-311.pyc new file mode 100644 index 0000000..8b74c6e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/object_node.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc new file mode 100644 index 0000000..b502309 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package.cpython-311.pyc new file mode 100644 index 0000000..1e24f87 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_id.cpython-311.pyc new file mode 100644 index 0000000..19ca42b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..aa3a544 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc new file mode 100644 index 0000000..41bc8aa Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_idchecksumchecksum_algorithm_body.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_idchecksumchecksum_algorithm_body.cpython-311.pyc new file mode 100644 index 0000000..0843284 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_idchecksumchecksum_algorithm_body.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/other_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/other_configuration.cpython-311.pyc new file mode 100644 index 0000000..c129194 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/other_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_comment_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_comment_info.cpython-311.pyc new file mode 100644 index 0000000..e0bc10b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_comment_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_data.cpython-311.pyc new file mode 100644 index 0000000..f15b676 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_info.cpython-311.pyc new file mode 100644 index 0000000..ff99aac Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset.cpython-311.pyc new file mode 100644 index 0000000..6f22348 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_info.cpython-311.pyc new file mode 100644 index 0000000..0483f78 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile.cpython-311.pyc new file mode 100644 index 0000000..b45aac6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile_info.cpython-311.pyc new file mode 100644 index 0000000..a886479 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_audit_log.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_audit_log.cpython-311.pyc new file mode 100644 index 0000000..4f24b7c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_audit_log.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_customer.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_customer.cpython-311.pyc new file mode 100644 index 0000000..c03ce9d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_customer.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..ddc3d12 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device.cpython-311.pyc new file mode 100644 index 0000000..be63b6d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_info.cpython-311.pyc new file mode 100644 index 0000000..2312d70 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile.cpython-311.pyc new file mode 100644 index 0000000..d0f7eea Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile_info.cpython-311.pyc new file mode 100644 index 0000000..1eae2e6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge.cpython-311.pyc new file mode 100644 index 0000000..86eb3c7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_event.cpython-311.pyc new file mode 100644 index 0000000..f7e478d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_info.cpython-311.pyc new file mode 100644 index 0000000..9724428 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_data.cpython-311.pyc new file mode 100644 index 0000000..6b3a02b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_info.cpython-311.pyc new file mode 100644 index 0000000..11c7123 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_version.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..9da7061 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_version.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view.cpython-311.pyc new file mode 100644 index 0000000..b447029 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..8a9e445 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_event.cpython-311.pyc new file mode 100644 index 0000000..8103612 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_event_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_event_info.cpython-311.pyc new file mode 100644 index 0000000..ef76aa6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_event_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification.cpython-311.pyc new file mode 100644 index 0000000..675a4ab Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_request_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_request_info.cpython-311.pyc new file mode 100644 index 0000000..ef4e191 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_request_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_rule_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_rule_info.cpython-311.pyc new file mode 100644 index 0000000..7bd68db Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_rule_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_target.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_target.cpython-311.pyc new file mode 100644 index 0000000..b38f9e3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_target.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_template.cpython-311.pyc new file mode 100644 index 0000000..4c17e99 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_ota_package_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..b7173f0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_ota_package_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_queue.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_queue.cpython-311.pyc new file mode 100644 index 0000000..a5cfbe7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_queue.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_rpc.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_rpc.cpython-311.pyc new file mode 100644 index 0000000..b3880d2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_rpc.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_rule_chain.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_rule_chain.cpython-311.pyc new file mode 100644 index 0000000..6a8c839 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_rule_chain.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tb_resource_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..e6b1abb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tb_resource_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant.cpython-311.pyc new file mode 100644 index 0000000..ea92c43 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_info.cpython-311.pyc new file mode 100644 index 0000000..b7867af Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_profile.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_profile.cpython-311.pyc new file mode 100644 index 0000000..7b985fd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_profile.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_user.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_user.cpython-311.pyc new file mode 100644 index 0000000..5d459da Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_user.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_user_email_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_user_email_info.cpython-311.pyc new file mode 100644 index 0000000..36e488c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_user_email_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_widgets_bundle.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_widgets_bundle.cpython-311.pyc new file mode 100644 index 0000000..e320874 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/page_data_widgets_bundle.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/platform_two_fa_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/platform_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..20dfe21 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/platform_two_fa_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/platform_users_notification_target_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/platform_users_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..8463bde Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/platform_users_notification_target_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/power_saving_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/power_saving_configuration.cpython-311.pyc new file mode 100644 index 0000000..39b9cec Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/power_saving_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/processing_strategy.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/processing_strategy.cpython-311.pyc new file mode 100644 index 0000000..3582a89 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/processing_strategy.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/proto_transport_payload_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/proto_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..bbea46f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/proto_transport_payload_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..128c0a0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/queue.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/queue.cpython-311.pyc new file mode 100644 index 0000000..9dc4416 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/queue.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/queue_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/queue_id.cpython-311.pyc new file mode 100644 index 0000000..5470756 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/queue_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relation_entity_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relation_entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..3001bf3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relation_entity_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relations_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relations_query_filter.cpython-311.pyc new file mode 100644 index 0000000..67f057c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relations_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relations_search_parameters.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relations_search_parameters.cpython-311.pyc new file mode 100644 index 0000000..d0a910f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/relations_search_parameters.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..6090001 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repository_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repository_settings.cpython-311.pyc new file mode 100644 index 0000000..c94cfbd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repository_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repository_settings_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repository_settings_info.cpython-311.pyc new file mode 100644 index 0000000..154c691 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/repository_settings_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/reset_password_email_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/reset_password_email_request.cpython-311.pyc new file mode 100644 index 0000000..dc290d6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/reset_password_email_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/reset_password_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/reset_password_request.cpython-311.pyc new file mode 100644 index 0000000..a621a61 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/reset_password_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/resource.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/resource.cpython-311.pyc new file mode 100644 index 0000000..9274b9f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/resource.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/response_entity.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/response_entity.cpython-311.pyc new file mode 100644 index 0000000..1a24e4a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/response_entity.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpc.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpc.cpython-311.pyc new file mode 100644 index 0000000..45112e4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpc.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpc_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpc_id.cpython-311.pyc new file mode 100644 index 0000000..a4d9f8b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpc_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..4b2b19f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain.cpython-311.pyc new file mode 100644 index 0000000..7ca284f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_connection_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_connection_info.cpython-311.pyc new file mode 100644 index 0000000..347b2b6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_connection_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_data.cpython-311.pyc new file mode 100644 index 0000000..fd0727b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..df4607b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_export_data.cpython-311.pyc new file mode 100644 index 0000000..df5677a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_id.cpython-311.pyc new file mode 100644 index 0000000..08e5011 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_import_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_import_result.cpython-311.pyc new file mode 100644 index 0000000..f89d89c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_import_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_meta_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_meta_data.cpython-311.pyc new file mode 100644 index 0000000..d35da8d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_meta_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc new file mode 100644 index 0000000..f2e5d3e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..bf8ab19 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node.cpython-311.pyc new file mode 100644 index 0000000..1d65135 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node_debug_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..e6853b3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node_debug_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node_id.cpython-311.pyc new file mode 100644 index 0000000..32b5afa Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/rule_node_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/save_device_with_credentials_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/save_device_with_credentials_request.cpython-311.pyc new file mode 100644 index 0000000..04c1130 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/save_device_with_credentials_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/save_ota_package_info_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/save_ota_package_info_request.cpython-311.pyc new file mode 100644 index 0000000..15cbb68 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/save_ota_package_info_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/security_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/security_settings.cpython-311.pyc new file mode 100644 index 0000000..eca2090 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/security_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/server_security_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/server_security_config.cpython-311.pyc new file mode 100644 index 0000000..df2d7fd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/server_security_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..274bab7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/short_customer_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/short_customer_info.cpython-311.pyc new file mode 100644 index 0000000..a390db8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/short_customer_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sign_up_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sign_up_request.cpython-311.pyc new file mode 100644 index 0000000..8e9003c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sign_up_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/simple_alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/simple_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..abe6a35 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/simple_alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_filter.cpython-311.pyc new file mode 100644 index 0000000..491f768 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..3114f88 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_load_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..e632a49 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_load_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_conversation.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_conversation.cpython-311.pyc new file mode 100644 index 0000000..56940fd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_conversation.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..59f6f66 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..24eafaf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_target_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..ea7ed35 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_target_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..0e7b636 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..3b9ce50 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..3d4363a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..576ddd4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..dfd2fb7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..f73300f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..1684a1b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..8b906d7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_mapping.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_mapping.cpython-311.pyc new file mode 100644 index 0000000..5a1bbc9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/snmp_mapping.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/specific_time_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/specific_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..b48430b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/specific_time_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/starred_dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/starred_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..057aa3f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/starred_dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/statistics_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/statistics_event_filter.cpython-311.pyc new file mode 100644 index 0000000..758015e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/statistics_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/string_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/string_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..6829c3c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/string_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/submit_strategy.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/submit_strategy.cpython-311.pyc new file mode 100644 index 0000000..aebca69 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/submit_strategy.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_administrators_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..29402fb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_administrators_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_info.cpython-311.pyc new file mode 100644 index 0000000..5c46d2a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_info_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_info_data.cpython-311.pyc new file mode 100644 index 0000000..ecad07b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/system_info_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource.cpython-311.pyc new file mode 100644 index 0000000..9008086 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_id.cpython-311.pyc new file mode 100644 index 0000000..7ca2e4f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..ddc012d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_entity_view.cpython-311.pyc new file mode 100644 index 0000000..d46ef96 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_mapping_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_mapping_configuration.cpython-311.pyc new file mode 100644 index 0000000..46f03d9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_mapping_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..d24f774 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant.cpython-311.pyc new file mode 100644 index 0000000..d672b31 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_administrators_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..d7ecb4c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_administrators_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_id.cpython-311.pyc new file mode 100644 index 0000000..6bed870 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_info.cpython-311.pyc new file mode 100644 index 0000000..8c79187 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile.cpython-311.pyc new file mode 100644 index 0000000..fcc9c3a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..3a838c8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_data.cpython-311.pyc new file mode 100644 index 0000000..2ffc241 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_id.cpython-311.pyc new file mode 100644 index 0000000..4f2756a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc new file mode 100644 index 0000000..ac4736b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/test_sms_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/test_sms_request.cpython-311.pyc new file mode 100644 index 0000000..53277e5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/test_sms_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc new file mode 100644 index 0000000..1c1a8ec Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_error_response.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_error_response.cpython-311.pyc new file mode 100644 index 0000000..b6c5e40 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_error_response.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..6db0811 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..f2af9dd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..0feffaa Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/transport_payload_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/transport_payload_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..5a30497 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/transport_payload_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ts_value.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ts_value.cpython-311.pyc new file mode 100644 index 0000000..a5be6c6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/ts_value.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..4f33621 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..2272ce3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config_update_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config_update_request.cpython-311.pyc new file mode 100644 index 0000000..acb4bd1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config_update_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..cbfa353 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_info.cpython-311.pyc new file mode 100644 index 0000000..d56e0a3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/update_message.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/update_message.cpython-311.pyc new file mode 100644 index 0000000..73b9305 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/update_message.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/usage_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/usage_info.cpython-311.pyc new file mode 100644 index 0000000..b8c71bf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/usage_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user.cpython-311.pyc new file mode 100644 index 0000000..ee61a5a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_dashboards_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_dashboards_info.cpython-311.pyc new file mode 100644 index 0000000..271b659 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_dashboards_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_email_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_email_info.cpython-311.pyc new file mode 100644 index 0000000..4941e6b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_email_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_id.cpython-311.pyc new file mode 100644 index 0000000..9f93504 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_list_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_list_filter.cpython-311.pyc new file mode 100644 index 0000000..7c5ee30 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_list_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_password_policy.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_password_policy.cpython-311.pyc new file mode 100644 index 0000000..debeacb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/user_password_policy.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/users_filter.cpython-311.pyc new file mode 100644 index 0000000..b02e3b9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_create_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_create_config.cpython-311.pyc new file mode 100644 index 0000000..698561b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_create_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_create_request.cpython-311.pyc new file mode 100644 index 0000000..9b3b271 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_creation_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_creation_result.cpython-311.pyc new file mode 100644 index 0000000..9123ff6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_creation_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_config.cpython-311.pyc new file mode 100644 index 0000000..984c01a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_request.cpython-311.pyc new file mode 100644 index 0000000..a1a14c1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_result.cpython-311.pyc new file mode 100644 index 0000000..af794f1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/version_load_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/versioned_entity_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..512159e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/versioned_entity_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/web_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/web_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..796d571 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/web_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type.cpython-311.pyc new file mode 100644 index 0000000..77ad194 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_details.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_details.cpython-311.pyc new file mode 100644 index 0000000..18f4bc0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_details.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_id.cpython-311.pyc new file mode 100644 index 0000000..c0a8787 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_info.cpython-311.pyc new file mode 100644 index 0000000..a10f944 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widget_type_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle.cpython-311.pyc new file mode 100644 index 0000000..650a01c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_export_data.cpython-311.pyc new file mode 100644 index 0000000..43ea88b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_id.cpython-311.pyc new file mode 100644 index 0000000..bf52f0e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..4d2dab5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..79c7254 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_ce/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_ce/account_two_fa_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/account_two_fa_settings.py new file mode 100644 index 0000000..8bdda25 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/account_two_fa_settings.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AccountTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configs': 'dict(str, TwoFaAccountConfig)' + } + + attribute_map = { + 'configs': 'configs' + } + + def __init__(self, configs=None): # noqa: E501 + """AccountTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._configs = None + self.discriminator = None + if configs is not None: + self.configs = configs + + @property + def configs(self): + """Gets the configs of this AccountTwoFaSettings. # noqa: E501 + + + :return: The configs of this AccountTwoFaSettings. # noqa: E501 + :rtype: dict(str, TwoFaAccountConfig) + """ + return self._configs + + @configs.setter + def configs(self, configs): + """Sets the configs of this AccountTwoFaSettings. + + + :param configs: The configs of this AccountTwoFaSettings. # noqa: E501 + :type: dict(str, TwoFaAccountConfig) + """ + + self._configs = configs + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AccountTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AccountTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/activate_user_request.py b/billinglayer/python/tb_rest_client/models/models_ce/activate_user_request.py new file mode 100644 index 0000000..8134f32 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/activate_user_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ActivateUserRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'activate_token': 'activateToken', + 'password': 'password' + } + + def __init__(self, activate_token=None, password=None): # noqa: E501 + """ActivateUserRequest - a model defined in Swagger""" # noqa: E501 + self._activate_token = None + self._password = None + self.discriminator = None + if activate_token is not None: + self.activate_token = activate_token + if password is not None: + self.password = password + + @property + def activate_token(self): + """Gets the activate_token of this ActivateUserRequest. # noqa: E501 + + The activate token to verify # noqa: E501 + + :return: The activate_token of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._activate_token + + @activate_token.setter + def activate_token(self, activate_token): + """Sets the activate_token of this ActivateUserRequest. + + The activate token to verify # noqa: E501 + + :param activate_token: The activate_token of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._activate_token = activate_token + + @property + def password(self): + """Gets the password of this ActivateUserRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ActivateUserRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ActivateUserRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ActivateUserRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/admin_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/admin_settings.py new file mode 100644 index 0000000..d30ebcb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/admin_settings.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AdminSettingsId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'key': 'str', + 'json_value': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'key': 'key', + 'json_value': 'jsonValue' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, key=None, json_value=None): # noqa: E501 + """AdminSettings - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._key = None + self._json_value = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if key is not None: + self.key = key + if json_value is not None: + self.json_value = json_value + + @property + def id(self): + """Gets the id of this AdminSettings. # noqa: E501 + + + :return: The id of this AdminSettings. # noqa: E501 + :rtype: AdminSettingsId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettings. + + + :param id: The id of this AdminSettings. # noqa: E501 + :type: AdminSettingsId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AdminSettings. # noqa: E501 + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :return: The created_time of this AdminSettings. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AdminSettings. + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AdminSettings. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AdminSettings. # noqa: E501 + + + :return: The tenant_id of this AdminSettings. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AdminSettings. + + + :param tenant_id: The tenant_id of this AdminSettings. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def key(self): + """Gets the key of this AdminSettings. # noqa: E501 + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :return: The key of this AdminSettings. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AdminSettings. + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :param key: The key of this AdminSettings. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def json_value(self): + """Gets the json_value of this AdminSettings. # noqa: E501 + + + :return: The json_value of this AdminSettings. # noqa: E501 + :rtype: JsonNode + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AdminSettings. + + + :param json_value: The json_value of this AdminSettings. # noqa: E501 + :type: JsonNode + """ + + self._json_value = json_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/admin_settings_id.py b/billinglayer/python/tb_rest_client/models/models_ce/admin_settings_id.py new file mode 100644 index 0000000..16f62bc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/admin_settings_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettingsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AdminSettingsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AdminSettingsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AdminSettingsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettingsId. + + string # noqa: E501 + + :param id: The id of this AdminSettingsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettingsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettingsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/affected_tenant_administrators_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/affected_tenant_administrators_filter.py new file mode 100644 index 0000000..7cf89ea --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/affected_tenant_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedTenantAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedTenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedTenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedTenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/affected_user_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/affected_user_filter.py new file mode 100644 index 0000000..8058d4e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/affected_user_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedUserFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedUserFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedUserFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedUserFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm.py new file mode 100644 index 0000000..b543f1c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm.py @@ -0,0 +1,721 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Alarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate': 'bool', + 'propagate_to_owner': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate': 'propagate', + 'propagate_to_owner': 'propagateToOwner', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate=None, propagate_to_owner=None, propagate_to_tenant=None, propagate_relation_types=None, status=None): # noqa: E501 + """Alarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate = None + self._propagate_to_owner = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate is not None: + self.propagate = propagate + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + self.status = status + + @property + def id(self): + """Gets the id of this Alarm. # noqa: E501 + + + :return: The id of this Alarm. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Alarm. + + + :param id: The id of this Alarm. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Alarm. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this Alarm. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Alarm. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Alarm. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Alarm. # noqa: E501 + + + :return: The tenant_id of this Alarm. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Alarm. + + + :param tenant_id: The tenant_id of this Alarm. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Alarm. # noqa: E501 + + + :return: The customer_id of this Alarm. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Alarm. + + + :param customer_id: The customer_id of this Alarm. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this Alarm. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this Alarm. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this Alarm. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this Alarm. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this Alarm. # noqa: E501 + + + :return: The originator of this Alarm. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this Alarm. + + + :param originator: The originator of this Alarm. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this Alarm. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this Alarm. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this Alarm. + + Alarm severity # noqa: E501 + + :param severity: The severity of this Alarm. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this Alarm. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this Alarm. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this Alarm. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this Alarm. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this Alarm. + + Cleared # noqa: E501 + + :param cleared: The cleared of this Alarm. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this Alarm. # noqa: E501 + + + :return: The assignee_id of this Alarm. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this Alarm. + + + :param assignee_id: The assignee_id of this Alarm. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this Alarm. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this Alarm. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this Alarm. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this Alarm. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this Alarm. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this Alarm. # noqa: E501 + + + :return: The details of this Alarm. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this Alarm. + + + :param details: The details of this Alarm. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate(self): + """Gets the propagate of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this Alarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this Alarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this Alarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this Alarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this Alarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this Alarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this Alarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def status(self): + """Gets the status of this Alarm. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this Alarm. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Alarm. + + status of the Alarm # noqa: E501 + + :param status: The status of this Alarm. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Alarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Alarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_assignee.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_assignee.py new file mode 100644 index 0000000..0c5b705 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_assignee.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignee(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'first_name': 'str', + 'id': 'UserId', + 'last_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'first_name': 'firstName', + 'id': 'id', + 'last_name': 'lastName' + } + + def __init__(self, email=None, first_name=None, id=None, last_name=None): # noqa: E501 + """AlarmAssignee - a model defined in Swagger""" # noqa: E501 + self._email = None + self._first_name = None + self._id = None + self._last_name = None + self.discriminator = None + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if id is not None: + self.id = id + if last_name is not None: + self.last_name = last_name + + @property + def email(self): + """Gets the email of this AlarmAssignee. # noqa: E501 + + + :return: The email of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmAssignee. + + + :param email: The email of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmAssignee. # noqa: E501 + + + :return: The first_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmAssignee. + + + :param first_name: The first_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def id(self): + """Gets the id of this AlarmAssignee. # noqa: E501 + + + :return: The id of this AlarmAssignee. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmAssignee. + + + :param id: The id of this AlarmAssignee. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def last_name(self): + """Gets the last_name of this AlarmAssignee. # noqa: E501 + + + :return: The last_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmAssignee. + + + :param last_name: The last_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignee, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignee): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_assignment_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_assignment_notification_rule_trigger_config.py new file mode 100644 index 0000000..b8367ea --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_assignment_notification_rule_trigger_config.py @@ -0,0 +1,255 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignmentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on=None, trigger_type=None): # noqa: E501 + """AlarmAssignmentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on(self): + """Gets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ASSIGNED", "UNASSIGNED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignmentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignmentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment.py new file mode 100644 index 0000000..f46fc6c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment.py @@ -0,0 +1,293 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmComment(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None): # noqa: E501 + """AlarmComment - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + + @property + def id(self): + """Gets the id of this AlarmComment. # noqa: E501 + + + :return: The id of this AlarmComment. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmComment. + + + :param id: The id of this AlarmComment. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmComment. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmComment. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmComment. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmComment. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmComment. # noqa: E501 + + + :return: The alarm_id of this AlarmComment. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmComment. + + + :param alarm_id: The alarm_id of this AlarmComment. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmComment. # noqa: E501 + + + :return: The user_id of this AlarmComment. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmComment. + + + :param user_id: The user_id of this AlarmComment. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmComment. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmComment. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmComment. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmComment. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmComment. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmComment. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmComment. # noqa: E501 + + + :return: The comment of this AlarmComment. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmComment. + + + :param comment: The comment of this AlarmComment. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmComment, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmComment): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_id.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_id.py new file mode 100644 index 0000000..da6d689 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AlarmCommentId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AlarmCommentId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AlarmCommentId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentId. + + string # noqa: E501 + + :param id: The id of this AlarmCommentId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_info.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_info.py new file mode 100644 index 0000000..d9dd209 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_info.py @@ -0,0 +1,377 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None, email=None, first_name=None, last_name=None): # noqa: E501 + """AlarmCommentInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this AlarmCommentInfo. # noqa: E501 + + + :return: The id of this AlarmCommentInfo. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentInfo. + + + :param id: The id of this AlarmCommentInfo. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmCommentInfo. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmCommentInfo. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmCommentInfo. + + + :param alarm_id: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The user_id of this AlarmCommentInfo. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmCommentInfo. + + + :param user_id: The user_id of this AlarmCommentInfo. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmCommentInfo. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmCommentInfo. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmCommentInfo. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmCommentInfo. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmCommentInfo. # noqa: E501 + + + :return: The comment of this AlarmCommentInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmCommentInfo. + + + :param comment: The comment of this AlarmCommentInfo. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + @property + def email(self): + """Gets the email of this AlarmCommentInfo. # noqa: E501 + + User email address # noqa: E501 + + :return: The email of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmCommentInfo. + + User email address # noqa: E501 + + :param email: The email of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmCommentInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmCommentInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this AlarmCommentInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmCommentInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_notification_rule_trigger_config.py new file mode 100644 index 0000000..6968805 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_comment_notification_rule_trigger_config.py @@ -0,0 +1,274 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on_comment_update': 'bool', + 'only_user_comments': 'bool', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on_comment_update': 'notifyOnCommentUpdate', + 'only_user_comments': 'onlyUserComments', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on_comment_update=None, only_user_comments=None, trigger_type=None): # noqa: E501 + """AlarmCommentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on_comment_update = None + self._only_user_comments = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on_comment_update is not None: + self.notify_on_comment_update = notify_on_comment_update + if only_user_comments is not None: + self.only_user_comments = only_user_comments + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on_comment_update(self): + """Gets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._notify_on_comment_update + + @notify_on_comment_update.setter + def notify_on_comment_update(self, notify_on_comment_update): + """Sets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. + + + :param notify_on_comment_update: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._notify_on_comment_update = notify_on_comment_update + + @property + def only_user_comments(self): + """Gets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_user_comments + + @only_user_comments.setter + def only_user_comments(self, only_user_comments): + """Sets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. + + + :param only_user_comments: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_user_comments = only_user_comments + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition.py new file mode 100644 index 0000000..ee10719 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCondition(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'list[AlarmConditionFilter]', + 'spec': 'AlarmConditionSpec' + } + + attribute_map = { + 'condition': 'condition', + 'spec': 'spec' + } + + def __init__(self, condition=None, spec=None): # noqa: E501 + """AlarmCondition - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._spec = None + self.discriminator = None + if condition is not None: + self.condition = condition + if spec is not None: + self.spec = spec + + @property + def condition(self): + """Gets the condition of this AlarmCondition. # noqa: E501 + + JSON array of alarm condition filters # noqa: E501 + + :return: The condition of this AlarmCondition. # noqa: E501 + :rtype: list[AlarmConditionFilter] + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmCondition. + + JSON array of alarm condition filters # noqa: E501 + + :param condition: The condition of this AlarmCondition. # noqa: E501 + :type: list[AlarmConditionFilter] + """ + + self._condition = condition + + @property + def spec(self): + """Gets the spec of this AlarmCondition. # noqa: E501 + + + :return: The spec of this AlarmCondition. # noqa: E501 + :rtype: AlarmConditionSpec + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this AlarmCondition. + + + :param spec: The spec of this AlarmCondition. # noqa: E501 + :type: AlarmConditionSpec + """ + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCondition, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCondition): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_filter.py new file mode 100644 index 0000000..93ff301 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_filter.py @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'AlarmConditionFilterKey', + 'value_type': 'str', + 'value': 'object', + 'predicate': 'KeyFilterPredicate' + } + + attribute_map = { + 'key': 'key', + 'value_type': 'valueType', + 'value': 'value', + 'predicate': 'predicate' + } + + def __init__(self, key=None, value_type=None, value=None, predicate=None): # noqa: E501 + """AlarmConditionFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._value_type = None + self._value = None + self._predicate = None + self.discriminator = None + if key is not None: + self.key = key + if value_type is not None: + self.value_type = value_type + if value is not None: + self.value = value + if predicate is not None: + self.predicate = predicate + + @property + def key(self): + """Gets the key of this AlarmConditionFilter. # noqa: E501 + + + :return: The key of this AlarmConditionFilter. # noqa: E501 + :rtype: AlarmConditionFilterKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilter. + + + :param key: The key of this AlarmConditionFilter. # noqa: E501 + :type: AlarmConditionFilterKey + """ + + self._key = key + + @property + def value_type(self): + """Gets the value_type of this AlarmConditionFilter. # noqa: E501 + + String representation of the type of the value # noqa: E501 + + :return: The value_type of this AlarmConditionFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this AlarmConditionFilter. + + String representation of the type of the value # noqa: E501 + + :param value_type: The value_type of this AlarmConditionFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + @property + def value(self): + """Gets the value of this AlarmConditionFilter. # noqa: E501 + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :return: The value of this AlarmConditionFilter. # noqa: E501 + :rtype: object + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this AlarmConditionFilter. + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :param value: The value of this AlarmConditionFilter. # noqa: E501 + :type: object + """ + + self._value = value + + @property + def predicate(self): + """Gets the predicate of this AlarmConditionFilter. # noqa: E501 + + + :return: The predicate of this AlarmConditionFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this AlarmConditionFilter. + + + :param predicate: The predicate of this AlarmConditionFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_filter_key.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_filter_key.py new file mode 100644 index 0000000..be6e0b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_filter_key.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilterKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'key': 'str' + } + + attribute_map = { + 'type': 'type', + 'key': 'key' + } + + def __init__(self, type=None, key=None): # noqa: E501 + """AlarmConditionFilterKey - a model defined in Swagger""" # noqa: E501 + self._type = None + self._key = None + self.discriminator = None + if type is not None: + self.type = type + if key is not None: + self.key = key + + @property + def type(self): + """Gets the type of this AlarmConditionFilterKey. # noqa: E501 + + The key type # noqa: E501 + + :return: The type of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmConditionFilterKey. + + The key type # noqa: E501 + + :param type: The type of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + allowed_values = ["ATTRIBUTE", "CONSTANT", "ENTITY_FIELD", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def key(self): + """Gets the key of this AlarmConditionFilterKey. # noqa: E501 + + String value representing the key # noqa: E501 + + :return: The key of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilterKey. + + String value representing the key # noqa: E501 + + :param key: The key of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilterKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilterKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_spec.py new file mode 100644 index 0000000..f550836 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_condition_spec.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionSpec(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_count_query.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_count_query.py new file mode 100644 index 0000000..24c16ae --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_count_query.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'end_ts': 'int', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'end_ts': 'endTs', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, end_ts=None, entity_filter=None, key_filters=None, search_propagated_alarms=None, severity_list=None, start_ts=None, status_list=None, time_window=None, type_list=None): # noqa: E501 + """AlarmCountQuery - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._end_ts = None + self._entity_filter = None + self._key_filters = None + self._search_propagated_alarms = None + self._severity_list = None + self._start_ts = None + self._status_list = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if end_ts is not None: + self.end_ts = end_ts + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmCountQuery. # noqa: E501 + + + :return: The assignee_id of this AlarmCountQuery. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmCountQuery. + + + :param assignee_id: The assignee_id of this AlarmCountQuery. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def end_ts(self): + """Gets the end_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The end_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmCountQuery. + + + :param end_ts: The end_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmCountQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmCountQuery. + + + :param entity_filter: The entity_filter of this AlarmCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmCountQuery. # noqa: E501 + + + :return: The key_filters of this AlarmCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmCountQuery. + + + :param key_filters: The key_filters of this AlarmCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmCountQuery. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmCountQuery. # noqa: E501 + + + :return: The severity_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmCountQuery. + + + :param severity_list: The severity_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def start_ts(self): + """Gets the start_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The start_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmCountQuery. + + + :param start_ts: The start_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmCountQuery. # noqa: E501 + + + :return: The status_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmCountQuery. + + + :param status_list: The status_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def time_window(self): + """Gets the time_window of this AlarmCountQuery. # noqa: E501 + + + :return: The time_window of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmCountQuery. + + + :param time_window: The time_window of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmCountQuery. # noqa: E501 + + + :return: The type_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmCountQuery. + + + :param type_list: The type_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_data.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_data.py new file mode 100644 index 0000000..5badb1d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_data.py @@ -0,0 +1,855 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate': 'bool', + 'originator_name': 'str', + 'propagate_to_owner': 'bool', + 'originator_label': 'str', + 'propagate_to_tenant': 'bool', + 'assignee': 'AlarmAssignee', + 'propagate_relation_types': 'list[str]', + 'status': 'str' + } + + attribute_map = { + 'entity_id': 'entityId', + 'latest': 'latest', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate': 'propagate', + 'originator_name': 'originatorName', + 'propagate_to_owner': 'propagateToOwner', + 'originator_label': 'originatorLabel', + 'propagate_to_tenant': 'propagateToTenant', + 'assignee': 'assignee', + 'propagate_relation_types': 'propagateRelationTypes', + 'status': 'status' + } + + def __init__(self, entity_id=None, latest=None, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate=None, originator_name=None, propagate_to_owner=None, originator_label=None, propagate_to_tenant=None, assignee=None, propagate_relation_types=None, status=None): # noqa: E501 + """AlarmData - a model defined in Swagger""" # noqa: E501 + self._entity_id = None + self._latest = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate = None + self._originator_name = None + self._propagate_to_owner = None + self._originator_label = None + self._propagate_to_tenant = None + self._assignee = None + self._propagate_relation_types = None + self._status = None + self.discriminator = None + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate is not None: + self.propagate = propagate + if originator_name is not None: + self.originator_name = originator_name + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_label is not None: + self.originator_label = originator_label + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if assignee is not None: + self.assignee = assignee + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + self.status = status + + @property + def entity_id(self): + """Gets the entity_id of this AlarmData. # noqa: E501 + + + :return: The entity_id of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AlarmData. + + + :param entity_id: The entity_id of this AlarmData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this AlarmData. # noqa: E501 + + + :return: The latest of this AlarmData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this AlarmData. + + + :param latest: The latest of this AlarmData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def id(self): + """Gets the id of this AlarmData. # noqa: E501 + + + :return: The id of this AlarmData. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmData. + + + :param id: The id of this AlarmData. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmData. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmData. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmData. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmData. # noqa: E501 + + + :return: The tenant_id of this AlarmData. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmData. + + + :param tenant_id: The tenant_id of this AlarmData. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmData. # noqa: E501 + + + :return: The customer_id of this AlarmData. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmData. + + + :param customer_id: The customer_id of this AlarmData. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmData. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmData. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmData. # noqa: E501 + + + :return: The originator of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmData. + + + :param originator: The originator of this AlarmData. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmData. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmData. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmData. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmData. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmData. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmData. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmData. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmData. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmData. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmData. # noqa: E501 + + + :return: The assignee_id of this AlarmData. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmData. + + + :param assignee_id: The assignee_id of this AlarmData. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmData. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmData. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmData. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmData. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmData. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmData. # noqa: E501 + + + :return: The details of this AlarmData. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmData. + + + :param details: The details of this AlarmData. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate(self): + """Gets the propagate of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmData. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def originator_name(self): + """Gets the originator_name of this AlarmData. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmData. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_label(self): + """Gets the originator_label of this AlarmData. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmData. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def assignee(self): + """Gets the assignee of this AlarmData. # noqa: E501 + + + :return: The assignee of this AlarmData. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmData. + + + :param assignee: The assignee of this AlarmData. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmData. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmData. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmData. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmData. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def status(self): + """Gets the status of this AlarmData. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmData. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmData. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_data_page_link.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_data_page_link.py new file mode 100644 index 0000000..0625bca --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_data_page_link.py @@ -0,0 +1,450 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'dynamic': 'bool', + 'end_ts': 'int', + 'page': 'int', + 'page_size': 'int', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'sort_order': 'EntityDataSortOrder', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'text_search': 'str', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'dynamic': 'dynamic', + 'end_ts': 'endTs', + 'page': 'page', + 'page_size': 'pageSize', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'sort_order': 'sortOrder', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'text_search': 'textSearch', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, dynamic=None, end_ts=None, page=None, page_size=None, search_propagated_alarms=None, severity_list=None, sort_order=None, start_ts=None, status_list=None, text_search=None, time_window=None, type_list=None): # noqa: E501 + """AlarmDataPageLink - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._dynamic = None + self._end_ts = None + self._page = None + self._page_size = None + self._search_propagated_alarms = None + self._severity_list = None + self._sort_order = None + self._start_ts = None + self._status_list = None + self._text_search = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if dynamic is not None: + self.dynamic = dynamic + if end_ts is not None: + self.end_ts = end_ts + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if sort_order is not None: + self.sort_order = sort_order + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if text_search is not None: + self.text_search = text_search + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmDataPageLink. # noqa: E501 + + + :return: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmDataPageLink. + + + :param assignee_id: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def dynamic(self): + """Gets the dynamic of this AlarmDataPageLink. # noqa: E501 + + + :return: The dynamic of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this AlarmDataPageLink. + + + :param dynamic: The dynamic of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def end_ts(self): + """Gets the end_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The end_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmDataPageLink. + + + :param end_ts: The end_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def page(self): + """Gets the page of this AlarmDataPageLink. # noqa: E501 + + + :return: The page of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this AlarmDataPageLink. + + + :param page: The page of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this AlarmDataPageLink. # noqa: E501 + + + :return: The page_size of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this AlarmDataPageLink. + + + :param page_size: The page_size of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmDataPageLink. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The severity_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmDataPageLink. + + + :param severity_list: The severity_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def sort_order(self): + """Gets the sort_order of this AlarmDataPageLink. # noqa: E501 + + + :return: The sort_order of this AlarmDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this AlarmDataPageLink. + + + :param sort_order: The sort_order of this AlarmDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def start_ts(self): + """Gets the start_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The start_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmDataPageLink. + + + :param start_ts: The start_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The status_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmDataPageLink. + + + :param status_list: The status_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def text_search(self): + """Gets the text_search of this AlarmDataPageLink. # noqa: E501 + + + :return: The text_search of this AlarmDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this AlarmDataPageLink. + + + :param text_search: The text_search of this AlarmDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + @property + def time_window(self): + """Gets the time_window of this AlarmDataPageLink. # noqa: E501 + + + :return: The time_window of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmDataPageLink. + + + :param time_window: The time_window of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The type_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmDataPageLink. + + + :param type_list: The type_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_data_query.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_data_query.py new file mode 100644 index 0000000..0bd5a21 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_data_query.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_fields': 'list[EntityKey]', + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'AlarmDataPageLink' + } + + attribute_map = { + 'alarm_fields': 'alarmFields', + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, alarm_fields=None, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """AlarmDataQuery - a model defined in Swagger""" # noqa: E501 + self._alarm_fields = None + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if alarm_fields is not None: + self.alarm_fields = alarm_fields + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def alarm_fields(self): + """Gets the alarm_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._alarm_fields + + @alarm_fields.setter + def alarm_fields(self, alarm_fields): + """Sets the alarm_fields of this AlarmDataQuery. + + + :param alarm_fields: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._alarm_fields = alarm_fields + + @property + def entity_fields(self): + """Gets the entity_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this AlarmDataQuery. + + + :param entity_fields: The entity_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmDataQuery. + + + :param entity_filter: The entity_filter of this AlarmDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmDataQuery. # noqa: E501 + + + :return: The key_filters of this AlarmDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmDataQuery. + + + :param key_filters: The key_filters of this AlarmDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this AlarmDataQuery. # noqa: E501 + + + :return: The latest_values of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this AlarmDataQuery. + + + :param latest_values: The latest_values of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this AlarmDataQuery. # noqa: E501 + + + :return: The page_link of this AlarmDataQuery. # noqa: E501 + :rtype: AlarmDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this AlarmDataQuery. + + + :param page_link: The page_link of this AlarmDataQuery. # noqa: E501 + :type: AlarmDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_id.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_id.py new file mode 100644 index 0000000..3fb48c2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AlarmId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AlarmId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AlarmId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AlarmId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AlarmId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AlarmId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_info.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_info.py new file mode 100644 index 0000000..addeac2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_info.py @@ -0,0 +1,803 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate': 'bool', + 'originator_name': 'str', + 'propagate_to_owner': 'bool', + 'originator_label': 'str', + 'propagate_to_tenant': 'bool', + 'assignee': 'AlarmAssignee', + 'propagate_relation_types': 'list[str]', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate': 'propagate', + 'originator_name': 'originatorName', + 'propagate_to_owner': 'propagateToOwner', + 'originator_label': 'originatorLabel', + 'propagate_to_tenant': 'propagateToTenant', + 'assignee': 'assignee', + 'propagate_relation_types': 'propagateRelationTypes', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate=None, originator_name=None, propagate_to_owner=None, originator_label=None, propagate_to_tenant=None, assignee=None, propagate_relation_types=None, status=None): # noqa: E501 + """AlarmInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate = None + self._originator_name = None + self._propagate_to_owner = None + self._originator_label = None + self._propagate_to_tenant = None + self._assignee = None + self._propagate_relation_types = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate is not None: + self.propagate = propagate + if originator_name is not None: + self.originator_name = originator_name + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_label is not None: + self.originator_label = originator_label + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if assignee is not None: + self.assignee = assignee + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + self.status = status + + @property + def id(self): + """Gets the id of this AlarmInfo. # noqa: E501 + + + :return: The id of this AlarmInfo. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmInfo. + + + :param id: The id of this AlarmInfo. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmInfo. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmInfo. # noqa: E501 + + + :return: The tenant_id of this AlarmInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmInfo. + + + :param tenant_id: The tenant_id of this AlarmInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmInfo. # noqa: E501 + + + :return: The customer_id of this AlarmInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmInfo. + + + :param customer_id: The customer_id of this AlarmInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmInfo. # noqa: E501 + + + :return: The originator of this AlarmInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmInfo. + + + :param originator: The originator of this AlarmInfo. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmInfo. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmInfo. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmInfo. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmInfo. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmInfo. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmInfo. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmInfo. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmInfo. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmInfo. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmInfo. # noqa: E501 + + + :return: The assignee_id of this AlarmInfo. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmInfo. + + + :param assignee_id: The assignee_id of this AlarmInfo. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmInfo. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmInfo. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmInfo. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmInfo. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmInfo. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmInfo. # noqa: E501 + + + :return: The details of this AlarmInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmInfo. + + + :param details: The details of this AlarmInfo. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate(self): + """Gets the propagate of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def originator_name(self): + """Gets the originator_name of this AlarmInfo. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmInfo. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_label(self): + """Gets the originator_label of this AlarmInfo. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmInfo. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def assignee(self): + """Gets the assignee of this AlarmInfo. # noqa: E501 + + + :return: The assignee of this AlarmInfo. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmInfo. + + + :param assignee: The assignee of this AlarmInfo. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmInfo. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmInfo. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def status(self): + """Gets the status of this AlarmInfo. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmInfo. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmInfo. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_notification_rule_trigger_config.py new file mode 100644 index 0000000..d1556af --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_notification_rule_trigger_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class AlarmNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_types': 'list[str]', + 'clear_rule': 'ClearRule', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_types': 'alarmTypes', + 'clear_rule': 'clearRule', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, alarm_severities=None, alarm_types=None, clear_rule=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """AlarmNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_types = None + self._clear_rule = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_types is not None: + self.alarm_types = alarm_types + if clear_rule is not None: + self.clear_rule = clear_rule + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def clear_rule(self): + """Gets the clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: ClearRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this AlarmNotificationRuleTriggerConfig. + + + :param clear_rule: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: ClearRule + """ + + self._clear_rule = clear_rule + + @property + def notify_on(self): + """Gets the notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACKNOWLEDGED", "CLEARED", "CREATED", "SEVERITY_CHANGED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_rule.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_rule.py new file mode 100644 index 0000000..a8cf0d7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_rule.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'AlarmCondition', + 'schedule': 'AlarmSchedule', + 'alarm_details': 'str', + 'dashboard_id': 'DashboardId' + } + + attribute_map = { + 'condition': 'condition', + 'schedule': 'schedule', + 'alarm_details': 'alarmDetails', + 'dashboard_id': 'dashboardId' + } + + def __init__(self, condition=None, schedule=None, alarm_details=None, dashboard_id=None): # noqa: E501 + """AlarmRule - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._schedule = None + self._alarm_details = None + self._dashboard_id = None + self.discriminator = None + if condition is not None: + self.condition = condition + if schedule is not None: + self.schedule = schedule + if alarm_details is not None: + self.alarm_details = alarm_details + if dashboard_id is not None: + self.dashboard_id = dashboard_id + + @property + def condition(self): + """Gets the condition of this AlarmRule. # noqa: E501 + + + :return: The condition of this AlarmRule. # noqa: E501 + :rtype: AlarmCondition + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmRule. + + + :param condition: The condition of this AlarmRule. # noqa: E501 + :type: AlarmCondition + """ + + self._condition = condition + + @property + def schedule(self): + """Gets the schedule of this AlarmRule. # noqa: E501 + + + :return: The schedule of this AlarmRule. # noqa: E501 + :rtype: AlarmSchedule + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this AlarmRule. + + + :param schedule: The schedule of this AlarmRule. # noqa: E501 + :type: AlarmSchedule + """ + + self._schedule = schedule + + @property + def alarm_details(self): + """Gets the alarm_details of this AlarmRule. # noqa: E501 + + String value representing the additional details for an alarm rule # noqa: E501 + + :return: The alarm_details of this AlarmRule. # noqa: E501 + :rtype: str + """ + return self._alarm_details + + @alarm_details.setter + def alarm_details(self, alarm_details): + """Sets the alarm_details of this AlarmRule. + + String value representing the additional details for an alarm rule # noqa: E501 + + :param alarm_details: The alarm_details of this AlarmRule. # noqa: E501 + :type: str + """ + + self._alarm_details = alarm_details + + @property + def dashboard_id(self): + """Gets the dashboard_id of this AlarmRule. # noqa: E501 + + + :return: The dashboard_id of this AlarmRule. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this AlarmRule. + + + :param dashboard_id: The dashboard_id of this AlarmRule. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/alarm_schedule.py b/billinglayer/python/tb_rest_client/models/models_ce/alarm_schedule.py new file mode 100644 index 0000000..5bc4b4a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/alarm_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AlarmSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AlarmSchedule. # noqa: E501 + + + :return: The dynamic_value of this AlarmSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AlarmSchedule. + + + :param dynamic_value: The dynamic_value of this AlarmSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AlarmSchedule. # noqa: E501 + + + :return: The type of this AlarmSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmSchedule. + + + :param type: The type of this AlarmSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/all_users_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/all_users_filter.py new file mode 100644 index 0000000..0526abf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/all_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AllUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/allow_create_new_devices_device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/allow_create_new_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..3222814 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/allow_create_new_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllowCreateNewDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """AllowCreateNewDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllowCreateNewDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllowCreateNewDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/any_time_schedule.py b/billinglayer/python/tb_rest_client/models/models_ce/any_time_schedule.py new file mode 100644 index 0000000..c787cd2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/any_time_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AnyTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AnyTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AnyTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AnyTimeSchedule. + + + :param dynamic_value: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AnyTimeSchedule. # noqa: E501 + + + :return: The type of this AnyTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AnyTimeSchedule. + + + :param type: The type of this AnyTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AnyTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AnyTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/api_usage_limit_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/api_usage_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..9a160c0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/api_usage_limit_notification_rule_trigger_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class ApiUsageLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'api_features': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'api_features': 'apiFeatures', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, api_features=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """ApiUsageLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._api_features = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if api_features is not None: + self.api_features = api_features + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def api_features(self): + """Gets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._api_features + + @api_features.setter + def api_features(self, api_features): + """Sets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param api_features: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "DB", "EMAIL", "JS", "RE", "SMS", "TRANSPORT"] # noqa: E501 + if not set(api_features).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `api_features` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(api_features) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._api_features = api_features + + @property + def notify_on(self): + """Gets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["DISABLED", "ENABLED", "WARNING"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/api_usage_state_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/api_usage_state_filter.py new file mode 100644 index 0000000..3b70f60 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/api_usage_state_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class ApiUsageStateFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'CustomerId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'customer_id': 'customerId' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, customer_id=None, *args, **kwargs): # noqa: E501 + """ApiUsageStateFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + if customer_id is not None: + self.customer_id = customer_id + EntityFilter.__init__(self, *args, **kwargs) + + @property + def customer_id(self): + """Gets the customer_id of this ApiUsageStateFilter. # noqa: E501 + + + :return: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ApiUsageStateFilter. + + + :param customer_id: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageStateFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageStateFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset.py b/billinglayer/python/tb_rest_client/models/models_ce/asset.py new file mode 100644 index 0000000..7c68164 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset.py @@ -0,0 +1,340 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Asset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None): # noqa: E501 + """Asset - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.label = label + self.asset_profile_id = asset_profile_id + self.type = type + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Asset. # noqa: E501 + + + :return: The id of this Asset. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Asset. + + + :param id: The id of this Asset. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Asset. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this Asset. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Asset. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Asset. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Asset. # noqa: E501 + + + :return: The tenant_id of this Asset. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Asset. + + + :param tenant_id: The tenant_id of this Asset. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Asset. # noqa: E501 + + + :return: The customer_id of this Asset. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Asset. + + + :param customer_id: The customer_id of this Asset. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Asset. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this Asset. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Asset. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this Asset. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Asset. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this Asset. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Asset. + + Asset type # noqa: E501 + + :param type: The type of this Asset. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def label(self): + """Gets the label of this Asset. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Asset. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Asset. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Asset. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this Asset. # noqa: E501 + + + :return: The asset_profile_id of this Asset. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this Asset. + + + :param asset_profile_id: The asset_profile_id of this Asset. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this Asset. # noqa: E501 + + + :return: The additional_info of this Asset. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Asset. + + + :param additional_info: The additional_info of this Asset. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Asset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Asset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_id.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_id.py new file mode 100644 index 0000000..a66566c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_info.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_info.py new file mode 100644 index 0000000..5296762 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_info.py @@ -0,0 +1,426 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'bool', + 'asset_profile_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic', + 'asset_profile_name': 'assetProfileName' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None, customer_title=None, customer_is_public=None, asset_profile_name=None): # noqa: E501 + """AssetInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self._asset_profile_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.asset_profile_id = asset_profile_id + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + if asset_profile_name is not None: + self.asset_profile_name = asset_profile_name + + @property + def id(self): + """Gets the id of this AssetInfo. # noqa: E501 + + + :return: The id of this AssetInfo. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetInfo. + + + :param id: The id of this AssetInfo. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AssetInfo. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this AssetInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AssetInfo. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AssetInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetInfo. # noqa: E501 + + + :return: The tenant_id of this AssetInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetInfo. + + + :param tenant_id: The tenant_id of this AssetInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AssetInfo. # noqa: E501 + + + :return: The customer_id of this AssetInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AssetInfo. + + + :param customer_id: The customer_id of this AssetInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AssetInfo. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetInfo. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this AssetInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AssetInfo. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AssetInfo. + + Asset type # noqa: E501 + + :param type: The type of this AssetInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this AssetInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this AssetInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this AssetInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this AssetInfo. # noqa: E501 + + + :return: The asset_profile_id of this AssetInfo. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this AssetInfo. + + + :param asset_profile_id: The asset_profile_id of this AssetInfo. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this AssetInfo. # noqa: E501 + + + :return: The additional_info of this AssetInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this AssetInfo. + + + :param additional_info: The additional_info of this AssetInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this AssetInfo. # noqa: E501 + + Title of the Customer that owns the asset. # noqa: E501 + + :return: The customer_title of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this AssetInfo. + + Title of the Customer that owns the asset. # noqa: E501 + + :param customer_title: The customer_title of this AssetInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this AssetInfo. # noqa: E501 + + Indicates special 'Public' Customer that is auto-generated to use the assets on public dashboards. # noqa: E501 + + :return: The customer_is_public of this AssetInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this AssetInfo. + + Indicates special 'Public' Customer that is auto-generated to use the assets on public dashboards. # noqa: E501 + + :param customer_is_public: The customer_is_public of this AssetInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + @property + def asset_profile_name(self): + """Gets the asset_profile_name of this AssetInfo. # noqa: E501 + + Name of the corresponding Asset Profile. # noqa: E501 + + :return: The asset_profile_name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._asset_profile_name + + @asset_profile_name.setter + def asset_profile_name(self, asset_profile_name): + """Sets the asset_profile_name of this AssetInfo. + + Name of the corresponding Asset Profile. # noqa: E501 + + :param asset_profile_name: The asset_profile_name of this AssetInfo. # noqa: E501 + :type: str + """ + + self._asset_profile_name = asset_profile_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_profile.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_profile.py new file mode 100644 index 0000000..eea7dbc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_profile.py @@ -0,0 +1,396 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetProfileId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'default': 'bool', + 'default_dashboard_id': 'DashboardId', + 'default_rule_chain_id': 'RuleChainId', + 'default_queue_name': 'str', + 'description': 'str', + 'image': 'str', + 'default_edge_rule_chain_id': 'RuleChainId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'default': 'default', + 'default_dashboard_id': 'defaultDashboardId', + 'default_rule_chain_id': 'defaultRuleChainId', + 'default_queue_name': 'defaultQueueName', + 'description': 'description', + 'image': 'image', + 'default_edge_rule_chain_id': 'defaultEdgeRuleChainId' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, name=None, default=None, default_dashboard_id=None, default_rule_chain_id=None, default_queue_name=None, description=None, image=None, default_edge_rule_chain_id=None): # noqa: E501 + """AssetProfile - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._default = None + self._default_dashboard_id = None + self._default_rule_chain_id = None + self._default_queue_name = None + self._description = None + self._image = None + self._default_edge_rule_chain_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if default is not None: + self.default = default + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if default_rule_chain_id is not None: + self.default_rule_chain_id = default_rule_chain_id + if default_queue_name is not None: + self.default_queue_name = default_queue_name + if description is not None: + self.description = description + if image is not None: + self.image = image + if default_edge_rule_chain_id is not None: + self.default_edge_rule_chain_id = default_edge_rule_chain_id + + @property + def id(self): + """Gets the id of this AssetProfile. # noqa: E501 + + + :return: The id of this AssetProfile. # noqa: E501 + :rtype: AssetProfileId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfile. + + + :param id: The id of this AssetProfile. # noqa: E501 + :type: AssetProfileId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AssetProfile. # noqa: E501 + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :return: The created_time of this AssetProfile. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AssetProfile. + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AssetProfile. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetProfile. # noqa: E501 + + + :return: The tenant_id of this AssetProfile. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetProfile. + + + :param tenant_id: The tenant_id of this AssetProfile. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this AssetProfile. # noqa: E501 + + Unique Asset Profile Name in scope of Tenant. # noqa: E501 + + :return: The name of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetProfile. + + Unique Asset Profile Name in scope of Tenant. # noqa: E501 + + :param name: The name of this AssetProfile. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def default(self): + """Gets the default of this AssetProfile. # noqa: E501 + + Used to mark the default profile. Default profile is used when the asset profile is not specified during asset creation. # noqa: E501 + + :return: The default of this AssetProfile. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this AssetProfile. + + Used to mark the default profile. Default profile is used when the asset profile is not specified during asset creation. # noqa: E501 + + :param default: The default of this AssetProfile. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this AssetProfile. # noqa: E501 + + + :return: The default_dashboard_id of this AssetProfile. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this AssetProfile. + + + :param default_dashboard_id: The default_dashboard_id of this AssetProfile. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def default_rule_chain_id(self): + """Gets the default_rule_chain_id of this AssetProfile. # noqa: E501 + + + :return: The default_rule_chain_id of this AssetProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_rule_chain_id + + @default_rule_chain_id.setter + def default_rule_chain_id(self, default_rule_chain_id): + """Sets the default_rule_chain_id of this AssetProfile. + + + :param default_rule_chain_id: The default_rule_chain_id of this AssetProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_rule_chain_id = default_rule_chain_id + + @property + def default_queue_name(self): + """Gets the default_queue_name of this AssetProfile. # noqa: E501 + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to asset, including asset updates, telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :return: The default_queue_name of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._default_queue_name + + @default_queue_name.setter + def default_queue_name(self, default_queue_name): + """Sets the default_queue_name of this AssetProfile. + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to asset, including asset updates, telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :param default_queue_name: The default_queue_name of this AssetProfile. # noqa: E501 + :type: str + """ + + self._default_queue_name = default_queue_name + + @property + def description(self): + """Gets the description of this AssetProfile. # noqa: E501 + + Asset Profile description. # noqa: E501 + + :return: The description of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this AssetProfile. + + Asset Profile description. # noqa: E501 + + :param description: The description of this AssetProfile. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this AssetProfile. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :return: The image of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this AssetProfile. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :param image: The image of this AssetProfile. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def default_edge_rule_chain_id(self): + """Gets the default_edge_rule_chain_id of this AssetProfile. # noqa: E501 + + + :return: The default_edge_rule_chain_id of this AssetProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_edge_rule_chain_id + + @default_edge_rule_chain_id.setter + def default_edge_rule_chain_id(self, default_edge_rule_chain_id): + """Sets the default_edge_rule_chain_id of this AssetProfile. + + + :param default_edge_rule_chain_id: The default_edge_rule_chain_id of this AssetProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_edge_rule_chain_id = default_edge_rule_chain_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_profile_id.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_profile_id.py new file mode 100644 index 0000000..1c220c5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_profile_info.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_profile_info.py new file mode 100644 index 0000000..2a3efea --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_profile_info.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str', + 'image': 'str', + 'default_dashboard_id': 'DashboardId', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'image': 'image', + 'default_dashboard_id': 'defaultDashboardId', + 'tenant_id': 'tenantId' + } + + def __init__(self, id=None, name=None, image=None, default_dashboard_id=None, tenant_id=None): # noqa: E501 + """AssetProfileInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._image = None + self._default_dashboard_id = None + self._tenant_id = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if image is not None: + self.image = image + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def id(self): + """Gets the id of this AssetProfileInfo. # noqa: E501 + + + :return: The id of this AssetProfileInfo. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfileInfo. + + + :param id: The id of this AssetProfileInfo. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this AssetProfileInfo. # noqa: E501 + + Entity Name # noqa: E501 + + :return: The name of this AssetProfileInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetProfileInfo. + + Entity Name # noqa: E501 + + :param name: The name of this AssetProfileInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def image(self): + """Gets the image of this AssetProfileInfo. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :return: The image of this AssetProfileInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this AssetProfileInfo. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :param image: The image of this AssetProfileInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this AssetProfileInfo. # noqa: E501 + + + :return: The default_dashboard_id of this AssetProfileInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this AssetProfileInfo. + + + :param default_dashboard_id: The default_dashboard_id of this AssetProfileInfo. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetProfileInfo. # noqa: E501 + + + :return: The tenant_id of this AssetProfileInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetProfileInfo. + + + :param tenant_id: The tenant_id of this AssetProfileInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_search_query.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_search_query.py new file mode 100644 index 0000000..d21cbae --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'asset_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'asset_types': 'assetTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, asset_types=None, parameters=None): # noqa: E501 + """AssetSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._asset_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if asset_types is not None: + self.asset_types = asset_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQuery. # noqa: E501 + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this AssetSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQuery. + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this AssetSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQuery. # noqa: E501 + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :return: The asset_types of this AssetSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQuery. + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :param asset_types: The asset_types of this AssetSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def parameters(self): + """Gets the parameters of this AssetSearchQuery. # noqa: E501 + + + :return: The parameters of this AssetSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this AssetSearchQuery. + + + :param parameters: The parameters of this AssetSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_search_query_filter.py new file mode 100644 index 0000000..3a438ac --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_types': 'assetTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """AssetSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._asset_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if asset_types is not None: + self.asset_types = asset_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQueryFilter. + + + :param asset_types: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def direction(self): + """Gets the direction of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The direction of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this AssetSearchQueryFilter. + + + :param direction: The direction of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this AssetSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this AssetSearchQueryFilter. + + + :param max_level: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQueryFilter. + + + :param relation_type: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this AssetSearchQueryFilter. + + + :param root_entity: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/asset_type_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/asset_type_filter.py new file mode 100644 index 0000000..74203a4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/asset_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_name_filter': 'str', + 'asset_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_name_filter': 'assetNameFilter', + 'asset_types': 'assetTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_name_filter=None, asset_types=None, *args, **kwargs): # noqa: E501 + """AssetTypeFilter - a model defined in Swagger""" # noqa: E501 + self._asset_name_filter = None + self._asset_types = None + self.discriminator = None + if asset_name_filter is not None: + self.asset_name_filter = asset_name_filter + if asset_types is not None: + self.asset_types = asset_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_name_filter(self): + """Gets the asset_name_filter of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :rtype: str + """ + return self._asset_name_filter + + @asset_name_filter.setter + def asset_name_filter(self, asset_name_filter): + """Sets the asset_name_filter of this AssetTypeFilter. + + + :param asset_name_filter: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :type: str + """ + + self._asset_name_filter = asset_name_filter + + @property + def asset_types(self): + """Gets the asset_types of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_types of this AssetTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetTypeFilter. + + + :param asset_types: The asset_types of this AssetTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/atomic_integer.py b/billinglayer/python/tb_rest_client/models/models_ce/atomic_integer.py new file mode 100644 index 0000000..9afe97d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/atomic_integer.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AtomicInteger(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'acquire': 'int', + 'and_decrement': 'int', + 'and_increment': 'int', + 'opaque': 'int', + 'plain': 'int' + } + + attribute_map = { + 'acquire': 'acquire', + 'and_decrement': 'andDecrement', + 'and_increment': 'andIncrement', + 'opaque': 'opaque', + 'plain': 'plain' + } + + def __init__(self, acquire=None, and_decrement=None, and_increment=None, opaque=None, plain=None): # noqa: E501 + """AtomicInteger - a model defined in Swagger""" # noqa: E501 + self._acquire = None + self._and_decrement = None + self._and_increment = None + self._opaque = None + self._plain = None + self.discriminator = None + if acquire is not None: + self.acquire = acquire + if and_decrement is not None: + self.and_decrement = and_decrement + if and_increment is not None: + self.and_increment = and_increment + if opaque is not None: + self.opaque = opaque + if plain is not None: + self.plain = plain + + @property + def acquire(self): + """Gets the acquire of this AtomicInteger. # noqa: E501 + + + :return: The acquire of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._acquire + + @acquire.setter + def acquire(self, acquire): + """Sets the acquire of this AtomicInteger. + + + :param acquire: The acquire of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._acquire = acquire + + @property + def and_decrement(self): + """Gets the and_decrement of this AtomicInteger. # noqa: E501 + + + :return: The and_decrement of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_decrement + + @and_decrement.setter + def and_decrement(self, and_decrement): + """Sets the and_decrement of this AtomicInteger. + + + :param and_decrement: The and_decrement of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_decrement = and_decrement + + @property + def and_increment(self): + """Gets the and_increment of this AtomicInteger. # noqa: E501 + + + :return: The and_increment of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_increment + + @and_increment.setter + def and_increment(self, and_increment): + """Sets the and_increment of this AtomicInteger. + + + :param and_increment: The and_increment of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_increment = and_increment + + @property + def opaque(self): + """Gets the opaque of this AtomicInteger. # noqa: E501 + + + :return: The opaque of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._opaque + + @opaque.setter + def opaque(self, opaque): + """Sets the opaque of this AtomicInteger. + + + :param opaque: The opaque of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._opaque = opaque + + @property + def plain(self): + """Gets the plain of this AtomicInteger. # noqa: E501 + + + :return: The plain of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._plain + + @plain.setter + def plain(self, plain): + """Sets the plain of this AtomicInteger. + + + :param plain: The plain of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._plain = plain + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AtomicInteger, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AtomicInteger): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/attribute_export_data.py b/billinglayer/python/tb_rest_client/models/models_ce/attribute_export_data.py new file mode 100644 index 0000000..ceff694 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/attribute_export_data.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributeExportData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'boolean_value': 'bool', + 'double_value': 'float', + 'json_value': 'str', + 'key': 'str', + 'last_update_ts': 'int', + 'long_value': 'int', + 'str_value': 'str' + } + + attribute_map = { + 'boolean_value': 'booleanValue', + 'double_value': 'doubleValue', + 'json_value': 'jsonValue', + 'key': 'key', + 'last_update_ts': 'lastUpdateTs', + 'long_value': 'longValue', + 'str_value': 'strValue' + } + + def __init__(self, boolean_value=None, double_value=None, json_value=None, key=None, last_update_ts=None, long_value=None, str_value=None): # noqa: E501 + """AttributeExportData - a model defined in Swagger""" # noqa: E501 + self._boolean_value = None + self._double_value = None + self._json_value = None + self._key = None + self._last_update_ts = None + self._long_value = None + self._str_value = None + self.discriminator = None + if boolean_value is not None: + self.boolean_value = boolean_value + if double_value is not None: + self.double_value = double_value + if json_value is not None: + self.json_value = json_value + if key is not None: + self.key = key + if last_update_ts is not None: + self.last_update_ts = last_update_ts + if long_value is not None: + self.long_value = long_value + if str_value is not None: + self.str_value = str_value + + @property + def boolean_value(self): + """Gets the boolean_value of this AttributeExportData. # noqa: E501 + + + :return: The boolean_value of this AttributeExportData. # noqa: E501 + :rtype: bool + """ + return self._boolean_value + + @boolean_value.setter + def boolean_value(self, boolean_value): + """Sets the boolean_value of this AttributeExportData. + + + :param boolean_value: The boolean_value of this AttributeExportData. # noqa: E501 + :type: bool + """ + + self._boolean_value = boolean_value + + @property + def double_value(self): + """Gets the double_value of this AttributeExportData. # noqa: E501 + + + :return: The double_value of this AttributeExportData. # noqa: E501 + :rtype: float + """ + return self._double_value + + @double_value.setter + def double_value(self, double_value): + """Sets the double_value of this AttributeExportData. + + + :param double_value: The double_value of this AttributeExportData. # noqa: E501 + :type: float + """ + + self._double_value = double_value + + @property + def json_value(self): + """Gets the json_value of this AttributeExportData. # noqa: E501 + + + :return: The json_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AttributeExportData. + + + :param json_value: The json_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._json_value = json_value + + @property + def key(self): + """Gets the key of this AttributeExportData. # noqa: E501 + + + :return: The key of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AttributeExportData. + + + :param key: The key of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def last_update_ts(self): + """Gets the last_update_ts of this AttributeExportData. # noqa: E501 + + + :return: The last_update_ts of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._last_update_ts + + @last_update_ts.setter + def last_update_ts(self, last_update_ts): + """Sets the last_update_ts of this AttributeExportData. + + + :param last_update_ts: The last_update_ts of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._last_update_ts = last_update_ts + + @property + def long_value(self): + """Gets the long_value of this AttributeExportData. # noqa: E501 + + + :return: The long_value of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._long_value + + @long_value.setter + def long_value(self, long_value): + """Sets the long_value of this AttributeExportData. + + + :param long_value: The long_value of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._long_value = long_value + + @property + def str_value(self): + """Gets the str_value of this AttributeExportData. # noqa: E501 + + + :return: The str_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._str_value + + @str_value.setter + def str_value(self, str_value): + """Sets the str_value of this AttributeExportData. + + + :param str_value: The str_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._str_value = str_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributeExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributeExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/attributes_entity_view.py b/billinglayer/python/tb_rest_client/models/models_ce/attributes_entity_view.py new file mode 100644 index 0000000..cf04a4c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/attributes_entity_view.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributesEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'cs': 'list[str]', + 'sh': 'list[str]', + 'ss': 'list[str]' + } + + attribute_map = { + 'cs': 'cs', + 'sh': 'sh', + 'ss': 'ss' + } + + def __init__(self, cs=None, sh=None, ss=None): # noqa: E501 + """AttributesEntityView - a model defined in Swagger""" # noqa: E501 + self._cs = None + self._sh = None + self._ss = None + self.discriminator = None + self.cs = cs + self.sh = sh + self.ss = ss + + @property + def cs(self): + """Gets the cs of this AttributesEntityView. # noqa: E501 + + List of client-side attribute keys to expose # noqa: E501 + + :return: The cs of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._cs + + @cs.setter + def cs(self, cs): + """Sets the cs of this AttributesEntityView. + + List of client-side attribute keys to expose # noqa: E501 + + :param cs: The cs of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if cs is None: + raise ValueError("Invalid value for `cs`, must not be `None`") # noqa: E501 + + self._cs = cs + + @property + def sh(self): + """Gets the sh of this AttributesEntityView. # noqa: E501 + + List of shared attribute keys to expose # noqa: E501 + + :return: The sh of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._sh + + @sh.setter + def sh(self, sh): + """Sets the sh of this AttributesEntityView. + + List of shared attribute keys to expose # noqa: E501 + + :param sh: The sh of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if sh is None: + raise ValueError("Invalid value for `sh`, must not be `None`") # noqa: E501 + + self._sh = sh + + @property + def ss(self): + """Gets the ss of this AttributesEntityView. # noqa: E501 + + List of server-side attribute keys to expose # noqa: E501 + + :return: The ss of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._ss + + @ss.setter + def ss(self, ss): + """Sets the ss of this AttributesEntityView. + + List of server-side attribute keys to expose # noqa: E501 + + :param ss: The ss of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if ss is None: + raise ValueError("Invalid value for `ss`, must not be `None`") # noqa: E501 + + self._ss = ss + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributesEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributesEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/audit_log.py b/billinglayer/python/tb_rest_client/models/models_ce/audit_log.py new file mode 100644 index 0000000..2701233 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/audit_log.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLog(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AuditLogId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'entity_id': 'EntityId', + 'entity_name': 'str', + 'user_id': 'UserId', + 'user_name': 'str', + 'action_type': 'str', + 'action_data': 'JsonNode', + 'action_status': 'str', + 'action_failure_details': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'entity_id': 'entityId', + 'entity_name': 'entityName', + 'user_id': 'userId', + 'user_name': 'userName', + 'action_type': 'actionType', + 'action_data': 'actionData', + 'action_status': 'actionStatus', + 'action_failure_details': 'actionFailureDetails' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, entity_id=None, entity_name=None, user_id=None, user_name=None, action_type=None, action_data=None, action_status=None, action_failure_details=None): # noqa: E501 + """AuditLog - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._entity_id = None + self._entity_name = None + self._user_id = None + self._user_name = None + self._action_type = None + self._action_data = None + self._action_status = None + self._action_failure_details = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if entity_id is not None: + self.entity_id = entity_id + if entity_name is not None: + self.entity_name = entity_name + if user_id is not None: + self.user_id = user_id + if user_name is not None: + self.user_name = user_name + if action_type is not None: + self.action_type = action_type + if action_data is not None: + self.action_data = action_data + if action_status is not None: + self.action_status = action_status + if action_failure_details is not None: + self.action_failure_details = action_failure_details + + @property + def id(self): + """Gets the id of this AuditLog. # noqa: E501 + + + :return: The id of this AuditLog. # noqa: E501 + :rtype: AuditLogId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLog. + + + :param id: The id of this AuditLog. # noqa: E501 + :type: AuditLogId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AuditLog. # noqa: E501 + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :return: The created_time of this AuditLog. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AuditLog. + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AuditLog. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AuditLog. # noqa: E501 + + + :return: The tenant_id of this AuditLog. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AuditLog. + + + :param tenant_id: The tenant_id of this AuditLog. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AuditLog. # noqa: E501 + + + :return: The customer_id of this AuditLog. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AuditLog. + + + :param customer_id: The customer_id of this AuditLog. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def entity_id(self): + """Gets the entity_id of this AuditLog. # noqa: E501 + + + :return: The entity_id of this AuditLog. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AuditLog. + + + :param entity_id: The entity_id of this AuditLog. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def entity_name(self): + """Gets the entity_name of this AuditLog. # noqa: E501 + + Name of the logged entity # noqa: E501 + + :return: The entity_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this AuditLog. + + Name of the logged entity # noqa: E501 + + :param entity_name: The entity_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._entity_name = entity_name + + @property + def user_id(self): + """Gets the user_id of this AuditLog. # noqa: E501 + + + :return: The user_id of this AuditLog. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AuditLog. + + + :param user_id: The user_id of this AuditLog. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def user_name(self): + """Gets the user_name of this AuditLog. # noqa: E501 + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :return: The user_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._user_name + + @user_name.setter + def user_name(self, user_name): + """Sets the user_name of this AuditLog. + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :param user_name: The user_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._user_name = user_name + + @property + def action_type(self): + """Gets the action_type of this AuditLog. # noqa: E501 + + String represented Action type # noqa: E501 + + :return: The action_type of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_type + + @action_type.setter + def action_type(self, action_type): + """Sets the action_type of this AuditLog. + + String represented Action type # noqa: E501 + + :param action_type: The action_type of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["ACTIVATED", "ADDED", "ADDED_COMMENT", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_DELETE", "ALARM_UNASSIGNED", "ASSIGNED_FROM_TENANT", "ASSIGNED_TO_CUSTOMER", "ASSIGNED_TO_EDGE", "ASSIGNED_TO_TENANT", "ATTRIBUTES_DELETED", "ATTRIBUTES_READ", "ATTRIBUTES_UPDATED", "CREDENTIALS_READ", "CREDENTIALS_UPDATED", "DELETED", "DELETED_COMMENT", "LOCKOUT", "LOGIN", "LOGOUT", "PROVISION_FAILURE", "PROVISION_SUCCESS", "RELATIONS_DELETED", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "RPC_CALL", "SUSPENDED", "TIMESERIES_DELETED", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_CUSTOMER", "UNASSIGNED_FROM_EDGE", "UPDATED", "UPDATED_COMMENT"] # noqa: E501 + if action_type not in allowed_values: + raise ValueError( + "Invalid value for `action_type` ({0}), must be one of {1}" # noqa: E501 + .format(action_type, allowed_values) + ) + + self._action_type = action_type + + @property + def action_data(self): + """Gets the action_data of this AuditLog. # noqa: E501 + + + :return: The action_data of this AuditLog. # noqa: E501 + :rtype: JsonNode + """ + return self._action_data + + @action_data.setter + def action_data(self, action_data): + """Sets the action_data of this AuditLog. + + + :param action_data: The action_data of this AuditLog. # noqa: E501 + :type: JsonNode + """ + + self._action_data = action_data + + @property + def action_status(self): + """Gets the action_status of this AuditLog. # noqa: E501 + + String represented Action status # noqa: E501 + + :return: The action_status of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_status + + @action_status.setter + def action_status(self, action_status): + """Sets the action_status of this AuditLog. + + String represented Action status # noqa: E501 + + :param action_status: The action_status of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["FAILURE", "SUCCESS"] # noqa: E501 + if action_status not in allowed_values: + raise ValueError( + "Invalid value for `action_status` ({0}), must be one of {1}" # noqa: E501 + .format(action_status, allowed_values) + ) + + self._action_status = action_status + + @property + def action_failure_details(self): + """Gets the action_failure_details of this AuditLog. # noqa: E501 + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :return: The action_failure_details of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_failure_details + + @action_failure_details.setter + def action_failure_details(self, action_failure_details): + """Sets the action_failure_details of this AuditLog. + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :param action_failure_details: The action_failure_details of this AuditLog. # noqa: E501 + :type: str + """ + + self._action_failure_details = action_failure_details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLog, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/audit_log_id.py b/billinglayer/python/tb_rest_client/models/models_ce/audit_log_id.py new file mode 100644 index 0000000..5a23ffb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/audit_log_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLogId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AuditLogId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AuditLogId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AuditLogId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLogId. + + string # noqa: E501 + + :param id: The id of this AuditLogId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLogId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLogId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/auto_version_create_config.py b/billinglayer/python/tb_rest_client/models/models_ce/auto_version_create_config.py new file mode 100644 index 0000000..d428fae --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/auto_version_create_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AutoVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'branch': 'branch', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_relations': 'saveRelations' + } + + def __init__(self, branch=None, save_attributes=None, save_credentials=None, save_relations=None): # noqa: E501 + """AutoVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._save_attributes = None + self._save_credentials = None + self._save_relations = None + self.discriminator = None + if branch is not None: + self.branch = branch + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_relations is not None: + self.save_relations = save_relations + + @property + def branch(self): + """Gets the branch of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The branch of this AutoVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this AutoVersionCreateConfig. + + + :param branch: The branch of this AutoVersionCreateConfig. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def save_attributes(self): + """Gets the save_attributes of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this AutoVersionCreateConfig. + + + :param save_attributes: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this AutoVersionCreateConfig. + + + :param save_credentials: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_relations(self): + """Gets the save_relations of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this AutoVersionCreateConfig. + + + :param save_relations: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AutoVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AutoVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/aws_sns_sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/aws_sns_sms_provider_configuration.py new file mode 100644 index 0000000..04c6294 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/aws_sns_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class AwsSnsSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_key_id': 'str', + 'secret_access_key': 'str', + 'region': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'access_key_id': 'accessKeyId', + 'secret_access_key': 'secretAccessKey', + 'region': 'region' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, access_key_id=None, secret_access_key=None, region=None, *args, **kwargs): # noqa: E501 + """AwsSnsSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._access_key_id = None + self._secret_access_key = None + self._region = None + self.discriminator = None + if access_key_id is not None: + self.access_key_id = access_key_id + if secret_access_key is not None: + self.secret_access_key = secret_access_key + if region is not None: + self.region = region + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def access_key_id(self): + """Gets the access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key ID. # noqa: E501 + + :return: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._access_key_id + + @access_key_id.setter + def access_key_id(self, access_key_id): + """Sets the access_key_id of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key ID. # noqa: E501 + + :param access_key_id: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._access_key_id = access_key_id + + @property + def secret_access_key(self): + """Gets the secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key. # noqa: E501 + + :return: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._secret_access_key + + @secret_access_key.setter + def secret_access_key(self, secret_access_key): + """Sets the secret_access_key of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key. # noqa: E501 + + :param secret_access_key: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._secret_access_key = secret_access_key + + @property + def region(self): + """Gets the region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS region. # noqa: E501 + + :return: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this AwsSnsSmsProviderConfiguration. + + The AWS region. # noqa: E501 + + :param region: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._region = region + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AwsSnsSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AwsSnsSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/backup_code_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_ce/backup_code_two_fa_account_config.py new file mode 100644 index 0000000..00bc857 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/backup_code_two_fa_account_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes': 'list[str]', + 'codes_left': 'int', + 'use_by_default': 'bool' + } + + attribute_map = { + 'codes': 'codes', + 'codes_left': 'codesLeft', + 'use_by_default': 'useByDefault' + } + + def __init__(self, codes=None, codes_left=None, use_by_default=None): # noqa: E501 + """BackupCodeTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._codes = None + self._codes_left = None + self._use_by_default = None + self.discriminator = None + if codes is not None: + self.codes = codes + if codes_left is not None: + self.codes_left = codes_left + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def codes(self): + """Gets the codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: list[str] + """ + return self._codes + + @codes.setter + def codes(self, codes): + """Sets the codes of this BackupCodeTwoFaAccountConfig. + + + :param codes: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: list[str] + """ + + self._codes = codes + + @property + def codes_left(self): + """Gets the codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: int + """ + return self._codes_left + + @codes_left.setter + def codes_left(self, codes_left): + """Sets the codes_left of this BackupCodeTwoFaAccountConfig. + + + :param codes_left: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: int + """ + + self._codes_left = codes_left + + @property + def use_by_default(self): + """Gets the use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this BackupCodeTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/backup_code_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_ce/backup_code_two_fa_provider_config.py new file mode 100644 index 0000000..a4d1b17 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/backup_code_two_fa_provider_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes_quantity': 'int' + } + + attribute_map = { + 'codes_quantity': 'codesQuantity' + } + + def __init__(self, codes_quantity=None): # noqa: E501 + """BackupCodeTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._codes_quantity = None + self.discriminator = None + if codes_quantity is not None: + self.codes_quantity = codes_quantity + + @property + def codes_quantity(self): + """Gets the codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + + + :return: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._codes_quantity + + @codes_quantity.setter + def codes_quantity(self, codes_quantity): + """Sets the codes_quantity of this BackupCodeTwoFaProviderConfig. + + + :param codes_quantity: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._codes_quantity = codes_quantity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/boolean_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_ce/boolean_filter_predicate.py new file mode 100644 index 0000000..817351e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/boolean_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class BooleanFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValueboolean' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """BooleanFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this BooleanFilterPredicate. # noqa: E501 + + + :return: The operation of this BooleanFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this BooleanFilterPredicate. + + + :param operation: The operation of this BooleanFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this BooleanFilterPredicate. # noqa: E501 + + + :return: The value of this BooleanFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValueboolean + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this BooleanFilterPredicate. + + + :param value: The value of this BooleanFilterPredicate. # noqa: E501 + :type: FilterPredicateValueboolean + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BooleanFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BooleanFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/branch_info.py b/billinglayer/python/tb_rest_client/models/models_ce/branch_info.py new file mode 100644 index 0000000..c2c37c3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default': 'bool', + 'name': 'str' + } + + attribute_map = { + 'default': 'default', + 'name': 'name' + } + + def __init__(self, default=None, name=None): # noqa: E501 + """BranchInfo - a model defined in Swagger""" # noqa: E501 + self._default = None + self._name = None + self.discriminator = None + if default is not None: + self.default = default + if name is not None: + self.name = name + + @property + def default(self): + """Gets the default of this BranchInfo. # noqa: E501 + + + :return: The default of this BranchInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this BranchInfo. + + + :param default: The default of this BranchInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def name(self): + """Gets the name of this BranchInfo. # noqa: E501 + + + :return: The name of this BranchInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BranchInfo. + + + :param name: The name of this BranchInfo. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_request.py b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_request.py new file mode 100644 index 0000000..17d8ccd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_request.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'file': 'str', + 'mapping': 'Mapping' + } + + attribute_map = { + 'file': 'file', + 'mapping': 'mapping' + } + + def __init__(self, file=None, mapping=None): # noqa: E501 + """BulkImportRequest - a model defined in Swagger""" # noqa: E501 + self._file = None + self._mapping = None + self.discriminator = None + if file is not None: + self.file = file + if mapping is not None: + self.mapping = mapping + + @property + def file(self): + """Gets the file of this BulkImportRequest. # noqa: E501 + + + :return: The file of this BulkImportRequest. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this BulkImportRequest. + + + :param file: The file of this BulkImportRequest. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def mapping(self): + """Gets the mapping of this BulkImportRequest. # noqa: E501 + + + :return: The mapping of this BulkImportRequest. # noqa: E501 + :rtype: Mapping + """ + return self._mapping + + @mapping.setter + def mapping(self, mapping): + """Sets the mapping of this BulkImportRequest. + + + :param mapping: The mapping of this BulkImportRequest. # noqa: E501 + :type: Mapping + """ + + self._mapping = mapping + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_asset.py b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_asset.py new file mode 100644 index 0000000..f77caef --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_asset.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultAsset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultAsset - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultAsset. # noqa: E501 + + + :return: The created of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultAsset. + + + :param created: The created of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultAsset. + + + :param errors: The errors of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors_list of this BulkImportResultAsset. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultAsset. + + + :param errors_list: The errors_list of this BulkImportResultAsset. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultAsset. # noqa: E501 + + + :return: The updated of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultAsset. + + + :param updated: The updated of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultAsset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultAsset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_device.py b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_device.py new file mode 100644 index 0000000..c404290 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_device.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultDevice(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultDevice - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultDevice. # noqa: E501 + + + :return: The created of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultDevice. + + + :param created: The created of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultDevice. + + + :param errors: The errors of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors_list of this BulkImportResultDevice. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultDevice. + + + :param errors_list: The errors_list of this BulkImportResultDevice. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultDevice. # noqa: E501 + + + :return: The updated of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultDevice. + + + :param updated: The updated of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultDevice, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultDevice): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_edge.py b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_edge.py new file mode 100644 index 0000000..8ba7364 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/bulk_import_result_edge.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultEdge - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultEdge. # noqa: E501 + + + :return: The created of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultEdge. + + + :param created: The created of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultEdge. + + + :param errors: The errors of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors_list of this BulkImportResultEdge. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultEdge. + + + :param errors_list: The errors_list of this BulkImportResultEdge. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultEdge. # noqa: E501 + + + :return: The updated of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultEdge. + + + :param updated: The updated of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/byte_buffer.py b/billinglayer/python/tb_rest_client/models/models_ce/byte_buffer.py new file mode 100644 index 0000000..101bdb1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/byte_buffer.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ByteBuffer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'char': 'str', + 'direct': 'bool', + 'double': 'float', + '_float': 'float', + '_int': 'int', + 'long': 'int', + 'read_only': 'bool', + 'short': 'int' + } + + attribute_map = { + 'char': 'char', + 'direct': 'direct', + 'double': 'double', + '_float': 'float', + '_int': 'int', + 'long': 'long', + 'read_only': 'readOnly', + 'short': 'short' + } + + def __init__(self, char=None, direct=None, double=None, _float=None, _int=None, long=None, read_only=None, short=None): # noqa: E501 + """ByteBuffer - a model defined in Swagger""" # noqa: E501 + self._char = None + self._direct = None + self._double = None + self.__float = None + self.__int = None + self._long = None + self._read_only = None + self._short = None + self.discriminator = None + if char is not None: + self.char = char + if direct is not None: + self.direct = direct + if double is not None: + self.double = double + if _float is not None: + self._float = _float + if _int is not None: + self._int = _int + if long is not None: + self.long = long + if read_only is not None: + self.read_only = read_only + if short is not None: + self.short = short + + @property + def char(self): + """Gets the char of this ByteBuffer. # noqa: E501 + + + :return: The char of this ByteBuffer. # noqa: E501 + :rtype: str + """ + return self._char + + @char.setter + def char(self, char): + """Sets the char of this ByteBuffer. + + + :param char: The char of this ByteBuffer. # noqa: E501 + :type: str + """ + + self._char = char + + @property + def direct(self): + """Gets the direct of this ByteBuffer. # noqa: E501 + + + :return: The direct of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._direct + + @direct.setter + def direct(self, direct): + """Sets the direct of this ByteBuffer. + + + :param direct: The direct of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._direct = direct + + @property + def double(self): + """Gets the double of this ByteBuffer. # noqa: E501 + + + :return: The double of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self._double + + @double.setter + def double(self, double): + """Sets the double of this ByteBuffer. + + + :param double: The double of this ByteBuffer. # noqa: E501 + :type: float + """ + + self._double = double + + @property + def _float(self): + """Gets the _float of this ByteBuffer. # noqa: E501 + + + :return: The _float of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self.__float + + @_float.setter + def _float(self, _float): + """Sets the _float of this ByteBuffer. + + + :param _float: The _float of this ByteBuffer. # noqa: E501 + :type: float + """ + + self.__float = _float + + @property + def _int(self): + """Gets the _int of this ByteBuffer. # noqa: E501 + + + :return: The _int of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self.__int + + @_int.setter + def _int(self, _int): + """Sets the _int of this ByteBuffer. + + + :param _int: The _int of this ByteBuffer. # noqa: E501 + :type: int + """ + + self.__int = _int + + @property + def long(self): + """Gets the long of this ByteBuffer. # noqa: E501 + + + :return: The long of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._long + + @long.setter + def long(self, long): + """Sets the long of this ByteBuffer. + + + :param long: The long of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._long = long + + @property + def read_only(self): + """Gets the read_only of this ByteBuffer. # noqa: E501 + + + :return: The read_only of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this ByteBuffer. + + + :param read_only: The read_only of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def short(self): + """Gets the short of this ByteBuffer. # noqa: E501 + + + :return: The short of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._short + + @short.setter + def short(self, short): + """Sets the short of this ByteBuffer. + + + :param short: The short of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._short = short + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ByteBuffer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ByteBuffer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/change_password_request.py b/billinglayer/python/tb_rest_client/models/models_ce/change_password_request.py new file mode 100644 index 0000000..6cfce18 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/change_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ChangePasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_password': 'str', + 'new_password': 'str' + } + + attribute_map = { + 'current_password': 'currentPassword', + 'new_password': 'newPassword' + } + + def __init__(self, current_password=None, new_password=None): # noqa: E501 + """ChangePasswordRequest - a model defined in Swagger""" # noqa: E501 + self._current_password = None + self._new_password = None + self.discriminator = None + if current_password is not None: + self.current_password = current_password + if new_password is not None: + self.new_password = new_password + + @property + def current_password(self): + """Gets the current_password of this ChangePasswordRequest. # noqa: E501 + + The old password # noqa: E501 + + :return: The current_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._current_password + + @current_password.setter + def current_password(self, current_password): + """Sets the current_password of this ChangePasswordRequest. + + The old password # noqa: E501 + + :param current_password: The current_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._current_password = current_password + + @property + def new_password(self): + """Gets the new_password of this ChangePasswordRequest. # noqa: E501 + + The new password # noqa: E501 + + :return: The new_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._new_password + + @new_password.setter + def new_password(self, new_password): + """Sets the new_password of this ChangePasswordRequest. + + The new password # noqa: E501 + + :param new_password: The new_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._new_password = new_password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ChangePasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ChangePasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/check_pre_provisioned_devices_device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/check_pre_provisioned_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..d69b0ee --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/check_pre_provisioned_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/claim_request.py b/billinglayer/python/tb_rest_client/models/models_ce/claim_request.py new file mode 100644 index 0000000..1658e07 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/claim_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClaimRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'secret_key': 'str' + } + + attribute_map = { + 'secret_key': 'secretKey' + } + + def __init__(self, secret_key=None): # noqa: E501 + """ClaimRequest - a model defined in Swagger""" # noqa: E501 + self._secret_key = None + self.discriminator = None + if secret_key is not None: + self.secret_key = secret_key + + @property + def secret_key(self): + """Gets the secret_key of this ClaimRequest. # noqa: E501 + + + :return: The secret_key of this ClaimRequest. # noqa: E501 + :rtype: str + """ + return self._secret_key + + @secret_key.setter + def secret_key(self, secret_key): + """Sets the secret_key of this ClaimRequest. + + + :param secret_key: The secret_key of this ClaimRequest. # noqa: E501 + :type: str + """ + + self._secret_key = secret_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClaimRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClaimRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/clear_rule.py b/billinglayer/python/tb_rest_client/models/models_ce/clear_rule.py new file mode 100644 index 0000000..29bf8f0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/clear_rule.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClearRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_statuses': 'list[str]' + } + + attribute_map = { + 'alarm_statuses': 'alarmStatuses' + } + + def __init__(self, alarm_statuses=None): # noqa: E501 + """ClearRule - a model defined in Swagger""" # noqa: E501 + self._alarm_statuses = None + self.discriminator = None + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this ClearRule. # noqa: E501 + + + :return: The alarm_statuses of this ClearRule. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this ClearRule. + + + :param alarm_statuses: The alarm_statuses of this ClearRule. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClearRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClearRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/client_attributes_querying_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_ce/client_attributes_querying_snmp_communication_config.py new file mode 100644 index 0000000..c88ce58 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/client_attributes_querying_snmp_communication_config.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClientAttributesQueryingSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None): # noqa: E501 + """ClientAttributesQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClientAttributesQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClientAttributesQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/coap_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/coap_device_profile_transport_configuration.py new file mode 100644 index 0000000..9877a38 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/coap_device_profile_transport_configuration.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class CoapDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_settings': 'PowerSavingConfiguration', + 'coap_device_type_configuration': 'CoapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'client_settings': 'clientSettings', + 'coap_device_type_configuration': 'coapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, client_settings=None, coap_device_type_configuration=None, *args, **kwargs): # noqa: E501 + """CoapDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_settings = None + self._coap_device_type_configuration = None + self.discriminator = None + if client_settings is not None: + self.client_settings = client_settings + if coap_device_type_configuration is not None: + self.coap_device_type_configuration = coap_device_type_configuration + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def client_settings(self): + """Gets the client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: PowerSavingConfiguration + """ + return self._client_settings + + @client_settings.setter + def client_settings(self, client_settings): + """Sets the client_settings of this CoapDeviceProfileTransportConfiguration. + + + :param client_settings: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: PowerSavingConfiguration + """ + + self._client_settings = client_settings + + @property + def coap_device_type_configuration(self): + """Gets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: CoapDeviceTypeConfiguration + """ + return self._coap_device_type_configuration + + @coap_device_type_configuration.setter + def coap_device_type_configuration(self, coap_device_type_configuration): + """Sets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. + + + :param coap_device_type_configuration: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: CoapDeviceTypeConfiguration + """ + + self._coap_device_type_configuration = coap_device_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/coap_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/coap_device_transport_configuration.py new file mode 100644 index 0000000..b491b65 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/coap_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class CoapDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """CoapDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this CoapDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this CoapDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this CoapDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this CoapDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/coap_device_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/coap_device_type_configuration.py new file mode 100644 index 0000000..3038e39 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """CoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/column_mapping.py b/billinglayer/python/tb_rest_client/models/models_ce/column_mapping.py new file mode 100644 index 0000000..a262f20 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/column_mapping.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ColumnMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """ColumnMapping - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this ColumnMapping. # noqa: E501 + + + :return: The key of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this ColumnMapping. + + + :param key: The key of this ColumnMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this ColumnMapping. # noqa: E501 + + + :return: The type of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ColumnMapping. + + + :param type: The type of this ColumnMapping. # noqa: E501 + :type: str + """ + allowed_values = ["ACCESS_TOKEN", "DESCRIPTION", "IS_GATEWAY", "LABEL", "LWM2M_BOOTSTRAP_SERVER_PUBLIC_KEY_OR_ID", "LWM2M_BOOTSTRAP_SERVER_SECRET_KEY", "LWM2M_BOOTSTRAP_SERVER_SECURITY_MODE", "LWM2M_CLIENT_CERT", "LWM2M_CLIENT_ENDPOINT", "LWM2M_CLIENT_IDENTITY", "LWM2M_CLIENT_KEY", "LWM2M_CLIENT_SECURITY_CONFIG_MODE", "LWM2M_SERVER_CLIENT_PUBLIC_KEY_OR_ID", "LWM2M_SERVER_CLIENT_SECRET_KEY", "LWM2M_SERVER_SECURITY_MODE", "MQTT_CLIENT_ID", "MQTT_PASSWORD", "MQTT_USER_NAME", "NAME", "ROUTING_KEY", "SECRET", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIMESERIES", "TYPE", "X509"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ColumnMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ColumnMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/comparison_ts_value.py b/billinglayer/python/tb_rest_client/models/models_ce/comparison_ts_value.py new file mode 100644 index 0000000..aaaa30f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/comparison_ts_value.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComparisonTsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current': 'TsValue', + 'previous': 'TsValue' + } + + attribute_map = { + 'current': 'current', + 'previous': 'previous' + } + + def __init__(self, current=None, previous=None): # noqa: E501 + """ComparisonTsValue - a model defined in Swagger""" # noqa: E501 + self._current = None + self._previous = None + self.discriminator = None + if current is not None: + self.current = current + if previous is not None: + self.previous = previous + + @property + def current(self): + """Gets the current of this ComparisonTsValue. # noqa: E501 + + + :return: The current of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._current + + @current.setter + def current(self, current): + """Sets the current of this ComparisonTsValue. + + + :param current: The current of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._current = current + + @property + def previous(self): + """Gets the previous of this ComparisonTsValue. # noqa: E501 + + + :return: The previous of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._previous + + @previous.setter + def previous(self, previous): + """Sets the previous of this ComparisonTsValue. + + + :param previous: The previous of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._previous = previous + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComparisonTsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComparisonTsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/complex_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_ce/complex_filter_predicate.py new file mode 100644 index 0000000..c0d6431 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/complex_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class ComplexFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'predicates': 'list[KeyFilterPredicate]' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'predicates': 'predicates' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, predicates=None, *args, **kwargs): # noqa: E501 + """ComplexFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._predicates = None + self.discriminator = None + if operation is not None: + self.operation = operation + if predicates is not None: + self.predicates = predicates + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this ComplexFilterPredicate. # noqa: E501 + + + :return: The operation of this ComplexFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this ComplexFilterPredicate. + + + :param operation: The operation of this ComplexFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["AND", "OR"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def predicates(self): + """Gets the predicates of this ComplexFilterPredicate. # noqa: E501 + + + :return: The predicates of this ComplexFilterPredicate. # noqa: E501 + :rtype: list[KeyFilterPredicate] + """ + return self._predicates + + @predicates.setter + def predicates(self, predicates): + """Sets the predicates of this ComplexFilterPredicate. + + + :param predicates: The predicates of this ComplexFilterPredicate. # noqa: E501 + :type: list[KeyFilterPredicate] + """ + + self._predicates = predicates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/complex_version_create_request.py b/billinglayer/python/tb_rest_client/models/models_ce/complex_version_create_request.py new file mode 100644 index 0000000..a27cd23 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/complex_version_create_request.py @@ -0,0 +1,246 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class ComplexVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'entity_types': 'dict(str, EntityTypeVersionCreateConfig)', + 'sync_strategy': 'str', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'entity_types': 'entityTypes', + 'sync_strategy': 'syncStrategy', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, entity_types=None, sync_strategy=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """ComplexVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._entity_types = None + self._sync_strategy = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if entity_types is not None: + self.entity_types = entity_types + if sync_strategy is not None: + self.sync_strategy = sync_strategy + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this ComplexVersionCreateRequest. + + + :param branch: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def entity_types(self): + """Gets the entity_types of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionCreateConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this ComplexVersionCreateRequest. + + + :param entity_types: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionCreateConfig) + """ + + self._entity_types = entity_types + + @property + def sync_strategy(self): + """Gets the sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this ComplexVersionCreateRequest. + + + :param sync_strategy: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + @property + def type(self): + """Gets the type of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The type of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComplexVersionCreateRequest. + + + :param type: The type of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this ComplexVersionCreateRequest. + + + :param version_name: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/component_descriptor.py b/billinglayer/python/tb_rest_client/models/models_ce/component_descriptor.py new file mode 100644 index 0000000..efd5a19 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/component_descriptor.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptor(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'ComponentDescriptorId', + 'created_time': 'int', + 'type': 'str', + 'scope': 'str', + 'clustering_mode': 'str', + 'name': 'str', + 'clazz': 'str', + 'configuration_descriptor': 'JsonNode', + 'actions': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'type': 'type', + 'scope': 'scope', + 'clustering_mode': 'clusteringMode', + 'name': 'name', + 'clazz': 'clazz', + 'configuration_descriptor': 'configurationDescriptor', + 'actions': 'actions' + } + + def __init__(self, id=None, created_time=None, type=None, scope=None, clustering_mode=None, name=None, clazz=None, configuration_descriptor=None, actions=None): # noqa: E501 + """ComponentDescriptor - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._type = None + self._scope = None + self._clustering_mode = None + self._name = None + self._clazz = None + self._configuration_descriptor = None + self._actions = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if type is not None: + self.type = type + if scope is not None: + self.scope = scope + if clustering_mode is not None: + self.clustering_mode = clustering_mode + if name is not None: + self.name = name + if clazz is not None: + self.clazz = clazz + if configuration_descriptor is not None: + self.configuration_descriptor = configuration_descriptor + if actions is not None: + self.actions = actions + + @property + def id(self): + """Gets the id of this ComponentDescriptor. # noqa: E501 + + + :return: The id of this ComponentDescriptor. # noqa: E501 + :rtype: ComponentDescriptorId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptor. + + + :param id: The id of this ComponentDescriptor. # noqa: E501 + :type: ComponentDescriptorId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this ComponentDescriptor. # noqa: E501 + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :return: The created_time of this ComponentDescriptor. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ComponentDescriptor. + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this ComponentDescriptor. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def type(self): + """Gets the type of this ComponentDescriptor. # noqa: E501 + + Type of the Rule Node # noqa: E501 + + :return: The type of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComponentDescriptor. + + Type of the Rule Node # noqa: E501 + + :param type: The type of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ACTION", "ENRICHMENT", "EXTERNAL", "FILTER", "FLOW", "TRANSFORMATION"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def scope(self): + """Gets the scope of this ComponentDescriptor. # noqa: E501 + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :return: The scope of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this ComponentDescriptor. + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :param scope: The scope of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["TENANT"] # noqa: E501 + if scope not in allowed_values: + raise ValueError( + "Invalid value for `scope` ({0}), must be one of {1}" # noqa: E501 + .format(scope, allowed_values) + ) + + self._scope = scope + + @property + def clustering_mode(self): + """Gets the clustering_mode of this ComponentDescriptor. # noqa: E501 + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :return: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clustering_mode + + @clustering_mode.setter + def clustering_mode(self, clustering_mode): + """Sets the clustering_mode of this ComponentDescriptor. + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :param clustering_mode: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ENABLED", "SINGLETON", "USER_PREFERENCE"] # noqa: E501 + if clustering_mode not in allowed_values: + raise ValueError( + "Invalid value for `clustering_mode` ({0}), must be one of {1}" # noqa: E501 + .format(clustering_mode, allowed_values) + ) + + self._clustering_mode = clustering_mode + + @property + def name(self): + """Gets the name of this ComponentDescriptor. # noqa: E501 + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :return: The name of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ComponentDescriptor. + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :param name: The name of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def clazz(self): + """Gets the clazz of this ComponentDescriptor. # noqa: E501 + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :return: The clazz of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clazz + + @clazz.setter + def clazz(self, clazz): + """Sets the clazz of this ComponentDescriptor. + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :param clazz: The clazz of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._clazz = clazz + + @property + def configuration_descriptor(self): + """Gets the configuration_descriptor of this ComponentDescriptor. # noqa: E501 + + + :return: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration_descriptor + + @configuration_descriptor.setter + def configuration_descriptor(self, configuration_descriptor): + """Sets the configuration_descriptor of this ComponentDescriptor. + + + :param configuration_descriptor: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :type: JsonNode + """ + + self._configuration_descriptor = configuration_descriptor + + @property + def actions(self): + """Gets the actions of this ComponentDescriptor. # noqa: E501 + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :return: The actions of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._actions + + @actions.setter + def actions(self, actions): + """Sets the actions of this ComponentDescriptor. + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :param actions: The actions of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._actions = actions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptor, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptor): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/component_descriptor_id.py b/billinglayer/python/tb_rest_client/models/models_ce/component_descriptor_id.py new file mode 100644 index 0000000..401c397 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/component_descriptor_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptorId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """ComponentDescriptorId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this ComponentDescriptorId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this ComponentDescriptorId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptorId. + + string # noqa: E501 + + :param id: The id of this ComponentDescriptorId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptorId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptorId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/custom_time_schedule.py b/billinglayer/python/tb_rest_client/models/models_ce/custom_time_schedule.py new file mode 100644 index 0000000..18842eb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/custom_time_schedule.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'items': 'list[CustomTimeScheduleItem]', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'items': 'items', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, items=None, timezone=None, type=None): # noqa: E501 + """CustomTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._items = None + self._timezone = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if items is not None: + self.items = items + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this CustomTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this CustomTimeSchedule. + + + :param dynamic_value: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def items(self): + """Gets the items of this CustomTimeSchedule. # noqa: E501 + + + :return: The items of this CustomTimeSchedule. # noqa: E501 + :rtype: list[CustomTimeScheduleItem] + """ + return self._items + + @items.setter + def items(self, items): + """Sets the items of this CustomTimeSchedule. + + + :param items: The items of this CustomTimeSchedule. # noqa: E501 + :type: list[CustomTimeScheduleItem] + """ + + self._items = items + + @property + def timezone(self): + """Gets the timezone of this CustomTimeSchedule. # noqa: E501 + + + :return: The timezone of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this CustomTimeSchedule. + + + :param timezone: The timezone of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this CustomTimeSchedule. # noqa: E501 + + + :return: The type of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this CustomTimeSchedule. + + + :param type: The type of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/custom_time_schedule_item.py b/billinglayer/python/tb_rest_client/models/models_ce/custom_time_schedule_item.py new file mode 100644 index 0000000..010c246 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/custom_time_schedule_item.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeScheduleItem(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'day_of_week': 'int', + 'enabled': 'bool', + 'ends_on': 'int', + 'starts_on': 'int' + } + + attribute_map = { + 'day_of_week': 'dayOfWeek', + 'enabled': 'enabled', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn' + } + + def __init__(self, day_of_week=None, enabled=None, ends_on=None, starts_on=None): # noqa: E501 + """CustomTimeScheduleItem - a model defined in Swagger""" # noqa: E501 + self._day_of_week = None + self._enabled = None + self._ends_on = None + self._starts_on = None + self.discriminator = None + if day_of_week is not None: + self.day_of_week = day_of_week + if enabled is not None: + self.enabled = enabled + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + + @property + def day_of_week(self): + """Gets the day_of_week of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._day_of_week + + @day_of_week.setter + def day_of_week(self, day_of_week): + """Sets the day_of_week of this CustomTimeScheduleItem. + + + :param day_of_week: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._day_of_week = day_of_week + + @property + def enabled(self): + """Gets the enabled of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this CustomTimeScheduleItem. + + + :param enabled: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def ends_on(self): + """Gets the ends_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this CustomTimeScheduleItem. + + + :param ends_on: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this CustomTimeScheduleItem. + + + :param starts_on: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeScheduleItem, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeScheduleItem): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/customer.py b/billinglayer/python/tb_rest_client/models/models_ce/customer.py new file mode 100644 index 0000000..192f217 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/customer.py @@ -0,0 +1,475 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Customer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'CustomerId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'tenant_id': 'TenantId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'tenant_id': 'tenantId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, tenant_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None): # noqa: E501 + """Customer - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._tenant_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + self.tenant_id = tenant_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Customer. # noqa: E501 + + + :return: The id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Customer. + + + :param id: The id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Customer. # noqa: E501 + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :return: The created_time of this Customer. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Customer. + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Customer. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this Customer. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The title of this Customer. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Customer. + + Title of the customer # noqa: E501 + + :param title: The title of this Customer. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this Customer. # noqa: E501 + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this Customer. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Customer. + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this Customer. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this Customer. # noqa: E501 + + + :return: The tenant_id of this Customer. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Customer. + + + :param tenant_id: The tenant_id of this Customer. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def country(self): + """Gets the country of this Customer. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this Customer. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this Customer. + + Country # noqa: E501 + + :param country: The country of this Customer. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this Customer. # noqa: E501 + + State # noqa: E501 + + :return: The state of this Customer. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Customer. + + State # noqa: E501 + + :param state: The state of this Customer. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this Customer. # noqa: E501 + + City # noqa: E501 + + :return: The city of this Customer. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this Customer. + + City # noqa: E501 + + :param city: The city of this Customer. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this Customer. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this Customer. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this Customer. + + Address Line 1 # noqa: E501 + + :param address: The address of this Customer. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this Customer. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this Customer. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this Customer. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this Customer. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this Customer. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this Customer. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this Customer. + + Zip code # noqa: E501 + + :param zip: The zip of this Customer. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this Customer. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this Customer. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this Customer. + + Phone number # noqa: E501 + + :param phone: The phone of this Customer. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this Customer. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this Customer. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Customer. + + Email # noqa: E501 + + :param email: The email of this Customer. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this Customer. # noqa: E501 + + + :return: The additional_info of this Customer. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Customer. + + + :param additional_info: The additional_info of this Customer. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Customer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Customer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/customer_id.py b/billinglayer/python/tb_rest_client/models/models_ce/customer_id.py new file mode 100644 index 0000000..1199f81 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/customer_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """CustomerId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this CustomerId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CustomerId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this CustomerId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this CustomerId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this CustomerId. + + string # noqa: E501 + + :param entity_type: The entity_type of this CustomerId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/customer_users_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/customer_users_filter.py new file mode 100644 index 0000000..9246ce6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/customer_users_filter.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'str' + } + + attribute_map = { + 'customer_id': 'customerId' + } + + def __init__(self, customer_id=None): # noqa: E501 + """CustomerUsersFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + self.customer_id = customer_id + + @property + def customer_id(self): + """Gets the customer_id of this CustomerUsersFilter. # noqa: E501 + + + :return: The customer_id of this CustomerUsersFilter. # noqa: E501 + :rtype: str + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this CustomerUsersFilter. + + + :param customer_id: The customer_id of this CustomerUsersFilter. # noqa: E501 + :type: str + """ + if customer_id is None: + raise ValueError("Invalid value for `customer_id`, must not be `None`") # noqa: E501 + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dashboard.py b/billinglayer/python/tb_rest_client/models/models_ce/dashboard.py new file mode 100644 index 0000000..c947e99 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dashboard.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Dashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'title': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'image': 'str', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'title': 'title', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'image': 'image', + 'configuration': 'configuration' + } + + def __init__(self, created_time=None, tenant_id=None, name=None, title=None, assigned_customers=None, mobile_hide=None, mobile_order=None, image=None, configuration=None): # noqa: E501 + """Dashboard - a model defined in Swagger""" # noqa: E501 + self._created_time = None + self._tenant_id = None + self._name = None + self._title = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._image = None + self._configuration = None + self.discriminator = None + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if title is not None: + self.title = title + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if image is not None: + self.image = image + if configuration is not None: + self.configuration = configuration + + @property + def created_time(self): + """Gets the created_time of this Dashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Dashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Dashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Dashboard. # noqa: E501 + + + :return: The tenant_id of this Dashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Dashboard. + + + :param tenant_id: The tenant_id of this Dashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this Dashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Dashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this Dashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this Dashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Dashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this Dashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def assigned_customers(self): + """Gets the assigned_customers of this Dashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this Dashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this Dashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this Dashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this Dashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this Dashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this Dashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this Dashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this Dashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this Dashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this Dashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def image(self): + """Gets the image of this Dashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this Dashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this Dashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def configuration(self): + """Gets the configuration of this Dashboard. # noqa: E501 + + + :return: The configuration of this Dashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Dashboard. + + + :param configuration: The configuration of this Dashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Dashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Dashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dashboard_id.py b/billinglayer/python/tb_rest_client/models/models_ce/dashboard_id.py new file mode 100644 index 0000000..a56948a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dashboard_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DashboardId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DashboardId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DashboardId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DashboardId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DashboardId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DashboardId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DASHBOARD"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_ce/dashboard_info.py new file mode 100644 index 0000000..c943784 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dashboard_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'title': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'image': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'title': 'title', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'image': 'image' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, name=None, title=None, assigned_customers=None, mobile_hide=None, mobile_order=None, image=None): # noqa: E501 + """DashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._title = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._image = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if title is not None: + self.title = title + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if image is not None: + self.image = image + + @property + def id(self): + """Gets the id of this DashboardInfo. # noqa: E501 + + + :return: The id of this DashboardInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardInfo. + + + :param id: The id of this DashboardInfo. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DashboardInfo. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DashboardInfo. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DashboardInfo. # noqa: E501 + + + :return: The tenant_id of this DashboardInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DashboardInfo. + + + :param tenant_id: The tenant_id of this DashboardInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this DashboardInfo. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DashboardInfo. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this DashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this DashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def assigned_customers(self): + """Gets the assigned_customers of this DashboardInfo. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this DashboardInfo. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this DashboardInfo. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this DashboardInfo. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this DashboardInfo. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this DashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this DashboardInfo. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this DashboardInfo. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this DashboardInfo. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this DashboardInfo. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def image(self): + """Gets the image of this DashboardInfo. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DashboardInfo. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._image = image + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/debug_rule_chain_event_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/debug_rule_chain_event_filter.py new file mode 100644 index 0000000..fdeb490 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/debug_rule_chain_event_filter.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .event_filter import EventFilter # noqa: F401,E501 + +class DebugRuleChainEventFilter(EventFilter): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'event_type': 'str', + 'msg_direction_type': 'str', + 'server': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'entity_name': 'str', + 'relation_type': 'str', + 'entity_id': 'str', + 'msg_type': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'event_type': 'eventType', + 'msg_direction_type': 'msgDirectionType', + 'server': 'server', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'entity_name': 'entityName', + 'relation_type': 'relationType', + 'entity_id': 'entityId', + 'msg_type': 'msgType', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, event_type=None, msg_direction_type=None, server=None, data_search=None, metadata_search=None, entity_name=None, relation_type=None, entity_id=None, msg_type=None, error_str=None, *args, **kwargs): # noqa: E501 + """DebugRuleChainEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._event_type = None + self._msg_direction_type = None + self._server = None + self._data_search = None + self._metadata_search = None + self._entity_name = None + self._relation_type = None + self._entity_id = None + self._msg_type = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + self.event_type = event_type + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if server is not None: + self.server = server + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if entity_name is not None: + self.entity_name = entity_name + if relation_type is not None: + self.relation_type = relation_type + if entity_id is not None: + self.entity_id = entity_id + if msg_type is not None: + self.msg_type = msg_type + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugRuleChainEventFilter. # noqa: E501 + + + :return: The error of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugRuleChainEventFilter. + + + :param error: The error of this DebugRuleChainEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def event_type(self): + """Gets the event_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugRuleChainEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this DebugRuleChainEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def server(self): + """Gets the server of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugRuleChainEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def data_search(self): + """Gets the data_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def entity_name(self): + """Gets the entity_name of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this DebugRuleChainEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_name: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_name not in allowed_values: + raise ValueError( + "Invalid value for `entity_name` ({0}), must be one of {1}" # noqa: E501 + .format(entity_name, allowed_values) + ) + + self._entity_name = entity_name + + @property + def relation_type(self): + """Gets the relation_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DebugRuleChainEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_id(self): + """Gets the entity_id of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this DebugRuleChainEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def msg_type(self): + """Gets the msg_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this DebugRuleChainEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + @property + def error_str(self): + """Gets the error_str of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugRuleChainEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugRuleChainEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/default_coap_device_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/default_coap_device_type_configuration.py new file mode 100644 index 0000000..f4ed1f3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/default_coap_device_type_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.coap_device_type_configuration import CoapDeviceTypeConfiguration # noqa: F401,E501 + +class DefaultCoapDeviceTypeConfiguration(CoapDeviceTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "swagger_types"): + swagger_types.update(CoapDeviceTypeConfiguration.swagger_types) + + attribute_map = { + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "attribute_map"): + attribute_map.update(CoapDeviceTypeConfiguration.attribute_map) + + def __init__(self, transport_payload_type_configuration=None, *args, **kwargs): # noqa: E501 + """DefaultCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self._transport_payload_type_configuration = None + self.discriminator = None + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + CoapDeviceTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/default_device_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/default_device_configuration.py new file mode 100644 index 0000000..3a35c14 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/default_device_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_configuration import DeviceConfiguration # noqa: F401,E501 + +class DefaultDeviceConfiguration(DeviceConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceConfiguration, "swagger_types"): + swagger_types.update(DeviceConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceConfiguration, "attribute_map"): + attribute_map.update(DeviceConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/default_device_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/default_device_profile_configuration.py new file mode 100644 index 0000000..b849551 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/default_device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/default_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/default_device_profile_transport_configuration.py new file mode 100644 index 0000000..79d9c62 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/default_device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/default_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/default_device_transport_configuration.py new file mode 100644 index 0000000..8d5e1dd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/default_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class DefaultDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/default_rule_chain_create_request.py b/billinglayer/python/tb_rest_client/models/models_ce/default_rule_chain_create_request.py new file mode 100644 index 0000000..621a17b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/default_rule_chain_create_request.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultRuleChainCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str' + } + + attribute_map = { + 'name': 'name' + } + + def __init__(self, name=None): # noqa: E501 + """DefaultRuleChainCreateRequest - a model defined in Swagger""" # noqa: E501 + self._name = None + self.discriminator = None + self.name = name + + @property + def name(self): + """Gets the name of this DefaultRuleChainCreateRequest. # noqa: E501 + + Name of the new rule chain # noqa: E501 + + :return: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DefaultRuleChainCreateRequest. + + Name of the new rule chain # noqa: E501 + + :param name: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultRuleChainCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultRuleChainCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/default_tenant_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/default_tenant_profile_configuration.py new file mode 100644 index 0000000..82e00fe --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/default_tenant_profile_configuration.py @@ -0,0 +1,1242 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultTenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms_ttl_days': 'int', + 'cassandra_query_tenant_rate_limits_configuration': 'str', + 'customer_server_rest_limits_configuration': 'str', + 'default_storage_ttl_days': 'int', + 'max_assets': 'int', + 'max_created_alarms': 'int', + 'max_customers': 'int', + 'max_dp_storage_days': 'int', + 'max_dashboards': 'int', + 'max_devices': 'int', + 'max_emails': 'int', + 'max_js_executions': 'int', + 'max_ota_packages_in_bytes': 'int', + 'max_re_executions': 'int', + 'max_resources_in_bytes': 'int', + 'max_rule_chains': 'int', + 'max_rule_node_executions_per_message': 'int', + 'max_sms': 'int', + 'max_transport_data_points': 'int', + 'max_transport_messages': 'int', + 'max_users': 'int', + 'max_ws_sessions_per_customer': 'int', + 'max_ws_sessions_per_public_user': 'int', + 'max_ws_sessions_per_regular_user': 'int', + 'max_ws_sessions_per_tenant': 'int', + 'max_ws_subscriptions_per_customer': 'int', + 'max_ws_subscriptions_per_public_user': 'int', + 'max_ws_subscriptions_per_regular_user': 'int', + 'max_ws_subscriptions_per_tenant': 'int', + 'rpc_ttl_days': 'int', + 'tenant_entity_export_rate_limit': 'str', + 'tenant_entity_import_rate_limit': 'str', + 'tenant_notification_requests_per_rule_rate_limit': 'str', + 'tenant_notification_requests_rate_limit': 'str', + 'tenant_server_rest_limits_configuration': 'str', + 'transport_device_msg_rate_limit': 'str', + 'transport_device_telemetry_data_points_rate_limit': 'str', + 'transport_device_telemetry_msg_rate_limit': 'str', + 'transport_tenant_msg_rate_limit': 'str', + 'transport_tenant_telemetry_data_points_rate_limit': 'str', + 'transport_tenant_telemetry_msg_rate_limit': 'str', + 'warn_threshold': 'float', + 'ws_msg_queue_limit_per_session': 'int', + 'ws_updates_per_session_rate_limit': 'str' + } + + attribute_map = { + 'alarms_ttl_days': 'alarmsTtlDays', + 'cassandra_query_tenant_rate_limits_configuration': 'cassandraQueryTenantRateLimitsConfiguration', + 'customer_server_rest_limits_configuration': 'customerServerRestLimitsConfiguration', + 'default_storage_ttl_days': 'defaultStorageTtlDays', + 'max_assets': 'maxAssets', + 'max_created_alarms': 'maxCreatedAlarms', + 'max_customers': 'maxCustomers', + 'max_dp_storage_days': 'maxDPStorageDays', + 'max_dashboards': 'maxDashboards', + 'max_devices': 'maxDevices', + 'max_emails': 'maxEmails', + 'max_js_executions': 'maxJSExecutions', + 'max_ota_packages_in_bytes': 'maxOtaPackagesInBytes', + 'max_re_executions': 'maxREExecutions', + 'max_resources_in_bytes': 'maxResourcesInBytes', + 'max_rule_chains': 'maxRuleChains', + 'max_rule_node_executions_per_message': 'maxRuleNodeExecutionsPerMessage', + 'max_sms': 'maxSms', + 'max_transport_data_points': 'maxTransportDataPoints', + 'max_transport_messages': 'maxTransportMessages', + 'max_users': 'maxUsers', + 'max_ws_sessions_per_customer': 'maxWsSessionsPerCustomer', + 'max_ws_sessions_per_public_user': 'maxWsSessionsPerPublicUser', + 'max_ws_sessions_per_regular_user': 'maxWsSessionsPerRegularUser', + 'max_ws_sessions_per_tenant': 'maxWsSessionsPerTenant', + 'max_ws_subscriptions_per_customer': 'maxWsSubscriptionsPerCustomer', + 'max_ws_subscriptions_per_public_user': 'maxWsSubscriptionsPerPublicUser', + 'max_ws_subscriptions_per_regular_user': 'maxWsSubscriptionsPerRegularUser', + 'max_ws_subscriptions_per_tenant': 'maxWsSubscriptionsPerTenant', + 'rpc_ttl_days': 'rpcTtlDays', + 'tenant_entity_export_rate_limit': 'tenantEntityExportRateLimit', + 'tenant_entity_import_rate_limit': 'tenantEntityImportRateLimit', + 'tenant_notification_requests_per_rule_rate_limit': 'tenantNotificationRequestsPerRuleRateLimit', + 'tenant_notification_requests_rate_limit': 'tenantNotificationRequestsRateLimit', + 'tenant_server_rest_limits_configuration': 'tenantServerRestLimitsConfiguration', + 'transport_device_msg_rate_limit': 'transportDeviceMsgRateLimit', + 'transport_device_telemetry_data_points_rate_limit': 'transportDeviceTelemetryDataPointsRateLimit', + 'transport_device_telemetry_msg_rate_limit': 'transportDeviceTelemetryMsgRateLimit', + 'transport_tenant_msg_rate_limit': 'transportTenantMsgRateLimit', + 'transport_tenant_telemetry_data_points_rate_limit': 'transportTenantTelemetryDataPointsRateLimit', + 'transport_tenant_telemetry_msg_rate_limit': 'transportTenantTelemetryMsgRateLimit', + 'warn_threshold': 'warnThreshold', + 'ws_msg_queue_limit_per_session': 'wsMsgQueueLimitPerSession', + 'ws_updates_per_session_rate_limit': 'wsUpdatesPerSessionRateLimit' + } + + def __init__(self, alarms_ttl_days=None, cassandra_query_tenant_rate_limits_configuration=None, customer_server_rest_limits_configuration=None, default_storage_ttl_days=None, max_assets=None, max_created_alarms=None, max_customers=None, max_dp_storage_days=None, max_dashboards=None, max_devices=None, max_emails=None, max_js_executions=None, max_ota_packages_in_bytes=None, max_re_executions=None, max_resources_in_bytes=None, max_rule_chains=None, max_rule_node_executions_per_message=None, max_sms=None, max_transport_data_points=None, max_transport_messages=None, max_users=None, max_ws_sessions_per_customer=None, max_ws_sessions_per_public_user=None, max_ws_sessions_per_regular_user=None, max_ws_sessions_per_tenant=None, max_ws_subscriptions_per_customer=None, max_ws_subscriptions_per_public_user=None, max_ws_subscriptions_per_regular_user=None, max_ws_subscriptions_per_tenant=None, rpc_ttl_days=None, tenant_entity_export_rate_limit=None, tenant_entity_import_rate_limit=None, tenant_notification_requests_per_rule_rate_limit=None, tenant_notification_requests_rate_limit=None, tenant_server_rest_limits_configuration=None, transport_device_msg_rate_limit=None, transport_device_telemetry_data_points_rate_limit=None, transport_device_telemetry_msg_rate_limit=None, transport_tenant_msg_rate_limit=None, transport_tenant_telemetry_data_points_rate_limit=None, transport_tenant_telemetry_msg_rate_limit=None, warn_threshold=None, ws_msg_queue_limit_per_session=None, ws_updates_per_session_rate_limit=None): # noqa: E501 + """DefaultTenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self._alarms_ttl_days = None + self._cassandra_query_tenant_rate_limits_configuration = None + self._customer_server_rest_limits_configuration = None + self._default_storage_ttl_days = None + self._max_assets = None + self._max_created_alarms = None + self._max_customers = None + self._max_dp_storage_days = None + self._max_dashboards = None + self._max_devices = None + self._max_emails = None + self._max_js_executions = None + self._max_ota_packages_in_bytes = None + self._max_re_executions = None + self._max_resources_in_bytes = None + self._max_rule_chains = None + self._max_rule_node_executions_per_message = None + self._max_sms = None + self._max_transport_data_points = None + self._max_transport_messages = None + self._max_users = None + self._max_ws_sessions_per_customer = None + self._max_ws_sessions_per_public_user = None + self._max_ws_sessions_per_regular_user = None + self._max_ws_sessions_per_tenant = None + self._max_ws_subscriptions_per_customer = None + self._max_ws_subscriptions_per_public_user = None + self._max_ws_subscriptions_per_regular_user = None + self._max_ws_subscriptions_per_tenant = None + self._rpc_ttl_days = None + self._tenant_entity_export_rate_limit = None + self._tenant_entity_import_rate_limit = None + self._tenant_notification_requests_per_rule_rate_limit = None + self._tenant_notification_requests_rate_limit = None + self._tenant_server_rest_limits_configuration = None + self._transport_device_msg_rate_limit = None + self._transport_device_telemetry_data_points_rate_limit = None + self._transport_device_telemetry_msg_rate_limit = None + self._transport_tenant_msg_rate_limit = None + self._transport_tenant_telemetry_data_points_rate_limit = None + self._transport_tenant_telemetry_msg_rate_limit = None + self._warn_threshold = None + self._ws_msg_queue_limit_per_session = None + self._ws_updates_per_session_rate_limit = None + self.discriminator = None + if alarms_ttl_days is not None: + self.alarms_ttl_days = alarms_ttl_days + if cassandra_query_tenant_rate_limits_configuration is not None: + self.cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + if customer_server_rest_limits_configuration is not None: + self.customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + if default_storage_ttl_days is not None: + self.default_storage_ttl_days = default_storage_ttl_days + if max_assets is not None: + self.max_assets = max_assets + if max_created_alarms is not None: + self.max_created_alarms = max_created_alarms + if max_customers is not None: + self.max_customers = max_customers + if max_dp_storage_days is not None: + self.max_dp_storage_days = max_dp_storage_days + if max_dashboards is not None: + self.max_dashboards = max_dashboards + if max_devices is not None: + self.max_devices = max_devices + if max_emails is not None: + self.max_emails = max_emails + if max_js_executions is not None: + self.max_js_executions = max_js_executions + if max_ota_packages_in_bytes is not None: + self.max_ota_packages_in_bytes = max_ota_packages_in_bytes + if max_re_executions is not None: + self.max_re_executions = max_re_executions + if max_resources_in_bytes is not None: + self.max_resources_in_bytes = max_resources_in_bytes + if max_rule_chains is not None: + self.max_rule_chains = max_rule_chains + if max_rule_node_executions_per_message is not None: + self.max_rule_node_executions_per_message = max_rule_node_executions_per_message + if max_sms is not None: + self.max_sms = max_sms + if max_transport_data_points is not None: + self.max_transport_data_points = max_transport_data_points + if max_transport_messages is not None: + self.max_transport_messages = max_transport_messages + if max_users is not None: + self.max_users = max_users + if max_ws_sessions_per_customer is not None: + self.max_ws_sessions_per_customer = max_ws_sessions_per_customer + if max_ws_sessions_per_public_user is not None: + self.max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + if max_ws_sessions_per_regular_user is not None: + self.max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + if max_ws_sessions_per_tenant is not None: + self.max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + if max_ws_subscriptions_per_customer is not None: + self.max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + if max_ws_subscriptions_per_public_user is not None: + self.max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + if max_ws_subscriptions_per_regular_user is not None: + self.max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + if max_ws_subscriptions_per_tenant is not None: + self.max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + if rpc_ttl_days is not None: + self.rpc_ttl_days = rpc_ttl_days + if tenant_entity_export_rate_limit is not None: + self.tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + if tenant_entity_import_rate_limit is not None: + self.tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + if tenant_notification_requests_per_rule_rate_limit is not None: + self.tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + if tenant_notification_requests_rate_limit is not None: + self.tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + if tenant_server_rest_limits_configuration is not None: + self.tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + if transport_device_msg_rate_limit is not None: + self.transport_device_msg_rate_limit = transport_device_msg_rate_limit + if transport_device_telemetry_data_points_rate_limit is not None: + self.transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + if transport_device_telemetry_msg_rate_limit is not None: + self.transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + if transport_tenant_msg_rate_limit is not None: + self.transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + if transport_tenant_telemetry_data_points_rate_limit is not None: + self.transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + if transport_tenant_telemetry_msg_rate_limit is not None: + self.transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + if warn_threshold is not None: + self.warn_threshold = warn_threshold + if ws_msg_queue_limit_per_session is not None: + self.ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + if ws_updates_per_session_rate_limit is not None: + self.ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + @property + def alarms_ttl_days(self): + """Gets the alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._alarms_ttl_days + + @alarms_ttl_days.setter + def alarms_ttl_days(self, alarms_ttl_days): + """Sets the alarms_ttl_days of this DefaultTenantProfileConfiguration. + + + :param alarms_ttl_days: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._alarms_ttl_days = alarms_ttl_days + + @property + def cassandra_query_tenant_rate_limits_configuration(self): + """Gets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._cassandra_query_tenant_rate_limits_configuration + + @cassandra_query_tenant_rate_limits_configuration.setter + def cassandra_query_tenant_rate_limits_configuration(self, cassandra_query_tenant_rate_limits_configuration): + """Sets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param cassandra_query_tenant_rate_limits_configuration: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + + @property + def customer_server_rest_limits_configuration(self): + """Gets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._customer_server_rest_limits_configuration + + @customer_server_rest_limits_configuration.setter + def customer_server_rest_limits_configuration(self, customer_server_rest_limits_configuration): + """Sets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param customer_server_rest_limits_configuration: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + + @property + def default_storage_ttl_days(self): + """Gets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._default_storage_ttl_days + + @default_storage_ttl_days.setter + def default_storage_ttl_days(self, default_storage_ttl_days): + """Sets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. + + + :param default_storage_ttl_days: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._default_storage_ttl_days = default_storage_ttl_days + + @property + def max_assets(self): + """Gets the max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this DefaultTenantProfileConfiguration. + + + :param max_assets: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_created_alarms(self): + """Gets the max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_created_alarms + + @max_created_alarms.setter + def max_created_alarms(self, max_created_alarms): + """Sets the max_created_alarms of this DefaultTenantProfileConfiguration. + + + :param max_created_alarms: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_created_alarms = max_created_alarms + + @property + def max_customers(self): + """Gets the max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_customers + + @max_customers.setter + def max_customers(self, max_customers): + """Sets the max_customers of this DefaultTenantProfileConfiguration. + + + :param max_customers: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_customers = max_customers + + @property + def max_dp_storage_days(self): + """Gets the max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dp_storage_days + + @max_dp_storage_days.setter + def max_dp_storage_days(self, max_dp_storage_days): + """Sets the max_dp_storage_days of this DefaultTenantProfileConfiguration. + + + :param max_dp_storage_days: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dp_storage_days = max_dp_storage_days + + @property + def max_dashboards(self): + """Gets the max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dashboards + + @max_dashboards.setter + def max_dashboards(self, max_dashboards): + """Sets the max_dashboards of this DefaultTenantProfileConfiguration. + + + :param max_dashboards: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dashboards = max_dashboards + + @property + def max_devices(self): + """Gets the max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this DefaultTenantProfileConfiguration. + + + :param max_devices: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def max_emails(self): + """Gets the max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_emails + + @max_emails.setter + def max_emails(self, max_emails): + """Sets the max_emails of this DefaultTenantProfileConfiguration. + + + :param max_emails: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_emails = max_emails + + @property + def max_js_executions(self): + """Gets the max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_js_executions + + @max_js_executions.setter + def max_js_executions(self, max_js_executions): + """Sets the max_js_executions of this DefaultTenantProfileConfiguration. + + + :param max_js_executions: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_js_executions = max_js_executions + + @property + def max_ota_packages_in_bytes(self): + """Gets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ota_packages_in_bytes + + @max_ota_packages_in_bytes.setter + def max_ota_packages_in_bytes(self, max_ota_packages_in_bytes): + """Sets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_ota_packages_in_bytes: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ota_packages_in_bytes = max_ota_packages_in_bytes + + @property + def max_re_executions(self): + """Gets the max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_re_executions + + @max_re_executions.setter + def max_re_executions(self, max_re_executions): + """Sets the max_re_executions of this DefaultTenantProfileConfiguration. + + + :param max_re_executions: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_re_executions = max_re_executions + + @property + def max_resources_in_bytes(self): + """Gets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_resources_in_bytes + + @max_resources_in_bytes.setter + def max_resources_in_bytes(self, max_resources_in_bytes): + """Sets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_resources_in_bytes: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_resources_in_bytes = max_resources_in_bytes + + @property + def max_rule_chains(self): + """Gets the max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_chains + + @max_rule_chains.setter + def max_rule_chains(self, max_rule_chains): + """Sets the max_rule_chains of this DefaultTenantProfileConfiguration. + + + :param max_rule_chains: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_chains = max_rule_chains + + @property + def max_rule_node_executions_per_message(self): + """Gets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_node_executions_per_message + + @max_rule_node_executions_per_message.setter + def max_rule_node_executions_per_message(self, max_rule_node_executions_per_message): + """Sets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. + + + :param max_rule_node_executions_per_message: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_node_executions_per_message = max_rule_node_executions_per_message + + @property + def max_sms(self): + """Gets the max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_sms + + @max_sms.setter + def max_sms(self, max_sms): + """Sets the max_sms of this DefaultTenantProfileConfiguration. + + + :param max_sms: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_sms = max_sms + + @property + def max_transport_data_points(self): + """Gets the max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_data_points + + @max_transport_data_points.setter + def max_transport_data_points(self, max_transport_data_points): + """Sets the max_transport_data_points of this DefaultTenantProfileConfiguration. + + + :param max_transport_data_points: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_data_points = max_transport_data_points + + @property + def max_transport_messages(self): + """Gets the max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_messages + + @max_transport_messages.setter + def max_transport_messages(self, max_transport_messages): + """Sets the max_transport_messages of this DefaultTenantProfileConfiguration. + + + :param max_transport_messages: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_messages = max_transport_messages + + @property + def max_users(self): + """Gets the max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_users + + @max_users.setter + def max_users(self, max_users): + """Sets the max_users of this DefaultTenantProfileConfiguration. + + + :param max_users: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_users = max_users + + @property + def max_ws_sessions_per_customer(self): + """Gets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_customer + + @max_ws_sessions_per_customer.setter + def max_ws_sessions_per_customer(self, max_ws_sessions_per_customer): + """Sets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_customer: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_customer = max_ws_sessions_per_customer + + @property + def max_ws_sessions_per_public_user(self): + """Gets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_public_user + + @max_ws_sessions_per_public_user.setter + def max_ws_sessions_per_public_user(self, max_ws_sessions_per_public_user): + """Sets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_public_user: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + + @property + def max_ws_sessions_per_regular_user(self): + """Gets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_regular_user + + @max_ws_sessions_per_regular_user.setter + def max_ws_sessions_per_regular_user(self, max_ws_sessions_per_regular_user): + """Sets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_regular_user: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + + @property + def max_ws_sessions_per_tenant(self): + """Gets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_tenant + + @max_ws_sessions_per_tenant.setter + def max_ws_sessions_per_tenant(self, max_ws_sessions_per_tenant): + """Sets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_tenant: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + + @property + def max_ws_subscriptions_per_customer(self): + """Gets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_customer + + @max_ws_subscriptions_per_customer.setter + def max_ws_subscriptions_per_customer(self, max_ws_subscriptions_per_customer): + """Sets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_customer: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + + @property + def max_ws_subscriptions_per_public_user(self): + """Gets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_public_user + + @max_ws_subscriptions_per_public_user.setter + def max_ws_subscriptions_per_public_user(self, max_ws_subscriptions_per_public_user): + """Sets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_public_user: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + + @property + def max_ws_subscriptions_per_regular_user(self): + """Gets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_regular_user + + @max_ws_subscriptions_per_regular_user.setter + def max_ws_subscriptions_per_regular_user(self, max_ws_subscriptions_per_regular_user): + """Sets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_regular_user: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + + @property + def max_ws_subscriptions_per_tenant(self): + """Gets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_tenant + + @max_ws_subscriptions_per_tenant.setter + def max_ws_subscriptions_per_tenant(self, max_ws_subscriptions_per_tenant): + """Sets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_tenant: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + + @property + def rpc_ttl_days(self): + """Gets the rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._rpc_ttl_days + + @rpc_ttl_days.setter + def rpc_ttl_days(self, rpc_ttl_days): + """Sets the rpc_ttl_days of this DefaultTenantProfileConfiguration. + + + :param rpc_ttl_days: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._rpc_ttl_days = rpc_ttl_days + + @property + def tenant_entity_export_rate_limit(self): + """Gets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_export_rate_limit + + @tenant_entity_export_rate_limit.setter + def tenant_entity_export_rate_limit(self, tenant_entity_export_rate_limit): + """Sets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_export_rate_limit: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + + @property + def tenant_entity_import_rate_limit(self): + """Gets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_import_rate_limit + + @tenant_entity_import_rate_limit.setter + def tenant_entity_import_rate_limit(self, tenant_entity_import_rate_limit): + """Sets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_import_rate_limit: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + + @property + def tenant_notification_requests_per_rule_rate_limit(self): + """Gets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_per_rule_rate_limit + + @tenant_notification_requests_per_rule_rate_limit.setter + def tenant_notification_requests_per_rule_rate_limit(self, tenant_notification_requests_per_rule_rate_limit): + """Sets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_per_rule_rate_limit: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + + @property + def tenant_notification_requests_rate_limit(self): + """Gets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_rate_limit + + @tenant_notification_requests_rate_limit.setter + def tenant_notification_requests_rate_limit(self, tenant_notification_requests_rate_limit): + """Sets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_rate_limit: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + + @property + def tenant_server_rest_limits_configuration(self): + """Gets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_server_rest_limits_configuration + + @tenant_server_rest_limits_configuration.setter + def tenant_server_rest_limits_configuration(self, tenant_server_rest_limits_configuration): + """Sets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param tenant_server_rest_limits_configuration: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + + @property + def transport_device_msg_rate_limit(self): + """Gets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_msg_rate_limit + + @transport_device_msg_rate_limit.setter + def transport_device_msg_rate_limit(self, transport_device_msg_rate_limit): + """Sets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_msg_rate_limit: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_msg_rate_limit = transport_device_msg_rate_limit + + @property + def transport_device_telemetry_data_points_rate_limit(self): + """Gets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_data_points_rate_limit + + @transport_device_telemetry_data_points_rate_limit.setter + def transport_device_telemetry_data_points_rate_limit(self, transport_device_telemetry_data_points_rate_limit): + """Sets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_data_points_rate_limit: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + + @property + def transport_device_telemetry_msg_rate_limit(self): + """Gets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_msg_rate_limit + + @transport_device_telemetry_msg_rate_limit.setter + def transport_device_telemetry_msg_rate_limit(self, transport_device_telemetry_msg_rate_limit): + """Sets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_msg_rate_limit: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + + @property + def transport_tenant_msg_rate_limit(self): + """Gets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_msg_rate_limit + + @transport_tenant_msg_rate_limit.setter + def transport_tenant_msg_rate_limit(self, transport_tenant_msg_rate_limit): + """Sets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_msg_rate_limit: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + + @property + def transport_tenant_telemetry_data_points_rate_limit(self): + """Gets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_data_points_rate_limit + + @transport_tenant_telemetry_data_points_rate_limit.setter + def transport_tenant_telemetry_data_points_rate_limit(self, transport_tenant_telemetry_data_points_rate_limit): + """Sets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_data_points_rate_limit: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + + @property + def transport_tenant_telemetry_msg_rate_limit(self): + """Gets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_msg_rate_limit + + @transport_tenant_telemetry_msg_rate_limit.setter + def transport_tenant_telemetry_msg_rate_limit(self, transport_tenant_telemetry_msg_rate_limit): + """Sets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_msg_rate_limit: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + + @property + def warn_threshold(self): + """Gets the warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: float + """ + return self._warn_threshold + + @warn_threshold.setter + def warn_threshold(self, warn_threshold): + """Sets the warn_threshold of this DefaultTenantProfileConfiguration. + + + :param warn_threshold: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: float + """ + + self._warn_threshold = warn_threshold + + @property + def ws_msg_queue_limit_per_session(self): + """Gets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._ws_msg_queue_limit_per_session + + @ws_msg_queue_limit_per_session.setter + def ws_msg_queue_limit_per_session(self, ws_msg_queue_limit_per_session): + """Sets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. + + + :param ws_msg_queue_limit_per_session: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + + @property + def ws_updates_per_session_rate_limit(self): + """Gets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._ws_updates_per_session_rate_limit + + @ws_updates_per_session_rate_limit.setter + def ws_updates_per_session_rate_limit(self, ws_updates_per_session_rate_limit): + """Sets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. + + + :param ws_updates_per_session_rate_limit: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultTenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultTenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_entity_data_diff.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_entity_data_diff.py new file mode 100644 index 0000000..97d6061 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataDiff. + + + :param result: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataDiff. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_entity_data_info.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_entity_data_info.py new file mode 100644 index 0000000..fcc9c4f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_entity_data_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataInfo. + + + :param result: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_list_branch_info.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_list_branch_info.py new file mode 100644 index 0000000..84e1bb2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_list_branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListBranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListBranchInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The result of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListBranchInfo. + + + :param result: The result of this DeferredResultListBranchInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListBranchInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListBranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListBranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_list_versioned_entity_info.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_list_versioned_entity_info.py new file mode 100644 index 0000000..30d404b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_list_versioned_entity_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListVersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListVersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListVersionedEntityInfo. + + + :param result: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListVersionedEntityInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListVersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListVersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_page_data_entity_version.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_page_data_entity_version.py new file mode 100644 index 0000000..4749b47 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_page_data_entity_version.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultPageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultPageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultPageDataEntityVersion. + + + :param result: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultPageDataEntityVersion. + + + :param set_or_expired: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultPageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultPageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_repository_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_repository_settings.py new file mode 100644 index 0000000..1ab1ad0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_repository_settings.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultRepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultRepositorySettings - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The result of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultRepositorySettings. + + + :param result: The result of this DeferredResultRepositorySettings. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultRepositorySettings. + + + :param set_or_expired: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultRepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultRepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_response_entity.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_response_entity.py new file mode 100644 index 0000000..3ad93e3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_response_entity.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultResponseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultResponseEntity - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultResponseEntity. # noqa: E501 + + + :return: The result of this DeferredResultResponseEntity. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultResponseEntity. + + + :param result: The result of this DeferredResultResponseEntity. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultResponseEntity. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultResponseEntity. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultResponseEntity. + + + :param set_or_expired: The set_or_expired of this DeferredResultResponseEntity. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultResponseEntity, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultResponseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_void.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_void.py new file mode 100644 index 0000000..e7ea554 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_result_void.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultVoid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultVoid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultVoid. # noqa: E501 + + + :return: The result of this DeferredResultVoid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultVoid. + + + :param result: The result of this DeferredResultVoid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultVoid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultVoid. + + + :param set_or_expired: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultVoid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultVoid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/deferred_resultuuid.py b/billinglayer/python/tb_rest_client/models/models_ce/deferred_resultuuid.py new file mode 100644 index 0000000..178c6d7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/deferred_resultuuid.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultuuid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultuuid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultuuid. # noqa: E501 + + + :return: The result of this DeferredResultuuid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultuuid. + + + :param result: The result of this DeferredResultuuid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultuuid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultuuid. + + + :param set_or_expired: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultuuid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultuuid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_ce/delivery_method_notification_template.py new file mode 100644 index 0000000..7128664 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """DeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this DeliveryMethodNotificationTemplate. + + + :param body: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this DeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device.py b/billinglayer/python/tb_rest_client/models/models_ce/device.py new file mode 100644 index 0000000..7b838ea --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device.py @@ -0,0 +1,418 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Device(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None): # noqa: E501 + """Device - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Device. # noqa: E501 + + + :return: The id of this Device. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Device. + + + :param id: The id of this Device. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Device. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this Device. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Device. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Device. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Device. # noqa: E501 + + + :return: The tenant_id of this Device. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Device. + + + :param tenant_id: The tenant_id of this Device. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Device. # noqa: E501 + + + :return: The customer_id of this Device. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Device. + + + :param customer_id: The customer_id of this Device. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Device. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this Device. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Device. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this Device. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Device. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this Device. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Device. + + Device Profile Name # noqa: E501 + + :param type: The type of this Device. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def label(self): + """Gets the label of this Device. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Device. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Device. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Device. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this Device. # noqa: E501 + + + :return: The device_profile_id of this Device. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this Device. + + + :param device_profile_id: The device_profile_id of this Device. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this Device. # noqa: E501 + + + :return: The device_data of this Device. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this Device. + + + :param device_data: The device_data of this Device. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this Device. # noqa: E501 + + + :return: The firmware_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this Device. + + + :param firmware_id: The firmware_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this Device. # noqa: E501 + + + :return: The software_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this Device. + + + :param software_id: The software_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this Device. # noqa: E501 + + + :return: The additional_info of this Device. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Device. + + + :param additional_info: The additional_info of this Device. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Device, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Device): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_activity_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/device_activity_notification_rule_trigger_config.py new file mode 100644 index 0000000..02fdaf5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_activity_notification_rule_trigger_config.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class DeviceActivityNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_profiles': 'list[str]', + 'devices': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'device_profiles': 'deviceProfiles', + 'devices': 'devices', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, device_profiles=None, devices=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """DeviceActivityNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._device_profiles = None + self._devices = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if device_profiles is not None: + self.device_profiles = device_profiles + if devices is not None: + self.devices = devices + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def device_profiles(self): + """Gets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._device_profiles + + @device_profiles.setter + def device_profiles(self, device_profiles): + """Sets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. + + + :param device_profiles: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._device_profiles = device_profiles + + @property + def devices(self): + """Gets the devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this DeviceActivityNotificationRuleTriggerConfig. + + + :param devices: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._devices = devices + + @property + def notify_on(self): + """Gets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVE", "INACTIVE"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceActivityNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceActivityNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/device_configuration.py new file mode 100644 index 0000000..27c6c20 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_credentials.py b/billinglayer/python/tb_rest_client/models/models_ce/device_credentials.py new file mode 100644 index 0000000..6301ab8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_credentials.py @@ -0,0 +1,267 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceCredentials(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceCredentialsId', + 'created_time': 'int', + 'device_id': 'DeviceId', + 'credentials_type': 'str', + 'credentials_id': 'str', + 'credentials_value': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'device_id': 'deviceId', + 'credentials_type': 'credentialsType', + 'credentials_id': 'credentialsId', + 'credentials_value': 'credentialsValue' + } + + def __init__(self, id=None, created_time=None, device_id=None, credentials_type=None, credentials_id=None, credentials_value=None): # noqa: E501 + """DeviceCredentials - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._device_id = None + self._credentials_type = None + self._credentials_id = None + self._credentials_value = None + self.discriminator = None + self.id = id + if created_time is not None: + self.created_time = created_time + self.device_id = device_id + if credentials_type is not None: + self.credentials_type = credentials_type + self.credentials_id = credentials_id + if credentials_value is not None: + self.credentials_value = credentials_value + + @property + def id(self): + """Gets the id of this DeviceCredentials. # noqa: E501 + + + :return: The id of this DeviceCredentials. # noqa: E501 + :rtype: DeviceCredentialsId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceCredentials. + + + :param id: The id of this DeviceCredentials. # noqa: E501 + :type: DeviceCredentialsId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DeviceCredentials. # noqa: E501 + + Timestamp of the device credentials creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceCredentials. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceCredentials. + + Timestamp of the device credentials creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceCredentials. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def device_id(self): + """Gets the device_id of this DeviceCredentials. # noqa: E501 + + + :return: The device_id of this DeviceCredentials. # noqa: E501 + :rtype: DeviceId + """ + return self._device_id + + @device_id.setter + def device_id(self, device_id): + """Sets the device_id of this DeviceCredentials. + + + :param device_id: The device_id of this DeviceCredentials. # noqa: E501 + :type: DeviceId + """ + + self._device_id = device_id + + @property + def credentials_type(self): + """Gets the credentials_type of this DeviceCredentials. # noqa: E501 + + Type of the credentials # noqa: E501 + + :return: The credentials_type of this DeviceCredentials. # noqa: E501 + :rtype: str + """ + return self._credentials_type + + @credentials_type.setter + def credentials_type(self, credentials_type): + """Sets the credentials_type of this DeviceCredentials. + + Type of the credentials # noqa: E501 + + :param credentials_type: The credentials_type of this DeviceCredentials. # noqa: E501 + :type: str + """ + allowed_values = ["ACCESS_TOKEN", "LWM2M_CREDENTIALS", "MQTT_BASIC", "X509_CERTIFICATE"] # noqa: E501 + if credentials_type not in allowed_values: + raise ValueError( + "Invalid value for `credentials_type` ({0}), must be one of {1}" # noqa: E501 + .format(credentials_type, allowed_values) + ) + + self._credentials_type = credentials_type + + @property + def credentials_id(self): + """Gets the credentials_id of this DeviceCredentials. # noqa: E501 + + Unique Credentials Id per platform instance. Used to lookup credentials from the database. By default, new access token for your device. Depends on the type of the credentials. # noqa: E501 + + :return: The credentials_id of this DeviceCredentials. # noqa: E501 + :rtype: str + """ + return self._credentials_id + + @credentials_id.setter + def credentials_id(self, credentials_id): + """Sets the credentials_id of this DeviceCredentials. + + Unique Credentials Id per platform instance. Used to lookup credentials from the database. By default, new access token for your device. Depends on the type of the credentials. # noqa: E501 + + :param credentials_id: The credentials_id of this DeviceCredentials. # noqa: E501 + :type: str + """ + if credentials_id is None: + raise ValueError("Invalid value for `credentials_id`, must not be `None`") # noqa: E501 + + self._credentials_id = credentials_id + + @property + def credentials_value(self): + """Gets the credentials_value of this DeviceCredentials. # noqa: E501 + + Value of the credentials. Null in case of ACCESS_TOKEN credentials type. Base64 value in case of X509_CERTIFICATE. Complex object in case of MQTT_BASIC and LWM2M_CREDENTIALS # noqa: E501 + + :return: The credentials_value of this DeviceCredentials. # noqa: E501 + :rtype: str + """ + return self._credentials_value + + @credentials_value.setter + def credentials_value(self, credentials_value): + """Sets the credentials_value of this DeviceCredentials. + + Value of the credentials. Null in case of ACCESS_TOKEN credentials type. Base64 value in case of X509_CERTIFICATE. Complex object in case of MQTT_BASIC and LWM2M_CREDENTIALS # noqa: E501 + + :param credentials_value: The credentials_value of this DeviceCredentials. # noqa: E501 + :type: str + """ + + self._credentials_value = credentials_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceCredentials, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceCredentials): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_credentials_id.py b/billinglayer/python/tb_rest_client/models/models_ce/device_credentials_id.py new file mode 100644 index 0000000..cb6ce2f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_credentials_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceCredentialsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """DeviceCredentialsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this DeviceCredentialsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this DeviceCredentialsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceCredentialsId. + + string # noqa: E501 + + :param id: The id of this DeviceCredentialsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceCredentialsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceCredentialsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_data.py b/billinglayer/python/tb_rest_client/models/models_ce/device_data.py new file mode 100644 index 0000000..f5c925a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_data.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceConfiguration', + 'transport_configuration': 'DeviceTransportConfiguration' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration' + } + + def __init__(self, configuration=None, transport_configuration=None): # noqa: E501 + """DeviceData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + + @property + def configuration(self): + """Gets the configuration of this DeviceData. # noqa: E501 + + + :return: The configuration of this DeviceData. # noqa: E501 + :rtype: DeviceConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceData. + + + :param configuration: The configuration of this DeviceData. # noqa: E501 + :type: DeviceConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceData. # noqa: E501 + + + :return: The transport_configuration of this DeviceData. # noqa: E501 + :rtype: DeviceTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceData. + + + :param transport_configuration: The transport_configuration of this DeviceData. # noqa: E501 + :type: DeviceTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_export_data.py b/billinglayer/python/tb_rest_client/models/models_ce/device_export_data.py new file mode 100644 index 0000000..a410363 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class DeviceExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'credentials': 'DeviceCredentials', + 'entity': 'Device', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'credentials': 'credentials', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, credentials=None, entity=None, entity_type=None, relations=None, *args, **kwargs): # noqa: E501 + """DeviceExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._credentials = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if credentials is not None: + self.credentials = credentials + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this DeviceExportData. # noqa: E501 + + + :return: The attributes of this DeviceExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this DeviceExportData. + + + :param attributes: The attributes of this DeviceExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def credentials(self): + """Gets the credentials of this DeviceExportData. # noqa: E501 + + + :return: The credentials of this DeviceExportData. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this DeviceExportData. + + + :param credentials: The credentials of this DeviceExportData. # noqa: E501 + :type: DeviceCredentials + """ + + self._credentials = credentials + + @property + def entity(self): + """Gets the entity of this DeviceExportData. # noqa: E501 + + + :return: The entity of this DeviceExportData. # noqa: E501 + :rtype: Device + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this DeviceExportData. + + + :param entity: The entity of this DeviceExportData. # noqa: E501 + :type: Device + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this DeviceExportData. # noqa: E501 + + + :return: The entity_type of this DeviceExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceExportData. + + + :param entity_type: The entity_type of this DeviceExportData. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this DeviceExportData. # noqa: E501 + + + :return: The relations of this DeviceExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this DeviceExportData. + + + :param relations: The relations of this DeviceExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_id.py b/billinglayer/python/tb_rest_client/models/models_ce/device_id.py new file mode 100644 index 0000000..2fc8571 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_info.py b/billinglayer/python/tb_rest_client/models/models_ce/device_info.py new file mode 100644 index 0000000..c464108 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_info.py @@ -0,0 +1,532 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'bool', + 'device_profile_name': 'str', + 'active': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic', + 'device_profile_name': 'deviceProfileName', + 'active': 'active' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None, customer_title=None, customer_is_public=None, device_profile_name=None, active=None): # noqa: E501 + """DeviceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self._device_profile_name = None + self._active = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + if device_profile_name is not None: + self.device_profile_name = device_profile_name + if active is not None: + self.active = active + + @property + def id(self): + """Gets the id of this DeviceInfo. # noqa: E501 + + + :return: The id of this DeviceInfo. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceInfo. + + + :param id: The id of this DeviceInfo. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DeviceInfo. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceInfo. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceInfo. # noqa: E501 + + + :return: The tenant_id of this DeviceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceInfo. + + + :param tenant_id: The tenant_id of this DeviceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this DeviceInfo. # noqa: E501 + + + :return: The customer_id of this DeviceInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this DeviceInfo. + + + :param customer_id: The customer_id of this DeviceInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this DeviceInfo. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceInfo. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this DeviceInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this DeviceInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this DeviceInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this DeviceInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this DeviceInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this DeviceInfo. # noqa: E501 + + + :return: The device_profile_id of this DeviceInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this DeviceInfo. + + + :param device_profile_id: The device_profile_id of this DeviceInfo. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this DeviceInfo. # noqa: E501 + + + :return: The device_data of this DeviceInfo. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this DeviceInfo. + + + :param device_data: The device_data of this DeviceInfo. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this DeviceInfo. # noqa: E501 + + + :return: The firmware_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this DeviceInfo. + + + :param firmware_id: The firmware_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this DeviceInfo. # noqa: E501 + + + :return: The software_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this DeviceInfo. + + + :param software_id: The software_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this DeviceInfo. # noqa: E501 + + + :return: The additional_info of this DeviceInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this DeviceInfo. + + + :param additional_info: The additional_info of this DeviceInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this DeviceInfo. # noqa: E501 + + Title of the Customer that owns the device. # noqa: E501 + + :return: The customer_title of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this DeviceInfo. + + Title of the Customer that owns the device. # noqa: E501 + + :param customer_title: The customer_title of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this DeviceInfo. # noqa: E501 + + Indicates special 'Public' Customer that is auto-generated to use the devices on public dashboards. # noqa: E501 + + :return: The customer_is_public of this DeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this DeviceInfo. + + Indicates special 'Public' Customer that is auto-generated to use the devices on public dashboards. # noqa: E501 + + :param customer_is_public: The customer_is_public of this DeviceInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + @property + def device_profile_name(self): + """Gets the device_profile_name of this DeviceInfo. # noqa: E501 + + Name of the corresponding Device Profile. # noqa: E501 + + :return: The device_profile_name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._device_profile_name + + @device_profile_name.setter + def device_profile_name(self, device_profile_name): + """Sets the device_profile_name of this DeviceInfo. + + Name of the corresponding Device Profile. # noqa: E501 + + :param device_profile_name: The device_profile_name of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._device_profile_name = device_profile_name + + @property + def active(self): + """Gets the active of this DeviceInfo. # noqa: E501 + + Device active flag. # noqa: E501 + + :return: The active of this DeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._active + + @active.setter + def active(self, active): + """Sets the active of this DeviceInfo. + + Device active flag. # noqa: E501 + + :param active: The active of this DeviceInfo. # noqa: E501 + :type: bool + """ + + self._active = active + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile.py new file mode 100644 index 0000000..1b34838 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile.py @@ -0,0 +1,616 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceProfileId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'default': 'bool', + 'default_dashboard_id': 'DashboardId', + 'default_rule_chain_id': 'RuleChainId', + 'default_queue_name': 'str', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'description': 'str', + 'image': 'str', + 'provision_device_key': 'str', + 'transport_type': 'str', + 'provision_type': 'str', + 'profile_data': 'DeviceProfileData', + 'type': 'str', + 'default_edge_rule_chain_id': 'RuleChainId', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'default': 'default', + 'default_dashboard_id': 'defaultDashboardId', + 'default_rule_chain_id': 'defaultRuleChainId', + 'default_queue_name': 'defaultQueueName', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'description': 'description', + 'image': 'image', + 'provision_device_key': 'provisionDeviceKey', + 'transport_type': 'transportType', + 'provision_type': 'provisionType', + 'profile_data': 'profileData', + 'type': 'type', + 'default_edge_rule_chain_id': 'defaultEdgeRuleChainId', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, name=None, default=None, default_dashboard_id=None, default_rule_chain_id=None, default_queue_name=None, firmware_id=None, software_id=None, description=None, image=None, provision_device_key=None, transport_type=None, provision_type=None, profile_data=None, type=None, default_edge_rule_chain_id=None): # noqa: E501 + """DeviceProfile - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._default = None + self._default_dashboard_id = None + self._default_rule_chain_id = None + self._default_queue_name = None + self._firmware_id = None + self._software_id = None + self._description = None + self._image = None + self._provision_device_key = None + self._transport_type = None + self._provision_type = None + self._profile_data = None + self._type = None + self._default_edge_rule_chain_id = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if default is not None: + self.default = default + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if default_rule_chain_id is not None: + self.default_rule_chain_id = default_rule_chain_id + if default_queue_name is not None: + self.default_queue_name = default_queue_name + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if description is not None: + self.description = description + if image is not None: + self.image = image + if provision_device_key is not None: + self.provision_device_key = provision_device_key + if transport_type is not None: + self.transport_type = transport_type + if provision_type is not None: + self.provision_type = provision_type + if profile_data is not None: + self.profile_data = profile_data + if type is not None: + self.type = type + if default_edge_rule_chain_id is not None: + self.default_edge_rule_chain_id = default_edge_rule_chain_id + + @property + def id(self): + """Gets the id of this DeviceProfile. # noqa: E501 + + + :return: The id of this DeviceProfile. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfile. + + + :param id: The id of this DeviceProfile. # noqa: E501 + :type: DeviceProfileId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this DeviceProfile. # noqa: E501 + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceProfile. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceProfile. + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceProfile. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceProfile. # noqa: E501 + + + :return: The tenant_id of this DeviceProfile. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceProfile. + + + :param tenant_id: The tenant_id of this DeviceProfile. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this DeviceProfile. # noqa: E501 + + Unique Device Profile Name in scope of Tenant. # noqa: E501 + + :return: The name of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceProfile. + + Unique Device Profile Name in scope of Tenant. # noqa: E501 + + :param name: The name of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def default(self): + """Gets the default of this DeviceProfile. # noqa: E501 + + Used to mark the default profile. Default profile is used when the device profile is not specified during device creation. # noqa: E501 + + :return: The default of this DeviceProfile. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this DeviceProfile. + + Used to mark the default profile. Default profile is used when the device profile is not specified during device creation. # noqa: E501 + + :param default: The default of this DeviceProfile. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this DeviceProfile. # noqa: E501 + + + :return: The default_dashboard_id of this DeviceProfile. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this DeviceProfile. + + + :param default_dashboard_id: The default_dashboard_id of this DeviceProfile. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def default_rule_chain_id(self): + """Gets the default_rule_chain_id of this DeviceProfile. # noqa: E501 + + + :return: The default_rule_chain_id of this DeviceProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_rule_chain_id + + @default_rule_chain_id.setter + def default_rule_chain_id(self, default_rule_chain_id): + """Sets the default_rule_chain_id of this DeviceProfile. + + + :param default_rule_chain_id: The default_rule_chain_id of this DeviceProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_rule_chain_id = default_rule_chain_id + + @property + def default_queue_name(self): + """Gets the default_queue_name of this DeviceProfile. # noqa: E501 + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to device, including telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :return: The default_queue_name of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._default_queue_name + + @default_queue_name.setter + def default_queue_name(self, default_queue_name): + """Sets the default_queue_name of this DeviceProfile. + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to device, including telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :param default_queue_name: The default_queue_name of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._default_queue_name = default_queue_name + + @property + def firmware_id(self): + """Gets the firmware_id of this DeviceProfile. # noqa: E501 + + + :return: The firmware_id of this DeviceProfile. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this DeviceProfile. + + + :param firmware_id: The firmware_id of this DeviceProfile. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this DeviceProfile. # noqa: E501 + + + :return: The software_id of this DeviceProfile. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this DeviceProfile. + + + :param software_id: The software_id of this DeviceProfile. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def description(self): + """Gets the description of this DeviceProfile. # noqa: E501 + + Device Profile description. # noqa: E501 + + :return: The description of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this DeviceProfile. + + Device Profile description. # noqa: E501 + + :param description: The description of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this DeviceProfile. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :return: The image of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DeviceProfile. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :param image: The image of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def provision_device_key(self): + """Gets the provision_device_key of this DeviceProfile. # noqa: E501 + + Unique provisioning key used by 'Device Provisioning' feature. # noqa: E501 + + :return: The provision_device_key of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._provision_device_key + + @provision_device_key.setter + def provision_device_key(self, provision_device_key): + """Sets the provision_device_key of this DeviceProfile. + + Unique provisioning key used by 'Device Provisioning' feature. # noqa: E501 + + :param provision_device_key: The provision_device_key of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._provision_device_key = provision_device_key + + @property + def transport_type(self): + """Gets the transport_type of this DeviceProfile. # noqa: E501 + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :return: The transport_type of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._transport_type + + @transport_type.setter + def transport_type(self, transport_type): + """Sets the transport_type of this DeviceProfile. + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :param transport_type: The transport_type of this DeviceProfile. # noqa: E501 + :type: str + """ + allowed_values = ["COAP", "DEFAULT", "LWM2M", "MQTT", "SNMP"] # noqa: E501 + if transport_type not in allowed_values: + raise ValueError( + "Invalid value for `transport_type` ({0}), must be one of {1}" # noqa: E501 + .format(transport_type, allowed_values) + ) + + self._transport_type = transport_type + + @property + def provision_type(self): + """Gets the provision_type of this DeviceProfile. # noqa: E501 + + Provisioning strategy. # noqa: E501 + + :return: The provision_type of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._provision_type + + @provision_type.setter + def provision_type(self, provision_type): + """Sets the provision_type of this DeviceProfile. + + Provisioning strategy. # noqa: E501 + + :param provision_type: The provision_type of this DeviceProfile. # noqa: E501 + :type: str + """ + allowed_values = ["ALLOW_CREATE_NEW_DEVICES", "CHECK_PRE_PROVISIONED_DEVICES", "DISABLED", "X509_CERTIFICATE_CHAIN"] # noqa: E501 + if provision_type not in allowed_values: + raise ValueError( + "Invalid value for `provision_type` ({0}), must be one of {1}" # noqa: E501 + .format(provision_type, allowed_values) + ) + + self._provision_type = provision_type + + @property + def profile_data(self): + """Gets the profile_data of this DeviceProfile. # noqa: E501 + + + :return: The profile_data of this DeviceProfile. # noqa: E501 + :rtype: DeviceProfileData + """ + return self._profile_data + + @profile_data.setter + def profile_data(self, profile_data): + """Sets the profile_data of this DeviceProfile. + + + :param profile_data: The profile_data of this DeviceProfile. # noqa: E501 + :type: DeviceProfileData + """ + + self._profile_data = profile_data + + @property + def type(self): + """Gets the type of this DeviceProfile. # noqa: E501 + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :return: The type of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceProfile. + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :param type: The type of this DeviceProfile. # noqa: E501 + :type: str + """ + allowed_values = ["DEFAULT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def default_edge_rule_chain_id(self): + """Gets the default_edge_rule_chain_id of this DeviceProfile. # noqa: E501 + + + :return: The default_edge_rule_chain_id of this DeviceProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_edge_rule_chain_id + + @default_edge_rule_chain_id.setter + def default_edge_rule_chain_id(self, default_edge_rule_chain_id): + """Sets the default_edge_rule_chain_id of this DeviceProfile. + + + :param default_edge_rule_chain_id: The default_edge_rule_chain_id of this DeviceProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_edge_rule_chain_id = default_edge_rule_chain_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile_alarm.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_alarm.py new file mode 100644 index 0000000..f82a0f6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_alarm.py @@ -0,0 +1,320 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileAlarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'alarm_type': 'str', + 'create_rules': 'dict(str, AlarmRule)', + 'clear_rule': 'AlarmRule', + 'propagate': 'bool', + 'propagate_to_owner': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]' + } + + attribute_map = { + 'id': 'id', + 'alarm_type': 'alarmType', + 'create_rules': 'createRules', + 'clear_rule': 'clearRule', + 'propagate': 'propagate', + 'propagate_to_owner': 'propagateToOwner', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes' + } + + def __init__(self, id=None, alarm_type=None, create_rules=None, clear_rule=None, propagate=None, propagate_to_owner=None, propagate_to_tenant=None, propagate_relation_types=None): # noqa: E501 + """DeviceProfileAlarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._alarm_type = None + self._create_rules = None + self._clear_rule = None + self._propagate = None + self._propagate_to_owner = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self.discriminator = None + if id is not None: + self.id = id + if alarm_type is not None: + self.alarm_type = alarm_type + if create_rules is not None: + self.create_rules = create_rules + if clear_rule is not None: + self.clear_rule = clear_rule + if propagate is not None: + self.propagate = propagate + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + + @property + def id(self): + """Gets the id of this DeviceProfileAlarm. # noqa: E501 + + String value representing the alarm rule id # noqa: E501 + + :return: The id of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileAlarm. + + String value representing the alarm rule id # noqa: E501 + + :param id: The id of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def alarm_type(self): + """Gets the alarm_type of this DeviceProfileAlarm. # noqa: E501 + + String value representing type of the alarm # noqa: E501 + + :return: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._alarm_type + + @alarm_type.setter + def alarm_type(self, alarm_type): + """Sets the alarm_type of this DeviceProfileAlarm. + + String value representing type of the alarm # noqa: E501 + + :param alarm_type: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._alarm_type = alarm_type + + @property + def create_rules(self): + """Gets the create_rules of this DeviceProfileAlarm. # noqa: E501 + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :return: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :rtype: dict(str, AlarmRule) + """ + return self._create_rules + + @create_rules.setter + def create_rules(self, create_rules): + """Sets the create_rules of this DeviceProfileAlarm. + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :param create_rules: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :type: dict(str, AlarmRule) + """ + + self._create_rules = create_rules + + @property + def clear_rule(self): + """Gets the clear_rule of this DeviceProfileAlarm. # noqa: E501 + + + :return: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :rtype: AlarmRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this DeviceProfileAlarm. + + + :param clear_rule: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :type: AlarmRule + """ + + self._clear_rule = clear_rule + + @property + def propagate(self): + """Gets the propagate of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this DeviceProfileAlarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileAlarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileAlarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_configuration.py new file mode 100644 index 0000000..6063fbf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile_data.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_data.py new file mode 100644 index 0000000..95587cc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_data.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceProfileConfiguration', + 'transport_configuration': 'DeviceProfileTransportConfiguration', + 'provision_configuration': 'DeviceProfileProvisionConfiguration', + 'alarms': 'list[DeviceProfileAlarm]' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration', + 'provision_configuration': 'provisionConfiguration', + 'alarms': 'alarms' + } + + def __init__(self, configuration=None, transport_configuration=None, provision_configuration=None, alarms=None): # noqa: E501 + """DeviceProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self._provision_configuration = None + self._alarms = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + if provision_configuration is not None: + self.provision_configuration = provision_configuration + if alarms is not None: + self.alarms = alarms + + @property + def configuration(self): + """Gets the configuration of this DeviceProfileData. # noqa: E501 + + + :return: The configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceProfileData. + + + :param configuration: The configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The transport_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceProfileData. + + + :param transport_configuration: The transport_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + @property + def provision_configuration(self): + """Gets the provision_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The provision_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileProvisionConfiguration + """ + return self._provision_configuration + + @provision_configuration.setter + def provision_configuration(self, provision_configuration): + """Sets the provision_configuration of this DeviceProfileData. + + + :param provision_configuration: The provision_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileProvisionConfiguration + """ + + self._provision_configuration = provision_configuration + + @property + def alarms(self): + """Gets the alarms of this DeviceProfileData. # noqa: E501 + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :return: The alarms of this DeviceProfileData. # noqa: E501 + :rtype: list[DeviceProfileAlarm] + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this DeviceProfileData. + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :param alarms: The alarms of this DeviceProfileData. # noqa: E501 + :type: list[DeviceProfileAlarm] + """ + + self._alarms = alarms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile_id.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_id.py new file mode 100644 index 0000000..44eb3a4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile_info.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_info.py new file mode 100644 index 0000000..cd2a526 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_info.py @@ -0,0 +1,300 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str', + 'image': 'str', + 'default_dashboard_id': 'DashboardId', + 'type': 'str', + 'transport_type': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'image': 'image', + 'default_dashboard_id': 'defaultDashboardId', + 'type': 'type', + 'transport_type': 'transportType', + 'tenant_id': 'tenantId' + } + + def __init__(self, id=None, name=None, image=None, default_dashboard_id=None, type=None, transport_type=None, tenant_id=None): # noqa: E501 + """DeviceProfileInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._image = None + self._default_dashboard_id = None + self._type = None + self._transport_type = None + self._tenant_id = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if image is not None: + self.image = image + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if type is not None: + self.type = type + if transport_type is not None: + self.transport_type = transport_type + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def id(self): + """Gets the id of this DeviceProfileInfo. # noqa: E501 + + + :return: The id of this DeviceProfileInfo. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileInfo. + + + :param id: The id of this DeviceProfileInfo. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this DeviceProfileInfo. # noqa: E501 + + Entity Name # noqa: E501 + + :return: The name of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceProfileInfo. + + Entity Name # noqa: E501 + + :param name: The name of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def image(self): + """Gets the image of this DeviceProfileInfo. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :return: The image of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DeviceProfileInfo. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :param image: The image of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this DeviceProfileInfo. # noqa: E501 + + + :return: The default_dashboard_id of this DeviceProfileInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this DeviceProfileInfo. + + + :param default_dashboard_id: The default_dashboard_id of this DeviceProfileInfo. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def type(self): + """Gets the type of this DeviceProfileInfo. # noqa: E501 + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :return: The type of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceProfileInfo. + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :param type: The type of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + allowed_values = ["DEFAULT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def transport_type(self): + """Gets the transport_type of this DeviceProfileInfo. # noqa: E501 + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :return: The transport_type of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._transport_type + + @transport_type.setter + def transport_type(self, transport_type): + """Sets the transport_type of this DeviceProfileInfo. + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :param transport_type: The transport_type of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + allowed_values = ["COAP", "DEFAULT", "LWM2M", "MQTT", "SNMP"] # noqa: E501 + if transport_type not in allowed_values: + raise ValueError( + "Invalid value for `transport_type` ({0}), must be one of {1}" # noqa: E501 + .format(transport_type, allowed_values) + ) + + self._transport_type = transport_type + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceProfileInfo. # noqa: E501 + + + :return: The tenant_id of this DeviceProfileInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceProfileInfo. + + + :param tenant_id: The tenant_id of this DeviceProfileInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_provision_configuration.py new file mode 100644 index 0000000..5a358b0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """DeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_transport_configuration.py new file mode 100644 index 0000000..fbb227e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_search_query.py b/billinglayer/python/tb_rest_client/models/models_ce/device_search_query.py new file mode 100644 index 0000000..20d3539 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'device_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'device_types': 'deviceTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, device_types=None, parameters=None): # noqa: E501 + """DeviceSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._device_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if device_types is not None: + self.device_types = device_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this DeviceSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this DeviceSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQuery. # noqa: E501 + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The device_types of this DeviceSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQuery. + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param device_types: The device_types of this DeviceSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def parameters(self): + """Gets the parameters of this DeviceSearchQuery. # noqa: E501 + + + :return: The parameters of this DeviceSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this DeviceSearchQuery. + + + :param parameters: The parameters of this DeviceSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/device_search_query_filter.py new file mode 100644 index 0000000..9cb350f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_types': 'deviceTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """DeviceSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._device_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if device_types is not None: + self.device_types = device_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQueryFilter. + + + :param device_types: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def direction(self): + """Gets the direction of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this DeviceSearchQueryFilter. + + + :param direction: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this DeviceSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this DeviceSearchQueryFilter. + + + :param max_level: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQueryFilter. + + + :param relation_type: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this DeviceSearchQueryFilter. + + + :param root_entity: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/device_transport_configuration.py new file mode 100644 index 0000000..c8e4205 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/device_type_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/device_type_filter.py new file mode 100644 index 0000000..d48f164 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/device_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_name_filter': 'str', + 'device_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_name_filter': 'deviceNameFilter', + 'device_types': 'deviceTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_name_filter=None, device_types=None, *args, **kwargs): # noqa: E501 + """DeviceTypeFilter - a model defined in Swagger""" # noqa: E501 + self._device_name_filter = None + self._device_types = None + self.discriminator = None + if device_name_filter is not None: + self.device_name_filter = device_name_filter + if device_types is not None: + self.device_types = device_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_name_filter(self): + """Gets the device_name_filter of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :rtype: str + """ + return self._device_name_filter + + @device_name_filter.setter + def device_name_filter(self, device_name_filter): + """Sets the device_name_filter of this DeviceTypeFilter. + + + :param device_name_filter: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :type: str + """ + + self._device_name_filter = device_name_filter + + @property + def device_types(self): + """Gets the device_types of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_types of this DeviceTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceTypeFilter. + + + :param device_types: The device_types of this DeviceTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/disabled_device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/disabled_device_profile_provision_configuration.py new file mode 100644 index 0000000..9f10c32 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/disabled_device_profile_provision_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class DisabledDeviceProfileProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """DisabledDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DisabledDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DisabledDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/duration_alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_ce/duration_alarm_condition_spec.py new file mode 100644 index 0000000..12043e4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/duration_alarm_condition_spec.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class DurationAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValuelong', + 'unit': 'str' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate', + 'unit': 'unit' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, unit=None, *args, **kwargs): # noqa: E501 + """DurationAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self._unit = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + if unit is not None: + self.unit = unit + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValuelong + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this DurationAlarmConditionSpec. + + + :param predicate: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValuelong + """ + + self._predicate = predicate + + @property + def unit(self): + """Gets the unit of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: str + """ + return self._unit + + @unit.setter + def unit(self, unit): + """Sets the unit of this DurationAlarmConditionSpec. + + + :param unit: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :type: str + """ + allowed_values = ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"] # noqa: E501 + if unit not in allowed_values: + raise ValueError( + "Invalid value for `unit` ({0}), must be one of {1}" # noqa: E501 + .format(unit, allowed_values) + ) + + self._unit = unit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DurationAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DurationAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valueboolean.py b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valueboolean.py new file mode 100644 index 0000000..b93e9e7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valueboolean.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueboolean - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueboolean. # noqa: E501 + + + :return: The inherit of this DynamicValueboolean. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueboolean. + + + :param inherit: The inherit of this DynamicValueboolean. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueboolean. # noqa: E501 + + + :return: The source_attribute of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueboolean. + + + :param source_attribute: The source_attribute of this DynamicValueboolean. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueboolean. # noqa: E501 + + + :return: The source_type of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueboolean. + + + :param source_type: The source_type of this DynamicValueboolean. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuedouble.py b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuedouble.py new file mode 100644 index 0000000..f5fa9f4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuedouble.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuedouble - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuedouble. # noqa: E501 + + + :return: The inherit of this DynamicValuedouble. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuedouble. + + + :param inherit: The inherit of this DynamicValuedouble. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuedouble. # noqa: E501 + + + :return: The source_attribute of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuedouble. + + + :param source_attribute: The source_attribute of this DynamicValuedouble. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuedouble. # noqa: E501 + + + :return: The source_type of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuedouble. + + + :param source_type: The source_type of this DynamicValuedouble. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valueint.py b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valueint.py new file mode 100644 index 0000000..b3c9d0b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valueint.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueint - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueint. # noqa: E501 + + + :return: The inherit of this DynamicValueint. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueint. + + + :param inherit: The inherit of this DynamicValueint. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueint. # noqa: E501 + + + :return: The source_attribute of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueint. + + + :param source_attribute: The source_attribute of this DynamicValueint. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueint. # noqa: E501 + + + :return: The source_type of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueint. + + + :param source_type: The source_type of this DynamicValueint. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuelong.py b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuelong.py new file mode 100644 index 0000000..8fa78d9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuelong.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuelong - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuelong. # noqa: E501 + + + :return: The inherit of this DynamicValuelong. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuelong. + + + :param inherit: The inherit of this DynamicValuelong. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuelong. # noqa: E501 + + + :return: The source_attribute of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuelong. + + + :param source_attribute: The source_attribute of this DynamicValuelong. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuelong. # noqa: E501 + + + :return: The source_type of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuelong. + + + :param source_type: The source_type of this DynamicValuelong. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuestring.py b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuestring.py new file mode 100644 index 0000000..89e7e48 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/dynamic_valuestring.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuestring - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuestring. # noqa: E501 + + + :return: The inherit of this DynamicValuestring. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuestring. + + + :param inherit: The inherit of this DynamicValuestring. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuestring. # noqa: E501 + + + :return: The source_attribute of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuestring. + + + :param source_attribute: The source_attribute of this DynamicValuestring. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuestring. # noqa: E501 + + + :return: The source_type of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuestring. + + + :param source_type: The source_type of this DynamicValuestring. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge.py b/billinglayer/python/tb_rest_client/models/models_ce/edge.py new file mode 100644 index 0000000..9c02d2c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge.py @@ -0,0 +1,400 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Edge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret' + } + + def __init__(self, additional_info=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None): # noqa: E501 + """Edge - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + + @property + def additional_info(self): + """Gets the additional_info of this Edge. # noqa: E501 + + + :return: The additional_info of this Edge. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Edge. + + + :param additional_info: The additional_info of this Edge. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def id(self): + """Gets the id of this Edge. # noqa: E501 + + + :return: The id of this Edge. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Edge. + + + :param id: The id of this Edge. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Edge. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this Edge. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Edge. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Edge. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Edge. # noqa: E501 + + + :return: The tenant_id of this Edge. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Edge. + + + :param tenant_id: The tenant_id of this Edge. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Edge. # noqa: E501 + + + :return: The customer_id of this Edge. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Edge. + + + :param customer_id: The customer_id of this Edge. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this Edge. # noqa: E501 + + + :return: The root_rule_chain_id of this Edge. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this Edge. + + + :param root_rule_chain_id: The root_rule_chain_id of this Edge. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this Edge. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this Edge. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Edge. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this Edge. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Edge. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this Edge. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Edge. + + Edge type # noqa: E501 + + :param type: The type of this Edge. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this Edge. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Edge. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Edge. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Edge. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this Edge. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this Edge. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this Edge. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this Edge. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this Edge. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this Edge. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this Edge. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this Edge. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Edge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Edge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_event.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_event.py new file mode 100644 index 0000000..8bace4f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_event.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'action': 'str', + 'body': 'JsonNode', + 'created_time': 'int', + 'edge_id': 'EdgeId', + 'entity_id': 'str', + 'id': 'EdgeEventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str' + } + + attribute_map = { + 'action': 'action', + 'body': 'body', + 'created_time': 'createdTime', + 'edge_id': 'edgeId', + 'entity_id': 'entityId', + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid' + } + + def __init__(self, action=None, body=None, created_time=None, edge_id=None, entity_id=None, id=None, tenant_id=None, type=None, uid=None): # noqa: E501 + """EdgeEvent - a model defined in Swagger""" # noqa: E501 + self._action = None + self._body = None + self._created_time = None + self._edge_id = None + self._entity_id = None + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self.discriminator = None + if action is not None: + self.action = action + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + if edge_id is not None: + self.edge_id = edge_id + if entity_id is not None: + self.entity_id = entity_id + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + + @property + def action(self): + """Gets the action of this EdgeEvent. # noqa: E501 + + + :return: The action of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._action + + @action.setter + def action(self, action): + """Sets the action of this EdgeEvent. + + + :param action: The action of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADDED", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_UNASSIGNED", "ASSIGNED_TO_CUSTOMER", "ASSIGNED_TO_EDGE", "ATTRIBUTES_DELETED", "ATTRIBUTES_UPDATED", "CREDENTIALS_REQUEST", "CREDENTIALS_UPDATED", "DELETED", "ENTITY_MERGE_REQUEST", "POST_ATTRIBUTES", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "RPC_CALL", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_CUSTOMER", "UNASSIGNED_FROM_EDGE", "UPDATED"] # noqa: E501 + if action not in allowed_values: + raise ValueError( + "Invalid value for `action` ({0}), must be one of {1}" # noqa: E501 + .format(action, allowed_values) + ) + + self._action = action + + @property + def body(self): + """Gets the body of this EdgeEvent. # noqa: E501 + + + :return: The body of this EdgeEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EdgeEvent. + + + :param body: The body of this EdgeEvent. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EdgeEvent. # noqa: E501 + + + :return: The created_time of this EdgeEvent. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeEvent. + + + :param created_time: The created_time of this EdgeEvent. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def edge_id(self): + """Gets the edge_id of this EdgeEvent. # noqa: E501 + + + :return: The edge_id of this EdgeEvent. # noqa: E501 + :rtype: EdgeId + """ + return self._edge_id + + @edge_id.setter + def edge_id(self, edge_id): + """Sets the edge_id of this EdgeEvent. + + + :param edge_id: The edge_id of this EdgeEvent. # noqa: E501 + :type: EdgeId + """ + + self._edge_id = edge_id + + @property + def entity_id(self): + """Gets the entity_id of this EdgeEvent. # noqa: E501 + + + :return: The entity_id of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EdgeEvent. + + + :param entity_id: The entity_id of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def id(self): + """Gets the id of this EdgeEvent. # noqa: E501 + + + :return: The id of this EdgeEvent. # noqa: E501 + :rtype: EdgeEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEvent. + + + :param id: The id of this EdgeEvent. # noqa: E501 + :type: EdgeEventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeEvent. # noqa: E501 + + + :return: The tenant_id of this EdgeEvent. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeEvent. + + + :param tenant_id: The tenant_id of this EdgeEvent. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EdgeEvent. # noqa: E501 + + + :return: The type of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeEvent. + + + :param type: The type of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADMIN_SETTINGS", "ALARM", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "OTA_PACKAGE", "QUEUE", "RELATION", "RULE_CHAIN", "RULE_CHAIN_METADATA", "TENANT", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def uid(self): + """Gets the uid of this EdgeEvent. # noqa: E501 + + + :return: The uid of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EdgeEvent. + + + :param uid: The uid of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._uid = uid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_event_id.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_event_id.py new file mode 100644 index 0000000..88475c0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EdgeEventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EdgeEventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EdgeEventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEventId. + + string # noqa: E501 + + :param id: The id of this EdgeEventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_id.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_id.py new file mode 100644 index 0000000..baa1e30 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EdgeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EdgeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EdgeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EdgeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EdgeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EdgeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["EDGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_info.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_info.py new file mode 100644 index 0000000..d5212b0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_info.py @@ -0,0 +1,452 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'customer_is_public': 'bool', + 'customer_title': 'str', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'customer_is_public': 'customerIsPublic', + 'customer_title': 'customerTitle', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret' + } + + def __init__(self, additional_info=None, customer_is_public=None, customer_title=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None): # noqa: E501 + """EdgeInfo - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._customer_is_public = None + self._customer_title = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if customer_is_public is not None: + self.customer_is_public = customer_is_public + if customer_title is not None: + self.customer_title = customer_title + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + + @property + def additional_info(self): + """Gets the additional_info of this EdgeInfo. # noqa: E501 + + + :return: The additional_info of this EdgeInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EdgeInfo. + + + :param additional_info: The additional_info of this EdgeInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_is_public(self): + """Gets the customer_is_public of this EdgeInfo. # noqa: E501 + + + :return: The customer_is_public of this EdgeInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this EdgeInfo. + + + :param customer_is_public: The customer_is_public of this EdgeInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + @property + def customer_title(self): + """Gets the customer_title of this EdgeInfo. # noqa: E501 + + + :return: The customer_title of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this EdgeInfo. + + + :param customer_title: The customer_title of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def id(self): + """Gets the id of this EdgeInfo. # noqa: E501 + + + :return: The id of this EdgeInfo. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeInfo. + + + :param id: The id of this EdgeInfo. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EdgeInfo. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this EdgeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeInfo. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EdgeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeInfo. # noqa: E501 + + + :return: The tenant_id of this EdgeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeInfo. + + + :param tenant_id: The tenant_id of this EdgeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EdgeInfo. # noqa: E501 + + + :return: The customer_id of this EdgeInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EdgeInfo. + + + :param customer_id: The customer_id of this EdgeInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this EdgeInfo. # noqa: E501 + + + :return: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this EdgeInfo. + + + :param root_rule_chain_id: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this EdgeInfo. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EdgeInfo. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this EdgeInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EdgeInfo. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeInfo. + + Edge type # noqa: E501 + + :param type: The type of this EdgeInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this EdgeInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this EdgeInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this EdgeInfo. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this EdgeInfo. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this EdgeInfo. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this EdgeInfo. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this EdgeInfo. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this EdgeInfo. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_install_instructions.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_install_instructions.py new file mode 100644 index 0000000..d916bf2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_install_instructions.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInstallInstructions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'docker_install_instructions': 'str' + } + + attribute_map = { + 'docker_install_instructions': 'dockerInstallInstructions' + } + + def __init__(self, docker_install_instructions=None): # noqa: E501 + """EdgeInstallInstructions - a model defined in Swagger""" # noqa: E501 + self._docker_install_instructions = None + self.discriminator = None + if docker_install_instructions is not None: + self.docker_install_instructions = docker_install_instructions + + @property + def docker_install_instructions(self): + """Gets the docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + + Markdown with docker install instructions # noqa: E501 + + :return: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :rtype: str + """ + return self._docker_install_instructions + + @docker_install_instructions.setter + def docker_install_instructions(self, docker_install_instructions): + """Sets the docker_install_instructions of this EdgeInstallInstructions. + + Markdown with docker install instructions # noqa: E501 + + :param docker_install_instructions: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :type: str + """ + + self._docker_install_instructions = docker_install_instructions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInstallInstructions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInstallInstructions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_search_query.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_search_query.py new file mode 100644 index 0000000..1d565c5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'edge_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'edge_types': 'edgeTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, edge_types=None, parameters=None): # noqa: E501 + """EdgeSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._edge_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if edge_types is not None: + self.edge_types = edge_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQuery. # noqa: E501 + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EdgeSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQuery. + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EdgeSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQuery. # noqa: E501 + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :return: The edge_types of this EdgeSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQuery. + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :param edge_types: The edge_types of this EdgeSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def parameters(self): + """Gets the parameters of this EdgeSearchQuery. # noqa: E501 + + + :return: The parameters of this EdgeSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EdgeSearchQuery. + + + :param parameters: The parameters of this EdgeSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_search_query_filter.py new file mode 100644 index 0000000..d669ed0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'edge_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'edge_types': 'edgeTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, edge_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EdgeSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._edge_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if edge_types is not None: + self.edge_types = edge_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EdgeSearchQueryFilter. + + + :param direction: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQueryFilter. + + + :param edge_types: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EdgeSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EdgeSearchQueryFilter. + + + :param max_level: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQueryFilter. + + + :param relation_type: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EdgeSearchQueryFilter. + + + :param root_entity: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/edge_type_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/edge_type_filter.py new file mode 100644 index 0000000..5fa0a1c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/edge_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edge_name_filter': 'str', + 'edge_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'edge_name_filter': 'edgeNameFilter', + 'edge_types': 'edgeTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, edge_name_filter=None, edge_types=None, *args, **kwargs): # noqa: E501 + """EdgeTypeFilter - a model defined in Swagger""" # noqa: E501 + self._edge_name_filter = None + self._edge_types = None + self.discriminator = None + if edge_name_filter is not None: + self.edge_name_filter = edge_name_filter + if edge_types is not None: + self.edge_types = edge_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def edge_name_filter(self): + """Gets the edge_name_filter of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :rtype: str + """ + return self._edge_name_filter + + @edge_name_filter.setter + def edge_name_filter(self, edge_name_filter): + """Sets the edge_name_filter of this EdgeTypeFilter. + + + :param edge_name_filter: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :type: str + """ + + self._edge_name_filter = edge_name_filter + + @property + def edge_types(self): + """Gets the edge_types of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_types of this EdgeTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeTypeFilter. + + + :param edge_types: The edge_types of this EdgeTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/efento_coap_device_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/efento_coap_device_type_configuration.py new file mode 100644 index 0000000..a4191b7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/efento_coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EfentoCoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """EfentoCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EfentoCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EfentoCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/email_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_ce/email_delivery_method_notification_template.py new file mode 100644 index 0000000..7e84a82 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/email_delivery_method_notification_template.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.delivery_method_notification_template import DeliveryMethodNotificationTemplate # noqa: F401,E501 + +class EmailDeliveryMethodNotificationTemplate(DeliveryMethodNotificationTemplate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + if hasattr(DeliveryMethodNotificationTemplate, "swagger_types"): + swagger_types.update(DeliveryMethodNotificationTemplate.swagger_types) + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + if hasattr(DeliveryMethodNotificationTemplate, "attribute_map"): + attribute_map.update(DeliveryMethodNotificationTemplate.attribute_map) + + def __init__(self, body=None, enabled=None, subject=None, *args, **kwargs): # noqa: E501 + """EmailDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + DeliveryMethodNotificationTemplate.__init__(self, *args, **kwargs) + + @property + def body(self): + """Gets the body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EmailDeliveryMethodNotificationTemplate. + + + :param body: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this EmailDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this EmailDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/email_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_ce/email_two_fa_account_config.py new file mode 100644 index 0000000..b286af9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/email_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EmailTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'email': 'email', + 'use_by_default': 'useByDefault' + } + + def __init__(self, email=None, use_by_default=None): # noqa: E501 + """EmailTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._email = None + self._use_by_default = None + self.discriminator = None + self.email = email + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def email(self): + """Gets the email of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this EmailTwoFaAccountConfig. + + + :param email: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if email is None: + raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + + self._email = email + + @property + def use_by_default(self): + """Gets the use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this EmailTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/email_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_ce/email_two_fa_provider_config.py new file mode 100644 index 0000000..a25b758 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/email_two_fa_provider_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.two_fa_provider_config import TwoFaProviderConfig # noqa: F401,E501 + +class EmailTwoFaProviderConfig(TwoFaProviderConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'verification_code_lifetime': 'int' + } + if hasattr(TwoFaProviderConfig, "swagger_types"): + swagger_types.update(TwoFaProviderConfig.swagger_types) + + attribute_map = { + 'verification_code_lifetime': 'verificationCodeLifetime' + } + if hasattr(TwoFaProviderConfig, "attribute_map"): + attribute_map.update(TwoFaProviderConfig.attribute_map) + + def __init__(self, verification_code_lifetime=None, *args, **kwargs): # noqa: E501 + """EmailTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._verification_code_lifetime = None + self.discriminator = None + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + TwoFaProviderConfig.__init__(self, *args, **kwargs) + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this EmailTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entities_limit_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/entities_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..d56bd7f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entities_limit_notification_rule_trigger_config.py @@ -0,0 +1,195 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class EntitiesLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'list[str]', + 'threshold': 'float', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'threshold': 'threshold', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, entity_types=None, threshold=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """EntitiesLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._threshold = None + self._trigger_type = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if threshold is not None: + self.threshold = threshold + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def threshold(self): + """Gets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: float + """ + return self._threshold + + @threshold.setter + def threshold(self, threshold): + """Sets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param threshold: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: float + """ + + self._threshold = threshold + + @property + def trigger_type(self): + """Gets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitiesLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitiesLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_action_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_action_notification_rule_trigger_config.py new file mode 100644 index 0000000..bd16c99 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_action_notification_rule_trigger_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityActionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'bool', + 'deleted': 'bool', + 'entity_types': 'list[str]', + 'trigger_type': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_types': 'entityTypes', + 'trigger_type': 'triggerType', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_types=None, trigger_type=None, updated=None): # noqa: E501 + """EntityActionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_types = None + self._trigger_type = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_types is not None: + self.entity_types = entity_types + if trigger_type is not None: + self.trigger_type = trigger_type + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityActionNotificationRuleTriggerConfig. + + + :param created: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityActionNotificationRuleTriggerConfig. + + + :param deleted: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._deleted = deleted + + @property + def entity_types(self): + """Gets the entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityActionNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def trigger_type(self): + """Gets the trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntityActionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + @property + def updated(self): + """Gets the updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityActionNotificationRuleTriggerConfig. + + + :param updated: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityActionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityActionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_count_query.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_count_query.py new file mode 100644 index 0000000..5e65037 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_count_query.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]' + } + + attribute_map = { + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters' + } + + def __init__(self, entity_filter=None, key_filters=None): # noqa: E501 + """EntityCountQuery - a model defined in Swagger""" # noqa: E501 + self._entity_filter = None + self._key_filters = None + self.discriminator = None + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityCountQuery. # noqa: E501 + + + :return: The entity_filter of this EntityCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityCountQuery. + + + :param entity_filter: The entity_filter of this EntityCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityCountQuery. # noqa: E501 + + + :return: The key_filters of this EntityCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityCountQuery. + + + :param key_filters: The key_filters of this EntityCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_data.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_data.py new file mode 100644 index 0000000..49036fa --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_data.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'agg_latest': 'dict(str, ComparisonTsValue)', + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'timeseries': 'dict(str, list[TsValue])' + } + + attribute_map = { + 'agg_latest': 'aggLatest', + 'entity_id': 'entityId', + 'latest': 'latest', + 'timeseries': 'timeseries' + } + + def __init__(self, agg_latest=None, entity_id=None, latest=None, timeseries=None): # noqa: E501 + """EntityData - a model defined in Swagger""" # noqa: E501 + self._agg_latest = None + self._entity_id = None + self._latest = None + self._timeseries = None + self.discriminator = None + if agg_latest is not None: + self.agg_latest = agg_latest + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if timeseries is not None: + self.timeseries = timeseries + + @property + def agg_latest(self): + """Gets the agg_latest of this EntityData. # noqa: E501 + + + :return: The agg_latest of this EntityData. # noqa: E501 + :rtype: dict(str, ComparisonTsValue) + """ + return self._agg_latest + + @agg_latest.setter + def agg_latest(self, agg_latest): + """Sets the agg_latest of this EntityData. + + + :param agg_latest: The agg_latest of this EntityData. # noqa: E501 + :type: dict(str, ComparisonTsValue) + """ + + self._agg_latest = agg_latest + + @property + def entity_id(self): + """Gets the entity_id of this EntityData. # noqa: E501 + + + :return: The entity_id of this EntityData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityData. + + + :param entity_id: The entity_id of this EntityData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this EntityData. # noqa: E501 + + + :return: The latest of this EntityData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this EntityData. + + + :param latest: The latest of this EntityData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def timeseries(self): + """Gets the timeseries of this EntityData. # noqa: E501 + + + :return: The timeseries of this EntityData. # noqa: E501 + :rtype: dict(str, list[TsValue]) + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this EntityData. + + + :param timeseries: The timeseries of this EntityData. # noqa: E501 + :type: dict(str, list[TsValue]) + """ + + self._timeseries = timeseries + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_data_diff.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_diff.py new file mode 100644 index 0000000..fce7238 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_version': 'EntityExportDataobject', + 'other_version': 'EntityExportDataobject' + } + + attribute_map = { + 'current_version': 'currentVersion', + 'other_version': 'otherVersion' + } + + def __init__(self, current_version=None, other_version=None): # noqa: E501 + """EntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._current_version = None + self._other_version = None + self.discriminator = None + if current_version is not None: + self.current_version = current_version + if other_version is not None: + self.other_version = other_version + + @property + def current_version(self): + """Gets the current_version of this EntityDataDiff. # noqa: E501 + + + :return: The current_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this EntityDataDiff. + + + :param current_version: The current_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._current_version = current_version + + @property + def other_version(self): + """Gets the other_version of this EntityDataDiff. # noqa: E501 + + + :return: The other_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._other_version + + @other_version.setter + def other_version(self, other_version): + """Sets the other_version of this EntityDataDiff. + + + :param other_version: The other_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._other_version = other_version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_data_info.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_info.py new file mode 100644 index 0000000..8f94dac --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_info.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'has_attributes': 'bool', + 'has_credentials': 'bool', + 'has_relations': 'bool' + } + + attribute_map = { + 'has_attributes': 'hasAttributes', + 'has_credentials': 'hasCredentials', + 'has_relations': 'hasRelations' + } + + def __init__(self, has_attributes=None, has_credentials=None, has_relations=None): # noqa: E501 + """EntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._has_attributes = None + self._has_credentials = None + self._has_relations = None + self.discriminator = None + if has_attributes is not None: + self.has_attributes = has_attributes + if has_credentials is not None: + self.has_credentials = has_credentials + if has_relations is not None: + self.has_relations = has_relations + + @property + def has_attributes(self): + """Gets the has_attributes of this EntityDataInfo. # noqa: E501 + + + :return: The has_attributes of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_attributes + + @has_attributes.setter + def has_attributes(self, has_attributes): + """Sets the has_attributes of this EntityDataInfo. + + + :param has_attributes: The has_attributes of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_attributes = has_attributes + + @property + def has_credentials(self): + """Gets the has_credentials of this EntityDataInfo. # noqa: E501 + + + :return: The has_credentials of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_credentials + + @has_credentials.setter + def has_credentials(self, has_credentials): + """Sets the has_credentials of this EntityDataInfo. + + + :param has_credentials: The has_credentials of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_credentials = has_credentials + + @property + def has_relations(self): + """Gets the has_relations of this EntityDataInfo. # noqa: E501 + + + :return: The has_relations of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_relations + + @has_relations.setter + def has_relations(self, has_relations): + """Sets the has_relations of this EntityDataInfo. + + + :param has_relations: The has_relations of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_relations = has_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_data_page_link.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_page_link.py new file mode 100644 index 0000000..bfeb5c1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_page_link.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic': 'bool', + 'page': 'int', + 'page_size': 'int', + 'sort_order': 'EntityDataSortOrder', + 'text_search': 'str' + } + + attribute_map = { + 'dynamic': 'dynamic', + 'page': 'page', + 'page_size': 'pageSize', + 'sort_order': 'sortOrder', + 'text_search': 'textSearch' + } + + def __init__(self, dynamic=None, page=None, page_size=None, sort_order=None, text_search=None): # noqa: E501 + """EntityDataPageLink - a model defined in Swagger""" # noqa: E501 + self._dynamic = None + self._page = None + self._page_size = None + self._sort_order = None + self._text_search = None + self.discriminator = None + if dynamic is not None: + self.dynamic = dynamic + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if sort_order is not None: + self.sort_order = sort_order + if text_search is not None: + self.text_search = text_search + + @property + def dynamic(self): + """Gets the dynamic of this EntityDataPageLink. # noqa: E501 + + + :return: The dynamic of this EntityDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this EntityDataPageLink. + + + :param dynamic: The dynamic of this EntityDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def page(self): + """Gets the page of this EntityDataPageLink. # noqa: E501 + + + :return: The page of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this EntityDataPageLink. + + + :param page: The page of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this EntityDataPageLink. # noqa: E501 + + + :return: The page_size of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this EntityDataPageLink. + + + :param page_size: The page_size of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def sort_order(self): + """Gets the sort_order of this EntityDataPageLink. # noqa: E501 + + + :return: The sort_order of this EntityDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this EntityDataPageLink. + + + :param sort_order: The sort_order of this EntityDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def text_search(self): + """Gets the text_search of this EntityDataPageLink. # noqa: E501 + + + :return: The text_search of this EntityDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this EntityDataPageLink. + + + :param text_search: The text_search of this EntityDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_data_query.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_query.py new file mode 100644 index 0000000..04f8b70 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_query.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'EntityDataPageLink' + } + + attribute_map = { + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """EntityDataQuery - a model defined in Swagger""" # noqa: E501 + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def entity_fields(self): + """Gets the entity_fields of this EntityDataQuery. # noqa: E501 + + + :return: The entity_fields of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this EntityDataQuery. + + + :param entity_fields: The entity_fields of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityDataQuery. # noqa: E501 + + + :return: The entity_filter of this EntityDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityDataQuery. + + + :param entity_filter: The entity_filter of this EntityDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityDataQuery. # noqa: E501 + + + :return: The key_filters of this EntityDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityDataQuery. + + + :param key_filters: The key_filters of this EntityDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this EntityDataQuery. # noqa: E501 + + + :return: The latest_values of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this EntityDataQuery. + + + :param latest_values: The latest_values of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this EntityDataQuery. # noqa: E501 + + + :return: The page_link of this EntityDataQuery. # noqa: E501 + :rtype: EntityDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this EntityDataQuery. + + + :param page_link: The page_link of this EntityDataQuery. # noqa: E501 + :type: EntityDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_data_sort_order.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_sort_order.py new file mode 100644 index 0000000..1bb8f16 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_data_sort_order.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataSortOrder(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'key': 'EntityKey' + } + + attribute_map = { + 'direction': 'direction', + 'key': 'key' + } + + def __init__(self, direction=None, key=None): # noqa: E501 + """EntityDataSortOrder - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._key = None + self.discriminator = None + if direction is not None: + self.direction = direction + if key is not None: + self.key = key + + @property + def direction(self): + """Gets the direction of this EntityDataSortOrder. # noqa: E501 + + + :return: The direction of this EntityDataSortOrder. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityDataSortOrder. + + + :param direction: The direction of this EntityDataSortOrder. # noqa: E501 + :type: str + """ + allowed_values = ["ASC", "DESC"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def key(self): + """Gets the key of this EntityDataSortOrder. # noqa: E501 + + + :return: The key of this EntityDataSortOrder. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityDataSortOrder. + + + :param key: The key of this EntityDataSortOrder. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataSortOrder, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataSortOrder): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_export_dataobject.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_export_dataobject.py new file mode 100644 index 0000000..b5080e4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_export_dataobject.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityExportDataobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'object', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None): # noqa: E501 + """EntityExportDataobject - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + + @property + def attributes(self): + """Gets the attributes of this EntityExportDataobject. # noqa: E501 + + + :return: The attributes of this EntityExportDataobject. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this EntityExportDataobject. + + + :param attributes: The attributes of this EntityExportDataobject. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this EntityExportDataobject. # noqa: E501 + + + :return: The entity of this EntityExportDataobject. # noqa: E501 + :rtype: object + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this EntityExportDataobject. + + + :param entity: The entity of this EntityExportDataobject. # noqa: E501 + :type: object + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this EntityExportDataobject. # noqa: E501 + + + :return: The entity_type of this EntityExportDataobject. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityExportDataobject. + + + :param entity_type: The entity_type of this EntityExportDataobject. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this EntityExportDataobject. # noqa: E501 + + + :return: The relations of this EntityExportDataobject. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this EntityExportDataobject. + + + :param relations: The relations of this EntityExportDataobject. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityExportDataobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityExportDataobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_filter.py new file mode 100644 index 0000000..7e99c98 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_filter.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'resolve_multiple': 'bool', + 'entity_type': 'str' + } + + attribute_map = { + 'type': 'type', + 'resolve_multiple': 'resolveMultiple', + 'entity_type': 'entityType' + } + + def __init__(self, type=None, resolve_multiple=None, entity_type=None): # noqa: E501 + """EntityFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + self._type = None + self._resolve_multiple = None + self._entity_type = None + self.type = type + self.resolve_multiple = resolve_multiple + self.entity_type = entity_type + + @property + def type(self): + return self._type + + @type.setter + def type(self, type): + self._type = type + + @property + def resolve_multiple(self): + return self._resolve_multiple + + @resolve_multiple.setter + def resolve_multiple(self, resolve_multiple): + self._resolve_multiple = resolve_multiple + + @property + def entity_type(self): + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_id.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_id.py new file mode 100644 index 0000000..cf4118a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityId. # noqa: E501 + + + :return: The entity_type of this EntityId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityId. + + + :param entity_type: The entity_type of this EntityId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_info.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_info.py new file mode 100644 index 0000000..e62d879 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name' + } + + def __init__(self, id=None, name=None): # noqa: E501 + """EntityInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def id(self): + """Gets the id of this EntityInfo. # noqa: E501 + + + :return: The id of this EntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityInfo. + + + :param id: The id of this EntityInfo. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this EntityInfo. # noqa: E501 + + Entity Name # noqa: E501 + + :return: The name of this EntityInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityInfo. + + Entity Name # noqa: E501 + + :param name: The name of this EntityInfo. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_key.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_key.py new file mode 100644 index 0000000..410ce42 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_key.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """EntityKey - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this EntityKey. # noqa: E501 + + + :return: The key of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityKey. + + + :param key: The key of this EntityKey. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this EntityKey. # noqa: E501 + + + :return: The type of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityKey. + + + :param type: The type of this EntityKey. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM_FIELD", "ATTRIBUTE", "CLIENT_ATTRIBUTE", "ENTITY_FIELD", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_list_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_list_filter.py new file mode 100644 index 0000000..ef32146 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_list_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityListFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_list': 'list[str]', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_list': 'entityList', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_list=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityListFilter - a model defined in Swagger""" # noqa: E501 + self._entity_list = None + self._entity_type = None + self.discriminator = None + if entity_list is not None: + self.entity_list = entity_list + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_list(self): + """Gets the entity_list of this EntityListFilter. # noqa: E501 + + + :return: The entity_list of this EntityListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_list + + @entity_list.setter + def entity_list(self, entity_list): + """Sets the entity_list of this EntityListFilter. + + + :param entity_list: The entity_list of this EntityListFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_list = entity_list + + @property + def entity_type(self): + """Gets the entity_type of this EntityListFilter. # noqa: E501 + + + :return: The entity_type of this EntityListFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityListFilter. + + + :param entity_type: The entity_type of this EntityListFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_load_error.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_load_error.py new file mode 100644 index 0000000..45405b6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_load_error.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityLoadError(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str', + 'source': 'EntityId', + 'target': 'EntityId', + 'type': 'str' + } + + attribute_map = { + 'message': 'message', + 'source': 'source', + 'target': 'target', + 'type': 'type' + } + + def __init__(self, message=None, source=None, target=None, type=None): # noqa: E501 + """EntityLoadError - a model defined in Swagger""" # noqa: E501 + self._message = None + self._source = None + self._target = None + self._type = None + self.discriminator = None + if message is not None: + self.message = message + if source is not None: + self.source = source + if target is not None: + self.target = target + if type is not None: + self.type = type + + @property + def message(self): + """Gets the message of this EntityLoadError. # noqa: E501 + + + :return: The message of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this EntityLoadError. + + + :param message: The message of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def source(self): + """Gets the source of this EntityLoadError. # noqa: E501 + + + :return: The source of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._source + + @source.setter + def source(self, source): + """Sets the source of this EntityLoadError. + + + :param source: The source of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._source = source + + @property + def target(self): + """Gets the target of this EntityLoadError. # noqa: E501 + + + :return: The target of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._target + + @target.setter + def target(self, target): + """Sets the target of this EntityLoadError. + + + :param target: The target of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._target = target + + @property + def type(self): + """Gets the type of this EntityLoadError. # noqa: E501 + + + :return: The type of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityLoadError. + + + :param type: The type of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityLoadError, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityLoadError): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_name_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_name_filter.py new file mode 100644 index 0000000..215f604 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_name_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_name_filter': 'str', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_name_filter': 'entityNameFilter', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_name_filter=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_name_filter = None + self._entity_type = None + self.discriminator = None + if entity_name_filter is not None: + self.entity_name_filter = entity_name_filter + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_name_filter(self): + """Gets the entity_name_filter of this EntityNameFilter. # noqa: E501 + + + :return: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name_filter + + @entity_name_filter.setter + def entity_name_filter(self, entity_name_filter): + """Sets the entity_name_filter of this EntityNameFilter. + + + :param entity_name_filter: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :type: str + """ + + self._entity_name_filter = entity_name_filter + + @property + def entity_type(self): + """Gets the entity_type of this EntityNameFilter. # noqa: E501 + + + :return: The entity_type of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityNameFilter. + + + :param entity_type: The entity_type of this EntityNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_relation.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_relation.py new file mode 100644 index 0000000..ee5b574 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_relation.py @@ -0,0 +1,238 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_from': 'EntityId', + 'to': 'EntityId', + 'type': 'str', + 'type_group': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + '_from': 'from', + 'to': 'to', + 'type': 'type', + 'type_group': 'typeGroup', + 'additional_info': 'additionalInfo' + } + + def __init__(self, _from=None, to=None, type=None, type_group=None, additional_info=None): # noqa: E501 + """EntityRelation - a model defined in Swagger""" # noqa: E501 + self.__from = None + self._to = None + self._type = None + self._type_group = None + self._additional_info = None + self.discriminator = None + if _from is not None: + self._from = _from + if to is not None: + self.to = to + if type is not None: + self.type = type + if type_group is not None: + self.type_group = type_group + if additional_info is not None: + self.additional_info = additional_info + + @property + def _from(self): + """Gets the _from of this EntityRelation. # noqa: E501 + + + :return: The _from of this EntityRelation. # noqa: E501 + :rtype: EntityId + """ + return self.__from + + @_from.setter + def _from(self, _from): + """Sets the _from of this EntityRelation. + + + :param _from: The _from of this EntityRelation. # noqa: E501 + :type: EntityId + """ + + self.__from = _from + + @property + def to(self): + """Gets the to of this EntityRelation. # noqa: E501 + + + :return: The to of this EntityRelation. # noqa: E501 + :rtype: EntityId + """ + return self._to + + @to.setter + def to(self, to): + """Sets the to of this EntityRelation. + + + :param to: The to of this EntityRelation. # noqa: E501 + :type: EntityId + """ + + self._to = to + + @property + def type(self): + """Gets the type of this EntityRelation. # noqa: E501 + + String value of relation type. # noqa: E501 + + :return: The type of this EntityRelation. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityRelation. + + String value of relation type. # noqa: E501 + + :param type: The type of this EntityRelation. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def type_group(self): + """Gets the type_group of this EntityRelation. # noqa: E501 + + Represents the type group of the relation. # noqa: E501 + + :return: The type_group of this EntityRelation. # noqa: E501 + :rtype: str + """ + return self._type_group + + @type_group.setter + def type_group(self, type_group): + """Sets the type_group of this EntityRelation. + + Represents the type group of the relation. # noqa: E501 + + :param type_group: The type_group of this EntityRelation. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if type_group not in allowed_values: + raise ValueError( + "Invalid value for `type_group` ({0}), must be one of {1}" # noqa: E501 + .format(type_group, allowed_values) + ) + + self._type_group = type_group + + @property + def additional_info(self): + """Gets the additional_info of this EntityRelation. # noqa: E501 + + + :return: The additional_info of this EntityRelation. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityRelation. + + + :param additional_info: The additional_info of this EntityRelation. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_relation_info.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_relation_info.py new file mode 100644 index 0000000..034de04 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_relation_info.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_from': 'EntityId', + 'to': 'EntityId', + 'type': 'str', + 'type_group': 'str', + 'additional_info': 'JsonNode', + 'from_name': 'str', + 'to_name': 'str' + } + + attribute_map = { + '_from': 'from', + 'to': 'to', + 'type': 'type', + 'type_group': 'typeGroup', + 'additional_info': 'additionalInfo', + 'from_name': 'fromName', + 'to_name': 'toName' + } + + def __init__(self, _from=None, to=None, type=None, type_group=None, additional_info=None, from_name=None, to_name=None): # noqa: E501 + """EntityRelationInfo - a model defined in Swagger""" # noqa: E501 + self.__from = None + self._to = None + self._type = None + self._type_group = None + self._additional_info = None + self._from_name = None + self._to_name = None + self.discriminator = None + if _from is not None: + self._from = _from + if to is not None: + self.to = to + if type is not None: + self.type = type + if type_group is not None: + self.type_group = type_group + if additional_info is not None: + self.additional_info = additional_info + if from_name is not None: + self.from_name = from_name + if to_name is not None: + self.to_name = to_name + + @property + def _from(self): + """Gets the _from of this EntityRelationInfo. # noqa: E501 + + + :return: The _from of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self.__from + + @_from.setter + def _from(self, _from): + """Sets the _from of this EntityRelationInfo. + + + :param _from: The _from of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self.__from = _from + + @property + def to(self): + """Gets the to of this EntityRelationInfo. # noqa: E501 + + + :return: The to of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._to + + @to.setter + def to(self, to): + """Sets the to of this EntityRelationInfo. + + + :param to: The to of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self._to = to + + @property + def type(self): + """Gets the type of this EntityRelationInfo. # noqa: E501 + + String value of relation type. # noqa: E501 + + :return: The type of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityRelationInfo. + + String value of relation type. # noqa: E501 + + :param type: The type of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def type_group(self): + """Gets the type_group of this EntityRelationInfo. # noqa: E501 + + Represents the type group of the relation. # noqa: E501 + + :return: The type_group of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type_group + + @type_group.setter + def type_group(self, type_group): + """Sets the type_group of this EntityRelationInfo. + + Represents the type group of the relation. # noqa: E501 + + :param type_group: The type_group of this EntityRelationInfo. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if type_group not in allowed_values: + raise ValueError( + "Invalid value for `type_group` ({0}), must be one of {1}" # noqa: E501 + .format(type_group, allowed_values) + ) + + self._type_group = type_group + + @property + def additional_info(self): + """Gets the additional_info of this EntityRelationInfo. # noqa: E501 + + + :return: The additional_info of this EntityRelationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityRelationInfo. + + + :param additional_info: The additional_info of this EntityRelationInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def from_name(self): + """Gets the from_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [from] direction. # noqa: E501 + + :return: The from_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._from_name + + @from_name.setter + def from_name(self, from_name): + """Sets the from_name of this EntityRelationInfo. + + Name of the entity for [from] direction. # noqa: E501 + + :param from_name: The from_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._from_name = from_name + + @property + def to_name(self): + """Gets the to_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [to] direction. # noqa: E501 + + :return: The to_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._to_name + + @to_name.setter + def to_name(self, to_name): + """Sets the to_name of this EntityRelationInfo. + + Name of the entity for [to] direction. # noqa: E501 + + :param to_name: The to_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._to_name = to_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_relations_query.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_relations_query.py new file mode 100644 index 0000000..eb568a2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_relations_query.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationsQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'filters': 'list[RelationEntityTypeFilter]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'filters': 'filters', + 'parameters': 'parameters' + } + + def __init__(self, filters=None, parameters=None): # noqa: E501 + """EntityRelationsQuery - a model defined in Swagger""" # noqa: E501 + self._filters = None + self._parameters = None + self.discriminator = None + if filters is not None: + self.filters = filters + if parameters is not None: + self.parameters = parameters + + @property + def filters(self): + """Gets the filters of this EntityRelationsQuery. # noqa: E501 + + Main filters. # noqa: E501 + + :return: The filters of this EntityRelationsQuery. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this EntityRelationsQuery. + + Main filters. # noqa: E501 + + :param filters: The filters of this EntityRelationsQuery. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def parameters(self): + """Gets the parameters of this EntityRelationsQuery. # noqa: E501 + + + :return: The parameters of this EntityRelationsQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityRelationsQuery. + + + :param parameters: The parameters of this EntityRelationsQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationsQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationsQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_subtype.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_subtype.py new file mode 100644 index 0000000..f336971 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_subtype.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntitySubtype(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str', + 'tenant_id': 'TenantId', + 'type': 'str' + } + + attribute_map = { + 'entity_type': 'entityType', + 'tenant_id': 'tenantId', + 'type': 'type' + } + + def __init__(self, entity_type=None, tenant_id=None, type=None): # noqa: E501 + """EntitySubtype - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self._tenant_id = None + self._type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + + @property + def entity_type(self): + """Gets the entity_type of this EntitySubtype. # noqa: E501 + + + :return: The entity_type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntitySubtype. + + + :param entity_type: The entity_type of this EntitySubtype. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def tenant_id(self): + """Gets the tenant_id of this EntitySubtype. # noqa: E501 + + + :return: The tenant_id of this EntitySubtype. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntitySubtype. + + + :param tenant_id: The tenant_id of this EntitySubtype. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EntitySubtype. # noqa: E501 + + + :return: The type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntitySubtype. + + + :param type: The type of this EntitySubtype. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitySubtype, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitySubtype): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_type_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_filter.py new file mode 100644 index 0000000..5cd009c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_filter.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeFilter. # noqa: E501 + + + :return: The entity_type of this EntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeFilter. + + + :param entity_type: The entity_type of this EntityTypeFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_type_load_result.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_load_result.py new file mode 100644 index 0000000..2813f01 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_load_result.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'int', + 'deleted': 'int', + 'entity_type': 'str', + 'updated': 'int' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_type': 'entityType', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_type=None, updated=None): # noqa: E501 + """EntityTypeLoadResult - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_type = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_type is not None: + self.entity_type = entity_type + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityTypeLoadResult. # noqa: E501 + + + :return: The created of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityTypeLoadResult. + + + :param created: The created of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityTypeLoadResult. # noqa: E501 + + + :return: The deleted of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityTypeLoadResult. + + + :param deleted: The deleted of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._deleted = deleted + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeLoadResult. # noqa: E501 + + + :return: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeLoadResult. + + + :param entity_type: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def updated(self): + """Gets the updated of this EntityTypeLoadResult. # noqa: E501 + + + :return: The updated of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityTypeLoadResult. + + + :param updated: The updated of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_create_config.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_create_config.py new file mode 100644 index 0000000..c8b36ac --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_create_config.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'all_entities': 'bool', + 'entity_ids': 'list[str]', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_relations': 'bool', + 'sync_strategy': 'str' + } + + attribute_map = { + 'all_entities': 'allEntities', + 'entity_ids': 'entityIds', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_relations': 'saveRelations', + 'sync_strategy': 'syncStrategy' + } + + def __init__(self, all_entities=None, entity_ids=None, save_attributes=None, save_credentials=None, save_relations=None, sync_strategy=None): # noqa: E501 + """EntityTypeVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._all_entities = None + self._entity_ids = None + self._save_attributes = None + self._save_credentials = None + self._save_relations = None + self._sync_strategy = None + self.discriminator = None + if all_entities is not None: + self.all_entities = all_entities + if entity_ids is not None: + self.entity_ids = entity_ids + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_relations is not None: + self.save_relations = save_relations + if sync_strategy is not None: + self.sync_strategy = sync_strategy + + @property + def all_entities(self): + """Gets the all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._all_entities + + @all_entities.setter + def all_entities(self, all_entities): + """Sets the all_entities of this EntityTypeVersionCreateConfig. + + + :param all_entities: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._all_entities = all_entities + + @property + def entity_ids(self): + """Gets the entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_ids + + @entity_ids.setter + def entity_ids(self, entity_ids): + """Sets the entity_ids of this EntityTypeVersionCreateConfig. + + + :param entity_ids: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: list[str] + """ + + self._entity_ids = entity_ids + + @property + def save_attributes(self): + """Gets the save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this EntityTypeVersionCreateConfig. + + + :param save_attributes: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this EntityTypeVersionCreateConfig. + + + :param save_credentials: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_relations(self): + """Gets the save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this EntityTypeVersionCreateConfig. + + + :param save_relations: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + @property + def sync_strategy(self): + """Gets the sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this EntityTypeVersionCreateConfig. + + + :param sync_strategy: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_load_config.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_load_config.py new file mode 100644 index 0000000..734a49a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_load_config.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'find_existing_entity_by_name': 'bool', + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_relations': 'bool', + 'remove_other_entities': 'bool' + } + + attribute_map = { + 'find_existing_entity_by_name': 'findExistingEntityByName', + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_relations': 'loadRelations', + 'remove_other_entities': 'removeOtherEntities' + } + + def __init__(self, find_existing_entity_by_name=None, load_attributes=None, load_credentials=None, load_relations=None, remove_other_entities=None): # noqa: E501 + """EntityTypeVersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._find_existing_entity_by_name = None + self._load_attributes = None + self._load_credentials = None + self._load_relations = None + self._remove_other_entities = None + self.discriminator = None + if find_existing_entity_by_name is not None: + self.find_existing_entity_by_name = find_existing_entity_by_name + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_relations is not None: + self.load_relations = load_relations + if remove_other_entities is not None: + self.remove_other_entities = remove_other_entities + + @property + def find_existing_entity_by_name(self): + """Gets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._find_existing_entity_by_name + + @find_existing_entity_by_name.setter + def find_existing_entity_by_name(self, find_existing_entity_by_name): + """Sets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. + + + :param find_existing_entity_by_name: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._find_existing_entity_by_name = find_existing_entity_by_name + + @property + def load_attributes(self): + """Gets the load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this EntityTypeVersionLoadConfig. + + + :param load_attributes: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this EntityTypeVersionLoadConfig. + + + :param load_credentials: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_relations(self): + """Gets the load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this EntityTypeVersionLoadConfig. + + + :param load_relations: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + @property + def remove_other_entities(self): + """Gets the remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._remove_other_entities + + @remove_other_entities.setter + def remove_other_entities(self, remove_other_entities): + """Sets the remove_other_entities of this EntityTypeVersionLoadConfig. + + + :param remove_other_entities: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._remove_other_entities = remove_other_entities + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_load_request.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_load_request.py new file mode 100644 index 0000000..2f67474 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_type_version_load_request.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class EntityTypeVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'dict(str, EntityTypeVersionLoadConfig)', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, entity_types=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """EntityTypeVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._type = None + self._version_id = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionLoadConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityTypeVersionLoadRequest. + + + :param entity_types: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionLoadConfig) + """ + + self._entity_types = entity_types + + @property + def type(self): + """Gets the type of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityTypeVersionLoadRequest. + + + :param type: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this EntityTypeVersionLoadRequest. + + + :param version_id: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_version.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_version.py new file mode 100644 index 0000000..01f8c6b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_version.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'author': 'str', + 'id': 'str', + 'name': 'str', + 'timestamp': 'int' + } + + attribute_map = { + 'author': 'author', + 'id': 'id', + 'name': 'name', + 'timestamp': 'timestamp' + } + + def __init__(self, author=None, id=None, name=None, timestamp=None): # noqa: E501 + """EntityVersion - a model defined in Swagger""" # noqa: E501 + self._author = None + self._id = None + self._name = None + self._timestamp = None + self.discriminator = None + if author is not None: + self.author = author + if id is not None: + self.id = id + if name is not None: + self.name = name + if timestamp is not None: + self.timestamp = timestamp + + @property + def author(self): + """Gets the author of this EntityVersion. # noqa: E501 + + + :return: The author of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._author + + @author.setter + def author(self, author): + """Sets the author of this EntityVersion. + + + :param author: The author of this EntityVersion. # noqa: E501 + :type: str + """ + + self._author = author + + @property + def id(self): + """Gets the id of this EntityVersion. # noqa: E501 + + + :return: The id of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityVersion. + + + :param id: The id of this EntityVersion. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this EntityVersion. # noqa: E501 + + + :return: The name of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityVersion. + + + :param name: The name of this EntityVersion. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def timestamp(self): + """Gets the timestamp of this EntityVersion. # noqa: E501 + + + :return: The timestamp of this EntityVersion. # noqa: E501 + :rtype: int + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this EntityVersion. + + + :param timestamp: The timestamp of this EntityVersion. # noqa: E501 + :type: int + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_view.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_view.py new file mode 100644 index 0000000..7159fa0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_view.py @@ -0,0 +1,398 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None): # noqa: E501 + """EntityView - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this EntityView. # noqa: E501 + + + :return: The id of this EntityView. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityView. + + + :param id: The id of this EntityView. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityView. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityView. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityView. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityView. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityView. # noqa: E501 + + + :return: The tenant_id of this EntityView. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityView. + + + :param tenant_id: The tenant_id of this EntityView. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityView. # noqa: E501 + + + :return: The customer_id of this EntityView. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityView. + + + :param customer_id: The customer_id of this EntityView. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityView. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityView. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityView. + + Entity View name # noqa: E501 + + :param name: The name of this EntityView. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityView. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityView. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityView. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityView. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityView. # noqa: E501 + + + :return: The entity_id of this EntityView. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityView. + + + :param entity_id: The entity_id of this EntityView. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityView. # noqa: E501 + + + :return: The keys of this EntityView. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityView. + + + :param keys: The keys of this EntityView. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityView. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityView. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityView. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityView. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityView. # noqa: E501 + + + :return: The additional_info of this EntityView. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityView. + + + :param additional_info: The additional_info of this EntityView. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_view_id.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_id.py new file mode 100644 index 0000000..1701bb1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityViewId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityViewId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityViewId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityViewId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityViewId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EntityViewId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ENTITY_VIEW"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_view_info.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_info.py new file mode 100644 index 0000000..aa0e005 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_info.py @@ -0,0 +1,454 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None, customer_title=None, customer_is_public=None): # noqa: E501 + """EntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + + @property + def id(self): + """Gets the id of this EntityViewInfo. # noqa: E501 + + + :return: The id of this EntityViewInfo. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewInfo. + + + :param id: The id of this EntityViewInfo. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityViewInfo. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityViewInfo. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityViewInfo. # noqa: E501 + + + :return: The tenant_id of this EntityViewInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityViewInfo. + + + :param tenant_id: The tenant_id of this EntityViewInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityViewInfo. # noqa: E501 + + + :return: The customer_id of this EntityViewInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityViewInfo. + + + :param customer_id: The customer_id of this EntityViewInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityViewInfo. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityViewInfo. + + Entity View name # noqa: E501 + + :param name: The name of this EntityViewInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityViewInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityViewInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityViewInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityViewInfo. # noqa: E501 + + + :return: The entity_id of this EntityViewInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityViewInfo. + + + :param entity_id: The entity_id of this EntityViewInfo. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityViewInfo. # noqa: E501 + + + :return: The keys of this EntityViewInfo. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityViewInfo. + + + :param keys: The keys of this EntityViewInfo. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityViewInfo. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityViewInfo. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityViewInfo. # noqa: E501 + + + :return: The additional_info of this EntityViewInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityViewInfo. + + + :param additional_info: The additional_info of this EntityViewInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this EntityViewInfo. # noqa: E501 + + Title of the Customer that owns the entity view. # noqa: E501 + + :return: The customer_title of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this EntityViewInfo. + + Title of the Customer that owns the entity view. # noqa: E501 + + :param customer_title: The customer_title of this EntityViewInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this EntityViewInfo. # noqa: E501 + + Indicates special 'Public' Customer that is auto-generated to use the entity view on public dashboards. # noqa: E501 + + :return: The customer_is_public of this EntityViewInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this EntityViewInfo. + + Indicates special 'Public' Customer that is auto-generated to use the entity view on public dashboards. # noqa: E501 + + :param customer_is_public: The customer_is_public of this EntityViewInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_view_search_query.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_search_query.py new file mode 100644 index 0000000..7a507fe --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_view_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_view_types': 'entityViewTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, entity_view_types=None, parameters=None): # noqa: E501 + """EntityViewSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_view_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQuery. # noqa: E501 + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQuery. + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param entity_view_types: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def parameters(self): + """Gets the parameters of this EntityViewSearchQuery. # noqa: E501 + + + :return: The parameters of this EntityViewSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityViewSearchQuery. + + + :param parameters: The parameters of this EntityViewSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_view_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_search_query_filter.py new file mode 100644 index 0000000..6bd8f09 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'entity_view_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'entity_view_types': 'entityViewTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, entity_view_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EntityViewSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._entity_view_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityViewSearchQueryFilter. + + + :param direction: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQueryFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EntityViewSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EntityViewSearchQueryFilter. + + + :param max_level: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQueryFilter. + + + :param relation_type: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EntityViewSearchQueryFilter. + + + :param root_entity: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/entity_view_type_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_type_filter.py new file mode 100644 index 0000000..1bb9a85 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/entity_view_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_view_name_filter': 'str', + 'entity_view_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_view_name_filter': 'entityViewNameFilter', + 'entity_view_types': 'entityViewTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_view_name_filter=None, entity_view_types=None, *args, **kwargs): # noqa: E501 + """EntityViewTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_view_name_filter = None + self._entity_view_types = None + self.discriminator = None + if entity_view_name_filter is not None: + self.entity_view_name_filter = entity_view_name_filter + if entity_view_types is not None: + self.entity_view_types = entity_view_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_view_name_filter(self): + """Gets the entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_view_name_filter + + @entity_view_name_filter.setter + def entity_view_name_filter(self, entity_view_name_filter): + """Sets the entity_view_name_filter of this EntityViewTypeFilter. + + + :param entity_view_name_filter: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :type: str + """ + + self._entity_view_name_filter = entity_view_name_filter + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewTypeFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/error_event_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/error_event_filter.py new file mode 100644 index 0000000..f9d80a4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/error_event_filter.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class ErrorEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'method': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'method': 'method', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, method=None, error_str=None, *args, **kwargs): # noqa: E501 + """ErrorEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._method = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if method is not None: + self.method = method + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this ErrorEventFilter. # noqa: E501 + + + :return: The not_empty of this ErrorEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this ErrorEventFilter. + + + :param not_empty: The not_empty of this ErrorEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this ErrorEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this ErrorEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this ErrorEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this ErrorEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this ErrorEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def method(self): + """Gets the method of this ErrorEventFilter. # noqa: E501 + + String value representing the method name when the error happened # noqa: E501 + + :return: The method of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._method + + @method.setter + def method(self, method): + """Sets the method of this ErrorEventFilter. + + String value representing the method name when the error happened # noqa: E501 + + :param method: The method of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._method = method + + @property + def error_str(self): + """Gets the error_str of this ErrorEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this ErrorEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ErrorEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ErrorEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/escalated_notification_rule_recipients_config.py b/billinglayer/python/tb_rest_client/models/models_ce/escalated_notification_rule_recipients_config.py new file mode 100644 index 0000000..e24f709 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/escalated_notification_rule_recipients_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EscalatedNotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'escalation_table': 'dict(str, list[str])', + 'trigger_type': 'str' + } + + attribute_map = { + 'escalation_table': 'escalationTable', + 'trigger_type': 'triggerType' + } + + def __init__(self, escalation_table=None, trigger_type=None): # noqa: E501 + """EscalatedNotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._escalation_table = None + self._trigger_type = None + self.discriminator = None + if escalation_table is not None: + self.escalation_table = escalation_table + self.trigger_type = trigger_type + + @property + def escalation_table(self): + """Gets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._escalation_table + + @escalation_table.setter + def escalation_table(self, escalation_table): + """Sets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. + + + :param escalation_table: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._escalation_table = escalation_table + + @property + def trigger_type(self): + """Gets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EscalatedNotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EscalatedNotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/event.py b/billinglayer/python/tb_rest_client/models/models_ce/event.py new file mode 100644 index 0000000..1fa4613 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/event.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Event(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """Event - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this Event. # noqa: E501 + + + :return: The id of this Event. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Event. + + + :param id: The id of this Event. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this Event. # noqa: E501 + + + :return: The tenant_id of this Event. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Event. + + + :param tenant_id: The tenant_id of this Event. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this Event. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this Event. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Event. + + Event type # noqa: E501 + + :param type: The type of this Event. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this Event. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this Event. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this Event. + + string # noqa: E501 + + :param uid: The uid of this Event. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this Event. # noqa: E501 + + + :return: The entity_id of this Event. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this Event. + + + :param entity_id: The entity_id of this Event. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this Event. # noqa: E501 + + + :return: The body of this Event. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this Event. + + + :param body: The body of this Event. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this Event. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this Event. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Event. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Event. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Event, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Event): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/event_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/event_filter.py new file mode 100644 index 0000000..5de4c94 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/event_filter.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str' + } + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType' + } + + def __init__(self, not_empty=None, event_type=None): # noqa: E501 + """EventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + + @property + def not_empty(self): + """Gets the not_empty of this EventFilter. # noqa: E501 + + + :return: The not_empty of this EventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this EventFilter. + + + :param not_empty: The not_empty of this EventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this EventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this EventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this EventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this EventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/event_id.py b/billinglayer/python/tb_rest_client/models/models_ce/event_id.py new file mode 100644 index 0000000..878a7b5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventId. + + string # noqa: E501 + + :param id: The id of this EventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/event_info.py b/billinglayer/python/tb_rest_client/models/models_ce/event_info.py new file mode 100644 index 0000000..4364897 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/event_info.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """EventInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this EventInfo. # noqa: E501 + + + :return: The id of this EventInfo. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventInfo. + + + :param id: The id of this EventInfo. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EventInfo. # noqa: E501 + + + :return: The tenant_id of this EventInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EventInfo. + + + :param tenant_id: The tenant_id of this EventInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EventInfo. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EventInfo. + + Event type # noqa: E501 + + :param type: The type of this EventInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this EventInfo. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EventInfo. + + string # noqa: E501 + + :param uid: The uid of this EventInfo. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this EventInfo. # noqa: E501 + + + :return: The entity_id of this EventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EventInfo. + + + :param entity_id: The entity_id of this EventInfo. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this EventInfo. # noqa: E501 + + + :return: The body of this EventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EventInfo. + + + :param body: The body of this EventInfo. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EventInfo. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this EventInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EventInfo. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EventInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/features_info.py b/billinglayer/python/tb_rest_client/models/models_ce/features_info.py new file mode 100644 index 0000000..7027db7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/features_info.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FeaturesInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email_enabled': 'bool', + 'notification_enabled': 'bool', + 'oauth_enabled': 'bool', + 'sms_enabled': 'bool', + 'two_fa_enabled': 'bool' + } + + attribute_map = { + 'email_enabled': 'emailEnabled', + 'notification_enabled': 'notificationEnabled', + 'oauth_enabled': 'oauthEnabled', + 'sms_enabled': 'smsEnabled', + 'two_fa_enabled': 'twoFaEnabled' + } + + def __init__(self, email_enabled=None, notification_enabled=None, oauth_enabled=None, sms_enabled=None, two_fa_enabled=None): # noqa: E501 + """FeaturesInfo - a model defined in Swagger""" # noqa: E501 + self._email_enabled = None + self._notification_enabled = None + self._oauth_enabled = None + self._sms_enabled = None + self._two_fa_enabled = None + self.discriminator = None + if email_enabled is not None: + self.email_enabled = email_enabled + if notification_enabled is not None: + self.notification_enabled = notification_enabled + if oauth_enabled is not None: + self.oauth_enabled = oauth_enabled + if sms_enabled is not None: + self.sms_enabled = sms_enabled + if two_fa_enabled is not None: + self.two_fa_enabled = two_fa_enabled + + @property + def email_enabled(self): + """Gets the email_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The email_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._email_enabled + + @email_enabled.setter + def email_enabled(self, email_enabled): + """Sets the email_enabled of this FeaturesInfo. + + + :param email_enabled: The email_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._email_enabled = email_enabled + + @property + def notification_enabled(self): + """Gets the notification_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The notification_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._notification_enabled + + @notification_enabled.setter + def notification_enabled(self, notification_enabled): + """Sets the notification_enabled of this FeaturesInfo. + + + :param notification_enabled: The notification_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._notification_enabled = notification_enabled + + @property + def oauth_enabled(self): + """Gets the oauth_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._oauth_enabled + + @oauth_enabled.setter + def oauth_enabled(self, oauth_enabled): + """Sets the oauth_enabled of this FeaturesInfo. + + + :param oauth_enabled: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._oauth_enabled = oauth_enabled + + @property + def sms_enabled(self): + """Gets the sms_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The sms_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._sms_enabled + + @sms_enabled.setter + def sms_enabled(self, sms_enabled): + """Sets the sms_enabled of this FeaturesInfo. + + + :param sms_enabled: The sms_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._sms_enabled = sms_enabled + + @property + def two_fa_enabled(self): + """Gets the two_fa_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._two_fa_enabled + + @two_fa_enabled.setter + def two_fa_enabled(self, two_fa_enabled): + """Sets the two_fa_enabled of this FeaturesInfo. + + + :param two_fa_enabled: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._two_fa_enabled = two_fa_enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FeaturesInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FeaturesInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/file.py b/billinglayer/python/tb_rest_client/models/models_ce/file.py new file mode 100644 index 0000000..c659662 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/file.py @@ -0,0 +1,488 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class File(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'absolute': 'bool', + 'absolute_file': 'file', + 'absolute_path': 'str', + 'canonical_file': 'file', + 'canonical_path': 'str', + 'directory': 'bool', + 'file': 'bool', + 'free_space': 'int', + 'hidden': 'bool', + 'name': 'str', + 'parent': 'str', + 'parent_file': 'file', + 'path': 'str', + 'total_space': 'int', + 'usable_space': 'int' + } + + attribute_map = { + 'absolute': 'absolute', + 'absolute_file': 'absoluteFile', + 'absolute_path': 'absolutePath', + 'canonical_file': 'canonicalFile', + 'canonical_path': 'canonicalPath', + 'directory': 'directory', + 'file': 'file', + 'free_space': 'freeSpace', + 'hidden': 'hidden', + 'name': 'name', + 'parent': 'parent', + 'parent_file': 'parentFile', + 'path': 'path', + 'total_space': 'totalSpace', + 'usable_space': 'usableSpace' + } + + def __init__(self, absolute=None, absolute_file=None, absolute_path=None, canonical_file=None, canonical_path=None, directory=None, file=None, free_space=None, hidden=None, name=None, parent=None, parent_file=None, path=None, total_space=None, usable_space=None): # noqa: E501 + """File - a model defined in Swagger""" # noqa: E501 + self._absolute = None + self._absolute_file = None + self._absolute_path = None + self._canonical_file = None + self._canonical_path = None + self._directory = None + self._file = None + self._free_space = None + self._hidden = None + self._name = None + self._parent = None + self._parent_file = None + self._path = None + self._total_space = None + self._usable_space = None + self.discriminator = None + if absolute is not None: + self.absolute = absolute + if absolute_file is not None: + self.absolute_file = absolute_file + if absolute_path is not None: + self.absolute_path = absolute_path + if canonical_file is not None: + self.canonical_file = canonical_file + if canonical_path is not None: + self.canonical_path = canonical_path + if directory is not None: + self.directory = directory + if file is not None: + self.file = file + if free_space is not None: + self.free_space = free_space + if hidden is not None: + self.hidden = hidden + if name is not None: + self.name = name + if parent is not None: + self.parent = parent + if parent_file is not None: + self.parent_file = parent_file + if path is not None: + self.path = path + if total_space is not None: + self.total_space = total_space + if usable_space is not None: + self.usable_space = usable_space + + @property + def absolute(self): + """Gets the absolute of this File. # noqa: E501 + + + :return: The absolute of this File. # noqa: E501 + :rtype: bool + """ + return self._absolute + + @absolute.setter + def absolute(self, absolute): + """Sets the absolute of this File. + + + :param absolute: The absolute of this File. # noqa: E501 + :type: bool + """ + + self._absolute = absolute + + @property + def absolute_file(self): + """Gets the absolute_file of this File. # noqa: E501 + + + :return: The absolute_file of this File. # noqa: E501 + :rtype: file + """ + return self._absolute_file + + @absolute_file.setter + def absolute_file(self, absolute_file): + """Sets the absolute_file of this File. + + + :param absolute_file: The absolute_file of this File. # noqa: E501 + :type: file + """ + + self._absolute_file = absolute_file + + @property + def absolute_path(self): + """Gets the absolute_path of this File. # noqa: E501 + + + :return: The absolute_path of this File. # noqa: E501 + :rtype: str + """ + return self._absolute_path + + @absolute_path.setter + def absolute_path(self, absolute_path): + """Sets the absolute_path of this File. + + + :param absolute_path: The absolute_path of this File. # noqa: E501 + :type: str + """ + + self._absolute_path = absolute_path + + @property + def canonical_file(self): + """Gets the canonical_file of this File. # noqa: E501 + + + :return: The canonical_file of this File. # noqa: E501 + :rtype: file + """ + return self._canonical_file + + @canonical_file.setter + def canonical_file(self, canonical_file): + """Sets the canonical_file of this File. + + + :param canonical_file: The canonical_file of this File. # noqa: E501 + :type: file + """ + + self._canonical_file = canonical_file + + @property + def canonical_path(self): + """Gets the canonical_path of this File. # noqa: E501 + + + :return: The canonical_path of this File. # noqa: E501 + :rtype: str + """ + return self._canonical_path + + @canonical_path.setter + def canonical_path(self, canonical_path): + """Sets the canonical_path of this File. + + + :param canonical_path: The canonical_path of this File. # noqa: E501 + :type: str + """ + + self._canonical_path = canonical_path + + @property + def directory(self): + """Gets the directory of this File. # noqa: E501 + + + :return: The directory of this File. # noqa: E501 + :rtype: bool + """ + return self._directory + + @directory.setter + def directory(self, directory): + """Sets the directory of this File. + + + :param directory: The directory of this File. # noqa: E501 + :type: bool + """ + + self._directory = directory + + @property + def file(self): + """Gets the file of this File. # noqa: E501 + + + :return: The file of this File. # noqa: E501 + :rtype: bool + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this File. + + + :param file: The file of this File. # noqa: E501 + :type: bool + """ + + self._file = file + + @property + def free_space(self): + """Gets the free_space of this File. # noqa: E501 + + + :return: The free_space of this File. # noqa: E501 + :rtype: int + """ + return self._free_space + + @free_space.setter + def free_space(self, free_space): + """Sets the free_space of this File. + + + :param free_space: The free_space of this File. # noqa: E501 + :type: int + """ + + self._free_space = free_space + + @property + def hidden(self): + """Gets the hidden of this File. # noqa: E501 + + + :return: The hidden of this File. # noqa: E501 + :rtype: bool + """ + return self._hidden + + @hidden.setter + def hidden(self, hidden): + """Sets the hidden of this File. + + + :param hidden: The hidden of this File. # noqa: E501 + :type: bool + """ + + self._hidden = hidden + + @property + def name(self): + """Gets the name of this File. # noqa: E501 + + + :return: The name of this File. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this File. + + + :param name: The name of this File. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def parent(self): + """Gets the parent of this File. # noqa: E501 + + + :return: The parent of this File. # noqa: E501 + :rtype: str + """ + return self._parent + + @parent.setter + def parent(self, parent): + """Sets the parent of this File. + + + :param parent: The parent of this File. # noqa: E501 + :type: str + """ + + self._parent = parent + + @property + def parent_file(self): + """Gets the parent_file of this File. # noqa: E501 + + + :return: The parent_file of this File. # noqa: E501 + :rtype: file + """ + return self._parent_file + + @parent_file.setter + def parent_file(self, parent_file): + """Sets the parent_file of this File. + + + :param parent_file: The parent_file of this File. # noqa: E501 + :type: file + """ + + self._parent_file = parent_file + + @property + def path(self): + """Gets the path of this File. # noqa: E501 + + + :return: The path of this File. # noqa: E501 + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """Sets the path of this File. + + + :param path: The path of this File. # noqa: E501 + :type: str + """ + + self._path = path + + @property + def total_space(self): + """Gets the total_space of this File. # noqa: E501 + + + :return: The total_space of this File. # noqa: E501 + :rtype: int + """ + return self._total_space + + @total_space.setter + def total_space(self, total_space): + """Sets the total_space of this File. + + + :param total_space: The total_space of this File. # noqa: E501 + :type: int + """ + + self._total_space = total_space + + @property + def usable_space(self): + """Gets the usable_space of this File. # noqa: E501 + + + :return: The usable_space of this File. # noqa: E501 + :rtype: int + """ + return self._usable_space + + @usable_space.setter + def usable_space(self, usable_space): + """Sets the usable_space of this File. + + + :param usable_space: The usable_space of this File. # noqa: E501 + :type: int + """ + + self._usable_space = usable_space + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(File, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, File): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valueboolean.py b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valueboolean.py new file mode 100644 index 0000000..90a95f9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valueboolean.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'bool', + 'dynamic_value': 'DynamicValueboolean', + 'user_value': 'bool' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueboolean - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueboolean. + + + :param default_value: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: DynamicValueboolean + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueboolean. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :type: DynamicValueboolean + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueboolean. + + + :param user_value: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuedouble.py b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuedouble.py new file mode 100644 index 0000000..af159f6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuedouble.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'float', + 'dynamic_value': 'DynamicValuedouble', + 'user_value': 'float' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuedouble - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuedouble. + + + :param default_value: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: DynamicValuedouble + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuedouble. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :type: DynamicValuedouble + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuedouble. + + + :param user_value: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valueint.py b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valueint.py new file mode 100644 index 0000000..588b349 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valueint.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValueint', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueint - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueint. + + + :param default_value: The default_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :rtype: DynamicValueint + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueint. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :type: DynamicValueint + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueint. + + + :param user_value: The user_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuelong.py b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuelong.py new file mode 100644 index 0000000..849bc29 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuelong.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValuelong', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuelong - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuelong. + + + :param default_value: The default_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: DynamicValuelong + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuelong. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :type: DynamicValuelong + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuelong. + + + :param user_value: The user_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuestring.py b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuestring.py new file mode 100644 index 0000000..f2d45a2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/filter_predicate_valuestring.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'str', + 'dynamic_value': 'DynamicValuestring', + 'user_value': 'str' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuestring - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuestring. + + + :param default_value: The default_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuestring. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuestring. + + + :param user_value: The user_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/home_dashboard.py b/billinglayer/python/tb_rest_client/models/models_ce/home_dashboard.py new file mode 100644 index 0000000..ca79d62 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/home_dashboard.py @@ -0,0 +1,374 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HomeDashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'title': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'image': 'str', + 'configuration': 'JsonNode', + 'hide_dashboard_toolbar': 'bool' + } + + attribute_map = { + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'title': 'title', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'image': 'image', + 'configuration': 'configuration', + 'hide_dashboard_toolbar': 'hideDashboardToolbar' + } + + def __init__(self, created_time=None, tenant_id=None, name=None, title=None, assigned_customers=None, mobile_hide=None, mobile_order=None, image=None, configuration=None, hide_dashboard_toolbar=None): # noqa: E501 + """HomeDashboard - a model defined in Swagger""" # noqa: E501 + self._created_time = None + self._tenant_id = None + self._name = None + self._title = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._image = None + self._configuration = None + self._hide_dashboard_toolbar = None + self.discriminator = None + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if title is not None: + self.title = title + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if image is not None: + self.image = image + if configuration is not None: + self.configuration = configuration + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def created_time(self): + """Gets the created_time of this HomeDashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this HomeDashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this HomeDashboard. # noqa: E501 + + + :return: The tenant_id of this HomeDashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this HomeDashboard. + + + :param tenant_id: The tenant_id of this HomeDashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this HomeDashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this HomeDashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this HomeDashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this HomeDashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def assigned_customers(self): + """Gets the assigned_customers of this HomeDashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this HomeDashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this HomeDashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this HomeDashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this HomeDashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this HomeDashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this HomeDashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this HomeDashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def image(self): + """Gets the image of this HomeDashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this HomeDashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def configuration(self): + """Gets the configuration of this HomeDashboard. # noqa: E501 + + + :return: The configuration of this HomeDashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this HomeDashboard. + + + :param configuration: The configuration of this HomeDashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :return: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this HomeDashboard. + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HomeDashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HomeDashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/home_dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_ce/home_dashboard_info.py new file mode 100644 index 0000000..c02816b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/home_dashboard_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HomeDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dashboard_id': 'DashboardId', + 'hide_dashboard_toolbar': 'bool' + } + + attribute_map = { + 'dashboard_id': 'dashboardId', + 'hide_dashboard_toolbar': 'hideDashboardToolbar' + } + + def __init__(self, dashboard_id=None, hide_dashboard_toolbar=None): # noqa: E501 + """HomeDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._dashboard_id = None + self._hide_dashboard_toolbar = None + self.discriminator = None + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def dashboard_id(self): + """Gets the dashboard_id of this HomeDashboardInfo. # noqa: E501 + + + :return: The dashboard_id of this HomeDashboardInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this HomeDashboardInfo. + + + :param dashboard_id: The dashboard_id of this HomeDashboardInfo. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this HomeDashboardInfo. # noqa: E501 + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :return: The hide_dashboard_toolbar of this HomeDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this HomeDashboardInfo. + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this HomeDashboardInfo. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HomeDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HomeDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/input_stream.py b/billinglayer/python/tb_rest_client/models/models_ce/input_stream.py new file mode 100644 index 0000000..3afd8fe --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/input_stream.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class InputStream(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """InputStream - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(InputStream, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, InputStream): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/json_node.py b/billinglayer/python/tb_rest_client/models/models_ce/json_node.py new file mode 100644 index 0000000..650d337 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/json_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JsonNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """JsonNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/json_transport_payload_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/json_transport_payload_configuration.py new file mode 100644 index 0000000..bba4c11 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/json_transport_payload_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class JsonTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """JsonTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/jwt_pair.py b/billinglayer/python/tb_rest_client/models/models_ce/jwt_pair.py new file mode 100644 index 0000000..d3502b0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/jwt_pair.py @@ -0,0 +1,186 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JWTPair(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'scope': 'str', + 'refresh_token': 'str', + 'token': 'str' + } + + attribute_map = { + 'scope': 'scope', + 'refresh_token': 'refreshToken', + 'token': 'token' + } + + def __init__(self, scope=None, refresh_token=None, token=None): # noqa: E501 + """JWTPair - a model defined in Swagger""" # noqa: E501 + self._scope = None + self._refresh_token = None + self._token = None + self.discriminator = None + if scope is not None: + self.scope = scope + if refresh_token is not None: + self.refresh_token = refresh_token + if token is not None: + self.token = token + + @property + def scope(self): + """Gets the scope of this JWTPair. # noqa: E501 + + + :return: The scope of this JWTPair. # noqa: E501 + :rtype: str + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this JWTPair. + + + :param scope: The scope of this JWTPair. # noqa: E501 + :type: str + """ + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if scope not in allowed_values: + raise ValueError( + "Invalid value for `scope` ({0}), must be one of {1}" # noqa: E501 + .format(scope, allowed_values) + ) + + self._scope = scope + + @property + def refresh_token(self): + """Gets the refresh_token of this JWTPair. # noqa: E501 + + The JWT Refresh Token. Used to get new JWT Access Token if old one has expired. # noqa: E501 + + :return: The refresh_token of this JWTPair. # noqa: E501 + :rtype: str + """ + return self._refresh_token + + @refresh_token.setter + def refresh_token(self, refresh_token): + """Sets the refresh_token of this JWTPair. + + The JWT Refresh Token. Used to get new JWT Access Token if old one has expired. # noqa: E501 + + :param refresh_token: The refresh_token of this JWTPair. # noqa: E501 + :type: str + """ + + self._refresh_token = refresh_token + + @property + def token(self): + """Gets the token of this JWTPair. # noqa: E501 + + The JWT Access Token. Used to perform API calls. # noqa: E501 + + :return: The token of this JWTPair. # noqa: E501 + :rtype: str + """ + return self._token + + @token.setter + def token(self, token): + """Sets the token of this JWTPair. + + The JWT Access Token. Used to perform API calls. # noqa: E501 + + :param token: The token of this JWTPair. # noqa: E501 + :type: str + """ + + self._token = token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JWTPair, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JWTPair): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/jwt_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/jwt_settings.py new file mode 100644 index 0000000..a3e5e27 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/jwt_settings.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JWTSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token_expiration_time': 'int', + 'refresh_token_exp_time': 'int', + 'token_issuer': 'str', + 'token_signing_key': 'str' + } + + attribute_map = { + 'token_expiration_time': 'tokenExpirationTime', + 'refresh_token_exp_time': 'refreshTokenExpTime', + 'token_issuer': 'tokenIssuer', + 'token_signing_key': 'tokenSigningKey' + } + + def __init__(self, token_expiration_time=None, refresh_token_exp_time=None, token_issuer=None, token_signing_key=None): # noqa: E501 + """JWTSettings - a model defined in Swagger""" # noqa: E501 + self._token_expiration_time = None + self._refresh_token_exp_time = None + self._token_issuer = None + self._token_signing_key = None + self.discriminator = None + if token_expiration_time is not None: + self.token_expiration_time = token_expiration_time + if refresh_token_exp_time is not None: + self.refresh_token_exp_time = refresh_token_exp_time + if token_issuer is not None: + self.token_issuer = token_issuer + if token_signing_key is not None: + self.token_signing_key = token_signing_key + + @property + def token_expiration_time(self): + """Gets the token_expiration_time of this JWTSettings. # noqa: E501 + + The JWT will expire after seconds. # noqa: E501 + + :return: The token_expiration_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._token_expiration_time + + @token_expiration_time.setter + def token_expiration_time(self, token_expiration_time): + """Sets the token_expiration_time of this JWTSettings. + + The JWT will expire after seconds. # noqa: E501 + + :param token_expiration_time: The token_expiration_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._token_expiration_time = token_expiration_time + + @property + def refresh_token_exp_time(self): + """Gets the refresh_token_exp_time of this JWTSettings. # noqa: E501 + + The JWT can be refreshed during seconds. # noqa: E501 + + :return: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._refresh_token_exp_time + + @refresh_token_exp_time.setter + def refresh_token_exp_time(self, refresh_token_exp_time): + """Sets the refresh_token_exp_time of this JWTSettings. + + The JWT can be refreshed during seconds. # noqa: E501 + + :param refresh_token_exp_time: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._refresh_token_exp_time = refresh_token_exp_time + + @property + def token_issuer(self): + """Gets the token_issuer of this JWTSettings. # noqa: E501 + + The JWT issuer. # noqa: E501 + + :return: The token_issuer of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_issuer + + @token_issuer.setter + def token_issuer(self, token_issuer): + """Sets the token_issuer of this JWTSettings. + + The JWT issuer. # noqa: E501 + + :param token_issuer: The token_issuer of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_issuer = token_issuer + + @property + def token_signing_key(self): + """Gets the token_signing_key of this JWTSettings. # noqa: E501 + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :return: The token_signing_key of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_signing_key + + @token_signing_key.setter + def token_signing_key(self, token_signing_key): + """Sets the token_signing_key of this JWTSettings. + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :param token_signing_key: The token_signing_key of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_signing_key = token_signing_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JWTSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JWTSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/key_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/key_filter.py new file mode 100644 index 0000000..4ae0113 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/key_filter.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'EntityKey', + 'predicate': 'KeyFilterPredicate', + 'value_type': 'str' + } + + attribute_map = { + 'key': 'key', + 'predicate': 'predicate', + 'value_type': 'valueType' + } + + def __init__(self, key=None, predicate=None, value_type=None): # noqa: E501 + """KeyFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._predicate = None + self._value_type = None + self.discriminator = None + if key is not None: + self.key = key + if predicate is not None: + self.predicate = predicate + if value_type is not None: + self.value_type = value_type + + @property + def key(self): + """Gets the key of this KeyFilter. # noqa: E501 + + + :return: The key of this KeyFilter. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this KeyFilter. + + + :param key: The key of this KeyFilter. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + @property + def predicate(self): + """Gets the predicate of this KeyFilter. # noqa: E501 + + + :return: The predicate of this KeyFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this KeyFilter. + + + :param predicate: The predicate of this KeyFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + @property + def value_type(self): + """Gets the value_type of this KeyFilter. # noqa: E501 + + + :return: The value_type of this KeyFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this KeyFilter. + + + :param value_type: The value_type of this KeyFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/key_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_ce/key_filter_predicate.py new file mode 100644 index 0000000..a7d54cf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/key_filter_predicate.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilterPredicate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """KeyFilterPredicate - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/last_visited_dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_ce/last_visited_dashboard_info.py new file mode 100644 index 0000000..acbb2d0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/last_visited_dashboard_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LastVisitedDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred': 'bool', + 'last_visited': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred': 'starred', + 'last_visited': 'lastVisited' + } + + def __init__(self, id=None, title=None, starred=None, last_visited=None): # noqa: E501 + """LastVisitedDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred = None + self._last_visited = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred is not None: + self.starred = starred + if last_visited is not None: + self.last_visited = last_visited + + @property + def id(self): + """Gets the id of this LastVisitedDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LastVisitedDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this LastVisitedDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this LastVisitedDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred(self): + """Gets the starred of this LastVisitedDashboardInfo. # noqa: E501 + + Starred flag # noqa: E501 + + :return: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this LastVisitedDashboardInfo. + + Starred flag # noqa: E501 + + :param starred: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :type: bool + """ + + self._starred = starred + + @property + def last_visited(self): + """Gets the last_visited of this LastVisitedDashboardInfo. # noqa: E501 + + Last visit timestamp # noqa: E501 + + :return: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._last_visited + + @last_visited.setter + def last_visited(self, last_visited): + """Sets the last_visited of this LastVisitedDashboardInfo. + + Last visit timestamp # noqa: E501 + + :param last_visited: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :type: int + """ + + self._last_visited = last_visited + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LastVisitedDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LastVisitedDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/life_cycle_event_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/life_cycle_event_filter.py new file mode 100644 index 0000000..ac2665c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/life_cycle_event_filter.py @@ -0,0 +1,283 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class LifeCycleEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'event': 'str', + 'status': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'event': 'event', + 'status': 'status', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, event=None, status=None, error_str=None, *args, **kwargs): # noqa: E501 + """LifeCycleEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._event = None + self._status = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if event is not None: + self.event = event + if status is not None: + self.status = status + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this LifeCycleEventFilter. # noqa: E501 + + + :return: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this LifeCycleEventFilter. + + + :param not_empty: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this LifeCycleEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this LifeCycleEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this LifeCycleEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this LifeCycleEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def event(self): + """Gets the event of this LifeCycleEventFilter. # noqa: E501 + + String value representing the lifecycle event type # noqa: E501 + + :return: The event of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event + + @event.setter + def event(self, event): + """Sets the event of this LifeCycleEventFilter. + + String value representing the lifecycle event type # noqa: E501 + + :param event: The event of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._event = event + + @property + def status(self): + """Gets the status of this LifeCycleEventFilter. # noqa: E501 + + String value representing status of the lifecycle event # noqa: E501 + + :return: The status of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this LifeCycleEventFilter. + + String value representing status of the lifecycle event # noqa: E501 + + :param status: The status of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["Failure", "Success"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def error_str(self): + """Gets the error_str of this LifeCycleEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this LifeCycleEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LifeCycleEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LifeCycleEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/login_request.py b/billinglayer/python/tb_rest_client/models/models_ce/login_request.py new file mode 100644 index 0000000..82db76a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/login_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'username': 'str', + 'password': 'str' + } + + attribute_map = { + 'username': 'username', + 'password': 'password' + } + + def __init__(self, username=None, password=None): # noqa: E501 + """LoginRequest - a model defined in Swagger""" # noqa: E501 + self._username = None + self._password = None + self.discriminator = None + self.username = username + self.password = password + + @property + def username(self): + """Gets the username of this LoginRequest. # noqa: E501 + + User email # noqa: E501 + + :return: The username of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this LoginRequest. + + User email # noqa: E501 + + :param username: The username of this LoginRequest. # noqa: E501 + :type: str + """ + if username is None: + raise ValueError("Invalid value for `username`, must not be `None`") # noqa: E501 + + self._username = username + + @property + def password(self): + """Gets the password of this LoginRequest. # noqa: E501 + + User password # noqa: E501 + + :return: The password of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this LoginRequest. + + User password # noqa: E501 + + :param password: The password of this LoginRequest. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/login_response.py b/billinglayer/python/tb_rest_client/models/models_ce/login_response.py new file mode 100644 index 0000000..5c626ee --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/login_response.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token': 'str', + 'refresh_token': 'str' + } + + attribute_map = { + 'token': 'token', + 'refresh_token': 'refreshToken' + } + + def __init__(self, token=None, refresh_token=None): # noqa: E501 + """LoginResponse - a model defined in Swagger""" # noqa: E501 + self._token = None + self._refresh_token = None + self.discriminator = None + self.token = token + self.refresh_token = refresh_token + + @property + def token(self): + """Gets the token of this LoginResponse. # noqa: E501 + + JWT token # noqa: E501 + + :return: The token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._token + + @token.setter + def token(self, token): + """Sets the token of this LoginResponse. + + JWT token # noqa: E501 + + :param token: The token of this LoginResponse. # noqa: E501 + :type: str + """ + if token is None: + raise ValueError("Invalid value for `token`, must not be `None`") # noqa: E501 + + self._token = token + + @property + def refresh_token(self): + """Gets the refresh_token of this LoginResponse. # noqa: E501 + + Refresh token # noqa: E501 + + :return: The refresh_token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._refresh_token + + @refresh_token.setter + def refresh_token(self, refresh_token): + """Sets the refresh_token of this LoginResponse. + + Refresh token # noqa: E501 + + :param refresh_token: The refresh_token of this LoginResponse. # noqa: E501 + :type: str + """ + if refresh_token is None: + raise ValueError("Invalid value for `refresh_token`, must not be `None`") # noqa: E501 + + self._refresh_token = refresh_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..daecd98 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/lw_m2_m_server_security_config_default.py b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2_m_server_security_config_default.py new file mode 100644 index 0000000..245f270 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2_m_server_security_config_default.py @@ -0,0 +1,490 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MServerSecurityConfigDefault(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, security_host=None, security_port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """LwM2MServerSecurityConfigDefault - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this LwM2MServerSecurityConfigDefault. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this LwM2MServerSecurityConfigDefault. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this LwM2MServerSecurityConfigDefault. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this LwM2MServerSecurityConfigDefault. + + Host for 'Security' mode (DTLS) # noqa: E501 + + :param security_host: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this LwM2MServerSecurityConfigDefault. + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :param security_port: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this LwM2MServerSecurityConfigDefault. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this LwM2MServerSecurityConfigDefault. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this LwM2MServerSecurityConfigDefault. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MServerSecurityConfigDefault, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MServerSecurityConfigDefault): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_instance.py b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_instance.py new file mode 100644 index 0000000..8c9a1be --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_instance.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mInstance(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'resources': 'list[LwM2mResourceObserve]' + } + + attribute_map = { + 'id': 'id', + 'resources': 'resources' + } + + def __init__(self, id=None, resources=None): # noqa: E501 + """LwM2mInstance - a model defined in Swagger""" # noqa: E501 + self._id = None + self._resources = None + self.discriminator = None + if id is not None: + self.id = id + if resources is not None: + self.resources = resources + + @property + def id(self): + """Gets the id of this LwM2mInstance. # noqa: E501 + + LwM2M Instance id. # noqa: E501 + + :return: The id of this LwM2mInstance. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mInstance. + + LwM2M Instance id. # noqa: E501 + + :param id: The id of this LwM2mInstance. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def resources(self): + """Gets the resources of this LwM2mInstance. # noqa: E501 + + LwM2M Resource observe. # noqa: E501 + + :return: The resources of this LwM2mInstance. # noqa: E501 + :rtype: list[LwM2mResourceObserve] + """ + return self._resources + + @resources.setter + def resources(self, resources): + """Sets the resources of this LwM2mInstance. + + LwM2M Resource observe. # noqa: E501 + + :param resources: The resources of this LwM2mInstance. # noqa: E501 + :type: list[LwM2mResourceObserve] + """ + + self._resources = resources + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mInstance, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mInstance): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_object.py b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_object.py new file mode 100644 index 0000000..b36df52 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_object.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mObject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'key_id': 'str', + 'name': 'str', + 'multiple': 'bool', + 'mandatory': 'bool', + 'instances': 'list[LwM2mInstance]' + } + + attribute_map = { + 'id': 'id', + 'key_id': 'keyId', + 'name': 'name', + 'multiple': 'multiple', + 'mandatory': 'mandatory', + 'instances': 'instances' + } + + def __init__(self, id=None, key_id=None, name=None, multiple=None, mandatory=None, instances=None): # noqa: E501 + """LwM2mObject - a model defined in Swagger""" # noqa: E501 + self._id = None + self._key_id = None + self._name = None + self._multiple = None + self._mandatory = None + self._instances = None + self.discriminator = None + if id is not None: + self.id = id + if key_id is not None: + self.key_id = key_id + if name is not None: + self.name = name + if multiple is not None: + self.multiple = multiple + if mandatory is not None: + self.mandatory = mandatory + if instances is not None: + self.instances = instances + + @property + def id(self): + """Gets the id of this LwM2mObject. # noqa: E501 + + LwM2M Object id. # noqa: E501 + + :return: The id of this LwM2mObject. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mObject. + + LwM2M Object id. # noqa: E501 + + :param id: The id of this LwM2mObject. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def key_id(self): + """Gets the key_id of this LwM2mObject. # noqa: E501 + + LwM2M Object key id. # noqa: E501 + + :return: The key_id of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._key_id + + @key_id.setter + def key_id(self, key_id): + """Sets the key_id of this LwM2mObject. + + LwM2M Object key id. # noqa: E501 + + :param key_id: The key_id of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._key_id = key_id + + @property + def name(self): + """Gets the name of this LwM2mObject. # noqa: E501 + + LwM2M Object name. # noqa: E501 + + :return: The name of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mObject. + + LwM2M Object name. # noqa: E501 + + :param name: The name of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def multiple(self): + """Gets the multiple of this LwM2mObject. # noqa: E501 + + LwM2M Object multiple. # noqa: E501 + + :return: The multiple of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._multiple + + @multiple.setter + def multiple(self, multiple): + """Sets the multiple of this LwM2mObject. + + LwM2M Object multiple. # noqa: E501 + + :param multiple: The multiple of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._multiple = multiple + + @property + def mandatory(self): + """Gets the mandatory of this LwM2mObject. # noqa: E501 + + LwM2M Object mandatory. # noqa: E501 + + :return: The mandatory of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._mandatory + + @mandatory.setter + def mandatory(self, mandatory): + """Sets the mandatory of this LwM2mObject. + + LwM2M Object mandatory. # noqa: E501 + + :param mandatory: The mandatory of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._mandatory = mandatory + + @property + def instances(self): + """Gets the instances of this LwM2mObject. # noqa: E501 + + LwM2M Object instances. # noqa: E501 + + :return: The instances of this LwM2mObject. # noqa: E501 + :rtype: list[LwM2mInstance] + """ + return self._instances + + @instances.setter + def instances(self, instances): + """Sets the instances of this LwM2mObject. + + LwM2M Object instances. # noqa: E501 + + :param instances: The instances of this LwM2mObject. # noqa: E501 + :type: list[LwM2mInstance] + """ + + self._instances = instances + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mObject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mObject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_resource_observe.py b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_resource_observe.py new file mode 100644 index 0000000..38c8293 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/lw_m2m_resource_observe.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mResourceObserve(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str', + 'observe': 'bool', + 'attribute': 'bool', + 'telemetry': 'bool', + 'key_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'observe': 'observe', + 'attribute': 'attribute', + 'telemetry': 'telemetry', + 'key_name': 'keyName' + } + + def __init__(self, id=None, name=None, observe=None, attribute=None, telemetry=None, key_name=None): # noqa: E501 + """LwM2mResourceObserve - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._observe = None + self._attribute = None + self._telemetry = None + self._key_name = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if observe is not None: + self.observe = observe + if attribute is not None: + self.attribute = attribute + if telemetry is not None: + self.telemetry = telemetry + if key_name is not None: + self.key_name = key_name + + @property + def id(self): + """Gets the id of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe id. # noqa: E501 + + :return: The id of this LwM2mResourceObserve. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mResourceObserve. + + LwM2M Resource Observe id. # noqa: E501 + + :param id: The id of this LwM2mResourceObserve. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def name(self): + """Gets the name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe name. # noqa: E501 + + :return: The name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mResourceObserve. + + LwM2M Resource Observe name. # noqa: E501 + + :param name: The name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def observe(self): + """Gets the observe of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe observe. # noqa: E501 + + :return: The observe of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this LwM2mResourceObserve. + + LwM2M Resource Observe observe. # noqa: E501 + + :param observe: The observe of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._observe = observe + + @property + def attribute(self): + """Gets the attribute of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe attribute. # noqa: E501 + + :return: The attribute of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this LwM2mResourceObserve. + + LwM2M Resource Observe attribute. # noqa: E501 + + :param attribute: The attribute of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._attribute = attribute + + @property + def telemetry(self): + """Gets the telemetry of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe telemetry. # noqa: E501 + + :return: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this LwM2mResourceObserve. + + LwM2M Resource Observe telemetry. # noqa: E501 + + :param telemetry: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._telemetry = telemetry + + @property + def key_name(self): + """Gets the key_name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe key name. # noqa: E501 + + :return: The key_name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this LwM2mResourceObserve. + + LwM2M Resource Observe key name. # noqa: E501 + + :param key_name: The key_name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._key_name = key_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mResourceObserve, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mResourceObserve): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/lwm2m_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/lwm2m_device_profile_transport_configuration.py new file mode 100644 index 0000000..b19d0fc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/lwm2m_device_profile_transport_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap': 'list[LwM2MBootstrapServerCredential]', + 'bootstrap_server_update_enable': 'bool', + 'client_lw_m2m_settings': 'OtherConfiguration', + 'observe_attr': 'TelemetryMappingConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'bootstrap': 'bootstrap', + 'bootstrap_server_update_enable': 'bootstrapServerUpdateEnable', + 'client_lw_m2m_settings': 'clientLwM2mSettings', + 'observe_attr': 'observeAttr' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, bootstrap=None, bootstrap_server_update_enable=None, client_lw_m2m_settings=None, observe_attr=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._bootstrap = None + self._bootstrap_server_update_enable = None + self._client_lw_m2m_settings = None + self._observe_attr = None + self.discriminator = None + if bootstrap is not None: + self.bootstrap = bootstrap + if bootstrap_server_update_enable is not None: + self.bootstrap_server_update_enable = bootstrap_server_update_enable + if client_lw_m2m_settings is not None: + self.client_lw_m2m_settings = client_lw_m2m_settings + if observe_attr is not None: + self.observe_attr = observe_attr + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def bootstrap(self): + """Gets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[LwM2MBootstrapServerCredential] + """ + return self._bootstrap + + @bootstrap.setter + def bootstrap(self, bootstrap): + """Sets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[LwM2MBootstrapServerCredential] + """ + + self._bootstrap = bootstrap + + @property + def bootstrap_server_update_enable(self): + """Gets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_update_enable + + @bootstrap_server_update_enable.setter + def bootstrap_server_update_enable(self, bootstrap_server_update_enable): + """Sets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap_server_update_enable: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_update_enable = bootstrap_server_update_enable + + @property + def client_lw_m2m_settings(self): + """Gets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: OtherConfiguration + """ + return self._client_lw_m2m_settings + + @client_lw_m2m_settings.setter + def client_lw_m2m_settings(self, client_lw_m2m_settings): + """Sets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. + + + :param client_lw_m2m_settings: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: OtherConfiguration + """ + + self._client_lw_m2m_settings = client_lw_m2m_settings + + @property + def observe_attr(self): + """Gets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TelemetryMappingConfiguration + """ + return self._observe_attr + + @observe_attr.setter + def observe_attr(self, observe_attr): + """Sets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. + + + :param observe_attr: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: TelemetryMappingConfiguration + """ + + self._observe_attr = observe_attr + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/lwm2m_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/lwm2m_device_transport_configuration.py new file mode 100644 index 0000000..8f2a8fc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/lwm2m_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this Lwm2mDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/mapping.py b/billinglayer/python/tb_rest_client/models/models_ce/mapping.py new file mode 100644 index 0000000..fd0ab51 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/mapping.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Mapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'columns': 'list[ColumnMapping]', + 'delimiter': 'str', + 'header': 'bool', + 'update': 'bool' + } + + attribute_map = { + 'columns': 'columns', + 'delimiter': 'delimiter', + 'header': 'header', + 'update': 'update' + } + + def __init__(self, columns=None, delimiter=None, header=None, update=None): # noqa: E501 + """Mapping - a model defined in Swagger""" # noqa: E501 + self._columns = None + self._delimiter = None + self._header = None + self._update = None + self.discriminator = None + if columns is not None: + self.columns = columns + if delimiter is not None: + self.delimiter = delimiter + if header is not None: + self.header = header + if update is not None: + self.update = update + + @property + def columns(self): + """Gets the columns of this Mapping. # noqa: E501 + + + :return: The columns of this Mapping. # noqa: E501 + :rtype: list[ColumnMapping] + """ + return self._columns + + @columns.setter + def columns(self, columns): + """Sets the columns of this Mapping. + + + :param columns: The columns of this Mapping. # noqa: E501 + :type: list[ColumnMapping] + """ + + self._columns = columns + + @property + def delimiter(self): + """Gets the delimiter of this Mapping. # noqa: E501 + + + :return: The delimiter of this Mapping. # noqa: E501 + :rtype: str + """ + return self._delimiter + + @delimiter.setter + def delimiter(self, delimiter): + """Sets the delimiter of this Mapping. + + + :param delimiter: The delimiter of this Mapping. # noqa: E501 + :type: str + """ + + self._delimiter = delimiter + + @property + def header(self): + """Gets the header of this Mapping. # noqa: E501 + + + :return: The header of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._header + + @header.setter + def header(self, header): + """Sets the header of this Mapping. + + + :param header: The header of this Mapping. # noqa: E501 + :type: bool + """ + + self._header = header + + @property + def update(self): + """Gets the update of this Mapping. # noqa: E501 + + + :return: The update of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._update + + @update.setter + def update(self, update): + """Sets the update of this Mapping. + + + :param update: The update of this Mapping. # noqa: E501 + :type: bool + """ + + self._update = update + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Mapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Mapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/mqtt_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/mqtt_device_profile_transport_configuration.py new file mode 100644 index 0000000..7efaa9e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/mqtt_device_profile_transport_configuration.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MqttDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_subscribe_topic': 'str', + 'device_attributes_topic': 'str', + 'device_telemetry_topic': 'str', + 'send_ack_on_validation_exception': 'bool', + 'sparkplug': 'bool', + 'sparkplug_attributes_metric_names': 'list[str]', + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + + attribute_map = { + 'device_attributes_subscribe_topic': 'deviceAttributesSubscribeTopic', + 'device_attributes_topic': 'deviceAttributesTopic', + 'device_telemetry_topic': 'deviceTelemetryTopic', + 'send_ack_on_validation_exception': 'sendAckOnValidationException', + 'sparkplug': 'sparkplug', + 'sparkplug_attributes_metric_names': 'sparkplugAttributesMetricNames', + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + + def __init__(self, device_attributes_subscribe_topic=None, device_attributes_topic=None, device_telemetry_topic=None, send_ack_on_validation_exception=None, sparkplug=None, sparkplug_attributes_metric_names=None, transport_payload_type_configuration=None): # noqa: E501 + """MqttDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_subscribe_topic = None + self._device_attributes_topic = None + self._device_telemetry_topic = None + self._send_ack_on_validation_exception = None + self._sparkplug = None + self._sparkplug_attributes_metric_names = None + self._transport_payload_type_configuration = None + self.discriminator = None + if device_attributes_subscribe_topic is not None: + self.device_attributes_subscribe_topic = device_attributes_subscribe_topic + if device_attributes_topic is not None: + self.device_attributes_topic = device_attributes_topic + if device_telemetry_topic is not None: + self.device_telemetry_topic = device_telemetry_topic + if send_ack_on_validation_exception is not None: + self.send_ack_on_validation_exception = send_ack_on_validation_exception + if sparkplug is not None: + self.sparkplug = sparkplug + if sparkplug_attributes_metric_names is not None: + self.sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + + @property + def device_attributes_subscribe_topic(self): + """Gets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_subscribe_topic + + @device_attributes_subscribe_topic.setter + def device_attributes_subscribe_topic(self, device_attributes_subscribe_topic): + """Sets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_subscribe_topic: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_subscribe_topic = device_attributes_subscribe_topic + + @property + def device_attributes_topic(self): + """Gets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_topic + + @device_attributes_topic.setter + def device_attributes_topic(self, device_attributes_topic): + """Sets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_topic: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_topic = device_attributes_topic + + @property + def device_telemetry_topic(self): + """Gets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_topic + + @device_telemetry_topic.setter + def device_telemetry_topic(self, device_telemetry_topic): + """Sets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_telemetry_topic: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_topic = device_telemetry_topic + + @property + def send_ack_on_validation_exception(self): + """Gets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._send_ack_on_validation_exception + + @send_ack_on_validation_exception.setter + def send_ack_on_validation_exception(self, send_ack_on_validation_exception): + """Sets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. + + + :param send_ack_on_validation_exception: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._send_ack_on_validation_exception = send_ack_on_validation_exception + + @property + def sparkplug(self): + """Gets the sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._sparkplug + + @sparkplug.setter + def sparkplug(self, sparkplug): + """Sets the sparkplug of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._sparkplug = sparkplug + + @property + def sparkplug_attributes_metric_names(self): + """Gets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._sparkplug_attributes_metric_names + + @sparkplug_attributes_metric_names.setter + def sparkplug_attributes_metric_names(self, sparkplug_attributes_metric_names): + """Sets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug_attributes_metric_names: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[str] + """ + + self._sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/mqtt_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/mqtt_device_transport_configuration.py new file mode 100644 index 0000000..f324e62 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/mqtt_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class MqttDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """MqttDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/new_platform_version_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/new_platform_version_notification_rule_trigger_config.py new file mode 100644 index 0000000..1b6c752 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/new_platform_version_notification_rule_trigger_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NewPlatformVersionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NewPlatformVersionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NewPlatformVersionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NewPlatformVersionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/no_sec_lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_ce/no_sec_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..7816c3f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/no_sec_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NoSecLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """NoSecLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this NoSecLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this NoSecLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this NoSecLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this NoSecLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this NoSecLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this NoSecLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NoSecLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NoSecLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/node_connection_info.py b/billinglayer/python/tb_rest_client/models/models_ce/node_connection_info.py new file mode 100644 index 0000000..20abae0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/node_connection_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NodeConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'to_index': 'int', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'to_index': 'toIndex', + 'type': 'type' + } + + def __init__(self, from_index=None, to_index=None, type=None): # noqa: E501 + """NodeConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._to_index = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.to_index = to_index + self.type = type + + @property + def from_index(self): + """Gets the from_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def to_index(self): + """Gets the to_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :return: The to_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._to_index + + @to_index.setter + def to_index(self, to_index): + """Sets the to_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :param to_index: The to_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if to_index is None: + raise ValueError("Invalid value for `to_index`, must not be `None`") # noqa: E501 + + self._to_index = to_index + + @property + def type(self): + """Gets the type of this NodeConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this NodeConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this NodeConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this NodeConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NodeConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NodeConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification.py b/billinglayer/python/tb_rest_client/models/models_ce/notification.py new file mode 100644 index 0000000..b078c29 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification.py @@ -0,0 +1,370 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Notification(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'created_time': 'int', + 'id': 'NotificationId', + 'info': 'NotificationInfo', + 'recipient_id': 'UserId', + 'request_id': 'NotificationRequestId', + 'status': 'str', + 'subject': 'str', + 'text': 'str', + 'type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'recipient_id': 'recipientId', + 'request_id': 'requestId', + 'status': 'status', + 'subject': 'subject', + 'text': 'text', + 'type': 'type' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, recipient_id=None, request_id=None, status=None, subject=None, text=None, type=None): # noqa: E501 + """Notification - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._recipient_id = None + self._request_id = None + self._status = None + self._subject = None + self._text = None + self._type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if recipient_id is not None: + self.recipient_id = recipient_id + if request_id is not None: + self.request_id = request_id + if status is not None: + self.status = status + if subject is not None: + self.subject = subject + if text is not None: + self.text = text + if type is not None: + self.type = type + + @property + def additional_config(self): + """Gets the additional_config of this Notification. # noqa: E501 + + + :return: The additional_config of this Notification. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this Notification. + + + :param additional_config: The additional_config of this Notification. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this Notification. # noqa: E501 + + + :return: The created_time of this Notification. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Notification. + + + :param created_time: The created_time of this Notification. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Notification. # noqa: E501 + + + :return: The id of this Notification. # noqa: E501 + :rtype: NotificationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Notification. + + + :param id: The id of this Notification. # noqa: E501 + :type: NotificationId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this Notification. # noqa: E501 + + + :return: The info of this Notification. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this Notification. + + + :param info: The info of this Notification. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def recipient_id(self): + """Gets the recipient_id of this Notification. # noqa: E501 + + + :return: The recipient_id of this Notification. # noqa: E501 + :rtype: UserId + """ + return self._recipient_id + + @recipient_id.setter + def recipient_id(self, recipient_id): + """Sets the recipient_id of this Notification. + + + :param recipient_id: The recipient_id of this Notification. # noqa: E501 + :type: UserId + """ + + self._recipient_id = recipient_id + + @property + def request_id(self): + """Gets the request_id of this Notification. # noqa: E501 + + + :return: The request_id of this Notification. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._request_id + + @request_id.setter + def request_id(self, request_id): + """Sets the request_id of this Notification. + + + :param request_id: The request_id of this Notification. # noqa: E501 + :type: NotificationRequestId + """ + + self._request_id = request_id + + @property + def status(self): + """Gets the status of this Notification. # noqa: E501 + + + :return: The status of this Notification. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Notification. + + + :param status: The status of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["READ", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def subject(self): + """Gets the subject of this Notification. # noqa: E501 + + + :return: The subject of this Notification. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this Notification. + + + :param subject: The subject of this Notification. # noqa: E501 + :type: str + """ + + self._subject = subject + + @property + def text(self): + """Gets the text of this Notification. # noqa: E501 + + + :return: The text of this Notification. # noqa: E501 + :rtype: str + """ + return self._text + + @text.setter + def text(self, text): + """Sets the text of this Notification. + + + :param text: The text of this Notification. # noqa: E501 + :type: str + """ + + self._text = text + + @property + def type(self): + """Gets the type of this Notification. # noqa: E501 + + + :return: The type of this Notification. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Notification. + + + :param type: The type of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "GENERAL", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT", "RULE_NODE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Notification, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Notification): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_delivery_method_config.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_delivery_method_config.py new file mode 100644 index 0000000..5703947 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_delivery_method_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """NotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_id.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_id.py new file mode 100644 index 0000000..a2e68cd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationId. # noqa: E501 + + + :return: The entity_type of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationId. + + + :param entity_type: The entity_type of this NotificationId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_info.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_info.py new file mode 100644 index 0000000..5e392ef --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_info.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'state_entity_id': 'EntityId' + } + + attribute_map = { + 'state_entity_id': 'stateEntityId' + } + + def __init__(self, state_entity_id=None): # noqa: E501 + """NotificationInfo - a model defined in Swagger""" # noqa: E501 + self._state_entity_id = None + self.discriminator = None + if state_entity_id is not None: + self.state_entity_id = state_entity_id + + @property + def state_entity_id(self): + """Gets the state_entity_id of this NotificationInfo. # noqa: E501 + + + :return: The state_entity_id of this NotificationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._state_entity_id + + @state_entity_id.setter + def state_entity_id(self, state_entity_id): + """Sets the state_entity_id of this NotificationInfo. + + + :param state_entity_id: The state_entity_id of this NotificationInfo. # noqa: E501 + :type: EntityId + """ + + self._state_entity_id = state_entity_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_request.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_request.py new file mode 100644 index 0000000..72eef9b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_request.py @@ -0,0 +1,416 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRequestConfig', + 'created_time': 'int', + 'id': 'NotificationRequestId', + 'info': 'NotificationInfo', + 'originator_entity_id': 'EntityId', + 'rule_id': 'NotificationRuleId', + 'stats': 'NotificationRequestStats', + 'status': 'str', + 'targets': 'list[str]', + 'template': 'NotificationTemplate', + 'template_id': 'NotificationTemplateId', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'originator_entity_id': 'originatorEntityId', + 'rule_id': 'ruleId', + 'stats': 'stats', + 'status': 'status', + 'targets': 'targets', + 'template': 'template', + 'template_id': 'templateId', + 'tenant_id': 'tenantId' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, originator_entity_id=None, rule_id=None, stats=None, status=None, targets=None, template=None, template_id=None, tenant_id=None): # noqa: E501 + """NotificationRequest - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._originator_entity_id = None + self._rule_id = None + self._stats = None + self._status = None + self._targets = None + self._template = None + self._template_id = None + self._tenant_id = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if originator_entity_id is not None: + self.originator_entity_id = originator_entity_id + if rule_id is not None: + self.rule_id = rule_id + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if targets is not None: + self.targets = targets + if template is not None: + self.template = template + if template_id is not None: + self.template_id = template_id + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRequest. # noqa: E501 + + + :return: The additional_config of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRequest. + + + :param additional_config: The additional_config of this NotificationRequest. # noqa: E501 + :type: NotificationRequestConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRequest. # noqa: E501 + + + :return: The created_time of this NotificationRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRequest. + + + :param created_time: The created_time of this NotificationRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationRequest. # noqa: E501 + + + :return: The id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequest. + + + :param id: The id of this NotificationRequest. # noqa: E501 + :type: NotificationRequestId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this NotificationRequest. # noqa: E501 + + + :return: The info of this NotificationRequest. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this NotificationRequest. + + + :param info: The info of this NotificationRequest. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def originator_entity_id(self): + """Gets the originator_entity_id of this NotificationRequest. # noqa: E501 + + + :return: The originator_entity_id of this NotificationRequest. # noqa: E501 + :rtype: EntityId + """ + return self._originator_entity_id + + @originator_entity_id.setter + def originator_entity_id(self, originator_entity_id): + """Sets the originator_entity_id of this NotificationRequest. + + + :param originator_entity_id: The originator_entity_id of this NotificationRequest. # noqa: E501 + :type: EntityId + """ + + self._originator_entity_id = originator_entity_id + + @property + def rule_id(self): + """Gets the rule_id of this NotificationRequest. # noqa: E501 + + + :return: The rule_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._rule_id + + @rule_id.setter + def rule_id(self, rule_id): + """Sets the rule_id of this NotificationRequest. + + + :param rule_id: The rule_id of this NotificationRequest. # noqa: E501 + :type: NotificationRuleId + """ + + self._rule_id = rule_id + + @property + def stats(self): + """Gets the stats of this NotificationRequest. # noqa: E501 + + + :return: The stats of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestStats + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this NotificationRequest. + + + :param stats: The stats of this NotificationRequest. # noqa: E501 + :type: NotificationRequestStats + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this NotificationRequest. # noqa: E501 + + + :return: The status of this NotificationRequest. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this NotificationRequest. + + + :param status: The status of this NotificationRequest. # noqa: E501 + :type: str + """ + allowed_values = ["PROCESSING", "SCHEDULED", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def targets(self): + """Gets the targets of this NotificationRequest. # noqa: E501 + + + :return: The targets of this NotificationRequest. # noqa: E501 + :rtype: list[str] + """ + return self._targets + + @targets.setter + def targets(self, targets): + """Sets the targets of this NotificationRequest. + + + :param targets: The targets of this NotificationRequest. # noqa: E501 + :type: list[str] + """ + + self._targets = targets + + @property + def template(self): + """Gets the template of this NotificationRequest. # noqa: E501 + + + :return: The template of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplate + """ + return self._template + + @template.setter + def template(self, template): + """Sets the template of this NotificationRequest. + + + :param template: The template of this NotificationRequest. # noqa: E501 + :type: NotificationTemplate + """ + + self._template = template + + @property + def template_id(self): + """Gets the template_id of this NotificationRequest. # noqa: E501 + + + :return: The template_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRequest. + + + :param template_id: The template_id of this NotificationRequest. # noqa: E501 + :type: NotificationTemplateId + """ + + self._template_id = template_id + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRequest. # noqa: E501 + + + :return: The tenant_id of this NotificationRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRequest. + + + :param tenant_id: The tenant_id of this NotificationRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_request_config.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_config.py new file mode 100644 index 0000000..ba59d4f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sending_delay_in_sec': 'int' + } + + attribute_map = { + 'sending_delay_in_sec': 'sendingDelayInSec' + } + + def __init__(self, sending_delay_in_sec=None): # noqa: E501 + """NotificationRequestConfig - a model defined in Swagger""" # noqa: E501 + self._sending_delay_in_sec = None + self.discriminator = None + if sending_delay_in_sec is not None: + self.sending_delay_in_sec = sending_delay_in_sec + + @property + def sending_delay_in_sec(self): + """Gets the sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + + + :return: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :rtype: int + """ + return self._sending_delay_in_sec + + @sending_delay_in_sec.setter + def sending_delay_in_sec(self, sending_delay_in_sec): + """Sets the sending_delay_in_sec of this NotificationRequestConfig. + + + :param sending_delay_in_sec: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :type: int + """ + + self._sending_delay_in_sec = sending_delay_in_sec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_request_id.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_id.py new file mode 100644 index 0000000..213692f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRequestId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRequestId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequestId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRequestId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRequestId. # noqa: E501 + + + :return: The entity_type of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRequestId. + + + :param entity_type: The entity_type of this NotificationRequestId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_request_info.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_info.py new file mode 100644 index 0000000..cf95b5f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_info.py @@ -0,0 +1,475 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRequestConfig', + 'created_time': 'int', + 'delivery_methods': 'list[str]', + 'id': 'NotificationRequestId', + 'info': 'NotificationInfo', + 'originator_entity_id': 'EntityId', + 'rule_id': 'NotificationRuleId', + 'stats': 'NotificationRequestStats', + 'status': 'str', + 'targets': 'list[str]', + 'template': 'NotificationTemplate', + 'template_id': 'NotificationTemplateId', + 'template_name': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'delivery_methods': 'deliveryMethods', + 'id': 'id', + 'info': 'info', + 'originator_entity_id': 'originatorEntityId', + 'rule_id': 'ruleId', + 'stats': 'stats', + 'status': 'status', + 'targets': 'targets', + 'template': 'template', + 'template_id': 'templateId', + 'template_name': 'templateName', + 'tenant_id': 'tenantId' + } + + def __init__(self, additional_config=None, created_time=None, delivery_methods=None, id=None, info=None, originator_entity_id=None, rule_id=None, stats=None, status=None, targets=None, template=None, template_id=None, template_name=None, tenant_id=None): # noqa: E501 + """NotificationRequestInfo - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._delivery_methods = None + self._id = None + self._info = None + self._originator_entity_id = None + self._rule_id = None + self._stats = None + self._status = None + self._targets = None + self._template = None + self._template_id = None + self._template_name = None + self._tenant_id = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if delivery_methods is not None: + self.delivery_methods = delivery_methods + if id is not None: + self.id = id + if info is not None: + self.info = info + if originator_entity_id is not None: + self.originator_entity_id = originator_entity_id + if rule_id is not None: + self.rule_id = rule_id + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if targets is not None: + self.targets = targets + if template is not None: + self.template = template + if template_id is not None: + self.template_id = template_id + if template_name is not None: + self.template_name = template_name + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRequestInfo. # noqa: E501 + + + :return: The additional_config of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRequestConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRequestInfo. + + + :param additional_config: The additional_config of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRequestConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRequestInfo. # noqa: E501 + + + :return: The created_time of this NotificationRequestInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRequestInfo. + + + :param created_time: The created_time of this NotificationRequestInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def delivery_methods(self): + """Gets the delivery_methods of this NotificationRequestInfo. # noqa: E501 + + + :return: The delivery_methods of this NotificationRequestInfo. # noqa: E501 + :rtype: list[str] + """ + return self._delivery_methods + + @delivery_methods.setter + def delivery_methods(self, delivery_methods): + """Sets the delivery_methods of this NotificationRequestInfo. + + + :param delivery_methods: The delivery_methods of this NotificationRequestInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["EMAIL", "SLACK", "SMS", "WEB"] # noqa: E501 + if not set(delivery_methods).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `delivery_methods` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(delivery_methods) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._delivery_methods = delivery_methods + + @property + def id(self): + """Gets the id of this NotificationRequestInfo. # noqa: E501 + + + :return: The id of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequestInfo. + + + :param id: The id of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRequestId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this NotificationRequestInfo. # noqa: E501 + + + :return: The info of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this NotificationRequestInfo. + + + :param info: The info of this NotificationRequestInfo. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def originator_entity_id(self): + """Gets the originator_entity_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The originator_entity_id of this NotificationRequestInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator_entity_id + + @originator_entity_id.setter + def originator_entity_id(self, originator_entity_id): + """Sets the originator_entity_id of this NotificationRequestInfo. + + + :param originator_entity_id: The originator_entity_id of this NotificationRequestInfo. # noqa: E501 + :type: EntityId + """ + + self._originator_entity_id = originator_entity_id + + @property + def rule_id(self): + """Gets the rule_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The rule_id of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._rule_id + + @rule_id.setter + def rule_id(self, rule_id): + """Sets the rule_id of this NotificationRequestInfo. + + + :param rule_id: The rule_id of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRuleId + """ + + self._rule_id = rule_id + + @property + def stats(self): + """Gets the stats of this NotificationRequestInfo. # noqa: E501 + + + :return: The stats of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRequestStats + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this NotificationRequestInfo. + + + :param stats: The stats of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRequestStats + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this NotificationRequestInfo. # noqa: E501 + + + :return: The status of this NotificationRequestInfo. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this NotificationRequestInfo. + + + :param status: The status of this NotificationRequestInfo. # noqa: E501 + :type: str + """ + allowed_values = ["PROCESSING", "SCHEDULED", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def targets(self): + """Gets the targets of this NotificationRequestInfo. # noqa: E501 + + + :return: The targets of this NotificationRequestInfo. # noqa: E501 + :rtype: list[str] + """ + return self._targets + + @targets.setter + def targets(self, targets): + """Sets the targets of this NotificationRequestInfo. + + + :param targets: The targets of this NotificationRequestInfo. # noqa: E501 + :type: list[str] + """ + + self._targets = targets + + @property + def template(self): + """Gets the template of this NotificationRequestInfo. # noqa: E501 + + + :return: The template of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationTemplate + """ + return self._template + + @template.setter + def template(self, template): + """Sets the template of this NotificationRequestInfo. + + + :param template: The template of this NotificationRequestInfo. # noqa: E501 + :type: NotificationTemplate + """ + + self._template = template + + @property + def template_id(self): + """Gets the template_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The template_id of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRequestInfo. + + + :param template_id: The template_id of this NotificationRequestInfo. # noqa: E501 + :type: NotificationTemplateId + """ + + self._template_id = template_id + + @property + def template_name(self): + """Gets the template_name of this NotificationRequestInfo. # noqa: E501 + + + :return: The template_name of this NotificationRequestInfo. # noqa: E501 + :rtype: str + """ + return self._template_name + + @template_name.setter + def template_name(self, template_name): + """Sets the template_name of this NotificationRequestInfo. + + + :param template_name: The template_name of this NotificationRequestInfo. # noqa: E501 + :type: str + """ + + self._template_name = template_name + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The tenant_id of this NotificationRequestInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRequestInfo. + + + :param tenant_id: The tenant_id of this NotificationRequestInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_request_preview.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_preview.py new file mode 100644 index 0000000..9452d66 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_preview.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestPreview(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'processed_templates': 'dict(str, DeliveryMethodNotificationTemplate)', + 'recipients_count_by_target': 'dict(str, int)', + 'recipients_preview': 'list[str]', + 'total_recipients_count': 'int' + } + + attribute_map = { + 'processed_templates': 'processedTemplates', + 'recipients_count_by_target': 'recipientsCountByTarget', + 'recipients_preview': 'recipientsPreview', + 'total_recipients_count': 'totalRecipientsCount' + } + + def __init__(self, processed_templates=None, recipients_count_by_target=None, recipients_preview=None, total_recipients_count=None): # noqa: E501 + """NotificationRequestPreview - a model defined in Swagger""" # noqa: E501 + self._processed_templates = None + self._recipients_count_by_target = None + self._recipients_preview = None + self._total_recipients_count = None + self.discriminator = None + if processed_templates is not None: + self.processed_templates = processed_templates + if recipients_count_by_target is not None: + self.recipients_count_by_target = recipients_count_by_target + if recipients_preview is not None: + self.recipients_preview = recipients_preview + if total_recipients_count is not None: + self.total_recipients_count = total_recipients_count + + @property + def processed_templates(self): + """Gets the processed_templates of this NotificationRequestPreview. # noqa: E501 + + + :return: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._processed_templates + + @processed_templates.setter + def processed_templates(self, processed_templates): + """Sets the processed_templates of this NotificationRequestPreview. + + + :param processed_templates: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._processed_templates = processed_templates + + @property + def recipients_count_by_target(self): + """Gets the recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, int) + """ + return self._recipients_count_by_target + + @recipients_count_by_target.setter + def recipients_count_by_target(self, recipients_count_by_target): + """Sets the recipients_count_by_target of this NotificationRequestPreview. + + + :param recipients_count_by_target: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, int) + """ + + self._recipients_count_by_target = recipients_count_by_target + + @property + def recipients_preview(self): + """Gets the recipients_preview of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :rtype: list[str] + """ + return self._recipients_preview + + @recipients_preview.setter + def recipients_preview(self, recipients_preview): + """Sets the recipients_preview of this NotificationRequestPreview. + + + :param recipients_preview: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :type: list[str] + """ + + self._recipients_preview = recipients_preview + + @property + def total_recipients_count(self): + """Gets the total_recipients_count of this NotificationRequestPreview. # noqa: E501 + + + :return: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :rtype: int + """ + return self._total_recipients_count + + @total_recipients_count.setter + def total_recipients_count(self, total_recipients_count): + """Sets the total_recipients_count of this NotificationRequestPreview. + + + :param total_recipients_count: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :type: int + """ + + self._total_recipients_count = total_recipients_count + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestPreview, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestPreview): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_request_stats.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_stats.py new file mode 100644 index 0000000..9a03edf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_request_stats.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestStats(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'errors': 'dict(str, object)', + 'sent': 'dict(str, AtomicInteger)' + } + + attribute_map = { + 'error': 'error', + 'errors': 'errors', + 'sent': 'sent' + } + + def __init__(self, error=None, errors=None, sent=None): # noqa: E501 + """NotificationRequestStats - a model defined in Swagger""" # noqa: E501 + self._error = None + self._errors = None + self._sent = None + self.discriminator = None + if error is not None: + self.error = error + if errors is not None: + self.errors = errors + if sent is not None: + self.sent = sent + + @property + def error(self): + """Gets the error of this NotificationRequestStats. # noqa: E501 + + + :return: The error of this NotificationRequestStats. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this NotificationRequestStats. + + + :param error: The error of this NotificationRequestStats. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def errors(self): + """Gets the errors of this NotificationRequestStats. # noqa: E501 + + + :return: The errors of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, object) + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this NotificationRequestStats. + + + :param errors: The errors of this NotificationRequestStats. # noqa: E501 + :type: dict(str, object) + """ + + self._errors = errors + + @property + def sent(self): + """Gets the sent of this NotificationRequestStats. # noqa: E501 + + + :return: The sent of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, AtomicInteger) + """ + return self._sent + + @sent.setter + def sent(self, sent): + """Sets the sent of this NotificationRequestStats. + + + :param sent: The sent of this NotificationRequestStats. # noqa: E501 + :type: dict(str, AtomicInteger) + """ + + self._sent = sent + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestStats, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestStats): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_rule.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule.py new file mode 100644 index 0000000..b91b456 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule.py @@ -0,0 +1,343 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRuleConfig', + 'created_time': 'int', + 'id': 'NotificationRuleId', + 'name': 'str', + 'recipients_config': 'NotificationRuleRecipientsConfig', + 'template_id': 'NotificationTemplateId', + 'tenant_id': 'TenantId', + 'trigger_config': 'NotificationRuleTriggerConfig', + 'trigger_type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'recipients_config': 'recipientsConfig', + 'template_id': 'templateId', + 'tenant_id': 'tenantId', + 'trigger_config': 'triggerConfig', + 'trigger_type': 'triggerType' + } + + def __init__(self, additional_config=None, created_time=None, id=None, name=None, recipients_config=None, template_id=None, tenant_id=None, trigger_config=None, trigger_type=None): # noqa: E501 + """NotificationRule - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._name = None + self._recipients_config = None + self._template_id = None + self._tenant_id = None + self._trigger_config = None + self._trigger_type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + self.name = name + self.recipients_config = recipients_config + self.template_id = template_id + if tenant_id is not None: + self.tenant_id = tenant_id + self.trigger_config = trigger_config + self.trigger_type = trigger_type + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRule. # noqa: E501 + + + :return: The additional_config of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRule. + + + :param additional_config: The additional_config of this NotificationRule. # noqa: E501 + :type: NotificationRuleConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRule. # noqa: E501 + + + :return: The created_time of this NotificationRule. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRule. + + + :param created_time: The created_time of this NotificationRule. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationRule. # noqa: E501 + + + :return: The id of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRule. + + + :param id: The id of this NotificationRule. # noqa: E501 + :type: NotificationRuleId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationRule. # noqa: E501 + + + :return: The name of this NotificationRule. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationRule. + + + :param name: The name of this NotificationRule. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def recipients_config(self): + """Gets the recipients_config of this NotificationRule. # noqa: E501 + + + :return: The recipients_config of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleRecipientsConfig + """ + return self._recipients_config + + @recipients_config.setter + def recipients_config(self, recipients_config): + """Sets the recipients_config of this NotificationRule. + + + :param recipients_config: The recipients_config of this NotificationRule. # noqa: E501 + :type: NotificationRuleRecipientsConfig + """ + if recipients_config is None: + raise ValueError("Invalid value for `recipients_config`, must not be `None`") # noqa: E501 + + self._recipients_config = recipients_config + + @property + def template_id(self): + """Gets the template_id of this NotificationRule. # noqa: E501 + + + :return: The template_id of this NotificationRule. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRule. + + + :param template_id: The template_id of this NotificationRule. # noqa: E501 + :type: NotificationTemplateId + """ + if template_id is None: + raise ValueError("Invalid value for `template_id`, must not be `None`") # noqa: E501 + + self._template_id = template_id + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRule. # noqa: E501 + + + :return: The tenant_id of this NotificationRule. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRule. + + + :param tenant_id: The tenant_id of this NotificationRule. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def trigger_config(self): + """Gets the trigger_config of this NotificationRule. # noqa: E501 + + + :return: The trigger_config of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleTriggerConfig + """ + return self._trigger_config + + @trigger_config.setter + def trigger_config(self, trigger_config): + """Sets the trigger_config of this NotificationRule. + + + :param trigger_config: The trigger_config of this NotificationRule. # noqa: E501 + :type: NotificationRuleTriggerConfig + """ + if trigger_config is None: + raise ValueError("Invalid value for `trigger_config`, must not be `None`") # noqa: E501 + + self._trigger_config = trigger_config + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRule. # noqa: E501 + + + :return: The trigger_type of this NotificationRule. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRule. + + + :param trigger_type: The trigger_type of this NotificationRule. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_config.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_config.py new file mode 100644 index 0000000..d7082f0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str' + } + + attribute_map = { + 'description': 'description' + } + + def __init__(self, description=None): # noqa: E501 + """NotificationRuleConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self.discriminator = None + if description is not None: + self.description = description + + @property + def description(self): + """Gets the description of this NotificationRuleConfig. # noqa: E501 + + + :return: The description of this NotificationRuleConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this NotificationRuleConfig. + + + :param description: The description of this NotificationRuleConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_id.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_id.py new file mode 100644 index 0000000..0612cd7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRuleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRuleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRuleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRuleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRuleId. # noqa: E501 + + + :return: The entity_type of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRuleId. + + + :param entity_type: The entity_type of this NotificationRuleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_info.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_info.py new file mode 100644 index 0000000..19a5141 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_info.py @@ -0,0 +1,402 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRuleConfig', + 'created_time': 'int', + 'delivery_methods': 'list[str]', + 'id': 'NotificationRuleId', + 'name': 'str', + 'recipients_config': 'NotificationRuleRecipientsConfig', + 'template_id': 'NotificationTemplateId', + 'template_name': 'str', + 'tenant_id': 'TenantId', + 'trigger_config': 'NotificationRuleTriggerConfig', + 'trigger_type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'delivery_methods': 'deliveryMethods', + 'id': 'id', + 'name': 'name', + 'recipients_config': 'recipientsConfig', + 'template_id': 'templateId', + 'template_name': 'templateName', + 'tenant_id': 'tenantId', + 'trigger_config': 'triggerConfig', + 'trigger_type': 'triggerType' + } + + def __init__(self, additional_config=None, created_time=None, delivery_methods=None, id=None, name=None, recipients_config=None, template_id=None, template_name=None, tenant_id=None, trigger_config=None, trigger_type=None): # noqa: E501 + """NotificationRuleInfo - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._delivery_methods = None + self._id = None + self._name = None + self._recipients_config = None + self._template_id = None + self._template_name = None + self._tenant_id = None + self._trigger_config = None + self._trigger_type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if delivery_methods is not None: + self.delivery_methods = delivery_methods + if id is not None: + self.id = id + self.name = name + self.recipients_config = recipients_config + self.template_id = template_id + if template_name is not None: + self.template_name = template_name + if tenant_id is not None: + self.tenant_id = tenant_id + self.trigger_config = trigger_config + self.trigger_type = trigger_type + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRuleInfo. # noqa: E501 + + + :return: The additional_config of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRuleInfo. + + + :param additional_config: The additional_config of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRuleInfo. # noqa: E501 + + + :return: The created_time of this NotificationRuleInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRuleInfo. + + + :param created_time: The created_time of this NotificationRuleInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def delivery_methods(self): + """Gets the delivery_methods of this NotificationRuleInfo. # noqa: E501 + + + :return: The delivery_methods of this NotificationRuleInfo. # noqa: E501 + :rtype: list[str] + """ + return self._delivery_methods + + @delivery_methods.setter + def delivery_methods(self, delivery_methods): + """Sets the delivery_methods of this NotificationRuleInfo. + + + :param delivery_methods: The delivery_methods of this NotificationRuleInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["EMAIL", "SLACK", "SMS", "WEB"] # noqa: E501 + if not set(delivery_methods).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `delivery_methods` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(delivery_methods) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._delivery_methods = delivery_methods + + @property + def id(self): + """Gets the id of this NotificationRuleInfo. # noqa: E501 + + + :return: The id of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRuleInfo. + + + :param id: The id of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationRuleInfo. # noqa: E501 + + + :return: The name of this NotificationRuleInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationRuleInfo. + + + :param name: The name of this NotificationRuleInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def recipients_config(self): + """Gets the recipients_config of this NotificationRuleInfo. # noqa: E501 + + + :return: The recipients_config of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleRecipientsConfig + """ + return self._recipients_config + + @recipients_config.setter + def recipients_config(self, recipients_config): + """Sets the recipients_config of this NotificationRuleInfo. + + + :param recipients_config: The recipients_config of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleRecipientsConfig + """ + if recipients_config is None: + raise ValueError("Invalid value for `recipients_config`, must not be `None`") # noqa: E501 + + self._recipients_config = recipients_config + + @property + def template_id(self): + """Gets the template_id of this NotificationRuleInfo. # noqa: E501 + + + :return: The template_id of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRuleInfo. + + + :param template_id: The template_id of this NotificationRuleInfo. # noqa: E501 + :type: NotificationTemplateId + """ + if template_id is None: + raise ValueError("Invalid value for `template_id`, must not be `None`") # noqa: E501 + + self._template_id = template_id + + @property + def template_name(self): + """Gets the template_name of this NotificationRuleInfo. # noqa: E501 + + + :return: The template_name of this NotificationRuleInfo. # noqa: E501 + :rtype: str + """ + return self._template_name + + @template_name.setter + def template_name(self, template_name): + """Sets the template_name of this NotificationRuleInfo. + + + :param template_name: The template_name of this NotificationRuleInfo. # noqa: E501 + :type: str + """ + + self._template_name = template_name + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRuleInfo. # noqa: E501 + + + :return: The tenant_id of this NotificationRuleInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRuleInfo. + + + :param tenant_id: The tenant_id of this NotificationRuleInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def trigger_config(self): + """Gets the trigger_config of this NotificationRuleInfo. # noqa: E501 + + + :return: The trigger_config of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleTriggerConfig + """ + return self._trigger_config + + @trigger_config.setter + def trigger_config(self, trigger_config): + """Sets the trigger_config of this NotificationRuleInfo. + + + :param trigger_config: The trigger_config of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleTriggerConfig + """ + if trigger_config is None: + raise ValueError("Invalid value for `trigger_config`, must not be `None`") # noqa: E501 + + self._trigger_config = trigger_config + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleInfo. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleInfo. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleInfo. + + + :param trigger_type: The trigger_type of this NotificationRuleInfo. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_recipients_config.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_recipients_config.py new file mode 100644 index 0000000..db23aa8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_recipients_config.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_trigger_config.py new file mode 100644 index 0000000..72b6683 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_rule_trigger_config.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str', + 'alarm_severities': 'list[str]', + 'clear_rule': 'bool', + 'notify_on': 'list[str]', + 'alarm_types': 'list[str]' + } + + attribute_map = { + 'trigger_type': 'triggerType', + 'clear_rule': 'clearRule', + 'notify_on': 'notifyOn', + 'alarm_types': 'alarmTypes', + 'alarm_severities': 'alarmSeverities' + } + + def __init__(self, trigger_type=None, clear_rule=None, notify_on=None, alarm_types=None, alarm_severities=None): # noqa: E501 + """NotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self._clear_rule = None + self._notify_on = None + self._alarm_types = None + self._alarm_severities = None + self.clear_rule = clear_rule + self.notify_on = notify_on + self.alarm_types = alarm_types + self.alarm_severities = alarm_severities + self.discriminator = None + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this NotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + @property + def clear_rule(self): + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + self._clear_rule = clear_rule + + @property + def notify_on(self): + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + self._notify_on = notify_on + + @property + def alarm_types(self): + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + self._alarm_types = alarm_types + + @property + def alarm_severities(self): + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + self._alarm_severities = alarm_severities + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_settings.py new file mode 100644 index 0000000..6aa17c4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_settings.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'delivery_methods_configs': 'dict(str, NotificationDeliveryMethodConfig)' + } + + attribute_map = { + 'delivery_methods_configs': 'deliveryMethodsConfigs' + } + + def __init__(self, delivery_methods_configs=None): # noqa: E501 + """NotificationSettings - a model defined in Swagger""" # noqa: E501 + self._delivery_methods_configs = None + self.discriminator = None + self.delivery_methods_configs = delivery_methods_configs + + @property + def delivery_methods_configs(self): + """Gets the delivery_methods_configs of this NotificationSettings. # noqa: E501 + + + :return: The delivery_methods_configs of this NotificationSettings. # noqa: E501 + :rtype: dict(str, NotificationDeliveryMethodConfig) + """ + return self._delivery_methods_configs + + @delivery_methods_configs.setter + def delivery_methods_configs(self, delivery_methods_configs): + """Sets the delivery_methods_configs of this NotificationSettings. + + + :param delivery_methods_configs: The delivery_methods_configs of this NotificationSettings. # noqa: E501 + :type: dict(str, NotificationDeliveryMethodConfig) + """ + if delivery_methods_configs is None: + raise ValueError("Invalid value for `delivery_methods_configs`, must not be `None`") # noqa: E501 + + self._delivery_methods_configs = delivery_methods_configs + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_target.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_target.py new file mode 100644 index 0000000..8b48de4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_target.py @@ -0,0 +1,230 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTarget(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'NotificationTargetConfig', + 'created_time': 'int', + 'id': 'NotificationTargetId', + 'name': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'configuration': 'configuration', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'tenant_id': 'tenantId' + } + + def __init__(self, configuration=None, created_time=None, id=None, name=None, tenant_id=None): # noqa: E501 + """NotificationTarget - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._created_time = None + self._id = None + self._name = None + self._tenant_id = None + self.discriminator = None + self.configuration = configuration + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + self.name = name + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def configuration(self): + """Gets the configuration of this NotificationTarget. # noqa: E501 + + + :return: The configuration of this NotificationTarget. # noqa: E501 + :rtype: NotificationTargetConfig + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this NotificationTarget. + + + :param configuration: The configuration of this NotificationTarget. # noqa: E501 + :type: NotificationTargetConfig + """ + if configuration is None: + raise ValueError("Invalid value for `configuration`, must not be `None`") # noqa: E501 + + self._configuration = configuration + + @property + def created_time(self): + """Gets the created_time of this NotificationTarget. # noqa: E501 + + + :return: The created_time of this NotificationTarget. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationTarget. + + + :param created_time: The created_time of this NotificationTarget. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationTarget. # noqa: E501 + + + :return: The id of this NotificationTarget. # noqa: E501 + :rtype: NotificationTargetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTarget. + + + :param id: The id of this NotificationTarget. # noqa: E501 + :type: NotificationTargetId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationTarget. # noqa: E501 + + + :return: The name of this NotificationTarget. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationTarget. + + + :param name: The name of this NotificationTarget. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationTarget. # noqa: E501 + + + :return: The tenant_id of this NotificationTarget. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationTarget. + + + :param tenant_id: The tenant_id of this NotificationTarget. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTarget, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTarget): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_target_config.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_target_config.py new file mode 100644 index 0000000..f70ac5c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_target_config.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTargetConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'type': 'str', + 'users_filter': 'JsonNode' + } + + attribute_map = { + 'description': 'description', + 'type': 'type', + 'users_filter': 'usersFilter' + } + + def __init__(self, description=None, type=None, users_filter=None): # noqa: E501 + """NotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self._type = None + self._users_filter = None + self.type = type + self.users_filter = users_filter + self.discriminator = None + if description is not None: + self.description = description + + @property + def type(self): + return self._type + + @type.setter + def type(self, type): + self._type = type + + @property + def users_filter(self): + return self._users_filter + + @users_filter.setter + def users_filter(self, users_filter): + self._users_filter = users_filter + + @property + def description(self): + """Gets the description of this NotificationTargetConfig. # noqa: E501 + + + :return: The description of this NotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this NotificationTargetConfig. + + + :param description: The description of this NotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_target_id.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_target_id.py new file mode 100644 index 0000000..805f8a8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_target_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTargetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTargetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTargetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTargetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTargetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTargetId. # noqa: E501 + + + :return: The entity_type of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTargetId. + + + :param entity_type: The entity_type of this NotificationTargetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTargetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTargetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_template.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_template.py new file mode 100644 index 0000000..3710733 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_template.py @@ -0,0 +1,262 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'NotificationTemplateConfig', + 'created_time': 'int', + 'id': 'NotificationTemplateId', + 'name': 'str', + 'notification_type': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'configuration': 'configuration', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'notification_type': 'notificationType', + 'tenant_id': 'tenantId' + } + + def __init__(self, configuration=None, created_time=None, id=None, name=None, notification_type=None, tenant_id=None): # noqa: E501 + """NotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._created_time = None + self._id = None + self._name = None + self._notification_type = None + self._tenant_id = None + self.discriminator = None + self.configuration = configuration + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + self.notification_type = notification_type + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def configuration(self): + """Gets the configuration of this NotificationTemplate. # noqa: E501 + + + :return: The configuration of this NotificationTemplate. # noqa: E501 + :rtype: NotificationTemplateConfig + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this NotificationTemplate. + + + :param configuration: The configuration of this NotificationTemplate. # noqa: E501 + :type: NotificationTemplateConfig + """ + if configuration is None: + raise ValueError("Invalid value for `configuration`, must not be `None`") # noqa: E501 + + self._configuration = configuration + + @property + def created_time(self): + """Gets the created_time of this NotificationTemplate. # noqa: E501 + + + :return: The created_time of this NotificationTemplate. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationTemplate. + + + :param created_time: The created_time of this NotificationTemplate. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationTemplate. # noqa: E501 + + + :return: The id of this NotificationTemplate. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTemplate. + + + :param id: The id of this NotificationTemplate. # noqa: E501 + :type: NotificationTemplateId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationTemplate. # noqa: E501 + + + :return: The name of this NotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationTemplate. + + + :param name: The name of this NotificationTemplate. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def notification_type(self): + """Gets the notification_type of this NotificationTemplate. # noqa: E501 + + + :return: The notification_type of this NotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._notification_type + + @notification_type.setter + def notification_type(self, notification_type): + """Sets the notification_type of this NotificationTemplate. + + + :param notification_type: The notification_type of this NotificationTemplate. # noqa: E501 + :type: str + """ + if notification_type is None: + raise ValueError("Invalid value for `notification_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "GENERAL", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT", "RULE_NODE"] # noqa: E501 + if notification_type not in allowed_values: + raise ValueError( + "Invalid value for `notification_type` ({0}), must be one of {1}" # noqa: E501 + .format(notification_type, allowed_values) + ) + + self._notification_type = notification_type + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationTemplate. # noqa: E501 + + + :return: The tenant_id of this NotificationTemplate. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationTemplate. + + + :param tenant_id: The tenant_id of this NotificationTemplate. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_template_config.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_template_config.py new file mode 100644 index 0000000..52e8e4b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_template_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'delivery_methods_templates': 'dict(str, DeliveryMethodNotificationTemplate)' + } + + attribute_map = { + 'delivery_methods_templates': 'deliveryMethodsTemplates' + } + + def __init__(self, delivery_methods_templates=None): # noqa: E501 + """NotificationTemplateConfig - a model defined in Swagger""" # noqa: E501 + self._delivery_methods_templates = None + self.discriminator = None + if delivery_methods_templates is not None: + self.delivery_methods_templates = delivery_methods_templates + + @property + def delivery_methods_templates(self): + """Gets the delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + + + :return: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._delivery_methods_templates + + @delivery_methods_templates.setter + def delivery_methods_templates(self, delivery_methods_templates): + """Sets the delivery_methods_templates of this NotificationTemplateConfig. + + + :param delivery_methods_templates: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._delivery_methods_templates = delivery_methods_templates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/notification_template_id.py b/billinglayer/python/tb_rest_client/models/models_ce/notification_template_id.py new file mode 100644 index 0000000..27da460 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/notification_template_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTemplateId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTemplateId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTemplateId. # noqa: E501 + + + :return: The entity_type of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTemplateId. + + + :param entity_type: The entity_type of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/numeric_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_ce/numeric_filter_predicate.py new file mode 100644 index 0000000..de37a37 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/numeric_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class NumericFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValuedouble' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """NumericFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this NumericFilterPredicate. # noqa: E501 + + + :return: The operation of this NumericFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this NumericFilterPredicate. + + + :param operation: The operation of this NumericFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "GREATER", "GREATER_OR_EQUAL", "LESS", "LESS_OR_EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this NumericFilterPredicate. # noqa: E501 + + + :return: The value of this NumericFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuedouble + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this NumericFilterPredicate. + + + :param value: The value of this NumericFilterPredicate. # noqa: E501 + :type: FilterPredicateValuedouble + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NumericFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NumericFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_basic_mapper_config.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_basic_mapper_config.py new file mode 100644 index 0000000..d3ad203 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_basic_mapper_config.py @@ -0,0 +1,329 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2BasicMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'always_full_screen': 'bool', + 'customer_name_pattern': 'str', + 'default_dashboard_name': 'str', + 'email_attribute_key': 'str', + 'first_name_attribute_key': 'str', + 'last_name_attribute_key': 'str', + 'tenant_name_pattern': 'str', + 'tenant_name_strategy': 'str' + } + + attribute_map = { + 'always_full_screen': 'alwaysFullScreen', + 'customer_name_pattern': 'customerNamePattern', + 'default_dashboard_name': 'defaultDashboardName', + 'email_attribute_key': 'emailAttributeKey', + 'first_name_attribute_key': 'firstNameAttributeKey', + 'last_name_attribute_key': 'lastNameAttributeKey', + 'tenant_name_pattern': 'tenantNamePattern', + 'tenant_name_strategy': 'tenantNameStrategy' + } + + def __init__(self, always_full_screen=None, customer_name_pattern=None, default_dashboard_name=None, email_attribute_key=None, first_name_attribute_key=None, last_name_attribute_key=None, tenant_name_pattern=None, tenant_name_strategy=None): # noqa: E501 + """OAuth2BasicMapperConfig - a model defined in Swagger""" # noqa: E501 + self._always_full_screen = None + self._customer_name_pattern = None + self._default_dashboard_name = None + self._email_attribute_key = None + self._first_name_attribute_key = None + self._last_name_attribute_key = None + self._tenant_name_pattern = None + self._tenant_name_strategy = None + self.discriminator = None + if always_full_screen is not None: + self.always_full_screen = always_full_screen + if customer_name_pattern is not None: + self.customer_name_pattern = customer_name_pattern + if default_dashboard_name is not None: + self.default_dashboard_name = default_dashboard_name + if email_attribute_key is not None: + self.email_attribute_key = email_attribute_key + if first_name_attribute_key is not None: + self.first_name_attribute_key = first_name_attribute_key + if last_name_attribute_key is not None: + self.last_name_attribute_key = last_name_attribute_key + if tenant_name_pattern is not None: + self.tenant_name_pattern = tenant_name_pattern + self.tenant_name_strategy = tenant_name_strategy + + @property + def always_full_screen(self): + """Gets the always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + + Whether default dashboard should be open in full screen # noqa: E501 + + :return: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._always_full_screen + + @always_full_screen.setter + def always_full_screen(self, always_full_screen): + """Sets the always_full_screen of this OAuth2BasicMapperConfig. + + Whether default dashboard should be open in full screen # noqa: E501 + + :param always_full_screen: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :type: bool + """ + + self._always_full_screen = always_full_screen + + @property + def customer_name_pattern(self): + """Gets the customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :return: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._customer_name_pattern + + @customer_name_pattern.setter + def customer_name_pattern(self, customer_name_pattern): + """Sets the customer_name_pattern of this OAuth2BasicMapperConfig. + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :param customer_name_pattern: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._customer_name_pattern = customer_name_pattern + + @property + def default_dashboard_name(self): + """Gets the default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :return: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._default_dashboard_name + + @default_dashboard_name.setter + def default_dashboard_name(self, default_dashboard_name): + """Sets the default_dashboard_name of this OAuth2BasicMapperConfig. + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :param default_dashboard_name: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._default_dashboard_name = default_dashboard_name + + @property + def email_attribute_key(self): + """Gets the email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :return: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._email_attribute_key + + @email_attribute_key.setter + def email_attribute_key(self, email_attribute_key): + """Sets the email_attribute_key of this OAuth2BasicMapperConfig. + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :param email_attribute_key: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._email_attribute_key = email_attribute_key + + @property + def first_name_attribute_key(self): + """Gets the first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + First name attribute key # noqa: E501 + + :return: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._first_name_attribute_key + + @first_name_attribute_key.setter + def first_name_attribute_key(self, first_name_attribute_key): + """Sets the first_name_attribute_key of this OAuth2BasicMapperConfig. + + First name attribute key # noqa: E501 + + :param first_name_attribute_key: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._first_name_attribute_key = first_name_attribute_key + + @property + def last_name_attribute_key(self): + """Gets the last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Last name attribute key # noqa: E501 + + :return: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._last_name_attribute_key + + @last_name_attribute_key.setter + def last_name_attribute_key(self, last_name_attribute_key): + """Sets the last_name_attribute_key of this OAuth2BasicMapperConfig. + + Last name attribute key # noqa: E501 + + :param last_name_attribute_key: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._last_name_attribute_key = last_name_attribute_key + + @property + def tenant_name_pattern(self): + """Gets the tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :return: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_pattern + + @tenant_name_pattern.setter + def tenant_name_pattern(self, tenant_name_pattern): + """Sets the tenant_name_pattern of this OAuth2BasicMapperConfig. + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :param tenant_name_pattern: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._tenant_name_pattern = tenant_name_pattern + + @property + def tenant_name_strategy(self): + """Gets the tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :return: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_strategy + + @tenant_name_strategy.setter + def tenant_name_strategy(self, tenant_name_strategy): + """Sets the tenant_name_strategy of this OAuth2BasicMapperConfig. + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :param tenant_name_strategy: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + if tenant_name_strategy is None: + raise ValueError("Invalid value for `tenant_name_strategy`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOM", "DOMAIN", "EMAIL"] # noqa: E501 + if tenant_name_strategy not in allowed_values: + raise ValueError( + "Invalid value for `tenant_name_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(tenant_name_strategy, allowed_values) + ) + + self._tenant_name_strategy = tenant_name_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2BasicMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2BasicMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_info.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_info.py new file mode 100644 index 0000000..a80f96b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'icon': 'str', + 'name': 'str', + 'url': 'str' + } + + attribute_map = { + 'icon': 'icon', + 'name': 'name', + 'url': 'url' + } + + def __init__(self, icon=None, name=None, url=None): # noqa: E501 + """OAuth2ClientInfo - a model defined in Swagger""" # noqa: E501 + self._icon = None + self._name = None + self._url = None + self.discriminator = None + if icon is not None: + self.icon = icon + if name is not None: + self.name = name + if url is not None: + self.url = url + + @property + def icon(self): + """Gets the icon of this OAuth2ClientInfo. # noqa: E501 + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :return: The icon of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._icon + + @icon.setter + def icon(self, icon): + """Sets the icon of this OAuth2ClientInfo. + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :param icon: The icon of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._icon = icon + + @property + def name(self): + """Gets the name of this OAuth2ClientInfo. # noqa: E501 + + OAuth2 client name # noqa: E501 + + :return: The name of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientInfo. + + OAuth2 client name # noqa: E501 + + :param name: The name of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def url(self): + """Gets the url of this OAuth2ClientInfo. # noqa: E501 + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :return: The url of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2ClientInfo. + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :param url: The url of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template.py new file mode 100644 index 0000000..ca355f7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template.py @@ -0,0 +1,565 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'comment': 'str', + 'created_time': 'int', + 'help_link': 'str', + 'id': 'OAuth2ClientRegistrationTemplateId', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'name': 'str', + 'provider_id': 'str', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'comment': 'comment', + 'created_time': 'createdTime', + 'help_link': 'helpLink', + 'id': 'id', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'name': 'name', + 'provider_id': 'providerId', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, comment=None, created_time=None, help_link=None, id=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, name=None, provider_id=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2ClientRegistrationTemplate - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._comment = None + self._created_time = None + self._help_link = None + self._id = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._name = None + self._provider_id = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + if access_token_uri is not None: + self.access_token_uri = access_token_uri + if additional_info is not None: + self.additional_info = additional_info + if authorization_uri is not None: + self.authorization_uri = authorization_uri + if client_authentication_method is not None: + self.client_authentication_method = client_authentication_method + if comment is not None: + self.comment = comment + if created_time is not None: + self.created_time = created_time + if help_link is not None: + self.help_link = help_link + if id is not None: + self.id = id + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + if login_button_label is not None: + self.login_button_label = login_button_label + if mapper_config is not None: + self.mapper_config = mapper_config + if name is not None: + self.name = name + self.provider_id = provider_id + if scope is not None: + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default access token URI of the OAuth2 provider # noqa: E501 + + :return: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2ClientRegistrationTemplate. + + Default access token URI of the OAuth2 provider # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2ClientRegistrationTemplate. + + + :param additional_info: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :return: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2ClientRegistrationTemplate. + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :return: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2ClientRegistrationTemplate. + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._client_authentication_method = client_authentication_method + + @property + def comment(self): + """Gets the comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Comment for OAuth2 provider # noqa: E501 + + :return: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this OAuth2ClientRegistrationTemplate. + + Comment for OAuth2 provider # noqa: E501 + + :param comment: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._comment = comment + + @property + def created_time(self): + """Gets the created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OAuth2ClientRegistrationTemplate. + + + :param created_time: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def help_link(self): + """Gets the help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Help link for OAuth2 provider # noqa: E501 + + :return: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._help_link + + @help_link.setter + def help_link(self, help_link): + """Sets the help_link of this OAuth2ClientRegistrationTemplate. + + Help link for OAuth2 provider # noqa: E501 + + :param help_link: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._help_link = help_link + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2ClientRegistrationTemplateId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplate. + + + :param id: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2ClientRegistrationTemplateId + """ + + self._id = id + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2ClientRegistrationTemplate. + + Default log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth2 provider label # noqa: E501 + + :return: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2ClientRegistrationTemplate. + + Default OAuth2 provider label # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2ClientRegistrationTemplate. + + + :param mapper_config: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2MapperConfig + """ + + self._mapper_config = mapper_config + + @property + def name(self): + """Gets the name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientRegistrationTemplate. + + + :param name: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def provider_id(self): + """Gets the provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :return: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._provider_id + + @provider_id.setter + def provider_id(self, provider_id): + """Sets the provider_id of this OAuth2ClientRegistrationTemplate. + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :param provider_id: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + if provider_id is None: + raise ValueError("Invalid value for `provider_id`, must not be `None`") # noqa: E501 + + self._provider_id = provider_id + + @property + def scope(self): + """Gets the scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :return: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2ClientRegistrationTemplate. + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :param scope: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: list[str] + """ + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default user info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2ClientRegistrationTemplate. + + Default user info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template_id.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template_id.py new file mode 100644 index 0000000..6b3b175 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """OAuth2ClientRegistrationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplateId. + + string # noqa: E501 + + :param id: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_custom_mapper_config.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_custom_mapper_config.py new file mode 100644 index 0000000..220b530 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_custom_mapper_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2CustomMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password': 'str', + 'send_token': 'bool', + 'url': 'str', + 'username': 'str' + } + + attribute_map = { + 'password': 'password', + 'send_token': 'sendToken', + 'url': 'url', + 'username': 'username' + } + + def __init__(self, password=None, send_token=None, url=None, username=None): # noqa: E501 + """OAuth2CustomMapperConfig - a model defined in Swagger""" # noqa: E501 + self._password = None + self._send_token = None + self._url = None + self._username = None + self.discriminator = None + if password is not None: + self.password = password + if send_token is not None: + self.send_token = send_token + if url is not None: + self.url = url + if username is not None: + self.username = username + + @property + def password(self): + """Gets the password of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this OAuth2CustomMapperConfig. + + + :param password: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def send_token(self): + """Gets the send_token of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._send_token + + @send_token.setter + def send_token(self, send_token): + """Sets the send_token of this OAuth2CustomMapperConfig. + + + :param send_token: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :type: bool + """ + + self._send_token = send_token + + @property + def url(self): + """Gets the url of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2CustomMapperConfig. + + + :param url: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def username(self): + """Gets the username of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this OAuth2CustomMapperConfig. + + + :param username: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2CustomMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2CustomMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_domain_info.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_domain_info.py new file mode 100644 index 0000000..2a293c6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_domain_info.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2DomainInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'scheme': 'str' + } + + attribute_map = { + 'name': 'name', + 'scheme': 'scheme' + } + + def __init__(self, name=None, scheme=None): # noqa: E501 + """OAuth2DomainInfo - a model defined in Swagger""" # noqa: E501 + self._name = None + self._scheme = None + self.discriminator = None + self.name = name + self.scheme = scheme + + @property + def name(self): + """Gets the name of this OAuth2DomainInfo. # noqa: E501 + + Domain name. Cannot be empty # noqa: E501 + + :return: The name of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2DomainInfo. + + Domain name. Cannot be empty # noqa: E501 + + :param name: The name of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def scheme(self): + """Gets the scheme of this OAuth2DomainInfo. # noqa: E501 + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :return: The scheme of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._scheme + + @scheme.setter + def scheme(self, scheme): + """Sets the scheme of this OAuth2DomainInfo. + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :param scheme: The scheme of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if scheme is None: + raise ValueError("Invalid value for `scheme`, must not be `None`") # noqa: E501 + allowed_values = ["HTTP", "HTTPS", "MIXED"] # noqa: E501 + if scheme not in allowed_values: + raise ValueError( + "Invalid value for `scheme` ({0}), must be one of {1}" # noqa: E501 + .format(scheme, allowed_values) + ) + + self._scheme = scheme + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2DomainInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2DomainInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_info.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_info.py new file mode 100644 index 0000000..b34609a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_info.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2Info(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'enabled': 'bool', + 'oauth2_params_infos': 'list[OAuth2ParamsInfo]' + } + + attribute_map = { + 'enabled': 'enabled', + 'oauth2_params_infos': 'oauth2ParamsInfos' + } + + def __init__(self, enabled=None, oauth2_params_infos=None): # noqa: E501 + """OAuth2Info - a model defined in Swagger""" # noqa: E501 + self._enabled = None + self._oauth2_params_infos = None + self.discriminator = None + if enabled is not None: + self.enabled = enabled + self.oauth2_params_infos = oauth2_params_infos + + @property + def enabled(self): + """Gets the enabled of this OAuth2Info. # noqa: E501 + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :return: The enabled of this OAuth2Info. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this OAuth2Info. + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :param enabled: The enabled of this OAuth2Info. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def oauth2_params_infos(self): + """Gets the oauth2_params_infos of this OAuth2Info. # noqa: E501 + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :return: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :rtype: list[OAuth2ParamsInfo] + """ + return self._oauth2_params_infos + + @oauth2_params_infos.setter + def oauth2_params_infos(self, oauth2_params_infos): + """Sets the oauth2_params_infos of this OAuth2Info. + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :param oauth2_params_infos: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :type: list[OAuth2ParamsInfo] + """ + if oauth2_params_infos is None: + raise ValueError("Invalid value for `oauth2_params_infos`, must not be `None`") # noqa: E501 + + self._oauth2_params_infos = oauth2_params_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2Info, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2Info): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_mapper_config.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_mapper_config.py new file mode 100644 index 0000000..85009ce --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_mapper_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_user': 'bool', + 'allow_user_creation': 'bool', + 'basic': 'OAuth2BasicMapperConfig', + 'custom': 'OAuth2CustomMapperConfig', + 'type': 'str' + } + + attribute_map = { + 'activate_user': 'activateUser', + 'allow_user_creation': 'allowUserCreation', + 'basic': 'basic', + 'custom': 'custom', + 'type': 'type' + } + + def __init__(self, activate_user=None, allow_user_creation=None, basic=None, custom=None, type=None): # noqa: E501 + """OAuth2MapperConfig - a model defined in Swagger""" # noqa: E501 + self._activate_user = None + self._allow_user_creation = None + self._basic = None + self._custom = None + self._type = None + self.discriminator = None + if activate_user is not None: + self.activate_user = activate_user + if allow_user_creation is not None: + self.allow_user_creation = allow_user_creation + if basic is not None: + self.basic = basic + if custom is not None: + self.custom = custom + self.type = type + + @property + def activate_user(self): + """Gets the activate_user of this OAuth2MapperConfig. # noqa: E501 + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :return: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._activate_user + + @activate_user.setter + def activate_user(self, activate_user): + """Sets the activate_user of this OAuth2MapperConfig. + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :param activate_user: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._activate_user = activate_user + + @property + def allow_user_creation(self): + """Gets the allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :return: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._allow_user_creation + + @allow_user_creation.setter + def allow_user_creation(self, allow_user_creation): + """Sets the allow_user_creation of this OAuth2MapperConfig. + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :param allow_user_creation: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._allow_user_creation = allow_user_creation + + @property + def basic(self): + """Gets the basic of this OAuth2MapperConfig. # noqa: E501 + + + :return: The basic of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2BasicMapperConfig + """ + return self._basic + + @basic.setter + def basic(self, basic): + """Sets the basic of this OAuth2MapperConfig. + + + :param basic: The basic of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2BasicMapperConfig + """ + + self._basic = basic + + @property + def custom(self): + """Gets the custom of this OAuth2MapperConfig. # noqa: E501 + + + :return: The custom of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2CustomMapperConfig + """ + return self._custom + + @custom.setter + def custom(self, custom): + """Sets the custom of this OAuth2MapperConfig. + + + :param custom: The custom of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2CustomMapperConfig + """ + + self._custom = custom + + @property + def type(self): + """Gets the type of this OAuth2MapperConfig. # noqa: E501 + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :return: The type of this OAuth2MapperConfig. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OAuth2MapperConfig. + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :param type: The type of this OAuth2MapperConfig. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APPLE", "BASIC", "CUSTOM", "GITHUB"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_mobile_info.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_mobile_info.py new file mode 100644 index 0000000..6795891 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_mobile_info.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MobileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'app_secret': 'str', + 'pkg_name': 'str' + } + + attribute_map = { + 'app_secret': 'appSecret', + 'pkg_name': 'pkgName' + } + + def __init__(self, app_secret=None, pkg_name=None): # noqa: E501 + """OAuth2MobileInfo - a model defined in Swagger""" # noqa: E501 + self._app_secret = None + self._pkg_name = None + self.discriminator = None + self.app_secret = app_secret + self.pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this OAuth2MobileInfo. # noqa: E501 + + Application secret. The length must be at least 16 characters # noqa: E501 + + :return: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this OAuth2MobileInfo. + + Application secret. The length must be at least 16 characters # noqa: E501 + + :param app_secret: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if app_secret is None: + raise ValueError("Invalid value for `app_secret`, must not be `None`") # noqa: E501 + + self._app_secret = app_secret + + @property + def pkg_name(self): + """Gets the pkg_name of this OAuth2MobileInfo. # noqa: E501 + + Application package name. Cannot be empty # noqa: E501 + + :return: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this OAuth2MobileInfo. + + Application package name. Cannot be empty # noqa: E501 + + :param pkg_name: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if pkg_name is None: + raise ValueError("Invalid value for `pkg_name`, must not be `None`") # noqa: E501 + + self._pkg_name = pkg_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MobileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MobileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_params_info.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_params_info.py new file mode 100644 index 0000000..d387e83 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_params_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ParamsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_registrations': 'list[OAuth2RegistrationInfo]', + 'domain_infos': 'list[OAuth2DomainInfo]', + 'mobile_infos': 'list[OAuth2MobileInfo]' + } + + attribute_map = { + 'client_registrations': 'clientRegistrations', + 'domain_infos': 'domainInfos', + 'mobile_infos': 'mobileInfos' + } + + def __init__(self, client_registrations=None, domain_infos=None, mobile_infos=None): # noqa: E501 + """OAuth2ParamsInfo - a model defined in Swagger""" # noqa: E501 + self._client_registrations = None + self._domain_infos = None + self._mobile_infos = None + self.discriminator = None + self.client_registrations = client_registrations + self.domain_infos = domain_infos + self.mobile_infos = mobile_infos + + @property + def client_registrations(self): + """Gets the client_registrations of this OAuth2ParamsInfo. # noqa: E501 + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :return: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2RegistrationInfo] + """ + return self._client_registrations + + @client_registrations.setter + def client_registrations(self, client_registrations): + """Sets the client_registrations of this OAuth2ParamsInfo. + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :param client_registrations: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2RegistrationInfo] + """ + if client_registrations is None: + raise ValueError("Invalid value for `client_registrations`, must not be `None`") # noqa: E501 + + self._client_registrations = client_registrations + + @property + def domain_infos(self): + """Gets the domain_infos of this OAuth2ParamsInfo. # noqa: E501 + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :return: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2DomainInfo] + """ + return self._domain_infos + + @domain_infos.setter + def domain_infos(self, domain_infos): + """Sets the domain_infos of this OAuth2ParamsInfo. + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :param domain_infos: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2DomainInfo] + """ + if domain_infos is None: + raise ValueError("Invalid value for `domain_infos`, must not be `None`") # noqa: E501 + + self._domain_infos = domain_infos + + @property + def mobile_infos(self): + """Gets the mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :return: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2MobileInfo] + """ + return self._mobile_infos + + @mobile_infos.setter + def mobile_infos(self, mobile_infos): + """Sets the mobile_infos of this OAuth2ParamsInfo. + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :param mobile_infos: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2MobileInfo] + """ + if mobile_infos is None: + raise ValueError("Invalid value for `mobile_infos`, must not be `None`") # noqa: E501 + + self._mobile_infos = mobile_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ParamsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ParamsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_registration_info.py b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_registration_info.py new file mode 100644 index 0000000..2c75e54 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/o_auth2_registration_info.py @@ -0,0 +1,502 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2RegistrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'client_id': 'str', + 'client_secret': 'str', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'platforms': 'list[str]', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'client_id': 'clientId', + 'client_secret': 'clientSecret', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'platforms': 'platforms', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, client_id=None, client_secret=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, platforms=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2RegistrationInfo - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._client_id = None + self._client_secret = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._platforms = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + self.access_token_uri = access_token_uri + self.additional_info = additional_info + self.authorization_uri = authorization_uri + self.client_authentication_method = client_authentication_method + self.client_id = client_id + self.client_secret = client_secret + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + self.login_button_label = login_button_label + self.mapper_config = mapper_config + if platforms is not None: + self.platforms = platforms + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2RegistrationInfo. + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if access_token_uri is None: + raise ValueError("Invalid value for `access_token_uri`, must not be `None`") # noqa: E501 + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2RegistrationInfo. + + + :param additional_info: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2RegistrationInfo. + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if authorization_uri is None: + raise ValueError("Invalid value for `authorization_uri`, must not be `None`") # noqa: E501 + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :return: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2RegistrationInfo. + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_authentication_method is None: + raise ValueError("Invalid value for `client_authentication_method`, must not be `None`") # noqa: E501 + + self._client_authentication_method = client_authentication_method + + @property + def client_id(self): + """Gets the client_id of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :return: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_id + + @client_id.setter + def client_id(self, client_id): + """Sets the client_id of this OAuth2RegistrationInfo. + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :param client_id: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_id is None: + raise ValueError("Invalid value for `client_id`, must not be `None`") # noqa: E501 + + self._client_id = client_id + + @property + def client_secret(self): + """Gets the client_secret of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :return: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_secret + + @client_secret.setter + def client_secret(self, client_secret): + """Sets the client_secret of this OAuth2RegistrationInfo. + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :param client_secret: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_secret is None: + raise ValueError("Invalid value for `client_secret`, must not be `None`") # noqa: E501 + + self._client_secret = client_secret + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2RegistrationInfo. + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + + Log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2RegistrationInfo. + + Log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :return: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2RegistrationInfo. + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if login_button_label is None: + raise ValueError("Invalid value for `login_button_label`, must not be `None`") # noqa: E501 + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2RegistrationInfo. + + + :param mapper_config: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :type: OAuth2MapperConfig + """ + if mapper_config is None: + raise ValueError("Invalid value for `mapper_config`, must not be `None`") # noqa: E501 + + self._mapper_config = mapper_config + + @property + def platforms(self): + """Gets the platforms of this OAuth2RegistrationInfo. # noqa: E501 + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :return: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._platforms + + @platforms.setter + def platforms(self, platforms): + """Sets the platforms of this OAuth2RegistrationInfo. + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :param platforms: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ANDROID", "IOS", "WEB"] # noqa: E501 + if not set(platforms).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `platforms` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(platforms) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._platforms = platforms + + @property + def scope(self): + """Gets the scope of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :return: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2RegistrationInfo. + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :param scope: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + if scope is None: + raise ValueError("Invalid value for `scope`, must not be `None`") # noqa: E501 + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + + User info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2RegistrationInfo. + + User info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2RegistrationInfo. + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2RegistrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2RegistrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/object_attributes.py b/billinglayer/python/tb_rest_client/models/models_ce/object_attributes.py new file mode 100644 index 0000000..11802ef --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/object_attributes.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectAttributes(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dim': 'int', + 'gt': 'float', + 'lt': 'float', + 'pmax': 'int', + 'pmin': 'int', + 'st': 'float', + 'ver': 'str' + } + + attribute_map = { + 'dim': 'dim', + 'gt': 'gt', + 'lt': 'lt', + 'pmax': 'pmax', + 'pmin': 'pmin', + 'st': 'st', + 'ver': 'ver' + } + + def __init__(self, dim=None, gt=None, lt=None, pmax=None, pmin=None, st=None, ver=None): # noqa: E501 + """ObjectAttributes - a model defined in Swagger""" # noqa: E501 + self._dim = None + self._gt = None + self._lt = None + self._pmax = None + self._pmin = None + self._st = None + self._ver = None + self.discriminator = None + if dim is not None: + self.dim = dim + if gt is not None: + self.gt = gt + if lt is not None: + self.lt = lt + if pmax is not None: + self.pmax = pmax + if pmin is not None: + self.pmin = pmin + if st is not None: + self.st = st + if ver is not None: + self.ver = ver + + @property + def dim(self): + """Gets the dim of this ObjectAttributes. # noqa: E501 + + + :return: The dim of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._dim + + @dim.setter + def dim(self, dim): + """Sets the dim of this ObjectAttributes. + + + :param dim: The dim of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._dim = dim + + @property + def gt(self): + """Gets the gt of this ObjectAttributes. # noqa: E501 + + + :return: The gt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._gt + + @gt.setter + def gt(self, gt): + """Sets the gt of this ObjectAttributes. + + + :param gt: The gt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._gt = gt + + @property + def lt(self): + """Gets the lt of this ObjectAttributes. # noqa: E501 + + + :return: The lt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._lt + + @lt.setter + def lt(self, lt): + """Sets the lt of this ObjectAttributes. + + + :param lt: The lt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._lt = lt + + @property + def pmax(self): + """Gets the pmax of this ObjectAttributes. # noqa: E501 + + + :return: The pmax of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmax + + @pmax.setter + def pmax(self, pmax): + """Sets the pmax of this ObjectAttributes. + + + :param pmax: The pmax of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmax = pmax + + @property + def pmin(self): + """Gets the pmin of this ObjectAttributes. # noqa: E501 + + + :return: The pmin of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmin + + @pmin.setter + def pmin(self, pmin): + """Sets the pmin of this ObjectAttributes. + + + :param pmin: The pmin of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmin = pmin + + @property + def st(self): + """Gets the st of this ObjectAttributes. # noqa: E501 + + + :return: The st of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._st + + @st.setter + def st(self, st): + """Sets the st of this ObjectAttributes. + + + :param st: The st of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._st = st + + @property + def ver(self): + """Gets the ver of this ObjectAttributes. # noqa: E501 + + + :return: The ver of this ObjectAttributes. # noqa: E501 + :rtype: str + """ + return self._ver + + @ver.setter + def ver(self, ver): + """Sets the ver of this ObjectAttributes. + + + :param ver: The ver of this ObjectAttributes. # noqa: E501 + :type: str + """ + + self._ver = ver + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectAttributes, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectAttributes): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/object_node.py b/billinglayer/python/tb_rest_client/models/models_ce/object_node.py new file mode 100644 index 0000000..97116b3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/object_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """ObjectNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/originator_entity_owner_users_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/originator_entity_owner_users_filter.py new file mode 100644 index 0000000..68a6a08 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/originator_entity_owner_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OriginatorEntityOwnerUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OriginatorEntityOwnerUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OriginatorEntityOwnerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OriginatorEntityOwnerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/ota_package.py b/billinglayer/python/tb_rest_client/models/models_ce/ota_package.py new file mode 100644 index 0000000..c5d0680 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/ota_package.py @@ -0,0 +1,576 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'data': 'ByteBuffer', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'data': 'data', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, data=None, additional_info=None): # noqa: E501 + """OtaPackage - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._data = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if data is not None: + self.data = data + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackage. # noqa: E501 + + + :return: The id of this OtaPackage. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackage. + + + :param id: The id of this OtaPackage. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackage. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackage. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackage. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackage. # noqa: E501 + + + :return: The tenant_id of this OtaPackage. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackage. + + + :param tenant_id: The tenant_id of this OtaPackage. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackage. # noqa: E501 + + + :return: The device_profile_id of this OtaPackage. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackage. + + + :param device_profile_id: The device_profile_id of this OtaPackage. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackage. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackage. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackage. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackage. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackage. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackage. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackage. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackage. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackage. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackage. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackage. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackage. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackage. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackage. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackage. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackage. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackage. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackage. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackage. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackage. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackage. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackage. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackage. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackage. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackage. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackage. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackage. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackage. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackage. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackage. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackage. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackage. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def data(self): + """Gets the data of this OtaPackage. # noqa: E501 + + + :return: The data of this OtaPackage. # noqa: E501 + :rtype: ByteBuffer + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OtaPackage. + + + :param data: The data of this OtaPackage. # noqa: E501 + :type: ByteBuffer + """ + + self._data = data + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackage. # noqa: E501 + + + :return: The additional_info of this OtaPackage. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackage. + + + :param additional_info: The additional_info of this OtaPackage. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/ota_package_id.py b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_id.py new file mode 100644 index 0000000..d9cc7a8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """OtaPackageId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this OtaPackageId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this OtaPackageId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this OtaPackageId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this OtaPackageId. + + string # noqa: E501 + + :param entity_type: The entity_type of this OtaPackageId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["OTA_PACKAGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/ota_package_info.py b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_info.py new file mode 100644 index 0000000..767412c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_info.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, additional_info=None): # noqa: E501 + """OtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackageInfo. # noqa: E501 + + + :return: The id of this OtaPackageInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageInfo. + + + :param id: The id of this OtaPackageInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackageInfo. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackageInfo. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackageInfo. # noqa: E501 + + + :return: The tenant_id of this OtaPackageInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackageInfo. + + + :param tenant_id: The tenant_id of this OtaPackageInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackageInfo. # noqa: E501 + + + :return: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackageInfo. + + + :param device_profile_id: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackageInfo. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackageInfo. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackageInfo. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackageInfo. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackageInfo. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackageInfo. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackageInfo. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackageInfo. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackageInfo. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackageInfo. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackageInfo. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackageInfo. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackageInfo. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackageInfo. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackageInfo. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackageInfo. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageInfo. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageInfo. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackageInfo. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackageInfo. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackageInfo. # noqa: E501 + + + :return: The additional_info of this OtaPackageInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackageInfo. + + + :param additional_info: The additional_info of this OtaPackageInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/ota_package_ota_package_id_body.py b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_ota_package_id_body.py new file mode 100644 index 0000000..66a8546 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_ota_package_id_body.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageOtaPackageIdBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'checksum': 'str', + 'checksum_algorithm': 'str', + 'file': 'str' + } + + attribute_map = { + 'checksum': 'checksum', + 'checksum_algorithm': 'checksumAlgorithm', + 'file': 'file' + } + + def __init__(self, checksum=None, checksum_algorithm=None, file=None): # noqa: E501 + """OtaPackageOtaPackageIdBody - a model defined in Swagger""" # noqa: E501 + self._checksum = None + self._checksum_algorithm = None + self._file = None + self.discriminator = None + if checksum is not None: + self.checksum = checksum + self.checksum_algorithm = checksum_algorithm + self.file = file + + @property + def checksum(self): + """Gets the checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :return: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageOtaPackageIdBody. + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :param checksum: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageOtaPackageIdBody. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if checksum_algorithm is None: + raise ValueError("Invalid value for `checksum_algorithm`, must not be `None`") # noqa: E501 + + self._checksum_algorithm = checksum_algorithm + + @property + def file(self): + """Gets the file of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package data. # noqa: E501 + + :return: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this OtaPackageOtaPackageIdBody. + + OTA Package data. # noqa: E501 + + :param file: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if file is None: + raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501 + + self._file = file + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageOtaPackageIdBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageOtaPackageIdBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/ota_package_ota_package_idchecksumchecksum_algorithm_body.py b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_ota_package_idchecksumchecksum_algorithm_body.py new file mode 100644 index 0000000..099b33d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/ota_package_ota_package_idchecksumchecksum_algorithm_body.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'file': 'str' + } + + attribute_map = { + 'file': 'file' + } + + def __init__(self, file=None): # noqa: E501 + """OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody - a model defined in Swagger""" # noqa: E501 + self._file = None + self.discriminator = None + self.file = file + + @property + def file(self): + """Gets the file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. # noqa: E501 + + file # noqa: E501 + + :return: The file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. + + file # noqa: E501 + + :param file: The file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. # noqa: E501 + :type: str + """ + if file is None: + raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501 + + self._file = file + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/other_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/other_configuration.py new file mode 100644 index 0000000..65ed3cc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/other_configuration.py @@ -0,0 +1,338 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtherConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_only_observe_after_connect': 'int', + 'edrx_cycle': 'int', + 'fw_update_resource': 'str', + 'fw_update_strategy': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int', + 'sw_update_resource': 'str', + 'sw_update_strategy': 'int' + } + + attribute_map = { + 'client_only_observe_after_connect': 'clientOnlyObserveAfterConnect', + 'edrx_cycle': 'edrxCycle', + 'fw_update_resource': 'fwUpdateResource', + 'fw_update_strategy': 'fwUpdateStrategy', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer', + 'sw_update_resource': 'swUpdateResource', + 'sw_update_strategy': 'swUpdateStrategy' + } + + def __init__(self, client_only_observe_after_connect=None, edrx_cycle=None, fw_update_resource=None, fw_update_strategy=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, sw_update_resource=None, sw_update_strategy=None): # noqa: E501 + """OtherConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_only_observe_after_connect = None + self._edrx_cycle = None + self._fw_update_resource = None + self._fw_update_strategy = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self._sw_update_resource = None + self._sw_update_strategy = None + self.discriminator = None + if client_only_observe_after_connect is not None: + self.client_only_observe_after_connect = client_only_observe_after_connect + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if fw_update_resource is not None: + self.fw_update_resource = fw_update_resource + if fw_update_strategy is not None: + self.fw_update_strategy = fw_update_strategy + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + if sw_update_resource is not None: + self.sw_update_resource = sw_update_resource + if sw_update_strategy is not None: + self.sw_update_strategy = sw_update_strategy + + @property + def client_only_observe_after_connect(self): + """Gets the client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + + + :return: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._client_only_observe_after_connect + + @client_only_observe_after_connect.setter + def client_only_observe_after_connect(self, client_only_observe_after_connect): + """Sets the client_only_observe_after_connect of this OtherConfiguration. + + + :param client_only_observe_after_connect: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._client_only_observe_after_connect = client_only_observe_after_connect + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this OtherConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this OtherConfiguration. + + + :param edrx_cycle: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def fw_update_resource(self): + """Gets the fw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._fw_update_resource + + @fw_update_resource.setter + def fw_update_resource(self, fw_update_resource): + """Sets the fw_update_resource of this OtherConfiguration. + + + :param fw_update_resource: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._fw_update_resource = fw_update_resource + + @property + def fw_update_strategy(self): + """Gets the fw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._fw_update_strategy + + @fw_update_strategy.setter + def fw_update_strategy(self, fw_update_strategy): + """Sets the fw_update_strategy of this OtherConfiguration. + + + :param fw_update_strategy: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._fw_update_strategy = fw_update_strategy + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this OtherConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this OtherConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this OtherConfiguration. # noqa: E501 + + + :return: The power_mode of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this OtherConfiguration. + + + :param power_mode: The power_mode of this OtherConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this OtherConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this OtherConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + @property + def sw_update_resource(self): + """Gets the sw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._sw_update_resource + + @sw_update_resource.setter + def sw_update_resource(self, sw_update_resource): + """Sets the sw_update_resource of this OtherConfiguration. + + + :param sw_update_resource: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._sw_update_resource = sw_update_resource + + @property + def sw_update_strategy(self): + """Gets the sw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._sw_update_strategy + + @sw_update_strategy.setter + def sw_update_strategy(self, sw_update_strategy): + """Sets the sw_update_strategy of this OtherConfiguration. + + + :param sw_update_strategy: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._sw_update_strategy = sw_update_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtherConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtherConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_comment_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_comment_info.py new file mode 100644 index 0000000..7a9a082 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_comment_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAlarmCommentInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AlarmCommentInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAlarmCommentInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAlarmCommentInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: list[AlarmCommentInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAlarmCommentInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAlarmCommentInfo. # noqa: E501 + :type: list[AlarmCommentInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAlarmCommentInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAlarmCommentInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAlarmCommentInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAlarmCommentInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAlarmCommentInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAlarmCommentInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAlarmCommentInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAlarmCommentInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAlarmCommentInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_data.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_data.py new file mode 100644 index 0000000..f260b5e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_data.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAlarmData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AlarmData]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAlarmData - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAlarmData. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAlarmData. # noqa: E501 + :rtype: list[AlarmData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAlarmData. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAlarmData. # noqa: E501 + :type: list[AlarmData] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAlarmData. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAlarmData. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAlarmData. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAlarmData. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAlarmData. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAlarmData. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAlarmData. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAlarmData. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAlarmData. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAlarmData. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAlarmData. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAlarmData. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAlarmData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAlarmData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_info.py new file mode 100644 index 0000000..ec0cf11 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_alarm_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAlarmInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AlarmInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAlarmInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAlarmInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAlarmInfo. # noqa: E501 + :rtype: list[AlarmInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAlarmInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAlarmInfo. # noqa: E501 + :type: list[AlarmInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAlarmInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAlarmInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAlarmInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAlarmInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAlarmInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAlarmInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAlarmInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAlarmInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAlarmInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAlarmInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAlarmInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAlarmInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAlarmInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset.py new file mode 100644 index 0000000..1bc4968 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAsset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Asset]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAsset - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAsset. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAsset. # noqa: E501 + :rtype: list[Asset] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAsset. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAsset. # noqa: E501 + :type: list[Asset] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAsset. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAsset. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAsset. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAsset. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAsset. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAsset. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAsset. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAsset. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAsset. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAsset. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAsset. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAsset. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAsset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAsset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_info.py new file mode 100644 index 0000000..fedfc92 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAssetInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AssetInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAssetInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAssetInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAssetInfo. # noqa: E501 + :rtype: list[AssetInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAssetInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAssetInfo. # noqa: E501 + :type: list[AssetInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAssetInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAssetInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAssetInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAssetInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAssetInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAssetInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAssetInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAssetInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAssetInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAssetInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAssetInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAssetInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAssetInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAssetInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_profile.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_profile.py new file mode 100644 index 0000000..4a35a92 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_profile.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAssetProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AssetProfile]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAssetProfile - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAssetProfile. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAssetProfile. # noqa: E501 + :rtype: list[AssetProfile] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAssetProfile. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAssetProfile. # noqa: E501 + :type: list[AssetProfile] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAssetProfile. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAssetProfile. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAssetProfile. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAssetProfile. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAssetProfile. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAssetProfile. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAssetProfile. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAssetProfile. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAssetProfile. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAssetProfile. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAssetProfile. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAssetProfile. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAssetProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAssetProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_profile_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_profile_info.py new file mode 100644 index 0000000..8f2b597 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_asset_profile_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAssetProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AssetProfileInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAssetProfileInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAssetProfileInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: list[AssetProfileInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAssetProfileInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAssetProfileInfo. # noqa: E501 + :type: list[AssetProfileInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAssetProfileInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAssetProfileInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAssetProfileInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAssetProfileInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAssetProfileInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAssetProfileInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAssetProfileInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAssetProfileInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAssetProfileInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAssetProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAssetProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_audit_log.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_audit_log.py new file mode 100644 index 0000000..9e9428f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_audit_log.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAuditLog(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AuditLog]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAuditLog - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAuditLog. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAuditLog. # noqa: E501 + :rtype: list[AuditLog] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAuditLog. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAuditLog. # noqa: E501 + :type: list[AuditLog] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAuditLog. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAuditLog. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAuditLog. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAuditLog. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAuditLog. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAuditLog. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAuditLog. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAuditLog. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAuditLog. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAuditLog. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAuditLog. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAuditLog. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAuditLog, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAuditLog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_customer.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_customer.py new file mode 100644 index 0000000..665fa1e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_customer.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataCustomer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Customer]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataCustomer - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataCustomer. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataCustomer. # noqa: E501 + :rtype: list[Customer] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataCustomer. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataCustomer. # noqa: E501 + :type: list[Customer] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataCustomer. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataCustomer. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataCustomer. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataCustomer. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataCustomer. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataCustomer. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataCustomer. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataCustomer. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataCustomer. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataCustomer. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataCustomer. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataCustomer. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataCustomer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataCustomer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_dashboard_info.py new file mode 100644 index 0000000..d435edf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_dashboard_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DashboardInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDashboardInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDashboardInfo. # noqa: E501 + :rtype: list[DashboardInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDashboardInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDashboardInfo. # noqa: E501 + :type: list[DashboardInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDashboardInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDashboardInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDashboardInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDashboardInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDashboardInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDashboardInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDashboardInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDashboardInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDashboardInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_device.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device.py new file mode 100644 index 0000000..30d423c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDevice(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Device]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDevice - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDevice. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDevice. # noqa: E501 + :rtype: list[Device] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDevice. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDevice. # noqa: E501 + :type: list[Device] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDevice. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDevice. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDevice. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDevice. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDevice. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDevice. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDevice. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDevice. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDevice. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDevice. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDevice. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDevice. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDevice, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDevice): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_info.py new file mode 100644 index 0000000..b14eb9e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDeviceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DeviceInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDeviceInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDeviceInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDeviceInfo. # noqa: E501 + :rtype: list[DeviceInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDeviceInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDeviceInfo. # noqa: E501 + :type: list[DeviceInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDeviceInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDeviceInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDeviceInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDeviceInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDeviceInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDeviceInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDeviceInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDeviceInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDeviceInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDeviceInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDeviceInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDeviceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDeviceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_profile.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_profile.py new file mode 100644 index 0000000..581e72c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_profile.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDeviceProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DeviceProfile]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDeviceProfile - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDeviceProfile. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDeviceProfile. # noqa: E501 + :rtype: list[DeviceProfile] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDeviceProfile. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDeviceProfile. # noqa: E501 + :type: list[DeviceProfile] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDeviceProfile. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDeviceProfile. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDeviceProfile. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDeviceProfile. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDeviceProfile. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDeviceProfile. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDeviceProfile. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDeviceProfile. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDeviceProfile. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDeviceProfile. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDeviceProfile. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDeviceProfile. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDeviceProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDeviceProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_profile_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_profile_info.py new file mode 100644 index 0000000..0e47110 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_device_profile_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDeviceProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DeviceProfileInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDeviceProfileInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDeviceProfileInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: list[DeviceProfileInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDeviceProfileInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDeviceProfileInfo. # noqa: E501 + :type: list[DeviceProfileInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDeviceProfileInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDeviceProfileInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDeviceProfileInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDeviceProfileInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDeviceProfileInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDeviceProfileInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDeviceProfileInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDeviceProfileInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDeviceProfileInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDeviceProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDeviceProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge.py new file mode 100644 index 0000000..5260b16 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Edge]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdge - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdge. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdge. # noqa: E501 + :rtype: list[Edge] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdge. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdge. # noqa: E501 + :type: list[Edge] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdge. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdge. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdge. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdge. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdge. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdge. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdge. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdge. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge_event.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge_event.py new file mode 100644 index 0000000..28ff883 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeEvent]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeEvent. # noqa: E501 + :rtype: list[EdgeEvent] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeEvent. # noqa: E501 + :type: list[EdgeEvent] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge_info.py new file mode 100644 index 0000000..bb23017 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_edge_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeInfo. # noqa: E501 + :rtype: list[EdgeInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeInfo. # noqa: E501 + :type: list[EdgeInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_data.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_data.py new file mode 100644 index 0000000..6f37628 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_data.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityData]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityData - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityData. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityData. # noqa: E501 + :rtype: list[EntityData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityData. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityData. # noqa: E501 + :type: list[EntityData] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityData. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityData. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityData. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityData. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityData. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityData. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityData. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityData. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityData. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityData. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityData. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityData. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_info.py new file mode 100644 index 0000000..8345b50 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_version.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_version.py new file mode 100644 index 0000000..7435129 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_version.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityVersion]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityVersion. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityVersion. # noqa: E501 + :rtype: list[EntityVersion] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityVersion. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityVersion. # noqa: E501 + :type: list[EntityVersion] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityVersion. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityVersion. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityVersion. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityVersion. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityVersion. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityVersion. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_view.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_view.py new file mode 100644 index 0000000..bb7e1e1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_view.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityView]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityView - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityView. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityView. # noqa: E501 + :rtype: list[EntityView] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityView. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityView. # noqa: E501 + :type: list[EntityView] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityView. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityView. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityView. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityView. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityView. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityView. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityView. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityView. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityView. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityView. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityView. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityView. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_view_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_view_info.py new file mode 100644 index 0000000..8aa7df9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_entity_view_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityViewInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityViewInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityViewInfo. # noqa: E501 + :rtype: list[EntityViewInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityViewInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityViewInfo. # noqa: E501 + :type: list[EntityViewInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityViewInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityViewInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityViewInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityViewInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityViewInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityViewInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_event.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_event.py new file mode 100644 index 0000000..af664d5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Event]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEvent. # noqa: E501 + :rtype: list[Event] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEvent. # noqa: E501 + :type: list[Event] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_event_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_event_info.py new file mode 100644 index 0000000..70d1dd8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_event_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EventInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEventInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEventInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEventInfo. # noqa: E501 + :rtype: list[EventInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEventInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEventInfo. # noqa: E501 + :type: list[EventInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEventInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEventInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEventInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEventInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEventInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEventInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEventInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEventInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification.py new file mode 100644 index 0000000..2b3c5a5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotification(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Notification]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotification - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotification. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotification. # noqa: E501 + :rtype: list[Notification] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotification. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotification. # noqa: E501 + :type: list[Notification] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotification. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotification. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotification. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotification. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotification. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotification. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotification. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotification. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotification. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotification. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotification. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotification. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotification, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotification): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_request_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_request_info.py new file mode 100644 index 0000000..d227625 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_request_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationRequestInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationRequestInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationRequestInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationRequestInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: list[NotificationRequestInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationRequestInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationRequestInfo. # noqa: E501 + :type: list[NotificationRequestInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationRequestInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationRequestInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationRequestInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationRequestInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationRequestInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationRequestInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationRequestInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationRequestInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationRequestInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationRequestInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationRequestInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_rule_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_rule_info.py new file mode 100644 index 0000000..f2cb24c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_rule_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationRuleInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationRuleInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationRuleInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationRuleInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: list[NotificationRuleInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationRuleInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationRuleInfo. # noqa: E501 + :type: list[NotificationRuleInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationRuleInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationRuleInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationRuleInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationRuleInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationRuleInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationRuleInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationRuleInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationRuleInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationRuleInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationRuleInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationRuleInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_target.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_target.py new file mode 100644 index 0000000..560379f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_target.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationTarget(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationTarget]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationTarget - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationTarget. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationTarget. # noqa: E501 + :rtype: list[NotificationTarget] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationTarget. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationTarget. # noqa: E501 + :type: list[NotificationTarget] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationTarget. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationTarget. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationTarget. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationTarget. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationTarget. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationTarget. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationTarget. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationTarget. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationTarget. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationTarget. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationTarget. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationTarget. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationTarget, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationTarget): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_template.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_template.py new file mode 100644 index 0000000..7df8f62 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_notification_template.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationTemplate]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationTemplate. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationTemplate. # noqa: E501 + :rtype: list[NotificationTemplate] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationTemplate. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationTemplate. # noqa: E501 + :type: list[NotificationTemplate] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationTemplate. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationTemplate. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationTemplate. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationTemplate. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationTemplate. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationTemplate. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationTemplate. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationTemplate. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationTemplate. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationTemplate. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_ota_package_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_ota_package_info.py new file mode 100644 index 0000000..e781dc2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_ota_package_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataOtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[OtaPackageInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataOtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataOtaPackageInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: list[OtaPackageInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataOtaPackageInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataOtaPackageInfo. # noqa: E501 + :type: list[OtaPackageInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataOtaPackageInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataOtaPackageInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataOtaPackageInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataOtaPackageInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataOtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataOtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_queue.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_queue.py new file mode 100644 index 0000000..6930283 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_queue.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataQueue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Queue]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataQueue - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataQueue. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataQueue. # noqa: E501 + :rtype: list[Queue] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataQueue. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataQueue. # noqa: E501 + :type: list[Queue] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataQueue. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataQueue. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataQueue. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataQueue. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataQueue. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataQueue. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataQueue. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataQueue. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataQueue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataQueue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_rpc.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_rpc.py new file mode 100644 index 0000000..b8fd697 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_rpc.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRpc(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Rpc]', + 'has_next': 'bool', + 'total_elements': 'int', + 'total_pages': 'int' + } + + attribute_map = { + 'data': 'data', + 'has_next': 'hasNext', + 'total_elements': 'totalElements', + 'total_pages': 'totalPages' + } + + def __init__(self, data=None, has_next=None, total_elements=None, total_pages=None): # noqa: E501 + """PageDataRpc - a model defined in Swagger""" # noqa: E501 + self._data = None + self._has_next = None + self._total_elements = None + self._total_pages = None + self.discriminator = None + if data is not None: + self.data = data + if has_next is not None: + self.has_next = has_next + if total_elements is not None: + self.total_elements = total_elements + if total_pages is not None: + self.total_pages = total_pages + + @property + def data(self): + """Gets the data of this PageDataRpc. # noqa: E501 + + + :return: The data of this PageDataRpc. # noqa: E501 + :rtype: list[Rpc] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRpc. + + + :param data: The data of this PageDataRpc. # noqa: E501 + :type: list[Rpc] + """ + + self._data = data + + @property + def has_next(self): + """Gets the has_next of this PageDataRpc. # noqa: E501 + + + :return: The has_next of this PageDataRpc. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRpc. + + + :param has_next: The has_next of this PageDataRpc. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRpc. # noqa: E501 + + + :return: The total_elements of this PageDataRpc. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRpc. + + + :param total_elements: The total_elements of this PageDataRpc. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRpc. # noqa: E501 + + + :return: The total_pages of this PageDataRpc. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRpc. + + + :param total_pages: The total_pages of this PageDataRpc. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRpc, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRpc): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_rule_chain.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_rule_chain.py new file mode 100644 index 0000000..0e4dc56 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_rule_chain.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[RuleChain]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataRuleChain - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataRuleChain. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataRuleChain. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRuleChain. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataRuleChain. # noqa: E501 + :type: list[RuleChain] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRuleChain. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRuleChain. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRuleChain. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRuleChain. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataRuleChain. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataRuleChain. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRuleChain. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataRuleChain. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_tb_resource_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tb_resource_info.py new file mode 100644 index 0000000..67a0fec --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tb_resource_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TbResourceInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTbResourceInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTbResourceInfo. # noqa: E501 + :rtype: list[TbResourceInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTbResourceInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTbResourceInfo. # noqa: E501 + :type: list[TbResourceInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTbResourceInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTbResourceInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTbResourceInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTbResourceInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTbResourceInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTbResourceInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant.py new file mode 100644 index 0000000..2a9fc38 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTenant(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Tenant]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTenant - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTenant. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTenant. # noqa: E501 + :rtype: list[Tenant] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTenant. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTenant. # noqa: E501 + :type: list[Tenant] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTenant. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTenant. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTenant. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTenant. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTenant. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTenant. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTenant. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTenant. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTenant. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTenant. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTenant. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTenant. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTenant, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTenant): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant_info.py new file mode 100644 index 0000000..01e0342 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTenantInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TenantInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTenantInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTenantInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTenantInfo. # noqa: E501 + :rtype: list[TenantInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTenantInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTenantInfo. # noqa: E501 + :type: list[TenantInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTenantInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTenantInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTenantInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTenantInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTenantInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTenantInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTenantInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTenantInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTenantInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTenantInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTenantInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTenantInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTenantInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTenantInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant_profile.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant_profile.py new file mode 100644 index 0000000..f9b45fe --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_tenant_profile.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTenantProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TenantProfile]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTenantProfile - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTenantProfile. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTenantProfile. # noqa: E501 + :rtype: list[TenantProfile] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTenantProfile. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTenantProfile. # noqa: E501 + :type: list[TenantProfile] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTenantProfile. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTenantProfile. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTenantProfile. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTenantProfile. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTenantProfile. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTenantProfile. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTenantProfile. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTenantProfile. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTenantProfile. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTenantProfile. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTenantProfile. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTenantProfile. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTenantProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTenantProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_user.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_user.py new file mode 100644 index 0000000..736448b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_user.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUser(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[User]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUser - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUser. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUser. # noqa: E501 + :rtype: list[User] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUser. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUser. # noqa: E501 + :type: list[User] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUser. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUser. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUser. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUser. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUser. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUser. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUser. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUser. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUser. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUser. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUser. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUser. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUser, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUser): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_user_email_info.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_user_email_info.py new file mode 100644 index 0000000..08490cb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_user_email_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[UserEmailInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUserEmailInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUserEmailInfo. # noqa: E501 + :rtype: list[UserEmailInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUserEmailInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUserEmailInfo. # noqa: E501 + :type: list[UserEmailInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUserEmailInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUserEmailInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUserEmailInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUserEmailInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUserEmailInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUserEmailInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/page_data_widgets_bundle.py b/billinglayer/python/tb_rest_client/models/models_ce/page_data_widgets_bundle.py new file mode 100644 index 0000000..71403fb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/page_data_widgets_bundle.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataWidgetsBundle(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[WidgetsBundle]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataWidgetsBundle - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataWidgetsBundle. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataWidgetsBundle. # noqa: E501 + :rtype: list[WidgetsBundle] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataWidgetsBundle. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataWidgetsBundle. # noqa: E501 + :type: list[WidgetsBundle] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataWidgetsBundle. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataWidgetsBundle. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataWidgetsBundle. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataWidgetsBundle. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataWidgetsBundle. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataWidgetsBundle. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataWidgetsBundle. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataWidgetsBundle. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataWidgetsBundle. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataWidgetsBundle. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataWidgetsBundle. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataWidgetsBundle. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataWidgetsBundle, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataWidgetsBundle): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/platform_two_fa_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/platform_two_fa_settings.py new file mode 100644 index 0000000..efa2e2b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/platform_two_fa_settings.py @@ -0,0 +1,231 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PlatformTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'max_verification_failures_before_user_lockout': 'int', + 'min_verification_code_send_period': 'int', + 'providers': 'list[TwoFaProviderConfig]', + 'total_allowed_time_for_verification': 'int', + 'verification_code_check_rate_limit': 'str' + } + + attribute_map = { + 'max_verification_failures_before_user_lockout': 'maxVerificationFailuresBeforeUserLockout', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'providers': 'providers', + 'total_allowed_time_for_verification': 'totalAllowedTimeForVerification', + 'verification_code_check_rate_limit': 'verificationCodeCheckRateLimit' + } + + def __init__(self, max_verification_failures_before_user_lockout=None, min_verification_code_send_period=None, providers=None, total_allowed_time_for_verification=None, verification_code_check_rate_limit=None): # noqa: E501 + """PlatformTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._max_verification_failures_before_user_lockout = None + self._min_verification_code_send_period = None + self._providers = None + self._total_allowed_time_for_verification = None + self._verification_code_check_rate_limit = None + self.discriminator = None + if max_verification_failures_before_user_lockout is not None: + self.max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + self.min_verification_code_send_period = min_verification_code_send_period + self.providers = providers + self.total_allowed_time_for_verification = total_allowed_time_for_verification + if verification_code_check_rate_limit is not None: + self.verification_code_check_rate_limit = verification_code_check_rate_limit + + @property + def max_verification_failures_before_user_lockout(self): + """Gets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._max_verification_failures_before_user_lockout + + @max_verification_failures_before_user_lockout.setter + def max_verification_failures_before_user_lockout(self, max_verification_failures_before_user_lockout): + """Sets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. + + + :param max_verification_failures_before_user_lockout: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + + self._max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this PlatformTwoFaSettings. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if min_verification_code_send_period is None: + raise ValueError("Invalid value for `min_verification_code_send_period`, must not be `None`") # noqa: E501 + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def providers(self): + """Gets the providers of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The providers of this PlatformTwoFaSettings. # noqa: E501 + :rtype: list[TwoFaProviderConfig] + """ + return self._providers + + @providers.setter + def providers(self, providers): + """Sets the providers of this PlatformTwoFaSettings. + + + :param providers: The providers of this PlatformTwoFaSettings. # noqa: E501 + :type: list[TwoFaProviderConfig] + """ + if providers is None: + raise ValueError("Invalid value for `providers`, must not be `None`") # noqa: E501 + + self._providers = providers + + @property + def total_allowed_time_for_verification(self): + """Gets the total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._total_allowed_time_for_verification + + @total_allowed_time_for_verification.setter + def total_allowed_time_for_verification(self, total_allowed_time_for_verification): + """Sets the total_allowed_time_for_verification of this PlatformTwoFaSettings. + + + :param total_allowed_time_for_verification: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if total_allowed_time_for_verification is None: + raise ValueError("Invalid value for `total_allowed_time_for_verification`, must not be `None`") # noqa: E501 + + self._total_allowed_time_for_verification = total_allowed_time_for_verification + + @property + def verification_code_check_rate_limit(self): + """Gets the verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :rtype: str + """ + return self._verification_code_check_rate_limit + + @verification_code_check_rate_limit.setter + def verification_code_check_rate_limit(self, verification_code_check_rate_limit): + """Sets the verification_code_check_rate_limit of this PlatformTwoFaSettings. + + + :param verification_code_check_rate_limit: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :type: str + """ + + self._verification_code_check_rate_limit = verification_code_check_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/platform_users_notification_target_config.py b/billinglayer/python/tb_rest_client/models/models_ce/platform_users_notification_target_config.py new file mode 100644 index 0000000..2b8b1ba --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/platform_users_notification_target_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class PlatformUsersNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'users_filter': 'UsersFilter' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'description': 'description', + 'users_filter': 'usersFilter' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, description=None, users_filter=None, *args, **kwargs): # noqa: E501 + """PlatformUsersNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self._users_filter = None + self.discriminator = None + if description is not None: + self.description = description + self.users_filter = users_filter + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def description(self): + """Gets the description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this PlatformUsersNotificationTargetConfig. + + + :param description: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def users_filter(self): + """Gets the users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: UsersFilter + """ + return self._users_filter + + @users_filter.setter + def users_filter(self, users_filter): + """Sets the users_filter of this PlatformUsersNotificationTargetConfig. + + + :param users_filter: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: UsersFilter + """ + if users_filter is None: + raise ValueError("Invalid value for `users_filter`, must not be `None`") # noqa: E501 + + self._users_filter = users_filter + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformUsersNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformUsersNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/power_saving_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/power_saving_configuration.py new file mode 100644 index 0000000..07a43e0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/power_saving_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PowerSavingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None): # noqa: E501 + """PowerSavingConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this PowerSavingConfiguration. + + + :param edrx_cycle: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this PowerSavingConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this PowerSavingConfiguration. # noqa: E501 + + + :return: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this PowerSavingConfiguration. + + + :param power_mode: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this PowerSavingConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PowerSavingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PowerSavingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/processing_strategy.py b/billinglayer/python/tb_rest_client/models/models_ce/processing_strategy.py new file mode 100644 index 0000000..a23adbe --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/processing_strategy.py @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ProcessingStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'failure_percentage': 'float', + 'max_pause_between_retries': 'int', + 'pause_between_retries': 'int', + 'retries': 'int', + 'type': 'str' + } + + attribute_map = { + 'failure_percentage': 'failurePercentage', + 'max_pause_between_retries': 'maxPauseBetweenRetries', + 'pause_between_retries': 'pauseBetweenRetries', + 'retries': 'retries', + 'type': 'type' + } + + def __init__(self, failure_percentage=None, max_pause_between_retries=None, pause_between_retries=None, retries=None, type=None): # noqa: E501 + """ProcessingStrategy - a model defined in Swagger""" # noqa: E501 + self._failure_percentage = None + self._max_pause_between_retries = None + self._pause_between_retries = None + self._retries = None + self._type = None + self.discriminator = None + if failure_percentage is not None: + self.failure_percentage = failure_percentage + if max_pause_between_retries is not None: + self.max_pause_between_retries = max_pause_between_retries + if pause_between_retries is not None: + self.pause_between_retries = pause_between_retries + if retries is not None: + self.retries = retries + if type is not None: + self.type = type + + @property + def failure_percentage(self): + """Gets the failure_percentage of this ProcessingStrategy. # noqa: E501 + + + :return: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :rtype: float + """ + return self._failure_percentage + + @failure_percentage.setter + def failure_percentage(self, failure_percentage): + """Sets the failure_percentage of this ProcessingStrategy. + + + :param failure_percentage: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :type: float + """ + + self._failure_percentage = failure_percentage + + @property + def max_pause_between_retries(self): + """Gets the max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._max_pause_between_retries + + @max_pause_between_retries.setter + def max_pause_between_retries(self, max_pause_between_retries): + """Sets the max_pause_between_retries of this ProcessingStrategy. + + + :param max_pause_between_retries: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._max_pause_between_retries = max_pause_between_retries + + @property + def pause_between_retries(self): + """Gets the pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._pause_between_retries + + @pause_between_retries.setter + def pause_between_retries(self, pause_between_retries): + """Sets the pause_between_retries of this ProcessingStrategy. + + + :param pause_between_retries: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._pause_between_retries = pause_between_retries + + @property + def retries(self): + """Gets the retries of this ProcessingStrategy. # noqa: E501 + + + :return: The retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this ProcessingStrategy. + + + :param retries: The retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def type(self): + """Gets the type of this ProcessingStrategy. # noqa: E501 + + + :return: The type of this ProcessingStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ProcessingStrategy. + + + :param type: The type of this ProcessingStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["RETRY_ALL", "RETRY_FAILED", "RETRY_FAILED_AND_TIMED_OUT", "RETRY_TIMED_OUT", "SKIP_ALL_FAILURES", "SKIP_ALL_FAILURES_AND_TIMED_OUT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProcessingStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProcessingStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/proto_transport_payload_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/proto_transport_payload_configuration.py new file mode 100644 index 0000000..ec66f53 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/proto_transport_payload_configuration.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class ProtoTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_proto_schema': 'str', + 'device_rpc_request_proto_schema': 'str', + 'device_rpc_response_proto_schema': 'str', + 'device_telemetry_proto_schema': 'str', + 'enable_compatibility_with_json_payload_format': 'bool', + 'use_json_payload_format_for_default_downlink_topics': 'bool' + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + 'device_attributes_proto_schema': 'deviceAttributesProtoSchema', + 'device_rpc_request_proto_schema': 'deviceRpcRequestProtoSchema', + 'device_rpc_response_proto_schema': 'deviceRpcResponseProtoSchema', + 'device_telemetry_proto_schema': 'deviceTelemetryProtoSchema', + 'enable_compatibility_with_json_payload_format': 'enableCompatibilityWithJsonPayloadFormat', + 'use_json_payload_format_for_default_downlink_topics': 'useJsonPayloadFormatForDefaultDownlinkTopics' + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, device_attributes_proto_schema=None, device_rpc_request_proto_schema=None, device_rpc_response_proto_schema=None, device_telemetry_proto_schema=None, enable_compatibility_with_json_payload_format=None, use_json_payload_format_for_default_downlink_topics=None, *args, **kwargs): # noqa: E501 + """ProtoTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_proto_schema = None + self._device_rpc_request_proto_schema = None + self._device_rpc_response_proto_schema = None + self._device_telemetry_proto_schema = None + self._enable_compatibility_with_json_payload_format = None + self._use_json_payload_format_for_default_downlink_topics = None + self.discriminator = None + if device_attributes_proto_schema is not None: + self.device_attributes_proto_schema = device_attributes_proto_schema + if device_rpc_request_proto_schema is not None: + self.device_rpc_request_proto_schema = device_rpc_request_proto_schema + if device_rpc_response_proto_schema is not None: + self.device_rpc_response_proto_schema = device_rpc_response_proto_schema + if device_telemetry_proto_schema is not None: + self.device_telemetry_proto_schema = device_telemetry_proto_schema + if enable_compatibility_with_json_payload_format is not None: + self.enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + if use_json_payload_format_for_default_downlink_topics is not None: + self.use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def device_attributes_proto_schema(self): + """Gets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_proto_schema + + @device_attributes_proto_schema.setter + def device_attributes_proto_schema(self, device_attributes_proto_schema): + """Sets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_attributes_proto_schema: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_proto_schema = device_attributes_proto_schema + + @property + def device_rpc_request_proto_schema(self): + """Gets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_request_proto_schema + + @device_rpc_request_proto_schema.setter + def device_rpc_request_proto_schema(self, device_rpc_request_proto_schema): + """Sets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_request_proto_schema: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_request_proto_schema = device_rpc_request_proto_schema + + @property + def device_rpc_response_proto_schema(self): + """Gets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_response_proto_schema + + @device_rpc_response_proto_schema.setter + def device_rpc_response_proto_schema(self, device_rpc_response_proto_schema): + """Sets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_response_proto_schema: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_response_proto_schema = device_rpc_response_proto_schema + + @property + def device_telemetry_proto_schema(self): + """Gets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_proto_schema + + @device_telemetry_proto_schema.setter + def device_telemetry_proto_schema(self, device_telemetry_proto_schema): + """Sets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_telemetry_proto_schema: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_proto_schema = device_telemetry_proto_schema + + @property + def enable_compatibility_with_json_payload_format(self): + """Gets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._enable_compatibility_with_json_payload_format + + @enable_compatibility_with_json_payload_format.setter + def enable_compatibility_with_json_payload_format(self, enable_compatibility_with_json_payload_format): + """Sets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. + + + :param enable_compatibility_with_json_payload_format: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + + @property + def use_json_payload_format_for_default_downlink_topics(self): + """Gets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._use_json_payload_format_for_default_downlink_topics + + @use_json_payload_format_for_default_downlink_topics.setter + def use_json_payload_format_for_default_downlink_topics(self, use_json_payload_format_for_default_downlink_topics): + """Sets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. + + + :param use_json_payload_format_for_default_downlink_topics: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProtoTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProtoTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/psklw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_ce/psklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..e8b56e1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/psklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential # noqa: F401,E501 + +class PSKLwM2MBootstrapServerCredential(LwM2MBootstrapServerCredential): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + if hasattr(LwM2MBootstrapServerCredential, "swagger_types"): + swagger_types.update(LwM2MBootstrapServerCredential.swagger_types) + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + if hasattr(LwM2MBootstrapServerCredential, "attribute_map"): + attribute_map.update(LwM2MBootstrapServerCredential.attribute_map) + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None, *args, **kwargs): # noqa: E501 + """PSKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + LwM2MBootstrapServerCredential.__init__(self, *args, **kwargs) + + @property + def short_server_id(self): + """Gets the short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this PSKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this PSKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this PSKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this PSKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this PSKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this PSKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PSKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PSKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/queue.py b/billinglayer/python/tb_rest_client/models/models_ce/queue.py new file mode 100644 index 0000000..e16d8fc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/queue.py @@ -0,0 +1,410 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Queue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'created_time': 'int', + 'id': 'QueueId', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'tenant_id': 'TenantId', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'tenant_id': 'tenantId', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, created_time=None, id=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, tenant_id=None, topic=None): # noqa: E501 + """Queue - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._created_time = None + self._id = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._tenant_id = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if tenant_id is not None: + self.tenant_id = tenant_id + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this Queue. # noqa: E501 + + + :return: The additional_info of this Queue. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Queue. + + + :param additional_info: The additional_info of this Queue. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this Queue. # noqa: E501 + + + :return: The consumer_per_partition of this Queue. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this Queue. + + + :param consumer_per_partition: The consumer_per_partition of this Queue. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def created_time(self): + """Gets the created_time of this Queue. # noqa: E501 + + + :return: The created_time of this Queue. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Queue. + + + :param created_time: The created_time of this Queue. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Queue. # noqa: E501 + + + :return: The id of this Queue. # noqa: E501 + :rtype: QueueId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Queue. + + + :param id: The id of this Queue. # noqa: E501 + :type: QueueId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Queue. # noqa: E501 + + + :return: The name of this Queue. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Queue. + + + :param name: The name of this Queue. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this Queue. # noqa: E501 + + + :return: The pack_processing_timeout of this Queue. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this Queue. + + + :param pack_processing_timeout: The pack_processing_timeout of this Queue. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this Queue. # noqa: E501 + + + :return: The partitions of this Queue. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this Queue. + + + :param partitions: The partitions of this Queue. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this Queue. # noqa: E501 + + + :return: The poll_interval of this Queue. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this Queue. + + + :param poll_interval: The poll_interval of this Queue. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this Queue. # noqa: E501 + + + :return: The processing_strategy of this Queue. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this Queue. + + + :param processing_strategy: The processing_strategy of this Queue. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this Queue. # noqa: E501 + + + :return: The submit_strategy of this Queue. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this Queue. + + + :param submit_strategy: The submit_strategy of this Queue. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def tenant_id(self): + """Gets the tenant_id of this Queue. # noqa: E501 + + + :return: The tenant_id of this Queue. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Queue. + + + :param tenant_id: The tenant_id of this Queue. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def topic(self): + """Gets the topic of this Queue. # noqa: E501 + + + :return: The topic of this Queue. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this Queue. + + + :param topic: The topic of this Queue. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Queue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Queue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/queue_id.py b/billinglayer/python/tb_rest_client/models/models_ce/queue_id.py new file mode 100644 index 0000000..163108c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/queue_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class QueueId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """QueueId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this QueueId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this QueueId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this QueueId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this QueueId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this QueueId. # noqa: E501 + + + :return: The entity_type of this QueueId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this QueueId. + + + :param entity_type: The entity_type of this QueueId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(QueueId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, QueueId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/relation_entity_type_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/relation_entity_type_filter.py new file mode 100644 index 0000000..027ad9c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/relation_entity_type_filter.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationEntityTypeFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_types': 'list[str]' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_types': 'entityTypes' + } + + def __init__(self, relation_type=None, entity_types=None): # noqa: E501 + """RelationEntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_types = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_types is not None: + self.entity_types = entity_types + + @property + def relation_type(self): + """Gets the relation_type of this RelationEntityTypeFilter. # noqa: E501 + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RelationEntityTypeFilter. + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_types(self): + """Gets the entity_types of this RelationEntityTypeFilter. # noqa: E501 + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :return: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this RelationEntityTypeFilter. + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :param entity_types: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationEntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationEntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/relations_query_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/relations_query_filter.py new file mode 100644 index 0000000..96be25a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/relations_query_filter.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class RelationsQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'filters': 'list[RelationEntityTypeFilter]', + 'max_level': 'int', + 'multi_root': 'bool', + 'multi_root_entities_type': 'str', + 'multi_root_entity_ids': 'list[str]', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'filters': 'filters', + 'max_level': 'maxLevel', + 'multi_root': 'multiRoot', + 'multi_root_entities_type': 'multiRootEntitiesType', + 'multi_root_entity_ids': 'multiRootEntityIds', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, fetch_last_level_only=None, filters=None, max_level=None, multi_root=None, multi_root_entities_type=None, multi_root_entity_ids=None, root_entity=None, *args, **kwargs): # noqa: E501 + """RelationsQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._fetch_last_level_only = None + self._filters = None + self._max_level = None + self._multi_root = None + self._multi_root_entities_type = None + self._multi_root_entity_ids = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if filters is not None: + self.filters = filters + if max_level is not None: + self.max_level = max_level + if multi_root is not None: + self.multi_root = multi_root + if multi_root_entities_type is not None: + self.multi_root_entities_type = multi_root_entities_type + if multi_root_entity_ids is not None: + self.multi_root_entity_ids = multi_root_entity_ids + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this RelationsQueryFilter. # noqa: E501 + + + :return: The direction of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsQueryFilter. + + + :param direction: The direction of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def filters(self): + """Gets the filters of this RelationsQueryFilter. # noqa: E501 + + + :return: The filters of this RelationsQueryFilter. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this RelationsQueryFilter. + + + :param filters: The filters of this RelationsQueryFilter. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def max_level(self): + """Gets the max_level of this RelationsQueryFilter. # noqa: E501 + + + :return: The max_level of this RelationsQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsQueryFilter. + + + :param max_level: The max_level of this RelationsQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def multi_root(self): + """Gets the multi_root of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._multi_root + + @multi_root.setter + def multi_root(self, multi_root): + """Sets the multi_root of this RelationsQueryFilter. + + + :param multi_root: The multi_root of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._multi_root = multi_root + + @property + def multi_root_entities_type(self): + """Gets the multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._multi_root_entities_type + + @multi_root_entities_type.setter + def multi_root_entities_type(self, multi_root_entities_type): + """Sets the multi_root_entities_type of this RelationsQueryFilter. + + + :param multi_root_entities_type: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if multi_root_entities_type not in allowed_values: + raise ValueError( + "Invalid value for `multi_root_entities_type` ({0}), must be one of {1}" # noqa: E501 + .format(multi_root_entities_type, allowed_values) + ) + + self._multi_root_entities_type = multi_root_entities_type + + @property + def multi_root_entity_ids(self): + """Gets the multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._multi_root_entity_ids + + @multi_root_entity_ids.setter + def multi_root_entity_ids(self, multi_root_entity_ids): + """Sets the multi_root_entity_ids of this RelationsQueryFilter. + + + :param multi_root_entity_ids: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._multi_root_entity_ids = multi_root_entity_ids + + @property + def root_entity(self): + """Gets the root_entity of this RelationsQueryFilter. # noqa: E501 + + + :return: The root_entity of this RelationsQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this RelationsQueryFilter. + + + :param root_entity: The root_entity of this RelationsQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/relations_search_parameters.py b/billinglayer/python/tb_rest_client/models/models_ce/relations_search_parameters.py new file mode 100644 index 0000000..b1f4c1e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/relations_search_parameters.py @@ -0,0 +1,284 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationsSearchParameters(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'root_id': 'str', + 'root_type': 'str', + 'direction': 'str', + 'relation_type_group': 'str', + 'max_level': 'int', + 'fetch_last_level_only': 'bool' + } + + attribute_map = { + 'root_id': 'rootId', + 'root_type': 'rootType', + 'direction': 'direction', + 'relation_type_group': 'relationTypeGroup', + 'max_level': 'maxLevel', + 'fetch_last_level_only': 'fetchLastLevelOnly' + } + + def __init__(self, root_id=None, root_type=None, direction=None, relation_type_group=None, max_level=None, fetch_last_level_only=None): # noqa: E501 + """RelationsSearchParameters - a model defined in Swagger""" # noqa: E501 + self._root_id = None + self._root_type = None + self._direction = None + self._relation_type_group = None + self._max_level = None + self._fetch_last_level_only = None + self.discriminator = None + if root_id is not None: + self.root_id = root_id + if root_type is not None: + self.root_type = root_type + if direction is not None: + self.direction = direction + if relation_type_group is not None: + self.relation_type_group = relation_type_group + if max_level is not None: + self.max_level = max_level + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + + @property + def root_id(self): + """Gets the root_id of this RelationsSearchParameters. # noqa: E501 + + Root entity id to start search from. # noqa: E501 + + :return: The root_id of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_id + + @root_id.setter + def root_id(self, root_id): + """Sets the root_id of this RelationsSearchParameters. + + Root entity id to start search from. # noqa: E501 + + :param root_id: The root_id of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + + self._root_id = root_id + + @property + def root_type(self): + """Gets the root_type of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The root_type of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_type + + @root_type.setter + def root_type(self, root_type): + """Sets the root_type of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param root_type: The root_type of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if root_type not in allowed_values: + raise ValueError( + "Invalid value for `root_type` ({0}), must be one of {1}" # noqa: E501 + .format(root_type, allowed_values) + ) + + self._root_type = root_type + + @property + def direction(self): + """Gets the direction of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The direction of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param direction: The direction of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def relation_type_group(self): + """Gets the relation_type_group of this RelationsSearchParameters. # noqa: E501 + + Type of the relation. # noqa: E501 + + :return: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._relation_type_group + + @relation_type_group.setter + def relation_type_group(self, relation_type_group): + """Sets the relation_type_group of this RelationsSearchParameters. + + Type of the relation. # noqa: E501 + + :param relation_type_group: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if relation_type_group not in allowed_values: + raise ValueError( + "Invalid value for `relation_type_group` ({0}), must be one of {1}" # noqa: E501 + .format(relation_type_group, allowed_values) + ) + + self._relation_type_group = relation_type_group + + @property + def max_level(self): + """Gets the max_level of this RelationsSearchParameters. # noqa: E501 + + Maximum level of the search depth. # noqa: E501 + + :return: The max_level of this RelationsSearchParameters. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsSearchParameters. + + Maximum level of the search depth. # noqa: E501 + + :param max_level: The max_level of this RelationsSearchParameters. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :return: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsSearchParameters. + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsSearchParameters, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsSearchParameters): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/repeating_alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_ce/repeating_alarm_condition_spec.py new file mode 100644 index 0000000..f0a1f7a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/repeating_alarm_condition_spec.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class RepeatingAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValueint' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, *args, **kwargs): # noqa: E501 + """RepeatingAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValueint + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this RepeatingAlarmConditionSpec. + + + :param predicate: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValueint + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepeatingAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepeatingAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/repository_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/repository_settings.py new file mode 100644 index 0000000..ea6ee37 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/repository_settings.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_method': 'str', + 'default_branch': 'str', + 'password': 'str', + 'private_key': 'str', + 'private_key_file_name': 'str', + 'private_key_password': 'str', + 'read_only': 'bool', + 'repository_uri': 'str', + 'show_merge_commits': 'bool', + 'username': 'str' + } + + attribute_map = { + 'auth_method': 'authMethod', + 'default_branch': 'defaultBranch', + 'password': 'password', + 'private_key': 'privateKey', + 'private_key_file_name': 'privateKeyFileName', + 'private_key_password': 'privateKeyPassword', + 'read_only': 'readOnly', + 'repository_uri': 'repositoryUri', + 'show_merge_commits': 'showMergeCommits', + 'username': 'username' + } + + def __init__(self, auth_method=None, default_branch=None, password=None, private_key=None, private_key_file_name=None, private_key_password=None, read_only=None, repository_uri=None, show_merge_commits=None, username=None): # noqa: E501 + """RepositorySettings - a model defined in Swagger""" # noqa: E501 + self._auth_method = None + self._default_branch = None + self._password = None + self._private_key = None + self._private_key_file_name = None + self._private_key_password = None + self._read_only = None + self._repository_uri = None + self._show_merge_commits = None + self._username = None + self.discriminator = None + if auth_method is not None: + self.auth_method = auth_method + if default_branch is not None: + self.default_branch = default_branch + if password is not None: + self.password = password + if private_key is not None: + self.private_key = private_key + if private_key_file_name is not None: + self.private_key_file_name = private_key_file_name + if private_key_password is not None: + self.private_key_password = private_key_password + if read_only is not None: + self.read_only = read_only + if repository_uri is not None: + self.repository_uri = repository_uri + if show_merge_commits is not None: + self.show_merge_commits = show_merge_commits + if username is not None: + self.username = username + + @property + def auth_method(self): + """Gets the auth_method of this RepositorySettings. # noqa: E501 + + + :return: The auth_method of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._auth_method + + @auth_method.setter + def auth_method(self, auth_method): + """Sets the auth_method of this RepositorySettings. + + + :param auth_method: The auth_method of this RepositorySettings. # noqa: E501 + :type: str + """ + allowed_values = ["PRIVATE_KEY", "USERNAME_PASSWORD"] # noqa: E501 + if auth_method not in allowed_values: + raise ValueError( + "Invalid value for `auth_method` ({0}), must be one of {1}" # noqa: E501 + .format(auth_method, allowed_values) + ) + + self._auth_method = auth_method + + @property + def default_branch(self): + """Gets the default_branch of this RepositorySettings. # noqa: E501 + + + :return: The default_branch of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._default_branch + + @default_branch.setter + def default_branch(self, default_branch): + """Sets the default_branch of this RepositorySettings. + + + :param default_branch: The default_branch of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._default_branch = default_branch + + @property + def password(self): + """Gets the password of this RepositorySettings. # noqa: E501 + + + :return: The password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this RepositorySettings. + + + :param password: The password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def private_key(self): + """Gets the private_key of this RepositorySettings. # noqa: E501 + + + :return: The private_key of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key + + @private_key.setter + def private_key(self, private_key): + """Sets the private_key of this RepositorySettings. + + + :param private_key: The private_key of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key = private_key + + @property + def private_key_file_name(self): + """Gets the private_key_file_name of this RepositorySettings. # noqa: E501 + + + :return: The private_key_file_name of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_file_name + + @private_key_file_name.setter + def private_key_file_name(self, private_key_file_name): + """Sets the private_key_file_name of this RepositorySettings. + + + :param private_key_file_name: The private_key_file_name of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_file_name = private_key_file_name + + @property + def private_key_password(self): + """Gets the private_key_password of this RepositorySettings. # noqa: E501 + + + :return: The private_key_password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_password + + @private_key_password.setter + def private_key_password(self, private_key_password): + """Sets the private_key_password of this RepositorySettings. + + + :param private_key_password: The private_key_password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_password = private_key_password + + @property + def read_only(self): + """Gets the read_only of this RepositorySettings. # noqa: E501 + + + :return: The read_only of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettings. + + + :param read_only: The read_only of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def repository_uri(self): + """Gets the repository_uri of this RepositorySettings. # noqa: E501 + + + :return: The repository_uri of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._repository_uri + + @repository_uri.setter + def repository_uri(self, repository_uri): + """Sets the repository_uri of this RepositorySettings. + + + :param repository_uri: The repository_uri of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._repository_uri = repository_uri + + @property + def show_merge_commits(self): + """Gets the show_merge_commits of this RepositorySettings. # noqa: E501 + + + :return: The show_merge_commits of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._show_merge_commits + + @show_merge_commits.setter + def show_merge_commits(self, show_merge_commits): + """Sets the show_merge_commits of this RepositorySettings. + + + :param show_merge_commits: The show_merge_commits of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._show_merge_commits = show_merge_commits + + @property + def username(self): + """Gets the username of this RepositorySettings. # noqa: E501 + + + :return: The username of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this RepositorySettings. + + + :param username: The username of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/repository_settings_info.py b/billinglayer/python/tb_rest_client/models/models_ce/repository_settings_info.py new file mode 100644 index 0000000..bd45203 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/repository_settings_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettingsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configured': 'bool', + 'read_only': 'bool' + } + + attribute_map = { + 'configured': 'configured', + 'read_only': 'readOnly' + } + + def __init__(self, configured=None, read_only=None): # noqa: E501 + """RepositorySettingsInfo - a model defined in Swagger""" # noqa: E501 + self._configured = None + self._read_only = None + self.discriminator = None + if configured is not None: + self.configured = configured + if read_only is not None: + self.read_only = read_only + + @property + def configured(self): + """Gets the configured of this RepositorySettingsInfo. # noqa: E501 + + + :return: The configured of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._configured + + @configured.setter + def configured(self, configured): + """Sets the configured of this RepositorySettingsInfo. + + + :param configured: The configured of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._configured = configured + + @property + def read_only(self): + """Gets the read_only of this RepositorySettingsInfo. # noqa: E501 + + + :return: The read_only of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettingsInfo. + + + :param read_only: The read_only of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettingsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettingsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/reset_password_email_request.py b/billinglayer/python/tb_rest_client/models/models_ce/reset_password_email_request.py new file mode 100644 index 0000000..76819e8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/reset_password_email_request.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordEmailRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str' + } + + attribute_map = { + 'email': 'email' + } + + def __init__(self, email=None): # noqa: E501 + """ResetPasswordEmailRequest - a model defined in Swagger""" # noqa: E501 + self._email = None + self.discriminator = None + if email is not None: + self.email = email + + @property + def email(self): + """Gets the email of this ResetPasswordEmailRequest. # noqa: E501 + + The email of the user # noqa: E501 + + :return: The email of this ResetPasswordEmailRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this ResetPasswordEmailRequest. + + The email of the user # noqa: E501 + + :param email: The email of this ResetPasswordEmailRequest. # noqa: E501 + :type: str + """ + + self._email = email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordEmailRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordEmailRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/reset_password_request.py b/billinglayer/python/tb_rest_client/models/models_ce/reset_password_request.py new file mode 100644 index 0000000..03f1eef --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/reset_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'reset_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'reset_token': 'resetToken', + 'password': 'password' + } + + def __init__(self, reset_token=None, password=None): # noqa: E501 + """ResetPasswordRequest - a model defined in Swagger""" # noqa: E501 + self._reset_token = None + self._password = None + self.discriminator = None + if reset_token is not None: + self.reset_token = reset_token + if password is not None: + self.password = password + + @property + def reset_token(self): + """Gets the reset_token of this ResetPasswordRequest. # noqa: E501 + + The reset token to verify # noqa: E501 + + :return: The reset_token of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ResetPasswordRequest. + + The reset token to verify # noqa: E501 + + :param reset_token: The reset_token of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + @property + def password(self): + """Gets the password of this ResetPasswordRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ResetPasswordRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/resource.py b/billinglayer/python/tb_rest_client/models/models_ce/resource.py new file mode 100644 index 0000000..2247923 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/resource.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Resource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'file': 'str', + 'filename': 'str', + 'input_stream': 'InputStream', + 'open': 'bool', + 'readable': 'bool', + 'uri': 'str', + 'url': 'str' + } + + attribute_map = { + 'description': 'description', + 'file': 'file', + 'filename': 'filename', + 'input_stream': 'inputStream', + 'open': 'open', + 'readable': 'readable', + 'uri': 'uri', + 'url': 'url' + } + + def __init__(self, description=None, file=None, filename=None, input_stream=None, open=None, readable=None, uri=None, url=None): # noqa: E501 + """Resource - a model defined in Swagger""" # noqa: E501 + self._description = None + self._file = None + self._filename = None + self._input_stream = None + self._open = None + self._readable = None + self._uri = None + self._url = None + self.discriminator = None + if description is not None: + self.description = description + if file is not None: + self.file = file + if filename is not None: + self.filename = filename + if input_stream is not None: + self.input_stream = input_stream + if open is not None: + self.open = open + if readable is not None: + self.readable = readable + if uri is not None: + self.uri = uri + if url is not None: + self.url = url + + @property + def description(self): + """Gets the description of this Resource. # noqa: E501 + + + :return: The description of this Resource. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Resource. + + + :param description: The description of this Resource. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def file(self): + """Gets the file of this Resource. # noqa: E501 + + + :return: The file of this Resource. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this Resource. + + + :param file: The file of this Resource. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def filename(self): + """Gets the filename of this Resource. # noqa: E501 + + + :return: The filename of this Resource. # noqa: E501 + :rtype: str + """ + return self._filename + + @filename.setter + def filename(self, filename): + """Sets the filename of this Resource. + + + :param filename: The filename of this Resource. # noqa: E501 + :type: str + """ + + self._filename = filename + + @property + def input_stream(self): + """Gets the input_stream of this Resource. # noqa: E501 + + + :return: The input_stream of this Resource. # noqa: E501 + :rtype: InputStream + """ + return self._input_stream + + @input_stream.setter + def input_stream(self, input_stream): + """Sets the input_stream of this Resource. + + + :param input_stream: The input_stream of this Resource. # noqa: E501 + :type: InputStream + """ + + self._input_stream = input_stream + + @property + def open(self): + """Gets the open of this Resource. # noqa: E501 + + + :return: The open of this Resource. # noqa: E501 + :rtype: bool + """ + return self._open + + @open.setter + def open(self, open): + """Sets the open of this Resource. + + + :param open: The open of this Resource. # noqa: E501 + :type: bool + """ + + self._open = open + + @property + def readable(self): + """Gets the readable of this Resource. # noqa: E501 + + + :return: The readable of this Resource. # noqa: E501 + :rtype: bool + """ + return self._readable + + @readable.setter + def readable(self, readable): + """Sets the readable of this Resource. + + + :param readable: The readable of this Resource. # noqa: E501 + :type: bool + """ + + self._readable = readable + + @property + def uri(self): + """Gets the uri of this Resource. # noqa: E501 + + + :return: The uri of this Resource. # noqa: E501 + :rtype: str + """ + return self._uri + + @uri.setter + def uri(self, uri): + """Sets the uri of this Resource. + + + :param uri: The uri of this Resource. # noqa: E501 + :type: str + """ + + self._uri = uri + + @property + def url(self): + """Gets the url of this Resource. # noqa: E501 + + + :return: The url of this Resource. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this Resource. + + + :param url: The url of this Resource. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Resource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Resource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/response_entity.py b/billinglayer/python/tb_rest_client/models/models_ce/response_entity.py new file mode 100644 index 0000000..07baecb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/response_entity.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResponseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'object', + 'status_code': 'str', + 'status_code_value': 'int' + } + + attribute_map = { + 'body': 'body', + 'status_code': 'statusCode', + 'status_code_value': 'statusCodeValue' + } + + def __init__(self, body=None, status_code=None, status_code_value=None): # noqa: E501 + """ResponseEntity - a model defined in Swagger""" # noqa: E501 + self._body = None + self._status_code = None + self._status_code_value = None + self.discriminator = None + if body is not None: + self.body = body + if status_code is not None: + self.status_code = status_code + if status_code_value is not None: + self.status_code_value = status_code_value + + @property + def body(self): + """Gets the body of this ResponseEntity. # noqa: E501 + + + :return: The body of this ResponseEntity. # noqa: E501 + :rtype: object + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this ResponseEntity. + + + :param body: The body of this ResponseEntity. # noqa: E501 + :type: object + """ + + self._body = body + + @property + def status_code(self): + """Gets the status_code of this ResponseEntity. # noqa: E501 + + + :return: The status_code of this ResponseEntity. # noqa: E501 + :rtype: str + """ + return self._status_code + + @status_code.setter + def status_code(self, status_code): + """Sets the status_code of this ResponseEntity. + + + :param status_code: The status_code of this ResponseEntity. # noqa: E501 + :type: str + """ + allowed_values = ["ACCEPTED", "ALREADY_REPORTED", "BAD_GATEWAY", "BAD_REQUEST", "BANDWIDTH_LIMIT_EXCEEDED", "CHECKPOINT", "CONFLICT", "CONTINUE", "CREATED", "DESTINATION_LOCKED", "EXPECTATION_FAILED", "FAILED_DEPENDENCY", "FORBIDDEN", "FOUND", "GATEWAY_TIMEOUT", "GONE", "HTTP_VERSION_NOT_SUPPORTED", "IM_USED", "INSUFFICIENT_SPACE_ON_RESOURCE", "INSUFFICIENT_STORAGE", "INTERNAL_SERVER_ERROR", "I_AM_A_TEAPOT", "LENGTH_REQUIRED", "LOCKED", "LOOP_DETECTED", "METHOD_FAILURE", "METHOD_NOT_ALLOWED", "MOVED_PERMANENTLY", "MOVED_TEMPORARILY", "MULTIPLE_CHOICES", "MULTI_STATUS", "NETWORK_AUTHENTICATION_REQUIRED", "NON_AUTHORITATIVE_INFORMATION", "NOT_ACCEPTABLE", "NOT_EXTENDED", "NOT_FOUND", "NOT_IMPLEMENTED", "NOT_MODIFIED", "NO_CONTENT", "OK", "PARTIAL_CONTENT", "PAYLOAD_TOO_LARGE", "PAYMENT_REQUIRED", "PERMANENT_REDIRECT", "PRECONDITION_FAILED", "PRECONDITION_REQUIRED", "PROCESSING", "PROXY_AUTHENTICATION_REQUIRED", "REQUESTED_RANGE_NOT_SATISFIABLE", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_HEADER_FIELDS_TOO_LARGE", "REQUEST_TIMEOUT", "REQUEST_URI_TOO_LONG", "RESET_CONTENT", "SEE_OTHER", "SERVICE_UNAVAILABLE", "SWITCHING_PROTOCOLS", "TEMPORARY_REDIRECT", "TOO_EARLY", "TOO_MANY_REQUESTS", "UNAUTHORIZED", "UNAVAILABLE_FOR_LEGAL_REASONS", "UNPROCESSABLE_ENTITY", "UNSUPPORTED_MEDIA_TYPE", "UPGRADE_REQUIRED", "URI_TOO_LONG", "USE_PROXY", "VARIANT_ALSO_NEGOTIATES"] # noqa: E501 + if status_code not in allowed_values: + raise ValueError( + "Invalid value for `status_code` ({0}), must be one of {1}" # noqa: E501 + .format(status_code, allowed_values) + ) + + self._status_code = status_code + + @property + def status_code_value(self): + """Gets the status_code_value of this ResponseEntity. # noqa: E501 + + + :return: The status_code_value of this ResponseEntity. # noqa: E501 + :rtype: int + """ + return self._status_code_value + + @status_code_value.setter + def status_code_value(self, status_code_value): + """Sets the status_code_value of this ResponseEntity. + + + :param status_code_value: The status_code_value of this ResponseEntity. # noqa: E501 + :type: int + """ + + self._status_code_value = status_code_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResponseEntity, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResponseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rpc.py b/billinglayer/python/tb_rest_client/models/models_ce/rpc.py new file mode 100644 index 0000000..267c9b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rpc.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Rpc(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'RpcId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_id': 'DeviceId', + 'expiration_time': 'int', + 'request': 'JsonNode', + 'response': 'JsonNode', + 'status': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_id': 'deviceId', + 'expiration_time': 'expirationTime', + 'request': 'request', + 'response': 'response', + 'status': 'status', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_id=None, expiration_time=None, request=None, response=None, status=None, additional_info=None): # noqa: E501 + """Rpc - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_id = None + self._expiration_time = None + self._request = None + self._response = None + self._status = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_id is not None: + self.device_id = device_id + if expiration_time is not None: + self.expiration_time = expiration_time + if request is not None: + self.request = request + if response is not None: + self.response = response + if status is not None: + self.status = status + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Rpc. # noqa: E501 + + + :return: The id of this Rpc. # noqa: E501 + :rtype: RpcId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Rpc. + + + :param id: The id of this Rpc. # noqa: E501 + :type: RpcId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Rpc. # noqa: E501 + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :return: The created_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Rpc. + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Rpc. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Rpc. # noqa: E501 + + + :return: The tenant_id of this Rpc. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Rpc. + + + :param tenant_id: The tenant_id of this Rpc. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_id(self): + """Gets the device_id of this Rpc. # noqa: E501 + + + :return: The device_id of this Rpc. # noqa: E501 + :rtype: DeviceId + """ + return self._device_id + + @device_id.setter + def device_id(self, device_id): + """Sets the device_id of this Rpc. + + + :param device_id: The device_id of this Rpc. # noqa: E501 + :type: DeviceId + """ + + self._device_id = device_id + + @property + def expiration_time(self): + """Gets the expiration_time of this Rpc. # noqa: E501 + + Expiration time of the request. # noqa: E501 + + :return: The expiration_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._expiration_time + + @expiration_time.setter + def expiration_time(self, expiration_time): + """Sets the expiration_time of this Rpc. + + Expiration time of the request. # noqa: E501 + + :param expiration_time: The expiration_time of this Rpc. # noqa: E501 + :type: int + """ + + self._expiration_time = expiration_time + + @property + def request(self): + """Gets the request of this Rpc. # noqa: E501 + + + :return: The request of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._request + + @request.setter + def request(self, request): + """Sets the request of this Rpc. + + + :param request: The request of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._request = request + + @property + def response(self): + """Gets the response of this Rpc. # noqa: E501 + + + :return: The response of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._response + + @response.setter + def response(self, response): + """Sets the response of this Rpc. + + + :param response: The response of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._response = response + + @property + def status(self): + """Gets the status of this Rpc. # noqa: E501 + + The current status of the RPC call. # noqa: E501 + + :return: The status of this Rpc. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Rpc. + + The current status of the RPC call. # noqa: E501 + + :param status: The status of this Rpc. # noqa: E501 + :type: str + """ + allowed_values = ["DELETED", "DELIVERED", "EXPIRED", "FAILED", "QUEUED", "SENT", "SUCCESSFUL", "TIMEOUT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def additional_info(self): + """Gets the additional_info of this Rpc. # noqa: E501 + + + :return: The additional_info of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Rpc. + + + :param additional_info: The additional_info of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Rpc, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Rpc): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rpc_id.py b/billinglayer/python/tb_rest_client/models/models_ce/rpc_id.py new file mode 100644 index 0000000..36ac7ee --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rpc_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RpcId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RpcId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RpcId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RpcId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RpcId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RpcId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RpcId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RpcId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RpcId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RpcId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RPC"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RpcId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RpcId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rpklw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_ce/rpklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..941bf21 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rpklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RPKLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """RPKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this RPKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this RPKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this RPKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this RPKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this RPKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this RPKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RPKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RPKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain.py new file mode 100644 index 0000000..49d0d88 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain.py @@ -0,0 +1,376 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'id': 'RuleChainId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'type': 'str', + 'first_rule_node_id': 'RuleNodeId', + 'root': 'bool', + 'debug_mode': 'bool', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'type': 'type', + 'first_rule_node_id': 'firstRuleNodeId', + 'root': 'root', + 'debug_mode': 'debugMode', + 'configuration': 'configuration' + } + + def __init__(self, additional_info=None, id=None, created_time=None, tenant_id=None, name=None, type=None, first_rule_node_id=None, root=None, debug_mode=None, configuration=None): # noqa: E501 + """RuleChain - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._type = None + self._first_rule_node_id = None + self._root = None + self._debug_mode = None + self._configuration = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + self.tenant_id = tenant_id + self.name = name + if type is not None: + self.type = type + if first_rule_node_id is not None: + self.first_rule_node_id = first_rule_node_id + if root is not None: + self.root = root + if debug_mode is not None: + self.debug_mode = debug_mode + if configuration is not None: + self.configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this RuleChain. # noqa: E501 + + + :return: The additional_info of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChain. + + + :param additional_info: The additional_info of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def id(self): + """Gets the id of this RuleChain. # noqa: E501 + + + :return: The id of this RuleChain. # noqa: E501 + :rtype: RuleChainId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChain. + + + :param id: The id of this RuleChain. # noqa: E501 + :type: RuleChainId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleChain. # noqa: E501 + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleChain. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleChain. + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleChain. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this RuleChain. # noqa: E501 + + + :return: The tenant_id of this RuleChain. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this RuleChain. + + + :param tenant_id: The tenant_id of this RuleChain. # noqa: E501 + :type: TenantId + """ + if tenant_id is None: + raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this RuleChain. # noqa: E501 + + Rule Chain name # noqa: E501 + + :return: The name of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleChain. + + Rule Chain name # noqa: E501 + + :param name: The name of this RuleChain. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this RuleChain. # noqa: E501 + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :return: The type of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChain. + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :param type: The type of this RuleChain. # noqa: E501 + :type: str + """ + allowed_values = ["CORE", "EDGE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def first_rule_node_id(self): + """Gets the first_rule_node_id of this RuleChain. # noqa: E501 + + + :return: The first_rule_node_id of this RuleChain. # noqa: E501 + :rtype: RuleNodeId + """ + return self._first_rule_node_id + + @first_rule_node_id.setter + def first_rule_node_id(self, first_rule_node_id): + """Sets the first_rule_node_id of this RuleChain. + + + :param first_rule_node_id: The first_rule_node_id of this RuleChain. # noqa: E501 + :type: RuleNodeId + """ + + self._first_rule_node_id = first_rule_node_id + + @property + def root(self): + """Gets the root of this RuleChain. # noqa: E501 + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :return: The root of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._root + + @root.setter + def root(self, root): + """Sets the root of this RuleChain. + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :param root: The root of this RuleChain. # noqa: E501 + :type: bool + """ + + self._root = root + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleChain. # noqa: E501 + + Reserved for future usage. # noqa: E501 + + :return: The debug_mode of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleChain. + + Reserved for future usage. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleChain. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def configuration(self): + """Gets the configuration of this RuleChain. # noqa: E501 + + + :return: The configuration of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleChain. + + + :param configuration: The configuration of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_connection_info.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_connection_info.py new file mode 100644 index 0000000..a9c3afa --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_connection_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'target_rule_chain_id': 'RuleChainId', + 'additional_info': 'JsonNode', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'target_rule_chain_id': 'targetRuleChainId', + 'additional_info': 'additionalInfo', + 'type': 'type' + } + + def __init__(self, from_index=None, target_rule_chain_id=None, additional_info=None, type=None): # noqa: E501 + """RuleChainConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._target_rule_chain_id = None + self._additional_info = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.target_rule_chain_id = target_rule_chain_id + self.additional_info = additional_info + self.type = type + + @property + def from_index(self): + """Gets the from_index of this RuleChainConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this RuleChainConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def target_rule_chain_id(self): + """Gets the target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._target_rule_chain_id + + @target_rule_chain_id.setter + def target_rule_chain_id(self, target_rule_chain_id): + """Sets the target_rule_chain_id of this RuleChainConnectionInfo. + + + :param target_rule_chain_id: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :type: RuleChainId + """ + if target_rule_chain_id is None: + raise ValueError("Invalid value for `target_rule_chain_id`, must not be `None`") # noqa: E501 + + self._target_rule_chain_id = target_rule_chain_id + + @property + def additional_info(self): + """Gets the additional_info of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChainConnectionInfo. + + + :param additional_info: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def type(self): + """Gets the type of this RuleChainConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this RuleChainConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChainConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this RuleChainConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_data.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_data.py new file mode 100644 index 0000000..f165612 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_data.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chains': 'list[RuleChain]', + 'metadata': 'list[RuleChainMetaData]' + } + + attribute_map = { + 'rule_chains': 'ruleChains', + 'metadata': 'metadata' + } + + def __init__(self, rule_chains=None, metadata=None): # noqa: E501 + """RuleChainData - a model defined in Swagger""" # noqa: E501 + self._rule_chains = None + self._metadata = None + self.discriminator = None + self.rule_chains = rule_chains + self.metadata = metadata + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleChainData. # noqa: E501 + + List of the Rule Chain objects. # noqa: E501 + + :return: The rule_chains of this RuleChainData. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleChainData. + + List of the Rule Chain objects. # noqa: E501 + + :param rule_chains: The rule_chains of this RuleChainData. # noqa: E501 + :type: list[RuleChain] + """ + if rule_chains is None: + raise ValueError("Invalid value for `rule_chains`, must not be `None`") # noqa: E501 + + self._rule_chains = rule_chains + + @property + def metadata(self): + """Gets the metadata of this RuleChainData. # noqa: E501 + + List of the Rule Chain metadata objects. # noqa: E501 + + :return: The metadata of this RuleChainData. # noqa: E501 + :rtype: list[RuleChainMetaData] + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this RuleChainData. + + List of the Rule Chain metadata objects. # noqa: E501 + + :param metadata: The metadata of this RuleChainData. # noqa: E501 + :type: list[RuleChainMetaData] + """ + if metadata is None: + raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 + + self._metadata = metadata + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_debug_event_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_debug_event_filter.py new file mode 100644 index 0000000..bd222e3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_debug_event_filter.py @@ -0,0 +1,275 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class RuleChainDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'message': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'message': 'message', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, message=None, error_str=None, *args, **kwargs): # noqa: E501 + """RuleChainDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._message = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if message is not None: + self.message = message + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainDebugEventFilter. + + + :param error: The error of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleChainDebugEventFilter. + + + :param not_empty: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleChainDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleChainDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def message(self): + """Gets the message of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the message # noqa: E501 + + :return: The message of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this RuleChainDebugEventFilter. + + String value representing the message # noqa: E501 + + :param message: The message of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_str(self): + """Gets the error_str of this RuleChainDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleChainDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_export_data.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_export_data.py new file mode 100644 index 0000000..dad52aa --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class RuleChainExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'RuleChain', + 'entity_type': 'str', + 'meta_data': 'RuleChainMetaData', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'meta_data': 'metaData', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, meta_data=None, relations=None, *args, **kwargs): # noqa: E501 + """RuleChainExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._meta_data = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if meta_data is not None: + self.meta_data = meta_data + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this RuleChainExportData. # noqa: E501 + + + :return: The attributes of this RuleChainExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this RuleChainExportData. + + + :param attributes: The attributes of this RuleChainExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this RuleChainExportData. # noqa: E501 + + + :return: The entity of this RuleChainExportData. # noqa: E501 + :rtype: RuleChain + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this RuleChainExportData. + + + :param entity: The entity of this RuleChainExportData. # noqa: E501 + :type: RuleChain + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainExportData. # noqa: E501 + + + :return: The entity_type of this RuleChainExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainExportData. + + + :param entity_type: The entity_type of this RuleChainExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def meta_data(self): + """Gets the meta_data of this RuleChainExportData. # noqa: E501 + + + :return: The meta_data of this RuleChainExportData. # noqa: E501 + :rtype: RuleChainMetaData + """ + return self._meta_data + + @meta_data.setter + def meta_data(self, meta_data): + """Sets the meta_data of this RuleChainExportData. + + + :param meta_data: The meta_data of this RuleChainExportData. # noqa: E501 + :type: RuleChainMetaData + """ + + self._meta_data = meta_data + + @property + def relations(self): + """Gets the relations of this RuleChainExportData. # noqa: E501 + + + :return: The relations of this RuleChainExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this RuleChainExportData. + + + :param relations: The relations of this RuleChainExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_id.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_id.py new file mode 100644 index 0000000..a0dfb64 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleChainId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleChainId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChainId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleChainId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleChainId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_CHAIN"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_import_result.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_import_result.py new file mode 100644 index 0000000..2b929d3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_import_result.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainImportResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'rule_chain_id': 'RuleChainId', + 'rule_chain_name': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'error': 'error', + 'rule_chain_id': 'ruleChainId', + 'rule_chain_name': 'ruleChainName', + 'updated': 'updated' + } + + def __init__(self, error=None, rule_chain_id=None, rule_chain_name=None, updated=None): # noqa: E501 + """RuleChainImportResult - a model defined in Swagger""" # noqa: E501 + self._error = None + self._rule_chain_id = None + self._rule_chain_name = None + self._updated = None + self.discriminator = None + if error is not None: + self.error = error + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if rule_chain_name is not None: + self.rule_chain_name = rule_chain_name + if updated is not None: + self.updated = updated + + @property + def error(self): + """Gets the error of this RuleChainImportResult. # noqa: E501 + + + :return: The error of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainImportResult. + + + :param error: The error of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainImportResult. + + + :param rule_chain_id: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainImportResult. + + + :param rule_chain_name: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._rule_chain_name = rule_chain_name + + @property + def updated(self): + """Gets the updated of this RuleChainImportResult. # noqa: E501 + + + :return: The updated of this RuleChainImportResult. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this RuleChainImportResult. + + + :param updated: The updated of this RuleChainImportResult. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainImportResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainImportResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_meta_data.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_meta_data.py new file mode 100644 index 0000000..2b403a9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_meta_data.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainMetaData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'first_node_index': 'int', + 'nodes': 'list[RuleNode]', + 'connections': 'list[NodeConnectionInfo]', + 'rule_chain_connections': 'list[RuleChainConnectionInfo]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'first_node_index': 'firstNodeIndex', + 'nodes': 'nodes', + 'connections': 'connections', + 'rule_chain_connections': 'ruleChainConnections' + } + + def __init__(self, rule_chain_id=None, first_node_index=None, nodes=None, connections=None, rule_chain_connections=None): # noqa: E501 + """RuleChainMetaData - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._first_node_index = None + self._nodes = None + self._connections = None + self._rule_chain_connections = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.first_node_index = first_node_index + self.nodes = nodes + self.connections = connections + self.rule_chain_connections = rule_chain_connections + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainMetaData. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainMetaData. + + + :param rule_chain_id: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def first_node_index(self): + """Gets the first_node_index of this RuleChainMetaData. # noqa: E501 + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :return: The first_node_index of this RuleChainMetaData. # noqa: E501 + :rtype: int + """ + return self._first_node_index + + @first_node_index.setter + def first_node_index(self, first_node_index): + """Sets the first_node_index of this RuleChainMetaData. + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :param first_node_index: The first_node_index of this RuleChainMetaData. # noqa: E501 + :type: int + """ + if first_node_index is None: + raise ValueError("Invalid value for `first_node_index`, must not be `None`") # noqa: E501 + + self._first_node_index = first_node_index + + @property + def nodes(self): + """Gets the nodes of this RuleChainMetaData. # noqa: E501 + + List of rule node JSON objects # noqa: E501 + + :return: The nodes of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleNode] + """ + return self._nodes + + @nodes.setter + def nodes(self, nodes): + """Sets the nodes of this RuleChainMetaData. + + List of rule node JSON objects # noqa: E501 + + :param nodes: The nodes of this RuleChainMetaData. # noqa: E501 + :type: list[RuleNode] + """ + if nodes is None: + raise ValueError("Invalid value for `nodes`, must not be `None`") # noqa: E501 + + self._nodes = nodes + + @property + def connections(self): + """Gets the connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :return: The connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[NodeConnectionInfo] + """ + return self._connections + + @connections.setter + def connections(self, connections): + """Sets the connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :param connections: The connections of this RuleChainMetaData. # noqa: E501 + :type: list[NodeConnectionInfo] + """ + if connections is None: + raise ValueError("Invalid value for `connections`, must not be `None`") # noqa: E501 + + self._connections = connections + + @property + def rule_chain_connections(self): + """Gets the rule_chain_connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :return: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleChainConnectionInfo] + """ + return self._rule_chain_connections + + @rule_chain_connections.setter + def rule_chain_connections(self, rule_chain_connections): + """Sets the rule_chain_connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :param rule_chain_connections: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :type: list[RuleChainConnectionInfo] + """ + if rule_chain_connections is None: + raise ValueError("Invalid value for `rule_chain_connections`, must not be `None`") # noqa: E501 + + self._rule_chain_connections = rule_chain_connections + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainMetaData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainMetaData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_output_labels_usage.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_output_labels_usage.py new file mode 100644 index 0000000..828d15f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_chain_output_labels_usage.py @@ -0,0 +1,239 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainOutputLabelsUsage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'rule_node_id': 'RuleNodeId', + 'rule_chain_name': 'str', + 'rule_node_name': 'str', + 'labels': 'list[str]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'rule_node_id': 'ruleNodeId', + 'rule_chain_name': 'ruleChainName', + 'rule_node_name': 'ruleNodeName', + 'labels': 'labels' + } + + def __init__(self, rule_chain_id=None, rule_node_id=None, rule_chain_name=None, rule_node_name=None, labels=None): # noqa: E501 + """RuleChainOutputLabelsUsage - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._rule_node_id = None + self._rule_chain_name = None + self._rule_node_name = None + self._labels = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.rule_node_id = rule_node_id + self.rule_chain_name = rule_chain_name + self.rule_node_name = rule_node_name + self.labels = labels + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainOutputLabelsUsage. + + + :param rule_chain_id: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def rule_node_id(self): + """Gets the rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleNodeId + """ + return self._rule_node_id + + @rule_node_id.setter + def rule_node_id(self, rule_node_id): + """Sets the rule_node_id of this RuleChainOutputLabelsUsage. + + + :param rule_node_id: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleNodeId + """ + if rule_node_id is None: + raise ValueError("Invalid value for `rule_node_id`, must not be `None`") # noqa: E501 + + self._rule_node_id = rule_node_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Chain Name # noqa: E501 + + :return: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainOutputLabelsUsage. + + Rule Chain Name # noqa: E501 + + :param rule_chain_name: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_chain_name is None: + raise ValueError("Invalid value for `rule_chain_name`, must not be `None`") # noqa: E501 + + self._rule_chain_name = rule_chain_name + + @property + def rule_node_name(self): + """Gets the rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Node Name # noqa: E501 + + :return: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_node_name + + @rule_node_name.setter + def rule_node_name(self, rule_node_name): + """Sets the rule_node_name of this RuleChainOutputLabelsUsage. + + Rule Node Name # noqa: E501 + + :param rule_node_name: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_node_name is None: + raise ValueError("Invalid value for `rule_node_name`, must not be `None`") # noqa: E501 + + self._rule_node_name = rule_node_name + + @property + def labels(self): + """Gets the labels of this RuleChainOutputLabelsUsage. # noqa: E501 + + Output labels # noqa: E501 + + :return: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: list[str] + """ + return self._labels + + @labels.setter + def labels(self, labels): + """Sets the labels of this RuleChainOutputLabelsUsage. + + Output labels # noqa: E501 + + :param labels: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: list[str] + """ + if labels is None: + raise ValueError("Invalid value for `labels`, must not be `None`") # noqa: E501 + + self._labels = labels + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainOutputLabelsUsage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainOutputLabelsUsage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py new file mode 100644 index 0000000..c293401 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'only_rule_chain_lifecycle_failures': 'bool', + 'only_rule_node_lifecycle_failures': 'bool', + 'rule_chain_events': 'list[str]', + 'rule_chains': 'list[str]', + 'rule_node_events': 'list[str]', + 'track_rule_node_events': 'bool', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'only_rule_chain_lifecycle_failures': 'onlyRuleChainLifecycleFailures', + 'only_rule_node_lifecycle_failures': 'onlyRuleNodeLifecycleFailures', + 'rule_chain_events': 'ruleChainEvents', + 'rule_chains': 'ruleChains', + 'rule_node_events': 'ruleNodeEvents', + 'track_rule_node_events': 'trackRuleNodeEvents', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, only_rule_chain_lifecycle_failures=None, only_rule_node_lifecycle_failures=None, rule_chain_events=None, rule_chains=None, rule_node_events=None, track_rule_node_events=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._only_rule_chain_lifecycle_failures = None + self._only_rule_node_lifecycle_failures = None + self._rule_chain_events = None + self._rule_chains = None + self._rule_node_events = None + self._track_rule_node_events = None + self._trigger_type = None + self.discriminator = None + if only_rule_chain_lifecycle_failures is not None: + self.only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + if only_rule_node_lifecycle_failures is not None: + self.only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + if rule_chain_events is not None: + self.rule_chain_events = rule_chain_events + if rule_chains is not None: + self.rule_chains = rule_chains + if rule_node_events is not None: + self.rule_node_events = rule_node_events + if track_rule_node_events is not None: + self.track_rule_node_events = track_rule_node_events + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def only_rule_chain_lifecycle_failures(self): + """Gets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_chain_lifecycle_failures + + @only_rule_chain_lifecycle_failures.setter + def only_rule_chain_lifecycle_failures(self, only_rule_chain_lifecycle_failures): + """Sets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_chain_lifecycle_failures: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + + @property + def only_rule_node_lifecycle_failures(self): + """Gets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_node_lifecycle_failures + + @only_rule_node_lifecycle_failures.setter + def only_rule_node_lifecycle_failures(self, only_rule_node_lifecycle_failures): + """Sets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_node_lifecycle_failures: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + + @property + def rule_chain_events(self): + """Gets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chain_events + + @rule_chain_events.setter + def rule_chain_events(self, rule_chain_events): + """Sets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chain_events: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_chain_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_chain_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_chain_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_chain_events = rule_chain_events + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chains: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._rule_chains = rule_chains + + @property + def rule_node_events(self): + """Gets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_node_events + + @rule_node_events.setter + def rule_node_events(self, rule_node_events): + """Sets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_node_events: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_node_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_node_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_node_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_node_events = rule_node_events + + @property + def track_rule_node_events(self): + """Gets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._track_rule_node_events + + @track_rule_node_events.setter + def track_rule_node_events(self, track_rule_node_events): + """Sets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param track_rule_node_events: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._track_rule_node_events = track_rule_node_events + + @property + def trigger_type(self): + """Gets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_node.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_node.py new file mode 100644 index 0000000..60ec592 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_node.py @@ -0,0 +1,368 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'RuleNodeId', + 'id': 'RuleNodeId', + 'created_time': 'int', + 'rule_chain_id': 'RuleChainId', + 'type': 'str', + 'name': 'str', + 'debug_mode': 'bool', + 'singleton_mode': 'bool', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'external_id': 'externalId', + 'id': 'id', + 'created_time': 'createdTime', + 'rule_chain_id': 'ruleChainId', + 'type': 'type', + 'name': 'name', + 'debug_mode': 'debugMode', + 'singleton_mode': 'singletonMode', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration' + } + + def __init__(self, external_id=None, id=None, created_time=None, rule_chain_id=None, type=None, name=None, debug_mode=None, singleton_mode=None, additional_info=None, configuration=None): # noqa: E501 + """RuleNode - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self._id = None + self._created_time = None + self._rule_chain_id = None + self._type = None + self._name = None + self._debug_mode = None + self._singleton_mode = None + self._additional_info = None + self._configuration = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if type is not None: + self.type = type + if name is not None: + self.name = name + if debug_mode is not None: + self.debug_mode = debug_mode + if singleton_mode is not None: + self.singleton_mode = singleton_mode + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + + @property + def external_id(self): + """Gets the external_id of this RuleNode. # noqa: E501 + + + :return: The external_id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this RuleNode. + + + :param external_id: The external_id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._external_id = external_id + + @property + def id(self): + """Gets the id of this RuleNode. # noqa: E501 + + + :return: The id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNode. + + + :param id: The id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleNode. # noqa: E501 + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleNode. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleNode. + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleNode. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleNode. # noqa: E501 + + + :return: The rule_chain_id of this RuleNode. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleNode. + + + :param rule_chain_id: The rule_chain_id of this RuleNode. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def type(self): + """Gets the type of this RuleNode. # noqa: E501 + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :return: The type of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleNode. + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :param type: The type of this RuleNode. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def name(self): + """Gets the name of this RuleNode. # noqa: E501 + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :return: The name of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleNode. + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :param name: The name of this RuleNode. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleNode. # noqa: E501 + + Enable/disable debug. # noqa: E501 + + :return: The debug_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleNode. + + Enable/disable debug. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def singleton_mode(self): + """Gets the singleton_mode of this RuleNode. # noqa: E501 + + Enable/disable singleton mode. # noqa: E501 + + :return: The singleton_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._singleton_mode + + @singleton_mode.setter + def singleton_mode(self, singleton_mode): + """Sets the singleton_mode of this RuleNode. + + Enable/disable singleton mode. # noqa: E501 + + :param singleton_mode: The singleton_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._singleton_mode = singleton_mode + + @property + def additional_info(self): + """Gets the additional_info of this RuleNode. # noqa: E501 + + + :return: The additional_info of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleNode. + + + :param additional_info: The additional_info of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this RuleNode. # noqa: E501 + + + :return: The configuration of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleNode. + + + :param configuration: The configuration of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_node_debug_event_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_node_debug_event_filter.py new file mode 100644 index 0000000..c3cfe90 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_node_debug_event_filter.py @@ -0,0 +1,483 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class RuleNodeDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'msg_direction_type': 'str', + 'entity_id': 'str', + 'entity_type': 'str', + 'msg_id': 'str', + 'msg_type': 'str', + 'relation_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'msg_direction_type': 'msgDirectionType', + 'entity_id': 'entityId', + 'entity_type': 'entityType', + 'msg_id': 'msgId', + 'msg_type': 'msgType', + 'relation_type': 'relationType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, msg_direction_type=None, entity_id=None, entity_type=None, msg_id=None, msg_type=None, relation_type=None, data_search=None, metadata_search=None, error_str=None, *args, **kwargs): # noqa: E501 + """RuleNodeDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._msg_direction_type = None + self._entity_id = None + self._entity_type = None + self._msg_id = None + self._msg_type = None + self._relation_type = None + self._data_search = None + self._metadata_search = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if entity_id is not None: + self.entity_id = entity_id + if entity_type is not None: + self.entity_type = entity_type + if msg_id is not None: + self.msg_id = msg_id + if msg_type is not None: + self.msg_type = msg_type + if relation_type is not None: + self.relation_type = relation_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleNodeDebugEventFilter. + + + :param error: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleNodeDebugEventFilter. + + + :param not_empty: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleNodeDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleNodeDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this RuleNodeDebugEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def entity_id(self): + """Gets the entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this RuleNodeDebugEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeDebugEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def msg_id(self): + """Gets the msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message id in the rule engine # noqa: E501 + + :return: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_id + + @msg_id.setter + def msg_id(self, msg_id): + """Sets the msg_id of this RuleNodeDebugEventFilter. + + String value representing the message id in the rule engine # noqa: E501 + + :param msg_id: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_id = msg_id + + @property + def msg_type(self): + """Gets the msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this RuleNodeDebugEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + @property + def relation_type(self): + """Gets the relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RuleNodeDebugEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def data_search(self): + """Gets the data_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def error_str(self): + """Gets the error_str of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/rule_node_id.py b/billinglayer/python/tb_rest_client/models/models_ce/rule_node_id.py new file mode 100644 index 0000000..2f39342 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/rule_node_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNodeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleNodeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleNodeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNodeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleNodeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_NODE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/save_device_with_credentials_request.py b/billinglayer/python/tb_rest_client/models/models_ce/save_device_with_credentials_request.py new file mode 100644 index 0000000..308f950 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/save_device_with_credentials_request.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveDeviceWithCredentialsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device': 'Device', + 'credentials': 'DeviceCredentials' + } + + attribute_map = { + 'device': 'device', + 'credentials': 'credentials' + } + + def __init__(self, device=None, credentials=None): # noqa: E501 + """SaveDeviceWithCredentialsRequest - a model defined in Swagger""" # noqa: E501 + self._device = None + self._credentials = None + self.discriminator = None + self.device = device + self.credentials = credentials + + @property + def device(self): + """Gets the device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: Device + """ + return self._device + + @device.setter + def device(self, device): + """Sets the device of this SaveDeviceWithCredentialsRequest. + + + :param device: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: Device + """ + if device is None: + raise ValueError("Invalid value for `device`, must not be `None`") # noqa: E501 + + self._device = device + + @property + def credentials(self): + """Gets the credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this SaveDeviceWithCredentialsRequest. + + + :param credentials: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: DeviceCredentials + """ + if credentials is None: + raise ValueError("Invalid value for `credentials`, must not be `None`") # noqa: E501 + + self._credentials = credentials + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveDeviceWithCredentialsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveDeviceWithCredentialsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/save_ota_package_info_request.py b/billinglayer/python/tb_rest_client/models/models_ce/save_ota_package_info_request.py new file mode 100644 index 0000000..f7b9c61 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/save_ota_package_info_request.py @@ -0,0 +1,578 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveOtaPackageInfoRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'uses_url': 'bool', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'uses_url': 'usesUrl', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, uses_url=None, additional_info=None): # noqa: E501 + """SaveOtaPackageInfoRequest - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._uses_url = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if uses_url is not None: + self.uses_url = uses_url + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SaveOtaPackageInfoRequest. + + + :param id: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SaveOtaPackageInfoRequest. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SaveOtaPackageInfoRequest. + + + :param tenant_id: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this SaveOtaPackageInfoRequest. + + + :param device_profile_id: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SaveOtaPackageInfoRequest. + + OTA Package type. # noqa: E501 + + :param type: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SaveOtaPackageInfoRequest. + + OTA Package title. # noqa: E501 + + :param title: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this SaveOtaPackageInfoRequest. + + OTA Package version. # noqa: E501 + + :param version: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this SaveOtaPackageInfoRequest. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this SaveOtaPackageInfoRequest. + + OTA Package url. # noqa: E501 + + :param url: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this SaveOtaPackageInfoRequest. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this SaveOtaPackageInfoRequest. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this SaveOtaPackageInfoRequest. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this SaveOtaPackageInfoRequest. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this SaveOtaPackageInfoRequest. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this SaveOtaPackageInfoRequest. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def uses_url(self): + """Gets the uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :return: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._uses_url + + @uses_url.setter + def uses_url(self, uses_url): + """Sets the uses_url of this SaveOtaPackageInfoRequest. + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :param uses_url: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._uses_url = uses_url + + @property + def additional_info(self): + """Gets the additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SaveOtaPackageInfoRequest. + + + :param additional_info: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveOtaPackageInfoRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveOtaPackageInfoRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/security_settings.py b/billinglayer/python/tb_rest_client/models/models_ce/security_settings.py new file mode 100644 index 0000000..3efbd69 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/security_settings.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SecuritySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password_policy': 'UserPasswordPolicy', + 'max_failed_login_attempts': 'int', + 'user_lockout_notification_email': 'str' + } + + attribute_map = { + 'password_policy': 'passwordPolicy', + 'max_failed_login_attempts': 'maxFailedLoginAttempts', + 'user_lockout_notification_email': 'userLockoutNotificationEmail' + } + + def __init__(self, password_policy=None, max_failed_login_attempts=None, user_lockout_notification_email=None): # noqa: E501 + """SecuritySettings - a model defined in Swagger""" # noqa: E501 + self._password_policy = None + self._max_failed_login_attempts = None + self._user_lockout_notification_email = None + self.discriminator = None + if password_policy is not None: + self.password_policy = password_policy + if max_failed_login_attempts is not None: + self.max_failed_login_attempts = max_failed_login_attempts + if user_lockout_notification_email is not None: + self.user_lockout_notification_email = user_lockout_notification_email + + @property + def password_policy(self): + """Gets the password_policy of this SecuritySettings. # noqa: E501 + + + :return: The password_policy of this SecuritySettings. # noqa: E501 + :rtype: UserPasswordPolicy + """ + return self._password_policy + + @password_policy.setter + def password_policy(self, password_policy): + """Sets the password_policy of this SecuritySettings. + + + :param password_policy: The password_policy of this SecuritySettings. # noqa: E501 + :type: UserPasswordPolicy + """ + + self._password_policy = password_policy + + @property + def max_failed_login_attempts(self): + """Gets the max_failed_login_attempts of this SecuritySettings. # noqa: E501 + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :return: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :rtype: int + """ + return self._max_failed_login_attempts + + @max_failed_login_attempts.setter + def max_failed_login_attempts(self, max_failed_login_attempts): + """Sets the max_failed_login_attempts of this SecuritySettings. + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :param max_failed_login_attempts: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :type: int + """ + + self._max_failed_login_attempts = max_failed_login_attempts + + @property + def user_lockout_notification_email(self): + """Gets the user_lockout_notification_email of this SecuritySettings. # noqa: E501 + + Email to use for notifications about locked users. # noqa: E501 + + :return: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :rtype: str + """ + return self._user_lockout_notification_email + + @user_lockout_notification_email.setter + def user_lockout_notification_email(self, user_lockout_notification_email): + """Sets the user_lockout_notification_email of this SecuritySettings. + + Email to use for notifications about locked users. # noqa: E501 + + :param user_lockout_notification_email: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :type: str + """ + + self._user_lockout_notification_email = user_lockout_notification_email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SecuritySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SecuritySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/server_security_config.py b/billinglayer/python/tb_rest_client/models/models_ce/server_security_config.py new file mode 100644 index 0000000..c3c48d1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/server_security_config.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ServerSecurityConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap_server_account_timeout': 'int', + 'bootstrap_server_is': 'bool', + 'client_hold_off_time': 'int', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'server_id': 'int', + 'server_public_key': 'str' + } + + attribute_map = { + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'bootstrap_server_is': 'bootstrapServerIs', + 'client_hold_off_time': 'clientHoldOffTime', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'server_id': 'serverId', + 'server_public_key': 'serverPublicKey' + } + + def __init__(self, bootstrap_server_account_timeout=None, bootstrap_server_is=None, client_hold_off_time=None, host=None, port=None, security_host=None, security_port=None, server_id=None, server_public_key=None): # noqa: E501 + """ServerSecurityConfig - a model defined in Swagger""" # noqa: E501 + self._bootstrap_server_account_timeout = None + self._bootstrap_server_is = None + self._client_hold_off_time = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._server_id = None + self._server_public_key = None + self.discriminator = None + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if server_id is not None: + self.server_id = server_id + if server_public_key is not None: + self.server_public_key = server_public_key + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + + + :return: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this ServerSecurityConfig. + + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + + + :return: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this ServerSecurityConfig. + + + :param bootstrap_server_is: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + + + :return: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this ServerSecurityConfig. + + + :param client_hold_off_time: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def host(self): + """Gets the host of this ServerSecurityConfig. # noqa: E501 + + + :return: The host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this ServerSecurityConfig. + + + :param host: The host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this ServerSecurityConfig. # noqa: E501 + + + :return: The port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this ServerSecurityConfig. + + + :param port: The port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this ServerSecurityConfig. # noqa: E501 + + + :return: The security_host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this ServerSecurityConfig. + + + :param security_host: The security_host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this ServerSecurityConfig. # noqa: E501 + + + :return: The security_port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this ServerSecurityConfig. + + + :param security_port: The security_port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def server_id(self): + """Gets the server_id of this ServerSecurityConfig. # noqa: E501 + + + :return: The server_id of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._server_id + + @server_id.setter + def server_id(self, server_id): + """Sets the server_id of this ServerSecurityConfig. + + + :param server_id: The server_id of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._server_id = server_id + + @property + def server_public_key(self): + """Gets the server_public_key of this ServerSecurityConfig. # noqa: E501 + + + :return: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this ServerSecurityConfig. + + + :param server_public_key: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ServerSecurityConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ServerSecurityConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/shared_attributes_setting_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_ce/shared_attributes_setting_snmp_communication_config.py new file mode 100644 index 0000000..a5ecd11 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/shared_attributes_setting_snmp_communication_config.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class SharedAttributesSettingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, spec=None, *args, **kwargs): # noqa: E501 + """SharedAttributesSettingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param mappings: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param spec: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SharedAttributesSettingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SharedAttributesSettingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/short_customer_info.py b/billinglayer/python/tb_rest_client/models/models_ce/short_customer_info.py new file mode 100644 index 0000000..60efb00 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/short_customer_info.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShortCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'customer_id': 'CustomerId', + 'title': 'str' + } + + attribute_map = { + 'public': 'public', + 'customer_id': 'customerId', + 'title': 'title' + } + + def __init__(self, public=None, customer_id=None, title=None): # noqa: E501 + """ShortCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._public = None + self._customer_id = None + self._title = None + self.discriminator = None + if public is not None: + self.public = public + if customer_id is not None: + self.customer_id = customer_id + if title is not None: + self.title = title + + @property + def public(self): + """Gets the public of this ShortCustomerInfo. # noqa: E501 + + + :return: The public of this ShortCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this ShortCustomerInfo. + + + :param public: The public of this ShortCustomerInfo. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def customer_id(self): + """Gets the customer_id of this ShortCustomerInfo. # noqa: E501 + + + :return: The customer_id of this ShortCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ShortCustomerInfo. + + + :param customer_id: The customer_id of this ShortCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def title(self): + """Gets the title of this ShortCustomerInfo. # noqa: E501 + + Title of the customer. # noqa: E501 + + :return: The title of this ShortCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this ShortCustomerInfo. + + Title of the customer. # noqa: E501 + + :param title: The title of this ShortCustomerInfo. # noqa: E501 + :type: str + """ + + self._title = title + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShortCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShortCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/sign_up_request.py b/billinglayer/python/tb_rest_client/models/models_ce/sign_up_request.py new file mode 100644 index 0000000..62c08a6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/sign_up_request.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SignUpRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'app_secret': 'str', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'password': 'str', + 'pkg_name': 'str', + 'recaptcha_response': 'str' + } + + attribute_map = { + 'app_secret': 'appSecret', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'password': 'password', + 'pkg_name': 'pkgName', + 'recaptcha_response': 'recaptchaResponse' + } + + def __init__(self, app_secret=None, email=None, first_name=None, last_name=None, password=None, pkg_name=None, recaptcha_response=None): # noqa: E501 + """SignUpRequest - a model defined in Swagger""" # noqa: E501 + self._app_secret = None + self._email = None + self._first_name = None + self._last_name = None + self._password = None + self._pkg_name = None + self._recaptcha_response = None + self.discriminator = None + if app_secret is not None: + self.app_secret = app_secret + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if password is not None: + self.password = password + if pkg_name is not None: + self.pkg_name = pkg_name + if recaptcha_response is not None: + self.recaptcha_response = recaptcha_response + + @property + def app_secret(self): + """Gets the app_secret of this SignUpRequest. # noqa: E501 + + + :return: The app_secret of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this SignUpRequest. + + + :param app_secret: The app_secret of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._app_secret = app_secret + + @property + def email(self): + """Gets the email of this SignUpRequest. # noqa: E501 + + + :return: The email of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SignUpRequest. + + + :param email: The email of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this SignUpRequest. # noqa: E501 + + + :return: The first_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this SignUpRequest. + + + :param first_name: The first_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this SignUpRequest. # noqa: E501 + + + :return: The last_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this SignUpRequest. + + + :param last_name: The last_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def password(self): + """Gets the password of this SignUpRequest. # noqa: E501 + + + :return: The password of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SignUpRequest. + + + :param password: The password of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def pkg_name(self): + """Gets the pkg_name of this SignUpRequest. # noqa: E501 + + + :return: The pkg_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this SignUpRequest. + + + :param pkg_name: The pkg_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._pkg_name = pkg_name + + @property + def recaptcha_response(self): + """Gets the recaptcha_response of this SignUpRequest. # noqa: E501 + + + :return: The recaptcha_response of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._recaptcha_response + + @recaptcha_response.setter + def recaptcha_response(self, recaptcha_response): + """Sets the recaptcha_response of this SignUpRequest. + + + :param recaptcha_response: The recaptcha_response of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._recaptcha_response = recaptcha_response + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SignUpRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SignUpRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/simple_alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_ce/simple_alarm_condition_spec.py new file mode 100644 index 0000000..67831b8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/simple_alarm_condition_spec.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class SimpleAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """SimpleAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + AlarmConditionSpec.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SimpleAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SimpleAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other + + +if __name__ == '__main__': + SimpleAlarmConditionSpec() diff --git a/billinglayer/python/tb_rest_client/models/models_ce/single_entity_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/single_entity_filter.py new file mode 100644 index 0000000..638d886 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/single_entity_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class SingleEntityFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'single_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'single_entity': 'singleEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, single_entity=None, *args, **kwargs): # noqa: E501 + """SingleEntityFilter - a model defined in Swagger""" # noqa: E501 + self._single_entity = None + self.discriminator = None + if single_entity is not None: + self.single_entity = single_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def single_entity(self): + """Gets the single_entity of this SingleEntityFilter. # noqa: E501 + + + :return: The single_entity of this SingleEntityFilter. # noqa: E501 + :rtype: EntityId + """ + return self._single_entity + + @single_entity.setter + def single_entity(self, single_entity): + """Sets the single_entity of this SingleEntityFilter. + + + :param single_entity: The single_entity of this SingleEntityFilter. # noqa: E501 + :type: EntityId + """ + + self._single_entity = single_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/single_entity_version_create_request.py b/billinglayer/python/tb_rest_client/models/models_ce/single_entity_version_create_request.py new file mode 100644 index 0000000..383912e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/single_entity_version_create_request.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class SingleEntityVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'config': 'VersionCreateConfig', + 'entity_id': 'EntityId', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'config': 'config', + 'entity_id': 'entityId', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, config=None, entity_id=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._config = None + self._entity_id = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if config is not None: + self.config = config + if entity_id is not None: + self.entity_id = entity_id + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this SingleEntityVersionCreateRequest. + + + :param branch: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def config(self): + """Gets the config of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: VersionCreateConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionCreateRequest. + + + :param config: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: VersionCreateConfig + """ + + self._config = config + + @property + def entity_id(self): + """Gets the entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this SingleEntityVersionCreateRequest. + + + :param entity_id: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionCreateRequest. + + + :param type: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this SingleEntityVersionCreateRequest. + + + :param version_name: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/single_entity_version_load_request.py b/billinglayer/python/tb_rest_client/models/models_ce/single_entity_version_load_request.py new file mode 100644 index 0000000..eed965c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/single_entity_version_load_request.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class SingleEntityVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'config': 'VersionLoadConfig', + 'external_entity_id': 'EntityId', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'config': 'config', + 'external_entity_id': 'externalEntityId', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, config=None, external_entity_id=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._config = None + self._external_entity_id = None + self._type = None + self._version_id = None + self.discriminator = None + if config is not None: + self.config = config + if external_entity_id is not None: + self.external_entity_id = external_entity_id + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def config(self): + """Gets the config of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: VersionLoadConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionLoadRequest. + + + :param config: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: VersionLoadConfig + """ + + self._config = config + + @property + def external_entity_id(self): + """Gets the external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: EntityId + """ + return self._external_entity_id + + @external_entity_id.setter + def external_entity_id(self, external_entity_id): + """Sets the external_entity_id of this SingleEntityVersionLoadRequest. + + + :param external_entity_id: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: EntityId + """ + + self._external_entity_id = external_entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionLoadRequest. + + + :param type: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this SingleEntityVersionLoadRequest. + + + :param version_id: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/slack_conversation.py b/billinglayer/python/tb_rest_client/models/models_ce/slack_conversation.py new file mode 100644 index 0000000..8e27a52 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/slack_conversation.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackConversation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'id': 'str', + 'name': 'str', + 'title': 'str', + 'type': 'str', + 'whole_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'id': 'id', + 'name': 'name', + 'title': 'title', + 'type': 'type', + 'whole_name': 'wholeName' + } + + def __init__(self, email=None, id=None, name=None, title=None, type=None, whole_name=None): # noqa: E501 + """SlackConversation - a model defined in Swagger""" # noqa: E501 + self._email = None + self._id = None + self._name = None + self._title = None + self._type = None + self._whole_name = None + self.discriminator = None + if email is not None: + self.email = email + if id is not None: + self.id = id + if name is not None: + self.name = name + if title is not None: + self.title = title + self.type = type + if whole_name is not None: + self.whole_name = whole_name + + @property + def email(self): + """Gets the email of this SlackConversation. # noqa: E501 + + + :return: The email of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SlackConversation. + + + :param email: The email of this SlackConversation. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def id(self): + """Gets the id of this SlackConversation. # noqa: E501 + + + :return: The id of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SlackConversation. + + + :param id: The id of this SlackConversation. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this SlackConversation. # noqa: E501 + + + :return: The name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SlackConversation. + + + :param name: The name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this SlackConversation. # noqa: E501 + + + :return: The title of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SlackConversation. + + + :param title: The title of this SlackConversation. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def type(self): + """Gets the type of this SlackConversation. # noqa: E501 + + + :return: The type of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SlackConversation. + + + :param type: The type of this SlackConversation. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def whole_name(self): + """Gets the whole_name of this SlackConversation. # noqa: E501 + + + :return: The whole_name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._whole_name + + @whole_name.setter + def whole_name(self, whole_name): + """Sets the whole_name of this SlackConversation. + + + :param whole_name: The whole_name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._whole_name = whole_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackConversation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackConversation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/slack_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_ce/slack_delivery_method_notification_template.py new file mode 100644 index 0000000..7eebc70 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/slack_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SlackDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SlackDeliveryMethodNotificationTemplate. + + + :param body: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SlackDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/slack_notification_delivery_method_config.py b/billinglayer/python/tb_rest_client/models/models_ce/slack_notification_delivery_method_config.py new file mode 100644 index 0000000..27d76f1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/slack_notification_delivery_method_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackNotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bot_token': 'str' + } + + attribute_map = { + 'bot_token': 'botToken' + } + + def __init__(self, bot_token=None): # noqa: E501 + """SlackNotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self._bot_token = None + self.discriminator = None + if bot_token is not None: + self.bot_token = bot_token + + @property + def bot_token(self): + """Gets the bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + + + :return: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :rtype: str + """ + return self._bot_token + + @bot_token.setter + def bot_token(self, bot_token): + """Sets the bot_token of this SlackNotificationDeliveryMethodConfig. + + + :param bot_token: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :type: str + """ + + self._bot_token = bot_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/slack_notification_target_config.py b/billinglayer/python/tb_rest_client/models/models_ce/slack_notification_target_config.py new file mode 100644 index 0000000..97949cd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/slack_notification_target_config.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class SlackNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'conversation': 'SlackConversation', + 'conversation_type': 'str', + 'description': 'str' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'conversation': 'conversation', + 'conversation_type': 'conversationType', + 'description': 'description' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, conversation=None, conversation_type=None, description=None, *args, **kwargs): # noqa: E501 + """SlackNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._conversation = None + self._conversation_type = None + self._description = None + self.discriminator = None + self.conversation = conversation + if conversation_type is not None: + self.conversation_type = conversation_type + if description is not None: + self.description = description + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def conversation(self): + """Gets the conversation of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: SlackConversation + """ + return self._conversation + + @conversation.setter + def conversation(self, conversation): + """Sets the conversation of this SlackNotificationTargetConfig. + + + :param conversation: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :type: SlackConversation + """ + if conversation is None: + raise ValueError("Invalid value for `conversation`, must not be `None`") # noqa: E501 + + self._conversation = conversation + + @property + def conversation_type(self): + """Gets the conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._conversation_type + + @conversation_type.setter + def conversation_type(self, conversation_type): + """Sets the conversation_type of this SlackNotificationTargetConfig. + + + :param conversation_type: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if conversation_type not in allowed_values: + raise ValueError( + "Invalid value for `conversation_type` ({0}), must be one of {1}" # noqa: E501 + .format(conversation_type, allowed_values) + ) + + self._conversation_type = conversation_type + + @property + def description(self): + """Gets the description of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The description of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this SlackNotificationTargetConfig. + + + :param description: The description of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/smpp_sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/smpp_sms_provider_configuration.py new file mode 100644 index 0000000..cf518df --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/smpp_sms_provider_configuration.py @@ -0,0 +1,541 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class SmppSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'address_range': 'str', + 'bind_type': 'str', + 'coding_scheme': 'str', + 'destination_npi': 'str', + 'destination_ton': 'str', + 'host': 'str', + 'password': 'str', + 'port': 'int', + 'protocol_version': 'str', + 'service_type': 'str', + 'source_address': 'str', + 'source_npi': 'str', + 'source_ton': 'str', + 'system_id': 'str', + 'system_type': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'address_range': 'addressRange', + 'bind_type': 'bindType', + 'coding_scheme': 'codingScheme', + 'destination_npi': 'destinationNpi', + 'destination_ton': 'destinationTon', + 'host': 'host', + 'password': 'password', + 'port': 'port', + 'protocol_version': 'protocolVersion', + 'service_type': 'serviceType', + 'source_address': 'sourceAddress', + 'source_npi': 'sourceNpi', + 'source_ton': 'sourceTon', + 'system_id': 'systemId', + 'system_type': 'systemType' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, address_range=None, bind_type=None, coding_scheme=None, destination_npi=None, destination_ton=None, host=None, password=None, port=None, protocol_version=None, service_type=None, source_address=None, source_npi=None, source_ton=None, system_id=None, system_type=None, *args, **kwargs): # noqa: E501 + """SmppSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._address_range = None + self._bind_type = None + self._coding_scheme = None + self._destination_npi = None + self._destination_ton = None + self._host = None + self._password = None + self._port = None + self._protocol_version = None + self._service_type = None + self._source_address = None + self._source_npi = None + self._source_ton = None + self._system_id = None + self._system_type = None + self.discriminator = None + if address_range is not None: + self.address_range = address_range + if bind_type is not None: + self.bind_type = bind_type + if coding_scheme is not None: + self.coding_scheme = coding_scheme + if destination_npi is not None: + self.destination_npi = destination_npi + if destination_ton is not None: + self.destination_ton = destination_ton + self.host = host + self.password = password + self.port = port + self.protocol_version = protocol_version + if service_type is not None: + self.service_type = service_type + if source_address is not None: + self.source_address = source_address + if source_npi is not None: + self.source_npi = source_npi + if source_ton is not None: + self.source_ton = source_ton + self.system_id = system_id + if system_type is not None: + self.system_type = system_type + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def address_range(self): + """Gets the address_range of this SmppSmsProviderConfiguration. # noqa: E501 + + Address range # noqa: E501 + + :return: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._address_range + + @address_range.setter + def address_range(self, address_range): + """Sets the address_range of this SmppSmsProviderConfiguration. + + Address range # noqa: E501 + + :param address_range: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._address_range = address_range + + @property + def bind_type(self): + """Gets the bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :return: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._bind_type + + @bind_type.setter + def bind_type(self, bind_type): + """Sets the bind_type of this SmppSmsProviderConfiguration. + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :param bind_type: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["RX", "TRX", "TX"] # noqa: E501 + if bind_type not in allowed_values: + raise ValueError( + "Invalid value for `bind_type` ({0}), must be one of {1}" # noqa: E501 + .format(bind_type, allowed_values) + ) + + self._bind_type = bind_type + + @property + def coding_scheme(self): + """Gets the coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :return: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._coding_scheme + + @coding_scheme.setter + def coding_scheme(self, coding_scheme): + """Sets the coding_scheme of this SmppSmsProviderConfiguration. + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :param coding_scheme: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._coding_scheme = coding_scheme + + @property + def destination_npi(self): + """Gets the destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_npi + + @destination_npi.setter + def destination_npi(self, destination_npi): + """Sets the destination_npi of this SmppSmsProviderConfiguration. + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param destination_npi: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_npi = destination_npi + + @property + def destination_ton(self): + """Gets the destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_ton + + @destination_ton.setter + def destination_ton(self, destination_ton): + """Sets the destination_ton of this SmppSmsProviderConfiguration. + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param destination_ton: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_ton = destination_ton + + @property + def host(self): + """Gets the host of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP host # noqa: E501 + + :return: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SmppSmsProviderConfiguration. + + SMPP host # noqa: E501 + + :param host: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if host is None: + raise ValueError("Invalid value for `host`, must not be `None`") # noqa: E501 + + self._host = host + + @property + def password(self): + """Gets the password of this SmppSmsProviderConfiguration. # noqa: E501 + + Password # noqa: E501 + + :return: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SmppSmsProviderConfiguration. + + Password # noqa: E501 + + :param password: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + @property + def port(self): + """Gets the port of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP port # noqa: E501 + + :return: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SmppSmsProviderConfiguration. + + SMPP port # noqa: E501 + + :param port: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :type: int + """ + if port is None: + raise ValueError("Invalid value for `port`, must not be `None`") # noqa: E501 + + self._port = port + + @property + def protocol_version(self): + """Gets the protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP version # noqa: E501 + + :return: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SmppSmsProviderConfiguration. + + SMPP version # noqa: E501 + + :param protocol_version: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if protocol_version is None: + raise ValueError("Invalid value for `protocol_version`, must not be `None`") # noqa: E501 + allowed_values = ["3.3", "3.4"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def service_type(self): + """Gets the service_type of this SmppSmsProviderConfiguration. # noqa: E501 + + Service type # noqa: E501 + + :return: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SmppSmsProviderConfiguration. + + Service type # noqa: E501 + + :param service_type: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def source_address(self): + """Gets the source_address of this SmppSmsProviderConfiguration. # noqa: E501 + + Source address # noqa: E501 + + :return: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_address + + @source_address.setter + def source_address(self, source_address): + """Sets the source_address of this SmppSmsProviderConfiguration. + + Source address # noqa: E501 + + :param source_address: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_address = source_address + + @property + def source_npi(self): + """Gets the source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_npi + + @source_npi.setter + def source_npi(self, source_npi): + """Sets the source_npi of this SmppSmsProviderConfiguration. + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param source_npi: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_npi = source_npi + + @property + def source_ton(self): + """Gets the source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_ton + + @source_ton.setter + def source_ton(self, source_ton): + """Sets the source_ton of this SmppSmsProviderConfiguration. + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param source_ton: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_ton = source_ton + + @property + def system_id(self): + """Gets the system_id of this SmppSmsProviderConfiguration. # noqa: E501 + + System ID # noqa: E501 + + :return: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_id + + @system_id.setter + def system_id(self, system_id): + """Sets the system_id of this SmppSmsProviderConfiguration. + + System ID # noqa: E501 + + :param system_id: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if system_id is None: + raise ValueError("Invalid value for `system_id`, must not be `None`") # noqa: E501 + + self._system_id = system_id + + @property + def system_type(self): + """Gets the system_type of this SmppSmsProviderConfiguration. # noqa: E501 + + System type # noqa: E501 + + :return: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_type + + @system_type.setter + def system_type(self, system_type): + """Sets the system_type of this SmppSmsProviderConfiguration. + + System type # noqa: E501 + + :param system_type: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._system_type = system_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmppSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmppSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/sms_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_ce/sms_delivery_method_notification_template.py new file mode 100644 index 0000000..d6b12b8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/sms_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SmsDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SmsDeliveryMethodNotificationTemplate. + + + :param body: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SmsDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/sms_provider_configuration.py new file mode 100644 index 0000000..1bb08b6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/sms_provider_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsProviderConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/sms_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_ce/sms_two_fa_account_config.py new file mode 100644 index 0000000..437a7de --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/sms_two_fa_account_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.two_fa_account_config import TwoFaAccountConfig # noqa: F401,E501 + +class SmsTwoFaAccountConfig(TwoFaAccountConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'phone_number': 'str', + 'use_by_default': 'bool' + } + if hasattr(TwoFaAccountConfig, "swagger_types"): + swagger_types.update(TwoFaAccountConfig.swagger_types) + + attribute_map = { + 'phone_number': 'phoneNumber', + 'use_by_default': 'useByDefault' + } + if hasattr(TwoFaAccountConfig, "attribute_map"): + attribute_map.update(TwoFaAccountConfig.attribute_map) + + def __init__(self, phone_number=None, use_by_default=None, *args, **kwargs): # noqa: E501 + """SmsTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._phone_number = None + self._use_by_default = None + self.discriminator = None + self.phone_number = phone_number + if use_by_default is not None: + self.use_by_default = use_by_default + TwoFaAccountConfig.__init__(self, *args, **kwargs) + + @property + def phone_number(self): + """Gets the phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._phone_number + + @phone_number.setter + def phone_number(self, phone_number): + """Sets the phone_number of this SmsTwoFaAccountConfig. + + + :param phone_number: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if phone_number is None: + raise ValueError("Invalid value for `phone_number`, must not be `None`") # noqa: E501 + + self._phone_number = phone_number + + @property + def use_by_default(self): + """Gets the use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this SmsTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/sms_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_ce/sms_two_fa_provider_config.py new file mode 100644 index 0000000..2179e97 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/sms_two_fa_provider_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sms_verification_message_template': 'str', + 'verification_code_lifetime': 'int' + } + + attribute_map = { + 'sms_verification_message_template': 'smsVerificationMessageTemplate', + 'verification_code_lifetime': 'verificationCodeLifetime' + } + + def __init__(self, sms_verification_message_template=None, verification_code_lifetime=None): # noqa: E501 + """SmsTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._sms_verification_message_template = None + self._verification_code_lifetime = None + self.discriminator = None + self.sms_verification_message_template = sms_verification_message_template + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + + @property + def sms_verification_message_template(self): + """Gets the sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._sms_verification_message_template + + @sms_verification_message_template.setter + def sms_verification_message_template(self, sms_verification_message_template): + """Sets the sms_verification_message_template of this SmsTwoFaProviderConfig. + + + :param sms_verification_message_template: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if sms_verification_message_template is None: + raise ValueError("Invalid value for `sms_verification_message_template`, must not be `None`") # noqa: E501 + + self._sms_verification_message_template = sms_verification_message_template + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this SmsTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_ce/snmp_communication_config.py new file mode 100644 index 0000000..5f01ccc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/snmp_communication_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'spec': 'str' + } + + attribute_map = { + 'spec': 'spec' + } + + def __init__(self, spec=None): # noqa: E501 + """SnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._spec = None + self.discriminator = None + if spec is not None: + self.spec = spec + + @property + def spec(self): + """Gets the spec of this SnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SnmpCommunicationConfig. + + + :param spec: The spec of this SnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/snmp_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/snmp_device_profile_transport_configuration.py new file mode 100644 index 0000000..2527fc4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/snmp_device_profile_transport_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'communication_configs': 'list[SnmpCommunicationConfig]', + 'retries': 'int', + 'timeout_ms': 'int' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'communication_configs': 'communicationConfigs', + 'retries': 'retries', + 'timeout_ms': 'timeoutMs' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, communication_configs=None, retries=None, timeout_ms=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._communication_configs = None + self._retries = None + self._timeout_ms = None + self.discriminator = None + if communication_configs is not None: + self.communication_configs = communication_configs + if retries is not None: + self.retries = retries + if timeout_ms is not None: + self.timeout_ms = timeout_ms + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def communication_configs(self): + """Gets the communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[SnmpCommunicationConfig] + """ + return self._communication_configs + + @communication_configs.setter + def communication_configs(self, communication_configs): + """Sets the communication_configs of this SnmpDeviceProfileTransportConfiguration. + + + :param communication_configs: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[SnmpCommunicationConfig] + """ + + self._communication_configs = communication_configs + + @property + def retries(self): + """Gets the retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this SnmpDeviceProfileTransportConfiguration. + + + :param retries: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def timeout_ms(self): + """Gets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._timeout_ms + + @timeout_ms.setter + def timeout_ms(self, timeout_ms): + """Sets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. + + + :param timeout_ms: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._timeout_ms = timeout_ms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/snmp_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/snmp_device_transport_configuration.py new file mode 100644 index 0000000..75419ff --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/snmp_device_transport_configuration.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'authentication_passphrase': 'str', + 'authentication_protocol': 'str', + 'community': 'str', + 'context_name': 'str', + 'engine_id': 'str', + 'host': 'str', + 'port': 'int', + 'privacy_passphrase': 'str', + 'privacy_protocol': 'str', + 'protocol_version': 'str', + 'security_name': 'str', + 'username': 'str' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'authentication_passphrase': 'authenticationPassphrase', + 'authentication_protocol': 'authenticationProtocol', + 'community': 'community', + 'context_name': 'contextName', + 'engine_id': 'engineId', + 'host': 'host', + 'port': 'port', + 'privacy_passphrase': 'privacyPassphrase', + 'privacy_protocol': 'privacyProtocol', + 'protocol_version': 'protocolVersion', + 'security_name': 'securityName', + 'username': 'username' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, authentication_passphrase=None, authentication_protocol=None, community=None, context_name=None, engine_id=None, host=None, port=None, privacy_passphrase=None, privacy_protocol=None, protocol_version=None, security_name=None, username=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._authentication_passphrase = None + self._authentication_protocol = None + self._community = None + self._context_name = None + self._engine_id = None + self._host = None + self._port = None + self._privacy_passphrase = None + self._privacy_protocol = None + self._protocol_version = None + self._security_name = None + self._username = None + self.discriminator = None + if authentication_passphrase is not None: + self.authentication_passphrase = authentication_passphrase + if authentication_protocol is not None: + self.authentication_protocol = authentication_protocol + if community is not None: + self.community = community + if context_name is not None: + self.context_name = context_name + if engine_id is not None: + self.engine_id = engine_id + if host is not None: + self.host = host + if port is not None: + self.port = port + if privacy_passphrase is not None: + self.privacy_passphrase = privacy_passphrase + if privacy_protocol is not None: + self.privacy_protocol = privacy_protocol + if protocol_version is not None: + self.protocol_version = protocol_version + if security_name is not None: + self.security_name = security_name + if username is not None: + self.username = username + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def authentication_passphrase(self): + """Gets the authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_passphrase + + @authentication_passphrase.setter + def authentication_passphrase(self, authentication_passphrase): + """Sets the authentication_passphrase of this SnmpDeviceTransportConfiguration. + + + :param authentication_passphrase: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._authentication_passphrase = authentication_passphrase + + @property + def authentication_protocol(self): + """Gets the authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_protocol + + @authentication_protocol.setter + def authentication_protocol(self, authentication_protocol): + """Sets the authentication_protocol of this SnmpDeviceTransportConfiguration. + + + :param authentication_protocol: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512"] # noqa: E501 + if authentication_protocol not in allowed_values: + raise ValueError( + "Invalid value for `authentication_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(authentication_protocol, allowed_values) + ) + + self._authentication_protocol = authentication_protocol + + @property + def community(self): + """Gets the community of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._community + + @community.setter + def community(self, community): + """Sets the community of this SnmpDeviceTransportConfiguration. + + + :param community: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._community = community + + @property + def context_name(self): + """Gets the context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._context_name + + @context_name.setter + def context_name(self, context_name): + """Sets the context_name of this SnmpDeviceTransportConfiguration. + + + :param context_name: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._context_name = context_name + + @property + def engine_id(self): + """Gets the engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._engine_id + + @engine_id.setter + def engine_id(self, engine_id): + """Sets the engine_id of this SnmpDeviceTransportConfiguration. + + + :param engine_id: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._engine_id = engine_id + + @property + def host(self): + """Gets the host of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SnmpDeviceTransportConfiguration. + + + :param host: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SnmpDeviceTransportConfiguration. + + + :param port: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def privacy_passphrase(self): + """Gets the privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_passphrase + + @privacy_passphrase.setter + def privacy_passphrase(self, privacy_passphrase): + """Sets the privacy_passphrase of this SnmpDeviceTransportConfiguration. + + + :param privacy_passphrase: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._privacy_passphrase = privacy_passphrase + + @property + def privacy_protocol(self): + """Gets the privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_protocol + + @privacy_protocol.setter + def privacy_protocol(self, privacy_protocol): + """Sets the privacy_protocol of this SnmpDeviceTransportConfiguration. + + + :param privacy_protocol: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["AES_128", "AES_192", "AES_256", "DES"] # noqa: E501 + if privacy_protocol not in allowed_values: + raise ValueError( + "Invalid value for `privacy_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(privacy_protocol, allowed_values) + ) + + self._privacy_protocol = privacy_protocol + + @property + def protocol_version(self): + """Gets the protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SnmpDeviceTransportConfiguration. + + + :param protocol_version: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["V1", "V2C", "V3"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def security_name(self): + """Gets the security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._security_name + + @security_name.setter + def security_name(self, security_name): + """Sets the security_name of this SnmpDeviceTransportConfiguration. + + + :param security_name: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._security_name = security_name + + @property + def username(self): + """Gets the username of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this SnmpDeviceTransportConfiguration. + + + :param username: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/snmp_mapping.py b/billinglayer/python/tb_rest_client/models/models_ce/snmp_mapping.py new file mode 100644 index 0000000..3e7c9d5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/snmp_mapping.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data_type': 'str', + 'key': 'str', + 'oid': 'str' + } + + attribute_map = { + 'data_type': 'dataType', + 'key': 'key', + 'oid': 'oid' + } + + def __init__(self, data_type=None, key=None, oid=None): # noqa: E501 + """SnmpMapping - a model defined in Swagger""" # noqa: E501 + self._data_type = None + self._key = None + self._oid = None + self.discriminator = None + if data_type is not None: + self.data_type = data_type + if key is not None: + self.key = key + if oid is not None: + self.oid = oid + + @property + def data_type(self): + """Gets the data_type of this SnmpMapping. # noqa: E501 + + + :return: The data_type of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._data_type + + @data_type.setter + def data_type(self, data_type): + """Sets the data_type of this SnmpMapping. + + + :param data_type: The data_type of this SnmpMapping. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DOUBLE", "JSON", "LONG", "STRING"] # noqa: E501 + if data_type not in allowed_values: + raise ValueError( + "Invalid value for `data_type` ({0}), must be one of {1}" # noqa: E501 + .format(data_type, allowed_values) + ) + + self._data_type = data_type + + @property + def key(self): + """Gets the key of this SnmpMapping. # noqa: E501 + + + :return: The key of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this SnmpMapping. + + + :param key: The key of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def oid(self): + """Gets the oid of this SnmpMapping. # noqa: E501 + + + :return: The oid of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._oid + + @oid.setter + def oid(self, oid): + """Sets the oid of this SnmpMapping. + + + :param oid: The oid of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._oid = oid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/specific_time_schedule.py b/billinglayer/python/tb_rest_client/models/models_ce/specific_time_schedule.py new file mode 100644 index 0000000..653c3a3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/specific_time_schedule.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SpecificTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'days_of_week': 'list[int]', + 'dynamic_value': 'DynamicValuestring', + 'ends_on': 'int', + 'starts_on': 'int', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'days_of_week': 'daysOfWeek', + 'dynamic_value': 'dynamicValue', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, days_of_week=None, dynamic_value=None, ends_on=None, starts_on=None, timezone=None, type=None): # noqa: E501 + """SpecificTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._days_of_week = None + self._dynamic_value = None + self._ends_on = None + self._starts_on = None + self._timezone = None + self._type = None + self.discriminator = None + if days_of_week is not None: + self.days_of_week = days_of_week + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def days_of_week(self): + """Gets the days_of_week of this SpecificTimeSchedule. # noqa: E501 + + + :return: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :rtype: list[int] + """ + return self._days_of_week + + @days_of_week.setter + def days_of_week(self, days_of_week): + """Sets the days_of_week of this SpecificTimeSchedule. + + + :param days_of_week: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :type: list[int] + """ + + self._days_of_week = days_of_week + + @property + def dynamic_value(self): + """Gets the dynamic_value of this SpecificTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this SpecificTimeSchedule. + + + :param dynamic_value: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def ends_on(self): + """Gets the ends_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this SpecificTimeSchedule. + + + :param ends_on: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this SpecificTimeSchedule. + + + :param starts_on: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + @property + def timezone(self): + """Gets the timezone of this SpecificTimeSchedule. # noqa: E501 + + + :return: The timezone of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this SpecificTimeSchedule. + + + :param timezone: The timezone of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this SpecificTimeSchedule. # noqa: E501 + + + :return: The type of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SpecificTimeSchedule. + + + :param type: The type of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SpecificTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SpecificTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/starred_dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_ce/starred_dashboard_info.py new file mode 100644 index 0000000..911c9b0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/starred_dashboard_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class StarredDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred_at': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred_at': 'starredAt' + } + + def __init__(self, id=None, title=None, starred_at=None): # noqa: E501 + """StarredDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred_at = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred_at is not None: + self.starred_at = starred_at + + @property + def id(self): + """Gets the id of this StarredDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this StarredDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this StarredDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this StarredDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred_at(self): + """Gets the starred_at of this StarredDashboardInfo. # noqa: E501 + + Starred timestamp # noqa: E501 + + :return: The starred_at of this StarredDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._starred_at + + @starred_at.setter + def starred_at(self, starred_at): + """Sets the starred_at of this StarredDashboardInfo. + + Starred timestamp # noqa: E501 + + :param starred_at: The starred_at of this StarredDashboardInfo. # noqa: E501 + :type: int + """ + + self._starred_at = starred_at + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StarredDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StarredDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/statistics_event_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/statistics_event_filter.py new file mode 100644 index 0000000..278ef7d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/statistics_event_filter.py @@ -0,0 +1,305 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class StatisticsEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'min_messages_processed': 'int', + 'max_messages_processed': 'int', + 'min_errors_occurred': 'int', + 'max_errors_occurred': 'int' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'min_messages_processed': 'minMessagesProcessed', + 'max_messages_processed': 'maxMessagesProcessed', + 'min_errors_occurred': 'minErrorsOccurred', + 'max_errors_occurred': 'maxErrorsOccurred' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, min_messages_processed=None, max_messages_processed=None, min_errors_occurred=None, max_errors_occurred=None, *args, **kwargs): # noqa: E501 + """StatisticsEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._min_messages_processed = None + self._max_messages_processed = None + self._min_errors_occurred = None + self._max_errors_occurred = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if min_messages_processed is not None: + self.min_messages_processed = min_messages_processed + if max_messages_processed is not None: + self.max_messages_processed = max_messages_processed + if min_errors_occurred is not None: + self.min_errors_occurred = min_errors_occurred + if max_errors_occurred is not None: + self.max_errors_occurred = max_errors_occurred + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this StatisticsEventFilter. # noqa: E501 + + + :return: The not_empty of this StatisticsEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this StatisticsEventFilter. + + + :param not_empty: The not_empty of this StatisticsEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this StatisticsEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this StatisticsEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this StatisticsEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this StatisticsEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def min_messages_processed(self): + """Gets the min_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The minimum number of successfully processed messages # noqa: E501 + + :return: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_messages_processed + + @min_messages_processed.setter + def min_messages_processed(self, min_messages_processed): + """Sets the min_messages_processed of this StatisticsEventFilter. + + The minimum number of successfully processed messages # noqa: E501 + + :param min_messages_processed: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_messages_processed = min_messages_processed + + @property + def max_messages_processed(self): + """Gets the max_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The maximum number of successfully processed messages # noqa: E501 + + :return: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_messages_processed + + @max_messages_processed.setter + def max_messages_processed(self, max_messages_processed): + """Sets the max_messages_processed of this StatisticsEventFilter. + + The maximum number of successfully processed messages # noqa: E501 + + :param max_messages_processed: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_messages_processed = max_messages_processed + + @property + def min_errors_occurred(self): + """Gets the min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The minimum number of errors occurred during messages processing # noqa: E501 + + :return: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_errors_occurred + + @min_errors_occurred.setter + def min_errors_occurred(self, min_errors_occurred): + """Sets the min_errors_occurred of this StatisticsEventFilter. + + The minimum number of errors occurred during messages processing # noqa: E501 + + :param min_errors_occurred: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_errors_occurred = min_errors_occurred + + @property + def max_errors_occurred(self): + """Gets the max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The maximum number of errors occurred during messages processing # noqa: E501 + + :return: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_errors_occurred + + @max_errors_occurred.setter + def max_errors_occurred(self, max_errors_occurred): + """Sets the max_errors_occurred of this StatisticsEventFilter. + + The maximum number of errors occurred during messages processing # noqa: E501 + + :param max_errors_occurred: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_errors_occurred = max_errors_occurred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StatisticsEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StatisticsEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/string_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_ce/string_filter_predicate.py new file mode 100644 index 0000000..9bd6423 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/string_filter_predicate.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class StringFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'ignore_case': 'bool', + 'operation': 'str', + 'value': 'FilterPredicateValuestring' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'ignore_case': 'ignoreCase', + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, ignore_case=None, operation=None, value=None, *args, **kwargs): # noqa: E501 + """StringFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._ignore_case = None + self._operation = None + self._value = None + self.discriminator = None + if ignore_case is not None: + self.ignore_case = ignore_case + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def ignore_case(self): + """Gets the ignore_case of this StringFilterPredicate. # noqa: E501 + + + :return: The ignore_case of this StringFilterPredicate. # noqa: E501 + :rtype: bool + """ + return self._ignore_case + + @ignore_case.setter + def ignore_case(self, ignore_case): + """Sets the ignore_case of this StringFilterPredicate. + + + :param ignore_case: The ignore_case of this StringFilterPredicate. # noqa: E501 + :type: bool + """ + + self._ignore_case = ignore_case + + @property + def operation(self): + """Gets the operation of this StringFilterPredicate. # noqa: E501 + + + :return: The operation of this StringFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this StringFilterPredicate. + + + :param operation: The operation of this StringFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["CONTAINS", "ENDS_WITH", "EQUAL", "IN", "NOT_CONTAINS", "NOT_EQUAL", "NOT_IN", "STARTS_WITH"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this StringFilterPredicate. # noqa: E501 + + + :return: The value of this StringFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuestring + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this StringFilterPredicate. + + + :param value: The value of this StringFilterPredicate. # noqa: E501 + :type: FilterPredicateValuestring + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StringFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StringFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/submit_strategy.py b/billinglayer/python/tb_rest_client/models/models_ce/submit_strategy.py new file mode 100644 index 0000000..d9d5776 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/submit_strategy.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SubmitStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'batch_size': 'int', + 'type': 'str' + } + + attribute_map = { + 'batch_size': 'batchSize', + 'type': 'type' + } + + def __init__(self, batch_size=None, type=None): # noqa: E501 + """SubmitStrategy - a model defined in Swagger""" # noqa: E501 + self._batch_size = None + self._type = None + self.discriminator = None + if batch_size is not None: + self.batch_size = batch_size + if type is not None: + self.type = type + + @property + def batch_size(self): + """Gets the batch_size of this SubmitStrategy. # noqa: E501 + + + :return: The batch_size of this SubmitStrategy. # noqa: E501 + :rtype: int + """ + return self._batch_size + + @batch_size.setter + def batch_size(self, batch_size): + """Sets the batch_size of this SubmitStrategy. + + + :param batch_size: The batch_size of this SubmitStrategy. # noqa: E501 + :type: int + """ + + self._batch_size = batch_size + + @property + def type(self): + """Gets the type of this SubmitStrategy. # noqa: E501 + + + :return: The type of this SubmitStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SubmitStrategy. + + + :param type: The type of this SubmitStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["BATCH", "BURST", "SEQUENTIAL", "SEQUENTIAL_BY_ORIGINATOR", "SEQUENTIAL_BY_TENANT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SubmitStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SubmitStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/system_administrators_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/system_administrators_filter.py new file mode 100644 index 0000000..31229ee --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/system_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SystemAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/system_info.py b/billinglayer/python/tb_rest_client/models/models_ce/system_info.py new file mode 100644 index 0000000..1ac3c6b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/system_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'monolith': 'bool', + 'system_data': 'list[SystemInfoData]' + } + + attribute_map = { + 'monolith': 'monolith', + 'system_data': 'systemData' + } + + def __init__(self, monolith=None, system_data=None): # noqa: E501 + """SystemInfo - a model defined in Swagger""" # noqa: E501 + self._monolith = None + self._system_data = None + self.discriminator = None + if monolith is not None: + self.monolith = monolith + if system_data is not None: + self.system_data = system_data + + @property + def monolith(self): + """Gets the monolith of this SystemInfo. # noqa: E501 + + + :return: The monolith of this SystemInfo. # noqa: E501 + :rtype: bool + """ + return self._monolith + + @monolith.setter + def monolith(self, monolith): + """Sets the monolith of this SystemInfo. + + + :param monolith: The monolith of this SystemInfo. # noqa: E501 + :type: bool + """ + + self._monolith = monolith + + @property + def system_data(self): + """Gets the system_data of this SystemInfo. # noqa: E501 + + System data. # noqa: E501 + + :return: The system_data of this SystemInfo. # noqa: E501 + :rtype: list[SystemInfoData] + """ + return self._system_data + + @system_data.setter + def system_data(self, system_data): + """Sets the system_data of this SystemInfo. + + System data. # noqa: E501 + + :param system_data: The system_data of this SystemInfo. # noqa: E501 + :type: list[SystemInfoData] + """ + + self._system_data = system_data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/system_info_data.py b/billinglayer/python/tb_rest_client/models/models_ce/system_info_data.py new file mode 100644 index 0000000..5205b7c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/system_info_data.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfoData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'service_id': 'str', + 'service_type': 'str', + 'cpu_usage': 'int', + 'cpu_count': 'int', + 'memory_usage': 'int', + 'total_memory': 'int', + 'disc_usage': 'int', + 'total_disc_space': 'int' + } + + attribute_map = { + 'service_id': 'serviceId', + 'service_type': 'serviceType', + 'cpu_usage': 'cpuUsage', + 'cpu_count': 'cpuCount', + 'memory_usage': 'memoryUsage', + 'total_memory': 'totalMemory', + 'disc_usage': 'discUsage', + 'total_disc_space': 'totalDiscSpace' + } + + def __init__(self, service_id=None, service_type=None, cpu_usage=None, cpu_count=None, memory_usage=None, total_memory=None, disc_usage=None, total_disc_space=None): # noqa: E501 + """SystemInfoData - a model defined in Swagger""" # noqa: E501 + self._service_id = None + self._service_type = None + self._cpu_usage = None + self._cpu_count = None + self._memory_usage = None + self._total_memory = None + self._disc_usage = None + self._total_disc_space = None + self.discriminator = None + if service_id is not None: + self.service_id = service_id + if service_type is not None: + self.service_type = service_type + if cpu_usage is not None: + self.cpu_usage = cpu_usage + if cpu_count is not None: + self.cpu_count = cpu_count + if memory_usage is not None: + self.memory_usage = memory_usage + if total_memory is not None: + self.total_memory = total_memory + if disc_usage is not None: + self.disc_usage = disc_usage + if total_disc_space is not None: + self.total_disc_space = total_disc_space + + @property + def service_id(self): + """Gets the service_id of this SystemInfoData. # noqa: E501 + + Service Id. # noqa: E501 + + :return: The service_id of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_id + + @service_id.setter + def service_id(self, service_id): + """Sets the service_id of this SystemInfoData. + + Service Id. # noqa: E501 + + :param service_id: The service_id of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_id = service_id + + @property + def service_type(self): + """Gets the service_type of this SystemInfoData. # noqa: E501 + + Service type. # noqa: E501 + + :return: The service_type of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SystemInfoData. + + Service type. # noqa: E501 + + :param service_type: The service_type of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def cpu_usage(self): + """Gets the cpu_usage of this SystemInfoData. # noqa: E501 + + CPU usage, in percent. # noqa: E501 + + :return: The cpu_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_usage + + @cpu_usage.setter + def cpu_usage(self, cpu_usage): + """Sets the cpu_usage of this SystemInfoData. + + CPU usage, in percent. # noqa: E501 + + :param cpu_usage: The cpu_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_usage = cpu_usage + + @property + def cpu_count(self): + """Gets the cpu_count of this SystemInfoData. # noqa: E501 + + Total CPU usage. # noqa: E501 + + :return: The cpu_count of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_count + + @cpu_count.setter + def cpu_count(self, cpu_count): + """Sets the cpu_count of this SystemInfoData. + + Total CPU usage. # noqa: E501 + + :param cpu_count: The cpu_count of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_count = cpu_count + + @property + def memory_usage(self): + """Gets the memory_usage of this SystemInfoData. # noqa: E501 + + Memory usage, in percent. # noqa: E501 + + :return: The memory_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._memory_usage + + @memory_usage.setter + def memory_usage(self, memory_usage): + """Sets the memory_usage of this SystemInfoData. + + Memory usage, in percent. # noqa: E501 + + :param memory_usage: The memory_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._memory_usage = memory_usage + + @property + def total_memory(self): + """Gets the total_memory of this SystemInfoData. # noqa: E501 + + Total memory in bytes. # noqa: E501 + + :return: The total_memory of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_memory + + @total_memory.setter + def total_memory(self, total_memory): + """Sets the total_memory of this SystemInfoData. + + Total memory in bytes. # noqa: E501 + + :param total_memory: The total_memory of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_memory = total_memory + + @property + def disc_usage(self): + """Gets the disc_usage of this SystemInfoData. # noqa: E501 + + Disk usage, in percent. # noqa: E501 + + :return: The disc_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._disc_usage + + @disc_usage.setter + def disc_usage(self, disc_usage): + """Sets the disc_usage of this SystemInfoData. + + Disk usage, in percent. # noqa: E501 + + :param disc_usage: The disc_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._disc_usage = disc_usage + + @property + def total_disc_space(self): + """Gets the total_disc_space of this SystemInfoData. # noqa: E501 + + Total disc space in bytes. # noqa: E501 + + :return: The total_disc_space of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_disc_space + + @total_disc_space.setter + def total_disc_space(self, total_disc_space): + """Sets the total_disc_space of this SystemInfoData. + + Total disc space in bytes. # noqa: E501 + + :param total_disc_space: The total_disc_space of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_disc_space = total_disc_space + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfoData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfoData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tb_resource.py b/billinglayer/python/tb_rest_client/models/models_ce/tb_resource.py new file mode 100644 index 0000000..42c736b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tb_resource.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str', + 'file_name': 'str', + 'data': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey', + 'file_name': 'fileName', + 'data': 'data' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None, file_name=None, data=None): # noqa: E501 + """TbResource - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self._file_name = None + self._data = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + if file_name is not None: + self.file_name = file_name + if data is not None: + self.data = data + + @property + def id(self): + """Gets the id of this TbResource. # noqa: E501 + + + :return: The id of this TbResource. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResource. + + + :param id: The id of this TbResource. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResource. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResource. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResource. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResource. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResource. # noqa: E501 + + + :return: The tenant_id of this TbResource. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResource. + + + :param tenant_id: The tenant_id of this TbResource. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResource. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResource. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResource. + + Resource title. # noqa: E501 + + :param title: The title of this TbResource. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResource. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResource. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResource. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResource. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResource. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResource. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + @property + def file_name(self): + """Gets the file_name of this TbResource. # noqa: E501 + + Resource file name. # noqa: E501 + + :return: The file_name of this TbResource. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this TbResource. + + Resource file name. # noqa: E501 + + :param file_name: The file_name of this TbResource. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def data(self): + """Gets the data of this TbResource. # noqa: E501 + + Resource data. # noqa: E501 + + :return: The data of this TbResource. # noqa: E501 + :rtype: str + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this TbResource. + + Resource data. # noqa: E501 + + :param data: The data of this TbResource. # noqa: E501 + :type: str + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tb_resource_id.py b/billinglayer/python/tb_rest_client/models/models_ce/tb_resource_id.py new file mode 100644 index 0000000..136ae59 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tb_resource_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TbResourceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TbResourceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TbResourceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TbResourceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TbResourceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TbResourceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TB_RESOURCE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tb_resource_info.py b/billinglayer/python/tb_rest_client/models/models_ce/tb_resource_info.py new file mode 100644 index 0000000..8237a84 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tb_resource_info.py @@ -0,0 +1,268 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None): # noqa: E501 + """TbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + + @property + def id(self): + """Gets the id of this TbResourceInfo. # noqa: E501 + + + :return: The id of this TbResourceInfo. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceInfo. + + + :param id: The id of this TbResourceInfo. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResourceInfo. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResourceInfo. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResourceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResourceInfo. # noqa: E501 + + + :return: The tenant_id of this TbResourceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResourceInfo. + + + :param tenant_id: The tenant_id of this TbResourceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResourceInfo. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResourceInfo. + + Resource title. # noqa: E501 + + :param title: The title of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResourceInfo. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResourceInfo. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResourceInfo. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResourceInfo. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResourceInfo. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/telemetry_entity_view.py b/billinglayer/python/tb_rest_client/models/models_ce/telemetry_entity_view.py new file mode 100644 index 0000000..42f5b86 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/telemetry_entity_view.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'timeseries': 'list[str]', + 'attributes': 'AttributesEntityView' + } + + attribute_map = { + 'timeseries': 'timeseries', + 'attributes': 'attributes' + } + + def __init__(self, timeseries=None, attributes=None): # noqa: E501 + """TelemetryEntityView - a model defined in Swagger""" # noqa: E501 + self._timeseries = None + self._attributes = None + self.discriminator = None + self.timeseries = timeseries + self.attributes = attributes + + @property + def timeseries(self): + """Gets the timeseries of this TelemetryEntityView. # noqa: E501 + + List of time-series data keys to expose # noqa: E501 + + :return: The timeseries of this TelemetryEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this TelemetryEntityView. + + List of time-series data keys to expose # noqa: E501 + + :param timeseries: The timeseries of this TelemetryEntityView. # noqa: E501 + :type: list[str] + """ + if timeseries is None: + raise ValueError("Invalid value for `timeseries`, must not be `None`") # noqa: E501 + + self._timeseries = timeseries + + @property + def attributes(self): + """Gets the attributes of this TelemetryEntityView. # noqa: E501 + + + :return: The attributes of this TelemetryEntityView. # noqa: E501 + :rtype: AttributesEntityView + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this TelemetryEntityView. + + + :param attributes: The attributes of this TelemetryEntityView. # noqa: E501 + :type: AttributesEntityView + """ + if attributes is None: + raise ValueError("Invalid value for `attributes`, must not be `None`") # noqa: E501 + + self._attributes = attributes + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/telemetry_mapping_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/telemetry_mapping_configuration.py new file mode 100644 index 0000000..e380caf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/telemetry_mapping_configuration.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryMappingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attribute': 'list[str]', + 'attribute_lwm2m': 'dict(str, ObjectAttributes)', + 'key_name': 'dict(str, str)', + 'observe': 'list[str]', + 'telemetry': 'list[str]' + } + + attribute_map = { + 'attribute': 'attribute', + 'attribute_lwm2m': 'attributeLwm2m', + 'key_name': 'keyName', + 'observe': 'observe', + 'telemetry': 'telemetry' + } + + def __init__(self, attribute=None, attribute_lwm2m=None, key_name=None, observe=None, telemetry=None): # noqa: E501 + """TelemetryMappingConfiguration - a model defined in Swagger""" # noqa: E501 + self._attribute = None + self._attribute_lwm2m = None + self._key_name = None + self._observe = None + self._telemetry = None + self.discriminator = None + if attribute is not None: + self.attribute = attribute + if attribute_lwm2m is not None: + self.attribute_lwm2m = attribute_lwm2m + if key_name is not None: + self.key_name = key_name + if observe is not None: + self.observe = observe + if telemetry is not None: + self.telemetry = telemetry + + @property + def attribute(self): + """Gets the attribute of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this TelemetryMappingConfiguration. + + + :param attribute: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._attribute = attribute + + @property + def attribute_lwm2m(self): + """Gets the attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, ObjectAttributes) + """ + return self._attribute_lwm2m + + @attribute_lwm2m.setter + def attribute_lwm2m(self, attribute_lwm2m): + """Sets the attribute_lwm2m of this TelemetryMappingConfiguration. + + + :param attribute_lwm2m: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, ObjectAttributes) + """ + + self._attribute_lwm2m = attribute_lwm2m + + @property + def key_name(self): + """Gets the key_name of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, str) + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this TelemetryMappingConfiguration. + + + :param key_name: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, str) + """ + + self._key_name = key_name + + @property + def observe(self): + """Gets the observe of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this TelemetryMappingConfiguration. + + + :param observe: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._observe = observe + + @property + def telemetry(self): + """Gets the telemetry of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this TelemetryMappingConfiguration. + + + :param telemetry: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._telemetry = telemetry + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryMappingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryMappingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/telemetry_querying_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_ce/telemetry_querying_snmp_communication_config.py new file mode 100644 index 0000000..897178d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/telemetry_querying_snmp_communication_config.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class TelemetryQueryingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None, *args, **kwargs): # noqa: E501 + """TelemetryQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this TelemetryQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this TelemetryQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant.py new file mode 100644 index 0000000..702512f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant.py @@ -0,0 +1,507 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Tenant(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TenantId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'region': 'str', + 'tenant_profile_id': 'TenantProfileId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'region': 'region', + 'tenant_profile_id': 'tenantProfileId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, region=None, tenant_profile_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None): # noqa: E501 + """Tenant - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._region = None + self._tenant_profile_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + if region is not None: + self.region = region + self.tenant_profile_id = tenant_profile_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Tenant. # noqa: E501 + + + :return: The id of this Tenant. # noqa: E501 + :rtype: TenantId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Tenant. + + + :param id: The id of this Tenant. # noqa: E501 + :type: TenantId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Tenant. # noqa: E501 + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :return: The created_time of this Tenant. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Tenant. + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Tenant. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this Tenant. # noqa: E501 + + Title of the tenant # noqa: E501 + + :return: The title of this Tenant. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Tenant. + + Title of the tenant # noqa: E501 + + :param title: The title of this Tenant. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this Tenant. # noqa: E501 + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this Tenant. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Tenant. + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this Tenant. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def region(self): + """Gets the region of this Tenant. # noqa: E501 + + Geo region of the tenant # noqa: E501 + + :return: The region of this Tenant. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this Tenant. + + Geo region of the tenant # noqa: E501 + + :param region: The region of this Tenant. # noqa: E501 + :type: str + """ + + self._region = region + + @property + def tenant_profile_id(self): + """Gets the tenant_profile_id of this Tenant. # noqa: E501 + + + :return: The tenant_profile_id of this Tenant. # noqa: E501 + :rtype: TenantProfileId + """ + return self._tenant_profile_id + + @tenant_profile_id.setter + def tenant_profile_id(self, tenant_profile_id): + """Sets the tenant_profile_id of this Tenant. + + + :param tenant_profile_id: The tenant_profile_id of this Tenant. # noqa: E501 + :type: TenantProfileId + """ + if tenant_profile_id is None: + raise ValueError("Invalid value for `tenant_profile_id`, must not be `None`") # noqa: E501 + + self._tenant_profile_id = tenant_profile_id + + @property + def country(self): + """Gets the country of this Tenant. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this Tenant. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this Tenant. + + Country # noqa: E501 + + :param country: The country of this Tenant. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this Tenant. # noqa: E501 + + State # noqa: E501 + + :return: The state of this Tenant. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Tenant. + + State # noqa: E501 + + :param state: The state of this Tenant. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this Tenant. # noqa: E501 + + City # noqa: E501 + + :return: The city of this Tenant. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this Tenant. + + City # noqa: E501 + + :param city: The city of this Tenant. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this Tenant. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this Tenant. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this Tenant. + + Address Line 1 # noqa: E501 + + :param address: The address of this Tenant. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this Tenant. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this Tenant. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this Tenant. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this Tenant. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this Tenant. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this Tenant. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this Tenant. + + Zip code # noqa: E501 + + :param zip: The zip of this Tenant. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this Tenant. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this Tenant. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this Tenant. + + Phone number # noqa: E501 + + :param phone: The phone of this Tenant. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this Tenant. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this Tenant. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Tenant. + + Email # noqa: E501 + + :param email: The email of this Tenant. # noqa: E501 + :type: str + """ + if email is None: + raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this Tenant. # noqa: E501 + + + :return: The additional_info of this Tenant. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Tenant. + + + :param additional_info: The additional_info of this Tenant. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Tenant, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Tenant): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_administrators_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_administrators_filter.py new file mode 100644 index 0000000..e9c31d8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_administrators_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.users_filter import UsersFilter # noqa: F401,E501 + +class TenantAdministratorsFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'tenant_profiles_ids': 'list[str]', + 'tenants_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'tenant_profiles_ids': 'tenantProfilesIds', + 'tenants_ids': 'tenantsIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, tenant_profiles_ids=None, tenants_ids=None, *args, **kwargs): # noqa: E501 + """TenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self._tenant_profiles_ids = None + self._tenants_ids = None + self.discriminator = None + if tenant_profiles_ids is not None: + self.tenant_profiles_ids = tenant_profiles_ids + if tenants_ids is not None: + self.tenants_ids = tenants_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def tenant_profiles_ids(self): + """Gets the tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_profiles_ids + + @tenant_profiles_ids.setter + def tenant_profiles_ids(self, tenant_profiles_ids): + """Sets the tenant_profiles_ids of this TenantAdministratorsFilter. + + + :param tenant_profiles_ids: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenant_profiles_ids = tenant_profiles_ids + + @property + def tenants_ids(self): + """Gets the tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenants_ids + + @tenants_ids.setter + def tenants_ids(self, tenants_ids): + """Sets the tenants_ids of this TenantAdministratorsFilter. + + + :param tenants_ids: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenants_ids = tenants_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_id.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_id.py new file mode 100644 index 0000000..a383689 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_info.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_info.py new file mode 100644 index 0000000..f8ff118 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_info.py @@ -0,0 +1,533 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TenantId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'region': 'str', + 'tenant_profile_id': 'TenantProfileId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode', + 'tenant_profile_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'region': 'region', + 'tenant_profile_id': 'tenantProfileId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo', + 'tenant_profile_name': 'tenantProfileName' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, region=None, tenant_profile_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None, tenant_profile_name=None): # noqa: E501 + """TenantInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._region = None + self._tenant_profile_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self._tenant_profile_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + if region is not None: + self.region = region + self.tenant_profile_id = tenant_profile_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + if tenant_profile_name is not None: + self.tenant_profile_name = tenant_profile_name + + @property + def id(self): + """Gets the id of this TenantInfo. # noqa: E501 + + + :return: The id of this TenantInfo. # noqa: E501 + :rtype: TenantId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantInfo. + + + :param id: The id of this TenantInfo. # noqa: E501 + :type: TenantId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TenantInfo. # noqa: E501 + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :return: The created_time of this TenantInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TenantInfo. + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TenantInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this TenantInfo. # noqa: E501 + + Title of the tenant # noqa: E501 + + :return: The title of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TenantInfo. + + Title of the tenant # noqa: E501 + + :param title: The title of this TenantInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this TenantInfo. # noqa: E501 + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantInfo. + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this TenantInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def region(self): + """Gets the region of this TenantInfo. # noqa: E501 + + Geo region of the tenant # noqa: E501 + + :return: The region of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this TenantInfo. + + Geo region of the tenant # noqa: E501 + + :param region: The region of this TenantInfo. # noqa: E501 + :type: str + """ + + self._region = region + + @property + def tenant_profile_id(self): + """Gets the tenant_profile_id of this TenantInfo. # noqa: E501 + + + :return: The tenant_profile_id of this TenantInfo. # noqa: E501 + :rtype: TenantProfileId + """ + return self._tenant_profile_id + + @tenant_profile_id.setter + def tenant_profile_id(self, tenant_profile_id): + """Sets the tenant_profile_id of this TenantInfo. + + + :param tenant_profile_id: The tenant_profile_id of this TenantInfo. # noqa: E501 + :type: TenantProfileId + """ + if tenant_profile_id is None: + raise ValueError("Invalid value for `tenant_profile_id`, must not be `None`") # noqa: E501 + + self._tenant_profile_id = tenant_profile_id + + @property + def country(self): + """Gets the country of this TenantInfo. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this TenantInfo. + + Country # noqa: E501 + + :param country: The country of this TenantInfo. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this TenantInfo. # noqa: E501 + + State # noqa: E501 + + :return: The state of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this TenantInfo. + + State # noqa: E501 + + :param state: The state of this TenantInfo. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this TenantInfo. # noqa: E501 + + City # noqa: E501 + + :return: The city of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this TenantInfo. + + City # noqa: E501 + + :param city: The city of this TenantInfo. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this TenantInfo. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this TenantInfo. + + Address Line 1 # noqa: E501 + + :param address: The address of this TenantInfo. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this TenantInfo. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this TenantInfo. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this TenantInfo. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this TenantInfo. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this TenantInfo. + + Zip code # noqa: E501 + + :param zip: The zip of this TenantInfo. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this TenantInfo. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this TenantInfo. + + Phone number # noqa: E501 + + :param phone: The phone of this TenantInfo. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this TenantInfo. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this TenantInfo. + + Email # noqa: E501 + + :param email: The email of this TenantInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this TenantInfo. # noqa: E501 + + + :return: The additional_info of this TenantInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this TenantInfo. + + + :param additional_info: The additional_info of this TenantInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def tenant_profile_name(self): + """Gets the tenant_profile_name of this TenantInfo. # noqa: E501 + + Tenant Profile name # noqa: E501 + + :return: The tenant_profile_name of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._tenant_profile_name + + @tenant_profile_name.setter + def tenant_profile_name(self, tenant_profile_name): + """Sets the tenant_profile_name of this TenantInfo. + + Tenant Profile name # noqa: E501 + + :param tenant_profile_name: The tenant_profile_name of this TenantInfo. # noqa: E501 + :type: str + """ + + self._tenant_profile_name = tenant_profile_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile.py new file mode 100644 index 0000000..2cbe46f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile.py @@ -0,0 +1,288 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default': 'bool', + 'id': 'TenantProfileId', + 'created_time': 'int', + 'name': 'str', + 'description': 'str', + 'isolated_tb_rule_engine': 'bool', + 'profile_data': 'TenantProfileData' + } + + attribute_map = { + 'default': 'default', + 'id': 'id', + 'created_time': 'createdTime', + 'name': 'name', + 'description': 'description', + 'isolated_tb_rule_engine': 'isolatedTbRuleEngine', + 'profile_data': 'profileData' + } + + def __init__(self, default=None, id=None, created_time=None, name=None, description=None, isolated_tb_rule_engine=None, profile_data=None): # noqa: E501 + """TenantProfile - a model defined in Swagger""" # noqa: E501 + self._default = None + self._id = None + self._created_time = None + self._name = None + self._description = None + self._isolated_tb_rule_engine = None + self._profile_data = None + self.discriminator = None + if default is not None: + self.default = default + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if name is not None: + self.name = name + if description is not None: + self.description = description + if isolated_tb_rule_engine is not None: + self.isolated_tb_rule_engine = isolated_tb_rule_engine + if profile_data is not None: + self.profile_data = profile_data + + @property + def default(self): + """Gets the default of this TenantProfile. # noqa: E501 + + + :return: The default of this TenantProfile. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this TenantProfile. + + + :param default: The default of this TenantProfile. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def id(self): + """Gets the id of this TenantProfile. # noqa: E501 + + + :return: The id of this TenantProfile. # noqa: E501 + :rtype: TenantProfileId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantProfile. + + + :param id: The id of this TenantProfile. # noqa: E501 + :type: TenantProfileId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TenantProfile. # noqa: E501 + + Timestamp of the tenant profile creation, in milliseconds # noqa: E501 + + :return: The created_time of this TenantProfile. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TenantProfile. + + Timestamp of the tenant profile creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TenantProfile. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def name(self): + """Gets the name of this TenantProfile. # noqa: E501 + + Name of the tenant profile # noqa: E501 + + :return: The name of this TenantProfile. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantProfile. + + Name of the tenant profile # noqa: E501 + + :param name: The name of this TenantProfile. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this TenantProfile. # noqa: E501 + + Description of the tenant profile # noqa: E501 + + :return: The description of this TenantProfile. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this TenantProfile. + + Description of the tenant profile # noqa: E501 + + :param description: The description of this TenantProfile. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def isolated_tb_rule_engine(self): + """Gets the isolated_tb_rule_engine of this TenantProfile. # noqa: E501 + + If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants # noqa: E501 + + :return: The isolated_tb_rule_engine of this TenantProfile. # noqa: E501 + :rtype: bool + """ + return self._isolated_tb_rule_engine + + @isolated_tb_rule_engine.setter + def isolated_tb_rule_engine(self, isolated_tb_rule_engine): + """Sets the isolated_tb_rule_engine of this TenantProfile. + + If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants # noqa: E501 + + :param isolated_tb_rule_engine: The isolated_tb_rule_engine of this TenantProfile. # noqa: E501 + :type: bool + """ + + self._isolated_tb_rule_engine = isolated_tb_rule_engine + + @property + def profile_data(self): + """Gets the profile_data of this TenantProfile. # noqa: E501 + + + :return: The profile_data of this TenantProfile. # noqa: E501 + :rtype: TenantProfileData + """ + return self._profile_data + + @profile_data.setter + def profile_data(self, profile_data): + """Sets the profile_data of this TenantProfile. + + + :param profile_data: The profile_data of this TenantProfile. # noqa: E501 + :type: TenantProfileData + """ + + self._profile_data = profile_data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_configuration.py new file mode 100644 index 0000000..0eefc79 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_data.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_data.py new file mode 100644 index 0000000..76ab8b6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_data.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'TenantProfileConfiguration', + 'queue_configuration': 'list[TenantProfileQueueConfiguration]' + } + + attribute_map = { + 'configuration': 'configuration', + 'queue_configuration': 'queueConfiguration' + } + + def __init__(self, configuration=None, queue_configuration=None): # noqa: E501 + """TenantProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._queue_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if queue_configuration is not None: + self.queue_configuration = queue_configuration + + @property + def configuration(self): + """Gets the configuration of this TenantProfileData. # noqa: E501 + + + :return: The configuration of this TenantProfileData. # noqa: E501 + :rtype: TenantProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this TenantProfileData. + + + :param configuration: The configuration of this TenantProfileData. # noqa: E501 + :type: TenantProfileConfiguration + """ + + self._configuration = configuration + + @property + def queue_configuration(self): + """Gets the queue_configuration of this TenantProfileData. # noqa: E501 + + JSON array of queue configuration per tenant profile # noqa: E501 + + :return: The queue_configuration of this TenantProfileData. # noqa: E501 + :rtype: list[TenantProfileQueueConfiguration] + """ + return self._queue_configuration + + @queue_configuration.setter + def queue_configuration(self, queue_configuration): + """Sets the queue_configuration of this TenantProfileData. + + JSON array of queue configuration per tenant profile # noqa: E501 + + :param queue_configuration: The queue_configuration of this TenantProfileData. # noqa: E501 + :type: list[TenantProfileQueueConfiguration] + """ + + self._queue_configuration = queue_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_id.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_id.py new file mode 100644 index 0000000..f197a7c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_queue_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_queue_configuration.py new file mode 100644 index 0000000..722cead --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/tenant_profile_queue_configuration.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileQueueConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, topic=None): # noqa: E501 + """TenantProfileQueueConfiguration - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this TenantProfileQueueConfiguration. + + + :param additional_info: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this TenantProfileQueueConfiguration. + + + :param consumer_per_partition: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def name(self): + """Gets the name of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantProfileQueueConfiguration. + + + :param name: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this TenantProfileQueueConfiguration. + + + :param pack_processing_timeout: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this TenantProfileQueueConfiguration. + + + :param partitions: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this TenantProfileQueueConfiguration. + + + :param poll_interval: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this TenantProfileQueueConfiguration. + + + :param processing_strategy: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this TenantProfileQueueConfiguration. + + + :param submit_strategy: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def topic(self): + """Gets the topic of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this TenantProfileQueueConfiguration. + + + :param topic: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileQueueConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileQueueConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/test_sms_request.py b/billinglayer/python/tb_rest_client/models/models_ce/test_sms_request.py new file mode 100644 index 0000000..8170515 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/test_sms_request.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TestSmsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provider_configuration': 'SmsProviderConfiguration', + 'number_to': 'str', + 'message': 'str' + } + + attribute_map = { + 'provider_configuration': 'providerConfiguration', + 'number_to': 'numberTo', + 'message': 'message' + } + + def __init__(self, provider_configuration=None, number_to=None, message=None): # noqa: E501 + """TestSmsRequest - a model defined in Swagger""" # noqa: E501 + self._provider_configuration = None + self._number_to = None + self._message = None + self.discriminator = None + if provider_configuration is not None: + self.provider_configuration = provider_configuration + if number_to is not None: + self.number_to = number_to + if message is not None: + self.message = message + + @property + def provider_configuration(self): + """Gets the provider_configuration of this TestSmsRequest. # noqa: E501 + + + :return: The provider_configuration of this TestSmsRequest. # noqa: E501 + :rtype: SmsProviderConfiguration + """ + return self._provider_configuration + + @provider_configuration.setter + def provider_configuration(self, provider_configuration): + """Sets the provider_configuration of this TestSmsRequest. + + + :param provider_configuration: The provider_configuration of this TestSmsRequest. # noqa: E501 + :type: SmsProviderConfiguration + """ + + self._provider_configuration = provider_configuration + + @property + def number_to(self): + """Gets the number_to of this TestSmsRequest. # noqa: E501 + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :return: The number_to of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._number_to + + @number_to.setter + def number_to(self, number_to): + """Sets the number_to of this TestSmsRequest. + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :param number_to: The number_to of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._number_to = number_to + + @property + def message(self): + """Gets the message of this TestSmsRequest. # noqa: E501 + + The test message # noqa: E501 + + :return: The message of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this TestSmsRequest. + + The test message # noqa: E501 + + :param message: The message of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TestSmsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TestSmsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/thingsboard_credentials_expired_response.py b/billinglayer/python/tb_rest_client/models/models_ce/thingsboard_credentials_expired_response.py new file mode 100644 index 0000000..acfa5b6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/thingsboard_credentials_expired_response.py @@ -0,0 +1,238 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardCredentialsExpiredResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime', + 'reset_token': 'str' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp', + 'reset_token': 'resetToken' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None, reset_token=None): # noqa: E501 + """ThingsboardCredentialsExpiredResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self._reset_token = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + if reset_token is not None: + self.reset_token = reset_token + + @property + def status(self): + """Gets the status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardCredentialsExpiredResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardCredentialsExpiredResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardCredentialsExpiredResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardCredentialsExpiredResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + @property + def reset_token(self): + """Gets the reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Password reset token # noqa: E501 + + :return: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ThingsboardCredentialsExpiredResponse. + + Password reset token # noqa: E501 + + :param reset_token: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardCredentialsExpiredResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardCredentialsExpiredResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/thingsboard_error_response.py b/billinglayer/python/tb_rest_client/models/models_ce/thingsboard_error_response.py new file mode 100644 index 0000000..fa256b5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/thingsboard_error_response.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardErrorResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None): # noqa: E501 + """ThingsboardErrorResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + + @property + def status(self): + """Gets the status of this ThingsboardErrorResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardErrorResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardErrorResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardErrorResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardErrorResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardErrorResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardErrorResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardErrorResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardErrorResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardErrorResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardErrorResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardErrorResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardErrorResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardErrorResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/to_device_rpc_request_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_ce/to_device_rpc_request_snmp_communication_config.py new file mode 100644 index 0000000..b159826 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/to_device_rpc_request_snmp_communication_config.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ToDeviceRpcRequestSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + + def __init__(self, mappings=None, spec=None): # noqa: E501 + """ToDeviceRpcRequestSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param mappings: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param spec: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ToDeviceRpcRequestSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ToDeviceRpcRequestSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/totp_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_ce/totp_two_fa_account_config.py new file mode 100644 index 0000000..1f69a88 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/totp_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_url': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'auth_url': 'authUrl', + 'use_by_default': 'useByDefault' + } + + def __init__(self, auth_url=None, use_by_default=None): # noqa: E501 + """TotpTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._auth_url = None + self._use_by_default = None + self.discriminator = None + self.auth_url = auth_url + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def auth_url(self): + """Gets the auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._auth_url + + @auth_url.setter + def auth_url(self, auth_url): + """Sets the auth_url of this TotpTwoFaAccountConfig. + + + :param auth_url: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if auth_url is None: + raise ValueError("Invalid value for `auth_url`, must not be `None`") # noqa: E501 + + self._auth_url = auth_url + + @property + def use_by_default(self): + """Gets the use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TotpTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/totp_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_ce/totp_two_fa_provider_config.py new file mode 100644 index 0000000..f92ed06 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/totp_two_fa_provider_config.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'issuer_name': 'str' + } + + attribute_map = { + 'issuer_name': 'issuerName' + } + + def __init__(self, issuer_name=None): # noqa: E501 + """TotpTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._issuer_name = None + self.discriminator = None + self.issuer_name = issuer_name + + @property + def issuer_name(self): + """Gets the issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + + + :return: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._issuer_name + + @issuer_name.setter + def issuer_name(self, issuer_name): + """Sets the issuer_name of this TotpTwoFaProviderConfig. + + + :param issuer_name: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if issuer_name is None: + raise ValueError("Invalid value for `issuer_name`, must not be `None`") # noqa: E501 + + self._issuer_name = issuer_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/transport_payload_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/transport_payload_type_configuration.py new file mode 100644 index 0000000..d03a1c3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/transport_payload_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TransportPayloadTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TransportPayloadTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TransportPayloadTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TransportPayloadTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/ts_value.py b/billinglayer/python/tb_rest_client/models/models_ce/ts_value.py new file mode 100644 index 0000000..356fa7f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/ts_value.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'count': 'int', + 'ts': 'int', + 'value': 'str' + } + + attribute_map = { + 'count': 'count', + 'ts': 'ts', + 'value': 'value' + } + + def __init__(self, count=None, ts=None, value=None): # noqa: E501 + """TsValue - a model defined in Swagger""" # noqa: E501 + self._count = None + self._ts = None + self._value = None + self.discriminator = None + if count is not None: + self.count = count + if ts is not None: + self.ts = ts + if value is not None: + self.value = value + + @property + def count(self): + """Gets the count of this TsValue. # noqa: E501 + + + :return: The count of this TsValue. # noqa: E501 + :rtype: int + """ + return self._count + + @count.setter + def count(self, count): + """Sets the count of this TsValue. + + + :param count: The count of this TsValue. # noqa: E501 + :type: int + """ + + self._count = count + + @property + def ts(self): + """Gets the ts of this TsValue. # noqa: E501 + + + :return: The ts of this TsValue. # noqa: E501 + :rtype: int + """ + return self._ts + + @ts.setter + def ts(self, ts): + """Sets the ts of this TsValue. + + + :param ts: The ts of this TsValue. # noqa: E501 + :type: int + """ + + self._ts = ts + + @property + def value(self): + """Gets the value of this TsValue. # noqa: E501 + + + :return: The value of this TsValue. # noqa: E501 + :rtype: str + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this TsValue. + + + :param value: The value of this TsValue. # noqa: E501 + :type: str + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/twilio_sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/twilio_sms_provider_configuration.py new file mode 100644 index 0000000..2b82627 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/twilio_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class TwilioSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'account_sid': 'str', + 'account_token': 'str', + 'number_from': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'account_sid': 'accountSid', + 'account_token': 'accountToken', + 'number_from': 'numberFrom' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, account_sid=None, account_token=None, number_from=None, *args, **kwargs): # noqa: E501 + """TwilioSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._account_sid = None + self._account_token = None + self._number_from = None + self.discriminator = None + if account_sid is not None: + self.account_sid = account_sid + if account_token is not None: + self.account_token = account_token + if number_from is not None: + self.number_from = number_from + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def account_sid(self): + """Gets the account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Sid. # noqa: E501 + + :return: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_sid + + @account_sid.setter + def account_sid(self, account_sid): + """Sets the account_sid of this TwilioSmsProviderConfiguration. + + Twilio account Sid. # noqa: E501 + + :param account_sid: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_sid = account_sid + + @property + def account_token(self): + """Gets the account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Token. # noqa: E501 + + :return: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_token + + @account_token.setter + def account_token(self, account_token): + """Sets the account_token of this TwilioSmsProviderConfiguration. + + Twilio account Token. # noqa: E501 + + :param account_token: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_token = account_token + + @property + def number_from(self): + """Gets the number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + + The number/id of a sender. # noqa: E501 + + :return: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._number_from + + @number_from.setter + def number_from(self, number_from): + """Sets the number_from of this TwilioSmsProviderConfiguration. + + The number/id of a sender. # noqa: E501 + + :param number_from: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._number_from = number_from + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwilioSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwilioSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_account_config.py new file mode 100644 index 0000000..85eee91 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_account_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/two_fa_account_config_update_request.py b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_account_config_update_request.py new file mode 100644 index 0000000..02ec2c1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_account_config_update_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfigUpdateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfigUpdateRequest - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfigUpdateRequest. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfigUpdateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfigUpdateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_provider_config.py new file mode 100644 index 0000000..4733f37 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_provider_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/two_fa_provider_info.py b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_provider_info.py new file mode 100644 index 0000000..da2a5aa --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/two_fa_provider_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'contact': 'str', + 'default': 'bool', + 'min_verification_code_send_period': 'int', + 'type': 'str' + } + + attribute_map = { + 'contact': 'contact', + 'default': 'default', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'type': 'type' + } + + def __init__(self, contact=None, default=None, min_verification_code_send_period=None, type=None): # noqa: E501 + """TwoFaProviderInfo - a model defined in Swagger""" # noqa: E501 + self._contact = None + self._default = None + self._min_verification_code_send_period = None + self._type = None + self.discriminator = None + if contact is not None: + self.contact = contact + if default is not None: + self.default = default + if min_verification_code_send_period is not None: + self.min_verification_code_send_period = min_verification_code_send_period + if type is not None: + self.type = type + + @property + def contact(self): + """Gets the contact of this TwoFaProviderInfo. # noqa: E501 + + + :return: The contact of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._contact + + @contact.setter + def contact(self, contact): + """Sets the contact of this TwoFaProviderInfo. + + + :param contact: The contact of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + + self._contact = contact + + @property + def default(self): + """Gets the default of this TwoFaProviderInfo. # noqa: E501 + + + :return: The default of this TwoFaProviderInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this TwoFaProviderInfo. + + + :param default: The default of this TwoFaProviderInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + + + :return: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this TwoFaProviderInfo. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :type: int + """ + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def type(self): + """Gets the type of this TwoFaProviderInfo. # noqa: E501 + + + :return: The type of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this TwoFaProviderInfo. + + + :param type: The type of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + allowed_values = ["BACKUP_CODE", "EMAIL", "SMS", "TOTP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/update_message.py b/billinglayer/python/tb_rest_client/models/models_ce/update_message.py new file mode 100644 index 0000000..6334d0e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/update_message.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UpdateMessage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'update_available': 'bool', + 'current_version': 'str', + 'latest_version': 'str', + 'upgrade_instructions_url': 'str', + 'current_version_release_notes_url': 'str', + 'latest_version_release_notes_url': 'str' + } + + attribute_map = { + 'update_available': 'updateAvailable', + 'current_version': 'currentVersion', + 'latest_version': 'latestVersion', + 'upgrade_instructions_url': 'upgradeInstructionsUrl', + 'current_version_release_notes_url': 'currentVersionReleaseNotesUrl', + 'latest_version_release_notes_url': 'latestVersionReleaseNotesUrl' + } + + def __init__(self, update_available=None, current_version=None, latest_version=None, upgrade_instructions_url=None, current_version_release_notes_url=None, latest_version_release_notes_url=None): # noqa: E501 + """UpdateMessage - a model defined in Swagger""" # noqa: E501 + self._update_available = None + self._current_version = None + self._latest_version = None + self._upgrade_instructions_url = None + self._current_version_release_notes_url = None + self._latest_version_release_notes_url = None + self.discriminator = None + if update_available is not None: + self.update_available = update_available + if current_version is not None: + self.current_version = current_version + if latest_version is not None: + self.latest_version = latest_version + if upgrade_instructions_url is not None: + self.upgrade_instructions_url = upgrade_instructions_url + if current_version_release_notes_url is not None: + self.current_version_release_notes_url = current_version_release_notes_url + if latest_version_release_notes_url is not None: + self.latest_version_release_notes_url = latest_version_release_notes_url + + @property + def update_available(self): + """Gets the update_available of this UpdateMessage. # noqa: E501 + + 'True' if new platform update is available. # noqa: E501 + + :return: The update_available of this UpdateMessage. # noqa: E501 + :rtype: bool + """ + return self._update_available + + @update_available.setter + def update_available(self, update_available): + """Sets the update_available of this UpdateMessage. + + 'True' if new platform update is available. # noqa: E501 + + :param update_available: The update_available of this UpdateMessage. # noqa: E501 + :type: bool + """ + + self._update_available = update_available + + @property + def current_version(self): + """Gets the current_version of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version. # noqa: E501 + + :return: The current_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this UpdateMessage. + + Current ThingsBoard version. # noqa: E501 + + :param current_version: The current_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version = current_version + + @property + def latest_version(self): + """Gets the latest_version of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version. # noqa: E501 + + :return: The latest_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version + + @latest_version.setter + def latest_version(self, latest_version): + """Sets the latest_version of this UpdateMessage. + + Latest ThingsBoard version. # noqa: E501 + + :param latest_version: The latest_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version = latest_version + + @property + def upgrade_instructions_url(self): + """Gets the upgrade_instructions_url of this UpdateMessage. # noqa: E501 + + Upgrade instructions URL. # noqa: E501 + + :return: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._upgrade_instructions_url + + @upgrade_instructions_url.setter + def upgrade_instructions_url(self, upgrade_instructions_url): + """Sets the upgrade_instructions_url of this UpdateMessage. + + Upgrade instructions URL. # noqa: E501 + + :param upgrade_instructions_url: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._upgrade_instructions_url = upgrade_instructions_url + + @property + def current_version_release_notes_url(self): + """Gets the current_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version release notes URL. # noqa: E501 + + :return: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version_release_notes_url + + @current_version_release_notes_url.setter + def current_version_release_notes_url(self, current_version_release_notes_url): + """Sets the current_version_release_notes_url of this UpdateMessage. + + Current ThingsBoard version release notes URL. # noqa: E501 + + :param current_version_release_notes_url: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version_release_notes_url = current_version_release_notes_url + + @property + def latest_version_release_notes_url(self): + """Gets the latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :return: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version_release_notes_url + + @latest_version_release_notes_url.setter + def latest_version_release_notes_url(self, latest_version_release_notes_url): + """Sets the latest_version_release_notes_url of this UpdateMessage. + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :param latest_version_release_notes_url: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version_release_notes_url = latest_version_release_notes_url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UpdateMessage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UpdateMessage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/usage_info.py b/billinglayer/python/tb_rest_client/models/models_ce/usage_info.py new file mode 100644 index 0000000..3566776 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/usage_info.py @@ -0,0 +1,618 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UsageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms': 'int', + 'assets': 'int', + 'customers': 'int', + 'dashboards': 'int', + 'devices': 'int', + 'emails': 'int', + 'js_executions': 'int', + 'max_alarms': 'int', + 'max_assets': 'int', + 'max_customers': 'int', + 'max_dashboards': 'int', + 'max_devices': 'int', + 'max_emails': 'int', + 'max_js_executions': 'int', + 'max_sms': 'int', + 'max_transport_messages': 'int', + 'max_users': 'int', + 'sms': 'int', + 'transport_messages': 'int', + 'users': 'int' + } + + attribute_map = { + 'alarms': 'alarms', + 'assets': 'assets', + 'customers': 'customers', + 'dashboards': 'dashboards', + 'devices': 'devices', + 'emails': 'emails', + 'js_executions': 'jsExecutions', + 'max_alarms': 'maxAlarms', + 'max_assets': 'maxAssets', + 'max_customers': 'maxCustomers', + 'max_dashboards': 'maxDashboards', + 'max_devices': 'maxDevices', + 'max_emails': 'maxEmails', + 'max_js_executions': 'maxJsExecutions', + 'max_sms': 'maxSms', + 'max_transport_messages': 'maxTransportMessages', + 'max_users': 'maxUsers', + 'sms': 'sms', + 'transport_messages': 'transportMessages', + 'users': 'users' + } + + def __init__(self, alarms=None, assets=None, customers=None, dashboards=None, devices=None, emails=None, js_executions=None, max_alarms=None, max_assets=None, max_customers=None, max_dashboards=None, max_devices=None, max_emails=None, max_js_executions=None, max_sms=None, max_transport_messages=None, max_users=None, sms=None, transport_messages=None, users=None): # noqa: E501 + """UsageInfo - a model defined in Swagger""" # noqa: E501 + self._alarms = None + self._assets = None + self._customers = None + self._dashboards = None + self._devices = None + self._emails = None + self._js_executions = None + self._max_alarms = None + self._max_assets = None + self._max_customers = None + self._max_dashboards = None + self._max_devices = None + self._max_emails = None + self._max_js_executions = None + self._max_sms = None + self._max_transport_messages = None + self._max_users = None + self._sms = None + self._transport_messages = None + self._users = None + self.discriminator = None + if alarms is not None: + self.alarms = alarms + if assets is not None: + self.assets = assets + if customers is not None: + self.customers = customers + if dashboards is not None: + self.dashboards = dashboards + if devices is not None: + self.devices = devices + if emails is not None: + self.emails = emails + if js_executions is not None: + self.js_executions = js_executions + if max_alarms is not None: + self.max_alarms = max_alarms + if max_assets is not None: + self.max_assets = max_assets + if max_customers is not None: + self.max_customers = max_customers + if max_dashboards is not None: + self.max_dashboards = max_dashboards + if max_devices is not None: + self.max_devices = max_devices + if max_emails is not None: + self.max_emails = max_emails + if max_js_executions is not None: + self.max_js_executions = max_js_executions + if max_sms is not None: + self.max_sms = max_sms + if max_transport_messages is not None: + self.max_transport_messages = max_transport_messages + if max_users is not None: + self.max_users = max_users + if sms is not None: + self.sms = sms + if transport_messages is not None: + self.transport_messages = transport_messages + if users is not None: + self.users = users + + @property + def alarms(self): + """Gets the alarms of this UsageInfo. # noqa: E501 + + + :return: The alarms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this UsageInfo. + + + :param alarms: The alarms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._alarms = alarms + + @property + def assets(self): + """Gets the assets of this UsageInfo. # noqa: E501 + + + :return: The assets of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._assets + + @assets.setter + def assets(self, assets): + """Sets the assets of this UsageInfo. + + + :param assets: The assets of this UsageInfo. # noqa: E501 + :type: int + """ + + self._assets = assets + + @property + def customers(self): + """Gets the customers of this UsageInfo. # noqa: E501 + + + :return: The customers of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._customers + + @customers.setter + def customers(self, customers): + """Sets the customers of this UsageInfo. + + + :param customers: The customers of this UsageInfo. # noqa: E501 + :type: int + """ + + self._customers = customers + + @property + def dashboards(self): + """Gets the dashboards of this UsageInfo. # noqa: E501 + + + :return: The dashboards of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._dashboards + + @dashboards.setter + def dashboards(self, dashboards): + """Sets the dashboards of this UsageInfo. + + + :param dashboards: The dashboards of this UsageInfo. # noqa: E501 + :type: int + """ + + self._dashboards = dashboards + + @property + def devices(self): + """Gets the devices of this UsageInfo. # noqa: E501 + + + :return: The devices of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this UsageInfo. + + + :param devices: The devices of this UsageInfo. # noqa: E501 + :type: int + """ + + self._devices = devices + + @property + def emails(self): + """Gets the emails of this UsageInfo. # noqa: E501 + + + :return: The emails of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._emails + + @emails.setter + def emails(self, emails): + """Sets the emails of this UsageInfo. + + + :param emails: The emails of this UsageInfo. # noqa: E501 + :type: int + """ + + self._emails = emails + + @property + def js_executions(self): + """Gets the js_executions of this UsageInfo. # noqa: E501 + + + :return: The js_executions of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._js_executions + + @js_executions.setter + def js_executions(self, js_executions): + """Sets the js_executions of this UsageInfo. + + + :param js_executions: The js_executions of this UsageInfo. # noqa: E501 + :type: int + """ + + self._js_executions = js_executions + + @property + def max_alarms(self): + """Gets the max_alarms of this UsageInfo. # noqa: E501 + + + :return: The max_alarms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_alarms + + @max_alarms.setter + def max_alarms(self, max_alarms): + """Sets the max_alarms of this UsageInfo. + + + :param max_alarms: The max_alarms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_alarms = max_alarms + + @property + def max_assets(self): + """Gets the max_assets of this UsageInfo. # noqa: E501 + + + :return: The max_assets of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this UsageInfo. + + + :param max_assets: The max_assets of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_customers(self): + """Gets the max_customers of this UsageInfo. # noqa: E501 + + + :return: The max_customers of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_customers + + @max_customers.setter + def max_customers(self, max_customers): + """Sets the max_customers of this UsageInfo. + + + :param max_customers: The max_customers of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_customers = max_customers + + @property + def max_dashboards(self): + """Gets the max_dashboards of this UsageInfo. # noqa: E501 + + + :return: The max_dashboards of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_dashboards + + @max_dashboards.setter + def max_dashboards(self, max_dashboards): + """Sets the max_dashboards of this UsageInfo. + + + :param max_dashboards: The max_dashboards of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_dashboards = max_dashboards + + @property + def max_devices(self): + """Gets the max_devices of this UsageInfo. # noqa: E501 + + + :return: The max_devices of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this UsageInfo. + + + :param max_devices: The max_devices of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def max_emails(self): + """Gets the max_emails of this UsageInfo. # noqa: E501 + + + :return: The max_emails of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_emails + + @max_emails.setter + def max_emails(self, max_emails): + """Sets the max_emails of this UsageInfo. + + + :param max_emails: The max_emails of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_emails = max_emails + + @property + def max_js_executions(self): + """Gets the max_js_executions of this UsageInfo. # noqa: E501 + + + :return: The max_js_executions of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_js_executions + + @max_js_executions.setter + def max_js_executions(self, max_js_executions): + """Sets the max_js_executions of this UsageInfo. + + + :param max_js_executions: The max_js_executions of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_js_executions = max_js_executions + + @property + def max_sms(self): + """Gets the max_sms of this UsageInfo. # noqa: E501 + + + :return: The max_sms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_sms + + @max_sms.setter + def max_sms(self, max_sms): + """Sets the max_sms of this UsageInfo. + + + :param max_sms: The max_sms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_sms = max_sms + + @property + def max_transport_messages(self): + """Gets the max_transport_messages of this UsageInfo. # noqa: E501 + + + :return: The max_transport_messages of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_transport_messages + + @max_transport_messages.setter + def max_transport_messages(self, max_transport_messages): + """Sets the max_transport_messages of this UsageInfo. + + + :param max_transport_messages: The max_transport_messages of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_transport_messages = max_transport_messages + + @property + def max_users(self): + """Gets the max_users of this UsageInfo. # noqa: E501 + + + :return: The max_users of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_users + + @max_users.setter + def max_users(self, max_users): + """Sets the max_users of this UsageInfo. + + + :param max_users: The max_users of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_users = max_users + + @property + def sms(self): + """Gets the sms of this UsageInfo. # noqa: E501 + + + :return: The sms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._sms + + @sms.setter + def sms(self, sms): + """Sets the sms of this UsageInfo. + + + :param sms: The sms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._sms = sms + + @property + def transport_messages(self): + """Gets the transport_messages of this UsageInfo. # noqa: E501 + + + :return: The transport_messages of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._transport_messages + + @transport_messages.setter + def transport_messages(self, transport_messages): + """Sets the transport_messages of this UsageInfo. + + + :param transport_messages: The transport_messages of this UsageInfo. # noqa: E501 + :type: int + """ + + self._transport_messages = transport_messages + + @property + def users(self): + """Gets the users of this UsageInfo. # noqa: E501 + + + :return: The users of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._users + + @users.setter + def users(self, users): + """Sets the users of this UsageInfo. + + + :param users: The users of this UsageInfo. # noqa: E501 + :type: int + """ + + self._users = users + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UsageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UsageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/user.py b/billinglayer/python/tb_rest_client/models/models_ce/user.py new file mode 100644 index 0000000..50340b6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/user.py @@ -0,0 +1,407 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class User(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'email': 'str', + 'name': 'str', + 'authority': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'phone': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'email': 'email', + 'name': 'name', + 'authority': 'authority', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'phone': 'phone', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, email=None, name=None, authority=None, first_name=None, last_name=None, phone=None, additional_info=None): # noqa: E501 + """User - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._email = None + self._name = None + self._authority = None + self._first_name = None + self._last_name = None + self._phone = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.email = email + if name is not None: + self.name = name + self.authority = authority + self.first_name = first_name + self.last_name = last_name + self.phone = phone + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this User. # noqa: E501 + + + :return: The id of this User. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + + :param id: The id of this User. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this User. # noqa: E501 + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :return: The created_time of this User. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this User. + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this User. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this User. # noqa: E501 + + + :return: The tenant_id of this User. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this User. + + + :param tenant_id: The tenant_id of this User. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this User. # noqa: E501 + + + :return: The customer_id of this User. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this User. + + + :param customer_id: The customer_id of this User. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def email(self): + """Gets the email of this User. # noqa: E501 + + Email of the user # noqa: E501 + + :return: The email of this User. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this User. + + Email of the user # noqa: E501 + + :param email: The email of this User. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def name(self): + """Gets the name of this User. # noqa: E501 + + Duplicates the email of the user, readonly # noqa: E501 + + :return: The name of this User. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this User. + + Duplicates the email of the user, readonly # noqa: E501 + + :param name: The name of this User. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def authority(self): + """Gets the authority of this User. # noqa: E501 + + Authority # noqa: E501 + + :return: The authority of this User. # noqa: E501 + :rtype: str + """ + return self._authority + + @authority.setter + def authority(self, authority): + """Sets the authority of this User. + + Authority # noqa: E501 + + :param authority: The authority of this User. # noqa: E501 + :type: str + """ + if authority is None: + raise ValueError("Invalid value for `authority`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if authority not in allowed_values: + raise ValueError( + "Invalid value for `authority` ({0}), must be one of {1}" # noqa: E501 + .format(authority, allowed_values) + ) + + self._authority = authority + + @property + def first_name(self): + """Gets the first_name of this User. # noqa: E501 + + First name of the user # noqa: E501 + + :return: The first_name of this User. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + First name of the user # noqa: E501 + + :param first_name: The first_name of this User. # noqa: E501 + :type: str + """ + # if first_name is None: + # raise ValueError("Invalid value for `first_name`, must not be `None`") # noqa: E501 + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. # noqa: E501 + + Last name of the user # noqa: E501 + + :return: The last_name of this User. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + Last name of the user # noqa: E501 + + :param last_name: The last_name of this User. # noqa: E501 + :type: str + """ + # if last_name is None: + # raise ValueError("Invalid value for `last_name`, must not be `None`") # noqa: E501 + + self._last_name = last_name + + @property + def phone(self): + """Gets the phone of this User. # noqa: E501 + + Phone number of the user # noqa: E501 + + :return: The phone of this User. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this User. + + Phone number of the user # noqa: E501 + + :param phone: The phone of this User. # noqa: E501 + :type: str + """ + # if phone is None: + # raise ValueError("Invalid value for `phone`, must not be `None`") # noqa: E501 + + self._phone = phone + + @property + def additional_info(self): + """Gets the additional_info of this User. # noqa: E501 + + + :return: The additional_info of this User. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this User. + + + :param additional_info: The additional_info of this User. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(User, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, User): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/user_dashboards_info.py b/billinglayer/python/tb_rest_client/models/models_ce/user_dashboards_info.py new file mode 100644 index 0000000..d64240e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/user_dashboards_info.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserDashboardsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'last': 'list[LastVisitedDashboardInfo]', + 'starred': 'list[StarredDashboardInfo]' + } + + attribute_map = { + 'last': 'last', + 'starred': 'starred' + } + + def __init__(self, last=None, starred=None): # noqa: E501 + """UserDashboardsInfo - a model defined in Swagger""" # noqa: E501 + self._last = None + self._starred = None + self.discriminator = None + if last is not None: + self.last = last + if starred is not None: + self.starred = starred + + @property + def last(self): + """Gets the last of this UserDashboardsInfo. # noqa: E501 + + List of last visited dashboards. # noqa: E501 + + :return: The last of this UserDashboardsInfo. # noqa: E501 + :rtype: list[LastVisitedDashboardInfo] + """ + return self._last + + @last.setter + def last(self, last): + """Sets the last of this UserDashboardsInfo. + + List of last visited dashboards. # noqa: E501 + + :param last: The last of this UserDashboardsInfo. # noqa: E501 + :type: list[LastVisitedDashboardInfo] + """ + + self._last = last + + @property + def starred(self): + """Gets the starred of this UserDashboardsInfo. # noqa: E501 + + List of starred dashboards. # noqa: E501 + + :return: The starred of this UserDashboardsInfo. # noqa: E501 + :rtype: list[StarredDashboardInfo] + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this UserDashboardsInfo. + + List of starred dashboards. # noqa: E501 + + :param starred: The starred of this UserDashboardsInfo. # noqa: E501 + :type: list[StarredDashboardInfo] + """ + + self._starred = starred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserDashboardsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserDashboardsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/user_email_info.py b/billinglayer/python/tb_rest_client/models/models_ce/user_email_info.py new file mode 100644 index 0000000..6ac0c08 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/user_email_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, email=None, first_name=None, last_name=None): # noqa: E501 + """UserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this UserEmailInfo. # noqa: E501 + + + :return: The id of this UserEmailInfo. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserEmailInfo. + + + :param id: The id of this UserEmailInfo. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def email(self): + """Gets the email of this UserEmailInfo. # noqa: E501 + + User email # noqa: E501 + + :return: The email of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this UserEmailInfo. + + User email # noqa: E501 + + :param email: The email of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this UserEmailInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this UserEmailInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this UserEmailInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this UserEmailInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/user_id.py b/billinglayer/python/tb_rest_client/models/models_ce/user_id.py new file mode 100644 index 0000000..dbe4bea --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/user_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """UserId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this UserId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this UserId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this UserId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this UserId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this UserId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this UserId. + + string # noqa: E501 + + :param entity_type: The entity_type of this UserId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["USER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/user_list_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/user_list_filter.py new file mode 100644 index 0000000..41d5d3e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/user_list_filter.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserListFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'users_ids': 'list[str]' + } + + attribute_map = { + 'users_ids': 'usersIds' + } + + def __init__(self, users_ids=None): # noqa: E501 + """UserListFilter - a model defined in Swagger""" # noqa: E501 + self._users_ids = None + self.discriminator = None + if users_ids is not None: + self.users_ids = users_ids + + @property + def users_ids(self): + """Gets the users_ids of this UserListFilter. # noqa: E501 + + + :return: The users_ids of this UserListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._users_ids + + @users_ids.setter + def users_ids(self, users_ids): + """Sets the users_ids of this UserListFilter. + + + :param users_ids: The users_ids of this UserListFilter. # noqa: E501 + :type: list[str] + """ + + self._users_ids = users_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/user_password_policy.py b/billinglayer/python/tb_rest_client/models/models_ce/user_password_policy.py new file mode 100644 index 0000000..41b736f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/user_password_policy.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserPasswordPolicy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_whitespaces': 'bool', + 'minimum_digits': 'int', + 'minimum_length': 'int', + 'minimum_lowercase_letters': 'int', + 'minimum_special_characters': 'int', + 'minimum_uppercase_letters': 'int', + 'password_expiration_period_days': 'int', + 'password_reuse_frequency_days': 'int' + } + + attribute_map = { + 'allow_whitespaces': 'allowWhitespaces', + 'minimum_digits': 'minimumDigits', + 'minimum_length': 'minimumLength', + 'minimum_lowercase_letters': 'minimumLowercaseLetters', + 'minimum_special_characters': 'minimumSpecialCharacters', + 'minimum_uppercase_letters': 'minimumUppercaseLetters', + 'password_expiration_period_days': 'passwordExpirationPeriodDays', + 'password_reuse_frequency_days': 'passwordReuseFrequencyDays' + } + + def __init__(self, allow_whitespaces=None, minimum_digits=None, minimum_length=None, minimum_lowercase_letters=None, minimum_special_characters=None, minimum_uppercase_letters=None, password_expiration_period_days=None, password_reuse_frequency_days=None): # noqa: E501 + """UserPasswordPolicy - a model defined in Swagger""" # noqa: E501 + self._allow_whitespaces = None + self._minimum_digits = None + self._minimum_length = None + self._minimum_lowercase_letters = None + self._minimum_special_characters = None + self._minimum_uppercase_letters = None + self._password_expiration_period_days = None + self._password_reuse_frequency_days = None + self.discriminator = None + if allow_whitespaces is not None: + self.allow_whitespaces = allow_whitespaces + if minimum_digits is not None: + self.minimum_digits = minimum_digits + if minimum_length is not None: + self.minimum_length = minimum_length + if minimum_lowercase_letters is not None: + self.minimum_lowercase_letters = minimum_lowercase_letters + if minimum_special_characters is not None: + self.minimum_special_characters = minimum_special_characters + if minimum_uppercase_letters is not None: + self.minimum_uppercase_letters = minimum_uppercase_letters + if password_expiration_period_days is not None: + self.password_expiration_period_days = password_expiration_period_days + if password_reuse_frequency_days is not None: + self.password_reuse_frequency_days = password_reuse_frequency_days + + @property + def allow_whitespaces(self): + """Gets the allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + + Allow whitespaces # noqa: E501 + + :return: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :rtype: bool + """ + return self._allow_whitespaces + + @allow_whitespaces.setter + def allow_whitespaces(self, allow_whitespaces): + """Sets the allow_whitespaces of this UserPasswordPolicy. + + Allow whitespaces # noqa: E501 + + :param allow_whitespaces: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :type: bool + """ + + self._allow_whitespaces = allow_whitespaces + + @property + def minimum_digits(self): + """Gets the minimum_digits of this UserPasswordPolicy. # noqa: E501 + + Minimum number of digits in the password. # noqa: E501 + + :return: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_digits + + @minimum_digits.setter + def minimum_digits(self, minimum_digits): + """Sets the minimum_digits of this UserPasswordPolicy. + + Minimum number of digits in the password. # noqa: E501 + + :param minimum_digits: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_digits = minimum_digits + + @property + def minimum_length(self): + """Gets the minimum_length of this UserPasswordPolicy. # noqa: E501 + + Minimum number of symbols in the password. # noqa: E501 + + :return: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_length + + @minimum_length.setter + def minimum_length(self, minimum_length): + """Sets the minimum_length of this UserPasswordPolicy. + + Minimum number of symbols in the password. # noqa: E501 + + :param minimum_length: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_length = minimum_length + + @property + def minimum_lowercase_letters(self): + """Gets the minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of lowercase letters in the password. # noqa: E501 + + :return: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_lowercase_letters + + @minimum_lowercase_letters.setter + def minimum_lowercase_letters(self, minimum_lowercase_letters): + """Sets the minimum_lowercase_letters of this UserPasswordPolicy. + + Minimum number of lowercase letters in the password. # noqa: E501 + + :param minimum_lowercase_letters: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_lowercase_letters = minimum_lowercase_letters + + @property + def minimum_special_characters(self): + """Gets the minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of special in the password. # noqa: E501 + + :return: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_special_characters + + @minimum_special_characters.setter + def minimum_special_characters(self, minimum_special_characters): + """Sets the minimum_special_characters of this UserPasswordPolicy. + + Minimum number of special in the password. # noqa: E501 + + :param minimum_special_characters: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_special_characters = minimum_special_characters + + @property + def minimum_uppercase_letters(self): + """Gets the minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of uppercase letters in the password. # noqa: E501 + + :return: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_uppercase_letters + + @minimum_uppercase_letters.setter + def minimum_uppercase_letters(self, minimum_uppercase_letters): + """Sets the minimum_uppercase_letters of this UserPasswordPolicy. + + Minimum number of uppercase letters in the password. # noqa: E501 + + :param minimum_uppercase_letters: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_uppercase_letters = minimum_uppercase_letters + + @property + def password_expiration_period_days(self): + """Gets the password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :return: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_expiration_period_days + + @password_expiration_period_days.setter + def password_expiration_period_days(self, password_expiration_period_days): + """Sets the password_expiration_period_days of this UserPasswordPolicy. + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :param password_expiration_period_days: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_expiration_period_days = password_expiration_period_days + + @property + def password_reuse_frequency_days(self): + """Gets the password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :return: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_reuse_frequency_days + + @password_reuse_frequency_days.setter + def password_reuse_frequency_days(self, password_reuse_frequency_days): + """Sets the password_reuse_frequency_days of this UserPasswordPolicy. + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :param password_reuse_frequency_days: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_reuse_frequency_days = password_reuse_frequency_days + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserPasswordPolicy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserPasswordPolicy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/users_filter.py b/billinglayer/python/tb_rest_client/models/models_ce/users_filter.py new file mode 100644 index 0000000..a50b520 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """UsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/version_create_config.py b/billinglayer/python/tb_rest_client/models/models_ce/version_create_config.py new file mode 100644 index 0000000..39c2450 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/version_create_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_relations': 'saveRelations' + } + + def __init__(self, save_attributes=None, save_credentials=None, save_relations=None): # noqa: E501 + """VersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._save_attributes = None + self._save_credentials = None + self._save_relations = None + self.discriminator = None + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_relations is not None: + self.save_relations = save_relations + + @property + def save_attributes(self): + """Gets the save_attributes of this VersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this VersionCreateConfig. + + + :param save_attributes: The save_attributes of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this VersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this VersionCreateConfig. + + + :param save_credentials: The save_credentials of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_relations(self): + """Gets the save_relations of this VersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this VersionCreateConfig. + + + :param save_relations: The save_relations of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/version_create_request.py b/billinglayer/python/tb_rest_client/models/models_ce/version_create_request.py new file mode 100644 index 0000000..27de65a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/version_create_request.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'type': 'str', + 'version_name': 'str' + } + + attribute_map = { + 'branch': 'branch', + 'type': 'type', + 'version_name': 'versionName' + } + + def __init__(self, branch=None, type=None, version_name=None): # noqa: E501 + """VersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + + @property + def branch(self): + """Gets the branch of this VersionCreateRequest. # noqa: E501 + + + :return: The branch of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this VersionCreateRequest. + + + :param branch: The branch of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def type(self): + """Gets the type of this VersionCreateRequest. # noqa: E501 + + + :return: The type of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionCreateRequest. + + + :param type: The type of this VersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this VersionCreateRequest. # noqa: E501 + + + :return: The version_name of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this VersionCreateRequest. + + + :param version_name: The version_name of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/version_creation_result.py b/billinglayer/python/tb_rest_client/models/models_ce/version_creation_result.py new file mode 100644 index 0000000..3d8599e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/version_creation_result.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreationResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'added': 'int', + 'done': 'bool', + 'error': 'str', + 'modified': 'int', + 'removed': 'int', + 'version': 'EntityVersion' + } + + attribute_map = { + 'added': 'added', + 'done': 'done', + 'error': 'error', + 'modified': 'modified', + 'removed': 'removed', + 'version': 'version' + } + + def __init__(self, added=None, done=None, error=None, modified=None, removed=None, version=None): # noqa: E501 + """VersionCreationResult - a model defined in Swagger""" # noqa: E501 + self._added = None + self._done = None + self._error = None + self._modified = None + self._removed = None + self._version = None + self.discriminator = None + if added is not None: + self.added = added + if done is not None: + self.done = done + if error is not None: + self.error = error + if modified is not None: + self.modified = modified + if removed is not None: + self.removed = removed + if version is not None: + self.version = version + + @property + def added(self): + """Gets the added of this VersionCreationResult. # noqa: E501 + + + :return: The added of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._added + + @added.setter + def added(self, added): + """Sets the added of this VersionCreationResult. + + + :param added: The added of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._added = added + + @property + def done(self): + """Gets the done of this VersionCreationResult. # noqa: E501 + + + :return: The done of this VersionCreationResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionCreationResult. + + + :param done: The done of this VersionCreationResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionCreationResult. # noqa: E501 + + + :return: The error of this VersionCreationResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionCreationResult. + + + :param error: The error of this VersionCreationResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def modified(self): + """Gets the modified of this VersionCreationResult. # noqa: E501 + + + :return: The modified of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._modified + + @modified.setter + def modified(self, modified): + """Sets the modified of this VersionCreationResult. + + + :param modified: The modified of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._modified = modified + + @property + def removed(self): + """Gets the removed of this VersionCreationResult. # noqa: E501 + + + :return: The removed of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._removed + + @removed.setter + def removed(self, removed): + """Sets the removed of this VersionCreationResult. + + + :param removed: The removed of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._removed = removed + + @property + def version(self): + """Gets the version of this VersionCreationResult. # noqa: E501 + + + :return: The version of this VersionCreationResult. # noqa: E501 + :rtype: EntityVersion + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this VersionCreationResult. + + + :param version: The version of this VersionCreationResult. # noqa: E501 + :type: EntityVersion + """ + + self._version = version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreationResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreationResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/version_load_config.py b/billinglayer/python/tb_rest_client/models/models_ce/version_load_config.py new file mode 100644 index 0000000..a654161 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/version_load_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_relations': 'bool' + } + + attribute_map = { + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_relations': 'loadRelations' + } + + def __init__(self, load_attributes=None, load_credentials=None, load_relations=None): # noqa: E501 + """VersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._load_attributes = None + self._load_credentials = None + self._load_relations = None + self.discriminator = None + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_relations is not None: + self.load_relations = load_relations + + @property + def load_attributes(self): + """Gets the load_attributes of this VersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this VersionLoadConfig. + + + :param load_attributes: The load_attributes of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this VersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this VersionLoadConfig. + + + :param load_credentials: The load_credentials of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_relations(self): + """Gets the load_relations of this VersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this VersionLoadConfig. + + + :param load_relations: The load_relations of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/version_load_request.py b/billinglayer/python/tb_rest_client/models/models_ce/version_load_request.py new file mode 100644 index 0000000..a7f753c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/version_load_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'version_id': 'str' + } + + attribute_map = { + 'type': 'type', + 'version_id': 'versionId' + } + + def __init__(self, type=None, version_id=None): # noqa: E501 + """VersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._type = None + self._version_id = None + self.discriminator = None + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + + @property + def type(self): + """Gets the type of this VersionLoadRequest. # noqa: E501 + + + :return: The type of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionLoadRequest. + + + :param type: The type of this VersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this VersionLoadRequest. # noqa: E501 + + + :return: The version_id of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this VersionLoadRequest. + + + :param version_id: The version_id of this VersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/version_load_result.py b/billinglayer/python/tb_rest_client/models/models_ce/version_load_result.py new file mode 100644 index 0000000..060a434 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/version_load_result.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'done': 'bool', + 'error': 'EntityLoadError', + 'result': 'list[EntityTypeLoadResult]' + } + + attribute_map = { + 'done': 'done', + 'error': 'error', + 'result': 'result' + } + + def __init__(self, done=None, error=None, result=None): # noqa: E501 + """VersionLoadResult - a model defined in Swagger""" # noqa: E501 + self._done = None + self._error = None + self._result = None + self.discriminator = None + if done is not None: + self.done = done + if error is not None: + self.error = error + if result is not None: + self.result = result + + @property + def done(self): + """Gets the done of this VersionLoadResult. # noqa: E501 + + + :return: The done of this VersionLoadResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionLoadResult. + + + :param done: The done of this VersionLoadResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionLoadResult. # noqa: E501 + + + :return: The error of this VersionLoadResult. # noqa: E501 + :rtype: EntityLoadError + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionLoadResult. + + + :param error: The error of this VersionLoadResult. # noqa: E501 + :type: EntityLoadError + """ + + self._error = error + + @property + def result(self): + """Gets the result of this VersionLoadResult. # noqa: E501 + + + :return: The result of this VersionLoadResult. # noqa: E501 + :rtype: list[EntityTypeLoadResult] + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this VersionLoadResult. + + + :param result: The result of this VersionLoadResult. # noqa: E501 + :type: list[EntityTypeLoadResult] + """ + + self._result = result + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/versioned_entity_info.py b/billinglayer/python/tb_rest_client/models/models_ce/versioned_entity_info.py new file mode 100644 index 0000000..75a01a7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/versioned_entity_info.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'EntityId' + } + + attribute_map = { + 'external_id': 'externalId' + } + + def __init__(self, external_id=None): # noqa: E501 + """VersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + + @property + def external_id(self): + """Gets the external_id of this VersionedEntityInfo. # noqa: E501 + + + :return: The external_id of this VersionedEntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this VersionedEntityInfo. + + + :param external_id: The external_id of this VersionedEntityInfo. # noqa: E501 + :type: EntityId + """ + + self._external_id = external_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/web_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_ce/web_delivery_method_notification_template.py new file mode 100644 index 0000000..e62d76c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/web_delivery_method_notification_template.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WebDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + + def __init__(self, additional_config=None, body=None, enabled=None, subject=None): # noqa: E501 + """WebDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + + @property + def additional_config(self): + """Gets the additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this WebDeliveryMethodNotificationTemplate. + + + :param additional_config: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def body(self): + """Gets the body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this WebDeliveryMethodNotificationTemplate. + + + :param body: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this WebDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this WebDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WebDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WebDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/widget_type.py b/billinglayer/python/tb_rest_client/models/models_ce/widget_type.py new file mode 100644 index 0000000..f3729b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/widget_type.py @@ -0,0 +1,288 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetType(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'descriptor': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'descriptor': 'descriptor' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, descriptor=None): # noqa: E501 + """WidgetType - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._descriptor = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if descriptor is not None: + self.descriptor = descriptor + + @property + def id(self): + """Gets the id of this WidgetType. # noqa: E501 + + + :return: The id of this WidgetType. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetType. + + + :param id: The id of this WidgetType. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetType. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetType. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetType. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetType. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetType. # noqa: E501 + + + :return: The tenant_id of this WidgetType. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetType. + + + :param tenant_id: The tenant_id of this WidgetType. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetType. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetType. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetType. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetType. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetType. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetType. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetType. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetType. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetType. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetType. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetType. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetType. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def descriptor(self): + """Gets the descriptor of this WidgetType. # noqa: E501 + + + :return: The descriptor of this WidgetType. # noqa: E501 + :rtype: JsonNode + """ + return self._descriptor + + @descriptor.setter + def descriptor(self, descriptor): + """Sets the descriptor of this WidgetType. + + + :param descriptor: The descriptor of this WidgetType. # noqa: E501 + :type: JsonNode + """ + + self._descriptor = descriptor + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetType, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetType): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/widget_type_details.py b/billinglayer/python/tb_rest_client/models/models_ce/widget_type_details.py new file mode 100644 index 0000000..dd8fc03 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/widget_type_details.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeDetails(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'descriptor': 'JsonNode', + 'image': 'str', + 'description': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'descriptor': 'descriptor', + 'image': 'image', + 'description': 'description' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, descriptor=None, image=None, description=None): # noqa: E501 + """WidgetTypeDetails - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._descriptor = None + self._image = None + self._description = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if descriptor is not None: + self.descriptor = descriptor + if image is not None: + self.image = image + if description is not None: + self.description = description + + @property + def id(self): + """Gets the id of this WidgetTypeDetails. # noqa: E501 + + + :return: The id of this WidgetTypeDetails. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeDetails. + + + :param id: The id of this WidgetTypeDetails. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetTypeDetails. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetTypeDetails. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetTypeDetails. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetTypeDetails. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetTypeDetails. # noqa: E501 + + + :return: The tenant_id of this WidgetTypeDetails. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetTypeDetails. + + + :param tenant_id: The tenant_id of this WidgetTypeDetails. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetTypeDetails. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetTypeDetails. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetTypeDetails. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetTypeDetails. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetTypeDetails. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetTypeDetails. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def descriptor(self): + """Gets the descriptor of this WidgetTypeDetails. # noqa: E501 + + + :return: The descriptor of this WidgetTypeDetails. # noqa: E501 + :rtype: JsonNode + """ + return self._descriptor + + @descriptor.setter + def descriptor(self, descriptor): + """Sets the descriptor of this WidgetTypeDetails. + + + :param descriptor: The descriptor of this WidgetTypeDetails. # noqa: E501 + :type: JsonNode + """ + + self._descriptor = descriptor + + @property + def image(self): + """Gets the image of this WidgetTypeDetails. # noqa: E501 + + Base64 encoded thumbnail # noqa: E501 + + :return: The image of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetTypeDetails. + + Base64 encoded thumbnail # noqa: E501 + + :param image: The image of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def description(self): + """Gets the description of this WidgetTypeDetails. # noqa: E501 + + Description of the widget # noqa: E501 + + :return: The description of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetTypeDetails. + + Description of the widget # noqa: E501 + + :param description: The description of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeDetails, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeDetails): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/widget_type_id.py b/billinglayer/python/tb_rest_client/models/models_ce/widget_type_id.py new file mode 100644 index 0000000..5385d7f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/widget_type_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetTypeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetTypeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetTypeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetTypeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetTypeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetTypeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/widget_type_info.py b/billinglayer/python/tb_rest_client/models/models_ce/widget_type_info.py new file mode 100644 index 0000000..563d4ff --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/widget_type_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'description': 'str', + 'image': 'str', + 'widget_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'description': 'description', + 'image': 'image', + 'widget_type': 'widgetType' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, description=None, image=None, widget_type=None): # noqa: E501 + """WidgetTypeInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._description = None + self._image = None + self._widget_type = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if description is not None: + self.description = description + if image is not None: + self.image = image + if widget_type is not None: + self.widget_type = widget_type + + @property + def id(self): + """Gets the id of this WidgetTypeInfo. # noqa: E501 + + + :return: The id of this WidgetTypeInfo. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeInfo. + + + :param id: The id of this WidgetTypeInfo. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetTypeInfo. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetTypeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetTypeInfo. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetTypeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetTypeInfo. # noqa: E501 + + + :return: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetTypeInfo. + + + :param tenant_id: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetTypeInfo. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetTypeInfo. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetTypeInfo. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetTypeInfo. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetTypeInfo. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetTypeInfo. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this WidgetTypeInfo. # noqa: E501 + + Description of the widget type # noqa: E501 + + :return: The description of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetTypeInfo. + + Description of the widget type # noqa: E501 + + :param description: The description of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this WidgetTypeInfo. # noqa: E501 + + Base64 encoded widget thumbnail # noqa: E501 + + :return: The image of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetTypeInfo. + + Base64 encoded widget thumbnail # noqa: E501 + + :param image: The image of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def widget_type(self): + """Gets the widget_type of this WidgetTypeInfo. # noqa: E501 + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :return: The widget_type of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._widget_type + + @widget_type.setter + def widget_type(self, widget_type): + """Sets the widget_type of this WidgetTypeInfo. + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :param widget_type: The widget_type of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._widget_type = widget_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle.py b/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle.py new file mode 100644 index 0000000..94582d9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle.py @@ -0,0 +1,330 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetsBundle(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetsBundleId', + 'created_time': 'int', + 'name': 'str', + 'tenant_id': 'TenantId', + 'alias': 'str', + 'title': 'str', + 'image': 'str', + 'description': 'str', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'name': 'name', + 'tenant_id': 'tenantId', + 'alias': 'alias', + 'title': 'title', + 'image': 'image', + 'description': 'description', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, name=None, tenant_id=None, alias=None, title=None, image=None, description=None): # noqa: E501 + """WidgetsBundle - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._name = None + self._tenant_id = None + self._alias = None + self._title = None + self._image = None + self._description = None + self._external_id = None + self.external_id = external_id + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if name is not None: + self.name = name + if tenant_id is not None: + self.tenant_id = tenant_id + if alias is not None: + self.alias = alias + if title is not None: + self.title = title + if image is not None: + self.image = image + if description is not None: + self.description = description + + @property + def id(self): + """Gets the id of this WidgetsBundle. # noqa: E501 + + + :return: The id of this WidgetsBundle. # noqa: E501 + :rtype: WidgetsBundleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetsBundle. + + + :param id: The id of this WidgetsBundle. # noqa: E501 + :type: WidgetsBundleId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this WidgetsBundle. # noqa: E501 + + Timestamp of the Widget Bundle creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetsBundle. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetsBundle. + + Timestamp of the Widget Bundle creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetsBundle. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def name(self): + """Gets the name of this WidgetsBundle. # noqa: E501 + + Same as title of the Widget Bundle. Read-only field. Update the 'title' to change the 'name' of the Widget Bundle. # noqa: E501 + + :return: The name of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetsBundle. + + Same as title of the Widget Bundle. Read-only field. Update the 'title' to change the 'name' of the Widget Bundle. # noqa: E501 + + :param name: The name of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetsBundle. # noqa: E501 + + + :return: The tenant_id of this WidgetsBundle. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetsBundle. + + + :param tenant_id: The tenant_id of this WidgetsBundle. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def alias(self): + """Gets the alias of this WidgetsBundle. # noqa: E501 + + Unique alias that is used in widget types as a reference widget bundle # noqa: E501 + + :return: The alias of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetsBundle. + + Unique alias that is used in widget types as a reference widget bundle # noqa: E501 + + :param alias: The alias of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def title(self): + """Gets the title of this WidgetsBundle. # noqa: E501 + + Title used in search and UI # noqa: E501 + + :return: The title of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this WidgetsBundle. + + Title used in search and UI # noqa: E501 + + :param title: The title of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this WidgetsBundle. # noqa: E501 + + Base64 encoded thumbnail # noqa: E501 + + :return: The image of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetsBundle. + + Base64 encoded thumbnail # noqa: E501 + + :param image: The image of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def description(self): + """Gets the description of this WidgetsBundle. # noqa: E501 + + Description # noqa: E501 + + :return: The description of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetsBundle. + + Description # noqa: E501 + + :param description: The description of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundle, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundle): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle_export_data.py b/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle_export_data.py new file mode 100644 index 0000000..004f45b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class WidgetsBundleExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'WidgetsBundle', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]', + 'widgets': 'list[WidgetTypeDetails]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations', + 'widgets': 'widgets' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None, widgets=None, *args, **kwargs): # noqa: E501 + """WidgetsBundleExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self._widgets = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + if widgets is not None: + self.widgets = widgets + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this WidgetsBundleExportData. # noqa: E501 + + + :return: The attributes of this WidgetsBundleExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this WidgetsBundleExportData. + + + :param attributes: The attributes of this WidgetsBundleExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity of this WidgetsBundleExportData. # noqa: E501 + :rtype: WidgetsBundle + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this WidgetsBundleExportData. + + + :param entity: The entity of this WidgetsBundleExportData. # noqa: E501 + :type: WidgetsBundle + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleExportData. + + + :param entity_type: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this WidgetsBundleExportData. # noqa: E501 + + + :return: The relations of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this WidgetsBundleExportData. + + + :param relations: The relations of this WidgetsBundleExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + @property + def widgets(self): + """Gets the widgets of this WidgetsBundleExportData. # noqa: E501 + + + :return: The widgets of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[WidgetTypeDetails] + """ + return self._widgets + + @widgets.setter + def widgets(self, widgets): + """Sets the widgets of this WidgetsBundleExportData. + + + :param widgets: The widgets of this WidgetsBundleExportData. # noqa: E501 + :type: list[WidgetTypeDetails] + """ + + self._widgets = widgets + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle_id.py b/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle_id.py new file mode 100644 index 0000000..f961425 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/widgets_bundle_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetsBundleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetsBundleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetsBundleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetsBundleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGETS_BUNDLE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/x509_certificate_chain_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_ce/x509_certificate_chain_provision_configuration.py new file mode 100644 index 0000000..e915ebe --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/x509_certificate_chain_provision_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class X509CertificateChainProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_create_new_devices_by_x509_certificate': 'bool', + 'certificate_reg_ex_pattern': 'str', + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'allow_create_new_devices_by_x509_certificate': 'allowCreateNewDevicesByX509Certificate', + 'certificate_reg_ex_pattern': 'certificateRegExPattern', + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, allow_create_new_devices_by_x509_certificate=None, certificate_reg_ex_pattern=None, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """X509CertificateChainProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._allow_create_new_devices_by_x509_certificate = None + self._certificate_reg_ex_pattern = None + self._provision_device_secret = None + self.discriminator = None + if allow_create_new_devices_by_x509_certificate is not None: + self.allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + if certificate_reg_ex_pattern is not None: + self.certificate_reg_ex_pattern = certificate_reg_ex_pattern + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def allow_create_new_devices_by_x509_certificate(self): + """Gets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: bool + """ + return self._allow_create_new_devices_by_x509_certificate + + @allow_create_new_devices_by_x509_certificate.setter + def allow_create_new_devices_by_x509_certificate(self, allow_create_new_devices_by_x509_certificate): + """Sets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. + + + :param allow_create_new_devices_by_x509_certificate: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: bool + """ + + self._allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + + @property + def certificate_reg_ex_pattern(self): + """Gets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._certificate_reg_ex_pattern + + @certificate_reg_ex_pattern.setter + def certificate_reg_ex_pattern(self, certificate_reg_ex_pattern): + """Sets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. + + + :param certificate_reg_ex_pattern: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._certificate_reg_ex_pattern = certificate_reg_ex_pattern + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this X509CertificateChainProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509CertificateChainProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509CertificateChainProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_ce/x509_lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_ce/x509_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..4e355c0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_ce/x509_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class X509LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """X509LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this X509LwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this X509LwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this X509LwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this X509LwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this X509LwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this X509LwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__init__.py b/billinglayer/python/tb_rest_client/models/models_pe/__init__.py new file mode 100644 index 0000000..574e885 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/__init__.py @@ -0,0 +1,418 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .default_device_profile_transport_configuration import DefaultDeviceProfileTransportConfiguration +from .json_node import JsonNode +from .merged_user_permissions import MergedUserPermissions +from .page_data_edge import PageDataEdge +from .tenant_solution_template_info import TenantSolutionTemplateInfo +from .debug_rule_node_event_filter import DebugRuleNodeEventFilter +from .admin_settings_id import AdminSettingsId +from .entity_data import EntityData +from .server_security_config import ServerSecurityConfig +from .login_response import LoginResponse +from .event_id import EventId +from .scheduler_event_info import SchedulerEventInfo +from .test_sms_request import TestSmsRequest +from .ota_package import OtaPackage +from .group_permission import GroupPermission +from .user import User +from .o_auth2_mobile_info import OAuth2MobileInfo +from .numeric_filter_predicate import NumericFilterPredicate +from .device_profile_alarm import DeviceProfileAlarm +from .ota_package_info import OtaPackageInfo +from .alarm_data import AlarmData +from .entity_id import EntityId +from .event import Event +from .complex_filter_predicate import ComplexFilterPredicate +from .edge_id import EdgeId +from .device_profile_data import DeviceProfileData +from .allowed_permissions_info import AllowedPermissionsInfo +from .device_group_ota_package import DeviceGroupOtaPackage +from .login_white_labeling_params import LoginWhiteLabelingParams +from .sign_up_request import SignUpRequest +from .share_group_request import ShareGroupRequest +from .save_ota_package_info_request import SaveOtaPackageInfoRequest +from .mqtt_device_transport_configuration import MqttDeviceTransportConfiguration +from .page_data_tb_resource_info import PageDataTbResourceInfo +from .home_dashboard import HomeDashboard +from .bulk_import_result_device import BulkImportResultDevice +from .device_search_query_filter import DeviceSearchQueryFilter +from .dashboard_info import DashboardInfo +from .byte_buffer import ByteBuffer +from .edge import Edge +from .scheduler_event_with_customer_info import SchedulerEventWithCustomerInfo +from .entity_relations_query import EntityRelationsQuery +from .sms_provider_configuration import SmsProviderConfiguration +from .entity_relation_info import EntityRelationInfo +from .tenant_id import TenantId +from .filter_predicate_valueboolean import FilterPredicateValueboolean +from .component_descriptor import ComponentDescriptor +from .short_customer_info import ShortCustomerInfo +from .duration_alarm_condition_spec import DurationAlarmConditionSpec +from .group_permission_id import GroupPermissionId +from .o_auth2_registration_info import OAuth2RegistrationInfo +from .twilio_sms_provider_configuration import TwilioSmsProviderConfiguration +from .page_data_converter import PageDataConverter +from .lw_m2m_resource_observe import LwM2mResourceObserve +from .default_tenant_profile_configuration import DefaultTenantProfileConfiguration +from .role_id import RoleId +from .check_pre_provisioned_devices_device_profile_provision_configuration import \ + CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration +from .alarm_info import AlarmInfo +from .asset import Asset +from .debug_converter_event_filter import DebugConverterEventFilter +from .o_auth2_client_info import OAuth2ClientInfo +from .boolean_filter_predicate import BooleanFilterPredicate +from .rule_chain_id import RuleChainId +from .admin_settings import AdminSettings +from .o_auth2_client_registration_template import OAuth2ClientRegistrationTemplate +from .rule_node import RuleNode +from .other_configuration import OtherConfiguration +from .device_data import DeviceData +from .page_data_integration import PageDataIntegration +from .proto_transport_payload_configuration import ProtoTransportPayloadConfiguration +from .dashboard_id import DashboardId +from .change_password_request import ChangePasswordRequest +from .tenant_profile_data import TenantProfileData +from .device import Device +from .shared_attributes_setting_snmp_communication_config import SharedAttributesSettingSnmpCommunicationConfig +from .sign_up_self_registration_params import SignUpSelfRegistrationParams +from .report_config import ReportConfig +from .o_auth2_custom_mapper_config import OAuth2CustomMapperConfig +from .update_message import UpdateMessage +from .power_saving_configuration import PowerSavingConfiguration +from .entity_group_filter import EntityGroupFilter +from .ota_package_id import OtaPackageId +from .error_event_filter import ErrorEventFilter +from .page_data_short_entity_view import PageDataShortEntityView +from .alarm_schedule import AlarmSchedule +from .user_id import UserId +from .entity_group_list_filter import EntityGroupListFilter +from .integration_id import IntegrationId +from .asset_type_filter import AssetTypeFilter +from .statistics_event_filter import StatisticsEventFilter +from .page_data_entity_group_info import PageDataEntityGroupInfo +from .api_usage_state_filter import ApiUsageStateFilter +from .merged_group_permission_info import MergedGroupPermissionInfo +from .widgets_bundle_id import WidgetsBundleId +from .atomic_integer import AtomicInteger +from .security_settings import SecuritySettings +from .event_filter import EventFilter +from .lw_m2m_object import LwM2mObject +from .edge_search_query import EdgeSearchQuery +from .page_data_scheduler_event_info import PageDataSchedulerEventInfo +from .state_entity_owner_filter import StateEntityOwnerFilter +from .o_auth2_params_info import OAuth2ParamsInfo +from .entity_view_id import EntityViewId +from .alarm_condition_filter_key import AlarmConditionFilterKey +from .merged_group_type_permission_info import MergedGroupTypePermissionInfo +from .device_transport_configuration import DeviceTransportConfiguration +from .filter_predicate_valuedouble import FilterPredicateValuedouble +from .filter_predicate_valuestring import FilterPredicateValuestring +from .page_data_role import PageDataRole +from .alarm_condition_filter import AlarmConditionFilter +from .alarm import Alarm +from .attributes_entity_view import AttributesEntityView +from .login_request import LoginRequest +from .entity_view import EntityView +from .device_profile_provision_configuration import DeviceProfileProvisionConfiguration +from .specific_time_schedule import SpecificTimeSchedule +from .favicon import Favicon +from .o_auth2_info import OAuth2Info +from .activate_user_request import ActivateUserRequest +from .converter import Converter +from .resource import Resource +from .subscription_usage import SubscriptionUsage +from .default_device_transport_configuration import DefaultDeviceTransportConfiguration +from .entity_group_id import EntityGroupId +from .telemetry_mapping_configuration import TelemetryMappingConfiguration +from .default_device_profile_configuration import DefaultDeviceProfileConfiguration +from .any_time_schedule import AnyTimeSchedule +from .allow_create_new_devices_device_profile_provision_configuration import \ + AllowCreateNewDevicesDeviceProfileProvisionConfiguration +from .to_device_rpc_request_snmp_communication_config import ToDeviceRpcRequestSnmpCommunicationConfig +from .default_device_configuration import DefaultDeviceConfiguration +from .widget_type_info import WidgetTypeInfo +from .entity_name_filter import EntityNameFilter +from .tb_resource_id import TbResourceId +from .efento_coap_device_type_configuration import EfentoCoapDeviceTypeConfiguration +from .edge_event import EdgeEvent +from .page_data_rule_chain import PageDataRuleChain +from .customer_id import CustomerId +from .snmp_device_transport_configuration import SnmpDeviceTransportConfiguration +from .short_entity_view import ShortEntityView +from .alarm_rule import AlarmRule +from .key_filter import KeyFilter +from .client_attributes_querying_snmp_communication_config import ClientAttributesQueryingSnmpCommunicationConfig +from .rule_chain_import_result import RuleChainImportResult +from .custom_menu_item import CustomMenuItem +from .role import Role +from .entity_group_info import EntityGroupInfo +from .input_stream import InputStream +from .edge_type_filter import EdgeTypeFilter +from .palette import Palette +from .object_node import ObjectNode +from .device_configuration import DeviceConfiguration +from .entity_subtype import EntitySubtype +from .entity_key import EntityKey +from .integration import Integration +from .device_type_filter import DeviceTypeFilter +from .edge_search_query_filter import EdgeSearchQueryFilter +from .save_device_with_credentials_request import SaveDeviceWithCredentialsRequest +from .bulk_import_result_edge import BulkImportResultEdge +from .lwm2m_device_transport_configuration import Lwm2mDeviceTransportConfiguration +from .palette_settings import PaletteSettings +from .response_entity import ResponseEntity +from .page_data_event import PageDataEvent +from .entity_list_filter import EntityListFilter +from .entity_type_filter import EntityTypeFilter +from .custom_time_schedule import CustomTimeSchedule +from .tenant_solution_template_instructions import TenantSolutionTemplateInstructions +from .snmp_communication_config import SnmpCommunicationConfig +from .dashboard import Dashboard +from .rule_chain_meta_data import RuleChainMetaData +from .filter_predicate_valueint import FilterPredicateValueint +from .bulk_import_result_asset import BulkImportResultAsset +from .edge_event_id import EdgeEventId +from .column_mapping import ColumnMapping +from .claim_request import ClaimRequest +from .filter_predicate_valuelong import FilterPredicateValuelong +from .widget_type_id import WidgetTypeId +from .custom_menu import CustomMenu +from .relations_search_parameters import RelationsSearchParameters +from .thingsboard_credentials_expired_response import ThingsboardCredentialsExpiredResponse +from .o_auth2_basic_mapper_config import OAuth2BasicMapperConfig +from .simple_alarm_condition_spec import SimpleAlarmConditionSpec +from .rpc import Rpc +from .group_permission_info import GroupPermissionInfo +from .rpc_id import RpcId +from .default_rule_chain_create_request import DefaultRuleChainCreateRequest +from .transport_payload_type_configuration import TransportPayloadTypeConfiguration +from .entity_group import EntityGroup +from .ts_value import TsValue +from .solution_install_response import SolutionInstallResponse +from .telemetry_querying_snmp_communication_config import TelemetryQueryingSnmpCommunicationConfig +from .device_profile_configuration import DeviceProfileConfiguration +from .entity_group_name_filter import EntityGroupNameFilter +from .entity_data_query import EntityDataQuery +from .custom_translation import CustomTranslation +from .entity_count_query import EntityCountQuery +from .contact_basedobject import ContactBasedobject +from .entity_view_search_query import EntityViewSearchQuery +from .bootstrap_configuration import BootstrapConfiguration +from .o_auth2_domain_info import OAuth2DomainInfo +from .bulk_import_request import BulkImportRequest +from .node_connection_info import NodeConnectionInfo +from .entity_data_page_link import EntityDataPageLink +from .dynamic_valueint import DynamicValueint +from .thingsboard_error_response import ThingsboardErrorResponse +from .coap_device_transport_configuration import CoapDeviceTransportConfiguration +from .string_filter_predicate import StringFilterPredicate +from .snmp_mapping import SnmpMapping +from .mqtt_device_profile_transport_configuration import MqttDeviceProfileTransportConfiguration +from .telemetry_entity_view import TelemetryEntityView +from .single_entity_filter import SingleEntityFilter +from .entity_view_search_query_filter import EntityViewSearchQueryFilter +from .disabled_device_profile_provision_configuration import DisabledDeviceProfileProvisionConfiguration +from .asset_search_query import AssetSearchQuery +from .entity_filter import EntityFilter +from .debug_integration_event_filter import DebugIntegrationEventFilter +from .entity_view_type_filter import EntityViewTypeFilter +from .dynamic_valueboolean import DynamicValueboolean +from .tenant_profile_configuration import TenantProfileConfiguration +from .customer import Customer +from .dynamic_valuelong import DynamicValuelong +from .device_profile_transport_configuration import DeviceProfileTransportConfiguration +from .tb_resource_info import TbResourceInfo +from .object_attributes import ObjectAttributes +from .relation_entity_type_filter import RelationEntityTypeFilter +from .asset_search_query_filter import AssetSearchQueryFilter +from .reset_password_email_request import ResetPasswordEmailRequest +from .tenant_solution_template_details import TenantSolutionTemplateDetails +from .tenant_profile_id import TenantProfileId +from .blob_entity_id import BlobEntityId +from .key_filter_predicate import KeyFilterPredicate +from .o_auth2_mapper_config import OAuth2MapperConfig +from .default_coap_device_type_configuration import DefaultCoapDeviceTypeConfiguration +from .snmp_device_profile_transport_configuration import SnmpDeviceProfileTransportConfiguration +from .life_cycle_event_filter import LifeCycleEventFilter +from .blob_entity_with_customer_info import BlobEntityWithCustomerInfo +from .relations_query_filter import RelationsQueryFilter +from .alarm_condition import AlarmCondition +from .self_registration_params import SelfRegistrationParams +from .rule_chain_data import RuleChainData +from .dynamic_valuedouble import DynamicValuedouble +from .dynamic_valuestring import DynamicValuestring +from .lw_m2m_instance import LwM2mInstance +from .repeating_alarm_condition_spec import RepeatingAlarmConditionSpec +from .custom_time_schedule_item import CustomTimeScheduleItem +from .mapping import Mapping +from .user_password_policy import UserPasswordPolicy +from .delete_tenant_request import DeleteTenantRequest +from .page_data_edge_event import PageDataEdgeEvent +from .device_id import DeviceId +from .converter_id import ConverterId +from .aws_sns_sms_provider_configuration import AwsSnsSmsProviderConfiguration +from .scheduler_event import SchedulerEvent +from .lwm2m_device_profile_transport_configuration import Lwm2mDeviceProfileTransportConfiguration +from .page_data_blob_entity_with_customer_info import PageDataBlobEntityWithCustomerInfo +from .component_descriptor_id import ComponentDescriptorId +from .o_auth2_client_registration_template_id import OAuth2ClientRegistrationTemplateId +from .alarm_id import AlarmId +from .audit_log import AuditLog +from .scheduler_event_id import SchedulerEventId +from .alarm_data_page_link import AlarmDataPageLink +from .device_search_query import DeviceSearchQuery +from .debug_rule_chain_event_filter import DebugRuleChainEventFilter +from .alarm_data_query import AlarmDataQuery +from .alarm_condition_spec import AlarmConditionSpec +from .coap_device_type_configuration import CoapDeviceTypeConfiguration +from .reset_password_request import ResetPasswordRequest +from .white_labeling_params import WhiteLabelingParams +from .asset_id import AssetId +from .tb_resource import TbResource +from .blob_entity_info import BlobEntityInfo +from .device_credentials_id import DeviceCredentialsId +from .rule_node_id import RuleNodeId +from .rule_chain_connection_info import RuleChainConnectionInfo +from .audit_log_id import AuditLogId +from .device_profile_id import DeviceProfileId +from .coap_device_profile_transport_configuration import CoapDeviceProfileTransportConfiguration +from .json_transport_payload_configuration import JsonTransportPayloadConfiguration +from .entity_data_sort_order import EntityDataSortOrder +from .page_data_ota_package_info import PageDataOtaPackageInfo +from .page_data_contact_basedobject import PageDataContactBasedobject +from .rule_chain import RuleChain +from .entities_by_group_name_filter import EntitiesByGroupNameFilter +from .version_create_request import VersionCreateRequest +from .entity_export_dataobject import EntityExportDataobject +from .two_fa_provider_config import TwoFaProviderConfig +from .version_load_request import VersionLoadRequest +from .lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential +from .two_fa_account_config import TwoFaAccountConfig +from .version_load_result import VersionLoadResult +from .deferred_result_list_branch_info import DeferredResultListBranchInfo +from .deferred_result_page_data_entity_version import DeferredResultPageDataEntityVersion +from .deferred_result_entity_data_info import DeferredResultEntityDataInfo +from .version_creation_result import VersionCreationResult +from .deferred_result_list_versioned_entity_info import DeferredResultListVersionedEntityInfo +from .deferred_result_entity_data_diff import DeferredResultEntityDataDiff +from .entity_version import EntityVersion +from .entity_type_load_result import EntityTypeLoadResult +from .complex_version_create_request import ComplexVersionCreateRequest +from .version_load_config import VersionLoadConfig +from .single_entity_version_load_request import SingleEntityVersionLoadRequest +from .entity_type_version_load_request import EntityTypeVersionLoadRequest +from .version_create_config import VersionCreateConfig +from .single_entity_version_create_request import SingleEntityVersionCreateRequest +from .entity_type_version_create_config import EntityTypeVersionCreateConfig +from .entity_type_version_load_config import EntityTypeVersionLoadConfig +from .repository_settings import RepositorySettings +from .deferred_result_repository_settings import DeferredResultRepositorySettings +from .deferred_result_void import DeferredResultVoid +from .auto_version_create_config import AutoVersionCreateConfig +from .platform_two_fa_settings import PlatformTwoFaSettings +from .account_two_fa_settings import AccountTwoFaSettings +from .two_fa_account_config_update_request import TwoFaAccountConfigUpdateRequest +from .two_fa_provider_info import TwoFaProviderInfo +from .entity_load_error import EntityLoadError +from .array_node import ArrayNode +from .integration_info import IntegrationInfo +from .page_data_integration_info import PageDataIntegrationInfo +from .raw_data_event_filter import RawDataEventFilter +from .rule_node_debug_event_filter import RuleNodeDebugEventFilter +from .scheduler_event_filter import SchedulerEventFilter +from .affected_tenant_administrators_filter import AffectedTenantAdministratorsFilter +from .affected_user_filter import AffectedUserFilter +from .alarm_assignee import AlarmAssignee +from .alarm_assignment_notification_rule_trigger_config import AlarmAssignmentNotificationRuleTriggerConfig +from .alarm_comment import AlarmComment +from .alarm_comment_id import AlarmCommentId +from .alarm_comment_info import AlarmCommentInfo +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .alarm_count_query import AlarmCountQuery +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .all_users_filter import AllUsersFilter +from .api_usage_limit_notification_rule_trigger_config import ApiUsageLimitNotificationRuleTriggerConfig +from .asset_info import AssetInfo +from .asset_profile_id import AssetProfileId +from .clear_rule import ClearRule +from .comparison_ts_value import ComparisonTsValue +from .customer_info import CustomerInfo +from .customer_users_filter import CustomerUsersFilter +from .delivery_method_notification_template import DeliveryMethodNotificationTemplate +from .device_activity_notification_rule_trigger_config import DeviceActivityNotificationRuleTriggerConfig +from .device_info import DeviceInfo +from .edge_info import EdgeInfo +from .edge_install_instructions import EdgeInstallInstructions +from .email_delivery_method_notification_template import EmailDeliveryMethodNotificationTemplate +from .entities_limit_notification_rule_trigger_config import EntitiesLimitNotificationRuleTriggerConfig +from .entity_action_notification_rule_trigger_config import EntityActionNotificationRuleTriggerConfig +from .entity_view_info import EntityViewInfo +from .escalated_notification_rule_recipients_config import EscalatedNotificationRuleRecipientsConfig +from .event_info import EventInfo +from .features_info import FeaturesInfo +from .integration_lifecycle_event_notification_rule_trigger_config import IntegrationLifecycleEventNotificationRuleTriggerConfig +from .jwt_settings import JWTSettings +from .last_visited_dashboard_info import LastVisitedDashboardInfo +from .license_usage_info import LicenseUsageInfo +from .new_platform_version_notification_rule_trigger_config import NewPlatformVersionNotificationRuleTriggerConfig +from .notification import Notification +from .notification_delivery_method_config import NotificationDeliveryMethodConfig +from .notification_id import NotificationId +from .notification_info import NotificationInfo +from .notification_request import NotificationRequest +from .notification_request_config import NotificationRequestConfig +from .notification_request_id import NotificationRequestId +from .notification_request_preview import NotificationRequestPreview +from .notification_request_stats import NotificationRequestStats +from .notification_rule_config import NotificationRuleConfig +from .notification_rule_id import NotificationRuleId +from .notification_rule_recipients_config import NotificationRuleRecipientsConfig +from .notification_target_id import NotificationTargetId +from .notification_template_config import NotificationTemplateConfig +from .notification_template_id import NotificationTemplateId +from .originator_entity_owner_users_filter import OriginatorEntityOwnerUsersFilter +from .page_data_customer_info import PageDataCustomerInfo +from .page_data_edge_info import PageDataEdgeInfo +from .page_data_entity_view_info import PageDataEntityViewInfo +from .page_data_event_info import PageDataEventInfo +from .page_data_user_email_info import PageDataUserEmailInfo +from .page_data_user_info import PageDataUserInfo +from .platform_users_notification_target_config import PlatformUsersNotificationTargetConfig +from .psklw_m2_m_bootstrap_server_credential import PSKLwM2MBootstrapServerCredential +from .repository_settings import RepositorySettings +from .rpklw_m2_m_bootstrap_server_credential import RPKLwM2MBootstrapServerCredential +from .rule_chain_debug_event_filter import RuleChainDebugEventFilter +from .rule_engine_component_lifecycle_event_notification_rule_trigger_config import RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig +from .slack_conversation import SlackConversation +from .slack_delivery_method_notification_template import SlackDeliveryMethodNotificationTemplate +from .slack_notification_delivery_method_config import SlackNotificationDeliveryMethodConfig +from .slack_notification_target_config import SlackNotificationTargetConfig +from .sms_delivery_method_notification_template import SmsDeliveryMethodNotificationTemplate +from .starred_dashboard_info import StarredDashboardInfo +from .system_administrators_filter import SystemAdministratorsFilter +from .system_info import SystemInfo +from .system_info_data import SystemInfoData +from .tenant_administrators_filter import TenantAdministratorsFilter +from .user_dashboards_info import UserDashboardsInfo +from .user_email_info import UserEmailInfo +from .user_group_list_filter import UserGroupListFilter +from .user_info import UserInfo +from .user_list_filter import UserListFilter +from .user_role_filter import UserRoleFilter +from .users_filter import UsersFilter +from .web_delivery_method_notification_template import WebDeliveryMethodNotificationTemplate +from .x509_certificate_chain_provision_configuration import X509CertificateChainProvisionConfiguration diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..83e6144 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/account_two_fa_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/account_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..ba86ad5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/account_two_fa_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/activate_user_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/activate_user_request.cpython-311.pyc new file mode 100644 index 0000000..610a332 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/activate_user_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/admin_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/admin_settings.cpython-311.pyc new file mode 100644 index 0000000..dfdc8e8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/admin_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/admin_settings_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/admin_settings_id.cpython-311.pyc new file mode 100644 index 0000000..85892c0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/admin_settings_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..84c6c10 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/affected_user_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/affected_user_filter.cpython-311.pyc new file mode 100644 index 0000000..9286497 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/affected_user_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm.cpython-311.pyc new file mode 100644 index 0000000..fae10e2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignee.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignee.cpython-311.pyc new file mode 100644 index 0000000..a730da9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignee.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..d4823c4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment.cpython-311.pyc new file mode 100644 index 0000000..3ac98b8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_id.cpython-311.pyc new file mode 100644 index 0000000..03dadc7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_info.cpython-311.pyc new file mode 100644 index 0000000..2ff3608 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..f5377f7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition.cpython-311.pyc new file mode 100644 index 0000000..8db432f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter.cpython-311.pyc new file mode 100644 index 0000000..57ddf30 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter_key.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter_key.cpython-311.pyc new file mode 100644 index 0000000..3a98e91 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter_key.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..18966b1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_count_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_count_query.cpython-311.pyc new file mode 100644 index 0000000..0b9f957 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_count_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data.cpython-311.pyc new file mode 100644 index 0000000..e284ccb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_page_link.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..dd33367 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_page_link.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_query.cpython-311.pyc new file mode 100644 index 0000000..f6afe4a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_id.cpython-311.pyc new file mode 100644 index 0000000..ed1f1b3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_info.cpython-311.pyc new file mode 100644 index 0000000..5d46800 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..10f4616 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_rule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_rule.cpython-311.pyc new file mode 100644 index 0000000..56c54e0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_rule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_schedule.cpython-311.pyc new file mode 100644 index 0000000..4ee7d70 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/alarm_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/all_users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/all_users_filter.cpython-311.pyc new file mode 100644 index 0000000..81f92bc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/all_users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..6a34fc8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/allowed_permissions_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/allowed_permissions_info.cpython-311.pyc new file mode 100644 index 0000000..2a9fbaf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/allowed_permissions_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/any_time_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/any_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..ccd6a26 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/any_time_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..2e38db0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/api_usage_state_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/api_usage_state_filter.cpython-311.pyc new file mode 100644 index 0000000..dce4d69 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/api_usage_state_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/array_node.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/array_node.cpython-311.pyc new file mode 100644 index 0000000..526bf0d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/array_node.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset.cpython-311.pyc new file mode 100644 index 0000000..2cc8730 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_id.cpython-311.pyc new file mode 100644 index 0000000..dcd1a95 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_info.cpython-311.pyc new file mode 100644 index 0000000..f606428 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_profile_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_profile_id.cpython-311.pyc new file mode 100644 index 0000000..ca5e1a5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_profile_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query.cpython-311.pyc new file mode 100644 index 0000000..5a8ac92 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..29b5c16 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_type_filter.cpython-311.pyc new file mode 100644 index 0000000..64d59d7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/asset_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/atomic_integer.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/atomic_integer.cpython-311.pyc new file mode 100644 index 0000000..f948056 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/atomic_integer.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/attribute_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/attribute_export_data.cpython-311.pyc new file mode 100644 index 0000000..640e601 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/attribute_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/attributes_entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/attributes_entity_view.cpython-311.pyc new file mode 100644 index 0000000..de5b05f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/attributes_entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/audit_log.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/audit_log.cpython-311.pyc new file mode 100644 index 0000000..7e78874 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/audit_log.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/audit_log_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/audit_log_id.cpython-311.pyc new file mode 100644 index 0000000..9b93ec5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/audit_log_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/auto_version_create_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/auto_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..928d9cb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/auto_version_create_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..57df6e6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..625e273 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..40258d8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_id.cpython-311.pyc new file mode 100644 index 0000000..8e7d6a7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_info.cpython-311.pyc new file mode 100644 index 0000000..a7147e3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_with_customer_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_with_customer_info.cpython-311.pyc new file mode 100644 index 0000000..323d12f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_with_customer_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/boolean_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/boolean_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..feb00ac Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/boolean_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bootstrap_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bootstrap_configuration.cpython-311.pyc new file mode 100644 index 0000000..65d0e87 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bootstrap_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/branch_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/branch_info.cpython-311.pyc new file mode 100644 index 0000000..ecba02b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/branch_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_request.cpython-311.pyc new file mode 100644 index 0000000..44957c2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_asset.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_asset.cpython-311.pyc new file mode 100644 index 0000000..cae4b2e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_asset.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_device.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_device.cpython-311.pyc new file mode 100644 index 0000000..2be3c1c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_device.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_edge.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_edge.cpython-311.pyc new file mode 100644 index 0000000..28ad980 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_edge.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/byte_buffer.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/byte_buffer.cpython-311.pyc new file mode 100644 index 0000000..1b09676 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/byte_buffer.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/change_password_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/change_password_request.cpython-311.pyc new file mode 100644 index 0000000..b245ca2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/change_password_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..1fc3f84 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/claim_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/claim_request.cpython-311.pyc new file mode 100644 index 0000000..72f0180 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/claim_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/clear_rule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/clear_rule.cpython-311.pyc new file mode 100644 index 0000000..2f65549 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/clear_rule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..80caa9a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/client_registration_dto.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/client_registration_dto.cpython-311.pyc new file mode 100644 index 0000000..3e7c09a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/client_registration_dto.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..d3a49ef Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..61e4fa6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..d95c73f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/coap_device_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/column_mapping.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/column_mapping.cpython-311.pyc new file mode 100644 index 0000000..7f3d11d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/column_mapping.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/comparison_ts_value.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/comparison_ts_value.cpython-311.pyc new file mode 100644 index 0000000..7265fce Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/comparison_ts_value.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/complex_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/complex_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..d2b707c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/complex_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/complex_version_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/complex_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..1d38849 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/complex_version_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor.cpython-311.pyc new file mode 100644 index 0000000..f1f2f0f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor_id.cpython-311.pyc new file mode 100644 index 0000000..30030e9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/contact_basedobject.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/contact_basedobject.cpython-311.pyc new file mode 100644 index 0000000..db9ec53 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/contact_basedobject.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/converter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/converter.cpython-311.pyc new file mode 100644 index 0000000..f7592cc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/converter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/converter_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/converter_id.cpython-311.pyc new file mode 100644 index 0000000..dd4ee90 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/converter_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_menu.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_menu.cpython-311.pyc new file mode 100644 index 0000000..8249fb6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_menu.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_menu_item.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_menu_item.cpython-311.pyc new file mode 100644 index 0000000..861c336 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_menu_item.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..30cb667 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule_item.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule_item.cpython-311.pyc new file mode 100644 index 0000000..9f08f7f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule_item.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_translation.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_translation.cpython-311.pyc new file mode 100644 index 0000000..1f0d04e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/custom_translation.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer.cpython-311.pyc new file mode 100644 index 0000000..26d243f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_id.cpython-311.pyc new file mode 100644 index 0000000..1189f22 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_info.cpython-311.pyc new file mode 100644 index 0000000..502ac39 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_users_filter.cpython-311.pyc new file mode 100644 index 0000000..e2a77a7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/customer_users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard.cpython-311.pyc new file mode 100644 index 0000000..376c2a4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard_id.cpython-311.pyc new file mode 100644 index 0000000..b6e003b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..ac02e70 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_converter_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_converter_event_filter.cpython-311.pyc new file mode 100644 index 0000000..93b2e32 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_converter_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_integration_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_integration_event_filter.cpython-311.pyc new file mode 100644 index 0000000..7d21689 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_integration_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc new file mode 100644 index 0000000..6b3a4e7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_node_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_node_event_filter.cpython-311.pyc new file mode 100644 index 0000000..b14869d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_node_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_coap_device_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..b53d073 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_coap_device_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_configuration.cpython-311.pyc new file mode 100644 index 0000000..60eb890 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..5fc98db Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..a982e65 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..f46faf8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_rule_chain_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_rule_chain_create_request.cpython-311.pyc new file mode 100644 index 0000000..768c418 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_rule_chain_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_tenant_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..13afdd7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/default_tenant_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..8c41c6c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..ea9790b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_branch_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_branch_info.cpython-311.pyc new file mode 100644 index 0000000..e29147a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_branch_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..0d961df Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..a0a49d8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_repository_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_repository_settings.cpython-311.pyc new file mode 100644 index 0000000..5af3804 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_repository_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_void.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_void.cpython-311.pyc new file mode 100644 index 0000000..6a6e5ab Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_void.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_resultuuid.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_resultuuid.cpython-311.pyc new file mode 100644 index 0000000..eeae57e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/deferred_resultuuid.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/delete_tenant_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/delete_tenant_request.cpython-311.pyc new file mode 100644 index 0000000..aee1725 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/delete_tenant_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..3ae4d03 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device.cpython-311.pyc new file mode 100644 index 0000000..3a1edaa Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..24e1cd1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_configuration.cpython-311.pyc new file mode 100644 index 0000000..f423eeb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_credentials_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_credentials_id.cpython-311.pyc new file mode 100644 index 0000000..e101743 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_credentials_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_data.cpython-311.pyc new file mode 100644 index 0000000..917c8f7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_export_data.cpython-311.pyc new file mode 100644 index 0000000..39ec958 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_group_ota_package.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_group_ota_package.cpython-311.pyc new file mode 100644 index 0000000..83f6faa Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_group_ota_package.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_id.cpython-311.pyc new file mode 100644 index 0000000..5d055db Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_info.cpython-311.pyc new file mode 100644 index 0000000..317f39a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_alarm.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_alarm.cpython-311.pyc new file mode 100644 index 0000000..a7f122b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_alarm.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..c778a4e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_data.cpython-311.pyc new file mode 100644 index 0000000..c7a6254 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_id.cpython-311.pyc new file mode 100644 index 0000000..301ac45 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..c7bf681 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..a39f9c2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_search_query.cpython-311.pyc new file mode 100644 index 0000000..8ed3652 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..df0dfed Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..3f6ee5f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_type_filter.cpython-311.pyc new file mode 100644 index 0000000..e686567 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/device_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..d0b340f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/domain_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/domain_info.cpython-311.pyc new file mode 100644 index 0000000..22f5e58 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/domain_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/duration_alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/duration_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..4cdfd5d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/duration_alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueboolean.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..746ebf2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueboolean.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuedouble.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..163e2bc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuedouble.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueint.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueint.cpython-311.pyc new file mode 100644 index 0000000..8516923 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueint.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuelong.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuelong.cpython-311.pyc new file mode 100644 index 0000000..c93c7cc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuelong.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuestring.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuestring.cpython-311.pyc new file mode 100644 index 0000000..230536b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuestring.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge.cpython-311.pyc new file mode 100644 index 0000000..8a0d675 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_event.cpython-311.pyc new file mode 100644 index 0000000..3ec6576 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_event_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_event_id.cpython-311.pyc new file mode 100644 index 0000000..8674c8a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_event_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_id.cpython-311.pyc new file mode 100644 index 0000000..1b4d585 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_info.cpython-311.pyc new file mode 100644 index 0000000..9301879 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_install_instructions.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_install_instructions.cpython-311.pyc new file mode 100644 index 0000000..2eb3338 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_install_instructions.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query.cpython-311.pyc new file mode 100644 index 0000000..98cd2bd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..4f0a9ca Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_type_filter.cpython-311.pyc new file mode 100644 index 0000000..c20cbb9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/edge_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..001a1d7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..7a34c0e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..56eb1a5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..ffeb79d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entities_by_group_name_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entities_by_group_name_filter.cpython-311.pyc new file mode 100644 index 0000000..5af9e14 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entities_by_group_name_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..ab2d125 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..63ee67c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_count_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_count_query.cpython-311.pyc new file mode 100644 index 0000000..b79b8ae Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_count_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data.cpython-311.pyc new file mode 100644 index 0000000..d702833 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_diff.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..9e24284 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_diff.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..69dc1c7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_page_link.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..ac67d9e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_page_link.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_query.cpython-311.pyc new file mode 100644 index 0000000..bdec3ef Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_sort_order.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_sort_order.cpython-311.pyc new file mode 100644 index 0000000..c6563fe Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_data_sort_order.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_export_dataobject.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_export_dataobject.cpython-311.pyc new file mode 100644 index 0000000..65557c9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_export_dataobject.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_filter.cpython-311.pyc new file mode 100644 index 0000000..894118a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group.cpython-311.pyc new file mode 100644 index 0000000..2307439 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_export_data.cpython-311.pyc new file mode 100644 index 0000000..d6709d0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_filter.cpython-311.pyc new file mode 100644 index 0000000..733bba8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_id.cpython-311.pyc new file mode 100644 index 0000000..42357c4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_info.cpython-311.pyc new file mode 100644 index 0000000..326a60a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_list_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_list_filter.cpython-311.pyc new file mode 100644 index 0000000..5b59aa3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_list_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_name_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_name_filter.cpython-311.pyc new file mode 100644 index 0000000..bfe9c33 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_group_name_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_id.cpython-311.pyc new file mode 100644 index 0000000..7b98430 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_key.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_key.cpython-311.pyc new file mode 100644 index 0000000..e64e248 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_key.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_list_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_list_filter.cpython-311.pyc new file mode 100644 index 0000000..198a5d8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_list_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_load_error.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_load_error.cpython-311.pyc new file mode 100644 index 0000000..de60aa3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_load_error.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_name_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_name_filter.cpython-311.pyc new file mode 100644 index 0000000..bc9c2b5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_name_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_relation_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_relation_info.cpython-311.pyc new file mode 100644 index 0000000..03c62a5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_relation_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_relations_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_relations_query.cpython-311.pyc new file mode 100644 index 0000000..ac9e3e2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_relations_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_subtype.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_subtype.cpython-311.pyc new file mode 100644 index 0000000..94311a5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_subtype.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..08d1387 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_load_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_load_result.cpython-311.pyc new file mode 100644 index 0000000..b4cad70 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_load_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_create_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..07a9d4e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_create_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_config.cpython-311.pyc new file mode 100644 index 0000000..3803aae Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..1d4230c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_version.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_version.cpython-311.pyc new file mode 100644 index 0000000..df9b54b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_version.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view.cpython-311.pyc new file mode 100644 index 0000000..ef11db9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_id.cpython-311.pyc new file mode 100644 index 0000000..2229913 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..a6c480f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query.cpython-311.pyc new file mode 100644 index 0000000..d61ce02 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..24c37cb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_type_filter.cpython-311.pyc new file mode 100644 index 0000000..9671728 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/entity_view_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/error_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/error_event_filter.cpython-311.pyc new file mode 100644 index 0000000..8385939 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/error_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..ad80b46 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event.cpython-311.pyc new file mode 100644 index 0000000..3136bad Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_filter.cpython-311.pyc new file mode 100644 index 0000000..4964f61 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_id.cpython-311.pyc new file mode 100644 index 0000000..6a6833b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_info.cpython-311.pyc new file mode 100644 index 0000000..2edbd21 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/event_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/exportable_entity_entity_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/exportable_entity_entity_id.cpython-311.pyc new file mode 100644 index 0000000..174dacd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/exportable_entity_entity_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/favicon.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/favicon.cpython-311.pyc new file mode 100644 index 0000000..35b695d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/favicon.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/features_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/features_info.cpython-311.pyc new file mode 100644 index 0000000..b72a8db Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/features_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueboolean.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..0a171af Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueboolean.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuedouble.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..8c91171 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuedouble.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueint.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueint.cpython-311.pyc new file mode 100644 index 0000000..6caba74 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueint.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuelong.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuelong.cpython-311.pyc new file mode 100644 index 0000000..f35cbe4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuelong.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuestring.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuestring.cpython-311.pyc new file mode 100644 index 0000000..009fffa Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuestring.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_entity_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_entity_export_data.cpython-311.pyc new file mode 100644 index 0000000..56aff7e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_entity_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission.cpython-311.pyc new file mode 100644 index 0000000..bbb588c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission_id.cpython-311.pyc new file mode 100644 index 0000000..9a3893b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission_info.cpython-311.pyc new file mode 100644 index 0000000..14c165c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/group_permission_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/home_dashboard.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/home_dashboard.cpython-311.pyc new file mode 100644 index 0000000..c03b119 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/home_dashboard.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/http_routing_key_body.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/http_routing_key_body.cpython-311.pyc new file mode 100644 index 0000000..698b0f8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/http_routing_key_body.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/input_stream.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/input_stream.cpython-311.pyc new file mode 100644 index 0000000..1ec68a8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/input_stream.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration.cpython-311.pyc new file mode 100644 index 0000000..fdf4c88 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_id.cpython-311.pyc new file mode 100644 index 0000000..a6cb240 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_info.cpython-311.pyc new file mode 100644 index 0000000..f1abbf3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..dc8e039 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/integration_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/json_node.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/json_node.cpython-311.pyc new file mode 100644 index 0000000..7b08f3c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/json_node.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/json_transport_payload_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/json_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..d0205ee Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/json_transport_payload_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/jwt_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/jwt_settings.cpython-311.pyc new file mode 100644 index 0000000..29b49d8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/jwt_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/key_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/key_filter.cpython-311.pyc new file mode 100644 index 0000000..f53d15c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/key_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/key_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/key_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..acd4579 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/key_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/last_visited_dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/last_visited_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..dfcfeb9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/last_visited_dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/license_usage_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/license_usage_info.cpython-311.pyc new file mode 100644 index 0000000..de4b48f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/license_usage_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/life_cycle_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/life_cycle_event_filter.cpython-311.pyc new file mode 100644 index 0000000..1e81ea6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/life_cycle_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_request.cpython-311.pyc new file mode 100644 index 0000000..a60310c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_response.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_response.cpython-311.pyc new file mode 100644 index 0000000..7753526 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_response.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_white_labeling_params.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_white_labeling_params.cpython-311.pyc new file mode 100644 index 0000000..dc31ef3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/login_white_labeling_params.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..9fe9ecf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc new file mode 100644 index 0000000..ec222b9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_instance.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_instance.cpython-311.pyc new file mode 100644 index 0000000..c58e204 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_instance.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_object.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_object.cpython-311.pyc new file mode 100644 index 0000000..c2524fc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_object.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_resource_observe.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_resource_observe.cpython-311.pyc new file mode 100644 index 0000000..63eb424 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_resource_observe.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..1507575 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..77fc693 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mapping.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mapping.cpython-311.pyc new file mode 100644 index 0000000..773af01 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mapping.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_group_permission_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_group_permission_info.cpython-311.pyc new file mode 100644 index 0000000..03981ee Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_group_permission_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_group_type_permission_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_group_type_permission_info.cpython-311.pyc new file mode 100644 index 0000000..ce4e246 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_group_type_permission_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_user_permissions.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_user_permissions.cpython-311.pyc new file mode 100644 index 0000000..dadfbf9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/merged_user_permissions.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..7a02d73 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..3b01b9f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..1f9dcae Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..c43ebb0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/node_connection_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/node_connection_info.cpython-311.pyc new file mode 100644 index 0000000..12754a0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/node_connection_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification.cpython-311.pyc new file mode 100644 index 0000000..2609e15 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_delivery_method_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..8896cc9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_delivery_method_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_id.cpython-311.pyc new file mode 100644 index 0000000..84bb924 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_info.cpython-311.pyc new file mode 100644 index 0000000..a70188c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request.cpython-311.pyc new file mode 100644 index 0000000..85b8084 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_config.cpython-311.pyc new file mode 100644 index 0000000..b3fb47b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_id.cpython-311.pyc new file mode 100644 index 0000000..731e43b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_preview.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_preview.cpython-311.pyc new file mode 100644 index 0000000..5d97f49 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_preview.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_stats.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_stats.cpython-311.pyc new file mode 100644 index 0000000..3d74614 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_request_stats.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_config.cpython-311.pyc new file mode 100644 index 0000000..22cf31c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_id.cpython-311.pyc new file mode 100644 index 0000000..9c59fc6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_recipients_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..afe8572 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_recipients_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_target_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_target_id.cpython-311.pyc new file mode 100644 index 0000000..d9fdd5b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_target_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_template_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_template_config.cpython-311.pyc new file mode 100644 index 0000000..b79e68a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_template_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_template_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_template_id.cpython-311.pyc new file mode 100644 index 0000000..2dd695e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/notification_template_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/numeric_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/numeric_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..c6bb1e9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/numeric_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..a9fee61 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_info.cpython-311.pyc new file mode 100644 index 0000000..3855d63 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template.cpython-311.pyc new file mode 100644 index 0000000..d37612b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc new file mode 100644 index 0000000..119e9df Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_domain_params.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_domain_params.cpython-311.pyc new file mode 100644 index 0000000..e200edd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_domain_params.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_params.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_params.cpython-311.pyc new file mode 100644 index 0000000..0a5fd5b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_params.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..33b3808 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_domain_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_domain_info.cpython-311.pyc new file mode 100644 index 0000000..fee5397 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_domain_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_info.cpython-311.pyc new file mode 100644 index 0000000..61b955c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mapper_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..2f9e1a6 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mapper_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mobile_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mobile_info.cpython-311.pyc new file mode 100644 index 0000000..ad6742e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mobile_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_params_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_params_info.cpython-311.pyc new file mode 100644 index 0000000..c266c1a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_params_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_registration_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_registration_info.cpython-311.pyc new file mode 100644 index 0000000..a675e0e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_registration_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/object_attributes.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/object_attributes.cpython-311.pyc new file mode 100644 index 0000000..169c5e4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/object_attributes.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/object_node.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/object_node.cpython-311.pyc new file mode 100644 index 0000000..fd0a48b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/object_node.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc new file mode 100644 index 0000000..53c6aa2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package.cpython-311.pyc new file mode 100644 index 0000000..34d00eb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_id.cpython-311.pyc new file mode 100644 index 0000000..8c946b1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..0ab6edd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc new file mode 100644 index 0000000..e0daaf7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/other_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/other_configuration.cpython-311.pyc new file mode 100644 index 0000000..2d963c5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/other_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_blob_entity_with_customer_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_blob_entity_with_customer_info.cpython-311.pyc new file mode 100644 index 0000000..22f5645 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_blob_entity_with_customer_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_contact_basedobject.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_contact_basedobject.cpython-311.pyc new file mode 100644 index 0000000..fbe98cd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_contact_basedobject.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_converter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_converter.cpython-311.pyc new file mode 100644 index 0000000..60df920 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_converter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_customer_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_customer_info.cpython-311.pyc new file mode 100644 index 0000000..e9928c5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_customer_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge.cpython-311.pyc new file mode 100644 index 0000000..4b395ba Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_event.cpython-311.pyc new file mode 100644 index 0000000..219243c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_info.cpython-311.pyc new file mode 100644 index 0000000..b00b057 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group.cpython-311.pyc new file mode 100644 index 0000000..20ec8b9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group_info.cpython-311.pyc new file mode 100644 index 0000000..6a99835 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_version.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..8228d0f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_version.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_view_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..4c28876 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_view_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_event.cpython-311.pyc new file mode 100644 index 0000000..d01dd83 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_event_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_event_info.cpython-311.pyc new file mode 100644 index 0000000..5f5925b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_event_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration.cpython-311.pyc new file mode 100644 index 0000000..deb6f01 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration_info.cpython-311.pyc new file mode 100644 index 0000000..b26fe3b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_ota_package_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..bd9776b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_ota_package_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_queue.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_queue.cpython-311.pyc new file mode 100644 index 0000000..026c153 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_queue.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_role.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_role.cpython-311.pyc new file mode 100644 index 0000000..afcdbf7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_role.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_rule_chain.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_rule_chain.cpython-311.pyc new file mode 100644 index 0000000..6cf89c5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_rule_chain.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_scheduler_event_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_scheduler_event_info.cpython-311.pyc new file mode 100644 index 0000000..7243ab9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_scheduler_event_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_short_entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_short_entity_view.cpython-311.pyc new file mode 100644 index 0000000..9793043 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_short_entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_tb_resource_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..efc4e34 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_tb_resource_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_email_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_email_info.cpython-311.pyc new file mode 100644 index 0000000..d2a938f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_email_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_info.cpython-311.pyc new file mode 100644 index 0000000..d117a5c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/palette.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/palette.cpython-311.pyc new file mode 100644 index 0000000..a03564d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/palette.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/palette_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/palette_settings.cpython-311.pyc new file mode 100644 index 0000000..c699053 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/palette_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/platform_two_fa_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/platform_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..ccfe142 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/platform_two_fa_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/platform_users_notification_target_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/platform_users_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..117420a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/platform_users_notification_target_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/power_saving_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/power_saving_configuration.cpython-311.pyc new file mode 100644 index 0000000..524f1aa Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/power_saving_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/processing_strategy.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/processing_strategy.cpython-311.pyc new file mode 100644 index 0000000..8e5fe79 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/processing_strategy.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/proto_transport_payload_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/proto_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..5dbe58f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/proto_transport_payload_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/psk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/psk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..ca044cf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/psk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..bb726e0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/queue.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/queue.cpython-311.pyc new file mode 100644 index 0000000..714fad2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/queue.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/queue_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/queue_id.cpython-311.pyc new file mode 100644 index 0000000..0137967 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/queue_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/raw_data_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/raw_data_event_filter.cpython-311.pyc new file mode 100644 index 0000000..e1eeba8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/raw_data_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relation_entity_type_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relation_entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..9eb74e1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relation_entity_type_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relations_query_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relations_query_filter.cpython-311.pyc new file mode 100644 index 0000000..3c863bf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relations_query_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relations_search_parameters.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relations_search_parameters.cpython-311.pyc new file mode 100644 index 0000000..eef3554 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/relations_search_parameters.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..47e90bf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/report_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/report_config.cpython-311.pyc new file mode 100644 index 0000000..d85fa5b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/report_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repository_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repository_settings.cpython-311.pyc new file mode 100644 index 0000000..b50045c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repository_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repository_settings_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repository_settings_info.cpython-311.pyc new file mode 100644 index 0000000..bac9c65 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/repository_settings_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/reset_password_email_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/reset_password_email_request.cpython-311.pyc new file mode 100644 index 0000000..51571dd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/reset_password_email_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/reset_password_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/reset_password_request.cpython-311.pyc new file mode 100644 index 0000000..a34a4d7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/reset_password_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/resource.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/resource.cpython-311.pyc new file mode 100644 index 0000000..65a25e4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/resource.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/response_entity.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/response_entity.cpython-311.pyc new file mode 100644 index 0000000..d077854 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/response_entity.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/role.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/role.cpython-311.pyc new file mode 100644 index 0000000..5ccac2a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/role.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/role_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/role_id.cpython-311.pyc new file mode 100644 index 0000000..ce8266b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/role_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpc.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpc.cpython-311.pyc new file mode 100644 index 0000000..cd02bfd Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpc.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpc_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpc_id.cpython-311.pyc new file mode 100644 index 0000000..6faef00 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpc_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..8144ef8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..9ec68b5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain.cpython-311.pyc new file mode 100644 index 0000000..9ed33b4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_connection_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_connection_info.cpython-311.pyc new file mode 100644 index 0000000..e335e24 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_connection_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_data.cpython-311.pyc new file mode 100644 index 0000000..798e545 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..8c5dfbc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_export_data.cpython-311.pyc new file mode 100644 index 0000000..ca978fe Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_id.cpython-311.pyc new file mode 100644 index 0000000..fd5f8c2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_import_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_import_result.cpython-311.pyc new file mode 100644 index 0000000..6b4e72c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_import_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_meta_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_meta_data.cpython-311.pyc new file mode 100644 index 0000000..4c5f9d5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_meta_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc new file mode 100644 index 0000000..5005a41 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..d987689 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node.cpython-311.pyc new file mode 100644 index 0000000..10e0b17 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node_debug_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..e6e4912 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node_debug_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node_id.cpython-311.pyc new file mode 100644 index 0000000..641a82b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/rule_node_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/save_device_with_credentials_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/save_device_with_credentials_request.cpython-311.pyc new file mode 100644 index 0000000..1270894 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/save_device_with_credentials_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/save_ota_package_info_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/save_ota_package_info_request.cpython-311.pyc new file mode 100644 index 0000000..c911b0a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/save_ota_package_info_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event.cpython-311.pyc new file mode 100644 index 0000000..d21c1ed Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_filter.cpython-311.pyc new file mode 100644 index 0000000..d44a420 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_id.cpython-311.pyc new file mode 100644 index 0000000..e7a57e8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_info.cpython-311.pyc new file mode 100644 index 0000000..f699dd0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_with_customer_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_with_customer_info.cpython-311.pyc new file mode 100644 index 0000000..414468b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_with_customer_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/security_settings.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/security_settings.cpython-311.pyc new file mode 100644 index 0000000..362e1ae Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/security_settings.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/self_registration_params.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/self_registration_params.cpython-311.pyc new file mode 100644 index 0000000..e3bdf39 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/self_registration_params.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/server_security_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/server_security_config.cpython-311.pyc new file mode 100644 index 0000000..62f2ce7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/server_security_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/share_group_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/share_group_request.cpython-311.pyc new file mode 100644 index 0000000..56cd6bb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/share_group_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..33b5a73 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/short_customer_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/short_customer_info.cpython-311.pyc new file mode 100644 index 0000000..5b74d6f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/short_customer_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/short_entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/short_entity_view.cpython-311.pyc new file mode 100644 index 0000000..c0e7248 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/short_entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sign_up_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sign_up_request.cpython-311.pyc new file mode 100644 index 0000000..04a68a2 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sign_up_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sign_up_self_registration_params.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sign_up_self_registration_params.cpython-311.pyc new file mode 100644 index 0000000..1892331 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sign_up_self_registration_params.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/simple_alarm_condition_spec.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/simple_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..70d3843 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/simple_alarm_condition_spec.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_filter.cpython-311.pyc new file mode 100644 index 0000000..67afa35 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..07440f7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_load_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..9732daf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_load_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_conversation.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_conversation.cpython-311.pyc new file mode 100644 index 0000000..23a30e5 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_conversation.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..10a4f61 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..eab7163 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_target_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..6d8303d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_target_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..c0527d9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..47bb19f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..d926682 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..2a65402 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..44769e8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..04abd96 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..8d9c51e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_transport_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..4482b19 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_transport_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_mapping.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_mapping.cpython-311.pyc new file mode 100644 index 0000000..621ea02 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/snmp_mapping.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/solution_install_response.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/solution_install_response.cpython-311.pyc new file mode 100644 index 0000000..660a74f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/solution_install_response.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/specific_time_schedule.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/specific_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..66e383c Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/specific_time_schedule.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/starred_dashboard_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/starred_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..d5a4083 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/starred_dashboard_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/state_entity_owner_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/state_entity_owner_filter.cpython-311.pyc new file mode 100644 index 0000000..d8419bf Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/state_entity_owner_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/statistics_event_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/statistics_event_filter.cpython-311.pyc new file mode 100644 index 0000000..5cece82 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/statistics_event_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/string_filter_predicate.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/string_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..8569c68 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/string_filter_predicate.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/submit_strategy.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/submit_strategy.cpython-311.pyc new file mode 100644 index 0000000..52ac2f0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/submit_strategy.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/subscription_usage.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/subscription_usage.cpython-311.pyc new file mode 100644 index 0000000..6e20e3e Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/subscription_usage.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_administrators_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..cf6a58b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_administrators_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_info.cpython-311.pyc new file mode 100644 index 0000000..98fae23 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_info_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_info_data.cpython-311.pyc new file mode 100644 index 0000000..c6d9c67 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/system_info_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource.cpython-311.pyc new file mode 100644 index 0000000..28f26ab Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_id.cpython-311.pyc new file mode 100644 index 0000000..2f80768 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..ec9c54d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_entity_view.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_entity_view.cpython-311.pyc new file mode 100644 index 0000000..d9e2e86 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_entity_view.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_mapping_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_mapping_configuration.cpython-311.pyc new file mode 100644 index 0000000..88e1f48 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_mapping_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..da6711a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_administrators_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..05b9c81 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_administrators_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_id.cpython-311.pyc new file mode 100644 index 0000000..db77ed4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..54044fc Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_data.cpython-311.pyc new file mode 100644 index 0000000..73ea93b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_id.cpython-311.pyc new file mode 100644 index 0000000..91a31c4 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc new file mode 100644 index 0000000..126c277 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_details.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_details.cpython-311.pyc new file mode 100644 index 0000000..7ffab29 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_details.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_info.cpython-311.pyc new file mode 100644 index 0000000..a801eb8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_instructions.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_instructions.cpython-311.pyc new file mode 100644 index 0000000..9a94321 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_instructions.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/test_sms_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/test_sms_request.cpython-311.pyc new file mode 100644 index 0000000..64ba5b3 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/test_sms_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc new file mode 100644 index 0000000..3680742 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_error_response.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_error_response.cpython-311.pyc new file mode 100644 index 0000000..e095029 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_error_response.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..b207487 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..7985c20 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..14449fb Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/transport_payload_type_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/transport_payload_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..67ef365 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/transport_payload_type_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ts_value.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ts_value.cpython-311.pyc new file mode 100644 index 0000000..c48f40d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/ts_value.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..fd13d64 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..9856d82 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config_update_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config_update_request.cpython-311.pyc new file mode 100644 index 0000000..9a8f229 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config_update_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..0e6e6b8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_info.cpython-311.pyc new file mode 100644 index 0000000..525b127 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/update_message.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/update_message.cpython-311.pyc new file mode 100644 index 0000000..2f38ed8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/update_message.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user.cpython-311.pyc new file mode 100644 index 0000000..50bbbf7 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_dashboards_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_dashboards_info.cpython-311.pyc new file mode 100644 index 0000000..c1fc911 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_dashboards_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_email_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_email_info.cpython-311.pyc new file mode 100644 index 0000000..eff8b1f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_email_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_group_list_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_group_list_filter.cpython-311.pyc new file mode 100644 index 0000000..e2af867 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_group_list_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_id.cpython-311.pyc new file mode 100644 index 0000000..6a6cdc1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_info.cpython-311.pyc new file mode 100644 index 0000000..85d0cff Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_list_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_list_filter.cpython-311.pyc new file mode 100644 index 0000000..3ee3c5f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_list_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_password_policy.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_password_policy.cpython-311.pyc new file mode 100644 index 0000000..9007bf8 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_password_policy.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_role_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_role_filter.cpython-311.pyc new file mode 100644 index 0000000..683866b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/user_role_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/users_filter.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/users_filter.cpython-311.pyc new file mode 100644 index 0000000..e224107 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/users_filter.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_create_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_create_config.cpython-311.pyc new file mode 100644 index 0000000..8743e0b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_create_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_create_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_create_request.cpython-311.pyc new file mode 100644 index 0000000..bfe3bf1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_create_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_creation_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_creation_result.cpython-311.pyc new file mode 100644 index 0000000..edc749d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_creation_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_config.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_config.cpython-311.pyc new file mode 100644 index 0000000..313807d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_config.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_request.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_request.cpython-311.pyc new file mode 100644 index 0000000..dcbb16a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_request.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_result.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_result.cpython-311.pyc new file mode 100644 index 0000000..89d2ed0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/version_load_result.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/versioned_entity_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..4fd3b15 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/versioned_entity_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/web_delivery_method_notification_template.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/web_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..63986c0 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/web_delivery_method_notification_template.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/white_labeling_params.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/white_labeling_params.cpython-311.pyc new file mode 100644 index 0000000..18ec06a Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/white_labeling_params.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widget_type_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widget_type_id.cpython-311.pyc new file mode 100644 index 0000000..c7caeff Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widget_type_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widget_type_info.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widget_type_info.cpython-311.pyc new file mode 100644 index 0000000..44fff7d Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widget_type_info.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_export_data.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_export_data.cpython-311.pyc new file mode 100644 index 0000000..121e92f Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_export_data.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_id.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_id.cpython-311.pyc new file mode 100644 index 0000000..030b88b Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_id.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..6daf0d1 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..5d303f9 Binary files /dev/null and b/billinglayer/python/tb_rest_client/models/models_pe/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/billinglayer/python/tb_rest_client/models/models_pe/account_two_fa_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/account_two_fa_settings.py new file mode 100644 index 0000000..62a6ab9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/account_two_fa_settings.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AccountTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configs': 'dict(str, TwoFaAccountConfig)' + } + + attribute_map = { + 'configs': 'configs' + } + + def __init__(self, configs=None): # noqa: E501 + """AccountTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._configs = None + self.discriminator = None + if configs is not None: + self.configs = configs + + @property + def configs(self): + """Gets the configs of this AccountTwoFaSettings. # noqa: E501 + + + :return: The configs of this AccountTwoFaSettings. # noqa: E501 + :rtype: dict(str, TwoFaAccountConfig) + """ + return self._configs + + @configs.setter + def configs(self, configs): + """Sets the configs of this AccountTwoFaSettings. + + + :param configs: The configs of this AccountTwoFaSettings. # noqa: E501 + :type: dict(str, TwoFaAccountConfig) + """ + + self._configs = configs + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AccountTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AccountTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/activate_user_request.py b/billinglayer/python/tb_rest_client/models/models_pe/activate_user_request.py new file mode 100644 index 0000000..88d3384 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/activate_user_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ActivateUserRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'activate_token': 'activateToken', + 'password': 'password' + } + + def __init__(self, activate_token=None, password=None): # noqa: E501 + """ActivateUserRequest - a model defined in Swagger""" # noqa: E501 + self._activate_token = None + self._password = None + self.discriminator = None + if activate_token is not None: + self.activate_token = activate_token + if password is not None: + self.password = password + + @property + def activate_token(self): + """Gets the activate_token of this ActivateUserRequest. # noqa: E501 + + The activate token to verify # noqa: E501 + + :return: The activate_token of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._activate_token + + @activate_token.setter + def activate_token(self, activate_token): + """Sets the activate_token of this ActivateUserRequest. + + The activate token to verify # noqa: E501 + + :param activate_token: The activate_token of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._activate_token = activate_token + + @property + def password(self): + """Gets the password of this ActivateUserRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ActivateUserRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ActivateUserRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ActivateUserRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/admin_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/admin_settings.py new file mode 100644 index 0000000..0b86036 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/admin_settings.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AdminSettingsId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'key': 'str', + 'json_value': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'key': 'key', + 'json_value': 'jsonValue' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, key=None, json_value=None): # noqa: E501 + """AdminSettings - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._key = None + self._json_value = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if key is not None: + self.key = key + if json_value is not None: + self.json_value = json_value + + @property + def id(self): + """Gets the id of this AdminSettings. # noqa: E501 + + + :return: The id of this AdminSettings. # noqa: E501 + :rtype: AdminSettingsId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettings. + + + :param id: The id of this AdminSettings. # noqa: E501 + :type: AdminSettingsId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AdminSettings. # noqa: E501 + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :return: The created_time of this AdminSettings. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AdminSettings. + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AdminSettings. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AdminSettings. # noqa: E501 + + + :return: The tenant_id of this AdminSettings. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AdminSettings. + + + :param tenant_id: The tenant_id of this AdminSettings. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def key(self): + """Gets the key of this AdminSettings. # noqa: E501 + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :return: The key of this AdminSettings. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AdminSettings. + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :param key: The key of this AdminSettings. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def json_value(self): + """Gets the json_value of this AdminSettings. # noqa: E501 + + + :return: The json_value of this AdminSettings. # noqa: E501 + :rtype: JsonNode + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AdminSettings. + + + :param json_value: The json_value of this AdminSettings. # noqa: E501 + :type: JsonNode + """ + + self._json_value = json_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/admin_settings_id.py b/billinglayer/python/tb_rest_client/models/models_pe/admin_settings_id.py new file mode 100644 index 0000000..f6fbbfc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/admin_settings_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettingsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AdminSettingsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AdminSettingsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AdminSettingsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettingsId. + + string # noqa: E501 + + :param id: The id of this AdminSettingsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettingsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettingsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/affected_tenant_administrators_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/affected_tenant_administrators_filter.py new file mode 100644 index 0000000..542d49f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/affected_tenant_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedTenantAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedTenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedTenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedTenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/affected_user_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/affected_user_filter.py new file mode 100644 index 0000000..313b949 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/affected_user_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedUserFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedUserFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedUserFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedUserFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm.py new file mode 100644 index 0000000..47cb306 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm.py @@ -0,0 +1,749 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Alarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'propagate_to_owner': 'bool', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate': 'propagate', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'propagate_to_owner': 'propagateToOwner', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate_to_owner_hierarchy=None, propagate=None, propagate_to_tenant=None, propagate_relation_types=None, propagate_to_owner=None, status=None): # noqa: E501 + """Alarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate_to_owner_hierarchy = None + self._propagate = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._propagate_to_owner = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate is not None: + self.propagate = propagate + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + self.status = status + + @property + def id(self): + """Gets the id of this Alarm. # noqa: E501 + + + :return: The id of this Alarm. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Alarm. + + + :param id: The id of this Alarm. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Alarm. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this Alarm. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Alarm. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Alarm. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Alarm. # noqa: E501 + + + :return: The tenant_id of this Alarm. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Alarm. + + + :param tenant_id: The tenant_id of this Alarm. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Alarm. # noqa: E501 + + + :return: The customer_id of this Alarm. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Alarm. + + + :param customer_id: The customer_id of this Alarm. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this Alarm. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this Alarm. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this Alarm. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this Alarm. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this Alarm. # noqa: E501 + + + :return: The originator of this Alarm. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this Alarm. + + + :param originator: The originator of this Alarm. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this Alarm. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this Alarm. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this Alarm. + + Alarm severity # noqa: E501 + + :param severity: The severity of this Alarm. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this Alarm. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this Alarm. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this Alarm. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this Alarm. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this Alarm. + + Cleared # noqa: E501 + + :param cleared: The cleared of this Alarm. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this Alarm. # noqa: E501 + + + :return: The assignee_id of this Alarm. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this Alarm. + + + :param assignee_id: The assignee_id of this Alarm. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this Alarm. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this Alarm. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this Alarm. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this Alarm. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this Alarm. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this Alarm. # noqa: E501 + + + :return: The details of this Alarm. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this Alarm. + + + :param details: The details of this Alarm. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this Alarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate(self): + """Gets the propagate of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this Alarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this Alarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this Alarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this Alarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this Alarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this Alarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this Alarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def status(self): + """Gets the status of this Alarm. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this Alarm. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Alarm. + + status of the Alarm # noqa: E501 + + :param status: The status of this Alarm. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Alarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Alarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_assignee.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_assignee.py new file mode 100644 index 0000000..aa9fc23 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_assignee.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignee(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'first_name': 'str', + 'id': 'UserId', + 'last_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'first_name': 'firstName', + 'id': 'id', + 'last_name': 'lastName' + } + + def __init__(self, email=None, first_name=None, id=None, last_name=None): # noqa: E501 + """AlarmAssignee - a model defined in Swagger""" # noqa: E501 + self._email = None + self._first_name = None + self._id = None + self._last_name = None + self.discriminator = None + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if id is not None: + self.id = id + if last_name is not None: + self.last_name = last_name + + @property + def email(self): + """Gets the email of this AlarmAssignee. # noqa: E501 + + + :return: The email of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmAssignee. + + + :param email: The email of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmAssignee. # noqa: E501 + + + :return: The first_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmAssignee. + + + :param first_name: The first_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def id(self): + """Gets the id of this AlarmAssignee. # noqa: E501 + + + :return: The id of this AlarmAssignee. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmAssignee. + + + :param id: The id of this AlarmAssignee. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def last_name(self): + """Gets the last_name of this AlarmAssignee. # noqa: E501 + + + :return: The last_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmAssignee. + + + :param last_name: The last_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignee, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignee): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_assignment_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_assignment_notification_rule_trigger_config.py new file mode 100644 index 0000000..06982a4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_assignment_notification_rule_trigger_config.py @@ -0,0 +1,255 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignmentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on=None, trigger_type=None): # noqa: E501 + """AlarmAssignmentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on(self): + """Gets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ASSIGNED", "UNASSIGNED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignmentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignmentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment.py new file mode 100644 index 0000000..060ecce --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment.py @@ -0,0 +1,293 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmComment(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None): # noqa: E501 + """AlarmComment - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + + @property + def id(self): + """Gets the id of this AlarmComment. # noqa: E501 + + + :return: The id of this AlarmComment. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmComment. + + + :param id: The id of this AlarmComment. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmComment. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmComment. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmComment. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmComment. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmComment. # noqa: E501 + + + :return: The alarm_id of this AlarmComment. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmComment. + + + :param alarm_id: The alarm_id of this AlarmComment. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmComment. # noqa: E501 + + + :return: The user_id of this AlarmComment. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmComment. + + + :param user_id: The user_id of this AlarmComment. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmComment. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmComment. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmComment. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmComment. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmComment. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmComment. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmComment. # noqa: E501 + + + :return: The comment of this AlarmComment. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmComment. + + + :param comment: The comment of this AlarmComment. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmComment, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmComment): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_id.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_id.py new file mode 100644 index 0000000..134ac70 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AlarmCommentId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AlarmCommentId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AlarmCommentId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentId. + + string # noqa: E501 + + :param id: The id of this AlarmCommentId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_info.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_info.py new file mode 100644 index 0000000..fd59618 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_info.py @@ -0,0 +1,377 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None, email=None, first_name=None, last_name=None): # noqa: E501 + """AlarmCommentInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this AlarmCommentInfo. # noqa: E501 + + + :return: The id of this AlarmCommentInfo. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentInfo. + + + :param id: The id of this AlarmCommentInfo. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmCommentInfo. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmCommentInfo. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmCommentInfo. + + + :param alarm_id: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The user_id of this AlarmCommentInfo. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmCommentInfo. + + + :param user_id: The user_id of this AlarmCommentInfo. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmCommentInfo. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmCommentInfo. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmCommentInfo. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmCommentInfo. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmCommentInfo. # noqa: E501 + + + :return: The comment of this AlarmCommentInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmCommentInfo. + + + :param comment: The comment of this AlarmCommentInfo. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + @property + def email(self): + """Gets the email of this AlarmCommentInfo. # noqa: E501 + + User email address # noqa: E501 + + :return: The email of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmCommentInfo. + + User email address # noqa: E501 + + :param email: The email of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmCommentInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmCommentInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this AlarmCommentInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmCommentInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_notification_rule_trigger_config.py new file mode 100644 index 0000000..a53c06c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_comment_notification_rule_trigger_config.py @@ -0,0 +1,274 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on_comment_update': 'bool', + 'only_user_comments': 'bool', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on_comment_update': 'notifyOnCommentUpdate', + 'only_user_comments': 'onlyUserComments', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on_comment_update=None, only_user_comments=None, trigger_type=None): # noqa: E501 + """AlarmCommentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on_comment_update = None + self._only_user_comments = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on_comment_update is not None: + self.notify_on_comment_update = notify_on_comment_update + if only_user_comments is not None: + self.only_user_comments = only_user_comments + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on_comment_update(self): + """Gets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._notify_on_comment_update + + @notify_on_comment_update.setter + def notify_on_comment_update(self, notify_on_comment_update): + """Sets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. + + + :param notify_on_comment_update: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._notify_on_comment_update = notify_on_comment_update + + @property + def only_user_comments(self): + """Gets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_user_comments + + @only_user_comments.setter + def only_user_comments(self, only_user_comments): + """Sets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. + + + :param only_user_comments: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_user_comments = only_user_comments + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition.py new file mode 100644 index 0000000..9d7268b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCondition(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'list[AlarmConditionFilter]', + 'spec': 'AlarmConditionSpec' + } + + attribute_map = { + 'condition': 'condition', + 'spec': 'spec' + } + + def __init__(self, condition=None, spec=None): # noqa: E501 + """AlarmCondition - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._spec = None + self.discriminator = None + if condition is not None: + self.condition = condition + if spec is not None: + self.spec = spec + + @property + def condition(self): + """Gets the condition of this AlarmCondition. # noqa: E501 + + JSON array of alarm condition filters # noqa: E501 + + :return: The condition of this AlarmCondition. # noqa: E501 + :rtype: list[AlarmConditionFilter] + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmCondition. + + JSON array of alarm condition filters # noqa: E501 + + :param condition: The condition of this AlarmCondition. # noqa: E501 + :type: list[AlarmConditionFilter] + """ + + self._condition = condition + + @property + def spec(self): + """Gets the spec of this AlarmCondition. # noqa: E501 + + + :return: The spec of this AlarmCondition. # noqa: E501 + :rtype: AlarmConditionSpec + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this AlarmCondition. + + + :param spec: The spec of this AlarmCondition. # noqa: E501 + :type: AlarmConditionSpec + """ + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCondition, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCondition): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_filter.py new file mode 100644 index 0000000..4193db8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_filter.py @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'AlarmConditionFilterKey', + 'value_type': 'str', + 'value': 'object', + 'predicate': 'KeyFilterPredicate' + } + + attribute_map = { + 'key': 'key', + 'value_type': 'valueType', + 'value': 'value', + 'predicate': 'predicate' + } + + def __init__(self, key=None, value_type=None, value=None, predicate=None): # noqa: E501 + """AlarmConditionFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._value_type = None + self._value = None + self._predicate = None + self.discriminator = None + if key is not None: + self.key = key + if value_type is not None: + self.value_type = value_type + if value is not None: + self.value = value + if predicate is not None: + self.predicate = predicate + + @property + def key(self): + """Gets the key of this AlarmConditionFilter. # noqa: E501 + + + :return: The key of this AlarmConditionFilter. # noqa: E501 + :rtype: AlarmConditionFilterKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilter. + + + :param key: The key of this AlarmConditionFilter. # noqa: E501 + :type: AlarmConditionFilterKey + """ + + self._key = key + + @property + def value_type(self): + """Gets the value_type of this AlarmConditionFilter. # noqa: E501 + + String representation of the type of the value # noqa: E501 + + :return: The value_type of this AlarmConditionFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this AlarmConditionFilter. + + String representation of the type of the value # noqa: E501 + + :param value_type: The value_type of this AlarmConditionFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + @property + def value(self): + """Gets the value of this AlarmConditionFilter. # noqa: E501 + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :return: The value of this AlarmConditionFilter. # noqa: E501 + :rtype: object + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this AlarmConditionFilter. + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :param value: The value of this AlarmConditionFilter. # noqa: E501 + :type: object + """ + + self._value = value + + @property + def predicate(self): + """Gets the predicate of this AlarmConditionFilter. # noqa: E501 + + + :return: The predicate of this AlarmConditionFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this AlarmConditionFilter. + + + :param predicate: The predicate of this AlarmConditionFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_filter_key.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_filter_key.py new file mode 100644 index 0000000..c6aa286 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_filter_key.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilterKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'key': 'str' + } + + attribute_map = { + 'type': 'type', + 'key': 'key' + } + + def __init__(self, type=None, key=None): # noqa: E501 + """AlarmConditionFilterKey - a model defined in Swagger""" # noqa: E501 + self._type = None + self._key = None + self.discriminator = None + if type is not None: + self.type = type + if key is not None: + self.key = key + + @property + def type(self): + """Gets the type of this AlarmConditionFilterKey. # noqa: E501 + + The key type # noqa: E501 + + :return: The type of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmConditionFilterKey. + + The key type # noqa: E501 + + :param type: The type of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + allowed_values = ["ATTRIBUTE", "CONSTANT", "ENTITY_FIELD", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def key(self): + """Gets the key of this AlarmConditionFilterKey. # noqa: E501 + + String value representing the key # noqa: E501 + + :return: The key of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilterKey. + + String value representing the key # noqa: E501 + + :param key: The key of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilterKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilterKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_spec.py new file mode 100644 index 0000000..7bf4694 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_condition_spec.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionSpec(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_count_query.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_count_query.py new file mode 100644 index 0000000..94e88ef --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_count_query.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'end_ts': 'int', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'end_ts': 'endTs', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, end_ts=None, entity_filter=None, key_filters=None, search_propagated_alarms=None, severity_list=None, start_ts=None, status_list=None, time_window=None, type_list=None): # noqa: E501 + """AlarmCountQuery - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._end_ts = None + self._entity_filter = None + self._key_filters = None + self._search_propagated_alarms = None + self._severity_list = None + self._start_ts = None + self._status_list = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if end_ts is not None: + self.end_ts = end_ts + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmCountQuery. # noqa: E501 + + + :return: The assignee_id of this AlarmCountQuery. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmCountQuery. + + + :param assignee_id: The assignee_id of this AlarmCountQuery. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def end_ts(self): + """Gets the end_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The end_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmCountQuery. + + + :param end_ts: The end_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmCountQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmCountQuery. + + + :param entity_filter: The entity_filter of this AlarmCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmCountQuery. # noqa: E501 + + + :return: The key_filters of this AlarmCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmCountQuery. + + + :param key_filters: The key_filters of this AlarmCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmCountQuery. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmCountQuery. # noqa: E501 + + + :return: The severity_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmCountQuery. + + + :param severity_list: The severity_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def start_ts(self): + """Gets the start_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The start_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmCountQuery. + + + :param start_ts: The start_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmCountQuery. # noqa: E501 + + + :return: The status_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmCountQuery. + + + :param status_list: The status_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def time_window(self): + """Gets the time_window of this AlarmCountQuery. # noqa: E501 + + + :return: The time_window of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmCountQuery. + + + :param time_window: The time_window of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmCountQuery. # noqa: E501 + + + :return: The type_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmCountQuery. + + + :param type_list: The type_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_data.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_data.py new file mode 100644 index 0000000..b7a3173 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_data.py @@ -0,0 +1,883 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'propagate_to_owner': 'bool', + 'originator_name': 'str', + 'originator_label': 'str', + 'assignee': 'AlarmAssignee', + 'status': 'str' + } + + attribute_map = { + 'entity_id': 'entityId', + 'latest': 'latest', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate': 'propagate', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'propagate_to_owner': 'propagateToOwner', + 'originator_name': 'originatorName', + 'originator_label': 'originatorLabel', + 'assignee': 'assignee', + 'status': 'status' + } + + def __init__(self, entity_id=None, latest=None, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate_to_owner_hierarchy=None, propagate=None, propagate_to_tenant=None, propagate_relation_types=None, propagate_to_owner=None, originator_name=None, originator_label=None, assignee=None, status=None): # noqa: E501 + """AlarmData - a model defined in Swagger""" # noqa: E501 + self._entity_id = None + self._latest = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate_to_owner_hierarchy = None + self._propagate = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._propagate_to_owner = None + self._originator_name = None + self._originator_label = None + self._assignee = None + self._status = None + self.discriminator = None + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate is not None: + self.propagate = propagate + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_name is not None: + self.originator_name = originator_name + if originator_label is not None: + self.originator_label = originator_label + if assignee is not None: + self.assignee = assignee + self.status = status + + @property + def entity_id(self): + """Gets the entity_id of this AlarmData. # noqa: E501 + + + :return: The entity_id of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AlarmData. + + + :param entity_id: The entity_id of this AlarmData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this AlarmData. # noqa: E501 + + + :return: The latest of this AlarmData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this AlarmData. + + + :param latest: The latest of this AlarmData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def id(self): + """Gets the id of this AlarmData. # noqa: E501 + + + :return: The id of this AlarmData. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmData. + + + :param id: The id of this AlarmData. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmData. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmData. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmData. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmData. # noqa: E501 + + + :return: The tenant_id of this AlarmData. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmData. + + + :param tenant_id: The tenant_id of this AlarmData. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmData. # noqa: E501 + + + :return: The customer_id of this AlarmData. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmData. + + + :param customer_id: The customer_id of this AlarmData. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmData. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmData. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmData. # noqa: E501 + + + :return: The originator of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmData. + + + :param originator: The originator of this AlarmData. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmData. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmData. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmData. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmData. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmData. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmData. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmData. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmData. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmData. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmData. # noqa: E501 + + + :return: The assignee_id of this AlarmData. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmData. + + + :param assignee_id: The assignee_id of this AlarmData. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmData. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmData. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmData. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmData. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmData. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmData. # noqa: E501 + + + :return: The details of this AlarmData. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmData. + + + :param details: The details of this AlarmData. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate(self): + """Gets the propagate of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmData. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmData. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmData. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmData. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmData. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_name(self): + """Gets the originator_name of this AlarmData. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmData. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def originator_label(self): + """Gets the originator_label of this AlarmData. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmData. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def assignee(self): + """Gets the assignee of this AlarmData. # noqa: E501 + + + :return: The assignee of this AlarmData. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmData. + + + :param assignee: The assignee of this AlarmData. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def status(self): + """Gets the status of this AlarmData. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmData. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmData. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_data_page_link.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_data_page_link.py new file mode 100644 index 0000000..a43e70d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_data_page_link.py @@ -0,0 +1,450 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'dynamic': 'bool', + 'end_ts': 'int', + 'page': 'int', + 'page_size': 'int', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'sort_order': 'EntityDataSortOrder', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'text_search': 'str', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'dynamic': 'dynamic', + 'end_ts': 'endTs', + 'page': 'page', + 'page_size': 'pageSize', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'sort_order': 'sortOrder', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'text_search': 'textSearch', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, dynamic=None, end_ts=None, page=None, page_size=None, search_propagated_alarms=None, severity_list=None, sort_order=None, start_ts=None, status_list=None, text_search=None, time_window=None, type_list=None): # noqa: E501 + """AlarmDataPageLink - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._dynamic = None + self._end_ts = None + self._page = None + self._page_size = None + self._search_propagated_alarms = None + self._severity_list = None + self._sort_order = None + self._start_ts = None + self._status_list = None + self._text_search = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if dynamic is not None: + self.dynamic = dynamic + if end_ts is not None: + self.end_ts = end_ts + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if sort_order is not None: + self.sort_order = sort_order + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if text_search is not None: + self.text_search = text_search + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmDataPageLink. # noqa: E501 + + + :return: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmDataPageLink. + + + :param assignee_id: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def dynamic(self): + """Gets the dynamic of this AlarmDataPageLink. # noqa: E501 + + + :return: The dynamic of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this AlarmDataPageLink. + + + :param dynamic: The dynamic of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def end_ts(self): + """Gets the end_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The end_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmDataPageLink. + + + :param end_ts: The end_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def page(self): + """Gets the page of this AlarmDataPageLink. # noqa: E501 + + + :return: The page of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this AlarmDataPageLink. + + + :param page: The page of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this AlarmDataPageLink. # noqa: E501 + + + :return: The page_size of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this AlarmDataPageLink. + + + :param page_size: The page_size of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmDataPageLink. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The severity_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmDataPageLink. + + + :param severity_list: The severity_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def sort_order(self): + """Gets the sort_order of this AlarmDataPageLink. # noqa: E501 + + + :return: The sort_order of this AlarmDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this AlarmDataPageLink. + + + :param sort_order: The sort_order of this AlarmDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def start_ts(self): + """Gets the start_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The start_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmDataPageLink. + + + :param start_ts: The start_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The status_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmDataPageLink. + + + :param status_list: The status_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def text_search(self): + """Gets the text_search of this AlarmDataPageLink. # noqa: E501 + + + :return: The text_search of this AlarmDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this AlarmDataPageLink. + + + :param text_search: The text_search of this AlarmDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + @property + def time_window(self): + """Gets the time_window of this AlarmDataPageLink. # noqa: E501 + + + :return: The time_window of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmDataPageLink. + + + :param time_window: The time_window of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The type_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmDataPageLink. + + + :param type_list: The type_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_data_query.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_data_query.py new file mode 100644 index 0000000..dcbb9ea --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_data_query.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_fields': 'list[EntityKey]', + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'AlarmDataPageLink' + } + + attribute_map = { + 'alarm_fields': 'alarmFields', + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, alarm_fields=None, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """AlarmDataQuery - a model defined in Swagger""" # noqa: E501 + self._alarm_fields = None + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if alarm_fields is not None: + self.alarm_fields = alarm_fields + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def alarm_fields(self): + """Gets the alarm_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._alarm_fields + + @alarm_fields.setter + def alarm_fields(self, alarm_fields): + """Sets the alarm_fields of this AlarmDataQuery. + + + :param alarm_fields: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._alarm_fields = alarm_fields + + @property + def entity_fields(self): + """Gets the entity_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this AlarmDataQuery. + + + :param entity_fields: The entity_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmDataQuery. + + + :param entity_filter: The entity_filter of this AlarmDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmDataQuery. # noqa: E501 + + + :return: The key_filters of this AlarmDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmDataQuery. + + + :param key_filters: The key_filters of this AlarmDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this AlarmDataQuery. # noqa: E501 + + + :return: The latest_values of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this AlarmDataQuery. + + + :param latest_values: The latest_values of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this AlarmDataQuery. # noqa: E501 + + + :return: The page_link of this AlarmDataQuery. # noqa: E501 + :rtype: AlarmDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this AlarmDataQuery. + + + :param page_link: The page_link of this AlarmDataQuery. # noqa: E501 + :type: AlarmDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_id.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_id.py new file mode 100644 index 0000000..1c22b08 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AlarmId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AlarmId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AlarmId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AlarmId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AlarmId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AlarmId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_info.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_info.py new file mode 100644 index 0000000..dc17bd1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_info.py @@ -0,0 +1,831 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'propagate_to_owner': 'bool', + 'originator_name': 'str', + 'originator_label': 'str', + 'assignee': 'AlarmAssignee', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate': 'propagate', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'propagate_to_owner': 'propagateToOwner', + 'originator_name': 'originatorName', + 'originator_label': 'originatorLabel', + 'assignee': 'assignee', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate_to_owner_hierarchy=None, propagate=None, propagate_to_tenant=None, propagate_relation_types=None, propagate_to_owner=None, originator_name=None, originator_label=None, assignee=None, status=None): # noqa: E501 + """AlarmInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate_to_owner_hierarchy = None + self._propagate = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._propagate_to_owner = None + self._originator_name = None + self._originator_label = None + self._assignee = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate is not None: + self.propagate = propagate + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_name is not None: + self.originator_name = originator_name + if originator_label is not None: + self.originator_label = originator_label + if assignee is not None: + self.assignee = assignee + self.status = status + + @property + def id(self): + """Gets the id of this AlarmInfo. # noqa: E501 + + + :return: The id of this AlarmInfo. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmInfo. + + + :param id: The id of this AlarmInfo. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmInfo. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmInfo. # noqa: E501 + + + :return: The tenant_id of this AlarmInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmInfo. + + + :param tenant_id: The tenant_id of this AlarmInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmInfo. # noqa: E501 + + + :return: The customer_id of this AlarmInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmInfo. + + + :param customer_id: The customer_id of this AlarmInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmInfo. # noqa: E501 + + + :return: The originator of this AlarmInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmInfo. + + + :param originator: The originator of this AlarmInfo. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmInfo. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmInfo. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmInfo. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmInfo. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmInfo. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmInfo. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmInfo. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmInfo. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmInfo. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmInfo. # noqa: E501 + + + :return: The assignee_id of this AlarmInfo. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmInfo. + + + :param assignee_id: The assignee_id of this AlarmInfo. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmInfo. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmInfo. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmInfo. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmInfo. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmInfo. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmInfo. # noqa: E501 + + + :return: The details of this AlarmInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmInfo. + + + :param details: The details of this AlarmInfo. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate(self): + """Gets the propagate of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmInfo. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmInfo. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_name(self): + """Gets the originator_name of this AlarmInfo. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmInfo. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def originator_label(self): + """Gets the originator_label of this AlarmInfo. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmInfo. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def assignee(self): + """Gets the assignee of this AlarmInfo. # noqa: E501 + + + :return: The assignee of this AlarmInfo. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmInfo. + + + :param assignee: The assignee of this AlarmInfo. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def status(self): + """Gets the status of this AlarmInfo. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmInfo. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmInfo. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_notification_rule_trigger_config.py new file mode 100644 index 0000000..59539a5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_notification_rule_trigger_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class AlarmNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_types': 'list[str]', + 'clear_rule': 'ClearRule', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_types': 'alarmTypes', + 'clear_rule': 'clearRule', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, alarm_severities=None, alarm_types=None, clear_rule=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """AlarmNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_types = None + self._clear_rule = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_types is not None: + self.alarm_types = alarm_types + if clear_rule is not None: + self.clear_rule = clear_rule + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def clear_rule(self): + """Gets the clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: ClearRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this AlarmNotificationRuleTriggerConfig. + + + :param clear_rule: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: ClearRule + """ + + self._clear_rule = clear_rule + + @property + def notify_on(self): + """Gets the notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACKNOWLEDGED", "CLEARED", "CREATED", "SEVERITY_CHANGED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_rule.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_rule.py new file mode 100644 index 0000000..1d691ff --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_rule.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'AlarmCondition', + 'schedule': 'AlarmSchedule', + 'alarm_details': 'str', + 'dashboard_id': 'DashboardId' + } + + attribute_map = { + 'condition': 'condition', + 'schedule': 'schedule', + 'alarm_details': 'alarmDetails', + 'dashboard_id': 'dashboardId' + } + + def __init__(self, condition=None, schedule=None, alarm_details=None, dashboard_id=None): # noqa: E501 + """AlarmRule - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._schedule = None + self._alarm_details = None + self._dashboard_id = None + self.discriminator = None + if condition is not None: + self.condition = condition + if schedule is not None: + self.schedule = schedule + if alarm_details is not None: + self.alarm_details = alarm_details + if dashboard_id is not None: + self.dashboard_id = dashboard_id + + @property + def condition(self): + """Gets the condition of this AlarmRule. # noqa: E501 + + + :return: The condition of this AlarmRule. # noqa: E501 + :rtype: AlarmCondition + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmRule. + + + :param condition: The condition of this AlarmRule. # noqa: E501 + :type: AlarmCondition + """ + + self._condition = condition + + @property + def schedule(self): + """Gets the schedule of this AlarmRule. # noqa: E501 + + + :return: The schedule of this AlarmRule. # noqa: E501 + :rtype: AlarmSchedule + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this AlarmRule. + + + :param schedule: The schedule of this AlarmRule. # noqa: E501 + :type: AlarmSchedule + """ + + self._schedule = schedule + + @property + def alarm_details(self): + """Gets the alarm_details of this AlarmRule. # noqa: E501 + + String value representing the additional details for an alarm rule # noqa: E501 + + :return: The alarm_details of this AlarmRule. # noqa: E501 + :rtype: str + """ + return self._alarm_details + + @alarm_details.setter + def alarm_details(self, alarm_details): + """Sets the alarm_details of this AlarmRule. + + String value representing the additional details for an alarm rule # noqa: E501 + + :param alarm_details: The alarm_details of this AlarmRule. # noqa: E501 + :type: str + """ + + self._alarm_details = alarm_details + + @property + def dashboard_id(self): + """Gets the dashboard_id of this AlarmRule. # noqa: E501 + + + :return: The dashboard_id of this AlarmRule. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this AlarmRule. + + + :param dashboard_id: The dashboard_id of this AlarmRule. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/alarm_schedule.py b/billinglayer/python/tb_rest_client/models/models_pe/alarm_schedule.py new file mode 100644 index 0000000..ab3b844 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/alarm_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AlarmSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AlarmSchedule. # noqa: E501 + + + :return: The dynamic_value of this AlarmSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AlarmSchedule. + + + :param dynamic_value: The dynamic_value of this AlarmSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AlarmSchedule. # noqa: E501 + + + :return: The type of this AlarmSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmSchedule. + + + :param type: The type of this AlarmSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/all_users_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/all_users_filter.py new file mode 100644 index 0000000..53023e6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/all_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AllUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/allow_create_new_devices_device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/allow_create_new_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..831cd5c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/allow_create_new_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllowCreateNewDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """AllowCreateNewDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllowCreateNewDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllowCreateNewDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/allowed_permissions_info.py b/billinglayer/python/tb_rest_client/models/models_pe/allowed_permissions_info.py new file mode 100644 index 0000000..d23046f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/allowed_permissions_info.py @@ -0,0 +1,318 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllowedPermissionsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'user_owner_id': 'EntityId', + 'user_permissions': 'MergedUserPermissions', + 'allowed_resources': 'list[str]', + 'operations_by_resource': 'dict(str, list[str])', + 'allowed_for_group_role_operations': 'list[str]', + 'allowed_for_group_owner_only_operations': 'list[str]', + 'allowed_for_group_owner_only_group_operations': 'list[str]' + } + + attribute_map = { + 'user_owner_id': 'userOwnerId', + 'user_permissions': 'userPermissions', + 'allowed_resources': 'allowedResources', + 'operations_by_resource': 'operationsByResource', + 'allowed_for_group_role_operations': 'allowedForGroupRoleOperations', + 'allowed_for_group_owner_only_operations': 'allowedForGroupOwnerOnlyOperations', + 'allowed_for_group_owner_only_group_operations': 'allowedForGroupOwnerOnlyGroupOperations' + } + + def __init__(self, user_owner_id=None, user_permissions=None, allowed_resources=None, operations_by_resource=None, allowed_for_group_role_operations=None, allowed_for_group_owner_only_operations=None, allowed_for_group_owner_only_group_operations=None): # noqa: E501 + """AllowedPermissionsInfo - a model defined in Swagger""" # noqa: E501 + self._user_owner_id = None + self._user_permissions = None + self._allowed_resources = None + self._operations_by_resource = None + self._allowed_for_group_role_operations = None + self._allowed_for_group_owner_only_operations = None + self._allowed_for_group_owner_only_group_operations = None + self.discriminator = None + if user_owner_id is not None: + self.user_owner_id = user_owner_id + if user_permissions is not None: + self.user_permissions = user_permissions + if allowed_resources is not None: + self.allowed_resources = allowed_resources + if operations_by_resource is not None: + self.operations_by_resource = operations_by_resource + if allowed_for_group_role_operations is not None: + self.allowed_for_group_role_operations = allowed_for_group_role_operations + if allowed_for_group_owner_only_operations is not None: + self.allowed_for_group_owner_only_operations = allowed_for_group_owner_only_operations + if allowed_for_group_owner_only_group_operations is not None: + self.allowed_for_group_owner_only_group_operations = allowed_for_group_owner_only_group_operations + + @property + def user_owner_id(self): + """Gets the user_owner_id of this AllowedPermissionsInfo. # noqa: E501 + + + :return: The user_owner_id of this AllowedPermissionsInfo. # noqa: E501 + :rtype: EntityId + """ + return self._user_owner_id + + @user_owner_id.setter + def user_owner_id(self, user_owner_id): + """Sets the user_owner_id of this AllowedPermissionsInfo. + + + :param user_owner_id: The user_owner_id of this AllowedPermissionsInfo. # noqa: E501 + :type: EntityId + """ + + self._user_owner_id = user_owner_id + + @property + def user_permissions(self): + """Gets the user_permissions of this AllowedPermissionsInfo. # noqa: E501 + + + :return: The user_permissions of this AllowedPermissionsInfo. # noqa: E501 + :rtype: MergedUserPermissions + """ + return self._user_permissions + + @user_permissions.setter + def user_permissions(self, user_permissions): + """Sets the user_permissions of this AllowedPermissionsInfo. + + + :param user_permissions: The user_permissions of this AllowedPermissionsInfo. # noqa: E501 + :type: MergedUserPermissions + """ + + self._user_permissions = user_permissions + + @property + def allowed_resources(self): + """Gets the allowed_resources of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of all possibly allowed resources. Static and depends only on the authority of the user # noqa: E501 + + :return: The allowed_resources of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_resources + + @allowed_resources.setter + def allowed_resources(self, allowed_resources): + """Sets the allowed_resources of this AllowedPermissionsInfo. + + Static set (vocabulary) of all possibly allowed resources. Static and depends only on the authority of the user # noqa: E501 + + :param allowed_resources: The allowed_resources of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["BILLING", "ADMIN_SETTINGS", "ALARM", "ALL", "API_USAGE_STATE", "ASSET", "ASSET_GROUP", "ASSET_PROFILE", "AUDIT_LOG", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "CUSTOMER_GROUP", "DASHBOARD", "DASHBOARD_GROUP", "DEVICE", "DEVICE_GROUP", "DEVICE_PROFILE", "EDGE", "EDGE_GROUP", "ENTITY_VIEW", "ENTITY_VIEW_GROUP", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "OAUTH2_CONFIGURATION_INFO", "OAUTH2_CONFIGURATION_TEMPLATE", "OTA_PACKAGE", "PROFILE", "QUEUE", "ROLE", "RULE_CHAIN", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "USER_GROUP", "VERSION_CONTROL", "WHITE_LABELING", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(allowed_resources).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_resources` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_resources) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_resources = allowed_resources + + @property + def operations_by_resource(self): + """Gets the operations_by_resource of this AllowedPermissionsInfo. # noqa: E501 + + Static map (vocabulary) of allowed operations by resource type # noqa: E501 + + :return: The operations_by_resource of this AllowedPermissionsInfo. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._operations_by_resource + + @operations_by_resource.setter + def operations_by_resource(self, operations_by_resource): + """Sets the operations_by_resource of this AllowedPermissionsInfo. + + Static map (vocabulary) of allowed operations by resource type # noqa: E501 + + :param operations_by_resource: The operations_by_resource of this AllowedPermissionsInfo. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._operations_by_resource = operations_by_resource + + @property + def allowed_for_group_role_operations(self): + """Gets the allowed_for_group_role_operations of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of allowed operations for group roles # noqa: E501 + + :return: The allowed_for_group_role_operations of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_for_group_role_operations + + @allowed_for_group_role_operations.setter + def allowed_for_group_role_operations(self, allowed_for_group_role_operations): + """Sets the allowed_for_group_role_operations of this AllowedPermissionsInfo. + + Static set (vocabulary) of allowed operations for group roles # noqa: E501 + + :param allowed_for_group_role_operations: The allowed_for_group_role_operations of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(allowed_for_group_role_operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_for_group_role_operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_for_group_role_operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_for_group_role_operations = allowed_for_group_role_operations + + @property + def allowed_for_group_owner_only_operations(self): + """Gets the allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of allowed operations for group owner # noqa: E501 + + :return: The allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_for_group_owner_only_operations + + @allowed_for_group_owner_only_operations.setter + def allowed_for_group_owner_only_operations(self, allowed_for_group_owner_only_operations): + """Sets the allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. + + Static set (vocabulary) of allowed operations for group owner # noqa: E501 + + :param allowed_for_group_owner_only_operations: The allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(allowed_for_group_owner_only_operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_for_group_owner_only_operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_for_group_owner_only_operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_for_group_owner_only_operations = allowed_for_group_owner_only_operations + + @property + def allowed_for_group_owner_only_group_operations(self): + """Gets the allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of allowed group operations for group owner # noqa: E501 + + :return: The allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_for_group_owner_only_group_operations + + @allowed_for_group_owner_only_group_operations.setter + def allowed_for_group_owner_only_group_operations(self, allowed_for_group_owner_only_group_operations): + """Sets the allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. + + Static set (vocabulary) of allowed group operations for group owner # noqa: E501 + + :param allowed_for_group_owner_only_group_operations: The allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(allowed_for_group_owner_only_group_operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_for_group_owner_only_group_operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_for_group_owner_only_group_operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_for_group_owner_only_group_operations = allowed_for_group_owner_only_group_operations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllowedPermissionsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllowedPermissionsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/any_time_schedule.py b/billinglayer/python/tb_rest_client/models/models_pe/any_time_schedule.py new file mode 100644 index 0000000..a765486 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/any_time_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AnyTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AnyTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AnyTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AnyTimeSchedule. + + + :param dynamic_value: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AnyTimeSchedule. # noqa: E501 + + + :return: The type of this AnyTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AnyTimeSchedule. + + + :param type: The type of this AnyTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AnyTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AnyTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/api_usage_limit_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/api_usage_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..63c8cc8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/api_usage_limit_notification_rule_trigger_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class ApiUsageLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'api_features': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'api_features': 'apiFeatures', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, api_features=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """ApiUsageLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._api_features = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if api_features is not None: + self.api_features = api_features + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def api_features(self): + """Gets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._api_features + + @api_features.setter + def api_features(self, api_features): + """Sets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param api_features: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "DB", "EMAIL", "JS", "RE", "SMS", "TRANSPORT"] # noqa: E501 + if not set(api_features).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `api_features` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(api_features) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._api_features = api_features + + @property + def notify_on(self): + """Gets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["DISABLED", "ENABLED", "WARNING"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/api_usage_state_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/api_usage_state_filter.py new file mode 100644 index 0000000..c581f2b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/api_usage_state_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class ApiUsageStateFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'CustomerId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'customer_id': 'customerId' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, customer_id=None, *args, **kwargs): # noqa: E501 + """ApiUsageStateFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + if customer_id is not None: + self.customer_id = customer_id + EntityFilter.__init__(self, *args, **kwargs) + + @property + def customer_id(self): + """Gets the customer_id of this ApiUsageStateFilter. # noqa: E501 + + + :return: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ApiUsageStateFilter. + + + :param customer_id: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageStateFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageStateFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/array_node.py b/billinglayer/python/tb_rest_client/models/models_pe/array_node.py new file mode 100644 index 0000000..62ae172 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/array_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ArrayNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """ArrayNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ArrayNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ArrayNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/asset.py b/billinglayer/python/tb_rest_client/models/models_pe/asset.py new file mode 100644 index 0000000..121588a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/asset.py @@ -0,0 +1,378 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Asset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, external_id=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None, owner_id=None): # noqa: E501 + """Asset - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self._owner_id = None + self._external_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.external_id = external_id + self.asset_profile_id = asset_profile_id + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this Asset. # noqa: E501 + + + :return: The id of this Asset. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Asset. + + + :param id: The id of this Asset. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Asset. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this Asset. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Asset. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Asset. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Asset. # noqa: E501 + + + :return: The tenant_id of this Asset. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Asset. + + + :param tenant_id: The tenant_id of this Asset. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Asset. # noqa: E501 + + + :return: The customer_id of this Asset. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Asset. + + + :param customer_id: The customer_id of this Asset. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Asset. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this Asset. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Asset. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this Asset. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Asset. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this Asset. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Asset. + + Asset type # noqa: E501 + + :param type: The type of this Asset. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def label(self): + """Gets the label of this Asset. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Asset. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Asset. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Asset. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this Asset. # noqa: E501 + + + :return: The asset_profile_id of this Asset. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this Asset. + + + :param asset_profile_id: The asset_profile_id of this Asset. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this Asset. # noqa: E501 + + + :return: The additional_info of this Asset. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Asset. + + + :param additional_info: The additional_info of this Asset. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this Asset. # noqa: E501 + + + :return: The owner_id of this Asset. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Asset. + + + :param owner_id: The owner_id of this Asset. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Asset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Asset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/asset_id.py b/billinglayer/python/tb_rest_client/models/models_pe/asset_id.py new file mode 100644 index 0000000..204014b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/asset_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/asset_info.py b/billinglayer/python/tb_rest_client/models/models_pe/asset_info.py new file mode 100644 index 0000000..89c5642 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/asset_info.py @@ -0,0 +1,424 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None, owner_id=None, owner_name=None, groups=None): # noqa: E501 + """AssetInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self._owner_id = None + self._owner_name = None + self._groups = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.asset_profile_id = asset_profile_id + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this AssetInfo. # noqa: E501 + + + :return: The id of this AssetInfo. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetInfo. + + + :param id: The id of this AssetInfo. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AssetInfo. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this AssetInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AssetInfo. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AssetInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetInfo. # noqa: E501 + + + :return: The tenant_id of this AssetInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetInfo. + + + :param tenant_id: The tenant_id of this AssetInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AssetInfo. # noqa: E501 + + + :return: The customer_id of this AssetInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AssetInfo. + + + :param customer_id: The customer_id of this AssetInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AssetInfo. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetInfo. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this AssetInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AssetInfo. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AssetInfo. + + Asset type # noqa: E501 + + :param type: The type of this AssetInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this AssetInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this AssetInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this AssetInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this AssetInfo. # noqa: E501 + + + :return: The asset_profile_id of this AssetInfo. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this AssetInfo. + + + :param asset_profile_id: The asset_profile_id of this AssetInfo. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this AssetInfo. # noqa: E501 + + + :return: The additional_info of this AssetInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this AssetInfo. + + + :param additional_info: The additional_info of this AssetInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this AssetInfo. # noqa: E501 + + + :return: The owner_id of this AssetInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this AssetInfo. + + + :param owner_id: The owner_id of this AssetInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def owner_name(self): + """Gets the owner_name of this AssetInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this AssetInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this AssetInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this AssetInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this AssetInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this AssetInfo. + + Groups # noqa: E501 + + :param groups: The groups of this AssetInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/asset_profile_id.py b/billinglayer/python/tb_rest_client/models/models_pe/asset_profile_id.py new file mode 100644 index 0000000..750fe18 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/asset_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/asset_search_query.py b/billinglayer/python/tb_rest_client/models/models_pe/asset_search_query.py new file mode 100644 index 0000000..14a115c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/asset_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'asset_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'asset_types': 'assetTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, asset_types=None, parameters=None): # noqa: E501 + """AssetSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._asset_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if asset_types is not None: + self.asset_types = asset_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQuery. # noqa: E501 + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this AssetSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQuery. + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this AssetSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQuery. # noqa: E501 + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :return: The asset_types of this AssetSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQuery. + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :param asset_types: The asset_types of this AssetSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def parameters(self): + """Gets the parameters of this AssetSearchQuery. # noqa: E501 + + + :return: The parameters of this AssetSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this AssetSearchQuery. + + + :param parameters: The parameters of this AssetSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/asset_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/asset_search_query_filter.py new file mode 100644 index 0000000..53e3b77 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/asset_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_types': 'assetTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """AssetSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._asset_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if asset_types is not None: + self.asset_types = asset_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQueryFilter. + + + :param asset_types: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def direction(self): + """Gets the direction of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The direction of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this AssetSearchQueryFilter. + + + :param direction: The direction of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this AssetSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this AssetSearchQueryFilter. + + + :param max_level: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQueryFilter. + + + :param relation_type: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this AssetSearchQueryFilter. + + + :param root_entity: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/asset_type_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/asset_type_filter.py new file mode 100644 index 0000000..57e764f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/asset_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_name_filter': 'str', + 'asset_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_name_filter': 'assetNameFilter', + 'asset_types': 'assetTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_name_filter=None, asset_types=None, *args, **kwargs): # noqa: E501 + """AssetTypeFilter - a model defined in Swagger""" # noqa: E501 + self._asset_name_filter = None + self._asset_types = None + self.discriminator = None + if asset_name_filter is not None: + self.asset_name_filter = asset_name_filter + if asset_types is not None: + self.asset_types = asset_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_name_filter(self): + """Gets the asset_name_filter of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :rtype: str + """ + return self._asset_name_filter + + @asset_name_filter.setter + def asset_name_filter(self, asset_name_filter): + """Sets the asset_name_filter of this AssetTypeFilter. + + + :param asset_name_filter: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :type: str + """ + + self._asset_name_filter = asset_name_filter + + @property + def asset_types(self): + """Gets the asset_types of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_types of this AssetTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetTypeFilter. + + + :param asset_types: The asset_types of this AssetTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/atomic_integer.py b/billinglayer/python/tb_rest_client/models/models_pe/atomic_integer.py new file mode 100644 index 0000000..4958429 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/atomic_integer.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AtomicInteger(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'acquire': 'int', + 'and_decrement': 'int', + 'and_increment': 'int', + 'opaque': 'int', + 'plain': 'int' + } + + attribute_map = { + 'acquire': 'acquire', + 'and_decrement': 'andDecrement', + 'and_increment': 'andIncrement', + 'opaque': 'opaque', + 'plain': 'plain' + } + + def __init__(self, acquire=None, and_decrement=None, and_increment=None, opaque=None, plain=None): # noqa: E501 + """AtomicInteger - a model defined in Swagger""" # noqa: E501 + self._acquire = None + self._and_decrement = None + self._and_increment = None + self._opaque = None + self._plain = None + self.discriminator = None + if acquire is not None: + self.acquire = acquire + if and_decrement is not None: + self.and_decrement = and_decrement + if and_increment is not None: + self.and_increment = and_increment + if opaque is not None: + self.opaque = opaque + if plain is not None: + self.plain = plain + + @property + def acquire(self): + """Gets the acquire of this AtomicInteger. # noqa: E501 + + + :return: The acquire of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._acquire + + @acquire.setter + def acquire(self, acquire): + """Sets the acquire of this AtomicInteger. + + + :param acquire: The acquire of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._acquire = acquire + + @property + def and_decrement(self): + """Gets the and_decrement of this AtomicInteger. # noqa: E501 + + + :return: The and_decrement of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_decrement + + @and_decrement.setter + def and_decrement(self, and_decrement): + """Sets the and_decrement of this AtomicInteger. + + + :param and_decrement: The and_decrement of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_decrement = and_decrement + + @property + def and_increment(self): + """Gets the and_increment of this AtomicInteger. # noqa: E501 + + + :return: The and_increment of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_increment + + @and_increment.setter + def and_increment(self, and_increment): + """Sets the and_increment of this AtomicInteger. + + + :param and_increment: The and_increment of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_increment = and_increment + + @property + def opaque(self): + """Gets the opaque of this AtomicInteger. # noqa: E501 + + + :return: The opaque of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._opaque + + @opaque.setter + def opaque(self, opaque): + """Sets the opaque of this AtomicInteger. + + + :param opaque: The opaque of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._opaque = opaque + + @property + def plain(self): + """Gets the plain of this AtomicInteger. # noqa: E501 + + + :return: The plain of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._plain + + @plain.setter + def plain(self, plain): + """Sets the plain of this AtomicInteger. + + + :param plain: The plain of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._plain = plain + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AtomicInteger, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AtomicInteger): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/attribute_export_data.py b/billinglayer/python/tb_rest_client/models/models_pe/attribute_export_data.py new file mode 100644 index 0000000..d780c50 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/attribute_export_data.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributeExportData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'boolean_value': 'bool', + 'double_value': 'float', + 'json_value': 'str', + 'key': 'str', + 'last_update_ts': 'int', + 'long_value': 'int', + 'str_value': 'str' + } + + attribute_map = { + 'boolean_value': 'booleanValue', + 'double_value': 'doubleValue', + 'json_value': 'jsonValue', + 'key': 'key', + 'last_update_ts': 'lastUpdateTs', + 'long_value': 'longValue', + 'str_value': 'strValue' + } + + def __init__(self, boolean_value=None, double_value=None, json_value=None, key=None, last_update_ts=None, long_value=None, str_value=None): # noqa: E501 + """AttributeExportData - a model defined in Swagger""" # noqa: E501 + self._boolean_value = None + self._double_value = None + self._json_value = None + self._key = None + self._last_update_ts = None + self._long_value = None + self._str_value = None + self.discriminator = None + if boolean_value is not None: + self.boolean_value = boolean_value + if double_value is not None: + self.double_value = double_value + if json_value is not None: + self.json_value = json_value + if key is not None: + self.key = key + if last_update_ts is not None: + self.last_update_ts = last_update_ts + if long_value is not None: + self.long_value = long_value + if str_value is not None: + self.str_value = str_value + + @property + def boolean_value(self): + """Gets the boolean_value of this AttributeExportData. # noqa: E501 + + + :return: The boolean_value of this AttributeExportData. # noqa: E501 + :rtype: bool + """ + return self._boolean_value + + @boolean_value.setter + def boolean_value(self, boolean_value): + """Sets the boolean_value of this AttributeExportData. + + + :param boolean_value: The boolean_value of this AttributeExportData. # noqa: E501 + :type: bool + """ + + self._boolean_value = boolean_value + + @property + def double_value(self): + """Gets the double_value of this AttributeExportData. # noqa: E501 + + + :return: The double_value of this AttributeExportData. # noqa: E501 + :rtype: float + """ + return self._double_value + + @double_value.setter + def double_value(self, double_value): + """Sets the double_value of this AttributeExportData. + + + :param double_value: The double_value of this AttributeExportData. # noqa: E501 + :type: float + """ + + self._double_value = double_value + + @property + def json_value(self): + """Gets the json_value of this AttributeExportData. # noqa: E501 + + + :return: The json_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AttributeExportData. + + + :param json_value: The json_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._json_value = json_value + + @property + def key(self): + """Gets the key of this AttributeExportData. # noqa: E501 + + + :return: The key of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AttributeExportData. + + + :param key: The key of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def last_update_ts(self): + """Gets the last_update_ts of this AttributeExportData. # noqa: E501 + + + :return: The last_update_ts of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._last_update_ts + + @last_update_ts.setter + def last_update_ts(self, last_update_ts): + """Sets the last_update_ts of this AttributeExportData. + + + :param last_update_ts: The last_update_ts of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._last_update_ts = last_update_ts + + @property + def long_value(self): + """Gets the long_value of this AttributeExportData. # noqa: E501 + + + :return: The long_value of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._long_value + + @long_value.setter + def long_value(self, long_value): + """Sets the long_value of this AttributeExportData. + + + :param long_value: The long_value of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._long_value = long_value + + @property + def str_value(self): + """Gets the str_value of this AttributeExportData. # noqa: E501 + + + :return: The str_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._str_value + + @str_value.setter + def str_value(self, str_value): + """Sets the str_value of this AttributeExportData. + + + :param str_value: The str_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._str_value = str_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributeExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributeExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/attributes_entity_view.py b/billinglayer/python/tb_rest_client/models/models_pe/attributes_entity_view.py new file mode 100644 index 0000000..f194c83 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/attributes_entity_view.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributesEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'cs': 'list[str]', + 'sh': 'list[str]', + 'ss': 'list[str]' + } + + attribute_map = { + 'cs': 'cs', + 'sh': 'sh', + 'ss': 'ss' + } + + def __init__(self, cs=None, sh=None, ss=None): # noqa: E501 + """AttributesEntityView - a model defined in Swagger""" # noqa: E501 + self._cs = None + self._sh = None + self._ss = None + self.discriminator = None + self.cs = cs + self.sh = sh + self.ss = ss + + @property + def cs(self): + """Gets the cs of this AttributesEntityView. # noqa: E501 + + List of client-side attribute keys to expose # noqa: E501 + + :return: The cs of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._cs + + @cs.setter + def cs(self, cs): + """Sets the cs of this AttributesEntityView. + + List of client-side attribute keys to expose # noqa: E501 + + :param cs: The cs of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if cs is None: + raise ValueError("Invalid value for `cs`, must not be `None`") # noqa: E501 + + self._cs = cs + + @property + def sh(self): + """Gets the sh of this AttributesEntityView. # noqa: E501 + + List of shared attribute keys to expose # noqa: E501 + + :return: The sh of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._sh + + @sh.setter + def sh(self, sh): + """Sets the sh of this AttributesEntityView. + + List of shared attribute keys to expose # noqa: E501 + + :param sh: The sh of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if sh is None: + raise ValueError("Invalid value for `sh`, must not be `None`") # noqa: E501 + + self._sh = sh + + @property + def ss(self): + """Gets the ss of this AttributesEntityView. # noqa: E501 + + List of server-side attribute keys to expose # noqa: E501 + + :return: The ss of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._ss + + @ss.setter + def ss(self, ss): + """Sets the ss of this AttributesEntityView. + + List of server-side attribute keys to expose # noqa: E501 + + :param ss: The ss of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if ss is None: + raise ValueError("Invalid value for `ss`, must not be `None`") # noqa: E501 + + self._ss = ss + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributesEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributesEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/audit_log.py b/billinglayer/python/tb_rest_client/models/models_pe/audit_log.py new file mode 100644 index 0000000..310da08 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/audit_log.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLog(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AuditLogId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'entity_id': 'EntityId', + 'entity_name': 'str', + 'user_id': 'UserId', + 'user_name': 'str', + 'action_type': 'str', + 'action_data': 'JsonNode', + 'action_status': 'str', + 'action_failure_details': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'entity_id': 'entityId', + 'entity_name': 'entityName', + 'user_id': 'userId', + 'user_name': 'userName', + 'action_type': 'actionType', + 'action_data': 'actionData', + 'action_status': 'actionStatus', + 'action_failure_details': 'actionFailureDetails' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, entity_id=None, entity_name=None, user_id=None, user_name=None, action_type=None, action_data=None, action_status=None, action_failure_details=None): # noqa: E501 + """AuditLog - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._entity_id = None + self._entity_name = None + self._user_id = None + self._user_name = None + self._action_type = None + self._action_data = None + self._action_status = None + self._action_failure_details = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if entity_id is not None: + self.entity_id = entity_id + if entity_name is not None: + self.entity_name = entity_name + if user_id is not None: + self.user_id = user_id + if user_name is not None: + self.user_name = user_name + if action_type is not None: + self.action_type = action_type + if action_data is not None: + self.action_data = action_data + if action_status is not None: + self.action_status = action_status + if action_failure_details is not None: + self.action_failure_details = action_failure_details + + @property + def id(self): + """Gets the id of this AuditLog. # noqa: E501 + + + :return: The id of this AuditLog. # noqa: E501 + :rtype: AuditLogId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLog. + + + :param id: The id of this AuditLog. # noqa: E501 + :type: AuditLogId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AuditLog. # noqa: E501 + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :return: The created_time of this AuditLog. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AuditLog. + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AuditLog. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AuditLog. # noqa: E501 + + + :return: The tenant_id of this AuditLog. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AuditLog. + + + :param tenant_id: The tenant_id of this AuditLog. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AuditLog. # noqa: E501 + + + :return: The customer_id of this AuditLog. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AuditLog. + + + :param customer_id: The customer_id of this AuditLog. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def entity_id(self): + """Gets the entity_id of this AuditLog. # noqa: E501 + + + :return: The entity_id of this AuditLog. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AuditLog. + + + :param entity_id: The entity_id of this AuditLog. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def entity_name(self): + """Gets the entity_name of this AuditLog. # noqa: E501 + + Name of the logged entity # noqa: E501 + + :return: The entity_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this AuditLog. + + Name of the logged entity # noqa: E501 + + :param entity_name: The entity_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._entity_name = entity_name + + @property + def user_id(self): + """Gets the user_id of this AuditLog. # noqa: E501 + + + :return: The user_id of this AuditLog. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AuditLog. + + + :param user_id: The user_id of this AuditLog. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def user_name(self): + """Gets the user_name of this AuditLog. # noqa: E501 + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :return: The user_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._user_name + + @user_name.setter + def user_name(self, user_name): + """Sets the user_name of this AuditLog. + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :param user_name: The user_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._user_name = user_name + + @property + def action_type(self): + """Gets the action_type of this AuditLog. # noqa: E501 + + String represented Action type # noqa: E501 + + :return: The action_type of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_type + + @action_type.setter + def action_type(self, action_type): + """Sets the action_type of this AuditLog. + + String represented Action type # noqa: E501 + + :param action_type: The action_type of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["ACTIVATED", "ADDED", "ADDED_COMMENT", "ADDED_TO_ENTITY_GROUP", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_DELETE", "ALARM_UNASSIGNED", "ASSIGNED_FROM_TENANT", "ASSIGNED_TO_CUSTOMER", "ASSIGNED_TO_EDGE", "ASSIGNED_TO_TENANT", "ATTRIBUTES_DELETED", "ATTRIBUTES_READ", "ATTRIBUTES_UPDATED", "CHANGE_OWNER", "CREDENTIALS_READ", "CREDENTIALS_UPDATED", "DELETED", "DELETED_COMMENT", "LOCKOUT", "LOGIN", "LOGOUT", "MADE_PRIVATE", "MADE_PUBLIC", "PROVISION_FAILURE", "PROVISION_SUCCESS", "RELATIONS_DELETED", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "REMOVED_FROM_ENTITY_GROUP", "REST_API_RULE_ENGINE_CALL", "RPC_CALL", "SUSPENDED", "TIMESERIES_DELETED", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_CUSTOMER", "UNASSIGNED_FROM_EDGE", "UPDATED", "UPDATED_COMMENT"] # noqa: E501 + if action_type not in allowed_values: + raise ValueError( + "Invalid value for `action_type` ({0}), must be one of {1}" # noqa: E501 + .format(action_type, allowed_values) + ) + + self._action_type = action_type + + @property + def action_data(self): + """Gets the action_data of this AuditLog. # noqa: E501 + + + :return: The action_data of this AuditLog. # noqa: E501 + :rtype: JsonNode + """ + return self._action_data + + @action_data.setter + def action_data(self, action_data): + """Sets the action_data of this AuditLog. + + + :param action_data: The action_data of this AuditLog. # noqa: E501 + :type: JsonNode + """ + + self._action_data = action_data + + @property + def action_status(self): + """Gets the action_status of this AuditLog. # noqa: E501 + + String represented Action status # noqa: E501 + + :return: The action_status of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_status + + @action_status.setter + def action_status(self, action_status): + """Sets the action_status of this AuditLog. + + String represented Action status # noqa: E501 + + :param action_status: The action_status of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["FAILURE", "SUCCESS"] # noqa: E501 + if action_status not in allowed_values: + raise ValueError( + "Invalid value for `action_status` ({0}), must be one of {1}" # noqa: E501 + .format(action_status, allowed_values) + ) + + self._action_status = action_status + + @property + def action_failure_details(self): + """Gets the action_failure_details of this AuditLog. # noqa: E501 + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :return: The action_failure_details of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_failure_details + + @action_failure_details.setter + def action_failure_details(self, action_failure_details): + """Sets the action_failure_details of this AuditLog. + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :param action_failure_details: The action_failure_details of this AuditLog. # noqa: E501 + :type: str + """ + + self._action_failure_details = action_failure_details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLog, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/audit_log_id.py b/billinglayer/python/tb_rest_client/models/models_pe/audit_log_id.py new file mode 100644 index 0000000..6710051 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/audit_log_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLogId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AuditLogId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AuditLogId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AuditLogId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLogId. + + string # noqa: E501 + + :param id: The id of this AuditLogId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLogId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLogId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/auto_version_create_config.py b/billinglayer/python/tb_rest_client/models/models_pe/auto_version_create_config.py new file mode 100644 index 0000000..357583c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/auto_version_create_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AutoVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_group_entities': 'bool', + 'save_permissions': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'branch': 'branch', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_group_entities': 'saveGroupEntities', + 'save_permissions': 'savePermissions', + 'save_relations': 'saveRelations' + } + + def __init__(self, branch=None, save_attributes=None, save_credentials=None, save_group_entities=None, save_permissions=None, save_relations=None): # noqa: E501 + """AutoVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._save_attributes = None + self._save_credentials = None + self._save_group_entities = None + self._save_permissions = None + self._save_relations = None + self.discriminator = None + if branch is not None: + self.branch = branch + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_group_entities is not None: + self.save_group_entities = save_group_entities + if save_permissions is not None: + self.save_permissions = save_permissions + if save_relations is not None: + self.save_relations = save_relations + + @property + def branch(self): + """Gets the branch of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The branch of this AutoVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this AutoVersionCreateConfig. + + + :param branch: The branch of this AutoVersionCreateConfig. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def save_attributes(self): + """Gets the save_attributes of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this AutoVersionCreateConfig. + + + :param save_attributes: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this AutoVersionCreateConfig. + + + :param save_credentials: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_group_entities(self): + """Gets the save_group_entities of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_group_entities of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_group_entities + + @save_group_entities.setter + def save_group_entities(self, save_group_entities): + """Sets the save_group_entities of this AutoVersionCreateConfig. + + + :param save_group_entities: The save_group_entities of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_group_entities = save_group_entities + + @property + def save_permissions(self): + """Gets the save_permissions of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_permissions of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_permissions + + @save_permissions.setter + def save_permissions(self, save_permissions): + """Sets the save_permissions of this AutoVersionCreateConfig. + + + :param save_permissions: The save_permissions of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_permissions = save_permissions + + @property + def save_relations(self): + """Gets the save_relations of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this AutoVersionCreateConfig. + + + :param save_relations: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AutoVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AutoVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/aws_sns_sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/aws_sns_sms_provider_configuration.py new file mode 100644 index 0000000..58bd365 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/aws_sns_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class AwsSnsSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_key_id': 'str', + 'secret_access_key': 'str', + 'region': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'access_key_id': 'accessKeyId', + 'secret_access_key': 'secretAccessKey', + 'region': 'region' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, access_key_id=None, secret_access_key=None, region=None, *args, **kwargs): # noqa: E501 + """AwsSnsSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._access_key_id = None + self._secret_access_key = None + self._region = None + self.discriminator = None + if access_key_id is not None: + self.access_key_id = access_key_id + if secret_access_key is not None: + self.secret_access_key = secret_access_key + if region is not None: + self.region = region + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def access_key_id(self): + """Gets the access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key ID. # noqa: E501 + + :return: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._access_key_id + + @access_key_id.setter + def access_key_id(self, access_key_id): + """Sets the access_key_id of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key ID. # noqa: E501 + + :param access_key_id: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._access_key_id = access_key_id + + @property + def secret_access_key(self): + """Gets the secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key. # noqa: E501 + + :return: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._secret_access_key + + @secret_access_key.setter + def secret_access_key(self, secret_access_key): + """Sets the secret_access_key of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key. # noqa: E501 + + :param secret_access_key: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._secret_access_key = secret_access_key + + @property + def region(self): + """Gets the region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS region. # noqa: E501 + + :return: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this AwsSnsSmsProviderConfiguration. + + The AWS region. # noqa: E501 + + :param region: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._region = region + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AwsSnsSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AwsSnsSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/backup_code_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_pe/backup_code_two_fa_account_config.py new file mode 100644 index 0000000..6b60109 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/backup_code_two_fa_account_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes': 'list[str]', + 'codes_left': 'int', + 'use_by_default': 'bool' + } + + attribute_map = { + 'codes': 'codes', + 'codes_left': 'codesLeft', + 'use_by_default': 'useByDefault' + } + + def __init__(self, codes=None, codes_left=None, use_by_default=None): # noqa: E501 + """BackupCodeTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._codes = None + self._codes_left = None + self._use_by_default = None + self.discriminator = None + if codes is not None: + self.codes = codes + if codes_left is not None: + self.codes_left = codes_left + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def codes(self): + """Gets the codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: list[str] + """ + return self._codes + + @codes.setter + def codes(self, codes): + """Sets the codes of this BackupCodeTwoFaAccountConfig. + + + :param codes: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: list[str] + """ + + self._codes = codes + + @property + def codes_left(self): + """Gets the codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: int + """ + return self._codes_left + + @codes_left.setter + def codes_left(self, codes_left): + """Sets the codes_left of this BackupCodeTwoFaAccountConfig. + + + :param codes_left: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: int + """ + + self._codes_left = codes_left + + @property + def use_by_default(self): + """Gets the use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this BackupCodeTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/backup_code_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_pe/backup_code_two_fa_provider_config.py new file mode 100644 index 0000000..f32b8d7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/backup_code_two_fa_provider_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes_quantity': 'int' + } + + attribute_map = { + 'codes_quantity': 'codesQuantity' + } + + def __init__(self, codes_quantity=None): # noqa: E501 + """BackupCodeTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._codes_quantity = None + self.discriminator = None + if codes_quantity is not None: + self.codes_quantity = codes_quantity + + @property + def codes_quantity(self): + """Gets the codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + + + :return: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._codes_quantity + + @codes_quantity.setter + def codes_quantity(self, codes_quantity): + """Sets the codes_quantity of this BackupCodeTwoFaProviderConfig. + + + :param codes_quantity: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._codes_quantity = codes_quantity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_id.py b/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_id.py new file mode 100644 index 0000000..9883108 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_id.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BlobEntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """BlobEntityId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this BlobEntityId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this BlobEntityId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this BlobEntityId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this BlobEntityId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BlobEntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BlobEntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_info.py b/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_info.py new file mode 100644 index 0000000..564887d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BlobEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'BlobEntityId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'content_type': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'content_type': 'contentType', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, content_type=None, additional_info=None): # noqa: E501 + """BlobEntityInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._content_type = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if content_type is not None: + self.content_type = content_type + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this BlobEntityInfo. # noqa: E501 + + + :return: The id of this BlobEntityInfo. # noqa: E501 + :rtype: BlobEntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this BlobEntityInfo. + + + :param id: The id of this BlobEntityInfo. # noqa: E501 + :type: BlobEntityId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this BlobEntityInfo. # noqa: E501 + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :return: The created_time of this BlobEntityInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this BlobEntityInfo. + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this BlobEntityInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this BlobEntityInfo. # noqa: E501 + + + :return: The tenant_id of this BlobEntityInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this BlobEntityInfo. + + + :param tenant_id: The tenant_id of this BlobEntityInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this BlobEntityInfo. # noqa: E501 + + + :return: The customer_id of this BlobEntityInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this BlobEntityInfo. + + + :param customer_id: The customer_id of this BlobEntityInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this BlobEntityInfo. # noqa: E501 + + + :return: The owner_id of this BlobEntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this BlobEntityInfo. + + + :param owner_id: The owner_id of this BlobEntityInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this BlobEntityInfo. # noqa: E501 + + blob entity name # noqa: E501 + + :return: The name of this BlobEntityInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BlobEntityInfo. + + blob entity name # noqa: E501 + + :param name: The name of this BlobEntityInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this BlobEntityInfo. # noqa: E501 + + blob entity type # noqa: E501 + + :return: The type of this BlobEntityInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this BlobEntityInfo. + + blob entity type # noqa: E501 + + :param type: The type of this BlobEntityInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def content_type(self): + """Gets the content_type of this BlobEntityInfo. # noqa: E501 + + blob content type # noqa: E501 + + :return: The content_type of this BlobEntityInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this BlobEntityInfo. + + blob content type # noqa: E501 + + :param content_type: The content_type of this BlobEntityInfo. # noqa: E501 + :type: str + """ + allowed_values = ["application/pdf", "image/jpeg", "image/png"] # noqa: E501 + if content_type not in allowed_values: + raise ValueError( + "Invalid value for `content_type` ({0}), must be one of {1}" # noqa: E501 + .format(content_type, allowed_values) + ) + + self._content_type = content_type + + @property + def additional_info(self): + """Gets the additional_info of this BlobEntityInfo. # noqa: E501 + + + :return: The additional_info of this BlobEntityInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this BlobEntityInfo. + + + :param additional_info: The additional_info of this BlobEntityInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BlobEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BlobEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_with_customer_info.py b/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_with_customer_info.py new file mode 100644 index 0000000..370564f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/blob_entity_with_customer_info.py @@ -0,0 +1,402 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BlobEntityWithCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'BlobEntityId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'content_type': 'str', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'object' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'content_type': 'contentType', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, content_type=None, additional_info=None, customer_title=None, customer_is_public=None): # noqa: E501 + """BlobEntityWithCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._content_type = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if content_type is not None: + self.content_type = content_type + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + + @property + def id(self): + """Gets the id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: BlobEntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this BlobEntityWithCustomerInfo. + + + :param id: The id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: BlobEntityId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this BlobEntityWithCustomerInfo. # noqa: E501 + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :return: The created_time of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this BlobEntityWithCustomerInfo. + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The tenant_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this BlobEntityWithCustomerInfo. + + + :param tenant_id: The tenant_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The customer_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this BlobEntityWithCustomerInfo. + + + :param customer_id: The customer_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The owner_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this BlobEntityWithCustomerInfo. + + + :param owner_id: The owner_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this BlobEntityWithCustomerInfo. # noqa: E501 + + blob entity name # noqa: E501 + + :return: The name of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BlobEntityWithCustomerInfo. + + blob entity name # noqa: E501 + + :param name: The name of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this BlobEntityWithCustomerInfo. # noqa: E501 + + blob entity type # noqa: E501 + + :return: The type of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this BlobEntityWithCustomerInfo. + + blob entity type # noqa: E501 + + :param type: The type of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def content_type(self): + """Gets the content_type of this BlobEntityWithCustomerInfo. # noqa: E501 + + blob content type # noqa: E501 + + :return: The content_type of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this BlobEntityWithCustomerInfo. + + blob content type # noqa: E501 + + :param content_type: The content_type of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + allowed_values = ["application/pdf", "image/jpeg", "image/png"] # noqa: E501 + if content_type not in allowed_values: + raise ValueError( + "Invalid value for `content_type` ({0}), must be one of {1}" # noqa: E501 + .format(content_type, allowed_values) + ) + + self._content_type = content_type + + @property + def additional_info(self): + """Gets the additional_info of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The additional_info of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this BlobEntityWithCustomerInfo. + + + :param additional_info: The additional_info of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this BlobEntityWithCustomerInfo. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The customer_title of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this BlobEntityWithCustomerInfo. + + Title of the customer # noqa: E501 + + :param customer_title: The customer_title of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this BlobEntityWithCustomerInfo. # noqa: E501 + + Parameter that specifies if customer is public # noqa: E501 + + :return: The customer_is_public of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: object + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this BlobEntityWithCustomerInfo. + + Parameter that specifies if customer is public # noqa: E501 + + :param customer_is_public: The customer_is_public of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: object + """ + + self._customer_is_public = customer_is_public + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BlobEntityWithCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BlobEntityWithCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/boolean_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_pe/boolean_filter_predicate.py new file mode 100644 index 0000000..a8e194e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/boolean_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class BooleanFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValueboolean' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """BooleanFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this BooleanFilterPredicate. # noqa: E501 + + + :return: The operation of this BooleanFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this BooleanFilterPredicate. + + + :param operation: The operation of this BooleanFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this BooleanFilterPredicate. # noqa: E501 + + + :return: The value of this BooleanFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValueboolean + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this BooleanFilterPredicate. + + + :param value: The value of this BooleanFilterPredicate. # noqa: E501 + :type: FilterPredicateValueboolean + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BooleanFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BooleanFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/bootstrap_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/bootstrap_configuration.py new file mode 100644 index 0000000..b8c716f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/bootstrap_configuration.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BootstrapConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap_server': 'object', + 'lwm2m_server': 'object', + 'servers': 'object' + } + + attribute_map = { + 'bootstrap_server': 'bootstrapServer', + 'lwm2m_server': 'lwm2mServer', + 'servers': 'servers' + } + + def __init__(self, bootstrap_server=None, lwm2m_server=None, servers=None): # noqa: E501 + """BootstrapConfiguration - a model defined in Swagger""" # noqa: E501 + self._bootstrap_server = None + self._lwm2m_server = None + self._servers = None + self.discriminator = None + if bootstrap_server is not None: + self.bootstrap_server = bootstrap_server + if lwm2m_server is not None: + self.lwm2m_server = lwm2m_server + if servers is not None: + self.servers = servers + + @property + def bootstrap_server(self): + """Gets the bootstrap_server of this BootstrapConfiguration. # noqa: E501 + + + :return: The bootstrap_server of this BootstrapConfiguration. # noqa: E501 + :rtype: object + """ + return self._bootstrap_server + + @bootstrap_server.setter + def bootstrap_server(self, bootstrap_server): + """Sets the bootstrap_server of this BootstrapConfiguration. + + + :param bootstrap_server: The bootstrap_server of this BootstrapConfiguration. # noqa: E501 + :type: object + """ + + self._bootstrap_server = bootstrap_server + + @property + def lwm2m_server(self): + """Gets the lwm2m_server of this BootstrapConfiguration. # noqa: E501 + + + :return: The lwm2m_server of this BootstrapConfiguration. # noqa: E501 + :rtype: object + """ + return self._lwm2m_server + + @lwm2m_server.setter + def lwm2m_server(self, lwm2m_server): + """Sets the lwm2m_server of this BootstrapConfiguration. + + + :param lwm2m_server: The lwm2m_server of this BootstrapConfiguration. # noqa: E501 + :type: object + """ + + self._lwm2m_server = lwm2m_server + + @property + def servers(self): + """Gets the servers of this BootstrapConfiguration. # noqa: E501 + + + :return: The servers of this BootstrapConfiguration. # noqa: E501 + :rtype: object + """ + return self._servers + + @servers.setter + def servers(self, servers): + """Sets the servers of this BootstrapConfiguration. + + + :param servers: The servers of this BootstrapConfiguration. # noqa: E501 + :type: object + """ + + self._servers = servers + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BootstrapConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BootstrapConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/branch_info.py b/billinglayer/python/tb_rest_client/models/models_pe/branch_info.py new file mode 100644 index 0000000..e5bf61f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default': 'bool', + 'name': 'str' + } + + attribute_map = { + 'default': 'default', + 'name': 'name' + } + + def __init__(self, default=None, name=None): # noqa: E501 + """BranchInfo - a model defined in Swagger""" # noqa: E501 + self._default = None + self._name = None + self.discriminator = None + if default is not None: + self.default = default + if name is not None: + self.name = name + + @property + def default(self): + """Gets the default of this BranchInfo. # noqa: E501 + + + :return: The default of this BranchInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this BranchInfo. + + + :param default: The default of this BranchInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def name(self): + """Gets the name of this BranchInfo. # noqa: E501 + + + :return: The name of this BranchInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BranchInfo. + + + :param name: The name of this BranchInfo. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_request.py b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_request.py new file mode 100644 index 0000000..5417a49 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_request.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'CustomerId', + 'entity_group_id': 'str', + 'file': 'str', + 'mapping': 'Mapping' + } + + attribute_map = { + 'customer_id': 'customerId', + 'entity_group_id': 'entityGroupId', + 'file': 'file', + 'mapping': 'mapping' + } + + def __init__(self, customer_id=None, entity_group_id=None, file=None, mapping=None): # noqa: E501 + """BulkImportRequest - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self._entity_group_id = None + self._file = None + self._mapping = None + self.discriminator = None + if customer_id is not None: + self.customer_id = customer_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if file is not None: + self.file = file + if mapping is not None: + self.mapping = mapping + + @property + def customer_id(self): + """Gets the customer_id of this BulkImportRequest. # noqa: E501 + + + :return: The customer_id of this BulkImportRequest. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this BulkImportRequest. + + + :param customer_id: The customer_id of this BulkImportRequest. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this BulkImportRequest. # noqa: E501 + + + :return: The entity_group_id of this BulkImportRequest. # noqa: E501 + :rtype: str + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this BulkImportRequest. + + + :param entity_group_id: The entity_group_id of this BulkImportRequest. # noqa: E501 + :type: str + """ + + self._entity_group_id = entity_group_id + + @property + def file(self): + """Gets the file of this BulkImportRequest. # noqa: E501 + + + :return: The file of this BulkImportRequest. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this BulkImportRequest. + + + :param file: The file of this BulkImportRequest. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def mapping(self): + """Gets the mapping of this BulkImportRequest. # noqa: E501 + + + :return: The mapping of this BulkImportRequest. # noqa: E501 + :rtype: Mapping + """ + return self._mapping + + @mapping.setter + def mapping(self, mapping): + """Sets the mapping of this BulkImportRequest. + + + :param mapping: The mapping of this BulkImportRequest. # noqa: E501 + :type: Mapping + """ + + self._mapping = mapping + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_asset.py b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_asset.py new file mode 100644 index 0000000..d14bb42 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_asset.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultAsset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultAsset - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultAsset. # noqa: E501 + + + :return: The created of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultAsset. + + + :param created: The created of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultAsset. + + + :param errors: The errors of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors_list of this BulkImportResultAsset. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultAsset. + + + :param errors_list: The errors_list of this BulkImportResultAsset. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultAsset. # noqa: E501 + + + :return: The updated of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultAsset. + + + :param updated: The updated of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultAsset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultAsset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_device.py b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_device.py new file mode 100644 index 0000000..ee3dd42 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_device.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultDevice(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultDevice - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultDevice. # noqa: E501 + + + :return: The created of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultDevice. + + + :param created: The created of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultDevice. + + + :param errors: The errors of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors_list of this BulkImportResultDevice. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultDevice. + + + :param errors_list: The errors_list of this BulkImportResultDevice. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultDevice. # noqa: E501 + + + :return: The updated of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultDevice. + + + :param updated: The updated of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultDevice, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultDevice): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_edge.py b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_edge.py new file mode 100644 index 0000000..007eb13 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/bulk_import_result_edge.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultEdge - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultEdge. # noqa: E501 + + + :return: The created of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultEdge. + + + :param created: The created of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultEdge. + + + :param errors: The errors of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors_list of this BulkImportResultEdge. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultEdge. + + + :param errors_list: The errors_list of this BulkImportResultEdge. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultEdge. # noqa: E501 + + + :return: The updated of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultEdge. + + + :param updated: The updated of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/byte_buffer.py b/billinglayer/python/tb_rest_client/models/models_pe/byte_buffer.py new file mode 100644 index 0000000..47b7d93 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/byte_buffer.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ByteBuffer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'char': 'str', + 'direct': 'bool', + 'double': 'float', + '_float': 'float', + '_int': 'int', + 'long': 'int', + 'read_only': 'bool', + 'short': 'int' + } + + attribute_map = { + 'char': 'char', + 'direct': 'direct', + 'double': 'double', + '_float': 'float', + '_int': 'int', + 'long': 'long', + 'read_only': 'readOnly', + 'short': 'short' + } + + def __init__(self, char=None, direct=None, double=None, _float=None, _int=None, long=None, read_only=None, short=None): # noqa: E501 + """ByteBuffer - a model defined in Swagger""" # noqa: E501 + self._char = None + self._direct = None + self._double = None + self.__float = None + self.__int = None + self._long = None + self._read_only = None + self._short = None + self.discriminator = None + if char is not None: + self.char = char + if direct is not None: + self.direct = direct + if double is not None: + self.double = double + if _float is not None: + self._float = _float + if _int is not None: + self._int = _int + if long is not None: + self.long = long + if read_only is not None: + self.read_only = read_only + if short is not None: + self.short = short + + @property + def char(self): + """Gets the char of this ByteBuffer. # noqa: E501 + + + :return: The char of this ByteBuffer. # noqa: E501 + :rtype: str + """ + return self._char + + @char.setter + def char(self, char): + """Sets the char of this ByteBuffer. + + + :param char: The char of this ByteBuffer. # noqa: E501 + :type: str + """ + + self._char = char + + @property + def direct(self): + """Gets the direct of this ByteBuffer. # noqa: E501 + + + :return: The direct of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._direct + + @direct.setter + def direct(self, direct): + """Sets the direct of this ByteBuffer. + + + :param direct: The direct of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._direct = direct + + @property + def double(self): + """Gets the double of this ByteBuffer. # noqa: E501 + + + :return: The double of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self._double + + @double.setter + def double(self, double): + """Sets the double of this ByteBuffer. + + + :param double: The double of this ByteBuffer. # noqa: E501 + :type: float + """ + + self._double = double + + @property + def _float(self): + """Gets the _float of this ByteBuffer. # noqa: E501 + + + :return: The _float of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self.__float + + @_float.setter + def _float(self, _float): + """Sets the _float of this ByteBuffer. + + + :param _float: The _float of this ByteBuffer. # noqa: E501 + :type: float + """ + + self.__float = _float + + @property + def _int(self): + """Gets the _int of this ByteBuffer. # noqa: E501 + + + :return: The _int of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self.__int + + @_int.setter + def _int(self, _int): + """Sets the _int of this ByteBuffer. + + + :param _int: The _int of this ByteBuffer. # noqa: E501 + :type: int + """ + + self.__int = _int + + @property + def long(self): + """Gets the long of this ByteBuffer. # noqa: E501 + + + :return: The long of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._long + + @long.setter + def long(self, long): + """Sets the long of this ByteBuffer. + + + :param long: The long of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._long = long + + @property + def read_only(self): + """Gets the read_only of this ByteBuffer. # noqa: E501 + + + :return: The read_only of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this ByteBuffer. + + + :param read_only: The read_only of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def short(self): + """Gets the short of this ByteBuffer. # noqa: E501 + + + :return: The short of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._short + + @short.setter + def short(self, short): + """Sets the short of this ByteBuffer. + + + :param short: The short of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._short = short + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ByteBuffer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ByteBuffer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/change_password_request.py b/billinglayer/python/tb_rest_client/models/models_pe/change_password_request.py new file mode 100644 index 0000000..8770bbb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/change_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ChangePasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_password': 'str', + 'new_password': 'str' + } + + attribute_map = { + 'current_password': 'currentPassword', + 'new_password': 'newPassword' + } + + def __init__(self, current_password=None, new_password=None): # noqa: E501 + """ChangePasswordRequest - a model defined in Swagger""" # noqa: E501 + self._current_password = None + self._new_password = None + self.discriminator = None + if current_password is not None: + self.current_password = current_password + if new_password is not None: + self.new_password = new_password + + @property + def current_password(self): + """Gets the current_password of this ChangePasswordRequest. # noqa: E501 + + The old password # noqa: E501 + + :return: The current_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._current_password + + @current_password.setter + def current_password(self, current_password): + """Sets the current_password of this ChangePasswordRequest. + + The old password # noqa: E501 + + :param current_password: The current_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._current_password = current_password + + @property + def new_password(self): + """Gets the new_password of this ChangePasswordRequest. # noqa: E501 + + The new password # noqa: E501 + + :return: The new_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._new_password + + @new_password.setter + def new_password(self, new_password): + """Sets the new_password of this ChangePasswordRequest. + + The new password # noqa: E501 + + :param new_password: The new_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._new_password = new_password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ChangePasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ChangePasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/check_pre_provisioned_devices_device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/check_pre_provisioned_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..7f3662d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/check_pre_provisioned_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/claim_request.py b/billinglayer/python/tb_rest_client/models/models_pe/claim_request.py new file mode 100644 index 0000000..16db2f4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/claim_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClaimRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'secret_key': 'str' + } + + attribute_map = { + 'secret_key': 'secretKey' + } + + def __init__(self, secret_key=None): # noqa: E501 + """ClaimRequest - a model defined in Swagger""" # noqa: E501 + self._secret_key = None + self.discriminator = None + if secret_key is not None: + self.secret_key = secret_key + + @property + def secret_key(self): + """Gets the secret_key of this ClaimRequest. # noqa: E501 + + + :return: The secret_key of this ClaimRequest. # noqa: E501 + :rtype: str + """ + return self._secret_key + + @secret_key.setter + def secret_key(self, secret_key): + """Sets the secret_key of this ClaimRequest. + + + :param secret_key: The secret_key of this ClaimRequest. # noqa: E501 + :type: str + """ + + self._secret_key = secret_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClaimRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClaimRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/clear_rule.py b/billinglayer/python/tb_rest_client/models/models_pe/clear_rule.py new file mode 100644 index 0000000..982d347 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/clear_rule.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClearRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_statuses': 'list[str]' + } + + attribute_map = { + 'alarm_statuses': 'alarmStatuses' + } + + def __init__(self, alarm_statuses=None): # noqa: E501 + """ClearRule - a model defined in Swagger""" # noqa: E501 + self._alarm_statuses = None + self.discriminator = None + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this ClearRule. # noqa: E501 + + + :return: The alarm_statuses of this ClearRule. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this ClearRule. + + + :param alarm_statuses: The alarm_statuses of this ClearRule. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClearRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClearRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/client_attributes_querying_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_pe/client_attributes_querying_snmp_communication_config.py new file mode 100644 index 0000000..71e11c1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/client_attributes_querying_snmp_communication_config.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClientAttributesQueryingSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None): # noqa: E501 + """ClientAttributesQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClientAttributesQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClientAttributesQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/client_registration_dto.py b/billinglayer/python/tb_rest_client/models/models_pe/client_registration_dto.py new file mode 100644 index 0000000..74b704d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/client_registration_dto.py @@ -0,0 +1,436 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClientRegistrationDto(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'str', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'client_id': 'str', + 'client_secret': 'str', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'client_id': 'clientId', + 'client_secret': 'clientSecret', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, client_id=None, client_secret=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """ClientRegistrationDto - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._client_id = None + self._client_secret = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + if access_token_uri is not None: + self.access_token_uri = access_token_uri + if additional_info is not None: + self.additional_info = additional_info + if authorization_uri is not None: + self.authorization_uri = authorization_uri + if client_authentication_method is not None: + self.client_authentication_method = client_authentication_method + if client_id is not None: + self.client_id = client_id + if client_secret is not None: + self.client_secret = client_secret + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + if login_button_label is not None: + self.login_button_label = login_button_label + if mapper_config is not None: + self.mapper_config = mapper_config + if scope is not None: + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The access_token_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this ClientRegistrationDto. + + + :param access_token_uri: The access_token_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this ClientRegistrationDto. # noqa: E501 + + + :return: The additional_info of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this ClientRegistrationDto. + + + :param additional_info: The additional_info of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The authorization_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this ClientRegistrationDto. + + + :param authorization_uri: The authorization_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this ClientRegistrationDto. # noqa: E501 + + + :return: The client_authentication_method of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this ClientRegistrationDto. + + + :param client_authentication_method: The client_authentication_method of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._client_authentication_method = client_authentication_method + + @property + def client_id(self): + """Gets the client_id of this ClientRegistrationDto. # noqa: E501 + + + :return: The client_id of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._client_id + + @client_id.setter + def client_id(self, client_id): + """Sets the client_id of this ClientRegistrationDto. + + + :param client_id: The client_id of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._client_id = client_id + + @property + def client_secret(self): + """Gets the client_secret of this ClientRegistrationDto. # noqa: E501 + + + :return: The client_secret of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._client_secret + + @client_secret.setter + def client_secret(self, client_secret): + """Sets the client_secret of this ClientRegistrationDto. + + + :param client_secret: The client_secret of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._client_secret = client_secret + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The jwk_set_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this ClientRegistrationDto. + + + :param jwk_set_uri: The jwk_set_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this ClientRegistrationDto. # noqa: E501 + + + :return: The login_button_icon of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this ClientRegistrationDto. + + + :param login_button_icon: The login_button_icon of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this ClientRegistrationDto. # noqa: E501 + + + :return: The login_button_label of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this ClientRegistrationDto. + + + :param login_button_label: The login_button_label of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this ClientRegistrationDto. # noqa: E501 + + + :return: The mapper_config of this ClientRegistrationDto. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this ClientRegistrationDto. + + + :param mapper_config: The mapper_config of this ClientRegistrationDto. # noqa: E501 + :type: OAuth2MapperConfig + """ + + self._mapper_config = mapper_config + + @property + def scope(self): + """Gets the scope of this ClientRegistrationDto. # noqa: E501 + + + :return: The scope of this ClientRegistrationDto. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this ClientRegistrationDto. + + + :param scope: The scope of this ClientRegistrationDto. # noqa: E501 + :type: list[str] + """ + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The user_info_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this ClientRegistrationDto. + + + :param user_info_uri: The user_info_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this ClientRegistrationDto. # noqa: E501 + + + :return: The user_name_attribute_name of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this ClientRegistrationDto. + + + :param user_name_attribute_name: The user_name_attribute_name of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClientRegistrationDto, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClientRegistrationDto): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/coap_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/coap_device_profile_transport_configuration.py new file mode 100644 index 0000000..50fa610 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/coap_device_profile_transport_configuration.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class CoapDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_settings': 'PowerSavingConfiguration', + 'coap_device_type_configuration': 'CoapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'client_settings': 'clientSettings', + 'coap_device_type_configuration': 'coapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, client_settings=None, coap_device_type_configuration=None, *args, **kwargs): # noqa: E501 + """CoapDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_settings = None + self._coap_device_type_configuration = None + self.discriminator = None + if client_settings is not None: + self.client_settings = client_settings + if coap_device_type_configuration is not None: + self.coap_device_type_configuration = coap_device_type_configuration + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def client_settings(self): + """Gets the client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: PowerSavingConfiguration + """ + return self._client_settings + + @client_settings.setter + def client_settings(self, client_settings): + """Sets the client_settings of this CoapDeviceProfileTransportConfiguration. + + + :param client_settings: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: PowerSavingConfiguration + """ + + self._client_settings = client_settings + + @property + def coap_device_type_configuration(self): + """Gets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: CoapDeviceTypeConfiguration + """ + return self._coap_device_type_configuration + + @coap_device_type_configuration.setter + def coap_device_type_configuration(self, coap_device_type_configuration): + """Sets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. + + + :param coap_device_type_configuration: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: CoapDeviceTypeConfiguration + """ + + self._coap_device_type_configuration = coap_device_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/coap_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/coap_device_transport_configuration.py new file mode 100644 index 0000000..e1c102f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/coap_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class CoapDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """CoapDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this CoapDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this CoapDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this CoapDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this CoapDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/coap_device_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/coap_device_type_configuration.py new file mode 100644 index 0000000..e4ac6c6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """CoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/column_mapping.py b/billinglayer/python/tb_rest_client/models/models_pe/column_mapping.py new file mode 100644 index 0000000..f4ce7bb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/column_mapping.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ColumnMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """ColumnMapping - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this ColumnMapping. # noqa: E501 + + + :return: The key of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this ColumnMapping. + + + :param key: The key of this ColumnMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this ColumnMapping. # noqa: E501 + + + :return: The type of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ColumnMapping. + + + :param type: The type of this ColumnMapping. # noqa: E501 + :type: str + """ + allowed_values = ["ACCESS_TOKEN", "CLOUD_ENDPOINT", "DESCRIPTION", "EDGE_LICENSE_KEY", "IS_GATEWAY", "LABEL", "LWM2M_BOOTSTRAP_SERVER_PUBLIC_KEY_OR_ID", "LWM2M_BOOTSTRAP_SERVER_SECRET_KEY", "LWM2M_BOOTSTRAP_SERVER_SECURITY_MODE", "LWM2M_CLIENT_CERT", "LWM2M_CLIENT_ENDPOINT", "LWM2M_CLIENT_IDENTITY", "LWM2M_CLIENT_KEY", "LWM2M_CLIENT_SECURITY_CONFIG_MODE", "LWM2M_SERVER_CLIENT_PUBLIC_KEY_OR_ID", "LWM2M_SERVER_CLIENT_SECRET_KEY", "LWM2M_SERVER_SECURITY_MODE", "MQTT_CLIENT_ID", "MQTT_PASSWORD", "MQTT_USER_NAME", "NAME", "ROUTING_KEY", "SECRET", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIMESERIES", "TYPE", "X509"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ColumnMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ColumnMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/comparison_ts_value.py b/billinglayer/python/tb_rest_client/models/models_pe/comparison_ts_value.py new file mode 100644 index 0000000..5bd4b18 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/comparison_ts_value.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComparisonTsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current': 'TsValue', + 'previous': 'TsValue' + } + + attribute_map = { + 'current': 'current', + 'previous': 'previous' + } + + def __init__(self, current=None, previous=None): # noqa: E501 + """ComparisonTsValue - a model defined in Swagger""" # noqa: E501 + self._current = None + self._previous = None + self.discriminator = None + if current is not None: + self.current = current + if previous is not None: + self.previous = previous + + @property + def current(self): + """Gets the current of this ComparisonTsValue. # noqa: E501 + + + :return: The current of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._current + + @current.setter + def current(self, current): + """Sets the current of this ComparisonTsValue. + + + :param current: The current of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._current = current + + @property + def previous(self): + """Gets the previous of this ComparisonTsValue. # noqa: E501 + + + :return: The previous of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._previous + + @previous.setter + def previous(self, previous): + """Sets the previous of this ComparisonTsValue. + + + :param previous: The previous of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._previous = previous + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComparisonTsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComparisonTsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/complex_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_pe/complex_filter_predicate.py new file mode 100644 index 0000000..84c63d4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/complex_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class ComplexFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'predicates': 'list[KeyFilterPredicate]' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'predicates': 'predicates' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, predicates=None, *args, **kwargs): # noqa: E501 + """ComplexFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._predicates = None + self.discriminator = None + if operation is not None: + self.operation = operation + if predicates is not None: + self.predicates = predicates + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this ComplexFilterPredicate. # noqa: E501 + + + :return: The operation of this ComplexFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this ComplexFilterPredicate. + + + :param operation: The operation of this ComplexFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["AND", "OR"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def predicates(self): + """Gets the predicates of this ComplexFilterPredicate. # noqa: E501 + + + :return: The predicates of this ComplexFilterPredicate. # noqa: E501 + :rtype: list[KeyFilterPredicate] + """ + return self._predicates + + @predicates.setter + def predicates(self, predicates): + """Sets the predicates of this ComplexFilterPredicate. + + + :param predicates: The predicates of this ComplexFilterPredicate. # noqa: E501 + :type: list[KeyFilterPredicate] + """ + + self._predicates = predicates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/complex_version_create_request.py b/billinglayer/python/tb_rest_client/models/models_pe/complex_version_create_request.py new file mode 100644 index 0000000..42cd339 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/complex_version_create_request.py @@ -0,0 +1,246 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class ComplexVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'entity_types': 'dict(str, EntityTypeVersionCreateConfig)', + 'sync_strategy': 'str', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'entity_types': 'entityTypes', + 'sync_strategy': 'syncStrategy', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, entity_types=None, sync_strategy=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """ComplexVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._entity_types = None + self._sync_strategy = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if entity_types is not None: + self.entity_types = entity_types + if sync_strategy is not None: + self.sync_strategy = sync_strategy + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this ComplexVersionCreateRequest. + + + :param branch: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def entity_types(self): + """Gets the entity_types of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionCreateConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this ComplexVersionCreateRequest. + + + :param entity_types: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionCreateConfig) + """ + + self._entity_types = entity_types + + @property + def sync_strategy(self): + """Gets the sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this ComplexVersionCreateRequest. + + + :param sync_strategy: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + @property + def type(self): + """Gets the type of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The type of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComplexVersionCreateRequest. + + + :param type: The type of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this ComplexVersionCreateRequest. + + + :param version_name: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/component_descriptor.py b/billinglayer/python/tb_rest_client/models/models_pe/component_descriptor.py new file mode 100644 index 0000000..4c9494e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/component_descriptor.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptor(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'ComponentDescriptorId', + 'created_time': 'int', + 'type': 'str', + 'scope': 'str', + 'clustering_mode': 'str', + 'name': 'str', + 'clazz': 'str', + 'configuration_descriptor': 'JsonNode', + 'actions': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'type': 'type', + 'scope': 'scope', + 'clustering_mode': 'clusteringMode', + 'name': 'name', + 'clazz': 'clazz', + 'configuration_descriptor': 'configurationDescriptor', + 'actions': 'actions' + } + + def __init__(self, id=None, created_time=None, type=None, scope=None, clustering_mode=None, name=None, clazz=None, configuration_descriptor=None, actions=None): # noqa: E501 + """ComponentDescriptor - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._type = None + self._scope = None + self._clustering_mode = None + self._name = None + self._clazz = None + self._configuration_descriptor = None + self._actions = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if type is not None: + self.type = type + if scope is not None: + self.scope = scope + if clustering_mode is not None: + self.clustering_mode = clustering_mode + if name is not None: + self.name = name + if clazz is not None: + self.clazz = clazz + if configuration_descriptor is not None: + self.configuration_descriptor = configuration_descriptor + if actions is not None: + self.actions = actions + + @property + def id(self): + """Gets the id of this ComponentDescriptor. # noqa: E501 + + + :return: The id of this ComponentDescriptor. # noqa: E501 + :rtype: ComponentDescriptorId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptor. + + + :param id: The id of this ComponentDescriptor. # noqa: E501 + :type: ComponentDescriptorId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this ComponentDescriptor. # noqa: E501 + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :return: The created_time of this ComponentDescriptor. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ComponentDescriptor. + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this ComponentDescriptor. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def type(self): + """Gets the type of this ComponentDescriptor. # noqa: E501 + + Type of the Rule Node # noqa: E501 + + :return: The type of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComponentDescriptor. + + Type of the Rule Node # noqa: E501 + + :param type: The type of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ACTION", "ANALYTICS", "ENRICHMENT", "EXTERNAL", "FILTER", "FLOW", "TRANSFORMATION"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def scope(self): + """Gets the scope of this ComponentDescriptor. # noqa: E501 + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :return: The scope of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this ComponentDescriptor. + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :param scope: The scope of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["TENANT"] # noqa: E501 + if scope not in allowed_values: + raise ValueError( + "Invalid value for `scope` ({0}), must be one of {1}" # noqa: E501 + .format(scope, allowed_values) + ) + + self._scope = scope + + @property + def clustering_mode(self): + """Gets the clustering_mode of this ComponentDescriptor. # noqa: E501 + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :return: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clustering_mode + + @clustering_mode.setter + def clustering_mode(self, clustering_mode): + """Sets the clustering_mode of this ComponentDescriptor. + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :param clustering_mode: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ENABLED", "SINGLETON", "USER_PREFERENCE"] # noqa: E501 + if clustering_mode not in allowed_values: + raise ValueError( + "Invalid value for `clustering_mode` ({0}), must be one of {1}" # noqa: E501 + .format(clustering_mode, allowed_values) + ) + + self._clustering_mode = clustering_mode + + @property + def name(self): + """Gets the name of this ComponentDescriptor. # noqa: E501 + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :return: The name of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ComponentDescriptor. + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :param name: The name of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def clazz(self): + """Gets the clazz of this ComponentDescriptor. # noqa: E501 + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :return: The clazz of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clazz + + @clazz.setter + def clazz(self, clazz): + """Sets the clazz of this ComponentDescriptor. + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :param clazz: The clazz of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._clazz = clazz + + @property + def configuration_descriptor(self): + """Gets the configuration_descriptor of this ComponentDescriptor. # noqa: E501 + + + :return: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration_descriptor + + @configuration_descriptor.setter + def configuration_descriptor(self, configuration_descriptor): + """Sets the configuration_descriptor of this ComponentDescriptor. + + + :param configuration_descriptor: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :type: JsonNode + """ + + self._configuration_descriptor = configuration_descriptor + + @property + def actions(self): + """Gets the actions of this ComponentDescriptor. # noqa: E501 + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :return: The actions of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._actions + + @actions.setter + def actions(self, actions): + """Sets the actions of this ComponentDescriptor. + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :param actions: The actions of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._actions = actions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptor, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptor): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/component_descriptor_id.py b/billinglayer/python/tb_rest_client/models/models_pe/component_descriptor_id.py new file mode 100644 index 0000000..c8315e3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/component_descriptor_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptorId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """ComponentDescriptorId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this ComponentDescriptorId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this ComponentDescriptorId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptorId. + + string # noqa: E501 + + :param id: The id of this ComponentDescriptorId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptorId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptorId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/contact_basedobject.py b/billinglayer/python/tb_rest_client/models/models_pe/contact_basedobject.py new file mode 100644 index 0000000..76ef563 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/contact_basedobject.py @@ -0,0 +1,494 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ContactBasedobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'address': 'str', + 'address2': 'str', + 'city': 'str', + 'country': 'str', + 'created_time': 'int', + 'email': 'str', + 'id': 'object', + 'name': 'str', + 'phone': 'str', + 'state': 'str', + 'zip': 'str', + 'external_id': 'EntityId', + 'owner_id': 'EntityId', + 'parent_customer_id': 'CustomerId', + 'tenant_id': 'TenantId', + 'title': 'str', + 'customer_id': 'CustomerId', + 'tenant_profile_id': 'TenantProfileId' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'address': 'address', + 'address2': 'address2', + 'city': 'city', + 'country': 'country', + 'created_time': 'createdTime', + 'email': 'email', + 'id': 'id', + 'name': 'name', + 'phone': 'phone', + 'state': 'state', + 'zip': 'zip', + 'external_id': 'externalId', + 'owner_id': 'ownerId', + 'parent_customer_id': 'parentCustomerId', + 'tenant_id': 'tenantId', + 'title': 'title', + 'customer_id': 'customerId', + 'tenant_profile_id': 'tenantProfileId' + } + + def __init__(self, additional_info=None, address=None, address2=None, tenant_profile_id=None, external_id=None, customer_id=None, owner_id=None, title=None, tenant_id=None, parent_customer_id=None, city=None, country=None, created_time=None, email=None, id=None, name=None, phone=None, state=None, zip=None): # noqa: E501 + """ContactBasedobject - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._address = None + self._address2 = None + self._city = None + self._country = None + self._created_time = None + self._email = None + self._id = None + self._name = None + self._phone = None + self._state = None + self._zip = None + self._external_id = None + self._owner_id = None + self._parent_customer_id = None + self._tenant_id = None + self._title = None + self._customer_id = None + self._tenant_profile_id = None + self.parent_customer_id = parent_customer_id + self.owner_id = owner_id + self.discriminator = None + self.external_id = external_id + self.tenant_id = tenant_id + self.title = title + self.customer_id = customer_id + self.tenant_profile_id = tenant_profile_id + if additional_info is not None: + self.additional_info = additional_info + if address is not None: + self.address = address + if address2 is not None: + self.address2 = address2 + if city is not None: + self.city = city + if country is not None: + self.country = country + if created_time is not None: + self.created_time = created_time + if email is not None: + self.email = email + if id is not None: + self.id = id + if name is not None: + self.name = name + if phone is not None: + self.phone = phone + if state is not None: + self.state = state + if zip is not None: + self.zip = zip + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def owner_id(self): + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + self._owner_id = owner_id + + @property + def parent_customer_id(self): + return self._parent_customer_id + + @parent_customer_id.setter + def parent_customer_id(self, parent_customer_id): + self._parent_customer_id = parent_customer_id + + @property + def tenant_id(self): + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + self._tenant_id = tenant_id + + @property + def title(self): + return self._title + + @title.setter + def title(self, title): + self._title = title + + @property + def customer_id(self): + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + self._customer_id = customer_id + + @property + def tenant_profile_id(self): + return self._tenant_profile_id + + @tenant_profile_id.setter + def tenant_profile_id(self, tenant_profile_id): + self._tenant_profile_id = tenant_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this ContactBasedobject. # noqa: E501 + + + :return: The additional_info of this ContactBasedobject. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this ContactBasedobject. + + + :param additional_info: The additional_info of this ContactBasedobject. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def address(self): + """Gets the address of this ContactBasedobject. # noqa: E501 + + + :return: The address of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this ContactBasedobject. + + + :param address: The address of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this ContactBasedobject. # noqa: E501 + + + :return: The address2 of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this ContactBasedobject. + + + :param address2: The address2 of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def city(self): + """Gets the city of this ContactBasedobject. # noqa: E501 + + + :return: The city of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this ContactBasedobject. + + + :param city: The city of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def country(self): + """Gets the country of this ContactBasedobject. # noqa: E501 + + + :return: The country of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this ContactBasedobject. + + + :param country: The country of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def created_time(self): + """Gets the created_time of this ContactBasedobject. # noqa: E501 + + + :return: The created_time of this ContactBasedobject. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ContactBasedobject. + + + :param created_time: The created_time of this ContactBasedobject. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def email(self): + """Gets the email of this ContactBasedobject. # noqa: E501 + + + :return: The email of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this ContactBasedobject. + + + :param email: The email of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def id(self): + """Gets the id of this ContactBasedobject. # noqa: E501 + + + :return: The id of this ContactBasedobject. # noqa: E501 + :rtype: object + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ContactBasedobject. + + + :param id: The id of this ContactBasedobject. # noqa: E501 + :type: object + """ + + self._id = id + + @property + def name(self): + """Gets the name of this ContactBasedobject. # noqa: E501 + + + :return: The name of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ContactBasedobject. + + + :param name: The name of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def phone(self): + """Gets the phone of this ContactBasedobject. # noqa: E501 + + + :return: The phone of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this ContactBasedobject. + + + :param phone: The phone of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def state(self): + """Gets the state of this ContactBasedobject. # noqa: E501 + + + :return: The state of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ContactBasedobject. + + + :param state: The state of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def zip(self): + """Gets the zip of this ContactBasedobject. # noqa: E501 + + + :return: The zip of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this ContactBasedobject. + + + :param zip: The zip of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._zip = zip + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ContactBasedobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ContactBasedobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/converter.py b/billinglayer/python/tb_rest_client/models/models_pe/converter.py new file mode 100644 index 0000000..6d5cbe2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/converter.py @@ -0,0 +1,362 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Converter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'ConverterId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'type': 'str', + 'debug_mode': 'bool', + 'configuration': 'JsonNode', + 'additional_info': 'JsonNode', + 'edge_template': 'bool', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'type': 'type', + 'debug_mode': 'debugMode', + 'configuration': 'configuration', + 'additional_info': 'additionalInfo', + 'edge_template': 'edgeTemplate', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, name=None, type=None, debug_mode=None, configuration=None, additional_info=None, edge_template=None): # noqa: E501 + """Converter - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._type = None + self._debug_mode = None + self._configuration = None + self._additional_info = None + self._edge_template = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + self.name = name + self.type = type + if debug_mode is not None: + self.debug_mode = debug_mode + if configuration is not None: + self.configuration = configuration + if additional_info is not None: + self.additional_info = additional_info + if edge_template is not None: + self.edge_template = edge_template + + @property + def id(self): + """Gets the id of this Converter. # noqa: E501 + + + :return: The id of this Converter. # noqa: E501 + :rtype: ConverterId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Converter. + + + :param id: The id of this Converter. # noqa: E501 + :type: ConverterId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Converter. # noqa: E501 + + Timestamp of the converter creation, in milliseconds # noqa: E501 + + :return: The created_time of this Converter. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Converter. + + Timestamp of the converter creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Converter. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Converter. # noqa: E501 + + + :return: The tenant_id of this Converter. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Converter. + + + :param tenant_id: The tenant_id of this Converter. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this Converter. # noqa: E501 + + Unique Converter Name in scope of Tenant # noqa: E501 + + :return: The name of this Converter. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Converter. + + Unique Converter Name in scope of Tenant # noqa: E501 + + :param name: The name of this Converter. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Converter. # noqa: E501 + + The type of the converter to process incoming or outgoing messages # noqa: E501 + + :return: The type of this Converter. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Converter. + + The type of the converter to process incoming or outgoing messages # noqa: E501 + + :param type: The type of this Converter. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["DOWNLINK", "UPLINK"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def debug_mode(self): + """Gets the debug_mode of this Converter. # noqa: E501 + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :return: The debug_mode of this Converter. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this Converter. + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :param debug_mode: The debug_mode of this Converter. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def configuration(self): + """Gets the configuration of this Converter. # noqa: E501 + + + :return: The configuration of this Converter. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Converter. + + + :param configuration: The configuration of this Converter. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this Converter. # noqa: E501 + + + :return: The additional_info of this Converter. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Converter. + + + :param additional_info: The additional_info of this Converter. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def edge_template(self): + """Gets the edge_template of this Converter. # noqa: E501 + + Boolean flag that specifies that is regular or edge template converter # noqa: E501 + + :return: The edge_template of this Converter. # noqa: E501 + :rtype: bool + """ + return self._edge_template + + @edge_template.setter + def edge_template(self, edge_template): + """Sets the edge_template of this Converter. + + Boolean flag that specifies that is regular or edge template converter # noqa: E501 + + :param edge_template: The edge_template of this Converter. # noqa: E501 + :type: bool + """ + + self._edge_template = edge_template + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Converter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Converter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/converter_id.py b/billinglayer/python/tb_rest_client/models/models_pe/converter_id.py new file mode 100644 index 0000000..e466395 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/converter_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ConverterId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """ConverterId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this ConverterId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this ConverterId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ConverterId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this ConverterId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this ConverterId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this ConverterId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this ConverterId. + + string # noqa: E501 + + :param entity_type: The entity_type of this ConverterId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["CONVERTER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ConverterId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ConverterId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/custom_menu.py b/billinglayer/python/tb_rest_client/models/models_pe/custom_menu.py new file mode 100644 index 0000000..c1b5efc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/custom_menu.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomMenu(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'disabled_menu_items': 'list[str]', + 'menu_items': 'list[CustomMenuItem]' + } + + attribute_map = { + 'disabled_menu_items': 'disabledMenuItems', + 'menu_items': 'menuItems' + } + + def __init__(self, disabled_menu_items=None, menu_items=None): # noqa: E501 + """CustomMenu - a model defined in Swagger""" # noqa: E501 + self._disabled_menu_items = None + self._menu_items = None + self.discriminator = None + self.disabled_menu_items = disabled_menu_items + self.menu_items = menu_items + + @property + def disabled_menu_items(self): + """Gets the disabled_menu_items of this CustomMenu. # noqa: E501 + + List of disabled regular menu items # noqa: E501 + + :return: The disabled_menu_items of this CustomMenu. # noqa: E501 + :rtype: list[str] + """ + return self._disabled_menu_items + + @disabled_menu_items.setter + def disabled_menu_items(self, disabled_menu_items): + """Sets the disabled_menu_items of this CustomMenu. + + List of disabled regular menu items # noqa: E501 + + :param disabled_menu_items: The disabled_menu_items of this CustomMenu. # noqa: E501 + :type: list[str] + """ + if disabled_menu_items is None: + raise ValueError("Invalid value for `disabled_menu_items`, must not be `None`") # noqa: E501 + + self._disabled_menu_items = disabled_menu_items + + @property + def menu_items(self): + """Gets the menu_items of this CustomMenu. # noqa: E501 + + List of custom menu items # noqa: E501 + + :return: The menu_items of this CustomMenu. # noqa: E501 + :rtype: list[CustomMenuItem] + """ + return self._menu_items + + @menu_items.setter + def menu_items(self, menu_items): + """Sets the menu_items of this CustomMenu. + + List of custom menu items # noqa: E501 + + :param menu_items: The menu_items of this CustomMenu. # noqa: E501 + :type: list[CustomMenuItem] + """ + if menu_items is None: + raise ValueError("Invalid value for `menu_items`, must not be `None`") # noqa: E501 + + self._menu_items = menu_items + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomMenu, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomMenu): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/custom_menu_item.py b/billinglayer/python/tb_rest_client/models/models_pe/custom_menu_item.py new file mode 100644 index 0000000..3858430 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/custom_menu_item.py @@ -0,0 +1,323 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomMenuItem(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'icon_url': 'str', + 'material_icon': 'str', + 'iframe_url': 'str', + 'dashboard_id': 'str', + 'hide_dashboard_toolbar': 'bool', + 'set_access_token': 'bool', + 'child_menu_items': 'list[CustomMenuItem]' + } + + attribute_map = { + 'name': 'name', + 'icon_url': 'iconUrl', + 'material_icon': 'materialIcon', + 'iframe_url': 'iframeUrl', + 'dashboard_id': 'dashboardId', + 'hide_dashboard_toolbar': 'hideDashboardToolbar', + 'set_access_token': 'setAccessToken', + 'child_menu_items': 'childMenuItems' + } + + def __init__(self, name=None, icon_url=None, material_icon=None, iframe_url=None, dashboard_id=None, hide_dashboard_toolbar=None, set_access_token=None, child_menu_items=None): # noqa: E501 + """CustomMenuItem - a model defined in Swagger""" # noqa: E501 + self._name = None + self._icon_url = None + self._material_icon = None + self._iframe_url = None + self._dashboard_id = None + self._hide_dashboard_toolbar = None + self._set_access_token = None + self._child_menu_items = None + self.discriminator = None + self.name = name + if icon_url is not None: + self.icon_url = icon_url + if material_icon is not None: + self.material_icon = material_icon + if iframe_url is not None: + self.iframe_url = iframe_url + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + if set_access_token is not None: + self.set_access_token = set_access_token + if child_menu_items is not None: + self.child_menu_items = child_menu_items + + @property + def name(self): + """Gets the name of this CustomMenuItem. # noqa: E501 + + Name of the menu item # noqa: E501 + + :return: The name of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this CustomMenuItem. + + Name of the menu item # noqa: E501 + + :param name: The name of this CustomMenuItem. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def icon_url(self): + """Gets the icon_url of this CustomMenuItem. # noqa: E501 + + URL of the menu item icon. Overrides 'materialIcon' # noqa: E501 + + :return: The icon_url of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._icon_url + + @icon_url.setter + def icon_url(self, icon_url): + """Sets the icon_url of this CustomMenuItem. + + URL of the menu item icon. Overrides 'materialIcon' # noqa: E501 + + :param icon_url: The icon_url of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._icon_url = icon_url + + @property + def material_icon(self): + """Gets the material_icon of this CustomMenuItem. # noqa: E501 + + Material icon name. See [Material Icons](https://fonts.google.com/icons?selected=Material+Icons) for examples # noqa: E501 + + :return: The material_icon of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._material_icon + + @material_icon.setter + def material_icon(self, material_icon): + """Sets the material_icon of this CustomMenuItem. + + Material icon name. See [Material Icons](https://fonts.google.com/icons?selected=Material+Icons) for examples # noqa: E501 + + :param material_icon: The material_icon of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._material_icon = material_icon + + @property + def iframe_url(self): + """Gets the iframe_url of this CustomMenuItem. # noqa: E501 + + URL to open in the iframe, when user clicks the menu item # noqa: E501 + + :return: The iframe_url of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._iframe_url + + @iframe_url.setter + def iframe_url(self, iframe_url): + """Sets the iframe_url of this CustomMenuItem. + + URL to open in the iframe, when user clicks the menu item # noqa: E501 + + :param iframe_url: The iframe_url of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._iframe_url = iframe_url + + @property + def dashboard_id(self): + """Gets the dashboard_id of this CustomMenuItem. # noqa: E501 + + Id of the Dashboard to open, when user clicks the menu item # noqa: E501 + + :return: The dashboard_id of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this CustomMenuItem. + + Id of the Dashboard to open, when user clicks the menu item # noqa: E501 + + :param dashboard_id: The dashboard_id of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._dashboard_id = dashboard_id + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this CustomMenuItem. # noqa: E501 + + Hide the dashboard toolbar # noqa: E501 + + :return: The hide_dashboard_toolbar of this CustomMenuItem. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this CustomMenuItem. + + Hide the dashboard toolbar # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this CustomMenuItem. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def set_access_token(self): + """Gets the set_access_token of this CustomMenuItem. # noqa: E501 + + Set the access token of the current user to a new dashboard # noqa: E501 + + :return: The set_access_token of this CustomMenuItem. # noqa: E501 + :rtype: bool + """ + return self._set_access_token + + @set_access_token.setter + def set_access_token(self, set_access_token): + """Sets the set_access_token of this CustomMenuItem. + + Set the access token of the current user to a new dashboard # noqa: E501 + + :param set_access_token: The set_access_token of this CustomMenuItem. # noqa: E501 + :type: bool + """ + + self._set_access_token = set_access_token + + @property + def child_menu_items(self): + """Gets the child_menu_items of this CustomMenuItem. # noqa: E501 + + List of child menu items # noqa: E501 + + :return: The child_menu_items of this CustomMenuItem. # noqa: E501 + :rtype: list[CustomMenuItem] + """ + return self._child_menu_items + + @child_menu_items.setter + def child_menu_items(self, child_menu_items): + """Sets the child_menu_items of this CustomMenuItem. + + List of child menu items # noqa: E501 + + :param child_menu_items: The child_menu_items of this CustomMenuItem. # noqa: E501 + :type: list[CustomMenuItem] + """ + + self._child_menu_items = child_menu_items + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomMenuItem, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomMenuItem): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/custom_time_schedule.py b/billinglayer/python/tb_rest_client/models/models_pe/custom_time_schedule.py new file mode 100644 index 0000000..c8cd452 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/custom_time_schedule.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'items': 'list[CustomTimeScheduleItem]', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'items': 'items', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, items=None, timezone=None, type=None): # noqa: E501 + """CustomTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._items = None + self._timezone = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if items is not None: + self.items = items + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this CustomTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this CustomTimeSchedule. + + + :param dynamic_value: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def items(self): + """Gets the items of this CustomTimeSchedule. # noqa: E501 + + + :return: The items of this CustomTimeSchedule. # noqa: E501 + :rtype: list[CustomTimeScheduleItem] + """ + return self._items + + @items.setter + def items(self, items): + """Sets the items of this CustomTimeSchedule. + + + :param items: The items of this CustomTimeSchedule. # noqa: E501 + :type: list[CustomTimeScheduleItem] + """ + + self._items = items + + @property + def timezone(self): + """Gets the timezone of this CustomTimeSchedule. # noqa: E501 + + + :return: The timezone of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this CustomTimeSchedule. + + + :param timezone: The timezone of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this CustomTimeSchedule. # noqa: E501 + + + :return: The type of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this CustomTimeSchedule. + + + :param type: The type of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/custom_time_schedule_item.py b/billinglayer/python/tb_rest_client/models/models_pe/custom_time_schedule_item.py new file mode 100644 index 0000000..4011ddd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/custom_time_schedule_item.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeScheduleItem(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'day_of_week': 'int', + 'enabled': 'bool', + 'ends_on': 'int', + 'starts_on': 'int' + } + + attribute_map = { + 'day_of_week': 'dayOfWeek', + 'enabled': 'enabled', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn' + } + + def __init__(self, day_of_week=None, enabled=None, ends_on=None, starts_on=None): # noqa: E501 + """CustomTimeScheduleItem - a model defined in Swagger""" # noqa: E501 + self._day_of_week = None + self._enabled = None + self._ends_on = None + self._starts_on = None + self.discriminator = None + if day_of_week is not None: + self.day_of_week = day_of_week + if enabled is not None: + self.enabled = enabled + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + + @property + def day_of_week(self): + """Gets the day_of_week of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._day_of_week + + @day_of_week.setter + def day_of_week(self, day_of_week): + """Sets the day_of_week of this CustomTimeScheduleItem. + + + :param day_of_week: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._day_of_week = day_of_week + + @property + def enabled(self): + """Gets the enabled of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this CustomTimeScheduleItem. + + + :param enabled: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def ends_on(self): + """Gets the ends_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this CustomTimeScheduleItem. + + + :param ends_on: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this CustomTimeScheduleItem. + + + :param starts_on: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeScheduleItem, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeScheduleItem): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/custom_translation.py b/billinglayer/python/tb_rest_client/models/models_pe/custom_translation.py new file mode 100644 index 0000000..e979623 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/custom_translation.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTranslation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'translation_map': 'dict(str, str)' + } + + attribute_map = { + 'translation_map': 'translationMap' + } + + def __init__(self, translation_map=None): # noqa: E501 + """CustomTranslation - a model defined in Swagger""" # noqa: E501 + self._translation_map = None + self.discriminator = None + self.translation_map = translation_map + + @property + def translation_map(self): + """Gets the translation_map of this CustomTranslation. # noqa: E501 + + Map of locale IDs to stringified json object with custom translations # noqa: E501 + + :return: The translation_map of this CustomTranslation. # noqa: E501 + :rtype: dict(str, str) + """ + return self._translation_map + + @translation_map.setter + def translation_map(self, translation_map): + """Sets the translation_map of this CustomTranslation. + + Map of locale IDs to stringified json object with custom translations # noqa: E501 + + :param translation_map: The translation_map of this CustomTranslation. # noqa: E501 + :type: dict(str, str) + """ + if translation_map is None: + raise ValueError("Invalid value for `translation_map`, must not be `None`") # noqa: E501 + + self._translation_map = translation_map + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTranslation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTranslation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/customer.py b/billinglayer/python/tb_rest_client/models/models_pe/customer.py new file mode 100644 index 0000000..4492a3c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/customer.py @@ -0,0 +1,567 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Customer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'CustomerId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'tenant_id': 'TenantId', + 'parent_customer_id': 'CustomerId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'tenant_id': 'tenantId', + 'parent_customer_id': 'parentCustomerId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, title=None, external_id=None, name=None, tenant_id=None, parent_customer_id=None, customer_id=None, owner_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None): # noqa: E501 + """Customer - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._tenant_id = None + self._parent_customer_id = None + self._customer_id = None + self._owner_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self._external_id = None + self.external_id = external_id + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + self.tenant_id = tenant_id + if parent_customer_id is not None: + self.parent_customer_id = parent_customer_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def id(self): + """Gets the id of this Customer. # noqa: E501 + + + :return: The id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Customer. + + + :param id: The id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Customer. # noqa: E501 + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :return: The created_time of this Customer. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Customer. + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Customer. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this Customer. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The title of this Customer. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Customer. + + Title of the customer # noqa: E501 + + :param title: The title of this Customer. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this Customer. # noqa: E501 + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this Customer. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Customer. + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this Customer. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this Customer. # noqa: E501 + + + :return: The tenant_id of this Customer. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Customer. + + + :param tenant_id: The tenant_id of this Customer. # noqa: E501 + :type: TenantId + """ + # if tenant_id is None: + # raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def parent_customer_id(self): + """Gets the parent_customer_id of this Customer. # noqa: E501 + + + :return: The parent_customer_id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._parent_customer_id + + @parent_customer_id.setter + def parent_customer_id(self, parent_customer_id): + """Sets the parent_customer_id of this Customer. + + + :param parent_customer_id: The parent_customer_id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._parent_customer_id = parent_customer_id + + @property + def customer_id(self): + """Gets the customer_id of this Customer. # noqa: E501 + + + :return: The customer_id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Customer. + + + :param customer_id: The customer_id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Customer. # noqa: E501 + + + :return: The owner_id of this Customer. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Customer. + + + :param owner_id: The owner_id of this Customer. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def country(self): + """Gets the country of this Customer. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this Customer. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this Customer. + + Country # noqa: E501 + + :param country: The country of this Customer. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this Customer. # noqa: E501 + + State # noqa: E501 + + :return: The state of this Customer. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Customer. + + State # noqa: E501 + + :param state: The state of this Customer. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this Customer. # noqa: E501 + + City # noqa: E501 + + :return: The city of this Customer. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this Customer. + + City # noqa: E501 + + :param city: The city of this Customer. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this Customer. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this Customer. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this Customer. + + Address Line 1 # noqa: E501 + + :param address: The address of this Customer. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this Customer. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this Customer. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this Customer. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this Customer. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this Customer. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this Customer. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this Customer. + + Zip code # noqa: E501 + + :param zip: The zip of this Customer. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this Customer. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this Customer. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this Customer. + + Phone number # noqa: E501 + + :param phone: The phone of this Customer. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this Customer. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this Customer. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Customer. + + Email # noqa: E501 + + :param email: The email of this Customer. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this Customer. # noqa: E501 + + + :return: The additional_info of this Customer. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Customer. + + + :param additional_info: The additional_info of this Customer. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Customer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Customer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/customer_id.py b/billinglayer/python/tb_rest_client/models/models_pe/customer_id.py new file mode 100644 index 0000000..5fe6246 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/customer_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """CustomerId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this CustomerId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CustomerId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this CustomerId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this CustomerId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this CustomerId. + + string # noqa: E501 + + :param entity_type: The entity_type of this CustomerId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/customer_info.py b/billinglayer/python/tb_rest_client/models/models_pe/customer_info.py new file mode 100644 index 0000000..9ece70e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/customer_info.py @@ -0,0 +1,611 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'CustomerId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'tenant_id': 'TenantId', + 'parent_customer_id': 'CustomerId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'tenant_id': 'tenantId', + 'parent_customer_id': 'parentCustomerId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, tenant_id=None, parent_customer_id=None, customer_id=None, owner_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None, owner_name=None, groups=None): # noqa: E501 + """CustomerInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._tenant_id = None + self._parent_customer_id = None + self._customer_id = None + self._owner_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self._owner_name = None + self._groups = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + self.tenant_id = tenant_id + if parent_customer_id is not None: + self.parent_customer_id = parent_customer_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this CustomerInfo. # noqa: E501 + + + :return: The id of this CustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CustomerInfo. + + + :param id: The id of this CustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this CustomerInfo. # noqa: E501 + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :return: The created_time of this CustomerInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this CustomerInfo. + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this CustomerInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this CustomerInfo. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The title of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this CustomerInfo. + + Title of the customer # noqa: E501 + + :param title: The title of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this CustomerInfo. # noqa: E501 + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this CustomerInfo. + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this CustomerInfo. # noqa: E501 + + + :return: The tenant_id of this CustomerInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this CustomerInfo. + + + :param tenant_id: The tenant_id of this CustomerInfo. # noqa: E501 + :type: TenantId + """ + if tenant_id is None: + raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def parent_customer_id(self): + """Gets the parent_customer_id of this CustomerInfo. # noqa: E501 + + + :return: The parent_customer_id of this CustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._parent_customer_id + + @parent_customer_id.setter + def parent_customer_id(self, parent_customer_id): + """Sets the parent_customer_id of this CustomerInfo. + + + :param parent_customer_id: The parent_customer_id of this CustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._parent_customer_id = parent_customer_id + + @property + def customer_id(self): + """Gets the customer_id of this CustomerInfo. # noqa: E501 + + + :return: The customer_id of this CustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this CustomerInfo. + + + :param customer_id: The customer_id of this CustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this CustomerInfo. # noqa: E501 + + + :return: The owner_id of this CustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this CustomerInfo. + + + :param owner_id: The owner_id of this CustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def country(self): + """Gets the country of this CustomerInfo. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this CustomerInfo. + + Country # noqa: E501 + + :param country: The country of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this CustomerInfo. # noqa: E501 + + State # noqa: E501 + + :return: The state of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this CustomerInfo. + + State # noqa: E501 + + :param state: The state of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this CustomerInfo. # noqa: E501 + + City # noqa: E501 + + :return: The city of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this CustomerInfo. + + City # noqa: E501 + + :param city: The city of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this CustomerInfo. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this CustomerInfo. + + Address Line 1 # noqa: E501 + + :param address: The address of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this CustomerInfo. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this CustomerInfo. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this CustomerInfo. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this CustomerInfo. + + Zip code # noqa: E501 + + :param zip: The zip of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this CustomerInfo. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this CustomerInfo. + + Phone number # noqa: E501 + + :param phone: The phone of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this CustomerInfo. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this CustomerInfo. + + Email # noqa: E501 + + :param email: The email of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this CustomerInfo. # noqa: E501 + + + :return: The additional_info of this CustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this CustomerInfo. + + + :param additional_info: The additional_info of this CustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_name(self): + """Gets the owner_name of this CustomerInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this CustomerInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this CustomerInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this CustomerInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this CustomerInfo. + + Groups # noqa: E501 + + :param groups: The groups of this CustomerInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/customer_users_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/customer_users_filter.py new file mode 100644 index 0000000..86267b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/customer_users_filter.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class CustomerUsersFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'str' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'customer_id': 'customerId' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, customer_id=None, *args, **kwargs): # noqa: E501 + """CustomerUsersFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + self.customer_id = customer_id + UsersFilter.__init__(self, *args, **kwargs) + + @property + def customer_id(self): + """Gets the customer_id of this CustomerUsersFilter. # noqa: E501 + + + :return: The customer_id of this CustomerUsersFilter. # noqa: E501 + :rtype: str + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this CustomerUsersFilter. + + + :param customer_id: The customer_id of this CustomerUsersFilter. # noqa: E501 + :type: str + """ + if customer_id is None: + raise ValueError("Invalid value for `customer_id`, must not be `None`") # noqa: E501 + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dashboard.py b/billinglayer/python/tb_rest_client/models/models_pe/dashboard.py new file mode 100644 index 0000000..56192fb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dashboard.py @@ -0,0 +1,436 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Dashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'title': 'str', + 'image': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'name': 'str', + 'configuration': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'title': 'title', + 'image': 'image', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'name': 'name', + 'configuration': 'configuration', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, title=None, image=None, assigned_customers=None, mobile_hide=None, mobile_order=None, name=None, configuration=None): # noqa: E501 + """Dashboard - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._title = None + self._image = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._name = None + self._configuration = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if title is not None: + self.title = title + if image is not None: + self.image = image + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if name is not None: + self.name = name + if configuration is not None: + self.configuration = configuration + + @property + def id(self): + """Gets the id of this Dashboard. # noqa: E501 + + + :return: The id of this Dashboard. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Dashboard. + + + :param id: The id of this Dashboard. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Dashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Dashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Dashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Dashboard. # noqa: E501 + + + :return: The tenant_id of this Dashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Dashboard. + + + :param tenant_id: The tenant_id of this Dashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Dashboard. # noqa: E501 + + + :return: The customer_id of this Dashboard. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Dashboard. + + + :param customer_id: The customer_id of this Dashboard. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Dashboard. # noqa: E501 + + + :return: The owner_id of this Dashboard. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Dashboard. + + + :param owner_id: The owner_id of this Dashboard. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def title(self): + """Gets the title of this Dashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Dashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this Dashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this Dashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this Dashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this Dashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def assigned_customers(self): + """Gets the assigned_customers of this Dashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this Dashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this Dashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this Dashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this Dashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this Dashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this Dashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this Dashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this Dashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this Dashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this Dashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def name(self): + """Gets the name of this Dashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Dashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this Dashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def configuration(self): + """Gets the configuration of this Dashboard. # noqa: E501 + + + :return: The configuration of this Dashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Dashboard. + + + :param configuration: The configuration of this Dashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Dashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Dashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dashboard_id.py b/billinglayer/python/tb_rest_client/models/models_pe/dashboard_id.py new file mode 100644 index 0000000..d797776 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dashboard_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DashboardId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DashboardId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DashboardId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DashboardId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DashboardId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DashboardId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DASHBOARD"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_pe/dashboard_info.py new file mode 100644 index 0000000..9470c88 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dashboard_info.py @@ -0,0 +1,492 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'title': 'str', + 'image': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'name': 'str', + 'configuration': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'title': 'title', + 'image': 'image', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'name': 'name', + 'configuration': 'configuration', + 'owner_name': 'ownerName', + 'groups': 'groups', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, title=None, image=None, assigned_customers=None, mobile_hide=None, mobile_order=None, name=None, configuration=None, owner_name=None, groups=None): # noqa: E501 + """DashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._title = None + self._image = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._name = None + self._configuration = None + self._owner_name = None + self._groups = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if title is not None: + self.title = title + if image is not None: + self.image = image + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if name is not None: + self.name = name + if configuration is not None: + self.configuration = configuration + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this DashboardInfo. # noqa: E501 + + + :return: The id of this DashboardInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardInfo. + + + :param id: The id of this DashboardInfo. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this DashboardInfo. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DashboardInfo. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DashboardInfo. # noqa: E501 + + + :return: The tenant_id of this DashboardInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DashboardInfo. + + + :param tenant_id: The tenant_id of this DashboardInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this DashboardInfo. # noqa: E501 + + + :return: The customer_id of this DashboardInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this DashboardInfo. + + + :param customer_id: The customer_id of this DashboardInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this DashboardInfo. # noqa: E501 + + + :return: The owner_id of this DashboardInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this DashboardInfo. + + + :param owner_id: The owner_id of this DashboardInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def title(self): + """Gets the title of this DashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this DashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this DashboardInfo. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DashboardInfo. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def assigned_customers(self): + """Gets the assigned_customers of this DashboardInfo. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this DashboardInfo. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this DashboardInfo. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this DashboardInfo. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this DashboardInfo. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this DashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this DashboardInfo. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this DashboardInfo. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this DashboardInfo. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this DashboardInfo. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def name(self): + """Gets the name of this DashboardInfo. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DashboardInfo. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def configuration(self): + """Gets the configuration of this DashboardInfo. # noqa: E501 + + + :return: The configuration of this DashboardInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DashboardInfo. + + + :param configuration: The configuration of this DashboardInfo. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def owner_name(self): + """Gets the owner_name of this DashboardInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this DashboardInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this DashboardInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this DashboardInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this DashboardInfo. + + Groups # noqa: E501 + + :param groups: The groups of this DashboardInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/debug_converter_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/debug_converter_event_filter.py new file mode 100644 index 0000000..2f15669 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/debug_converter_event_filter.py @@ -0,0 +1,351 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class DebugConverterEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + '_in': 'str', + 'metadata': 'str', + 'not_empty': 'bool', + 'out': 'str', + 'type': 'str', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + '_in': 'in', + 'metadata': 'metadata', + 'not_empty': 'notEmpty', + 'out': 'out', + 'type': 'type', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, _in=None, metadata=None, not_empty=None, out=None, type=None, event_type=None, server=None, error_str=None, *args, **kwargs): # noqa: E501 + """DebugConverterEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self.__in = None + self._metadata = None + self._not_empty = None + self._out = None + self._type = None + self._event_type = None + self._server = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if _in is not None: + self._in = _in + if metadata is not None: + self.metadata = metadata + if not_empty is not None: + self.not_empty = not_empty + if out is not None: + self.out = out + if type is not None: + self.type = type + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugConverterEventFilter. # noqa: E501 + + + :return: The error of this DebugConverterEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugConverterEventFilter. + + + :param error: The error of this DebugConverterEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def _in(self): + """Gets the _in of this DebugConverterEventFilter. # noqa: E501 + + + :return: The _in of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self.__in + + @_in.setter + def _in(self, _in): + """Sets the _in of this DebugConverterEventFilter. + + + :param _in: The _in of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self.__in = _in + + @property + def metadata(self): + """Gets the metadata of this DebugConverterEventFilter. # noqa: E501 + + + :return: The metadata of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this DebugConverterEventFilter. + + + :param metadata: The metadata of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._metadata = metadata + + @property + def not_empty(self): + """Gets the not_empty of this DebugConverterEventFilter. # noqa: E501 + + + :return: The not_empty of this DebugConverterEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this DebugConverterEventFilter. + + + :param not_empty: The not_empty of this DebugConverterEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def out(self): + """Gets the out of this DebugConverterEventFilter. # noqa: E501 + + + :return: The out of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._out + + @out.setter + def out(self, out): + """Sets the out of this DebugConverterEventFilter. + + + :param out: The out of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._out = out + + @property + def type(self): + """Gets the type of this DebugConverterEventFilter. # noqa: E501 + + + :return: The type of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DebugConverterEventFilter. + + + :param type: The type of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def event_type(self): + """Gets the event_type of this DebugConverterEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugConverterEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugConverterEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugConverterEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugConverterEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugConverterEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugConverterEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugConverterEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/debug_integration_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/debug_integration_event_filter.py new file mode 100644 index 0000000..ff0a09e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/debug_integration_event_filter.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class DebugIntegrationEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'message': 'str', + 'not_empty': 'bool', + 'status_integration': 'str', + 'type': 'str', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'message': 'message', + 'not_empty': 'notEmpty', + 'status_integration': 'statusIntegration', + 'type': 'type', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, message=None, not_empty=None, status_integration=None, type=None, event_type=None, server=None, error_str=None, *args, **kwargs): # noqa: E501 + """DebugIntegrationEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._message = None + self._not_empty = None + self._status_integration = None + self._type = None + self._event_type = None + self._server = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if message is not None: + self.message = message + if not_empty is not None: + self.not_empty = not_empty + if status_integration is not None: + self.status_integration = status_integration + if type is not None: + self.type = type + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The error of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugIntegrationEventFilter. + + + :param error: The error of this DebugIntegrationEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def message(self): + """Gets the message of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The message of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this DebugIntegrationEventFilter. + + + :param message: The message of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def not_empty(self): + """Gets the not_empty of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The not_empty of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this DebugIntegrationEventFilter. + + + :param not_empty: The not_empty of this DebugIntegrationEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def status_integration(self): + """Gets the status_integration of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The status_integration of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._status_integration + + @status_integration.setter + def status_integration(self, status_integration): + """Sets the status_integration of this DebugIntegrationEventFilter. + + + :param status_integration: The status_integration of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._status_integration = status_integration + + @property + def type(self): + """Gets the type of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The type of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DebugIntegrationEventFilter. + + + :param type: The type of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def event_type(self): + """Gets the event_type of this DebugIntegrationEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugIntegrationEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugIntegrationEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugIntegrationEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugIntegrationEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugIntegrationEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugIntegrationEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugIntegrationEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/debug_rule_chain_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/debug_rule_chain_event_filter.py new file mode 100644 index 0000000..3564e44 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/debug_rule_chain_event_filter.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .event_filter import EventFilter # noqa: F401,E501 + +class DebugRuleChainEventFilter(EventFilter): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str', + 'msg_direction_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'entity_name': 'str', + 'relation_type': 'str', + 'entity_id': 'str', + 'msg_type': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr', + 'msg_direction_type': 'msgDirectionType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'entity_name': 'entityName', + 'relation_type': 'relationType', + 'entity_id': 'entityId', + 'msg_type': 'msgType' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, event_type=None, server=None, error_str=None, msg_direction_type=None, data_search=None, metadata_search=None, entity_name=None, relation_type=None, entity_id=None, msg_type=None, *args, **kwargs): # noqa: E501 + """DebugRuleChainEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._event_type = None + self._server = None + self._error_str = None + self._msg_direction_type = None + self._data_search = None + self._metadata_search = None + self._entity_name = None + self._relation_type = None + self._entity_id = None + self._msg_type = None + self.discriminator = None + if error is not None: + self.error = error + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if entity_name is not None: + self.entity_name = entity_name + if relation_type is not None: + self.relation_type = relation_type + if entity_id is not None: + self.entity_id = entity_id + if msg_type is not None: + self.msg_type = msg_type + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugRuleChainEventFilter. # noqa: E501 + + + :return: The error of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugRuleChainEventFilter. + + + :param error: The error of this DebugRuleChainEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def event_type(self): + """Gets the event_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugRuleChainEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugRuleChainEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this DebugRuleChainEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def data_search(self): + """Gets the data_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def entity_name(self): + """Gets the entity_name of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this DebugRuleChainEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_name: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_name not in allowed_values: + raise ValueError( + "Invalid value for `entity_name` ({0}), must be one of {1}" # noqa: E501 + .format(entity_name, allowed_values) + ) + + self._entity_name = entity_name + + @property + def relation_type(self): + """Gets the relation_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DebugRuleChainEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_id(self): + """Gets the entity_id of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this DebugRuleChainEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def msg_type(self): + """Gets the msg_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this DebugRuleChainEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugRuleChainEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugRuleChainEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/debug_rule_node_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/debug_rule_node_event_filter.py new file mode 100644 index 0000000..8afc612 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/debug_rule_node_event_filter.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .event_filter import EventFilter # noqa: F401,E501 + +class DebugRuleNodeEventFilter(EventFilter): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str', + 'msg_direction_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'entity_name': 'str', + 'relation_type': 'str', + 'entity_id': 'str', + 'msg_type': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr', + 'msg_direction_type': 'msgDirectionType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'entity_name': 'entityName', + 'relation_type': 'relationType', + 'entity_id': 'entityId', + 'msg_type': 'msgType' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, event_type=None, server=None, error_str=None, msg_direction_type=None, data_search=None, metadata_search=None, entity_name=None, relation_type=None, entity_id=None, msg_type=None, *args, **kwargs): # noqa: E501 + """DebugRuleNodeEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._event_type = None + self._server = None + self._error_str = None + self._msg_direction_type = None + self._data_search = None + self._metadata_search = None + self._entity_name = None + self._relation_type = None + self._entity_id = None + self._msg_type = None + self.discriminator = None + if error is not None: + self.error = error + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if entity_name is not None: + self.entity_name = entity_name + if relation_type is not None: + self.relation_type = relation_type + if entity_id is not None: + self.entity_id = entity_id + if msg_type is not None: + self.msg_type = msg_type + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugRuleNodeEventFilter. # noqa: E501 + + + :return: The error of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugRuleNodeEventFilter. + + + :param error: The error of this DebugRuleNodeEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def event_type(self): + """Gets the event_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugRuleNodeEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugRuleNodeEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugRuleNodeEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugRuleNodeEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this DebugRuleNodeEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def data_search(self): + """Gets the data_search of this DebugRuleNodeEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this DebugRuleNodeEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this DebugRuleNodeEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this DebugRuleNodeEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def entity_name(self): + """Gets the entity_name of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_name of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this DebugRuleNodeEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_name: The entity_name of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_name not in allowed_values: + raise ValueError( + "Invalid value for `entity_name` ({0}), must be one of {1}" # noqa: E501 + .format(entity_name, allowed_values) + ) + + self._entity_name = entity_name + + @property + def relation_type(self): + """Gets the relation_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DebugRuleNodeEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_id(self): + """Gets the entity_id of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this DebugRuleNodeEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def msg_type(self): + """Gets the msg_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this DebugRuleNodeEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugRuleNodeEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugRuleNodeEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/default_coap_device_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/default_coap_device_type_configuration.py new file mode 100644 index 0000000..1a894f5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/default_coap_device_type_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.coap_device_type_configuration import CoapDeviceTypeConfiguration # noqa: F401,E501 + +class DefaultCoapDeviceTypeConfiguration(CoapDeviceTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "swagger_types"): + swagger_types.update(CoapDeviceTypeConfiguration.swagger_types) + + attribute_map = { + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "attribute_map"): + attribute_map.update(CoapDeviceTypeConfiguration.attribute_map) + + def __init__(self, transport_payload_type_configuration=None, *args, **kwargs): # noqa: E501 + """DefaultCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self._transport_payload_type_configuration = None + self.discriminator = None + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + CoapDeviceTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/default_device_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/default_device_configuration.py new file mode 100644 index 0000000..dc2ea7f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/default_device_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_configuration import DeviceConfiguration # noqa: F401,E501 + +class DefaultDeviceConfiguration(DeviceConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceConfiguration, "swagger_types"): + swagger_types.update(DeviceConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceConfiguration, "attribute_map"): + attribute_map.update(DeviceConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/default_device_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/default_device_profile_configuration.py new file mode 100644 index 0000000..c172a4d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/default_device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/default_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/default_device_profile_transport_configuration.py new file mode 100644 index 0000000..254ad36 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/default_device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/default_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/default_device_transport_configuration.py new file mode 100644 index 0000000..d54447a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/default_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class DefaultDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/default_rule_chain_create_request.py b/billinglayer/python/tb_rest_client/models/models_pe/default_rule_chain_create_request.py new file mode 100644 index 0000000..e5114c7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/default_rule_chain_create_request.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultRuleChainCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str' + } + + attribute_map = { + 'name': 'name' + } + + def __init__(self, name=None): # noqa: E501 + """DefaultRuleChainCreateRequest - a model defined in Swagger""" # noqa: E501 + self._name = None + self.discriminator = None + self.name = name + + @property + def name(self): + """Gets the name of this DefaultRuleChainCreateRequest. # noqa: E501 + + Name of the new rule chain # noqa: E501 + + :return: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DefaultRuleChainCreateRequest. + + Name of the new rule chain # noqa: E501 + + :param name: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultRuleChainCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultRuleChainCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/default_tenant_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/default_tenant_profile_configuration.py new file mode 100644 index 0000000..f0892f0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/default_tenant_profile_configuration.py @@ -0,0 +1,1320 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultTenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms_ttl_days': 'int', + 'cassandra_query_tenant_rate_limits_configuration': 'str', + 'customer_server_rest_limits_configuration': 'str', + 'default_storage_ttl_days': 'int', + 'max_assets': 'int', + 'max_converters': 'int', + 'max_created_alarms': 'int', + 'max_customers': 'int', + 'max_dp_storage_days': 'int', + 'max_dashboards': 'int', + 'max_devices': 'int', + 'max_emails': 'int', + 'max_integrations': 'int', + 'max_js_executions': 'int', + 'max_ota_packages_in_bytes': 'int', + 'max_re_executions': 'int', + 'max_resources_in_bytes': 'int', + 'max_rule_chains': 'int', + 'max_rule_node_executions_per_message': 'int', + 'max_scheduler_events': 'int', + 'max_sms': 'int', + 'max_transport_data_points': 'int', + 'max_transport_messages': 'int', + 'max_users': 'int', + 'max_ws_sessions_per_customer': 'int', + 'max_ws_sessions_per_public_user': 'int', + 'max_ws_sessions_per_regular_user': 'int', + 'max_ws_sessions_per_tenant': 'int', + 'max_ws_subscriptions_per_customer': 'int', + 'max_ws_subscriptions_per_public_user': 'int', + 'max_ws_subscriptions_per_regular_user': 'int', + 'max_ws_subscriptions_per_tenant': 'int', + 'rpc_ttl_days': 'int', + 'tenant_entity_export_rate_limit': 'str', + 'tenant_entity_import_rate_limit': 'str', + 'tenant_notification_requests_per_rule_rate_limit': 'str', + 'tenant_notification_requests_rate_limit': 'str', + 'tenant_server_rest_limits_configuration': 'str', + 'transport_device_msg_rate_limit': 'str', + 'transport_device_telemetry_data_points_rate_limit': 'str', + 'transport_device_telemetry_msg_rate_limit': 'str', + 'transport_tenant_msg_rate_limit': 'str', + 'transport_tenant_telemetry_data_points_rate_limit': 'str', + 'transport_tenant_telemetry_msg_rate_limit': 'str', + 'warn_threshold': 'float', + 'ws_msg_queue_limit_per_session': 'int', + 'ws_updates_per_session_rate_limit': 'str' + } + + attribute_map = { + 'alarms_ttl_days': 'alarmsTtlDays', + 'cassandra_query_tenant_rate_limits_configuration': 'cassandraQueryTenantRateLimitsConfiguration', + 'customer_server_rest_limits_configuration': 'customerServerRestLimitsConfiguration', + 'default_storage_ttl_days': 'defaultStorageTtlDays', + 'max_assets': 'maxAssets', + 'max_converters': 'maxConverters', + 'max_created_alarms': 'maxCreatedAlarms', + 'max_customers': 'maxCustomers', + 'max_dp_storage_days': 'maxDPStorageDays', + 'max_dashboards': 'maxDashboards', + 'max_devices': 'maxDevices', + 'max_emails': 'maxEmails', + 'max_integrations': 'maxIntegrations', + 'max_js_executions': 'maxJSExecutions', + 'max_ota_packages_in_bytes': 'maxOtaPackagesInBytes', + 'max_re_executions': 'maxREExecutions', + 'max_resources_in_bytes': 'maxResourcesInBytes', + 'max_rule_chains': 'maxRuleChains', + 'max_rule_node_executions_per_message': 'maxRuleNodeExecutionsPerMessage', + 'max_scheduler_events': 'maxSchedulerEvents', + 'max_sms': 'maxSms', + 'max_transport_data_points': 'maxTransportDataPoints', + 'max_transport_messages': 'maxTransportMessages', + 'max_users': 'maxUsers', + 'max_ws_sessions_per_customer': 'maxWsSessionsPerCustomer', + 'max_ws_sessions_per_public_user': 'maxWsSessionsPerPublicUser', + 'max_ws_sessions_per_regular_user': 'maxWsSessionsPerRegularUser', + 'max_ws_sessions_per_tenant': 'maxWsSessionsPerTenant', + 'max_ws_subscriptions_per_customer': 'maxWsSubscriptionsPerCustomer', + 'max_ws_subscriptions_per_public_user': 'maxWsSubscriptionsPerPublicUser', + 'max_ws_subscriptions_per_regular_user': 'maxWsSubscriptionsPerRegularUser', + 'max_ws_subscriptions_per_tenant': 'maxWsSubscriptionsPerTenant', + 'rpc_ttl_days': 'rpcTtlDays', + 'tenant_entity_export_rate_limit': 'tenantEntityExportRateLimit', + 'tenant_entity_import_rate_limit': 'tenantEntityImportRateLimit', + 'tenant_notification_requests_per_rule_rate_limit': 'tenantNotificationRequestsPerRuleRateLimit', + 'tenant_notification_requests_rate_limit': 'tenantNotificationRequestsRateLimit', + 'tenant_server_rest_limits_configuration': 'tenantServerRestLimitsConfiguration', + 'transport_device_msg_rate_limit': 'transportDeviceMsgRateLimit', + 'transport_device_telemetry_data_points_rate_limit': 'transportDeviceTelemetryDataPointsRateLimit', + 'transport_device_telemetry_msg_rate_limit': 'transportDeviceTelemetryMsgRateLimit', + 'transport_tenant_msg_rate_limit': 'transportTenantMsgRateLimit', + 'transport_tenant_telemetry_data_points_rate_limit': 'transportTenantTelemetryDataPointsRateLimit', + 'transport_tenant_telemetry_msg_rate_limit': 'transportTenantTelemetryMsgRateLimit', + 'warn_threshold': 'warnThreshold', + 'ws_msg_queue_limit_per_session': 'wsMsgQueueLimitPerSession', + 'ws_updates_per_session_rate_limit': 'wsUpdatesPerSessionRateLimit' + } + + def __init__(self, alarms_ttl_days=None, cassandra_query_tenant_rate_limits_configuration=None, customer_server_rest_limits_configuration=None, default_storage_ttl_days=None, max_assets=None, max_converters=None, max_created_alarms=None, max_customers=None, max_dp_storage_days=None, max_dashboards=None, max_devices=None, max_emails=None, max_integrations=None, max_js_executions=None, max_ota_packages_in_bytes=None, max_re_executions=None, max_resources_in_bytes=None, max_rule_chains=None, max_rule_node_executions_per_message=None, max_scheduler_events=None, max_sms=None, max_transport_data_points=None, max_transport_messages=None, max_users=None, max_ws_sessions_per_customer=None, max_ws_sessions_per_public_user=None, max_ws_sessions_per_regular_user=None, max_ws_sessions_per_tenant=None, max_ws_subscriptions_per_customer=None, max_ws_subscriptions_per_public_user=None, max_ws_subscriptions_per_regular_user=None, max_ws_subscriptions_per_tenant=None, rpc_ttl_days=None, tenant_entity_export_rate_limit=None, tenant_entity_import_rate_limit=None, tenant_notification_requests_per_rule_rate_limit=None, tenant_notification_requests_rate_limit=None, tenant_server_rest_limits_configuration=None, transport_device_msg_rate_limit=None, transport_device_telemetry_data_points_rate_limit=None, transport_device_telemetry_msg_rate_limit=None, transport_tenant_msg_rate_limit=None, transport_tenant_telemetry_data_points_rate_limit=None, transport_tenant_telemetry_msg_rate_limit=None, warn_threshold=None, ws_msg_queue_limit_per_session=None, ws_updates_per_session_rate_limit=None): # noqa: E501 + """DefaultTenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self._alarms_ttl_days = None + self._cassandra_query_tenant_rate_limits_configuration = None + self._customer_server_rest_limits_configuration = None + self._default_storage_ttl_days = None + self._max_assets = None + self._max_converters = None + self._max_created_alarms = None + self._max_customers = None + self._max_dp_storage_days = None + self._max_dashboards = None + self._max_devices = None + self._max_emails = None + self._max_integrations = None + self._max_js_executions = None + self._max_ota_packages_in_bytes = None + self._max_re_executions = None + self._max_resources_in_bytes = None + self._max_rule_chains = None + self._max_rule_node_executions_per_message = None + self._max_scheduler_events = None + self._max_sms = None + self._max_transport_data_points = None + self._max_transport_messages = None + self._max_users = None + self._max_ws_sessions_per_customer = None + self._max_ws_sessions_per_public_user = None + self._max_ws_sessions_per_regular_user = None + self._max_ws_sessions_per_tenant = None + self._max_ws_subscriptions_per_customer = None + self._max_ws_subscriptions_per_public_user = None + self._max_ws_subscriptions_per_regular_user = None + self._max_ws_subscriptions_per_tenant = None + self._rpc_ttl_days = None + self._tenant_entity_export_rate_limit = None + self._tenant_entity_import_rate_limit = None + self._tenant_notification_requests_per_rule_rate_limit = None + self._tenant_notification_requests_rate_limit = None + self._tenant_server_rest_limits_configuration = None + self._transport_device_msg_rate_limit = None + self._transport_device_telemetry_data_points_rate_limit = None + self._transport_device_telemetry_msg_rate_limit = None + self._transport_tenant_msg_rate_limit = None + self._transport_tenant_telemetry_data_points_rate_limit = None + self._transport_tenant_telemetry_msg_rate_limit = None + self._warn_threshold = None + self._ws_msg_queue_limit_per_session = None + self._ws_updates_per_session_rate_limit = None + self.discriminator = None + if alarms_ttl_days is not None: + self.alarms_ttl_days = alarms_ttl_days + if cassandra_query_tenant_rate_limits_configuration is not None: + self.cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + if customer_server_rest_limits_configuration is not None: + self.customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + if default_storage_ttl_days is not None: + self.default_storage_ttl_days = default_storage_ttl_days + if max_assets is not None: + self.max_assets = max_assets + if max_converters is not None: + self.max_converters = max_converters + if max_created_alarms is not None: + self.max_created_alarms = max_created_alarms + if max_customers is not None: + self.max_customers = max_customers + if max_dp_storage_days is not None: + self.max_dp_storage_days = max_dp_storage_days + if max_dashboards is not None: + self.max_dashboards = max_dashboards + if max_devices is not None: + self.max_devices = max_devices + if max_emails is not None: + self.max_emails = max_emails + if max_integrations is not None: + self.max_integrations = max_integrations + if max_js_executions is not None: + self.max_js_executions = max_js_executions + if max_ota_packages_in_bytes is not None: + self.max_ota_packages_in_bytes = max_ota_packages_in_bytes + if max_re_executions is not None: + self.max_re_executions = max_re_executions + if max_resources_in_bytes is not None: + self.max_resources_in_bytes = max_resources_in_bytes + if max_rule_chains is not None: + self.max_rule_chains = max_rule_chains + if max_rule_node_executions_per_message is not None: + self.max_rule_node_executions_per_message = max_rule_node_executions_per_message + if max_scheduler_events is not None: + self.max_scheduler_events = max_scheduler_events + if max_sms is not None: + self.max_sms = max_sms + if max_transport_data_points is not None: + self.max_transport_data_points = max_transport_data_points + if max_transport_messages is not None: + self.max_transport_messages = max_transport_messages + if max_users is not None: + self.max_users = max_users + if max_ws_sessions_per_customer is not None: + self.max_ws_sessions_per_customer = max_ws_sessions_per_customer + if max_ws_sessions_per_public_user is not None: + self.max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + if max_ws_sessions_per_regular_user is not None: + self.max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + if max_ws_sessions_per_tenant is not None: + self.max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + if max_ws_subscriptions_per_customer is not None: + self.max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + if max_ws_subscriptions_per_public_user is not None: + self.max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + if max_ws_subscriptions_per_regular_user is not None: + self.max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + if max_ws_subscriptions_per_tenant is not None: + self.max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + if rpc_ttl_days is not None: + self.rpc_ttl_days = rpc_ttl_days + if tenant_entity_export_rate_limit is not None: + self.tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + if tenant_entity_import_rate_limit is not None: + self.tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + if tenant_notification_requests_per_rule_rate_limit is not None: + self.tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + if tenant_notification_requests_rate_limit is not None: + self.tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + if tenant_server_rest_limits_configuration is not None: + self.tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + if transport_device_msg_rate_limit is not None: + self.transport_device_msg_rate_limit = transport_device_msg_rate_limit + if transport_device_telemetry_data_points_rate_limit is not None: + self.transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + if transport_device_telemetry_msg_rate_limit is not None: + self.transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + if transport_tenant_msg_rate_limit is not None: + self.transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + if transport_tenant_telemetry_data_points_rate_limit is not None: + self.transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + if transport_tenant_telemetry_msg_rate_limit is not None: + self.transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + if warn_threshold is not None: + self.warn_threshold = warn_threshold + if ws_msg_queue_limit_per_session is not None: + self.ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + if ws_updates_per_session_rate_limit is not None: + self.ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + @property + def alarms_ttl_days(self): + """Gets the alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._alarms_ttl_days + + @alarms_ttl_days.setter + def alarms_ttl_days(self, alarms_ttl_days): + """Sets the alarms_ttl_days of this DefaultTenantProfileConfiguration. + + + :param alarms_ttl_days: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._alarms_ttl_days = alarms_ttl_days + + @property + def cassandra_query_tenant_rate_limits_configuration(self): + """Gets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._cassandra_query_tenant_rate_limits_configuration + + @cassandra_query_tenant_rate_limits_configuration.setter + def cassandra_query_tenant_rate_limits_configuration(self, cassandra_query_tenant_rate_limits_configuration): + """Sets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param cassandra_query_tenant_rate_limits_configuration: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + + @property + def customer_server_rest_limits_configuration(self): + """Gets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._customer_server_rest_limits_configuration + + @customer_server_rest_limits_configuration.setter + def customer_server_rest_limits_configuration(self, customer_server_rest_limits_configuration): + """Sets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param customer_server_rest_limits_configuration: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + + @property + def default_storage_ttl_days(self): + """Gets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._default_storage_ttl_days + + @default_storage_ttl_days.setter + def default_storage_ttl_days(self, default_storage_ttl_days): + """Sets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. + + + :param default_storage_ttl_days: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._default_storage_ttl_days = default_storage_ttl_days + + @property + def max_assets(self): + """Gets the max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this DefaultTenantProfileConfiguration. + + + :param max_assets: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_converters(self): + """Gets the max_converters of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_converters of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_converters + + @max_converters.setter + def max_converters(self, max_converters): + """Sets the max_converters of this DefaultTenantProfileConfiguration. + + + :param max_converters: The max_converters of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_converters = max_converters + + @property + def max_created_alarms(self): + """Gets the max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_created_alarms + + @max_created_alarms.setter + def max_created_alarms(self, max_created_alarms): + """Sets the max_created_alarms of this DefaultTenantProfileConfiguration. + + + :param max_created_alarms: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_created_alarms = max_created_alarms + + @property + def max_customers(self): + """Gets the max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_customers + + @max_customers.setter + def max_customers(self, max_customers): + """Sets the max_customers of this DefaultTenantProfileConfiguration. + + + :param max_customers: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_customers = max_customers + + @property + def max_dp_storage_days(self): + """Gets the max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dp_storage_days + + @max_dp_storage_days.setter + def max_dp_storage_days(self, max_dp_storage_days): + """Sets the max_dp_storage_days of this DefaultTenantProfileConfiguration. + + + :param max_dp_storage_days: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dp_storage_days = max_dp_storage_days + + @property + def max_dashboards(self): + """Gets the max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dashboards + + @max_dashboards.setter + def max_dashboards(self, max_dashboards): + """Sets the max_dashboards of this DefaultTenantProfileConfiguration. + + + :param max_dashboards: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dashboards = max_dashboards + + @property + def max_devices(self): + """Gets the max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this DefaultTenantProfileConfiguration. + + + :param max_devices: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def max_emails(self): + """Gets the max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_emails + + @max_emails.setter + def max_emails(self, max_emails): + """Sets the max_emails of this DefaultTenantProfileConfiguration. + + + :param max_emails: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_emails = max_emails + + @property + def max_integrations(self): + """Gets the max_integrations of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_integrations of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_integrations + + @max_integrations.setter + def max_integrations(self, max_integrations): + """Sets the max_integrations of this DefaultTenantProfileConfiguration. + + + :param max_integrations: The max_integrations of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_integrations = max_integrations + + @property + def max_js_executions(self): + """Gets the max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_js_executions + + @max_js_executions.setter + def max_js_executions(self, max_js_executions): + """Sets the max_js_executions of this DefaultTenantProfileConfiguration. + + + :param max_js_executions: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_js_executions = max_js_executions + + @property + def max_ota_packages_in_bytes(self): + """Gets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ota_packages_in_bytes + + @max_ota_packages_in_bytes.setter + def max_ota_packages_in_bytes(self, max_ota_packages_in_bytes): + """Sets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_ota_packages_in_bytes: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ota_packages_in_bytes = max_ota_packages_in_bytes + + @property + def max_re_executions(self): + """Gets the max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_re_executions + + @max_re_executions.setter + def max_re_executions(self, max_re_executions): + """Sets the max_re_executions of this DefaultTenantProfileConfiguration. + + + :param max_re_executions: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_re_executions = max_re_executions + + @property + def max_resources_in_bytes(self): + """Gets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_resources_in_bytes + + @max_resources_in_bytes.setter + def max_resources_in_bytes(self, max_resources_in_bytes): + """Sets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_resources_in_bytes: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_resources_in_bytes = max_resources_in_bytes + + @property + def max_rule_chains(self): + """Gets the max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_chains + + @max_rule_chains.setter + def max_rule_chains(self, max_rule_chains): + """Sets the max_rule_chains of this DefaultTenantProfileConfiguration. + + + :param max_rule_chains: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_chains = max_rule_chains + + @property + def max_rule_node_executions_per_message(self): + """Gets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_node_executions_per_message + + @max_rule_node_executions_per_message.setter + def max_rule_node_executions_per_message(self, max_rule_node_executions_per_message): + """Sets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. + + + :param max_rule_node_executions_per_message: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_node_executions_per_message = max_rule_node_executions_per_message + + @property + def max_scheduler_events(self): + """Gets the max_scheduler_events of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_scheduler_events of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_scheduler_events + + @max_scheduler_events.setter + def max_scheduler_events(self, max_scheduler_events): + """Sets the max_scheduler_events of this DefaultTenantProfileConfiguration. + + + :param max_scheduler_events: The max_scheduler_events of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_scheduler_events = max_scheduler_events + + @property + def max_sms(self): + """Gets the max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_sms + + @max_sms.setter + def max_sms(self, max_sms): + """Sets the max_sms of this DefaultTenantProfileConfiguration. + + + :param max_sms: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_sms = max_sms + + @property + def max_transport_data_points(self): + """Gets the max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_data_points + + @max_transport_data_points.setter + def max_transport_data_points(self, max_transport_data_points): + """Sets the max_transport_data_points of this DefaultTenantProfileConfiguration. + + + :param max_transport_data_points: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_data_points = max_transport_data_points + + @property + def max_transport_messages(self): + """Gets the max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_messages + + @max_transport_messages.setter + def max_transport_messages(self, max_transport_messages): + """Sets the max_transport_messages of this DefaultTenantProfileConfiguration. + + + :param max_transport_messages: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_messages = max_transport_messages + + @property + def max_users(self): + """Gets the max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_users + + @max_users.setter + def max_users(self, max_users): + """Sets the max_users of this DefaultTenantProfileConfiguration. + + + :param max_users: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_users = max_users + + @property + def max_ws_sessions_per_customer(self): + """Gets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_customer + + @max_ws_sessions_per_customer.setter + def max_ws_sessions_per_customer(self, max_ws_sessions_per_customer): + """Sets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_customer: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_customer = max_ws_sessions_per_customer + + @property + def max_ws_sessions_per_public_user(self): + """Gets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_public_user + + @max_ws_sessions_per_public_user.setter + def max_ws_sessions_per_public_user(self, max_ws_sessions_per_public_user): + """Sets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_public_user: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + + @property + def max_ws_sessions_per_regular_user(self): + """Gets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_regular_user + + @max_ws_sessions_per_regular_user.setter + def max_ws_sessions_per_regular_user(self, max_ws_sessions_per_regular_user): + """Sets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_regular_user: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + + @property + def max_ws_sessions_per_tenant(self): + """Gets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_tenant + + @max_ws_sessions_per_tenant.setter + def max_ws_sessions_per_tenant(self, max_ws_sessions_per_tenant): + """Sets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_tenant: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + + @property + def max_ws_subscriptions_per_customer(self): + """Gets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_customer + + @max_ws_subscriptions_per_customer.setter + def max_ws_subscriptions_per_customer(self, max_ws_subscriptions_per_customer): + """Sets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_customer: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + + @property + def max_ws_subscriptions_per_public_user(self): + """Gets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_public_user + + @max_ws_subscriptions_per_public_user.setter + def max_ws_subscriptions_per_public_user(self, max_ws_subscriptions_per_public_user): + """Sets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_public_user: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + + @property + def max_ws_subscriptions_per_regular_user(self): + """Gets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_regular_user + + @max_ws_subscriptions_per_regular_user.setter + def max_ws_subscriptions_per_regular_user(self, max_ws_subscriptions_per_regular_user): + """Sets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_regular_user: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + + @property + def max_ws_subscriptions_per_tenant(self): + """Gets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_tenant + + @max_ws_subscriptions_per_tenant.setter + def max_ws_subscriptions_per_tenant(self, max_ws_subscriptions_per_tenant): + """Sets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_tenant: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + + @property + def rpc_ttl_days(self): + """Gets the rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._rpc_ttl_days + + @rpc_ttl_days.setter + def rpc_ttl_days(self, rpc_ttl_days): + """Sets the rpc_ttl_days of this DefaultTenantProfileConfiguration. + + + :param rpc_ttl_days: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._rpc_ttl_days = rpc_ttl_days + + @property + def tenant_entity_export_rate_limit(self): + """Gets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_export_rate_limit + + @tenant_entity_export_rate_limit.setter + def tenant_entity_export_rate_limit(self, tenant_entity_export_rate_limit): + """Sets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_export_rate_limit: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + + @property + def tenant_entity_import_rate_limit(self): + """Gets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_import_rate_limit + + @tenant_entity_import_rate_limit.setter + def tenant_entity_import_rate_limit(self, tenant_entity_import_rate_limit): + """Sets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_import_rate_limit: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + + @property + def tenant_notification_requests_per_rule_rate_limit(self): + """Gets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_per_rule_rate_limit + + @tenant_notification_requests_per_rule_rate_limit.setter + def tenant_notification_requests_per_rule_rate_limit(self, tenant_notification_requests_per_rule_rate_limit): + """Sets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_per_rule_rate_limit: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + + @property + def tenant_notification_requests_rate_limit(self): + """Gets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_rate_limit + + @tenant_notification_requests_rate_limit.setter + def tenant_notification_requests_rate_limit(self, tenant_notification_requests_rate_limit): + """Sets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_rate_limit: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + + @property + def tenant_server_rest_limits_configuration(self): + """Gets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_server_rest_limits_configuration + + @tenant_server_rest_limits_configuration.setter + def tenant_server_rest_limits_configuration(self, tenant_server_rest_limits_configuration): + """Sets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param tenant_server_rest_limits_configuration: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + + @property + def transport_device_msg_rate_limit(self): + """Gets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_msg_rate_limit + + @transport_device_msg_rate_limit.setter + def transport_device_msg_rate_limit(self, transport_device_msg_rate_limit): + """Sets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_msg_rate_limit: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_msg_rate_limit = transport_device_msg_rate_limit + + @property + def transport_device_telemetry_data_points_rate_limit(self): + """Gets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_data_points_rate_limit + + @transport_device_telemetry_data_points_rate_limit.setter + def transport_device_telemetry_data_points_rate_limit(self, transport_device_telemetry_data_points_rate_limit): + """Sets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_data_points_rate_limit: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + + @property + def transport_device_telemetry_msg_rate_limit(self): + """Gets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_msg_rate_limit + + @transport_device_telemetry_msg_rate_limit.setter + def transport_device_telemetry_msg_rate_limit(self, transport_device_telemetry_msg_rate_limit): + """Sets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_msg_rate_limit: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + + @property + def transport_tenant_msg_rate_limit(self): + """Gets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_msg_rate_limit + + @transport_tenant_msg_rate_limit.setter + def transport_tenant_msg_rate_limit(self, transport_tenant_msg_rate_limit): + """Sets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_msg_rate_limit: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + + @property + def transport_tenant_telemetry_data_points_rate_limit(self): + """Gets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_data_points_rate_limit + + @transport_tenant_telemetry_data_points_rate_limit.setter + def transport_tenant_telemetry_data_points_rate_limit(self, transport_tenant_telemetry_data_points_rate_limit): + """Sets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_data_points_rate_limit: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + + @property + def transport_tenant_telemetry_msg_rate_limit(self): + """Gets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_msg_rate_limit + + @transport_tenant_telemetry_msg_rate_limit.setter + def transport_tenant_telemetry_msg_rate_limit(self, transport_tenant_telemetry_msg_rate_limit): + """Sets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_msg_rate_limit: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + + @property + def warn_threshold(self): + """Gets the warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: float + """ + return self._warn_threshold + + @warn_threshold.setter + def warn_threshold(self, warn_threshold): + """Sets the warn_threshold of this DefaultTenantProfileConfiguration. + + + :param warn_threshold: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: float + """ + + self._warn_threshold = warn_threshold + + @property + def ws_msg_queue_limit_per_session(self): + """Gets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._ws_msg_queue_limit_per_session + + @ws_msg_queue_limit_per_session.setter + def ws_msg_queue_limit_per_session(self, ws_msg_queue_limit_per_session): + """Sets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. + + + :param ws_msg_queue_limit_per_session: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + + @property + def ws_updates_per_session_rate_limit(self): + """Gets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._ws_updates_per_session_rate_limit + + @ws_updates_per_session_rate_limit.setter + def ws_updates_per_session_rate_limit(self, ws_updates_per_session_rate_limit): + """Sets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. + + + :param ws_updates_per_session_rate_limit: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultTenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultTenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_entity_data_diff.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_entity_data_diff.py new file mode 100644 index 0000000..939a9fa --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataDiff. + + + :param result: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataDiff. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_entity_data_info.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_entity_data_info.py new file mode 100644 index 0000000..8587069 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_entity_data_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataInfo. + + + :param result: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_list_branch_info.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_list_branch_info.py new file mode 100644 index 0000000..4a61a3c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_list_branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListBranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListBranchInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The result of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListBranchInfo. + + + :param result: The result of this DeferredResultListBranchInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListBranchInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListBranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListBranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_list_versioned_entity_info.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_list_versioned_entity_info.py new file mode 100644 index 0000000..3b63eb0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_list_versioned_entity_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListVersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListVersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListVersionedEntityInfo. + + + :param result: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListVersionedEntityInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListVersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListVersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_page_data_entity_version.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_page_data_entity_version.py new file mode 100644 index 0000000..32816c0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_page_data_entity_version.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultPageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultPageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultPageDataEntityVersion. + + + :param result: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultPageDataEntityVersion. + + + :param set_or_expired: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultPageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultPageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_repository_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_repository_settings.py new file mode 100644 index 0000000..995eaee --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_repository_settings.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultRepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultRepositorySettings - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The result of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultRepositorySettings. + + + :param result: The result of this DeferredResultRepositorySettings. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultRepositorySettings. + + + :param set_or_expired: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultRepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultRepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_void.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_void.py new file mode 100644 index 0000000..4d71738 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_result_void.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultVoid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultVoid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultVoid. # noqa: E501 + + + :return: The result of this DeferredResultVoid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultVoid. + + + :param result: The result of this DeferredResultVoid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultVoid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultVoid. + + + :param set_or_expired: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultVoid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultVoid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/deferred_resultuuid.py b/billinglayer/python/tb_rest_client/models/models_pe/deferred_resultuuid.py new file mode 100644 index 0000000..31d6fd1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/deferred_resultuuid.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultuuid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultuuid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultuuid. # noqa: E501 + + + :return: The result of this DeferredResultuuid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultuuid. + + + :param result: The result of this DeferredResultuuid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultuuid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultuuid. + + + :param set_or_expired: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultuuid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultuuid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/delete_tenant_request.py b/billinglayer/python/tb_rest_client/models/models_pe/delete_tenant_request.py new file mode 100644 index 0000000..c62c498 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/delete_tenant_request.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeleteTenantRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_notes': 'str', + 'reason': 'str' + } + + attribute_map = { + 'additional_notes': 'additionalNotes', + 'reason': 'reason' + } + + def __init__(self, additional_notes=None, reason=None): # noqa: E501 + """DeleteTenantRequest - a model defined in Swagger""" # noqa: E501 + self._additional_notes = None + self._reason = None + self.discriminator = None + if additional_notes is not None: + self.additional_notes = additional_notes + if reason is not None: + self.reason = reason + + @property + def additional_notes(self): + """Gets the additional_notes of this DeleteTenantRequest. # noqa: E501 + + + :return: The additional_notes of this DeleteTenantRequest. # noqa: E501 + :rtype: str + """ + return self._additional_notes + + @additional_notes.setter + def additional_notes(self, additional_notes): + """Sets the additional_notes of this DeleteTenantRequest. + + + :param additional_notes: The additional_notes of this DeleteTenantRequest. # noqa: E501 + :type: str + """ + + self._additional_notes = additional_notes + + @property + def reason(self): + """Gets the reason of this DeleteTenantRequest. # noqa: E501 + + + :return: The reason of this DeleteTenantRequest. # noqa: E501 + :rtype: str + """ + return self._reason + + @reason.setter + def reason(self, reason): + """Sets the reason of this DeleteTenantRequest. + + + :param reason: The reason of this DeleteTenantRequest. # noqa: E501 + :type: str + """ + + self._reason = reason + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeleteTenantRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeleteTenantRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_pe/delivery_method_notification_template.py new file mode 100644 index 0000000..94af3d7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """DeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this DeliveryMethodNotificationTemplate. + + + :param body: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this DeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device.py b/billinglayer/python/tb_rest_client/models/models_pe/device.py new file mode 100644 index 0000000..c2869b3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device.py @@ -0,0 +1,458 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Device(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, external_id=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None): # noqa: E501 + """Device - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self._external_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + self.label = label + self.external_id = external_id + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Device. # noqa: E501 + + + :return: The id of this Device. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Device. + + + :param id: The id of this Device. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Device. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this Device. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Device. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Device. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def tenant_id(self): + """Gets the tenant_id of this Device. # noqa: E501 + + + :return: The tenant_id of this Device. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Device. + + + :param tenant_id: The tenant_id of this Device. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Device. # noqa: E501 + + + :return: The customer_id of this Device. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Device. + + + :param customer_id: The customer_id of this Device. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Device. # noqa: E501 + + + :return: The owner_id of this Device. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Device. + + + :param owner_id: The owner_id of this Device. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this Device. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this Device. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Device. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this Device. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Device. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this Device. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Device. + + Device Profile Name # noqa: E501 + + :param type: The type of this Device. # noqa: E501 + :type: str + """ + # if type is None: + # raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this Device. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Device. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Device. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Device. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this Device. # noqa: E501 + + + :return: The device_profile_id of this Device. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this Device. + + + :param device_profile_id: The device_profile_id of this Device. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this Device. # noqa: E501 + + + :return: The device_data of this Device. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this Device. + + + :param device_data: The device_data of this Device. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this Device. # noqa: E501 + + + :return: The firmware_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this Device. + + + :param firmware_id: The firmware_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this Device. # noqa: E501 + + + :return: The software_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this Device. + + + :param software_id: The software_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this Device. # noqa: E501 + + + :return: The additional_info of this Device. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Device. + + + :param additional_info: The additional_info of this Device. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Device, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Device): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_activity_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/device_activity_notification_rule_trigger_config.py new file mode 100644 index 0000000..74f0319 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_activity_notification_rule_trigger_config.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class DeviceActivityNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_profiles': 'list[str]', + 'devices': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'device_profiles': 'deviceProfiles', + 'devices': 'devices', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, device_profiles=None, devices=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """DeviceActivityNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._device_profiles = None + self._devices = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if device_profiles is not None: + self.device_profiles = device_profiles + if devices is not None: + self.devices = devices + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def device_profiles(self): + """Gets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._device_profiles + + @device_profiles.setter + def device_profiles(self, device_profiles): + """Sets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. + + + :param device_profiles: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._device_profiles = device_profiles + + @property + def devices(self): + """Gets the devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this DeviceActivityNotificationRuleTriggerConfig. + + + :param devices: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._devices = devices + + @property + def notify_on(self): + """Gets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVE", "INACTIVE"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceActivityNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceActivityNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/device_configuration.py new file mode 100644 index 0000000..b92fa47 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_credentials_id.py b/billinglayer/python/tb_rest_client/models/models_pe/device_credentials_id.py new file mode 100644 index 0000000..e6ad9c3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_credentials_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceCredentialsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """DeviceCredentialsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this DeviceCredentialsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this DeviceCredentialsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceCredentialsId. + + string # noqa: E501 + + :param id: The id of this DeviceCredentialsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceCredentialsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceCredentialsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_data.py b/billinglayer/python/tb_rest_client/models/models_pe/device_data.py new file mode 100644 index 0000000..23983c4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_data.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceConfiguration', + 'transport_configuration': 'DeviceTransportConfiguration' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration' + } + + def __init__(self, configuration=None, transport_configuration=None): # noqa: E501 + """DeviceData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + + @property + def configuration(self): + """Gets the configuration of this DeviceData. # noqa: E501 + + + :return: The configuration of this DeviceData. # noqa: E501 + :rtype: DeviceConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceData. + + + :param configuration: The configuration of this DeviceData. # noqa: E501 + :type: DeviceConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceData. # noqa: E501 + + + :return: The transport_configuration of this DeviceData. # noqa: E501 + :rtype: DeviceTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceData. + + + :param transport_configuration: The transport_configuration of this DeviceData. # noqa: E501 + :type: DeviceTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_export_data.py b/billinglayer/python/tb_rest_client/models/models_pe/device_export_data.py new file mode 100644 index 0000000..012ecaf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class DeviceExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'credentials': 'DeviceCredentials', + 'entity': 'Device', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'credentials': 'credentials', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, credentials=None, entity=None, entity_type=None, relations=None, *args, **kwargs): # noqa: E501 + """DeviceExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._credentials = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if credentials is not None: + self.credentials = credentials + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this DeviceExportData. # noqa: E501 + + + :return: The attributes of this DeviceExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this DeviceExportData. + + + :param attributes: The attributes of this DeviceExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def credentials(self): + """Gets the credentials of this DeviceExportData. # noqa: E501 + + + :return: The credentials of this DeviceExportData. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this DeviceExportData. + + + :param credentials: The credentials of this DeviceExportData. # noqa: E501 + :type: DeviceCredentials + """ + + self._credentials = credentials + + @property + def entity(self): + """Gets the entity of this DeviceExportData. # noqa: E501 + + + :return: The entity of this DeviceExportData. # noqa: E501 + :rtype: Device + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this DeviceExportData. + + + :param entity: The entity of this DeviceExportData. # noqa: E501 + :type: Device + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this DeviceExportData. # noqa: E501 + + + :return: The entity_type of this DeviceExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceExportData. + + + :param entity_type: The entity_type of this DeviceExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this DeviceExportData. # noqa: E501 + + + :return: The relations of this DeviceExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this DeviceExportData. + + + :param relations: The relations of this DeviceExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_group_ota_package.py b/billinglayer/python/tb_rest_client/models/models_pe/device_group_ota_package.py new file mode 100644 index 0000000..a02f819 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_group_ota_package.py @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceGroupOtaPackage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'group_id': 'EntityGroupId', + 'id': 'str', + 'ota_package_id': 'OtaPackageId', + 'ota_package_type': 'str', + 'ota_package_update_time': 'int' + } + + attribute_map = { + 'group_id': 'groupId', + 'id': 'id', + 'ota_package_id': 'otaPackageId', + 'ota_package_type': 'otaPackageType', + 'ota_package_update_time': 'otaPackageUpdateTime' + } + + def __init__(self, group_id=None, id=None, ota_package_id=None, ota_package_type=None, ota_package_update_time=None): # noqa: E501 + """DeviceGroupOtaPackage - a model defined in Swagger""" # noqa: E501 + self._group_id = None + self._id = None + self._ota_package_id = None + self._ota_package_type = None + self._ota_package_update_time = None + self.discriminator = None + if group_id is not None: + self.group_id = group_id + if id is not None: + self.id = id + if ota_package_id is not None: + self.ota_package_id = ota_package_id + if ota_package_type is not None: + self.ota_package_type = ota_package_type + if ota_package_update_time is not None: + self.ota_package_update_time = ota_package_update_time + + @property + def group_id(self): + """Gets the group_id of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The group_id of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: EntityGroupId + """ + return self._group_id + + @group_id.setter + def group_id(self, group_id): + """Sets the group_id of this DeviceGroupOtaPackage. + + + :param group_id: The group_id of this DeviceGroupOtaPackage. # noqa: E501 + :type: EntityGroupId + """ + + self._group_id = group_id + + @property + def id(self): + """Gets the id of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The id of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceGroupOtaPackage. + + + :param id: The id of this DeviceGroupOtaPackage. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def ota_package_id(self): + """Gets the ota_package_id of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The ota_package_id of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: OtaPackageId + """ + return self._ota_package_id + + @ota_package_id.setter + def ota_package_id(self, ota_package_id): + """Sets the ota_package_id of this DeviceGroupOtaPackage. + + + :param ota_package_id: The ota_package_id of this DeviceGroupOtaPackage. # noqa: E501 + :type: OtaPackageId + """ + + self._ota_package_id = ota_package_id + + @property + def ota_package_type(self): + """Gets the ota_package_type of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The ota_package_type of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: str + """ + return self._ota_package_type + + @ota_package_type.setter + def ota_package_type(self, ota_package_type): + """Sets the ota_package_type of this DeviceGroupOtaPackage. + + + :param ota_package_type: The ota_package_type of this DeviceGroupOtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if ota_package_type not in allowed_values: + raise ValueError( + "Invalid value for `ota_package_type` ({0}), must be one of {1}" # noqa: E501 + .format(ota_package_type, allowed_values) + ) + + self._ota_package_type = ota_package_type + + @property + def ota_package_update_time(self): + """Gets the ota_package_update_time of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The ota_package_update_time of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: int + """ + return self._ota_package_update_time + + @ota_package_update_time.setter + def ota_package_update_time(self, ota_package_update_time): + """Sets the ota_package_update_time of this DeviceGroupOtaPackage. + + + :param ota_package_update_time: The ota_package_update_time of this DeviceGroupOtaPackage. # noqa: E501 + :type: int + """ + + self._ota_package_update_time = ota_package_update_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceGroupOtaPackage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceGroupOtaPackage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_id.py b/billinglayer/python/tb_rest_client/models/models_pe/device_id.py new file mode 100644 index 0000000..6b726b7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_info.py b/billinglayer/python/tb_rest_client/models/models_pe/device_info.py new file mode 100644 index 0000000..4c92934 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_info.py @@ -0,0 +1,530 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]', + 'active': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo', + 'owner_name': 'ownerName', + 'groups': 'groups', + 'active': 'active' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None, owner_name=None, groups=None, active=None): # noqa: E501 + """DeviceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self._owner_name = None + self._groups = None + self._active = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + self.label = label + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + if active is not None: + self.active = active + + @property + def id(self): + """Gets the id of this DeviceInfo. # noqa: E501 + + + :return: The id of this DeviceInfo. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceInfo. + + + :param id: The id of this DeviceInfo. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DeviceInfo. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceInfo. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceInfo. # noqa: E501 + + + :return: The tenant_id of this DeviceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceInfo. + + + :param tenant_id: The tenant_id of this DeviceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this DeviceInfo. # noqa: E501 + + + :return: The customer_id of this DeviceInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this DeviceInfo. + + + :param customer_id: The customer_id of this DeviceInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this DeviceInfo. # noqa: E501 + + + :return: The owner_id of this DeviceInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this DeviceInfo. + + + :param owner_id: The owner_id of this DeviceInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this DeviceInfo. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceInfo. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this DeviceInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this DeviceInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this DeviceInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this DeviceInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this DeviceInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this DeviceInfo. # noqa: E501 + + + :return: The device_profile_id of this DeviceInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this DeviceInfo. + + + :param device_profile_id: The device_profile_id of this DeviceInfo. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this DeviceInfo. # noqa: E501 + + + :return: The device_data of this DeviceInfo. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this DeviceInfo. + + + :param device_data: The device_data of this DeviceInfo. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this DeviceInfo. # noqa: E501 + + + :return: The firmware_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this DeviceInfo. + + + :param firmware_id: The firmware_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this DeviceInfo. # noqa: E501 + + + :return: The software_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this DeviceInfo. + + + :param software_id: The software_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this DeviceInfo. # noqa: E501 + + + :return: The additional_info of this DeviceInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this DeviceInfo. + + + :param additional_info: The additional_info of this DeviceInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_name(self): + """Gets the owner_name of this DeviceInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this DeviceInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this DeviceInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this DeviceInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this DeviceInfo. + + Groups # noqa: E501 + + :param groups: The groups of this DeviceInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + @property + def active(self): + """Gets the active of this DeviceInfo. # noqa: E501 + + Device active flag. # noqa: E501 + + :return: The active of this DeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._active + + @active.setter + def active(self, active): + """Sets the active of this DeviceInfo. + + Device active flag. # noqa: E501 + + :param active: The active of this DeviceInfo. # noqa: E501 + :type: bool + """ + + self._active = active + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_profile_alarm.py b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_alarm.py new file mode 100644 index 0000000..847f9c0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_alarm.py @@ -0,0 +1,348 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileAlarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'alarm_type': 'str', + 'create_rules': 'dict(str, AlarmRule)', + 'clear_rule': 'AlarmRule', + 'propagate': 'bool', + 'propagate_to_owner': 'bool', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]' + } + + attribute_map = { + 'id': 'id', + 'alarm_type': 'alarmType', + 'create_rules': 'createRules', + 'clear_rule': 'clearRule', + 'propagate': 'propagate', + 'propagate_to_owner': 'propagateToOwner', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes' + } + + def __init__(self, id=None, alarm_type=None, create_rules=None, clear_rule=None, propagate=None, propagate_to_owner=None, propagate_to_owner_hierarchy=None, propagate_to_tenant=None, propagate_relation_types=None): # noqa: E501 + """DeviceProfileAlarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._alarm_type = None + self._create_rules = None + self._clear_rule = None + self._propagate = None + self._propagate_to_owner = None + self._propagate_to_owner_hierarchy = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self.discriminator = None + if id is not None: + self.id = id + if alarm_type is not None: + self.alarm_type = alarm_type + if create_rules is not None: + self.create_rules = create_rules + if clear_rule is not None: + self.clear_rule = clear_rule + if propagate is not None: + self.propagate = propagate + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + + @property + def id(self): + """Gets the id of this DeviceProfileAlarm. # noqa: E501 + + String value representing the alarm rule id # noqa: E501 + + :return: The id of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileAlarm. + + String value representing the alarm rule id # noqa: E501 + + :param id: The id of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def alarm_type(self): + """Gets the alarm_type of this DeviceProfileAlarm. # noqa: E501 + + String value representing type of the alarm # noqa: E501 + + :return: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._alarm_type + + @alarm_type.setter + def alarm_type(self, alarm_type): + """Sets the alarm_type of this DeviceProfileAlarm. + + String value representing type of the alarm # noqa: E501 + + :param alarm_type: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._alarm_type = alarm_type + + @property + def create_rules(self): + """Gets the create_rules of this DeviceProfileAlarm. # noqa: E501 + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :return: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :rtype: dict(str, AlarmRule) + """ + return self._create_rules + + @create_rules.setter + def create_rules(self, create_rules): + """Sets the create_rules of this DeviceProfileAlarm. + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :param create_rules: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :type: dict(str, AlarmRule) + """ + + self._create_rules = create_rules + + @property + def clear_rule(self): + """Gets the clear_rule of this DeviceProfileAlarm. # noqa: E501 + + + :return: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :rtype: AlarmRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this DeviceProfileAlarm. + + + :param clear_rule: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :type: AlarmRule + """ + + self._clear_rule = clear_rule + + @property + def propagate(self): + """Gets the propagate of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this DeviceProfileAlarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileAlarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileAlarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_configuration.py new file mode 100644 index 0000000..8605ae8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_profile_data.py b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_data.py new file mode 100644 index 0000000..51da870 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_data.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceProfileConfiguration', + 'transport_configuration': 'DeviceProfileTransportConfiguration', + 'provision_configuration': 'DeviceProfileProvisionConfiguration', + 'alarms': 'list[DeviceProfileAlarm]' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration', + 'provision_configuration': 'provisionConfiguration', + 'alarms': 'alarms' + } + + def __init__(self, configuration=None, transport_configuration=None, provision_configuration=None, alarms=None): # noqa: E501 + """DeviceProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self._provision_configuration = None + self._alarms = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + if provision_configuration is not None: + self.provision_configuration = provision_configuration + if alarms is not None: + self.alarms = alarms + + @property + def configuration(self): + """Gets the configuration of this DeviceProfileData. # noqa: E501 + + + :return: The configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceProfileData. + + + :param configuration: The configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The transport_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceProfileData. + + + :param transport_configuration: The transport_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + @property + def provision_configuration(self): + """Gets the provision_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The provision_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileProvisionConfiguration + """ + return self._provision_configuration + + @provision_configuration.setter + def provision_configuration(self, provision_configuration): + """Sets the provision_configuration of this DeviceProfileData. + + + :param provision_configuration: The provision_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileProvisionConfiguration + """ + + self._provision_configuration = provision_configuration + + @property + def alarms(self): + """Gets the alarms of this DeviceProfileData. # noqa: E501 + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :return: The alarms of this DeviceProfileData. # noqa: E501 + :rtype: list[DeviceProfileAlarm] + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this DeviceProfileData. + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :param alarms: The alarms of this DeviceProfileData. # noqa: E501 + :type: list[DeviceProfileAlarm] + """ + + self._alarms = alarms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_profile_id.py b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_id.py new file mode 100644 index 0000000..f3a8055 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_provision_configuration.py new file mode 100644 index 0000000..4ca00e9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """DeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_transport_configuration.py new file mode 100644 index 0000000..802a981 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_search_query.py b/billinglayer/python/tb_rest_client/models/models_pe/device_search_query.py new file mode 100644 index 0000000..66a0079 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'device_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'device_types': 'deviceTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, device_types=None, parameters=None): # noqa: E501 + """DeviceSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._device_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if device_types is not None: + self.device_types = device_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this DeviceSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this DeviceSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQuery. # noqa: E501 + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The device_types of this DeviceSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQuery. + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param device_types: The device_types of this DeviceSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def parameters(self): + """Gets the parameters of this DeviceSearchQuery. # noqa: E501 + + + :return: The parameters of this DeviceSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this DeviceSearchQuery. + + + :param parameters: The parameters of this DeviceSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/device_search_query_filter.py new file mode 100644 index 0000000..c9b451d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_types': 'deviceTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """DeviceSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._device_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if device_types is not None: + self.device_types = device_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQueryFilter. + + + :param device_types: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def direction(self): + """Gets the direction of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this DeviceSearchQueryFilter. + + + :param direction: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this DeviceSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this DeviceSearchQueryFilter. + + + :param max_level: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQueryFilter. + + + :param relation_type: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this DeviceSearchQueryFilter. + + + :param root_entity: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/device_transport_configuration.py new file mode 100644 index 0000000..701cebb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/device_type_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/device_type_filter.py new file mode 100644 index 0000000..147c129 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/device_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_name_filter': 'str', + 'device_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_name_filter': 'deviceNameFilter', + 'device_types': 'deviceTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_name_filter=None, device_types=None, *args, **kwargs): # noqa: E501 + """DeviceTypeFilter - a model defined in Swagger""" # noqa: E501 + self._device_name_filter = None + self._device_types = None + self.discriminator = None + if device_name_filter is not None: + self.device_name_filter = device_name_filter + if device_types is not None: + self.device_types = device_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_name_filter(self): + """Gets the device_name_filter of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :rtype: str + """ + return self._device_name_filter + + @device_name_filter.setter + def device_name_filter(self, device_name_filter): + """Sets the device_name_filter of this DeviceTypeFilter. + + + :param device_name_filter: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :type: str + """ + + self._device_name_filter = device_name_filter + + @property + def device_types(self): + """Gets the device_types of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_types of this DeviceTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceTypeFilter. + + + :param device_types: The device_types of this DeviceTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/disabled_device_profile_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/disabled_device_profile_provision_configuration.py new file mode 100644 index 0000000..2c4985d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/disabled_device_profile_provision_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class DisabledDeviceProfileProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """DisabledDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DisabledDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DisabledDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/domain_info.py b/billinglayer/python/tb_rest_client/models/models_pe/domain_info.py new file mode 100644 index 0000000..59c1b64 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/domain_info.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DomainInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'scheme': 'str' + } + + attribute_map = { + 'name': 'name', + 'scheme': 'scheme' + } + + def __init__(self, name=None, scheme=None): # noqa: E501 + """DomainInfo - a model defined in Swagger""" # noqa: E501 + self._name = None + self._scheme = None + self.discriminator = None + if name is not None: + self.name = name + if scheme is not None: + self.scheme = scheme + + @property + def name(self): + """Gets the name of this DomainInfo. # noqa: E501 + + + :return: The name of this DomainInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DomainInfo. + + + :param name: The name of this DomainInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def scheme(self): + """Gets the scheme of this DomainInfo. # noqa: E501 + + + :return: The scheme of this DomainInfo. # noqa: E501 + :rtype: str + """ + return self._scheme + + @scheme.setter + def scheme(self, scheme): + """Sets the scheme of this DomainInfo. + + + :param scheme: The scheme of this DomainInfo. # noqa: E501 + :type: str + """ + allowed_values = ["HTTP", "HTTPS", "MIXED"] # noqa: E501 + if scheme not in allowed_values: + raise ValueError( + "Invalid value for `scheme` ({0}), must be one of {1}" # noqa: E501 + .format(scheme, allowed_values) + ) + + self._scheme = scheme + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DomainInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DomainInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/duration_alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_pe/duration_alarm_condition_spec.py new file mode 100644 index 0000000..97f83b8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/duration_alarm_condition_spec.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class DurationAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValuelong', + 'unit': 'str' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate', + 'unit': 'unit' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, unit=None, *args, **kwargs): # noqa: E501 + """DurationAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self._unit = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + if unit is not None: + self.unit = unit + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValuelong + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this DurationAlarmConditionSpec. + + + :param predicate: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValuelong + """ + + self._predicate = predicate + + @property + def unit(self): + """Gets the unit of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: str + """ + return self._unit + + @unit.setter + def unit(self, unit): + """Sets the unit of this DurationAlarmConditionSpec. + + + :param unit: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :type: str + """ + allowed_values = ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"] # noqa: E501 + if unit not in allowed_values: + raise ValueError( + "Invalid value for `unit` ({0}), must be one of {1}" # noqa: E501 + .format(unit, allowed_values) + ) + + self._unit = unit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DurationAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DurationAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valueboolean.py b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valueboolean.py new file mode 100644 index 0000000..1df15a2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valueboolean.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueboolean - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueboolean. # noqa: E501 + + + :return: The inherit of this DynamicValueboolean. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueboolean. + + + :param inherit: The inherit of this DynamicValueboolean. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueboolean. # noqa: E501 + + + :return: The source_attribute of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueboolean. + + + :param source_attribute: The source_attribute of this DynamicValueboolean. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueboolean. # noqa: E501 + + + :return: The source_type of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueboolean. + + + :param source_type: The source_type of this DynamicValueboolean. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuedouble.py b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuedouble.py new file mode 100644 index 0000000..f8b016b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuedouble.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuedouble - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuedouble. # noqa: E501 + + + :return: The inherit of this DynamicValuedouble. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuedouble. + + + :param inherit: The inherit of this DynamicValuedouble. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuedouble. # noqa: E501 + + + :return: The source_attribute of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuedouble. + + + :param source_attribute: The source_attribute of this DynamicValuedouble. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuedouble. # noqa: E501 + + + :return: The source_type of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuedouble. + + + :param source_type: The source_type of this DynamicValuedouble. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valueint.py b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valueint.py new file mode 100644 index 0000000..bbf937b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valueint.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueint - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueint. # noqa: E501 + + + :return: The inherit of this DynamicValueint. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueint. + + + :param inherit: The inherit of this DynamicValueint. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueint. # noqa: E501 + + + :return: The source_attribute of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueint. + + + :param source_attribute: The source_attribute of this DynamicValueint. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueint. # noqa: E501 + + + :return: The source_type of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueint. + + + :param source_type: The source_type of this DynamicValueint. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuelong.py b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuelong.py new file mode 100644 index 0000000..ca901f4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuelong.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuelong - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuelong. # noqa: E501 + + + :return: The inherit of this DynamicValuelong. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuelong. + + + :param inherit: The inherit of this DynamicValuelong. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuelong. # noqa: E501 + + + :return: The source_attribute of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuelong. + + + :param source_attribute: The source_attribute of this DynamicValuelong. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuelong. # noqa: E501 + + + :return: The source_type of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuelong. + + + :param source_type: The source_type of this DynamicValuelong. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuestring.py b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuestring.py new file mode 100644 index 0000000..a7abee0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/dynamic_valuestring.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuestring - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuestring. # noqa: E501 + + + :return: The inherit of this DynamicValuestring. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuestring. + + + :param inherit: The inherit of this DynamicValuestring. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuestring. # noqa: E501 + + + :return: The source_attribute of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuestring. + + + :param source_attribute: The source_attribute of this DynamicValuestring. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuestring. # noqa: E501 + + + :return: The source_type of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuestring. + + + :param source_type: The source_type of this DynamicValuestring. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge.py b/billinglayer/python/tb_rest_client/models/models_pe/edge.py new file mode 100644 index 0000000..f819fa6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge.py @@ -0,0 +1,484 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Edge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str', + 'edge_license_key': 'str', + 'cloud_endpoint': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret', + 'edge_license_key': 'edgeLicenseKey', + 'cloud_endpoint': 'cloudEndpoint' + } + + def __init__(self, additional_info=None, owner_id=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None, edge_license_key=None, cloud_endpoint=None): # noqa: E501 + """Edge - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._owner_id = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self._edge_license_key = None + self._cloud_endpoint = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + self.edge_license_key = edge_license_key + self.cloud_endpoint = cloud_endpoint + + @property + def additional_info(self): + """Gets the additional_info of this Edge. # noqa: E501 + + + :return: The additional_info of this Edge. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Edge. + + + :param additional_info: The additional_info of this Edge. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this Edge. # noqa: E501 + + + :return: The owner_id of this Edge. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Edge. + + + :param owner_id: The owner_id of this Edge. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def id(self): + """Gets the id of this Edge. # noqa: E501 + + + :return: The id of this Edge. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Edge. + + + :param id: The id of this Edge. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Edge. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this Edge. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Edge. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Edge. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Edge. # noqa: E501 + + + :return: The tenant_id of this Edge. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Edge. + + + :param tenant_id: The tenant_id of this Edge. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Edge. # noqa: E501 + + + :return: The customer_id of this Edge. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Edge. + + + :param customer_id: The customer_id of this Edge. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this Edge. # noqa: E501 + + + :return: The root_rule_chain_id of this Edge. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this Edge. + + + :param root_rule_chain_id: The root_rule_chain_id of this Edge. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this Edge. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this Edge. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Edge. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this Edge. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Edge. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this Edge. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Edge. + + Edge type # noqa: E501 + + :param type: The type of this Edge. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this Edge. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Edge. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Edge. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Edge. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this Edge. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this Edge. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this Edge. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this Edge. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this Edge. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this Edge. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this Edge. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this Edge. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + @property + def edge_license_key(self): + """Gets the edge_license_key of this Edge. # noqa: E501 + + Edge license key obtained from license portal # noqa: E501 + + :return: The edge_license_key of this Edge. # noqa: E501 + :rtype: str + """ + return self._edge_license_key + + @edge_license_key.setter + def edge_license_key(self, edge_license_key): + """Sets the edge_license_key of this Edge. + + Edge license key obtained from license portal # noqa: E501 + + :param edge_license_key: The edge_license_key of this Edge. # noqa: E501 + :type: str + """ + if edge_license_key is None: + raise ValueError("Invalid value for `edge_license_key`, must not be `None`") # noqa: E501 + + self._edge_license_key = edge_license_key + + @property + def cloud_endpoint(self): + """Gets the cloud_endpoint of this Edge. # noqa: E501 + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :return: The cloud_endpoint of this Edge. # noqa: E501 + :rtype: str + """ + return self._cloud_endpoint + + @cloud_endpoint.setter + def cloud_endpoint(self, cloud_endpoint): + """Sets the cloud_endpoint of this Edge. + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :param cloud_endpoint: The cloud_endpoint of this Edge. # noqa: E501 + :type: str + """ + if cloud_endpoint is None: + raise ValueError("Invalid value for `cloud_endpoint`, must not be `None`") # noqa: E501 + + self._cloud_endpoint = cloud_endpoint + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Edge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Edge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_event.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_event.py new file mode 100644 index 0000000..e72eec9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_event.py @@ -0,0 +1,370 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'action': 'str', + 'body': 'JsonNode', + 'created_time': 'int', + 'edge_id': 'EdgeId', + 'entity_group_id': 'str', + 'entity_id': 'str', + 'id': 'EdgeEventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str' + } + + attribute_map = { + 'action': 'action', + 'body': 'body', + 'created_time': 'createdTime', + 'edge_id': 'edgeId', + 'entity_group_id': 'entityGroupId', + 'entity_id': 'entityId', + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid' + } + + def __init__(self, action=None, body=None, created_time=None, edge_id=None, entity_group_id=None, entity_id=None, id=None, tenant_id=None, type=None, uid=None): # noqa: E501 + """EdgeEvent - a model defined in Swagger""" # noqa: E501 + self._action = None + self._body = None + self._created_time = None + self._edge_id = None + self._entity_group_id = None + self._entity_id = None + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self.discriminator = None + if action is not None: + self.action = action + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + if edge_id is not None: + self.edge_id = edge_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if entity_id is not None: + self.entity_id = entity_id + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + + @property + def action(self): + """Gets the action of this EdgeEvent. # noqa: E501 + + + :return: The action of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._action + + @action.setter + def action(self, action): + """Sets the action of this EdgeEvent. + + + :param action: The action of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADDED", "ADDED_TO_ENTITY_GROUP", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_UNASSIGNED", "ASSIGNED_TO_EDGE", "ATTRIBUTES_DELETED", "ATTRIBUTES_UPDATED", "CHANGE_OWNER", "CREDENTIALS_REQUEST", "CREDENTIALS_UPDATED", "DELETED", "ENTITY_MERGE_REQUEST", "POST_ATTRIBUTES", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "REMOVED_FROM_ENTITY_GROUP", "RPC_CALL", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_EDGE", "UPDATED"] # noqa: E501 + if action not in allowed_values: + raise ValueError( + "Invalid value for `action` ({0}), must be one of {1}" # noqa: E501 + .format(action, allowed_values) + ) + + self._action = action + + @property + def body(self): + """Gets the body of this EdgeEvent. # noqa: E501 + + + :return: The body of this EdgeEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EdgeEvent. + + + :param body: The body of this EdgeEvent. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EdgeEvent. # noqa: E501 + + + :return: The created_time of this EdgeEvent. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeEvent. + + + :param created_time: The created_time of this EdgeEvent. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def edge_id(self): + """Gets the edge_id of this EdgeEvent. # noqa: E501 + + + :return: The edge_id of this EdgeEvent. # noqa: E501 + :rtype: EdgeId + """ + return self._edge_id + + @edge_id.setter + def edge_id(self, edge_id): + """Sets the edge_id of this EdgeEvent. + + + :param edge_id: The edge_id of this EdgeEvent. # noqa: E501 + :type: EdgeId + """ + + self._edge_id = edge_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this EdgeEvent. # noqa: E501 + + + :return: The entity_group_id of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this EdgeEvent. + + + :param entity_group_id: The entity_group_id of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._entity_group_id = entity_group_id + + @property + def entity_id(self): + """Gets the entity_id of this EdgeEvent. # noqa: E501 + + + :return: The entity_id of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EdgeEvent. + + + :param entity_id: The entity_id of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def id(self): + """Gets the id of this EdgeEvent. # noqa: E501 + + + :return: The id of this EdgeEvent. # noqa: E501 + :rtype: EdgeEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEvent. + + + :param id: The id of this EdgeEvent. # noqa: E501 + :type: EdgeEventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeEvent. # noqa: E501 + + + :return: The tenant_id of this EdgeEvent. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeEvent. + + + :param tenant_id: The tenant_id of this EdgeEvent. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EdgeEvent. # noqa: E501 + + + :return: The type of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeEvent. + + + :param type: The type of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADMIN_SETTINGS", "ALARM", "ASSET", "ASSET_PROFILE", "CONVERTER", "CUSTOMER", "CUSTOM_TRANSLATION", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "LOGIN_WHITE_LABELING", "OTA_PACKAGE", "QUEUE", "RELATION", "ROLE", "RULE_CHAIN", "RULE_CHAIN_METADATA", "SCHEDULER_EVENT", "TENANT", "USER", "WHITE_LABELING", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def uid(self): + """Gets the uid of this EdgeEvent. # noqa: E501 + + + :return: The uid of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EdgeEvent. + + + :param uid: The uid of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._uid = uid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_event_id.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_event_id.py new file mode 100644 index 0000000..36b044e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EdgeEventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EdgeEventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EdgeEventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEventId. + + string # noqa: E501 + + :param id: The id of this EdgeEventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_id.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_id.py new file mode 100644 index 0000000..8871efb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EdgeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EdgeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EdgeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EdgeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EdgeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EdgeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["EDGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_info.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_info.py new file mode 100644 index 0000000..fac6493 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_info.py @@ -0,0 +1,540 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str', + 'edge_license_key': 'str', + 'cloud_endpoint': 'str', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret', + 'edge_license_key': 'edgeLicenseKey', + 'cloud_endpoint': 'cloudEndpoint', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, additional_info=None, owner_id=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None, edge_license_key=None, cloud_endpoint=None, owner_name=None, groups=None): # noqa: E501 + """EdgeInfo - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._owner_id = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self._edge_license_key = None + self._cloud_endpoint = None + self._owner_name = None + self._groups = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + self.edge_license_key = edge_license_key + self.cloud_endpoint = cloud_endpoint + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def additional_info(self): + """Gets the additional_info of this EdgeInfo. # noqa: E501 + + + :return: The additional_info of this EdgeInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EdgeInfo. + + + :param additional_info: The additional_info of this EdgeInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this EdgeInfo. # noqa: E501 + + + :return: The owner_id of this EdgeInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EdgeInfo. + + + :param owner_id: The owner_id of this EdgeInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def id(self): + """Gets the id of this EdgeInfo. # noqa: E501 + + + :return: The id of this EdgeInfo. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeInfo. + + + :param id: The id of this EdgeInfo. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EdgeInfo. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this EdgeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeInfo. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EdgeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeInfo. # noqa: E501 + + + :return: The tenant_id of this EdgeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeInfo. + + + :param tenant_id: The tenant_id of this EdgeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EdgeInfo. # noqa: E501 + + + :return: The customer_id of this EdgeInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EdgeInfo. + + + :param customer_id: The customer_id of this EdgeInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this EdgeInfo. # noqa: E501 + + + :return: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this EdgeInfo. + + + :param root_rule_chain_id: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this EdgeInfo. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EdgeInfo. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this EdgeInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EdgeInfo. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeInfo. + + Edge type # noqa: E501 + + :param type: The type of this EdgeInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this EdgeInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this EdgeInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this EdgeInfo. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this EdgeInfo. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this EdgeInfo. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this EdgeInfo. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this EdgeInfo. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this EdgeInfo. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + @property + def edge_license_key(self): + """Gets the edge_license_key of this EdgeInfo. # noqa: E501 + + Edge license key obtained from license portal # noqa: E501 + + :return: The edge_license_key of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._edge_license_key + + @edge_license_key.setter + def edge_license_key(self, edge_license_key): + """Sets the edge_license_key of this EdgeInfo. + + Edge license key obtained from license portal # noqa: E501 + + :param edge_license_key: The edge_license_key of this EdgeInfo. # noqa: E501 + :type: str + """ + if edge_license_key is None: + raise ValueError("Invalid value for `edge_license_key`, must not be `None`") # noqa: E501 + + self._edge_license_key = edge_license_key + + @property + def cloud_endpoint(self): + """Gets the cloud_endpoint of this EdgeInfo. # noqa: E501 + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :return: The cloud_endpoint of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._cloud_endpoint + + @cloud_endpoint.setter + def cloud_endpoint(self, cloud_endpoint): + """Sets the cloud_endpoint of this EdgeInfo. + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :param cloud_endpoint: The cloud_endpoint of this EdgeInfo. # noqa: E501 + :type: str + """ + if cloud_endpoint is None: + raise ValueError("Invalid value for `cloud_endpoint`, must not be `None`") # noqa: E501 + + self._cloud_endpoint = cloud_endpoint + + @property + def owner_name(self): + """Gets the owner_name of this EdgeInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this EdgeInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this EdgeInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this EdgeInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this EdgeInfo. + + Groups # noqa: E501 + + :param groups: The groups of this EdgeInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_install_instructions.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_install_instructions.py new file mode 100644 index 0000000..7b6ba1e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_install_instructions.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInstallInstructions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'docker_install_instructions': 'str' + } + + attribute_map = { + 'docker_install_instructions': 'dockerInstallInstructions' + } + + def __init__(self, docker_install_instructions=None): # noqa: E501 + """EdgeInstallInstructions - a model defined in Swagger""" # noqa: E501 + self._docker_install_instructions = None + self.discriminator = None + if docker_install_instructions is not None: + self.docker_install_instructions = docker_install_instructions + + @property + def docker_install_instructions(self): + """Gets the docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + + Markdown with docker install instructions # noqa: E501 + + :return: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :rtype: str + """ + return self._docker_install_instructions + + @docker_install_instructions.setter + def docker_install_instructions(self, docker_install_instructions): + """Sets the docker_install_instructions of this EdgeInstallInstructions. + + Markdown with docker install instructions # noqa: E501 + + :param docker_install_instructions: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :type: str + """ + + self._docker_install_instructions = docker_install_instructions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInstallInstructions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInstallInstructions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_search_query.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_search_query.py new file mode 100644 index 0000000..d677f21 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'edge_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'edge_types': 'edgeTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, edge_types=None, parameters=None): # noqa: E501 + """EdgeSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._edge_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if edge_types is not None: + self.edge_types = edge_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQuery. # noqa: E501 + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EdgeSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQuery. + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EdgeSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQuery. # noqa: E501 + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :return: The edge_types of this EdgeSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQuery. + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :param edge_types: The edge_types of this EdgeSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def parameters(self): + """Gets the parameters of this EdgeSearchQuery. # noqa: E501 + + + :return: The parameters of this EdgeSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EdgeSearchQuery. + + + :param parameters: The parameters of this EdgeSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_search_query_filter.py new file mode 100644 index 0000000..91ba41f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'edge_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'edge_types': 'edgeTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, edge_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EdgeSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._edge_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if edge_types is not None: + self.edge_types = edge_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EdgeSearchQueryFilter. + + + :param direction: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQueryFilter. + + + :param edge_types: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EdgeSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EdgeSearchQueryFilter. + + + :param max_level: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQueryFilter. + + + :param relation_type: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EdgeSearchQueryFilter. + + + :param root_entity: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/edge_type_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/edge_type_filter.py new file mode 100644 index 0000000..e5945e6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/edge_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edge_name_filter': 'str', + 'edge_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'edge_name_filter': 'edgeNameFilter', + 'edge_types': 'edgeTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, edge_name_filter=None, edge_types=None, *args, **kwargs): # noqa: E501 + """EdgeTypeFilter - a model defined in Swagger""" # noqa: E501 + self._edge_name_filter = None + self._edge_types = None + self.discriminator = None + if edge_name_filter is not None: + self.edge_name_filter = edge_name_filter + if edge_types is not None: + self.edge_types = edge_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def edge_name_filter(self): + """Gets the edge_name_filter of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :rtype: str + """ + return self._edge_name_filter + + @edge_name_filter.setter + def edge_name_filter(self, edge_name_filter): + """Sets the edge_name_filter of this EdgeTypeFilter. + + + :param edge_name_filter: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :type: str + """ + + self._edge_name_filter = edge_name_filter + + @property + def edge_types(self): + """Gets the edge_types of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_types of this EdgeTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeTypeFilter. + + + :param edge_types: The edge_types of this EdgeTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/efento_coap_device_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/efento_coap_device_type_configuration.py new file mode 100644 index 0000000..b350d27 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/efento_coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EfentoCoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """EfentoCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EfentoCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EfentoCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/email_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_pe/email_delivery_method_notification_template.py new file mode 100644 index 0000000..d59a3a3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/email_delivery_method_notification_template.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.delivery_method_notification_template import DeliveryMethodNotificationTemplate # noqa: F401,E501 + +class EmailDeliveryMethodNotificationTemplate(DeliveryMethodNotificationTemplate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + if hasattr(DeliveryMethodNotificationTemplate, "swagger_types"): + swagger_types.update(DeliveryMethodNotificationTemplate.swagger_types) + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + if hasattr(DeliveryMethodNotificationTemplate, "attribute_map"): + attribute_map.update(DeliveryMethodNotificationTemplate.attribute_map) + + def __init__(self, body=None, enabled=None, subject=None, *args, **kwargs): # noqa: E501 + """EmailDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + DeliveryMethodNotificationTemplate.__init__(self, *args, **kwargs) + + @property + def body(self): + """Gets the body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EmailDeliveryMethodNotificationTemplate. + + + :param body: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this EmailDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this EmailDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/email_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_pe/email_two_fa_account_config.py new file mode 100644 index 0000000..5632489 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/email_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EmailTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'email': 'email', + 'use_by_default': 'useByDefault' + } + + def __init__(self, email=None, use_by_default=None): # noqa: E501 + """EmailTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._email = None + self._use_by_default = None + self.discriminator = None + self.email = email + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def email(self): + """Gets the email of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this EmailTwoFaAccountConfig. + + + :param email: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if email is None: + raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + + self._email = email + + @property + def use_by_default(self): + """Gets the use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this EmailTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/email_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_pe/email_two_fa_provider_config.py new file mode 100644 index 0000000..16fb2ff --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/email_two_fa_provider_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.two_fa_provider_config import TwoFaProviderConfig # noqa: F401,E501 + +class EmailTwoFaProviderConfig(TwoFaProviderConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'verification_code_lifetime': 'int' + } + if hasattr(TwoFaProviderConfig, "swagger_types"): + swagger_types.update(TwoFaProviderConfig.swagger_types) + + attribute_map = { + 'verification_code_lifetime': 'verificationCodeLifetime' + } + if hasattr(TwoFaProviderConfig, "attribute_map"): + attribute_map.update(TwoFaProviderConfig.attribute_map) + + def __init__(self, verification_code_lifetime=None, *args, **kwargs): # noqa: E501 + """EmailTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._verification_code_lifetime = None + self.discriminator = None + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + TwoFaProviderConfig.__init__(self, *args, **kwargs) + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this EmailTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entities_by_group_name_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entities_by_group_name_filter.py new file mode 100644 index 0000000..5bfe156 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entities_by_group_name_filter.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntitiesByGroupNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group_name_filter': 'str', + 'group_type': 'str', + 'owner_id': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group_name_filter': 'entityGroupNameFilter', + 'group_type': 'groupType', + 'owner_id': 'ownerId' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group_name_filter=None, group_type=None, owner_id=None, *args, **kwargs): # noqa: E501 + """EntitiesByGroupNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group_name_filter = None + self._group_type = None + self._owner_id = None + self.discriminator = None + if entity_group_name_filter is not None: + self.entity_group_name_filter = entity_group_name_filter + if group_type is not None: + self.group_type = group_type + if owner_id is not None: + self.owner_id = owner_id + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group_name_filter(self): + """Gets the entity_group_name_filter of this EntitiesByGroupNameFilter. # noqa: E501 + + + :return: The entity_group_name_filter of this EntitiesByGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_group_name_filter + + @entity_group_name_filter.setter + def entity_group_name_filter(self, entity_group_name_filter): + """Sets the entity_group_name_filter of this EntitiesByGroupNameFilter. + + + :param entity_group_name_filter: The entity_group_name_filter of this EntitiesByGroupNameFilter. # noqa: E501 + :type: str + """ + + self._entity_group_name_filter = entity_group_name_filter + + @property + def group_type(self): + """Gets the group_type of this EntitiesByGroupNameFilter. # noqa: E501 + + + :return: The group_type of this EntitiesByGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntitiesByGroupNameFilter. + + + :param group_type: The group_type of this EntitiesByGroupNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + @property + def owner_id(self): + """Gets the owner_id of this EntitiesByGroupNameFilter. # noqa: E501 + + + :return: The owner_id of this EntitiesByGroupNameFilter. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntitiesByGroupNameFilter. + + + :param owner_id: The owner_id of this EntitiesByGroupNameFilter. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitiesByGroupNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitiesByGroupNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entities_limit_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/entities_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..c19769c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entities_limit_notification_rule_trigger_config.py @@ -0,0 +1,195 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class EntitiesLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'list[str]', + 'threshold': 'float', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'threshold': 'threshold', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, entity_types=None, threshold=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """EntitiesLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._threshold = None + self._trigger_type = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if threshold is not None: + self.threshold = threshold + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def threshold(self): + """Gets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: float + """ + return self._threshold + + @threshold.setter + def threshold(self, threshold): + """Sets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param threshold: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: float + """ + + self._threshold = threshold + + @property + def trigger_type(self): + """Gets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitiesLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitiesLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_action_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_action_notification_rule_trigger_config.py new file mode 100644 index 0000000..2a00ee8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_action_notification_rule_trigger_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityActionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'bool', + 'deleted': 'bool', + 'entity_types': 'list[str]', + 'trigger_type': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_types': 'entityTypes', + 'trigger_type': 'triggerType', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_types=None, trigger_type=None, updated=None): # noqa: E501 + """EntityActionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_types = None + self._trigger_type = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_types is not None: + self.entity_types = entity_types + if trigger_type is not None: + self.trigger_type = trigger_type + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityActionNotificationRuleTriggerConfig. + + + :param created: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityActionNotificationRuleTriggerConfig. + + + :param deleted: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._deleted = deleted + + @property + def entity_types(self): + """Gets the entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityActionNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def trigger_type(self): + """Gets the trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntityActionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + @property + def updated(self): + """Gets the updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityActionNotificationRuleTriggerConfig. + + + :param updated: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityActionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityActionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_count_query.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_count_query.py new file mode 100644 index 0000000..f944aaf --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_count_query.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]' + } + + attribute_map = { + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters' + } + + def __init__(self, entity_filter=None, key_filters=None): # noqa: E501 + """EntityCountQuery - a model defined in Swagger""" # noqa: E501 + self._entity_filter = None + self._key_filters = None + self.discriminator = None + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityCountQuery. # noqa: E501 + + + :return: The entity_filter of this EntityCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityCountQuery. + + + :param entity_filter: The entity_filter of this EntityCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityCountQuery. # noqa: E501 + + + :return: The key_filters of this EntityCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityCountQuery. + + + :param key_filters: The key_filters of this EntityCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_data.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_data.py new file mode 100644 index 0000000..aec6ecc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_data.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'agg_latest': 'dict(str, ComparisonTsValue)', + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'read_attrs': 'bool', + 'read_ts': 'bool', + 'timeseries': 'dict(str, list[TsValue])' + } + + attribute_map = { + 'agg_latest': 'aggLatest', + 'entity_id': 'entityId', + 'latest': 'latest', + 'read_attrs': 'readAttrs', + 'read_ts': 'readTs', + 'timeseries': 'timeseries' + } + + def __init__(self, agg_latest=None, entity_id=None, latest=None, read_attrs=None, read_ts=None, timeseries=None): # noqa: E501 + """EntityData - a model defined in Swagger""" # noqa: E501 + self._agg_latest = None + self._entity_id = None + self._latest = None + self._read_attrs = None + self._read_ts = None + self._timeseries = None + self.discriminator = None + if agg_latest is not None: + self.agg_latest = agg_latest + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if read_attrs is not None: + self.read_attrs = read_attrs + if read_ts is not None: + self.read_ts = read_ts + if timeseries is not None: + self.timeseries = timeseries + + @property + def agg_latest(self): + """Gets the agg_latest of this EntityData. # noqa: E501 + + + :return: The agg_latest of this EntityData. # noqa: E501 + :rtype: dict(str, ComparisonTsValue) + """ + return self._agg_latest + + @agg_latest.setter + def agg_latest(self, agg_latest): + """Sets the agg_latest of this EntityData. + + + :param agg_latest: The agg_latest of this EntityData. # noqa: E501 + :type: dict(str, ComparisonTsValue) + """ + + self._agg_latest = agg_latest + + @property + def entity_id(self): + """Gets the entity_id of this EntityData. # noqa: E501 + + + :return: The entity_id of this EntityData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityData. + + + :param entity_id: The entity_id of this EntityData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this EntityData. # noqa: E501 + + + :return: The latest of this EntityData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this EntityData. + + + :param latest: The latest of this EntityData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def read_attrs(self): + """Gets the read_attrs of this EntityData. # noqa: E501 + + + :return: The read_attrs of this EntityData. # noqa: E501 + :rtype: bool + """ + return self._read_attrs + + @read_attrs.setter + def read_attrs(self, read_attrs): + """Sets the read_attrs of this EntityData. + + + :param read_attrs: The read_attrs of this EntityData. # noqa: E501 + :type: bool + """ + + self._read_attrs = read_attrs + + @property + def read_ts(self): + """Gets the read_ts of this EntityData. # noqa: E501 + + + :return: The read_ts of this EntityData. # noqa: E501 + :rtype: bool + """ + return self._read_ts + + @read_ts.setter + def read_ts(self, read_ts): + """Sets the read_ts of this EntityData. + + + :param read_ts: The read_ts of this EntityData. # noqa: E501 + :type: bool + """ + + self._read_ts = read_ts + + @property + def timeseries(self): + """Gets the timeseries of this EntityData. # noqa: E501 + + + :return: The timeseries of this EntityData. # noqa: E501 + :rtype: dict(str, list[TsValue]) + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this EntityData. + + + :param timeseries: The timeseries of this EntityData. # noqa: E501 + :type: dict(str, list[TsValue]) + """ + + self._timeseries = timeseries + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_data_diff.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_diff.py new file mode 100644 index 0000000..fef6de1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_version': 'EntityExportDataobject', + 'other_version': 'EntityExportDataobject' + } + + attribute_map = { + 'current_version': 'currentVersion', + 'other_version': 'otherVersion' + } + + def __init__(self, current_version=None, other_version=None): # noqa: E501 + """EntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._current_version = None + self._other_version = None + self.discriminator = None + if current_version is not None: + self.current_version = current_version + if other_version is not None: + self.other_version = other_version + + @property + def current_version(self): + """Gets the current_version of this EntityDataDiff. # noqa: E501 + + + :return: The current_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this EntityDataDiff. + + + :param current_version: The current_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._current_version = current_version + + @property + def other_version(self): + """Gets the other_version of this EntityDataDiff. # noqa: E501 + + + :return: The other_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._other_version + + @other_version.setter + def other_version(self, other_version): + """Sets the other_version of this EntityDataDiff. + + + :param other_version: The other_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._other_version = other_version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_data_info.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_info.py new file mode 100644 index 0000000..8ba013f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_info.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'has_attributes': 'bool', + 'has_credentials': 'bool', + 'has_group_entities': 'bool', + 'has_permissions': 'bool', + 'has_relations': 'bool' + } + + attribute_map = { + 'has_attributes': 'hasAttributes', + 'has_credentials': 'hasCredentials', + 'has_group_entities': 'hasGroupEntities', + 'has_permissions': 'hasPermissions', + 'has_relations': 'hasRelations' + } + + def __init__(self, has_attributes=None, has_credentials=None, has_group_entities=None, has_permissions=None, has_relations=None): # noqa: E501 + """EntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._has_attributes = None + self._has_credentials = None + self._has_group_entities = None + self._has_permissions = None + self._has_relations = None + self.discriminator = None + if has_attributes is not None: + self.has_attributes = has_attributes + if has_credentials is not None: + self.has_credentials = has_credentials + if has_group_entities is not None: + self.has_group_entities = has_group_entities + if has_permissions is not None: + self.has_permissions = has_permissions + if has_relations is not None: + self.has_relations = has_relations + + @property + def has_attributes(self): + """Gets the has_attributes of this EntityDataInfo. # noqa: E501 + + + :return: The has_attributes of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_attributes + + @has_attributes.setter + def has_attributes(self, has_attributes): + """Sets the has_attributes of this EntityDataInfo. + + + :param has_attributes: The has_attributes of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_attributes = has_attributes + + @property + def has_credentials(self): + """Gets the has_credentials of this EntityDataInfo. # noqa: E501 + + + :return: The has_credentials of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_credentials + + @has_credentials.setter + def has_credentials(self, has_credentials): + """Sets the has_credentials of this EntityDataInfo. + + + :param has_credentials: The has_credentials of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_credentials = has_credentials + + @property + def has_group_entities(self): + """Gets the has_group_entities of this EntityDataInfo. # noqa: E501 + + + :return: The has_group_entities of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_group_entities + + @has_group_entities.setter + def has_group_entities(self, has_group_entities): + """Sets the has_group_entities of this EntityDataInfo. + + + :param has_group_entities: The has_group_entities of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_group_entities = has_group_entities + + @property + def has_permissions(self): + """Gets the has_permissions of this EntityDataInfo. # noqa: E501 + + + :return: The has_permissions of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_permissions + + @has_permissions.setter + def has_permissions(self, has_permissions): + """Sets the has_permissions of this EntityDataInfo. + + + :param has_permissions: The has_permissions of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_permissions = has_permissions + + @property + def has_relations(self): + """Gets the has_relations of this EntityDataInfo. # noqa: E501 + + + :return: The has_relations of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_relations + + @has_relations.setter + def has_relations(self, has_relations): + """Sets the has_relations of this EntityDataInfo. + + + :param has_relations: The has_relations of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_relations = has_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_data_page_link.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_page_link.py new file mode 100644 index 0000000..5d67aee --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_page_link.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic': 'bool', + 'page': 'int', + 'page_size': 'int', + 'sort_order': 'EntityDataSortOrder', + 'text_search': 'str' + } + + attribute_map = { + 'dynamic': 'dynamic', + 'page': 'page', + 'page_size': 'pageSize', + 'sort_order': 'sortOrder', + 'text_search': 'textSearch' + } + + def __init__(self, dynamic=None, page=None, page_size=None, sort_order=None, text_search=None): # noqa: E501 + """EntityDataPageLink - a model defined in Swagger""" # noqa: E501 + self._dynamic = None + self._page = None + self._page_size = None + self._sort_order = None + self._text_search = None + self.discriminator = None + if dynamic is not None: + self.dynamic = dynamic + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if sort_order is not None: + self.sort_order = sort_order + if text_search is not None: + self.text_search = text_search + + @property + def dynamic(self): + """Gets the dynamic of this EntityDataPageLink. # noqa: E501 + + + :return: The dynamic of this EntityDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this EntityDataPageLink. + + + :param dynamic: The dynamic of this EntityDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def page(self): + """Gets the page of this EntityDataPageLink. # noqa: E501 + + + :return: The page of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this EntityDataPageLink. + + + :param page: The page of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this EntityDataPageLink. # noqa: E501 + + + :return: The page_size of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this EntityDataPageLink. + + + :param page_size: The page_size of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def sort_order(self): + """Gets the sort_order of this EntityDataPageLink. # noqa: E501 + + + :return: The sort_order of this EntityDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this EntityDataPageLink. + + + :param sort_order: The sort_order of this EntityDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def text_search(self): + """Gets the text_search of this EntityDataPageLink. # noqa: E501 + + + :return: The text_search of this EntityDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this EntityDataPageLink. + + + :param text_search: The text_search of this EntityDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_data_query.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_query.py new file mode 100644 index 0000000..ffa5bda --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_query.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'EntityDataPageLink' + } + + attribute_map = { + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """EntityDataQuery - a model defined in Swagger""" # noqa: E501 + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def entity_fields(self): + """Gets the entity_fields of this EntityDataQuery. # noqa: E501 + + + :return: The entity_fields of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this EntityDataQuery. + + + :param entity_fields: The entity_fields of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityDataQuery. # noqa: E501 + + + :return: The entity_filter of this EntityDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityDataQuery. + + + :param entity_filter: The entity_filter of this EntityDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityDataQuery. # noqa: E501 + + + :return: The key_filters of this EntityDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityDataQuery. + + + :param key_filters: The key_filters of this EntityDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this EntityDataQuery. # noqa: E501 + + + :return: The latest_values of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this EntityDataQuery. + + + :param latest_values: The latest_values of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this EntityDataQuery. # noqa: E501 + + + :return: The page_link of this EntityDataQuery. # noqa: E501 + :rtype: EntityDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this EntityDataQuery. + + + :param page_link: The page_link of this EntityDataQuery. # noqa: E501 + :type: EntityDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_data_sort_order.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_sort_order.py new file mode 100644 index 0000000..d9b1c47 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_data_sort_order.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataSortOrder(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'key': 'EntityKey' + } + + attribute_map = { + 'direction': 'direction', + 'key': 'key' + } + + def __init__(self, direction=None, key=None): # noqa: E501 + """EntityDataSortOrder - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._key = None + self.discriminator = None + if direction is not None: + self.direction = direction + if key is not None: + self.key = key + + @property + def direction(self): + """Gets the direction of this EntityDataSortOrder. # noqa: E501 + + + :return: The direction of this EntityDataSortOrder. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityDataSortOrder. + + + :param direction: The direction of this EntityDataSortOrder. # noqa: E501 + :type: str + """ + allowed_values = ["ASC", "DESC"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def key(self): + """Gets the key of this EntityDataSortOrder. # noqa: E501 + + + :return: The key of this EntityDataSortOrder. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityDataSortOrder. + + + :param key: The key of this EntityDataSortOrder. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataSortOrder, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataSortOrder): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_export_dataobject.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_export_dataobject.py new file mode 100644 index 0000000..efaa132 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_export_dataobject.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityExportDataobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'object', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None): # noqa: E501 + """EntityExportDataobject - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + + @property + def attributes(self): + """Gets the attributes of this EntityExportDataobject. # noqa: E501 + + + :return: The attributes of this EntityExportDataobject. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this EntityExportDataobject. + + + :param attributes: The attributes of this EntityExportDataobject. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this EntityExportDataobject. # noqa: E501 + + + :return: The entity of this EntityExportDataobject. # noqa: E501 + :rtype: object + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this EntityExportDataobject. + + + :param entity: The entity of this EntityExportDataobject. # noqa: E501 + :type: object + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this EntityExportDataobject. # noqa: E501 + + + :return: The entity_type of this EntityExportDataobject. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityExportDataobject. + + + :param entity_type: The entity_type of this EntityExportDataobject. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this EntityExportDataobject. # noqa: E501 + + + :return: The relations of this EntityExportDataobject. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this EntityExportDataobject. + + + :param relations: The relations of this EntityExportDataobject. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityExportDataobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityExportDataobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_filter.py new file mode 100644 index 0000000..c14d5f6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """EntityFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_group.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_group.py new file mode 100644 index 0000000..88763f6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_group.py @@ -0,0 +1,348 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityGroup(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityGroupId', + 'created_time': 'int', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode', + 'group_all': 'bool', + 'edge_group_all': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration', + 'group_all': 'groupAll', + 'edge_group_all': 'edgeGroupAll' + } + + def __init__(self, id=None, created_time=None, owner_id=None, name=None, type=None, additional_info=None, configuration=None, group_all=None, edge_group_all=None): # noqa: E501 + """EntityGroup - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._owner_id = None + self._name = None + self._type = None + self._additional_info = None + self._configuration = None + self._group_all = None + self._edge_group_all = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + if group_all is not None: + self.group_all = group_all + if edge_group_all is not None: + self.edge_group_all = edge_group_all + + @property + def id(self): + """Gets the id of this EntityGroup. # noqa: E501 + + + :return: The id of this EntityGroup. # noqa: E501 + :rtype: EntityGroupId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityGroup. + + + :param id: The id of this EntityGroup. # noqa: E501 + :type: EntityGroupId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityGroup. # noqa: E501 + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityGroup. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityGroup. + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityGroup. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def owner_id(self): + """Gets the owner_id of this EntityGroup. # noqa: E501 + + + :return: The owner_id of this EntityGroup. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityGroup. + + + :param owner_id: The owner_id of this EntityGroup. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this EntityGroup. # noqa: E501 + + Name of the entity group # noqa: E501 + + :return: The name of this EntityGroup. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityGroup. + + Name of the entity group # noqa: E501 + + :param name: The name of this EntityGroup. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityGroup. # noqa: E501 + + + :return: The type of this EntityGroup. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityGroup. + + + :param type: The type of this EntityGroup. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET", "CUSTOMER", "DASHBOARD", "DEVICE", "EDGE", "ENTITY_VIEW", "USER"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def additional_info(self): + """Gets the additional_info of this EntityGroup. # noqa: E501 + + + :return: The additional_info of this EntityGroup. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityGroup. + + + :param additional_info: The additional_info of this EntityGroup. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this EntityGroup. # noqa: E501 + + + :return: The configuration of this EntityGroup. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this EntityGroup. + + + :param configuration: The configuration of this EntityGroup. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def group_all(self): + """Gets the group_all of this EntityGroup. # noqa: E501 + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The group_all of this EntityGroup. # noqa: E501 + :rtype: bool + """ + return self._group_all + + @group_all.setter + def group_all(self, group_all): + """Sets the group_all of this EntityGroup. + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param group_all: The group_all of this EntityGroup. # noqa: E501 + :type: bool + """ + + self._group_all = group_all + + @property + def edge_group_all(self): + """Gets the edge_group_all of this EntityGroup. # noqa: E501 + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The edge_group_all of this EntityGroup. # noqa: E501 + :rtype: bool + """ + return self._edge_group_all + + @edge_group_all.setter + def edge_group_all(self, edge_group_all): + """Sets the edge_group_all of this EntityGroup. + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param edge_group_all: The edge_group_all of this EntityGroup. # noqa: E501 + :type: bool + """ + + self._edge_group_all = edge_group_all + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroup, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroup): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_group_export_data.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_export_data.py new file mode 100644 index 0000000..2ddb134 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_export_data.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class EntityGroupExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'EntityGroup', + 'entity_type': 'str', + 'group_entities': 'bool', + 'permissions': 'list[GroupPermission]', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'group_entities': 'groupEntities', + 'permissions': 'permissions', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, group_entities=None, permissions=None, relations=None, *args, **kwargs): # noqa: E501 + """EntityGroupExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._group_entities = None + self._permissions = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if group_entities is not None: + self.group_entities = group_entities + if permissions is not None: + self.permissions = permissions + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this EntityGroupExportData. # noqa: E501 + + + :return: The attributes of this EntityGroupExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this EntityGroupExportData. + + + :param attributes: The attributes of this EntityGroupExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this EntityGroupExportData. # noqa: E501 + + + :return: The entity of this EntityGroupExportData. # noqa: E501 + :rtype: EntityGroup + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this EntityGroupExportData. + + + :param entity: The entity of this EntityGroupExportData. # noqa: E501 + :type: EntityGroup + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this EntityGroupExportData. # noqa: E501 + + + :return: The entity_type of this EntityGroupExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityGroupExportData. + + + :param entity_type: The entity_type of this EntityGroupExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def group_entities(self): + """Gets the group_entities of this EntityGroupExportData. # noqa: E501 + + + :return: The group_entities of this EntityGroupExportData. # noqa: E501 + :rtype: bool + """ + return self._group_entities + + @group_entities.setter + def group_entities(self, group_entities): + """Sets the group_entities of this EntityGroupExportData. + + + :param group_entities: The group_entities of this EntityGroupExportData. # noqa: E501 + :type: bool + """ + + self._group_entities = group_entities + + @property + def permissions(self): + """Gets the permissions of this EntityGroupExportData. # noqa: E501 + + + :return: The permissions of this EntityGroupExportData. # noqa: E501 + :rtype: list[GroupPermission] + """ + return self._permissions + + @permissions.setter + def permissions(self, permissions): + """Sets the permissions of this EntityGroupExportData. + + + :param permissions: The permissions of this EntityGroupExportData. # noqa: E501 + :type: list[GroupPermission] + """ + + self._permissions = permissions + + @property + def relations(self): + """Gets the relations of this EntityGroupExportData. # noqa: E501 + + + :return: The relations of this EntityGroupExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this EntityGroupExportData. + + + :param relations: The relations of this EntityGroupExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_group_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_filter.py new file mode 100644 index 0000000..f80823e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityGroupFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group': 'str', + 'group_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group': 'entityGroup', + 'group_type': 'groupType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group=None, group_type=None, *args, **kwargs): # noqa: E501 + """EntityGroupFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group = None + self._group_type = None + self.discriminator = None + if entity_group is not None: + self.entity_group = entity_group + if group_type is not None: + self.group_type = group_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group(self): + """Gets the entity_group of this EntityGroupFilter. # noqa: E501 + + + :return: The entity_group of this EntityGroupFilter. # noqa: E501 + :rtype: str + """ + return self._entity_group + + @entity_group.setter + def entity_group(self, entity_group): + """Sets the entity_group of this EntityGroupFilter. + + + :param entity_group: The entity_group of this EntityGroupFilter. # noqa: E501 + :type: str + """ + + self._entity_group = entity_group + + @property + def group_type(self): + """Gets the group_type of this EntityGroupFilter. # noqa: E501 + + + :return: The group_type of this EntityGroupFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntityGroupFilter. + + + :param group_type: The group_type of this EntityGroupFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_group_id.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_id.py new file mode 100644 index 0000000..50c0209 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityGroupId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityGroupId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityGroupId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityGroupId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityGroupId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityGroupId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ENTITY_GROUP"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_group_info.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_info.py new file mode 100644 index 0000000..9586dc2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_info.py @@ -0,0 +1,389 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityGroupInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityGroupId', + 'created_time': 'int', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode', + 'group_all': 'bool', + 'edge_group_all': 'bool', + 'external_id': 'str', + 'owner_ids': 'list[EntityId]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration', + 'group_all': 'groupAll', + 'edge_group_all': 'edgeGroupAll', + 'external_id': 'externalId', + 'owner_ids': 'ownerIds' + } + + def __init__(self, id=None, created_time=None, owner_id=None, external_id=None, name=None, type=None, additional_info=None, configuration=None, group_all=None, edge_group_all=None, owner_ids=None): # noqa: E501 + """EntityGroupInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._owner_id = None + self._name = None + self._type = None + self._additional_info = None + self._configuration = None + self._group_all = None + self._edge_group_all = None + self._owner_ids = None + self._external_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + if group_all is not None: + self.group_all = group_all + if edge_group_all is not None: + self.edge_group_all = edge_group_all + self.owner_ids = owner_ids + self.external_id = external_id + + @property + def id(self): + """Gets the id of this EntityGroupInfo. # noqa: E501 + + + :return: The id of this EntityGroupInfo. # noqa: E501 + :rtype: EntityGroupId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityGroupInfo. + + + :param id: The id of this EntityGroupInfo. # noqa: E501 + :type: EntityGroupId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityGroupInfo. # noqa: E501 + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityGroupInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityGroupInfo. + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityGroupInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def owner_id(self): + """Gets the owner_id of this EntityGroupInfo. # noqa: E501 + + + :return: The owner_id of this EntityGroupInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityGroupInfo. + + + :param owner_id: The owner_id of this EntityGroupInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this EntityGroupInfo. # noqa: E501 + + Name of the entity group # noqa: E501 + + :return: The name of this EntityGroupInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityGroupInfo. + + Name of the entity group # noqa: E501 + + :param name: The name of this EntityGroupInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityGroupInfo. # noqa: E501 + + + :return: The type of this EntityGroupInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityGroupInfo. + + + :param type: The type of this EntityGroupInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET", "CUSTOMER", "DASHBOARD", "DEVICE", "EDGE", "ENTITY_VIEW", "USER"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, value): + self._external_id = value + + @property + def additional_info(self): + """Gets the additional_info of this EntityGroupInfo. # noqa: E501 + + + :return: The additional_info of this EntityGroupInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityGroupInfo. + + + :param additional_info: The additional_info of this EntityGroupInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this EntityGroupInfo. # noqa: E501 + + + :return: The configuration of this EntityGroupInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this EntityGroupInfo. + + + :param configuration: The configuration of this EntityGroupInfo. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def group_all(self): + """Gets the group_all of this EntityGroupInfo. # noqa: E501 + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The group_all of this EntityGroupInfo. # noqa: E501 + :rtype: bool + """ + return self._group_all + + @group_all.setter + def group_all(self, group_all): + """Sets the group_all of this EntityGroupInfo. + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param group_all: The group_all of this EntityGroupInfo. # noqa: E501 + :type: bool + """ + + self._group_all = group_all + + @property + def edge_group_all(self): + """Gets the edge_group_all of this EntityGroupInfo. # noqa: E501 + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The edge_group_all of this EntityGroupInfo. # noqa: E501 + :rtype: bool + """ + return self._edge_group_all + + @edge_group_all.setter + def edge_group_all(self, edge_group_all): + """Sets the edge_group_all of this EntityGroupInfo. + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param edge_group_all: The edge_group_all of this EntityGroupInfo. # noqa: E501 + :type: bool + """ + + self._edge_group_all = edge_group_all + + @property + def owner_ids(self): + """Gets the owner_ids of this EntityGroupInfo. # noqa: E501 + + List of the entity group owners. # noqa: E501 + + :return: The owner_ids of this EntityGroupInfo. # noqa: E501 + :rtype: list[EntityId] + """ + return self._owner_ids + + @owner_ids.setter + def owner_ids(self, owner_ids): + """Sets the owner_ids of this EntityGroupInfo. + + List of the entity group owners. # noqa: E501 + + :param owner_ids: The owner_ids of this EntityGroupInfo. # noqa: E501 + :type: list[EntityId] + """ + if owner_ids is None: + raise ValueError("Invalid value for `owner_ids`, must not be `None`") # noqa: E501 + + self._owner_ids = owner_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_group_list_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_list_filter.py new file mode 100644 index 0000000..99a2a3b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_list_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityGroupListFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group_list': 'list[str]', + 'group_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group_list': 'entityGroupList', + 'group_type': 'groupType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group_list=None, group_type=None, *args, **kwargs): # noqa: E501 + """EntityGroupListFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group_list = None + self._group_type = None + self.discriminator = None + if entity_group_list is not None: + self.entity_group_list = entity_group_list + if group_type is not None: + self.group_type = group_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group_list(self): + """Gets the entity_group_list of this EntityGroupListFilter. # noqa: E501 + + + :return: The entity_group_list of this EntityGroupListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_group_list + + @entity_group_list.setter + def entity_group_list(self, entity_group_list): + """Sets the entity_group_list of this EntityGroupListFilter. + + + :param entity_group_list: The entity_group_list of this EntityGroupListFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_group_list = entity_group_list + + @property + def group_type(self): + """Gets the group_type of this EntityGroupListFilter. # noqa: E501 + + + :return: The group_type of this EntityGroupListFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntityGroupListFilter. + + + :param group_type: The group_type of this EntityGroupListFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_group_name_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_name_filter.py new file mode 100644 index 0000000..07a16df --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_group_name_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityGroupNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group_name_filter': 'str', + 'group_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group_name_filter': 'entityGroupNameFilter', + 'group_type': 'groupType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group_name_filter=None, group_type=None, *args, **kwargs): # noqa: E501 + """EntityGroupNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group_name_filter = None + self._group_type = None + self.discriminator = None + if entity_group_name_filter is not None: + self.entity_group_name_filter = entity_group_name_filter + if group_type is not None: + self.group_type = group_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group_name_filter(self): + """Gets the entity_group_name_filter of this EntityGroupNameFilter. # noqa: E501 + + + :return: The entity_group_name_filter of this EntityGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_group_name_filter + + @entity_group_name_filter.setter + def entity_group_name_filter(self, entity_group_name_filter): + """Sets the entity_group_name_filter of this EntityGroupNameFilter. + + + :param entity_group_name_filter: The entity_group_name_filter of this EntityGroupNameFilter. # noqa: E501 + :type: str + """ + + self._entity_group_name_filter = entity_group_name_filter + + @property + def group_type(self): + """Gets the group_type of this EntityGroupNameFilter. # noqa: E501 + + + :return: The group_type of this EntityGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntityGroupNameFilter. + + + :param group_type: The group_type of this EntityGroupNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_id.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_id.py new file mode 100644 index 0000000..a9aaf9b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityId. # noqa: E501 + + + :return: The entity_type of this EntityId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityId. + + + :param entity_type: The entity_type of this EntityId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_key.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_key.py new file mode 100644 index 0000000..5eca8dc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_key.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """EntityKey - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this EntityKey. # noqa: E501 + + + :return: The key of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityKey. + + + :param key: The key of this EntityKey. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this EntityKey. # noqa: E501 + + + :return: The type of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityKey. + + + :param type: The type of this EntityKey. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM_FIELD", "ATTRIBUTE", "CLIENT_ATTRIBUTE", "ENTITY_FIELD", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_list_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_list_filter.py new file mode 100644 index 0000000..73d120a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_list_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityListFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_list': 'list[str]', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_list': 'entityList', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_list=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityListFilter - a model defined in Swagger""" # noqa: E501 + self._entity_list = None + self._entity_type = None + self.discriminator = None + if entity_list is not None: + self.entity_list = entity_list + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_list(self): + """Gets the entity_list of this EntityListFilter. # noqa: E501 + + + :return: The entity_list of this EntityListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_list + + @entity_list.setter + def entity_list(self, entity_list): + """Sets the entity_list of this EntityListFilter. + + + :param entity_list: The entity_list of this EntityListFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_list = entity_list + + @property + def entity_type(self): + """Gets the entity_type of this EntityListFilter. # noqa: E501 + + + :return: The entity_type of this EntityListFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityListFilter. + + + :param entity_type: The entity_type of this EntityListFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_load_error.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_load_error.py new file mode 100644 index 0000000..06e8578 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_load_error.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityLoadError(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str', + 'source': 'EntityId', + 'target': 'EntityId', + 'type': 'str' + } + + attribute_map = { + 'message': 'message', + 'source': 'source', + 'target': 'target', + 'type': 'type' + } + + def __init__(self, message=None, source=None, target=None, type=None): # noqa: E501 + """EntityLoadError - a model defined in Swagger""" # noqa: E501 + self._message = None + self._source = None + self._target = None + self._type = None + self.discriminator = None + if message is not None: + self.message = message + if source is not None: + self.source = source + if target is not None: + self.target = target + if type is not None: + self.type = type + + @property + def message(self): + """Gets the message of this EntityLoadError. # noqa: E501 + + + :return: The message of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this EntityLoadError. + + + :param message: The message of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def source(self): + """Gets the source of this EntityLoadError. # noqa: E501 + + + :return: The source of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._source + + @source.setter + def source(self, source): + """Sets the source of this EntityLoadError. + + + :param source: The source of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._source = source + + @property + def target(self): + """Gets the target of this EntityLoadError. # noqa: E501 + + + :return: The target of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._target + + @target.setter + def target(self, target): + """Sets the target of this EntityLoadError. + + + :param target: The target of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._target = target + + @property + def type(self): + """Gets the type of this EntityLoadError. # noqa: E501 + + + :return: The type of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityLoadError. + + + :param type: The type of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityLoadError, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityLoadError): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_name_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_name_filter.py new file mode 100644 index 0000000..174ce39 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_name_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_name_filter': 'str', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_name_filter': 'entityNameFilter', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_name_filter=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_name_filter = None + self._entity_type = None + self.discriminator = None + if entity_name_filter is not None: + self.entity_name_filter = entity_name_filter + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_name_filter(self): + """Gets the entity_name_filter of this EntityNameFilter. # noqa: E501 + + + :return: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name_filter + + @entity_name_filter.setter + def entity_name_filter(self, entity_name_filter): + """Sets the entity_name_filter of this EntityNameFilter. + + + :param entity_name_filter: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :type: str + """ + + self._entity_name_filter = entity_name_filter + + @property + def entity_type(self): + """Gets the entity_type of this EntityNameFilter. # noqa: E501 + + + :return: The entity_type of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityNameFilter. + + + :param entity_type: The entity_type of this EntityNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_relation_info.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_relation_info.py new file mode 100644 index 0000000..a5ef38a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_relation_info.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_from': 'EntityId', + 'to': 'EntityId', + 'type': 'str', + 'type_group': 'str', + 'additional_info': 'JsonNode', + 'from_name': 'str', + 'to_name': 'str' + } + + attribute_map = { + '_from': 'from', + 'to': 'to', + 'type': 'type', + 'type_group': 'typeGroup', + 'additional_info': 'additionalInfo', + 'from_name': 'fromName', + 'to_name': 'toName' + } + + def __init__(self, _from=None, to=None, type=None, type_group=None, additional_info=None, from_name=None, to_name=None): # noqa: E501 + """EntityRelationInfo - a model defined in Swagger""" # noqa: E501 + self.__from = None + self._to = None + self._type = None + self._type_group = None + self._additional_info = None + self._from_name = None + self._to_name = None + self.discriminator = None + if _from is not None: + self._from = _from + if to is not None: + self.to = to + if type is not None: + self.type = type + if type_group is not None: + self.type_group = type_group + if additional_info is not None: + self.additional_info = additional_info + if from_name is not None: + self.from_name = from_name + if to_name is not None: + self.to_name = to_name + + @property + def _from(self): + """Gets the _from of this EntityRelationInfo. # noqa: E501 + + + :return: The _from of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self.__from + + @_from.setter + def _from(self, _from): + """Sets the _from of this EntityRelationInfo. + + + :param _from: The _from of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self.__from = _from + + @property + def to(self): + """Gets the to of this EntityRelationInfo. # noqa: E501 + + + :return: The to of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._to + + @to.setter + def to(self, to): + """Sets the to of this EntityRelationInfo. + + + :param to: The to of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self._to = to + + @property + def type(self): + """Gets the type of this EntityRelationInfo. # noqa: E501 + + String value of relation type. # noqa: E501 + + :return: The type of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityRelationInfo. + + String value of relation type. # noqa: E501 + + :param type: The type of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def type_group(self): + """Gets the type_group of this EntityRelationInfo. # noqa: E501 + + Represents the type group of the relation. # noqa: E501 + + :return: The type_group of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type_group + + @type_group.setter + def type_group(self, type_group): + """Sets the type_group of this EntityRelationInfo. + + Represents the type group of the relation. # noqa: E501 + + :param type_group: The type_group of this EntityRelationInfo. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "FROM_ENTITY_GROUP", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if type_group not in allowed_values: + raise ValueError( + "Invalid value for `type_group` ({0}), must be one of {1}" # noqa: E501 + .format(type_group, allowed_values) + ) + + self._type_group = type_group + + @property + def additional_info(self): + """Gets the additional_info of this EntityRelationInfo. # noqa: E501 + + + :return: The additional_info of this EntityRelationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityRelationInfo. + + + :param additional_info: The additional_info of this EntityRelationInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def from_name(self): + """Gets the from_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [from] direction. # noqa: E501 + + :return: The from_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._from_name + + @from_name.setter + def from_name(self, from_name): + """Sets the from_name of this EntityRelationInfo. + + Name of the entity for [from] direction. # noqa: E501 + + :param from_name: The from_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._from_name = from_name + + @property + def to_name(self): + """Gets the to_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [to] direction. # noqa: E501 + + :return: The to_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._to_name + + @to_name.setter + def to_name(self, to_name): + """Sets the to_name of this EntityRelationInfo. + + Name of the entity for [to] direction. # noqa: E501 + + :param to_name: The to_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._to_name = to_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_relations_query.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_relations_query.py new file mode 100644 index 0000000..1a436c3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_relations_query.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationsQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'filters': 'list[RelationEntityTypeFilter]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'filters': 'filters', + 'parameters': 'parameters' + } + + def __init__(self, filters=None, parameters=None): # noqa: E501 + """EntityRelationsQuery - a model defined in Swagger""" # noqa: E501 + self._filters = None + self._parameters = None + self.discriminator = None + if filters is not None: + self.filters = filters + if parameters is not None: + self.parameters = parameters + + @property + def filters(self): + """Gets the filters of this EntityRelationsQuery. # noqa: E501 + + Main filters. # noqa: E501 + + :return: The filters of this EntityRelationsQuery. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this EntityRelationsQuery. + + Main filters. # noqa: E501 + + :param filters: The filters of this EntityRelationsQuery. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def parameters(self): + """Gets the parameters of this EntityRelationsQuery. # noqa: E501 + + + :return: The parameters of this EntityRelationsQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityRelationsQuery. + + + :param parameters: The parameters of this EntityRelationsQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationsQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationsQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_subtype.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_subtype.py new file mode 100644 index 0000000..d42bf94 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_subtype.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntitySubtype(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str', + 'tenant_id': 'TenantId', + 'type': 'str' + } + + attribute_map = { + 'entity_type': 'entityType', + 'tenant_id': 'tenantId', + 'type': 'type' + } + + def __init__(self, entity_type=None, tenant_id=None, type=None): # noqa: E501 + """EntitySubtype - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self._tenant_id = None + self._type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + + @property + def entity_type(self): + """Gets the entity_type of this EntitySubtype. # noqa: E501 + + + :return: The entity_type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntitySubtype. + + + :param entity_type: The entity_type of this EntitySubtype. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def tenant_id(self): + """Gets the tenant_id of this EntitySubtype. # noqa: E501 + + + :return: The tenant_id of this EntitySubtype. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntitySubtype. + + + :param tenant_id: The tenant_id of this EntitySubtype. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EntitySubtype. # noqa: E501 + + + :return: The type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntitySubtype. + + + :param type: The type of this EntitySubtype. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitySubtype, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitySubtype): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_type_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_filter.py new file mode 100644 index 0000000..2806526 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_filter.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeFilter. # noqa: E501 + + + :return: The entity_type of this EntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeFilter. + + + :param entity_type: The entity_type of this EntityTypeFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_type_load_result.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_load_result.py new file mode 100644 index 0000000..d6dbac0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_load_result.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'int', + 'deleted': 'int', + 'entity_type': 'str', + 'groups_created': 'int', + 'groups_deleted': 'int', + 'groups_updated': 'int', + 'updated': 'int' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_type': 'entityType', + 'groups_created': 'groupsCreated', + 'groups_deleted': 'groupsDeleted', + 'groups_updated': 'groupsUpdated', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_type=None, groups_created=None, groups_deleted=None, groups_updated=None, updated=None): # noqa: E501 + """EntityTypeLoadResult - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_type = None + self._groups_created = None + self._groups_deleted = None + self._groups_updated = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_type is not None: + self.entity_type = entity_type + if groups_created is not None: + self.groups_created = groups_created + if groups_deleted is not None: + self.groups_deleted = groups_deleted + if groups_updated is not None: + self.groups_updated = groups_updated + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityTypeLoadResult. # noqa: E501 + + + :return: The created of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityTypeLoadResult. + + + :param created: The created of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityTypeLoadResult. # noqa: E501 + + + :return: The deleted of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityTypeLoadResult. + + + :param deleted: The deleted of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._deleted = deleted + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeLoadResult. # noqa: E501 + + + :return: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeLoadResult. + + + :param entity_type: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def groups_created(self): + """Gets the groups_created of this EntityTypeLoadResult. # noqa: E501 + + + :return: The groups_created of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._groups_created + + @groups_created.setter + def groups_created(self, groups_created): + """Sets the groups_created of this EntityTypeLoadResult. + + + :param groups_created: The groups_created of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._groups_created = groups_created + + @property + def groups_deleted(self): + """Gets the groups_deleted of this EntityTypeLoadResult. # noqa: E501 + + + :return: The groups_deleted of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._groups_deleted + + @groups_deleted.setter + def groups_deleted(self, groups_deleted): + """Sets the groups_deleted of this EntityTypeLoadResult. + + + :param groups_deleted: The groups_deleted of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._groups_deleted = groups_deleted + + @property + def groups_updated(self): + """Gets the groups_updated of this EntityTypeLoadResult. # noqa: E501 + + + :return: The groups_updated of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._groups_updated + + @groups_updated.setter + def groups_updated(self, groups_updated): + """Sets the groups_updated of this EntityTypeLoadResult. + + + :param groups_updated: The groups_updated of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._groups_updated = groups_updated + + @property + def updated(self): + """Gets the updated of this EntityTypeLoadResult. # noqa: E501 + + + :return: The updated of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityTypeLoadResult. + + + :param updated: The updated of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_create_config.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_create_config.py new file mode 100644 index 0000000..b738664 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_create_config.py @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'all_entities': 'bool', + 'entity_ids': 'list[str]', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_group_entities': 'bool', + 'save_permissions': 'bool', + 'save_relations': 'bool', + 'sync_strategy': 'str' + } + + attribute_map = { + 'all_entities': 'allEntities', + 'entity_ids': 'entityIds', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_group_entities': 'saveGroupEntities', + 'save_permissions': 'savePermissions', + 'save_relations': 'saveRelations', + 'sync_strategy': 'syncStrategy' + } + + def __init__(self, all_entities=None, entity_ids=None, save_attributes=None, save_credentials=None, save_group_entities=None, save_permissions=None, save_relations=None, sync_strategy=None): # noqa: E501 + """EntityTypeVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._all_entities = None + self._entity_ids = None + self._save_attributes = None + self._save_credentials = None + self._save_group_entities = None + self._save_permissions = None + self._save_relations = None + self._sync_strategy = None + self.discriminator = None + if all_entities is not None: + self.all_entities = all_entities + if entity_ids is not None: + self.entity_ids = entity_ids + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_group_entities is not None: + self.save_group_entities = save_group_entities + if save_permissions is not None: + self.save_permissions = save_permissions + if save_relations is not None: + self.save_relations = save_relations + if sync_strategy is not None: + self.sync_strategy = sync_strategy + + @property + def all_entities(self): + """Gets the all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._all_entities + + @all_entities.setter + def all_entities(self, all_entities): + """Sets the all_entities of this EntityTypeVersionCreateConfig. + + + :param all_entities: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._all_entities = all_entities + + @property + def entity_ids(self): + """Gets the entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_ids + + @entity_ids.setter + def entity_ids(self, entity_ids): + """Sets the entity_ids of this EntityTypeVersionCreateConfig. + + + :param entity_ids: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: list[str] + """ + + self._entity_ids = entity_ids + + @property + def save_attributes(self): + """Gets the save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this EntityTypeVersionCreateConfig. + + + :param save_attributes: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this EntityTypeVersionCreateConfig. + + + :param save_credentials: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_group_entities(self): + """Gets the save_group_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_group_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_group_entities + + @save_group_entities.setter + def save_group_entities(self, save_group_entities): + """Sets the save_group_entities of this EntityTypeVersionCreateConfig. + + + :param save_group_entities: The save_group_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_group_entities = save_group_entities + + @property + def save_permissions(self): + """Gets the save_permissions of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_permissions of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_permissions + + @save_permissions.setter + def save_permissions(self, save_permissions): + """Sets the save_permissions of this EntityTypeVersionCreateConfig. + + + :param save_permissions: The save_permissions of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_permissions = save_permissions + + @property + def save_relations(self): + """Gets the save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this EntityTypeVersionCreateConfig. + + + :param save_relations: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + @property + def sync_strategy(self): + """Gets the sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this EntityTypeVersionCreateConfig. + + + :param sync_strategy: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_load_config.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_load_config.py new file mode 100644 index 0000000..8f1975c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_load_config.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auto_generate_integration_key': 'bool', + 'find_existing_entity_by_name': 'bool', + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_group_entities': 'bool', + 'load_permissions': 'bool', + 'load_relations': 'bool', + 'remove_other_entities': 'bool' + } + + attribute_map = { + 'auto_generate_integration_key': 'autoGenerateIntegrationKey', + 'find_existing_entity_by_name': 'findExistingEntityByName', + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_group_entities': 'loadGroupEntities', + 'load_permissions': 'loadPermissions', + 'load_relations': 'loadRelations', + 'remove_other_entities': 'removeOtherEntities' + } + + def __init__(self, auto_generate_integration_key=None, find_existing_entity_by_name=None, load_attributes=None, load_credentials=None, load_group_entities=None, load_permissions=None, load_relations=None, remove_other_entities=None): # noqa: E501 + """EntityTypeVersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._auto_generate_integration_key = None + self._find_existing_entity_by_name = None + self._load_attributes = None + self._load_credentials = None + self._load_group_entities = None + self._load_permissions = None + self._load_relations = None + self._remove_other_entities = None + self.discriminator = None + if auto_generate_integration_key is not None: + self.auto_generate_integration_key = auto_generate_integration_key + if find_existing_entity_by_name is not None: + self.find_existing_entity_by_name = find_existing_entity_by_name + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_group_entities is not None: + self.load_group_entities = load_group_entities + if load_permissions is not None: + self.load_permissions = load_permissions + if load_relations is not None: + self.load_relations = load_relations + if remove_other_entities is not None: + self.remove_other_entities = remove_other_entities + + @property + def auto_generate_integration_key(self): + """Gets the auto_generate_integration_key of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The auto_generate_integration_key of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._auto_generate_integration_key + + @auto_generate_integration_key.setter + def auto_generate_integration_key(self, auto_generate_integration_key): + """Sets the auto_generate_integration_key of this EntityTypeVersionLoadConfig. + + + :param auto_generate_integration_key: The auto_generate_integration_key of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._auto_generate_integration_key = auto_generate_integration_key + + @property + def find_existing_entity_by_name(self): + """Gets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._find_existing_entity_by_name + + @find_existing_entity_by_name.setter + def find_existing_entity_by_name(self, find_existing_entity_by_name): + """Sets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. + + + :param find_existing_entity_by_name: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._find_existing_entity_by_name = find_existing_entity_by_name + + @property + def load_attributes(self): + """Gets the load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this EntityTypeVersionLoadConfig. + + + :param load_attributes: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this EntityTypeVersionLoadConfig. + + + :param load_credentials: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_group_entities(self): + """Gets the load_group_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_group_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_group_entities + + @load_group_entities.setter + def load_group_entities(self, load_group_entities): + """Sets the load_group_entities of this EntityTypeVersionLoadConfig. + + + :param load_group_entities: The load_group_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_group_entities = load_group_entities + + @property + def load_permissions(self): + """Gets the load_permissions of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_permissions of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_permissions + + @load_permissions.setter + def load_permissions(self, load_permissions): + """Sets the load_permissions of this EntityTypeVersionLoadConfig. + + + :param load_permissions: The load_permissions of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_permissions = load_permissions + + @property + def load_relations(self): + """Gets the load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this EntityTypeVersionLoadConfig. + + + :param load_relations: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + @property + def remove_other_entities(self): + """Gets the remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._remove_other_entities + + @remove_other_entities.setter + def remove_other_entities(self, remove_other_entities): + """Sets the remove_other_entities of this EntityTypeVersionLoadConfig. + + + :param remove_other_entities: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._remove_other_entities = remove_other_entities + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_load_request.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_load_request.py new file mode 100644 index 0000000..7ef10e3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_type_version_load_request.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class EntityTypeVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'dict(str, EntityTypeVersionLoadConfig)', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, entity_types=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """EntityTypeVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._type = None + self._version_id = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionLoadConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityTypeVersionLoadRequest. + + + :param entity_types: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionLoadConfig) + """ + + self._entity_types = entity_types + + @property + def type(self): + """Gets the type of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityTypeVersionLoadRequest. + + + :param type: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this EntityTypeVersionLoadRequest. + + + :param version_id: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_version.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_version.py new file mode 100644 index 0000000..f4749ce --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_version.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'author': 'str', + 'id': 'str', + 'name': 'str', + 'timestamp': 'int' + } + + attribute_map = { + 'author': 'author', + 'id': 'id', + 'name': 'name', + 'timestamp': 'timestamp' + } + + def __init__(self, author=None, id=None, name=None, timestamp=None): # noqa: E501 + """EntityVersion - a model defined in Swagger""" # noqa: E501 + self._author = None + self._id = None + self._name = None + self._timestamp = None + self.discriminator = None + if author is not None: + self.author = author + if id is not None: + self.id = id + if name is not None: + self.name = name + if timestamp is not None: + self.timestamp = timestamp + + @property + def author(self): + """Gets the author of this EntityVersion. # noqa: E501 + + + :return: The author of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._author + + @author.setter + def author(self, author): + """Sets the author of this EntityVersion. + + + :param author: The author of this EntityVersion. # noqa: E501 + :type: str + """ + + self._author = author + + @property + def id(self): + """Gets the id of this EntityVersion. # noqa: E501 + + + :return: The id of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityVersion. + + + :param id: The id of this EntityVersion. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this EntityVersion. # noqa: E501 + + + :return: The name of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityVersion. + + + :param name: The name of this EntityVersion. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def timestamp(self): + """Gets the timestamp of this EntityVersion. # noqa: E501 + + + :return: The timestamp of this EntityVersion. # noqa: E501 + :rtype: int + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this EntityVersion. + + + :param timestamp: The timestamp of this EntityVersion. # noqa: E501 + :type: int + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_view.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_view.py new file mode 100644 index 0000000..dfdeeed --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_view.py @@ -0,0 +1,436 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None, owner_id=None): # noqa: E501 + """EntityView - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self._owner_id = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this EntityView. # noqa: E501 + + + :return: The id of this EntityView. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityView. + + + :param id: The id of this EntityView. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this EntityView. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityView. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityView. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityView. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityView. # noqa: E501 + + + :return: The tenant_id of this EntityView. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityView. + + + :param tenant_id: The tenant_id of this EntityView. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityView. # noqa: E501 + + + :return: The customer_id of this EntityView. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityView. + + + :param customer_id: The customer_id of this EntityView. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityView. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityView. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityView. + + Entity View name # noqa: E501 + + :param name: The name of this EntityView. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityView. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityView. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityView. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityView. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityView. # noqa: E501 + + + :return: The entity_id of this EntityView. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityView. + + + :param entity_id: The entity_id of this EntityView. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityView. # noqa: E501 + + + :return: The keys of this EntityView. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityView. + + + :param keys: The keys of this EntityView. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityView. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityView. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityView. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityView. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityView. # noqa: E501 + + + :return: The additional_info of this EntityView. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityView. + + + :param additional_info: The additional_info of this EntityView. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this EntityView. # noqa: E501 + + + :return: The owner_id of this EntityView. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityView. + + + :param owner_id: The owner_id of this EntityView. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_view_id.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_id.py new file mode 100644 index 0000000..629f50f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityViewId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityViewId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityViewId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityViewId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityViewId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EntityViewId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ENTITY_VIEW"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_view_info.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_info.py new file mode 100644 index 0000000..9c0a738 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_info.py @@ -0,0 +1,480 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]', + 'owner_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo', + 'owner_name': 'ownerName', + 'groups': 'groups', + 'owner_id': 'ownerId' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None, owner_name=None, groups=None, owner_id=None): # noqa: E501 + """EntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self._owner_name = None + self._groups = None + self._owner_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this EntityViewInfo. # noqa: E501 + + + :return: The id of this EntityViewInfo. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewInfo. + + + :param id: The id of this EntityViewInfo. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityViewInfo. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityViewInfo. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityViewInfo. # noqa: E501 + + + :return: The tenant_id of this EntityViewInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityViewInfo. + + + :param tenant_id: The tenant_id of this EntityViewInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityViewInfo. # noqa: E501 + + + :return: The customer_id of this EntityViewInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityViewInfo. + + + :param customer_id: The customer_id of this EntityViewInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityViewInfo. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityViewInfo. + + Entity View name # noqa: E501 + + :param name: The name of this EntityViewInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityViewInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityViewInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityViewInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityViewInfo. # noqa: E501 + + + :return: The entity_id of this EntityViewInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityViewInfo. + + + :param entity_id: The entity_id of this EntityViewInfo. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityViewInfo. # noqa: E501 + + + :return: The keys of this EntityViewInfo. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityViewInfo. + + + :param keys: The keys of this EntityViewInfo. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityViewInfo. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityViewInfo. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityViewInfo. # noqa: E501 + + + :return: The additional_info of this EntityViewInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityViewInfo. + + + :param additional_info: The additional_info of this EntityViewInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_name(self): + """Gets the owner_name of this EntityViewInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this EntityViewInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this EntityViewInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this EntityViewInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this EntityViewInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this EntityViewInfo. + + Groups # noqa: E501 + + :param groups: The groups of this EntityViewInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + @property + def owner_id(self): + """Gets the owner_id of this EntityViewInfo. # noqa: E501 + + + :return: The owner_id of this EntityViewInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityViewInfo. + + + :param owner_id: The owner_id of this EntityViewInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_view_search_query.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_search_query.py new file mode 100644 index 0000000..821983c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_view_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_view_types': 'entityViewTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, entity_view_types=None, parameters=None): # noqa: E501 + """EntityViewSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_view_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQuery. # noqa: E501 + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQuery. + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param entity_view_types: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def parameters(self): + """Gets the parameters of this EntityViewSearchQuery. # noqa: E501 + + + :return: The parameters of this EntityViewSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityViewSearchQuery. + + + :param parameters: The parameters of this EntityViewSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_view_search_query_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_search_query_filter.py new file mode 100644 index 0000000..eb1243a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'entity_view_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'entity_view_types': 'entityViewTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, entity_view_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EntityViewSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._entity_view_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityViewSearchQueryFilter. + + + :param direction: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQueryFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EntityViewSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EntityViewSearchQueryFilter. + + + :param max_level: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQueryFilter. + + + :param relation_type: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EntityViewSearchQueryFilter. + + + :param root_entity: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/entity_view_type_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_type_filter.py new file mode 100644 index 0000000..0dcccba --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/entity_view_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_view_name_filter': 'str', + 'entity_view_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_view_name_filter': 'entityViewNameFilter', + 'entity_view_types': 'entityViewTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_view_name_filter=None, entity_view_types=None, *args, **kwargs): # noqa: E501 + """EntityViewTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_view_name_filter = None + self._entity_view_types = None + self.discriminator = None + if entity_view_name_filter is not None: + self.entity_view_name_filter = entity_view_name_filter + if entity_view_types is not None: + self.entity_view_types = entity_view_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_view_name_filter(self): + """Gets the entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_view_name_filter + + @entity_view_name_filter.setter + def entity_view_name_filter(self, entity_view_name_filter): + """Sets the entity_view_name_filter of this EntityViewTypeFilter. + + + :param entity_view_name_filter: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :type: str + """ + + self._entity_view_name_filter = entity_view_name_filter + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewTypeFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/error_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/error_event_filter.py new file mode 100644 index 0000000..04eb11e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/error_event_filter.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class ErrorEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'method': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'method': 'method', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, method=None, error_str=None, *args, **kwargs): # noqa: E501 + """ErrorEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._method = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if method is not None: + self.method = method + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this ErrorEventFilter. # noqa: E501 + + + :return: The not_empty of this ErrorEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this ErrorEventFilter. + + + :param not_empty: The not_empty of this ErrorEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this ErrorEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this ErrorEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this ErrorEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this ErrorEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this ErrorEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def method(self): + """Gets the method of this ErrorEventFilter. # noqa: E501 + + String value representing the method name when the error happened # noqa: E501 + + :return: The method of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._method + + @method.setter + def method(self, method): + """Sets the method of this ErrorEventFilter. + + String value representing the method name when the error happened # noqa: E501 + + :param method: The method of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._method = method + + @property + def error_str(self): + """Gets the error_str of this ErrorEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this ErrorEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ErrorEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ErrorEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/escalated_notification_rule_recipients_config.py b/billinglayer/python/tb_rest_client/models/models_pe/escalated_notification_rule_recipients_config.py new file mode 100644 index 0000000..e3987a5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/escalated_notification_rule_recipients_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EscalatedNotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'escalation_table': 'dict(str, list[str])', + 'trigger_type': 'str' + } + + attribute_map = { + 'escalation_table': 'escalationTable', + 'trigger_type': 'triggerType' + } + + def __init__(self, escalation_table=None, trigger_type=None): # noqa: E501 + """EscalatedNotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._escalation_table = None + self._trigger_type = None + self.discriminator = None + if escalation_table is not None: + self.escalation_table = escalation_table + self.trigger_type = trigger_type + + @property + def escalation_table(self): + """Gets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._escalation_table + + @escalation_table.setter + def escalation_table(self, escalation_table): + """Sets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. + + + :param escalation_table: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._escalation_table = escalation_table + + @property + def trigger_type(self): + """Gets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EscalatedNotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EscalatedNotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/event.py b/billinglayer/python/tb_rest_client/models/models_pe/event.py new file mode 100644 index 0000000..2925e8a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/event.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Event(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """Event - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this Event. # noqa: E501 + + + :return: The id of this Event. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Event. + + + :param id: The id of this Event. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this Event. # noqa: E501 + + + :return: The tenant_id of this Event. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Event. + + + :param tenant_id: The tenant_id of this Event. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this Event. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this Event. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Event. + + Event type # noqa: E501 + + :param type: The type of this Event. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this Event. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this Event. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this Event. + + string # noqa: E501 + + :param uid: The uid of this Event. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this Event. # noqa: E501 + + + :return: The entity_id of this Event. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this Event. + + + :param entity_id: The entity_id of this Event. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this Event. # noqa: E501 + + + :return: The body of this Event. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this Event. + + + :param body: The body of this Event. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this Event. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this Event. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Event. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Event. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Event, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Event): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/event_filter.py new file mode 100644 index 0000000..338afe9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/event_filter.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str' + } + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType' + } + + def __init__(self, not_empty=None, event_type=None): # noqa: E501 + """EventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + + @property + def not_empty(self): + """Gets the not_empty of this EventFilter. # noqa: E501 + + + :return: The not_empty of this EventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this EventFilter. + + + :param not_empty: The not_empty of this EventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this EventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this EventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this EventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this EventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/event_id.py b/billinglayer/python/tb_rest_client/models/models_pe/event_id.py new file mode 100644 index 0000000..63a436e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventId. + + string # noqa: E501 + + :param id: The id of this EventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/event_info.py b/billinglayer/python/tb_rest_client/models/models_pe/event_info.py new file mode 100644 index 0000000..2236301 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/event_info.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """EventInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this EventInfo. # noqa: E501 + + + :return: The id of this EventInfo. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventInfo. + + + :param id: The id of this EventInfo. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EventInfo. # noqa: E501 + + + :return: The tenant_id of this EventInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EventInfo. + + + :param tenant_id: The tenant_id of this EventInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EventInfo. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EventInfo. + + Event type # noqa: E501 + + :param type: The type of this EventInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this EventInfo. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EventInfo. + + string # noqa: E501 + + :param uid: The uid of this EventInfo. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this EventInfo. # noqa: E501 + + + :return: The entity_id of this EventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EventInfo. + + + :param entity_id: The entity_id of this EventInfo. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this EventInfo. # noqa: E501 + + + :return: The body of this EventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EventInfo. + + + :param body: The body of this EventInfo. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EventInfo. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this EventInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EventInfo. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EventInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/exportable_entity_entity_id.py b/billinglayer/python/tb_rest_client/models/models_pe/exportable_entity_entity_id.py new file mode 100644 index 0000000..085aff6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/exportable_entity_entity_id.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ExportableEntityEntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created_time': 'int', + 'id': 'EntityId', + 'name': 'str' + } + + attribute_map = { + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name' + } + + def __init__(self, created_time=None, id=None, name=None): # noqa: E501 + """ExportableEntityEntityId - a model defined in Swagger""" # noqa: E501 + self._created_time = None + self._id = None + self._name = None + self.discriminator = None + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def created_time(self): + """Gets the created_time of this ExportableEntityEntityId. # noqa: E501 + + + :return: The created_time of this ExportableEntityEntityId. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ExportableEntityEntityId. + + + :param created_time: The created_time of this ExportableEntityEntityId. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this ExportableEntityEntityId. # noqa: E501 + + + :return: The id of this ExportableEntityEntityId. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ExportableEntityEntityId. + + + :param id: The id of this ExportableEntityEntityId. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this ExportableEntityEntityId. # noqa: E501 + + + :return: The name of this ExportableEntityEntityId. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ExportableEntityEntityId. + + + :param name: The name of this ExportableEntityEntityId. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ExportableEntityEntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ExportableEntityEntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/favicon.py b/billinglayer/python/tb_rest_client/models/models_pe/favicon.py new file mode 100644 index 0000000..a28169d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/favicon.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Favicon(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'url': 'str' + } + + attribute_map = { + 'type': 'type', + 'url': 'url' + } + + def __init__(self, type=None, url=None): # noqa: E501 + """Favicon - a model defined in Swagger""" # noqa: E501 + self._type = None + self._url = None + self.discriminator = None + if type is not None: + self.type = type + if url is not None: + self.url = url + + @property + def type(self): + """Gets the type of this Favicon. # noqa: E501 + + + :return: The type of this Favicon. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Favicon. + + + :param type: The type of this Favicon. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def url(self): + """Gets the url of this Favicon. # noqa: E501 + + + :return: The url of this Favicon. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this Favicon. + + + :param url: The url of this Favicon. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Favicon, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Favicon): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/features_info.py b/billinglayer/python/tb_rest_client/models/models_pe/features_info.py new file mode 100644 index 0000000..9e86600 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/features_info.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FeaturesInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email_enabled': 'bool', + 'notification_enabled': 'bool', + 'oauth_enabled': 'bool', + 'sms_enabled': 'bool', + 'two_fa_enabled': 'bool', + 'white_labeling_enabled': 'bool' + } + + attribute_map = { + 'email_enabled': 'emailEnabled', + 'notification_enabled': 'notificationEnabled', + 'oauth_enabled': 'oauthEnabled', + 'sms_enabled': 'smsEnabled', + 'two_fa_enabled': 'twoFaEnabled', + 'white_labeling_enabled': 'whiteLabelingEnabled' + } + + def __init__(self, email_enabled=None, notification_enabled=None, oauth_enabled=None, sms_enabled=None, two_fa_enabled=None, white_labeling_enabled=None): # noqa: E501 + """FeaturesInfo - a model defined in Swagger""" # noqa: E501 + self._email_enabled = None + self._notification_enabled = None + self._oauth_enabled = None + self._sms_enabled = None + self._two_fa_enabled = None + self._white_labeling_enabled = None + self.discriminator = None + if email_enabled is not None: + self.email_enabled = email_enabled + if notification_enabled is not None: + self.notification_enabled = notification_enabled + if oauth_enabled is not None: + self.oauth_enabled = oauth_enabled + if sms_enabled is not None: + self.sms_enabled = sms_enabled + if two_fa_enabled is not None: + self.two_fa_enabled = two_fa_enabled + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + + @property + def email_enabled(self): + """Gets the email_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The email_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._email_enabled + + @email_enabled.setter + def email_enabled(self, email_enabled): + """Sets the email_enabled of this FeaturesInfo. + + + :param email_enabled: The email_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._email_enabled = email_enabled + + @property + def notification_enabled(self): + """Gets the notification_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The notification_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._notification_enabled + + @notification_enabled.setter + def notification_enabled(self, notification_enabled): + """Sets the notification_enabled of this FeaturesInfo. + + + :param notification_enabled: The notification_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._notification_enabled = notification_enabled + + @property + def oauth_enabled(self): + """Gets the oauth_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._oauth_enabled + + @oauth_enabled.setter + def oauth_enabled(self, oauth_enabled): + """Sets the oauth_enabled of this FeaturesInfo. + + + :param oauth_enabled: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._oauth_enabled = oauth_enabled + + @property + def sms_enabled(self): + """Gets the sms_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The sms_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._sms_enabled + + @sms_enabled.setter + def sms_enabled(self, sms_enabled): + """Sets the sms_enabled of this FeaturesInfo. + + + :param sms_enabled: The sms_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._sms_enabled = sms_enabled + + @property + def two_fa_enabled(self): + """Gets the two_fa_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._two_fa_enabled + + @two_fa_enabled.setter + def two_fa_enabled(self, two_fa_enabled): + """Sets the two_fa_enabled of this FeaturesInfo. + + + :param two_fa_enabled: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._two_fa_enabled = two_fa_enabled + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The white_labeling_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this FeaturesInfo. + + + :param white_labeling_enabled: The white_labeling_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FeaturesInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FeaturesInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valueboolean.py b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valueboolean.py new file mode 100644 index 0000000..fab089c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valueboolean.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'bool', + 'dynamic_value': 'DynamicValueboolean', + 'user_value': 'bool' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueboolean - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueboolean. + + + :param default_value: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: DynamicValueboolean + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueboolean. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :type: DynamicValueboolean + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueboolean. + + + :param user_value: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuedouble.py b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuedouble.py new file mode 100644 index 0000000..3467a02 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuedouble.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'float', + 'dynamic_value': 'DynamicValuedouble', + 'user_value': 'float' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuedouble - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuedouble. + + + :param default_value: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: DynamicValuedouble + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuedouble. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :type: DynamicValuedouble + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuedouble. + + + :param user_value: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valueint.py b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valueint.py new file mode 100644 index 0000000..8def90a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valueint.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValueint', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueint - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueint. + + + :param default_value: The default_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :rtype: DynamicValueint + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueint. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :type: DynamicValueint + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueint. + + + :param user_value: The user_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuelong.py b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuelong.py new file mode 100644 index 0000000..915a56a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuelong.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValuelong', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuelong - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuelong. + + + :param default_value: The default_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: DynamicValuelong + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuelong. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :type: DynamicValuelong + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuelong. + + + :param user_value: The user_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuestring.py b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuestring.py new file mode 100644 index 0000000..f7598bb --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/filter_predicate_valuestring.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'str', + 'dynamic_value': 'DynamicValuestring', + 'user_value': 'str' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuestring - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuestring. + + + :param default_value: The default_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuestring. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuestring. + + + :param user_value: The user_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/group_entity_export_data.py b/billinglayer/python/tb_rest_client/models/models_pe/group_entity_export_data.py new file mode 100644 index 0000000..f60f8a8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/group_entity_export_data.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class GroupEntityExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'ExportableEntityEntityId', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None, *args, **kwargs): # noqa: E501 + """GroupEntityExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this GroupEntityExportData. # noqa: E501 + + + :return: The attributes of this GroupEntityExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this GroupEntityExportData. + + + :param attributes: The attributes of this GroupEntityExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this GroupEntityExportData. # noqa: E501 + + + :return: The entity of this GroupEntityExportData. # noqa: E501 + :rtype: ExportableEntityEntityId + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this GroupEntityExportData. + + + :param entity: The entity of this GroupEntityExportData. # noqa: E501 + :type: ExportableEntityEntityId + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this GroupEntityExportData. # noqa: E501 + + + :return: The entity_type of this GroupEntityExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this GroupEntityExportData. + + + :param entity_type: The entity_type of this GroupEntityExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this GroupEntityExportData. # noqa: E501 + + + :return: The relations of this GroupEntityExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this GroupEntityExportData. + + + :param relations: The relations of this GroupEntityExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupEntityExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupEntityExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/group_permission.py b/billinglayer/python/tb_rest_client/models/models_pe/group_permission.py new file mode 100644 index 0000000..4da9a36 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/group_permission.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class GroupPermission(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'id': 'GroupPermissionId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'user_group_id': 'EntityGroupId', + 'role_id': 'RoleId', + 'entity_group_id': 'EntityGroupId', + 'entity_group_type': 'str', + 'name': 'str' + } + + attribute_map = { + 'public': 'public', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'user_group_id': 'userGroupId', + 'role_id': 'roleId', + 'entity_group_id': 'entityGroupId', + 'entity_group_type': 'entityGroupType', + 'name': 'name' + } + + def __init__(self, public=None, id=None, created_time=None, tenant_id=None, user_group_id=None, role_id=None, entity_group_id=None, entity_group_type=None, name=None): # noqa: E501 + """GroupPermission - a model defined in Swagger""" # noqa: E501 + self._public = None + self._id = None + self._created_time = None + self._tenant_id = None + self._user_group_id = None + self._role_id = None + self._entity_group_id = None + self._entity_group_type = None + self._name = None + self.discriminator = None + if public is not None: + self.public = public + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if user_group_id is not None: + self.user_group_id = user_group_id + if role_id is not None: + self.role_id = role_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if entity_group_type is not None: + self.entity_group_type = entity_group_type + if name is not None: + self.name = name + + @property + def public(self): + """Gets the public of this GroupPermission. # noqa: E501 + + + :return: The public of this GroupPermission. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this GroupPermission. + + + :param public: The public of this GroupPermission. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def id(self): + """Gets the id of this GroupPermission. # noqa: E501 + + + :return: The id of this GroupPermission. # noqa: E501 + :rtype: GroupPermissionId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this GroupPermission. + + + :param id: The id of this GroupPermission. # noqa: E501 + :type: GroupPermissionId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this GroupPermission. # noqa: E501 + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :return: The created_time of this GroupPermission. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this GroupPermission. + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this GroupPermission. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this GroupPermission. # noqa: E501 + + + :return: The tenant_id of this GroupPermission. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this GroupPermission. + + + :param tenant_id: The tenant_id of this GroupPermission. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def user_group_id(self): + """Gets the user_group_id of this GroupPermission. # noqa: E501 + + + :return: The user_group_id of this GroupPermission. # noqa: E501 + :rtype: EntityGroupId + """ + return self._user_group_id + + @user_group_id.setter + def user_group_id(self, user_group_id): + """Sets the user_group_id of this GroupPermission. + + + :param user_group_id: The user_group_id of this GroupPermission. # noqa: E501 + :type: EntityGroupId + """ + + self._user_group_id = user_group_id + + @property + def role_id(self): + """Gets the role_id of this GroupPermission. # noqa: E501 + + + :return: The role_id of this GroupPermission. # noqa: E501 + :rtype: RoleId + """ + return self._role_id + + @role_id.setter + def role_id(self, role_id): + """Sets the role_id of this GroupPermission. + + + :param role_id: The role_id of this GroupPermission. # noqa: E501 + :type: RoleId + """ + + self._role_id = role_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this GroupPermission. # noqa: E501 + + + :return: The entity_group_id of this GroupPermission. # noqa: E501 + :rtype: EntityGroupId + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this GroupPermission. + + + :param entity_group_id: The entity_group_id of this GroupPermission. # noqa: E501 + :type: EntityGroupId + """ + + self._entity_group_id = entity_group_id + + @property + def entity_group_type(self): + """Gets the entity_group_type of this GroupPermission. # noqa: E501 + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :return: The entity_group_type of this GroupPermission. # noqa: E501 + :rtype: str + """ + return self._entity_group_type + + @entity_group_type.setter + def entity_group_type(self, entity_group_type): + """Sets the entity_group_type of this GroupPermission. + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :param entity_group_type: The entity_group_type of this GroupPermission. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_group_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_group_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_group_type, allowed_values) + ) + + self._entity_group_type = entity_group_type + + @property + def name(self): + """Gets the name of this GroupPermission. # noqa: E501 + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :return: The name of this GroupPermission. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this GroupPermission. + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :param name: The name of this GroupPermission. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupPermission, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupPermission): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/group_permission_id.py b/billinglayer/python/tb_rest_client/models/models_pe/group_permission_id.py new file mode 100644 index 0000000..9869cc8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/group_permission_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class GroupPermissionId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """GroupPermissionId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this GroupPermissionId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this GroupPermissionId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this GroupPermissionId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this GroupPermissionId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this GroupPermissionId. # noqa: E501 + + + :return: The entity_type of this GroupPermissionId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this GroupPermissionId. + + + :param entity_type: The entity_type of this GroupPermissionId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupPermissionId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupPermissionId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/group_permission_info.py b/billinglayer/python/tb_rest_client/models/models_pe/group_permission_info.py new file mode 100644 index 0000000..bc84e3e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/group_permission_info.py @@ -0,0 +1,560 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class GroupPermissionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'read_only': 'bool', + 'id': 'GroupPermissionId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'user_group_id': 'EntityGroupId', + 'role_id': 'RoleId', + 'entity_group_id': 'EntityGroupId', + 'entity_group_type': 'str', + 'name': 'str', + 'role': 'Role', + 'entity_group_name': 'str', + 'entity_group_owner_id': 'EntityId', + 'entity_group_owner_name': 'str', + 'user_group_name': 'str', + 'user_group_owner_id': 'EntityId', + 'user_group_owner_name': 'str' + } + + attribute_map = { + 'public': 'public', + 'read_only': 'readOnly', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'user_group_id': 'userGroupId', + 'role_id': 'roleId', + 'entity_group_id': 'entityGroupId', + 'entity_group_type': 'entityGroupType', + 'name': 'name', + 'role': 'role', + 'entity_group_name': 'entityGroupName', + 'entity_group_owner_id': 'entityGroupOwnerId', + 'entity_group_owner_name': 'entityGroupOwnerName', + 'user_group_name': 'userGroupName', + 'user_group_owner_id': 'userGroupOwnerId', + 'user_group_owner_name': 'userGroupOwnerName' + } + + def __init__(self, public=None, read_only=None, id=None, created_time=None, tenant_id=None, user_group_id=None, role_id=None, entity_group_id=None, entity_group_type=None, name=None, role=None, entity_group_name=None, entity_group_owner_id=None, entity_group_owner_name=None, user_group_name=None, user_group_owner_id=None, user_group_owner_name=None): # noqa: E501 + """GroupPermissionInfo - a model defined in Swagger""" # noqa: E501 + self._public = None + self._read_only = None + self._id = None + self._created_time = None + self._tenant_id = None + self._user_group_id = None + self._role_id = None + self._entity_group_id = None + self._entity_group_type = None + self._name = None + self._role = None + self._entity_group_name = None + self._entity_group_owner_id = None + self._entity_group_owner_name = None + self._user_group_name = None + self._user_group_owner_id = None + self._user_group_owner_name = None + self.discriminator = None + if public is not None: + self.public = public + if read_only is not None: + self.read_only = read_only + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if user_group_id is not None: + self.user_group_id = user_group_id + if role_id is not None: + self.role_id = role_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if entity_group_type is not None: + self.entity_group_type = entity_group_type + if name is not None: + self.name = name + if role is not None: + self.role = role + if entity_group_name is not None: + self.entity_group_name = entity_group_name + if entity_group_owner_id is not None: + self.entity_group_owner_id = entity_group_owner_id + if entity_group_owner_name is not None: + self.entity_group_owner_name = entity_group_owner_name + if user_group_name is not None: + self.user_group_name = user_group_name + if user_group_owner_id is not None: + self.user_group_owner_id = user_group_owner_id + if user_group_owner_name is not None: + self.user_group_owner_name = user_group_owner_name + + @property + def public(self): + """Gets the public of this GroupPermissionInfo. # noqa: E501 + + + :return: The public of this GroupPermissionInfo. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this GroupPermissionInfo. + + + :param public: The public of this GroupPermissionInfo. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def read_only(self): + """Gets the read_only of this GroupPermissionInfo. # noqa: E501 + + + :return: The read_only of this GroupPermissionInfo. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this GroupPermissionInfo. + + + :param read_only: The read_only of this GroupPermissionInfo. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def id(self): + """Gets the id of this GroupPermissionInfo. # noqa: E501 + + + :return: The id of this GroupPermissionInfo. # noqa: E501 + :rtype: GroupPermissionId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this GroupPermissionInfo. + + + :param id: The id of this GroupPermissionInfo. # noqa: E501 + :type: GroupPermissionId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this GroupPermissionInfo. # noqa: E501 + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :return: The created_time of this GroupPermissionInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this GroupPermissionInfo. + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this GroupPermissionInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The tenant_id of this GroupPermissionInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this GroupPermissionInfo. + + + :param tenant_id: The tenant_id of this GroupPermissionInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def user_group_id(self): + """Gets the user_group_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The user_group_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityGroupId + """ + return self._user_group_id + + @user_group_id.setter + def user_group_id(self, user_group_id): + """Sets the user_group_id of this GroupPermissionInfo. + + + :param user_group_id: The user_group_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityGroupId + """ + + self._user_group_id = user_group_id + + @property + def role_id(self): + """Gets the role_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The role_id of this GroupPermissionInfo. # noqa: E501 + :rtype: RoleId + """ + return self._role_id + + @role_id.setter + def role_id(self, role_id): + """Sets the role_id of this GroupPermissionInfo. + + + :param role_id: The role_id of this GroupPermissionInfo. # noqa: E501 + :type: RoleId + """ + + self._role_id = role_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The entity_group_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityGroupId + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this GroupPermissionInfo. + + + :param entity_group_id: The entity_group_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityGroupId + """ + + self._entity_group_id = entity_group_id + + @property + def entity_group_type(self): + """Gets the entity_group_type of this GroupPermissionInfo. # noqa: E501 + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :return: The entity_group_type of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_group_type + + @entity_group_type.setter + def entity_group_type(self, entity_group_type): + """Sets the entity_group_type of this GroupPermissionInfo. + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :param entity_group_type: The entity_group_type of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_group_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_group_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_group_type, allowed_values) + ) + + self._entity_group_type = entity_group_type + + @property + def name(self): + """Gets the name of this GroupPermissionInfo. # noqa: E501 + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :return: The name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this GroupPermissionInfo. + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :param name: The name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def role(self): + """Gets the role of this GroupPermissionInfo. # noqa: E501 + + + :return: The role of this GroupPermissionInfo. # noqa: E501 + :rtype: Role + """ + return self._role + + @role.setter + def role(self, role): + """Sets the role of this GroupPermissionInfo. + + + :param role: The role of this GroupPermissionInfo. # noqa: E501 + :type: Role + """ + + self._role = role + + @property + def entity_group_name(self): + """Gets the entity_group_name of this GroupPermissionInfo. # noqa: E501 + + Entity Group Name. # noqa: E501 + + :return: The entity_group_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_group_name + + @entity_group_name.setter + def entity_group_name(self, entity_group_name): + """Sets the entity_group_name of this GroupPermissionInfo. + + Entity Group Name. # noqa: E501 + + :param entity_group_name: The entity_group_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._entity_group_name = entity_group_name + + @property + def entity_group_owner_id(self): + """Gets the entity_group_owner_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The entity_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_group_owner_id + + @entity_group_owner_id.setter + def entity_group_owner_id(self, entity_group_owner_id): + """Sets the entity_group_owner_id of this GroupPermissionInfo. + + + :param entity_group_owner_id: The entity_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityId + """ + + self._entity_group_owner_id = entity_group_owner_id + + @property + def entity_group_owner_name(self): + """Gets the entity_group_owner_name of this GroupPermissionInfo. # noqa: E501 + + Name of the entity group owner (Tenant or Customer title). # noqa: E501 + + :return: The entity_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_group_owner_name + + @entity_group_owner_name.setter + def entity_group_owner_name(self, entity_group_owner_name): + """Sets the entity_group_owner_name of this GroupPermissionInfo. + + Name of the entity group owner (Tenant or Customer title). # noqa: E501 + + :param entity_group_owner_name: The entity_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._entity_group_owner_name = entity_group_owner_name + + @property + def user_group_name(self): + """Gets the user_group_name of this GroupPermissionInfo. # noqa: E501 + + User Group Name. # noqa: E501 + + :return: The user_group_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._user_group_name + + @user_group_name.setter + def user_group_name(self, user_group_name): + """Sets the user_group_name of this GroupPermissionInfo. + + User Group Name. # noqa: E501 + + :param user_group_name: The user_group_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._user_group_name = user_group_name + + @property + def user_group_owner_id(self): + """Gets the user_group_owner_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The user_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityId + """ + return self._user_group_owner_id + + @user_group_owner_id.setter + def user_group_owner_id(self, user_group_owner_id): + """Sets the user_group_owner_id of this GroupPermissionInfo. + + + :param user_group_owner_id: The user_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityId + """ + + self._user_group_owner_id = user_group_owner_id + + @property + def user_group_owner_name(self): + """Gets the user_group_owner_name of this GroupPermissionInfo. # noqa: E501 + + Name of the user group owner (Tenant or Customer title). # noqa: E501 + + :return: The user_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._user_group_owner_name + + @user_group_owner_name.setter + def user_group_owner_name(self, user_group_owner_name): + """Sets the user_group_owner_name of this GroupPermissionInfo. + + Name of the user group owner (Tenant or Customer title). # noqa: E501 + + :param user_group_owner_name: The user_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._user_group_owner_name = user_group_owner_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupPermissionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupPermissionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/home_dashboard.py b/billinglayer/python/tb_rest_client/models/models_pe/home_dashboard.py new file mode 100644 index 0000000..2134628 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/home_dashboard.py @@ -0,0 +1,464 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HomeDashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'title': 'str', + 'image': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'name': 'str', + 'configuration': 'JsonNode', + 'hide_dashboard_toolbar': 'bool', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'title': 'title', + 'image': 'image', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'name': 'name', + 'configuration': 'configuration', + 'hide_dashboard_toolbar': 'hideDashboardToolbar', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, title=None, image=None, assigned_customers=None, mobile_hide=None, mobile_order=None, name=None, configuration=None, hide_dashboard_toolbar=None): # noqa: E501 + """HomeDashboard - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._title = None + self._image = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._name = None + self._configuration = None + self._hide_dashboard_toolbar = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if title is not None: + self.title = title + if image is not None: + self.image = image + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if name is not None: + self.name = name + if configuration is not None: + self.configuration = configuration + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def id(self): + """Gets the id of this HomeDashboard. # noqa: E501 + + + :return: The id of this HomeDashboard. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this HomeDashboard. + + + :param id: The id of this HomeDashboard. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this HomeDashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this HomeDashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this HomeDashboard. # noqa: E501 + + + :return: The tenant_id of this HomeDashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this HomeDashboard. + + + :param tenant_id: The tenant_id of this HomeDashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this HomeDashboard. # noqa: E501 + + + :return: The customer_id of this HomeDashboard. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this HomeDashboard. + + + :param customer_id: The customer_id of this HomeDashboard. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this HomeDashboard. # noqa: E501 + + + :return: The owner_id of this HomeDashboard. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this HomeDashboard. + + + :param owner_id: The owner_id of this HomeDashboard. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def title(self): + """Gets the title of this HomeDashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this HomeDashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this HomeDashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this HomeDashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def assigned_customers(self): + """Gets the assigned_customers of this HomeDashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this HomeDashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this HomeDashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this HomeDashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this HomeDashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this HomeDashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this HomeDashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this HomeDashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def name(self): + """Gets the name of this HomeDashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this HomeDashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def configuration(self): + """Gets the configuration of this HomeDashboard. # noqa: E501 + + + :return: The configuration of this HomeDashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this HomeDashboard. + + + :param configuration: The configuration of this HomeDashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :return: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this HomeDashboard. + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HomeDashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HomeDashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/http_routing_key_body.py b/billinglayer/python/tb_rest_client/models/models_pe/http_routing_key_body.py new file mode 100644 index 0000000..dfc6388 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/http_routing_key_body.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HttpRoutingKeyBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'request_params': 'Object' + } + + attribute_map = { + 'request_params': 'requestParams' + } + + def __init__(self, request_params=None): # noqa: E501 + """HttpRoutingKeyBody - a model defined in Swagger""" # noqa: E501 + self._request_params = None + self.discriminator = None + self.request_params = request_params + + @property + def request_params(self): + """Gets the request_params of this HttpRoutingKeyBody. # noqa: E501 + + requestParams # noqa: E501 + + :return: The request_params of this HttpRoutingKeyBody. # noqa: E501 + :rtype: Object + """ + return self._request_params + + @request_params.setter + def request_params(self, request_params): + """Sets the request_params of this HttpRoutingKeyBody. + + requestParams # noqa: E501 + + :param request_params: The request_params of this HttpRoutingKeyBody. # noqa: E501 + :type: Object + """ + if request_params is None: + raise ValueError("Invalid value for `request_params`, must not be `None`") # noqa: E501 + + self._request_params = request_params + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HttpRoutingKeyBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HttpRoutingKeyBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/input_stream.py b/billinglayer/python/tb_rest_client/models/models_pe/input_stream.py new file mode 100644 index 0000000..02d378d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/input_stream.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class InputStream(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """InputStream - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(InputStream, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, InputStream): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/integration.py b/billinglayer/python/tb_rest_client/models/models_pe/integration.py new file mode 100644 index 0000000..6ad69e5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/integration.py @@ -0,0 +1,557 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Integration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'IntegrationId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'default_converter_id': 'ConverterId', + 'downlink_converter_id': 'ConverterId', + 'routing_key': 'str', + 'type': 'str', + 'debug_mode': 'bool', + 'enabled': 'bool', + 'remote': 'bool', + 'allow_create_devices_or_assets': 'bool', + 'secret': 'str', + 'configuration': 'JsonNode', + 'additional_info': 'JsonNode', + 'name': 'str', + 'edge_template': 'bool', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'default_converter_id': 'defaultConverterId', + 'downlink_converter_id': 'downlinkConverterId', + 'routing_key': 'routingKey', + 'type': 'type', + 'debug_mode': 'debugMode', + 'enabled': 'enabled', + 'remote': 'remote', + 'allow_create_devices_or_assets': 'allowCreateDevicesOrAssets', + 'secret': 'secret', + 'configuration': 'configuration', + 'additional_info': 'additionalInfo', + 'name': 'name', + 'edge_template': 'edgeTemplate', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, default_converter_id=None, downlink_converter_id=None, routing_key=None, type=None, debug_mode=None, enabled=None, remote=None, allow_create_devices_or_assets=None, secret=None, configuration=None, additional_info=None, name=None, edge_template=None): # noqa: E501 + """Integration - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._default_converter_id = None + self._downlink_converter_id = None + self._routing_key = None + self._type = None + self._debug_mode = None + self._enabled = None + self._remote = None + self._allow_create_devices_or_assets = None + self._secret = None + self._configuration = None + self._additional_info = None + self._name = None + self._edge_template = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + self.default_converter_id = default_converter_id + if downlink_converter_id is not None: + self.downlink_converter_id = downlink_converter_id + self.routing_key = routing_key + self.type = type + if debug_mode is not None: + self.debug_mode = debug_mode + if enabled is not None: + self.enabled = enabled + if remote is not None: + self.remote = remote + if allow_create_devices_or_assets is not None: + self.allow_create_devices_or_assets = allow_create_devices_or_assets + if secret is not None: + self.secret = secret + self.configuration = configuration + if additional_info is not None: + self.additional_info = additional_info + self.name = name + if edge_template is not None: + self.edge_template = edge_template + + @property + def id(self): + """Gets the id of this Integration. # noqa: E501 + + + :return: The id of this Integration. # noqa: E501 + :rtype: IntegrationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Integration. + + + :param id: The id of this Integration. # noqa: E501 + :type: IntegrationId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Integration. # noqa: E501 + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :return: The created_time of this Integration. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Integration. + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Integration. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Integration. # noqa: E501 + + + :return: The tenant_id of this Integration. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Integration. + + + :param tenant_id: The tenant_id of this Integration. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def default_converter_id(self): + """Gets the default_converter_id of this Integration. # noqa: E501 + + + :return: The default_converter_id of this Integration. # noqa: E501 + :rtype: ConverterId + """ + return self._default_converter_id + + @default_converter_id.setter + def default_converter_id(self, default_converter_id): + """Sets the default_converter_id of this Integration. + + + :param default_converter_id: The default_converter_id of this Integration. # noqa: E501 + :type: ConverterId + """ + if default_converter_id is None: + raise ValueError("Invalid value for `default_converter_id`, must not be `None`") # noqa: E501 + + self._default_converter_id = default_converter_id + + @property + def downlink_converter_id(self): + """Gets the downlink_converter_id of this Integration. # noqa: E501 + + + :return: The downlink_converter_id of this Integration. # noqa: E501 + :rtype: ConverterId + """ + return self._downlink_converter_id + + @downlink_converter_id.setter + def downlink_converter_id(self, downlink_converter_id): + """Sets the downlink_converter_id of this Integration. + + + :param downlink_converter_id: The downlink_converter_id of this Integration. # noqa: E501 + :type: ConverterId + """ + + self._downlink_converter_id = downlink_converter_id + + @property + def routing_key(self): + """Gets the routing_key of this Integration. # noqa: E501 + + String value used by HTTP based integrations for the base URL construction and by the remote integrations. Remote integration uses this value along with the 'secret' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :return: The routing_key of this Integration. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this Integration. + + String value used by HTTP based integrations for the base URL construction and by the remote integrations. Remote integration uses this value along with the 'secret' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :param routing_key: The routing_key of this Integration. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def type(self): + """Gets the type of this Integration. # noqa: E501 + + The type of the integration # noqa: E501 + + :return: The type of this Integration. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Integration. + + The type of the integration # noqa: E501 + + :param type: The type of this Integration. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APACHE_PULSAR", "AWS_IOT", "AWS_KINESIS", "AWS_SQS", "AZURE_EVENT_HUB", "AZURE_IOT_HUB", "AZURE_SERVICE_BUS", "CHIRPSTACK", "COAP", "CUSTOM", "HTTP", "IBM_WATSON_IOT", "KAFKA", "LORIOT", "MQTT", "OCEANCONNECT", "OPC_UA", "PUB_SUB", "RABBITMQ", "SIGFOX", "TCP", "THINGPARK", "TMOBILE_IOT_CDP", "TPE", "TTI", "TTN", "TUYA", "UDP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def debug_mode(self): + """Gets the debug_mode of this Integration. # noqa: E501 + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :return: The debug_mode of this Integration. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this Integration. + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :param debug_mode: The debug_mode of this Integration. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def enabled(self): + """Gets the enabled of this Integration. # noqa: E501 + + Boolean flag to enable/disable the integration # noqa: E501 + + :return: The enabled of this Integration. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this Integration. + + Boolean flag to enable/disable the integration # noqa: E501 + + :param enabled: The enabled of this Integration. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def remote(self): + """Gets the remote of this Integration. # noqa: E501 + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :return: The remote of this Integration. # noqa: E501 + :rtype: bool + """ + return self._remote + + @remote.setter + def remote(self, remote): + """Sets the remote of this Integration. + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :param remote: The remote of this Integration. # noqa: E501 + :type: bool + """ + + self._remote = remote + + @property + def allow_create_devices_or_assets(self): + """Gets the allow_create_devices_or_assets of this Integration. # noqa: E501 + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :return: The allow_create_devices_or_assets of this Integration. # noqa: E501 + :rtype: bool + """ + return self._allow_create_devices_or_assets + + @allow_create_devices_or_assets.setter + def allow_create_devices_or_assets(self, allow_create_devices_or_assets): + """Sets the allow_create_devices_or_assets of this Integration. + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :param allow_create_devices_or_assets: The allow_create_devices_or_assets of this Integration. # noqa: E501 + :type: bool + """ + + self._allow_create_devices_or_assets = allow_create_devices_or_assets + + @property + def secret(self): + """Gets the secret of this Integration. # noqa: E501 + + String value used by the remote integrations. Remote integration uses this value along with the 'routingKey' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :return: The secret of this Integration. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this Integration. + + String value used by the remote integrations. Remote integration uses this value along with the 'routingKey' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :param secret: The secret of this Integration. # noqa: E501 + :type: str + """ + + self._secret = secret + + @property + def configuration(self): + """Gets the configuration of this Integration. # noqa: E501 + + + :return: The configuration of this Integration. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Integration. + + + :param configuration: The configuration of this Integration. # noqa: E501 + :type: JsonNode + """ + if configuration is None: + raise ValueError("Invalid value for `configuration`, must not be `None`") # noqa: E501 + + self._configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this Integration. # noqa: E501 + + + :return: The additional_info of this Integration. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Integration. + + + :param additional_info: The additional_info of this Integration. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def name(self): + """Gets the name of this Integration. # noqa: E501 + + Integration Name # noqa: E501 + + :return: The name of this Integration. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Integration. + + Integration Name # noqa: E501 + + :param name: The name of this Integration. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def edge_template(self): + """Gets the edge_template of this Integration. # noqa: E501 + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :return: The edge_template of this Integration. # noqa: E501 + :rtype: bool + """ + return self._edge_template + + @edge_template.setter + def edge_template(self, edge_template): + """Sets the edge_template of this Integration. + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :param edge_template: The edge_template of this Integration. # noqa: E501 + :type: bool + """ + + self._edge_template = edge_template + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Integration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Integration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/integration_id.py b/billinglayer/python/tb_rest_client/models/models_pe/integration_id.py new file mode 100644 index 0000000..04d0f8c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/integration_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class IntegrationId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """IntegrationId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this IntegrationId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this IntegrationId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this IntegrationId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this IntegrationId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this IntegrationId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this IntegrationId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this IntegrationId. + + string # noqa: E501 + + :param entity_type: The entity_type of this IntegrationId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["INTEGRATION"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(IntegrationId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, IntegrationId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/integration_info.py b/billinglayer/python/tb_rest_client/models/models_pe/integration_info.py new file mode 100644 index 0000000..b980418 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/integration_info.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class IntegrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'stats': 'ArrayNode', + 'status': 'ObjectNode', + 'id': 'IntegrationId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'type': 'str', + 'debug_mode': 'bool', + 'enabled': 'bool', + 'remote': 'bool', + 'allow_create_devices_or_assets': 'bool', + 'name': 'str', + 'edge_template': 'bool' + } + + attribute_map = { + 'stats': 'stats', + 'status': 'status', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'type': 'type', + 'debug_mode': 'debugMode', + 'enabled': 'enabled', + 'remote': 'remote', + 'allow_create_devices_or_assets': 'allowCreateDevicesOrAssets', + 'name': 'name', + 'edge_template': 'edgeTemplate' + } + + def __init__(self, stats=None, status=None, id=None, created_time=None, tenant_id=None, type=None, debug_mode=None, enabled=None, remote=None, allow_create_devices_or_assets=None, name=None, edge_template=None): # noqa: E501 + """IntegrationInfo - a model defined in Swagger""" # noqa: E501 + self._stats = None + self._status = None + self._id = None + self._created_time = None + self._tenant_id = None + self._type = None + self._debug_mode = None + self._enabled = None + self._remote = None + self._allow_create_devices_or_assets = None + self._name = None + self._edge_template = None + self.discriminator = None + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + self.type = type + if debug_mode is not None: + self.debug_mode = debug_mode + if enabled is not None: + self.enabled = enabled + if remote is not None: + self.remote = remote + if allow_create_devices_or_assets is not None: + self.allow_create_devices_or_assets = allow_create_devices_or_assets + self.name = name + if edge_template is not None: + self.edge_template = edge_template + + @property + def stats(self): + """Gets the stats of this IntegrationInfo. # noqa: E501 + + + :return: The stats of this IntegrationInfo. # noqa: E501 + :rtype: ArrayNode + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this IntegrationInfo. + + + :param stats: The stats of this IntegrationInfo. # noqa: E501 + :type: ArrayNode + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this IntegrationInfo. # noqa: E501 + + + :return: The status of this IntegrationInfo. # noqa: E501 + :rtype: ObjectNode + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IntegrationInfo. + + + :param status: The status of this IntegrationInfo. # noqa: E501 + :type: ObjectNode + """ + + self._status = status + + @property + def id(self): + """Gets the id of this IntegrationInfo. # noqa: E501 + + + :return: The id of this IntegrationInfo. # noqa: E501 + :rtype: IntegrationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this IntegrationInfo. + + + :param id: The id of this IntegrationInfo. # noqa: E501 + :type: IntegrationId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this IntegrationInfo. # noqa: E501 + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :return: The created_time of this IntegrationInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this IntegrationInfo. + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this IntegrationInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this IntegrationInfo. # noqa: E501 + + + :return: The tenant_id of this IntegrationInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this IntegrationInfo. + + + :param tenant_id: The tenant_id of this IntegrationInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this IntegrationInfo. # noqa: E501 + + The type of the integration # noqa: E501 + + :return: The type of this IntegrationInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this IntegrationInfo. + + The type of the integration # noqa: E501 + + :param type: The type of this IntegrationInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APACHE_PULSAR", "AWS_IOT", "AWS_KINESIS", "AWS_SQS", "AZURE_EVENT_HUB", "AZURE_IOT_HUB", "AZURE_SERVICE_BUS", "CHIRPSTACK", "COAP", "CUSTOM", "HTTP", "IBM_WATSON_IOT", "KAFKA", "LORIOT", "MQTT", "OCEANCONNECT", "OPC_UA", "PUB_SUB", "RABBITMQ", "SIGFOX", "TCP", "THINGPARK", "TMOBILE_IOT_CDP", "TPE", "TTI", "TTN", "TUYA", "UDP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def debug_mode(self): + """Gets the debug_mode of this IntegrationInfo. # noqa: E501 + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :return: The debug_mode of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this IntegrationInfo. + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :param debug_mode: The debug_mode of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def enabled(self): + """Gets the enabled of this IntegrationInfo. # noqa: E501 + + Boolean flag to enable/disable the integration # noqa: E501 + + :return: The enabled of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this IntegrationInfo. + + Boolean flag to enable/disable the integration # noqa: E501 + + :param enabled: The enabled of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def remote(self): + """Gets the remote of this IntegrationInfo. # noqa: E501 + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :return: The remote of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._remote + + @remote.setter + def remote(self, remote): + """Sets the remote of this IntegrationInfo. + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :param remote: The remote of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._remote = remote + + @property + def allow_create_devices_or_assets(self): + """Gets the allow_create_devices_or_assets of this IntegrationInfo. # noqa: E501 + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :return: The allow_create_devices_or_assets of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._allow_create_devices_or_assets + + @allow_create_devices_or_assets.setter + def allow_create_devices_or_assets(self, allow_create_devices_or_assets): + """Sets the allow_create_devices_or_assets of this IntegrationInfo. + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :param allow_create_devices_or_assets: The allow_create_devices_or_assets of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._allow_create_devices_or_assets = allow_create_devices_or_assets + + @property + def name(self): + """Gets the name of this IntegrationInfo. # noqa: E501 + + Integration Name # noqa: E501 + + :return: The name of this IntegrationInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this IntegrationInfo. + + Integration Name # noqa: E501 + + :param name: The name of this IntegrationInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def edge_template(self): + """Gets the edge_template of this IntegrationInfo. # noqa: E501 + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :return: The edge_template of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._edge_template + + @edge_template.setter + def edge_template(self, edge_template): + """Sets the edge_template of this IntegrationInfo. + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :param edge_template: The edge_template of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._edge_template = edge_template + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(IntegrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, IntegrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/integration_lifecycle_event_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/integration_lifecycle_event_notification_rule_trigger_config.py new file mode 100644 index 0000000..0cb1767 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/integration_lifecycle_event_notification_rule_trigger_config.py @@ -0,0 +1,248 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class IntegrationLifecycleEventNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'integration_types': 'list[str]', + 'integrations': 'list[str]', + 'notify_on': 'list[str]', + 'only_on_error': 'bool', + 'trigger_type': 'str' + } + + attribute_map = { + 'integration_types': 'integrationTypes', + 'integrations': 'integrations', + 'notify_on': 'notifyOn', + 'only_on_error': 'onlyOnError', + 'trigger_type': 'triggerType' + } + + def __init__(self, integration_types=None, integrations=None, notify_on=None, only_on_error=None, trigger_type=None): # noqa: E501 + """IntegrationLifecycleEventNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._integration_types = None + self._integrations = None + self._notify_on = None + self._only_on_error = None + self._trigger_type = None + self.discriminator = None + if integration_types is not None: + self.integration_types = integration_types + if integrations is not None: + self.integrations = integrations + if notify_on is not None: + self.notify_on = notify_on + if only_on_error is not None: + self.only_on_error = only_on_error + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def integration_types(self): + """Gets the integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._integration_types + + @integration_types.setter + def integration_types(self, integration_types): + """Sets the integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param integration_types: The integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["APACHE_PULSAR", "AWS_IOT", "AWS_KINESIS", "AWS_SQS", "AZURE_EVENT_HUB", "AZURE_IOT_HUB", "AZURE_SERVICE_BUS", "CHIRPSTACK", "COAP", "CUSTOM", "HTTP", "IBM_WATSON_IOT", "KAFKA", "LORIOT", "MQTT", "OCEANCONNECT", "OPC_UA", "PUB_SUB", "RABBITMQ", "SIGFOX", "TCP", "THINGPARK", "TMOBILE_IOT_CDP", "TPE", "TTI", "TTN", "TUYA", "UDP"] # noqa: E501 + if not set(integration_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `integration_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(integration_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._integration_types = integration_types + + @property + def integrations(self): + """Gets the integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._integrations + + @integrations.setter + def integrations(self, integrations): + """Sets the integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param integrations: The integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._integrations = integrations + + @property + def notify_on(self): + """Gets the notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "FAILED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def only_on_error(self): + """Gets the only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_on_error + + @only_on_error.setter + def only_on_error(self, only_on_error): + """Sets the only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param only_on_error: The only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_on_error = only_on_error + + @property + def trigger_type(self): + """Gets the trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(IntegrationLifecycleEventNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, IntegrationLifecycleEventNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/json_node.py b/billinglayer/python/tb_rest_client/models/models_pe/json_node.py new file mode 100644 index 0000000..a476292 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/json_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JsonNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """JsonNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/json_transport_payload_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/json_transport_payload_configuration.py new file mode 100644 index 0000000..dc88ec5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/json_transport_payload_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class JsonTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """JsonTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/jwt_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/jwt_settings.py new file mode 100644 index 0000000..b1af7ce --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/jwt_settings.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JWTSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token_expiration_time': 'int', + 'refresh_token_exp_time': 'int', + 'token_issuer': 'str', + 'token_signing_key': 'str' + } + + attribute_map = { + 'token_expiration_time': 'tokenExpirationTime', + 'refresh_token_exp_time': 'refreshTokenExpTime', + 'token_issuer': 'tokenIssuer', + 'token_signing_key': 'tokenSigningKey' + } + + def __init__(self, token_expiration_time=None, refresh_token_exp_time=None, token_issuer=None, token_signing_key=None): # noqa: E501 + """JWTSettings - a model defined in Swagger""" # noqa: E501 + self._token_expiration_time = None + self._refresh_token_exp_time = None + self._token_issuer = None + self._token_signing_key = None + self.discriminator = None + if token_expiration_time is not None: + self.token_expiration_time = token_expiration_time + if refresh_token_exp_time is not None: + self.refresh_token_exp_time = refresh_token_exp_time + if token_issuer is not None: + self.token_issuer = token_issuer + if token_signing_key is not None: + self.token_signing_key = token_signing_key + + @property + def token_expiration_time(self): + """Gets the token_expiration_time of this JWTSettings. # noqa: E501 + + The JWT will expire after seconds. # noqa: E501 + + :return: The token_expiration_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._token_expiration_time + + @token_expiration_time.setter + def token_expiration_time(self, token_expiration_time): + """Sets the token_expiration_time of this JWTSettings. + + The JWT will expire after seconds. # noqa: E501 + + :param token_expiration_time: The token_expiration_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._token_expiration_time = token_expiration_time + + @property + def refresh_token_exp_time(self): + """Gets the refresh_token_exp_time of this JWTSettings. # noqa: E501 + + The JWT can be refreshed during seconds. # noqa: E501 + + :return: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._refresh_token_exp_time + + @refresh_token_exp_time.setter + def refresh_token_exp_time(self, refresh_token_exp_time): + """Sets the refresh_token_exp_time of this JWTSettings. + + The JWT can be refreshed during seconds. # noqa: E501 + + :param refresh_token_exp_time: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._refresh_token_exp_time = refresh_token_exp_time + + @property + def token_issuer(self): + """Gets the token_issuer of this JWTSettings. # noqa: E501 + + The JWT issuer. # noqa: E501 + + :return: The token_issuer of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_issuer + + @token_issuer.setter + def token_issuer(self, token_issuer): + """Sets the token_issuer of this JWTSettings. + + The JWT issuer. # noqa: E501 + + :param token_issuer: The token_issuer of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_issuer = token_issuer + + @property + def token_signing_key(self): + """Gets the token_signing_key of this JWTSettings. # noqa: E501 + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :return: The token_signing_key of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_signing_key + + @token_signing_key.setter + def token_signing_key(self, token_signing_key): + """Sets the token_signing_key of this JWTSettings. + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :param token_signing_key: The token_signing_key of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_signing_key = token_signing_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JWTSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JWTSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/key_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/key_filter.py new file mode 100644 index 0000000..b904bcd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/key_filter.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'EntityKey', + 'predicate': 'KeyFilterPredicate', + 'value_type': 'str' + } + + attribute_map = { + 'key': 'key', + 'predicate': 'predicate', + 'value_type': 'valueType' + } + + def __init__(self, key=None, predicate=None, value_type=None): # noqa: E501 + """KeyFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._predicate = None + self._value_type = None + self.discriminator = None + if key is not None: + self.key = key + if predicate is not None: + self.predicate = predicate + if value_type is not None: + self.value_type = value_type + + @property + def key(self): + """Gets the key of this KeyFilter. # noqa: E501 + + + :return: The key of this KeyFilter. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this KeyFilter. + + + :param key: The key of this KeyFilter. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + @property + def predicate(self): + """Gets the predicate of this KeyFilter. # noqa: E501 + + + :return: The predicate of this KeyFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this KeyFilter. + + + :param predicate: The predicate of this KeyFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + @property + def value_type(self): + """Gets the value_type of this KeyFilter. # noqa: E501 + + + :return: The value_type of this KeyFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this KeyFilter. + + + :param value_type: The value_type of this KeyFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/key_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_pe/key_filter_predicate.py new file mode 100644 index 0000000..c03c5dd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/key_filter_predicate.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilterPredicate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """KeyFilterPredicate - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/last_visited_dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_pe/last_visited_dashboard_info.py new file mode 100644 index 0000000..7ea0a5b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/last_visited_dashboard_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LastVisitedDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred': 'bool', + 'last_visited': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred': 'starred', + 'last_visited': 'lastVisited' + } + + def __init__(self, id=None, title=None, starred=None, last_visited=None): # noqa: E501 + """LastVisitedDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred = None + self._last_visited = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred is not None: + self.starred = starred + if last_visited is not None: + self.last_visited = last_visited + + @property + def id(self): + """Gets the id of this LastVisitedDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LastVisitedDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this LastVisitedDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this LastVisitedDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred(self): + """Gets the starred of this LastVisitedDashboardInfo. # noqa: E501 + + Starred flag # noqa: E501 + + :return: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this LastVisitedDashboardInfo. + + Starred flag # noqa: E501 + + :param starred: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :type: bool + """ + + self._starred = starred + + @property + def last_visited(self): + """Gets the last_visited of this LastVisitedDashboardInfo. # noqa: E501 + + Last visit timestamp # noqa: E501 + + :return: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._last_visited + + @last_visited.setter + def last_visited(self, last_visited): + """Sets the last_visited of this LastVisitedDashboardInfo. + + Last visit timestamp # noqa: E501 + + :param last_visited: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :type: int + """ + + self._last_visited = last_visited + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LastVisitedDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LastVisitedDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/license_usage_info.py b/billinglayer/python/tb_rest_client/models/models_pe/license_usage_info.py new file mode 100644 index 0000000..5aa179f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/license_usage_info.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LicenseUsageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assets_count': 'int', + 'dashboards_count': 'int', + 'development': 'bool', + 'devices_count': 'int', + 'integrations_count': 'int', + 'max_assets': 'int', + 'max_devices': 'int', + 'plan': 'str', + 'white_labeling_enabled': 'bool' + } + + attribute_map = { + 'assets_count': 'assetsCount', + 'dashboards_count': 'dashboardsCount', + 'development': 'development', + 'devices_count': 'devicesCount', + 'integrations_count': 'integrationsCount', + 'max_assets': 'maxAssets', + 'max_devices': 'maxDevices', + 'plan': 'plan', + 'white_labeling_enabled': 'whiteLabelingEnabled' + } + + def __init__(self, assets_count=None, dashboards_count=None, development=None, devices_count=None, integrations_count=None, max_assets=None, max_devices=None, plan=None, white_labeling_enabled=None): # noqa: E501 + """LicenseUsageInfo - a model defined in Swagger""" # noqa: E501 + self._assets_count = None + self._dashboards_count = None + self._development = None + self._devices_count = None + self._integrations_count = None + self._max_assets = None + self._max_devices = None + self._plan = None + self._white_labeling_enabled = None + self.discriminator = None + if assets_count is not None: + self.assets_count = assets_count + if dashboards_count is not None: + self.dashboards_count = dashboards_count + if development is not None: + self.development = development + if devices_count is not None: + self.devices_count = devices_count + if integrations_count is not None: + self.integrations_count = integrations_count + if max_assets is not None: + self.max_assets = max_assets + if max_devices is not None: + self.max_devices = max_devices + if plan is not None: + self.plan = plan + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + + @property + def assets_count(self): + """Gets the assets_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The assets_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._assets_count + + @assets_count.setter + def assets_count(self, assets_count): + """Sets the assets_count of this LicenseUsageInfo. + + + :param assets_count: The assets_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._assets_count = assets_count + + @property + def dashboards_count(self): + """Gets the dashboards_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The dashboards_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._dashboards_count + + @dashboards_count.setter + def dashboards_count(self, dashboards_count): + """Sets the dashboards_count of this LicenseUsageInfo. + + + :param dashboards_count: The dashboards_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._dashboards_count = dashboards_count + + @property + def development(self): + """Gets the development of this LicenseUsageInfo. # noqa: E501 + + + :return: The development of this LicenseUsageInfo. # noqa: E501 + :rtype: bool + """ + return self._development + + @development.setter + def development(self, development): + """Sets the development of this LicenseUsageInfo. + + + :param development: The development of this LicenseUsageInfo. # noqa: E501 + :type: bool + """ + + self._development = development + + @property + def devices_count(self): + """Gets the devices_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The devices_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._devices_count + + @devices_count.setter + def devices_count(self, devices_count): + """Sets the devices_count of this LicenseUsageInfo. + + + :param devices_count: The devices_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._devices_count = devices_count + + @property + def integrations_count(self): + """Gets the integrations_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The integrations_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._integrations_count + + @integrations_count.setter + def integrations_count(self, integrations_count): + """Sets the integrations_count of this LicenseUsageInfo. + + + :param integrations_count: The integrations_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._integrations_count = integrations_count + + @property + def max_assets(self): + """Gets the max_assets of this LicenseUsageInfo. # noqa: E501 + + + :return: The max_assets of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this LicenseUsageInfo. + + + :param max_assets: The max_assets of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_devices(self): + """Gets the max_devices of this LicenseUsageInfo. # noqa: E501 + + + :return: The max_devices of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this LicenseUsageInfo. + + + :param max_devices: The max_devices of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def plan(self): + """Gets the plan of this LicenseUsageInfo. # noqa: E501 + + + :return: The plan of this LicenseUsageInfo. # noqa: E501 + :rtype: str + """ + return self._plan + + @plan.setter + def plan(self, plan): + """Sets the plan of this LicenseUsageInfo. + + + :param plan: The plan of this LicenseUsageInfo. # noqa: E501 + :type: str + """ + + self._plan = plan + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this LicenseUsageInfo. # noqa: E501 + + + :return: The white_labeling_enabled of this LicenseUsageInfo. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this LicenseUsageInfo. + + + :param white_labeling_enabled: The white_labeling_enabled of this LicenseUsageInfo. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LicenseUsageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LicenseUsageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/life_cycle_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/life_cycle_event_filter.py new file mode 100644 index 0000000..e66f7f1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/life_cycle_event_filter.py @@ -0,0 +1,283 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class LifeCycleEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'event': 'str', + 'status': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'event': 'event', + 'status': 'status', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, event=None, status=None, error_str=None, *args, **kwargs): # noqa: E501 + """LifeCycleEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._event = None + self._status = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if event is not None: + self.event = event + if status is not None: + self.status = status + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this LifeCycleEventFilter. # noqa: E501 + + + :return: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this LifeCycleEventFilter. + + + :param not_empty: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this LifeCycleEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this LifeCycleEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this LifeCycleEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this LifeCycleEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def event(self): + """Gets the event of this LifeCycleEventFilter. # noqa: E501 + + String value representing the lifecycle event type # noqa: E501 + + :return: The event of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event + + @event.setter + def event(self, event): + """Sets the event of this LifeCycleEventFilter. + + String value representing the lifecycle event type # noqa: E501 + + :param event: The event of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._event = event + + @property + def status(self): + """Gets the status of this LifeCycleEventFilter. # noqa: E501 + + String value representing status of the lifecycle event # noqa: E501 + + :return: The status of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this LifeCycleEventFilter. + + String value representing status of the lifecycle event # noqa: E501 + + :param status: The status of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["Failure", "Success"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def error_str(self): + """Gets the error_str of this LifeCycleEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this LifeCycleEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LifeCycleEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LifeCycleEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/login_request.py b/billinglayer/python/tb_rest_client/models/models_pe/login_request.py new file mode 100644 index 0000000..75bddca --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/login_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'username': 'str', + 'password': 'str' + } + + attribute_map = { + 'username': 'username', + 'password': 'password' + } + + def __init__(self, username=None, password=None): # noqa: E501 + """LoginRequest - a model defined in Swagger""" # noqa: E501 + self._username = None + self._password = None + self.discriminator = None + self.username = username + self.password = password + + @property + def username(self): + """Gets the username of this LoginRequest. # noqa: E501 + + User email # noqa: E501 + + :return: The username of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this LoginRequest. + + User email # noqa: E501 + + :param username: The username of this LoginRequest. # noqa: E501 + :type: str + """ + if username is None: + raise ValueError("Invalid value for `username`, must not be `None`") # noqa: E501 + + self._username = username + + @property + def password(self): + """Gets the password of this LoginRequest. # noqa: E501 + + User password # noqa: E501 + + :return: The password of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this LoginRequest. + + User password # noqa: E501 + + :param password: The password of this LoginRequest. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/login_response.py b/billinglayer/python/tb_rest_client/models/models_pe/login_response.py new file mode 100644 index 0000000..ee50016 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/login_response.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token': 'str', + 'refresh_token': 'str' + } + + attribute_map = { + 'token': 'token', + 'refresh_token': 'refreshToken' + } + + def __init__(self, token=None, refresh_token=None): # noqa: E501 + """LoginResponse - a model defined in Swagger""" # noqa: E501 + self._token = None + self._refresh_token = None + self.discriminator = None + self.token = token + self.refresh_token = refresh_token + + @property + def token(self): + """Gets the token of this LoginResponse. # noqa: E501 + + JWT token # noqa: E501 + + :return: The token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._token + + @token.setter + def token(self, token): + """Sets the token of this LoginResponse. + + JWT token # noqa: E501 + + :param token: The token of this LoginResponse. # noqa: E501 + :type: str + """ + if token is None: + raise ValueError("Invalid value for `token`, must not be `None`") # noqa: E501 + + self._token = token + + @property + def refresh_token(self): + """Gets the refresh_token of this LoginResponse. # noqa: E501 + + Refresh token # noqa: E501 + + :return: The refresh_token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._refresh_token + + @refresh_token.setter + def refresh_token(self, refresh_token): + """Sets the refresh_token of this LoginResponse. + + Refresh token # noqa: E501 + + :param refresh_token: The refresh_token of this LoginResponse. # noqa: E501 + :type: str + """ + if refresh_token is None: + raise ValueError("Invalid value for `refresh_token`, must not be `None`") # noqa: E501 + + self._refresh_token = refresh_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/login_white_labeling_params.py b/billinglayer/python/tb_rest_client/models/models_pe/login_white_labeling_params.py new file mode 100644 index 0000000..129c308 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/login_white_labeling_params.py @@ -0,0 +1,710 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginWhiteLabelingParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'logo_image_url': 'str', + 'logo_image_checksum': 'str', + 'logo_image_height': 'int', + 'app_title': 'str', + 'favicon': 'Favicon', + 'favicon_checksum': 'str', + 'palette_settings': 'PaletteSettings', + 'help_link_base_url': 'str', + 'ui_help_base_url': 'str', + 'enable_help_links': 'bool', + 'white_labeling_enabled': 'bool', + 'show_name_version': 'bool', + 'platform_name': 'str', + 'platform_version': 'str', + 'custom_css': 'str', + 'page_background_color': 'str', + 'dark_foreground': 'bool', + 'domain_name': 'str', + 'base_url': 'str', + 'prohibit_different_url': 'bool', + 'admin_settings_id': 'str', + 'show_name_bottom': 'bool' + } + + attribute_map = { + 'logo_image_url': 'logoImageUrl', + 'logo_image_checksum': 'logoImageChecksum', + 'logo_image_height': 'logoImageHeight', + 'app_title': 'appTitle', + 'favicon': 'favicon', + 'favicon_checksum': 'faviconChecksum', + 'palette_settings': 'paletteSettings', + 'help_link_base_url': 'helpLinkBaseUrl', + 'ui_help_base_url': 'uiHelpBaseUrl', + 'enable_help_links': 'enableHelpLinks', + 'white_labeling_enabled': 'whiteLabelingEnabled', + 'show_name_version': 'showNameVersion', + 'platform_name': 'platformName', + 'platform_version': 'platformVersion', + 'custom_css': 'customCss', + 'page_background_color': 'pageBackgroundColor', + 'dark_foreground': 'darkForeground', + 'domain_name': 'domainName', + 'base_url': 'baseUrl', + 'prohibit_different_url': 'prohibitDifferentUrl', + 'admin_settings_id': 'adminSettingsId', + 'show_name_bottom': 'showNameBottom' + } + + def __init__(self, logo_image_url=None, logo_image_checksum=None, logo_image_height=None, app_title=None, favicon=None, favicon_checksum=None, palette_settings=None, help_link_base_url=None, ui_help_base_url=None, enable_help_links=None, white_labeling_enabled=None, show_name_version=None, platform_name=None, platform_version=None, custom_css=None, page_background_color=None, dark_foreground=None, domain_name=None, base_url=None, prohibit_different_url=None, admin_settings_id=None, show_name_bottom=None): # noqa: E501 + """LoginWhiteLabelingParams - a model defined in Swagger""" # noqa: E501 + self._logo_image_url = None + self._logo_image_checksum = None + self._logo_image_height = None + self._app_title = None + self._favicon = None + self._favicon_checksum = None + self._palette_settings = None + self._help_link_base_url = None + self._ui_help_base_url = None + self._enable_help_links = None + self._white_labeling_enabled = None + self._show_name_version = None + self._platform_name = None + self._platform_version = None + self._custom_css = None + self._page_background_color = None + self._dark_foreground = None + self._domain_name = None + self._base_url = None + self._prohibit_different_url = None + self._admin_settings_id = None + self._show_name_bottom = None + self.discriminator = None + if logo_image_url is not None: + self.logo_image_url = logo_image_url + if logo_image_checksum is not None: + self.logo_image_checksum = logo_image_checksum + if logo_image_height is not None: + self.logo_image_height = logo_image_height + if app_title is not None: + self.app_title = app_title + if favicon is not None: + self.favicon = favicon + if favicon_checksum is not None: + self.favicon_checksum = favicon_checksum + if palette_settings is not None: + self.palette_settings = palette_settings + if help_link_base_url is not None: + self.help_link_base_url = help_link_base_url + if ui_help_base_url is not None: + self.ui_help_base_url = ui_help_base_url + if enable_help_links is not None: + self.enable_help_links = enable_help_links + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + if show_name_version is not None: + self.show_name_version = show_name_version + if platform_name is not None: + self.platform_name = platform_name + if platform_version is not None: + self.platform_version = platform_version + if custom_css is not None: + self.custom_css = custom_css + if page_background_color is not None: + self.page_background_color = page_background_color + if dark_foreground is not None: + self.dark_foreground = dark_foreground + if domain_name is not None: + self.domain_name = domain_name + if base_url is not None: + self.base_url = base_url + if prohibit_different_url is not None: + self.prohibit_different_url = prohibit_different_url + if admin_settings_id is not None: + self.admin_settings_id = admin_settings_id + if show_name_bottom is not None: + self.show_name_bottom = show_name_bottom + + @property + def logo_image_url(self): + """Gets the logo_image_url of this LoginWhiteLabelingParams. # noqa: E501 + + Logo image URL # noqa: E501 + + :return: The logo_image_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_url + + @logo_image_url.setter + def logo_image_url(self, logo_image_url): + """Sets the logo_image_url of this LoginWhiteLabelingParams. + + Logo image URL # noqa: E501 + + :param logo_image_url: The logo_image_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_url = logo_image_url + + @property + def logo_image_checksum(self): + """Gets the logo_image_checksum of this LoginWhiteLabelingParams. # noqa: E501 + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :return: The logo_image_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_checksum + + @logo_image_checksum.setter + def logo_image_checksum(self, logo_image_checksum): + """Sets the logo_image_checksum of this LoginWhiteLabelingParams. + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :param logo_image_checksum: The logo_image_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_checksum = logo_image_checksum + + @property + def logo_image_height(self): + """Gets the logo_image_height of this LoginWhiteLabelingParams. # noqa: E501 + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :return: The logo_image_height of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: int + """ + return self._logo_image_height + + @logo_image_height.setter + def logo_image_height(self, logo_image_height): + """Sets the logo_image_height of this LoginWhiteLabelingParams. + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :param logo_image_height: The logo_image_height of this LoginWhiteLabelingParams. # noqa: E501 + :type: int + """ + + self._logo_image_height = logo_image_height + + @property + def app_title(self): + """Gets the app_title of this LoginWhiteLabelingParams. # noqa: E501 + + White-labeled name of the platform # noqa: E501 + + :return: The app_title of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._app_title + + @app_title.setter + def app_title(self, app_title): + """Sets the app_title of this LoginWhiteLabelingParams. + + White-labeled name of the platform # noqa: E501 + + :param app_title: The app_title of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._app_title = app_title + + @property + def favicon(self): + """Gets the favicon of this LoginWhiteLabelingParams. # noqa: E501 + + + :return: The favicon of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: Favicon + """ + return self._favicon + + @favicon.setter + def favicon(self, favicon): + """Sets the favicon of this LoginWhiteLabelingParams. + + + :param favicon: The favicon of this LoginWhiteLabelingParams. # noqa: E501 + :type: Favicon + """ + + self._favicon = favicon + + @property + def favicon_checksum(self): + """Gets the favicon_checksum of this LoginWhiteLabelingParams. # noqa: E501 + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :return: The favicon_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._favicon_checksum + + @favicon_checksum.setter + def favicon_checksum(self, favicon_checksum): + """Sets the favicon_checksum of this LoginWhiteLabelingParams. + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :param favicon_checksum: The favicon_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._favicon_checksum = favicon_checksum + + @property + def palette_settings(self): + """Gets the palette_settings of this LoginWhiteLabelingParams. # noqa: E501 + + + :return: The palette_settings of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: PaletteSettings + """ + return self._palette_settings + + @palette_settings.setter + def palette_settings(self, palette_settings): + """Sets the palette_settings of this LoginWhiteLabelingParams. + + + :param palette_settings: The palette_settings of this LoginWhiteLabelingParams. # noqa: E501 + :type: PaletteSettings + """ + + self._palette_settings = palette_settings + + @property + def help_link_base_url(self): + """Gets the help_link_base_url of this LoginWhiteLabelingParams. # noqa: E501 + + Base URL for help link # noqa: E501 + + :return: The help_link_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._help_link_base_url + + @help_link_base_url.setter + def help_link_base_url(self, help_link_base_url): + """Sets the help_link_base_url of this LoginWhiteLabelingParams. + + Base URL for help link # noqa: E501 + + :param help_link_base_url: The help_link_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._help_link_base_url = help_link_base_url + + @property + def ui_help_base_url(self): + """Gets the ui_help_base_url of this LoginWhiteLabelingParams. # noqa: E501 + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :return: The ui_help_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._ui_help_base_url + + @ui_help_base_url.setter + def ui_help_base_url(self, ui_help_base_url): + """Sets the ui_help_base_url of this LoginWhiteLabelingParams. + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :param ui_help_base_url: The ui_help_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._ui_help_base_url = ui_help_base_url + + @property + def enable_help_links(self): + """Gets the enable_help_links of this LoginWhiteLabelingParams. # noqa: E501 + + Enable or Disable help links # noqa: E501 + + :return: The enable_help_links of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._enable_help_links + + @enable_help_links.setter + def enable_help_links(self, enable_help_links): + """Sets the enable_help_links of this LoginWhiteLabelingParams. + + Enable or Disable help links # noqa: E501 + + :param enable_help_links: The enable_help_links of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._enable_help_links = enable_help_links + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this LoginWhiteLabelingParams. # noqa: E501 + + Enable white-labeling # noqa: E501 + + :return: The white_labeling_enabled of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this LoginWhiteLabelingParams. + + Enable white-labeling # noqa: E501 + + :param white_labeling_enabled: The white_labeling_enabled of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + @property + def show_name_version(self): + """Gets the show_name_version of this LoginWhiteLabelingParams. # noqa: E501 + + Show platform name and version on UI and login screen # noqa: E501 + + :return: The show_name_version of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._show_name_version + + @show_name_version.setter + def show_name_version(self, show_name_version): + """Sets the show_name_version of this LoginWhiteLabelingParams. + + Show platform name and version on UI and login screen # noqa: E501 + + :param show_name_version: The show_name_version of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._show_name_version = show_name_version + + @property + def platform_name(self): + """Gets the platform_name of this LoginWhiteLabelingParams. # noqa: E501 + + White-labeled platform name # noqa: E501 + + :return: The platform_name of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_name + + @platform_name.setter + def platform_name(self, platform_name): + """Sets the platform_name of this LoginWhiteLabelingParams. + + White-labeled platform name # noqa: E501 + + :param platform_name: The platform_name of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_name = platform_name + + @property + def platform_version(self): + """Gets the platform_version of this LoginWhiteLabelingParams. # noqa: E501 + + White-labeled platform version # noqa: E501 + + :return: The platform_version of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_version + + @platform_version.setter + def platform_version(self, platform_version): + """Sets the platform_version of this LoginWhiteLabelingParams. + + White-labeled platform version # noqa: E501 + + :param platform_version: The platform_version of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_version = platform_version + + @property + def custom_css(self): + """Gets the custom_css of this LoginWhiteLabelingParams. # noqa: E501 + + Custom CSS content # noqa: E501 + + :return: The custom_css of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._custom_css + + @custom_css.setter + def custom_css(self, custom_css): + """Sets the custom_css of this LoginWhiteLabelingParams. + + Custom CSS content # noqa: E501 + + :param custom_css: The custom_css of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._custom_css = custom_css + + @property + def page_background_color(self): + """Gets the page_background_color of this LoginWhiteLabelingParams. # noqa: E501 + + Login page background color # noqa: E501 + + :return: The page_background_color of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._page_background_color + + @page_background_color.setter + def page_background_color(self, page_background_color): + """Sets the page_background_color of this LoginWhiteLabelingParams. + + Login page background color # noqa: E501 + + :param page_background_color: The page_background_color of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._page_background_color = page_background_color + + @property + def dark_foreground(self): + """Gets the dark_foreground of this LoginWhiteLabelingParams. # noqa: E501 + + Enable/Disable dark foreground # noqa: E501 + + :return: The dark_foreground of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._dark_foreground + + @dark_foreground.setter + def dark_foreground(self, dark_foreground): + """Sets the dark_foreground of this LoginWhiteLabelingParams. + + Enable/Disable dark foreground # noqa: E501 + + :param dark_foreground: The dark_foreground of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._dark_foreground = dark_foreground + + @property + def domain_name(self): + """Gets the domain_name of this LoginWhiteLabelingParams. # noqa: E501 + + Domain name of the login page # noqa: E501 + + :return: The domain_name of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._domain_name + + @domain_name.setter + def domain_name(self, domain_name): + """Sets the domain_name of this LoginWhiteLabelingParams. + + Domain name of the login page # noqa: E501 + + :param domain_name: The domain_name of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._domain_name = domain_name + + @property + def base_url(self): + """Gets the base_url of this LoginWhiteLabelingParams. # noqa: E501 + + Base URL for the activation link, etc # noqa: E501 + + :return: The base_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._base_url + + @base_url.setter + def base_url(self, base_url): + """Sets the base_url of this LoginWhiteLabelingParams. + + Base URL for the activation link, etc # noqa: E501 + + :param base_url: The base_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._base_url = base_url + + @property + def prohibit_different_url(self): + """Gets the prohibit_different_url of this LoginWhiteLabelingParams. # noqa: E501 + + Prohibit use of other URLs. It is recommended to enable this setting # noqa: E501 + + :return: The prohibit_different_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._prohibit_different_url + + @prohibit_different_url.setter + def prohibit_different_url(self, prohibit_different_url): + """Sets the prohibit_different_url of this LoginWhiteLabelingParams. + + Prohibit use of other URLs. It is recommended to enable this setting # noqa: E501 + + :param prohibit_different_url: The prohibit_different_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._prohibit_different_url = prohibit_different_url + + @property + def admin_settings_id(self): + """Gets the admin_settings_id of this LoginWhiteLabelingParams. # noqa: E501 + + Id of the settings object that store this parameters # noqa: E501 + + :return: The admin_settings_id of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._admin_settings_id + + @admin_settings_id.setter + def admin_settings_id(self, admin_settings_id): + """Sets the admin_settings_id of this LoginWhiteLabelingParams. + + Id of the settings object that store this parameters # noqa: E501 + + :param admin_settings_id: The admin_settings_id of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._admin_settings_id = admin_settings_id + + @property + def show_name_bottom(self): + """Gets the show_name_bottom of this LoginWhiteLabelingParams. # noqa: E501 + + Show platform name and version on login page # noqa: E501 + + :return: The show_name_bottom of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._show_name_bottom + + @show_name_bottom.setter + def show_name_bottom(self, show_name_bottom): + """Sets the show_name_bottom of this LoginWhiteLabelingParams. + + Show platform name and version on login page # noqa: E501 + + :param show_name_bottom: The show_name_bottom of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._show_name_bottom = show_name_bottom + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginWhiteLabelingParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginWhiteLabelingParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..7ec3448 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/lw_m2_m_server_security_config_default.py b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2_m_server_security_config_default.py new file mode 100644 index 0000000..31e06fc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2_m_server_security_config_default.py @@ -0,0 +1,490 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MServerSecurityConfigDefault(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, security_host=None, security_port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """LwM2MServerSecurityConfigDefault - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this LwM2MServerSecurityConfigDefault. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this LwM2MServerSecurityConfigDefault. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this LwM2MServerSecurityConfigDefault. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this LwM2MServerSecurityConfigDefault. + + Host for 'Security' mode (DTLS) # noqa: E501 + + :param security_host: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this LwM2MServerSecurityConfigDefault. + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :param security_port: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this LwM2MServerSecurityConfigDefault. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this LwM2MServerSecurityConfigDefault. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this LwM2MServerSecurityConfigDefault. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MServerSecurityConfigDefault, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MServerSecurityConfigDefault): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_instance.py b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_instance.py new file mode 100644 index 0000000..fafd5c0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_instance.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mInstance(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'resources': 'list[LwM2mResourceObserve]' + } + + attribute_map = { + 'id': 'id', + 'resources': 'resources' + } + + def __init__(self, id=None, resources=None): # noqa: E501 + """LwM2mInstance - a model defined in Swagger""" # noqa: E501 + self._id = None + self._resources = None + self.discriminator = None + if id is not None: + self.id = id + if resources is not None: + self.resources = resources + + @property + def id(self): + """Gets the id of this LwM2mInstance. # noqa: E501 + + LwM2M Instance id. # noqa: E501 + + :return: The id of this LwM2mInstance. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mInstance. + + LwM2M Instance id. # noqa: E501 + + :param id: The id of this LwM2mInstance. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def resources(self): + """Gets the resources of this LwM2mInstance. # noqa: E501 + + LwM2M Resource observe. # noqa: E501 + + :return: The resources of this LwM2mInstance. # noqa: E501 + :rtype: list[LwM2mResourceObserve] + """ + return self._resources + + @resources.setter + def resources(self, resources): + """Sets the resources of this LwM2mInstance. + + LwM2M Resource observe. # noqa: E501 + + :param resources: The resources of this LwM2mInstance. # noqa: E501 + :type: list[LwM2mResourceObserve] + """ + + self._resources = resources + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mInstance, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mInstance): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_object.py b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_object.py new file mode 100644 index 0000000..177b339 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_object.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mObject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'key_id': 'str', + 'name': 'str', + 'multiple': 'bool', + 'mandatory': 'bool', + 'instances': 'list[LwM2mInstance]' + } + + attribute_map = { + 'id': 'id', + 'key_id': 'keyId', + 'name': 'name', + 'multiple': 'multiple', + 'mandatory': 'mandatory', + 'instances': 'instances' + } + + def __init__(self, id=None, key_id=None, name=None, multiple=None, mandatory=None, instances=None): # noqa: E501 + """LwM2mObject - a model defined in Swagger""" # noqa: E501 + self._id = None + self._key_id = None + self._name = None + self._multiple = None + self._mandatory = None + self._instances = None + self.discriminator = None + if id is not None: + self.id = id + if key_id is not None: + self.key_id = key_id + if name is not None: + self.name = name + if multiple is not None: + self.multiple = multiple + if mandatory is not None: + self.mandatory = mandatory + if instances is not None: + self.instances = instances + + @property + def id(self): + """Gets the id of this LwM2mObject. # noqa: E501 + + LwM2M Object id. # noqa: E501 + + :return: The id of this LwM2mObject. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mObject. + + LwM2M Object id. # noqa: E501 + + :param id: The id of this LwM2mObject. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def key_id(self): + """Gets the key_id of this LwM2mObject. # noqa: E501 + + LwM2M Object key id. # noqa: E501 + + :return: The key_id of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._key_id + + @key_id.setter + def key_id(self, key_id): + """Sets the key_id of this LwM2mObject. + + LwM2M Object key id. # noqa: E501 + + :param key_id: The key_id of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._key_id = key_id + + @property + def name(self): + """Gets the name of this LwM2mObject. # noqa: E501 + + LwM2M Object name. # noqa: E501 + + :return: The name of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mObject. + + LwM2M Object name. # noqa: E501 + + :param name: The name of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def multiple(self): + """Gets the multiple of this LwM2mObject. # noqa: E501 + + LwM2M Object multiple. # noqa: E501 + + :return: The multiple of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._multiple + + @multiple.setter + def multiple(self, multiple): + """Sets the multiple of this LwM2mObject. + + LwM2M Object multiple. # noqa: E501 + + :param multiple: The multiple of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._multiple = multiple + + @property + def mandatory(self): + """Gets the mandatory of this LwM2mObject. # noqa: E501 + + LwM2M Object mandatory. # noqa: E501 + + :return: The mandatory of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._mandatory + + @mandatory.setter + def mandatory(self, mandatory): + """Sets the mandatory of this LwM2mObject. + + LwM2M Object mandatory. # noqa: E501 + + :param mandatory: The mandatory of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._mandatory = mandatory + + @property + def instances(self): + """Gets the instances of this LwM2mObject. # noqa: E501 + + LwM2M Object instances. # noqa: E501 + + :return: The instances of this LwM2mObject. # noqa: E501 + :rtype: list[LwM2mInstance] + """ + return self._instances + + @instances.setter + def instances(self, instances): + """Sets the instances of this LwM2mObject. + + LwM2M Object instances. # noqa: E501 + + :param instances: The instances of this LwM2mObject. # noqa: E501 + :type: list[LwM2mInstance] + """ + + self._instances = instances + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mObject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mObject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_resource_observe.py b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_resource_observe.py new file mode 100644 index 0000000..9cbee35 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/lw_m2m_resource_observe.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mResourceObserve(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str', + 'observe': 'bool', + 'attribute': 'bool', + 'telemetry': 'bool', + 'key_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'observe': 'observe', + 'attribute': 'attribute', + 'telemetry': 'telemetry', + 'key_name': 'keyName' + } + + def __init__(self, id=None, name=None, observe=None, attribute=None, telemetry=None, key_name=None): # noqa: E501 + """LwM2mResourceObserve - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._observe = None + self._attribute = None + self._telemetry = None + self._key_name = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if observe is not None: + self.observe = observe + if attribute is not None: + self.attribute = attribute + if telemetry is not None: + self.telemetry = telemetry + if key_name is not None: + self.key_name = key_name + + @property + def id(self): + """Gets the id of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe id. # noqa: E501 + + :return: The id of this LwM2mResourceObserve. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mResourceObserve. + + LwM2M Resource Observe id. # noqa: E501 + + :param id: The id of this LwM2mResourceObserve. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def name(self): + """Gets the name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe name. # noqa: E501 + + :return: The name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mResourceObserve. + + LwM2M Resource Observe name. # noqa: E501 + + :param name: The name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def observe(self): + """Gets the observe of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe observe. # noqa: E501 + + :return: The observe of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this LwM2mResourceObserve. + + LwM2M Resource Observe observe. # noqa: E501 + + :param observe: The observe of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._observe = observe + + @property + def attribute(self): + """Gets the attribute of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe attribute. # noqa: E501 + + :return: The attribute of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this LwM2mResourceObserve. + + LwM2M Resource Observe attribute. # noqa: E501 + + :param attribute: The attribute of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._attribute = attribute + + @property + def telemetry(self): + """Gets the telemetry of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe telemetry. # noqa: E501 + + :return: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this LwM2mResourceObserve. + + LwM2M Resource Observe telemetry. # noqa: E501 + + :param telemetry: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._telemetry = telemetry + + @property + def key_name(self): + """Gets the key_name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe key name. # noqa: E501 + + :return: The key_name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this LwM2mResourceObserve. + + LwM2M Resource Observe key name. # noqa: E501 + + :param key_name: The key_name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._key_name = key_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mResourceObserve, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mResourceObserve): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/lwm2m_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/lwm2m_device_profile_transport_configuration.py new file mode 100644 index 0000000..08f1932 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/lwm2m_device_profile_transport_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap': 'list[LwM2MBootstrapServerCredential]', + 'bootstrap_server_update_enable': 'bool', + 'client_lw_m2m_settings': 'OtherConfiguration', + 'observe_attr': 'TelemetryMappingConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'bootstrap': 'bootstrap', + 'bootstrap_server_update_enable': 'bootstrapServerUpdateEnable', + 'client_lw_m2m_settings': 'clientLwM2mSettings', + 'observe_attr': 'observeAttr' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, bootstrap=None, bootstrap_server_update_enable=None, client_lw_m2m_settings=None, observe_attr=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._bootstrap = None + self._bootstrap_server_update_enable = None + self._client_lw_m2m_settings = None + self._observe_attr = None + self.discriminator = None + if bootstrap is not None: + self.bootstrap = bootstrap + if bootstrap_server_update_enable is not None: + self.bootstrap_server_update_enable = bootstrap_server_update_enable + if client_lw_m2m_settings is not None: + self.client_lw_m2m_settings = client_lw_m2m_settings + if observe_attr is not None: + self.observe_attr = observe_attr + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def bootstrap(self): + """Gets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[LwM2MBootstrapServerCredential] + """ + return self._bootstrap + + @bootstrap.setter + def bootstrap(self, bootstrap): + """Sets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[LwM2MBootstrapServerCredential] + """ + + self._bootstrap = bootstrap + + @property + def bootstrap_server_update_enable(self): + """Gets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_update_enable + + @bootstrap_server_update_enable.setter + def bootstrap_server_update_enable(self, bootstrap_server_update_enable): + """Sets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap_server_update_enable: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_update_enable = bootstrap_server_update_enable + + @property + def client_lw_m2m_settings(self): + """Gets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: OtherConfiguration + """ + return self._client_lw_m2m_settings + + @client_lw_m2m_settings.setter + def client_lw_m2m_settings(self, client_lw_m2m_settings): + """Sets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. + + + :param client_lw_m2m_settings: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: OtherConfiguration + """ + + self._client_lw_m2m_settings = client_lw_m2m_settings + + @property + def observe_attr(self): + """Gets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TelemetryMappingConfiguration + """ + return self._observe_attr + + @observe_attr.setter + def observe_attr(self, observe_attr): + """Sets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. + + + :param observe_attr: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: TelemetryMappingConfiguration + """ + + self._observe_attr = observe_attr + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/lwm2m_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/lwm2m_device_transport_configuration.py new file mode 100644 index 0000000..374377f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/lwm2m_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this Lwm2mDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/mapping.py b/billinglayer/python/tb_rest_client/models/models_pe/mapping.py new file mode 100644 index 0000000..5435a36 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/mapping.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Mapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'columns': 'list[ColumnMapping]', + 'delimiter': 'str', + 'header': 'bool', + 'update': 'bool' + } + + attribute_map = { + 'columns': 'columns', + 'delimiter': 'delimiter', + 'header': 'header', + 'update': 'update' + } + + def __init__(self, columns=None, delimiter=None, header=None, update=None): # noqa: E501 + """Mapping - a model defined in Swagger""" # noqa: E501 + self._columns = None + self._delimiter = None + self._header = None + self._update = None + self.discriminator = None + if columns is not None: + self.columns = columns + if delimiter is not None: + self.delimiter = delimiter + if header is not None: + self.header = header + if update is not None: + self.update = update + + @property + def columns(self): + """Gets the columns of this Mapping. # noqa: E501 + + + :return: The columns of this Mapping. # noqa: E501 + :rtype: list[ColumnMapping] + """ + return self._columns + + @columns.setter + def columns(self, columns): + """Sets the columns of this Mapping. + + + :param columns: The columns of this Mapping. # noqa: E501 + :type: list[ColumnMapping] + """ + + self._columns = columns + + @property + def delimiter(self): + """Gets the delimiter of this Mapping. # noqa: E501 + + + :return: The delimiter of this Mapping. # noqa: E501 + :rtype: str + """ + return self._delimiter + + @delimiter.setter + def delimiter(self, delimiter): + """Sets the delimiter of this Mapping. + + + :param delimiter: The delimiter of this Mapping. # noqa: E501 + :type: str + """ + + self._delimiter = delimiter + + @property + def header(self): + """Gets the header of this Mapping. # noqa: E501 + + + :return: The header of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._header + + @header.setter + def header(self, header): + """Sets the header of this Mapping. + + + :param header: The header of this Mapping. # noqa: E501 + :type: bool + """ + + self._header = header + + @property + def update(self): + """Gets the update of this Mapping. # noqa: E501 + + + :return: The update of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._update + + @update.setter + def update(self, update): + """Sets the update of this Mapping. + + + :param update: The update of this Mapping. # noqa: E501 + :type: bool + """ + + self._update = update + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Mapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Mapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/merged_group_permission_info.py b/billinglayer/python/tb_rest_client/models/models_pe/merged_group_permission_info.py new file mode 100644 index 0000000..67d5839 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/merged_group_permission_info.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MergedGroupPermissionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str', + 'operations': 'list[str]' + } + + attribute_map = { + 'entity_type': 'entityType', + 'operations': 'operations' + } + + def __init__(self, entity_type=None, operations=None): # noqa: E501 + """MergedGroupPermissionInfo - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self._operations = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + if operations is not None: + self.operations = operations + + @property + def entity_type(self): + """Gets the entity_type of this MergedGroupPermissionInfo. # noqa: E501 + + + :return: The entity_type of this MergedGroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this MergedGroupPermissionInfo. + + + :param entity_type: The entity_type of this MergedGroupPermissionInfo. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def operations(self): + """Gets the operations of this MergedGroupPermissionInfo. # noqa: E501 + + + :return: The operations of this MergedGroupPermissionInfo. # noqa: E501 + :rtype: list[str] + """ + return self._operations + + @operations.setter + def operations(self, operations): + """Sets the operations of this MergedGroupPermissionInfo. + + + :param operations: The operations of this MergedGroupPermissionInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._operations = operations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MergedGroupPermissionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MergedGroupPermissionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/merged_group_type_permission_info.py b/billinglayer/python/tb_rest_client/models/models_pe/merged_group_type_permission_info.py new file mode 100644 index 0000000..9a03462 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/merged_group_type_permission_info.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MergedGroupTypePermissionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'has_generic_read': 'bool', + 'entity_group_ids': 'list[EntityGroupId]' + } + + attribute_map = { + 'has_generic_read': 'hasGenericRead', + 'entity_group_ids': 'entityGroupIds' + } + + def __init__(self, has_generic_read=None, entity_group_ids=None): # noqa: E501 + """MergedGroupTypePermissionInfo - a model defined in Swagger""" # noqa: E501 + self._has_generic_read = None + self._entity_group_ids = None + self.discriminator = None + if has_generic_read is not None: + self.has_generic_read = has_generic_read + if entity_group_ids is not None: + self.entity_group_ids = entity_group_ids + + @property + def has_generic_read(self): + """Gets the has_generic_read of this MergedGroupTypePermissionInfo. # noqa: E501 + + Indicates if generic permission assigned to the user group. # noqa: E501 + + :return: The has_generic_read of this MergedGroupTypePermissionInfo. # noqa: E501 + :rtype: bool + """ + return self._has_generic_read + + @has_generic_read.setter + def has_generic_read(self, has_generic_read): + """Sets the has_generic_read of this MergedGroupTypePermissionInfo. + + Indicates if generic permission assigned to the user group. # noqa: E501 + + :param has_generic_read: The has_generic_read of this MergedGroupTypePermissionInfo. # noqa: E501 + :type: bool + """ + + self._has_generic_read = has_generic_read + + @property + def entity_group_ids(self): + """Gets the entity_group_ids of this MergedGroupTypePermissionInfo. # noqa: E501 + + List of Entity Groups in case of group roles are assigned to the user (user group) # noqa: E501 + + :return: The entity_group_ids of this MergedGroupTypePermissionInfo. # noqa: E501 + :rtype: list[EntityGroupId] + """ + return self._entity_group_ids + + @entity_group_ids.setter + def entity_group_ids(self, entity_group_ids): + """Sets the entity_group_ids of this MergedGroupTypePermissionInfo. + + List of Entity Groups in case of group roles are assigned to the user (user group) # noqa: E501 + + :param entity_group_ids: The entity_group_ids of this MergedGroupTypePermissionInfo. # noqa: E501 + :type: list[EntityGroupId] + """ + + self._entity_group_ids = entity_group_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MergedGroupTypePermissionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MergedGroupTypePermissionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/merged_user_permissions.py b/billinglayer/python/tb_rest_client/models/models_pe/merged_user_permissions.py new file mode 100644 index 0000000..aef6067 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/merged_user_permissions.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MergedUserPermissions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'generic_permissions': 'dict(str, list[str])', + 'group_permissions': 'dict(str, MergedGroupPermissionInfo)', + 'read_group_permissions': 'dict(str, MergedGroupTypePermissionInfo)', + 'read_entity_permissions': 'dict(str, MergedGroupTypePermissionInfo)', + 'read_attr_permissions': 'dict(str, MergedGroupTypePermissionInfo)', + 'read_ts_permissions': 'dict(str, MergedGroupTypePermissionInfo)' + } + + attribute_map = { + 'generic_permissions': 'genericPermissions', + 'group_permissions': 'groupPermissions', + 'read_group_permissions': 'readGroupPermissions', + 'read_entity_permissions': 'readEntityPermissions', + 'read_attr_permissions': 'readAttrPermissions', + 'read_ts_permissions': 'readTsPermissions' + } + + def __init__(self, generic_permissions=None, group_permissions=None, read_group_permissions=None, read_entity_permissions=None, read_attr_permissions=None, read_ts_permissions=None): # noqa: E501 + """MergedUserPermissions - a model defined in Swagger""" # noqa: E501 + self._generic_permissions = None + self._group_permissions = None + self._read_group_permissions = None + self._read_entity_permissions = None + self._read_attr_permissions = None + self._read_ts_permissions = None + self.discriminator = None + if generic_permissions is not None: + self.generic_permissions = generic_permissions + if group_permissions is not None: + self.group_permissions = group_permissions + if read_group_permissions is not None: + self.read_group_permissions = read_group_permissions + if read_entity_permissions is not None: + self.read_entity_permissions = read_entity_permissions + if read_attr_permissions is not None: + self.read_attr_permissions = read_attr_permissions + if read_ts_permissions is not None: + self.read_ts_permissions = read_ts_permissions + + @property + def generic_permissions(self): + """Gets the generic_permissions of this MergedUserPermissions. # noqa: E501 + + Map of permissions defined using generic roles ('Customer Administrator', etc) # noqa: E501 + + :return: The generic_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._generic_permissions + + @generic_permissions.setter + def generic_permissions(self, generic_permissions): + """Sets the generic_permissions of this MergedUserPermissions. + + Map of permissions defined using generic roles ('Customer Administrator', etc) # noqa: E501 + + :param generic_permissions: The generic_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._generic_permissions = generic_permissions + + @property + def group_permissions(self): + """Gets the group_permissions of this MergedUserPermissions. # noqa: E501 + + Map of permissions defined using group roles ('Read' or 'Write' access to specific entity group, etc) # noqa: E501 + + :return: The group_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupPermissionInfo) + """ + return self._group_permissions + + @group_permissions.setter + def group_permissions(self, group_permissions): + """Sets the group_permissions of this MergedUserPermissions. + + Map of permissions defined using group roles ('Read' or 'Write' access to specific entity group, etc) # noqa: E501 + + :param group_permissions: The group_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupPermissionInfo) + """ + + self._group_permissions = group_permissions + + @property + def read_group_permissions(self): + """Gets the read_group_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read permissions per entity type. Used on the UI to enable/disable certain components. # noqa: E501 + + :return: The read_group_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_group_permissions + + @read_group_permissions.setter + def read_group_permissions(self, read_group_permissions): + """Sets the read_group_permissions of this MergedUserPermissions. + + Map of read permissions per entity type. Used on the UI to enable/disable certain components. # noqa: E501 + + :param read_group_permissions: The read_group_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_group_permissions = read_group_permissions + + @property + def read_entity_permissions(self): + """Gets the read_entity_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read permissions per resource. Used on the UI to enable/disable certain components. # noqa: E501 + + :return: The read_entity_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_entity_permissions + + @read_entity_permissions.setter + def read_entity_permissions(self, read_entity_permissions): + """Sets the read_entity_permissions of this MergedUserPermissions. + + Map of read permissions per resource. Used on the UI to enable/disable certain components. # noqa: E501 + + :param read_entity_permissions: The read_entity_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_entity_permissions = read_entity_permissions + + @property + def read_attr_permissions(self): + """Gets the read_attr_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read entity attributes permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :return: The read_attr_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_attr_permissions + + @read_attr_permissions.setter + def read_attr_permissions(self, read_attr_permissions): + """Sets the read_attr_permissions of this MergedUserPermissions. + + Map of read entity attributes permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :param read_attr_permissions: The read_attr_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_attr_permissions = read_attr_permissions + + @property + def read_ts_permissions(self): + """Gets the read_ts_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read entity time-series permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :return: The read_ts_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_ts_permissions + + @read_ts_permissions.setter + def read_ts_permissions(self, read_ts_permissions): + """Sets the read_ts_permissions of this MergedUserPermissions. + + Map of read entity time-series permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :param read_ts_permissions: The read_ts_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_ts_permissions = read_ts_permissions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MergedUserPermissions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MergedUserPermissions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/mqtt_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/mqtt_device_profile_transport_configuration.py new file mode 100644 index 0000000..f5b6bf1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/mqtt_device_profile_transport_configuration.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MqttDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_subscribe_topic': 'str', + 'device_attributes_topic': 'str', + 'device_telemetry_topic': 'str', + 'send_ack_on_validation_exception': 'bool', + 'sparkplug': 'bool', + 'sparkplug_attributes_metric_names': 'list[str]', + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + + attribute_map = { + 'device_attributes_subscribe_topic': 'deviceAttributesSubscribeTopic', + 'device_attributes_topic': 'deviceAttributesTopic', + 'device_telemetry_topic': 'deviceTelemetryTopic', + 'send_ack_on_validation_exception': 'sendAckOnValidationException', + 'sparkplug': 'sparkplug', + 'sparkplug_attributes_metric_names': 'sparkplugAttributesMetricNames', + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + + def __init__(self, device_attributes_subscribe_topic=None, device_attributes_topic=None, device_telemetry_topic=None, send_ack_on_validation_exception=None, sparkplug=None, sparkplug_attributes_metric_names=None, transport_payload_type_configuration=None): # noqa: E501 + """MqttDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_subscribe_topic = None + self._device_attributes_topic = None + self._device_telemetry_topic = None + self._send_ack_on_validation_exception = None + self._sparkplug = None + self._sparkplug_attributes_metric_names = None + self._transport_payload_type_configuration = None + self.discriminator = None + if device_attributes_subscribe_topic is not None: + self.device_attributes_subscribe_topic = device_attributes_subscribe_topic + if device_attributes_topic is not None: + self.device_attributes_topic = device_attributes_topic + if device_telemetry_topic is not None: + self.device_telemetry_topic = device_telemetry_topic + if send_ack_on_validation_exception is not None: + self.send_ack_on_validation_exception = send_ack_on_validation_exception + if sparkplug is not None: + self.sparkplug = sparkplug + if sparkplug_attributes_metric_names is not None: + self.sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + + @property + def device_attributes_subscribe_topic(self): + """Gets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_subscribe_topic + + @device_attributes_subscribe_topic.setter + def device_attributes_subscribe_topic(self, device_attributes_subscribe_topic): + """Sets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_subscribe_topic: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_subscribe_topic = device_attributes_subscribe_topic + + @property + def device_attributes_topic(self): + """Gets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_topic + + @device_attributes_topic.setter + def device_attributes_topic(self, device_attributes_topic): + """Sets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_topic: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_topic = device_attributes_topic + + @property + def device_telemetry_topic(self): + """Gets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_topic + + @device_telemetry_topic.setter + def device_telemetry_topic(self, device_telemetry_topic): + """Sets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_telemetry_topic: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_topic = device_telemetry_topic + + @property + def send_ack_on_validation_exception(self): + """Gets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._send_ack_on_validation_exception + + @send_ack_on_validation_exception.setter + def send_ack_on_validation_exception(self, send_ack_on_validation_exception): + """Sets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. + + + :param send_ack_on_validation_exception: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._send_ack_on_validation_exception = send_ack_on_validation_exception + + @property + def sparkplug(self): + """Gets the sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._sparkplug + + @sparkplug.setter + def sparkplug(self, sparkplug): + """Sets the sparkplug of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._sparkplug = sparkplug + + @property + def sparkplug_attributes_metric_names(self): + """Gets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._sparkplug_attributes_metric_names + + @sparkplug_attributes_metric_names.setter + def sparkplug_attributes_metric_names(self, sparkplug_attributes_metric_names): + """Sets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug_attributes_metric_names: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[str] + """ + + self._sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/mqtt_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/mqtt_device_transport_configuration.py new file mode 100644 index 0000000..cef731e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/mqtt_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class MqttDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """MqttDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/new_platform_version_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/new_platform_version_notification_rule_trigger_config.py new file mode 100644 index 0000000..a127075 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/new_platform_version_notification_rule_trigger_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NewPlatformVersionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NewPlatformVersionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NewPlatformVersionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NewPlatformVersionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/no_sec_lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_pe/no_sec_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..a7a923c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/no_sec_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NoSecLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """NoSecLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this NoSecLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this NoSecLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this NoSecLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this NoSecLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this NoSecLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this NoSecLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NoSecLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NoSecLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/node_connection_info.py b/billinglayer/python/tb_rest_client/models/models_pe/node_connection_info.py new file mode 100644 index 0000000..449f6e3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/node_connection_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NodeConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'to_index': 'int', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'to_index': 'toIndex', + 'type': 'type' + } + + def __init__(self, from_index=None, to_index=None, type=None): # noqa: E501 + """NodeConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._to_index = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.to_index = to_index + self.type = type + + @property + def from_index(self): + """Gets the from_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def to_index(self): + """Gets the to_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :return: The to_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._to_index + + @to_index.setter + def to_index(self, to_index): + """Sets the to_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :param to_index: The to_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if to_index is None: + raise ValueError("Invalid value for `to_index`, must not be `None`") # noqa: E501 + + self._to_index = to_index + + @property + def type(self): + """Gets the type of this NodeConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this NodeConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this NodeConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this NodeConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NodeConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NodeConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification.py b/billinglayer/python/tb_rest_client/models/models_pe/notification.py new file mode 100644 index 0000000..f470b37 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification.py @@ -0,0 +1,370 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Notification(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'created_time': 'int', + 'id': 'NotificationId', + 'info': 'NotificationInfo', + 'recipient_id': 'UserId', + 'request_id': 'NotificationRequestId', + 'status': 'str', + 'subject': 'str', + 'text': 'str', + 'type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'recipient_id': 'recipientId', + 'request_id': 'requestId', + 'status': 'status', + 'subject': 'subject', + 'text': 'text', + 'type': 'type' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, recipient_id=None, request_id=None, status=None, subject=None, text=None, type=None): # noqa: E501 + """Notification - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._recipient_id = None + self._request_id = None + self._status = None + self._subject = None + self._text = None + self._type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if recipient_id is not None: + self.recipient_id = recipient_id + if request_id is not None: + self.request_id = request_id + if status is not None: + self.status = status + if subject is not None: + self.subject = subject + if text is not None: + self.text = text + if type is not None: + self.type = type + + @property + def additional_config(self): + """Gets the additional_config of this Notification. # noqa: E501 + + + :return: The additional_config of this Notification. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this Notification. + + + :param additional_config: The additional_config of this Notification. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this Notification. # noqa: E501 + + + :return: The created_time of this Notification. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Notification. + + + :param created_time: The created_time of this Notification. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Notification. # noqa: E501 + + + :return: The id of this Notification. # noqa: E501 + :rtype: NotificationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Notification. + + + :param id: The id of this Notification. # noqa: E501 + :type: NotificationId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this Notification. # noqa: E501 + + + :return: The info of this Notification. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this Notification. + + + :param info: The info of this Notification. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def recipient_id(self): + """Gets the recipient_id of this Notification. # noqa: E501 + + + :return: The recipient_id of this Notification. # noqa: E501 + :rtype: UserId + """ + return self._recipient_id + + @recipient_id.setter + def recipient_id(self, recipient_id): + """Sets the recipient_id of this Notification. + + + :param recipient_id: The recipient_id of this Notification. # noqa: E501 + :type: UserId + """ + + self._recipient_id = recipient_id + + @property + def request_id(self): + """Gets the request_id of this Notification. # noqa: E501 + + + :return: The request_id of this Notification. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._request_id + + @request_id.setter + def request_id(self, request_id): + """Sets the request_id of this Notification. + + + :param request_id: The request_id of this Notification. # noqa: E501 + :type: NotificationRequestId + """ + + self._request_id = request_id + + @property + def status(self): + """Gets the status of this Notification. # noqa: E501 + + + :return: The status of this Notification. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Notification. + + + :param status: The status of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["READ", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def subject(self): + """Gets the subject of this Notification. # noqa: E501 + + + :return: The subject of this Notification. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this Notification. + + + :param subject: The subject of this Notification. # noqa: E501 + :type: str + """ + + self._subject = subject + + @property + def text(self): + """Gets the text of this Notification. # noqa: E501 + + + :return: The text of this Notification. # noqa: E501 + :rtype: str + """ + return self._text + + @text.setter + def text(self, text): + """Sets the text of this Notification. + + + :param text: The text of this Notification. # noqa: E501 + :type: str + """ + + self._text = text + + @property + def type(self): + """Gets the type of this Notification. # noqa: E501 + + + :return: The type of this Notification. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Notification. + + + :param type: The type of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "GENERAL", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT", "RULE_NODE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Notification, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Notification): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_delivery_method_config.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_delivery_method_config.py new file mode 100644 index 0000000..7077eb5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_delivery_method_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """NotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_id.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_id.py new file mode 100644 index 0000000..02efb37 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationId. # noqa: E501 + + + :return: The entity_type of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationId. + + + :param entity_type: The entity_type of this NotificationId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_info.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_info.py new file mode 100644 index 0000000..0e847ec --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_info.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'state_entity_id': 'EntityId' + } + + attribute_map = { + 'state_entity_id': 'stateEntityId' + } + + def __init__(self, state_entity_id=None): # noqa: E501 + """NotificationInfo - a model defined in Swagger""" # noqa: E501 + self._state_entity_id = None + self.discriminator = None + if state_entity_id is not None: + self.state_entity_id = state_entity_id + + @property + def state_entity_id(self): + """Gets the state_entity_id of this NotificationInfo. # noqa: E501 + + + :return: The state_entity_id of this NotificationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._state_entity_id + + @state_entity_id.setter + def state_entity_id(self, state_entity_id): + """Sets the state_entity_id of this NotificationInfo. + + + :param state_entity_id: The state_entity_id of this NotificationInfo. # noqa: E501 + :type: EntityId + """ + + self._state_entity_id = state_entity_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_request.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_request.py new file mode 100644 index 0000000..87c0d17 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_request.py @@ -0,0 +1,416 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRequestConfig', + 'created_time': 'int', + 'id': 'NotificationRequestId', + 'info': 'NotificationInfo', + 'originator_entity_id': 'EntityId', + 'rule_id': 'NotificationRuleId', + 'stats': 'NotificationRequestStats', + 'status': 'str', + 'targets': 'list[str]', + 'template': 'NotificationTemplate', + 'template_id': 'NotificationTemplateId', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'originator_entity_id': 'originatorEntityId', + 'rule_id': 'ruleId', + 'stats': 'stats', + 'status': 'status', + 'targets': 'targets', + 'template': 'template', + 'template_id': 'templateId', + 'tenant_id': 'tenantId' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, originator_entity_id=None, rule_id=None, stats=None, status=None, targets=None, template=None, template_id=None, tenant_id=None): # noqa: E501 + """NotificationRequest - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._originator_entity_id = None + self._rule_id = None + self._stats = None + self._status = None + self._targets = None + self._template = None + self._template_id = None + self._tenant_id = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if originator_entity_id is not None: + self.originator_entity_id = originator_entity_id + if rule_id is not None: + self.rule_id = rule_id + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if targets is not None: + self.targets = targets + if template is not None: + self.template = template + if template_id is not None: + self.template_id = template_id + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRequest. # noqa: E501 + + + :return: The additional_config of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRequest. + + + :param additional_config: The additional_config of this NotificationRequest. # noqa: E501 + :type: NotificationRequestConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRequest. # noqa: E501 + + + :return: The created_time of this NotificationRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRequest. + + + :param created_time: The created_time of this NotificationRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationRequest. # noqa: E501 + + + :return: The id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequest. + + + :param id: The id of this NotificationRequest. # noqa: E501 + :type: NotificationRequestId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this NotificationRequest. # noqa: E501 + + + :return: The info of this NotificationRequest. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this NotificationRequest. + + + :param info: The info of this NotificationRequest. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def originator_entity_id(self): + """Gets the originator_entity_id of this NotificationRequest. # noqa: E501 + + + :return: The originator_entity_id of this NotificationRequest. # noqa: E501 + :rtype: EntityId + """ + return self._originator_entity_id + + @originator_entity_id.setter + def originator_entity_id(self, originator_entity_id): + """Sets the originator_entity_id of this NotificationRequest. + + + :param originator_entity_id: The originator_entity_id of this NotificationRequest. # noqa: E501 + :type: EntityId + """ + + self._originator_entity_id = originator_entity_id + + @property + def rule_id(self): + """Gets the rule_id of this NotificationRequest. # noqa: E501 + + + :return: The rule_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._rule_id + + @rule_id.setter + def rule_id(self, rule_id): + """Sets the rule_id of this NotificationRequest. + + + :param rule_id: The rule_id of this NotificationRequest. # noqa: E501 + :type: NotificationRuleId + """ + + self._rule_id = rule_id + + @property + def stats(self): + """Gets the stats of this NotificationRequest. # noqa: E501 + + + :return: The stats of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestStats + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this NotificationRequest. + + + :param stats: The stats of this NotificationRequest. # noqa: E501 + :type: NotificationRequestStats + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this NotificationRequest. # noqa: E501 + + + :return: The status of this NotificationRequest. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this NotificationRequest. + + + :param status: The status of this NotificationRequest. # noqa: E501 + :type: str + """ + allowed_values = ["PROCESSING", "SCHEDULED", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def targets(self): + """Gets the targets of this NotificationRequest. # noqa: E501 + + + :return: The targets of this NotificationRequest. # noqa: E501 + :rtype: list[str] + """ + return self._targets + + @targets.setter + def targets(self, targets): + """Sets the targets of this NotificationRequest. + + + :param targets: The targets of this NotificationRequest. # noqa: E501 + :type: list[str] + """ + + self._targets = targets + + @property + def template(self): + """Gets the template of this NotificationRequest. # noqa: E501 + + + :return: The template of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplate + """ + return self._template + + @template.setter + def template(self, template): + """Sets the template of this NotificationRequest. + + + :param template: The template of this NotificationRequest. # noqa: E501 + :type: NotificationTemplate + """ + + self._template = template + + @property + def template_id(self): + """Gets the template_id of this NotificationRequest. # noqa: E501 + + + :return: The template_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRequest. + + + :param template_id: The template_id of this NotificationRequest. # noqa: E501 + :type: NotificationTemplateId + """ + + self._template_id = template_id + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRequest. # noqa: E501 + + + :return: The tenant_id of this NotificationRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRequest. + + + :param tenant_id: The tenant_id of this NotificationRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_request_config.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_config.py new file mode 100644 index 0000000..54f9de4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sending_delay_in_sec': 'int' + } + + attribute_map = { + 'sending_delay_in_sec': 'sendingDelayInSec' + } + + def __init__(self, sending_delay_in_sec=None): # noqa: E501 + """NotificationRequestConfig - a model defined in Swagger""" # noqa: E501 + self._sending_delay_in_sec = None + self.discriminator = None + if sending_delay_in_sec is not None: + self.sending_delay_in_sec = sending_delay_in_sec + + @property + def sending_delay_in_sec(self): + """Gets the sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + + + :return: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :rtype: int + """ + return self._sending_delay_in_sec + + @sending_delay_in_sec.setter + def sending_delay_in_sec(self, sending_delay_in_sec): + """Sets the sending_delay_in_sec of this NotificationRequestConfig. + + + :param sending_delay_in_sec: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :type: int + """ + + self._sending_delay_in_sec = sending_delay_in_sec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_request_id.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_id.py new file mode 100644 index 0000000..8b9bfd8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRequestId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRequestId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequestId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRequestId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRequestId. # noqa: E501 + + + :return: The entity_type of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRequestId. + + + :param entity_type: The entity_type of this NotificationRequestId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_request_preview.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_preview.py new file mode 100644 index 0000000..c16ca74 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_preview.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestPreview(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'processed_templates': 'dict(str, DeliveryMethodNotificationTemplate)', + 'recipients_count_by_target': 'dict(str, int)', + 'recipients_preview': 'list[str]', + 'total_recipients_count': 'int' + } + + attribute_map = { + 'processed_templates': 'processedTemplates', + 'recipients_count_by_target': 'recipientsCountByTarget', + 'recipients_preview': 'recipientsPreview', + 'total_recipients_count': 'totalRecipientsCount' + } + + def __init__(self, processed_templates=None, recipients_count_by_target=None, recipients_preview=None, total_recipients_count=None): # noqa: E501 + """NotificationRequestPreview - a model defined in Swagger""" # noqa: E501 + self._processed_templates = None + self._recipients_count_by_target = None + self._recipients_preview = None + self._total_recipients_count = None + self.discriminator = None + if processed_templates is not None: + self.processed_templates = processed_templates + if recipients_count_by_target is not None: + self.recipients_count_by_target = recipients_count_by_target + if recipients_preview is not None: + self.recipients_preview = recipients_preview + if total_recipients_count is not None: + self.total_recipients_count = total_recipients_count + + @property + def processed_templates(self): + """Gets the processed_templates of this NotificationRequestPreview. # noqa: E501 + + + :return: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._processed_templates + + @processed_templates.setter + def processed_templates(self, processed_templates): + """Sets the processed_templates of this NotificationRequestPreview. + + + :param processed_templates: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._processed_templates = processed_templates + + @property + def recipients_count_by_target(self): + """Gets the recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, int) + """ + return self._recipients_count_by_target + + @recipients_count_by_target.setter + def recipients_count_by_target(self, recipients_count_by_target): + """Sets the recipients_count_by_target of this NotificationRequestPreview. + + + :param recipients_count_by_target: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, int) + """ + + self._recipients_count_by_target = recipients_count_by_target + + @property + def recipients_preview(self): + """Gets the recipients_preview of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :rtype: list[str] + """ + return self._recipients_preview + + @recipients_preview.setter + def recipients_preview(self, recipients_preview): + """Sets the recipients_preview of this NotificationRequestPreview. + + + :param recipients_preview: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :type: list[str] + """ + + self._recipients_preview = recipients_preview + + @property + def total_recipients_count(self): + """Gets the total_recipients_count of this NotificationRequestPreview. # noqa: E501 + + + :return: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :rtype: int + """ + return self._total_recipients_count + + @total_recipients_count.setter + def total_recipients_count(self, total_recipients_count): + """Sets the total_recipients_count of this NotificationRequestPreview. + + + :param total_recipients_count: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :type: int + """ + + self._total_recipients_count = total_recipients_count + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestPreview, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestPreview): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_request_stats.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_stats.py new file mode 100644 index 0000000..5338f06 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_request_stats.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestStats(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'errors': 'dict(str, object)', + 'sent': 'dict(str, AtomicInteger)' + } + + attribute_map = { + 'error': 'error', + 'errors': 'errors', + 'sent': 'sent' + } + + def __init__(self, error=None, errors=None, sent=None): # noqa: E501 + """NotificationRequestStats - a model defined in Swagger""" # noqa: E501 + self._error = None + self._errors = None + self._sent = None + self.discriminator = None + if error is not None: + self.error = error + if errors is not None: + self.errors = errors + if sent is not None: + self.sent = sent + + @property + def error(self): + """Gets the error of this NotificationRequestStats. # noqa: E501 + + + :return: The error of this NotificationRequestStats. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this NotificationRequestStats. + + + :param error: The error of this NotificationRequestStats. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def errors(self): + """Gets the errors of this NotificationRequestStats. # noqa: E501 + + + :return: The errors of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, object) + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this NotificationRequestStats. + + + :param errors: The errors of this NotificationRequestStats. # noqa: E501 + :type: dict(str, object) + """ + + self._errors = errors + + @property + def sent(self): + """Gets the sent of this NotificationRequestStats. # noqa: E501 + + + :return: The sent of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, AtomicInteger) + """ + return self._sent + + @sent.setter + def sent(self, sent): + """Sets the sent of this NotificationRequestStats. + + + :param sent: The sent of this NotificationRequestStats. # noqa: E501 + :type: dict(str, AtomicInteger) + """ + + self._sent = sent + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestStats, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestStats): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_config.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_config.py new file mode 100644 index 0000000..f07ae78 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str' + } + + attribute_map = { + 'description': 'description' + } + + def __init__(self, description=None): # noqa: E501 + """NotificationRuleConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self.discriminator = None + if description is not None: + self.description = description + + @property + def description(self): + """Gets the description of this NotificationRuleConfig. # noqa: E501 + + + :return: The description of this NotificationRuleConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this NotificationRuleConfig. + + + :param description: The description of this NotificationRuleConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_id.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_id.py new file mode 100644 index 0000000..5e847d8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRuleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRuleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRuleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRuleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRuleId. # noqa: E501 + + + :return: The entity_type of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRuleId. + + + :param entity_type: The entity_type of this NotificationRuleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_recipients_config.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_recipients_config.py new file mode 100644 index 0000000..29a0d61 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_rule_recipients_config.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_target_id.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_target_id.py new file mode 100644 index 0000000..1cbe661 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_target_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTargetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTargetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTargetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTargetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTargetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTargetId. # noqa: E501 + + + :return: The entity_type of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTargetId. + + + :param entity_type: The entity_type of this NotificationTargetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTargetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTargetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_template_config.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_template_config.py new file mode 100644 index 0000000..edb7f35 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_template_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'delivery_methods_templates': 'dict(str, DeliveryMethodNotificationTemplate)' + } + + attribute_map = { + 'delivery_methods_templates': 'deliveryMethodsTemplates' + } + + def __init__(self, delivery_methods_templates=None): # noqa: E501 + """NotificationTemplateConfig - a model defined in Swagger""" # noqa: E501 + self._delivery_methods_templates = None + self.discriminator = None + if delivery_methods_templates is not None: + self.delivery_methods_templates = delivery_methods_templates + + @property + def delivery_methods_templates(self): + """Gets the delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + + + :return: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._delivery_methods_templates + + @delivery_methods_templates.setter + def delivery_methods_templates(self, delivery_methods_templates): + """Sets the delivery_methods_templates of this NotificationTemplateConfig. + + + :param delivery_methods_templates: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._delivery_methods_templates = delivery_methods_templates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/notification_template_id.py b/billinglayer/python/tb_rest_client/models/models_pe/notification_template_id.py new file mode 100644 index 0000000..89379cc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/notification_template_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTemplateId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTemplateId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTemplateId. # noqa: E501 + + + :return: The entity_type of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTemplateId. + + + :param entity_type: The entity_type of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/numeric_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_pe/numeric_filter_predicate.py new file mode 100644 index 0000000..22eeea7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/numeric_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class NumericFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValuedouble' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """NumericFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this NumericFilterPredicate. # noqa: E501 + + + :return: The operation of this NumericFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this NumericFilterPredicate. + + + :param operation: The operation of this NumericFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "GREATER", "GREATER_OR_EQUAL", "LESS", "LESS_OR_EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this NumericFilterPredicate. # noqa: E501 + + + :return: The value of this NumericFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuedouble + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this NumericFilterPredicate. + + + :param value: The value of this NumericFilterPredicate. # noqa: E501 + :type: FilterPredicateValuedouble + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NumericFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NumericFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_basic_mapper_config.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_basic_mapper_config.py new file mode 100644 index 0000000..6fde47a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_basic_mapper_config.py @@ -0,0 +1,381 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2BasicMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'always_full_screen': 'bool', + 'customer_name_pattern': 'str', + 'default_dashboard_name': 'str', + 'email_attribute_key': 'str', + 'first_name_attribute_key': 'str', + 'last_name_attribute_key': 'str', + 'parent_customer_name_pattern': 'str', + 'tenant_name_pattern': 'str', + 'tenant_name_strategy': 'str', + 'user_groups_name_pattern': 'list[str]' + } + + attribute_map = { + 'always_full_screen': 'alwaysFullScreen', + 'customer_name_pattern': 'customerNamePattern', + 'default_dashboard_name': 'defaultDashboardName', + 'email_attribute_key': 'emailAttributeKey', + 'first_name_attribute_key': 'firstNameAttributeKey', + 'last_name_attribute_key': 'lastNameAttributeKey', + 'parent_customer_name_pattern': 'parentCustomerNamePattern', + 'tenant_name_pattern': 'tenantNamePattern', + 'tenant_name_strategy': 'tenantNameStrategy', + 'user_groups_name_pattern': 'userGroupsNamePattern' + } + + def __init__(self, always_full_screen=None, customer_name_pattern=None, default_dashboard_name=None, email_attribute_key=None, first_name_attribute_key=None, last_name_attribute_key=None, parent_customer_name_pattern=None, tenant_name_pattern=None, tenant_name_strategy=None, user_groups_name_pattern=None): # noqa: E501 + """OAuth2BasicMapperConfig - a model defined in Swagger""" # noqa: E501 + self._always_full_screen = None + self._customer_name_pattern = None + self._default_dashboard_name = None + self._email_attribute_key = None + self._first_name_attribute_key = None + self._last_name_attribute_key = None + self._parent_customer_name_pattern = None + self._tenant_name_pattern = None + self._tenant_name_strategy = None + self._user_groups_name_pattern = None + self.discriminator = None + if always_full_screen is not None: + self.always_full_screen = always_full_screen + if customer_name_pattern is not None: + self.customer_name_pattern = customer_name_pattern + if default_dashboard_name is not None: + self.default_dashboard_name = default_dashboard_name + if email_attribute_key is not None: + self.email_attribute_key = email_attribute_key + if first_name_attribute_key is not None: + self.first_name_attribute_key = first_name_attribute_key + if last_name_attribute_key is not None: + self.last_name_attribute_key = last_name_attribute_key + if parent_customer_name_pattern is not None: + self.parent_customer_name_pattern = parent_customer_name_pattern + if tenant_name_pattern is not None: + self.tenant_name_pattern = tenant_name_pattern + self.tenant_name_strategy = tenant_name_strategy + if user_groups_name_pattern is not None: + self.user_groups_name_pattern = user_groups_name_pattern + + @property + def always_full_screen(self): + """Gets the always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + + Whether default dashboard should be open in full screen # noqa: E501 + + :return: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._always_full_screen + + @always_full_screen.setter + def always_full_screen(self, always_full_screen): + """Sets the always_full_screen of this OAuth2BasicMapperConfig. + + Whether default dashboard should be open in full screen # noqa: E501 + + :param always_full_screen: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :type: bool + """ + + self._always_full_screen = always_full_screen + + @property + def customer_name_pattern(self): + """Gets the customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :return: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._customer_name_pattern + + @customer_name_pattern.setter + def customer_name_pattern(self, customer_name_pattern): + """Sets the customer_name_pattern of this OAuth2BasicMapperConfig. + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :param customer_name_pattern: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._customer_name_pattern = customer_name_pattern + + @property + def default_dashboard_name(self): + """Gets the default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :return: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._default_dashboard_name + + @default_dashboard_name.setter + def default_dashboard_name(self, default_dashboard_name): + """Sets the default_dashboard_name of this OAuth2BasicMapperConfig. + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :param default_dashboard_name: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._default_dashboard_name = default_dashboard_name + + @property + def email_attribute_key(self): + """Gets the email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :return: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._email_attribute_key + + @email_attribute_key.setter + def email_attribute_key(self, email_attribute_key): + """Sets the email_attribute_key of this OAuth2BasicMapperConfig. + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :param email_attribute_key: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._email_attribute_key = email_attribute_key + + @property + def first_name_attribute_key(self): + """Gets the first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + First name attribute key # noqa: E501 + + :return: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._first_name_attribute_key + + @first_name_attribute_key.setter + def first_name_attribute_key(self, first_name_attribute_key): + """Sets the first_name_attribute_key of this OAuth2BasicMapperConfig. + + First name attribute key # noqa: E501 + + :param first_name_attribute_key: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._first_name_attribute_key = first_name_attribute_key + + @property + def last_name_attribute_key(self): + """Gets the last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Last name attribute key # noqa: E501 + + :return: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._last_name_attribute_key + + @last_name_attribute_key.setter + def last_name_attribute_key(self, last_name_attribute_key): + """Sets the last_name_attribute_key of this OAuth2BasicMapperConfig. + + Last name attribute key # noqa: E501 + + :param last_name_attribute_key: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._last_name_attribute_key = last_name_attribute_key + + @property + def parent_customer_name_pattern(self): + """Gets the parent_customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + + :return: The parent_customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._parent_customer_name_pattern + + @parent_customer_name_pattern.setter + def parent_customer_name_pattern(self, parent_customer_name_pattern): + """Sets the parent_customer_name_pattern of this OAuth2BasicMapperConfig. + + + :param parent_customer_name_pattern: The parent_customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._parent_customer_name_pattern = parent_customer_name_pattern + + @property + def tenant_name_pattern(self): + """Gets the tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :return: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_pattern + + @tenant_name_pattern.setter + def tenant_name_pattern(self, tenant_name_pattern): + """Sets the tenant_name_pattern of this OAuth2BasicMapperConfig. + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :param tenant_name_pattern: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._tenant_name_pattern = tenant_name_pattern + + @property + def tenant_name_strategy(self): + """Gets the tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :return: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_strategy + + @tenant_name_strategy.setter + def tenant_name_strategy(self, tenant_name_strategy): + """Sets the tenant_name_strategy of this OAuth2BasicMapperConfig. + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :param tenant_name_strategy: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + if tenant_name_strategy is None: + raise ValueError("Invalid value for `tenant_name_strategy`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOM", "DOMAIN", "EMAIL"] # noqa: E501 + if tenant_name_strategy not in allowed_values: + raise ValueError( + "Invalid value for `tenant_name_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(tenant_name_strategy, allowed_values) + ) + + self._tenant_name_strategy = tenant_name_strategy + + @property + def user_groups_name_pattern(self): + """Gets the user_groups_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + + :return: The user_groups_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: list[str] + """ + return self._user_groups_name_pattern + + @user_groups_name_pattern.setter + def user_groups_name_pattern(self, user_groups_name_pattern): + """Sets the user_groups_name_pattern of this OAuth2BasicMapperConfig. + + + :param user_groups_name_pattern: The user_groups_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: list[str] + """ + + self._user_groups_name_pattern = user_groups_name_pattern + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2BasicMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2BasicMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_info.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_info.py new file mode 100644 index 0000000..c023158 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'icon': 'str', + 'name': 'str', + 'url': 'str' + } + + attribute_map = { + 'icon': 'icon', + 'name': 'name', + 'url': 'url' + } + + def __init__(self, icon=None, name=None, url=None): # noqa: E501 + """OAuth2ClientInfo - a model defined in Swagger""" # noqa: E501 + self._icon = None + self._name = None + self._url = None + self.discriminator = None + if icon is not None: + self.icon = icon + if name is not None: + self.name = name + if url is not None: + self.url = url + + @property + def icon(self): + """Gets the icon of this OAuth2ClientInfo. # noqa: E501 + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :return: The icon of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._icon + + @icon.setter + def icon(self, icon): + """Sets the icon of this OAuth2ClientInfo. + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :param icon: The icon of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._icon = icon + + @property + def name(self): + """Gets the name of this OAuth2ClientInfo. # noqa: E501 + + OAuth2 client name # noqa: E501 + + :return: The name of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientInfo. + + OAuth2 client name # noqa: E501 + + :param name: The name of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def url(self): + """Gets the url of this OAuth2ClientInfo. # noqa: E501 + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :return: The url of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2ClientInfo. + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :param url: The url of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template.py new file mode 100644 index 0000000..8238cdd --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template.py @@ -0,0 +1,565 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'comment': 'str', + 'created_time': 'int', + 'help_link': 'str', + 'id': 'OAuth2ClientRegistrationTemplateId', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'name': 'str', + 'provider_id': 'str', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'comment': 'comment', + 'created_time': 'createdTime', + 'help_link': 'helpLink', + 'id': 'id', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'name': 'name', + 'provider_id': 'providerId', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, comment=None, created_time=None, help_link=None, id=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, name=None, provider_id=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2ClientRegistrationTemplate - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._comment = None + self._created_time = None + self._help_link = None + self._id = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._name = None + self._provider_id = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + if access_token_uri is not None: + self.access_token_uri = access_token_uri + if additional_info is not None: + self.additional_info = additional_info + if authorization_uri is not None: + self.authorization_uri = authorization_uri + if client_authentication_method is not None: + self.client_authentication_method = client_authentication_method + if comment is not None: + self.comment = comment + if created_time is not None: + self.created_time = created_time + if help_link is not None: + self.help_link = help_link + if id is not None: + self.id = id + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + if login_button_label is not None: + self.login_button_label = login_button_label + if mapper_config is not None: + self.mapper_config = mapper_config + if name is not None: + self.name = name + self.provider_id = provider_id + if scope is not None: + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default access token URI of the OAuth2 provider # noqa: E501 + + :return: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2ClientRegistrationTemplate. + + Default access token URI of the OAuth2 provider # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2ClientRegistrationTemplate. + + + :param additional_info: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :return: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2ClientRegistrationTemplate. + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :return: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2ClientRegistrationTemplate. + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._client_authentication_method = client_authentication_method + + @property + def comment(self): + """Gets the comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Comment for OAuth2 provider # noqa: E501 + + :return: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this OAuth2ClientRegistrationTemplate. + + Comment for OAuth2 provider # noqa: E501 + + :param comment: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._comment = comment + + @property + def created_time(self): + """Gets the created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OAuth2ClientRegistrationTemplate. + + + :param created_time: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def help_link(self): + """Gets the help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Help link for OAuth2 provider # noqa: E501 + + :return: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._help_link + + @help_link.setter + def help_link(self, help_link): + """Sets the help_link of this OAuth2ClientRegistrationTemplate. + + Help link for OAuth2 provider # noqa: E501 + + :param help_link: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._help_link = help_link + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2ClientRegistrationTemplateId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplate. + + + :param id: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2ClientRegistrationTemplateId + """ + + self._id = id + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2ClientRegistrationTemplate. + + Default log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth2 provider label # noqa: E501 + + :return: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2ClientRegistrationTemplate. + + Default OAuth2 provider label # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2ClientRegistrationTemplate. + + + :param mapper_config: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2MapperConfig + """ + + self._mapper_config = mapper_config + + @property + def name(self): + """Gets the name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientRegistrationTemplate. + + + :param name: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def provider_id(self): + """Gets the provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :return: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._provider_id + + @provider_id.setter + def provider_id(self, provider_id): + """Sets the provider_id of this OAuth2ClientRegistrationTemplate. + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :param provider_id: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + if provider_id is None: + raise ValueError("Invalid value for `provider_id`, must not be `None`") # noqa: E501 + + self._provider_id = provider_id + + @property + def scope(self): + """Gets the scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :return: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2ClientRegistrationTemplate. + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :param scope: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: list[str] + """ + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default user info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2ClientRegistrationTemplate. + + Default user info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template_id.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template_id.py new file mode 100644 index 0000000..93ea683 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """OAuth2ClientRegistrationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplateId. + + string # noqa: E501 + + :param id: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_clients_domain_params.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_clients_domain_params.py new file mode 100644 index 0000000..4383a89 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_clients_domain_params.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientsDomainParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_registrations': 'list[ClientRegistrationDto]', + 'domain_infos': 'list[DomainInfo]' + } + + attribute_map = { + 'client_registrations': 'clientRegistrations', + 'domain_infos': 'domainInfos' + } + + def __init__(self, client_registrations=None, domain_infos=None): # noqa: E501 + """OAuth2ClientsDomainParams - a model defined in Swagger""" # noqa: E501 + self._client_registrations = None + self._domain_infos = None + self.discriminator = None + if client_registrations is not None: + self.client_registrations = client_registrations + if domain_infos is not None: + self.domain_infos = domain_infos + + @property + def client_registrations(self): + """Gets the client_registrations of this OAuth2ClientsDomainParams. # noqa: E501 + + + :return: The client_registrations of this OAuth2ClientsDomainParams. # noqa: E501 + :rtype: list[ClientRegistrationDto] + """ + return self._client_registrations + + @client_registrations.setter + def client_registrations(self, client_registrations): + """Sets the client_registrations of this OAuth2ClientsDomainParams. + + + :param client_registrations: The client_registrations of this OAuth2ClientsDomainParams. # noqa: E501 + :type: list[ClientRegistrationDto] + """ + + self._client_registrations = client_registrations + + @property + def domain_infos(self): + """Gets the domain_infos of this OAuth2ClientsDomainParams. # noqa: E501 + + + :return: The domain_infos of this OAuth2ClientsDomainParams. # noqa: E501 + :rtype: list[DomainInfo] + """ + return self._domain_infos + + @domain_infos.setter + def domain_infos(self, domain_infos): + """Sets the domain_infos of this OAuth2ClientsDomainParams. + + + :param domain_infos: The domain_infos of this OAuth2ClientsDomainParams. # noqa: E501 + :type: list[DomainInfo] + """ + + self._domain_infos = domain_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientsDomainParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientsDomainParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_clients_params.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_clients_params.py new file mode 100644 index 0000000..a249d83 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_clients_params.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientsParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'domains_params': 'list[OAuth2ClientsDomainParams]', + 'enabled': 'bool' + } + + attribute_map = { + 'domains_params': 'domainsParams', + 'enabled': 'enabled' + } + + def __init__(self, domains_params=None, enabled=None): # noqa: E501 + """OAuth2ClientsParams - a model defined in Swagger""" # noqa: E501 + self._domains_params = None + self._enabled = None + self.discriminator = None + if domains_params is not None: + self.domains_params = domains_params + if enabled is not None: + self.enabled = enabled + + @property + def domains_params(self): + """Gets the domains_params of this OAuth2ClientsParams. # noqa: E501 + + + :return: The domains_params of this OAuth2ClientsParams. # noqa: E501 + :rtype: list[OAuth2ClientsDomainParams] + """ + return self._domains_params + + @domains_params.setter + def domains_params(self, domains_params): + """Sets the domains_params of this OAuth2ClientsParams. + + + :param domains_params: The domains_params of this OAuth2ClientsParams. # noqa: E501 + :type: list[OAuth2ClientsDomainParams] + """ + + self._domains_params = domains_params + + @property + def enabled(self): + """Gets the enabled of this OAuth2ClientsParams. # noqa: E501 + + + :return: The enabled of this OAuth2ClientsParams. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this OAuth2ClientsParams. + + + :param enabled: The enabled of this OAuth2ClientsParams. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientsParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientsParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_custom_mapper_config.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_custom_mapper_config.py new file mode 100644 index 0000000..90ae2c8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_custom_mapper_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2CustomMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password': 'str', + 'send_token': 'bool', + 'url': 'str', + 'username': 'str' + } + + attribute_map = { + 'password': 'password', + 'send_token': 'sendToken', + 'url': 'url', + 'username': 'username' + } + + def __init__(self, password=None, send_token=None, url=None, username=None): # noqa: E501 + """OAuth2CustomMapperConfig - a model defined in Swagger""" # noqa: E501 + self._password = None + self._send_token = None + self._url = None + self._username = None + self.discriminator = None + if password is not None: + self.password = password + if send_token is not None: + self.send_token = send_token + if url is not None: + self.url = url + if username is not None: + self.username = username + + @property + def password(self): + """Gets the password of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this OAuth2CustomMapperConfig. + + + :param password: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def send_token(self): + """Gets the send_token of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._send_token + + @send_token.setter + def send_token(self, send_token): + """Sets the send_token of this OAuth2CustomMapperConfig. + + + :param send_token: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :type: bool + """ + + self._send_token = send_token + + @property + def url(self): + """Gets the url of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2CustomMapperConfig. + + + :param url: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def username(self): + """Gets the username of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this OAuth2CustomMapperConfig. + + + :param username: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2CustomMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2CustomMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_domain_info.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_domain_info.py new file mode 100644 index 0000000..7fe98b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_domain_info.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2DomainInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'scheme': 'str' + } + + attribute_map = { + 'name': 'name', + 'scheme': 'scheme' + } + + def __init__(self, name=None, scheme=None): # noqa: E501 + """OAuth2DomainInfo - a model defined in Swagger""" # noqa: E501 + self._name = None + self._scheme = None + self.discriminator = None + self.name = name + self.scheme = scheme + + @property + def name(self): + """Gets the name of this OAuth2DomainInfo. # noqa: E501 + + Domain name. Cannot be empty # noqa: E501 + + :return: The name of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2DomainInfo. + + Domain name. Cannot be empty # noqa: E501 + + :param name: The name of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def scheme(self): + """Gets the scheme of this OAuth2DomainInfo. # noqa: E501 + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :return: The scheme of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._scheme + + @scheme.setter + def scheme(self, scheme): + """Sets the scheme of this OAuth2DomainInfo. + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :param scheme: The scheme of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if scheme is None: + raise ValueError("Invalid value for `scheme`, must not be `None`") # noqa: E501 + allowed_values = ["HTTP", "HTTPS", "MIXED"] # noqa: E501 + if scheme not in allowed_values: + raise ValueError( + "Invalid value for `scheme` ({0}), must be one of {1}" # noqa: E501 + .format(scheme, allowed_values) + ) + + self._scheme = scheme + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2DomainInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2DomainInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_info.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_info.py new file mode 100644 index 0000000..0f1439b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_info.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2Info(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'enabled': 'bool', + 'oauth2_params_infos': 'list[OAuth2ParamsInfo]' + } + + attribute_map = { + 'enabled': 'enabled', + 'oauth2_params_infos': 'oauth2ParamsInfos' + } + + def __init__(self, enabled=None, oauth2_params_infos=None): # noqa: E501 + """OAuth2Info - a model defined in Swagger""" # noqa: E501 + self._enabled = None + self._oauth2_params_infos = None + self.discriminator = None + if enabled is not None: + self.enabled = enabled + self.oauth2_params_infos = oauth2_params_infos + + @property + def enabled(self): + """Gets the enabled of this OAuth2Info. # noqa: E501 + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :return: The enabled of this OAuth2Info. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this OAuth2Info. + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :param enabled: The enabled of this OAuth2Info. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def oauth2_params_infos(self): + """Gets the oauth2_params_infos of this OAuth2Info. # noqa: E501 + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :return: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :rtype: list[OAuth2ParamsInfo] + """ + return self._oauth2_params_infos + + @oauth2_params_infos.setter + def oauth2_params_infos(self, oauth2_params_infos): + """Sets the oauth2_params_infos of this OAuth2Info. + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :param oauth2_params_infos: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :type: list[OAuth2ParamsInfo] + """ + if oauth2_params_infos is None: + raise ValueError("Invalid value for `oauth2_params_infos`, must not be `None`") # noqa: E501 + + self._oauth2_params_infos = oauth2_params_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2Info, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2Info): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_mapper_config.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_mapper_config.py new file mode 100644 index 0000000..d874927 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_mapper_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_user': 'bool', + 'allow_user_creation': 'bool', + 'basic': 'OAuth2BasicMapperConfig', + 'custom': 'OAuth2CustomMapperConfig', + 'type': 'str' + } + + attribute_map = { + 'activate_user': 'activateUser', + 'allow_user_creation': 'allowUserCreation', + 'basic': 'basic', + 'custom': 'custom', + 'type': 'type' + } + + def __init__(self, activate_user=None, allow_user_creation=None, basic=None, custom=None, type=None): # noqa: E501 + """OAuth2MapperConfig - a model defined in Swagger""" # noqa: E501 + self._activate_user = None + self._allow_user_creation = None + self._basic = None + self._custom = None + self._type = None + self.discriminator = None + if activate_user is not None: + self.activate_user = activate_user + if allow_user_creation is not None: + self.allow_user_creation = allow_user_creation + if basic is not None: + self.basic = basic + if custom is not None: + self.custom = custom + self.type = type + + @property + def activate_user(self): + """Gets the activate_user of this OAuth2MapperConfig. # noqa: E501 + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :return: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._activate_user + + @activate_user.setter + def activate_user(self, activate_user): + """Sets the activate_user of this OAuth2MapperConfig. + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :param activate_user: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._activate_user = activate_user + + @property + def allow_user_creation(self): + """Gets the allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :return: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._allow_user_creation + + @allow_user_creation.setter + def allow_user_creation(self, allow_user_creation): + """Sets the allow_user_creation of this OAuth2MapperConfig. + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :param allow_user_creation: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._allow_user_creation = allow_user_creation + + @property + def basic(self): + """Gets the basic of this OAuth2MapperConfig. # noqa: E501 + + + :return: The basic of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2BasicMapperConfig + """ + return self._basic + + @basic.setter + def basic(self, basic): + """Sets the basic of this OAuth2MapperConfig. + + + :param basic: The basic of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2BasicMapperConfig + """ + + self._basic = basic + + @property + def custom(self): + """Gets the custom of this OAuth2MapperConfig. # noqa: E501 + + + :return: The custom of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2CustomMapperConfig + """ + return self._custom + + @custom.setter + def custom(self, custom): + """Sets the custom of this OAuth2MapperConfig. + + + :param custom: The custom of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2CustomMapperConfig + """ + + self._custom = custom + + @property + def type(self): + """Gets the type of this OAuth2MapperConfig. # noqa: E501 + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :return: The type of this OAuth2MapperConfig. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OAuth2MapperConfig. + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :param type: The type of this OAuth2MapperConfig. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APPLE", "BASIC", "CUSTOM", "GITHUB"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_mobile_info.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_mobile_info.py new file mode 100644 index 0000000..c6c6238 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_mobile_info.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MobileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'app_secret': 'str', + 'pkg_name': 'str' + } + + attribute_map = { + 'app_secret': 'appSecret', + 'pkg_name': 'pkgName' + } + + def __init__(self, app_secret=None, pkg_name=None): # noqa: E501 + """OAuth2MobileInfo - a model defined in Swagger""" # noqa: E501 + self._app_secret = None + self._pkg_name = None + self.discriminator = None + self.app_secret = app_secret + self.pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this OAuth2MobileInfo. # noqa: E501 + + Application secret. The length must be at least 16 characters # noqa: E501 + + :return: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this OAuth2MobileInfo. + + Application secret. The length must be at least 16 characters # noqa: E501 + + :param app_secret: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if app_secret is None: + raise ValueError("Invalid value for `app_secret`, must not be `None`") # noqa: E501 + + self._app_secret = app_secret + + @property + def pkg_name(self): + """Gets the pkg_name of this OAuth2MobileInfo. # noqa: E501 + + Application package name. Cannot be empty # noqa: E501 + + :return: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this OAuth2MobileInfo. + + Application package name. Cannot be empty # noqa: E501 + + :param pkg_name: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if pkg_name is None: + raise ValueError("Invalid value for `pkg_name`, must not be `None`") # noqa: E501 + + self._pkg_name = pkg_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MobileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MobileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_params_info.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_params_info.py new file mode 100644 index 0000000..879921c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_params_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ParamsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_registrations': 'list[OAuth2RegistrationInfo]', + 'domain_infos': 'list[OAuth2DomainInfo]', + 'mobile_infos': 'list[OAuth2MobileInfo]' + } + + attribute_map = { + 'client_registrations': 'clientRegistrations', + 'domain_infos': 'domainInfos', + 'mobile_infos': 'mobileInfos' + } + + def __init__(self, client_registrations=None, domain_infos=None, mobile_infos=None): # noqa: E501 + """OAuth2ParamsInfo - a model defined in Swagger""" # noqa: E501 + self._client_registrations = None + self._domain_infos = None + self._mobile_infos = None + self.discriminator = None + self.client_registrations = client_registrations + self.domain_infos = domain_infos + self.mobile_infos = mobile_infos + + @property + def client_registrations(self): + """Gets the client_registrations of this OAuth2ParamsInfo. # noqa: E501 + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :return: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2RegistrationInfo] + """ + return self._client_registrations + + @client_registrations.setter + def client_registrations(self, client_registrations): + """Sets the client_registrations of this OAuth2ParamsInfo. + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :param client_registrations: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2RegistrationInfo] + """ + if client_registrations is None: + raise ValueError("Invalid value for `client_registrations`, must not be `None`") # noqa: E501 + + self._client_registrations = client_registrations + + @property + def domain_infos(self): + """Gets the domain_infos of this OAuth2ParamsInfo. # noqa: E501 + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :return: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2DomainInfo] + """ + return self._domain_infos + + @domain_infos.setter + def domain_infos(self, domain_infos): + """Sets the domain_infos of this OAuth2ParamsInfo. + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :param domain_infos: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2DomainInfo] + """ + if domain_infos is None: + raise ValueError("Invalid value for `domain_infos`, must not be `None`") # noqa: E501 + + self._domain_infos = domain_infos + + @property + def mobile_infos(self): + """Gets the mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :return: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2MobileInfo] + """ + return self._mobile_infos + + @mobile_infos.setter + def mobile_infos(self, mobile_infos): + """Sets the mobile_infos of this OAuth2ParamsInfo. + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :param mobile_infos: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2MobileInfo] + """ + if mobile_infos is None: + raise ValueError("Invalid value for `mobile_infos`, must not be `None`") # noqa: E501 + + self._mobile_infos = mobile_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ParamsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ParamsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_registration_info.py b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_registration_info.py new file mode 100644 index 0000000..553b1b2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/o_auth2_registration_info.py @@ -0,0 +1,502 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2RegistrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'client_id': 'str', + 'client_secret': 'str', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'platforms': 'list[str]', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'client_id': 'clientId', + 'client_secret': 'clientSecret', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'platforms': 'platforms', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, client_id=None, client_secret=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, platforms=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2RegistrationInfo - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._client_id = None + self._client_secret = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._platforms = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + self.access_token_uri = access_token_uri + self.additional_info = additional_info + self.authorization_uri = authorization_uri + self.client_authentication_method = client_authentication_method + self.client_id = client_id + self.client_secret = client_secret + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + self.login_button_label = login_button_label + self.mapper_config = mapper_config + if platforms is not None: + self.platforms = platforms + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2RegistrationInfo. + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if access_token_uri is None: + raise ValueError("Invalid value for `access_token_uri`, must not be `None`") # noqa: E501 + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2RegistrationInfo. + + + :param additional_info: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2RegistrationInfo. + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if authorization_uri is None: + raise ValueError("Invalid value for `authorization_uri`, must not be `None`") # noqa: E501 + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :return: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2RegistrationInfo. + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_authentication_method is None: + raise ValueError("Invalid value for `client_authentication_method`, must not be `None`") # noqa: E501 + + self._client_authentication_method = client_authentication_method + + @property + def client_id(self): + """Gets the client_id of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :return: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_id + + @client_id.setter + def client_id(self, client_id): + """Sets the client_id of this OAuth2RegistrationInfo. + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :param client_id: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_id is None: + raise ValueError("Invalid value for `client_id`, must not be `None`") # noqa: E501 + + self._client_id = client_id + + @property + def client_secret(self): + """Gets the client_secret of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :return: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_secret + + @client_secret.setter + def client_secret(self, client_secret): + """Sets the client_secret of this OAuth2RegistrationInfo. + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :param client_secret: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_secret is None: + raise ValueError("Invalid value for `client_secret`, must not be `None`") # noqa: E501 + + self._client_secret = client_secret + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2RegistrationInfo. + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + + Log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2RegistrationInfo. + + Log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :return: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2RegistrationInfo. + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if login_button_label is None: + raise ValueError("Invalid value for `login_button_label`, must not be `None`") # noqa: E501 + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2RegistrationInfo. + + + :param mapper_config: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :type: OAuth2MapperConfig + """ + if mapper_config is None: + raise ValueError("Invalid value for `mapper_config`, must not be `None`") # noqa: E501 + + self._mapper_config = mapper_config + + @property + def platforms(self): + """Gets the platforms of this OAuth2RegistrationInfo. # noqa: E501 + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :return: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._platforms + + @platforms.setter + def platforms(self, platforms): + """Sets the platforms of this OAuth2RegistrationInfo. + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :param platforms: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ANDROID", "IOS", "WEB"] # noqa: E501 + if not set(platforms).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `platforms` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(platforms) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._platforms = platforms + + @property + def scope(self): + """Gets the scope of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :return: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2RegistrationInfo. + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :param scope: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + if scope is None: + raise ValueError("Invalid value for `scope`, must not be `None`") # noqa: E501 + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + + User info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2RegistrationInfo. + + User info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2RegistrationInfo. + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2RegistrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2RegistrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/object_attributes.py b/billinglayer/python/tb_rest_client/models/models_pe/object_attributes.py new file mode 100644 index 0000000..61ac821 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/object_attributes.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectAttributes(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dim': 'int', + 'gt': 'float', + 'lt': 'float', + 'pmax': 'int', + 'pmin': 'int', + 'st': 'float', + 'ver': 'str' + } + + attribute_map = { + 'dim': 'dim', + 'gt': 'gt', + 'lt': 'lt', + 'pmax': 'pmax', + 'pmin': 'pmin', + 'st': 'st', + 'ver': 'ver' + } + + def __init__(self, dim=None, gt=None, lt=None, pmax=None, pmin=None, st=None, ver=None): # noqa: E501 + """ObjectAttributes - a model defined in Swagger""" # noqa: E501 + self._dim = None + self._gt = None + self._lt = None + self._pmax = None + self._pmin = None + self._st = None + self._ver = None + self.discriminator = None + if dim is not None: + self.dim = dim + if gt is not None: + self.gt = gt + if lt is not None: + self.lt = lt + if pmax is not None: + self.pmax = pmax + if pmin is not None: + self.pmin = pmin + if st is not None: + self.st = st + if ver is not None: + self.ver = ver + + @property + def dim(self): + """Gets the dim of this ObjectAttributes. # noqa: E501 + + + :return: The dim of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._dim + + @dim.setter + def dim(self, dim): + """Sets the dim of this ObjectAttributes. + + + :param dim: The dim of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._dim = dim + + @property + def gt(self): + """Gets the gt of this ObjectAttributes. # noqa: E501 + + + :return: The gt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._gt + + @gt.setter + def gt(self, gt): + """Sets the gt of this ObjectAttributes. + + + :param gt: The gt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._gt = gt + + @property + def lt(self): + """Gets the lt of this ObjectAttributes. # noqa: E501 + + + :return: The lt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._lt + + @lt.setter + def lt(self, lt): + """Sets the lt of this ObjectAttributes. + + + :param lt: The lt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._lt = lt + + @property + def pmax(self): + """Gets the pmax of this ObjectAttributes. # noqa: E501 + + + :return: The pmax of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmax + + @pmax.setter + def pmax(self, pmax): + """Sets the pmax of this ObjectAttributes. + + + :param pmax: The pmax of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmax = pmax + + @property + def pmin(self): + """Gets the pmin of this ObjectAttributes. # noqa: E501 + + + :return: The pmin of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmin + + @pmin.setter + def pmin(self, pmin): + """Sets the pmin of this ObjectAttributes. + + + :param pmin: The pmin of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmin = pmin + + @property + def st(self): + """Gets the st of this ObjectAttributes. # noqa: E501 + + + :return: The st of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._st + + @st.setter + def st(self, st): + """Sets the st of this ObjectAttributes. + + + :param st: The st of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._st = st + + @property + def ver(self): + """Gets the ver of this ObjectAttributes. # noqa: E501 + + + :return: The ver of this ObjectAttributes. # noqa: E501 + :rtype: str + """ + return self._ver + + @ver.setter + def ver(self, ver): + """Sets the ver of this ObjectAttributes. + + + :param ver: The ver of this ObjectAttributes. # noqa: E501 + :type: str + """ + + self._ver = ver + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectAttributes, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectAttributes): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/object_node.py b/billinglayer/python/tb_rest_client/models/models_pe/object_node.py new file mode 100644 index 0000000..ad354da --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/object_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """ObjectNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/originator_entity_owner_users_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/originator_entity_owner_users_filter.py new file mode 100644 index 0000000..9e8a3c8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/originator_entity_owner_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OriginatorEntityOwnerUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OriginatorEntityOwnerUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OriginatorEntityOwnerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OriginatorEntityOwnerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/ota_package.py b/billinglayer/python/tb_rest_client/models/models_pe/ota_package.py new file mode 100644 index 0000000..bf480a5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/ota_package.py @@ -0,0 +1,576 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'data': 'ByteBuffer', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'data': 'data', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, data=None, additional_info=None): # noqa: E501 + """OtaPackage - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._data = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if data is not None: + self.data = data + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackage. # noqa: E501 + + + :return: The id of this OtaPackage. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackage. + + + :param id: The id of this OtaPackage. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackage. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackage. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackage. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackage. # noqa: E501 + + + :return: The tenant_id of this OtaPackage. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackage. + + + :param tenant_id: The tenant_id of this OtaPackage. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackage. # noqa: E501 + + + :return: The device_profile_id of this OtaPackage. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackage. + + + :param device_profile_id: The device_profile_id of this OtaPackage. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackage. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackage. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackage. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackage. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackage. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackage. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackage. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackage. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackage. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackage. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackage. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackage. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackage. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackage. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackage. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackage. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackage. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackage. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackage. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackage. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackage. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackage. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackage. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackage. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackage. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackage. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackage. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackage. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackage. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackage. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackage. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackage. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def data(self): + """Gets the data of this OtaPackage. # noqa: E501 + + + :return: The data of this OtaPackage. # noqa: E501 + :rtype: ByteBuffer + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OtaPackage. + + + :param data: The data of this OtaPackage. # noqa: E501 + :type: ByteBuffer + """ + + self._data = data + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackage. # noqa: E501 + + + :return: The additional_info of this OtaPackage. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackage. + + + :param additional_info: The additional_info of this OtaPackage. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/ota_package_id.py b/billinglayer/python/tb_rest_client/models/models_pe/ota_package_id.py new file mode 100644 index 0000000..b014418 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/ota_package_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """OtaPackageId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this OtaPackageId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this OtaPackageId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this OtaPackageId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this OtaPackageId. + + string # noqa: E501 + + :param entity_type: The entity_type of this OtaPackageId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["OTA_PACKAGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/ota_package_info.py b/billinglayer/python/tb_rest_client/models/models_pe/ota_package_info.py new file mode 100644 index 0000000..1d66159 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/ota_package_info.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, additional_info=None): # noqa: E501 + """OtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackageInfo. # noqa: E501 + + + :return: The id of this OtaPackageInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageInfo. + + + :param id: The id of this OtaPackageInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackageInfo. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackageInfo. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackageInfo. # noqa: E501 + + + :return: The tenant_id of this OtaPackageInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackageInfo. + + + :param tenant_id: The tenant_id of this OtaPackageInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackageInfo. # noqa: E501 + + + :return: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackageInfo. + + + :param device_profile_id: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackageInfo. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackageInfo. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackageInfo. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackageInfo. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackageInfo. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackageInfo. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackageInfo. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackageInfo. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackageInfo. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackageInfo. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackageInfo. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackageInfo. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackageInfo. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackageInfo. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackageInfo. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackageInfo. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageInfo. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageInfo. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackageInfo. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackageInfo. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackageInfo. # noqa: E501 + + + :return: The additional_info of this OtaPackageInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackageInfo. + + + :param additional_info: The additional_info of this OtaPackageInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/ota_package_ota_package_id_body.py b/billinglayer/python/tb_rest_client/models/models_pe/ota_package_ota_package_id_body.py new file mode 100644 index 0000000..4cde49f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/ota_package_ota_package_id_body.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageOtaPackageIdBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'checksum': 'str', + 'checksum_algorithm': 'str', + 'file': 'str' + } + + attribute_map = { + 'checksum': 'checksum', + 'checksum_algorithm': 'checksumAlgorithm', + 'file': 'file' + } + + def __init__(self, checksum=None, checksum_algorithm=None, file=None): # noqa: E501 + """OtaPackageOtaPackageIdBody - a model defined in Swagger""" # noqa: E501 + self._checksum = None + self._checksum_algorithm = None + self._file = None + self.discriminator = None + if checksum is not None: + self.checksum = checksum + self.checksum_algorithm = checksum_algorithm + self.file = file + + @property + def checksum(self): + """Gets the checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :return: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageOtaPackageIdBody. + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :param checksum: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageOtaPackageIdBody. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if checksum_algorithm is None: + raise ValueError("Invalid value for `checksum_algorithm`, must not be `None`") # noqa: E501 + + self._checksum_algorithm = checksum_algorithm + + @property + def file(self): + """Gets the file of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package data. # noqa: E501 + + :return: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this OtaPackageOtaPackageIdBody. + + OTA Package data. # noqa: E501 + + :param file: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if file is None: + raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501 + + self._file = file + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageOtaPackageIdBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageOtaPackageIdBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/other_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/other_configuration.py new file mode 100644 index 0000000..3a97795 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/other_configuration.py @@ -0,0 +1,338 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtherConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_only_observe_after_connect': 'int', + 'edrx_cycle': 'int', + 'fw_update_resource': 'str', + 'fw_update_strategy': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int', + 'sw_update_resource': 'str', + 'sw_update_strategy': 'int' + } + + attribute_map = { + 'client_only_observe_after_connect': 'clientOnlyObserveAfterConnect', + 'edrx_cycle': 'edrxCycle', + 'fw_update_resource': 'fwUpdateResource', + 'fw_update_strategy': 'fwUpdateStrategy', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer', + 'sw_update_resource': 'swUpdateResource', + 'sw_update_strategy': 'swUpdateStrategy' + } + + def __init__(self, client_only_observe_after_connect=None, edrx_cycle=None, fw_update_resource=None, fw_update_strategy=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, sw_update_resource=None, sw_update_strategy=None): # noqa: E501 + """OtherConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_only_observe_after_connect = None + self._edrx_cycle = None + self._fw_update_resource = None + self._fw_update_strategy = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self._sw_update_resource = None + self._sw_update_strategy = None + self.discriminator = None + if client_only_observe_after_connect is not None: + self.client_only_observe_after_connect = client_only_observe_after_connect + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if fw_update_resource is not None: + self.fw_update_resource = fw_update_resource + if fw_update_strategy is not None: + self.fw_update_strategy = fw_update_strategy + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + if sw_update_resource is not None: + self.sw_update_resource = sw_update_resource + if sw_update_strategy is not None: + self.sw_update_strategy = sw_update_strategy + + @property + def client_only_observe_after_connect(self): + """Gets the client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + + + :return: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._client_only_observe_after_connect + + @client_only_observe_after_connect.setter + def client_only_observe_after_connect(self, client_only_observe_after_connect): + """Sets the client_only_observe_after_connect of this OtherConfiguration. + + + :param client_only_observe_after_connect: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._client_only_observe_after_connect = client_only_observe_after_connect + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this OtherConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this OtherConfiguration. + + + :param edrx_cycle: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def fw_update_resource(self): + """Gets the fw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._fw_update_resource + + @fw_update_resource.setter + def fw_update_resource(self, fw_update_resource): + """Sets the fw_update_resource of this OtherConfiguration. + + + :param fw_update_resource: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._fw_update_resource = fw_update_resource + + @property + def fw_update_strategy(self): + """Gets the fw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._fw_update_strategy + + @fw_update_strategy.setter + def fw_update_strategy(self, fw_update_strategy): + """Sets the fw_update_strategy of this OtherConfiguration. + + + :param fw_update_strategy: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._fw_update_strategy = fw_update_strategy + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this OtherConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this OtherConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this OtherConfiguration. # noqa: E501 + + + :return: The power_mode of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this OtherConfiguration. + + + :param power_mode: The power_mode of this OtherConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this OtherConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this OtherConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + @property + def sw_update_resource(self): + """Gets the sw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._sw_update_resource + + @sw_update_resource.setter + def sw_update_resource(self, sw_update_resource): + """Sets the sw_update_resource of this OtherConfiguration. + + + :param sw_update_resource: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._sw_update_resource = sw_update_resource + + @property + def sw_update_strategy(self): + """Gets the sw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._sw_update_strategy + + @sw_update_strategy.setter + def sw_update_strategy(self, sw_update_strategy): + """Sets the sw_update_strategy of this OtherConfiguration. + + + :param sw_update_strategy: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._sw_update_strategy = sw_update_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtherConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtherConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_blob_entity_with_customer_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_blob_entity_with_customer_info.py new file mode 100644 index 0000000..af1633a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_blob_entity_with_customer_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataBlobEntityWithCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[BlobEntityWithCustomerInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataBlobEntityWithCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: list[BlobEntityWithCustomerInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataBlobEntityWithCustomerInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: list[BlobEntityWithCustomerInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataBlobEntityWithCustomerInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataBlobEntityWithCustomerInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataBlobEntityWithCustomerInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataBlobEntityWithCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataBlobEntityWithCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_contact_basedobject.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_contact_basedobject.py new file mode 100644 index 0000000..ea5cf2b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_contact_basedobject.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataContactBasedobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[ContactBasedobject]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataContactBasedobject - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataContactBasedobject. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataContactBasedobject. # noqa: E501 + :rtype: list[ContactBasedobject] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataContactBasedobject. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataContactBasedobject. # noqa: E501 + :type: list[ContactBasedobject] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataContactBasedobject. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataContactBasedobject. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataContactBasedobject. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataContactBasedobject. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataContactBasedobject. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataContactBasedobject. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataContactBasedobject. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataContactBasedobject. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataContactBasedobject. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataContactBasedobject. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataContactBasedobject. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataContactBasedobject. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataContactBasedobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataContactBasedobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_converter.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_converter.py new file mode 100644 index 0000000..bb12633 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_converter.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataConverter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Converter]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataConverter - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataConverter. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataConverter. # noqa: E501 + :rtype: list[Converter] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataConverter. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataConverter. # noqa: E501 + :type: list[Converter] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataConverter. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataConverter. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataConverter. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataConverter. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataConverter. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataConverter. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataConverter. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataConverter. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataConverter. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataConverter. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataConverter. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataConverter. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataConverter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataConverter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_customer_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_customer_info.py new file mode 100644 index 0000000..70a1668 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_customer_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[CustomerInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataCustomerInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataCustomerInfo. # noqa: E501 + :rtype: list[CustomerInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataCustomerInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataCustomerInfo. # noqa: E501 + :type: list[CustomerInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataCustomerInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataCustomerInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataCustomerInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataCustomerInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataCustomerInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataCustomerInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataCustomerInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge.py new file mode 100644 index 0000000..a7b3929 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Edge]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdge - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdge. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdge. # noqa: E501 + :rtype: list[Edge] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdge. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdge. # noqa: E501 + :type: list[Edge] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdge. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdge. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdge. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdge. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdge. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdge. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdge. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdge. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge_event.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge_event.py new file mode 100644 index 0000000..093296a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeEvent]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeEvent. # noqa: E501 + :rtype: list[EdgeEvent] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeEvent. # noqa: E501 + :type: list[EdgeEvent] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge_info.py new file mode 100644 index 0000000..9c0d44f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_edge_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeInfo. # noqa: E501 + :rtype: list[EdgeInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeInfo. # noqa: E501 + :type: list[EdgeInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_group.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_group.py new file mode 100644 index 0000000..0bd1f79 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_group.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityGroup(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityGroup]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityGroup - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityGroup. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityGroup. # noqa: E501 + :rtype: list[EntityGroup] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityGroup. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityGroup. # noqa: E501 + :type: list[EntityGroup] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityGroup. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityGroup. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityGroup. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityGroup. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityGroup. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityGroup. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityGroup. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityGroup. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityGroup. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityGroup. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityGroup. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityGroup. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityGroup, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityGroup): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_group_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_group_info.py new file mode 100644 index 0000000..82b3918 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_group_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityGroupInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityGroupInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityGroupInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityGroupInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: list[EntityGroupInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityGroupInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityGroupInfo. # noqa: E501 + :type: list[EntityGroupInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityGroupInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityGroupInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityGroupInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityGroupInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityGroupInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityGroupInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityGroupInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityGroupInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityGroupInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityGroupInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityGroupInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_version.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_version.py new file mode 100644 index 0000000..a26c1db --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_version.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityVersion]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityVersion. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityVersion. # noqa: E501 + :rtype: list[EntityVersion] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityVersion. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityVersion. # noqa: E501 + :type: list[EntityVersion] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityVersion. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityVersion. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityVersion. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityVersion. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityVersion. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityVersion. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_view_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_view_info.py new file mode 100644 index 0000000..7c7fed2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_entity_view_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityViewInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityViewInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityViewInfo. # noqa: E501 + :rtype: list[EntityViewInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityViewInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityViewInfo. # noqa: E501 + :type: list[EntityViewInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityViewInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityViewInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityViewInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityViewInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityViewInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityViewInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_event.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_event.py new file mode 100644 index 0000000..7a4d5f0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Event]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEvent. # noqa: E501 + :rtype: list[Event] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEvent. # noqa: E501 + :type: list[Event] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_event_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_event_info.py new file mode 100644 index 0000000..4dd244a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_event_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EventInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEventInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEventInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEventInfo. # noqa: E501 + :rtype: list[EventInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEventInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEventInfo. # noqa: E501 + :type: list[EventInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEventInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEventInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEventInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEventInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEventInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEventInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEventInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEventInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_integration.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_integration.py new file mode 100644 index 0000000..2cd4de5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_integration.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataIntegration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Integration]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataIntegration - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataIntegration. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataIntegration. # noqa: E501 + :rtype: list[Integration] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataIntegration. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataIntegration. # noqa: E501 + :type: list[Integration] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataIntegration. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataIntegration. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataIntegration. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataIntegration. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataIntegration. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataIntegration. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataIntegration. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataIntegration. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataIntegration. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataIntegration. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataIntegration. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataIntegration. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataIntegration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataIntegration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_integration_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_integration_info.py new file mode 100644 index 0000000..cf532e4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_integration_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataIntegrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[IntegrationInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataIntegrationInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataIntegrationInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataIntegrationInfo. # noqa: E501 + :rtype: list[IntegrationInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataIntegrationInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataIntegrationInfo. # noqa: E501 + :type: list[IntegrationInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataIntegrationInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataIntegrationInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataIntegrationInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataIntegrationInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataIntegrationInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataIntegrationInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataIntegrationInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataIntegrationInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataIntegrationInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataIntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataIntegrationInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataIntegrationInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataIntegrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataIntegrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_ota_package_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_ota_package_info.py new file mode 100644 index 0000000..27170d7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_ota_package_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataOtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[OtaPackageInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataOtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataOtaPackageInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: list[OtaPackageInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataOtaPackageInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataOtaPackageInfo. # noqa: E501 + :type: list[OtaPackageInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataOtaPackageInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataOtaPackageInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataOtaPackageInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataOtaPackageInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataOtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataOtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_queue.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_queue.py new file mode 100644 index 0000000..ee319f3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_queue.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataQueue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Queue]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataQueue - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataQueue. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataQueue. # noqa: E501 + :rtype: list[Queue] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataQueue. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataQueue. # noqa: E501 + :type: list[Queue] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataQueue. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataQueue. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataQueue. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataQueue. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataQueue. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataQueue. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataQueue. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataQueue. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataQueue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataQueue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_role.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_role.py new file mode 100644 index 0000000..38b734c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_role.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRole(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Role]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataRole - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataRole. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataRole. # noqa: E501 + :rtype: list[Role] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRole. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataRole. # noqa: E501 + :type: list[Role] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRole. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataRole. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRole. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataRole. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRole. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataRole. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRole. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataRole. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataRole. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataRole. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRole. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataRole. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRole, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRole): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_rule_chain.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_rule_chain.py new file mode 100644 index 0000000..d9f93a9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_rule_chain.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[RuleChain]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataRuleChain - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataRuleChain. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataRuleChain. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRuleChain. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataRuleChain. # noqa: E501 + :type: list[RuleChain] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRuleChain. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRuleChain. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRuleChain. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRuleChain. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataRuleChain. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataRuleChain. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRuleChain. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataRuleChain. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_scheduler_event_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_scheduler_event_info.py new file mode 100644 index 0000000..6a96fe7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_scheduler_event_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataSchedulerEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[SchedulerEventInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataSchedulerEventInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataSchedulerEventInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: list[SchedulerEventInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataSchedulerEventInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataSchedulerEventInfo. # noqa: E501 + :type: list[SchedulerEventInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataSchedulerEventInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataSchedulerEventInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataSchedulerEventInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataSchedulerEventInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataSchedulerEventInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataSchedulerEventInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataSchedulerEventInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataSchedulerEventInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataSchedulerEventInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataSchedulerEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataSchedulerEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_short_entity_view.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_short_entity_view.py new file mode 100644 index 0000000..c463e1a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_short_entity_view.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataShortEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[ShortEntityView]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataShortEntityView - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataShortEntityView. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataShortEntityView. # noqa: E501 + :rtype: list[ShortEntityView] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataShortEntityView. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataShortEntityView. # noqa: E501 + :type: list[ShortEntityView] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataShortEntityView. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataShortEntityView. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataShortEntityView. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataShortEntityView. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataShortEntityView. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataShortEntityView. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataShortEntityView. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataShortEntityView. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataShortEntityView. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataShortEntityView. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataShortEntityView. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataShortEntityView. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataShortEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataShortEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_tb_resource_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_tb_resource_info.py new file mode 100644 index 0000000..23e3b00 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_tb_resource_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TbResourceInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTbResourceInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTbResourceInfo. # noqa: E501 + :rtype: list[TbResourceInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTbResourceInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTbResourceInfo. # noqa: E501 + :type: list[TbResourceInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTbResourceInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTbResourceInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTbResourceInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTbResourceInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTbResourceInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTbResourceInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_user_email_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_user_email_info.py new file mode 100644 index 0000000..3a14aa3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_user_email_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[UserEmailInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUserEmailInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUserEmailInfo. # noqa: E501 + :rtype: list[UserEmailInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUserEmailInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUserEmailInfo. # noqa: E501 + :type: list[UserEmailInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUserEmailInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUserEmailInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUserEmailInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUserEmailInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUserEmailInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUserEmailInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/page_data_user_info.py b/billinglayer/python/tb_rest_client/models/models_pe/page_data_user_info.py new file mode 100644 index 0000000..60a6106 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/page_data_user_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUserInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[UserInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUserInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUserInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUserInfo. # noqa: E501 + :rtype: list[UserInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUserInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUserInfo. # noqa: E501 + :type: list[UserInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUserInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUserInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUserInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUserInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUserInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUserInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUserInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUserInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUserInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUserInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUserInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUserInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUserInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUserInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/palette.py b/billinglayer/python/tb_rest_client/models/models_pe/palette.py new file mode 100644 index 0000000..9935214 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/palette.py @@ -0,0 +1,183 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Palette(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'extends': 'str', + 'colors': 'dict(str, str)' + } + + attribute_map = { + 'type': 'type', + 'extends': 'extends', + 'colors': 'colors' + } + + def __init__(self, type=None, extends=None, colors=None): # noqa: E501 + """Palette - a model defined in Swagger""" # noqa: E501 + self._type = None + self._extends = None + self._colors = None + self.discriminator = None + self.type = type + if extends is not None: + self.extends = extends + if colors is not None: + self.colors = colors + + @property + def type(self): + """Gets the type of this Palette. # noqa: E501 + + Name of the pre-defined palette, or 'custom' # noqa: E501 + + :return: The type of this Palette. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Palette. + + Name of the pre-defined palette, or 'custom' # noqa: E501 + + :param type: The type of this Palette. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def extends(self): + """Gets the extends of this Palette. # noqa: E501 + + Pre-defined palette name that the custom palette extends # noqa: E501 + + :return: The extends of this Palette. # noqa: E501 + :rtype: str + """ + return self._extends + + @extends.setter + def extends(self, extends): + """Sets the extends of this Palette. + + Pre-defined palette name that the custom palette extends # noqa: E501 + + :param extends: The extends of this Palette. # noqa: E501 + :type: str + """ + + self._extends = extends + + @property + def colors(self): + """Gets the colors of this Palette. # noqa: E501 + + Mapping of hue identifier number to the rgb(a) color code # noqa: E501 + + :return: The colors of this Palette. # noqa: E501 + :rtype: dict(str, str) + """ + return self._colors + + @colors.setter + def colors(self, colors): + """Sets the colors of this Palette. + + Mapping of hue identifier number to the rgb(a) color code # noqa: E501 + + :param colors: The colors of this Palette. # noqa: E501 + :type: dict(str, str) + """ + + self._colors = colors + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Palette, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Palette): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/palette_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/palette_settings.py new file mode 100644 index 0000000..d50a7e3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/palette_settings.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PaletteSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'primary_palette': 'Palette', + 'accent_palette': 'Palette' + } + + attribute_map = { + 'primary_palette': 'primaryPalette', + 'accent_palette': 'accentPalette' + } + + def __init__(self, primary_palette=None, accent_palette=None): # noqa: E501 + """PaletteSettings - a model defined in Swagger""" # noqa: E501 + self._primary_palette = None + self._accent_palette = None + self.discriminator = None + self.primary_palette = primary_palette + self.accent_palette = accent_palette + + @property + def primary_palette(self): + """Gets the primary_palette of this PaletteSettings. # noqa: E501 + + + :return: The primary_palette of this PaletteSettings. # noqa: E501 + :rtype: Palette + """ + return self._primary_palette + + @primary_palette.setter + def primary_palette(self, primary_palette): + """Sets the primary_palette of this PaletteSettings. + + + :param primary_palette: The primary_palette of this PaletteSettings. # noqa: E501 + :type: Palette + """ + if primary_palette is None: + raise ValueError("Invalid value for `primary_palette`, must not be `None`") # noqa: E501 + + self._primary_palette = primary_palette + + @property + def accent_palette(self): + """Gets the accent_palette of this PaletteSettings. # noqa: E501 + + + :return: The accent_palette of this PaletteSettings. # noqa: E501 + :rtype: Palette + """ + return self._accent_palette + + @accent_palette.setter + def accent_palette(self, accent_palette): + """Sets the accent_palette of this PaletteSettings. + + + :param accent_palette: The accent_palette of this PaletteSettings. # noqa: E501 + :type: Palette + """ + if accent_palette is None: + raise ValueError("Invalid value for `accent_palette`, must not be `None`") # noqa: E501 + + self._accent_palette = accent_palette + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PaletteSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PaletteSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/platform_two_fa_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/platform_two_fa_settings.py new file mode 100644 index 0000000..18d6d89 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/platform_two_fa_settings.py @@ -0,0 +1,257 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PlatformTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'max_verification_failures_before_user_lockout': 'int', + 'min_verification_code_send_period': 'int', + 'providers': 'list[TwoFaProviderConfig]', + 'total_allowed_time_for_verification': 'int', + 'use_system_two_factor_auth_settings': 'bool', + 'verification_code_check_rate_limit': 'str' + } + + attribute_map = { + 'max_verification_failures_before_user_lockout': 'maxVerificationFailuresBeforeUserLockout', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'providers': 'providers', + 'total_allowed_time_for_verification': 'totalAllowedTimeForVerification', + 'use_system_two_factor_auth_settings': 'useSystemTwoFactorAuthSettings', + 'verification_code_check_rate_limit': 'verificationCodeCheckRateLimit' + } + + def __init__(self, max_verification_failures_before_user_lockout=None, min_verification_code_send_period=None, providers=None, total_allowed_time_for_verification=None, use_system_two_factor_auth_settings=None, verification_code_check_rate_limit=None): # noqa: E501 + """PlatformTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._max_verification_failures_before_user_lockout = None + self._min_verification_code_send_period = None + self._providers = None + self._total_allowed_time_for_verification = None + self._use_system_two_factor_auth_settings = None + self._verification_code_check_rate_limit = None + self.discriminator = None + if max_verification_failures_before_user_lockout is not None: + self.max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + self.min_verification_code_send_period = min_verification_code_send_period + self.providers = providers + self.total_allowed_time_for_verification = total_allowed_time_for_verification + if use_system_two_factor_auth_settings is not None: + self.use_system_two_factor_auth_settings = use_system_two_factor_auth_settings + if verification_code_check_rate_limit is not None: + self.verification_code_check_rate_limit = verification_code_check_rate_limit + + @property + def max_verification_failures_before_user_lockout(self): + """Gets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._max_verification_failures_before_user_lockout + + @max_verification_failures_before_user_lockout.setter + def max_verification_failures_before_user_lockout(self, max_verification_failures_before_user_lockout): + """Sets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. + + + :param max_verification_failures_before_user_lockout: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + + self._max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this PlatformTwoFaSettings. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if min_verification_code_send_period is None: + raise ValueError("Invalid value for `min_verification_code_send_period`, must not be `None`") # noqa: E501 + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def providers(self): + """Gets the providers of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The providers of this PlatformTwoFaSettings. # noqa: E501 + :rtype: list[TwoFaProviderConfig] + """ + return self._providers + + @providers.setter + def providers(self, providers): + """Sets the providers of this PlatformTwoFaSettings. + + + :param providers: The providers of this PlatformTwoFaSettings. # noqa: E501 + :type: list[TwoFaProviderConfig] + """ + if providers is None: + raise ValueError("Invalid value for `providers`, must not be `None`") # noqa: E501 + + self._providers = providers + + @property + def total_allowed_time_for_verification(self): + """Gets the total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._total_allowed_time_for_verification + + @total_allowed_time_for_verification.setter + def total_allowed_time_for_verification(self, total_allowed_time_for_verification): + """Sets the total_allowed_time_for_verification of this PlatformTwoFaSettings. + + + :param total_allowed_time_for_verification: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if total_allowed_time_for_verification is None: + raise ValueError("Invalid value for `total_allowed_time_for_verification`, must not be `None`") # noqa: E501 + + self._total_allowed_time_for_verification = total_allowed_time_for_verification + + @property + def use_system_two_factor_auth_settings(self): + """Gets the use_system_two_factor_auth_settings of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The use_system_two_factor_auth_settings of this PlatformTwoFaSettings. # noqa: E501 + :rtype: bool + """ + return self._use_system_two_factor_auth_settings + + @use_system_two_factor_auth_settings.setter + def use_system_two_factor_auth_settings(self, use_system_two_factor_auth_settings): + """Sets the use_system_two_factor_auth_settings of this PlatformTwoFaSettings. + + + :param use_system_two_factor_auth_settings: The use_system_two_factor_auth_settings of this PlatformTwoFaSettings. # noqa: E501 + :type: bool + """ + + self._use_system_two_factor_auth_settings = use_system_two_factor_auth_settings + + @property + def verification_code_check_rate_limit(self): + """Gets the verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :rtype: str + """ + return self._verification_code_check_rate_limit + + @verification_code_check_rate_limit.setter + def verification_code_check_rate_limit(self, verification_code_check_rate_limit): + """Sets the verification_code_check_rate_limit of this PlatformTwoFaSettings. + + + :param verification_code_check_rate_limit: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :type: str + """ + + self._verification_code_check_rate_limit = verification_code_check_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/platform_users_notification_target_config.py b/billinglayer/python/tb_rest_client/models/models_pe/platform_users_notification_target_config.py new file mode 100644 index 0000000..8754aa2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/platform_users_notification_target_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class PlatformUsersNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'users_filter': 'UsersFilter' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'description': 'description', + 'users_filter': 'usersFilter' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, description=None, users_filter=None, *args, **kwargs): # noqa: E501 + """PlatformUsersNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self._users_filter = None + self.discriminator = None + if description is not None: + self.description = description + self.users_filter = users_filter + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def description(self): + """Gets the description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this PlatformUsersNotificationTargetConfig. + + + :param description: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def users_filter(self): + """Gets the users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: UsersFilter + """ + return self._users_filter + + @users_filter.setter + def users_filter(self, users_filter): + """Sets the users_filter of this PlatformUsersNotificationTargetConfig. + + + :param users_filter: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: UsersFilter + """ + if users_filter is None: + raise ValueError("Invalid value for `users_filter`, must not be `None`") # noqa: E501 + + self._users_filter = users_filter + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformUsersNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformUsersNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/power_saving_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/power_saving_configuration.py new file mode 100644 index 0000000..4504589 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/power_saving_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PowerSavingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None): # noqa: E501 + """PowerSavingConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this PowerSavingConfiguration. + + + :param edrx_cycle: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this PowerSavingConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this PowerSavingConfiguration. # noqa: E501 + + + :return: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this PowerSavingConfiguration. + + + :param power_mode: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this PowerSavingConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PowerSavingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PowerSavingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/processing_strategy.py b/billinglayer/python/tb_rest_client/models/models_pe/processing_strategy.py new file mode 100644 index 0000000..831fef8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/processing_strategy.py @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ProcessingStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'failure_percentage': 'float', + 'max_pause_between_retries': 'int', + 'pause_between_retries': 'int', + 'retries': 'int', + 'type': 'str' + } + + attribute_map = { + 'failure_percentage': 'failurePercentage', + 'max_pause_between_retries': 'maxPauseBetweenRetries', + 'pause_between_retries': 'pauseBetweenRetries', + 'retries': 'retries', + 'type': 'type' + } + + def __init__(self, failure_percentage=None, max_pause_between_retries=None, pause_between_retries=None, retries=None, type=None): # noqa: E501 + """ProcessingStrategy - a model defined in Swagger""" # noqa: E501 + self._failure_percentage = None + self._max_pause_between_retries = None + self._pause_between_retries = None + self._retries = None + self._type = None + self.discriminator = None + if failure_percentage is not None: + self.failure_percentage = failure_percentage + if max_pause_between_retries is not None: + self.max_pause_between_retries = max_pause_between_retries + if pause_between_retries is not None: + self.pause_between_retries = pause_between_retries + if retries is not None: + self.retries = retries + if type is not None: + self.type = type + + @property + def failure_percentage(self): + """Gets the failure_percentage of this ProcessingStrategy. # noqa: E501 + + + :return: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :rtype: float + """ + return self._failure_percentage + + @failure_percentage.setter + def failure_percentage(self, failure_percentage): + """Sets the failure_percentage of this ProcessingStrategy. + + + :param failure_percentage: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :type: float + """ + + self._failure_percentage = failure_percentage + + @property + def max_pause_between_retries(self): + """Gets the max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._max_pause_between_retries + + @max_pause_between_retries.setter + def max_pause_between_retries(self, max_pause_between_retries): + """Sets the max_pause_between_retries of this ProcessingStrategy. + + + :param max_pause_between_retries: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._max_pause_between_retries = max_pause_between_retries + + @property + def pause_between_retries(self): + """Gets the pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._pause_between_retries + + @pause_between_retries.setter + def pause_between_retries(self, pause_between_retries): + """Sets the pause_between_retries of this ProcessingStrategy. + + + :param pause_between_retries: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._pause_between_retries = pause_between_retries + + @property + def retries(self): + """Gets the retries of this ProcessingStrategy. # noqa: E501 + + + :return: The retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this ProcessingStrategy. + + + :param retries: The retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def type(self): + """Gets the type of this ProcessingStrategy. # noqa: E501 + + + :return: The type of this ProcessingStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ProcessingStrategy. + + + :param type: The type of this ProcessingStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["RETRY_ALL", "RETRY_FAILED", "RETRY_FAILED_AND_TIMED_OUT", "RETRY_TIMED_OUT", "SKIP_ALL_FAILURES", "SKIP_ALL_FAILURES_AND_TIMED_OUT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProcessingStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProcessingStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/proto_transport_payload_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/proto_transport_payload_configuration.py new file mode 100644 index 0000000..3471428 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/proto_transport_payload_configuration.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class ProtoTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_proto_schema': 'str', + 'device_rpc_request_proto_schema': 'str', + 'device_rpc_response_proto_schema': 'str', + 'device_telemetry_proto_schema': 'str', + 'enable_compatibility_with_json_payload_format': 'bool', + 'use_json_payload_format_for_default_downlink_topics': 'bool' + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + 'device_attributes_proto_schema': 'deviceAttributesProtoSchema', + 'device_rpc_request_proto_schema': 'deviceRpcRequestProtoSchema', + 'device_rpc_response_proto_schema': 'deviceRpcResponseProtoSchema', + 'device_telemetry_proto_schema': 'deviceTelemetryProtoSchema', + 'enable_compatibility_with_json_payload_format': 'enableCompatibilityWithJsonPayloadFormat', + 'use_json_payload_format_for_default_downlink_topics': 'useJsonPayloadFormatForDefaultDownlinkTopics' + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, device_attributes_proto_schema=None, device_rpc_request_proto_schema=None, device_rpc_response_proto_schema=None, device_telemetry_proto_schema=None, enable_compatibility_with_json_payload_format=None, use_json_payload_format_for_default_downlink_topics=None, *args, **kwargs): # noqa: E501 + """ProtoTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_proto_schema = None + self._device_rpc_request_proto_schema = None + self._device_rpc_response_proto_schema = None + self._device_telemetry_proto_schema = None + self._enable_compatibility_with_json_payload_format = None + self._use_json_payload_format_for_default_downlink_topics = None + self.discriminator = None + if device_attributes_proto_schema is not None: + self.device_attributes_proto_schema = device_attributes_proto_schema + if device_rpc_request_proto_schema is not None: + self.device_rpc_request_proto_schema = device_rpc_request_proto_schema + if device_rpc_response_proto_schema is not None: + self.device_rpc_response_proto_schema = device_rpc_response_proto_schema + if device_telemetry_proto_schema is not None: + self.device_telemetry_proto_schema = device_telemetry_proto_schema + if enable_compatibility_with_json_payload_format is not None: + self.enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + if use_json_payload_format_for_default_downlink_topics is not None: + self.use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def device_attributes_proto_schema(self): + """Gets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_proto_schema + + @device_attributes_proto_schema.setter + def device_attributes_proto_schema(self, device_attributes_proto_schema): + """Sets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_attributes_proto_schema: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_proto_schema = device_attributes_proto_schema + + @property + def device_rpc_request_proto_schema(self): + """Gets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_request_proto_schema + + @device_rpc_request_proto_schema.setter + def device_rpc_request_proto_schema(self, device_rpc_request_proto_schema): + """Sets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_request_proto_schema: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_request_proto_schema = device_rpc_request_proto_schema + + @property + def device_rpc_response_proto_schema(self): + """Gets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_response_proto_schema + + @device_rpc_response_proto_schema.setter + def device_rpc_response_proto_schema(self, device_rpc_response_proto_schema): + """Sets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_response_proto_schema: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_response_proto_schema = device_rpc_response_proto_schema + + @property + def device_telemetry_proto_schema(self): + """Gets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_proto_schema + + @device_telemetry_proto_schema.setter + def device_telemetry_proto_schema(self, device_telemetry_proto_schema): + """Sets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_telemetry_proto_schema: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_proto_schema = device_telemetry_proto_schema + + @property + def enable_compatibility_with_json_payload_format(self): + """Gets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._enable_compatibility_with_json_payload_format + + @enable_compatibility_with_json_payload_format.setter + def enable_compatibility_with_json_payload_format(self, enable_compatibility_with_json_payload_format): + """Sets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. + + + :param enable_compatibility_with_json_payload_format: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + + @property + def use_json_payload_format_for_default_downlink_topics(self): + """Gets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._use_json_payload_format_for_default_downlink_topics + + @use_json_payload_format_for_default_downlink_topics.setter + def use_json_payload_format_for_default_downlink_topics(self, use_json_payload_format_for_default_downlink_topics): + """Sets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. + + + :param use_json_payload_format_for_default_downlink_topics: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProtoTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProtoTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/psk_lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_pe/psk_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..c32b3d8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/psk_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential # noqa: F401,E501 + +class PSKLwM2MBootstrapServerCredential(LwM2MBootstrapServerCredential): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + if hasattr(LwM2MBootstrapServerCredential, "swagger_types"): + swagger_types.update(LwM2MBootstrapServerCredential.swagger_types) + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + if hasattr(LwM2MBootstrapServerCredential, "attribute_map"): + attribute_map.update(LwM2MBootstrapServerCredential.attribute_map) + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None, *args, **kwargs): # noqa: E501 + """PSKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + LwM2MBootstrapServerCredential.__init__(self, *args, **kwargs) + + @property + def short_server_id(self): + """Gets the short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this PSKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this PSKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this PSKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this PSKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this PSKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this PSKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PSKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PSKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/psklw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_pe/psklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..04d0d7c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/psklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential # noqa: F401,E501 + +class PSKLwM2MBootstrapServerCredential(LwM2MBootstrapServerCredential): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + if hasattr(LwM2MBootstrapServerCredential, "swagger_types"): + swagger_types.update(LwM2MBootstrapServerCredential.swagger_types) + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + if hasattr(LwM2MBootstrapServerCredential, "attribute_map"): + attribute_map.update(LwM2MBootstrapServerCredential.attribute_map) + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None, *args, **kwargs): # noqa: E501 + """PSKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + LwM2MBootstrapServerCredential.__init__(self, *args, **kwargs) + + @property + def short_server_id(self): + """Gets the short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this PSKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this PSKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this PSKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this PSKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this PSKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this PSKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PSKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PSKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/queue.py b/billinglayer/python/tb_rest_client/models/models_pe/queue.py new file mode 100644 index 0000000..ddc6f1b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/queue.py @@ -0,0 +1,410 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Queue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'created_time': 'int', + 'id': 'QueueId', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'tenant_id': 'TenantId', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'tenant_id': 'tenantId', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, created_time=None, id=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, tenant_id=None, topic=None): # noqa: E501 + """Queue - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._created_time = None + self._id = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._tenant_id = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if tenant_id is not None: + self.tenant_id = tenant_id + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this Queue. # noqa: E501 + + + :return: The additional_info of this Queue. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Queue. + + + :param additional_info: The additional_info of this Queue. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this Queue. # noqa: E501 + + + :return: The consumer_per_partition of this Queue. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this Queue. + + + :param consumer_per_partition: The consumer_per_partition of this Queue. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def created_time(self): + """Gets the created_time of this Queue. # noqa: E501 + + + :return: The created_time of this Queue. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Queue. + + + :param created_time: The created_time of this Queue. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Queue. # noqa: E501 + + + :return: The id of this Queue. # noqa: E501 + :rtype: QueueId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Queue. + + + :param id: The id of this Queue. # noqa: E501 + :type: QueueId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Queue. # noqa: E501 + + + :return: The name of this Queue. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Queue. + + + :param name: The name of this Queue. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this Queue. # noqa: E501 + + + :return: The pack_processing_timeout of this Queue. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this Queue. + + + :param pack_processing_timeout: The pack_processing_timeout of this Queue. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this Queue. # noqa: E501 + + + :return: The partitions of this Queue. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this Queue. + + + :param partitions: The partitions of this Queue. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this Queue. # noqa: E501 + + + :return: The poll_interval of this Queue. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this Queue. + + + :param poll_interval: The poll_interval of this Queue. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this Queue. # noqa: E501 + + + :return: The processing_strategy of this Queue. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this Queue. + + + :param processing_strategy: The processing_strategy of this Queue. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this Queue. # noqa: E501 + + + :return: The submit_strategy of this Queue. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this Queue. + + + :param submit_strategy: The submit_strategy of this Queue. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def tenant_id(self): + """Gets the tenant_id of this Queue. # noqa: E501 + + + :return: The tenant_id of this Queue. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Queue. + + + :param tenant_id: The tenant_id of this Queue. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def topic(self): + """Gets the topic of this Queue. # noqa: E501 + + + :return: The topic of this Queue. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this Queue. + + + :param topic: The topic of this Queue. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Queue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Queue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/queue_id.py b/billinglayer/python/tb_rest_client/models/models_pe/queue_id.py new file mode 100644 index 0000000..66232db --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/queue_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class QueueId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """QueueId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this QueueId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this QueueId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this QueueId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this QueueId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this QueueId. # noqa: E501 + + + :return: The entity_type of this QueueId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this QueueId. + + + :param entity_type: The entity_type of this QueueId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(QueueId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, QueueId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/raw_data_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/raw_data_event_filter.py new file mode 100644 index 0000000..dccd75a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/raw_data_event_filter.py @@ -0,0 +1,277 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class RawDataEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'uuid': 'str', + 'message_type': 'str', + 'message': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'uuid': 'uuid', + 'message_type': 'messageType', + 'message': 'message' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, uuid=None, message_type=None, message=None, *args, **kwargs): # noqa: E501 + """RawDataEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._uuid = None + self._message_type = None + self._message = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if uuid is not None: + self.uuid = uuid + if message_type is not None: + self.message_type = message_type + if message is not None: + self.message = message + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this RawDataEventFilter. # noqa: E501 + + + :return: The not_empty of this RawDataEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RawDataEventFilter. + + + :param not_empty: The not_empty of this RawDataEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RawDataEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RawDataEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RawDataEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RawDataEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RawDataEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def uuid(self): + """Gets the uuid of this RawDataEventFilter. # noqa: E501 + + String value representing the uuid # noqa: E501 + + :return: The uuid of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """Sets the uuid of this RawDataEventFilter. + + String value representing the uuid # noqa: E501 + + :param uuid: The uuid of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._uuid = uuid + + @property + def message_type(self): + """Gets the message_type of this RawDataEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The message_type of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._message_type + + @message_type.setter + def message_type(self, message_type): + """Sets the message_type of this RawDataEventFilter. + + String value representing the message type # noqa: E501 + + :param message_type: The message_type of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._message_type = message_type + + @property + def message(self): + """Gets the message of this RawDataEventFilter. # noqa: E501 + + String value representing the message # noqa: E501 + + :return: The message of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this RawDataEventFilter. + + String value representing the message # noqa: E501 + + :param message: The message of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RawDataEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RawDataEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/relation_entity_type_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/relation_entity_type_filter.py new file mode 100644 index 0000000..0edd2b6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/relation_entity_type_filter.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationEntityTypeFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_types': 'list[str]' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_types': 'entityTypes' + } + + def __init__(self, relation_type=None, entity_types=None): # noqa: E501 + """RelationEntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_types = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_types is not None: + self.entity_types = entity_types + + @property + def relation_type(self): + """Gets the relation_type of this RelationEntityTypeFilter. # noqa: E501 + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RelationEntityTypeFilter. + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_types(self): + """Gets the entity_types of this RelationEntityTypeFilter. # noqa: E501 + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :return: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this RelationEntityTypeFilter. + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :param entity_types: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationEntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationEntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/relations_query_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/relations_query_filter.py new file mode 100644 index 0000000..aa8188d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/relations_query_filter.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class RelationsQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'filters': 'list[RelationEntityTypeFilter]', + 'max_level': 'int', + 'multi_root': 'bool', + 'multi_root_entities_type': 'str', + 'multi_root_entity_ids': 'list[str]', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'filters': 'filters', + 'max_level': 'maxLevel', + 'multi_root': 'multiRoot', + 'multi_root_entities_type': 'multiRootEntitiesType', + 'multi_root_entity_ids': 'multiRootEntityIds', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, fetch_last_level_only=None, filters=None, max_level=None, multi_root=None, multi_root_entities_type=None, multi_root_entity_ids=None, root_entity=None, *args, **kwargs): # noqa: E501 + """RelationsQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._fetch_last_level_only = None + self._filters = None + self._max_level = None + self._multi_root = None + self._multi_root_entities_type = None + self._multi_root_entity_ids = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if filters is not None: + self.filters = filters + if max_level is not None: + self.max_level = max_level + if multi_root is not None: + self.multi_root = multi_root + if multi_root_entities_type is not None: + self.multi_root_entities_type = multi_root_entities_type + if multi_root_entity_ids is not None: + self.multi_root_entity_ids = multi_root_entity_ids + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this RelationsQueryFilter. # noqa: E501 + + + :return: The direction of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsQueryFilter. + + + :param direction: The direction of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def filters(self): + """Gets the filters of this RelationsQueryFilter. # noqa: E501 + + + :return: The filters of this RelationsQueryFilter. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this RelationsQueryFilter. + + + :param filters: The filters of this RelationsQueryFilter. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def max_level(self): + """Gets the max_level of this RelationsQueryFilter. # noqa: E501 + + + :return: The max_level of this RelationsQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsQueryFilter. + + + :param max_level: The max_level of this RelationsQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def multi_root(self): + """Gets the multi_root of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._multi_root + + @multi_root.setter + def multi_root(self, multi_root): + """Sets the multi_root of this RelationsQueryFilter. + + + :param multi_root: The multi_root of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._multi_root = multi_root + + @property + def multi_root_entities_type(self): + """Gets the multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._multi_root_entities_type + + @multi_root_entities_type.setter + def multi_root_entities_type(self, multi_root_entities_type): + """Sets the multi_root_entities_type of this RelationsQueryFilter. + + + :param multi_root_entities_type: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if multi_root_entities_type not in allowed_values: + raise ValueError( + "Invalid value for `multi_root_entities_type` ({0}), must be one of {1}" # noqa: E501 + .format(multi_root_entities_type, allowed_values) + ) + + self._multi_root_entities_type = multi_root_entities_type + + @property + def multi_root_entity_ids(self): + """Gets the multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._multi_root_entity_ids + + @multi_root_entity_ids.setter + def multi_root_entity_ids(self, multi_root_entity_ids): + """Sets the multi_root_entity_ids of this RelationsQueryFilter. + + + :param multi_root_entity_ids: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._multi_root_entity_ids = multi_root_entity_ids + + @property + def root_entity(self): + """Gets the root_entity of this RelationsQueryFilter. # noqa: E501 + + + :return: The root_entity of this RelationsQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this RelationsQueryFilter. + + + :param root_entity: The root_entity of this RelationsQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/relations_search_parameters.py b/billinglayer/python/tb_rest_client/models/models_pe/relations_search_parameters.py new file mode 100644 index 0000000..c686cf4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/relations_search_parameters.py @@ -0,0 +1,284 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationsSearchParameters(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'root_id': 'str', + 'root_type': 'str', + 'direction': 'str', + 'relation_type_group': 'str', + 'max_level': 'int', + 'fetch_last_level_only': 'bool' + } + + attribute_map = { + 'root_id': 'rootId', + 'root_type': 'rootType', + 'direction': 'direction', + 'relation_type_group': 'relationTypeGroup', + 'max_level': 'maxLevel', + 'fetch_last_level_only': 'fetchLastLevelOnly' + } + + def __init__(self, root_id=None, root_type=None, direction=None, relation_type_group=None, max_level=None, fetch_last_level_only=None): # noqa: E501 + """RelationsSearchParameters - a model defined in Swagger""" # noqa: E501 + self._root_id = None + self._root_type = None + self._direction = None + self._relation_type_group = None + self._max_level = None + self._fetch_last_level_only = None + self.discriminator = None + if root_id is not None: + self.root_id = root_id + if root_type is not None: + self.root_type = root_type + if direction is not None: + self.direction = direction + if relation_type_group is not None: + self.relation_type_group = relation_type_group + if max_level is not None: + self.max_level = max_level + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + + @property + def root_id(self): + """Gets the root_id of this RelationsSearchParameters. # noqa: E501 + + Root entity id to start search from. # noqa: E501 + + :return: The root_id of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_id + + @root_id.setter + def root_id(self, root_id): + """Sets the root_id of this RelationsSearchParameters. + + Root entity id to start search from. # noqa: E501 + + :param root_id: The root_id of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + + self._root_id = root_id + + @property + def root_type(self): + """Gets the root_type of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The root_type of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_type + + @root_type.setter + def root_type(self, root_type): + """Sets the root_type of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param root_type: The root_type of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if root_type not in allowed_values: + raise ValueError( + "Invalid value for `root_type` ({0}), must be one of {1}" # noqa: E501 + .format(root_type, allowed_values) + ) + + self._root_type = root_type + + @property + def direction(self): + """Gets the direction of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The direction of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param direction: The direction of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def relation_type_group(self): + """Gets the relation_type_group of this RelationsSearchParameters. # noqa: E501 + + Type of the relation. # noqa: E501 + + :return: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._relation_type_group + + @relation_type_group.setter + def relation_type_group(self, relation_type_group): + """Sets the relation_type_group of this RelationsSearchParameters. + + Type of the relation. # noqa: E501 + + :param relation_type_group: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "FROM_ENTITY_GROUP", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if relation_type_group not in allowed_values: + raise ValueError( + "Invalid value for `relation_type_group` ({0}), must be one of {1}" # noqa: E501 + .format(relation_type_group, allowed_values) + ) + + self._relation_type_group = relation_type_group + + @property + def max_level(self): + """Gets the max_level of this RelationsSearchParameters. # noqa: E501 + + Maximum level of the search depth. # noqa: E501 + + :return: The max_level of this RelationsSearchParameters. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsSearchParameters. + + Maximum level of the search depth. # noqa: E501 + + :param max_level: The max_level of this RelationsSearchParameters. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :return: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsSearchParameters. + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsSearchParameters, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsSearchParameters): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/repeating_alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_pe/repeating_alarm_condition_spec.py new file mode 100644 index 0000000..593e10e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/repeating_alarm_condition_spec.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class RepeatingAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValueint' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, *args, **kwargs): # noqa: E501 + """RepeatingAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValueint + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this RepeatingAlarmConditionSpec. + + + :param predicate: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValueint + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepeatingAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepeatingAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/report_config.py b/billinglayer/python/tb_rest_client/models/models_pe/report_config.py new file mode 100644 index 0000000..fc35c8d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/report_config.py @@ -0,0 +1,358 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ReportConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'base_url': 'str', + 'dashboard_id': 'str', + 'name_pattern': 'str', + 'state': 'str', + 'timewindow': 'JsonNode', + 'timezone': 'str', + 'type': 'str', + 'use_current_user_credentials': 'bool', + 'use_dashboard_timewindow': 'bool', + 'user_id': 'str' + } + + attribute_map = { + 'base_url': 'baseUrl', + 'dashboard_id': 'dashboardId', + 'name_pattern': 'namePattern', + 'state': 'state', + 'timewindow': 'timewindow', + 'timezone': 'timezone', + 'type': 'type', + 'use_current_user_credentials': 'useCurrentUserCredentials', + 'use_dashboard_timewindow': 'useDashboardTimewindow', + 'user_id': 'userId' + } + + def __init__(self, base_url=None, dashboard_id=None, name_pattern=None, state=None, timewindow=None, timezone=None, type=None, use_current_user_credentials=None, use_dashboard_timewindow=None, user_id=None): # noqa: E501 + """ReportConfig - a model defined in Swagger""" # noqa: E501 + self._base_url = None + self._dashboard_id = None + self._name_pattern = None + self._state = None + self._timewindow = None + self._timezone = None + self._type = None + self._use_current_user_credentials = None + self._use_dashboard_timewindow = None + self._user_id = None + self.discriminator = None + if base_url is not None: + self.base_url = base_url + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if name_pattern is not None: + self.name_pattern = name_pattern + if state is not None: + self.state = state + if timewindow is not None: + self.timewindow = timewindow + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + if use_current_user_credentials is not None: + self.use_current_user_credentials = use_current_user_credentials + if use_dashboard_timewindow is not None: + self.use_dashboard_timewindow = use_dashboard_timewindow + if user_id is not None: + self.user_id = user_id + + @property + def base_url(self): + """Gets the base_url of this ReportConfig. # noqa: E501 + + + :return: The base_url of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._base_url + + @base_url.setter + def base_url(self, base_url): + """Sets the base_url of this ReportConfig. + + + :param base_url: The base_url of this ReportConfig. # noqa: E501 + :type: str + """ + + self._base_url = base_url + + @property + def dashboard_id(self): + """Gets the dashboard_id of this ReportConfig. # noqa: E501 + + + :return: The dashboard_id of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this ReportConfig. + + + :param dashboard_id: The dashboard_id of this ReportConfig. # noqa: E501 + :type: str + """ + + self._dashboard_id = dashboard_id + + @property + def name_pattern(self): + """Gets the name_pattern of this ReportConfig. # noqa: E501 + + + :return: The name_pattern of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._name_pattern + + @name_pattern.setter + def name_pattern(self, name_pattern): + """Sets the name_pattern of this ReportConfig. + + + :param name_pattern: The name_pattern of this ReportConfig. # noqa: E501 + :type: str + """ + + self._name_pattern = name_pattern + + @property + def state(self): + """Gets the state of this ReportConfig. # noqa: E501 + + + :return: The state of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ReportConfig. + + + :param state: The state of this ReportConfig. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def timewindow(self): + """Gets the timewindow of this ReportConfig. # noqa: E501 + + + :return: The timewindow of this ReportConfig. # noqa: E501 + :rtype: JsonNode + """ + return self._timewindow + + @timewindow.setter + def timewindow(self, timewindow): + """Sets the timewindow of this ReportConfig. + + + :param timewindow: The timewindow of this ReportConfig. # noqa: E501 + :type: JsonNode + """ + + self._timewindow = timewindow + + @property + def timezone(self): + """Gets the timezone of this ReportConfig. # noqa: E501 + + + :return: The timezone of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this ReportConfig. + + + :param timezone: The timezone of this ReportConfig. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this ReportConfig. # noqa: E501 + + + :return: The type of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ReportConfig. + + + :param type: The type of this ReportConfig. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def use_current_user_credentials(self): + """Gets the use_current_user_credentials of this ReportConfig. # noqa: E501 + + + :return: The use_current_user_credentials of this ReportConfig. # noqa: E501 + :rtype: bool + """ + return self._use_current_user_credentials + + @use_current_user_credentials.setter + def use_current_user_credentials(self, use_current_user_credentials): + """Sets the use_current_user_credentials of this ReportConfig. + + + :param use_current_user_credentials: The use_current_user_credentials of this ReportConfig. # noqa: E501 + :type: bool + """ + + self._use_current_user_credentials = use_current_user_credentials + + @property + def use_dashboard_timewindow(self): + """Gets the use_dashboard_timewindow of this ReportConfig. # noqa: E501 + + + :return: The use_dashboard_timewindow of this ReportConfig. # noqa: E501 + :rtype: bool + """ + return self._use_dashboard_timewindow + + @use_dashboard_timewindow.setter + def use_dashboard_timewindow(self, use_dashboard_timewindow): + """Sets the use_dashboard_timewindow of this ReportConfig. + + + :param use_dashboard_timewindow: The use_dashboard_timewindow of this ReportConfig. # noqa: E501 + :type: bool + """ + + self._use_dashboard_timewindow = use_dashboard_timewindow + + @property + def user_id(self): + """Gets the user_id of this ReportConfig. # noqa: E501 + + + :return: The user_id of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this ReportConfig. + + + :param user_id: The user_id of this ReportConfig. # noqa: E501 + :type: str + """ + + self._user_id = user_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ReportConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReportConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/repository_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/repository_settings.py new file mode 100644 index 0000000..82375e7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/repository_settings.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_method': 'str', + 'default_branch': 'str', + 'password': 'str', + 'private_key': 'str', + 'private_key_file_name': 'str', + 'private_key_password': 'str', + 'read_only': 'bool', + 'repository_uri': 'str', + 'show_merge_commits': 'bool', + 'username': 'str' + } + + attribute_map = { + 'auth_method': 'authMethod', + 'default_branch': 'defaultBranch', + 'password': 'password', + 'private_key': 'privateKey', + 'private_key_file_name': 'privateKeyFileName', + 'private_key_password': 'privateKeyPassword', + 'read_only': 'readOnly', + 'repository_uri': 'repositoryUri', + 'show_merge_commits': 'showMergeCommits', + 'username': 'username' + } + + def __init__(self, auth_method=None, default_branch=None, password=None, private_key=None, private_key_file_name=None, private_key_password=None, read_only=None, repository_uri=None, show_merge_commits=None, username=None): # noqa: E501 + """RepositorySettings - a model defined in Swagger""" # noqa: E501 + self._auth_method = None + self._default_branch = None + self._password = None + self._private_key = None + self._private_key_file_name = None + self._private_key_password = None + self._read_only = None + self._repository_uri = None + self._show_merge_commits = None + self._username = None + self.discriminator = None + if auth_method is not None: + self.auth_method = auth_method + if default_branch is not None: + self.default_branch = default_branch + if password is not None: + self.password = password + if private_key is not None: + self.private_key = private_key + if private_key_file_name is not None: + self.private_key_file_name = private_key_file_name + if private_key_password is not None: + self.private_key_password = private_key_password + if read_only is not None: + self.read_only = read_only + if repository_uri is not None: + self.repository_uri = repository_uri + if show_merge_commits is not None: + self.show_merge_commits = show_merge_commits + if username is not None: + self.username = username + + @property + def auth_method(self): + """Gets the auth_method of this RepositorySettings. # noqa: E501 + + + :return: The auth_method of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._auth_method + + @auth_method.setter + def auth_method(self, auth_method): + """Sets the auth_method of this RepositorySettings. + + + :param auth_method: The auth_method of this RepositorySettings. # noqa: E501 + :type: str + """ + allowed_values = ["PRIVATE_KEY", "USERNAME_PASSWORD"] # noqa: E501 + if auth_method not in allowed_values: + raise ValueError( + "Invalid value for `auth_method` ({0}), must be one of {1}" # noqa: E501 + .format(auth_method, allowed_values) + ) + + self._auth_method = auth_method + + @property + def default_branch(self): + """Gets the default_branch of this RepositorySettings. # noqa: E501 + + + :return: The default_branch of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._default_branch + + @default_branch.setter + def default_branch(self, default_branch): + """Sets the default_branch of this RepositorySettings. + + + :param default_branch: The default_branch of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._default_branch = default_branch + + @property + def password(self): + """Gets the password of this RepositorySettings. # noqa: E501 + + + :return: The password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this RepositorySettings. + + + :param password: The password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def private_key(self): + """Gets the private_key of this RepositorySettings. # noqa: E501 + + + :return: The private_key of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key + + @private_key.setter + def private_key(self, private_key): + """Sets the private_key of this RepositorySettings. + + + :param private_key: The private_key of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key = private_key + + @property + def private_key_file_name(self): + """Gets the private_key_file_name of this RepositorySettings. # noqa: E501 + + + :return: The private_key_file_name of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_file_name + + @private_key_file_name.setter + def private_key_file_name(self, private_key_file_name): + """Sets the private_key_file_name of this RepositorySettings. + + + :param private_key_file_name: The private_key_file_name of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_file_name = private_key_file_name + + @property + def private_key_password(self): + """Gets the private_key_password of this RepositorySettings. # noqa: E501 + + + :return: The private_key_password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_password + + @private_key_password.setter + def private_key_password(self, private_key_password): + """Sets the private_key_password of this RepositorySettings. + + + :param private_key_password: The private_key_password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_password = private_key_password + + @property + def read_only(self): + """Gets the read_only of this RepositorySettings. # noqa: E501 + + + :return: The read_only of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettings. + + + :param read_only: The read_only of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def repository_uri(self): + """Gets the repository_uri of this RepositorySettings. # noqa: E501 + + + :return: The repository_uri of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._repository_uri + + @repository_uri.setter + def repository_uri(self, repository_uri): + """Sets the repository_uri of this RepositorySettings. + + + :param repository_uri: The repository_uri of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._repository_uri = repository_uri + + @property + def show_merge_commits(self): + """Gets the show_merge_commits of this RepositorySettings. # noqa: E501 + + + :return: The show_merge_commits of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._show_merge_commits + + @show_merge_commits.setter + def show_merge_commits(self, show_merge_commits): + """Sets the show_merge_commits of this RepositorySettings. + + + :param show_merge_commits: The show_merge_commits of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._show_merge_commits = show_merge_commits + + @property + def username(self): + """Gets the username of this RepositorySettings. # noqa: E501 + + + :return: The username of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this RepositorySettings. + + + :param username: The username of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/repository_settings_info.py b/billinglayer/python/tb_rest_client/models/models_pe/repository_settings_info.py new file mode 100644 index 0000000..f45d24d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/repository_settings_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettingsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configured': 'bool', + 'read_only': 'bool' + } + + attribute_map = { + 'configured': 'configured', + 'read_only': 'readOnly' + } + + def __init__(self, configured=None, read_only=None): # noqa: E501 + """RepositorySettingsInfo - a model defined in Swagger""" # noqa: E501 + self._configured = None + self._read_only = None + self.discriminator = None + if configured is not None: + self.configured = configured + if read_only is not None: + self.read_only = read_only + + @property + def configured(self): + """Gets the configured of this RepositorySettingsInfo. # noqa: E501 + + + :return: The configured of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._configured + + @configured.setter + def configured(self, configured): + """Sets the configured of this RepositorySettingsInfo. + + + :param configured: The configured of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._configured = configured + + @property + def read_only(self): + """Gets the read_only of this RepositorySettingsInfo. # noqa: E501 + + + :return: The read_only of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettingsInfo. + + + :param read_only: The read_only of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettingsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettingsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/reset_password_email_request.py b/billinglayer/python/tb_rest_client/models/models_pe/reset_password_email_request.py new file mode 100644 index 0000000..4ec3127 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/reset_password_email_request.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordEmailRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str' + } + + attribute_map = { + 'email': 'email' + } + + def __init__(self, email=None): # noqa: E501 + """ResetPasswordEmailRequest - a model defined in Swagger""" # noqa: E501 + self._email = None + self.discriminator = None + if email is not None: + self.email = email + + @property + def email(self): + """Gets the email of this ResetPasswordEmailRequest. # noqa: E501 + + The email of the user # noqa: E501 + + :return: The email of this ResetPasswordEmailRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this ResetPasswordEmailRequest. + + The email of the user # noqa: E501 + + :param email: The email of this ResetPasswordEmailRequest. # noqa: E501 + :type: str + """ + + self._email = email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordEmailRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordEmailRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/reset_password_request.py b/billinglayer/python/tb_rest_client/models/models_pe/reset_password_request.py new file mode 100644 index 0000000..e5cbe9e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/reset_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'reset_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'reset_token': 'resetToken', + 'password': 'password' + } + + def __init__(self, reset_token=None, password=None): # noqa: E501 + """ResetPasswordRequest - a model defined in Swagger""" # noqa: E501 + self._reset_token = None + self._password = None + self.discriminator = None + if reset_token is not None: + self.reset_token = reset_token + if password is not None: + self.password = password + + @property + def reset_token(self): + """Gets the reset_token of this ResetPasswordRequest. # noqa: E501 + + The reset token to verify # noqa: E501 + + :return: The reset_token of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ResetPasswordRequest. + + The reset token to verify # noqa: E501 + + :param reset_token: The reset_token of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + @property + def password(self): + """Gets the password of this ResetPasswordRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ResetPasswordRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/resource.py b/billinglayer/python/tb_rest_client/models/models_pe/resource.py new file mode 100644 index 0000000..df14158 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/resource.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Resource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'file': 'str', + 'filename': 'str', + 'input_stream': 'InputStream', + 'open': 'bool', + 'readable': 'bool', + 'uri': 'str', + 'url': 'str' + } + + attribute_map = { + 'description': 'description', + 'file': 'file', + 'filename': 'filename', + 'input_stream': 'inputStream', + 'open': 'open', + 'readable': 'readable', + 'uri': 'uri', + 'url': 'url' + } + + def __init__(self, description=None, file=None, filename=None, input_stream=None, open=None, readable=None, uri=None, url=None): # noqa: E501 + """Resource - a model defined in Swagger""" # noqa: E501 + self._description = None + self._file = None + self._filename = None + self._input_stream = None + self._open = None + self._readable = None + self._uri = None + self._url = None + self.discriminator = None + if description is not None: + self.description = description + if file is not None: + self.file = file + if filename is not None: + self.filename = filename + if input_stream is not None: + self.input_stream = input_stream + if open is not None: + self.open = open + if readable is not None: + self.readable = readable + if uri is not None: + self.uri = uri + if url is not None: + self.url = url + + @property + def description(self): + """Gets the description of this Resource. # noqa: E501 + + + :return: The description of this Resource. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Resource. + + + :param description: The description of this Resource. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def file(self): + """Gets the file of this Resource. # noqa: E501 + + + :return: The file of this Resource. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this Resource. + + + :param file: The file of this Resource. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def filename(self): + """Gets the filename of this Resource. # noqa: E501 + + + :return: The filename of this Resource. # noqa: E501 + :rtype: str + """ + return self._filename + + @filename.setter + def filename(self, filename): + """Sets the filename of this Resource. + + + :param filename: The filename of this Resource. # noqa: E501 + :type: str + """ + + self._filename = filename + + @property + def input_stream(self): + """Gets the input_stream of this Resource. # noqa: E501 + + + :return: The input_stream of this Resource. # noqa: E501 + :rtype: InputStream + """ + return self._input_stream + + @input_stream.setter + def input_stream(self, input_stream): + """Sets the input_stream of this Resource. + + + :param input_stream: The input_stream of this Resource. # noqa: E501 + :type: InputStream + """ + + self._input_stream = input_stream + + @property + def open(self): + """Gets the open of this Resource. # noqa: E501 + + + :return: The open of this Resource. # noqa: E501 + :rtype: bool + """ + return self._open + + @open.setter + def open(self, open): + """Sets the open of this Resource. + + + :param open: The open of this Resource. # noqa: E501 + :type: bool + """ + + self._open = open + + @property + def readable(self): + """Gets the readable of this Resource. # noqa: E501 + + + :return: The readable of this Resource. # noqa: E501 + :rtype: bool + """ + return self._readable + + @readable.setter + def readable(self, readable): + """Sets the readable of this Resource. + + + :param readable: The readable of this Resource. # noqa: E501 + :type: bool + """ + + self._readable = readable + + @property + def uri(self): + """Gets the uri of this Resource. # noqa: E501 + + + :return: The uri of this Resource. # noqa: E501 + :rtype: str + """ + return self._uri + + @uri.setter + def uri(self, uri): + """Sets the uri of this Resource. + + + :param uri: The uri of this Resource. # noqa: E501 + :type: str + """ + + self._uri = uri + + @property + def url(self): + """Gets the url of this Resource. # noqa: E501 + + + :return: The url of this Resource. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this Resource. + + + :param url: The url of this Resource. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Resource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Resource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/response_entity.py b/billinglayer/python/tb_rest_client/models/models_pe/response_entity.py new file mode 100644 index 0000000..64d542e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/response_entity.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResponseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'object', + 'status_code': 'str', + 'status_code_value': 'int' + } + + attribute_map = { + 'body': 'body', + 'status_code': 'statusCode', + 'status_code_value': 'statusCodeValue' + } + + def __init__(self, body=None, status_code=None, status_code_value=None): # noqa: E501 + """ResponseEntity - a model defined in Swagger""" # noqa: E501 + self._body = None + self._status_code = None + self._status_code_value = None + self.discriminator = None + if body is not None: + self.body = body + if status_code is not None: + self.status_code = status_code + if status_code_value is not None: + self.status_code_value = status_code_value + + @property + def body(self): + """Gets the body of this ResponseEntity. # noqa: E501 + + + :return: The body of this ResponseEntity. # noqa: E501 + :rtype: object + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this ResponseEntity. + + + :param body: The body of this ResponseEntity. # noqa: E501 + :type: object + """ + + self._body = body + + @property + def status_code(self): + """Gets the status_code of this ResponseEntity. # noqa: E501 + + + :return: The status_code of this ResponseEntity. # noqa: E501 + :rtype: str + """ + return self._status_code + + @status_code.setter + def status_code(self, status_code): + """Sets the status_code of this ResponseEntity. + + + :param status_code: The status_code of this ResponseEntity. # noqa: E501 + :type: str + """ + allowed_values = ["ACCEPTED", "ALREADY_REPORTED", "BAD_GATEWAY", "BAD_REQUEST", "BANDWIDTH_LIMIT_EXCEEDED", "CHECKPOINT", "CONFLICT", "CONTINUE", "CREATED", "DESTINATION_LOCKED", "EXPECTATION_FAILED", "FAILED_DEPENDENCY", "FORBIDDEN", "FOUND", "GATEWAY_TIMEOUT", "GONE", "HTTP_VERSION_NOT_SUPPORTED", "IM_USED", "INSUFFICIENT_SPACE_ON_RESOURCE", "INSUFFICIENT_STORAGE", "INTERNAL_SERVER_ERROR", "I_AM_A_TEAPOT", "LENGTH_REQUIRED", "LOCKED", "LOOP_DETECTED", "METHOD_FAILURE", "METHOD_NOT_ALLOWED", "MOVED_PERMANENTLY", "MOVED_TEMPORARILY", "MULTIPLE_CHOICES", "MULTI_STATUS", "NETWORK_AUTHENTICATION_REQUIRED", "NON_AUTHORITATIVE_INFORMATION", "NOT_ACCEPTABLE", "NOT_EXTENDED", "NOT_FOUND", "NOT_IMPLEMENTED", "NOT_MODIFIED", "NO_CONTENT", "OK", "PARTIAL_CONTENT", "PAYLOAD_TOO_LARGE", "PAYMENT_REQUIRED", "PERMANENT_REDIRECT", "PRECONDITION_FAILED", "PRECONDITION_REQUIRED", "PROCESSING", "PROXY_AUTHENTICATION_REQUIRED", "REQUESTED_RANGE_NOT_SATISFIABLE", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_HEADER_FIELDS_TOO_LARGE", "REQUEST_TIMEOUT", "REQUEST_URI_TOO_LONG", "RESET_CONTENT", "SEE_OTHER", "SERVICE_UNAVAILABLE", "SWITCHING_PROTOCOLS", "TEMPORARY_REDIRECT", "TOO_EARLY", "TOO_MANY_REQUESTS", "UNAUTHORIZED", "UNAVAILABLE_FOR_LEGAL_REASONS", "UNPROCESSABLE_ENTITY", "UNSUPPORTED_MEDIA_TYPE", "UPGRADE_REQUIRED", "URI_TOO_LONG", "USE_PROXY", "VARIANT_ALSO_NEGOTIATES"] # noqa: E501 + if status_code not in allowed_values: + raise ValueError( + "Invalid value for `status_code` ({0}), must be one of {1}" # noqa: E501 + .format(status_code, allowed_values) + ) + + self._status_code = status_code + + @property + def status_code_value(self): + """Gets the status_code_value of this ResponseEntity. # noqa: E501 + + + :return: The status_code_value of this ResponseEntity. # noqa: E501 + :rtype: int + """ + return self._status_code_value + + @status_code_value.setter + def status_code_value(self, status_code_value): + """Sets the status_code_value of this ResponseEntity. + + + :param status_code_value: The status_code_value of this ResponseEntity. # noqa: E501 + :type: int + """ + + self._status_code_value = status_code_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResponseEntity, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResponseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/role.py b/billinglayer/python/tb_rest_client/models/models_pe/role.py new file mode 100644 index 0000000..48ab3a2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/role.py @@ -0,0 +1,357 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Role(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'RoleId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'permissions': 'JsonNode', + 'additional_info': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'permissions': 'permissions', + 'additional_info': 'additionalInfo', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, external_id=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, permissions=None, additional_info=None): # noqa: E501 + """Role - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._permissions = None + self._additional_info = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + if permissions is not None: + self.permissions = permissions + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Role. # noqa: E501 + + + :return: The id of this Role. # noqa: E501 + :rtype: RoleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Role. + + + :param id: The id of this Role. # noqa: E501 + :type: RoleId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Role. # noqa: E501 + + Timestamp of the role creation, in milliseconds # noqa: E501 + + :return: The created_time of this Role. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Role. + + Timestamp of the role creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Role. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Role. # noqa: E501 + + + :return: The tenant_id of this Role. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Role. + + + :param tenant_id: The tenant_id of this Role. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Role. # noqa: E501 + + + :return: The customer_id of this Role. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Role. + + + :param customer_id: The customer_id of this Role. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Role. # noqa: E501 + + + :return: The owner_id of this Role. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Role. + + + :param owner_id: The owner_id of this Role. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this Role. # noqa: E501 + + Role Name # noqa: E501 + + :return: The name of this Role. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Role. + + Role Name # noqa: E501 + + :param name: The name of this Role. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Role. # noqa: E501 + + Type of the role: generic or group # noqa: E501 + + :return: The type of this Role. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Role. + + Type of the role: generic or group # noqa: E501 + + :param type: The type of this Role. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["GENERIC", "GROUP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def permissions(self): + """Gets the permissions of this Role. # noqa: E501 + + + :return: The permissions of this Role. # noqa: E501 + :rtype: JsonNode + """ + return self._permissions + + @permissions.setter + def permissions(self, permissions): + """Sets the permissions of this Role. + + + :param permissions: The permissions of this Role. # noqa: E501 + :type: JsonNode + """ + + self._permissions = permissions + + @property + def additional_info(self): + """Gets the additional_info of this Role. # noqa: E501 + + + :return: The additional_info of this Role. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Role. + + + :param additional_info: The additional_info of this Role. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Role, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Role): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/role_id.py b/billinglayer/python/tb_rest_client/models/models_pe/role_id.py new file mode 100644 index 0000000..b238d53 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/role_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RoleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RoleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RoleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RoleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RoleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RoleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RoleId. # noqa: E501 + + + :return: The entity_type of this RoleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RoleId. + + + :param entity_type: The entity_type of this RoleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RoleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RoleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rpc.py b/billinglayer/python/tb_rest_client/models/models_pe/rpc.py new file mode 100644 index 0000000..8ad8c7e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rpc.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Rpc(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'RpcId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_id': 'DeviceId', + 'expiration_time': 'int', + 'request': 'JsonNode', + 'response': 'JsonNode', + 'status': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_id': 'deviceId', + 'expiration_time': 'expirationTime', + 'request': 'request', + 'response': 'response', + 'status': 'status', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_id=None, expiration_time=None, request=None, response=None, status=None, additional_info=None): # noqa: E501 + """Rpc - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_id = None + self._expiration_time = None + self._request = None + self._response = None + self._status = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_id is not None: + self.device_id = device_id + if expiration_time is not None: + self.expiration_time = expiration_time + if request is not None: + self.request = request + if response is not None: + self.response = response + if status is not None: + self.status = status + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Rpc. # noqa: E501 + + + :return: The id of this Rpc. # noqa: E501 + :rtype: RpcId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Rpc. + + + :param id: The id of this Rpc. # noqa: E501 + :type: RpcId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Rpc. # noqa: E501 + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :return: The created_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Rpc. + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Rpc. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Rpc. # noqa: E501 + + + :return: The tenant_id of this Rpc. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Rpc. + + + :param tenant_id: The tenant_id of this Rpc. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_id(self): + """Gets the device_id of this Rpc. # noqa: E501 + + + :return: The device_id of this Rpc. # noqa: E501 + :rtype: DeviceId + """ + return self._device_id + + @device_id.setter + def device_id(self, device_id): + """Sets the device_id of this Rpc. + + + :param device_id: The device_id of this Rpc. # noqa: E501 + :type: DeviceId + """ + + self._device_id = device_id + + @property + def expiration_time(self): + """Gets the expiration_time of this Rpc. # noqa: E501 + + Expiration time of the request. # noqa: E501 + + :return: The expiration_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._expiration_time + + @expiration_time.setter + def expiration_time(self, expiration_time): + """Sets the expiration_time of this Rpc. + + Expiration time of the request. # noqa: E501 + + :param expiration_time: The expiration_time of this Rpc. # noqa: E501 + :type: int + """ + + self._expiration_time = expiration_time + + @property + def request(self): + """Gets the request of this Rpc. # noqa: E501 + + + :return: The request of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._request + + @request.setter + def request(self, request): + """Sets the request of this Rpc. + + + :param request: The request of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._request = request + + @property + def response(self): + """Gets the response of this Rpc. # noqa: E501 + + + :return: The response of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._response + + @response.setter + def response(self, response): + """Sets the response of this Rpc. + + + :param response: The response of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._response = response + + @property + def status(self): + """Gets the status of this Rpc. # noqa: E501 + + The current status of the RPC call. # noqa: E501 + + :return: The status of this Rpc. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Rpc. + + The current status of the RPC call. # noqa: E501 + + :param status: The status of this Rpc. # noqa: E501 + :type: str + """ + allowed_values = ["DELETED", "DELIVERED", "EXPIRED", "FAILED", "QUEUED", "SENT", "SUCCESSFUL", "TIMEOUT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def additional_info(self): + """Gets the additional_info of this Rpc. # noqa: E501 + + + :return: The additional_info of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Rpc. + + + :param additional_info: The additional_info of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Rpc, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Rpc): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rpc_id.py b/billinglayer/python/tb_rest_client/models/models_pe/rpc_id.py new file mode 100644 index 0000000..00197f2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rpc_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RpcId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RpcId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RpcId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RpcId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RpcId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RpcId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RpcId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RpcId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RpcId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RpcId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RPC"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RpcId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RpcId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rpk_lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_pe/rpk_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..0be8710 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rpk_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RPKLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """RPKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this RPKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this RPKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this RPKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this RPKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this RPKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this RPKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RPKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RPKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rpklw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_pe/rpklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..9aa502e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rpklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RPKLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """RPKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this RPKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this RPKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this RPKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this RPKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this RPKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this RPKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RPKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RPKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain.py new file mode 100644 index 0000000..7f57525 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain.py @@ -0,0 +1,376 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'id': 'RuleChainId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'type': 'str', + 'first_rule_node_id': 'RuleNodeId', + 'root': 'bool', + 'debug_mode': 'bool', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'type': 'type', + 'first_rule_node_id': 'firstRuleNodeId', + 'root': 'root', + 'debug_mode': 'debugMode', + 'configuration': 'configuration' + } + + def __init__(self, additional_info=None, id=None, created_time=None, tenant_id=None, name=None, type=None, first_rule_node_id=None, root=None, debug_mode=None, configuration=None): # noqa: E501 + """RuleChain - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._type = None + self._first_rule_node_id = None + self._root = None + self._debug_mode = None + self._configuration = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + self.tenant_id = tenant_id + self.name = name + if type is not None: + self.type = type + if first_rule_node_id is not None: + self.first_rule_node_id = first_rule_node_id + if root is not None: + self.root = root + if debug_mode is not None: + self.debug_mode = debug_mode + if configuration is not None: + self.configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this RuleChain. # noqa: E501 + + + :return: The additional_info of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChain. + + + :param additional_info: The additional_info of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def id(self): + """Gets the id of this RuleChain. # noqa: E501 + + + :return: The id of this RuleChain. # noqa: E501 + :rtype: RuleChainId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChain. + + + :param id: The id of this RuleChain. # noqa: E501 + :type: RuleChainId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleChain. # noqa: E501 + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleChain. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleChain. + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleChain. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this RuleChain. # noqa: E501 + + + :return: The tenant_id of this RuleChain. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this RuleChain. + + + :param tenant_id: The tenant_id of this RuleChain. # noqa: E501 + :type: TenantId + """ + if tenant_id is None: + raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this RuleChain. # noqa: E501 + + Rule Chain name # noqa: E501 + + :return: The name of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleChain. + + Rule Chain name # noqa: E501 + + :param name: The name of this RuleChain. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this RuleChain. # noqa: E501 + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :return: The type of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChain. + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :param type: The type of this RuleChain. # noqa: E501 + :type: str + """ + allowed_values = ["CORE", "EDGE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def first_rule_node_id(self): + """Gets the first_rule_node_id of this RuleChain. # noqa: E501 + + + :return: The first_rule_node_id of this RuleChain. # noqa: E501 + :rtype: RuleNodeId + """ + return self._first_rule_node_id + + @first_rule_node_id.setter + def first_rule_node_id(self, first_rule_node_id): + """Sets the first_rule_node_id of this RuleChain. + + + :param first_rule_node_id: The first_rule_node_id of this RuleChain. # noqa: E501 + :type: RuleNodeId + """ + + self._first_rule_node_id = first_rule_node_id + + @property + def root(self): + """Gets the root of this RuleChain. # noqa: E501 + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :return: The root of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._root + + @root.setter + def root(self, root): + """Sets the root of this RuleChain. + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :param root: The root of this RuleChain. # noqa: E501 + :type: bool + """ + + self._root = root + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleChain. # noqa: E501 + + Reserved for future usage. # noqa: E501 + + :return: The debug_mode of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleChain. + + Reserved for future usage. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleChain. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def configuration(self): + """Gets the configuration of this RuleChain. # noqa: E501 + + + :return: The configuration of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleChain. + + + :param configuration: The configuration of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_connection_info.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_connection_info.py new file mode 100644 index 0000000..3973a0f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_connection_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'target_rule_chain_id': 'RuleChainId', + 'additional_info': 'JsonNode', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'target_rule_chain_id': 'targetRuleChainId', + 'additional_info': 'additionalInfo', + 'type': 'type' + } + + def __init__(self, from_index=None, target_rule_chain_id=None, additional_info=None, type=None): # noqa: E501 + """RuleChainConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._target_rule_chain_id = None + self._additional_info = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.target_rule_chain_id = target_rule_chain_id + self.additional_info = additional_info + self.type = type + + @property + def from_index(self): + """Gets the from_index of this RuleChainConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this RuleChainConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def target_rule_chain_id(self): + """Gets the target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._target_rule_chain_id + + @target_rule_chain_id.setter + def target_rule_chain_id(self, target_rule_chain_id): + """Sets the target_rule_chain_id of this RuleChainConnectionInfo. + + + :param target_rule_chain_id: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :type: RuleChainId + """ + if target_rule_chain_id is None: + raise ValueError("Invalid value for `target_rule_chain_id`, must not be `None`") # noqa: E501 + + self._target_rule_chain_id = target_rule_chain_id + + @property + def additional_info(self): + """Gets the additional_info of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChainConnectionInfo. + + + :param additional_info: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def type(self): + """Gets the type of this RuleChainConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this RuleChainConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChainConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this RuleChainConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_data.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_data.py new file mode 100644 index 0000000..0452057 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_data.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chains': 'list[RuleChain]', + 'metadata': 'list[RuleChainMetaData]' + } + + attribute_map = { + 'rule_chains': 'ruleChains', + 'metadata': 'metadata' + } + + def __init__(self, rule_chains=None, metadata=None): # noqa: E501 + """RuleChainData - a model defined in Swagger""" # noqa: E501 + self._rule_chains = None + self._metadata = None + self.discriminator = None + self.rule_chains = rule_chains + self.metadata = metadata + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleChainData. # noqa: E501 + + List of the Rule Chain objects. # noqa: E501 + + :return: The rule_chains of this RuleChainData. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleChainData. + + List of the Rule Chain objects. # noqa: E501 + + :param rule_chains: The rule_chains of this RuleChainData. # noqa: E501 + :type: list[RuleChain] + """ + if rule_chains is None: + raise ValueError("Invalid value for `rule_chains`, must not be `None`") # noqa: E501 + + self._rule_chains = rule_chains + + @property + def metadata(self): + """Gets the metadata of this RuleChainData. # noqa: E501 + + List of the Rule Chain metadata objects. # noqa: E501 + + :return: The metadata of this RuleChainData. # noqa: E501 + :rtype: list[RuleChainMetaData] + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this RuleChainData. + + List of the Rule Chain metadata objects. # noqa: E501 + + :param metadata: The metadata of this RuleChainData. # noqa: E501 + :type: list[RuleChainMetaData] + """ + if metadata is None: + raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 + + self._metadata = metadata + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_debug_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_debug_event_filter.py new file mode 100644 index 0000000..227bc4f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_debug_event_filter.py @@ -0,0 +1,275 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class RuleChainDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'message': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'message': 'message', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, message=None, error_str=None, *args, **kwargs): # noqa: E501 + """RuleChainDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._message = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if message is not None: + self.message = message + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainDebugEventFilter. + + + :param error: The error of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleChainDebugEventFilter. + + + :param not_empty: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleChainDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleChainDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def message(self): + """Gets the message of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the message # noqa: E501 + + :return: The message of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this RuleChainDebugEventFilter. + + String value representing the message # noqa: E501 + + :param message: The message of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_str(self): + """Gets the error_str of this RuleChainDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleChainDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_export_data.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_export_data.py new file mode 100644 index 0000000..11da9be --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class RuleChainExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'RuleChain', + 'entity_type': 'str', + 'meta_data': 'RuleChainMetaData', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'meta_data': 'metaData', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, meta_data=None, relations=None, *args, **kwargs): # noqa: E501 + """RuleChainExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._meta_data = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if meta_data is not None: + self.meta_data = meta_data + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this RuleChainExportData. # noqa: E501 + + + :return: The attributes of this RuleChainExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this RuleChainExportData. + + + :param attributes: The attributes of this RuleChainExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this RuleChainExportData. # noqa: E501 + + + :return: The entity of this RuleChainExportData. # noqa: E501 + :rtype: RuleChain + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this RuleChainExportData. + + + :param entity: The entity of this RuleChainExportData. # noqa: E501 + :type: RuleChain + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainExportData. # noqa: E501 + + + :return: The entity_type of this RuleChainExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainExportData. + + + :param entity_type: The entity_type of this RuleChainExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def meta_data(self): + """Gets the meta_data of this RuleChainExportData. # noqa: E501 + + + :return: The meta_data of this RuleChainExportData. # noqa: E501 + :rtype: RuleChainMetaData + """ + return self._meta_data + + @meta_data.setter + def meta_data(self, meta_data): + """Sets the meta_data of this RuleChainExportData. + + + :param meta_data: The meta_data of this RuleChainExportData. # noqa: E501 + :type: RuleChainMetaData + """ + + self._meta_data = meta_data + + @property + def relations(self): + """Gets the relations of this RuleChainExportData. # noqa: E501 + + + :return: The relations of this RuleChainExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this RuleChainExportData. + + + :param relations: The relations of this RuleChainExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_id.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_id.py new file mode 100644 index 0000000..d42b988 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleChainId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleChainId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChainId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleChainId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleChainId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_CHAIN"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_import_result.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_import_result.py new file mode 100644 index 0000000..b69387d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_import_result.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainImportResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'rule_chain_id': 'RuleChainId', + 'rule_chain_name': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'error': 'error', + 'rule_chain_id': 'ruleChainId', + 'rule_chain_name': 'ruleChainName', + 'updated': 'updated' + } + + def __init__(self, error=None, rule_chain_id=None, rule_chain_name=None, updated=None): # noqa: E501 + """RuleChainImportResult - a model defined in Swagger""" # noqa: E501 + self._error = None + self._rule_chain_id = None + self._rule_chain_name = None + self._updated = None + self.discriminator = None + if error is not None: + self.error = error + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if rule_chain_name is not None: + self.rule_chain_name = rule_chain_name + if updated is not None: + self.updated = updated + + @property + def error(self): + """Gets the error of this RuleChainImportResult. # noqa: E501 + + + :return: The error of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainImportResult. + + + :param error: The error of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainImportResult. + + + :param rule_chain_id: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainImportResult. + + + :param rule_chain_name: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._rule_chain_name = rule_chain_name + + @property + def updated(self): + """Gets the updated of this RuleChainImportResult. # noqa: E501 + + + :return: The updated of this RuleChainImportResult. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this RuleChainImportResult. + + + :param updated: The updated of this RuleChainImportResult. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainImportResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainImportResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_meta_data.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_meta_data.py new file mode 100644 index 0000000..43b42d7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_meta_data.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainMetaData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'first_node_index': 'int', + 'nodes': 'list[RuleNode]', + 'connections': 'list[NodeConnectionInfo]', + 'rule_chain_connections': 'list[RuleChainConnectionInfo]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'first_node_index': 'firstNodeIndex', + 'nodes': 'nodes', + 'connections': 'connections', + 'rule_chain_connections': 'ruleChainConnections' + } + + def __init__(self, rule_chain_id=None, first_node_index=None, nodes=None, connections=None, rule_chain_connections=None): # noqa: E501 + """RuleChainMetaData - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._first_node_index = None + self._nodes = None + self._connections = None + self._rule_chain_connections = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.first_node_index = first_node_index + self.nodes = nodes + self.connections = connections + self.rule_chain_connections = rule_chain_connections + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainMetaData. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainMetaData. + + + :param rule_chain_id: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def first_node_index(self): + """Gets the first_node_index of this RuleChainMetaData. # noqa: E501 + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :return: The first_node_index of this RuleChainMetaData. # noqa: E501 + :rtype: int + """ + return self._first_node_index + + @first_node_index.setter + def first_node_index(self, first_node_index): + """Sets the first_node_index of this RuleChainMetaData. + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :param first_node_index: The first_node_index of this RuleChainMetaData. # noqa: E501 + :type: int + """ + if first_node_index is None: + raise ValueError("Invalid value for `first_node_index`, must not be `None`") # noqa: E501 + + self._first_node_index = first_node_index + + @property + def nodes(self): + """Gets the nodes of this RuleChainMetaData. # noqa: E501 + + List of rule node JSON objects # noqa: E501 + + :return: The nodes of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleNode] + """ + return self._nodes + + @nodes.setter + def nodes(self, nodes): + """Sets the nodes of this RuleChainMetaData. + + List of rule node JSON objects # noqa: E501 + + :param nodes: The nodes of this RuleChainMetaData. # noqa: E501 + :type: list[RuleNode] + """ + if nodes is None: + raise ValueError("Invalid value for `nodes`, must not be `None`") # noqa: E501 + + self._nodes = nodes + + @property + def connections(self): + """Gets the connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :return: The connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[NodeConnectionInfo] + """ + return self._connections + + @connections.setter + def connections(self, connections): + """Sets the connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :param connections: The connections of this RuleChainMetaData. # noqa: E501 + :type: list[NodeConnectionInfo] + """ + if connections is None: + raise ValueError("Invalid value for `connections`, must not be `None`") # noqa: E501 + + self._connections = connections + + @property + def rule_chain_connections(self): + """Gets the rule_chain_connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :return: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleChainConnectionInfo] + """ + return self._rule_chain_connections + + @rule_chain_connections.setter + def rule_chain_connections(self, rule_chain_connections): + """Sets the rule_chain_connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :param rule_chain_connections: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :type: list[RuleChainConnectionInfo] + """ + if rule_chain_connections is None: + raise ValueError("Invalid value for `rule_chain_connections`, must not be `None`") # noqa: E501 + + self._rule_chain_connections = rule_chain_connections + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainMetaData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainMetaData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_output_labels_usage.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_output_labels_usage.py new file mode 100644 index 0000000..3b23ad2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_chain_output_labels_usage.py @@ -0,0 +1,239 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainOutputLabelsUsage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'rule_node_id': 'RuleNodeId', + 'rule_chain_name': 'str', + 'rule_node_name': 'str', + 'labels': 'list[str]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'rule_node_id': 'ruleNodeId', + 'rule_chain_name': 'ruleChainName', + 'rule_node_name': 'ruleNodeName', + 'labels': 'labels' + } + + def __init__(self, rule_chain_id=None, rule_node_id=None, rule_chain_name=None, rule_node_name=None, labels=None): # noqa: E501 + """RuleChainOutputLabelsUsage - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._rule_node_id = None + self._rule_chain_name = None + self._rule_node_name = None + self._labels = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.rule_node_id = rule_node_id + self.rule_chain_name = rule_chain_name + self.rule_node_name = rule_node_name + self.labels = labels + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainOutputLabelsUsage. + + + :param rule_chain_id: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def rule_node_id(self): + """Gets the rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleNodeId + """ + return self._rule_node_id + + @rule_node_id.setter + def rule_node_id(self, rule_node_id): + """Sets the rule_node_id of this RuleChainOutputLabelsUsage. + + + :param rule_node_id: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleNodeId + """ + if rule_node_id is None: + raise ValueError("Invalid value for `rule_node_id`, must not be `None`") # noqa: E501 + + self._rule_node_id = rule_node_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Chain Name # noqa: E501 + + :return: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainOutputLabelsUsage. + + Rule Chain Name # noqa: E501 + + :param rule_chain_name: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_chain_name is None: + raise ValueError("Invalid value for `rule_chain_name`, must not be `None`") # noqa: E501 + + self._rule_chain_name = rule_chain_name + + @property + def rule_node_name(self): + """Gets the rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Node Name # noqa: E501 + + :return: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_node_name + + @rule_node_name.setter + def rule_node_name(self, rule_node_name): + """Sets the rule_node_name of this RuleChainOutputLabelsUsage. + + Rule Node Name # noqa: E501 + + :param rule_node_name: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_node_name is None: + raise ValueError("Invalid value for `rule_node_name`, must not be `None`") # noqa: E501 + + self._rule_node_name = rule_node_name + + @property + def labels(self): + """Gets the labels of this RuleChainOutputLabelsUsage. # noqa: E501 + + Output labels # noqa: E501 + + :return: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: list[str] + """ + return self._labels + + @labels.setter + def labels(self, labels): + """Sets the labels of this RuleChainOutputLabelsUsage. + + Output labels # noqa: E501 + + :param labels: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: list[str] + """ + if labels is None: + raise ValueError("Invalid value for `labels`, must not be `None`") # noqa: E501 + + self._labels = labels + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainOutputLabelsUsage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainOutputLabelsUsage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py new file mode 100644 index 0000000..3d341a5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'only_rule_chain_lifecycle_failures': 'bool', + 'only_rule_node_lifecycle_failures': 'bool', + 'rule_chain_events': 'list[str]', + 'rule_chains': 'list[str]', + 'rule_node_events': 'list[str]', + 'track_rule_node_events': 'bool', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'only_rule_chain_lifecycle_failures': 'onlyRuleChainLifecycleFailures', + 'only_rule_node_lifecycle_failures': 'onlyRuleNodeLifecycleFailures', + 'rule_chain_events': 'ruleChainEvents', + 'rule_chains': 'ruleChains', + 'rule_node_events': 'ruleNodeEvents', + 'track_rule_node_events': 'trackRuleNodeEvents', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, only_rule_chain_lifecycle_failures=None, only_rule_node_lifecycle_failures=None, rule_chain_events=None, rule_chains=None, rule_node_events=None, track_rule_node_events=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._only_rule_chain_lifecycle_failures = None + self._only_rule_node_lifecycle_failures = None + self._rule_chain_events = None + self._rule_chains = None + self._rule_node_events = None + self._track_rule_node_events = None + self._trigger_type = None + self.discriminator = None + if only_rule_chain_lifecycle_failures is not None: + self.only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + if only_rule_node_lifecycle_failures is not None: + self.only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + if rule_chain_events is not None: + self.rule_chain_events = rule_chain_events + if rule_chains is not None: + self.rule_chains = rule_chains + if rule_node_events is not None: + self.rule_node_events = rule_node_events + if track_rule_node_events is not None: + self.track_rule_node_events = track_rule_node_events + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def only_rule_chain_lifecycle_failures(self): + """Gets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_chain_lifecycle_failures + + @only_rule_chain_lifecycle_failures.setter + def only_rule_chain_lifecycle_failures(self, only_rule_chain_lifecycle_failures): + """Sets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_chain_lifecycle_failures: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + + @property + def only_rule_node_lifecycle_failures(self): + """Gets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_node_lifecycle_failures + + @only_rule_node_lifecycle_failures.setter + def only_rule_node_lifecycle_failures(self, only_rule_node_lifecycle_failures): + """Sets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_node_lifecycle_failures: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + + @property + def rule_chain_events(self): + """Gets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chain_events + + @rule_chain_events.setter + def rule_chain_events(self, rule_chain_events): + """Sets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chain_events: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "FAILED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_chain_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_chain_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_chain_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_chain_events = rule_chain_events + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chains: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._rule_chains = rule_chains + + @property + def rule_node_events(self): + """Gets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_node_events + + @rule_node_events.setter + def rule_node_events(self, rule_node_events): + """Sets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_node_events: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "FAILED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_node_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_node_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_node_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_node_events = rule_node_events + + @property + def track_rule_node_events(self): + """Gets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._track_rule_node_events + + @track_rule_node_events.setter + def track_rule_node_events(self, track_rule_node_events): + """Sets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param track_rule_node_events: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._track_rule_node_events = track_rule_node_events + + @property + def trigger_type(self): + """Gets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_node.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_node.py new file mode 100644 index 0000000..3d66394 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_node.py @@ -0,0 +1,368 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'RuleNodeId', + 'id': 'RuleNodeId', + 'created_time': 'int', + 'rule_chain_id': 'RuleChainId', + 'type': 'str', + 'name': 'str', + 'debug_mode': 'bool', + 'singleton_mode': 'bool', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'external_id': 'externalId', + 'id': 'id', + 'created_time': 'createdTime', + 'rule_chain_id': 'ruleChainId', + 'type': 'type', + 'name': 'name', + 'debug_mode': 'debugMode', + 'singleton_mode': 'singletonMode', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration' + } + + def __init__(self, external_id=None, id=None, created_time=None, rule_chain_id=None, type=None, name=None, debug_mode=None, singleton_mode=None, additional_info=None, configuration=None): # noqa: E501 + """RuleNode - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self._id = None + self._created_time = None + self._rule_chain_id = None + self._type = None + self._name = None + self._debug_mode = None + self._singleton_mode = None + self._additional_info = None + self._configuration = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if type is not None: + self.type = type + if name is not None: + self.name = name + if debug_mode is not None: + self.debug_mode = debug_mode + if singleton_mode is not None: + self.singleton_mode = singleton_mode + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + + @property + def external_id(self): + """Gets the external_id of this RuleNode. # noqa: E501 + + + :return: The external_id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this RuleNode. + + + :param external_id: The external_id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._external_id = external_id + + @property + def id(self): + """Gets the id of this RuleNode. # noqa: E501 + + + :return: The id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNode. + + + :param id: The id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleNode. # noqa: E501 + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleNode. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleNode. + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleNode. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleNode. # noqa: E501 + + + :return: The rule_chain_id of this RuleNode. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleNode. + + + :param rule_chain_id: The rule_chain_id of this RuleNode. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def type(self): + """Gets the type of this RuleNode. # noqa: E501 + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :return: The type of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleNode. + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :param type: The type of this RuleNode. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def name(self): + """Gets the name of this RuleNode. # noqa: E501 + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :return: The name of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleNode. + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :param name: The name of this RuleNode. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleNode. # noqa: E501 + + Enable/disable debug. # noqa: E501 + + :return: The debug_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleNode. + + Enable/disable debug. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def singleton_mode(self): + """Gets the singleton_mode of this RuleNode. # noqa: E501 + + Enable/disable singleton mode. # noqa: E501 + + :return: The singleton_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._singleton_mode + + @singleton_mode.setter + def singleton_mode(self, singleton_mode): + """Sets the singleton_mode of this RuleNode. + + Enable/disable singleton mode. # noqa: E501 + + :param singleton_mode: The singleton_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._singleton_mode = singleton_mode + + @property + def additional_info(self): + """Gets the additional_info of this RuleNode. # noqa: E501 + + + :return: The additional_info of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleNode. + + + :param additional_info: The additional_info of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this RuleNode. # noqa: E501 + + + :return: The configuration of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleNode. + + + :param configuration: The configuration of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_node_debug_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_node_debug_event_filter.py new file mode 100644 index 0000000..e7d7658 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_node_debug_event_filter.py @@ -0,0 +1,483 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class RuleNodeDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'msg_direction_type': 'str', + 'entity_id': 'str', + 'error_str': 'str', + 'entity_type': 'str', + 'msg_id': 'str', + 'msg_type': 'str', + 'relation_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'msg_direction_type': 'msgDirectionType', + 'entity_id': 'entityId', + 'error_str': 'errorStr', + 'entity_type': 'entityType', + 'msg_id': 'msgId', + 'msg_type': 'msgType', + 'relation_type': 'relationType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, msg_direction_type=None, entity_id=None, error_str=None, entity_type=None, msg_id=None, msg_type=None, relation_type=None, data_search=None, metadata_search=None, *args, **kwargs): # noqa: E501 + """RuleNodeDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._msg_direction_type = None + self._entity_id = None + self._error_str = None + self._entity_type = None + self._msg_id = None + self._msg_type = None + self._relation_type = None + self._data_search = None + self._metadata_search = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if entity_id is not None: + self.entity_id = entity_id + if error_str is not None: + self.error_str = error_str + if entity_type is not None: + self.entity_type = entity_type + if msg_id is not None: + self.msg_id = msg_id + if msg_type is not None: + self.msg_type = msg_type + if relation_type is not None: + self.relation_type = relation_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleNodeDebugEventFilter. + + + :param error: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleNodeDebugEventFilter. + + + :param not_empty: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleNodeDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleNodeDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this RuleNodeDebugEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def entity_id(self): + """Gets the entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this RuleNodeDebugEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def error_str(self): + """Gets the error_str of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeDebugEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def msg_id(self): + """Gets the msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message id in the rule engine # noqa: E501 + + :return: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_id + + @msg_id.setter + def msg_id(self, msg_id): + """Sets the msg_id of this RuleNodeDebugEventFilter. + + String value representing the message id in the rule engine # noqa: E501 + + :param msg_id: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_id = msg_id + + @property + def msg_type(self): + """Gets the msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this RuleNodeDebugEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + @property + def relation_type(self): + """Gets the relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RuleNodeDebugEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def data_search(self): + """Gets the data_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/rule_node_id.py b/billinglayer/python/tb_rest_client/models/models_pe/rule_node_id.py new file mode 100644 index 0000000..7d3b8ba --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/rule_node_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNodeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleNodeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleNodeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNodeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleNodeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_NODE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/save_device_with_credentials_request.py b/billinglayer/python/tb_rest_client/models/models_pe/save_device_with_credentials_request.py new file mode 100644 index 0000000..7ad0047 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/save_device_with_credentials_request.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveDeviceWithCredentialsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device': 'Device', + 'credentials': 'DeviceCredentials' + } + + attribute_map = { + 'device': 'device', + 'credentials': 'credentials' + } + + def __init__(self, device=None, credentials=None): # noqa: E501 + """SaveDeviceWithCredentialsRequest - a model defined in Swagger""" # noqa: E501 + self._device = None + self._credentials = None + self.discriminator = None + self.device = device + self.credentials = credentials + + @property + def device(self): + """Gets the device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: Device + """ + return self._device + + @device.setter + def device(self, device): + """Sets the device of this SaveDeviceWithCredentialsRequest. + + + :param device: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: Device + """ + if device is None: + raise ValueError("Invalid value for `device`, must not be `None`") # noqa: E501 + + self._device = device + + @property + def credentials(self): + """Gets the credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this SaveDeviceWithCredentialsRequest. + + + :param credentials: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: DeviceCredentials + """ + if credentials is None: + raise ValueError("Invalid value for `credentials`, must not be `None`") # noqa: E501 + + self._credentials = credentials + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveDeviceWithCredentialsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveDeviceWithCredentialsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/save_ota_package_info_request.py b/billinglayer/python/tb_rest_client/models/models_pe/save_ota_package_info_request.py new file mode 100644 index 0000000..63a3a6f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/save_ota_package_info_request.py @@ -0,0 +1,578 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveOtaPackageInfoRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'uses_url': 'bool', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'uses_url': 'usesUrl', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, uses_url=None, additional_info=None): # noqa: E501 + """SaveOtaPackageInfoRequest - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._uses_url = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if uses_url is not None: + self.uses_url = uses_url + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SaveOtaPackageInfoRequest. + + + :param id: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SaveOtaPackageInfoRequest. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SaveOtaPackageInfoRequest. + + + :param tenant_id: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this SaveOtaPackageInfoRequest. + + + :param device_profile_id: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SaveOtaPackageInfoRequest. + + OTA Package type. # noqa: E501 + + :param type: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SaveOtaPackageInfoRequest. + + OTA Package title. # noqa: E501 + + :param title: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this SaveOtaPackageInfoRequest. + + OTA Package version. # noqa: E501 + + :param version: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this SaveOtaPackageInfoRequest. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this SaveOtaPackageInfoRequest. + + OTA Package url. # noqa: E501 + + :param url: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this SaveOtaPackageInfoRequest. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this SaveOtaPackageInfoRequest. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this SaveOtaPackageInfoRequest. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this SaveOtaPackageInfoRequest. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this SaveOtaPackageInfoRequest. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this SaveOtaPackageInfoRequest. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def uses_url(self): + """Gets the uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :return: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._uses_url + + @uses_url.setter + def uses_url(self, uses_url): + """Sets the uses_url of this SaveOtaPackageInfoRequest. + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :param uses_url: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._uses_url = uses_url + + @property + def additional_info(self): + """Gets the additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SaveOtaPackageInfoRequest. + + + :param additional_info: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveOtaPackageInfoRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveOtaPackageInfoRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event.py b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event.py new file mode 100644 index 0000000..53655bc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event.py @@ -0,0 +1,390 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'SchedulerEventId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'originator_id': 'EntityId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'schedule': 'JsonNode', + 'configuration': 'JsonNode', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'originator_id': 'originatorId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'schedule': 'schedule', + 'configuration': 'configuration', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, originator_id=None, owner_id=None, name=None, type=None, schedule=None, configuration=None, additional_info=None): # noqa: E501 + """SchedulerEvent - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._originator_id = None + self._owner_id = None + self._name = None + self._type = None + self._schedule = None + self._configuration = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if originator_id is not None: + self.originator_id = originator_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if schedule is not None: + self.schedule = schedule + if configuration is not None: + self.configuration = configuration + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SchedulerEvent. # noqa: E501 + + + :return: The id of this SchedulerEvent. # noqa: E501 + :rtype: SchedulerEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEvent. + + + :param id: The id of this SchedulerEvent. # noqa: E501 + :type: SchedulerEventId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SchedulerEvent. # noqa: E501 + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :return: The created_time of this SchedulerEvent. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SchedulerEvent. + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SchedulerEvent. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SchedulerEvent. # noqa: E501 + + + :return: The tenant_id of this SchedulerEvent. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SchedulerEvent. + + + :param tenant_id: The tenant_id of this SchedulerEvent. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this SchedulerEvent. # noqa: E501 + + + :return: The customer_id of this SchedulerEvent. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this SchedulerEvent. + + + :param customer_id: The customer_id of this SchedulerEvent. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def originator_id(self): + """Gets the originator_id of this SchedulerEvent. # noqa: E501 + + + :return: The originator_id of this SchedulerEvent. # noqa: E501 + :rtype: EntityId + """ + return self._originator_id + + @originator_id.setter + def originator_id(self, originator_id): + """Sets the originator_id of this SchedulerEvent. + + + :param originator_id: The originator_id of this SchedulerEvent. # noqa: E501 + :type: EntityId + """ + + self._originator_id = originator_id + + @property + def owner_id(self): + """Gets the owner_id of this SchedulerEvent. # noqa: E501 + + + :return: The owner_id of this SchedulerEvent. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this SchedulerEvent. + + + :param owner_id: The owner_id of this SchedulerEvent. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this SchedulerEvent. # noqa: E501 + + scheduler event name # noqa: E501 + + :return: The name of this SchedulerEvent. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SchedulerEvent. + + scheduler event name # noqa: E501 + + :param name: The name of this SchedulerEvent. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this SchedulerEvent. # noqa: E501 + + scheduler event type # noqa: E501 + + :return: The type of this SchedulerEvent. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SchedulerEvent. + + scheduler event type # noqa: E501 + + :param type: The type of this SchedulerEvent. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def schedule(self): + """Gets the schedule of this SchedulerEvent. # noqa: E501 + + + :return: The schedule of this SchedulerEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this SchedulerEvent. + + + :param schedule: The schedule of this SchedulerEvent. # noqa: E501 + :type: JsonNode + """ + + self._schedule = schedule + + @property + def configuration(self): + """Gets the configuration of this SchedulerEvent. # noqa: E501 + + + :return: The configuration of this SchedulerEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this SchedulerEvent. + + + :param configuration: The configuration of this SchedulerEvent. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this SchedulerEvent. # noqa: E501 + + + :return: The additional_info of this SchedulerEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SchedulerEvent. + + + :param additional_info: The additional_info of this SchedulerEvent. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_filter.py new file mode 100644 index 0000000..cc5d73b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class SchedulerEventFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'event_type': 'str', + 'originator': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'event_type': 'eventType', + 'originator': 'originator' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, event_type=None, originator=None, *args, **kwargs): # noqa: E501 + """SchedulerEventFilter - a model defined in Swagger""" # noqa: E501 + self._event_type = None + self._originator = None + self.discriminator = None + if event_type is not None: + self.event_type = event_type + if originator is not None: + self.originator = originator + EntityFilter.__init__(self, *args, **kwargs) + + @property + def event_type(self): + """Gets the event_type of this SchedulerEventFilter. # noqa: E501 + + + :return: The event_type of this SchedulerEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this SchedulerEventFilter. + + + :param event_type: The event_type of this SchedulerEventFilter. # noqa: E501 + :type: str + """ + + self._event_type = event_type + + @property + def originator(self): + """Gets the originator of this SchedulerEventFilter. # noqa: E501 + + + :return: The originator of this SchedulerEventFilter. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this SchedulerEventFilter. + + + :param originator: The originator of this SchedulerEventFilter. # noqa: E501 + :type: EntityId + """ + + self._originator = originator + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_id.py b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_id.py new file mode 100644 index 0000000..f9514d4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_id.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """SchedulerEventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this SchedulerEventId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this SchedulerEventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEventId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this SchedulerEventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_info.py b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_info.py new file mode 100644 index 0000000..8218fe1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_info.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'SchedulerEventId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'originator_id': 'EntityId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'schedule': 'JsonNode', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'originator_id': 'originatorId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'schedule': 'schedule', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, originator_id=None, owner_id=None, name=None, type=None, schedule=None, additional_info=None): # noqa: E501 + """SchedulerEventInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._originator_id = None + self._owner_id = None + self._name = None + self._type = None + self._schedule = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if originator_id is not None: + self.originator_id = originator_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if schedule is not None: + self.schedule = schedule + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SchedulerEventInfo. # noqa: E501 + + + :return: The id of this SchedulerEventInfo. # noqa: E501 + :rtype: SchedulerEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEventInfo. + + + :param id: The id of this SchedulerEventInfo. # noqa: E501 + :type: SchedulerEventId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SchedulerEventInfo. # noqa: E501 + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :return: The created_time of this SchedulerEventInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SchedulerEventInfo. + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SchedulerEventInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The tenant_id of this SchedulerEventInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SchedulerEventInfo. + + + :param tenant_id: The tenant_id of this SchedulerEventInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The customer_id of this SchedulerEventInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this SchedulerEventInfo. + + + :param customer_id: The customer_id of this SchedulerEventInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def originator_id(self): + """Gets the originator_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The originator_id of this SchedulerEventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator_id + + @originator_id.setter + def originator_id(self, originator_id): + """Sets the originator_id of this SchedulerEventInfo. + + + :param originator_id: The originator_id of this SchedulerEventInfo. # noqa: E501 + :type: EntityId + """ + + self._originator_id = originator_id + + @property + def owner_id(self): + """Gets the owner_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The owner_id of this SchedulerEventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this SchedulerEventInfo. + + + :param owner_id: The owner_id of this SchedulerEventInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this SchedulerEventInfo. # noqa: E501 + + scheduler event name # noqa: E501 + + :return: The name of this SchedulerEventInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SchedulerEventInfo. + + scheduler event name # noqa: E501 + + :param name: The name of this SchedulerEventInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this SchedulerEventInfo. # noqa: E501 + + scheduler event type # noqa: E501 + + :return: The type of this SchedulerEventInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SchedulerEventInfo. + + scheduler event type # noqa: E501 + + :param type: The type of this SchedulerEventInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def schedule(self): + """Gets the schedule of this SchedulerEventInfo. # noqa: E501 + + + :return: The schedule of this SchedulerEventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this SchedulerEventInfo. + + + :param schedule: The schedule of this SchedulerEventInfo. # noqa: E501 + :type: JsonNode + """ + + self._schedule = schedule + + @property + def additional_info(self): + """Gets the additional_info of this SchedulerEventInfo. # noqa: E501 + + + :return: The additional_info of this SchedulerEventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SchedulerEventInfo. + + + :param additional_info: The additional_info of this SchedulerEventInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_with_customer_info.py b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_with_customer_info.py new file mode 100644 index 0000000..e919a2a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/scheduler_event_with_customer_info.py @@ -0,0 +1,420 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEventWithCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'SchedulerEventId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'originator_id': 'EntityId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'schedule': 'JsonNode', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'object' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'originator_id': 'originatorId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'schedule': 'schedule', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, originator_id=None, owner_id=None, name=None, type=None, schedule=None, additional_info=None, customer_title=None, customer_is_public=None): # noqa: E501 + """SchedulerEventWithCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._originator_id = None + self._owner_id = None + self._name = None + self._type = None + self._schedule = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if originator_id is not None: + self.originator_id = originator_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if schedule is not None: + self.schedule = schedule + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + + @property + def id(self): + """Gets the id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: SchedulerEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEventWithCustomerInfo. + + + :param id: The id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: SchedulerEventId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SchedulerEventWithCustomerInfo. # noqa: E501 + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :return: The created_time of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SchedulerEventWithCustomerInfo. + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The tenant_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SchedulerEventWithCustomerInfo. + + + :param tenant_id: The tenant_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The customer_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this SchedulerEventWithCustomerInfo. + + + :param customer_id: The customer_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def originator_id(self): + """Gets the originator_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The originator_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator_id + + @originator_id.setter + def originator_id(self, originator_id): + """Sets the originator_id of this SchedulerEventWithCustomerInfo. + + + :param originator_id: The originator_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._originator_id = originator_id + + @property + def owner_id(self): + """Gets the owner_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The owner_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this SchedulerEventWithCustomerInfo. + + + :param owner_id: The owner_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this SchedulerEventWithCustomerInfo. # noqa: E501 + + scheduler event name # noqa: E501 + + :return: The name of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SchedulerEventWithCustomerInfo. + + scheduler event name # noqa: E501 + + :param name: The name of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this SchedulerEventWithCustomerInfo. # noqa: E501 + + scheduler event type # noqa: E501 + + :return: The type of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SchedulerEventWithCustomerInfo. + + scheduler event type # noqa: E501 + + :param type: The type of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def schedule(self): + """Gets the schedule of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The schedule of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this SchedulerEventWithCustomerInfo. + + + :param schedule: The schedule of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._schedule = schedule + + @property + def additional_info(self): + """Gets the additional_info of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The additional_info of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SchedulerEventWithCustomerInfo. + + + :param additional_info: The additional_info of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this SchedulerEventWithCustomerInfo. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The customer_title of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this SchedulerEventWithCustomerInfo. + + Title of the customer # noqa: E501 + + :param customer_title: The customer_title of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this SchedulerEventWithCustomerInfo. # noqa: E501 + + Parameter that specifies if customer is public # noqa: E501 + + :return: The customer_is_public of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: object + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this SchedulerEventWithCustomerInfo. + + Parameter that specifies if customer is public # noqa: E501 + + :param customer_is_public: The customer_is_public of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: object + """ + + self._customer_is_public = customer_is_public + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventWithCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventWithCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/security_settings.py b/billinglayer/python/tb_rest_client/models/models_pe/security_settings.py new file mode 100644 index 0000000..9bb96b6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/security_settings.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SecuritySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password_policy': 'UserPasswordPolicy', + 'max_failed_login_attempts': 'int', + 'user_lockout_notification_email': 'str' + } + + attribute_map = { + 'password_policy': 'passwordPolicy', + 'max_failed_login_attempts': 'maxFailedLoginAttempts', + 'user_lockout_notification_email': 'userLockoutNotificationEmail' + } + + def __init__(self, password_policy=None, max_failed_login_attempts=None, user_lockout_notification_email=None): # noqa: E501 + """SecuritySettings - a model defined in Swagger""" # noqa: E501 + self._password_policy = None + self._max_failed_login_attempts = None + self._user_lockout_notification_email = None + self.discriminator = None + if password_policy is not None: + self.password_policy = password_policy + if max_failed_login_attempts is not None: + self.max_failed_login_attempts = max_failed_login_attempts + if user_lockout_notification_email is not None: + self.user_lockout_notification_email = user_lockout_notification_email + + @property + def password_policy(self): + """Gets the password_policy of this SecuritySettings. # noqa: E501 + + + :return: The password_policy of this SecuritySettings. # noqa: E501 + :rtype: UserPasswordPolicy + """ + return self._password_policy + + @password_policy.setter + def password_policy(self, password_policy): + """Sets the password_policy of this SecuritySettings. + + + :param password_policy: The password_policy of this SecuritySettings. # noqa: E501 + :type: UserPasswordPolicy + """ + + self._password_policy = password_policy + + @property + def max_failed_login_attempts(self): + """Gets the max_failed_login_attempts of this SecuritySettings. # noqa: E501 + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :return: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :rtype: int + """ + return self._max_failed_login_attempts + + @max_failed_login_attempts.setter + def max_failed_login_attempts(self, max_failed_login_attempts): + """Sets the max_failed_login_attempts of this SecuritySettings. + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :param max_failed_login_attempts: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :type: int + """ + + self._max_failed_login_attempts = max_failed_login_attempts + + @property + def user_lockout_notification_email(self): + """Gets the user_lockout_notification_email of this SecuritySettings. # noqa: E501 + + Email to use for notifications about locked users. # noqa: E501 + + :return: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :rtype: str + """ + return self._user_lockout_notification_email + + @user_lockout_notification_email.setter + def user_lockout_notification_email(self, user_lockout_notification_email): + """Sets the user_lockout_notification_email of this SecuritySettings. + + Email to use for notifications about locked users. # noqa: E501 + + :param user_lockout_notification_email: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :type: str + """ + + self._user_lockout_notification_email = user_lockout_notification_email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SecuritySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SecuritySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/self_registration_params.py b/billinglayer/python/tb_rest_client/models/models_pe/self_registration_params.py new file mode 100644 index 0000000..ad2092e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/self_registration_params.py @@ -0,0 +1,592 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SelfRegistrationParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'admin_settings_id': 'str', + 'sign_up_text_message': 'str', + 'captcha_site_key': 'str', + 'captcha_version': 'str', + 'captcha_action': 'str', + 'show_privacy_policy': 'bool', + 'show_terms_of_use': 'bool', + 'domain_name': 'str', + 'captcha_secret_key': 'str', + 'privacy_policy': 'str', + 'terms_of_use': 'str', + 'notification_email': 'str', + 'default_dashboard_id': 'str', + 'default_dashboard_fullscreen': 'bool', + 'permissions': 'list[GroupPermission]', + 'pkg_name': 'str', + 'app_secret': 'str', + 'app_scheme': 'str', + 'app_host': 'str' + } + + attribute_map = { + 'admin_settings_id': 'adminSettingsId', + 'sign_up_text_message': 'signUpTextMessage', + 'captcha_site_key': 'captchaSiteKey', + 'captcha_version': 'captchaVersion', + 'captcha_action': 'captchaAction', + 'show_privacy_policy': 'showPrivacyPolicy', + 'show_terms_of_use': 'showTermsOfUse', + 'domain_name': 'domainName', + 'captcha_secret_key': 'captchaSecretKey', + 'privacy_policy': 'privacyPolicy', + 'terms_of_use': 'termsOfUse', + 'notification_email': 'notificationEmail', + 'default_dashboard_id': 'defaultDashboardId', + 'default_dashboard_fullscreen': 'defaultDashboardFullscreen', + 'permissions': 'permissions', + 'pkg_name': 'pkgName', + 'app_secret': 'appSecret', + 'app_scheme': 'appScheme', + 'app_host': 'appHost' + } + + def __init__(self, admin_settings_id=None, sign_up_text_message=None, captcha_site_key=None, captcha_version=None, captcha_action=None, show_privacy_policy=None, show_terms_of_use=None, domain_name=None, captcha_secret_key=None, privacy_policy=None, terms_of_use=None, notification_email=None, default_dashboard_id=None, default_dashboard_fullscreen=None, permissions=None, pkg_name=None, app_secret=None, app_scheme=None, app_host=None): # noqa: E501 + """SelfRegistrationParams - a model defined in Swagger""" # noqa: E501 + self._admin_settings_id = None + self._sign_up_text_message = None + self._captcha_site_key = None + self._captcha_version = None + self._captcha_action = None + self._show_privacy_policy = None + self._show_terms_of_use = None + self._domain_name = None + self._captcha_secret_key = None + self._privacy_policy = None + self._terms_of_use = None + self._notification_email = None + self._default_dashboard_id = None + self._default_dashboard_fullscreen = None + self._permissions = None + self._pkg_name = None + self._app_secret = None + self._app_scheme = None + self._app_host = None + self.discriminator = None + if admin_settings_id is not None: + self.admin_settings_id = admin_settings_id + if sign_up_text_message is not None: + self.sign_up_text_message = sign_up_text_message + if captcha_site_key is not None: + self.captcha_site_key = captcha_site_key + if captcha_version is not None: + self.captcha_version = captcha_version + if captcha_action is not None: + self.captcha_action = captcha_action + if show_privacy_policy is not None: + self.show_privacy_policy = show_privacy_policy + if show_terms_of_use is not None: + self.show_terms_of_use = show_terms_of_use + if domain_name is not None: + self.domain_name = domain_name + if captcha_secret_key is not None: + self.captcha_secret_key = captcha_secret_key + if privacy_policy is not None: + self.privacy_policy = privacy_policy + if terms_of_use is not None: + self.terms_of_use = terms_of_use + if notification_email is not None: + self.notification_email = notification_email + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if default_dashboard_fullscreen is not None: + self.default_dashboard_fullscreen = default_dashboard_fullscreen + if permissions is not None: + self.permissions = permissions + if pkg_name is not None: + self.pkg_name = pkg_name + if app_secret is not None: + self.app_secret = app_secret + if app_scheme is not None: + self.app_scheme = app_scheme + if app_host is not None: + self.app_host = app_host + + @property + def admin_settings_id(self): + """Gets the admin_settings_id of this SelfRegistrationParams. # noqa: E501 + + + :return: The admin_settings_id of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._admin_settings_id + + @admin_settings_id.setter + def admin_settings_id(self, admin_settings_id): + """Sets the admin_settings_id of this SelfRegistrationParams. + + + :param admin_settings_id: The admin_settings_id of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._admin_settings_id = admin_settings_id + + @property + def sign_up_text_message(self): + """Gets the sign_up_text_message of this SelfRegistrationParams. # noqa: E501 + + + :return: The sign_up_text_message of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._sign_up_text_message + + @sign_up_text_message.setter + def sign_up_text_message(self, sign_up_text_message): + """Sets the sign_up_text_message of this SelfRegistrationParams. + + + :param sign_up_text_message: The sign_up_text_message of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._sign_up_text_message = sign_up_text_message + + @property + def captcha_site_key(self): + """Gets the captcha_site_key of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_site_key of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_site_key + + @captcha_site_key.setter + def captcha_site_key(self, captcha_site_key): + """Sets the captcha_site_key of this SelfRegistrationParams. + + + :param captcha_site_key: The captcha_site_key of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_site_key = captcha_site_key + + @property + def captcha_version(self): + """Gets the captcha_version of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_version of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_version + + @captcha_version.setter + def captcha_version(self, captcha_version): + """Sets the captcha_version of this SelfRegistrationParams. + + + :param captcha_version: The captcha_version of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_version = captcha_version + + @property + def captcha_action(self): + """Gets the captcha_action of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_action of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_action + + @captcha_action.setter + def captcha_action(self, captcha_action): + """Sets the captcha_action of this SelfRegistrationParams. + + + :param captcha_action: The captcha_action of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_action = captcha_action + + @property + def show_privacy_policy(self): + """Gets the show_privacy_policy of this SelfRegistrationParams. # noqa: E501 + + + :return: The show_privacy_policy of this SelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_privacy_policy + + @show_privacy_policy.setter + def show_privacy_policy(self, show_privacy_policy): + """Sets the show_privacy_policy of this SelfRegistrationParams. + + + :param show_privacy_policy: The show_privacy_policy of this SelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_privacy_policy = show_privacy_policy + + @property + def show_terms_of_use(self): + """Gets the show_terms_of_use of this SelfRegistrationParams. # noqa: E501 + + + :return: The show_terms_of_use of this SelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_terms_of_use + + @show_terms_of_use.setter + def show_terms_of_use(self, show_terms_of_use): + """Sets the show_terms_of_use of this SelfRegistrationParams. + + + :param show_terms_of_use: The show_terms_of_use of this SelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_terms_of_use = show_terms_of_use + + @property + def domain_name(self): + """Gets the domain_name of this SelfRegistrationParams. # noqa: E501 + + + :return: The domain_name of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._domain_name + + @domain_name.setter + def domain_name(self, domain_name): + """Sets the domain_name of this SelfRegistrationParams. + + + :param domain_name: The domain_name of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._domain_name = domain_name + + @property + def captcha_secret_key(self): + """Gets the captcha_secret_key of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_secret_key of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_secret_key + + @captcha_secret_key.setter + def captcha_secret_key(self, captcha_secret_key): + """Sets the captcha_secret_key of this SelfRegistrationParams. + + + :param captcha_secret_key: The captcha_secret_key of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_secret_key = captcha_secret_key + + @property + def privacy_policy(self): + """Gets the privacy_policy of this SelfRegistrationParams. # noqa: E501 + + + :return: The privacy_policy of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._privacy_policy + + @privacy_policy.setter + def privacy_policy(self, privacy_policy): + """Sets the privacy_policy of this SelfRegistrationParams. + + + :param privacy_policy: The privacy_policy of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._privacy_policy = privacy_policy + + @property + def terms_of_use(self): + """Gets the terms_of_use of this SelfRegistrationParams. # noqa: E501 + + + :return: The terms_of_use of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._terms_of_use + + @terms_of_use.setter + def terms_of_use(self, terms_of_use): + """Sets the terms_of_use of this SelfRegistrationParams. + + + :param terms_of_use: The terms_of_use of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._terms_of_use = terms_of_use + + @property + def notification_email(self): + """Gets the notification_email of this SelfRegistrationParams. # noqa: E501 + + + :return: The notification_email of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._notification_email + + @notification_email.setter + def notification_email(self, notification_email): + """Sets the notification_email of this SelfRegistrationParams. + + + :param notification_email: The notification_email of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._notification_email = notification_email + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this SelfRegistrationParams. # noqa: E501 + + + :return: The default_dashboard_id of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this SelfRegistrationParams. + + + :param default_dashboard_id: The default_dashboard_id of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def default_dashboard_fullscreen(self): + """Gets the default_dashboard_fullscreen of this SelfRegistrationParams. # noqa: E501 + + + :return: The default_dashboard_fullscreen of this SelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._default_dashboard_fullscreen + + @default_dashboard_fullscreen.setter + def default_dashboard_fullscreen(self, default_dashboard_fullscreen): + """Sets the default_dashboard_fullscreen of this SelfRegistrationParams. + + + :param default_dashboard_fullscreen: The default_dashboard_fullscreen of this SelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._default_dashboard_fullscreen = default_dashboard_fullscreen + + @property + def permissions(self): + """Gets the permissions of this SelfRegistrationParams. # noqa: E501 + + + :return: The permissions of this SelfRegistrationParams. # noqa: E501 + :rtype: list[GroupPermission] + """ + return self._permissions + + @permissions.setter + def permissions(self, permissions): + """Sets the permissions of this SelfRegistrationParams. + + + :param permissions: The permissions of this SelfRegistrationParams. # noqa: E501 + :type: list[GroupPermission] + """ + + self._permissions = permissions + + @property + def pkg_name(self): + """Gets the pkg_name of this SelfRegistrationParams. # noqa: E501 + + + :return: The pkg_name of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this SelfRegistrationParams. + + + :param pkg_name: The pkg_name of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this SelfRegistrationParams. # noqa: E501 + + + :return: The app_secret of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this SelfRegistrationParams. + + + :param app_secret: The app_secret of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._app_secret = app_secret + + @property + def app_scheme(self): + """Gets the app_scheme of this SelfRegistrationParams. # noqa: E501 + + + :return: The app_scheme of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._app_scheme + + @app_scheme.setter + def app_scheme(self, app_scheme): + """Sets the app_scheme of this SelfRegistrationParams. + + + :param app_scheme: The app_scheme of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._app_scheme = app_scheme + + @property + def app_host(self): + """Gets the app_host of this SelfRegistrationParams. # noqa: E501 + + + :return: The app_host of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._app_host + + @app_host.setter + def app_host(self, app_host): + """Sets the app_host of this SelfRegistrationParams. + + + :param app_host: The app_host of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._app_host = app_host + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SelfRegistrationParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SelfRegistrationParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/server_security_config.py b/billinglayer/python/tb_rest_client/models/models_pe/server_security_config.py new file mode 100644 index 0000000..c41c95f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/server_security_config.py @@ -0,0 +1,350 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ServerSecurityConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'server_id': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'bootstrap_server_account_timeout': 'int' + } + + attribute_map = { + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'server_id': 'serverId', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout' + } + + def __init__(self, bootstrap_server_is=None, host=None, port=None, security_host=None, security_port=None, server_id=None, client_hold_off_time=None, server_public_key=None, bootstrap_server_account_timeout=None): # noqa: E501 + """ServerSecurityConfig - a model defined in Swagger""" # noqa: E501 + self._bootstrap_server_is = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._server_id = None + self._client_hold_off_time = None + self._server_public_key = None + self._bootstrap_server_account_timeout = None + self.discriminator = None + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if server_id is not None: + self.server_id = server_id + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + + Is Bootstrap Server # noqa: E501 + + :return: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this ServerSecurityConfig. + + Is Bootstrap Server # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this ServerSecurityConfig. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this ServerSecurityConfig. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this ServerSecurityConfig. # noqa: E501 + + Port for 'No Security' mode # noqa: E501 + + :return: The port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this ServerSecurityConfig. + + Port for 'No Security' mode # noqa: E501 + + :param port: The port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this ServerSecurityConfig. # noqa: E501 + + Host for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this ServerSecurityConfig. + + Host for 'Security' mode (DTLS) # noqa: E501 + + :param security_host: The security_host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this ServerSecurityConfig. # noqa: E501 + + Port for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this ServerSecurityConfig. + + Port for 'Security' mode (DTLS) # noqa: E501 + + :param security_port: The security_port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def server_id(self): + """Gets the server_id of this ServerSecurityConfig. # noqa: E501 + + Server short Id # noqa: E501 + + :return: The server_id of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._server_id + + @server_id.setter + def server_id(self, server_id): + """Sets the server_id of this ServerSecurityConfig. + + Server short Id # noqa: E501 + + :param server_id: The server_id of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._server_id = server_id + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + + Client Hold Off Time # noqa: E501 + + :return: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this ServerSecurityConfig. + + Client Hold Off Time # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this ServerSecurityConfig. # noqa: E501 + + Server Public Key (base64 encoded) # noqa: E501 + + :return: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this ServerSecurityConfig. + + Server Public Key (base64 encoded) # noqa: E501 + + :param server_public_key: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + + Bootstrap Server Account Timeout # noqa: E501 + + :return: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this ServerSecurityConfig. + + Bootstrap Server Account Timeout # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ServerSecurityConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ServerSecurityConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/share_group_request.py b/billinglayer/python/tb_rest_client/models/models_pe/share_group_request.py new file mode 100644 index 0000000..d8748ea --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/share_group_request.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShareGroupRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'all_user_group': 'bool', + 'owner_id': 'EntityId', + 'user_group_id': 'EntityGroupId', + 'read_else_write': 'bool', + 'role_ids': 'list[RoleId]' + } + + attribute_map = { + 'all_user_group': 'allUserGroup', + 'owner_id': 'ownerId', + 'user_group_id': 'userGroupId', + 'read_else_write': 'readElseWrite', + 'role_ids': 'roleIds' + } + + def __init__(self, all_user_group=None, owner_id=None, user_group_id=None, read_else_write=None, role_ids=None): # noqa: E501 + """ShareGroupRequest - a model defined in Swagger""" # noqa: E501 + self._all_user_group = None + self._owner_id = None + self._user_group_id = None + self._read_else_write = None + self._role_ids = None + self.discriminator = None + self.all_user_group = all_user_group + if owner_id is not None: + self.owner_id = owner_id + if user_group_id is not None: + self.user_group_id = user_group_id + if read_else_write is not None: + self.read_else_write = read_else_write + if role_ids is not None: + self.role_ids = role_ids + + @property + def all_user_group(self): + """Gets the all_user_group of this ShareGroupRequest. # noqa: E501 + + Indicate that the group should be shared with user group 'All' that belongs to Tenant or Customer (see 'ownerId' property description). # noqa: E501 + + :return: The all_user_group of this ShareGroupRequest. # noqa: E501 + :rtype: bool + """ + return self._all_user_group + + @all_user_group.setter + def all_user_group(self, all_user_group): + """Sets the all_user_group of this ShareGroupRequest. + + Indicate that the group should be shared with user group 'All' that belongs to Tenant or Customer (see 'ownerId' property description). # noqa: E501 + + :param all_user_group: The all_user_group of this ShareGroupRequest. # noqa: E501 + :type: bool + """ + if all_user_group is None: + raise ValueError("Invalid value for `all_user_group`, must not be `None`") # noqa: E501 + + self._all_user_group = all_user_group + + @property + def owner_id(self): + """Gets the owner_id of this ShareGroupRequest. # noqa: E501 + + + :return: The owner_id of this ShareGroupRequest. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this ShareGroupRequest. + + + :param owner_id: The owner_id of this ShareGroupRequest. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def user_group_id(self): + """Gets the user_group_id of this ShareGroupRequest. # noqa: E501 + + + :return: The user_group_id of this ShareGroupRequest. # noqa: E501 + :rtype: EntityGroupId + """ + return self._user_group_id + + @user_group_id.setter + def user_group_id(self, user_group_id): + """Sets the user_group_id of this ShareGroupRequest. + + + :param user_group_id: The user_group_id of this ShareGroupRequest. # noqa: E501 + :type: EntityGroupId + """ + + self._user_group_id = user_group_id + + @property + def read_else_write(self): + """Gets the read_else_write of this ShareGroupRequest. # noqa: E501 + + Used if 'roleIds' property is not present. if the value is 'true', creates role with read-only permissions. If the value is 'false', creates role with write permissions. # noqa: E501 + + :return: The read_else_write of this ShareGroupRequest. # noqa: E501 + :rtype: bool + """ + return self._read_else_write + + @read_else_write.setter + def read_else_write(self, read_else_write): + """Sets the read_else_write of this ShareGroupRequest. + + Used if 'roleIds' property is not present. if the value is 'true', creates role with read-only permissions. If the value is 'false', creates role with write permissions. # noqa: E501 + + :param read_else_write: The read_else_write of this ShareGroupRequest. # noqa: E501 + :type: bool + """ + + self._read_else_write = read_else_write + + @property + def role_ids(self): + """Gets the role_ids of this ShareGroupRequest. # noqa: E501 + + List of group role Ids that should be used to share the entity group with the user group. If not set, the platform will create new role (see 'readElseWrite' property description) # noqa: E501 + + :return: The role_ids of this ShareGroupRequest. # noqa: E501 + :rtype: list[RoleId] + """ + return self._role_ids + + @role_ids.setter + def role_ids(self, role_ids): + """Sets the role_ids of this ShareGroupRequest. + + List of group role Ids that should be used to share the entity group with the user group. If not set, the platform will create new role (see 'readElseWrite' property description) # noqa: E501 + + :param role_ids: The role_ids of this ShareGroupRequest. # noqa: E501 + :type: list[RoleId] + """ + + self._role_ids = role_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShareGroupRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShareGroupRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/shared_attributes_setting_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_pe/shared_attributes_setting_snmp_communication_config.py new file mode 100644 index 0000000..a0e2d73 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/shared_attributes_setting_snmp_communication_config.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class SharedAttributesSettingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, spec=None, *args, **kwargs): # noqa: E501 + """SharedAttributesSettingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param mappings: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param spec: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SharedAttributesSettingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SharedAttributesSettingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/short_customer_info.py b/billinglayer/python/tb_rest_client/models/models_pe/short_customer_info.py new file mode 100644 index 0000000..37e5b87 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/short_customer_info.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShortCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'customer_id': 'CustomerId', + 'title': 'str' + } + + attribute_map = { + 'public': 'public', + 'customer_id': 'customerId', + 'title': 'title' + } + + def __init__(self, public=None, customer_id=None, title=None): # noqa: E501 + """ShortCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._public = None + self._customer_id = None + self._title = None + self.discriminator = None + if public is not None: + self.public = public + if customer_id is not None: + self.customer_id = customer_id + if title is not None: + self.title = title + + @property + def public(self): + """Gets the public of this ShortCustomerInfo. # noqa: E501 + + + :return: The public of this ShortCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this ShortCustomerInfo. + + + :param public: The public of this ShortCustomerInfo. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def customer_id(self): + """Gets the customer_id of this ShortCustomerInfo. # noqa: E501 + + + :return: The customer_id of this ShortCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ShortCustomerInfo. + + + :param customer_id: The customer_id of this ShortCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def title(self): + """Gets the title of this ShortCustomerInfo. # noqa: E501 + + Title of the customer. # noqa: E501 + + :return: The title of this ShortCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this ShortCustomerInfo. + + Title of the customer. # noqa: E501 + + :param title: The title of this ShortCustomerInfo. # noqa: E501 + :type: str + """ + + self._title = title + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShortCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShortCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/short_entity_view.py b/billinglayer/python/tb_rest_client/models/models_pe/short_entity_view.py new file mode 100644 index 0000000..fb8eed8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/short_entity_view.py @@ -0,0 +1,190 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShortEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str', + 'created_time': 'int', + 'device_profile': 'str', + 'label': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'created_time': 'created_time', + 'device_profile': 'device_profile', + 'label': 'label' + } + + def __init__(self, id=None, name=None, label=None, device_profile=None, created_time=None): # noqa: E501 + """ShortEntityView - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._label = None + self._device_profile_id = None + self._created_time = None + self.discriminator = None + self.id = id + self.name = name + self.label = label + self.device_profile = device_profile + self.created_time = created_time + + @property + def label(self): + return self._label + + @label.setter + def label(self, val): + self._label = val + + @property + def device_profile(self): + return self._device_profile + + @device_profile.setter + def device_profile(self, val): + self._device_profile = val + + @property + def created_time(self): + return self._created_time + + @created_time.setter + def created_time(self, val): + self._created_time = val + + @property + def id(self): + """Gets the id of this ShortEntityView. # noqa: E501 + + + :return: The id of this ShortEntityView. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ShortEntityView. + + + :param id: The id of this ShortEntityView. # noqa: E501 + :type: EntityId + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this ShortEntityView. # noqa: E501 + + Name of the entity # noqa: E501 + + :return: The name of this ShortEntityView. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ShortEntityView. + + Name of the entity # noqa: E501 + + :param name: The name of this ShortEntityView. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShortEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShortEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/sign_up_request.py b/billinglayer/python/tb_rest_client/models/models_pe/sign_up_request.py new file mode 100644 index 0000000..c27d374 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/sign_up_request.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SignUpRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'first_name': 'str', + 'last_name': 'str', + 'email': 'str', + 'password': 'str', + 'recaptcha_response': 'str', + 'pkg_name': 'str', + 'app_secret': 'str' + } + + attribute_map = { + 'first_name': 'firstName', + 'last_name': 'lastName', + 'email': 'email', + 'password': 'password', + 'recaptcha_response': 'recaptchaResponse', + 'pkg_name': 'pkgName', + 'app_secret': 'appSecret' + } + + def __init__(self, first_name=None, last_name=None, email=None, password=None, recaptcha_response=None, pkg_name=None, app_secret=None): # noqa: E501 + """SignUpRequest - a model defined in Swagger""" # noqa: E501 + self._first_name = None + self._last_name = None + self._email = None + self._password = None + self._recaptcha_response = None + self._pkg_name = None + self._app_secret = None + self.discriminator = None + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if email is not None: + self.email = email + if password is not None: + self.password = password + if recaptcha_response is not None: + self.recaptcha_response = recaptcha_response + if pkg_name is not None: + self.pkg_name = pkg_name + if app_secret is not None: + self.app_secret = app_secret + + @property + def first_name(self): + """Gets the first_name of this SignUpRequest. # noqa: E501 + + First Name # noqa: E501 + + :return: The first_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this SignUpRequest. + + First Name # noqa: E501 + + :param first_name: The first_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this SignUpRequest. # noqa: E501 + + Last Name # noqa: E501 + + :return: The last_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this SignUpRequest. + + Last Name # noqa: E501 + + :param last_name: The last_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def email(self): + """Gets the email of this SignUpRequest. # noqa: E501 + + Email will be used for new user to login # noqa: E501 + + :return: The email of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SignUpRequest. + + Email will be used for new user to login # noqa: E501 + + :param email: The email of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def password(self): + """Gets the password of this SignUpRequest. # noqa: E501 + + New User Password # noqa: E501 + + :return: The password of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SignUpRequest. + + New User Password # noqa: E501 + + :param password: The password of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def recaptcha_response(self): + """Gets the recaptcha_response of this SignUpRequest. # noqa: E501 + + Response from reCAPTCHA validation # noqa: E501 + + :return: The recaptcha_response of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._recaptcha_response + + @recaptcha_response.setter + def recaptcha_response(self, recaptcha_response): + """Sets the recaptcha_response of this SignUpRequest. + + Response from reCAPTCHA validation # noqa: E501 + + :param recaptcha_response: The recaptcha_response of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._recaptcha_response = recaptcha_response + + @property + def pkg_name(self): + """Gets the pkg_name of this SignUpRequest. # noqa: E501 + + For mobile apps only. Mobile app package name # noqa: E501 + + :return: The pkg_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this SignUpRequest. + + For mobile apps only. Mobile app package name # noqa: E501 + + :param pkg_name: The pkg_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this SignUpRequest. # noqa: E501 + + For mobile apps only. Mobile app secret # noqa: E501 + + :return: The app_secret of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this SignUpRequest. + + For mobile apps only. Mobile app secret # noqa: E501 + + :param app_secret: The app_secret of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._app_secret = app_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SignUpRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SignUpRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/sign_up_self_registration_params.py b/billinglayer/python/tb_rest_client/models/models_pe/sign_up_self_registration_params.py new file mode 100644 index 0000000..24878b0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/sign_up_self_registration_params.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SignUpSelfRegistrationParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sign_up_text_message': 'str', + 'captcha_site_key': 'str', + 'captcha_version': 'str', + 'captcha_action': 'str', + 'show_privacy_policy': 'bool', + 'show_terms_of_use': 'bool' + } + + attribute_map = { + 'sign_up_text_message': 'signUpTextMessage', + 'captcha_site_key': 'captchaSiteKey', + 'captcha_version': 'captchaVersion', + 'captcha_action': 'captchaAction', + 'show_privacy_policy': 'showPrivacyPolicy', + 'show_terms_of_use': 'showTermsOfUse' + } + + def __init__(self, sign_up_text_message=None, captcha_site_key=None, captcha_version=None, captcha_action=None, show_privacy_policy=None, show_terms_of_use=None): # noqa: E501 + """SignUpSelfRegistrationParams - a model defined in Swagger""" # noqa: E501 + self._sign_up_text_message = None + self._captcha_site_key = None + self._captcha_version = None + self._captcha_action = None + self._show_privacy_policy = None + self._show_terms_of_use = None + self.discriminator = None + if sign_up_text_message is not None: + self.sign_up_text_message = sign_up_text_message + if captcha_site_key is not None: + self.captcha_site_key = captcha_site_key + if captcha_version is not None: + self.captcha_version = captcha_version + if captcha_action is not None: + self.captcha_action = captcha_action + if show_privacy_policy is not None: + self.show_privacy_policy = show_privacy_policy + if show_terms_of_use is not None: + self.show_terms_of_use = show_terms_of_use + + @property + def sign_up_text_message(self): + """Gets the sign_up_text_message of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The sign_up_text_message of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._sign_up_text_message + + @sign_up_text_message.setter + def sign_up_text_message(self, sign_up_text_message): + """Sets the sign_up_text_message of this SignUpSelfRegistrationParams. + + + :param sign_up_text_message: The sign_up_text_message of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._sign_up_text_message = sign_up_text_message + + @property + def captcha_site_key(self): + """Gets the captcha_site_key of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The captcha_site_key of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_site_key + + @captcha_site_key.setter + def captcha_site_key(self, captcha_site_key): + """Sets the captcha_site_key of this SignUpSelfRegistrationParams. + + + :param captcha_site_key: The captcha_site_key of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_site_key = captcha_site_key + + @property + def captcha_version(self): + """Gets the captcha_version of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The captcha_version of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_version + + @captcha_version.setter + def captcha_version(self, captcha_version): + """Sets the captcha_version of this SignUpSelfRegistrationParams. + + + :param captcha_version: The captcha_version of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_version = captcha_version + + @property + def captcha_action(self): + """Gets the captcha_action of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The captcha_action of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_action + + @captcha_action.setter + def captcha_action(self, captcha_action): + """Sets the captcha_action of this SignUpSelfRegistrationParams. + + + :param captcha_action: The captcha_action of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_action = captcha_action + + @property + def show_privacy_policy(self): + """Gets the show_privacy_policy of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The show_privacy_policy of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_privacy_policy + + @show_privacy_policy.setter + def show_privacy_policy(self, show_privacy_policy): + """Sets the show_privacy_policy of this SignUpSelfRegistrationParams. + + + :param show_privacy_policy: The show_privacy_policy of this SignUpSelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_privacy_policy = show_privacy_policy + + @property + def show_terms_of_use(self): + """Gets the show_terms_of_use of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The show_terms_of_use of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_terms_of_use + + @show_terms_of_use.setter + def show_terms_of_use(self, show_terms_of_use): + """Sets the show_terms_of_use of this SignUpSelfRegistrationParams. + + + :param show_terms_of_use: The show_terms_of_use of this SignUpSelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_terms_of_use = show_terms_of_use + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SignUpSelfRegistrationParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SignUpSelfRegistrationParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/simple_alarm_condition_spec.py b/billinglayer/python/tb_rest_client/models/models_pe/simple_alarm_condition_spec.py new file mode 100644 index 0000000..f9a6833 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/simple_alarm_condition_spec.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class SimpleAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """SimpleAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + AlarmConditionSpec.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SimpleAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SimpleAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/single_entity_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/single_entity_filter.py new file mode 100644 index 0000000..5edc2a7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/single_entity_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class SingleEntityFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'single_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'single_entity': 'singleEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, single_entity=None, *args, **kwargs): # noqa: E501 + """SingleEntityFilter - a model defined in Swagger""" # noqa: E501 + self._single_entity = None + self.discriminator = None + if single_entity is not None: + self.single_entity = single_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def single_entity(self): + """Gets the single_entity of this SingleEntityFilter. # noqa: E501 + + + :return: The single_entity of this SingleEntityFilter. # noqa: E501 + :rtype: EntityId + """ + return self._single_entity + + @single_entity.setter + def single_entity(self, single_entity): + """Sets the single_entity of this SingleEntityFilter. + + + :param single_entity: The single_entity of this SingleEntityFilter. # noqa: E501 + :type: EntityId + """ + + self._single_entity = single_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/single_entity_version_create_request.py b/billinglayer/python/tb_rest_client/models/models_pe/single_entity_version_create_request.py new file mode 100644 index 0000000..896aa32 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/single_entity_version_create_request.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class SingleEntityVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'config': 'VersionCreateConfig', + 'entity_id': 'EntityId', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'config': 'config', + 'entity_id': 'entityId', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, config=None, entity_id=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._config = None + self._entity_id = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if config is not None: + self.config = config + if entity_id is not None: + self.entity_id = entity_id + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this SingleEntityVersionCreateRequest. + + + :param branch: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def config(self): + """Gets the config of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: VersionCreateConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionCreateRequest. + + + :param config: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: VersionCreateConfig + """ + + self._config = config + + @property + def entity_id(self): + """Gets the entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this SingleEntityVersionCreateRequest. + + + :param entity_id: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionCreateRequest. + + + :param type: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this SingleEntityVersionCreateRequest. + + + :param version_name: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/single_entity_version_load_request.py b/billinglayer/python/tb_rest_client/models/models_pe/single_entity_version_load_request.py new file mode 100644 index 0000000..fb4d344 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/single_entity_version_load_request.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class SingleEntityVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'config': 'VersionLoadConfig', + 'external_entity_id': 'EntityId', + 'internal_entity_id': 'EntityId', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'config': 'config', + 'external_entity_id': 'externalEntityId', + 'internal_entity_id': 'internalEntityId', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, config=None, external_entity_id=None, internal_entity_id=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._config = None + self._external_entity_id = None + self._internal_entity_id = None + self._type = None + self._version_id = None + self.discriminator = None + if config is not None: + self.config = config + if external_entity_id is not None: + self.external_entity_id = external_entity_id + if internal_entity_id is not None: + self.internal_entity_id = internal_entity_id + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def config(self): + """Gets the config of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: VersionLoadConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionLoadRequest. + + + :param config: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: VersionLoadConfig + """ + + self._config = config + + @property + def external_entity_id(self): + """Gets the external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: EntityId + """ + return self._external_entity_id + + @external_entity_id.setter + def external_entity_id(self, external_entity_id): + """Sets the external_entity_id of this SingleEntityVersionLoadRequest. + + + :param external_entity_id: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: EntityId + """ + + self._external_entity_id = external_entity_id + + @property + def internal_entity_id(self): + """Gets the internal_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The internal_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: EntityId + """ + return self._internal_entity_id + + @internal_entity_id.setter + def internal_entity_id(self, internal_entity_id): + """Sets the internal_entity_id of this SingleEntityVersionLoadRequest. + + + :param internal_entity_id: The internal_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: EntityId + """ + + self._internal_entity_id = internal_entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionLoadRequest. + + + :param type: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this SingleEntityVersionLoadRequest. + + + :param version_id: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/slack_conversation.py b/billinglayer/python/tb_rest_client/models/models_pe/slack_conversation.py new file mode 100644 index 0000000..320e74d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/slack_conversation.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackConversation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'id': 'str', + 'name': 'str', + 'title': 'str', + 'type': 'str', + 'whole_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'id': 'id', + 'name': 'name', + 'title': 'title', + 'type': 'type', + 'whole_name': 'wholeName' + } + + def __init__(self, email=None, id=None, name=None, title=None, type=None, whole_name=None): # noqa: E501 + """SlackConversation - a model defined in Swagger""" # noqa: E501 + self._email = None + self._id = None + self._name = None + self._title = None + self._type = None + self._whole_name = None + self.discriminator = None + if email is not None: + self.email = email + if id is not None: + self.id = id + if name is not None: + self.name = name + if title is not None: + self.title = title + self.type = type + if whole_name is not None: + self.whole_name = whole_name + + @property + def email(self): + """Gets the email of this SlackConversation. # noqa: E501 + + + :return: The email of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SlackConversation. + + + :param email: The email of this SlackConversation. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def id(self): + """Gets the id of this SlackConversation. # noqa: E501 + + + :return: The id of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SlackConversation. + + + :param id: The id of this SlackConversation. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this SlackConversation. # noqa: E501 + + + :return: The name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SlackConversation. + + + :param name: The name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this SlackConversation. # noqa: E501 + + + :return: The title of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SlackConversation. + + + :param title: The title of this SlackConversation. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def type(self): + """Gets the type of this SlackConversation. # noqa: E501 + + + :return: The type of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SlackConversation. + + + :param type: The type of this SlackConversation. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def whole_name(self): + """Gets the whole_name of this SlackConversation. # noqa: E501 + + + :return: The whole_name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._whole_name + + @whole_name.setter + def whole_name(self, whole_name): + """Sets the whole_name of this SlackConversation. + + + :param whole_name: The whole_name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._whole_name = whole_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackConversation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackConversation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/slack_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_pe/slack_delivery_method_notification_template.py new file mode 100644 index 0000000..3f24ab3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/slack_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SlackDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SlackDeliveryMethodNotificationTemplate. + + + :param body: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SlackDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/slack_notification_delivery_method_config.py b/billinglayer/python/tb_rest_client/models/models_pe/slack_notification_delivery_method_config.py new file mode 100644 index 0000000..81fe50e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/slack_notification_delivery_method_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackNotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bot_token': 'str' + } + + attribute_map = { + 'bot_token': 'botToken' + } + + def __init__(self, bot_token=None): # noqa: E501 + """SlackNotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self._bot_token = None + self.discriminator = None + if bot_token is not None: + self.bot_token = bot_token + + @property + def bot_token(self): + """Gets the bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + + + :return: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :rtype: str + """ + return self._bot_token + + @bot_token.setter + def bot_token(self, bot_token): + """Sets the bot_token of this SlackNotificationDeliveryMethodConfig. + + + :param bot_token: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :type: str + """ + + self._bot_token = bot_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/slack_notification_target_config.py b/billinglayer/python/tb_rest_client/models/models_pe/slack_notification_target_config.py new file mode 100644 index 0000000..fa8f57a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/slack_notification_target_config.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class SlackNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'conversation': 'SlackConversation', + 'conversation_type': 'str', + 'description': 'str' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'conversation': 'conversation', + 'conversation_type': 'conversationType', + 'description': 'description' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, conversation=None, conversation_type=None, description=None, *args, **kwargs): # noqa: E501 + """SlackNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._conversation = None + self._conversation_type = None + self._description = None + self.discriminator = None + self.conversation = conversation + if conversation_type is not None: + self.conversation_type = conversation_type + if description is not None: + self.description = description + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def conversation(self): + """Gets the conversation of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: SlackConversation + """ + return self._conversation + + @conversation.setter + def conversation(self, conversation): + """Sets the conversation of this SlackNotificationTargetConfig. + + + :param conversation: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :type: SlackConversation + """ + if conversation is None: + raise ValueError("Invalid value for `conversation`, must not be `None`") # noqa: E501 + + self._conversation = conversation + + @property + def conversation_type(self): + """Gets the conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._conversation_type + + @conversation_type.setter + def conversation_type(self, conversation_type): + """Sets the conversation_type of this SlackNotificationTargetConfig. + + + :param conversation_type: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if conversation_type not in allowed_values: + raise ValueError( + "Invalid value for `conversation_type` ({0}), must be one of {1}" # noqa: E501 + .format(conversation_type, allowed_values) + ) + + self._conversation_type = conversation_type + + @property + def description(self): + """Gets the description of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The description of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this SlackNotificationTargetConfig. + + + :param description: The description of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/smpp_sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/smpp_sms_provider_configuration.py new file mode 100644 index 0000000..f925381 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/smpp_sms_provider_configuration.py @@ -0,0 +1,541 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class SmppSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'address_range': 'str', + 'bind_type': 'str', + 'coding_scheme': 'str', + 'destination_npi': 'str', + 'destination_ton': 'str', + 'host': 'str', + 'password': 'str', + 'port': 'int', + 'protocol_version': 'str', + 'service_type': 'str', + 'source_address': 'str', + 'source_npi': 'str', + 'source_ton': 'str', + 'system_id': 'str', + 'system_type': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'address_range': 'addressRange', + 'bind_type': 'bindType', + 'coding_scheme': 'codingScheme', + 'destination_npi': 'destinationNpi', + 'destination_ton': 'destinationTon', + 'host': 'host', + 'password': 'password', + 'port': 'port', + 'protocol_version': 'protocolVersion', + 'service_type': 'serviceType', + 'source_address': 'sourceAddress', + 'source_npi': 'sourceNpi', + 'source_ton': 'sourceTon', + 'system_id': 'systemId', + 'system_type': 'systemType' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, address_range=None, bind_type=None, coding_scheme=None, destination_npi=None, destination_ton=None, host=None, password=None, port=None, protocol_version=None, service_type=None, source_address=None, source_npi=None, source_ton=None, system_id=None, system_type=None, *args, **kwargs): # noqa: E501 + """SmppSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._address_range = None + self._bind_type = None + self._coding_scheme = None + self._destination_npi = None + self._destination_ton = None + self._host = None + self._password = None + self._port = None + self._protocol_version = None + self._service_type = None + self._source_address = None + self._source_npi = None + self._source_ton = None + self._system_id = None + self._system_type = None + self.discriminator = None + if address_range is not None: + self.address_range = address_range + if bind_type is not None: + self.bind_type = bind_type + if coding_scheme is not None: + self.coding_scheme = coding_scheme + if destination_npi is not None: + self.destination_npi = destination_npi + if destination_ton is not None: + self.destination_ton = destination_ton + self.host = host + self.password = password + self.port = port + self.protocol_version = protocol_version + if service_type is not None: + self.service_type = service_type + if source_address is not None: + self.source_address = source_address + if source_npi is not None: + self.source_npi = source_npi + if source_ton is not None: + self.source_ton = source_ton + self.system_id = system_id + if system_type is not None: + self.system_type = system_type + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def address_range(self): + """Gets the address_range of this SmppSmsProviderConfiguration. # noqa: E501 + + Address range # noqa: E501 + + :return: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._address_range + + @address_range.setter + def address_range(self, address_range): + """Sets the address_range of this SmppSmsProviderConfiguration. + + Address range # noqa: E501 + + :param address_range: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._address_range = address_range + + @property + def bind_type(self): + """Gets the bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :return: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._bind_type + + @bind_type.setter + def bind_type(self, bind_type): + """Sets the bind_type of this SmppSmsProviderConfiguration. + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :param bind_type: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["RX", "TRX", "TX"] # noqa: E501 + if bind_type not in allowed_values: + raise ValueError( + "Invalid value for `bind_type` ({0}), must be one of {1}" # noqa: E501 + .format(bind_type, allowed_values) + ) + + self._bind_type = bind_type + + @property + def coding_scheme(self): + """Gets the coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :return: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._coding_scheme + + @coding_scheme.setter + def coding_scheme(self, coding_scheme): + """Sets the coding_scheme of this SmppSmsProviderConfiguration. + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :param coding_scheme: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._coding_scheme = coding_scheme + + @property + def destination_npi(self): + """Gets the destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_npi + + @destination_npi.setter + def destination_npi(self, destination_npi): + """Sets the destination_npi of this SmppSmsProviderConfiguration. + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param destination_npi: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_npi = destination_npi + + @property + def destination_ton(self): + """Gets the destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_ton + + @destination_ton.setter + def destination_ton(self, destination_ton): + """Sets the destination_ton of this SmppSmsProviderConfiguration. + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param destination_ton: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_ton = destination_ton + + @property + def host(self): + """Gets the host of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP host # noqa: E501 + + :return: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SmppSmsProviderConfiguration. + + SMPP host # noqa: E501 + + :param host: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if host is None: + raise ValueError("Invalid value for `host`, must not be `None`") # noqa: E501 + + self._host = host + + @property + def password(self): + """Gets the password of this SmppSmsProviderConfiguration. # noqa: E501 + + Password # noqa: E501 + + :return: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SmppSmsProviderConfiguration. + + Password # noqa: E501 + + :param password: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + @property + def port(self): + """Gets the port of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP port # noqa: E501 + + :return: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SmppSmsProviderConfiguration. + + SMPP port # noqa: E501 + + :param port: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :type: int + """ + if port is None: + raise ValueError("Invalid value for `port`, must not be `None`") # noqa: E501 + + self._port = port + + @property + def protocol_version(self): + """Gets the protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP version # noqa: E501 + + :return: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SmppSmsProviderConfiguration. + + SMPP version # noqa: E501 + + :param protocol_version: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if protocol_version is None: + raise ValueError("Invalid value for `protocol_version`, must not be `None`") # noqa: E501 + allowed_values = ["3.3", "3.4"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def service_type(self): + """Gets the service_type of this SmppSmsProviderConfiguration. # noqa: E501 + + Service type # noqa: E501 + + :return: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SmppSmsProviderConfiguration. + + Service type # noqa: E501 + + :param service_type: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def source_address(self): + """Gets the source_address of this SmppSmsProviderConfiguration. # noqa: E501 + + Source address # noqa: E501 + + :return: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_address + + @source_address.setter + def source_address(self, source_address): + """Sets the source_address of this SmppSmsProviderConfiguration. + + Source address # noqa: E501 + + :param source_address: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_address = source_address + + @property + def source_npi(self): + """Gets the source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_npi + + @source_npi.setter + def source_npi(self, source_npi): + """Sets the source_npi of this SmppSmsProviderConfiguration. + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param source_npi: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_npi = source_npi + + @property + def source_ton(self): + """Gets the source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_ton + + @source_ton.setter + def source_ton(self, source_ton): + """Sets the source_ton of this SmppSmsProviderConfiguration. + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param source_ton: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_ton = source_ton + + @property + def system_id(self): + """Gets the system_id of this SmppSmsProviderConfiguration. # noqa: E501 + + System ID # noqa: E501 + + :return: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_id + + @system_id.setter + def system_id(self, system_id): + """Sets the system_id of this SmppSmsProviderConfiguration. + + System ID # noqa: E501 + + :param system_id: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if system_id is None: + raise ValueError("Invalid value for `system_id`, must not be `None`") # noqa: E501 + + self._system_id = system_id + + @property + def system_type(self): + """Gets the system_type of this SmppSmsProviderConfiguration. # noqa: E501 + + System type # noqa: E501 + + :return: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_type + + @system_type.setter + def system_type(self, system_type): + """Sets the system_type of this SmppSmsProviderConfiguration. + + System type # noqa: E501 + + :param system_type: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._system_type = system_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmppSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmppSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/sms_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_pe/sms_delivery_method_notification_template.py new file mode 100644 index 0000000..a8cd25f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/sms_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SmsDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SmsDeliveryMethodNotificationTemplate. + + + :param body: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SmsDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/sms_provider_configuration.py new file mode 100644 index 0000000..d60a33d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/sms_provider_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsProviderConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/sms_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_pe/sms_two_fa_account_config.py new file mode 100644 index 0000000..9bf96c7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/sms_two_fa_account_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.two_fa_account_config import TwoFaAccountConfig # noqa: F401,E501 + +class SmsTwoFaAccountConfig(TwoFaAccountConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'phone_number': 'str', + 'use_by_default': 'bool' + } + if hasattr(TwoFaAccountConfig, "swagger_types"): + swagger_types.update(TwoFaAccountConfig.swagger_types) + + attribute_map = { + 'phone_number': 'phoneNumber', + 'use_by_default': 'useByDefault' + } + if hasattr(TwoFaAccountConfig, "attribute_map"): + attribute_map.update(TwoFaAccountConfig.attribute_map) + + def __init__(self, phone_number=None, use_by_default=None, *args, **kwargs): # noqa: E501 + """SmsTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._phone_number = None + self._use_by_default = None + self.discriminator = None + self.phone_number = phone_number + if use_by_default is not None: + self.use_by_default = use_by_default + TwoFaAccountConfig.__init__(self, *args, **kwargs) + + @property + def phone_number(self): + """Gets the phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._phone_number + + @phone_number.setter + def phone_number(self, phone_number): + """Sets the phone_number of this SmsTwoFaAccountConfig. + + + :param phone_number: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if phone_number is None: + raise ValueError("Invalid value for `phone_number`, must not be `None`") # noqa: E501 + + self._phone_number = phone_number + + @property + def use_by_default(self): + """Gets the use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this SmsTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/sms_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_pe/sms_two_fa_provider_config.py new file mode 100644 index 0000000..bfb6ed0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/sms_two_fa_provider_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sms_verification_message_template': 'str', + 'verification_code_lifetime': 'int' + } + + attribute_map = { + 'sms_verification_message_template': 'smsVerificationMessageTemplate', + 'verification_code_lifetime': 'verificationCodeLifetime' + } + + def __init__(self, sms_verification_message_template=None, verification_code_lifetime=None): # noqa: E501 + """SmsTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._sms_verification_message_template = None + self._verification_code_lifetime = None + self.discriminator = None + self.sms_verification_message_template = sms_verification_message_template + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + + @property + def sms_verification_message_template(self): + """Gets the sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._sms_verification_message_template + + @sms_verification_message_template.setter + def sms_verification_message_template(self, sms_verification_message_template): + """Sets the sms_verification_message_template of this SmsTwoFaProviderConfig. + + + :param sms_verification_message_template: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if sms_verification_message_template is None: + raise ValueError("Invalid value for `sms_verification_message_template`, must not be `None`") # noqa: E501 + + self._sms_verification_message_template = sms_verification_message_template + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this SmsTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_pe/snmp_communication_config.py new file mode 100644 index 0000000..31ce853 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/snmp_communication_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'spec': 'str' + } + + attribute_map = { + 'spec': 'spec' + } + + def __init__(self, spec=None): # noqa: E501 + """SnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._spec = None + self.discriminator = None + if spec is not None: + self.spec = spec + + @property + def spec(self): + """Gets the spec of this SnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SnmpCommunicationConfig. + + + :param spec: The spec of this SnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/snmp_device_profile_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/snmp_device_profile_transport_configuration.py new file mode 100644 index 0000000..b8da5b5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/snmp_device_profile_transport_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'communication_configs': 'list[SnmpCommunicationConfig]', + 'retries': 'int', + 'timeout_ms': 'int' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'communication_configs': 'communicationConfigs', + 'retries': 'retries', + 'timeout_ms': 'timeoutMs' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, communication_configs=None, retries=None, timeout_ms=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._communication_configs = None + self._retries = None + self._timeout_ms = None + self.discriminator = None + if communication_configs is not None: + self.communication_configs = communication_configs + if retries is not None: + self.retries = retries + if timeout_ms is not None: + self.timeout_ms = timeout_ms + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def communication_configs(self): + """Gets the communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[SnmpCommunicationConfig] + """ + return self._communication_configs + + @communication_configs.setter + def communication_configs(self, communication_configs): + """Sets the communication_configs of this SnmpDeviceProfileTransportConfiguration. + + + :param communication_configs: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[SnmpCommunicationConfig] + """ + + self._communication_configs = communication_configs + + @property + def retries(self): + """Gets the retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this SnmpDeviceProfileTransportConfiguration. + + + :param retries: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def timeout_ms(self): + """Gets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._timeout_ms + + @timeout_ms.setter + def timeout_ms(self, timeout_ms): + """Sets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. + + + :param timeout_ms: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._timeout_ms = timeout_ms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/snmp_device_transport_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/snmp_device_transport_configuration.py new file mode 100644 index 0000000..20bde4e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/snmp_device_transport_configuration.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'authentication_passphrase': 'str', + 'authentication_protocol': 'str', + 'community': 'str', + 'context_name': 'str', + 'engine_id': 'str', + 'host': 'str', + 'port': 'int', + 'privacy_passphrase': 'str', + 'privacy_protocol': 'str', + 'protocol_version': 'str', + 'security_name': 'str', + 'username': 'str' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'authentication_passphrase': 'authenticationPassphrase', + 'authentication_protocol': 'authenticationProtocol', + 'community': 'community', + 'context_name': 'contextName', + 'engine_id': 'engineId', + 'host': 'host', + 'port': 'port', + 'privacy_passphrase': 'privacyPassphrase', + 'privacy_protocol': 'privacyProtocol', + 'protocol_version': 'protocolVersion', + 'security_name': 'securityName', + 'username': 'username' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, authentication_passphrase=None, authentication_protocol=None, community=None, context_name=None, engine_id=None, host=None, port=None, privacy_passphrase=None, privacy_protocol=None, protocol_version=None, security_name=None, username=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._authentication_passphrase = None + self._authentication_protocol = None + self._community = None + self._context_name = None + self._engine_id = None + self._host = None + self._port = None + self._privacy_passphrase = None + self._privacy_protocol = None + self._protocol_version = None + self._security_name = None + self._username = None + self.discriminator = None + if authentication_passphrase is not None: + self.authentication_passphrase = authentication_passphrase + if authentication_protocol is not None: + self.authentication_protocol = authentication_protocol + if community is not None: + self.community = community + if context_name is not None: + self.context_name = context_name + if engine_id is not None: + self.engine_id = engine_id + if host is not None: + self.host = host + if port is not None: + self.port = port + if privacy_passphrase is not None: + self.privacy_passphrase = privacy_passphrase + if privacy_protocol is not None: + self.privacy_protocol = privacy_protocol + if protocol_version is not None: + self.protocol_version = protocol_version + if security_name is not None: + self.security_name = security_name + if username is not None: + self.username = username + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def authentication_passphrase(self): + """Gets the authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_passphrase + + @authentication_passphrase.setter + def authentication_passphrase(self, authentication_passphrase): + """Sets the authentication_passphrase of this SnmpDeviceTransportConfiguration. + + + :param authentication_passphrase: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._authentication_passphrase = authentication_passphrase + + @property + def authentication_protocol(self): + """Gets the authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_protocol + + @authentication_protocol.setter + def authentication_protocol(self, authentication_protocol): + """Sets the authentication_protocol of this SnmpDeviceTransportConfiguration. + + + :param authentication_protocol: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512"] # noqa: E501 + if authentication_protocol not in allowed_values: + raise ValueError( + "Invalid value for `authentication_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(authentication_protocol, allowed_values) + ) + + self._authentication_protocol = authentication_protocol + + @property + def community(self): + """Gets the community of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._community + + @community.setter + def community(self, community): + """Sets the community of this SnmpDeviceTransportConfiguration. + + + :param community: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._community = community + + @property + def context_name(self): + """Gets the context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._context_name + + @context_name.setter + def context_name(self, context_name): + """Sets the context_name of this SnmpDeviceTransportConfiguration. + + + :param context_name: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._context_name = context_name + + @property + def engine_id(self): + """Gets the engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._engine_id + + @engine_id.setter + def engine_id(self, engine_id): + """Sets the engine_id of this SnmpDeviceTransportConfiguration. + + + :param engine_id: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._engine_id = engine_id + + @property + def host(self): + """Gets the host of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SnmpDeviceTransportConfiguration. + + + :param host: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SnmpDeviceTransportConfiguration. + + + :param port: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def privacy_passphrase(self): + """Gets the privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_passphrase + + @privacy_passphrase.setter + def privacy_passphrase(self, privacy_passphrase): + """Sets the privacy_passphrase of this SnmpDeviceTransportConfiguration. + + + :param privacy_passphrase: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._privacy_passphrase = privacy_passphrase + + @property + def privacy_protocol(self): + """Gets the privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_protocol + + @privacy_protocol.setter + def privacy_protocol(self, privacy_protocol): + """Sets the privacy_protocol of this SnmpDeviceTransportConfiguration. + + + :param privacy_protocol: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["AES_128", "AES_192", "AES_256", "DES"] # noqa: E501 + if privacy_protocol not in allowed_values: + raise ValueError( + "Invalid value for `privacy_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(privacy_protocol, allowed_values) + ) + + self._privacy_protocol = privacy_protocol + + @property + def protocol_version(self): + """Gets the protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SnmpDeviceTransportConfiguration. + + + :param protocol_version: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["V1", "V2C", "V3"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def security_name(self): + """Gets the security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._security_name + + @security_name.setter + def security_name(self, security_name): + """Sets the security_name of this SnmpDeviceTransportConfiguration. + + + :param security_name: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._security_name = security_name + + @property + def username(self): + """Gets the username of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this SnmpDeviceTransportConfiguration. + + + :param username: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/snmp_mapping.py b/billinglayer/python/tb_rest_client/models/models_pe/snmp_mapping.py new file mode 100644 index 0000000..5857164 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/snmp_mapping.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data_type': 'str', + 'key': 'str', + 'oid': 'str' + } + + attribute_map = { + 'data_type': 'dataType', + 'key': 'key', + 'oid': 'oid' + } + + def __init__(self, data_type=None, key=None, oid=None): # noqa: E501 + """SnmpMapping - a model defined in Swagger""" # noqa: E501 + self._data_type = None + self._key = None + self._oid = None + self.discriminator = None + if data_type is not None: + self.data_type = data_type + if key is not None: + self.key = key + if oid is not None: + self.oid = oid + + @property + def data_type(self): + """Gets the data_type of this SnmpMapping. # noqa: E501 + + + :return: The data_type of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._data_type + + @data_type.setter + def data_type(self, data_type): + """Sets the data_type of this SnmpMapping. + + + :param data_type: The data_type of this SnmpMapping. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DOUBLE", "JSON", "LONG", "STRING"] # noqa: E501 + if data_type not in allowed_values: + raise ValueError( + "Invalid value for `data_type` ({0}), must be one of {1}" # noqa: E501 + .format(data_type, allowed_values) + ) + + self._data_type = data_type + + @property + def key(self): + """Gets the key of this SnmpMapping. # noqa: E501 + + + :return: The key of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this SnmpMapping. + + + :param key: The key of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def oid(self): + """Gets the oid of this SnmpMapping. # noqa: E501 + + + :return: The oid of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._oid + + @oid.setter + def oid(self, oid): + """Sets the oid of this SnmpMapping. + + + :param oid: The oid of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._oid = oid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/solution_install_response.py b/billinglayer/python/tb_rest_client/models/models_pe/solution_install_response.py new file mode 100644 index 0000000..acb33dc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/solution_install_response.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SolutionInstallResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dashboard_group_id': 'EntityGroupId', + 'dashboard_id': 'DashboardId', + 'public_id': 'CustomerId', + 'main_dashboard_public': 'bool', + 'success': 'bool', + 'details': 'str' + } + + attribute_map = { + 'dashboard_group_id': 'dashboardGroupId', + 'dashboard_id': 'dashboardId', + 'public_id': 'publicId', + 'main_dashboard_public': 'mainDashboardPublic', + 'success': 'success', + 'details': 'details' + } + + def __init__(self, dashboard_group_id=None, dashboard_id=None, public_id=None, main_dashboard_public=None, success=None, details=None): # noqa: E501 + """SolutionInstallResponse - a model defined in Swagger""" # noqa: E501 + self._dashboard_group_id = None + self._dashboard_id = None + self._public_id = None + self._main_dashboard_public = None + self._success = None + self._details = None + self.discriminator = None + if dashboard_group_id is not None: + self.dashboard_group_id = dashboard_group_id + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if public_id is not None: + self.public_id = public_id + if main_dashboard_public is not None: + self.main_dashboard_public = main_dashboard_public + if success is not None: + self.success = success + if details is not None: + self.details = details + + @property + def dashboard_group_id(self): + """Gets the dashboard_group_id of this SolutionInstallResponse. # noqa: E501 + + + :return: The dashboard_group_id of this SolutionInstallResponse. # noqa: E501 + :rtype: EntityGroupId + """ + return self._dashboard_group_id + + @dashboard_group_id.setter + def dashboard_group_id(self, dashboard_group_id): + """Sets the dashboard_group_id of this SolutionInstallResponse. + + + :param dashboard_group_id: The dashboard_group_id of this SolutionInstallResponse. # noqa: E501 + :type: EntityGroupId + """ + + self._dashboard_group_id = dashboard_group_id + + @property + def dashboard_id(self): + """Gets the dashboard_id of this SolutionInstallResponse. # noqa: E501 + + + :return: The dashboard_id of this SolutionInstallResponse. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this SolutionInstallResponse. + + + :param dashboard_id: The dashboard_id of this SolutionInstallResponse. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + @property + def public_id(self): + """Gets the public_id of this SolutionInstallResponse. # noqa: E501 + + + :return: The public_id of this SolutionInstallResponse. # noqa: E501 + :rtype: CustomerId + """ + return self._public_id + + @public_id.setter + def public_id(self, public_id): + """Sets the public_id of this SolutionInstallResponse. + + + :param public_id: The public_id of this SolutionInstallResponse. # noqa: E501 + :type: CustomerId + """ + + self._public_id = public_id + + @property + def main_dashboard_public(self): + """Gets the main_dashboard_public of this SolutionInstallResponse. # noqa: E501 + + Is the main dashboard public # noqa: E501 + + :return: The main_dashboard_public of this SolutionInstallResponse. # noqa: E501 + :rtype: bool + """ + return self._main_dashboard_public + + @main_dashboard_public.setter + def main_dashboard_public(self, main_dashboard_public): + """Sets the main_dashboard_public of this SolutionInstallResponse. + + Is the main dashboard public # noqa: E501 + + :param main_dashboard_public: The main_dashboard_public of this SolutionInstallResponse. # noqa: E501 + :type: bool + """ + + self._main_dashboard_public = main_dashboard_public + + @property + def success(self): + """Gets the success of this SolutionInstallResponse. # noqa: E501 + + Indicates that template was installed successfully # noqa: E501 + + :return: The success of this SolutionInstallResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this SolutionInstallResponse. + + Indicates that template was installed successfully # noqa: E501 + + :param success: The success of this SolutionInstallResponse. # noqa: E501 + :type: bool + """ + + self._success = success + + @property + def details(self): + """Gets the details of this SolutionInstallResponse. # noqa: E501 + + Markdown with solution usage instructions # noqa: E501 + + :return: The details of this SolutionInstallResponse. # noqa: E501 + :rtype: str + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this SolutionInstallResponse. + + Markdown with solution usage instructions # noqa: E501 + + :param details: The details of this SolutionInstallResponse. # noqa: E501 + :type: str + """ + + self._details = details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SolutionInstallResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SolutionInstallResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/specific_time_schedule.py b/billinglayer/python/tb_rest_client/models/models_pe/specific_time_schedule.py new file mode 100644 index 0000000..2c57b29 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/specific_time_schedule.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SpecificTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'days_of_week': 'list[int]', + 'dynamic_value': 'DynamicValuestring', + 'ends_on': 'int', + 'starts_on': 'int', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'days_of_week': 'daysOfWeek', + 'dynamic_value': 'dynamicValue', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, days_of_week=None, dynamic_value=None, ends_on=None, starts_on=None, timezone=None, type=None): # noqa: E501 + """SpecificTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._days_of_week = None + self._dynamic_value = None + self._ends_on = None + self._starts_on = None + self._timezone = None + self._type = None + self.discriminator = None + if days_of_week is not None: + self.days_of_week = days_of_week + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def days_of_week(self): + """Gets the days_of_week of this SpecificTimeSchedule. # noqa: E501 + + + :return: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :rtype: list[int] + """ + return self._days_of_week + + @days_of_week.setter + def days_of_week(self, days_of_week): + """Sets the days_of_week of this SpecificTimeSchedule. + + + :param days_of_week: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :type: list[int] + """ + + self._days_of_week = days_of_week + + @property + def dynamic_value(self): + """Gets the dynamic_value of this SpecificTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this SpecificTimeSchedule. + + + :param dynamic_value: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def ends_on(self): + """Gets the ends_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this SpecificTimeSchedule. + + + :param ends_on: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this SpecificTimeSchedule. + + + :param starts_on: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + @property + def timezone(self): + """Gets the timezone of this SpecificTimeSchedule. # noqa: E501 + + + :return: The timezone of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this SpecificTimeSchedule. + + + :param timezone: The timezone of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this SpecificTimeSchedule. # noqa: E501 + + + :return: The type of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SpecificTimeSchedule. + + + :param type: The type of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SpecificTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SpecificTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/starred_dashboard_info.py b/billinglayer/python/tb_rest_client/models/models_pe/starred_dashboard_info.py new file mode 100644 index 0000000..efa5080 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/starred_dashboard_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class StarredDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred_at': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred_at': 'starredAt' + } + + def __init__(self, id=None, title=None, starred_at=None): # noqa: E501 + """StarredDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred_at = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred_at is not None: + self.starred_at = starred_at + + @property + def id(self): + """Gets the id of this StarredDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this StarredDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this StarredDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this StarredDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred_at(self): + """Gets the starred_at of this StarredDashboardInfo. # noqa: E501 + + Starred timestamp # noqa: E501 + + :return: The starred_at of this StarredDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._starred_at + + @starred_at.setter + def starred_at(self, starred_at): + """Sets the starred_at of this StarredDashboardInfo. + + Starred timestamp # noqa: E501 + + :param starred_at: The starred_at of this StarredDashboardInfo. # noqa: E501 + :type: int + """ + + self._starred_at = starred_at + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StarredDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StarredDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/state_entity_owner_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/state_entity_owner_filter.py new file mode 100644 index 0000000..a9e0524 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/state_entity_owner_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class StateEntityOwnerFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'single_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'single_entity': 'singleEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, single_entity=None, *args, **kwargs): # noqa: E501 + """StateEntityOwnerFilter - a model defined in Swagger""" # noqa: E501 + self._single_entity = None + self.discriminator = None + if single_entity is not None: + self.single_entity = single_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def single_entity(self): + """Gets the single_entity of this StateEntityOwnerFilter. # noqa: E501 + + + :return: The single_entity of this StateEntityOwnerFilter. # noqa: E501 + :rtype: EntityId + """ + return self._single_entity + + @single_entity.setter + def single_entity(self, single_entity): + """Sets the single_entity of this StateEntityOwnerFilter. + + + :param single_entity: The single_entity of this StateEntityOwnerFilter. # noqa: E501 + :type: EntityId + """ + + self._single_entity = single_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StateEntityOwnerFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StateEntityOwnerFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/statistics_event_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/statistics_event_filter.py new file mode 100644 index 0000000..1de4462 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/statistics_event_filter.py @@ -0,0 +1,305 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class StatisticsEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'min_messages_processed': 'int', + 'max_messages_processed': 'int', + 'min_errors_occurred': 'int', + 'max_errors_occurred': 'int' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'min_messages_processed': 'minMessagesProcessed', + 'max_messages_processed': 'maxMessagesProcessed', + 'min_errors_occurred': 'minErrorsOccurred', + 'max_errors_occurred': 'maxErrorsOccurred' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, min_messages_processed=None, max_messages_processed=None, min_errors_occurred=None, max_errors_occurred=None, *args, **kwargs): # noqa: E501 + """StatisticsEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._min_messages_processed = None + self._max_messages_processed = None + self._min_errors_occurred = None + self._max_errors_occurred = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if min_messages_processed is not None: + self.min_messages_processed = min_messages_processed + if max_messages_processed is not None: + self.max_messages_processed = max_messages_processed + if min_errors_occurred is not None: + self.min_errors_occurred = min_errors_occurred + if max_errors_occurred is not None: + self.max_errors_occurred = max_errors_occurred + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this StatisticsEventFilter. # noqa: E501 + + + :return: The not_empty of this StatisticsEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this StatisticsEventFilter. + + + :param not_empty: The not_empty of this StatisticsEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this StatisticsEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this StatisticsEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this StatisticsEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this StatisticsEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def min_messages_processed(self): + """Gets the min_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The minimum number of successfully processed messages # noqa: E501 + + :return: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_messages_processed + + @min_messages_processed.setter + def min_messages_processed(self, min_messages_processed): + """Sets the min_messages_processed of this StatisticsEventFilter. + + The minimum number of successfully processed messages # noqa: E501 + + :param min_messages_processed: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_messages_processed = min_messages_processed + + @property + def max_messages_processed(self): + """Gets the max_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The maximum number of successfully processed messages # noqa: E501 + + :return: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_messages_processed + + @max_messages_processed.setter + def max_messages_processed(self, max_messages_processed): + """Sets the max_messages_processed of this StatisticsEventFilter. + + The maximum number of successfully processed messages # noqa: E501 + + :param max_messages_processed: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_messages_processed = max_messages_processed + + @property + def min_errors_occurred(self): + """Gets the min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The minimum number of errors occurred during messages processing # noqa: E501 + + :return: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_errors_occurred + + @min_errors_occurred.setter + def min_errors_occurred(self, min_errors_occurred): + """Sets the min_errors_occurred of this StatisticsEventFilter. + + The minimum number of errors occurred during messages processing # noqa: E501 + + :param min_errors_occurred: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_errors_occurred = min_errors_occurred + + @property + def max_errors_occurred(self): + """Gets the max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The maximum number of errors occurred during messages processing # noqa: E501 + + :return: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_errors_occurred + + @max_errors_occurred.setter + def max_errors_occurred(self, max_errors_occurred): + """Sets the max_errors_occurred of this StatisticsEventFilter. + + The maximum number of errors occurred during messages processing # noqa: E501 + + :param max_errors_occurred: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_errors_occurred = max_errors_occurred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StatisticsEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StatisticsEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/string_filter_predicate.py b/billinglayer/python/tb_rest_client/models/models_pe/string_filter_predicate.py new file mode 100644 index 0000000..61b692d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/string_filter_predicate.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class StringFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'ignore_case': 'bool', + 'operation': 'str', + 'value': 'FilterPredicateValuestring' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'ignore_case': 'ignoreCase', + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, ignore_case=None, operation=None, value=None, *args, **kwargs): # noqa: E501 + """StringFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._ignore_case = None + self._operation = None + self._value = None + self.discriminator = None + if ignore_case is not None: + self.ignore_case = ignore_case + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def ignore_case(self): + """Gets the ignore_case of this StringFilterPredicate. # noqa: E501 + + + :return: The ignore_case of this StringFilterPredicate. # noqa: E501 + :rtype: bool + """ + return self._ignore_case + + @ignore_case.setter + def ignore_case(self, ignore_case): + """Sets the ignore_case of this StringFilterPredicate. + + + :param ignore_case: The ignore_case of this StringFilterPredicate. # noqa: E501 + :type: bool + """ + + self._ignore_case = ignore_case + + @property + def operation(self): + """Gets the operation of this StringFilterPredicate. # noqa: E501 + + + :return: The operation of this StringFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this StringFilterPredicate. + + + :param operation: The operation of this StringFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["CONTAINS", "ENDS_WITH", "EQUAL", "IN", "NOT_CONTAINS", "NOT_EQUAL", "NOT_IN", "STARTS_WITH"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this StringFilterPredicate. # noqa: E501 + + + :return: The value of this StringFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuestring + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this StringFilterPredicate. + + + :param value: The value of this StringFilterPredicate. # noqa: E501 + :type: FilterPredicateValuestring + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StringFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StringFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/submit_strategy.py b/billinglayer/python/tb_rest_client/models/models_pe/submit_strategy.py new file mode 100644 index 0000000..0b3706c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/submit_strategy.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SubmitStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'batch_size': 'int', + 'type': 'str' + } + + attribute_map = { + 'batch_size': 'batchSize', + 'type': 'type' + } + + def __init__(self, batch_size=None, type=None): # noqa: E501 + """SubmitStrategy - a model defined in Swagger""" # noqa: E501 + self._batch_size = None + self._type = None + self.discriminator = None + if batch_size is not None: + self.batch_size = batch_size + if type is not None: + self.type = type + + @property + def batch_size(self): + """Gets the batch_size of this SubmitStrategy. # noqa: E501 + + + :return: The batch_size of this SubmitStrategy. # noqa: E501 + :rtype: int + """ + return self._batch_size + + @batch_size.setter + def batch_size(self, batch_size): + """Sets the batch_size of this SubmitStrategy. + + + :param batch_size: The batch_size of this SubmitStrategy. # noqa: E501 + :type: int + """ + + self._batch_size = batch_size + + @property + def type(self): + """Gets the type of this SubmitStrategy. # noqa: E501 + + + :return: The type of this SubmitStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SubmitStrategy. + + + :param type: The type of this SubmitStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["BATCH", "BURST", "SEQUENTIAL", "SEQUENTIAL_BY_ORIGINATOR", "SEQUENTIAL_BY_TENANT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SubmitStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SubmitStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/subscription_usage.py b/billinglayer/python/tb_rest_client/models/models_pe/subscription_usage.py new file mode 100644 index 0000000..2c5b358 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/subscription_usage.py @@ -0,0 +1,540 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SubscriptionUsage(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms': 'int', + 'assets': 'int', + 'converters': 'int', + 'customers': 'int', + 'dashboards': 'int', + 'devices': 'int', + 'dp_storage_days': 'int', + 'emails': 'int', + 'integrations': 'int', + 'js_executions': 'int', + 're_executions': 'int', + 'rule_chains': 'int', + 'scheduler_events': 'int', + 'sms': 'int', + 'transport_data_points': 'int', + 'transport_messages': 'int', + 'users': 'int' + } + + attribute_map = { + 'alarms': 'alarms', + 'assets': 'assets', + 'converters': 'converters', + 'customers': 'customers', + 'dashboards': 'dashboards', + 'devices': 'devices', + 'dp_storage_days': 'dpStorageDays', + 'emails': 'emails', + 'integrations': 'integrations', + 'js_executions': 'jsExecutions', + 're_executions': 'reExecutions', + 'rule_chains': 'ruleChains', + 'scheduler_events': 'schedulerEvents', + 'sms': 'sms', + 'transport_data_points': 'transportDataPoints', + 'transport_messages': 'transportMessages', + 'users': 'users' + } + + def __init__(self, alarms=None, assets=None, converters=None, customers=None, dashboards=None, devices=None, dp_storage_days=None, emails=None, integrations=None, js_executions=None, re_executions=None, rule_chains=None, scheduler_events=None, sms=None, transport_data_points=None, transport_messages=None, users=None): # noqa: E501 + """SubscriptionUsage - a model defined in Swagger""" # noqa: E501 + self._alarms = None + self._assets = None + self._converters = None + self._customers = None + self._dashboards = None + self._devices = None + self._dp_storage_days = None + self._emails = None + self._integrations = None + self._js_executions = None + self._re_executions = None + self._rule_chains = None + self._scheduler_events = None + self._sms = None + self._transport_data_points = None + self._transport_messages = None + self._users = None + self.discriminator = None + if alarms is not None: + self.alarms = alarms + if assets is not None: + self.assets = assets + if converters is not None: + self.converters = converters + if customers is not None: + self.customers = customers + if dashboards is not None: + self.dashboards = dashboards + if devices is not None: + self.devices = devices + if dp_storage_days is not None: + self.dp_storage_days = dp_storage_days + if emails is not None: + self.emails = emails + if integrations is not None: + self.integrations = integrations + if js_executions is not None: + self.js_executions = js_executions + if re_executions is not None: + self.re_executions = re_executions + if rule_chains is not None: + self.rule_chains = rule_chains + if scheduler_events is not None: + self.scheduler_events = scheduler_events + if sms is not None: + self.sms = sms + if transport_data_points is not None: + self.transport_data_points = transport_data_points + if transport_messages is not None: + self.transport_messages = transport_messages + if users is not None: + self.users = users + + @property + def alarms(self): + """Gets the alarms of this SubscriptionUsage. # noqa: E501 + + + :return: The alarms of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this SubscriptionUsage. + + + :param alarms: The alarms of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._alarms = alarms + + @property + def assets(self): + """Gets the assets of this SubscriptionUsage. # noqa: E501 + + + :return: The assets of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._assets + + @assets.setter + def assets(self, assets): + """Sets the assets of this SubscriptionUsage. + + + :param assets: The assets of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._assets = assets + + @property + def converters(self): + """Gets the converters of this SubscriptionUsage. # noqa: E501 + + + :return: The converters of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._converters + + @converters.setter + def converters(self, converters): + """Sets the converters of this SubscriptionUsage. + + + :param converters: The converters of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._converters = converters + + @property + def customers(self): + """Gets the customers of this SubscriptionUsage. # noqa: E501 + + + :return: The customers of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._customers + + @customers.setter + def customers(self, customers): + """Sets the customers of this SubscriptionUsage. + + + :param customers: The customers of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._customers = customers + + @property + def dashboards(self): + """Gets the dashboards of this SubscriptionUsage. # noqa: E501 + + + :return: The dashboards of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._dashboards + + @dashboards.setter + def dashboards(self, dashboards): + """Sets the dashboards of this SubscriptionUsage. + + + :param dashboards: The dashboards of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._dashboards = dashboards + + @property + def devices(self): + """Gets the devices of this SubscriptionUsage. # noqa: E501 + + + :return: The devices of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this SubscriptionUsage. + + + :param devices: The devices of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._devices = devices + + @property + def dp_storage_days(self): + """Gets the dp_storage_days of this SubscriptionUsage. # noqa: E501 + + + :return: The dp_storage_days of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._dp_storage_days + + @dp_storage_days.setter + def dp_storage_days(self, dp_storage_days): + """Sets the dp_storage_days of this SubscriptionUsage. + + + :param dp_storage_days: The dp_storage_days of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._dp_storage_days = dp_storage_days + + @property + def emails(self): + """Gets the emails of this SubscriptionUsage. # noqa: E501 + + + :return: The emails of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._emails + + @emails.setter + def emails(self, emails): + """Sets the emails of this SubscriptionUsage. + + + :param emails: The emails of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._emails = emails + + @property + def integrations(self): + """Gets the integrations of this SubscriptionUsage. # noqa: E501 + + + :return: The integrations of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._integrations + + @integrations.setter + def integrations(self, integrations): + """Sets the integrations of this SubscriptionUsage. + + + :param integrations: The integrations of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._integrations = integrations + + @property + def js_executions(self): + """Gets the js_executions of this SubscriptionUsage. # noqa: E501 + + + :return: The js_executions of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._js_executions + + @js_executions.setter + def js_executions(self, js_executions): + """Sets the js_executions of this SubscriptionUsage. + + + :param js_executions: The js_executions of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._js_executions = js_executions + + @property + def re_executions(self): + """Gets the re_executions of this SubscriptionUsage. # noqa: E501 + + + :return: The re_executions of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._re_executions + + @re_executions.setter + def re_executions(self, re_executions): + """Sets the re_executions of this SubscriptionUsage. + + + :param re_executions: The re_executions of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._re_executions = re_executions + + @property + def rule_chains(self): + """Gets the rule_chains of this SubscriptionUsage. # noqa: E501 + + + :return: The rule_chains of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this SubscriptionUsage. + + + :param rule_chains: The rule_chains of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._rule_chains = rule_chains + + @property + def scheduler_events(self): + """Gets the scheduler_events of this SubscriptionUsage. # noqa: E501 + + + :return: The scheduler_events of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._scheduler_events + + @scheduler_events.setter + def scheduler_events(self, scheduler_events): + """Sets the scheduler_events of this SubscriptionUsage. + + + :param scheduler_events: The scheduler_events of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._scheduler_events = scheduler_events + + @property + def sms(self): + """Gets the sms of this SubscriptionUsage. # noqa: E501 + + + :return: The sms of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._sms + + @sms.setter + def sms(self, sms): + """Sets the sms of this SubscriptionUsage. + + + :param sms: The sms of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._sms = sms + + @property + def transport_data_points(self): + """Gets the transport_data_points of this SubscriptionUsage. # noqa: E501 + + + :return: The transport_data_points of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._transport_data_points + + @transport_data_points.setter + def transport_data_points(self, transport_data_points): + """Sets the transport_data_points of this SubscriptionUsage. + + + :param transport_data_points: The transport_data_points of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._transport_data_points = transport_data_points + + @property + def transport_messages(self): + """Gets the transport_messages of this SubscriptionUsage. # noqa: E501 + + + :return: The transport_messages of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._transport_messages + + @transport_messages.setter + def transport_messages(self, transport_messages): + """Sets the transport_messages of this SubscriptionUsage. + + + :param transport_messages: The transport_messages of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._transport_messages = transport_messages + + @property + def users(self): + """Gets the users of this SubscriptionUsage. # noqa: E501 + + + :return: The users of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._users + + @users.setter + def users(self, users): + """Sets the users of this SubscriptionUsage. + + + :param users: The users of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._users = users + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SubscriptionUsage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SubscriptionUsage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/system_administrators_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/system_administrators_filter.py new file mode 100644 index 0000000..795789a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/system_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SystemAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/system_info.py b/billinglayer/python/tb_rest_client/models/models_pe/system_info.py new file mode 100644 index 0000000..ac5ca7f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/system_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'monolith': 'bool', + 'system_data': 'list[SystemInfoData]' + } + + attribute_map = { + 'monolith': 'monolith', + 'system_data': 'systemData' + } + + def __init__(self, monolith=None, system_data=None): # noqa: E501 + """SystemInfo - a model defined in Swagger""" # noqa: E501 + self._monolith = None + self._system_data = None + self.discriminator = None + if monolith is not None: + self.monolith = monolith + if system_data is not None: + self.system_data = system_data + + @property + def monolith(self): + """Gets the monolith of this SystemInfo. # noqa: E501 + + + :return: The monolith of this SystemInfo. # noqa: E501 + :rtype: bool + """ + return self._monolith + + @monolith.setter + def monolith(self, monolith): + """Sets the monolith of this SystemInfo. + + + :param monolith: The monolith of this SystemInfo. # noqa: E501 + :type: bool + """ + + self._monolith = monolith + + @property + def system_data(self): + """Gets the system_data of this SystemInfo. # noqa: E501 + + System data. # noqa: E501 + + :return: The system_data of this SystemInfo. # noqa: E501 + :rtype: list[SystemInfoData] + """ + return self._system_data + + @system_data.setter + def system_data(self, system_data): + """Sets the system_data of this SystemInfo. + + System data. # noqa: E501 + + :param system_data: The system_data of this SystemInfo. # noqa: E501 + :type: list[SystemInfoData] + """ + + self._system_data = system_data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/system_info_data.py b/billinglayer/python/tb_rest_client/models/models_pe/system_info_data.py new file mode 100644 index 0000000..0067e39 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/system_info_data.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfoData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'service_id': 'str', + 'service_type': 'str', + 'cpu_usage': 'int', + 'cpu_count': 'int', + 'memory_usage': 'int', + 'total_memory': 'int', + 'disc_usage': 'int', + 'total_disc_space': 'int' + } + + attribute_map = { + 'service_id': 'serviceId', + 'service_type': 'serviceType', + 'cpu_usage': 'cpuUsage', + 'cpu_count': 'cpuCount', + 'memory_usage': 'memoryUsage', + 'total_memory': 'totalMemory', + 'disc_usage': 'discUsage', + 'total_disc_space': 'totalDiscSpace' + } + + def __init__(self, service_id=None, service_type=None, cpu_usage=None, cpu_count=None, memory_usage=None, total_memory=None, disc_usage=None, total_disc_space=None): # noqa: E501 + """SystemInfoData - a model defined in Swagger""" # noqa: E501 + self._service_id = None + self._service_type = None + self._cpu_usage = None + self._cpu_count = None + self._memory_usage = None + self._total_memory = None + self._disc_usage = None + self._total_disc_space = None + self.discriminator = None + if service_id is not None: + self.service_id = service_id + if service_type is not None: + self.service_type = service_type + if cpu_usage is not None: + self.cpu_usage = cpu_usage + if cpu_count is not None: + self.cpu_count = cpu_count + if memory_usage is not None: + self.memory_usage = memory_usage + if total_memory is not None: + self.total_memory = total_memory + if disc_usage is not None: + self.disc_usage = disc_usage + if total_disc_space is not None: + self.total_disc_space = total_disc_space + + @property + def service_id(self): + """Gets the service_id of this SystemInfoData. # noqa: E501 + + Service Id. # noqa: E501 + + :return: The service_id of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_id + + @service_id.setter + def service_id(self, service_id): + """Sets the service_id of this SystemInfoData. + + Service Id. # noqa: E501 + + :param service_id: The service_id of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_id = service_id + + @property + def service_type(self): + """Gets the service_type of this SystemInfoData. # noqa: E501 + + Service type. # noqa: E501 + + :return: The service_type of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SystemInfoData. + + Service type. # noqa: E501 + + :param service_type: The service_type of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def cpu_usage(self): + """Gets the cpu_usage of this SystemInfoData. # noqa: E501 + + CPU usage, in percent. # noqa: E501 + + :return: The cpu_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_usage + + @cpu_usage.setter + def cpu_usage(self, cpu_usage): + """Sets the cpu_usage of this SystemInfoData. + + CPU usage, in percent. # noqa: E501 + + :param cpu_usage: The cpu_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_usage = cpu_usage + + @property + def cpu_count(self): + """Gets the cpu_count of this SystemInfoData. # noqa: E501 + + Total CPU usage. # noqa: E501 + + :return: The cpu_count of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_count + + @cpu_count.setter + def cpu_count(self, cpu_count): + """Sets the cpu_count of this SystemInfoData. + + Total CPU usage. # noqa: E501 + + :param cpu_count: The cpu_count of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_count = cpu_count + + @property + def memory_usage(self): + """Gets the memory_usage of this SystemInfoData. # noqa: E501 + + Memory usage, in percent. # noqa: E501 + + :return: The memory_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._memory_usage + + @memory_usage.setter + def memory_usage(self, memory_usage): + """Sets the memory_usage of this SystemInfoData. + + Memory usage, in percent. # noqa: E501 + + :param memory_usage: The memory_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._memory_usage = memory_usage + + @property + def total_memory(self): + """Gets the total_memory of this SystemInfoData. # noqa: E501 + + Total memory in bytes. # noqa: E501 + + :return: The total_memory of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_memory + + @total_memory.setter + def total_memory(self, total_memory): + """Sets the total_memory of this SystemInfoData. + + Total memory in bytes. # noqa: E501 + + :param total_memory: The total_memory of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_memory = total_memory + + @property + def disc_usage(self): + """Gets the disc_usage of this SystemInfoData. # noqa: E501 + + Disk usage, in percent. # noqa: E501 + + :return: The disc_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._disc_usage + + @disc_usage.setter + def disc_usage(self, disc_usage): + """Sets the disc_usage of this SystemInfoData. + + Disk usage, in percent. # noqa: E501 + + :param disc_usage: The disc_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._disc_usage = disc_usage + + @property + def total_disc_space(self): + """Gets the total_disc_space of this SystemInfoData. # noqa: E501 + + Total disc space in bytes. # noqa: E501 + + :return: The total_disc_space of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_disc_space + + @total_disc_space.setter + def total_disc_space(self, total_disc_space): + """Sets the total_disc_space of this SystemInfoData. + + Total disc space in bytes. # noqa: E501 + + :param total_disc_space: The total_disc_space of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_disc_space = total_disc_space + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfoData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfoData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tb_resource.py b/billinglayer/python/tb_rest_client/models/models_pe/tb_resource.py new file mode 100644 index 0000000..beeb657 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tb_resource.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str', + 'file_name': 'str', + 'data': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey', + 'file_name': 'fileName', + 'data': 'data' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None, file_name=None, data=None): # noqa: E501 + """TbResource - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self._file_name = None + self._data = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + if file_name is not None: + self.file_name = file_name + if data is not None: + self.data = data + + @property + def id(self): + """Gets the id of this TbResource. # noqa: E501 + + + :return: The id of this TbResource. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResource. + + + :param id: The id of this TbResource. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResource. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResource. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResource. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResource. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResource. # noqa: E501 + + + :return: The tenant_id of this TbResource. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResource. + + + :param tenant_id: The tenant_id of this TbResource. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResource. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResource. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResource. + + Resource title. # noqa: E501 + + :param title: The title of this TbResource. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResource. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResource. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResource. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResource. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResource. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResource. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + @property + def file_name(self): + """Gets the file_name of this TbResource. # noqa: E501 + + Resource file name. # noqa: E501 + + :return: The file_name of this TbResource. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this TbResource. + + Resource file name. # noqa: E501 + + :param file_name: The file_name of this TbResource. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def data(self): + """Gets the data of this TbResource. # noqa: E501 + + Resource data. # noqa: E501 + + :return: The data of this TbResource. # noqa: E501 + :rtype: str + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this TbResource. + + Resource data. # noqa: E501 + + :param data: The data of this TbResource. # noqa: E501 + :type: str + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tb_resource_id.py b/billinglayer/python/tb_rest_client/models/models_pe/tb_resource_id.py new file mode 100644 index 0000000..16ac0e4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tb_resource_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TbResourceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TbResourceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TbResourceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TbResourceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TbResourceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TbResourceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TB_RESOURCE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tb_resource_info.py b/billinglayer/python/tb_rest_client/models/models_pe/tb_resource_info.py new file mode 100644 index 0000000..beed8be --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tb_resource_info.py @@ -0,0 +1,268 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None): # noqa: E501 + """TbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + + @property + def id(self): + """Gets the id of this TbResourceInfo. # noqa: E501 + + + :return: The id of this TbResourceInfo. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceInfo. + + + :param id: The id of this TbResourceInfo. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResourceInfo. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResourceInfo. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResourceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResourceInfo. # noqa: E501 + + + :return: The tenant_id of this TbResourceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResourceInfo. + + + :param tenant_id: The tenant_id of this TbResourceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResourceInfo. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResourceInfo. + + Resource title. # noqa: E501 + + :param title: The title of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResourceInfo. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResourceInfo. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResourceInfo. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResourceInfo. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResourceInfo. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/telemetry_entity_view.py b/billinglayer/python/tb_rest_client/models/models_pe/telemetry_entity_view.py new file mode 100644 index 0000000..bd26484 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/telemetry_entity_view.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'timeseries': 'list[str]', + 'attributes': 'AttributesEntityView' + } + + attribute_map = { + 'timeseries': 'timeseries', + 'attributes': 'attributes' + } + + def __init__(self, timeseries=None, attributes=None): # noqa: E501 + """TelemetryEntityView - a model defined in Swagger""" # noqa: E501 + self._timeseries = None + self._attributes = None + self.discriminator = None + self.timeseries = timeseries + self.attributes = attributes + + @property + def timeseries(self): + """Gets the timeseries of this TelemetryEntityView. # noqa: E501 + + List of time-series data keys to expose # noqa: E501 + + :return: The timeseries of this TelemetryEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this TelemetryEntityView. + + List of time-series data keys to expose # noqa: E501 + + :param timeseries: The timeseries of this TelemetryEntityView. # noqa: E501 + :type: list[str] + """ + if timeseries is None: + raise ValueError("Invalid value for `timeseries`, must not be `None`") # noqa: E501 + + self._timeseries = timeseries + + @property + def attributes(self): + """Gets the attributes of this TelemetryEntityView. # noqa: E501 + + + :return: The attributes of this TelemetryEntityView. # noqa: E501 + :rtype: AttributesEntityView + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this TelemetryEntityView. + + + :param attributes: The attributes of this TelemetryEntityView. # noqa: E501 + :type: AttributesEntityView + """ + if attributes is None: + raise ValueError("Invalid value for `attributes`, must not be `None`") # noqa: E501 + + self._attributes = attributes + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/telemetry_mapping_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/telemetry_mapping_configuration.py new file mode 100644 index 0000000..393d74d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/telemetry_mapping_configuration.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryMappingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attribute': 'list[str]', + 'attribute_lwm2m': 'dict(str, ObjectAttributes)', + 'key_name': 'dict(str, str)', + 'observe': 'list[str]', + 'telemetry': 'list[str]' + } + + attribute_map = { + 'attribute': 'attribute', + 'attribute_lwm2m': 'attributeLwm2m', + 'key_name': 'keyName', + 'observe': 'observe', + 'telemetry': 'telemetry' + } + + def __init__(self, attribute=None, attribute_lwm2m=None, key_name=None, observe=None, telemetry=None): # noqa: E501 + """TelemetryMappingConfiguration - a model defined in Swagger""" # noqa: E501 + self._attribute = None + self._attribute_lwm2m = None + self._key_name = None + self._observe = None + self._telemetry = None + self.discriminator = None + if attribute is not None: + self.attribute = attribute + if attribute_lwm2m is not None: + self.attribute_lwm2m = attribute_lwm2m + if key_name is not None: + self.key_name = key_name + if observe is not None: + self.observe = observe + if telemetry is not None: + self.telemetry = telemetry + + @property + def attribute(self): + """Gets the attribute of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this TelemetryMappingConfiguration. + + + :param attribute: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._attribute = attribute + + @property + def attribute_lwm2m(self): + """Gets the attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, ObjectAttributes) + """ + return self._attribute_lwm2m + + @attribute_lwm2m.setter + def attribute_lwm2m(self, attribute_lwm2m): + """Sets the attribute_lwm2m of this TelemetryMappingConfiguration. + + + :param attribute_lwm2m: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, ObjectAttributes) + """ + + self._attribute_lwm2m = attribute_lwm2m + + @property + def key_name(self): + """Gets the key_name of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, str) + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this TelemetryMappingConfiguration. + + + :param key_name: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, str) + """ + + self._key_name = key_name + + @property + def observe(self): + """Gets the observe of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this TelemetryMappingConfiguration. + + + :param observe: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._observe = observe + + @property + def telemetry(self): + """Gets the telemetry of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this TelemetryMappingConfiguration. + + + :param telemetry: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._telemetry = telemetry + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryMappingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryMappingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/telemetry_querying_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_pe/telemetry_querying_snmp_communication_config.py new file mode 100644 index 0000000..9e41084 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/telemetry_querying_snmp_communication_config.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class TelemetryQueryingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None, *args, **kwargs): # noqa: E501 + """TelemetryQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this TelemetryQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this TelemetryQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_administrators_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_administrators_filter.py new file mode 100644 index 0000000..68cf9b0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_administrators_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class TenantAdministratorsFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'tenant_profiles_ids': 'list[str]', + 'tenants_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'tenant_profiles_ids': 'tenantProfilesIds', + 'tenants_ids': 'tenantsIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, tenant_profiles_ids=None, tenants_ids=None, *args, **kwargs): # noqa: E501 + """TenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self._tenant_profiles_ids = None + self._tenants_ids = None + self.discriminator = None + if tenant_profiles_ids is not None: + self.tenant_profiles_ids = tenant_profiles_ids + if tenants_ids is not None: + self.tenants_ids = tenants_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def tenant_profiles_ids(self): + """Gets the tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_profiles_ids + + @tenant_profiles_ids.setter + def tenant_profiles_ids(self, tenant_profiles_ids): + """Sets the tenant_profiles_ids of this TenantAdministratorsFilter. + + + :param tenant_profiles_ids: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenant_profiles_ids = tenant_profiles_ids + + @property + def tenants_ids(self): + """Gets the tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenants_ids + + @tenants_ids.setter + def tenants_ids(self, tenants_ids): + """Sets the tenants_ids of this TenantAdministratorsFilter. + + + :param tenants_ids: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenants_ids = tenants_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_id.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_id.py new file mode 100644 index 0000000..97106e5 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_configuration.py new file mode 100644 index 0000000..3b9bb45 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_data.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_data.py new file mode 100644 index 0000000..0d8bbe6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_data.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'TenantProfileConfiguration', + 'queue_configuration': 'list[TenantProfileQueueConfiguration]' + } + + attribute_map = { + 'configuration': 'configuration', + 'queue_configuration': 'queueConfiguration' + } + + def __init__(self, configuration=None, queue_configuration=None): # noqa: E501 + """TenantProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._queue_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if queue_configuration is not None: + self.queue_configuration = queue_configuration + + @property + def configuration(self): + """Gets the configuration of this TenantProfileData. # noqa: E501 + + + :return: The configuration of this TenantProfileData. # noqa: E501 + :rtype: TenantProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this TenantProfileData. + + + :param configuration: The configuration of this TenantProfileData. # noqa: E501 + :type: TenantProfileConfiguration + """ + + self._configuration = configuration + + @property + def queue_configuration(self): + """Gets the queue_configuration of this TenantProfileData. # noqa: E501 + + JSON array of queue configuration per tenant profile # noqa: E501 + + :return: The queue_configuration of this TenantProfileData. # noqa: E501 + :rtype: list[TenantProfileQueueConfiguration] + """ + return self._queue_configuration + + @queue_configuration.setter + def queue_configuration(self, queue_configuration): + """Sets the queue_configuration of this TenantProfileData. + + JSON array of queue configuration per tenant profile # noqa: E501 + + :param queue_configuration: The queue_configuration of this TenantProfileData. # noqa: E501 + :type: list[TenantProfileQueueConfiguration] + """ + + self._queue_configuration = queue_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_id.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_id.py new file mode 100644 index 0000000..def1758 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_queue_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_queue_configuration.py new file mode 100644 index 0000000..e8009dc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_profile_queue_configuration.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileQueueConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, topic=None): # noqa: E501 + """TenantProfileQueueConfiguration - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this TenantProfileQueueConfiguration. + + + :param additional_info: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this TenantProfileQueueConfiguration. + + + :param consumer_per_partition: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def name(self): + """Gets the name of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantProfileQueueConfiguration. + + + :param name: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this TenantProfileQueueConfiguration. + + + :param pack_processing_timeout: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this TenantProfileQueueConfiguration. + + + :param partitions: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this TenantProfileQueueConfiguration. + + + :param poll_interval: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this TenantProfileQueueConfiguration. + + + :param processing_strategy: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this TenantProfileQueueConfiguration. + + + :param submit_strategy: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def topic(self): + """Gets the topic of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this TenantProfileQueueConfiguration. + + + :param topic: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileQueueConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileQueueConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_details.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_details.py new file mode 100644 index 0000000..dff6c1b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_details.py @@ -0,0 +1,376 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantSolutionTemplateDetails(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'highlights': 'str', + 'image_urls': 'list[str]', + 'installed': 'bool', + 'id': 'str', + 'title': 'str', + 'level': 'str', + 'install_timeout_ms': 'int', + 'tenant_telemetry_keys': 'list[str]', + 'tenant_attribute_keys': 'list[str]' + } + + attribute_map = { + 'description': 'description', + 'highlights': 'highlights', + 'image_urls': 'imageUrls', + 'installed': 'installed', + 'id': 'id', + 'title': 'title', + 'level': 'level', + 'install_timeout_ms': 'installTimeoutMs', + 'tenant_telemetry_keys': 'tenantTelemetryKeys', + 'tenant_attribute_keys': 'tenantAttributeKeys' + } + + def __init__(self, description=None, highlights=None, image_urls=None, installed=None, id=None, title=None, level=None, install_timeout_ms=None, tenant_telemetry_keys=None, tenant_attribute_keys=None): # noqa: E501 + """TenantSolutionTemplateDetails - a model defined in Swagger""" # noqa: E501 + self._description = None + self._highlights = None + self._image_urls = None + self._installed = None + self._id = None + self._title = None + self._level = None + self._install_timeout_ms = None + self._tenant_telemetry_keys = None + self._tenant_attribute_keys = None + self.discriminator = None + if description is not None: + self.description = description + if highlights is not None: + self.highlights = highlights + if image_urls is not None: + self.image_urls = image_urls + if installed is not None: + self.installed = installed + if id is not None: + self.id = id + if title is not None: + self.title = title + if level is not None: + self.level = level + if install_timeout_ms is not None: + self.install_timeout_ms = install_timeout_ms + if tenant_telemetry_keys is not None: + self.tenant_telemetry_keys = tenant_telemetry_keys + if tenant_attribute_keys is not None: + self.tenant_attribute_keys = tenant_attribute_keys + + @property + def description(self): + """Gets the description of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The description of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this TenantSolutionTemplateDetails. + + + :param description: The description of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def highlights(self): + """Gets the highlights of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The highlights of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._highlights + + @highlights.setter + def highlights(self, highlights): + """Sets the highlights of this TenantSolutionTemplateDetails. + + + :param highlights: The highlights of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._highlights = highlights + + @property + def image_urls(self): + """Gets the image_urls of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The image_urls of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: list[str] + """ + return self._image_urls + + @image_urls.setter + def image_urls(self, image_urls): + """Sets the image_urls of this TenantSolutionTemplateDetails. + + + :param image_urls: The image_urls of this TenantSolutionTemplateDetails. # noqa: E501 + :type: list[str] + """ + + self._image_urls = image_urls + + @property + def installed(self): + """Gets the installed of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The installed of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: bool + """ + return self._installed + + @installed.setter + def installed(self, installed): + """Sets the installed of this TenantSolutionTemplateDetails. + + + :param installed: The installed of this TenantSolutionTemplateDetails. # noqa: E501 + :type: bool + """ + + self._installed = installed + + @property + def id(self): + """Gets the id of this TenantSolutionTemplateDetails. # noqa: E501 + + ID of the solution template # noqa: E501 + + :return: The id of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantSolutionTemplateDetails. + + ID of the solution template # noqa: E501 + + :param id: The id of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this TenantSolutionTemplateDetails. # noqa: E501 + + Template Title # noqa: E501 + + :return: The title of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TenantSolutionTemplateDetails. + + Template Title # noqa: E501 + + :param title: The title of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def level(self): + """Gets the level of this TenantSolutionTemplateDetails. # noqa: E501 + + Level of the subscription that is required to unlock the template # noqa: E501 + + :return: The level of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._level + + @level.setter + def level(self, level): + """Sets the level of this TenantSolutionTemplateDetails. + + Level of the subscription that is required to unlock the template # noqa: E501 + + :param level: The level of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + allowed_values = ["MAKER", "PROTOTYPE", "STARTUP"] # noqa: E501 + if level not in allowed_values: + raise ValueError( + "Invalid value for `level` ({0}), must be one of {1}" # noqa: E501 + .format(level, allowed_values) + ) + + self._level = level + + @property + def install_timeout_ms(self): + """Gets the install_timeout_ms of this TenantSolutionTemplateDetails. # noqa: E501 + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :return: The install_timeout_ms of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: int + """ + return self._install_timeout_ms + + @install_timeout_ms.setter + def install_timeout_ms(self, install_timeout_ms): + """Sets the install_timeout_ms of this TenantSolutionTemplateDetails. + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :param install_timeout_ms: The install_timeout_ms of this TenantSolutionTemplateDetails. # noqa: E501 + :type: int + """ + + self._install_timeout_ms = install_timeout_ms + + @property + def tenant_telemetry_keys(self): + """Gets the tenant_telemetry_keys of this TenantSolutionTemplateDetails. # noqa: E501 + + What keys to delete during template uninstall # noqa: E501 + + :return: The tenant_telemetry_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_telemetry_keys + + @tenant_telemetry_keys.setter + def tenant_telemetry_keys(self, tenant_telemetry_keys): + """Sets the tenant_telemetry_keys of this TenantSolutionTemplateDetails. + + What keys to delete during template uninstall # noqa: E501 + + :param tenant_telemetry_keys: The tenant_telemetry_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :type: list[str] + """ + + self._tenant_telemetry_keys = tenant_telemetry_keys + + @property + def tenant_attribute_keys(self): + """Gets the tenant_attribute_keys of this TenantSolutionTemplateDetails. # noqa: E501 + + What attributes to delete during template uninstall # noqa: E501 + + :return: The tenant_attribute_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_attribute_keys + + @tenant_attribute_keys.setter + def tenant_attribute_keys(self, tenant_attribute_keys): + """Sets the tenant_attribute_keys of this TenantSolutionTemplateDetails. + + What attributes to delete during template uninstall # noqa: E501 + + :param tenant_attribute_keys: The tenant_attribute_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :type: list[str] + """ + + self._tenant_attribute_keys = tenant_attribute_keys + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantSolutionTemplateDetails, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantSolutionTemplateDetails): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_info.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_info.py new file mode 100644 index 0000000..e48998b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_info.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantSolutionTemplateInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'level': 'str', + 'install_timeout_ms': 'int', + 'tenant_telemetry_keys': 'list[str]', + 'tenant_attribute_keys': 'list[str]', + 'preview_image_url': 'str', + 'short_description': 'str', + 'installed': 'bool', + 'video_preview_image_url': 'str', + 'preview_mp4_url': 'str', + 'preview_webm_url': 'str' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'level': 'level', + 'install_timeout_ms': 'installTimeoutMs', + 'tenant_telemetry_keys': 'tenantTelemetryKeys', + 'tenant_attribute_keys': 'tenantAttributeKeys', + 'preview_image_url': 'previewImageUrl', + 'short_description': 'shortDescription', + 'installed': 'installed', + 'video_preview_image_url': 'videoPreviewImageUrl', + 'preview_mp4_url': 'previewMp4Url', + 'preview_webm_url': 'previewWebmUrl' + } + + def __init__(self, id=None, title=None, level=None, install_timeout_ms=None, tenant_telemetry_keys=None, tenant_attribute_keys=None, preview_image_url=None, short_description=None, installed=None, video_preview_image_url=None, preview_mp4_url=None, preview_webm_url=None): # noqa: E501 + """TenantSolutionTemplateInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._level = None + self._install_timeout_ms = None + self._tenant_telemetry_keys = None + self._tenant_attribute_keys = None + self._preview_image_url = None + self._short_description = None + self._installed = None + self._video_preview_image_url = None + self._preview_mp4_url = None + self._preview_webm_url = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if level is not None: + self.level = level + if install_timeout_ms is not None: + self.install_timeout_ms = install_timeout_ms + if tenant_telemetry_keys is not None: + self.tenant_telemetry_keys = tenant_telemetry_keys + if tenant_attribute_keys is not None: + self.tenant_attribute_keys = tenant_attribute_keys + if preview_image_url is not None: + self.preview_image_url = preview_image_url + if short_description is not None: + self.short_description = short_description + if installed is not None: + self.installed = installed + if video_preview_image_url is not None: + self.video_preview_image_url = video_preview_image_url + if preview_mp4_url is not None: + self.preview_mp4_url = preview_mp4_url + if preview_webm_url is not None: + self.preview_webm_url = preview_webm_url + + @property + def id(self): + """Gets the id of this TenantSolutionTemplateInfo. # noqa: E501 + + ID of the solution template # noqa: E501 + + :return: The id of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantSolutionTemplateInfo. + + ID of the solution template # noqa: E501 + + :param id: The id of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this TenantSolutionTemplateInfo. # noqa: E501 + + Template Title # noqa: E501 + + :return: The title of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TenantSolutionTemplateInfo. + + Template Title # noqa: E501 + + :param title: The title of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def level(self): + """Gets the level of this TenantSolutionTemplateInfo. # noqa: E501 + + Level of the subscription that is required to unlock the template # noqa: E501 + + :return: The level of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._level + + @level.setter + def level(self, level): + """Sets the level of this TenantSolutionTemplateInfo. + + Level of the subscription that is required to unlock the template # noqa: E501 + + :param level: The level of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + allowed_values = ["MAKER", "PROTOTYPE", "STARTUP"] # noqa: E501 + if level not in allowed_values: + raise ValueError( + "Invalid value for `level` ({0}), must be one of {1}" # noqa: E501 + .format(level, allowed_values) + ) + + self._level = level + + @property + def install_timeout_ms(self): + """Gets the install_timeout_ms of this TenantSolutionTemplateInfo. # noqa: E501 + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :return: The install_timeout_ms of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: int + """ + return self._install_timeout_ms + + @install_timeout_ms.setter + def install_timeout_ms(self, install_timeout_ms): + """Sets the install_timeout_ms of this TenantSolutionTemplateInfo. + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :param install_timeout_ms: The install_timeout_ms of this TenantSolutionTemplateInfo. # noqa: E501 + :type: int + """ + + self._install_timeout_ms = install_timeout_ms + + @property + def tenant_telemetry_keys(self): + """Gets the tenant_telemetry_keys of this TenantSolutionTemplateInfo. # noqa: E501 + + What keys to delete during template uninstall # noqa: E501 + + :return: The tenant_telemetry_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_telemetry_keys + + @tenant_telemetry_keys.setter + def tenant_telemetry_keys(self, tenant_telemetry_keys): + """Sets the tenant_telemetry_keys of this TenantSolutionTemplateInfo. + + What keys to delete during template uninstall # noqa: E501 + + :param tenant_telemetry_keys: The tenant_telemetry_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :type: list[str] + """ + + self._tenant_telemetry_keys = tenant_telemetry_keys + + @property + def tenant_attribute_keys(self): + """Gets the tenant_attribute_keys of this TenantSolutionTemplateInfo. # noqa: E501 + + What attributes to delete during template uninstall # noqa: E501 + + :return: The tenant_attribute_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_attribute_keys + + @tenant_attribute_keys.setter + def tenant_attribute_keys(self, tenant_attribute_keys): + """Sets the tenant_attribute_keys of this TenantSolutionTemplateInfo. + + What attributes to delete during template uninstall # noqa: E501 + + :param tenant_attribute_keys: The tenant_attribute_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :type: list[str] + """ + + self._tenant_attribute_keys = tenant_attribute_keys + + @property + def preview_image_url(self): + """Gets the preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + + URL of the preview image # noqa: E501 + + :return: The preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._preview_image_url + + @preview_image_url.setter + def preview_image_url(self, preview_image_url): + """Sets the preview_image_url of this TenantSolutionTemplateInfo. + + URL of the preview image # noqa: E501 + + :param preview_image_url: The preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._preview_image_url = preview_image_url + + @property + def short_description(self): + """Gets the short_description of this TenantSolutionTemplateInfo. # noqa: E501 + + Short description to display on template card # noqa: E501 + + :return: The short_description of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._short_description + + @short_description.setter + def short_description(self, short_description): + """Sets the short_description of this TenantSolutionTemplateInfo. + + Short description to display on template card # noqa: E501 + + :param short_description: The short_description of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._short_description = short_description + + @property + def installed(self): + """Gets the installed of this TenantSolutionTemplateInfo. # noqa: E501 + + Indicates that template is already installed for the current tenant # noqa: E501 + + :return: The installed of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: bool + """ + return self._installed + + @installed.setter + def installed(self, installed): + """Sets the installed of this TenantSolutionTemplateInfo. + + Indicates that template is already installed for the current tenant # noqa: E501 + + :param installed: The installed of this TenantSolutionTemplateInfo. # noqa: E501 + :type: bool + """ + + self._installed = installed + + @property + def video_preview_image_url(self): + """Gets the video_preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + + Video preview image URL # noqa: E501 + + :return: The video_preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._video_preview_image_url + + @video_preview_image_url.setter + def video_preview_image_url(self, video_preview_image_url): + """Sets the video_preview_image_url of this TenantSolutionTemplateInfo. + + Video preview image URL # noqa: E501 + + :param video_preview_image_url: The video_preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._video_preview_image_url = video_preview_image_url + + @property + def preview_mp4_url(self): + """Gets the preview_mp4_url of this TenantSolutionTemplateInfo. # noqa: E501 + + Video MP4 URL # noqa: E501 + + :return: The preview_mp4_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._preview_mp4_url + + @preview_mp4_url.setter + def preview_mp4_url(self, preview_mp4_url): + """Sets the preview_mp4_url of this TenantSolutionTemplateInfo. + + Video MP4 URL # noqa: E501 + + :param preview_mp4_url: The preview_mp4_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._preview_mp4_url = preview_mp4_url + + @property + def preview_webm_url(self): + """Gets the preview_webm_url of this TenantSolutionTemplateInfo. # noqa: E501 + + Video WEBM URL # noqa: E501 + + :return: The preview_webm_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._preview_webm_url + + @preview_webm_url.setter + def preview_webm_url(self, preview_webm_url): + """Sets the preview_webm_url of this TenantSolutionTemplateInfo. + + Video WEBM URL # noqa: E501 + + :param preview_webm_url: The preview_webm_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._preview_webm_url = preview_webm_url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantSolutionTemplateInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantSolutionTemplateInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_instructions.py b/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_instructions.py new file mode 100644 index 0000000..8c8169e --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/tenant_solution_template_instructions.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantSolutionTemplateInstructions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dashboard_group_id': 'EntityGroupId', + 'dashboard_id': 'DashboardId', + 'public_id': 'CustomerId', + 'main_dashboard_public': 'bool', + 'details': 'str' + } + + attribute_map = { + 'dashboard_group_id': 'dashboardGroupId', + 'dashboard_id': 'dashboardId', + 'public_id': 'publicId', + 'main_dashboard_public': 'mainDashboardPublic', + 'details': 'details' + } + + def __init__(self, dashboard_group_id=None, dashboard_id=None, public_id=None, main_dashboard_public=None, details=None): # noqa: E501 + """TenantSolutionTemplateInstructions - a model defined in Swagger""" # noqa: E501 + self._dashboard_group_id = None + self._dashboard_id = None + self._public_id = None + self._main_dashboard_public = None + self._details = None + self.discriminator = None + if dashboard_group_id is not None: + self.dashboard_group_id = dashboard_group_id + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if public_id is not None: + self.public_id = public_id + if main_dashboard_public is not None: + self.main_dashboard_public = main_dashboard_public + if details is not None: + self.details = details + + @property + def dashboard_group_id(self): + """Gets the dashboard_group_id of this TenantSolutionTemplateInstructions. # noqa: E501 + + + :return: The dashboard_group_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: EntityGroupId + """ + return self._dashboard_group_id + + @dashboard_group_id.setter + def dashboard_group_id(self, dashboard_group_id): + """Sets the dashboard_group_id of this TenantSolutionTemplateInstructions. + + + :param dashboard_group_id: The dashboard_group_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: EntityGroupId + """ + + self._dashboard_group_id = dashboard_group_id + + @property + def dashboard_id(self): + """Gets the dashboard_id of this TenantSolutionTemplateInstructions. # noqa: E501 + + + :return: The dashboard_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this TenantSolutionTemplateInstructions. + + + :param dashboard_id: The dashboard_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + @property + def public_id(self): + """Gets the public_id of this TenantSolutionTemplateInstructions. # noqa: E501 + + + :return: The public_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: CustomerId + """ + return self._public_id + + @public_id.setter + def public_id(self, public_id): + """Sets the public_id of this TenantSolutionTemplateInstructions. + + + :param public_id: The public_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: CustomerId + """ + + self._public_id = public_id + + @property + def main_dashboard_public(self): + """Gets the main_dashboard_public of this TenantSolutionTemplateInstructions. # noqa: E501 + + Is the main dashboard public # noqa: E501 + + :return: The main_dashboard_public of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: bool + """ + return self._main_dashboard_public + + @main_dashboard_public.setter + def main_dashboard_public(self, main_dashboard_public): + """Sets the main_dashboard_public of this TenantSolutionTemplateInstructions. + + Is the main dashboard public # noqa: E501 + + :param main_dashboard_public: The main_dashboard_public of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: bool + """ + + self._main_dashboard_public = main_dashboard_public + + @property + def details(self): + """Gets the details of this TenantSolutionTemplateInstructions. # noqa: E501 + + Markdown with solution usage instructions # noqa: E501 + + :return: The details of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: str + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this TenantSolutionTemplateInstructions. + + Markdown with solution usage instructions # noqa: E501 + + :param details: The details of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: str + """ + + self._details = details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantSolutionTemplateInstructions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantSolutionTemplateInstructions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/test_sms_request.py b/billinglayer/python/tb_rest_client/models/models_pe/test_sms_request.py new file mode 100644 index 0000000..5be2ec1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/test_sms_request.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TestSmsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provider_configuration': 'SmsProviderConfiguration', + 'number_to': 'str', + 'message': 'str' + } + + attribute_map = { + 'provider_configuration': 'providerConfiguration', + 'number_to': 'numberTo', + 'message': 'message' + } + + def __init__(self, provider_configuration=None, number_to=None, message=None): # noqa: E501 + """TestSmsRequest - a model defined in Swagger""" # noqa: E501 + self._provider_configuration = None + self._number_to = None + self._message = None + self.discriminator = None + if provider_configuration is not None: + self.provider_configuration = provider_configuration + if number_to is not None: + self.number_to = number_to + if message is not None: + self.message = message + + @property + def provider_configuration(self): + """Gets the provider_configuration of this TestSmsRequest. # noqa: E501 + + + :return: The provider_configuration of this TestSmsRequest. # noqa: E501 + :rtype: SmsProviderConfiguration + """ + return self._provider_configuration + + @provider_configuration.setter + def provider_configuration(self, provider_configuration): + """Sets the provider_configuration of this TestSmsRequest. + + + :param provider_configuration: The provider_configuration of this TestSmsRequest. # noqa: E501 + :type: SmsProviderConfiguration + """ + + self._provider_configuration = provider_configuration + + @property + def number_to(self): + """Gets the number_to of this TestSmsRequest. # noqa: E501 + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :return: The number_to of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._number_to + + @number_to.setter + def number_to(self, number_to): + """Sets the number_to of this TestSmsRequest. + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :param number_to: The number_to of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._number_to = number_to + + @property + def message(self): + """Gets the message of this TestSmsRequest. # noqa: E501 + + The test message # noqa: E501 + + :return: The message of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this TestSmsRequest. + + The test message # noqa: E501 + + :param message: The message of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TestSmsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TestSmsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/thingsboard_credentials_expired_response.py b/billinglayer/python/tb_rest_client/models/models_pe/thingsboard_credentials_expired_response.py new file mode 100644 index 0000000..8203161 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/thingsboard_credentials_expired_response.py @@ -0,0 +1,238 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardCredentialsExpiredResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime', + 'reset_token': 'str' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp', + 'reset_token': 'resetToken' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None, reset_token=None): # noqa: E501 + """ThingsboardCredentialsExpiredResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self._reset_token = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + if reset_token is not None: + self.reset_token = reset_token + + @property + def status(self): + """Gets the status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardCredentialsExpiredResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardCredentialsExpiredResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardCredentialsExpiredResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardCredentialsExpiredResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + @property + def reset_token(self): + """Gets the reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Password reset token # noqa: E501 + + :return: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ThingsboardCredentialsExpiredResponse. + + Password reset token # noqa: E501 + + :param reset_token: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardCredentialsExpiredResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardCredentialsExpiredResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/thingsboard_error_response.py b/billinglayer/python/tb_rest_client/models/models_pe/thingsboard_error_response.py new file mode 100644 index 0000000..6466951 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/thingsboard_error_response.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardErrorResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None): # noqa: E501 + """ThingsboardErrorResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + + @property + def status(self): + """Gets the status of this ThingsboardErrorResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardErrorResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardErrorResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardErrorResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardErrorResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardErrorResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardErrorResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardErrorResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardErrorResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardErrorResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardErrorResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardErrorResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardErrorResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardErrorResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/to_device_rpc_request_snmp_communication_config.py b/billinglayer/python/tb_rest_client/models/models_pe/to_device_rpc_request_snmp_communication_config.py new file mode 100644 index 0000000..5715783 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/to_device_rpc_request_snmp_communication_config.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ToDeviceRpcRequestSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + + def __init__(self, mappings=None, spec=None): # noqa: E501 + """ToDeviceRpcRequestSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param mappings: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param spec: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ToDeviceRpcRequestSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ToDeviceRpcRequestSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/totp_two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_pe/totp_two_fa_account_config.py new file mode 100644 index 0000000..fc97a60 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/totp_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_url': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'auth_url': 'authUrl', + 'use_by_default': 'useByDefault' + } + + def __init__(self, auth_url=None, use_by_default=None): # noqa: E501 + """TotpTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._auth_url = None + self._use_by_default = None + self.discriminator = None + self.auth_url = auth_url + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def auth_url(self): + """Gets the auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._auth_url + + @auth_url.setter + def auth_url(self, auth_url): + """Sets the auth_url of this TotpTwoFaAccountConfig. + + + :param auth_url: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if auth_url is None: + raise ValueError("Invalid value for `auth_url`, must not be `None`") # noqa: E501 + + self._auth_url = auth_url + + @property + def use_by_default(self): + """Gets the use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TotpTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/totp_two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_pe/totp_two_fa_provider_config.py new file mode 100644 index 0000000..9a7d2e0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/totp_two_fa_provider_config.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'issuer_name': 'str' + } + + attribute_map = { + 'issuer_name': 'issuerName' + } + + def __init__(self, issuer_name=None): # noqa: E501 + """TotpTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._issuer_name = None + self.discriminator = None + self.issuer_name = issuer_name + + @property + def issuer_name(self): + """Gets the issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + + + :return: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._issuer_name + + @issuer_name.setter + def issuer_name(self, issuer_name): + """Sets the issuer_name of this TotpTwoFaProviderConfig. + + + :param issuer_name: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if issuer_name is None: + raise ValueError("Invalid value for `issuer_name`, must not be `None`") # noqa: E501 + + self._issuer_name = issuer_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/transport_payload_type_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/transport_payload_type_configuration.py new file mode 100644 index 0000000..2581ed6 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/transport_payload_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TransportPayloadTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TransportPayloadTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TransportPayloadTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TransportPayloadTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/ts_value.py b/billinglayer/python/tb_rest_client/models/models_pe/ts_value.py new file mode 100644 index 0000000..0aacd09 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/ts_value.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'count': 'int', + 'ts': 'int', + 'value': 'str' + } + + attribute_map = { + 'count': 'count', + 'ts': 'ts', + 'value': 'value' + } + + def __init__(self, count=None, ts=None, value=None): # noqa: E501 + """TsValue - a model defined in Swagger""" # noqa: E501 + self._count = None + self._ts = None + self._value = None + self.discriminator = None + if count is not None: + self.count = count + if ts is not None: + self.ts = ts + if value is not None: + self.value = value + + @property + def count(self): + """Gets the count of this TsValue. # noqa: E501 + + + :return: The count of this TsValue. # noqa: E501 + :rtype: int + """ + return self._count + + @count.setter + def count(self, count): + """Sets the count of this TsValue. + + + :param count: The count of this TsValue. # noqa: E501 + :type: int + """ + + self._count = count + + @property + def ts(self): + """Gets the ts of this TsValue. # noqa: E501 + + + :return: The ts of this TsValue. # noqa: E501 + :rtype: int + """ + return self._ts + + @ts.setter + def ts(self, ts): + """Sets the ts of this TsValue. + + + :param ts: The ts of this TsValue. # noqa: E501 + :type: int + """ + + self._ts = ts + + @property + def value(self): + """Gets the value of this TsValue. # noqa: E501 + + + :return: The value of this TsValue. # noqa: E501 + :rtype: str + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this TsValue. + + + :param value: The value of this TsValue. # noqa: E501 + :type: str + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/twilio_sms_provider_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/twilio_sms_provider_configuration.py new file mode 100644 index 0000000..93b199a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/twilio_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class TwilioSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'account_sid': 'str', + 'account_token': 'str', + 'number_from': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'account_sid': 'accountSid', + 'account_token': 'accountToken', + 'number_from': 'numberFrom' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, account_sid=None, account_token=None, number_from=None, *args, **kwargs): # noqa: E501 + """TwilioSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._account_sid = None + self._account_token = None + self._number_from = None + self.discriminator = None + if account_sid is not None: + self.account_sid = account_sid + if account_token is not None: + self.account_token = account_token + if number_from is not None: + self.number_from = number_from + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def account_sid(self): + """Gets the account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Sid. # noqa: E501 + + :return: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_sid + + @account_sid.setter + def account_sid(self, account_sid): + """Sets the account_sid of this TwilioSmsProviderConfiguration. + + Twilio account Sid. # noqa: E501 + + :param account_sid: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_sid = account_sid + + @property + def account_token(self): + """Gets the account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Token. # noqa: E501 + + :return: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_token + + @account_token.setter + def account_token(self, account_token): + """Sets the account_token of this TwilioSmsProviderConfiguration. + + Twilio account Token. # noqa: E501 + + :param account_token: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_token = account_token + + @property + def number_from(self): + """Gets the number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + + The number/id of a sender. # noqa: E501 + + :return: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._number_from + + @number_from.setter + def number_from(self, number_from): + """Sets the number_from of this TwilioSmsProviderConfiguration. + + The number/id of a sender. # noqa: E501 + + :param number_from: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._number_from = number_from + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwilioSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwilioSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/two_fa_account_config.py b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_account_config.py new file mode 100644 index 0000000..3f122d3 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_account_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/two_fa_account_config_update_request.py b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_account_config_update_request.py new file mode 100644 index 0000000..38c98b1 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_account_config_update_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfigUpdateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfigUpdateRequest - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfigUpdateRequest. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfigUpdateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfigUpdateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/two_fa_provider_config.py b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_provider_config.py new file mode 100644 index 0000000..d94f428 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_provider_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/two_fa_provider_info.py b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_provider_info.py new file mode 100644 index 0000000..3628b32 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/two_fa_provider_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'contact': 'str', + 'default': 'bool', + 'min_verification_code_send_period': 'int', + 'type': 'str' + } + + attribute_map = { + 'contact': 'contact', + 'default': 'default', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'type': 'type' + } + + def __init__(self, contact=None, default=None, min_verification_code_send_period=None, type=None): # noqa: E501 + """TwoFaProviderInfo - a model defined in Swagger""" # noqa: E501 + self._contact = None + self._default = None + self._min_verification_code_send_period = None + self._type = None + self.discriminator = None + if contact is not None: + self.contact = contact + if default is not None: + self.default = default + if min_verification_code_send_period is not None: + self.min_verification_code_send_period = min_verification_code_send_period + if type is not None: + self.type = type + + @property + def contact(self): + """Gets the contact of this TwoFaProviderInfo. # noqa: E501 + + + :return: The contact of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._contact + + @contact.setter + def contact(self, contact): + """Sets the contact of this TwoFaProviderInfo. + + + :param contact: The contact of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + + self._contact = contact + + @property + def default(self): + """Gets the default of this TwoFaProviderInfo. # noqa: E501 + + + :return: The default of this TwoFaProviderInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this TwoFaProviderInfo. + + + :param default: The default of this TwoFaProviderInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + + + :return: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this TwoFaProviderInfo. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :type: int + """ + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def type(self): + """Gets the type of this TwoFaProviderInfo. # noqa: E501 + + + :return: The type of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this TwoFaProviderInfo. + + + :param type: The type of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + allowed_values = ["BACKUP_CODE", "EMAIL", "SMS", "TOTP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/update_message.py b/billinglayer/python/tb_rest_client/models/models_pe/update_message.py new file mode 100644 index 0000000..0aad87d --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/update_message.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UpdateMessage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'update_available': 'bool', + 'current_version': 'str', + 'latest_version': 'str', + 'upgrade_instructions_url': 'str', + 'current_version_release_notes_url': 'str', + 'latest_version_release_notes_url': 'str' + } + + attribute_map = { + 'update_available': 'updateAvailable', + 'current_version': 'currentVersion', + 'latest_version': 'latestVersion', + 'upgrade_instructions_url': 'upgradeInstructionsUrl', + 'current_version_release_notes_url': 'currentVersionReleaseNotesUrl', + 'latest_version_release_notes_url': 'latestVersionReleaseNotesUrl' + } + + def __init__(self, update_available=None, current_version=None, latest_version=None, upgrade_instructions_url=None, current_version_release_notes_url=None, latest_version_release_notes_url=None): # noqa: E501 + """UpdateMessage - a model defined in Swagger""" # noqa: E501 + self._update_available = None + self._current_version = None + self._latest_version = None + self._upgrade_instructions_url = None + self._current_version_release_notes_url = None + self._latest_version_release_notes_url = None + self.discriminator = None + if update_available is not None: + self.update_available = update_available + if current_version is not None: + self.current_version = current_version + if latest_version is not None: + self.latest_version = latest_version + if upgrade_instructions_url is not None: + self.upgrade_instructions_url = upgrade_instructions_url + if current_version_release_notes_url is not None: + self.current_version_release_notes_url = current_version_release_notes_url + if latest_version_release_notes_url is not None: + self.latest_version_release_notes_url = latest_version_release_notes_url + + @property + def update_available(self): + """Gets the update_available of this UpdateMessage. # noqa: E501 + + 'True' if new platform update is available. # noqa: E501 + + :return: The update_available of this UpdateMessage. # noqa: E501 + :rtype: bool + """ + return self._update_available + + @update_available.setter + def update_available(self, update_available): + """Sets the update_available of this UpdateMessage. + + 'True' if new platform update is available. # noqa: E501 + + :param update_available: The update_available of this UpdateMessage. # noqa: E501 + :type: bool + """ + + self._update_available = update_available + + @property + def current_version(self): + """Gets the current_version of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version. # noqa: E501 + + :return: The current_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this UpdateMessage. + + Current ThingsBoard version. # noqa: E501 + + :param current_version: The current_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version = current_version + + @property + def latest_version(self): + """Gets the latest_version of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version. # noqa: E501 + + :return: The latest_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version + + @latest_version.setter + def latest_version(self, latest_version): + """Sets the latest_version of this UpdateMessage. + + Latest ThingsBoard version. # noqa: E501 + + :param latest_version: The latest_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version = latest_version + + @property + def upgrade_instructions_url(self): + """Gets the upgrade_instructions_url of this UpdateMessage. # noqa: E501 + + Upgrade instructions URL. # noqa: E501 + + :return: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._upgrade_instructions_url + + @upgrade_instructions_url.setter + def upgrade_instructions_url(self, upgrade_instructions_url): + """Sets the upgrade_instructions_url of this UpdateMessage. + + Upgrade instructions URL. # noqa: E501 + + :param upgrade_instructions_url: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._upgrade_instructions_url = upgrade_instructions_url + + @property + def current_version_release_notes_url(self): + """Gets the current_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version release notes URL. # noqa: E501 + + :return: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version_release_notes_url + + @current_version_release_notes_url.setter + def current_version_release_notes_url(self, current_version_release_notes_url): + """Sets the current_version_release_notes_url of this UpdateMessage. + + Current ThingsBoard version release notes URL. # noqa: E501 + + :param current_version_release_notes_url: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version_release_notes_url = current_version_release_notes_url + + @property + def latest_version_release_notes_url(self): + """Gets the latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :return: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version_release_notes_url + + @latest_version_release_notes_url.setter + def latest_version_release_notes_url(self, latest_version_release_notes_url): + """Sets the latest_version_release_notes_url of this UpdateMessage. + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :param latest_version_release_notes_url: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version_release_notes_url = latest_version_release_notes_url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UpdateMessage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UpdateMessage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user.py b/billinglayer/python/tb_rest_client/models/models_pe/user.py new file mode 100644 index 0000000..03fa28b --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class User(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'email': 'str', + 'name': 'str', + 'authority': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'phone': 'str', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'email': 'email', + 'name': 'name', + 'authority': 'authority', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'phone': 'phone', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, email=None, name=None, authority=None, first_name=None, last_name=None, phone=None, additional_info=None, owner_id=None): # noqa: E501 + """User - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._email = None + self._name = None + self._authority = None + self._first_name = None + self._last_name = None + self._phone = None + self._additional_info = None + self._owner_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.email = email + if name is not None: + self.name = name + self.authority = authority + self.first_name = first_name + self.last_name = last_name + self.phone = phone + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this User. # noqa: E501 + + + :return: The id of this User. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + + :param id: The id of this User. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this User. # noqa: E501 + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :return: The created_time of this User. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this User. + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this User. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this User. # noqa: E501 + + + :return: The tenant_id of this User. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this User. + + + :param tenant_id: The tenant_id of this User. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this User. # noqa: E501 + + + :return: The customer_id of this User. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this User. + + + :param customer_id: The customer_id of this User. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def email(self): + """Gets the email of this User. # noqa: E501 + + Email of the user # noqa: E501 + + :return: The email of this User. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this User. + + Email of the user # noqa: E501 + + :param email: The email of this User. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def name(self): + """Gets the name of this User. # noqa: E501 + + Duplicates the email of the user, readonly # noqa: E501 + + :return: The name of this User. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this User. + + Duplicates the email of the user, readonly # noqa: E501 + + :param name: The name of this User. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def authority(self): + """Gets the authority of this User. # noqa: E501 + + Authority # noqa: E501 + + :return: The authority of this User. # noqa: E501 + :rtype: str + """ + return self._authority + + @authority.setter + def authority(self, authority): + """Sets the authority of this User. + + Authority # noqa: E501 + + :param authority: The authority of this User. # noqa: E501 + :type: str + """ + if authority is None: + raise ValueError("Invalid value for `authority`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if authority not in allowed_values: + raise ValueError( + "Invalid value for `authority` ({0}), must be one of {1}" # noqa: E501 + .format(authority, allowed_values) + ) + + self._authority = authority + + @property + def first_name(self): + """Gets the first_name of this User. # noqa: E501 + + First name of the user # noqa: E501 + + :return: The first_name of this User. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + First name of the user # noqa: E501 + + :param first_name: The first_name of this User. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. # noqa: E501 + + Last name of the user # noqa: E501 + + :return: The last_name of this User. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + Last name of the user # noqa: E501 + + :param last_name: The last_name of this User. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def phone(self): + """Gets the phone of this User. # noqa: E501 + + Phone number of the user # noqa: E501 + + :return: The phone of this User. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this User. + + Phone number of the user # noqa: E501 + + :param phone: The phone of this User. # noqa: E501 + :type: str + """ + # if phone is None: + # raise ValueError("Invalid value for `phone`, must not be `None`") # noqa: E501 + + self._phone = phone + + @property + def additional_info(self): + """Gets the additional_info of this User. # noqa: E501 + + + :return: The additional_info of this User. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this User. + + + :param additional_info: The additional_info of this User. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this User. # noqa: E501 + + + :return: The owner_id of this User. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this User. + + + :param owner_id: The owner_id of this User. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(User, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, User): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_dashboards_info.py b/billinglayer/python/tb_rest_client/models/models_pe/user_dashboards_info.py new file mode 100644 index 0000000..7a08fb4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_dashboards_info.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserDashboardsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'last': 'list[LastVisitedDashboardInfo]', + 'starred': 'list[StarredDashboardInfo]' + } + + attribute_map = { + 'last': 'last', + 'starred': 'starred' + } + + def __init__(self, last=None, starred=None): # noqa: E501 + """UserDashboardsInfo - a model defined in Swagger""" # noqa: E501 + self._last = None + self._starred = None + self.discriminator = None + if last is not None: + self.last = last + if starred is not None: + self.starred = starred + + @property + def last(self): + """Gets the last of this UserDashboardsInfo. # noqa: E501 + + List of last visited dashboards. # noqa: E501 + + :return: The last of this UserDashboardsInfo. # noqa: E501 + :rtype: list[LastVisitedDashboardInfo] + """ + return self._last + + @last.setter + def last(self, last): + """Sets the last of this UserDashboardsInfo. + + List of last visited dashboards. # noqa: E501 + + :param last: The last of this UserDashboardsInfo. # noqa: E501 + :type: list[LastVisitedDashboardInfo] + """ + + self._last = last + + @property + def starred(self): + """Gets the starred of this UserDashboardsInfo. # noqa: E501 + + List of starred dashboards. # noqa: E501 + + :return: The starred of this UserDashboardsInfo. # noqa: E501 + :rtype: list[StarredDashboardInfo] + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this UserDashboardsInfo. + + List of starred dashboards. # noqa: E501 + + :param starred: The starred of this UserDashboardsInfo. # noqa: E501 + :type: list[StarredDashboardInfo] + """ + + self._starred = starred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserDashboardsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserDashboardsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_email_info.py b/billinglayer/python/tb_rest_client/models/models_pe/user_email_info.py new file mode 100644 index 0000000..efa2db7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_email_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, email=None, first_name=None, last_name=None): # noqa: E501 + """UserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this UserEmailInfo. # noqa: E501 + + + :return: The id of this UserEmailInfo. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserEmailInfo. + + + :param id: The id of this UserEmailInfo. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def email(self): + """Gets the email of this UserEmailInfo. # noqa: E501 + + User email # noqa: E501 + + :return: The email of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this UserEmailInfo. + + User email # noqa: E501 + + :param email: The email of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this UserEmailInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this UserEmailInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this UserEmailInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this UserEmailInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_group_list_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/user_group_list_filter.py new file mode 100644 index 0000000..0ba91dc --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_group_list_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class UserGroupListFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'groups_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'groups_ids': 'groupsIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, groups_ids=None, *args, **kwargs): # noqa: E501 + """UserGroupListFilter - a model defined in Swagger""" # noqa: E501 + self._groups_ids = None + self.discriminator = None + if groups_ids is not None: + self.groups_ids = groups_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def groups_ids(self): + """Gets the groups_ids of this UserGroupListFilter. # noqa: E501 + + + :return: The groups_ids of this UserGroupListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._groups_ids + + @groups_ids.setter + def groups_ids(self, groups_ids): + """Sets the groups_ids of this UserGroupListFilter. + + + :param groups_ids: The groups_ids of this UserGroupListFilter. # noqa: E501 + :type: list[str] + """ + + self._groups_ids = groups_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserGroupListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserGroupListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_id.py b/billinglayer/python/tb_rest_client/models/models_pe/user_id.py new file mode 100644 index 0000000..594add0 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """UserId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this UserId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this UserId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this UserId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this UserId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this UserId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this UserId. + + string # noqa: E501 + + :param entity_type: The entity_type of this UserId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["USER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_info.py b/billinglayer/python/tb_rest_client/models/models_pe/user_info.py new file mode 100644 index 0000000..840f5f4 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_info.py @@ -0,0 +1,483 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'email': 'str', + 'name': 'str', + 'authority': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'phone': 'str', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'email': 'email', + 'name': 'name', + 'authority': 'authority', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'phone': 'phone', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, email=None, name=None, authority=None, first_name=None, last_name=None, phone=None, additional_info=None, owner_id=None, owner_name=None, groups=None): # noqa: E501 + """UserInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._email = None + self._name = None + self._authority = None + self._first_name = None + self._last_name = None + self._phone = None + self._additional_info = None + self._owner_id = None + self._owner_name = None + self._groups = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.email = email + if name is not None: + self.name = name + self.authority = authority + self.first_name = first_name + self.last_name = last_name + self.phone = phone + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this UserInfo. # noqa: E501 + + + :return: The id of this UserInfo. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserInfo. + + + :param id: The id of this UserInfo. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this UserInfo. # noqa: E501 + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :return: The created_time of this UserInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this UserInfo. + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this UserInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this UserInfo. # noqa: E501 + + + :return: The tenant_id of this UserInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this UserInfo. + + + :param tenant_id: The tenant_id of this UserInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this UserInfo. # noqa: E501 + + + :return: The customer_id of this UserInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this UserInfo. + + + :param customer_id: The customer_id of this UserInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def email(self): + """Gets the email of this UserInfo. # noqa: E501 + + Email of the user # noqa: E501 + + :return: The email of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this UserInfo. + + Email of the user # noqa: E501 + + :param email: The email of this UserInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def name(self): + """Gets the name of this UserInfo. # noqa: E501 + + Duplicates the email of the user, readonly # noqa: E501 + + :return: The name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this UserInfo. + + Duplicates the email of the user, readonly # noqa: E501 + + :param name: The name of this UserInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def authority(self): + """Gets the authority of this UserInfo. # noqa: E501 + + Authority # noqa: E501 + + :return: The authority of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._authority + + @authority.setter + def authority(self, authority): + """Sets the authority of this UserInfo. + + Authority # noqa: E501 + + :param authority: The authority of this UserInfo. # noqa: E501 + :type: str + """ + if authority is None: + raise ValueError("Invalid value for `authority`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if authority not in allowed_values: + raise ValueError( + "Invalid value for `authority` ({0}), must be one of {1}" # noqa: E501 + .format(authority, allowed_values) + ) + + self._authority = authority + + @property + def first_name(self): + """Gets the first_name of this UserInfo. # noqa: E501 + + First name of the user # noqa: E501 + + :return: The first_name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this UserInfo. + + First name of the user # noqa: E501 + + :param first_name: The first_name of this UserInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this UserInfo. # noqa: E501 + + Last name of the user # noqa: E501 + + :return: The last_name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this UserInfo. + + Last name of the user # noqa: E501 + + :param last_name: The last_name of this UserInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def phone(self): + """Gets the phone of this UserInfo. # noqa: E501 + + Phone number of the user # noqa: E501 + + :return: The phone of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this UserInfo. + + Phone number of the user # noqa: E501 + + :param phone: The phone of this UserInfo. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def additional_info(self): + """Gets the additional_info of this UserInfo. # noqa: E501 + + + :return: The additional_info of this UserInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this UserInfo. + + + :param additional_info: The additional_info of this UserInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this UserInfo. # noqa: E501 + + + :return: The owner_id of this UserInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this UserInfo. + + + :param owner_id: The owner_id of this UserInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def owner_name(self): + """Gets the owner_name of this UserInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this UserInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this UserInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this UserInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this UserInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this UserInfo. + + Groups # noqa: E501 + + :param groups: The groups of this UserInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_list_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/user_list_filter.py new file mode 100644 index 0000000..74207f9 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_list_filter.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserListFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'users_ids': 'list[str]' + } + + attribute_map = { + 'users_ids': 'usersIds' + } + + def __init__(self, users_ids=None): # noqa: E501 + """UserListFilter - a model defined in Swagger""" # noqa: E501 + self._users_ids = None + self.discriminator = None + if users_ids is not None: + self.users_ids = users_ids + + @property + def users_ids(self): + """Gets the users_ids of this UserListFilter. # noqa: E501 + + + :return: The users_ids of this UserListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._users_ids + + @users_ids.setter + def users_ids(self, users_ids): + """Sets the users_ids of this UserListFilter. + + + :param users_ids: The users_ids of this UserListFilter. # noqa: E501 + :type: list[str] + """ + + self._users_ids = users_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_password_policy.py b/billinglayer/python/tb_rest_client/models/models_pe/user_password_policy.py new file mode 100644 index 0000000..6558c6c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_password_policy.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserPasswordPolicy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_whitespaces': 'bool', + 'minimum_digits': 'int', + 'minimum_length': 'int', + 'minimum_lowercase_letters': 'int', + 'minimum_special_characters': 'int', + 'minimum_uppercase_letters': 'int', + 'password_expiration_period_days': 'int', + 'password_reuse_frequency_days': 'int' + } + + attribute_map = { + 'allow_whitespaces': 'allowWhitespaces', + 'minimum_digits': 'minimumDigits', + 'minimum_length': 'minimumLength', + 'minimum_lowercase_letters': 'minimumLowercaseLetters', + 'minimum_special_characters': 'minimumSpecialCharacters', + 'minimum_uppercase_letters': 'minimumUppercaseLetters', + 'password_expiration_period_days': 'passwordExpirationPeriodDays', + 'password_reuse_frequency_days': 'passwordReuseFrequencyDays' + } + + def __init__(self, allow_whitespaces=None, minimum_digits=None, minimum_length=None, minimum_lowercase_letters=None, minimum_special_characters=None, minimum_uppercase_letters=None, password_expiration_period_days=None, password_reuse_frequency_days=None): # noqa: E501 + """UserPasswordPolicy - a model defined in Swagger""" # noqa: E501 + self._allow_whitespaces = None + self._minimum_digits = None + self._minimum_length = None + self._minimum_lowercase_letters = None + self._minimum_special_characters = None + self._minimum_uppercase_letters = None + self._password_expiration_period_days = None + self._password_reuse_frequency_days = None + self.discriminator = None + if allow_whitespaces is not None: + self.allow_whitespaces = allow_whitespaces + if minimum_digits is not None: + self.minimum_digits = minimum_digits + if minimum_length is not None: + self.minimum_length = minimum_length + if minimum_lowercase_letters is not None: + self.minimum_lowercase_letters = minimum_lowercase_letters + if minimum_special_characters is not None: + self.minimum_special_characters = minimum_special_characters + if minimum_uppercase_letters is not None: + self.minimum_uppercase_letters = minimum_uppercase_letters + if password_expiration_period_days is not None: + self.password_expiration_period_days = password_expiration_period_days + if password_reuse_frequency_days is not None: + self.password_reuse_frequency_days = password_reuse_frequency_days + + @property + def allow_whitespaces(self): + """Gets the allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + + Allow whitespaces # noqa: E501 + + :return: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :rtype: bool + """ + return self._allow_whitespaces + + @allow_whitespaces.setter + def allow_whitespaces(self, allow_whitespaces): + """Sets the allow_whitespaces of this UserPasswordPolicy. + + Allow whitespaces # noqa: E501 + + :param allow_whitespaces: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :type: bool + """ + + self._allow_whitespaces = allow_whitespaces + + @property + def minimum_digits(self): + """Gets the minimum_digits of this UserPasswordPolicy. # noqa: E501 + + Minimum number of digits in the password. # noqa: E501 + + :return: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_digits + + @minimum_digits.setter + def minimum_digits(self, minimum_digits): + """Sets the minimum_digits of this UserPasswordPolicy. + + Minimum number of digits in the password. # noqa: E501 + + :param minimum_digits: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_digits = minimum_digits + + @property + def minimum_length(self): + """Gets the minimum_length of this UserPasswordPolicy. # noqa: E501 + + Minimum number of symbols in the password. # noqa: E501 + + :return: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_length + + @minimum_length.setter + def minimum_length(self, minimum_length): + """Sets the minimum_length of this UserPasswordPolicy. + + Minimum number of symbols in the password. # noqa: E501 + + :param minimum_length: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_length = minimum_length + + @property + def minimum_lowercase_letters(self): + """Gets the minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of lowercase letters in the password. # noqa: E501 + + :return: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_lowercase_letters + + @minimum_lowercase_letters.setter + def minimum_lowercase_letters(self, minimum_lowercase_letters): + """Sets the minimum_lowercase_letters of this UserPasswordPolicy. + + Minimum number of lowercase letters in the password. # noqa: E501 + + :param minimum_lowercase_letters: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_lowercase_letters = minimum_lowercase_letters + + @property + def minimum_special_characters(self): + """Gets the minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of special in the password. # noqa: E501 + + :return: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_special_characters + + @minimum_special_characters.setter + def minimum_special_characters(self, minimum_special_characters): + """Sets the minimum_special_characters of this UserPasswordPolicy. + + Minimum number of special in the password. # noqa: E501 + + :param minimum_special_characters: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_special_characters = minimum_special_characters + + @property + def minimum_uppercase_letters(self): + """Gets the minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of uppercase letters in the password. # noqa: E501 + + :return: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_uppercase_letters + + @minimum_uppercase_letters.setter + def minimum_uppercase_letters(self, minimum_uppercase_letters): + """Sets the minimum_uppercase_letters of this UserPasswordPolicy. + + Minimum number of uppercase letters in the password. # noqa: E501 + + :param minimum_uppercase_letters: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_uppercase_letters = minimum_uppercase_letters + + @property + def password_expiration_period_days(self): + """Gets the password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :return: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_expiration_period_days + + @password_expiration_period_days.setter + def password_expiration_period_days(self, password_expiration_period_days): + """Sets the password_expiration_period_days of this UserPasswordPolicy. + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :param password_expiration_period_days: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_expiration_period_days = password_expiration_period_days + + @property + def password_reuse_frequency_days(self): + """Gets the password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :return: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_reuse_frequency_days + + @password_reuse_frequency_days.setter + def password_reuse_frequency_days(self, password_reuse_frequency_days): + """Sets the password_reuse_frequency_days of this UserPasswordPolicy. + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :param password_reuse_frequency_days: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_reuse_frequency_days = password_reuse_frequency_days + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserPasswordPolicy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserPasswordPolicy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/user_role_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/user_role_filter.py new file mode 100644 index 0000000..2630604 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/user_role_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class UserRoleFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'roles_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'roles_ids': 'rolesIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, roles_ids=None, *args, **kwargs): # noqa: E501 + """UserRoleFilter - a model defined in Swagger""" # noqa: E501 + self._roles_ids = None + self.discriminator = None + if roles_ids is not None: + self.roles_ids = roles_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def roles_ids(self): + """Gets the roles_ids of this UserRoleFilter. # noqa: E501 + + + :return: The roles_ids of this UserRoleFilter. # noqa: E501 + :rtype: list[str] + """ + return self._roles_ids + + @roles_ids.setter + def roles_ids(self, roles_ids): + """Sets the roles_ids of this UserRoleFilter. + + + :param roles_ids: The roles_ids of this UserRoleFilter. # noqa: E501 + :type: list[str] + """ + + self._roles_ids = roles_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserRoleFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserRoleFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/users_filter.py b/billinglayer/python/tb_rest_client/models/models_pe/users_filter.py new file mode 100644 index 0000000..ad1e5c8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """UsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/version_create_config.py b/billinglayer/python/tb_rest_client/models/models_pe/version_create_config.py new file mode 100644 index 0000000..d04fa00 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/version_create_config.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_group_entities': 'bool', + 'save_permissions': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_group_entities': 'saveGroupEntities', + 'save_permissions': 'savePermissions', + 'save_relations': 'saveRelations' + } + + def __init__(self, save_attributes=None, save_credentials=None, save_group_entities=None, save_permissions=None, save_relations=None): # noqa: E501 + """VersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._save_attributes = None + self._save_credentials = None + self._save_group_entities = None + self._save_permissions = None + self._save_relations = None + self.discriminator = None + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_group_entities is not None: + self.save_group_entities = save_group_entities + if save_permissions is not None: + self.save_permissions = save_permissions + if save_relations is not None: + self.save_relations = save_relations + + @property + def save_attributes(self): + """Gets the save_attributes of this VersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this VersionCreateConfig. + + + :param save_attributes: The save_attributes of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this VersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this VersionCreateConfig. + + + :param save_credentials: The save_credentials of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_group_entities(self): + """Gets the save_group_entities of this VersionCreateConfig. # noqa: E501 + + + :return: The save_group_entities of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_group_entities + + @save_group_entities.setter + def save_group_entities(self, save_group_entities): + """Sets the save_group_entities of this VersionCreateConfig. + + + :param save_group_entities: The save_group_entities of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_group_entities = save_group_entities + + @property + def save_permissions(self): + """Gets the save_permissions of this VersionCreateConfig. # noqa: E501 + + + :return: The save_permissions of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_permissions + + @save_permissions.setter + def save_permissions(self, save_permissions): + """Sets the save_permissions of this VersionCreateConfig. + + + :param save_permissions: The save_permissions of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_permissions = save_permissions + + @property + def save_relations(self): + """Gets the save_relations of this VersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this VersionCreateConfig. + + + :param save_relations: The save_relations of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/version_create_request.py b/billinglayer/python/tb_rest_client/models/models_pe/version_create_request.py new file mode 100644 index 0000000..c321158 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/version_create_request.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'type': 'str', + 'version_name': 'str' + } + + attribute_map = { + 'branch': 'branch', + 'type': 'type', + 'version_name': 'versionName' + } + + def __init__(self, branch=None, type=None, version_name=None): # noqa: E501 + """VersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + + @property + def branch(self): + """Gets the branch of this VersionCreateRequest. # noqa: E501 + + + :return: The branch of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this VersionCreateRequest. + + + :param branch: The branch of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def type(self): + """Gets the type of this VersionCreateRequest. # noqa: E501 + + + :return: The type of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionCreateRequest. + + + :param type: The type of this VersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this VersionCreateRequest. # noqa: E501 + + + :return: The version_name of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this VersionCreateRequest. + + + :param version_name: The version_name of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/version_creation_result.py b/billinglayer/python/tb_rest_client/models/models_pe/version_creation_result.py new file mode 100644 index 0000000..20df78f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/version_creation_result.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreationResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'added': 'int', + 'done': 'bool', + 'error': 'str', + 'modified': 'int', + 'removed': 'int', + 'version': 'EntityVersion' + } + + attribute_map = { + 'added': 'added', + 'done': 'done', + 'error': 'error', + 'modified': 'modified', + 'removed': 'removed', + 'version': 'version' + } + + def __init__(self, added=None, done=None, error=None, modified=None, removed=None, version=None): # noqa: E501 + """VersionCreationResult - a model defined in Swagger""" # noqa: E501 + self._added = None + self._done = None + self._error = None + self._modified = None + self._removed = None + self._version = None + self.discriminator = None + if added is not None: + self.added = added + if done is not None: + self.done = done + if error is not None: + self.error = error + if modified is not None: + self.modified = modified + if removed is not None: + self.removed = removed + if version is not None: + self.version = version + + @property + def added(self): + """Gets the added of this VersionCreationResult. # noqa: E501 + + + :return: The added of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._added + + @added.setter + def added(self, added): + """Sets the added of this VersionCreationResult. + + + :param added: The added of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._added = added + + @property + def done(self): + """Gets the done of this VersionCreationResult. # noqa: E501 + + + :return: The done of this VersionCreationResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionCreationResult. + + + :param done: The done of this VersionCreationResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionCreationResult. # noqa: E501 + + + :return: The error of this VersionCreationResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionCreationResult. + + + :param error: The error of this VersionCreationResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def modified(self): + """Gets the modified of this VersionCreationResult. # noqa: E501 + + + :return: The modified of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._modified + + @modified.setter + def modified(self, modified): + """Sets the modified of this VersionCreationResult. + + + :param modified: The modified of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._modified = modified + + @property + def removed(self): + """Gets the removed of this VersionCreationResult. # noqa: E501 + + + :return: The removed of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._removed + + @removed.setter + def removed(self, removed): + """Sets the removed of this VersionCreationResult. + + + :param removed: The removed of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._removed = removed + + @property + def version(self): + """Gets the version of this VersionCreationResult. # noqa: E501 + + + :return: The version of this VersionCreationResult. # noqa: E501 + :rtype: EntityVersion + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this VersionCreationResult. + + + :param version: The version of this VersionCreationResult. # noqa: E501 + :type: EntityVersion + """ + + self._version = version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreationResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreationResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/version_load_config.py b/billinglayer/python/tb_rest_client/models/models_pe/version_load_config.py new file mode 100644 index 0000000..fb0529f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/version_load_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auto_generate_integration_key': 'bool', + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_group_entities': 'bool', + 'load_permissions': 'bool', + 'load_relations': 'bool' + } + + attribute_map = { + 'auto_generate_integration_key': 'autoGenerateIntegrationKey', + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_group_entities': 'loadGroupEntities', + 'load_permissions': 'loadPermissions', + 'load_relations': 'loadRelations' + } + + def __init__(self, auto_generate_integration_key=None, load_attributes=None, load_credentials=None, load_group_entities=None, load_permissions=None, load_relations=None): # noqa: E501 + """VersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._auto_generate_integration_key = None + self._load_attributes = None + self._load_credentials = None + self._load_group_entities = None + self._load_permissions = None + self._load_relations = None + self.discriminator = None + if auto_generate_integration_key is not None: + self.auto_generate_integration_key = auto_generate_integration_key + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_group_entities is not None: + self.load_group_entities = load_group_entities + if load_permissions is not None: + self.load_permissions = load_permissions + if load_relations is not None: + self.load_relations = load_relations + + @property + def auto_generate_integration_key(self): + """Gets the auto_generate_integration_key of this VersionLoadConfig. # noqa: E501 + + + :return: The auto_generate_integration_key of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._auto_generate_integration_key + + @auto_generate_integration_key.setter + def auto_generate_integration_key(self, auto_generate_integration_key): + """Sets the auto_generate_integration_key of this VersionLoadConfig. + + + :param auto_generate_integration_key: The auto_generate_integration_key of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._auto_generate_integration_key = auto_generate_integration_key + + @property + def load_attributes(self): + """Gets the load_attributes of this VersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this VersionLoadConfig. + + + :param load_attributes: The load_attributes of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this VersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this VersionLoadConfig. + + + :param load_credentials: The load_credentials of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_group_entities(self): + """Gets the load_group_entities of this VersionLoadConfig. # noqa: E501 + + + :return: The load_group_entities of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_group_entities + + @load_group_entities.setter + def load_group_entities(self, load_group_entities): + """Sets the load_group_entities of this VersionLoadConfig. + + + :param load_group_entities: The load_group_entities of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_group_entities = load_group_entities + + @property + def load_permissions(self): + """Gets the load_permissions of this VersionLoadConfig. # noqa: E501 + + + :return: The load_permissions of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_permissions + + @load_permissions.setter + def load_permissions(self, load_permissions): + """Sets the load_permissions of this VersionLoadConfig. + + + :param load_permissions: The load_permissions of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_permissions = load_permissions + + @property + def load_relations(self): + """Gets the load_relations of this VersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this VersionLoadConfig. + + + :param load_relations: The load_relations of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/version_load_request.py b/billinglayer/python/tb_rest_client/models/models_pe/version_load_request.py new file mode 100644 index 0000000..a1239b2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/version_load_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'version_id': 'str' + } + + attribute_map = { + 'type': 'type', + 'version_id': 'versionId' + } + + def __init__(self, type=None, version_id=None): # noqa: E501 + """VersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._type = None + self._version_id = None + self.discriminator = None + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + + @property + def type(self): + """Gets the type of this VersionLoadRequest. # noqa: E501 + + + :return: The type of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionLoadRequest. + + + :param type: The type of this VersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this VersionLoadRequest. # noqa: E501 + + + :return: The version_id of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this VersionLoadRequest. + + + :param version_id: The version_id of this VersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/version_load_result.py b/billinglayer/python/tb_rest_client/models/models_pe/version_load_result.py new file mode 100644 index 0000000..f21fdc2 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/version_load_result.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'done': 'bool', + 'error': 'EntityLoadError', + 'result': 'list[EntityTypeLoadResult]' + } + + attribute_map = { + 'done': 'done', + 'error': 'error', + 'result': 'result' + } + + def __init__(self, done=None, error=None, result=None): # noqa: E501 + """VersionLoadResult - a model defined in Swagger""" # noqa: E501 + self._done = None + self._error = None + self._result = None + self.discriminator = None + if done is not None: + self.done = done + if error is not None: + self.error = error + if result is not None: + self.result = result + + @property + def done(self): + """Gets the done of this VersionLoadResult. # noqa: E501 + + + :return: The done of this VersionLoadResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionLoadResult. + + + :param done: The done of this VersionLoadResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionLoadResult. # noqa: E501 + + + :return: The error of this VersionLoadResult. # noqa: E501 + :rtype: EntityLoadError + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionLoadResult. + + + :param error: The error of this VersionLoadResult. # noqa: E501 + :type: EntityLoadError + """ + + self._error = error + + @property + def result(self): + """Gets the result of this VersionLoadResult. # noqa: E501 + + + :return: The result of this VersionLoadResult. # noqa: E501 + :rtype: list[EntityTypeLoadResult] + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this VersionLoadResult. + + + :param result: The result of this VersionLoadResult. # noqa: E501 + :type: list[EntityTypeLoadResult] + """ + + self._result = result + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/versioned_entity_info.py b/billinglayer/python/tb_rest_client/models/models_pe/versioned_entity_info.py new file mode 100644 index 0000000..7ef8251 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/versioned_entity_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'EntityId', + 'path': 'str' + } + + attribute_map = { + 'external_id': 'externalId', + 'path': 'path' + } + + def __init__(self, external_id=None, path=None): # noqa: E501 + """VersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self._path = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + if path is not None: + self.path = path + + @property + def external_id(self): + """Gets the external_id of this VersionedEntityInfo. # noqa: E501 + + + :return: The external_id of this VersionedEntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this VersionedEntityInfo. + + + :param external_id: The external_id of this VersionedEntityInfo. # noqa: E501 + :type: EntityId + """ + + self._external_id = external_id + + @property + def path(self): + """Gets the path of this VersionedEntityInfo. # noqa: E501 + + + :return: The path of this VersionedEntityInfo. # noqa: E501 + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """Sets the path of this VersionedEntityInfo. + + + :param path: The path of this VersionedEntityInfo. # noqa: E501 + :type: str + """ + + self._path = path + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/web_delivery_method_notification_template.py b/billinglayer/python/tb_rest_client/models/models_pe/web_delivery_method_notification_template.py new file mode 100644 index 0000000..6e40782 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/web_delivery_method_notification_template.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WebDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + + def __init__(self, additional_config=None, body=None, enabled=None, subject=None): # noqa: E501 + """WebDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + + @property + def additional_config(self): + """Gets the additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this WebDeliveryMethodNotificationTemplate. + + + :param additional_config: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def body(self): + """Gets the body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this WebDeliveryMethodNotificationTemplate. + + + :param body: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this WebDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this WebDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WebDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WebDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/white_labeling_params.py b/billinglayer/python/tb_rest_client/models/models_pe/white_labeling_params.py new file mode 100644 index 0000000..8cc0c21 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/white_labeling_params.py @@ -0,0 +1,514 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WhiteLabelingParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'logo_image_url': 'str', + 'logo_image_checksum': 'str', + 'logo_image_height': 'int', + 'app_title': 'str', + 'favicon': 'Favicon', + 'favicon_checksum': 'str', + 'palette_settings': 'PaletteSettings', + 'help_link_base_url': 'str', + 'ui_help_base_url': 'str', + 'enable_help_links': 'bool', + 'white_labeling_enabled': 'bool', + 'show_name_version': 'bool', + 'platform_name': 'str', + 'platform_version': 'str', + 'custom_css': 'str' + } + + attribute_map = { + 'logo_image_url': 'logoImageUrl', + 'logo_image_checksum': 'logoImageChecksum', + 'logo_image_height': 'logoImageHeight', + 'app_title': 'appTitle', + 'favicon': 'favicon', + 'favicon_checksum': 'faviconChecksum', + 'palette_settings': 'paletteSettings', + 'help_link_base_url': 'helpLinkBaseUrl', + 'ui_help_base_url': 'uiHelpBaseUrl', + 'enable_help_links': 'enableHelpLinks', + 'white_labeling_enabled': 'whiteLabelingEnabled', + 'show_name_version': 'showNameVersion', + 'platform_name': 'platformName', + 'platform_version': 'platformVersion', + 'custom_css': 'customCss' + } + + def __init__(self, logo_image_url=None, logo_image_checksum=None, logo_image_height=None, app_title=None, favicon=None, favicon_checksum=None, palette_settings=None, help_link_base_url=None, ui_help_base_url=None, enable_help_links=None, white_labeling_enabled=None, show_name_version=None, platform_name=None, platform_version=None, custom_css=None): # noqa: E501 + """WhiteLabelingParams - a model defined in Swagger""" # noqa: E501 + self._logo_image_url = None + self._logo_image_checksum = None + self._logo_image_height = None + self._app_title = None + self._favicon = None + self._favicon_checksum = None + self._palette_settings = None + self._help_link_base_url = None + self._ui_help_base_url = None + self._enable_help_links = None + self._white_labeling_enabled = None + self._show_name_version = None + self._platform_name = None + self._platform_version = None + self._custom_css = None + self.discriminator = None + if logo_image_url is not None: + self.logo_image_url = logo_image_url + if logo_image_checksum is not None: + self.logo_image_checksum = logo_image_checksum + if logo_image_height is not None: + self.logo_image_height = logo_image_height + if app_title is not None: + self.app_title = app_title + if favicon is not None: + self.favicon = favicon + if favicon_checksum is not None: + self.favicon_checksum = favicon_checksum + if palette_settings is not None: + self.palette_settings = palette_settings + if help_link_base_url is not None: + self.help_link_base_url = help_link_base_url + if ui_help_base_url is not None: + self.ui_help_base_url = ui_help_base_url + if enable_help_links is not None: + self.enable_help_links = enable_help_links + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + if show_name_version is not None: + self.show_name_version = show_name_version + if platform_name is not None: + self.platform_name = platform_name + if platform_version is not None: + self.platform_version = platform_version + if custom_css is not None: + self.custom_css = custom_css + + @property + def logo_image_url(self): + """Gets the logo_image_url of this WhiteLabelingParams. # noqa: E501 + + Logo image URL # noqa: E501 + + :return: The logo_image_url of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_url + + @logo_image_url.setter + def logo_image_url(self, logo_image_url): + """Sets the logo_image_url of this WhiteLabelingParams. + + Logo image URL # noqa: E501 + + :param logo_image_url: The logo_image_url of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_url = logo_image_url + + @property + def logo_image_checksum(self): + """Gets the logo_image_checksum of this WhiteLabelingParams. # noqa: E501 + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :return: The logo_image_checksum of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_checksum + + @logo_image_checksum.setter + def logo_image_checksum(self, logo_image_checksum): + """Sets the logo_image_checksum of this WhiteLabelingParams. + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :param logo_image_checksum: The logo_image_checksum of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_checksum = logo_image_checksum + + @property + def logo_image_height(self): + """Gets the logo_image_height of this WhiteLabelingParams. # noqa: E501 + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :return: The logo_image_height of this WhiteLabelingParams. # noqa: E501 + :rtype: int + """ + return self._logo_image_height + + @logo_image_height.setter + def logo_image_height(self, logo_image_height): + """Sets the logo_image_height of this WhiteLabelingParams. + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :param logo_image_height: The logo_image_height of this WhiteLabelingParams. # noqa: E501 + :type: int + """ + + self._logo_image_height = logo_image_height + + @property + def app_title(self): + """Gets the app_title of this WhiteLabelingParams. # noqa: E501 + + White-labeled name of the platform # noqa: E501 + + :return: The app_title of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._app_title + + @app_title.setter + def app_title(self, app_title): + """Sets the app_title of this WhiteLabelingParams. + + White-labeled name of the platform # noqa: E501 + + :param app_title: The app_title of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._app_title = app_title + + @property + def favicon(self): + """Gets the favicon of this WhiteLabelingParams. # noqa: E501 + + + :return: The favicon of this WhiteLabelingParams. # noqa: E501 + :rtype: Favicon + """ + return self._favicon + + @favicon.setter + def favicon(self, favicon): + """Sets the favicon of this WhiteLabelingParams. + + + :param favicon: The favicon of this WhiteLabelingParams. # noqa: E501 + :type: Favicon + """ + + self._favicon = favicon + + @property + def favicon_checksum(self): + """Gets the favicon_checksum of this WhiteLabelingParams. # noqa: E501 + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :return: The favicon_checksum of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._favicon_checksum + + @favicon_checksum.setter + def favicon_checksum(self, favicon_checksum): + """Sets the favicon_checksum of this WhiteLabelingParams. + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :param favicon_checksum: The favicon_checksum of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._favicon_checksum = favicon_checksum + + @property + def palette_settings(self): + """Gets the palette_settings of this WhiteLabelingParams. # noqa: E501 + + + :return: The palette_settings of this WhiteLabelingParams. # noqa: E501 + :rtype: PaletteSettings + """ + return self._palette_settings + + @palette_settings.setter + def palette_settings(self, palette_settings): + """Sets the palette_settings of this WhiteLabelingParams. + + + :param palette_settings: The palette_settings of this WhiteLabelingParams. # noqa: E501 + :type: PaletteSettings + """ + + self._palette_settings = palette_settings + + @property + def help_link_base_url(self): + """Gets the help_link_base_url of this WhiteLabelingParams. # noqa: E501 + + Base URL for help link # noqa: E501 + + :return: The help_link_base_url of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._help_link_base_url + + @help_link_base_url.setter + def help_link_base_url(self, help_link_base_url): + """Sets the help_link_base_url of this WhiteLabelingParams. + + Base URL for help link # noqa: E501 + + :param help_link_base_url: The help_link_base_url of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._help_link_base_url = help_link_base_url + + @property + def ui_help_base_url(self): + """Gets the ui_help_base_url of this WhiteLabelingParams. # noqa: E501 + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :return: The ui_help_base_url of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._ui_help_base_url + + @ui_help_base_url.setter + def ui_help_base_url(self, ui_help_base_url): + """Sets the ui_help_base_url of this WhiteLabelingParams. + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :param ui_help_base_url: The ui_help_base_url of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._ui_help_base_url = ui_help_base_url + + @property + def enable_help_links(self): + """Gets the enable_help_links of this WhiteLabelingParams. # noqa: E501 + + Enable or Disable help links # noqa: E501 + + :return: The enable_help_links of this WhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._enable_help_links + + @enable_help_links.setter + def enable_help_links(self, enable_help_links): + """Sets the enable_help_links of this WhiteLabelingParams. + + Enable or Disable help links # noqa: E501 + + :param enable_help_links: The enable_help_links of this WhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._enable_help_links = enable_help_links + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this WhiteLabelingParams. # noqa: E501 + + Enable white-labeling # noqa: E501 + + :return: The white_labeling_enabled of this WhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this WhiteLabelingParams. + + Enable white-labeling # noqa: E501 + + :param white_labeling_enabled: The white_labeling_enabled of this WhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + @property + def show_name_version(self): + """Gets the show_name_version of this WhiteLabelingParams. # noqa: E501 + + Show platform name and version on UI and login screen # noqa: E501 + + :return: The show_name_version of this WhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._show_name_version + + @show_name_version.setter + def show_name_version(self, show_name_version): + """Sets the show_name_version of this WhiteLabelingParams. + + Show platform name and version on UI and login screen # noqa: E501 + + :param show_name_version: The show_name_version of this WhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._show_name_version = show_name_version + + @property + def platform_name(self): + """Gets the platform_name of this WhiteLabelingParams. # noqa: E501 + + White-labeled platform name # noqa: E501 + + :return: The platform_name of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_name + + @platform_name.setter + def platform_name(self, platform_name): + """Sets the platform_name of this WhiteLabelingParams. + + White-labeled platform name # noqa: E501 + + :param platform_name: The platform_name of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_name = platform_name + + @property + def platform_version(self): + """Gets the platform_version of this WhiteLabelingParams. # noqa: E501 + + White-labeled platform version # noqa: E501 + + :return: The platform_version of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_version + + @platform_version.setter + def platform_version(self, platform_version): + """Sets the platform_version of this WhiteLabelingParams. + + White-labeled platform version # noqa: E501 + + :param platform_version: The platform_version of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_version = platform_version + + @property + def custom_css(self): + """Gets the custom_css of this WhiteLabelingParams. # noqa: E501 + + Custom CSS content # noqa: E501 + + :return: The custom_css of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._custom_css + + @custom_css.setter + def custom_css(self, custom_css): + """Sets the custom_css of this WhiteLabelingParams. + + Custom CSS content # noqa: E501 + + :param custom_css: The custom_css of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._custom_css = custom_css + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WhiteLabelingParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WhiteLabelingParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/widget_type_id.py b/billinglayer/python/tb_rest_client/models/models_pe/widget_type_id.py new file mode 100644 index 0000000..3afb09c --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/widget_type_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetTypeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetTypeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetTypeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetTypeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetTypeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetTypeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/widget_type_info.py b/billinglayer/python/tb_rest_client/models/models_pe/widget_type_info.py new file mode 100644 index 0000000..9cd3427 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/widget_type_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'description': 'str', + 'image': 'str', + 'widget_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'description': 'description', + 'image': 'image', + 'widget_type': 'widgetType' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, description=None, image=None, widget_type=None): # noqa: E501 + """WidgetTypeInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._description = None + self._image = None + self._widget_type = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if description is not None: + self.description = description + if image is not None: + self.image = image + if widget_type is not None: + self.widget_type = widget_type + + @property + def id(self): + """Gets the id of this WidgetTypeInfo. # noqa: E501 + + + :return: The id of this WidgetTypeInfo. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeInfo. + + + :param id: The id of this WidgetTypeInfo. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetTypeInfo. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetTypeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetTypeInfo. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetTypeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetTypeInfo. # noqa: E501 + + + :return: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetTypeInfo. + + + :param tenant_id: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetTypeInfo. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetTypeInfo. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetTypeInfo. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetTypeInfo. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetTypeInfo. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetTypeInfo. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this WidgetTypeInfo. # noqa: E501 + + Description of the widget type # noqa: E501 + + :return: The description of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetTypeInfo. + + Description of the widget type # noqa: E501 + + :param description: The description of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this WidgetTypeInfo. # noqa: E501 + + Base64 encoded widget thumbnail # noqa: E501 + + :return: The image of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetTypeInfo. + + Base64 encoded widget thumbnail # noqa: E501 + + :param image: The image of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def widget_type(self): + """Gets the widget_type of this WidgetTypeInfo. # noqa: E501 + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :return: The widget_type of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._widget_type + + @widget_type.setter + def widget_type(self, widget_type): + """Sets the widget_type of this WidgetTypeInfo. + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :param widget_type: The widget_type of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._widget_type = widget_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/widgets_bundle_export_data.py b/billinglayer/python/tb_rest_client/models/models_pe/widgets_bundle_export_data.py new file mode 100644 index 0000000..8cefc9a --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/widgets_bundle_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class WidgetsBundleExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'WidgetsBundle', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]', + 'widgets': 'list[WidgetTypeDetails]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations', + 'widgets': 'widgets' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None, widgets=None, *args, **kwargs): # noqa: E501 + """WidgetsBundleExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self._widgets = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + if widgets is not None: + self.widgets = widgets + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this WidgetsBundleExportData. # noqa: E501 + + + :return: The attributes of this WidgetsBundleExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this WidgetsBundleExportData. + + + :param attributes: The attributes of this WidgetsBundleExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity of this WidgetsBundleExportData. # noqa: E501 + :rtype: WidgetsBundle + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this WidgetsBundleExportData. + + + :param entity: The entity of this WidgetsBundleExportData. # noqa: E501 + :type: WidgetsBundle + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleExportData. + + + :param entity_type: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this WidgetsBundleExportData. # noqa: E501 + + + :return: The relations of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this WidgetsBundleExportData. + + + :param relations: The relations of this WidgetsBundleExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + @property + def widgets(self): + """Gets the widgets of this WidgetsBundleExportData. # noqa: E501 + + + :return: The widgets of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[WidgetTypeDetails] + """ + return self._widgets + + @widgets.setter + def widgets(self, widgets): + """Sets the widgets of this WidgetsBundleExportData. + + + :param widgets: The widgets of this WidgetsBundleExportData. # noqa: E501 + :type: list[WidgetTypeDetails] + """ + + self._widgets = widgets + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/widgets_bundle_id.py b/billinglayer/python/tb_rest_client/models/models_pe/widgets_bundle_id.py new file mode 100644 index 0000000..7e91e2f --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/widgets_bundle_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetsBundleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetsBundleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetsBundleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetsBundleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGETS_BUNDLE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/x509_certificate_chain_provision_configuration.py b/billinglayer/python/tb_rest_client/models/models_pe/x509_certificate_chain_provision_configuration.py new file mode 100644 index 0000000..880f9c7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/x509_certificate_chain_provision_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class X509CertificateChainProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_create_new_devices_by_x509_certificate': 'bool', + 'certificate_reg_ex_pattern': 'str', + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'allow_create_new_devices_by_x509_certificate': 'allowCreateNewDevicesByX509Certificate', + 'certificate_reg_ex_pattern': 'certificateRegExPattern', + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, allow_create_new_devices_by_x509_certificate=None, certificate_reg_ex_pattern=None, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """X509CertificateChainProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._allow_create_new_devices_by_x509_certificate = None + self._certificate_reg_ex_pattern = None + self._provision_device_secret = None + self.discriminator = None + if allow_create_new_devices_by_x509_certificate is not None: + self.allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + if certificate_reg_ex_pattern is not None: + self.certificate_reg_ex_pattern = certificate_reg_ex_pattern + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def allow_create_new_devices_by_x509_certificate(self): + """Gets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: bool + """ + return self._allow_create_new_devices_by_x509_certificate + + @allow_create_new_devices_by_x509_certificate.setter + def allow_create_new_devices_by_x509_certificate(self, allow_create_new_devices_by_x509_certificate): + """Sets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. + + + :param allow_create_new_devices_by_x509_certificate: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: bool + """ + + self._allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + + @property + def certificate_reg_ex_pattern(self): + """Gets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._certificate_reg_ex_pattern + + @certificate_reg_ex_pattern.setter + def certificate_reg_ex_pattern(self, certificate_reg_ex_pattern): + """Sets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. + + + :param certificate_reg_ex_pattern: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._certificate_reg_ex_pattern = certificate_reg_ex_pattern + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this X509CertificateChainProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509CertificateChainProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509CertificateChainProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/models/models_pe/x509_lw_m2_m_bootstrap_server_credential.py b/billinglayer/python/tb_rest_client/models/models_pe/x509_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..30531f7 --- /dev/null +++ b/billinglayer/python/tb_rest_client/models/models_pe/x509_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class X509LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """X509LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this X509LwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this X509LwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this X509LwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this X509LwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this X509LwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this X509LwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/billinglayer/python/tb_rest_client/rest.py b/billinglayer/python/tb_rest_client/rest.py new file mode 100644 index 0000000..e7a990a --- /dev/null +++ b/billinglayer/python/tb_rest_client/rest.py @@ -0,0 +1,342 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError('Swagger python client requires urllib3.') + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :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: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting 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'] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if query_params: + url += '?' + urlencode(query_params) + if re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = '{}' + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message diff --git a/billinglayer/python/tb_rest_client/rest_client_base.py b/billinglayer/python/tb_rest_client/rest_client_base.py new file mode 100644 index 0000000..12ab2d8 --- /dev/null +++ b/billinglayer/python/tb_rest_client/rest_client_base.py @@ -0,0 +1,1819 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import jwt +from time import time, sleep + +from requests import post +from threading import Thread +from logging import getLogger + +from typing import List, Optional, Union, Any, Dict + +from tb_rest_client.models.models_ce import * +from tb_rest_client.rest import RESTResponse +from tb_rest_client.api.api_ce.two_factor_auth_controller_api import TwoFactorAuthControllerApi +from tb_rest_client.api.api_ce.entities_version_control_controller_api import EntitiesVersionControlControllerApi +from tb_rest_client.api.api_ce.admin_controller_api import AdminControllerApi +from tb_rest_client.api.api_ce.alarm_controller_api import AlarmControllerApi +from tb_rest_client.api.api_ce.asset_controller_api import AssetControllerApi +from tb_rest_client.api.api_ce.audit_log_controller_api import AuditLogControllerApi +from tb_rest_client.api.api_ce.auth_controller_api import AuthControllerApi +from tb_rest_client.api.api_ce.component_descriptor_controller_api import ComponentDescriptorControllerApi +from tb_rest_client.api.api_ce.customer_controller_api import CustomerControllerApi +from tb_rest_client.api.api_ce.dashboard_controller_api import DashboardControllerApi +from tb_rest_client.api.api_ce.device_controller_api import DeviceControllerApi +from tb_rest_client.api.api_ce.device_api_controller_api import DeviceApiControllerApi +from tb_rest_client.api.api_ce.device_profile_controller_api import DeviceProfileControllerApi +from tb_rest_client.api.api_ce.edge_controller_api import EdgeControllerApi +from tb_rest_client.api.api_ce.edge_event_controller_api import EdgeEventControllerApi +from tb_rest_client.api.api_ce.entity_query_controller_api import EntityQueryControllerApi +from tb_rest_client.api.api_ce.entity_relation_controller_api import EntityRelationControllerApi +from tb_rest_client.api.api_ce.entity_view_controller_api import EntityViewControllerApi +from tb_rest_client.api.api_ce.event_controller_api import EventControllerApi +from tb_rest_client.api.api_ce.lwm_2m_controller_api import Lwm2mControllerApi +from tb_rest_client.api.api_ce.o_auth_2_config_template_controller_api import OAuth2ConfigTemplateControllerApi +from tb_rest_client.api.api_ce.o_auth_2_controller_api import OAuth2ControllerApi +from tb_rest_client.api.api_ce.ota_package_controller_api import OtaPackageControllerApi +from tb_rest_client.api.api_ce.queue_controller_api import QueueControllerApi +from tb_rest_client.api.api_ce.rpc_v_1_controller_api import RpcV1ControllerApi +from tb_rest_client.api.api_ce.rpc_v_2_controller_api import RpcV2ControllerApi +from tb_rest_client.api.api_ce.rule_chain_controller_api import RuleChainControllerApi +from tb_rest_client.api.api_ce.tb_resource_controller_api import TbResourceControllerApi +from tb_rest_client.api.api_ce.telemetry_controller_api import TelemetryControllerApi +from tb_rest_client.api.api_ce.tenant_controller_api import TenantControllerApi +from tb_rest_client.api.api_ce.tenant_profile_controller_api import TenantProfileControllerApi +from tb_rest_client.api.api_ce.user_controller_api import UserControllerApi +from tb_rest_client.api.api_ce.widget_type_controller_api import WidgetTypeControllerApi +from tb_rest_client.api.api_ce.widgets_bundle_controller_api import WidgetsBundleControllerApi +from tb_rest_client.api.api_ce.ui_settings_controller_api import UiSettingsControllerApi +from tb_rest_client.api.api_ce.alarm_comment_controller_api import AlarmCommentControllerApi +from tb_rest_client.api.api_ce.notification_target_controller_api import NotificationTargetControllerApi +from tb_rest_client.api.api_ce.usage_info_controller_api import UsageInfoControllerApi +from tb_rest_client.api.api_ce.notification_rule_controller_api import NotificationRuleControllerApi +from tb_rest_client.api.api_ce.notification_controller_api import NotificationControllerApi +from tb_rest_client.api.api_ce.notification_template_controller_api import NotificationTemplateControllerApi +from tb_rest_client.api.api_ce.asset_profile_controller_api import AssetProfileControllerApi +from tb_rest_client.api.api_ce.two_factor_auth_config_controller_api import TwoFactorAuthConfigControllerApi +# from tb_rest_client.models.models_pe import * +from tb_rest_client.configuration import Configuration +from tb_rest_client.api_client import ApiClient + +logger = getLogger(__name__) + + +class RestClientBase(Thread): + def __init__(self, base_url): + super().__init__() + if base_url.startswith("http"): + self.base_url = base_url + else: + self.base_url = "http://" + base_url + self.token_info = {"token": "", "refreshToken": "", "exp": 0} + self.api_client = None + self.logged_in = False + self.stopped = True + self.configuration = Configuration() + self.configuration.host = self.base_url + + def run(self): + self.stopped = False + while not self.stopped: + try: + check_time = time() + if check_time >= self.token_info["exp"] and self.logged_in: + if self.token_info["refreshToken"]: + self.refresh() + else: + logger.error("No username or password provided!") + sleep(1) + except Exception as e: + logger.exception(e) + break + except KeyboardInterrupt: + break + + def stop(self): + self.stopped = True + + def __enter__(self): + self.start() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.stop() + + def login(self, username, password): + """Authorization on the host and saving the toke information""" + token_json = post(self.base_url + "/api/auth/login", json={"username": username, "password": password}, + verify=self.configuration.verify_ssl).json() + self.__save_token(token_json) + + self.logged_in = True + + self.__load_configuration() + + def public_login(self, public_id): + token_json = post(self.base_url + "/api/auth/login/public", json={"publicId": public_id}, + verify=self.configuration.verify_ssl).json() + + self.__save_token(token_json) + self.__load_configuration() + + def token_login(self, token, refresh_token=None): + token_json = { + "token": token, + "refreshToken": refresh_token, + } + + self.__save_token(token_json) + self.__load_configuration() + + def refresh(self): + if not self.token_info["refreshToken"]: + return + + token_json = post(self.base_url + "/api/auth/token", json={"refreshToken": self.token_info["refreshToken"]}, + verify=self.configuration.verify_ssl).json() + + self.__save_token(token_json) + self.__load_configuration() + + def __save_token(self, token_json): + token = None + refresh_token = None + if isinstance(token_json, dict) and token_json.get("token") is not None: + token = token_json["token"] + refresh_token = token_json["refreshToken"] + self.configuration.api_key_prefix["X-Authorization"] = "Bearer" + self.configuration.api_key["X-Authorization"] = token + self.token_info['token'] = token + self.token_info['refreshToken'] = refresh_token + try: + parsed_token = jwt.decode(token, options={"verify_signature": False}) + self.token_info['exp'] = parsed_token['exp'] + except Exception: + return + + def __load_configuration(self): + self.api_client = ApiClient(self.configuration) + self.__load_controllers() + + def get_token(self): + return self.token_info["token"] + + # OAuth2 Controller + def delete_client_registration_template(self, client_registration_template_id: EntityId): + client_registration_template_id = self.get_id(client_registration_template_id) + return self.o_auth2_config_template_controller.delete_client_registration_template_using_delete( + client_registration_template_id=client_registration_template_id) + + def get_client_registration_templates(self) -> List[OAuth2ClientRegistrationTemplate]: + return self.o_auth2_config_template_controller.get_client_registration_templates_using_get() + + def save_client_registration_template(self, + body: Optional[OAuth2ClientRegistrationTemplate]) -> OAuth2ClientRegistrationTemplate: + return self.o_auth2_config_template_controller.save_client_registration_template_using_post(body=body) + + # Asset Controller + def get_customer_assets(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataAsset: + customer_id = self.get_id(customer_id) + return self.asset_controller.get_customer_assets_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_asset(self, asset_name: str) -> Asset: + return self.asset_controller.get_tenant_asset_using_get(asset_name=asset_name) + + def delete_asset(self, asset_id: AssetId) -> None: + asset_id = self.get_id(asset_id) + return self.asset_controller.delete_asset_using_delete(asset_id=asset_id) + + def get_assets_by_ids(self, asset_ids: list) -> List[Asset]: + asset_ids = ','.join(asset_ids) + return self.asset_controller.get_assets_by_ids_using_get(asset_ids=asset_ids) + + def get_tenant_assets(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAsset: + return self.asset_controller.get_tenant_assets_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_asset_types(self) -> List[EntitySubtype]: + return self.asset_controller.get_asset_types_using_get() + + def find_by_query(self, body: Optional[AssetSearchQuery]) -> List[Asset]: + return self.asset_controller.find_by_query_using_post(body=body) + + def get_asset_by_id(self, asset_id: AssetId) -> Asset: + asset_id = self.get_id(asset_id) + return self.asset_controller.get_asset_by_id_using_get(asset_id=asset_id) + + # Rule Chain Controller + def export_rule_chains(self, limit: int) -> RuleChainData: + return self.rule_chain_controller.export_rule_chains_using_get(limit=limit) + + def delete_rule_chain(self, rule_chain_id: RuleChainId) -> None: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.delete_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def set_edge_template_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_edge_template_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def save_rule_chain(self, body: Optional[DefaultRuleChainCreateRequest]) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post(body=body) + + def unassign_rule_chain_from_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unassign_rule_chain_from_edge_using_delete(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def assign_rule_chain_to_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.assign_rule_chain_to_edge_using_post(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def unset_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def get_rule_chain_by_id(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_by_id_using_get(rule_chain_id=rule_chain_id) + + def test_script(self, body: Optional[RuleChain]) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.rule_chain_controller.test_script_using_post(body=body) + + def save_rule_chain_v1(self, body: Optional[RuleChain]) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post1(body=body) + + def get_edge_rule_chains(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + edge_id = self.get_id(edge_id) + return self.rule_chain_controller.get_edge_rule_chains_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def set_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def import_rule_chains(self, body: Optional[RuleChainData], overwrite: Optional[bool] = None) -> List[ + RuleChainImportResult]: + return self.rule_chain_controller.import_rule_chains_using_post(body=body, overwrite=overwrite) + + def set_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def get_rule_chains(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + return self.rule_chain_controller.get_rule_chains_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_auto_assign_to_edge_rule_chains(self) -> List[RuleChain]: + return self.rule_chain_controller.get_auto_assign_to_edge_rule_chains_using_get() + + def get_latest_rule_node_debug_input(self, rule_node_id: RuleNodeId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + rule_node_id = self.get_id(rule_node_id) + return self.rule_chain_controller.get_latest_rule_node_debug_input_using_get(rule_node_id=rule_node_id) + + def get_rule_chain_meta_data(self, rule_chain_id: RuleChainId) -> RuleChainMetaData: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_meta_data_using_get(rule_chain_id=rule_chain_id) + + # Auth Controller + def get_user(self) -> User: + return self.auth_controller.get_user_using_get() + + def change_password(self, body: Optional[ChangePasswordRequest] = None) -> ObjectNode: + return self.auth_controller.change_password_using_post(body=body) + + def logout(self) -> None: + return self.auth_controller.logout_using_post() + + def check_reset_token(self, reset_token: str) -> str: + return self.auth_controller.check_reset_token_using_get(reset_token=reset_token) + + def reset_password(self, body: Optional[ResetPasswordRequest] = None) -> JWTPair: + return self.auth_controller.reset_password_using_post(body=body) + + def activate_user(self, body: Optional[ActivateUserRequest], send_activation_mail: bool) -> JWTPair: + return self.auth_controller.activate_user_using_post(body=body, send_activation_mail=send_activation_mail) + + def get_user_password_policy(self) -> UserPasswordPolicy: + return self.auth_controller.get_user_password_policy_using_get() + + def check_activate_token(self, activate_token: str) -> str: + return self.auth_controller.check_activate_token_using_get(activate_token=activate_token) + + def request_reset_password_by_email(self, body: Optional[ResetPasswordEmailRequest] = None) -> None: + return self.auth_controller.request_reset_password_by_email_using_post(body=body) + + # Event Controller # + def get_events_post(self, tenant_id: TenantId, page_size: int, page: int, entity_id: EntityId, + body: Optional[EventFilter], text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEventInfo: + tenant_id = self.get_id(tenant_id) + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.event_controller.get_events_using_post(tenant_id=tenant_id, page_size=page_size, page=page, + entity_type=entity_type, entity_id=entity_id, body=body, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + def get_events_v1_get1(self, entity_id: EntityId, event_type: str, tenant_id: TenantId, + page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataEvent: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + tenant_id = self.get_id(tenant_id) + return self.event_controller.get_events_using_get1(entity_type=entity_type, entity_id=entity_id, + event_type=event_type, tenant_id=tenant_id, + page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + def clear_events_post(self, entity_id: EntityId, body: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.event_controller.clear_events_using_post(entity_type=entity_type, entity_id=entity_id, body=body, + start_time=start_time, end_time=end_time) + + def get_events_get(self, entity_id: EntityId, tenant_id: TenantId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEventInfo: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + tenant_id = self.get_id(tenant_id) + return self.event_controller.get_events_using_get(entity_type=entity_type, entity_id=entity_id, + tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + # Telemetry Controller # + def get_attribute_keys_by_scope(self, entity_id: EntityId, scope: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_by_scope_using_get(entity_type=entity_type, + entity_id=entity_id, scope=scope) + + def get_timeseries(self, entity_id: EntityId, keys: str, start_ts: int, end_ts: int, + interval: Optional[int] = None, limit: Optional[int] = None, agg: Optional[str] = None, order_by: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, start_ts=start_ts, end_ts=end_ts, + interval=interval, limit=limit, agg=agg, + order_by=order_by, + use_strict_data_types=use_strict_data_types) + + def delete_device_attributes(self, device_id: DeviceId, scope: str, keys: str): + device_id = self.get_id(device_id) + return self.telemetry_controller.delete_device_attributes_using_delete(device_id=device_id, scope=scope, + keys=keys) + + def save_entity_attributes_v1(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v1_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def delete_entity_timeseries(self, entity_id: EntityId, keys: str, delete_all_data_for_keys: Optional[bool] = None, + start_ts: Optional[int] = None, end_ts: Optional[int] = None, + rewrite_latest_if_deleted: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_timeseries_using_delete(entity_type=entity_type, + entity_id=entity_id, keys=keys, + delete_all_data_for_keys=delete_all_data_for_keys, + start_ts=start_ts, end_ts=end_ts, + rewrite_latest_if_deleted=rewrite_latest_if_deleted) + + def save_device_attributes(self, device_id: DeviceId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + device_id = self.get_id(device_id) + return self.telemetry_controller.save_device_attributes_using_post(device_id=device_id, scope=scope, body=body) + + def get_latest_timeseries(self, entity_id: EntityId, keys: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_latest_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, + use_strict_data_types=use_strict_data_types) + + def get_timeseries_keys_v1(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_keys_using_get1(entity_type=entity_type, entity_id=entity_id) + + def get_attributes_by_scope(self, entity_id: EntityId, scope: str, + keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_by_scope_using_get(entity_type=entity_type, entity_id=entity_id, + scope=scope, keys=keys) + + def get_attribute_keys(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_using_get(entity_type=entity_type, entity_id=entity_id) + + def save_entity_attributes_v2(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v2_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def save_entity_telemetry(self, entity_id: EntityId, scope: str, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_telemetry_using_post(entity_type=entity_type, entity_id=entity_id, + scope=scope, body=body) + + def save_entity_telemetry_with_ttl(self, entity_id: EntityId, scope: str, ttl: int, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + ttl = str(ttl) + return self.telemetry_controller.save_entity_telemetry_with_ttl_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + ttl=ttl, body=body) + + def get_attributes(self, entity_id: EntityId, keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys) + + def delete_entity_attributes(self, entity_id: EntityId, scope: str, keys: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_attributes_using_delete(entity_type=entity_type, + entity_id=entity_id, scope=scope, + keys=keys) + + # Alarm Controller + def ack_alarm(self, alarm_id: AlarmId) -> AlarmInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.ack_alarm_using_post(alarm_id=alarm_id) + + def get_alarm_info_by_id(self, alarm_id: AlarmId) -> AlarmInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.get_alarm_info_by_id_using_get(alarm_id=alarm_id) + + def delete_alarm(self, alarm_id: AlarmId) -> bool: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.delete_alarm_using_delete(alarm_id=alarm_id) + + def clear_alarm(self, alarm_id: AlarmId) -> AlarmInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.clear_alarm_using_post(alarm_id=alarm_id) + + def save_alarm(self, body: Alarm) -> Alarm: + return self.alarm_controller.save_alarm_using_post(body=body) + + def get_alarms(self, entity_id: EntityId, page_size: int, page: int, search_status: Optional[str] = None, + status: Optional[str] = None, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, end_time: Optional[int] = None, + fetch_originator: Optional[bool] = None, assignee_id: Optional[str] = None) -> PageDataAlarmInfo: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.alarm_controller.get_alarms_using_get(entity_type=entity_type, entity_id=entity_id, + page_size=page_size, page=page, search_status=search_status, + status=status, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time, + fetch_originator=fetch_originator, assignee_id=assignee_id) + + def unassign_alarm(self, id: AlarmId) -> Alarm: + id = self.get_id(id) + return self.alarm_controller.unassign_alarm_using_delete(alarm_id=id) + + def get_asset_info_by_id(self, asset_id: AssetId) -> AssetInfo: + asset_id = self.get_id(asset_id) + return self.asset_controller.get_asset_info_by_id_using_get(asset_id=asset_id) + + def get_customer_asset_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAssetInfo: + customer_id = self.get_id(customer_id) + + if asset_profile_id: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_customer_asset_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, asset_profile_id=asset_profile_id) + + def count_alarms_by_query(self, body: AlarmCountQuery) -> int: + return self.entity_query_controller.count_alarms_by_query_using_post(body=body) + + def get_customer_dashboards(self, customer_id: CustomerId, page_size: int, page: int, mobile: Optional[bool] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + customer_id = self.get_id(customer_id) + return self.dashboard_controller.get_customer_dashboards_using_get(customer_id=customer_id, page_size=page_size, + page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_settings(self) -> JsonNode: + return self.user_controller.get_user_settings_using_get() + + def get_tenant_usage_info(self) -> UsageInfo: + return self.usage_info_controller.get_tenant_usage_info_using_get() + + def save_user_settings(self, body: JsonNode) -> JsonNode: + return self.user_controller.save_user_settings_using_post(body=body) + + def put_user_settings(self, body: JsonNode): + return self.user_controller.put_user_settings_using_put(body=body) + + def report_user_dashboard_action(self, dashboard_id: DashboardId, action: str) -> UserDashboardsInfo: + dashboard_id = self.get_id(dashboard_id) + return self.user_controller.report_user_dashboard_action_using_get(dashboard_id=dashboard_id, action=action) + + def get_users_for_assign(self, alarm_id: AlarmId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUserEmailInfo: + alarm_id = self.get_id(alarm_id) + return self.user_controller.get_users_for_assign_using_get(alarm_id=alarm_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_users_by_query(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUserEmailInfo: + return self.user_controller.find_users_by_query_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_dashboards_info(self) -> UserDashboardsInfo: + return self.user_controller.get_user_dashboards_info_using_get() + + def delete_user_settings(self, paths: List[str], type: str): + paths = ','.join(paths) + return self.user_controller.delete_user_settings_using_delete(paths=paths, type=type) + + def get_tenant_profiles_by_ids(self, ids: List[str]) -> List[TenantProfile]: + ids = ','.join(ids) + return self.tenant_profile_controller.get_tenant_profiles_by_ids_using_get(ids=ids) + + def get_entity_view_info_by_id(self, entity_view_id: EntityViewId) -> EntityViewInfo: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_info_by_id_using_get(entity_view_id=entity_view_id) + + def get_device_info_by_id(self, device_id: DeviceId) -> DeviceInfo: + device_id = self.get_id(device_id) + return self.device_controller.get_device_info_by_id_using_get(device_id=device_id) + + def get_alarm_by_id(self, alarm_id: AlarmId) -> Alarm: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.get_alarm_by_id_using_get(alarm_id=alarm_id) + + def get_all_alarms(self, page_size: int, page: int, search_status: Optional[str] = None, status: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None, + fetch_originator: Optional[bool] = None) -> PageDataAlarmInfo: + return self.alarm_controller.get_all_alarms_using_get(page_size=page_size, page=page, + search_status=search_status, status=status, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time, fetch_originator=fetch_originator) + + # Alarm Comment Controller + def delete_alarm_comment(self, alarm_id: AlarmId, comment_id: AlarmCommentId): + alarm_id = self.get_id(alarm_id) + comment_id = self.get_id(comment_id) + return self.alarm_comment_controller.delete_alarm_comment_using_delete(alarm_id=alarm_id, comment_id=comment_id) + + def get_alarm_comments(self, alarm_id: AlarmId, page_size: int, page: int, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAlarmCommentInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_comment_controller.get_alarm_comments_using_get(alarm_id=alarm_id, page_size=page_size, + page=page, sort_property=sort_property, + sort_order=sort_order) + + def save_alarm_comment(self, alarm_id: AlarmId, body: Optional[AlarmComment] = None) -> AlarmComment: + alarm_id = self.get_id(alarm_id) + return self.alarm_comment_controller.save_alarm_comment_using_post(alarm_id=alarm_id, body=body) + + # Edge Controller # + def get_tenant_edge(self, edge_name: str) -> Edge: + return self.edge_controller.get_tenant_edge_using_get(edge_name=edge_name) + + def delete_edge(self, edge_id: EdgeId) -> None: + edge_id = self.get_id(edge_id) + return self.edge_controller.delete_edge_using_delete(edge_id=edge_id) + + def is_edges_support_enabled(self) -> bool: + return self.edge_controller.is_edges_support_enabled_using_get() + + def get_edge_by_id(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_by_id_using_get(edge_id=edge_id) + + def sync_edge(self, edge_id: EdgeId) -> DeferredResultResponseEntity: + edge_id = self.get_id(edge_id) + return self.edge_controller.sync_edge_using_post(edge_id=edge_id) + + def get_tenant_edges(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_tenant_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def find_by_query_v2(self, body: Optional[EdgeSearchQuery] = None) -> List[Edge]: + return self.edge_controller.find_by_query_using_post2(body=body) + + def get_edges(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_edges_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edge_types(self) -> List[EntitySubtype]: + return self.edge_controller.get_edge_types_using_get() + + def set_edge_root_rule_chain(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> Edge: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.edge_controller.set_edge_root_rule_chain_using_post(edge_id=edge_id, rule_chain_id=rule_chain_id) + + def find_missing_to_related_rule_chains(self, edge_id: EdgeId) -> str: + edge_id = self.get_id(edge_id) + return self.edge_controller.find_missing_to_related_rule_chains_using_get(edge_id=edge_id) + + def get_customer_edges(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edges_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edges_by_ids(self, edge_ids: list) -> List[Edge]: + return self.edge_controller.get_edges_by_ids_using_get(edge_ids=str(edge_ids)) + + def process_edges_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultEdge: + return self.edge_controller.process_edges_bulk_import_using_post(body=body) + + def get_edge_events(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEdgeEvent: + edge_id = self.get_id(edge_id) + return self.edge_event_controller.get_edge_events_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + # RPC v2 Controller + def get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def handle_one_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_one_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_two_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def get_persisted_rpc_by_device(self, device_id: DeviceId, page_size: int, page: int, rpc_status: str, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.get_persisted_rpc_by_device_using_get(device_id=device_id, page_size=page_size, + page=page, rpc_status=rpc_status, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + def get_rule_chain_output_labels_usage(self, rule_chain_id: RuleChainId) -> List[RuleChainOutputLabelsUsage]: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_output_labels_usage_using_get(rule_chain_id=rule_chain_id) + + def get_rule_chain_output_labels(self, rule_chain_id: RuleChainId) -> List[str]: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_output_labels_using_get(rule_chain_id=rule_chain_id) + + def is_tbel_enabled(self) -> bool: + return self.rule_chain_controller.is_tbel_enabled_using_get() + + def save_rule_chain_meta_data(self, body: Optional[RuleChainMetaData] = None, + update_related: Optional[bool] = None) -> RuleChainMetaData: + return self.rule_chain_controller.save_rule_chain_meta_data_using_post(body=body, update_related=update_related) + + def delete_rpc(self, rpc_id: RpcId) -> None: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.delete_rpc_using_delete(rpc_id=rpc_id) + + def delete_resource(self, rpc_id: RpcId) -> None: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.delete_resource_using_delete(rpc_id=rpc_id) + + # Customer Controller # + def get_customer_title_by_id(self, customer_id: CustomerId) -> str: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_title_by_id_using_get(customer_id=customer_id) + + def get_customers(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataCustomer: + return self.customer_controller.get_customers_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_customer_by_id(self, customer_id: CustomerId) -> Customer: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_by_id_using_get(customer_id=customer_id) + + def get_short_customer_info_by_id(self, customer_id: CustomerId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_short_customer_info_by_id_using_get(customer_id=customer_id) + + def get_tenant_customer(self, customer_title: str) -> Customer: + return self.customer_controller.get_tenant_customer_using_get(customer_title=customer_title) + + def delete_customer(self, customer_id: CustomerId) -> None: + customer_id = self.get_id(customer_id) + return self.customer_controller.delete_customer_using_delete(customer_id=customer_id) + + # User Controller # + def get_user_token(self, user_id: UserId) -> JWTPair: + user_id = self.get_id(user_id) + return self.user_controller.get_user_token_using_get(user_id=user_id) + + def get_activation_link(self, user_id: UserId) -> str: + user_id = self.get_id(user_id) + return self.user_controller.get_activation_link_using_get(user_id=user_id) + + def delete_user(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.delete_user_using_delete(user_id=user_id) + + def set_user_credentials_enabled(self, user_id: UserId, user_credentials_enabled: bool) -> None: + user_id = self.get_id(user_id) + return self.user_controller.set_user_credentials_enabled_using_post(user_id=user_id, + user_credentials_enabled=user_credentials_enabled) + + def get_customer_users(self, customer_id: CustomerId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataUser: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_users_using_get(customer_id=customer_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_user_by_id(self, user_id: UserId) -> User: + user_id = self.get_id(user_id) + return self.user_controller.get_user_by_id_using_get(user_id=user_id) + + def get_tenant_admins(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUser: + tenant_id = self.get_id(tenant_id) + return self.user_controller.get_tenant_admins_using_get(tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def is_user_token_access_enabled(self) -> bool: + return self.user_controller.is_user_token_access_enabled_using_get() + + def send_activation_email(self, email: str) -> None: + return self.user_controller.send_activation_email_using_post(email=email) + + # Queue Controller + def get_tenant_queues_by_service_type(self, service_type: str, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> List[str]: + return self.queue_controller.get_tenant_queues_by_service_type_using_get(service_type=service_type, + page_size=page_size, + page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_queue(self, service_type: str, body: Optional[Queue] = None) -> Queue: + return self.queue_controller.save_queue_using_post(service_type=service_type, body=body) + + # RPC v1 Controller + def handle_one_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_one_way_device_rpc_request_using_post(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_two_way_device_rpc_request_using_post(device_id=device_id, body=body) + + # Device Controller + def get_device_types(self) -> List[EntitySubtype]: + return self.device_controller.get_device_types_using_get() + + def update_device_credentials(self, body: Optional[DeviceCredentials] = None) -> DeviceCredentials: + return self.device_controller.update_device_credentials_using_post(body=body) + + def delete_device(self, device_id: DeviceId) -> None: + device_id = self.get_id(device_id) + return self.device_controller.delete_device_using_delete(device_id=device_id) + + def assign_device_to_tenant(self, tenant_id: TenantId, device_id: DeviceId) -> Device: + tenant_id = self.get_id(tenant_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_tenant_using_post(tenant_id=tenant_id, device_id=device_id) + + def re_claim_device(self, device_name: str): + return self.device_controller.re_claim_device_using_delete(device_name=device_name) + + def process_devices_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultDevice: + return self.device_controller.process_devices_bulk_import_using_post(body=body) + + def count_by_device_profile_and_empty_ota_package(self, ota_package_type: str, + device_profile_id: DeviceProfileId) -> int: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.count_by_device_profile_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, device_profile_id=device_profile_id) + + def get_devices_by_ids(self, device_ids: list) -> List[Device]: + return self.device_controller.get_devices_by_ids_using_get(device_ids=str(device_ids)) + + def get_device_by_id(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.get_device_by_id_using_get(device_id=device_id) + + def find_by_query_v1(self, body: Optional[DeviceSearchQuery] = None) -> List[Device]: + return self.device_controller.find_by_query_using_post1(body=body) + + def get_customer_devices(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDevice: + customer_id = self.get_id(customer_id) + return self.device_controller.get_customer_devices_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_devices(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDevice: + return self.device_controller.get_tenant_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_device(self, device_name: str) -> Device: + return self.device_controller.get_tenant_device_using_get(device_name=device_name) + + def get_device_credentials_by_device_id(self, device_id: DeviceId) -> DeviceCredentials: + device_id = self.get_id(device_id) + return self.device_controller.get_device_credentials_by_device_id_using_get(device_id=device_id) + + # Entity Relation Controller + def find_by_to_v1(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[EntityRelation]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get1(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def find_info_by_to(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelationInfo]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_info_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def delete_relations(self, entity_id: EntityId) -> None: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entity_relation_controller.delete_relations_using_delete(entity_id=entity_id, + entity_type=entity_type) + + def delete_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> None: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.delete_relation_using_delete(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_info_by_query(self, body: Optional[EntityRelationsQuery] = None) -> List[EntityRelationInfo]: + return self.entity_relation_controller.find_info_by_query_using_post(body=body) + + def find_by_query_v3(self, body: Optional[EntityRelationsQuery] = None) -> List[EntityRelation]: + return self.entity_relation_controller.find_by_query_using_post3(body=body) + + def save_relation(self, body: Optional[EntityRelation] = None) -> None: + return self.entity_relation_controller.save_relation_using_post(body=body) + + def find_by_to(self, to_id: EntityId, relation_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelation]: + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + def find_info_by_from(self, from_id: EntityId, + relation_type_group: Optional[str] = None) -> List[EntityRelationInfo]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_info_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def get_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> EntityRelation: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.get_relation_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_by_from_v1(self, from_id: EntityId, from_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelation]: + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get1(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def find_by_from(self, from_id: EntityId, relation_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + # Entity View Controller + def get_tenant_entity_view(self, entity_view_name: str) -> EntityView: + return self.entity_view_controller.get_tenant_entity_view_using_get(entity_view_name=entity_view_name) + + def get_tenant_entity_views(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityView: + return self.entity_view_controller.get_tenant_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_view_by_id(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_by_id_using_get(entity_view_id=entity_view_id) + + def find_by_query_v4(self, body: Optional[EntityViewSearchQuery] = None) -> List[EntityView]: + return self.entity_view_controller.find_by_query_using_post4(body=body) + + def get_entity_view_types(self) -> List[EntitySubtype]: + return self.entity_view_controller.get_entity_view_types_using_get() + + def delete_entity_view(self, entity_view_id: EntityViewId) -> None: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.delete_entity_view_using_delete(entity_view_id=entity_view_id) + + def get_customer_entity_views(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEntityView: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_views_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Admin Controller + def send_test_sms(self, body: Optional[TestSmsRequest] = None) -> None: + return self.admin_controller.send_test_sms_using_post(body=body) + + def check_updates(self) -> UpdateMessage: + return self.admin_controller.check_updates_using_get() + + def get_security_settings(self) -> SecuritySettings: + return self.admin_controller.get_security_settings_using_get() + + def send_test_mail(self, body: Optional[AdminSettings] = None) -> None: + return self.admin_controller.send_test_mail_using_post(body=body) + + def save_admin_settings(self, body: Optional[AdminSettings] = None) -> AdminSettings: + return self.admin_controller.save_admin_settings_using_post(body=body) + + def save_security_settings(self, body: Optional[SecuritySettings] = None) -> SecuritySettings: + return self.admin_controller.save_security_settings_using_post(body=body) + + def get_repository_settings(self) -> RepositorySettings: + return self.admin_controller.get_repository_settings_using_get() + + def save_repository_settings(self, body: Optional[RepositorySettings] = None) -> DeferredResultRepositorySettings: + return self.admin_controller.save_repository_settings_using_post(body=body) + + def delete_repository_settings(self) -> DeferredResultVoid: + return self.admin_controller.delete_repository_settings_using_delete() + + def repository_settings_exists(self) -> bool: + return self.admin_controller.repository_settings_exists_using_get() + + def check_repository_access(self, body: Optional[RepositorySettings] = None) -> DeferredResultVoid: + return self.admin_controller.check_repository_access_using_post(body=body) + + def delete_auto_commit_settings(self) -> None: + return self.admin_controller.delete_auto_commit_settings_using_delete() + + def auto_commit_settings_exists(self) -> bool: + return self.admin_controller.auto_commit_settings_exists_using_get() + + def save_auto_commit_settings(self, body: Optional[Dict[str, AutoVersionCreateConfig]] = None) -> Dict[str, AutoVersionCreateConfig]: + return self.admin_controller.save_auto_commit_settings_using_post(body=body) + + def get_auto_commit_settings(self) -> Dict[str, AutoVersionCreateConfig]: + return self.admin_controller.get_auto_commit_settings_using_get() + + def get_jwt_setting(self) -> JWTSettings: + return self.admin_controller.get_jwt_settings_using_get() + + def save_jwt_settings(self, body: Optional[JWTSettings] = None) -> JWTPair: + return self.admin_controller.save_jwt_settings_using_post(body=body) + + # TB Resource Controller + def get_resource_info_by_id(self, resource_id: EntityId) -> TbResourceInfo: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_info_by_id_using_get(resource_id=resource_id) + + def delete_resource_v1(self, resource_id: EntityId): + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.delete_resource_using_delete1(resource_id=resource_id) + + def get_resource_by_id(self, resource_id: EntityId) -> None: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_by_id_using_get(resource_id=resource_id) + + def save_resource(self, body: Optional[TbResource] = None) -> TbResource: + return self.tb_resource_controller.save_resource_using_post(body=body) + + def get_resources(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTbResourceInfo: + return self.tb_resource_controller.get_resources_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_lwm2m_list_objects(self, sort_order: str, sort_property: str, object_ids: list) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_using_get(sort_order=sort_order, + sort_property=sort_property, + object_ids=str(object_ids)) + + def download_resource(self, resource_id: EntityId) -> Resource: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.download_resource_using_get(resource_id=resource_id) + + def get_lwm2m_list_objects_page(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_page_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_repository_settings_info(self) -> RepositorySettingsInfo: + return self.admin_controller.get_repository_settings_info_using_get() + + # O Auth 2 Controller + def get_login_processing_url(self) -> str: + return self.o_auth2_controller.get_login_processing_url_using_get() + + def get_current_o_auth2_info(self) -> OAuth2Info: + return self.o_auth2_controller.get_current_o_auth2_info_using_get() + + def save_o_auth2_info(self, body: Optional[OAuth2Info] = None) -> OAuth2Info: + return self.o_auth2_controller.save_o_auth2_info_using_post(body=body) + + def get_o_auth2_clients(self, pkg_name: Optional[str] = None, platform: Optional[str] = None) -> List[OAuth2ClientInfo]: + return self.o_auth2_controller.get_o_auth2_clients_using_post(pkg_name=pkg_name, platform=platform) + + # Tenant Profile Controller + def get_default_tenant_profile_info(self) -> EntityInfo: + return self.tenant_profile_controller.get_default_tenant_profile_info_using_get() + + def save_tenant_profile(self, body: Optional[TenantProfile] = None) -> TenantProfile: + return self.tenant_profile_controller.save_tenant_profile_using_post(body=body) + + def get_tenant_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantProfile: + return self.tenant_profile_controller.get_tenant_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_tenant_profile(self, tenant_profile_id: TenantProfileId) -> None: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.delete_tenant_profile_using_delete(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_info_by_id(self, tenant_profile_id: TenantProfileId) -> EntityInfo: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_info_by_id_using_get( + tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_by_id(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_by_id_using_get(tenant_profile_id=tenant_profile_id) + + def set_default_tenant_profile(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.set_default_tenant_profile_using_post(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityInfo: + return self.tenant_profile_controller.get_tenant_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Widgets Bundle Controller + def get_widgets_bundle_by_id(self, widgets_bundle_id: WidgetsBundleId) -> WidgetsBundle: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.get_widgets_bundle_by_id_using_get(widgets_bundle_id=widgets_bundle_id) + + def save_widgets_bundle(self, body: Optional[WidgetsBundle] = None) -> WidgetsBundle: + return self.widgets_bundle_controller.save_widgets_bundle_using_post(body=body) + + def get_widgets_bundles_v1(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataWidgetsBundle: + return self.widgets_bundle_controller.get_widgets_bundles_using_get1(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_widgets_bundle(self, widgets_bundle_id: WidgetsBundleId) -> None: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.delete_widgets_bundle_using_delete(widgets_bundle_id=widgets_bundle_id) + + def get_widgets_bundles(self, ): + return self.widgets_bundle_controller.get_widgets_bundles_using_get() + + # Device Profile Controller + def get_device_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + transport_type: Optional[str] = None) -> PageDataDeviceProfileInfo: + return self.device_profile_controller.get_device_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + transport_type=transport_type) + + def set_default_device_profile(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.set_default_device_profile_using_post(device_profile_id=device_profile_id) + + def delete_device_profile(self, device_profile_id: DeviceProfileId) -> None: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.delete_device_profile_using_delete(device_profile_id=device_profile_id) + + def get_attributes_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_attributes_keys_using_get(device_profile_id=device_profile_id) + + def save_device_profile(self, body: Optional[DeviceProfile] = None) -> DeviceProfile: + return self.device_profile_controller.save_device_profile_using_post(body=body) + + def get_default_device_profile_info(self) -> DeviceProfileInfo: + return self.device_profile_controller.get_default_device_profile_info_using_get() + + def get_timeseries_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_timeseries_keys_using_get(device_profile_id=device_profile_id) + + def get_device_profile_info_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfileInfo: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_info_by_id_using_get( + device_profile_id=device_profile_id) + + def get_device_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDeviceProfile: + return self.device_profile_controller.get_device_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_device_profile_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_by_id_using_get(device_profile_id=device_profile_id) + + # Dashboard Controller + def get_tenant_dashboards_v1(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + tenant_id = self.get_id(tenant_id) + return self.dashboard_controller.get_tenant_dashboards_using_get1(tenant_id=tenant_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_info_by_id(self, dashboard_id: DashboardId) -> DashboardInfo: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_info_by_id_using_get(dashboard_id=dashboard_id) + + def get_home_dashboard(self) -> HomeDashboard: + return self.dashboard_controller.get_home_dashboard_using_get() + + def set_tenant_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_tenant_home_dashboard_info_using_post(body=body) + + def get_server_time(self) -> int: + return self.dashboard_controller.get_server_time_using_get() + + def get_highest_alarm_severity(self, entity_id: EntityId, search_status: Optional[str] = None, + status: Optional[str] = None, assignee_id: Optional[str] = None) -> str: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.alarm_controller.get_highest_alarm_severity_using_get(entity_id=entity_id, entity_type=entity_type, + search_status=search_status, status=status, + assignee_id=assignee_id) + + def get_max_datapoints_limit(self) -> int: + return self.dashboard_controller.get_max_datapoints_limit_using_get() + + def get_home_dashboard_info(self) -> HomeDashboardInfo: + return self.dashboard_controller.get_home_dashboard_info_using_get() + + def get_dashboard_by_id(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_by_id_using_get(dashboard_id=dashboard_id) + + def get_tenant_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_tenant_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_dashboard(self, dashboard_id: DashboardId) -> None: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.delete_dashboard_using_delete(dashboard_id=dashboard_id) + + def get_tenant_home_dashboard_info(self) -> HomeDashboardInfo: + return self.dashboard_controller.get_tenant_home_dashboard_info_using_get() + + # Entity Query Controller + def find_entity_timeseries_and_attributes_keys_by_query(self, timeseries: bool, attributes: bool, body: Optional[ + EntityDataQuery]): + return self.entity_query_controller.find_entity_timeseries_and_attributes_keys_by_query_using_post( + timeseries=timeseries, attributes=attributes, body=body) + + def find_alarm_data_by_query(self, body: Optional[AlarmDataQuery] = None) -> PageDataAlarmData: + return self.entity_query_controller.find_alarm_data_by_query_using_post(body=body) + + def find_entity_data_by_query(self, body: Optional[EntityDataQuery] = None) -> PageDataEntityData: + return self.entity_query_controller.find_entity_data_by_query_using_post(body=body) + + # Widget Type Controller + def get_bundle_widget_types_infos(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeInfo]: + return self.widget_type_controller.get_bundle_widget_types_infos_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_bundle_widget_types_details(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeDetails]: + return self.widget_type_controller.get_bundle_widget_types_details_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def delete_widget_type(self, widget_type_id: WidgetTypeId) -> None: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.delete_widget_type_using_delete(widget_type_id=widget_type_id) + + def save_widget_type(self, body: Optional[WidgetTypeDetails] = None) -> WidgetTypeDetails: + return self.widget_type_controller.save_widget_type_using_post(body=body) + + def get_bundle_widget_types(self, is_system: bool, bundle_alias: str) -> List[WidgetType]: + return self.widget_type_controller.get_bundle_widget_types_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_widget_type(self, is_system: bool, bundle_alias: str, alias: str): + return self.widget_type_controller.get_widget_type_using_get(is_system=is_system, bundle_alias=bundle_alias, + alias=alias) + + def get_widget_type_by_id(self, widget_type_id: WidgetTypeId) -> WidgetType: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.get_widget_type_by_id_using_get(widget_type_id=widget_type_id) + + # Audit Log Controller + def get_audit_logs_by_customer_id(self, customer_id: CustomerId, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + customer_id = self.get_id(customer_id) + return self.audit_log_controller.get_audit_logs_by_customer_id_using_get(customer_id=customer_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, + end_time=end_time, + action_types=action_types) + + def get_audit_logs_by_user_id(self, user_id: UserId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + user_id = self.get_id(user_id) + return self.audit_log_controller.get_audit_logs_by_user_id_using_get(user_id=user_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + def get_audit_logs(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + return self.audit_log_controller.get_audit_logs_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time, action_types=action_types) + + def get_audit_logs_by_entity_id(self, entity_id: EntityId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None, action_types: Optional[str] = None) -> PageDataAuditLog: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.audit_log_controller.get_audit_logs_by_entity_id_using_get(entity_type=entity_type, + entity_id=entity_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + # Lwm2M Controller + def get_lwm2m_bootstrap_security_info(self, is_bootstrap_server: bool) -> ServerSecurityConfig: + return self.lwm2m_controller.get_lwm2m_bootstrap_security_info_using_get( + is_bootstrap_server=is_bootstrap_server) + + # Component Descriptor Controller + def get_component_descriptors_by_type(self, component_type: str, + rule_chain_type: Optional[str] = None) -> List[ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_type_using_get( + component_type=component_type, rule_chain_type=rule_chain_type) + + def get_component_descriptor_by_clazz(self, component_descriptor_clazz: str) -> ComponentDescriptor: + return self.component_descriptor_controller.get_component_descriptor_by_clazz_using_get( + component_descriptor_clazz=component_descriptor_clazz) + + def get_component_descriptors_by_types(self, component_types: str, + rule_chain_type: Optional[str] = None) -> List[ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_types_using_get( + component_types=component_types, rule_chain_type=rule_chain_type) + + # UI Controller + def get_help_base_url(self) -> str: + return self.ui_settings_controller.get_help_base_url_using_get() + + # Device API Controller + def subscribe_to_attributes(self, device_token: str, timeout: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.subscribe_to_attributes_using_get(device_token=device_token, timeout=timeout) + + def subscribe_to_commands(self, device_token: str, timeout: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.subscribe_to_commands_using_get(device_token=device_token, timeout=timeout) + + def get_device_attributes(self, device_token: str, client_keys: str, + shared_keys: str) -> DeferredResultResponseEntity: + return self.device_api_controller.get_device_attributes_using_get(device_token=device_token, + client_keys=client_keys, + shared_keys=shared_keys) + + def get_firmware(self, device_token: str, title: str, version: str, size: Optional[int] = None, + chunk: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.get_firmware_using_get(device_token=device_token, title=title, + version=version, size=size, chunk=chunk) + + def reply_to_command(self, device_token: str, request_id: int, + body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.reply_to_command_using_post(device_token=device_token, request_id=request_id, + body=body) + + def get_software(self, device_token: str, title: str, version: str, size: Optional[int] = None, + chunk: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.get_software_using_get(device_token=device_token, title=title, + version=version, size=size, chunk=chunk) + + def post_telemetry(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.post_telemetry_using_post(device_token=device_token, body=body) + + def claim_device(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.claim_device_using_post(device_token=device_token, body=body) + + def post_rpc_request(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.post_rpc_request_using_post(device_token=device_token, body=body) + + def provision_device(self, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.provision_device_using_post(body=body) + + def post_device_attributes(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.post_device_attributes_using_post(device_token=device_token, body=body) + + # Tenant Controller + def get_tenant_infos(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantInfo: + return self.tenant_controller.get_tenant_infos_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_by_id(self, tenant_id: TenantId) -> Tenant: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_by_id_using_get(tenant_id=tenant_id) + + def save_tenant(self, body: Optional[Tenant] = None) -> Tenant: + return self.tenant_controller.save_tenant_using_post(body=body) + + def get_tenants(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenant: + return self.tenant_controller.get_tenants_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_info_by_id(self, tenant_id: TenantId) -> TenantInfo: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_info_by_id_using_get(tenant_id=tenant_id) + + def delete_tenant(self, tenant_id: TenantId) -> None: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.delete_tenant_using_delete(tenant_id=tenant_id) + + # OTA Package Controller + def delete_ota_package(self, ota_package_id: OtaPackageId) -> None: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.delete_ota_package_using_delete(ota_package_id=ota_package_id) + + def save_ota_package_data(self, ota_package_id: OtaPackageId, checksum: Optional[str] = None, + checksum_algorithm: Optional[str] = None, file: Optional[str] = None) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.save_ota_package_data_using_post(ota_package_id=ota_package_id, + checksum=checksum, + checksum_algorithm=checksum_algorithm, + file=file) + + def get_ota_packages_v1(self, device_profile_id: DeviceProfileId, type: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + device_profile_id = self.get_id(device_profile_id) + return self.ota_package_controller.get_ota_packages_using_get1(device_profile_id=device_profile_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_ota_package_info(self, body: Optional[SaveOtaPackageInfoRequest] = None) -> OtaPackageInfo: + return self.ota_package_controller.save_ota_package_info_using_post(body=body) + + def get_ota_packages(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + return self.ota_package_controller.get_ota_packages_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_ota_package_by_id(self, ota_package_id: OtaPackageId) -> OtaPackage: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_by_id_using_get(ota_package_id=ota_package_id) + + def download_ota_package(self, ota_package_id: OtaPackageId) -> Resource: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.download_ota_package_using_get(ota_package_id=ota_package_id) + + def get_ota_package_info_by_id(self, ota_package_id: OtaPackageId) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_info_by_id_using_get(ota_package_id=ota_package_id) + + def save_entities_version(self, body: Optional[VersionCreateRequest] = None) -> str: + return self.entities_version_control_controller.save_entities_version_using_post(body=body) + + def get_version_load_request_status(self, request_id: str) -> VersionLoadResult: + return self.entities_version_control_controller.get_version_load_request_status_using_get(request_id=request_id) + + def list_branches(self): + return self.entities_version_control_controller.list_branches_using_get() + + def list_entity_versions(self, entity_type: str, external_entity_uuid: str, branch: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + return self.entities_version_control_controller.list_entity_versions_using_get(entity_type=entity_type, + external_entity_uuid=external_entity_uuid, + branch=branch, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_data_info(self, version_id: str, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entities_version_control_controller.get_entity_data_info_using_get(version_id=version_id, + entity_type=entity_type, + external_entity_uuid=entity_id) + + def get_version_create_request_status(self, request_id: str) -> VersionCreationResult: + return self.entities_version_control_controller.get_version_create_request_status_using_get( + request_id=request_id) + + def load_entities_version(self, body: Optional[VersionLoadRequest] = None) -> str: + return self.entities_version_control_controller.load_entities_version_using_post(body=body) + + def list_entity_type_versions(self, entity_type: str, branch: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + return self.entities_version_control_controller.list_entity_type_versions_using_get(entity_type=entity_type, + branch=branch, + page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def list_entities_at_version(self, entity_type: str, version_id: str): + return self.entities_version_control_controller.list_entities_at_version_using_get(entity_type=entity_type, + version_id=version_id) + + def list_all_entities_at_version(self, version_id: str): + return self.entities_version_control_controller.list_all_entities_at_version_using_get(version_id=version_id) + + def compare_entity_data_to_version(self, entity_id: EntityId, + version_id: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entities_version_control_controller.compare_entity_data_to_version_using_get( + entity_type=entity_type, internal_entity_uuid=entity_id, version_id=version_id) + + def list_versions(self, branch: str, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + return self.entities_version_control_controller.list_versions_using_get(branch=branch, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_queue(self, queue_id: QueueId) -> None: + queue_id = self.get_id(queue_id) + return self.queue_controller.delete_queue_using_delete(queue_id=queue_id) + + def get_queue_by_id(self, queue_id: QueueId) -> Queue: + queue_id = self.get_id(queue_id) + return self.queue_controller.get_queue_by_id_using_get(queue_id=queue_id) + + def get_queue_by_name(self, queue_name: str) -> Queue: + return self.queue_controller.get_queue_by_name_using_get(queue_name=queue_name) + + # Two-Factor Auth Controller + def check_two_fa_verification_code(self, provider_type: str, verification_code: str) -> JWTPair: + return self.two_factor_auth_controller.check_two_fa_verification_code_using_post(provider_type=provider_type, + verification_code=verification_code) + + def get_available_two_fa_providers_v1(self, ) -> List[TwoFaProviderInfo]: + return self.two_factor_auth_controller.get_available_two_fa_providers_using_get1() + + def request_two_fa_verification_code(self, provider_type: str) -> None: + return self.two_factor_auth_controller.request_two_fa_verification_code_using_post(provider_type=provider_type) + + # Tow Factor Auth Config Controller + def delete_two_fa_account_config(self, provider_type: str) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.delete_two_fa_account_config_using_delete(provider_type=provider_type) + + def generate_two_fa_account_config(self, provider_type: str) -> TwoFaAccountConfig: + return self.two_factor_auth_config_controller.generate_two_fa_account_config_using_post(provider_type=provider_type) + + def get_account_two_fa_settings(self) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.get_account_two_fa_settings_using_get() + + def get_available_two_fa_providers(self) -> List[str]: + return self.two_factor_auth_config_controller.get_available_two_fa_providers_using_get() + + def get_platform_two_fa_settings(self) -> PlatformTwoFaSettings: + return self.two_factor_auth_config_controller.get_platform_two_fa_settings_using_get() + + def save_platform_two_fa_settings(self, body: PlatformTwoFaSettings) -> PlatformTwoFaSettings: + return self.two_factor_auth_config_controller.save_platform_two_fa_settings_using_post(body=body) + + def submit_two_fa_account_config(self, body: TwoFaAccountConfig): + return self.two_factor_auth_config_controller.submit_two_fa_account_config_using_post(body=body) + + def update_two_fa_account_config(self, provider_type: str, body: TwoFaAccountConfigUpdateRequest) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.update_two_fa_account_config_using_put(provider_type=provider_type, body=body) + + def verify_and_save_two_fa_account_config(self, body: TwoFaAccountConfig, verification_code: str) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.verify_and_save_two_fa_account_config_using_post(body=body, verification_code=verification_code) + + def create_notification_request(self, body: NotificationRequest) -> NotificationRequest: + return self.notification_controller.create_notification_request_using_post(body=body) + + def delete_notification_request(self, id: str): + return self.notification_controller.delete_notification_request_using_delete(id=id) + + def delete_notification(self, id: str): + return self.notification_controller.delete_notification_using_delete(id=id) + + def get_available_delivery_methods(self) -> List[str]: + return self.notification_controller.get_available_delivery_methods_using_get() + + def get_notification_request_by_id(self, id: str) -> NotificationRequestInfo: + return self.notification_controller.get_notification_request_by_id_using_get(id=id) + + def get_notification_request_preview(self, body: NotificationRequest, + recipients_preview_size: Optional[int] = None): + return self.notification_controller.get_notification_request_preview_using_post(body=body, + recipients_preview_size=recipients_preview_size) + + def get_notification_requests(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationRequestInfo: + return self.notification_controller.get_notification_requests_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_notification_settings(self) -> NotificationSettings: + return self.notification_controller.get_notification_settings_using_get() + + def get_notifications(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotification: + return self.notification_controller.get_notifications_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def mark_all_notifications_as_read(self): + return self.notification_controller.mark_all_notifications_as_read_using_put() + + def mark_notification_as_read(self, id: str): + return self.notification_controller.mark_notification_as_read_using_put(id=id) + + def save_notification_settings(self, body: NotificationSettings) -> NotificationSettings: + return self.notification_controller.save_notification_settings_using_post(body=body) + + def delete_notification_rule(self, id: str): + return self.notification_rule_controller.delete_notification_rule_using_delete(id=id) + + def get_notification_rule_by_id(self, id: str) -> NotificationRuleInfo: + return self.notification_rule_controller.get_notification_rule_by_id_using_get(id=id) + + def get_notification_rules(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationRuleInfo: + return self.notification_rule_controller.get_notification_rules_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_notification_rule(self, body: NotificationRule) -> NotificationRule: + return self.notification_rule_controller.save_notification_rule_using_post(body=body) + + def delete_notification_target_by_id(self, id: str): + return self.notification_target_controller.delete_notification_target_by_id_using_delete(id=id) + + def get_notification_target_by_id(self, id: str) -> NotificationTarget: + return self.notification_target_controller.get_notification_target_by_id_using_get(id=id) + + def get_notification_targets_by_ids(self, ids: list) -> List[NotificationTarget]: + ids = ','.join(ids) + return self.notification_target_controller.get_notification_targets_by_ids_using_get(ids=ids) + + def get_notification_targets_by_supported_notification_type(self, notification_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataNotificationTarget: + return self.notification_target_controller.get_notification_targets_by_supported_notification_type_using_get( + notification_type=notification_type, page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_notification_targets(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationTarget: + return self.notification_target_controller.get_notification_targets_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_recipients_for_notification_target_config(self, page_size: int, page: int): + return self.notification_target_controller.get_recipients_for_notification_target_config_using_post( + page_size=page_size, page=page) + + def save_notification_target(self, body: NotificationTarget) -> NotificationTarget: + return self.notification_target_controller.save_notification_target_using_post(body=body) + + def delete_notification_template_by_id(self, id: str): + return self.notification_template_controller.delete_notification_template_by_id_using_delete(id=id) + + def get_notification_template_by_id(self, id: str) -> NotificationTemplate: + return self.notification_template_controller.get_notification_template_by_id_using_get(id=id) + + def get_notification_templates(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationTemplate: + return self.notification_template_controller.get_notification_templates_using_get(page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def list_slack_conversations(self, type: str, token: Optional[str] = None) -> List[SlackConversation]: + return self.notification_template_controller.list_slack_conversations_using_get(type=type, token=token) + + def save_notification_template(self, body: NotificationTemplate) -> NotificationTemplate: + return self.notification_template_controller.save_notification_template_using_post(body=body) + + def __load_controllers(self): + self.audit_log_controller = AuditLogControllerApi(self.api_client) + self.o_auth2_config_template_controller = OAuth2ConfigTemplateControllerApi(self.api_client) + self.entity_view_controller = EntityViewControllerApi(self.api_client) + self.entity_query_controller = EntityQueryControllerApi(self.api_client) + self.o_auth2_controller = OAuth2ControllerApi(self.api_client) + self.entity_relation_controller = EntityRelationControllerApi(self.api_client) + self.rpc_v2_controller = RpcV2ControllerApi(self.api_client) + self.edge_controller = EdgeControllerApi(self.api_client) + self.admin_controller = AdminControllerApi(self.api_client) + self.user_controller = UserControllerApi(self.api_client) + self.asset_controller = AssetControllerApi(self.api_client) + self.widgets_bundle_controller = WidgetsBundleControllerApi(self.api_client) + self.tenant_profile_controller = TenantProfileControllerApi(self.api_client) + self.event_controller = EventControllerApi(self.api_client) + self.lwm2m_controller = Lwm2mControllerApi(self.api_client) + self.dashboard_controller = DashboardControllerApi(self.api_client) + self.component_descriptor_controller = ComponentDescriptorControllerApi(self.api_client) + self.device_profile_controller = DeviceProfileControllerApi(self.api_client) + self.customer_controller = CustomerControllerApi(self.api_client) + self.telemetry_controller = TelemetryControllerApi(self.api_client) + self.tenant_controller = TenantControllerApi(self.api_client) + self.rpc_v1_controller = RpcV1ControllerApi(self.api_client) + self.widget_type_controller = WidgetTypeControllerApi(self.api_client) + self.device_controller = DeviceControllerApi(self.api_client) + self.device_api_controller = DeviceApiControllerApi(self.api_client) + self.rule_chain_controller = RuleChainControllerApi(self.api_client) + self.tb_resource_controller = TbResourceControllerApi(self.api_client) + self.auth_controller = AuthControllerApi(self.api_client) + self.queue_controller = QueueControllerApi(self.api_client) + self.ota_package_controller = OtaPackageControllerApi(self.api_client) + self.alarm_controller = AlarmControllerApi(self.api_client) + self.edge_event_controller = EdgeEventControllerApi(self.api_client) + self.ui_settings_controller = UiSettingsControllerApi(self.api_client) + self.entities_version_control_controller = EntitiesVersionControlControllerApi(self.api_client) + self.two_factor_auth_controller = TwoFactorAuthControllerApi(self.api_client) + self.alarm_comment_controller = AlarmCommentControllerApi(self.api_client) + self.notification_target_controller = NotificationTargetControllerApi(self.api_client) + self.usage_info_controller = UsageInfoControllerApi(self.api_client) + self.notification_rule_controller = NotificationRuleControllerApi(self.api_client) + self.notification_controller = NotificationControllerApi(self.api_client) + self.notification_template_controller = NotificationTemplateControllerApi(self.api_client) + self.asset_profile_controller = AssetProfileControllerApi(self.api_client) + self.two_factor_auth_config_controller = TwoFactorAuthConfigControllerApi(self.api_client) + + @staticmethod + def get_type(type): + return type.entity_type if hasattr(type, "entity_type") else type + + @staticmethod + def get_id(id): + return id.id if hasattr(id, "id") else id diff --git a/billinglayer/python/tb_rest_client/rest_client_ce.py b/billinglayer/python/tb_rest_client/rest_client_ce.py new file mode 100644 index 0000000..1a8f799 --- /dev/null +++ b/billinglayer/python/tb_rest_client/rest_client_ce.py @@ -0,0 +1,1348 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from tb_rest_client.rest_client_base import * + +logger = getLogger(__name__) + + +class RestClientCE(RestClientBase): + def __init__(self, base_url): + super().__init__(base_url) + + # O Auth 2 Config Template Controller + def delete_client_registration_template(self, client_registration_template_id: EntityId) -> None: + client_registration_template_id = self.get_id(client_registration_template_id) + return self.o_auth2_config_template_controller.delete_client_registration_template_using_delete( + client_registration_template_id=client_registration_template_id) + + def get_client_registration_templates(self) -> List[OAuth2ClientRegistrationTemplate]: + return self.o_auth2_config_template_controller.get_client_registration_templates_using_get() + + def save_client_registration_template(self, body: Optional[ + OAuth2ClientRegistrationTemplate] = None) -> OAuth2ClientRegistrationTemplate: + return self.o_auth2_config_template_controller.save_client_registration_template_using_post(body=body) + + # Asset Controller + def assign_asset_to_edge(self, edge_id: EdgeId, asset_id: AssetId) -> Asset: + edge_id = self.get_id(edge_id) + asset_id = self.get_id(asset_id) + return self.asset_controller.assign_asset_to_edge_using_post(edge_id=edge_id, asset_id=asset_id) + + def get_tenant_asset_infos(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAssetInfo: + + if asset_profile_id: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_tenant_asset_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, asset_profile_id=asset_profile_id) + + def process_assets_bulk_import(self, body: BulkImportRequest) -> BulkImportResultAsset: + return self.asset_controller.process_assets_bulk_import_using_post(body=body) + + def unassign_asset_from_edge(self, edge_id: EdgeId, asset_id: AssetId) -> Asset: + edge_id = self.get_id(edge_id) + asset_id = self.get_id(asset_id) + return self.asset_controller.unassign_asset_from_edge_using_delete(edge_id=edge_id, asset_id=asset_id) + + def get_edge_assets(self, edge_id: EdgeId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataAsset: + edge_id = self.get_id(edge_id) + return self.asset_controller.get_edge_assets_using_get(edge_id=edge_id, page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + def assign_asset_to_customer(self, customer_id: CustomerId, asset_id: AssetId) -> Asset: + customer_id = self.get_id(customer_id) + asset_id = self.get_id(asset_id) + return self.asset_controller.assign_asset_to_customer_using_post(customer_id=customer_id, asset_id=asset_id) + + def unassign_asset_from_customer(self, asset_id: AssetId) -> Asset: + asset_id = self.get_id(asset_id) + return self.asset_controller.unassign_asset_from_customer_using_delete(asset_id=asset_id) + + def assign_asset_to_public_customer(self, asset_id: AssetId) -> Asset: + asset_id = self.get_id(asset_id) + return self.asset_controller.assign_asset_to_public_customer_using_post(asset_id=asset_id) + + def save_asset(self, body: Optional[Asset] = None) -> Asset: + return self.asset_controller.save_asset_using_post(body=body) + + # Edge Controller + def get_tenant_edge_infos(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdgeInfo: + return self.edge_controller.get_tenant_edge_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edge_info_by_id(self, edge_id: EdgeId) -> EdgeInfo: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_info_by_id_using_get(edge_id=edge_id) + + def get_customer_edge_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdgeInfo: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edge_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def assign_edge_to_customer(self, customer_id: CustomerId, edge_id: EdgeId) -> Edge: + customer_id = self.get_id(customer_id) + edge_id = self.get_id(edge_id) + return self.edge_controller.assign_edge_to_customer_using_post(customer_id=customer_id, edge_id=edge_id) + + def find_by_query_v2(self, body: Optional[EdgeSearchQuery] = None) -> List[Edge]: + return self.edge_controller.find_by_query_using_post2(body=body) + + def get_tenant_edges(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_tenant_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def find_missing_to_related_rule_chains(self, edge_id: EdgeId) -> str: + edge_id = self.get_id(edge_id) + return self.edge_controller.find_missing_to_related_rule_chains_using_get(edge_id=edge_id) + + def get_customer_edges(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edges_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def process_edges_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultEdge: + return self.edge_controller.process_edges_bulk_import_using_post(body=body) + + def activate_instance(self, license_secret: str, release_date: str) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.edge_controller.activate_instance_using_post(license_secret=license_secret, + release_date=release_date) + + def get_tenant_edge(self, edge_name: str) -> Edge: + return self.edge_controller.get_tenant_edge_using_get(edge_name=edge_name) + + def get_edge_by_id(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_by_id_using_get(edge_id=edge_id) + + def delete_edge(self, edge_id: EdgeId) -> None: + edge_id = self.get_id(edge_id) + return self.edge_controller.delete_edge_using_delete(edge_id=edge_id) + + def save_edge(self, body: Optional[Edge] = None) -> Edge: + return self.edge_controller.save_edge_using_post(body=body) + + def is_edges_support_enabled(self, ) -> bool: + return self.edge_controller.is_edges_support_enabled_using_get() + + def get_edges(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_edges_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def unassign_edge_from_customer(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.unassign_edge_from_customer_using_delete(edge_id=edge_id) + + def assign_edge_to_public_customer(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.assign_edge_to_public_customer_using_post(edge_id=edge_id) + + def get_edge_types(self, ) -> List[EntitySubtype]: + return self.edge_controller.get_edge_types_using_get() + + def set_edge_root_rule_chain(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> Edge: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.edge_controller.set_edge_root_rule_chain_using_post(edge_id=edge_id, rule_chain_id=rule_chain_id) + + def get_edges_by_ids(self, edge_ids: list) -> List[Edge]: + return self.edge_controller.get_edges_by_ids_using_get(edge_ids=edge_ids) + + # Rule Chain Controller + def export_rule_chains(self, limit: int) -> RuleChainData: + return self.rule_chain_controller.export_rule_chains_using_get(limit=limit) + + def delete_rule_chain(self, rule_chain_id: RuleChainId) -> None: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.delete_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def set_edge_template_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_edge_template_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def save_rule_chain(self, body: Optional[DefaultRuleChainCreateRequest] = None) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post(body=body) + + def assign_rule_chain_to_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.assign_rule_chain_to_edge_using_post(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def unassign_rule_chain_from_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unassign_rule_chain_from_edge_using_delete(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def unset_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def get_rule_chain_by_id(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_by_id_using_get(rule_chain_id=rule_chain_id) + + def test_script(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.rule_chain_controller.test_script_using_post(body=body) + + def save_rule_chain_v1(self, body: Optional[RuleChain] = None) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post1(body=body) + + def get_edge_rule_chains(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + edge_id = self.get_id(edge_id) + return self.rule_chain_controller.get_edge_rule_chains_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def set_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def import_rule_chains(self, body: Optional[RuleChainData] = None, overwrite: Optional[bool] = None) -> List[ + RuleChainImportResult]: + return self.rule_chain_controller.import_rule_chains_using_post(body=body, overwrite=overwrite) + + def set_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def get_rule_chains(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + return self.rule_chain_controller.get_rule_chains_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_auto_assign_to_edge_rule_chains(self, ) -> List[RuleChain]: + return self.rule_chain_controller.get_auto_assign_to_edge_rule_chains_using_get() + + def get_latest_rule_node_debug_input(self, rule_node_id: RuleNodeId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + rule_node_id = self.get_id(rule_node_id) + return self.rule_chain_controller.get_latest_rule_node_debug_input_using_get(rule_node_id=rule_node_id) + + def get_rule_chain_meta_data(self, rule_chain_id: RuleChainId) -> RuleChainMetaData: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_meta_data_using_get(rule_chain_id=rule_chain_id) + + # Auth Controller + def get_user(self, ) -> User: + return self.auth_controller.get_user_using_get() + + def change_password(self, body: Optional[ChangePasswordRequest] = None) -> ObjectNode: + return self.auth_controller.change_password_using_post(body=body) + + def logout(self, ) -> None: + return self.auth_controller.logout_using_post() + + def check_reset_token(self, reset_token: str) -> str: + return self.auth_controller.check_reset_token_using_get(reset_token=reset_token) + + def get_user_password_policy(self, ) -> UserPasswordPolicy: + return self.auth_controller.get_user_password_policy_using_get() + + def check_activate_token(self, activate_token: str) -> str: + return self.auth_controller.check_activate_token_using_get(activate_token=activate_token) + + def request_reset_password_by_email(self, body: Optional[ResetPasswordEmailRequest] = None) -> None: + return self.auth_controller.request_reset_password_by_email_using_post(body=body) + + # Event Controller + def get_events_v1_get1(self, entity_id: EntityId, event_type: str, tenant_id: TenantId, + page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataEvent: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + tenant_id = self.get_id(tenant_id) + return self.event_controller.get_events_using_get1(entity_type=entity_type, entity_id=entity_id, + event_type=event_type, tenant_id=tenant_id, + page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + # Telemetry Controller + def get_attribute_keys_by_scope(self, entity_id: EntityId, scope: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_by_scope_using_get(entity_type=entity_type, + entity_id=entity_id, scope=scope) + + def get_timeseries(self, entity_id: EntityId, keys: str, start_ts: int, end_ts: int, + interval: Optional[int] = None, limit: Optional[int] = None, agg: Optional[str] = None, order_by: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, start_ts=start_ts, end_ts=end_ts, + interval=interval, limit=limit, agg=agg, + order_by=order_by, + use_strict_data_types=use_strict_data_types) + + def delete_device_attributes(self, device_id: DeviceId, scope: str, keys: str): + device_id = self.get_id(device_id) + return self.telemetry_controller.delete_device_attributes_using_delete(device_id=device_id, scope=scope, + keys=keys) + + def delete_entity_timeseries(self, entity_id: EntityId, keys: str, delete_all_data_for_keys: Optional[bool] = None, + start_ts: Optional[int] = None, end_ts: Optional[int] = None, + rewrite_latest_if_deleted: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_timeseries_using_delete(entity_type=entity_type, + entity_id=entity_id, keys=keys, + delete_all_data_for_keys=delete_all_data_for_keys, + start_ts=start_ts, end_ts=end_ts, + rewrite_latest_if_deleted=rewrite_latest_if_deleted) + + def save_entity_attributes_v1(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v1_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def save_device_attributes(self, device_id: DeviceId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + device_id = self.get_id(device_id) + return self.telemetry_controller.save_device_attributes_using_post(device_id=device_id, scope=scope, body=body) + + def get_latest_timeseries(self, entity_id: EntityId, keys: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_latest_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, + use_strict_data_types=use_strict_data_types) + + def get_timeseries_keys_v1(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_keys_using_get1(entity_type=entity_type, entity_id=entity_id) + + def get_attributes_by_scope(self, entity_id: EntityId, scope: str, + keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_by_scope_using_get(entity_type=entity_type, entity_id=entity_id, + scope=scope, keys=keys) + + def get_attribute_keys(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_using_get(entity_type=entity_type, entity_id=entity_id) + + def save_entity_attributes_v2(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v2_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def save_entity_telemetry(self, entity_id: EntityId, scope: str, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_telemetry_using_post(entity_type=entity_type, entity_id=entity_id, + scope=scope, body=body) + + def save_entity_telemetry_with_ttl(self, entity_id: EntityId, scope: str, ttl: int, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + ttl = str(ttl) + return self.telemetry_controller.save_entity_telemetry_with_ttl_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + ttl=ttl, body=body) + + def get_attributes(self, entity_id: EntityId, keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys) + + def delete_entity_attributes(self, entity_id: EntityId, scope: str, keys: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_attributes_using_delete(entity_type=entity_type, + entity_id=entity_id, scope=scope, + keys=keys) + + # Alarm Controller + def clear_alarm(self, alarm_id: AlarmId) -> None: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.clear_alarm_using_post(alarm_id=alarm_id) + + # RPC v2 Controller + def get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def handle_one_way_device_rpc_request_v1(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_one_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request_v1(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_two_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def get_persisted_rpc_by_device(self, device_id: DeviceId, page_size: int, page: int, rpc_status: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.get_persisted_rpc_by_device_using_get(device_id=device_id, page_size=page_size, + page=page, rpc_status=rpc_status, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_resource(self, rpc_id: RpcId) -> None: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.delete_resource_using_delete(rpc_id=rpc_id) + + # Edge Event Controller + def get_edge_events(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEdgeEvent: + edge_id = self.get_id(edge_id) + return self.edge_event_controller.get_edge_events_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + # Customer Controller + def get_customer_title_by_id(self, customer_id: CustomerId) -> str: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_title_by_id_using_get(customer_id=customer_id) + + def get_customers(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataCustomer: + return self.customer_controller.get_customers_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_customer_by_id(self, customer_id: CustomerId) -> Customer: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_by_id_using_get(customer_id=customer_id) + + def get_short_customer_info_by_id(self, customer_id: CustomerId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_short_customer_info_by_id_using_get(customer_id=customer_id) + + def save_customer(self, body: Optional[Customer] = None) -> Customer: + return self.customer_controller.save_customer_using_post(body=body) + + def get_tenant_customer(self, customer_title: str) -> Customer: + return self.customer_controller.get_tenant_customer_using_get(customer_title=customer_title) + + def delete_customer(self, customer_id: CustomerId) -> None: + customer_id = self.get_id(customer_id) + return self.customer_controller.delete_customer_using_delete(customer_id=customer_id) + + # User Controller + def get_user_token(self, user_id: UserId) -> JWTPair: + user_id = self.get_id(user_id) + return self.user_controller.get_user_token_using_get(user_id=user_id) + + def get_activation_link(self, user_id: UserId) -> str: + user_id = self.get_id(user_id) + return self.user_controller.get_activation_link_using_get(user_id=user_id) + + def delete_user(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.delete_user_using_delete(user_id=user_id) + + def get_users(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUser: + return self.user_controller.get_users_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def set_user_credentials_enabled(self, user_id: UserId, user_credentials_enabled: Optional[bool] = None) -> None: + user_id = self.get_id(user_id) + return self.user_controller.set_user_credentials_enabled_using_post(user_id=user_id, + user_credentials_enabled=user_credentials_enabled) + + def get_customer_users(self, customer_id: CustomerId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataUser: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_users_using_get(customer_id=customer_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_user_by_id(self, user_id: UserId) -> User: + user_id = self.get_id(user_id) + return self.user_controller.get_user_by_id_using_get(user_id=user_id) + + def get_tenant_admins(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUser: + tenant_id = self.get_id(tenant_id) + return self.user_controller.get_tenant_admins_using_get(tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def is_user_token_access_enabled(self, ) -> bool: + return self.user_controller.is_user_token_access_enabled_using_get() + + def save_user(self, body: Optional[User] = None, send_activation_mail: Optional[bool] = None) -> User: + return self.user_controller.save_user_using_post(body=body, send_activation_mail=send_activation_mail) + + def send_activation_email(self, email: str) -> None: + return self.user_controller.send_activation_email_using_post(email=email) + + # RPC v1 Controller + def handle_one_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_one_way_device_rpc_request_using_post(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_two_way_device_rpc_request_using_post(device_id=device_id, body=body) + + # Device Controller + def get_device_types(self, ) -> List[EntitySubtype]: + return self.device_controller.get_device_types_using_get() + + def process_devices_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultDevice: + return self.device_controller.process_devices_bulk_import_using_post(body=body) + + def count_by_device_profile_and_empty_ota_package(self, ota_package_type: str, + device_profile_id: DeviceProfileId) -> int: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.count_by_device_profile_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, device_profile_id=device_profile_id) + + def get_devices_by_ids(self, device_ids: list) -> List[Device]: + device_ids = ','.join(device_ids) + return self.device_controller.get_devices_by_ids_using_get(device_ids=device_ids) + + def save_device_with_credentials(self, body: Optional[SaveDeviceWithCredentialsRequest] = None) -> Device: + return self.device_controller.save_device_with_credentials_using_post(body=body) + + def update_device_credentials(self, body: Optional[DeviceCredentials] = None) -> DeviceCredentials: + return self.device_controller.update_device_credentials_using_post(body=body) + + def save_device(self, body: Optional[Device] = None, access_token: Optional[str] = None) -> Device: + return self.device_controller.save_device_using_post(body=body, access_token=access_token) + + def assign_device_to_public_customer(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_public_customer_using_post(device_id=device_id) + + def unassign_device_from_customer(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.unassign_device_from_customer_using_delete(device_id=device_id) + + def get_device_by_id(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.get_device_by_id_using_get(device_id=device_id) + + def get_tenant_device_infos(self, page_size: int, page: int, type: Optional[str] = None, + device_profile_id: Optional[DeviceProfileId] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + active: Optional[bool] = None) -> PageDataDeviceInfo: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_tenant_device_infos_using_get(page_size=page_size, page=page, type=type, + device_profile_id=device_profile_id, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, active=active) + + def get_customer_device_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + device_profile_id: Optional[DeviceProfileId] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + active: Optional[bool] = None) -> PageDataDeviceInfo: + customer_id = self.get_id(customer_id) + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_customer_device_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, + device_profile_id=device_profile_id, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, active=active) + + def get_tenant_devices(self, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDevice: + return self.device_controller.get_tenant_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_customer_devices(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDevice: + customer_id = self.get_id(customer_id) + return self.device_controller.get_customer_devices_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def unassign_device_from_edge(self, edge_id: EdgeId, device_id: DeviceId) -> Device: + edge_id = self.get_id(edge_id) + device_id = self.get_id(device_id) + return self.device_controller.unassign_device_from_edge_using_delete(edge_id=edge_id, device_id=device_id) + + def assign_device_to_tenant(self, tenant_id: TenantId, device_id: DeviceId) -> Device: + tenant_id = self.get_id(tenant_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_tenant_using_post(tenant_id=tenant_id, device_id=device_id) + + def find_by_query_v1(self, body: DeviceSearchQuery) -> List[Device]: + return self.device_controller.find_by_query_using_post1(body=body) + + def assign_device_to_edge(self, edge_id: EdgeId, device_id: DeviceId) -> Device: + edge_id = self.get_id(edge_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_edge_using_post(edge_id=edge_id, device_id=device_id) + + def delete_device(self, device_id: DeviceId) -> None: + device_id = self.get_id(device_id) + return self.device_controller.delete_device_using_delete(device_id=device_id) + + def re_claim_device(self, device_name: str): + return self.device_controller.re_claim_device_using_delete(device_name=device_name) + + def assign_device_to_customer(self, customer_id: CustomerId, device_id: DeviceId) -> Device: + customer_id = self.get_id(customer_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_customer_using_post(customer_id=customer_id, device_id=device_id) + + def get_edge_devices(self, edge_id: EdgeId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None, device_profile_id: Optional[DeviceProfileId] = None, active: Optional[bool] = None) -> PageDataDevice: + edge_id = self.get_id(edge_id) + + if device_profile_id: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_edge_devices_using_get(edge_id=edge_id, page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time, device_profile_id=device_profile_id, active=active) + + def get_tenant_device(self, device_name: str) -> Device: + return self.device_controller.get_tenant_device_using_get(device_name=device_name) + + def get_device_credentials_by_device_id(self, device_id: DeviceId) -> DeviceCredentials: + device_id = self.get_id(device_id) + return self.device_controller.get_device_credentials_by_device_id_using_get(device_id=device_id) + + # Entity View Controller + def find_by_to_v1(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[EntityRelation]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get1(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def find_info_by_to(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelationInfo]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_info_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def delete_relations(self, entity_id: EntityId) -> None: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entity_relation_controller.delete_relations_using_delete(entity_id=entity_id, + entity_type=entity_type) + + def delete_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> None: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.delete_relation_using_delete(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_by_from_v1(self, from_id: EntityId, from_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get1(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def find_by_query_v3(self, body: EntityRelationsQuery) -> List[EntityRelation]: + return self.entity_relation_controller.find_by_query_using_post3(body=body) + + def find_info_by_query(self, body: EntityRelationsQuery) -> List[EntityRelationInfo]: + return self.entity_relation_controller.find_info_by_query_using_post(body=body) + + def save_relation(self, body: Optional[EntityRelation] = None) -> None: + return self.entity_relation_controller.save_relation_using_post(body=body) + + def find_by_to(self, to_id: EntityId, relation_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + def find_info_by_from(self, from_id: EntityId, + relation_type_group: Optional[str] = None) -> List[EntityRelationInfo]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_info_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def get_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> EntityRelation: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.get_relation_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_by_from(self, from_id: EntityId, relation_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + def assign_entity_view_to_edge(self, edge_id: EdgeId, entity_view_id: EntityViewId) -> EntityView: + edge_id = self.get_id(edge_id) + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.assign_entity_view_to_edge_using_post(edge_id=edge_id, + entity_view_id=entity_view_id) + + def get_entity_view_types(self, ) -> List[EntitySubtype]: + return self.entity_view_controller.get_entity_view_types_using_get() + + def delete_entity_view(self, entity_view_id: EntityViewId) -> None: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.delete_entity_view_using_delete(entity_view_id=entity_view_id) + + def assign_entity_view_to_customer(self, customer_id: CustomerId, entity_view_id: EntityViewId) -> EntityView: + customer_id = self.get_id(customer_id) + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.assign_entity_view_to_customer_using_post(customer_id=customer_id, + entity_view_id=entity_view_id) + + def get_entity_view_by_id(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_by_id_using_get(entity_view_id=entity_view_id) + + def get_customer_entity_view_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityViewInfo: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_view_infos_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_entity_view_infos(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEntityViewInfo: + return self.entity_view_controller.get_tenant_entity_view_infos_using_get(page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_entity_view(self, entity_view_name: str) -> EntityView: + return self.entity_view_controller.get_tenant_entity_view_using_get(entity_view_name=entity_view_name) + + def get_edge_entity_views(self, edge_id: EdgeId, page: int, page_size: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEntityView: + edge_id = self.get_id(edge_id) + return self.entity_view_controller.get_edge_entity_views_using_get(edge_id=edge_id, page=page, + page_size=page_size, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + def unassign_entity_view_from_customer(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.unassign_entity_view_from_customer_using_delete( + entity_view_id=entity_view_id) + + def save_entity_view(self, body: Optional[EntityView] = None) -> EntityView: + return self.entity_view_controller.save_entity_view_using_post(body=body) + + def unassign_entity_view_from_edge(self, edge_id: EdgeId, entity_view_id: EntityViewId) -> EntityView: + edge_id = self.get_id(edge_id) + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.unassign_entity_view_from_edge_using_delete(edge_id=edge_id, + entity_view_id=entity_view_id) + + def get_tenant_entity_views(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityView: + return self.entity_view_controller.get_tenant_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def assign_entity_view_to_public_customer(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.assign_entity_view_to_public_customer_using_post( + entity_view_id=entity_view_id) + + def find_by_query_v4(self, body: EntityViewSearchQuery) -> List[EntityView]: + return self.entity_view_controller.find_by_query_using_post4(body=body) + + def get_customer_entity_views(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEntityView: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_views_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Admin Controller + def get_admin_settings(self, key: str) -> AdminSettings: + return self.admin_controller.get_admin_settings_using_get(key=key) + + # TB Resource Controller + def get_resource_info_by_id(self, resource_id: EntityId) -> TbResourceInfo: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_info_by_id_using_get(resource_id=resource_id) + + def delete_resource_v1(self, resource_id: EntityId) -> None: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.delete_resource_using_delete1(resource_id=resource_id) + + def get_resource_by_id(self, resource_id: EntityId) -> TbResource: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_by_id_using_get(resource_id=resource_id) + + def save_resource(self, body=None): + return self.tb_resource_controller.save_resource_using_post(body=body) + + def get_resources(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTbResourceInfo: + return self.tb_resource_controller.get_resources_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_lwm2m_list_objects(self, sort_order: str, sort_property: str, object_ids: list) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_using_get(sort_order=sort_order, + sort_property=sort_property, + object_ids=object_ids) + + def download_resource(self, resource_id: EntityId) -> Resource: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.download_resource_using_get(resource_id=resource_id) + + def get_lwm2m_list_objects_page(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_page_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_features_info(self) -> FeaturesInfo: + return self.admin_controller.get_features_info_using_get() + + def get_system_info(self) -> SystemInfo: + return self.admin_controller.get_system_info_using_get() + + # O Auth 2 Controller + def get_login_processing_url(self, ) -> str: + return self.o_auth2_controller.get_login_processing_url_using_get() + + def save_o_auth2_info(self, body: Optional[OAuth2Info] = None) -> OAuth2Info: + return self.o_auth2_controller.save_o_auth2_info_using_post(body=body) + + def get_o_auth2_clients(self, pkg_name: Optional[str] = None, platform: Optional[str] = None) -> List[OAuth2ClientInfo]: + return self.o_auth2_controller.get_o_auth2_clients_using_post(pkg_name=pkg_name, platform=platform) + + def get_current_o_auth2_info(self, ) -> OAuth2Info: + return self.o_auth2_controller.get_current_o_auth2_info_using_get() + + # Tenant Profile Controller + def get_default_tenant_profile_info(self, ) -> EntityInfo: + return self.tenant_profile_controller.get_default_tenant_profile_info_using_get() + + def save_tenant_profile(self, body: Optional[TenantProfile] = None) -> TenantProfile: + return self.tenant_profile_controller.save_tenant_profile_using_post(body=body) + + def get_tenant_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantProfile: + return self.tenant_profile_controller.get_tenant_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_tenant_profile(self, tenant_profile_id: TenantProfileId) -> None: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.delete_tenant_profile_using_delete(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_info_by_id(self, tenant_profile_id: TenantProfileId) -> EntityInfo: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_info_by_id_using_get( + tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_by_id(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_by_id_using_get(tenant_profile_id=tenant_profile_id) + + def set_default_tenant_profile(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.set_default_tenant_profile_using_post(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityInfo: + return self.tenant_profile_controller.get_tenant_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Widgets Bundle Controller + def get_widgets_bundle_by_id(self, widgets_bundle_id: WidgetsBundleId) -> WidgetsBundle: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.get_widgets_bundle_by_id_using_get(widgets_bundle_id=widgets_bundle_id) + + def save_widgets_bundle(self, body: Optional[WidgetsBundle] = None) -> WidgetsBundle: + return self.widgets_bundle_controller.save_widgets_bundle_using_post(body=body) + + def get_widgets_bundles_v1(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataWidgetsBundle: + return self.widgets_bundle_controller.get_widgets_bundles_using_get1(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_widgets_bundle(self, widgets_bundle_id: WidgetsBundleId) -> None: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.delete_widgets_bundle_using_delete(widgets_bundle_id=widgets_bundle_id) + + def get_widgets_bundles(self, ) -> List[WidgetsBundle]: + return self.widgets_bundle_controller.get_widgets_bundles_using_get() + + # Device Profile Controller + def get_device_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, transport_type: Optional[str] = None) -> PageDataDeviceProfileInfo: + return self.device_profile_controller.get_device_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + transport_type=transport_type) + + def set_default_device_profile(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.set_default_device_profile_using_post(device_profile_id=device_profile_id) + + def get_attributes_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_attributes_keys_using_get(device_profile_id=device_profile_id) + + def delete_device_profile(self, device_profile_id: DeviceProfileId) -> None: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.delete_device_profile_using_delete(device_profile_id=device_profile_id) + + def save_device_profile(self, body: Optional[DeviceProfile] = None) -> DeviceProfile: + return self.device_profile_controller.save_device_profile_using_post(body=body) + + def get_default_device_profile_info(self, ) -> DeviceProfileInfo: + return self.device_profile_controller.get_default_device_profile_info_using_get() + + def get_timeseries_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_timeseries_keys_using_get(device_profile_id=device_profile_id) + + def get_device_profile_info_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfileInfo: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_info_by_id_using_get( + device_profile_id=device_profile_id) + + def get_device_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDeviceProfile: + return self.device_profile_controller.get_device_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_device_profile_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_by_id_using_get(device_profile_id=device_profile_id) + + # Dashboard Controller + def add_dashboard_customers(self, dashboard_id: DashboardId, body: Optional[List[str]] = None) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.add_dashboard_customers_using_post(dashboard_id=dashboard_id, body=body) + + def assign_dashboard_to_edge(self, edge_id: EdgeId, dashboard_id: DashboardId) -> Dashboard: + edge_id = self.get_id(edge_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.assign_dashboard_to_edge_using_post(edge_id=edge_id, dashboard_id=dashboard_id) + + def remove_dashboard_customers(self, dashboard_id: DashboardId, body: Optional[List[str]] = None) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.remove_dashboard_customers_using_post(dashboard_id=dashboard_id, body=body) + + def get_server_time(self, ) -> int: + return self.dashboard_controller.get_server_time_using_get() + + def get_dashboard_by_id(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_by_id_using_get(dashboard_id=dashboard_id) + + def assign_dashboard_to_public_customer(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.assign_dashboard_to_public_customer_using_post(dashboard_id=dashboard_id) + + def delete_dashboard(self, dashboard_id: DashboardId) -> None: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.delete_dashboard_using_delete(dashboard_id=dashboard_id) + + def update_dashboard_customers(self, dashboard_id: DashboardId, body: Optional[List[str]] = None) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.update_dashboard_customers_using_post(dashboard_id=dashboard_id, body=body) + + def unassign_dashboard_from_public_customer(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.unassign_dashboard_from_public_customer_using_delete(dashboard_id=dashboard_id) + + def save_dashboard(self, body: Optional[Dashboard] = None) -> Dashboard: + return self.dashboard_controller.save_dashboard_using_post(body=body) + + def get_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_home_dashboard_info_using_get() + + def get_tenant_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_tenant_home_dashboard_info_using_get() + + def get_tenant_dashboards_v1(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + tenant_id = self.get_id(tenant_id) + return self.dashboard_controller.get_tenant_dashboards_using_get1(tenant_id=tenant_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_info_by_id(self, dashboard_id: DashboardId) -> DashboardInfo: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_info_by_id_using_get(dashboard_id=dashboard_id) + + def unassign_dashboard_from_edge(self, edge_id: EdgeId, dashboard_id: DashboardId) -> Dashboard: + edge_id = self.get_id(edge_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.unassign_dashboard_from_edge_using_delete(edge_id=edge_id, + dashboard_id=dashboard_id) + + def get_home_dashboard(self, ) -> HomeDashboard: + return self.dashboard_controller.get_home_dashboard_using_get() + + def get_max_datapoints_limit(self, ) -> int: + return self.dashboard_controller.get_max_datapoints_limit_using_get() + + def get_tenant_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_tenant_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def assign_dashboard_to_customer(self, customer_id: CustomerId, dashboard_id: DashboardId) -> Dashboard: + customer_id = self.get_id(customer_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.assign_dashboard_to_customer_using_post(customer_id=customer_id, + dashboard_id=dashboard_id) + + def set_tenant_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_tenant_home_dashboard_info_using_post(body=body) + + def get_edge_dashboards(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDashboardInfo: + edge_id = self.get_id(edge_id) + return self.dashboard_controller.get_edge_dashboards_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def unassign_dashboard_from_customer(self, customer_id: CustomerId, dashboard_id: DashboardId) -> Dashboard: + customer_id = self.get_id(customer_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.unassign_dashboard_from_customer_using_delete(customer_id=customer_id, + dashboard_id=dashboard_id) + + # Entity Query Controller + def count_entities_by_query(self, body: Optional[EntityCountQuery] = None) -> int: + return self.entity_query_controller.count_entities_by_query_using_post(body=body) + + def find_entity_timeseries_and_attributes_keys_by_query(self, timeseries: bool, attributes: bool, body: Optional[ + EntityDataQuery]) -> DeferredResultResponseEntity: + return self.entity_query_controller.find_entity_timeseries_and_attributes_keys_by_query_using_post( + timeseries=timeseries, attributes=attributes, body=body) + + def find_alarm_data_by_query(self, body: Optional[AlarmDataQuery] = None) -> PageDataAlarmData: + return self.entity_query_controller.find_alarm_data_by_query_using_post(body=body) + + def find_entity_data_by_query(self, body: Optional[EntityDataQuery] = None) -> PageDataEntityData: + return self.entity_query_controller.find_entity_data_by_query_using_post(body=body) + + # Widget Type Controller + def get_bundle_widget_types_infos(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeInfo]: + return self.widget_type_controller.get_bundle_widget_types_infos_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_bundle_widget_types_details(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeDetails]: + return self.widget_type_controller.get_bundle_widget_types_details_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def delete_widget_type(self, widget_type_id: WidgetTypeId) -> None: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.delete_widget_type_using_delete(widget_type_id=widget_type_id) + + def save_widget_type(self, body: Optional[WidgetTypeDetails] = None) -> WidgetTypeDetails: + return self.widget_type_controller.save_widget_type_using_post(body=body) + + def get_bundle_widget_types(self, is_system: bool, bundle_alias: str) -> List[WidgetType]: + return self.widget_type_controller.get_bundle_widget_types_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_widget_type(self, is_system: bool, bundle_alias: str, alias: str) -> WidgetType: + return self.widget_type_controller.get_widget_type_using_get(is_system=is_system, bundle_alias=bundle_alias, + alias=alias) + + def get_widget_type_by_id(self, widget_type_id: WidgetTypeId) -> WidgetTypeDetails: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.get_widget_type_by_id_using_get(widget_type_id=widget_type_id) + + # Audit Log Controller + def get_audit_logs_by_customer_id(self, customer_id: CustomerId, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + customer_id = self.get_id(customer_id) + return self.audit_log_controller.get_audit_logs_by_customer_id_using_get(customer_id=customer_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, + end_time=end_time, + action_types=action_types) + + def get_audit_logs_by_user_id(self, user_id: UserId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + user_id = self.get_id(user_id) + return self.audit_log_controller.get_audit_logs_by_user_id_using_get(user_id=user_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + def get_audit_logs_by_entity_id(self, entity_id: EntityId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.audit_log_controller.get_audit_logs_by_entity_id_using_get(entity_type=entity_type, + entity_id=entity_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + # Lwm2m Controller + def get_lwm2m_bootstrap_security_info(self, is_bootstrap_server: bool): + return self.lwm2m_controller.get_lwm2m_bootstrap_security_info_using_get( + is_bootstrap_server=is_bootstrap_server) + + # UI Controller + def get_help_base_url(self, ) -> str: + return self.ui_settings_controller.get_help_base_url_using_get() + + # Component Descriptor Controller + def get_component_descriptors_by_types(self, component_types: str, rule_chain_type: Optional[str] = None) -> List[ + ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_types_using_get( + component_types=component_types, rule_chain_type=rule_chain_type) + + def get_component_descriptor_by_clazz(self, component_descriptor_clazz: str) -> ComponentDescriptor: + return self.component_descriptor_controller.get_component_descriptor_by_clazz_using_get( + component_descriptor_clazz=component_descriptor_clazz) + + def get_component_descriptors_by_type(self, component_type: str, rule_chain_type: Optional[str] = None) -> List[ + ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_type_using_get( + component_type=component_type, rule_chain_type=rule_chain_type) + + # Tenant Controller + def get_tenant_infos(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantInfo: + return self.tenant_controller.get_tenant_infos_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_by_id(self, tenant_id: TenantId) -> Tenant: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_by_id_using_get(tenant_id=tenant_id) + + def save_tenant(self, body: Optional[Tenant] = None) -> Tenant: + return self.tenant_controller.save_tenant_using_post(body=body) + + def get_tenants(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenant: + return self.tenant_controller.get_tenants_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_info_by_id(self, tenant_id: TenantId) -> TenantInfo: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_info_by_id_using_get(tenant_id=tenant_id) + + def delete_tenant(self, tenant_id: TenantId) -> None: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.delete_tenant_using_delete(tenant_id=tenant_id) + + # OTA Package Controller + def delete_ota_package(self, ota_package_id: OtaPackageId) -> None: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.delete_ota_package_using_delete(ota_package_id=ota_package_id) + + def get_ota_packages_v1(self, device_profile_id: DeviceProfileId, type: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + device_profile_id = self.get_id(device_profile_id) + return self.ota_package_controller.get_ota_packages_using_get1(device_profile_id=device_profile_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_ota_package_data(self, ota_package_id: OtaPackageId, checksum: Optional[str] = None, + checksum_algorithm: Optional[str] = None, file: Optional[str] = None) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.save_ota_package_data_using_post(ota_package_id=ota_package_id, + checksum=checksum, + checksum_algorithm=checksum_algorithm, + file=file) + + def save_ota_package_info(self, body: Optional[SaveOtaPackageInfoRequest] = None) -> OtaPackageInfo: + return self.ota_package_controller.save_ota_package_info_using_post(body=body) + + def get_ota_packages(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + return self.ota_package_controller.get_ota_packages_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_ota_package_by_id(self, ota_package_id: OtaPackageId) -> OtaPackage: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_by_id_using_get(ota_package_id=ota_package_id) + + def download_ota_package(self, ota_package_id: OtaPackageId) -> Resource: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.download_ota_package_using_get(ota_package_id=ota_package_id) + + def get_ota_package_info_by_id(self, ota_package_id: OtaPackageId) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_info_by_id_using_get(ota_package_id=ota_package_id) + + def assign_alarm(self, alarm_id: AlarmId, assignee_id: str) -> Alarm: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.assign_alarm_using_post(alarm_id=alarm_id, assignee_id=assignee_id) + + # Asset Profile Controller + def delete_asset_profile(self, asset_profile_id: str): + return self.asset_profile_controller.delete_asset_profile_using_delete(asset_profile_id=asset_profile_id) + + def get_asset_profile_by_id(self, asset_profile_id: str) -> AssetProfile: + return self.asset_profile_controller.get_asset_profile_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_info_by_id(self, asset_profile_id: str) -> AssetProfileInfo: + return self.asset_profile_controller.get_asset_profile_info_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfileInfo: + return self.asset_profile_controller.get_asset_profile_infos_using_get(page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_asset_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfile: + return self.asset_profile_controller.get_asset_profiles_using_get(page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_default_asset_profile_info(self) -> AssetProfileInfo: + return self.asset_profile_controller.get_default_asset_profile_info_using_get() + + def save_asset_profile(self, body: AssetProfile) -> AssetProfile: + return self.asset_profile_controller.save_asset_profile_using_post(body=body) + + def set_default_asset_profile(self, asset_profile_id: str) -> AssetProfile: + return self.asset_profile_controller.set_default_asset_profile_using_post(asset_profile_id=asset_profile_id) diff --git a/billinglayer/python/tb_rest_client/rest_client_pe.py b/billinglayer/python/tb_rest_client/rest_client_pe.py new file mode 100644 index 0000000..59daf63 --- /dev/null +++ b/billinglayer/python/tb_rest_client/rest_client_pe.py @@ -0,0 +1,1806 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from tb_rest_client.rest_client_base import * +from tb_rest_client.api.api_pe import * +from tb_rest_client.api.api_pe import DashboardControllerApi +from tb_rest_client.models.models_pe import * + +logger = getLogger(__name__) + + +class RestClientPE(RestClientBase): + def __init__(self, base_url): + super().__init__(base_url) + + def login(self, username, password): + super(RestClientPE, self).login(username=username, password=password) + self.__load_controllers() + + def public_login(self, public_id): + super(RestClientPE, self).public_login(public_id=public_id) + self.__load_controllers() + + def token_login(self, token, refresh_token=None): + super(RestClientPE, self).token_login(token=token, refresh_token=refresh_token) + self.__load_controllers() + + # Self Registration Controller + def get_privacy_policy(self, ) -> str: + return self.self_registration_controller.get_privacy_policy_using_get() + + def get_self_registration_params(self, ) -> SelfRegistrationParams: + return self.self_registration_controller.get_self_registration_params_using_get() + + def get_sign_up_self_registration_params(self, pkg_name: Optional[str] = None) -> SignUpSelfRegistrationParams: + return self.self_registration_controller.get_sign_up_self_registration_params_using_get(pkg_name=pkg_name) + + def get_terms_of_use(self, ) -> str: + return self.self_registration_controller.get_terms_of_use_using_get() + + def delete_self_registration_params(self, domain_name: str): + return self.self_registration_controller.delete_self_registration_params_using_delete(domain_name=domain_name) + + def save_self_registration_params(self, body: Optional[SelfRegistrationParams] = None) -> SelfRegistrationParams: + return self.self_registration_controller.save_self_registration_params_using_post(body=body) + + # O Auth 2 Config Template Controller + def delete_client_registration_template(self, client_registration_template_id: EntityId) -> None: + client_registration_template_id = self.get_id(client_registration_template_id) + return self.o_auth2_config_template_controller.delete_client_registration_template_using_delete( + client_registration_template_id=client_registration_template_id) + + def get_client_registration_templates(self, ) -> List[OAuth2ClientRegistrationTemplate]: + return self.o_auth2_config_template_controller.get_client_registration_templates_using_get() + + def save_client_registration_template(self, body: Optional[OAuth2ClientRegistrationTemplate] = None) -> OAuth2ClientRegistrationTemplate: + return self.o_auth2_config_template_controller.save_client_registration_template_using_post(body=body) + + # HTTP Integration Controller + def http_check_status_get(self, routing_key: str, request_params: dict, request_headers: dict): + return self.http_integration_controller.check_status_using_get(routing_key=routing_key, + request_params=request_params, + request_headers=request_headers) + + def http_process_request_v1_post1(self, routing_key: str, suffix: str): + return self.http_integration_controller.process_request_using_post1(routing_key=routing_key, suffix=suffix) + + def http_process_request_v2_post2(self, routing_key: str, suffix: str): + return self.http_integration_controller.process_request_using_post2(routing_key=routing_key, suffix=suffix) + + def get_asset_types(self, ) -> List[EntitySubtype]: + return self.asset_controller.get_asset_types_using_get() + + def find_by_query(self, body: Optional[AssetSearchQuery] = None) -> List[Asset]: + return self.asset_controller.find_by_query_using_post(body=body) + + def get_tenant_assets(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAsset: + return self.asset_controller.get_tenant_assets_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + # Asset Controller + def process_asset_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultAsset: + return self.asset_controller.process_asset_bulk_import_using_post(body=body) + + def save_asset(self, body: Optional[Asset] = None, entity_group_id: EntityGroupId = None, entity_group_ids: Optional[str] = None): + entity_group_id = self.get_id(entity_group_id) + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + return self.asset_controller.save_asset_using_post(body=body, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def get_all_customer_infos(self, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataCustomerInfo: + return self.customer_controller.get_all_customer_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_customer_customer_infos(self, customer_id: CustomerId, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataCustomerInfo: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_customer_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + customer_id=customer_id) + + def get_customer_info_by_id(self, customer_id: CustomerId) -> CustomerInfo: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_info_by_id_using_get(customer_id=customer_id) + + def get_assets_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataAsset: + entity_group_id = self.get_id(entity_group_id) + return self.asset_controller.get_assets_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_assets(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAsset: + if asset_profile_id: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_user_assets_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, asset_profile_id=asset_profile_id) + + def delete_device_group_ota_package(self, id: str) -> None: + return self.device_group_ota_package_controller.delete_device_group_ota_package_using_delete(id=id) + + def get_firmware_by_id(self, group_id: EntityGroupId, firmware_type: str) -> DeviceGroupOtaPackage: + group_id = self.get_id(group_id) + return self.device_group_ota_package_controller.get_firmware_by_id_using_get(group_id=group_id, + firmware_type=firmware_type) + + def save_device_group_ota_package(self, body: Optional[DeviceGroupOtaPackage] = None) -> DeviceGroupOtaPackage: + return self.device_group_ota_package_controller.save_device_group_ota_package_using_post(body=body) + + def find_by_query_v2(self, body: Optional[EdgeSearchQuery] = None) -> List[Edge]: + return self.edge_controller.find_by_query_using_post2(body=body) + + def check_instance(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.edge_controller.check_instance_using_post(body=body) + + def get_tenant_edges(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_tenant_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def find_missing_to_related_rule_chains(self, edge_id: EdgeId) -> str: + edge_id = self.get_id(edge_id) + return self.edge_controller.find_missing_to_related_rule_chains_using_get(edge_id=edge_id) + + def get_customer_edges(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edges_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def process_edges_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultEdge: + return self.edge_controller.process_edges_bulk_import_using_post(body=body) + + def activate_instance(self, license_secret: str, release_date: str) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.edge_controller.activate_instance_using_post(license_secret=license_secret, + release_date=release_date) + + def get_tenant_edge(self, edge_name: str) -> Edge: + return self.edge_controller.get_tenant_edge_using_get(edge_name=edge_name) + + def get_edge_by_id(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_by_id_using_get(edge_id=edge_id) + + def get_user_edges(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_user_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def delete_edge(self, edge_id: EdgeId) -> None: + edge_id = self.get_id(edge_id) + return self.edge_controller.delete_edge_using_delete(edge_id=edge_id) + + def save_edge(self, body: Optional[Edge] = None) -> Edge: + return self.edge_controller.save_edge_using_post(body=body) + + def is_edges_support_enabled(self, ) -> bool: + return self.edge_controller.is_edges_support_enabled_using_get() + + def get_edges(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_edges_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edge_types(self, ) -> List[EntitySubtype]: + return self.edge_controller.get_edge_types_using_get() + + def set_edge_root_rule_chain(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> Edge: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.edge_controller.set_edge_root_rule_chain_using_post(edge_id=edge_id, rule_chain_id=rule_chain_id) + + def get_edges_by_ids(self, edge_ids: list) -> List[Edge]: + return self.edge_controller.get_edges_by_ids_using_get(edge_ids=str(edge_ids)) + + def ocean_connect_process_request_v2_delete2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_delete2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_get2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_get2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_head2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_head2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_options2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_options2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_patch2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_patch2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v10_post10(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_post10(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_put2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_put2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def get_allowed_permissions(self, ) -> AllowedPermissionsInfo: + return self.user_permissions_controller.get_allowed_permissions_using_get() + + def change_owner_to_customer(self, owner_id: UserId, entity_id: EntityId, body: Optional[List[str]] = None) -> None: + owner_id = self.get_id(owner_id) + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + if body: + body = ','.join(body) + return self.owner_controller.change_owner_to_customer_using_post(owner_id=owner_id, entity_type=entity_type, + entity_id=entity_id, body=body) + + def change_owner_to_tenant(self, owner_id: UserId, entity_id: EntityId, body: Optional[List[str]] = None) -> None: + owner_id = self.get_id(owner_id) + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + if body: + body = ','.join(body) + return self.owner_controller.change_owner_to_tenant_using_post(owner_id=owner_id, entity_type=entity_type, + entity_id=entity_id, body=body) + + def get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def rpc_v2_get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def get_user_customers(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataCustomer: + return self.customer_controller.get_user_customers_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def handle_one_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_one_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_two_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def get_persisted_rpc_by_device(self, device_id: DeviceId, page_size: int, page: int, rpc_status: str, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.get_persisted_rpc_by_device_using_get(device_id=device_id, page_size=page_size, + page=page, rpc_status=rpc_status, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_customers_by_ids(self, customer_ids: str) -> List[Customer]: + return self.customer_controller.get_customers_by_ids_using_get(customer_ids=customer_ids) + + def get_edge_events(self, edge_id: EdgeId, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataEdgeEvent: + edge_id = self.get_id(edge_id) + return self.edge_event_controller.get_edge_events_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + def get_customers_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataCustomer: + entity_group_id = self.get_id(entity_group_id) + return self.customer_controller.get_customers_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_customer_title_by_id(self, customer_id: CustomerId) -> str: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_title_by_id_using_get(customer_id=customer_id) + + def get_customers(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataCustomer: + return self.customer_controller.get_customers_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_customer_by_id(self, customer_id: CustomerId) -> Customer: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_by_id_using_get(customer_id=customer_id) + + def get_short_customer_info_by_id(self, customer_id: CustomerId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_short_customer_info_by_id_using_get(customer_id=customer_id) + + def save_customer(self, body: Optional[Customer] = None, entity_group_id: Optional[EntityGroupId] = None, entity_group_ids: Optional[List[str]] = None) -> Customer: + if entity_group_id: + entity_group_id = self.get_id(entity_group_id) + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + return self.customer_controller.save_customer_using_post(body=body, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def get_tenant_customer(self, customer_title: str) -> Customer: + return self.customer_controller.get_tenant_customer_using_get(customer_title=customer_title) + + def delete_customer(self, customer_id: CustomerId) -> None: + customer_id = self.get_id(customer_id) + return self.customer_controller.delete_customer_using_delete(customer_id=customer_id) + + def get_user_token(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.get_user_token_using_get(user_id=user_id) + + def get_activation_link(self, user_id: UserId) -> str: + user_id = self.get_id(user_id) + return self.user_controller.get_activation_link_using_get(user_id=user_id) + + def get_user_users(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataUser: + return self.user_controller.get_user_users_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def delete_user(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.delete_user_using_delete(user_id=user_id) + + def get_all_customer_users(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataUser: + return self.user_controller.get_all_customer_users_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def set_user_credentials_enabled(self, user_id: UserId, user_credentials_enabled: Optional[bool] = None) -> None: + user_id = self.get_id(user_id) + return self.user_controller.set_user_credentials_enabled_using_post(user_id=user_id, + user_credentials_enabled=user_credentials_enabled) + + def get_customer_users(self, customer_id: CustomerId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataUser: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_users_using_get(customer_id=customer_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_user_by_id(self, user_id: UserId) -> User: + user_id = self.get_id(user_id) + return self.user_controller.get_user_by_id_using_get(user_id=user_id) + + def get_tenant_admins(self, tenant_id: TenantId, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataUser: + tenant_id = self.get_id(tenant_id) + return self.user_controller.get_tenant_admins_using_get(tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def is_user_token_access_enabled(self, ) -> bool: + return self.user_controller.is_user_token_access_enabled_using_get() + + def get_users_by_ids(self, user_ids: list) -> List[User]: + return self.user_controller.get_users_by_ids_using_get(user_ids=str(user_ids)) + + def save_user(self, body: Optional[User] = None, send_activation_mail: Optional[bool] = None, entity_group_id: Optional[EntityGroupId] = None, entity_group_ids: Optional[List[str]] = None) -> User: + if entity_group_id: + entity_group_id = self.get_id(entity_group_id) + + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + + return self.user_controller.save_user_using_post(body=body, send_activation_mail=send_activation_mail, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def send_activation_email(self, email: str) -> None: + return self.user_controller.send_activation_email_using_post(email=email) + + def get_users_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataUser: + entity_group_id = self.get_id(entity_group_id) + return self.user_controller.get_users_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_group_permission(self, group_permission_id: GroupPermissionId) -> None: + group_permission_id = self.get_id(group_permission_id) + return self.group_permission_controller.delete_group_permission_using_delete( + group_permission_id=group_permission_id) + + def get_entity_group_permissions(self, entity_group_id: EntityGroupId) -> List[GroupPermissionInfo]: + entity_group_id = self.get_id(entity_group_id) + return self.group_permission_controller.get_entity_group_permissions_using_get(entity_group_id=entity_group_id) + + def get_group_permission_by_id(self, group_permission_id: GroupPermissionId) -> GroupPermission: + group_permission_id = self.get_id(group_permission_id) + return self.group_permission_controller.get_group_permission_by_id_using_get( + group_permission_id=group_permission_id) + + def get_group_permission_info_by_id(self, group_permission_id: GroupPermissionId, is_user_group: bool) -> GroupPermissionInfo: + group_permission_id = self.get_id(group_permission_id) + return self.group_permission_controller.get_group_permission_info_by_id_using_get( + group_permission_id=group_permission_id, is_user_group=is_user_group) + + def get_user_group_permissions(self, user_group_id: EntityId) -> List[GroupPermissionInfo]: + user_group_id = self.get_id(user_group_id) + return self.group_permission_controller.get_user_group_permissions_using_get(user_group_id=user_group_id) + + def load_user_group_permission_infos(self, body: Optional[List[GroupPermission]] = None) -> List[GroupPermissionInfo]: + return self.group_permission_controller.load_user_group_permission_infos_using_post(body=body) + + def save_group_permission(self, body: Optional[GroupPermission] = None) -> GroupPermission: + return self.group_permission_controller.save_group_permission_using_post(body=body) + + def get_device_types(self, ) -> List[EntitySubtype]: + return self.device_controller.get_device_types_using_get() + + def process_devices_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultDevice: + return self.device_controller.process_devices_bulk_import_using_post(body=body) + + def count_by_device_profile_and_empty_ota_package(self, ota_package_type: str, device_profile_id: DeviceProfileId) -> int: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.count_by_device_profile_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, device_profile_id=device_profile_id) + + def get_devices_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDevice: + entity_group_id = self.get_id(entity_group_id) + return self.device_controller.get_devices_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_devices_by_ids(self, device_ids: list) -> List[Device]: + device_ids = ','.join(device_ids) + return self.device_controller.get_devices_by_ids_using_get(device_ids=device_ids) + + def get_user_devices(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataDevice: + return self.device_controller.get_user_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def save_device_with_credentials(self, body: Optional[SaveDeviceWithCredentialsRequest] = None) -> Device: + return self.device_controller.save_device_with_credentials_using_post(body=body) + + def update_device_credentials(self, body: Optional[DeviceCredentials] = None) -> DeviceCredentials: + return self.device_controller.update_device_credentials_using_post(body=body) + + def save_device(self, body: Optional[Device], access_token: Optional[str] = None) -> Device: + return self.device_controller.save_device_using_post(body=body, access_token=access_token) + + def get_device_by_id(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.get_device_by_id_using_get(device_id=device_id) + + def get_tenant_devices(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataDevice: + return self.device_controller.get_tenant_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_customer_devices(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDevice: + customer_id = self.get_id(customer_id) + return self.device_controller.get_customer_devices_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def assign_device_to_tenant(self, tenant_id: TenantId, device_id: DeviceId) -> Device: + tenant_id = self.get_id(tenant_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_tenant_using_post(tenant_id=tenant_id, device_id=device_id) + + def find_by_query_v1(self, body: Optional[DeviceSearchQuery] = None) -> List[Device]: + return self.device_controller.find_by_query_using_post1(body=body) + + def count_by_device_group_and_empty_ota_package(self, ota_package_type: str, ota_package_id: OtaPackageId, + entity_group_id: EntityGroupId) -> int: + ota_package_id = self.get_id(ota_package_id) + entity_group_id = self.get_id(entity_group_id) + return self.device_controller.count_by_device_group_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, ota_package_id=ota_package_id, entity_group_id=entity_group_id) + + def delete_device(self, device_id: DeviceId) -> None: + device_id = self.get_id(device_id) + return self.device_controller.delete_device_using_delete(device_id=device_id) + + def re_claim_device(self, device_name: str): + return self.device_controller.re_claim_device_using_delete(device_name=device_name) + + def get_tenant_device(self, device_name: str) -> Device: + return self.device_controller.get_tenant_device_using_get(device_name=device_name) + + def get_device_credentials_by_device_id(self, device_id: DeviceId) -> DeviceCredentials: + device_id = self.get_id(device_id) + return self.device_controller.get_device_credentials_by_device_id_using_get(device_id=device_id) + + def delete_converter(self, converter_id: ConverterId) -> None: + converter_id = self.get_id(converter_id) + return self.converter_controller.delete_converter_using_delete(converter_id=converter_id) + + def get_converter_by_id(self, converter_id: ConverterId) -> Converter: + converter_id = self.get_id(converter_id) + return self.converter_controller.get_converter_by_id_using_get(converter_id=converter_id) + + def get_converters_by_ids(self, converter_ids: list) -> List[Converter]: + converter_ids = ','.join(converter_ids) + return self.converter_controller.get_converters_by_ids_using_get(converter_ids=converter_ids) + + def get_converters(self, page_size: int, page: int, is_edge_template: Optional[bool] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataConverter: + return self.converter_controller.get_converters_using_get(page_size=page_size, page=page, + is_edge_template=is_edge_template, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_latest_converter_debug_input(self, converter_id: ConverterId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + converter_id = self.get_id(converter_id) + return self.converter_controller.get_latest_converter_debug_input_using_get(converter_id=converter_id) + + def assign_integration_to_edge(self, edge_id: EdgeId, integration_id: IntegrationId) -> Integration: + edge_id = self.get_id(edge_id) + integration_id = self.get_id(integration_id) + return self.integration_controller.assign_integration_to_edge_using_post(edge_id=edge_id, + integration_id=integration_id) + + def unassign_integration_from_edge(self, edge_id: EdgeId, integration_id: IntegrationId) -> Integration: + edge_id = self.get_id(edge_id) + integration_id = self.get_id(integration_id) + return self.integration_controller.unassign_integration_from_edge_using_delete(edge_id=edge_id, + integration_id=integration_id) + + def get_edge_integrations(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataIntegration: + edge_id = self.get_id(edge_id) + return self.integration_controller.get_edge_integrations_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_all_related_edges_missing_attributes(self, integration_id: IntegrationId) -> str: + integration_id = self.get_id(integration_id) + return self.integration_controller.find_all_related_edges_missing_attributes_using_get( + integration_id=integration_id) + + def get_edge_integration_infos(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, ) -> PageDataIntegrationInfo: + edge_id = self.get_id(edge_id) + return self.integration_controller.get_edge_integration_infos_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_edge_missing_attributes_get(self, edge_id: EdgeId, integration_ids: str) -> str: + edge_id = self.get_id(edge_id) + return self.integration_controller.find_edge_missing_attributes_using_get(edge_id=edge_id, + integration_ids=integration_ids) + + def save_converter(self, body: Optional[Converter] = None) -> Converter: + return self.converter_controller.save_converter_using_post(body=body) + + def test_down_link_converter(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None, script_lang: Optional[str] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.converter_controller.test_down_link_converter_using_post(body=body, script_lang=script_lang) + + def test_up_link_converter(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None, script_lang: Optional[str] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.converter_controller.test_up_link_converter_using_post(body=body, script_lang=script_lang) + + def get_entity_view_types(self, ) -> List[EntitySubtype]: + return self.entity_view_controller.get_entity_view_types_using_get() + + def delete_entity_view(self, entity_view_id: EntityViewId) -> None: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.delete_entity_view_using_delete(entity_view_id=entity_view_id) + + def get_entity_view_by_id(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_by_id_using_get(entity_view_id=entity_view_id) + + def get_tenant_entity_view(self, entity_view_name: str) -> EntityView: + return self.entity_view_controller.get_tenant_entity_view_using_get(entity_view_name=entity_view_name) + + def get_user_entity_views(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataEntityView: + return self.entity_view_controller.get_user_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_views_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataEntityView: + entity_group_id = self.get_id(entity_group_id) + return self.entity_view_controller.get_entity_views_by_entity_group_id_using_get( + entity_group_id=entity_group_id, page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_entity_views_by_ids(self, entity_view_ids: list) -> List[EntityView]: + entity_view_ids = ','.join(entity_view_ids) + return self.entity_view_controller.get_entity_views_by_ids_using_get(entity_view_ids=entity_view_ids) + + def save_entity_view(self, body: Optional[EntityView] = None, entity_group_id: Optional[EntityGroupId] = None, entity_group_ids: Optional[List[str]] = None) -> EntityView: + if entity_group_id: + entity_group_id = self.get_id(entity_group_id) + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + return self.entity_view_controller.save_entity_view_using_post(body=body, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def get_tenant_entity_views(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataEntityView: + return self.entity_view_controller.get_tenant_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_by_query_v4(self, body: Optional[EntityViewSearchQuery] = None) -> List[EntityView]: + return self.entity_view_controller.find_by_query_using_post4(body=body) + + def get_customer_entity_views(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataEntityView: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_views_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def handle_rule_engine_request(self, entity_id: EntityId, timeout: int, body: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.rule_engine_controller.handle_rule_engine_request_using_post(entity_type=entity_type, + entity_id=entity_id, timeout=timeout, + body=body) + + def handle_rule_engine_request_v1(self, entity_id: EntityId, body: Optional[str] = None, + queue_name: Optional[str] = None, + timeout: Optional[int] = None) -> DeferredResultResponseEntity: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.rule_engine_controller.handle_rule_engine_request_using_post1(entity_type=entity_type, + entity_id=entity_id, body=body, + queue_nam=queue_name, timeout=timeout) + + def handle_rule_engine_request_v2(self, entity_id: EntityId, body: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.rule_engine_controller.handle_rule_engine_request_using_post2(entity_type=entity_type, + entity_id=entity_id, body=body) + + def get_admin_settings(self, key: str, system_by_default=None) -> AdminSettings: + return self.admin_controller.get_admin_settings_using_get(key=key, system_by_default=system_by_default) + + def t_mobile_iot_cdp_process_request_v4_delete4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_delete4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_get4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_get4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_head4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_head4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_options4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_options4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_patch4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_patch4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v12_post12(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_post12(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_put4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_put4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sign_up(self, body: Optional[SignUpRequest] = None) -> str: + return self.sign_up_controller.sign_up_using_post(body=body) + + def resend_email_activation(self, email: str, pkg_name: Optional[str] = None) -> None: + return self.sign_up_controller.resend_email_activation_using_post(email=email, pkg_name=pkg_name) + + def activate_user_by_email_code(self, email_code: str, pkg_name: Optional[str] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.sign_up_controller.activate_user_by_email_code_using_post(email_code=email_code, pkg_name=pkg_name) + + def privacy_policy_accepted(self, ) -> bool: + return self.sign_up_controller.privacy_policy_accepted_using_get() + + def accept_terms_of_use(self, ) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.sign_up_controller.accept_terms_of_use_using_post() + + def activate_email(self, email_code: str, pkg_name: Optional[str] = None) -> str: + return self.sign_up_controller.activate_email_using_get(email_code=email_code, pkg_name=pkg_name) + + def mobile_login(self, pkg_name: str) -> str: + return self.sign_up_controller.mobile_login_using_get(pkg_name=pkg_name) + + def terms_of_use_accepted(self, ) -> bool: + return self.sign_up_controller.terms_of_use_accepted_using_get() + + def get_device_profiles_by_ids(self, device_profile_ids: list) -> List[DeviceProfileInfo]: + device_profile_ids = ','.join(device_profile_ids) + return self.device_profile_controller.get_device_profiles_by_ids_using_get( + device_profile_ids=device_profile_ids) + + def delete_device_v1(self, ) -> None: + return self.trail_controller.delete_device_using_delete1() + + def thing_park_process_request_tpe_delete(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_delete(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_get(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_get(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_head(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_head(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_options(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_options(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_patch(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_patch(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_post(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_post(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_put(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_put(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_delete5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_delete5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_get5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_get5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_head5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_head5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_options5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_options5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_patch5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_patch5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v13_post13(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_post13(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_put5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_put5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def sig_fox_process_request_v3_delete3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_delete3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_get3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_get3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_head3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_head3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_options3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_options3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_patch3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_patch3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v11_post11(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_post11(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_put3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_put3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def assign_scheduler_event_to_edge(self, edge_id: EdgeId, scheduler_event_id: SchedulerEventId) -> SchedulerEventInfo: + edge_id = self.get_id(edge_id) + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.assign_scheduler_event_to_edge_using_post(edge_id=edge_id, + scheduler_event_id=scheduler_event_id) + + def delete_scheduler_event(self, scheduler_event_id: SchedulerEventId) -> None: + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.delete_scheduler_event_using_delete( + scheduler_event_id=scheduler_event_id) + + def get_all_scheduler_events(self, edge_id: EdgeId) -> List[SchedulerEventInfo]: + edge_id = self.get_id(edge_id) + return self.scheduler_event_controller.get_all_scheduler_events_using_get(edge_id=edge_id) + + def get_edge_scheduler_events(self, edge_id: EdgeId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataSchedulerEventInfo: + edge_id = self.get_id(edge_id) + return self.scheduler_event_controller.get_edge_scheduler_events_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_scheduler_event_by_id(self, scheduler_event_id: SchedulerEventId) -> SchedulerEvent: + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.get_scheduler_event_by_id_using_get( + scheduler_event_id=scheduler_event_id) + + def get_scheduler_event_info_by_id(self, scheduler_event_id: SchedulerEventId) -> SchedulerEventWithCustomerInfo: + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.get_scheduler_event_info_by_id_using_get( + scheduler_event_id=scheduler_event_id) + + def get_scheduler_events_by_ids(self, scheduler_event_ids: list) -> List[SchedulerEventInfo]: + return self.scheduler_event_controller.get_scheduler_events_by_ids_using_get( + scheduler_event_ids=str(scheduler_event_ids)) + + def get_scheduler_events(self, type: Optional[str] = None) -> List[SchedulerEventWithCustomerInfo]: + return self.scheduler_event_controller.get_scheduler_events_using_get(type=type) + + def save_scheduler_event(self, body: Optional[SchedulerEvent] = None) -> SchedulerEvent: + return self.scheduler_event_controller.save_scheduler_event_using_post(body=body) + + def unassign_scheduler_event_from_edge(self, edge_id: EdgeId, scheduler_event_id: SchedulerEventId) -> SchedulerEventInfo: + edge_id = self.get_id(edge_id) + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.unassign_scheduler_event_from_edge_using_delete(edge_id=edge_id, + scheduler_event_id=scheduler_event_id) + + def download_dashboard_report(self, dashboard_id: DashboardId, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + dashboard_id = self.get_id(dashboard_id) + return self.report_controller.download_dashboard_report_using_post(dashboard_id=dashboard_id, body=body) + + def download_test_report(self, body: Optional[ReportConfig], reports_server_endpoint_url: Optional[str] = None): + return self.report_controller.download_test_report_using_post(body=body, + reports_server_endpoint_url=reports_server_endpoint_url) + + def get_server_time(self, ) -> int: + return self.dashboard_controller.get_server_time_using_get() + + def get_dashboards_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDashboardInfo: + entity_group_id = self.get_id(entity_group_id) + return self.dashboard_controller.get_dashboards_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_by_id(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_by_id_using_get(dashboard_id=dashboard_id) + + def delete_dashboard(self, dashboard_id: DashboardId) -> None: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.delete_dashboard_using_delete(dashboard_id=dashboard_id) + + def save_dashboard(self, body: Optional[Dashboard] = None) -> Dashboard: + return self.dashboard_controller.save_dashboard_using_post(body=body) + + def get_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_home_dashboard_info_using_get() + + def get_tenant_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_tenant_home_dashboard_info_using_get() + + def set_customer_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_customer_home_dashboard_info_using_post(body=body) + + def get_edge_docker_install_instructions(self, edge_id: EdgeId) -> EdgeInstallInstructions: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_docker_install_instructions_using_get(edge_id=edge_id) + + def get_tenant_dashboards_v1(self, tenant_id: TenantId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDashboardInfo: + tenant_id = self.get_id(tenant_id) + return self.dashboard_controller.get_tenant_dashboards_using_get1(tenant_id=tenant_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_info_by_id(self, dashboard_id: DashboardId) -> DashboardInfo: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_info_by_id_using_get(dashboard_id=dashboard_id) + + def get_home_dashboard(self, ) -> HomeDashboard: + return self.dashboard_controller.get_home_dashboard_using_get() + + def get_max_datapoints_limit(self, ) -> int: + return self.dashboard_controller.get_max_datapoints_limit_using_get() + + def get_dashboards_by_ids(self, dashboard_ids: list) -> List[DashboardInfo]: + dashboard_ids = ','.join(dashboard_ids) + return self.dashboard_controller.get_dashboards_by_ids_using_get(dashboard_ids=dashboard_ids) + + def get_customer_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_customer_home_dashboard_info_using_get() + + def get_tenant_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_tenant_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, operation: Optional[str] = None, user_id: Optional[str] = None) -> PageDataDashboardInfo: + user_id = self.get_id(user_id) + return self.dashboard_controller.get_user_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, operation=operation, + user_id=user_id) + + def import_group_dashboards(self, entity_group_id: EntityGroupId, body: Optional[List[Dashboard]] = None, overwrite: Optional[bool] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.dashboard_controller.import_group_dashboards_using_post(entity_group_id=entity_group_id, body=body, + overwrite=overwrite) + + def set_tenant_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_tenant_home_dashboard_info_using_post(body=body) + + def export_group_dashboards(self, entity_group_id: EntityGroupId, limit: int) -> List[Dashboard]: + entity_group_id = self.get_id(entity_group_id) + return self.dashboard_controller.export_group_dashboards_using_get(entity_group_id=entity_group_id, limit=limit) + + def check_integration_connection(self, body: Optional[Integration] = None) -> None: + return self.integration_controller.check_integration_connection_using_post(body=body) + + def delete_integration(self, integration_id: IntegrationId) -> None: + integration_id = self.get_id(integration_id) + return self.integration_controller.delete_integration_using_delete(integration_id=integration_id) + + def get_integration_by_id(self, integration_id: IntegrationId) -> Integration: + integration_id = self.get_id(integration_id) + return self.integration_controller.get_integration_by_id_using_get(integration_id=integration_id) + + def get_integration_by_routing_key(self, routing_key: str) -> Integration: + return self.integration_controller.get_integration_by_routing_key_using_get(routing_key=routing_key) + + def get_integrations_by_ids(self, integration_ids: list) -> List[Integration]: + integration_ids = ','.join(integration_ids) + return self.integration_controller.get_integrations_by_ids_using_get(integration_ids=integration_ids) + + def get_integration_infos(self, page_size: int, page: int, is_edge_template: Optional[bool], + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataIntegrationInfo: + return self.integration_controller.get_integration_infos_using_get(page_size=page_size, page=page, + is_edge_template=is_edge_template, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_integrations(self, page_size: int, page: int, is_edge_template: Optional[bool], text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataIntegration: + return self.integration_controller.get_integrations_using_get(page_size=page_size, page=page, + is_edge_template=is_edge_template, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_integration(self, body: Optional[Integration] = None) -> Integration: + return self.integration_controller.save_integration_using_post(body=body) + + def get_current_custom_menu(self, ) -> CustomMenu: + return self.custom_menu_controller.get_current_custom_menu_using_get() + + def get_custom_menu(self, ) -> CustomMenu: + return self.custom_menu_controller.get_custom_menu_using_get() + + def save_custom_menu(self, body: Optional[CustomMenu] = None) -> CustomMenu: + return self.custom_menu_controller.save_custom_menu_using_post(body=body) + + def get_lwm2m_bootstrap_security_info(self, is_bootstrap_server: bool) -> ServerSecurityConfig: + return self.lwm2m_controller.get_lwm2m_bootstrap_security_info_using_get( + is_bootstrap_server=is_bootstrap_server) + + def get_current_custom_translation(self, ) -> CustomTranslation: + return self.custom_translation_controller.get_current_custom_translation_using_get() + + def get_custom_translation(self, ) -> CustomTranslation: + return self.custom_translation_controller.get_custom_translation_using_get() + + def save_custom_translation(self, body: Optional[CustomTranslation] = None) -> CustomTranslation: + return self.custom_translation_controller.save_custom_translation_using_post(body=body) + + def delete_role(self, role_id: RoleId) -> None: + role_id = self.get_id(role_id) + return self.role_controller.delete_role_using_delete(role_id=role_id) + + def get_role_by_id(self, role_id: RoleId) -> Role: + role_id = self.get_id(role_id) + return self.role_controller.get_role_by_id_using_get(role_id=role_id) + + def get_roles_by_ids(self, role_ids: list) -> List[Role]: + role_ids = ','.join(role_ids) + return self.role_controller.get_roles_by_ids_using_get(role_ids=role_ids) + + def get_roles(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, ) -> PageDataRole: + return self.role_controller.get_roles_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def save_role(self, body: Optional[Role] = None) -> Role: + return self.role_controller.save_role_using_post(body=body) + + def delete_blob_entity(self, blob_entity_id: BlobEntityId) -> None: + blob_entity_id = self.get_id(blob_entity_id) + return self.blob_entity_controller.delete_blob_entity_using_delete(blob_entity_id=blob_entity_id) + + def download_blob_entity(self, blob_entity_id: BlobEntityId) -> Resource: + blob_entity_id = self.get_id(blob_entity_id) + return self.blob_entity_controller.download_blob_entity_using_get(blob_entity_id=blob_entity_id) + + def get_blob_entities_by_ids(self, blob_entity_ids: list) -> List[BlobEntityInfo]: + return self.blob_entity_controller.get_blob_entities_by_ids_using_get(blob_entity_ids=str(blob_entity_ids)) + + def get_blob_entities(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataBlobEntityWithCustomerInfo: + return self.blob_entity_controller.get_blob_entities_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + def get_blob_entity_info_by_id(self, blob_entity_id: BlobEntityId) -> BlobEntityWithCustomerInfo: + blob_entity_id = self.get_id(blob_entity_id) + return self.blob_entity_controller.get_blob_entity_info_by_id_using_get(blob_entity_id=blob_entity_id) + + def loriot_process_request_v1_delete1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_delete1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_get1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_get1(body=body, request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_head1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_head1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_options1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_options1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_patch1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_patch1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v9_post9(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_post9(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_put1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_put1(body=body, request_headers=request_headers, + routing_key=routing_key) + + def get_tenant_infos(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataTenantInfo: + return self.tenant_controller.get_tenant_infos_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_by_id(self, tenant_id: TenantId) -> Tenant: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_by_id_using_get(tenant_id=tenant_id) + + def save_tenant(self, body: Optional[Tenant] = None) -> Tenant: + return self.tenant_controller.save_tenant_using_post(body=body) + + def get_tenants(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataTenant: + return self.tenant_controller.get_tenants_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenants_by_ids(self, tenant_ids: list) -> List[Tenant]: + return self.tenant_controller.get_tenants_by_ids_using_get(tenant_ids=str(tenant_ids)) + + def get_tenant_info_by_id(self, tenant_id: TenantId) -> TenantInfo: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_info_by_id_using_get(tenant_id=tenant_id) + + def delete_tenant(self, tenant_id: TenantId) -> None: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.delete_tenant_using_delete(tenant_id=tenant_id) + + def chirp_stack_process_request_delete(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_delete(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_get(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_get(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_head(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_head(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_options(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_options(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_patch(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_patch(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_post(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_post(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_put(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_put(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def get_current_login_white_label_params(self, ) -> LoginWhiteLabelingParams: + return self.white_labeling_controller.get_current_login_white_label_params_using_get() + + def get_current_white_label_params(self, ) -> WhiteLabelingParams: + return self.white_labeling_controller.get_current_white_label_params_using_get() + + def get_login_white_label_params(self, logo_image_checksum: str, favicon_checksum: str) -> LoginWhiteLabelingParams: + return self.white_labeling_controller.get_login_white_label_params_using_get( + logo_image_checksum=logo_image_checksum, favicon_checksum=favicon_checksum) + + def get_white_label_params(self, logo_image_checksum: str, favicon_checksum: str) -> WhiteLabelingParams: + return self.white_labeling_controller.get_white_label_params_using_get(logo_image_checksum=logo_image_checksum, + favicon_checksum=favicon_checksum) + + def get_widgets_bundles_by_ids(self, widget_bundle_ids: List[str]) -> List[WidgetsBundle]: + widget_bundle_ids = ','.join(widget_bundle_ids) + return self.widgets_bundle_controller.get_widgets_bundles_by_ids_using_get(widget_bundle_ids=widget_bundle_ids) + + def is_customer_white_labeling_allowed(self, ) -> bool: + return self.white_labeling_controller.is_customer_white_labeling_allowed_using_get() + + def is_white_labeling_allowed(self, ) -> bool: + return self.white_labeling_controller.is_white_labeling_allowed_using_get() + + def preview_white_label_params(self, body: Optional[WhiteLabelingParams] = None) -> WhiteLabelingParams: + return self.white_labeling_controller.preview_white_label_params_using_post(body=body) + + def save_login_white_label_params(self, body: Optional[LoginWhiteLabelingParams] = None) -> LoginWhiteLabelingParams: + return self.white_labeling_controller.save_login_white_label_params_using_post(body=body) + + def save_white_label_params(self, body: Optional[WhiteLabelingParams] = None) -> WhiteLabelingParams: + return self.white_labeling_controller.save_white_label_params_using_post(body=body) + + def delete_ota_package(self, ota_package_id: OtaPackageId) -> None: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.delete_ota_package_using_delete(ota_package_id=ota_package_id) + + def get_ota_packages_v1(self, device_profile_id: DeviceProfileId, type: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataOtaPackageInfo: + device_profile_id = self.get_id(device_profile_id) + return self.ota_package_controller.get_ota_packages_using_get1(device_profile_id=device_profile_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_ota_package_data(self, ota_package_id: OtaPackageId, checksum=None, checksum_algorithm: str = None, file=None) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.save_ota_package_data_using_post(checksum_algorithm=checksum_algorithm, + ota_package_id=ota_package_id, file=file, + checksum=checksum) + + def save_ota_package_info(self, body: Optional[SaveOtaPackageInfoRequest] = None) -> OtaPackageInfo: + return self.ota_package_controller.save_ota_package_info_using_post(body=body) + + def get_ota_packages(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataOtaPackageInfo: + return self.ota_package_controller.get_ota_packages_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_ota_package_by_id(self, ota_package_id: OtaPackageId) -> OtaPackage: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_by_id_using_get(ota_package_id=ota_package_id) + + def get_group_ota_packages(self, group_id: EntityGroupId, type: str, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataOtaPackageInfo: + group_id = self.get_id(group_id) + return self.ota_package_controller.get_group_ota_packages_using_get(group_id=group_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def download_ota_package(self, ota_package_id: OtaPackageId) -> Resource: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.download_ota_package_using_get(ota_package_id=ota_package_id) + + def get_ota_package_info_by_id(self, ota_package_id: OtaPackageId) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_info_by_id_using_get(ota_package_id=ota_package_id) + + def add_entities_to_entity_group(self, entity_group_id: EntityGroupId, body: Optional[List[str]] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.add_entities_to_entity_group_using_post(entity_group_id=entity_group_id, + body=body) + + def assign_entity_group_to_edge(self, edge_id: EdgeId, group_type: str, entity_group_id: EntityGroupId) -> EntityGroup: + edge_id = self.get_id(edge_id) + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.assign_entity_group_to_edge_using_post(edge_id=edge_id, + group_type=group_type, + entity_group_id=entity_group_id) + + def delete_entity_group(self, entity_group_id: EntityGroupId) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.delete_entity_group_using_delete(entity_group_id=entity_group_id) + + def get_all_edge_entity_groups(self, edge_id: EdgeId, group_type: str) -> List[EntityGroupInfo]: + edge_id = self.get_id(edge_id) + return self.entity_group_controller.get_all_edge_entity_groups_using_get(edge_id=edge_id, group_type=group_type) + + def get_edge_entity_groups(self, edge_id: EdgeId, group_type: str, page_size: int, page: int, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataEntityGroupInfo: + edge_id = self.get_id(edge_id) + return self.entity_group_controller.get_edge_entity_groups_using_get(edge_id=edge_id, group_type=group_type, + page_size=page_size, page=page, + sort_property=sort_property, + sort_order=sort_order) + + def get_entities(self, entity_group_id: EntityGroupId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataShortEntityView: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.get_entities_using_get(entity_group_id=entity_group_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_all_by_owner_and_type(self, owner_type: str, owner_id: UserId, group_type: str) -> EntityGroupInfo: + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_group_all_by_owner_and_type_using_get(owner_type=owner_type, + owner_id=owner_id, + group_type=group_type) + + def get_entity_groups_by_owner_and_type_and_page_link(self, owner_type: str, owner_id: UserId, group_type: str, + page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityGroupInfo: + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_groups_by_owner_and_type_and_page_link_using_get( + owner_type=owner_type, + owner_id=owner_id, + group_type=group_type, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_by_id(self, entity_group_id: EntityGroupId) -> EntityGroupInfo: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.get_entity_group_by_id_using_get(entity_group_id=entity_group_id) + + def get_entity_group_by_owner_and_name_and_type(self, owner_id: UserId, group_type: str, + group_name: str) -> EntityGroupInfo: + owner_type = self.get_type(owner_id) + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_group_by_owner_and_name_and_type_using_get(owner_type=owner_type, + owner_id=owner_id, + group_type=group_type, + group_name=group_name) + + def get_entity_groups_by_ids(self, entity_group_ids: List[str]) -> List[EntityGroupInfo]: + entity_group_ids = ','.join(entity_group_ids) + return self.entity_group_controller.get_entity_groups_by_ids_using_get(entity_group_ids=entity_group_ids) + + def get_entity_groups_by_owner_and_type(self, owner_type: str, owner_id: UserId, group_type: str) -> List[EntityGroupInfo]: + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_groups_by_owner_and_type_using_get(owner_type=owner_type, + owner_id=owner_id, + group_type=group_type) + + def get_entity_groups_by_type(self, group_type: str, include_shared: Optional[bool] = None) -> List[EntityGroupInfo]: + return self.entity_group_controller.get_entity_groups_by_type_using_get(group_type=group_type, include_shared=include_shared) + + def get_entity_groups_for_entity(self, entity_id: EntityId) -> List[EntityGroupId]: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entity_group_controller.get_entity_groups_for_entity_using_get(entity_type=entity_type, + entity_id=entity_id) + + def get_group_entity(self, entity_group_id: EntityGroupId, entity_id: EntityId) -> ShortEntityView: + entity_group_id = self.get_id(entity_group_id) + entity_id = self.get_id(entity_id) + return self.entity_group_controller.get_group_entity_using_get(entity_group_id=entity_group_id, + entity_id=entity_id) + + def get_owners(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataContactBasedobject: + return self.entity_group_controller.get_owners_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def make_entity_group_private(self, entity_group_id: EntityGroupId) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.make_entity_group_private_using_post(entity_group_id=entity_group_id) + + def make_entity_group_public(self, entity_group_id: EntityGroupId) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.make_entity_group_public_using_post(entity_group_id=entity_group_id) + + def remove_entities_from_entity_group(self, entity_group_id: EntityGroupId, body: Optional[List[str]] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.remove_entities_from_entity_group_using_post( + entity_group_id=entity_group_id, body=body) + + def save_entity_group(self, body: Optional[EntityGroup] = None) -> EntityGroupInfo: + return self.entity_group_controller.save_entity_group_using_post(body=body) + + def share_entity_group_to_child_owner_user_group(self, entity_group_id: EntityGroupId, user_group_id: EntityId, + role_id: RoleId) -> None: + entity_group_id = self.get_id(entity_group_id) + user_group_id = self.get_id(user_group_id) + role_id = self.get_id(role_id) + return self.entity_group_controller.share_entity_group_to_child_owner_user_group_using_post( + entity_group_id=entity_group_id, user_group_id=user_group_id, role_id=role_id) + + def share_entity_group(self, entity_group_id: EntityGroupId, body: Optional[ShareGroupRequest] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.share_entity_group_using_post(entity_group_id=entity_group_id, body=body) + + def unassign_entity_group_from_edge(self, edge_id: EdgeId, group_type: str, entity_group_id: EntityGroupId) -> EntityGroup: + edge_id = self.get_id(edge_id) + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.unassign_entity_group_from_edge_using_delete(edge_id=edge_id, + group_type=group_type, + entity_group_id=entity_group_id) + + # Subscription Controller + def get_tenant_profile_data_by_id(self, tenant_profile_id: TenantProfileId) -> TenantProfileData: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.subscription_controller.get_tenant_profile_data_by_id_using_get(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_data(self, ) -> TenantProfileData: + return self.subscription_controller.get_tenant_profile_data_using_get() + + def get_tenant_subscription_usage(self) -> SubscriptionUsage: + return self.subscription_controller.get_tenant_subscription_usage_using_get() + + # Solution Controller + def get_solution_template_details(self, solution_template_id) -> TenantSolutionTemplateDetails: + return self.solution_controller.get_solution_template_details_using_get( + solution_template_id=solution_template_id) + + def get_solution_template_infos(self) -> List[TenantSolutionTemplateInfo]: + return self.solution_controller.get_solution_template_infos_using_get() + + def get_solution_template_instructions(self, solution_template_id) -> TenantSolutionTemplateInstructions: + return self.solution_controller.get_solution_template_instructions_using_get( + solution_template_id=solution_template_id) + + def install_solution_template(self, solution_template_id) -> SolutionInstallResponse: + return self.solution_controller.install_solution_template_using_post(solution_template_id=solution_template_id) + + def uninstall_solution_template(self, solution_template_id) -> None: + return self.solution_controller.uninstall_solution_template_using_delete( + solution_template_id=solution_template_id) + + # Asset Profile Controller + def delete_asset_profile(self, asset_profile_id: AssetProfileId): + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.delete_asset_profile_using_delete(asset_profile_id=asset_profile_id) + + def get_asset_profile_by_id(self, asset_profile_id: AssetProfileId) -> AssetProfile: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.get_asset_profile_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_info_by_id(self, asset_profile_id: AssetProfileId) -> AssetProfileInfo: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.get_asset_profile_info_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfileInfo: + return self.asset_profile_controller.get_asset_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_asset_profiles_by_ids(self, asset_profile_ids: List[str]) -> List[AssetProfileInfo]: + asset_profile_ids = ','.join(asset_profile_ids) + return self.asset_profile_controller.get_asset_profiles_by_ids_using_get(asset_profile_ids=asset_profile_ids) + + def get_asset_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfile: + return self.asset_profile_controller.get_asset_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_default_asset_profile_info(self) -> AssetProfileInfo: + return self.asset_profile_controller.get_default_asset_profile_info_using_get() + + def save_asset_profile(self, body: AssetProfile) -> AssetProfile: + return self.asset_profile_controller.save_asset_profile_using_post(body=body) + + def set_default_asset_profile(self, asset_profile_id: AssetProfileId) -> AssetProfile: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.set_default_asset_profile_using_post(asset_profile_id=asset_profile_id) + + def get_features_info(self) -> FeaturesInfo: + return self.admin_controller.get_features_info_using_get() + + def get_license_usage_info(self) -> LicenseUsageInfo: + return self.admin_controller.get_license_usage_info_using_get() + + def get_system_info(self) -> SystemInfo: + return self.admin_controller.get_system_info_using_get() + + def assign_alarm(self, alarm_id: AlarmId, assignee_id: str) -> Alarm: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.assign_alarm_using_post(alarm_id=alarm_id, assignee_id=assignee_id) + + def get_all_asset_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, include_customers: Optional[bool] = None, + asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAssetInfo: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_all_asset_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + asset_profile_id=asset_profile_id) + + def get_all_dashboards(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_all_dashboards_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_all_device_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None, + device_profile_id: Optional[DeviceProfileId] = None) -> PageDataDeviceInfo: + if device_profile_id: + device_profile_id = self.get_id(device_profile_id) + + return self.device_controller.get_all_device_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + device_profile_id=device_profile_id) + + def get_customer_device_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + device_profile_id: Optional[DeviceProfileId] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + active: Optional[bool] = None, + include_customers: Optional[bool] = None) -> PageDataDeviceInfo: + customer_id = self.get_id(customer_id) + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_customer_device_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, + device_profile_id=device_profile_id, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, active=active, + include_customers=include_customers) + + def get_entity_group_entity_info_by_id(self, entity_group_id: EntityGroupId) -> EntityInfo: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.get_entity_group_entity_info_by_id_using_get(entity_group_id=entity_group_id) + + def get_entity_group_entity_infos_by_ids(self, entity_group_ids: List[str]) -> List[EntityInfo]: + entity_group_ids = ','.join(entity_group_ids) + return self.entity_group_controller.get_entity_group_entity_infos_by_ids_using_get(entity_group_ids=entity_group_ids) + + def get_entity_group_entity_infos_by_owner_and_type_and_page_link(self, owner_id: str, owner_type: str, + group_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get( + owner_id=owner_id, owner_type=owner_type, group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_entity_infos_by_type_and_page_link(self, group_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_entity_group_entity_infos_by_type_and_page_link_using_get( + group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link(self, owner_id: str, owner_type: str, + group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get( + owner_id=owner_id, owner_type=owner_type, group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_entity_groups_by_type_and_page_link(self, group_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityGroupInfo: + return self.entity_group_controller.get_entity_groups_by_type_and_page_link_using_get(group_type=group_type, + page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_groups_hierarchy_by_owner_and_type_and_page_link(self, owner_id: str, owner_type: str, + group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityGroupInfo: + return self.entity_group_controller.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get( + owner_id=owner_id, owner_type=owner_type, group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_owner_info(self, owner_type: str, owner_id: str) -> EntityInfo: + return self.entity_group_controller.get_owner_info_using_get(owner_type=owner_type, owner_id=owner_id) + + def get_owner_infos(self, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_owner_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_shared_entity_group_entity_infos_by_type_and_page_link(self, group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get( + group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_shared_entity_groups_by_type_and_page_link(self, group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityGroupInfo: + return self.entity_group_controller.get_shared_entity_groups_by_type_and_page_link_using_get( + group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_shared_entity_groups_by_type(self, group_type: str) -> List[EntityGroupInfo]: + return self.entity_group_controller.get_shared_entity_groups_by_type_using_get(group_type=group_type) + + def get_all_entity_view_infos(self, page_size: int, + page: int, + include_customers: Optional[bool] = None, + type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityViewInfo: + return self.entity_view_controller.get_all_entity_view_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + type=type) + + def get_customer_entity_view_infos(self, customer_id: CustomerId, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, include_customers: Optional[bool] = None): + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_view_infos_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_all_user_infos(self, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataUserInfo: + return self.user_controller.get_all_user_infos_using_get(page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_customer_user_infos(self, customer_id: CustomerId, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataUserInfo: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_user_infos_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_user_info_by_id(self, user_id: UserId) -> UserInfo: + user_id = self.get_id(user_id) + return self.user_controller.get_user_info_by_id_using_get(user_id=user_id) + + def __load_controllers(self): + self.dashboard_controller = DashboardControllerApi(self.api_client) + self.device_profile_controller = DeviceProfileControllerApi(self.api_client) + self.http_integration_controller = HttpIntegrationControllerApi(self.api_client) + self.user_permissions_controller = UserPermissionsControllerApi(self.api_client) + self.device_group_ota_package_controller = DeviceGroupOtaPackageControllerApi(self.api_client) + self.converter_controller = ConverterControllerApi(self.api_client) + self.t_mobile_iot_cdp_integration_controller = TMobileIotCdpIntegrationControllerApi(self.api_client) + self.customer_controller = CustomerControllerApi(self.api_client) + self.role_controller = RoleControllerApi(self.api_client) + self.entity_group_controller = EntityGroupControllerApi(self.api_client) + self.admin_controller = AdminControllerApi(self.api_client) + self.edge_controller = EdgeControllerApi(self.api_client) + self.tenant_controller = TenantControllerApi(self.api_client) + self.trail_controller = TrailControllerApi(self.api_client) + self.report_controller = ReportControllerApi(self.api_client) + self.loriot_integration_controller = LoriotIntegrationControllerApi(self.api_client) + self.entity_view_controller = EntityViewControllerApi(self.api_client) + self.rpc_v2_controller = RpcV2ControllerApi(self.api_client) + self.lwm2m_controller = Lwm2mControllerApi(self.api_client) + self.scheduler_event_controller = SchedulerEventControllerApi(self.api_client) + self.custom_menu_controller = CustomMenuControllerApi(self.api_client) + self.thing_park_integration_controller = ThingParkIntegrationControllerApi(self.api_client) + self.rule_engine_controller = RuleEngineControllerApi(self.api_client) + self.ocean_connect_integration_controller = OceanConnectIntegrationControllerApi(self.api_client) + self.integration_controller = IntegrationControllerApi(self.api_client) + self.custom_translation_controller = CustomTranslationControllerApi(self.api_client) + self.ota_package_controller = OtaPackageControllerApi(self.api_client) + self.edge_event_controller = EdgeEventControllerApi(self.api_client) + self.device_controller = DeviceControllerApi(self.api_client) + self.group_permission_controller = GroupPermissionControllerApi(self.api_client) + self.chirp_stack_integration_controller = ChirpStackIntegrationControllerApi(self.api_client) + self.user_controller = UserControllerApi(self.api_client) + self.white_labeling_controller = WhiteLabelingControllerApi(self.api_client) + self.sign_up_controller = SignUpControllerApi(self.api_client) + self.blob_entity_controller = BlobEntityControllerApi(self.api_client) + self.owner_controller = OwnerControllerApi(self.api_client) + self.self_registration_controller = SelfRegistrationControllerApi(self.api_client) + self.sig_fox_integration_controller = SigFoxIntegrationControllerApi(self.api_client) + self.asset_controller = AssetControllerApi(self.api_client) + self.subscription_controller = SubscriptionControllerApi(self.api_client) + self.solution_controller = SolutionControllerApi(self.api_client) + self.asset_profile_controller = AssetProfileControllerApi(self.api_client) diff --git a/billinglayer/python/urllib3-2.0.4.dist-info/INSTALLER b/billinglayer/python/urllib3-2.0.4.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/billinglayer/python/urllib3-2.0.4.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/billinglayer/python/urllib3-2.0.4.dist-info/METADATA b/billinglayer/python/urllib3-2.0.4.dist-info/METADATA new file mode 100644 index 0000000..e7c094f --- /dev/null +++ b/billinglayer/python/urllib3-2.0.4.dist-info/METADATA @@ -0,0 +1,158 @@ +Metadata-Version: 2.1 +Name: urllib3 +Version: 2.0.4 +Summary: HTTP library with thread-safe connection pooling, file post, and more. +Project-URL: Changelog, https://github.com/urllib3/urllib3/blob/main/CHANGES.rst +Project-URL: Documentation, https://urllib3.readthedocs.io +Project-URL: Code, https://github.com/urllib3/urllib3 +Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues +Author-email: Andrey Petrov +Maintainer-email: Seth Michael Larson , Quentin Pradet +License-File: LICENSE.txt +Keywords: filepost,http,httplib,https,pooling,ssl,threadsafe,urllib +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=3.7 +Provides-Extra: brotli +Requires-Dist: brotli>=1.0.9; platform_python_implementation == 'CPython' and extra == 'brotli' +Requires-Dist: brotlicffi>=0.8.0; platform_python_implementation != 'CPython' and extra == 'brotli' +Provides-Extra: secure +Requires-Dist: certifi; extra == 'secure' +Requires-Dist: cryptography>=1.9; extra == 'secure' +Requires-Dist: idna>=2.0.0; extra == 'secure' +Requires-Dist: pyopenssl>=17.1.0; extra == 'secure' +Requires-Dist: urllib3-secure-extra; extra == 'secure' +Provides-Extra: socks +Requires-Dist: pysocks!=1.5.7,<2.0,>=1.5.6; extra == 'socks' +Provides-Extra: zstd +Requires-Dist: zstandard>=0.18.0; extra == 'zstd' +Description-Content-Type: text/markdown + +

+ +![urllib3](https://github.com/urllib3/urllib3/raw/main/docs/_static/banner_github.svg) + +

+ +

+ PyPI Version + Python Versions + Join our Discord + Coverage Status + Build Status on GitHub + Documentation Status
+ OpenSSF Scorecard + SLSA 3 + CII Best Practices +

+ +urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the +Python ecosystem already uses urllib3 and you should too. +urllib3 brings many critical features that are missing from the Python +standard libraries: + +- Thread safety. +- Connection pooling. +- Client-side SSL/TLS verification. +- File uploads with multipart encoding. +- Helpers for retrying requests and dealing with HTTP redirects. +- Support for gzip, deflate, brotli, and zstd encoding. +- Proxy support for HTTP and SOCKS. +- 100% test coverage. + +urllib3 is powerful and easy to use: + +```python3 +>>> import urllib3 +>>> resp = urllib3.request("GET", "http://httpbin.org/robots.txt") +>>> resp.status +200 +>>> resp.data +b"User-agent: *\nDisallow: /deny\n" +``` + +## Installing + +urllib3 can be installed with [pip](https://pip.pypa.io): + +```bash +$ python -m pip install urllib3 +``` + +Alternatively, you can grab the latest source code from [GitHub](https://github.com/urllib3/urllib3): + +```bash +$ git clone https://github.com/urllib3/urllib3.git +$ cd urllib3 +$ pip install . +``` + + +## Documentation + +urllib3 has usage and reference documentation at [urllib3.readthedocs.io](https://urllib3.readthedocs.io). + + +## Community + +urllib3 has a [community Discord channel](https://discord.gg/urllib3) for asking questions and +collaborating with other contributors. Drop by and say hello 👋 + + +## Contributing + +urllib3 happily accepts contributions. Please see our +[contributing documentation](https://urllib3.readthedocs.io/en/latest/contributing.html) +for some tips on getting started. + + +## Security Disclosures + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure with maintainers. + + +## Maintainers + +- [@sethmlarson](https://github.com/sethmlarson) (Seth M. Larson) +- [@pquentin](https://github.com/pquentin) (Quentin Pradet) +- [@theacodes](https://github.com/theacodes) (Thea Flowers) +- [@haikuginger](https://github.com/haikuginger) (Jess Shapiro) +- [@lukasa](https://github.com/lukasa) (Cory Benfield) +- [@sigmavirus24](https://github.com/sigmavirus24) (Ian Stapleton Cordasco) +- [@shazow](https://github.com/shazow) (Andrey Petrov) + +👋 + + +## Sponsorship + +If your company benefits from this library, please consider [sponsoring its +development](https://urllib3.readthedocs.io/en/latest/sponsors.html). + + +## For Enterprise + +Professional support for urllib3 is available as part of the [Tidelift +Subscription][1]. Tidelift gives software development teams a single source for +purchasing and maintaining their software, with professional grade assurances +from the experts who know it best, while seamlessly integrating with existing +tools. + +[1]: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme diff --git a/billinglayer/python/urllib3-2.0.4.dist-info/RECORD b/billinglayer/python/urllib3-2.0.4.dist-info/RECORD new file mode 100644 index 0000000..5ae1ecc --- /dev/null +++ b/billinglayer/python/urllib3-2.0.4.dist-info/RECORD @@ -0,0 +1,70 @@ +urllib3-2.0.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +urllib3-2.0.4.dist-info/METADATA,sha256=hqexOXqgsYEGm5SMWGrhOHKgm4jxLM7lFPbit444zXY,6591 +urllib3-2.0.4.dist-info/RECORD,, +urllib3-2.0.4.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87 +urllib3-2.0.4.dist-info/licenses/LICENSE.txt,sha256=Ew46ZNX91dCWp1JpRjSn2d8oRGnehuVzIQAmgEHj1oY,1093 +urllib3/__init__.py,sha256=OV22EiB-j4tci8776nQPuyOorDZSvsbzlS1_3SP9fmo,5307 +urllib3/__pycache__/__init__.cpython-311.pyc,, +urllib3/__pycache__/_base_connection.cpython-311.pyc,, +urllib3/__pycache__/_collections.cpython-311.pyc,, +urllib3/__pycache__/_request_methods.cpython-311.pyc,, +urllib3/__pycache__/_version.cpython-311.pyc,, +urllib3/__pycache__/connection.cpython-311.pyc,, +urllib3/__pycache__/connectionpool.cpython-311.pyc,, +urllib3/__pycache__/exceptions.cpython-311.pyc,, +urllib3/__pycache__/fields.cpython-311.pyc,, +urllib3/__pycache__/filepost.cpython-311.pyc,, +urllib3/__pycache__/poolmanager.cpython-311.pyc,, +urllib3/__pycache__/response.cpython-311.pyc,, +urllib3/_base_connection.py,sha256=Zx9RKhOpdcV6EuNZUYpwSy_i3Y-HgBQxl72rprYBD9I,5651 +urllib3/_collections.py,sha256=GYCDeODxROILJVRL9E9hprePDegUqh5LdggY_9UPBAw,16817 +urllib3/_request_methods.py,sha256=rTM3FfErdUIVfuqGYJvrnI-HLvBePTLDWKdzosJoyx4,7756 +urllib3/_version.py,sha256=sfuelPE6Hyx1lJZ4flqCAEV9EUMtHOhQK_9Zr_XZQIQ,98 +urllib3/connection.py,sha256=ynxJhsCnkmi6PFtbF-dbPoewZDr420SVFzQuLXU9BF0,33830 +urllib3/connectionpool.py,sha256=Sj7x6xkQHYe9I4xHBOBgkpeFQXog3nmmsLdtQJU3A4k,42961 +urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +urllib3/contrib/__pycache__/__init__.cpython-311.pyc,, +urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc,, +urllib3/contrib/__pycache__/securetransport.cpython-311.pyc,, +urllib3/contrib/__pycache__/socks.cpython-311.pyc,, +urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc,, +urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc,, +urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc,, +urllib3/contrib/_securetransport/bindings.py,sha256=N8r6aifbJ-dNS5v-YTPsBl7d0R1GhTi6FiUOdZMGdoo,14452 +urllib3/contrib/_securetransport/low_level.py,sha256=14Dhp_jima5J824obfFX5oBORYiAnULtUJ_TB8CEscY,16220 +urllib3/contrib/pyopenssl.py,sha256=mezuGWCrkZqlESm2CbLLTmKTt16ky-wADega-HSeq9U,19437 +urllib3/contrib/securetransport.py,sha256=tDglxxJvySdRih4JsawEKHitPytWUBJ6glrDrje4yM8,34121 +urllib3/contrib/socks.py,sha256=xbqs-P-UHH5L5a_dKvxKetFyV9lKuxkcV9K9Oiyd-gI,7715 +urllib3/exceptions.py,sha256=rOVHX1HOAb_TZwJZTqprLRTNAJQUWnrXDYaR8XBk1tY,9385 +urllib3/fields.py,sha256=XvSMfnSMqeOn9o-6Eb3Fl9MN2MNjiHsmEff_HR5jhEI,11026 +urllib3/filepost.py,sha256=-9qJT11cNGjO9dqnI20-oErZuTvNaM18xZZPCjZSbOE,2395 +urllib3/poolmanager.py,sha256=0StMnGCE-r0vuQygEsTpeaQjEQVBIyBb640rD1Bovfw,22648 +urllib3/py.typed,sha256=UaCuPFa3H8UAakbt-5G8SPacldTOGvJv18pPjUJ5gDY,93 +urllib3/response.py,sha256=jN5lRBnFn6gCqfP7NjuQJepLmll2W6p8SE6t8EU_C04,40092 +urllib3/util/__init__.py,sha256=WsFx_PdwI25do8AcdW-Xj3rvUrI3NsgeQULp6S0sPeU,1051 +urllib3/util/__pycache__/__init__.cpython-311.pyc,, +urllib3/util/__pycache__/connection.cpython-311.pyc,, +urllib3/util/__pycache__/proxy.cpython-311.pyc,, +urllib3/util/__pycache__/request.cpython-311.pyc,, +urllib3/util/__pycache__/response.cpython-311.pyc,, +urllib3/util/__pycache__/retry.cpython-311.pyc,, +urllib3/util/__pycache__/ssl_.cpython-311.pyc,, +urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc,, +urllib3/util/__pycache__/ssltransport.cpython-311.pyc,, +urllib3/util/__pycache__/timeout.cpython-311.pyc,, +urllib3/util/__pycache__/url.cpython-311.pyc,, +urllib3/util/__pycache__/util.cpython-311.pyc,, +urllib3/util/__pycache__/wait.cpython-311.pyc,, +urllib3/util/connection.py,sha256=QeUUEuNmhznpuKNPL-B0IVOkMdMCu8oJX62OC0Vpzug,4462 +urllib3/util/proxy.py,sha256=seP8-Q5B6bB0dMtwPj-YcZZQ30vHuLqRu-tI0JZ2fzs,1148 +urllib3/util/request.py,sha256=5w7bjcFNwXffvFyqogq8KmJhKagKdiiD5EusYH-rxgU,8083 +urllib3/util/response.py,sha256=vQE639uoEhj1vpjEdxu5lNIhJCSUZkd7pqllUI0BZOA,3374 +urllib3/util/retry.py,sha256=EgWJcUb_2BrMT1Z-HLBwkQva_CCwHDWZ-0jdTZin0TM,18374 +urllib3/util/ssl_.py,sha256=uCuWbQhktyOwdHI91g4Ri3CD4SloVInYA58G6vKpqcw,19244 +urllib3/util/ssl_match_hostname.py,sha256=gaWqixoYtQ_GKO8fcRGFj3VXeMoqyxQQuUTPgWeiL_M,5812 +urllib3/util/ssltransport.py,sha256=jGmDxXI-nPBfMib-kjksI5TxUQyooYpekd0sjo1ibdg,9045 +urllib3/util/timeout.py,sha256=iXlm7hqG7ij7y27z23giTzsjyg3KIiVyjhsQsiWLDHA,10529 +urllib3/util/url.py,sha256=wHORhp80RAXyTlAIkTqLFzSrkU7J34ZDxX-tN65MBZk,15213 +urllib3/util/util.py,sha256=j3lbZK1jPyiwD34T8IgJzdWEZVT-4E-0vYIJi9UjeNA,1146 +urllib3/util/wait.py,sha256=_ph8IrUR3sqPqi0OopQgJUlH4wzkGeM5CiyA7XGGtmI,4423 diff --git a/billinglayer/python/urllib3-2.0.4.dist-info/WHEEL b/billinglayer/python/urllib3-2.0.4.dist-info/WHEEL new file mode 100644 index 0000000..ba1a8af --- /dev/null +++ b/billinglayer/python/urllib3-2.0.4.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.18.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/billinglayer/python/urllib3-2.0.4.dist-info/licenses/LICENSE.txt b/billinglayer/python/urllib3-2.0.4.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000..e6183d0 --- /dev/null +++ b/billinglayer/python/urllib3-2.0.4.dist-info/licenses/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2008-2020 Andrey Petrov and contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/billinglayer/python/urllib3/__init__.py b/billinglayer/python/urllib3/__init__.py new file mode 100644 index 0000000..32c1f00 --- /dev/null +++ b/billinglayer/python/urllib3/__init__.py @@ -0,0 +1,166 @@ +""" +Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more +""" + +from __future__ import annotations + +# Set default logging handler to avoid "No handler found" warnings. +import logging +import typing +import warnings +from logging import NullHandler + +from . import exceptions +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from ._version import __version__ +from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url +from .filepost import _TYPE_FIELDS, encode_multipart_formdata +from .poolmanager import PoolManager, ProxyManager, proxy_from_url +from .response import BaseHTTPResponse, HTTPResponse +from .util.request import make_headers +from .util.retry import Retry +from .util.timeout import Timeout + +# Ensure that Python is compiled with OpenSSL 1.1.1+ +# If the 'ssl' module isn't available at all that's +# fine, we only care if the module is available. +try: + import ssl +except ImportError: + pass +else: + if not ssl.OPENSSL_VERSION.startswith("OpenSSL "): # Defensive: + warnings.warn( + "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently " + f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " + "See: https://github.com/urllib3/urllib3/issues/3020", + exceptions.NotOpenSSLWarning, + ) + elif ssl.OPENSSL_VERSION_INFO < (1, 1, 1): # Defensive: + raise ImportError( + "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently " + f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " + "See: https://github.com/urllib3/urllib3/issues/2168" + ) + +# === NOTE TO REPACKAGERS AND VENDORS === +# Please delete this block, this logic is only +# for urllib3 being distributed via PyPI. +# See: https://github.com/urllib3/urllib3/issues/2680 +try: + import urllib3_secure_extra # type: ignore # noqa: F401 +except ModuleNotFoundError: + pass +else: + warnings.warn( + "'urllib3[secure]' extra is deprecated and will be removed " + "in urllib3 v2.1.0. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2680", + category=DeprecationWarning, + stacklevel=2, + ) + +__author__ = "Andrey Petrov (andrey.petrov@shazow.net)" +__license__ = "MIT" +__version__ = __version__ + +__all__ = ( + "HTTPConnectionPool", + "HTTPHeaderDict", + "HTTPSConnectionPool", + "PoolManager", + "ProxyManager", + "HTTPResponse", + "Retry", + "Timeout", + "add_stderr_logger", + "connection_from_url", + "disable_warnings", + "encode_multipart_formdata", + "make_headers", + "proxy_from_url", + "request", + "BaseHTTPResponse", +) + +logging.getLogger(__name__).addHandler(NullHandler()) + + +def add_stderr_logger( + level: int = logging.DEBUG, +) -> logging.StreamHandler[typing.TextIO]: + """ + Helper for quickly adding a StreamHandler to the logger. Useful for + debugging. + + Returns the handler after adding it. + """ + # This method needs to be in this __init__.py to get the __name__ correct + # even if urllib3 is vendored within another package. + logger = logging.getLogger(__name__) + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(message)s")) + logger.addHandler(handler) + logger.setLevel(level) + logger.debug("Added a stderr logging handler to logger: %s", __name__) + return handler + + +# ... Clean up. +del NullHandler + + +# All warning filters *must* be appended unless you're really certain that they +# shouldn't be: otherwise, it's very hard for users to use most Python +# mechanisms to silence them. +# SecurityWarning's always go off by default. +warnings.simplefilter("always", exceptions.SecurityWarning, append=True) +# InsecurePlatformWarning's don't vary between requests, so we keep it default. +warnings.simplefilter("default", exceptions.InsecurePlatformWarning, append=True) + + +def disable_warnings(category: type[Warning] = exceptions.HTTPWarning) -> None: + """ + Helper for quickly disabling all urllib3 warnings. + """ + warnings.simplefilter("ignore", category) + + +_DEFAULT_POOL = PoolManager() + + +def request( + method: str, + url: str, + *, + body: _TYPE_BODY | None = None, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + preload_content: bool | None = True, + decode_content: bool | None = True, + redirect: bool | None = True, + retries: Retry | bool | int | None = None, + timeout: Timeout | float | int | None = 3, + json: typing.Any | None = None, +) -> BaseHTTPResponse: + """ + A convenience, top-level request method. It uses a module-global ``PoolManager`` instance. + Therefore, its side effects could be shared across dependencies relying on it. + To avoid side effects create a new ``PoolManager`` instance and use it instead. + The method does not accept low-level ``**urlopen_kw`` keyword arguments. + """ + + return _DEFAULT_POOL.request( + method, + url, + body=body, + fields=fields, + headers=headers, + preload_content=preload_content, + decode_content=decode_content, + redirect=redirect, + retries=retries, + timeout=timeout, + json=json, + ) diff --git a/billinglayer/python/urllib3/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..7458e5c Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/_base_connection.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/_base_connection.cpython-311.pyc new file mode 100644 index 0000000..8fee680 Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/_base_connection.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/_collections.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/_collections.cpython-311.pyc new file mode 100644 index 0000000..b1724ab Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/_collections.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/_request_methods.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/_request_methods.cpython-311.pyc new file mode 100644 index 0000000..73dbdaf Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/_request_methods.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/_version.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/_version.cpython-311.pyc new file mode 100644 index 0000000..98be416 Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/_version.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/connection.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/connection.cpython-311.pyc new file mode 100644 index 0000000..7d47c35 Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/connection.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/connectionpool.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/connectionpool.cpython-311.pyc new file mode 100644 index 0000000..f82fcf7 Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/connectionpool.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/exceptions.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..9d957ab Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/exceptions.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/fields.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/fields.cpython-311.pyc new file mode 100644 index 0000000..f9432fe Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/fields.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/filepost.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/filepost.cpython-311.pyc new file mode 100644 index 0000000..50637b8 Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/filepost.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/poolmanager.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/poolmanager.cpython-311.pyc new file mode 100644 index 0000000..e4cad52 Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/poolmanager.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/__pycache__/response.cpython-311.pyc b/billinglayer/python/urllib3/__pycache__/response.cpython-311.pyc new file mode 100644 index 0000000..d9ce24c Binary files /dev/null and b/billinglayer/python/urllib3/__pycache__/response.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/_base_connection.py b/billinglayer/python/urllib3/_base_connection.py new file mode 100644 index 0000000..3afed76 --- /dev/null +++ b/billinglayer/python/urllib3/_base_connection.py @@ -0,0 +1,173 @@ +from __future__ import annotations + +import typing + +from .util.connection import _TYPE_SOCKET_OPTIONS +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT +from .util.url import Url + +_TYPE_BODY = typing.Union[bytes, typing.IO[typing.Any], typing.Iterable[bytes], str] + + +class ProxyConfig(typing.NamedTuple): + ssl_context: ssl.SSLContext | None + use_forwarding_for_https: bool + assert_hostname: None | str | Literal[False] + assert_fingerprint: str | None + + +class _ResponseOptions(typing.NamedTuple): + # TODO: Remove this in favor of a better + # HTTP request/response lifecycle tracking. + request_method: str + request_url: str + preload_content: bool + decode_content: bool + enforce_content_length: bool + + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Literal, Protocol + + from .response import BaseHTTPResponse + + class BaseHTTPConnection(Protocol): + default_port: typing.ClassVar[int] + default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] + + host: str + port: int + timeout: None | ( + float + ) # Instance doesn't store _DEFAULT_TIMEOUT, must be resolved. + blocksize: int + source_address: tuple[str, int] | None + socket_options: _TYPE_SOCKET_OPTIONS | None + + proxy: Url | None + proxy_config: ProxyConfig | None + + is_verified: bool + proxy_is_verified: bool | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: _TYPE_SOCKET_OPTIONS | None = ..., + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + ) -> None: + ... + + def set_tunnel( + self, + host: str, + port: int | None = None, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: + ... + + def connect(self) -> None: + ... + + def request( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + # We know *at least* botocore is depending on the order of the + # first 3 parameters so to be safe we only mark the later ones + # as keyword-only to ensure we have space to extend. + *, + chunked: bool = False, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> None: + ... + + def getresponse(self) -> BaseHTTPResponse: + ... + + def close(self) -> None: + ... + + @property + def is_closed(self) -> bool: + """Whether the connection either is brand new or has been previously closed. + If this property is True then both ``is_connected`` and ``has_connected_to_proxy`` + properties must be False. + """ + + @property + def is_connected(self) -> bool: + """Whether the connection is actively connected to any origin (proxy or target)""" + + @property + def has_connected_to_proxy(self) -> bool: + """Whether the connection has successfully connected to its proxy. + This returns False if no proxy is in use. Used to determine whether + errors are coming from the proxy layer or from tunnelling to the target origin. + """ + + class BaseHTTPSConnection(BaseHTTPConnection, Protocol): + default_port: typing.ClassVar[int] + default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] + + # Certificate verification methods + cert_reqs: int | str | None + assert_hostname: None | str | Literal[False] + assert_fingerprint: str | None + ssl_context: ssl.SSLContext | None + + # Trusted CAs + ca_certs: str | None + ca_cert_dir: str | None + ca_cert_data: None | str | bytes + + # TLS version + ssl_minimum_version: int | None + ssl_maximum_version: int | None + ssl_version: int | str | None # Deprecated + + # Client certificates + cert_file: str | None + key_file: str | None + key_password: str | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: _TYPE_SOCKET_OPTIONS | None = ..., + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + cert_reqs: int | str | None = None, + assert_hostname: None | str | Literal[False] = None, + assert_fingerprint: str | None = None, + server_hostname: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_certs: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + ssl_version: int | str | None = None, # Deprecated + cert_file: str | None = None, + key_file: str | None = None, + key_password: str | None = None, + ) -> None: + ... diff --git a/billinglayer/python/urllib3/_collections.py b/billinglayer/python/urllib3/_collections.py new file mode 100644 index 0000000..7f9dca7 --- /dev/null +++ b/billinglayer/python/urllib3/_collections.py @@ -0,0 +1,463 @@ +from __future__ import annotations + +import typing +from collections import OrderedDict +from enum import Enum, auto +from threading import RLock + +if typing.TYPE_CHECKING: + # We can only import Protocol if TYPE_CHECKING because it's a development + # dependency, and is not available at runtime. + from typing_extensions import Protocol + + class HasGettableStringKeys(Protocol): + def keys(self) -> typing.Iterator[str]: + ... + + def __getitem__(self, key: str) -> str: + ... + + +__all__ = ["RecentlyUsedContainer", "HTTPHeaderDict"] + + +# Key type +_KT = typing.TypeVar("_KT") +# Value type +_VT = typing.TypeVar("_VT") +# Default type +_DT = typing.TypeVar("_DT") + +ValidHTTPHeaderSource = typing.Union[ + "HTTPHeaderDict", + typing.Mapping[str, str], + typing.Iterable[typing.Tuple[str, str]], + "HasGettableStringKeys", +] + + +class _Sentinel(Enum): + not_passed = auto() + + +def ensure_can_construct_http_header_dict( + potential: object, +) -> ValidHTTPHeaderSource | None: + if isinstance(potential, HTTPHeaderDict): + return potential + elif isinstance(potential, typing.Mapping): + # Full runtime checking of the contents of a Mapping is expensive, so for the + # purposes of typechecking, we assume that any Mapping is the right shape. + return typing.cast(typing.Mapping[str, str], potential) + elif isinstance(potential, typing.Iterable): + # Similarly to Mapping, full runtime checking of the contents of an Iterable is + # expensive, so for the purposes of typechecking, we assume that any Iterable + # is the right shape. + return typing.cast(typing.Iterable[typing.Tuple[str, str]], potential) + elif hasattr(potential, "keys") and hasattr(potential, "__getitem__"): + return typing.cast("HasGettableStringKeys", potential) + else: + return None + + +class RecentlyUsedContainer(typing.Generic[_KT, _VT], typing.MutableMapping[_KT, _VT]): + """ + Provides a thread-safe dict-like container which maintains up to + ``maxsize`` keys while throwing away the least-recently-used keys beyond + ``maxsize``. + + :param maxsize: + Maximum number of recent elements to retain. + + :param dispose_func: + Every time an item is evicted from the container, + ``dispose_func(value)`` is called. Callback which will get called + """ + + _container: typing.OrderedDict[_KT, _VT] + _maxsize: int + dispose_func: typing.Callable[[_VT], None] | None + lock: RLock + + def __init__( + self, + maxsize: int = 10, + dispose_func: typing.Callable[[_VT], None] | None = None, + ) -> None: + super().__init__() + self._maxsize = maxsize + self.dispose_func = dispose_func + self._container = OrderedDict() + self.lock = RLock() + + def __getitem__(self, key: _KT) -> _VT: + # Re-insert the item, moving it to the end of the eviction line. + with self.lock: + item = self._container.pop(key) + self._container[key] = item + return item + + def __setitem__(self, key: _KT, value: _VT) -> None: + evicted_item = None + with self.lock: + # Possibly evict the existing value of 'key' + try: + # If the key exists, we'll overwrite it, which won't change the + # size of the pool. Because accessing a key should move it to + # the end of the eviction line, we pop it out first. + evicted_item = key, self._container.pop(key) + self._container[key] = value + except KeyError: + # When the key does not exist, we insert the value first so that + # evicting works in all cases, including when self._maxsize is 0 + self._container[key] = value + if len(self._container) > self._maxsize: + # If we didn't evict an existing value, and we've hit our maximum + # size, then we have to evict the least recently used item from + # the beginning of the container. + evicted_item = self._container.popitem(last=False) + + # After releasing the lock on the pool, dispose of any evicted value. + if evicted_item is not None and self.dispose_func: + _, evicted_value = evicted_item + self.dispose_func(evicted_value) + + def __delitem__(self, key: _KT) -> None: + with self.lock: + value = self._container.pop(key) + + if self.dispose_func: + self.dispose_func(value) + + def __len__(self) -> int: + with self.lock: + return len(self._container) + + def __iter__(self) -> typing.NoReturn: + raise NotImplementedError( + "Iteration over this class is unlikely to be threadsafe." + ) + + def clear(self) -> None: + with self.lock: + # Copy pointers to all values, then wipe the mapping + values = list(self._container.values()) + self._container.clear() + + if self.dispose_func: + for value in values: + self.dispose_func(value) + + def keys(self) -> set[_KT]: # type: ignore[override] + with self.lock: + return set(self._container.keys()) + + +class HTTPHeaderDictItemView(typing.Set[typing.Tuple[str, str]]): + """ + HTTPHeaderDict is unusual for a Mapping[str, str] in that it has two modes of + address. + + If we directly try to get an item with a particular name, we will get a string + back that is the concatenated version of all the values: + + >>> d['X-Header-Name'] + 'Value1, Value2, Value3' + + However, if we iterate over an HTTPHeaderDict's items, we will optionally combine + these values based on whether combine=True was called when building up the dictionary + + >>> d = HTTPHeaderDict({"A": "1", "B": "foo"}) + >>> d.add("A", "2", combine=True) + >>> d.add("B", "bar") + >>> list(d.items()) + [ + ('A', '1, 2'), + ('B', 'foo'), + ('B', 'bar'), + ] + + This class conforms to the interface required by the MutableMapping ABC while + also giving us the nonstandard iteration behavior we want; items with duplicate + keys, ordered by time of first insertion. + """ + + _headers: HTTPHeaderDict + + def __init__(self, headers: HTTPHeaderDict) -> None: + self._headers = headers + + def __len__(self) -> int: + return len(list(self._headers.iteritems())) + + def __iter__(self) -> typing.Iterator[tuple[str, str]]: + return self._headers.iteritems() + + def __contains__(self, item: object) -> bool: + if isinstance(item, tuple) and len(item) == 2: + passed_key, passed_val = item + if isinstance(passed_key, str) and isinstance(passed_val, str): + return self._headers._has_value_for_header(passed_key, passed_val) + return False + + +class HTTPHeaderDict(typing.MutableMapping[str, str]): + """ + :param headers: + An iterable of field-value pairs. Must not contain multiple field names + when compared case-insensitively. + + :param kwargs: + Additional field-value pairs to pass in to ``dict.update``. + + A ``dict`` like container for storing HTTP Headers. + + Field names are stored and compared case-insensitively in compliance with + RFC 7230. Iteration provides the first case-sensitive key seen for each + case-insensitive pair. + + Using ``__setitem__`` syntax overwrites fields that compare equal + case-insensitively in order to maintain ``dict``'s api. For fields that + compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add`` + in a loop. + + If multiple fields that are equal case-insensitively are passed to the + constructor or ``.update``, the behavior is undefined and some will be + lost. + + >>> headers = HTTPHeaderDict() + >>> headers.add('Set-Cookie', 'foo=bar') + >>> headers.add('set-cookie', 'baz=quxx') + >>> headers['content-length'] = '7' + >>> headers['SET-cookie'] + 'foo=bar, baz=quxx' + >>> headers['Content-Length'] + '7' + """ + + _container: typing.MutableMapping[str, list[str]] + + def __init__(self, headers: ValidHTTPHeaderSource | None = None, **kwargs: str): + super().__init__() + self._container = {} # 'dict' is insert-ordered in Python 3.7+ + if headers is not None: + if isinstance(headers, HTTPHeaderDict): + self._copy_from(headers) + else: + self.extend(headers) + if kwargs: + self.extend(kwargs) + + def __setitem__(self, key: str, val: str) -> None: + # avoid a bytes/str comparison by decoding before httplib + if isinstance(key, bytes): + key = key.decode("latin-1") + self._container[key.lower()] = [key, val] + + def __getitem__(self, key: str) -> str: + val = self._container[key.lower()] + return ", ".join(val[1:]) + + def __delitem__(self, key: str) -> None: + del self._container[key.lower()] + + def __contains__(self, key: object) -> bool: + if isinstance(key, str): + return key.lower() in self._container + return False + + def setdefault(self, key: str, default: str = "") -> str: + return super().setdefault(key, default) + + def __eq__(self, other: object) -> bool: + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return False + else: + other_as_http_header_dict = type(self)(maybe_constructable) + + return {k.lower(): v for k, v in self.itermerged()} == { + k.lower(): v for k, v in other_as_http_header_dict.itermerged() + } + + def __ne__(self, other: object) -> bool: + return not self.__eq__(other) + + def __len__(self) -> int: + return len(self._container) + + def __iter__(self) -> typing.Iterator[str]: + # Only provide the originally cased names + for vals in self._container.values(): + yield vals[0] + + def discard(self, key: str) -> None: + try: + del self[key] + except KeyError: + pass + + def add(self, key: str, val: str, *, combine: bool = False) -> None: + """Adds a (name, value) pair, doesn't overwrite the value if it already + exists. + + If this is called with combine=True, instead of adding a new header value + as a distinct item during iteration, this will instead append the value to + any existing header value with a comma. If no existing header value exists + for the key, then the value will simply be added, ignoring the combine parameter. + + >>> headers = HTTPHeaderDict(foo='bar') + >>> headers.add('Foo', 'baz') + >>> headers['foo'] + 'bar, baz' + >>> list(headers.items()) + [('foo', 'bar'), ('foo', 'baz')] + >>> headers.add('foo', 'quz', combine=True) + >>> list(headers.items()) + [('foo', 'bar, baz, quz')] + """ + # avoid a bytes/str comparison by decoding before httplib + if isinstance(key, bytes): + key = key.decode("latin-1") + key_lower = key.lower() + new_vals = [key, val] + # Keep the common case aka no item present as fast as possible + vals = self._container.setdefault(key_lower, new_vals) + if new_vals is not vals: + # if there are values here, then there is at least the initial + # key/value pair + assert len(vals) >= 2 + if combine: + vals[-1] = vals[-1] + ", " + val + else: + vals.append(val) + + def extend(self, *args: ValidHTTPHeaderSource, **kwargs: str) -> None: + """Generic import function for any type of header-like object. + Adapted version of MutableMapping.update in order to insert items + with self.add instead of self.__setitem__ + """ + if len(args) > 1: + raise TypeError( + f"extend() takes at most 1 positional arguments ({len(args)} given)" + ) + other = args[0] if len(args) >= 1 else () + + if isinstance(other, HTTPHeaderDict): + for key, val in other.iteritems(): + self.add(key, val) + elif isinstance(other, typing.Mapping): + for key, val in other.items(): + self.add(key, val) + elif isinstance(other, typing.Iterable): + other = typing.cast(typing.Iterable[typing.Tuple[str, str]], other) + for key, value in other: + self.add(key, value) + elif hasattr(other, "keys") and hasattr(other, "__getitem__"): + # THIS IS NOT A TYPESAFE BRANCH + # In this branch, the object has a `keys` attr but is not a Mapping or any of + # the other types indicated in the method signature. We do some stuff with + # it as though it partially implements the Mapping interface, but we're not + # doing that stuff safely AT ALL. + for key in other.keys(): + self.add(key, other[key]) + + for key, value in kwargs.items(): + self.add(key, value) + + @typing.overload + def getlist(self, key: str) -> list[str]: + ... + + @typing.overload + def getlist(self, key: str, default: _DT) -> list[str] | _DT: + ... + + def getlist( + self, key: str, default: _Sentinel | _DT = _Sentinel.not_passed + ) -> list[str] | _DT: + """Returns a list of all the values for the named field. Returns an + empty list if the key doesn't exist.""" + try: + vals = self._container[key.lower()] + except KeyError: + if default is _Sentinel.not_passed: + # _DT is unbound; empty list is instance of List[str] + return [] + # _DT is bound; default is instance of _DT + return default + else: + # _DT may or may not be bound; vals[1:] is instance of List[str], which + # meets our external interface requirement of `Union[List[str], _DT]`. + return vals[1:] + + # Backwards compatibility for httplib + getheaders = getlist + getallmatchingheaders = getlist + iget = getlist + + # Backwards compatibility for http.cookiejar + get_all = getlist + + def __repr__(self) -> str: + return f"{type(self).__name__}({dict(self.itermerged())})" + + def _copy_from(self, other: HTTPHeaderDict) -> None: + for key in other: + val = other.getlist(key) + self._container[key.lower()] = [key, *val] + + def copy(self) -> HTTPHeaderDict: + clone = type(self)() + clone._copy_from(self) + return clone + + def iteritems(self) -> typing.Iterator[tuple[str, str]]: + """Iterate over all header lines, including duplicate ones.""" + for key in self: + vals = self._container[key.lower()] + for val in vals[1:]: + yield vals[0], val + + def itermerged(self) -> typing.Iterator[tuple[str, str]]: + """Iterate over all headers, merging duplicate ones together.""" + for key in self: + val = self._container[key.lower()] + yield val[0], ", ".join(val[1:]) + + def items(self) -> HTTPHeaderDictItemView: # type: ignore[override] + return HTTPHeaderDictItemView(self) + + def _has_value_for_header(self, header_name: str, potential_value: str) -> bool: + if header_name in self: + return potential_value in self._container[header_name.lower()][1:] + return False + + def __ior__(self, other: object) -> HTTPHeaderDict: + # Supports extending a header dict in-place using operator |= + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + self.extend(maybe_constructable) + return self + + def __or__(self, other: object) -> HTTPHeaderDict: + # Supports merging header dicts using operator | + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + result = self.copy() + result.extend(maybe_constructable) + return result + + def __ror__(self, other: object) -> HTTPHeaderDict: + # Supports merging header dicts using operator | when other is on left side + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + result = type(self)(maybe_constructable) + result.extend(self) + return result diff --git a/billinglayer/python/urllib3/_request_methods.py b/billinglayer/python/urllib3/_request_methods.py new file mode 100644 index 0000000..1d0f346 --- /dev/null +++ b/billinglayer/python/urllib3/_request_methods.py @@ -0,0 +1,217 @@ +from __future__ import annotations + +import json as _json +import typing +from urllib.parse import urlencode + +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from .filepost import _TYPE_FIELDS, encode_multipart_formdata +from .response import BaseHTTPResponse + +__all__ = ["RequestMethods"] + +_TYPE_ENCODE_URL_FIELDS = typing.Union[ + typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]], + typing.Mapping[str, typing.Union[str, bytes]], +] + + +class RequestMethods: + """ + Convenience mixin for classes who implement a :meth:`urlopen` method, such + as :class:`urllib3.HTTPConnectionPool` and + :class:`urllib3.PoolManager`. + + Provides behavior for making common types of HTTP request methods and + decides which type of request field encoding to use. + + Specifically, + + :meth:`.request_encode_url` is for sending requests whose fields are + encoded in the URL (such as GET, HEAD, DELETE). + + :meth:`.request_encode_body` is for sending requests whose fields are + encoded in the *body* of the request using multipart or www-form-urlencoded + (such as for POST, PUT, PATCH). + + :meth:`.request` is for making any kind of request, it will look up the + appropriate encoding format and use one of the above two methods to make + the request. + + Initializer parameters: + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + """ + + _encode_url_methods = {"DELETE", "GET", "HEAD", "OPTIONS"} + + def __init__(self, headers: typing.Mapping[str, str] | None = None) -> None: + self.headers = headers or {} + + def urlopen( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + encode_multipart: bool = True, + multipart_boundary: str | None = None, + **kw: typing.Any, + ) -> BaseHTTPResponse: # Abstract + raise NotImplementedError( + "Classes extending RequestMethods must implement " + "their own ``urlopen`` method." + ) + + def request( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + json: typing.Any | None = None, + **urlopen_kw: typing.Any, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the appropriate encoding of + ``fields`` based on the ``method`` used. + + This is a convenience method that requires the least amount of manual + effort. It can be used in most situations, while still having the + option to drop down to more specific methods when necessary, such as + :meth:`request_encode_url`, :meth:`request_encode_body`, + or even the lowest level :meth:`urlopen`. + """ + method = method.upper() + + if json is not None and body is not None: + raise TypeError( + "request got values for both 'body' and 'json' parameters which are mutually exclusive" + ) + + if json is not None: + if headers is None: + headers = self.headers.copy() # type: ignore + if not ("content-type" in map(str.lower, headers.keys())): + headers["Content-Type"] = "application/json" # type: ignore + + body = _json.dumps(json, separators=(",", ":"), ensure_ascii=False).encode( + "utf-8" + ) + + if body is not None: + urlopen_kw["body"] = body + + if method in self._encode_url_methods: + return self.request_encode_url( + method, + url, + fields=fields, # type: ignore[arg-type] + headers=headers, + **urlopen_kw, + ) + else: + return self.request_encode_body( + method, url, fields=fields, headers=headers, **urlopen_kw + ) + + def request_encode_url( + self, + method: str, + url: str, + fields: _TYPE_ENCODE_URL_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + **urlopen_kw: str, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the ``fields`` encoded in + the url. This is useful for request methods like GET, HEAD, DELETE, etc. + """ + if headers is None: + headers = self.headers + + extra_kw: dict[str, typing.Any] = {"headers": headers} + extra_kw.update(urlopen_kw) + + if fields: + url += "?" + urlencode(fields) + + return self.urlopen(method, url, **extra_kw) + + def request_encode_body( + self, + method: str, + url: str, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + encode_multipart: bool = True, + multipart_boundary: str | None = None, + **urlopen_kw: str, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the ``fields`` encoded in + the body. This is useful for request methods like POST, PUT, PATCH, etc. + + When ``encode_multipart=True`` (default), then + :func:`urllib3.encode_multipart_formdata` is used to encode + the payload with the appropriate content type. Otherwise + :func:`urllib.parse.urlencode` is used with the + 'application/x-www-form-urlencoded' content type. + + Multipart encoding must be used when posting files, and it's reasonably + safe to use it in other times too. However, it may break request + signing, such as with OAuth. + + Supports an optional ``fields`` parameter of key/value strings AND + key/filetuple. A filetuple is a (filename, data, MIME type) tuple where + the MIME type is optional. For example:: + + fields = { + 'foo': 'bar', + 'fakefile': ('foofile.txt', 'contents of foofile'), + 'realfile': ('barfile.txt', open('realfile').read()), + 'typedfile': ('bazfile.bin', open('bazfile').read(), + 'image/jpeg'), + 'nonamefile': 'contents of nonamefile field', + } + + When uploading a file, providing a filename (the first parameter of the + tuple) is optional but recommended to best mimic behavior of browsers. + + Note that if ``headers`` are supplied, the 'Content-Type' header will + be overwritten because it depends on the dynamic random boundary string + which is used to compose the body of the request. The random boundary + string can be explicitly set with the ``multipart_boundary`` parameter. + """ + if headers is None: + headers = self.headers + + extra_kw: dict[str, typing.Any] = {"headers": HTTPHeaderDict(headers)} + body: bytes | str + + if fields: + if "body" in urlopen_kw: + raise TypeError( + "request got values for both 'fields' and 'body', can only specify one." + ) + + if encode_multipart: + body, content_type = encode_multipart_formdata( + fields, boundary=multipart_boundary + ) + else: + body, content_type = ( + urlencode(fields), # type: ignore[arg-type] + "application/x-www-form-urlencoded", + ) + + extra_kw["body"] = body + extra_kw["headers"].setdefault("Content-Type", content_type) + + extra_kw.update(urlopen_kw) + + return self.urlopen(method, url, **extra_kw) diff --git a/billinglayer/python/urllib3/_version.py b/billinglayer/python/urllib3/_version.py new file mode 100644 index 0000000..782af43 --- /dev/null +++ b/billinglayer/python/urllib3/_version.py @@ -0,0 +1,4 @@ +# This file is protected via CODEOWNERS +from __future__ import annotations + +__version__ = "2.0.4" diff --git a/billinglayer/python/urllib3/connection.py b/billinglayer/python/urllib3/connection.py new file mode 100644 index 0000000..10109fa --- /dev/null +++ b/billinglayer/python/urllib3/connection.py @@ -0,0 +1,906 @@ +from __future__ import annotations + +import datetime +import logging +import os +import re +import socket +import sys +import typing +import warnings +from http.client import HTTPConnection as _HTTPConnection +from http.client import HTTPException as HTTPException # noqa: F401 +from http.client import ResponseNotReady +from socket import timeout as SocketTimeout + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + + from .response import HTTPResponse + from .util.ssl_ import _TYPE_PEER_CERT_RET_DICT + from .util.ssltransport import SSLTransport + +from ._collections import HTTPHeaderDict +from .util.response import assert_header_parsing +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT, Timeout +from .util.util import to_str +from .util.wait import wait_for_read + +try: # Compiled with SSL? + import ssl + + BaseSSLError = ssl.SSLError +except (ImportError, AttributeError): + ssl = None # type: ignore[assignment] + + class BaseSSLError(BaseException): # type: ignore[no-redef] + pass + + +from ._base_connection import _TYPE_BODY +from ._base_connection import ProxyConfig as ProxyConfig +from ._base_connection import _ResponseOptions as _ResponseOptions +from ._version import __version__ +from .exceptions import ( + ConnectTimeoutError, + HeaderParsingError, + NameResolutionError, + NewConnectionError, + ProxyError, + SystemTimeWarning, +) +from .util import SKIP_HEADER, SKIPPABLE_HEADERS, connection, ssl_ +from .util.request import body_to_chunks +from .util.ssl_ import assert_fingerprint as _assert_fingerprint +from .util.ssl_ import ( + create_urllib3_context, + is_ipaddress, + resolve_cert_reqs, + resolve_ssl_version, + ssl_wrap_socket, +) +from .util.ssl_match_hostname import CertificateError, match_hostname +from .util.url import Url + +# Not a no-op, we're adding this to the namespace so it can be imported. +ConnectionError = ConnectionError +BrokenPipeError = BrokenPipeError + + +log = logging.getLogger(__name__) + +port_by_scheme = {"http": 80, "https": 443} + +# When it comes time to update this value as a part of regular maintenance +# (ie test_recent_date is failing) update it to ~6 months before the current date. +RECENT_DATE = datetime.date(2022, 1, 1) + +_CONTAINS_CONTROL_CHAR_RE = re.compile(r"[^-!#$%&'*+.^_`|~0-9a-zA-Z]") + +_HAS_SYS_AUDIT = hasattr(sys, "audit") + + +class HTTPConnection(_HTTPConnection): + """ + Based on :class:`http.client.HTTPConnection` but provides an extra constructor + backwards-compatibility layer between older and newer Pythons. + + Additional keyword parameters are used to configure attributes of the connection. + Accepted parameters include: + + - ``source_address``: Set the source address for the current connection. + - ``socket_options``: Set specific options on the underlying socket. If not specified, then + defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling + Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy. + + For example, if you wish to enable TCP Keep Alive in addition to the defaults, + you might pass: + + .. code-block:: python + + HTTPConnection.default_socket_options + [ + (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), + ] + + Or you may want to disable the defaults by passing an empty list (e.g., ``[]``). + """ + + default_port: typing.ClassVar[int] = port_by_scheme["http"] # type: ignore[misc] + + #: Disable Nagle's algorithm by default. + #: ``[(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]`` + default_socket_options: typing.ClassVar[connection._TYPE_SOCKET_OPTIONS] = [ + (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + ] + + #: Whether this connection verifies the host's certificate. + is_verified: bool = False + + #: Whether this proxy connection verified the proxy host's certificate. + # If no proxy is currently connected to the value will be ``None``. + proxy_is_verified: bool | None = None + + blocksize: int + source_address: tuple[str, int] | None + socket_options: connection._TYPE_SOCKET_OPTIONS | None + + _has_connected_to_proxy: bool + _response_options: _ResponseOptions | None + _tunnel_host: str | None + _tunnel_port: int | None + _tunnel_scheme: str | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: None + | (connection._TYPE_SOCKET_OPTIONS) = default_socket_options, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + ) -> None: + super().__init__( + host=host, + port=port, + timeout=Timeout.resolve_default_timeout(timeout), + source_address=source_address, + blocksize=blocksize, + ) + self.socket_options = socket_options + self.proxy = proxy + self.proxy_config = proxy_config + + self._has_connected_to_proxy = False + self._response_options = None + self._tunnel_host: str | None = None + self._tunnel_port: int | None = None + self._tunnel_scheme: str | None = None + + # https://github.com/python/mypy/issues/4125 + # Mypy treats this as LSP violation, which is considered a bug. + # If `host` is made a property it violates LSP, because a writeable attribute is overridden with a read-only one. + # However, there is also a `host` setter so LSP is not violated. + # Potentially, a `@host.deleter` might be needed depending on how this issue will be fixed. + @property + def host(self) -> str: + """ + Getter method to remove any trailing dots that indicate the hostname is an FQDN. + + In general, SSL certificates don't include the trailing dot indicating a + fully-qualified domain name, and thus, they don't validate properly when + checked against a domain name that includes the dot. In addition, some + servers may not expect to receive the trailing dot when provided. + + However, the hostname with trailing dot is critical to DNS resolution; doing a + lookup with the trailing dot will properly only resolve the appropriate FQDN, + whereas a lookup without a trailing dot will search the system's search domain + list. Thus, it's important to keep the original host around for use only in + those cases where it's appropriate (i.e., when doing DNS lookup to establish the + actual TCP connection across which we're going to send HTTP requests). + """ + return self._dns_host.rstrip(".") + + @host.setter + def host(self, value: str) -> None: + """ + Setter for the `host` property. + + We assume that only urllib3 uses the _dns_host attribute; httplib itself + only uses `host`, and it seems reasonable that other libraries follow suit. + """ + self._dns_host = value + + def _new_conn(self) -> socket.socket: + """Establish a socket connection and set nodelay settings on it. + + :return: New socket connection. + """ + try: + sock = connection.create_connection( + (self._dns_host, self.port), + self.timeout, + source_address=self.source_address, + socket_options=self.socket_options, + ) + except socket.gaierror as e: + raise NameResolutionError(self.host, self, e) from e + except SocketTimeout as e: + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + + except OSError as e: + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + # Audit hooks are only available in Python 3.8+ + if _HAS_SYS_AUDIT: + sys.audit("http.client.connect", self, self.host, self.port) + + return sock + + def set_tunnel( + self, + host: str, + port: int | None = None, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: + if scheme not in ("http", "https"): + raise ValueError( + f"Invalid proxy scheme for tunneling: {scheme!r}, must be either 'http' or 'https'" + ) + super().set_tunnel(host, port=port, headers=headers) + self._tunnel_scheme = scheme + + def connect(self) -> None: + self.sock = self._new_conn() + if self._tunnel_host: + # If we're tunneling it means we're connected to our proxy. + self._has_connected_to_proxy = True + + # TODO: Fix tunnel so it doesn't depend on self.sock state. + self._tunnel() # type: ignore[attr-defined] + + # If there's a proxy to be connected to we are fully connected. + # This is set twice (once above and here) due to forwarding proxies + # not using tunnelling. + self._has_connected_to_proxy = bool(self.proxy) + + @property + def is_closed(self) -> bool: + return self.sock is None + + @property + def is_connected(self) -> bool: + if self.sock is None: + return False + return not wait_for_read(self.sock, timeout=0.0) + + @property + def has_connected_to_proxy(self) -> bool: + return self._has_connected_to_proxy + + def close(self) -> None: + try: + super().close() + finally: + # Reset all stateful properties so connection + # can be re-used without leaking prior configs. + self.sock = None + self.is_verified = False + self.proxy_is_verified = None + self._has_connected_to_proxy = False + self._response_options = None + self._tunnel_host = None + self._tunnel_port = None + self._tunnel_scheme = None + + def putrequest( + self, + method: str, + url: str, + skip_host: bool = False, + skip_accept_encoding: bool = False, + ) -> None: + """""" + # Empty docstring because the indentation of CPython's implementation + # is broken but we don't want this method in our documentation. + match = _CONTAINS_CONTROL_CHAR_RE.search(method) + if match: + raise ValueError( + f"Method cannot contain non-token characters {method!r} (found at least {match.group()!r})" + ) + + return super().putrequest( + method, url, skip_host=skip_host, skip_accept_encoding=skip_accept_encoding + ) + + def putheader(self, header: str, *values: str) -> None: + """""" + if not any(isinstance(v, str) and v == SKIP_HEADER for v in values): + super().putheader(header, *values) + elif to_str(header.lower()) not in SKIPPABLE_HEADERS: + skippable_headers = "', '".join( + [str.title(header) for header in sorted(SKIPPABLE_HEADERS)] + ) + raise ValueError( + f"urllib3.util.SKIP_HEADER only supports '{skippable_headers}'" + ) + + # `request` method's signature intentionally violates LSP. + # urllib3's API is different from `http.client.HTTPConnection` and the subclassing is only incidental. + def request( # type: ignore[override] + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + *, + chunked: bool = False, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> None: + # Update the inner socket's timeout value to send the request. + # This only triggers if the connection is re-used. + if self.sock is not None: + self.sock.settimeout(self.timeout) + + # Store these values to be fed into the HTTPResponse + # object later. TODO: Remove this in favor of a real + # HTTP lifecycle mechanism. + + # We have to store these before we call .request() + # because sometimes we can still salvage a response + # off the wire even if we aren't able to completely + # send the request body. + self._response_options = _ResponseOptions( + request_method=method, + request_url=url, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + if headers is None: + headers = {} + header_keys = frozenset(to_str(k.lower()) for k in headers) + skip_accept_encoding = "accept-encoding" in header_keys + skip_host = "host" in header_keys + self.putrequest( + method, url, skip_accept_encoding=skip_accept_encoding, skip_host=skip_host + ) + + # Transform the body into an iterable of sendall()-able chunks + # and detect if an explicit Content-Length is doable. + chunks_and_cl = body_to_chunks(body, method=method, blocksize=self.blocksize) + chunks = chunks_and_cl.chunks + content_length = chunks_and_cl.content_length + + # When chunked is explicit set to 'True' we respect that. + if chunked: + if "transfer-encoding" not in header_keys: + self.putheader("Transfer-Encoding", "chunked") + else: + # Detect whether a framing mechanism is already in use. If so + # we respect that value, otherwise we pick chunked vs content-length + # depending on the type of 'body'. + if "content-length" in header_keys: + chunked = False + elif "transfer-encoding" in header_keys: + chunked = True + + # Otherwise we go off the recommendation of 'body_to_chunks()'. + else: + chunked = False + if content_length is None: + if chunks is not None: + chunked = True + self.putheader("Transfer-Encoding", "chunked") + else: + self.putheader("Content-Length", str(content_length)) + + # Now that framing headers are out of the way we send all the other headers. + if "user-agent" not in header_keys: + self.putheader("User-Agent", _get_default_user_agent()) + for header, value in headers.items(): + self.putheader(header, value) + self.endheaders() + + # If we're given a body we start sending that in chunks. + if chunks is not None: + for chunk in chunks: + # Sending empty chunks isn't allowed for TE: chunked + # as it indicates the end of the body. + if not chunk: + continue + if isinstance(chunk, str): + chunk = chunk.encode("utf-8") + if chunked: + self.send(b"%x\r\n%b\r\n" % (len(chunk), chunk)) + else: + self.send(chunk) + + # Regardless of whether we have a body or not, if we're in + # chunked mode we want to send an explicit empty chunk. + if chunked: + self.send(b"0\r\n\r\n") + + def request_chunked( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + ) -> None: + """ + Alternative to the common request method, which sends the + body with chunked encoding and not as one block + """ + warnings.warn( + "HTTPConnection.request_chunked() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead use HTTPConnection.request(..., chunked=True).", + category=DeprecationWarning, + stacklevel=2, + ) + self.request(method, url, body=body, headers=headers, chunked=True) + + def getresponse( # type: ignore[override] + self, + ) -> HTTPResponse: + """ + Get the response from the server. + + If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable. + + If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed. + """ + # Raise the same error as http.client.HTTPConnection + if self._response_options is None: + raise ResponseNotReady() + + # Reset this attribute for being used again. + resp_options = self._response_options + self._response_options = None + + # Since the connection's timeout value may have been updated + # we need to set the timeout on the socket. + self.sock.settimeout(self.timeout) + + # This is needed here to avoid circular import errors + from .response import HTTPResponse + + # Get the response from http.client.HTTPConnection + httplib_response = super().getresponse() + + try: + assert_header_parsing(httplib_response.msg) + except (HeaderParsingError, TypeError) as hpe: + log.warning( + "Failed to parse headers (url=%s): %s", + _url_from_connection(self, resp_options.request_url), + hpe, + exc_info=True, + ) + + headers = HTTPHeaderDict(httplib_response.msg.items()) + + response = HTTPResponse( + body=httplib_response, + headers=headers, + status=httplib_response.status, + version=httplib_response.version, + reason=httplib_response.reason, + preload_content=resp_options.preload_content, + decode_content=resp_options.decode_content, + original_response=httplib_response, + enforce_content_length=resp_options.enforce_content_length, + request_method=resp_options.request_method, + request_url=resp_options.request_url, + ) + return response + + +class HTTPSConnection(HTTPConnection): + """ + Many of the parameters to this constructor are passed to the underlying SSL + socket by means of :py:func:`urllib3.util.ssl_wrap_socket`. + """ + + default_port = port_by_scheme["https"] # type: ignore[misc] + + cert_reqs: int | str | None = None + ca_certs: str | None = None + ca_cert_dir: str | None = None + ca_cert_data: None | str | bytes = None + ssl_version: int | str | None = None + ssl_minimum_version: int | None = None + ssl_maximum_version: int | None = None + assert_fingerprint: str | None = None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: None + | (connection._TYPE_SOCKET_OPTIONS) = HTTPConnection.default_socket_options, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + cert_reqs: int | str | None = None, + assert_hostname: None | str | Literal[False] = None, + assert_fingerprint: str | None = None, + server_hostname: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_certs: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + ssl_version: int | str | None = None, # Deprecated + cert_file: str | None = None, + key_file: str | None = None, + key_password: str | None = None, + ) -> None: + super().__init__( + host, + port=port, + timeout=timeout, + source_address=source_address, + blocksize=blocksize, + socket_options=socket_options, + proxy=proxy, + proxy_config=proxy_config, + ) + + self.key_file = key_file + self.cert_file = cert_file + self.key_password = key_password + self.ssl_context = ssl_context + self.server_hostname = server_hostname + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + self.ssl_version = ssl_version + self.ssl_minimum_version = ssl_minimum_version + self.ssl_maximum_version = ssl_maximum_version + self.ca_certs = ca_certs and os.path.expanduser(ca_certs) + self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) + self.ca_cert_data = ca_cert_data + + # cert_reqs depends on ssl_context so calculate last. + if cert_reqs is None: + if self.ssl_context is not None: + cert_reqs = self.ssl_context.verify_mode + else: + cert_reqs = resolve_cert_reqs(None) + self.cert_reqs = cert_reqs + + def set_cert( + self, + key_file: str | None = None, + cert_file: str | None = None, + cert_reqs: int | str | None = None, + key_password: str | None = None, + ca_certs: str | None = None, + assert_hostname: None | str | Literal[False] = None, + assert_fingerprint: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ) -> None: + """ + This method should only be called once, before the connection is used. + """ + warnings.warn( + "HTTPSConnection.set_cert() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead provide the parameters to the " + "HTTPSConnection constructor.", + category=DeprecationWarning, + stacklevel=2, + ) + + # If cert_reqs is not provided we'll assume CERT_REQUIRED unless we also + # have an SSLContext object in which case we'll use its verify_mode. + if cert_reqs is None: + if self.ssl_context is not None: + cert_reqs = self.ssl_context.verify_mode + else: + cert_reqs = resolve_cert_reqs(None) + + self.key_file = key_file + self.cert_file = cert_file + self.cert_reqs = cert_reqs + self.key_password = key_password + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + self.ca_certs = ca_certs and os.path.expanduser(ca_certs) + self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) + self.ca_cert_data = ca_cert_data + + def connect(self) -> None: + sock: socket.socket | ssl.SSLSocket + self.sock = sock = self._new_conn() + server_hostname: str = self.host + tls_in_tls = False + + # Do we need to establish a tunnel? + if self._tunnel_host is not None: + # We're tunneling to an HTTPS origin so need to do TLS-in-TLS. + if self._tunnel_scheme == "https": + self.sock = sock = self._connect_tls_proxy(self.host, sock) + tls_in_tls = True + + # If we're tunneling it means we're connected to our proxy. + self._has_connected_to_proxy = True + + self._tunnel() # type: ignore[attr-defined] + # Override the host with the one we're requesting data from. + server_hostname = self._tunnel_host + + if self.server_hostname is not None: + server_hostname = self.server_hostname + + is_time_off = datetime.date.today() < RECENT_DATE + if is_time_off: + warnings.warn( + ( + f"System time is way off (before {RECENT_DATE}). This will probably " + "lead to SSL verification errors" + ), + SystemTimeWarning, + ) + + sock_and_verified = _ssl_wrap_socket_and_match_hostname( + sock=sock, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + ca_cert_data=self.ca_cert_data, + cert_file=self.cert_file, + key_file=self.key_file, + key_password=self.key_password, + server_hostname=server_hostname, + ssl_context=self.ssl_context, + tls_in_tls=tls_in_tls, + assert_hostname=self.assert_hostname, + assert_fingerprint=self.assert_fingerprint, + ) + self.sock = sock_and_verified.socket + self.is_verified = sock_and_verified.is_verified + + # If there's a proxy to be connected to we are fully connected. + # This is set twice (once above and here) due to forwarding proxies + # not using tunnelling. + self._has_connected_to_proxy = bool(self.proxy) + + def _connect_tls_proxy(self, hostname: str, sock: socket.socket) -> ssl.SSLSocket: + """ + Establish a TLS connection to the proxy using the provided SSL context. + """ + # `_connect_tls_proxy` is called when self._tunnel_host is truthy. + proxy_config = typing.cast(ProxyConfig, self.proxy_config) + ssl_context = proxy_config.ssl_context + sock_and_verified = _ssl_wrap_socket_and_match_hostname( + sock, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + ca_cert_data=self.ca_cert_data, + server_hostname=hostname, + ssl_context=ssl_context, + assert_hostname=proxy_config.assert_hostname, + assert_fingerprint=proxy_config.assert_fingerprint, + # Features that aren't implemented for proxies yet: + cert_file=None, + key_file=None, + key_password=None, + tls_in_tls=False, + ) + self.proxy_is_verified = sock_and_verified.is_verified + return sock_and_verified.socket # type: ignore[return-value] + + +class _WrappedAndVerifiedSocket(typing.NamedTuple): + """ + Wrapped socket and whether the connection is + verified after the TLS handshake + """ + + socket: ssl.SSLSocket | SSLTransport + is_verified: bool + + +def _ssl_wrap_socket_and_match_hostname( + sock: socket.socket, + *, + cert_reqs: None | str | int, + ssl_version: None | str | int, + ssl_minimum_version: int | None, + ssl_maximum_version: int | None, + cert_file: str | None, + key_file: str | None, + key_password: str | None, + ca_certs: str | None, + ca_cert_dir: str | None, + ca_cert_data: None | str | bytes, + assert_hostname: None | str | Literal[False], + assert_fingerprint: str | None, + server_hostname: str | None, + ssl_context: ssl.SSLContext | None, + tls_in_tls: bool = False, +) -> _WrappedAndVerifiedSocket: + """Logic for constructing an SSLContext from all TLS parameters, passing + that down into ssl_wrap_socket, and then doing certificate verification + either via hostname or fingerprint. This function exists to guarantee + that both proxies and targets have the same behavior when connecting via TLS. + """ + default_ssl_context = False + if ssl_context is None: + default_ssl_context = True + context = create_urllib3_context( + ssl_version=resolve_ssl_version(ssl_version), + ssl_minimum_version=ssl_minimum_version, + ssl_maximum_version=ssl_maximum_version, + cert_reqs=resolve_cert_reqs(cert_reqs), + ) + else: + context = ssl_context + + context.verify_mode = resolve_cert_reqs(cert_reqs) + + # In some cases, we want to verify hostnames ourselves + if ( + # `ssl` can't verify fingerprints or alternate hostnames + assert_fingerprint + or assert_hostname + # assert_hostname can be set to False to disable hostname checking + or assert_hostname is False + # We still support OpenSSL 1.0.2, which prevents us from verifying + # hostnames easily: https://github.com/pyca/pyopenssl/pull/933 + or ssl_.IS_PYOPENSSL + or not ssl_.HAS_NEVER_CHECK_COMMON_NAME + ): + context.check_hostname = False + + # Try to load OS default certs if none are given. + # We need to do the hasattr() check for our custom + # pyOpenSSL and SecureTransport SSLContext objects + # because neither support load_default_certs(). + if ( + not ca_certs + and not ca_cert_dir + and not ca_cert_data + and default_ssl_context + and hasattr(context, "load_default_certs") + ): + context.load_default_certs() + + # Ensure that IPv6 addresses are in the proper format and don't have a + # scope ID. Python's SSL module fails to recognize scoped IPv6 addresses + # and interprets them as DNS hostnames. + if server_hostname is not None: + normalized = server_hostname.strip("[]") + if "%" in normalized: + normalized = normalized[: normalized.rfind("%")] + if is_ipaddress(normalized): + server_hostname = normalized + + ssl_sock = ssl_wrap_socket( + sock=sock, + keyfile=key_file, + certfile=cert_file, + key_password=key_password, + ca_certs=ca_certs, + ca_cert_dir=ca_cert_dir, + ca_cert_data=ca_cert_data, + server_hostname=server_hostname, + ssl_context=context, + tls_in_tls=tls_in_tls, + ) + + try: + if assert_fingerprint: + _assert_fingerprint( + ssl_sock.getpeercert(binary_form=True), assert_fingerprint + ) + elif ( + context.verify_mode != ssl.CERT_NONE + and not context.check_hostname + and assert_hostname is not False + ): + cert: _TYPE_PEER_CERT_RET_DICT = ssl_sock.getpeercert() # type: ignore[assignment] + + # Need to signal to our match_hostname whether to use 'commonName' or not. + # If we're using our own constructed SSLContext we explicitly set 'False' + # because PyPy hard-codes 'True' from SSLContext.hostname_checks_common_name. + if default_ssl_context: + hostname_checks_common_name = False + else: + hostname_checks_common_name = ( + getattr(context, "hostname_checks_common_name", False) or False + ) + + _match_hostname( + cert, + assert_hostname or server_hostname, # type: ignore[arg-type] + hostname_checks_common_name, + ) + + return _WrappedAndVerifiedSocket( + socket=ssl_sock, + is_verified=context.verify_mode == ssl.CERT_REQUIRED + or bool(assert_fingerprint), + ) + except BaseException: + ssl_sock.close() + raise + + +def _match_hostname( + cert: _TYPE_PEER_CERT_RET_DICT | None, + asserted_hostname: str, + hostname_checks_common_name: bool = False, +) -> None: + # Our upstream implementation of ssl.match_hostname() + # only applies this normalization to IP addresses so it doesn't + # match DNS SANs so we do the same thing! + stripped_hostname = asserted_hostname.strip("[]") + if is_ipaddress(stripped_hostname): + asserted_hostname = stripped_hostname + + try: + match_hostname(cert, asserted_hostname, hostname_checks_common_name) + except CertificateError as e: + log.warning( + "Certificate did not match expected hostname: %s. Certificate: %s", + asserted_hostname, + cert, + ) + # Add cert to exception and reraise so client code can inspect + # the cert when catching the exception, if they want to + e._peer_cert = cert # type: ignore[attr-defined] + raise + + +def _wrap_proxy_error(err: Exception, proxy_scheme: str | None) -> ProxyError: + # Look for the phrase 'wrong version number', if found + # then we should warn the user that we're very sure that + # this proxy is HTTP-only and they have a configuration issue. + error_normalized = " ".join(re.split("[^a-z]", str(err).lower())) + is_likely_http_proxy = ( + "wrong version number" in error_normalized + or "unknown protocol" in error_normalized + ) + http_proxy_warning = ( + ". Your proxy appears to only use HTTP and not HTTPS, " + "try changing your proxy URL to be HTTP. See: " + "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" + "#https-proxy-error-http-proxy" + ) + new_err = ProxyError( + f"Unable to connect to proxy" + f"{http_proxy_warning if is_likely_http_proxy and proxy_scheme == 'https' else ''}", + err, + ) + new_err.__cause__ = err + return new_err + + +def _get_default_user_agent() -> str: + return f"python-urllib3/{__version__}" + + +class DummyConnection: + """Used to detect a failed ConnectionCls import.""" + + +if not ssl: + HTTPSConnection = DummyConnection # type: ignore[misc, assignment] # noqa: F811 + + +VerifiedHTTPSConnection = HTTPSConnection + + +def _url_from_connection( + conn: HTTPConnection | HTTPSConnection, path: str | None = None +) -> str: + """Returns the URL from a given connection. This is mainly used for testing and logging.""" + + scheme = "https" if isinstance(conn, HTTPSConnection) else "http" + + return Url(scheme=scheme, host=conn.host, port=conn.port, path=path).url diff --git a/billinglayer/python/urllib3/connectionpool.py b/billinglayer/python/urllib3/connectionpool.py new file mode 100644 index 0000000..2479405 --- /dev/null +++ b/billinglayer/python/urllib3/connectionpool.py @@ -0,0 +1,1178 @@ +from __future__ import annotations + +import errno +import logging +import queue +import sys +import typing +import warnings +import weakref +from socket import timeout as SocketTimeout +from types import TracebackType + +from ._base_connection import _TYPE_BODY +from ._request_methods import RequestMethods +from .connection import ( + BaseSSLError, + BrokenPipeError, + DummyConnection, + HTTPConnection, + HTTPException, + HTTPSConnection, + ProxyConfig, + _wrap_proxy_error, +) +from .connection import port_by_scheme as port_by_scheme +from .exceptions import ( + ClosedPoolError, + EmptyPoolError, + FullPoolError, + HostChangedError, + InsecureRequestWarning, + LocationValueError, + MaxRetryError, + NewConnectionError, + ProtocolError, + ProxyError, + ReadTimeoutError, + SSLError, + TimeoutError, +) +from .response import BaseHTTPResponse +from .util.connection import is_connection_dropped +from .util.proxy import connection_requires_http_tunnel +from .util.request import _TYPE_BODY_POSITION, set_file_position +from .util.retry import Retry +from .util.ssl_match_hostname import CertificateError +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_DEFAULT, Timeout +from .util.url import Url, _encode_target +from .util.url import _normalize_host as normalize_host +from .util.url import parse_url +from .util.util import to_str + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Literal + + from ._base_connection import BaseHTTPConnection, BaseHTTPSConnection + +log = logging.getLogger(__name__) + +_TYPE_TIMEOUT = typing.Union[Timeout, float, _TYPE_DEFAULT, None] + +_SelfT = typing.TypeVar("_SelfT") + + +# Pool objects +class ConnectionPool: + """ + Base class for all connection pools, such as + :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. + + .. note:: + ConnectionPool.urlopen() does not normalize or percent-encode target URIs + which is useful if your target server doesn't support percent-encoded + target URIs. + """ + + scheme: str | None = None + QueueCls = queue.LifoQueue + + def __init__(self, host: str, port: int | None = None) -> None: + if not host: + raise LocationValueError("No host specified.") + + self.host = _normalize_host(host, scheme=self.scheme) + self.port = port + + # This property uses 'normalize_host()' (not '_normalize_host()') + # to avoid removing square braces around IPv6 addresses. + # This value is sent to `HTTPConnection.set_tunnel()` if called + # because square braces are required for HTTP CONNECT tunneling. + self._tunnel_host = normalize_host(host, scheme=self.scheme).lower() + + def __str__(self) -> str: + return f"{type(self).__name__}(host={self.host!r}, port={self.port!r})" + + def __enter__(self: _SelfT) -> _SelfT: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> Literal[False]: + self.close() + # Return False to re-raise any potential exceptions + return False + + def close(self) -> None: + """ + Close all pooled connections and disable the pool. + """ + + +# This is taken from http://hg.python.org/cpython/file/7aaba721ebc0/Lib/socket.py#l252 +_blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} + + +class HTTPConnectionPool(ConnectionPool, RequestMethods): + """ + Thread-safe connection pool for one host. + + :param host: + Host used for this HTTP Connection (e.g. "localhost"), passed into + :class:`http.client.HTTPConnection`. + + :param port: + Port used for this HTTP Connection (None is equivalent to 80), passed + into :class:`http.client.HTTPConnection`. + + :param timeout: + Socket timeout in seconds for each individual connection. This can + be a float or integer, which sets the timeout for the HTTP request, + or an instance of :class:`urllib3.util.Timeout` which gives you more + fine-grained control over request timeouts. After the constructor has + been parsed, this is always a `urllib3.util.Timeout` object. + + :param maxsize: + Number of connections to save that can be reused. More than 1 is useful + in multithreaded situations. If ``block`` is set to False, more + connections will be created but they will not be saved once they've + been used. + + :param block: + If set to True, no more than ``maxsize`` connections will be used at + a time. When no free connections are available, the call will block + until a connection has been released. This is a useful side effect for + particular multithreaded situations where one does not want to use more + than maxsize connections per host to prevent flooding. + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + + :param retries: + Retry configuration to use by default with requests in this pool. + + :param _proxy: + Parsed proxy URL, should not be used directly, instead, see + :class:`urllib3.ProxyManager` + + :param _proxy_headers: + A dictionary with proxy headers, should not be used directly, + instead, see :class:`urllib3.ProxyManager` + + :param \\**conn_kw: + Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, + :class:`urllib3.connection.HTTPSConnection` instances. + """ + + scheme = "http" + ConnectionCls: ( + type[BaseHTTPConnection] | type[BaseHTTPSConnection] + ) = HTTPConnection + + def __init__( + self, + host: str, + port: int | None = None, + timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, + maxsize: int = 1, + block: bool = False, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + _proxy: Url | None = None, + _proxy_headers: typing.Mapping[str, str] | None = None, + _proxy_config: ProxyConfig | None = None, + **conn_kw: typing.Any, + ): + ConnectionPool.__init__(self, host, port) + RequestMethods.__init__(self, headers) + + if not isinstance(timeout, Timeout): + timeout = Timeout.from_float(timeout) + + if retries is None: + retries = Retry.DEFAULT + + self.timeout = timeout + self.retries = retries + + self.pool: queue.LifoQueue[typing.Any] | None = self.QueueCls(maxsize) + self.block = block + + self.proxy = _proxy + self.proxy_headers = _proxy_headers or {} + self.proxy_config = _proxy_config + + # Fill the queue up so that doing get() on it will block properly + for _ in range(maxsize): + self.pool.put(None) + + # These are mostly for testing and debugging purposes. + self.num_connections = 0 + self.num_requests = 0 + self.conn_kw = conn_kw + + if self.proxy: + # Enable Nagle's algorithm for proxies, to avoid packet fragmentation. + # We cannot know if the user has added default socket options, so we cannot replace the + # list. + self.conn_kw.setdefault("socket_options", []) + + self.conn_kw["proxy"] = self.proxy + self.conn_kw["proxy_config"] = self.proxy_config + + # Do not pass 'self' as callback to 'finalize'. + # Then the 'finalize' would keep an endless living (leak) to self. + # By just passing a reference to the pool allows the garbage collector + # to free self if nobody else has a reference to it. + pool = self.pool + + # Close all the HTTPConnections in the pool before the + # HTTPConnectionPool object is garbage collected. + weakref.finalize(self, _close_pool_connections, pool) + + def _new_conn(self) -> BaseHTTPConnection: + """ + Return a fresh :class:`HTTPConnection`. + """ + self.num_connections += 1 + log.debug( + "Starting new HTTP connection (%d): %s:%s", + self.num_connections, + self.host, + self.port or "80", + ) + + conn = self.ConnectionCls( + host=self.host, + port=self.port, + timeout=self.timeout.connect_timeout, + **self.conn_kw, + ) + return conn + + def _get_conn(self, timeout: float | None = None) -> BaseHTTPConnection: + """ + Get a connection. Will return a pooled connection if one is available. + + If no connections are available and :prop:`.block` is ``False``, then a + fresh connection is returned. + + :param timeout: + Seconds to wait before giving up and raising + :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and + :prop:`.block` is ``True``. + """ + conn = None + + if self.pool is None: + raise ClosedPoolError(self, "Pool is closed.") + + try: + conn = self.pool.get(block=self.block, timeout=timeout) + + except AttributeError: # self.pool is None + raise ClosedPoolError(self, "Pool is closed.") from None # Defensive: + + except queue.Empty: + if self.block: + raise EmptyPoolError( + self, + "Pool is empty and a new connection can't be opened due to blocking mode.", + ) from None + pass # Oh well, we'll create a new connection then + + # If this is a persistent connection, check if it got disconnected + if conn and is_connection_dropped(conn): + log.debug("Resetting dropped connection: %s", self.host) + conn.close() + + return conn or self._new_conn() + + def _put_conn(self, conn: BaseHTTPConnection | None) -> None: + """ + Put a connection back into the pool. + + :param conn: + Connection object for the current host and port as returned by + :meth:`._new_conn` or :meth:`._get_conn`. + + If the pool is already full, the connection is closed and discarded + because we exceeded maxsize. If connections are discarded frequently, + then maxsize should be increased. + + If the pool is closed, then the connection will be closed and discarded. + """ + if self.pool is not None: + try: + self.pool.put(conn, block=False) + return # Everything is dandy, done. + except AttributeError: + # self.pool is None. + pass + except queue.Full: + # Connection never got put back into the pool, close it. + if conn: + conn.close() + + if self.block: + # This should never happen if you got the conn from self._get_conn + raise FullPoolError( + self, + "Pool reached maximum size and no more connections are allowed.", + ) from None + + log.warning( + "Connection pool is full, discarding connection: %s. Connection pool size: %s", + self.host, + self.pool.qsize(), + ) + + # Connection never got put back into the pool, close it. + if conn: + conn.close() + + def _validate_conn(self, conn: BaseHTTPConnection) -> None: + """ + Called right before a request is made, after the socket is created. + """ + + def _prepare_proxy(self, conn: BaseHTTPConnection) -> None: + # Nothing to do for HTTP connections. + pass + + def _get_timeout(self, timeout: _TYPE_TIMEOUT) -> Timeout: + """Helper that always returns a :class:`urllib3.util.Timeout`""" + if timeout is _DEFAULT_TIMEOUT: + return self.timeout.clone() + + if isinstance(timeout, Timeout): + return timeout.clone() + else: + # User passed us an int/float. This is for backwards compatibility, + # can be removed later + return Timeout.from_float(timeout) + + def _raise_timeout( + self, + err: BaseSSLError | OSError | SocketTimeout, + url: str, + timeout_value: _TYPE_TIMEOUT | None, + ) -> None: + """Is the error actually a timeout? Will raise a ReadTimeout or pass""" + + if isinstance(err, SocketTimeout): + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err + + # See the above comment about EAGAIN in Python 3. + if hasattr(err, "errno") and err.errno in _blocking_errnos: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err + + def _make_request( + self, + conn: BaseHTTPConnection, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | None = None, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + chunked: bool = False, + response_conn: BaseHTTPConnection | None = None, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> BaseHTTPResponse: + """ + Perform a request on a given urllib connection object taken from our + pool. + + :param conn: + a connection from one of our connection pools + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + Pass ``None`` to retry until you receive a response. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param response_conn: + Set this to ``None`` if you will handle releasing the connection or + set the connection to have the response release it. + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + self.num_requests += 1 + + timeout_obj = self._get_timeout(timeout) + timeout_obj.start_connect() + conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) + + try: + # Trigger any extra validation we need to do. + try: + self._validate_conn(conn) + except (SocketTimeout, BaseSSLError) as e: + self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) + raise + + # _validate_conn() starts the connection to an HTTPS proxy + # so we need to wrap errors with 'ProxyError' here too. + except ( + OSError, + NewConnectionError, + TimeoutError, + BaseSSLError, + CertificateError, + SSLError, + ) as e: + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + # If the connection didn't successfully connect to it's proxy + # then there + if isinstance( + new_e, (OSError, NewConnectionError, TimeoutError, SSLError) + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + raise new_e + + # conn.request() calls http.client.*.request, not the method in + # urllib3.request. It also calls makefile (recv) on the socket. + try: + conn.request( + method, + url, + body=body, + headers=headers, + chunked=chunked, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + # We are swallowing BrokenPipeError (errno.EPIPE) since the server is + # legitimately able to close the connection after sending a valid response. + # With this behaviour, the received response is still readable. + except BrokenPipeError: + pass + except OSError as e: + # MacOS/Linux + # EPROTOTYPE is needed on macOS + # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/ + if e.errno != errno.EPROTOTYPE: + raise + + # Reset the timeout for the recv() on the socket + read_timeout = timeout_obj.read_timeout + + if not conn.is_closed: + # In Python 3 socket.py will catch EAGAIN and return None when you + # try and read into the file pointer created by http.client, which + # instead raises a BadStatusLine exception. Instead of catching + # the exception and assuming all BadStatusLine exceptions are read + # timeouts, check for a zero timeout before making the request. + if read_timeout == 0: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={read_timeout})" + ) + conn.timeout = read_timeout + + # Receive the response from the server + try: + response = conn.getresponse() + except (BaseSSLError, OSError) as e: + self._raise_timeout(err=e, url=url, timeout_value=read_timeout) + raise + + # Set properties that are used by the pooling layer. + response.retries = retries + response._connection = response_conn # type: ignore[attr-defined] + response._pool = self # type: ignore[attr-defined] + + log.debug( + '%s://%s:%s "%s %s %s" %s %s', + self.scheme, + self.host, + self.port, + method, + url, + # HTTP version + conn._http_vsn_str, # type: ignore[attr-defined] + response.status, + response.length_remaining, # type: ignore[attr-defined] + ) + + return response + + def close(self) -> None: + """ + Close all pooled connections and disable the pool. + """ + if self.pool is None: + return + # Disable access to the pool + old_pool, self.pool = self.pool, None + + # Close all the HTTPConnections in the pool. + _close_pool_connections(old_pool) + + def is_same_host(self, url: str) -> bool: + """ + Check if the given ``url`` is a member of the same host as this + connection pool. + """ + if url.startswith("/"): + return True + + # TODO: Add optional support for socket.gethostbyname checking. + scheme, _, host, port, *_ = parse_url(url) + scheme = scheme or "http" + if host is not None: + host = _normalize_host(host, scheme=scheme) + + # Use explicit default port for comparison when none is given + if self.port and not port: + port = port_by_scheme.get(scheme) + elif not self.port and port == port_by_scheme.get(scheme): + port = None + + return (scheme, host, port) == (self.scheme, self.host, self.port) + + def urlopen( # type: ignore[override] + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + redirect: bool = True, + assert_same_host: bool = True, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + pool_timeout: int | None = None, + release_conn: bool | None = None, + chunked: bool = False, + body_pos: _TYPE_BODY_POSITION | None = None, + preload_content: bool = True, + decode_content: bool = True, + **response_kw: typing.Any, + ) -> BaseHTTPResponse: + """ + Get a connection from the pool and perform an HTTP request. This is the + lowest level call for making a request, so you'll need to specify all + the raw details. + + .. note:: + + More commonly, it's appropriate to use a convenience method + such as :meth:`request`. + + .. note:: + + `release_conn` will only behave as expected if + `preload_content=False` because we want to make + `preload_content=False` the default behaviour someday soon without + breaking backwards compatibility. + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + Pass ``None`` to retry until you receive a response. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param redirect: + If True, automatically handle redirects (status codes 301, 302, + 303, 307, 308). Each redirect counts as a retry. Disabling retries + will disable redirect, too. + + :param assert_same_host: + If ``True``, will make sure that the host of the pool requests is + consistent else will raise HostChangedError. When ``False``, you can + use the pool on an HTTP proxy and request foreign hosts. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param pool_timeout: + If set and the pool is set to block=True, then this method will + block for ``pool_timeout`` seconds and raise EmptyPoolError if no + connection is available within the time period. + + :param bool preload_content: + If True, the response's body will be preloaded into memory. + + :param bool decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param release_conn: + If False, then the urlopen call will not release the connection + back into the pool once a response is received (but will release if + you read the entire contents of the response such as when + `preload_content=True`). This is useful if you're not preloading + the response's content immediately. You will need to call + ``r.release_conn()`` on the response ``r`` to return the connection + back into the pool. If None, it takes the value of ``preload_content`` + which defaults to ``True``. + + :param bool chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param int body_pos: + Position to seek to in file-like body in the event of a retry or + redirect. Typically this won't need to be set because urllib3 will + auto-populate the value when needed. + """ + parsed_url = parse_url(url) + destination_scheme = parsed_url.scheme + + if headers is None: + headers = self.headers + + if not isinstance(retries, Retry): + retries = Retry.from_int(retries, redirect=redirect, default=self.retries) + + if release_conn is None: + release_conn = preload_content + + # Check host + if assert_same_host and not self.is_same_host(url): + raise HostChangedError(self, url, retries) + + # Ensure that the URL we're connecting to is properly encoded + if url.startswith("/"): + url = to_str(_encode_target(url)) + else: + url = to_str(parsed_url.url) + + conn = None + + # Track whether `conn` needs to be released before + # returning/raising/recursing. Update this variable if necessary, and + # leave `release_conn` constant throughout the function. That way, if + # the function recurses, the original value of `release_conn` will be + # passed down into the recursive call, and its value will be respected. + # + # See issue #651 [1] for details. + # + # [1] + release_this_conn = release_conn + + http_tunnel_required = connection_requires_http_tunnel( + self.proxy, self.proxy_config, destination_scheme + ) + + # Merge the proxy headers. Only done when not using HTTP CONNECT. We + # have to copy the headers dict so we can safely change it without those + # changes being reflected in anyone else's copy. + if not http_tunnel_required: + headers = headers.copy() # type: ignore[attr-defined] + headers.update(self.proxy_headers) # type: ignore[union-attr] + + # Must keep the exception bound to a separate variable or else Python 3 + # complains about UnboundLocalError. + err = None + + # Keep track of whether we cleanly exited the except block. This + # ensures we do proper cleanup in finally. + clean_exit = False + + # Rewind body position, if needed. Record current position + # for future rewinds in the event of a redirect/retry. + body_pos = set_file_position(body, body_pos) + + try: + # Request a connection from the queue. + timeout_obj = self._get_timeout(timeout) + conn = self._get_conn(timeout=pool_timeout) + + conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] + + # Is this a closed/new connection that requires CONNECT tunnelling? + if self.proxy is not None and http_tunnel_required and conn.is_closed: + try: + self._prepare_proxy(conn) + except (BaseSSLError, OSError, SocketTimeout) as e: + self._raise_timeout( + err=e, url=self.proxy.url, timeout_value=conn.timeout + ) + raise + + # If we're going to release the connection in ``finally:``, then + # the response doesn't need to know about the connection. Otherwise + # it will also try to release it and we'll have a double-release + # mess. + response_conn = conn if not release_conn else None + + # Make the request on the HTTPConnection object + response = self._make_request( + conn, + method, + url, + timeout=timeout_obj, + body=body, + headers=headers, + chunked=chunked, + retries=retries, + response_conn=response_conn, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Everything went great! + clean_exit = True + + except EmptyPoolError: + # Didn't get a connection from the pool, no need to clean up + clean_exit = True + release_this_conn = False + raise + + except ( + TimeoutError, + HTTPException, + OSError, + ProtocolError, + BaseSSLError, + SSLError, + CertificateError, + ProxyError, + ) as e: + # Discard the connection for these exceptions. It will be + # replaced during the next _get_conn() call. + clean_exit = False + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + if isinstance( + new_e, + ( + OSError, + NewConnectionError, + TimeoutError, + SSLError, + HTTPException, + ), + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + elif isinstance(new_e, (OSError, HTTPException)): + new_e = ProtocolError("Connection aborted.", new_e) + + retries = retries.increment( + method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2] + ) + retries.sleep() + + # Keep track of the error for the retry warning. + err = e + + finally: + if not clean_exit: + # We hit some kind of exception, handled or otherwise. We need + # to throw the connection away unless explicitly told not to. + # Close the connection, set the variable to None, and make sure + # we put the None back in the pool to avoid leaking it. + if conn: + conn.close() + conn = None + release_this_conn = True + + if release_this_conn: + # Put the connection back to be reused. If the connection is + # expired then it will be None, which will get replaced with a + # fresh connection during _get_conn. + self._put_conn(conn) + + if not conn: + # Try again + log.warning( + "Retrying (%r) after connection broken by '%r': %s", retries, err, url + ) + return self.urlopen( + method, + url, + body, + headers, + retries, + redirect, + assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Handle redirect? + redirect_location = redirect and response.get_redirect_location() + if redirect_location: + if response.status == 303: + method = "GET" + + try: + retries = retries.increment(method, url, response=response, _pool=self) + except MaxRetryError: + if retries.raise_on_redirect: + response.drain_conn() + raise + return response + + response.drain_conn() + retries.sleep_for_retry(response) + log.debug("Redirecting %s -> %s", url, redirect_location) + return self.urlopen( + method, + redirect_location, + body, + headers, + retries=retries, + redirect=redirect, + assert_same_host=assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Check if we should retry the HTTP response. + has_retry_after = bool(response.headers.get("Retry-After")) + if retries.is_retry(method, response.status, has_retry_after): + try: + retries = retries.increment(method, url, response=response, _pool=self) + except MaxRetryError: + if retries.raise_on_status: + response.drain_conn() + raise + return response + + response.drain_conn() + retries.sleep(response) + log.debug("Retry: %s", url) + return self.urlopen( + method, + url, + body, + headers, + retries=retries, + redirect=redirect, + assert_same_host=assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + return response + + +class HTTPSConnectionPool(HTTPConnectionPool): + """ + Same as :class:`.HTTPConnectionPool`, but HTTPS. + + :class:`.HTTPSConnection` uses one of ``assert_fingerprint``, + ``assert_hostname`` and ``host`` in this order to verify connections. + If ``assert_hostname`` is False, no verification is done. + + The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``, + ``ca_cert_dir``, ``ssl_version``, ``key_password`` are only used if :mod:`ssl` + is available and are fed into :meth:`urllib3.util.ssl_wrap_socket` to upgrade + the connection socket into an SSL socket. + """ + + scheme = "https" + ConnectionCls: type[BaseHTTPSConnection] = HTTPSConnection + + def __init__( + self, + host: str, + port: int | None = None, + timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, + maxsize: int = 1, + block: bool = False, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + _proxy: Url | None = None, + _proxy_headers: typing.Mapping[str, str] | None = None, + key_file: str | None = None, + cert_file: str | None = None, + cert_reqs: int | str | None = None, + key_password: str | None = None, + ca_certs: str | None = None, + ssl_version: int | str | None = None, + ssl_minimum_version: ssl.TLSVersion | None = None, + ssl_maximum_version: ssl.TLSVersion | None = None, + assert_hostname: str | Literal[False] | None = None, + assert_fingerprint: str | None = None, + ca_cert_dir: str | None = None, + **conn_kw: typing.Any, + ) -> None: + super().__init__( + host, + port, + timeout, + maxsize, + block, + headers, + retries, + _proxy, + _proxy_headers, + **conn_kw, + ) + + self.key_file = key_file + self.cert_file = cert_file + self.cert_reqs = cert_reqs + self.key_password = key_password + self.ca_certs = ca_certs + self.ca_cert_dir = ca_cert_dir + self.ssl_version = ssl_version + self.ssl_minimum_version = ssl_minimum_version + self.ssl_maximum_version = ssl_maximum_version + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + + def _prepare_proxy(self, conn: HTTPSConnection) -> None: # type: ignore[override] + """Establishes a tunnel connection through HTTP CONNECT.""" + if self.proxy and self.proxy.scheme == "https": + tunnel_scheme = "https" + else: + tunnel_scheme = "http" + + conn.set_tunnel( + scheme=tunnel_scheme, + host=self._tunnel_host, + port=self.port, + headers=self.proxy_headers, + ) + conn.connect() + + def _new_conn(self) -> BaseHTTPSConnection: + """ + Return a fresh :class:`urllib3.connection.HTTPConnection`. + """ + self.num_connections += 1 + log.debug( + "Starting new HTTPS connection (%d): %s:%s", + self.num_connections, + self.host, + self.port or "443", + ) + + if not self.ConnectionCls or self.ConnectionCls is DummyConnection: # type: ignore[comparison-overlap] + raise ImportError( + "Can't connect to HTTPS URL because the SSL module is not available." + ) + + actual_host: str = self.host + actual_port = self.port + if self.proxy is not None and self.proxy.host is not None: + actual_host = self.proxy.host + actual_port = self.proxy.port + + return self.ConnectionCls( + host=actual_host, + port=actual_port, + timeout=self.timeout.connect_timeout, + cert_file=self.cert_file, + key_file=self.key_file, + key_password=self.key_password, + cert_reqs=self.cert_reqs, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + assert_hostname=self.assert_hostname, + assert_fingerprint=self.assert_fingerprint, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + **self.conn_kw, + ) + + def _validate_conn(self, conn: BaseHTTPConnection) -> None: + """ + Called right before a request is made, after the socket is created. + """ + super()._validate_conn(conn) + + # Force connect early to allow us to validate the connection. + if conn.is_closed: + conn.connect() + + if not conn.is_verified: + warnings.warn( + ( + f"Unverified HTTPS request is being made to host '{conn.host}'. " + "Adding certificate verification is strongly advised. See: " + "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" + "#tls-warnings" + ), + InsecureRequestWarning, + ) + + +def connection_from_url(url: str, **kw: typing.Any) -> HTTPConnectionPool: + """ + Given a url, return an :class:`.ConnectionPool` instance of its host. + + This is a shortcut for not having to parse out the scheme, host, and port + of the url before creating an :class:`.ConnectionPool` instance. + + :param url: + Absolute URL string that must include the scheme. Port is optional. + + :param \\**kw: + Passes additional parameters to the constructor of the appropriate + :class:`.ConnectionPool`. Useful for specifying things like + timeout, maxsize, headers, etc. + + Example:: + + >>> conn = connection_from_url('http://google.com/') + >>> r = conn.request('GET', '/') + """ + scheme, _, host, port, *_ = parse_url(url) + scheme = scheme or "http" + port = port or port_by_scheme.get(scheme, 80) + if scheme == "https": + return HTTPSConnectionPool(host, port=port, **kw) # type: ignore[arg-type] + else: + return HTTPConnectionPool(host, port=port, **kw) # type: ignore[arg-type] + + +@typing.overload +def _normalize_host(host: None, scheme: str | None) -> None: + ... + + +@typing.overload +def _normalize_host(host: str, scheme: str | None) -> str: + ... + + +def _normalize_host(host: str | None, scheme: str | None) -> str | None: + """ + Normalize hosts for comparisons and use with sockets. + """ + + host = normalize_host(host, scheme) + + # httplib doesn't like it when we include brackets in IPv6 addresses + # Specifically, if we include brackets but also pass the port then + # httplib crazily doubles up the square brackets on the Host header. + # Instead, we need to make sure we never pass ``None`` as the port. + # However, for backward compatibility reasons we can't actually + # *assert* that. See http://bugs.python.org/issue28539 + if host and host.startswith("[") and host.endswith("]"): + host = host[1:-1] + return host + + +def _url_from_pool( + pool: HTTPConnectionPool | HTTPSConnectionPool, path: str | None = None +) -> str: + """Returns the URL from a given connection pool. This is mainly used for testing and logging.""" + return Url(scheme=pool.scheme, host=pool.host, port=pool.port, path=path).url + + +def _close_pool_connections(pool: queue.LifoQueue[typing.Any]) -> None: + """Drains a queue of connections and closes each one.""" + try: + while True: + conn = pool.get(block=False) + if conn: + conn.close() + except queue.Empty: + pass # Done. diff --git a/billinglayer/python/urllib3/contrib/__init__.py b/billinglayer/python/urllib3/contrib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/urllib3/contrib/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/urllib3/contrib/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..bf5a8e2 Binary files /dev/null and b/billinglayer/python/urllib3/contrib/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc b/billinglayer/python/urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc new file mode 100644 index 0000000..3ecc28a Binary files /dev/null and b/billinglayer/python/urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/contrib/__pycache__/securetransport.cpython-311.pyc b/billinglayer/python/urllib3/contrib/__pycache__/securetransport.cpython-311.pyc new file mode 100644 index 0000000..9da032c Binary files /dev/null and b/billinglayer/python/urllib3/contrib/__pycache__/securetransport.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/contrib/__pycache__/socks.cpython-311.pyc b/billinglayer/python/urllib3/contrib/__pycache__/socks.cpython-311.pyc new file mode 100644 index 0000000..db2545f Binary files /dev/null and b/billinglayer/python/urllib3/contrib/__pycache__/socks.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/contrib/_securetransport/__init__.py b/billinglayer/python/urllib3/contrib/_securetransport/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..63fca0b Binary files /dev/null and b/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc b/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc new file mode 100644 index 0000000..01ac614 Binary files /dev/null and b/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc b/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc new file mode 100644 index 0000000..3a28c1d Binary files /dev/null and b/billinglayer/python/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/contrib/_securetransport/bindings.py b/billinglayer/python/urllib3/contrib/_securetransport/bindings.py new file mode 100644 index 0000000..3e4cd46 --- /dev/null +++ b/billinglayer/python/urllib3/contrib/_securetransport/bindings.py @@ -0,0 +1,430 @@ +# type: ignore + +""" +This module uses ctypes to bind a whole bunch of functions and constants from +SecureTransport. The goal here is to provide the low-level API to +SecureTransport. These are essentially the C-level functions and constants, and +they're pretty gross to work with. + +This code is a bastardised version of the code found in Will Bond's oscrypto +library. An enormous debt is owed to him for blazing this trail for us. For +that reason, this code should be considered to be covered both by urllib3's +license and by oscrypto's: + + Copyright (c) 2015-2016 Will Bond + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +""" + +from __future__ import annotations + +import platform +from ctypes import ( + CDLL, + CFUNCTYPE, + POINTER, + c_bool, + c_byte, + c_char_p, + c_int32, + c_long, + c_size_t, + c_uint32, + c_ulong, + c_void_p, +) +from ctypes.util import find_library + +if platform.system() != "Darwin": + raise ImportError("Only macOS is supported") + +version = platform.mac_ver()[0] +version_info = tuple(map(int, version.split("."))) +if version_info < (10, 8): + raise OSError( + f"Only OS X 10.8 and newer are supported, not {version_info[0]}.{version_info[1]}" + ) + + +def load_cdll(name: str, macos10_16_path: str) -> CDLL: + """Loads a CDLL by name, falling back to known path on 10.16+""" + try: + # Big Sur is technically 11 but we use 10.16 due to the Big Sur + # beta being labeled as 10.16. + path: str | None + if version_info >= (10, 16): + path = macos10_16_path + else: + path = find_library(name) + if not path: + raise OSError # Caught and reraised as 'ImportError' + return CDLL(path, use_errno=True) + except OSError: + raise ImportError(f"The library {name} failed to load") from None + + +Security = load_cdll( + "Security", "/System/Library/Frameworks/Security.framework/Security" +) +CoreFoundation = load_cdll( + "CoreFoundation", + "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", +) + + +Boolean = c_bool +CFIndex = c_long +CFStringEncoding = c_uint32 +CFData = c_void_p +CFString = c_void_p +CFArray = c_void_p +CFMutableArray = c_void_p +CFDictionary = c_void_p +CFError = c_void_p +CFType = c_void_p +CFTypeID = c_ulong + +CFTypeRef = POINTER(CFType) +CFAllocatorRef = c_void_p + +OSStatus = c_int32 + +CFDataRef = POINTER(CFData) +CFStringRef = POINTER(CFString) +CFArrayRef = POINTER(CFArray) +CFMutableArrayRef = POINTER(CFMutableArray) +CFDictionaryRef = POINTER(CFDictionary) +CFArrayCallBacks = c_void_p +CFDictionaryKeyCallBacks = c_void_p +CFDictionaryValueCallBacks = c_void_p + +SecCertificateRef = POINTER(c_void_p) +SecExternalFormat = c_uint32 +SecExternalItemType = c_uint32 +SecIdentityRef = POINTER(c_void_p) +SecItemImportExportFlags = c_uint32 +SecItemImportExportKeyParameters = c_void_p +SecKeychainRef = POINTER(c_void_p) +SSLProtocol = c_uint32 +SSLCipherSuite = c_uint32 +SSLContextRef = POINTER(c_void_p) +SecTrustRef = POINTER(c_void_p) +SSLConnectionRef = c_uint32 +SecTrustResultType = c_uint32 +SecTrustOptionFlags = c_uint32 +SSLProtocolSide = c_uint32 +SSLConnectionType = c_uint32 +SSLSessionOption = c_uint32 + + +try: + Security.SecItemImport.argtypes = [ + CFDataRef, + CFStringRef, + POINTER(SecExternalFormat), + POINTER(SecExternalItemType), + SecItemImportExportFlags, + POINTER(SecItemImportExportKeyParameters), + SecKeychainRef, + POINTER(CFArrayRef), + ] + Security.SecItemImport.restype = OSStatus + + Security.SecCertificateGetTypeID.argtypes = [] + Security.SecCertificateGetTypeID.restype = CFTypeID + + Security.SecIdentityGetTypeID.argtypes = [] + Security.SecIdentityGetTypeID.restype = CFTypeID + + Security.SecKeyGetTypeID.argtypes = [] + Security.SecKeyGetTypeID.restype = CFTypeID + + Security.SecCertificateCreateWithData.argtypes = [CFAllocatorRef, CFDataRef] + Security.SecCertificateCreateWithData.restype = SecCertificateRef + + Security.SecCertificateCopyData.argtypes = [SecCertificateRef] + Security.SecCertificateCopyData.restype = CFDataRef + + Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p] + Security.SecCopyErrorMessageString.restype = CFStringRef + + Security.SecIdentityCreateWithCertificate.argtypes = [ + CFTypeRef, + SecCertificateRef, + POINTER(SecIdentityRef), + ] + Security.SecIdentityCreateWithCertificate.restype = OSStatus + + Security.SecKeychainCreate.argtypes = [ + c_char_p, + c_uint32, + c_void_p, + Boolean, + c_void_p, + POINTER(SecKeychainRef), + ] + Security.SecKeychainCreate.restype = OSStatus + + Security.SecKeychainDelete.argtypes = [SecKeychainRef] + Security.SecKeychainDelete.restype = OSStatus + + Security.SecPKCS12Import.argtypes = [ + CFDataRef, + CFDictionaryRef, + POINTER(CFArrayRef), + ] + Security.SecPKCS12Import.restype = OSStatus + + SSLReadFunc = CFUNCTYPE(OSStatus, SSLConnectionRef, c_void_p, POINTER(c_size_t)) + SSLWriteFunc = CFUNCTYPE( + OSStatus, SSLConnectionRef, POINTER(c_byte), POINTER(c_size_t) + ) + + Security.SSLSetIOFuncs.argtypes = [SSLContextRef, SSLReadFunc, SSLWriteFunc] + Security.SSLSetIOFuncs.restype = OSStatus + + Security.SSLSetPeerID.argtypes = [SSLContextRef, c_char_p, c_size_t] + Security.SSLSetPeerID.restype = OSStatus + + Security.SSLSetCertificate.argtypes = [SSLContextRef, CFArrayRef] + Security.SSLSetCertificate.restype = OSStatus + + Security.SSLSetCertificateAuthorities.argtypes = [SSLContextRef, CFTypeRef, Boolean] + Security.SSLSetCertificateAuthorities.restype = OSStatus + + Security.SSLSetConnection.argtypes = [SSLContextRef, SSLConnectionRef] + Security.SSLSetConnection.restype = OSStatus + + Security.SSLSetPeerDomainName.argtypes = [SSLContextRef, c_char_p, c_size_t] + Security.SSLSetPeerDomainName.restype = OSStatus + + Security.SSLHandshake.argtypes = [SSLContextRef] + Security.SSLHandshake.restype = OSStatus + + Security.SSLRead.argtypes = [SSLContextRef, c_char_p, c_size_t, POINTER(c_size_t)] + Security.SSLRead.restype = OSStatus + + Security.SSLWrite.argtypes = [SSLContextRef, c_char_p, c_size_t, POINTER(c_size_t)] + Security.SSLWrite.restype = OSStatus + + Security.SSLClose.argtypes = [SSLContextRef] + Security.SSLClose.restype = OSStatus + + Security.SSLGetNumberSupportedCiphers.argtypes = [SSLContextRef, POINTER(c_size_t)] + Security.SSLGetNumberSupportedCiphers.restype = OSStatus + + Security.SSLGetSupportedCiphers.argtypes = [ + SSLContextRef, + POINTER(SSLCipherSuite), + POINTER(c_size_t), + ] + Security.SSLGetSupportedCiphers.restype = OSStatus + + Security.SSLSetEnabledCiphers.argtypes = [ + SSLContextRef, + POINTER(SSLCipherSuite), + c_size_t, + ] + Security.SSLSetEnabledCiphers.restype = OSStatus + + Security.SSLGetNumberEnabledCiphers.argtype = [SSLContextRef, POINTER(c_size_t)] + Security.SSLGetNumberEnabledCiphers.restype = OSStatus + + Security.SSLGetEnabledCiphers.argtypes = [ + SSLContextRef, + POINTER(SSLCipherSuite), + POINTER(c_size_t), + ] + Security.SSLGetEnabledCiphers.restype = OSStatus + + Security.SSLGetNegotiatedCipher.argtypes = [SSLContextRef, POINTER(SSLCipherSuite)] + Security.SSLGetNegotiatedCipher.restype = OSStatus + + Security.SSLGetNegotiatedProtocolVersion.argtypes = [ + SSLContextRef, + POINTER(SSLProtocol), + ] + Security.SSLGetNegotiatedProtocolVersion.restype = OSStatus + + Security.SSLCopyPeerTrust.argtypes = [SSLContextRef, POINTER(SecTrustRef)] + Security.SSLCopyPeerTrust.restype = OSStatus + + Security.SecTrustSetAnchorCertificates.argtypes = [SecTrustRef, CFArrayRef] + Security.SecTrustSetAnchorCertificates.restype = OSStatus + + Security.SecTrustSetAnchorCertificatesOnly.argstypes = [SecTrustRef, Boolean] + Security.SecTrustSetAnchorCertificatesOnly.restype = OSStatus + + Security.SecTrustEvaluate.argtypes = [SecTrustRef, POINTER(SecTrustResultType)] + Security.SecTrustEvaluate.restype = OSStatus + + Security.SecTrustGetCertificateCount.argtypes = [SecTrustRef] + Security.SecTrustGetCertificateCount.restype = CFIndex + + Security.SecTrustGetCertificateAtIndex.argtypes = [SecTrustRef, CFIndex] + Security.SecTrustGetCertificateAtIndex.restype = SecCertificateRef + + Security.SSLCreateContext.argtypes = [ + CFAllocatorRef, + SSLProtocolSide, + SSLConnectionType, + ] + Security.SSLCreateContext.restype = SSLContextRef + + Security.SSLSetSessionOption.argtypes = [SSLContextRef, SSLSessionOption, Boolean] + Security.SSLSetSessionOption.restype = OSStatus + + Security.SSLSetProtocolVersionMin.argtypes = [SSLContextRef, SSLProtocol] + Security.SSLSetProtocolVersionMin.restype = OSStatus + + Security.SSLSetProtocolVersionMax.argtypes = [SSLContextRef, SSLProtocol] + Security.SSLSetProtocolVersionMax.restype = OSStatus + + try: + Security.SSLSetALPNProtocols.argtypes = [SSLContextRef, CFArrayRef] + Security.SSLSetALPNProtocols.restype = OSStatus + except AttributeError: + # Supported only in 10.12+ + pass + + Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p] + Security.SecCopyErrorMessageString.restype = CFStringRef + + Security.SSLReadFunc = SSLReadFunc + Security.SSLWriteFunc = SSLWriteFunc + Security.SSLContextRef = SSLContextRef + Security.SSLProtocol = SSLProtocol + Security.SSLCipherSuite = SSLCipherSuite + Security.SecIdentityRef = SecIdentityRef + Security.SecKeychainRef = SecKeychainRef + Security.SecTrustRef = SecTrustRef + Security.SecTrustResultType = SecTrustResultType + Security.SecExternalFormat = SecExternalFormat + Security.OSStatus = OSStatus + + Security.kSecImportExportPassphrase = CFStringRef.in_dll( + Security, "kSecImportExportPassphrase" + ) + Security.kSecImportItemIdentity = CFStringRef.in_dll( + Security, "kSecImportItemIdentity" + ) + + # CoreFoundation time! + CoreFoundation.CFRetain.argtypes = [CFTypeRef] + CoreFoundation.CFRetain.restype = CFTypeRef + + CoreFoundation.CFRelease.argtypes = [CFTypeRef] + CoreFoundation.CFRelease.restype = None + + CoreFoundation.CFGetTypeID.argtypes = [CFTypeRef] + CoreFoundation.CFGetTypeID.restype = CFTypeID + + CoreFoundation.CFStringCreateWithCString.argtypes = [ + CFAllocatorRef, + c_char_p, + CFStringEncoding, + ] + CoreFoundation.CFStringCreateWithCString.restype = CFStringRef + + CoreFoundation.CFStringGetCStringPtr.argtypes = [CFStringRef, CFStringEncoding] + CoreFoundation.CFStringGetCStringPtr.restype = c_char_p + + CoreFoundation.CFStringGetCString.argtypes = [ + CFStringRef, + c_char_p, + CFIndex, + CFStringEncoding, + ] + CoreFoundation.CFStringGetCString.restype = c_bool + + CoreFoundation.CFDataCreate.argtypes = [CFAllocatorRef, c_char_p, CFIndex] + CoreFoundation.CFDataCreate.restype = CFDataRef + + CoreFoundation.CFDataGetLength.argtypes = [CFDataRef] + CoreFoundation.CFDataGetLength.restype = CFIndex + + CoreFoundation.CFDataGetBytePtr.argtypes = [CFDataRef] + CoreFoundation.CFDataGetBytePtr.restype = c_void_p + + CoreFoundation.CFDictionaryCreate.argtypes = [ + CFAllocatorRef, + POINTER(CFTypeRef), + POINTER(CFTypeRef), + CFIndex, + CFDictionaryKeyCallBacks, + CFDictionaryValueCallBacks, + ] + CoreFoundation.CFDictionaryCreate.restype = CFDictionaryRef + + CoreFoundation.CFDictionaryGetValue.argtypes = [CFDictionaryRef, CFTypeRef] + CoreFoundation.CFDictionaryGetValue.restype = CFTypeRef + + CoreFoundation.CFArrayCreate.argtypes = [ + CFAllocatorRef, + POINTER(CFTypeRef), + CFIndex, + CFArrayCallBacks, + ] + CoreFoundation.CFArrayCreate.restype = CFArrayRef + + CoreFoundation.CFArrayCreateMutable.argtypes = [ + CFAllocatorRef, + CFIndex, + CFArrayCallBacks, + ] + CoreFoundation.CFArrayCreateMutable.restype = CFMutableArrayRef + + CoreFoundation.CFArrayAppendValue.argtypes = [CFMutableArrayRef, c_void_p] + CoreFoundation.CFArrayAppendValue.restype = None + + CoreFoundation.CFArrayGetCount.argtypes = [CFArrayRef] + CoreFoundation.CFArrayGetCount.restype = CFIndex + + CoreFoundation.CFArrayGetValueAtIndex.argtypes = [CFArrayRef, CFIndex] + CoreFoundation.CFArrayGetValueAtIndex.restype = c_void_p + + CoreFoundation.kCFAllocatorDefault = CFAllocatorRef.in_dll( + CoreFoundation, "kCFAllocatorDefault" + ) + CoreFoundation.kCFTypeArrayCallBacks = c_void_p.in_dll( + CoreFoundation, "kCFTypeArrayCallBacks" + ) + CoreFoundation.kCFTypeDictionaryKeyCallBacks = c_void_p.in_dll( + CoreFoundation, "kCFTypeDictionaryKeyCallBacks" + ) + CoreFoundation.kCFTypeDictionaryValueCallBacks = c_void_p.in_dll( + CoreFoundation, "kCFTypeDictionaryValueCallBacks" + ) + + CoreFoundation.CFTypeRef = CFTypeRef + CoreFoundation.CFArrayRef = CFArrayRef + CoreFoundation.CFStringRef = CFStringRef + CoreFoundation.CFDictionaryRef = CFDictionaryRef + +except AttributeError: + raise ImportError("Error initializing ctypes") from None + + +class CFConst: + """ + A class object that acts as essentially a namespace for CoreFoundation + constants. + """ + + kCFStringEncodingUTF8 = CFStringEncoding(0x08000100) diff --git a/billinglayer/python/urllib3/contrib/_securetransport/low_level.py b/billinglayer/python/urllib3/contrib/_securetransport/low_level.py new file mode 100644 index 0000000..e235699 --- /dev/null +++ b/billinglayer/python/urllib3/contrib/_securetransport/low_level.py @@ -0,0 +1,474 @@ +""" +Low-level helpers for the SecureTransport bindings. + +These are Python functions that are not directly related to the high-level APIs +but are necessary to get them to work. They include a whole bunch of low-level +CoreFoundation messing about and memory management. The concerns in this module +are almost entirely about trying to avoid memory leaks and providing +appropriate and useful assistance to the higher-level code. +""" +from __future__ import annotations + +import base64 +import ctypes +import itertools +import os +import re +import ssl +import struct +import tempfile +import typing + +from .bindings import ( # type: ignore[attr-defined] + CFArray, + CFConst, + CFData, + CFDictionary, + CFMutableArray, + CFString, + CFTypeRef, + CoreFoundation, + SecKeychainRef, + Security, +) + +# This regular expression is used to grab PEM data out of a PEM bundle. +_PEM_CERTS_RE = re.compile( + b"-----BEGIN CERTIFICATE-----\n(.*?)\n-----END CERTIFICATE-----", re.DOTALL +) + + +def _cf_data_from_bytes(bytestring: bytes) -> CFData: + """ + Given a bytestring, create a CFData object from it. This CFData object must + be CFReleased by the caller. + """ + return CoreFoundation.CFDataCreate( + CoreFoundation.kCFAllocatorDefault, bytestring, len(bytestring) + ) + + +def _cf_dictionary_from_tuples( + tuples: list[tuple[typing.Any, typing.Any]] +) -> CFDictionary: + """ + Given a list of Python tuples, create an associated CFDictionary. + """ + dictionary_size = len(tuples) + + # We need to get the dictionary keys and values out in the same order. + keys = (t[0] for t in tuples) + values = (t[1] for t in tuples) + cf_keys = (CoreFoundation.CFTypeRef * dictionary_size)(*keys) + cf_values = (CoreFoundation.CFTypeRef * dictionary_size)(*values) + + return CoreFoundation.CFDictionaryCreate( + CoreFoundation.kCFAllocatorDefault, + cf_keys, + cf_values, + dictionary_size, + CoreFoundation.kCFTypeDictionaryKeyCallBacks, + CoreFoundation.kCFTypeDictionaryValueCallBacks, + ) + + +def _cfstr(py_bstr: bytes) -> CFString: + """ + Given a Python binary data, create a CFString. + The string must be CFReleased by the caller. + """ + c_str = ctypes.c_char_p(py_bstr) + cf_str = CoreFoundation.CFStringCreateWithCString( + CoreFoundation.kCFAllocatorDefault, + c_str, + CFConst.kCFStringEncodingUTF8, + ) + return cf_str + + +def _create_cfstring_array(lst: list[bytes]) -> CFMutableArray: + """ + Given a list of Python binary data, create an associated CFMutableArray. + The array must be CFReleased by the caller. + + Raises an ssl.SSLError on failure. + """ + cf_arr = None + try: + cf_arr = CoreFoundation.CFArrayCreateMutable( + CoreFoundation.kCFAllocatorDefault, + 0, + ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), + ) + if not cf_arr: + raise MemoryError("Unable to allocate memory!") + for item in lst: + cf_str = _cfstr(item) + if not cf_str: + raise MemoryError("Unable to allocate memory!") + try: + CoreFoundation.CFArrayAppendValue(cf_arr, cf_str) + finally: + CoreFoundation.CFRelease(cf_str) + except BaseException as e: + if cf_arr: + CoreFoundation.CFRelease(cf_arr) + raise ssl.SSLError(f"Unable to allocate array: {e}") from None + return cf_arr + + +def _cf_string_to_unicode(value: CFString) -> str | None: + """ + Creates a Unicode string from a CFString object. Used entirely for error + reporting. + + Yes, it annoys me quite a lot that this function is this complex. + """ + value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p)) + + string = CoreFoundation.CFStringGetCStringPtr( + value_as_void_p, CFConst.kCFStringEncodingUTF8 + ) + if string is None: + buffer = ctypes.create_string_buffer(1024) + result = CoreFoundation.CFStringGetCString( + value_as_void_p, buffer, 1024, CFConst.kCFStringEncodingUTF8 + ) + if not result: + raise OSError("Error copying C string from CFStringRef") + string = buffer.value + if string is not None: + string = string.decode("utf-8") + return string # type: ignore[no-any-return] + + +def _assert_no_error( + error: int, exception_class: type[BaseException] | None = None +) -> None: + """ + Checks the return code and throws an exception if there is an error to + report + """ + if error == 0: + return + + cf_error_string = Security.SecCopyErrorMessageString(error, None) + output = _cf_string_to_unicode(cf_error_string) + CoreFoundation.CFRelease(cf_error_string) + + if output is None or output == "": + output = f"OSStatus {error}" + + if exception_class is None: + exception_class = ssl.SSLError + + raise exception_class(output) + + +def _cert_array_from_pem(pem_bundle: bytes) -> CFArray: + """ + Given a bundle of certs in PEM format, turns them into a CFArray of certs + that can be used to validate a cert chain. + """ + # Normalize the PEM bundle's line endings. + pem_bundle = pem_bundle.replace(b"\r\n", b"\n") + + der_certs = [ + base64.b64decode(match.group(1)) for match in _PEM_CERTS_RE.finditer(pem_bundle) + ] + if not der_certs: + raise ssl.SSLError("No root certificates specified") + + cert_array = CoreFoundation.CFArrayCreateMutable( + CoreFoundation.kCFAllocatorDefault, + 0, + ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), + ) + if not cert_array: + raise ssl.SSLError("Unable to allocate memory!") + + try: + for der_bytes in der_certs: + certdata = _cf_data_from_bytes(der_bytes) + if not certdata: + raise ssl.SSLError("Unable to allocate memory!") + cert = Security.SecCertificateCreateWithData( + CoreFoundation.kCFAllocatorDefault, certdata + ) + CoreFoundation.CFRelease(certdata) + if not cert: + raise ssl.SSLError("Unable to build cert object!") + + CoreFoundation.CFArrayAppendValue(cert_array, cert) + CoreFoundation.CFRelease(cert) + except Exception: + # We need to free the array before the exception bubbles further. + # We only want to do that if an error occurs: otherwise, the caller + # should free. + CoreFoundation.CFRelease(cert_array) + raise + + return cert_array + + +def _is_cert(item: CFTypeRef) -> bool: + """ + Returns True if a given CFTypeRef is a certificate. + """ + expected = Security.SecCertificateGetTypeID() + return CoreFoundation.CFGetTypeID(item) == expected # type: ignore[no-any-return] + + +def _is_identity(item: CFTypeRef) -> bool: + """ + Returns True if a given CFTypeRef is an identity. + """ + expected = Security.SecIdentityGetTypeID() + return CoreFoundation.CFGetTypeID(item) == expected # type: ignore[no-any-return] + + +def _temporary_keychain() -> tuple[SecKeychainRef, str]: + """ + This function creates a temporary Mac keychain that we can use to work with + credentials. This keychain uses a one-time password and a temporary file to + store the data. We expect to have one keychain per socket. The returned + SecKeychainRef must be freed by the caller, including calling + SecKeychainDelete. + + Returns a tuple of the SecKeychainRef and the path to the temporary + directory that contains it. + """ + # Unfortunately, SecKeychainCreate requires a path to a keychain. This + # means we cannot use mkstemp to use a generic temporary file. Instead, + # we're going to create a temporary directory and a filename to use there. + # This filename will be 8 random bytes expanded into base64. We also need + # some random bytes to password-protect the keychain we're creating, so we + # ask for 40 random bytes. + random_bytes = os.urandom(40) + filename = base64.b16encode(random_bytes[:8]).decode("utf-8") + password = base64.b16encode(random_bytes[8:]) # Must be valid UTF-8 + tempdirectory = tempfile.mkdtemp() + + keychain_path = os.path.join(tempdirectory, filename).encode("utf-8") + + # We now want to create the keychain itself. + keychain = Security.SecKeychainRef() + status = Security.SecKeychainCreate( + keychain_path, len(password), password, False, None, ctypes.byref(keychain) + ) + _assert_no_error(status) + + # Having created the keychain, we want to pass it off to the caller. + return keychain, tempdirectory + + +def _load_items_from_file( + keychain: SecKeychainRef, path: str +) -> tuple[list[CFTypeRef], list[CFTypeRef]]: + """ + Given a single file, loads all the trust objects from it into arrays and + the keychain. + Returns a tuple of lists: the first list is a list of identities, the + second a list of certs. + """ + certificates = [] + identities = [] + result_array = None + + with open(path, "rb") as f: + raw_filedata = f.read() + + try: + filedata = CoreFoundation.CFDataCreate( + CoreFoundation.kCFAllocatorDefault, raw_filedata, len(raw_filedata) + ) + result_array = CoreFoundation.CFArrayRef() + result = Security.SecItemImport( + filedata, # cert data + None, # Filename, leaving it out for now + None, # What the type of the file is, we don't care + None, # what's in the file, we don't care + 0, # import flags + None, # key params, can include passphrase in the future + keychain, # The keychain to insert into + ctypes.byref(result_array), # Results + ) + _assert_no_error(result) + + # A CFArray is not very useful to us as an intermediary + # representation, so we are going to extract the objects we want + # and then free the array. We don't need to keep hold of keys: the + # keychain already has them! + result_count = CoreFoundation.CFArrayGetCount(result_array) + for index in range(result_count): + item = CoreFoundation.CFArrayGetValueAtIndex(result_array, index) + item = ctypes.cast(item, CoreFoundation.CFTypeRef) + + if _is_cert(item): + CoreFoundation.CFRetain(item) + certificates.append(item) + elif _is_identity(item): + CoreFoundation.CFRetain(item) + identities.append(item) + finally: + if result_array: + CoreFoundation.CFRelease(result_array) + + CoreFoundation.CFRelease(filedata) + + return (identities, certificates) + + +def _load_client_cert_chain(keychain: SecKeychainRef, *paths: str | None) -> CFArray: + """ + Load certificates and maybe keys from a number of files. Has the end goal + of returning a CFArray containing one SecIdentityRef, and then zero or more + SecCertificateRef objects, suitable for use as a client certificate trust + chain. + """ + # Ok, the strategy. + # + # This relies on knowing that macOS will not give you a SecIdentityRef + # unless you have imported a key into a keychain. This is a somewhat + # artificial limitation of macOS (for example, it doesn't necessarily + # affect iOS), but there is nothing inside Security.framework that lets you + # get a SecIdentityRef without having a key in a keychain. + # + # So the policy here is we take all the files and iterate them in order. + # Each one will use SecItemImport to have one or more objects loaded from + # it. We will also point at a keychain that macOS can use to work with the + # private key. + # + # Once we have all the objects, we'll check what we actually have. If we + # already have a SecIdentityRef in hand, fab: we'll use that. Otherwise, + # we'll take the first certificate (which we assume to be our leaf) and + # ask the keychain to give us a SecIdentityRef with that cert's associated + # key. + # + # We'll then return a CFArray containing the trust chain: one + # SecIdentityRef and then zero-or-more SecCertificateRef objects. The + # responsibility for freeing this CFArray will be with the caller. This + # CFArray must remain alive for the entire connection, so in practice it + # will be stored with a single SSLSocket, along with the reference to the + # keychain. + certificates = [] + identities = [] + + # Filter out bad paths. + filtered_paths = (path for path in paths if path) + + try: + for file_path in filtered_paths: + new_identities, new_certs = _load_items_from_file(keychain, file_path) + identities.extend(new_identities) + certificates.extend(new_certs) + + # Ok, we have everything. The question is: do we have an identity? If + # not, we want to grab one from the first cert we have. + if not identities: + new_identity = Security.SecIdentityRef() + status = Security.SecIdentityCreateWithCertificate( + keychain, certificates[0], ctypes.byref(new_identity) + ) + _assert_no_error(status) + identities.append(new_identity) + + # We now want to release the original certificate, as we no longer + # need it. + CoreFoundation.CFRelease(certificates.pop(0)) + + # We now need to build a new CFArray that holds the trust chain. + trust_chain = CoreFoundation.CFArrayCreateMutable( + CoreFoundation.kCFAllocatorDefault, + 0, + ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), + ) + for item in itertools.chain(identities, certificates): + # ArrayAppendValue does a CFRetain on the item. That's fine, + # because the finally block will release our other refs to them. + CoreFoundation.CFArrayAppendValue(trust_chain, item) + + return trust_chain + finally: + for obj in itertools.chain(identities, certificates): + CoreFoundation.CFRelease(obj) + + +TLS_PROTOCOL_VERSIONS = { + "SSLv2": (0, 2), + "SSLv3": (3, 0), + "TLSv1": (3, 1), + "TLSv1.1": (3, 2), + "TLSv1.2": (3, 3), +} + + +def _build_tls_unknown_ca_alert(version: str) -> bytes: + """ + Builds a TLS alert record for an unknown CA. + """ + ver_maj, ver_min = TLS_PROTOCOL_VERSIONS[version] + severity_fatal = 0x02 + description_unknown_ca = 0x30 + msg = struct.pack(">BB", severity_fatal, description_unknown_ca) + msg_len = len(msg) + record_type_alert = 0x15 + record = struct.pack(">BBBH", record_type_alert, ver_maj, ver_min, msg_len) + msg + return record + + +class SecurityConst: + """ + A class object that acts as essentially a namespace for Security constants. + """ + + kSSLSessionOptionBreakOnServerAuth = 0 + + kSSLProtocol2 = 1 + kSSLProtocol3 = 2 + kTLSProtocol1 = 4 + kTLSProtocol11 = 7 + kTLSProtocol12 = 8 + # SecureTransport does not support TLS 1.3 even if there's a constant for it + kTLSProtocol13 = 10 + kTLSProtocolMaxSupported = 999 + + kSSLClientSide = 1 + kSSLStreamType = 0 + + kSecFormatPEMSequence = 10 + + kSecTrustResultInvalid = 0 + kSecTrustResultProceed = 1 + # This gap is present on purpose: this was kSecTrustResultConfirm, which + # is deprecated. + kSecTrustResultDeny = 3 + kSecTrustResultUnspecified = 4 + kSecTrustResultRecoverableTrustFailure = 5 + kSecTrustResultFatalTrustFailure = 6 + kSecTrustResultOtherError = 7 + + errSSLProtocol = -9800 + errSSLWouldBlock = -9803 + errSSLClosedGraceful = -9805 + errSSLClosedNoNotify = -9816 + errSSLClosedAbort = -9806 + + errSSLXCertChainInvalid = -9807 + errSSLCrypto = -9809 + errSSLInternal = -9810 + errSSLCertExpired = -9814 + errSSLCertNotYetValid = -9815 + errSSLUnknownRootCert = -9812 + errSSLNoRootCert = -9813 + errSSLHostNameMismatch = -9843 + errSSLPeerHandshakeFail = -9824 + errSSLPeerUserCancelled = -9839 + errSSLWeakPeerEphemeralDHKey = -9850 + errSSLServerAuthCompleted = -9841 + errSSLRecordOverflow = -9847 + + errSecVerifyFailed = -67808 + errSecNoTrustSettings = -25263 + errSecItemNotFound = -25300 + errSecInvalidTrustSettings = -25262 diff --git a/billinglayer/python/urllib3/contrib/pyopenssl.py b/billinglayer/python/urllib3/contrib/pyopenssl.py new file mode 100644 index 0000000..0089cd2 --- /dev/null +++ b/billinglayer/python/urllib3/contrib/pyopenssl.py @@ -0,0 +1,557 @@ +""" +Module for using pyOpenSSL as a TLS backend. This module was relevant before +the standard library ``ssl`` module supported SNI, but now that we've dropped +support for Python 2.7 all relevant Python versions support SNI so +**this module is no longer recommended**. + +This needs the following packages installed: + +* `pyOpenSSL`_ (tested with 16.0.0) +* `cryptography`_ (minimum 1.3.4, from pyopenssl) +* `idna`_ (minimum 2.0, from cryptography) + +However, pyOpenSSL depends on cryptography, which depends on idna, so while we +use all three directly here we end up having relatively few packages required. + +You can install them with the following command: + +.. code-block:: bash + + $ python -m pip install pyopenssl cryptography idna + +To activate certificate checking, call +:func:`~urllib3.contrib.pyopenssl.inject_into_urllib3` from your Python code +before you begin making HTTP requests. This can be done in a ``sitecustomize`` +module, or at any other time before your application begins using ``urllib3``, +like this: + +.. code-block:: python + + try: + import urllib3.contrib.pyopenssl + urllib3.contrib.pyopenssl.inject_into_urllib3() + except ImportError: + pass + +.. _pyopenssl: https://www.pyopenssl.org +.. _cryptography: https://cryptography.io +.. _idna: https://github.com/kjd/idna +""" + +from __future__ import annotations + +import OpenSSL.SSL # type: ignore[import] +from cryptography import x509 + +try: + from cryptography.x509 import UnsupportedExtension # type: ignore[attr-defined] +except ImportError: + # UnsupportedExtension is gone in cryptography >= 2.1.0 + class UnsupportedExtension(Exception): # type: ignore[no-redef] + pass + + +import logging +import ssl +import typing +import warnings +from io import BytesIO +from socket import socket as socket_cls +from socket import timeout + +from .. import util + +warnings.warn( + "'urllib3.contrib.pyopenssl' module is deprecated and will be removed " + "in urllib3 v2.1.0. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2680", + category=DeprecationWarning, + stacklevel=2, +) + +if typing.TYPE_CHECKING: + from OpenSSL.crypto import X509 # type: ignore[import] + + +__all__ = ["inject_into_urllib3", "extract_from_urllib3"] + +# Map from urllib3 to PyOpenSSL compatible parameter-values. +_openssl_versions = { + util.ssl_.PROTOCOL_TLS: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] + util.ssl_.PROTOCOL_TLS_CLIENT: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] + ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD, +} + +if hasattr(ssl, "PROTOCOL_TLSv1_1") and hasattr(OpenSSL.SSL, "TLSv1_1_METHOD"): + _openssl_versions[ssl.PROTOCOL_TLSv1_1] = OpenSSL.SSL.TLSv1_1_METHOD + +if hasattr(ssl, "PROTOCOL_TLSv1_2") and hasattr(OpenSSL.SSL, "TLSv1_2_METHOD"): + _openssl_versions[ssl.PROTOCOL_TLSv1_2] = OpenSSL.SSL.TLSv1_2_METHOD + + +_stdlib_to_openssl_verify = { + ssl.CERT_NONE: OpenSSL.SSL.VERIFY_NONE, + ssl.CERT_OPTIONAL: OpenSSL.SSL.VERIFY_PEER, + ssl.CERT_REQUIRED: OpenSSL.SSL.VERIFY_PEER + + OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT, +} +_openssl_to_stdlib_verify = {v: k for k, v in _stdlib_to_openssl_verify.items()} + +# The SSLvX values are the most likely to be missing in the future +# but we check them all just to be sure. +_OP_NO_SSLv2_OR_SSLv3: int = getattr(OpenSSL.SSL, "OP_NO_SSLv2", 0) | getattr( + OpenSSL.SSL, "OP_NO_SSLv3", 0 +) +_OP_NO_TLSv1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1", 0) +_OP_NO_TLSv1_1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_1", 0) +_OP_NO_TLSv1_2: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_2", 0) +_OP_NO_TLSv1_3: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_3", 0) + +_openssl_to_ssl_minimum_version: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.TLSv1: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1, + ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1, + ssl.TLSVersion.TLSv1_3: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 + ), + ssl.TLSVersion.MAXIMUM_SUPPORTED: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 + ), +} +_openssl_to_ssl_maximum_version: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: ( + _OP_NO_SSLv2_OR_SSLv3 + | _OP_NO_TLSv1 + | _OP_NO_TLSv1_1 + | _OP_NO_TLSv1_2 + | _OP_NO_TLSv1_3 + ), + ssl.TLSVersion.TLSv1: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3 + ), + ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3, + ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_3, + ssl.TLSVersion.TLSv1_3: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.MAXIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, +} + +# OpenSSL will only write 16K at a time +SSL_WRITE_BLOCKSIZE = 16384 + +orig_util_SSLContext = util.ssl_.SSLContext + + +log = logging.getLogger(__name__) + + +def inject_into_urllib3() -> None: + "Monkey-patch urllib3 with PyOpenSSL-backed SSL-support." + + _validate_dependencies_met() + + util.SSLContext = PyOpenSSLContext # type: ignore[assignment] + util.ssl_.SSLContext = PyOpenSSLContext # type: ignore[assignment] + util.IS_PYOPENSSL = True + util.ssl_.IS_PYOPENSSL = True + + +def extract_from_urllib3() -> None: + "Undo monkey-patching by :func:`inject_into_urllib3`." + + util.SSLContext = orig_util_SSLContext + util.ssl_.SSLContext = orig_util_SSLContext + util.IS_PYOPENSSL = False + util.ssl_.IS_PYOPENSSL = False + + +def _validate_dependencies_met() -> None: + """ + Verifies that PyOpenSSL's package-level dependencies have been met. + Throws `ImportError` if they are not met. + """ + # Method added in `cryptography==1.1`; not available in older versions + from cryptography.x509.extensions import Extensions + + if getattr(Extensions, "get_extension_for_class", None) is None: + raise ImportError( + "'cryptography' module missing required functionality. " + "Try upgrading to v1.3.4 or newer." + ) + + # pyOpenSSL 0.14 and above use cryptography for OpenSSL bindings. The _x509 + # attribute is only present on those versions. + from OpenSSL.crypto import X509 + + x509 = X509() + if getattr(x509, "_x509", None) is None: + raise ImportError( + "'pyOpenSSL' module missing required functionality. " + "Try upgrading to v0.14 or newer." + ) + + +def _dnsname_to_stdlib(name: str) -> str | None: + """ + Converts a dNSName SubjectAlternativeName field to the form used by the + standard library on the given Python version. + + Cryptography produces a dNSName as a unicode string that was idna-decoded + from ASCII bytes. We need to idna-encode that string to get it back, and + then on Python 3 we also need to convert to unicode via UTF-8 (the stdlib + uses PyUnicode_FromStringAndSize on it, which decodes via UTF-8). + + If the name cannot be idna-encoded then we return None signalling that + the name given should be skipped. + """ + + def idna_encode(name: str) -> bytes | None: + """ + Borrowed wholesale from the Python Cryptography Project. It turns out + that we can't just safely call `idna.encode`: it can explode for + wildcard names. This avoids that problem. + """ + import idna + + try: + for prefix in ["*.", "."]: + if name.startswith(prefix): + name = name[len(prefix) :] + return prefix.encode("ascii") + idna.encode(name) + return idna.encode(name) + except idna.core.IDNAError: + return None + + # Don't send IPv6 addresses through the IDNA encoder. + if ":" in name: + return name + + encoded_name = idna_encode(name) + if encoded_name is None: + return None + return encoded_name.decode("utf-8") + + +def get_subj_alt_name(peer_cert: X509) -> list[tuple[str, str]]: + """ + Given an PyOpenSSL certificate, provides all the subject alternative names. + """ + cert = peer_cert.to_cryptography() + + # We want to find the SAN extension. Ask Cryptography to locate it (it's + # faster than looping in Python) + try: + ext = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value + except x509.ExtensionNotFound: + # No such extension, return the empty list. + return [] + except ( + x509.DuplicateExtension, + UnsupportedExtension, + x509.UnsupportedGeneralNameType, + UnicodeError, + ) as e: + # A problem has been found with the quality of the certificate. Assume + # no SAN field is present. + log.warning( + "A problem was encountered with the certificate that prevented " + "urllib3 from finding the SubjectAlternativeName field. This can " + "affect certificate validation. The error was %s", + e, + ) + return [] + + # We want to return dNSName and iPAddress fields. We need to cast the IPs + # back to strings because the match_hostname function wants them as + # strings. + # Sadly the DNS names need to be idna encoded and then, on Python 3, UTF-8 + # decoded. This is pretty frustrating, but that's what the standard library + # does with certificates, and so we need to attempt to do the same. + # We also want to skip over names which cannot be idna encoded. + names = [ + ("DNS", name) + for name in map(_dnsname_to_stdlib, ext.get_values_for_type(x509.DNSName)) + if name is not None + ] + names.extend( + ("IP Address", str(name)) for name in ext.get_values_for_type(x509.IPAddress) + ) + + return names + + +class WrappedSocket: + """API-compatibility wrapper for Python OpenSSL's Connection-class.""" + + def __init__( + self, + connection: OpenSSL.SSL.Connection, + socket: socket_cls, + suppress_ragged_eofs: bool = True, + ) -> None: + self.connection = connection + self.socket = socket + self.suppress_ragged_eofs = suppress_ragged_eofs + self._io_refs = 0 + self._closed = False + + def fileno(self) -> int: + return self.socket.fileno() + + # Copy-pasted from Python 3.5 source code + def _decref_socketios(self) -> None: + if self._io_refs > 0: + self._io_refs -= 1 + if self._closed: + self.close() + + def recv(self, *args: typing.Any, **kwargs: typing.Any) -> bytes: + try: + data = self.connection.recv(*args, **kwargs) + except OpenSSL.SSL.SysCallError as e: + if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): + return b"" + else: + raise OSError(e.args[0], str(e)) from e + except OpenSSL.SSL.ZeroReturnError: + if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: + return b"" + else: + raise + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(self.socket, self.socket.gettimeout()): + raise timeout("The read operation timed out") from e + else: + return self.recv(*args, **kwargs) + + # TLS 1.3 post-handshake authentication + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"read error: {e!r}") from e + else: + return data # type: ignore[no-any-return] + + def recv_into(self, *args: typing.Any, **kwargs: typing.Any) -> int: + try: + return self.connection.recv_into(*args, **kwargs) # type: ignore[no-any-return] + except OpenSSL.SSL.SysCallError as e: + if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): + return 0 + else: + raise OSError(e.args[0], str(e)) from e + except OpenSSL.SSL.ZeroReturnError: + if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: + return 0 + else: + raise + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(self.socket, self.socket.gettimeout()): + raise timeout("The read operation timed out") from e + else: + return self.recv_into(*args, **kwargs) + + # TLS 1.3 post-handshake authentication + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"read error: {e!r}") from e + + def settimeout(self, timeout: float) -> None: + return self.socket.settimeout(timeout) + + def _send_until_done(self, data: bytes) -> int: + while True: + try: + return self.connection.send(data) # type: ignore[no-any-return] + except OpenSSL.SSL.WantWriteError as e: + if not util.wait_for_write(self.socket, self.socket.gettimeout()): + raise timeout() from e + continue + except OpenSSL.SSL.SysCallError as e: + raise OSError(e.args[0], str(e)) from e + + def sendall(self, data: bytes) -> None: + total_sent = 0 + while total_sent < len(data): + sent = self._send_until_done( + data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] + ) + total_sent += sent + + def shutdown(self) -> None: + # FIXME rethrow compatible exceptions should we ever use this + self.connection.shutdown() + + def close(self) -> None: + self._closed = True + if self._io_refs <= 0: + self._real_close() + + def _real_close(self) -> None: + try: + return self.connection.close() # type: ignore[no-any-return] + except OpenSSL.SSL.Error: + return + + def getpeercert( + self, binary_form: bool = False + ) -> dict[str, list[typing.Any]] | None: + x509 = self.connection.get_peer_certificate() + + if not x509: + return x509 # type: ignore[no-any-return] + + if binary_form: + return OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_ASN1, x509) # type: ignore[no-any-return] + + return { + "subject": ((("commonName", x509.get_subject().CN),),), # type: ignore[dict-item] + "subjectAltName": get_subj_alt_name(x509), + } + + def version(self) -> str: + return self.connection.get_protocol_version_name() # type: ignore[no-any-return] + + +WrappedSocket.makefile = socket_cls.makefile # type: ignore[attr-defined] + + +class PyOpenSSLContext: + """ + I am a wrapper class for the PyOpenSSL ``Context`` object. I am responsible + for translating the interface of the standard library ``SSLContext`` object + to calls into PyOpenSSL. + """ + + def __init__(self, protocol: int) -> None: + self.protocol = _openssl_versions[protocol] + self._ctx = OpenSSL.SSL.Context(self.protocol) + self._options = 0 + self.check_hostname = False + self._minimum_version: int = ssl.TLSVersion.MINIMUM_SUPPORTED + self._maximum_version: int = ssl.TLSVersion.MAXIMUM_SUPPORTED + + @property + def options(self) -> int: + return self._options + + @options.setter + def options(self, value: int) -> None: + self._options = value + self._set_ctx_options() + + @property + def verify_mode(self) -> int: + return _openssl_to_stdlib_verify[self._ctx.get_verify_mode()] + + @verify_mode.setter + def verify_mode(self, value: ssl.VerifyMode) -> None: + self._ctx.set_verify(_stdlib_to_openssl_verify[value], _verify_callback) + + def set_default_verify_paths(self) -> None: + self._ctx.set_default_verify_paths() + + def set_ciphers(self, ciphers: bytes | str) -> None: + if isinstance(ciphers, str): + ciphers = ciphers.encode("utf-8") + self._ctx.set_cipher_list(ciphers) + + def load_verify_locations( + self, + cafile: str | None = None, + capath: str | None = None, + cadata: bytes | None = None, + ) -> None: + if cafile is not None: + cafile = cafile.encode("utf-8") # type: ignore[assignment] + if capath is not None: + capath = capath.encode("utf-8") # type: ignore[assignment] + try: + self._ctx.load_verify_locations(cafile, capath) + if cadata is not None: + self._ctx.load_verify_locations(BytesIO(cadata)) + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"unable to load trusted certificates: {e!r}") from e + + def load_cert_chain( + self, + certfile: str, + keyfile: str | None = None, + password: str | None = None, + ) -> None: + try: + self._ctx.use_certificate_chain_file(certfile) + if password is not None: + if not isinstance(password, bytes): + password = password.encode("utf-8") # type: ignore[assignment] + self._ctx.set_passwd_cb(lambda *_: password) + self._ctx.use_privatekey_file(keyfile or certfile) + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"Unable to load certificate chain: {e!r}") from e + + def set_alpn_protocols(self, protocols: list[bytes | str]) -> None: + protocols = [util.util.to_bytes(p, "ascii") for p in protocols] + return self._ctx.set_alpn_protos(protocols) # type: ignore[no-any-return] + + def wrap_socket( + self, + sock: socket_cls, + server_side: bool = False, + do_handshake_on_connect: bool = True, + suppress_ragged_eofs: bool = True, + server_hostname: bytes | str | None = None, + ) -> WrappedSocket: + cnx = OpenSSL.SSL.Connection(self._ctx, sock) + + # If server_hostname is an IP, don't use it for SNI, per RFC6066 Section 3 + if server_hostname and not util.ssl_.is_ipaddress(server_hostname): + if isinstance(server_hostname, str): + server_hostname = server_hostname.encode("utf-8") + cnx.set_tlsext_host_name(server_hostname) + + cnx.set_connect_state() + + while True: + try: + cnx.do_handshake() + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(sock, sock.gettimeout()): + raise timeout("select timed out") from e + continue + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"bad handshake: {e!r}") from e + break + + return WrappedSocket(cnx, sock) + + def _set_ctx_options(self) -> None: + self._ctx.set_options( + self._options + | _openssl_to_ssl_minimum_version[self._minimum_version] + | _openssl_to_ssl_maximum_version[self._maximum_version] + ) + + @property + def minimum_version(self) -> int: + return self._minimum_version + + @minimum_version.setter + def minimum_version(self, minimum_version: int) -> None: + self._minimum_version = minimum_version + self._set_ctx_options() + + @property + def maximum_version(self) -> int: + return self._maximum_version + + @maximum_version.setter + def maximum_version(self, maximum_version: int) -> None: + self._maximum_version = maximum_version + self._set_ctx_options() + + +def _verify_callback( + cnx: OpenSSL.SSL.Connection, + x509: X509, + err_no: int, + err_depth: int, + return_code: int, +) -> bool: + return err_no == 0 diff --git a/billinglayer/python/urllib3/contrib/securetransport.py b/billinglayer/python/urllib3/contrib/securetransport.py new file mode 100644 index 0000000..11beb3d --- /dev/null +++ b/billinglayer/python/urllib3/contrib/securetransport.py @@ -0,0 +1,913 @@ +""" +SecureTranport support for urllib3 via ctypes. + +This makes platform-native TLS available to urllib3 users on macOS without the +use of a compiler. This is an important feature because the Python Package +Index is moving to become a TLSv1.2-or-higher server, and the default OpenSSL +that ships with macOS is not capable of doing TLSv1.2. The only way to resolve +this is to give macOS users an alternative solution to the problem, and that +solution is to use SecureTransport. + +We use ctypes here because this solution must not require a compiler. That's +because pip is not allowed to require a compiler either. + +This is not intended to be a seriously long-term solution to this problem. +The hope is that PEP 543 will eventually solve this issue for us, at which +point we can retire this contrib module. But in the short term, we need to +solve the impending tire fire that is Python on Mac without this kind of +contrib module. So...here we are. + +To use this module, simply import and inject it:: + + import urllib3.contrib.securetransport + urllib3.contrib.securetransport.inject_into_urllib3() + +Happy TLSing! + +This code is a bastardised version of the code found in Will Bond's oscrypto +library. An enormous debt is owed to him for blazing this trail for us. For +that reason, this code should be considered to be covered both by urllib3's +license and by oscrypto's: + +.. code-block:: + + Copyright (c) 2015-2016 Will Bond + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +""" + +from __future__ import annotations + +import contextlib +import ctypes +import errno +import os.path +import shutil +import socket +import ssl +import struct +import threading +import typing +import warnings +import weakref +from socket import socket as socket_cls + +from .. import util +from ._securetransport.bindings import ( # type: ignore[attr-defined] + CoreFoundation, + Security, +) +from ._securetransport.low_level import ( + SecurityConst, + _assert_no_error, + _build_tls_unknown_ca_alert, + _cert_array_from_pem, + _create_cfstring_array, + _load_client_cert_chain, + _temporary_keychain, +) + +warnings.warn( + "'urllib3.contrib.securetransport' module is deprecated and will be removed " + "in urllib3 v2.1.0. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2681", + category=DeprecationWarning, + stacklevel=2, +) + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + +__all__ = ["inject_into_urllib3", "extract_from_urllib3"] + +orig_util_SSLContext = util.ssl_.SSLContext + +# This dictionary is used by the read callback to obtain a handle to the +# calling wrapped socket. This is a pretty silly approach, but for now it'll +# do. I feel like I should be able to smuggle a handle to the wrapped socket +# directly in the SSLConnectionRef, but for now this approach will work I +# guess. +# +# We need to lock around this structure for inserts, but we don't do it for +# reads/writes in the callbacks. The reasoning here goes as follows: +# +# 1. It is not possible to call into the callbacks before the dictionary is +# populated, so once in the callback the id must be in the dictionary. +# 2. The callbacks don't mutate the dictionary, they only read from it, and +# so cannot conflict with any of the insertions. +# +# This is good: if we had to lock in the callbacks we'd drastically slow down +# the performance of this code. +_connection_refs: weakref.WeakValueDictionary[ + int, WrappedSocket +] = weakref.WeakValueDictionary() +_connection_ref_lock = threading.Lock() + +# Limit writes to 16kB. This is OpenSSL's limit, but we'll cargo-cult it over +# for no better reason than we need *a* limit, and this one is right there. +SSL_WRITE_BLOCKSIZE = 16384 + +# Basically this is simple: for PROTOCOL_SSLv23 we turn it into a low of +# TLSv1 and a high of TLSv1.2. For everything else, we pin to that version. +# TLSv1 to 1.2 are supported on macOS 10.8+ +_protocol_to_min_max = { + util.ssl_.PROTOCOL_TLS: (SecurityConst.kTLSProtocol1, SecurityConst.kTLSProtocol12), # type: ignore[attr-defined] + util.ssl_.PROTOCOL_TLS_CLIENT: ( # type: ignore[attr-defined] + SecurityConst.kTLSProtocol1, + SecurityConst.kTLSProtocol12, + ), +} + +if hasattr(ssl, "PROTOCOL_SSLv2"): + _protocol_to_min_max[ssl.PROTOCOL_SSLv2] = ( + SecurityConst.kSSLProtocol2, + SecurityConst.kSSLProtocol2, + ) +if hasattr(ssl, "PROTOCOL_SSLv3"): + _protocol_to_min_max[ssl.PROTOCOL_SSLv3] = ( + SecurityConst.kSSLProtocol3, + SecurityConst.kSSLProtocol3, + ) +if hasattr(ssl, "PROTOCOL_TLSv1"): + _protocol_to_min_max[ssl.PROTOCOL_TLSv1] = ( + SecurityConst.kTLSProtocol1, + SecurityConst.kTLSProtocol1, + ) +if hasattr(ssl, "PROTOCOL_TLSv1_1"): + _protocol_to_min_max[ssl.PROTOCOL_TLSv1_1] = ( + SecurityConst.kTLSProtocol11, + SecurityConst.kTLSProtocol11, + ) +if hasattr(ssl, "PROTOCOL_TLSv1_2"): + _protocol_to_min_max[ssl.PROTOCOL_TLSv1_2] = ( + SecurityConst.kTLSProtocol12, + SecurityConst.kTLSProtocol12, + ) + + +_tls_version_to_st: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: SecurityConst.kTLSProtocol1, + ssl.TLSVersion.TLSv1: SecurityConst.kTLSProtocol1, + ssl.TLSVersion.TLSv1_1: SecurityConst.kTLSProtocol11, + ssl.TLSVersion.TLSv1_2: SecurityConst.kTLSProtocol12, + ssl.TLSVersion.MAXIMUM_SUPPORTED: SecurityConst.kTLSProtocol12, +} + + +def inject_into_urllib3() -> None: + """ + Monkey-patch urllib3 with SecureTransport-backed SSL-support. + """ + util.SSLContext = SecureTransportContext # type: ignore[assignment] + util.ssl_.SSLContext = SecureTransportContext # type: ignore[assignment] + util.IS_SECURETRANSPORT = True + util.ssl_.IS_SECURETRANSPORT = True + + +def extract_from_urllib3() -> None: + """ + Undo monkey-patching by :func:`inject_into_urllib3`. + """ + util.SSLContext = orig_util_SSLContext + util.ssl_.SSLContext = orig_util_SSLContext + util.IS_SECURETRANSPORT = False + util.ssl_.IS_SECURETRANSPORT = False + + +def _read_callback( + connection_id: int, data_buffer: int, data_length_pointer: bytearray +) -> int: + """ + SecureTransport read callback. This is called by ST to request that data + be returned from the socket. + """ + wrapped_socket = None + try: + wrapped_socket = _connection_refs.get(connection_id) + if wrapped_socket is None: + return SecurityConst.errSSLInternal + base_socket = wrapped_socket.socket + + requested_length = data_length_pointer[0] + + timeout = wrapped_socket.gettimeout() + error = None + read_count = 0 + + try: + while read_count < requested_length: + if timeout is None or timeout >= 0: + if not util.wait_for_read(base_socket, timeout): + raise OSError(errno.EAGAIN, "timed out") + + remaining = requested_length - read_count + buffer = (ctypes.c_char * remaining).from_address( + data_buffer + read_count + ) + chunk_size = base_socket.recv_into(buffer, remaining) + read_count += chunk_size + if not chunk_size: + if not read_count: + return SecurityConst.errSSLClosedGraceful + break + except OSError as e: + error = e.errno + + if error is not None and error != errno.EAGAIN: + data_length_pointer[0] = read_count + if error == errno.ECONNRESET or error == errno.EPIPE: + return SecurityConst.errSSLClosedAbort + raise + + data_length_pointer[0] = read_count + + if read_count != requested_length: + return SecurityConst.errSSLWouldBlock + + return 0 + except Exception as e: + if wrapped_socket is not None: + wrapped_socket._exception = e + return SecurityConst.errSSLInternal + + +def _write_callback( + connection_id: int, data_buffer: int, data_length_pointer: bytearray +) -> int: + """ + SecureTransport write callback. This is called by ST to request that data + actually be sent on the network. + """ + wrapped_socket = None + try: + wrapped_socket = _connection_refs.get(connection_id) + if wrapped_socket is None: + return SecurityConst.errSSLInternal + base_socket = wrapped_socket.socket + + bytes_to_write = data_length_pointer[0] + data = ctypes.string_at(data_buffer, bytes_to_write) + + timeout = wrapped_socket.gettimeout() + error = None + sent = 0 + + try: + while sent < bytes_to_write: + if timeout is None or timeout >= 0: + if not util.wait_for_write(base_socket, timeout): + raise OSError(errno.EAGAIN, "timed out") + chunk_sent = base_socket.send(data) + sent += chunk_sent + + # This has some needless copying here, but I'm not sure there's + # much value in optimising this data path. + data = data[chunk_sent:] + except OSError as e: + error = e.errno + + if error is not None and error != errno.EAGAIN: + data_length_pointer[0] = sent + if error == errno.ECONNRESET or error == errno.EPIPE: + return SecurityConst.errSSLClosedAbort + raise + + data_length_pointer[0] = sent + + if sent != bytes_to_write: + return SecurityConst.errSSLWouldBlock + + return 0 + except Exception as e: + if wrapped_socket is not None: + wrapped_socket._exception = e + return SecurityConst.errSSLInternal + + +# We need to keep these two objects references alive: if they get GC'd while +# in use then SecureTransport could attempt to call a function that is in freed +# memory. That would be...uh...bad. Yeah, that's the word. Bad. +_read_callback_pointer = Security.SSLReadFunc(_read_callback) +_write_callback_pointer = Security.SSLWriteFunc(_write_callback) + + +class WrappedSocket: + """ + API-compatibility wrapper for Python's OpenSSL wrapped socket object. + """ + + def __init__(self, socket: socket_cls) -> None: + self.socket = socket + self.context = None + self._io_refs = 0 + self._closed = False + self._real_closed = False + self._exception: Exception | None = None + self._keychain = None + self._keychain_dir: str | None = None + self._client_cert_chain = None + + # We save off the previously-configured timeout and then set it to + # zero. This is done because we use select and friends to handle the + # timeouts, but if we leave the timeout set on the lower socket then + # Python will "kindly" call select on that socket again for us. Avoid + # that by forcing the timeout to zero. + self._timeout = self.socket.gettimeout() + self.socket.settimeout(0) + + @contextlib.contextmanager + def _raise_on_error(self) -> typing.Generator[None, None, None]: + """ + A context manager that can be used to wrap calls that do I/O from + SecureTransport. If any of the I/O callbacks hit an exception, this + context manager will correctly propagate the exception after the fact. + This avoids silently swallowing those exceptions. + + It also correctly forces the socket closed. + """ + self._exception = None + + # We explicitly don't catch around this yield because in the unlikely + # event that an exception was hit in the block we don't want to swallow + # it. + yield + if self._exception is not None: + exception, self._exception = self._exception, None + self._real_close() + raise exception + + def _set_alpn_protocols(self, protocols: list[bytes] | None) -> None: + """ + Sets up the ALPN protocols on the context. + """ + if not protocols: + return + protocols_arr = _create_cfstring_array(protocols) + try: + result = Security.SSLSetALPNProtocols(self.context, protocols_arr) + _assert_no_error(result) + finally: + CoreFoundation.CFRelease(protocols_arr) + + def _custom_validate(self, verify: bool, trust_bundle: bytes | None) -> None: + """ + Called when we have set custom validation. We do this in two cases: + first, when cert validation is entirely disabled; and second, when + using a custom trust DB. + Raises an SSLError if the connection is not trusted. + """ + # If we disabled cert validation, just say: cool. + if not verify or trust_bundle is None: + return + + successes = ( + SecurityConst.kSecTrustResultUnspecified, + SecurityConst.kSecTrustResultProceed, + ) + try: + trust_result = self._evaluate_trust(trust_bundle) + if trust_result in successes: + return + reason = f"error code: {int(trust_result)}" + exc = None + except Exception as e: + # Do not trust on error + reason = f"exception: {e!r}" + exc = e + + # SecureTransport does not send an alert nor shuts down the connection. + rec = _build_tls_unknown_ca_alert(self.version()) + self.socket.sendall(rec) + # close the connection immediately + # l_onoff = 1, activate linger + # l_linger = 0, linger for 0 seoncds + opts = struct.pack("ii", 1, 0) + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, opts) + self._real_close() + raise ssl.SSLError(f"certificate verify failed, {reason}") from exc + + def _evaluate_trust(self, trust_bundle: bytes) -> int: + # We want data in memory, so load it up. + if os.path.isfile(trust_bundle): + with open(trust_bundle, "rb") as f: + trust_bundle = f.read() + + cert_array = None + trust = Security.SecTrustRef() + + try: + # Get a CFArray that contains the certs we want. + cert_array = _cert_array_from_pem(trust_bundle) + + # Ok, now the hard part. We want to get the SecTrustRef that ST has + # created for this connection, shove our CAs into it, tell ST to + # ignore everything else it knows, and then ask if it can build a + # chain. This is a buuuunch of code. + result = Security.SSLCopyPeerTrust(self.context, ctypes.byref(trust)) + _assert_no_error(result) + if not trust: + raise ssl.SSLError("Failed to copy trust reference") + + result = Security.SecTrustSetAnchorCertificates(trust, cert_array) + _assert_no_error(result) + + result = Security.SecTrustSetAnchorCertificatesOnly(trust, True) + _assert_no_error(result) + + trust_result = Security.SecTrustResultType() + result = Security.SecTrustEvaluate(trust, ctypes.byref(trust_result)) + _assert_no_error(result) + finally: + if trust: + CoreFoundation.CFRelease(trust) + + if cert_array is not None: + CoreFoundation.CFRelease(cert_array) + + return trust_result.value # type: ignore[no-any-return] + + def handshake( + self, + server_hostname: bytes | str | None, + verify: bool, + trust_bundle: bytes | None, + min_version: int, + max_version: int, + client_cert: str | None, + client_key: str | None, + client_key_passphrase: typing.Any, + alpn_protocols: list[bytes] | None, + ) -> None: + """ + Actually performs the TLS handshake. This is run automatically by + wrapped socket, and shouldn't be needed in user code. + """ + # First, we do the initial bits of connection setup. We need to create + # a context, set its I/O funcs, and set the connection reference. + self.context = Security.SSLCreateContext( + None, SecurityConst.kSSLClientSide, SecurityConst.kSSLStreamType + ) + result = Security.SSLSetIOFuncs( + self.context, _read_callback_pointer, _write_callback_pointer + ) + _assert_no_error(result) + + # Here we need to compute the handle to use. We do this by taking the + # id of self modulo 2**31 - 1. If this is already in the dictionary, we + # just keep incrementing by one until we find a free space. + with _connection_ref_lock: + handle = id(self) % 2147483647 + while handle in _connection_refs: + handle = (handle + 1) % 2147483647 + _connection_refs[handle] = self + + result = Security.SSLSetConnection(self.context, handle) + _assert_no_error(result) + + # If we have a server hostname, we should set that too. + # RFC6066 Section 3 tells us not to use SNI when the host is an IP, but we have + # to do it anyway to match server_hostname against the server certificate + if server_hostname: + if not isinstance(server_hostname, bytes): + server_hostname = server_hostname.encode("utf-8") + + result = Security.SSLSetPeerDomainName( + self.context, server_hostname, len(server_hostname) + ) + _assert_no_error(result) + + # Setup the ALPN protocols. + self._set_alpn_protocols(alpn_protocols) + + # Set the minimum and maximum TLS versions. + result = Security.SSLSetProtocolVersionMin(self.context, min_version) + _assert_no_error(result) + + result = Security.SSLSetProtocolVersionMax(self.context, max_version) + _assert_no_error(result) + + # If there's a trust DB, we need to use it. We do that by telling + # SecureTransport to break on server auth. We also do that if we don't + # want to validate the certs at all: we just won't actually do any + # authing in that case. + if not verify or trust_bundle is not None: + result = Security.SSLSetSessionOption( + self.context, SecurityConst.kSSLSessionOptionBreakOnServerAuth, True + ) + _assert_no_error(result) + + # If there's a client cert, we need to use it. + if client_cert: + self._keychain, self._keychain_dir = _temporary_keychain() + self._client_cert_chain = _load_client_cert_chain( + self._keychain, client_cert, client_key + ) + result = Security.SSLSetCertificate(self.context, self._client_cert_chain) + _assert_no_error(result) + + while True: + with self._raise_on_error(): + result = Security.SSLHandshake(self.context) + + if result == SecurityConst.errSSLWouldBlock: + raise socket.timeout("handshake timed out") + elif result == SecurityConst.errSSLServerAuthCompleted: + self._custom_validate(verify, trust_bundle) + continue + else: + _assert_no_error(result) + break + + def fileno(self) -> int: + return self.socket.fileno() + + # Copy-pasted from Python 3.5 source code + def _decref_socketios(self) -> None: + if self._io_refs > 0: + self._io_refs -= 1 + if self._closed: + self.close() + + def recv(self, bufsiz: int) -> bytes: + buffer = ctypes.create_string_buffer(bufsiz) + bytes_read = self.recv_into(buffer, bufsiz) + data = buffer[:bytes_read] + return typing.cast(bytes, data) + + def recv_into( + self, buffer: ctypes.Array[ctypes.c_char], nbytes: int | None = None + ) -> int: + # Read short on EOF. + if self._real_closed: + return 0 + + if nbytes is None: + nbytes = len(buffer) + + buffer = (ctypes.c_char * nbytes).from_buffer(buffer) + processed_bytes = ctypes.c_size_t(0) + + with self._raise_on_error(): + result = Security.SSLRead( + self.context, buffer, nbytes, ctypes.byref(processed_bytes) + ) + + # There are some result codes that we want to treat as "not always + # errors". Specifically, those are errSSLWouldBlock, + # errSSLClosedGraceful, and errSSLClosedNoNotify. + if result == SecurityConst.errSSLWouldBlock: + # If we didn't process any bytes, then this was just a time out. + # However, we can get errSSLWouldBlock in situations when we *did* + # read some data, and in those cases we should just read "short" + # and return. + if processed_bytes.value == 0: + # Timed out, no data read. + raise socket.timeout("recv timed out") + elif result in ( + SecurityConst.errSSLClosedGraceful, + SecurityConst.errSSLClosedNoNotify, + ): + # The remote peer has closed this connection. We should do so as + # well. Note that we don't actually return here because in + # principle this could actually be fired along with return data. + # It's unlikely though. + self._real_close() + else: + _assert_no_error(result) + + # Ok, we read and probably succeeded. We should return whatever data + # was actually read. + return processed_bytes.value + + def settimeout(self, timeout: float) -> None: + self._timeout = timeout + + def gettimeout(self) -> float | None: + return self._timeout + + def send(self, data: bytes) -> int: + processed_bytes = ctypes.c_size_t(0) + + with self._raise_on_error(): + result = Security.SSLWrite( + self.context, data, len(data), ctypes.byref(processed_bytes) + ) + + if result == SecurityConst.errSSLWouldBlock and processed_bytes.value == 0: + # Timed out + raise socket.timeout("send timed out") + else: + _assert_no_error(result) + + # We sent, and probably succeeded. Tell them how much we sent. + return processed_bytes.value + + def sendall(self, data: bytes) -> None: + total_sent = 0 + while total_sent < len(data): + sent = self.send(data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE]) + total_sent += sent + + def shutdown(self) -> None: + with self._raise_on_error(): + Security.SSLClose(self.context) + + def close(self) -> None: + self._closed = True + # TODO: should I do clean shutdown here? Do I have to? + if self._io_refs <= 0: + self._real_close() + + def _real_close(self) -> None: + self._real_closed = True + if self.context: + CoreFoundation.CFRelease(self.context) + self.context = None + if self._client_cert_chain: + CoreFoundation.CFRelease(self._client_cert_chain) + self._client_cert_chain = None + if self._keychain: + Security.SecKeychainDelete(self._keychain) + CoreFoundation.CFRelease(self._keychain) + shutil.rmtree(self._keychain_dir) + self._keychain = self._keychain_dir = None + return self.socket.close() + + def getpeercert(self, binary_form: bool = False) -> bytes | None: + # Urgh, annoying. + # + # Here's how we do this: + # + # 1. Call SSLCopyPeerTrust to get hold of the trust object for this + # connection. + # 2. Call SecTrustGetCertificateAtIndex for index 0 to get the leaf. + # 3. To get the CN, call SecCertificateCopyCommonName and process that + # string so that it's of the appropriate type. + # 4. To get the SAN, we need to do something a bit more complex: + # a. Call SecCertificateCopyValues to get the data, requesting + # kSecOIDSubjectAltName. + # b. Mess about with this dictionary to try to get the SANs out. + # + # This is gross. Really gross. It's going to be a few hundred LoC extra + # just to repeat something that SecureTransport can *already do*. So my + # operating assumption at this time is that what we want to do is + # instead to just flag to urllib3 that it shouldn't do its own hostname + # validation when using SecureTransport. + if not binary_form: + raise ValueError("SecureTransport only supports dumping binary certs") + trust = Security.SecTrustRef() + certdata = None + der_bytes = None + + try: + # Grab the trust store. + result = Security.SSLCopyPeerTrust(self.context, ctypes.byref(trust)) + _assert_no_error(result) + if not trust: + # Probably we haven't done the handshake yet. No biggie. + return None + + cert_count = Security.SecTrustGetCertificateCount(trust) + if not cert_count: + # Also a case that might happen if we haven't handshaked. + # Handshook? Handshaken? + return None + + leaf = Security.SecTrustGetCertificateAtIndex(trust, 0) + assert leaf + + # Ok, now we want the DER bytes. + certdata = Security.SecCertificateCopyData(leaf) + assert certdata + + data_length = CoreFoundation.CFDataGetLength(certdata) + data_buffer = CoreFoundation.CFDataGetBytePtr(certdata) + der_bytes = ctypes.string_at(data_buffer, data_length) + finally: + if certdata: + CoreFoundation.CFRelease(certdata) + if trust: + CoreFoundation.CFRelease(trust) + + return der_bytes + + def version(self) -> str: + protocol = Security.SSLProtocol() + result = Security.SSLGetNegotiatedProtocolVersion( + self.context, ctypes.byref(protocol) + ) + _assert_no_error(result) + if protocol.value == SecurityConst.kTLSProtocol13: + raise ssl.SSLError("SecureTransport does not support TLS 1.3") + elif protocol.value == SecurityConst.kTLSProtocol12: + return "TLSv1.2" + elif protocol.value == SecurityConst.kTLSProtocol11: + return "TLSv1.1" + elif protocol.value == SecurityConst.kTLSProtocol1: + return "TLSv1" + elif protocol.value == SecurityConst.kSSLProtocol3: + return "SSLv3" + elif protocol.value == SecurityConst.kSSLProtocol2: + return "SSLv2" + else: + raise ssl.SSLError(f"Unknown TLS version: {protocol!r}") + + +def makefile( + self: socket_cls, + mode: ( + Literal["r"] | Literal["w"] | Literal["rw"] | Literal["wr"] | Literal[""] + ) = "r", + buffering: int | None = None, + *args: typing.Any, + **kwargs: typing.Any, +) -> typing.BinaryIO | typing.TextIO: + # We disable buffering with SecureTransport because it conflicts with + # the buffering that ST does internally (see issue #1153 for more). + buffering = 0 + return socket_cls.makefile(self, mode, buffering, *args, **kwargs) + + +WrappedSocket.makefile = makefile # type: ignore[attr-defined] + + +class SecureTransportContext: + """ + I am a wrapper class for the SecureTransport library, to translate the + interface of the standard library ``SSLContext`` object to calls into + SecureTransport. + """ + + def __init__(self, protocol: int) -> None: + self._minimum_version: int = ssl.TLSVersion.MINIMUM_SUPPORTED + self._maximum_version: int = ssl.TLSVersion.MAXIMUM_SUPPORTED + if protocol not in (None, ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS_CLIENT): + self._min_version, self._max_version = _protocol_to_min_max[protocol] + + self._options = 0 + self._verify = False + self._trust_bundle: bytes | None = None + self._client_cert: str | None = None + self._client_key: str | None = None + self._client_key_passphrase = None + self._alpn_protocols: list[bytes] | None = None + + @property + def check_hostname(self) -> Literal[True]: + """ + SecureTransport cannot have its hostname checking disabled. For more, + see the comment on getpeercert() in this file. + """ + return True + + @check_hostname.setter + def check_hostname(self, value: typing.Any) -> None: + """ + SecureTransport cannot have its hostname checking disabled. For more, + see the comment on getpeercert() in this file. + """ + + @property + def options(self) -> int: + # TODO: Well, crap. + # + # So this is the bit of the code that is the most likely to cause us + # trouble. Essentially we need to enumerate all of the SSL options that + # users might want to use and try to see if we can sensibly translate + # them, or whether we should just ignore them. + return self._options + + @options.setter + def options(self, value: int) -> None: + # TODO: Update in line with above. + self._options = value + + @property + def verify_mode(self) -> int: + return ssl.CERT_REQUIRED if self._verify else ssl.CERT_NONE + + @verify_mode.setter + def verify_mode(self, value: int) -> None: + self._verify = value == ssl.CERT_REQUIRED + + def set_default_verify_paths(self) -> None: + # So, this has to do something a bit weird. Specifically, what it does + # is nothing. + # + # This means that, if we had previously had load_verify_locations + # called, this does not undo that. We need to do that because it turns + # out that the rest of the urllib3 code will attempt to load the + # default verify paths if it hasn't been told about any paths, even if + # the context itself was sometime earlier. We resolve that by just + # ignoring it. + pass + + def load_default_certs(self) -> None: + return self.set_default_verify_paths() + + def set_ciphers(self, ciphers: typing.Any) -> None: + raise ValueError("SecureTransport doesn't support custom cipher strings") + + def load_verify_locations( + self, + cafile: str | None = None, + capath: str | None = None, + cadata: bytes | None = None, + ) -> None: + # OK, we only really support cadata and cafile. + if capath is not None: + raise ValueError("SecureTransport does not support cert directories") + + # Raise if cafile does not exist. + if cafile is not None: + with open(cafile): + pass + + self._trust_bundle = cafile or cadata # type: ignore[assignment] + + def load_cert_chain( + self, + certfile: str, + keyfile: str | None = None, + password: str | None = None, + ) -> None: + self._client_cert = certfile + self._client_key = keyfile + self._client_cert_passphrase = password + + def set_alpn_protocols(self, protocols: list[str | bytes]) -> None: + """ + Sets the ALPN protocols that will later be set on the context. + + Raises a NotImplementedError if ALPN is not supported. + """ + if not hasattr(Security, "SSLSetALPNProtocols"): + raise NotImplementedError( + "SecureTransport supports ALPN only in macOS 10.12+" + ) + self._alpn_protocols = [util.util.to_bytes(p, "ascii") for p in protocols] + + def wrap_socket( + self, + sock: socket_cls, + server_side: bool = False, + do_handshake_on_connect: bool = True, + suppress_ragged_eofs: bool = True, + server_hostname: bytes | str | None = None, + ) -> WrappedSocket: + # So, what do we do here? Firstly, we assert some properties. This is a + # stripped down shim, so there is some functionality we don't support. + # See PEP 543 for the real deal. + assert not server_side + assert do_handshake_on_connect + assert suppress_ragged_eofs + + # Ok, we're good to go. Now we want to create the wrapped socket object + # and store it in the appropriate place. + wrapped_socket = WrappedSocket(sock) + + # Now we can handshake + wrapped_socket.handshake( + server_hostname, + self._verify, + self._trust_bundle, + _tls_version_to_st[self._minimum_version], + _tls_version_to_st[self._maximum_version], + self._client_cert, + self._client_key, + self._client_key_passphrase, + self._alpn_protocols, + ) + return wrapped_socket + + @property + def minimum_version(self) -> int: + return self._minimum_version + + @minimum_version.setter + def minimum_version(self, minimum_version: int) -> None: + self._minimum_version = minimum_version + + @property + def maximum_version(self) -> int: + return self._maximum_version + + @maximum_version.setter + def maximum_version(self, maximum_version: int) -> None: + self._maximum_version = maximum_version diff --git a/billinglayer/python/urllib3/contrib/socks.py b/billinglayer/python/urllib3/contrib/socks.py new file mode 100644 index 0000000..5e552dd --- /dev/null +++ b/billinglayer/python/urllib3/contrib/socks.py @@ -0,0 +1,233 @@ +""" +This module contains provisional support for SOCKS proxies from within +urllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and +SOCKS5. To enable its functionality, either install PySocks or install this +module with the ``socks`` extra. + +The SOCKS implementation supports the full range of urllib3 features. It also +supports the following SOCKS features: + +- SOCKS4A (``proxy_url='socks4a://...``) +- SOCKS4 (``proxy_url='socks4://...``) +- SOCKS5 with remote DNS (``proxy_url='socks5h://...``) +- SOCKS5 with local DNS (``proxy_url='socks5://...``) +- Usernames and passwords for the SOCKS proxy + +.. note:: + It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in + your ``proxy_url`` to ensure that DNS resolution is done from the remote + server instead of client-side when connecting to a domain name. + +SOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5 +supports IPv4, IPv6, and domain names. + +When connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url`` +will be sent as the ``userid`` section of the SOCKS request: + +.. code-block:: python + + proxy_url="socks4a://@proxy-host" + +When connecting to a SOCKS5 proxy the ``username`` and ``password`` portion +of the ``proxy_url`` will be sent as the username/password to authenticate +with the proxy: + +.. code-block:: python + + proxy_url="socks5h://:@proxy-host" + +""" + +from __future__ import annotations + +try: + import socks # type: ignore[import] +except ImportError: + import warnings + + from ..exceptions import DependencyWarning + + warnings.warn( + ( + "SOCKS support in urllib3 requires the installation of optional " + "dependencies: specifically, PySocks. For more information, see " + "https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies" + ), + DependencyWarning, + ) + raise + +import typing +from socket import timeout as SocketTimeout + +from ..connection import HTTPConnection, HTTPSConnection +from ..connectionpool import HTTPConnectionPool, HTTPSConnectionPool +from ..exceptions import ConnectTimeoutError, NewConnectionError +from ..poolmanager import PoolManager +from ..util.url import parse_url + +try: + import ssl +except ImportError: + ssl = None # type: ignore[assignment] + +try: + from typing import TypedDict + + class _TYPE_SOCKS_OPTIONS(TypedDict): + socks_version: int + proxy_host: str | None + proxy_port: str | None + username: str | None + password: str | None + rdns: bool + +except ImportError: # Python 3.7 + _TYPE_SOCKS_OPTIONS = typing.Dict[str, typing.Any] # type: ignore[misc, assignment] + + +class SOCKSConnection(HTTPConnection): + """ + A plain-text HTTP connection that connects via a SOCKS proxy. + """ + + def __init__( + self, + _socks_options: _TYPE_SOCKS_OPTIONS, + *args: typing.Any, + **kwargs: typing.Any, + ) -> None: + self._socks_options = _socks_options + super().__init__(*args, **kwargs) + + def _new_conn(self) -> socks.socksocket: + """ + Establish a new connection via the SOCKS proxy. + """ + extra_kw: dict[str, typing.Any] = {} + if self.source_address: + extra_kw["source_address"] = self.source_address + + if self.socket_options: + extra_kw["socket_options"] = self.socket_options + + try: + conn = socks.create_connection( + (self.host, self.port), + proxy_type=self._socks_options["socks_version"], + proxy_addr=self._socks_options["proxy_host"], + proxy_port=self._socks_options["proxy_port"], + proxy_username=self._socks_options["username"], + proxy_password=self._socks_options["password"], + proxy_rdns=self._socks_options["rdns"], + timeout=self.timeout, + **extra_kw, + ) + + except SocketTimeout as e: + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + + except socks.ProxyError as e: + # This is fragile as hell, but it seems to be the only way to raise + # useful errors here. + if e.socket_err: + error = e.socket_err + if isinstance(error, SocketTimeout): + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + else: + # Adding `from e` messes with coverage somehow, so it's omitted. + # See #2386. + raise NewConnectionError( + self, f"Failed to establish a new connection: {error}" + ) + else: + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + except OSError as e: # Defensive: PySocks should catch all these. + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + return conn + + +# We don't need to duplicate the Verified/Unverified distinction from +# urllib3/connection.py here because the HTTPSConnection will already have been +# correctly set to either the Verified or Unverified form by that module. This +# means the SOCKSHTTPSConnection will automatically be the correct type. +class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection): + pass + + +class SOCKSHTTPConnectionPool(HTTPConnectionPool): + ConnectionCls = SOCKSConnection + + +class SOCKSHTTPSConnectionPool(HTTPSConnectionPool): + ConnectionCls = SOCKSHTTPSConnection + + +class SOCKSProxyManager(PoolManager): + """ + A version of the urllib3 ProxyManager that routes connections via the + defined SOCKS proxy. + """ + + pool_classes_by_scheme = { + "http": SOCKSHTTPConnectionPool, + "https": SOCKSHTTPSConnectionPool, + } + + def __init__( + self, + proxy_url: str, + username: str | None = None, + password: str | None = None, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + **connection_pool_kw: typing.Any, + ): + parsed = parse_url(proxy_url) + + if username is None and password is None and parsed.auth is not None: + split = parsed.auth.split(":") + if len(split) == 2: + username, password = split + if parsed.scheme == "socks5": + socks_version = socks.PROXY_TYPE_SOCKS5 + rdns = False + elif parsed.scheme == "socks5h": + socks_version = socks.PROXY_TYPE_SOCKS5 + rdns = True + elif parsed.scheme == "socks4": + socks_version = socks.PROXY_TYPE_SOCKS4 + rdns = False + elif parsed.scheme == "socks4a": + socks_version = socks.PROXY_TYPE_SOCKS4 + rdns = True + else: + raise ValueError(f"Unable to determine SOCKS version from {proxy_url}") + + self.proxy_url = proxy_url + + socks_options = { + "socks_version": socks_version, + "proxy_host": parsed.host, + "proxy_port": parsed.port, + "username": username, + "password": password, + "rdns": rdns, + } + connection_pool_kw["_socks_options"] = socks_options + + super().__init__(num_pools, headers, **connection_pool_kw) + + self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme diff --git a/billinglayer/python/urllib3/exceptions.py b/billinglayer/python/urllib3/exceptions.py new file mode 100644 index 0000000..5bb9236 --- /dev/null +++ b/billinglayer/python/urllib3/exceptions.py @@ -0,0 +1,318 @@ +from __future__ import annotations + +import socket +import typing +import warnings +from email.errors import MessageDefect +from http.client import IncompleteRead as httplib_IncompleteRead + +if typing.TYPE_CHECKING: + from .connection import HTTPConnection + from .connectionpool import ConnectionPool + from .response import HTTPResponse + from .util.retry import Retry + +# Base Exceptions + + +class HTTPError(Exception): + """Base exception used by this module.""" + + +class HTTPWarning(Warning): + """Base warning used by this module.""" + + +_TYPE_REDUCE_RESULT = typing.Tuple[ + typing.Callable[..., object], typing.Tuple[object, ...] +] + + +class PoolError(HTTPError): + """Base exception for errors caused within a pool.""" + + def __init__(self, pool: ConnectionPool, message: str) -> None: + self.pool = pool + super().__init__(f"{pool}: {message}") + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, None) + + +class RequestError(PoolError): + """Base exception for PoolErrors that have associated URLs.""" + + def __init__(self, pool: ConnectionPool, url: str, message: str) -> None: + self.url = url + super().__init__(pool, message) + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, self.url, None) + + +class SSLError(HTTPError): + """Raised when SSL certificate fails in an HTTPS connection.""" + + +class ProxyError(HTTPError): + """Raised when the connection to a proxy fails.""" + + # The original error is also available as __cause__. + original_error: Exception + + def __init__(self, message: str, error: Exception) -> None: + super().__init__(message, error) + self.original_error = error + + +class DecodeError(HTTPError): + """Raised when automatic decoding based on Content-Type fails.""" + + +class ProtocolError(HTTPError): + """Raised when something unexpected happens mid-request/response.""" + + +#: Renamed to ProtocolError but aliased for backwards compatibility. +ConnectionError = ProtocolError + + +# Leaf Exceptions + + +class MaxRetryError(RequestError): + """Raised when the maximum number of retries is exceeded. + + :param pool: The connection pool + :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool` + :param str url: The requested Url + :param reason: The underlying error + :type reason: :class:`Exception` + + """ + + def __init__( + self, pool: ConnectionPool, url: str, reason: Exception | None = None + ) -> None: + self.reason = reason + + message = f"Max retries exceeded with url: {url} (Caused by {reason!r})" + + super().__init__(pool, url, message) + + +class HostChangedError(RequestError): + """Raised when an existing pool gets a request for a foreign host.""" + + def __init__( + self, pool: ConnectionPool, url: str, retries: Retry | int = 3 + ) -> None: + message = f"Tried to open a foreign host with url: {url}" + super().__init__(pool, url, message) + self.retries = retries + + +class TimeoutStateError(HTTPError): + """Raised when passing an invalid state to a timeout""" + + +class TimeoutError(HTTPError): + """Raised when a socket timeout error occurs. + + Catching this error will catch both :exc:`ReadTimeoutErrors + ` and :exc:`ConnectTimeoutErrors `. + """ + + +class ReadTimeoutError(TimeoutError, RequestError): + """Raised when a socket timeout occurs while receiving data from a server""" + + +# This timeout error does not have a URL attached and needs to inherit from the +# base HTTPError +class ConnectTimeoutError(TimeoutError): + """Raised when a socket timeout occurs while connecting to a server""" + + +class NewConnectionError(ConnectTimeoutError, HTTPError): + """Raised when we fail to establish a new connection. Usually ECONNREFUSED.""" + + def __init__(self, conn: HTTPConnection, message: str) -> None: + self.conn = conn + super().__init__(f"{conn}: {message}") + + @property + def pool(self) -> HTTPConnection: + warnings.warn( + "The 'pool' property is deprecated and will be removed " + "in urllib3 v2.1.0. Use 'conn' instead.", + DeprecationWarning, + stacklevel=2, + ) + + return self.conn + + +class NameResolutionError(NewConnectionError): + """Raised when host name resolution fails.""" + + def __init__(self, host: str, conn: HTTPConnection, reason: socket.gaierror): + message = f"Failed to resolve '{host}' ({reason})" + super().__init__(conn, message) + + +class EmptyPoolError(PoolError): + """Raised when a pool runs out of connections and no more are allowed.""" + + +class FullPoolError(PoolError): + """Raised when we try to add a connection to a full pool in blocking mode.""" + + +class ClosedPoolError(PoolError): + """Raised when a request enters a pool after the pool has been closed.""" + + +class LocationValueError(ValueError, HTTPError): + """Raised when there is something wrong with a given URL input.""" + + +class LocationParseError(LocationValueError): + """Raised when get_host or similar fails to parse the URL input.""" + + def __init__(self, location: str) -> None: + message = f"Failed to parse: {location}" + super().__init__(message) + + self.location = location + + +class URLSchemeUnknown(LocationValueError): + """Raised when a URL input has an unsupported scheme.""" + + def __init__(self, scheme: str): + message = f"Not supported URL scheme {scheme}" + super().__init__(message) + + self.scheme = scheme + + +class ResponseError(HTTPError): + """Used as a container for an error reason supplied in a MaxRetryError.""" + + GENERIC_ERROR = "too many error responses" + SPECIFIC_ERROR = "too many {status_code} error responses" + + +class SecurityWarning(HTTPWarning): + """Warned when performing security reducing actions""" + + +class InsecureRequestWarning(SecurityWarning): + """Warned when making an unverified HTTPS request.""" + + +class NotOpenSSLWarning(SecurityWarning): + """Warned when using unsupported SSL library""" + + +class SystemTimeWarning(SecurityWarning): + """Warned when system time is suspected to be wrong""" + + +class InsecurePlatformWarning(SecurityWarning): + """Warned when certain TLS/SSL configuration is not available on a platform.""" + + +class DependencyWarning(HTTPWarning): + """ + Warned when an attempt is made to import a module with missing optional + dependencies. + """ + + +class ResponseNotChunked(ProtocolError, ValueError): + """Response needs to be chunked in order to read it as chunks.""" + + +class BodyNotHttplibCompatible(HTTPError): + """ + Body should be :class:`http.client.HTTPResponse` like + (have an fp attribute which returns raw chunks) for read_chunked(). + """ + + +class IncompleteRead(HTTPError, httplib_IncompleteRead): + """ + Response length doesn't match expected Content-Length + + Subclass of :class:`http.client.IncompleteRead` to allow int value + for ``partial`` to avoid creating large objects on streamed reads. + """ + + def __init__(self, partial: int, expected: int) -> None: + self.partial = partial # type: ignore[assignment] + self.expected = expected + + def __repr__(self) -> str: + return "IncompleteRead(%i bytes read, %i more expected)" % ( + self.partial, # type: ignore[str-format] + self.expected, + ) + + +class InvalidChunkLength(HTTPError, httplib_IncompleteRead): + """Invalid chunk length in a chunked response.""" + + def __init__(self, response: HTTPResponse, length: bytes) -> None: + self.partial: int = response.tell() # type: ignore[assignment] + self.expected: int | None = response.length_remaining + self.response = response + self.length = length + + def __repr__(self) -> str: + return "InvalidChunkLength(got length %r, %i bytes read)" % ( + self.length, + self.partial, + ) + + +class InvalidHeader(HTTPError): + """The header provided was somehow invalid.""" + + +class ProxySchemeUnknown(AssertionError, URLSchemeUnknown): + """ProxyManager does not support the supplied scheme""" + + # TODO(t-8ch): Stop inheriting from AssertionError in v2.0. + + def __init__(self, scheme: str | None) -> None: + # 'localhost' is here because our URL parser parses + # localhost:8080 -> scheme=localhost, remove if we fix this. + if scheme == "localhost": + scheme = None + if scheme is None: + message = "Proxy URL had no scheme, should start with http:// or https://" + else: + message = f"Proxy URL had unsupported scheme {scheme}, should use http:// or https://" + super().__init__(message) + + +class ProxySchemeUnsupported(ValueError): + """Fetching HTTPS resources through HTTPS proxies is unsupported""" + + +class HeaderParsingError(HTTPError): + """Raised by assert_header_parsing, but we convert it to a log.warning statement.""" + + def __init__( + self, defects: list[MessageDefect], unparsed_data: bytes | str | None + ) -> None: + message = f"{defects or 'Unknown'}, unparsed data: {unparsed_data!r}" + super().__init__(message) + + +class UnrewindableBodyError(HTTPError): + """urllib3 encountered an error when trying to rewind a body""" diff --git a/billinglayer/python/urllib3/fields.py b/billinglayer/python/urllib3/fields.py new file mode 100644 index 0000000..51d898e --- /dev/null +++ b/billinglayer/python/urllib3/fields.py @@ -0,0 +1,345 @@ +from __future__ import annotations + +import email.utils +import mimetypes +import typing + +_TYPE_FIELD_VALUE = typing.Union[str, bytes] +_TYPE_FIELD_VALUE_TUPLE = typing.Union[ + _TYPE_FIELD_VALUE, + typing.Tuple[str, _TYPE_FIELD_VALUE], + typing.Tuple[str, _TYPE_FIELD_VALUE, str], +] + + +def guess_content_type( + filename: str | None, default: str = "application/octet-stream" +) -> str: + """ + Guess the "Content-Type" of a file. + + :param filename: + The filename to guess the "Content-Type" of using :mod:`mimetypes`. + :param default: + If no "Content-Type" can be guessed, default to `default`. + """ + if filename: + return mimetypes.guess_type(filename)[0] or default + return default + + +def format_header_param_rfc2231(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Helper function to format and quote a single header parameter using the + strategy defined in RFC 2231. + + Particularly useful for header parameters which might contain + non-ASCII values, like file names. This follows + `RFC 2388 Section 4.4 `_. + + :param name: + The name of the parameter, a string expected to be ASCII only. + :param value: + The value of the parameter, provided as ``bytes`` or `str``. + :returns: + An RFC-2231-formatted unicode string. + + .. deprecated:: 2.0.0 + Will be removed in urllib3 v2.1.0. This is not valid for + ``multipart/form-data`` header parameters. + """ + import warnings + + warnings.warn( + "'format_header_param_rfc2231' is deprecated and will be " + "removed in urllib3 v2.1.0. This is not valid for " + "multipart/form-data header parameters.", + DeprecationWarning, + stacklevel=2, + ) + + if isinstance(value, bytes): + value = value.decode("utf-8") + + if not any(ch in value for ch in '"\\\r\n'): + result = f'{name}="{value}"' + try: + result.encode("ascii") + except (UnicodeEncodeError, UnicodeDecodeError): + pass + else: + return result + + value = email.utils.encode_rfc2231(value, "utf-8") + value = f"{name}*={value}" + + return value + + +def format_multipart_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Format and quote a single multipart header parameter. + + This follows the `WHATWG HTML Standard`_ as of 2021/06/10, matching + the behavior of current browser and curl versions. Values are + assumed to be UTF-8. The ``\\n``, ``\\r``, and ``"`` characters are + percent encoded. + + .. _WHATWG HTML Standard: + https://html.spec.whatwg.org/multipage/ + form-control-infrastructure.html#multipart-form-data + + :param name: + The name of the parameter, an ASCII-only ``str``. + :param value: + The value of the parameter, a ``str`` or UTF-8 encoded + ``bytes``. + :returns: + A string ``name="value"`` with the escaped value. + + .. versionchanged:: 2.0.0 + Matches the WHATWG HTML Standard as of 2021/06/10. Control + characters are no longer percent encoded. + + .. versionchanged:: 2.0.0 + Renamed from ``format_header_param_html5`` and + ``format_header_param``. The old names will be removed in + urllib3 v2.1.0. + """ + if isinstance(value, bytes): + value = value.decode("utf-8") + + # percent encode \n \r " + value = value.translate({10: "%0A", 13: "%0D", 34: "%22"}) + return f'{name}="{value}"' + + +def format_header_param_html5(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + .. deprecated:: 2.0.0 + Renamed to :func:`format_multipart_header_param`. Will be + removed in urllib3 v2.1.0. + """ + import warnings + + warnings.warn( + "'format_header_param_html5' has been renamed to " + "'format_multipart_header_param'. The old name will be " + "removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + return format_multipart_header_param(name, value) + + +def format_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + .. deprecated:: 2.0.0 + Renamed to :func:`format_multipart_header_param`. Will be + removed in urllib3 v2.1.0. + """ + import warnings + + warnings.warn( + "'format_header_param' has been renamed to " + "'format_multipart_header_param'. The old name will be " + "removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + return format_multipart_header_param(name, value) + + +class RequestField: + """ + A data container for request body parameters. + + :param name: + The name of this request field. Must be unicode. + :param data: + The data/value body. + :param filename: + An optional filename of the request field. Must be unicode. + :param headers: + An optional dict-like object of headers to initially use for the field. + + .. versionchanged:: 2.0.0 + The ``header_formatter`` parameter is deprecated and will + be removed in urllib3 v2.1.0. + """ + + def __init__( + self, + name: str, + data: _TYPE_FIELD_VALUE, + filename: str | None = None, + headers: typing.Mapping[str, str] | None = None, + header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, + ): + self._name = name + self._filename = filename + self.data = data + self.headers: dict[str, str | None] = {} + if headers: + self.headers = dict(headers) + + if header_formatter is not None: + import warnings + + warnings.warn( + "The 'header_formatter' parameter is deprecated and " + "will be removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + self.header_formatter = header_formatter + else: + self.header_formatter = format_multipart_header_param + + @classmethod + def from_tuples( + cls, + fieldname: str, + value: _TYPE_FIELD_VALUE_TUPLE, + header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, + ) -> RequestField: + """ + A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. + + Supports constructing :class:`~urllib3.fields.RequestField` from + parameter of key/value strings AND key/filetuple. A filetuple is a + (filename, data, MIME type) tuple where the MIME type is optional. + For example:: + + 'foo': 'bar', + 'fakefile': ('foofile.txt', 'contents of foofile'), + 'realfile': ('barfile.txt', open('realfile').read()), + 'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'), + 'nonamefile': 'contents of nonamefile field', + + Field names and filenames must be unicode. + """ + filename: str | None + content_type: str | None + data: _TYPE_FIELD_VALUE + + if isinstance(value, tuple): + if len(value) == 3: + filename, data, content_type = typing.cast( + typing.Tuple[str, _TYPE_FIELD_VALUE, str], value + ) + else: + filename, data = typing.cast( + typing.Tuple[str, _TYPE_FIELD_VALUE], value + ) + content_type = guess_content_type(filename) + else: + filename = None + content_type = None + data = value + + request_param = cls( + fieldname, data, filename=filename, header_formatter=header_formatter + ) + request_param.make_multipart(content_type=content_type) + + return request_param + + def _render_part(self, name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Override this method to change how each multipart header + parameter is formatted. By default, this calls + :func:`format_multipart_header_param`. + + :param name: + The name of the parameter, an ASCII-only ``str``. + :param value: + The value of the parameter, a ``str`` or UTF-8 encoded + ``bytes``. + + :meta public: + """ + return self.header_formatter(name, value) + + def _render_parts( + self, + header_parts: ( + dict[str, _TYPE_FIELD_VALUE | None] + | typing.Sequence[tuple[str, _TYPE_FIELD_VALUE | None]] + ), + ) -> str: + """ + Helper function to format and quote a single header. + + Useful for single headers that are composed of multiple items. E.g., + 'Content-Disposition' fields. + + :param header_parts: + A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format + as `k1="v1"; k2="v2"; ...`. + """ + iterable: typing.Iterable[tuple[str, _TYPE_FIELD_VALUE | None]] + + parts = [] + if isinstance(header_parts, dict): + iterable = header_parts.items() + else: + iterable = header_parts + + for name, value in iterable: + if value is not None: + parts.append(self._render_part(name, value)) + + return "; ".join(parts) + + def render_headers(self) -> str: + """ + Renders the headers for this request field. + """ + lines = [] + + sort_keys = ["Content-Disposition", "Content-Type", "Content-Location"] + for sort_key in sort_keys: + if self.headers.get(sort_key, False): + lines.append(f"{sort_key}: {self.headers[sort_key]}") + + for header_name, header_value in self.headers.items(): + if header_name not in sort_keys: + if header_value: + lines.append(f"{header_name}: {header_value}") + + lines.append("\r\n") + return "\r\n".join(lines) + + def make_multipart( + self, + content_disposition: str | None = None, + content_type: str | None = None, + content_location: str | None = None, + ) -> None: + """ + Makes this request field into a multipart request field. + + This method overrides "Content-Disposition", "Content-Type" and + "Content-Location" headers to the request parameter. + + :param content_disposition: + The 'Content-Disposition' of the request body. Defaults to 'form-data' + :param content_type: + The 'Content-Type' of the request body. + :param content_location: + The 'Content-Location' of the request body. + + """ + content_disposition = (content_disposition or "form-data") + "; ".join( + [ + "", + self._render_parts( + (("name", self._name), ("filename", self._filename)) + ), + ] + ) + + self.headers["Content-Disposition"] = content_disposition + self.headers["Content-Type"] = content_type + self.headers["Content-Location"] = content_location diff --git a/billinglayer/python/urllib3/filepost.py b/billinglayer/python/urllib3/filepost.py new file mode 100644 index 0000000..1c90a21 --- /dev/null +++ b/billinglayer/python/urllib3/filepost.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +import binascii +import codecs +import os +import typing +from io import BytesIO + +from .fields import _TYPE_FIELD_VALUE_TUPLE, RequestField + +writer = codecs.lookup("utf-8")[3] + +_TYPE_FIELDS_SEQUENCE = typing.Sequence[ + typing.Union[typing.Tuple[str, _TYPE_FIELD_VALUE_TUPLE], RequestField] +] +_TYPE_FIELDS = typing.Union[ + _TYPE_FIELDS_SEQUENCE, + typing.Mapping[str, _TYPE_FIELD_VALUE_TUPLE], +] + + +def choose_boundary() -> str: + """ + Our embarrassingly-simple replacement for mimetools.choose_boundary. + """ + return binascii.hexlify(os.urandom(16)).decode() + + +def iter_field_objects(fields: _TYPE_FIELDS) -> typing.Iterable[RequestField]: + """ + Iterate over fields. + + Supports list of (k, v) tuples and dicts, and lists of + :class:`~urllib3.fields.RequestField`. + + """ + iterable: typing.Iterable[RequestField | tuple[str, _TYPE_FIELD_VALUE_TUPLE]] + + if isinstance(fields, typing.Mapping): + iterable = fields.items() + else: + iterable = fields + + for field in iterable: + if isinstance(field, RequestField): + yield field + else: + yield RequestField.from_tuples(*field) + + +def encode_multipart_formdata( + fields: _TYPE_FIELDS, boundary: str | None = None +) -> tuple[bytes, str]: + """ + Encode a dictionary of ``fields`` using the multipart/form-data MIME format. + + :param fields: + Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). + Values are processed by :func:`urllib3.fields.RequestField.from_tuples`. + + :param boundary: + If not specified, then a random boundary will be generated using + :func:`urllib3.filepost.choose_boundary`. + """ + body = BytesIO() + if boundary is None: + boundary = choose_boundary() + + for field in iter_field_objects(fields): + body.write(f"--{boundary}\r\n".encode("latin-1")) + + writer(body).write(field.render_headers()) + data = field.data + + if isinstance(data, int): + data = str(data) # Backwards compatibility + + if isinstance(data, str): + writer(body).write(data) + else: + body.write(data) + + body.write(b"\r\n") + + body.write(f"--{boundary}--\r\n".encode("latin-1")) + + content_type = f"multipart/form-data; boundary={boundary}" + + return body.getvalue(), content_type diff --git a/billinglayer/python/urllib3/poolmanager.py b/billinglayer/python/urllib3/poolmanager.py new file mode 100644 index 0000000..02b2f62 --- /dev/null +++ b/billinglayer/python/urllib3/poolmanager.py @@ -0,0 +1,634 @@ +from __future__ import annotations + +import functools +import logging +import typing +import warnings +from types import TracebackType +from urllib.parse import urljoin + +from ._collections import RecentlyUsedContainer +from ._request_methods import RequestMethods +from .connection import ProxyConfig +from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, port_by_scheme +from .exceptions import ( + LocationValueError, + MaxRetryError, + ProxySchemeUnknown, + URLSchemeUnknown, +) +from .response import BaseHTTPResponse +from .util.connection import _TYPE_SOCKET_OPTIONS +from .util.proxy import connection_requires_http_tunnel +from .util.retry import Retry +from .util.timeout import Timeout +from .util.url import Url, parse_url + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Literal + +__all__ = ["PoolManager", "ProxyManager", "proxy_from_url"] + + +log = logging.getLogger(__name__) + +SSL_KEYWORDS = ( + "key_file", + "cert_file", + "cert_reqs", + "ca_certs", + "ssl_version", + "ssl_minimum_version", + "ssl_maximum_version", + "ca_cert_dir", + "ssl_context", + "key_password", + "server_hostname", +) +# Default value for `blocksize` - a new parameter introduced to +# http.client.HTTPConnection & http.client.HTTPSConnection in Python 3.7 +_DEFAULT_BLOCKSIZE = 16384 + +_SelfT = typing.TypeVar("_SelfT") + + +class PoolKey(typing.NamedTuple): + """ + All known keyword arguments that could be provided to the pool manager, its + pools, or the underlying connections. + + All custom key schemes should include the fields in this key at a minimum. + """ + + key_scheme: str + key_host: str + key_port: int | None + key_timeout: Timeout | float | int | None + key_retries: Retry | bool | int | None + key_block: bool | None + key_source_address: tuple[str, int] | None + key_key_file: str | None + key_key_password: str | None + key_cert_file: str | None + key_cert_reqs: str | None + key_ca_certs: str | None + key_ssl_version: int | str | None + key_ssl_minimum_version: ssl.TLSVersion | None + key_ssl_maximum_version: ssl.TLSVersion | None + key_ca_cert_dir: str | None + key_ssl_context: ssl.SSLContext | None + key_maxsize: int | None + key_headers: frozenset[tuple[str, str]] | None + key__proxy: Url | None + key__proxy_headers: frozenset[tuple[str, str]] | None + key__proxy_config: ProxyConfig | None + key_socket_options: _TYPE_SOCKET_OPTIONS | None + key__socks_options: frozenset[tuple[str, str]] | None + key_assert_hostname: bool | str | None + key_assert_fingerprint: str | None + key_server_hostname: str | None + key_blocksize: int | None + + +def _default_key_normalizer( + key_class: type[PoolKey], request_context: dict[str, typing.Any] +) -> PoolKey: + """ + Create a pool key out of a request context dictionary. + + According to RFC 3986, both the scheme and host are case-insensitive. + Therefore, this function normalizes both before constructing the pool + key for an HTTPS request. If you wish to change this behaviour, provide + alternate callables to ``key_fn_by_scheme``. + + :param key_class: + The class to use when constructing the key. This should be a namedtuple + with the ``scheme`` and ``host`` keys at a minimum. + :type key_class: namedtuple + :param request_context: + A dictionary-like object that contain the context for a request. + :type request_context: dict + + :return: A namedtuple that can be used as a connection pool key. + :rtype: PoolKey + """ + # Since we mutate the dictionary, make a copy first + context = request_context.copy() + context["scheme"] = context["scheme"].lower() + context["host"] = context["host"].lower() + + # These are both dictionaries and need to be transformed into frozensets + for key in ("headers", "_proxy_headers", "_socks_options"): + if key in context and context[key] is not None: + context[key] = frozenset(context[key].items()) + + # The socket_options key may be a list and needs to be transformed into a + # tuple. + socket_opts = context.get("socket_options") + if socket_opts is not None: + context["socket_options"] = tuple(socket_opts) + + # Map the kwargs to the names in the namedtuple - this is necessary since + # namedtuples can't have fields starting with '_'. + for key in list(context.keys()): + context["key_" + key] = context.pop(key) + + # Default to ``None`` for keys missing from the context + for field in key_class._fields: + if field not in context: + context[field] = None + + # Default key_blocksize to _DEFAULT_BLOCKSIZE if missing from the context + if context.get("key_blocksize") is None: + context["key_blocksize"] = _DEFAULT_BLOCKSIZE + + return key_class(**context) + + +#: A dictionary that maps a scheme to a callable that creates a pool key. +#: This can be used to alter the way pool keys are constructed, if desired. +#: Each PoolManager makes a copy of this dictionary so they can be configured +#: globally here, or individually on the instance. +key_fn_by_scheme = { + "http": functools.partial(_default_key_normalizer, PoolKey), + "https": functools.partial(_default_key_normalizer, PoolKey), +} + +pool_classes_by_scheme = {"http": HTTPConnectionPool, "https": HTTPSConnectionPool} + + +class PoolManager(RequestMethods): + """ + Allows for arbitrary requests while transparently keeping track of + necessary connection pools for you. + + :param num_pools: + Number of connection pools to cache before discarding the least + recently used pool. + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + + :param \\**connection_pool_kw: + Additional parameters are used to create fresh + :class:`urllib3.connectionpool.ConnectionPool` instances. + + Example: + + .. code-block:: python + + import urllib3 + + http = urllib3.PoolManager(num_pools=2) + + resp1 = http.request("GET", "https://google.com/") + resp2 = http.request("GET", "https://google.com/mail") + resp3 = http.request("GET", "https://yahoo.com/") + + print(len(http.pools)) + # 2 + + """ + + proxy: Url | None = None + proxy_config: ProxyConfig | None = None + + def __init__( + self, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + **connection_pool_kw: typing.Any, + ) -> None: + super().__init__(headers) + self.connection_pool_kw = connection_pool_kw + + self.pools: RecentlyUsedContainer[PoolKey, HTTPConnectionPool] + self.pools = RecentlyUsedContainer(num_pools) + + # Locally set the pool classes and keys so other PoolManagers can + # override them. + self.pool_classes_by_scheme = pool_classes_by_scheme + self.key_fn_by_scheme = key_fn_by_scheme.copy() + + def __enter__(self: _SelfT) -> _SelfT: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> Literal[False]: + self.clear() + # Return False to re-raise any potential exceptions + return False + + def _new_pool( + self, + scheme: str, + host: str, + port: int, + request_context: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + """ + Create a new :class:`urllib3.connectionpool.ConnectionPool` based on host, port, scheme, and + any additional pool keyword arguments. + + If ``request_context`` is provided, it is provided as keyword arguments + to the pool class used. This method is used to actually create the + connection pools handed out by :meth:`connection_from_url` and + companion methods. It is intended to be overridden for customization. + """ + pool_cls: type[HTTPConnectionPool] = self.pool_classes_by_scheme[scheme] + if request_context is None: + request_context = self.connection_pool_kw.copy() + + # Default blocksize to _DEFAULT_BLOCKSIZE if missing or explicitly + # set to 'None' in the request_context. + if request_context.get("blocksize") is None: + request_context["blocksize"] = _DEFAULT_BLOCKSIZE + + # Although the context has everything necessary to create the pool, + # this function has historically only used the scheme, host, and port + # in the positional args. When an API change is acceptable these can + # be removed. + for key in ("scheme", "host", "port"): + request_context.pop(key, None) + + if scheme == "http": + for kw in SSL_KEYWORDS: + request_context.pop(kw, None) + + return pool_cls(host, port, **request_context) + + def clear(self) -> None: + """ + Empty our store of pools and direct them all to close. + + This will not affect in-flight connections, but they will not be + re-used after completion. + """ + self.pools.clear() + + def connection_from_host( + self, + host: str | None, + port: int | None = None, + scheme: str | None = "http", + pool_kwargs: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme. + + If ``port`` isn't given, it will be derived from the ``scheme`` using + ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is + provided, it is merged with the instance's ``connection_pool_kw`` + variable and used to create the new connection pool, if one is + needed. + """ + + if not host: + raise LocationValueError("No host specified.") + + request_context = self._merge_pool_kwargs(pool_kwargs) + request_context["scheme"] = scheme or "http" + if not port: + port = port_by_scheme.get(request_context["scheme"].lower(), 80) + request_context["port"] = port + request_context["host"] = host + + return self.connection_from_context(request_context) + + def connection_from_context( + self, request_context: dict[str, typing.Any] + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. + + ``request_context`` must at least contain the ``scheme`` key and its + value must be a key in ``key_fn_by_scheme`` instance variable. + """ + if "strict" in request_context: + warnings.warn( + "The 'strict' parameter is no longer needed on Python 3+. " + "This will raise an error in urllib3 v2.1.0.", + DeprecationWarning, + ) + request_context.pop("strict") + + scheme = request_context["scheme"].lower() + pool_key_constructor = self.key_fn_by_scheme.get(scheme) + if not pool_key_constructor: + raise URLSchemeUnknown(scheme) + pool_key = pool_key_constructor(request_context) + + return self.connection_from_pool_key(pool_key, request_context=request_context) + + def connection_from_pool_key( + self, pool_key: PoolKey, request_context: dict[str, typing.Any] + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. + + ``pool_key`` should be a namedtuple that only contains immutable + objects. At a minimum it must have the ``scheme``, ``host``, and + ``port`` fields. + """ + with self.pools.lock: + # If the scheme, host, or port doesn't match existing open + # connections, open a new ConnectionPool. + pool = self.pools.get(pool_key) + if pool: + return pool + + # Make a fresh ConnectionPool of the desired type + scheme = request_context["scheme"] + host = request_context["host"] + port = request_context["port"] + pool = self._new_pool(scheme, host, port, request_context=request_context) + self.pools[pool_key] = pool + + return pool + + def connection_from_url( + self, url: str, pool_kwargs: dict[str, typing.Any] | None = None + ) -> HTTPConnectionPool: + """ + Similar to :func:`urllib3.connectionpool.connection_from_url`. + + If ``pool_kwargs`` is not provided and a new pool needs to be + constructed, ``self.connection_pool_kw`` is used to initialize + the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` + is provided, it is used instead. Note that if a new pool does not + need to be created for the request, the provided ``pool_kwargs`` are + not used. + """ + u = parse_url(url) + return self.connection_from_host( + u.host, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs + ) + + def _merge_pool_kwargs( + self, override: dict[str, typing.Any] | None + ) -> dict[str, typing.Any]: + """ + Merge a dictionary of override values for self.connection_pool_kw. + + This does not modify self.connection_pool_kw and returns a new dict. + Any keys in the override dictionary with a value of ``None`` are + removed from the merged dictionary. + """ + base_pool_kwargs = self.connection_pool_kw.copy() + if override: + for key, value in override.items(): + if value is None: + try: + del base_pool_kwargs[key] + except KeyError: + pass + else: + base_pool_kwargs[key] = value + return base_pool_kwargs + + def _proxy_requires_url_absolute_form(self, parsed_url: Url) -> bool: + """ + Indicates if the proxy requires the complete destination URL in the + request. Normally this is only needed when not using an HTTP CONNECT + tunnel. + """ + if self.proxy is None: + return False + + return not connection_requires_http_tunnel( + self.proxy, self.proxy_config, parsed_url.scheme + ) + + def urlopen( # type: ignore[override] + self, method: str, url: str, redirect: bool = True, **kw: typing.Any + ) -> BaseHTTPResponse: + """ + Same as :meth:`urllib3.HTTPConnectionPool.urlopen` + with custom cross-host redirect logic and only sends the request-uri + portion of the ``url``. + + The given ``url`` parameter must be absolute, such that an appropriate + :class:`urllib3.connectionpool.ConnectionPool` can be chosen for it. + """ + u = parse_url(url) + + if u.scheme is None: + warnings.warn( + "URLs without a scheme (ie 'https://') are deprecated and will raise an error " + "in a future version of urllib3. To avoid this DeprecationWarning ensure all URLs " + "start with 'https://' or 'http://'. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2920", + category=DeprecationWarning, + stacklevel=2, + ) + + conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme) + + kw["assert_same_host"] = False + kw["redirect"] = False + + if "headers" not in kw: + kw["headers"] = self.headers + + if self._proxy_requires_url_absolute_form(u): + response = conn.urlopen(method, url, **kw) + else: + response = conn.urlopen(method, u.request_uri, **kw) + + redirect_location = redirect and response.get_redirect_location() + if not redirect_location: + return response + + # Support relative URLs for redirecting. + redirect_location = urljoin(url, redirect_location) + + # RFC 7231, Section 6.4.4 + if response.status == 303: + method = "GET" + + retries = kw.get("retries") + if not isinstance(retries, Retry): + retries = Retry.from_int(retries, redirect=redirect) + + # Strip headers marked as unsafe to forward to the redirected location. + # Check remove_headers_on_redirect to avoid a potential network call within + # conn.is_same_host() which may use socket.gethostbyname() in the future. + if retries.remove_headers_on_redirect and not conn.is_same_host( + redirect_location + ): + new_headers = kw["headers"].copy() + for header in kw["headers"]: + if header.lower() in retries.remove_headers_on_redirect: + new_headers.pop(header, None) + kw["headers"] = new_headers + + try: + retries = retries.increment(method, url, response=response, _pool=conn) + except MaxRetryError: + if retries.raise_on_redirect: + response.drain_conn() + raise + return response + + kw["retries"] = retries + kw["redirect"] = redirect + + log.info("Redirecting %s -> %s", url, redirect_location) + + response.drain_conn() + return self.urlopen(method, redirect_location, **kw) + + +class ProxyManager(PoolManager): + """ + Behaves just like :class:`PoolManager`, but sends all requests through + the defined proxy, using the CONNECT method for HTTPS URLs. + + :param proxy_url: + The URL of the proxy to be used. + + :param proxy_headers: + A dictionary containing headers that will be sent to the proxy. In case + of HTTP they are being sent with each request, while in the + HTTPS/CONNECT case they are sent only once. Could be used for proxy + authentication. + + :param proxy_ssl_context: + The proxy SSL context is used to establish the TLS connection to the + proxy when using HTTPS proxies. + + :param use_forwarding_for_https: + (Defaults to False) If set to True will forward requests to the HTTPS + proxy to be made on behalf of the client instead of creating a TLS + tunnel via the CONNECT method. **Enabling this flag means that request + and response headers and content will be visible from the HTTPS proxy** + whereas tunneling keeps request and response headers and content + private. IP address, target hostname, SNI, and port are always visible + to an HTTPS proxy even when this flag is disabled. + + :param proxy_assert_hostname: + The hostname of the certificate to verify against. + + :param proxy_assert_fingerprint: + The fingerprint of the certificate to verify against. + + Example: + + .. code-block:: python + + import urllib3 + + proxy = urllib3.ProxyManager("https://localhost:3128/") + + resp1 = proxy.request("GET", "https://google.com/") + resp2 = proxy.request("GET", "https://httpbin.org/") + + print(len(proxy.pools)) + # 1 + + resp3 = proxy.request("GET", "https://httpbin.org/") + resp4 = proxy.request("GET", "https://twitter.com/") + + print(len(proxy.pools)) + # 3 + + """ + + def __init__( + self, + proxy_url: str, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + proxy_headers: typing.Mapping[str, str] | None = None, + proxy_ssl_context: ssl.SSLContext | None = None, + use_forwarding_for_https: bool = False, + proxy_assert_hostname: None | str | Literal[False] = None, + proxy_assert_fingerprint: str | None = None, + **connection_pool_kw: typing.Any, + ) -> None: + if isinstance(proxy_url, HTTPConnectionPool): + str_proxy_url = f"{proxy_url.scheme}://{proxy_url.host}:{proxy_url.port}" + else: + str_proxy_url = proxy_url + proxy = parse_url(str_proxy_url) + + if proxy.scheme not in ("http", "https"): + raise ProxySchemeUnknown(proxy.scheme) + + if not proxy.port: + port = port_by_scheme.get(proxy.scheme, 80) + proxy = proxy._replace(port=port) + + self.proxy = proxy + self.proxy_headers = proxy_headers or {} + self.proxy_ssl_context = proxy_ssl_context + self.proxy_config = ProxyConfig( + proxy_ssl_context, + use_forwarding_for_https, + proxy_assert_hostname, + proxy_assert_fingerprint, + ) + + connection_pool_kw["_proxy"] = self.proxy + connection_pool_kw["_proxy_headers"] = self.proxy_headers + connection_pool_kw["_proxy_config"] = self.proxy_config + + super().__init__(num_pools, headers, **connection_pool_kw) + + def connection_from_host( + self, + host: str | None, + port: int | None = None, + scheme: str | None = "http", + pool_kwargs: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + if scheme == "https": + return super().connection_from_host( + host, port, scheme, pool_kwargs=pool_kwargs + ) + + return super().connection_from_host( + self.proxy.host, self.proxy.port, self.proxy.scheme, pool_kwargs=pool_kwargs # type: ignore[union-attr] + ) + + def _set_proxy_headers( + self, url: str, headers: typing.Mapping[str, str] | None = None + ) -> typing.Mapping[str, str]: + """ + Sets headers needed by proxies: specifically, the Accept and Host + headers. Only sets headers not provided by the user. + """ + headers_ = {"Accept": "*/*"} + + netloc = parse_url(url).netloc + if netloc: + headers_["Host"] = netloc + + if headers: + headers_.update(headers) + return headers_ + + def urlopen( # type: ignore[override] + self, method: str, url: str, redirect: bool = True, **kw: typing.Any + ) -> BaseHTTPResponse: + "Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute." + u = parse_url(url) + if not connection_requires_http_tunnel(self.proxy, self.proxy_config, u.scheme): + # For connections using HTTP CONNECT, httplib sets the necessary + # headers on the CONNECT to the proxy. If we're not using CONNECT, + # we'll definitely need to set 'Host' at the very least. + headers = kw.get("headers", self.headers) + kw["headers"] = self._set_proxy_headers(url, headers) + + return super().urlopen(method, url, redirect=redirect, **kw) + + +def proxy_from_url(url: str, **kw: typing.Any) -> ProxyManager: + return ProxyManager(proxy_url=url, **kw) diff --git a/billinglayer/python/urllib3/py.typed b/billinglayer/python/urllib3/py.typed new file mode 100644 index 0000000..5f3ea3d --- /dev/null +++ b/billinglayer/python/urllib3/py.typed @@ -0,0 +1,2 @@ +# Instruct type checkers to look for inline type annotations in this package. +# See PEP 561. diff --git a/billinglayer/python/urllib3/response.py b/billinglayer/python/urllib3/response.py new file mode 100644 index 0000000..50e4d88 --- /dev/null +++ b/billinglayer/python/urllib3/response.py @@ -0,0 +1,1136 @@ +from __future__ import annotations + +import collections +import io +import json as _json +import logging +import re +import sys +import typing +import warnings +import zlib +from contextlib import contextmanager +from http.client import HTTPMessage as _HttplibHTTPMessage +from http.client import HTTPResponse as _HttplibHTTPResponse +from socket import timeout as SocketTimeout + +try: + try: + import brotlicffi as brotli # type: ignore[import] + except ImportError: + import brotli # type: ignore[import] +except ImportError: + brotli = None + +try: + import zstandard as zstd # type: ignore[import] + + # The package 'zstandard' added the 'eof' property starting + # in v0.18.0 which we require to ensure a complete and + # valid zstd stream was fed into the ZstdDecoder. + # See: https://github.com/urllib3/urllib3/pull/2624 + _zstd_version = _zstd_version = tuple( + map(int, re.search(r"^([0-9]+)\.([0-9]+)", zstd.__version__).groups()) # type: ignore[union-attr] + ) + if _zstd_version < (0, 18): # Defensive: + zstd = None + +except (AttributeError, ImportError, ValueError): # Defensive: + zstd = None + +from . import util +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from .connection import BaseSSLError, HTTPConnection, HTTPException +from .exceptions import ( + BodyNotHttplibCompatible, + DecodeError, + HTTPError, + IncompleteRead, + InvalidChunkLength, + InvalidHeader, + ProtocolError, + ReadTimeoutError, + ResponseNotChunked, + SSLError, +) +from .util.response import is_fp_closed, is_response_to_head +from .util.retry import Retry + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + + from .connectionpool import HTTPConnectionPool + +log = logging.getLogger(__name__) + + +class ContentDecoder: + def decompress(self, data: bytes) -> bytes: + raise NotImplementedError() + + def flush(self) -> bytes: + raise NotImplementedError() + + +class DeflateDecoder(ContentDecoder): + def __init__(self) -> None: + self._first_try = True + self._data = b"" + self._obj = zlib.decompressobj() + + def decompress(self, data: bytes) -> bytes: + if not data: + return data + + if not self._first_try: + return self._obj.decompress(data) + + self._data += data + try: + decompressed = self._obj.decompress(data) + if decompressed: + self._first_try = False + self._data = None # type: ignore[assignment] + return decompressed + except zlib.error: + self._first_try = False + self._obj = zlib.decompressobj(-zlib.MAX_WBITS) + try: + return self.decompress(self._data) + finally: + self._data = None # type: ignore[assignment] + + def flush(self) -> bytes: + return self._obj.flush() + + +class GzipDecoderState: + FIRST_MEMBER = 0 + OTHER_MEMBERS = 1 + SWALLOW_DATA = 2 + + +class GzipDecoder(ContentDecoder): + def __init__(self) -> None: + self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) + self._state = GzipDecoderState.FIRST_MEMBER + + def decompress(self, data: bytes) -> bytes: + ret = bytearray() + if self._state == GzipDecoderState.SWALLOW_DATA or not data: + return bytes(ret) + while True: + try: + ret += self._obj.decompress(data) + except zlib.error: + previous_state = self._state + # Ignore data after the first error + self._state = GzipDecoderState.SWALLOW_DATA + if previous_state == GzipDecoderState.OTHER_MEMBERS: + # Allow trailing garbage acceptable in other gzip clients + return bytes(ret) + raise + data = self._obj.unused_data + if not data: + return bytes(ret) + self._state = GzipDecoderState.OTHER_MEMBERS + self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) + + def flush(self) -> bytes: + return self._obj.flush() + + +if brotli is not None: + + class BrotliDecoder(ContentDecoder): + # Supports both 'brotlipy' and 'Brotli' packages + # since they share an import name. The top branches + # are for 'brotlipy' and bottom branches for 'Brotli' + def __init__(self) -> None: + self._obj = brotli.Decompressor() + if hasattr(self._obj, "decompress"): + setattr(self, "decompress", self._obj.decompress) + else: + setattr(self, "decompress", self._obj.process) + + def flush(self) -> bytes: + if hasattr(self._obj, "flush"): + return self._obj.flush() # type: ignore[no-any-return] + return b"" + + +if zstd is not None: + + class ZstdDecoder(ContentDecoder): + def __init__(self) -> None: + self._obj = zstd.ZstdDecompressor().decompressobj() + + def decompress(self, data: bytes) -> bytes: + if not data: + return b"" + data_parts = [self._obj.decompress(data)] + while self._obj.eof and self._obj.unused_data: + unused_data = self._obj.unused_data + self._obj = zstd.ZstdDecompressor().decompressobj() + data_parts.append(self._obj.decompress(unused_data)) + return b"".join(data_parts) + + def flush(self) -> bytes: + ret = self._obj.flush() # note: this is a no-op + if not self._obj.eof: + raise DecodeError("Zstandard data is incomplete") + return ret # type: ignore[no-any-return] + + +class MultiDecoder(ContentDecoder): + """ + From RFC7231: + If one or more encodings have been applied to a representation, the + sender that applied the encodings MUST generate a Content-Encoding + header field that lists the content codings in the order in which + they were applied. + """ + + def __init__(self, modes: str) -> None: + self._decoders = [_get_decoder(m.strip()) for m in modes.split(",")] + + def flush(self) -> bytes: + return self._decoders[0].flush() + + def decompress(self, data: bytes) -> bytes: + for d in reversed(self._decoders): + data = d.decompress(data) + return data + + +def _get_decoder(mode: str) -> ContentDecoder: + if "," in mode: + return MultiDecoder(mode) + + if mode == "gzip": + return GzipDecoder() + + if brotli is not None and mode == "br": + return BrotliDecoder() + + if zstd is not None and mode == "zstd": + return ZstdDecoder() + + return DeflateDecoder() + + +class BytesQueueBuffer: + """Memory-efficient bytes buffer + + To return decoded data in read() and still follow the BufferedIOBase API, we need a + buffer to always return the correct amount of bytes. + + This buffer should be filled using calls to put() + + Our maximum memory usage is determined by the sum of the size of: + + * self.buffer, which contains the full data + * the largest chunk that we will copy in get() + + The worst case scenario is a single chunk, in which case we'll make a full copy of + the data inside get(). + """ + + def __init__(self) -> None: + self.buffer: typing.Deque[bytes] = collections.deque() + self._size: int = 0 + + def __len__(self) -> int: + return self._size + + def put(self, data: bytes) -> None: + self.buffer.append(data) + self._size += len(data) + + def get(self, n: int) -> bytes: + if n == 0: + return b"" + elif not self.buffer: + raise RuntimeError("buffer is empty") + elif n < 0: + raise ValueError("n should be > 0") + + fetched = 0 + ret = io.BytesIO() + while fetched < n: + remaining = n - fetched + chunk = self.buffer.popleft() + chunk_length = len(chunk) + if remaining < chunk_length: + left_chunk, right_chunk = chunk[:remaining], chunk[remaining:] + ret.write(left_chunk) + self.buffer.appendleft(right_chunk) + self._size -= remaining + break + else: + ret.write(chunk) + self._size -= chunk_length + fetched += chunk_length + + if not self.buffer: + break + + return ret.getvalue() + + +class BaseHTTPResponse(io.IOBase): + CONTENT_DECODERS = ["gzip", "deflate"] + if brotli is not None: + CONTENT_DECODERS += ["br"] + if zstd is not None: + CONTENT_DECODERS += ["zstd"] + REDIRECT_STATUSES = [301, 302, 303, 307, 308] + + DECODER_ERROR_CLASSES: tuple[type[Exception], ...] = (IOError, zlib.error) + if brotli is not None: + DECODER_ERROR_CLASSES += (brotli.error,) + + if zstd is not None: + DECODER_ERROR_CLASSES += (zstd.ZstdError,) + + def __init__( + self, + *, + headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, + status: int, + version: int, + reason: str | None, + decode_content: bool, + request_url: str | None, + retries: Retry | None = None, + ) -> None: + if isinstance(headers, HTTPHeaderDict): + self.headers = headers + else: + self.headers = HTTPHeaderDict(headers) # type: ignore[arg-type] + self.status = status + self.version = version + self.reason = reason + self.decode_content = decode_content + self._has_decoded_content = False + self._request_url: str | None = request_url + self.retries = retries + + self.chunked = False + tr_enc = self.headers.get("transfer-encoding", "").lower() + # Don't incur the penalty of creating a list and then discarding it + encodings = (enc.strip() for enc in tr_enc.split(",")) + if "chunked" in encodings: + self.chunked = True + + self._decoder: ContentDecoder | None = None + + def get_redirect_location(self) -> str | None | Literal[False]: + """ + Should we redirect and where to? + + :returns: Truthy redirect location string if we got a redirect status + code and valid location. ``None`` if redirect status and no + location. ``False`` if not a redirect status code. + """ + if self.status in self.REDIRECT_STATUSES: + return self.headers.get("location") + return False + + @property + def data(self) -> bytes: + raise NotImplementedError() + + def json(self) -> typing.Any: + """ + Parses the body of the HTTP response as JSON. + + To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to the decoder. + + This method can raise either `UnicodeDecodeError` or `json.JSONDecodeError`. + + Read more :ref:`here `. + """ + data = self.data.decode("utf-8") + return _json.loads(data) + + @property + def url(self) -> str | None: + raise NotImplementedError() + + @url.setter + def url(self, url: str | None) -> None: + raise NotImplementedError() + + @property + def connection(self) -> HTTPConnection | None: + raise NotImplementedError() + + @property + def retries(self) -> Retry | None: + return self._retries + + @retries.setter + def retries(self, retries: Retry | None) -> None: + # Override the request_url if retries has a redirect location. + if retries is not None and retries.history: + self.url = retries.history[-1].redirect_location + self._retries = retries + + def stream( + self, amt: int | None = 2**16, decode_content: bool | None = None + ) -> typing.Iterator[bytes]: + raise NotImplementedError() + + def read( + self, + amt: int | None = None, + decode_content: bool | None = None, + cache_content: bool = False, + ) -> bytes: + raise NotImplementedError() + + def read_chunked( + self, + amt: int | None = None, + decode_content: bool | None = None, + ) -> typing.Iterator[bytes]: + raise NotImplementedError() + + def release_conn(self) -> None: + raise NotImplementedError() + + def drain_conn(self) -> None: + raise NotImplementedError() + + def close(self) -> None: + raise NotImplementedError() + + def _init_decoder(self) -> None: + """ + Set-up the _decoder attribute if necessary. + """ + # Note: content-encoding value should be case-insensitive, per RFC 7230 + # Section 3.2 + content_encoding = self.headers.get("content-encoding", "").lower() + if self._decoder is None: + if content_encoding in self.CONTENT_DECODERS: + self._decoder = _get_decoder(content_encoding) + elif "," in content_encoding: + encodings = [ + e.strip() + for e in content_encoding.split(",") + if e.strip() in self.CONTENT_DECODERS + ] + if encodings: + self._decoder = _get_decoder(content_encoding) + + def _decode( + self, data: bytes, decode_content: bool | None, flush_decoder: bool + ) -> bytes: + """ + Decode the data passed in and potentially flush the decoder. + """ + if not decode_content: + if self._has_decoded_content: + raise RuntimeError( + "Calling read(decode_content=False) is not supported after " + "read(decode_content=True) was called." + ) + return data + + try: + if self._decoder: + data = self._decoder.decompress(data) + self._has_decoded_content = True + except self.DECODER_ERROR_CLASSES as e: + content_encoding = self.headers.get("content-encoding", "").lower() + raise DecodeError( + "Received response with content-encoding: %s, but " + "failed to decode it." % content_encoding, + e, + ) from e + if flush_decoder: + data += self._flush_decoder() + + return data + + def _flush_decoder(self) -> bytes: + """ + Flushes the decoder. Should only be called if the decoder is actually + being used. + """ + if self._decoder: + return self._decoder.decompress(b"") + self._decoder.flush() + return b"" + + # Compatibility methods for `io` module + def readinto(self, b: bytearray) -> int: + temp = self.read(len(b)) + if len(temp) == 0: + return 0 + else: + b[: len(temp)] = temp + return len(temp) + + # Compatibility methods for http.client.HTTPResponse + def getheaders(self) -> HTTPHeaderDict: + warnings.warn( + "HTTPResponse.getheaders() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.", + category=DeprecationWarning, + stacklevel=2, + ) + return self.headers + + def getheader(self, name: str, default: str | None = None) -> str | None: + warnings.warn( + "HTTPResponse.getheader() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).", + category=DeprecationWarning, + stacklevel=2, + ) + return self.headers.get(name, default) + + # Compatibility method for http.cookiejar + def info(self) -> HTTPHeaderDict: + return self.headers + + def geturl(self) -> str | None: + return self.url + + +class HTTPResponse(BaseHTTPResponse): + """ + HTTP Response container. + + Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is + loaded and decoded on-demand when the ``data`` property is accessed. This + class is also compatible with the Python standard library's :mod:`io` + module, and can hence be treated as a readable object in the context of that + framework. + + Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`: + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param original_response: + When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse` + object, it's convenient to include the original for debug purposes. It's + otherwise unused. + + :param retries: + The retries contains the last :class:`~urllib3.util.retry.Retry` that + was used during the request. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + + def __init__( + self, + body: _TYPE_BODY = "", + headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, + status: int = 0, + version: int = 0, + reason: str | None = None, + preload_content: bool = True, + decode_content: bool = True, + original_response: _HttplibHTTPResponse | None = None, + pool: HTTPConnectionPool | None = None, + connection: HTTPConnection | None = None, + msg: _HttplibHTTPMessage | None = None, + retries: Retry | None = None, + enforce_content_length: bool = True, + request_method: str | None = None, + request_url: str | None = None, + auto_close: bool = True, + ) -> None: + super().__init__( + headers=headers, + status=status, + version=version, + reason=reason, + decode_content=decode_content, + request_url=request_url, + retries=retries, + ) + + self.enforce_content_length = enforce_content_length + self.auto_close = auto_close + + self._body = None + self._fp: _HttplibHTTPResponse | None = None + self._original_response = original_response + self._fp_bytes_read = 0 + self.msg = msg + + if body and isinstance(body, (str, bytes)): + self._body = body + + self._pool = pool + self._connection = connection + + if hasattr(body, "read"): + self._fp = body # type: ignore[assignment] + + # Are we using the chunked-style of transfer encoding? + self.chunk_left: int | None = None + + # Determine length of response + self.length_remaining = self._init_length(request_method) + + # Used to return the correct amount of bytes for partial read()s + self._decoded_buffer = BytesQueueBuffer() + + # If requested, preload the body. + if preload_content and not self._body: + self._body = self.read(decode_content=decode_content) + + def release_conn(self) -> None: + if not self._pool or not self._connection: + return None + + self._pool._put_conn(self._connection) + self._connection = None + + def drain_conn(self) -> None: + """ + Read and discard any remaining HTTP response data in the response connection. + + Unread data in the HTTPResponse connection blocks the connection from being released back to the pool. + """ + try: + self.read() + except (HTTPError, OSError, BaseSSLError, HTTPException): + pass + + @property + def data(self) -> bytes: + # For backwards-compat with earlier urllib3 0.4 and earlier. + if self._body: + return self._body # type: ignore[return-value] + + if self._fp: + return self.read(cache_content=True) + + return None # type: ignore[return-value] + + @property + def connection(self) -> HTTPConnection | None: + return self._connection + + def isclosed(self) -> bool: + return is_fp_closed(self._fp) + + def tell(self) -> int: + """ + Obtain the number of bytes pulled over the wire so far. May differ from + the amount of content returned by :meth:``urllib3.response.HTTPResponse.read`` + if bytes are encoded on the wire (e.g, compressed). + """ + return self._fp_bytes_read + + def _init_length(self, request_method: str | None) -> int | None: + """ + Set initial length value for Response content if available. + """ + length: int | None + content_length: str | None = self.headers.get("content-length") + + if content_length is not None: + if self.chunked: + # This Response will fail with an IncompleteRead if it can't be + # received as chunked. This method falls back to attempt reading + # the response before raising an exception. + log.warning( + "Received response with both Content-Length and " + "Transfer-Encoding set. This is expressly forbidden " + "by RFC 7230 sec 3.3.2. Ignoring Content-Length and " + "attempting to process response as Transfer-Encoding: " + "chunked." + ) + return None + + try: + # RFC 7230 section 3.3.2 specifies multiple content lengths can + # be sent in a single Content-Length header + # (e.g. Content-Length: 42, 42). This line ensures the values + # are all valid ints and that as long as the `set` length is 1, + # all values are the same. Otherwise, the header is invalid. + lengths = {int(val) for val in content_length.split(",")} + if len(lengths) > 1: + raise InvalidHeader( + "Content-Length contained multiple " + "unmatching values (%s)" % content_length + ) + length = lengths.pop() + except ValueError: + length = None + else: + if length < 0: + length = None + + else: # if content_length is None + length = None + + # Convert status to int for comparison + # In some cases, httplib returns a status of "_UNKNOWN" + try: + status = int(self.status) + except ValueError: + status = 0 + + # Check for responses that shouldn't include a body + if status in (204, 304) or 100 <= status < 200 or request_method == "HEAD": + length = 0 + + return length + + @contextmanager + def _error_catcher(self) -> typing.Generator[None, None, None]: + """ + Catch low-level python exceptions, instead re-raising urllib3 + variants, so that low-level exceptions are not leaked in the + high-level api. + + On exit, release the connection back to the pool. + """ + clean_exit = False + + try: + try: + yield + + except SocketTimeout as e: + # FIXME: Ideally we'd like to include the url in the ReadTimeoutError but + # there is yet no clean way to get at it from this context. + raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] + + except BaseSSLError as e: + # FIXME: Is there a better way to differentiate between SSLErrors? + if "read operation timed out" not in str(e): + # SSL errors related to framing/MAC get wrapped and reraised here + raise SSLError(e) from e + + raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] + + except (HTTPException, OSError) as e: + # This includes IncompleteRead. + raise ProtocolError(f"Connection broken: {e!r}", e) from e + + # If no exception is thrown, we should avoid cleaning up + # unnecessarily. + clean_exit = True + finally: + # If we didn't terminate cleanly, we need to throw away our + # connection. + if not clean_exit: + # The response may not be closed but we're not going to use it + # anymore so close it now to ensure that the connection is + # released back to the pool. + if self._original_response: + self._original_response.close() + + # Closing the response may not actually be sufficient to close + # everything, so if we have a hold of the connection close that + # too. + if self._connection: + self._connection.close() + + # If we hold the original response but it's closed now, we should + # return the connection back to the pool. + if self._original_response and self._original_response.isclosed(): + self.release_conn() + + def _fp_read(self, amt: int | None = None) -> bytes: + """ + Read a response with the thought that reading the number of bytes + larger than can fit in a 32-bit int at a time via SSL in some + known cases leads to an overflow error that has to be prevented + if `amt` or `self.length_remaining` indicate that a problem may + happen. + + The known cases: + * 3.8 <= CPython < 3.9.7 because of a bug + https://github.com/urllib3/urllib3/issues/2513#issuecomment-1152559900. + * urllib3 injected with pyOpenSSL-backed SSL-support. + * CPython < 3.10 only when `amt` does not fit 32-bit int. + """ + assert self._fp + c_int_max = 2**31 - 1 + if ( + ( + (amt and amt > c_int_max) + or (self.length_remaining and self.length_remaining > c_int_max) + ) + and not util.IS_SECURETRANSPORT + and (util.IS_PYOPENSSL or sys.version_info < (3, 10)) + ): + buffer = io.BytesIO() + # Besides `max_chunk_amt` being a maximum chunk size, it + # affects memory overhead of reading a response by this + # method in CPython. + # `c_int_max` equal to 2 GiB - 1 byte is the actual maximum + # chunk size that does not lead to an overflow error, but + # 256 MiB is a compromise. + max_chunk_amt = 2**28 + while amt is None or amt != 0: + if amt is not None: + chunk_amt = min(amt, max_chunk_amt) + amt -= chunk_amt + else: + chunk_amt = max_chunk_amt + data = self._fp.read(chunk_amt) + if not data: + break + buffer.write(data) + del data # to reduce peak memory usage by `max_chunk_amt`. + return buffer.getvalue() + else: + # StringIO doesn't like amt=None + return self._fp.read(amt) if amt is not None else self._fp.read() + + def _raw_read( + self, + amt: int | None = None, + ) -> bytes: + """ + Reads `amt` of bytes from the socket. + """ + if self._fp is None: + return None # type: ignore[return-value] + + fp_closed = getattr(self._fp, "closed", False) + + with self._error_catcher(): + data = self._fp_read(amt) if not fp_closed else b"" + if amt is not None and amt != 0 and not data: + # Platform-specific: Buggy versions of Python. + # Close the connection when no data is returned + # + # This is redundant to what httplib/http.client _should_ + # already do. However, versions of python released before + # December 15, 2012 (http://bugs.python.org/issue16298) do + # not properly close the connection in all cases. There is + # no harm in redundantly calling close. + self._fp.close() + if ( + self.enforce_content_length + and self.length_remaining is not None + and self.length_remaining != 0 + ): + # This is an edge case that httplib failed to cover due + # to concerns of backward compatibility. We're + # addressing it here to make sure IncompleteRead is + # raised during streaming, so all calls with incorrect + # Content-Length are caught. + raise IncompleteRead(self._fp_bytes_read, self.length_remaining) + + if data: + self._fp_bytes_read += len(data) + if self.length_remaining is not None: + self.length_remaining -= len(data) + return data + + def read( + self, + amt: int | None = None, + decode_content: bool | None = None, + cache_content: bool = False, + ) -> bytes: + """ + Similar to :meth:`http.client.HTTPResponse.read`, but with two additional + parameters: ``decode_content`` and ``cache_content``. + + :param amt: + How much of the content to read. If specified, caching is skipped + because it doesn't make sense to cache partial content as the full + response. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param cache_content: + If True, will save the returned data such that the same result is + returned despite of the state of the underlying file object. This + is useful if you want the ``.data`` property to continue working + after having ``.read()`` the file object. (Overridden if ``amt`` is + set.) + """ + self._init_decoder() + if decode_content is None: + decode_content = self.decode_content + + if amt is not None: + cache_content = False + + if len(self._decoded_buffer) >= amt: + return self._decoded_buffer.get(amt) + + data = self._raw_read(amt) + + flush_decoder = False + if amt is None: + flush_decoder = True + elif amt != 0 and not data: + flush_decoder = True + + if not data and len(self._decoded_buffer) == 0: + return data + + if amt is None: + data = self._decode(data, decode_content, flush_decoder) + if cache_content: + self._body = data + else: + # do not waste memory on buffer when not decoding + if not decode_content: + if self._has_decoded_content: + raise RuntimeError( + "Calling read(decode_content=False) is not supported after " + "read(decode_content=True) was called." + ) + return data + + decoded_data = self._decode(data, decode_content, flush_decoder) + self._decoded_buffer.put(decoded_data) + + while len(self._decoded_buffer) < amt and data: + # TODO make sure to initially read enough data to get past the headers + # For example, the GZ file header takes 10 bytes, we don't want to read + # it one byte at a time + data = self._raw_read(amt) + decoded_data = self._decode(data, decode_content, flush_decoder) + self._decoded_buffer.put(decoded_data) + data = self._decoded_buffer.get(amt) + + return data + + def stream( + self, amt: int | None = 2**16, decode_content: bool | None = None + ) -> typing.Generator[bytes, None, None]: + """ + A generator wrapper for the read() method. A call will block until + ``amt`` bytes have been read from the connection or until the + connection is closed. + + :param amt: + How much of the content to read. The generator will return up to + much data per iteration, but may return less. This is particularly + likely when using compressed data. However, the empty string will + never be returned. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + if self.chunked and self.supports_chunked_reads(): + yield from self.read_chunked(amt, decode_content=decode_content) + else: + while not is_fp_closed(self._fp) or len(self._decoded_buffer) > 0: + data = self.read(amt=amt, decode_content=decode_content) + + if data: + yield data + + # Overrides from io.IOBase + def readable(self) -> bool: + return True + + def close(self) -> None: + if not self.closed and self._fp: + self._fp.close() + + if self._connection: + self._connection.close() + + if not self.auto_close: + io.IOBase.close(self) + + @property + def closed(self) -> bool: + if not self.auto_close: + return io.IOBase.closed.__get__(self) # type: ignore[no-any-return] + elif self._fp is None: + return True + elif hasattr(self._fp, "isclosed"): + return self._fp.isclosed() + elif hasattr(self._fp, "closed"): + return self._fp.closed + else: + return True + + def fileno(self) -> int: + if self._fp is None: + raise OSError("HTTPResponse has no file to get a fileno from") + elif hasattr(self._fp, "fileno"): + return self._fp.fileno() + else: + raise OSError( + "The file-like object this HTTPResponse is wrapped " + "around has no file descriptor" + ) + + def flush(self) -> None: + if ( + self._fp is not None + and hasattr(self._fp, "flush") + and not getattr(self._fp, "closed", False) + ): + return self._fp.flush() + + def supports_chunked_reads(self) -> bool: + """ + Checks if the underlying file-like object looks like a + :class:`http.client.HTTPResponse` object. We do this by testing for + the fp attribute. If it is present we assume it returns raw chunks as + processed by read_chunked(). + """ + return hasattr(self._fp, "fp") + + def _update_chunk_length(self) -> None: + # First, we'll figure out length of a chunk and then + # we'll try to read it from socket. + if self.chunk_left is not None: + return None + line = self._fp.fp.readline() # type: ignore[union-attr] + line = line.split(b";", 1)[0] + try: + self.chunk_left = int(line, 16) + except ValueError: + # Invalid chunked protocol response, abort. + self.close() + raise InvalidChunkLength(self, line) from None + + def _handle_chunk(self, amt: int | None) -> bytes: + returned_chunk = None + if amt is None: + chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] + returned_chunk = chunk + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + elif self.chunk_left is not None and amt < self.chunk_left: + value = self._fp._safe_read(amt) # type: ignore[union-attr] + self.chunk_left = self.chunk_left - amt + returned_chunk = value + elif amt == self.chunk_left: + value = self._fp._safe_read(amt) # type: ignore[union-attr] + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + returned_chunk = value + else: # amt > self.chunk_left + returned_chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + return returned_chunk # type: ignore[no-any-return] + + def read_chunked( + self, amt: int | None = None, decode_content: bool | None = None + ) -> typing.Generator[bytes, None, None]: + """ + Similar to :meth:`HTTPResponse.read`, but with an additional + parameter: ``decode_content``. + + :param amt: + How much of the content to read. If specified, caching is skipped + because it doesn't make sense to cache partial content as the full + response. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + self._init_decoder() + # FIXME: Rewrite this method and make it a class with a better structured logic. + if not self.chunked: + raise ResponseNotChunked( + "Response is not chunked. " + "Header 'transfer-encoding: chunked' is missing." + ) + if not self.supports_chunked_reads(): + raise BodyNotHttplibCompatible( + "Body should be http.client.HTTPResponse like. " + "It should have have an fp attribute which returns raw chunks." + ) + + with self._error_catcher(): + # Don't bother reading the body of a HEAD request. + if self._original_response and is_response_to_head(self._original_response): + self._original_response.close() + return None + + # If a response is already read and closed + # then return immediately. + if self._fp.fp is None: # type: ignore[union-attr] + return None + + while True: + self._update_chunk_length() + if self.chunk_left == 0: + break + chunk = self._handle_chunk(amt) + decoded = self._decode( + chunk, decode_content=decode_content, flush_decoder=False + ) + if decoded: + yield decoded + + if decode_content: + # On CPython and PyPy, we should never need to flush the + # decoder. However, on Jython we *might* need to, so + # lets defensively do it anyway. + decoded = self._flush_decoder() + if decoded: # Platform-specific: Jython. + yield decoded + + # Chunk content ends with \r\n: discard it. + while self._fp is not None: + line = self._fp.fp.readline() + if not line: + # Some sites may not end with '\r\n'. + break + if line == b"\r\n": + break + + # We read everything; close the "file". + if self._original_response: + self._original_response.close() + + @property + def url(self) -> str | None: + """ + Returns the URL that was the source of this response. + If the request that generated this response redirected, this method + will return the final redirect location. + """ + return self._request_url + + @url.setter + def url(self, url: str) -> None: + self._request_url = url + + def __iter__(self) -> typing.Iterator[bytes]: + buffer: list[bytes] = [] + for chunk in self.stream(decode_content=True): + if b"\n" in chunk: + chunks = chunk.split(b"\n") + yield b"".join(buffer) + chunks[0] + b"\n" + for x in chunks[1:-1]: + yield x + b"\n" + if chunks[-1]: + buffer = [chunks[-1]] + else: + buffer = [] + else: + buffer.append(chunk) + if buffer: + yield b"".join(buffer) diff --git a/billinglayer/python/urllib3/util/__init__.py b/billinglayer/python/urllib3/util/__init__.py new file mode 100644 index 0000000..ff56c55 --- /dev/null +++ b/billinglayer/python/urllib3/util/__init__.py @@ -0,0 +1,44 @@ +# For backwards compatibility, provide imports that used to be here. +from __future__ import annotations + +from .connection import is_connection_dropped +from .request import SKIP_HEADER, SKIPPABLE_HEADERS, make_headers +from .response import is_fp_closed +from .retry import Retry +from .ssl_ import ( + ALPN_PROTOCOLS, + IS_PYOPENSSL, + IS_SECURETRANSPORT, + SSLContext, + assert_fingerprint, + create_urllib3_context, + resolve_cert_reqs, + resolve_ssl_version, + ssl_wrap_socket, +) +from .timeout import Timeout +from .url import Url, parse_url +from .wait import wait_for_read, wait_for_write + +__all__ = ( + "IS_PYOPENSSL", + "IS_SECURETRANSPORT", + "SSLContext", + "ALPN_PROTOCOLS", + "Retry", + "Timeout", + "Url", + "assert_fingerprint", + "create_urllib3_context", + "is_connection_dropped", + "is_fp_closed", + "parse_url", + "make_headers", + "resolve_cert_reqs", + "resolve_ssl_version", + "ssl_wrap_socket", + "wait_for_read", + "wait_for_write", + "SKIP_HEADER", + "SKIPPABLE_HEADERS", +) diff --git a/billinglayer/python/urllib3/util/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..7612e14 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/connection.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/connection.cpython-311.pyc new file mode 100644 index 0000000..f19e348 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/connection.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/proxy.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/proxy.cpython-311.pyc new file mode 100644 index 0000000..59eacf1 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/proxy.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/request.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/request.cpython-311.pyc new file mode 100644 index 0000000..479a890 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/request.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/response.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/response.cpython-311.pyc new file mode 100644 index 0000000..9b41e40 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/response.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/retry.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/retry.cpython-311.pyc new file mode 100644 index 0000000..7028678 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/retry.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/ssl_.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/ssl_.cpython-311.pyc new file mode 100644 index 0000000..8b7c5cc Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/ssl_.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc new file mode 100644 index 0000000..45dad56 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/ssltransport.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/ssltransport.cpython-311.pyc new file mode 100644 index 0000000..08d0642 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/ssltransport.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/timeout.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/timeout.cpython-311.pyc new file mode 100644 index 0000000..146bb8b Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/timeout.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/url.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/url.cpython-311.pyc new file mode 100644 index 0000000..2e13bc0 Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/url.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/util.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/util.cpython-311.pyc new file mode 100644 index 0000000..98b597c Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/util.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/__pycache__/wait.cpython-311.pyc b/billinglayer/python/urllib3/util/__pycache__/wait.cpython-311.pyc new file mode 100644 index 0000000..b324cce Binary files /dev/null and b/billinglayer/python/urllib3/util/__pycache__/wait.cpython-311.pyc differ diff --git a/billinglayer/python/urllib3/util/connection.py b/billinglayer/python/urllib3/util/connection.py new file mode 100644 index 0000000..5c7da73 --- /dev/null +++ b/billinglayer/python/urllib3/util/connection.py @@ -0,0 +1,137 @@ +from __future__ import annotations + +import socket +import typing + +from ..exceptions import LocationParseError +from .timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT + +_TYPE_SOCKET_OPTIONS = typing.Sequence[typing.Tuple[int, int, typing.Union[int, bytes]]] + +if typing.TYPE_CHECKING: + from .._base_connection import BaseHTTPConnection + + +def is_connection_dropped(conn: BaseHTTPConnection) -> bool: # Platform-specific + """ + Returns True if the connection is dropped and should be closed. + :param conn: :class:`urllib3.connection.HTTPConnection` object. + """ + return not conn.is_connected + + +# This function is copied from socket.py in the Python 2.7 standard +# library test suite. Added to its signature is only `socket_options`. +# One additional modification is that we avoid binding to IPv6 servers +# discovered in DNS if the system doesn't have IPv6 functionality. +def create_connection( + address: tuple[str, int], + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + socket_options: _TYPE_SOCKET_OPTIONS | None = None, +) -> socket.socket: + """Connect to *address* and return the socket object. + + Convenience function. Connect to *address* (a 2-tuple ``(host, + port)``) and return the socket object. Passing the optional + *timeout* parameter will set the timeout on the socket instance + before attempting to connect. If no *timeout* is supplied, the + global default timeout setting returned by :func:`socket.getdefaulttimeout` + is used. If *source_address* is set it must be a tuple of (host, port) + for the socket to bind as a source address before making the connection. + An host of '' or port 0 tells the OS to use the default. + """ + + host, port = address + if host.startswith("["): + host = host.strip("[]") + err = None + + # Using the value from allowed_gai_family() in the context of getaddrinfo lets + # us select whether to work with IPv4 DNS records, IPv6 records, or both. + # The original create_connection function always returns all records. + family = allowed_gai_family() + + try: + host.encode("idna") + except UnicodeError: + raise LocationParseError(f"'{host}', label empty or too long") from None + + for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): + af, socktype, proto, canonname, sa = res + sock = None + try: + sock = socket.socket(af, socktype, proto) + + # If provided, set socket level options before connecting. + _set_socket_options(sock, socket_options) + + if timeout is not _DEFAULT_TIMEOUT: + sock.settimeout(timeout) + if source_address: + sock.bind(source_address) + sock.connect(sa) + # Break explicitly a reference cycle + err = None + return sock + + except OSError as _: + err = _ + if sock is not None: + sock.close() + + if err is not None: + try: + raise err + finally: + # Break explicitly a reference cycle + err = None + else: + raise OSError("getaddrinfo returns an empty list") + + +def _set_socket_options( + sock: socket.socket, options: _TYPE_SOCKET_OPTIONS | None +) -> None: + if options is None: + return + + for opt in options: + sock.setsockopt(*opt) + + +def allowed_gai_family() -> socket.AddressFamily: + """This function is designed to work in the context of + getaddrinfo, where family=socket.AF_UNSPEC is the default and + will perform a DNS search for both IPv6 and IPv4 records.""" + + family = socket.AF_INET + if HAS_IPV6: + family = socket.AF_UNSPEC + return family + + +def _has_ipv6(host: str) -> bool: + """Returns True if the system can bind an IPv6 address.""" + sock = None + has_ipv6 = False + + if socket.has_ipv6: + # has_ipv6 returns true if cPython was compiled with IPv6 support. + # It does not tell us if the system has IPv6 support enabled. To + # determine that we must bind to an IPv6 address. + # https://github.com/urllib3/urllib3/pull/611 + # https://bugs.python.org/issue658327 + try: + sock = socket.socket(socket.AF_INET6) + sock.bind((host, 0)) + has_ipv6 = True + except Exception: + pass + + if sock: + sock.close() + return has_ipv6 + + +HAS_IPV6 = _has_ipv6("::1") diff --git a/billinglayer/python/urllib3/util/proxy.py b/billinglayer/python/urllib3/util/proxy.py new file mode 100644 index 0000000..908fc66 --- /dev/null +++ b/billinglayer/python/urllib3/util/proxy.py @@ -0,0 +1,43 @@ +from __future__ import annotations + +import typing + +from .url import Url + +if typing.TYPE_CHECKING: + from ..connection import ProxyConfig + + +def connection_requires_http_tunnel( + proxy_url: Url | None = None, + proxy_config: ProxyConfig | None = None, + destination_scheme: str | None = None, +) -> bool: + """ + Returns True if the connection requires an HTTP CONNECT through the proxy. + + :param URL proxy_url: + URL of the proxy. + :param ProxyConfig proxy_config: + Proxy configuration from poolmanager.py + :param str destination_scheme: + The scheme of the destination. (i.e https, http, etc) + """ + # If we're not using a proxy, no way to use a tunnel. + if proxy_url is None: + return False + + # HTTP destinations never require tunneling, we always forward. + if destination_scheme == "http": + return False + + # Support for forwarding with HTTPS proxies and HTTPS destinations. + if ( + proxy_url.scheme == "https" + and proxy_config + and proxy_config.use_forwarding_for_https + ): + return False + + # Otherwise always use a tunnel. + return True diff --git a/billinglayer/python/urllib3/util/request.py b/billinglayer/python/urllib3/util/request.py new file mode 100644 index 0000000..7d6866f --- /dev/null +++ b/billinglayer/python/urllib3/util/request.py @@ -0,0 +1,256 @@ +from __future__ import annotations + +import io +import typing +from base64 import b64encode +from enum import Enum + +from ..exceptions import UnrewindableBodyError +from .util import to_bytes + +if typing.TYPE_CHECKING: + from typing_extensions import Final + +# Pass as a value within ``headers`` to skip +# emitting some HTTP headers that are added automatically. +# The only headers that are supported are ``Accept-Encoding``, +# ``Host``, and ``User-Agent``. +SKIP_HEADER = "@@@SKIP_HEADER@@@" +SKIPPABLE_HEADERS = frozenset(["accept-encoding", "host", "user-agent"]) + +ACCEPT_ENCODING = "gzip,deflate" +try: + try: + import brotlicffi as _unused_module_brotli # type: ignore[import] # noqa: F401 + except ImportError: + import brotli as _unused_module_brotli # type: ignore[import] # noqa: F401 +except ImportError: + pass +else: + ACCEPT_ENCODING += ",br" +try: + import zstandard as _unused_module_zstd # type: ignore[import] # noqa: F401 +except ImportError: + pass +else: + ACCEPT_ENCODING += ",zstd" + + +class _TYPE_FAILEDTELL(Enum): + token = 0 + + +_FAILEDTELL: Final[_TYPE_FAILEDTELL] = _TYPE_FAILEDTELL.token + +_TYPE_BODY_POSITION = typing.Union[int, _TYPE_FAILEDTELL] + +# When sending a request with these methods we aren't expecting +# a body so don't need to set an explicit 'Content-Length: 0' +# The reason we do this in the negative instead of tracking methods +# which 'should' have a body is because unknown methods should be +# treated as if they were 'POST' which *does* expect a body. +_METHODS_NOT_EXPECTING_BODY = {"GET", "HEAD", "DELETE", "TRACE", "OPTIONS", "CONNECT"} + + +def make_headers( + keep_alive: bool | None = None, + accept_encoding: bool | list[str] | str | None = None, + user_agent: str | None = None, + basic_auth: str | None = None, + proxy_basic_auth: str | None = None, + disable_cache: bool | None = None, +) -> dict[str, str]: + """ + Shortcuts for generating request headers. + + :param keep_alive: + If ``True``, adds 'connection: keep-alive' header. + + :param accept_encoding: + Can be a boolean, list, or string. + ``True`` translates to 'gzip,deflate'. If either the ``brotli`` or + ``brotlicffi`` package is installed 'gzip,deflate,br' is used instead. + List will get joined by comma. + String will be used as provided. + + :param user_agent: + String representing the user-agent you want, such as + "python-urllib3/0.6" + + :param basic_auth: + Colon-separated username:password string for 'authorization: basic ...' + auth header. + + :param proxy_basic_auth: + Colon-separated username:password string for 'proxy-authorization: basic ...' + auth header. + + :param disable_cache: + If ``True``, adds 'cache-control: no-cache' header. + + Example: + + .. code-block:: python + + import urllib3 + + print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0")) + # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} + print(urllib3.util.make_headers(accept_encoding=True)) + # {'accept-encoding': 'gzip,deflate'} + """ + headers: dict[str, str] = {} + if accept_encoding: + if isinstance(accept_encoding, str): + pass + elif isinstance(accept_encoding, list): + accept_encoding = ",".join(accept_encoding) + else: + accept_encoding = ACCEPT_ENCODING + headers["accept-encoding"] = accept_encoding + + if user_agent: + headers["user-agent"] = user_agent + + if keep_alive: + headers["connection"] = "keep-alive" + + if basic_auth: + headers[ + "authorization" + ] = f"Basic {b64encode(basic_auth.encode('latin-1')).decode()}" + + if proxy_basic_auth: + headers[ + "proxy-authorization" + ] = f"Basic {b64encode(proxy_basic_auth.encode('latin-1')).decode()}" + + if disable_cache: + headers["cache-control"] = "no-cache" + + return headers + + +def set_file_position( + body: typing.Any, pos: _TYPE_BODY_POSITION | None +) -> _TYPE_BODY_POSITION | None: + """ + If a position is provided, move file to that point. + Otherwise, we'll attempt to record a position for future use. + """ + if pos is not None: + rewind_body(body, pos) + elif getattr(body, "tell", None) is not None: + try: + pos = body.tell() + except OSError: + # This differentiates from None, allowing us to catch + # a failed `tell()` later when trying to rewind the body. + pos = _FAILEDTELL + + return pos + + +def rewind_body(body: typing.IO[typing.AnyStr], body_pos: _TYPE_BODY_POSITION) -> None: + """ + Attempt to rewind body to a certain position. + Primarily used for request redirects and retries. + + :param body: + File-like object that supports seek. + + :param int pos: + Position to seek to in file. + """ + body_seek = getattr(body, "seek", None) + if body_seek is not None and isinstance(body_pos, int): + try: + body_seek(body_pos) + except OSError as e: + raise UnrewindableBodyError( + "An error occurred when rewinding request body for redirect/retry." + ) from e + elif body_pos is _FAILEDTELL: + raise UnrewindableBodyError( + "Unable to record file position for rewinding " + "request body during a redirect/retry." + ) + else: + raise ValueError( + f"body_pos must be of type integer, instead it was {type(body_pos)}." + ) + + +class ChunksAndContentLength(typing.NamedTuple): + chunks: typing.Iterable[bytes] | None + content_length: int | None + + +def body_to_chunks( + body: typing.Any | None, method: str, blocksize: int +) -> ChunksAndContentLength: + """Takes the HTTP request method, body, and blocksize and + transforms them into an iterable of chunks to pass to + socket.sendall() and an optional 'Content-Length' header. + + A 'Content-Length' of 'None' indicates the length of the body + can't be determined so should use 'Transfer-Encoding: chunked' + for framing instead. + """ + + chunks: typing.Iterable[bytes] | None + content_length: int | None + + # No body, we need to make a recommendation on 'Content-Length' + # based on whether that request method is expected to have + # a body or not. + if body is None: + chunks = None + if method.upper() not in _METHODS_NOT_EXPECTING_BODY: + content_length = 0 + else: + content_length = None + + # Bytes or strings become bytes + elif isinstance(body, (str, bytes)): + chunks = (to_bytes(body),) + content_length = len(chunks[0]) + + # File-like object, TODO: use seek() and tell() for length? + elif hasattr(body, "read"): + + def chunk_readable() -> typing.Iterable[bytes]: + nonlocal body, blocksize + encode = isinstance(body, io.TextIOBase) + while True: + datablock = body.read(blocksize) + if not datablock: + break + if encode: + datablock = datablock.encode("iso-8859-1") + yield datablock + + chunks = chunk_readable() + content_length = None + + # Otherwise we need to start checking via duck-typing. + else: + try: + # Check if the body implements the buffer API. + mv = memoryview(body) + except TypeError: + try: + # Check if the body is an iterable + chunks = iter(body) + content_length = None + except TypeError: + raise TypeError( + f"'body' must be a bytes-like object, file-like " + f"object, or iterable. Instead was {body!r}" + ) from None + else: + # Since it implements the buffer API can be passed directly to socket.sendall() + chunks = (body,) + content_length = mv.nbytes + + return ChunksAndContentLength(chunks=chunks, content_length=content_length) diff --git a/billinglayer/python/urllib3/util/response.py b/billinglayer/python/urllib3/util/response.py new file mode 100644 index 0000000..0f45786 --- /dev/null +++ b/billinglayer/python/urllib3/util/response.py @@ -0,0 +1,101 @@ +from __future__ import annotations + +import http.client as httplib +from email.errors import MultipartInvariantViolationDefect, StartBoundaryNotFoundDefect + +from ..exceptions import HeaderParsingError + + +def is_fp_closed(obj: object) -> bool: + """ + Checks whether a given file-like object is closed. + + :param obj: + The file-like object to check. + """ + + try: + # Check `isclosed()` first, in case Python3 doesn't set `closed`. + # GH Issue #928 + return obj.isclosed() # type: ignore[no-any-return, attr-defined] + except AttributeError: + pass + + try: + # Check via the official file-like-object way. + return obj.closed # type: ignore[no-any-return, attr-defined] + except AttributeError: + pass + + try: + # Check if the object is a container for another file-like object that + # gets released on exhaustion (e.g. HTTPResponse). + return obj.fp is None # type: ignore[attr-defined] + except AttributeError: + pass + + raise ValueError("Unable to determine whether fp is closed.") + + +def assert_header_parsing(headers: httplib.HTTPMessage) -> None: + """ + Asserts whether all headers have been successfully parsed. + Extracts encountered errors from the result of parsing headers. + + Only works on Python 3. + + :param http.client.HTTPMessage headers: Headers to verify. + + :raises urllib3.exceptions.HeaderParsingError: + If parsing errors are found. + """ + + # This will fail silently if we pass in the wrong kind of parameter. + # To make debugging easier add an explicit check. + if not isinstance(headers, httplib.HTTPMessage): + raise TypeError(f"expected httplib.Message, got {type(headers)}.") + + unparsed_data = None + + # get_payload is actually email.message.Message.get_payload; + # we're only interested in the result if it's not a multipart message + if not headers.is_multipart(): + payload = headers.get_payload() + + if isinstance(payload, (bytes, str)): + unparsed_data = payload + + # httplib is assuming a response body is available + # when parsing headers even when httplib only sends + # header data to parse_headers() This results in + # defects on multipart responses in particular. + # See: https://github.com/urllib3/urllib3/issues/800 + + # So we ignore the following defects: + # - StartBoundaryNotFoundDefect: + # The claimed start boundary was never found. + # - MultipartInvariantViolationDefect: + # A message claimed to be a multipart but no subparts were found. + defects = [ + defect + for defect in headers.defects + if not isinstance( + defect, (StartBoundaryNotFoundDefect, MultipartInvariantViolationDefect) + ) + ] + + if defects or unparsed_data: + raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data) + + +def is_response_to_head(response: httplib.HTTPResponse) -> bool: + """ + Checks whether the request of a response has been a HEAD-request. + + :param http.client.HTTPResponse response: + Response to check if the originating request + used 'HEAD' as a method. + """ + # FIXME: Can we do this somehow without accessing private httplib _method? + method_str = response._method # type: str # type: ignore[attr-defined] + return method_str.upper() == "HEAD" diff --git a/billinglayer/python/urllib3/util/retry.py b/billinglayer/python/urllib3/util/retry.py new file mode 100644 index 0000000..ea48afe --- /dev/null +++ b/billinglayer/python/urllib3/util/retry.py @@ -0,0 +1,529 @@ +from __future__ import annotations + +import email +import logging +import random +import re +import time +import typing +from itertools import takewhile +from types import TracebackType + +from ..exceptions import ( + ConnectTimeoutError, + InvalidHeader, + MaxRetryError, + ProtocolError, + ProxyError, + ReadTimeoutError, + ResponseError, +) +from .util import reraise + +if typing.TYPE_CHECKING: + from ..connectionpool import ConnectionPool + from ..response import BaseHTTPResponse + +log = logging.getLogger(__name__) + + +# Data structure for representing the metadata of requests that result in a retry. +class RequestHistory(typing.NamedTuple): + method: str | None + url: str | None + error: Exception | None + status: int | None + redirect_location: str | None + + +class Retry: + """Retry configuration. + + Each retry attempt will create a new Retry object with updated values, so + they can be safely reused. + + Retries can be defined as a default for a pool: + + .. code-block:: python + + retries = Retry(connect=5, read=2, redirect=5) + http = PoolManager(retries=retries) + response = http.request("GET", "https://example.com/") + + Or per-request (which overrides the default for the pool): + + .. code-block:: python + + response = http.request("GET", "https://example.com/", retries=Retry(10)) + + Retries can be disabled by passing ``False``: + + .. code-block:: python + + response = http.request("GET", "https://example.com/", retries=False) + + Errors will be wrapped in :class:`~urllib3.exceptions.MaxRetryError` unless + retries are disabled, in which case the causing exception will be raised. + + :param int total: + Total number of retries to allow. Takes precedence over other counts. + + Set to ``None`` to remove this constraint and fall back on other + counts. + + Set to ``0`` to fail on the first retry. + + Set to ``False`` to disable and imply ``raise_on_redirect=False``. + + :param int connect: + How many connection-related errors to retry on. + + These are errors raised before the request is sent to the remote server, + which we assume has not triggered the server to process the request. + + Set to ``0`` to fail on the first retry of this type. + + :param int read: + How many times to retry on read errors. + + These errors are raised after the request was sent to the server, so the + request may have side-effects. + + Set to ``0`` to fail on the first retry of this type. + + :param int redirect: + How many redirects to perform. Limit this to avoid infinite redirect + loops. + + A redirect is a HTTP response with a status code 301, 302, 303, 307 or + 308. + + Set to ``0`` to fail on the first retry of this type. + + Set to ``False`` to disable and imply ``raise_on_redirect=False``. + + :param int status: + How many times to retry on bad status codes. + + These are retries made on responses, where status code matches + ``status_forcelist``. + + Set to ``0`` to fail on the first retry of this type. + + :param int other: + How many times to retry on other errors. + + Other errors are errors that are not connect, read, redirect or status errors. + These errors might be raised after the request was sent to the server, so the + request might have side-effects. + + Set to ``0`` to fail on the first retry of this type. + + If ``total`` is not set, it's a good idea to set this to 0 to account + for unexpected edge cases and avoid infinite retry loops. + + :param Collection allowed_methods: + Set of uppercased HTTP method verbs that we should retry on. + + By default, we only retry on methods which are considered to be + idempotent (multiple requests with the same parameters end with the + same state). See :attr:`Retry.DEFAULT_ALLOWED_METHODS`. + + Set to a ``None`` value to retry on any verb. + + :param Collection status_forcelist: + A set of integer HTTP status codes that we should force a retry on. + A retry is initiated if the request method is in ``allowed_methods`` + and the response status code is in ``status_forcelist``. + + By default, this is disabled with ``None``. + + :param float backoff_factor: + A backoff factor to apply between attempts after the second try + (most errors are resolved immediately by a second try without a + delay). urllib3 will sleep for:: + + {backoff factor} * (2 ** ({number of previous retries})) + + seconds. If `backoff_jitter` is non-zero, this sleep is extended by:: + + random.uniform(0, {backoff jitter}) + + seconds. For example, if the backoff_factor is 0.1, then :func:`Retry.sleep` will + sleep for [0.0s, 0.2s, 0.4s, 0.8s, ...] between retries. No backoff will ever + be longer than `backoff_max`. + + By default, backoff is disabled (factor set to 0). + + :param bool raise_on_redirect: Whether, if the number of redirects is + exhausted, to raise a MaxRetryError, or to return a response with a + response code in the 3xx range. + + :param bool raise_on_status: Similar meaning to ``raise_on_redirect``: + whether we should raise an exception, or return a response, + if status falls in ``status_forcelist`` range and retries have + been exhausted. + + :param tuple history: The history of the request encountered during + each call to :meth:`~Retry.increment`. The list is in the order + the requests occurred. Each list item is of class :class:`RequestHistory`. + + :param bool respect_retry_after_header: + Whether to respect Retry-After header on status codes defined as + :attr:`Retry.RETRY_AFTER_STATUS_CODES` or not. + + :param Collection remove_headers_on_redirect: + Sequence of headers to remove from the request when a response + indicating a redirect is returned before firing off the redirected + request. + """ + + #: Default methods to be used for ``allowed_methods`` + DEFAULT_ALLOWED_METHODS = frozenset( + ["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"] + ) + + #: Default status codes to be used for ``status_forcelist`` + RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503]) + + #: Default headers to be used for ``remove_headers_on_redirect`` + DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Authorization"]) + + #: Default maximum backoff time. + DEFAULT_BACKOFF_MAX = 120 + + # Backward compatibility; assigned outside of the class. + DEFAULT: typing.ClassVar[Retry] + + def __init__( + self, + total: bool | int | None = 10, + connect: int | None = None, + read: int | None = None, + redirect: bool | int | None = None, + status: int | None = None, + other: int | None = None, + allowed_methods: typing.Collection[str] | None = DEFAULT_ALLOWED_METHODS, + status_forcelist: typing.Collection[int] | None = None, + backoff_factor: float = 0, + backoff_max: float = DEFAULT_BACKOFF_MAX, + raise_on_redirect: bool = True, + raise_on_status: bool = True, + history: tuple[RequestHistory, ...] | None = None, + respect_retry_after_header: bool = True, + remove_headers_on_redirect: typing.Collection[ + str + ] = DEFAULT_REMOVE_HEADERS_ON_REDIRECT, + backoff_jitter: float = 0.0, + ) -> None: + self.total = total + self.connect = connect + self.read = read + self.status = status + self.other = other + + if redirect is False or total is False: + redirect = 0 + raise_on_redirect = False + + self.redirect = redirect + self.status_forcelist = status_forcelist or set() + self.allowed_methods = allowed_methods + self.backoff_factor = backoff_factor + self.backoff_max = backoff_max + self.raise_on_redirect = raise_on_redirect + self.raise_on_status = raise_on_status + self.history = history or () + self.respect_retry_after_header = respect_retry_after_header + self.remove_headers_on_redirect = frozenset( + h.lower() for h in remove_headers_on_redirect + ) + self.backoff_jitter = backoff_jitter + + def new(self, **kw: typing.Any) -> Retry: + params = dict( + total=self.total, + connect=self.connect, + read=self.read, + redirect=self.redirect, + status=self.status, + other=self.other, + allowed_methods=self.allowed_methods, + status_forcelist=self.status_forcelist, + backoff_factor=self.backoff_factor, + backoff_max=self.backoff_max, + raise_on_redirect=self.raise_on_redirect, + raise_on_status=self.raise_on_status, + history=self.history, + remove_headers_on_redirect=self.remove_headers_on_redirect, + respect_retry_after_header=self.respect_retry_after_header, + backoff_jitter=self.backoff_jitter, + ) + + params.update(kw) + return type(self)(**params) # type: ignore[arg-type] + + @classmethod + def from_int( + cls, + retries: Retry | bool | int | None, + redirect: bool | int | None = True, + default: Retry | bool | int | None = None, + ) -> Retry: + """Backwards-compatibility for the old retries format.""" + if retries is None: + retries = default if default is not None else cls.DEFAULT + + if isinstance(retries, Retry): + return retries + + redirect = bool(redirect) and None + new_retries = cls(retries, redirect=redirect) + log.debug("Converted retries value: %r -> %r", retries, new_retries) + return new_retries + + def get_backoff_time(self) -> float: + """Formula for computing the current backoff + + :rtype: float + """ + # We want to consider only the last consecutive errors sequence (Ignore redirects). + consecutive_errors_len = len( + list( + takewhile(lambda x: x.redirect_location is None, reversed(self.history)) + ) + ) + if consecutive_errors_len <= 1: + return 0 + + backoff_value = self.backoff_factor * (2 ** (consecutive_errors_len - 1)) + if self.backoff_jitter != 0.0: + backoff_value += random.random() * self.backoff_jitter + return float(max(0, min(self.backoff_max, backoff_value))) + + def parse_retry_after(self, retry_after: str) -> float: + seconds: float + # Whitespace: https://tools.ietf.org/html/rfc7230#section-3.2.4 + if re.match(r"^\s*[0-9]+\s*$", retry_after): + seconds = int(retry_after) + else: + retry_date_tuple = email.utils.parsedate_tz(retry_after) + if retry_date_tuple is None: + raise InvalidHeader(f"Invalid Retry-After header: {retry_after}") + + retry_date = email.utils.mktime_tz(retry_date_tuple) + seconds = retry_date - time.time() + + seconds = max(seconds, 0) + + return seconds + + def get_retry_after(self, response: BaseHTTPResponse) -> float | None: + """Get the value of Retry-After in seconds.""" + + retry_after = response.headers.get("Retry-After") + + if retry_after is None: + return None + + return self.parse_retry_after(retry_after) + + def sleep_for_retry(self, response: BaseHTTPResponse) -> bool: + retry_after = self.get_retry_after(response) + if retry_after: + time.sleep(retry_after) + return True + + return False + + def _sleep_backoff(self) -> None: + backoff = self.get_backoff_time() + if backoff <= 0: + return + time.sleep(backoff) + + def sleep(self, response: BaseHTTPResponse | None = None) -> None: + """Sleep between retry attempts. + + This method will respect a server's ``Retry-After`` response header + and sleep the duration of the time requested. If that is not present, it + will use an exponential backoff. By default, the backoff factor is 0 and + this method will return immediately. + """ + + if self.respect_retry_after_header and response: + slept = self.sleep_for_retry(response) + if slept: + return + + self._sleep_backoff() + + def _is_connection_error(self, err: Exception) -> bool: + """Errors when we're fairly sure that the server did not receive the + request, so it should be safe to retry. + """ + if isinstance(err, ProxyError): + err = err.original_error + return isinstance(err, ConnectTimeoutError) + + def _is_read_error(self, err: Exception) -> bool: + """Errors that occur after the request has been started, so we should + assume that the server began processing it. + """ + return isinstance(err, (ReadTimeoutError, ProtocolError)) + + def _is_method_retryable(self, method: str) -> bool: + """Checks if a given HTTP method should be retried upon, depending if + it is included in the allowed_methods + """ + if self.allowed_methods and method.upper() not in self.allowed_methods: + return False + return True + + def is_retry( + self, method: str, status_code: int, has_retry_after: bool = False + ) -> bool: + """Is this method/status code retryable? (Based on allowlists and control + variables such as the number of total retries to allow, whether to + respect the Retry-After header, whether this header is present, and + whether the returned status code is on the list of status codes to + be retried upon on the presence of the aforementioned header) + """ + if not self._is_method_retryable(method): + return False + + if self.status_forcelist and status_code in self.status_forcelist: + return True + + return bool( + self.total + and self.respect_retry_after_header + and has_retry_after + and (status_code in self.RETRY_AFTER_STATUS_CODES) + ) + + def is_exhausted(self) -> bool: + """Are we out of retries?""" + retry_counts = [ + x + for x in ( + self.total, + self.connect, + self.read, + self.redirect, + self.status, + self.other, + ) + if x + ] + if not retry_counts: + return False + + return min(retry_counts) < 0 + + def increment( + self, + method: str | None = None, + url: str | None = None, + response: BaseHTTPResponse | None = None, + error: Exception | None = None, + _pool: ConnectionPool | None = None, + _stacktrace: TracebackType | None = None, + ) -> Retry: + """Return a new Retry object with incremented retry counters. + + :param response: A response object, or None, if the server did not + return a response. + :type response: :class:`~urllib3.response.BaseHTTPResponse` + :param Exception error: An error encountered during the request, or + None if the response was received successfully. + + :return: A new ``Retry`` object. + """ + if self.total is False and error: + # Disabled, indicate to re-raise the error. + raise reraise(type(error), error, _stacktrace) + + total = self.total + if total is not None: + total -= 1 + + connect = self.connect + read = self.read + redirect = self.redirect + status_count = self.status + other = self.other + cause = "unknown" + status = None + redirect_location = None + + if error and self._is_connection_error(error): + # Connect retry? + if connect is False: + raise reraise(type(error), error, _stacktrace) + elif connect is not None: + connect -= 1 + + elif error and self._is_read_error(error): + # Read retry? + if read is False or method is None or not self._is_method_retryable(method): + raise reraise(type(error), error, _stacktrace) + elif read is not None: + read -= 1 + + elif error: + # Other retry? + if other is not None: + other -= 1 + + elif response and response.get_redirect_location(): + # Redirect retry? + if redirect is not None: + redirect -= 1 + cause = "too many redirects" + response_redirect_location = response.get_redirect_location() + if response_redirect_location: + redirect_location = response_redirect_location + status = response.status + + else: + # Incrementing because of a server error like a 500 in + # status_forcelist and the given method is in the allowed_methods + cause = ResponseError.GENERIC_ERROR + if response and response.status: + if status_count is not None: + status_count -= 1 + cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) + status = response.status + + history = self.history + ( + RequestHistory(method, url, error, status, redirect_location), + ) + + new_retry = self.new( + total=total, + connect=connect, + read=read, + redirect=redirect, + status=status_count, + other=other, + history=history, + ) + + if new_retry.is_exhausted(): + reason = error or ResponseError(cause) + raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] + + log.debug("Incremented Retry for (url='%s'): %r", url, new_retry) + + return new_retry + + def __repr__(self) -> str: + return ( + f"{type(self).__name__}(total={self.total}, connect={self.connect}, " + f"read={self.read}, redirect={self.redirect}, status={self.status})" + ) + + +# For backwards compatibility (equivalent to pre-v1.9): +Retry.DEFAULT = Retry(3) diff --git a/billinglayer/python/urllib3/util/ssl_.py b/billinglayer/python/urllib3/util/ssl_.py new file mode 100644 index 0000000..7762803 --- /dev/null +++ b/billinglayer/python/urllib3/util/ssl_.py @@ -0,0 +1,513 @@ +from __future__ import annotations + +import hmac +import os +import socket +import sys +import typing +import warnings +from binascii import unhexlify +from hashlib import md5, sha1, sha256 + +from ..exceptions import ProxySchemeUnsupported, SSLError +from .url import _BRACELESS_IPV6_ADDRZ_RE, _IPV4_RE + +SSLContext = None +SSLTransport = None +HAS_NEVER_CHECK_COMMON_NAME = False +IS_PYOPENSSL = False +IS_SECURETRANSPORT = False +ALPN_PROTOCOLS = ["http/1.1"] + +_TYPE_VERSION_INFO = typing.Tuple[int, int, int, str, int] + +# Maps the length of a digest to a possible hash function producing this digest +HASHFUNC_MAP = {32: md5, 40: sha1, 64: sha256} + + +def _is_bpo_43522_fixed( + implementation_name: str, + version_info: _TYPE_VERSION_INFO, + pypy_version_info: _TYPE_VERSION_INFO | None, +) -> bool: + """Return True for CPython 3.8.9+, 3.9.3+ or 3.10+ and PyPy 7.3.8+ where + setting SSLContext.hostname_checks_common_name to False works. + + Outside of CPython and PyPy we don't know which implementations work + or not so we conservatively use our hostname matching as we know that works + on all implementations. + + https://github.com/urllib3/urllib3/issues/2192#issuecomment-821832963 + https://foss.heptapod.net/pypy/pypy/-/issues/3539 + """ + if implementation_name == "pypy": + # https://foss.heptapod.net/pypy/pypy/-/issues/3129 + return pypy_version_info >= (7, 3, 8) and version_info >= (3, 8) # type: ignore[operator] + elif implementation_name == "cpython": + major_minor = version_info[:2] + micro = version_info[2] + return ( + (major_minor == (3, 8) and micro >= 9) + or (major_minor == (3, 9) and micro >= 3) + or major_minor >= (3, 10) + ) + else: # Defensive: + return False + + +def _is_has_never_check_common_name_reliable( + openssl_version: str, + openssl_version_number: int, + implementation_name: str, + version_info: _TYPE_VERSION_INFO, + pypy_version_info: _TYPE_VERSION_INFO | None, +) -> bool: + # As of May 2023, all released versions of LibreSSL fail to reject certificates with + # only common names, see https://github.com/urllib3/urllib3/pull/3024 + is_openssl = openssl_version.startswith("OpenSSL ") + # Before fixing OpenSSL issue #14579, the SSL_new() API was not copying hostflags + # like X509_CHECK_FLAG_NEVER_CHECK_SUBJECT, which tripped up CPython. + # https://github.com/openssl/openssl/issues/14579 + # This was released in OpenSSL 1.1.1l+ (>=0x101010cf) + is_openssl_issue_14579_fixed = openssl_version_number >= 0x101010CF + + return is_openssl and ( + is_openssl_issue_14579_fixed + or _is_bpo_43522_fixed(implementation_name, version_info, pypy_version_info) + ) + + +if typing.TYPE_CHECKING: + from ssl import VerifyMode + + from typing_extensions import Literal, TypedDict + + from .ssltransport import SSLTransport as SSLTransportType + + class _TYPE_PEER_CERT_RET_DICT(TypedDict, total=False): + subjectAltName: tuple[tuple[str, str], ...] + subject: tuple[tuple[tuple[str, str], ...], ...] + serialNumber: str + + +# Mapping from 'ssl.PROTOCOL_TLSX' to 'TLSVersion.X' +_SSL_VERSION_TO_TLS_VERSION: dict[int, int] = {} + +try: # Do we have ssl at all? + import ssl + from ssl import ( # type: ignore[assignment] + CERT_REQUIRED, + HAS_NEVER_CHECK_COMMON_NAME, + OP_NO_COMPRESSION, + OP_NO_TICKET, + OPENSSL_VERSION, + OPENSSL_VERSION_NUMBER, + PROTOCOL_TLS, + PROTOCOL_TLS_CLIENT, + OP_NO_SSLv2, + OP_NO_SSLv3, + SSLContext, + TLSVersion, + ) + + PROTOCOL_SSLv23 = PROTOCOL_TLS + + # Setting SSLContext.hostname_checks_common_name = False didn't work before CPython + # 3.8.9, 3.9.3, and 3.10 (but OK on PyPy) or OpenSSL 1.1.1l+ + if HAS_NEVER_CHECK_COMMON_NAME and not _is_has_never_check_common_name_reliable( + OPENSSL_VERSION, + OPENSSL_VERSION_NUMBER, + sys.implementation.name, + sys.version_info, + sys.pypy_version_info if sys.implementation.name == "pypy" else None, # type: ignore[attr-defined] + ): + HAS_NEVER_CHECK_COMMON_NAME = False + + # Need to be careful here in case old TLS versions get + # removed in future 'ssl' module implementations. + for attr in ("TLSv1", "TLSv1_1", "TLSv1_2"): + try: + _SSL_VERSION_TO_TLS_VERSION[getattr(ssl, f"PROTOCOL_{attr}")] = getattr( + TLSVersion, attr + ) + except AttributeError: # Defensive: + continue + + from .ssltransport import SSLTransport # type: ignore[assignment] +except ImportError: + OP_NO_COMPRESSION = 0x20000 # type: ignore[assignment] + OP_NO_TICKET = 0x4000 # type: ignore[assignment] + OP_NO_SSLv2 = 0x1000000 # type: ignore[assignment] + OP_NO_SSLv3 = 0x2000000 # type: ignore[assignment] + PROTOCOL_SSLv23 = PROTOCOL_TLS = 2 # type: ignore[assignment] + PROTOCOL_TLS_CLIENT = 16 # type: ignore[assignment] + + +_TYPE_PEER_CERT_RET = typing.Union["_TYPE_PEER_CERT_RET_DICT", bytes, None] + + +def assert_fingerprint(cert: bytes | None, fingerprint: str) -> None: + """ + Checks if given fingerprint matches the supplied certificate. + + :param cert: + Certificate as bytes object. + :param fingerprint: + Fingerprint as string of hexdigits, can be interspersed by colons. + """ + + if cert is None: + raise SSLError("No certificate for the peer.") + + fingerprint = fingerprint.replace(":", "").lower() + digest_length = len(fingerprint) + hashfunc = HASHFUNC_MAP.get(digest_length) + if not hashfunc: + raise SSLError(f"Fingerprint of invalid length: {fingerprint}") + + # We need encode() here for py32; works on py2 and p33. + fingerprint_bytes = unhexlify(fingerprint.encode()) + + cert_digest = hashfunc(cert).digest() + + if not hmac.compare_digest(cert_digest, fingerprint_bytes): + raise SSLError( + f'Fingerprints did not match. Expected "{fingerprint}", got "{cert_digest.hex()}"' + ) + + +def resolve_cert_reqs(candidate: None | int | str) -> VerifyMode: + """ + Resolves the argument to a numeric constant, which can be passed to + the wrap_socket function/method from the ssl module. + Defaults to :data:`ssl.CERT_REQUIRED`. + If given a string it is assumed to be the name of the constant in the + :mod:`ssl` module or its abbreviation. + (So you can specify `REQUIRED` instead of `CERT_REQUIRED`. + If it's neither `None` nor a string we assume it is already the numeric + constant which can directly be passed to wrap_socket. + """ + if candidate is None: + return CERT_REQUIRED + + if isinstance(candidate, str): + res = getattr(ssl, candidate, None) + if res is None: + res = getattr(ssl, "CERT_" + candidate) + return res # type: ignore[no-any-return] + + return candidate # type: ignore[return-value] + + +def resolve_ssl_version(candidate: None | int | str) -> int: + """ + like resolve_cert_reqs + """ + if candidate is None: + return PROTOCOL_TLS + + if isinstance(candidate, str): + res = getattr(ssl, candidate, None) + if res is None: + res = getattr(ssl, "PROTOCOL_" + candidate) + return typing.cast(int, res) + + return candidate + + +def create_urllib3_context( + ssl_version: int | None = None, + cert_reqs: int | None = None, + options: int | None = None, + ciphers: str | None = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, +) -> ssl.SSLContext: + """Creates and configures an :class:`ssl.SSLContext` instance for use with urllib3. + + :param ssl_version: + The desired protocol version to use. This will default to + PROTOCOL_SSLv23 which will negotiate the highest protocol that both + the server and your installation of OpenSSL support. + + This parameter is deprecated instead use 'ssl_minimum_version'. + :param ssl_minimum_version: + The minimum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. + :param ssl_maximum_version: + The maximum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. + Not recommended to set to anything other than 'ssl.TLSVersion.MAXIMUM_SUPPORTED' which is the + default value. + :param cert_reqs: + Whether to require the certificate verification. This defaults to + ``ssl.CERT_REQUIRED``. + :param options: + Specific OpenSSL options. These default to ``ssl.OP_NO_SSLv2``, + ``ssl.OP_NO_SSLv3``, ``ssl.OP_NO_COMPRESSION``, and ``ssl.OP_NO_TICKET``. + :param ciphers: + Which cipher suites to allow the server to select. Defaults to either system configured + ciphers if OpenSSL 1.1.1+, otherwise uses a secure default set of ciphers. + :returns: + Constructed SSLContext object with specified options + :rtype: SSLContext + """ + if SSLContext is None: + raise TypeError("Can't create an SSLContext object without an ssl module") + + # This means 'ssl_version' was specified as an exact value. + if ssl_version not in (None, PROTOCOL_TLS, PROTOCOL_TLS_CLIENT): + # Disallow setting 'ssl_version' and 'ssl_minimum|maximum_version' + # to avoid conflicts. + if ssl_minimum_version is not None or ssl_maximum_version is not None: + raise ValueError( + "Can't specify both 'ssl_version' and either " + "'ssl_minimum_version' or 'ssl_maximum_version'" + ) + + # 'ssl_version' is deprecated and will be removed in the future. + else: + # Use 'ssl_minimum_version' and 'ssl_maximum_version' instead. + ssl_minimum_version = _SSL_VERSION_TO_TLS_VERSION.get( + ssl_version, TLSVersion.MINIMUM_SUPPORTED + ) + ssl_maximum_version = _SSL_VERSION_TO_TLS_VERSION.get( + ssl_version, TLSVersion.MAXIMUM_SUPPORTED + ) + + # This warning message is pushing users to use 'ssl_minimum_version' + # instead of both min/max. Best practice is to only set the minimum version and + # keep the maximum version to be it's default value: 'TLSVersion.MAXIMUM_SUPPORTED' + warnings.warn( + "'ssl_version' option is deprecated and will be " + "removed in urllib3 v2.1.0. Instead use 'ssl_minimum_version'", + category=DeprecationWarning, + stacklevel=2, + ) + + # PROTOCOL_TLS is deprecated in Python 3.10 so we always use PROTOCOL_TLS_CLIENT + context = SSLContext(PROTOCOL_TLS_CLIENT) + + if ssl_minimum_version is not None: + context.minimum_version = ssl_minimum_version + else: # Python <3.10 defaults to 'MINIMUM_SUPPORTED' so explicitly set TLSv1.2 here + context.minimum_version = TLSVersion.TLSv1_2 + + if ssl_maximum_version is not None: + context.maximum_version = ssl_maximum_version + + # Unless we're given ciphers defer to either system ciphers in + # the case of OpenSSL 1.1.1+ or use our own secure default ciphers. + if ciphers: + context.set_ciphers(ciphers) + + # Setting the default here, as we may have no ssl module on import + cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs + + if options is None: + options = 0 + # SSLv2 is easily broken and is considered harmful and dangerous + options |= OP_NO_SSLv2 + # SSLv3 has several problems and is now dangerous + options |= OP_NO_SSLv3 + # Disable compression to prevent CRIME attacks for OpenSSL 1.0+ + # (issue #309) + options |= OP_NO_COMPRESSION + # TLSv1.2 only. Unless set explicitly, do not request tickets. + # This may save some bandwidth on wire, and although the ticket is encrypted, + # there is a risk associated with it being on wire, + # if the server is not rotating its ticketing keys properly. + options |= OP_NO_TICKET + + context.options |= options + + # Enable post-handshake authentication for TLS 1.3, see GH #1634. PHA is + # necessary for conditional client cert authentication with TLS 1.3. + # The attribute is None for OpenSSL <= 1.1.0 or does not exist in older + # versions of Python. We only enable on Python 3.7.4+ or if certificate + # verification is enabled to work around Python issue #37428 + # See: https://bugs.python.org/issue37428 + if (cert_reqs == ssl.CERT_REQUIRED or sys.version_info >= (3, 7, 4)) and getattr( + context, "post_handshake_auth", None + ) is not None: + context.post_handshake_auth = True + + # The order of the below lines setting verify_mode and check_hostname + # matter due to safe-guards SSLContext has to prevent an SSLContext with + # check_hostname=True, verify_mode=NONE/OPTIONAL. + # We always set 'check_hostname=False' for pyOpenSSL so we rely on our own + # 'ssl.match_hostname()' implementation. + if cert_reqs == ssl.CERT_REQUIRED and not IS_PYOPENSSL: + context.verify_mode = cert_reqs + context.check_hostname = True + else: + context.check_hostname = False + context.verify_mode = cert_reqs + + try: + context.hostname_checks_common_name = False + except AttributeError: # Defensive: for CPython < 3.8.9 and 3.9.3; for PyPy < 7.3.8 + pass + + # Enable logging of TLS session keys via defacto standard environment variable + # 'SSLKEYLOGFILE', if the feature is available (Python 3.8+). Skip empty values. + if hasattr(context, "keylog_filename"): + sslkeylogfile = os.environ.get("SSLKEYLOGFILE") + if sslkeylogfile: + context.keylog_filename = sslkeylogfile + + return context + + +@typing.overload +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = ..., + certfile: str | None = ..., + cert_reqs: int | None = ..., + ca_certs: str | None = ..., + server_hostname: str | None = ..., + ssl_version: int | None = ..., + ciphers: str | None = ..., + ssl_context: ssl.SSLContext | None = ..., + ca_cert_dir: str | None = ..., + key_password: str | None = ..., + ca_cert_data: None | str | bytes = ..., + tls_in_tls: Literal[False] = ..., +) -> ssl.SSLSocket: + ... + + +@typing.overload +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = ..., + certfile: str | None = ..., + cert_reqs: int | None = ..., + ca_certs: str | None = ..., + server_hostname: str | None = ..., + ssl_version: int | None = ..., + ciphers: str | None = ..., + ssl_context: ssl.SSLContext | None = ..., + ca_cert_dir: str | None = ..., + key_password: str | None = ..., + ca_cert_data: None | str | bytes = ..., + tls_in_tls: bool = ..., +) -> ssl.SSLSocket | SSLTransportType: + ... + + +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = None, + certfile: str | None = None, + cert_reqs: int | None = None, + ca_certs: str | None = None, + server_hostname: str | None = None, + ssl_version: int | None = None, + ciphers: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_cert_dir: str | None = None, + key_password: str | None = None, + ca_cert_data: None | str | bytes = None, + tls_in_tls: bool = False, +) -> ssl.SSLSocket | SSLTransportType: + """ + All arguments except for server_hostname, ssl_context, and ca_cert_dir have + the same meaning as they do when using :func:`ssl.wrap_socket`. + + :param server_hostname: + When SNI is supported, the expected hostname of the certificate + :param ssl_context: + A pre-made :class:`SSLContext` object. If none is provided, one will + be created using :func:`create_urllib3_context`. + :param ciphers: + A string of ciphers we wish the client to support. + :param ca_cert_dir: + A directory containing CA certificates in multiple separate files, as + supported by OpenSSL's -CApath flag or the capath argument to + SSLContext.load_verify_locations(). + :param key_password: + Optional password if the keyfile is encrypted. + :param ca_cert_data: + Optional string containing CA certificates in PEM format suitable for + passing as the cadata parameter to SSLContext.load_verify_locations() + :param tls_in_tls: + Use SSLTransport to wrap the existing socket. + """ + context = ssl_context + if context is None: + # Note: This branch of code and all the variables in it are only used in tests. + # We should consider deprecating and removing this code. + context = create_urllib3_context(ssl_version, cert_reqs, ciphers=ciphers) + + if ca_certs or ca_cert_dir or ca_cert_data: + try: + context.load_verify_locations(ca_certs, ca_cert_dir, ca_cert_data) + except OSError as e: + raise SSLError(e) from e + + elif ssl_context is None and hasattr(context, "load_default_certs"): + # try to load OS default certs; works well on Windows. + context.load_default_certs() + + # Attempt to detect if we get the goofy behavior of the + # keyfile being encrypted and OpenSSL asking for the + # passphrase via the terminal and instead error out. + if keyfile and key_password is None and _is_key_file_encrypted(keyfile): + raise SSLError("Client private key is encrypted, password is required") + + if certfile: + if key_password is None: + context.load_cert_chain(certfile, keyfile) + else: + context.load_cert_chain(certfile, keyfile, key_password) + + try: + context.set_alpn_protocols(ALPN_PROTOCOLS) + except NotImplementedError: # Defensive: in CI, we always have set_alpn_protocols + pass + + ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) + return ssl_sock + + +def is_ipaddress(hostname: str | bytes) -> bool: + """Detects whether the hostname given is an IPv4 or IPv6 address. + Also detects IPv6 addresses with Zone IDs. + + :param str hostname: Hostname to examine. + :return: True if the hostname is an IP address, False otherwise. + """ + if isinstance(hostname, bytes): + # IDN A-label bytes are ASCII compatible. + hostname = hostname.decode("ascii") + return bool(_IPV4_RE.match(hostname) or _BRACELESS_IPV6_ADDRZ_RE.match(hostname)) + + +def _is_key_file_encrypted(key_file: str) -> bool: + """Detects if a key file is encrypted or not.""" + with open(key_file) as f: + for line in f: + # Look for Proc-Type: 4,ENCRYPTED + if "ENCRYPTED" in line: + return True + + return False + + +def _ssl_wrap_socket_impl( + sock: socket.socket, + ssl_context: ssl.SSLContext, + tls_in_tls: bool, + server_hostname: str | None = None, +) -> ssl.SSLSocket | SSLTransportType: + if tls_in_tls: + if not SSLTransport: + # Import error, ssl is not available. + raise ProxySchemeUnsupported( + "TLS in TLS requires support for the 'ssl' module" + ) + + SSLTransport._validate_ssl_context_for_tls_in_tls(ssl_context) + return SSLTransport(sock, ssl_context, server_hostname) + + return ssl_context.wrap_socket(sock, server_hostname=server_hostname) diff --git a/billinglayer/python/urllib3/util/ssl_match_hostname.py b/billinglayer/python/urllib3/util/ssl_match_hostname.py new file mode 100644 index 0000000..453cfd4 --- /dev/null +++ b/billinglayer/python/urllib3/util/ssl_match_hostname.py @@ -0,0 +1,159 @@ +"""The match_hostname() function from Python 3.5, essential when using SSL.""" + +# Note: This file is under the PSF license as the code comes from the python +# stdlib. http://docs.python.org/3/license.html +# It is modified to remove commonName support. + +from __future__ import annotations + +import ipaddress +import re +import typing +from ipaddress import IPv4Address, IPv6Address + +if typing.TYPE_CHECKING: + from .ssl_ import _TYPE_PEER_CERT_RET_DICT + +__version__ = "3.5.0.1" + + +class CertificateError(ValueError): + pass + + +def _dnsname_match( + dn: typing.Any, hostname: str, max_wildcards: int = 1 +) -> typing.Match[str] | None | bool: + """Matching according to RFC 6125, section 6.4.3 + + http://tools.ietf.org/html/rfc6125#section-6.4.3 + """ + pats = [] + if not dn: + return False + + # Ported from python3-syntax: + # leftmost, *remainder = dn.split(r'.') + parts = dn.split(r".") + leftmost = parts[0] + remainder = parts[1:] + + wildcards = leftmost.count("*") + if wildcards > max_wildcards: + # Issue #17980: avoid denials of service by refusing more + # than one wildcard per fragment. A survey of established + # policy among SSL implementations showed it to be a + # reasonable choice. + raise CertificateError( + "too many wildcards in certificate DNS name: " + repr(dn) + ) + + # speed up common case w/o wildcards + if not wildcards: + return bool(dn.lower() == hostname.lower()) + + # RFC 6125, section 6.4.3, subitem 1. + # The client SHOULD NOT attempt to match a presented identifier in which + # the wildcard character comprises a label other than the left-most label. + if leftmost == "*": + # When '*' is a fragment by itself, it matches a non-empty dotless + # fragment. + pats.append("[^.]+") + elif leftmost.startswith("xn--") or hostname.startswith("xn--"): + # RFC 6125, section 6.4.3, subitem 3. + # The client SHOULD NOT attempt to match a presented identifier + # where the wildcard character is embedded within an A-label or + # U-label of an internationalized domain name. + pats.append(re.escape(leftmost)) + else: + # Otherwise, '*' matches any dotless string, e.g. www* + pats.append(re.escape(leftmost).replace(r"\*", "[^.]*")) + + # add the remaining fragments, ignore any wildcards + for frag in remainder: + pats.append(re.escape(frag)) + + pat = re.compile(r"\A" + r"\.".join(pats) + r"\Z", re.IGNORECASE) + return pat.match(hostname) + + +def _ipaddress_match(ipname: str, host_ip: IPv4Address | IPv6Address) -> bool: + """Exact matching of IP addresses. + + RFC 9110 section 4.3.5: "A reference identity of IP-ID contains the decoded + bytes of the IP address. An IP version 4 address is 4 octets, and an IP + version 6 address is 16 octets. [...] A reference identity of type IP-ID + matches if the address is identical to an iPAddress value of the + subjectAltName extension of the certificate." + """ + # OpenSSL may add a trailing newline to a subjectAltName's IP address + # Divergence from upstream: ipaddress can't handle byte str + ip = ipaddress.ip_address(ipname.rstrip()) + return bool(ip.packed == host_ip.packed) + + +def match_hostname( + cert: _TYPE_PEER_CERT_RET_DICT | None, + hostname: str, + hostname_checks_common_name: bool = False, +) -> None: + """Verify that *cert* (in decoded format as returned by + SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 + rules are followed, but IP addresses are not accepted for *hostname*. + + CertificateError is raised on failure. On success, the function + returns nothing. + """ + if not cert: + raise ValueError( + "empty or no certificate, match_hostname needs a " + "SSL socket or SSL context with either " + "CERT_OPTIONAL or CERT_REQUIRED" + ) + try: + # Divergence from upstream: ipaddress can't handle byte str + # + # The ipaddress module shipped with Python < 3.9 does not support + # scoped IPv6 addresses so we unconditionally strip the Zone IDs for + # now. Once we drop support for Python 3.9 we can remove this branch. + if "%" in hostname: + host_ip = ipaddress.ip_address(hostname[: hostname.rfind("%")]) + else: + host_ip = ipaddress.ip_address(hostname) + + except ValueError: + # Not an IP address (common case) + host_ip = None + dnsnames = [] + san: tuple[tuple[str, str], ...] = cert.get("subjectAltName", ()) + key: str + value: str + for key, value in san: + if key == "DNS": + if host_ip is None and _dnsname_match(value, hostname): + return + dnsnames.append(value) + elif key == "IP Address": + if host_ip is not None and _ipaddress_match(value, host_ip): + return + dnsnames.append(value) + + # We only check 'commonName' if it's enabled and we're not verifying + # an IP address. IP addresses aren't valid within 'commonName'. + if hostname_checks_common_name and host_ip is None and not dnsnames: + for sub in cert.get("subject", ()): + for key, value in sub: + if key == "commonName": + if _dnsname_match(value, hostname): + return + dnsnames.append(value) + + if len(dnsnames) > 1: + raise CertificateError( + "hostname %r " + "doesn't match either of %s" % (hostname, ", ".join(map(repr, dnsnames))) + ) + elif len(dnsnames) == 1: + raise CertificateError(f"hostname {hostname!r} doesn't match {dnsnames[0]!r}") + else: + raise CertificateError("no appropriate subjectAltName fields were found") diff --git a/billinglayer/python/urllib3/util/ssltransport.py b/billinglayer/python/urllib3/util/ssltransport.py new file mode 100644 index 0000000..5ec8647 --- /dev/null +++ b/billinglayer/python/urllib3/util/ssltransport.py @@ -0,0 +1,280 @@ +from __future__ import annotations + +import io +import socket +import ssl +import typing + +from ..exceptions import ProxySchemeUnsupported + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + + from .ssl_ import _TYPE_PEER_CERT_RET, _TYPE_PEER_CERT_RET_DICT + + +_SelfT = typing.TypeVar("_SelfT", bound="SSLTransport") +_WriteBuffer = typing.Union[bytearray, memoryview] +_ReturnValue = typing.TypeVar("_ReturnValue") + +SSL_BLOCKSIZE = 16384 + + +class SSLTransport: + """ + The SSLTransport wraps an existing socket and establishes an SSL connection. + + Contrary to Python's implementation of SSLSocket, it allows you to chain + multiple TLS connections together. It's particularly useful if you need to + implement TLS within TLS. + + The class supports most of the socket API operations. + """ + + @staticmethod + def _validate_ssl_context_for_tls_in_tls(ssl_context: ssl.SSLContext) -> None: + """ + Raises a ProxySchemeUnsupported if the provided ssl_context can't be used + for TLS in TLS. + + The only requirement is that the ssl_context provides the 'wrap_bio' + methods. + """ + + if not hasattr(ssl_context, "wrap_bio"): + raise ProxySchemeUnsupported( + "TLS in TLS requires SSLContext.wrap_bio() which isn't " + "available on non-native SSLContext" + ) + + def __init__( + self, + socket: socket.socket, + ssl_context: ssl.SSLContext, + server_hostname: str | None = None, + suppress_ragged_eofs: bool = True, + ) -> None: + """ + Create an SSLTransport around socket using the provided ssl_context. + """ + self.incoming = ssl.MemoryBIO() + self.outgoing = ssl.MemoryBIO() + + self.suppress_ragged_eofs = suppress_ragged_eofs + self.socket = socket + + self.sslobj = ssl_context.wrap_bio( + self.incoming, self.outgoing, server_hostname=server_hostname + ) + + # Perform initial handshake. + self._ssl_io_loop(self.sslobj.do_handshake) + + def __enter__(self: _SelfT) -> _SelfT: + return self + + def __exit__(self, *_: typing.Any) -> None: + self.close() + + def fileno(self) -> int: + return self.socket.fileno() + + def read(self, len: int = 1024, buffer: typing.Any | None = None) -> int | bytes: + return self._wrap_ssl_read(len, buffer) + + def recv(self, buflen: int = 1024, flags: int = 0) -> int | bytes: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv") + return self._wrap_ssl_read(buflen) + + def recv_into( + self, + buffer: _WriteBuffer, + nbytes: int | None = None, + flags: int = 0, + ) -> None | int | bytes: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv_into") + if nbytes is None: + nbytes = len(buffer) + return self.read(nbytes, buffer) + + def sendall(self, data: bytes, flags: int = 0) -> None: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to sendall") + count = 0 + with memoryview(data) as view, view.cast("B") as byte_view: + amount = len(byte_view) + while count < amount: + v = self.send(byte_view[count:]) + count += v + + def send(self, data: bytes, flags: int = 0) -> int: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to send") + return self._ssl_io_loop(self.sslobj.write, data) + + def makefile( + self, + mode: str, + buffering: int | None = None, + *, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + ) -> typing.BinaryIO | typing.TextIO | socket.SocketIO: + """ + Python's httpclient uses makefile and buffered io when reading HTTP + messages and we need to support it. + + This is unfortunately a copy and paste of socket.py makefile with small + changes to point to the socket directly. + """ + if not set(mode) <= {"r", "w", "b"}: + raise ValueError(f"invalid mode {mode!r} (only r, w, b allowed)") + + writing = "w" in mode + reading = "r" in mode or not writing + assert reading or writing + binary = "b" in mode + rawmode = "" + if reading: + rawmode += "r" + if writing: + rawmode += "w" + raw = socket.SocketIO(self, rawmode) # type: ignore[arg-type] + self.socket._io_refs += 1 # type: ignore[attr-defined] + if buffering is None: + buffering = -1 + if buffering < 0: + buffering = io.DEFAULT_BUFFER_SIZE + if buffering == 0: + if not binary: + raise ValueError("unbuffered streams must be binary") + return raw + buffer: typing.BinaryIO + if reading and writing: + buffer = io.BufferedRWPair(raw, raw, buffering) # type: ignore[assignment] + elif reading: + buffer = io.BufferedReader(raw, buffering) + else: + assert writing + buffer = io.BufferedWriter(raw, buffering) + if binary: + return buffer + text = io.TextIOWrapper(buffer, encoding, errors, newline) + text.mode = mode # type: ignore[misc] + return text + + def unwrap(self) -> None: + self._ssl_io_loop(self.sslobj.unwrap) + + def close(self) -> None: + self.socket.close() + + @typing.overload + def getpeercert( + self, binary_form: Literal[False] = ... + ) -> _TYPE_PEER_CERT_RET_DICT | None: + ... + + @typing.overload + def getpeercert(self, binary_form: Literal[True]) -> bytes | None: + ... + + def getpeercert(self, binary_form: bool = False) -> _TYPE_PEER_CERT_RET: + return self.sslobj.getpeercert(binary_form) # type: ignore[return-value] + + def version(self) -> str | None: + return self.sslobj.version() + + def cipher(self) -> tuple[str, str, int] | None: + return self.sslobj.cipher() + + def selected_alpn_protocol(self) -> str | None: + return self.sslobj.selected_alpn_protocol() + + def selected_npn_protocol(self) -> str | None: + return self.sslobj.selected_npn_protocol() + + def shared_ciphers(self) -> list[tuple[str, str, int]] | None: + return self.sslobj.shared_ciphers() + + def compression(self) -> str | None: + return self.sslobj.compression() + + def settimeout(self, value: float | None) -> None: + self.socket.settimeout(value) + + def gettimeout(self) -> float | None: + return self.socket.gettimeout() + + def _decref_socketios(self) -> None: + self.socket._decref_socketios() # type: ignore[attr-defined] + + def _wrap_ssl_read(self, len: int, buffer: bytearray | None = None) -> int | bytes: + try: + return self._ssl_io_loop(self.sslobj.read, len, buffer) + except ssl.SSLError as e: + if e.errno == ssl.SSL_ERROR_EOF and self.suppress_ragged_eofs: + return 0 # eof, return 0. + else: + raise + + # func is sslobj.do_handshake or sslobj.unwrap + @typing.overload + def _ssl_io_loop(self, func: typing.Callable[[], None]) -> None: + ... + + # func is sslobj.write, arg1 is data + @typing.overload + def _ssl_io_loop(self, func: typing.Callable[[bytes], int], arg1: bytes) -> int: + ... + + # func is sslobj.read, arg1 is len, arg2 is buffer + @typing.overload + def _ssl_io_loop( + self, + func: typing.Callable[[int, bytearray | None], bytes], + arg1: int, + arg2: bytearray | None, + ) -> bytes: + ... + + def _ssl_io_loop( + self, + func: typing.Callable[..., _ReturnValue], + arg1: None | bytes | int = None, + arg2: bytearray | None = None, + ) -> _ReturnValue: + """Performs an I/O loop between incoming/outgoing and the socket.""" + should_loop = True + ret = None + + while should_loop: + errno = None + try: + if arg1 is None and arg2 is None: + ret = func() + elif arg2 is None: + ret = func(arg1) + else: + ret = func(arg1, arg2) + except ssl.SSLError as e: + if e.errno not in (ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE): + # WANT_READ, and WANT_WRITE are expected, others are not. + raise e + errno = e.errno + + buf = self.outgoing.read() + self.socket.sendall(buf) + + if errno is None: + should_loop = False + elif errno == ssl.SSL_ERROR_WANT_READ: + buf = self.socket.recv(SSL_BLOCKSIZE) + if buf: + self.incoming.write(buf) + else: + self.incoming.write_eof() + return typing.cast(_ReturnValue, ret) diff --git a/billinglayer/python/urllib3/util/timeout.py b/billinglayer/python/urllib3/util/timeout.py new file mode 100644 index 0000000..ec090f6 --- /dev/null +++ b/billinglayer/python/urllib3/util/timeout.py @@ -0,0 +1,279 @@ +from __future__ import annotations + +import time +import typing +from enum import Enum +from socket import getdefaulttimeout + +from ..exceptions import TimeoutStateError + +if typing.TYPE_CHECKING: + from typing_extensions import Final + + +class _TYPE_DEFAULT(Enum): + # This value should never be passed to socket.settimeout() so for safety we use a -1. + # socket.settimout() raises a ValueError for negative values. + token = -1 + + +_DEFAULT_TIMEOUT: Final[_TYPE_DEFAULT] = _TYPE_DEFAULT.token + +_TYPE_TIMEOUT = typing.Optional[typing.Union[float, _TYPE_DEFAULT]] + + +class Timeout: + """Timeout configuration. + + Timeouts can be defined as a default for a pool: + + .. code-block:: python + + import urllib3 + + timeout = urllib3.util.Timeout(connect=2.0, read=7.0) + + http = urllib3.PoolManager(timeout=timeout) + + resp = http.request("GET", "https://example.com/") + + print(resp.status) + + Or per-request (which overrides the default for the pool): + + .. code-block:: python + + response = http.request("GET", "https://example.com/", timeout=Timeout(10)) + + Timeouts can be disabled by setting all the parameters to ``None``: + + .. code-block:: python + + no_timeout = Timeout(connect=None, read=None) + response = http.request("GET", "https://example.com/", timeout=no_timeout) + + + :param total: + This combines the connect and read timeouts into one; the read timeout + will be set to the time leftover from the connect attempt. In the + event that both a connect timeout and a total are specified, or a read + timeout and a total are specified, the shorter timeout will be applied. + + Defaults to None. + + :type total: int, float, or None + + :param connect: + The maximum amount of time (in seconds) to wait for a connection + attempt to a server to succeed. Omitting the parameter will default the + connect timeout to the system default, probably `the global default + timeout in socket.py + `_. + None will set an infinite timeout for connection attempts. + + :type connect: int, float, or None + + :param read: + The maximum amount of time (in seconds) to wait between consecutive + read operations for a response from the server. Omitting the parameter + will default the read timeout to the system default, probably `the + global default timeout in socket.py + `_. + None will set an infinite timeout. + + :type read: int, float, or None + + .. note:: + + Many factors can affect the total amount of time for urllib3 to return + an HTTP response. + + For example, Python's DNS resolver does not obey the timeout specified + on the socket. Other factors that can affect total request time include + high CPU load, high swap, the program running at a low priority level, + or other behaviors. + + In addition, the read and total timeouts only measure the time between + read operations on the socket connecting the client and the server, + not the total amount of time for the request to return a complete + response. For most requests, the timeout is raised because the server + has not sent the first byte in the specified time. This is not always + the case; if a server streams one byte every fifteen seconds, a timeout + of 20 seconds will not trigger, even though the request will take + several minutes to complete. + + If your goal is to cut off any request after a set amount of wall clock + time, consider having a second "watcher" thread to cut off a slow + request. + """ + + #: A sentinel object representing the default timeout value + DEFAULT_TIMEOUT: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT + + def __init__( + self, + total: _TYPE_TIMEOUT = None, + connect: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + read: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + ) -> None: + self._connect = self._validate_timeout(connect, "connect") + self._read = self._validate_timeout(read, "read") + self.total = self._validate_timeout(total, "total") + self._start_connect: float | None = None + + def __repr__(self) -> str: + return f"{type(self).__name__}(connect={self._connect!r}, read={self._read!r}, total={self.total!r})" + + # __str__ provided for backwards compatibility + __str__ = __repr__ + + @staticmethod + def resolve_default_timeout(timeout: _TYPE_TIMEOUT) -> float | None: + return getdefaulttimeout() if timeout is _DEFAULT_TIMEOUT else timeout + + @classmethod + def _validate_timeout(cls, value: _TYPE_TIMEOUT, name: str) -> _TYPE_TIMEOUT: + """Check that a timeout attribute is valid. + + :param value: The timeout value to validate + :param name: The name of the timeout attribute to validate. This is + used to specify in error messages. + :return: The validated and casted version of the given value. + :raises ValueError: If it is a numeric value less than or equal to + zero, or the type is not an integer, float, or None. + """ + if value is None or value is _DEFAULT_TIMEOUT: + return value + + if isinstance(value, bool): + raise ValueError( + "Timeout cannot be a boolean value. It must " + "be an int, float or None." + ) + try: + float(value) + except (TypeError, ValueError): + raise ValueError( + "Timeout value %s was %s, but it must be an " + "int, float or None." % (name, value) + ) from None + + try: + if value <= 0: + raise ValueError( + "Attempted to set %s timeout to %s, but the " + "timeout cannot be set to a value less " + "than or equal to 0." % (name, value) + ) + except TypeError: + raise ValueError( + "Timeout value %s was %s, but it must be an " + "int, float or None." % (name, value) + ) from None + + return value + + @classmethod + def from_float(cls, timeout: _TYPE_TIMEOUT) -> Timeout: + """Create a new Timeout from a legacy timeout value. + + The timeout value used by httplib.py sets the same timeout on the + connect(), and recv() socket requests. This creates a :class:`Timeout` + object that sets the individual timeouts to the ``timeout`` value + passed to this function. + + :param timeout: The legacy timeout value. + :type timeout: integer, float, :attr:`urllib3.util.Timeout.DEFAULT_TIMEOUT`, or None + :return: Timeout object + :rtype: :class:`Timeout` + """ + return Timeout(read=timeout, connect=timeout) + + def clone(self) -> Timeout: + """Create a copy of the timeout object + + Timeout properties are stored per-pool but each request needs a fresh + Timeout object to ensure each one has its own start/stop configured. + + :return: a copy of the timeout object + :rtype: :class:`Timeout` + """ + # We can't use copy.deepcopy because that will also create a new object + # for _GLOBAL_DEFAULT_TIMEOUT, which socket.py uses as a sentinel to + # detect the user default. + return Timeout(connect=self._connect, read=self._read, total=self.total) + + def start_connect(self) -> float: + """Start the timeout clock, used during a connect() attempt + + :raises urllib3.exceptions.TimeoutStateError: if you attempt + to start a timer that has been started already. + """ + if self._start_connect is not None: + raise TimeoutStateError("Timeout timer has already been started.") + self._start_connect = time.monotonic() + return self._start_connect + + def get_connect_duration(self) -> float: + """Gets the time elapsed since the call to :meth:`start_connect`. + + :return: Elapsed time in seconds. + :rtype: float + :raises urllib3.exceptions.TimeoutStateError: if you attempt + to get duration for a timer that hasn't been started. + """ + if self._start_connect is None: + raise TimeoutStateError( + "Can't get connect duration for timer that has not started." + ) + return time.monotonic() - self._start_connect + + @property + def connect_timeout(self) -> _TYPE_TIMEOUT: + """Get the value to use when setting a connection timeout. + + This will be a positive float or integer, the value None + (never timeout), or the default system timeout. + + :return: Connect timeout. + :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None + """ + if self.total is None: + return self._connect + + if self._connect is None or self._connect is _DEFAULT_TIMEOUT: + return self.total + + return min(self._connect, self.total) # type: ignore[type-var] + + @property + def read_timeout(self) -> float | None: + """Get the value for the read timeout. + + This assumes some time has elapsed in the connection timeout and + computes the read timeout appropriately. + + If self.total is set, the read timeout is dependent on the amount of + time taken by the connect timeout. If the connection time has not been + established, a :exc:`~urllib3.exceptions.TimeoutStateError` will be + raised. + + :return: Value to use for the read timeout. + :rtype: int, float or None + :raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect` + has not yet been called on this object. + """ + if ( + self.total is not None + and self.total is not _DEFAULT_TIMEOUT + and self._read is not None + and self._read is not _DEFAULT_TIMEOUT + ): + # In case the connect timeout has not yet been established. + if self._start_connect is None: + return self._read + return max(0, min(self.total - self.get_connect_duration(), self._read)) + elif self.total is not None and self.total is not _DEFAULT_TIMEOUT: + return max(0, self.total - self.get_connect_duration()) + else: + return self.resolve_default_timeout(self._read) diff --git a/billinglayer/python/urllib3/util/url.py b/billinglayer/python/urllib3/util/url.py new file mode 100644 index 0000000..d53ea93 --- /dev/null +++ b/billinglayer/python/urllib3/util/url.py @@ -0,0 +1,471 @@ +from __future__ import annotations + +import re +import typing + +from ..exceptions import LocationParseError +from .util import to_str + +# We only want to normalize urls with an HTTP(S) scheme. +# urllib3 infers URLs without a scheme (None) to be http. +_NORMALIZABLE_SCHEMES = ("http", "https", None) + +# Almost all of these patterns were derived from the +# 'rfc3986' module: https://github.com/python-hyper/rfc3986 +_PERCENT_RE = re.compile(r"%[a-fA-F0-9]{2}") +_SCHEME_RE = re.compile(r"^(?:[a-zA-Z][a-zA-Z0-9+-]*:|/)") +_URI_RE = re.compile( + r"^(?:([a-zA-Z][a-zA-Z0-9+.-]*):)?" + r"(?://([^\\/?#]*))?" + r"([^?#]*)" + r"(?:\?([^#]*))?" + r"(?:#(.*))?$", + re.UNICODE | re.DOTALL, +) + +_IPV4_PAT = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" +_HEX_PAT = "[0-9A-Fa-f]{1,4}" +_LS32_PAT = "(?:{hex}:{hex}|{ipv4})".format(hex=_HEX_PAT, ipv4=_IPV4_PAT) +_subs = {"hex": _HEX_PAT, "ls32": _LS32_PAT} +_variations = [ + # 6( h16 ":" ) ls32 + "(?:%(hex)s:){6}%(ls32)s", + # "::" 5( h16 ":" ) ls32 + "::(?:%(hex)s:){5}%(ls32)s", + # [ h16 ] "::" 4( h16 ":" ) ls32 + "(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)s", + # [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + "(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)s", + # [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + "(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)s", + # [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + "(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)s", + # [ *4( h16 ":" ) h16 ] "::" ls32 + "(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)s", + # [ *5( h16 ":" ) h16 ] "::" h16 + "(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)s", + # [ *6( h16 ":" ) h16 ] "::" + "(?:(?:%(hex)s:){0,6}%(hex)s)?::", +] + +_UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~" +_IPV6_PAT = "(?:" + "|".join([x % _subs for x in _variations]) + ")" +_ZONE_ID_PAT = "(?:%25|%)(?:[" + _UNRESERVED_PAT + "]|%[a-fA-F0-9]{2})+" +_IPV6_ADDRZ_PAT = r"\[" + _IPV6_PAT + r"(?:" + _ZONE_ID_PAT + r")?\]" +_REG_NAME_PAT = r"(?:[^\[\]%:/?#]|%[a-fA-F0-9]{2})*" +_TARGET_RE = re.compile(r"^(/[^?#]*)(?:\?([^#]*))?(?:#.*)?$") + +_IPV4_RE = re.compile("^" + _IPV4_PAT + "$") +_IPV6_RE = re.compile("^" + _IPV6_PAT + "$") +_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT + "$") +_BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT[2:-2] + "$") +_ZONE_ID_RE = re.compile("(" + _ZONE_ID_PAT + r")\]$") + +_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|[1-9][0-9]{0,4}))?$") % ( + _REG_NAME_PAT, + _IPV4_PAT, + _IPV6_ADDRZ_PAT, +) +_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL) + +_UNRESERVED_CHARS = set( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~" +) +_SUB_DELIM_CHARS = set("!$&'()*+,;=") +_USERINFO_CHARS = _UNRESERVED_CHARS | _SUB_DELIM_CHARS | {":"} +_PATH_CHARS = _USERINFO_CHARS | {"@", "/"} +_QUERY_CHARS = _FRAGMENT_CHARS = _PATH_CHARS | {"?"} + + +class Url( + typing.NamedTuple( + "Url", + [ + ("scheme", typing.Optional[str]), + ("auth", typing.Optional[str]), + ("host", typing.Optional[str]), + ("port", typing.Optional[int]), + ("path", typing.Optional[str]), + ("query", typing.Optional[str]), + ("fragment", typing.Optional[str]), + ], + ) +): + """ + Data structure for representing an HTTP URL. Used as a return value for + :func:`parse_url`. Both the scheme and host are normalized as they are + both case-insensitive according to RFC 3986. + """ + + def __new__( # type: ignore[no-untyped-def] + cls, + scheme: str | None = None, + auth: str | None = None, + host: str | None = None, + port: int | None = None, + path: str | None = None, + query: str | None = None, + fragment: str | None = None, + ): + if path and not path.startswith("/"): + path = "/" + path + if scheme is not None: + scheme = scheme.lower() + return super().__new__(cls, scheme, auth, host, port, path, query, fragment) + + @property + def hostname(self) -> str | None: + """For backwards-compatibility with urlparse. We're nice like that.""" + return self.host + + @property + def request_uri(self) -> str: + """Absolute path including the query string.""" + uri = self.path or "/" + + if self.query is not None: + uri += "?" + self.query + + return uri + + @property + def authority(self) -> str | None: + """ + Authority component as defined in RFC 3986 3.2. + This includes userinfo (auth), host and port. + + i.e. + userinfo@host:port + """ + userinfo = self.auth + netloc = self.netloc + if netloc is None or userinfo is None: + return netloc + else: + return f"{userinfo}@{netloc}" + + @property + def netloc(self) -> str | None: + """ + Network location including host and port. + + If you need the equivalent of urllib.parse's ``netloc``, + use the ``authority`` property instead. + """ + if self.host is None: + return None + if self.port: + return f"{self.host}:{self.port}" + return self.host + + @property + def url(self) -> str: + """ + Convert self into a url + + This function should more or less round-trip with :func:`.parse_url`. The + returned url may not be exactly the same as the url inputted to + :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls + with a blank port will have : removed). + + Example: + + .. code-block:: python + + import urllib3 + + U = urllib3.util.parse_url("https://google.com/mail/") + + print(U.url) + # "https://google.com/mail/" + + print( urllib3.util.Url("https", "username:password", + "host.com", 80, "/path", "query", "fragment" + ).url + ) + # "https://username:password@host.com:80/path?query#fragment" + """ + scheme, auth, host, port, path, query, fragment = self + url = "" + + # We use "is not None" we want things to happen with empty strings (or 0 port) + if scheme is not None: + url += scheme + "://" + if auth is not None: + url += auth + "@" + if host is not None: + url += host + if port is not None: + url += ":" + str(port) + if path is not None: + url += path + if query is not None: + url += "?" + query + if fragment is not None: + url += "#" + fragment + + return url + + def __str__(self) -> str: + return self.url + + +@typing.overload +def _encode_invalid_chars( + component: str, allowed_chars: typing.Container[str] +) -> str: # Abstract + ... + + +@typing.overload +def _encode_invalid_chars( + component: None, allowed_chars: typing.Container[str] +) -> None: # Abstract + ... + + +def _encode_invalid_chars( + component: str | None, allowed_chars: typing.Container[str] +) -> str | None: + """Percent-encodes a URI component without reapplying + onto an already percent-encoded component. + """ + if component is None: + return component + + component = to_str(component) + + # Normalize existing percent-encoded bytes. + # Try to see if the component we're encoding is already percent-encoded + # so we can skip all '%' characters but still encode all others. + component, percent_encodings = _PERCENT_RE.subn( + lambda match: match.group(0).upper(), component + ) + + uri_bytes = component.encode("utf-8", "surrogatepass") + is_percent_encoded = percent_encodings == uri_bytes.count(b"%") + encoded_component = bytearray() + + for i in range(0, len(uri_bytes)): + # Will return a single character bytestring + byte = uri_bytes[i : i + 1] + byte_ord = ord(byte) + if (is_percent_encoded and byte == b"%") or ( + byte_ord < 128 and byte.decode() in allowed_chars + ): + encoded_component += byte + continue + encoded_component.extend(b"%" + (hex(byte_ord)[2:].encode().zfill(2).upper())) + + return encoded_component.decode() + + +def _remove_path_dot_segments(path: str) -> str: + # See http://tools.ietf.org/html/rfc3986#section-5.2.4 for pseudo-code + segments = path.split("/") # Turn the path into a list of segments + output = [] # Initialize the variable to use to store output + + for segment in segments: + # '.' is the current directory, so ignore it, it is superfluous + if segment == ".": + continue + # Anything other than '..', should be appended to the output + if segment != "..": + output.append(segment) + # In this case segment == '..', if we can, we should pop the last + # element + elif output: + output.pop() + + # If the path starts with '/' and the output is empty or the first string + # is non-empty + if path.startswith("/") and (not output or output[0]): + output.insert(0, "") + + # If the path starts with '/.' or '/..' ensure we add one more empty + # string to add a trailing '/' + if path.endswith(("/.", "/..")): + output.append("") + + return "/".join(output) + + +@typing.overload +def _normalize_host(host: None, scheme: str | None) -> None: + ... + + +@typing.overload +def _normalize_host(host: str, scheme: str | None) -> str: + ... + + +def _normalize_host(host: str | None, scheme: str | None) -> str | None: + if host: + if scheme in _NORMALIZABLE_SCHEMES: + is_ipv6 = _IPV6_ADDRZ_RE.match(host) + if is_ipv6: + # IPv6 hosts of the form 'a::b%zone' are encoded in a URL as + # such per RFC 6874: 'a::b%25zone'. Unquote the ZoneID + # separator as necessary to return a valid RFC 4007 scoped IP. + match = _ZONE_ID_RE.search(host) + if match: + start, end = match.span(1) + zone_id = host[start:end] + + if zone_id.startswith("%25") and zone_id != "%25": + zone_id = zone_id[3:] + else: + zone_id = zone_id[1:] + zone_id = _encode_invalid_chars(zone_id, _UNRESERVED_CHARS) + return f"{host[:start].lower()}%{zone_id}{host[end:]}" + else: + return host.lower() + elif not _IPV4_RE.match(host): + return to_str( + b".".join([_idna_encode(label) for label in host.split(".")]), + "ascii", + ) + return host + + +def _idna_encode(name: str) -> bytes: + if not name.isascii(): + try: + import idna + except ImportError: + raise LocationParseError( + "Unable to parse URL without the 'idna' module" + ) from None + + try: + return idna.encode(name.lower(), strict=True, std3_rules=True) + except idna.IDNAError: + raise LocationParseError( + f"Name '{name}' is not a valid IDNA label" + ) from None + + return name.lower().encode("ascii") + + +def _encode_target(target: str) -> str: + """Percent-encodes a request target so that there are no invalid characters + + Pre-condition for this function is that 'target' must start with '/'. + If that is the case then _TARGET_RE will always produce a match. + """ + match = _TARGET_RE.match(target) + if not match: # Defensive: + raise LocationParseError(f"{target!r} is not a valid request URI") + + path, query = match.groups() + encoded_target = _encode_invalid_chars(path, _PATH_CHARS) + if query is not None: + query = _encode_invalid_chars(query, _QUERY_CHARS) + encoded_target += "?" + query + return encoded_target + + +def parse_url(url: str) -> Url: + """ + Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is + performed to parse incomplete urls. Fields not provided will be None. + This parser is RFC 3986 and RFC 6874 compliant. + + The parser logic and helper functions are based heavily on + work done in the ``rfc3986`` module. + + :param str url: URL to parse into a :class:`.Url` namedtuple. + + Partly backwards-compatible with :mod:`urllib.parse`. + + Example: + + .. code-block:: python + + import urllib3 + + print( urllib3.util.parse_url('http://google.com/mail/')) + # Url(scheme='http', host='google.com', port=None, path='/mail/', ...) + + print( urllib3.util.parse_url('google.com:80')) + # Url(scheme=None, host='google.com', port=80, path=None, ...) + + print( urllib3.util.parse_url('/foo?bar')) + # Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...) + """ + if not url: + # Empty + return Url() + + source_url = url + if not _SCHEME_RE.search(url): + url = "//" + url + + scheme: str | None + authority: str | None + auth: str | None + host: str | None + port: str | None + port_int: int | None + path: str | None + query: str | None + fragment: str | None + + try: + scheme, authority, path, query, fragment = _URI_RE.match(url).groups() # type: ignore[union-attr] + normalize_uri = scheme is None or scheme.lower() in _NORMALIZABLE_SCHEMES + + if scheme: + scheme = scheme.lower() + + if authority: + auth, _, host_port = authority.rpartition("@") + auth = auth or None + host, port = _HOST_PORT_RE.match(host_port).groups() # type: ignore[union-attr] + if auth and normalize_uri: + auth = _encode_invalid_chars(auth, _USERINFO_CHARS) + if port == "": + port = None + else: + auth, host, port = None, None, None + + if port is not None: + port_int = int(port) + if not (0 <= port_int <= 65535): + raise LocationParseError(url) + else: + port_int = None + + host = _normalize_host(host, scheme) + + if normalize_uri and path: + path = _remove_path_dot_segments(path) + path = _encode_invalid_chars(path, _PATH_CHARS) + if normalize_uri and query: + query = _encode_invalid_chars(query, _QUERY_CHARS) + if normalize_uri and fragment: + fragment = _encode_invalid_chars(fragment, _FRAGMENT_CHARS) + + except (ValueError, AttributeError) as e: + raise LocationParseError(source_url) from e + + # For the sake of backwards compatibility we put empty + # string values for path if there are any defined values + # beyond the path in the URL. + # TODO: Remove this when we break backwards compatibility. + if not path: + if query is not None or fragment is not None: + path = "" + else: + path = None + + return Url( + scheme=scheme, + auth=auth, + host=host, + port=port_int, + path=path, + query=query, + fragment=fragment, + ) diff --git a/billinglayer/python/urllib3/util/util.py b/billinglayer/python/urllib3/util/util.py new file mode 100644 index 0000000..35c77e4 --- /dev/null +++ b/billinglayer/python/urllib3/util/util.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +import typing +from types import TracebackType + + +def to_bytes( + x: str | bytes, encoding: str | None = None, errors: str | None = None +) -> bytes: + if isinstance(x, bytes): + return x + elif not isinstance(x, str): + raise TypeError(f"not expecting type {type(x).__name__}") + if encoding or errors: + return x.encode(encoding or "utf-8", errors=errors or "strict") + return x.encode() + + +def to_str( + x: str | bytes, encoding: str | None = None, errors: str | None = None +) -> str: + if isinstance(x, str): + return x + elif not isinstance(x, bytes): + raise TypeError(f"not expecting type {type(x).__name__}") + if encoding or errors: + return x.decode(encoding or "utf-8", errors=errors or "strict") + return x.decode() + + +def reraise( + tp: type[BaseException] | None, + value: BaseException, + tb: TracebackType | None = None, +) -> typing.NoReturn: + try: + if value.__traceback__ is not tb: + raise value.with_traceback(tb) + raise value + finally: + value = None # type: ignore[assignment] + tb = None diff --git a/billinglayer/python/urllib3/util/wait.py b/billinglayer/python/urllib3/util/wait.py new file mode 100644 index 0000000..aeca0c7 --- /dev/null +++ b/billinglayer/python/urllib3/util/wait.py @@ -0,0 +1,124 @@ +from __future__ import annotations + +import select +import socket +from functools import partial + +__all__ = ["wait_for_read", "wait_for_write"] + + +# How should we wait on sockets? +# +# There are two types of APIs you can use for waiting on sockets: the fancy +# modern stateful APIs like epoll/kqueue, and the older stateless APIs like +# select/poll. The stateful APIs are more efficient when you have a lots of +# sockets to keep track of, because you can set them up once and then use them +# lots of times. But we only ever want to wait on a single socket at a time +# and don't want to keep track of state, so the stateless APIs are actually +# more efficient. So we want to use select() or poll(). +# +# Now, how do we choose between select() and poll()? On traditional Unixes, +# select() has a strange calling convention that makes it slow, or fail +# altogether, for high-numbered file descriptors. The point of poll() is to fix +# that, so on Unixes, we prefer poll(). +# +# On Windows, there is no poll() (or at least Python doesn't provide a wrapper +# for it), but that's OK, because on Windows, select() doesn't have this +# strange calling convention; plain select() works fine. +# +# So: on Windows we use select(), and everywhere else we use poll(). We also +# fall back to select() in case poll() is somehow broken or missing. + + +def select_wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + if not read and not write: + raise RuntimeError("must specify at least one of read=True, write=True") + rcheck = [] + wcheck = [] + if read: + rcheck.append(sock) + if write: + wcheck.append(sock) + # When doing a non-blocking connect, most systems signal success by + # marking the socket writable. Windows, though, signals success by marked + # it as "exceptional". We paper over the difference by checking the write + # sockets for both conditions. (The stdlib selectors module does the same + # thing.) + fn = partial(select.select, rcheck, wcheck, wcheck) + rready, wready, xready = fn(timeout) + return bool(rready or wready or xready) + + +def poll_wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + if not read and not write: + raise RuntimeError("must specify at least one of read=True, write=True") + mask = 0 + if read: + mask |= select.POLLIN + if write: + mask |= select.POLLOUT + poll_obj = select.poll() + poll_obj.register(sock, mask) + + # For some reason, poll() takes timeout in milliseconds + def do_poll(t: float | None) -> list[tuple[int, int]]: + if t is not None: + t *= 1000 + return poll_obj.poll(t) + + return bool(do_poll(timeout)) + + +def _have_working_poll() -> bool: + # Apparently some systems have a select.poll that fails as soon as you try + # to use it, either due to strange configuration or broken monkeypatching + # from libraries like eventlet/greenlet. + try: + poll_obj = select.poll() + poll_obj.poll(0) + except (AttributeError, OSError): + return False + else: + return True + + +def wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + # We delay choosing which implementation to use until the first time we're + # called. We could do it at import time, but then we might make the wrong + # decision if someone goes wild with monkeypatching select.poll after + # we're imported. + global wait_for_socket + if _have_working_poll(): + wait_for_socket = poll_wait_for_socket + elif hasattr(select, "select"): + wait_for_socket = select_wait_for_socket + return wait_for_socket(sock, read, write, timeout) + + +def wait_for_read(sock: socket.socket, timeout: float | None = None) -> bool: + """Waits for reading to be available on a given socket. + Returns True if the socket is readable, or False if the timeout expired. + """ + return wait_for_socket(sock, read=True, timeout=timeout) + + +def wait_for_write(sock: socket.socket, timeout: float | None = None) -> bool: + """Waits for writing to be available on a given socket. + Returns True if the socket is readable, or False if the timeout expired. + """ + return wait_for_socket(sock, write=True, timeout=timeout) diff --git a/billinglayer/python/xlsxwriter/__init__.py b/billinglayer/python/xlsxwriter/__init__.py new file mode 100644 index 0000000..d91139d --- /dev/null +++ b/billinglayer/python/xlsxwriter/__init__.py @@ -0,0 +1,7 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +__version__ = "3.1.2" +__VERSION__ = __version__ +from .workbook import Workbook # noqa diff --git a/billinglayer/python/xlsxwriter/__pycache__/__init__.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..82d7905 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/__init__.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/app.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/app.cpython-311.pyc new file mode 100644 index 0000000..2955a67 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/app.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart.cpython-311.pyc new file mode 100644 index 0000000..1f198f9 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_area.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_area.cpython-311.pyc new file mode 100644 index 0000000..e3c594c Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_area.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_bar.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_bar.cpython-311.pyc new file mode 100644 index 0000000..d20d683 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_bar.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_column.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_column.cpython-311.pyc new file mode 100644 index 0000000..427e3f7 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_column.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_doughnut.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_doughnut.cpython-311.pyc new file mode 100644 index 0000000..a893d43 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_doughnut.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_line.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_line.cpython-311.pyc new file mode 100644 index 0000000..e02126e Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_line.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_pie.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_pie.cpython-311.pyc new file mode 100644 index 0000000..9fa966a Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_pie.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_radar.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_radar.cpython-311.pyc new file mode 100644 index 0000000..3c7fde5 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_radar.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_scatter.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_scatter.cpython-311.pyc new file mode 100644 index 0000000..851ee18 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_scatter.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chart_stock.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chart_stock.cpython-311.pyc new file mode 100644 index 0000000..463a613 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chart_stock.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/chartsheet.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/chartsheet.cpython-311.pyc new file mode 100644 index 0000000..def0b65 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/chartsheet.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/comments.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/comments.cpython-311.pyc new file mode 100644 index 0000000..64796e0 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/comments.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/contenttypes.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/contenttypes.cpython-311.pyc new file mode 100644 index 0000000..841e6a8 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/contenttypes.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/core.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..dcc6e9d Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/core.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/custom.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/custom.cpython-311.pyc new file mode 100644 index 0000000..8275002 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/custom.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/drawing.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/drawing.cpython-311.pyc new file mode 100644 index 0000000..b5f1aff Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/drawing.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/exceptions.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..2f0434a Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/exceptions.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/format.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/format.cpython-311.pyc new file mode 100644 index 0000000..dfd74d5 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/format.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/metadata.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/metadata.cpython-311.pyc new file mode 100644 index 0000000..2b8943a Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/metadata.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/packager.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/packager.cpython-311.pyc new file mode 100644 index 0000000..86501e0 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/packager.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/relationships.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/relationships.cpython-311.pyc new file mode 100644 index 0000000..ca67f06 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/relationships.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/shape.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/shape.cpython-311.pyc new file mode 100644 index 0000000..c69b368 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/shape.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/sharedstrings.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/sharedstrings.cpython-311.pyc new file mode 100644 index 0000000..f6e23fc Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/sharedstrings.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/styles.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/styles.cpython-311.pyc new file mode 100644 index 0000000..6d20803 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/styles.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/table.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/table.cpython-311.pyc new file mode 100644 index 0000000..c8cc621 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/table.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/theme.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/theme.cpython-311.pyc new file mode 100644 index 0000000..b8a6c04 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/theme.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/utility.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/utility.cpython-311.pyc new file mode 100644 index 0000000..af9e839 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/utility.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/vml.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/vml.cpython-311.pyc new file mode 100644 index 0000000..3476c11 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/vml.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/workbook.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/workbook.cpython-311.pyc new file mode 100644 index 0000000..afa4b6f Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/workbook.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/worksheet.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/worksheet.cpython-311.pyc new file mode 100644 index 0000000..ff13af3 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/worksheet.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/__pycache__/xmlwriter.cpython-311.pyc b/billinglayer/python/xlsxwriter/__pycache__/xmlwriter.cpython-311.pyc new file mode 100644 index 0000000..e044d35 Binary files /dev/null and b/billinglayer/python/xlsxwriter/__pycache__/xmlwriter.cpython-311.pyc differ diff --git a/billinglayer/python/xlsxwriter/app.py b/billinglayer/python/xlsxwriter/app.py new file mode 100644 index 0000000..2b7d5d6 --- /dev/null +++ b/billinglayer/python/xlsxwriter/app.py @@ -0,0 +1,198 @@ +############################################################################### +# +# App - A class for writing the Excel XLSX App file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class App(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX App file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(App, self).__init__() + + self.part_names = [] + self.heading_pairs = [] + self.properties = {} + self.doc_security = 0 + + def _add_part_name(self, part_name): + # Add the name of a workbook Part such as 'Sheet1' or 'Print_Titles'. + self.part_names.append(part_name) + + def _add_heading_pair(self, heading_pair): + # Add the name of a workbook Heading Pair such as 'Worksheets', + # 'Charts' or 'Named Ranges'. + + # Ignore empty pairs such as chartsheets. + if not heading_pair[1]: + return + + self.heading_pairs.append(("lpstr", heading_pair[0])) + self.heading_pairs.append(("i4", heading_pair[1])) + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_properties() + self._write_application() + self._write_doc_security() + self._write_scale_crop() + self._write_heading_pairs() + self._write_titles_of_parts() + self._write_manager() + self._write_company() + self._write_links_up_to_date() + self._write_shared_doc() + self._write_hyperlink_base() + self._write_hyperlinks_changed() + self._write_app_version() + + self._xml_end_tag("Properties") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_properties(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/2006/" + xmlns = schema + "extended-properties" + xmlns_vt = schema + "docPropsVTypes" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:vt", xmlns_vt), + ] + + self._xml_start_tag("Properties", attributes) + + def _write_application(self): + # Write the element. + self._xml_data_element("Application", "Microsoft Excel") + + def _write_doc_security(self): + # Write the element. + self._xml_data_element("DocSecurity", self.doc_security) + + def _write_scale_crop(self): + # Write the element. + self._xml_data_element("ScaleCrop", "false") + + def _write_heading_pairs(self): + # Write the element. + self._xml_start_tag("HeadingPairs") + self._write_vt_vector("variant", self.heading_pairs) + self._xml_end_tag("HeadingPairs") + + def _write_titles_of_parts(self): + # Write the element. + parts_data = [] + + self._xml_start_tag("TitlesOfParts") + + for part_name in self.part_names: + parts_data.append(("lpstr", part_name)) + + self._write_vt_vector("lpstr", parts_data) + + self._xml_end_tag("TitlesOfParts") + + def _write_vt_vector(self, base_type, vector_data): + # Write the element. + attributes = [ + ("size", len(vector_data)), + ("baseType", base_type), + ] + + self._xml_start_tag("vt:vector", attributes) + + for vt_data in vector_data: + if base_type == "variant": + self._xml_start_tag("vt:variant") + + self._write_vt_data(vt_data) + + if base_type == "variant": + self._xml_end_tag("vt:variant") + + self._xml_end_tag("vt:vector") + + def _write_vt_data(self, vt_data): + # Write the elements such as and . + self._xml_data_element("vt:%s" % vt_data[0], vt_data[1]) + + def _write_company(self): + company = self.properties.get("company", "") + + self._xml_data_element("Company", company) + + def _write_manager(self): + # Write the element. + if "manager" not in self.properties: + return + + self._xml_data_element("Manager", self.properties["manager"]) + + def _write_links_up_to_date(self): + # Write the element. + self._xml_data_element("LinksUpToDate", "false") + + def _write_shared_doc(self): + # Write the element. + self._xml_data_element("SharedDoc", "false") + + def _write_hyperlink_base(self): + # Write the element. + hyperlink_base = self.properties.get("hyperlink_base") + + if hyperlink_base is None: + return + + self._xml_data_element("HyperlinkBase", hyperlink_base) + + def _write_hyperlinks_changed(self): + # Write the element. + self._xml_data_element("HyperlinksChanged", "false") + + def _write_app_version(self): + # Write the element. + self._xml_data_element("AppVersion", "12.0000") diff --git a/billinglayer/python/xlsxwriter/chart.py b/billinglayer/python/xlsxwriter/chart.py new file mode 100644 index 0000000..d34fa83 --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart.py @@ -0,0 +1,4278 @@ +############################################################################### +# +# Chart - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import re +import copy +from warnings import warn + +from .shape import Shape +from . import xmlwriter +from .utility import get_rgb_color +from .utility import xl_rowcol_to_cell +from .utility import xl_range_formula +from .utility import supported_datetime +from .utility import datetime_to_excel_datetime +from .utility import quote_sheetname + + +class Chart(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Chart file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + + super(Chart, self).__init__() + + self.subtype = None + self.sheet_type = 0x0200 + self.orientation = 0x0 + self.series = [] + self.embedded = 0 + self.id = -1 + self.series_index = 0 + self.style_id = 2 + self.axis_ids = [] + self.axis2_ids = [] + self.cat_has_num_fmt = 0 + self.requires_category = False + self.legend = {} + self.cat_axis_position = "b" + self.val_axis_position = "l" + self.formula_ids = {} + self.formula_data = [] + self.horiz_cat_axis = 0 + self.horiz_val_axis = 1 + self.protection = 0 + self.chartarea = {} + self.plotarea = {} + self.x_axis = {} + self.y_axis = {} + self.y2_axis = {} + self.x2_axis = {} + self.chart_name = "" + self.show_blanks = "gap" + self.show_hidden = 0 + self.show_crosses = 1 + self.width = 480 + self.height = 288 + self.x_scale = 1 + self.y_scale = 1 + self.x_offset = 0 + self.y_offset = 0 + self.table = None + self.cross_between = "between" + self.default_marker = None + self.series_gap_1 = None + self.series_gap_2 = None + self.series_overlap_1 = None + self.series_overlap_2 = None + self.drop_lines = None + self.hi_low_lines = None + self.up_down_bars = None + self.smooth_allowed = False + self.title_font = None + self.title_name = None + self.title_formula = None + self.title_data_id = None + self.title_layout = None + self.title_overlay = None + self.title_none = False + self.date_category = False + self.date_1904 = False + self.remove_timezone = False + self.label_positions = {} + self.label_position_default = "" + self.already_inserted = False + self.combined = None + self.is_secondary = False + self.warn_sheetname = True + self._set_default_properties() + + def add_series(self, options=None): + """ + Add a data series to a chart. + + Args: + options: A dictionary of chart series options. + + Returns: + Nothing. + + """ + # Add a series and it's properties to a chart. + if options is None: + options = {} + + # Check that the required input has been specified. + if "values" not in options: + warn("Must specify 'values' in add_series()") + return + + if self.requires_category and "categories" not in options: + warn("Must specify 'categories' in add_series() for this chart type") + return + + if len(self.series) == 255: + warn( + "The maximum number of series that can be added to an " + "Excel Chart is 255" + ) + return + + # Convert list into a formula string. + values = self._list_to_formula(options.get("values")) + categories = self._list_to_formula(options.get("categories")) + + # Switch name and name_formula parameters if required. + name, name_formula = self._process_names( + options.get("name"), options.get("name_formula") + ) + + # Get an id for the data equivalent to the range formula. + cat_id = self._get_data_id(categories, options.get("categories_data")) + val_id = self._get_data_id(values, options.get("values_data")) + name_id = self._get_data_id(name_formula, options.get("name_data")) + + # Set the line properties for the series. + line = Shape._get_line_properties(options.get("line")) + + # Allow 'border' as a synonym for 'line' in bar/column style charts. + if options.get("border"): + line = Shape._get_line_properties(options["border"]) + + # Set the fill properties for the series. + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + # Set the marker properties for the series. + marker = self._get_marker_properties(options.get("marker")) + + # Set the trendline properties for the series. + trendline = self._get_trendline_properties(options.get("trendline")) + + # Set the line smooth property for the series. + smooth = options.get("smooth") + + # Set the error bars properties for the series. + y_error_bars = self._get_error_bars_props(options.get("y_error_bars")) + x_error_bars = self._get_error_bars_props(options.get("x_error_bars")) + + error_bars = {"x_error_bars": x_error_bars, "y_error_bars": y_error_bars} + + # Set the point properties for the series. + points = self._get_points_properties(options.get("points")) + + # Set the labels properties for the series. + labels = self._get_labels_properties(options.get("data_labels")) + + # Set the "invert if negative" fill property. + invert_if_neg = options.get("invert_if_negative", False) + inverted_color = options.get("invert_if_negative_color", False) + + # Set the secondary axis properties. + x2_axis = options.get("x2_axis") + y2_axis = options.get("y2_axis") + + # Store secondary status for combined charts. + if x2_axis or y2_axis: + self.is_secondary = True + + # Set the gap for Bar/Column charts. + if options.get("gap") is not None: + if y2_axis: + self.series_gap_2 = options["gap"] + else: + self.series_gap_1 = options["gap"] + + # Set the overlap for Bar/Column charts. + if options.get("overlap"): + if y2_axis: + self.series_overlap_2 = options["overlap"] + else: + self.series_overlap_1 = options["overlap"] + + # Add the user supplied data to the internal structures. + series = { + "values": values, + "categories": categories, + "name": name, + "name_formula": name_formula, + "name_id": name_id, + "val_data_id": val_id, + "cat_data_id": cat_id, + "line": line, + "fill": fill, + "pattern": pattern, + "gradient": gradient, + "marker": marker, + "trendline": trendline, + "labels": labels, + "invert_if_neg": invert_if_neg, + "inverted_color": inverted_color, + "x2_axis": x2_axis, + "y2_axis": y2_axis, + "points": points, + "error_bars": error_bars, + "smooth": smooth, + } + + self.series.append(series) + + def set_x_axis(self, options): + """ + Set the chart X axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.x_axis, options) + + self.x_axis = axis + + def set_y_axis(self, options): + """ + Set the chart Y axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.y_axis, options) + + self.y_axis = axis + + def set_x2_axis(self, options): + """ + Set the chart secondary X axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.x2_axis, options) + + self.x2_axis = axis + + def set_y2_axis(self, options): + """ + Set the chart secondary Y axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.y2_axis, options) + + self.y2_axis = axis + + def set_title(self, options=None): + """ + Set the chart title options. + + Args: + options: A dictionary of chart title options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + name, name_formula = self._process_names( + options.get("name"), options.get("name_formula") + ) + + data_id = self._get_data_id(name_formula, options.get("data")) + + self.title_name = name + self.title_formula = name_formula + self.title_data_id = data_id + + # Set the font properties if present. + self.title_font = self._convert_font_args(options.get("name_font")) + + # Set the axis name layout. + self.title_layout = self._get_layout_properties(options.get("layout"), True) + # Set the title overlay option. + self.title_overlay = options.get("overlay") + + # Set the automatic title option. + self.title_none = options.get("none") + + def set_legend(self, options): + """ + Set the chart legend options. + + Args: + options: A dictionary of chart legend options. + + Returns: + Nothing. + """ + # Convert the user defined properties to internal properties. + self.legend = self._get_legend_properties(options) + + def set_plotarea(self, options): + """ + Set the chart plot area options. + + Args: + options: A dictionary of chart plot area options. + + Returns: + Nothing. + """ + # Convert the user defined properties to internal properties. + self.plotarea = self._get_area_properties(options) + + def set_chartarea(self, options): + """ + Set the chart area options. + + Args: + options: A dictionary of chart area options. + + Returns: + Nothing. + """ + # Convert the user defined properties to internal properties. + self.chartarea = self._get_area_properties(options) + + def set_style(self, style_id): + """ + Set the chart style type. + + Args: + style_id: An int representing the chart style. + + Returns: + Nothing. + """ + # Set one of the 48 built-in Excel chart styles. The default is 2. + if style_id is None: + style_id = 2 + + if style_id < 1 or style_id > 48: + style_id = 2 + + self.style_id = style_id + + def show_blanks_as(self, option): + """ + Set the option for displaying blank data in a chart. + + Args: + option: A string representing the display option. + + Returns: + Nothing. + """ + if not option: + return + + valid_options = { + "gap": 1, + "zero": 1, + "span": 1, + } + + if option not in valid_options: + warn("Unknown show_blanks_as() option '%s'" % option) + return + + self.show_blanks = option + + def show_hidden_data(self): + """ + Display data on charts from hidden rows or columns. + + Args: + option: A string representing the display option. + + Returns: + Nothing. + """ + self.show_hidden = 1 + + def set_size(self, options=None): + """ + Set size or scale of the chart. + + Args: + options: A dictionary of chart size options. + + Returns: + Nothing. + """ + if options is None: + options = {} + + # Set dimensions or scale for the chart. + self.width = options.get("width", self.width) + self.height = options.get("height", self.height) + self.x_scale = options.get("x_scale", 1) + self.y_scale = options.get("y_scale", 1) + self.x_offset = options.get("x_offset", 0) + self.y_offset = options.get("y_offset", 0) + + def set_table(self, options=None): + """ + Set properties for an axis data table. + + Args: + options: A dictionary of axis table options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + table = {} + + table["horizontal"] = options.get("horizontal", 1) + table["vertical"] = options.get("vertical", 1) + table["outline"] = options.get("outline", 1) + table["show_keys"] = options.get("show_keys", 0) + table["font"] = self._convert_font_args(options.get("font")) + + self.table = table + + def set_up_down_bars(self, options=None): + """ + Set properties for the chart up-down bars. + + Args: + options: A dictionary of options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + # Defaults. + up_line = None + up_fill = None + down_line = None + down_fill = None + + # Set properties for 'up' bar. + if options.get("up"): + if "border" in options["up"]: + # Map border to line. + up_line = Shape._get_line_properties(options["up"]["border"]) + + if "line" in options["up"]: + up_line = Shape._get_line_properties(options["up"]["line"]) + + if "fill" in options["up"]: + up_fill = Shape._get_fill_properties(options["up"]["fill"]) + + # Set properties for 'down' bar. + if options.get("down"): + if "border" in options["down"]: + # Map border to line. + down_line = Shape._get_line_properties(options["down"]["border"]) + + if "line" in options["down"]: + down_line = Shape._get_line_properties(options["down"]["line"]) + + if "fill" in options["down"]: + down_fill = Shape._get_fill_properties(options["down"]["fill"]) + + self.up_down_bars = { + "up": { + "line": up_line, + "fill": up_fill, + }, + "down": { + "line": down_line, + "fill": down_fill, + }, + } + + def set_drop_lines(self, options=None): + """ + Set properties for the chart drop lines. + + Args: + options: A dictionary of options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + line = Shape._get_line_properties(options.get("line")) + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + self.drop_lines = { + "line": line, + "fill": fill, + "pattern": pattern, + "gradient": gradient, + } + + def set_high_low_lines(self, options=None): + """ + Set properties for the chart high-low lines. + + Args: + options: A dictionary of options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + line = Shape._get_line_properties(options.get("line")) + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + self.hi_low_lines = { + "line": line, + "fill": fill, + "pattern": pattern, + "gradient": gradient, + } + + def combine(self, chart=None): + """ + Create a combination chart with a secondary chart. + + Args: + chart: The secondary chart to combine with the primary chart. + + Returns: + Nothing. + + """ + if chart is None: + return + + self.combined = chart + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the c:chartSpace element. + self._write_chart_space() + + # Write the c:lang element. + self._write_lang() + + # Write the c:style element. + self._write_style() + + # Write the c:protection element. + self._write_protection() + + # Write the c:chart element. + self._write_chart() + + # Write the c:spPr element for the chartarea formatting. + self._write_sp_pr(self.chartarea) + + # Write the c:printSettings element. + if self.embedded: + self._write_print_settings() + + # Close the worksheet tag. + self._xml_end_tag("c:chartSpace") + # Close the file. + self._xml_close() + + def _convert_axis_args(self, axis, user_options): + # Convert user defined axis values into private hash values. + options = axis["defaults"].copy() + options.update(user_options) + + name, name_formula = self._process_names( + options.get("name"), options.get("name_formula") + ) + + data_id = self._get_data_id(name_formula, options.get("data")) + + axis = { + "defaults": axis["defaults"], + "name": name, + "formula": name_formula, + "data_id": data_id, + "reverse": options.get("reverse"), + "min": options.get("min"), + "max": options.get("max"), + "minor_unit": options.get("minor_unit"), + "major_unit": options.get("major_unit"), + "minor_unit_type": options.get("minor_unit_type"), + "major_unit_type": options.get("major_unit_type"), + "display_units": options.get("display_units"), + "log_base": options.get("log_base"), + "crossing": options.get("crossing"), + "position_axis": options.get("position_axis"), + "position": options.get("position"), + "label_position": options.get("label_position"), + "label_align": options.get("label_align"), + "num_format": options.get("num_format"), + "num_format_linked": options.get("num_format_linked"), + "interval_unit": options.get("interval_unit"), + "interval_tick": options.get("interval_tick"), + "text_axis": False, + } + + if "visible" in options: + axis["visible"] = options.get("visible") + else: + axis["visible"] = 1 + + # Convert the display units. + axis["display_units"] = self._get_display_units(axis["display_units"]) + axis["display_units_visible"] = options.get("display_units_visible", True) + + # Map major_gridlines properties. + if options.get("major_gridlines") and options["major_gridlines"]["visible"]: + axis["major_gridlines"] = self._get_gridline_properties( + options["major_gridlines"] + ) + + # Map minor_gridlines properties. + if options.get("minor_gridlines") and options["minor_gridlines"]["visible"]: + axis["minor_gridlines"] = self._get_gridline_properties( + options["minor_gridlines"] + ) + + # Only use the first letter of bottom, top, left or right. + if axis.get("position"): + axis["position"] = axis["position"].lower()[0] + + # Set the position for a category axis on or between the tick marks. + if axis.get("position_axis"): + if axis["position_axis"] == "on_tick": + axis["position_axis"] = "midCat" + elif axis["position_axis"] == "between": + # Doesn't need to be modified. + pass + else: + # Otherwise use the default value. + axis["position_axis"] = None + + # Set the category axis as a date axis. + if options.get("date_axis"): + self.date_category = True + + # Set the category axis as a text axis. + if options.get("text_axis"): + self.date_category = False + axis["text_axis"] = True + + # Convert datetime args if required. + if axis.get("min") and supported_datetime(axis["min"]): + axis["min"] = datetime_to_excel_datetime( + axis["min"], self.date_1904, self.remove_timezone + ) + if axis.get("max") and supported_datetime(axis["max"]): + axis["max"] = datetime_to_excel_datetime( + axis["max"], self.date_1904, self.remove_timezone + ) + if axis.get("crossing") and supported_datetime(axis["crossing"]): + axis["crossing"] = datetime_to_excel_datetime( + axis["crossing"], self.date_1904, self.remove_timezone + ) + + # Set the font properties if present. + axis["num_font"] = self._convert_font_args(options.get("num_font")) + axis["name_font"] = self._convert_font_args(options.get("name_font")) + + # Set the axis name layout. + axis["name_layout"] = self._get_layout_properties( + options.get("name_layout"), True + ) + + # Set the line properties for the axis. + axis["line"] = Shape._get_line_properties(options.get("line")) + + # Set the fill properties for the axis. + axis["fill"] = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + axis["pattern"] = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + axis["gradient"] = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if axis.get("pattern"): + axis["fill"] = None + + # Gradient fill overrides the solid and pattern fill. + if axis.get("gradient"): + axis["pattern"] = None + axis["fill"] = None + + # Set the tick marker types. + axis["minor_tick_mark"] = self._get_tick_type(options.get("minor_tick_mark")) + axis["major_tick_mark"] = self._get_tick_type(options.get("major_tick_mark")) + + return axis + + def _convert_font_args(self, options): + # Convert user defined font values into private dict values. + if not options: + return + + font = { + "name": options.get("name"), + "color": options.get("color"), + "size": options.get("size"), + "bold": options.get("bold"), + "italic": options.get("italic"), + "underline": options.get("underline"), + "pitch_family": options.get("pitch_family"), + "charset": options.get("charset"), + "baseline": options.get("baseline", 0), + "rotation": options.get("rotation"), + } + + # Convert font size units. + if font["size"]: + font["size"] = int(font["size"] * 100) + + # Convert rotation into 60,000ths of a degree. + if font["rotation"]: + font["rotation"] = 60000 * int(font["rotation"]) + + return font + + def _list_to_formula(self, data): + # Convert and list of row col values to a range formula. + + # If it isn't an array ref it is probably a formula already. + if type(data) is not list: + # Check for unquoted sheetnames. + if data and " " in data and "'" not in data and self.warn_sheetname: + warn( + "Sheetname in '%s' contains spaces but isn't quoted. " + "This may cause errors in Excel." % data + ) + return data + + formula = xl_range_formula(*data) + + return formula + + def _process_names(self, name, name_formula): + # Switch name and name_formula parameters if required. + + if name is not None: + if isinstance(name, list): + # Convert a list of values into a name formula. + cell = xl_rowcol_to_cell(name[1], name[2], True, True) + name_formula = quote_sheetname(name[0]) + "!" + cell + name = "" + elif re.match(r"^=?[^!]+!\$?[A-Z]+\$?\d+", name): + # Name looks like a formula, use it to set name_formula. + name_formula = name + name = "" + + return name, name_formula + + def _get_data_type(self, data): + # Find the overall type of the data associated with a series. + + # Check for no data in the series. + if data is None or len(data) == 0: + return "none" + + if isinstance(data[0], list): + return "multi_str" + + # Determine if data is numeric or strings. + for token in data: + if token is None: + continue + + # Check for strings that would evaluate to float like + # '1.1_1' of ' 1'. + if type(token) == str and re.search("[_ ]", token): + # Assume entire data series is string data. + return "str" + + try: + float(token) + except ValueError: + # Not a number. Assume entire data series is string data. + return "str" + + # The series data was all numeric. + return "num" + + def _get_data_id(self, formula, data): + # Assign an id to a each unique series formula or title/axis formula. + # Repeated formulas such as for categories get the same id. If the + # series or title has user specified data associated with it then + # that is also stored. This data is used to populate cached Excel + # data when creating a chart. If there is no user defined data then + # it will be populated by the parent Workbook._add_chart_data(). + + # Ignore series without a range formula. + if not formula: + return + + # Strip the leading '=' from the formula. + if formula.startswith("="): + formula = formula.lstrip("=") + + # Store the data id in a hash keyed by the formula and store the data + # in a separate array with the same id. + if formula not in self.formula_ids: + # Haven't seen this formula before. + formula_id = len(self.formula_data) + + self.formula_data.append(data) + self.formula_ids[formula] = formula_id + else: + # Formula already seen. Return existing id. + formula_id = self.formula_ids[formula] + + # Store user defined data if it isn't already there. + if self.formula_data[formula_id] is None: + self.formula_data[formula_id] = data + + return formula_id + + def _get_marker_properties(self, marker): + # Convert user marker properties to the structure required internally. + + if not marker: + return + + # Copy the user defined properties since they will be modified. + marker = copy.deepcopy(marker) + + types = { + "automatic": "automatic", + "none": "none", + "square": "square", + "diamond": "diamond", + "triangle": "triangle", + "x": "x", + "star": "star", + "dot": "dot", + "short_dash": "dot", + "dash": "dash", + "long_dash": "dash", + "circle": "circle", + "plus": "plus", + "picture": "picture", + } + + # Check for valid types. + marker_type = marker.get("type") + + if marker_type is not None: + if marker_type in types: + marker["type"] = types[marker_type] + else: + warn("Unknown marker type '%s" % marker_type) + return + + # Set the line properties for the marker. + line = Shape._get_line_properties(marker.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in marker: + line = Shape._get_line_properties(marker["border"]) + + # Set the fill properties for the marker. + fill = Shape._get_fill_properties(marker.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(marker.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(marker.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + marker["line"] = line + marker["fill"] = fill + marker["pattern"] = pattern + marker["gradient"] = gradient + + return marker + + def _get_trendline_properties(self, trendline): + # Convert user trendline properties to structure required internally. + + if not trendline: + return + + # Copy the user defined properties since they will be modified. + trendline = copy.deepcopy(trendline) + + types = { + "exponential": "exp", + "linear": "linear", + "log": "log", + "moving_average": "movingAvg", + "polynomial": "poly", + "power": "power", + } + + # Check the trendline type. + trend_type = trendline.get("type") + + if trend_type in types: + trendline["type"] = types[trend_type] + else: + warn("Unknown trendline type '%s'" % trend_type) + return + + # Set the line properties for the trendline. + line = Shape._get_line_properties(trendline.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in trendline: + line = Shape._get_line_properties(trendline["border"]) + + # Set the fill properties for the trendline. + fill = Shape._get_fill_properties(trendline.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(trendline.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(trendline.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + trendline["line"] = line + trendline["fill"] = fill + trendline["pattern"] = pattern + trendline["gradient"] = gradient + + return trendline + + def _get_error_bars_props(self, options): + # Convert user error bars properties to structure required internally. + if not options: + return + + # Default values. + error_bars = {"type": "fixedVal", "value": 1, "endcap": 1, "direction": "both"} + + types = { + "fixed": "fixedVal", + "percentage": "percentage", + "standard_deviation": "stdDev", + "standard_error": "stdErr", + "custom": "cust", + } + + # Check the error bars type. + error_type = options["type"] + + if error_type in types: + error_bars["type"] = types[error_type] + else: + warn("Unknown error bars type '%s" % error_type) + return + + # Set the value for error types that require it. + if "value" in options: + error_bars["value"] = options["value"] + + # Set the end-cap style. + if "end_style" in options: + error_bars["endcap"] = options["end_style"] + + # Set the error bar direction. + if "direction" in options: + if options["direction"] == "minus": + error_bars["direction"] = "minus" + elif options["direction"] == "plus": + error_bars["direction"] = "plus" + else: + # Default to 'both'. + pass + + # Set any custom values. + error_bars["plus_values"] = options.get("plus_values") + error_bars["minus_values"] = options.get("minus_values") + error_bars["plus_data"] = options.get("plus_data") + error_bars["minus_data"] = options.get("minus_data") + + # Set the line properties for the error bars. + error_bars["line"] = Shape._get_line_properties(options.get("line")) + + return error_bars + + def _get_gridline_properties(self, options): + # Convert user gridline properties to structure required internally. + + # Set the visible property for the gridline. + gridline = {"visible": options.get("visible")} + + # Set the line properties for the gridline. + gridline["line"] = Shape._get_line_properties(options.get("line")) + + return gridline + + def _get_labels_properties(self, labels): + # Convert user labels properties to the structure required internally. + + if not labels: + return None + + # Copy the user defined properties since they will be modified. + labels = copy.deepcopy(labels) + + # Map user defined label positions to Excel positions. + position = labels.get("position") + + if position: + if position in self.label_positions: + if position == self.label_position_default: + labels["position"] = None + else: + labels["position"] = self.label_positions[position] + else: + warn("Unsupported label position '%s' for this chart type" % position) + return + + # Map the user defined label separator to the Excel separator. + separator = labels.get("separator") + separators = { + ",": ", ", + ";": "; ", + ".": ". ", + "\n": "\n", + " ": " ", + } + + if separator: + if separator in separators: + labels["separator"] = separators[separator] + else: + warn("Unsupported label separator") + return + + # Set the font properties if present. + labels["font"] = self._convert_font_args(labels.get("font")) + + # Set the line properties for the labels. + line = Shape._get_line_properties(labels.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in labels: + line = Shape._get_line_properties(labels["border"]) + + # Set the fill properties for the labels. + fill = Shape._get_fill_properties(labels.get("fill")) + + # Set the pattern fill properties for the labels. + pattern = Shape._get_pattern_properties(labels.get("pattern")) + + # Set the gradient fill properties for the labels. + gradient = Shape._get_gradient_properties(labels.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + labels["line"] = line + labels["fill"] = fill + labels["pattern"] = pattern + labels["gradient"] = gradient + + if labels.get("custom"): + for label in labels["custom"]: + if label is None: + continue + + value = label.get("value") + if value and re.match(r"^=?[^!]+!\$?[A-Z]+\$?\d+", str(value)): + label["formula"] = value + + formula = label.get("formula") + if formula and formula.startswith("="): + label["formula"] = formula.lstrip("=") + + data_id = self._get_data_id(formula, label.get("data")) + label["data_id"] = data_id + + label["font"] = self._convert_font_args(label.get("font")) + + # Set the line properties for the label. + line = Shape._get_line_properties(label.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in label: + line = Shape._get_line_properties(label["border"]) + + # Set the fill properties for the label. + fill = Shape._get_fill_properties(label.get("fill")) + + # Set the pattern fill properties for the label. + pattern = Shape._get_pattern_properties(label.get("pattern")) + + # Set the gradient fill properties for the label. + gradient = Shape._get_gradient_properties(label.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + label["line"] = line + label["fill"] = fill + label["pattern"] = pattern + label["gradient"] = gradient + + return labels + + def _get_area_properties(self, options): + # Convert user area properties to the structure required internally. + area = {} + + # Set the line properties for the chartarea. + line = Shape._get_line_properties(options.get("line")) + + # Allow 'border' as a synonym for 'line'. + if options.get("border"): + line = Shape._get_line_properties(options["border"]) + + # Set the fill properties for the chartarea. + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + # Set the plotarea layout. + layout = self._get_layout_properties(options.get("layout"), False) + + area["line"] = line + area["fill"] = fill + area["pattern"] = pattern + area["layout"] = layout + area["gradient"] = gradient + + return area + + def _get_legend_properties(self, options=None): + # Convert user legend properties to the structure required internally. + legend = {} + + if options is None: + options = {} + + legend["position"] = options.get("position", "right") + legend["delete_series"] = options.get("delete_series") + legend["font"] = self._convert_font_args(options.get("font")) + legend["layout"] = self._get_layout_properties(options.get("layout"), False) + + # Turn off the legend. + if options.get("none"): + legend["position"] = "none" + + # Set the line properties for the legend. + line = Shape._get_line_properties(options.get("line")) + + # Allow 'border' as a synonym for 'line'. + if options.get("border"): + line = Shape._get_line_properties(options["border"]) + + # Set the fill properties for the legend. + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + # Set the legend layout. + layout = self._get_layout_properties(options.get("layout"), False) + + legend["line"] = line + legend["fill"] = fill + legend["pattern"] = pattern + legend["layout"] = layout + legend["gradient"] = gradient + + return legend + + def _get_layout_properties(self, args, is_text): + # Convert user defined layout properties to format used internally. + layout = {} + + if not args: + return + + if is_text: + properties = ("x", "y") + else: + properties = ("x", "y", "width", "height") + + # Check for valid properties. + for key in args.keys(): + if key not in properties: + warn("Property '%s' allowed not in layout options" % key) + return + + # Set the layout properties. + for prop in properties: + if prop not in args.keys(): + warn("Property '%s' must be specified in layout options" % prop) + return + + value = args[prop] + + try: + float(value) + except ValueError: + warn( + "Property '%s' value '%s' must be numeric in layout" % (prop, value) + ) + return + + if value < 0 or value > 1: + warn( + "Property '%s' value '%s' must be in range " + "0 < x <= 1 in layout options" % (prop, value) + ) + return + + # Convert to the format used by Excel for easier testing + layout[prop] = "%.17g" % value + + return layout + + def _get_points_properties(self, user_points): + # Convert user points properties to structure required internally. + points = [] + + if not user_points: + return + + for user_point in user_points: + point = {} + + if user_point is not None: + # Set the line properties for the point. + line = Shape._get_line_properties(user_point.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in user_point: + line = Shape._get_line_properties(user_point["border"]) + + # Set the fill properties for the chartarea. + fill = Shape._get_fill_properties(user_point.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(user_point.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(user_point.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + point["line"] = line + point["fill"] = fill + point["pattern"] = pattern + point["gradient"] = gradient + + points.append(point) + + return points + + def _has_fill_formatting(self, element): + # Check if a chart element has line, fill or gradient formatting. + has_fill = False + has_line = False + has_pattern = element.get("pattern") + has_gradient = element.get("gradient") + + if element.get("fill") and element["fill"]["defined"]: + has_fill = True + + if element.get("line") and element["line"]["defined"]: + has_line = True + + if not has_fill and not has_line and not has_pattern and not has_gradient: + return False + else: + return True + + def _get_display_units(self, display_units): + # Convert user defined display units to internal units. + if not display_units: + return + + types = { + "hundreds": "hundreds", + "thousands": "thousands", + "ten_thousands": "tenThousands", + "hundred_thousands": "hundredThousands", + "millions": "millions", + "ten_millions": "tenMillions", + "hundred_millions": "hundredMillions", + "billions": "billions", + "trillions": "trillions", + } + + if display_units in types: + display_units = types[display_units] + else: + warn("Unknown display_units type '%s'" % display_units) + return + + return display_units + + def _get_tick_type(self, tick_type): + # Convert user defined display units to internal units. + if not tick_type: + return + + types = { + "outside": "out", + "inside": "in", + "none": "none", + "cross": "cross", + } + + if tick_type in types: + tick_type = types[tick_type] + else: + warn("Unknown tick_type '%s'" % tick_type) + return + + return tick_type + + def _get_primary_axes_series(self): + # Returns series which use the primary axes. + primary_axes_series = [] + + for series in self.series: + if not series["y2_axis"]: + primary_axes_series.append(series) + + return primary_axes_series + + def _get_secondary_axes_series(self): + # Returns series which use the secondary axes. + secondary_axes_series = [] + + for series in self.series: + if series["y2_axis"]: + secondary_axes_series.append(series) + + return secondary_axes_series + + def _add_axis_ids(self, args): + # Add unique ids for primary or secondary axes + chart_id = 5001 + int(self.id) + axis_count = 1 + len(self.axis2_ids) + len(self.axis_ids) + + id1 = "%04d%04d" % (chart_id, axis_count) + id2 = "%04d%04d" % (chart_id, axis_count + 1) + + if args["primary_axes"]: + self.axis_ids.append(id1) + self.axis_ids.append(id2) + + if not args["primary_axes"]: + self.axis2_ids.append(id1) + self.axis2_ids.append(id2) + + def _set_default_properties(self): + # Setup the default properties for a chart. + + self.x_axis["defaults"] = { + "num_format": "General", + "major_gridlines": {"visible": 0}, + } + + self.y_axis["defaults"] = { + "num_format": "General", + "major_gridlines": {"visible": 1}, + } + + self.x2_axis["defaults"] = { + "num_format": "General", + "label_position": "none", + "crossing": "max", + "visible": 0, + } + + self.y2_axis["defaults"] = { + "num_format": "General", + "major_gridlines": {"visible": 0}, + "position": "right", + "visible": 1, + } + + self.set_x_axis({}) + self.set_y_axis({}) + + self.set_x2_axis({}) + self.set_y2_axis({}) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_chart_space(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/" + xmlns_c = schema + "drawingml/2006/chart" + xmlns_a = schema + "drawingml/2006/main" + xmlns_r = schema + "officeDocument/2006/relationships" + + attributes = [ + ("xmlns:c", xmlns_c), + ("xmlns:a", xmlns_a), + ("xmlns:r", xmlns_r), + ] + + self._xml_start_tag("c:chartSpace", attributes) + + def _write_lang(self): + # Write the element. + val = "en-US" + + attributes = [("val", val)] + + self._xml_empty_tag("c:lang", attributes) + + def _write_style(self): + # Write the element. + style_id = self.style_id + + # Don't write an element for the default style, 2. + if style_id == 2: + return + + attributes = [("val", style_id)] + + self._xml_empty_tag("c:style", attributes) + + def _write_chart(self): + # Write the element. + self._xml_start_tag("c:chart") + + if self.title_none: + # Turn off the title. + self._write_c_auto_title_deleted() + else: + # Write the chart title elements. + if self.title_formula is not None: + self._write_title_formula( + self.title_formula, + self.title_data_id, + None, + self.title_font, + self.title_layout, + self.title_overlay, + ) + elif self.title_name is not None: + self._write_title_rich( + self.title_name, + None, + self.title_font, + self.title_layout, + self.title_overlay, + ) + + # Write the c:plotArea element. + self._write_plot_area() + + # Write the c:legend element. + self._write_legend() + + # Write the c:plotVisOnly element. + self._write_plot_vis_only() + + # Write the c:dispBlanksAs element. + self._write_disp_blanks_as() + + self._xml_end_tag("c:chart") + + def _write_disp_blanks_as(self): + # Write the element. + val = self.show_blanks + + # Ignore the default value. + if val == "gap": + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:dispBlanksAs", attributes) + + def _write_plot_area(self): + # Write the element. + self._xml_start_tag("c:plotArea") + + # Write the c:layout element. + self._write_layout(self.plotarea.get("layout"), "plot") + + # Write subclass chart type elements for primary and secondary axes. + self._write_chart_type({"primary_axes": True}) + self._write_chart_type({"primary_axes": False}) + + # Configure a combined chart if present. + second_chart = self.combined + if second_chart: + # Secondary axis has unique id otherwise use same as primary. + if second_chart.is_secondary: + second_chart.id = 1000 + self.id + else: + second_chart.id = self.id + + # Share the same filehandle for writing. + second_chart.fh = self.fh + + # Share series index with primary chart. + second_chart.series_index = self.series_index + + # Write the subclass chart type elements for combined chart. + second_chart._write_chart_type({"primary_axes": True}) + second_chart._write_chart_type({"primary_axes": False}) + + # Write the category and value elements for the primary axes. + args = {"x_axis": self.x_axis, "y_axis": self.y_axis, "axis_ids": self.axis_ids} + + if self.date_category: + self._write_date_axis(args) + else: + self._write_cat_axis(args) + + self._write_val_axis(args) + + # Write the category and value elements for the secondary axes. + args = { + "x_axis": self.x2_axis, + "y_axis": self.y2_axis, + "axis_ids": self.axis2_ids, + } + + self._write_val_axis(args) + + # Write the secondary axis for the secondary chart. + if second_chart and second_chart.is_secondary: + args = { + "x_axis": second_chart.x2_axis, + "y_axis": second_chart.y2_axis, + "axis_ids": second_chart.axis2_ids, + } + + second_chart._write_val_axis(args) + + if self.date_category: + self._write_date_axis(args) + else: + self._write_cat_axis(args) + + # Write the c:dTable element. + self._write_d_table() + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(self.plotarea) + + self._xml_end_tag("c:plotArea") + + def _write_layout(self, layout, layout_type): + # Write the element. + + if not layout: + # Automatic layout. + self._xml_empty_tag("c:layout") + else: + # User defined manual layout. + self._xml_start_tag("c:layout") + self._write_manual_layout(layout, layout_type) + self._xml_end_tag("c:layout") + + def _write_manual_layout(self, layout, layout_type): + # Write the element. + self._xml_start_tag("c:manualLayout") + + # Plotarea has a layoutTarget element. + if layout_type == "plot": + self._xml_empty_tag("c:layoutTarget", [("val", "inner")]) + + # Set the x, y positions. + self._xml_empty_tag("c:xMode", [("val", "edge")]) + self._xml_empty_tag("c:yMode", [("val", "edge")]) + self._xml_empty_tag("c:x", [("val", layout["x"])]) + self._xml_empty_tag("c:y", [("val", layout["y"])]) + + # For plotarea and legend set the width and height. + if layout_type != "text": + self._xml_empty_tag("c:w", [("val", layout["width"])]) + self._xml_empty_tag("c:h", [("val", layout["height"])]) + + self._xml_end_tag("c:manualLayout") + + def _write_chart_type(self, options): + # Write the chart type element. This method should be overridden + # by the subclasses. + return + + def _write_grouping(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("c:grouping", attributes) + + def _write_series(self, series): + # Write the series elements. + self._write_ser(series) + + def _write_ser(self, series): + # Write the element. + index = self.series_index + self.series_index += 1 + + self._xml_start_tag("c:ser") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:order element. + self._write_order(index) + + # Write the series name. + self._write_series_name(series) + + # Write the c:spPr element. + self._write_sp_pr(series) + + # Write the c:marker element. + self._write_marker(series["marker"]) + + # Write the c:invertIfNegative element. + self._write_c_invert_if_negative(series["invert_if_neg"]) + + # Write the c:dPt element. + self._write_d_pt(series["points"]) + + # Write the c:dLbls element. + self._write_d_lbls(series["labels"]) + + # Write the c:trendline element. + self._write_trendline(series["trendline"]) + + # Write the c:errBars element. + self._write_error_bars(series["error_bars"]) + + # Write the c:cat element. + self._write_cat(series) + + # Write the c:val element. + self._write_val(series) + + # Write the c:smooth element. + if self.smooth_allowed: + self._write_c_smooth(series["smooth"]) + + # Write the c:extLst element. + if series.get("inverted_color"): + self._write_c_ext_lst(series["inverted_color"]) + + self._xml_end_tag("c:ser") + + def _write_c_ext_lst(self, color): + # Write the element for the inverted fill color. + + uri = "{6F2FDCE9-48DA-4B69-8628-5D25D57E5C99}" + xmlns_c_14 = "http://schemas.microsoft.com/office/drawing/2007/8/2/chart" + + attributes1 = [ + ("uri", uri), + ("xmlns:c14", xmlns_c_14), + ] + + attributes2 = [("xmlns:c14", xmlns_c_14)] + + self._xml_start_tag("c:extLst") + self._xml_start_tag("c:ext", attributes1) + self._xml_start_tag("c14:invertSolidFillFmt") + self._xml_start_tag("c14:spPr", attributes2) + + self._write_a_solid_fill({"color": color}) + + self._xml_end_tag("c14:spPr") + self._xml_end_tag("c14:invertSolidFillFmt") + self._xml_end_tag("c:ext") + self._xml_end_tag("c:extLst") + + def _write_idx(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:idx", attributes) + + def _write_order(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:order", attributes) + + def _write_series_name(self, series): + # Write the series name. + + if series["name_formula"] is not None: + self._write_tx_formula(series["name_formula"], series["name_id"]) + elif series["name"] is not None: + self._write_tx_value(series["name"]) + + def _write_c_smooth(self, smooth): + # Write the element. + + if smooth: + self._xml_empty_tag("c:smooth", [("val", "1")]) + + def _write_cat(self, series): + # Write the element. + formula = series["categories"] + data_id = series["cat_data_id"] + data = None + + if data_id is not None: + data = self.formula_data[data_id] + + # Ignore elements for charts without category values. + if not formula: + return + + self._xml_start_tag("c:cat") + + # Check the type of cached data. + cat_type = self._get_data_type(data) + + if cat_type == "str": + self.cat_has_num_fmt = 0 + # Write the c:numRef element. + self._write_str_ref(formula, data, cat_type) + + elif cat_type == "multi_str": + self.cat_has_num_fmt = 0 + # Write the c:numRef element. + self._write_multi_lvl_str_ref(formula, data) + + else: + self.cat_has_num_fmt = 1 + # Write the c:numRef element. + self._write_num_ref(formula, data, cat_type) + + self._xml_end_tag("c:cat") + + def _write_val(self, series): + # Write the element. + formula = series["values"] + data_id = series["val_data_id"] + data = self.formula_data[data_id] + + self._xml_start_tag("c:val") + + # Unlike Cat axes data should only be numeric. + # Write the c:numRef element. + self._write_num_ref(formula, data, "num") + + self._xml_end_tag("c:val") + + def _write_num_ref(self, formula, data, ref_type): + # Write the element. + self._xml_start_tag("c:numRef") + + # Write the c:f element. + self._write_series_formula(formula) + + if ref_type == "num": + # Write the c:numCache element. + self._write_num_cache(data) + elif ref_type == "str": + # Write the c:strCache element. + self._write_str_cache(data) + + self._xml_end_tag("c:numRef") + + def _write_str_ref(self, formula, data, ref_type): + # Write the element. + + self._xml_start_tag("c:strRef") + + # Write the c:f element. + self._write_series_formula(formula) + + if ref_type == "num": + # Write the c:numCache element. + self._write_num_cache(data) + elif ref_type == "str": + # Write the c:strCache element. + self._write_str_cache(data) + + self._xml_end_tag("c:strRef") + + def _write_multi_lvl_str_ref(self, formula, data): + # Write the element. + + if not data: + return + + self._xml_start_tag("c:multiLvlStrRef") + + # Write the c:f element. + self._write_series_formula(formula) + + self._xml_start_tag("c:multiLvlStrCache") + + # Write the c:ptCount element. + count = len(data[-1]) + self._write_pt_count(count) + + for cat_data in reversed(data): + self._xml_start_tag("c:lvl") + + for i, point in enumerate(cat_data): + # Write the c:pt element. + self._write_pt(i, cat_data[i]) + + self._xml_end_tag("c:lvl") + + self._xml_end_tag("c:multiLvlStrCache") + self._xml_end_tag("c:multiLvlStrRef") + + def _write_series_formula(self, formula): + # Write the element. + + # Strip the leading '=' from the formula. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("c:f", formula) + + def _write_axis_ids(self, args): + # Write the elements for the primary or secondary axes. + + # Generate the axis ids. + self._add_axis_ids(args) + + if args["primary_axes"]: + # Write the axis ids for the primary axes. + self._write_axis_id(self.axis_ids[0]) + self._write_axis_id(self.axis_ids[1]) + else: + # Write the axis ids for the secondary axes. + self._write_axis_id(self.axis2_ids[0]) + self._write_axis_id(self.axis2_ids[1]) + + def _write_axis_id(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:axId", attributes) + + def _write_cat_axis(self, args): + # Write the element. Usually the X axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + position = self.cat_axis_position + is_y_axis = self.horiz_cat_axis + + # Overwrite the default axis position with a user supplied value. + if x_axis.get("position"): + position = x_axis["position"] + + self._xml_start_tag("c:catAx") + + self._write_axis_id(axis_ids[0]) + + # Write the c:scaling element. + self._write_scaling(x_axis.get("reverse"), None, None, None) + + if not x_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, y_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(x_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(x_axis.get("minor_gridlines")) + + # Write the axis title elements. + if x_axis["formula"] is not None: + self._write_title_formula( + x_axis["formula"], + x_axis["data_id"], + is_y_axis, + x_axis["name_font"], + x_axis["name_layout"], + ) + elif x_axis["name"] is not None: + self._write_title_rich( + x_axis["name"], is_y_axis, x_axis["name_font"], x_axis["name_layout"] + ) + + # Write the c:numFmt element. + self._write_cat_number_format(x_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(x_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(x_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(x_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(x_axis) + + # Write the axis font elements. + self._write_axis_font(x_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[1]) + + if self.show_crosses or x_axis.get("visible"): + # Note, the category crossing comes from the value axis. + if ( + y_axis.get("crossing") is None + or y_axis.get("crossing") == "max" + or y_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(y_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(y_axis.get("crossing")) + + # Write the c:auto element. + if not x_axis.get("text_axis"): + self._write_auto(1) + + # Write the c:labelAlign element. + self._write_label_align(x_axis.get("label_align")) + + # Write the c:labelOffset element. + self._write_label_offset(100) + + # Write the c:tickLblSkip element. + self._write_c_tick_lbl_skip(x_axis.get("interval_unit")) + + # Write the c:tickMarkSkip element. + self._write_c_tick_mark_skip(x_axis.get("interval_tick")) + + self._xml_end_tag("c:catAx") + + def _write_val_axis(self, args): + # Write the element. Usually the Y axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + position = args.get("position", self.val_axis_position) + is_y_axis = self.horiz_val_axis + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + # Overwrite the default axis position with a user supplied value. + position = y_axis.get("position") or position + + self._xml_start_tag("c:valAx") + + self._write_axis_id(axis_ids[1]) + + # Write the c:scaling element. + self._write_scaling( + y_axis.get("reverse"), + y_axis.get("min"), + y_axis.get("max"), + y_axis.get("log_base"), + ) + + if not y_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, x_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(y_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(y_axis.get("minor_gridlines")) + + # Write the axis title elements. + if y_axis["formula"] is not None: + self._write_title_formula( + y_axis["formula"], + y_axis["data_id"], + is_y_axis, + y_axis["name_font"], + y_axis["name_layout"], + ) + elif y_axis["name"] is not None: + self._write_title_rich( + y_axis["name"], + is_y_axis, + y_axis.get("name_font"), + y_axis.get("name_layout"), + ) + + # Write the c:numberFormat element. + self._write_number_format(y_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(y_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(y_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(y_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(y_axis) + + # Write the axis font elements. + self._write_axis_font(y_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[0]) + + # Note, the category crossing comes from the value axis. + if ( + x_axis.get("crossing") is None + or x_axis["crossing"] == "max" + or x_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(x_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(x_axis.get("crossing")) + + # Write the c:crossBetween element. + self._write_cross_between(x_axis.get("position_axis")) + + # Write the c:majorUnit element. + self._write_c_major_unit(y_axis.get("major_unit")) + + # Write the c:minorUnit element. + self._write_c_minor_unit(y_axis.get("minor_unit")) + + # Write the c:dispUnits element. + self._write_disp_units( + y_axis.get("display_units"), y_axis.get("display_units_visible") + ) + + self._xml_end_tag("c:valAx") + + def _write_cat_val_axis(self, args): + # Write the element. This is for the second valAx + # in scatter plots. Usually the X axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + position = args["position"] or self.val_axis_position + is_y_axis = self.horiz_val_axis + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + # Overwrite the default axis position with a user supplied value. + position = x_axis.get("position") or position + + self._xml_start_tag("c:valAx") + + self._write_axis_id(axis_ids[0]) + + # Write the c:scaling element. + self._write_scaling( + x_axis.get("reverse"), + x_axis.get("min"), + x_axis.get("max"), + x_axis.get("log_base"), + ) + + if not x_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, y_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(x_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(x_axis.get("minor_gridlines")) + + # Write the axis title elements. + if x_axis["formula"] is not None: + self._write_title_formula( + x_axis["formula"], + x_axis["data_id"], + is_y_axis, + x_axis["name_font"], + x_axis["name_layout"], + ) + elif x_axis["name"] is not None: + self._write_title_rich( + x_axis["name"], is_y_axis, x_axis["name_font"], x_axis["name_layout"] + ) + + # Write the c:numberFormat element. + self._write_number_format(x_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(x_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(x_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(x_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(x_axis) + + # Write the axis font elements. + self._write_axis_font(x_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[1]) + + # Note, the category crossing comes from the value axis. + if ( + y_axis.get("crossing") is None + or y_axis["crossing"] == "max" + or y_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(y_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(y_axis.get("crossing")) + + # Write the c:crossBetween element. + self._write_cross_between(y_axis.get("position_axis")) + + # Write the c:majorUnit element. + self._write_c_major_unit(x_axis.get("major_unit")) + + # Write the c:minorUnit element. + self._write_c_minor_unit(x_axis.get("minor_unit")) + + # Write the c:dispUnits element. + self._write_disp_units( + x_axis.get("display_units"), x_axis.get("display_units_visible") + ) + + self._xml_end_tag("c:valAx") + + def _write_date_axis(self, args): + # Write the element. Usually the X axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + position = self.cat_axis_position + + # Overwrite the default axis position with a user supplied value. + position = x_axis.get("position") or position + + self._xml_start_tag("c:dateAx") + + self._write_axis_id(axis_ids[0]) + + # Write the c:scaling element. + self._write_scaling( + x_axis.get("reverse"), + x_axis.get("min"), + x_axis.get("max"), + x_axis.get("log_base"), + ) + + if not x_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, y_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(x_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(x_axis.get("minor_gridlines")) + + # Write the axis title elements. + if x_axis["formula"] is not None: + self._write_title_formula( + x_axis["formula"], + x_axis["data_id"], + None, + x_axis["name_font"], + x_axis["name_layout"], + ) + elif x_axis["name"] is not None: + self._write_title_rich( + x_axis["name"], None, x_axis["name_font"], x_axis["name_layout"] + ) + + # Write the c:numFmt element. + self._write_number_format(x_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(x_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(x_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(x_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(x_axis) + + # Write the axis font elements. + self._write_axis_font(x_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[1]) + + if self.show_crosses or x_axis.get("visible"): + # Note, the category crossing comes from the value axis. + if ( + y_axis.get("crossing") is None + or y_axis.get("crossing") == "max" + or y_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(y_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(y_axis.get("crossing")) + + # Write the c:auto element. + self._write_auto(1) + + # Write the c:labelOffset element. + self._write_label_offset(100) + + # Write the c:tickLblSkip element. + self._write_c_tick_lbl_skip(x_axis.get("interval_unit")) + + # Write the c:tickMarkSkip element. + self._write_c_tick_mark_skip(x_axis.get("interval_tick")) + + # Write the c:majorUnit element. + self._write_c_major_unit(x_axis.get("major_unit")) + + # Write the c:majorTimeUnit element. + if x_axis.get("major_unit"): + self._write_c_major_time_unit(x_axis["major_unit_type"]) + + # Write the c:minorUnit element. + self._write_c_minor_unit(x_axis.get("minor_unit")) + + # Write the c:minorTimeUnit element. + if x_axis.get("minor_unit"): + self._write_c_minor_time_unit(x_axis["minor_unit_type"]) + + self._xml_end_tag("c:dateAx") + + def _write_scaling(self, reverse, min_val, max_val, log_base): + # Write the element. + + self._xml_start_tag("c:scaling") + + # Write the c:logBase element. + self._write_c_log_base(log_base) + + # Write the c:orientation element. + self._write_orientation(reverse) + + # Write the c:max element. + self._write_c_max(max_val) + + # Write the c:min element. + self._write_c_min(min_val) + + self._xml_end_tag("c:scaling") + + def _write_c_log_base(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:logBase", attributes) + + def _write_orientation(self, reverse): + # Write the element. + val = "minMax" + + if reverse: + val = "maxMin" + + attributes = [("val", val)] + + self._xml_empty_tag("c:orientation", attributes) + + def _write_c_max(self, max_val): + # Write the element. + + if max_val is None: + return + + attributes = [("val", max_val)] + + self._xml_empty_tag("c:max", attributes) + + def _write_c_min(self, min_val): + # Write the element. + + if min_val is None: + return + + attributes = [("val", min_val)] + + self._xml_empty_tag("c:min", attributes) + + def _write_axis_pos(self, val, reverse): + # Write the element. + + if reverse: + if val == "l": + val = "r" + if val == "b": + val = "t" + + attributes = [("val", val)] + + self._xml_empty_tag("c:axPos", attributes) + + def _write_number_format(self, axis): + # Write the element. Note: It is assumed that if + # a user defined number format is supplied (i.e., non-default) then + # the sourceLinked attribute is 0. + # The user can override this if required. + format_code = axis.get("num_format") + source_linked = 1 + + # Check if a user defined number format has been set. + if format_code is not None and format_code != axis["defaults"]["num_format"]: + source_linked = 0 + + # User override of sourceLinked. + if axis.get("num_format_linked"): + source_linked = 1 + + attributes = [ + ("formatCode", format_code), + ("sourceLinked", source_linked), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_cat_number_format(self, axis): + # Write the element. Special case handler for category + # axes which don't always have a number format. + format_code = axis.get("num_format") + source_linked = 1 + default_format = 1 + + # Check if a user defined number format has been set. + if format_code is not None and format_code != axis["defaults"]["num_format"]: + source_linked = 0 + default_format = 0 + + # User override of sourceLinked. + if axis.get("num_format_linked"): + source_linked = 1 + + # Skip if cat doesn't have a num format (unless it is non-default). + if not self.cat_has_num_fmt and default_format: + return + + attributes = [ + ("formatCode", format_code), + ("sourceLinked", source_linked), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_data_label_number_format(self, format_code): + # Write the element for data labels. + source_linked = 0 + + attributes = [ + ("formatCode", format_code), + ("sourceLinked", source_linked), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_major_tick_mark(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:majorTickMark", attributes) + + def _write_minor_tick_mark(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:minorTickMark", attributes) + + def _write_tick_label_pos(self, val=None): + # Write the element. + if val is None or val == "next_to": + val = "nextTo" + + attributes = [("val", val)] + + self._xml_empty_tag("c:tickLblPos", attributes) + + def _write_cross_axis(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:crossAx", attributes) + + def _write_crosses(self, val=None): + # Write the element. + if val is None: + val = "autoZero" + + attributes = [("val", val)] + + self._xml_empty_tag("c:crosses", attributes) + + def _write_c_crosses_at(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:crossesAt", attributes) + + def _write_auto(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:auto", attributes) + + def _write_label_align(self, val=None): + # Write the element. + + if val is None: + val = "ctr" + + if val == "right": + val = "r" + + if val == "left": + val = "l" + + attributes = [("val", val)] + + self._xml_empty_tag("c:lblAlgn", attributes) + + def _write_label_offset(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:lblOffset", attributes) + + def _write_c_tick_lbl_skip(self, val): + # Write the element. + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:tickLblSkip", attributes) + + def _write_c_tick_mark_skip(self, val): + # Write the element. + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:tickMarkSkip", attributes) + + def _write_major_gridlines(self, gridlines): + # Write the element. + + if not gridlines: + return + + if not gridlines["visible"]: + return + + if gridlines["line"]["defined"]: + self._xml_start_tag("c:majorGridlines") + + # Write the c:spPr element. + self._write_sp_pr(gridlines) + + self._xml_end_tag("c:majorGridlines") + else: + self._xml_empty_tag("c:majorGridlines") + + def _write_minor_gridlines(self, gridlines): + # Write the element. + + if not gridlines: + return + + if not gridlines["visible"]: + return + + if gridlines["line"]["defined"]: + self._xml_start_tag("c:minorGridlines") + + # Write the c:spPr element. + self._write_sp_pr(gridlines) + + self._xml_end_tag("c:minorGridlines") + else: + self._xml_empty_tag("c:minorGridlines") + + def _write_cross_between(self, val): + # Write the element. + if val is None: + val = self.cross_between + + attributes = [("val", val)] + + self._xml_empty_tag("c:crossBetween", attributes) + + def _write_c_major_unit(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:majorUnit", attributes) + + def _write_c_minor_unit(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:minorUnit", attributes) + + def _write_c_major_time_unit(self, val=None): + # Write the element. + if val is None: + val = "days" + + attributes = [("val", val)] + + self._xml_empty_tag("c:majorTimeUnit", attributes) + + def _write_c_minor_time_unit(self, val=None): + # Write the element. + if val is None: + val = "days" + + attributes = [("val", val)] + + self._xml_empty_tag("c:minorTimeUnit", attributes) + + def _write_legend(self): + # Write the element. + legend = self.legend + position = legend.get("position", "right") + font = legend.get("font") + delete_series = [] + overlay = 0 + + if legend.get("delete_series") and type(legend["delete_series"]) is list: + delete_series = legend["delete_series"] + + if position.startswith("overlay_"): + position = position.replace("overlay_", "") + overlay = 1 + + allowed = { + "right": "r", + "left": "l", + "top": "t", + "bottom": "b", + "top_right": "tr", + } + + if position == "none": + return + + if position not in allowed: + return + + position = allowed[position] + + self._xml_start_tag("c:legend") + + # Write the c:legendPos element. + self._write_legend_pos(position) + + # Remove series labels from the legend. + for index in delete_series: + # Write the c:legendEntry element. + self._write_legend_entry(index) + + # Write the c:layout element. + self._write_layout(legend.get("layout"), "legend") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + if font: + self._write_tx_pr(font) + + # Write the c:spPr element. + self._write_sp_pr(legend) + + self._xml_end_tag("c:legend") + + def _write_legend_pos(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:legendPos", attributes) + + def _write_legend_entry(self, index): + # Write the element. + + self._xml_start_tag("c:legendEntry") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:delete element. + self._write_delete(1) + + self._xml_end_tag("c:legendEntry") + + def _write_overlay(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:overlay", attributes) + + def _write_plot_vis_only(self): + # Write the element. + val = 1 + + # Ignore this element if we are plotting hidden data. + if self.show_hidden: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:plotVisOnly", attributes) + + def _write_print_settings(self): + # Write the element. + self._xml_start_tag("c:printSettings") + + # Write the c:headerFooter element. + self._write_header_footer() + + # Write the c:pageMargins element. + self._write_page_margins() + + # Write the c:pageSetup element. + self._write_page_setup() + + self._xml_end_tag("c:printSettings") + + def _write_header_footer(self): + # Write the element. + self._xml_empty_tag("c:headerFooter") + + def _write_page_margins(self): + # Write the element. + bottom = 0.75 + left = 0.7 + right = 0.7 + top = 0.75 + header = 0.3 + footer = 0.3 + + attributes = [ + ("b", bottom), + ("l", left), + ("r", right), + ("t", top), + ("header", header), + ("footer", footer), + ] + + self._xml_empty_tag("c:pageMargins", attributes) + + def _write_page_setup(self): + # Write the element. + self._xml_empty_tag("c:pageSetup") + + def _write_c_auto_title_deleted(self): + # Write the element. + self._xml_empty_tag("c:autoTitleDeleted", [("val", 1)]) + + def _write_title_rich(self, title, is_y_axis, font, layout, overlay=False): + # Write the element for a rich string. + + self._xml_start_tag("c:title") + + # Write the c:tx element. + self._write_tx_rich(title, is_y_axis, font) + + # Write the c:layout element. + self._write_layout(layout, "text") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + self._xml_end_tag("c:title") + + def _write_title_formula( + self, title, data_id, is_y_axis, font, layout, overlay=False + ): + # Write the element for a rich string. + + self._xml_start_tag("c:title") + + # Write the c:tx element. + self._write_tx_formula(title, data_id) + + # Write the c:layout element. + self._write_layout(layout, "text") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + # Write the c:txPr element. + self._write_tx_pr(font, is_y_axis) + + self._xml_end_tag("c:title") + + def _write_tx_rich(self, title, is_y_axis, font): + # Write the element. + + self._xml_start_tag("c:tx") + + # Write the c:rich element. + self._write_rich(title, font, is_y_axis, ignore_rich_pr=False) + + self._xml_end_tag("c:tx") + + def _write_tx_value(self, title): + # Write the element with a value such as for series names. + + self._xml_start_tag("c:tx") + + # Write the c:v element. + self._write_v(title) + + self._xml_end_tag("c:tx") + + def _write_tx_formula(self, title, data_id): + # Write the element. + data = None + + if data_id is not None: + data = self.formula_data[data_id] + + self._xml_start_tag("c:tx") + + # Write the c:strRef element. + self._write_str_ref(title, data, "str") + + self._xml_end_tag("c:tx") + + def _write_rich(self, title, font, is_y_axis, ignore_rich_pr): + # Write the element. + + if font and font.get("rotation") is not None: + rotation = font["rotation"] + else: + rotation = None + + self._xml_start_tag("c:rich") + + # Write the a:bodyPr element. + self._write_a_body_pr(rotation, is_y_axis) + + # Write the a:lstStyle element. + self._write_a_lst_style() + + # Write the a:p element. + self._write_a_p_rich(title, font, ignore_rich_pr) + + self._xml_end_tag("c:rich") + + def _write_a_body_pr(self, rotation, is_y_axis): + # Write the element. + attributes = [] + + if rotation is None and is_y_axis: + rotation = -5400000 + + if rotation is not None: + if rotation == 16200000: + # 270 deg/stacked angle. + attributes.append(("rot", 0)) + attributes.append(("vert", "wordArtVert")) + elif rotation == 16260000: + # 271 deg/East Asian vertical. + attributes.append(("rot", 0)) + attributes.append(("vert", "eaVert")) + else: + attributes.append(("rot", rotation)) + attributes.append(("vert", "horz")) + + self._xml_empty_tag("a:bodyPr", attributes) + + def _write_a_lst_style(self): + # Write the element. + self._xml_empty_tag("a:lstStyle") + + def _write_a_p_rich(self, title, font, ignore_rich_pr): + # Write the element for rich string titles. + + self._xml_start_tag("a:p") + + # Write the a:pPr element. + if not ignore_rich_pr: + self._write_a_p_pr_rich(font) + + # Write the a:r element. + self._write_a_r(title, font) + + self._xml_end_tag("a:p") + + def _write_a_p_formula(self, font): + # Write the element for formula titles. + + self._xml_start_tag("a:p") + + # Write the a:pPr element. + self._write_a_p_pr_rich(font) + + # Write the a:endParaRPr element. + self._write_a_end_para_rpr() + + self._xml_end_tag("a:p") + + def _write_a_p_pr_rich(self, font): + # Write the element for rich string titles. + + self._xml_start_tag("a:pPr") + + # Write the a:defRPr element. + self._write_a_def_rpr(font) + + self._xml_end_tag("a:pPr") + + def _write_a_def_rpr(self, font): + # Write the element. + has_color = 0 + + style_attributes = Shape._get_font_style_attributes(font) + latin_attributes = Shape._get_font_latin_attributes(font) + + if font and font.get("color") is not None: + has_color = 1 + + if latin_attributes or has_color: + self._xml_start_tag("a:defRPr", style_attributes) + + if has_color: + self._write_a_solid_fill({"color": font["color"]}) + + if latin_attributes: + self._write_a_latin(latin_attributes) + + self._xml_end_tag("a:defRPr") + else: + self._xml_empty_tag("a:defRPr", style_attributes) + + def _write_a_end_para_rpr(self): + # Write the element. + lang = "en-US" + + attributes = [("lang", lang)] + + self._xml_empty_tag("a:endParaRPr", attributes) + + def _write_a_r(self, title, font): + # Write the element. + + self._xml_start_tag("a:r") + + # Write the a:rPr element. + self._write_a_r_pr(font) + + # Write the a:t element. + self._write_a_t(title) + + self._xml_end_tag("a:r") + + def _write_a_r_pr(self, font): + # Write the element. + has_color = 0 + lang = "en-US" + + style_attributes = Shape._get_font_style_attributes(font) + latin_attributes = Shape._get_font_latin_attributes(font) + + if font and font["color"] is not None: + has_color = 1 + + # Add the lang type to the attributes. + style_attributes.insert(0, ("lang", lang)) + + if latin_attributes or has_color: + self._xml_start_tag("a:rPr", style_attributes) + + if has_color: + self._write_a_solid_fill({"color": font["color"]}) + + if latin_attributes: + self._write_a_latin(latin_attributes) + + self._xml_end_tag("a:rPr") + else: + self._xml_empty_tag("a:rPr", style_attributes) + + def _write_a_t(self, title): + # Write the element. + + self._xml_data_element("a:t", title) + + def _write_tx_pr(self, font, is_y_axis=False): + # Write the element. + + if font and font.get("rotation") is not None: + rotation = font["rotation"] + else: + rotation = None + + self._xml_start_tag("c:txPr") + + # Write the a:bodyPr element. + self._write_a_body_pr(rotation, is_y_axis) + + # Write the a:lstStyle element. + self._write_a_lst_style() + + # Write the a:p element. + self._write_a_p_formula(font) + + self._xml_end_tag("c:txPr") + + def _write_marker(self, marker): + # Write the element. + if marker is None: + marker = self.default_marker + + if not marker: + return + + if marker["type"] == "automatic": + return + + self._xml_start_tag("c:marker") + + # Write the c:symbol element. + self._write_symbol(marker["type"]) + + # Write the c:size element. + if marker.get("size"): + self._write_marker_size(marker["size"]) + + # Write the c:spPr element. + self._write_sp_pr(marker) + + self._xml_end_tag("c:marker") + + def _write_marker_size(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:size", attributes) + + def _write_symbol(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:symbol", attributes) + + def _write_sp_pr(self, series): + # Write the element. + + if not self._has_fill_formatting(series): + return + + self._xml_start_tag("c:spPr") + + # Write the fill elements for solid charts such as pie and bar. + if series.get("fill") and series["fill"]["defined"]: + if "none" in series["fill"]: + # Write the a:noFill element. + self._write_a_no_fill() + else: + # Write the a:solidFill element. + self._write_a_solid_fill(series["fill"]) + + if series.get("pattern"): + # Write the a:gradFill element. + self._write_a_patt_fill(series["pattern"]) + + if series.get("gradient"): + # Write the a:gradFill element. + self._write_a_grad_fill(series["gradient"]) + + # Write the a:ln element. + if series.get("line") and series["line"]["defined"]: + self._write_a_ln(series["line"]) + + self._xml_end_tag("c:spPr") + + def _write_a_ln(self, line): + # Write the element. + attributes = [] + + # Add the line width as an attribute. + width = line.get("width") + + if width is not None: + # Round width to nearest 0.25, like Excel. + width = int((width + 0.125) * 4) / 4.0 + + # Convert to internal units. + width = int(0.5 + (12700 * width)) + + attributes = [("w", width)] + + if line.get("none") or line.get("color") or line.get("dash_type"): + self._xml_start_tag("a:ln", attributes) + + # Write the line fill. + if "none" in line: + # Write the a:noFill element. + self._write_a_no_fill() + elif "color" in line: + # Write the a:solidFill element. + self._write_a_solid_fill(line) + + # Write the line/dash type. + line_type = line.get("dash_type") + if line_type: + # Write the a:prstDash element. + self._write_a_prst_dash(line_type) + + self._xml_end_tag("a:ln") + else: + self._xml_empty_tag("a:ln", attributes) + + def _write_a_no_fill(self): + # Write the element. + self._xml_empty_tag("a:noFill") + + def _write_a_solid_fill(self, fill): + # Write the element. + + self._xml_start_tag("a:solidFill") + + if "color" in fill: + color = get_rgb_color(fill["color"]) + transparency = fill.get("transparency") + # Write the a:srgbClr element. + self._write_a_srgb_clr(color, transparency) + + self._xml_end_tag("a:solidFill") + + def _write_a_srgb_clr(self, val, transparency=None): + # Write the element. + attributes = [("val", val)] + + if transparency: + self._xml_start_tag("a:srgbClr", attributes) + + # Write the a:alpha element. + self._write_a_alpha(transparency) + + self._xml_end_tag("a:srgbClr") + else: + self._xml_empty_tag("a:srgbClr", attributes) + + def _write_a_alpha(self, val): + # Write the element. + + val = int((100 - int(val)) * 1000) + + attributes = [("val", val)] + + self._xml_empty_tag("a:alpha", attributes) + + def _write_a_prst_dash(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("a:prstDash", attributes) + + def _write_trendline(self, trendline): + # Write the element. + + if not trendline: + return + + self._xml_start_tag("c:trendline") + + # Write the c:name element. + self._write_name(trendline.get("name")) + + # Write the c:spPr element. + self._write_sp_pr(trendline) + + # Write the c:trendlineType element. + self._write_trendline_type(trendline["type"]) + + # Write the c:order element for polynomial trendlines. + if trendline["type"] == "poly": + self._write_trendline_order(trendline.get("order")) + + # Write the c:period element for moving average trendlines. + if trendline["type"] == "movingAvg": + self._write_period(trendline.get("period")) + + # Write the c:forward element. + self._write_forward(trendline.get("forward")) + + # Write the c:backward element. + self._write_backward(trendline.get("backward")) + + if "intercept" in trendline: + # Write the c:intercept element. + self._write_c_intercept(trendline["intercept"]) + + if trendline.get("display_r_squared"): + # Write the c:dispRSqr element. + self._write_c_disp_rsqr() + + if trendline.get("display_equation"): + # Write the c:dispEq element. + self._write_c_disp_eq() + + # Write the c:trendlineLbl element. + self._write_c_trendline_lbl() + + self._xml_end_tag("c:trendline") + + def _write_trendline_type(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:trendlineType", attributes) + + def _write_name(self, data): + # Write the element. + + if data is None: + return + + self._xml_data_element("c:name", data) + + def _write_trendline_order(self, val): + # Write the element. + if val < 2: + val = 2 + + attributes = [("val", val)] + + self._xml_empty_tag("c:order", attributes) + + def _write_period(self, val): + # Write the element. + if val < 2: + val = 2 + + attributes = [("val", val)] + + self._xml_empty_tag("c:period", attributes) + + def _write_forward(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:forward", attributes) + + def _write_backward(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:backward", attributes) + + def _write_c_intercept(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("c:intercept", attributes) + + def _write_c_disp_eq(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:dispEq", attributes) + + def _write_c_disp_rsqr(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:dispRSqr", attributes) + + def _write_c_trendline_lbl(self): + # Write the element. + self._xml_start_tag("c:trendlineLbl") + + # Write the c:layout element. + self._write_layout(None, None) + + # Write the c:numFmt element. + self._write_trendline_num_fmt() + + self._xml_end_tag("c:trendlineLbl") + + def _write_trendline_num_fmt(self): + # Write the element. + attributes = [ + ("formatCode", "General"), + ("sourceLinked", 0), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_hi_low_lines(self): + # Write the element. + hi_low_lines = self.hi_low_lines + + if hi_low_lines is None: + return + + if "line" in hi_low_lines and hi_low_lines["line"]["defined"]: + self._xml_start_tag("c:hiLowLines") + + # Write the c:spPr element. + self._write_sp_pr(hi_low_lines) + + self._xml_end_tag("c:hiLowLines") + else: + self._xml_empty_tag("c:hiLowLines") + + def _write_drop_lines(self): + # Write the element. + drop_lines = self.drop_lines + + if drop_lines is None: + return + + if drop_lines["line"]["defined"]: + self._xml_start_tag("c:dropLines") + + # Write the c:spPr element. + self._write_sp_pr(drop_lines) + + self._xml_end_tag("c:dropLines") + else: + self._xml_empty_tag("c:dropLines") + + def _write_overlap(self, val): + # Write the element. + + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:overlap", attributes) + + def _write_num_cache(self, data): + # Write the element. + if data: + count = len(data) + else: + count = 0 + + self._xml_start_tag("c:numCache") + + # Write the c:formatCode element. + self._write_format_code("General") + + # Write the c:ptCount element. + self._write_pt_count(count) + + for i in range(count): + token = data[i] + + if token is None: + continue + + try: + float(token) + except ValueError: + # Write non-numeric data as 0. + token = 0 + + # Write the c:pt element. + self._write_pt(i, token) + + self._xml_end_tag("c:numCache") + + def _write_str_cache(self, data): + # Write the element. + count = len(data) + + self._xml_start_tag("c:strCache") + + # Write the c:ptCount element. + self._write_pt_count(count) + + for i in range(count): + # Write the c:pt element. + self._write_pt(i, data[i]) + + self._xml_end_tag("c:strCache") + + def _write_format_code(self, data): + # Write the element. + + self._xml_data_element("c:formatCode", data) + + def _write_pt_count(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:ptCount", attributes) + + def _write_pt(self, idx, value): + # Write the element. + + if value is None: + return + + attributes = [("idx", idx)] + + self._xml_start_tag("c:pt", attributes) + + # Write the c:v element. + self._write_v(value) + + self._xml_end_tag("c:pt") + + def _write_v(self, data): + # Write the element. + + self._xml_data_element("c:v", data) + + def _write_protection(self): + # Write the element. + if not self.protection: + return + + self._xml_empty_tag("c:protection") + + def _write_d_pt(self, points): + # Write the elements. + index = -1 + + if not points: + return + + for point in points: + index += 1 + if not point: + continue + + self._write_d_pt_point(index, point) + + def _write_d_pt_point(self, index, point): + # Write an individual element. + + self._xml_start_tag("c:dPt") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:spPr element. + self._write_sp_pr(point) + + self._xml_end_tag("c:dPt") + + def _write_d_lbls(self, labels): + # Write the element. + + if not labels: + return + + self._xml_start_tag("c:dLbls") + + # Write the custom c:dLbl elements. + if labels.get("custom"): + self._write_custom_labels(labels, labels["custom"]) + + # Write the c:numFmt element. + if labels.get("num_format"): + self._write_data_label_number_format(labels["num_format"]) + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(labels) + + # Write the data label font elements. + if labels.get("font"): + self._write_axis_font(labels["font"]) + + # Write the c:dLblPos element. + if labels.get("position"): + self._write_d_lbl_pos(labels["position"]) + + # Write the c:showLegendKey element. + if labels.get("legend_key"): + self._write_show_legend_key() + + # Write the c:showVal element. + if labels.get("value"): + self._write_show_val() + + # Write the c:showCatName element. + if labels.get("category"): + self._write_show_cat_name() + + # Write the c:showSerName element. + if labels.get("series_name"): + self._write_show_ser_name() + + # Write the c:showPercent element. + if labels.get("percentage"): + self._write_show_percent() + + # Write the c:separator element. + if labels.get("separator"): + self._write_separator(labels["separator"]) + + # Write the c:showLeaderLines element. + if labels.get("leader_lines"): + self._write_show_leader_lines() + + self._xml_end_tag("c:dLbls") + + def _write_custom_labels(self, parent, labels): + # Write the element. + index = 0 + + for label in labels: + index += 1 + + if label is None: + continue + + self._xml_start_tag("c:dLbl") + + # Write the c:idx element. + self._write_idx(index - 1) + + delete_label = label.get("delete") + + if delete_label: + self._write_delete(1) + + elif label.get("formula"): + self._write_custom_label_formula(label) + + if parent.get("position"): + self._write_d_lbl_pos(parent["position"]) + + if parent.get("value"): + self._write_show_val() + if parent.get("category"): + self._write_show_cat_name() + if parent.get("series_name"): + self._write_show_ser_name() + + elif label.get("value"): + self._write_custom_label_str(label) + + if parent.get("position"): + self._write_d_lbl_pos(parent["position"]) + + if parent.get("value"): + self._write_show_val() + if parent.get("category"): + self._write_show_cat_name() + if parent.get("series_name"): + self._write_show_ser_name() + else: + self._write_custom_label_format_only(label) + + self._xml_end_tag("c:dLbl") + + def _write_custom_label_str(self, label): + # Write parts of the element for strings. + title = label.get("value") + font = label.get("font") + has_formatting = self._has_fill_formatting(label) + + # Write the c:layout element. + self._write_layout(None, None) + + self._xml_start_tag("c:tx") + + # Write the c:rich element. + self._write_rich(title, font, False, not has_formatting) + + self._xml_end_tag("c:tx") + + # Write the c:spPr element. + self._write_sp_pr(label) + + def _write_custom_label_formula(self, label): + # Write parts of the element for formulas. + formula = label.get("formula") + data_id = label.get("data_id") + data = None + + if data_id is not None: + data = self.formula_data[data_id] + + # Write the c:layout element. + self._write_layout(None, None) + + self._xml_start_tag("c:tx") + + # Write the c:strRef element. + self._write_str_ref(formula, data, "str") + + self._xml_end_tag("c:tx") + + # Write the data label formatting, if any. + self._write_custom_label_format_only(label) + + def _write_custom_label_format_only(self, label): + # Write parts of the labels with changed formatting. + font = label.get("font") + has_formatting = self._has_fill_formatting(label) + + if has_formatting: + self._write_sp_pr(label) + self._write_tx_pr(font) + elif font: + self._xml_empty_tag("c:spPr") + self._write_tx_pr(font) + + def _write_show_legend_key(self): + # Write the element. + val = "1" + + attributes = [("val", val)] + + self._xml_empty_tag("c:showLegendKey", attributes) + + def _write_show_val(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showVal", attributes) + + def _write_show_cat_name(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showCatName", attributes) + + def _write_show_ser_name(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showSerName", attributes) + + def _write_show_percent(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showPercent", attributes) + + def _write_separator(self, data): + # Write the element. + self._xml_data_element("c:separator", data) + + def _write_show_leader_lines(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showLeaderLines", attributes) + + def _write_d_lbl_pos(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:dLblPos", attributes) + + def _write_delete(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:delete", attributes) + + def _write_c_invert_if_negative(self, invert): + # Write the element. + val = 1 + + if not invert: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:invertIfNegative", attributes) + + def _write_axis_font(self, font): + # Write the axis font elements. + + if not font: + return + + self._xml_start_tag("c:txPr") + self._write_a_body_pr(font.get("rotation"), None) + self._write_a_lst_style() + self._xml_start_tag("a:p") + + self._write_a_p_pr_rich(font) + + self._write_a_end_para_rpr() + self._xml_end_tag("a:p") + self._xml_end_tag("c:txPr") + + def _write_a_latin(self, attributes): + # Write the element. + self._xml_empty_tag("a:latin", attributes) + + def _write_d_table(self): + # Write the element. + table = self.table + + if not table: + return + + self._xml_start_tag("c:dTable") + + if table["horizontal"]: + # Write the c:showHorzBorder element. + self._write_show_horz_border() + + if table["vertical"]: + # Write the c:showVertBorder element. + self._write_show_vert_border() + + if table["outline"]: + # Write the c:showOutline element. + self._write_show_outline() + + if table["show_keys"]: + # Write the c:showKeys element. + self._write_show_keys() + + if table["font"]: + # Write the table font. + self._write_tx_pr(table["font"]) + + self._xml_end_tag("c:dTable") + + def _write_show_horz_border(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showHorzBorder", attributes) + + def _write_show_vert_border(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showVertBorder", attributes) + + def _write_show_outline(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showOutline", attributes) + + def _write_show_keys(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showKeys", attributes) + + def _write_error_bars(self, error_bars): + # Write the X and Y error bars. + + if not error_bars: + return + + if error_bars["x_error_bars"]: + self._write_err_bars("x", error_bars["x_error_bars"]) + + if error_bars["y_error_bars"]: + self._write_err_bars("y", error_bars["y_error_bars"]) + + def _write_err_bars(self, direction, error_bars): + # Write the element. + + if not error_bars: + return + + self._xml_start_tag("c:errBars") + + # Write the c:errDir element. + self._write_err_dir(direction) + + # Write the c:errBarType element. + self._write_err_bar_type(error_bars["direction"]) + + # Write the c:errValType element. + self._write_err_val_type(error_bars["type"]) + + if not error_bars["endcap"]: + # Write the c:noEndCap element. + self._write_no_end_cap() + + if error_bars["type"] == "stdErr": + # Don't need to write a c:errValType tag. + pass + elif error_bars["type"] == "cust": + # Write the custom error tags. + self._write_custom_error(error_bars) + else: + # Write the c:val element. + self._write_error_val(error_bars["value"]) + + # Write the c:spPr element. + self._write_sp_pr(error_bars) + + self._xml_end_tag("c:errBars") + + def _write_err_dir(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:errDir", attributes) + + def _write_err_bar_type(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:errBarType", attributes) + + def _write_err_val_type(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:errValType", attributes) + + def _write_no_end_cap(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:noEndCap", attributes) + + def _write_error_val(self, val): + # Write the element for error bars. + + attributes = [("val", val)] + + self._xml_empty_tag("c:val", attributes) + + def _write_custom_error(self, error_bars): + # Write the custom error bars tags. + + if error_bars["plus_values"]: + # Write the c:plus element. + self._xml_start_tag("c:plus") + + if isinstance(error_bars["plus_values"], list): + self._write_num_lit(error_bars["plus_values"]) + else: + self._write_num_ref( + error_bars["plus_values"], error_bars["plus_data"], "num" + ) + self._xml_end_tag("c:plus") + + if error_bars["minus_values"]: + # Write the c:minus element. + self._xml_start_tag("c:minus") + + if isinstance(error_bars["minus_values"], list): + self._write_num_lit(error_bars["minus_values"]) + else: + self._write_num_ref( + error_bars["minus_values"], error_bars["minus_data"], "num" + ) + self._xml_end_tag("c:minus") + + def _write_num_lit(self, data): + # Write the element for literal number list elements. + count = len(data) + + # Write the c:numLit element. + self._xml_start_tag("c:numLit") + + # Write the c:formatCode element. + self._write_format_code("General") + + # Write the c:ptCount element. + self._write_pt_count(count) + + for i in range(count): + token = data[i] + + if token is None: + continue + + try: + float(token) + except ValueError: + # Write non-numeric data as 0. + token = 0 + + # Write the c:pt element. + self._write_pt(i, token) + + self._xml_end_tag("c:numLit") + + def _write_up_down_bars(self): + # Write the element. + up_down_bars = self.up_down_bars + + if up_down_bars is None: + return + + self._xml_start_tag("c:upDownBars") + + # Write the c:gapWidth element. + self._write_gap_width(150) + + # Write the c:upBars element. + self._write_up_bars(up_down_bars.get("up")) + + # Write the c:downBars element. + self._write_down_bars(up_down_bars.get("down")) + + self._xml_end_tag("c:upDownBars") + + def _write_gap_width(self, val): + # Write the element. + + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:gapWidth", attributes) + + def _write_up_bars(self, bar_format): + # Write the element. + + if bar_format["line"] and bar_format["line"]["defined"]: + self._xml_start_tag("c:upBars") + + # Write the c:spPr element. + self._write_sp_pr(bar_format) + + self._xml_end_tag("c:upBars") + else: + self._xml_empty_tag("c:upBars") + + def _write_down_bars(self, bar_format): + # Write the element. + + if bar_format["line"] and bar_format["line"]["defined"]: + self._xml_start_tag("c:downBars") + + # Write the c:spPr element. + self._write_sp_pr(bar_format) + + self._xml_end_tag("c:downBars") + else: + self._xml_empty_tag("c:downBars") + + def _write_disp_units(self, units, display): + # Write the element. + + if not units: + return + + attributes = [("val", units)] + + self._xml_start_tag("c:dispUnits") + self._xml_empty_tag("c:builtInUnit", attributes) + + if display: + self._xml_start_tag("c:dispUnitsLbl") + self._xml_empty_tag("c:layout") + self._xml_end_tag("c:dispUnitsLbl") + + self._xml_end_tag("c:dispUnits") + + def _write_a_grad_fill(self, gradient): + # Write the element. + + attributes = [("flip", "none"), ("rotWithShape", "1")] + + if gradient["type"] == "linear": + attributes = [] + + self._xml_start_tag("a:gradFill", attributes) + + # Write the a:gsLst element. + self._write_a_gs_lst(gradient) + + if gradient["type"] == "linear": + # Write the a:lin element. + self._write_a_lin(gradient["angle"]) + else: + # Write the a:path element. + self._write_a_path(gradient["type"]) + + # Write the a:tileRect element. + self._write_a_tile_rect(gradient["type"]) + + self._xml_end_tag("a:gradFill") + + def _write_a_gs_lst(self, gradient): + # Write the element. + positions = gradient["positions"] + colors = gradient["colors"] + + self._xml_start_tag("a:gsLst") + + for i in range(len(colors)): + pos = int(positions[i] * 1000) + attributes = [("pos", pos)] + self._xml_start_tag("a:gs", attributes) + + # Write the a:srgbClr element. + color = get_rgb_color(colors[i]) + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:gs") + + self._xml_end_tag("a:gsLst") + + def _write_a_lin(self, angle): + # Write the element. + + angle = int(60000 * angle) + + attributes = [ + ("ang", angle), + ("scaled", "0"), + ] + + self._xml_empty_tag("a:lin", attributes) + + def _write_a_path(self, gradient_type): + # Write the element. + + attributes = [("path", gradient_type)] + + self._xml_start_tag("a:path", attributes) + + # Write the a:fillToRect element. + self._write_a_fill_to_rect(gradient_type) + + self._xml_end_tag("a:path") + + def _write_a_fill_to_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [ + ("l", "50000"), + ("t", "50000"), + ("r", "50000"), + ("b", "50000"), + ] + else: + attributes = [ + ("l", "100000"), + ("t", "100000"), + ] + + self._xml_empty_tag("a:fillToRect", attributes) + + def _write_a_tile_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [] + else: + attributes = [ + ("r", "-100000"), + ("b", "-100000"), + ] + + self._xml_empty_tag("a:tileRect", attributes) + + def _write_a_patt_fill(self, pattern): + # Write the element. + + attributes = [("prst", pattern["pattern"])] + + self._xml_start_tag("a:pattFill", attributes) + + # Write the a:fgClr element. + self._write_a_fg_clr(pattern["fg_color"]) + + # Write the a:bgClr element. + self._write_a_bg_clr(pattern["bg_color"]) + + self._xml_end_tag("a:pattFill") + + def _write_a_fg_clr(self, color): + # Write the element. + + color = get_rgb_color(color) + + self._xml_start_tag("a:fgClr") + + # Write the a:srgbClr element. + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:fgClr") + + def _write_a_bg_clr(self, color): + # Write the element. + + color = get_rgb_color(color) + + self._xml_start_tag("a:bgClr") + + # Write the a:srgbClr element. + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:bgClr") diff --git a/billinglayer/python/xlsxwriter/chart_area.py b/billinglayer/python/xlsxwriter/chart_area.py new file mode 100644 index 0000000..6d0e37e --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_area.py @@ -0,0 +1,101 @@ +############################################################################### +# +# ChartArea - A class for writing the Excel XLSX Area charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartArea(chart.Chart): + """ + A class for writing the Excel XLSX Area charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartArea, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "standard" + + self.cross_between = "midCat" + self.show_crosses = 0 + + # Override and reset the default axis values. + if self.subtype == "percent_stacked": + self.y_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "center" + self.label_positions = {"center": "ctr"} + + self.set_y_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:areaChart element. + self._write_area_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + # + def _write_area_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + + if subtype == "percent_stacked": + subtype = "percentStacked" + + self._xml_start_tag("c:areaChart") + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:dropLines element. + self._write_drop_lines() + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:areaChart") diff --git a/billinglayer/python/xlsxwriter/chart_bar.py b/billinglayer/python/xlsxwriter/chart_bar.py new file mode 100644 index 0000000..93aa48f --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_bar.py @@ -0,0 +1,173 @@ +############################################################################### +# +# ChartBar - A class for writing the Excel XLSX Bar charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart +from warnings import warn + + +class ChartBar(chart.Chart): + """ + A class for writing the Excel XLSX Bar charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartBar, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "clustered" + + self.cat_axis_position = "l" + self.val_axis_position = "b" + self.horiz_val_axis = 0 + self.horiz_cat_axis = 1 + self.show_crosses = 0 + + # Override and reset the default axis values. + self.x_axis["defaults"]["major_gridlines"] = {"visible": 1} + self.y_axis["defaults"]["major_gridlines"] = {"visible": 0} + + if self.subtype == "percent_stacked": + self.x_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "outside_end" + self.label_positions = { + "center": "ctr", + "inside_base": "inBase", + "inside_end": "inEnd", + "outside_end": "outEnd", + } + + self.set_x_axis({}) + self.set_y_axis({}) + + def combine(self, chart=None): + """ + Create a combination chart with a secondary chart. + + Note: Override parent method to add an extra check that is required + for Bar charts to ensure that their combined chart is on a secondary + axis. + + Args: + chart: The secondary chart to combine with the primary chart. + + Returns: + Nothing. + + """ + if chart is None: + return + + if not chart.is_secondary: + warn("Charts combined with Bar charts must be on a secondary axis") + + self.combined = chart + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + if args["primary_axes"]: + # Reverse X and Y axes for Bar charts. + tmp = self.y_axis + self.y_axis = self.x_axis + self.x_axis = tmp + + if self.y2_axis["position"] == "r": + self.y2_axis["position"] = "t" + + # Write the c:barChart element. + self._write_bar_chart(args) + + def _write_bar_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + if subtype == "percent_stacked": + subtype = "percentStacked" + + # Set a default overlap for stacked charts. + if "stacked" in self.subtype and self.series_overlap_1 is None: + self.series_overlap_1 = 100 + + self._xml_start_tag("c:barChart") + + # Write the c:barDir element. + self._write_bar_dir() + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the c:ser elements. + for data in series: + self._write_ser(data) + + # Write the c:gapWidth element. + if args["primary_axes"]: + self._write_gap_width(self.series_gap_1) + else: + self._write_gap_width(self.series_gap_2) + + # Write the c:overlap element. + if args["primary_axes"]: + self._write_overlap(self.series_overlap_1) + else: + self._write_overlap(self.series_overlap_2) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:barChart") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_bar_dir(self): + # Write the element. + val = "bar" + + attributes = [("val", val)] + + self._xml_empty_tag("c:barDir", attributes) + + def _write_err_dir(self, val): + # Overridden from Chart class since it is not used in Bar charts. + pass diff --git a/billinglayer/python/xlsxwriter/chart_column.py b/billinglayer/python/xlsxwriter/chart_column.py new file mode 100644 index 0000000..20eaaa8 --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_column.py @@ -0,0 +1,132 @@ +############################################################################### +# +# ChartColumn - A class for writing the Excel XLSX Column charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartColumn(chart.Chart): + """ + A class for writing the Excel XLSX Column charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartColumn, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "clustered" + + self.horiz_val_axis = 0 + + if self.subtype == "percent_stacked": + self.y_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "outside_end" + self.label_positions = { + "center": "ctr", + "inside_base": "inBase", + "inside_end": "inEnd", + "outside_end": "outEnd", + } + + self.set_y_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + + # Write the c:barChart element. + self._write_bar_chart(args) + + def _write_bar_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + if subtype == "percent_stacked": + subtype = "percentStacked" + + # Set a default overlap for stacked charts. + if "stacked" in self.subtype and self.series_overlap_1 is None: + self.series_overlap_1 = 100 + + self._xml_start_tag("c:barChart") + + # Write the c:barDir element. + self._write_bar_dir() + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the c:ser elements. + for data in series: + self._write_ser(data) + + # Write the c:gapWidth element. + if args["primary_axes"]: + self._write_gap_width(self.series_gap_1) + else: + self._write_gap_width(self.series_gap_2) + + # Write the c:overlap element. + if args["primary_axes"]: + self._write_overlap(self.series_overlap_1) + else: + self._write_overlap(self.series_overlap_2) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:barChart") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_bar_dir(self): + # Write the element. + val = "col" + + attributes = [("val", val)] + + self._xml_empty_tag("c:barDir", attributes) + + def _write_err_dir(self, val): + # Overridden from Chart class since it is not used in Column charts. + pass diff --git a/billinglayer/python/xlsxwriter/chart_doughnut.py b/billinglayer/python/xlsxwriter/chart_doughnut.py new file mode 100644 index 0000000..adca88d --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_doughnut.py @@ -0,0 +1,99 @@ +############################################################################### +# +# ChartDoughnut - A class for writing the Excel XLSX Doughnut charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from warnings import warn +from . import chart_pie + + +class ChartDoughnut(chart_pie.ChartPie): + """ + A class for writing the Excel XLSX Doughnut charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartDoughnut, self).__init__() + + self.vary_data_color = 1 + self.rotation = 0 + self.hole_size = 50 + + def set_hole_size(self, size): + """ + Set the Doughnut chart hole size. + + Args: + size: 10 <= size <= 90. + + Returns: + Nothing. + + """ + if size is None: + return + + # Ensure the size is in Excel's range. + if size < 10 or size > 90: + warn("Chart hole size %d outside Excel range: 10 <= size <= 90" % size) + return + + self.hole_size = int(size) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:doughnutChart element. + self._write_doughnut_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_doughnut_chart(self, args): + # Write the element. Over-ridden method to remove + # axis_id code since Doughnut charts don't require val and cat axes. + self._xml_start_tag("c:doughnutChart") + + # Write the c:varyColors element. + self._write_vary_colors() + + # Write the series elements. + for data in self.series: + self._write_ser(data) + + # Write the c:firstSliceAng element. + self._write_first_slice_ang() + + # Write the c:holeSize element. + self._write_c_hole_size() + + self._xml_end_tag("c:doughnutChart") + + def _write_c_hole_size(self): + # Write the element. + attributes = [("val", self.hole_size)] + + self._xml_empty_tag("c:holeSize", attributes) diff --git a/billinglayer/python/xlsxwriter/chart_line.py b/billinglayer/python/xlsxwriter/chart_line.py new file mode 100644 index 0000000..4c73a4d --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_line.py @@ -0,0 +1,143 @@ +############################################################################### +# +# ChartLine - A class for writing the Excel XLSX Line charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartLine(chart.Chart): + """ + A class for writing the Excel XLSX Line charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartLine, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "standard" + + self.default_marker = {"type": "none"} + self.smooth_allowed = True + + # Override and reset the default axis values. + if self.subtype == "percent_stacked": + self.y_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "right" + self.label_positions = { + "center": "ctr", + "right": "r", + "left": "l", + "above": "t", + "below": "b", + # For backward compatibility. + "top": "t", + "bottom": "b", + } + + self.set_y_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:lineChart element. + self._write_line_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_line_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + + if subtype == "percent_stacked": + subtype = "percentStacked" + + self._xml_start_tag("c:lineChart") + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:dropLines element. + self._write_drop_lines() + + # Write the c:hiLowLines element. + self._write_hi_low_lines() + + # Write the c:upDownBars element. + self._write_up_down_bars() + + # Write the c:marker element. + self._write_marker_value() + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:lineChart") + + def _write_d_pt_point(self, index, point): + # Write an individual element. Override the parent method to + # add markers. + + self._xml_start_tag("c:dPt") + + # Write the c:idx element. + self._write_idx(index) + + self._xml_start_tag("c:marker") + + # Write the c:spPr element. + self._write_sp_pr(point) + + self._xml_end_tag("c:marker") + + self._xml_end_tag("c:dPt") + + def _write_marker_value(self): + # Write the element without a sub-element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:marker", attributes) diff --git a/billinglayer/python/xlsxwriter/chart_pie.py b/billinglayer/python/xlsxwriter/chart_pie.py new file mode 100644 index 0000000..908fc32 --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_pie.py @@ -0,0 +1,251 @@ +############################################################################### +# +# ChartPie - A class for writing the Excel XLSX Pie charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from warnings import warn +from . import chart + + +class ChartPie(chart.Chart): + """ + A class for writing the Excel XLSX Pie charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartPie, self).__init__() + + self.vary_data_color = 1 + self.rotation = 0 + + # Set the available data label positions for this chart type. + self.label_position_default = "best_fit" + self.label_positions = { + "center": "ctr", + "inside_end": "inEnd", + "outside_end": "outEnd", + "best_fit": "bestFit", + } + + def set_rotation(self, rotation): + """ + Set the Pie/Doughnut chart rotation: the angle of the first slice. + + Args: + rotation: First segment angle: 0 <= rotation <= 360. + + Returns: + Nothing. + + """ + if rotation is None: + return + + # Ensure the rotation is in Excel's range. + if rotation < 0 or rotation > 360: + warn( + "Chart rotation %d outside Excel range: 0 <= rotation <= 360" % rotation + ) + return + + self.rotation = int(rotation) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:pieChart element. + self._write_pie_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_pie_chart(self, args): + # Write the element. Over-ridden method to remove + # axis_id code since Pie charts don't require val and cat axes. + self._xml_start_tag("c:pieChart") + + # Write the c:varyColors element. + self._write_vary_colors() + + # Write the series elements. + for data in self.series: + self._write_ser(data) + + # Write the c:firstSliceAng element. + self._write_first_slice_ang() + + self._xml_end_tag("c:pieChart") + + def _write_plot_area(self): + # Over-ridden method to remove the cat_axis() and val_axis() code + # since Pie charts don't require those axes. + # + # Write the element. + + self._xml_start_tag("c:plotArea") + + # Write the c:layout element. + self._write_layout(self.plotarea.get("layout"), "plot") + + # Write the subclass chart type element. + self._write_chart_type(None) + # Configure a combined chart if present. + second_chart = self.combined + + if second_chart: + # Secondary axis has unique id otherwise use same as primary. + if second_chart.is_secondary: + second_chart.id = 1000 + self.id + else: + second_chart.id = self.id + + # Share the same filehandle for writing. + second_chart.fh = self.fh + + # Share series index with primary chart. + second_chart.series_index = self.series_index + + # Write the subclass chart type elements for combined chart. + second_chart._write_chart_type(None) + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(self.plotarea) + + self._xml_end_tag("c:plotArea") + + def _write_legend(self): + # Over-ridden method to add to legend. + # Write the element. + legend = self.legend + position = legend.get("position", "right") + font = legend.get("font") + delete_series = [] + overlay = 0 + + if legend.get("delete_series") and type(legend["delete_series"]) is list: + delete_series = legend["delete_series"] + + if position.startswith("overlay_"): + position = position.replace("overlay_", "") + overlay = 1 + + allowed = { + "right": "r", + "left": "l", + "top": "t", + "bottom": "b", + "top_right": "tr", + } + + if position == "none": + return + + if position not in allowed: + return + + position = allowed[position] + + self._xml_start_tag("c:legend") + + # Write the c:legendPos element. + self._write_legend_pos(position) + + # Remove series labels from the legend. + for index in delete_series: + # Write the c:legendEntry element. + self._write_legend_entry(index) + + # Write the c:layout element. + self._write_layout(legend.get("layout"), "legend") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + # Write the c:spPr element. + self._write_sp_pr(legend) + + # Write the c:txPr element. Over-ridden. + self._write_tx_pr_legend(None, font) + + self._xml_end_tag("c:legend") + + def _write_tx_pr_legend(self, horiz, font): + # Write the element for legends. + + if font and font.get("rotation"): + rotation = font["rotation"] + else: + rotation = None + + self._xml_start_tag("c:txPr") + + # Write the a:bodyPr element. + self._write_a_body_pr(rotation, horiz) + + # Write the a:lstStyle element. + self._write_a_lst_style() + + # Write the a:p element. + self._write_a_p_legend(font) + + self._xml_end_tag("c:txPr") + + def _write_a_p_legend(self, font): + # Write the element for legends. + + self._xml_start_tag("a:p") + + # Write the a:pPr element. + self._write_a_p_pr_legend(font) + + # Write the a:endParaRPr element. + self._write_a_end_para_rpr() + + self._xml_end_tag("a:p") + + def _write_a_p_pr_legend(self, font): + # Write the element for legends. + attributes = [("rtl", 0)] + + self._xml_start_tag("a:pPr", attributes) + + # Write the a:defRPr element. + self._write_a_def_rpr(font) + + self._xml_end_tag("a:pPr") + + def _write_vary_colors(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:varyColors", attributes) + + def _write_first_slice_ang(self): + # Write the element. + attributes = [("val", self.rotation)] + + self._xml_empty_tag("c:firstSliceAng", attributes) diff --git a/billinglayer/python/xlsxwriter/chart_radar.py b/billinglayer/python/xlsxwriter/chart_radar.py new file mode 100644 index 0000000..cdf62eb --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_radar.py @@ -0,0 +1,102 @@ +############################################################################### +# +# ChartRadar - A class for writing the Excel XLSX Radar charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartRadar(chart.Chart): + """ + A class for writing the Excel XLSX Radar charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartRadar, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "marker" + self.default_marker = {"type": "none"} + + # Override and reset the default axis values. + self.x_axis["defaults"]["major_gridlines"] = {"visible": 1} + self.set_x_axis({}) + + # Set the available data label positions for this chart type. + self.label_position_default = "center" + self.label_positions = {"center": "ctr"} + + # Hardcode major_tick_mark for now until there is an accessor. + self.y_axis["major_tick_mark"] = "cross" + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Write the c:radarChart element. + self._write_radar_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_radar_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + self._xml_start_tag("c:radarChart") + + # Write the c:radarStyle element. + self._write_radar_style() + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:radarChart") + + def _write_radar_style(self): + # Write the element. + val = "marker" + + if self.subtype == "filled": + val = "filled" + + attributes = [("val", val)] + + self._xml_empty_tag("c:radarStyle", attributes) diff --git a/billinglayer/python/xlsxwriter/chart_scatter.py b/billinglayer/python/xlsxwriter/chart_scatter.py new file mode 100644 index 0000000..104c9ed --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_scatter.py @@ -0,0 +1,333 @@ +############################################################################### +# +# ChartScatter - A class for writing the Excel XLSX Scatter charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart +from warnings import warn + + +class ChartScatter(chart.Chart): + """ + A class for writing the Excel XLSX Scatter charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartScatter, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "marker_only" + + self.cross_between = "midCat" + self.horiz_val_axis = 0 + self.val_axis_position = "b" + self.smooth_allowed = True + self.requires_category = True + + # Set the available data label positions for this chart type. + self.label_position_default = "right" + self.label_positions = { + "center": "ctr", + "right": "r", + "left": "l", + "above": "t", + "below": "b", + # For backward compatibility. + "top": "t", + "bottom": "b", + } + + def combine(self, chart=None): + """ + Create a combination chart with a secondary chart. + + Note: Override parent method to add a warning. + + Args: + chart: The secondary chart to combine with the primary chart. + + Returns: + Nothing. + + """ + if chart is None: + return + + warn( + "Combined chart not currently supported with scatter chart " + "as the primary chart" + ) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:scatterChart element. + self._write_scatter_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_scatter_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + style = "lineMarker" + subtype = self.subtype + + # Set the user defined chart subtype. + if subtype == "marker_only": + style = "lineMarker" + + if subtype == "straight_with_markers": + style = "lineMarker" + + if subtype == "straight": + style = "lineMarker" + self.default_marker = {"type": "none"} + + if subtype == "smooth_with_markers": + style = "smoothMarker" + + if subtype == "smooth": + style = "smoothMarker" + self.default_marker = {"type": "none"} + + # Add default formatting to the series data. + self._modify_series_formatting() + + self._xml_start_tag("c:scatterChart") + + # Write the c:scatterStyle element. + self._write_scatter_style(style) + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:scatterChart") + + def _write_ser(self, series): + # Over-ridden to write c:xVal/c:yVal instead of c:cat/c:val elements. + # Write the element. + + index = self.series_index + self.series_index += 1 + + self._xml_start_tag("c:ser") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:order element. + self._write_order(index) + + # Write the series name. + self._write_series_name(series) + + # Write the c:spPr element. + self._write_sp_pr(series) + + # Write the c:marker element. + self._write_marker(series.get("marker")) + + # Write the c:dPt element. + self._write_d_pt(series.get("points")) + + # Write the c:dLbls element. + self._write_d_lbls(series.get("labels")) + + # Write the c:trendline element. + self._write_trendline(series.get("trendline")) + + # Write the c:errBars element. + self._write_error_bars(series.get("error_bars")) + + # Write the c:xVal element. + self._write_x_val(series) + + # Write the c:yVal element. + self._write_y_val(series) + + # Write the c:smooth element. + if "smooth" in self.subtype and series["smooth"] is None: + # Default is on for smooth scatter charts. + self._write_c_smooth(True) + else: + self._write_c_smooth(series["smooth"]) + + self._xml_end_tag("c:ser") + + def _write_plot_area(self): + # Over-ridden to have 2 valAx elements for scatter charts instead + # of catAx/valAx. + # + # Write the element. + self._xml_start_tag("c:plotArea") + + # Write the c:layout element. + self._write_layout(self.plotarea.get("layout"), "plot") + + # Write the subclass chart elements for primary and secondary axes. + self._write_chart_type({"primary_axes": 1}) + self._write_chart_type({"primary_axes": 0}) + + # Write c:catAx and c:valAx elements for series using primary axes. + self._write_cat_val_axis( + { + "x_axis": self.x_axis, + "y_axis": self.y_axis, + "axis_ids": self.axis_ids, + "position": "b", + } + ) + + tmp = self.horiz_val_axis + self.horiz_val_axis = 1 + + self._write_val_axis( + { + "x_axis": self.x_axis, + "y_axis": self.y_axis, + "axis_ids": self.axis_ids, + "position": "l", + } + ) + + self.horiz_val_axis = tmp + + # Write c:valAx and c:catAx elements for series using secondary axes + self._write_cat_val_axis( + { + "x_axis": self.x2_axis, + "y_axis": self.y2_axis, + "axis_ids": self.axis2_ids, + "position": "b", + } + ) + self.horiz_val_axis = 1 + self._write_val_axis( + { + "x_axis": self.x2_axis, + "y_axis": self.y2_axis, + "axis_ids": self.axis2_ids, + "position": "l", + } + ) + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(self.plotarea) + + self._xml_end_tag("c:plotArea") + + def _write_x_val(self, series): + # Write the element. + formula = series.get("categories") + data_id = series.get("cat_data_id") + data = self.formula_data[data_id] + + self._xml_start_tag("c:xVal") + + # Check the type of cached data. + data_type = self._get_data_type(data) + + if data_type == "str": + # Write the c:numRef element. + self._write_str_ref(formula, data, data_type) + else: + # Write the c:numRef element. + self._write_num_ref(formula, data, data_type) + + self._xml_end_tag("c:xVal") + + def _write_y_val(self, series): + # Write the element. + formula = series.get("values") + data_id = series.get("val_data_id") + data = self.formula_data[data_id] + + self._xml_start_tag("c:yVal") + + # Unlike Cat axes data should only be numeric. + # Write the c:numRef element. + self._write_num_ref(formula, data, "num") + + self._xml_end_tag("c:yVal") + + def _write_scatter_style(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("c:scatterStyle", attributes) + + def _modify_series_formatting(self): + # Add default formatting to the series data unless it has already been + # specified by the user. + subtype = self.subtype + + # The default scatter style "markers only" requires a line type. + if subtype == "marker_only": + # Go through each series and define default values. + for series in self.series: + # Set a line type unless there is already a user defined type. + if not series["line"]["defined"]: + series["line"] = { + "width": 2.25, + "none": 1, + "defined": 1, + } + + def _write_d_pt_point(self, index, point): + # Write an individual element. Override the parent method to + # add markers. + + self._xml_start_tag("c:dPt") + + # Write the c:idx element. + self._write_idx(index) + + self._xml_start_tag("c:marker") + + # Write the c:spPr element. + self._write_sp_pr(point) + + self._xml_end_tag("c:marker") + + self._xml_end_tag("c:dPt") diff --git a/billinglayer/python/xlsxwriter/chart_stock.py b/billinglayer/python/xlsxwriter/chart_stock.py new file mode 100644 index 0000000..5dc9843 --- /dev/null +++ b/billinglayer/python/xlsxwriter/chart_stock.py @@ -0,0 +1,124 @@ +############################################################################### +# +# ChartStock - A class for writing the Excel XLSX Stock charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartStock(chart.Chart): + """ + A class for writing the Excel XLSX Stock charts. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartStock, self).__init__() + + self.show_crosses = 0 + self.hi_low_lines = {} + self.date_category = True + + # Override and reset the default axis values. + self.x_axis["defaults"]["num_format"] = "dd/mm/yyyy" + self.x2_axis["defaults"]["num_format"] = "dd/mm/yyyy" + + # Set the available data label positions for this chart type. + self.label_position_default = "right" + self.label_positions = { + "center": "ctr", + "right": "r", + "left": "l", + "above": "t", + "below": "b", + # For backward compatibility. + "top": "t", + "bottom": "b", + } + + self.set_x_axis({}) + self.set_x2_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:stockChart element. + self._write_stock_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_stock_chart(self, args): + # Write the element. + # Overridden to add hi_low_lines(). + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + # Add default formatting to the series data. + self._modify_series_formatting() + + self._xml_start_tag("c:stockChart") + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:dropLines element. + self._write_drop_lines() + + # Write the c:hiLowLines element. + if args.get("primary_axes"): + self._write_hi_low_lines() + + # Write the c:upDownBars element. + self._write_up_down_bars() + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:stockChart") + + def _modify_series_formatting(self): + # Add default formatting to the series data. + + index = 0 + + for series in self.series: + if index % 4 != 3: + if not series["line"]["defined"]: + series["line"] = {"width": 2.25, "none": 1, "defined": 1} + + if series["marker"] is None: + if index % 4 == 2: + series["marker"] = {"type": "dot", "size": 3} + else: + series["marker"] = {"type": "none"} + + index += 1 diff --git a/billinglayer/python/xlsxwriter/chartsheet.py b/billinglayer/python/xlsxwriter/chartsheet.py new file mode 100644 index 0000000..8ab70af --- /dev/null +++ b/billinglayer/python/xlsxwriter/chartsheet.py @@ -0,0 +1,193 @@ +############################################################################### +# +# Chartsheet - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import worksheet +from .drawing import Drawing + + +class Chartsheet(worksheet.Worksheet): + """ + A class for writing the Excel XLSX Chartsheet file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Chartsheet, self).__init__() + + self.is_chartsheet = True + self.drawing = None + self.chart = None + self.charts = [] + self.zoom_scale_normal = 0 + self.orientation = 0 + self.protection = False + + def set_chart(self, chart): + """ + Set the chart object for the chartsheet. + Args: + chart: Chart object. + Returns: + chart: A reference to the chart object. + """ + chart.embedded = False + chart.protection = self.protection + self.chart = chart + self.charts.append([0, 0, chart, 0, 0, 1, 1]) + return chart + + def protect(self, password="", options=None): + """ + Set the password and protection options of the worksheet. + + Args: + password: An optional password string. + options: A dictionary of worksheet objects to protect. + + Returns: + Nothing. + + """ + # This method is overridden from parent worksheet class. + + # Chartsheets only allow a reduced set of protect options. + copy = {} + + if not options: + options = {} + + if options.get("objects") is None: + copy["objects"] = False + else: + # Objects are default on for chartsheets, so reverse state. + copy["objects"] = not options["objects"] + + if options.get("content") is None: + copy["content"] = True + else: + copy["content"] = options["content"] + + copy["sheet"] = False + copy["scenarios"] = True + + # If objects and content are both off then the chartsheet isn't + # protected, unless it has a password. + if password == "" and copy["objects"] and not copy["content"]: + return + + if self.chart: + self.chart.protection = True + else: + self.protection = True + + # Call the parent method. + super(Chartsheet, self).protect(password, copy) + + ########################################################################### + # + # Private API. + # + ########################################################################### + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the root worksheet element. + self._write_chartsheet() + + # Write the worksheet properties. + self._write_sheet_pr() + + # Write the sheet view properties. + self._write_sheet_views() + + # Write the sheetProtection element. + self._write_sheet_protection() + + # Write the printOptions element. + self._write_print_options() + + # Write the worksheet page_margins. + self._write_page_margins() + + # Write the worksheet page setup. + self._write_page_setup() + + # Write the headerFooter element. + self._write_header_footer() + + # Write the drawing element. + self._write_drawings() + + # Close the worksheet tag. + self._xml_end_tag("chartsheet") + + # Close the file. + self._xml_close() + + def _prepare_chart(self, index, chart_id, drawing_id): + # Set up chart/drawings. + + self.chart.id = chart_id - 1 + + self.drawing = Drawing() + self.drawing.orientation = self.orientation + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml"] + ) + + self.drawing_links.append( + ["/chart", "../charts/chart" + str(chart_id) + ".xml"] + ) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_chartsheet(self): + # Write the element. This is the root element. + + schema = "http://schemas.openxmlformats.org/" + xmlns = schema + "spreadsheetml/2006/main" + xmlns_r = schema + "officeDocument/2006/relationships" + + attributes = [("xmlns", xmlns), ("xmlns:r", xmlns_r)] + + self._xml_start_tag("chartsheet", attributes) + + def _write_sheet_pr(self): + # Write the element for Sheet level properties. + attributes = [] + + if self.filter_on: + attributes.append(("filterMode", 1)) + + if self.fit_page or self.tab_color: + self._xml_start_tag("sheetPr", attributes) + self._write_tab_color() + self._write_page_set_up_pr() + self._xml_end_tag("sheetPr") + else: + self._xml_empty_tag("sheetPr", attributes) diff --git a/billinglayer/python/xlsxwriter/comments.py b/billinglayer/python/xlsxwriter/comments.py new file mode 100644 index 0000000..8c58679 --- /dev/null +++ b/billinglayer/python/xlsxwriter/comments.py @@ -0,0 +1,209 @@ +############################################################################### +# +# Comments - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter +from .utility import preserve_whitespace +from .utility import xl_rowcol_to_cell + + +class Comments(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Comments file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Comments, self).__init__() + self.author_ids = {} + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self, comments_data=[]): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the comments element. + self._write_comments() + + # Write the authors element. + self._write_authors(comments_data) + + # Write the commentList element. + self._write_comment_list(comments_data) + + self._xml_end_tag("comments") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_comments(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + + attributes = [("xmlns", xmlns)] + + self._xml_start_tag("comments", attributes) + + def _write_authors(self, comment_data): + # Write the element. + author_count = 0 + + self._xml_start_tag("authors") + + for comment in comment_data: + author = comment[3] + + if author is not None and author not in self.author_ids: + # Store the author id. + self.author_ids[author] = author_count + author_count += 1 + + # Write the author element. + self._write_author(author) + + self._xml_end_tag("authors") + + def _write_author(self, data): + # Write the element. + self._xml_data_element("author", data) + + def _write_comment_list(self, comment_data): + # Write the element. + self._xml_start_tag("commentList") + + for comment in comment_data: + row = comment[0] + col = comment[1] + text = comment[2] + author = comment[3] + font_name = comment[6] + font_size = comment[7] + font_family = comment[8] + + # Look up the author id. + author_id = None + if author is not None: + author_id = self.author_ids[author] + + # Write the comment element. + font = (font_name, font_size, font_family) + self._write_comment(row, col, text, author_id, font) + + self._xml_end_tag("commentList") + + def _write_comment(self, row, col, text, author_id, font): + # Write the element. + ref = xl_rowcol_to_cell(row, col) + + attributes = [("ref", ref)] + + if author_id is not None: + attributes.append(("authorId", author_id)) + + self._xml_start_tag("comment", attributes) + + # Write the text element. + self._write_text(text, font) + + self._xml_end_tag("comment") + + def _write_text(self, text, font): + # Write the element. + self._xml_start_tag("text") + + # Write the text r element. + self._write_text_r(text, font) + + self._xml_end_tag("text") + + def _write_text_r(self, text, font): + # Write the element. + self._xml_start_tag("r") + + # Write the rPr element. + self._write_r_pr(font) + + # Write the text r element. + self._write_text_t(text) + + self._xml_end_tag("r") + + def _write_text_t(self, text): + # Write the text element. + attributes = [] + + if preserve_whitespace(text): + attributes.append(("xml:space", "preserve")) + + self._xml_data_element("t", text, attributes) + + def _write_r_pr(self, font): + # Write the element. + self._xml_start_tag("rPr") + + # Write the sz element. + self._write_sz(font[1]) + + # Write the color element. + self._write_color() + + # Write the rFont element. + self._write_r_font(font[0]) + + # Write the family element. + self._write_family(font[2]) + + self._xml_end_tag("rPr") + + def _write_sz(self, font_size): + # Write the element. + attributes = [("val", font_size)] + + self._xml_empty_tag("sz", attributes) + + def _write_color(self): + # Write the element. + attributes = [("indexed", 81)] + + self._xml_empty_tag("color", attributes) + + def _write_r_font(self, font_name): + # Write the element. + attributes = [("val", font_name)] + + self._xml_empty_tag("rFont", attributes) + + def _write_family(self, font_family): + # Write the element. + attributes = [("val", font_family)] + + self._xml_empty_tag("family", attributes) diff --git a/billinglayer/python/xlsxwriter/contenttypes.py b/billinglayer/python/xlsxwriter/contenttypes.py new file mode 100644 index 0000000..ac345ce --- /dev/null +++ b/billinglayer/python/xlsxwriter/contenttypes.py @@ -0,0 +1,222 @@ +############################################################################### +# +# ContentTypes - A class for writing the Excel XLSX ContentTypes file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +import copy +from . import xmlwriter + +# Long namespace strings used in the class. +app_package = "application/vnd.openxmlformats-package." +app_document = "application/vnd.openxmlformats-officedocument." + +defaults = [ + ["rels", app_package + "relationships+xml"], + ["xml", "application/xml"], +] + +overrides = [ + ["/docProps/app.xml", app_document + "extended-properties+xml"], + ["/docProps/core.xml", app_package + "core-properties+xml"], + ["/xl/styles.xml", app_document + "spreadsheetml.styles+xml"], + ["/xl/theme/theme1.xml", app_document + "theme+xml"], + ["/xl/workbook.xml", app_document + "spreadsheetml.sheet.main+xml"], +] + + +class ContentTypes(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX ContentTypes file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(ContentTypes, self).__init__() + + # Copy the defaults in case we need to change them. + self.defaults = copy.deepcopy(defaults) + self.overrides = copy.deepcopy(overrides) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_types() + self._write_defaults() + self._write_overrides() + + self._xml_end_tag("Types") + + # Close the file. + self._xml_close() + + def _add_default(self, default): + # Add elements to the ContentTypes defaults. + self.defaults.append(default) + + def _add_override(self, override): + # Add elements to the ContentTypes overrides. + self.overrides.append(override) + + def _add_worksheet_name(self, worksheet_name): + # Add the name of a worksheet to the ContentTypes overrides. + worksheet_name = "/xl/worksheets/" + worksheet_name + ".xml" + + self._add_override( + (worksheet_name, app_document + "spreadsheetml.worksheet+xml") + ) + + def _add_chartsheet_name(self, chartsheet_name): + # Add the name of a chartsheet to the ContentTypes overrides. + chartsheet_name = "/xl/chartsheets/" + chartsheet_name + ".xml" + + self._add_override( + (chartsheet_name, app_document + "spreadsheetml.chartsheet+xml") + ) + + def _add_chart_name(self, chart_name): + # Add the name of a chart to the ContentTypes overrides. + chart_name = "/xl/charts/" + chart_name + ".xml" + + self._add_override((chart_name, app_document + "drawingml.chart+xml")) + + def _add_drawing_name(self, drawing_name): + # Add the name of a drawing to the ContentTypes overrides. + drawing_name = "/xl/drawings/" + drawing_name + ".xml" + + self._add_override((drawing_name, app_document + "drawing+xml")) + + def _add_vml_name(self): + # Add the name of a VML drawing to the ContentTypes defaults. + self._add_default(("vml", app_document + "vmlDrawing")) + + def _add_comment_name(self, comment_name): + # Add the name of a comment to the ContentTypes overrides. + comment_name = "/xl/" + comment_name + ".xml" + + self._add_override((comment_name, app_document + "spreadsheetml.comments+xml")) + + def _add_shared_strings(self): + # Add the sharedStrings link to the ContentTypes overrides. + self._add_override( + ("/xl/sharedStrings.xml", app_document + "spreadsheetml.sharedStrings+xml") + ) + + def _add_calc_chain(self): + # Add the calcChain link to the ContentTypes overrides. + self._add_override( + ("/xl/calcChain.xml", app_document + "spreadsheetml.calcChain+xml") + ) + + def _add_image_types(self, image_types): + # Add the image default types. + for image_type in image_types: + extension = image_type + + if image_type in ("wmf", "emf"): + image_type = "x-" + image_type + + self._add_default((extension, "image/" + image_type)) + + def _add_table_name(self, table_name): + # Add the name of a table to the ContentTypes overrides. + table_name = "/xl/tables/" + table_name + ".xml" + + self._add_override((table_name, app_document + "spreadsheetml.table+xml")) + + def _add_vba_project(self): + # Add a vbaProject to the ContentTypes defaults. + + # Change the workbook.xml content-type from xlsx to xlsm. + for i, override in enumerate(self.overrides): + if override[0] == "/xl/workbook.xml": + xlsm = "application/vnd.ms-excel.sheet.macroEnabled.main+xml" + self.overrides[i][1] = xlsm + + self._add_default(("bin", "application/vnd.ms-office.vbaProject")) + + def _add_custom_properties(self): + # Add the custom properties to the ContentTypes overrides. + self._add_override( + ("/docProps/custom.xml", app_document + "custom-properties+xml") + ) + + def _add_metadata(self): + # Add the metadata file to the ContentTypes overrides. + self._add_override( + ("/xl/metadata.xml", app_document + "spreadsheetml.sheetMetadata+xml") + ) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_defaults(self): + # Write out all of the types. + + for extension, content_type in self.defaults: + self._xml_empty_tag( + "Default", [("Extension", extension), ("ContentType", content_type)] + ) + + def _write_overrides(self): + # Write out all of the types. + for part_name, content_type in self.overrides: + self._xml_empty_tag( + "Override", [("PartName", part_name), ("ContentType", content_type)] + ) + + def _write_types(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/package/2006/content-types" + + attributes = [ + ( + "xmlns", + xmlns, + ) + ] + self._xml_start_tag("Types", attributes) + + def _write_default(self, extension, content_type): + # Write the element. + attributes = [ + ("Extension", extension), + ("ContentType", content_type), + ] + + self._xml_empty_tag("Default", attributes) + + def _write_override(self, part_name, content_type): + # Write the element. + attributes = [ + ("PartName", part_name), + ("ContentType", content_type), + ] + + self._xml_empty_tag("Override", attributes) diff --git a/billinglayer/python/xlsxwriter/core.py b/billinglayer/python/xlsxwriter/core.py new file mode 100644 index 0000000..905736f --- /dev/null +++ b/billinglayer/python/xlsxwriter/core.py @@ -0,0 +1,205 @@ +############################################################################### +# +# Core - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +from datetime import datetime + +# Package imports. +from . import xmlwriter + + +class Core(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Core file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Core, self).__init__() + + self.properties = {} + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_cp_core_properties() + self._write_dc_title() + self._write_dc_subject() + self._write_dc_creator() + self._write_cp_keywords() + self._write_dc_description() + self._write_cp_last_modified_by() + self._write_dcterms_created() + self._write_dcterms_modified() + self._write_cp_category() + self._write_cp_content_status() + + self._xml_end_tag("cp:coreProperties") + + # Close the file. + self._xml_close() + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + def _datetime_to_iso8601_date(self, date): + # Convert to a ISO 8601 style "2010-01-01T00:00:00Z" date. + if not date: + date = datetime.utcnow() + + return date.strftime("%Y-%m-%dT%H:%M:%SZ") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_cp_core_properties(self): + # Write the element. + + xmlns_cp = ( + "http://schemas.openxmlformats.org/package/2006/" + + "metadata/core-properties" + ) + xmlns_dc = "http://purl.org/dc/elements/1.1/" + xmlns_dcterms = "http://purl.org/dc/terms/" + xmlns_dcmitype = "http://purl.org/dc/dcmitype/" + xmlns_xsi = "http://www.w3.org/2001/XMLSchema-instance" + + attributes = [ + ("xmlns:cp", xmlns_cp), + ("xmlns:dc", xmlns_dc), + ("xmlns:dcterms", xmlns_dcterms), + ("xmlns:dcmitype", xmlns_dcmitype), + ("xmlns:xsi", xmlns_xsi), + ] + + self._xml_start_tag("cp:coreProperties", attributes) + + def _write_dc_creator(self): + # Write the element. + data = self.properties.get("author", "") + + self._xml_data_element("dc:creator", data) + + def _write_cp_last_modified_by(self): + # Write the element. + data = self.properties.get("author", "") + + self._xml_data_element("cp:lastModifiedBy", data) + + def _write_dcterms_created(self): + # Write the element. + date = self.properties.get("created", datetime.utcnow()) + + xsi_type = "dcterms:W3CDTF" + + date = self._datetime_to_iso8601_date(date) + + attributes = [ + ( + "xsi:type", + xsi_type, + ) + ] + + self._xml_data_element("dcterms:created", date, attributes) + + def _write_dcterms_modified(self): + # Write the element. + date = self.properties.get("created", datetime.utcnow()) + + xsi_type = "dcterms:W3CDTF" + + date = self._datetime_to_iso8601_date(date) + + attributes = [ + ( + "xsi:type", + xsi_type, + ) + ] + + self._xml_data_element("dcterms:modified", date, attributes) + + def _write_dc_title(self): + # Write the element. + if "title" in self.properties: + data = self.properties["title"] + else: + return + + self._xml_data_element("dc:title", data) + + def _write_dc_subject(self): + # Write the element. + if "subject" in self.properties: + data = self.properties["subject"] + else: + return + + self._xml_data_element("dc:subject", data) + + def _write_cp_keywords(self): + # Write the element. + if "keywords" in self.properties: + data = self.properties["keywords"] + else: + return + + self._xml_data_element("cp:keywords", data) + + def _write_dc_description(self): + # Write the element. + if "comments" in self.properties: + data = self.properties["comments"] + else: + return + + self._xml_data_element("dc:description", data) + + def _write_cp_category(self): + # Write the element. + if "category" in self.properties: + data = self.properties["category"] + else: + return + + self._xml_data_element("cp:category", data) + + def _write_cp_content_status(self): + # Write the element. + if "status" in self.properties: + data = self.properties["status"] + else: + return + + self._xml_data_element("cp:contentStatus", data) diff --git a/billinglayer/python/xlsxwriter/custom.py b/billinglayer/python/xlsxwriter/custom.py new file mode 100644 index 0000000..39aabae --- /dev/null +++ b/billinglayer/python/xlsxwriter/custom.py @@ -0,0 +1,141 @@ +############################################################################### +# +# Custom - A class for writing the Excel XLSX Custom Property file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class Custom(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Custom Workbook Property file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Custom, self).__init__() + + self.properties = [] + self.pid = 1 + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_properties() + + self._xml_end_tag("Properties") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_properties(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/2006/" + xmlns = schema + "custom-properties" + xmlns_vt = schema + "docPropsVTypes" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:vt", xmlns_vt), + ] + + self._xml_start_tag("Properties", attributes) + + for custom_property in self.properties: + # Write the property element. + self._write_property(custom_property) + + def _write_property(self, custom_property): + # Write the element. + + fmtid = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" + + name, value, property_type = custom_property + self.pid += 1 + + attributes = [ + ("fmtid", fmtid), + ("pid", self.pid), + ("name", name), + ] + + self._xml_start_tag("property", attributes) + + if property_type == "number_int": + # Write the vt:i4 element. + self._write_vt_i4(value) + elif property_type == "number": + # Write the vt:r8 element. + self._write_vt_r8(value) + elif property_type == "date": + # Write the vt:filetime element. + self._write_vt_filetime(value) + elif property_type == "bool": + # Write the vt:bool element. + self._write_vt_bool(value) + else: + # Write the vt:lpwstr element. + self._write_vt_lpwstr(value) + + self._xml_end_tag("property") + + def _write_vt_lpwstr(self, value): + # Write the element. + self._xml_data_element("vt:lpwstr", value) + + def _write_vt_filetime(self, value): + # Write the element. + self._xml_data_element("vt:filetime", value) + + def _write_vt_i4(self, value): + # Write the element. + self._xml_data_element("vt:i4", value) + + def _write_vt_r8(self, value): + # Write the element. + self._xml_data_element("vt:r8", value) + + def _write_vt_bool(self, value): + # Write the element. + + if value: + value = "true" + else: + value = "false" + + self._xml_data_element("vt:bool", value) diff --git a/billinglayer/python/xlsxwriter/drawing.py b/billinglayer/python/xlsxwriter/drawing.py new file mode 100644 index 0000000..152f4c6 --- /dev/null +++ b/billinglayer/python/xlsxwriter/drawing.py @@ -0,0 +1,1204 @@ +############################################################################### +# +# Drawing - A class for writing the Excel XLSX Drawing file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter +from .shape import Shape +from .utility import get_rgb_color + + +class Drawing(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Drawing file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Drawing, self).__init__() + + self.drawings = [] + self.embedded = 0 + self.orientation = 0 + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the xdr:wsDr element. + self._write_drawing_workspace() + + if self.embedded: + index = 0 + for drawing_properties in self.drawings: + # Write the xdr:twoCellAnchor element. + index += 1 + self._write_two_cell_anchor(index, drawing_properties) + + else: + # Write the xdr:absoluteAnchor element. + self._write_absolute_anchor(1) + + self._xml_end_tag("xdr:wsDr") + + # Close the file. + self._xml_close() + + def _add_drawing_object(self): + # Add a chart, image or shape sub object to the drawing. + + drawing_object = { + "anchor_type": None, + "dimensions": [], + "width": 0, + "height": 0, + "shape": None, + "anchor": None, + "rel_index": 0, + "url_rel_index": 0, + "tip": None, + "name": None, + "description": None, + "decorative": False, + } + + self.drawings.append(drawing_object) + + return drawing_object + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_drawing_workspace(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/drawingml/" + xmlns_xdr = schema + "2006/spreadsheetDrawing" + xmlns_a = schema + "2006/main" + + attributes = [ + ("xmlns:xdr", xmlns_xdr), + ("xmlns:a", xmlns_a), + ] + + self._xml_start_tag("xdr:wsDr", attributes) + + def _write_two_cell_anchor(self, index, drawing_properties): + # Write the element. + anchor_type = drawing_properties["type"] + dimensions = drawing_properties["dimensions"] + col_from = dimensions[0] + row_from = dimensions[1] + col_from_offset = dimensions[2] + row_from_offset = dimensions[3] + col_to = dimensions[4] + row_to = dimensions[5] + col_to_offset = dimensions[6] + row_to_offset = dimensions[7] + col_absolute = dimensions[8] + row_absolute = dimensions[9] + width = drawing_properties["width"] + height = drawing_properties["height"] + shape = drawing_properties["shape"] + anchor = drawing_properties["anchor"] + rel_index = drawing_properties["rel_index"] + url_rel_index = drawing_properties["url_rel_index"] + tip = drawing_properties["tip"] + name = drawing_properties["name"] + description = drawing_properties["description"] + decorative = drawing_properties["decorative"] + + attributes = [] + + # Add attribute for positioning. + if anchor == 2: + attributes.append(("editAs", "oneCell")) + elif anchor == 3: + attributes.append(("editAs", "absolute")) + + # Add editAs attribute for shapes. + if shape and shape.edit_as: + attributes.append(("editAs", shape.edit_as)) + + self._xml_start_tag("xdr:twoCellAnchor", attributes) + + # Write the xdr:from element. + self._write_from(col_from, row_from, col_from_offset, row_from_offset) + + # Write the xdr:from element. + self._write_to(col_to, row_to, col_to_offset, row_to_offset) + + if anchor_type == 1: + # Graphic frame. + # Write the xdr:graphicFrame element for charts. + self._write_graphic_frame(index, rel_index, name, description, decorative) + elif anchor_type == 2: + # Write the xdr:pic element. + self._write_pic( + index, + rel_index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ) + else: + # Write the xdr:sp element for shapes. + self._write_sp( + index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ) + + # Write the xdr:clientData element. + self._write_client_data() + + self._xml_end_tag("xdr:twoCellAnchor") + + def _write_absolute_anchor(self, frame_index): + self._xml_start_tag("xdr:absoluteAnchor") + # Write the element. + + # Different coordinates for horizontal (= 0) and vertical (= 1). + if self.orientation == 0: + # Write the xdr:pos element. + self._write_pos(0, 0) + + # Write the xdr:ext element. + self._write_xdr_ext(9308969, 6078325) + + else: + # Write the xdr:pos element. + self._write_pos(0, -47625) + + # Write the xdr:ext element. + self._write_xdr_ext(6162675, 6124575) + + # Write the xdr:graphicFrame element. + self._write_graphic_frame(frame_index, frame_index) + + # Write the xdr:clientData element. + self._write_client_data() + + self._xml_end_tag("xdr:absoluteAnchor") + + def _write_from(self, col, row, col_offset, row_offset): + # Write the element. + self._xml_start_tag("xdr:from") + + # Write the xdr:col element. + self._write_col(col) + + # Write the xdr:colOff element. + self._write_col_off(col_offset) + + # Write the xdr:row element. + self._write_row(row) + + # Write the xdr:rowOff element. + self._write_row_off(row_offset) + + self._xml_end_tag("xdr:from") + + def _write_to(self, col, row, col_offset, row_offset): + # Write the element. + self._xml_start_tag("xdr:to") + + # Write the xdr:col element. + self._write_col(col) + + # Write the xdr:colOff element. + self._write_col_off(col_offset) + + # Write the xdr:row element. + self._write_row(row) + + # Write the xdr:rowOff element. + self._write_row_off(row_offset) + + self._xml_end_tag("xdr:to") + + def _write_col(self, data): + # Write the element. + self._xml_data_element("xdr:col", data) + + def _write_col_off(self, data): + # Write the element. + self._xml_data_element("xdr:colOff", data) + + def _write_row(self, data): + # Write the element. + self._xml_data_element("xdr:row", data) + + def _write_row_off(self, data): + # Write the element. + self._xml_data_element("xdr:rowOff", data) + + def _write_pos(self, x, y): + # Write the element. + + attributes = [("x", x), ("y", y)] + + self._xml_empty_tag("xdr:pos", attributes) + + def _write_xdr_ext(self, cx, cy): + # Write the element. + + attributes = [("cx", cx), ("cy", cy)] + + self._xml_empty_tag("xdr:ext", attributes) + + def _write_graphic_frame( + self, index, rel_index, name=None, description=None, decorative=None + ): + # Write the element. + attributes = [("macro", "")] + + self._xml_start_tag("xdr:graphicFrame", attributes) + + # Write the xdr:nvGraphicFramePr element. + self._write_nv_graphic_frame_pr(index, name, description, decorative) + + # Write the xdr:xfrm element. + self._write_xfrm() + + # Write the a:graphic element. + self._write_atag_graphic(rel_index) + + self._xml_end_tag("xdr:graphicFrame") + + def _write_nv_graphic_frame_pr(self, index, name, description, decorative): + # Write the element. + + if not name: + name = "Chart " + str(index) + + self._xml_start_tag("xdr:nvGraphicFramePr") + + # Write the xdr:cNvPr element. + self._write_c_nv_pr(index + 1, name, description, None, None, decorative) + + # Write the xdr:cNvGraphicFramePr element. + self._write_c_nv_graphic_frame_pr() + + self._xml_end_tag("xdr:nvGraphicFramePr") + + def _write_c_nv_pr(self, index, name, description, url_rel_index, tip, decorative): + # Write the element. + attributes = [("id", index), ("name", name)] + + # Add description attribute for images. + if description and not decorative: + attributes.append(("descr", description)) + + if url_rel_index or decorative: + self._xml_start_tag("xdr:cNvPr", attributes) + + if url_rel_index: + self._write_a_hlink_click(url_rel_index, tip) + + if decorative: + self._write_decorative() + + self._xml_end_tag("xdr:cNvPr") + else: + self._xml_empty_tag("xdr:cNvPr", attributes) + + def _write_decorative(self): + self._xml_start_tag("a:extLst") + + self._write_uri_ext("{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}") + self._write_a16_creation_id() + self._xml_end_tag("a:ext") + + self._write_uri_ext("{C183D7F6-B498-43B3-948B-1728B52AA6E4}") + self._write_adec_decorative() + self._xml_end_tag("a:ext") + + self._xml_end_tag("a:extLst") + + def _write_uri_ext(self, uri): + # Write the element. + attributes = [("uri", uri)] + + self._xml_start_tag("a:ext", attributes) + + def _write_adec_decorative(self): + # Write the element. + xmlns = "http://schemas.microsoft.com/office/drawing/2017/decorative" + val = "1" + + attributes = [ + ("xmlns:adec", xmlns), + ("val", val), + ] + + self._xml_empty_tag("adec:decorative", attributes) + + def _write_a16_creation_id(self): + # Write the element. + + xmlns_a_16 = "http://schemas.microsoft.com/office/drawing/2014/main" + creation_id = "{00000000-0008-0000-0000-000002000000}" + + attributes = [ + ("xmlns:a16", xmlns_a_16), + ("id", creation_id), + ] + + self._xml_empty_tag("a16:creationId", attributes) + + def _write_a_hlink_click(self, rel_index, tip): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/" + xmlns_r = schema + "2006/relationships" + + attributes = [ + ("xmlns:r", xmlns_r), + ("r:id", "rId" + str(rel_index)), + ] + + if tip: + attributes.append(("tooltip", tip)) + + self._xml_empty_tag("a:hlinkClick", attributes) + + def _write_c_nv_graphic_frame_pr(self): + # Write the element. + if self.embedded: + self._xml_empty_tag("xdr:cNvGraphicFramePr") + else: + self._xml_start_tag("xdr:cNvGraphicFramePr") + + # Write the a:graphicFrameLocks element. + self._write_a_graphic_frame_locks() + + self._xml_end_tag("xdr:cNvGraphicFramePr") + + def _write_a_graphic_frame_locks(self): + # Write the element. + attributes = [("noGrp", 1)] + + self._xml_empty_tag("a:graphicFrameLocks", attributes) + + def _write_xfrm(self): + # Write the element. + self._xml_start_tag("xdr:xfrm") + + # Write the xfrmOffset element. + self._write_xfrm_offset() + + # Write the xfrmOffset element. + self._write_xfrm_extension() + + self._xml_end_tag("xdr:xfrm") + + def _write_xfrm_offset(self): + # Write the xfrm sub-element. + + attributes = [ + ("x", 0), + ("y", 0), + ] + + self._xml_empty_tag("a:off", attributes) + + def _write_xfrm_extension(self): + # Write the xfrm sub-element. + + attributes = [ + ("cx", 0), + ("cy", 0), + ] + + self._xml_empty_tag("a:ext", attributes) + + def _write_atag_graphic(self, index): + # Write the element. + self._xml_start_tag("a:graphic") + + # Write the a:graphicData element. + self._write_atag_graphic_data(index) + + self._xml_end_tag("a:graphic") + + def _write_atag_graphic_data(self, index): + # Write the element. + uri = "http://schemas.openxmlformats.org/drawingml/2006/chart" + + attributes = [ + ( + "uri", + uri, + ) + ] + + self._xml_start_tag("a:graphicData", attributes) + + # Write the c:chart element. + self._write_c_chart("rId" + str(index)) + + self._xml_end_tag("a:graphicData") + + def _write_c_chart(self, r_id): + # Write the element. + + schema = "http://schemas.openxmlformats.org/" + xmlns_c = schema + "drawingml/2006/chart" + xmlns_r = schema + "officeDocument/2006/relationships" + + attributes = [ + ("xmlns:c", xmlns_c), + ("xmlns:r", xmlns_r), + ("r:id", r_id), + ] + + self._xml_empty_tag("c:chart", attributes) + + def _write_client_data(self): + # Write the element. + self._xml_empty_tag("xdr:clientData") + + def _write_sp( + self, + index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ): + # Write the element. + + if shape and shape.connect: + attributes = [("macro", "")] + self._xml_start_tag("xdr:cxnSp", attributes) + + # Write the xdr:nvCxnSpPr element. + self._write_nv_cxn_sp_pr(index, shape) + + # Write the xdr:spPr element. + self._write_xdr_sp_pr( + index, col_absolute, row_absolute, width, height, shape + ) + + self._xml_end_tag("xdr:cxnSp") + else: + # Add attribute for shapes. + attributes = [("macro", ""), ("textlink", shape.textlink)] + + self._xml_start_tag("xdr:sp", attributes) + + # Write the xdr:nvSpPr element. + self._write_nv_sp_pr( + index, shape, url_rel_index, tip, description, decorative + ) + + # Write the xdr:spPr element. + self._write_xdr_sp_pr( + index, col_absolute, row_absolute, width, height, shape + ) + + # Write the xdr:style element. + self._write_style() + + # Write the xdr:txBody element. + if shape.text is not None: + self._write_tx_body(col_absolute, row_absolute, width, height, shape) + + self._xml_end_tag("xdr:sp") + + def _write_nv_cxn_sp_pr(self, index, shape): + # Write the element. + self._xml_start_tag("xdr:nvCxnSpPr") + + name = shape.name + " " + str(index) + if name is not None: + self._write_c_nv_pr(index, name, None, None, None, None) + + self._xml_start_tag("xdr:cNvCxnSpPr") + + attributes = [("noChangeShapeType", "1")] + self._xml_empty_tag("a:cxnSpLocks", attributes) + + if shape.start: + attributes = [("id", shape.start), ("idx", shape.start_index)] + self._xml_empty_tag("a:stCxn", attributes) + + if shape.end: + attributes = [("id", shape.end), ("idx", shape.end_index)] + self._xml_empty_tag("a:endCxn", attributes) + + self._xml_end_tag("xdr:cNvCxnSpPr") + self._xml_end_tag("xdr:nvCxnSpPr") + + def _write_nv_sp_pr( + self, index, shape, url_rel_index, tip, description, decorative + ): + # Write the element. + attributes = [] + + self._xml_start_tag("xdr:nvSpPr") + + name = shape.name + " " + str(index) + + self._write_c_nv_pr( + index + 1, name, description, url_rel_index, tip, decorative + ) + + if shape.name == "TextBox": + attributes = [("txBox", 1)] + + self._xml_empty_tag("xdr:cNvSpPr", attributes) + + self._xml_end_tag("xdr:nvSpPr") + + def _write_pic( + self, + index, + rel_index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ): + # Write the element. + self._xml_start_tag("xdr:pic") + + # Write the xdr:nvPicPr element. + self._write_nv_pic_pr( + index, rel_index, description, url_rel_index, tip, decorative + ) + # Write the xdr:blipFill element. + self._write_blip_fill(rel_index) + + # Write the xdr:spPr element. + self._write_sp_pr(col_absolute, row_absolute, width, height, shape) + + self._xml_end_tag("xdr:pic") + + def _write_nv_pic_pr( + self, index, rel_index, description, url_rel_index, tip, decorative + ): + # Write the element. + self._xml_start_tag("xdr:nvPicPr") + + # Write the xdr:cNvPr element. + self._write_c_nv_pr( + index + 1, + "Picture " + str(index), + description, + url_rel_index, + tip, + decorative, + ) + + # Write the xdr:cNvPicPr element. + self._write_c_nv_pic_pr() + + self._xml_end_tag("xdr:nvPicPr") + + def _write_c_nv_pic_pr(self): + # Write the element. + self._xml_start_tag("xdr:cNvPicPr") + + # Write the a:picLocks element. + self._write_a_pic_locks() + + self._xml_end_tag("xdr:cNvPicPr") + + def _write_a_pic_locks(self): + # Write the element. + attributes = [("noChangeAspect", 1)] + + self._xml_empty_tag("a:picLocks", attributes) + + def _write_blip_fill(self, index): + # Write the element. + self._xml_start_tag("xdr:blipFill") + + # Write the a:blip element. + self._write_a_blip(index) + + # Write the a:stretch element. + self._write_a_stretch() + + self._xml_end_tag("xdr:blipFill") + + def _write_a_blip(self, index): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/" + xmlns_r = schema + "2006/relationships" + r_embed = "rId" + str(index) + + attributes = [("xmlns:r", xmlns_r), ("r:embed", r_embed)] + + self._xml_empty_tag("a:blip", attributes) + + def _write_a_stretch(self): + # Write the element. + self._xml_start_tag("a:stretch") + + # Write the a:fillRect element. + self._write_a_fill_rect() + + self._xml_end_tag("a:stretch") + + def _write_a_fill_rect(self): + # Write the element. + self._xml_empty_tag("a:fillRect") + + def _write_sp_pr(self, col_absolute, row_absolute, width, height, shape=None): + # Write the element, for charts. + + self._xml_start_tag("xdr:spPr") + + # Write the a:xfrm element. + self._write_a_xfrm(col_absolute, row_absolute, width, height) + + # Write the a:prstGeom element. + self._write_a_prst_geom(shape) + + self._xml_end_tag("xdr:spPr") + + def _write_xdr_sp_pr(self, index, col_absolute, row_absolute, width, height, shape): + # Write the element for shapes. + self._xml_start_tag("xdr:spPr") + + # Write the a:xfrm element. + self._write_a_xfrm(col_absolute, row_absolute, width, height, shape) + + # Write the a:prstGeom element. + self._write_a_prst_geom(shape) + + if shape.fill: + if not shape.fill["defined"]: + # Write the a:solidFill element. + self._write_a_solid_fill_scheme("lt1") + elif "none" in shape.fill: + # Write the a:noFill element. + self._xml_empty_tag("a:noFill") + elif "color" in shape.fill: + # Write the a:solidFill element. + self._write_a_solid_fill(get_rgb_color(shape.fill["color"])) + + if shape.gradient: + # Write the a:gradFill element. + self._write_a_grad_fill(shape.gradient) + + # Write the a:ln element. + self._write_a_ln(shape.line) + + self._xml_end_tag("xdr:spPr") + + def _write_a_xfrm(self, col_absolute, row_absolute, width, height, shape=None): + # Write the element. + attributes = [] + + if shape: + if shape.rotation: + rotation = shape.rotation + rotation *= 60000 + attributes.append(("rot", rotation)) + + if shape.flip_h: + attributes.append(("flipH", 1)) + if shape.flip_v: + attributes.append(("flipV", 1)) + + self._xml_start_tag("a:xfrm", attributes) + + # Write the a:off element. + self._write_a_off(col_absolute, row_absolute) + + # Write the a:ext element. + self._write_a_ext(width, height) + + self._xml_end_tag("a:xfrm") + + def _write_a_off(self, x, y): + # Write the element. + attributes = [ + ("x", x), + ("y", y), + ] + + self._xml_empty_tag("a:off", attributes) + + def _write_a_ext(self, cx, cy): + # Write the element. + attributes = [ + ("cx", cx), + ("cy", cy), + ] + + self._xml_empty_tag("a:ext", attributes) + + def _write_a_prst_geom(self, shape=None): + # Write the element. + attributes = [("prst", "rect")] + + self._xml_start_tag("a:prstGeom", attributes) + + # Write the a:avLst element. + self._write_a_av_lst(shape) + + self._xml_end_tag("a:prstGeom") + + def _write_a_av_lst(self, shape=None): + # Write the element. + adjustments = [] + + if shape and shape.adjustments: + adjustments = shape.adjustments + + if adjustments: + self._xml_start_tag("a:avLst") + + i = 0 + for adj in adjustments: + i += 1 + # Only connectors have multiple adjustments. + if shape.connect: + suffix = i + else: + suffix = "" + + # Scale Adjustments: 100,000 = 100%. + adj_int = str(int(adj * 1000)) + + attributes = [("name", "adj" + suffix), ("fmla", "val" + adj_int)] + + self._xml_empty_tag("a:gd", attributes) + + self._xml_end_tag("a:avLst") + else: + self._xml_empty_tag("a:avLst") + + def _write_a_solid_fill(self, rgb): + # Write the element. + if rgb is None: + rgb = "FFFFFF" + + self._xml_start_tag("a:solidFill") + + # Write the a:srgbClr element. + self._write_a_srgb_clr(rgb) + + self._xml_end_tag("a:solidFill") + + def _write_a_solid_fill_scheme(self, color, shade=None): + attributes = [("val", color)] + + self._xml_start_tag("a:solidFill") + + if shade: + self._xml_start_tag("a:schemeClr", attributes) + self._write_a_shade(shade) + self._xml_end_tag("a:schemeClr") + else: + self._xml_empty_tag("a:schemeClr", attributes) + + self._xml_end_tag("a:solidFill") + + def _write_a_ln(self, line): + # Write the element. + width = line.get("width", 0.75) + + # Round width to nearest 0.25, like Excel. + width = int((width + 0.125) * 4) / 4.0 + + # Convert to internal units. + width = int(0.5 + (12700 * width)) + + attributes = [("w", width), ("cmpd", "sng")] + + self._xml_start_tag("a:ln", attributes) + + if "none" in line: + # Write the a:noFill element. + self._xml_empty_tag("a:noFill") + + elif "color" in line: + # Write the a:solidFill element. + self._write_a_solid_fill(get_rgb_color(line["color"])) + + else: + # Write the a:solidFill element. + self._write_a_solid_fill_scheme("lt1", "50000") + + # Write the line/dash type. + line_type = line.get("dash_type") + if line_type: + # Write the a:prstDash element. + self._write_a_prst_dash(line_type) + + self._xml_end_tag("a:ln") + + def _write_tx_body(self, col_absolute, row_absolute, width, height, shape): + # Write the element. + attributes = [] + + if shape.text_rotation != 0: + if shape.text_rotation == 90: + attributes.append(("vert", "vert270")) + if shape.text_rotation == -90: + attributes.append(("vert", "vert")) + if shape.text_rotation == 270: + attributes.append(("vert", "wordArtVert")) + if shape.text_rotation == 271: + attributes.append(("vert", "eaVert")) + + attributes.append(("wrap", "square")) + attributes.append(("rtlCol", "0")) + + if not shape.align["defined"]: + attributes.append(("anchor", "t")) + else: + if "vertical" in shape.align: + align = shape.align["vertical"] + if align == "top": + attributes.append(("anchor", "t")) + elif align == "middle": + attributes.append(("anchor", "ctr")) + elif align == "bottom": + attributes.append(("anchor", "b")) + else: + attributes.append(("anchor", "t")) + + if "horizontal" in shape.align: + align = shape.align["horizontal"] + if align == "center": + attributes.append(("anchorCtr", "1")) + else: + attributes.append(("anchorCtr", "0")) + + self._xml_start_tag("xdr:txBody") + self._xml_empty_tag("a:bodyPr", attributes) + self._xml_empty_tag("a:lstStyle") + + lines = shape.text.split("\n") + + # Set the font attributes. + font = shape.font + style_attrs = Shape._get_font_style_attributes(font) + latin_attrs = Shape._get_font_latin_attributes(font) + style_attrs.insert(0, ("lang", font["lang"])) + + if shape.textlink != "": + attributes = [ + ("id", "{B8ADDEFE-BF52-4FD4-8C5D-6B85EF6FF707}"), + ("type", "TxLink"), + ] + + self._xml_start_tag("a:p") + self._xml_start_tag("a:fld", attributes) + + self._write_font_run(font, style_attrs, latin_attrs, "a:rPr") + + self._xml_data_element("a:t", shape.text) + self._xml_end_tag("a:fld") + + self._write_font_run(font, style_attrs, latin_attrs, "a:endParaRPr") + + self._xml_end_tag("a:p") + else: + for line in lines: + self._xml_start_tag("a:p") + + if line == "": + self._write_font_run(font, style_attrs, latin_attrs, "a:endParaRPr") + self._xml_end_tag("a:p") + continue + elif "text" in shape.align: + if shape.align["text"] == "left": + self._xml_empty_tag("a:pPr", [("algn", "l")]) + if shape.align["text"] == "center": + self._xml_empty_tag("a:pPr", [("algn", "ctr")]) + if shape.align["text"] == "right": + self._xml_empty_tag("a:pPr", [("algn", "r")]) + + self._xml_start_tag("a:r") + + self._write_font_run(font, style_attrs, latin_attrs, "a:rPr") + + self._xml_data_element("a:t", line) + + self._xml_end_tag("a:r") + self._xml_end_tag("a:p") + + self._xml_end_tag("xdr:txBody") + + def _write_font_run(self, font, style_attrs, latin_attrs, run_type): + # Write a:rPr or a:endParaRPr. + if font.get("color") is not None: + has_color = True + else: + has_color = False + + if latin_attrs or has_color: + self._xml_start_tag(run_type, style_attrs) + + if has_color: + self._write_a_solid_fill(get_rgb_color(font["color"])) + + if latin_attrs: + self._write_a_latin(latin_attrs) + self._write_a_cs(latin_attrs) + + self._xml_end_tag(run_type) + else: + self._xml_empty_tag(run_type, style_attrs) + + def _write_style(self): + # Write the element. + self._xml_start_tag("xdr:style") + + # Write the a:lnRef element. + self._write_a_ln_ref() + + # Write the a:fillRef element. + self._write_a_fill_ref() + + # Write the a:effectRef element. + self._write_a_effect_ref() + + # Write the a:fontRef element. + self._write_a_font_ref() + + self._xml_end_tag("xdr:style") + + def _write_a_ln_ref(self): + # Write the element. + attributes = [("idx", "0")] + + self._xml_start_tag("a:lnRef", attributes) + + # Write the a:scrgbClr element. + self._write_a_scrgb_clr() + + self._xml_end_tag("a:lnRef") + + def _write_a_fill_ref(self): + # Write the element. + attributes = [("idx", "0")] + + self._xml_start_tag("a:fillRef", attributes) + + # Write the a:scrgbClr element. + self._write_a_scrgb_clr() + + self._xml_end_tag("a:fillRef") + + def _write_a_effect_ref(self): + # Write the element. + attributes = [("idx", "0")] + + self._xml_start_tag("a:effectRef", attributes) + + # Write the a:scrgbClr element. + self._write_a_scrgb_clr() + + self._xml_end_tag("a:effectRef") + + def _write_a_scrgb_clr(self): + # Write the element. + + attributes = [ + ("r", "0"), + ("g", "0"), + ("b", "0"), + ] + + self._xml_empty_tag("a:scrgbClr", attributes) + + def _write_a_font_ref(self): + # Write the element. + attributes = [("idx", "minor")] + + self._xml_start_tag("a:fontRef", attributes) + + # Write the a:schemeClr element. + self._write_a_scheme_clr("dk1") + + self._xml_end_tag("a:fontRef") + + def _write_a_scheme_clr(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("a:schemeClr", attributes) + + def _write_a_shade(self, shade): + # Write the element. + attributes = [("val", shade)] + + self._xml_empty_tag("a:shade", attributes) + + def _write_a_prst_dash(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("a:prstDash", attributes) + + def _write_a_grad_fill(self, gradient): + # Write the element. + + attributes = [("flip", "none"), ("rotWithShape", "1")] + + if gradient["type"] == "linear": + attributes = [] + + self._xml_start_tag("a:gradFill", attributes) + + # Write the a:gsLst element. + self._write_a_gs_lst(gradient) + + if gradient["type"] == "linear": + # Write the a:lin element. + self._write_a_lin(gradient["angle"]) + else: + # Write the a:path element. + self._write_a_path(gradient["type"]) + + # Write the a:tileRect element. + self._write_a_tile_rect(gradient["type"]) + + self._xml_end_tag("a:gradFill") + + def _write_a_gs_lst(self, gradient): + # Write the element. + positions = gradient["positions"] + colors = gradient["colors"] + + self._xml_start_tag("a:gsLst") + + for i in range(len(colors)): + pos = int(positions[i] * 1000) + attributes = [("pos", pos)] + self._xml_start_tag("a:gs", attributes) + + # Write the a:srgbClr element. + color = get_rgb_color(colors[i]) + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:gs") + + self._xml_end_tag("a:gsLst") + + def _write_a_lin(self, angle): + # Write the element. + + angle = int(60000 * angle) + + attributes = [ + ("ang", angle), + ("scaled", "0"), + ] + + self._xml_empty_tag("a:lin", attributes) + + def _write_a_path(self, gradient_type): + # Write the element. + + attributes = [("path", gradient_type)] + + self._xml_start_tag("a:path", attributes) + + # Write the a:fillToRect element. + self._write_a_fill_to_rect(gradient_type) + + self._xml_end_tag("a:path") + + def _write_a_fill_to_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [ + ("l", "50000"), + ("t", "50000"), + ("r", "50000"), + ("b", "50000"), + ] + else: + attributes = [ + ("l", "100000"), + ("t", "100000"), + ] + + self._xml_empty_tag("a:fillToRect", attributes) + + def _write_a_tile_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [] + else: + attributes = [ + ("r", "-100000"), + ("b", "-100000"), + ] + + self._xml_empty_tag("a:tileRect", attributes) + + def _write_a_srgb_clr(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("a:srgbClr", attributes) + + def _write_a_latin(self, attributes): + # Write the element. + self._xml_empty_tag("a:latin", attributes) + + def _write_a_cs(self, attributes): + # Write the element. + self._xml_empty_tag("a:cs", attributes) diff --git a/billinglayer/python/xlsxwriter/exceptions.py b/billinglayer/python/xlsxwriter/exceptions.py new file mode 100644 index 0000000..ccb7d73 --- /dev/null +++ b/billinglayer/python/xlsxwriter/exceptions.py @@ -0,0 +1,55 @@ +############################################################################### +# +# Exceptions - A class for XlsxWriter exceptions. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + + +class XlsxWriterException(Exception): + """Base exception for XlsxWriter.""" + + +class XlsxInputError(XlsxWriterException): + """Base exception for all input data related errors.""" + + +class XlsxFileError(XlsxWriterException): + """Base exception for all file related errors.""" + + +class EmptyChartSeries(XlsxInputError): + """Chart must contain at least one data series.""" + + +class DuplicateTableName(XlsxInputError): + """Worksheet table name already exists.""" + + +class InvalidWorksheetName(XlsxInputError): + """Worksheet name is too long or contains restricted characters.""" + + +class DuplicateWorksheetName(XlsxInputError): + """Worksheet name already exists.""" + + +class OverlappingRange(XlsxInputError): + """Worksheet merge range or table overlaps previous range.""" + + +class UndefinedImageSize(XlsxFileError): + """No size data found in image file.""" + + +class UnsupportedImageFormat(XlsxFileError): + """Unsupported image file format.""" + + +class FileCreateError(XlsxFileError): + """IO error when creating xlsx file.""" + + +class FileSizeError(XlsxFileError): + """Filesize would require ZIP64 extensions. Use workbook.use_zip64().""" diff --git a/billinglayer/python/xlsxwriter/format.py b/billinglayer/python/xlsxwriter/format.py new file mode 100644 index 0000000..2769ac2 --- /dev/null +++ b/billinglayer/python/xlsxwriter/format.py @@ -0,0 +1,1030 @@ +############################################################################### +# +# Format - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter +from warnings import warn + + +class Format(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Format file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, properties=None, xf_indices=None, dxf_indices=None): + """ + Constructor. + + """ + if properties is None: + properties = {} + + super(Format, self).__init__() + + self.xf_format_indices = xf_indices + self.dxf_format_indices = dxf_indices + self.xf_index = None + self.dxf_index = None + + self.num_format = "General" + self.num_format_index = 0 + self.font_index = 0 + self.has_font = 0 + self.has_dxf_font = 0 + + self.bold = 0 + self.underline = 0 + self.italic = 0 + self.font_name = "Calibri" + self.font_size = 11 + self.font_color = 0x0 + self.font_strikeout = 0 + self.font_outline = 0 + self.font_shadow = 0 + self.font_script = 0 + self.font_family = 2 + self.font_charset = 0 + self.font_scheme = "minor" + self.font_condense = 0 + self.font_extend = 0 + self.theme = 0 + self.hyperlink = False + self.xf_id = 0 + + self.hidden = 0 + self.locked = 1 + + self.text_h_align = 0 + self.text_wrap = 0 + self.text_v_align = 0 + self.text_justlast = 0 + self.rotation = 0 + + self.fg_color = 0 + self.bg_color = 0 + self.pattern = 0 + self.has_fill = 0 + self.has_dxf_fill = 0 + self.fill_index = 0 + self.fill_count = 0 + + self.border_index = 0 + self.has_border = 0 + self.has_dxf_border = 0 + self.border_count = 0 + + self.bottom = 0 + self.bottom_color = 0 + self.diag_border = 0 + self.diag_color = 0 + self.diag_type = 0 + self.left = 0 + self.left_color = 0 + self.right = 0 + self.right_color = 0 + self.top = 0 + self.top_color = 0 + + self.indent = 0 + self.shrink = 0 + self.merge_range = 0 + self.reading_order = 0 + self.just_distrib = 0 + self.color_indexed = 0 + self.font_only = 0 + + self.quote_prefix = False + + # Convert properties in the constructor to method calls. + for key, value in properties.items(): + getattr(self, "set_" + key)(value) + + self._format_key = None + + ########################################################################### + # + # Format properties. + # + ########################################################################### + + def set_font_name(self, font_name): + """ + Set the Format font_name property such as 'Time New Roman'. The + default Excel font is 'Calibri'. + + Args: + font_name: String with the font name. No default. + + Returns: + Nothing. + + """ + self.font_name = font_name + + def set_font_size(self, font_size=11): + """ + Set the Format font_size property. The default Excel font size is 11. + + Args: + font_size: Int with font size. No default. + + Returns: + Nothing. + + """ + self.font_size = font_size + + def set_font_color(self, font_color): + """ + Set the Format font_color property. The Excel default is black. + + Args: + font_color: String with the font color. No default. + + Returns: + Nothing. + + """ + self.font_color = self._get_color(font_color) + + def set_bold(self, bold=True): + """ + Set the Format bold property. + + Args: + bold: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.bold = bold + + def set_italic(self, italic=True): + """ + Set the Format italic property. + + Args: + italic: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.italic = italic + + def set_underline(self, underline=1): + """ + Set the Format underline property. + + Args: + underline: Default is 1, single underline. + + Returns: + Nothing. + + """ + self.underline = underline + + def set_font_strikeout(self, font_strikeout=True): + """ + Set the Format font_strikeout property. + + Args: + font_strikeout: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.font_strikeout = font_strikeout + + def set_font_script(self, font_script=1): + """ + Set the Format font_script property. + + Args: + font_script: Default is 1, superscript. + + Returns: + Nothing. + + """ + self.font_script = font_script + + def set_font_outline(self, font_outline=True): + """ + Set the Format font_outline property. + + Args: + font_outline: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.font_outline = font_outline + + def set_font_shadow(self, font_shadow=True): + """ + Set the Format font_shadow property. + + Args: + font_shadow: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.font_shadow = font_shadow + + def set_num_format(self, num_format): + """ + Set the Format num_format property such as '#,##0'. + + Args: + num_format: String representing the number format. No default. + + Returns: + Nothing. + + """ + self.num_format = num_format + + def set_locked(self, locked=True): + """ + Set the Format locked property. + + Args: + locked: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.locked = locked + + def set_hidden(self, hidden=True): + """ + Set the Format hidden property. + + Args: + hidden: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.hidden = hidden + + def set_align(self, alignment): + """ + Set the Format cell alignment. + + Args: + alignment: String representing alignment. No default. + + Returns: + Nothing. + """ + alignment = alignment.lower() + + # Set horizontal alignment properties. + if alignment == "left": + self.set_text_h_align(1) + if alignment == "centre": + self.set_text_h_align(2) + if alignment == "center": + self.set_text_h_align(2) + if alignment == "right": + self.set_text_h_align(3) + if alignment == "fill": + self.set_text_h_align(4) + if alignment == "justify": + self.set_text_h_align(5) + if alignment == "center_across": + self.set_text_h_align(6) + if alignment == "centre_across": + self.set_text_h_align(6) + if alignment == "distributed": + self.set_text_h_align(7) + if alignment == "justify_distributed": + self.set_text_h_align(7) + + if alignment == "justify_distributed": + self.just_distrib = 1 + + # Set vertical alignment properties. + if alignment == "top": + self.set_text_v_align(1) + if alignment == "vcentre": + self.set_text_v_align(2) + if alignment == "vcenter": + self.set_text_v_align(2) + if alignment == "bottom": + self.set_text_v_align(3) + if alignment == "vjustify": + self.set_text_v_align(4) + if alignment == "vdistributed": + self.set_text_v_align(5) + + def set_center_across(self, align_type=None): + """ + Set the Format center_across property. + + Returns: + Nothing. + + """ + self.set_text_h_align(6) + + def set_text_wrap(self, text_wrap=True): + """ + Set the Format text_wrap property. + + Args: + text_wrap: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.text_wrap = text_wrap + + def set_rotation(self, rotation): + """ + Set the Format rotation property. + + Args: + rotation: Rotation angle. No default. + + Returns: + Nothing. + + """ + rotation = int(rotation) + + # Map user angle to Excel angle. + if rotation == 270: + rotation = 255 + elif -90 <= rotation <= 90: + if rotation < 0: + rotation = -rotation + 90 + else: + warn("Rotation rotation outside range: -90 <= angle <= 90") + return + + self.rotation = rotation + + def set_indent(self, indent=1): + """ + Set the Format indent property. + + Args: + indent: Default is 1, first indentation level. + + Returns: + Nothing. + + """ + self.indent = indent + + def set_shrink(self, shrink=True): + """ + Set the Format shrink property. + + Args: + shrink: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.shrink = shrink + + def set_text_justlast(self, text_justlast=True): + """ + Set the Format text_justlast property. + + Args: + text_justlast: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.text_justlast = text_justlast + + def set_pattern(self, pattern=1): + """ + Set the Format pattern property. + + Args: + pattern: Default is 1, solid fill. + + Returns: + Nothing. + + """ + self.pattern = pattern + + def set_bg_color(self, bg_color): + """ + Set the Format bg_color property. + + Args: + bg_color: Background color. No default. + + Returns: + Nothing. + + """ + self.bg_color = self._get_color(bg_color) + + def set_fg_color(self, fg_color): + """ + Set the Format fg_color property. + + Args: + fg_color: Foreground color. No default. + + Returns: + Nothing. + + """ + self.fg_color = self._get_color(fg_color) + + # set_border(style) Set cells borders to the same style + def set_border(self, style=1): + """ + Set the Format bottom property. + + Args: + bottom: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.set_bottom(style) + self.set_top(style) + self.set_left(style) + self.set_right(style) + + # set_border_color(color) Set cells border to the same color + def set_border_color(self, color): + """ + Set the Format bottom property. + + Args: + color: Color string. No default. + + Returns: + Nothing. + + """ + self.set_bottom_color(color) + self.set_top_color(color) + self.set_left_color(color) + self.set_right_color(color) + + def set_bottom(self, bottom=1): + """ + Set the Format bottom property. + + Args: + bottom: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.bottom = bottom + + def set_bottom_color(self, bottom_color): + """ + Set the Format bottom_color property. + + Args: + bottom_color: Color string. No default. + + Returns: + Nothing. + + """ + self.bottom_color = self._get_color(bottom_color) + + def set_diag_type(self, diag_type=1): + """ + Set the Format diag_type property. + + Args: + diag_type: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.diag_type = diag_type + + def set_left(self, left=1): + """ + Set the Format left property. + + Args: + left: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.left = left + + def set_left_color(self, left_color): + """ + Set the Format left_color property. + + Args: + left_color: Color string. No default. + + Returns: + Nothing. + + """ + self.left_color = self._get_color(left_color) + + def set_right(self, right=1): + """ + Set the Format right property. + + Args: + right: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.right = right + + def set_right_color(self, right_color): + """ + Set the Format right_color property. + + Args: + right_color: Color string. No default. + + Returns: + Nothing. + + """ + self.right_color = self._get_color(right_color) + + def set_top(self, top=1): + """ + Set the Format top property. + + Args: + top: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.top = top + + def set_top_color(self, top_color): + """ + Set the Format top_color property. + + Args: + top_color: Color string. No default. + + Returns: + Nothing. + + """ + self.top_color = self._get_color(top_color) + + def set_diag_color(self, diag_color): + """ + Set the Format diag_color property. + + Args: + diag_color: Color string. No default. + + Returns: + Nothing. + + """ + self.diag_color = self._get_color(diag_color) + + def set_diag_border(self, diag_border=1): + """ + Set the Format diag_border property. + + Args: + diag_border: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.diag_border = diag_border + + def set_quote_prefix(self, quote_prefix=True): + """ + Set the Format quote prefix property. + + Args: + quote_prefix: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.quote_prefix = quote_prefix + + ########################################################################### + # + # Internal Format properties. These aren't documented since they are + # either only used internally or else are unlikely to be set by the user. + # + ########################################################################### + + def set_has_font(self, has_font=True): + # Set the has_font property. + self.has_font = has_font + + def set_has_fill(self, has_fill=True): + # Set the has_fill property. + self.has_fill = has_fill + + def set_font_index(self, font_index): + # Set the font_index property. + self.font_index = font_index + + def set_xf_index(self, xf_index): + # Set the xf_index property. + self.xf_index = xf_index + + def set_dxf_index(self, dxf_index): + # Set the xf_index property. + self.dxf_index = dxf_index + + def set_num_format_index(self, num_format_index): + # Set the num_format_index property. + self.num_format_index = num_format_index + + def set_text_h_align(self, text_h_align): + # Set the text_h_align property. + self.text_h_align = text_h_align + + def set_text_v_align(self, text_v_align): + # Set the text_v_align property. + self.text_v_align = text_v_align + + def set_reading_order(self, direction=0): + # Set the reading_order property. + self.reading_order = direction + + def set_valign(self, align): + # Set vertical cell alignment. This is required by the constructor + # properties dict to differentiate between the vertical and horizontal + # properties. + self.set_align(align) + + def set_font_family(self, font_family): + # Set the Format font_family property. + self.font_family = font_family + + def set_font_charset(self, font_charset): + # Set the Format font_charset property. + self.font_charset = font_charset + + def set_font_scheme(self, font_scheme): + # Set the Format font_scheme property. + self.font_scheme = font_scheme + + def set_font_condense(self, font_condense): + # Set the Format font_condense property. + self.font_condense = font_condense + + def set_font_extend(self, font_extend): + # Set the Format font_extend property. + self.font_extend = font_extend + + def set_theme(self, theme): + # Set the Format theme property. + self.theme = theme + + def set_hyperlink(self, hyperlink=True): + # Set the properties for the hyperlink style. This isn't + # currently public. To be fixed when styles are supported. + self.xf_id = 1 + self.set_underline(1) + self.set_theme(10) + self.hyperlink = hyperlink + + def set_color_indexed(self, color_index): + # Used in the cell comment format. + self.color_indexed = color_index + + def set_font_only(self, font_only=True): + # Used in the cell comment format. + self.font_only = font_only + + # Compatibility methods. + def set_font(self, font_name): + # For compatibility with Excel::Writer::XLSX. + self.font_name = font_name + + def set_size(self, font_size): + # For compatibility with Excel::Writer::XLSX. + self.font_size = font_size + + def set_color(self, font_color): + # For compatibility with Excel::Writer::XLSX. + self.font_color = self._get_color(font_color) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _get_align_properties(self): + # Return properties for an Style xf sub-element. + changed = 0 + align = [] + + # Check if any alignment options in the format have been changed. + if ( + self.text_h_align + or self.text_v_align + or self.indent + or self.rotation + or self.text_wrap + or self.shrink + or self.reading_order + ): + changed = 1 + else: + return changed, align + + # Indent is only allowed for horizontal left, right and distributed. + # If it is defined for any other alignment or no alignment has + # been set then default to left alignment. + if ( + self.indent + and self.text_h_align != 1 + and self.text_h_align != 3 + and self.text_h_align != 7 + ): + self.text_h_align = 1 + + # Check for properties that are mutually exclusive. + if self.text_wrap: + self.shrink = 0 + if self.text_h_align == 4: + self.shrink = 0 + if self.text_h_align == 5: + self.shrink = 0 + if self.text_h_align == 7: + self.shrink = 0 + if self.text_h_align != 7: + self.just_distrib = 0 + if self.indent: + self.just_distrib = 0 + + continuous = "centerContinuous" + + if self.text_h_align == 1: + align.append(("horizontal", "left")) + if self.text_h_align == 2: + align.append(("horizontal", "center")) + if self.text_h_align == 3: + align.append(("horizontal", "right")) + if self.text_h_align == 4: + align.append(("horizontal", "fill")) + if self.text_h_align == 5: + align.append(("horizontal", "justify")) + if self.text_h_align == 6: + align.append(("horizontal", continuous)) + if self.text_h_align == 7: + align.append(("horizontal", "distributed")) + + if self.just_distrib: + align.append(("justifyLastLine", 1)) + + # Property 'vertical' => 'bottom' is a default. It sets applyAlignment + # without an alignment sub-element. + if self.text_v_align == 1: + align.append(("vertical", "top")) + if self.text_v_align == 2: + align.append(("vertical", "center")) + if self.text_v_align == 4: + align.append(("vertical", "justify")) + if self.text_v_align == 5: + align.append(("vertical", "distributed")) + + if self.indent: + align.append(("indent", self.indent)) + if self.rotation: + align.append(("textRotation", self.rotation)) + + if self.text_wrap: + align.append(("wrapText", 1)) + if self.shrink: + align.append(("shrinkToFit", 1)) + + if self.reading_order == 1: + align.append(("readingOrder", 1)) + if self.reading_order == 2: + align.append(("readingOrder", 2)) + + return changed, align + + def _get_protection_properties(self): + # Return properties for an Excel XML element. + attribs = [] + + if not self.locked: + attribs.append(("locked", 0)) + if self.hidden: + attribs.append(("hidden", 1)) + + return attribs + + def _get_format_key(self): + # Returns a unique hash key for a format. Used by Workbook. + if self._format_key is None: + self._format_key = ":".join( + str(x) + for x in ( + self._get_font_key(), + self._get_border_key(), + self._get_fill_key(), + self._get_alignment_key(), + self.num_format, + self.locked, + self.quote_prefix, + self.hidden, + ) + ) + + return self._format_key + + def _get_font_key(self): + # Returns a unique hash key for a font. Used by Workbook. + key = ":".join( + str(x) + for x in ( + self.bold, + self.font_color, + self.font_charset, + self.font_family, + self.font_outline, + self.font_script, + self.font_shadow, + self.font_strikeout, + self.font_name, + self.italic, + self.font_size, + self.underline, + self.theme, + ) + ) + + return key + + def _get_border_key(self): + # Returns a unique hash key for a border style. Used by Workbook. + key = ":".join( + str(x) + for x in ( + self.bottom, + self.bottom_color, + self.diag_border, + self.diag_color, + self.diag_type, + self.left, + self.left_color, + self.right, + self.right_color, + self.top, + self.top_color, + ) + ) + + return key + + def _get_fill_key(self): + # Returns a unique hash key for a fill style. Used by Workbook. + key = ":".join(str(x) for x in (self.pattern, self.bg_color, self.fg_color)) + + return key + + def _get_alignment_key(self): + # Returns a unique hash key for alignment formats. + + key = ":".join( + str(x) + for x in ( + self.text_h_align, + self.text_v_align, + self.indent, + self.rotation, + self.text_wrap, + self.shrink, + self.reading_order, + ) + ) + + return key + + def _get_xf_index(self): + # Returns the XF index number used by Excel to identify a format. + if self.xf_index is not None: + # Format already has an index number so return it. + return self.xf_index + else: + # Format doesn't have an index number so assign one. + key = self._get_format_key() + + if key in self.xf_format_indices: + # Format matches existing format with an index. + return self.xf_format_indices[key] + else: + # New format requiring an index. Note. +1 since Excel + # has an implicit "General" format at index 0. + index = 1 + len(self.xf_format_indices) + self.xf_format_indices[key] = index + self.xf_index = index + return index + + def _get_dxf_index(self): + # Returns the DXF index number used by Excel to identify a format. + if self.dxf_index is not None: + # Format already has an index number so return it. + return self.dxf_index + else: + # Format doesn't have an index number so assign one. + key = self._get_format_key() + + if key in self.dxf_format_indices: + # Format matches existing format with an index. + return self.dxf_format_indices[key] + else: + # New format requiring an index. + index = len(self.dxf_format_indices) + self.dxf_format_indices[key] = index + self.dxf_index = index + return index + + def _get_color(self, color): + # Used in conjunction with the set_xxx_color methods to convert a + # color name into an RGB formatted string. These colors are for + # backward compatibility with older versions of Excel. + named_colors = { + "black": "#000000", + "blue": "#0000FF", + "brown": "#800000", + "cyan": "#00FFFF", + "gray": "#808080", + "green": "#008000", + "lime": "#00FF00", + "magenta": "#FF00FF", + "navy": "#000080", + "orange": "#FF6600", + "pink": "#FF00FF", + "purple": "#800080", + "red": "#FF0000", + "silver": "#C0C0C0", + "white": "#FFFFFF", + "yellow": "#FFFF00", + "automatic": "Automatic", + } + + if color in named_colors: + color = named_colors[color] + + return color + + ########################################################################### + # + # XML methods. + # + ########################################################################### diff --git a/billinglayer/python/xlsxwriter/metadata.py b/billinglayer/python/xlsxwriter/metadata.py new file mode 100644 index 0000000..5495a96 --- /dev/null +++ b/billinglayer/python/xlsxwriter/metadata.py @@ -0,0 +1,170 @@ +############################################################################### +# +# Metadata - A class for writing the Excel XLSX Metadata file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter + + +class Metadata(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Metadata file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Metadata, self).__init__() + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the metadata element. + self._write_metadata() + + # Write the metadataTypes element. + self._write_metadata_types() + + # Write the futureMetadata element. + self._write_future_metadata() + + # Write the cellMetadata element. + self._write_cell_metadata() + + self._xml_end_tag("metadata") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_metadata(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + schema = "http://schemas.microsoft.com/office" + xmlns_xda = schema + "/spreadsheetml/2017/dynamicarray" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:xda", xmlns_xda), + ] + + self._xml_start_tag("metadata", attributes) + + def _write_metadata_types(self): + # Write the element. + attributes = [("count", 1)] + + self._xml_start_tag("metadataTypes", attributes) + + # Write the metadataType element. + self._write_metadata_type() + + self._xml_end_tag("metadataTypes") + + def _write_metadata_type(self): + # Write the element. + attributes = [ + ("name", "XLDAPR"), + ("minSupportedVersion", 120000), + ("copy", 1), + ("pasteAll", 1), + ("pasteValues", 1), + ("merge", 1), + ("splitFirst", 1), + ("rowColShift", 1), + ("clearFormats", 1), + ("clearComments", 1), + ("assign", 1), + ("coerce", 1), + ("cellMeta", 1), + ] + + self._xml_empty_tag("metadataType", attributes) + + def _write_future_metadata(self): + # Write the element. + attributes = [ + ("name", "XLDAPR"), + ("count", 1), + ] + + self._xml_start_tag("futureMetadata", attributes) + self._xml_start_tag("bk") + self._xml_start_tag("extLst") + + # Write the ext element. + self._write_ext() + + self._xml_end_tag("extLst") + self._xml_end_tag("bk") + self._xml_end_tag("futureMetadata") + + def _write_ext(self): + # Write the element. + attributes = [("uri", "{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}")] + + self._xml_start_tag("ext", attributes) + + # Write the xda:dynamicArrayProperties element. + self._write_xda_dynamic_array_properties() + + self._xml_end_tag("ext") + + def _write_xda_dynamic_array_properties(self): + # Write the element. + attributes = [ + ("fDynamic", 1), + ("fCollapsed", 0), + ] + + self._xml_empty_tag("xda:dynamicArrayProperties", attributes) + + def _write_cell_metadata(self): + # Write the element. + attributes = [("count", 1)] + + self._xml_start_tag("cellMetadata", attributes) + self._xml_start_tag("bk") + + # Write the rc element. + self._write_rc() + + self._xml_end_tag("bk") + self._xml_end_tag("cellMetadata") + + def _write_rc(self): + # Write the element. + attributes = [ + ("t", 1), + ("v", 0), + ] + + self._xml_empty_tag("rc", attributes) diff --git a/billinglayer/python/xlsxwriter/packager.py b/billinglayer/python/xlsxwriter/packager.py new file mode 100644 index 0000000..bc239c3 --- /dev/null +++ b/billinglayer/python/xlsxwriter/packager.py @@ -0,0 +1,711 @@ +############################################################################### +# +# Packager - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import os +import stat +import tempfile +from shutil import copy + +from io import StringIO +from io import BytesIO + +# Package imports. +from .app import App +from .contenttypes import ContentTypes +from .core import Core +from .custom import Custom +from .metadata import Metadata +from .relationships import Relationships +from .sharedstrings import SharedStrings +from .styles import Styles +from .theme import Theme +from .vml import Vml +from .table import Table +from .comments import Comments +from .exceptions import EmptyChartSeries + + +class Packager(object): + """ + A class for writing the Excel XLSX Packager file. + + This module is used in conjunction with XlsxWriter to create an + Excel XLSX container file. + + From Wikipedia: The Open Packaging Conventions (OPC) is a + container-file technology initially created by Microsoft to store + a combination of XML and non-XML files that together form a single + entity such as an Open XML Paper Specification (OpenXPS) + document. http://en.wikipedia.org/wiki/Open_Packaging_Conventions. + + At its simplest an Excel XLSX file contains the following elements:: + + ____ [Content_Types].xml + | + |____ docProps + | |____ app.xml + | |____ core.xml + | + |____ xl + | |____ workbook.xml + | |____ worksheets + | | |____ sheet1.xml + | | + | |____ styles.xml + | | + | |____ theme + | | |____ theme1.xml + | | + | |_____rels + | |____ workbook.xml.rels + | + |_____rels + |____ .rels + + The Packager class coordinates the classes that represent the + elements of the package and writes them into the XLSX file. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Packager, self).__init__() + + self.tmpdir = "" + self.in_memory = False + self.workbook = None + self.worksheet_count = 0 + self.chartsheet_count = 0 + self.chart_count = 0 + self.drawing_count = 0 + self.table_count = 0 + self.num_vml_files = 0 + self.num_comment_files = 0 + self.named_ranges = [] + self.filenames = [] + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _set_tmpdir(self, tmpdir): + # Set an optional user defined temp directory. + self.tmpdir = tmpdir + + def _set_in_memory(self, in_memory): + # Set the optional 'in_memory' mode. + self.in_memory = in_memory + + def _add_workbook(self, workbook): + # Add the Excel::Writer::XLSX::Workbook object to the package. + self.workbook = workbook + self.chart_count = len(workbook.charts) + self.drawing_count = len(workbook.drawings) + self.num_vml_files = workbook.num_vml_files + self.num_comment_files = workbook.num_comment_files + self.named_ranges = workbook.named_ranges + + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + self.chartsheet_count += 1 + else: + self.worksheet_count += 1 + + def _create_package(self): + # Write the xml files that make up the XLSX OPC package. + self._write_content_types_file() + self._write_root_rels_file() + self._write_workbook_rels_file() + self._write_worksheet_files() + self._write_chartsheet_files() + self._write_workbook_file() + self._write_chart_files() + self._write_drawing_files() + self._write_vml_files() + self._write_comment_files() + self._write_table_files() + self._write_shared_strings_file() + self._write_styles_file() + self._write_custom_file() + self._write_theme_file() + self._write_worksheet_rels_files() + self._write_chartsheet_rels_files() + self._write_drawing_rels_files() + self._add_image_files() + self._add_vba_project() + self._write_core_file() + self._write_app_file() + self._write_metadata_file() + + return self.filenames + + def _filename(self, xml_filename): + # Create a temp filename to write the XML data to and store the Excel + # filename to use as the name in the Zip container. + if self.in_memory: + os_filename = StringIO() + else: + (fd, os_filename) = tempfile.mkstemp(dir=self.tmpdir) + os.close(fd) + + self.filenames.append((os_filename, xml_filename, False)) + + return os_filename + + def _write_workbook_file(self): + # Write the workbook.xml file. + workbook = self.workbook + + workbook._set_xml_writer(self._filename("xl/workbook.xml")) + workbook._assemble_xml_file() + + def _write_worksheet_files(self): + # Write the worksheet files. + index = 1 + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + continue + + if worksheet.constant_memory: + worksheet._opt_reopen() + worksheet._write_single_row() + + worksheet._set_xml_writer( + self._filename("xl/worksheets/sheet" + str(index) + ".xml") + ) + worksheet._assemble_xml_file() + index += 1 + + def _write_chartsheet_files(self): + # Write the chartsheet files. + index = 1 + for worksheet in self.workbook.worksheets(): + if not worksheet.is_chartsheet: + continue + + worksheet._set_xml_writer( + self._filename("xl/chartsheets/sheet" + str(index) + ".xml") + ) + worksheet._assemble_xml_file() + index += 1 + + def _write_chart_files(self): + # Write the chart files. + if not self.workbook.charts: + return + + index = 1 + for chart in self.workbook.charts: + # Check that the chart has at least one data series. + if not chart.series: + raise EmptyChartSeries( + "Chart%d must contain at least one " + "data series. See chart.add_series()." % index + ) + + chart._set_xml_writer( + self._filename("xl/charts/chart" + str(index) + ".xml") + ) + chart._assemble_xml_file() + index += 1 + + def _write_drawing_files(self): + # Write the drawing files. + if not self.drawing_count: + return + + index = 1 + for drawing in self.workbook.drawings: + drawing._set_xml_writer( + self._filename("xl/drawings/drawing" + str(index) + ".xml") + ) + drawing._assemble_xml_file() + index += 1 + + def _write_vml_files(self): + # Write the comment VML files. + index = 1 + for worksheet in self.workbook.worksheets(): + if not worksheet.has_vml and not worksheet.has_header_vml: + continue + if worksheet.has_vml: + vml = Vml() + vml._set_xml_writer( + self._filename("xl/drawings/vmlDrawing" + str(index) + ".vml") + ) + vml._assemble_xml_file( + worksheet.vml_data_id, + worksheet.vml_shape_id, + worksheet.comments_list, + worksheet.buttons_list, + ) + index += 1 + + if worksheet.has_header_vml: + vml = Vml() + + vml._set_xml_writer( + self._filename("xl/drawings/vmlDrawing" + str(index) + ".vml") + ) + vml._assemble_xml_file( + worksheet.vml_header_id, + worksheet.vml_header_id * 1024, + None, + None, + worksheet.header_images_list, + ) + + self._write_vml_drawing_rels_file(worksheet, index) + index += 1 + + def _write_comment_files(self): + # Write the comment files. + index = 1 + for worksheet in self.workbook.worksheets(): + if not worksheet.has_comments: + continue + + comment = Comments() + comment._set_xml_writer(self._filename("xl/comments" + str(index) + ".xml")) + comment._assemble_xml_file(worksheet.comments_list) + index += 1 + + def _write_shared_strings_file(self): + # Write the sharedStrings.xml file. + sst = SharedStrings() + sst.string_table = self.workbook.str_table + + if not self.workbook.str_table.count: + return + + sst._set_xml_writer(self._filename("xl/sharedStrings.xml")) + sst._assemble_xml_file() + + def _write_app_file(self): + # Write the app.xml file. + properties = self.workbook.doc_properties + app = App() + + # Add the Worksheet heading pairs. + app._add_heading_pair(["Worksheets", self.worksheet_count]) + + # Add the Chartsheet heading pairs. + app._add_heading_pair(["Charts", self.chartsheet_count]) + + # Add the Worksheet parts. + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + continue + app._add_part_name(worksheet.name) + + # Add the Chartsheet parts. + for worksheet in self.workbook.worksheets(): + if not worksheet.is_chartsheet: + continue + app._add_part_name(worksheet.name) + + # Add the Named Range heading pairs. + if self.named_ranges: + app._add_heading_pair(["Named Ranges", len(self.named_ranges)]) + + # Add the Named Ranges parts. + for named_range in self.named_ranges: + app._add_part_name(named_range) + + app._set_properties(properties) + app.doc_security = self.workbook.read_only + + app._set_xml_writer(self._filename("docProps/app.xml")) + app._assemble_xml_file() + + def _write_core_file(self): + # Write the core.xml file. + properties = self.workbook.doc_properties + core = Core() + + core._set_properties(properties) + core._set_xml_writer(self._filename("docProps/core.xml")) + core._assemble_xml_file() + + def _write_metadata_file(self): + # Write the metadata.xml file. + if not self.workbook.has_metadata: + return + + metadata = Metadata() + metadata._set_xml_writer(self._filename("xl/metadata.xml")) + metadata._assemble_xml_file() + + def _write_custom_file(self): + # Write the custom.xml file. + properties = self.workbook.custom_properties + custom = Custom() + + if not len(properties): + return + + custom._set_properties(properties) + custom._set_xml_writer(self._filename("docProps/custom.xml")) + custom._assemble_xml_file() + + def _write_content_types_file(self): + # Write the ContentTypes.xml file. + content = ContentTypes() + content._add_image_types(self.workbook.image_types) + + self._get_table_count() + + worksheet_index = 1 + chartsheet_index = 1 + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + content._add_chartsheet_name("sheet" + str(chartsheet_index)) + chartsheet_index += 1 + else: + content._add_worksheet_name("sheet" + str(worksheet_index)) + worksheet_index += 1 + + for i in range(1, self.chart_count + 1): + content._add_chart_name("chart" + str(i)) + + for i in range(1, self.drawing_count + 1): + content._add_drawing_name("drawing" + str(i)) + + if self.num_vml_files: + content._add_vml_name() + + for i in range(1, self.table_count + 1): + content._add_table_name("table" + str(i)) + + for i in range(1, self.num_comment_files + 1): + content._add_comment_name("comments" + str(i)) + + # Add the sharedString rel if there is string data in the workbook. + if self.workbook.str_table.count: + content._add_shared_strings() + + # Add vbaProject if present. + if self.workbook.vba_project: + content._add_vba_project() + + # Add the custom properties if present. + if self.workbook.custom_properties: + content._add_custom_properties() + + # Add the metadata file if present. + if self.workbook.has_metadata: + content._add_metadata() + + content._set_xml_writer(self._filename("[Content_Types].xml")) + content._assemble_xml_file() + + def _write_styles_file(self): + # Write the style xml file. + xf_formats = self.workbook.xf_formats + palette = self.workbook.palette + font_count = self.workbook.font_count + num_formats = self.workbook.num_formats + border_count = self.workbook.border_count + fill_count = self.workbook.fill_count + custom_colors = self.workbook.custom_colors + dxf_formats = self.workbook.dxf_formats + has_comments = self.workbook.has_comments + + styles = Styles() + styles._set_style_properties( + [ + xf_formats, + palette, + font_count, + num_formats, + border_count, + fill_count, + custom_colors, + dxf_formats, + has_comments, + ] + ) + + styles._set_xml_writer(self._filename("xl/styles.xml")) + styles._assemble_xml_file() + + def _write_theme_file(self): + # Write the theme xml file. + theme = Theme() + + theme._set_xml_writer(self._filename("xl/theme/theme1.xml")) + theme._assemble_xml_file() + + def _write_table_files(self): + # Write the table files. + index = 1 + for worksheet in self.workbook.worksheets(): + table_props = worksheet.tables + + if not table_props: + continue + + for table_props in table_props: + table = Table() + table._set_xml_writer( + self._filename("xl/tables/table" + str(index) + ".xml") + ) + table._set_properties(table_props) + table._assemble_xml_file() + index += 1 + + def _get_table_count(self): + # Count the table files. Required for the [Content_Types] file. + for worksheet in self.workbook.worksheets(): + for _ in worksheet.tables: + self.table_count += 1 + + def _write_root_rels_file(self): + # Write the _rels/.rels xml file. + rels = Relationships() + + rels._add_document_relationship("/officeDocument", "xl/workbook.xml") + + rels._add_package_relationship("/metadata/core-properties", "docProps/core.xml") + + rels._add_document_relationship("/extended-properties", "docProps/app.xml") + + if self.workbook.custom_properties: + rels._add_document_relationship("/custom-properties", "docProps/custom.xml") + + rels._set_xml_writer(self._filename("_rels/.rels")) + + rels._assemble_xml_file() + + def _write_workbook_rels_file(self): + # Write the _rels/.rels xml file. + rels = Relationships() + + worksheet_index = 1 + chartsheet_index = 1 + + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + rels._add_document_relationship( + "/chartsheet", "chartsheets/sheet" + str(chartsheet_index) + ".xml" + ) + chartsheet_index += 1 + else: + rels._add_document_relationship( + "/worksheet", "worksheets/sheet" + str(worksheet_index) + ".xml" + ) + worksheet_index += 1 + + rels._add_document_relationship("/theme", "theme/theme1.xml") + rels._add_document_relationship("/styles", "styles.xml") + + # Add the sharedString rel if there is string data in the workbook. + if self.workbook.str_table.count: + rels._add_document_relationship("/sharedStrings", "sharedStrings.xml") + + # Add vbaProject if present. + if self.workbook.vba_project: + rels._add_ms_package_relationship("/vbaProject", "vbaProject.bin") + + # Add the metadata file if required. + if self.workbook.has_metadata: + rels._add_document_relationship("/sheetMetadata", "metadata.xml") + + rels._set_xml_writer(self._filename("xl/_rels/workbook.xml.rels")) + rels._assemble_xml_file() + + def _write_worksheet_rels_files(self): + # Write data such as hyperlinks or drawings. + index = 0 + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + continue + + index += 1 + + external_links = ( + worksheet.external_hyper_links + + worksheet.external_drawing_links + + worksheet.external_vml_links + + worksheet.external_background_links + + worksheet.external_table_links + + worksheet.external_comment_links + ) + + if not external_links: + continue + + # Create the worksheet .rels dirs. + rels = Relationships() + + for link_data in external_links: + rels._add_document_relationship(*link_data) + + # Create .rels file such as /xl/worksheets/_rels/sheet1.xml.rels. + rels._set_xml_writer( + self._filename("xl/worksheets/_rels/sheet" + str(index) + ".xml.rels") + ) + rels._assemble_xml_file() + + def _write_chartsheet_rels_files(self): + # Write the chartsheet .rels files for links to drawing files. + index = 0 + for worksheet in self.workbook.worksheets(): + if not worksheet.is_chartsheet: + continue + + index += 1 + + external_links = worksheet.external_drawing_links + + if not external_links: + continue + + # Create the chartsheet .rels xlsx_dir. + rels = Relationships() + + for link_data in external_links: + rels._add_document_relationship(*link_data) + + # Create .rels file such as /xl/chartsheets/_rels/sheet1.xml.rels. + rels._set_xml_writer( + self._filename("xl/chartsheets/_rels/sheet" + str(index) + ".xml.rels") + ) + rels._assemble_xml_file() + + def _write_drawing_rels_files(self): + # Write the drawing .rels files for worksheets with charts or drawings. + index = 0 + for worksheet in self.workbook.worksheets(): + if worksheet.drawing: + index += 1 + + if not worksheet.drawing_links: + continue + + # Create the drawing .rels xlsx_dir. + rels = Relationships() + + for drawing_data in worksheet.drawing_links: + rels._add_document_relationship(*drawing_data) + + # Create .rels file such as /xl/drawings/_rels/sheet1.xml.rels. + rels._set_xml_writer( + self._filename("xl/drawings/_rels/drawing" + str(index) + ".xml.rels") + ) + rels._assemble_xml_file() + + def _write_vml_drawing_rels_file(self, worksheet, index): + # Write the vmlDdrawing .rels files for worksheets with images in + # headers or footers. + + # Create the drawing .rels dir. + rels = Relationships() + + for drawing_data in worksheet.vml_drawing_links: + rels._add_document_relationship(*drawing_data) + + # Create .rels file such as /xl/drawings/_rels/vmlDrawing1.vml.rels. + rels._set_xml_writer( + self._filename("xl/drawings/_rels/vmlDrawing" + str(index) + ".vml.rels") + ) + rels._assemble_xml_file() + + def _add_image_files(self): + # Write the /xl/media/image?.xml files. + workbook = self.workbook + index = 1 + + for image in workbook.images: + filename = image[0] + ext = "." + image[1] + image_data = image[2] + + xml_image_name = "xl/media/image" + str(index) + ext + + if not self.in_memory: + # In file mode we just write or copy the image file. + os_filename = self._filename(xml_image_name) + + if image_data: + # The data is in a byte stream. Write it to the target. + os_file = open(os_filename, mode="wb") + os_file.write(image_data.getvalue()) + os_file.close() + else: + copy(filename, os_filename) + + # Allow copies of Windows read-only images to be deleted. + try: + os.chmod( + os_filename, os.stat(os_filename).st_mode | stat.S_IWRITE + ) + except OSError: + pass + else: + # For in-memory mode we read the image into a stream. + if image_data: + # The data is already in a byte stream. + os_filename = image_data + else: + image_file = open(filename, mode="rb") + image_data = image_file.read() + os_filename = BytesIO(image_data) + image_file.close() + + self.filenames.append((os_filename, xml_image_name, True)) + + index += 1 + + def _add_vba_project(self): + # Copy in a vbaProject.bin file. + vba_project = self.workbook.vba_project + vba_is_stream = self.workbook.vba_is_stream + + if not vba_project: + return + + xml_vba_name = "xl/vbaProject.bin" + + if not self.in_memory: + # In file mode we just write or copy the VBA file. + os_filename = self._filename(xml_vba_name) + + if vba_is_stream: + # The data is in a byte stream. Write it to the target. + os_file = open(os_filename, mode="wb") + os_file.write(vba_project.getvalue()) + os_file.close() + else: + copy(vba_project, os_filename) + + else: + # For in-memory mode we read the vba into a stream. + if vba_is_stream: + # The data is already in a byte stream. + os_filename = vba_project + else: + vba_file = open(vba_project, mode="rb") + vba_data = vba_file.read() + os_filename = BytesIO(vba_data) + vba_file.close() + + self.filenames.append((os_filename, xml_vba_name, True)) diff --git a/billinglayer/python/xlsxwriter/relationships.py b/billinglayer/python/xlsxwriter/relationships.py new file mode 100644 index 0000000..0db069e --- /dev/null +++ b/billinglayer/python/xlsxwriter/relationships.py @@ -0,0 +1,115 @@ +############################################################################### +# +# Relationships - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + +# Long namespace strings used in the class. +schema_root = "http://schemas.openxmlformats.org" +package_schema = schema_root + "/package/2006/relationships" +document_schema = schema_root + "/officeDocument/2006/relationships" + + +class Relationships(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Relationships file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Relationships, self).__init__() + + self.relationships = [] + self.id = 1 + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_relationships() + + # Close the file. + self._xml_close() + + def _add_document_relationship(self, rel_type, target, target_mode=None): + # Add container relationship to XLSX .rels xml files. + rel_type = document_schema + rel_type + + self.relationships.append((rel_type, target, target_mode)) + + def _add_package_relationship(self, rel_type, target): + # Add container relationship to XLSX .rels xml files. + rel_type = package_schema + rel_type + + self.relationships.append((rel_type, target, None)) + + def _add_ms_package_relationship(self, rel_type, target): + # Add container relationship to XLSX .rels xml files. Uses MS schema. + schema = "http://schemas.microsoft.com/office/2006/relationships" + rel_type = schema + rel_type + + self.relationships.append((rel_type, target, None)) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_relationships(self): + # Write the element. + attributes = [ + ( + "xmlns", + package_schema, + ) + ] + + self._xml_start_tag("Relationships", attributes) + + for relationship in self.relationships: + self._write_relationship(relationship) + + self._xml_end_tag("Relationships") + + def _write_relationship(self, relationship): + # Write the element. + rel_type, target, target_mode = relationship + + attributes = [ + ("Id", "rId" + str(self.id)), + ("Type", rel_type), + ("Target", target), + ] + + self.id += 1 + + if target_mode: + attributes.append(("TargetMode", target_mode)) + + self._xml_empty_tag("Relationship", attributes) diff --git a/billinglayer/python/xlsxwriter/shape.py b/billinglayer/python/xlsxwriter/shape.py new file mode 100644 index 0000000..fd265cd --- /dev/null +++ b/billinglayer/python/xlsxwriter/shape.py @@ -0,0 +1,414 @@ +############################################################################### +# +# Shape - A class for to represent Excel XLSX shape objects. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import copy +from warnings import warn + + +class Shape(object): + """ + A class for to represent Excel XLSX shape objects. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, shape_type, name, options): + """ + Constructor. + + """ + super(Shape, self).__init__() + self.name = name + self.shape_type = shape_type + self.connect = 0 + self.drawing = 0 + self.edit_as = "" + self.id = 0 + self.text = "" + self.textlink = "" + self.stencil = 1 + self.element = -1 + self.start = None + self.start_index = None + self.end = None + self.end_index = None + self.adjustments = [] + self.start_side = "" + self.end_side = "" + self.flip_h = 0 + self.flip_v = 0 + self.rotation = 0 + self.text_rotation = 0 + self.textbox = False + + self.align = None + self.fill = None + self.font = None + self.format = None + self.line = None + self.url_rel_index = None + self.tip = None + + self._set_options(options) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _set_options(self, options): + self.align = self._get_align_properties(options.get("align")) + self.fill = self._get_fill_properties(options.get("fill")) + self.font = self._get_font_properties(options.get("font")) + self.gradient = self._get_gradient_properties(options.get("gradient")) + self.line = self._get_line_properties(options.get("line")) + + self.text_rotation = options.get("text_rotation", 0) + + self.textlink = options.get("textlink", "") + if self.textlink.startswith("="): + self.textlink = self.textlink.lstrip("=") + + if options.get("border"): + self.line = self._get_line_properties(options["border"]) + + # Gradient fill overrides solid fill. + if self.gradient: + self.fill = None + + ########################################################################### + # + # Static methods for processing chart/shape style properties. + # + ########################################################################### + + @staticmethod + def _get_line_properties(line): + # Convert user line properties to the structure required internally. + + if not line: + return {"defined": False} + + # Copy the user defined properties since they will be modified. + line = copy.deepcopy(line) + + dash_types = { + "solid": "solid", + "round_dot": "sysDot", + "square_dot": "sysDash", + "dash": "dash", + "dash_dot": "dashDot", + "long_dash": "lgDash", + "long_dash_dot": "lgDashDot", + "long_dash_dot_dot": "lgDashDotDot", + "dot": "dot", + "system_dash_dot": "sysDashDot", + "system_dash_dot_dot": "sysDashDotDot", + } + + # Check the dash type. + dash_type = line.get("dash_type") + + if dash_type is not None: + if dash_type in dash_types: + line["dash_type"] = dash_types[dash_type] + else: + warn("Unknown dash type '%s'" % dash_type) + return + + line["defined"] = True + + return line + + @staticmethod + def _get_fill_properties(fill): + # Convert user fill properties to the structure required internally. + + if not fill: + return {"defined": False} + + # Copy the user defined properties since they will be modified. + fill = copy.deepcopy(fill) + + fill["defined"] = True + + return fill + + @staticmethod + def _get_pattern_properties(pattern): + # Convert user defined pattern to the structure required internally. + + if not pattern: + return + + # Copy the user defined properties since they will be modified. + pattern = copy.deepcopy(pattern) + + if not pattern.get("pattern"): + warn("Pattern must include 'pattern'") + return + + if not pattern.get("fg_color"): + warn("Pattern must include 'fg_color'") + return + + types = { + "percent_5": "pct5", + "percent_10": "pct10", + "percent_20": "pct20", + "percent_25": "pct25", + "percent_30": "pct30", + "percent_40": "pct40", + "percent_50": "pct50", + "percent_60": "pct60", + "percent_70": "pct70", + "percent_75": "pct75", + "percent_80": "pct80", + "percent_90": "pct90", + "light_downward_diagonal": "ltDnDiag", + "light_upward_diagonal": "ltUpDiag", + "dark_downward_diagonal": "dkDnDiag", + "dark_upward_diagonal": "dkUpDiag", + "wide_downward_diagonal": "wdDnDiag", + "wide_upward_diagonal": "wdUpDiag", + "light_vertical": "ltVert", + "light_horizontal": "ltHorz", + "narrow_vertical": "narVert", + "narrow_horizontal": "narHorz", + "dark_vertical": "dkVert", + "dark_horizontal": "dkHorz", + "dashed_downward_diagonal": "dashDnDiag", + "dashed_upward_diagonal": "dashUpDiag", + "dashed_horizontal": "dashHorz", + "dashed_vertical": "dashVert", + "small_confetti": "smConfetti", + "large_confetti": "lgConfetti", + "zigzag": "zigZag", + "wave": "wave", + "diagonal_brick": "diagBrick", + "horizontal_brick": "horzBrick", + "weave": "weave", + "plaid": "plaid", + "divot": "divot", + "dotted_grid": "dotGrid", + "dotted_diamond": "dotDmnd", + "shingle": "shingle", + "trellis": "trellis", + "sphere": "sphere", + "small_grid": "smGrid", + "large_grid": "lgGrid", + "small_check": "smCheck", + "large_check": "lgCheck", + "outlined_diamond": "openDmnd", + "solid_diamond": "solidDmnd", + } + + # Check for valid types. + if pattern["pattern"] not in types: + warn("unknown pattern type '%s'" % pattern["pattern"]) + return + else: + pattern["pattern"] = types[pattern["pattern"]] + + # Specify a default background color. + pattern["bg_color"] = pattern.get("bg_color", "#FFFFFF") + + return pattern + + @staticmethod + def _get_gradient_properties(gradient): + # Convert user defined gradient to the structure required internally. + + if not gradient: + return + + # Copy the user defined properties since they will be modified. + gradient = copy.deepcopy(gradient) + + types = { + "linear": "linear", + "radial": "circle", + "rectangular": "rect", + "path": "shape", + } + + # Check the colors array exists and is valid. + if "colors" not in gradient or type(gradient["colors"]) != list: + warn("Gradient must include colors list") + return + + # Check the colors array has the required number of entries. + if not 2 <= len(gradient["colors"]) <= 10: + warn("Gradient colors list must at least 2 values and not more than 10") + return + + if "positions" in gradient: + # Check the positions array has the right number of entries. + if len(gradient["positions"]) != len(gradient["colors"]): + warn("Gradient positions not equal to number of colors") + return + + # Check the positions are in the correct range. + for pos in gradient["positions"]: + if not 0 <= pos <= 100: + warn("Gradient position must be in the range 0 <= position <= 100") + return + else: + # Use the default gradient positions. + if len(gradient["colors"]) == 2: + gradient["positions"] = [0, 100] + + elif len(gradient["colors"]) == 3: + gradient["positions"] = [0, 50, 100] + + elif len(gradient["colors"]) == 4: + gradient["positions"] = [0, 33, 66, 100] + + else: + warn("Must specify gradient positions") + return + + angle = gradient.get("angle") + if angle: + if not 0 <= angle < 360: + warn("Gradient angle must be in the range 0 <= angle < 360") + return + else: + gradient["angle"] = 90 + + # Check for valid types. + gradient_type = gradient.get("type") + + if gradient_type is not None: + if gradient_type in types: + gradient["type"] = types[gradient_type] + else: + warn("Unknown gradient type '%s" % gradient_type) + return + else: + gradient["type"] = "linear" + + return gradient + + @staticmethod + def _get_font_properties(options): + # Convert user defined font values into private dict values. + if options is None: + options = {} + + font = { + "name": options.get("name"), + "color": options.get("color"), + "size": options.get("size", 11), + "bold": options.get("bold"), + "italic": options.get("italic"), + "underline": options.get("underline"), + "pitch_family": options.get("pitch_family"), + "charset": options.get("charset"), + "baseline": options.get("baseline", -1), + "lang": options.get("lang", "en-US"), + } + + # Convert font size units. + if font["size"]: + font["size"] = int(font["size"] * 100) + + return font + + @staticmethod + def _get_font_style_attributes(font): + # _get_font_style_attributes. + attributes = [] + + if not font: + return attributes + + if font.get("size"): + attributes.append(("sz", font["size"])) + + if font.get("bold") is not None: + attributes.append(("b", 0 + font["bold"])) + + if font.get("italic") is not None: + attributes.append(("i", 0 + font["italic"])) + + if font.get("underline") is not None: + attributes.append(("u", "sng")) + + if font.get("baseline") != -1: + attributes.append(("baseline", font["baseline"])) + + return attributes + + @staticmethod + def _get_font_latin_attributes(font): + # _get_font_latin_attributes. + attributes = [] + + if not font: + return attributes + + if font["name"] is not None: + attributes.append(("typeface", font["name"])) + + if font["pitch_family"] is not None: + attributes.append(("pitchFamily", font["pitch_family"])) + + if font["charset"] is not None: + attributes.append(("charset", font["charset"])) + + return attributes + + @staticmethod + def _get_align_properties(align): + # Convert user defined align to the structure required internally. + if not align: + return {"defined": False} + + # Copy the user defined properties since they will be modified. + align = copy.deepcopy(align) + + if "vertical" in align: + align_type = align["vertical"] + + align_types = { + "top": "top", + "middle": "middle", + "bottom": "bottom", + } + + if align_type in align_types: + align["vertical"] = align_types[align_type] + else: + warn("Unknown alignment type '%s'" % align_type) + return {"defined": False} + + if "horizontal" in align: + align_type = align["horizontal"] + + align_types = { + "left": "left", + "center": "center", + "right": "right", + } + + if align_type in align_types: + align["horizontal"] = align_types[align_type] + else: + warn("Unknown alignment type '%s'" % align_type) + return {"defined": False} + + align["defined"] = True + + return align diff --git a/billinglayer/python/xlsxwriter/sharedstrings.py b/billinglayer/python/xlsxwriter/sharedstrings.py new file mode 100644 index 0000000..fc881ef --- /dev/null +++ b/billinglayer/python/xlsxwriter/sharedstrings.py @@ -0,0 +1,158 @@ +############################################################################### +# +# SharedStrings - A class for writing the Excel XLSX sharedStrings file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import re + +# Package imports. +from . import xmlwriter +from .utility import preserve_whitespace + +# Compile performance critical regular expressions. +re_control_chars_1 = re.compile("(_x[0-9a-fA-F]{4}_)") +re_control_chars_2 = re.compile(r"([\x00-\x08\x0b-\x1f])") + + +class SharedStrings(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX sharedStrings file. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(SharedStrings, self).__init__() + + self.string_table = None + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the sst element. + self._write_sst() + + # Write the sst strings. + self._write_sst_strings() + + # Close the sst tag. + self._xml_end_tag("sst") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_sst(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + + attributes = [ + ("xmlns", xmlns), + ("count", self.string_table.count), + ("uniqueCount", self.string_table.unique_count), + ] + + self._xml_start_tag("sst", attributes) + + def _write_sst_strings(self): + # Write the sst string elements. + + for string in self.string_table.string_array: + self._write_si(string) + + def _write_si(self, string): + # Write the element. + attributes = [] + + # Excel escapes control characters with _xHHHH_ and also escapes any + # literal strings of that type by encoding the leading underscore. + # So "\0" -> _x0000_ and "_x0000_" -> _x005F_x0000_. + # The following substitutions deal with those cases. + + # Escape the escape. + string = re_control_chars_1.sub(r"_x005F\1", string) + + # Convert control character to the _xHHHH_ escape. + string = re_control_chars_2.sub( + lambda match: "_x%04X_" % ord(match.group(1)), string + ) + + # Escapes non characters in strings. + string = string.replace("\uFFFE", "_xFFFE_") + string = string.replace("\uFFFF", "_xFFFF_") + + # Add attribute to preserve leading or trailing whitespace. + if preserve_whitespace(string): + attributes.append(("xml:space", "preserve")) + + # Write any rich strings without further tags. + if string.startswith("") and string.endswith(""): + self._xml_rich_si_element(string) + else: + self._xml_si_element(string, attributes) + + +# A metadata class to store Excel strings between worksheets. +class SharedStringTable(object): + """ + A class to track Excel shared strings between worksheets. + + """ + + def __init__(self): + self.count = 0 + self.unique_count = 0 + self.string_table = {} + self.string_array = [] + + def _get_shared_string_index(self, string): + """ " Get the index of the string in the Shared String table.""" + if string not in self.string_table: + # String isn't already stored in the table so add it. + index = self.unique_count + self.string_table[string] = index + self.count += 1 + self.unique_count += 1 + return index + else: + # String exists in the table. + index = self.string_table[string] + self.count += 1 + return index + + def _get_shared_string(self, index): + """ " Get a shared string from the index.""" + return self.string_array[index] + + def _sort_string_data(self): + """ " Sort the shared string data and convert from dict to list.""" + self.string_array = sorted(self.string_table, key=self.string_table.__getitem__) + self.string_table = {} diff --git a/billinglayer/python/xlsxwriter/styles.py b/billinglayer/python/xlsxwriter/styles.py new file mode 100644 index 0000000..b79c781 --- /dev/null +++ b/billinglayer/python/xlsxwriter/styles.py @@ -0,0 +1,754 @@ +############################################################################### +# +# Styles - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class Styles(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Styles file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Styles, self).__init__() + + self.xf_formats = [] + self.palette = [] + self.font_count = 0 + self.num_formats = [] + self.border_count = 0 + self.fill_count = 0 + self.custom_colors = [] + self.dxf_formats = [] + self.has_hyperlink = False + self.hyperlink_font_id = 0 + self.has_comments = False + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Add the style sheet. + self._write_style_sheet() + + # Write the number formats. + self._write_num_fmts() + + # Write the fonts. + self._write_fonts() + + # Write the fills. + self._write_fills() + + # Write the borders element. + self._write_borders() + + # Write the cellStyleXfs element. + self._write_cell_style_xfs() + + # Write the cellXfs element. + self._write_cell_xfs() + + # Write the cellStyles element. + self._write_cell_styles() + + # Write the dxfs element. + self._write_dxfs() + + # Write the tableStyles element. + self._write_table_styles() + + # Write the colors element. + self._write_colors() + + # Close the style sheet tag. + self._xml_end_tag("styleSheet") + + # Close the file. + self._xml_close() + + def _set_style_properties(self, properties): + # Pass in the Format objects and other properties used in the styles. + + self.xf_formats = properties[0] + self.palette = properties[1] + self.font_count = properties[2] + self.num_formats = properties[3] + self.border_count = properties[4] + self.fill_count = properties[5] + self.custom_colors = properties[6] + self.dxf_formats = properties[7] + self.has_comments = properties[8] + + def _get_palette_color(self, color): + # Special handling for automatic color. + if color == "Automatic": + return color + + # Convert the RGB color. + if color[0] == "#": + color = color[1:] + + return "FF" + color.upper() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_style_sheet(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + + attributes = [("xmlns", xmlns)] + self._xml_start_tag("styleSheet", attributes) + + def _write_num_fmts(self): + # Write the element. + if not self.num_formats: + return + + attributes = [("count", len(self.num_formats))] + self._xml_start_tag("numFmts", attributes) + + # Write the numFmts elements. + for index, num_format in enumerate(self.num_formats, 164): + self._write_num_fmt(index, num_format) + + self._xml_end_tag("numFmts") + + def _write_num_fmt(self, num_fmt_id, format_code): + # Write the element. + format_codes = { + 0: "General", + 1: "0", + 2: "0.00", + 3: "#,##0", + 4: "#,##0.00", + 5: "($#,##0_);($#,##0)", + 6: "($#,##0_);[Red]($#,##0)", + 7: "($#,##0.00_);($#,##0.00)", + 8: "($#,##0.00_);[Red]($#,##0.00)", + 9: "0%", + 10: "0.00%", + 11: "0.00E+00", + 12: "# ?/?", + 13: "# ??/??", + 14: "m/d/yy", + 15: "d-mmm-yy", + 16: "d-mmm", + 17: "mmm-yy", + 18: "h:mm AM/PM", + 19: "h:mm:ss AM/PM", + 20: "h:mm", + 21: "h:mm:ss", + 22: "m/d/yy h:mm", + 37: "(#,##0_);(#,##0)", + 38: "(#,##0_);[Red](#,##0)", + 39: "(#,##0.00_);(#,##0.00)", + 40: "(#,##0.00_);[Red](#,##0.00)", + 41: '_(* #,##0_);_(* (#,##0);_(* "-"_);_(_)', + 42: '_($* #,##0_);_($* (#,##0);_($* "-"_);_(_)', + 43: '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(_)', + 44: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(_)', + 45: "mm:ss", + 46: "[h]:mm:ss", + 47: "mm:ss.0", + 48: "##0.0E+0", + 49: "@", + } + + # Set the format code for built-in number formats. + if num_fmt_id < 164: + if num_fmt_id in format_codes: + format_code = format_codes[num_fmt_id] + else: + format_code = "General" + + attributes = [ + ("numFmtId", num_fmt_id), + ("formatCode", format_code), + ] + + self._xml_empty_tag("numFmt", attributes) + + def _write_fonts(self): + # Write the element. + if self.has_comments: + # Add extra font for comments. + attributes = [("count", self.font_count + 1)] + else: + attributes = [("count", self.font_count)] + + self._xml_start_tag("fonts", attributes) + + # Write the font elements for xf_format objects that have them. + for xf_format in self.xf_formats: + if xf_format.has_font: + self._write_font(xf_format) + + if self.has_comments: + self._write_comment_font() + + self._xml_end_tag("fonts") + + def _write_font(self, xf_format, is_dxf_format=False): + # Write the element. + self._xml_start_tag("font") + + # The condense and extend elements are mainly used in dxf formats. + if xf_format.font_condense: + self._write_condense() + + if xf_format.font_extend: + self._write_extend() + + if xf_format.bold: + self._xml_empty_tag("b") + + if xf_format.italic: + self._xml_empty_tag("i") + + if xf_format.font_strikeout: + self._xml_empty_tag("strike") + + if xf_format.font_outline: + self._xml_empty_tag("outline") + + if xf_format.font_shadow: + self._xml_empty_tag("shadow") + + # Handle the underline variants. + if xf_format.underline: + self._write_underline(xf_format.underline) + + if xf_format.font_script == 1: + self._write_vert_align("superscript") + + if xf_format.font_script == 2: + self._write_vert_align("subscript") + + if not is_dxf_format: + self._xml_empty_tag("sz", [("val", xf_format.font_size)]) + + if xf_format.theme == -1: + # Ignore for excel2003_style. + pass + elif xf_format.theme: + self._write_color("theme", xf_format.theme) + elif xf_format.color_indexed: + self._write_color("indexed", xf_format.color_indexed) + elif xf_format.font_color: + color = self._get_palette_color(xf_format.font_color) + if color != "Automatic": + self._write_color("rgb", color) + elif not is_dxf_format: + self._write_color("theme", 1) + + if not is_dxf_format: + self._xml_empty_tag("name", [("val", xf_format.font_name)]) + + if xf_format.font_family: + self._xml_empty_tag("family", [("val", xf_format.font_family)]) + + if xf_format.font_charset: + self._xml_empty_tag("charset", [("val", xf_format.font_charset)]) + + if xf_format.font_name == "Calibri" and not xf_format.hyperlink: + self._xml_empty_tag("scheme", [("val", xf_format.font_scheme)]) + + if xf_format.hyperlink: + self.has_hyperlink = True + if self.hyperlink_font_id == 0: + self.hyperlink_font_id = xf_format.font_index + + self._xml_end_tag("font") + + def _write_comment_font(self): + # Write the element for comments. + self._xml_start_tag("font") + + self._xml_empty_tag("sz", [("val", 8)]) + self._write_color("indexed", 81) + self._xml_empty_tag("name", [("val", "Tahoma")]) + self._xml_empty_tag("family", [("val", 2)]) + + self._xml_end_tag("font") + + def _write_underline(self, underline): + # Write the underline font element. + + if underline == 2: + attributes = [("val", "double")] + elif underline == 33: + attributes = [("val", "singleAccounting")] + elif underline == 34: + attributes = [("val", "doubleAccounting")] + else: + # Default to single underline. + attributes = [] + + self._xml_empty_tag("u", attributes) + + def _write_vert_align(self, val): + # Write the font sub-element. + attributes = [("val", val)] + + self._xml_empty_tag("vertAlign", attributes) + + def _write_color(self, name, value): + # Write the element. + attributes = [(name, value)] + + self._xml_empty_tag("color", attributes) + + def _write_fills(self): + # Write the element. + attributes = [("count", self.fill_count)] + + self._xml_start_tag("fills", attributes) + + # Write the default fill element. + self._write_default_fill("none") + self._write_default_fill("gray125") + + # Write the fill elements for xf_format objects that have them. + for xf_format in self.xf_formats: + if xf_format.has_fill: + self._write_fill(xf_format) + + self._xml_end_tag("fills") + + def _write_default_fill(self, pattern_type): + # Write the element for the default fills. + self._xml_start_tag("fill") + self._xml_empty_tag("patternFill", [("patternType", pattern_type)]) + self._xml_end_tag("fill") + + def _write_fill(self, xf_format, is_dxf_format=False): + # Write the element. + pattern = xf_format.pattern + bg_color = xf_format.bg_color + fg_color = xf_format.fg_color + + # Colors for dxf formats are handled differently from normal formats + # since the normal xf_format reverses the meaning of BG and FG for + # solid fills. + if is_dxf_format: + bg_color = xf_format.dxf_bg_color + fg_color = xf_format.dxf_fg_color + + patterns = ( + "none", + "solid", + "mediumGray", + "darkGray", + "lightGray", + "darkHorizontal", + "darkVertical", + "darkDown", + "darkUp", + "darkGrid", + "darkTrellis", + "lightHorizontal", + "lightVertical", + "lightDown", + "lightUp", + "lightGrid", + "lightTrellis", + "gray125", + "gray0625", + ) + + # Special handling for pattern only case. + if not fg_color and not bg_color and patterns[pattern]: + self._write_default_fill(patterns[pattern]) + return + + self._xml_start_tag("fill") + + # The "none" pattern is handled differently for dxf formats. + if is_dxf_format and pattern <= 1: + self._xml_start_tag("patternFill") + else: + self._xml_start_tag("patternFill", [("patternType", patterns[pattern])]) + + if fg_color: + fg_color = self._get_palette_color(fg_color) + if fg_color != "Automatic": + self._xml_empty_tag("fgColor", [("rgb", fg_color)]) + + if bg_color: + bg_color = self._get_palette_color(bg_color) + if bg_color != "Automatic": + self._xml_empty_tag("bgColor", [("rgb", bg_color)]) + else: + if not is_dxf_format and pattern <= 1: + self._xml_empty_tag("bgColor", [("indexed", 64)]) + + self._xml_end_tag("patternFill") + self._xml_end_tag("fill") + + def _write_borders(self): + # Write the element. + attributes = [("count", self.border_count)] + + self._xml_start_tag("borders", attributes) + + # Write the border elements for xf_format objects that have them. + for xf_format in self.xf_formats: + if xf_format.has_border: + self._write_border(xf_format) + + self._xml_end_tag("borders") + + def _write_border(self, xf_format, is_dxf_format=False): + # Write the element. + attributes = [] + + # Diagonal borders add attributes to the element. + if xf_format.diag_type == 1: + attributes.append(("diagonalUp", 1)) + elif xf_format.diag_type == 2: + attributes.append(("diagonalDown", 1)) + elif xf_format.diag_type == 3: + attributes.append(("diagonalUp", 1)) + attributes.append(("diagonalDown", 1)) + + # Ensure that a default diag border is set if the diag type is set. + if xf_format.diag_type and not xf_format.diag_border: + xf_format.diag_border = 1 + + # Write the start border tag. + self._xml_start_tag("border", attributes) + + # Write the sub elements. + self._write_sub_border("left", xf_format.left, xf_format.left_color) + + self._write_sub_border("right", xf_format.right, xf_format.right_color) + + self._write_sub_border("top", xf_format.top, xf_format.top_color) + + self._write_sub_border("bottom", xf_format.bottom, xf_format.bottom_color) + + # Condition DXF formats don't allow diagonal borders. + if not is_dxf_format: + self._write_sub_border( + "diagonal", xf_format.diag_border, xf_format.diag_color + ) + + if is_dxf_format: + self._write_sub_border("vertical", None, None) + self._write_sub_border("horizontal", None, None) + + self._xml_end_tag("border") + + def _write_sub_border(self, border_type, style, color): + # Write the sub elements such as , , etc. + attributes = [] + + if not style: + self._xml_empty_tag(border_type) + return + + border_styles = ( + "none", + "thin", + "medium", + "dashed", + "dotted", + "thick", + "double", + "hair", + "mediumDashed", + "dashDot", + "mediumDashDot", + "dashDotDot", + "mediumDashDotDot", + "slantDashDot", + ) + + attributes.append(("style", border_styles[style])) + + self._xml_start_tag(border_type, attributes) + + if color and color != "Automatic": + color = self._get_palette_color(color) + self._xml_empty_tag("color", [("rgb", color)]) + else: + self._xml_empty_tag("color", [("auto", 1)]) + + self._xml_end_tag(border_type) + + def _write_cell_style_xfs(self): + # Write the element. + count = 1 + + if self.has_hyperlink: + count = 2 + + attributes = [("count", count)] + + self._xml_start_tag("cellStyleXfs", attributes) + self._write_style_xf() + + if self.has_hyperlink: + self._write_style_xf(True, self.hyperlink_font_id) + + self._xml_end_tag("cellStyleXfs") + + def _write_cell_xfs(self): + # Write the element. + formats = self.xf_formats + + # Workaround for when the last xf_format is used for the comment font + # and shouldn't be used for cellXfs. + last_format = formats[-1] + if last_format.font_only: + formats.pop() + + attributes = [("count", len(formats))] + self._xml_start_tag("cellXfs", attributes) + + # Write the xf elements. + for xf_format in formats: + self._write_xf(xf_format) + + self._xml_end_tag("cellXfs") + + def _write_style_xf(self, has_hyperlink=False, font_id=0): + # Write the style element. + num_fmt_id = 0 + fill_id = 0 + border_id = 0 + + attributes = [ + ("numFmtId", num_fmt_id), + ("fontId", font_id), + ("fillId", fill_id), + ("borderId", border_id), + ] + + if has_hyperlink: + attributes.append(("applyNumberFormat", 0)) + attributes.append(("applyFill", 0)) + attributes.append(("applyBorder", 0)) + attributes.append(("applyAlignment", 0)) + attributes.append(("applyProtection", 0)) + + self._xml_start_tag("xf", attributes) + self._xml_empty_tag("alignment", [("vertical", "top")]) + self._xml_empty_tag("protection", [("locked", 0)]) + self._xml_end_tag("xf") + + else: + self._xml_empty_tag("xf", attributes) + + def _write_xf(self, xf_format): + # Write the element. + num_fmt_id = xf_format.num_format_index + font_id = xf_format.font_index + fill_id = xf_format.fill_index + border_id = xf_format.border_index + xf_id = xf_format.xf_id + has_align = 0 + has_protect = 0 + + attributes = [ + ("numFmtId", num_fmt_id), + ("fontId", font_id), + ("fillId", fill_id), + ("borderId", border_id), + ("xfId", xf_id), + ] + + if xf_format.quote_prefix: + attributes.append(("quotePrefix", 1)) + + if xf_format.num_format_index > 0: + attributes.append(("applyNumberFormat", 1)) + + # Add applyFont attribute if XF format uses a font element. + if xf_format.font_index > 0 and not xf_format.hyperlink: + attributes.append(("applyFont", 1)) + + # Add applyFill attribute if XF format uses a fill element. + if xf_format.fill_index > 0: + attributes.append(("applyFill", 1)) + + # Add applyBorder attribute if XF format uses a border element. + if xf_format.border_index > 0: + attributes.append(("applyBorder", 1)) + + # Check if XF format has alignment properties set. + (apply_align, align) = xf_format._get_align_properties() + + # Check if an alignment sub-element should be written. + if apply_align and align: + has_align = 1 + + # We can also have applyAlignment without a sub-element. + if apply_align or xf_format.hyperlink: + attributes.append(("applyAlignment", 1)) + + # Check for cell protection properties. + protection = xf_format._get_protection_properties() + + if protection or xf_format.hyperlink: + attributes.append(("applyProtection", 1)) + + if not xf_format.hyperlink: + has_protect = 1 + + # Write XF with sub-elements if required. + if has_align or has_protect: + self._xml_start_tag("xf", attributes) + if has_align: + self._xml_empty_tag("alignment", align) + if has_protect: + self._xml_empty_tag("protection", protection) + self._xml_end_tag("xf") + else: + self._xml_empty_tag("xf", attributes) + + def _write_cell_styles(self): + # Write the element. + count = 1 + + if self.has_hyperlink: + count = 2 + + attributes = [("count", count)] + + self._xml_start_tag("cellStyles", attributes) + + if self.has_hyperlink: + self._write_cell_style("Hyperlink", 1, 8) + + self._write_cell_style() + + self._xml_end_tag("cellStyles") + + def _write_cell_style(self, name="Normal", xf_id=0, builtin_id=0): + # Write the element. + attributes = [ + ("name", name), + ("xfId", xf_id), + ("builtinId", builtin_id), + ] + + self._xml_empty_tag("cellStyle", attributes) + + def _write_dxfs(self): + # Write the element. + formats = self.dxf_formats + count = len(formats) + + attributes = [("count", len(formats))] + + if count: + self._xml_start_tag("dxfs", attributes) + + # Write the font elements for xf_format objects that have them. + for xf_format in self.dxf_formats: + self._xml_start_tag("dxf") + if xf_format.has_dxf_font: + self._write_font(xf_format, True) + + if xf_format.num_format_index: + self._write_num_fmt( + xf_format.num_format_index, xf_format.num_format + ) + + if xf_format.has_dxf_fill: + self._write_fill(xf_format, True) + if xf_format.has_dxf_border: + self._write_border(xf_format, True) + self._xml_end_tag("dxf") + + self._xml_end_tag("dxfs") + else: + self._xml_empty_tag("dxfs", attributes) + + def _write_table_styles(self): + # Write the element. + count = 0 + default_table_style = "TableStyleMedium9" + default_pivot_style = "PivotStyleLight16" + + attributes = [ + ("count", count), + ("defaultTableStyle", default_table_style), + ("defaultPivotStyle", default_pivot_style), + ] + + self._xml_empty_tag("tableStyles", attributes) + + def _write_colors(self): + # Write the element. + custom_colors = self.custom_colors + + if not custom_colors: + return + + self._xml_start_tag("colors") + self._write_mru_colors(custom_colors) + self._xml_end_tag("colors") + + def _write_mru_colors(self, custom_colors): + # Write the element for the most recently used colors. + + # Write the custom custom_colors in reverse order. + custom_colors.reverse() + + # Limit the mruColors to the last 10. + if len(custom_colors) > 10: + custom_colors = custom_colors[0:10] + + self._xml_start_tag("mruColors") + + # Write the custom custom_colors in reverse order. + for color in custom_colors: + self._write_color("rgb", color) + + self._xml_end_tag("mruColors") + + def _write_condense(self): + # Write the element. + attributes = [("val", 0)] + + self._xml_empty_tag("condense", attributes) + + def _write_extend(self): + # Write the element. + attributes = [("val", 0)] + + self._xml_empty_tag("extend", attributes) diff --git a/billinglayer/python/xlsxwriter/table.py b/billinglayer/python/xlsxwriter/table.py new file mode 100644 index 0000000..e15e042 --- /dev/null +++ b/billinglayer/python/xlsxwriter/table.py @@ -0,0 +1,184 @@ +############################################################################### +# +# Table - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter + + +class Table(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Table file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Table, self).__init__() + + self.properties = {} + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the table element. + self._write_table() + + # Write the autoFilter element. + self._write_auto_filter() + + # Write the tableColumns element. + self._write_table_columns() + + # Write the tableStyleInfo element. + self._write_table_style_info() + + # Close the table tag. + self._xml_end_tag("table") + + # Close the file. + self._xml_close() + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_table(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/" + xmlns = schema + "spreadsheetml/2006/main" + table_id = self.properties["id"] + name = self.properties["name"] + display_name = self.properties["name"] + ref = self.properties["range"] + totals_row_shown = self.properties["totals_row_shown"] + header_row_count = self.properties["header_row_count"] + + attributes = [ + ("xmlns", xmlns), + ("id", table_id), + ("name", name), + ("displayName", display_name), + ("ref", ref), + ] + + if not header_row_count: + attributes.append(("headerRowCount", 0)) + + if totals_row_shown: + attributes.append(("totalsRowCount", 1)) + else: + attributes.append(("totalsRowShown", 0)) + + self._xml_start_tag("table", attributes) + + def _write_auto_filter(self): + # Write the element. + autofilter = self.properties.get("autofilter", 0) + + if not autofilter: + return + + attributes = [ + ( + "ref", + autofilter, + ) + ] + + self._xml_empty_tag("autoFilter", attributes) + + def _write_table_columns(self): + # Write the element. + columns = self.properties["columns"] + + count = len(columns) + + attributes = [("count", count)] + + self._xml_start_tag("tableColumns", attributes) + + for col_data in columns: + # Write the tableColumn element. + self._write_table_column(col_data) + + self._xml_end_tag("tableColumns") + + def _write_table_column(self, col_data): + # Write the element. + attributes = [ + ("id", col_data["id"]), + ("name", col_data["name"]), + ] + + if col_data.get("total_string"): + attributes.append(("totalsRowLabel", col_data["total_string"])) + elif col_data.get("total_function"): + attributes.append(("totalsRowFunction", col_data["total_function"])) + + if "format" in col_data and col_data["format"] is not None: + attributes.append(("dataDxfId", col_data["format"])) + + if col_data.get("formula"): + self._xml_start_tag("tableColumn", attributes) + + # Write the calculatedColumnFormula element. + self._write_calculated_column_formula(col_data["formula"]) + + self._xml_end_tag("tableColumn") + else: + self._xml_empty_tag("tableColumn", attributes) + + def _write_table_style_info(self): + # Write the element. + props = self.properties + attributes = [] + + name = props["style"] + show_first_column = 0 + props["show_first_col"] + show_last_column = 0 + props["show_last_col"] + show_row_stripes = 0 + props["show_row_stripes"] + show_column_stripes = 0 + props["show_col_stripes"] + + if name is not None and name != "" and name != "None": + attributes.append(("name", name)) + + attributes.append(("showFirstColumn", show_first_column)) + attributes.append(("showLastColumn", show_last_column)) + attributes.append(("showRowStripes", show_row_stripes)) + attributes.append(("showColumnStripes", show_column_stripes)) + + self._xml_empty_tag("tableStyleInfo", attributes) + + def _write_calculated_column_formula(self, formula): + # Write the element. + self._xml_data_element("calculatedColumnFormula", formula) diff --git a/billinglayer/python/xlsxwriter/theme.py b/billinglayer/python/xlsxwriter/theme.py new file mode 100644 index 0000000..75c369f --- /dev/null +++ b/billinglayer/python/xlsxwriter/theme.py @@ -0,0 +1,66 @@ +############################################################################### +# +# Theme - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from io import StringIO + + +class Theme(object): + """ + A class for writing the Excel XLSX Theme file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + super(Theme, self).__init__() + self.fh = None + self.internal_fh = False + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + self._write_theme_file() + if self.internal_fh: + self.fh.close() + + def _set_xml_writer(self, filename): + # Set the XML writer filehandle for the object. + if isinstance(filename, StringIO): + self.internal_fh = False + self.fh = filename + else: + self.internal_fh = True + self.fh = open(filename, mode="w", encoding="utf-8") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_theme_file(self): + # Write a default theme.xml file. + + default_theme = """\n""" # noqa + + self.fh.write(default_theme) diff --git a/billinglayer/python/xlsxwriter/utility.py b/billinglayer/python/xlsxwriter/utility.py new file mode 100644 index 0000000..b21bd40 --- /dev/null +++ b/billinglayer/python/xlsxwriter/utility.py @@ -0,0 +1,875 @@ +############################################################################### +# +# Worksheet - A class for writing Excel Worksheets. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import re +import datetime +from warnings import warn + +COL_NAMES = {} + +CHAR_WIDTHS = { + " ": 3, + "!": 5, + '"': 6, + "#": 7, + "$": 7, + "%": 11, + "&": 10, + "'": 3, + "(": 5, + ")": 5, + "*": 7, + "+": 7, + ",": 4, + "-": 5, + ".": 4, + "/": 6, + "0": 7, + "1": 7, + "2": 7, + "3": 7, + "4": 7, + "5": 7, + "6": 7, + "7": 7, + "8": 7, + "9": 7, + ":": 4, + ";": 4, + "<": 7, + "=": 7, + ">": 7, + "?": 7, + "@": 13, + "A": 9, + "B": 8, + "C": 8, + "D": 9, + "E": 7, + "F": 7, + "G": 9, + "H": 9, + "I": 4, + "J": 5, + "K": 8, + "L": 6, + "M": 12, + "N": 10, + "O": 10, + "P": 8, + "Q": 10, + "R": 8, + "S": 7, + "T": 7, + "U": 9, + "V": 9, + "W": 13, + "X": 8, + "Y": 7, + "Z": 7, + "[": 5, + "\\": 6, + "]": 5, + "^": 7, + "_": 7, + "`": 4, + "a": 7, + "b": 8, + "c": 6, + "d": 8, + "e": 8, + "f": 5, + "g": 7, + "h": 8, + "i": 4, + "j": 4, + "k": 7, + "l": 4, + "m": 12, + "n": 8, + "o": 8, + "p": 8, + "q": 8, + "r": 5, + "s": 6, + "t": 5, + "u": 8, + "v": 7, + "w": 11, + "x": 7, + "y": 7, + "z": 6, + "{": 5, + "|": 7, + "}": 5, + "~": 7, +} + +# Compile performance critical regular expressions. +re_leading = re.compile(r"^\s") +re_trailing = re.compile(r"\s$") +re_range_parts = re.compile(r"(\$?)([A-Z]{1,3})(\$?)(\d+)") + + +def xl_rowcol_to_cell(row, col, row_abs=False, col_abs=False): + """ + Convert a zero indexed row and column cell reference to a A1 style string. + + Args: + row: The cell row. Int. + col: The cell column. Int. + row_abs: Optional flag to make the row absolute. Bool. + col_abs: Optional flag to make the column absolute. Bool. + + Returns: + A1 style string. + + """ + if row < 0: + warn("Row number %d must be >= 0" % row) + return None + + if col < 0: + warn("Col number %d must be >= 0" % col) + return None + + row += 1 # Change to 1-index. + row_abs = "$" if row_abs else "" + + col_str = xl_col_to_name(col, col_abs) + + return col_str + row_abs + str(row) + + +def xl_rowcol_to_cell_fast(row, col): + """ + Optimized version of the xl_rowcol_to_cell function. Only used internally. + + Args: + row: The cell row. Int. + col: The cell column. Int. + + Returns: + A1 style string. + + """ + if col in COL_NAMES: + col_str = COL_NAMES[col] + else: + col_str = xl_col_to_name(col) + COL_NAMES[col] = col_str + + return col_str + str(row + 1) + + +def xl_col_to_name(col, col_abs=False): + """ + Convert a zero indexed column cell reference to a string. + + Args: + col: The cell column. Int. + col_abs: Optional flag to make the column absolute. Bool. + + Returns: + Column style string. + + """ + col_num = col + if col_num < 0: + warn("Col number %d must be >= 0" % col_num) + return None + + col_num += 1 # Change to 1-index. + col_str = "" + col_abs = "$" if col_abs else "" + + while col_num: + # Set remainder from 1 .. 26 + remainder = col_num % 26 + + if remainder == 0: + remainder = 26 + + # Convert the remainder to a character. + col_letter = chr(ord("A") + remainder - 1) + + # Accumulate the column letters, right to left. + col_str = col_letter + col_str + + # Get the next order of magnitude. + col_num = int((col_num - 1) / 26) + + return col_abs + col_str + + +def xl_cell_to_rowcol(cell_str): + """ + Convert a cell reference in A1 notation to a zero indexed row and column. + + Args: + cell_str: A1 style string. + + Returns: + row, col: Zero indexed cell row and column indices. + + """ + if not cell_str: + return 0, 0 + + match = re_range_parts.match(cell_str) + col_str = match.group(2) + row_str = match.group(4) + + # Convert base26 column string to number. + expn = 0 + col = 0 + for char in reversed(col_str): + col += (ord(char) - ord("A") + 1) * (26**expn) + expn += 1 + + # Convert 1-index to zero-index + row = int(row_str) - 1 + col -= 1 + + return row, col + + +def xl_cell_to_rowcol_abs(cell_str): + """ + Convert an absolute cell reference in A1 notation to a zero indexed + row and column, with True/False values for absolute rows or columns. + + Args: + cell_str: A1 style string. + + Returns: + row, col, row_abs, col_abs: Zero indexed cell row and column indices. + + """ + if not cell_str: + return 0, 0, False, False + + match = re_range_parts.match(cell_str) + + col_abs = match.group(1) + col_str = match.group(2) + row_abs = match.group(3) + row_str = match.group(4) + + if col_abs: + col_abs = True + else: + col_abs = False + + if row_abs: + row_abs = True + else: + row_abs = False + + # Convert base26 column string to number. + expn = 0 + col = 0 + for char in reversed(col_str): + col += (ord(char) - ord("A") + 1) * (26**expn) + expn += 1 + + # Convert 1-index to zero-index + row = int(row_str) - 1 + col -= 1 + + return row, col, row_abs, col_abs + + +def xl_range(first_row, first_col, last_row, last_col): + """ + Convert zero indexed row and col cell references to a A1:B1 range string. + + Args: + first_row: The first cell row. Int. + first_col: The first cell column. Int. + last_row: The last cell row. Int. + last_col: The last cell column. Int. + + Returns: + A1:B1 style range string. + + """ + range1 = xl_rowcol_to_cell(first_row, first_col) + range2 = xl_rowcol_to_cell(last_row, last_col) + + if range1 is None or range2 is None: + warn("Row and column numbers must be >= 0") + return None + + if range1 == range2: + return range1 + else: + return range1 + ":" + range2 + + +def xl_range_abs(first_row, first_col, last_row, last_col): + """ + Convert zero indexed row and col cell references to a $A$1:$B$1 absolute + range string. + + Args: + first_row: The first cell row. Int. + first_col: The first cell column. Int. + last_row: The last cell row. Int. + last_col: The last cell column. Int. + + Returns: + $A$1:$B$1 style range string. + + """ + range1 = xl_rowcol_to_cell(first_row, first_col, True, True) + range2 = xl_rowcol_to_cell(last_row, last_col, True, True) + + if range1 is None or range2 is None: + warn("Row and column numbers must be >= 0") + return None + + if range1 == range2: + return range1 + else: + return range1 + ":" + range2 + + +def xl_range_formula(sheetname, first_row, first_col, last_row, last_col): + """ + Convert worksheet name and zero indexed row and col cell references to + a Sheet1!A1:B1 range formula string. + + Args: + sheetname: The worksheet name. String. + first_row: The first cell row. Int. + first_col: The first cell column. Int. + last_row: The last cell row. Int. + last_col: The last cell column. Int. + + Returns: + A1:B1 style range string. + + """ + cell_range = xl_range_abs(first_row, first_col, last_row, last_col) + sheetname = quote_sheetname(sheetname) + + return sheetname + "!" + cell_range + + +def quote_sheetname(sheetname): + """ + Convert a worksheet name to a quoted name if it contains spaces or + special characters. + + Args: + sheetname: The worksheet name. String. + + Returns: + A quoted worksheet string. + + """ + + if not sheetname.isalnum() and not sheetname.startswith("'"): + # Double quote any single quotes. + sheetname = sheetname.replace("'", "''") + + # Single quote the sheet name. + sheetname = "'%s'" % sheetname + + return sheetname + + +def xl_pixel_width(string): + """ + Get the pixel width of a string based on individual character widths taken + from Excel. UTF8 characters, and other unhandled characters, are given a + default width of 8. + + Args: + string: The string to calculate the width for. String. + + Returns: + The string width in pixels. Note, Excel adds an additional 7 pixels of + padding in the cell. + + """ + length = 0 + for char in string: + length += CHAR_WIDTHS.get(char, 8) + + return length + + +def xl_color(color): + # Used in conjunction with the XlsxWriter *color() methods to convert + # a color name into an RGB formatted string. These colors are for + # backward compatibility with older versions of Excel. + named_colors = { + "black": "#000000", + "blue": "#0000FF", + "brown": "#800000", + "cyan": "#00FFFF", + "gray": "#808080", + "green": "#008000", + "lime": "#00FF00", + "magenta": "#FF00FF", + "navy": "#000080", + "orange": "#FF6600", + "pink": "#FF00FF", + "purple": "#800080", + "red": "#FF0000", + "silver": "#C0C0C0", + "white": "#FFFFFF", + "yellow": "#FFFF00", + } + + if color in named_colors: + color = named_colors[color] + + if not re.match("#[0-9a-fA-F]{6}", color): + warn("Color '%s' isn't a valid Excel color" % color) + + # Convert the RGB color to the Excel ARGB format. + return "FF" + color.lstrip("#").upper() + + +def get_rgb_color(color): + # Convert the user specified color to an RGB color. + rgb_color = xl_color(color) + + # Remove leading FF from RGB color for charts. + rgb_color = re.sub(r"^FF", "", rgb_color) + + return rgb_color + + +def get_sparkline_style(style_id): + styles = [ + { + "series": {"theme": "4", "tint": "-0.499984740745262"}, + "negative": {"theme": "5"}, + "markers": {"theme": "4", "tint": "-0.499984740745262"}, + "first": {"theme": "4", "tint": "0.39997558519241921"}, + "last": {"theme": "4", "tint": "0.39997558519241921"}, + "high": {"theme": "4"}, + "low": {"theme": "4"}, + }, # 0 + { + "series": {"theme": "4", "tint": "-0.499984740745262"}, + "negative": {"theme": "5"}, + "markers": {"theme": "4", "tint": "-0.499984740745262"}, + "first": {"theme": "4", "tint": "0.39997558519241921"}, + "last": {"theme": "4", "tint": "0.39997558519241921"}, + "high": {"theme": "4"}, + "low": {"theme": "4"}, + }, # 1 + { + "series": {"theme": "5", "tint": "-0.499984740745262"}, + "negative": {"theme": "6"}, + "markers": {"theme": "5", "tint": "-0.499984740745262"}, + "first": {"theme": "5", "tint": "0.39997558519241921"}, + "last": {"theme": "5", "tint": "0.39997558519241921"}, + "high": {"theme": "5"}, + "low": {"theme": "5"}, + }, # 2 + { + "series": {"theme": "6", "tint": "-0.499984740745262"}, + "negative": {"theme": "7"}, + "markers": {"theme": "6", "tint": "-0.499984740745262"}, + "first": {"theme": "6", "tint": "0.39997558519241921"}, + "last": {"theme": "6", "tint": "0.39997558519241921"}, + "high": {"theme": "6"}, + "low": {"theme": "6"}, + }, # 3 + { + "series": {"theme": "7", "tint": "-0.499984740745262"}, + "negative": {"theme": "8"}, + "markers": {"theme": "7", "tint": "-0.499984740745262"}, + "first": {"theme": "7", "tint": "0.39997558519241921"}, + "last": {"theme": "7", "tint": "0.39997558519241921"}, + "high": {"theme": "7"}, + "low": {"theme": "7"}, + }, # 4 + { + "series": {"theme": "8", "tint": "-0.499984740745262"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8", "tint": "-0.499984740745262"}, + "first": {"theme": "8", "tint": "0.39997558519241921"}, + "last": {"theme": "8", "tint": "0.39997558519241921"}, + "high": {"theme": "8"}, + "low": {"theme": "8"}, + }, # 5 + { + "series": {"theme": "9", "tint": "-0.499984740745262"}, + "negative": {"theme": "4"}, + "markers": {"theme": "9", "tint": "-0.499984740745262"}, + "first": {"theme": "9", "tint": "0.39997558519241921"}, + "last": {"theme": "9", "tint": "0.39997558519241921"}, + "high": {"theme": "9"}, + "low": {"theme": "9"}, + }, # 6 + { + "series": {"theme": "4", "tint": "-0.249977111117893"}, + "negative": {"theme": "5"}, + "markers": {"theme": "5", "tint": "-0.249977111117893"}, + "first": {"theme": "5", "tint": "-0.249977111117893"}, + "last": {"theme": "5", "tint": "-0.249977111117893"}, + "high": {"theme": "5", "tint": "-0.249977111117893"}, + "low": {"theme": "5", "tint": "-0.249977111117893"}, + }, # 7 + { + "series": {"theme": "5", "tint": "-0.249977111117893"}, + "negative": {"theme": "6"}, + "markers": {"theme": "6", "tint": "-0.249977111117893"}, + "first": {"theme": "6", "tint": "-0.249977111117893"}, + "last": {"theme": "6", "tint": "-0.249977111117893"}, + "high": {"theme": "6", "tint": "-0.249977111117893"}, + "low": {"theme": "6", "tint": "-0.249977111117893"}, + }, # 8 + { + "series": {"theme": "6", "tint": "-0.249977111117893"}, + "negative": {"theme": "7"}, + "markers": {"theme": "7", "tint": "-0.249977111117893"}, + "first": {"theme": "7", "tint": "-0.249977111117893"}, + "last": {"theme": "7", "tint": "-0.249977111117893"}, + "high": {"theme": "7", "tint": "-0.249977111117893"}, + "low": {"theme": "7", "tint": "-0.249977111117893"}, + }, # 9 + { + "series": {"theme": "7", "tint": "-0.249977111117893"}, + "negative": {"theme": "8"}, + "markers": {"theme": "8", "tint": "-0.249977111117893"}, + "first": {"theme": "8", "tint": "-0.249977111117893"}, + "last": {"theme": "8", "tint": "-0.249977111117893"}, + "high": {"theme": "8", "tint": "-0.249977111117893"}, + "low": {"theme": "8", "tint": "-0.249977111117893"}, + }, # 10 + { + "series": {"theme": "8", "tint": "-0.249977111117893"}, + "negative": {"theme": "9"}, + "markers": {"theme": "9", "tint": "-0.249977111117893"}, + "first": {"theme": "9", "tint": "-0.249977111117893"}, + "last": {"theme": "9", "tint": "-0.249977111117893"}, + "high": {"theme": "9", "tint": "-0.249977111117893"}, + "low": {"theme": "9", "tint": "-0.249977111117893"}, + }, # 11 + { + "series": {"theme": "9", "tint": "-0.249977111117893"}, + "negative": {"theme": "4"}, + "markers": {"theme": "4", "tint": "-0.249977111117893"}, + "first": {"theme": "4", "tint": "-0.249977111117893"}, + "last": {"theme": "4", "tint": "-0.249977111117893"}, + "high": {"theme": "4", "tint": "-0.249977111117893"}, + "low": {"theme": "4", "tint": "-0.249977111117893"}, + }, # 12 + { + "series": {"theme": "4"}, + "negative": {"theme": "5"}, + "markers": {"theme": "4", "tint": "-0.249977111117893"}, + "first": {"theme": "4", "tint": "-0.249977111117893"}, + "last": {"theme": "4", "tint": "-0.249977111117893"}, + "high": {"theme": "4", "tint": "-0.249977111117893"}, + "low": {"theme": "4", "tint": "-0.249977111117893"}, + }, # 13 + { + "series": {"theme": "5"}, + "negative": {"theme": "6"}, + "markers": {"theme": "5", "tint": "-0.249977111117893"}, + "first": {"theme": "5", "tint": "-0.249977111117893"}, + "last": {"theme": "5", "tint": "-0.249977111117893"}, + "high": {"theme": "5", "tint": "-0.249977111117893"}, + "low": {"theme": "5", "tint": "-0.249977111117893"}, + }, # 14 + { + "series": {"theme": "6"}, + "negative": {"theme": "7"}, + "markers": {"theme": "6", "tint": "-0.249977111117893"}, + "first": {"theme": "6", "tint": "-0.249977111117893"}, + "last": {"theme": "6", "tint": "-0.249977111117893"}, + "high": {"theme": "6", "tint": "-0.249977111117893"}, + "low": {"theme": "6", "tint": "-0.249977111117893"}, + }, # 15 + { + "series": {"theme": "7"}, + "negative": {"theme": "8"}, + "markers": {"theme": "7", "tint": "-0.249977111117893"}, + "first": {"theme": "7", "tint": "-0.249977111117893"}, + "last": {"theme": "7", "tint": "-0.249977111117893"}, + "high": {"theme": "7", "tint": "-0.249977111117893"}, + "low": {"theme": "7", "tint": "-0.249977111117893"}, + }, # 16 + { + "series": {"theme": "8"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8", "tint": "-0.249977111117893"}, + "first": {"theme": "8", "tint": "-0.249977111117893"}, + "last": {"theme": "8", "tint": "-0.249977111117893"}, + "high": {"theme": "8", "tint": "-0.249977111117893"}, + "low": {"theme": "8", "tint": "-0.249977111117893"}, + }, # 17 + { + "series": {"theme": "9"}, + "negative": {"theme": "4"}, + "markers": {"theme": "9", "tint": "-0.249977111117893"}, + "first": {"theme": "9", "tint": "-0.249977111117893"}, + "last": {"theme": "9", "tint": "-0.249977111117893"}, + "high": {"theme": "9", "tint": "-0.249977111117893"}, + "low": {"theme": "9", "tint": "-0.249977111117893"}, + }, # 18 + { + "series": {"theme": "4", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "4", "tint": "0.79998168889431442"}, + "first": {"theme": "4", "tint": "-0.249977111117893"}, + "last": {"theme": "4", "tint": "-0.249977111117893"}, + "high": {"theme": "4", "tint": "-0.499984740745262"}, + "low": {"theme": "4", "tint": "-0.499984740745262"}, + }, # 19 + { + "series": {"theme": "5", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "5", "tint": "0.79998168889431442"}, + "first": {"theme": "5", "tint": "-0.249977111117893"}, + "last": {"theme": "5", "tint": "-0.249977111117893"}, + "high": {"theme": "5", "tint": "-0.499984740745262"}, + "low": {"theme": "5", "tint": "-0.499984740745262"}, + }, # 20 + { + "series": {"theme": "6", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "6", "tint": "0.79998168889431442"}, + "first": {"theme": "6", "tint": "-0.249977111117893"}, + "last": {"theme": "6", "tint": "-0.249977111117893"}, + "high": {"theme": "6", "tint": "-0.499984740745262"}, + "low": {"theme": "6", "tint": "-0.499984740745262"}, + }, # 21 + { + "series": {"theme": "7", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "7", "tint": "0.79998168889431442"}, + "first": {"theme": "7", "tint": "-0.249977111117893"}, + "last": {"theme": "7", "tint": "-0.249977111117893"}, + "high": {"theme": "7", "tint": "-0.499984740745262"}, + "low": {"theme": "7", "tint": "-0.499984740745262"}, + }, # 22 + { + "series": {"theme": "8", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "8", "tint": "0.79998168889431442"}, + "first": {"theme": "8", "tint": "-0.249977111117893"}, + "last": {"theme": "8", "tint": "-0.249977111117893"}, + "high": {"theme": "8", "tint": "-0.499984740745262"}, + "low": {"theme": "8", "tint": "-0.499984740745262"}, + }, # 23 + { + "series": {"theme": "9", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "9", "tint": "0.79998168889431442"}, + "first": {"theme": "9", "tint": "-0.249977111117893"}, + "last": {"theme": "9", "tint": "-0.249977111117893"}, + "high": {"theme": "9", "tint": "-0.499984740745262"}, + "low": {"theme": "9", "tint": "-0.499984740745262"}, + }, # 24 + { + "series": {"theme": "1", "tint": "0.499984740745262"}, + "negative": {"theme": "1", "tint": "0.249977111117893"}, + "markers": {"theme": "1", "tint": "0.249977111117893"}, + "first": {"theme": "1", "tint": "0.249977111117893"}, + "last": {"theme": "1", "tint": "0.249977111117893"}, + "high": {"theme": "1", "tint": "0.249977111117893"}, + "low": {"theme": "1", "tint": "0.249977111117893"}, + }, # 25 + { + "series": {"theme": "1", "tint": "0.34998626667073579"}, + "negative": {"theme": "0", "tint": "-0.249977111117893"}, + "markers": {"theme": "0", "tint": "-0.249977111117893"}, + "first": {"theme": "0", "tint": "-0.249977111117893"}, + "last": {"theme": "0", "tint": "-0.249977111117893"}, + "high": {"theme": "0", "tint": "-0.249977111117893"}, + "low": {"theme": "0", "tint": "-0.249977111117893"}, + }, # 26 + { + "series": {"rgb": "FF323232"}, + "negative": {"rgb": "FFD00000"}, + "markers": {"rgb": "FFD00000"}, + "first": {"rgb": "FFD00000"}, + "last": {"rgb": "FFD00000"}, + "high": {"rgb": "FFD00000"}, + "low": {"rgb": "FFD00000"}, + }, # 27 + { + "series": {"rgb": "FF000000"}, + "negative": {"rgb": "FF0070C0"}, + "markers": {"rgb": "FF0070C0"}, + "first": {"rgb": "FF0070C0"}, + "last": {"rgb": "FF0070C0"}, + "high": {"rgb": "FF0070C0"}, + "low": {"rgb": "FF0070C0"}, + }, # 28 + { + "series": {"rgb": "FF376092"}, + "negative": {"rgb": "FFD00000"}, + "markers": {"rgb": "FFD00000"}, + "first": {"rgb": "FFD00000"}, + "last": {"rgb": "FFD00000"}, + "high": {"rgb": "FFD00000"}, + "low": {"rgb": "FFD00000"}, + }, # 29 + { + "series": {"rgb": "FF0070C0"}, + "negative": {"rgb": "FF000000"}, + "markers": {"rgb": "FF000000"}, + "first": {"rgb": "FF000000"}, + "last": {"rgb": "FF000000"}, + "high": {"rgb": "FF000000"}, + "low": {"rgb": "FF000000"}, + }, # 30 + { + "series": {"rgb": "FF5F5F5F"}, + "negative": {"rgb": "FFFFB620"}, + "markers": {"rgb": "FFD70077"}, + "first": {"rgb": "FF5687C2"}, + "last": {"rgb": "FF359CEB"}, + "high": {"rgb": "FF56BE79"}, + "low": {"rgb": "FFFF5055"}, + }, # 31 + { + "series": {"rgb": "FF5687C2"}, + "negative": {"rgb": "FFFFB620"}, + "markers": {"rgb": "FFD70077"}, + "first": {"rgb": "FF777777"}, + "last": {"rgb": "FF359CEB"}, + "high": {"rgb": "FF56BE79"}, + "low": {"rgb": "FFFF5055"}, + }, # 32 + { + "series": {"rgb": "FFC6EFCE"}, + "negative": {"rgb": "FFFFC7CE"}, + "markers": {"rgb": "FF8CADD6"}, + "first": {"rgb": "FFFFDC47"}, + "last": {"rgb": "FFFFEB9C"}, + "high": {"rgb": "FF60D276"}, + "low": {"rgb": "FFFF5367"}, + }, # 33 + { + "series": {"rgb": "FF00B050"}, + "negative": {"rgb": "FFFF0000"}, + "markers": {"rgb": "FF0070C0"}, + "first": {"rgb": "FFFFC000"}, + "last": {"rgb": "FFFFC000"}, + "high": {"rgb": "FF00B050"}, + "low": {"rgb": "FFFF0000"}, + }, # 34 + { + "series": {"theme": "3"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8"}, + "first": {"theme": "4"}, + "last": {"theme": "5"}, + "high": {"theme": "6"}, + "low": {"theme": "7"}, + }, # 35 + { + "series": {"theme": "1"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8"}, + "first": {"theme": "4"}, + "last": {"theme": "5"}, + "high": {"theme": "6"}, + "low": {"theme": "7"}, + }, # 36 + ] + + return styles[style_id] + + +def supported_datetime(dt): + # Determine is an argument is a supported datetime object. + return isinstance( + dt, (datetime.datetime, datetime.date, datetime.time, datetime.timedelta) + ) + + +def remove_datetime_timezone(dt_obj, remove_timezone): + # Excel doesn't support timezones in datetimes/times so we remove the + # tzinfo from the object if the user has specified that option in the + # constructor. + if remove_timezone: + dt_obj = dt_obj.replace(tzinfo=None) + else: + if dt_obj.tzinfo: + raise TypeError( + "Excel doesn't support timezones in datetimes. " + "Set the tzinfo in the datetime/time object to None or " + "use the 'remove_timezone' Workbook() option" + ) + + return dt_obj + + +def datetime_to_excel_datetime(dt_obj, date_1904, remove_timezone): + # Convert a datetime object to an Excel serial date and time. The integer + # part of the number stores the number of days since the epoch and the + # fractional part stores the percentage of the day. + date_type = dt_obj + is_timedelta = False + + if date_1904: + # Excel for Mac date epoch. + epoch = datetime.datetime(1904, 1, 1) + else: + # Default Excel epoch. + epoch = datetime.datetime(1899, 12, 31) + + # We handle datetime .datetime, .date and .time objects but convert + # them to datetime.datetime objects and process them in the same way. + if isinstance(dt_obj, datetime.datetime): + dt_obj = remove_datetime_timezone(dt_obj, remove_timezone) + delta = dt_obj - epoch + elif isinstance(dt_obj, datetime.date): + dt_obj = datetime.datetime.fromordinal(dt_obj.toordinal()) + delta = dt_obj - epoch + elif isinstance(dt_obj, datetime.time): + dt_obj = datetime.datetime.combine(epoch, dt_obj) + dt_obj = remove_datetime_timezone(dt_obj, remove_timezone) + delta = dt_obj - epoch + elif isinstance(dt_obj, datetime.timedelta): + is_timedelta = True + delta = dt_obj + else: + raise TypeError("Unknown or unsupported datetime type") + + # Convert a Python datetime.datetime value to an Excel date number. + excel_time = delta.days + ( + float(delta.seconds) + float(delta.microseconds) / 1e6 + ) / (60 * 60 * 24) + + # The following is a workaround for the fact that in Excel a time only + # value is represented as 1899-12-31+time whereas in datetime.datetime() + # it is 1900-1-1+time so we need to subtract the 1 day difference. + if isinstance(date_type, datetime.datetime) and dt_obj.isocalendar() == ( + 1900, + 1, + 1, + ): + excel_time -= 1 + + # Account for Excel erroneously treating 1900 as a leap year. + if not date_1904 and not is_timedelta and excel_time > 59: + excel_time += 1 + + return excel_time + + +def preserve_whitespace(string): + # Check if a string has leading or trailing whitespace that requires a + # "preserve" attribute. + if re_leading.search(string) or re_trailing.search(string): + return True + else: + return False diff --git a/billinglayer/python/xlsxwriter/vml.py b/billinglayer/python/xlsxwriter/vml.py new file mode 100644 index 0000000..868580c --- /dev/null +++ b/billinglayer/python/xlsxwriter/vml.py @@ -0,0 +1,720 @@ +############################################################################### +# +# Vml - A class for writing the Excel XLSX Vml file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class Vml(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Vml file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Vml, self).__init__() + + ########################################################################### + # + # Private API. + # + ########################################################################### + def _assemble_xml_file( + self, + data_id, + vml_shape_id, + comments_data=None, + buttons_data=None, + header_images_data=None, + ): + # Assemble and write the XML file. + z_index = 1 + + self._write_xml_namespace() + + # Write the o:shapelayout element. + self._write_shapelayout(data_id) + + if buttons_data: + # Write the v:shapetype element. + self._write_button_shapetype() + + for button in buttons_data: + # Write the v:shape element. + vml_shape_id += 1 + self._write_button_shape(vml_shape_id, z_index, button) + z_index += 1 + + if comments_data: + # Write the v:shapetype element. + self._write_comment_shapetype() + + for comment in comments_data: + # Write the v:shape element. + vml_shape_id += 1 + self._write_comment_shape(vml_shape_id, z_index, comment) + z_index += 1 + + if header_images_data: + # Write the v:shapetype element. + self._write_image_shapetype() + + index = 1 + for image in header_images_data: + # Write the v:shape element. + vml_shape_id += 1 + self._write_image_shape(vml_shape_id, index, image) + index += 1 + + self._xml_end_tag("xml") + + # Close the XML writer filehandle. + self._xml_close() + + def _pixels_to_points(self, vertices): + # Convert comment vertices from pixels to points. + + left, top, width, height = vertices[8:12] + + # Scale to pixels. + left *= 0.75 + top *= 0.75 + width *= 0.75 + height *= 0.75 + + return left, top, width, height + + ########################################################################### + # + # XML methods. + # + ########################################################################### + def _write_xml_namespace(self): + # Write the element. This is the root element of VML. + schema = "urn:schemas-microsoft-com:" + xmlns = schema + "vml" + xmlns_o = schema + "office:office" + xmlns_x = schema + "office:excel" + + attributes = [ + ("xmlns:v", xmlns), + ("xmlns:o", xmlns_o), + ("xmlns:x", xmlns_x), + ] + + self._xml_start_tag("xml", attributes) + + def _write_shapelayout(self, data_id): + # Write the element. + attributes = [("v:ext", "edit")] + + self._xml_start_tag("o:shapelayout", attributes) + + # Write the o:idmap element. + self._write_idmap(data_id) + + self._xml_end_tag("o:shapelayout") + + def _write_idmap(self, data_id): + # Write the element. + attributes = [ + ("v:ext", "edit"), + ("data", data_id), + ] + + self._xml_empty_tag("o:idmap", attributes) + + def _write_comment_shapetype(self): + # Write the element. + shape_id = "_x0000_t202" + coordsize = "21600,21600" + spt = 202 + path = "m,l,21600r21600,l21600,xe" + + attributes = [ + ("id", shape_id), + ("coordsize", coordsize), + ("o:spt", spt), + ("path", path), + ] + + self._xml_start_tag("v:shapetype", attributes) + + # Write the v:stroke element. + self._write_stroke() + + # Write the v:path element. + self._write_comment_path("t", "rect") + + self._xml_end_tag("v:shapetype") + + def _write_button_shapetype(self): + # Write the element. + shape_id = "_x0000_t201" + coordsize = "21600,21600" + spt = 201 + path = "m,l,21600r21600,l21600,xe" + + attributes = [ + ("id", shape_id), + ("coordsize", coordsize), + ("o:spt", spt), + ("path", path), + ] + + self._xml_start_tag("v:shapetype", attributes) + + # Write the v:stroke element. + self._write_stroke() + + # Write the v:path element. + self._write_button_path() + + # Write the o:lock element. + self._write_shapetype_lock() + + self._xml_end_tag("v:shapetype") + + def _write_image_shapetype(self): + # Write the element. + shape_id = "_x0000_t75" + coordsize = "21600,21600" + spt = 75 + o_preferrelative = "t" + path = "m@4@5l@4@11@9@11@9@5xe" + filled = "f" + stroked = "f" + + attributes = [ + ("id", shape_id), + ("coordsize", coordsize), + ("o:spt", spt), + ("o:preferrelative", o_preferrelative), + ("path", path), + ("filled", filled), + ("stroked", stroked), + ] + + self._xml_start_tag("v:shapetype", attributes) + + # Write the v:stroke element. + self._write_stroke() + + # Write the v:formulas element. + self._write_formulas() + + # Write the v:path element. + self._write_image_path() + + # Write the o:lock element. + self._write_aspect_ratio_lock() + + self._xml_end_tag("v:shapetype") + + def _write_stroke(self): + # Write the element. + joinstyle = "miter" + + attributes = [("joinstyle", joinstyle)] + + self._xml_empty_tag("v:stroke", attributes) + + def _write_comment_path(self, gradientshapeok, connecttype): + # Write the element. + attributes = [] + + if gradientshapeok: + attributes.append(("gradientshapeok", "t")) + + attributes.append(("o:connecttype", connecttype)) + + self._xml_empty_tag("v:path", attributes) + + def _write_button_path(self): + # Write the element. + shadowok = "f" + extrusionok = "f" + strokeok = "f" + fillok = "f" + connecttype = "rect" + + attributes = [ + ("shadowok", shadowok), + ("o:extrusionok", extrusionok), + ("strokeok", strokeok), + ("fillok", fillok), + ("o:connecttype", connecttype), + ] + + self._xml_empty_tag("v:path", attributes) + + def _write_image_path(self): + # Write the element. + extrusionok = "f" + gradientshapeok = "t" + connecttype = "rect" + + attributes = [ + ("o:extrusionok", extrusionok), + ("gradientshapeok", gradientshapeok), + ("o:connecttype", connecttype), + ] + + self._xml_empty_tag("v:path", attributes) + + def _write_shapetype_lock(self): + # Write the element. + ext = "edit" + shapetype = "t" + + attributes = [ + ("v:ext", ext), + ("shapetype", shapetype), + ] + + self._xml_empty_tag("o:lock", attributes) + + def _write_rotation_lock(self): + # Write the element. + ext = "edit" + rotation = "t" + + attributes = [ + ("v:ext", ext), + ("rotation", rotation), + ] + + self._xml_empty_tag("o:lock", attributes) + + def _write_aspect_ratio_lock(self): + # Write the element. + ext = "edit" + aspectratio = "t" + + attributes = [ + ("v:ext", ext), + ("aspectratio", aspectratio), + ] + + self._xml_empty_tag("o:lock", attributes) + + def _write_comment_shape(self, shape_id, z_index, comment): + # Write the element. + shape_type = "#_x0000_t202" + insetmode = "auto" + visibility = "hidden" + + # Set the shape index. + shape_id = "_x0000_s" + str(shape_id) + + # Get the comment parameters + row = comment[0] + col = comment[1] + visible = comment[4] + fillcolor = comment[5] + vertices = comment[9] + + (left, top, width, height) = self._pixels_to_points(vertices) + + # Set the visibility. + if visible: + visibility = "visible" + + style = ( + "position:absolute;" + "margin-left:%.15gpt;" + "margin-top:%.15gpt;" + "width:%.15gpt;" + "height:%.15gpt;" + "z-index:%d;" + "visibility:%s" % (left, top, width, height, z_index, visibility) + ) + + attributes = [ + ("id", shape_id), + ("type", shape_type), + ("style", style), + ("fillcolor", fillcolor), + ("o:insetmode", insetmode), + ] + + self._xml_start_tag("v:shape", attributes) + + # Write the v:fill element. + self._write_comment_fill() + + # Write the v:shadow element. + self._write_shadow() + + # Write the v:path element. + self._write_comment_path(None, "none") + + # Write the v:textbox element. + self._write_comment_textbox() + + # Write the x:ClientData element. + self._write_comment_client_data(row, col, visible, vertices) + + self._xml_end_tag("v:shape") + + def _write_button_shape(self, shape_id, z_index, button): + # Write the element. + shape_type = "#_x0000_t201" + + # Set the shape index. + shape_id = "_x0000_s" + str(shape_id) + + # Get the button parameters. + # row = button["_row"] + # col = button["_col"] + vertices = button["vertices"] + + (left, top, width, height) = self._pixels_to_points(vertices) + + style = ( + "position:absolute;" + "margin-left:%.15gpt;" + "margin-top:%.15gpt;" + "width:%.15gpt;" + "height:%.15gpt;" + "z-index:%d;" + "mso-wrap-style:tight" % (left, top, width, height, z_index) + ) + + attributes = [ + ("id", shape_id), + ("type", shape_type), + ] + + if button.get("description"): + attributes.append(("alt", button["description"])) + + attributes.append(("style", style)) + attributes.append(("o:button", "t")) + attributes.append(("fillcolor", "buttonFace [67]")) + attributes.append(("strokecolor", "windowText [64]")) + attributes.append(("o:insetmode", "auto")) + + self._xml_start_tag("v:shape", attributes) + + # Write the v:fill element. + self._write_button_fill() + + # Write the o:lock element. + self._write_rotation_lock() + + # Write the v:textbox element. + self._write_button_textbox(button["font"]) + + # Write the x:ClientData element. + self._write_button_client_data(button) + + self._xml_end_tag("v:shape") + + def _write_image_shape(self, shape_id, z_index, image_data): + # Write the element. + shape_type = "#_x0000_t75" + + # Set the shape index. + shape_id = "_x0000_s" + str(shape_id) + + # Get the image parameters + width = image_data[0] + height = image_data[1] + name = image_data[2] + position = image_data[3] + x_dpi = image_data[4] + y_dpi = image_data[5] + ref_id = image_data[6] + + # Scale the height/width by the resolution, relative to 72dpi. + width = width * 72.0 / x_dpi + height = height * 72.0 / y_dpi + + # Excel uses a rounding based around 72 and 96 dpi. + width = 72.0 / 96 * int(width * 96.0 / 72 + 0.25) + height = 72.0 / 96 * int(height * 96.0 / 72 + 0.25) + + style = ( + "position:absolute;" + "margin-left:0;" + "margin-top:0;" + "width:%.15gpt;" + "height:%.15gpt;" + "z-index:%d" % (width, height, z_index) + ) + + attributes = [ + ("id", position), + ("o:spid", shape_id), + ("type", shape_type), + ("style", style), + ] + + self._xml_start_tag("v:shape", attributes) + + # Write the v:imagedata element. + self._write_imagedata(ref_id, name) + + # Write the o:lock element. + self._write_rotation_lock() + + self._xml_end_tag("v:shape") + + def _write_comment_fill(self): + # Write the element. + color_2 = "#ffffe1" + + attributes = [("color2", color_2)] + + self._xml_empty_tag("v:fill", attributes) + + def _write_button_fill(self): + # Write the element. + color_2 = "buttonFace [67]" + detectmouseclick = "t" + + attributes = [ + ("color2", color_2), + ("o:detectmouseclick", detectmouseclick), + ] + + self._xml_empty_tag("v:fill", attributes) + + def _write_shadow(self): + # Write the element. + on = "t" + color = "black" + obscured = "t" + + attributes = [ + ("on", on), + ("color", color), + ("obscured", obscured), + ] + + self._xml_empty_tag("v:shadow", attributes) + + def _write_comment_textbox(self): + # Write the element. + style = "mso-direction-alt:auto" + + attributes = [("style", style)] + + self._xml_start_tag("v:textbox", attributes) + + # Write the div element. + self._write_div("left") + + self._xml_end_tag("v:textbox") + + def _write_button_textbox(self, font): + # Write the element. + style = "mso-direction-alt:auto" + + attributes = [("style", style), ("o:singleclick", "f")] + + self._xml_start_tag("v:textbox", attributes) + + # Write the div element. + self._write_div("center", font) + + self._xml_end_tag("v:textbox") + + def _write_div(self, align, font=None): + # Write the
element. + + style = "text-align:" + align + + attributes = [("style", style)] + + self._xml_start_tag("div", attributes) + + if font: + # Write the font element. + self._write_font(font) + + self._xml_end_tag("div") + + def _write_font(self, font): + # Write the element. + caption = font["caption"] + face = "Calibri" + size = 220 + color = "#000000" + + attributes = [ + ("face", face), + ("size", size), + ("color", color), + ] + + self._xml_data_element("font", caption, attributes) + + def _write_comment_client_data(self, row, col, visible, vertices): + # Write the element. + object_type = "Note" + + attributes = [("ObjectType", object_type)] + + self._xml_start_tag("x:ClientData", attributes) + + # Write the x:MoveWithCells element. + self._write_move_with_cells() + + # Write the x:SizeWithCells element. + self._write_size_with_cells() + + # Write the x:Anchor element. + self._write_anchor(vertices) + + # Write the x:AutoFill element. + self._write_auto_fill() + + # Write the x:Row element. + self._write_row(row) + + # Write the x:Column element. + self._write_column(col) + + # Write the x:Visible element. + if visible: + self._write_visible() + + self._xml_end_tag("x:ClientData") + + def _write_button_client_data(self, button): + # Write the element. + macro = button["macro"] + vertices = button["vertices"] + + object_type = "Button" + + attributes = [("ObjectType", object_type)] + + self._xml_start_tag("x:ClientData", attributes) + + # Write the x:Anchor element. + self._write_anchor(vertices) + + # Write the x:PrintObject element. + self._write_print_object() + + # Write the x:AutoFill element. + self._write_auto_fill() + + # Write the x:FmlaMacro element. + self._write_fmla_macro(macro) + + # Write the x:TextHAlign element. + self._write_text_halign() + + # Write the x:TextVAlign element. + self._write_text_valign() + + self._xml_end_tag("x:ClientData") + + def _write_move_with_cells(self): + # Write the element. + self._xml_empty_tag("x:MoveWithCells") + + def _write_size_with_cells(self): + # Write the element. + self._xml_empty_tag("x:SizeWithCells") + + def _write_visible(self): + # Write the element. + self._xml_empty_tag("x:Visible") + + def _write_anchor(self, vertices): + # Write the element. + (col_start, row_start, x1, y1, col_end, row_end, x2, y2) = vertices[:8] + + strings = [col_start, x1, row_start, y1, col_end, x2, row_end, y2] + strings = [str(i) for i in strings] + + data = ", ".join(strings) + + self._xml_data_element("x:Anchor", data) + + def _write_auto_fill(self): + # Write the element. + data = "False" + + self._xml_data_element("x:AutoFill", data) + + def _write_row(self, data): + # Write the element. + self._xml_data_element("x:Row", data) + + def _write_column(self, data): + # Write the element. + self._xml_data_element("x:Column", data) + + def _write_print_object(self): + # Write the element. + self._xml_data_element("x:PrintObject", "False") + + def _write_text_halign(self): + # Write the element. + self._xml_data_element("x:TextHAlign", "Center") + + def _write_text_valign(self): + # Write the element. + self._xml_data_element("x:TextVAlign", "Center") + + def _write_fmla_macro(self, data): + # Write the element. + self._xml_data_element("x:FmlaMacro", data) + + def _write_imagedata(self, ref_id, o_title): + # Write the element. + attributes = [ + ("o:relid", "rId" + str(ref_id)), + ("o:title", o_title), + ] + + self._xml_empty_tag("v:imagedata", attributes) + + def _write_formulas(self): + # Write the element. + self._xml_start_tag("v:formulas") + + # Write the v:f elements. + self._write_formula("if lineDrawn pixelLineWidth 0") + self._write_formula("sum @0 1 0") + self._write_formula("sum 0 0 @1") + self._write_formula("prod @2 1 2") + self._write_formula("prod @3 21600 pixelWidth") + self._write_formula("prod @3 21600 pixelHeight") + self._write_formula("sum @0 0 1") + self._write_formula("prod @6 1 2") + self._write_formula("prod @7 21600 pixelWidth") + self._write_formula("sum @8 21600 0") + self._write_formula("prod @7 21600 pixelHeight") + self._write_formula("sum @10 21600 0") + + self._xml_end_tag("v:formulas") + + def _write_formula(self, eqn): + # Write the element. + attributes = [("eqn", eqn)] + + self._xml_empty_tag("v:f", attributes) diff --git a/billinglayer/python/xlsxwriter/workbook.py b/billinglayer/python/xlsxwriter/workbook.py new file mode 100644 index 0000000..06eee09 --- /dev/null +++ b/billinglayer/python/xlsxwriter/workbook.py @@ -0,0 +1,1968 @@ +############################################################################### +# +# Workbook - A class for writing the Excel XLSX Workbook file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import hashlib +import operator +import os +import re +import time +from datetime import datetime +from decimal import Decimal +from fractions import Fraction +from struct import unpack +from warnings import warn +from zipfile import ZipFile, ZipInfo, ZIP_DEFLATED, LargeZipFile + + +# Package imports. +from . import xmlwriter +from .worksheet import Worksheet +from .chartsheet import Chartsheet +from .sharedstrings import SharedStringTable +from .format import Format +from .packager import Packager +from .utility import xl_cell_to_rowcol +from .chart_area import ChartArea +from .chart_bar import ChartBar +from .chart_column import ChartColumn +from .chart_doughnut import ChartDoughnut +from .chart_line import ChartLine +from .chart_pie import ChartPie +from .chart_radar import ChartRadar +from .chart_scatter import ChartScatter +from .chart_stock import ChartStock +from .exceptions import InvalidWorksheetName +from .exceptions import DuplicateWorksheetName +from .exceptions import UndefinedImageSize +from .exceptions import UnsupportedImageFormat +from .exceptions import FileCreateError +from .exceptions import FileSizeError + + +class Workbook(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Workbook file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + chartsheet_class = Chartsheet + worksheet_class = Worksheet + + def __init__(self, filename=None, options=None): + """ + Constructor. + + """ + if options is None: + options = {} + + super(Workbook, self).__init__() + + self.filename = filename + + self.tmpdir = options.get("tmpdir", None) + self.date_1904 = options.get("date_1904", False) + self.strings_to_numbers = options.get("strings_to_numbers", False) + self.strings_to_formulas = options.get("strings_to_formulas", True) + self.strings_to_urls = options.get("strings_to_urls", True) + self.nan_inf_to_errors = options.get("nan_inf_to_errors", False) + self.default_date_format = options.get("default_date_format", None) + self.constant_memory = options.get("constant_memory", False) + self.in_memory = options.get("in_memory", False) + self.excel2003_style = options.get("excel2003_style", False) + self.remove_timezone = options.get("remove_timezone", False) + self.use_future_functions = options.get("use_future_functions", False) + self.default_format_properties = options.get("default_format_properties", {}) + + self.max_url_length = options.get("max_url_length", 2079) + if self.max_url_length < 255: + self.max_url_length = 2079 + + if options.get("use_zip64"): + self.allow_zip64 = True + else: + self.allow_zip64 = False + + self.worksheet_meta = WorksheetMeta() + self.selected = 0 + self.fileclosed = 0 + self.filehandle = None + self.internal_fh = 0 + self.sheet_name = "Sheet" + self.chart_name = "Chart" + self.sheetname_count = 0 + self.chartname_count = 0 + self.worksheets_objs = [] + self.charts = [] + self.drawings = [] + self.sheetnames = {} + self.formats = [] + self.xf_formats = [] + self.xf_format_indices = {} + self.dxf_formats = [] + self.dxf_format_indices = {} + self.palette = [] + self.font_count = 0 + self.num_formats = [] + self.defined_names = [] + self.named_ranges = [] + self.custom_colors = [] + self.doc_properties = {} + self.custom_properties = [] + self.createtime = datetime.utcnow() + self.num_vml_files = 0 + self.num_comment_files = 0 + self.x_window = 240 + self.y_window = 15 + self.window_width = 16095 + self.window_height = 9660 + self.tab_ratio = 600 + self.str_table = SharedStringTable() + self.vba_project = None + self.vba_is_stream = False + self.vba_codename = None + self.image_types = {} + self.images = [] + self.border_count = 0 + self.fill_count = 0 + self.drawing_count = 0 + self.calc_mode = "auto" + self.calc_on_load = True + self.calc_id = 124519 + self.has_comments = False + self.read_only = 0 + self.has_metadata = False + + # We can't do 'constant_memory' mode while doing 'in_memory' mode. + if self.in_memory: + self.constant_memory = False + + # Add the default cell format. + if self.excel2003_style: + self.add_format({"xf_index": 0, "font_family": 0}) + else: + self.add_format({"xf_index": 0}) + + # Add a default URL format. + self.default_url_format = self.add_format({"hyperlink": True}) + + # Add the default date format. + if self.default_date_format is not None: + self.default_date_format = self.add_format( + {"num_format": self.default_date_format} + ) + + def __enter__(self): + """Return self object to use with "with" statement.""" + return self + + def __exit__(self, type, value, traceback): + """Close workbook when exiting "with" statement.""" + self.close() + + def add_worksheet(self, name=None, worksheet_class=None): + """ + Add a new worksheet to the Excel workbook. + + Args: + name: The worksheet name. Defaults to 'Sheet1', etc. + + Returns: + Reference to a worksheet object. + + """ + if worksheet_class is None: + worksheet_class = self.worksheet_class + + return self._add_sheet(name, worksheet_class=worksheet_class) + + def add_chartsheet(self, name=None, chartsheet_class=None): + """ + Add a new chartsheet to the Excel workbook. + + Args: + name: The chartsheet name. Defaults to 'Sheet1', etc. + + Returns: + Reference to a chartsheet object. + + """ + if chartsheet_class is None: + chartsheet_class = self.chartsheet_class + + return self._add_sheet(name, worksheet_class=chartsheet_class) + + def add_format(self, properties=None): + """ + Add a new Format to the Excel Workbook. + + Args: + properties: The format properties. + + Returns: + Reference to a Format object. + + """ + format_properties = self.default_format_properties.copy() + + if self.excel2003_style: + format_properties = {"font_name": "Arial", "font_size": 10, "theme": 1 * -1} + + if properties: + format_properties.update(properties) + + xf_format = Format( + format_properties, self.xf_format_indices, self.dxf_format_indices + ) + + # Store the format reference. + self.formats.append(xf_format) + + return xf_format + + def add_chart(self, options): + """ + Create a chart object. + + Args: + options: The chart type and subtype options. + + Returns: + Reference to a Chart object. + + """ + + # Type must be specified so we can create the required chart instance. + chart_type = options.get("type") + if chart_type is None: + warn("Chart type must be defined in add_chart()") + return + + if chart_type == "area": + chart = ChartArea(options) + elif chart_type == "bar": + chart = ChartBar(options) + elif chart_type == "column": + chart = ChartColumn(options) + elif chart_type == "doughnut": + chart = ChartDoughnut(options) + elif chart_type == "line": + chart = ChartLine(options) + elif chart_type == "pie": + chart = ChartPie(options) + elif chart_type == "radar": + chart = ChartRadar(options) + elif chart_type == "scatter": + chart = ChartScatter(options) + elif chart_type == "stock": + chart = ChartStock(options) + else: + warn("Unknown chart type '%s' in add_chart()" % chart_type) + return + + # Set the embedded chart name if present. + if "name" in options: + chart.chart_name = options["name"] + + chart.embedded = True + chart.date_1904 = self.date_1904 + chart.remove_timezone = self.remove_timezone + + self.charts.append(chart) + + return chart + + def add_vba_project(self, vba_project, is_stream=False): + """ + Add a vbaProject binary to the Excel workbook. + + Args: + vba_project: The vbaProject binary file name. + is_stream: vba_project is an in memory byte stream. + + Returns: + Nothing. + + """ + if not is_stream and not os.path.exists(vba_project): + warn("VBA project binary file '%s' not found." % vba_project) + return -1 + + if self.vba_codename is None: + self.vba_codename = "ThisWorkbook" + + self.vba_project = vba_project + self.vba_is_stream = is_stream + + def close(self): + """ + Call finalization code and close file. + + Args: + None. + + Returns: + Nothing. + + """ + if not self.fileclosed: + try: + self._store_workbook() + except IOError as e: + raise FileCreateError(e) + except LargeZipFile: + raise FileSizeError( + "Filesize would require ZIP64 extensions. " + "Use workbook.use_zip64()." + ) + + self.fileclosed = True + + # Ensure all constant_memory temp files are closed. + if self.constant_memory: + for worksheet in self.worksheets(): + worksheet._opt_close() + + else: + warn("Calling close() on already closed file.") + + def set_size(self, width, height): + """ + Set the size of a workbook window. + + Args: + width: Width of the window in pixels. + height: Height of the window in pixels. + + Returns: + Nothing. + + """ + # Convert the width/height to twips at 96 dpi. + if width: + self.window_width = int(width * 1440 / 96) + else: + self.window_width = 16095 + + if height: + self.window_height = int(height * 1440 / 96) + else: + self.window_height = 9660 + + def set_tab_ratio(self, tab_ratio=None): + """ + Set the ratio between worksheet tabs and the horizontal slider. + + Args: + tab_ratio: The tab ratio, 0 <= tab_ratio <= 100 + + Returns: + Nothing. + + """ + if tab_ratio is None: + return + + if tab_ratio < 0 or tab_ratio > 100: + warn("Tab ratio '%d' outside: 0 <= tab_ratio <= 100" % tab_ratio) + else: + self.tab_ratio = int(tab_ratio * 10) + + def set_properties(self, properties): + """ + Set the document properties such as Title, Author etc. + + Args: + properties: Dictionary of document properties. + + Returns: + Nothing. + + """ + self.doc_properties = properties + + def set_custom_property(self, name, value, property_type=None): + """ + Set a custom document property. + + Args: + name: The name of the custom property. + value: The value of the custom property. + property_type: The type of the custom property. Optional. + + Returns: + Nothing. + + """ + if name is None or value is None: + warn( + "The name and value parameters must be non-None in " + "set_custom_property()" + ) + return -1 + + if property_type is None: + # Determine the property type from the Python type. + if isinstance(value, bool): + property_type = "bool" + elif isinstance(value, datetime): + property_type = "date" + elif isinstance(value, int): + property_type = "number_int" + elif isinstance(value, (float, int, Decimal, Fraction)): + property_type = "number" + else: + property_type = "text" + + if property_type == "date": + value = value.strftime("%Y-%m-%dT%H:%M:%SZ") + + if property_type == "text" and len(value) > 255: + warn( + "Length of 'value' parameter exceeds Excel's limit of 255 " + "characters in set_custom_property(): '%s'" % value + ) + + if len(name) > 255: + warn( + "Length of 'name' parameter exceeds Excel's limit of 255 " + "characters in set_custom_property(): '%s'" % name + ) + + self.custom_properties.append((name, value, property_type)) + + def set_calc_mode(self, mode, calc_id=None): + """ + Set the Excel calculation mode for the workbook. + + Args: + mode: String containing one of: + * manual + * auto_except_tables + * auto + + Returns: + Nothing. + + """ + self.calc_mode = mode + + if mode == "manual": + self.calc_on_load = False + elif mode == "auto_except_tables": + self.calc_mode = "autoNoTable" + + # Leave undocumented for now. Rarely required. + if calc_id: + self.calc_id = calc_id + + def define_name(self, name, formula): + # Create a defined name in Excel. We handle global/workbook level + # names and local/worksheet names. + """ + Create a defined name in the workbook. + + Args: + name: The defined name. + formula: The cell or range that the defined name refers to. + + Returns: + Nothing. + + """ + sheet_index = None + sheetname = "" + + # Remove the = sign from the formula if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + # Local defined names are formatted like "Sheet1!name". + sheet_parts = re.compile(r"^([^!]+)!([^!]+)$") + match = sheet_parts.match(name) + + if match: + sheetname = match.group(1) + name = match.group(2) + sheet_index = self._get_sheet_index(sheetname) + + # Warn if the sheet index wasn't found. + if sheet_index is None: + warn("Unknown sheet name '%s' in defined_name()" % sheetname) + return -1 + else: + # Use -1 to indicate global names. + sheet_index = -1 + + # Warn if the defined name contains invalid chars as defined by Excel. + if not re.match(r"^[\w\\][\w\\.]*$", name, re.UNICODE) or re.match( + r"^\d", name + ): + warn("Invalid Excel characters in defined_name(): '%s'" % name) + return -1 + + # Warn if the defined name looks like a cell name. + if re.match(r"^[a-zA-Z][a-zA-Z]?[a-dA-D]?\d+$", name): + warn("Name looks like a cell name in defined_name(): '%s'" % name) + return -1 + + # Warn if the name looks like a R1C1 cell reference. + if re.match(r"^[rcRC]$", name) or re.match(r"^[rcRC]\d+[rcRC]\d+$", name): + warn("Invalid name '%s' like a RC cell ref in defined_name()" % name) + return -1 + + self.defined_names.append([name, sheet_index, formula, False]) + + def worksheets(self): + """ + Return a list of the worksheet objects in the workbook. + + Args: + None. + + Returns: + A list of worksheet objects. + + """ + return self.worksheets_objs + + def get_worksheet_by_name(self, name): + """ + Return a worksheet object in the workbook using the sheetname. + + Args: + name: The name of the worksheet. + + Returns: + A worksheet object or None. + + """ + return self.sheetnames.get(name) + + def get_default_url_format(self): + """ + Get the default url format used when a user defined format isn't + specified with write_url(). The format is the hyperlink style defined + by Excel for the default theme. + + Args: + None. + + Returns: + A format object. + + """ + return self.default_url_format + + def use_zip64(self): + """ + Allow ZIP64 extensions when writing xlsx file zip container. + + Args: + None. + + Returns: + Nothing. + + """ + self.allow_zip64 = True + + def set_vba_name(self, name=None): + """ + Set the VBA name for the workbook. By default the workbook is referred + to as ThisWorkbook in VBA. + + Args: + name: The VBA name for the workbook. + + Returns: + Nothing. + + """ + if name is not None: + self.vba_codename = name + else: + self.vba_codename = "ThisWorkbook" + + def read_only_recommended(self): + """ + Set the Excel "Read-only recommended" option when saving a file. + + Args: + None. + + Returns: + Nothing. + + """ + self.read_only = 2 + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Prepare format object for passing to Style.pm. + self._prepare_format_properties() + + # Write the XML declaration. + self._xml_declaration() + + # Write the workbook element. + self._write_workbook() + + # Write the fileVersion element. + self._write_file_version() + + # Write the fileSharing element. + self._write_file_sharing() + + # Write the workbookPr element. + self._write_workbook_pr() + + # Write the bookViews element. + self._write_book_views() + + # Write the sheets element. + self._write_sheets() + + # Write the workbook defined names. + self._write_defined_names() + + # Write the calcPr element. + self._write_calc_pr() + + # Close the workbook tag. + self._xml_end_tag("workbook") + + # Close the file. + self._xml_close() + + def _store_workbook(self): + # Create the xlsx/zip file. + try: + xlsx_file = ZipFile( + self.filename, + "w", + compression=ZIP_DEFLATED, + allowZip64=self.allow_zip64, + ) + except IOError as e: + raise e + + # Assemble worksheets into a workbook. + packager = self._get_packager() + + # Add a default worksheet if non have been added. + if not self.worksheets(): + self.add_worksheet() + + # Ensure that at least one worksheet has been selected. + if self.worksheet_meta.activesheet == 0: + self.worksheets_objs[0].selected = 1 + self.worksheets_objs[0].hidden = 0 + + # Set the active sheet. + for sheet in self.worksheets(): + if sheet.index == self.worksheet_meta.activesheet: + sheet.active = 1 + + # Set the sheet vba_codename the workbook has a vbaProject binary. + if self.vba_project: + for sheet in self.worksheets(): + if sheet.vba_codename is None: + sheet.set_vba_name() + + # Convert the SST strings data structure. + self._prepare_sst_string_data() + + # Prepare the worksheet VML elements such as comments and buttons. + self._prepare_vml() + + # Set the defined names for the worksheets such as Print Titles. + self._prepare_defined_names() + + # Prepare the drawings, charts and images. + self._prepare_drawings() + + # Add cached data to charts. + self._add_chart_data() + + # Prepare the worksheet tables. + self._prepare_tables() + + # Prepare the metadata file links. + self._prepare_metadata() + + # Package the workbook. + packager._add_workbook(self) + packager._set_tmpdir(self.tmpdir) + packager._set_in_memory(self.in_memory) + xml_files = packager._create_package() + + # Free up the Packager object. + packager = None + + # Add XML sub-files to the Zip file with their Excel filename. + for file_id, file_data in enumerate(xml_files): + os_filename, xml_filename, is_binary = file_data + + if self.in_memory: + # Set sub-file timestamp to Excel's timestamp of 1/1/1980. + zipinfo = ZipInfo(xml_filename, (1980, 1, 1, 0, 0, 0)) + + # Copy compression type from parent ZipFile. + zipinfo.compress_type = xlsx_file.compression + + if is_binary: + xlsx_file.writestr(zipinfo, os_filename.getvalue()) + else: + xlsx_file.writestr(zipinfo, os_filename.getvalue().encode("utf-8")) + else: + # The sub-files are tempfiles on disk, i.e, not in memory. + + # Set sub-file timestamp to 31/1/1980 due to portability + # issues setting it to Excel's timestamp of 1/1/1980. + timestamp = time.mktime((1980, 1, 31, 0, 0, 0, 0, 0, -1)) + os.utime(os_filename, (timestamp, timestamp)) + + try: + xlsx_file.write(os_filename, xml_filename) + os.remove(os_filename) + except LargeZipFile as e: + # Close open temp files on zipfile.LargeZipFile exception. + for i in range(file_id, len(xml_files) - 1): + os.remove(xml_files[i][0]) + raise e + + xlsx_file.close() + + def _add_sheet(self, name, worksheet_class=None): + # Utility for shared code in add_worksheet() and add_chartsheet(). + + if worksheet_class: + worksheet = worksheet_class() + else: + worksheet = self.worksheet_class() + + sheet_index = len(self.worksheets_objs) + name = self._check_sheetname(name, isinstance(worksheet, Chartsheet)) + + # Initialization data to pass to the worksheet. + init_data = { + "name": name, + "index": sheet_index, + "str_table": self.str_table, + "worksheet_meta": self.worksheet_meta, + "constant_memory": self.constant_memory, + "tmpdir": self.tmpdir, + "date_1904": self.date_1904, + "strings_to_numbers": self.strings_to_numbers, + "strings_to_formulas": self.strings_to_formulas, + "strings_to_urls": self.strings_to_urls, + "nan_inf_to_errors": self.nan_inf_to_errors, + "default_date_format": self.default_date_format, + "default_url_format": self.default_url_format, + "excel2003_style": self.excel2003_style, + "remove_timezone": self.remove_timezone, + "max_url_length": self.max_url_length, + "use_future_functions": self.use_future_functions, + } + + worksheet._initialize(init_data) + + self.worksheets_objs.append(worksheet) + self.sheetnames[name] = worksheet + + return worksheet + + def _check_sheetname(self, sheetname, is_chartsheet=False): + # Check for valid worksheet names. We check the length, if it contains + # any invalid chars and if the sheetname is unique in the workbook. + invalid_char = re.compile(r"[\[\]:*?/\\]") + + # Increment the Sheet/Chart number used for default sheet names below. + if is_chartsheet: + self.chartname_count += 1 + else: + self.sheetname_count += 1 + + # Supply default Sheet/Chart sheetname if none has been defined. + if sheetname is None or sheetname == "": + if is_chartsheet: + sheetname = self.chart_name + str(self.chartname_count) + else: + sheetname = self.sheet_name + str(self.sheetname_count) + + # Check that sheet sheetname is <= 31. Excel limit. + if len(sheetname) > 31: + raise InvalidWorksheetName( + "Excel worksheet name '%s' must be <= 31 chars." % sheetname + ) + + # Check that sheetname doesn't contain any invalid characters. + if invalid_char.search(sheetname): + raise InvalidWorksheetName( + "Invalid Excel character '[]:*?/\\' in sheetname '%s'." % sheetname + ) + + # Check that sheetname doesn't start or end with an apostrophe. + if sheetname.startswith("'") or sheetname.endswith("'"): + raise InvalidWorksheetName( + 'Sheet name cannot start or end with an apostrophe "%s".' % sheetname + ) + + # Check that the worksheet name doesn't already exist since this is a + # fatal Excel error. The check must be case insensitive like Excel. + for worksheet in self.worksheets(): + if sheetname.lower() == worksheet.name.lower(): + raise DuplicateWorksheetName( + "Sheetname '%s', with case ignored, is already in use." % sheetname + ) + + return sheetname + + def _prepare_format_properties(self): + # Prepare all Format properties prior to passing them to styles.py. + + # Separate format objects into XF and DXF formats. + self._prepare_formats() + + # Set the font index for the format objects. + self._prepare_fonts() + + # Set the number format index for the format objects. + self._prepare_num_formats() + + # Set the border index for the format objects. + self._prepare_borders() + + # Set the fill index for the format objects. + self._prepare_fills() + + def _prepare_formats(self): + # Iterate through the XF Format objects and separate them into + # XF and DXF formats. The XF and DF formats then need to be sorted + # back into index order rather than creation order. + xf_formats = [] + dxf_formats = [] + + # Sort into XF and DXF formats. + for xf_format in self.formats: + if xf_format.xf_index is not None: + xf_formats.append(xf_format) + + if xf_format.dxf_index is not None: + dxf_formats.append(xf_format) + + # Pre-extend the format lists. + self.xf_formats = [None] * len(xf_formats) + self.dxf_formats = [None] * len(dxf_formats) + + # Rearrange formats into index order. + for xf_format in xf_formats: + index = xf_format.xf_index + self.xf_formats[index] = xf_format + + for dxf_format in dxf_formats: + index = dxf_format.dxf_index + self.dxf_formats[index] = dxf_format + + def _set_default_xf_indices(self): + # Set the default index for each format. Only used for testing. + + formats = list(self.formats) + + # Delete the default url format. + del formats[1] + + # Skip the default date format if set. + if self.default_date_format is not None: + del formats[1] + + # Set the remaining formats. + for xf_format in formats: + xf_format._get_xf_index() + + def _prepare_fonts(self): + # Iterate through the XF Format objects and give them an index to + # non-default font elements. + fonts = {} + index = 0 + + for xf_format in self.xf_formats: + key = xf_format._get_font_key() + if key in fonts: + # Font has already been used. + xf_format.font_index = fonts[key] + xf_format.has_font = 0 + else: + # This is a new font. + fonts[key] = index + xf_format.font_index = index + xf_format.has_font = 1 + index += 1 + + self.font_count = index + + # For DXF formats we only need to check if the properties have changed. + for xf_format in self.dxf_formats: + # The only font properties that can change for a DXF format are: + # color, bold, italic, underline and strikethrough. + if ( + xf_format.font_color + or xf_format.bold + or xf_format.italic + or xf_format.underline + or xf_format.font_strikeout + ): + xf_format.has_dxf_font = 1 + + def _prepare_num_formats(self): + # User defined records in Excel start from index 0xA4. + unique_num_formats = {} + num_formats = [] + index = 164 + + for xf_format in self.xf_formats + self.dxf_formats: + num_format = xf_format.num_format + + # Check if num_format is an index to a built-in number format. + if not isinstance(num_format, str): + num_format = int(num_format) + + # Number format '0' is indexed as 1 in Excel. + if num_format == 0: + num_format = 1 + + xf_format.num_format_index = num_format + continue + elif num_format == "0": + # Number format '0' is indexed as 1 in Excel. + xf_format.num_format_index = 1 + continue + elif num_format == "General": + # The 'General' format has an number format index of 0. + xf_format.num_format_index = 0 + continue + + if num_format in unique_num_formats: + # Number xf_format has already been used. + xf_format.num_format_index = unique_num_formats[num_format] + else: + # Add a new number xf_format. + unique_num_formats[num_format] = index + xf_format.num_format_index = index + index += 1 + + # Only increase font count for XF formats (not DXF formats). + if xf_format.xf_index: + num_formats.append(num_format) + + self.num_formats = num_formats + + def _prepare_borders(self): + # Iterate through the XF Format objects and give them an index to + # non-default border elements. + borders = {} + index = 0 + + for xf_format in self.xf_formats: + key = xf_format._get_border_key() + + if key in borders: + # Border has already been used. + xf_format.border_index = borders[key] + xf_format.has_border = 0 + else: + # This is a new border. + borders[key] = index + xf_format.border_index = index + xf_format.has_border = 1 + index += 1 + + self.border_count = index + + # For DXF formats we only need to check if the properties have changed. + has_border = re.compile(r"[^0:]") + + for xf_format in self.dxf_formats: + key = xf_format._get_border_key() + + if has_border.search(key): + xf_format.has_dxf_border = 1 + + def _prepare_fills(self): + # Iterate through the XF Format objects and give them an index to + # non-default fill elements. + # The user defined fill properties start from 2 since there are 2 + # default fills: patternType="none" and patternType="gray125". + fills = {} + index = 2 # Start from 2. See above. + + # Add the default fills. + fills["0:0:0"] = 0 + fills["17:0:0"] = 1 + + # Store the DXF colors separately since them may be reversed below. + for xf_format in self.dxf_formats: + if xf_format.pattern or xf_format.bg_color or xf_format.fg_color: + xf_format.has_dxf_fill = 1 + xf_format.dxf_bg_color = xf_format.bg_color + xf_format.dxf_fg_color = xf_format.fg_color + + for xf_format in self.xf_formats: + # The following logical statements jointly take care of special + # cases in relation to cell colors and patterns: + # 1. For a solid fill (_pattern == 1) Excel reverses the role of + # foreground and background colors, and + # 2. If the user specifies a foreground or background color + # without a pattern they probably wanted a solid fill, so we fill + # in the defaults. + if ( + xf_format.pattern == 1 + and xf_format.bg_color != 0 + and xf_format.fg_color != 0 + ): + tmp = xf_format.fg_color + xf_format.fg_color = xf_format.bg_color + xf_format.bg_color = tmp + + if ( + xf_format.pattern <= 1 + and xf_format.bg_color != 0 + and xf_format.fg_color == 0 + ): + xf_format.fg_color = xf_format.bg_color + xf_format.bg_color = 0 + xf_format.pattern = 1 + + if ( + xf_format.pattern <= 1 + and xf_format.bg_color == 0 + and xf_format.fg_color != 0 + ): + xf_format.pattern = 1 + + key = xf_format._get_fill_key() + + if key in fills: + # Fill has already been used. + xf_format.fill_index = fills[key] + xf_format.has_fill = 0 + else: + # This is a new fill. + fills[key] = index + xf_format.fill_index = index + xf_format.has_fill = 1 + index += 1 + + self.fill_count = index + + def _prepare_defined_names(self): + # Iterate through the worksheets and store any defined names in + # addition to any user defined names. Stores the defined names + # for the Workbook.xml and the named ranges for App.xml. + defined_names = self.defined_names + + for sheet in self.worksheets(): + # Check for Print Area settings. + if sheet.autofilter_area: + hidden = 1 + sheet_range = sheet.autofilter_area + # Store the defined names. + defined_names.append( + ["_xlnm._FilterDatabase", sheet.index, sheet_range, hidden] + ) + + # Check for Print Area settings. + if sheet.print_area_range: + hidden = 0 + sheet_range = sheet.print_area_range + # Store the defined names. + defined_names.append( + ["_xlnm.Print_Area", sheet.index, sheet_range, hidden] + ) + + # Check for repeat rows/cols referred to as Print Titles. + if sheet.repeat_col_range or sheet.repeat_row_range: + hidden = 0 + sheet_range = "" + if sheet.repeat_col_range and sheet.repeat_row_range: + sheet_range = sheet.repeat_col_range + "," + sheet.repeat_row_range + else: + sheet_range = sheet.repeat_col_range + sheet.repeat_row_range + # Store the defined names. + defined_names.append( + ["_xlnm.Print_Titles", sheet.index, sheet_range, hidden] + ) + + defined_names = self._sort_defined_names(defined_names) + self.defined_names = defined_names + self.named_ranges = self._extract_named_ranges(defined_names) + + def _sort_defined_names(self, names): + # Sort the list of list of internal and user defined names in + # the same order as used by Excel. + + # Add a normalize name string to each list for sorting. + for name_list in names: + (defined_name, _, sheet_name, _) = name_list + + # Normalize the defined name by removing any leading '_xmln.' + # from internal names and lowercasing the string. + defined_name = defined_name.replace("_xlnm.", "").lower() + + # Normalize the sheetname by removing the leading quote and + # lowercasing the string. + sheet_name = sheet_name.lstrip("'").lower() + + name_list.append(defined_name + "::" + sheet_name) + + # Sort based on the normalized key. + names.sort(key=operator.itemgetter(4)) + + # Remove the extra key used for sorting. + for name_list in names: + name_list.pop() + + return names + + def _prepare_drawings(self): + # Iterate through the worksheets and set up chart and image drawings. + chart_ref_id = 0 + image_ref_id = 0 + ref_id = 0 + drawing_id = 0 + image_ids = {} + header_image_ids = {} + background_ids = {} + + for sheet in self.worksheets(): + chart_count = len(sheet.charts) + image_count = len(sheet.images) + shape_count = len(sheet.shapes) + + header_image_count = len(sheet.header_images) + footer_image_count = len(sheet.footer_images) + has_background = sheet.background_image + has_drawing = False + + if not ( + chart_count + or image_count + or shape_count + or header_image_count + or footer_image_count + or has_background + ): + continue + + # Don't increase the drawing_id header/footer images. + if chart_count or image_count or shape_count: + drawing_id += 1 + has_drawing = True + + # Prepare the background images. + if sheet.background_image: + if sheet.background_bytes: + filename = "" + image_data = sheet.background_image + else: + filename = sheet.background_image + image_data = None + + ( + image_type, + _, + _, + _, + _, + _, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in background_ids: + ref_id = background_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + background_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_background(ref_id, image_type) + + # Prepare the worksheet images. + for index in range(image_count): + filename = sheet.images[index][2] + image_data = sheet.images[index][10] + ( + image_type, + width, + height, + name, + x_dpi, + y_dpi, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in image_ids: + ref_id = image_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + image_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_image( + index, + ref_id, + drawing_id, + width, + height, + name, + image_type, + x_dpi, + y_dpi, + digest, + ) + + # Prepare the worksheet charts. + for index in range(chart_count): + chart_ref_id += 1 + sheet._prepare_chart(index, chart_ref_id, drawing_id) + + # Prepare the worksheet shapes. + for index in range(shape_count): + sheet._prepare_shape(index, drawing_id) + + # Prepare the header images. + for index in range(header_image_count): + filename = sheet.header_images[index][0] + image_data = sheet.header_images[index][1] + position = sheet.header_images[index][2] + + ( + image_type, + width, + height, + name, + x_dpi, + y_dpi, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in header_image_ids: + ref_id = header_image_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + header_image_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_header_image( + ref_id, + width, + height, + name, + image_type, + position, + x_dpi, + y_dpi, + digest, + ) + + # Prepare the footer images. + for index in range(footer_image_count): + filename = sheet.footer_images[index][0] + image_data = sheet.footer_images[index][1] + position = sheet.footer_images[index][2] + + ( + image_type, + width, + height, + name, + x_dpi, + y_dpi, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in header_image_ids: + ref_id = header_image_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + header_image_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_header_image( + ref_id, + width, + height, + name, + image_type, + position, + x_dpi, + y_dpi, + digest, + ) + + if has_drawing: + drawing = sheet.drawing + self.drawings.append(drawing) + + # Remove charts that were created but not inserted into worksheets. + for chart in self.charts[:]: + if chart.id == -1: + self.charts.remove(chart) + + # Sort the workbook charts references into the order that the were + # written to the worksheets above. + self.charts = sorted(self.charts, key=lambda chart: chart.id) + + self.drawing_count = drawing_id + + def _get_image_properties(self, filename, image_data): + # Extract dimension information from the image file. + height = 0 + width = 0 + x_dpi = 96 + y_dpi = 96 + + if not image_data: + # Open the image file and read in the data. + fh = open(filename, "rb") + data = fh.read() + else: + # Read the image data from the user supplied byte stream. + data = image_data.getvalue() + + digest = hashlib.sha256(data).hexdigest() + + # Get the image filename without the path. + image_name = os.path.basename(filename) + + # Look for some common image file markers. + marker1 = unpack("3s", data[1:4])[0] + marker2 = unpack(">H", data[:2])[0] + marker3 = unpack("2s", data[:2])[0] + marker4 = unpack("I", data[offset + 0 : offset + 4])[0] + marker = unpack("4s", data[offset + 4 : offset + 8])[0] + + # Read the image dimensions. + if marker == b"IHDR": + width = unpack(">I", data[offset + 8 : offset + 12])[0] + height = unpack(">I", data[offset + 12 : offset + 16])[0] + + # Read the image DPI. + if marker == b"pHYs": + x_density = unpack(">I", data[offset + 8 : offset + 12])[0] + y_density = unpack(">I", data[offset + 12 : offset + 16])[0] + units = unpack("b", data[offset + 16 : offset + 17])[0] + + if units == 1: + x_dpi = x_density * 0.0254 + y_dpi = y_density * 0.0254 + + if marker == b"IEND": + end_marker = True + continue + + offset = offset + length + 12 + + return "png", width, height, x_dpi, y_dpi + + def _process_jpg(self, data): + # Extract width and height information from a JPEG file. + offset = 2 + data_length = len(data) + end_marker = False + width = 0 + height = 0 + x_dpi = 96 + y_dpi = 96 + + # Search through the image data to read the JPEG markers. + while not end_marker and offset < data_length: + marker = unpack(">H", data[offset + 0 : offset + 2])[0] + length = unpack(">H", data[offset + 2 : offset + 4])[0] + + # Read the height and width in the 0xFFCn elements (except C4, C8 + # and CC which aren't SOF markers). + if ( + (marker & 0xFFF0) == 0xFFC0 + and marker != 0xFFC4 + and marker != 0xFFC8 + and marker != 0xFFCC + ): + height = unpack(">H", data[offset + 5 : offset + 7])[0] + width = unpack(">H", data[offset + 7 : offset + 9])[0] + + # Read the DPI in the 0xFFE0 element. + if marker == 0xFFE0: + units = unpack("b", data[offset + 11 : offset + 12])[0] + x_density = unpack(">H", data[offset + 12 : offset + 14])[0] + y_density = unpack(">H", data[offset + 14 : offset + 16])[0] + + if units == 1: + x_dpi = x_density + y_dpi = y_density + + if units == 2: + x_dpi = x_density * 2.54 + y_dpi = y_density * 2.54 + + # Workaround for incorrect dpi. + if x_dpi == 1: + x_dpi = 96 + if y_dpi == 1: + y_dpi = 96 + + if marker == 0xFFDA: + end_marker = True + continue + + offset = offset + length + 2 + + return "jpeg", width, height, x_dpi, y_dpi + + def _process_gif(self, data): + # Extract width and height information from a GIF file. + x_dpi = 96 + y_dpi = 96 + + width = unpack(" 0: + sheetname = c_range[:pos] + cells = c_range[pos + 1 :] + else: + return None, None + + # Split the cell range into 2 cells or else use single cell for both. + if cells.find(":") > 0: + (cell_1, cell_2) = cells.split(":", 1) + else: + (cell_1, cell_2) = (cells, cells) + + # Remove leading/trailing quotes and convert escaped quotes to single. + sheetname = sheetname.strip("'") + sheetname = sheetname.replace("''", "'") + + try: + # Get the row, col values from the Excel ranges. We do this in a + # try block for ranges that can't be parsed such as defined names. + (row_start, col_start) = xl_cell_to_rowcol(cell_1) + (row_end, col_end) = xl_cell_to_rowcol(cell_2) + except AttributeError: + return None, None + + # We only handle 1D ranges. + if row_start != row_end and col_start != col_end: + return None, None + + return sheetname, [row_start, col_start, row_end, col_end] + + def _prepare_sst_string_data(self): + # Convert the SST string data from a dict to a list. + self.str_table._sort_string_data() + + def _get_packager(self): + # Get and instance of the Packager class to create the xlsx package. + # This allows the default packager to be over-ridden. + return Packager() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_workbook(self): + # Write element. + + schema = "http://schemas.openxmlformats.org" + xmlns = schema + "/spreadsheetml/2006/main" + xmlns_r = schema + "/officeDocument/2006/relationships" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:r", xmlns_r), + ] + + self._xml_start_tag("workbook", attributes) + + def _write_file_version(self): + # Write the element. + + app_name = "xl" + last_edited = 4 + lowest_edited = 4 + rup_build = 4505 + + attributes = [ + ("appName", app_name), + ("lastEdited", last_edited), + ("lowestEdited", lowest_edited), + ("rupBuild", rup_build), + ] + + if self.vba_project: + attributes.append(("codeName", "{37E998C4-C9E5-D4B9-71C8-EB1FF731991C}")) + + self._xml_empty_tag("fileVersion", attributes) + + def _write_file_sharing(self): + # Write the element. + if self.read_only == 0: + return + + attributes = [("readOnlyRecommended", 1)] + + self._xml_empty_tag("fileSharing", attributes) + + def _write_workbook_pr(self): + # Write element. + default_theme_version = 124226 + attributes = [] + + if self.vba_codename: + attributes.append(("codeName", self.vba_codename)) + if self.date_1904: + attributes.append(("date1904", 1)) + + attributes.append(("defaultThemeVersion", default_theme_version)) + + self._xml_empty_tag("workbookPr", attributes) + + def _write_book_views(self): + # Write element. + self._xml_start_tag("bookViews") + self._write_workbook_view() + self._xml_end_tag("bookViews") + + def _write_workbook_view(self): + # Write element. + attributes = [ + ("xWindow", self.x_window), + ("yWindow", self.y_window), + ("windowWidth", self.window_width), + ("windowHeight", self.window_height), + ] + + # Store the tabRatio attribute when it isn't the default. + if self.tab_ratio != 600: + attributes.append(("tabRatio", self.tab_ratio)) + + # Store the firstSheet attribute when it isn't the default. + if self.worksheet_meta.firstsheet > 0: + firstsheet = self.worksheet_meta.firstsheet + 1 + attributes.append(("firstSheet", firstsheet)) + + # Store the activeTab attribute when it isn't the first sheet. + if self.worksheet_meta.activesheet > 0: + attributes.append(("activeTab", self.worksheet_meta.activesheet)) + + self._xml_empty_tag("workbookView", attributes) + + def _write_sheets(self): + # Write element. + self._xml_start_tag("sheets") + + id_num = 1 + for worksheet in self.worksheets(): + self._write_sheet(worksheet.name, id_num, worksheet.hidden) + id_num += 1 + + self._xml_end_tag("sheets") + + def _write_sheet(self, name, sheet_id, hidden): + # Write element. + attributes = [ + ("name", name), + ("sheetId", sheet_id), + ] + + if hidden: + attributes.append(("state", "hidden")) + + attributes.append(("r:id", "rId" + str(sheet_id))) + + self._xml_empty_tag("sheet", attributes) + + def _write_calc_pr(self): + # Write the element. + attributes = [("calcId", self.calc_id)] + + if self.calc_mode == "manual": + attributes.append(("calcMode", self.calc_mode)) + attributes.append(("calcOnSave", "0")) + elif self.calc_mode == "autoNoTable": + attributes.append(("calcMode", self.calc_mode)) + + if self.calc_on_load: + attributes.append(("fullCalcOnLoad", "1")) + + self._xml_empty_tag("calcPr", attributes) + + def _write_defined_names(self): + # Write the element. + if not self.defined_names: + return + + self._xml_start_tag("definedNames") + + for defined_name in self.defined_names: + self._write_defined_name(defined_name) + + self._xml_end_tag("definedNames") + + def _write_defined_name(self, defined_name): + # Write the element. + name = defined_name[0] + sheet_id = defined_name[1] + sheet_range = defined_name[2] + hidden = defined_name[3] + + attributes = [("name", name)] + + if sheet_id != -1: + attributes.append(("localSheetId", sheet_id)) + if hidden: + attributes.append(("hidden", 1)) + + self._xml_data_element("definedName", sheet_range, attributes) + + +# A metadata class to share data between worksheets. +class WorksheetMeta(object): + """ + A class to track worksheets data such as the active sheet and the + first sheet. + + """ + + def __init__(self): + self.activesheet = 0 + self.firstsheet = 0 diff --git a/billinglayer/python/xlsxwriter/worksheet.py b/billinglayer/python/xlsxwriter/worksheet.py new file mode 100644 index 0000000..eb2bc2c --- /dev/null +++ b/billinglayer/python/xlsxwriter/worksheet.py @@ -0,0 +1,8367 @@ +############################################################################### +# +# Worksheet - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import datetime +import math +import os +import re +import tempfile + +from collections import defaultdict +from collections import namedtuple +from decimal import Decimal +from fractions import Fraction +from functools import wraps +from io import StringIO +from math import isinf +from math import isnan +from warnings import warn + +# Package imports. +from . import xmlwriter +from .format import Format +from .drawing import Drawing +from .shape import Shape +from .xmlwriter import XMLwriter +from .utility import xl_rowcol_to_cell +from .utility import xl_rowcol_to_cell_fast +from .utility import xl_cell_to_rowcol +from .utility import xl_col_to_name +from .utility import xl_range +from .utility import xl_color +from .utility import xl_pixel_width +from .utility import get_sparkline_style +from .utility import supported_datetime +from .utility import datetime_to_excel_datetime +from .utility import preserve_whitespace +from .utility import quote_sheetname +from .exceptions import DuplicateTableName +from .exceptions import OverlappingRange + +# Compile performance critical regular expressions. +re_control_chars_1 = re.compile("(_x[0-9a-fA-F]{4}_)") +re_control_chars_2 = re.compile(r"([\x00-\x08\x0b-\x1f])") + +re_dynamic_function = re.compile( + r""" + \bANCHORARRAY\( | + \bBYCOL\( | + \bBYROW\( | + \bCHOOSECOLS\( | + \bCHOOSEROWS\( | + \bDROP\( | + \bEXPAND\( | + \bFILTER\( | + \bHSTACK\( | + \bLAMBDA\( | + \bMAKEARRAY\( | + \bMAP\( | + \bRANDARRAY\( | + \bREDUCE\( | + \bSCAN\( | + \bSEQUENCE\( | + \bSINGLE\( | + \bSORT\( | + \bSORTBY\( | + \bSWITCH\( | + \bTAKE\( | + \bTEXTSPLIT\( | + \bTOCOL\( | + \bTOROW\( | + \bUNIQUE\( | + \bVSTACK\( | + \bWRAPCOLS\( | + \bWRAPROWS\( | + \bXLOOKUP\(""", + re.VERBOSE, +) + + +############################################################################### +# +# Decorator functions. +# +############################################################################### +def convert_cell_args(method): + """ + Decorator function to convert A1 notation in cell method calls + to the default row/col notation. + + """ + + @wraps(method) + def cell_wrapper(self, *args, **kwargs): + try: + # First arg is an int, default to row/col notation. + if args: + first_arg = args[0] + int(first_arg) + except ValueError: + # First arg isn't an int, convert to A1 notation. + new_args = xl_cell_to_rowcol(first_arg) + args = new_args + args[1:] + + return method(self, *args, **kwargs) + + return cell_wrapper + + +def convert_range_args(method): + """ + Decorator function to convert A1 notation in range method calls + to the default row/col notation. + + """ + + @wraps(method) + def cell_wrapper(self, *args, **kwargs): + try: + # First arg is an int, default to row/col notation. + if args: + int(args[0]) + except ValueError: + # First arg isn't an int, convert to A1 notation. + if ":" in args[0]: + cell_1, cell_2 = args[0].split(":") + row_1, col_1 = xl_cell_to_rowcol(cell_1) + row_2, col_2 = xl_cell_to_rowcol(cell_2) + else: + row_1, col_1 = xl_cell_to_rowcol(args[0]) + row_2, col_2 = row_1, col_1 + + new_args = [row_1, col_1, row_2, col_2] + new_args.extend(args[1:]) + args = new_args + + return method(self, *args, **kwargs) + + return cell_wrapper + + +def convert_column_args(method): + """ + Decorator function to convert A1 notation in columns method calls + to the default row/col notation. + + """ + + @wraps(method) + def column_wrapper(self, *args, **kwargs): + try: + # First arg is an int, default to row/col notation. + if args: + int(args[0]) + except ValueError: + # First arg isn't an int, convert to A1 notation. + cell_1, cell_2 = [col + "1" for col in args[0].split(":")] + _, col_1 = xl_cell_to_rowcol(cell_1) + _, col_2 = xl_cell_to_rowcol(cell_2) + new_args = [col_1, col_2] + new_args.extend(args[1:]) + args = new_args + + return method(self, *args, **kwargs) + + return column_wrapper + + +############################################################################### +# +# Named tuples used for cell types. +# +############################################################################### +cell_string_tuple = namedtuple("String", "string, format") +cell_number_tuple = namedtuple("Number", "number, format") +cell_blank_tuple = namedtuple("Blank", "format") +cell_boolean_tuple = namedtuple("Boolean", "boolean, format") +cell_formula_tuple = namedtuple("Formula", "formula, format, value") +cell_datetime_tuple = namedtuple("Datetime", "number, format") +cell_arformula_tuple = namedtuple( + "ArrayFormula", "formula, format, value, range, atype" +) +cell_rich_string_tuple = namedtuple("RichString", "string, format, raw_string") + + +############################################################################### +# +# Worksheet Class definition. +# +############################################################################### +class Worksheet(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Worksheet file. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Worksheet, self).__init__() + + self.name = None + self.index = None + self.str_table = None + self.palette = None + self.constant_memory = 0 + self.tmpdir = None + self.is_chartsheet = False + + self.ext_sheets = [] + self.fileclosed = 0 + self.excel_version = 2007 + self.excel2003_style = False + + self.xls_rowmax = 1048576 + self.xls_colmax = 16384 + self.xls_strmax = 32767 + self.dim_rowmin = None + self.dim_rowmax = None + self.dim_colmin = None + self.dim_colmax = None + + self.col_info = {} + self.selections = [] + self.hidden = 0 + self.active = 0 + self.tab_color = 0 + self.top_left_cell = "" + + self.panes = [] + self.active_pane = 3 + self.selected = 0 + + self.page_setup_changed = False + self.paper_size = 0 + self.orientation = 1 + + self.print_options_changed = False + self.hcenter = False + self.vcenter = False + self.print_gridlines = False + self.screen_gridlines = True + self.print_headers = False + self.row_col_headers = False + + self.header_footer_changed = False + self.header = "" + self.footer = "" + self.header_footer_aligns = True + self.header_footer_scales = True + self.header_images = [] + self.footer_images = [] + self.header_images_list = [] + + self.margin_left = 0.7 + self.margin_right = 0.7 + self.margin_top = 0.75 + self.margin_bottom = 0.75 + self.margin_header = 0.3 + self.margin_footer = 0.3 + + self.repeat_row_range = "" + self.repeat_col_range = "" + self.print_area_range = "" + + self.page_order = 0 + self.black_white = 0 + self.draft_quality = 0 + self.print_comments = 0 + self.page_start = 0 + + self.fit_page = 0 + self.fit_width = 0 + self.fit_height = 0 + + self.hbreaks = [] + self.vbreaks = [] + + self.protect_options = {} + self.protected_ranges = [] + self.num_protected_ranges = 0 + self.set_cols = {} + self.set_rows = defaultdict(dict) + + self.zoom = 100 + self.zoom_scale_normal = 1 + self.print_scale = 100 + self.is_right_to_left = 0 + self.show_zeros = 1 + self.leading_zeros = 0 + + self.outline_row_level = 0 + self.outline_col_level = 0 + self.outline_style = 0 + self.outline_below = 1 + self.outline_right = 1 + self.outline_on = 1 + self.outline_changed = False + + self.original_row_height = 15 + self.default_row_height = 15 + self.default_row_pixels = 20 + self.default_col_width = 8.43 + self.default_col_pixels = 64 + self.default_date_pixels = 68 + self.default_row_zeroed = 0 + + self.names = {} + self.write_match = [] + self.table = defaultdict(dict) + self.merge = [] + self.merged_cells = {} + self.table_cells = {} + self.row_spans = {} + + self.has_vml = False + self.has_header_vml = False + self.has_comments = False + self.comments = defaultdict(dict) + self.comments_list = [] + self.comments_author = "" + self.comments_visible = 0 + self.vml_shape_id = 1024 + self.buttons_list = [] + self.vml_header_id = 0 + + self.autofilter_area = "" + self.autofilter_ref = None + self.filter_range = [] + self.filter_on = 0 + self.filter_cols = {} + self.filter_type = {} + self.filter_cells = {} + + self.row_sizes = {} + self.col_size_changed = False + self.row_size_changed = False + + self.last_shape_id = 1 + self.rel_count = 0 + self.hlink_count = 0 + self.hlink_refs = [] + self.external_hyper_links = [] + self.external_drawing_links = [] + self.external_comment_links = [] + self.external_vml_links = [] + self.external_table_links = [] + self.external_background_links = [] + self.drawing_links = [] + self.vml_drawing_links = [] + self.charts = [] + self.images = [] + self.tables = [] + self.sparklines = [] + self.shapes = [] + self.shape_hash = {} + self.drawing = 0 + self.drawing_rels = {} + self.drawing_rels_id = 0 + self.vml_drawing_rels = {} + self.vml_drawing_rels_id = 0 + self.background_image = None + self.background_bytes = False + + self.rstring = "" + self.previous_row = 0 + + self.validations = [] + self.cond_formats = {} + self.data_bars_2010 = [] + self.use_data_bars_2010 = False + self.dxf_priority = 1 + self.page_view = 0 + + self.vba_codename = None + + self.date_1904 = False + self.hyperlinks = defaultdict(dict) + + self.strings_to_numbers = False + self.strings_to_urls = True + self.nan_inf_to_errors = False + self.strings_to_formulas = True + + self.default_date_format = None + self.default_url_format = None + self.remove_timezone = False + self.max_url_length = 2079 + + self.row_data_filename = None + self.row_data_fh = None + self.worksheet_meta = None + self.vml_data_id = None + self.vml_shape_id = None + + self.row_data_filename = None + self.row_data_fh = None + self.row_data_fh_closed = False + + self.vertical_dpi = 0 + self.horizontal_dpi = 0 + + self.write_handlers = {} + + self.ignored_errors = None + + self.has_dynamic_arrays = False + self.use_future_functions = False + + # Utility function for writing different types of strings. + def _write_token_as_string(self, token, row, col, *args): + # Map the data to the appropriate write_*() method. + if token == "": + return self._write_blank(row, col, *args) + + if self.strings_to_formulas and token.startswith("="): + return self._write_formula(row, col, *args) + + if token.startswith("{=") and token.endswith("}"): + return self._write_formula(row, col, *args) + + if ( + ":" in token + and self.strings_to_urls + and ( + re.match("(ftp|http)s?://", token) + or re.match("mailto:", token) + or re.match("(in|ex)ternal:", token) + ) + ): + return self._write_url(row, col, *args) + + if self.strings_to_numbers: + try: + f = float(token) + if self.nan_inf_to_errors or (not isnan(f) and not isinf(f)): + return self._write_number(row, col, f, *args[1:]) + except ValueError: + # Not a number, write as a string. + pass + + return self._write_string(row, col, *args) + + else: + # We have a plain string. + return self._write_string(row, col, *args) + + @convert_cell_args + def write(self, row, col, *args): + """ + Write data to a worksheet cell by calling the appropriate write_*() + method based on the type of data being passed. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + *args: Args to pass to sub functions. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + other: Return value of called method. + + """ + return self._write(row, col, *args) + + # Undecorated version of write(). + def _write(self, row, col, *args): + # Check the number of args passed. + if not args: + raise TypeError("write() takes at least 4 arguments (3 given)") + + # The first arg should be the token for all write calls. + token = args[0] + + # Avoid isinstance() for better performance. + token_type = token.__class__ + + # Check for any user defined type handlers with callback functions. + if token_type in self.write_handlers: + write_handler = self.write_handlers[token_type] + function_return = write_handler(self, row, col, *args) + + # If the return value is None then the callback has returned + # control to this function and we should continue as + # normal. Otherwise we return the value to the caller and exit. + if function_return is None: + pass + else: + return function_return + + # Write None as a blank cell. + if token is None: + return self._write_blank(row, col, *args) + + # Check for standard Python types. + if token_type is bool: + return self._write_boolean(row, col, *args) + + if token_type in (float, int, Decimal, Fraction): + return self._write_number(row, col, *args) + + if token_type is str: + return self._write_token_as_string(token, row, col, *args) + + if token_type in ( + datetime.datetime, + datetime.date, + datetime.time, + datetime.timedelta, + ): + return self._write_datetime(row, col, *args) + + # Resort to isinstance() for subclassed primitives. + + # Write number types. + if isinstance(token, (float, int, Decimal, Fraction)): + return self._write_number(row, col, *args) + + # Write string types. + if isinstance(token, str): + return self._write_token_as_string(token, row, col, *args) + + # Write boolean types. + if isinstance(token, bool): + return self._write_boolean(row, col, *args) + + # Write datetime objects. + if supported_datetime(token): + return self._write_datetime(row, col, *args) + + # We haven't matched a supported type. Try float. + try: + f = float(token) + return self._write_number(row, col, f, *args[1:]) + except ValueError: + pass + except TypeError: + raise TypeError("Unsupported type %s in write()" % type(token)) + + # Finally try string. + try: + str(token) + return self._write_string(row, col, *args) + except ValueError: + raise TypeError("Unsupported type %s in write()" % type(token)) + + @convert_cell_args + def write_string(self, row, col, string, cell_format=None): + """ + Write a string to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + string: Cell data. Str. + format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String truncated to 32k characters. + + """ + return self._write_string(row, col, string, cell_format) + + # Undecorated version of write_string(). + def _write_string(self, row, col, string, cell_format=None): + str_error = 0 + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Check that the string is < 32767 chars. + if len(string) > self.xls_strmax: + string = string[: self.xls_strmax] + str_error = -2 + + # Write a shared string or an in-line string in constant_memory mode. + if not self.constant_memory: + string_index = self.str_table._get_shared_string_index(string) + else: + string_index = string + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_string_tuple(string_index, cell_format) + + return str_error + + @convert_cell_args + def write_number(self, row, col, number, cell_format=None): + """ + Write a number to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + number: Cell data. Int or float. + cell_format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_number(row, col, number, cell_format) + + # Undecorated version of write_number(). + def _write_number(self, row, col, number, cell_format=None): + if isnan(number) or isinf(number): + if self.nan_inf_to_errors: + if isnan(number): + return self._write_formula(row, col, "#NUM!", cell_format, "#NUM!") + elif number == math.inf: + return self._write_formula(row, col, "1/0", cell_format, "#DIV/0!") + elif number == -math.inf: + return self._write_formula(row, col, "-1/0", cell_format, "#DIV/0!") + else: + raise TypeError( + "NAN/INF not supported in write_number() " + "without 'nan_inf_to_errors' Workbook() option" + ) + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_number_tuple(number, cell_format) + + return 0 + + @convert_cell_args + def write_blank(self, row, col, blank, cell_format=None): + """ + Write a blank cell with formatting to a worksheet cell. The blank + token is ignored and the format only is written to the cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + blank: Any value. It is ignored. + cell_format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_blank(row, col, blank, cell_format) + + # Undecorated version of write_blank(). + def _write_blank(self, row, col, blank, cell_format=None): + # Don't write a blank cell unless it has a format. + if cell_format is None: + return 0 + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_blank_tuple(cell_format) + + return 0 + + @convert_cell_args + def write_formula(self, row, col, formula, cell_format=None, value=0): + """ + Write a formula to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + formula: Cell formula. + cell_format: An optional cell Format object. + value: An optional value for the formula. Default is 0. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Formula can't be None or empty. + + """ + # Check that row and col are valid and store max and min values. + return self._write_formula(row, col, formula, cell_format, value) + + # Undecorated version of write_formula(). + def _write_formula(self, row, col, formula, cell_format=None, value=0): + if self._check_dimensions(row, col): + return -1 + + if formula is None or formula == "": + warn("Formula can't be None or empty") + return -1 + + # Check for dynamic array functions. + if re_dynamic_function.search(formula): + return self.write_dynamic_array_formula( + row, col, row, col, formula, cell_format, value + ) + + # Hand off array formulas. + if formula.startswith("{") and formula.endswith("}"): + return self._write_array_formula( + row, col, row, col, formula, cell_format, value + ) + + # Modify the formula string, as needed. + formula = self._prepare_formula(formula) + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_formula_tuple(formula, cell_format, value) + + return 0 + + @convert_range_args + def write_array_formula( + self, + first_row, + first_col, + last_row, + last_col, + formula, + cell_format=None, + value=0, + ): + """ + Write a formula to a worksheet cell/range. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + formula: Cell formula. + cell_format: An optional cell Format object. + value: An optional value for the formula. Default is 0. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check for dynamic array functions. + if re_dynamic_function.search(formula): + return self.write_dynamic_array_formula( + first_row, first_col, last_row, last_col, formula, cell_format, value + ) + + return self._write_array_formula( + first_row, + first_col, + last_row, + last_col, + formula, + cell_format, + value, + "static", + ) + + @convert_range_args + def write_dynamic_array_formula( + self, + first_row, + first_col, + last_row, + last_col, + formula, + cell_format=None, + value=0, + ): + """ + Write a dynamic array formula to a worksheet cell/range. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + formula: Cell formula. + cell_format: An optional cell Format object. + value: An optional value for the formula. Default is 0. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + error = self._write_array_formula( + first_row, + first_col, + last_row, + last_col, + formula, + cell_format, + value, + "dynamic", + ) + + if error == 0: + self.has_dynamic_arrays = True + + return error + + # Utility method to strip equal sign and array braces from a formula and + # also expand out future and dynamic array formulas. + def _prepare_formula(self, formula): + # Remove array formula braces and the leading =. + if formula.startswith("{"): + formula = formula[1:] + if formula.startswith("="): + formula = formula[1:] + if formula.endswith("}"): + formula = formula[:-1] + + # Check if formula is already expanded by the user. + if "_xlfn." in formula: + return formula + + # Expand dynamic formulas. + formula = re.sub(r"\bANCHORARRAY\(", "_xlfn.ANCHORARRAY(", formula) + formula = re.sub(r"\bBYCOL\(", "_xlfn.BYCOL(", formula) + formula = re.sub(r"\bBYROW\(", "_xlfn.BYROW(", formula) + formula = re.sub(r"\bCHOOSECOLS\(", "_xlfn.CHOOSECOLS(", formula) + formula = re.sub(r"\bCHOOSEROWS\(", "_xlfn.CHOOSEROWS(", formula) + formula = re.sub(r"\bDROP\(", "_xlfn.DROP(", formula) + formula = re.sub(r"\bEXPAND\(", "_xlfn.EXPAND(", formula) + formula = re.sub(r"\bFILTER\(", "_xlfn._xlws.FILTER(", formula) + formula = re.sub(r"\bHSTACK\(", "_xlfn.HSTACK(", formula) + formula = re.sub(r"\bLAMBDA\(", "_xlfn.LAMBDA(", formula) + formula = re.sub(r"\bMAKEARRAY\(", "_xlfn.MAKEARRAY(", formula) + formula = re.sub(r"\bMAP\(", "_xlfn.MAP(", formula) + formula = re.sub(r"\bRANDARRAY\(", "_xlfn.RANDARRAY(", formula) + formula = re.sub(r"\bREDUCE\(", "_xlfn.REDUCE(", formula) + formula = re.sub(r"\bSCAN\(", "_xlfn.SCAN(", formula) + formula = re.sub(r"\SINGLE\(", "_xlfn.SINGLE(", formula) + formula = re.sub(r"\bSEQUENCE\(", "_xlfn.SEQUENCE(", formula) + formula = re.sub(r"\bSORT\(", "_xlfn._xlws.SORT(", formula) + formula = re.sub(r"\bSORTBY\(", "_xlfn.SORTBY(", formula) + formula = re.sub(r"\bSWITCH\(", "_xlfn.SWITCH(", formula) + formula = re.sub(r"\bTAKE\(", "_xlfn.TAKE(", formula) + formula = re.sub(r"\bTEXTSPLIT\(", "_xlfn.TEXTSPLIT(", formula) + formula = re.sub(r"\bTOCOL\(", "_xlfn.TOCOL(", formula) + formula = re.sub(r"\bTOROW\(", "_xlfn.TOROW(", formula) + formula = re.sub(r"\bUNIQUE\(", "_xlfn.UNIQUE(", formula) + formula = re.sub(r"\bVSTACK\(", "_xlfn.VSTACK(", formula) + formula = re.sub(r"\bWRAPCOLS\(", "_xlfn.WRAPCOLS(", formula) + formula = re.sub(r"\bWRAPROWS\(", "_xlfn.WRAPROWS(", formula) + formula = re.sub(r"\bXLOOKUP\(", "_xlfn.XLOOKUP(", formula) + + if not self.use_future_functions: + return formula + + formula = re.sub(r"\bACOTH\(", "_xlfn.ACOTH(", formula) + formula = re.sub(r"\bACOT\(", "_xlfn.ACOT(", formula) + formula = re.sub(r"\bAGGREGATE\(", "_xlfn.AGGREGATE(", formula) + formula = re.sub(r"\bARABIC\(", "_xlfn.ARABIC(", formula) + formula = re.sub(r"\bARRAYTOTEXT\(", "_xlfn.ARRAYTOTEXT(", formula) + formula = re.sub(r"\bBASE\(", "_xlfn.BASE(", formula) + formula = re.sub(r"\bBETA.DIST\(", "_xlfn.BETA.DIST(", formula) + formula = re.sub(r"\bBETA.INV\(", "_xlfn.BETA.INV(", formula) + formula = re.sub(r"\bBINOM.DIST.RANGE\(", "_xlfn.BINOM.DIST.RANGE(", formula) + formula = re.sub(r"\bBINOM.DIST\(", "_xlfn.BINOM.DIST(", formula) + formula = re.sub(r"\bBINOM.INV\(", "_xlfn.BINOM.INV(", formula) + formula = re.sub(r"\bBITAND\(", "_xlfn.BITAND(", formula) + formula = re.sub(r"\bBITLSHIFT\(", "_xlfn.BITLSHIFT(", formula) + formula = re.sub(r"\bBITOR\(", "_xlfn.BITOR(", formula) + formula = re.sub(r"\bBITRSHIFT\(", "_xlfn.BITRSHIFT(", formula) + formula = re.sub(r"\bBITXOR\(", "_xlfn.BITXOR(", formula) + formula = re.sub(r"\bCEILING.MATH\(", "_xlfn.CEILING.MATH(", formula) + formula = re.sub(r"\bCEILING.PRECISE\(", "_xlfn.CEILING.PRECISE(", formula) + formula = re.sub(r"\bCHISQ.DIST.RT\(", "_xlfn.CHISQ.DIST.RT(", formula) + formula = re.sub(r"\bCHISQ.DIST\(", "_xlfn.CHISQ.DIST(", formula) + formula = re.sub(r"\bCHISQ.INV.RT\(", "_xlfn.CHISQ.INV.RT(", formula) + formula = re.sub(r"\bCHISQ.INV\(", "_xlfn.CHISQ.INV(", formula) + formula = re.sub(r"\bCHISQ.TEST\(", "_xlfn.CHISQ.TEST(", formula) + formula = re.sub(r"\bCOMBINA\(", "_xlfn.COMBINA(", formula) + formula = re.sub(r"\bCONCAT\(", "_xlfn.CONCAT(", formula) + formula = re.sub(r"\bCONFIDENCE.NORM\(", "_xlfn.CONFIDENCE.NORM(", formula) + formula = re.sub(r"\bCONFIDENCE.T\(", "_xlfn.CONFIDENCE.T(", formula) + formula = re.sub(r"\bCOTH\(", "_xlfn.COTH(", formula) + formula = re.sub(r"\bCOT\(", "_xlfn.COT(", formula) + formula = re.sub(r"\bCOVARIANCE.P\(", "_xlfn.COVARIANCE.P(", formula) + formula = re.sub(r"\bCOVARIANCE.S\(", "_xlfn.COVARIANCE.S(", formula) + formula = re.sub(r"\bCSCH\(", "_xlfn.CSCH(", formula) + formula = re.sub(r"\bCSC\(", "_xlfn.CSC(", formula) + formula = re.sub(r"\bDAYS\(", "_xlfn.DAYS(", formula) + formula = re.sub(r"\bDECIMAL\(", "_xlfn.DECIMAL(", formula) + formula = re.sub(r"\bERF.PRECISE\(", "_xlfn.ERF.PRECISE(", formula) + formula = re.sub(r"\bERFC.PRECISE\(", "_xlfn.ERFC.PRECISE(", formula) + formula = re.sub(r"\bEXPON.DIST\(", "_xlfn.EXPON.DIST(", formula) + formula = re.sub(r"\bF.DIST.RT\(", "_xlfn.F.DIST.RT(", formula) + formula = re.sub(r"\bF.DIST\(", "_xlfn.F.DIST(", formula) + formula = re.sub(r"\bF.INV.RT\(", "_xlfn.F.INV.RT(", formula) + formula = re.sub(r"\bF.INV\(", "_xlfn.F.INV(", formula) + formula = re.sub(r"\bF.TEST\(", "_xlfn.F.TEST(", formula) + formula = re.sub(r"\bFILTERXML\(", "_xlfn.FILTERXML(", formula) + formula = re.sub(r"\bFLOOR.MATH\(", "_xlfn.FLOOR.MATH(", formula) + formula = re.sub(r"\bFLOOR.PRECISE\(", "_xlfn.FLOOR.PRECISE(", formula) + formula = re.sub( + r"\bFORECAST.ETS.CONFINT\(", "_xlfn.FORECAST.ETS.CONFINT(", formula + ) + formula = re.sub( + r"\bFORECAST.ETS.SEASONALITY\(", "_xlfn.FORECAST.ETS.SEASONALITY(", formula + ) + formula = re.sub(r"\bFORECAST.ETS.STAT\(", "_xlfn.FORECAST.ETS.STAT(", formula) + formula = re.sub(r"\bFORECAST.ETS\(", "_xlfn.FORECAST.ETS(", formula) + formula = re.sub(r"\bFORECAST.LINEAR\(", "_xlfn.FORECAST.LINEAR(", formula) + formula = re.sub(r"\bFORMULATEXT\(", "_xlfn.FORMULATEXT(", formula) + formula = re.sub(r"\bGAMMA.DIST\(", "_xlfn.GAMMA.DIST(", formula) + formula = re.sub(r"\bGAMMA.INV\(", "_xlfn.GAMMA.INV(", formula) + formula = re.sub(r"\bGAMMALN.PRECISE\(", "_xlfn.GAMMALN.PRECISE(", formula) + formula = re.sub(r"\bGAMMA\(", "_xlfn.GAMMA(", formula) + formula = re.sub(r"\bGAUSS\(", "_xlfn.GAUSS(", formula) + formula = re.sub(r"\bHYPGEOM.DIST\(", "_xlfn.HYPGEOM.DIST(", formula) + formula = re.sub(r"\bIFNA\(", "_xlfn.IFNA(", formula) + formula = re.sub(r"\bIFS\(", "_xlfn.IFS(", formula) + formula = re.sub(r"\bIMAGE\(", "_xlfn.IMAGE(", formula) + formula = re.sub(r"\bIMCOSH\(", "_xlfn.IMCOSH(", formula) + formula = re.sub(r"\bIMCOT\(", "_xlfn.IMCOT(", formula) + formula = re.sub(r"\bIMCSCH\(", "_xlfn.IMCSCH(", formula) + formula = re.sub(r"\bIMCSC\(", "_xlfn.IMCSC(", formula) + formula = re.sub(r"\bIMSECH\(", "_xlfn.IMSECH(", formula) + formula = re.sub(r"\bIMSEC\(", "_xlfn.IMSEC(", formula) + formula = re.sub(r"\bIMSINH\(", "_xlfn.IMSINH(", formula) + formula = re.sub(r"\bIMTAN\(", "_xlfn.IMTAN(", formula) + formula = re.sub(r"\bISFORMULA\(", "_xlfn.ISFORMULA(", formula) + formula = re.sub(r"\bISOMITTED\(", "_xlfn.ISOMITTED(", formula) + formula = re.sub(r"\bISOWEEKNUM\(", "_xlfn.ISOWEEKNUM(", formula) + formula = re.sub(r"\bLET\(", "_xlfn.LET(", formula) + formula = re.sub(r"\bLOGNORM.DIST\(", "_xlfn.LOGNORM.DIST(", formula) + formula = re.sub(r"\bLOGNORM.INV\(", "_xlfn.LOGNORM.INV(", formula) + formula = re.sub(r"\bMAXIFS\(", "_xlfn.MAXIFS(", formula) + formula = re.sub(r"\bMINIFS\(", "_xlfn.MINIFS(", formula) + formula = re.sub(r"\bMODE.MULT\(", "_xlfn.MODE.MULT(", formula) + formula = re.sub(r"\bMODE.SNGL\(", "_xlfn.MODE.SNGL(", formula) + formula = re.sub(r"\bMUNIT\(", "_xlfn.MUNIT(", formula) + formula = re.sub(r"\bNEGBINOM.DIST\(", "_xlfn.NEGBINOM.DIST(", formula) + formula = re.sub(r"\bNORM.DIST\(", "_xlfn.NORM.DIST(", formula) + formula = re.sub(r"\bNORM.INV\(", "_xlfn.NORM.INV(", formula) + formula = re.sub(r"\bNORM.S.DIST\(", "_xlfn.NORM.S.DIST(", formula) + formula = re.sub(r"\bNORM.S.INV\(", "_xlfn.NORM.S.INV(", formula) + formula = re.sub(r"\bNUMBERVALUE\(", "_xlfn.NUMBERVALUE(", formula) + formula = re.sub(r"\bPDURATION\(", "_xlfn.PDURATION(", formula) + formula = re.sub(r"\bPERCENTILE.EXC\(", "_xlfn.PERCENTILE.EXC(", formula) + formula = re.sub(r"\bPERCENTILE.INC\(", "_xlfn.PERCENTILE.INC(", formula) + formula = re.sub(r"\bPERCENTRANK.EXC\(", "_xlfn.PERCENTRANK.EXC(", formula) + formula = re.sub(r"\bPERCENTRANK.INC\(", "_xlfn.PERCENTRANK.INC(", formula) + formula = re.sub(r"\bPERMUTATIONA\(", "_xlfn.PERMUTATIONA(", formula) + formula = re.sub(r"\bPHI\(", "_xlfn.PHI(", formula) + formula = re.sub(r"\bPOISSON.DIST\(", "_xlfn.POISSON.DIST(", formula) + formula = re.sub(r"\bQUARTILE.EXC\(", "_xlfn.QUARTILE.EXC(", formula) + formula = re.sub(r"\bQUARTILE.INC\(", "_xlfn.QUARTILE.INC(", formula) + formula = re.sub(r"\bQUERYSTRING\(", "_xlfn.QUERYSTRING(", formula) + formula = re.sub(r"\bRANK.AVG\(", "_xlfn.RANK.AVG(", formula) + formula = re.sub(r"\bRANK.EQ\(", "_xlfn.RANK.EQ(", formula) + formula = re.sub(r"\bRRI\(", "_xlfn.RRI(", formula) + formula = re.sub(r"\bSECH\(", "_xlfn.SECH(", formula) + formula = re.sub(r"\bSEC\(", "_xlfn.SEC(", formula) + formula = re.sub(r"\bSHEETS\(", "_xlfn.SHEETS(", formula) + formula = re.sub(r"\bSHEET\(", "_xlfn.SHEET(", formula) + formula = re.sub(r"\bSKEW.P\(", "_xlfn.SKEW.P(", formula) + formula = re.sub(r"\bSTDEV.P\(", "_xlfn.STDEV.P(", formula) + formula = re.sub(r"\bSTDEV.S\(", "_xlfn.STDEV.S(", formula) + formula = re.sub(r"\bT.DIST.2T\(", "_xlfn.T.DIST.2T(", formula) + formula = re.sub(r"\bT.DIST.RT\(", "_xlfn.T.DIST.RT(", formula) + formula = re.sub(r"\bT.DIST\(", "_xlfn.T.DIST(", formula) + formula = re.sub(r"\bT.INV.2T\(", "_xlfn.T.INV.2T(", formula) + formula = re.sub(r"\bT.INV\(", "_xlfn.T.INV(", formula) + formula = re.sub(r"\bT.TEST\(", "_xlfn.T.TEST(", formula) + formula = re.sub(r"\bTEXTAFTER\(", "_xlfn.TEXTAFTER(", formula) + formula = re.sub(r"\bTEXTBEFORE\(", "_xlfn.TEXTBEFORE(", formula) + formula = re.sub(r"\bTEXTJOIN\(", "_xlfn.TEXTJOIN(", formula) + formula = re.sub(r"\bUNICHAR\(", "_xlfn.UNICHAR(", formula) + formula = re.sub(r"\bUNICODE\(", "_xlfn.UNICODE(", formula) + formula = re.sub(r"\bVALUETOTEXT\(", "_xlfn.VALUETOTEXT(", formula) + formula = re.sub(r"\bVAR.P\(", "_xlfn.VAR.P(", formula) + formula = re.sub(r"\bVAR.S\(", "_xlfn.VAR.S(", formula) + formula = re.sub(r"\bWEBSERVICE\(", "_xlfn.WEBSERVICE(", formula) + formula = re.sub(r"\bWEIBULL.DIST\(", "_xlfn.WEIBULL.DIST(", formula) + formula = re.sub(r"\bXMATCH\(", "_xlfn.XMATCH(", formula) + formula = re.sub(r"\bXOR\(", "_xlfn.XOR(", formula) + formula = re.sub(r"\bZ.TEST\(", "_xlfn.Z.TEST(", formula) + + return formula + + # Undecorated version of write_array_formula() and + # write_dynamic_array_formula(). + def _write_array_formula( + self, + first_row, + first_col, + last_row, + last_col, + formula, + cell_format=None, + value=0, + atype="static", + ): + # Swap last row/col with first row/col as necessary. + if first_row > last_row: + first_row, last_row = last_row, first_row + if first_col > last_col: + first_col, last_col = last_col, first_col + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(first_row, first_col): + return -1 + if self._check_dimensions(last_row, last_col): + return -1 + + # Define array range + if first_row == last_row and first_col == last_col: + cell_range = xl_rowcol_to_cell(first_row, first_col) + else: + cell_range = ( + xl_rowcol_to_cell(first_row, first_col) + + ":" + + xl_rowcol_to_cell(last_row, last_col) + ) + + # Modify the formula string, as needed. + formula = self._prepare_formula(formula) + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and first_row > self.previous_row: + self._write_single_row(first_row) + + # Store the cell data in the worksheet data table. + self.table[first_row][first_col] = cell_arformula_tuple( + formula, cell_format, value, cell_range, atype + ) + + # Pad out the rest of the area with formatted zeroes. + if not self.constant_memory: + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if row != first_row or col != first_col: + self._write_number(row, col, 0, cell_format) + + return 0 + + @convert_cell_args + def write_datetime(self, row, col, date, cell_format=None): + """ + Write a date or time to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + date: Date and/or time as a datetime object. + cell_format: A cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_datetime(row, col, date, cell_format) + + # Undecorated version of write_datetime(). + def _write_datetime(self, row, col, date, cell_format=None): + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Convert datetime to an Excel date. + number = self._convert_date_time(date) + + # Add the default date format. + if cell_format is None: + cell_format = self.default_date_format + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_datetime_tuple(number, cell_format) + + return 0 + + @convert_cell_args + def write_boolean(self, row, col, boolean, cell_format=None): + """ + Write a boolean value to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + boolean: Cell data. bool type. + cell_format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_boolean(row, col, boolean, cell_format) + + # Undecorated version of write_boolean(). + def _write_boolean(self, row, col, boolean, cell_format=None): + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + if boolean: + value = 1 + else: + value = 0 + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_boolean_tuple(value, cell_format) + + return 0 + + # Write a hyperlink. This is comprised of two elements: the displayed + # string and the non-displayed link. The displayed string is the same as + # the link unless an alternative string is specified. The display string + # is written using the write_string() method. Therefore the max characters + # string limit applies. + # + # The hyperlink can be to a http, ftp, mail, internal sheet, or external + # directory urls. + @convert_cell_args + def write_url(self, row, col, url, cell_format=None, string=None, tip=None): + """ + Write a hyperlink to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + url: Hyperlink url. + format: An optional cell Format object. + string: An optional display string for the hyperlink. + tip: An optional tooltip. + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String longer than 32767 characters. + -3: URL longer than Excel limit of 255 characters. + -4: Exceeds Excel limit of 65,530 urls per worksheet. + """ + return self._write_url(row, col, url, cell_format, string, tip) + + # Undecorated version of write_url(). + def _write_url(self, row, col, url, cell_format=None, string=None, tip=None): + # Check that row and col are valid and store max and min values + if self._check_dimensions(row, col): + return -1 + + # Set the displayed string to the URL unless defined by the user. + if string is None: + string = url + + # Default to external link type such as 'http://' or 'external:'. + link_type = 1 + + # Remove the URI scheme from internal links. + if url.startswith("internal:"): + url = url.replace("internal:", "") + string = string.replace("internal:", "") + link_type = 2 + + # Remove the URI scheme from external links and change the directory + # separator from Unix to Dos. + external = False + if url.startswith("external:"): + url = url.replace("external:", "") + url = url.replace("/", "\\") + string = string.replace("external:", "") + string = string.replace("/", "\\") + external = True + + # Strip the mailto header. + string = string.replace("mailto:", "") + + # Check that the string is < 32767 chars + str_error = 0 + if len(string) > self.xls_strmax: + warn( + "Ignoring URL since it exceeds Excel's string limit of " + "32767 characters" + ) + return -2 + + # Copy string for use in hyperlink elements. + url_str = string + + # External links to URLs and to other Excel workbooks have slightly + # different characteristics that we have to account for. + if link_type == 1: + # Split url into the link and optional anchor/location. + if "#" in url: + url, url_str = url.split("#", 1) + else: + url_str = None + + url = self._escape_url(url) + + if url_str is not None and not external: + url_str = self._escape_url(url_str) + + # Add the file:/// URI to the url for Windows style "C:/" link and + # Network shares. + if re.match(r"\w:", url) or re.match(r"\\", url): + url = "file:///" + url + + # Convert a .\dir\file.xlsx link to dir\file.xlsx. + url = re.sub(r"^\.\\", "", url) + + # Excel limits the escaped URL and location/anchor to 255 characters. + tmp_url_str = url_str or "" + max_url = self.max_url_length + if len(url) > max_url or len(tmp_url_str) > max_url: + warn( + "Ignoring URL '%s' with link or location/anchor > %d " + "characters since it exceeds Excel's limit for URLS" % (url, max_url) + ) + return -3 + + # Check the limit of URLS per worksheet. + self.hlink_count += 1 + + if self.hlink_count > 65530: + warn( + "Ignoring URL '%s' since it exceeds Excel's limit of " + "65,530 URLS per worksheet." % url + ) + return -4 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Add the default URL format. + if cell_format is None: + cell_format = self.default_url_format + + # Write the hyperlink string. + self._write_string(row, col, string, cell_format) + + # Store the hyperlink data in a separate structure. + self.hyperlinks[row][col] = { + "link_type": link_type, + "url": url, + "str": url_str, + "tip": tip, + } + + return str_error + + @convert_cell_args + def write_rich_string(self, row, col, *args): + """ + Write a "rich" string with multiple formats to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + string_parts: String and format pairs. + cell_format: Optional Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String truncated to 32k characters. + -3: 2 consecutive formats used. + -4: Empty string used. + -5: Insufficient parameters. + + """ + + return self._write_rich_string(row, col, *args) + + # Undecorated version of write_rich_string(). + def _write_rich_string(self, row, col, *args): + tokens = list(args) + cell_format = None + string_index = 0 + raw_string = "" + + # Check that row and col are valid and store max and min values + if self._check_dimensions(row, col): + return -1 + + # If the last arg is a format we use it as the cell format. + if isinstance(tokens[-1], Format): + cell_format = tokens.pop() + + # Create a temp XMLWriter object and use it to write the rich string + # XML to a string. + fh = StringIO() + self.rstring = XMLwriter() + self.rstring._set_filehandle(fh) + + # Create a temp format with the default font for unformatted fragments. + default = Format() + + # Convert list of format, string tokens to pairs of (format, string) + # except for the first string fragment which doesn't require a default + # formatting run. Use the default for strings without a leading format. + fragments = [] + previous = "format" + pos = 0 + + if len(tokens) <= 2: + warn( + "You must specify more than 2 format/fragments for rich " + "strings. Ignoring input in write_rich_string()." + ) + return -5 + + for token in tokens: + if not isinstance(token, Format): + # Token is a string. + if previous != "format": + # If previous token wasn't a format add one before string. + fragments.append(default) + fragments.append(token) + else: + # If previous token was a format just add the string. + fragments.append(token) + + if token == "": + warn( + "Excel doesn't allow empty strings in rich strings. " + "Ignoring input in write_rich_string()." + ) + return -4 + + # Keep track of unformatted string. + raw_string += token + previous = "string" + else: + # Can't allow 2 formats in a row. + if previous == "format" and pos > 0: + warn( + "Excel doesn't allow 2 consecutive formats in rich " + "strings. Ignoring input in write_rich_string()." + ) + return -3 + + # Token is a format object. Add it to the fragment list. + fragments.append(token) + previous = "format" + + pos += 1 + + # If the first token is a string start the element. + if not isinstance(fragments[0], Format): + self.rstring._xml_start_tag("r") + + # Write the XML elements for the $format $string fragments. + for token in fragments: + if isinstance(token, Format): + # Write the font run. + self.rstring._xml_start_tag("r") + self._write_font(token) + else: + # Write the string fragment part, with whitespace handling. + attributes = [] + + if preserve_whitespace(token): + attributes.append(("xml:space", "preserve")) + + self.rstring._xml_data_element("t", token, attributes) + self.rstring._xml_end_tag("r") + + # Read the in-memory string. + string = self.rstring.fh.getvalue() + + # Check that the string is < 32767 chars. + if len(raw_string) > self.xls_strmax: + warn( + "String length must be less than or equal to Excel's limit " + "of 32,767 characters in write_rich_string()." + ) + return -2 + + # Write a shared string or an in-line string in constant_memory mode. + if not self.constant_memory: + string_index = self.str_table._get_shared_string_index(string) + else: + string_index = string + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_rich_string_tuple( + string_index, cell_format, raw_string + ) + + return 0 + + def add_write_handler(self, user_type, user_function): + """ + Add a callback function to the write() method to handle user defined + types. + + Args: + user_type: The user type() to match on. + user_function: The user defined function to write the type data. + Returns: + Nothing. + + """ + + self.write_handlers[user_type] = user_function + + @convert_cell_args + def write_row(self, row, col, data, cell_format=None): + """ + Write a row of data starting from (row, col). + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + data: A list of tokens to be written with write(). + format: An optional cell Format object. + Returns: + 0: Success. + other: Return value of write() method. + + """ + for token in data: + error = self._write(row, col, token, cell_format) + if error: + return error + col += 1 + + return 0 + + @convert_cell_args + def write_column(self, row, col, data, cell_format=None): + """ + Write a column of data starting from (row, col). + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + data: A list of tokens to be written with write(). + format: An optional cell Format object. + Returns: + 0: Success. + other: Return value of write() method. + + """ + for token in data: + error = self._write(row, col, token, cell_format) + if error: + return error + row += 1 + + return 0 + + @convert_cell_args + def insert_image(self, row, col, filename, options=None): + """ + Insert an image with its top-left corner in a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + filename: Path and filename for in supported formats. + options: Position, scale, url and data stream of the image. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert image at (%d, %d)." % (row, col)) + return -1 + + if options is None: + options = {} + + x_offset = options.get("x_offset", 0) + y_offset = options.get("y_offset", 0) + x_scale = options.get("x_scale", 1) + y_scale = options.get("y_scale", 1) + url = options.get("url", None) + tip = options.get("tip", None) + anchor = options.get("object_position", 2) + image_data = options.get("image_data", None) + description = options.get("description", None) + decorative = options.get("decorative", False) + + # For backward compatibility with older parameter name. + anchor = options.get("positioning", anchor) + + if not image_data and not os.path.exists(filename): + warn("Image file '%s' not found." % filename) + return -1 + + self.images.append( + [ + row, + col, + filename, + x_offset, + y_offset, + x_scale, + y_scale, + url, + tip, + anchor, + image_data, + description, + decorative, + ] + ) + return 0 + + @convert_cell_args + def insert_textbox(self, row, col, text, options=None): + """ + Insert an textbox with its top-left corner in a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + text: The text for the textbox. + options: Textbox options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert textbox at (%d, %d)." % (row, col)) + return -1 + + if text is None: + text = "" + + if options is None: + options = {} + + x_offset = options.get("x_offset", 0) + y_offset = options.get("y_offset", 0) + x_scale = options.get("x_scale", 1) + y_scale = options.get("y_scale", 1) + anchor = options.get("object_position", 1) + description = options.get("description", None) + decorative = options.get("decorative", False) + + self.shapes.append( + [ + row, + col, + x_offset, + y_offset, + x_scale, + y_scale, + text, + anchor, + options, + description, + decorative, + ] + ) + return 0 + + @convert_cell_args + def insert_chart(self, row, col, chart, options=None): + """ + Insert an chart with its top-left corner in a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + chart: Chart object. + options: Position and scale of the chart. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert chart at (%d, %d)." % (row, col)) + return -1 + + if options is None: + options = {} + + # Ensure a chart isn't inserted more than once. + if chart.already_inserted or chart.combined and chart.combined.already_inserted: + warn("Chart cannot be inserted in a worksheet more than once.") + return + else: + chart.already_inserted = True + + if chart.combined: + chart.combined.already_inserted = True + + x_offset = options.get("x_offset", 0) + y_offset = options.get("y_offset", 0) + x_scale = options.get("x_scale", 1) + y_scale = options.get("y_scale", 1) + anchor = options.get("object_position", 1) + description = options.get("description", None) + decorative = options.get("decorative", False) + + # Allow Chart to override the scale and offset. + if chart.x_scale != 1: + x_scale = chart.x_scale + + if chart.y_scale != 1: + y_scale = chart.y_scale + + if chart.x_offset: + x_offset = chart.x_offset + + if chart.y_offset: + y_offset = chart.y_offset + + self.charts.append( + [ + row, + col, + chart, + x_offset, + y_offset, + x_scale, + y_scale, + anchor, + description, + decorative, + ] + ) + return 0 + + @convert_cell_args + def write_comment(self, row, col, comment, options=None): + """ + Write a comment to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + comment: Cell comment. Str. + options: Comment formatting options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String longer than 32k characters. + + """ + if options is None: + options = {} + + # Check that row and col are valid and store max and min values + if self._check_dimensions(row, col): + return -1 + + # Check that the comment string is < 32767 chars. + if len(comment) > self.xls_strmax: + return -2 + + self.has_vml = 1 + self.has_comments = 1 + + # Store the options of the cell comment, to process on file close. + self.comments[row][col] = [row, col, comment, options] + + return 0 + + def show_comments(self): + """ + Make any comments in the worksheet visible. + + Args: + None. + + Returns: + Nothing. + + """ + self.comments_visible = 1 + + def set_background(self, filename, is_byte_stream=False): + """ + Set a background image for a worksheet. + + Args: + filename: Path and filename for in supported formats. + is_byte_stream: File is a stream of bytes. + Returns: + Nothing. + + """ + + if not is_byte_stream and not os.path.exists(filename): + warn("Image file '%s' not found." % filename) + return -1 + + self.background_bytes = is_byte_stream + self.background_image = filename + + def set_comments_author(self, author): + """ + Set the default author of the cell comments. + + Args: + author: Comment author name. String. + + Returns: + Nothing. + + """ + self.comments_author = author + + def get_name(self): + """ + Retrieve the worksheet name. + + Args: + None. + + Returns: + Nothing. + + """ + # There is no set_name() method. Name must be set in add_worksheet(). + return self.name + + def activate(self): + """ + Set this worksheet as the active worksheet, i.e. the worksheet that is + displayed when the workbook is opened. Also set it as selected. + + Note: An active worksheet cannot be hidden. + + Args: + None. + + Returns: + Nothing. + + """ + self.hidden = 0 + self.selected = 1 + self.worksheet_meta.activesheet = self.index + + def select(self): + """ + Set current worksheet as a selected worksheet, i.e. the worksheet + has its tab highlighted. + + Note: A selected worksheet cannot be hidden. + + Args: + None. + + Returns: + Nothing. + + """ + self.selected = 1 + self.hidden = 0 + + def hide(self): + """ + Hide the current worksheet. + + Args: + None. + + Returns: + Nothing. + + """ + self.hidden = 1 + + # A hidden worksheet shouldn't be active or selected. + self.selected = 0 + + def set_first_sheet(self): + """ + Set current worksheet as the first visible sheet. This is necessary + when there are a large number of worksheets and the activated + worksheet is not visible on the screen. + + Note: A selected worksheet cannot be hidden. + + Args: + None. + + Returns: + Nothing. + + """ + self.hidden = 0 # Active worksheet can't be hidden. + self.worksheet_meta.firstsheet = self.index + + @convert_column_args + def set_column( + self, first_col, last_col, width=None, cell_format=None, options=None + ): + """ + Set the width, and other properties of a single column or a + range of columns. + + Args: + first_col: First column (zero-indexed). + last_col: Last column (zero-indexed). Can be same as first_col. + width: Column width. (optional). + cell_format: Column cell_format. (optional). + options: Dict of options such as hidden and level. + + Returns: + 0: Success. + -1: Column number is out of worksheet bounds. + + """ + if options is None: + options = {} + + # Ensure 2nd col is larger than first. + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + # Don't modify the row dimensions when checking the columns. + ignore_row = True + + # Set optional column values. + hidden = options.get("hidden", False) + collapsed = options.get("collapsed", False) + level = options.get("level", 0) + + # Store the column dimension only in some conditions. + if cell_format or (width and hidden): + ignore_col = False + else: + ignore_col = True + + # Check that each column is valid and store the max and min values. + if self._check_dimensions(0, last_col, ignore_row, ignore_col): + return -1 + if self._check_dimensions(0, first_col, ignore_row, ignore_col): + return -1 + + # Set the limits for the outline levels (0 <= x <= 7). + if level < 0: + level = 0 + if level > 7: + level = 7 + + if level > self.outline_col_level: + self.outline_col_level = level + + # Store the column data. + for col in range(first_col, last_col + 1): + self.col_info[col] = [width, cell_format, hidden, level, collapsed, False] + + # Store the column change to allow optimizations. + self.col_size_changed = True + + return 0 + + @convert_column_args + def set_column_pixels( + self, first_col, last_col, width=None, cell_format=None, options=None + ): + """ + Set the width, and other properties of a single column or a + range of columns, where column width is in pixels. + + Args: + first_col: First column (zero-indexed). + last_col: Last column (zero-indexed). Can be same as first_col. + width: Column width in pixels. (optional). + cell_format: Column cell_format. (optional). + options: Dict of options such as hidden and level. + + Returns: + 0: Success. + -1: Column number is out of worksheet bounds. + + """ + if width is not None: + width = self._pixels_to_width(width) + + return self.set_column(first_col, last_col, width, cell_format, options) + + def autofit(self): + """ + Simulate autofit based on the data, and datatypes in each column. + + Args: + None. + + Returns: + Nothing. + + """ + if self.constant_memory: + warn("Autofit is not supported in constant_memory mode.") + return + + # No data written to the target sheet; nothing to autofit + if self.dim_rowmax is None: + return + + # Store the max pixel width for each column. + col_width_max = {} + + # Create a reverse lookup for the share strings table so we can convert + # the string id back to the original string. + strings = sorted( + self.str_table.string_table, key=self.str_table.string_table.__getitem__ + ) + + for row_num in range(self.dim_rowmin, self.dim_rowmax + 1): + if not self.table.get(row_num): + continue + + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + cell = self.table[row_num][col_num] + cell_type = cell.__class__.__name__ + length = 0 + + if cell_type in ("String", "RichString"): + # Handle strings and rich strings. + # + # For standard shared strings we do a reverse lookup + # from the shared string id to the actual string. For + # rich strings we use the unformatted string. We also + # split multi-line strings and handle each part + # separately. + if cell_type == "String": + string_id = cell.string + string = strings[string_id] + else: + string = cell.raw_string + + if "\n" not in string: + # Single line string. + length = xl_pixel_width(string) + else: + # Handle multi-line strings. + for string in string.split("\n"): + seg_length = xl_pixel_width(string) + if seg_length > length: + length = seg_length + + elif cell_type == "Number": + # Handle numbers. + # + # We use a workaround/optimization for numbers since + # digits all have a pixel width of 7. This gives a + # slightly greater width for the decimal place and + # minus sign but only by a few pixels and + # over-estimation is okay. + length = 7 * len(str(cell.number)) + + elif cell_type == "Datetime": + # Handle dates. + # + # The following uses the default width for mm/dd/yyyy + # dates. It isn't feasible to parse the number format + # to get the actual string width for all format types. + length = self.default_date_pixels + + elif cell_type == "Boolean": + # Handle boolean values. + # + # Use the Excel standard widths for TRUE and FALSE. + if cell.boolean: + length = 31 + else: + length = 36 + + elif cell_type == "Formula" or cell_type == "ArrayFormula": + # Handle formulas. + # + # We only try to autofit a formula if it has a + # non-zero value. + if isinstance(cell.value, (float, int)): + if cell.value > 0: + length = 7 * len(str(cell.value)) + + elif isinstance(cell.value, str): + length = xl_pixel_width(cell.value) + + elif type(cell.value) == bool: + if cell.value: + length = 31 + else: + length = 36 + + # If the cell is in an autofilter header we add an + # additional 16 pixels for the dropdown arrow. + if self.filter_cells.get((row_num, col_num)) and length > 0: + length += 16 + + # Add the string length to the lookup table. + width_max = col_width_max.get(col_num, 0) + if length > width_max: + col_width_max[col_num] = length + + # Apply the width to the column. + for col_num, pixel_width in col_width_max.items(): + # Convert the string pixel width to a character width using an + # additional padding of 7 pixels, like Excel. + width = self._pixels_to_width(pixel_width + 7) + + # The max column character width in Excel is 255. + if width > 255.0: + width = 255.0 + + # Add the width to an existing col info structure or add a new one. + if self.col_info.get(col_num): + # We only update the width for an existing column if it is + # greater than the user defined value. This allows the user + # to pre-load a minimum col width. + col_info = self.col_info.get(col_num) + user_width = col_info[0] + hidden = col_info[5] + if user_width is not None and not hidden: + # Col info is user defined. + if width > user_width: + self.col_info[col_num][0] = width + self.col_info[col_num][5] = True + else: + self.col_info[col_num][0] = width + self.col_info[col_num][5] = True + else: + self.col_info[col_num] = [width, None, False, 0, False, True] + + def set_row(self, row, height=None, cell_format=None, options=None): + """ + Set the width, and other properties of a row. + + Args: + row: Row number (zero-indexed). + height: Row height. (optional). + cell_format: Row cell_format. (optional). + options: Dict of options such as hidden, level and collapsed. + + Returns: + 0: Success. + -1: Row number is out of worksheet bounds. + + """ + if options is None: + options = {} + + # Use minimum col in _check_dimensions(). + if self.dim_colmin is not None: + min_col = self.dim_colmin + else: + min_col = 0 + + # Check that row is valid. + if self._check_dimensions(row, min_col): + return -1 + + if height is None: + height = self.default_row_height + + # Set optional row values. + hidden = options.get("hidden", False) + collapsed = options.get("collapsed", False) + level = options.get("level", 0) + + # If the height is 0 the row is hidden and the height is the default. + if height == 0: + hidden = 1 + height = self.default_row_height + + # Set the limits for the outline levels (0 <= x <= 7). + if level < 0: + level = 0 + if level > 7: + level = 7 + + if level > self.outline_row_level: + self.outline_row_level = level + + # Store the row properties. + self.set_rows[row] = [height, cell_format, hidden, level, collapsed] + + # Store the row change to allow optimizations. + self.row_size_changed = True + + # Store the row sizes for use when calculating image vertices. + self.row_sizes[row] = [height, hidden] + + return 0 + + def set_row_pixels(self, row, height=None, cell_format=None, options=None): + """ + Set the width (in pixels), and other properties of a row. + + Args: + row: Row number (zero-indexed). + height: Row height in pixels. (optional). + cell_format: Row cell_format. (optional). + options: Dict of options such as hidden, level and collapsed. + + Returns: + 0: Success. + -1: Row number is out of worksheet bounds. + + """ + if height is not None: + height = self._pixels_to_height(height) + + return self.set_row(row, height, cell_format, options) + + def set_default_row(self, height=None, hide_unused_rows=False): + """ + Set the default row properties. + + Args: + height: Default height. Optional, defaults to 15. + hide_unused_rows: Hide unused rows. Optional, defaults to False. + + Returns: + Nothing. + + """ + if height is None: + height = self.default_row_height + + if height != self.original_row_height: + # Store the row change to allow optimizations. + self.row_size_changed = True + self.default_row_height = height + + if hide_unused_rows: + self.default_row_zeroed = 1 + + @convert_range_args + def merge_range( + self, first_row, first_col, last_row, last_col, data, cell_format=None + ): + """ + Merge a range of cells. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + data: Cell data. + cell_format: Cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + other: Return value of write(). + + """ + # Merge a range of cells. The first cell should contain the data and + # the others should be blank. All cells should have the same format. + + # Excel doesn't allow a single cell to be merged + if first_row == last_row and first_col == last_col: + warn("Can't merge single cell") + return + + # Swap last row/col with first row/col as necessary + if first_row > last_row: + (first_row, last_row) = (last_row, first_row) + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(first_row, first_col): + return -1 + if self._check_dimensions(last_row, last_col): + return -1 + + # Check if the merge range overlaps a previous merged or table range. + # This is a critical file corruption error in Excel. + cell_range = xl_range(first_row, first_col, last_row, last_col) + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if self.merged_cells.get((row, col)): + previous_range = self.merged_cells.get((row, col)) + raise OverlappingRange( + "Merge range '%s' overlaps previous merge range '%s'." + % (cell_range, previous_range) + ) + elif self.table_cells.get((row, col)): + previous_range = self.table_cells.get((row, col)) + raise OverlappingRange( + "Merge range '%s' overlaps previous table range '%s'." + % (cell_range, previous_range) + ) + else: + self.merged_cells[(row, col)] = cell_range + + # Store the merge range. + self.merge.append([first_row, first_col, last_row, last_col]) + + # Write the first cell + self._write(first_row, first_col, data, cell_format) + + # Pad out the rest of the area with formatted blank cells. + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if row == first_row and col == first_col: + continue + self._write_blank(row, col, "", cell_format) + + return 0 + + @convert_range_args + def autofilter(self, first_row, first_col, last_row, last_col): + """ + Set the autofilter area in the worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + + Returns: + Nothing. + + """ + # Reverse max and min values if necessary. + if last_row < first_row: + (first_row, last_row) = (last_row, first_row) + if last_col < first_col: + (first_col, last_col) = (last_col, first_col) + + # Build up the print area range "Sheet1!$A$1:$C$13". + area = self._convert_name_area(first_row, first_col, last_row, last_col) + ref = xl_range(first_row, first_col, last_row, last_col) + + self.autofilter_area = area + self.autofilter_ref = ref + self.filter_range = [first_col, last_col] + + # Store the filter cell positions for use in the autofit calculation. + for col in range(first_col, last_col + 1): + self.filter_cells[(first_row, col)] = True + + def filter_column(self, col, criteria): + """ + Set the column filter criteria. + + Args: + col: Filter column (zero-indexed). + criteria: Filter criteria. + + Returns: + Nothing. + + """ + if not self.autofilter_area: + warn("Must call autofilter() before filter_column()") + return + + # Check for a column reference in A1 notation and substitute. + try: + int(col) + except ValueError: + # Convert col ref to a cell ref and then to a col number. + col_letter = col + (_, col) = xl_cell_to_rowcol(col + "1") + + if col >= self.xls_colmax: + warn("Invalid column '%s'" % col_letter) + return + + (col_first, col_last) = self.filter_range + + # Reject column if it is outside filter range. + if col < col_first or col > col_last: + warn( + "Column '%d' outside autofilter() column range (%d, %d)" + % (col, col_first, col_last) + ) + return + + tokens = self._extract_filter_tokens(criteria) + + if len(tokens) not in (3, 7): + warn("Incorrect number of tokens in criteria '%s'" % criteria) + + tokens = self._parse_filter_expression(criteria, tokens) + + # Excel handles single or double custom filters as default filters. + # We need to check for them and handle them accordingly. + if len(tokens) == 2 and tokens[0] == 2: + # Single equality. + self.filter_column_list(col, [tokens[1]]) + elif len(tokens) == 5 and tokens[0] == 2 and tokens[2] == 1 and tokens[3] == 2: + # Double equality with "or" operator. + self.filter_column_list(col, [tokens[1], tokens[4]]) + else: + # Non default custom filter. + self.filter_cols[col] = tokens + self.filter_type[col] = 0 + + self.filter_on = 1 + + def filter_column_list(self, col, filters): + """ + Set the column filter criteria in Excel 2007 list style. + + Args: + col: Filter column (zero-indexed). + filters: List of filter criteria to match. + + Returns: + Nothing. + + """ + if not self.autofilter_area: + warn("Must call autofilter() before filter_column()") + return + + # Check for a column reference in A1 notation and substitute. + try: + int(col) + except ValueError: + # Convert col ref to a cell ref and then to a col number. + col_letter = col + (_, col) = xl_cell_to_rowcol(col + "1") + + if col >= self.xls_colmax: + warn("Invalid column '%s'" % col_letter) + return + + (col_first, col_last) = self.filter_range + + # Reject column if it is outside filter range. + if col < col_first or col > col_last: + warn( + "Column '%d' outside autofilter() column range " + "(%d,%d)" % (col, col_first, col_last) + ) + return + + self.filter_cols[col] = filters + self.filter_type[col] = 1 + self.filter_on = 1 + + @convert_range_args + def data_validation(self, first_row, first_col, last_row, last_col, options=None): + """ + Add a data validation to a worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + options: Data validation options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + """ + # Check that row and col are valid without storing the values. + if self._check_dimensions(first_row, first_col, True, True): + return -1 + if self._check_dimensions(last_row, last_col, True, True): + return -1 + + if options is None: + options = {} + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + # Valid input parameters. + valid_parameters = { + "validate", + "criteria", + "value", + "source", + "minimum", + "maximum", + "ignore_blank", + "dropdown", + "show_input", + "input_title", + "input_message", + "show_error", + "error_title", + "error_message", + "error_type", + "other_cells", + "multi_range", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameters: + warn("Unknown parameter '%s' in data_validation()" % param_key) + return -2 + + # Map alternative parameter names 'source' or 'minimum' to 'value'. + if "source" in options: + options["value"] = options["source"] + if "minimum" in options: + options["value"] = options["minimum"] + + # 'validate' is a required parameter. + if "validate" not in options: + warn("Parameter 'validate' is required in data_validation()") + return -2 + + # List of valid validation types. + valid_types = { + "any": "none", + "any value": "none", + "whole number": "whole", + "whole": "whole", + "integer": "whole", + "decimal": "decimal", + "list": "list", + "date": "date", + "time": "time", + "text length": "textLength", + "length": "textLength", + "custom": "custom", + } + + # Check for valid validation types. + if options["validate"] not in valid_types: + warn( + "Unknown validation type '%s' for parameter " + "'validate' in data_validation()" % options["validate"] + ) + return -2 + else: + options["validate"] = valid_types[options["validate"]] + + # No action is required for validation type 'any' if there are no + # input messages to display. + if ( + options["validate"] == "none" + and options.get("input_title") is None + and options.get("input_message") is None + ): + return -2 + + # The any, list and custom validations don't have a criteria so we use + # a default of 'between'. + if ( + options["validate"] == "none" + or options["validate"] == "list" + or options["validate"] == "custom" + ): + options["criteria"] = "between" + options["maximum"] = None + + # 'criteria' is a required parameter. + if "criteria" not in options: + warn("Parameter 'criteria' is required in data_validation()") + return -2 + + # Valid criteria types. + criteria_types = { + "between": "between", + "not between": "notBetween", + "equal to": "equal", + "=": "equal", + "==": "equal", + "not equal to": "notEqual", + "!=": "notEqual", + "<>": "notEqual", + "greater than": "greaterThan", + ">": "greaterThan", + "less than": "lessThan", + "<": "lessThan", + "greater than or equal to": "greaterThanOrEqual", + ">=": "greaterThanOrEqual", + "less than or equal to": "lessThanOrEqual", + "<=": "lessThanOrEqual", + } + + # Check for valid criteria types. + if options["criteria"] not in criteria_types: + warn( + "Unknown criteria type '%s' for parameter " + "'criteria' in data_validation()" % options["criteria"] + ) + return -2 + else: + options["criteria"] = criteria_types[options["criteria"]] + + # 'Between' and 'Not between' criteria require 2 values. + if options["criteria"] == "between" or options["criteria"] == "notBetween": + if "maximum" not in options: + warn( + "Parameter 'maximum' is required in data_validation() " + "when using 'between' or 'not between' criteria" + ) + return -2 + else: + options["maximum"] = None + + # Valid error dialog types. + error_types = { + "stop": 0, + "warning": 1, + "information": 2, + } + + # Check for valid error dialog types. + if "error_type" not in options: + options["error_type"] = 0 + elif options["error_type"] not in error_types: + warn( + "Unknown criteria type '%s' for parameter 'error_type' " + "in data_validation()" % options["error_type"] + ) + return -2 + else: + options["error_type"] = error_types[options["error_type"]] + + # Convert date/times value if required. + if ( + options["validate"] in ("date", "time") + and options["value"] + and supported_datetime(options["value"]) + ): + date_time = self._convert_date_time(options["value"]) + # Format date number to the same precision as Excel. + options["value"] = "%.16g" % date_time + + if options["maximum"] and supported_datetime(options["maximum"]): + date_time = self._convert_date_time(options["maximum"]) + options["maximum"] = "%.16g" % date_time + + # Check that the input title doesn't exceed the maximum length. + if options.get("input_title") and len(options["input_title"]) > 32: + warn( + "Length of input title '%s' exceeds Excel's limit of 32" + % options["input_title"] + ) + return -2 + + # Check that the error title doesn't exceed the maximum length. + if options.get("error_title") and len(options["error_title"]) > 32: + warn( + "Length of error title '%s' exceeds Excel's limit of 32" + % options["error_title"] + ) + return -2 + + # Check that the input message doesn't exceed the maximum length. + if options.get("input_message") and len(options["input_message"]) > 255: + warn( + "Length of input message '%s' exceeds Excel's limit of 255" + % options["input_message"] + ) + return -2 + + # Check that the error message doesn't exceed the maximum length. + if options.get("error_message") and len(options["error_message"]) > 255: + warn( + "Length of error message '%s' exceeds Excel's limit of 255" + % options["error_message"] + ) + return -2 + + # Check that the input list doesn't exceed the maximum length. + if options["validate"] == "list" and type(options["value"]) is list: + formula = self._csv_join(*options["value"]) + if len(formula) > 255: + warn( + "Length of list items '%s' exceeds Excel's limit of " + "255, use a formula range instead" % formula + ) + return -2 + + # Set some defaults if they haven't been defined by the user. + if "ignore_blank" not in options: + options["ignore_blank"] = 1 + if "dropdown" not in options: + options["dropdown"] = 1 + if "show_input" not in options: + options["show_input"] = 1 + if "show_error" not in options: + options["show_error"] = 1 + + # These are the cells to which the validation is applied. + options["cells"] = [[first_row, first_col, last_row, last_col]] + + # A (for now) undocumented parameter to pass additional cell ranges. + if "other_cells" in options: + options["cells"].extend(options["other_cells"]) + + # Override with user defined multiple range if provided. + if "multi_range" in options: + options["multi_range"] = options["multi_range"].replace("$", "") + + # Store the validation information until we close the worksheet. + self.validations.append(options) + + return 0 + + @convert_range_args + def conditional_format( + self, first_row, first_col, last_row, last_col, options=None + ): + """ + Add a conditional format to a worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + options: Conditional format options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + """ + # Check that row and col are valid without storing the values. + if self._check_dimensions(first_row, first_col, True, True): + return -1 + if self._check_dimensions(last_row, last_col, True, True): + return -1 + + if options is None: + options = {} + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + # Valid input parameters. + valid_parameter = { + "type", + "format", + "criteria", + "value", + "minimum", + "maximum", + "stop_if_true", + "min_type", + "mid_type", + "max_type", + "min_value", + "mid_value", + "max_value", + "min_color", + "mid_color", + "max_color", + "min_length", + "max_length", + "multi_range", + "bar_color", + "bar_negative_color", + "bar_negative_color_same", + "bar_solid", + "bar_border_color", + "bar_negative_border_color", + "bar_negative_border_color_same", + "bar_no_border", + "bar_direction", + "bar_axis_position", + "bar_axis_color", + "bar_only", + "data_bar_2010", + "icon_style", + "reverse_icons", + "icons_only", + "icons", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameter: + warn("Unknown parameter '%s' in conditional_format()" % param_key) + return -2 + + # 'type' is a required parameter. + if "type" not in options: + warn("Parameter 'type' is required in conditional_format()") + return -2 + + # Valid types. + valid_type = { + "cell": "cellIs", + "date": "date", + "time": "time", + "average": "aboveAverage", + "duplicate": "duplicateValues", + "unique": "uniqueValues", + "top": "top10", + "bottom": "top10", + "text": "text", + "time_period": "timePeriod", + "blanks": "containsBlanks", + "no_blanks": "notContainsBlanks", + "errors": "containsErrors", + "no_errors": "notContainsErrors", + "2_color_scale": "2_color_scale", + "3_color_scale": "3_color_scale", + "data_bar": "dataBar", + "formula": "expression", + "icon_set": "iconSet", + } + + # Check for valid types. + if options["type"] not in valid_type: + warn( + "Unknown value '%s' for parameter 'type' " + "in conditional_format()" % options["type"] + ) + return -2 + else: + if options["type"] == "bottom": + options["direction"] = "bottom" + options["type"] = valid_type[options["type"]] + + # Valid criteria types. + criteria_type = { + "between": "between", + "not between": "notBetween", + "equal to": "equal", + "=": "equal", + "==": "equal", + "not equal to": "notEqual", + "!=": "notEqual", + "<>": "notEqual", + "greater than": "greaterThan", + ">": "greaterThan", + "less than": "lessThan", + "<": "lessThan", + "greater than or equal to": "greaterThanOrEqual", + ">=": "greaterThanOrEqual", + "less than or equal to": "lessThanOrEqual", + "<=": "lessThanOrEqual", + "containing": "containsText", + "not containing": "notContains", + "begins with": "beginsWith", + "ends with": "endsWith", + "yesterday": "yesterday", + "today": "today", + "last 7 days": "last7Days", + "last week": "lastWeek", + "this week": "thisWeek", + "next week": "nextWeek", + "last month": "lastMonth", + "this month": "thisMonth", + "next month": "nextMonth", + # For legacy, but incorrect, support. + "continue week": "nextWeek", + "continue month": "nextMonth", + } + + # Check for valid criteria types. + if "criteria" in options and options["criteria"] in criteria_type: + options["criteria"] = criteria_type[options["criteria"]] + + # Convert date/times value if required. + if options["type"] in ("date", "time"): + options["type"] = "cellIs" + + if "value" in options: + if not supported_datetime(options["value"]): + warn("Conditional format 'value' must be a datetime object.") + return -2 + else: + date_time = self._convert_date_time(options["value"]) + # Format date number to the same precision as Excel. + options["value"] = "%.16g" % date_time + + if "minimum" in options: + if not supported_datetime(options["minimum"]): + warn("Conditional format 'minimum' must be a datetime object.") + return -2 + else: + date_time = self._convert_date_time(options["minimum"]) + options["minimum"] = "%.16g" % date_time + + if "maximum" in options: + if not supported_datetime(options["maximum"]): + warn("Conditional format 'maximum' must be a datetime object.") + return -2 + else: + date_time = self._convert_date_time(options["maximum"]) + options["maximum"] = "%.16g" % date_time + + # Valid icon styles. + valid_icons = { + "3_arrows": "3Arrows", # 1 + "3_flags": "3Flags", # 2 + "3_traffic_lights_rimmed": "3TrafficLights2", # 3 + "3_symbols_circled": "3Symbols", # 4 + "4_arrows": "4Arrows", # 5 + "4_red_to_black": "4RedToBlack", # 6 + "4_traffic_lights": "4TrafficLights", # 7 + "5_arrows_gray": "5ArrowsGray", # 8 + "5_quarters": "5Quarters", # 9 + "3_arrows_gray": "3ArrowsGray", # 10 + "3_traffic_lights": "3TrafficLights", # 11 + "3_signs": "3Signs", # 12 + "3_symbols": "3Symbols2", # 13 + "4_arrows_gray": "4ArrowsGray", # 14 + "4_ratings": "4Rating", # 15 + "5_arrows": "5Arrows", # 16 + "5_ratings": "5Rating", + } # 17 + + # Set the icon set properties. + if options["type"] == "iconSet": + # An icon_set must have an icon style. + if not options.get("icon_style"): + warn( + "The 'icon_style' parameter must be specified when " + "'type' == 'icon_set' in conditional_format()" + ) + return -3 + + # Check for valid icon styles. + if options["icon_style"] not in valid_icons: + warn( + "Unknown icon_style '%s' in conditional_format()" + % options["icon_style"] + ) + return -2 + else: + options["icon_style"] = valid_icons[options["icon_style"]] + + # Set the number of icons for the icon style. + options["total_icons"] = 3 + if options["icon_style"].startswith("4"): + options["total_icons"] = 4 + elif options["icon_style"].startswith("5"): + options["total_icons"] = 5 + + options["icons"] = self._set_icon_props( + options.get("total_icons"), options.get("icons") + ) + + # Swap last row/col for first row/col as necessary + if first_row > last_row: + first_row, last_row = last_row, first_row + + if first_col > last_col: + first_col, last_col = last_col, first_col + + # Set the formatting range. + cell_range = xl_range(first_row, first_col, last_row, last_col) + start_cell = xl_rowcol_to_cell(first_row, first_col) + + # Override with user defined multiple range if provided. + if "multi_range" in options: + cell_range = options["multi_range"] + cell_range = cell_range.replace("$", "") + + # Get the dxf format index. + if "format" in options and options["format"]: + options["format"] = options["format"]._get_dxf_index() + + # Set the priority based on the order of adding. + options["priority"] = self.dxf_priority + self.dxf_priority += 1 + + # Check for 2010 style data_bar parameters. + if ( + self.use_data_bars_2010 + or options.get("data_bar_2010") + or options.get("bar_solid") + or options.get("bar_border_color") + or options.get("bar_negative_color") + or options.get("bar_negative_color_same") + or options.get("bar_negative_border_color") + or options.get("bar_negative_border_color_same") + or options.get("bar_no_border") + or options.get("bar_axis_position") + or options.get("bar_axis_color") + or options.get("bar_direction") + ): + options["is_data_bar_2010"] = True + + # Special handling of text criteria. + if options["type"] == "text": + if options["criteria"] == "containsText": + options["type"] = "containsText" + options["formula"] = 'NOT(ISERROR(SEARCH("%s",%s)))' % ( + options["value"], + start_cell, + ) + elif options["criteria"] == "notContains": + options["type"] = "notContainsText" + options["formula"] = 'ISERROR(SEARCH("%s",%s))' % ( + options["value"], + start_cell, + ) + elif options["criteria"] == "beginsWith": + options["type"] = "beginsWith" + options["formula"] = 'LEFT(%s,%d)="%s"' % ( + start_cell, + len(options["value"]), + options["value"], + ) + elif options["criteria"] == "endsWith": + options["type"] = "endsWith" + options["formula"] = 'RIGHT(%s,%d)="%s"' % ( + start_cell, + len(options["value"]), + options["value"], + ) + else: + warn( + "Invalid text criteria '%s' " + "in conditional_format()" % options["criteria"] + ) + + # Special handling of time time_period criteria. + if options["type"] == "timePeriod": + if options["criteria"] == "yesterday": + options["formula"] = "FLOOR(%s,1)=TODAY()-1" % start_cell + + elif options["criteria"] == "today": + options["formula"] = "FLOOR(%s,1)=TODAY()" % start_cell + + elif options["criteria"] == "tomorrow": + options["formula"] = "FLOOR(%s,1)=TODAY()+1" % start_cell + + elif options["criteria"] == "last7Days": + options[ + "formula" + ] = "AND(TODAY()-FLOOR(%s,1)<=6,FLOOR(%s,1)<=TODAY())" % ( + start_cell, + start_cell, + ) + + elif options["criteria"] == "lastWeek": + options["formula"] = ( + "AND(TODAY()-ROUNDDOWN(%s,0)>=(WEEKDAY(TODAY()))," + "TODAY()-ROUNDDOWN(%s,0)<(WEEKDAY(TODAY())+7))" + % (start_cell, start_cell) + ) + + elif options["criteria"] == "thisWeek": + options["formula"] = ( + "AND(TODAY()-ROUNDDOWN(%s,0)<=WEEKDAY(TODAY())-1," + "ROUNDDOWN(%s,0)-TODAY()<=7-WEEKDAY(TODAY()))" + % (start_cell, start_cell) + ) + + elif options["criteria"] == "nextWeek": + options["formula"] = ( + "AND(ROUNDDOWN(%s,0)-TODAY()>(7-WEEKDAY(TODAY()))," + "ROUNDDOWN(%s,0)-TODAY()<(15-WEEKDAY(TODAY())))" + % (start_cell, start_cell) + ) + + elif options["criteria"] == "lastMonth": + options["formula"] = ( + "AND(MONTH(%s)=MONTH(TODAY())-1,OR(YEAR(%s)=YEAR(" + "TODAY()),AND(MONTH(%s)=1,YEAR(A1)=YEAR(TODAY())-1)))" + % (start_cell, start_cell, start_cell) + ) + + elif options["criteria"] == "thisMonth": + options[ + "formula" + ] = "AND(MONTH(%s)=MONTH(TODAY()),YEAR(%s)=YEAR(TODAY()))" % ( + start_cell, + start_cell, + ) + + elif options["criteria"] == "nextMonth": + options["formula"] = ( + "AND(MONTH(%s)=MONTH(TODAY())+1,OR(YEAR(%s)=YEAR(" + "TODAY()),AND(MONTH(%s)=12,YEAR(%s)=YEAR(TODAY())+1)))" + % (start_cell, start_cell, start_cell, start_cell) + ) + + else: + warn( + "Invalid time_period criteria '%s' " + "in conditional_format()" % options["criteria"] + ) + + # Special handling of blanks/error types. + if options["type"] == "containsBlanks": + options["formula"] = "LEN(TRIM(%s))=0" % start_cell + + if options["type"] == "notContainsBlanks": + options["formula"] = "LEN(TRIM(%s))>0" % start_cell + + if options["type"] == "containsErrors": + options["formula"] = "ISERROR(%s)" % start_cell + + if options["type"] == "notContainsErrors": + options["formula"] = "NOT(ISERROR(%s))" % start_cell + + # Special handling for 2 color scale. + if options["type"] == "2_color_scale": + options["type"] = "colorScale" + + # Color scales don't use any additional formatting. + options["format"] = None + + # Turn off 3 color parameters. + options["mid_type"] = None + options["mid_color"] = None + + options.setdefault("min_type", "min") + options.setdefault("max_type", "max") + options.setdefault("min_value", 0) + options.setdefault("max_value", 0) + options.setdefault("min_color", "#FF7128") + options.setdefault("max_color", "#FFEF9C") + + options["min_color"] = xl_color(options["min_color"]) + options["max_color"] = xl_color(options["max_color"]) + + # Special handling for 3 color scale. + if options["type"] == "3_color_scale": + options["type"] = "colorScale" + + # Color scales don't use any additional formatting. + options["format"] = None + + options.setdefault("min_type", "min") + options.setdefault("mid_type", "percentile") + options.setdefault("max_type", "max") + options.setdefault("min_value", 0) + options.setdefault("max_value", 0) + options.setdefault("min_color", "#F8696B") + options.setdefault("mid_color", "#FFEB84") + options.setdefault("max_color", "#63BE7B") + + options["min_color"] = xl_color(options["min_color"]) + options["mid_color"] = xl_color(options["mid_color"]) + options["max_color"] = xl_color(options["max_color"]) + + # Set a default mid value. + if "mid_value" not in options: + options["mid_value"] = 50 + + # Special handling for data bar. + if options["type"] == "dataBar": + # Color scales don't use any additional formatting. + options["format"] = None + + if not options.get("min_type"): + options["min_type"] = "min" + options["x14_min_type"] = "autoMin" + else: + options["x14_min_type"] = options["min_type"] + + if not options.get("max_type"): + options["max_type"] = "max" + options["x14_max_type"] = "autoMax" + else: + options["x14_max_type"] = options["max_type"] + + options.setdefault("min_value", 0) + options.setdefault("max_value", 0) + options.setdefault("bar_color", "#638EC6") + options.setdefault("bar_border_color", options["bar_color"]) + options.setdefault("bar_only", False) + options.setdefault("bar_no_border", False) + options.setdefault("bar_solid", False) + options.setdefault("bar_direction", "") + options.setdefault("bar_negative_color", "#FF0000") + options.setdefault("bar_negative_border_color", "#FF0000") + options.setdefault("bar_negative_color_same", False) + options.setdefault("bar_negative_border_color_same", False) + options.setdefault("bar_axis_position", "") + options.setdefault("bar_axis_color", "#000000") + + options["bar_color"] = xl_color(options["bar_color"]) + options["bar_border_color"] = xl_color(options["bar_border_color"]) + options["bar_axis_color"] = xl_color(options["bar_axis_color"]) + options["bar_negative_color"] = xl_color(options["bar_negative_color"]) + options["bar_negative_border_color"] = xl_color( + options["bar_negative_border_color"] + ) + + # Adjust for 2010 style data_bar parameters. + if options.get("is_data_bar_2010"): + self.excel_version = 2010 + + if options["min_type"] == "min" and options["min_value"] == 0: + options["min_value"] = None + + if options["max_type"] == "max" and options["max_value"] == 0: + options["max_value"] = None + + options["range"] = cell_range + + # Strip the leading = from formulas. + try: + options["min_value"] = options["min_value"].lstrip("=") + except (KeyError, AttributeError): + pass + try: + options["mid_value"] = options["mid_value"].lstrip("=") + except (KeyError, AttributeError): + pass + try: + options["max_value"] = options["max_value"].lstrip("=") + except (KeyError, AttributeError): + pass + + # Store the conditional format until we close the worksheet. + if cell_range in self.cond_formats: + self.cond_formats[cell_range].append(options) + else: + self.cond_formats[cell_range] = [options] + + return 0 + + @convert_range_args + def add_table(self, first_row, first_col, last_row, last_col, options=None): + """ + Add an Excel table to a worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + options: Table format options. (Optional) + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + -3: Not supported in constant_memory mode. + """ + table = {} + col_formats = {} + + if options is None: + options = {} + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + if self.constant_memory: + warn("add_table() isn't supported in 'constant_memory' mode") + return -3 + + # Check that row and col are valid without storing the values. + if self._check_dimensions(first_row, first_col, True, True): + return -1 + if self._check_dimensions(last_row, last_col, True, True): + return -1 + + # Swap last row/col for first row/col as necessary. + if first_row > last_row: + (first_row, last_row) = (last_row, first_row) + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + # Check if the table range overlaps a previous merged or table range. + # This is a critical file corruption error in Excel. + cell_range = xl_range(first_row, first_col, last_row, last_col) + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if self.table_cells.get((row, col)): + previous_range = self.table_cells.get((row, col)) + raise OverlappingRange( + "Table range '%s' overlaps previous table range '%s'." + % (cell_range, previous_range) + ) + elif self.merged_cells.get((row, col)): + previous_range = self.merged_cells.get((row, col)) + raise OverlappingRange( + "Table range '%s' overlaps previous merge range '%s'." + % (cell_range, previous_range) + ) + else: + self.table_cells[(row, col)] = cell_range + + # Valid input parameters. + valid_parameter = { + "autofilter", + "banded_columns", + "banded_rows", + "columns", + "data", + "first_column", + "header_row", + "last_column", + "name", + "style", + "total_row", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameter: + warn("Unknown parameter '%s' in add_table()" % param_key) + return -2 + + # Turn on Excel's defaults. + options["banded_rows"] = options.get("banded_rows", True) + options["header_row"] = options.get("header_row", True) + options["autofilter"] = options.get("autofilter", True) + + # Check that there are enough rows. + num_rows = last_row - first_row + if options["header_row"]: + num_rows -= 1 + + if num_rows < 0: + warn("Must have at least one data row in in add_table()") + return -2 + + # Set the table options. + table["show_first_col"] = options.get("first_column", False) + table["show_last_col"] = options.get("last_column", False) + table["show_row_stripes"] = options.get("banded_rows", False) + table["show_col_stripes"] = options.get("banded_columns", False) + table["header_row_count"] = options.get("header_row", 0) + table["totals_row_shown"] = options.get("total_row", False) + + # Set the table name. + if "name" in options: + name = options["name"] + table["name"] = name + + if " " in name: + warn("Name '%s' in add_table() cannot contain spaces" % name) + return -2 + + # Warn if the name contains invalid chars as defined by Excel. + if not re.match(r"^[\w\\][\w\\.]*$", name, re.UNICODE) or re.match( + r"^\d", name + ): + warn("Invalid Excel characters in add_table(): '%s'" % name) + return -2 + + # Warn if the name looks like a cell name. + if re.match(r"^[a-zA-Z][a-zA-Z]?[a-dA-D]?\d+$", name): + warn("Name looks like a cell name in add_table(): '%s'" % name) + return -2 + + # Warn if the name looks like a R1C1 cell reference. + if re.match(r"^[rcRC]$", name) or re.match(r"^[rcRC]\d+[rcRC]\d+$", name): + warn("Invalid name '%s' like a RC cell ref in add_table()" % name) + return -2 + + # Set the table style. + if "style" in options: + table["style"] = options["style"] + + if table["style"] is None: + table["style"] = "" + + # Remove whitespace from style name. + table["style"] = table["style"].replace(" ", "") + else: + table["style"] = "TableStyleMedium9" + + # Set the data range rows (without the header and footer). + first_data_row = first_row + last_data_row = last_row + + if options.get("header_row"): + first_data_row += 1 + + if options.get("total_row"): + last_data_row -= 1 + + # Set the table and autofilter ranges. + table["range"] = xl_range(first_row, first_col, last_row, last_col) + + table["a_range"] = xl_range(first_row, first_col, last_data_row, last_col) + + # If the header row if off the default is to turn autofilter off. + if not options["header_row"]: + options["autofilter"] = 0 + + # Set the autofilter range. + if options["autofilter"]: + table["autofilter"] = table["a_range"] + + # Add the table columns. + col_id = 1 + table["columns"] = [] + seen_names = {} + + for col_num in range(first_col, last_col + 1): + # Set up the default column data. + col_data = { + "id": col_id, + "name": "Column" + str(col_id), + "total_string": "", + "total_function": "", + "total_value": 0, + "formula": "", + "format": None, + "name_format": None, + } + + # Overwrite the defaults with any user defined values. + if "columns" in options: + # Check if there are user defined values for this column. + if col_id <= len(options["columns"]): + user_data = options["columns"][col_id - 1] + else: + user_data = None + + if user_data: + # Get the column format. + xformat = user_data.get("format", None) + + # Map user defined values to internal values. + if user_data.get("header"): + col_data["name"] = user_data["header"] + + # Excel requires unique case insensitive header names. + header_name = col_data["name"] + name = header_name.lower() + if name in seen_names: + warn("Duplicate header name in add_table(): '%s'" % name) + return -2 + else: + seen_names[name] = True + + col_data["name_format"] = user_data.get("header_format") + + # Handle the column formula. + if "formula" in user_data and user_data["formula"]: + formula = user_data["formula"] + + # Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + # Convert Excel 2010 "@" ref to 2007 "#This Row". + formula = formula.replace("@", "[#This Row],") + + col_data["formula"] = formula + + for row in range(first_data_row, last_data_row + 1): + self._write_formula(row, col_num, formula, xformat) + + # Handle the function for the total row. + if user_data.get("total_function"): + function = user_data["total_function"] + + # Massage the function name. + function = function.lower() + function = function.replace("_", "") + function = function.replace(" ", "") + + if function == "countnums": + function = "countNums" + if function == "stddev": + function = "stdDev" + + col_data["total_function"] = function + + formula = self._table_function_to_formula( + function, col_data["name"] + ) + + value = user_data.get("total_value", 0) + + self._write_formula(last_row, col_num, formula, xformat, value) + + elif user_data.get("total_string"): + # Total label only (not a function). + total_string = user_data["total_string"] + col_data["total_string"] = total_string + + self._write_string( + last_row, col_num, total_string, user_data.get("format") + ) + + # Get the dxf format index. + if xformat is not None: + col_data["format"] = xformat._get_dxf_index() + + # Store the column format for writing the cell data. + # It doesn't matter if it is undefined. + col_formats[col_id - 1] = xformat + + # Store the column data. + table["columns"].append(col_data) + + # Write the column headers to the worksheet. + if options["header_row"]: + self._write_string( + first_row, col_num, col_data["name"], col_data["name_format"] + ) + + col_id += 1 + + # Write the cell data if supplied. + if "data" in options: + data = options["data"] + + i = 0 # For indexing the row data. + for row in range(first_data_row, last_data_row + 1): + j = 0 # For indexing the col data. + for col in range(first_col, last_col + 1): + if i < len(data) and j < len(data[i]): + token = data[i][j] + if j in col_formats: + self._write(row, col, token, col_formats[j]) + else: + self._write(row, col, token, None) + j += 1 + i += 1 + + # Store the table data. + self.tables.append(table) + + # Store the filter cell positions for use in the autofit calculation. + if options["autofilter"]: + for col in range(first_col, last_col + 1): + self.filter_cells[(first_row, col)] = True + + return 0 + + @convert_cell_args + def add_sparkline(self, row, col, options=None): + """ + Add sparklines to the worksheet. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + options: Sparkline formatting options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + + """ + + # Check that row and col are valid without storing the values. + if self._check_dimensions(row, col, True, True): + return -1 + + sparkline = {"locations": [xl_rowcol_to_cell(row, col)]} + + if options is None: + options = {} + + # Valid input parameters. + valid_parameters = { + "location", + "range", + "type", + "high_point", + "low_point", + "negative_points", + "first_point", + "last_point", + "markers", + "style", + "series_color", + "negative_color", + "markers_color", + "first_color", + "last_color", + "high_color", + "low_color", + "max", + "min", + "axis", + "reverse", + "empty_cells", + "show_hidden", + "plot_hidden", + "date_axis", + "weight", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameters: + warn("Unknown parameter '%s' in add_sparkline()" % param_key) + return -1 + + # 'range' is a required parameter. + if "range" not in options: + warn("Parameter 'range' is required in add_sparkline()") + return -2 + + # Handle the sparkline type. + spark_type = options.get("type", "line") + + if spark_type not in ("line", "column", "win_loss"): + warn( + "Parameter 'type' must be 'line', 'column' " + "or 'win_loss' in add_sparkline()" + ) + return -2 + + if spark_type == "win_loss": + spark_type = "stacked" + sparkline["type"] = spark_type + + # We handle single location/range values or list of values. + if "location" in options: + if type(options["location"]) is list: + sparkline["locations"] = options["location"] + else: + sparkline["locations"] = [options["location"]] + + if type(options["range"]) is list: + sparkline["ranges"] = options["range"] + else: + sparkline["ranges"] = [options["range"]] + + range_count = len(sparkline["ranges"]) + location_count = len(sparkline["locations"]) + + # The ranges and locations must match. + if range_count != location_count: + warn( + "Must have the same number of location and range " + "parameters in add_sparkline()" + ) + return -2 + + # Store the count. + sparkline["count"] = len(sparkline["locations"]) + + # Get the worksheet name for the range conversion below. + sheetname = quote_sheetname(self.name) + + # Cleanup the input ranges. + new_ranges = [] + for spark_range in sparkline["ranges"]: + # Remove the absolute reference $ symbols. + spark_range = spark_range.replace("$", "") + + # Remove the = from formula. + spark_range = spark_range.lstrip("=") + + # Convert a simple range into a full Sheet1!A1:D1 range. + if "!" not in spark_range: + spark_range = sheetname + "!" + spark_range + + new_ranges.append(spark_range) + + sparkline["ranges"] = new_ranges + + # Cleanup the input locations. + new_locations = [] + for location in sparkline["locations"]: + location = location.replace("$", "") + new_locations.append(location) + + sparkline["locations"] = new_locations + + # Map options. + sparkline["high"] = options.get("high_point") + sparkline["low"] = options.get("low_point") + sparkline["negative"] = options.get("negative_points") + sparkline["first"] = options.get("first_point") + sparkline["last"] = options.get("last_point") + sparkline["markers"] = options.get("markers") + sparkline["min"] = options.get("min") + sparkline["max"] = options.get("max") + sparkline["axis"] = options.get("axis") + sparkline["reverse"] = options.get("reverse") + sparkline["hidden"] = options.get("show_hidden") + sparkline["weight"] = options.get("weight") + + # Map empty cells options. + empty = options.get("empty_cells", "") + + if empty == "zero": + sparkline["empty"] = 0 + elif empty == "connect": + sparkline["empty"] = "span" + else: + sparkline["empty"] = "gap" + + # Map the date axis range. + date_range = options.get("date_axis") + + if date_range and "!" not in date_range: + date_range = sheetname + "!" + date_range + + sparkline["date_axis"] = date_range + + # Set the sparkline styles. + style_id = options.get("style", 0) + style = get_sparkline_style(style_id) + + sparkline["series_color"] = style["series"] + sparkline["negative_color"] = style["negative"] + sparkline["markers_color"] = style["markers"] + sparkline["first_color"] = style["first"] + sparkline["last_color"] = style["last"] + sparkline["high_color"] = style["high"] + sparkline["low_color"] = style["low"] + + # Override the style colors with user defined colors. + self._set_spark_color(sparkline, options, "series_color") + self._set_spark_color(sparkline, options, "negative_color") + self._set_spark_color(sparkline, options, "markers_color") + self._set_spark_color(sparkline, options, "first_color") + self._set_spark_color(sparkline, options, "last_color") + self._set_spark_color(sparkline, options, "high_color") + self._set_spark_color(sparkline, options, "low_color") + + self.sparklines.append(sparkline) + + return 0 + + @convert_range_args + def set_selection(self, first_row, first_col, last_row, last_col): + """ + Set the selected cell or cells in a worksheet + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + + Returns: + 0: Nothing. + """ + pane = None + + # Range selection. Do this before swapping max/min to allow the + # selection direction to be reversed. + active_cell = xl_rowcol_to_cell(first_row, first_col) + + # Swap last row/col for first row/col if necessary + if first_row > last_row: + (first_row, last_row) = (last_row, first_row) + + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + sqref = xl_range(first_row, first_col, last_row, last_col) + + # Selection isn't set for cell A1. + if sqref == "A1": + return + + self.selections = [[pane, active_cell, sqref]] + + @convert_cell_args + def set_top_left_cell(self, row=0, col=0): + """ + Set the first visible cell at the top left of a worksheet. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + + Returns: + 0: Nothing. + """ + + if row == 0 and col == 0: + return + + self.top_left_cell = xl_rowcol_to_cell(row, col) + + def outline_settings( + self, visible=1, symbols_below=1, symbols_right=1, auto_style=0 + ): + """ + Control outline settings. + + Args: + visible: Outlines are visible. Optional, defaults to True. + symbols_below: Show row outline symbols below the outline bar. + Optional, defaults to True. + symbols_right: Show column outline symbols to the right of the + outline bar. Optional, defaults to True. + auto_style: Use Automatic style. Optional, defaults to False. + + Returns: + 0: Nothing. + """ + self.outline_on = visible + self.outline_below = symbols_below + self.outline_right = symbols_right + self.outline_style = auto_style + + self.outline_changed = True + + @convert_cell_args + def freeze_panes(self, row, col, top_row=None, left_col=None, pane_type=0): + """ + Create worksheet panes and mark them as frozen. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + top_row: Topmost visible row in scrolling region of pane. + left_col: Leftmost visible row in scrolling region of pane. + + Returns: + 0: Nothing. + + """ + if top_row is None: + top_row = row + + if left_col is None: + left_col = col + + self.panes = [row, col, top_row, left_col, pane_type] + + @convert_cell_args + def split_panes(self, x, y, top_row=None, left_col=None): + """ + Create worksheet panes and mark them as split. + + Args: + x: The position for the vertical split. + y: The position for the horizontal split. + top_row: Topmost visible row in scrolling region of pane. + left_col: Leftmost visible row in scrolling region of pane. + + Returns: + 0: Nothing. + + """ + # Same as freeze panes with a different pane type. + self.freeze_panes(x, y, top_row, left_col, 2) + + def set_zoom(self, zoom=100): + """ + Set the worksheet zoom factor. + + Args: + zoom: Scale factor: 10 <= zoom <= 400. + + Returns: + Nothing. + + """ + # Ensure the zoom scale is in Excel's range. + if zoom < 10 or zoom > 400: + warn("Zoom factor %d outside range: 10 <= zoom <= 400" % zoom) + zoom = 100 + + self.zoom = int(zoom) + + def right_to_left(self): + """ + Display the worksheet right to left for some versions of Excel. + + Args: + None. + + Returns: + Nothing. + + """ + self.is_right_to_left = 1 + + def hide_zero(self): + """ + Hide zero values in worksheet cells. + + Args: + None. + + Returns: + Nothing. + + """ + self.show_zeros = 0 + + def set_tab_color(self, color): + """ + Set the color of the worksheet tab. + + Args: + color: A #RGB color index. + + Returns: + Nothing. + + """ + self.tab_color = xl_color(color) + + def protect(self, password="", options=None): + """ + Set the password and protection options of the worksheet. + + Args: + password: An optional password string. + options: A dictionary of worksheet objects to protect. + + Returns: + Nothing. + + """ + if password != "": + password = self._encode_password(password) + + if not options: + options = {} + + # Default values for objects that can be protected. + defaults = { + "sheet": True, + "content": False, + "objects": False, + "scenarios": False, + "format_cells": False, + "format_columns": False, + "format_rows": False, + "insert_columns": False, + "insert_rows": False, + "insert_hyperlinks": False, + "delete_columns": False, + "delete_rows": False, + "select_locked_cells": True, + "sort": False, + "autofilter": False, + "pivot_tables": False, + "select_unlocked_cells": True, + } + + # Overwrite the defaults with user specified values. + for key in options.keys(): + if key in defaults: + defaults[key] = options[key] + else: + warn("Unknown protection object: '%s'" % key) + + # Set the password after the user defined values. + defaults["password"] = password + + self.protect_options = defaults + + def unprotect_range(self, cell_range, range_name=None, password=None): + """ + Unprotect ranges within a protected worksheet. + + Args: + cell_range: The cell or cell range to unprotect. + range_name: An optional name for the range. + password: An optional password string. (undocumented) + + Returns: + Nothing. + + """ + if cell_range is None: + warn("Cell range must be specified in unprotect_range()") + return -1 + + # Sanitize the cell range. + cell_range = cell_range.lstrip("=") + cell_range = cell_range.replace("$", "") + + self.num_protected_ranges += 1 + + if range_name is None: + range_name = "Range" + str(self.num_protected_ranges) + + if password: + password = self._encode_password(password) + + self.protected_ranges.append((cell_range, range_name, password)) + + @convert_cell_args + def insert_button(self, row, col, options=None): + """ + Insert a button form object into the worksheet. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + options: Button formatting options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert button at (%d, %d)." % (row, col)) + return -1 + + if options is None: + options = {} + + button = self._button_params(row, col, options) + + self.buttons_list.append(button) + + self.has_vml = 1 + + return 0 + + ########################################################################### + # + # Public API. Page Setup methods. + # + ########################################################################### + def set_landscape(self): + """ + Set the page orientation as landscape. + + Args: + None. + + Returns: + Nothing. + + """ + self.orientation = 0 + self.page_setup_changed = True + + def set_portrait(self): + """ + Set the page orientation as portrait. + + Args: + None. + + Returns: + Nothing. + + """ + self.orientation = 1 + self.page_setup_changed = True + + def set_page_view(self, view=1): + """ + Set the page view mode. + + Args: + 0: Normal view mode + 1: Page view mode (the default) + 2: Page break view mode + + Returns: + Nothing. + + """ + self.page_view = view + + def set_pagebreak_view(self, view=1): + """ + Set the page view mode. + + Args: + None. + + Returns: + Nothing. + + """ + self.page_view = 2 + + def set_paper(self, paper_size): + """ + Set the paper type. US Letter = 1, A4 = 9. + + Args: + paper_size: Paper index. + + Returns: + Nothing. + + """ + if paper_size: + self.paper_size = paper_size + self.page_setup_changed = True + + def center_horizontally(self): + """ + Center the page horizontally. + + Args: + None. + + Returns: + Nothing. + + """ + self.print_options_changed = True + self.hcenter = 1 + + def center_vertically(self): + """ + Center the page vertically. + + Args: + None. + + Returns: + Nothing. + + """ + self.print_options_changed = True + self.vcenter = 1 + + def set_margins(self, left=0.7, right=0.7, top=0.75, bottom=0.75): + """ + Set all the page margins in inches. + + Args: + left: Left margin. + right: Right margin. + top: Top margin. + bottom: Bottom margin. + + Returns: + Nothing. + + """ + self.margin_left = left + self.margin_right = right + self.margin_top = top + self.margin_bottom = bottom + + def set_header(self, header="", options=None, margin=None): + """ + Set the page header caption and optional margin. + + Args: + header: Header string. + margin: Header margin. + options: Header options, mainly for images. + + Returns: + Nothing. + + """ + header_orig = header + header = header.replace("&[Picture]", "&G") + + if len(header) > 255: + warn("Header string cannot be longer than Excel's limit of 255 characters") + return + + if options is not None: + # For backward compatibility allow options to be the margin. + if not isinstance(options, dict): + options = {"margin": options} + else: + options = {} + + # Copy the user defined options so they aren't modified. + options = options.copy() + + # For backward compatibility. + if margin is not None: + options["margin"] = margin + + # Reset the list in case the function is called more than once. + self.header_images = [] + + if options.get("image_left"): + self.header_images.append( + [options.get("image_left"), options.get("image_data_left"), "LH"] + ) + + if options.get("image_center"): + self.header_images.append( + [options.get("image_center"), options.get("image_data_center"), "CH"] + ) + + if options.get("image_right"): + self.header_images.append( + [options.get("image_right"), options.get("image_data_right"), "RH"] + ) + + placeholder_count = header.count("&G") + image_count = len(self.header_images) + + if placeholder_count != image_count: + warn( + "Number of header images (%s) doesn't match placeholder " + "count (%s) in string: %s" + % (image_count, placeholder_count, header_orig) + ) + self.header_images = [] + return + + if "align_with_margins" in options: + self.header_footer_aligns = options["align_with_margins"] + + if "scale_with_doc" in options: + self.header_footer_scales = options["scale_with_doc"] + + self.header = header + self.margin_header = options.get("margin", 0.3) + self.header_footer_changed = True + + if image_count: + self.has_header_vml = True + + def set_footer(self, footer="", options=None, margin=None): + """ + Set the page footer caption and optional margin. + + Args: + footer: Footer string. + margin: Footer margin. + options: Footer options, mainly for images. + + Returns: + Nothing. + + """ + footer_orig = footer + footer = footer.replace("&[Picture]", "&G") + + if len(footer) > 255: + warn("Footer string cannot be longer than Excel's limit of 255 characters") + return + + if options is not None: + # For backward compatibility allow options to be the margin. + if not isinstance(options, dict): + options = {"margin": options} + else: + options = {} + + # Copy the user defined options so they aren't modified. + options = options.copy() + + # For backward compatibility. + if margin is not None: + options["margin"] = margin + + # Reset the list in case the function is called more than once. + self.footer_images = [] + + if options.get("image_left"): + self.footer_images.append( + [options.get("image_left"), options.get("image_data_left"), "LF"] + ) + + if options.get("image_center"): + self.footer_images.append( + [options.get("image_center"), options.get("image_data_center"), "CF"] + ) + + if options.get("image_right"): + self.footer_images.append( + [options.get("image_right"), options.get("image_data_right"), "RF"] + ) + + placeholder_count = footer.count("&G") + image_count = len(self.footer_images) + + if placeholder_count != image_count: + warn( + "Number of footer images (%s) doesn't match placeholder " + "count (%s) in string: %s" + % (image_count, placeholder_count, footer_orig) + ) + self.footer_images = [] + return + + if "align_with_margins" in options: + self.header_footer_aligns = options["align_with_margins"] + + if "scale_with_doc" in options: + self.header_footer_scales = options["scale_with_doc"] + + self.footer = footer + self.margin_footer = options.get("margin", 0.3) + self.header_footer_changed = True + + if image_count: + self.has_header_vml = True + + def repeat_rows(self, first_row, last_row=None): + """ + Set the rows to repeat at the top of each printed page. + + Args: + first_row: Start row for range. + last_row: End row for range. + + Returns: + Nothing. + + """ + if last_row is None: + last_row = first_row + + # Convert rows to 1 based. + first_row += 1 + last_row += 1 + + # Create the row range area like: $1:$2. + area = "$%d:$%d" % (first_row, last_row) + + # Build up the print titles area "Sheet1!$1:$2" + sheetname = quote_sheetname(self.name) + self.repeat_row_range = sheetname + "!" + area + + @convert_column_args + def repeat_columns(self, first_col, last_col=None): + """ + Set the columns to repeat at the left hand side of each printed page. + + Args: + first_col: Start column for range. + last_col: End column for range. + + Returns: + Nothing. + + """ + if last_col is None: + last_col = first_col + + # Convert to A notation. + first_col = xl_col_to_name(first_col, 1) + last_col = xl_col_to_name(last_col, 1) + + # Create a column range like $C:$D. + area = first_col + ":" + last_col + + # Build up the print area range "=Sheet2!$C:$D" + sheetname = quote_sheetname(self.name) + self.repeat_col_range = sheetname + "!" + area + + def hide_gridlines(self, option=1): + """ + Set the option to hide gridlines on the screen and the printed page. + + Args: + option: 0 : Don't hide gridlines + 1 : Hide printed gridlines only + 2 : Hide screen and printed gridlines + + Returns: + Nothing. + + """ + if option == 0: + self.print_gridlines = 1 + self.screen_gridlines = 1 + self.print_options_changed = True + elif option == 1: + self.print_gridlines = 0 + self.screen_gridlines = 1 + else: + self.print_gridlines = 0 + self.screen_gridlines = 0 + + def print_row_col_headers(self): + """ + Set the option to print the row and column headers on the printed page. + + Args: + None. + + Returns: + Nothing. + + """ + self.print_headers = True + self.print_options_changed = True + + def hide_row_col_headers(self): + """ + Set the option to hide the row and column headers on the worksheet. + + Args: + None. + + Returns: + Nothing. + + """ + self.row_col_headers = True + + @convert_range_args + def print_area(self, first_row, first_col, last_row, last_col): + """ + Set the print area in the current worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Set the print area in the current worksheet. + + # Ignore max print area since it is the same as no area for Excel. + if ( + first_row == 0 + and first_col == 0 + and last_row == self.xls_rowmax - 1 + and last_col == self.xls_colmax - 1 + ): + return + + # Build up the print area range "Sheet1!$A$1:$C$13". + area = self._convert_name_area(first_row, first_col, last_row, last_col) + self.print_area_range = area + + return 0 + + def print_across(self): + """ + Set the order in which pages are printed. + + Args: + None. + + Returns: + Nothing. + + """ + self.page_order = 1 + self.page_setup_changed = True + + def fit_to_pages(self, width, height): + """ + Fit the printed area to a specific number of pages both vertically and + horizontally. + + Args: + width: Number of pages horizontally. + height: Number of pages vertically. + + Returns: + Nothing. + + """ + self.fit_page = 1 + self.fit_width = width + self.fit_height = height + self.page_setup_changed = True + + def set_start_page(self, start_page): + """ + Set the start page number when printing. + + Args: + start_page: Start page number. + + Returns: + Nothing. + + """ + self.page_start = start_page + + def set_print_scale(self, scale): + """ + Set the scale factor for the printed page. + + Args: + scale: Print scale. 10 <= scale <= 400. + + Returns: + Nothing. + + """ + # Confine the scale to Excel's range. + if scale < 10 or scale > 400: + warn("Print scale '%d' outside range: 10 <= scale <= 400" % scale) + return + + # Turn off "fit to page" option when print scale is on. + self.fit_page = 0 + + self.print_scale = int(scale) + self.page_setup_changed = True + + def print_black_and_white(self): + """ + Set the option to print the worksheet in black and white. + + Args: + None. + + Returns: + Nothing. + + """ + self.black_white = True + self.page_setup_changed = True + + def set_h_pagebreaks(self, breaks): + """ + Set the horizontal page breaks on a worksheet. + + Args: + breaks: List of rows where the page breaks should be added. + + Returns: + Nothing. + + """ + self.hbreaks = breaks + + def set_v_pagebreaks(self, breaks): + """ + Set the horizontal page breaks on a worksheet. + + Args: + breaks: List of columns where the page breaks should be added. + + Returns: + Nothing. + + """ + self.vbreaks = breaks + + def set_vba_name(self, name=None): + """ + Set the VBA name for the worksheet. By default this is the + same as the sheet name: i.e., Sheet1 etc. + + Args: + name: The VBA name for the worksheet. + + Returns: + Nothing. + + """ + if name is not None: + self.vba_codename = name + else: + self.vba_codename = "Sheet" + str(self.index + 1) + + def ignore_errors(self, options=None): + """ + Ignore various Excel errors/warnings in a worksheet for user defined + ranges. + + Args: + options: A dict of ignore errors keys with cell range values. + + Returns: + 0: Success. + -1: Incorrect parameter or option. + + """ + if options is None: + return -1 + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + # Valid input parameters. + valid_parameters = { + "number_stored_as_text", + "eval_error", + "formula_differs", + "formula_range", + "formula_unlocked", + "empty_cell_reference", + "list_data_validation", + "calculated_column", + "two_digit_text_year", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameters: + warn("Unknown parameter '%s' in ignore_errors()" % param_key) + return -1 + + self.ignored_errors = options + + return 0 + + ########################################################################### + # + # Private API. + # + ########################################################################### + def _initialize(self, init_data): + self.name = init_data["name"] + self.index = init_data["index"] + self.str_table = init_data["str_table"] + self.worksheet_meta = init_data["worksheet_meta"] + self.constant_memory = init_data["constant_memory"] + self.tmpdir = init_data["tmpdir"] + self.date_1904 = init_data["date_1904"] + self.strings_to_numbers = init_data["strings_to_numbers"] + self.strings_to_formulas = init_data["strings_to_formulas"] + self.strings_to_urls = init_data["strings_to_urls"] + self.nan_inf_to_errors = init_data["nan_inf_to_errors"] + self.default_date_format = init_data["default_date_format"] + self.default_url_format = init_data["default_url_format"] + self.excel2003_style = init_data["excel2003_style"] + self.remove_timezone = init_data["remove_timezone"] + self.max_url_length = init_data["max_url_length"] + self.use_future_functions = init_data["use_future_functions"] + + if self.excel2003_style: + self.original_row_height = 12.75 + self.default_row_height = 12.75 + self.default_row_pixels = 17 + self.margin_left = 0.75 + self.margin_right = 0.75 + self.margin_top = 1 + self.margin_bottom = 1 + self.margin_header = 0.5 + self.margin_footer = 0.5 + self.header_footer_aligns = False + + # Open a temp filehandle to store row data in constant_memory mode. + if self.constant_memory: + # This is sub-optimal but we need to create a temp file + # with utf8 encoding in Python < 3. + (fd, filename) = tempfile.mkstemp(dir=self.tmpdir) + os.close(fd) + self.row_data_filename = filename + self.row_data_fh = open(filename, mode="w+", encoding="utf-8") + + # Set as the worksheet filehandle until the file is assembled. + self.fh = self.row_data_fh + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the root worksheet element. + self._write_worksheet() + + # Write the worksheet properties. + self._write_sheet_pr() + + # Write the worksheet dimensions. + self._write_dimension() + + # Write the sheet view properties. + self._write_sheet_views() + + # Write the sheet format properties. + self._write_sheet_format_pr() + + # Write the sheet column info. + self._write_cols() + + # Write the worksheet data such as rows columns and cells. + if not self.constant_memory: + self._write_sheet_data() + else: + self._write_optimized_sheet_data() + + # Write the sheetProtection element. + self._write_sheet_protection() + + # Write the protectedRanges element. + self._write_protected_ranges() + + # Write the phoneticPr element. + if self.excel2003_style: + self._write_phonetic_pr() + + # Write the autoFilter element. + self._write_auto_filter() + + # Write the mergeCells element. + self._write_merge_cells() + + # Write the conditional formats. + self._write_conditional_formats() + + # Write the dataValidations element. + self._write_data_validations() + + # Write the hyperlink element. + self._write_hyperlinks() + + # Write the printOptions element. + self._write_print_options() + + # Write the worksheet page_margins. + self._write_page_margins() + + # Write the worksheet page setup. + self._write_page_setup() + + # Write the headerFooter element. + self._write_header_footer() + + # Write the rowBreaks element. + self._write_row_breaks() + + # Write the colBreaks element. + self._write_col_breaks() + + # Write the ignoredErrors element. + self._write_ignored_errors() + + # Write the drawing element. + self._write_drawings() + + # Write the legacyDrawing element. + self._write_legacy_drawing() + + # Write the legacyDrawingHF element. + self._write_legacy_drawing_hf() + + # Write the picture element, for the background. + self._write_picture() + + # Write the tableParts element. + self._write_table_parts() + + # Write the extLst elements. + self._write_ext_list() + + # Close the worksheet tag. + self._xml_end_tag("worksheet") + + # Close the file. + self._xml_close() + + def _check_dimensions(self, row, col, ignore_row=False, ignore_col=False): + # Check that row and col are valid and store the max and min + # values for use in other methods/elements. The ignore_row / + # ignore_col flags is used to indicate that we wish to perform + # the dimension check without storing the value. The ignore + # flags are use by set_row() and data_validate. + + # Check that the row/col are within the worksheet bounds. + if row < 0 or col < 0: + return -1 + if row >= self.xls_rowmax or col >= self.xls_colmax: + return -1 + + # In constant_memory mode we don't change dimensions for rows + # that are already written. + if not ignore_row and not ignore_col and self.constant_memory: + if row < self.previous_row: + return -2 + + if not ignore_row: + if self.dim_rowmin is None or row < self.dim_rowmin: + self.dim_rowmin = row + if self.dim_rowmax is None or row > self.dim_rowmax: + self.dim_rowmax = row + + if not ignore_col: + if self.dim_colmin is None or col < self.dim_colmin: + self.dim_colmin = col + if self.dim_colmax is None or col > self.dim_colmax: + self.dim_colmax = col + + return 0 + + def _convert_date_time(self, dt_obj): + # Convert a datetime object to an Excel serial date and time. + return datetime_to_excel_datetime(dt_obj, self.date_1904, self.remove_timezone) + + def _convert_name_area(self, row_num_1, col_num_1, row_num_2, col_num_2): + # Convert zero indexed rows and columns to the format required by + # worksheet named ranges, eg, "Sheet1!$A$1:$C$13". + + range1 = "" + range2 = "" + area = "" + row_col_only = 0 + + # Convert to A1 notation. + col_char_1 = xl_col_to_name(col_num_1, 1) + col_char_2 = xl_col_to_name(col_num_2, 1) + row_char_1 = "$" + str(row_num_1 + 1) + row_char_2 = "$" + str(row_num_2 + 1) + + # We need to handle special cases that refer to rows or columns only. + if row_num_1 == 0 and row_num_2 == self.xls_rowmax - 1: + range1 = col_char_1 + range2 = col_char_2 + row_col_only = 1 + elif col_num_1 == 0 and col_num_2 == self.xls_colmax - 1: + range1 = row_char_1 + range2 = row_char_2 + row_col_only = 1 + else: + range1 = col_char_1 + row_char_1 + range2 = col_char_2 + row_char_2 + + # A repeated range is only written once (if it isn't a special case). + if range1 == range2 and not row_col_only: + area = range1 + else: + area = range1 + ":" + range2 + + # Build up the print area range "Sheet1!$A$1:$C$13". + sheetname = quote_sheetname(self.name) + area = sheetname + "!" + area + + return area + + def _sort_pagebreaks(self, breaks): + # This is an internal method used to filter elements of a list of + # pagebreaks used in the _store_hbreak() and _store_vbreak() methods. + # It: + # 1. Removes duplicate entries from the list. + # 2. Sorts the list. + # 3. Removes 0 from the list if present. + if not breaks: + return + + breaks_set = set(breaks) + + if 0 in breaks_set: + breaks_set.remove(0) + + breaks_list = list(breaks_set) + breaks_list.sort() + + # The Excel 2007 specification says that the maximum number of page + # breaks is 1026. However, in practice it is actually 1023. + max_num_breaks = 1023 + if len(breaks_list) > max_num_breaks: + breaks_list = breaks_list[:max_num_breaks] + + return breaks_list + + def _extract_filter_tokens(self, expression): + # Extract the tokens from the filter expression. The tokens are mainly + # non-whitespace groups. The only tricky part is to extract string + # tokens that contain whitespace and/or quoted double quotes (Excel's + # escaped quotes). + # + # Examples: 'x < 2000' + # 'x > 2000 and x < 5000' + # 'x = "foo"' + # 'x = "foo bar"' + # 'x = "foo "" bar"' + # + if not expression: + return [] + + token_re = re.compile(r'"(?:[^"]|"")*"|\S+') + tokens = token_re.findall(expression) + + new_tokens = [] + # Remove single leading and trailing quotes and un-escape other quotes. + for token in tokens: + if token.startswith('"'): + token = token[1:] + + if token.endswith('"'): + token = token[:-1] + + token = token.replace('""', '"') + + new_tokens.append(token) + + return new_tokens + + def _parse_filter_expression(self, expression, tokens): + # Converts the tokens of a possibly conditional expression into 1 or 2 + # sub expressions for further parsing. + # + # Examples: + # ('x', '==', 2000) -> exp1 + # ('x', '>', 2000, 'and', 'x', '<', 5000) -> exp1 and exp2 + + if len(tokens) == 7: + # The number of tokens will be either 3 (for 1 expression) + # or 7 (for 2 expressions). + conditional = tokens[3] + + if re.match("(and|&&)", conditional): + conditional = 0 + elif re.match(r"(or|\|\|)", conditional): + conditional = 1 + else: + warn( + "Token '%s' is not a valid conditional " + "in filter expression '%s'" % (conditional, expression) + ) + + expression_1 = self._parse_filter_tokens(expression, tokens[0:3]) + expression_2 = self._parse_filter_tokens(expression, tokens[4:7]) + + return expression_1 + [conditional] + expression_2 + else: + return self._parse_filter_tokens(expression, tokens) + + def _parse_filter_tokens(self, expression, tokens): + # Parse the 3 tokens of a filter expression and return the operator + # and token. The use of numbers instead of operators is a legacy of + # Spreadsheet::WriteExcel. + operators = { + "==": 2, + "=": 2, + "=~": 2, + "eq": 2, + "!=": 5, + "!~": 5, + "ne": 5, + "<>": 5, + "<": 1, + "<=": 3, + ">": 4, + ">=": 6, + } + + operator = operators.get(tokens[1], None) + token = tokens[2] + + # Special handling of "Top" filter expressions. + if re.match("top|bottom", tokens[0].lower()): + value = int(tokens[1]) + + if value < 1 or value > 500: + warn( + "The value '%d' in expression '%s' " + "must be in the range 1 to 500" % (value, expression) + ) + + token = token.lower() + + if token != "items" and token != "%": + warn( + "The type '%s' in expression '%s' " + "must be either 'items' or '%%'" % (token, expression) + ) + + if tokens[0].lower() == "top": + operator = 30 + else: + operator = 32 + + if tokens[2] == "%": + operator += 1 + + token = str(value) + + if not operator and tokens[0]: + warn( + "Token '%s' is not a valid operator " + "in filter expression '%s'" % (token[0], expression) + ) + + # Special handling for Blanks/NonBlanks. + if re.match("blanks|nonblanks", token.lower()): + # Only allow Equals or NotEqual in this context. + if operator != 2 and operator != 5: + warn( + "The operator '%s' in expression '%s' " + "is not valid in relation to Blanks/NonBlanks'" + % (tokens[1], expression) + ) + + token = token.lower() + + # The operator should always be 2 (=) to flag a "simple" equality + # in the binary record. Therefore we convert <> to =. + if token == "blanks": + if operator == 5: + token = " " + else: + if operator == 5: + operator = 2 + token = "blanks" + else: + operator = 5 + token = " " + + # if the string token contains an Excel match character then change the + # operator type to indicate a non "simple" equality. + if operator == 2 and re.search("[*?]", token): + operator = 22 + + return [operator, token] + + def _encode_password(self, password): + # Hash a worksheet password. Based on the algorithm in + # ECMA-376-4:2016, Office Open XML File Formats — Transitional + # Migration Features, Additional attributes for workbookProtection + # element (Part 1, §18.2.29). + hash = 0x0000 + + for char in password[::-1]: + hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7FFF) + hash ^= ord(char) + + hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7FFF) + hash ^= len(password) + hash ^= 0xCE4B + + return "%X" % hash + + def _prepare_image( + self, + index, + image_id, + drawing_id, + width, + height, + name, + image_type, + x_dpi, + y_dpi, + digest, + ): + # Set up images/drawings. + drawing_type = 2 + ( + row, + col, + _, + x_offset, + y_offset, + x_scale, + y_scale, + url, + tip, + anchor, + _, + description, + decorative, + ) = self.images[index] + + width *= x_scale + height *= y_scale + + # Scale by non 96dpi resolutions. + width *= 96.0 / x_dpi + height *= 96.0 / y_dpi + + dimensions = self._position_object_emus( + col, row, x_offset, y_offset, width, height, anchor + ) + # Convert from pixels to emus. + width = int(0.5 + (width * 9525)) + height = int(0.5 + (height * 9525)) + + # Create a Drawing obj to use with worksheet unless one already exists. + if not self.drawing: + drawing = Drawing() + drawing.embedded = 1 + self.drawing = drawing + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml", None] + ) + else: + drawing = self.drawing + + drawing_object = drawing._add_drawing_object() + drawing_object["type"] = drawing_type + drawing_object["dimensions"] = dimensions + drawing_object["width"] = width + drawing_object["height"] = height + drawing_object["description"] = name + drawing_object["shape"] = None + drawing_object["anchor"] = anchor + drawing_object["rel_index"] = 0 + drawing_object["url_rel_index"] = 0 + drawing_object["tip"] = tip + drawing_object["decorative"] = decorative + + if description is not None: + drawing_object["description"] = description + + if url: + target = None + rel_type = "/hyperlink" + target_mode = "External" + + if re.match("(ftp|http)s?://", url): + target = self._escape_url(url) + + if re.match("^mailto:", url): + target = self._escape_url(url) + + if re.match("external:", url): + target = url.replace("external:", "") + target = self._escape_url(target) + # Additional escape not required in worksheet hyperlinks. + target = target.replace("#", "%23") + + if re.match(r"\w:", target) or re.match(r"\\", target): + target = "file:///" + target + else: + target = target.replace("\\", "/") + + if re.match("internal:", url): + target = url.replace("internal:", "#") + target_mode = None + + if target is not None: + if len(target) > self.max_url_length: + warn( + "Ignoring URL '%s' with link and/or anchor > %d " + "characters since it exceeds Excel's limit for URLS" + % (url, self.max_url_length) + ) + else: + if not self.drawing_rels.get(url): + self.drawing_links.append([rel_type, target, target_mode]) + + drawing_object["url_rel_index"] = self._get_drawing_rel_index(url) + + if not self.drawing_rels.get(digest): + self.drawing_links.append( + ["/image", "../media/image" + str(image_id) + "." + image_type] + ) + + drawing_object["rel_index"] = self._get_drawing_rel_index(digest) + + def _prepare_shape(self, index, drawing_id): + # Set up shapes/drawings. + drawing_type = 3 + + ( + row, + col, + x_offset, + y_offset, + x_scale, + y_scale, + text, + anchor, + options, + description, + decorative, + ) = self.shapes[index] + + width = options.get("width", self.default_col_pixels * 3) + height = options.get("height", self.default_row_pixels * 6) + + width *= x_scale + height *= y_scale + + dimensions = self._position_object_emus( + col, row, x_offset, y_offset, width, height, anchor + ) + + # Convert from pixels to emus. + width = int(0.5 + (width * 9525)) + height = int(0.5 + (height * 9525)) + + # Create a Drawing obj to use with worksheet unless one already exists. + if not self.drawing: + drawing = Drawing() + drawing.embedded = 1 + self.drawing = drawing + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml", None] + ) + else: + drawing = self.drawing + + shape = Shape("rect", "TextBox", options) + shape.text = text + + drawing_object = drawing._add_drawing_object() + drawing_object["type"] = drawing_type + drawing_object["dimensions"] = dimensions + drawing_object["width"] = width + drawing_object["height"] = height + drawing_object["description"] = description + drawing_object["shape"] = shape + drawing_object["anchor"] = anchor + drawing_object["rel_index"] = 0 + drawing_object["url_rel_index"] = 0 + drawing_object["tip"] = options.get("tip") + drawing_object["decorative"] = decorative + + url = options.get("url", None) + if url: + target = None + rel_type = "/hyperlink" + target_mode = "External" + + if re.match("(ftp|http)s?://", url): + target = self._escape_url(url) + + if re.match("^mailto:", url): + target = self._escape_url(url) + + if re.match("external:", url): + target = url.replace("external:", "file:///") + target = self._escape_url(target) + # Additional escape not required in worksheet hyperlinks. + target = target.replace("#", "%23") + + if re.match("internal:", url): + target = url.replace("internal:", "#") + target_mode = None + + if target is not None: + if len(target) > self.max_url_length: + warn( + "Ignoring URL '%s' with link and/or anchor > %d " + "characters since it exceeds Excel's limit for URLS" + % (url, self.max_url_length) + ) + else: + if not self.drawing_rels.get(url): + self.drawing_links.append([rel_type, target, target_mode]) + + drawing_object["url_rel_index"] = self._get_drawing_rel_index(url) + + def _prepare_header_image( + self, image_id, width, height, name, image_type, position, x_dpi, y_dpi, digest + ): + # Set up an image without a drawing object for header/footer images. + + # Strip the extension from the filename. + name = re.sub(r"\..*$", "", name) + + if not self.vml_drawing_rels.get(digest): + self.vml_drawing_links.append( + ["/image", "../media/image" + str(image_id) + "." + image_type] + ) + + ref_id = self._get_vml_drawing_rel_index(digest) + + self.header_images_list.append( + [width, height, name, position, x_dpi, y_dpi, ref_id] + ) + + def _prepare_background(self, image_id, image_type): + # Set up an image without a drawing object for backgrounds. + self.external_background_links.append( + ["/image", "../media/image" + str(image_id) + "." + image_type] + ) + + def _prepare_chart(self, index, chart_id, drawing_id): + # Set up chart/drawings. + drawing_type = 1 + + ( + row, + col, + chart, + x_offset, + y_offset, + x_scale, + y_scale, + anchor, + description, + decorative, + ) = self.charts[index] + + chart.id = chart_id - 1 + + # Use user specified dimensions, if any. + width = int(0.5 + (chart.width * x_scale)) + height = int(0.5 + (chart.height * y_scale)) + + dimensions = self._position_object_emus( + col, row, x_offset, y_offset, width, height, anchor + ) + + # Set the chart name for the embedded object if it has been specified. + name = chart.chart_name + + # Create a Drawing obj to use with worksheet unless one already exists. + if not self.drawing: + drawing = Drawing() + drawing.embedded = 1 + self.drawing = drawing + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml"] + ) + else: + drawing = self.drawing + + drawing_object = drawing._add_drawing_object() + drawing_object["type"] = drawing_type + drawing_object["dimensions"] = dimensions + drawing_object["width"] = width + drawing_object["height"] = height + drawing_object["name"] = name + drawing_object["shape"] = None + drawing_object["anchor"] = anchor + drawing_object["rel_index"] = self._get_drawing_rel_index() + drawing_object["url_rel_index"] = 0 + drawing_object["tip"] = None + drawing_object["description"] = description + drawing_object["decorative"] = decorative + + self.drawing_links.append( + ["/chart", "../charts/chart" + str(chart_id) + ".xml"] + ) + + def _position_object_emus( + self, col_start, row_start, x1, y1, width, height, anchor + ): + # Calculate the vertices that define the position of a graphical + # object within the worksheet in EMUs. + # + # The vertices are expressed as English Metric Units (EMUs). There are + # 12,700 EMUs per point. Therefore, 12,700 * 3 /4 = 9,525 EMUs per + # pixel + ( + col_start, + row_start, + x1, + y1, + col_end, + row_end, + x2, + y2, + x_abs, + y_abs, + ) = self._position_object_pixels( + col_start, row_start, x1, y1, width, height, anchor + ) + + # Convert the pixel values to EMUs. See above. + x1 = int(0.5 + 9525 * x1) + y1 = int(0.5 + 9525 * y1) + x2 = int(0.5 + 9525 * x2) + y2 = int(0.5 + 9525 * y2) + x_abs = int(0.5 + 9525 * x_abs) + y_abs = int(0.5 + 9525 * y_abs) + + return (col_start, row_start, x1, y1, col_end, row_end, x2, y2, x_abs, y_abs) + + # Calculate the vertices that define the position of a graphical object + # within the worksheet in pixels. + # + # +------------+------------+ + # | A | B | + # +-----+------------+------------+ + # | |(x1,y1) | | + # | 1 |(A1)._______|______ | + # | | | | | + # | | | | | + # +-----+----| OBJECT |-----+ + # | | | | | + # | 2 | |______________. | + # | | | (B2)| + # | | | (x2,y2)| + # +---- +------------+------------+ + # + # Example of an object that covers some of the area from cell A1 to B2. + # + # Based on the width and height of the object we need to calculate 8 vars: + # + # col_start, row_start, col_end, row_end, x1, y1, x2, y2. + # + # We also calculate the absolute x and y position of the top left vertex of + # the object. This is required for images. + # + # The width and height of the cells that the object occupies can be + # variable and have to be taken into account. + # + # The values of col_start and row_start are passed in from the calling + # function. The values of col_end and row_end are calculated by + # subtracting the width and height of the object from the width and + # height of the underlying cells. + # + def _position_object_pixels( + self, col_start, row_start, x1, y1, width, height, anchor + ): + # col_start # Col containing upper left corner of object. + # x1 # Distance to left side of object. + # + # row_start # Row containing top left corner of object. + # y1 # Distance to top of object. + # + # col_end # Col containing lower right corner of object. + # x2 # Distance to right side of object. + # + # row_end # Row containing bottom right corner of object. + # y2 # Distance to bottom of object. + # + # width # Width of object frame. + # height # Height of object frame. + # + # x_abs # Absolute distance to left side of object. + # y_abs # Absolute distance to top side of object. + x_abs = 0 + y_abs = 0 + + # Adjust start column for negative offsets. + while x1 < 0 and col_start > 0: + x1 += self._size_col(col_start - 1) + col_start -= 1 + + # Adjust start row for negative offsets. + while y1 < 0 and row_start > 0: + y1 += self._size_row(row_start - 1) + row_start -= 1 + + # Ensure that the image isn't shifted off the page at top left. + if x1 < 0: + x1 = 0 + + if y1 < 0: + y1 = 0 + + # Calculate the absolute x offset of the top-left vertex. + if self.col_size_changed: + for col_id in range(col_start): + x_abs += self._size_col(col_id) + else: + # Optimization for when the column widths haven't changed. + x_abs += self.default_col_pixels * col_start + + x_abs += x1 + + # Calculate the absolute y offset of the top-left vertex. + if self.row_size_changed: + for row_id in range(row_start): + y_abs += self._size_row(row_id) + else: + # Optimization for when the row heights haven't changed. + y_abs += self.default_row_pixels * row_start + + y_abs += y1 + + # Adjust start column for offsets that are greater than the col width. + while x1 >= self._size_col(col_start, anchor): + x1 -= self._size_col(col_start) + col_start += 1 + + # Adjust start row for offsets that are greater than the row height. + while y1 >= self._size_row(row_start, anchor): + y1 -= self._size_row(row_start) + row_start += 1 + + # Initialize end cell to the same as the start cell. + col_end = col_start + row_end = row_start + + # Don't offset the image in the cell if the row/col is hidden. + if self._size_col(col_start, anchor) > 0: + width = width + x1 + if self._size_row(row_start, anchor) > 0: + height = height + y1 + + # Subtract the underlying cell widths to find end cell of the object. + while width >= self._size_col(col_end, anchor): + width -= self._size_col(col_end, anchor) + col_end += 1 + + # Subtract the underlying cell heights to find end cell of the object. + while height >= self._size_row(row_end, anchor): + height -= self._size_row(row_end, anchor) + row_end += 1 + + # The end vertices are whatever is left from the width and height. + x2 = width + y2 = height + + return [col_start, row_start, x1, y1, col_end, row_end, x2, y2, x_abs, y_abs] + + def _size_col(self, col, anchor=0): + # Convert the width of a cell from character units to pixels. Excel + # rounds the column width to the nearest pixel. If the width hasn't + # been set by the user we use the default value. A hidden column is + # treated as having a width of zero unless it has the special + # "object_position" of 4 (size with cells). + max_digit_width = 7 # For Calibri 11. + padding = 5 + pixels = 0 + + # Look up the cell value to see if it has been changed. + if col in self.col_info: + width = self.col_info[col][0] + hidden = self.col_info[col][2] + + if width is None: + width = self.default_col_width + + # Convert to pixels. + if hidden and anchor != 4: + pixels = 0 + elif width < 1: + pixels = int(width * (max_digit_width + padding) + 0.5) + else: + pixels = int(width * max_digit_width + 0.5) + padding + else: + pixels = self.default_col_pixels + + return pixels + + def _size_row(self, row, anchor=0): + # Convert the height of a cell from character units to pixels. If the + # height hasn't been set by the user we use the default value. A + # hidden row is treated as having a height of zero unless it has the + # special "object_position" of 4 (size with cells). + pixels = 0 + + # Look up the cell value to see if it has been changed + if row in self.row_sizes: + height = self.row_sizes[row][0] + hidden = self.row_sizes[row][1] + + if hidden and anchor != 4: + pixels = 0 + else: + pixels = int(4.0 / 3.0 * height) + else: + pixels = int(4.0 / 3.0 * self.default_row_height) + + return pixels + + def _pixels_to_width(self, pixels): + # Convert the width of a cell from pixels to character units. + max_digit_width = 7.0 # For Calabri 11. + padding = 5.0 + + if pixels <= 12: + width = pixels / (max_digit_width + padding) + else: + width = (pixels - padding) / max_digit_width + + return width + + def _pixels_to_height(self, pixels): + # Convert the height of a cell from pixels to character units. + return 0.75 * pixels + + def _comment_params(self, row, col, string, options): + # This method handles the additional optional parameters to + # write_comment() as well as calculating the comment object + # position and vertices. + default_width = 128 + default_height = 74 + anchor = 0 + + params = { + "author": None, + "color": "#ffffe1", + "start_cell": None, + "start_col": None, + "start_row": None, + "visible": None, + "width": default_width, + "height": default_height, + "x_offset": None, + "x_scale": 1, + "y_offset": None, + "y_scale": 1, + "font_name": "Tahoma", + "font_size": 8, + "font_family": 2, + } + + # Overwrite the defaults with any user supplied values. Incorrect or + # misspelled parameters are silently ignored. + for key in options.keys(): + params[key] = options[key] + + # Ensure that a width and height have been set. + if not params["width"]: + params["width"] = default_width + if not params["height"]: + params["height"] = default_height + + # Set the comment background color. + params["color"] = xl_color(params["color"]).lower() + + # Convert from Excel XML style color to XML html style color. + params["color"] = params["color"].replace("ff", "#", 1) + + # Convert a cell reference to a row and column. + if params["start_cell"] is not None: + (start_row, start_col) = xl_cell_to_rowcol(params["start_cell"]) + params["start_row"] = start_row + params["start_col"] = start_col + + # Set the default start cell and offsets for the comment. These are + # generally fixed in relation to the parent cell. However there are + # some edge cases for cells at the, er, edges. + row_max = self.xls_rowmax + col_max = self.xls_colmax + + if params["start_row"] is None: + if row == 0: + params["start_row"] = 0 + elif row == row_max - 3: + params["start_row"] = row_max - 7 + elif row == row_max - 2: + params["start_row"] = row_max - 6 + elif row == row_max - 1: + params["start_row"] = row_max - 5 + else: + params["start_row"] = row - 1 + + if params["y_offset"] is None: + if row == 0: + params["y_offset"] = 2 + elif row == row_max - 3: + params["y_offset"] = 16 + elif row == row_max - 2: + params["y_offset"] = 16 + elif row == row_max - 1: + params["y_offset"] = 14 + else: + params["y_offset"] = 10 + + if params["start_col"] is None: + if col == col_max - 3: + params["start_col"] = col_max - 6 + elif col == col_max - 2: + params["start_col"] = col_max - 5 + elif col == col_max - 1: + params["start_col"] = col_max - 4 + else: + params["start_col"] = col + 1 + + if params["x_offset"] is None: + if col == col_max - 3: + params["x_offset"] = 49 + elif col == col_max - 2: + params["x_offset"] = 49 + elif col == col_max - 1: + params["x_offset"] = 49 + else: + params["x_offset"] = 15 + + # Scale the size of the comment box if required. + if params["x_scale"]: + params["width"] = params["width"] * params["x_scale"] + + if params["y_scale"]: + params["height"] = params["height"] * params["y_scale"] + + # Round the dimensions to the nearest pixel. + params["width"] = int(0.5 + params["width"]) + params["height"] = int(0.5 + params["height"]) + + # Calculate the positions of the comment object. + vertices = self._position_object_pixels( + params["start_col"], + params["start_row"], + params["x_offset"], + params["y_offset"], + params["width"], + params["height"], + anchor, + ) + + # Add the width and height for VML. + vertices.append(params["width"]) + vertices.append(params["height"]) + + return [ + row, + col, + string, + params["author"], + params["visible"], + params["color"], + params["font_name"], + params["font_size"], + params["font_family"], + ] + [vertices] + + def _button_params(self, row, col, options): + # This method handles the parameters passed to insert_button() as well + # as calculating the button object position and vertices. + + default_height = self.default_row_pixels + default_width = self.default_col_pixels + anchor = 0 + + button_number = 1 + len(self.buttons_list) + button = {"row": row, "col": col, "font": {}} + params = {} + + # Overwrite the defaults with any user supplied values. Incorrect or + # misspelled parameters are silently ignored. + for key in options.keys(): + params[key] = options[key] + + # Set the button caption. + caption = params.get("caption") + + # Set a default caption if none was specified by user. + if caption is None: + caption = "Button %d" % button_number + + button["font"]["caption"] = caption + + # Set the macro name. + if params.get("macro"): + button["macro"] = "[0]!" + params["macro"] + else: + button["macro"] = "[0]!Button%d_Click" % button_number + + # Set the alt text for the button. + button["description"] = params.get("description") + + # Ensure that a width and height have been set. + params["width"] = params.get("width", default_width) + params["height"] = params.get("height", default_height) + + # Set the x/y offsets. + params["x_offset"] = params.get("x_offset", 0) + params["y_offset"] = params.get("y_offset", 0) + + # Scale the size of the button if required. + params["width"] = params["width"] * params.get("x_scale", 1) + params["height"] = params["height"] * params.get("y_scale", 1) + + # Round the dimensions to the nearest pixel. + params["width"] = int(0.5 + params["width"]) + params["height"] = int(0.5 + params["height"]) + + params["start_row"] = row + params["start_col"] = col + + # Calculate the positions of the button object. + vertices = self._position_object_pixels( + params["start_col"], + params["start_row"], + params["x_offset"], + params["y_offset"], + params["width"], + params["height"], + anchor, + ) + + # Add the width and height for VML. + vertices.append(params["width"]) + vertices.append(params["height"]) + + button["vertices"] = vertices + + return button + + def _prepare_vml_objects( + self, vml_data_id, vml_shape_id, vml_drawing_id, comment_id + ): + comments = [] + # Sort the comments into row/column order for easier comparison + # testing and set the external links for comments and buttons. + row_nums = sorted(self.comments.keys()) + + for row in row_nums: + col_nums = sorted(self.comments[row].keys()) + + for col in col_nums: + user_options = self.comments[row][col] + params = self._comment_params(*user_options) + self.comments[row][col] = params + + # Set comment visibility if required and not user defined. + if self.comments_visible: + if self.comments[row][col][4] is None: + self.comments[row][col][4] = 1 + + # Set comment author if not already user defined. + if self.comments[row][col][3] is None: + self.comments[row][col][3] = self.comments_author + + comments.append(self.comments[row][col]) + + self.external_vml_links.append( + ["/vmlDrawing", "../drawings/vmlDrawing" + str(vml_drawing_id) + ".vml"] + ) + + if self.has_comments: + self.comments_list = comments + + self.external_comment_links.append( + ["/comments", "../comments" + str(comment_id) + ".xml"] + ) + + count = len(comments) + start_data_id = vml_data_id + + # The VML o:idmap data id contains a comma separated range when there + # is more than one 1024 block of comments, like this: data="1,2". + for i in range(int(count / 1024)): + vml_data_id = "%s,%d" % (vml_data_id, start_data_id + i + 1) + + self.vml_data_id = vml_data_id + self.vml_shape_id = vml_shape_id + + return count + + def _prepare_header_vml_objects(self, vml_header_id, vml_drawing_id): + # Set up external linkage for VML header/footer images. + + self.vml_header_id = vml_header_id + + self.external_vml_links.append( + ["/vmlDrawing", "../drawings/vmlDrawing" + str(vml_drawing_id) + ".vml"] + ) + + def _prepare_tables(self, table_id, seen): + # Set the table ids for the worksheet tables. + for table in self.tables: + table["id"] = table_id + + if table.get("name") is None: + # Set a default name. + table["name"] = "Table" + str(table_id) + + # Check for duplicate table names. + name = table["name"].lower() + + if name in seen: + raise DuplicateTableName( + "Duplicate name '%s' used in worksheet.add_table()." % table["name"] + ) + else: + seen[name] = True + + # Store the link used for the rels file. + self.external_table_links.append( + ["/table", "../tables/table" + str(table_id) + ".xml"] + ) + table_id += 1 + + def _table_function_to_formula(self, function, col_name): + # Convert a table total function to a worksheet formula. + formula = "" + + # Escape special characters, as required by Excel. + col_name = col_name.replace("'", "''") + col_name = col_name.replace("#", "'#") + col_name = col_name.replace("]", "']") + col_name = col_name.replace("[", "'[") + + subtotals = { + "average": 101, + "countNums": 102, + "count": 103, + "max": 104, + "min": 105, + "stdDev": 107, + "sum": 109, + "var": 110, + } + + if function in subtotals: + func_num = subtotals[function] + formula = "SUBTOTAL(%s,[%s])" % (func_num, col_name) + else: + warn("Unsupported function '%s' in add_table()" % function) + + return formula + + def _set_spark_color(self, sparkline, options, user_color): + # Set the sparkline color. + if user_color not in options: + return + + sparkline[user_color] = {"rgb": xl_color(options[user_color])} + + def _get_range_data(self, row_start, col_start, row_end, col_end): + # Returns a range of data from the worksheet _table to be used in + # chart cached data. Strings are returned as SST ids and decoded + # in the workbook. Return None for data that doesn't exist since + # Excel can chart series with data missing. + + if self.constant_memory: + return () + + data = [] + + # Iterate through the table data. + for row_num in range(row_start, row_end + 1): + # Store None if row doesn't exist. + if row_num not in self.table: + data.append(None) + continue + + for col_num in range(col_start, col_end + 1): + if col_num in self.table[row_num]: + cell = self.table[row_num][col_num] + + cell_type = cell.__class__.__name__ + + if cell_type in ("Number", "Datetime"): + # Return a number with Excel's precision. + data.append("%.16g" % cell.number) + + elif cell_type == "String": + # Return a string from it's shared string index. + index = cell.string + string = self.str_table._get_shared_string(index) + + data.append(string) + + elif cell_type in ("Formula", "ArrayFormula"): + # Return the formula value. + value = cell.value + + if value is None: + value = 0 + + data.append(value) + + elif cell_type == "Blank": + # Return a empty cell. + data.append("") + else: + # Store None if column doesn't exist. + data.append(None) + + return data + + def _csv_join(self, *items): + # Create a csv string for use with data validation formulas and lists. + + # Convert non string types to string. + items = [str(item) if not isinstance(item, str) else item for item in items] + + return ",".join(items) + + def _escape_url(self, url): + # Don't escape URL if it looks already escaped. + if re.search("%[0-9a-fA-F]{2}", url): + return url + + # Can't use url.quote() here because it doesn't match Excel. + url = url.replace("%", "%25") + url = url.replace('"', "%22") + url = url.replace(" ", "%20") + url = url.replace("<", "%3c") + url = url.replace(">", "%3e") + url = url.replace("[", "%5b") + url = url.replace("]", "%5d") + url = url.replace("^", "%5e") + url = url.replace("`", "%60") + url = url.replace("{", "%7b") + url = url.replace("}", "%7d") + + return url + + def _get_drawing_rel_index(self, target=None): + # Get the index used to address a drawing rel link. + if target is None: + self.drawing_rels_id += 1 + return self.drawing_rels_id + elif self.drawing_rels.get(target): + return self.drawing_rels[target] + else: + self.drawing_rels_id += 1 + self.drawing_rels[target] = self.drawing_rels_id + return self.drawing_rels_id + + def _get_vml_drawing_rel_index(self, target=None): + # Get the index used to address a vml drawing rel link. + if self.vml_drawing_rels.get(target): + return self.vml_drawing_rels[target] + else: + self.vml_drawing_rels_id += 1 + self.vml_drawing_rels[target] = self.vml_drawing_rels_id + return self.vml_drawing_rels_id + + ########################################################################### + # + # The following font methods are, more or less, duplicated from the + # Styles class. Not the cleanest version of reuse but works for now. + # + ########################################################################### + def _write_font(self, xf_format): + # Write the element. + xml_writer = self.rstring + + xml_writer._xml_start_tag("rPr") + + # Handle the main font properties. + if xf_format.bold: + xml_writer._xml_empty_tag("b") + if xf_format.italic: + xml_writer._xml_empty_tag("i") + if xf_format.font_strikeout: + xml_writer._xml_empty_tag("strike") + if xf_format.font_outline: + xml_writer._xml_empty_tag("outline") + if xf_format.font_shadow: + xml_writer._xml_empty_tag("shadow") + + # Handle the underline variants. + if xf_format.underline: + self._write_underline(xf_format.underline) + + # Handle super/subscript. + if xf_format.font_script == 1: + self._write_vert_align("superscript") + if xf_format.font_script == 2: + self._write_vert_align("subscript") + + # Write the font size + xml_writer._xml_empty_tag("sz", [("val", xf_format.font_size)]) + + # Handle colors. + if xf_format.theme == -1: + # Ignore for excel2003_style. + pass + elif xf_format.theme: + self._write_color("theme", xf_format.theme) + elif xf_format.color_indexed: + self._write_color("indexed", xf_format.color_indexed) + elif xf_format.font_color: + color = self._get_palette_color(xf_format.font_color) + self._write_rstring_color("rgb", color) + else: + self._write_rstring_color("theme", 1) + + # Write some other font properties related to font families. + xml_writer._xml_empty_tag("rFont", [("val", xf_format.font_name)]) + xml_writer._xml_empty_tag("family", [("val", xf_format.font_family)]) + + if xf_format.font_name == "Calibri" and not xf_format.hyperlink: + xml_writer._xml_empty_tag("scheme", [("val", xf_format.font_scheme)]) + + xml_writer._xml_end_tag("rPr") + + def _write_underline(self, underline): + # Write the underline font element. + attributes = [] + + # Handle the underline variants. + if underline == 2: + attributes = [("val", "double")] + elif underline == 33: + attributes = [("val", "singleAccounting")] + elif underline == 34: + attributes = [("val", "doubleAccounting")] + + self.rstring._xml_empty_tag("u", attributes) + + def _write_vert_align(self, val): + # Write the font sub-element. + attributes = [("val", val)] + + self.rstring._xml_empty_tag("vertAlign", attributes) + + def _write_rstring_color(self, name, value): + # Write the element. + attributes = [(name, value)] + + self.rstring._xml_empty_tag("color", attributes) + + def _get_palette_color(self, color): + # Convert the RGB color. + if color[0] == "#": + color = color[1:] + + return "FF" + color.upper() + + def _opt_close(self): + # Close the row data filehandle in constant_memory mode. + if not self.row_data_fh_closed: + self.row_data_fh.close() + self.row_data_fh_closed = True + + def _opt_reopen(self): + # Reopen the row data filehandle in constant_memory mode. + if self.row_data_fh_closed: + filename = self.row_data_filename + self.row_data_fh = open(filename, mode="a+", encoding="utf-8") + self.row_data_fh_closed = False + self.fh = self.row_data_fh + + def _set_icon_props(self, total_icons, user_props=None): + # Set the sub-properties for icons. + props = [] + + # Set the defaults. + for _ in range(total_icons): + props.append({"criteria": False, "value": 0, "type": "percent"}) + + # Set the default icon values based on the number of icons. + if total_icons == 3: + props[0]["value"] = 67 + props[1]["value"] = 33 + + if total_icons == 4: + props[0]["value"] = 75 + props[1]["value"] = 50 + props[2]["value"] = 25 + + if total_icons == 5: + props[0]["value"] = 80 + props[1]["value"] = 60 + props[2]["value"] = 40 + props[3]["value"] = 20 + + # Overwrite default properties with user defined properties. + if user_props: + # Ensure we don't set user properties for lowest icon. + max_data = len(user_props) + if max_data >= total_icons: + max_data = total_icons - 1 + + for i in range(max_data): + # Set the user defined 'value' property. + if user_props[i].get("value") is not None: + props[i]["value"] = user_props[i]["value"] + + # Remove the formula '=' sign if it exists. + tmp = props[i]["value"] + if isinstance(tmp, str) and tmp.startswith("="): + props[i]["value"] = tmp.lstrip("=") + + # Set the user defined 'type' property. + if user_props[i].get("type"): + valid_types = ("percent", "percentile", "number", "formula") + + if user_props[i]["type"] not in valid_types: + warn( + "Unknown icon property type '%s' for sub-" + "property 'type' in conditional_format()" + % user_props[i]["type"] + ) + else: + props[i]["type"] = user_props[i]["type"] + + if props[i]["type"] == "number": + props[i]["type"] = "num" + + # Set the user defined 'criteria' property. + criteria = user_props[i].get("criteria") + if criteria and criteria == ">": + props[i]["criteria"] = True + + return props + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_worksheet(self): + # Write the element. This is the root element. + + schema = "http://schemas.openxmlformats.org/" + xmlns = schema + "spreadsheetml/2006/main" + xmlns_r = schema + "officeDocument/2006/relationships" + xmlns_mc = schema + "markup-compatibility/2006" + ms_schema = "http://schemas.microsoft.com/" + xmlns_x14ac = ms_schema + "office/spreadsheetml/2009/9/ac" + + attributes = [("xmlns", xmlns), ("xmlns:r", xmlns_r)] + + # Add some extra attributes for Excel 2010. Mainly for sparklines. + if self.excel_version == 2010: + attributes.append(("xmlns:mc", xmlns_mc)) + attributes.append(("xmlns:x14ac", xmlns_x14ac)) + attributes.append(("mc:Ignorable", "x14ac")) + + self._xml_start_tag("worksheet", attributes) + + def _write_dimension(self): + # Write the element. This specifies the range of + # cells in the worksheet. As a special case, empty + # spreadsheets use 'A1' as a range. + + if self.dim_rowmin is None and self.dim_colmin is None: + # If the min dimensions are not defined then no dimensions + # have been set and we use the default 'A1'. + ref = "A1" + + elif self.dim_rowmin is None and self.dim_colmin is not None: + # If the row dimensions aren't set but the column + # dimensions are set then they have been changed via + # set_column(). + + if self.dim_colmin == self.dim_colmax: + # The dimensions are a single cell and not a range. + ref = xl_rowcol_to_cell(0, self.dim_colmin) + else: + # The dimensions are a cell range. + cell_1 = xl_rowcol_to_cell(0, self.dim_colmin) + cell_2 = xl_rowcol_to_cell(0, self.dim_colmax) + ref = cell_1 + ":" + cell_2 + + elif self.dim_rowmin == self.dim_rowmax and self.dim_colmin == self.dim_colmax: + # The dimensions are a single cell and not a range. + ref = xl_rowcol_to_cell(self.dim_rowmin, self.dim_colmin) + else: + # The dimensions are a cell range. + cell_1 = xl_rowcol_to_cell(self.dim_rowmin, self.dim_colmin) + cell_2 = xl_rowcol_to_cell(self.dim_rowmax, self.dim_colmax) + ref = cell_1 + ":" + cell_2 + + self._xml_empty_tag("dimension", [("ref", ref)]) + + def _write_sheet_views(self): + # Write the element. + self._xml_start_tag("sheetViews") + + # Write the sheetView element. + self._write_sheet_view() + + self._xml_end_tag("sheetViews") + + def _write_sheet_view(self): + # Write the element. + attributes = [] + + # Hide screen gridlines if required. + if not self.screen_gridlines: + attributes.append(("showGridLines", 0)) + + # Hide screen row/column headers. + if self.row_col_headers: + attributes.append(("showRowColHeaders", 0)) + + # Hide zeroes in cells. + if not self.show_zeros: + attributes.append(("showZeros", 0)) + + # Display worksheet right to left for Hebrew, Arabic and others. + if self.is_right_to_left: + attributes.append(("rightToLeft", 1)) + + # Show that the sheet tab is selected. + if self.selected: + attributes.append(("tabSelected", 1)) + + # Turn outlines off. Also required in the outlinePr element. + if not self.outline_on: + attributes.append(("showOutlineSymbols", 0)) + + # Set the page view/layout mode if required. + if self.page_view == 1: + attributes.append(("view", "pageLayout")) + elif self.page_view == 2: + attributes.append(("view", "pageBreakPreview")) + + # Set the first visible cell. + if self.top_left_cell != "": + attributes.append(("topLeftCell", self.top_left_cell)) + + # Set the zoom level. + if self.zoom != 100: + attributes.append(("zoomScale", self.zoom)) + + if self.page_view == 0 and self.zoom_scale_normal: + attributes.append(("zoomScaleNormal", self.zoom)) + if self.page_view == 1: + attributes.append(("zoomScalePageLayoutView", self.zoom)) + if self.page_view == 2: + attributes.append(("zoomScaleSheetLayoutView", self.zoom)) + + attributes.append(("workbookViewId", 0)) + + if self.panes or len(self.selections): + self._xml_start_tag("sheetView", attributes) + self._write_panes() + self._write_selections() + self._xml_end_tag("sheetView") + else: + self._xml_empty_tag("sheetView", attributes) + + def _write_sheet_format_pr(self): + # Write the element. + default_row_height = self.default_row_height + row_level = self.outline_row_level + col_level = self.outline_col_level + + attributes = [("defaultRowHeight", default_row_height)] + + if self.default_row_height != self.original_row_height: + attributes.append(("customHeight", 1)) + + if self.default_row_zeroed: + attributes.append(("zeroHeight", 1)) + + if row_level: + attributes.append(("outlineLevelRow", row_level)) + if col_level: + attributes.append(("outlineLevelCol", col_level)) + + if self.excel_version == 2010: + attributes.append(("x14ac:dyDescent", "0.25")) + + self._xml_empty_tag("sheetFormatPr", attributes) + + def _write_cols(self): + # Write the element and
sub elements. + + # Exit unless some column have been formatted. + if not self.col_info: + return + + self._xml_start_tag("cols") + + # Use the first element of the column information structures to set + # the initial/previous properties. + first_col = (sorted(self.col_info.keys()))[0] + last_col = first_col + prev_col_options = self.col_info[first_col] + del self.col_info[first_col] + deleted_col = first_col + deleted_col_options = prev_col_options + + for col in sorted(self.col_info.keys()): + col_options = self.col_info[col] + # Check if the column number is contiguous with the previous + # column and if the properties are the same. + if col == last_col + 1 and col_options == prev_col_options: + last_col = col + else: + # If not contiguous/equal then we write out the current range + # of columns and start again. + self._write_col_info(first_col, last_col, prev_col_options) + first_col = col + last_col = first_col + prev_col_options = col_options + + # We will exit the previous loop with one unhandled column range. + self._write_col_info(first_col, last_col, prev_col_options) + + # Put back the deleted first column information structure. + self.col_info[deleted_col] = deleted_col_options + + self._xml_end_tag("cols") + + def _write_col_info(self, col_min, col_max, col_info): + # Write the element. + (width, cell_format, hidden, level, collapsed, autofit) = col_info + + custom_width = 1 + xf_index = 0 + + # Get the cell_format index. + if cell_format: + xf_index = cell_format._get_xf_index() + + # Set the Excel default column width. + if width is None: + if not hidden: + width = 8.43 + custom_width = 0 + else: + width = 0 + elif width == 8.43: + # Width is defined but same as default. + custom_width = 0 + + # Convert column width from user units to character width. + if width > 0: + # For Calabri 11. + max_digit_width = 7 + padding = 5 + + if width < 1: + width = ( + int( + (int(width * (max_digit_width + padding) + 0.5)) + / float(max_digit_width) + * 256.0 + ) + / 256.0 + ) + else: + width = ( + int( + (int(width * max_digit_width + 0.5) + padding) + / float(max_digit_width) + * 256.0 + ) + / 256.0 + ) + + attributes = [ + ("min", col_min + 1), + ("max", col_max + 1), + ("width", "%.16g" % width), + ] + + if xf_index: + attributes.append(("style", xf_index)) + if hidden: + attributes.append(("hidden", "1")) + if autofit: + attributes.append(("bestFit", "1")) + if custom_width: + attributes.append(("customWidth", "1")) + if level: + attributes.append(("outlineLevel", level)) + if collapsed: + attributes.append(("collapsed", "1")) + + self._xml_empty_tag("col", attributes) + + def _write_sheet_data(self): + # Write the element. + + if self.dim_rowmin is None: + # If the dimensions aren't defined there is no data to write. + self._xml_empty_tag("sheetData") + else: + self._xml_start_tag("sheetData") + self._write_rows() + self._xml_end_tag("sheetData") + + def _write_optimized_sheet_data(self): + # Write the element when constant_memory is on. In this + # case we read the data stored in the temp file and rewrite it to the + # XML sheet file. + if self.dim_rowmin is None: + # If the dimensions aren't defined then there is no data to write. + self._xml_empty_tag("sheetData") + else: + self._xml_start_tag("sheetData") + + # Rewind the filehandle that was used for temp row data. + buff_size = 65536 + self.row_data_fh.seek(0) + data = self.row_data_fh.read(buff_size) + + while data: + self.fh.write(data) + data = self.row_data_fh.read(buff_size) + + self.row_data_fh.close() + os.unlink(self.row_data_filename) + + self._xml_end_tag("sheetData") + + def _write_page_margins(self): + # Write the element. + attributes = [ + ("left", self.margin_left), + ("right", self.margin_right), + ("top", self.margin_top), + ("bottom", self.margin_bottom), + ("header", self.margin_header), + ("footer", self.margin_footer), + ] + + self._xml_empty_tag("pageMargins", attributes) + + def _write_page_setup(self): + # Write the element. + # + # The following is an example taken from Excel. + # + # + # + attributes = [] + + # Skip this element if no page setup has changed. + if not self.page_setup_changed: + return + + # Set paper size. + if self.paper_size: + attributes.append(("paperSize", self.paper_size)) + + # Set the print_scale. + if self.print_scale != 100: + attributes.append(("scale", self.print_scale)) + + # Set the "Fit to page" properties. + if self.fit_page and self.fit_width != 1: + attributes.append(("fitToWidth", self.fit_width)) + + if self.fit_page and self.fit_height != 1: + attributes.append(("fitToHeight", self.fit_height)) + + # Set the page print direction. + if self.page_order: + attributes.append(("pageOrder", "overThenDown")) + + # Set start page for printing. + if self.page_start > 1: + attributes.append(("firstPageNumber", self.page_start)) + + # Set page orientation. + if self.orientation: + attributes.append(("orientation", "portrait")) + else: + attributes.append(("orientation", "landscape")) + + # Set the print in black and white option. + if self.black_white: + attributes.append(("blackAndWhite", "1")) + + # Set start page for printing. + if self.page_start != 0: + attributes.append(("useFirstPageNumber", "1")) + + # Set the DPI. Mainly only for testing. + if self.is_chartsheet: + if self.horizontal_dpi: + attributes.append(("horizontalDpi", self.horizontal_dpi)) + + if self.vertical_dpi: + attributes.append(("verticalDpi", self.vertical_dpi)) + else: + if self.vertical_dpi: + attributes.append(("verticalDpi", self.vertical_dpi)) + + if self.horizontal_dpi: + attributes.append(("horizontalDpi", self.horizontal_dpi)) + + self._xml_empty_tag("pageSetup", attributes) + + def _write_print_options(self): + # Write the element. + attributes = [] + + if not self.print_options_changed: + return + + # Set horizontal centering. + if self.hcenter: + attributes.append(("horizontalCentered", 1)) + + # Set vertical centering. + if self.vcenter: + attributes.append(("verticalCentered", 1)) + + # Enable row and column headers. + if self.print_headers: + attributes.append(("headings", 1)) + + # Set printed gridlines. + if self.print_gridlines: + attributes.append(("gridLines", 1)) + + self._xml_empty_tag("printOptions", attributes) + + def _write_header_footer(self): + # Write the element. + attributes = [] + + if not self.header_footer_scales: + attributes.append(("scaleWithDoc", 0)) + + if not self.header_footer_aligns: + attributes.append(("alignWithMargins", 0)) + + if self.header_footer_changed: + self._xml_start_tag("headerFooter", attributes) + if self.header: + self._write_odd_header() + if self.footer: + self._write_odd_footer() + self._xml_end_tag("headerFooter") + elif self.excel2003_style: + self._xml_empty_tag("headerFooter", attributes) + + def _write_odd_header(self): + # Write the element. + self._xml_data_element("oddHeader", self.header) + + def _write_odd_footer(self): + # Write the element. + self._xml_data_element("oddFooter", self.footer) + + def _write_rows(self): + # Write out the worksheet data as a series of rows and cells. + self._calculate_spans() + + for row_num in range(self.dim_rowmin, self.dim_rowmax + 1): + if ( + row_num in self.set_rows + or row_num in self.comments + or self.table[row_num] + ): + # Only process rows with formatting, cell data and/or comments. + + span_index = int(row_num / 16) + + if span_index in self.row_spans: + span = self.row_spans[span_index] + else: + span = None + + if self.table[row_num]: + # Write the cells if the row contains data. + if row_num not in self.set_rows: + self._write_row(row_num, span) + else: + self._write_row(row_num, span, self.set_rows[row_num]) + + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + col_ref = self.table[row_num][col_num] + self._write_cell(row_num, col_num, col_ref) + + self._xml_end_tag("row") + + elif row_num in self.comments: + # Row with comments in cells. + self._write_empty_row(row_num, span, self.set_rows[row_num]) + else: + # Blank row with attributes only. + self._write_empty_row(row_num, span, self.set_rows[row_num]) + + def _write_single_row(self, current_row_num=0): + # Write out the worksheet data as a single row with cells. + # This method is used when constant_memory is on. A single + # row is written and the data table is reset. That way only + # one row of data is kept in memory at any one time. We don't + # write span data in the optimized case since it is optional. + + # Set the new previous row as the current row. + row_num = self.previous_row + self.previous_row = current_row_num + + if row_num in self.set_rows or row_num in self.comments or self.table[row_num]: + # Only process rows with formatting, cell data and/or comments. + + # No span data in optimized mode. + span = None + + if self.table[row_num]: + # Write the cells if the row contains data. + if row_num not in self.set_rows: + self._write_row(row_num, span) + else: + self._write_row(row_num, span, self.set_rows[row_num]) + + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + col_ref = self.table[row_num][col_num] + self._write_cell(row_num, col_num, col_ref) + + self._xml_end_tag("row") + else: + # Row attributes or comments only. + self._write_empty_row(row_num, span, self.set_rows[row_num]) + + # Reset table. + self.table.clear() + + def _calculate_spans(self): + # Calculate the "spans" attribute of the tag. This is an + # XLSX optimization and isn't strictly required. However, it + # makes comparing files easier. The span is the same for each + # block of 16 rows. + spans = {} + span_min = None + span_max = None + + for row_num in range(self.dim_rowmin, self.dim_rowmax + 1): + if row_num in self.table: + # Calculate spans for cell data. + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + if span_min is None: + span_min = col_num + span_max = col_num + else: + if col_num < span_min: + span_min = col_num + if col_num > span_max: + span_max = col_num + + if row_num in self.comments: + # Calculate spans for comments. + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if row_num in self.comments and col_num in self.comments[row_num]: + if span_min is None: + span_min = col_num + span_max = col_num + else: + if col_num < span_min: + span_min = col_num + if col_num > span_max: + span_max = col_num + + if ((row_num + 1) % 16 == 0) or row_num == self.dim_rowmax: + span_index = int(row_num / 16) + + if span_min is not None: + span_min += 1 + span_max += 1 + spans[span_index] = "%s:%s" % (span_min, span_max) + span_min = None + + self.row_spans = spans + + def _write_row(self, row, spans, properties=None, empty_row=False): + # Write the element. + xf_index = 0 + + if properties: + height, cell_format, hidden, level, collapsed = properties + else: + height, cell_format, hidden, level, collapsed = None, None, 0, 0, 0 + + if height is None: + height = self.default_row_height + + attributes = [("r", row + 1)] + + # Get the cell_format index. + if cell_format: + xf_index = cell_format._get_xf_index() + + # Add row attributes where applicable. + if spans: + attributes.append(("spans", spans)) + + if xf_index: + attributes.append(("s", xf_index)) + + if cell_format: + attributes.append(("customFormat", 1)) + + if height != self.original_row_height: + attributes.append(("ht", "%g" % height)) + + if hidden: + attributes.append(("hidden", 1)) + + if height != self.original_row_height: + attributes.append(("customHeight", 1)) + + if level: + attributes.append(("outlineLevel", level)) + + if collapsed: + attributes.append(("collapsed", 1)) + + if self.excel_version == 2010: + attributes.append(("x14ac:dyDescent", "0.25")) + + if empty_row: + self._xml_empty_tag_unencoded("row", attributes) + else: + self._xml_start_tag_unencoded("row", attributes) + + def _write_empty_row(self, row, spans, properties=None): + # Write and empty element. + self._write_row(row, spans, properties, empty_row=True) + + def _write_cell(self, row, col, cell): + # Write the element. + # Note. This is the innermost loop so efficiency is important. + + cell_range = xl_rowcol_to_cell_fast(row, col) + attributes = [("r", cell_range)] + + if cell.format: + # Add the cell format index. + xf_index = cell.format._get_xf_index() + attributes.append(("s", xf_index)) + elif row in self.set_rows and self.set_rows[row][1]: + # Add the row format. + row_xf = self.set_rows[row][1] + attributes.append(("s", row_xf._get_xf_index())) + elif col in self.col_info: + # Add the column format. + col_xf = self.col_info[col][1] + if col_xf is not None: + attributes.append(("s", col_xf._get_xf_index())) + + type_cell_name = cell.__class__.__name__ + + # Write the various cell types. + if type_cell_name in ("Number", "Datetime"): + # Write a number. + self._xml_number_element(cell.number, attributes) + + elif type_cell_name in ("String", "RichString"): + # Write a string. + string = cell.string + + if not self.constant_memory: + # Write a shared string. + self._xml_string_element(string, attributes) + else: + # Write an optimized in-line string. + + # Escape control characters. See SharedString.pm for details. + string = re_control_chars_1.sub(r"_x005F\1", string) + string = re_control_chars_2.sub( + lambda match: "_x%04X_" % ord(match.group(1)), string + ) + + # Escapes non characters in strings. + string = string.replace("\uFFFE", "_xFFFE_") + string = string.replace("\uFFFF", "_xFFFF_") + + # Write any rich strings without further tags. + if string.startswith("") and string.endswith(""): + self._xml_rich_inline_string(string, attributes) + else: + # Add attribute to preserve leading or trailing whitespace. + preserve = preserve_whitespace(string) + self._xml_inline_string(string, preserve, attributes) + + elif type_cell_name == "Formula": + # Write a formula. First check the formula value type. + value = cell.value + if type(cell.value) == bool: + attributes.append(("t", "b")) + if cell.value: + value = 1 + else: + value = 0 + + elif isinstance(cell.value, str): + error_codes = ( + "#DIV/0!", + "#N/A", + "#NAME?", + "#NULL!", + "#NUM!", + "#REF!", + "#VALUE!", + ) + + if cell.value == "": + # Allow blank to force recalc in some third party apps. + pass + elif cell.value in error_codes: + attributes.append(("t", "e")) + else: + attributes.append(("t", "str")) + + self._xml_formula_element(cell.formula, value, attributes) + + elif type_cell_name == "ArrayFormula": + # Write a array formula. + + if cell.atype == "dynamic": + attributes.append(("cm", 1)) + + # First check if the formula value is a string. + try: + float(cell.value) + except ValueError: + attributes.append(("t", "str")) + + # Write an array formula. + self._xml_start_tag("c", attributes) + + self._write_cell_array_formula(cell.formula, cell.range) + self._write_cell_value(cell.value) + self._xml_end_tag("c") + + elif type_cell_name == "Blank": + # Write a empty cell. + self._xml_empty_tag("c", attributes) + + elif type_cell_name == "Boolean": + # Write a boolean cell. + attributes.append(("t", "b")) + self._xml_start_tag("c", attributes) + self._write_cell_value(cell.boolean) + self._xml_end_tag("c") + + def _write_cell_value(self, value): + # Write the cell value element. + if value is None: + value = "" + + self._xml_data_element("v", value) + + def _write_cell_array_formula(self, formula, cell_range): + # Write the cell array formula element. + attributes = [("t", "array"), ("ref", cell_range)] + + self._xml_data_element("f", formula, attributes) + + def _write_sheet_pr(self): + # Write the element for Sheet level properties. + attributes = [] + + if ( + not self.fit_page + and not self.filter_on + and not self.tab_color + and not self.outline_changed + and not self.vba_codename + ): + return + + if self.vba_codename: + attributes.append(("codeName", self.vba_codename)) + + if self.filter_on: + attributes.append(("filterMode", 1)) + + if self.fit_page or self.tab_color or self.outline_changed: + self._xml_start_tag("sheetPr", attributes) + self._write_tab_color() + self._write_outline_pr() + self._write_page_set_up_pr() + self._xml_end_tag("sheetPr") + else: + self._xml_empty_tag("sheetPr", attributes) + + def _write_page_set_up_pr(self): + # Write the element. + if not self.fit_page: + return + + attributes = [("fitToPage", 1)] + self._xml_empty_tag("pageSetUpPr", attributes) + + def _write_tab_color(self): + # Write the element. + color = self.tab_color + + if not color: + return + + attributes = [("rgb", color)] + + self._xml_empty_tag("tabColor", attributes) + + def _write_outline_pr(self): + # Write the element. + attributes = [] + + if not self.outline_changed: + return + + if self.outline_style: + attributes.append(("applyStyles", 1)) + if not self.outline_below: + attributes.append(("summaryBelow", 0)) + if not self.outline_right: + attributes.append(("summaryRight", 0)) + if not self.outline_on: + attributes.append(("showOutlineSymbols", 0)) + + self._xml_empty_tag("outlinePr", attributes) + + def _write_row_breaks(self): + # Write the element. + page_breaks = self._sort_pagebreaks(self.hbreaks) + + if not page_breaks: + return + + count = len(page_breaks) + + attributes = [ + ("count", count), + ("manualBreakCount", count), + ] + + self._xml_start_tag("rowBreaks", attributes) + + for row_num in page_breaks: + self._write_brk(row_num, 16383) + + self._xml_end_tag("rowBreaks") + + def _write_col_breaks(self): + # Write the element. + page_breaks = self._sort_pagebreaks(self.vbreaks) + + if not page_breaks: + return + + count = len(page_breaks) + + attributes = [ + ("count", count), + ("manualBreakCount", count), + ] + + self._xml_start_tag("colBreaks", attributes) + + for col_num in page_breaks: + self._write_brk(col_num, 1048575) + + self._xml_end_tag("colBreaks") + + def _write_brk(self, brk_id, brk_max): + # Write the element. + attributes = [("id", brk_id), ("max", brk_max), ("man", 1)] + + self._xml_empty_tag("brk", attributes) + + def _write_merge_cells(self): + # Write the element. + merged_cells = self.merge + count = len(merged_cells) + + if not count: + return + + attributes = [("count", count)] + + self._xml_start_tag("mergeCells", attributes) + + for merged_range in merged_cells: + # Write the mergeCell element. + self._write_merge_cell(merged_range) + + self._xml_end_tag("mergeCells") + + def _write_merge_cell(self, merged_range): + # Write the element. + (row_min, col_min, row_max, col_max) = merged_range + + # Convert the merge dimensions to a cell range. + cell_1 = xl_rowcol_to_cell(row_min, col_min) + cell_2 = xl_rowcol_to_cell(row_max, col_max) + ref = cell_1 + ":" + cell_2 + + attributes = [("ref", ref)] + + self._xml_empty_tag("mergeCell", attributes) + + def _write_hyperlinks(self): + # Process any stored hyperlinks in row/col order and write the + # element. The attributes are different for internal + # and external links. + hlink_refs = [] + display = None + + # Sort the hyperlinks into row order. + row_nums = sorted(self.hyperlinks.keys()) + + # Exit if there are no hyperlinks to process. + if not row_nums: + return + + # Iterate over the rows. + for row_num in row_nums: + # Sort the hyperlinks into column order. + col_nums = sorted(self.hyperlinks[row_num].keys()) + + # Iterate over the columns. + for col_num in col_nums: + # Get the link data for this cell. + link = self.hyperlinks[row_num][col_num] + link_type = link["link_type"] + + # If the cell isn't a string then we have to add the url as + # the string to display. + if self.table and self.table[row_num] and self.table[row_num][col_num]: + cell = self.table[row_num][col_num] + if cell.__class__.__name__ != "String": + display = link["url"] + + if link_type == 1: + # External link with rel file relationship. + self.rel_count += 1 + + hlink_refs.append( + [ + link_type, + row_num, + col_num, + self.rel_count, + link["str"], + display, + link["tip"], + ] + ) + + # Links for use by the packager. + self.external_hyper_links.append( + ["/hyperlink", link["url"], "External"] + ) + else: + # Internal link with rel file relationship. + hlink_refs.append( + [ + link_type, + row_num, + col_num, + link["url"], + link["str"], + link["tip"], + ] + ) + + # Write the hyperlink elements. + self._xml_start_tag("hyperlinks") + + for args in hlink_refs: + link_type = args.pop(0) + + if link_type == 1: + self._write_hyperlink_external(*args) + elif link_type == 2: + self._write_hyperlink_internal(*args) + + self._xml_end_tag("hyperlinks") + + def _write_hyperlink_external( + self, row, col, id_num, location=None, display=None, tooltip=None + ): + # Write the element for external links. + ref = xl_rowcol_to_cell(row, col) + r_id = "rId" + str(id_num) + + attributes = [("ref", ref), ("r:id", r_id)] + + if location is not None: + attributes.append(("location", location)) + if display is not None: + attributes.append(("display", display)) + if tooltip is not None: + attributes.append(("tooltip", tooltip)) + + self._xml_empty_tag("hyperlink", attributes) + + def _write_hyperlink_internal( + self, row, col, location=None, display=None, tooltip=None + ): + # Write the element for internal links. + ref = xl_rowcol_to_cell(row, col) + + attributes = [("ref", ref), ("location", location)] + + if tooltip is not None: + attributes.append(("tooltip", tooltip)) + attributes.append(("display", display)) + + self._xml_empty_tag("hyperlink", attributes) + + def _write_auto_filter(self): + # Write the element. + if not self.autofilter_ref: + return + + attributes = [("ref", self.autofilter_ref)] + + if self.filter_on: + # Autofilter defined active filters. + self._xml_start_tag("autoFilter", attributes) + self._write_autofilters() + self._xml_end_tag("autoFilter") + + else: + # Autofilter defined without active filters. + self._xml_empty_tag("autoFilter", attributes) + + def _write_autofilters(self): + # Function to iterate through the columns that form part of an + # autofilter range and write the appropriate filters. + (col1, col2) = self.filter_range + + for col in range(col1, col2 + 1): + # Skip if column doesn't have an active filter. + if col not in self.filter_cols: + continue + + # Retrieve the filter tokens and write the autofilter records. + tokens = self.filter_cols[col] + filter_type = self.filter_type[col] + + # Filters are relative to first column in the autofilter. + self._write_filter_column(col - col1, filter_type, tokens) + + def _write_filter_column(self, col_id, filter_type, filters): + # Write the element. + attributes = [("colId", col_id)] + + self._xml_start_tag("filterColumn", attributes) + + if filter_type == 1: + # Type == 1 is the new XLSX style filter. + self._write_filters(filters) + else: + # Type == 0 is the classic "custom" filter. + self._write_custom_filters(filters) + + self._xml_end_tag("filterColumn") + + def _write_filters(self, filters): + # Write the element. + non_blanks = [filter for filter in filters if str(filter).lower() != "blanks"] + attributes = [] + + if len(filters) != len(non_blanks): + attributes = [("blank", 1)] + + if len(filters) == 1 and len(non_blanks) == 0: + # Special case for blank cells only. + self._xml_empty_tag("filters", attributes) + else: + # General case. + self._xml_start_tag("filters", attributes) + + for autofilter in sorted(non_blanks): + self._write_filter(autofilter) + + self._xml_end_tag("filters") + + def _write_filter(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("filter", attributes) + + def _write_custom_filters(self, tokens): + # Write the element. + if len(tokens) == 2: + # One filter expression only. + self._xml_start_tag("customFilters") + self._write_custom_filter(*tokens) + self._xml_end_tag("customFilters") + else: + # Two filter expressions. + attributes = [] + + # Check if the "join" operand is "and" or "or". + if tokens[2] == 0: + attributes = [("and", 1)] + else: + attributes = [("and", 0)] + + # Write the two custom filters. + self._xml_start_tag("customFilters", attributes) + self._write_custom_filter(tokens[0], tokens[1]) + self._write_custom_filter(tokens[3], tokens[4]) + self._xml_end_tag("customFilters") + + def _write_custom_filter(self, operator, val): + # Write the element. + attributes = [] + + operators = { + 1: "lessThan", + 2: "equal", + 3: "lessThanOrEqual", + 4: "greaterThan", + 5: "notEqual", + 6: "greaterThanOrEqual", + 22: "equal", + } + + # Convert the operator from a number to a descriptive string. + if operators[operator] is not None: + operator = operators[operator] + else: + warn("Unknown operator = %s" % operator) + + # The 'equal' operator is the default attribute and isn't stored. + if operator != "equal": + attributes.append(("operator", operator)) + attributes.append(("val", val)) + + self._xml_empty_tag("customFilter", attributes) + + def _write_sheet_protection(self): + # Write the element. + attributes = [] + + if not self.protect_options: + return + + options = self.protect_options + + if options["password"]: + attributes.append(("password", options["password"])) + if options["sheet"]: + attributes.append(("sheet", 1)) + if options["content"]: + attributes.append(("content", 1)) + if not options["objects"]: + attributes.append(("objects", 1)) + if not options["scenarios"]: + attributes.append(("scenarios", 1)) + if options["format_cells"]: + attributes.append(("formatCells", 0)) + if options["format_columns"]: + attributes.append(("formatColumns", 0)) + if options["format_rows"]: + attributes.append(("formatRows", 0)) + if options["insert_columns"]: + attributes.append(("insertColumns", 0)) + if options["insert_rows"]: + attributes.append(("insertRows", 0)) + if options["insert_hyperlinks"]: + attributes.append(("insertHyperlinks", 0)) + if options["delete_columns"]: + attributes.append(("deleteColumns", 0)) + if options["delete_rows"]: + attributes.append(("deleteRows", 0)) + if not options["select_locked_cells"]: + attributes.append(("selectLockedCells", 1)) + if options["sort"]: + attributes.append(("sort", 0)) + if options["autofilter"]: + attributes.append(("autoFilter", 0)) + if options["pivot_tables"]: + attributes.append(("pivotTables", 0)) + if not options["select_unlocked_cells"]: + attributes.append(("selectUnlockedCells", 1)) + + self._xml_empty_tag("sheetProtection", attributes) + + def _write_protected_ranges(self): + # Write the element. + if self.num_protected_ranges == 0: + return + + self._xml_start_tag("protectedRanges") + + for cell_range, range_name, password in self.protected_ranges: + self._write_protected_range(cell_range, range_name, password) + + self._xml_end_tag("protectedRanges") + + def _write_protected_range(self, cell_range, range_name, password): + # Write the element. + attributes = [] + + if password: + attributes.append(("password", password)) + + attributes.append(("sqref", cell_range)) + attributes.append(("name", range_name)) + + self._xml_empty_tag("protectedRange", attributes) + + def _write_drawings(self): + # Write the elements. + if not self.drawing: + return + + self.rel_count += 1 + self._write_drawing(self.rel_count) + + def _write_drawing(self, drawing_id): + # Write the element. + r_id = "rId" + str(drawing_id) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("drawing", attributes) + + def _write_legacy_drawing(self): + # Write the element. + if not self.has_vml: + return + + # Increment the relationship id for any drawings or comments. + self.rel_count += 1 + r_id = "rId" + str(self.rel_count) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("legacyDrawing", attributes) + + def _write_legacy_drawing_hf(self): + # Write the element. + if not self.has_header_vml: + return + + # Increment the relationship id for any drawings or comments. + self.rel_count += 1 + r_id = "rId" + str(self.rel_count) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("legacyDrawingHF", attributes) + + def _write_picture(self): + # Write the element. + if not self.background_image: + return + + # Increment the relationship id. + self.rel_count += 1 + r_id = "rId" + str(self.rel_count) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("picture", attributes) + + def _write_data_validations(self): + # Write the element. + validations = self.validations + count = len(validations) + + if not count: + return + + attributes = [("count", count)] + + self._xml_start_tag("dataValidations", attributes) + + for validation in validations: + # Write the dataValidation element. + self._write_data_validation(validation) + + self._xml_end_tag("dataValidations") + + def _write_data_validation(self, options): + # Write the element. + sqref = "" + attributes = [] + + # Set the cell range(s) for the data validation. + for cells in options["cells"]: + # Add a space between multiple cell ranges. + if sqref != "": + sqref += " " + + (row_first, col_first, row_last, col_last) = cells + + # Swap last row/col for first row/col as necessary + if row_first > row_last: + (row_first, row_last) = (row_last, row_first) + + if col_first > col_last: + (col_first, col_last) = (col_last, col_first) + + sqref += xl_range(row_first, col_first, row_last, col_last) + + if options.get("multi_range"): + sqref = options["multi_range"] + + if options["validate"] != "none": + attributes.append(("type", options["validate"])) + + if options["criteria"] != "between": + attributes.append(("operator", options["criteria"])) + + if "error_type" in options: + if options["error_type"] == 1: + attributes.append(("errorStyle", "warning")) + if options["error_type"] == 2: + attributes.append(("errorStyle", "information")) + + if options["ignore_blank"]: + attributes.append(("allowBlank", 1)) + + if not options["dropdown"]: + attributes.append(("showDropDown", 1)) + + if options["show_input"]: + attributes.append(("showInputMessage", 1)) + + if options["show_error"]: + attributes.append(("showErrorMessage", 1)) + + if "error_title" in options: + attributes.append(("errorTitle", options["error_title"])) + + if "error_message" in options: + attributes.append(("error", options["error_message"])) + + if "input_title" in options: + attributes.append(("promptTitle", options["input_title"])) + + if "input_message" in options: + attributes.append(("prompt", options["input_message"])) + + attributes.append(("sqref", sqref)) + + if options["validate"] == "none": + self._xml_empty_tag("dataValidation", attributes) + else: + self._xml_start_tag("dataValidation", attributes) + + # Write the formula1 element. + self._write_formula_1(options["value"]) + + # Write the formula2 element. + if options["maximum"] is not None: + self._write_formula_2(options["maximum"]) + + self._xml_end_tag("dataValidation") + + def _write_formula_1(self, formula): + # Write the element. + + if type(formula) is list: + formula = self._csv_join(*formula) + formula = '"%s"' % formula + else: + # Check if the formula is a number. + try: + float(formula) + except ValueError: + # Not a number. Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("formula1", formula) + + def _write_formula_2(self, formula): + # Write the element. + + # Check if the formula is a number. + try: + float(formula) + except ValueError: + # Not a number. Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("formula2", formula) + + def _write_conditional_formats(self): + # Write the Worksheet conditional formats. + ranges = sorted(self.cond_formats.keys()) + + if not ranges: + return + + for cond_range in ranges: + self._write_conditional_formatting( + cond_range, self.cond_formats[cond_range] + ) + + def _write_conditional_formatting(self, cond_range, params): + # Write the element. + attributes = [("sqref", cond_range)] + self._xml_start_tag("conditionalFormatting", attributes) + for param in params: + # Write the cfRule element. + self._write_cf_rule(param) + self._xml_end_tag("conditionalFormatting") + + def _write_cf_rule(self, params): + # Write the element. + attributes = [("type", params["type"])] + + if "format" in params and params["format"] is not None: + attributes.append(("dxfId", params["format"])) + + attributes.append(("priority", params["priority"])) + + if params.get("stop_if_true"): + attributes.append(("stopIfTrue", 1)) + + if params["type"] == "cellIs": + attributes.append(("operator", params["criteria"])) + + self._xml_start_tag("cfRule", attributes) + + if "minimum" in params and "maximum" in params: + self._write_formula_element(params["minimum"]) + self._write_formula_element(params["maximum"]) + else: + self._write_formula_element(params["value"]) + + self._xml_end_tag("cfRule") + + elif params["type"] == "aboveAverage": + if re.search("below", params["criteria"]): + attributes.append(("aboveAverage", 0)) + + if re.search("equal", params["criteria"]): + attributes.append(("equalAverage", 1)) + + if re.search("[123] std dev", params["criteria"]): + match = re.search("([123]) std dev", params["criteria"]) + attributes.append(("stdDev", match.group(1))) + + self._xml_empty_tag("cfRule", attributes) + + elif params["type"] == "top10": + if "criteria" in params and params["criteria"] == "%": + attributes.append(("percent", 1)) + + if "direction" in params: + attributes.append(("bottom", 1)) + + rank = params["value"] or 10 + attributes.append(("rank", rank)) + + self._xml_empty_tag("cfRule", attributes) + + elif params["type"] == "duplicateValues": + self._xml_empty_tag("cfRule", attributes) + + elif params["type"] == "uniqueValues": + self._xml_empty_tag("cfRule", attributes) + + elif ( + params["type"] == "containsText" + or params["type"] == "notContainsText" + or params["type"] == "beginsWith" + or params["type"] == "endsWith" + ): + attributes.append(("operator", params["criteria"])) + attributes.append(("text", params["value"])) + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["formula"]) + self._xml_end_tag("cfRule") + + elif params["type"] == "timePeriod": + attributes.append(("timePeriod", params["criteria"])) + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["formula"]) + self._xml_end_tag("cfRule") + + elif ( + params["type"] == "containsBlanks" + or params["type"] == "notContainsBlanks" + or params["type"] == "containsErrors" + or params["type"] == "notContainsErrors" + ): + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["formula"]) + self._xml_end_tag("cfRule") + + elif params["type"] == "colorScale": + self._xml_start_tag("cfRule", attributes) + self._write_color_scale(params) + self._xml_end_tag("cfRule") + + elif params["type"] == "dataBar": + self._xml_start_tag("cfRule", attributes) + self._write_data_bar(params) + + if params.get("is_data_bar_2010"): + self._write_data_bar_ext(params) + + self._xml_end_tag("cfRule") + + elif params["type"] == "expression": + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["criteria"]) + self._xml_end_tag("cfRule") + + elif params["type"] == "iconSet": + self._xml_start_tag("cfRule", attributes) + self._write_icon_set(params) + self._xml_end_tag("cfRule") + + def _write_formula_element(self, formula): + # Write the element. + + # Check if the formula is a number. + try: + float(formula) + except ValueError: + # Not a number. Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("formula", formula) + + def _write_color_scale(self, param): + # Write the element. + + self._xml_start_tag("colorScale") + + self._write_cfvo(param["min_type"], param["min_value"]) + + if param["mid_type"] is not None: + self._write_cfvo(param["mid_type"], param["mid_value"]) + + self._write_cfvo(param["max_type"], param["max_value"]) + + self._write_color("rgb", param["min_color"]) + + if param["mid_color"] is not None: + self._write_color("rgb", param["mid_color"]) + + self._write_color("rgb", param["max_color"]) + + self._xml_end_tag("colorScale") + + def _write_data_bar(self, param): + # Write the element. + attributes = [] + + # Min and max bar lengths in in the spec but not supported directly by + # Excel. + if param.get("min_length"): + attributes.append(("minLength", param["min_length"])) + + if param.get("max_length"): + attributes.append(("maxLength", param["max_length"])) + + if param.get("bar_only"): + attributes.append(("showValue", 0)) + + self._xml_start_tag("dataBar", attributes) + + self._write_cfvo(param["min_type"], param["min_value"]) + self._write_cfvo(param["max_type"], param["max_value"]) + self._write_color("rgb", param["bar_color"]) + + self._xml_end_tag("dataBar") + + def _write_data_bar_ext(self, param): + # Write the dataBar extension element. + + # Create a pseudo GUID for each unique Excel 2010 data bar. + worksheet_count = self.index + 1 + data_bar_count = len(self.data_bars_2010) + 1 + guid = "{DA7ABA51-AAAA-BBBB-%04X-%012X}" % (worksheet_count, data_bar_count) + + # Store the 2010 data bar parameters to write the extLst elements. + param["guid"] = guid + self.data_bars_2010.append(param) + + self._xml_start_tag("extLst") + self._write_ext("{B025F937-C7B1-47D3-B67F-A62EFF666E3E}") + self._xml_data_element("x14:id", guid) + self._xml_end_tag("ext") + self._xml_end_tag("extLst") + + def _write_icon_set(self, param): + # Write the element. + attributes = [] + + # Don't set attribute for default style. + if param["icon_style"] != "3TrafficLights": + attributes = [("iconSet", param["icon_style"])] + + if param.get("icons_only"): + attributes.append(("showValue", 0)) + + if param.get("reverse_icons"): + attributes.append(("reverse", 1)) + + self._xml_start_tag("iconSet", attributes) + + # Write the properties for different icon styles. + for icon in reversed(param["icons"]): + self._write_cfvo(icon["type"], icon["value"], icon["criteria"]) + + self._xml_end_tag("iconSet") + + def _write_cfvo(self, cf_type, val, criteria=None): + # Write the element. + attributes = [("type", cf_type)] + + if val is not None: + attributes.append(("val", val)) + + if criteria: + attributes.append(("gte", 0)) + + self._xml_empty_tag("cfvo", attributes) + + def _write_color(self, name, value): + # Write the element. + attributes = [(name, value)] + + self._xml_empty_tag("color", attributes) + + def _write_selections(self): + # Write the elements. + for selection in self.selections: + self._write_selection(*selection) + + def _write_selection(self, pane, active_cell, sqref): + # Write the element. + attributes = [] + + if pane: + attributes.append(("pane", pane)) + + if active_cell: + attributes.append(("activeCell", active_cell)) + + if sqref: + attributes.append(("sqref", sqref)) + + self._xml_empty_tag("selection", attributes) + + def _write_panes(self): + # Write the frozen or split elements. + panes = self.panes + + if not len(panes): + return + + if panes[4] == 2: + self._write_split_panes(*panes) + else: + self._write_freeze_panes(*panes) + + def _write_freeze_panes(self, row, col, top_row, left_col, pane_type): + # Write the element for freeze panes. + attributes = [] + + y_split = row + x_split = col + top_left_cell = xl_rowcol_to_cell(top_row, left_col) + active_pane = "" + state = "" + active_cell = "" + sqref = "" + + # Move user cell selection to the panes. + if self.selections: + (_, active_cell, sqref) = self.selections[0] + self.selections = [] + + # Set the active pane. + if row and col: + active_pane = "bottomRight" + + row_cell = xl_rowcol_to_cell(row, 0) + col_cell = xl_rowcol_to_cell(0, col) + + self.selections.append(["topRight", col_cell, col_cell]) + self.selections.append(["bottomLeft", row_cell, row_cell]) + self.selections.append(["bottomRight", active_cell, sqref]) + + elif col: + active_pane = "topRight" + self.selections.append(["topRight", active_cell, sqref]) + + else: + active_pane = "bottomLeft" + self.selections.append(["bottomLeft", active_cell, sqref]) + + # Set the pane type. + if pane_type == 0: + state = "frozen" + elif pane_type == 1: + state = "frozenSplit" + else: + state = "split" + + if x_split: + attributes.append(("xSplit", x_split)) + + if y_split: + attributes.append(("ySplit", y_split)) + + attributes.append(("topLeftCell", top_left_cell)) + attributes.append(("activePane", active_pane)) + attributes.append(("state", state)) + + self._xml_empty_tag("pane", attributes) + + def _write_split_panes(self, row, col, top_row, left_col, pane_type): + # Write the element for split panes. + attributes = [] + has_selection = 0 + active_pane = "" + active_cell = "" + sqref = "" + + y_split = row + x_split = col + + # Move user cell selection to the panes. + if self.selections: + (_, active_cell, sqref) = self.selections[0] + self.selections = [] + has_selection = 1 + + # Convert the row and col to 1/20 twip units with padding. + if y_split: + y_split = int(20 * y_split + 300) + + if x_split: + x_split = self._calculate_x_split_width(x_split) + + # For non-explicit topLeft definitions, estimate the cell offset based + # on the pixels dimensions. This is only a workaround and doesn't take + # adjusted cell dimensions into account. + if top_row == row and left_col == col: + top_row = int(0.5 + (y_split - 300) / 20 / 15) + left_col = int(0.5 + (x_split - 390) / 20 / 3 * 4 / 64) + + top_left_cell = xl_rowcol_to_cell(top_row, left_col) + + # If there is no selection set the active cell to the top left cell. + if not has_selection: + active_cell = top_left_cell + sqref = top_left_cell + + # Set the Cell selections. + if row and col: + active_pane = "bottomRight" + + row_cell = xl_rowcol_to_cell(top_row, 0) + col_cell = xl_rowcol_to_cell(0, left_col) + + self.selections.append(["topRight", col_cell, col_cell]) + self.selections.append(["bottomLeft", row_cell, row_cell]) + self.selections.append(["bottomRight", active_cell, sqref]) + + elif col: + active_pane = "topRight" + self.selections.append(["topRight", active_cell, sqref]) + + else: + active_pane = "bottomLeft" + self.selections.append(["bottomLeft", active_cell, sqref]) + + # Format splits to the same precision as Excel. + if x_split: + attributes.append(("xSplit", "%.16g" % x_split)) + + if y_split: + attributes.append(("ySplit", "%.16g" % y_split)) + + attributes.append(("topLeftCell", top_left_cell)) + + if has_selection: + attributes.append(("activePane", active_pane)) + + self._xml_empty_tag("pane", attributes) + + def _calculate_x_split_width(self, width): + # Convert column width from user units to pane split width. + + max_digit_width = 7 # For Calabri 11. + padding = 5 + + # Convert to pixels. + if width < 1: + pixels = int(width * (max_digit_width + padding) + 0.5) + else: + pixels = int(width * max_digit_width + 0.5) + padding + + # Convert to points. + points = pixels * 3 / 4 + + # Convert to twips (twentieths of a point). + twips = points * 20 + + # Add offset/padding. + width = twips + 390 + + return width + + def _write_table_parts(self): + # Write the element. + tables = self.tables + count = len(tables) + + # Return if worksheet doesn't contain any tables. + if not count: + return + + attributes = [ + ( + "count", + count, + ) + ] + + self._xml_start_tag("tableParts", attributes) + + for _ in tables: + # Write the tablePart element. + self.rel_count += 1 + self._write_table_part(self.rel_count) + + self._xml_end_tag("tableParts") + + def _write_table_part(self, r_id): + # Write the element. + + r_id = "rId" + str(r_id) + + attributes = [ + ( + "r:id", + r_id, + ) + ] + + self._xml_empty_tag("tablePart", attributes) + + def _write_ext_list(self): + # Write the element for data bars and sparklines. + has_data_bars = len(self.data_bars_2010) + has_sparklines = len(self.sparklines) + + if not has_data_bars and not has_sparklines: + return + + # Write the extLst element. + self._xml_start_tag("extLst") + + if has_data_bars: + self._write_ext_list_data_bars() + + if has_sparklines: + self._write_ext_list_sparklines() + + self._xml_end_tag("extLst") + + def _write_ext_list_data_bars(self): + # Write the Excel 2010 data_bar subelements. + self._write_ext("{78C0D931-6437-407d-A8EE-F0AAD7539E65}") + + self._xml_start_tag("x14:conditionalFormattings") + + # Write the Excel 2010 conditional formatting data bar elements. + for data_bar in self.data_bars_2010: + # Write the x14:conditionalFormatting element. + self._write_conditional_formatting_2010(data_bar) + + self._xml_end_tag("x14:conditionalFormattings") + self._xml_end_tag("ext") + + def _write_conditional_formatting_2010(self, data_bar): + # Write the element. + xmlns_xm = "http://schemas.microsoft.com/office/excel/2006/main" + + attributes = [("xmlns:xm", xmlns_xm)] + + self._xml_start_tag("x14:conditionalFormatting", attributes) + + # Write the x14:cfRule element. + self._write_x14_cf_rule(data_bar) + + # Write the x14:dataBar element. + self._write_x14_data_bar(data_bar) + + # Write the x14 max and min data bars. + self._write_x14_cfvo(data_bar["x14_min_type"], data_bar["min_value"]) + self._write_x14_cfvo(data_bar["x14_max_type"], data_bar["max_value"]) + + if not data_bar["bar_no_border"]: + # Write the x14:borderColor element. + self._write_x14_border_color(data_bar["bar_border_color"]) + + # Write the x14:negativeFillColor element. + if not data_bar["bar_negative_color_same"]: + self._write_x14_negative_fill_color(data_bar["bar_negative_color"]) + + # Write the x14:negativeBorderColor element. + if ( + not data_bar["bar_no_border"] + and not data_bar["bar_negative_border_color_same"] + ): + self._write_x14_negative_border_color(data_bar["bar_negative_border_color"]) + + # Write the x14:axisColor element. + if data_bar["bar_axis_position"] != "none": + self._write_x14_axis_color(data_bar["bar_axis_color"]) + + self._xml_end_tag("x14:dataBar") + self._xml_end_tag("x14:cfRule") + + # Write the xm:sqref element. + self._xml_data_element("xm:sqref", data_bar["range"]) + + self._xml_end_tag("x14:conditionalFormatting") + + def _write_x14_cf_rule(self, data_bar): + # Write the element. + rule_type = "dataBar" + guid = data_bar["guid"] + attributes = [("type", rule_type), ("id", guid)] + + self._xml_start_tag("x14:cfRule", attributes) + + def _write_x14_data_bar(self, data_bar): + # Write the element. + min_length = 0 + max_length = 100 + + attributes = [ + ("minLength", min_length), + ("maxLength", max_length), + ] + + if not data_bar["bar_no_border"]: + attributes.append(("border", 1)) + + if data_bar["bar_solid"]: + attributes.append(("gradient", 0)) + + if data_bar["bar_direction"] == "left": + attributes.append(("direction", "leftToRight")) + + if data_bar["bar_direction"] == "right": + attributes.append(("direction", "rightToLeft")) + + if data_bar["bar_negative_color_same"]: + attributes.append(("negativeBarColorSameAsPositive", 1)) + + if ( + not data_bar["bar_no_border"] + and not data_bar["bar_negative_border_color_same"] + ): + attributes.append(("negativeBarBorderColorSameAsPositive", 0)) + + if data_bar["bar_axis_position"] == "middle": + attributes.append(("axisPosition", "middle")) + + if data_bar["bar_axis_position"] == "none": + attributes.append(("axisPosition", "none")) + + self._xml_start_tag("x14:dataBar", attributes) + + def _write_x14_cfvo(self, rule_type, value): + # Write the element. + attributes = [("type", rule_type)] + + if rule_type in ("min", "max", "autoMin", "autoMax"): + self._xml_empty_tag("x14:cfvo", attributes) + else: + self._xml_start_tag("x14:cfvo", attributes) + self._xml_data_element("xm:f", value) + self._xml_end_tag("x14:cfvo") + + def _write_x14_border_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:borderColor", attributes) + + def _write_x14_negative_fill_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:negativeFillColor", attributes) + + def _write_x14_negative_border_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:negativeBorderColor", attributes) + + def _write_x14_axis_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:axisColor", attributes) + + def _write_ext_list_sparklines(self): + # Write the sparkline extension sub-elements. + self._write_ext("{05C60535-1F16-4fd2-B633-F4F36F0B64E0}") + + # Write the x14:sparklineGroups element. + self._write_sparkline_groups() + + # Write the sparkline elements. + for sparkline in reversed(self.sparklines): + # Write the x14:sparklineGroup element. + self._write_sparkline_group(sparkline) + + # Write the x14:colorSeries element. + self._write_color_series(sparkline["series_color"]) + + # Write the x14:colorNegative element. + self._write_color_negative(sparkline["negative_color"]) + + # Write the x14:colorAxis element. + self._write_color_axis() + + # Write the x14:colorMarkers element. + self._write_color_markers(sparkline["markers_color"]) + + # Write the x14:colorFirst element. + self._write_color_first(sparkline["first_color"]) + + # Write the x14:colorLast element. + self._write_color_last(sparkline["last_color"]) + + # Write the x14:colorHigh element. + self._write_color_high(sparkline["high_color"]) + + # Write the x14:colorLow element. + self._write_color_low(sparkline["low_color"]) + + if sparkline["date_axis"]: + self._xml_data_element("xm:f", sparkline["date_axis"]) + + self._write_sparklines(sparkline) + + self._xml_end_tag("x14:sparklineGroup") + + self._xml_end_tag("x14:sparklineGroups") + self._xml_end_tag("ext") + + def _write_sparklines(self, sparkline): + # Write the element and sub-elements. + + # Write the sparkline elements. + self._xml_start_tag("x14:sparklines") + + for i in range(sparkline["count"]): + spark_range = sparkline["ranges"][i] + location = sparkline["locations"][i] + + self._xml_start_tag("x14:sparkline") + self._xml_data_element("xm:f", spark_range) + self._xml_data_element("xm:sqref", location) + self._xml_end_tag("x14:sparkline") + + self._xml_end_tag("x14:sparklines") + + def _write_ext(self, uri): + # Write the element. + schema = "http://schemas.microsoft.com/office/" + xmlns_x14 = schema + "spreadsheetml/2009/9/main" + + attributes = [ + ("xmlns:x14", xmlns_x14), + ("uri", uri), + ] + + self._xml_start_tag("ext", attributes) + + def _write_sparkline_groups(self): + # Write the element. + xmlns_xm = "http://schemas.microsoft.com/office/excel/2006/main" + + attributes = [("xmlns:xm", xmlns_xm)] + + self._xml_start_tag("x14:sparklineGroups", attributes) + + def _write_sparkline_group(self, options): + # Write the element. + # + # Example for order. + # + # + # + empty = options.get("empty") + attributes = [] + + if options.get("max") is not None: + if options["max"] == "group": + options["cust_max"] = "group" + else: + attributes.append(("manualMax", options["max"])) + options["cust_max"] = "custom" + + if options.get("min") is not None: + if options["min"] == "group": + options["cust_min"] = "group" + else: + attributes.append(("manualMin", options["min"])) + options["cust_min"] = "custom" + + # Ignore the default type attribute (line). + if options["type"] != "line": + attributes.append(("type", options["type"])) + + if options.get("weight"): + attributes.append(("lineWeight", options["weight"])) + + if options.get("date_axis"): + attributes.append(("dateAxis", 1)) + + if empty: + attributes.append(("displayEmptyCellsAs", empty)) + + if options.get("markers"): + attributes.append(("markers", 1)) + + if options.get("high"): + attributes.append(("high", 1)) + + if options.get("low"): + attributes.append(("low", 1)) + + if options.get("first"): + attributes.append(("first", 1)) + + if options.get("last"): + attributes.append(("last", 1)) + + if options.get("negative"): + attributes.append(("negative", 1)) + + if options.get("axis"): + attributes.append(("displayXAxis", 1)) + + if options.get("hidden"): + attributes.append(("displayHidden", 1)) + + if options.get("cust_min"): + attributes.append(("minAxisType", options["cust_min"])) + + if options.get("cust_max"): + attributes.append(("maxAxisType", options["cust_max"])) + + if options.get("reverse"): + attributes.append(("rightToLeft", 1)) + + self._xml_start_tag("x14:sparklineGroup", attributes) + + def _write_spark_color(self, element, color): + # Helper function for the sparkline color functions below. + attributes = [] + + if color.get("rgb"): + attributes.append(("rgb", color["rgb"])) + + if color.get("theme"): + attributes.append(("theme", color["theme"])) + + if color.get("tint"): + attributes.append(("tint", color["tint"])) + + self._xml_empty_tag(element, attributes) + + def _write_color_series(self, color): + # Write the element. + self._write_spark_color("x14:colorSeries", color) + + def _write_color_negative(self, color): + # Write the element. + self._write_spark_color("x14:colorNegative", color) + + def _write_color_axis(self): + # Write the element. + self._write_spark_color("x14:colorAxis", {"rgb": "FF000000"}) + + def _write_color_markers(self, color): + # Write the element. + self._write_spark_color("x14:colorMarkers", color) + + def _write_color_first(self, color): + # Write the element. + self._write_spark_color("x14:colorFirst", color) + + def _write_color_last(self, color): + # Write the element. + self._write_spark_color("x14:colorLast", color) + + def _write_color_high(self, color): + # Write the element. + self._write_spark_color("x14:colorHigh", color) + + def _write_color_low(self, color): + # Write the element. + self._write_spark_color("x14:colorLow", color) + + def _write_phonetic_pr(self): + # Write the element. + attributes = [ + ("fontId", "0"), + ("type", "noConversion"), + ] + + self._xml_empty_tag("phoneticPr", attributes) + + def _write_ignored_errors(self): + # Write the element. + if not self.ignored_errors: + return + + self._xml_start_tag("ignoredErrors") + + if self.ignored_errors.get("number_stored_as_text"): + ignored_range = self.ignored_errors["number_stored_as_text"] + self._write_ignored_error("numberStoredAsText", ignored_range) + + if self.ignored_errors.get("eval_error"): + ignored_range = self.ignored_errors["eval_error"] + self._write_ignored_error("evalError", ignored_range) + + if self.ignored_errors.get("formula_differs"): + ignored_range = self.ignored_errors["formula_differs"] + self._write_ignored_error("formula", ignored_range) + + if self.ignored_errors.get("formula_ignored_range"): + ignored_range = self.ignored_errors["formula_ignored_range"] + self._write_ignored_error("formulaIgnored_range", ignored_range) + + if self.ignored_errors.get("formula_unlocked"): + ignored_range = self.ignored_errors["formula_unlocked"] + self._write_ignored_error("unlockedFormula", ignored_range) + + if self.ignored_errors.get("empty_cell_reference"): + ignored_range = self.ignored_errors["empty_cell_reference"] + self._write_ignored_error("emptyCellReference", ignored_range) + + if self.ignored_errors.get("list_data_validation"): + ignored_range = self.ignored_errors["list_data_validation"] + self._write_ignored_error("listDataValidation", ignored_range) + + if self.ignored_errors.get("calculated_column"): + ignored_range = self.ignored_errors["calculated_column"] + self._write_ignored_error("calculatedColumn", ignored_range) + + if self.ignored_errors.get("two_digit_text_year"): + ignored_range = self.ignored_errors["two_digit_text_year"] + self._write_ignored_error("twoDigitTextYear", ignored_range) + + self._xml_end_tag("ignoredErrors") + + def _write_ignored_error(self, type, ignored_range): + # Write the element. + attributes = [ + ("sqref", ignored_range), + (type, 1), + ] + + self._xml_empty_tag("ignoredError", attributes) diff --git a/billinglayer/python/xlsxwriter/xmlwriter.py b/billinglayer/python/xlsxwriter/xmlwriter.py new file mode 100644 index 0000000..28b8a0f --- /dev/null +++ b/billinglayer/python/xlsxwriter/xmlwriter.py @@ -0,0 +1,206 @@ +############################################################################### +# +# XMLwriter - A base class for XlsxWriter classes. +# +# Used in conjunction with XlsxWriter. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import re +from io import StringIO + + +class XMLwriter(object): + """ + Simple XML writer class. + + """ + + def __init__(self): + self.fh = None + self.escapes = re.compile('["&<>\n]') + self.internal_fh = False + + def _set_filehandle(self, filehandle): + # Set the writer filehandle directly. Mainly for testing. + self.fh = filehandle + self.internal_fh = False + + def _set_xml_writer(self, filename): + # Set the XML writer filehandle for the object. + if isinstance(filename, StringIO): + self.internal_fh = False + self.fh = filename + else: + self.internal_fh = True + self.fh = open(filename, "w", encoding="utf-8") + + def _xml_close(self): + # Close the XML filehandle if we created it. + if self.internal_fh: + self.fh.close() + + def _xml_declaration(self): + # Write the XML declaration. + self.fh.write("""\n""") + + def _xml_start_tag(self, tag, attributes=[]): + # Write an XML start tag with optional attributes. + for key, value in attributes: + value = self._escape_attributes(value) + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s>" % tag) + + def _xml_start_tag_unencoded(self, tag, attributes=[]): + # Write an XML start tag with optional, unencoded, attributes. + # This is a minor speed optimization for elements that don't + # need encoding. + for key, value in attributes: + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s>" % tag) + + def _xml_end_tag(self, tag): + # Write an XML end tag. + self.fh.write("" % tag) + + def _xml_empty_tag(self, tag, attributes=[]): + # Write an empty XML tag with optional attributes. + for key, value in attributes: + value = self._escape_attributes(value) + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s/>" % tag) + + def _xml_empty_tag_unencoded(self, tag, attributes=[]): + # Write an empty XML tag with optional, unencoded, attributes. + # This is a minor speed optimization for elements that don't + # need encoding. + for key, value in attributes: + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s/>" % tag) + + def _xml_data_element(self, tag, data, attributes=[]): + # Write an XML element containing data with optional attributes. + end_tag = tag + + for key, value in attributes: + value = self._escape_attributes(value) + tag += ' %s="%s"' % (key, value) + + data = self._escape_data(data) + self.fh.write("<%s>%s" % (tag, data, end_tag)) + + def _xml_string_element(self, index, attributes=[]): + # Optimized tag writer for cell string elements in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write("""%d""" % (attr, index)) + + def _xml_si_element(self, string, attributes=[]): + # Optimized tag writer for shared strings elements. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + string = self._escape_data(string) + + self.fh.write("""%s""" % (attr, string)) + + def _xml_rich_si_element(self, string): + # Optimized tag writer for shared strings rich string elements. + + self.fh.write("""%s""" % string) + + def _xml_number_element(self, number, attributes=[]): + # Optimized tag writer for cell number elements in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write("""%.16G""" % (attr, number)) + + def _xml_formula_element(self, formula, result, attributes=[]): + # Optimized tag writer for cell formula elements in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write( + """%s%s""" + % (attr, self._escape_data(formula), self._escape_data(result)) + ) + + def _xml_inline_string(self, string, preserve, attributes=[]): + # Optimized tag writer for inlineStr cell elements in the inner loop. + attr = "" + t_attr = "" + + # Set the attribute to preserve whitespace. + if preserve: + t_attr = ' xml:space="preserve"' + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + string = self._escape_data(string) + + self.fh.write( + """%s""" % (attr, t_attr, string) + ) + + def _xml_rich_inline_string(self, string, attributes=[]): + # Optimized tag writer for rich inlineStr in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write("""%s""" % (attr, string)) + + def _escape_attributes(self, attribute): + # Escape XML characters in attributes. + try: + if not self.escapes.search(attribute): + return attribute + except TypeError: + return attribute + + attribute = ( + attribute.replace("&", "&") + .replace('"', """) + .replace("<", "<") + .replace(">", ">") + .replace("\n", " ") + ) + return attribute + + def _escape_data(self, data): + # Escape XML characters in data sections of tags. Note, this + # is different from _escape_attributes() in that double quotes + # are not escaped by Excel. + try: + if not self.escapes.search(data): + return data + except TypeError: + return data + + data = data.replace("&", "&").replace("<", "<").replace(">", ">") + return data diff --git a/click/.DS_Store b/click/.DS_Store new file mode 100644 index 0000000..5117ba3 Binary files /dev/null and b/click/.DS_Store differ diff --git a/click/click.zip b/click/click.zip new file mode 100644 index 0000000..fa4357d Binary files /dev/null and b/click/click.zip differ diff --git a/click/python/.DS_Store b/click/python/.DS_Store new file mode 100644 index 0000000..9352014 Binary files /dev/null and b/click/python/.DS_Store differ diff --git a/click/python/click/__init__.py b/click/python/click/__init__.py new file mode 100644 index 0000000..9a1dab0 --- /dev/null +++ b/click/python/click/__init__.py @@ -0,0 +1,73 @@ +""" +Click is a simple Python module inspired by the stdlib optparse to make +writing command line scripts fun. Unlike other modules, it's based +around a simple API that does not come with too much magic and is +composable. +""" +from .core import Argument as Argument +from .core import BaseCommand as BaseCommand +from .core import Command as Command +from .core import CommandCollection as CommandCollection +from .core import Context as Context +from .core import Group as Group +from .core import MultiCommand as MultiCommand +from .core import Option as Option +from .core import Parameter as Parameter +from .decorators import argument as argument +from .decorators import command as command +from .decorators import confirmation_option as confirmation_option +from .decorators import group as group +from .decorators import help_option as help_option +from .decorators import make_pass_decorator as make_pass_decorator +from .decorators import option as option +from .decorators import pass_context as pass_context +from .decorators import pass_obj as pass_obj +from .decorators import password_option as password_option +from .decorators import version_option as version_option +from .exceptions import Abort as Abort +from .exceptions import BadArgumentUsage as BadArgumentUsage +from .exceptions import BadOptionUsage as BadOptionUsage +from .exceptions import BadParameter as BadParameter +from .exceptions import ClickException as ClickException +from .exceptions import FileError as FileError +from .exceptions import MissingParameter as MissingParameter +from .exceptions import NoSuchOption as NoSuchOption +from .exceptions import UsageError as UsageError +from .formatting import HelpFormatter as HelpFormatter +from .formatting import wrap_text as wrap_text +from .globals import get_current_context as get_current_context +from .parser import OptionParser as OptionParser +from .termui import clear as clear +from .termui import confirm as confirm +from .termui import echo_via_pager as echo_via_pager +from .termui import edit as edit +from .termui import getchar as getchar +from .termui import launch as launch +from .termui import pause as pause +from .termui import progressbar as progressbar +from .termui import prompt as prompt +from .termui import secho as secho +from .termui import style as style +from .termui import unstyle as unstyle +from .types import BOOL as BOOL +from .types import Choice as Choice +from .types import DateTime as DateTime +from .types import File as File +from .types import FLOAT as FLOAT +from .types import FloatRange as FloatRange +from .types import INT as INT +from .types import IntRange as IntRange +from .types import ParamType as ParamType +from .types import Path as Path +from .types import STRING as STRING +from .types import Tuple as Tuple +from .types import UNPROCESSED as UNPROCESSED +from .types import UUID as UUID +from .utils import echo as echo +from .utils import format_filename as format_filename +from .utils import get_app_dir as get_app_dir +from .utils import get_binary_stream as get_binary_stream +from .utils import get_text_stream as get_text_stream +from .utils import open_file as open_file + +__version__ = "8.1.7" diff --git a/click/python/click/__pycache__/__init__.cpython-311.pyc b/click/python/click/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1c4b03d Binary files /dev/null and b/click/python/click/__pycache__/__init__.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/_compat.cpython-311.pyc b/click/python/click/__pycache__/_compat.cpython-311.pyc new file mode 100644 index 0000000..aa105fe Binary files /dev/null and b/click/python/click/__pycache__/_compat.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/_termui_impl.cpython-311.pyc b/click/python/click/__pycache__/_termui_impl.cpython-311.pyc new file mode 100644 index 0000000..206cfdd Binary files /dev/null and b/click/python/click/__pycache__/_termui_impl.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/_textwrap.cpython-311.pyc b/click/python/click/__pycache__/_textwrap.cpython-311.pyc new file mode 100644 index 0000000..ef2c062 Binary files /dev/null and b/click/python/click/__pycache__/_textwrap.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/_winconsole.cpython-311.pyc b/click/python/click/__pycache__/_winconsole.cpython-311.pyc new file mode 100644 index 0000000..8eec081 Binary files /dev/null and b/click/python/click/__pycache__/_winconsole.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/core.cpython-311.pyc b/click/python/click/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..893a478 Binary files /dev/null and b/click/python/click/__pycache__/core.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/decorators.cpython-311.pyc b/click/python/click/__pycache__/decorators.cpython-311.pyc new file mode 100644 index 0000000..221aa30 Binary files /dev/null and b/click/python/click/__pycache__/decorators.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/exceptions.cpython-311.pyc b/click/python/click/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..62589f2 Binary files /dev/null and b/click/python/click/__pycache__/exceptions.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/formatting.cpython-311.pyc b/click/python/click/__pycache__/formatting.cpython-311.pyc new file mode 100644 index 0000000..d4defa2 Binary files /dev/null and b/click/python/click/__pycache__/formatting.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/globals.cpython-311.pyc b/click/python/click/__pycache__/globals.cpython-311.pyc new file mode 100644 index 0000000..d98bf27 Binary files /dev/null and b/click/python/click/__pycache__/globals.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/parser.cpython-311.pyc b/click/python/click/__pycache__/parser.cpython-311.pyc new file mode 100644 index 0000000..f7ea009 Binary files /dev/null and b/click/python/click/__pycache__/parser.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/shell_completion.cpython-311.pyc b/click/python/click/__pycache__/shell_completion.cpython-311.pyc new file mode 100644 index 0000000..cdafa8f Binary files /dev/null and b/click/python/click/__pycache__/shell_completion.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/termui.cpython-311.pyc b/click/python/click/__pycache__/termui.cpython-311.pyc new file mode 100644 index 0000000..218f9e0 Binary files /dev/null and b/click/python/click/__pycache__/termui.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/testing.cpython-311.pyc b/click/python/click/__pycache__/testing.cpython-311.pyc new file mode 100644 index 0000000..21e2744 Binary files /dev/null and b/click/python/click/__pycache__/testing.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/types.cpython-311.pyc b/click/python/click/__pycache__/types.cpython-311.pyc new file mode 100644 index 0000000..4575bc6 Binary files /dev/null and b/click/python/click/__pycache__/types.cpython-311.pyc differ diff --git a/click/python/click/__pycache__/utils.cpython-311.pyc b/click/python/click/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..5767500 Binary files /dev/null and b/click/python/click/__pycache__/utils.cpython-311.pyc differ diff --git a/click/python/click/_compat.py b/click/python/click/_compat.py new file mode 100644 index 0000000..23f8866 --- /dev/null +++ b/click/python/click/_compat.py @@ -0,0 +1,623 @@ +import codecs +import io +import os +import re +import sys +import typing as t +from weakref import WeakKeyDictionary + +CYGWIN = sys.platform.startswith("cygwin") +WIN = sys.platform.startswith("win") +auto_wrap_for_ansi: t.Optional[t.Callable[[t.TextIO], t.TextIO]] = None +_ansi_re = re.compile(r"\033\[[;?0-9]*[a-zA-Z]") + + +def _make_text_stream( + stream: t.BinaryIO, + encoding: t.Optional[str], + errors: t.Optional[str], + force_readable: bool = False, + force_writable: bool = False, +) -> t.TextIO: + if encoding is None: + encoding = get_best_encoding(stream) + if errors is None: + errors = "replace" + return _NonClosingTextIOWrapper( + stream, + encoding, + errors, + line_buffering=True, + force_readable=force_readable, + force_writable=force_writable, + ) + + +def is_ascii_encoding(encoding: str) -> bool: + """Checks if a given encoding is ascii.""" + try: + return codecs.lookup(encoding).name == "ascii" + except LookupError: + return False + + +def get_best_encoding(stream: t.IO[t.Any]) -> str: + """Returns the default stream encoding if not found.""" + rv = getattr(stream, "encoding", None) or sys.getdefaultencoding() + if is_ascii_encoding(rv): + return "utf-8" + return rv + + +class _NonClosingTextIOWrapper(io.TextIOWrapper): + def __init__( + self, + stream: t.BinaryIO, + encoding: t.Optional[str], + errors: t.Optional[str], + force_readable: bool = False, + force_writable: bool = False, + **extra: t.Any, + ) -> None: + self._stream = stream = t.cast( + t.BinaryIO, _FixupStream(stream, force_readable, force_writable) + ) + super().__init__(stream, encoding, errors, **extra) + + def __del__(self) -> None: + try: + self.detach() + except Exception: + pass + + def isatty(self) -> bool: + # https://bitbucket.org/pypy/pypy/issue/1803 + return self._stream.isatty() + + +class _FixupStream: + """The new io interface needs more from streams than streams + traditionally implement. As such, this fix-up code is necessary in + some circumstances. + + The forcing of readable and writable flags are there because some tools + put badly patched objects on sys (one such offender are certain version + of jupyter notebook). + """ + + def __init__( + self, + stream: t.BinaryIO, + force_readable: bool = False, + force_writable: bool = False, + ): + self._stream = stream + self._force_readable = force_readable + self._force_writable = force_writable + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._stream, name) + + def read1(self, size: int) -> bytes: + f = getattr(self._stream, "read1", None) + + if f is not None: + return t.cast(bytes, f(size)) + + return self._stream.read(size) + + def readable(self) -> bool: + if self._force_readable: + return True + x = getattr(self._stream, "readable", None) + if x is not None: + return t.cast(bool, x()) + try: + self._stream.read(0) + except Exception: + return False + return True + + def writable(self) -> bool: + if self._force_writable: + return True + x = getattr(self._stream, "writable", None) + if x is not None: + return t.cast(bool, x()) + try: + self._stream.write("") # type: ignore + except Exception: + try: + self._stream.write(b"") + except Exception: + return False + return True + + def seekable(self) -> bool: + x = getattr(self._stream, "seekable", None) + if x is not None: + return t.cast(bool, x()) + try: + self._stream.seek(self._stream.tell()) + except Exception: + return False + return True + + +def _is_binary_reader(stream: t.IO[t.Any], default: bool = False) -> bool: + try: + return isinstance(stream.read(0), bytes) + except Exception: + return default + # This happens in some cases where the stream was already + # closed. In this case, we assume the default. + + +def _is_binary_writer(stream: t.IO[t.Any], default: bool = False) -> bool: + try: + stream.write(b"") + except Exception: + try: + stream.write("") + return False + except Exception: + pass + return default + return True + + +def _find_binary_reader(stream: t.IO[t.Any]) -> t.Optional[t.BinaryIO]: + # We need to figure out if the given stream is already binary. + # This can happen because the official docs recommend detaching + # the streams to get binary streams. Some code might do this, so + # we need to deal with this case explicitly. + if _is_binary_reader(stream, False): + return t.cast(t.BinaryIO, stream) + + buf = getattr(stream, "buffer", None) + + # Same situation here; this time we assume that the buffer is + # actually binary in case it's closed. + if buf is not None and _is_binary_reader(buf, True): + return t.cast(t.BinaryIO, buf) + + return None + + +def _find_binary_writer(stream: t.IO[t.Any]) -> t.Optional[t.BinaryIO]: + # We need to figure out if the given stream is already binary. + # This can happen because the official docs recommend detaching + # the streams to get binary streams. Some code might do this, so + # we need to deal with this case explicitly. + if _is_binary_writer(stream, False): + return t.cast(t.BinaryIO, stream) + + buf = getattr(stream, "buffer", None) + + # Same situation here; this time we assume that the buffer is + # actually binary in case it's closed. + if buf is not None and _is_binary_writer(buf, True): + return t.cast(t.BinaryIO, buf) + + return None + + +def _stream_is_misconfigured(stream: t.TextIO) -> bool: + """A stream is misconfigured if its encoding is ASCII.""" + # If the stream does not have an encoding set, we assume it's set + # to ASCII. This appears to happen in certain unittest + # environments. It's not quite clear what the correct behavior is + # but this at least will force Click to recover somehow. + return is_ascii_encoding(getattr(stream, "encoding", None) or "ascii") + + +def _is_compat_stream_attr(stream: t.TextIO, attr: str, value: t.Optional[str]) -> bool: + """A stream attribute is compatible if it is equal to the + desired value or the desired value is unset and the attribute + has a value. + """ + stream_value = getattr(stream, attr, None) + return stream_value == value or (value is None and stream_value is not None) + + +def _is_compatible_text_stream( + stream: t.TextIO, encoding: t.Optional[str], errors: t.Optional[str] +) -> bool: + """Check if a stream's encoding and errors attributes are + compatible with the desired values. + """ + return _is_compat_stream_attr( + stream, "encoding", encoding + ) and _is_compat_stream_attr(stream, "errors", errors) + + +def _force_correct_text_stream( + text_stream: t.IO[t.Any], + encoding: t.Optional[str], + errors: t.Optional[str], + is_binary: t.Callable[[t.IO[t.Any], bool], bool], + find_binary: t.Callable[[t.IO[t.Any]], t.Optional[t.BinaryIO]], + force_readable: bool = False, + force_writable: bool = False, +) -> t.TextIO: + if is_binary(text_stream, False): + binary_reader = t.cast(t.BinaryIO, text_stream) + else: + text_stream = t.cast(t.TextIO, text_stream) + # If the stream looks compatible, and won't default to a + # misconfigured ascii encoding, return it as-is. + if _is_compatible_text_stream(text_stream, encoding, errors) and not ( + encoding is None and _stream_is_misconfigured(text_stream) + ): + return text_stream + + # Otherwise, get the underlying binary reader. + possible_binary_reader = find_binary(text_stream) + + # If that's not possible, silently use the original reader + # and get mojibake instead of exceptions. + if possible_binary_reader is None: + return text_stream + + binary_reader = possible_binary_reader + + # Default errors to replace instead of strict in order to get + # something that works. + if errors is None: + errors = "replace" + + # Wrap the binary stream in a text stream with the correct + # encoding parameters. + return _make_text_stream( + binary_reader, + encoding, + errors, + force_readable=force_readable, + force_writable=force_writable, + ) + + +def _force_correct_text_reader( + text_reader: t.IO[t.Any], + encoding: t.Optional[str], + errors: t.Optional[str], + force_readable: bool = False, +) -> t.TextIO: + return _force_correct_text_stream( + text_reader, + encoding, + errors, + _is_binary_reader, + _find_binary_reader, + force_readable=force_readable, + ) + + +def _force_correct_text_writer( + text_writer: t.IO[t.Any], + encoding: t.Optional[str], + errors: t.Optional[str], + force_writable: bool = False, +) -> t.TextIO: + return _force_correct_text_stream( + text_writer, + encoding, + errors, + _is_binary_writer, + _find_binary_writer, + force_writable=force_writable, + ) + + +def get_binary_stdin() -> t.BinaryIO: + reader = _find_binary_reader(sys.stdin) + if reader is None: + raise RuntimeError("Was not able to determine binary stream for sys.stdin.") + return reader + + +def get_binary_stdout() -> t.BinaryIO: + writer = _find_binary_writer(sys.stdout) + if writer is None: + raise RuntimeError("Was not able to determine binary stream for sys.stdout.") + return writer + + +def get_binary_stderr() -> t.BinaryIO: + writer = _find_binary_writer(sys.stderr) + if writer is None: + raise RuntimeError("Was not able to determine binary stream for sys.stderr.") + return writer + + +def get_text_stdin( + encoding: t.Optional[str] = None, errors: t.Optional[str] = None +) -> t.TextIO: + rv = _get_windows_console_stream(sys.stdin, encoding, errors) + if rv is not None: + return rv + return _force_correct_text_reader(sys.stdin, encoding, errors, force_readable=True) + + +def get_text_stdout( + encoding: t.Optional[str] = None, errors: t.Optional[str] = None +) -> t.TextIO: + rv = _get_windows_console_stream(sys.stdout, encoding, errors) + if rv is not None: + return rv + return _force_correct_text_writer(sys.stdout, encoding, errors, force_writable=True) + + +def get_text_stderr( + encoding: t.Optional[str] = None, errors: t.Optional[str] = None +) -> t.TextIO: + rv = _get_windows_console_stream(sys.stderr, encoding, errors) + if rv is not None: + return rv + return _force_correct_text_writer(sys.stderr, encoding, errors, force_writable=True) + + +def _wrap_io_open( + file: t.Union[str, "os.PathLike[str]", int], + mode: str, + encoding: t.Optional[str], + errors: t.Optional[str], +) -> t.IO[t.Any]: + """Handles not passing ``encoding`` and ``errors`` in binary mode.""" + if "b" in mode: + return open(file, mode) + + return open(file, mode, encoding=encoding, errors=errors) + + +def open_stream( + filename: "t.Union[str, os.PathLike[str]]", + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + atomic: bool = False, +) -> t.Tuple[t.IO[t.Any], bool]: + binary = "b" in mode + filename = os.fspath(filename) + + # Standard streams first. These are simple because they ignore the + # atomic flag. Use fsdecode to handle Path("-"). + if os.fsdecode(filename) == "-": + if any(m in mode for m in ["w", "a", "x"]): + if binary: + return get_binary_stdout(), False + return get_text_stdout(encoding=encoding, errors=errors), False + if binary: + return get_binary_stdin(), False + return get_text_stdin(encoding=encoding, errors=errors), False + + # Non-atomic writes directly go out through the regular open functions. + if not atomic: + return _wrap_io_open(filename, mode, encoding, errors), True + + # Some usability stuff for atomic writes + if "a" in mode: + raise ValueError( + "Appending to an existing file is not supported, because that" + " would involve an expensive `copy`-operation to a temporary" + " file. Open the file in normal `w`-mode and copy explicitly" + " if that's what you're after." + ) + if "x" in mode: + raise ValueError("Use the `overwrite`-parameter instead.") + if "w" not in mode: + raise ValueError("Atomic writes only make sense with `w`-mode.") + + # Atomic writes are more complicated. They work by opening a file + # as a proxy in the same folder and then using the fdopen + # functionality to wrap it in a Python file. Then we wrap it in an + # atomic file that moves the file over on close. + import errno + import random + + try: + perm: t.Optional[int] = os.stat(filename).st_mode + except OSError: + perm = None + + flags = os.O_RDWR | os.O_CREAT | os.O_EXCL + + if binary: + flags |= getattr(os, "O_BINARY", 0) + + while True: + tmp_filename = os.path.join( + os.path.dirname(filename), + f".__atomic-write{random.randrange(1 << 32):08x}", + ) + try: + fd = os.open(tmp_filename, flags, 0o666 if perm is None else perm) + break + except OSError as e: + if e.errno == errno.EEXIST or ( + os.name == "nt" + and e.errno == errno.EACCES + and os.path.isdir(e.filename) + and os.access(e.filename, os.W_OK) + ): + continue + raise + + if perm is not None: + os.chmod(tmp_filename, perm) # in case perm includes bits in umask + + f = _wrap_io_open(fd, mode, encoding, errors) + af = _AtomicFile(f, tmp_filename, os.path.realpath(filename)) + return t.cast(t.IO[t.Any], af), True + + +class _AtomicFile: + def __init__(self, f: t.IO[t.Any], tmp_filename: str, real_filename: str) -> None: + self._f = f + self._tmp_filename = tmp_filename + self._real_filename = real_filename + self.closed = False + + @property + def name(self) -> str: + return self._real_filename + + def close(self, delete: bool = False) -> None: + if self.closed: + return + self._f.close() + os.replace(self._tmp_filename, self._real_filename) + self.closed = True + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._f, name) + + def __enter__(self) -> "_AtomicFile": + return self + + def __exit__(self, exc_type: t.Optional[t.Type[BaseException]], *_: t.Any) -> None: + self.close(delete=exc_type is not None) + + def __repr__(self) -> str: + return repr(self._f) + + +def strip_ansi(value: str) -> str: + return _ansi_re.sub("", value) + + +def _is_jupyter_kernel_output(stream: t.IO[t.Any]) -> bool: + while isinstance(stream, (_FixupStream, _NonClosingTextIOWrapper)): + stream = stream._stream + + return stream.__class__.__module__.startswith("ipykernel.") + + +def should_strip_ansi( + stream: t.Optional[t.IO[t.Any]] = None, color: t.Optional[bool] = None +) -> bool: + if color is None: + if stream is None: + stream = sys.stdin + return not isatty(stream) and not _is_jupyter_kernel_output(stream) + return not color + + +# On Windows, wrap the output streams with colorama to support ANSI +# color codes. +# NOTE: double check is needed so mypy does not analyze this on Linux +if sys.platform.startswith("win") and WIN: + from ._winconsole import _get_windows_console_stream + + def _get_argv_encoding() -> str: + import locale + + return locale.getpreferredencoding() + + _ansi_stream_wrappers: t.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary() + + def auto_wrap_for_ansi( # noqa: F811 + stream: t.TextIO, color: t.Optional[bool] = None + ) -> t.TextIO: + """Support ANSI color and style codes on Windows by wrapping a + stream with colorama. + """ + try: + cached = _ansi_stream_wrappers.get(stream) + except Exception: + cached = None + + if cached is not None: + return cached + + import colorama + + strip = should_strip_ansi(stream, color) + ansi_wrapper = colorama.AnsiToWin32(stream, strip=strip) + rv = t.cast(t.TextIO, ansi_wrapper.stream) + _write = rv.write + + def _safe_write(s): + try: + return _write(s) + except BaseException: + ansi_wrapper.reset_all() + raise + + rv.write = _safe_write + + try: + _ansi_stream_wrappers[stream] = rv + except Exception: + pass + + return rv + +else: + + def _get_argv_encoding() -> str: + return getattr(sys.stdin, "encoding", None) or sys.getfilesystemencoding() + + def _get_windows_console_stream( + f: t.TextIO, encoding: t.Optional[str], errors: t.Optional[str] + ) -> t.Optional[t.TextIO]: + return None + + +def term_len(x: str) -> int: + return len(strip_ansi(x)) + + +def isatty(stream: t.IO[t.Any]) -> bool: + try: + return stream.isatty() + except Exception: + return False + + +def _make_cached_stream_func( + src_func: t.Callable[[], t.Optional[t.TextIO]], + wrapper_func: t.Callable[[], t.TextIO], +) -> t.Callable[[], t.Optional[t.TextIO]]: + cache: t.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary() + + def func() -> t.Optional[t.TextIO]: + stream = src_func() + + if stream is None: + return None + + try: + rv = cache.get(stream) + except Exception: + rv = None + if rv is not None: + return rv + rv = wrapper_func() + try: + cache[stream] = rv + except Exception: + pass + return rv + + return func + + +_default_text_stdin = _make_cached_stream_func(lambda: sys.stdin, get_text_stdin) +_default_text_stdout = _make_cached_stream_func(lambda: sys.stdout, get_text_stdout) +_default_text_stderr = _make_cached_stream_func(lambda: sys.stderr, get_text_stderr) + + +binary_streams: t.Mapping[str, t.Callable[[], t.BinaryIO]] = { + "stdin": get_binary_stdin, + "stdout": get_binary_stdout, + "stderr": get_binary_stderr, +} + +text_streams: t.Mapping[ + str, t.Callable[[t.Optional[str], t.Optional[str]], t.TextIO] +] = { + "stdin": get_text_stdin, + "stdout": get_text_stdout, + "stderr": get_text_stderr, +} diff --git a/click/python/click/_termui_impl.py b/click/python/click/_termui_impl.py new file mode 100644 index 0000000..f744657 --- /dev/null +++ b/click/python/click/_termui_impl.py @@ -0,0 +1,739 @@ +""" +This module contains implementations for the termui module. To keep the +import time of Click down, some infrequently used functionality is +placed in this module and only imported as needed. +""" +import contextlib +import math +import os +import sys +import time +import typing as t +from gettext import gettext as _ +from io import StringIO +from types import TracebackType + +from ._compat import _default_text_stdout +from ._compat import CYGWIN +from ._compat import get_best_encoding +from ._compat import isatty +from ._compat import open_stream +from ._compat import strip_ansi +from ._compat import term_len +from ._compat import WIN +from .exceptions import ClickException +from .utils import echo + +V = t.TypeVar("V") + +if os.name == "nt": + BEFORE_BAR = "\r" + AFTER_BAR = "\n" +else: + BEFORE_BAR = "\r\033[?25l" + AFTER_BAR = "\033[?25h\n" + + +class ProgressBar(t.Generic[V]): + def __init__( + self, + iterable: t.Optional[t.Iterable[V]], + length: t.Optional[int] = None, + fill_char: str = "#", + empty_char: str = " ", + bar_template: str = "%(bar)s", + info_sep: str = " ", + show_eta: bool = True, + show_percent: t.Optional[bool] = None, + show_pos: bool = False, + item_show_func: t.Optional[t.Callable[[t.Optional[V]], t.Optional[str]]] = None, + label: t.Optional[str] = None, + file: t.Optional[t.TextIO] = None, + color: t.Optional[bool] = None, + update_min_steps: int = 1, + width: int = 30, + ) -> None: + self.fill_char = fill_char + self.empty_char = empty_char + self.bar_template = bar_template + self.info_sep = info_sep + self.show_eta = show_eta + self.show_percent = show_percent + self.show_pos = show_pos + self.item_show_func = item_show_func + self.label: str = label or "" + + if file is None: + file = _default_text_stdout() + + # There are no standard streams attached to write to. For example, + # pythonw on Windows. + if file is None: + file = StringIO() + + self.file = file + self.color = color + self.update_min_steps = update_min_steps + self._completed_intervals = 0 + self.width: int = width + self.autowidth: bool = width == 0 + + if length is None: + from operator import length_hint + + length = length_hint(iterable, -1) + + if length == -1: + length = None + if iterable is None: + if length is None: + raise TypeError("iterable or length is required") + iterable = t.cast(t.Iterable[V], range(length)) + self.iter: t.Iterable[V] = iter(iterable) + self.length = length + self.pos = 0 + self.avg: t.List[float] = [] + self.last_eta: float + self.start: float + self.start = self.last_eta = time.time() + self.eta_known: bool = False + self.finished: bool = False + self.max_width: t.Optional[int] = None + self.entered: bool = False + self.current_item: t.Optional[V] = None + self.is_hidden: bool = not isatty(self.file) + self._last_line: t.Optional[str] = None + + def __enter__(self) -> "ProgressBar[V]": + self.entered = True + self.render_progress() + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + self.render_finish() + + def __iter__(self) -> t.Iterator[V]: + if not self.entered: + raise RuntimeError("You need to use progress bars in a with block.") + self.render_progress() + return self.generator() + + def __next__(self) -> V: + # Iteration is defined in terms of a generator function, + # returned by iter(self); use that to define next(). This works + # because `self.iter` is an iterable consumed by that generator, + # so it is re-entry safe. Calling `next(self.generator())` + # twice works and does "what you want". + return next(iter(self)) + + def render_finish(self) -> None: + if self.is_hidden: + return + self.file.write(AFTER_BAR) + self.file.flush() + + @property + def pct(self) -> float: + if self.finished: + return 1.0 + return min(self.pos / (float(self.length or 1) or 1), 1.0) + + @property + def time_per_iteration(self) -> float: + if not self.avg: + return 0.0 + return sum(self.avg) / float(len(self.avg)) + + @property + def eta(self) -> float: + if self.length is not None and not self.finished: + return self.time_per_iteration * (self.length - self.pos) + return 0.0 + + def format_eta(self) -> str: + if self.eta_known: + t = int(self.eta) + seconds = t % 60 + t //= 60 + minutes = t % 60 + t //= 60 + hours = t % 24 + t //= 24 + if t > 0: + return f"{t}d {hours:02}:{minutes:02}:{seconds:02}" + else: + return f"{hours:02}:{minutes:02}:{seconds:02}" + return "" + + def format_pos(self) -> str: + pos = str(self.pos) + if self.length is not None: + pos += f"/{self.length}" + return pos + + def format_pct(self) -> str: + return f"{int(self.pct * 100): 4}%"[1:] + + def format_bar(self) -> str: + if self.length is not None: + bar_length = int(self.pct * self.width) + bar = self.fill_char * bar_length + bar += self.empty_char * (self.width - bar_length) + elif self.finished: + bar = self.fill_char * self.width + else: + chars = list(self.empty_char * (self.width or 1)) + if self.time_per_iteration != 0: + chars[ + int( + (math.cos(self.pos * self.time_per_iteration) / 2.0 + 0.5) + * self.width + ) + ] = self.fill_char + bar = "".join(chars) + return bar + + def format_progress_line(self) -> str: + show_percent = self.show_percent + + info_bits = [] + if self.length is not None and show_percent is None: + show_percent = not self.show_pos + + if self.show_pos: + info_bits.append(self.format_pos()) + if show_percent: + info_bits.append(self.format_pct()) + if self.show_eta and self.eta_known and not self.finished: + info_bits.append(self.format_eta()) + if self.item_show_func is not None: + item_info = self.item_show_func(self.current_item) + if item_info is not None: + info_bits.append(item_info) + + return ( + self.bar_template + % { + "label": self.label, + "bar": self.format_bar(), + "info": self.info_sep.join(info_bits), + } + ).rstrip() + + def render_progress(self) -> None: + import shutil + + if self.is_hidden: + # Only output the label as it changes if the output is not a + # TTY. Use file=stderr if you expect to be piping stdout. + if self._last_line != self.label: + self._last_line = self.label + echo(self.label, file=self.file, color=self.color) + + return + + buf = [] + # Update width in case the terminal has been resized + if self.autowidth: + old_width = self.width + self.width = 0 + clutter_length = term_len(self.format_progress_line()) + new_width = max(0, shutil.get_terminal_size().columns - clutter_length) + if new_width < old_width: + buf.append(BEFORE_BAR) + buf.append(" " * self.max_width) # type: ignore + self.max_width = new_width + self.width = new_width + + clear_width = self.width + if self.max_width is not None: + clear_width = self.max_width + + buf.append(BEFORE_BAR) + line = self.format_progress_line() + line_len = term_len(line) + if self.max_width is None or self.max_width < line_len: + self.max_width = line_len + + buf.append(line) + buf.append(" " * (clear_width - line_len)) + line = "".join(buf) + # Render the line only if it changed. + + if line != self._last_line: + self._last_line = line + echo(line, file=self.file, color=self.color, nl=False) + self.file.flush() + + def make_step(self, n_steps: int) -> None: + self.pos += n_steps + if self.length is not None and self.pos >= self.length: + self.finished = True + + if (time.time() - self.last_eta) < 1.0: + return + + self.last_eta = time.time() + + # self.avg is a rolling list of length <= 7 of steps where steps are + # defined as time elapsed divided by the total progress through + # self.length. + if self.pos: + step = (time.time() - self.start) / self.pos + else: + step = time.time() - self.start + + self.avg = self.avg[-6:] + [step] + + self.eta_known = self.length is not None + + def update(self, n_steps: int, current_item: t.Optional[V] = None) -> None: + """Update the progress bar by advancing a specified number of + steps, and optionally set the ``current_item`` for this new + position. + + :param n_steps: Number of steps to advance. + :param current_item: Optional item to set as ``current_item`` + for the updated position. + + .. versionchanged:: 8.0 + Added the ``current_item`` optional parameter. + + .. versionchanged:: 8.0 + Only render when the number of steps meets the + ``update_min_steps`` threshold. + """ + if current_item is not None: + self.current_item = current_item + + self._completed_intervals += n_steps + + if self._completed_intervals >= self.update_min_steps: + self.make_step(self._completed_intervals) + self.render_progress() + self._completed_intervals = 0 + + def finish(self) -> None: + self.eta_known = False + self.current_item = None + self.finished = True + + def generator(self) -> t.Iterator[V]: + """Return a generator which yields the items added to the bar + during construction, and updates the progress bar *after* the + yielded block returns. + """ + # WARNING: the iterator interface for `ProgressBar` relies on + # this and only works because this is a simple generator which + # doesn't create or manage additional state. If this function + # changes, the impact should be evaluated both against + # `iter(bar)` and `next(bar)`. `next()` in particular may call + # `self.generator()` repeatedly, and this must remain safe in + # order for that interface to work. + if not self.entered: + raise RuntimeError("You need to use progress bars in a with block.") + + if self.is_hidden: + yield from self.iter + else: + for rv in self.iter: + self.current_item = rv + + # This allows show_item_func to be updated before the + # item is processed. Only trigger at the beginning of + # the update interval. + if self._completed_intervals == 0: + self.render_progress() + + yield rv + self.update(1) + + self.finish() + self.render_progress() + + +def pager(generator: t.Iterable[str], color: t.Optional[bool] = None) -> None: + """Decide what method to use for paging through text.""" + stdout = _default_text_stdout() + + # There are no standard streams attached to write to. For example, + # pythonw on Windows. + if stdout is None: + stdout = StringIO() + + if not isatty(sys.stdin) or not isatty(stdout): + return _nullpager(stdout, generator, color) + pager_cmd = (os.environ.get("PAGER", None) or "").strip() + if pager_cmd: + if WIN: + return _tempfilepager(generator, pager_cmd, color) + return _pipepager(generator, pager_cmd, color) + if os.environ.get("TERM") in ("dumb", "emacs"): + return _nullpager(stdout, generator, color) + if WIN or sys.platform.startswith("os2"): + return _tempfilepager(generator, "more <", color) + if hasattr(os, "system") and os.system("(less) 2>/dev/null") == 0: + return _pipepager(generator, "less", color) + + import tempfile + + fd, filename = tempfile.mkstemp() + os.close(fd) + try: + if hasattr(os, "system") and os.system(f'more "{filename}"') == 0: + return _pipepager(generator, "more", color) + return _nullpager(stdout, generator, color) + finally: + os.unlink(filename) + + +def _pipepager(generator: t.Iterable[str], cmd: str, color: t.Optional[bool]) -> None: + """Page through text by feeding it to another program. Invoking a + pager through this might support colors. + """ + import subprocess + + env = dict(os.environ) + + # If we're piping to less we might support colors under the + # condition that + cmd_detail = cmd.rsplit("/", 1)[-1].split() + if color is None and cmd_detail[0] == "less": + less_flags = f"{os.environ.get('LESS', '')}{' '.join(cmd_detail[1:])}" + if not less_flags: + env["LESS"] = "-R" + color = True + elif "r" in less_flags or "R" in less_flags: + color = True + + c = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, env=env) + stdin = t.cast(t.BinaryIO, c.stdin) + encoding = get_best_encoding(stdin) + try: + for text in generator: + if not color: + text = strip_ansi(text) + + stdin.write(text.encode(encoding, "replace")) + except (OSError, KeyboardInterrupt): + pass + else: + stdin.close() + + # Less doesn't respect ^C, but catches it for its own UI purposes (aborting + # search or other commands inside less). + # + # That means when the user hits ^C, the parent process (click) terminates, + # but less is still alive, paging the output and messing up the terminal. + # + # If the user wants to make the pager exit on ^C, they should set + # `LESS='-K'`. It's not our decision to make. + while True: + try: + c.wait() + except KeyboardInterrupt: + pass + else: + break + + +def _tempfilepager( + generator: t.Iterable[str], cmd: str, color: t.Optional[bool] +) -> None: + """Page through text by invoking a program on a temporary file.""" + import tempfile + + fd, filename = tempfile.mkstemp() + # TODO: This never terminates if the passed generator never terminates. + text = "".join(generator) + if not color: + text = strip_ansi(text) + encoding = get_best_encoding(sys.stdout) + with open_stream(filename, "wb")[0] as f: + f.write(text.encode(encoding)) + try: + os.system(f'{cmd} "{filename}"') + finally: + os.close(fd) + os.unlink(filename) + + +def _nullpager( + stream: t.TextIO, generator: t.Iterable[str], color: t.Optional[bool] +) -> None: + """Simply print unformatted text. This is the ultimate fallback.""" + for text in generator: + if not color: + text = strip_ansi(text) + stream.write(text) + + +class Editor: + def __init__( + self, + editor: t.Optional[str] = None, + env: t.Optional[t.Mapping[str, str]] = None, + require_save: bool = True, + extension: str = ".txt", + ) -> None: + self.editor = editor + self.env = env + self.require_save = require_save + self.extension = extension + + def get_editor(self) -> str: + if self.editor is not None: + return self.editor + for key in "VISUAL", "EDITOR": + rv = os.environ.get(key) + if rv: + return rv + if WIN: + return "notepad" + for editor in "sensible-editor", "vim", "nano": + if os.system(f"which {editor} >/dev/null 2>&1") == 0: + return editor + return "vi" + + def edit_file(self, filename: str) -> None: + import subprocess + + editor = self.get_editor() + environ: t.Optional[t.Dict[str, str]] = None + + if self.env: + environ = os.environ.copy() + environ.update(self.env) + + try: + c = subprocess.Popen(f'{editor} "{filename}"', env=environ, shell=True) + exit_code = c.wait() + if exit_code != 0: + raise ClickException( + _("{editor}: Editing failed").format(editor=editor) + ) + except OSError as e: + raise ClickException( + _("{editor}: Editing failed: {e}").format(editor=editor, e=e) + ) from e + + def edit(self, text: t.Optional[t.AnyStr]) -> t.Optional[t.AnyStr]: + import tempfile + + if not text: + data = b"" + elif isinstance(text, (bytes, bytearray)): + data = text + else: + if text and not text.endswith("\n"): + text += "\n" + + if WIN: + data = text.replace("\n", "\r\n").encode("utf-8-sig") + else: + data = text.encode("utf-8") + + fd, name = tempfile.mkstemp(prefix="editor-", suffix=self.extension) + f: t.BinaryIO + + try: + with os.fdopen(fd, "wb") as f: + f.write(data) + + # If the filesystem resolution is 1 second, like Mac OS + # 10.12 Extended, or 2 seconds, like FAT32, and the editor + # closes very fast, require_save can fail. Set the modified + # time to be 2 seconds in the past to work around this. + os.utime(name, (os.path.getatime(name), os.path.getmtime(name) - 2)) + # Depending on the resolution, the exact value might not be + # recorded, so get the new recorded value. + timestamp = os.path.getmtime(name) + + self.edit_file(name) + + if self.require_save and os.path.getmtime(name) == timestamp: + return None + + with open(name, "rb") as f: + rv = f.read() + + if isinstance(text, (bytes, bytearray)): + return rv + + return rv.decode("utf-8-sig").replace("\r\n", "\n") # type: ignore + finally: + os.unlink(name) + + +def open_url(url: str, wait: bool = False, locate: bool = False) -> int: + import subprocess + + def _unquote_file(url: str) -> str: + from urllib.parse import unquote + + if url.startswith("file://"): + url = unquote(url[7:]) + + return url + + if sys.platform == "darwin": + args = ["open"] + if wait: + args.append("-W") + if locate: + args.append("-R") + args.append(_unquote_file(url)) + null = open("/dev/null", "w") + try: + return subprocess.Popen(args, stderr=null).wait() + finally: + null.close() + elif WIN: + if locate: + url = _unquote_file(url.replace('"', "")) + args = f'explorer /select,"{url}"' + else: + url = url.replace('"', "") + wait_str = "/WAIT" if wait else "" + args = f'start {wait_str} "" "{url}"' + return os.system(args) + elif CYGWIN: + if locate: + url = os.path.dirname(_unquote_file(url).replace('"', "")) + args = f'cygstart "{url}"' + else: + url = url.replace('"', "") + wait_str = "-w" if wait else "" + args = f'cygstart {wait_str} "{url}"' + return os.system(args) + + try: + if locate: + url = os.path.dirname(_unquote_file(url)) or "." + else: + url = _unquote_file(url) + c = subprocess.Popen(["xdg-open", url]) + if wait: + return c.wait() + return 0 + except OSError: + if url.startswith(("http://", "https://")) and not locate and not wait: + import webbrowser + + webbrowser.open(url) + return 0 + return 1 + + +def _translate_ch_to_exc(ch: str) -> t.Optional[BaseException]: + if ch == "\x03": + raise KeyboardInterrupt() + + if ch == "\x04" and not WIN: # Unix-like, Ctrl+D + raise EOFError() + + if ch == "\x1a" and WIN: # Windows, Ctrl+Z + raise EOFError() + + return None + + +if WIN: + import msvcrt + + @contextlib.contextmanager + def raw_terminal() -> t.Iterator[int]: + yield -1 + + def getchar(echo: bool) -> str: + # The function `getch` will return a bytes object corresponding to + # the pressed character. Since Windows 10 build 1803, it will also + # return \x00 when called a second time after pressing a regular key. + # + # `getwch` does not share this probably-bugged behavior. Moreover, it + # returns a Unicode object by default, which is what we want. + # + # Either of these functions will return \x00 or \xe0 to indicate + # a special key, and you need to call the same function again to get + # the "rest" of the code. The fun part is that \u00e0 is + # "latin small letter a with grave", so if you type that on a French + # keyboard, you _also_ get a \xe0. + # E.g., consider the Up arrow. This returns \xe0 and then \x48. The + # resulting Unicode string reads as "a with grave" + "capital H". + # This is indistinguishable from when the user actually types + # "a with grave" and then "capital H". + # + # When \xe0 is returned, we assume it's part of a special-key sequence + # and call `getwch` again, but that means that when the user types + # the \u00e0 character, `getchar` doesn't return until a second + # character is typed. + # The alternative is returning immediately, but that would mess up + # cross-platform handling of arrow keys and others that start with + # \xe0. Another option is using `getch`, but then we can't reliably + # read non-ASCII characters, because return values of `getch` are + # limited to the current 8-bit codepage. + # + # Anyway, Click doesn't claim to do this Right(tm), and using `getwch` + # is doing the right thing in more situations than with `getch`. + func: t.Callable[[], str] + + if echo: + func = msvcrt.getwche # type: ignore + else: + func = msvcrt.getwch # type: ignore + + rv = func() + + if rv in ("\x00", "\xe0"): + # \x00 and \xe0 are control characters that indicate special key, + # see above. + rv += func() + + _translate_ch_to_exc(rv) + return rv + +else: + import tty + import termios + + @contextlib.contextmanager + def raw_terminal() -> t.Iterator[int]: + f: t.Optional[t.TextIO] + fd: int + + if not isatty(sys.stdin): + f = open("/dev/tty") + fd = f.fileno() + else: + fd = sys.stdin.fileno() + f = None + + try: + old_settings = termios.tcgetattr(fd) + + try: + tty.setraw(fd) + yield fd + finally: + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) + sys.stdout.flush() + + if f is not None: + f.close() + except termios.error: + pass + + def getchar(echo: bool) -> str: + with raw_terminal() as fd: + ch = os.read(fd, 32).decode(get_best_encoding(sys.stdin), "replace") + + if echo and isatty(sys.stdout): + sys.stdout.write(ch) + + _translate_ch_to_exc(ch) + return ch diff --git a/click/python/click/_textwrap.py b/click/python/click/_textwrap.py new file mode 100644 index 0000000..b47dcbd --- /dev/null +++ b/click/python/click/_textwrap.py @@ -0,0 +1,49 @@ +import textwrap +import typing as t +from contextlib import contextmanager + + +class TextWrapper(textwrap.TextWrapper): + def _handle_long_word( + self, + reversed_chunks: t.List[str], + cur_line: t.List[str], + cur_len: int, + width: int, + ) -> None: + space_left = max(width - cur_len, 1) + + if self.break_long_words: + last = reversed_chunks[-1] + cut = last[:space_left] + res = last[space_left:] + cur_line.append(cut) + reversed_chunks[-1] = res + elif not cur_line: + cur_line.append(reversed_chunks.pop()) + + @contextmanager + def extra_indent(self, indent: str) -> t.Iterator[None]: + old_initial_indent = self.initial_indent + old_subsequent_indent = self.subsequent_indent + self.initial_indent += indent + self.subsequent_indent += indent + + try: + yield + finally: + self.initial_indent = old_initial_indent + self.subsequent_indent = old_subsequent_indent + + def indent_only(self, text: str) -> str: + rv = [] + + for idx, line in enumerate(text.splitlines()): + indent = self.initial_indent + + if idx > 0: + indent = self.subsequent_indent + + rv.append(f"{indent}{line}") + + return "\n".join(rv) diff --git a/click/python/click/_winconsole.py b/click/python/click/_winconsole.py new file mode 100644 index 0000000..6b20df3 --- /dev/null +++ b/click/python/click/_winconsole.py @@ -0,0 +1,279 @@ +# This module is based on the excellent work by Adam Bartoš who +# provided a lot of what went into the implementation here in +# the discussion to issue1602 in the Python bug tracker. +# +# There are some general differences in regards to how this works +# compared to the original patches as we do not need to patch +# the entire interpreter but just work in our little world of +# echo and prompt. +import io +import sys +import time +import typing as t +from ctypes import byref +from ctypes import c_char +from ctypes import c_char_p +from ctypes import c_int +from ctypes import c_ssize_t +from ctypes import c_ulong +from ctypes import c_void_p +from ctypes import POINTER +from ctypes import py_object +from ctypes import Structure +from ctypes.wintypes import DWORD +from ctypes.wintypes import HANDLE +from ctypes.wintypes import LPCWSTR +from ctypes.wintypes import LPWSTR + +from ._compat import _NonClosingTextIOWrapper + +assert sys.platform == "win32" +import msvcrt # noqa: E402 +from ctypes import windll # noqa: E402 +from ctypes import WINFUNCTYPE # noqa: E402 + +c_ssize_p = POINTER(c_ssize_t) + +kernel32 = windll.kernel32 +GetStdHandle = kernel32.GetStdHandle +ReadConsoleW = kernel32.ReadConsoleW +WriteConsoleW = kernel32.WriteConsoleW +GetConsoleMode = kernel32.GetConsoleMode +GetLastError = kernel32.GetLastError +GetCommandLineW = WINFUNCTYPE(LPWSTR)(("GetCommandLineW", windll.kernel32)) +CommandLineToArgvW = WINFUNCTYPE(POINTER(LPWSTR), LPCWSTR, POINTER(c_int))( + ("CommandLineToArgvW", windll.shell32) +) +LocalFree = WINFUNCTYPE(c_void_p, c_void_p)(("LocalFree", windll.kernel32)) + +STDIN_HANDLE = GetStdHandle(-10) +STDOUT_HANDLE = GetStdHandle(-11) +STDERR_HANDLE = GetStdHandle(-12) + +PyBUF_SIMPLE = 0 +PyBUF_WRITABLE = 1 + +ERROR_SUCCESS = 0 +ERROR_NOT_ENOUGH_MEMORY = 8 +ERROR_OPERATION_ABORTED = 995 + +STDIN_FILENO = 0 +STDOUT_FILENO = 1 +STDERR_FILENO = 2 + +EOF = b"\x1a" +MAX_BYTES_WRITTEN = 32767 + +try: + from ctypes import pythonapi +except ImportError: + # On PyPy we cannot get buffers so our ability to operate here is + # severely limited. + get_buffer = None +else: + + class Py_buffer(Structure): + _fields_ = [ + ("buf", c_void_p), + ("obj", py_object), + ("len", c_ssize_t), + ("itemsize", c_ssize_t), + ("readonly", c_int), + ("ndim", c_int), + ("format", c_char_p), + ("shape", c_ssize_p), + ("strides", c_ssize_p), + ("suboffsets", c_ssize_p), + ("internal", c_void_p), + ] + + PyObject_GetBuffer = pythonapi.PyObject_GetBuffer + PyBuffer_Release = pythonapi.PyBuffer_Release + + def get_buffer(obj, writable=False): + buf = Py_buffer() + flags = PyBUF_WRITABLE if writable else PyBUF_SIMPLE + PyObject_GetBuffer(py_object(obj), byref(buf), flags) + + try: + buffer_type = c_char * buf.len + return buffer_type.from_address(buf.buf) + finally: + PyBuffer_Release(byref(buf)) + + +class _WindowsConsoleRawIOBase(io.RawIOBase): + def __init__(self, handle): + self.handle = handle + + def isatty(self): + super().isatty() + return True + + +class _WindowsConsoleReader(_WindowsConsoleRawIOBase): + def readable(self): + return True + + def readinto(self, b): + bytes_to_be_read = len(b) + if not bytes_to_be_read: + return 0 + elif bytes_to_be_read % 2: + raise ValueError( + "cannot read odd number of bytes from UTF-16-LE encoded console" + ) + + buffer = get_buffer(b, writable=True) + code_units_to_be_read = bytes_to_be_read // 2 + code_units_read = c_ulong() + + rv = ReadConsoleW( + HANDLE(self.handle), + buffer, + code_units_to_be_read, + byref(code_units_read), + None, + ) + if GetLastError() == ERROR_OPERATION_ABORTED: + # wait for KeyboardInterrupt + time.sleep(0.1) + if not rv: + raise OSError(f"Windows error: {GetLastError()}") + + if buffer[0] == EOF: + return 0 + return 2 * code_units_read.value + + +class _WindowsConsoleWriter(_WindowsConsoleRawIOBase): + def writable(self): + return True + + @staticmethod + def _get_error_message(errno): + if errno == ERROR_SUCCESS: + return "ERROR_SUCCESS" + elif errno == ERROR_NOT_ENOUGH_MEMORY: + return "ERROR_NOT_ENOUGH_MEMORY" + return f"Windows error {errno}" + + def write(self, b): + bytes_to_be_written = len(b) + buf = get_buffer(b) + code_units_to_be_written = min(bytes_to_be_written, MAX_BYTES_WRITTEN) // 2 + code_units_written = c_ulong() + + WriteConsoleW( + HANDLE(self.handle), + buf, + code_units_to_be_written, + byref(code_units_written), + None, + ) + bytes_written = 2 * code_units_written.value + + if bytes_written == 0 and bytes_to_be_written > 0: + raise OSError(self._get_error_message(GetLastError())) + return bytes_written + + +class ConsoleStream: + def __init__(self, text_stream: t.TextIO, byte_stream: t.BinaryIO) -> None: + self._text_stream = text_stream + self.buffer = byte_stream + + @property + def name(self) -> str: + return self.buffer.name + + def write(self, x: t.AnyStr) -> int: + if isinstance(x, str): + return self._text_stream.write(x) + try: + self.flush() + except Exception: + pass + return self.buffer.write(x) + + def writelines(self, lines: t.Iterable[t.AnyStr]) -> None: + for line in lines: + self.write(line) + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._text_stream, name) + + def isatty(self) -> bool: + return self.buffer.isatty() + + def __repr__(self): + return f"" + + +def _get_text_stdin(buffer_stream: t.BinaryIO) -> t.TextIO: + text_stream = _NonClosingTextIOWrapper( + io.BufferedReader(_WindowsConsoleReader(STDIN_HANDLE)), + "utf-16-le", + "strict", + line_buffering=True, + ) + return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) + + +def _get_text_stdout(buffer_stream: t.BinaryIO) -> t.TextIO: + text_stream = _NonClosingTextIOWrapper( + io.BufferedWriter(_WindowsConsoleWriter(STDOUT_HANDLE)), + "utf-16-le", + "strict", + line_buffering=True, + ) + return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) + + +def _get_text_stderr(buffer_stream: t.BinaryIO) -> t.TextIO: + text_stream = _NonClosingTextIOWrapper( + io.BufferedWriter(_WindowsConsoleWriter(STDERR_HANDLE)), + "utf-16-le", + "strict", + line_buffering=True, + ) + return t.cast(t.TextIO, ConsoleStream(text_stream, buffer_stream)) + + +_stream_factories: t.Mapping[int, t.Callable[[t.BinaryIO], t.TextIO]] = { + 0: _get_text_stdin, + 1: _get_text_stdout, + 2: _get_text_stderr, +} + + +def _is_console(f: t.TextIO) -> bool: + if not hasattr(f, "fileno"): + return False + + try: + fileno = f.fileno() + except (OSError, io.UnsupportedOperation): + return False + + handle = msvcrt.get_osfhandle(fileno) + return bool(GetConsoleMode(handle, byref(DWORD()))) + + +def _get_windows_console_stream( + f: t.TextIO, encoding: t.Optional[str], errors: t.Optional[str] +) -> t.Optional[t.TextIO]: + if ( + get_buffer is not None + and encoding in {"utf-16-le", None} + and errors in {"strict", None} + and _is_console(f) + ): + func = _stream_factories.get(f.fileno()) + if func is not None: + b = getattr(f, "buffer", None) + + if b is None: + return None + + return func(b) diff --git a/click/python/click/core.py b/click/python/click/core.py new file mode 100644 index 0000000..cc65e89 --- /dev/null +++ b/click/python/click/core.py @@ -0,0 +1,3042 @@ +import enum +import errno +import inspect +import os +import sys +import typing as t +from collections import abc +from contextlib import contextmanager +from contextlib import ExitStack +from functools import update_wrapper +from gettext import gettext as _ +from gettext import ngettext +from itertools import repeat +from types import TracebackType + +from . import types +from .exceptions import Abort +from .exceptions import BadParameter +from .exceptions import ClickException +from .exceptions import Exit +from .exceptions import MissingParameter +from .exceptions import UsageError +from .formatting import HelpFormatter +from .formatting import join_options +from .globals import pop_context +from .globals import push_context +from .parser import _flag_needs_value +from .parser import OptionParser +from .parser import split_opt +from .termui import confirm +from .termui import prompt +from .termui import style +from .utils import _detect_program_name +from .utils import _expand_args +from .utils import echo +from .utils import make_default_short_help +from .utils import make_str +from .utils import PacifyFlushWrapper + +if t.TYPE_CHECKING: + import typing_extensions as te + from .shell_completion import CompletionItem + +F = t.TypeVar("F", bound=t.Callable[..., t.Any]) +V = t.TypeVar("V") + + +def _complete_visible_commands( + ctx: "Context", incomplete: str +) -> t.Iterator[t.Tuple[str, "Command"]]: + """List all the subcommands of a group that start with the + incomplete value and aren't hidden. + + :param ctx: Invocation context for the group. + :param incomplete: Value being completed. May be empty. + """ + multi = t.cast(MultiCommand, ctx.command) + + for name in multi.list_commands(ctx): + if name.startswith(incomplete): + command = multi.get_command(ctx, name) + + if command is not None and not command.hidden: + yield name, command + + +def _check_multicommand( + base_command: "MultiCommand", cmd_name: str, cmd: "Command", register: bool = False +) -> None: + if not base_command.chain or not isinstance(cmd, MultiCommand): + return + if register: + hint = ( + "It is not possible to add multi commands as children to" + " another multi command that is in chain mode." + ) + else: + hint = ( + "Found a multi command as subcommand to a multi command" + " that is in chain mode. This is not supported." + ) + raise RuntimeError( + f"{hint}. Command {base_command.name!r} is set to chain and" + f" {cmd_name!r} was added as a subcommand but it in itself is a" + f" multi command. ({cmd_name!r} is a {type(cmd).__name__}" + f" within a chained {type(base_command).__name__} named" + f" {base_command.name!r})." + ) + + +def batch(iterable: t.Iterable[V], batch_size: int) -> t.List[t.Tuple[V, ...]]: + return list(zip(*repeat(iter(iterable), batch_size))) + + +@contextmanager +def augment_usage_errors( + ctx: "Context", param: t.Optional["Parameter"] = None +) -> t.Iterator[None]: + """Context manager that attaches extra information to exceptions.""" + try: + yield + except BadParameter as e: + if e.ctx is None: + e.ctx = ctx + if param is not None and e.param is None: + e.param = param + raise + except UsageError as e: + if e.ctx is None: + e.ctx = ctx + raise + + +def iter_params_for_processing( + invocation_order: t.Sequence["Parameter"], + declaration_order: t.Sequence["Parameter"], +) -> t.List["Parameter"]: + """Given a sequence of parameters in the order as should be considered + for processing and an iterable of parameters that exist, this returns + a list in the correct order as they should be processed. + """ + + def sort_key(item: "Parameter") -> t.Tuple[bool, float]: + try: + idx: float = invocation_order.index(item) + except ValueError: + idx = float("inf") + + return not item.is_eager, idx + + return sorted(declaration_order, key=sort_key) + + +class ParameterSource(enum.Enum): + """This is an :class:`~enum.Enum` that indicates the source of a + parameter's value. + + Use :meth:`click.Context.get_parameter_source` to get the + source for a parameter by name. + + .. versionchanged:: 8.0 + Use :class:`~enum.Enum` and drop the ``validate`` method. + + .. versionchanged:: 8.0 + Added the ``PROMPT`` value. + """ + + COMMANDLINE = enum.auto() + """The value was provided by the command line args.""" + ENVIRONMENT = enum.auto() + """The value was provided with an environment variable.""" + DEFAULT = enum.auto() + """Used the default specified by the parameter.""" + DEFAULT_MAP = enum.auto() + """Used a default provided by :attr:`Context.default_map`.""" + PROMPT = enum.auto() + """Used a prompt to confirm a default or provide a value.""" + + +class Context: + """The context is a special internal object that holds state relevant + for the script execution at every single level. It's normally invisible + to commands unless they opt-in to getting access to it. + + The context is useful as it can pass internal objects around and can + control special execution features such as reading data from + environment variables. + + A context can be used as context manager in which case it will call + :meth:`close` on teardown. + + :param command: the command class for this context. + :param parent: the parent context. + :param info_name: the info name for this invocation. Generally this + is the most descriptive name for the script or + command. For the toplevel script it is usually + the name of the script, for commands below it it's + the name of the script. + :param obj: an arbitrary object of user data. + :param auto_envvar_prefix: the prefix to use for automatic environment + variables. If this is `None` then reading + from environment variables is disabled. This + does not affect manually set environment + variables which are always read. + :param default_map: a dictionary (like object) with default values + for parameters. + :param terminal_width: the width of the terminal. The default is + inherit from parent context. If no context + defines the terminal width then auto + detection will be applied. + :param max_content_width: the maximum width for content rendered by + Click (this currently only affects help + pages). This defaults to 80 characters if + not overridden. In other words: even if the + terminal is larger than that, Click will not + format things wider than 80 characters by + default. In addition to that, formatters might + add some safety mapping on the right. + :param resilient_parsing: if this flag is enabled then Click will + parse without any interactivity or callback + invocation. Default values will also be + ignored. This is useful for implementing + things such as completion support. + :param allow_extra_args: if this is set to `True` then extra arguments + at the end will not raise an error and will be + kept on the context. The default is to inherit + from the command. + :param allow_interspersed_args: if this is set to `False` then options + and arguments cannot be mixed. The + default is to inherit from the command. + :param ignore_unknown_options: instructs click to ignore options it does + not know and keeps them for later + processing. + :param help_option_names: optionally a list of strings that define how + the default help parameter is named. The + default is ``['--help']``. + :param token_normalize_func: an optional function that is used to + normalize tokens (options, choices, + etc.). This for instance can be used to + implement case insensitive behavior. + :param color: controls if the terminal supports ANSI colors or not. The + default is autodetection. This is only needed if ANSI + codes are used in texts that Click prints which is by + default not the case. This for instance would affect + help output. + :param show_default: Show the default value for commands. If this + value is not set, it defaults to the value from the parent + context. ``Command.show_default`` overrides this default for the + specific command. + + .. versionchanged:: 8.1 + The ``show_default`` parameter is overridden by + ``Command.show_default``, instead of the other way around. + + .. versionchanged:: 8.0 + The ``show_default`` parameter defaults to the value from the + parent context. + + .. versionchanged:: 7.1 + Added the ``show_default`` parameter. + + .. versionchanged:: 4.0 + Added the ``color``, ``ignore_unknown_options``, and + ``max_content_width`` parameters. + + .. versionchanged:: 3.0 + Added the ``allow_extra_args`` and ``allow_interspersed_args`` + parameters. + + .. versionchanged:: 2.0 + Added the ``resilient_parsing``, ``help_option_names``, and + ``token_normalize_func`` parameters. + """ + + #: The formatter class to create with :meth:`make_formatter`. + #: + #: .. versionadded:: 8.0 + formatter_class: t.Type["HelpFormatter"] = HelpFormatter + + def __init__( + self, + command: "Command", + parent: t.Optional["Context"] = None, + info_name: t.Optional[str] = None, + obj: t.Optional[t.Any] = None, + auto_envvar_prefix: t.Optional[str] = None, + default_map: t.Optional[t.MutableMapping[str, t.Any]] = None, + terminal_width: t.Optional[int] = None, + max_content_width: t.Optional[int] = None, + resilient_parsing: bool = False, + allow_extra_args: t.Optional[bool] = None, + allow_interspersed_args: t.Optional[bool] = None, + ignore_unknown_options: t.Optional[bool] = None, + help_option_names: t.Optional[t.List[str]] = None, + token_normalize_func: t.Optional[t.Callable[[str], str]] = None, + color: t.Optional[bool] = None, + show_default: t.Optional[bool] = None, + ) -> None: + #: the parent context or `None` if none exists. + self.parent = parent + #: the :class:`Command` for this context. + self.command = command + #: the descriptive information name + self.info_name = info_name + #: Map of parameter names to their parsed values. Parameters + #: with ``expose_value=False`` are not stored. + self.params: t.Dict[str, t.Any] = {} + #: the leftover arguments. + self.args: t.List[str] = [] + #: protected arguments. These are arguments that are prepended + #: to `args` when certain parsing scenarios are encountered but + #: must be never propagated to another arguments. This is used + #: to implement nested parsing. + self.protected_args: t.List[str] = [] + #: the collected prefixes of the command's options. + self._opt_prefixes: t.Set[str] = set(parent._opt_prefixes) if parent else set() + + if obj is None and parent is not None: + obj = parent.obj + + #: the user object stored. + self.obj: t.Any = obj + self._meta: t.Dict[str, t.Any] = getattr(parent, "meta", {}) + + #: A dictionary (-like object) with defaults for parameters. + if ( + default_map is None + and info_name is not None + and parent is not None + and parent.default_map is not None + ): + default_map = parent.default_map.get(info_name) + + self.default_map: t.Optional[t.MutableMapping[str, t.Any]] = default_map + + #: This flag indicates if a subcommand is going to be executed. A + #: group callback can use this information to figure out if it's + #: being executed directly or because the execution flow passes + #: onwards to a subcommand. By default it's None, but it can be + #: the name of the subcommand to execute. + #: + #: If chaining is enabled this will be set to ``'*'`` in case + #: any commands are executed. It is however not possible to + #: figure out which ones. If you require this knowledge you + #: should use a :func:`result_callback`. + self.invoked_subcommand: t.Optional[str] = None + + if terminal_width is None and parent is not None: + terminal_width = parent.terminal_width + + #: The width of the terminal (None is autodetection). + self.terminal_width: t.Optional[int] = terminal_width + + if max_content_width is None and parent is not None: + max_content_width = parent.max_content_width + + #: The maximum width of formatted content (None implies a sensible + #: default which is 80 for most things). + self.max_content_width: t.Optional[int] = max_content_width + + if allow_extra_args is None: + allow_extra_args = command.allow_extra_args + + #: Indicates if the context allows extra args or if it should + #: fail on parsing. + #: + #: .. versionadded:: 3.0 + self.allow_extra_args = allow_extra_args + + if allow_interspersed_args is None: + allow_interspersed_args = command.allow_interspersed_args + + #: Indicates if the context allows mixing of arguments and + #: options or not. + #: + #: .. versionadded:: 3.0 + self.allow_interspersed_args: bool = allow_interspersed_args + + if ignore_unknown_options is None: + ignore_unknown_options = command.ignore_unknown_options + + #: Instructs click to ignore options that a command does not + #: understand and will store it on the context for later + #: processing. This is primarily useful for situations where you + #: want to call into external programs. Generally this pattern is + #: strongly discouraged because it's not possibly to losslessly + #: forward all arguments. + #: + #: .. versionadded:: 4.0 + self.ignore_unknown_options: bool = ignore_unknown_options + + if help_option_names is None: + if parent is not None: + help_option_names = parent.help_option_names + else: + help_option_names = ["--help"] + + #: The names for the help options. + self.help_option_names: t.List[str] = help_option_names + + if token_normalize_func is None and parent is not None: + token_normalize_func = parent.token_normalize_func + + #: An optional normalization function for tokens. This is + #: options, choices, commands etc. + self.token_normalize_func: t.Optional[ + t.Callable[[str], str] + ] = token_normalize_func + + #: Indicates if resilient parsing is enabled. In that case Click + #: will do its best to not cause any failures and default values + #: will be ignored. Useful for completion. + self.resilient_parsing: bool = resilient_parsing + + # If there is no envvar prefix yet, but the parent has one and + # the command on this level has a name, we can expand the envvar + # prefix automatically. + if auto_envvar_prefix is None: + if ( + parent is not None + and parent.auto_envvar_prefix is not None + and self.info_name is not None + ): + auto_envvar_prefix = ( + f"{parent.auto_envvar_prefix}_{self.info_name.upper()}" + ) + else: + auto_envvar_prefix = auto_envvar_prefix.upper() + + if auto_envvar_prefix is not None: + auto_envvar_prefix = auto_envvar_prefix.replace("-", "_") + + self.auto_envvar_prefix: t.Optional[str] = auto_envvar_prefix + + if color is None and parent is not None: + color = parent.color + + #: Controls if styling output is wanted or not. + self.color: t.Optional[bool] = color + + if show_default is None and parent is not None: + show_default = parent.show_default + + #: Show option default values when formatting help text. + self.show_default: t.Optional[bool] = show_default + + self._close_callbacks: t.List[t.Callable[[], t.Any]] = [] + self._depth = 0 + self._parameter_source: t.Dict[str, ParameterSource] = {} + self._exit_stack = ExitStack() + + def to_info_dict(self) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. This traverses the entire CLI + structure. + + .. code-block:: python + + with Context(cli) as ctx: + info = ctx.to_info_dict() + + .. versionadded:: 8.0 + """ + return { + "command": self.command.to_info_dict(self), + "info_name": self.info_name, + "allow_extra_args": self.allow_extra_args, + "allow_interspersed_args": self.allow_interspersed_args, + "ignore_unknown_options": self.ignore_unknown_options, + "auto_envvar_prefix": self.auto_envvar_prefix, + } + + def __enter__(self) -> "Context": + self._depth += 1 + push_context(self) + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + self._depth -= 1 + if self._depth == 0: + self.close() + pop_context() + + @contextmanager + def scope(self, cleanup: bool = True) -> t.Iterator["Context"]: + """This helper method can be used with the context object to promote + it to the current thread local (see :func:`get_current_context`). + The default behavior of this is to invoke the cleanup functions which + can be disabled by setting `cleanup` to `False`. The cleanup + functions are typically used for things such as closing file handles. + + If the cleanup is intended the context object can also be directly + used as a context manager. + + Example usage:: + + with ctx.scope(): + assert get_current_context() is ctx + + This is equivalent:: + + with ctx: + assert get_current_context() is ctx + + .. versionadded:: 5.0 + + :param cleanup: controls if the cleanup functions should be run or + not. The default is to run these functions. In + some situations the context only wants to be + temporarily pushed in which case this can be disabled. + Nested pushes automatically defer the cleanup. + """ + if not cleanup: + self._depth += 1 + try: + with self as rv: + yield rv + finally: + if not cleanup: + self._depth -= 1 + + @property + def meta(self) -> t.Dict[str, t.Any]: + """This is a dictionary which is shared with all the contexts + that are nested. It exists so that click utilities can store some + state here if they need to. It is however the responsibility of + that code to manage this dictionary well. + + The keys are supposed to be unique dotted strings. For instance + module paths are a good choice for it. What is stored in there is + irrelevant for the operation of click. However what is important is + that code that places data here adheres to the general semantics of + the system. + + Example usage:: + + LANG_KEY = f'{__name__}.lang' + + def set_language(value): + ctx = get_current_context() + ctx.meta[LANG_KEY] = value + + def get_language(): + return get_current_context().meta.get(LANG_KEY, 'en_US') + + .. versionadded:: 5.0 + """ + return self._meta + + def make_formatter(self) -> HelpFormatter: + """Creates the :class:`~click.HelpFormatter` for the help and + usage output. + + To quickly customize the formatter class used without overriding + this method, set the :attr:`formatter_class` attribute. + + .. versionchanged:: 8.0 + Added the :attr:`formatter_class` attribute. + """ + return self.formatter_class( + width=self.terminal_width, max_width=self.max_content_width + ) + + def with_resource(self, context_manager: t.ContextManager[V]) -> V: + """Register a resource as if it were used in a ``with`` + statement. The resource will be cleaned up when the context is + popped. + + Uses :meth:`contextlib.ExitStack.enter_context`. It calls the + resource's ``__enter__()`` method and returns the result. When + the context is popped, it closes the stack, which calls the + resource's ``__exit__()`` method. + + To register a cleanup function for something that isn't a + context manager, use :meth:`call_on_close`. Or use something + from :mod:`contextlib` to turn it into a context manager first. + + .. code-block:: python + + @click.group() + @click.option("--name") + @click.pass_context + def cli(ctx): + ctx.obj = ctx.with_resource(connect_db(name)) + + :param context_manager: The context manager to enter. + :return: Whatever ``context_manager.__enter__()`` returns. + + .. versionadded:: 8.0 + """ + return self._exit_stack.enter_context(context_manager) + + def call_on_close(self, f: t.Callable[..., t.Any]) -> t.Callable[..., t.Any]: + """Register a function to be called when the context tears down. + + This can be used to close resources opened during the script + execution. Resources that support Python's context manager + protocol which would be used in a ``with`` statement should be + registered with :meth:`with_resource` instead. + + :param f: The function to execute on teardown. + """ + return self._exit_stack.callback(f) + + def close(self) -> None: + """Invoke all close callbacks registered with + :meth:`call_on_close`, and exit all context managers entered + with :meth:`with_resource`. + """ + self._exit_stack.close() + # In case the context is reused, create a new exit stack. + self._exit_stack = ExitStack() + + @property + def command_path(self) -> str: + """The computed command path. This is used for the ``usage`` + information on the help page. It's automatically created by + combining the info names of the chain of contexts to the root. + """ + rv = "" + if self.info_name is not None: + rv = self.info_name + if self.parent is not None: + parent_command_path = [self.parent.command_path] + + if isinstance(self.parent.command, Command): + for param in self.parent.command.get_params(self): + parent_command_path.extend(param.get_usage_pieces(self)) + + rv = f"{' '.join(parent_command_path)} {rv}" + return rv.lstrip() + + def find_root(self) -> "Context": + """Finds the outermost context.""" + node = self + while node.parent is not None: + node = node.parent + return node + + def find_object(self, object_type: t.Type[V]) -> t.Optional[V]: + """Finds the closest object of a given type.""" + node: t.Optional["Context"] = self + + while node is not None: + if isinstance(node.obj, object_type): + return node.obj + + node = node.parent + + return None + + def ensure_object(self, object_type: t.Type[V]) -> V: + """Like :meth:`find_object` but sets the innermost object to a + new instance of `object_type` if it does not exist. + """ + rv = self.find_object(object_type) + if rv is None: + self.obj = rv = object_type() + return rv + + @t.overload + def lookup_default( + self, name: str, call: "te.Literal[True]" = True + ) -> t.Optional[t.Any]: + ... + + @t.overload + def lookup_default( + self, name: str, call: "te.Literal[False]" = ... + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + ... + + def lookup_default(self, name: str, call: bool = True) -> t.Optional[t.Any]: + """Get the default for a parameter from :attr:`default_map`. + + :param name: Name of the parameter. + :param call: If the default is a callable, call it. Disable to + return the callable instead. + + .. versionchanged:: 8.0 + Added the ``call`` parameter. + """ + if self.default_map is not None: + value = self.default_map.get(name) + + if call and callable(value): + return value() + + return value + + return None + + def fail(self, message: str) -> "te.NoReturn": + """Aborts the execution of the program with a specific error + message. + + :param message: the error message to fail with. + """ + raise UsageError(message, self) + + def abort(self) -> "te.NoReturn": + """Aborts the script.""" + raise Abort() + + def exit(self, code: int = 0) -> "te.NoReturn": + """Exits the application with a given exit code.""" + raise Exit(code) + + def get_usage(self) -> str: + """Helper method to get formatted usage string for the current + context and command. + """ + return self.command.get_usage(self) + + def get_help(self) -> str: + """Helper method to get formatted help page for the current + context and command. + """ + return self.command.get_help(self) + + def _make_sub_context(self, command: "Command") -> "Context": + """Create a new context of the same type as this context, but + for a new command. + + :meta private: + """ + return type(self)(command, info_name=command.name, parent=self) + + @t.overload + def invoke( + __self, # noqa: B902 + __callback: "t.Callable[..., V]", + *args: t.Any, + **kwargs: t.Any, + ) -> V: + ... + + @t.overload + def invoke( + __self, # noqa: B902 + __callback: "Command", + *args: t.Any, + **kwargs: t.Any, + ) -> t.Any: + ... + + def invoke( + __self, # noqa: B902 + __callback: t.Union["Command", "t.Callable[..., V]"], + *args: t.Any, + **kwargs: t.Any, + ) -> t.Union[t.Any, V]: + """Invokes a command callback in exactly the way it expects. There + are two ways to invoke this method: + + 1. the first argument can be a callback and all other arguments and + keyword arguments are forwarded directly to the function. + 2. the first argument is a click command object. In that case all + arguments are forwarded as well but proper click parameters + (options and click arguments) must be keyword arguments and Click + will fill in defaults. + + Note that before Click 3.2 keyword arguments were not properly filled + in against the intention of this code and no context was created. For + more information about this change and why it was done in a bugfix + release see :ref:`upgrade-to-3.2`. + + .. versionchanged:: 8.0 + All ``kwargs`` are tracked in :attr:`params` so they will be + passed if :meth:`forward` is called at multiple levels. + """ + if isinstance(__callback, Command): + other_cmd = __callback + + if other_cmd.callback is None: + raise TypeError( + "The given command does not have a callback that can be invoked." + ) + else: + __callback = t.cast("t.Callable[..., V]", other_cmd.callback) + + ctx = __self._make_sub_context(other_cmd) + + for param in other_cmd.params: + if param.name not in kwargs and param.expose_value: + kwargs[param.name] = param.type_cast_value( # type: ignore + ctx, param.get_default(ctx) + ) + + # Track all kwargs as params, so that forward() will pass + # them on in subsequent calls. + ctx.params.update(kwargs) + else: + ctx = __self + + with augment_usage_errors(__self): + with ctx: + return __callback(*args, **kwargs) + + def forward( + __self, __cmd: "Command", *args: t.Any, **kwargs: t.Any # noqa: B902 + ) -> t.Any: + """Similar to :meth:`invoke` but fills in default keyword + arguments from the current context if the other command expects + it. This cannot invoke callbacks directly, only other commands. + + .. versionchanged:: 8.0 + All ``kwargs`` are tracked in :attr:`params` so they will be + passed if ``forward`` is called at multiple levels. + """ + # Can only forward to other commands, not direct callbacks. + if not isinstance(__cmd, Command): + raise TypeError("Callback is not a command.") + + for param in __self.params: + if param not in kwargs: + kwargs[param] = __self.params[param] + + return __self.invoke(__cmd, *args, **kwargs) + + def set_parameter_source(self, name: str, source: ParameterSource) -> None: + """Set the source of a parameter. This indicates the location + from which the value of the parameter was obtained. + + :param name: The name of the parameter. + :param source: A member of :class:`~click.core.ParameterSource`. + """ + self._parameter_source[name] = source + + def get_parameter_source(self, name: str) -> t.Optional[ParameterSource]: + """Get the source of a parameter. This indicates the location + from which the value of the parameter was obtained. + + This can be useful for determining when a user specified a value + on the command line that is the same as the default value. It + will be :attr:`~click.core.ParameterSource.DEFAULT` only if the + value was actually taken from the default. + + :param name: The name of the parameter. + :rtype: ParameterSource + + .. versionchanged:: 8.0 + Returns ``None`` if the parameter was not provided from any + source. + """ + return self._parameter_source.get(name) + + +class BaseCommand: + """The base command implements the minimal API contract of commands. + Most code will never use this as it does not implement a lot of useful + functionality but it can act as the direct subclass of alternative + parsing methods that do not depend on the Click parser. + + For instance, this can be used to bridge Click and other systems like + argparse or docopt. + + Because base commands do not implement a lot of the API that other + parts of Click take for granted, they are not supported for all + operations. For instance, they cannot be used with the decorators + usually and they have no built-in callback system. + + .. versionchanged:: 2.0 + Added the `context_settings` parameter. + + :param name: the name of the command to use unless a group overrides it. + :param context_settings: an optional dictionary with defaults that are + passed to the context object. + """ + + #: The context class to create with :meth:`make_context`. + #: + #: .. versionadded:: 8.0 + context_class: t.Type[Context] = Context + #: the default for the :attr:`Context.allow_extra_args` flag. + allow_extra_args = False + #: the default for the :attr:`Context.allow_interspersed_args` flag. + allow_interspersed_args = True + #: the default for the :attr:`Context.ignore_unknown_options` flag. + ignore_unknown_options = False + + def __init__( + self, + name: t.Optional[str], + context_settings: t.Optional[t.MutableMapping[str, t.Any]] = None, + ) -> None: + #: the name the command thinks it has. Upon registering a command + #: on a :class:`Group` the group will default the command name + #: with this information. You should instead use the + #: :class:`Context`\'s :attr:`~Context.info_name` attribute. + self.name = name + + if context_settings is None: + context_settings = {} + + #: an optional dictionary with defaults passed to the context. + self.context_settings: t.MutableMapping[str, t.Any] = context_settings + + def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. This traverses the entire structure + below this command. + + Use :meth:`click.Context.to_info_dict` to traverse the entire + CLI structure. + + :param ctx: A :class:`Context` representing this command. + + .. versionadded:: 8.0 + """ + return {"name": self.name} + + def __repr__(self) -> str: + return f"<{self.__class__.__name__} {self.name}>" + + def get_usage(self, ctx: Context) -> str: + raise NotImplementedError("Base commands cannot get usage") + + def get_help(self, ctx: Context) -> str: + raise NotImplementedError("Base commands cannot get help") + + def make_context( + self, + info_name: t.Optional[str], + args: t.List[str], + parent: t.Optional[Context] = None, + **extra: t.Any, + ) -> Context: + """This function when given an info name and arguments will kick + off the parsing and create a new :class:`Context`. It does not + invoke the actual command callback though. + + To quickly customize the context class used without overriding + this method, set the :attr:`context_class` attribute. + + :param info_name: the info name for this invocation. Generally this + is the most descriptive name for the script or + command. For the toplevel script it's usually + the name of the script, for commands below it's + the name of the command. + :param args: the arguments to parse as list of strings. + :param parent: the parent context if available. + :param extra: extra keyword arguments forwarded to the context + constructor. + + .. versionchanged:: 8.0 + Added the :attr:`context_class` attribute. + """ + for key, value in self.context_settings.items(): + if key not in extra: + extra[key] = value + + ctx = self.context_class( + self, info_name=info_name, parent=parent, **extra # type: ignore + ) + + with ctx.scope(cleanup=False): + self.parse_args(ctx, args) + return ctx + + def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: + """Given a context and a list of arguments this creates the parser + and parses the arguments, then modifies the context as necessary. + This is automatically invoked by :meth:`make_context`. + """ + raise NotImplementedError("Base commands do not know how to parse arguments.") + + def invoke(self, ctx: Context) -> t.Any: + """Given a context, this invokes the command. The default + implementation is raising a not implemented error. + """ + raise NotImplementedError("Base commands are not invocable by default") + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. Looks + at the names of chained multi-commands. + + Any command could be part of a chained multi-command, so sibling + commands are valid at any point during command completion. Other + command classes will return more completions. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + results: t.List["CompletionItem"] = [] + + while ctx.parent is not None: + ctx = ctx.parent + + if isinstance(ctx.command, MultiCommand) and ctx.command.chain: + results.extend( + CompletionItem(name, help=command.get_short_help_str()) + for name, command in _complete_visible_commands(ctx, incomplete) + if name not in ctx.protected_args + ) + + return results + + @t.overload + def main( + self, + args: t.Optional[t.Sequence[str]] = None, + prog_name: t.Optional[str] = None, + complete_var: t.Optional[str] = None, + standalone_mode: "te.Literal[True]" = True, + **extra: t.Any, + ) -> "te.NoReturn": + ... + + @t.overload + def main( + self, + args: t.Optional[t.Sequence[str]] = None, + prog_name: t.Optional[str] = None, + complete_var: t.Optional[str] = None, + standalone_mode: bool = ..., + **extra: t.Any, + ) -> t.Any: + ... + + def main( + self, + args: t.Optional[t.Sequence[str]] = None, + prog_name: t.Optional[str] = None, + complete_var: t.Optional[str] = None, + standalone_mode: bool = True, + windows_expand_args: bool = True, + **extra: t.Any, + ) -> t.Any: + """This is the way to invoke a script with all the bells and + whistles as a command line application. This will always terminate + the application after a call. If this is not wanted, ``SystemExit`` + needs to be caught. + + This method is also available by directly calling the instance of + a :class:`Command`. + + :param args: the arguments that should be used for parsing. If not + provided, ``sys.argv[1:]`` is used. + :param prog_name: the program name that should be used. By default + the program name is constructed by taking the file + name from ``sys.argv[0]``. + :param complete_var: the environment variable that controls the + bash completion support. The default is + ``"__COMPLETE"`` with prog_name in + uppercase. + :param standalone_mode: the default behavior is to invoke the script + in standalone mode. Click will then + handle exceptions and convert them into + error messages and the function will never + return but shut down the interpreter. If + this is set to `False` they will be + propagated to the caller and the return + value of this function is the return value + of :meth:`invoke`. + :param windows_expand_args: Expand glob patterns, user dir, and + env vars in command line args on Windows. + :param extra: extra keyword arguments are forwarded to the context + constructor. See :class:`Context` for more information. + + .. versionchanged:: 8.0.1 + Added the ``windows_expand_args`` parameter to allow + disabling command line arg expansion on Windows. + + .. versionchanged:: 8.0 + When taking arguments from ``sys.argv`` on Windows, glob + patterns, user dir, and env vars are expanded. + + .. versionchanged:: 3.0 + Added the ``standalone_mode`` parameter. + """ + if args is None: + args = sys.argv[1:] + + if os.name == "nt" and windows_expand_args: + args = _expand_args(args) + else: + args = list(args) + + if prog_name is None: + prog_name = _detect_program_name() + + # Process shell completion requests and exit early. + self._main_shell_completion(extra, prog_name, complete_var) + + try: + try: + with self.make_context(prog_name, args, **extra) as ctx: + rv = self.invoke(ctx) + if not standalone_mode: + return rv + # it's not safe to `ctx.exit(rv)` here! + # note that `rv` may actually contain data like "1" which + # has obvious effects + # more subtle case: `rv=[None, None]` can come out of + # chained commands which all returned `None` -- so it's not + # even always obvious that `rv` indicates success/failure + # by its truthiness/falsiness + ctx.exit() + except (EOFError, KeyboardInterrupt) as e: + echo(file=sys.stderr) + raise Abort() from e + except ClickException as e: + if not standalone_mode: + raise + e.show() + sys.exit(e.exit_code) + except OSError as e: + if e.errno == errno.EPIPE: + sys.stdout = t.cast(t.TextIO, PacifyFlushWrapper(sys.stdout)) + sys.stderr = t.cast(t.TextIO, PacifyFlushWrapper(sys.stderr)) + sys.exit(1) + else: + raise + except Exit as e: + if standalone_mode: + sys.exit(e.exit_code) + else: + # in non-standalone mode, return the exit code + # note that this is only reached if `self.invoke` above raises + # an Exit explicitly -- thus bypassing the check there which + # would return its result + # the results of non-standalone execution may therefore be + # somewhat ambiguous: if there are codepaths which lead to + # `ctx.exit(1)` and to `return 1`, the caller won't be able to + # tell the difference between the two + return e.exit_code + except Abort: + if not standalone_mode: + raise + echo(_("Aborted!"), file=sys.stderr) + sys.exit(1) + + def _main_shell_completion( + self, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + complete_var: t.Optional[str] = None, + ) -> None: + """Check if the shell is asking for tab completion, process + that, then exit early. Called from :meth:`main` before the + program is invoked. + + :param prog_name: Name of the executable in the shell. + :param complete_var: Name of the environment variable that holds + the completion instruction. Defaults to + ``_{PROG_NAME}_COMPLETE``. + + .. versionchanged:: 8.2.0 + Dots (``.``) in ``prog_name`` are replaced with underscores (``_``). + """ + if complete_var is None: + complete_name = prog_name.replace("-", "_").replace(".", "_") + complete_var = f"_{complete_name}_COMPLETE".upper() + + instruction = os.environ.get(complete_var) + + if not instruction: + return + + from .shell_completion import shell_complete + + rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction) + sys.exit(rv) + + def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any: + """Alias for :meth:`main`.""" + return self.main(*args, **kwargs) + + +class Command(BaseCommand): + """Commands are the basic building block of command line interfaces in + Click. A basic command handles command line parsing and might dispatch + more parsing to commands nested below it. + + :param name: the name of the command to use unless a group overrides it. + :param context_settings: an optional dictionary with defaults that are + passed to the context object. + :param callback: the callback to invoke. This is optional. + :param params: the parameters to register with this command. This can + be either :class:`Option` or :class:`Argument` objects. + :param help: the help string to use for this command. + :param epilog: like the help string but it's printed at the end of the + help page after everything else. + :param short_help: the short help to use for this command. This is + shown on the command listing of the parent command. + :param add_help_option: by default each command registers a ``--help`` + option. This can be disabled by this parameter. + :param no_args_is_help: this controls what happens if no arguments are + provided. This option is disabled by default. + If enabled this will add ``--help`` as argument + if no arguments are passed + :param hidden: hide this command from help outputs. + + :param deprecated: issues a message indicating that + the command is deprecated. + + .. versionchanged:: 8.1 + ``help``, ``epilog``, and ``short_help`` are stored unprocessed, + all formatting is done when outputting help text, not at init, + and is done even if not using the ``@command`` decorator. + + .. versionchanged:: 8.0 + Added a ``repr`` showing the command name. + + .. versionchanged:: 7.1 + Added the ``no_args_is_help`` parameter. + + .. versionchanged:: 2.0 + Added the ``context_settings`` parameter. + """ + + def __init__( + self, + name: t.Optional[str], + context_settings: t.Optional[t.MutableMapping[str, t.Any]] = None, + callback: t.Optional[t.Callable[..., t.Any]] = None, + params: t.Optional[t.List["Parameter"]] = None, + help: t.Optional[str] = None, + epilog: t.Optional[str] = None, + short_help: t.Optional[str] = None, + options_metavar: t.Optional[str] = "[OPTIONS]", + add_help_option: bool = True, + no_args_is_help: bool = False, + hidden: bool = False, + deprecated: bool = False, + ) -> None: + super().__init__(name, context_settings) + #: the callback to execute when the command fires. This might be + #: `None` in which case nothing happens. + self.callback = callback + #: the list of parameters for this command in the order they + #: should show up in the help page and execute. Eager parameters + #: will automatically be handled before non eager ones. + self.params: t.List["Parameter"] = params or [] + self.help = help + self.epilog = epilog + self.options_metavar = options_metavar + self.short_help = short_help + self.add_help_option = add_help_option + self.no_args_is_help = no_args_is_help + self.hidden = hidden + self.deprecated = deprecated + + def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict(ctx) + info_dict.update( + params=[param.to_info_dict() for param in self.get_params(ctx)], + help=self.help, + epilog=self.epilog, + short_help=self.short_help, + hidden=self.hidden, + deprecated=self.deprecated, + ) + return info_dict + + def get_usage(self, ctx: Context) -> str: + """Formats the usage line into a string and returns it. + + Calls :meth:`format_usage` internally. + """ + formatter = ctx.make_formatter() + self.format_usage(ctx, formatter) + return formatter.getvalue().rstrip("\n") + + def get_params(self, ctx: Context) -> t.List["Parameter"]: + rv = self.params + help_option = self.get_help_option(ctx) + + if help_option is not None: + rv = [*rv, help_option] + + return rv + + def format_usage(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the usage line into the formatter. + + This is a low-level method called by :meth:`get_usage`. + """ + pieces = self.collect_usage_pieces(ctx) + formatter.write_usage(ctx.command_path, " ".join(pieces)) + + def collect_usage_pieces(self, ctx: Context) -> t.List[str]: + """Returns all the pieces that go into the usage line and returns + it as a list of strings. + """ + rv = [self.options_metavar] if self.options_metavar else [] + + for param in self.get_params(ctx): + rv.extend(param.get_usage_pieces(ctx)) + + return rv + + def get_help_option_names(self, ctx: Context) -> t.List[str]: + """Returns the names for the help option.""" + all_names = set(ctx.help_option_names) + for param in self.params: + all_names.difference_update(param.opts) + all_names.difference_update(param.secondary_opts) + return list(all_names) + + def get_help_option(self, ctx: Context) -> t.Optional["Option"]: + """Returns the help option object.""" + help_options = self.get_help_option_names(ctx) + + if not help_options or not self.add_help_option: + return None + + def show_help(ctx: Context, param: "Parameter", value: str) -> None: + if value and not ctx.resilient_parsing: + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + return Option( + help_options, + is_flag=True, + is_eager=True, + expose_value=False, + callback=show_help, + help=_("Show this message and exit."), + ) + + def make_parser(self, ctx: Context) -> OptionParser: + """Creates the underlying option parser for this command.""" + parser = OptionParser(ctx) + for param in self.get_params(ctx): + param.add_to_parser(parser, ctx) + return parser + + def get_help(self, ctx: Context) -> str: + """Formats the help into a string and returns it. + + Calls :meth:`format_help` internally. + """ + formatter = ctx.make_formatter() + self.format_help(ctx, formatter) + return formatter.getvalue().rstrip("\n") + + def get_short_help_str(self, limit: int = 45) -> str: + """Gets short help for the command or makes it by shortening the + long help string. + """ + if self.short_help: + text = inspect.cleandoc(self.short_help) + elif self.help: + text = make_default_short_help(self.help, limit) + else: + text = "" + + if self.deprecated: + text = _("(Deprecated) {text}").format(text=text) + + return text.strip() + + def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the help into the formatter if it exists. + + This is a low-level method called by :meth:`get_help`. + + This calls the following methods: + + - :meth:`format_usage` + - :meth:`format_help_text` + - :meth:`format_options` + - :meth:`format_epilog` + """ + self.format_usage(ctx, formatter) + self.format_help_text(ctx, formatter) + self.format_options(ctx, formatter) + self.format_epilog(ctx, formatter) + + def format_help_text(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the help text to the formatter if it exists.""" + if self.help is not None: + # truncate the help text to the first form feed + text = inspect.cleandoc(self.help).partition("\f")[0] + else: + text = "" + + if self.deprecated: + text = _("(Deprecated) {text}").format(text=text) + + if text: + formatter.write_paragraph() + + with formatter.indentation(): + formatter.write_text(text) + + def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes all the options into the formatter if they exist.""" + opts = [] + for param in self.get_params(ctx): + rv = param.get_help_record(ctx) + if rv is not None: + opts.append(rv) + + if opts: + with formatter.section(_("Options")): + formatter.write_dl(opts) + + def format_epilog(self, ctx: Context, formatter: HelpFormatter) -> None: + """Writes the epilog into the formatter if it exists.""" + if self.epilog: + epilog = inspect.cleandoc(self.epilog) + formatter.write_paragraph() + + with formatter.indentation(): + formatter.write_text(epilog) + + def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: + if not args and self.no_args_is_help and not ctx.resilient_parsing: + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + parser = self.make_parser(ctx) + opts, args, param_order = parser.parse_args(args=args) + + for param in iter_params_for_processing(param_order, self.get_params(ctx)): + value, args = param.handle_parse_result(ctx, opts, args) + + if args and not ctx.allow_extra_args and not ctx.resilient_parsing: + ctx.fail( + ngettext( + "Got unexpected extra argument ({args})", + "Got unexpected extra arguments ({args})", + len(args), + ).format(args=" ".join(map(str, args))) + ) + + ctx.args = args + ctx._opt_prefixes.update(parser._opt_prefixes) + return args + + def invoke(self, ctx: Context) -> t.Any: + """Given a context, this invokes the attached callback (if it exists) + in the right way. + """ + if self.deprecated: + message = _( + "DeprecationWarning: The command {name!r} is deprecated." + ).format(name=self.name) + echo(style(message, fg="red"), err=True) + + if self.callback is not None: + return ctx.invoke(self.callback, **ctx.params) + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. Looks + at the names of options and chained multi-commands. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + results: t.List["CompletionItem"] = [] + + if incomplete and not incomplete[0].isalnum(): + for param in self.get_params(ctx): + if ( + not isinstance(param, Option) + or param.hidden + or ( + not param.multiple + and ctx.get_parameter_source(param.name) # type: ignore + is ParameterSource.COMMANDLINE + ) + ): + continue + + results.extend( + CompletionItem(name, help=param.help) + for name in [*param.opts, *param.secondary_opts] + if name.startswith(incomplete) + ) + + results.extend(super().shell_complete(ctx, incomplete)) + return results + + +class MultiCommand(Command): + """A multi command is the basic implementation of a command that + dispatches to subcommands. The most common version is the + :class:`Group`. + + :param invoke_without_command: this controls how the multi command itself + is invoked. By default it's only invoked + if a subcommand is provided. + :param no_args_is_help: this controls what happens if no arguments are + provided. This option is enabled by default if + `invoke_without_command` is disabled or disabled + if it's enabled. If enabled this will add + ``--help`` as argument if no arguments are + passed. + :param subcommand_metavar: the string that is used in the documentation + to indicate the subcommand place. + :param chain: if this is set to `True` chaining of multiple subcommands + is enabled. This restricts the form of commands in that + they cannot have optional arguments but it allows + multiple commands to be chained together. + :param result_callback: The result callback to attach to this multi + command. This can be set or changed later with the + :meth:`result_callback` decorator. + :param attrs: Other command arguments described in :class:`Command`. + """ + + allow_extra_args = True + allow_interspersed_args = False + + def __init__( + self, + name: t.Optional[str] = None, + invoke_without_command: bool = False, + no_args_is_help: t.Optional[bool] = None, + subcommand_metavar: t.Optional[str] = None, + chain: bool = False, + result_callback: t.Optional[t.Callable[..., t.Any]] = None, + **attrs: t.Any, + ) -> None: + super().__init__(name, **attrs) + + if no_args_is_help is None: + no_args_is_help = not invoke_without_command + + self.no_args_is_help = no_args_is_help + self.invoke_without_command = invoke_without_command + + if subcommand_metavar is None: + if chain: + subcommand_metavar = "COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]..." + else: + subcommand_metavar = "COMMAND [ARGS]..." + + self.subcommand_metavar = subcommand_metavar + self.chain = chain + # The result callback that is stored. This can be set or + # overridden with the :func:`result_callback` decorator. + self._result_callback = result_callback + + if self.chain: + for param in self.params: + if isinstance(param, Argument) and not param.required: + raise RuntimeError( + "Multi commands in chain mode cannot have" + " optional arguments." + ) + + def to_info_dict(self, ctx: Context) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict(ctx) + commands = {} + + for name in self.list_commands(ctx): + command = self.get_command(ctx, name) + + if command is None: + continue + + sub_ctx = ctx._make_sub_context(command) + + with sub_ctx.scope(cleanup=False): + commands[name] = command.to_info_dict(sub_ctx) + + info_dict.update(commands=commands, chain=self.chain) + return info_dict + + def collect_usage_pieces(self, ctx: Context) -> t.List[str]: + rv = super().collect_usage_pieces(ctx) + rv.append(self.subcommand_metavar) + return rv + + def format_options(self, ctx: Context, formatter: HelpFormatter) -> None: + super().format_options(ctx, formatter) + self.format_commands(ctx, formatter) + + def result_callback(self, replace: bool = False) -> t.Callable[[F], F]: + """Adds a result callback to the command. By default if a + result callback is already registered this will chain them but + this can be disabled with the `replace` parameter. The result + callback is invoked with the return value of the subcommand + (or the list of return values from all subcommands if chaining + is enabled) as well as the parameters as they would be passed + to the main callback. + + Example:: + + @click.group() + @click.option('-i', '--input', default=23) + def cli(input): + return 42 + + @cli.result_callback() + def process_result(result, input): + return result + input + + :param replace: if set to `True` an already existing result + callback will be removed. + + .. versionchanged:: 8.0 + Renamed from ``resultcallback``. + + .. versionadded:: 3.0 + """ + + def decorator(f: F) -> F: + old_callback = self._result_callback + + if old_callback is None or replace: + self._result_callback = f + return f + + def function(__value, *args, **kwargs): # type: ignore + inner = old_callback(__value, *args, **kwargs) + return f(inner, *args, **kwargs) + + self._result_callback = rv = update_wrapper(t.cast(F, function), f) + return rv + + return decorator + + def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: + """Extra format methods for multi methods that adds all the commands + after the options. + """ + commands = [] + for subcommand in self.list_commands(ctx): + cmd = self.get_command(ctx, subcommand) + # What is this, the tool lied about a command. Ignore it + if cmd is None: + continue + if cmd.hidden: + continue + + commands.append((subcommand, cmd)) + + # allow for 3 times the default spacing + if len(commands): + limit = formatter.width - 6 - max(len(cmd[0]) for cmd in commands) + + rows = [] + for subcommand, cmd in commands: + help = cmd.get_short_help_str(limit) + rows.append((subcommand, help)) + + if rows: + with formatter.section(_("Commands")): + formatter.write_dl(rows) + + def parse_args(self, ctx: Context, args: t.List[str]) -> t.List[str]: + if not args and self.no_args_is_help and not ctx.resilient_parsing: + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + rest = super().parse_args(ctx, args) + + if self.chain: + ctx.protected_args = rest + ctx.args = [] + elif rest: + ctx.protected_args, ctx.args = rest[:1], rest[1:] + + return ctx.args + + def invoke(self, ctx: Context) -> t.Any: + def _process_result(value: t.Any) -> t.Any: + if self._result_callback is not None: + value = ctx.invoke(self._result_callback, value, **ctx.params) + return value + + if not ctx.protected_args: + if self.invoke_without_command: + # No subcommand was invoked, so the result callback is + # invoked with the group return value for regular + # groups, or an empty list for chained groups. + with ctx: + rv = super().invoke(ctx) + return _process_result([] if self.chain else rv) + ctx.fail(_("Missing command.")) + + # Fetch args back out + args = [*ctx.protected_args, *ctx.args] + ctx.args = [] + ctx.protected_args = [] + + # If we're not in chain mode, we only allow the invocation of a + # single command but we also inform the current context about the + # name of the command to invoke. + if not self.chain: + # Make sure the context is entered so we do not clean up + # resources until the result processor has worked. + with ctx: + cmd_name, cmd, args = self.resolve_command(ctx, args) + assert cmd is not None + ctx.invoked_subcommand = cmd_name + super().invoke(ctx) + sub_ctx = cmd.make_context(cmd_name, args, parent=ctx) + with sub_ctx: + return _process_result(sub_ctx.command.invoke(sub_ctx)) + + # In chain mode we create the contexts step by step, but after the + # base command has been invoked. Because at that point we do not + # know the subcommands yet, the invoked subcommand attribute is + # set to ``*`` to inform the command that subcommands are executed + # but nothing else. + with ctx: + ctx.invoked_subcommand = "*" if args else None + super().invoke(ctx) + + # Otherwise we make every single context and invoke them in a + # chain. In that case the return value to the result processor + # is the list of all invoked subcommand's results. + contexts = [] + while args: + cmd_name, cmd, args = self.resolve_command(ctx, args) + assert cmd is not None + sub_ctx = cmd.make_context( + cmd_name, + args, + parent=ctx, + allow_extra_args=True, + allow_interspersed_args=False, + ) + contexts.append(sub_ctx) + args, sub_ctx.args = sub_ctx.args, [] + + rv = [] + for sub_ctx in contexts: + with sub_ctx: + rv.append(sub_ctx.command.invoke(sub_ctx)) + return _process_result(rv) + + def resolve_command( + self, ctx: Context, args: t.List[str] + ) -> t.Tuple[t.Optional[str], t.Optional[Command], t.List[str]]: + cmd_name = make_str(args[0]) + original_cmd_name = cmd_name + + # Get the command + cmd = self.get_command(ctx, cmd_name) + + # If we can't find the command but there is a normalization + # function available, we try with that one. + if cmd is None and ctx.token_normalize_func is not None: + cmd_name = ctx.token_normalize_func(cmd_name) + cmd = self.get_command(ctx, cmd_name) + + # If we don't find the command we want to show an error message + # to the user that it was not provided. However, there is + # something else we should do: if the first argument looks like + # an option we want to kick off parsing again for arguments to + # resolve things like --help which now should go to the main + # place. + if cmd is None and not ctx.resilient_parsing: + if split_opt(cmd_name)[0]: + self.parse_args(ctx, ctx.args) + ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name)) + return cmd_name if cmd else None, cmd, args[1:] + + def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: + """Given a context and a command name, this returns a + :class:`Command` object if it exists or returns `None`. + """ + raise NotImplementedError + + def list_commands(self, ctx: Context) -> t.List[str]: + """Returns a list of subcommand names in the order they should + appear. + """ + return [] + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. Looks + at the names of options, subcommands, and chained + multi-commands. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + results = [ + CompletionItem(name, help=command.get_short_help_str()) + for name, command in _complete_visible_commands(ctx, incomplete) + ] + results.extend(super().shell_complete(ctx, incomplete)) + return results + + +class Group(MultiCommand): + """A group allows a command to have subcommands attached. This is + the most common way to implement nesting in Click. + + :param name: The name of the group command. + :param commands: A dict mapping names to :class:`Command` objects. + Can also be a list of :class:`Command`, which will use + :attr:`Command.name` to create the dict. + :param attrs: Other command arguments described in + :class:`MultiCommand`, :class:`Command`, and + :class:`BaseCommand`. + + .. versionchanged:: 8.0 + The ``commands`` argument can be a list of command objects. + """ + + #: If set, this is used by the group's :meth:`command` decorator + #: as the default :class:`Command` class. This is useful to make all + #: subcommands use a custom command class. + #: + #: .. versionadded:: 8.0 + command_class: t.Optional[t.Type[Command]] = None + + #: If set, this is used by the group's :meth:`group` decorator + #: as the default :class:`Group` class. This is useful to make all + #: subgroups use a custom group class. + #: + #: If set to the special value :class:`type` (literally + #: ``group_class = type``), this group's class will be used as the + #: default class. This makes a custom group class continue to make + #: custom groups. + #: + #: .. versionadded:: 8.0 + group_class: t.Optional[t.Union[t.Type["Group"], t.Type[type]]] = None + # Literal[type] isn't valid, so use Type[type] + + def __init__( + self, + name: t.Optional[str] = None, + commands: t.Optional[ + t.Union[t.MutableMapping[str, Command], t.Sequence[Command]] + ] = None, + **attrs: t.Any, + ) -> None: + super().__init__(name, **attrs) + + if commands is None: + commands = {} + elif isinstance(commands, abc.Sequence): + commands = {c.name: c for c in commands if c.name is not None} + + #: The registered subcommands by their exported names. + self.commands: t.MutableMapping[str, Command] = commands + + def add_command(self, cmd: Command, name: t.Optional[str] = None) -> None: + """Registers another :class:`Command` with this group. If the name + is not provided, the name of the command is used. + """ + name = name or cmd.name + if name is None: + raise TypeError("Command has no name.") + _check_multicommand(self, name, cmd, register=True) + self.commands[name] = cmd + + @t.overload + def command(self, __func: t.Callable[..., t.Any]) -> Command: + ... + + @t.overload + def command( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Callable[[t.Callable[..., t.Any]], Command]: + ... + + def command( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Union[t.Callable[[t.Callable[..., t.Any]], Command], Command]: + """A shortcut decorator for declaring and attaching a command to + the group. This takes the same arguments as :func:`command` and + immediately registers the created command with this group by + calling :meth:`add_command`. + + To customize the command class used, set the + :attr:`command_class` attribute. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + + .. versionchanged:: 8.0 + Added the :attr:`command_class` attribute. + """ + from .decorators import command + + func: t.Optional[t.Callable[..., t.Any]] = None + + if args and callable(args[0]): + assert ( + len(args) == 1 and not kwargs + ), "Use 'command(**kwargs)(callable)' to provide arguments." + (func,) = args + args = () + + if self.command_class and kwargs.get("cls") is None: + kwargs["cls"] = self.command_class + + def decorator(f: t.Callable[..., t.Any]) -> Command: + cmd: Command = command(*args, **kwargs)(f) + self.add_command(cmd) + return cmd + + if func is not None: + return decorator(func) + + return decorator + + @t.overload + def group(self, __func: t.Callable[..., t.Any]) -> "Group": + ... + + @t.overload + def group( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Callable[[t.Callable[..., t.Any]], "Group"]: + ... + + def group( + self, *args: t.Any, **kwargs: t.Any + ) -> t.Union[t.Callable[[t.Callable[..., t.Any]], "Group"], "Group"]: + """A shortcut decorator for declaring and attaching a group to + the group. This takes the same arguments as :func:`group` and + immediately registers the created group with this group by + calling :meth:`add_command`. + + To customize the group class used, set the :attr:`group_class` + attribute. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + + .. versionchanged:: 8.0 + Added the :attr:`group_class` attribute. + """ + from .decorators import group + + func: t.Optional[t.Callable[..., t.Any]] = None + + if args and callable(args[0]): + assert ( + len(args) == 1 and not kwargs + ), "Use 'group(**kwargs)(callable)' to provide arguments." + (func,) = args + args = () + + if self.group_class is not None and kwargs.get("cls") is None: + if self.group_class is type: + kwargs["cls"] = type(self) + else: + kwargs["cls"] = self.group_class + + def decorator(f: t.Callable[..., t.Any]) -> "Group": + cmd: Group = group(*args, **kwargs)(f) + self.add_command(cmd) + return cmd + + if func is not None: + return decorator(func) + + return decorator + + def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: + return self.commands.get(cmd_name) + + def list_commands(self, ctx: Context) -> t.List[str]: + return sorted(self.commands) + + +class CommandCollection(MultiCommand): + """A command collection is a multi command that merges multiple multi + commands together into one. This is a straightforward implementation + that accepts a list of different multi commands as sources and + provides all the commands for each of them. + + See :class:`MultiCommand` and :class:`Command` for the description of + ``name`` and ``attrs``. + """ + + def __init__( + self, + name: t.Optional[str] = None, + sources: t.Optional[t.List[MultiCommand]] = None, + **attrs: t.Any, + ) -> None: + super().__init__(name, **attrs) + #: The list of registered multi commands. + self.sources: t.List[MultiCommand] = sources or [] + + def add_source(self, multi_cmd: MultiCommand) -> None: + """Adds a new multi command to the chain dispatcher.""" + self.sources.append(multi_cmd) + + def get_command(self, ctx: Context, cmd_name: str) -> t.Optional[Command]: + for source in self.sources: + rv = source.get_command(ctx, cmd_name) + + if rv is not None: + if self.chain: + _check_multicommand(self, cmd_name, rv) + + return rv + + return None + + def list_commands(self, ctx: Context) -> t.List[str]: + rv: t.Set[str] = set() + + for source in self.sources: + rv.update(source.list_commands(ctx)) + + return sorted(rv) + + +def _check_iter(value: t.Any) -> t.Iterator[t.Any]: + """Check if the value is iterable but not a string. Raises a type + error, or return an iterator over the value. + """ + if isinstance(value, str): + raise TypeError + + return iter(value) + + +class Parameter: + r"""A parameter to a command comes in two versions: they are either + :class:`Option`\s or :class:`Argument`\s. Other subclasses are currently + not supported by design as some of the internals for parsing are + intentionally not finalized. + + Some settings are supported by both options and arguments. + + :param param_decls: the parameter declarations for this option or + argument. This is a list of flags or argument + names. + :param type: the type that should be used. Either a :class:`ParamType` + or a Python type. The latter is converted into the former + automatically if supported. + :param required: controls if this is optional or not. + :param default: the default value if omitted. This can also be a callable, + in which case it's invoked when the default is needed + without any arguments. + :param callback: A function to further process or validate the value + after type conversion. It is called as ``f(ctx, param, value)`` + and must return the value. It is called for all sources, + including prompts. + :param nargs: the number of arguments to match. If not ``1`` the return + value is a tuple instead of single value. The default for + nargs is ``1`` (except if the type is a tuple, then it's + the arity of the tuple). If ``nargs=-1``, all remaining + parameters are collected. + :param metavar: how the value is represented in the help page. + :param expose_value: if this is `True` then the value is passed onwards + to the command callback and stored on the context, + otherwise it's skipped. + :param is_eager: eager values are processed before non eager ones. This + should not be set for arguments or it will inverse the + order of processing. + :param envvar: a string or list of strings that are environment variables + that should be checked. + :param shell_complete: A function that returns custom shell + completions. Used instead of the param's type completion if + given. Takes ``ctx, param, incomplete`` and must return a list + of :class:`~click.shell_completion.CompletionItem` or a list of + strings. + + .. versionchanged:: 8.0 + ``process_value`` validates required parameters and bounded + ``nargs``, and invokes the parameter callback before returning + the value. This allows the callback to validate prompts. + ``full_process_value`` is removed. + + .. versionchanged:: 8.0 + ``autocompletion`` is renamed to ``shell_complete`` and has new + semantics described above. The old name is deprecated and will + be removed in 8.1, until then it will be wrapped to match the + new requirements. + + .. versionchanged:: 8.0 + For ``multiple=True, nargs>1``, the default must be a list of + tuples. + + .. versionchanged:: 8.0 + Setting a default is no longer required for ``nargs>1``, it will + default to ``None``. ``multiple=True`` or ``nargs=-1`` will + default to ``()``. + + .. versionchanged:: 7.1 + Empty environment variables are ignored rather than taking the + empty string value. This makes it possible for scripts to clear + variables if they can't unset them. + + .. versionchanged:: 2.0 + Changed signature for parameter callback to also be passed the + parameter. The old callback format will still work, but it will + raise a warning to give you a chance to migrate the code easier. + """ + + param_type_name = "parameter" + + def __init__( + self, + param_decls: t.Optional[t.Sequence[str]] = None, + type: t.Optional[t.Union[types.ParamType, t.Any]] = None, + required: bool = False, + default: t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]] = None, + callback: t.Optional[t.Callable[[Context, "Parameter", t.Any], t.Any]] = None, + nargs: t.Optional[int] = None, + multiple: bool = False, + metavar: t.Optional[str] = None, + expose_value: bool = True, + is_eager: bool = False, + envvar: t.Optional[t.Union[str, t.Sequence[str]]] = None, + shell_complete: t.Optional[ + t.Callable[ + [Context, "Parameter", str], + t.Union[t.List["CompletionItem"], t.List[str]], + ] + ] = None, + ) -> None: + self.name: t.Optional[str] + self.opts: t.List[str] + self.secondary_opts: t.List[str] + self.name, self.opts, self.secondary_opts = self._parse_decls( + param_decls or (), expose_value + ) + self.type: types.ParamType = types.convert_type(type, default) + + # Default nargs to what the type tells us if we have that + # information available. + if nargs is None: + if self.type.is_composite: + nargs = self.type.arity + else: + nargs = 1 + + self.required = required + self.callback = callback + self.nargs = nargs + self.multiple = multiple + self.expose_value = expose_value + self.default = default + self.is_eager = is_eager + self.metavar = metavar + self.envvar = envvar + self._custom_shell_complete = shell_complete + + if __debug__: + if self.type.is_composite and nargs != self.type.arity: + raise ValueError( + f"'nargs' must be {self.type.arity} (or None) for" + f" type {self.type!r}, but it was {nargs}." + ) + + # Skip no default or callable default. + check_default = default if not callable(default) else None + + if check_default is not None: + if multiple: + try: + # Only check the first value against nargs. + check_default = next(_check_iter(check_default), None) + except TypeError: + raise ValueError( + "'default' must be a list when 'multiple' is true." + ) from None + + # Can be None for multiple with empty default. + if nargs != 1 and check_default is not None: + try: + _check_iter(check_default) + except TypeError: + if multiple: + message = ( + "'default' must be a list of lists when 'multiple' is" + " true and 'nargs' != 1." + ) + else: + message = "'default' must be a list when 'nargs' != 1." + + raise ValueError(message) from None + + if nargs > 1 and len(check_default) != nargs: + subject = "item length" if multiple else "length" + raise ValueError( + f"'default' {subject} must match nargs={nargs}." + ) + + def to_info_dict(self) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. + + Use :meth:`click.Context.to_info_dict` to traverse the entire + CLI structure. + + .. versionadded:: 8.0 + """ + return { + "name": self.name, + "param_type_name": self.param_type_name, + "opts": self.opts, + "secondary_opts": self.secondary_opts, + "type": self.type.to_info_dict(), + "required": self.required, + "nargs": self.nargs, + "multiple": self.multiple, + "default": self.default, + "envvar": self.envvar, + } + + def __repr__(self) -> str: + return f"<{self.__class__.__name__} {self.name}>" + + def _parse_decls( + self, decls: t.Sequence[str], expose_value: bool + ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: + raise NotImplementedError() + + @property + def human_readable_name(self) -> str: + """Returns the human readable name of this parameter. This is the + same as the name for options, but the metavar for arguments. + """ + return self.name # type: ignore + + def make_metavar(self) -> str: + if self.metavar is not None: + return self.metavar + + metavar = self.type.get_metavar(self) + + if metavar is None: + metavar = self.type.name.upper() + + if self.nargs != 1: + metavar += "..." + + return metavar + + @t.overload + def get_default( + self, ctx: Context, call: "te.Literal[True]" = True + ) -> t.Optional[t.Any]: + ... + + @t.overload + def get_default( + self, ctx: Context, call: bool = ... + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + ... + + def get_default( + self, ctx: Context, call: bool = True + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + """Get the default for the parameter. Tries + :meth:`Context.lookup_default` first, then the local default. + + :param ctx: Current context. + :param call: If the default is a callable, call it. Disable to + return the callable instead. + + .. versionchanged:: 8.0.2 + Type casting is no longer performed when getting a default. + + .. versionchanged:: 8.0.1 + Type casting can fail in resilient parsing mode. Invalid + defaults will not prevent showing help text. + + .. versionchanged:: 8.0 + Looks at ``ctx.default_map`` first. + + .. versionchanged:: 8.0 + Added the ``call`` parameter. + """ + value = ctx.lookup_default(self.name, call=False) # type: ignore + + if value is None: + value = self.default + + if call and callable(value): + value = value() + + return value + + def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: + raise NotImplementedError() + + def consume_value( + self, ctx: Context, opts: t.Mapping[str, t.Any] + ) -> t.Tuple[t.Any, ParameterSource]: + value = opts.get(self.name) # type: ignore + source = ParameterSource.COMMANDLINE + + if value is None: + value = self.value_from_envvar(ctx) + source = ParameterSource.ENVIRONMENT + + if value is None: + value = ctx.lookup_default(self.name) # type: ignore + source = ParameterSource.DEFAULT_MAP + + if value is None: + value = self.get_default(ctx) + source = ParameterSource.DEFAULT + + return value, source + + def type_cast_value(self, ctx: Context, value: t.Any) -> t.Any: + """Convert and validate a value against the option's + :attr:`type`, :attr:`multiple`, and :attr:`nargs`. + """ + if value is None: + return () if self.multiple or self.nargs == -1 else None + + def check_iter(value: t.Any) -> t.Iterator[t.Any]: + try: + return _check_iter(value) + except TypeError: + # This should only happen when passing in args manually, + # the parser should construct an iterable when parsing + # the command line. + raise BadParameter( + _("Value must be an iterable."), ctx=ctx, param=self + ) from None + + if self.nargs == 1 or self.type.is_composite: + + def convert(value: t.Any) -> t.Any: + return self.type(value, param=self, ctx=ctx) + + elif self.nargs == -1: + + def convert(value: t.Any) -> t.Any: # t.Tuple[t.Any, ...] + return tuple(self.type(x, self, ctx) for x in check_iter(value)) + + else: # nargs > 1 + + def convert(value: t.Any) -> t.Any: # t.Tuple[t.Any, ...] + value = tuple(check_iter(value)) + + if len(value) != self.nargs: + raise BadParameter( + ngettext( + "Takes {nargs} values but 1 was given.", + "Takes {nargs} values but {len} were given.", + len(value), + ).format(nargs=self.nargs, len=len(value)), + ctx=ctx, + param=self, + ) + + return tuple(self.type(x, self, ctx) for x in value) + + if self.multiple: + return tuple(convert(x) for x in check_iter(value)) + + return convert(value) + + def value_is_missing(self, value: t.Any) -> bool: + if value is None: + return True + + if (self.nargs != 1 or self.multiple) and value == (): + return True + + return False + + def process_value(self, ctx: Context, value: t.Any) -> t.Any: + value = self.type_cast_value(ctx, value) + + if self.required and self.value_is_missing(value): + raise MissingParameter(ctx=ctx, param=self) + + if self.callback is not None: + value = self.callback(ctx, self, value) + + return value + + def resolve_envvar_value(self, ctx: Context) -> t.Optional[str]: + if self.envvar is None: + return None + + if isinstance(self.envvar, str): + rv = os.environ.get(self.envvar) + + if rv: + return rv + else: + for envvar in self.envvar: + rv = os.environ.get(envvar) + + if rv: + return rv + + return None + + def value_from_envvar(self, ctx: Context) -> t.Optional[t.Any]: + rv: t.Optional[t.Any] = self.resolve_envvar_value(ctx) + + if rv is not None and self.nargs != 1: + rv = self.type.split_envvar_value(rv) + + return rv + + def handle_parse_result( + self, ctx: Context, opts: t.Mapping[str, t.Any], args: t.List[str] + ) -> t.Tuple[t.Any, t.List[str]]: + with augment_usage_errors(ctx, param=self): + value, source = self.consume_value(ctx, opts) + ctx.set_parameter_source(self.name, source) # type: ignore + + try: + value = self.process_value(ctx, value) + except Exception: + if not ctx.resilient_parsing: + raise + + value = None + + if self.expose_value: + ctx.params[self.name] = value # type: ignore + + return value, args + + def get_help_record(self, ctx: Context) -> t.Optional[t.Tuple[str, str]]: + pass + + def get_usage_pieces(self, ctx: Context) -> t.List[str]: + return [] + + def get_error_hint(self, ctx: Context) -> str: + """Get a stringified version of the param for use in error messages to + indicate which param caused the error. + """ + hint_list = self.opts or [self.human_readable_name] + return " / ".join(f"'{x}'" for x in hint_list) + + def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: + """Return a list of completions for the incomplete value. If a + ``shell_complete`` function was given during init, it is used. + Otherwise, the :attr:`type` + :meth:`~click.types.ParamType.shell_complete` function is used. + + :param ctx: Invocation context for this command. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + if self._custom_shell_complete is not None: + results = self._custom_shell_complete(ctx, self, incomplete) + + if results and isinstance(results[0], str): + from click.shell_completion import CompletionItem + + results = [CompletionItem(c) for c in results] + + return t.cast(t.List["CompletionItem"], results) + + return self.type.shell_complete(ctx, self, incomplete) + + +class Option(Parameter): + """Options are usually optional values on the command line and + have some extra features that arguments don't have. + + All other parameters are passed onwards to the parameter constructor. + + :param show_default: Show the default value for this option in its + help text. Values are not shown by default, unless + :attr:`Context.show_default` is ``True``. If this value is a + string, it shows that string in parentheses instead of the + actual value. This is particularly useful for dynamic options. + For single option boolean flags, the default remains hidden if + its value is ``False``. + :param show_envvar: Controls if an environment variable should be + shown on the help page. Normally, environment variables are not + shown. + :param prompt: If set to ``True`` or a non empty string then the + user will be prompted for input. If set to ``True`` the prompt + will be the option name capitalized. + :param confirmation_prompt: Prompt a second time to confirm the + value if it was prompted for. Can be set to a string instead of + ``True`` to customize the message. + :param prompt_required: If set to ``False``, the user will be + prompted for input only when the option was specified as a flag + without a value. + :param hide_input: If this is ``True`` then the input on the prompt + will be hidden from the user. This is useful for password input. + :param is_flag: forces this option to act as a flag. The default is + auto detection. + :param flag_value: which value should be used for this flag if it's + enabled. This is set to a boolean automatically if + the option string contains a slash to mark two options. + :param multiple: if this is set to `True` then the argument is accepted + multiple times and recorded. This is similar to ``nargs`` + in how it works but supports arbitrary number of + arguments. + :param count: this flag makes an option increment an integer. + :param allow_from_autoenv: if this is enabled then the value of this + parameter will be pulled from an environment + variable in case a prefix is defined on the + context. + :param help: the help string. + :param hidden: hide this option from help outputs. + :param attrs: Other command arguments described in :class:`Parameter`. + + .. versionchanged:: 8.1.0 + Help text indentation is cleaned here instead of only in the + ``@option`` decorator. + + .. versionchanged:: 8.1.0 + The ``show_default`` parameter overrides + ``Context.show_default``. + + .. versionchanged:: 8.1.0 + The default of a single option boolean flag is not shown if the + default value is ``False``. + + .. versionchanged:: 8.0.1 + ``type`` is detected from ``flag_value`` if given. + """ + + param_type_name = "option" + + def __init__( + self, + param_decls: t.Optional[t.Sequence[str]] = None, + show_default: t.Union[bool, str, None] = None, + prompt: t.Union[bool, str] = False, + confirmation_prompt: t.Union[bool, str] = False, + prompt_required: bool = True, + hide_input: bool = False, + is_flag: t.Optional[bool] = None, + flag_value: t.Optional[t.Any] = None, + multiple: bool = False, + count: bool = False, + allow_from_autoenv: bool = True, + type: t.Optional[t.Union[types.ParamType, t.Any]] = None, + help: t.Optional[str] = None, + hidden: bool = False, + show_choices: bool = True, + show_envvar: bool = False, + **attrs: t.Any, + ) -> None: + if help: + help = inspect.cleandoc(help) + + default_is_missing = "default" not in attrs + super().__init__(param_decls, type=type, multiple=multiple, **attrs) + + if prompt is True: + if self.name is None: + raise TypeError("'name' is required with 'prompt=True'.") + + prompt_text: t.Optional[str] = self.name.replace("_", " ").capitalize() + elif prompt is False: + prompt_text = None + else: + prompt_text = prompt + + self.prompt = prompt_text + self.confirmation_prompt = confirmation_prompt + self.prompt_required = prompt_required + self.hide_input = hide_input + self.hidden = hidden + + # If prompt is enabled but not required, then the option can be + # used as a flag to indicate using prompt or flag_value. + self._flag_needs_value = self.prompt is not None and not self.prompt_required + + if is_flag is None: + if flag_value is not None: + # Implicitly a flag because flag_value was set. + is_flag = True + elif self._flag_needs_value: + # Not a flag, but when used as a flag it shows a prompt. + is_flag = False + else: + # Implicitly a flag because flag options were given. + is_flag = bool(self.secondary_opts) + elif is_flag is False and not self._flag_needs_value: + # Not a flag, and prompt is not enabled, can be used as a + # flag if flag_value is set. + self._flag_needs_value = flag_value is not None + + self.default: t.Union[t.Any, t.Callable[[], t.Any]] + + if is_flag and default_is_missing and not self.required: + if multiple: + self.default = () + else: + self.default = False + + if flag_value is None: + flag_value = not self.default + + self.type: types.ParamType + if is_flag and type is None: + # Re-guess the type from the flag value instead of the + # default. + self.type = types.convert_type(None, flag_value) + + self.is_flag: bool = is_flag + self.is_bool_flag: bool = is_flag and isinstance(self.type, types.BoolParamType) + self.flag_value: t.Any = flag_value + + # Counting + self.count = count + if count: + if type is None: + self.type = types.IntRange(min=0) + if default_is_missing: + self.default = 0 + + self.allow_from_autoenv = allow_from_autoenv + self.help = help + self.show_default = show_default + self.show_choices = show_choices + self.show_envvar = show_envvar + + if __debug__: + if self.nargs == -1: + raise TypeError("nargs=-1 is not supported for options.") + + if self.prompt and self.is_flag and not self.is_bool_flag: + raise TypeError("'prompt' is not valid for non-boolean flag.") + + if not self.is_bool_flag and self.secondary_opts: + raise TypeError("Secondary flag is not valid for non-boolean flag.") + + if self.is_bool_flag and self.hide_input and self.prompt is not None: + raise TypeError( + "'prompt' with 'hide_input' is not valid for boolean flag." + ) + + if self.count: + if self.multiple: + raise TypeError("'count' is not valid with 'multiple'.") + + if self.is_flag: + raise TypeError("'count' is not valid with 'is_flag'.") + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update( + help=self.help, + prompt=self.prompt, + is_flag=self.is_flag, + flag_value=self.flag_value, + count=self.count, + hidden=self.hidden, + ) + return info_dict + + def _parse_decls( + self, decls: t.Sequence[str], expose_value: bool + ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: + opts = [] + secondary_opts = [] + name = None + possible_names = [] + + for decl in decls: + if decl.isidentifier(): + if name is not None: + raise TypeError(f"Name '{name}' defined twice") + name = decl + else: + split_char = ";" if decl[:1] == "/" else "/" + if split_char in decl: + first, second = decl.split(split_char, 1) + first = first.rstrip() + if first: + possible_names.append(split_opt(first)) + opts.append(first) + second = second.lstrip() + if second: + secondary_opts.append(second.lstrip()) + if first == second: + raise ValueError( + f"Boolean option {decl!r} cannot use the" + " same flag for true/false." + ) + else: + possible_names.append(split_opt(decl)) + opts.append(decl) + + if name is None and possible_names: + possible_names.sort(key=lambda x: -len(x[0])) # group long options first + name = possible_names[0][1].replace("-", "_").lower() + if not name.isidentifier(): + name = None + + if name is None: + if not expose_value: + return None, opts, secondary_opts + raise TypeError("Could not determine name for option") + + if not opts and not secondary_opts: + raise TypeError( + f"No options defined but a name was passed ({name})." + " Did you mean to declare an argument instead? Did" + f" you mean to pass '--{name}'?" + ) + + return name, opts, secondary_opts + + def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: + if self.multiple: + action = "append" + elif self.count: + action = "count" + else: + action = "store" + + if self.is_flag: + action = f"{action}_const" + + if self.is_bool_flag and self.secondary_opts: + parser.add_option( + obj=self, opts=self.opts, dest=self.name, action=action, const=True + ) + parser.add_option( + obj=self, + opts=self.secondary_opts, + dest=self.name, + action=action, + const=False, + ) + else: + parser.add_option( + obj=self, + opts=self.opts, + dest=self.name, + action=action, + const=self.flag_value, + ) + else: + parser.add_option( + obj=self, + opts=self.opts, + dest=self.name, + action=action, + nargs=self.nargs, + ) + + def get_help_record(self, ctx: Context) -> t.Optional[t.Tuple[str, str]]: + if self.hidden: + return None + + any_prefix_is_slash = False + + def _write_opts(opts: t.Sequence[str]) -> str: + nonlocal any_prefix_is_slash + + rv, any_slashes = join_options(opts) + + if any_slashes: + any_prefix_is_slash = True + + if not self.is_flag and not self.count: + rv += f" {self.make_metavar()}" + + return rv + + rv = [_write_opts(self.opts)] + + if self.secondary_opts: + rv.append(_write_opts(self.secondary_opts)) + + help = self.help or "" + extra = [] + + if self.show_envvar: + envvar = self.envvar + + if envvar is None: + if ( + self.allow_from_autoenv + and ctx.auto_envvar_prefix is not None + and self.name is not None + ): + envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" + + if envvar is not None: + var_str = ( + envvar + if isinstance(envvar, str) + else ", ".join(str(d) for d in envvar) + ) + extra.append(_("env var: {var}").format(var=var_str)) + + # Temporarily enable resilient parsing to avoid type casting + # failing for the default. Might be possible to extend this to + # help formatting in general. + resilient = ctx.resilient_parsing + ctx.resilient_parsing = True + + try: + default_value = self.get_default(ctx, call=False) + finally: + ctx.resilient_parsing = resilient + + show_default = False + show_default_is_str = False + + if self.show_default is not None: + if isinstance(self.show_default, str): + show_default_is_str = show_default = True + else: + show_default = self.show_default + elif ctx.show_default is not None: + show_default = ctx.show_default + + if show_default_is_str or (show_default and (default_value is not None)): + if show_default_is_str: + default_string = f"({self.show_default})" + elif isinstance(default_value, (list, tuple)): + default_string = ", ".join(str(d) for d in default_value) + elif inspect.isfunction(default_value): + default_string = _("(dynamic)") + elif self.is_bool_flag and self.secondary_opts: + # For boolean flags that have distinct True/False opts, + # use the opt without prefix instead of the value. + default_string = split_opt( + (self.opts if self.default else self.secondary_opts)[0] + )[1] + elif self.is_bool_flag and not self.secondary_opts and not default_value: + default_string = "" + else: + default_string = str(default_value) + + if default_string: + extra.append(_("default: {default}").format(default=default_string)) + + if ( + isinstance(self.type, types._NumberRangeBase) + # skip count with default range type + and not (self.count and self.type.min == 0 and self.type.max is None) + ): + range_str = self.type._describe_range() + + if range_str: + extra.append(range_str) + + if self.required: + extra.append(_("required")) + + if extra: + extra_str = "; ".join(extra) + help = f"{help} [{extra_str}]" if help else f"[{extra_str}]" + + return ("; " if any_prefix_is_slash else " / ").join(rv), help + + @t.overload + def get_default( + self, ctx: Context, call: "te.Literal[True]" = True + ) -> t.Optional[t.Any]: + ... + + @t.overload + def get_default( + self, ctx: Context, call: bool = ... + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + ... + + def get_default( + self, ctx: Context, call: bool = True + ) -> t.Optional[t.Union[t.Any, t.Callable[[], t.Any]]]: + # If we're a non boolean flag our default is more complex because + # we need to look at all flags in the same group to figure out + # if we're the default one in which case we return the flag + # value as default. + if self.is_flag and not self.is_bool_flag: + for param in ctx.command.params: + if param.name == self.name and param.default: + return t.cast(Option, param).flag_value + + return None + + return super().get_default(ctx, call=call) + + def prompt_for_value(self, ctx: Context) -> t.Any: + """This is an alternative flow that can be activated in the full + value processing if a value does not exist. It will prompt the + user until a valid value exists and then returns the processed + value as result. + """ + assert self.prompt is not None + + # Calculate the default before prompting anything to be stable. + default = self.get_default(ctx) + + # If this is a prompt for a flag we need to handle this + # differently. + if self.is_bool_flag: + return confirm(self.prompt, default) + + return prompt( + self.prompt, + default=default, + type=self.type, + hide_input=self.hide_input, + show_choices=self.show_choices, + confirmation_prompt=self.confirmation_prompt, + value_proc=lambda x: self.process_value(ctx, x), + ) + + def resolve_envvar_value(self, ctx: Context) -> t.Optional[str]: + rv = super().resolve_envvar_value(ctx) + + if rv is not None: + return rv + + if ( + self.allow_from_autoenv + and ctx.auto_envvar_prefix is not None + and self.name is not None + ): + envvar = f"{ctx.auto_envvar_prefix}_{self.name.upper()}" + rv = os.environ.get(envvar) + + if rv: + return rv + + return None + + def value_from_envvar(self, ctx: Context) -> t.Optional[t.Any]: + rv: t.Optional[t.Any] = self.resolve_envvar_value(ctx) + + if rv is None: + return None + + value_depth = (self.nargs != 1) + bool(self.multiple) + + if value_depth > 0: + rv = self.type.split_envvar_value(rv) + + if self.multiple and self.nargs != 1: + rv = batch(rv, self.nargs) + + return rv + + def consume_value( + self, ctx: Context, opts: t.Mapping[str, "Parameter"] + ) -> t.Tuple[t.Any, ParameterSource]: + value, source = super().consume_value(ctx, opts) + + # The parser will emit a sentinel value if the option can be + # given as a flag without a value. This is different from None + # to distinguish from the flag not being given at all. + if value is _flag_needs_value: + if self.prompt is not None and not ctx.resilient_parsing: + value = self.prompt_for_value(ctx) + source = ParameterSource.PROMPT + else: + value = self.flag_value + source = ParameterSource.COMMANDLINE + + elif ( + self.multiple + and value is not None + and any(v is _flag_needs_value for v in value) + ): + value = [self.flag_value if v is _flag_needs_value else v for v in value] + source = ParameterSource.COMMANDLINE + + # The value wasn't set, or used the param's default, prompt if + # prompting is enabled. + elif ( + source in {None, ParameterSource.DEFAULT} + and self.prompt is not None + and (self.required or self.prompt_required) + and not ctx.resilient_parsing + ): + value = self.prompt_for_value(ctx) + source = ParameterSource.PROMPT + + return value, source + + +class Argument(Parameter): + """Arguments are positional parameters to a command. They generally + provide fewer features than options but can have infinite ``nargs`` + and are required by default. + + All parameters are passed onwards to the constructor of :class:`Parameter`. + """ + + param_type_name = "argument" + + def __init__( + self, + param_decls: t.Sequence[str], + required: t.Optional[bool] = None, + **attrs: t.Any, + ) -> None: + if required is None: + if attrs.get("default") is not None: + required = False + else: + required = attrs.get("nargs", 1) > 0 + + if "multiple" in attrs: + raise TypeError("__init__() got an unexpected keyword argument 'multiple'.") + + super().__init__(param_decls, required=required, **attrs) + + if __debug__: + if self.default is not None and self.nargs == -1: + raise TypeError("'default' is not supported for nargs=-1.") + + @property + def human_readable_name(self) -> str: + if self.metavar is not None: + return self.metavar + return self.name.upper() # type: ignore + + def make_metavar(self) -> str: + if self.metavar is not None: + return self.metavar + var = self.type.get_metavar(self) + if not var: + var = self.name.upper() # type: ignore + if not self.required: + var = f"[{var}]" + if self.nargs != 1: + var += "..." + return var + + def _parse_decls( + self, decls: t.Sequence[str], expose_value: bool + ) -> t.Tuple[t.Optional[str], t.List[str], t.List[str]]: + if not decls: + if not expose_value: + return None, [], [] + raise TypeError("Could not determine name for argument") + if len(decls) == 1: + name = arg = decls[0] + name = name.replace("-", "_").lower() + else: + raise TypeError( + "Arguments take exactly one parameter declaration, got" + f" {len(decls)}." + ) + return name, [arg], [] + + def get_usage_pieces(self, ctx: Context) -> t.List[str]: + return [self.make_metavar()] + + def get_error_hint(self, ctx: Context) -> str: + return f"'{self.make_metavar()}'" + + def add_to_parser(self, parser: OptionParser, ctx: Context) -> None: + parser.add_argument(dest=self.name, nargs=self.nargs, obj=self) diff --git a/click/python/click/decorators.py b/click/python/click/decorators.py new file mode 100644 index 0000000..d9bba95 --- /dev/null +++ b/click/python/click/decorators.py @@ -0,0 +1,561 @@ +import inspect +import types +import typing as t +from functools import update_wrapper +from gettext import gettext as _ + +from .core import Argument +from .core import Command +from .core import Context +from .core import Group +from .core import Option +from .core import Parameter +from .globals import get_current_context +from .utils import echo + +if t.TYPE_CHECKING: + import typing_extensions as te + + P = te.ParamSpec("P") + +R = t.TypeVar("R") +T = t.TypeVar("T") +_AnyCallable = t.Callable[..., t.Any] +FC = t.TypeVar("FC", bound=t.Union[_AnyCallable, Command]) + + +def pass_context(f: "t.Callable[te.Concatenate[Context, P], R]") -> "t.Callable[P, R]": + """Marks a callback as wanting to receive the current context + object as first argument. + """ + + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R": + return f(get_current_context(), *args, **kwargs) + + return update_wrapper(new_func, f) + + +def pass_obj(f: "t.Callable[te.Concatenate[t.Any, P], R]") -> "t.Callable[P, R]": + """Similar to :func:`pass_context`, but only pass the object on the + context onwards (:attr:`Context.obj`). This is useful if that object + represents the state of a nested system. + """ + + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R": + return f(get_current_context().obj, *args, **kwargs) + + return update_wrapper(new_func, f) + + +def make_pass_decorator( + object_type: t.Type[T], ensure: bool = False +) -> t.Callable[["t.Callable[te.Concatenate[T, P], R]"], "t.Callable[P, R]"]: + """Given an object type this creates a decorator that will work + similar to :func:`pass_obj` but instead of passing the object of the + current context, it will find the innermost context of type + :func:`object_type`. + + This generates a decorator that works roughly like this:: + + from functools import update_wrapper + + def decorator(f): + @pass_context + def new_func(ctx, *args, **kwargs): + obj = ctx.find_object(object_type) + return ctx.invoke(f, obj, *args, **kwargs) + return update_wrapper(new_func, f) + return decorator + + :param object_type: the type of the object to pass. + :param ensure: if set to `True`, a new object will be created and + remembered on the context if it's not there yet. + """ + + def decorator(f: "t.Callable[te.Concatenate[T, P], R]") -> "t.Callable[P, R]": + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R": + ctx = get_current_context() + + obj: t.Optional[T] + if ensure: + obj = ctx.ensure_object(object_type) + else: + obj = ctx.find_object(object_type) + + if obj is None: + raise RuntimeError( + "Managed to invoke callback without a context" + f" object of type {object_type.__name__!r}" + " existing." + ) + + return ctx.invoke(f, obj, *args, **kwargs) + + return update_wrapper(new_func, f) + + return decorator # type: ignore[return-value] + + +def pass_meta_key( + key: str, *, doc_description: t.Optional[str] = None +) -> "t.Callable[[t.Callable[te.Concatenate[t.Any, P], R]], t.Callable[P, R]]": + """Create a decorator that passes a key from + :attr:`click.Context.meta` as the first argument to the decorated + function. + + :param key: Key in ``Context.meta`` to pass. + :param doc_description: Description of the object being passed, + inserted into the decorator's docstring. Defaults to "the 'key' + key from Context.meta". + + .. versionadded:: 8.0 + """ + + def decorator(f: "t.Callable[te.Concatenate[t.Any, P], R]") -> "t.Callable[P, R]": + def new_func(*args: "P.args", **kwargs: "P.kwargs") -> R: + ctx = get_current_context() + obj = ctx.meta[key] + return ctx.invoke(f, obj, *args, **kwargs) + + return update_wrapper(new_func, f) + + if doc_description is None: + doc_description = f"the {key!r} key from :attr:`click.Context.meta`" + + decorator.__doc__ = ( + f"Decorator that passes {doc_description} as the first argument" + " to the decorated function." + ) + return decorator # type: ignore[return-value] + + +CmdType = t.TypeVar("CmdType", bound=Command) + + +# variant: no call, directly as decorator for a function. +@t.overload +def command(name: _AnyCallable) -> Command: + ... + + +# variant: with positional name and with positional or keyword cls argument: +# @command(namearg, CommandCls, ...) or @command(namearg, cls=CommandCls, ...) +@t.overload +def command( + name: t.Optional[str], + cls: t.Type[CmdType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], CmdType]: + ... + + +# variant: name omitted, cls _must_ be a keyword argument, @command(cls=CommandCls, ...) +@t.overload +def command( + name: None = None, + *, + cls: t.Type[CmdType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], CmdType]: + ... + + +# variant: with optional string name, no cls argument provided. +@t.overload +def command( + name: t.Optional[str] = ..., cls: None = None, **attrs: t.Any +) -> t.Callable[[_AnyCallable], Command]: + ... + + +def command( + name: t.Union[t.Optional[str], _AnyCallable] = None, + cls: t.Optional[t.Type[CmdType]] = None, + **attrs: t.Any, +) -> t.Union[Command, t.Callable[[_AnyCallable], t.Union[Command, CmdType]]]: + r"""Creates a new :class:`Command` and uses the decorated function as + callback. This will also automatically attach all decorated + :func:`option`\s and :func:`argument`\s as parameters to the command. + + The name of the command defaults to the name of the function with + underscores replaced by dashes. If you want to change that, you can + pass the intended name as the first argument. + + All keyword arguments are forwarded to the underlying command class. + For the ``params`` argument, any decorated params are appended to + the end of the list. + + Once decorated the function turns into a :class:`Command` instance + that can be invoked as a command line utility or be attached to a + command :class:`Group`. + + :param name: the name of the command. This defaults to the function + name with underscores replaced by dashes. + :param cls: the command class to instantiate. This defaults to + :class:`Command`. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + + .. versionchanged:: 8.1 + The ``params`` argument can be used. Decorated params are + appended to the end of the list. + """ + + func: t.Optional[t.Callable[[_AnyCallable], t.Any]] = None + + if callable(name): + func = name + name = None + assert cls is None, "Use 'command(cls=cls)(callable)' to specify a class." + assert not attrs, "Use 'command(**kwargs)(callable)' to provide arguments." + + if cls is None: + cls = t.cast(t.Type[CmdType], Command) + + def decorator(f: _AnyCallable) -> CmdType: + if isinstance(f, Command): + raise TypeError("Attempted to convert a callback into a command twice.") + + attr_params = attrs.pop("params", None) + params = attr_params if attr_params is not None else [] + + try: + decorator_params = f.__click_params__ # type: ignore + except AttributeError: + pass + else: + del f.__click_params__ # type: ignore + params.extend(reversed(decorator_params)) + + if attrs.get("help") is None: + attrs["help"] = f.__doc__ + + if t.TYPE_CHECKING: + assert cls is not None + assert not callable(name) + + cmd = cls( + name=name or f.__name__.lower().replace("_", "-"), + callback=f, + params=params, + **attrs, + ) + cmd.__doc__ = f.__doc__ + return cmd + + if func is not None: + return decorator(func) + + return decorator + + +GrpType = t.TypeVar("GrpType", bound=Group) + + +# variant: no call, directly as decorator for a function. +@t.overload +def group(name: _AnyCallable) -> Group: + ... + + +# variant: with positional name and with positional or keyword cls argument: +# @group(namearg, GroupCls, ...) or @group(namearg, cls=GroupCls, ...) +@t.overload +def group( + name: t.Optional[str], + cls: t.Type[GrpType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], GrpType]: + ... + + +# variant: name omitted, cls _must_ be a keyword argument, @group(cmd=GroupCls, ...) +@t.overload +def group( + name: None = None, + *, + cls: t.Type[GrpType], + **attrs: t.Any, +) -> t.Callable[[_AnyCallable], GrpType]: + ... + + +# variant: with optional string name, no cls argument provided. +@t.overload +def group( + name: t.Optional[str] = ..., cls: None = None, **attrs: t.Any +) -> t.Callable[[_AnyCallable], Group]: + ... + + +def group( + name: t.Union[str, _AnyCallable, None] = None, + cls: t.Optional[t.Type[GrpType]] = None, + **attrs: t.Any, +) -> t.Union[Group, t.Callable[[_AnyCallable], t.Union[Group, GrpType]]]: + """Creates a new :class:`Group` with a function as callback. This + works otherwise the same as :func:`command` just that the `cls` + parameter is set to :class:`Group`. + + .. versionchanged:: 8.1 + This decorator can be applied without parentheses. + """ + if cls is None: + cls = t.cast(t.Type[GrpType], Group) + + if callable(name): + return command(cls=cls, **attrs)(name) + + return command(name, cls, **attrs) + + +def _param_memo(f: t.Callable[..., t.Any], param: Parameter) -> None: + if isinstance(f, Command): + f.params.append(param) + else: + if not hasattr(f, "__click_params__"): + f.__click_params__ = [] # type: ignore + + f.__click_params__.append(param) # type: ignore + + +def argument( + *param_decls: str, cls: t.Optional[t.Type[Argument]] = None, **attrs: t.Any +) -> t.Callable[[FC], FC]: + """Attaches an argument to the command. All positional arguments are + passed as parameter declarations to :class:`Argument`; all keyword + arguments are forwarded unchanged (except ``cls``). + This is equivalent to creating an :class:`Argument` instance manually + and attaching it to the :attr:`Command.params` list. + + For the default argument class, refer to :class:`Argument` and + :class:`Parameter` for descriptions of parameters. + + :param cls: the argument class to instantiate. This defaults to + :class:`Argument`. + :param param_decls: Passed as positional arguments to the constructor of + ``cls``. + :param attrs: Passed as keyword arguments to the constructor of ``cls``. + """ + if cls is None: + cls = Argument + + def decorator(f: FC) -> FC: + _param_memo(f, cls(param_decls, **attrs)) + return f + + return decorator + + +def option( + *param_decls: str, cls: t.Optional[t.Type[Option]] = None, **attrs: t.Any +) -> t.Callable[[FC], FC]: + """Attaches an option to the command. All positional arguments are + passed as parameter declarations to :class:`Option`; all keyword + arguments are forwarded unchanged (except ``cls``). + This is equivalent to creating an :class:`Option` instance manually + and attaching it to the :attr:`Command.params` list. + + For the default option class, refer to :class:`Option` and + :class:`Parameter` for descriptions of parameters. + + :param cls: the option class to instantiate. This defaults to + :class:`Option`. + :param param_decls: Passed as positional arguments to the constructor of + ``cls``. + :param attrs: Passed as keyword arguments to the constructor of ``cls``. + """ + if cls is None: + cls = Option + + def decorator(f: FC) -> FC: + _param_memo(f, cls(param_decls, **attrs)) + return f + + return decorator + + +def confirmation_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: + """Add a ``--yes`` option which shows a prompt before continuing if + not passed. If the prompt is declined, the program will exit. + + :param param_decls: One or more option names. Defaults to the single + value ``"--yes"``. + :param kwargs: Extra arguments are passed to :func:`option`. + """ + + def callback(ctx: Context, param: Parameter, value: bool) -> None: + if not value: + ctx.abort() + + if not param_decls: + param_decls = ("--yes",) + + kwargs.setdefault("is_flag", True) + kwargs.setdefault("callback", callback) + kwargs.setdefault("expose_value", False) + kwargs.setdefault("prompt", "Do you want to continue?") + kwargs.setdefault("help", "Confirm the action without prompting.") + return option(*param_decls, **kwargs) + + +def password_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: + """Add a ``--password`` option which prompts for a password, hiding + input and asking to enter the value again for confirmation. + + :param param_decls: One or more option names. Defaults to the single + value ``"--password"``. + :param kwargs: Extra arguments are passed to :func:`option`. + """ + if not param_decls: + param_decls = ("--password",) + + kwargs.setdefault("prompt", True) + kwargs.setdefault("confirmation_prompt", True) + kwargs.setdefault("hide_input", True) + return option(*param_decls, **kwargs) + + +def version_option( + version: t.Optional[str] = None, + *param_decls: str, + package_name: t.Optional[str] = None, + prog_name: t.Optional[str] = None, + message: t.Optional[str] = None, + **kwargs: t.Any, +) -> t.Callable[[FC], FC]: + """Add a ``--version`` option which immediately prints the version + number and exits the program. + + If ``version`` is not provided, Click will try to detect it using + :func:`importlib.metadata.version` to get the version for the + ``package_name``. On Python < 3.8, the ``importlib_metadata`` + backport must be installed. + + If ``package_name`` is not provided, Click will try to detect it by + inspecting the stack frames. This will be used to detect the + version, so it must match the name of the installed package. + + :param version: The version number to show. If not provided, Click + will try to detect it. + :param param_decls: One or more option names. Defaults to the single + value ``"--version"``. + :param package_name: The package name to detect the version from. If + not provided, Click will try to detect it. + :param prog_name: The name of the CLI to show in the message. If not + provided, it will be detected from the command. + :param message: The message to show. The values ``%(prog)s``, + ``%(package)s``, and ``%(version)s`` are available. Defaults to + ``"%(prog)s, version %(version)s"``. + :param kwargs: Extra arguments are passed to :func:`option`. + :raise RuntimeError: ``version`` could not be detected. + + .. versionchanged:: 8.0 + Add the ``package_name`` parameter, and the ``%(package)s`` + value for messages. + + .. versionchanged:: 8.0 + Use :mod:`importlib.metadata` instead of ``pkg_resources``. The + version is detected based on the package name, not the entry + point name. The Python package name must match the installed + package name, or be passed with ``package_name=``. + """ + if message is None: + message = _("%(prog)s, version %(version)s") + + if version is None and package_name is None: + frame = inspect.currentframe() + f_back = frame.f_back if frame is not None else None + f_globals = f_back.f_globals if f_back is not None else None + # break reference cycle + # https://docs.python.org/3/library/inspect.html#the-interpreter-stack + del frame + + if f_globals is not None: + package_name = f_globals.get("__name__") + + if package_name == "__main__": + package_name = f_globals.get("__package__") + + if package_name: + package_name = package_name.partition(".")[0] + + def callback(ctx: Context, param: Parameter, value: bool) -> None: + if not value or ctx.resilient_parsing: + return + + nonlocal prog_name + nonlocal version + + if prog_name is None: + prog_name = ctx.find_root().info_name + + if version is None and package_name is not None: + metadata: t.Optional[types.ModuleType] + + try: + from importlib import metadata # type: ignore + except ImportError: + # Python < 3.8 + import importlib_metadata as metadata # type: ignore + + try: + version = metadata.version(package_name) # type: ignore + except metadata.PackageNotFoundError: # type: ignore + raise RuntimeError( + f"{package_name!r} is not installed. Try passing" + " 'package_name' instead." + ) from None + + if version is None: + raise RuntimeError( + f"Could not determine the version for {package_name!r} automatically." + ) + + echo( + message % {"prog": prog_name, "package": package_name, "version": version}, + color=ctx.color, + ) + ctx.exit() + + if not param_decls: + param_decls = ("--version",) + + kwargs.setdefault("is_flag", True) + kwargs.setdefault("expose_value", False) + kwargs.setdefault("is_eager", True) + kwargs.setdefault("help", _("Show the version and exit.")) + kwargs["callback"] = callback + return option(*param_decls, **kwargs) + + +def help_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: + """Add a ``--help`` option which immediately prints the help page + and exits the program. + + This is usually unnecessary, as the ``--help`` option is added to + each command automatically unless ``add_help_option=False`` is + passed. + + :param param_decls: One or more option names. Defaults to the single + value ``"--help"``. + :param kwargs: Extra arguments are passed to :func:`option`. + """ + + def callback(ctx: Context, param: Parameter, value: bool) -> None: + if not value or ctx.resilient_parsing: + return + + echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + if not param_decls: + param_decls = ("--help",) + + kwargs.setdefault("is_flag", True) + kwargs.setdefault("expose_value", False) + kwargs.setdefault("is_eager", True) + kwargs.setdefault("help", _("Show this message and exit.")) + kwargs["callback"] = callback + return option(*param_decls, **kwargs) diff --git a/click/python/click/exceptions.py b/click/python/click/exceptions.py new file mode 100644 index 0000000..fe68a36 --- /dev/null +++ b/click/python/click/exceptions.py @@ -0,0 +1,288 @@ +import typing as t +from gettext import gettext as _ +from gettext import ngettext + +from ._compat import get_text_stderr +from .utils import echo +from .utils import format_filename + +if t.TYPE_CHECKING: + from .core import Command + from .core import Context + from .core import Parameter + + +def _join_param_hints( + param_hint: t.Optional[t.Union[t.Sequence[str], str]] +) -> t.Optional[str]: + if param_hint is not None and not isinstance(param_hint, str): + return " / ".join(repr(x) for x in param_hint) + + return param_hint + + +class ClickException(Exception): + """An exception that Click can handle and show to the user.""" + + #: The exit code for this exception. + exit_code = 1 + + def __init__(self, message: str) -> None: + super().__init__(message) + self.message = message + + def format_message(self) -> str: + return self.message + + def __str__(self) -> str: + return self.message + + def show(self, file: t.Optional[t.IO[t.Any]] = None) -> None: + if file is None: + file = get_text_stderr() + + echo(_("Error: {message}").format(message=self.format_message()), file=file) + + +class UsageError(ClickException): + """An internal exception that signals a usage error. This typically + aborts any further handling. + + :param message: the error message to display. + :param ctx: optionally the context that caused this error. Click will + fill in the context automatically in some situations. + """ + + exit_code = 2 + + def __init__(self, message: str, ctx: t.Optional["Context"] = None) -> None: + super().__init__(message) + self.ctx = ctx + self.cmd: t.Optional["Command"] = self.ctx.command if self.ctx else None + + def show(self, file: t.Optional[t.IO[t.Any]] = None) -> None: + if file is None: + file = get_text_stderr() + color = None + hint = "" + if ( + self.ctx is not None + and self.ctx.command.get_help_option(self.ctx) is not None + ): + hint = _("Try '{command} {option}' for help.").format( + command=self.ctx.command_path, option=self.ctx.help_option_names[0] + ) + hint = f"{hint}\n" + if self.ctx is not None: + color = self.ctx.color + echo(f"{self.ctx.get_usage()}\n{hint}", file=file, color=color) + echo( + _("Error: {message}").format(message=self.format_message()), + file=file, + color=color, + ) + + +class BadParameter(UsageError): + """An exception that formats out a standardized error message for a + bad parameter. This is useful when thrown from a callback or type as + Click will attach contextual information to it (for instance, which + parameter it is). + + .. versionadded:: 2.0 + + :param param: the parameter object that caused this error. This can + be left out, and Click will attach this info itself + if possible. + :param param_hint: a string that shows up as parameter name. This + can be used as alternative to `param` in cases + where custom validation should happen. If it is + a string it's used as such, if it's a list then + each item is quoted and separated. + """ + + def __init__( + self, + message: str, + ctx: t.Optional["Context"] = None, + param: t.Optional["Parameter"] = None, + param_hint: t.Optional[str] = None, + ) -> None: + super().__init__(message, ctx) + self.param = param + self.param_hint = param_hint + + def format_message(self) -> str: + if self.param_hint is not None: + param_hint = self.param_hint + elif self.param is not None: + param_hint = self.param.get_error_hint(self.ctx) # type: ignore + else: + return _("Invalid value: {message}").format(message=self.message) + + return _("Invalid value for {param_hint}: {message}").format( + param_hint=_join_param_hints(param_hint), message=self.message + ) + + +class MissingParameter(BadParameter): + """Raised if click required an option or argument but it was not + provided when invoking the script. + + .. versionadded:: 4.0 + + :param param_type: a string that indicates the type of the parameter. + The default is to inherit the parameter type from + the given `param`. Valid values are ``'parameter'``, + ``'option'`` or ``'argument'``. + """ + + def __init__( + self, + message: t.Optional[str] = None, + ctx: t.Optional["Context"] = None, + param: t.Optional["Parameter"] = None, + param_hint: t.Optional[str] = None, + param_type: t.Optional[str] = None, + ) -> None: + super().__init__(message or "", ctx, param, param_hint) + self.param_type = param_type + + def format_message(self) -> str: + if self.param_hint is not None: + param_hint: t.Optional[str] = self.param_hint + elif self.param is not None: + param_hint = self.param.get_error_hint(self.ctx) # type: ignore + else: + param_hint = None + + param_hint = _join_param_hints(param_hint) + param_hint = f" {param_hint}" if param_hint else "" + + param_type = self.param_type + if param_type is None and self.param is not None: + param_type = self.param.param_type_name + + msg = self.message + if self.param is not None: + msg_extra = self.param.type.get_missing_message(self.param) + if msg_extra: + if msg: + msg += f". {msg_extra}" + else: + msg = msg_extra + + msg = f" {msg}" if msg else "" + + # Translate param_type for known types. + if param_type == "argument": + missing = _("Missing argument") + elif param_type == "option": + missing = _("Missing option") + elif param_type == "parameter": + missing = _("Missing parameter") + else: + missing = _("Missing {param_type}").format(param_type=param_type) + + return f"{missing}{param_hint}.{msg}" + + def __str__(self) -> str: + if not self.message: + param_name = self.param.name if self.param else None + return _("Missing parameter: {param_name}").format(param_name=param_name) + else: + return self.message + + +class NoSuchOption(UsageError): + """Raised if click attempted to handle an option that does not + exist. + + .. versionadded:: 4.0 + """ + + def __init__( + self, + option_name: str, + message: t.Optional[str] = None, + possibilities: t.Optional[t.Sequence[str]] = None, + ctx: t.Optional["Context"] = None, + ) -> None: + if message is None: + message = _("No such option: {name}").format(name=option_name) + + super().__init__(message, ctx) + self.option_name = option_name + self.possibilities = possibilities + + def format_message(self) -> str: + if not self.possibilities: + return self.message + + possibility_str = ", ".join(sorted(self.possibilities)) + suggest = ngettext( + "Did you mean {possibility}?", + "(Possible options: {possibilities})", + len(self.possibilities), + ).format(possibility=possibility_str, possibilities=possibility_str) + return f"{self.message} {suggest}" + + +class BadOptionUsage(UsageError): + """Raised if an option is generally supplied but the use of the option + was incorrect. This is for instance raised if the number of arguments + for an option is not correct. + + .. versionadded:: 4.0 + + :param option_name: the name of the option being used incorrectly. + """ + + def __init__( + self, option_name: str, message: str, ctx: t.Optional["Context"] = None + ) -> None: + super().__init__(message, ctx) + self.option_name = option_name + + +class BadArgumentUsage(UsageError): + """Raised if an argument is generally supplied but the use of the argument + was incorrect. This is for instance raised if the number of values + for an argument is not correct. + + .. versionadded:: 6.0 + """ + + +class FileError(ClickException): + """Raised if a file cannot be opened.""" + + def __init__(self, filename: str, hint: t.Optional[str] = None) -> None: + if hint is None: + hint = _("unknown error") + + super().__init__(hint) + self.ui_filename: str = format_filename(filename) + self.filename = filename + + def format_message(self) -> str: + return _("Could not open file {filename!r}: {message}").format( + filename=self.ui_filename, message=self.message + ) + + +class Abort(RuntimeError): + """An internal signalling exception that signals Click to abort.""" + + +class Exit(RuntimeError): + """An exception that indicates that the application should exit with some + status code. + + :param code: the status code to exit with. + """ + + __slots__ = ("exit_code",) + + def __init__(self, code: int = 0) -> None: + self.exit_code: int = code diff --git a/click/python/click/formatting.py b/click/python/click/formatting.py new file mode 100644 index 0000000..ddd2a2f --- /dev/null +++ b/click/python/click/formatting.py @@ -0,0 +1,301 @@ +import typing as t +from contextlib import contextmanager +from gettext import gettext as _ + +from ._compat import term_len +from .parser import split_opt + +# Can force a width. This is used by the test system +FORCED_WIDTH: t.Optional[int] = None + + +def measure_table(rows: t.Iterable[t.Tuple[str, str]]) -> t.Tuple[int, ...]: + widths: t.Dict[int, int] = {} + + for row in rows: + for idx, col in enumerate(row): + widths[idx] = max(widths.get(idx, 0), term_len(col)) + + return tuple(y for x, y in sorted(widths.items())) + + +def iter_rows( + rows: t.Iterable[t.Tuple[str, str]], col_count: int +) -> t.Iterator[t.Tuple[str, ...]]: + for row in rows: + yield row + ("",) * (col_count - len(row)) + + +def wrap_text( + text: str, + width: int = 78, + initial_indent: str = "", + subsequent_indent: str = "", + preserve_paragraphs: bool = False, +) -> str: + """A helper function that intelligently wraps text. By default, it + assumes that it operates on a single paragraph of text but if the + `preserve_paragraphs` parameter is provided it will intelligently + handle paragraphs (defined by two empty lines). + + If paragraphs are handled, a paragraph can be prefixed with an empty + line containing the ``\\b`` character (``\\x08``) to indicate that + no rewrapping should happen in that block. + + :param text: the text that should be rewrapped. + :param width: the maximum width for the text. + :param initial_indent: the initial indent that should be placed on the + first line as a string. + :param subsequent_indent: the indent string that should be placed on + each consecutive line. + :param preserve_paragraphs: if this flag is set then the wrapping will + intelligently handle paragraphs. + """ + from ._textwrap import TextWrapper + + text = text.expandtabs() + wrapper = TextWrapper( + width, + initial_indent=initial_indent, + subsequent_indent=subsequent_indent, + replace_whitespace=False, + ) + if not preserve_paragraphs: + return wrapper.fill(text) + + p: t.List[t.Tuple[int, bool, str]] = [] + buf: t.List[str] = [] + indent = None + + def _flush_par() -> None: + if not buf: + return + if buf[0].strip() == "\b": + p.append((indent or 0, True, "\n".join(buf[1:]))) + else: + p.append((indent or 0, False, " ".join(buf))) + del buf[:] + + for line in text.splitlines(): + if not line: + _flush_par() + indent = None + else: + if indent is None: + orig_len = term_len(line) + line = line.lstrip() + indent = orig_len - term_len(line) + buf.append(line) + _flush_par() + + rv = [] + for indent, raw, text in p: + with wrapper.extra_indent(" " * indent): + if raw: + rv.append(wrapper.indent_only(text)) + else: + rv.append(wrapper.fill(text)) + + return "\n\n".join(rv) + + +class HelpFormatter: + """This class helps with formatting text-based help pages. It's + usually just needed for very special internal cases, but it's also + exposed so that developers can write their own fancy outputs. + + At present, it always writes into memory. + + :param indent_increment: the additional increment for each level. + :param width: the width for the text. This defaults to the terminal + width clamped to a maximum of 78. + """ + + def __init__( + self, + indent_increment: int = 2, + width: t.Optional[int] = None, + max_width: t.Optional[int] = None, + ) -> None: + import shutil + + self.indent_increment = indent_increment + if max_width is None: + max_width = 80 + if width is None: + width = FORCED_WIDTH + if width is None: + width = max(min(shutil.get_terminal_size().columns, max_width) - 2, 50) + self.width = width + self.current_indent = 0 + self.buffer: t.List[str] = [] + + def write(self, string: str) -> None: + """Writes a unicode string into the internal buffer.""" + self.buffer.append(string) + + def indent(self) -> None: + """Increases the indentation.""" + self.current_indent += self.indent_increment + + def dedent(self) -> None: + """Decreases the indentation.""" + self.current_indent -= self.indent_increment + + def write_usage( + self, prog: str, args: str = "", prefix: t.Optional[str] = None + ) -> None: + """Writes a usage line into the buffer. + + :param prog: the program name. + :param args: whitespace separated list of arguments. + :param prefix: The prefix for the first line. Defaults to + ``"Usage: "``. + """ + if prefix is None: + prefix = f"{_('Usage:')} " + + usage_prefix = f"{prefix:>{self.current_indent}}{prog} " + text_width = self.width - self.current_indent + + if text_width >= (term_len(usage_prefix) + 20): + # The arguments will fit to the right of the prefix. + indent = " " * term_len(usage_prefix) + self.write( + wrap_text( + args, + text_width, + initial_indent=usage_prefix, + subsequent_indent=indent, + ) + ) + else: + # The prefix is too long, put the arguments on the next line. + self.write(usage_prefix) + self.write("\n") + indent = " " * (max(self.current_indent, term_len(prefix)) + 4) + self.write( + wrap_text( + args, text_width, initial_indent=indent, subsequent_indent=indent + ) + ) + + self.write("\n") + + def write_heading(self, heading: str) -> None: + """Writes a heading into the buffer.""" + self.write(f"{'':>{self.current_indent}}{heading}:\n") + + def write_paragraph(self) -> None: + """Writes a paragraph into the buffer.""" + if self.buffer: + self.write("\n") + + def write_text(self, text: str) -> None: + """Writes re-indented text into the buffer. This rewraps and + preserves paragraphs. + """ + indent = " " * self.current_indent + self.write( + wrap_text( + text, + self.width, + initial_indent=indent, + subsequent_indent=indent, + preserve_paragraphs=True, + ) + ) + self.write("\n") + + def write_dl( + self, + rows: t.Sequence[t.Tuple[str, str]], + col_max: int = 30, + col_spacing: int = 2, + ) -> None: + """Writes a definition list into the buffer. This is how options + and commands are usually formatted. + + :param rows: a list of two item tuples for the terms and values. + :param col_max: the maximum width of the first column. + :param col_spacing: the number of spaces between the first and + second column. + """ + rows = list(rows) + widths = measure_table(rows) + if len(widths) != 2: + raise TypeError("Expected two columns for definition list") + + first_col = min(widths[0], col_max) + col_spacing + + for first, second in iter_rows(rows, len(widths)): + self.write(f"{'':>{self.current_indent}}{first}") + if not second: + self.write("\n") + continue + if term_len(first) <= first_col - col_spacing: + self.write(" " * (first_col - term_len(first))) + else: + self.write("\n") + self.write(" " * (first_col + self.current_indent)) + + text_width = max(self.width - first_col - 2, 10) + wrapped_text = wrap_text(second, text_width, preserve_paragraphs=True) + lines = wrapped_text.splitlines() + + if lines: + self.write(f"{lines[0]}\n") + + for line in lines[1:]: + self.write(f"{'':>{first_col + self.current_indent}}{line}\n") + else: + self.write("\n") + + @contextmanager + def section(self, name: str) -> t.Iterator[None]: + """Helpful context manager that writes a paragraph, a heading, + and the indents. + + :param name: the section name that is written as heading. + """ + self.write_paragraph() + self.write_heading(name) + self.indent() + try: + yield + finally: + self.dedent() + + @contextmanager + def indentation(self) -> t.Iterator[None]: + """A context manager that increases the indentation.""" + self.indent() + try: + yield + finally: + self.dedent() + + def getvalue(self) -> str: + """Returns the buffer contents.""" + return "".join(self.buffer) + + +def join_options(options: t.Sequence[str]) -> t.Tuple[str, bool]: + """Given a list of option strings this joins them in the most appropriate + way and returns them in the form ``(formatted_string, + any_prefix_is_slash)`` where the second item in the tuple is a flag that + indicates if any of the option prefixes was a slash. + """ + rv = [] + any_prefix_is_slash = False + + for opt in options: + prefix = split_opt(opt)[0] + + if prefix == "/": + any_prefix_is_slash = True + + rv.append((len(prefix), opt)) + + rv.sort(key=lambda x: x[0]) + return ", ".join(x[1] for x in rv), any_prefix_is_slash diff --git a/click/python/click/globals.py b/click/python/click/globals.py new file mode 100644 index 0000000..480058f --- /dev/null +++ b/click/python/click/globals.py @@ -0,0 +1,68 @@ +import typing as t +from threading import local + +if t.TYPE_CHECKING: + import typing_extensions as te + from .core import Context + +_local = local() + + +@t.overload +def get_current_context(silent: "te.Literal[False]" = False) -> "Context": + ... + + +@t.overload +def get_current_context(silent: bool = ...) -> t.Optional["Context"]: + ... + + +def get_current_context(silent: bool = False) -> t.Optional["Context"]: + """Returns the current click context. This can be used as a way to + access the current context object from anywhere. This is a more implicit + alternative to the :func:`pass_context` decorator. This function is + primarily useful for helpers such as :func:`echo` which might be + interested in changing its behavior based on the current context. + + To push the current context, :meth:`Context.scope` can be used. + + .. versionadded:: 5.0 + + :param silent: if set to `True` the return value is `None` if no context + is available. The default behavior is to raise a + :exc:`RuntimeError`. + """ + try: + return t.cast("Context", _local.stack[-1]) + except (AttributeError, IndexError) as e: + if not silent: + raise RuntimeError("There is no active click context.") from e + + return None + + +def push_context(ctx: "Context") -> None: + """Pushes a new context to the current stack.""" + _local.__dict__.setdefault("stack", []).append(ctx) + + +def pop_context() -> None: + """Removes the top level from the stack.""" + _local.stack.pop() + + +def resolve_color_default(color: t.Optional[bool] = None) -> t.Optional[bool]: + """Internal helper to get the default value of the color flag. If a + value is passed it's returned unchanged, otherwise it's looked up from + the current context. + """ + if color is not None: + return color + + ctx = get_current_context(silent=True) + + if ctx is not None: + return ctx.color + + return None diff --git a/click/python/click/parser.py b/click/python/click/parser.py new file mode 100644 index 0000000..5fa7adf --- /dev/null +++ b/click/python/click/parser.py @@ -0,0 +1,529 @@ +""" +This module started out as largely a copy paste from the stdlib's +optparse module with the features removed that we do not need from +optparse because we implement them in Click on a higher level (for +instance type handling, help formatting and a lot more). + +The plan is to remove more and more from here over time. + +The reason this is a different module and not optparse from the stdlib +is that there are differences in 2.x and 3.x about the error messages +generated and optparse in the stdlib uses gettext for no good reason +and might cause us issues. + +Click uses parts of optparse written by Gregory P. Ward and maintained +by the Python Software Foundation. This is limited to code in parser.py. + +Copyright 2001-2006 Gregory P. Ward. All rights reserved. +Copyright 2002-2006 Python Software Foundation. All rights reserved. +""" +# This code uses parts of optparse written by Gregory P. Ward and +# maintained by the Python Software Foundation. +# Copyright 2001-2006 Gregory P. Ward +# Copyright 2002-2006 Python Software Foundation +import typing as t +from collections import deque +from gettext import gettext as _ +from gettext import ngettext + +from .exceptions import BadArgumentUsage +from .exceptions import BadOptionUsage +from .exceptions import NoSuchOption +from .exceptions import UsageError + +if t.TYPE_CHECKING: + import typing_extensions as te + from .core import Argument as CoreArgument + from .core import Context + from .core import Option as CoreOption + from .core import Parameter as CoreParameter + +V = t.TypeVar("V") + +# Sentinel value that indicates an option was passed as a flag without a +# value but is not a flag option. Option.consume_value uses this to +# prompt or use the flag_value. +_flag_needs_value = object() + + +def _unpack_args( + args: t.Sequence[str], nargs_spec: t.Sequence[int] +) -> t.Tuple[t.Sequence[t.Union[str, t.Sequence[t.Optional[str]], None]], t.List[str]]: + """Given an iterable of arguments and an iterable of nargs specifications, + it returns a tuple with all the unpacked arguments at the first index + and all remaining arguments as the second. + + The nargs specification is the number of arguments that should be consumed + or `-1` to indicate that this position should eat up all the remainders. + + Missing items are filled with `None`. + """ + args = deque(args) + nargs_spec = deque(nargs_spec) + rv: t.List[t.Union[str, t.Tuple[t.Optional[str], ...], None]] = [] + spos: t.Optional[int] = None + + def _fetch(c: "te.Deque[V]") -> t.Optional[V]: + try: + if spos is None: + return c.popleft() + else: + return c.pop() + except IndexError: + return None + + while nargs_spec: + nargs = _fetch(nargs_spec) + + if nargs is None: + continue + + if nargs == 1: + rv.append(_fetch(args)) + elif nargs > 1: + x = [_fetch(args) for _ in range(nargs)] + + # If we're reversed, we're pulling in the arguments in reverse, + # so we need to turn them around. + if spos is not None: + x.reverse() + + rv.append(tuple(x)) + elif nargs < 0: + if spos is not None: + raise TypeError("Cannot have two nargs < 0") + + spos = len(rv) + rv.append(None) + + # spos is the position of the wildcard (star). If it's not `None`, + # we fill it with the remainder. + if spos is not None: + rv[spos] = tuple(args) + args = [] + rv[spos + 1 :] = reversed(rv[spos + 1 :]) + + return tuple(rv), list(args) + + +def split_opt(opt: str) -> t.Tuple[str, str]: + first = opt[:1] + if first.isalnum(): + return "", opt + if opt[1:2] == first: + return opt[:2], opt[2:] + return first, opt[1:] + + +def normalize_opt(opt: str, ctx: t.Optional["Context"]) -> str: + if ctx is None or ctx.token_normalize_func is None: + return opt + prefix, opt = split_opt(opt) + return f"{prefix}{ctx.token_normalize_func(opt)}" + + +def split_arg_string(string: str) -> t.List[str]: + """Split an argument string as with :func:`shlex.split`, but don't + fail if the string is incomplete. Ignores a missing closing quote or + incomplete escape sequence and uses the partial token as-is. + + .. code-block:: python + + split_arg_string("example 'my file") + ["example", "my file"] + + split_arg_string("example my\\") + ["example", "my"] + + :param string: String to split. + """ + import shlex + + lex = shlex.shlex(string, posix=True) + lex.whitespace_split = True + lex.commenters = "" + out = [] + + try: + for token in lex: + out.append(token) + except ValueError: + # Raised when end-of-string is reached in an invalid state. Use + # the partial token as-is. The quote or escape character is in + # lex.state, not lex.token. + out.append(lex.token) + + return out + + +class Option: + def __init__( + self, + obj: "CoreOption", + opts: t.Sequence[str], + dest: t.Optional[str], + action: t.Optional[str] = None, + nargs: int = 1, + const: t.Optional[t.Any] = None, + ): + self._short_opts = [] + self._long_opts = [] + self.prefixes: t.Set[str] = set() + + for opt in opts: + prefix, value = split_opt(opt) + if not prefix: + raise ValueError(f"Invalid start character for option ({opt})") + self.prefixes.add(prefix[0]) + if len(prefix) == 1 and len(value) == 1: + self._short_opts.append(opt) + else: + self._long_opts.append(opt) + self.prefixes.add(prefix) + + if action is None: + action = "store" + + self.dest = dest + self.action = action + self.nargs = nargs + self.const = const + self.obj = obj + + @property + def takes_value(self) -> bool: + return self.action in ("store", "append") + + def process(self, value: t.Any, state: "ParsingState") -> None: + if self.action == "store": + state.opts[self.dest] = value # type: ignore + elif self.action == "store_const": + state.opts[self.dest] = self.const # type: ignore + elif self.action == "append": + state.opts.setdefault(self.dest, []).append(value) # type: ignore + elif self.action == "append_const": + state.opts.setdefault(self.dest, []).append(self.const) # type: ignore + elif self.action == "count": + state.opts[self.dest] = state.opts.get(self.dest, 0) + 1 # type: ignore + else: + raise ValueError(f"unknown action '{self.action}'") + state.order.append(self.obj) + + +class Argument: + def __init__(self, obj: "CoreArgument", dest: t.Optional[str], nargs: int = 1): + self.dest = dest + self.nargs = nargs + self.obj = obj + + def process( + self, + value: t.Union[t.Optional[str], t.Sequence[t.Optional[str]]], + state: "ParsingState", + ) -> None: + if self.nargs > 1: + assert value is not None + holes = sum(1 for x in value if x is None) + if holes == len(value): + value = None + elif holes != 0: + raise BadArgumentUsage( + _("Argument {name!r} takes {nargs} values.").format( + name=self.dest, nargs=self.nargs + ) + ) + + if self.nargs == -1 and self.obj.envvar is not None and value == (): + # Replace empty tuple with None so that a value from the + # environment may be tried. + value = None + + state.opts[self.dest] = value # type: ignore + state.order.append(self.obj) + + +class ParsingState: + def __init__(self, rargs: t.List[str]) -> None: + self.opts: t.Dict[str, t.Any] = {} + self.largs: t.List[str] = [] + self.rargs = rargs + self.order: t.List["CoreParameter"] = [] + + +class OptionParser: + """The option parser is an internal class that is ultimately used to + parse options and arguments. It's modelled after optparse and brings + a similar but vastly simplified API. It should generally not be used + directly as the high level Click classes wrap it for you. + + It's not nearly as extensible as optparse or argparse as it does not + implement features that are implemented on a higher level (such as + types or defaults). + + :param ctx: optionally the :class:`~click.Context` where this parser + should go with. + """ + + def __init__(self, ctx: t.Optional["Context"] = None) -> None: + #: The :class:`~click.Context` for this parser. This might be + #: `None` for some advanced use cases. + self.ctx = ctx + #: This controls how the parser deals with interspersed arguments. + #: If this is set to `False`, the parser will stop on the first + #: non-option. Click uses this to implement nested subcommands + #: safely. + self.allow_interspersed_args: bool = True + #: This tells the parser how to deal with unknown options. By + #: default it will error out (which is sensible), but there is a + #: second mode where it will ignore it and continue processing + #: after shifting all the unknown options into the resulting args. + self.ignore_unknown_options: bool = False + + if ctx is not None: + self.allow_interspersed_args = ctx.allow_interspersed_args + self.ignore_unknown_options = ctx.ignore_unknown_options + + self._short_opt: t.Dict[str, Option] = {} + self._long_opt: t.Dict[str, Option] = {} + self._opt_prefixes = {"-", "--"} + self._args: t.List[Argument] = [] + + def add_option( + self, + obj: "CoreOption", + opts: t.Sequence[str], + dest: t.Optional[str], + action: t.Optional[str] = None, + nargs: int = 1, + const: t.Optional[t.Any] = None, + ) -> None: + """Adds a new option named `dest` to the parser. The destination + is not inferred (unlike with optparse) and needs to be explicitly + provided. Action can be any of ``store``, ``store_const``, + ``append``, ``append_const`` or ``count``. + + The `obj` can be used to identify the option in the order list + that is returned from the parser. + """ + opts = [normalize_opt(opt, self.ctx) for opt in opts] + option = Option(obj, opts, dest, action=action, nargs=nargs, const=const) + self._opt_prefixes.update(option.prefixes) + for opt in option._short_opts: + self._short_opt[opt] = option + for opt in option._long_opts: + self._long_opt[opt] = option + + def add_argument( + self, obj: "CoreArgument", dest: t.Optional[str], nargs: int = 1 + ) -> None: + """Adds a positional argument named `dest` to the parser. + + The `obj` can be used to identify the option in the order list + that is returned from the parser. + """ + self._args.append(Argument(obj, dest=dest, nargs=nargs)) + + def parse_args( + self, args: t.List[str] + ) -> t.Tuple[t.Dict[str, t.Any], t.List[str], t.List["CoreParameter"]]: + """Parses positional arguments and returns ``(values, args, order)`` + for the parsed options and arguments as well as the leftover + arguments if there are any. The order is a list of objects as they + appear on the command line. If arguments appear multiple times they + will be memorized multiple times as well. + """ + state = ParsingState(args) + try: + self._process_args_for_options(state) + self._process_args_for_args(state) + except UsageError: + if self.ctx is None or not self.ctx.resilient_parsing: + raise + return state.opts, state.largs, state.order + + def _process_args_for_args(self, state: ParsingState) -> None: + pargs, args = _unpack_args( + state.largs + state.rargs, [x.nargs for x in self._args] + ) + + for idx, arg in enumerate(self._args): + arg.process(pargs[idx], state) + + state.largs = args + state.rargs = [] + + def _process_args_for_options(self, state: ParsingState) -> None: + while state.rargs: + arg = state.rargs.pop(0) + arglen = len(arg) + # Double dashes always handled explicitly regardless of what + # prefixes are valid. + if arg == "--": + return + elif arg[:1] in self._opt_prefixes and arglen > 1: + self._process_opts(arg, state) + elif self.allow_interspersed_args: + state.largs.append(arg) + else: + state.rargs.insert(0, arg) + return + + # Say this is the original argument list: + # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)] + # ^ + # (we are about to process arg(i)). + # + # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of + # [arg0, ..., arg(i-1)] (any options and their arguments will have + # been removed from largs). + # + # The while loop will usually consume 1 or more arguments per pass. + # If it consumes 1 (eg. arg is an option that takes no arguments), + # then after _process_arg() is done the situation is: + # + # largs = subset of [arg0, ..., arg(i)] + # rargs = [arg(i+1), ..., arg(N-1)] + # + # If allow_interspersed_args is false, largs will always be + # *empty* -- still a subset of [arg0, ..., arg(i-1)], but + # not a very interesting subset! + + def _match_long_opt( + self, opt: str, explicit_value: t.Optional[str], state: ParsingState + ) -> None: + if opt not in self._long_opt: + from difflib import get_close_matches + + possibilities = get_close_matches(opt, self._long_opt) + raise NoSuchOption(opt, possibilities=possibilities, ctx=self.ctx) + + option = self._long_opt[opt] + if option.takes_value: + # At this point it's safe to modify rargs by injecting the + # explicit value, because no exception is raised in this + # branch. This means that the inserted value will be fully + # consumed. + if explicit_value is not None: + state.rargs.insert(0, explicit_value) + + value = self._get_value_from_state(opt, option, state) + + elif explicit_value is not None: + raise BadOptionUsage( + opt, _("Option {name!r} does not take a value.").format(name=opt) + ) + + else: + value = None + + option.process(value, state) + + def _match_short_opt(self, arg: str, state: ParsingState) -> None: + stop = False + i = 1 + prefix = arg[0] + unknown_options = [] + + for ch in arg[1:]: + opt = normalize_opt(f"{prefix}{ch}", self.ctx) + option = self._short_opt.get(opt) + i += 1 + + if not option: + if self.ignore_unknown_options: + unknown_options.append(ch) + continue + raise NoSuchOption(opt, ctx=self.ctx) + if option.takes_value: + # Any characters left in arg? Pretend they're the + # next arg, and stop consuming characters of arg. + if i < len(arg): + state.rargs.insert(0, arg[i:]) + stop = True + + value = self._get_value_from_state(opt, option, state) + + else: + value = None + + option.process(value, state) + + if stop: + break + + # If we got any unknown options we recombine the string of the + # remaining options and re-attach the prefix, then report that + # to the state as new larg. This way there is basic combinatorics + # that can be achieved while still ignoring unknown arguments. + if self.ignore_unknown_options and unknown_options: + state.largs.append(f"{prefix}{''.join(unknown_options)}") + + def _get_value_from_state( + self, option_name: str, option: Option, state: ParsingState + ) -> t.Any: + nargs = option.nargs + + if len(state.rargs) < nargs: + if option.obj._flag_needs_value: + # Option allows omitting the value. + value = _flag_needs_value + else: + raise BadOptionUsage( + option_name, + ngettext( + "Option {name!r} requires an argument.", + "Option {name!r} requires {nargs} arguments.", + nargs, + ).format(name=option_name, nargs=nargs), + ) + elif nargs == 1: + next_rarg = state.rargs[0] + + if ( + option.obj._flag_needs_value + and isinstance(next_rarg, str) + and next_rarg[:1] in self._opt_prefixes + and len(next_rarg) > 1 + ): + # The next arg looks like the start of an option, don't + # use it as the value if omitting the value is allowed. + value = _flag_needs_value + else: + value = state.rargs.pop(0) + else: + value = tuple(state.rargs[:nargs]) + del state.rargs[:nargs] + + return value + + def _process_opts(self, arg: str, state: ParsingState) -> None: + explicit_value = None + # Long option handling happens in two parts. The first part is + # supporting explicitly attached values. In any case, we will try + # to long match the option first. + if "=" in arg: + long_opt, explicit_value = arg.split("=", 1) + else: + long_opt = arg + norm_long_opt = normalize_opt(long_opt, self.ctx) + + # At this point we will match the (assumed) long option through + # the long option matching code. Note that this allows options + # like "-foo" to be matched as long options. + try: + self._match_long_opt(norm_long_opt, explicit_value, state) + except NoSuchOption: + # At this point the long option matching failed, and we need + # to try with short options. However there is a special rule + # which says, that if we have a two character options prefix + # (applies to "--foo" for instance), we do not dispatch to the + # short option code and will instead raise the no option + # error. + if arg[:2] not in self._opt_prefixes: + self._match_short_opt(arg, state) + return + + if not self.ignore_unknown_options: + raise + + state.largs.append(arg) diff --git a/click/python/click/py.typed b/click/python/click/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/click/python/click/shell_completion.py b/click/python/click/shell_completion.py new file mode 100644 index 0000000..dc9e00b --- /dev/null +++ b/click/python/click/shell_completion.py @@ -0,0 +1,596 @@ +import os +import re +import typing as t +from gettext import gettext as _ + +from .core import Argument +from .core import BaseCommand +from .core import Context +from .core import MultiCommand +from .core import Option +from .core import Parameter +from .core import ParameterSource +from .parser import split_arg_string +from .utils import echo + + +def shell_complete( + cli: BaseCommand, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + complete_var: str, + instruction: str, +) -> int: + """Perform shell completion for the given CLI program. + + :param cli: Command being called. + :param ctx_args: Extra arguments to pass to + ``cli.make_context``. + :param prog_name: Name of the executable in the shell. + :param complete_var: Name of the environment variable that holds + the completion instruction. + :param instruction: Value of ``complete_var`` with the completion + instruction and shell, in the form ``instruction_shell``. + :return: Status code to exit with. + """ + shell, _, instruction = instruction.partition("_") + comp_cls = get_completion_class(shell) + + if comp_cls is None: + return 1 + + comp = comp_cls(cli, ctx_args, prog_name, complete_var) + + if instruction == "source": + echo(comp.source()) + return 0 + + if instruction == "complete": + echo(comp.complete()) + return 0 + + return 1 + + +class CompletionItem: + """Represents a completion value and metadata about the value. The + default metadata is ``type`` to indicate special shell handling, + and ``help`` if a shell supports showing a help string next to the + value. + + Arbitrary parameters can be passed when creating the object, and + accessed using ``item.attr``. If an attribute wasn't passed, + accessing it returns ``None``. + + :param value: The completion suggestion. + :param type: Tells the shell script to provide special completion + support for the type. Click uses ``"dir"`` and ``"file"``. + :param help: String shown next to the value if supported. + :param kwargs: Arbitrary metadata. The built-in implementations + don't use this, but custom type completions paired with custom + shell support could use it. + """ + + __slots__ = ("value", "type", "help", "_info") + + def __init__( + self, + value: t.Any, + type: str = "plain", + help: t.Optional[str] = None, + **kwargs: t.Any, + ) -> None: + self.value: t.Any = value + self.type: str = type + self.help: t.Optional[str] = help + self._info = kwargs + + def __getattr__(self, name: str) -> t.Any: + return self._info.get(name) + + +# Only Bash >= 4.4 has the nosort option. +_SOURCE_BASH = """\ +%(complete_func)s() { + local IFS=$'\\n' + local response + + response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD \ +%(complete_var)s=bash_complete $1) + + for completion in $response; do + IFS=',' read type value <<< "$completion" + + if [[ $type == 'dir' ]]; then + COMPREPLY=() + compopt -o dirnames + elif [[ $type == 'file' ]]; then + COMPREPLY=() + compopt -o default + elif [[ $type == 'plain' ]]; then + COMPREPLY+=($value) + fi + done + + return 0 +} + +%(complete_func)s_setup() { + complete -o nosort -F %(complete_func)s %(prog_name)s +} + +%(complete_func)s_setup; +""" + +_SOURCE_ZSH = """\ +#compdef %(prog_name)s + +%(complete_func)s() { + local -a completions + local -a completions_with_descriptions + local -a response + (( ! $+commands[%(prog_name)s] )) && return 1 + + response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) \ +%(complete_var)s=zsh_complete %(prog_name)s)}") + + for type key descr in ${response}; do + if [[ "$type" == "plain" ]]; then + if [[ "$descr" == "_" ]]; then + completions+=("$key") + else + completions_with_descriptions+=("$key":"$descr") + fi + elif [[ "$type" == "dir" ]]; then + _path_files -/ + elif [[ "$type" == "file" ]]; then + _path_files -f + fi + done + + if [ -n "$completions_with_descriptions" ]; then + _describe -V unsorted completions_with_descriptions -U + fi + + if [ -n "$completions" ]; then + compadd -U -V unsorted -a completions + fi +} + +if [[ $zsh_eval_context[-1] == loadautofunc ]]; then + # autoload from fpath, call function directly + %(complete_func)s "$@" +else + # eval/source/. command, register function for later + compdef %(complete_func)s %(prog_name)s +fi +""" + +_SOURCE_FISH = """\ +function %(complete_func)s; + set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) \ +COMP_CWORD=(commandline -t) %(prog_name)s); + + for completion in $response; + set -l metadata (string split "," $completion); + + if test $metadata[1] = "dir"; + __fish_complete_directories $metadata[2]; + else if test $metadata[1] = "file"; + __fish_complete_path $metadata[2]; + else if test $metadata[1] = "plain"; + echo $metadata[2]; + end; + end; +end; + +complete --no-files --command %(prog_name)s --arguments \ +"(%(complete_func)s)"; +""" + + +class ShellComplete: + """Base class for providing shell completion support. A subclass for + a given shell will override attributes and methods to implement the + completion instructions (``source`` and ``complete``). + + :param cli: Command being called. + :param prog_name: Name of the executable in the shell. + :param complete_var: Name of the environment variable that holds + the completion instruction. + + .. versionadded:: 8.0 + """ + + name: t.ClassVar[str] + """Name to register the shell as with :func:`add_completion_class`. + This is used in completion instructions (``{name}_source`` and + ``{name}_complete``). + """ + + source_template: t.ClassVar[str] + """Completion script template formatted by :meth:`source`. This must + be provided by subclasses. + """ + + def __init__( + self, + cli: BaseCommand, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + complete_var: str, + ) -> None: + self.cli = cli + self.ctx_args = ctx_args + self.prog_name = prog_name + self.complete_var = complete_var + + @property + def func_name(self) -> str: + """The name of the shell function defined by the completion + script. + """ + safe_name = re.sub(r"\W*", "", self.prog_name.replace("-", "_"), flags=re.ASCII) + return f"_{safe_name}_completion" + + def source_vars(self) -> t.Dict[str, t.Any]: + """Vars for formatting :attr:`source_template`. + + By default this provides ``complete_func``, ``complete_var``, + and ``prog_name``. + """ + return { + "complete_func": self.func_name, + "complete_var": self.complete_var, + "prog_name": self.prog_name, + } + + def source(self) -> str: + """Produce the shell script that defines the completion + function. By default this ``%``-style formats + :attr:`source_template` with the dict returned by + :meth:`source_vars`. + """ + return self.source_template % self.source_vars() + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + """Use the env vars defined by the shell script to return a + tuple of ``args, incomplete``. This must be implemented by + subclasses. + """ + raise NotImplementedError + + def get_completions( + self, args: t.List[str], incomplete: str + ) -> t.List[CompletionItem]: + """Determine the context and last complete command or parameter + from the complete args. Call that object's ``shell_complete`` + method to get the completions for the incomplete value. + + :param args: List of complete args before the incomplete value. + :param incomplete: Value being completed. May be empty. + """ + ctx = _resolve_context(self.cli, self.ctx_args, self.prog_name, args) + obj, incomplete = _resolve_incomplete(ctx, args, incomplete) + return obj.shell_complete(ctx, incomplete) + + def format_completion(self, item: CompletionItem) -> str: + """Format a completion item into the form recognized by the + shell script. This must be implemented by subclasses. + + :param item: Completion item to format. + """ + raise NotImplementedError + + def complete(self) -> str: + """Produce the completion data to send back to the shell. + + By default this calls :meth:`get_completion_args`, gets the + completions, then calls :meth:`format_completion` for each + completion. + """ + args, incomplete = self.get_completion_args() + completions = self.get_completions(args, incomplete) + out = [self.format_completion(item) for item in completions] + return "\n".join(out) + + +class BashComplete(ShellComplete): + """Shell completion for Bash.""" + + name = "bash" + source_template = _SOURCE_BASH + + @staticmethod + def _check_version() -> None: + import subprocess + + output = subprocess.run( + ["bash", "-c", 'echo "${BASH_VERSION}"'], stdout=subprocess.PIPE + ) + match = re.search(r"^(\d+)\.(\d+)\.\d+", output.stdout.decode()) + + if match is not None: + major, minor = match.groups() + + if major < "4" or major == "4" and minor < "4": + echo( + _( + "Shell completion is not supported for Bash" + " versions older than 4.4." + ), + err=True, + ) + else: + echo( + _("Couldn't detect Bash version, shell completion is not supported."), + err=True, + ) + + def source(self) -> str: + self._check_version() + return super().source() + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + cwords = split_arg_string(os.environ["COMP_WORDS"]) + cword = int(os.environ["COMP_CWORD"]) + args = cwords[1:cword] + + try: + incomplete = cwords[cword] + except IndexError: + incomplete = "" + + return args, incomplete + + def format_completion(self, item: CompletionItem) -> str: + return f"{item.type},{item.value}" + + +class ZshComplete(ShellComplete): + """Shell completion for Zsh.""" + + name = "zsh" + source_template = _SOURCE_ZSH + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + cwords = split_arg_string(os.environ["COMP_WORDS"]) + cword = int(os.environ["COMP_CWORD"]) + args = cwords[1:cword] + + try: + incomplete = cwords[cword] + except IndexError: + incomplete = "" + + return args, incomplete + + def format_completion(self, item: CompletionItem) -> str: + return f"{item.type}\n{item.value}\n{item.help if item.help else '_'}" + + +class FishComplete(ShellComplete): + """Shell completion for Fish.""" + + name = "fish" + source_template = _SOURCE_FISH + + def get_completion_args(self) -> t.Tuple[t.List[str], str]: + cwords = split_arg_string(os.environ["COMP_WORDS"]) + incomplete = os.environ["COMP_CWORD"] + args = cwords[1:] + + # Fish stores the partial word in both COMP_WORDS and + # COMP_CWORD, remove it from complete args. + if incomplete and args and args[-1] == incomplete: + args.pop() + + return args, incomplete + + def format_completion(self, item: CompletionItem) -> str: + if item.help: + return f"{item.type},{item.value}\t{item.help}" + + return f"{item.type},{item.value}" + + +ShellCompleteType = t.TypeVar("ShellCompleteType", bound=t.Type[ShellComplete]) + + +_available_shells: t.Dict[str, t.Type[ShellComplete]] = { + "bash": BashComplete, + "fish": FishComplete, + "zsh": ZshComplete, +} + + +def add_completion_class( + cls: ShellCompleteType, name: t.Optional[str] = None +) -> ShellCompleteType: + """Register a :class:`ShellComplete` subclass under the given name. + The name will be provided by the completion instruction environment + variable during completion. + + :param cls: The completion class that will handle completion for the + shell. + :param name: Name to register the class under. Defaults to the + class's ``name`` attribute. + """ + if name is None: + name = cls.name + + _available_shells[name] = cls + + return cls + + +def get_completion_class(shell: str) -> t.Optional[t.Type[ShellComplete]]: + """Look up a registered :class:`ShellComplete` subclass by the name + provided by the completion instruction environment variable. If the + name isn't registered, returns ``None``. + + :param shell: Name the class is registered under. + """ + return _available_shells.get(shell) + + +def _is_incomplete_argument(ctx: Context, param: Parameter) -> bool: + """Determine if the given parameter is an argument that can still + accept values. + + :param ctx: Invocation context for the command represented by the + parsed complete args. + :param param: Argument object being checked. + """ + if not isinstance(param, Argument): + return False + + assert param.name is not None + # Will be None if expose_value is False. + value = ctx.params.get(param.name) + return ( + param.nargs == -1 + or ctx.get_parameter_source(param.name) is not ParameterSource.COMMANDLINE + or ( + param.nargs > 1 + and isinstance(value, (tuple, list)) + and len(value) < param.nargs + ) + ) + + +def _start_of_option(ctx: Context, value: str) -> bool: + """Check if the value looks like the start of an option.""" + if not value: + return False + + c = value[0] + return c in ctx._opt_prefixes + + +def _is_incomplete_option(ctx: Context, args: t.List[str], param: Parameter) -> bool: + """Determine if the given parameter is an option that needs a value. + + :param args: List of complete args before the incomplete value. + :param param: Option object being checked. + """ + if not isinstance(param, Option): + return False + + if param.is_flag or param.count: + return False + + last_option = None + + for index, arg in enumerate(reversed(args)): + if index + 1 > param.nargs: + break + + if _start_of_option(ctx, arg): + last_option = arg + + return last_option is not None and last_option in param.opts + + +def _resolve_context( + cli: BaseCommand, + ctx_args: t.MutableMapping[str, t.Any], + prog_name: str, + args: t.List[str], +) -> Context: + """Produce the context hierarchy starting with the command and + traversing the complete arguments. This only follows the commands, + it doesn't trigger input prompts or callbacks. + + :param cli: Command being called. + :param prog_name: Name of the executable in the shell. + :param args: List of complete args before the incomplete value. + """ + ctx_args["resilient_parsing"] = True + ctx = cli.make_context(prog_name, args.copy(), **ctx_args) + args = ctx.protected_args + ctx.args + + while args: + command = ctx.command + + if isinstance(command, MultiCommand): + if not command.chain: + name, cmd, args = command.resolve_command(ctx, args) + + if cmd is None: + return ctx + + ctx = cmd.make_context(name, args, parent=ctx, resilient_parsing=True) + args = ctx.protected_args + ctx.args + else: + sub_ctx = ctx + + while args: + name, cmd, args = command.resolve_command(ctx, args) + + if cmd is None: + return ctx + + sub_ctx = cmd.make_context( + name, + args, + parent=ctx, + allow_extra_args=True, + allow_interspersed_args=False, + resilient_parsing=True, + ) + args = sub_ctx.args + + ctx = sub_ctx + args = [*sub_ctx.protected_args, *sub_ctx.args] + else: + break + + return ctx + + +def _resolve_incomplete( + ctx: Context, args: t.List[str], incomplete: str +) -> t.Tuple[t.Union[BaseCommand, Parameter], str]: + """Find the Click object that will handle the completion of the + incomplete value. Return the object and the incomplete value. + + :param ctx: Invocation context for the command represented by + the parsed complete args. + :param args: List of complete args before the incomplete value. + :param incomplete: Value being completed. May be empty. + """ + # Different shells treat an "=" between a long option name and + # value differently. Might keep the value joined, return the "=" + # as a separate item, or return the split name and value. Always + # split and discard the "=" to make completion easier. + if incomplete == "=": + incomplete = "" + elif "=" in incomplete and _start_of_option(ctx, incomplete): + name, _, incomplete = incomplete.partition("=") + args.append(name) + + # The "--" marker tells Click to stop treating values as options + # even if they start with the option character. If it hasn't been + # given and the incomplete arg looks like an option, the current + # command will provide option name completions. + if "--" not in args and _start_of_option(ctx, incomplete): + return ctx.command, incomplete + + params = ctx.command.get_params(ctx) + + # If the last complete arg is an option name with an incomplete + # value, the option will provide value completions. + for param in params: + if _is_incomplete_option(ctx, args, param): + return param, incomplete + + # It's not an option name or value. The first argument without a + # parsed value will provide value completions. + for param in params: + if _is_incomplete_argument(ctx, param): + return param, incomplete + + # There were no unparsed arguments, the command may be a group that + # will provide command name completions. + return ctx.command, incomplete diff --git a/click/python/click/termui.py b/click/python/click/termui.py new file mode 100644 index 0000000..db7a4b2 --- /dev/null +++ b/click/python/click/termui.py @@ -0,0 +1,784 @@ +import inspect +import io +import itertools +import sys +import typing as t +from gettext import gettext as _ + +from ._compat import isatty +from ._compat import strip_ansi +from .exceptions import Abort +from .exceptions import UsageError +from .globals import resolve_color_default +from .types import Choice +from .types import convert_type +from .types import ParamType +from .utils import echo +from .utils import LazyFile + +if t.TYPE_CHECKING: + from ._termui_impl import ProgressBar + +V = t.TypeVar("V") + +# The prompt functions to use. The doc tools currently override these +# functions to customize how they work. +visible_prompt_func: t.Callable[[str], str] = input + +_ansi_colors = { + "black": 30, + "red": 31, + "green": 32, + "yellow": 33, + "blue": 34, + "magenta": 35, + "cyan": 36, + "white": 37, + "reset": 39, + "bright_black": 90, + "bright_red": 91, + "bright_green": 92, + "bright_yellow": 93, + "bright_blue": 94, + "bright_magenta": 95, + "bright_cyan": 96, + "bright_white": 97, +} +_ansi_reset_all = "\033[0m" + + +def hidden_prompt_func(prompt: str) -> str: + import getpass + + return getpass.getpass(prompt) + + +def _build_prompt( + text: str, + suffix: str, + show_default: bool = False, + default: t.Optional[t.Any] = None, + show_choices: bool = True, + type: t.Optional[ParamType] = None, +) -> str: + prompt = text + if type is not None and show_choices and isinstance(type, Choice): + prompt += f" ({', '.join(map(str, type.choices))})" + if default is not None and show_default: + prompt = f"{prompt} [{_format_default(default)}]" + return f"{prompt}{suffix}" + + +def _format_default(default: t.Any) -> t.Any: + if isinstance(default, (io.IOBase, LazyFile)) and hasattr(default, "name"): + return default.name + + return default + + +def prompt( + text: str, + default: t.Optional[t.Any] = None, + hide_input: bool = False, + confirmation_prompt: t.Union[bool, str] = False, + type: t.Optional[t.Union[ParamType, t.Any]] = None, + value_proc: t.Optional[t.Callable[[str], t.Any]] = None, + prompt_suffix: str = ": ", + show_default: bool = True, + err: bool = False, + show_choices: bool = True, +) -> t.Any: + """Prompts a user for input. This is a convenience function that can + be used to prompt a user for input later. + + If the user aborts the input by sending an interrupt signal, this + function will catch it and raise a :exc:`Abort` exception. + + :param text: the text to show for the prompt. + :param default: the default value to use if no input happens. If this + is not given it will prompt until it's aborted. + :param hide_input: if this is set to true then the input value will + be hidden. + :param confirmation_prompt: Prompt a second time to confirm the + value. Can be set to a string instead of ``True`` to customize + the message. + :param type: the type to use to check the value against. + :param value_proc: if this parameter is provided it's a function that + is invoked instead of the type conversion to + convert a value. + :param prompt_suffix: a suffix that should be added to the prompt. + :param show_default: shows or hides the default value in the prompt. + :param err: if set to true the file defaults to ``stderr`` instead of + ``stdout``, the same as with echo. + :param show_choices: Show or hide choices if the passed type is a Choice. + For example if type is a Choice of either day or week, + show_choices is true and text is "Group by" then the + prompt will be "Group by (day, week): ". + + .. versionadded:: 8.0 + ``confirmation_prompt`` can be a custom string. + + .. versionadded:: 7.0 + Added the ``show_choices`` parameter. + + .. versionadded:: 6.0 + Added unicode support for cmd.exe on Windows. + + .. versionadded:: 4.0 + Added the `err` parameter. + + """ + + def prompt_func(text: str) -> str: + f = hidden_prompt_func if hide_input else visible_prompt_func + try: + # Write the prompt separately so that we get nice + # coloring through colorama on Windows + echo(text.rstrip(" "), nl=False, err=err) + # Echo a space to stdout to work around an issue where + # readline causes backspace to clear the whole line. + return f(" ") + except (KeyboardInterrupt, EOFError): + # getpass doesn't print a newline if the user aborts input with ^C. + # Allegedly this behavior is inherited from getpass(3). + # A doc bug has been filed at https://bugs.python.org/issue24711 + if hide_input: + echo(None, err=err) + raise Abort() from None + + if value_proc is None: + value_proc = convert_type(type, default) + + prompt = _build_prompt( + text, prompt_suffix, show_default, default, show_choices, type + ) + + if confirmation_prompt: + if confirmation_prompt is True: + confirmation_prompt = _("Repeat for confirmation") + + confirmation_prompt = _build_prompt(confirmation_prompt, prompt_suffix) + + while True: + while True: + value = prompt_func(prompt) + if value: + break + elif default is not None: + value = default + break + try: + result = value_proc(value) + except UsageError as e: + if hide_input: + echo(_("Error: The value you entered was invalid."), err=err) + else: + echo(_("Error: {e.message}").format(e=e), err=err) # noqa: B306 + continue + if not confirmation_prompt: + return result + while True: + value2 = prompt_func(confirmation_prompt) + is_empty = not value and not value2 + if value2 or is_empty: + break + if value == value2: + return result + echo(_("Error: The two entered values do not match."), err=err) + + +def confirm( + text: str, + default: t.Optional[bool] = False, + abort: bool = False, + prompt_suffix: str = ": ", + show_default: bool = True, + err: bool = False, +) -> bool: + """Prompts for confirmation (yes/no question). + + If the user aborts the input by sending a interrupt signal this + function will catch it and raise a :exc:`Abort` exception. + + :param text: the question to ask. + :param default: The default value to use when no input is given. If + ``None``, repeat until input is given. + :param abort: if this is set to `True` a negative answer aborts the + exception by raising :exc:`Abort`. + :param prompt_suffix: a suffix that should be added to the prompt. + :param show_default: shows or hides the default value in the prompt. + :param err: if set to true the file defaults to ``stderr`` instead of + ``stdout``, the same as with echo. + + .. versionchanged:: 8.0 + Repeat until input is given if ``default`` is ``None``. + + .. versionadded:: 4.0 + Added the ``err`` parameter. + """ + prompt = _build_prompt( + text, + prompt_suffix, + show_default, + "y/n" if default is None else ("Y/n" if default else "y/N"), + ) + + while True: + try: + # Write the prompt separately so that we get nice + # coloring through colorama on Windows + echo(prompt.rstrip(" "), nl=False, err=err) + # Echo a space to stdout to work around an issue where + # readline causes backspace to clear the whole line. + value = visible_prompt_func(" ").lower().strip() + except (KeyboardInterrupt, EOFError): + raise Abort() from None + if value in ("y", "yes"): + rv = True + elif value in ("n", "no"): + rv = False + elif default is not None and value == "": + rv = default + else: + echo(_("Error: invalid input"), err=err) + continue + break + if abort and not rv: + raise Abort() + return rv + + +def echo_via_pager( + text_or_generator: t.Union[t.Iterable[str], t.Callable[[], t.Iterable[str]], str], + color: t.Optional[bool] = None, +) -> None: + """This function takes a text and shows it via an environment specific + pager on stdout. + + .. versionchanged:: 3.0 + Added the `color` flag. + + :param text_or_generator: the text to page, or alternatively, a + generator emitting the text to page. + :param color: controls if the pager supports ANSI colors or not. The + default is autodetection. + """ + color = resolve_color_default(color) + + if inspect.isgeneratorfunction(text_or_generator): + i = t.cast(t.Callable[[], t.Iterable[str]], text_or_generator)() + elif isinstance(text_or_generator, str): + i = [text_or_generator] + else: + i = iter(t.cast(t.Iterable[str], text_or_generator)) + + # convert every element of i to a text type if necessary + text_generator = (el if isinstance(el, str) else str(el) for el in i) + + from ._termui_impl import pager + + return pager(itertools.chain(text_generator, "\n"), color) + + +def progressbar( + iterable: t.Optional[t.Iterable[V]] = None, + length: t.Optional[int] = None, + label: t.Optional[str] = None, + show_eta: bool = True, + show_percent: t.Optional[bool] = None, + show_pos: bool = False, + item_show_func: t.Optional[t.Callable[[t.Optional[V]], t.Optional[str]]] = None, + fill_char: str = "#", + empty_char: str = "-", + bar_template: str = "%(label)s [%(bar)s] %(info)s", + info_sep: str = " ", + width: int = 36, + file: t.Optional[t.TextIO] = None, + color: t.Optional[bool] = None, + update_min_steps: int = 1, +) -> "ProgressBar[V]": + """This function creates an iterable context manager that can be used + to iterate over something while showing a progress bar. It will + either iterate over the `iterable` or `length` items (that are counted + up). While iteration happens, this function will print a rendered + progress bar to the given `file` (defaults to stdout) and will attempt + to calculate remaining time and more. By default, this progress bar + will not be rendered if the file is not a terminal. + + The context manager creates the progress bar. When the context + manager is entered the progress bar is already created. With every + iteration over the progress bar, the iterable passed to the bar is + advanced and the bar is updated. When the context manager exits, + a newline is printed and the progress bar is finalized on screen. + + Note: The progress bar is currently designed for use cases where the + total progress can be expected to take at least several seconds. + Because of this, the ProgressBar class object won't display + progress that is considered too fast, and progress where the time + between steps is less than a second. + + No printing must happen or the progress bar will be unintentionally + destroyed. + + Example usage:: + + with progressbar(items) as bar: + for item in bar: + do_something_with(item) + + Alternatively, if no iterable is specified, one can manually update the + progress bar through the `update()` method instead of directly + iterating over the progress bar. The update method accepts the number + of steps to increment the bar with:: + + with progressbar(length=chunks.total_bytes) as bar: + for chunk in chunks: + process_chunk(chunk) + bar.update(chunks.bytes) + + The ``update()`` method also takes an optional value specifying the + ``current_item`` at the new position. This is useful when used + together with ``item_show_func`` to customize the output for each + manual step:: + + with click.progressbar( + length=total_size, + label='Unzipping archive', + item_show_func=lambda a: a.filename + ) as bar: + for archive in zip_file: + archive.extract() + bar.update(archive.size, archive) + + :param iterable: an iterable to iterate over. If not provided the length + is required. + :param length: the number of items to iterate over. By default the + progressbar will attempt to ask the iterator about its + length, which might or might not work. If an iterable is + also provided this parameter can be used to override the + length. If an iterable is not provided the progress bar + will iterate over a range of that length. + :param label: the label to show next to the progress bar. + :param show_eta: enables or disables the estimated time display. This is + automatically disabled if the length cannot be + determined. + :param show_percent: enables or disables the percentage display. The + default is `True` if the iterable has a length or + `False` if not. + :param show_pos: enables or disables the absolute position display. The + default is `False`. + :param item_show_func: A function called with the current item which + can return a string to show next to the progress bar. If the + function returns ``None`` nothing is shown. The current item can + be ``None``, such as when entering and exiting the bar. + :param fill_char: the character to use to show the filled part of the + progress bar. + :param empty_char: the character to use to show the non-filled part of + the progress bar. + :param bar_template: the format string to use as template for the bar. + The parameters in it are ``label`` for the label, + ``bar`` for the progress bar and ``info`` for the + info section. + :param info_sep: the separator between multiple info items (eta etc.) + :param width: the width of the progress bar in characters, 0 means full + terminal width + :param file: The file to write to. If this is not a terminal then + only the label is printed. + :param color: controls if the terminal supports ANSI colors or not. The + default is autodetection. This is only needed if ANSI + codes are included anywhere in the progress bar output + which is not the case by default. + :param update_min_steps: Render only when this many updates have + completed. This allows tuning for very fast iterators. + + .. versionchanged:: 8.0 + Output is shown even if execution time is less than 0.5 seconds. + + .. versionchanged:: 8.0 + ``item_show_func`` shows the current item, not the previous one. + + .. versionchanged:: 8.0 + Labels are echoed if the output is not a TTY. Reverts a change + in 7.0 that removed all output. + + .. versionadded:: 8.0 + Added the ``update_min_steps`` parameter. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. Added the ``update`` method to + the object. + + .. versionadded:: 2.0 + """ + from ._termui_impl import ProgressBar + + color = resolve_color_default(color) + return ProgressBar( + iterable=iterable, + length=length, + show_eta=show_eta, + show_percent=show_percent, + show_pos=show_pos, + item_show_func=item_show_func, + fill_char=fill_char, + empty_char=empty_char, + bar_template=bar_template, + info_sep=info_sep, + file=file, + label=label, + width=width, + color=color, + update_min_steps=update_min_steps, + ) + + +def clear() -> None: + """Clears the terminal screen. This will have the effect of clearing + the whole visible space of the terminal and moving the cursor to the + top left. This does not do anything if not connected to a terminal. + + .. versionadded:: 2.0 + """ + if not isatty(sys.stdout): + return + + # ANSI escape \033[2J clears the screen, \033[1;1H moves the cursor + echo("\033[2J\033[1;1H", nl=False) + + +def _interpret_color( + color: t.Union[int, t.Tuple[int, int, int], str], offset: int = 0 +) -> str: + if isinstance(color, int): + return f"{38 + offset};5;{color:d}" + + if isinstance(color, (tuple, list)): + r, g, b = color + return f"{38 + offset};2;{r:d};{g:d};{b:d}" + + return str(_ansi_colors[color] + offset) + + +def style( + text: t.Any, + fg: t.Optional[t.Union[int, t.Tuple[int, int, int], str]] = None, + bg: t.Optional[t.Union[int, t.Tuple[int, int, int], str]] = None, + bold: t.Optional[bool] = None, + dim: t.Optional[bool] = None, + underline: t.Optional[bool] = None, + overline: t.Optional[bool] = None, + italic: t.Optional[bool] = None, + blink: t.Optional[bool] = None, + reverse: t.Optional[bool] = None, + strikethrough: t.Optional[bool] = None, + reset: bool = True, +) -> str: + """Styles a text with ANSI styles and returns the new string. By + default the styling is self contained which means that at the end + of the string a reset code is issued. This can be prevented by + passing ``reset=False``. + + Examples:: + + click.echo(click.style('Hello World!', fg='green')) + click.echo(click.style('ATTENTION!', blink=True)) + click.echo(click.style('Some things', reverse=True, fg='cyan')) + click.echo(click.style('More colors', fg=(255, 12, 128), bg=117)) + + Supported color names: + + * ``black`` (might be a gray) + * ``red`` + * ``green`` + * ``yellow`` (might be an orange) + * ``blue`` + * ``magenta`` + * ``cyan`` + * ``white`` (might be light gray) + * ``bright_black`` + * ``bright_red`` + * ``bright_green`` + * ``bright_yellow`` + * ``bright_blue`` + * ``bright_magenta`` + * ``bright_cyan`` + * ``bright_white`` + * ``reset`` (reset the color code only) + + If the terminal supports it, color may also be specified as: + + - An integer in the interval [0, 255]. The terminal must support + 8-bit/256-color mode. + - An RGB tuple of three integers in [0, 255]. The terminal must + support 24-bit/true-color mode. + + See https://en.wikipedia.org/wiki/ANSI_color and + https://gist.github.com/XVilka/8346728 for more information. + + :param text: the string to style with ansi codes. + :param fg: if provided this will become the foreground color. + :param bg: if provided this will become the background color. + :param bold: if provided this will enable or disable bold mode. + :param dim: if provided this will enable or disable dim mode. This is + badly supported. + :param underline: if provided this will enable or disable underline. + :param overline: if provided this will enable or disable overline. + :param italic: if provided this will enable or disable italic. + :param blink: if provided this will enable or disable blinking. + :param reverse: if provided this will enable or disable inverse + rendering (foreground becomes background and the + other way round). + :param strikethrough: if provided this will enable or disable + striking through text. + :param reset: by default a reset-all code is added at the end of the + string which means that styles do not carry over. This + can be disabled to compose styles. + + .. versionchanged:: 8.0 + A non-string ``message`` is converted to a string. + + .. versionchanged:: 8.0 + Added support for 256 and RGB color codes. + + .. versionchanged:: 8.0 + Added the ``strikethrough``, ``italic``, and ``overline`` + parameters. + + .. versionchanged:: 7.0 + Added support for bright colors. + + .. versionadded:: 2.0 + """ + if not isinstance(text, str): + text = str(text) + + bits = [] + + if fg: + try: + bits.append(f"\033[{_interpret_color(fg)}m") + except KeyError: + raise TypeError(f"Unknown color {fg!r}") from None + + if bg: + try: + bits.append(f"\033[{_interpret_color(bg, 10)}m") + except KeyError: + raise TypeError(f"Unknown color {bg!r}") from None + + if bold is not None: + bits.append(f"\033[{1 if bold else 22}m") + if dim is not None: + bits.append(f"\033[{2 if dim else 22}m") + if underline is not None: + bits.append(f"\033[{4 if underline else 24}m") + if overline is not None: + bits.append(f"\033[{53 if overline else 55}m") + if italic is not None: + bits.append(f"\033[{3 if italic else 23}m") + if blink is not None: + bits.append(f"\033[{5 if blink else 25}m") + if reverse is not None: + bits.append(f"\033[{7 if reverse else 27}m") + if strikethrough is not None: + bits.append(f"\033[{9 if strikethrough else 29}m") + bits.append(text) + if reset: + bits.append(_ansi_reset_all) + return "".join(bits) + + +def unstyle(text: str) -> str: + """Removes ANSI styling information from a string. Usually it's not + necessary to use this function as Click's echo function will + automatically remove styling if necessary. + + .. versionadded:: 2.0 + + :param text: the text to remove style information from. + """ + return strip_ansi(text) + + +def secho( + message: t.Optional[t.Any] = None, + file: t.Optional[t.IO[t.AnyStr]] = None, + nl: bool = True, + err: bool = False, + color: t.Optional[bool] = None, + **styles: t.Any, +) -> None: + """This function combines :func:`echo` and :func:`style` into one + call. As such the following two calls are the same:: + + click.secho('Hello World!', fg='green') + click.echo(click.style('Hello World!', fg='green')) + + All keyword arguments are forwarded to the underlying functions + depending on which one they go with. + + Non-string types will be converted to :class:`str`. However, + :class:`bytes` are passed directly to :meth:`echo` without applying + style. If you want to style bytes that represent text, call + :meth:`bytes.decode` first. + + .. versionchanged:: 8.0 + A non-string ``message`` is converted to a string. Bytes are + passed through without style applied. + + .. versionadded:: 2.0 + """ + if message is not None and not isinstance(message, (bytes, bytearray)): + message = style(message, **styles) + + return echo(message, file=file, nl=nl, err=err, color=color) + + +def edit( + text: t.Optional[t.AnyStr] = None, + editor: t.Optional[str] = None, + env: t.Optional[t.Mapping[str, str]] = None, + require_save: bool = True, + extension: str = ".txt", + filename: t.Optional[str] = None, +) -> t.Optional[t.AnyStr]: + r"""Edits the given text in the defined editor. If an editor is given + (should be the full path to the executable but the regular operating + system search path is used for finding the executable) it overrides + the detected editor. Optionally, some environment variables can be + used. If the editor is closed without changes, `None` is returned. In + case a file is edited directly the return value is always `None` and + `require_save` and `extension` are ignored. + + If the editor cannot be opened a :exc:`UsageError` is raised. + + Note for Windows: to simplify cross-platform usage, the newlines are + automatically converted from POSIX to Windows and vice versa. As such, + the message here will have ``\n`` as newline markers. + + :param text: the text to edit. + :param editor: optionally the editor to use. Defaults to automatic + detection. + :param env: environment variables to forward to the editor. + :param require_save: if this is true, then not saving in the editor + will make the return value become `None`. + :param extension: the extension to tell the editor about. This defaults + to `.txt` but changing this might change syntax + highlighting. + :param filename: if provided it will edit this file instead of the + provided text contents. It will not use a temporary + file as an indirection in that case. + """ + from ._termui_impl import Editor + + ed = Editor(editor=editor, env=env, require_save=require_save, extension=extension) + + if filename is None: + return ed.edit(text) + + ed.edit_file(filename) + return None + + +def launch(url: str, wait: bool = False, locate: bool = False) -> int: + """This function launches the given URL (or filename) in the default + viewer application for this file type. If this is an executable, it + might launch the executable in a new session. The return value is + the exit code of the launched application. Usually, ``0`` indicates + success. + + Examples:: + + click.launch('https://click.palletsprojects.com/') + click.launch('/my/downloaded/file', locate=True) + + .. versionadded:: 2.0 + + :param url: URL or filename of the thing to launch. + :param wait: Wait for the program to exit before returning. This + only works if the launched program blocks. In particular, + ``xdg-open`` on Linux does not block. + :param locate: if this is set to `True` then instead of launching the + application associated with the URL it will attempt to + launch a file manager with the file located. This + might have weird effects if the URL does not point to + the filesystem. + """ + from ._termui_impl import open_url + + return open_url(url, wait=wait, locate=locate) + + +# If this is provided, getchar() calls into this instead. This is used +# for unittesting purposes. +_getchar: t.Optional[t.Callable[[bool], str]] = None + + +def getchar(echo: bool = False) -> str: + """Fetches a single character from the terminal and returns it. This + will always return a unicode character and under certain rare + circumstances this might return more than one character. The + situations which more than one character is returned is when for + whatever reason multiple characters end up in the terminal buffer or + standard input was not actually a terminal. + + Note that this will always read from the terminal, even if something + is piped into the standard input. + + Note for Windows: in rare cases when typing non-ASCII characters, this + function might wait for a second character and then return both at once. + This is because certain Unicode characters look like special-key markers. + + .. versionadded:: 2.0 + + :param echo: if set to `True`, the character read will also show up on + the terminal. The default is to not show it. + """ + global _getchar + + if _getchar is None: + from ._termui_impl import getchar as f + + _getchar = f + + return _getchar(echo) + + +def raw_terminal() -> t.ContextManager[int]: + from ._termui_impl import raw_terminal as f + + return f() + + +def pause(info: t.Optional[str] = None, err: bool = False) -> None: + """This command stops execution and waits for the user to press any + key to continue. This is similar to the Windows batch "pause" + command. If the program is not run through a terminal, this command + will instead do nothing. + + .. versionadded:: 2.0 + + .. versionadded:: 4.0 + Added the `err` parameter. + + :param info: The message to print before pausing. Defaults to + ``"Press any key to continue..."``. + :param err: if set to message goes to ``stderr`` instead of + ``stdout``, the same as with echo. + """ + if not isatty(sys.stdin) or not isatty(sys.stdout): + return + + if info is None: + info = _("Press any key to continue...") + + try: + if info: + echo(info, nl=False, err=err) + try: + getchar() + except (KeyboardInterrupt, EOFError): + pass + finally: + if info: + echo(err=err) diff --git a/click/python/click/testing.py b/click/python/click/testing.py new file mode 100644 index 0000000..e0df0d2 --- /dev/null +++ b/click/python/click/testing.py @@ -0,0 +1,479 @@ +import contextlib +import io +import os +import shlex +import shutil +import sys +import tempfile +import typing as t +from types import TracebackType + +from . import formatting +from . import termui +from . import utils +from ._compat import _find_binary_reader + +if t.TYPE_CHECKING: + from .core import BaseCommand + + +class EchoingStdin: + def __init__(self, input: t.BinaryIO, output: t.BinaryIO) -> None: + self._input = input + self._output = output + self._paused = False + + def __getattr__(self, x: str) -> t.Any: + return getattr(self._input, x) + + def _echo(self, rv: bytes) -> bytes: + if not self._paused: + self._output.write(rv) + + return rv + + def read(self, n: int = -1) -> bytes: + return self._echo(self._input.read(n)) + + def read1(self, n: int = -1) -> bytes: + return self._echo(self._input.read1(n)) # type: ignore + + def readline(self, n: int = -1) -> bytes: + return self._echo(self._input.readline(n)) + + def readlines(self) -> t.List[bytes]: + return [self._echo(x) for x in self._input.readlines()] + + def __iter__(self) -> t.Iterator[bytes]: + return iter(self._echo(x) for x in self._input) + + def __repr__(self) -> str: + return repr(self._input) + + +@contextlib.contextmanager +def _pause_echo(stream: t.Optional[EchoingStdin]) -> t.Iterator[None]: + if stream is None: + yield + else: + stream._paused = True + yield + stream._paused = False + + +class _NamedTextIOWrapper(io.TextIOWrapper): + def __init__( + self, buffer: t.BinaryIO, name: str, mode: str, **kwargs: t.Any + ) -> None: + super().__init__(buffer, **kwargs) + self._name = name + self._mode = mode + + @property + def name(self) -> str: + return self._name + + @property + def mode(self) -> str: + return self._mode + + +def make_input_stream( + input: t.Optional[t.Union[str, bytes, t.IO[t.Any]]], charset: str +) -> t.BinaryIO: + # Is already an input stream. + if hasattr(input, "read"): + rv = _find_binary_reader(t.cast(t.IO[t.Any], input)) + + if rv is not None: + return rv + + raise TypeError("Could not find binary reader for input stream.") + + if input is None: + input = b"" + elif isinstance(input, str): + input = input.encode(charset) + + return io.BytesIO(input) + + +class Result: + """Holds the captured result of an invoked CLI script.""" + + def __init__( + self, + runner: "CliRunner", + stdout_bytes: bytes, + stderr_bytes: t.Optional[bytes], + return_value: t.Any, + exit_code: int, + exception: t.Optional[BaseException], + exc_info: t.Optional[ + t.Tuple[t.Type[BaseException], BaseException, TracebackType] + ] = None, + ): + #: The runner that created the result + self.runner = runner + #: The standard output as bytes. + self.stdout_bytes = stdout_bytes + #: The standard error as bytes, or None if not available + self.stderr_bytes = stderr_bytes + #: The value returned from the invoked command. + #: + #: .. versionadded:: 8.0 + self.return_value = return_value + #: The exit code as integer. + self.exit_code = exit_code + #: The exception that happened if one did. + self.exception = exception + #: The traceback + self.exc_info = exc_info + + @property + def output(self) -> str: + """The (standard) output as unicode string.""" + return self.stdout + + @property + def stdout(self) -> str: + """The standard output as unicode string.""" + return self.stdout_bytes.decode(self.runner.charset, "replace").replace( + "\r\n", "\n" + ) + + @property + def stderr(self) -> str: + """The standard error as unicode string.""" + if self.stderr_bytes is None: + raise ValueError("stderr not separately captured") + return self.stderr_bytes.decode(self.runner.charset, "replace").replace( + "\r\n", "\n" + ) + + def __repr__(self) -> str: + exc_str = repr(self.exception) if self.exception else "okay" + return f"<{type(self).__name__} {exc_str}>" + + +class CliRunner: + """The CLI runner provides functionality to invoke a Click command line + script for unittesting purposes in a isolated environment. This only + works in single-threaded systems without any concurrency as it changes the + global interpreter state. + + :param charset: the character set for the input and output data. + :param env: a dictionary with environment variables for overriding. + :param echo_stdin: if this is set to `True`, then reading from stdin writes + to stdout. This is useful for showing examples in + some circumstances. Note that regular prompts + will automatically echo the input. + :param mix_stderr: if this is set to `False`, then stdout and stderr are + preserved as independent streams. This is useful for + Unix-philosophy apps that have predictable stdout and + noisy stderr, such that each may be measured + independently + """ + + def __init__( + self, + charset: str = "utf-8", + env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, + echo_stdin: bool = False, + mix_stderr: bool = True, + ) -> None: + self.charset = charset + self.env: t.Mapping[str, t.Optional[str]] = env or {} + self.echo_stdin = echo_stdin + self.mix_stderr = mix_stderr + + def get_default_prog_name(self, cli: "BaseCommand") -> str: + """Given a command object it will return the default program name + for it. The default is the `name` attribute or ``"root"`` if not + set. + """ + return cli.name or "root" + + def make_env( + self, overrides: t.Optional[t.Mapping[str, t.Optional[str]]] = None + ) -> t.Mapping[str, t.Optional[str]]: + """Returns the environment overrides for invoking a script.""" + rv = dict(self.env) + if overrides: + rv.update(overrides) + return rv + + @contextlib.contextmanager + def isolation( + self, + input: t.Optional[t.Union[str, bytes, t.IO[t.Any]]] = None, + env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, + color: bool = False, + ) -> t.Iterator[t.Tuple[io.BytesIO, t.Optional[io.BytesIO]]]: + """A context manager that sets up the isolation for invoking of a + command line tool. This sets up stdin with the given input data + and `os.environ` with the overrides from the given dictionary. + This also rebinds some internals in Click to be mocked (like the + prompt functionality). + + This is automatically done in the :meth:`invoke` method. + + :param input: the input stream to put into sys.stdin. + :param env: the environment overrides as dictionary. + :param color: whether the output should contain color codes. The + application can still override this explicitly. + + .. versionchanged:: 8.0 + ``stderr`` is opened with ``errors="backslashreplace"`` + instead of the default ``"strict"``. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. + """ + bytes_input = make_input_stream(input, self.charset) + echo_input = None + + old_stdin = sys.stdin + old_stdout = sys.stdout + old_stderr = sys.stderr + old_forced_width = formatting.FORCED_WIDTH + formatting.FORCED_WIDTH = 80 + + env = self.make_env(env) + + bytes_output = io.BytesIO() + + if self.echo_stdin: + bytes_input = echo_input = t.cast( + t.BinaryIO, EchoingStdin(bytes_input, bytes_output) + ) + + sys.stdin = text_input = _NamedTextIOWrapper( + bytes_input, encoding=self.charset, name="", mode="r" + ) + + if self.echo_stdin: + # Force unbuffered reads, otherwise TextIOWrapper reads a + # large chunk which is echoed early. + text_input._CHUNK_SIZE = 1 # type: ignore + + sys.stdout = _NamedTextIOWrapper( + bytes_output, encoding=self.charset, name="", mode="w" + ) + + bytes_error = None + if self.mix_stderr: + sys.stderr = sys.stdout + else: + bytes_error = io.BytesIO() + sys.stderr = _NamedTextIOWrapper( + bytes_error, + encoding=self.charset, + name="", + mode="w", + errors="backslashreplace", + ) + + @_pause_echo(echo_input) # type: ignore + def visible_input(prompt: t.Optional[str] = None) -> str: + sys.stdout.write(prompt or "") + val = text_input.readline().rstrip("\r\n") + sys.stdout.write(f"{val}\n") + sys.stdout.flush() + return val + + @_pause_echo(echo_input) # type: ignore + def hidden_input(prompt: t.Optional[str] = None) -> str: + sys.stdout.write(f"{prompt or ''}\n") + sys.stdout.flush() + return text_input.readline().rstrip("\r\n") + + @_pause_echo(echo_input) # type: ignore + def _getchar(echo: bool) -> str: + char = sys.stdin.read(1) + + if echo: + sys.stdout.write(char) + + sys.stdout.flush() + return char + + default_color = color + + def should_strip_ansi( + stream: t.Optional[t.IO[t.Any]] = None, color: t.Optional[bool] = None + ) -> bool: + if color is None: + return not default_color + return not color + + old_visible_prompt_func = termui.visible_prompt_func + old_hidden_prompt_func = termui.hidden_prompt_func + old__getchar_func = termui._getchar + old_should_strip_ansi = utils.should_strip_ansi # type: ignore + termui.visible_prompt_func = visible_input + termui.hidden_prompt_func = hidden_input + termui._getchar = _getchar + utils.should_strip_ansi = should_strip_ansi # type: ignore + + old_env = {} + try: + for key, value in env.items(): + old_env[key] = os.environ.get(key) + if value is None: + try: + del os.environ[key] + except Exception: + pass + else: + os.environ[key] = value + yield (bytes_output, bytes_error) + finally: + for key, value in old_env.items(): + if value is None: + try: + del os.environ[key] + except Exception: + pass + else: + os.environ[key] = value + sys.stdout = old_stdout + sys.stderr = old_stderr + sys.stdin = old_stdin + termui.visible_prompt_func = old_visible_prompt_func + termui.hidden_prompt_func = old_hidden_prompt_func + termui._getchar = old__getchar_func + utils.should_strip_ansi = old_should_strip_ansi # type: ignore + formatting.FORCED_WIDTH = old_forced_width + + def invoke( + self, + cli: "BaseCommand", + args: t.Optional[t.Union[str, t.Sequence[str]]] = None, + input: t.Optional[t.Union[str, bytes, t.IO[t.Any]]] = None, + env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, + catch_exceptions: bool = True, + color: bool = False, + **extra: t.Any, + ) -> Result: + """Invokes a command in an isolated environment. The arguments are + forwarded directly to the command line script, the `extra` keyword + arguments are passed to the :meth:`~clickpkg.Command.main` function of + the command. + + This returns a :class:`Result` object. + + :param cli: the command to invoke + :param args: the arguments to invoke. It may be given as an iterable + or a string. When given as string it will be interpreted + as a Unix shell command. More details at + :func:`shlex.split`. + :param input: the input data for `sys.stdin`. + :param env: the environment overrides. + :param catch_exceptions: Whether to catch any other exceptions than + ``SystemExit``. + :param extra: the keyword arguments to pass to :meth:`main`. + :param color: whether the output should contain color codes. The + application can still override this explicitly. + + .. versionchanged:: 8.0 + The result object has the ``return_value`` attribute with + the value returned from the invoked command. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. + + .. versionchanged:: 3.0 + Added the ``catch_exceptions`` parameter. + + .. versionchanged:: 3.0 + The result object has the ``exc_info`` attribute with the + traceback if available. + """ + exc_info = None + with self.isolation(input=input, env=env, color=color) as outstreams: + return_value = None + exception: t.Optional[BaseException] = None + exit_code = 0 + + if isinstance(args, str): + args = shlex.split(args) + + try: + prog_name = extra.pop("prog_name") + except KeyError: + prog_name = self.get_default_prog_name(cli) + + try: + return_value = cli.main(args=args or (), prog_name=prog_name, **extra) + except SystemExit as e: + exc_info = sys.exc_info() + e_code = t.cast(t.Optional[t.Union[int, t.Any]], e.code) + + if e_code is None: + e_code = 0 + + if e_code != 0: + exception = e + + if not isinstance(e_code, int): + sys.stdout.write(str(e_code)) + sys.stdout.write("\n") + e_code = 1 + + exit_code = e_code + + except Exception as e: + if not catch_exceptions: + raise + exception = e + exit_code = 1 + exc_info = sys.exc_info() + finally: + sys.stdout.flush() + stdout = outstreams[0].getvalue() + if self.mix_stderr: + stderr = None + else: + stderr = outstreams[1].getvalue() # type: ignore + + return Result( + runner=self, + stdout_bytes=stdout, + stderr_bytes=stderr, + return_value=return_value, + exit_code=exit_code, + exception=exception, + exc_info=exc_info, # type: ignore + ) + + @contextlib.contextmanager + def isolated_filesystem( + self, temp_dir: t.Optional[t.Union[str, "os.PathLike[str]"]] = None + ) -> t.Iterator[str]: + """A context manager that creates a temporary directory and + changes the current working directory to it. This isolates tests + that affect the contents of the CWD to prevent them from + interfering with each other. + + :param temp_dir: Create the temporary directory under this + directory. If given, the created directory is not removed + when exiting. + + .. versionchanged:: 8.0 + Added the ``temp_dir`` parameter. + """ + cwd = os.getcwd() + dt = tempfile.mkdtemp(dir=temp_dir) + os.chdir(dt) + + try: + yield dt + finally: + os.chdir(cwd) + + if temp_dir is None: + try: + shutil.rmtree(dt) + except OSError: # noqa: B014 + pass diff --git a/click/python/click/types.py b/click/python/click/types.py new file mode 100644 index 0000000..2b1d179 --- /dev/null +++ b/click/python/click/types.py @@ -0,0 +1,1089 @@ +import os +import stat +import sys +import typing as t +from datetime import datetime +from gettext import gettext as _ +from gettext import ngettext + +from ._compat import _get_argv_encoding +from ._compat import open_stream +from .exceptions import BadParameter +from .utils import format_filename +from .utils import LazyFile +from .utils import safecall + +if t.TYPE_CHECKING: + import typing_extensions as te + from .core import Context + from .core import Parameter + from .shell_completion import CompletionItem + + +class ParamType: + """Represents the type of a parameter. Validates and converts values + from the command line or Python into the correct type. + + To implement a custom type, subclass and implement at least the + following: + + - The :attr:`name` class attribute must be set. + - Calling an instance of the type with ``None`` must return + ``None``. This is already implemented by default. + - :meth:`convert` must convert string values to the correct type. + - :meth:`convert` must accept values that are already the correct + type. + - It must be able to convert a value if the ``ctx`` and ``param`` + arguments are ``None``. This can occur when converting prompt + input. + """ + + is_composite: t.ClassVar[bool] = False + arity: t.ClassVar[int] = 1 + + #: the descriptive name of this type + name: str + + #: if a list of this type is expected and the value is pulled from a + #: string environment variable, this is what splits it up. `None` + #: means any whitespace. For all parameters the general rule is that + #: whitespace splits them up. The exception are paths and files which + #: are split by ``os.path.pathsep`` by default (":" on Unix and ";" on + #: Windows). + envvar_list_splitter: t.ClassVar[t.Optional[str]] = None + + def to_info_dict(self) -> t.Dict[str, t.Any]: + """Gather information that could be useful for a tool generating + user-facing documentation. + + Use :meth:`click.Context.to_info_dict` to traverse the entire + CLI structure. + + .. versionadded:: 8.0 + """ + # The class name without the "ParamType" suffix. + param_type = type(self).__name__.partition("ParamType")[0] + param_type = param_type.partition("ParameterType")[0] + + # Custom subclasses might not remember to set a name. + if hasattr(self, "name"): + name = self.name + else: + name = param_type + + return {"param_type": param_type, "name": name} + + def __call__( + self, + value: t.Any, + param: t.Optional["Parameter"] = None, + ctx: t.Optional["Context"] = None, + ) -> t.Any: + if value is not None: + return self.convert(value, param, ctx) + + def get_metavar(self, param: "Parameter") -> t.Optional[str]: + """Returns the metavar default for this param if it provides one.""" + + def get_missing_message(self, param: "Parameter") -> t.Optional[str]: + """Optionally might return extra information about a missing + parameter. + + .. versionadded:: 2.0 + """ + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + """Convert the value to the correct type. This is not called if + the value is ``None`` (the missing value). + + This must accept string values from the command line, as well as + values that are already the correct type. It may also convert + other compatible types. + + The ``param`` and ``ctx`` arguments may be ``None`` in certain + situations, such as when converting prompt input. + + If the value cannot be converted, call :meth:`fail` with a + descriptive message. + + :param value: The value to convert. + :param param: The parameter that is using this type to convert + its value. May be ``None``. + :param ctx: The current context that arrived at this value. May + be ``None``. + """ + return value + + def split_envvar_value(self, rv: str) -> t.Sequence[str]: + """Given a value from an environment variable this splits it up + into small chunks depending on the defined envvar list splitter. + + If the splitter is set to `None`, which means that whitespace splits, + then leading and trailing whitespace is ignored. Otherwise, leading + and trailing splitters usually lead to empty items being included. + """ + return (rv or "").split(self.envvar_list_splitter) + + def fail( + self, + message: str, + param: t.Optional["Parameter"] = None, + ctx: t.Optional["Context"] = None, + ) -> "t.NoReturn": + """Helper method to fail with an invalid value message.""" + raise BadParameter(message, ctx=ctx, param=param) + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Return a list of + :class:`~click.shell_completion.CompletionItem` objects for the + incomplete value. Most types do not provide completions, but + some do, and this allows custom types to provide custom + completions as well. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + return [] + + +class CompositeParamType(ParamType): + is_composite = True + + @property + def arity(self) -> int: # type: ignore + raise NotImplementedError() + + +class FuncParamType(ParamType): + def __init__(self, func: t.Callable[[t.Any], t.Any]) -> None: + self.name: str = func.__name__ + self.func = func + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["func"] = self.func + return info_dict + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + try: + return self.func(value) + except ValueError: + try: + value = str(value) + except UnicodeError: + value = value.decode("utf-8", "replace") + + self.fail(value, param, ctx) + + +class UnprocessedParamType(ParamType): + name = "text" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + return value + + def __repr__(self) -> str: + return "UNPROCESSED" + + +class StringParamType(ParamType): + name = "text" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + if isinstance(value, bytes): + enc = _get_argv_encoding() + try: + value = value.decode(enc) + except UnicodeError: + fs_enc = sys.getfilesystemencoding() + if fs_enc != enc: + try: + value = value.decode(fs_enc) + except UnicodeError: + value = value.decode("utf-8", "replace") + else: + value = value.decode("utf-8", "replace") + return value + return str(value) + + def __repr__(self) -> str: + return "STRING" + + +class Choice(ParamType): + """The choice type allows a value to be checked against a fixed set + of supported values. All of these values have to be strings. + + You should only pass a list or tuple of choices. Other iterables + (like generators) may lead to surprising results. + + The resulting value will always be one of the originally passed choices + regardless of ``case_sensitive`` or any ``ctx.token_normalize_func`` + being specified. + + See :ref:`choice-opts` for an example. + + :param case_sensitive: Set to false to make choices case + insensitive. Defaults to true. + """ + + name = "choice" + + def __init__(self, choices: t.Sequence[str], case_sensitive: bool = True) -> None: + self.choices = choices + self.case_sensitive = case_sensitive + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["choices"] = self.choices + info_dict["case_sensitive"] = self.case_sensitive + return info_dict + + def get_metavar(self, param: "Parameter") -> str: + choices_str = "|".join(self.choices) + + # Use curly braces to indicate a required argument. + if param.required and param.param_type_name == "argument": + return f"{{{choices_str}}}" + + # Use square braces to indicate an option or optional argument. + return f"[{choices_str}]" + + def get_missing_message(self, param: "Parameter") -> str: + return _("Choose from:\n\t{choices}").format(choices=",\n\t".join(self.choices)) + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + # Match through normalization and case sensitivity + # first do token_normalize_func, then lowercase + # preserve original `value` to produce an accurate message in + # `self.fail` + normed_value = value + normed_choices = {choice: choice for choice in self.choices} + + if ctx is not None and ctx.token_normalize_func is not None: + normed_value = ctx.token_normalize_func(value) + normed_choices = { + ctx.token_normalize_func(normed_choice): original + for normed_choice, original in normed_choices.items() + } + + if not self.case_sensitive: + normed_value = normed_value.casefold() + normed_choices = { + normed_choice.casefold(): original + for normed_choice, original in normed_choices.items() + } + + if normed_value in normed_choices: + return normed_choices[normed_value] + + choices_str = ", ".join(map(repr, self.choices)) + self.fail( + ngettext( + "{value!r} is not {choice}.", + "{value!r} is not one of {choices}.", + len(self.choices), + ).format(value=value, choice=choices_str, choices=choices_str), + param, + ctx, + ) + + def __repr__(self) -> str: + return f"Choice({list(self.choices)})" + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Complete choices that start with the incomplete value. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + str_choices = map(str, self.choices) + + if self.case_sensitive: + matched = (c for c in str_choices if c.startswith(incomplete)) + else: + incomplete = incomplete.lower() + matched = (c for c in str_choices if c.lower().startswith(incomplete)) + + return [CompletionItem(c) for c in matched] + + +class DateTime(ParamType): + """The DateTime type converts date strings into `datetime` objects. + + The format strings which are checked are configurable, but default to some + common (non-timezone aware) ISO 8601 formats. + + When specifying *DateTime* formats, you should only pass a list or a tuple. + Other iterables, like generators, may lead to surprising results. + + The format strings are processed using ``datetime.strptime``, and this + consequently defines the format strings which are allowed. + + Parsing is tried using each format, in order, and the first format which + parses successfully is used. + + :param formats: A list or tuple of date format strings, in the order in + which they should be tried. Defaults to + ``'%Y-%m-%d'``, ``'%Y-%m-%dT%H:%M:%S'``, + ``'%Y-%m-%d %H:%M:%S'``. + """ + + name = "datetime" + + def __init__(self, formats: t.Optional[t.Sequence[str]] = None): + self.formats: t.Sequence[str] = formats or [ + "%Y-%m-%d", + "%Y-%m-%dT%H:%M:%S", + "%Y-%m-%d %H:%M:%S", + ] + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["formats"] = self.formats + return info_dict + + def get_metavar(self, param: "Parameter") -> str: + return f"[{'|'.join(self.formats)}]" + + def _try_to_convert_date(self, value: t.Any, format: str) -> t.Optional[datetime]: + try: + return datetime.strptime(value, format) + except ValueError: + return None + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + if isinstance(value, datetime): + return value + + for format in self.formats: + converted = self._try_to_convert_date(value, format) + + if converted is not None: + return converted + + formats_str = ", ".join(map(repr, self.formats)) + self.fail( + ngettext( + "{value!r} does not match the format {format}.", + "{value!r} does not match the formats {formats}.", + len(self.formats), + ).format(value=value, format=formats_str, formats=formats_str), + param, + ctx, + ) + + def __repr__(self) -> str: + return "DateTime" + + +class _NumberParamTypeBase(ParamType): + _number_class: t.ClassVar[t.Type[t.Any]] + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + try: + return self._number_class(value) + except ValueError: + self.fail( + _("{value!r} is not a valid {number_type}.").format( + value=value, number_type=self.name + ), + param, + ctx, + ) + + +class _NumberRangeBase(_NumberParamTypeBase): + def __init__( + self, + min: t.Optional[float] = None, + max: t.Optional[float] = None, + min_open: bool = False, + max_open: bool = False, + clamp: bool = False, + ) -> None: + self.min = min + self.max = max + self.min_open = min_open + self.max_open = max_open + self.clamp = clamp + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update( + min=self.min, + max=self.max, + min_open=self.min_open, + max_open=self.max_open, + clamp=self.clamp, + ) + return info_dict + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + import operator + + rv = super().convert(value, param, ctx) + lt_min: bool = self.min is not None and ( + operator.le if self.min_open else operator.lt + )(rv, self.min) + gt_max: bool = self.max is not None and ( + operator.ge if self.max_open else operator.gt + )(rv, self.max) + + if self.clamp: + if lt_min: + return self._clamp(self.min, 1, self.min_open) # type: ignore + + if gt_max: + return self._clamp(self.max, -1, self.max_open) # type: ignore + + if lt_min or gt_max: + self.fail( + _("{value} is not in the range {range}.").format( + value=rv, range=self._describe_range() + ), + param, + ctx, + ) + + return rv + + def _clamp(self, bound: float, dir: "te.Literal[1, -1]", open: bool) -> float: + """Find the valid value to clamp to bound in the given + direction. + + :param bound: The boundary value. + :param dir: 1 or -1 indicating the direction to move. + :param open: If true, the range does not include the bound. + """ + raise NotImplementedError + + def _describe_range(self) -> str: + """Describe the range for use in help text.""" + if self.min is None: + op = "<" if self.max_open else "<=" + return f"x{op}{self.max}" + + if self.max is None: + op = ">" if self.min_open else ">=" + return f"x{op}{self.min}" + + lop = "<" if self.min_open else "<=" + rop = "<" if self.max_open else "<=" + return f"{self.min}{lop}x{rop}{self.max}" + + def __repr__(self) -> str: + clamp = " clamped" if self.clamp else "" + return f"<{type(self).__name__} {self._describe_range()}{clamp}>" + + +class IntParamType(_NumberParamTypeBase): + name = "integer" + _number_class = int + + def __repr__(self) -> str: + return "INT" + + +class IntRange(_NumberRangeBase, IntParamType): + """Restrict an :data:`click.INT` value to a range of accepted + values. See :ref:`ranges`. + + If ``min`` or ``max`` are not passed, any value is accepted in that + direction. If ``min_open`` or ``max_open`` are enabled, the + corresponding boundary is not included in the range. + + If ``clamp`` is enabled, a value outside the range is clamped to the + boundary instead of failing. + + .. versionchanged:: 8.0 + Added the ``min_open`` and ``max_open`` parameters. + """ + + name = "integer range" + + def _clamp( # type: ignore + self, bound: int, dir: "te.Literal[1, -1]", open: bool + ) -> int: + if not open: + return bound + + return bound + dir + + +class FloatParamType(_NumberParamTypeBase): + name = "float" + _number_class = float + + def __repr__(self) -> str: + return "FLOAT" + + +class FloatRange(_NumberRangeBase, FloatParamType): + """Restrict a :data:`click.FLOAT` value to a range of accepted + values. See :ref:`ranges`. + + If ``min`` or ``max`` are not passed, any value is accepted in that + direction. If ``min_open`` or ``max_open`` are enabled, the + corresponding boundary is not included in the range. + + If ``clamp`` is enabled, a value outside the range is clamped to the + boundary instead of failing. This is not supported if either + boundary is marked ``open``. + + .. versionchanged:: 8.0 + Added the ``min_open`` and ``max_open`` parameters. + """ + + name = "float range" + + def __init__( + self, + min: t.Optional[float] = None, + max: t.Optional[float] = None, + min_open: bool = False, + max_open: bool = False, + clamp: bool = False, + ) -> None: + super().__init__( + min=min, max=max, min_open=min_open, max_open=max_open, clamp=clamp + ) + + if (min_open or max_open) and clamp: + raise TypeError("Clamping is not supported for open bounds.") + + def _clamp(self, bound: float, dir: "te.Literal[1, -1]", open: bool) -> float: + if not open: + return bound + + # Could use Python 3.9's math.nextafter here, but clamping an + # open float range doesn't seem to be particularly useful. It's + # left up to the user to write a callback to do it if needed. + raise RuntimeError("Clamping is not supported for open bounds.") + + +class BoolParamType(ParamType): + name = "boolean" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + if value in {False, True}: + return bool(value) + + norm = value.strip().lower() + + if norm in {"1", "true", "t", "yes", "y", "on"}: + return True + + if norm in {"0", "false", "f", "no", "n", "off"}: + return False + + self.fail( + _("{value!r} is not a valid boolean.").format(value=value), param, ctx + ) + + def __repr__(self) -> str: + return "BOOL" + + +class UUIDParameterType(ParamType): + name = "uuid" + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + import uuid + + if isinstance(value, uuid.UUID): + return value + + value = value.strip() + + try: + return uuid.UUID(value) + except ValueError: + self.fail( + _("{value!r} is not a valid UUID.").format(value=value), param, ctx + ) + + def __repr__(self) -> str: + return "UUID" + + +class File(ParamType): + """Declares a parameter to be a file for reading or writing. The file + is automatically closed once the context tears down (after the command + finished working). + + Files can be opened for reading or writing. The special value ``-`` + indicates stdin or stdout depending on the mode. + + By default, the file is opened for reading text data, but it can also be + opened in binary mode or for writing. The encoding parameter can be used + to force a specific encoding. + + The `lazy` flag controls if the file should be opened immediately or upon + first IO. The default is to be non-lazy for standard input and output + streams as well as files opened for reading, `lazy` otherwise. When opening a + file lazily for reading, it is still opened temporarily for validation, but + will not be held open until first IO. lazy is mainly useful when opening + for writing to avoid creating the file until it is needed. + + Starting with Click 2.0, files can also be opened atomically in which + case all writes go into a separate file in the same folder and upon + completion the file will be moved over to the original location. This + is useful if a file regularly read by other users is modified. + + See :ref:`file-args` for more information. + """ + + name = "filename" + envvar_list_splitter: t.ClassVar[str] = os.path.pathsep + + def __init__( + self, + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + lazy: t.Optional[bool] = None, + atomic: bool = False, + ) -> None: + self.mode = mode + self.encoding = encoding + self.errors = errors + self.lazy = lazy + self.atomic = atomic + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update(mode=self.mode, encoding=self.encoding) + return info_dict + + def resolve_lazy_flag(self, value: "t.Union[str, os.PathLike[str]]") -> bool: + if self.lazy is not None: + return self.lazy + if os.fspath(value) == "-": + return False + elif "w" in self.mode: + return True + return False + + def convert( + self, + value: t.Union[str, "os.PathLike[str]", t.IO[t.Any]], + param: t.Optional["Parameter"], + ctx: t.Optional["Context"], + ) -> t.IO[t.Any]: + if _is_file_like(value): + return value + + value = t.cast("t.Union[str, os.PathLike[str]]", value) + + try: + lazy = self.resolve_lazy_flag(value) + + if lazy: + lf = LazyFile( + value, self.mode, self.encoding, self.errors, atomic=self.atomic + ) + + if ctx is not None: + ctx.call_on_close(lf.close_intelligently) + + return t.cast(t.IO[t.Any], lf) + + f, should_close = open_stream( + value, self.mode, self.encoding, self.errors, atomic=self.atomic + ) + + # If a context is provided, we automatically close the file + # at the end of the context execution (or flush out). If a + # context does not exist, it's the caller's responsibility to + # properly close the file. This for instance happens when the + # type is used with prompts. + if ctx is not None: + if should_close: + ctx.call_on_close(safecall(f.close)) + else: + ctx.call_on_close(safecall(f.flush)) + + return f + except OSError as e: # noqa: B014 + self.fail(f"'{format_filename(value)}': {e.strerror}", param, ctx) + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Return a special completion marker that tells the completion + system to use the shell to provide file path completions. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + return [CompletionItem(incomplete, type="file")] + + +def _is_file_like(value: t.Any) -> "te.TypeGuard[t.IO[t.Any]]": + return hasattr(value, "read") or hasattr(value, "write") + + +class Path(ParamType): + """The ``Path`` type is similar to the :class:`File` type, but + returns the filename instead of an open file. Various checks can be + enabled to validate the type of file and permissions. + + :param exists: The file or directory needs to exist for the value to + be valid. If this is not set to ``True``, and the file does not + exist, then all further checks are silently skipped. + :param file_okay: Allow a file as a value. + :param dir_okay: Allow a directory as a value. + :param readable: if true, a readable check is performed. + :param writable: if true, a writable check is performed. + :param executable: if true, an executable check is performed. + :param resolve_path: Make the value absolute and resolve any + symlinks. A ``~`` is not expanded, as this is supposed to be + done by the shell only. + :param allow_dash: Allow a single dash as a value, which indicates + a standard stream (but does not open it). Use + :func:`~click.open_file` to handle opening this value. + :param path_type: Convert the incoming path value to this type. If + ``None``, keep Python's default, which is ``str``. Useful to + convert to :class:`pathlib.Path`. + + .. versionchanged:: 8.1 + Added the ``executable`` parameter. + + .. versionchanged:: 8.0 + Allow passing ``path_type=pathlib.Path``. + + .. versionchanged:: 6.0 + Added the ``allow_dash`` parameter. + """ + + envvar_list_splitter: t.ClassVar[str] = os.path.pathsep + + def __init__( + self, + exists: bool = False, + file_okay: bool = True, + dir_okay: bool = True, + writable: bool = False, + readable: bool = True, + resolve_path: bool = False, + allow_dash: bool = False, + path_type: t.Optional[t.Type[t.Any]] = None, + executable: bool = False, + ): + self.exists = exists + self.file_okay = file_okay + self.dir_okay = dir_okay + self.readable = readable + self.writable = writable + self.executable = executable + self.resolve_path = resolve_path + self.allow_dash = allow_dash + self.type = path_type + + if self.file_okay and not self.dir_okay: + self.name: str = _("file") + elif self.dir_okay and not self.file_okay: + self.name = _("directory") + else: + self.name = _("path") + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict.update( + exists=self.exists, + file_okay=self.file_okay, + dir_okay=self.dir_okay, + writable=self.writable, + readable=self.readable, + allow_dash=self.allow_dash, + ) + return info_dict + + def coerce_path_result( + self, value: "t.Union[str, os.PathLike[str]]" + ) -> "t.Union[str, bytes, os.PathLike[str]]": + if self.type is not None and not isinstance(value, self.type): + if self.type is str: + return os.fsdecode(value) + elif self.type is bytes: + return os.fsencode(value) + else: + return t.cast("os.PathLike[str]", self.type(value)) + + return value + + def convert( + self, + value: "t.Union[str, os.PathLike[str]]", + param: t.Optional["Parameter"], + ctx: t.Optional["Context"], + ) -> "t.Union[str, bytes, os.PathLike[str]]": + rv = value + + is_dash = self.file_okay and self.allow_dash and rv in (b"-", "-") + + if not is_dash: + if self.resolve_path: + # os.path.realpath doesn't resolve symlinks on Windows + # until Python 3.8. Use pathlib for now. + import pathlib + + rv = os.fsdecode(pathlib.Path(rv).resolve()) + + try: + st = os.stat(rv) + except OSError: + if not self.exists: + return self.coerce_path_result(rv) + self.fail( + _("{name} {filename!r} does not exist.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if not self.file_okay and stat.S_ISREG(st.st_mode): + self.fail( + _("{name} {filename!r} is a file.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + if not self.dir_okay and stat.S_ISDIR(st.st_mode): + self.fail( + _("{name} '{filename}' is a directory.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if self.readable and not os.access(rv, os.R_OK): + self.fail( + _("{name} {filename!r} is not readable.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if self.writable and not os.access(rv, os.W_OK): + self.fail( + _("{name} {filename!r} is not writable.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + if self.executable and not os.access(value, os.X_OK): + self.fail( + _("{name} {filename!r} is not executable.").format( + name=self.name.title(), filename=format_filename(value) + ), + param, + ctx, + ) + + return self.coerce_path_result(rv) + + def shell_complete( + self, ctx: "Context", param: "Parameter", incomplete: str + ) -> t.List["CompletionItem"]: + """Return a special completion marker that tells the completion + system to use the shell to provide path completions for only + directories or any paths. + + :param ctx: Invocation context for this command. + :param param: The parameter that is requesting completion. + :param incomplete: Value being completed. May be empty. + + .. versionadded:: 8.0 + """ + from click.shell_completion import CompletionItem + + type = "dir" if self.dir_okay and not self.file_okay else "file" + return [CompletionItem(incomplete, type=type)] + + +class Tuple(CompositeParamType): + """The default behavior of Click is to apply a type on a value directly. + This works well in most cases, except for when `nargs` is set to a fixed + count and different types should be used for different items. In this + case the :class:`Tuple` type can be used. This type can only be used + if `nargs` is set to a fixed number. + + For more information see :ref:`tuple-type`. + + This can be selected by using a Python tuple literal as a type. + + :param types: a list of types that should be used for the tuple items. + """ + + def __init__(self, types: t.Sequence[t.Union[t.Type[t.Any], ParamType]]) -> None: + self.types: t.Sequence[ParamType] = [convert_type(ty) for ty in types] + + def to_info_dict(self) -> t.Dict[str, t.Any]: + info_dict = super().to_info_dict() + info_dict["types"] = [t.to_info_dict() for t in self.types] + return info_dict + + @property + def name(self) -> str: # type: ignore + return f"<{' '.join(ty.name for ty in self.types)}>" + + @property + def arity(self) -> int: # type: ignore + return len(self.types) + + def convert( + self, value: t.Any, param: t.Optional["Parameter"], ctx: t.Optional["Context"] + ) -> t.Any: + len_type = len(self.types) + len_value = len(value) + + if len_value != len_type: + self.fail( + ngettext( + "{len_type} values are required, but {len_value} was given.", + "{len_type} values are required, but {len_value} were given.", + len_value, + ).format(len_type=len_type, len_value=len_value), + param=param, + ctx=ctx, + ) + + return tuple(ty(x, param, ctx) for ty, x in zip(self.types, value)) + + +def convert_type(ty: t.Optional[t.Any], default: t.Optional[t.Any] = None) -> ParamType: + """Find the most appropriate :class:`ParamType` for the given Python + type. If the type isn't provided, it can be inferred from a default + value. + """ + guessed_type = False + + if ty is None and default is not None: + if isinstance(default, (tuple, list)): + # If the default is empty, ty will remain None and will + # return STRING. + if default: + item = default[0] + + # A tuple of tuples needs to detect the inner types. + # Can't call convert recursively because that would + # incorrectly unwind the tuple to a single type. + if isinstance(item, (tuple, list)): + ty = tuple(map(type, item)) + else: + ty = type(item) + else: + ty = type(default) + + guessed_type = True + + if isinstance(ty, tuple): + return Tuple(ty) + + if isinstance(ty, ParamType): + return ty + + if ty is str or ty is None: + return STRING + + if ty is int: + return INT + + if ty is float: + return FLOAT + + if ty is bool: + return BOOL + + if guessed_type: + return STRING + + if __debug__: + try: + if issubclass(ty, ParamType): + raise AssertionError( + f"Attempted to use an uninstantiated parameter type ({ty})." + ) + except TypeError: + # ty is an instance (correct), so issubclass fails. + pass + + return FuncParamType(ty) + + +#: A dummy parameter type that just does nothing. From a user's +#: perspective this appears to just be the same as `STRING` but +#: internally no string conversion takes place if the input was bytes. +#: This is usually useful when working with file paths as they can +#: appear in bytes and unicode. +#: +#: For path related uses the :class:`Path` type is a better choice but +#: there are situations where an unprocessed type is useful which is why +#: it is is provided. +#: +#: .. versionadded:: 4.0 +UNPROCESSED = UnprocessedParamType() + +#: A unicode string parameter type which is the implicit default. This +#: can also be selected by using ``str`` as type. +STRING = StringParamType() + +#: An integer parameter. This can also be selected by using ``int`` as +#: type. +INT = IntParamType() + +#: A floating point value parameter. This can also be selected by using +#: ``float`` as type. +FLOAT = FloatParamType() + +#: A boolean parameter. This is the default for boolean flags. This can +#: also be selected by using ``bool`` as a type. +BOOL = BoolParamType() + +#: A UUID parameter. +UUID = UUIDParameterType() diff --git a/click/python/click/utils.py b/click/python/click/utils.py new file mode 100644 index 0000000..d536434 --- /dev/null +++ b/click/python/click/utils.py @@ -0,0 +1,624 @@ +import os +import re +import sys +import typing as t +from functools import update_wrapper +from types import ModuleType +from types import TracebackType + +from ._compat import _default_text_stderr +from ._compat import _default_text_stdout +from ._compat import _find_binary_writer +from ._compat import auto_wrap_for_ansi +from ._compat import binary_streams +from ._compat import open_stream +from ._compat import should_strip_ansi +from ._compat import strip_ansi +from ._compat import text_streams +from ._compat import WIN +from .globals import resolve_color_default + +if t.TYPE_CHECKING: + import typing_extensions as te + + P = te.ParamSpec("P") + +R = t.TypeVar("R") + + +def _posixify(name: str) -> str: + return "-".join(name.split()).lower() + + +def safecall(func: "t.Callable[P, R]") -> "t.Callable[P, t.Optional[R]]": + """Wraps a function so that it swallows exceptions.""" + + def wrapper(*args: "P.args", **kwargs: "P.kwargs") -> t.Optional[R]: + try: + return func(*args, **kwargs) + except Exception: + pass + return None + + return update_wrapper(wrapper, func) + + +def make_str(value: t.Any) -> str: + """Converts a value into a valid string.""" + if isinstance(value, bytes): + try: + return value.decode(sys.getfilesystemencoding()) + except UnicodeError: + return value.decode("utf-8", "replace") + return str(value) + + +def make_default_short_help(help: str, max_length: int = 45) -> str: + """Returns a condensed version of help string.""" + # Consider only the first paragraph. + paragraph_end = help.find("\n\n") + + if paragraph_end != -1: + help = help[:paragraph_end] + + # Collapse newlines, tabs, and spaces. + words = help.split() + + if not words: + return "" + + # The first paragraph started with a "no rewrap" marker, ignore it. + if words[0] == "\b": + words = words[1:] + + total_length = 0 + last_index = len(words) - 1 + + for i, word in enumerate(words): + total_length += len(word) + (i > 0) + + if total_length > max_length: # too long, truncate + break + + if word[-1] == ".": # sentence end, truncate without "..." + return " ".join(words[: i + 1]) + + if total_length == max_length and i != last_index: + break # not at sentence end, truncate with "..." + else: + return " ".join(words) # no truncation needed + + # Account for the length of the suffix. + total_length += len("...") + + # remove words until the length is short enough + while i > 0: + total_length -= len(words[i]) + (i > 0) + + if total_length <= max_length: + break + + i -= 1 + + return " ".join(words[:i]) + "..." + + +class LazyFile: + """A lazy file works like a regular file but it does not fully open + the file but it does perform some basic checks early to see if the + filename parameter does make sense. This is useful for safely opening + files for writing. + """ + + def __init__( + self, + filename: t.Union[str, "os.PathLike[str]"], + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + atomic: bool = False, + ): + self.name: str = os.fspath(filename) + self.mode = mode + self.encoding = encoding + self.errors = errors + self.atomic = atomic + self._f: t.Optional[t.IO[t.Any]] + self.should_close: bool + + if self.name == "-": + self._f, self.should_close = open_stream(filename, mode, encoding, errors) + else: + if "r" in mode: + # Open and close the file in case we're opening it for + # reading so that we can catch at least some errors in + # some cases early. + open(filename, mode).close() + self._f = None + self.should_close = True + + def __getattr__(self, name: str) -> t.Any: + return getattr(self.open(), name) + + def __repr__(self) -> str: + if self._f is not None: + return repr(self._f) + return f"" + + def open(self) -> t.IO[t.Any]: + """Opens the file if it's not yet open. This call might fail with + a :exc:`FileError`. Not handling this error will produce an error + that Click shows. + """ + if self._f is not None: + return self._f + try: + rv, self.should_close = open_stream( + self.name, self.mode, self.encoding, self.errors, atomic=self.atomic + ) + except OSError as e: # noqa: E402 + from .exceptions import FileError + + raise FileError(self.name, hint=e.strerror) from e + self._f = rv + return rv + + def close(self) -> None: + """Closes the underlying file, no matter what.""" + if self._f is not None: + self._f.close() + + def close_intelligently(self) -> None: + """This function only closes the file if it was opened by the lazy + file wrapper. For instance this will never close stdin. + """ + if self.should_close: + self.close() + + def __enter__(self) -> "LazyFile": + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + self.close_intelligently() + + def __iter__(self) -> t.Iterator[t.AnyStr]: + self.open() + return iter(self._f) # type: ignore + + +class KeepOpenFile: + def __init__(self, file: t.IO[t.Any]) -> None: + self._file: t.IO[t.Any] = file + + def __getattr__(self, name: str) -> t.Any: + return getattr(self._file, name) + + def __enter__(self) -> "KeepOpenFile": + return self + + def __exit__( + self, + exc_type: t.Optional[t.Type[BaseException]], + exc_value: t.Optional[BaseException], + tb: t.Optional[TracebackType], + ) -> None: + pass + + def __repr__(self) -> str: + return repr(self._file) + + def __iter__(self) -> t.Iterator[t.AnyStr]: + return iter(self._file) + + +def echo( + message: t.Optional[t.Any] = None, + file: t.Optional[t.IO[t.Any]] = None, + nl: bool = True, + err: bool = False, + color: t.Optional[bool] = None, +) -> None: + """Print a message and newline to stdout or a file. This should be + used instead of :func:`print` because it provides better support + for different data, files, and environments. + + Compared to :func:`print`, this does the following: + + - Ensures that the output encoding is not misconfigured on Linux. + - Supports Unicode in the Windows console. + - Supports writing to binary outputs, and supports writing bytes + to text outputs. + - Supports colors and styles on Windows. + - Removes ANSI color and style codes if the output does not look + like an interactive terminal. + - Always flushes the output. + + :param message: The string or bytes to output. Other objects are + converted to strings. + :param file: The file to write to. Defaults to ``stdout``. + :param err: Write to ``stderr`` instead of ``stdout``. + :param nl: Print a newline after the message. Enabled by default. + :param color: Force showing or hiding colors and other styles. By + default Click will remove color if the output does not look like + an interactive terminal. + + .. versionchanged:: 6.0 + Support Unicode output on the Windows console. Click does not + modify ``sys.stdout``, so ``sys.stdout.write()`` and ``print()`` + will still not support Unicode. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. + + .. versionadded:: 3.0 + Added the ``err`` parameter. + + .. versionchanged:: 2.0 + Support colors on Windows if colorama is installed. + """ + if file is None: + if err: + file = _default_text_stderr() + else: + file = _default_text_stdout() + + # There are no standard streams attached to write to. For example, + # pythonw on Windows. + if file is None: + return + + # Convert non bytes/text into the native string type. + if message is not None and not isinstance(message, (str, bytes, bytearray)): + out: t.Optional[t.Union[str, bytes]] = str(message) + else: + out = message + + if nl: + out = out or "" + if isinstance(out, str): + out += "\n" + else: + out += b"\n" + + if not out: + file.flush() + return + + # If there is a message and the value looks like bytes, we manually + # need to find the binary stream and write the message in there. + # This is done separately so that most stream types will work as you + # would expect. Eg: you can write to StringIO for other cases. + if isinstance(out, (bytes, bytearray)): + binary_file = _find_binary_writer(file) + + if binary_file is not None: + file.flush() + binary_file.write(out) + binary_file.flush() + return + + # ANSI style code support. For no message or bytes, nothing happens. + # When outputting to a file instead of a terminal, strip codes. + else: + color = resolve_color_default(color) + + if should_strip_ansi(file, color): + out = strip_ansi(out) + elif WIN: + if auto_wrap_for_ansi is not None: + file = auto_wrap_for_ansi(file) # type: ignore + elif not color: + out = strip_ansi(out) + + file.write(out) # type: ignore + file.flush() + + +def get_binary_stream(name: "te.Literal['stdin', 'stdout', 'stderr']") -> t.BinaryIO: + """Returns a system stream for byte processing. + + :param name: the name of the stream to open. Valid names are ``'stdin'``, + ``'stdout'`` and ``'stderr'`` + """ + opener = binary_streams.get(name) + if opener is None: + raise TypeError(f"Unknown standard stream '{name}'") + return opener() + + +def get_text_stream( + name: "te.Literal['stdin', 'stdout', 'stderr']", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", +) -> t.TextIO: + """Returns a system stream for text processing. This usually returns + a wrapped stream around a binary stream returned from + :func:`get_binary_stream` but it also can take shortcuts for already + correctly configured streams. + + :param name: the name of the stream to open. Valid names are ``'stdin'``, + ``'stdout'`` and ``'stderr'`` + :param encoding: overrides the detected default encoding. + :param errors: overrides the default error mode. + """ + opener = text_streams.get(name) + if opener is None: + raise TypeError(f"Unknown standard stream '{name}'") + return opener(encoding, errors) + + +def open_file( + filename: str, + mode: str = "r", + encoding: t.Optional[str] = None, + errors: t.Optional[str] = "strict", + lazy: bool = False, + atomic: bool = False, +) -> t.IO[t.Any]: + """Open a file, with extra behavior to handle ``'-'`` to indicate + a standard stream, lazy open on write, and atomic write. Similar to + the behavior of the :class:`~click.File` param type. + + If ``'-'`` is given to open ``stdout`` or ``stdin``, the stream is + wrapped so that using it in a context manager will not close it. + This makes it possible to use the function without accidentally + closing a standard stream: + + .. code-block:: python + + with open_file(filename) as f: + ... + + :param filename: The name of the file to open, or ``'-'`` for + ``stdin``/``stdout``. + :param mode: The mode in which to open the file. + :param encoding: The encoding to decode or encode a file opened in + text mode. + :param errors: The error handling mode. + :param lazy: Wait to open the file until it is accessed. For read + mode, the file is temporarily opened to raise access errors + early, then closed until it is read again. + :param atomic: Write to a temporary file and replace the given file + on close. + + .. versionadded:: 3.0 + """ + if lazy: + return t.cast( + t.IO[t.Any], LazyFile(filename, mode, encoding, errors, atomic=atomic) + ) + + f, should_close = open_stream(filename, mode, encoding, errors, atomic=atomic) + + if not should_close: + f = t.cast(t.IO[t.Any], KeepOpenFile(f)) + + return f + + +def format_filename( + filename: "t.Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]", + shorten: bool = False, +) -> str: + """Format a filename as a string for display. Ensures the filename can be + displayed by replacing any invalid bytes or surrogate escapes in the name + with the replacement character ``�``. + + Invalid bytes or surrogate escapes will raise an error when written to a + stream with ``errors="strict". This will typically happen with ``stdout`` + when the locale is something like ``en_GB.UTF-8``. + + Many scenarios *are* safe to write surrogates though, due to PEP 538 and + PEP 540, including: + + - Writing to ``stderr``, which uses ``errors="backslashreplace"``. + - The system has ``LANG=C.UTF-8``, ``C``, or ``POSIX``. Python opens + stdout and stderr with ``errors="surrogateescape"``. + - None of ``LANG/LC_*`` are set. Python assumes ``LANG=C.UTF-8``. + - Python is started in UTF-8 mode with ``PYTHONUTF8=1`` or ``-X utf8``. + Python opens stdout and stderr with ``errors="surrogateescape"``. + + :param filename: formats a filename for UI display. This will also convert + the filename into unicode without failing. + :param shorten: this optionally shortens the filename to strip of the + path that leads up to it. + """ + if shorten: + filename = os.path.basename(filename) + else: + filename = os.fspath(filename) + + if isinstance(filename, bytes): + filename = filename.decode(sys.getfilesystemencoding(), "replace") + else: + filename = filename.encode("utf-8", "surrogateescape").decode( + "utf-8", "replace" + ) + + return filename + + +def get_app_dir(app_name: str, roaming: bool = True, force_posix: bool = False) -> str: + r"""Returns the config folder for the application. The default behavior + is to return whatever is most appropriate for the operating system. + + To give you an idea, for an app called ``"Foo Bar"``, something like + the following folders could be returned: + + Mac OS X: + ``~/Library/Application Support/Foo Bar`` + Mac OS X (POSIX): + ``~/.foo-bar`` + Unix: + ``~/.config/foo-bar`` + Unix (POSIX): + ``~/.foo-bar`` + Windows (roaming): + ``C:\Users\\AppData\Roaming\Foo Bar`` + Windows (not roaming): + ``C:\Users\\AppData\Local\Foo Bar`` + + .. versionadded:: 2.0 + + :param app_name: the application name. This should be properly capitalized + and can contain whitespace. + :param roaming: controls if the folder should be roaming or not on Windows. + Has no effect otherwise. + :param force_posix: if this is set to `True` then on any POSIX system the + folder will be stored in the home folder with a leading + dot instead of the XDG config home or darwin's + application support folder. + """ + if WIN: + key = "APPDATA" if roaming else "LOCALAPPDATA" + folder = os.environ.get(key) + if folder is None: + folder = os.path.expanduser("~") + return os.path.join(folder, app_name) + if force_posix: + return os.path.join(os.path.expanduser(f"~/.{_posixify(app_name)}")) + if sys.platform == "darwin": + return os.path.join( + os.path.expanduser("~/Library/Application Support"), app_name + ) + return os.path.join( + os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), + _posixify(app_name), + ) + + +class PacifyFlushWrapper: + """This wrapper is used to catch and suppress BrokenPipeErrors resulting + from ``.flush()`` being called on broken pipe during the shutdown/final-GC + of the Python interpreter. Notably ``.flush()`` is always called on + ``sys.stdout`` and ``sys.stderr``. So as to have minimal impact on any + other cleanup code, and the case where the underlying file is not a broken + pipe, all calls and attributes are proxied. + """ + + def __init__(self, wrapped: t.IO[t.Any]) -> None: + self.wrapped = wrapped + + def flush(self) -> None: + try: + self.wrapped.flush() + except OSError as e: + import errno + + if e.errno != errno.EPIPE: + raise + + def __getattr__(self, attr: str) -> t.Any: + return getattr(self.wrapped, attr) + + +def _detect_program_name( + path: t.Optional[str] = None, _main: t.Optional[ModuleType] = None +) -> str: + """Determine the command used to run the program, for use in help + text. If a file or entry point was executed, the file name is + returned. If ``python -m`` was used to execute a module or package, + ``python -m name`` is returned. + + This doesn't try to be too precise, the goal is to give a concise + name for help text. Files are only shown as their name without the + path. ``python`` is only shown for modules, and the full path to + ``sys.executable`` is not shown. + + :param path: The Python file being executed. Python puts this in + ``sys.argv[0]``, which is used by default. + :param _main: The ``__main__`` module. This should only be passed + during internal testing. + + .. versionadded:: 8.0 + Based on command args detection in the Werkzeug reloader. + + :meta private: + """ + if _main is None: + _main = sys.modules["__main__"] + + if not path: + path = sys.argv[0] + + # The value of __package__ indicates how Python was called. It may + # not exist if a setuptools script is installed as an egg. It may be + # set incorrectly for entry points created with pip on Windows. + # It is set to "" inside a Shiv or PEX zipapp. + if getattr(_main, "__package__", None) in {None, ""} or ( + os.name == "nt" + and _main.__package__ == "" + and not os.path.exists(path) + and os.path.exists(f"{path}.exe") + ): + # Executed a file, like "python app.py". + return os.path.basename(path) + + # Executed a module, like "python -m example". + # Rewritten by Python from "-m script" to "/path/to/script.py". + # Need to look at main module to determine how it was executed. + py_module = t.cast(str, _main.__package__) + name = os.path.splitext(os.path.basename(path))[0] + + # A submodule like "example.cli". + if name != "__main__": + py_module = f"{py_module}.{name}" + + return f"python -m {py_module.lstrip('.')}" + + +def _expand_args( + args: t.Iterable[str], + *, + user: bool = True, + env: bool = True, + glob_recursive: bool = True, +) -> t.List[str]: + """Simulate Unix shell expansion with Python functions. + + See :func:`glob.glob`, :func:`os.path.expanduser`, and + :func:`os.path.expandvars`. + + This is intended for use on Windows, where the shell does not do any + expansion. It may not exactly match what a Unix shell would do. + + :param args: List of command line arguments to expand. + :param user: Expand user home directory. + :param env: Expand environment variables. + :param glob_recursive: ``**`` matches directories recursively. + + .. versionchanged:: 8.1 + Invalid glob patterns are treated as empty expansions rather + than raising an error. + + .. versionadded:: 8.0 + + :meta private: + """ + from glob import glob + + out = [] + + for arg in args: + if user: + arg = os.path.expanduser(arg) + + if env: + arg = os.path.expandvars(arg) + + try: + matches = glob(arg, recursive=glob_recursive) + except re.error: + matches = [] + + if not matches: + out.append(arg) + else: + out.extend(matches) + + return out diff --git a/jwt/python/_cffi_backend.cpython-311-x86_64-linux-gnu.so b/jwt/python/_cffi_backend.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..0ccaa84 Binary files /dev/null and b/jwt/python/_cffi_backend.cpython-311-x86_64-linux-gnu.so differ diff --git a/jwt/python/cffi-1.15.1.dist-info/INSTALLER b/jwt/python/cffi-1.15.1.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/jwt/python/cffi-1.15.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/jwt/python/cffi-1.15.1.dist-info/LICENSE b/jwt/python/cffi-1.15.1.dist-info/LICENSE new file mode 100644 index 0000000..29225ee --- /dev/null +++ b/jwt/python/cffi-1.15.1.dist-info/LICENSE @@ -0,0 +1,26 @@ + +Except when otherwise stated (look for LICENSE files in directories or +information at the beginning of each file) all software and +documentation is licensed as follows: + + The MIT License + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + diff --git a/jwt/python/cffi-1.15.1.dist-info/METADATA b/jwt/python/cffi-1.15.1.dist-info/METADATA new file mode 100644 index 0000000..538e679 --- /dev/null +++ b/jwt/python/cffi-1.15.1.dist-info/METADATA @@ -0,0 +1,34 @@ +Metadata-Version: 2.1 +Name: cffi +Version: 1.15.1 +Summary: Foreign Function Interface for Python calling C code. +Home-page: http://cffi.readthedocs.org +Author: Armin Rigo, Maciej Fijalkowski +Author-email: python-cffi@googlegroups.com +License: MIT +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: License :: OSI Approved :: MIT License +License-File: LICENSE +Requires-Dist: pycparser + + +CFFI +==== + +Foreign Function Interface for Python calling C code. +Please see the `Documentation `_. + +Contact +------- + +`Mailing list `_ diff --git a/jwt/python/cffi-1.15.1.dist-info/RECORD b/jwt/python/cffi-1.15.1.dist-info/RECORD new file mode 100644 index 0000000..9a17f6a --- /dev/null +++ b/jwt/python/cffi-1.15.1.dist-info/RECORD @@ -0,0 +1,44 @@ +_cffi_backend.cpython-311-x86_64-linux-gnu.so,sha256=Tqtlk67ccuzwROK1EjnDv_LCj8qMxKsTlJdYDjl3uvA,1065976 +cffi-1.15.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +cffi-1.15.1.dist-info/LICENSE,sha256=BLgPWwd7vtaICM_rreteNSPyqMmpZJXFh72W3x6sKjM,1294 +cffi-1.15.1.dist-info/METADATA,sha256=KP4G3WmavRgDGwD2b8Y_eDsM1YeV6ckcG6Alz3-D8VY,1144 +cffi-1.15.1.dist-info/RECORD,, +cffi-1.15.1.dist-info/WHEEL,sha256=MXkSmZj-ucMvJEZe-5F9uGaWQfgqj_gRjwLyMfC10Vs,152 +cffi-1.15.1.dist-info/entry_points.txt,sha256=y6jTxnyeuLnL-XJcDv8uML3n6wyYiGRg8MTp_QGJ9Ho,75 +cffi-1.15.1.dist-info/top_level.txt,sha256=rE7WR3rZfNKxWI9-jn6hsHCAl7MDkB-FmuQbxWjFehQ,19 +cffi/__init__.py,sha256=6xB_tafGvhhM5Xvj0Ova3oPC2SEhVlLTEObVLnazeiM,513 +cffi/__pycache__/__init__.cpython-311.pyc,, +cffi/__pycache__/api.cpython-311.pyc,, +cffi/__pycache__/backend_ctypes.cpython-311.pyc,, +cffi/__pycache__/cffi_opcode.cpython-311.pyc,, +cffi/__pycache__/commontypes.cpython-311.pyc,, +cffi/__pycache__/cparser.cpython-311.pyc,, +cffi/__pycache__/error.cpython-311.pyc,, +cffi/__pycache__/ffiplatform.cpython-311.pyc,, +cffi/__pycache__/lock.cpython-311.pyc,, +cffi/__pycache__/model.cpython-311.pyc,, +cffi/__pycache__/pkgconfig.cpython-311.pyc,, +cffi/__pycache__/recompiler.cpython-311.pyc,, +cffi/__pycache__/setuptools_ext.cpython-311.pyc,, +cffi/__pycache__/vengine_cpy.cpython-311.pyc,, +cffi/__pycache__/vengine_gen.cpython-311.pyc,, +cffi/__pycache__/verifier.cpython-311.pyc,, +cffi/_cffi_errors.h,sha256=zQXt7uR_m8gUW-fI2hJg0KoSkJFwXv8RGUkEDZ177dQ,3908 +cffi/_cffi_include.h,sha256=tKnA1rdSoPHp23FnDL1mDGwFo-Uj6fXfA6vA6kcoEUc,14800 +cffi/_embedding.h,sha256=9tnjF44QRobR8z0FGqAmAZY-wMSBOae1SUPqHccowqc,17680 +cffi/api.py,sha256=yxJalIePbr1mz_WxAHokSwyP5CVYde44m-nolHnbJNo,42064 +cffi/backend_ctypes.py,sha256=h5ZIzLc6BFVXnGyc9xPqZWUS7qGy7yFSDqXe68Sa8z4,42454 +cffi/cffi_opcode.py,sha256=v9RdD_ovA8rCtqsC95Ivki5V667rAOhGgs3fb2q9xpM,5724 +cffi/commontypes.py,sha256=QS4uxCDI7JhtTyjh1hlnCA-gynmaszWxJaRRLGkJa1A,2689 +cffi/cparser.py,sha256=rO_1pELRw1gI1DE1m4gi2ik5JMfpxouAACLXpRPlVEA,44231 +cffi/error.py,sha256=v6xTiS4U0kvDcy4h_BDRo5v39ZQuj-IMRYLv5ETddZs,877 +cffi/ffiplatform.py,sha256=HMXqR8ks2wtdsNxGaWpQ_PyqIvtiuos_vf1qKCy-cwg,4046 +cffi/lock.py,sha256=l9TTdwMIMpi6jDkJGnQgE9cvTIR7CAntIJr8EGHt3pY,747 +cffi/model.py,sha256=_GH_UF1Rn9vC4AvmgJm6qj7RUXXG3eqKPc8bPxxyBKE,21768 +cffi/parse_c_type.h,sha256=OdwQfwM9ktq6vlCB43exFQmxDBtj2MBNdK8LYl15tjw,5976 +cffi/pkgconfig.py,sha256=LP1w7vmWvmKwyqLaU1Z243FOWGNQMrgMUZrvgFuOlco,4374 +cffi/recompiler.py,sha256=YgVYTh2CrXIobo-vMk7_K9mwAXdd_LqB4-IbYABQ488,64598 +cffi/setuptools_ext.py,sha256=RUR17N5f8gpiQBBlXL34P9FtOu1mhHIaAf3WJlg5S4I,8931 +cffi/vengine_cpy.py,sha256=YglN8YS-UaHEv2k2cxgotNWE87dHX20-68EyKoiKUYA,43320 +cffi/vengine_gen.py,sha256=5dX7s1DU6pTBOMI6oTVn_8Bnmru_lj932B6b4v29Hlg,26684 +cffi/verifier.py,sha256=ESwuXWXtXrKEagCKveLRDjFzLNCyaKdqAgAlKREcyhY,11253 diff --git a/jwt/python/cffi-1.15.1.dist-info/WHEEL b/jwt/python/cffi-1.15.1.dist-info/WHEEL new file mode 100644 index 0000000..1d3967a --- /dev/null +++ b/jwt/python/cffi-1.15.1.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.1) +Root-Is-Purelib: false +Tag: cp311-cp311-manylinux_2_17_x86_64 +Tag: cp311-cp311-manylinux2014_x86_64 + diff --git a/jwt/python/cffi-1.15.1.dist-info/entry_points.txt b/jwt/python/cffi-1.15.1.dist-info/entry_points.txt new file mode 100644 index 0000000..4b0274f --- /dev/null +++ b/jwt/python/cffi-1.15.1.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[distutils.setup_keywords] +cffi_modules = cffi.setuptools_ext:cffi_modules diff --git a/jwt/python/cffi-1.15.1.dist-info/top_level.txt b/jwt/python/cffi-1.15.1.dist-info/top_level.txt new file mode 100644 index 0000000..f645779 --- /dev/null +++ b/jwt/python/cffi-1.15.1.dist-info/top_level.txt @@ -0,0 +1,2 @@ +_cffi_backend +cffi diff --git a/jwt/python/cffi/__init__.py b/jwt/python/cffi/__init__.py new file mode 100644 index 0000000..90e2e65 --- /dev/null +++ b/jwt/python/cffi/__init__.py @@ -0,0 +1,14 @@ +__all__ = ['FFI', 'VerificationError', 'VerificationMissing', 'CDefError', + 'FFIError'] + +from .api import FFI +from .error import CDefError, FFIError, VerificationError, VerificationMissing +from .error import PkgConfigError + +__version__ = "1.15.1" +__version_info__ = (1, 15, 1) + +# The verifier module file names are based on the CRC32 of a string that +# contains the following version number. It may be older than __version__ +# if nothing is clearly incompatible. +__version_verifier_modules__ = "0.8.6" diff --git a/jwt/python/cffi/__pycache__/__init__.cpython-311.pyc b/jwt/python/cffi/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..a2bc643 Binary files /dev/null and b/jwt/python/cffi/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/api.cpython-311.pyc b/jwt/python/cffi/__pycache__/api.cpython-311.pyc new file mode 100644 index 0000000..5eca4b0 Binary files /dev/null and b/jwt/python/cffi/__pycache__/api.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/backend_ctypes.cpython-311.pyc b/jwt/python/cffi/__pycache__/backend_ctypes.cpython-311.pyc new file mode 100644 index 0000000..23c17b7 Binary files /dev/null and b/jwt/python/cffi/__pycache__/backend_ctypes.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/cffi_opcode.cpython-311.pyc b/jwt/python/cffi/__pycache__/cffi_opcode.cpython-311.pyc new file mode 100644 index 0000000..476a810 Binary files /dev/null and b/jwt/python/cffi/__pycache__/cffi_opcode.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/commontypes.cpython-311.pyc b/jwt/python/cffi/__pycache__/commontypes.cpython-311.pyc new file mode 100644 index 0000000..01eb5b9 Binary files /dev/null and b/jwt/python/cffi/__pycache__/commontypes.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/cparser.cpython-311.pyc b/jwt/python/cffi/__pycache__/cparser.cpython-311.pyc new file mode 100644 index 0000000..a51a859 Binary files /dev/null and b/jwt/python/cffi/__pycache__/cparser.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/error.cpython-311.pyc b/jwt/python/cffi/__pycache__/error.cpython-311.pyc new file mode 100644 index 0000000..0947871 Binary files /dev/null and b/jwt/python/cffi/__pycache__/error.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/ffiplatform.cpython-311.pyc b/jwt/python/cffi/__pycache__/ffiplatform.cpython-311.pyc new file mode 100644 index 0000000..b52183c Binary files /dev/null and b/jwt/python/cffi/__pycache__/ffiplatform.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/lock.cpython-311.pyc b/jwt/python/cffi/__pycache__/lock.cpython-311.pyc new file mode 100644 index 0000000..4ec7eef Binary files /dev/null and b/jwt/python/cffi/__pycache__/lock.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/model.cpython-311.pyc b/jwt/python/cffi/__pycache__/model.cpython-311.pyc new file mode 100644 index 0000000..1e2e435 Binary files /dev/null and b/jwt/python/cffi/__pycache__/model.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/pkgconfig.cpython-311.pyc b/jwt/python/cffi/__pycache__/pkgconfig.cpython-311.pyc new file mode 100644 index 0000000..6190437 Binary files /dev/null and b/jwt/python/cffi/__pycache__/pkgconfig.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/recompiler.cpython-311.pyc b/jwt/python/cffi/__pycache__/recompiler.cpython-311.pyc new file mode 100644 index 0000000..58aa486 Binary files /dev/null and b/jwt/python/cffi/__pycache__/recompiler.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/setuptools_ext.cpython-311.pyc b/jwt/python/cffi/__pycache__/setuptools_ext.cpython-311.pyc new file mode 100644 index 0000000..985cd71 Binary files /dev/null and b/jwt/python/cffi/__pycache__/setuptools_ext.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/vengine_cpy.cpython-311.pyc b/jwt/python/cffi/__pycache__/vengine_cpy.cpython-311.pyc new file mode 100644 index 0000000..7149b8a Binary files /dev/null and b/jwt/python/cffi/__pycache__/vengine_cpy.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/vengine_gen.cpython-311.pyc b/jwt/python/cffi/__pycache__/vengine_gen.cpython-311.pyc new file mode 100644 index 0000000..0d6b1fb Binary files /dev/null and b/jwt/python/cffi/__pycache__/vengine_gen.cpython-311.pyc differ diff --git a/jwt/python/cffi/__pycache__/verifier.cpython-311.pyc b/jwt/python/cffi/__pycache__/verifier.cpython-311.pyc new file mode 100644 index 0000000..642e083 Binary files /dev/null and b/jwt/python/cffi/__pycache__/verifier.cpython-311.pyc differ diff --git a/jwt/python/cffi/_cffi_errors.h b/jwt/python/cffi/_cffi_errors.h new file mode 100644 index 0000000..158e059 --- /dev/null +++ b/jwt/python/cffi/_cffi_errors.h @@ -0,0 +1,149 @@ +#ifndef CFFI_MESSAGEBOX +# ifdef _MSC_VER +# define CFFI_MESSAGEBOX 1 +# else +# define CFFI_MESSAGEBOX 0 +# endif +#endif + + +#if CFFI_MESSAGEBOX +/* Windows only: logic to take the Python-CFFI embedding logic + initialization errors and display them in a background thread + with MessageBox. The idea is that if the whole program closes + as a result of this problem, then likely it is already a console + program and you can read the stderr output in the console too. + If it is not a console program, then it will likely show its own + dialog to complain, or generally not abruptly close, and for this + case the background thread should stay alive. +*/ +static void *volatile _cffi_bootstrap_text; + +static PyObject *_cffi_start_error_capture(void) +{ + PyObject *result = NULL; + PyObject *x, *m, *bi; + + if (InterlockedCompareExchangePointer(&_cffi_bootstrap_text, + (void *)1, NULL) != NULL) + return (PyObject *)1; + + m = PyImport_AddModule("_cffi_error_capture"); + if (m == NULL) + goto error; + + result = PyModule_GetDict(m); + if (result == NULL) + goto error; + +#if PY_MAJOR_VERSION >= 3 + bi = PyImport_ImportModule("builtins"); +#else + bi = PyImport_ImportModule("__builtin__"); +#endif + if (bi == NULL) + goto error; + PyDict_SetItemString(result, "__builtins__", bi); + Py_DECREF(bi); + + x = PyRun_String( + "import sys\n" + "class FileLike:\n" + " def write(self, x):\n" + " try:\n" + " of.write(x)\n" + " except: pass\n" + " self.buf += x\n" + " def flush(self):\n" + " pass\n" + "fl = FileLike()\n" + "fl.buf = ''\n" + "of = sys.stderr\n" + "sys.stderr = fl\n" + "def done():\n" + " sys.stderr = of\n" + " return fl.buf\n", /* make sure the returned value stays alive */ + Py_file_input, + result, result); + Py_XDECREF(x); + + error: + if (PyErr_Occurred()) + { + PyErr_WriteUnraisable(Py_None); + PyErr_Clear(); + } + return result; +} + +#pragma comment(lib, "user32.lib") + +static DWORD WINAPI _cffi_bootstrap_dialog(LPVOID ignored) +{ + Sleep(666); /* may be interrupted if the whole process is closing */ +#if PY_MAJOR_VERSION >= 3 + MessageBoxW(NULL, (wchar_t *)_cffi_bootstrap_text, + L"Python-CFFI error", + MB_OK | MB_ICONERROR); +#else + MessageBoxA(NULL, (char *)_cffi_bootstrap_text, + "Python-CFFI error", + MB_OK | MB_ICONERROR); +#endif + _cffi_bootstrap_text = NULL; + return 0; +} + +static void _cffi_stop_error_capture(PyObject *ecap) +{ + PyObject *s; + void *text; + + if (ecap == (PyObject *)1) + return; + + if (ecap == NULL) + goto error; + + s = PyRun_String("done()", Py_eval_input, ecap, ecap); + if (s == NULL) + goto error; + + /* Show a dialog box, but in a background thread, and + never show multiple dialog boxes at once. */ +#if PY_MAJOR_VERSION >= 3 + text = PyUnicode_AsWideCharString(s, NULL); +#else + text = PyString_AsString(s); +#endif + + _cffi_bootstrap_text = text; + + if (text != NULL) + { + HANDLE h; + h = CreateThread(NULL, 0, _cffi_bootstrap_dialog, + NULL, 0, NULL); + if (h != NULL) + CloseHandle(h); + } + /* decref the string, but it should stay alive as 'fl.buf' + in the small module above. It will really be freed only if + we later get another similar error. So it's a leak of at + most one copy of the small module. That's fine for this + situation which is usually a "fatal error" anyway. */ + Py_DECREF(s); + PyErr_Clear(); + return; + + error: + _cffi_bootstrap_text = NULL; + PyErr_Clear(); +} + +#else + +static PyObject *_cffi_start_error_capture(void) { return NULL; } +static void _cffi_stop_error_capture(PyObject *ecap) { } + +#endif diff --git a/jwt/python/cffi/_cffi_include.h b/jwt/python/cffi/_cffi_include.h new file mode 100644 index 0000000..e4c0a67 --- /dev/null +++ b/jwt/python/cffi/_cffi_include.h @@ -0,0 +1,385 @@ +#define _CFFI_ + +/* We try to define Py_LIMITED_API before including Python.h. + + Mess: we can only define it if Py_DEBUG, Py_TRACE_REFS and + Py_REF_DEBUG are not defined. This is a best-effort approximation: + we can learn about Py_DEBUG from pyconfig.h, but it is unclear if + the same works for the other two macros. Py_DEBUG implies them, + but not the other way around. + + The implementation is messy (issue #350): on Windows, with _MSC_VER, + we have to define Py_LIMITED_API even before including pyconfig.h. + In that case, we guess what pyconfig.h will do to the macros above, + and check our guess after the #include. + + Note that on Windows, with CPython 3.x, you need >= 3.5 and virtualenv + version >= 16.0.0. With older versions of either, you don't get a + copy of PYTHON3.DLL in the virtualenv. We can't check the version of + CPython *before* we even include pyconfig.h. ffi.set_source() puts + a ``#define _CFFI_NO_LIMITED_API'' at the start of this file if it is + running on Windows < 3.5, as an attempt at fixing it, but that's + arguably wrong because it may not be the target version of Python. + Still better than nothing I guess. As another workaround, you can + remove the definition of Py_LIMITED_API here. + + See also 'py_limited_api' in cffi/setuptools_ext.py. +*/ +#if !defined(_CFFI_USE_EMBEDDING) && !defined(Py_LIMITED_API) +# ifdef _MSC_VER +# if !defined(_DEBUG) && !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API) +# define Py_LIMITED_API +# endif +# include + /* sanity-check: Py_LIMITED_API will cause crashes if any of these + are also defined. Normally, the Python file PC/pyconfig.h does not + cause any of these to be defined, with the exception that _DEBUG + causes Py_DEBUG. Double-check that. */ +# ifdef Py_LIMITED_API +# if defined(Py_DEBUG) +# error "pyconfig.h unexpectedly defines Py_DEBUG, but Py_LIMITED_API is set" +# endif +# if defined(Py_TRACE_REFS) +# error "pyconfig.h unexpectedly defines Py_TRACE_REFS, but Py_LIMITED_API is set" +# endif +# if defined(Py_REF_DEBUG) +# error "pyconfig.h unexpectedly defines Py_REF_DEBUG, but Py_LIMITED_API is set" +# endif +# endif +# else +# include +# if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API) +# define Py_LIMITED_API +# endif +# endif +#endif + +#include +#ifdef __cplusplus +extern "C" { +#endif +#include +#include "parse_c_type.h" + +/* this block of #ifs should be kept exactly identical between + c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py + and cffi/_cffi_include.h */ +#if defined(_MSC_VER) +# include /* for alloca() */ +# if _MSC_VER < 1600 /* MSVC < 2010 */ + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; + typedef __int8 int_least8_t; + typedef __int16 int_least16_t; + typedef __int32 int_least32_t; + typedef __int64 int_least64_t; + typedef unsigned __int8 uint_least8_t; + typedef unsigned __int16 uint_least16_t; + typedef unsigned __int32 uint_least32_t; + typedef unsigned __int64 uint_least64_t; + typedef __int8 int_fast8_t; + typedef __int16 int_fast16_t; + typedef __int32 int_fast32_t; + typedef __int64 int_fast64_t; + typedef unsigned __int8 uint_fast8_t; + typedef unsigned __int16 uint_fast16_t; + typedef unsigned __int32 uint_fast32_t; + typedef unsigned __int64 uint_fast64_t; + typedef __int64 intmax_t; + typedef unsigned __int64 uintmax_t; +# else +# include +# endif +# if _MSC_VER < 1800 /* MSVC < 2013 */ +# ifndef __cplusplus + typedef unsigned char _Bool; +# endif +# endif +#else +# include +# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux) +# include +# endif +#endif + +#ifdef __GNUC__ +# define _CFFI_UNUSED_FN __attribute__((unused)) +#else +# define _CFFI_UNUSED_FN /* nothing */ +#endif + +#ifdef __cplusplus +# ifndef _Bool + typedef bool _Bool; /* semi-hackish: C++ has no _Bool; bool is builtin */ +# endif +#endif + +/********** CPython-specific section **********/ +#ifndef PYPY_VERSION + + +#if PY_MAJOR_VERSION >= 3 +# define PyInt_FromLong PyLong_FromLong +#endif + +#define _cffi_from_c_double PyFloat_FromDouble +#define _cffi_from_c_float PyFloat_FromDouble +#define _cffi_from_c_long PyInt_FromLong +#define _cffi_from_c_ulong PyLong_FromUnsignedLong +#define _cffi_from_c_longlong PyLong_FromLongLong +#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong +#define _cffi_from_c__Bool PyBool_FromLong + +#define _cffi_to_c_double PyFloat_AsDouble +#define _cffi_to_c_float PyFloat_AsDouble + +#define _cffi_from_c_int(x, type) \ + (((type)-1) > 0 ? /* unsigned */ \ + (sizeof(type) < sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + sizeof(type) == sizeof(long) ? \ + PyLong_FromUnsignedLong((unsigned long)x) : \ + PyLong_FromUnsignedLongLong((unsigned long long)x)) : \ + (sizeof(type) <= sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + PyLong_FromLongLong((long long)x))) + +#define _cffi_to_c_int(o, type) \ + ((type)( \ + sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o) \ + : (type)_cffi_to_c_i8(o)) : \ + sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o) \ + : (type)_cffi_to_c_i16(o)) : \ + sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o) \ + : (type)_cffi_to_c_i32(o)) : \ + sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o) \ + : (type)_cffi_to_c_i64(o)) : \ + (Py_FatalError("unsupported size for type " #type), (type)0))) + +#define _cffi_to_c_i8 \ + ((int(*)(PyObject *))_cffi_exports[1]) +#define _cffi_to_c_u8 \ + ((int(*)(PyObject *))_cffi_exports[2]) +#define _cffi_to_c_i16 \ + ((int(*)(PyObject *))_cffi_exports[3]) +#define _cffi_to_c_u16 \ + ((int(*)(PyObject *))_cffi_exports[4]) +#define _cffi_to_c_i32 \ + ((int(*)(PyObject *))_cffi_exports[5]) +#define _cffi_to_c_u32 \ + ((unsigned int(*)(PyObject *))_cffi_exports[6]) +#define _cffi_to_c_i64 \ + ((long long(*)(PyObject *))_cffi_exports[7]) +#define _cffi_to_c_u64 \ + ((unsigned long long(*)(PyObject *))_cffi_exports[8]) +#define _cffi_to_c_char \ + ((int(*)(PyObject *))_cffi_exports[9]) +#define _cffi_from_c_pointer \ + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[10]) +#define _cffi_to_c_pointer \ + ((char *(*)(PyObject *, struct _cffi_ctypedescr *))_cffi_exports[11]) +#define _cffi_get_struct_layout \ + not used any more +#define _cffi_restore_errno \ + ((void(*)(void))_cffi_exports[13]) +#define _cffi_save_errno \ + ((void(*)(void))_cffi_exports[14]) +#define _cffi_from_c_char \ + ((PyObject *(*)(char))_cffi_exports[15]) +#define _cffi_from_c_deref \ + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[16]) +#define _cffi_to_c \ + ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[17]) +#define _cffi_from_c_struct \ + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[18]) +#define _cffi_to_c_wchar_t \ + ((_cffi_wchar_t(*)(PyObject *))_cffi_exports[19]) +#define _cffi_from_c_wchar_t \ + ((PyObject *(*)(_cffi_wchar_t))_cffi_exports[20]) +#define _cffi_to_c_long_double \ + ((long double(*)(PyObject *))_cffi_exports[21]) +#define _cffi_to_c__Bool \ + ((_Bool(*)(PyObject *))_cffi_exports[22]) +#define _cffi_prepare_pointer_call_argument \ + ((Py_ssize_t(*)(struct _cffi_ctypedescr *, \ + PyObject *, char **))_cffi_exports[23]) +#define _cffi_convert_array_from_object \ + ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[24]) +#define _CFFI_CPIDX 25 +#define _cffi_call_python \ + ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[_CFFI_CPIDX]) +#define _cffi_to_c_wchar3216_t \ + ((int(*)(PyObject *))_cffi_exports[26]) +#define _cffi_from_c_wchar3216_t \ + ((PyObject *(*)(int))_cffi_exports[27]) +#define _CFFI_NUM_EXPORTS 28 + +struct _cffi_ctypedescr; + +static void *_cffi_exports[_CFFI_NUM_EXPORTS]; + +#define _cffi_type(index) ( \ + assert((((uintptr_t)_cffi_types[index]) & 1) == 0), \ + (struct _cffi_ctypedescr *)_cffi_types[index]) + +static PyObject *_cffi_init(const char *module_name, Py_ssize_t version, + const struct _cffi_type_context_s *ctx) +{ + PyObject *module, *o_arg, *new_module; + void *raw[] = { + (void *)module_name, + (void *)version, + (void *)_cffi_exports, + (void *)ctx, + }; + + module = PyImport_ImportModule("_cffi_backend"); + if (module == NULL) + goto failure; + + o_arg = PyLong_FromVoidPtr((void *)raw); + if (o_arg == NULL) + goto failure; + + new_module = PyObject_CallMethod( + module, (char *)"_init_cffi_1_0_external_module", (char *)"O", o_arg); + + Py_DECREF(o_arg); + Py_DECREF(module); + return new_module; + + failure: + Py_XDECREF(module); + return NULL; +} + + +#ifdef HAVE_WCHAR_H +typedef wchar_t _cffi_wchar_t; +#else +typedef uint16_t _cffi_wchar_t; /* same random pick as _cffi_backend.c */ +#endif + +_CFFI_UNUSED_FN static uint16_t _cffi_to_c_char16_t(PyObject *o) +{ + if (sizeof(_cffi_wchar_t) == 2) + return (uint16_t)_cffi_to_c_wchar_t(o); + else + return (uint16_t)_cffi_to_c_wchar3216_t(o); +} + +_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char16_t(uint16_t x) +{ + if (sizeof(_cffi_wchar_t) == 2) + return _cffi_from_c_wchar_t((_cffi_wchar_t)x); + else + return _cffi_from_c_wchar3216_t((int)x); +} + +_CFFI_UNUSED_FN static int _cffi_to_c_char32_t(PyObject *o) +{ + if (sizeof(_cffi_wchar_t) == 4) + return (int)_cffi_to_c_wchar_t(o); + else + return (int)_cffi_to_c_wchar3216_t(o); +} + +_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char32_t(unsigned int x) +{ + if (sizeof(_cffi_wchar_t) == 4) + return _cffi_from_c_wchar_t((_cffi_wchar_t)x); + else + return _cffi_from_c_wchar3216_t((int)x); +} + +union _cffi_union_alignment_u { + unsigned char m_char; + unsigned short m_short; + unsigned int m_int; + unsigned long m_long; + unsigned long long m_longlong; + float m_float; + double m_double; + long double m_longdouble; +}; + +struct _cffi_freeme_s { + struct _cffi_freeme_s *next; + union _cffi_union_alignment_u alignment; +}; + +_CFFI_UNUSED_FN static int +_cffi_convert_array_argument(struct _cffi_ctypedescr *ctptr, PyObject *arg, + char **output_data, Py_ssize_t datasize, + struct _cffi_freeme_s **freeme) +{ + char *p; + if (datasize < 0) + return -1; + + p = *output_data; + if (p == NULL) { + struct _cffi_freeme_s *fp = (struct _cffi_freeme_s *)PyObject_Malloc( + offsetof(struct _cffi_freeme_s, alignment) + (size_t)datasize); + if (fp == NULL) + return -1; + fp->next = *freeme; + *freeme = fp; + p = *output_data = (char *)&fp->alignment; + } + memset((void *)p, 0, (size_t)datasize); + return _cffi_convert_array_from_object(p, ctptr, arg); +} + +_CFFI_UNUSED_FN static void +_cffi_free_array_arguments(struct _cffi_freeme_s *freeme) +{ + do { + void *p = (void *)freeme; + freeme = freeme->next; + PyObject_Free(p); + } while (freeme != NULL); +} + +/********** end CPython-specific section **********/ +#else +_CFFI_UNUSED_FN +static void (*_cffi_call_python_org)(struct _cffi_externpy_s *, char *); +# define _cffi_call_python _cffi_call_python_org +#endif + + +#define _cffi_array_len(array) (sizeof(array) / sizeof((array)[0])) + +#define _cffi_prim_int(size, sign) \ + ((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8 : _CFFI_PRIM_UINT8) : \ + (size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) : \ + (size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) : \ + (size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) : \ + _CFFI__UNKNOWN_PRIM) + +#define _cffi_prim_float(size) \ + ((size) == sizeof(float) ? _CFFI_PRIM_FLOAT : \ + (size) == sizeof(double) ? _CFFI_PRIM_DOUBLE : \ + (size) == sizeof(long double) ? _CFFI__UNKNOWN_LONG_DOUBLE : \ + _CFFI__UNKNOWN_FLOAT_PRIM) + +#define _cffi_check_int(got, got_nonpos, expected) \ + ((got_nonpos) == (expected <= 0) && \ + (got) == (unsigned long long)expected) + +#ifdef MS_WIN32 +# define _cffi_stdcall __stdcall +#else +# define _cffi_stdcall /* nothing */ +#endif + +#ifdef __cplusplus +} +#endif diff --git a/jwt/python/cffi/_embedding.h b/jwt/python/cffi/_embedding.h new file mode 100644 index 0000000..8e8df88 --- /dev/null +++ b/jwt/python/cffi/_embedding.h @@ -0,0 +1,528 @@ + +/***** Support code for embedding *****/ + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined(_WIN32) +# define CFFI_DLLEXPORT __declspec(dllexport) +#elif defined(__GNUC__) +# define CFFI_DLLEXPORT __attribute__((visibility("default"))) +#else +# define CFFI_DLLEXPORT /* nothing */ +#endif + + +/* There are two global variables of type _cffi_call_python_fnptr: + + * _cffi_call_python, which we declare just below, is the one called + by ``extern "Python"`` implementations. + + * _cffi_call_python_org, which on CPython is actually part of the + _cffi_exports[] array, is the function pointer copied from + _cffi_backend. If _cffi_start_python() fails, then this is set + to NULL; otherwise, it should never be NULL. + + After initialization is complete, both are equal. However, the + first one remains equal to &_cffi_start_and_call_python until the + very end of initialization, when we are (or should be) sure that + concurrent threads also see a completely initialized world, and + only then is it changed. +*/ +#undef _cffi_call_python +typedef void (*_cffi_call_python_fnptr)(struct _cffi_externpy_s *, char *); +static void _cffi_start_and_call_python(struct _cffi_externpy_s *, char *); +static _cffi_call_python_fnptr _cffi_call_python = &_cffi_start_and_call_python; + + +#ifndef _MSC_VER + /* --- Assuming a GCC not infinitely old --- */ +# define cffi_compare_and_swap(l,o,n) __sync_bool_compare_and_swap(l,o,n) +# define cffi_write_barrier() __sync_synchronize() +# if !defined(__amd64__) && !defined(__x86_64__) && \ + !defined(__i386__) && !defined(__i386) +# define cffi_read_barrier() __sync_synchronize() +# else +# define cffi_read_barrier() (void)0 +# endif +#else + /* --- Windows threads version --- */ +# include +# define cffi_compare_and_swap(l,o,n) \ + (InterlockedCompareExchangePointer(l,n,o) == (o)) +# define cffi_write_barrier() InterlockedCompareExchange(&_cffi_dummy,0,0) +# define cffi_read_barrier() (void)0 +static volatile LONG _cffi_dummy; +#endif + +#ifdef WITH_THREAD +# ifndef _MSC_VER +# include + static pthread_mutex_t _cffi_embed_startup_lock; +# else + static CRITICAL_SECTION _cffi_embed_startup_lock; +# endif + static char _cffi_embed_startup_lock_ready = 0; +#endif + +static void _cffi_acquire_reentrant_mutex(void) +{ + static void *volatile lock = NULL; + + while (!cffi_compare_and_swap(&lock, NULL, (void *)1)) { + /* should ideally do a spin loop instruction here, but + hard to do it portably and doesn't really matter I + think: pthread_mutex_init() should be very fast, and + this is only run at start-up anyway. */ + } + +#ifdef WITH_THREAD + if (!_cffi_embed_startup_lock_ready) { +# ifndef _MSC_VER + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&_cffi_embed_startup_lock, &attr); +# else + InitializeCriticalSection(&_cffi_embed_startup_lock); +# endif + _cffi_embed_startup_lock_ready = 1; + } +#endif + + while (!cffi_compare_and_swap(&lock, (void *)1, NULL)) + ; + +#ifndef _MSC_VER + pthread_mutex_lock(&_cffi_embed_startup_lock); +#else + EnterCriticalSection(&_cffi_embed_startup_lock); +#endif +} + +static void _cffi_release_reentrant_mutex(void) +{ +#ifndef _MSC_VER + pthread_mutex_unlock(&_cffi_embed_startup_lock); +#else + LeaveCriticalSection(&_cffi_embed_startup_lock); +#endif +} + + +/********** CPython-specific section **********/ +#ifndef PYPY_VERSION + +#include "_cffi_errors.h" + + +#define _cffi_call_python_org _cffi_exports[_CFFI_CPIDX] + +PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(void); /* forward */ + +static void _cffi_py_initialize(void) +{ + /* XXX use initsigs=0, which "skips initialization registration of + signal handlers, which might be useful when Python is + embedded" according to the Python docs. But review and think + if it should be a user-controllable setting. + + XXX we should also give a way to write errors to a buffer + instead of to stderr. + + XXX if importing 'site' fails, CPython (any version) calls + exit(). Should we try to work around this behavior here? + */ + Py_InitializeEx(0); +} + +static int _cffi_initialize_python(void) +{ + /* This initializes Python, imports _cffi_backend, and then the + present .dll/.so is set up as a CPython C extension module. + */ + int result; + PyGILState_STATE state; + PyObject *pycode=NULL, *global_dict=NULL, *x; + PyObject *builtins; + + state = PyGILState_Ensure(); + + /* Call the initxxx() function from the present module. It will + create and initialize us as a CPython extension module, instead + of letting the startup Python code do it---it might reimport + the same .dll/.so and get maybe confused on some platforms. + It might also have troubles locating the .dll/.so again for all + I know. + */ + (void)_CFFI_PYTHON_STARTUP_FUNC(); + if (PyErr_Occurred()) + goto error; + + /* Now run the Python code provided to ffi.embedding_init_code(). + */ + pycode = Py_CompileString(_CFFI_PYTHON_STARTUP_CODE, + "", + Py_file_input); + if (pycode == NULL) + goto error; + global_dict = PyDict_New(); + if (global_dict == NULL) + goto error; + builtins = PyEval_GetBuiltins(); + if (builtins == NULL) + goto error; + if (PyDict_SetItemString(global_dict, "__builtins__", builtins) < 0) + goto error; + x = PyEval_EvalCode( +#if PY_MAJOR_VERSION < 3 + (PyCodeObject *) +#endif + pycode, global_dict, global_dict); + if (x == NULL) + goto error; + Py_DECREF(x); + + /* Done! Now if we've been called from + _cffi_start_and_call_python() in an ``extern "Python"``, we can + only hope that the Python code did correctly set up the + corresponding @ffi.def_extern() function. Otherwise, the + general logic of ``extern "Python"`` functions (inside the + _cffi_backend module) will find that the reference is still + missing and print an error. + */ + result = 0; + done: + Py_XDECREF(pycode); + Py_XDECREF(global_dict); + PyGILState_Release(state); + return result; + + error:; + { + /* Print as much information as potentially useful. + Debugging load-time failures with embedding is not fun + */ + PyObject *ecap; + PyObject *exception, *v, *tb, *f, *modules, *mod; + PyErr_Fetch(&exception, &v, &tb); + ecap = _cffi_start_error_capture(); + f = PySys_GetObject((char *)"stderr"); + if (f != NULL && f != Py_None) { + PyFile_WriteString( + "Failed to initialize the Python-CFFI embedding logic:\n\n", f); + } + + if (exception != NULL) { + PyErr_NormalizeException(&exception, &v, &tb); + PyErr_Display(exception, v, tb); + } + Py_XDECREF(exception); + Py_XDECREF(v); + Py_XDECREF(tb); + + if (f != NULL && f != Py_None) { + PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME + "\ncompiled with cffi version: 1.15.1" + "\n_cffi_backend module: ", f); + modules = PyImport_GetModuleDict(); + mod = PyDict_GetItemString(modules, "_cffi_backend"); + if (mod == NULL) { + PyFile_WriteString("not loaded", f); + } + else { + v = PyObject_GetAttrString(mod, "__file__"); + PyFile_WriteObject(v, f, 0); + Py_XDECREF(v); + } + PyFile_WriteString("\nsys.path: ", f); + PyFile_WriteObject(PySys_GetObject((char *)"path"), f, 0); + PyFile_WriteString("\n\n", f); + } + _cffi_stop_error_capture(ecap); + } + result = -1; + goto done; +} + +#if PY_VERSION_HEX < 0x03080000 +PyAPI_DATA(char *) _PyParser_TokenNames[]; /* from CPython */ +#endif + +static int _cffi_carefully_make_gil(void) +{ + /* This does the basic initialization of Python. It can be called + completely concurrently from unrelated threads. It assumes + that we don't hold the GIL before (if it exists), and we don't + hold it afterwards. + + (What it really does used to be completely different in Python 2 + and Python 3, with the Python 2 solution avoiding the spin-lock + around the Py_InitializeEx() call. However, after recent changes + to CPython 2.7 (issue #358) it no longer works. So we use the + Python 3 solution everywhere.) + + This initializes Python by calling Py_InitializeEx(). + Important: this must not be called concurrently at all. + So we use a global variable as a simple spin lock. This global + variable must be from 'libpythonX.Y.so', not from this + cffi-based extension module, because it must be shared from + different cffi-based extension modules. + + In Python < 3.8, we choose + _PyParser_TokenNames[0] as a completely arbitrary pointer value + that is never written to. The default is to point to the + string "ENDMARKER". We change it temporarily to point to the + next character in that string. (Yes, I know it's REALLY + obscure.) + + In Python >= 3.8, this string array is no longer writable, so + instead we pick PyCapsuleType.tp_version_tag. We can't change + Python < 3.8 because someone might use a mixture of cffi + embedded modules, some of which were compiled before this file + changed. + */ + +#ifdef WITH_THREAD +# if PY_VERSION_HEX < 0x03080000 + char *volatile *lock = (char *volatile *)_PyParser_TokenNames; + char *old_value, *locked_value; + + while (1) { /* spin loop */ + old_value = *lock; + locked_value = old_value + 1; + if (old_value[0] == 'E') { + assert(old_value[1] == 'N'); + if (cffi_compare_and_swap(lock, old_value, locked_value)) + break; + } + else { + assert(old_value[0] == 'N'); + /* should ideally do a spin loop instruction here, but + hard to do it portably and doesn't really matter I + think: PyEval_InitThreads() should be very fast, and + this is only run at start-up anyway. */ + } + } +# else + int volatile *lock = (int volatile *)&PyCapsule_Type.tp_version_tag; + int old_value, locked_value; + assert(!(PyCapsule_Type.tp_flags & Py_TPFLAGS_HAVE_VERSION_TAG)); + + while (1) { /* spin loop */ + old_value = *lock; + locked_value = -42; + if (old_value == 0) { + if (cffi_compare_and_swap(lock, old_value, locked_value)) + break; + } + else { + assert(old_value == locked_value); + /* should ideally do a spin loop instruction here, but + hard to do it portably and doesn't really matter I + think: PyEval_InitThreads() should be very fast, and + this is only run at start-up anyway. */ + } + } +# endif +#endif + + /* call Py_InitializeEx() */ + if (!Py_IsInitialized()) { + _cffi_py_initialize(); +#if PY_VERSION_HEX < 0x03070000 + PyEval_InitThreads(); +#endif + PyEval_SaveThread(); /* release the GIL */ + /* the returned tstate must be the one that has been stored into the + autoTLSkey by _PyGILState_Init() called from Py_Initialize(). */ + } + else { +#if PY_VERSION_HEX < 0x03070000 + /* PyEval_InitThreads() is always a no-op from CPython 3.7 */ + PyGILState_STATE state = PyGILState_Ensure(); + PyEval_InitThreads(); + PyGILState_Release(state); +#endif + } + +#ifdef WITH_THREAD + /* release the lock */ + while (!cffi_compare_and_swap(lock, locked_value, old_value)) + ; +#endif + + return 0; +} + +/********** end CPython-specific section **********/ + + +#else + + +/********** PyPy-specific section **********/ + +PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(const void *[]); /* forward */ + +static struct _cffi_pypy_init_s { + const char *name; + void *func; /* function pointer */ + const char *code; +} _cffi_pypy_init = { + _CFFI_MODULE_NAME, + _CFFI_PYTHON_STARTUP_FUNC, + _CFFI_PYTHON_STARTUP_CODE, +}; + +extern int pypy_carefully_make_gil(const char *); +extern int pypy_init_embedded_cffi_module(int, struct _cffi_pypy_init_s *); + +static int _cffi_carefully_make_gil(void) +{ + return pypy_carefully_make_gil(_CFFI_MODULE_NAME); +} + +static int _cffi_initialize_python(void) +{ + return pypy_init_embedded_cffi_module(0xB011, &_cffi_pypy_init); +} + +/********** end PyPy-specific section **********/ + + +#endif + + +#ifdef __GNUC__ +__attribute__((noinline)) +#endif +static _cffi_call_python_fnptr _cffi_start_python(void) +{ + /* Delicate logic to initialize Python. This function can be + called multiple times concurrently, e.g. when the process calls + its first ``extern "Python"`` functions in multiple threads at + once. It can also be called recursively, in which case we must + ignore it. We also have to consider what occurs if several + different cffi-based extensions reach this code in parallel + threads---it is a different copy of the code, then, and we + can't have any shared global variable unless it comes from + 'libpythonX.Y.so'. + + Idea: + + * _cffi_carefully_make_gil(): "carefully" call + PyEval_InitThreads() (possibly with Py_InitializeEx() first). + + * then we use a (local) custom lock to make sure that a call to this + cffi-based extension will wait if another call to the *same* + extension is running the initialization in another thread. + It is reentrant, so that a recursive call will not block, but + only one from a different thread. + + * then we grab the GIL and (Python 2) we call Py_InitializeEx(). + At this point, concurrent calls to Py_InitializeEx() are not + possible: we have the GIL. + + * do the rest of the specific initialization, which may + temporarily release the GIL but not the custom lock. + Only release the custom lock when we are done. + */ + static char called = 0; + + if (_cffi_carefully_make_gil() != 0) + return NULL; + + _cffi_acquire_reentrant_mutex(); + + /* Here the GIL exists, but we don't have it. We're only protected + from concurrency by the reentrant mutex. */ + + /* This file only initializes the embedded module once, the first + time this is called, even if there are subinterpreters. */ + if (!called) { + called = 1; /* invoke _cffi_initialize_python() only once, + but don't set '_cffi_call_python' right now, + otherwise concurrent threads won't call + this function at all (we need them to wait) */ + if (_cffi_initialize_python() == 0) { + /* now initialization is finished. Switch to the fast-path. */ + + /* We would like nobody to see the new value of + '_cffi_call_python' without also seeing the rest of the + data initialized. However, this is not possible. But + the new value of '_cffi_call_python' is the function + 'cffi_call_python()' from _cffi_backend. So: */ + cffi_write_barrier(); + /* ^^^ we put a write barrier here, and a corresponding + read barrier at the start of cffi_call_python(). This + ensures that after that read barrier, we see everything + done here before the write barrier. + */ + + assert(_cffi_call_python_org != NULL); + _cffi_call_python = (_cffi_call_python_fnptr)_cffi_call_python_org; + } + else { + /* initialization failed. Reset this to NULL, even if it was + already set to some other value. Future calls to + _cffi_start_python() are still forced to occur, and will + always return NULL from now on. */ + _cffi_call_python_org = NULL; + } + } + + _cffi_release_reentrant_mutex(); + + return (_cffi_call_python_fnptr)_cffi_call_python_org; +} + +static +void _cffi_start_and_call_python(struct _cffi_externpy_s *externpy, char *args) +{ + _cffi_call_python_fnptr fnptr; + int current_err = errno; +#ifdef _MSC_VER + int current_lasterr = GetLastError(); +#endif + fnptr = _cffi_start_python(); + if (fnptr == NULL) { + fprintf(stderr, "function %s() called, but initialization code " + "failed. Returning 0.\n", externpy->name); + memset(args, 0, externpy->size_of_result); + } +#ifdef _MSC_VER + SetLastError(current_lasterr); +#endif + errno = current_err; + + if (fnptr != NULL) + fnptr(externpy, args); +} + + +/* The cffi_start_python() function makes sure Python is initialized + and our cffi module is set up. It can be called manually from the + user C code. The same effect is obtained automatically from any + dll-exported ``extern "Python"`` function. This function returns + -1 if initialization failed, 0 if all is OK. */ +_CFFI_UNUSED_FN +static int cffi_start_python(void) +{ + if (_cffi_call_python == &_cffi_start_and_call_python) { + if (_cffi_start_python() == NULL) + return -1; + } + cffi_read_barrier(); + return 0; +} + +#undef cffi_compare_and_swap +#undef cffi_write_barrier +#undef cffi_read_barrier + +#ifdef __cplusplus +} +#endif diff --git a/jwt/python/cffi/api.py b/jwt/python/cffi/api.py new file mode 100644 index 0000000..999a8ae --- /dev/null +++ b/jwt/python/cffi/api.py @@ -0,0 +1,965 @@ +import sys, types +from .lock import allocate_lock +from .error import CDefError +from . import model + +try: + callable +except NameError: + # Python 3.1 + from collections import Callable + callable = lambda x: isinstance(x, Callable) + +try: + basestring +except NameError: + # Python 3.x + basestring = str + +_unspecified = object() + + + +class FFI(object): + r''' + The main top-level class that you instantiate once, or once per module. + + Example usage: + + ffi = FFI() + ffi.cdef(""" + int printf(const char *, ...); + """) + + C = ffi.dlopen(None) # standard library + -or- + C = ffi.verify() # use a C compiler: verify the decl above is right + + C.printf("hello, %s!\n", ffi.new("char[]", "world")) + ''' + + def __init__(self, backend=None): + """Create an FFI instance. The 'backend' argument is used to + select a non-default backend, mostly for tests. + """ + if backend is None: + # You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with + # _cffi_backend.so compiled. + import _cffi_backend as backend + from . import __version__ + if backend.__version__ != __version__: + # bad version! Try to be as explicit as possible. + if hasattr(backend, '__file__'): + # CPython + raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r. The two versions should be equal; check your installation." % ( + __version__, __file__, + backend.__version__, backend.__file__)) + else: + # PyPy + raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. This interpreter comes with a built-in '_cffi_backend' module, which is version %s. The two versions should be equal; check your installation." % ( + __version__, __file__, backend.__version__)) + # (If you insist you can also try to pass the option + # 'backend=backend_ctypes.CTypesBackend()', but don't + # rely on it! It's probably not going to work well.) + + from . import cparser + self._backend = backend + self._lock = allocate_lock() + self._parser = cparser.Parser() + self._cached_btypes = {} + self._parsed_types = types.ModuleType('parsed_types').__dict__ + self._new_types = types.ModuleType('new_types').__dict__ + self._function_caches = [] + self._libraries = [] + self._cdefsources = [] + self._included_ffis = [] + self._windows_unicode = None + self._init_once_cache = {} + self._cdef_version = None + self._embedding = None + self._typecache = model.get_typecache(backend) + if hasattr(backend, 'set_ffi'): + backend.set_ffi(self) + for name in list(backend.__dict__): + if name.startswith('RTLD_'): + setattr(self, name, getattr(backend, name)) + # + with self._lock: + self.BVoidP = self._get_cached_btype(model.voidp_type) + self.BCharA = self._get_cached_btype(model.char_array_type) + if isinstance(backend, types.ModuleType): + # _cffi_backend: attach these constants to the class + if not hasattr(FFI, 'NULL'): + FFI.NULL = self.cast(self.BVoidP, 0) + FFI.CData, FFI.CType = backend._get_types() + else: + # ctypes backend: attach these constants to the instance + self.NULL = self.cast(self.BVoidP, 0) + self.CData, self.CType = backend._get_types() + self.buffer = backend.buffer + + def cdef(self, csource, override=False, packed=False, pack=None): + """Parse the given C source. This registers all declared functions, + types, and global variables. The functions and global variables can + then be accessed via either 'ffi.dlopen()' or 'ffi.verify()'. + The types can be used in 'ffi.new()' and other functions. + If 'packed' is specified as True, all structs declared inside this + cdef are packed, i.e. laid out without any field alignment at all. + Alternatively, 'pack' can be a small integer, and requests for + alignment greater than that are ignored (pack=1 is equivalent to + packed=True). + """ + self._cdef(csource, override=override, packed=packed, pack=pack) + + def embedding_api(self, csource, packed=False, pack=None): + self._cdef(csource, packed=packed, pack=pack, dllexport=True) + if self._embedding is None: + self._embedding = '' + + def _cdef(self, csource, override=False, **options): + if not isinstance(csource, str): # unicode, on Python 2 + if not isinstance(csource, basestring): + raise TypeError("cdef() argument must be a string") + csource = csource.encode('ascii') + with self._lock: + self._cdef_version = object() + self._parser.parse(csource, override=override, **options) + self._cdefsources.append(csource) + if override: + for cache in self._function_caches: + cache.clear() + finishlist = self._parser._recomplete + if finishlist: + self._parser._recomplete = [] + for tp in finishlist: + tp.finish_backend_type(self, finishlist) + + def dlopen(self, name, flags=0): + """Load and return a dynamic library identified by 'name'. + The standard C library can be loaded by passing None. + Note that functions and types declared by 'ffi.cdef()' are not + linked to a particular library, just like C headers; in the + library we only look for the actual (untyped) symbols. + """ + if not (isinstance(name, basestring) or + name is None or + isinstance(name, self.CData)): + raise TypeError("dlopen(name): name must be a file name, None, " + "or an already-opened 'void *' handle") + with self._lock: + lib, function_cache = _make_ffi_library(self, name, flags) + self._function_caches.append(function_cache) + self._libraries.append(lib) + return lib + + def dlclose(self, lib): + """Close a library obtained with ffi.dlopen(). After this call, + access to functions or variables from the library will fail + (possibly with a segmentation fault). + """ + type(lib).__cffi_close__(lib) + + def _typeof_locked(self, cdecl): + # call me with the lock! + key = cdecl + if key in self._parsed_types: + return self._parsed_types[key] + # + if not isinstance(cdecl, str): # unicode, on Python 2 + cdecl = cdecl.encode('ascii') + # + type = self._parser.parse_type(cdecl) + really_a_function_type = type.is_raw_function + if really_a_function_type: + type = type.as_function_pointer() + btype = self._get_cached_btype(type) + result = btype, really_a_function_type + self._parsed_types[key] = result + return result + + def _typeof(self, cdecl, consider_function_as_funcptr=False): + # string -> ctype object + try: + result = self._parsed_types[cdecl] + except KeyError: + with self._lock: + result = self._typeof_locked(cdecl) + # + btype, really_a_function_type = result + if really_a_function_type and not consider_function_as_funcptr: + raise CDefError("the type %r is a function type, not a " + "pointer-to-function type" % (cdecl,)) + return btype + + def typeof(self, cdecl): + """Parse the C type given as a string and return the + corresponding object. + It can also be used on 'cdata' instance to get its C type. + """ + if isinstance(cdecl, basestring): + return self._typeof(cdecl) + if isinstance(cdecl, self.CData): + return self._backend.typeof(cdecl) + if isinstance(cdecl, types.BuiltinFunctionType): + res = _builtin_function_type(cdecl) + if res is not None: + return res + if (isinstance(cdecl, types.FunctionType) + and hasattr(cdecl, '_cffi_base_type')): + with self._lock: + return self._get_cached_btype(cdecl._cffi_base_type) + raise TypeError(type(cdecl)) + + def sizeof(self, cdecl): + """Return the size in bytes of the argument. It can be a + string naming a C type, or a 'cdata' instance. + """ + if isinstance(cdecl, basestring): + BType = self._typeof(cdecl) + return self._backend.sizeof(BType) + else: + return self._backend.sizeof(cdecl) + + def alignof(self, cdecl): + """Return the natural alignment size in bytes of the C type + given as a string. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.alignof(cdecl) + + def offsetof(self, cdecl, *fields_or_indexes): + """Return the offset of the named field inside the given + structure or array, which must be given as a C type name. + You can give several field names in case of nested structures. + You can also give numeric values which correspond to array + items, in case of an array type. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._typeoffsetof(cdecl, *fields_or_indexes)[1] + + def new(self, cdecl, init=None): + """Allocate an instance according to the specified C type and + return a pointer to it. The specified C type must be either a + pointer or an array: ``new('X *')`` allocates an X and returns + a pointer to it, whereas ``new('X[n]')`` allocates an array of + n X'es and returns an array referencing it (which works + mostly like a pointer, like in C). You can also use + ``new('X[]', n)`` to allocate an array of a non-constant + length n. + + The memory is initialized following the rules of declaring a + global variable in C: by default it is zero-initialized, but + an explicit initializer can be given which can be used to + fill all or part of the memory. + + When the returned object goes out of scope, the memory + is freed. In other words the returned object has + ownership of the value of type 'cdecl' that it points to. This + means that the raw data can be used as long as this object is + kept alive, but must not be used for a longer time. Be careful + about that when copying the pointer to the memory somewhere + else, e.g. into another structure. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.newp(cdecl, init) + + def new_allocator(self, alloc=None, free=None, + should_clear_after_alloc=True): + """Return a new allocator, i.e. a function that behaves like ffi.new() + but uses the provided low-level 'alloc' and 'free' functions. + + 'alloc' is called with the size as argument. If it returns NULL, a + MemoryError is raised. 'free' is called with the result of 'alloc' + as argument. Both can be either Python function or directly C + functions. If 'free' is None, then no free function is called. + If both 'alloc' and 'free' are None, the default is used. + + If 'should_clear_after_alloc' is set to False, then the memory + returned by 'alloc' is assumed to be already cleared (or you are + fine with garbage); otherwise CFFI will clear it. + """ + compiled_ffi = self._backend.FFI() + allocator = compiled_ffi.new_allocator(alloc, free, + should_clear_after_alloc) + def allocate(cdecl, init=None): + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return allocator(cdecl, init) + return allocate + + def cast(self, cdecl, source): + """Similar to a C cast: returns an instance of the named C + type initialized with the given 'source'. The source is + casted between integers or pointers of any type. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.cast(cdecl, source) + + def string(self, cdata, maxlen=-1): + """Return a Python string (or unicode string) from the 'cdata'. + If 'cdata' is a pointer or array of characters or bytes, returns + the null-terminated string. The returned string extends until + the first null character, or at most 'maxlen' characters. If + 'cdata' is an array then 'maxlen' defaults to its length. + + If 'cdata' is a pointer or array of wchar_t, returns a unicode + string following the same rules. + + If 'cdata' is a single character or byte or a wchar_t, returns + it as a string or unicode string. + + If 'cdata' is an enum, returns the value of the enumerator as a + string, or 'NUMBER' if the value is out of range. + """ + return self._backend.string(cdata, maxlen) + + def unpack(self, cdata, length): + """Unpack an array of C data of the given length, + returning a Python string/unicode/list. + + If 'cdata' is a pointer to 'char', returns a byte string. + It does not stop at the first null. This is equivalent to: + ffi.buffer(cdata, length)[:] + + If 'cdata' is a pointer to 'wchar_t', returns a unicode string. + 'length' is measured in wchar_t's; it is not the size in bytes. + + If 'cdata' is a pointer to anything else, returns a list of + 'length' items. This is a faster equivalent to: + [cdata[i] for i in range(length)] + """ + return self._backend.unpack(cdata, length) + + #def buffer(self, cdata, size=-1): + # """Return a read-write buffer object that references the raw C data + # pointed to by the given 'cdata'. The 'cdata' must be a pointer or + # an array. Can be passed to functions expecting a buffer, or directly + # manipulated with: + # + # buf[:] get a copy of it in a regular string, or + # buf[idx] as a single character + # buf[:] = ... + # buf[idx] = ... change the content + # """ + # note that 'buffer' is a type, set on this instance by __init__ + + def from_buffer(self, cdecl, python_buffer=_unspecified, + require_writable=False): + """Return a cdata of the given type pointing to the data of the + given Python object, which must support the buffer interface. + Note that this is not meant to be used on the built-in types + str or unicode (you can build 'char[]' arrays explicitly) + but only on objects containing large quantities of raw data + in some other format, like 'array.array' or numpy arrays. + + The first argument is optional and default to 'char[]'. + """ + if python_buffer is _unspecified: + cdecl, python_buffer = self.BCharA, cdecl + elif isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + return self._backend.from_buffer(cdecl, python_buffer, + require_writable) + + def memmove(self, dest, src, n): + """ffi.memmove(dest, src, n) copies n bytes of memory from src to dest. + + Like the C function memmove(), the memory areas may overlap; + apart from that it behaves like the C function memcpy(). + + 'src' can be any cdata ptr or array, or any Python buffer object. + 'dest' can be any cdata ptr or array, or a writable Python buffer + object. The size to copy, 'n', is always measured in bytes. + + Unlike other methods, this one supports all Python buffer including + byte strings and bytearrays---but it still does not support + non-contiguous buffers. + """ + return self._backend.memmove(dest, src, n) + + def callback(self, cdecl, python_callable=None, error=None, onerror=None): + """Return a callback object or a decorator making such a + callback object. 'cdecl' must name a C function pointer type. + The callback invokes the specified 'python_callable' (which may + be provided either directly or via a decorator). Important: the + callback object must be manually kept alive for as long as the + callback may be invoked from the C level. + """ + def callback_decorator_wrap(python_callable): + if not callable(python_callable): + raise TypeError("the 'python_callable' argument " + "is not callable") + return self._backend.callback(cdecl, python_callable, + error, onerror) + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl, consider_function_as_funcptr=True) + if python_callable is None: + return callback_decorator_wrap # decorator mode + else: + return callback_decorator_wrap(python_callable) # direct mode + + def getctype(self, cdecl, replace_with=''): + """Return a string giving the C type 'cdecl', which may be itself + a string or a object. If 'replace_with' is given, it gives + extra text to append (or insert for more complicated C types), like + a variable name, or '*' to get actually the C type 'pointer-to-cdecl'. + """ + if isinstance(cdecl, basestring): + cdecl = self._typeof(cdecl) + replace_with = replace_with.strip() + if (replace_with.startswith('*') + and '&[' in self._backend.getcname(cdecl, '&')): + replace_with = '(%s)' % replace_with + elif replace_with and not replace_with[0] in '[(': + replace_with = ' ' + replace_with + return self._backend.getcname(cdecl, replace_with) + + def gc(self, cdata, destructor, size=0): + """Return a new cdata object that points to the same + data. Later, when this new cdata object is garbage-collected, + 'destructor(old_cdata_object)' will be called. + + The optional 'size' gives an estimate of the size, used to + trigger the garbage collection more eagerly. So far only used + on PyPy. It tells the GC that the returned object keeps alive + roughly 'size' bytes of external memory. + """ + return self._backend.gcp(cdata, destructor, size) + + def _get_cached_btype(self, type): + assert self._lock.acquire(False) is False + # call me with the lock! + try: + BType = self._cached_btypes[type] + except KeyError: + finishlist = [] + BType = type.get_cached_btype(self, finishlist) + for type in finishlist: + type.finish_backend_type(self, finishlist) + return BType + + def verify(self, source='', tmpdir=None, **kwargs): + """Verify that the current ffi signatures compile on this + machine, and return a dynamic library object. The dynamic + library can be used to call functions and access global + variables declared in this 'ffi'. The library is compiled + by the C compiler: it gives you C-level API compatibility + (including calling macros). This is unlike 'ffi.dlopen()', + which requires binary compatibility in the signatures. + """ + from .verifier import Verifier, _caller_dir_pycache + # + # If set_unicode(True) was called, insert the UNICODE and + # _UNICODE macro declarations + if self._windows_unicode: + self._apply_windows_unicode(kwargs) + # + # Set the tmpdir here, and not in Verifier.__init__: it picks + # up the caller's directory, which we want to be the caller of + # ffi.verify(), as opposed to the caller of Veritier(). + tmpdir = tmpdir or _caller_dir_pycache() + # + # Make a Verifier() and use it to load the library. + self.verifier = Verifier(self, source, tmpdir, **kwargs) + lib = self.verifier.load_library() + # + # Save the loaded library for keep-alive purposes, even + # if the caller doesn't keep it alive itself (it should). + self._libraries.append(lib) + return lib + + def _get_errno(self): + return self._backend.get_errno() + def _set_errno(self, errno): + self._backend.set_errno(errno) + errno = property(_get_errno, _set_errno, None, + "the value of 'errno' from/to the C calls") + + def getwinerror(self, code=-1): + return self._backend.getwinerror(code) + + def _pointer_to(self, ctype): + with self._lock: + return model.pointer_cache(self, ctype) + + def addressof(self, cdata, *fields_or_indexes): + """Return the address of a . + If 'fields_or_indexes' are given, returns the address of that + field or array item in the structure or array, recursively in + case of nested structures. + """ + try: + ctype = self._backend.typeof(cdata) + except TypeError: + if '__addressof__' in type(cdata).__dict__: + return type(cdata).__addressof__(cdata, *fields_or_indexes) + raise + if fields_or_indexes: + ctype, offset = self._typeoffsetof(ctype, *fields_or_indexes) + else: + if ctype.kind == "pointer": + raise TypeError("addressof(pointer)") + offset = 0 + ctypeptr = self._pointer_to(ctype) + return self._backend.rawaddressof(ctypeptr, cdata, offset) + + def _typeoffsetof(self, ctype, field_or_index, *fields_or_indexes): + ctype, offset = self._backend.typeoffsetof(ctype, field_or_index) + for field1 in fields_or_indexes: + ctype, offset1 = self._backend.typeoffsetof(ctype, field1, 1) + offset += offset1 + return ctype, offset + + def include(self, ffi_to_include): + """Includes the typedefs, structs, unions and enums defined + in another FFI instance. Usage is similar to a #include in C, + where a part of the program might include types defined in + another part for its own usage. Note that the include() + method has no effect on functions, constants and global + variables, which must anyway be accessed directly from the + lib object returned by the original FFI instance. + """ + if not isinstance(ffi_to_include, FFI): + raise TypeError("ffi.include() expects an argument that is also of" + " type cffi.FFI, not %r" % ( + type(ffi_to_include).__name__,)) + if ffi_to_include is self: + raise ValueError("self.include(self)") + with ffi_to_include._lock: + with self._lock: + self._parser.include(ffi_to_include._parser) + self._cdefsources.append('[') + self._cdefsources.extend(ffi_to_include._cdefsources) + self._cdefsources.append(']') + self._included_ffis.append(ffi_to_include) + + def new_handle(self, x): + return self._backend.newp_handle(self.BVoidP, x) + + def from_handle(self, x): + return self._backend.from_handle(x) + + def release(self, x): + self._backend.release(x) + + def set_unicode(self, enabled_flag): + """Windows: if 'enabled_flag' is True, enable the UNICODE and + _UNICODE defines in C, and declare the types like TCHAR and LPTCSTR + to be (pointers to) wchar_t. If 'enabled_flag' is False, + declare these types to be (pointers to) plain 8-bit characters. + This is mostly for backward compatibility; you usually want True. + """ + if self._windows_unicode is not None: + raise ValueError("set_unicode() can only be called once") + enabled_flag = bool(enabled_flag) + if enabled_flag: + self.cdef("typedef wchar_t TBYTE;" + "typedef wchar_t TCHAR;" + "typedef const wchar_t *LPCTSTR;" + "typedef const wchar_t *PCTSTR;" + "typedef wchar_t *LPTSTR;" + "typedef wchar_t *PTSTR;" + "typedef TBYTE *PTBYTE;" + "typedef TCHAR *PTCHAR;") + else: + self.cdef("typedef char TBYTE;" + "typedef char TCHAR;" + "typedef const char *LPCTSTR;" + "typedef const char *PCTSTR;" + "typedef char *LPTSTR;" + "typedef char *PTSTR;" + "typedef TBYTE *PTBYTE;" + "typedef TCHAR *PTCHAR;") + self._windows_unicode = enabled_flag + + def _apply_windows_unicode(self, kwds): + defmacros = kwds.get('define_macros', ()) + if not isinstance(defmacros, (list, tuple)): + raise TypeError("'define_macros' must be a list or tuple") + defmacros = list(defmacros) + [('UNICODE', '1'), + ('_UNICODE', '1')] + kwds['define_macros'] = defmacros + + def _apply_embedding_fix(self, kwds): + # must include an argument like "-lpython2.7" for the compiler + def ensure(key, value): + lst = kwds.setdefault(key, []) + if value not in lst: + lst.append(value) + # + if '__pypy__' in sys.builtin_module_names: + import os + if sys.platform == "win32": + # we need 'libpypy-c.lib'. Current distributions of + # pypy (>= 4.1) contain it as 'libs/python27.lib'. + pythonlib = "python{0[0]}{0[1]}".format(sys.version_info) + if hasattr(sys, 'prefix'): + ensure('library_dirs', os.path.join(sys.prefix, 'libs')) + else: + # we need 'libpypy-c.{so,dylib}', which should be by + # default located in 'sys.prefix/bin' for installed + # systems. + if sys.version_info < (3,): + pythonlib = "pypy-c" + else: + pythonlib = "pypy3-c" + if hasattr(sys, 'prefix'): + ensure('library_dirs', os.path.join(sys.prefix, 'bin')) + # On uninstalled pypy's, the libpypy-c is typically found in + # .../pypy/goal/. + if hasattr(sys, 'prefix'): + ensure('library_dirs', os.path.join(sys.prefix, 'pypy', 'goal')) + else: + if sys.platform == "win32": + template = "python%d%d" + if hasattr(sys, 'gettotalrefcount'): + template += '_d' + else: + try: + import sysconfig + except ImportError: # 2.6 + from distutils import sysconfig + template = "python%d.%d" + if sysconfig.get_config_var('DEBUG_EXT'): + template += sysconfig.get_config_var('DEBUG_EXT') + pythonlib = (template % + (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) + if hasattr(sys, 'abiflags'): + pythonlib += sys.abiflags + ensure('libraries', pythonlib) + if sys.platform == "win32": + ensure('extra_link_args', '/MANIFEST') + + def set_source(self, module_name, source, source_extension='.c', **kwds): + import os + if hasattr(self, '_assigned_source'): + raise ValueError("set_source() cannot be called several times " + "per ffi object") + if not isinstance(module_name, basestring): + raise TypeError("'module_name' must be a string") + if os.sep in module_name or (os.altsep and os.altsep in module_name): + raise ValueError("'module_name' must not contain '/': use a dotted " + "name to make a 'package.module' location") + self._assigned_source = (str(module_name), source, + source_extension, kwds) + + def set_source_pkgconfig(self, module_name, pkgconfig_libs, source, + source_extension='.c', **kwds): + from . import pkgconfig + if not isinstance(pkgconfig_libs, list): + raise TypeError("the pkgconfig_libs argument must be a list " + "of package names") + kwds2 = pkgconfig.flags_from_pkgconfig(pkgconfig_libs) + pkgconfig.merge_flags(kwds, kwds2) + self.set_source(module_name, source, source_extension, **kwds) + + def distutils_extension(self, tmpdir='build', verbose=True): + from distutils.dir_util import mkpath + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + if hasattr(self, 'verifier'): # fallback, 'tmpdir' ignored + return self.verifier.get_extension() + raise ValueError("set_source() must be called before" + " distutils_extension()") + module_name, source, source_extension, kwds = self._assigned_source + if source is None: + raise TypeError("distutils_extension() is only for C extension " + "modules, not for dlopen()-style pure Python " + "modules") + mkpath(tmpdir) + ext, updated = recompile(self, module_name, + source, tmpdir=tmpdir, extradir=tmpdir, + source_extension=source_extension, + call_c_compiler=False, **kwds) + if verbose: + if updated: + sys.stderr.write("regenerated: %r\n" % (ext.sources[0],)) + else: + sys.stderr.write("not modified: %r\n" % (ext.sources[0],)) + return ext + + def emit_c_code(self, filename): + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + raise ValueError("set_source() must be called before emit_c_code()") + module_name, source, source_extension, kwds = self._assigned_source + if source is None: + raise TypeError("emit_c_code() is only for C extension modules, " + "not for dlopen()-style pure Python modules") + recompile(self, module_name, source, + c_file=filename, call_c_compiler=False, **kwds) + + def emit_python_code(self, filename): + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + raise ValueError("set_source() must be called before emit_c_code()") + module_name, source, source_extension, kwds = self._assigned_source + if source is not None: + raise TypeError("emit_python_code() is only for dlopen()-style " + "pure Python modules, not for C extension modules") + recompile(self, module_name, source, + c_file=filename, call_c_compiler=False, **kwds) + + def compile(self, tmpdir='.', verbose=0, target=None, debug=None): + """The 'target' argument gives the final file name of the + compiled DLL. Use '*' to force distutils' choice, suitable for + regular CPython C API modules. Use a file name ending in '.*' + to ask for the system's default extension for dynamic libraries + (.so/.dll/.dylib). + + The default is '*' when building a non-embedded C API extension, + and (module_name + '.*') when building an embedded library. + """ + from .recompiler import recompile + # + if not hasattr(self, '_assigned_source'): + raise ValueError("set_source() must be called before compile()") + module_name, source, source_extension, kwds = self._assigned_source + return recompile(self, module_name, source, tmpdir=tmpdir, + target=target, source_extension=source_extension, + compiler_verbose=verbose, debug=debug, **kwds) + + def init_once(self, func, tag): + # Read _init_once_cache[tag], which is either (False, lock) if + # we're calling the function now in some thread, or (True, result). + # Don't call setdefault() in most cases, to avoid allocating and + # immediately freeing a lock; but still use setdefaut() to avoid + # races. + try: + x = self._init_once_cache[tag] + except KeyError: + x = self._init_once_cache.setdefault(tag, (False, allocate_lock())) + # Common case: we got (True, result), so we return the result. + if x[0]: + return x[1] + # Else, it's a lock. Acquire it to serialize the following tests. + with x[1]: + # Read again from _init_once_cache the current status. + x = self._init_once_cache[tag] + if x[0]: + return x[1] + # Call the function and store the result back. + result = func() + self._init_once_cache[tag] = (True, result) + return result + + def embedding_init_code(self, pysource): + if self._embedding: + raise ValueError("embedding_init_code() can only be called once") + # fix 'pysource' before it gets dumped into the C file: + # - remove empty lines at the beginning, so it starts at "line 1" + # - dedent, if all non-empty lines are indented + # - check for SyntaxErrors + import re + match = re.match(r'\s*\n', pysource) + if match: + pysource = pysource[match.end():] + lines = pysource.splitlines() or [''] + prefix = re.match(r'\s*', lines[0]).group() + for i in range(1, len(lines)): + line = lines[i] + if line.rstrip(): + while not line.startswith(prefix): + prefix = prefix[:-1] + i = len(prefix) + lines = [line[i:]+'\n' for line in lines] + pysource = ''.join(lines) + # + compile(pysource, "cffi_init", "exec") + # + self._embedding = pysource + + def def_extern(self, *args, **kwds): + raise ValueError("ffi.def_extern() is only available on API-mode FFI " + "objects") + + def list_types(self): + """Returns the user type names known to this FFI instance. + This returns a tuple containing three lists of names: + (typedef_names, names_of_structs, names_of_unions) + """ + typedefs = [] + structs = [] + unions = [] + for key in self._parser._declarations: + if key.startswith('typedef '): + typedefs.append(key[8:]) + elif key.startswith('struct '): + structs.append(key[7:]) + elif key.startswith('union '): + unions.append(key[6:]) + typedefs.sort() + structs.sort() + unions.sort() + return (typedefs, structs, unions) + + +def _load_backend_lib(backend, name, flags): + import os + if not isinstance(name, basestring): + if sys.platform != "win32" or name is not None: + return backend.load_library(name, flags) + name = "c" # Windows: load_library(None) fails, but this works + # on Python 2 (backward compatibility hack only) + first_error = None + if '.' in name or '/' in name or os.sep in name: + try: + return backend.load_library(name, flags) + except OSError as e: + first_error = e + import ctypes.util + path = ctypes.util.find_library(name) + if path is None: + if name == "c" and sys.platform == "win32" and sys.version_info >= (3,): + raise OSError("dlopen(None) cannot work on Windows for Python 3 " + "(see http://bugs.python.org/issue23606)") + msg = ("ctypes.util.find_library() did not manage " + "to locate a library called %r" % (name,)) + if first_error is not None: + msg = "%s. Additionally, %s" % (first_error, msg) + raise OSError(msg) + return backend.load_library(path, flags) + +def _make_ffi_library(ffi, libname, flags): + backend = ffi._backend + backendlib = _load_backend_lib(backend, libname, flags) + # + def accessor_function(name): + key = 'function ' + name + tp, _ = ffi._parser._declarations[key] + BType = ffi._get_cached_btype(tp) + value = backendlib.load_function(BType, name) + library.__dict__[name] = value + # + def accessor_variable(name): + key = 'variable ' + name + tp, _ = ffi._parser._declarations[key] + BType = ffi._get_cached_btype(tp) + read_variable = backendlib.read_variable + write_variable = backendlib.write_variable + setattr(FFILibrary, name, property( + lambda self: read_variable(BType, name), + lambda self, value: write_variable(BType, name, value))) + # + def addressof_var(name): + try: + return addr_variables[name] + except KeyError: + with ffi._lock: + if name not in addr_variables: + key = 'variable ' + name + tp, _ = ffi._parser._declarations[key] + BType = ffi._get_cached_btype(tp) + if BType.kind != 'array': + BType = model.pointer_cache(ffi, BType) + p = backendlib.load_function(BType, name) + addr_variables[name] = p + return addr_variables[name] + # + def accessor_constant(name): + raise NotImplementedError("non-integer constant '%s' cannot be " + "accessed from a dlopen() library" % (name,)) + # + def accessor_int_constant(name): + library.__dict__[name] = ffi._parser._int_constants[name] + # + accessors = {} + accessors_version = [False] + addr_variables = {} + # + def update_accessors(): + if accessors_version[0] is ffi._cdef_version: + return + # + for key, (tp, _) in ffi._parser._declarations.items(): + if not isinstance(tp, model.EnumType): + tag, name = key.split(' ', 1) + if tag == 'function': + accessors[name] = accessor_function + elif tag == 'variable': + accessors[name] = accessor_variable + elif tag == 'constant': + accessors[name] = accessor_constant + else: + for i, enumname in enumerate(tp.enumerators): + def accessor_enum(name, tp=tp, i=i): + tp.check_not_partial() + library.__dict__[name] = tp.enumvalues[i] + accessors[enumname] = accessor_enum + for name in ffi._parser._int_constants: + accessors.setdefault(name, accessor_int_constant) + accessors_version[0] = ffi._cdef_version + # + def make_accessor(name): + with ffi._lock: + if name in library.__dict__ or name in FFILibrary.__dict__: + return # added by another thread while waiting for the lock + if name not in accessors: + update_accessors() + if name not in accessors: + raise AttributeError(name) + accessors[name](name) + # + class FFILibrary(object): + def __getattr__(self, name): + make_accessor(name) + return getattr(self, name) + def __setattr__(self, name, value): + try: + property = getattr(self.__class__, name) + except AttributeError: + make_accessor(name) + setattr(self, name, value) + else: + property.__set__(self, value) + def __dir__(self): + with ffi._lock: + update_accessors() + return accessors.keys() + def __addressof__(self, name): + if name in library.__dict__: + return library.__dict__[name] + if name in FFILibrary.__dict__: + return addressof_var(name) + make_accessor(name) + if name in library.__dict__: + return library.__dict__[name] + if name in FFILibrary.__dict__: + return addressof_var(name) + raise AttributeError("cffi library has no function or " + "global variable named '%s'" % (name,)) + def __cffi_close__(self): + backendlib.close_lib() + self.__dict__.clear() + # + if isinstance(libname, basestring): + try: + if not isinstance(libname, str): # unicode, on Python 2 + libname = libname.encode('utf-8') + FFILibrary.__name__ = 'FFILibrary_%s' % libname + except UnicodeError: + pass + library = FFILibrary() + return library, library.__dict__ + +def _builtin_function_type(func): + # a hack to make at least ffi.typeof(builtin_function) work, + # if the builtin function was obtained by 'vengine_cpy'. + import sys + try: + module = sys.modules[func.__module__] + ffi = module._cffi_original_ffi + types_of_builtin_funcs = module._cffi_types_of_builtin_funcs + tp = types_of_builtin_funcs[func] + except (KeyError, AttributeError, TypeError): + return None + else: + with ffi._lock: + return ffi._get_cached_btype(tp) diff --git a/jwt/python/cffi/backend_ctypes.py b/jwt/python/cffi/backend_ctypes.py new file mode 100644 index 0000000..e7956a7 --- /dev/null +++ b/jwt/python/cffi/backend_ctypes.py @@ -0,0 +1,1121 @@ +import ctypes, ctypes.util, operator, sys +from . import model + +if sys.version_info < (3,): + bytechr = chr +else: + unicode = str + long = int + xrange = range + bytechr = lambda num: bytes([num]) + +class CTypesType(type): + pass + +class CTypesData(object): + __metaclass__ = CTypesType + __slots__ = ['__weakref__'] + __name__ = '' + + def __init__(self, *args): + raise TypeError("cannot instantiate %r" % (self.__class__,)) + + @classmethod + def _newp(cls, init): + raise TypeError("expected a pointer or array ctype, got '%s'" + % (cls._get_c_name(),)) + + @staticmethod + def _to_ctypes(value): + raise TypeError + + @classmethod + def _arg_to_ctypes(cls, *value): + try: + ctype = cls._ctype + except AttributeError: + raise TypeError("cannot create an instance of %r" % (cls,)) + if value: + res = cls._to_ctypes(*value) + if not isinstance(res, ctype): + res = cls._ctype(res) + else: + res = cls._ctype() + return res + + @classmethod + def _create_ctype_obj(cls, init): + if init is None: + return cls._arg_to_ctypes() + else: + return cls._arg_to_ctypes(init) + + @staticmethod + def _from_ctypes(ctypes_value): + raise TypeError + + @classmethod + def _get_c_name(cls, replace_with=''): + return cls._reftypename.replace(' &', replace_with) + + @classmethod + def _fix_class(cls): + cls.__name__ = 'CData<%s>' % (cls._get_c_name(),) + cls.__qualname__ = 'CData<%s>' % (cls._get_c_name(),) + cls.__module__ = 'ffi' + + def _get_own_repr(self): + raise NotImplementedError + + def _addr_repr(self, address): + if address == 0: + return 'NULL' + else: + if address < 0: + address += 1 << (8*ctypes.sizeof(ctypes.c_void_p)) + return '0x%x' % address + + def __repr__(self, c_name=None): + own = self._get_own_repr() + return '' % (c_name or self._get_c_name(), own) + + def _convert_to_address(self, BClass): + if BClass is None: + raise TypeError("cannot convert %r to an address" % ( + self._get_c_name(),)) + else: + raise TypeError("cannot convert %r to %r" % ( + self._get_c_name(), BClass._get_c_name())) + + @classmethod + def _get_size(cls): + return ctypes.sizeof(cls._ctype) + + def _get_size_of_instance(self): + return ctypes.sizeof(self._ctype) + + @classmethod + def _cast_from(cls, source): + raise TypeError("cannot cast to %r" % (cls._get_c_name(),)) + + def _cast_to_integer(self): + return self._convert_to_address(None) + + @classmethod + def _alignment(cls): + return ctypes.alignment(cls._ctype) + + def __iter__(self): + raise TypeError("cdata %r does not support iteration" % ( + self._get_c_name()),) + + def _make_cmp(name): + cmpfunc = getattr(operator, name) + def cmp(self, other): + v_is_ptr = not isinstance(self, CTypesGenericPrimitive) + w_is_ptr = (isinstance(other, CTypesData) and + not isinstance(other, CTypesGenericPrimitive)) + if v_is_ptr and w_is_ptr: + return cmpfunc(self._convert_to_address(None), + other._convert_to_address(None)) + elif v_is_ptr or w_is_ptr: + return NotImplemented + else: + if isinstance(self, CTypesGenericPrimitive): + self = self._value + if isinstance(other, CTypesGenericPrimitive): + other = other._value + return cmpfunc(self, other) + cmp.func_name = name + return cmp + + __eq__ = _make_cmp('__eq__') + __ne__ = _make_cmp('__ne__') + __lt__ = _make_cmp('__lt__') + __le__ = _make_cmp('__le__') + __gt__ = _make_cmp('__gt__') + __ge__ = _make_cmp('__ge__') + + def __hash__(self): + return hash(self._convert_to_address(None)) + + def _to_string(self, maxlen): + raise TypeError("string(): %r" % (self,)) + + +class CTypesGenericPrimitive(CTypesData): + __slots__ = [] + + def __hash__(self): + return hash(self._value) + + def _get_own_repr(self): + return repr(self._from_ctypes(self._value)) + + +class CTypesGenericArray(CTypesData): + __slots__ = [] + + @classmethod + def _newp(cls, init): + return cls(init) + + def __iter__(self): + for i in xrange(len(self)): + yield self[i] + + def _get_own_repr(self): + return self._addr_repr(ctypes.addressof(self._blob)) + + +class CTypesGenericPtr(CTypesData): + __slots__ = ['_address', '_as_ctype_ptr'] + _automatic_casts = False + kind = "pointer" + + @classmethod + def _newp(cls, init): + return cls(init) + + @classmethod + def _cast_from(cls, source): + if source is None: + address = 0 + elif isinstance(source, CTypesData): + address = source._cast_to_integer() + elif isinstance(source, (int, long)): + address = source + else: + raise TypeError("bad type for cast to %r: %r" % + (cls, type(source).__name__)) + return cls._new_pointer_at(address) + + @classmethod + def _new_pointer_at(cls, address): + self = cls.__new__(cls) + self._address = address + self._as_ctype_ptr = ctypes.cast(address, cls._ctype) + return self + + def _get_own_repr(self): + try: + return self._addr_repr(self._address) + except AttributeError: + return '???' + + def _cast_to_integer(self): + return self._address + + def __nonzero__(self): + return bool(self._address) + __bool__ = __nonzero__ + + @classmethod + def _to_ctypes(cls, value): + if not isinstance(value, CTypesData): + raise TypeError("unexpected %s object" % type(value).__name__) + address = value._convert_to_address(cls) + return ctypes.cast(address, cls._ctype) + + @classmethod + def _from_ctypes(cls, ctypes_ptr): + address = ctypes.cast(ctypes_ptr, ctypes.c_void_p).value or 0 + return cls._new_pointer_at(address) + + @classmethod + def _initialize(cls, ctypes_ptr, value): + if value: + ctypes_ptr.contents = cls._to_ctypes(value).contents + + def _convert_to_address(self, BClass): + if (BClass in (self.__class__, None) or BClass._automatic_casts + or self._automatic_casts): + return self._address + else: + return CTypesData._convert_to_address(self, BClass) + + +class CTypesBaseStructOrUnion(CTypesData): + __slots__ = ['_blob'] + + @classmethod + def _create_ctype_obj(cls, init): + # may be overridden + raise TypeError("cannot instantiate opaque type %s" % (cls,)) + + def _get_own_repr(self): + return self._addr_repr(ctypes.addressof(self._blob)) + + @classmethod + def _offsetof(cls, fieldname): + return getattr(cls._ctype, fieldname).offset + + def _convert_to_address(self, BClass): + if getattr(BClass, '_BItem', None) is self.__class__: + return ctypes.addressof(self._blob) + else: + return CTypesData._convert_to_address(self, BClass) + + @classmethod + def _from_ctypes(cls, ctypes_struct_or_union): + self = cls.__new__(cls) + self._blob = ctypes_struct_or_union + return self + + @classmethod + def _to_ctypes(cls, value): + return value._blob + + def __repr__(self, c_name=None): + return CTypesData.__repr__(self, c_name or self._get_c_name(' &')) + + +class CTypesBackend(object): + + PRIMITIVE_TYPES = { + 'char': ctypes.c_char, + 'short': ctypes.c_short, + 'int': ctypes.c_int, + 'long': ctypes.c_long, + 'long long': ctypes.c_longlong, + 'signed char': ctypes.c_byte, + 'unsigned char': ctypes.c_ubyte, + 'unsigned short': ctypes.c_ushort, + 'unsigned int': ctypes.c_uint, + 'unsigned long': ctypes.c_ulong, + 'unsigned long long': ctypes.c_ulonglong, + 'float': ctypes.c_float, + 'double': ctypes.c_double, + '_Bool': ctypes.c_bool, + } + + for _name in ['unsigned long long', 'unsigned long', + 'unsigned int', 'unsigned short', 'unsigned char']: + _size = ctypes.sizeof(PRIMITIVE_TYPES[_name]) + PRIMITIVE_TYPES['uint%d_t' % (8*_size)] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_void_p): + PRIMITIVE_TYPES['uintptr_t'] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_size_t): + PRIMITIVE_TYPES['size_t'] = PRIMITIVE_TYPES[_name] + + for _name in ['long long', 'long', 'int', 'short', 'signed char']: + _size = ctypes.sizeof(PRIMITIVE_TYPES[_name]) + PRIMITIVE_TYPES['int%d_t' % (8*_size)] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_void_p): + PRIMITIVE_TYPES['intptr_t'] = PRIMITIVE_TYPES[_name] + PRIMITIVE_TYPES['ptrdiff_t'] = PRIMITIVE_TYPES[_name] + if _size == ctypes.sizeof(ctypes.c_size_t): + PRIMITIVE_TYPES['ssize_t'] = PRIMITIVE_TYPES[_name] + + + def __init__(self): + self.RTLD_LAZY = 0 # not supported anyway by ctypes + self.RTLD_NOW = 0 + self.RTLD_GLOBAL = ctypes.RTLD_GLOBAL + self.RTLD_LOCAL = ctypes.RTLD_LOCAL + + def set_ffi(self, ffi): + self.ffi = ffi + + def _get_types(self): + return CTypesData, CTypesType + + def load_library(self, path, flags=0): + cdll = ctypes.CDLL(path, flags) + return CTypesLibrary(self, cdll) + + def new_void_type(self): + class CTypesVoid(CTypesData): + __slots__ = [] + _reftypename = 'void &' + @staticmethod + def _from_ctypes(novalue): + return None + @staticmethod + def _to_ctypes(novalue): + if novalue is not None: + raise TypeError("None expected, got %s object" % + (type(novalue).__name__,)) + return None + CTypesVoid._fix_class() + return CTypesVoid + + def new_primitive_type(self, name): + if name == 'wchar_t': + raise NotImplementedError(name) + ctype = self.PRIMITIVE_TYPES[name] + if name == 'char': + kind = 'char' + elif name in ('float', 'double'): + kind = 'float' + else: + if name in ('signed char', 'unsigned char'): + kind = 'byte' + elif name == '_Bool': + kind = 'bool' + else: + kind = 'int' + is_signed = (ctype(-1).value == -1) + # + def _cast_source_to_int(source): + if isinstance(source, (int, long, float)): + source = int(source) + elif isinstance(source, CTypesData): + source = source._cast_to_integer() + elif isinstance(source, bytes): + source = ord(source) + elif source is None: + source = 0 + else: + raise TypeError("bad type for cast to %r: %r" % + (CTypesPrimitive, type(source).__name__)) + return source + # + kind1 = kind + class CTypesPrimitive(CTypesGenericPrimitive): + __slots__ = ['_value'] + _ctype = ctype + _reftypename = '%s &' % name + kind = kind1 + + def __init__(self, value): + self._value = value + + @staticmethod + def _create_ctype_obj(init): + if init is None: + return ctype() + return ctype(CTypesPrimitive._to_ctypes(init)) + + if kind == 'int' or kind == 'byte': + @classmethod + def _cast_from(cls, source): + source = _cast_source_to_int(source) + source = ctype(source).value # cast within range + return cls(source) + def __int__(self): + return self._value + + if kind == 'bool': + @classmethod + def _cast_from(cls, source): + if not isinstance(source, (int, long, float)): + source = _cast_source_to_int(source) + return cls(bool(source)) + def __int__(self): + return int(self._value) + + if kind == 'char': + @classmethod + def _cast_from(cls, source): + source = _cast_source_to_int(source) + source = bytechr(source & 0xFF) + return cls(source) + def __int__(self): + return ord(self._value) + + if kind == 'float': + @classmethod + def _cast_from(cls, source): + if isinstance(source, float): + pass + elif isinstance(source, CTypesGenericPrimitive): + if hasattr(source, '__float__'): + source = float(source) + else: + source = int(source) + else: + source = _cast_source_to_int(source) + source = ctype(source).value # fix precision + return cls(source) + def __int__(self): + return int(self._value) + def __float__(self): + return self._value + + _cast_to_integer = __int__ + + if kind == 'int' or kind == 'byte' or kind == 'bool': + @staticmethod + def _to_ctypes(x): + if not isinstance(x, (int, long)): + if isinstance(x, CTypesData): + x = int(x) + else: + raise TypeError("integer expected, got %s" % + type(x).__name__) + if ctype(x).value != x: + if not is_signed and x < 0: + raise OverflowError("%s: negative integer" % name) + else: + raise OverflowError("%s: integer out of bounds" + % name) + return x + + if kind == 'char': + @staticmethod + def _to_ctypes(x): + if isinstance(x, bytes) and len(x) == 1: + return x + if isinstance(x, CTypesPrimitive): # > + return x._value + raise TypeError("character expected, got %s" % + type(x).__name__) + def __nonzero__(self): + return ord(self._value) != 0 + else: + def __nonzero__(self): + return self._value != 0 + __bool__ = __nonzero__ + + if kind == 'float': + @staticmethod + def _to_ctypes(x): + if not isinstance(x, (int, long, float, CTypesData)): + raise TypeError("float expected, got %s" % + type(x).__name__) + return ctype(x).value + + @staticmethod + def _from_ctypes(value): + return getattr(value, 'value', value) + + @staticmethod + def _initialize(blob, init): + blob.value = CTypesPrimitive._to_ctypes(init) + + if kind == 'char': + def _to_string(self, maxlen): + return self._value + if kind == 'byte': + def _to_string(self, maxlen): + return chr(self._value & 0xff) + # + CTypesPrimitive._fix_class() + return CTypesPrimitive + + def new_pointer_type(self, BItem): + getbtype = self.ffi._get_cached_btype + if BItem is getbtype(model.PrimitiveType('char')): + kind = 'charp' + elif BItem in (getbtype(model.PrimitiveType('signed char')), + getbtype(model.PrimitiveType('unsigned char'))): + kind = 'bytep' + elif BItem is getbtype(model.void_type): + kind = 'voidp' + else: + kind = 'generic' + # + class CTypesPtr(CTypesGenericPtr): + __slots__ = ['_own'] + if kind == 'charp': + __slots__ += ['__as_strbuf'] + _BItem = BItem + if hasattr(BItem, '_ctype'): + _ctype = ctypes.POINTER(BItem._ctype) + _bitem_size = ctypes.sizeof(BItem._ctype) + else: + _ctype = ctypes.c_void_p + if issubclass(BItem, CTypesGenericArray): + _reftypename = BItem._get_c_name('(* &)') + else: + _reftypename = BItem._get_c_name(' * &') + + def __init__(self, init): + ctypeobj = BItem._create_ctype_obj(init) + if kind == 'charp': + self.__as_strbuf = ctypes.create_string_buffer( + ctypeobj.value + b'\x00') + self._as_ctype_ptr = ctypes.cast( + self.__as_strbuf, self._ctype) + else: + self._as_ctype_ptr = ctypes.pointer(ctypeobj) + self._address = ctypes.cast(self._as_ctype_ptr, + ctypes.c_void_p).value + self._own = True + + def __add__(self, other): + if isinstance(other, (int, long)): + return self._new_pointer_at(self._address + + other * self._bitem_size) + else: + return NotImplemented + + def __sub__(self, other): + if isinstance(other, (int, long)): + return self._new_pointer_at(self._address - + other * self._bitem_size) + elif type(self) is type(other): + return (self._address - other._address) // self._bitem_size + else: + return NotImplemented + + def __getitem__(self, index): + if getattr(self, '_own', False) and index != 0: + raise IndexError + return BItem._from_ctypes(self._as_ctype_ptr[index]) + + def __setitem__(self, index, value): + self._as_ctype_ptr[index] = BItem._to_ctypes(value) + + if kind == 'charp' or kind == 'voidp': + @classmethod + def _arg_to_ctypes(cls, *value): + if value and isinstance(value[0], bytes): + return ctypes.c_char_p(value[0]) + else: + return super(CTypesPtr, cls)._arg_to_ctypes(*value) + + if kind == 'charp' or kind == 'bytep': + def _to_string(self, maxlen): + if maxlen < 0: + maxlen = sys.maxsize + p = ctypes.cast(self._as_ctype_ptr, + ctypes.POINTER(ctypes.c_char)) + n = 0 + while n < maxlen and p[n] != b'\x00': + n += 1 + return b''.join([p[i] for i in range(n)]) + + def _get_own_repr(self): + if getattr(self, '_own', False): + return 'owning %d bytes' % ( + ctypes.sizeof(self._as_ctype_ptr.contents),) + return super(CTypesPtr, self)._get_own_repr() + # + if (BItem is self.ffi._get_cached_btype(model.void_type) or + BItem is self.ffi._get_cached_btype(model.PrimitiveType('char'))): + CTypesPtr._automatic_casts = True + # + CTypesPtr._fix_class() + return CTypesPtr + + def new_array_type(self, CTypesPtr, length): + if length is None: + brackets = ' &[]' + else: + brackets = ' &[%d]' % length + BItem = CTypesPtr._BItem + getbtype = self.ffi._get_cached_btype + if BItem is getbtype(model.PrimitiveType('char')): + kind = 'char' + elif BItem in (getbtype(model.PrimitiveType('signed char')), + getbtype(model.PrimitiveType('unsigned char'))): + kind = 'byte' + else: + kind = 'generic' + # + class CTypesArray(CTypesGenericArray): + __slots__ = ['_blob', '_own'] + if length is not None: + _ctype = BItem._ctype * length + else: + __slots__.append('_ctype') + _reftypename = BItem._get_c_name(brackets) + _declared_length = length + _CTPtr = CTypesPtr + + def __init__(self, init): + if length is None: + if isinstance(init, (int, long)): + len1 = init + init = None + elif kind == 'char' and isinstance(init, bytes): + len1 = len(init) + 1 # extra null + else: + init = tuple(init) + len1 = len(init) + self._ctype = BItem._ctype * len1 + self._blob = self._ctype() + self._own = True + if init is not None: + self._initialize(self._blob, init) + + @staticmethod + def _initialize(blob, init): + if isinstance(init, bytes): + init = [init[i:i+1] for i in range(len(init))] + else: + if isinstance(init, CTypesGenericArray): + if (len(init) != len(blob) or + not isinstance(init, CTypesArray)): + raise TypeError("length/type mismatch: %s" % (init,)) + init = tuple(init) + if len(init) > len(blob): + raise IndexError("too many initializers") + addr = ctypes.cast(blob, ctypes.c_void_p).value + PTR = ctypes.POINTER(BItem._ctype) + itemsize = ctypes.sizeof(BItem._ctype) + for i, value in enumerate(init): + p = ctypes.cast(addr + i * itemsize, PTR) + BItem._initialize(p.contents, value) + + def __len__(self): + return len(self._blob) + + def __getitem__(self, index): + if not (0 <= index < len(self._blob)): + raise IndexError + return BItem._from_ctypes(self._blob[index]) + + def __setitem__(self, index, value): + if not (0 <= index < len(self._blob)): + raise IndexError + self._blob[index] = BItem._to_ctypes(value) + + if kind == 'char' or kind == 'byte': + def _to_string(self, maxlen): + if maxlen < 0: + maxlen = len(self._blob) + p = ctypes.cast(self._blob, + ctypes.POINTER(ctypes.c_char)) + n = 0 + while n < maxlen and p[n] != b'\x00': + n += 1 + return b''.join([p[i] for i in range(n)]) + + def _get_own_repr(self): + if getattr(self, '_own', False): + return 'owning %d bytes' % (ctypes.sizeof(self._blob),) + return super(CTypesArray, self)._get_own_repr() + + def _convert_to_address(self, BClass): + if BClass in (CTypesPtr, None) or BClass._automatic_casts: + return ctypes.addressof(self._blob) + else: + return CTypesData._convert_to_address(self, BClass) + + @staticmethod + def _from_ctypes(ctypes_array): + self = CTypesArray.__new__(CTypesArray) + self._blob = ctypes_array + return self + + @staticmethod + def _arg_to_ctypes(value): + return CTypesPtr._arg_to_ctypes(value) + + def __add__(self, other): + if isinstance(other, (int, long)): + return CTypesPtr._new_pointer_at( + ctypes.addressof(self._blob) + + other * ctypes.sizeof(BItem._ctype)) + else: + return NotImplemented + + @classmethod + def _cast_from(cls, source): + raise NotImplementedError("casting to %r" % ( + cls._get_c_name(),)) + # + CTypesArray._fix_class() + return CTypesArray + + def _new_struct_or_union(self, kind, name, base_ctypes_class): + # + class struct_or_union(base_ctypes_class): + pass + struct_or_union.__name__ = '%s_%s' % (kind, name) + kind1 = kind + # + class CTypesStructOrUnion(CTypesBaseStructOrUnion): + __slots__ = ['_blob'] + _ctype = struct_or_union + _reftypename = '%s &' % (name,) + _kind = kind = kind1 + # + CTypesStructOrUnion._fix_class() + return CTypesStructOrUnion + + def new_struct_type(self, name): + return self._new_struct_or_union('struct', name, ctypes.Structure) + + def new_union_type(self, name): + return self._new_struct_or_union('union', name, ctypes.Union) + + def complete_struct_or_union(self, CTypesStructOrUnion, fields, tp, + totalsize=-1, totalalignment=-1, sflags=0, + pack=0): + if totalsize >= 0 or totalalignment >= 0: + raise NotImplementedError("the ctypes backend of CFFI does not support " + "structures completed by verify(); please " + "compile and install the _cffi_backend module.") + struct_or_union = CTypesStructOrUnion._ctype + fnames = [fname for (fname, BField, bitsize) in fields] + btypes = [BField for (fname, BField, bitsize) in fields] + bitfields = [bitsize for (fname, BField, bitsize) in fields] + # + bfield_types = {} + cfields = [] + for (fname, BField, bitsize) in fields: + if bitsize < 0: + cfields.append((fname, BField._ctype)) + bfield_types[fname] = BField + else: + cfields.append((fname, BField._ctype, bitsize)) + bfield_types[fname] = Ellipsis + if sflags & 8: + struct_or_union._pack_ = 1 + elif pack: + struct_or_union._pack_ = pack + struct_or_union._fields_ = cfields + CTypesStructOrUnion._bfield_types = bfield_types + # + @staticmethod + def _create_ctype_obj(init): + result = struct_or_union() + if init is not None: + initialize(result, init) + return result + CTypesStructOrUnion._create_ctype_obj = _create_ctype_obj + # + def initialize(blob, init): + if is_union: + if len(init) > 1: + raise ValueError("union initializer: %d items given, but " + "only one supported (use a dict if needed)" + % (len(init),)) + if not isinstance(init, dict): + if isinstance(init, (bytes, unicode)): + raise TypeError("union initializer: got a str") + init = tuple(init) + if len(init) > len(fnames): + raise ValueError("too many values for %s initializer" % + CTypesStructOrUnion._get_c_name()) + init = dict(zip(fnames, init)) + addr = ctypes.addressof(blob) + for fname, value in init.items(): + BField, bitsize = name2fieldtype[fname] + assert bitsize < 0, \ + "not implemented: initializer with bit fields" + offset = CTypesStructOrUnion._offsetof(fname) + PTR = ctypes.POINTER(BField._ctype) + p = ctypes.cast(addr + offset, PTR) + BField._initialize(p.contents, value) + is_union = CTypesStructOrUnion._kind == 'union' + name2fieldtype = dict(zip(fnames, zip(btypes, bitfields))) + # + for fname, BField, bitsize in fields: + if fname == '': + raise NotImplementedError("nested anonymous structs/unions") + if hasattr(CTypesStructOrUnion, fname): + raise ValueError("the field name %r conflicts in " + "the ctypes backend" % fname) + if bitsize < 0: + def getter(self, fname=fname, BField=BField, + offset=CTypesStructOrUnion._offsetof(fname), + PTR=ctypes.POINTER(BField._ctype)): + addr = ctypes.addressof(self._blob) + p = ctypes.cast(addr + offset, PTR) + return BField._from_ctypes(p.contents) + def setter(self, value, fname=fname, BField=BField): + setattr(self._blob, fname, BField._to_ctypes(value)) + # + if issubclass(BField, CTypesGenericArray): + setter = None + if BField._declared_length == 0: + def getter(self, fname=fname, BFieldPtr=BField._CTPtr, + offset=CTypesStructOrUnion._offsetof(fname), + PTR=ctypes.POINTER(BField._ctype)): + addr = ctypes.addressof(self._blob) + p = ctypes.cast(addr + offset, PTR) + return BFieldPtr._from_ctypes(p) + # + else: + def getter(self, fname=fname, BField=BField): + return BField._from_ctypes(getattr(self._blob, fname)) + def setter(self, value, fname=fname, BField=BField): + # xxx obscure workaround + value = BField._to_ctypes(value) + oldvalue = getattr(self._blob, fname) + setattr(self._blob, fname, value) + if value != getattr(self._blob, fname): + setattr(self._blob, fname, oldvalue) + raise OverflowError("value too large for bitfield") + setattr(CTypesStructOrUnion, fname, property(getter, setter)) + # + CTypesPtr = self.ffi._get_cached_btype(model.PointerType(tp)) + for fname in fnames: + if hasattr(CTypesPtr, fname): + raise ValueError("the field name %r conflicts in " + "the ctypes backend" % fname) + def getter(self, fname=fname): + return getattr(self[0], fname) + def setter(self, value, fname=fname): + setattr(self[0], fname, value) + setattr(CTypesPtr, fname, property(getter, setter)) + + def new_function_type(self, BArgs, BResult, has_varargs): + nameargs = [BArg._get_c_name() for BArg in BArgs] + if has_varargs: + nameargs.append('...') + nameargs = ', '.join(nameargs) + # + class CTypesFunctionPtr(CTypesGenericPtr): + __slots__ = ['_own_callback', '_name'] + _ctype = ctypes.CFUNCTYPE(getattr(BResult, '_ctype', None), + *[BArg._ctype for BArg in BArgs], + use_errno=True) + _reftypename = BResult._get_c_name('(* &)(%s)' % (nameargs,)) + + def __init__(self, init, error=None): + # create a callback to the Python callable init() + import traceback + assert not has_varargs, "varargs not supported for callbacks" + if getattr(BResult, '_ctype', None) is not None: + error = BResult._from_ctypes( + BResult._create_ctype_obj(error)) + else: + error = None + def callback(*args): + args2 = [] + for arg, BArg in zip(args, BArgs): + args2.append(BArg._from_ctypes(arg)) + try: + res2 = init(*args2) + res2 = BResult._to_ctypes(res2) + except: + traceback.print_exc() + res2 = error + if issubclass(BResult, CTypesGenericPtr): + if res2: + res2 = ctypes.cast(res2, ctypes.c_void_p).value + # .value: http://bugs.python.org/issue1574593 + else: + res2 = None + #print repr(res2) + return res2 + if issubclass(BResult, CTypesGenericPtr): + # The only pointers callbacks can return are void*s: + # http://bugs.python.org/issue5710 + callback_ctype = ctypes.CFUNCTYPE( + ctypes.c_void_p, + *[BArg._ctype for BArg in BArgs], + use_errno=True) + else: + callback_ctype = CTypesFunctionPtr._ctype + self._as_ctype_ptr = callback_ctype(callback) + self._address = ctypes.cast(self._as_ctype_ptr, + ctypes.c_void_p).value + self._own_callback = init + + @staticmethod + def _initialize(ctypes_ptr, value): + if value: + raise NotImplementedError("ctypes backend: not supported: " + "initializers for function pointers") + + def __repr__(self): + c_name = getattr(self, '_name', None) + if c_name: + i = self._reftypename.index('(* &)') + if self._reftypename[i-1] not in ' )*': + c_name = ' ' + c_name + c_name = self._reftypename.replace('(* &)', c_name) + return CTypesData.__repr__(self, c_name) + + def _get_own_repr(self): + if getattr(self, '_own_callback', None) is not None: + return 'calling %r' % (self._own_callback,) + return super(CTypesFunctionPtr, self)._get_own_repr() + + def __call__(self, *args): + if has_varargs: + assert len(args) >= len(BArgs) + extraargs = args[len(BArgs):] + args = args[:len(BArgs)] + else: + assert len(args) == len(BArgs) + ctypes_args = [] + for arg, BArg in zip(args, BArgs): + ctypes_args.append(BArg._arg_to_ctypes(arg)) + if has_varargs: + for i, arg in enumerate(extraargs): + if arg is None: + ctypes_args.append(ctypes.c_void_p(0)) # NULL + continue + if not isinstance(arg, CTypesData): + raise TypeError( + "argument %d passed in the variadic part " + "needs to be a cdata object (got %s)" % + (1 + len(BArgs) + i, type(arg).__name__)) + ctypes_args.append(arg._arg_to_ctypes(arg)) + result = self._as_ctype_ptr(*ctypes_args) + return BResult._from_ctypes(result) + # + CTypesFunctionPtr._fix_class() + return CTypesFunctionPtr + + def new_enum_type(self, name, enumerators, enumvalues, CTypesInt): + assert isinstance(name, str) + reverse_mapping = dict(zip(reversed(enumvalues), + reversed(enumerators))) + # + class CTypesEnum(CTypesInt): + __slots__ = [] + _reftypename = '%s &' % name + + def _get_own_repr(self): + value = self._value + try: + return '%d: %s' % (value, reverse_mapping[value]) + except KeyError: + return str(value) + + def _to_string(self, maxlen): + value = self._value + try: + return reverse_mapping[value] + except KeyError: + return str(value) + # + CTypesEnum._fix_class() + return CTypesEnum + + def get_errno(self): + return ctypes.get_errno() + + def set_errno(self, value): + ctypes.set_errno(value) + + def string(self, b, maxlen=-1): + return b._to_string(maxlen) + + def buffer(self, bptr, size=-1): + raise NotImplementedError("buffer() with ctypes backend") + + def sizeof(self, cdata_or_BType): + if isinstance(cdata_or_BType, CTypesData): + return cdata_or_BType._get_size_of_instance() + else: + assert issubclass(cdata_or_BType, CTypesData) + return cdata_or_BType._get_size() + + def alignof(self, BType): + assert issubclass(BType, CTypesData) + return BType._alignment() + + def newp(self, BType, source): + if not issubclass(BType, CTypesData): + raise TypeError + return BType._newp(source) + + def cast(self, BType, source): + return BType._cast_from(source) + + def callback(self, BType, source, error, onerror): + assert onerror is None # XXX not implemented + return BType(source, error) + + _weakref_cache_ref = None + + def gcp(self, cdata, destructor, size=0): + if self._weakref_cache_ref is None: + import weakref + class MyRef(weakref.ref): + def __eq__(self, other): + myref = self() + return self is other or ( + myref is not None and myref is other()) + def __ne__(self, other): + return not (self == other) + def __hash__(self): + try: + return self._hash + except AttributeError: + self._hash = hash(self()) + return self._hash + self._weakref_cache_ref = {}, MyRef + weak_cache, MyRef = self._weakref_cache_ref + + if destructor is None: + try: + del weak_cache[MyRef(cdata)] + except KeyError: + raise TypeError("Can remove destructor only on a object " + "previously returned by ffi.gc()") + return None + + def remove(k): + cdata, destructor = weak_cache.pop(k, (None, None)) + if destructor is not None: + destructor(cdata) + + new_cdata = self.cast(self.typeof(cdata), cdata) + assert new_cdata is not cdata + weak_cache[MyRef(new_cdata, remove)] = (cdata, destructor) + return new_cdata + + typeof = type + + def getcname(self, BType, replace_with): + return BType._get_c_name(replace_with) + + def typeoffsetof(self, BType, fieldname, num=0): + if isinstance(fieldname, str): + if num == 0 and issubclass(BType, CTypesGenericPtr): + BType = BType._BItem + if not issubclass(BType, CTypesBaseStructOrUnion): + raise TypeError("expected a struct or union ctype") + BField = BType._bfield_types[fieldname] + if BField is Ellipsis: + raise TypeError("not supported for bitfields") + return (BField, BType._offsetof(fieldname)) + elif isinstance(fieldname, (int, long)): + if issubclass(BType, CTypesGenericArray): + BType = BType._CTPtr + if not issubclass(BType, CTypesGenericPtr): + raise TypeError("expected an array or ptr ctype") + BItem = BType._BItem + offset = BItem._get_size() * fieldname + if offset > sys.maxsize: + raise OverflowError + return (BItem, offset) + else: + raise TypeError(type(fieldname)) + + def rawaddressof(self, BTypePtr, cdata, offset=None): + if isinstance(cdata, CTypesBaseStructOrUnion): + ptr = ctypes.pointer(type(cdata)._to_ctypes(cdata)) + elif isinstance(cdata, CTypesGenericPtr): + if offset is None or not issubclass(type(cdata)._BItem, + CTypesBaseStructOrUnion): + raise TypeError("unexpected cdata type") + ptr = type(cdata)._to_ctypes(cdata) + elif isinstance(cdata, CTypesGenericArray): + ptr = type(cdata)._to_ctypes(cdata) + else: + raise TypeError("expected a ") + if offset: + ptr = ctypes.cast( + ctypes.c_void_p( + ctypes.cast(ptr, ctypes.c_void_p).value + offset), + type(ptr)) + return BTypePtr._from_ctypes(ptr) + + +class CTypesLibrary(object): + + def __init__(self, backend, cdll): + self.backend = backend + self.cdll = cdll + + def load_function(self, BType, name): + c_func = getattr(self.cdll, name) + funcobj = BType._from_ctypes(c_func) + funcobj._name = name + return funcobj + + def read_variable(self, BType, name): + try: + ctypes_obj = BType._ctype.in_dll(self.cdll, name) + except AttributeError as e: + raise NotImplementedError(e) + return BType._from_ctypes(ctypes_obj) + + def write_variable(self, BType, name, value): + new_ctypes_obj = BType._to_ctypes(value) + ctypes_obj = BType._ctype.in_dll(self.cdll, name) + ctypes.memmove(ctypes.addressof(ctypes_obj), + ctypes.addressof(new_ctypes_obj), + ctypes.sizeof(BType._ctype)) diff --git a/jwt/python/cffi/cffi_opcode.py b/jwt/python/cffi/cffi_opcode.py new file mode 100644 index 0000000..a0df98d --- /dev/null +++ b/jwt/python/cffi/cffi_opcode.py @@ -0,0 +1,187 @@ +from .error import VerificationError + +class CffiOp(object): + def __init__(self, op, arg): + self.op = op + self.arg = arg + + def as_c_expr(self): + if self.op is None: + assert isinstance(self.arg, str) + return '(_cffi_opcode_t)(%s)' % (self.arg,) + classname = CLASS_NAME[self.op] + return '_CFFI_OP(_CFFI_OP_%s, %s)' % (classname, self.arg) + + def as_python_bytes(self): + if self.op is None and self.arg.isdigit(): + value = int(self.arg) # non-negative: '-' not in self.arg + if value >= 2**31: + raise OverflowError("cannot emit %r: limited to 2**31-1" + % (self.arg,)) + return format_four_bytes(value) + if isinstance(self.arg, str): + raise VerificationError("cannot emit to Python: %r" % (self.arg,)) + return format_four_bytes((self.arg << 8) | self.op) + + def __str__(self): + classname = CLASS_NAME.get(self.op, self.op) + return '(%s %s)' % (classname, self.arg) + +def format_four_bytes(num): + return '\\x%02X\\x%02X\\x%02X\\x%02X' % ( + (num >> 24) & 0xFF, + (num >> 16) & 0xFF, + (num >> 8) & 0xFF, + (num ) & 0xFF) + +OP_PRIMITIVE = 1 +OP_POINTER = 3 +OP_ARRAY = 5 +OP_OPEN_ARRAY = 7 +OP_STRUCT_UNION = 9 +OP_ENUM = 11 +OP_FUNCTION = 13 +OP_FUNCTION_END = 15 +OP_NOOP = 17 +OP_BITFIELD = 19 +OP_TYPENAME = 21 +OP_CPYTHON_BLTN_V = 23 # varargs +OP_CPYTHON_BLTN_N = 25 # noargs +OP_CPYTHON_BLTN_O = 27 # O (i.e. a single arg) +OP_CONSTANT = 29 +OP_CONSTANT_INT = 31 +OP_GLOBAL_VAR = 33 +OP_DLOPEN_FUNC = 35 +OP_DLOPEN_CONST = 37 +OP_GLOBAL_VAR_F = 39 +OP_EXTERN_PYTHON = 41 + +PRIM_VOID = 0 +PRIM_BOOL = 1 +PRIM_CHAR = 2 +PRIM_SCHAR = 3 +PRIM_UCHAR = 4 +PRIM_SHORT = 5 +PRIM_USHORT = 6 +PRIM_INT = 7 +PRIM_UINT = 8 +PRIM_LONG = 9 +PRIM_ULONG = 10 +PRIM_LONGLONG = 11 +PRIM_ULONGLONG = 12 +PRIM_FLOAT = 13 +PRIM_DOUBLE = 14 +PRIM_LONGDOUBLE = 15 + +PRIM_WCHAR = 16 +PRIM_INT8 = 17 +PRIM_UINT8 = 18 +PRIM_INT16 = 19 +PRIM_UINT16 = 20 +PRIM_INT32 = 21 +PRIM_UINT32 = 22 +PRIM_INT64 = 23 +PRIM_UINT64 = 24 +PRIM_INTPTR = 25 +PRIM_UINTPTR = 26 +PRIM_PTRDIFF = 27 +PRIM_SIZE = 28 +PRIM_SSIZE = 29 +PRIM_INT_LEAST8 = 30 +PRIM_UINT_LEAST8 = 31 +PRIM_INT_LEAST16 = 32 +PRIM_UINT_LEAST16 = 33 +PRIM_INT_LEAST32 = 34 +PRIM_UINT_LEAST32 = 35 +PRIM_INT_LEAST64 = 36 +PRIM_UINT_LEAST64 = 37 +PRIM_INT_FAST8 = 38 +PRIM_UINT_FAST8 = 39 +PRIM_INT_FAST16 = 40 +PRIM_UINT_FAST16 = 41 +PRIM_INT_FAST32 = 42 +PRIM_UINT_FAST32 = 43 +PRIM_INT_FAST64 = 44 +PRIM_UINT_FAST64 = 45 +PRIM_INTMAX = 46 +PRIM_UINTMAX = 47 +PRIM_FLOATCOMPLEX = 48 +PRIM_DOUBLECOMPLEX = 49 +PRIM_CHAR16 = 50 +PRIM_CHAR32 = 51 + +_NUM_PRIM = 52 +_UNKNOWN_PRIM = -1 +_UNKNOWN_FLOAT_PRIM = -2 +_UNKNOWN_LONG_DOUBLE = -3 + +_IO_FILE_STRUCT = -1 + +PRIMITIVE_TO_INDEX = { + 'char': PRIM_CHAR, + 'short': PRIM_SHORT, + 'int': PRIM_INT, + 'long': PRIM_LONG, + 'long long': PRIM_LONGLONG, + 'signed char': PRIM_SCHAR, + 'unsigned char': PRIM_UCHAR, + 'unsigned short': PRIM_USHORT, + 'unsigned int': PRIM_UINT, + 'unsigned long': PRIM_ULONG, + 'unsigned long long': PRIM_ULONGLONG, + 'float': PRIM_FLOAT, + 'double': PRIM_DOUBLE, + 'long double': PRIM_LONGDOUBLE, + 'float _Complex': PRIM_FLOATCOMPLEX, + 'double _Complex': PRIM_DOUBLECOMPLEX, + '_Bool': PRIM_BOOL, + 'wchar_t': PRIM_WCHAR, + 'char16_t': PRIM_CHAR16, + 'char32_t': PRIM_CHAR32, + 'int8_t': PRIM_INT8, + 'uint8_t': PRIM_UINT8, + 'int16_t': PRIM_INT16, + 'uint16_t': PRIM_UINT16, + 'int32_t': PRIM_INT32, + 'uint32_t': PRIM_UINT32, + 'int64_t': PRIM_INT64, + 'uint64_t': PRIM_UINT64, + 'intptr_t': PRIM_INTPTR, + 'uintptr_t': PRIM_UINTPTR, + 'ptrdiff_t': PRIM_PTRDIFF, + 'size_t': PRIM_SIZE, + 'ssize_t': PRIM_SSIZE, + 'int_least8_t': PRIM_INT_LEAST8, + 'uint_least8_t': PRIM_UINT_LEAST8, + 'int_least16_t': PRIM_INT_LEAST16, + 'uint_least16_t': PRIM_UINT_LEAST16, + 'int_least32_t': PRIM_INT_LEAST32, + 'uint_least32_t': PRIM_UINT_LEAST32, + 'int_least64_t': PRIM_INT_LEAST64, + 'uint_least64_t': PRIM_UINT_LEAST64, + 'int_fast8_t': PRIM_INT_FAST8, + 'uint_fast8_t': PRIM_UINT_FAST8, + 'int_fast16_t': PRIM_INT_FAST16, + 'uint_fast16_t': PRIM_UINT_FAST16, + 'int_fast32_t': PRIM_INT_FAST32, + 'uint_fast32_t': PRIM_UINT_FAST32, + 'int_fast64_t': PRIM_INT_FAST64, + 'uint_fast64_t': PRIM_UINT_FAST64, + 'intmax_t': PRIM_INTMAX, + 'uintmax_t': PRIM_UINTMAX, + } + +F_UNION = 0x01 +F_CHECK_FIELDS = 0x02 +F_PACKED = 0x04 +F_EXTERNAL = 0x08 +F_OPAQUE = 0x10 + +G_FLAGS = dict([('_CFFI_' + _key, globals()[_key]) + for _key in ['F_UNION', 'F_CHECK_FIELDS', 'F_PACKED', + 'F_EXTERNAL', 'F_OPAQUE']]) + +CLASS_NAME = {} +for _name, _value in list(globals().items()): + if _name.startswith('OP_') and isinstance(_value, int): + CLASS_NAME[_value] = _name[3:] diff --git a/jwt/python/cffi/commontypes.py b/jwt/python/cffi/commontypes.py new file mode 100644 index 0000000..8ec97c7 --- /dev/null +++ b/jwt/python/cffi/commontypes.py @@ -0,0 +1,80 @@ +import sys +from . import model +from .error import FFIError + + +COMMON_TYPES = {} + +try: + # fetch "bool" and all simple Windows types + from _cffi_backend import _get_common_types + _get_common_types(COMMON_TYPES) +except ImportError: + pass + +COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE') +COMMON_TYPES['bool'] = '_Bool' # in case we got ImportError above + +for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + if _type.endswith('_t'): + COMMON_TYPES[_type] = _type +del _type + +_CACHE = {} + +def resolve_common_type(parser, commontype): + try: + return _CACHE[commontype] + except KeyError: + cdecl = COMMON_TYPES.get(commontype, commontype) + if not isinstance(cdecl, str): + result, quals = cdecl, 0 # cdecl is already a BaseType + elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES: + result, quals = model.PrimitiveType(cdecl), 0 + elif cdecl == 'set-unicode-needed': + raise FFIError("The Windows type %r is only available after " + "you call ffi.set_unicode()" % (commontype,)) + else: + if commontype == cdecl: + raise FFIError( + "Unsupported type: %r. Please look at " + "http://cffi.readthedocs.io/en/latest/cdef.html#ffi-cdef-limitations " + "and file an issue if you think this type should really " + "be supported." % (commontype,)) + result, quals = parser.parse_type_and_quals(cdecl) # recursive + + assert isinstance(result, model.BaseTypeByIdentity) + _CACHE[commontype] = result, quals + return result, quals + + +# ____________________________________________________________ +# extra types for Windows (most of them are in commontypes.c) + + +def win_common_types(): + return { + "UNICODE_STRING": model.StructType( + "_UNICODE_STRING", + ["Length", + "MaximumLength", + "Buffer"], + [model.PrimitiveType("unsigned short"), + model.PrimitiveType("unsigned short"), + model.PointerType(model.PrimitiveType("wchar_t"))], + [-1, -1, -1]), + "PUNICODE_STRING": "UNICODE_STRING *", + "PCUNICODE_STRING": "const UNICODE_STRING *", + + "TBYTE": "set-unicode-needed", + "TCHAR": "set-unicode-needed", + "LPCTSTR": "set-unicode-needed", + "PCTSTR": "set-unicode-needed", + "LPTSTR": "set-unicode-needed", + "PTSTR": "set-unicode-needed", + "PTBYTE": "set-unicode-needed", + "PTCHAR": "set-unicode-needed", + } + +if sys.platform == 'win32': + COMMON_TYPES.update(win_common_types()) diff --git a/jwt/python/cffi/cparser.py b/jwt/python/cffi/cparser.py new file mode 100644 index 0000000..74830e9 --- /dev/null +++ b/jwt/python/cffi/cparser.py @@ -0,0 +1,1006 @@ +from . import model +from .commontypes import COMMON_TYPES, resolve_common_type +from .error import FFIError, CDefError +try: + from . import _pycparser as pycparser +except ImportError: + import pycparser +import weakref, re, sys + +try: + if sys.version_info < (3,): + import thread as _thread + else: + import _thread + lock = _thread.allocate_lock() +except ImportError: + lock = None + +def _workaround_for_static_import_finders(): + # Issue #392: packaging tools like cx_Freeze can not find these + # because pycparser uses exec dynamic import. This is an obscure + # workaround. This function is never called. + import pycparser.yacctab + import pycparser.lextab + +CDEF_SOURCE_STRING = "" +_r_comment = re.compile(r"/\*.*?\*/|//([^\n\\]|\\.)*?$", + re.DOTALL | re.MULTILINE) +_r_define = re.compile(r"^\s*#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)" + r"\b((?:[^\n\\]|\\.)*?)$", + re.DOTALL | re.MULTILINE) +_r_line_directive = re.compile(r"^[ \t]*#[ \t]*(?:line|\d+)\b.*$", re.MULTILINE) +_r_partial_enum = re.compile(r"=\s*\.\.\.\s*[,}]|\.\.\.\s*\}") +_r_enum_dotdotdot = re.compile(r"__dotdotdot\d+__$") +_r_partial_array = re.compile(r"\[\s*\.\.\.\s*\]") +_r_words = re.compile(r"\w+|\S") +_parser_cache = None +_r_int_literal = re.compile(r"-?0?x?[0-9a-f]+[lu]*$", re.IGNORECASE) +_r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b") +_r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b") +_r_cdecl = re.compile(r"\b__cdecl\b") +_r_extern_python = re.compile(r'\bextern\s*"' + r'(Python|Python\s*\+\s*C|C\s*\+\s*Python)"\s*.') +_r_star_const_space = re.compile( # matches "* const " + r"[*]\s*((const|volatile|restrict)\b\s*)+") +_r_int_dotdotdot = re.compile(r"(\b(int|long|short|signed|unsigned|char)\s*)+" + r"\.\.\.") +_r_float_dotdotdot = re.compile(r"\b(double|float)\s*\.\.\.") + +def _get_parser(): + global _parser_cache + if _parser_cache is None: + _parser_cache = pycparser.CParser() + return _parser_cache + +def _workaround_for_old_pycparser(csource): + # Workaround for a pycparser issue (fixed between pycparser 2.10 and + # 2.14): "char*const***" gives us a wrong syntax tree, the same as + # for "char***(*const)". This means we can't tell the difference + # afterwards. But "char(*const(***))" gives us the right syntax + # tree. The issue only occurs if there are several stars in + # sequence with no parenthesis inbetween, just possibly qualifiers. + # Attempt to fix it by adding some parentheses in the source: each + # time we see "* const" or "* const *", we add an opening + # parenthesis before each star---the hard part is figuring out where + # to close them. + parts = [] + while True: + match = _r_star_const_space.search(csource) + if not match: + break + #print repr(''.join(parts)+csource), '=>', + parts.append(csource[:match.start()]) + parts.append('('); closing = ')' + parts.append(match.group()) # e.g. "* const " + endpos = match.end() + if csource.startswith('*', endpos): + parts.append('('); closing += ')' + level = 0 + i = endpos + while i < len(csource): + c = csource[i] + if c == '(': + level += 1 + elif c == ')': + if level == 0: + break + level -= 1 + elif c in ',;=': + if level == 0: + break + i += 1 + csource = csource[endpos:i] + closing + csource[i:] + #print repr(''.join(parts)+csource) + parts.append(csource) + return ''.join(parts) + +def _preprocess_extern_python(csource): + # input: `extern "Python" int foo(int);` or + # `extern "Python" { int foo(int); }` + # output: + # void __cffi_extern_python_start; + # int foo(int); + # void __cffi_extern_python_stop; + # + # input: `extern "Python+C" int foo(int);` + # output: + # void __cffi_extern_python_plus_c_start; + # int foo(int); + # void __cffi_extern_python_stop; + parts = [] + while True: + match = _r_extern_python.search(csource) + if not match: + break + endpos = match.end() - 1 + #print + #print ''.join(parts)+csource + #print '=>' + parts.append(csource[:match.start()]) + if 'C' in match.group(1): + parts.append('void __cffi_extern_python_plus_c_start; ') + else: + parts.append('void __cffi_extern_python_start; ') + if csource[endpos] == '{': + # grouping variant + closing = csource.find('}', endpos) + if closing < 0: + raise CDefError("'extern \"Python\" {': no '}' found") + if csource.find('{', endpos + 1, closing) >= 0: + raise NotImplementedError("cannot use { } inside a block " + "'extern \"Python\" { ... }'") + parts.append(csource[endpos+1:closing]) + csource = csource[closing+1:] + else: + # non-grouping variant + semicolon = csource.find(';', endpos) + if semicolon < 0: + raise CDefError("'extern \"Python\": no ';' found") + parts.append(csource[endpos:semicolon+1]) + csource = csource[semicolon+1:] + parts.append(' void __cffi_extern_python_stop;') + #print ''.join(parts)+csource + #print + parts.append(csource) + return ''.join(parts) + +def _warn_for_string_literal(csource): + if '"' not in csource: + return + for line in csource.splitlines(): + if '"' in line and not line.lstrip().startswith('#'): + import warnings + warnings.warn("String literal found in cdef() or type source. " + "String literals are ignored here, but you should " + "remove them anyway because some character sequences " + "confuse pre-parsing.") + break + +def _warn_for_non_extern_non_static_global_variable(decl): + if not decl.storage: + import warnings + warnings.warn("Global variable '%s' in cdef(): for consistency " + "with C it should have a storage class specifier " + "(usually 'extern')" % (decl.name,)) + +def _remove_line_directives(csource): + # _r_line_directive matches whole lines, without the final \n, if they + # start with '#line' with some spacing allowed, or '#NUMBER'. This + # function stores them away and replaces them with exactly the string + # '#line@N', where N is the index in the list 'line_directives'. + line_directives = [] + def replace(m): + i = len(line_directives) + line_directives.append(m.group()) + return '#line@%d' % i + csource = _r_line_directive.sub(replace, csource) + return csource, line_directives + +def _put_back_line_directives(csource, line_directives): + def replace(m): + s = m.group() + if not s.startswith('#line@'): + raise AssertionError("unexpected #line directive " + "(should have been processed and removed") + return line_directives[int(s[6:])] + return _r_line_directive.sub(replace, csource) + +def _preprocess(csource): + # First, remove the lines of the form '#line N "filename"' because + # the "filename" part could confuse the rest + csource, line_directives = _remove_line_directives(csource) + # Remove comments. NOTE: this only work because the cdef() section + # should not contain any string literals (except in line directives)! + def replace_keeping_newlines(m): + return ' ' + m.group().count('\n') * '\n' + csource = _r_comment.sub(replace_keeping_newlines, csource) + # Remove the "#define FOO x" lines + macros = {} + for match in _r_define.finditer(csource): + macroname, macrovalue = match.groups() + macrovalue = macrovalue.replace('\\\n', '').strip() + macros[macroname] = macrovalue + csource = _r_define.sub('', csource) + # + if pycparser.__version__ < '2.14': + csource = _workaround_for_old_pycparser(csource) + # + # BIG HACK: replace WINAPI or __stdcall with "volatile const". + # It doesn't make sense for the return type of a function to be + # "volatile volatile const", so we abuse it to detect __stdcall... + # Hack number 2 is that "int(volatile *fptr)();" is not valid C + # syntax, so we place the "volatile" before the opening parenthesis. + csource = _r_stdcall2.sub(' volatile volatile const(', csource) + csource = _r_stdcall1.sub(' volatile volatile const ', csource) + csource = _r_cdecl.sub(' ', csource) + # + # Replace `extern "Python"` with start/end markers + csource = _preprocess_extern_python(csource) + # + # Now there should not be any string literal left; warn if we get one + _warn_for_string_literal(csource) + # + # Replace "[...]" with "[__dotdotdotarray__]" + csource = _r_partial_array.sub('[__dotdotdotarray__]', csource) + # + # Replace "...}" with "__dotdotdotNUM__}". This construction should + # occur only at the end of enums; at the end of structs we have "...;}" + # and at the end of vararg functions "...);". Also replace "=...[,}]" + # with ",__dotdotdotNUM__[,}]": this occurs in the enums too, when + # giving an unknown value. + matches = list(_r_partial_enum.finditer(csource)) + for number, match in enumerate(reversed(matches)): + p = match.start() + if csource[p] == '=': + p2 = csource.find('...', p, match.end()) + assert p2 > p + csource = '%s,__dotdotdot%d__ %s' % (csource[:p], number, + csource[p2+3:]) + else: + assert csource[p:p+3] == '...' + csource = '%s __dotdotdot%d__ %s' % (csource[:p], number, + csource[p+3:]) + # Replace "int ..." or "unsigned long int..." with "__dotdotdotint__" + csource = _r_int_dotdotdot.sub(' __dotdotdotint__ ', csource) + # Replace "float ..." or "double..." with "__dotdotdotfloat__" + csource = _r_float_dotdotdot.sub(' __dotdotdotfloat__ ', csource) + # Replace all remaining "..." with the same name, "__dotdotdot__", + # which is declared with a typedef for the purpose of C parsing. + csource = csource.replace('...', ' __dotdotdot__ ') + # Finally, put back the line directives + csource = _put_back_line_directives(csource, line_directives) + return csource, macros + +def _common_type_names(csource): + # Look in the source for what looks like usages of types from the + # list of common types. A "usage" is approximated here as the + # appearance of the word, minus a "definition" of the type, which + # is the last word in a "typedef" statement. Approximative only + # but should be fine for all the common types. + look_for_words = set(COMMON_TYPES) + look_for_words.add(';') + look_for_words.add(',') + look_for_words.add('(') + look_for_words.add(')') + look_for_words.add('typedef') + words_used = set() + is_typedef = False + paren = 0 + previous_word = '' + for word in _r_words.findall(csource): + if word in look_for_words: + if word == ';': + if is_typedef: + words_used.discard(previous_word) + look_for_words.discard(previous_word) + is_typedef = False + elif word == 'typedef': + is_typedef = True + paren = 0 + elif word == '(': + paren += 1 + elif word == ')': + paren -= 1 + elif word == ',': + if is_typedef and paren == 0: + words_used.discard(previous_word) + look_for_words.discard(previous_word) + else: # word in COMMON_TYPES + words_used.add(word) + previous_word = word + return words_used + + +class Parser(object): + + def __init__(self): + self._declarations = {} + self._included_declarations = set() + self._anonymous_counter = 0 + self._structnode2type = weakref.WeakKeyDictionary() + self._options = {} + self._int_constants = {} + self._recomplete = [] + self._uses_new_feature = None + + def _parse(self, csource): + csource, macros = _preprocess(csource) + # XXX: for more efficiency we would need to poke into the + # internals of CParser... the following registers the + # typedefs, because their presence or absence influences the + # parsing itself (but what they are typedef'ed to plays no role) + ctn = _common_type_names(csource) + typenames = [] + for name in sorted(self._declarations): + if name.startswith('typedef '): + name = name[8:] + typenames.append(name) + ctn.discard(name) + typenames += sorted(ctn) + # + csourcelines = [] + csourcelines.append('# 1 ""') + for typename in typenames: + csourcelines.append('typedef int %s;' % typename) + csourcelines.append('typedef int __dotdotdotint__, __dotdotdotfloat__,' + ' __dotdotdot__;') + # this forces pycparser to consider the following in the file + # called from line 1 + csourcelines.append('# 1 "%s"' % (CDEF_SOURCE_STRING,)) + csourcelines.append(csource) + fullcsource = '\n'.join(csourcelines) + if lock is not None: + lock.acquire() # pycparser is not thread-safe... + try: + ast = _get_parser().parse(fullcsource) + except pycparser.c_parser.ParseError as e: + self.convert_pycparser_error(e, csource) + finally: + if lock is not None: + lock.release() + # csource will be used to find buggy source text + return ast, macros, csource + + def _convert_pycparser_error(self, e, csource): + # xxx look for ":NUM:" at the start of str(e) + # and interpret that as a line number. This will not work if + # the user gives explicit ``# NUM "FILE"`` directives. + line = None + msg = str(e) + match = re.match(r"%s:(\d+):" % (CDEF_SOURCE_STRING,), msg) + if match: + linenum = int(match.group(1), 10) + csourcelines = csource.splitlines() + if 1 <= linenum <= len(csourcelines): + line = csourcelines[linenum-1] + return line + + def convert_pycparser_error(self, e, csource): + line = self._convert_pycparser_error(e, csource) + + msg = str(e) + if line: + msg = 'cannot parse "%s"\n%s' % (line.strip(), msg) + else: + msg = 'parse error\n%s' % (msg,) + raise CDefError(msg) + + def parse(self, csource, override=False, packed=False, pack=None, + dllexport=False): + if packed: + if packed != True: + raise ValueError("'packed' should be False or True; use " + "'pack' to give another value") + if pack: + raise ValueError("cannot give both 'pack' and 'packed'") + pack = 1 + elif pack: + if pack & (pack - 1): + raise ValueError("'pack' must be a power of two, not %r" % + (pack,)) + else: + pack = 0 + prev_options = self._options + try: + self._options = {'override': override, + 'packed': pack, + 'dllexport': dllexport} + self._internal_parse(csource) + finally: + self._options = prev_options + + def _internal_parse(self, csource): + ast, macros, csource = self._parse(csource) + # add the macros + self._process_macros(macros) + # find the first "__dotdotdot__" and use that as a separator + # between the repeated typedefs and the real csource + iterator = iter(ast.ext) + for decl in iterator: + if decl.name == '__dotdotdot__': + break + else: + assert 0 + current_decl = None + # + try: + self._inside_extern_python = '__cffi_extern_python_stop' + for decl in iterator: + current_decl = decl + if isinstance(decl, pycparser.c_ast.Decl): + self._parse_decl(decl) + elif isinstance(decl, pycparser.c_ast.Typedef): + if not decl.name: + raise CDefError("typedef does not declare any name", + decl) + quals = 0 + if (isinstance(decl.type.type, pycparser.c_ast.IdentifierType) and + decl.type.type.names[-1].startswith('__dotdotdot')): + realtype = self._get_unknown_type(decl) + elif (isinstance(decl.type, pycparser.c_ast.PtrDecl) and + isinstance(decl.type.type, pycparser.c_ast.TypeDecl) and + isinstance(decl.type.type.type, + pycparser.c_ast.IdentifierType) and + decl.type.type.type.names[-1].startswith('__dotdotdot')): + realtype = self._get_unknown_ptr_type(decl) + else: + realtype, quals = self._get_type_and_quals( + decl.type, name=decl.name, partial_length_ok=True, + typedef_example="*(%s *)0" % (decl.name,)) + self._declare('typedef ' + decl.name, realtype, quals=quals) + elif decl.__class__.__name__ == 'Pragma': + pass # skip pragma, only in pycparser 2.15 + else: + raise CDefError("unexpected <%s>: this construct is valid " + "C but not valid in cdef()" % + decl.__class__.__name__, decl) + except CDefError as e: + if len(e.args) == 1: + e.args = e.args + (current_decl,) + raise + except FFIError as e: + msg = self._convert_pycparser_error(e, csource) + if msg: + e.args = (e.args[0] + "\n *** Err: %s" % msg,) + raise + + def _add_constants(self, key, val): + if key in self._int_constants: + if self._int_constants[key] == val: + return # ignore identical double declarations + raise FFIError( + "multiple declarations of constant: %s" % (key,)) + self._int_constants[key] = val + + def _add_integer_constant(self, name, int_str): + int_str = int_str.lower().rstrip("ul") + neg = int_str.startswith('-') + if neg: + int_str = int_str[1:] + # "010" is not valid oct in py3 + if (int_str.startswith("0") and int_str != '0' + and not int_str.startswith("0x")): + int_str = "0o" + int_str[1:] + pyvalue = int(int_str, 0) + if neg: + pyvalue = -pyvalue + self._add_constants(name, pyvalue) + self._declare('macro ' + name, pyvalue) + + def _process_macros(self, macros): + for key, value in macros.items(): + value = value.strip() + if _r_int_literal.match(value): + self._add_integer_constant(key, value) + elif value == '...': + self._declare('macro ' + key, value) + else: + raise CDefError( + 'only supports one of the following syntax:\n' + ' #define %s ... (literally dot-dot-dot)\n' + ' #define %s NUMBER (with NUMBER an integer' + ' constant, decimal/hex/octal)\n' + 'got:\n' + ' #define %s %s' + % (key, key, key, value)) + + def _declare_function(self, tp, quals, decl): + tp = self._get_type_pointer(tp, quals) + if self._options.get('dllexport'): + tag = 'dllexport_python ' + elif self._inside_extern_python == '__cffi_extern_python_start': + tag = 'extern_python ' + elif self._inside_extern_python == '__cffi_extern_python_plus_c_start': + tag = 'extern_python_plus_c ' + else: + tag = 'function ' + self._declare(tag + decl.name, tp) + + def _parse_decl(self, decl): + node = decl.type + if isinstance(node, pycparser.c_ast.FuncDecl): + tp, quals = self._get_type_and_quals(node, name=decl.name) + assert isinstance(tp, model.RawFunctionType) + self._declare_function(tp, quals, decl) + else: + if isinstance(node, pycparser.c_ast.Struct): + self._get_struct_union_enum_type('struct', node) + elif isinstance(node, pycparser.c_ast.Union): + self._get_struct_union_enum_type('union', node) + elif isinstance(node, pycparser.c_ast.Enum): + self._get_struct_union_enum_type('enum', node) + elif not decl.name: + raise CDefError("construct does not declare any variable", + decl) + # + if decl.name: + tp, quals = self._get_type_and_quals(node, + partial_length_ok=True) + if tp.is_raw_function: + self._declare_function(tp, quals, decl) + elif (tp.is_integer_type() and + hasattr(decl, 'init') and + hasattr(decl.init, 'value') and + _r_int_literal.match(decl.init.value)): + self._add_integer_constant(decl.name, decl.init.value) + elif (tp.is_integer_type() and + isinstance(decl.init, pycparser.c_ast.UnaryOp) and + decl.init.op == '-' and + hasattr(decl.init.expr, 'value') and + _r_int_literal.match(decl.init.expr.value)): + self._add_integer_constant(decl.name, + '-' + decl.init.expr.value) + elif (tp is model.void_type and + decl.name.startswith('__cffi_extern_python_')): + # hack: `extern "Python"` in the C source is replaced + # with "void __cffi_extern_python_start;" and + # "void __cffi_extern_python_stop;" + self._inside_extern_python = decl.name + else: + if self._inside_extern_python !='__cffi_extern_python_stop': + raise CDefError( + "cannot declare constants or " + "variables with 'extern \"Python\"'") + if (quals & model.Q_CONST) and not tp.is_array_type: + self._declare('constant ' + decl.name, tp, quals=quals) + else: + _warn_for_non_extern_non_static_global_variable(decl) + self._declare('variable ' + decl.name, tp, quals=quals) + + def parse_type(self, cdecl): + return self.parse_type_and_quals(cdecl)[0] + + def parse_type_and_quals(self, cdecl): + ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2] + assert not macros + exprnode = ast.ext[-1].type.args.params[0] + if isinstance(exprnode, pycparser.c_ast.ID): + raise CDefError("unknown identifier '%s'" % (exprnode.name,)) + return self._get_type_and_quals(exprnode.type) + + def _declare(self, name, obj, included=False, quals=0): + if name in self._declarations: + prevobj, prevquals = self._declarations[name] + if prevobj is obj and prevquals == quals: + return + if not self._options.get('override'): + raise FFIError( + "multiple declarations of %s (for interactive usage, " + "try cdef(xx, override=True))" % (name,)) + assert '__dotdotdot__' not in name.split() + self._declarations[name] = (obj, quals) + if included: + self._included_declarations.add(obj) + + def _extract_quals(self, type): + quals = 0 + if isinstance(type, (pycparser.c_ast.TypeDecl, + pycparser.c_ast.PtrDecl)): + if 'const' in type.quals: + quals |= model.Q_CONST + if 'volatile' in type.quals: + quals |= model.Q_VOLATILE + if 'restrict' in type.quals: + quals |= model.Q_RESTRICT + return quals + + def _get_type_pointer(self, type, quals, declname=None): + if isinstance(type, model.RawFunctionType): + return type.as_function_pointer() + if (isinstance(type, model.StructOrUnionOrEnum) and + type.name.startswith('$') and type.name[1:].isdigit() and + type.forcename is None and declname is not None): + return model.NamedPointerType(type, declname, quals) + return model.PointerType(type, quals) + + def _get_type_and_quals(self, typenode, name=None, partial_length_ok=False, + typedef_example=None): + # first, dereference typedefs, if we have it already parsed, we're good + if (isinstance(typenode, pycparser.c_ast.TypeDecl) and + isinstance(typenode.type, pycparser.c_ast.IdentifierType) and + len(typenode.type.names) == 1 and + ('typedef ' + typenode.type.names[0]) in self._declarations): + tp, quals = self._declarations['typedef ' + typenode.type.names[0]] + quals |= self._extract_quals(typenode) + return tp, quals + # + if isinstance(typenode, pycparser.c_ast.ArrayDecl): + # array type + if typenode.dim is None: + length = None + else: + length = self._parse_constant( + typenode.dim, partial_length_ok=partial_length_ok) + # a hack: in 'typedef int foo_t[...][...];', don't use '...' as + # the length but use directly the C expression that would be + # generated by recompiler.py. This lets the typedef be used in + # many more places within recompiler.py + if typedef_example is not None: + if length == '...': + length = '_cffi_array_len(%s)' % (typedef_example,) + typedef_example = "*" + typedef_example + # + tp, quals = self._get_type_and_quals(typenode.type, + partial_length_ok=partial_length_ok, + typedef_example=typedef_example) + return model.ArrayType(tp, length), quals + # + if isinstance(typenode, pycparser.c_ast.PtrDecl): + # pointer type + itemtype, itemquals = self._get_type_and_quals(typenode.type) + tp = self._get_type_pointer(itemtype, itemquals, declname=name) + quals = self._extract_quals(typenode) + return tp, quals + # + if isinstance(typenode, pycparser.c_ast.TypeDecl): + quals = self._extract_quals(typenode) + type = typenode.type + if isinstance(type, pycparser.c_ast.IdentifierType): + # assume a primitive type. get it from .names, but reduce + # synonyms to a single chosen combination + names = list(type.names) + if names != ['signed', 'char']: # keep this unmodified + prefixes = {} + while names: + name = names[0] + if name in ('short', 'long', 'signed', 'unsigned'): + prefixes[name] = prefixes.get(name, 0) + 1 + del names[0] + else: + break + # ignore the 'signed' prefix below, and reorder the others + newnames = [] + for prefix in ('unsigned', 'short', 'long'): + for i in range(prefixes.get(prefix, 0)): + newnames.append(prefix) + if not names: + names = ['int'] # implicitly + if names == ['int']: # but kill it if 'short' or 'long' + if 'short' in prefixes or 'long' in prefixes: + names = [] + names = newnames + names + ident = ' '.join(names) + if ident == 'void': + return model.void_type, quals + if ident == '__dotdotdot__': + raise FFIError(':%d: bad usage of "..."' % + typenode.coord.line) + tp0, quals0 = resolve_common_type(self, ident) + return tp0, (quals | quals0) + # + if isinstance(type, pycparser.c_ast.Struct): + # 'struct foobar' + tp = self._get_struct_union_enum_type('struct', type, name) + return tp, quals + # + if isinstance(type, pycparser.c_ast.Union): + # 'union foobar' + tp = self._get_struct_union_enum_type('union', type, name) + return tp, quals + # + if isinstance(type, pycparser.c_ast.Enum): + # 'enum foobar' + tp = self._get_struct_union_enum_type('enum', type, name) + return tp, quals + # + if isinstance(typenode, pycparser.c_ast.FuncDecl): + # a function type + return self._parse_function_type(typenode, name), 0 + # + # nested anonymous structs or unions end up here + if isinstance(typenode, pycparser.c_ast.Struct): + return self._get_struct_union_enum_type('struct', typenode, name, + nested=True), 0 + if isinstance(typenode, pycparser.c_ast.Union): + return self._get_struct_union_enum_type('union', typenode, name, + nested=True), 0 + # + raise FFIError(":%d: bad or unsupported type declaration" % + typenode.coord.line) + + def _parse_function_type(self, typenode, funcname=None): + params = list(getattr(typenode.args, 'params', [])) + for i, arg in enumerate(params): + if not hasattr(arg, 'type'): + raise CDefError("%s arg %d: unknown type '%s'" + " (if you meant to use the old C syntax of giving" + " untyped arguments, it is not supported)" + % (funcname or 'in expression', i + 1, + getattr(arg, 'name', '?'))) + ellipsis = ( + len(params) > 0 and + isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and + isinstance(params[-1].type.type, + pycparser.c_ast.IdentifierType) and + params[-1].type.type.names == ['__dotdotdot__']) + if ellipsis: + params.pop() + if not params: + raise CDefError( + "%s: a function with only '(...)' as argument" + " is not correct C" % (funcname or 'in expression')) + args = [self._as_func_arg(*self._get_type_and_quals(argdeclnode.type)) + for argdeclnode in params] + if not ellipsis and args == [model.void_type]: + args = [] + result, quals = self._get_type_and_quals(typenode.type) + # the 'quals' on the result type are ignored. HACK: we absure them + # to detect __stdcall functions: we textually replace "__stdcall" + # with "volatile volatile const" above. + abi = None + if hasattr(typenode.type, 'quals'): # else, probable syntax error anyway + if typenode.type.quals[-3:] == ['volatile', 'volatile', 'const']: + abi = '__stdcall' + return model.RawFunctionType(tuple(args), result, ellipsis, abi) + + def _as_func_arg(self, type, quals): + if isinstance(type, model.ArrayType): + return model.PointerType(type.item, quals) + elif isinstance(type, model.RawFunctionType): + return type.as_function_pointer() + else: + return type + + def _get_struct_union_enum_type(self, kind, type, name=None, nested=False): + # First, a level of caching on the exact 'type' node of the AST. + # This is obscure, but needed because pycparser "unrolls" declarations + # such as "typedef struct { } foo_t, *foo_p" and we end up with + # an AST that is not a tree, but a DAG, with the "type" node of the + # two branches foo_t and foo_p of the trees being the same node. + # It's a bit silly but detecting "DAG-ness" in the AST tree seems + # to be the only way to distinguish this case from two independent + # structs. See test_struct_with_two_usages. + try: + return self._structnode2type[type] + except KeyError: + pass + # + # Note that this must handle parsing "struct foo" any number of + # times and always return the same StructType object. Additionally, + # one of these times (not necessarily the first), the fields of + # the struct can be specified with "struct foo { ...fields... }". + # If no name is given, then we have to create a new anonymous struct + # with no caching; in this case, the fields are either specified + # right now or never. + # + force_name = name + name = type.name + # + # get the type or create it if needed + if name is None: + # 'force_name' is used to guess a more readable name for + # anonymous structs, for the common case "typedef struct { } foo". + if force_name is not None: + explicit_name = '$%s' % force_name + else: + self._anonymous_counter += 1 + explicit_name = '$%d' % self._anonymous_counter + tp = None + else: + explicit_name = name + key = '%s %s' % (kind, name) + tp, _ = self._declarations.get(key, (None, None)) + # + if tp is None: + if kind == 'struct': + tp = model.StructType(explicit_name, None, None, None) + elif kind == 'union': + tp = model.UnionType(explicit_name, None, None, None) + elif kind == 'enum': + if explicit_name == '__dotdotdot__': + raise CDefError("Enums cannot be declared with ...") + tp = self._build_enum_type(explicit_name, type.values) + else: + raise AssertionError("kind = %r" % (kind,)) + if name is not None: + self._declare(key, tp) + else: + if kind == 'enum' and type.values is not None: + raise NotImplementedError( + "enum %s: the '{}' declaration should appear on the first " + "time the enum is mentioned, not later" % explicit_name) + if not tp.forcename: + tp.force_the_name(force_name) + if tp.forcename and '$' in tp.name: + self._declare('anonymous %s' % tp.forcename, tp) + # + self._structnode2type[type] = tp + # + # enums: done here + if kind == 'enum': + return tp + # + # is there a 'type.decls'? If yes, then this is the place in the + # C sources that declare the fields. If no, then just return the + # existing type, possibly still incomplete. + if type.decls is None: + return tp + # + if tp.fldnames is not None: + raise CDefError("duplicate declaration of struct %s" % name) + fldnames = [] + fldtypes = [] + fldbitsize = [] + fldquals = [] + for decl in type.decls: + if (isinstance(decl.type, pycparser.c_ast.IdentifierType) and + ''.join(decl.type.names) == '__dotdotdot__'): + # XXX pycparser is inconsistent: 'names' should be a list + # of strings, but is sometimes just one string. Use + # str.join() as a way to cope with both. + self._make_partial(tp, nested) + continue + if decl.bitsize is None: + bitsize = -1 + else: + bitsize = self._parse_constant(decl.bitsize) + self._partial_length = False + type, fqual = self._get_type_and_quals(decl.type, + partial_length_ok=True) + if self._partial_length: + self._make_partial(tp, nested) + if isinstance(type, model.StructType) and type.partial: + self._make_partial(tp, nested) + fldnames.append(decl.name or '') + fldtypes.append(type) + fldbitsize.append(bitsize) + fldquals.append(fqual) + tp.fldnames = tuple(fldnames) + tp.fldtypes = tuple(fldtypes) + tp.fldbitsize = tuple(fldbitsize) + tp.fldquals = tuple(fldquals) + if fldbitsize != [-1] * len(fldbitsize): + if isinstance(tp, model.StructType) and tp.partial: + raise NotImplementedError("%s: using both bitfields and '...;'" + % (tp,)) + tp.packed = self._options.get('packed') + if tp.completed: # must be re-completed: it is not opaque any more + tp.completed = 0 + self._recomplete.append(tp) + return tp + + def _make_partial(self, tp, nested): + if not isinstance(tp, model.StructOrUnion): + raise CDefError("%s cannot be partial" % (tp,)) + if not tp.has_c_name() and not nested: + raise NotImplementedError("%s is partial but has no C name" %(tp,)) + tp.partial = True + + def _parse_constant(self, exprnode, partial_length_ok=False): + # for now, limited to expressions that are an immediate number + # or positive/negative number + if isinstance(exprnode, pycparser.c_ast.Constant): + s = exprnode.value + if '0' <= s[0] <= '9': + s = s.rstrip('uUlL') + try: + if s.startswith('0'): + return int(s, 8) + else: + return int(s, 10) + except ValueError: + if len(s) > 1: + if s.lower()[0:2] == '0x': + return int(s, 16) + elif s.lower()[0:2] == '0b': + return int(s, 2) + raise CDefError("invalid constant %r" % (s,)) + elif s[0] == "'" and s[-1] == "'" and ( + len(s) == 3 or (len(s) == 4 and s[1] == "\\")): + return ord(s[-2]) + else: + raise CDefError("invalid constant %r" % (s,)) + # + if (isinstance(exprnode, pycparser.c_ast.UnaryOp) and + exprnode.op == '+'): + return self._parse_constant(exprnode.expr) + # + if (isinstance(exprnode, pycparser.c_ast.UnaryOp) and + exprnode.op == '-'): + return -self._parse_constant(exprnode.expr) + # load previously defined int constant + if (isinstance(exprnode, pycparser.c_ast.ID) and + exprnode.name in self._int_constants): + return self._int_constants[exprnode.name] + # + if (isinstance(exprnode, pycparser.c_ast.ID) and + exprnode.name == '__dotdotdotarray__'): + if partial_length_ok: + self._partial_length = True + return '...' + raise FFIError(":%d: unsupported '[...]' here, cannot derive " + "the actual array length in this context" + % exprnode.coord.line) + # + if isinstance(exprnode, pycparser.c_ast.BinaryOp): + left = self._parse_constant(exprnode.left) + right = self._parse_constant(exprnode.right) + if exprnode.op == '+': + return left + right + elif exprnode.op == '-': + return left - right + elif exprnode.op == '*': + return left * right + elif exprnode.op == '/': + return self._c_div(left, right) + elif exprnode.op == '%': + return left - self._c_div(left, right) * right + elif exprnode.op == '<<': + return left << right + elif exprnode.op == '>>': + return left >> right + elif exprnode.op == '&': + return left & right + elif exprnode.op == '|': + return left | right + elif exprnode.op == '^': + return left ^ right + # + raise FFIError(":%d: unsupported expression: expected a " + "simple numeric constant" % exprnode.coord.line) + + def _c_div(self, a, b): + result = a // b + if ((a < 0) ^ (b < 0)) and (a % b) != 0: + result += 1 + return result + + def _build_enum_type(self, explicit_name, decls): + if decls is not None: + partial = False + enumerators = [] + enumvalues = [] + nextenumvalue = 0 + for enum in decls.enumerators: + if _r_enum_dotdotdot.match(enum.name): + partial = True + continue + if enum.value is not None: + nextenumvalue = self._parse_constant(enum.value) + enumerators.append(enum.name) + enumvalues.append(nextenumvalue) + self._add_constants(enum.name, nextenumvalue) + nextenumvalue += 1 + enumerators = tuple(enumerators) + enumvalues = tuple(enumvalues) + tp = model.EnumType(explicit_name, enumerators, enumvalues) + tp.partial = partial + else: # opaque enum + tp = model.EnumType(explicit_name, (), ()) + return tp + + def include(self, other): + for name, (tp, quals) in other._declarations.items(): + if name.startswith('anonymous $enum_$'): + continue # fix for test_anonymous_enum_include + kind = name.split(' ', 1)[0] + if kind in ('struct', 'union', 'enum', 'anonymous', 'typedef'): + self._declare(name, tp, included=True, quals=quals) + for k, v in other._int_constants.items(): + self._add_constants(k, v) + + def _get_unknown_type(self, decl): + typenames = decl.type.type.names + if typenames == ['__dotdotdot__']: + return model.unknown_type(decl.name) + + if typenames == ['__dotdotdotint__']: + if self._uses_new_feature is None: + self._uses_new_feature = "'typedef int... %s'" % decl.name + return model.UnknownIntegerType(decl.name) + + if typenames == ['__dotdotdotfloat__']: + # note: not for 'long double' so far + if self._uses_new_feature is None: + self._uses_new_feature = "'typedef float... %s'" % decl.name + return model.UnknownFloatType(decl.name) + + raise FFIError(':%d: unsupported usage of "..." in typedef' + % decl.coord.line) + + def _get_unknown_ptr_type(self, decl): + if decl.type.type.type.names == ['__dotdotdot__']: + return model.unknown_ptr_type(decl.name) + raise FFIError(':%d: unsupported usage of "..." in typedef' + % decl.coord.line) diff --git a/jwt/python/cffi/error.py b/jwt/python/cffi/error.py new file mode 100644 index 0000000..0a27247 --- /dev/null +++ b/jwt/python/cffi/error.py @@ -0,0 +1,31 @@ + +class FFIError(Exception): + __module__ = 'cffi' + +class CDefError(Exception): + __module__ = 'cffi' + def __str__(self): + try: + current_decl = self.args[1] + filename = current_decl.coord.file + linenum = current_decl.coord.line + prefix = '%s:%d: ' % (filename, linenum) + except (AttributeError, TypeError, IndexError): + prefix = '' + return '%s%s' % (prefix, self.args[0]) + +class VerificationError(Exception): + """ An error raised when verification fails + """ + __module__ = 'cffi' + +class VerificationMissing(Exception): + """ An error raised when incomplete structures are passed into + cdef, but no verification has been done + """ + __module__ = 'cffi' + +class PkgConfigError(Exception): + """ An error raised for missing modules in pkg-config + """ + __module__ = 'cffi' diff --git a/jwt/python/cffi/ffiplatform.py b/jwt/python/cffi/ffiplatform.py new file mode 100644 index 0000000..8531346 --- /dev/null +++ b/jwt/python/cffi/ffiplatform.py @@ -0,0 +1,127 @@ +import sys, os +from .error import VerificationError + + +LIST_OF_FILE_NAMES = ['sources', 'include_dirs', 'library_dirs', + 'extra_objects', 'depends'] + +def get_extension(srcfilename, modname, sources=(), **kwds): + _hack_at_distutils() + from distutils.core import Extension + allsources = [srcfilename] + for src in sources: + allsources.append(os.path.normpath(src)) + return Extension(name=modname, sources=allsources, **kwds) + +def compile(tmpdir, ext, compiler_verbose=0, debug=None): + """Compile a C extension module using distutils.""" + + _hack_at_distutils() + saved_environ = os.environ.copy() + try: + outputfilename = _build(tmpdir, ext, compiler_verbose, debug) + outputfilename = os.path.abspath(outputfilename) + finally: + # workaround for a distutils bugs where some env vars can + # become longer and longer every time it is used + for key, value in saved_environ.items(): + if os.environ.get(key) != value: + os.environ[key] = value + return outputfilename + +def _build(tmpdir, ext, compiler_verbose=0, debug=None): + # XXX compact but horrible :-( + from distutils.core import Distribution + import distutils.errors, distutils.log + # + dist = Distribution({'ext_modules': [ext]}) + dist.parse_config_files() + options = dist.get_option_dict('build_ext') + if debug is None: + debug = sys.flags.debug + options['debug'] = ('ffiplatform', debug) + options['force'] = ('ffiplatform', True) + options['build_lib'] = ('ffiplatform', tmpdir) + options['build_temp'] = ('ffiplatform', tmpdir) + # + try: + old_level = distutils.log.set_threshold(0) or 0 + try: + distutils.log.set_verbosity(compiler_verbose) + dist.run_command('build_ext') + cmd_obj = dist.get_command_obj('build_ext') + [soname] = cmd_obj.get_outputs() + finally: + distutils.log.set_threshold(old_level) + except (distutils.errors.CompileError, + distutils.errors.LinkError) as e: + raise VerificationError('%s: %s' % (e.__class__.__name__, e)) + # + return soname + +try: + from os.path import samefile +except ImportError: + def samefile(f1, f2): + return os.path.abspath(f1) == os.path.abspath(f2) + +def maybe_relative_path(path): + if not os.path.isabs(path): + return path # already relative + dir = path + names = [] + while True: + prevdir = dir + dir, name = os.path.split(prevdir) + if dir == prevdir or not dir: + return path # failed to make it relative + names.append(name) + try: + if samefile(dir, os.curdir): + names.reverse() + return os.path.join(*names) + except OSError: + pass + +# ____________________________________________________________ + +try: + int_or_long = (int, long) + import cStringIO +except NameError: + int_or_long = int # Python 3 + import io as cStringIO + +def _flatten(x, f): + if isinstance(x, str): + f.write('%ds%s' % (len(x), x)) + elif isinstance(x, dict): + keys = sorted(x.keys()) + f.write('%dd' % len(keys)) + for key in keys: + _flatten(key, f) + _flatten(x[key], f) + elif isinstance(x, (list, tuple)): + f.write('%dl' % len(x)) + for value in x: + _flatten(value, f) + elif isinstance(x, int_or_long): + f.write('%di' % (x,)) + else: + raise TypeError( + "the keywords to verify() contains unsupported object %r" % (x,)) + +def flatten(x): + f = cStringIO.StringIO() + _flatten(x, f) + return f.getvalue() + +def _hack_at_distutils(): + # Windows-only workaround for some configurations: see + # https://bugs.python.org/issue23246 (Python 2.7 with + # a specific MS compiler suite download) + if sys.platform == "win32": + try: + import setuptools # for side-effects, patches distutils + except ImportError: + pass diff --git a/jwt/python/cffi/lock.py b/jwt/python/cffi/lock.py new file mode 100644 index 0000000..db91b71 --- /dev/null +++ b/jwt/python/cffi/lock.py @@ -0,0 +1,30 @@ +import sys + +if sys.version_info < (3,): + try: + from thread import allocate_lock + except ImportError: + from dummy_thread import allocate_lock +else: + try: + from _thread import allocate_lock + except ImportError: + from _dummy_thread import allocate_lock + + +##import sys +##l1 = allocate_lock + +##class allocate_lock(object): +## def __init__(self): +## self._real = l1() +## def __enter__(self): +## for i in range(4, 0, -1): +## print sys._getframe(i).f_code +## print +## return self._real.__enter__() +## def __exit__(self, *args): +## return self._real.__exit__(*args) +## def acquire(self, f): +## assert f is False +## return self._real.acquire(f) diff --git a/jwt/python/cffi/model.py b/jwt/python/cffi/model.py new file mode 100644 index 0000000..ad1c176 --- /dev/null +++ b/jwt/python/cffi/model.py @@ -0,0 +1,617 @@ +import types +import weakref + +from .lock import allocate_lock +from .error import CDefError, VerificationError, VerificationMissing + +# type qualifiers +Q_CONST = 0x01 +Q_RESTRICT = 0x02 +Q_VOLATILE = 0x04 + +def qualify(quals, replace_with): + if quals & Q_CONST: + replace_with = ' const ' + replace_with.lstrip() + if quals & Q_VOLATILE: + replace_with = ' volatile ' + replace_with.lstrip() + if quals & Q_RESTRICT: + # It seems that __restrict is supported by gcc and msvc. + # If you hit some different compiler, add a #define in + # _cffi_include.h for it (and in its copies, documented there) + replace_with = ' __restrict ' + replace_with.lstrip() + return replace_with + + +class BaseTypeByIdentity(object): + is_array_type = False + is_raw_function = False + + def get_c_name(self, replace_with='', context='a C file', quals=0): + result = self.c_name_with_marker + assert result.count('&') == 1 + # some logic duplication with ffi.getctype()... :-( + replace_with = replace_with.strip() + if replace_with: + if replace_with.startswith('*') and '&[' in result: + replace_with = '(%s)' % replace_with + elif not replace_with[0] in '[(': + replace_with = ' ' + replace_with + replace_with = qualify(quals, replace_with) + result = result.replace('&', replace_with) + if '$' in result: + raise VerificationError( + "cannot generate '%s' in %s: unknown type name" + % (self._get_c_name(), context)) + return result + + def _get_c_name(self): + return self.c_name_with_marker.replace('&', '') + + def has_c_name(self): + return '$' not in self._get_c_name() + + def is_integer_type(self): + return False + + def get_cached_btype(self, ffi, finishlist, can_delay=False): + try: + BType = ffi._cached_btypes[self] + except KeyError: + BType = self.build_backend_type(ffi, finishlist) + BType2 = ffi._cached_btypes.setdefault(self, BType) + assert BType2 is BType + return BType + + def __repr__(self): + return '<%s>' % (self._get_c_name(),) + + def _get_items(self): + return [(name, getattr(self, name)) for name in self._attrs_] + + +class BaseType(BaseTypeByIdentity): + + def __eq__(self, other): + return (self.__class__ == other.__class__ and + self._get_items() == other._get_items()) + + def __ne__(self, other): + return not self == other + + def __hash__(self): + return hash((self.__class__, tuple(self._get_items()))) + + +class VoidType(BaseType): + _attrs_ = () + + def __init__(self): + self.c_name_with_marker = 'void&' + + def build_backend_type(self, ffi, finishlist): + return global_cache(self, ffi, 'new_void_type') + +void_type = VoidType() + + +class BasePrimitiveType(BaseType): + def is_complex_type(self): + return False + + +class PrimitiveType(BasePrimitiveType): + _attrs_ = ('name',) + + ALL_PRIMITIVE_TYPES = { + 'char': 'c', + 'short': 'i', + 'int': 'i', + 'long': 'i', + 'long long': 'i', + 'signed char': 'i', + 'unsigned char': 'i', + 'unsigned short': 'i', + 'unsigned int': 'i', + 'unsigned long': 'i', + 'unsigned long long': 'i', + 'float': 'f', + 'double': 'f', + 'long double': 'f', + 'float _Complex': 'j', + 'double _Complex': 'j', + '_Bool': 'i', + # the following types are not primitive in the C sense + 'wchar_t': 'c', + 'char16_t': 'c', + 'char32_t': 'c', + 'int8_t': 'i', + 'uint8_t': 'i', + 'int16_t': 'i', + 'uint16_t': 'i', + 'int32_t': 'i', + 'uint32_t': 'i', + 'int64_t': 'i', + 'uint64_t': 'i', + 'int_least8_t': 'i', + 'uint_least8_t': 'i', + 'int_least16_t': 'i', + 'uint_least16_t': 'i', + 'int_least32_t': 'i', + 'uint_least32_t': 'i', + 'int_least64_t': 'i', + 'uint_least64_t': 'i', + 'int_fast8_t': 'i', + 'uint_fast8_t': 'i', + 'int_fast16_t': 'i', + 'uint_fast16_t': 'i', + 'int_fast32_t': 'i', + 'uint_fast32_t': 'i', + 'int_fast64_t': 'i', + 'uint_fast64_t': 'i', + 'intptr_t': 'i', + 'uintptr_t': 'i', + 'intmax_t': 'i', + 'uintmax_t': 'i', + 'ptrdiff_t': 'i', + 'size_t': 'i', + 'ssize_t': 'i', + } + + def __init__(self, name): + assert name in self.ALL_PRIMITIVE_TYPES + self.name = name + self.c_name_with_marker = name + '&' + + def is_char_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'c' + def is_integer_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'i' + def is_float_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'f' + def is_complex_type(self): + return self.ALL_PRIMITIVE_TYPES[self.name] == 'j' + + def build_backend_type(self, ffi, finishlist): + return global_cache(self, ffi, 'new_primitive_type', self.name) + + +class UnknownIntegerType(BasePrimitiveType): + _attrs_ = ('name',) + + def __init__(self, name): + self.name = name + self.c_name_with_marker = name + '&' + + def is_integer_type(self): + return True + + def build_backend_type(self, ffi, finishlist): + raise NotImplementedError("integer type '%s' can only be used after " + "compilation" % self.name) + +class UnknownFloatType(BasePrimitiveType): + _attrs_ = ('name', ) + + def __init__(self, name): + self.name = name + self.c_name_with_marker = name + '&' + + def build_backend_type(self, ffi, finishlist): + raise NotImplementedError("float type '%s' can only be used after " + "compilation" % self.name) + + +class BaseFunctionType(BaseType): + _attrs_ = ('args', 'result', 'ellipsis', 'abi') + + def __init__(self, args, result, ellipsis, abi=None): + self.args = args + self.result = result + self.ellipsis = ellipsis + self.abi = abi + # + reprargs = [arg._get_c_name() for arg in self.args] + if self.ellipsis: + reprargs.append('...') + reprargs = reprargs or ['void'] + replace_with = self._base_pattern % (', '.join(reprargs),) + if abi is not None: + replace_with = replace_with[:1] + abi + ' ' + replace_with[1:] + self.c_name_with_marker = ( + self.result.c_name_with_marker.replace('&', replace_with)) + + +class RawFunctionType(BaseFunctionType): + # Corresponds to a C type like 'int(int)', which is the C type of + # a function, but not a pointer-to-function. The backend has no + # notion of such a type; it's used temporarily by parsing. + _base_pattern = '(&)(%s)' + is_raw_function = True + + def build_backend_type(self, ffi, finishlist): + raise CDefError("cannot render the type %r: it is a function " + "type, not a pointer-to-function type" % (self,)) + + def as_function_pointer(self): + return FunctionPtrType(self.args, self.result, self.ellipsis, self.abi) + + +class FunctionPtrType(BaseFunctionType): + _base_pattern = '(*&)(%s)' + + def build_backend_type(self, ffi, finishlist): + result = self.result.get_cached_btype(ffi, finishlist) + args = [] + for tp in self.args: + args.append(tp.get_cached_btype(ffi, finishlist)) + abi_args = () + if self.abi == "__stdcall": + if not self.ellipsis: # __stdcall ignored for variadic funcs + try: + abi_args = (ffi._backend.FFI_STDCALL,) + except AttributeError: + pass + return global_cache(self, ffi, 'new_function_type', + tuple(args), result, self.ellipsis, *abi_args) + + def as_raw_function(self): + return RawFunctionType(self.args, self.result, self.ellipsis, self.abi) + + +class PointerType(BaseType): + _attrs_ = ('totype', 'quals') + + def __init__(self, totype, quals=0): + self.totype = totype + self.quals = quals + extra = qualify(quals, " *&") + if totype.is_array_type: + extra = "(%s)" % (extra.lstrip(),) + self.c_name_with_marker = totype.c_name_with_marker.replace('&', extra) + + def build_backend_type(self, ffi, finishlist): + BItem = self.totype.get_cached_btype(ffi, finishlist, can_delay=True) + return global_cache(self, ffi, 'new_pointer_type', BItem) + +voidp_type = PointerType(void_type) + +def ConstPointerType(totype): + return PointerType(totype, Q_CONST) + +const_voidp_type = ConstPointerType(void_type) + + +class NamedPointerType(PointerType): + _attrs_ = ('totype', 'name') + + def __init__(self, totype, name, quals=0): + PointerType.__init__(self, totype, quals) + self.name = name + self.c_name_with_marker = name + '&' + + +class ArrayType(BaseType): + _attrs_ = ('item', 'length') + is_array_type = True + + def __init__(self, item, length): + self.item = item + self.length = length + # + if length is None: + brackets = '&[]' + elif length == '...': + brackets = '&[/*...*/]' + else: + brackets = '&[%s]' % length + self.c_name_with_marker = ( + self.item.c_name_with_marker.replace('&', brackets)) + + def length_is_unknown(self): + return isinstance(self.length, str) + + def resolve_length(self, newlength): + return ArrayType(self.item, newlength) + + def build_backend_type(self, ffi, finishlist): + if self.length_is_unknown(): + raise CDefError("cannot render the type %r: unknown length" % + (self,)) + self.item.get_cached_btype(ffi, finishlist) # force the item BType + BPtrItem = PointerType(self.item).get_cached_btype(ffi, finishlist) + return global_cache(self, ffi, 'new_array_type', BPtrItem, self.length) + +char_array_type = ArrayType(PrimitiveType('char'), None) + + +class StructOrUnionOrEnum(BaseTypeByIdentity): + _attrs_ = ('name',) + forcename = None + + def build_c_name_with_marker(self): + name = self.forcename or '%s %s' % (self.kind, self.name) + self.c_name_with_marker = name + '&' + + def force_the_name(self, forcename): + self.forcename = forcename + self.build_c_name_with_marker() + + def get_official_name(self): + assert self.c_name_with_marker.endswith('&') + return self.c_name_with_marker[:-1] + + +class StructOrUnion(StructOrUnionOrEnum): + fixedlayout = None + completed = 0 + partial = False + packed = 0 + + def __init__(self, name, fldnames, fldtypes, fldbitsize, fldquals=None): + self.name = name + self.fldnames = fldnames + self.fldtypes = fldtypes + self.fldbitsize = fldbitsize + self.fldquals = fldquals + self.build_c_name_with_marker() + + def anonymous_struct_fields(self): + if self.fldtypes is not None: + for name, type in zip(self.fldnames, self.fldtypes): + if name == '' and isinstance(type, StructOrUnion): + yield type + + def enumfields(self, expand_anonymous_struct_union=True): + fldquals = self.fldquals + if fldquals is None: + fldquals = (0,) * len(self.fldnames) + for name, type, bitsize, quals in zip(self.fldnames, self.fldtypes, + self.fldbitsize, fldquals): + if (name == '' and isinstance(type, StructOrUnion) + and expand_anonymous_struct_union): + # nested anonymous struct/union + for result in type.enumfields(): + yield result + else: + yield (name, type, bitsize, quals) + + def force_flatten(self): + # force the struct or union to have a declaration that lists + # directly all fields returned by enumfields(), flattening + # nested anonymous structs/unions. + names = [] + types = [] + bitsizes = [] + fldquals = [] + for name, type, bitsize, quals in self.enumfields(): + names.append(name) + types.append(type) + bitsizes.append(bitsize) + fldquals.append(quals) + self.fldnames = tuple(names) + self.fldtypes = tuple(types) + self.fldbitsize = tuple(bitsizes) + self.fldquals = tuple(fldquals) + + def get_cached_btype(self, ffi, finishlist, can_delay=False): + BType = StructOrUnionOrEnum.get_cached_btype(self, ffi, finishlist, + can_delay) + if not can_delay: + self.finish_backend_type(ffi, finishlist) + return BType + + def finish_backend_type(self, ffi, finishlist): + if self.completed: + if self.completed != 2: + raise NotImplementedError("recursive structure declaration " + "for '%s'" % (self.name,)) + return + BType = ffi._cached_btypes[self] + # + self.completed = 1 + # + if self.fldtypes is None: + pass # not completing it: it's an opaque struct + # + elif self.fixedlayout is None: + fldtypes = [tp.get_cached_btype(ffi, finishlist) + for tp in self.fldtypes] + lst = list(zip(self.fldnames, fldtypes, self.fldbitsize)) + extra_flags = () + if self.packed: + if self.packed == 1: + extra_flags = (8,) # SF_PACKED + else: + extra_flags = (0, self.packed) + ffi._backend.complete_struct_or_union(BType, lst, self, + -1, -1, *extra_flags) + # + else: + fldtypes = [] + fieldofs, fieldsize, totalsize, totalalignment = self.fixedlayout + for i in range(len(self.fldnames)): + fsize = fieldsize[i] + ftype = self.fldtypes[i] + # + if isinstance(ftype, ArrayType) and ftype.length_is_unknown(): + # fix the length to match the total size + BItemType = ftype.item.get_cached_btype(ffi, finishlist) + nlen, nrest = divmod(fsize, ffi.sizeof(BItemType)) + if nrest != 0: + self._verification_error( + "field '%s.%s' has a bogus size?" % ( + self.name, self.fldnames[i] or '{}')) + ftype = ftype.resolve_length(nlen) + self.fldtypes = (self.fldtypes[:i] + (ftype,) + + self.fldtypes[i+1:]) + # + BFieldType = ftype.get_cached_btype(ffi, finishlist) + if isinstance(ftype, ArrayType) and ftype.length is None: + assert fsize == 0 + else: + bitemsize = ffi.sizeof(BFieldType) + if bitemsize != fsize: + self._verification_error( + "field '%s.%s' is declared as %d bytes, but is " + "really %d bytes" % (self.name, + self.fldnames[i] or '{}', + bitemsize, fsize)) + fldtypes.append(BFieldType) + # + lst = list(zip(self.fldnames, fldtypes, self.fldbitsize, fieldofs)) + ffi._backend.complete_struct_or_union(BType, lst, self, + totalsize, totalalignment) + self.completed = 2 + + def _verification_error(self, msg): + raise VerificationError(msg) + + def check_not_partial(self): + if self.partial and self.fixedlayout is None: + raise VerificationMissing(self._get_c_name()) + + def build_backend_type(self, ffi, finishlist): + self.check_not_partial() + finishlist.append(self) + # + return global_cache(self, ffi, 'new_%s_type' % self.kind, + self.get_official_name(), key=self) + + +class StructType(StructOrUnion): + kind = 'struct' + + +class UnionType(StructOrUnion): + kind = 'union' + + +class EnumType(StructOrUnionOrEnum): + kind = 'enum' + partial = False + partial_resolved = False + + def __init__(self, name, enumerators, enumvalues, baseinttype=None): + self.name = name + self.enumerators = enumerators + self.enumvalues = enumvalues + self.baseinttype = baseinttype + self.build_c_name_with_marker() + + def force_the_name(self, forcename): + StructOrUnionOrEnum.force_the_name(self, forcename) + if self.forcename is None: + name = self.get_official_name() + self.forcename = '$' + name.replace(' ', '_') + + def check_not_partial(self): + if self.partial and not self.partial_resolved: + raise VerificationMissing(self._get_c_name()) + + def build_backend_type(self, ffi, finishlist): + self.check_not_partial() + base_btype = self.build_baseinttype(ffi, finishlist) + return global_cache(self, ffi, 'new_enum_type', + self.get_official_name(), + self.enumerators, self.enumvalues, + base_btype, key=self) + + def build_baseinttype(self, ffi, finishlist): + if self.baseinttype is not None: + return self.baseinttype.get_cached_btype(ffi, finishlist) + # + if self.enumvalues: + smallest_value = min(self.enumvalues) + largest_value = max(self.enumvalues) + else: + import warnings + try: + # XXX! The goal is to ensure that the warnings.warn() + # will not suppress the warning. We want to get it + # several times if we reach this point several times. + __warningregistry__.clear() + except NameError: + pass + warnings.warn("%r has no values explicitly defined; " + "guessing that it is equivalent to 'unsigned int'" + % self._get_c_name()) + smallest_value = largest_value = 0 + if smallest_value < 0: # needs a signed type + sign = 1 + candidate1 = PrimitiveType("int") + candidate2 = PrimitiveType("long") + else: + sign = 0 + candidate1 = PrimitiveType("unsigned int") + candidate2 = PrimitiveType("unsigned long") + btype1 = candidate1.get_cached_btype(ffi, finishlist) + btype2 = candidate2.get_cached_btype(ffi, finishlist) + size1 = ffi.sizeof(btype1) + size2 = ffi.sizeof(btype2) + if (smallest_value >= ((-1) << (8*size1-1)) and + largest_value < (1 << (8*size1-sign))): + return btype1 + if (smallest_value >= ((-1) << (8*size2-1)) and + largest_value < (1 << (8*size2-sign))): + return btype2 + raise CDefError("%s values don't all fit into either 'long' " + "or 'unsigned long'" % self._get_c_name()) + +def unknown_type(name, structname=None): + if structname is None: + structname = '$%s' % name + tp = StructType(structname, None, None, None) + tp.force_the_name(name) + tp.origin = "unknown_type" + return tp + +def unknown_ptr_type(name, structname=None): + if structname is None: + structname = '$$%s' % name + tp = StructType(structname, None, None, None) + return NamedPointerType(tp, name) + + +global_lock = allocate_lock() +_typecache_cffi_backend = weakref.WeakValueDictionary() + +def get_typecache(backend): + # returns _typecache_cffi_backend if backend is the _cffi_backend + # module, or type(backend).__typecache if backend is an instance of + # CTypesBackend (or some FakeBackend class during tests) + if isinstance(backend, types.ModuleType): + return _typecache_cffi_backend + with global_lock: + if not hasattr(type(backend), '__typecache'): + type(backend).__typecache = weakref.WeakValueDictionary() + return type(backend).__typecache + +def global_cache(srctype, ffi, funcname, *args, **kwds): + key = kwds.pop('key', (funcname, args)) + assert not kwds + try: + return ffi._typecache[key] + except KeyError: + pass + try: + res = getattr(ffi._backend, funcname)(*args) + except NotImplementedError as e: + raise NotImplementedError("%s: %r: %s" % (funcname, srctype, e)) + # note that setdefault() on WeakValueDictionary is not atomic + # and contains a rare bug (http://bugs.python.org/issue19542); + # we have to use a lock and do it ourselves + cache = ffi._typecache + with global_lock: + res1 = cache.get(key) + if res1 is None: + cache[key] = res + return res + else: + return res1 + +def pointer_cache(ffi, BType): + return global_cache('?', ffi, 'new_pointer_type', BType) + +def attach_exception_info(e, name): + if e.args and type(e.args[0]) is str: + e.args = ('%s: %s' % (name, e.args[0]),) + e.args[1:] diff --git a/jwt/python/cffi/parse_c_type.h b/jwt/python/cffi/parse_c_type.h new file mode 100644 index 0000000..84e4ef8 --- /dev/null +++ b/jwt/python/cffi/parse_c_type.h @@ -0,0 +1,181 @@ + +/* This part is from file 'cffi/parse_c_type.h'. It is copied at the + beginning of C sources generated by CFFI's ffi.set_source(). */ + +typedef void *_cffi_opcode_t; + +#define _CFFI_OP(opcode, arg) (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8)) +#define _CFFI_GETOP(cffi_opcode) ((unsigned char)(uintptr_t)cffi_opcode) +#define _CFFI_GETARG(cffi_opcode) (((intptr_t)cffi_opcode) >> 8) + +#define _CFFI_OP_PRIMITIVE 1 +#define _CFFI_OP_POINTER 3 +#define _CFFI_OP_ARRAY 5 +#define _CFFI_OP_OPEN_ARRAY 7 +#define _CFFI_OP_STRUCT_UNION 9 +#define _CFFI_OP_ENUM 11 +#define _CFFI_OP_FUNCTION 13 +#define _CFFI_OP_FUNCTION_END 15 +#define _CFFI_OP_NOOP 17 +#define _CFFI_OP_BITFIELD 19 +#define _CFFI_OP_TYPENAME 21 +#define _CFFI_OP_CPYTHON_BLTN_V 23 // varargs +#define _CFFI_OP_CPYTHON_BLTN_N 25 // noargs +#define _CFFI_OP_CPYTHON_BLTN_O 27 // O (i.e. a single arg) +#define _CFFI_OP_CONSTANT 29 +#define _CFFI_OP_CONSTANT_INT 31 +#define _CFFI_OP_GLOBAL_VAR 33 +#define _CFFI_OP_DLOPEN_FUNC 35 +#define _CFFI_OP_DLOPEN_CONST 37 +#define _CFFI_OP_GLOBAL_VAR_F 39 +#define _CFFI_OP_EXTERN_PYTHON 41 + +#define _CFFI_PRIM_VOID 0 +#define _CFFI_PRIM_BOOL 1 +#define _CFFI_PRIM_CHAR 2 +#define _CFFI_PRIM_SCHAR 3 +#define _CFFI_PRIM_UCHAR 4 +#define _CFFI_PRIM_SHORT 5 +#define _CFFI_PRIM_USHORT 6 +#define _CFFI_PRIM_INT 7 +#define _CFFI_PRIM_UINT 8 +#define _CFFI_PRIM_LONG 9 +#define _CFFI_PRIM_ULONG 10 +#define _CFFI_PRIM_LONGLONG 11 +#define _CFFI_PRIM_ULONGLONG 12 +#define _CFFI_PRIM_FLOAT 13 +#define _CFFI_PRIM_DOUBLE 14 +#define _CFFI_PRIM_LONGDOUBLE 15 + +#define _CFFI_PRIM_WCHAR 16 +#define _CFFI_PRIM_INT8 17 +#define _CFFI_PRIM_UINT8 18 +#define _CFFI_PRIM_INT16 19 +#define _CFFI_PRIM_UINT16 20 +#define _CFFI_PRIM_INT32 21 +#define _CFFI_PRIM_UINT32 22 +#define _CFFI_PRIM_INT64 23 +#define _CFFI_PRIM_UINT64 24 +#define _CFFI_PRIM_INTPTR 25 +#define _CFFI_PRIM_UINTPTR 26 +#define _CFFI_PRIM_PTRDIFF 27 +#define _CFFI_PRIM_SIZE 28 +#define _CFFI_PRIM_SSIZE 29 +#define _CFFI_PRIM_INT_LEAST8 30 +#define _CFFI_PRIM_UINT_LEAST8 31 +#define _CFFI_PRIM_INT_LEAST16 32 +#define _CFFI_PRIM_UINT_LEAST16 33 +#define _CFFI_PRIM_INT_LEAST32 34 +#define _CFFI_PRIM_UINT_LEAST32 35 +#define _CFFI_PRIM_INT_LEAST64 36 +#define _CFFI_PRIM_UINT_LEAST64 37 +#define _CFFI_PRIM_INT_FAST8 38 +#define _CFFI_PRIM_UINT_FAST8 39 +#define _CFFI_PRIM_INT_FAST16 40 +#define _CFFI_PRIM_UINT_FAST16 41 +#define _CFFI_PRIM_INT_FAST32 42 +#define _CFFI_PRIM_UINT_FAST32 43 +#define _CFFI_PRIM_INT_FAST64 44 +#define _CFFI_PRIM_UINT_FAST64 45 +#define _CFFI_PRIM_INTMAX 46 +#define _CFFI_PRIM_UINTMAX 47 +#define _CFFI_PRIM_FLOATCOMPLEX 48 +#define _CFFI_PRIM_DOUBLECOMPLEX 49 +#define _CFFI_PRIM_CHAR16 50 +#define _CFFI_PRIM_CHAR32 51 + +#define _CFFI__NUM_PRIM 52 +#define _CFFI__UNKNOWN_PRIM (-1) +#define _CFFI__UNKNOWN_FLOAT_PRIM (-2) +#define _CFFI__UNKNOWN_LONG_DOUBLE (-3) + +#define _CFFI__IO_FILE_STRUCT (-1) + + +struct _cffi_global_s { + const char *name; + void *address; + _cffi_opcode_t type_op; + void *size_or_direct_fn; // OP_GLOBAL_VAR: size, or 0 if unknown + // OP_CPYTHON_BLTN_*: addr of direct function +}; + +struct _cffi_getconst_s { + unsigned long long value; + const struct _cffi_type_context_s *ctx; + int gindex; +}; + +struct _cffi_struct_union_s { + const char *name; + int type_index; // -> _cffi_types, on a OP_STRUCT_UNION + int flags; // _CFFI_F_* flags below + size_t size; + int alignment; + int first_field_index; // -> _cffi_fields array + int num_fields; +}; +#define _CFFI_F_UNION 0x01 // is a union, not a struct +#define _CFFI_F_CHECK_FIELDS 0x02 // complain if fields are not in the + // "standard layout" or if some are missing +#define _CFFI_F_PACKED 0x04 // for CHECK_FIELDS, assume a packed struct +#define _CFFI_F_EXTERNAL 0x08 // in some other ffi.include() +#define _CFFI_F_OPAQUE 0x10 // opaque + +struct _cffi_field_s { + const char *name; + size_t field_offset; + size_t field_size; + _cffi_opcode_t field_type_op; +}; + +struct _cffi_enum_s { + const char *name; + int type_index; // -> _cffi_types, on a OP_ENUM + int type_prim; // _CFFI_PRIM_xxx + const char *enumerators; // comma-delimited string +}; + +struct _cffi_typename_s { + const char *name; + int type_index; /* if opaque, points to a possibly artificial + OP_STRUCT which is itself opaque */ +}; + +struct _cffi_type_context_s { + _cffi_opcode_t *types; + const struct _cffi_global_s *globals; + const struct _cffi_field_s *fields; + const struct _cffi_struct_union_s *struct_unions; + const struct _cffi_enum_s *enums; + const struct _cffi_typename_s *typenames; + int num_globals; + int num_struct_unions; + int num_enums; + int num_typenames; + const char *const *includes; + int num_types; + int flags; /* future extension */ +}; + +struct _cffi_parse_info_s { + const struct _cffi_type_context_s *ctx; + _cffi_opcode_t *output; + unsigned int output_size; + size_t error_location; + const char *error_message; +}; + +struct _cffi_externpy_s { + const char *name; + size_t size_of_result; + void *reserved1, *reserved2; +}; + +#ifdef _CFFI_INTERNAL +static int parse_c_type(struct _cffi_parse_info_s *info, const char *input); +static int search_in_globals(const struct _cffi_type_context_s *ctx, + const char *search, size_t search_len); +static int search_in_struct_unions(const struct _cffi_type_context_s *ctx, + const char *search, size_t search_len); +#endif diff --git a/jwt/python/cffi/pkgconfig.py b/jwt/python/cffi/pkgconfig.py new file mode 100644 index 0000000..5c93f15 --- /dev/null +++ b/jwt/python/cffi/pkgconfig.py @@ -0,0 +1,121 @@ +# pkg-config, https://www.freedesktop.org/wiki/Software/pkg-config/ integration for cffi +import sys, os, subprocess + +from .error import PkgConfigError + + +def merge_flags(cfg1, cfg2): + """Merge values from cffi config flags cfg2 to cf1 + + Example: + merge_flags({"libraries": ["one"]}, {"libraries": ["two"]}) + {"libraries": ["one", "two"]} + """ + for key, value in cfg2.items(): + if key not in cfg1: + cfg1[key] = value + else: + if not isinstance(cfg1[key], list): + raise TypeError("cfg1[%r] should be a list of strings" % (key,)) + if not isinstance(value, list): + raise TypeError("cfg2[%r] should be a list of strings" % (key,)) + cfg1[key].extend(value) + return cfg1 + + +def call(libname, flag, encoding=sys.getfilesystemencoding()): + """Calls pkg-config and returns the output if found + """ + a = ["pkg-config", "--print-errors"] + a.append(flag) + a.append(libname) + try: + pc = subprocess.Popen(a, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except EnvironmentError as e: + raise PkgConfigError("cannot run pkg-config: %s" % (str(e).strip(),)) + + bout, berr = pc.communicate() + if pc.returncode != 0: + try: + berr = berr.decode(encoding) + except Exception: + pass + raise PkgConfigError(berr.strip()) + + if sys.version_info >= (3,) and not isinstance(bout, str): # Python 3.x + try: + bout = bout.decode(encoding) + except UnicodeDecodeError: + raise PkgConfigError("pkg-config %s %s returned bytes that cannot " + "be decoded with encoding %r:\n%r" % + (flag, libname, encoding, bout)) + + if os.altsep != '\\' and '\\' in bout: + raise PkgConfigError("pkg-config %s %s returned an unsupported " + "backslash-escaped output:\n%r" % + (flag, libname, bout)) + return bout + + +def flags_from_pkgconfig(libs): + r"""Return compiler line flags for FFI.set_source based on pkg-config output + + Usage + ... + ffibuilder.set_source("_foo", pkgconfig = ["libfoo", "libbar >= 1.8.3"]) + + If pkg-config is installed on build machine, then arguments include_dirs, + library_dirs, libraries, define_macros, extra_compile_args and + extra_link_args are extended with an output of pkg-config for libfoo and + libbar. + + Raises PkgConfigError in case the pkg-config call fails. + """ + + def get_include_dirs(string): + return [x[2:] for x in string.split() if x.startswith("-I")] + + def get_library_dirs(string): + return [x[2:] for x in string.split() if x.startswith("-L")] + + def get_libraries(string): + return [x[2:] for x in string.split() if x.startswith("-l")] + + # convert -Dfoo=bar to list of tuples [("foo", "bar")] expected by distutils + def get_macros(string): + def _macro(x): + x = x[2:] # drop "-D" + if '=' in x: + return tuple(x.split("=", 1)) # "-Dfoo=bar" => ("foo", "bar") + else: + return (x, None) # "-Dfoo" => ("foo", None) + return [_macro(x) for x in string.split() if x.startswith("-D")] + + def get_other_cflags(string): + return [x for x in string.split() if not x.startswith("-I") and + not x.startswith("-D")] + + def get_other_libs(string): + return [x for x in string.split() if not x.startswith("-L") and + not x.startswith("-l")] + + # return kwargs for given libname + def kwargs(libname): + fse = sys.getfilesystemencoding() + all_cflags = call(libname, "--cflags") + all_libs = call(libname, "--libs") + return { + "include_dirs": get_include_dirs(all_cflags), + "library_dirs": get_library_dirs(all_libs), + "libraries": get_libraries(all_libs), + "define_macros": get_macros(all_cflags), + "extra_compile_args": get_other_cflags(all_cflags), + "extra_link_args": get_other_libs(all_libs), + } + + # merge all arguments together + ret = {} + for libname in libs: + lib_flags = kwargs(libname) + merge_flags(ret, lib_flags) + return ret diff --git a/jwt/python/cffi/recompiler.py b/jwt/python/cffi/recompiler.py new file mode 100644 index 0000000..5d9d32d --- /dev/null +++ b/jwt/python/cffi/recompiler.py @@ -0,0 +1,1581 @@ +import os, sys, io +from . import ffiplatform, model +from .error import VerificationError +from .cffi_opcode import * + +VERSION_BASE = 0x2601 +VERSION_EMBEDDED = 0x2701 +VERSION_CHAR16CHAR32 = 0x2801 + +USE_LIMITED_API = (sys.platform != 'win32' or sys.version_info < (3, 0) or + sys.version_info >= (3, 5)) + + +class GlobalExpr: + def __init__(self, name, address, type_op, size=0, check_value=0): + self.name = name + self.address = address + self.type_op = type_op + self.size = size + self.check_value = check_value + + def as_c_expr(self): + return ' { "%s", (void *)%s, %s, (void *)%s },' % ( + self.name, self.address, self.type_op.as_c_expr(), self.size) + + def as_python_expr(self): + return "b'%s%s',%d" % (self.type_op.as_python_bytes(), self.name, + self.check_value) + +class FieldExpr: + def __init__(self, name, field_offset, field_size, fbitsize, field_type_op): + self.name = name + self.field_offset = field_offset + self.field_size = field_size + self.fbitsize = fbitsize + self.field_type_op = field_type_op + + def as_c_expr(self): + spaces = " " * len(self.name) + return (' { "%s", %s,\n' % (self.name, self.field_offset) + + ' %s %s,\n' % (spaces, self.field_size) + + ' %s %s },' % (spaces, self.field_type_op.as_c_expr())) + + def as_python_expr(self): + raise NotImplementedError + + def as_field_python_expr(self): + if self.field_type_op.op == OP_NOOP: + size_expr = '' + elif self.field_type_op.op == OP_BITFIELD: + size_expr = format_four_bytes(self.fbitsize) + else: + raise NotImplementedError + return "b'%s%s%s'" % (self.field_type_op.as_python_bytes(), + size_expr, + self.name) + +class StructUnionExpr: + def __init__(self, name, type_index, flags, size, alignment, comment, + first_field_index, c_fields): + self.name = name + self.type_index = type_index + self.flags = flags + self.size = size + self.alignment = alignment + self.comment = comment + self.first_field_index = first_field_index + self.c_fields = c_fields + + def as_c_expr(self): + return (' { "%s", %d, %s,' % (self.name, self.type_index, self.flags) + + '\n %s, %s, ' % (self.size, self.alignment) + + '%d, %d ' % (self.first_field_index, len(self.c_fields)) + + ('/* %s */ ' % self.comment if self.comment else '') + + '},') + + def as_python_expr(self): + flags = eval(self.flags, G_FLAGS) + fields_expr = [c_field.as_field_python_expr() + for c_field in self.c_fields] + return "(b'%s%s%s',%s)" % ( + format_four_bytes(self.type_index), + format_four_bytes(flags), + self.name, + ','.join(fields_expr)) + +class EnumExpr: + def __init__(self, name, type_index, size, signed, allenums): + self.name = name + self.type_index = type_index + self.size = size + self.signed = signed + self.allenums = allenums + + def as_c_expr(self): + return (' { "%s", %d, _cffi_prim_int(%s, %s),\n' + ' "%s" },' % (self.name, self.type_index, + self.size, self.signed, self.allenums)) + + def as_python_expr(self): + prim_index = { + (1, 0): PRIM_UINT8, (1, 1): PRIM_INT8, + (2, 0): PRIM_UINT16, (2, 1): PRIM_INT16, + (4, 0): PRIM_UINT32, (4, 1): PRIM_INT32, + (8, 0): PRIM_UINT64, (8, 1): PRIM_INT64, + }[self.size, self.signed] + return "b'%s%s%s\\x00%s'" % (format_four_bytes(self.type_index), + format_four_bytes(prim_index), + self.name, self.allenums) + +class TypenameExpr: + def __init__(self, name, type_index): + self.name = name + self.type_index = type_index + + def as_c_expr(self): + return ' { "%s", %d },' % (self.name, self.type_index) + + def as_python_expr(self): + return "b'%s%s'" % (format_four_bytes(self.type_index), self.name) + + +# ____________________________________________________________ + + +class Recompiler: + _num_externpy = 0 + + def __init__(self, ffi, module_name, target_is_python=False): + self.ffi = ffi + self.module_name = module_name + self.target_is_python = target_is_python + self._version = VERSION_BASE + + def needs_version(self, ver): + self._version = max(self._version, ver) + + def collect_type_table(self): + self._typesdict = {} + self._generate("collecttype") + # + all_decls = sorted(self._typesdict, key=str) + # + # prepare all FUNCTION bytecode sequences first + self.cffi_types = [] + for tp in all_decls: + if tp.is_raw_function: + assert self._typesdict[tp] is None + self._typesdict[tp] = len(self.cffi_types) + self.cffi_types.append(tp) # placeholder + for tp1 in tp.args: + assert isinstance(tp1, (model.VoidType, + model.BasePrimitiveType, + model.PointerType, + model.StructOrUnionOrEnum, + model.FunctionPtrType)) + if self._typesdict[tp1] is None: + self._typesdict[tp1] = len(self.cffi_types) + self.cffi_types.append(tp1) # placeholder + self.cffi_types.append('END') # placeholder + # + # prepare all OTHER bytecode sequences + for tp in all_decls: + if not tp.is_raw_function and self._typesdict[tp] is None: + self._typesdict[tp] = len(self.cffi_types) + self.cffi_types.append(tp) # placeholder + if tp.is_array_type and tp.length is not None: + self.cffi_types.append('LEN') # placeholder + assert None not in self._typesdict.values() + # + # collect all structs and unions and enums + self._struct_unions = {} + self._enums = {} + for tp in all_decls: + if isinstance(tp, model.StructOrUnion): + self._struct_unions[tp] = None + elif isinstance(tp, model.EnumType): + self._enums[tp] = None + for i, tp in enumerate(sorted(self._struct_unions, + key=lambda tp: tp.name)): + self._struct_unions[tp] = i + for i, tp in enumerate(sorted(self._enums, + key=lambda tp: tp.name)): + self._enums[tp] = i + # + # emit all bytecode sequences now + for tp in all_decls: + method = getattr(self, '_emit_bytecode_' + tp.__class__.__name__) + method(tp, self._typesdict[tp]) + # + # consistency check + for op in self.cffi_types: + assert isinstance(op, CffiOp) + self.cffi_types = tuple(self.cffi_types) # don't change any more + + def _enum_fields(self, tp): + # When producing C, expand all anonymous struct/union fields. + # That's necessary to have C code checking the offsets of the + # individual fields contained in them. When producing Python, + # don't do it and instead write it like it is, with the + # corresponding fields having an empty name. Empty names are + # recognized at runtime when we import the generated Python + # file. + expand_anonymous_struct_union = not self.target_is_python + return tp.enumfields(expand_anonymous_struct_union) + + def _do_collect_type(self, tp): + if not isinstance(tp, model.BaseTypeByIdentity): + if isinstance(tp, tuple): + for x in tp: + self._do_collect_type(x) + return + if tp not in self._typesdict: + self._typesdict[tp] = None + if isinstance(tp, model.FunctionPtrType): + self._do_collect_type(tp.as_raw_function()) + elif isinstance(tp, model.StructOrUnion): + if tp.fldtypes is not None and ( + tp not in self.ffi._parser._included_declarations): + for name1, tp1, _, _ in self._enum_fields(tp): + self._do_collect_type(self._field_type(tp, name1, tp1)) + else: + for _, x in tp._get_items(): + self._do_collect_type(x) + + def _generate(self, step_name): + lst = self.ffi._parser._declarations.items() + for name, (tp, quals) in sorted(lst): + kind, realname = name.split(' ', 1) + try: + method = getattr(self, '_generate_cpy_%s_%s' % (kind, + step_name)) + except AttributeError: + raise VerificationError( + "not implemented in recompile(): %r" % name) + try: + self._current_quals = quals + method(tp, realname) + except Exception as e: + model.attach_exception_info(e, name) + raise + + # ---------- + + ALL_STEPS = ["global", "field", "struct_union", "enum", "typename"] + + def collect_step_tables(self): + # collect the declarations for '_cffi_globals', '_cffi_typenames', etc. + self._lsts = {} + for step_name in self.ALL_STEPS: + self._lsts[step_name] = [] + self._seen_struct_unions = set() + self._generate("ctx") + self._add_missing_struct_unions() + # + for step_name in self.ALL_STEPS: + lst = self._lsts[step_name] + if step_name != "field": + lst.sort(key=lambda entry: entry.name) + self._lsts[step_name] = tuple(lst) # don't change any more + # + # check for a possible internal inconsistency: _cffi_struct_unions + # should have been generated with exactly self._struct_unions + lst = self._lsts["struct_union"] + for tp, i in self._struct_unions.items(): + assert i < len(lst) + assert lst[i].name == tp.name + assert len(lst) == len(self._struct_unions) + # same with enums + lst = self._lsts["enum"] + for tp, i in self._enums.items(): + assert i < len(lst) + assert lst[i].name == tp.name + assert len(lst) == len(self._enums) + + # ---------- + + def _prnt(self, what=''): + self._f.write(what + '\n') + + def write_source_to_f(self, f, preamble): + if self.target_is_python: + assert preamble is None + self.write_py_source_to_f(f) + else: + assert preamble is not None + self.write_c_source_to_f(f, preamble) + + def _rel_readlines(self, filename): + g = open(os.path.join(os.path.dirname(__file__), filename), 'r') + lines = g.readlines() + g.close() + return lines + + def write_c_source_to_f(self, f, preamble): + self._f = f + prnt = self._prnt + if self.ffi._embedding is not None: + prnt('#define _CFFI_USE_EMBEDDING') + if not USE_LIMITED_API: + prnt('#define _CFFI_NO_LIMITED_API') + # + # first the '#include' (actually done by inlining the file's content) + lines = self._rel_readlines('_cffi_include.h') + i = lines.index('#include "parse_c_type.h"\n') + lines[i:i+1] = self._rel_readlines('parse_c_type.h') + prnt(''.join(lines)) + # + # if we have ffi._embedding != None, we give it here as a macro + # and include an extra file + base_module_name = self.module_name.split('.')[-1] + if self.ffi._embedding is not None: + prnt('#define _CFFI_MODULE_NAME "%s"' % (self.module_name,)) + prnt('static const char _CFFI_PYTHON_STARTUP_CODE[] = {') + self._print_string_literal_in_array(self.ffi._embedding) + prnt('0 };') + prnt('#ifdef PYPY_VERSION') + prnt('# define _CFFI_PYTHON_STARTUP_FUNC _cffi_pypyinit_%s' % ( + base_module_name,)) + prnt('#elif PY_MAJOR_VERSION >= 3') + prnt('# define _CFFI_PYTHON_STARTUP_FUNC PyInit_%s' % ( + base_module_name,)) + prnt('#else') + prnt('# define _CFFI_PYTHON_STARTUP_FUNC init%s' % ( + base_module_name,)) + prnt('#endif') + lines = self._rel_readlines('_embedding.h') + i = lines.index('#include "_cffi_errors.h"\n') + lines[i:i+1] = self._rel_readlines('_cffi_errors.h') + prnt(''.join(lines)) + self.needs_version(VERSION_EMBEDDED) + # + # then paste the C source given by the user, verbatim. + prnt('/************************************************************/') + prnt() + prnt(preamble) + prnt() + prnt('/************************************************************/') + prnt() + # + # the declaration of '_cffi_types' + prnt('static void *_cffi_types[] = {') + typeindex2type = dict([(i, tp) for (tp, i) in self._typesdict.items()]) + for i, op in enumerate(self.cffi_types): + comment = '' + if i in typeindex2type: + comment = ' // ' + typeindex2type[i]._get_c_name() + prnt('/* %2d */ %s,%s' % (i, op.as_c_expr(), comment)) + if not self.cffi_types: + prnt(' 0') + prnt('};') + prnt() + # + # call generate_cpy_xxx_decl(), for every xxx found from + # ffi._parser._declarations. This generates all the functions. + self._seen_constants = set() + self._generate("decl") + # + # the declaration of '_cffi_globals' and '_cffi_typenames' + nums = {} + for step_name in self.ALL_STEPS: + lst = self._lsts[step_name] + nums[step_name] = len(lst) + if nums[step_name] > 0: + prnt('static const struct _cffi_%s_s _cffi_%ss[] = {' % ( + step_name, step_name)) + for entry in lst: + prnt(entry.as_c_expr()) + prnt('};') + prnt() + # + # the declaration of '_cffi_includes' + if self.ffi._included_ffis: + prnt('static const char * const _cffi_includes[] = {') + for ffi_to_include in self.ffi._included_ffis: + try: + included_module_name, included_source = ( + ffi_to_include._assigned_source[:2]) + except AttributeError: + raise VerificationError( + "ffi object %r includes %r, but the latter has not " + "been prepared with set_source()" % ( + self.ffi, ffi_to_include,)) + if included_source is None: + raise VerificationError( + "not implemented yet: ffi.include() of a Python-based " + "ffi inside a C-based ffi") + prnt(' "%s",' % (included_module_name,)) + prnt(' NULL') + prnt('};') + prnt() + # + # the declaration of '_cffi_type_context' + prnt('static const struct _cffi_type_context_s _cffi_type_context = {') + prnt(' _cffi_types,') + for step_name in self.ALL_STEPS: + if nums[step_name] > 0: + prnt(' _cffi_%ss,' % step_name) + else: + prnt(' NULL, /* no %ss */' % step_name) + for step_name in self.ALL_STEPS: + if step_name != "field": + prnt(' %d, /* num_%ss */' % (nums[step_name], step_name)) + if self.ffi._included_ffis: + prnt(' _cffi_includes,') + else: + prnt(' NULL, /* no includes */') + prnt(' %d, /* num_types */' % (len(self.cffi_types),)) + flags = 0 + if self._num_externpy > 0 or self.ffi._embedding is not None: + flags |= 1 # set to mean that we use extern "Python" + prnt(' %d, /* flags */' % flags) + prnt('};') + prnt() + # + # the init function + prnt('#ifdef __GNUC__') + prnt('# pragma GCC visibility push(default) /* for -fvisibility= */') + prnt('#endif') + prnt() + prnt('#ifdef PYPY_VERSION') + prnt('PyMODINIT_FUNC') + prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,)) + prnt('{') + if flags & 1: + prnt(' if (((intptr_t)p[0]) >= 0x0A03) {') + prnt(' _cffi_call_python_org = ' + '(void(*)(struct _cffi_externpy_s *, char *))p[1];') + prnt(' }') + prnt(' p[0] = (const void *)0x%x;' % self._version) + prnt(' p[1] = &_cffi_type_context;') + prnt('#if PY_MAJOR_VERSION >= 3') + prnt(' return NULL;') + prnt('#endif') + prnt('}') + # on Windows, distutils insists on putting init_cffi_xyz in + # 'export_symbols', so instead of fighting it, just give up and + # give it one + prnt('# ifdef _MSC_VER') + prnt(' PyMODINIT_FUNC') + prnt('# if PY_MAJOR_VERSION >= 3') + prnt(' PyInit_%s(void) { return NULL; }' % (base_module_name,)) + prnt('# else') + prnt(' init%s(void) { }' % (base_module_name,)) + prnt('# endif') + prnt('# endif') + prnt('#elif PY_MAJOR_VERSION >= 3') + prnt('PyMODINIT_FUNC') + prnt('PyInit_%s(void)' % (base_module_name,)) + prnt('{') + prnt(' return _cffi_init("%s", 0x%x, &_cffi_type_context);' % ( + self.module_name, self._version)) + prnt('}') + prnt('#else') + prnt('PyMODINIT_FUNC') + prnt('init%s(void)' % (base_module_name,)) + prnt('{') + prnt(' _cffi_init("%s", 0x%x, &_cffi_type_context);' % ( + self.module_name, self._version)) + prnt('}') + prnt('#endif') + prnt() + prnt('#ifdef __GNUC__') + prnt('# pragma GCC visibility pop') + prnt('#endif') + self._version = None + + def _to_py(self, x): + if isinstance(x, str): + return "b'%s'" % (x,) + if isinstance(x, (list, tuple)): + rep = [self._to_py(item) for item in x] + if len(rep) == 1: + rep.append('') + return "(%s)" % (','.join(rep),) + return x.as_python_expr() # Py2: unicode unexpected; Py3: bytes unexp. + + def write_py_source_to_f(self, f): + self._f = f + prnt = self._prnt + # + # header + prnt("# auto-generated file") + prnt("import _cffi_backend") + # + # the 'import' of the included ffis + num_includes = len(self.ffi._included_ffis or ()) + for i in range(num_includes): + ffi_to_include = self.ffi._included_ffis[i] + try: + included_module_name, included_source = ( + ffi_to_include._assigned_source[:2]) + except AttributeError: + raise VerificationError( + "ffi object %r includes %r, but the latter has not " + "been prepared with set_source()" % ( + self.ffi, ffi_to_include,)) + if included_source is not None: + raise VerificationError( + "not implemented yet: ffi.include() of a C-based " + "ffi inside a Python-based ffi") + prnt('from %s import ffi as _ffi%d' % (included_module_name, i)) + prnt() + prnt("ffi = _cffi_backend.FFI('%s'," % (self.module_name,)) + prnt(" _version = 0x%x," % (self._version,)) + self._version = None + # + # the '_types' keyword argument + self.cffi_types = tuple(self.cffi_types) # don't change any more + types_lst = [op.as_python_bytes() for op in self.cffi_types] + prnt(' _types = %s,' % (self._to_py(''.join(types_lst)),)) + typeindex2type = dict([(i, tp) for (tp, i) in self._typesdict.items()]) + # + # the keyword arguments from ALL_STEPS + for step_name in self.ALL_STEPS: + lst = self._lsts[step_name] + if len(lst) > 0 and step_name != "field": + prnt(' _%ss = %s,' % (step_name, self._to_py(lst))) + # + # the '_includes' keyword argument + if num_includes > 0: + prnt(' _includes = (%s,),' % ( + ', '.join(['_ffi%d' % i for i in range(num_includes)]),)) + # + # the footer + prnt(')') + + # ---------- + + def _gettypenum(self, type): + # a KeyError here is a bug. please report it! :-) + return self._typesdict[type] + + def _convert_funcarg_to_c(self, tp, fromvar, tovar, errcode): + extraarg = '' + if isinstance(tp, model.BasePrimitiveType) and not tp.is_complex_type(): + if tp.is_integer_type() and tp.name != '_Bool': + converter = '_cffi_to_c_int' + extraarg = ', %s' % tp.name + elif isinstance(tp, model.UnknownFloatType): + # don't check with is_float_type(): it may be a 'long + # double' here, and _cffi_to_c_double would loose precision + converter = '(%s)_cffi_to_c_double' % (tp.get_c_name(''),) + else: + cname = tp.get_c_name('') + converter = '(%s)_cffi_to_c_%s' % (cname, + tp.name.replace(' ', '_')) + if cname in ('char16_t', 'char32_t'): + self.needs_version(VERSION_CHAR16CHAR32) + errvalue = '-1' + # + elif isinstance(tp, model.PointerType): + self._convert_funcarg_to_c_ptr_or_array(tp, fromvar, + tovar, errcode) + return + # + elif (isinstance(tp, model.StructOrUnionOrEnum) or + isinstance(tp, model.BasePrimitiveType)): + # a struct (not a struct pointer) as a function argument; + # or, a complex (the same code works) + self._prnt(' if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)' + % (tovar, self._gettypenum(tp), fromvar)) + self._prnt(' %s;' % errcode) + return + # + elif isinstance(tp, model.FunctionPtrType): + converter = '(%s)_cffi_to_c_pointer' % tp.get_c_name('') + extraarg = ', _cffi_type(%d)' % self._gettypenum(tp) + errvalue = 'NULL' + # + else: + raise NotImplementedError(tp) + # + self._prnt(' %s = %s(%s%s);' % (tovar, converter, fromvar, extraarg)) + self._prnt(' if (%s == (%s)%s && PyErr_Occurred())' % ( + tovar, tp.get_c_name(''), errvalue)) + self._prnt(' %s;' % errcode) + + def _extra_local_variables(self, tp, localvars, freelines): + if isinstance(tp, model.PointerType): + localvars.add('Py_ssize_t datasize') + localvars.add('struct _cffi_freeme_s *large_args_free = NULL') + freelines.add('if (large_args_free != NULL)' + ' _cffi_free_array_arguments(large_args_free);') + + def _convert_funcarg_to_c_ptr_or_array(self, tp, fromvar, tovar, errcode): + self._prnt(' datasize = _cffi_prepare_pointer_call_argument(') + self._prnt(' _cffi_type(%d), %s, (char **)&%s);' % ( + self._gettypenum(tp), fromvar, tovar)) + self._prnt(' if (datasize != 0) {') + self._prnt(' %s = ((size_t)datasize) <= 640 ? ' + '(%s)alloca((size_t)datasize) : NULL;' % ( + tovar, tp.get_c_name(''))) + self._prnt(' if (_cffi_convert_array_argument(_cffi_type(%d), %s, ' + '(char **)&%s,' % (self._gettypenum(tp), fromvar, tovar)) + self._prnt(' datasize, &large_args_free) < 0)') + self._prnt(' %s;' % errcode) + self._prnt(' }') + + def _convert_expr_from_c(self, tp, var, context): + if isinstance(tp, model.BasePrimitiveType): + if tp.is_integer_type() and tp.name != '_Bool': + return '_cffi_from_c_int(%s, %s)' % (var, tp.name) + elif isinstance(tp, model.UnknownFloatType): + return '_cffi_from_c_double(%s)' % (var,) + elif tp.name != 'long double' and not tp.is_complex_type(): + cname = tp.name.replace(' ', '_') + if cname in ('char16_t', 'char32_t'): + self.needs_version(VERSION_CHAR16CHAR32) + return '_cffi_from_c_%s(%s)' % (cname, var) + else: + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, (model.PointerType, model.FunctionPtrType)): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.ArrayType): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(model.PointerType(tp.item))) + elif isinstance(tp, model.StructOrUnion): + if tp.fldnames is None: + raise TypeError("'%s' is used as %s, but is opaque" % ( + tp._get_c_name(), context)) + return '_cffi_from_c_struct((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.EnumType): + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + else: + raise NotImplementedError(tp) + + # ---------- + # typedefs + + def _typedef_type(self, tp, name): + return self._global_type(tp, "(*(%s *)0)" % (name,)) + + def _generate_cpy_typedef_collecttype(self, tp, name): + self._do_collect_type(self._typedef_type(tp, name)) + + def _generate_cpy_typedef_decl(self, tp, name): + pass + + def _typedef_ctx(self, tp, name): + type_index = self._typesdict[tp] + self._lsts["typename"].append(TypenameExpr(name, type_index)) + + def _generate_cpy_typedef_ctx(self, tp, name): + tp = self._typedef_type(tp, name) + self._typedef_ctx(tp, name) + if getattr(tp, "origin", None) == "unknown_type": + self._struct_ctx(tp, tp.name, approxname=None) + elif isinstance(tp, model.NamedPointerType): + self._struct_ctx(tp.totype, tp.totype.name, approxname=tp.name, + named_ptr=tp) + + # ---------- + # function declarations + + def _generate_cpy_function_collecttype(self, tp, name): + self._do_collect_type(tp.as_raw_function()) + if tp.ellipsis and not self.target_is_python: + self._do_collect_type(tp) + + def _generate_cpy_function_decl(self, tp, name): + assert not self.target_is_python + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + # cannot support vararg functions better than this: check for its + # exact type (including the fixed arguments), and build it as a + # constant function pointer (no CPython wrapper) + self._generate_cpy_constant_decl(tp, name) + return + prnt = self._prnt + numargs = len(tp.args) + if numargs == 0: + argname = 'noarg' + elif numargs == 1: + argname = 'arg0' + else: + argname = 'args' + # + # ------------------------------ + # the 'd' version of the function, only for addressof(lib, 'func') + arguments = [] + call_arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arguments.append(type.get_c_name(' x%d' % i, context)) + call_arguments.append('x%d' % i) + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + if tp.abi: + abi = tp.abi + ' ' + else: + abi = '' + name_and_arguments = '%s_cffi_d_%s(%s)' % (abi, name, repr_arguments) + prnt('static %s' % (tp.result.get_c_name(name_and_arguments),)) + prnt('{') + call_arguments = ', '.join(call_arguments) + result_code = 'return ' + if isinstance(tp.result, model.VoidType): + result_code = '' + prnt(' %s%s(%s);' % (result_code, name, call_arguments)) + prnt('}') + # + prnt('#ifndef PYPY_VERSION') # ------------------------------ + # + prnt('static PyObject *') + prnt('_cffi_f_%s(PyObject *self, PyObject *%s)' % (name, argname)) + prnt('{') + # + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arg = type.get_c_name(' x%d' % i, context) + prnt(' %s;' % arg) + # + localvars = set() + freelines = set() + for type in tp.args: + self._extra_local_variables(type, localvars, freelines) + for decl in sorted(localvars): + prnt(' %s;' % (decl,)) + # + if not isinstance(tp.result, model.VoidType): + result_code = 'result = ' + context = 'result of %s' % name + result_decl = ' %s;' % tp.result.get_c_name(' result', context) + prnt(result_decl) + prnt(' PyObject *pyresult;') + else: + result_decl = None + result_code = '' + # + if len(tp.args) > 1: + rng = range(len(tp.args)) + for i in rng: + prnt(' PyObject *arg%d;' % i) + prnt() + prnt(' if (!PyArg_UnpackTuple(args, "%s", %d, %d, %s))' % ( + name, len(rng), len(rng), + ', '.join(['&arg%d' % i for i in rng]))) + prnt(' return NULL;') + prnt() + # + for i, type in enumerate(tp.args): + self._convert_funcarg_to_c(type, 'arg%d' % i, 'x%d' % i, + 'return NULL') + prnt() + # + prnt(' Py_BEGIN_ALLOW_THREADS') + prnt(' _cffi_restore_errno();') + call_arguments = ['x%d' % i for i in range(len(tp.args))] + call_arguments = ', '.join(call_arguments) + prnt(' { %s%s(%s); }' % (result_code, name, call_arguments)) + prnt(' _cffi_save_errno();') + prnt(' Py_END_ALLOW_THREADS') + prnt() + # + prnt(' (void)self; /* unused */') + if numargs == 0: + prnt(' (void)noarg; /* unused */') + if result_code: + prnt(' pyresult = %s;' % + self._convert_expr_from_c(tp.result, 'result', 'result type')) + for freeline in freelines: + prnt(' ' + freeline) + prnt(' return pyresult;') + else: + for freeline in freelines: + prnt(' ' + freeline) + prnt(' Py_INCREF(Py_None);') + prnt(' return Py_None;') + prnt('}') + # + prnt('#else') # ------------------------------ + # + # the PyPy version: need to replace struct/union arguments with + # pointers, and if the result is a struct/union, insert a first + # arg that is a pointer to the result. We also do that for + # complex args and return type. + def need_indirection(type): + return (isinstance(type, model.StructOrUnion) or + (isinstance(type, model.PrimitiveType) and + type.is_complex_type())) + difference = False + arguments = [] + call_arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + indirection = '' + if need_indirection(type): + indirection = '*' + difference = True + arg = type.get_c_name(' %sx%d' % (indirection, i), context) + arguments.append(arg) + call_arguments.append('%sx%d' % (indirection, i)) + tp_result = tp.result + if need_indirection(tp_result): + context = 'result of %s' % name + arg = tp_result.get_c_name(' *result', context) + arguments.insert(0, arg) + tp_result = model.void_type + result_decl = None + result_code = '*result = ' + difference = True + if difference: + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + name_and_arguments = '%s_cffi_f_%s(%s)' % (abi, name, + repr_arguments) + prnt('static %s' % (tp_result.get_c_name(name_and_arguments),)) + prnt('{') + if result_decl: + prnt(result_decl) + call_arguments = ', '.join(call_arguments) + prnt(' { %s%s(%s); }' % (result_code, name, call_arguments)) + if result_decl: + prnt(' return result;') + prnt('}') + else: + prnt('# define _cffi_f_%s _cffi_d_%s' % (name, name)) + # + prnt('#endif') # ------------------------------ + prnt() + + def _generate_cpy_function_ctx(self, tp, name): + if tp.ellipsis and not self.target_is_python: + self._generate_cpy_constant_ctx(tp, name) + return + type_index = self._typesdict[tp.as_raw_function()] + numargs = len(tp.args) + if self.target_is_python: + meth_kind = OP_DLOPEN_FUNC + elif numargs == 0: + meth_kind = OP_CPYTHON_BLTN_N # 'METH_NOARGS' + elif numargs == 1: + meth_kind = OP_CPYTHON_BLTN_O # 'METH_O' + else: + meth_kind = OP_CPYTHON_BLTN_V # 'METH_VARARGS' + self._lsts["global"].append( + GlobalExpr(name, '_cffi_f_%s' % name, + CffiOp(meth_kind, type_index), + size='_cffi_d_%s' % name)) + + # ---------- + # named structs or unions + + def _field_type(self, tp_struct, field_name, tp_field): + if isinstance(tp_field, model.ArrayType): + actual_length = tp_field.length + if actual_length == '...': + ptr_struct_name = tp_struct.get_c_name('*') + actual_length = '_cffi_array_len(((%s)0)->%s)' % ( + ptr_struct_name, field_name) + tp_item = self._field_type(tp_struct, '%s[0]' % field_name, + tp_field.item) + tp_field = model.ArrayType(tp_item, actual_length) + return tp_field + + def _struct_collecttype(self, tp): + self._do_collect_type(tp) + if self.target_is_python: + # also requires nested anon struct/unions in ABI mode, recursively + for fldtype in tp.anonymous_struct_fields(): + self._struct_collecttype(fldtype) + + def _struct_decl(self, tp, cname, approxname): + if tp.fldtypes is None: + return + prnt = self._prnt + checkfuncname = '_cffi_checkfld_%s' % (approxname,) + prnt('_CFFI_UNUSED_FN') + prnt('static void %s(%s *p)' % (checkfuncname, cname)) + prnt('{') + prnt(' /* only to generate compile-time warnings or errors */') + prnt(' (void)p;') + for fname, ftype, fbitsize, fqual in self._enum_fields(tp): + try: + if ftype.is_integer_type() or fbitsize >= 0: + # accept all integers, but complain on float or double + if fname != '': + prnt(" (void)((p->%s) | 0); /* check that '%s.%s' is " + "an integer */" % (fname, cname, fname)) + continue + # only accept exactly the type declared, except that '[]' + # is interpreted as a '*' and so will match any array length. + # (It would also match '*', but that's harder to detect...) + while (isinstance(ftype, model.ArrayType) + and (ftype.length is None or ftype.length == '...')): + ftype = ftype.item + fname = fname + '[0]' + prnt(' { %s = &p->%s; (void)tmp; }' % ( + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) + except VerificationError as e: + prnt(' /* %s */' % str(e)) # cannot verify it, ignore + prnt('}') + prnt('struct _cffi_align_%s { char x; %s y; };' % (approxname, cname)) + prnt() + + def _struct_ctx(self, tp, cname, approxname, named_ptr=None): + type_index = self._typesdict[tp] + reason_for_not_expanding = None + flags = [] + if isinstance(tp, model.UnionType): + flags.append("_CFFI_F_UNION") + if tp.fldtypes is None: + flags.append("_CFFI_F_OPAQUE") + reason_for_not_expanding = "opaque" + if (tp not in self.ffi._parser._included_declarations and + (named_ptr is None or + named_ptr not in self.ffi._parser._included_declarations)): + if tp.fldtypes is None: + pass # opaque + elif tp.partial or any(tp.anonymous_struct_fields()): + pass # field layout obtained silently from the C compiler + else: + flags.append("_CFFI_F_CHECK_FIELDS") + if tp.packed: + if tp.packed > 1: + raise NotImplementedError( + "%r is declared with 'pack=%r'; only 0 or 1 are " + "supported in API mode (try to use \"...;\", which " + "does not require a 'pack' declaration)" % + (tp, tp.packed)) + flags.append("_CFFI_F_PACKED") + else: + flags.append("_CFFI_F_EXTERNAL") + reason_for_not_expanding = "external" + flags = '|'.join(flags) or '0' + c_fields = [] + if reason_for_not_expanding is None: + enumfields = list(self._enum_fields(tp)) + for fldname, fldtype, fbitsize, fqual in enumfields: + fldtype = self._field_type(tp, fldname, fldtype) + self._check_not_opaque(fldtype, + "field '%s.%s'" % (tp.name, fldname)) + # cname is None for _add_missing_struct_unions() only + op = OP_NOOP + if fbitsize >= 0: + op = OP_BITFIELD + size = '%d /* bits */' % fbitsize + elif cname is None or ( + isinstance(fldtype, model.ArrayType) and + fldtype.length is None): + size = '(size_t)-1' + else: + size = 'sizeof(((%s)0)->%s)' % ( + tp.get_c_name('*') if named_ptr is None + else named_ptr.name, + fldname) + if cname is None or fbitsize >= 0: + offset = '(size_t)-1' + elif named_ptr is not None: + offset = '((char *)&((%s)0)->%s) - (char *)0' % ( + named_ptr.name, fldname) + else: + offset = 'offsetof(%s, %s)' % (tp.get_c_name(''), fldname) + c_fields.append( + FieldExpr(fldname, offset, size, fbitsize, + CffiOp(op, self._typesdict[fldtype]))) + first_field_index = len(self._lsts["field"]) + self._lsts["field"].extend(c_fields) + # + if cname is None: # unknown name, for _add_missing_struct_unions + size = '(size_t)-2' + align = -2 + comment = "unnamed" + else: + if named_ptr is not None: + size = 'sizeof(*(%s)0)' % (named_ptr.name,) + align = '-1 /* unknown alignment */' + else: + size = 'sizeof(%s)' % (cname,) + align = 'offsetof(struct _cffi_align_%s, y)' % (approxname,) + comment = None + else: + size = '(size_t)-1' + align = -1 + first_field_index = -1 + comment = reason_for_not_expanding + self._lsts["struct_union"].append( + StructUnionExpr(tp.name, type_index, flags, size, align, comment, + first_field_index, c_fields)) + self._seen_struct_unions.add(tp) + + def _check_not_opaque(self, tp, location): + while isinstance(tp, model.ArrayType): + tp = tp.item + if isinstance(tp, model.StructOrUnion) and tp.fldtypes is None: + raise TypeError( + "%s is of an opaque type (not declared in cdef())" % location) + + def _add_missing_struct_unions(self): + # not very nice, but some struct declarations might be missing + # because they don't have any known C name. Check that they are + # not partial (we can't complete or verify them!) and emit them + # anonymously. + lst = list(self._struct_unions.items()) + lst.sort(key=lambda tp_order: tp_order[1]) + for tp, order in lst: + if tp not in self._seen_struct_unions: + if tp.partial: + raise NotImplementedError("internal inconsistency: %r is " + "partial but was not seen at " + "this point" % (tp,)) + if tp.name.startswith('$') and tp.name[1:].isdigit(): + approxname = tp.name[1:] + elif tp.name == '_IO_FILE' and tp.forcename == 'FILE': + approxname = 'FILE' + self._typedef_ctx(tp, 'FILE') + else: + raise NotImplementedError("internal inconsistency: %r" % + (tp,)) + self._struct_ctx(tp, None, approxname) + + def _generate_cpy_struct_collecttype(self, tp, name): + self._struct_collecttype(tp) + _generate_cpy_union_collecttype = _generate_cpy_struct_collecttype + + def _struct_names(self, tp): + cname = tp.get_c_name('') + if ' ' in cname: + return cname, cname.replace(' ', '_') + else: + return cname, '_' + cname + + def _generate_cpy_struct_decl(self, tp, name): + self._struct_decl(tp, *self._struct_names(tp)) + _generate_cpy_union_decl = _generate_cpy_struct_decl + + def _generate_cpy_struct_ctx(self, tp, name): + self._struct_ctx(tp, *self._struct_names(tp)) + _generate_cpy_union_ctx = _generate_cpy_struct_ctx + + # ---------- + # 'anonymous' declarations. These are produced for anonymous structs + # or unions; the 'name' is obtained by a typedef. + + def _generate_cpy_anonymous_collecttype(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_cpy_enum_collecttype(tp, name) + else: + self._struct_collecttype(tp) + + def _generate_cpy_anonymous_decl(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_cpy_enum_decl(tp) + else: + self._struct_decl(tp, name, 'typedef_' + name) + + def _generate_cpy_anonymous_ctx(self, tp, name): + if isinstance(tp, model.EnumType): + self._enum_ctx(tp, name) + else: + self._struct_ctx(tp, name, 'typedef_' + name) + + # ---------- + # constants, declared with "static const ..." + + def _generate_cpy_const(self, is_int, name, tp=None, category='const', + check_value=None): + if (category, name) in self._seen_constants: + raise VerificationError( + "duplicate declaration of %s '%s'" % (category, name)) + self._seen_constants.add((category, name)) + # + prnt = self._prnt + funcname = '_cffi_%s_%s' % (category, name) + if is_int: + prnt('static int %s(unsigned long long *o)' % funcname) + prnt('{') + prnt(' int n = (%s) <= 0;' % (name,)) + prnt(' *o = (unsigned long long)((%s) | 0);' + ' /* check that %s is an integer */' % (name, name)) + if check_value is not None: + if check_value > 0: + check_value = '%dU' % (check_value,) + prnt(' if (!_cffi_check_int(*o, n, %s))' % (check_value,)) + prnt(' n |= 2;') + prnt(' return n;') + prnt('}') + else: + assert check_value is None + prnt('static void %s(char *o)' % funcname) + prnt('{') + prnt(' *(%s)o = %s;' % (tp.get_c_name('*'), name)) + prnt('}') + prnt() + + def _generate_cpy_constant_collecttype(self, tp, name): + is_int = tp.is_integer_type() + if not is_int or self.target_is_python: + self._do_collect_type(tp) + + def _generate_cpy_constant_decl(self, tp, name): + is_int = tp.is_integer_type() + self._generate_cpy_const(is_int, name, tp) + + def _generate_cpy_constant_ctx(self, tp, name): + if not self.target_is_python and tp.is_integer_type(): + type_op = CffiOp(OP_CONSTANT_INT, -1) + else: + if self.target_is_python: + const_kind = OP_DLOPEN_CONST + else: + const_kind = OP_CONSTANT + type_index = self._typesdict[tp] + type_op = CffiOp(const_kind, type_index) + self._lsts["global"].append( + GlobalExpr(name, '_cffi_const_%s' % name, type_op)) + + # ---------- + # enums + + def _generate_cpy_enum_collecttype(self, tp, name): + self._do_collect_type(tp) + + def _generate_cpy_enum_decl(self, tp, name=None): + for enumerator in tp.enumerators: + self._generate_cpy_const(True, enumerator) + + def _enum_ctx(self, tp, cname): + type_index = self._typesdict[tp] + type_op = CffiOp(OP_ENUM, -1) + if self.target_is_python: + tp.check_not_partial() + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + self._lsts["global"].append( + GlobalExpr(enumerator, '_cffi_const_%s' % enumerator, type_op, + check_value=enumvalue)) + # + if cname is not None and '$' not in cname and not self.target_is_python: + size = "sizeof(%s)" % cname + signed = "((%s)-1) <= 0" % cname + else: + basetp = tp.build_baseinttype(self.ffi, []) + size = self.ffi.sizeof(basetp) + signed = int(int(self.ffi.cast(basetp, -1)) < 0) + allenums = ",".join(tp.enumerators) + self._lsts["enum"].append( + EnumExpr(tp.name, type_index, size, signed, allenums)) + + def _generate_cpy_enum_ctx(self, tp, name): + self._enum_ctx(tp, tp._get_c_name()) + + # ---------- + # macros: for now only for integers + + def _generate_cpy_macro_collecttype(self, tp, name): + pass + + def _generate_cpy_macro_decl(self, tp, name): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + self._generate_cpy_const(True, name, check_value=check_value) + + def _generate_cpy_macro_ctx(self, tp, name): + if tp == '...': + if self.target_is_python: + raise VerificationError( + "cannot use the syntax '...' in '#define %s ...' when " + "using the ABI mode" % (name,)) + check_value = None + else: + check_value = tp # an integer + type_op = CffiOp(OP_CONSTANT_INT, -1) + self._lsts["global"].append( + GlobalExpr(name, '_cffi_const_%s' % name, type_op, + check_value=check_value)) + + # ---------- + # global variables + + def _global_type(self, tp, global_name): + if isinstance(tp, model.ArrayType): + actual_length = tp.length + if actual_length == '...': + actual_length = '_cffi_array_len(%s)' % (global_name,) + tp_item = self._global_type(tp.item, '%s[0]' % global_name) + tp = model.ArrayType(tp_item, actual_length) + return tp + + def _generate_cpy_variable_collecttype(self, tp, name): + self._do_collect_type(self._global_type(tp, name)) + + def _generate_cpy_variable_decl(self, tp, name): + prnt = self._prnt + tp = self._global_type(tp, name) + if isinstance(tp, model.ArrayType) and tp.length is None: + tp = tp.item + ampersand = '' + else: + ampersand = '&' + # This code assumes that casts from "tp *" to "void *" is a + # no-op, i.e. a function that returns a "tp *" can be called + # as if it returned a "void *". This should be generally true + # on any modern machine. The only exception to that rule (on + # uncommon architectures, and as far as I can tell) might be + # if 'tp' were a function type, but that is not possible here. + # (If 'tp' is a function _pointer_ type, then casts from "fn_t + # **" to "void *" are again no-ops, as far as I can tell.) + decl = '*_cffi_var_%s(void)' % (name,) + prnt('static ' + tp.get_c_name(decl, quals=self._current_quals)) + prnt('{') + prnt(' return %s(%s);' % (ampersand, name)) + prnt('}') + prnt() + + def _generate_cpy_variable_ctx(self, tp, name): + tp = self._global_type(tp, name) + type_index = self._typesdict[tp] + if self.target_is_python: + op = OP_GLOBAL_VAR + else: + op = OP_GLOBAL_VAR_F + self._lsts["global"].append( + GlobalExpr(name, '_cffi_var_%s' % name, CffiOp(op, type_index))) + + # ---------- + # extern "Python" + + def _generate_cpy_extern_python_collecttype(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + self._do_collect_type(tp) + _generate_cpy_dllexport_python_collecttype = \ + _generate_cpy_extern_python_plus_c_collecttype = \ + _generate_cpy_extern_python_collecttype + + def _extern_python_decl(self, tp, name, tag_and_space): + prnt = self._prnt + if isinstance(tp.result, model.VoidType): + size_of_result = '0' + else: + context = 'result of %s' % name + size_of_result = '(int)sizeof(%s)' % ( + tp.result.get_c_name('', context),) + prnt('static struct _cffi_externpy_s _cffi_externpy__%s =' % name) + prnt(' { "%s.%s", %s, 0, 0 };' % ( + self.module_name, name, size_of_result)) + prnt() + # + arguments = [] + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + arg = type.get_c_name(' a%d' % i, context) + arguments.append(arg) + # + repr_arguments = ', '.join(arguments) + repr_arguments = repr_arguments or 'void' + name_and_arguments = '%s(%s)' % (name, repr_arguments) + if tp.abi == "__stdcall": + name_and_arguments = '_cffi_stdcall ' + name_and_arguments + # + def may_need_128_bits(tp): + return (isinstance(tp, model.PrimitiveType) and + tp.name == 'long double') + # + size_of_a = max(len(tp.args)*8, 8) + if may_need_128_bits(tp.result): + size_of_a = max(size_of_a, 16) + if isinstance(tp.result, model.StructOrUnion): + size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % ( + tp.result.get_c_name(''), size_of_a, + tp.result.get_c_name(''), size_of_a) + prnt('%s%s' % (tag_and_space, tp.result.get_c_name(name_and_arguments))) + prnt('{') + prnt(' char a[%s];' % size_of_a) + prnt(' char *p = a;') + for i, type in enumerate(tp.args): + arg = 'a%d' % i + if (isinstance(type, model.StructOrUnion) or + may_need_128_bits(type)): + arg = '&' + arg + type = model.PointerType(type) + prnt(' *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg)) + prnt(' _cffi_call_python(&_cffi_externpy__%s, p);' % name) + if not isinstance(tp.result, model.VoidType): + prnt(' return *(%s)p;' % (tp.result.get_c_name('*'),)) + prnt('}') + prnt() + self._num_externpy += 1 + + def _generate_cpy_extern_python_decl(self, tp, name): + self._extern_python_decl(tp, name, 'static ') + + def _generate_cpy_dllexport_python_decl(self, tp, name): + self._extern_python_decl(tp, name, 'CFFI_DLLEXPORT ') + + def _generate_cpy_extern_python_plus_c_decl(self, tp, name): + self._extern_python_decl(tp, name, '') + + def _generate_cpy_extern_python_ctx(self, tp, name): + if self.target_is_python: + raise VerificationError( + "cannot use 'extern \"Python\"' in the ABI mode") + if tp.ellipsis: + raise NotImplementedError("a vararg function is extern \"Python\"") + type_index = self._typesdict[tp] + type_op = CffiOp(OP_EXTERN_PYTHON, type_index) + self._lsts["global"].append( + GlobalExpr(name, '&_cffi_externpy__%s' % name, type_op, name)) + + _generate_cpy_dllexport_python_ctx = \ + _generate_cpy_extern_python_plus_c_ctx = \ + _generate_cpy_extern_python_ctx + + def _print_string_literal_in_array(self, s): + prnt = self._prnt + prnt('// # NB. this is not a string because of a size limit in MSVC') + if not isinstance(s, bytes): # unicode + s = s.encode('utf-8') # -> bytes + else: + s.decode('utf-8') # got bytes, check for valid utf-8 + try: + s.decode('ascii') + except UnicodeDecodeError: + s = b'# -*- encoding: utf8 -*-\n' + s + for line in s.splitlines(True): + comment = line + if type('//') is bytes: # python2 + line = map(ord, line) # make a list of integers + else: # python3 + # type(line) is bytes, which enumerates like a list of integers + comment = ascii(comment)[1:-1] + prnt(('// ' + comment).rstrip()) + printed_line = '' + for c in line: + if len(printed_line) >= 76: + prnt(printed_line) + printed_line = '' + printed_line += '%d,' % (c,) + prnt(printed_line) + + # ---------- + # emitting the opcodes for individual types + + def _emit_bytecode_VoidType(self, tp, index): + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, PRIM_VOID) + + def _emit_bytecode_PrimitiveType(self, tp, index): + prim_index = PRIMITIVE_TO_INDEX[tp.name] + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, prim_index) + + def _emit_bytecode_UnknownIntegerType(self, tp, index): + s = ('_cffi_prim_int(sizeof(%s), (\n' + ' ((%s)-1) | 0 /* check that %s is an integer type */\n' + ' ) <= 0)' % (tp.name, tp.name, tp.name)) + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s) + + def _emit_bytecode_UnknownFloatType(self, tp, index): + s = ('_cffi_prim_float(sizeof(%s) *\n' + ' (((%s)1) / 2) * 2 /* integer => 0, float => 1 */\n' + ' )' % (tp.name, tp.name)) + self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s) + + def _emit_bytecode_RawFunctionType(self, tp, index): + self.cffi_types[index] = CffiOp(OP_FUNCTION, self._typesdict[tp.result]) + index += 1 + for tp1 in tp.args: + realindex = self._typesdict[tp1] + if index != realindex: + if isinstance(tp1, model.PrimitiveType): + self._emit_bytecode_PrimitiveType(tp1, index) + else: + self.cffi_types[index] = CffiOp(OP_NOOP, realindex) + index += 1 + flags = int(tp.ellipsis) + if tp.abi is not None: + if tp.abi == '__stdcall': + flags |= 2 + else: + raise NotImplementedError("abi=%r" % (tp.abi,)) + self.cffi_types[index] = CffiOp(OP_FUNCTION_END, flags) + + def _emit_bytecode_PointerType(self, tp, index): + self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[tp.totype]) + + _emit_bytecode_ConstPointerType = _emit_bytecode_PointerType + _emit_bytecode_NamedPointerType = _emit_bytecode_PointerType + + def _emit_bytecode_FunctionPtrType(self, tp, index): + raw = tp.as_raw_function() + self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[raw]) + + def _emit_bytecode_ArrayType(self, tp, index): + item_index = self._typesdict[tp.item] + if tp.length is None: + self.cffi_types[index] = CffiOp(OP_OPEN_ARRAY, item_index) + elif tp.length == '...': + raise VerificationError( + "type %s badly placed: the '...' array length can only be " + "used on global arrays or on fields of structures" % ( + str(tp).replace('/*...*/', '...'),)) + else: + assert self.cffi_types[index + 1] == 'LEN' + self.cffi_types[index] = CffiOp(OP_ARRAY, item_index) + self.cffi_types[index + 1] = CffiOp(None, str(tp.length)) + + def _emit_bytecode_StructType(self, tp, index): + struct_index = self._struct_unions[tp] + self.cffi_types[index] = CffiOp(OP_STRUCT_UNION, struct_index) + _emit_bytecode_UnionType = _emit_bytecode_StructType + + def _emit_bytecode_EnumType(self, tp, index): + enum_index = self._enums[tp] + self.cffi_types[index] = CffiOp(OP_ENUM, enum_index) + + +if sys.version_info >= (3,): + NativeIO = io.StringIO +else: + class NativeIO(io.BytesIO): + def write(self, s): + if isinstance(s, unicode): + s = s.encode('ascii') + super(NativeIO, self).write(s) + +def _make_c_or_py_source(ffi, module_name, preamble, target_file, verbose): + if verbose: + print("generating %s" % (target_file,)) + recompiler = Recompiler(ffi, module_name, + target_is_python=(preamble is None)) + recompiler.collect_type_table() + recompiler.collect_step_tables() + f = NativeIO() + recompiler.write_source_to_f(f, preamble) + output = f.getvalue() + try: + with open(target_file, 'r') as f1: + if f1.read(len(output) + 1) != output: + raise IOError + if verbose: + print("(already up-to-date)") + return False # already up-to-date + except IOError: + tmp_file = '%s.~%d' % (target_file, os.getpid()) + with open(tmp_file, 'w') as f1: + f1.write(output) + try: + os.rename(tmp_file, target_file) + except OSError: + os.unlink(target_file) + os.rename(tmp_file, target_file) + return True + +def make_c_source(ffi, module_name, preamble, target_c_file, verbose=False): + assert preamble is not None + return _make_c_or_py_source(ffi, module_name, preamble, target_c_file, + verbose) + +def make_py_source(ffi, module_name, target_py_file, verbose=False): + return _make_c_or_py_source(ffi, module_name, None, target_py_file, + verbose) + +def _modname_to_file(outputdir, modname, extension): + parts = modname.split('.') + try: + os.makedirs(os.path.join(outputdir, *parts[:-1])) + except OSError: + pass + parts[-1] += extension + return os.path.join(outputdir, *parts), parts + + +# Aaargh. Distutils is not tested at all for the purpose of compiling +# DLLs that are not extension modules. Here are some hacks to work +# around that, in the _patch_for_*() functions... + +def _patch_meth(patchlist, cls, name, new_meth): + old = getattr(cls, name) + patchlist.append((cls, name, old)) + setattr(cls, name, new_meth) + return old + +def _unpatch_meths(patchlist): + for cls, name, old_meth in reversed(patchlist): + setattr(cls, name, old_meth) + +def _patch_for_embedding(patchlist): + if sys.platform == 'win32': + # we must not remove the manifest when building for embedding! + from distutils.msvc9compiler import MSVCCompiler + _patch_meth(patchlist, MSVCCompiler, '_remove_visual_c_ref', + lambda self, manifest_file: manifest_file) + + if sys.platform == 'darwin': + # we must not make a '-bundle', but a '-dynamiclib' instead + from distutils.ccompiler import CCompiler + def my_link_shared_object(self, *args, **kwds): + if '-bundle' in self.linker_so: + self.linker_so = list(self.linker_so) + i = self.linker_so.index('-bundle') + self.linker_so[i] = '-dynamiclib' + return old_link_shared_object(self, *args, **kwds) + old_link_shared_object = _patch_meth(patchlist, CCompiler, + 'link_shared_object', + my_link_shared_object) + +def _patch_for_target(patchlist, target): + from distutils.command.build_ext import build_ext + # if 'target' is different from '*', we need to patch some internal + # method to just return this 'target' value, instead of having it + # built from module_name + if target.endswith('.*'): + target = target[:-2] + if sys.platform == 'win32': + target += '.dll' + elif sys.platform == 'darwin': + target += '.dylib' + else: + target += '.so' + _patch_meth(patchlist, build_ext, 'get_ext_filename', + lambda self, ext_name: target) + + +def recompile(ffi, module_name, preamble, tmpdir='.', call_c_compiler=True, + c_file=None, source_extension='.c', extradir=None, + compiler_verbose=1, target=None, debug=None, **kwds): + if not isinstance(module_name, str): + module_name = module_name.encode('ascii') + if ffi._windows_unicode: + ffi._apply_windows_unicode(kwds) + if preamble is not None: + embedding = (ffi._embedding is not None) + if embedding: + ffi._apply_embedding_fix(kwds) + if c_file is None: + c_file, parts = _modname_to_file(tmpdir, module_name, + source_extension) + if extradir: + parts = [extradir] + parts + ext_c_file = os.path.join(*parts) + else: + ext_c_file = c_file + # + if target is None: + if embedding: + target = '%s.*' % module_name + else: + target = '*' + # + ext = ffiplatform.get_extension(ext_c_file, module_name, **kwds) + updated = make_c_source(ffi, module_name, preamble, c_file, + verbose=compiler_verbose) + if call_c_compiler: + patchlist = [] + cwd = os.getcwd() + try: + if embedding: + _patch_for_embedding(patchlist) + if target != '*': + _patch_for_target(patchlist, target) + if compiler_verbose: + if tmpdir == '.': + msg = 'the current directory is' + else: + msg = 'setting the current directory to' + print('%s %r' % (msg, os.path.abspath(tmpdir))) + os.chdir(tmpdir) + outputfilename = ffiplatform.compile('.', ext, + compiler_verbose, debug) + finally: + os.chdir(cwd) + _unpatch_meths(patchlist) + return outputfilename + else: + return ext, updated + else: + if c_file is None: + c_file, _ = _modname_to_file(tmpdir, module_name, '.py') + updated = make_py_source(ffi, module_name, c_file, + verbose=compiler_verbose) + if call_c_compiler: + return c_file + else: + return None, updated + diff --git a/jwt/python/cffi/setuptools_ext.py b/jwt/python/cffi/setuptools_ext.py new file mode 100644 index 0000000..8fe3614 --- /dev/null +++ b/jwt/python/cffi/setuptools_ext.py @@ -0,0 +1,219 @@ +import os +import sys + +try: + basestring +except NameError: + # Python 3.x + basestring = str + +def error(msg): + from distutils.errors import DistutilsSetupError + raise DistutilsSetupError(msg) + + +def execfile(filename, glob): + # We use execfile() (here rewritten for Python 3) instead of + # __import__() to load the build script. The problem with + # a normal import is that in some packages, the intermediate + # __init__.py files may already try to import the file that + # we are generating. + with open(filename) as f: + src = f.read() + src += '\n' # Python 2.6 compatibility + code = compile(src, filename, 'exec') + exec(code, glob, glob) + + +def add_cffi_module(dist, mod_spec): + from cffi.api import FFI + + if not isinstance(mod_spec, basestring): + error("argument to 'cffi_modules=...' must be a str or a list of str," + " not %r" % (type(mod_spec).__name__,)) + mod_spec = str(mod_spec) + try: + build_file_name, ffi_var_name = mod_spec.split(':') + except ValueError: + error("%r must be of the form 'path/build.py:ffi_variable'" % + (mod_spec,)) + if not os.path.exists(build_file_name): + ext = '' + rewritten = build_file_name.replace('.', '/') + '.py' + if os.path.exists(rewritten): + ext = ' (rewrite cffi_modules to [%r])' % ( + rewritten + ':' + ffi_var_name,) + error("%r does not name an existing file%s" % (build_file_name, ext)) + + mod_vars = {'__name__': '__cffi__', '__file__': build_file_name} + execfile(build_file_name, mod_vars) + + try: + ffi = mod_vars[ffi_var_name] + except KeyError: + error("%r: object %r not found in module" % (mod_spec, + ffi_var_name)) + if not isinstance(ffi, FFI): + ffi = ffi() # maybe it's a function instead of directly an ffi + if not isinstance(ffi, FFI): + error("%r is not an FFI instance (got %r)" % (mod_spec, + type(ffi).__name__)) + if not hasattr(ffi, '_assigned_source'): + error("%r: the set_source() method was not called" % (mod_spec,)) + module_name, source, source_extension, kwds = ffi._assigned_source + if ffi._windows_unicode: + kwds = kwds.copy() + ffi._apply_windows_unicode(kwds) + + if source is None: + _add_py_module(dist, ffi, module_name) + else: + _add_c_module(dist, ffi, module_name, source, source_extension, kwds) + +def _set_py_limited_api(Extension, kwds): + """ + Add py_limited_api to kwds if setuptools >= 26 is in use. + Do not alter the setting if it already exists. + Setuptools takes care of ignoring the flag on Python 2 and PyPy. + + CPython itself should ignore the flag in a debugging version + (by not listing .abi3.so in the extensions it supports), but + it doesn't so far, creating troubles. That's why we check + for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent + of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401) + + On Windows, with CPython <= 3.4, it's better not to use py_limited_api + because virtualenv *still* doesn't copy PYTHON3.DLL on these versions. + Recently (2020) we started shipping only >= 3.5 wheels, though. So + we'll give it another try and set py_limited_api on Windows >= 3.5. + """ + from cffi import recompiler + + if ('py_limited_api' not in kwds and not hasattr(sys, 'gettotalrefcount') + and recompiler.USE_LIMITED_API): + import setuptools + try: + setuptools_major_version = int(setuptools.__version__.partition('.')[0]) + if setuptools_major_version >= 26: + kwds['py_limited_api'] = True + except ValueError: # certain development versions of setuptools + # If we don't know the version number of setuptools, we + # try to set 'py_limited_api' anyway. At worst, we get a + # warning. + kwds['py_limited_api'] = True + return kwds + +def _add_c_module(dist, ffi, module_name, source, source_extension, kwds): + from distutils.core import Extension + # We are a setuptools extension. Need this build_ext for py_limited_api. + from setuptools.command.build_ext import build_ext + from distutils.dir_util import mkpath + from distutils import log + from cffi import recompiler + + allsources = ['$PLACEHOLDER'] + allsources.extend(kwds.pop('sources', [])) + kwds = _set_py_limited_api(Extension, kwds) + ext = Extension(name=module_name, sources=allsources, **kwds) + + def make_mod(tmpdir, pre_run=None): + c_file = os.path.join(tmpdir, module_name + source_extension) + log.info("generating cffi module %r" % c_file) + mkpath(tmpdir) + # a setuptools-only, API-only hook: called with the "ext" and "ffi" + # arguments just before we turn the ffi into C code. To use it, + # subclass the 'distutils.command.build_ext.build_ext' class and + # add a method 'def pre_run(self, ext, ffi)'. + if pre_run is not None: + pre_run(ext, ffi) + updated = recompiler.make_c_source(ffi, module_name, source, c_file) + if not updated: + log.info("already up-to-date") + return c_file + + if dist.ext_modules is None: + dist.ext_modules = [] + dist.ext_modules.append(ext) + + base_class = dist.cmdclass.get('build_ext', build_ext) + class build_ext_make_mod(base_class): + def run(self): + if ext.sources[0] == '$PLACEHOLDER': + pre_run = getattr(self, 'pre_run', None) + ext.sources[0] = make_mod(self.build_temp, pre_run) + base_class.run(self) + dist.cmdclass['build_ext'] = build_ext_make_mod + # NB. multiple runs here will create multiple 'build_ext_make_mod' + # classes. Even in this case the 'build_ext' command should be + # run once; but just in case, the logic above does nothing if + # called again. + + +def _add_py_module(dist, ffi, module_name): + from distutils.dir_util import mkpath + from setuptools.command.build_py import build_py + from setuptools.command.build_ext import build_ext + from distutils import log + from cffi import recompiler + + def generate_mod(py_file): + log.info("generating cffi module %r" % py_file) + mkpath(os.path.dirname(py_file)) + updated = recompiler.make_py_source(ffi, module_name, py_file) + if not updated: + log.info("already up-to-date") + + base_class = dist.cmdclass.get('build_py', build_py) + class build_py_make_mod(base_class): + def run(self): + base_class.run(self) + module_path = module_name.split('.') + module_path[-1] += '.py' + generate_mod(os.path.join(self.build_lib, *module_path)) + def get_source_files(self): + # This is called from 'setup.py sdist' only. Exclude + # the generate .py module in this case. + saved_py_modules = self.py_modules + try: + if saved_py_modules: + self.py_modules = [m for m in saved_py_modules + if m != module_name] + return base_class.get_source_files(self) + finally: + self.py_modules = saved_py_modules + dist.cmdclass['build_py'] = build_py_make_mod + + # distutils and setuptools have no notion I could find of a + # generated python module. If we don't add module_name to + # dist.py_modules, then things mostly work but there are some + # combination of options (--root and --record) that will miss + # the module. So we add it here, which gives a few apparently + # harmless warnings about not finding the file outside the + # build directory. + # Then we need to hack more in get_source_files(); see above. + if dist.py_modules is None: + dist.py_modules = [] + dist.py_modules.append(module_name) + + # the following is only for "build_ext -i" + base_class_2 = dist.cmdclass.get('build_ext', build_ext) + class build_ext_make_mod(base_class_2): + def run(self): + base_class_2.run(self) + if self.inplace: + # from get_ext_fullpath() in distutils/command/build_ext.py + module_path = module_name.split('.') + package = '.'.join(module_path[:-1]) + build_py = self.get_finalized_command('build_py') + package_dir = build_py.get_package_dir(package) + file_name = module_path[-1] + '.py' + generate_mod(os.path.join(package_dir, file_name)) + dist.cmdclass['build_ext'] = build_ext_make_mod + +def cffi_modules(dist, attr, value): + assert attr == 'cffi_modules' + if isinstance(value, basestring): + value = [value] + + for cffi_module in value: + add_cffi_module(dist, cffi_module) diff --git a/jwt/python/cffi/vengine_cpy.py b/jwt/python/cffi/vengine_cpy.py new file mode 100644 index 0000000..6de0df0 --- /dev/null +++ b/jwt/python/cffi/vengine_cpy.py @@ -0,0 +1,1076 @@ +# +# DEPRECATED: implementation for ffi.verify() +# +import sys, imp +from . import model +from .error import VerificationError + + +class VCPythonEngine(object): + _class_key = 'x' + _gen_python_module = True + + def __init__(self, verifier): + self.verifier = verifier + self.ffi = verifier.ffi + self._struct_pending_verification = {} + self._types_of_builtin_functions = {} + + def patch_extension_kwds(self, kwds): + pass + + def find_module(self, module_name, path, so_suffixes): + try: + f, filename, descr = imp.find_module(module_name, path) + except ImportError: + return None + if f is not None: + f.close() + # Note that after a setuptools installation, there are both .py + # and .so files with the same basename. The code here relies on + # imp.find_module() locating the .so in priority. + if descr[0] not in so_suffixes: + return None + return filename + + def collect_types(self): + self._typesdict = {} + self._generate("collecttype") + + def _prnt(self, what=''): + self._f.write(what + '\n') + + def _gettypenum(self, type): + # a KeyError here is a bug. please report it! :-) + return self._typesdict[type] + + def _do_collect_type(self, tp): + if ((not isinstance(tp, model.PrimitiveType) + or tp.name == 'long double') + and tp not in self._typesdict): + num = len(self._typesdict) + self._typesdict[tp] = num + + def write_source_to_f(self): + self.collect_types() + # + # The new module will have a _cffi_setup() function that receives + # objects from the ffi world, and that calls some setup code in + # the module. This setup code is split in several independent + # functions, e.g. one per constant. The functions are "chained" + # by ending in a tail call to each other. + # + # This is further split in two chained lists, depending on if we + # can do it at import-time or if we must wait for _cffi_setup() to + # provide us with the objects. This is needed because we + # need the values of the enum constants in order to build the + # that we may have to pass to _cffi_setup(). + # + # The following two 'chained_list_constants' items contains + # the head of these two chained lists, as a string that gives the + # call to do, if any. + self._chained_list_constants = ['((void)lib,0)', '((void)lib,0)'] + # + prnt = self._prnt + # first paste some standard set of lines that are mostly '#define' + prnt(cffimod_header) + prnt() + # then paste the C source given by the user, verbatim. + prnt(self.verifier.preamble) + prnt() + # + # call generate_cpy_xxx_decl(), for every xxx found from + # ffi._parser._declarations. This generates all the functions. + self._generate("decl") + # + # implement the function _cffi_setup_custom() as calling the + # head of the chained list. + self._generate_setup_custom() + prnt() + # + # produce the method table, including the entries for the + # generated Python->C function wrappers, which are done + # by generate_cpy_function_method(). + prnt('static PyMethodDef _cffi_methods[] = {') + self._generate("method") + prnt(' {"_cffi_setup", _cffi_setup, METH_VARARGS, NULL},') + prnt(' {NULL, NULL, 0, NULL} /* Sentinel */') + prnt('};') + prnt() + # + # standard init. + modname = self.verifier.get_module_name() + constants = self._chained_list_constants[False] + prnt('#if PY_MAJOR_VERSION >= 3') + prnt() + prnt('static struct PyModuleDef _cffi_module_def = {') + prnt(' PyModuleDef_HEAD_INIT,') + prnt(' "%s",' % modname) + prnt(' NULL,') + prnt(' -1,') + prnt(' _cffi_methods,') + prnt(' NULL, NULL, NULL, NULL') + prnt('};') + prnt() + prnt('PyMODINIT_FUNC') + prnt('PyInit_%s(void)' % modname) + prnt('{') + prnt(' PyObject *lib;') + prnt(' lib = PyModule_Create(&_cffi_module_def);') + prnt(' if (lib == NULL)') + prnt(' return NULL;') + prnt(' if (%s < 0 || _cffi_init() < 0) {' % (constants,)) + prnt(' Py_DECREF(lib);') + prnt(' return NULL;') + prnt(' }') + prnt(' return lib;') + prnt('}') + prnt() + prnt('#else') + prnt() + prnt('PyMODINIT_FUNC') + prnt('init%s(void)' % modname) + prnt('{') + prnt(' PyObject *lib;') + prnt(' lib = Py_InitModule("%s", _cffi_methods);' % modname) + prnt(' if (lib == NULL)') + prnt(' return;') + prnt(' if (%s < 0 || _cffi_init() < 0)' % (constants,)) + prnt(' return;') + prnt(' return;') + prnt('}') + prnt() + prnt('#endif') + + def load_library(self, flags=None): + # XXX review all usages of 'self' here! + # import it as a new extension module + imp.acquire_lock() + try: + if hasattr(sys, "getdlopenflags"): + previous_flags = sys.getdlopenflags() + try: + if hasattr(sys, "setdlopenflags") and flags is not None: + sys.setdlopenflags(flags) + module = imp.load_dynamic(self.verifier.get_module_name(), + self.verifier.modulefilename) + except ImportError as e: + error = "importing %r: %s" % (self.verifier.modulefilename, e) + raise VerificationError(error) + finally: + if hasattr(sys, "setdlopenflags"): + sys.setdlopenflags(previous_flags) + finally: + imp.release_lock() + # + # call loading_cpy_struct() to get the struct layout inferred by + # the C compiler + self._load(module, 'loading') + # + # the C code will need the objects. Collect them in + # order in a list. + revmapping = dict([(value, key) + for (key, value) in self._typesdict.items()]) + lst = [revmapping[i] for i in range(len(revmapping))] + lst = list(map(self.ffi._get_cached_btype, lst)) + # + # build the FFILibrary class and instance and call _cffi_setup(). + # this will set up some fields like '_cffi_types', and only then + # it will invoke the chained list of functions that will really + # build (notably) the constant objects, as if they are + # pointers, and store them as attributes on the 'library' object. + class FFILibrary(object): + _cffi_python_module = module + _cffi_ffi = self.ffi + _cffi_dir = [] + def __dir__(self): + return FFILibrary._cffi_dir + list(self.__dict__) + library = FFILibrary() + if module._cffi_setup(lst, VerificationError, library): + import warnings + warnings.warn("reimporting %r might overwrite older definitions" + % (self.verifier.get_module_name())) + # + # finally, call the loaded_cpy_xxx() functions. This will perform + # the final adjustments, like copying the Python->C wrapper + # functions from the module to the 'library' object, and setting + # up the FFILibrary class with properties for the global C variables. + self._load(module, 'loaded', library=library) + module._cffi_original_ffi = self.ffi + module._cffi_types_of_builtin_funcs = self._types_of_builtin_functions + return library + + def _get_declarations(self): + lst = [(key, tp) for (key, (tp, qual)) in + self.ffi._parser._declarations.items()] + lst.sort() + return lst + + def _generate(self, step_name): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + try: + method = getattr(self, '_generate_cpy_%s_%s' % (kind, + step_name)) + except AttributeError: + raise VerificationError( + "not implemented in verify(): %r" % name) + try: + method(tp, realname) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _load(self, module, step_name, **kwds): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + method = getattr(self, '_%s_cpy_%s' % (step_name, kind)) + try: + method(tp, realname, module, **kwds) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _generate_nothing(self, tp, name): + pass + + def _loaded_noop(self, tp, name, module, **kwds): + pass + + # ---------- + + def _convert_funcarg_to_c(self, tp, fromvar, tovar, errcode): + extraarg = '' + if isinstance(tp, model.PrimitiveType): + if tp.is_integer_type() and tp.name != '_Bool': + converter = '_cffi_to_c_int' + extraarg = ', %s' % tp.name + else: + converter = '(%s)_cffi_to_c_%s' % (tp.get_c_name(''), + tp.name.replace(' ', '_')) + errvalue = '-1' + # + elif isinstance(tp, model.PointerType): + self._convert_funcarg_to_c_ptr_or_array(tp, fromvar, + tovar, errcode) + return + # + elif isinstance(tp, (model.StructOrUnion, model.EnumType)): + # a struct (not a struct pointer) as a function argument + self._prnt(' if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)' + % (tovar, self._gettypenum(tp), fromvar)) + self._prnt(' %s;' % errcode) + return + # + elif isinstance(tp, model.FunctionPtrType): + converter = '(%s)_cffi_to_c_pointer' % tp.get_c_name('') + extraarg = ', _cffi_type(%d)' % self._gettypenum(tp) + errvalue = 'NULL' + # + else: + raise NotImplementedError(tp) + # + self._prnt(' %s = %s(%s%s);' % (tovar, converter, fromvar, extraarg)) + self._prnt(' if (%s == (%s)%s && PyErr_Occurred())' % ( + tovar, tp.get_c_name(''), errvalue)) + self._prnt(' %s;' % errcode) + + def _extra_local_variables(self, tp, localvars, freelines): + if isinstance(tp, model.PointerType): + localvars.add('Py_ssize_t datasize') + localvars.add('struct _cffi_freeme_s *large_args_free = NULL') + freelines.add('if (large_args_free != NULL)' + ' _cffi_free_array_arguments(large_args_free);') + + def _convert_funcarg_to_c_ptr_or_array(self, tp, fromvar, tovar, errcode): + self._prnt(' datasize = _cffi_prepare_pointer_call_argument(') + self._prnt(' _cffi_type(%d), %s, (char **)&%s);' % ( + self._gettypenum(tp), fromvar, tovar)) + self._prnt(' if (datasize != 0) {') + self._prnt(' %s = ((size_t)datasize) <= 640 ? ' + 'alloca((size_t)datasize) : NULL;' % (tovar,)) + self._prnt(' if (_cffi_convert_array_argument(_cffi_type(%d), %s, ' + '(char **)&%s,' % (self._gettypenum(tp), fromvar, tovar)) + self._prnt(' datasize, &large_args_free) < 0)') + self._prnt(' %s;' % errcode) + self._prnt(' }') + + def _convert_expr_from_c(self, tp, var, context): + if isinstance(tp, model.PrimitiveType): + if tp.is_integer_type() and tp.name != '_Bool': + return '_cffi_from_c_int(%s, %s)' % (var, tp.name) + elif tp.name != 'long double': + return '_cffi_from_c_%s(%s)' % (tp.name.replace(' ', '_'), var) + else: + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, (model.PointerType, model.FunctionPtrType)): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.ArrayType): + return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % ( + var, self._gettypenum(model.PointerType(tp.item))) + elif isinstance(tp, model.StructOrUnion): + if tp.fldnames is None: + raise TypeError("'%s' is used as %s, but is opaque" % ( + tp._get_c_name(), context)) + return '_cffi_from_c_struct((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + elif isinstance(tp, model.EnumType): + return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % ( + var, self._gettypenum(tp)) + else: + raise NotImplementedError(tp) + + # ---------- + # typedefs: generates no code so far + + _generate_cpy_typedef_collecttype = _generate_nothing + _generate_cpy_typedef_decl = _generate_nothing + _generate_cpy_typedef_method = _generate_nothing + _loading_cpy_typedef = _loaded_noop + _loaded_cpy_typedef = _loaded_noop + + # ---------- + # function declarations + + def _generate_cpy_function_collecttype(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + self._do_collect_type(tp) + else: + # don't call _do_collect_type(tp) in this common case, + # otherwise test_autofilled_struct_as_argument fails + for type in tp.args: + self._do_collect_type(type) + self._do_collect_type(tp.result) + + def _generate_cpy_function_decl(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + # cannot support vararg functions better than this: check for its + # exact type (including the fixed arguments), and build it as a + # constant function pointer (no CPython wrapper) + self._generate_cpy_const(False, name, tp) + return + prnt = self._prnt + numargs = len(tp.args) + if numargs == 0: + argname = 'noarg' + elif numargs == 1: + argname = 'arg0' + else: + argname = 'args' + prnt('static PyObject *') + prnt('_cffi_f_%s(PyObject *self, PyObject *%s)' % (name, argname)) + prnt('{') + # + context = 'argument of %s' % name + for i, type in enumerate(tp.args): + prnt(' %s;' % type.get_c_name(' x%d' % i, context)) + # + localvars = set() + freelines = set() + for type in tp.args: + self._extra_local_variables(type, localvars, freelines) + for decl in sorted(localvars): + prnt(' %s;' % (decl,)) + # + if not isinstance(tp.result, model.VoidType): + result_code = 'result = ' + context = 'result of %s' % name + prnt(' %s;' % tp.result.get_c_name(' result', context)) + prnt(' PyObject *pyresult;') + else: + result_code = '' + # + if len(tp.args) > 1: + rng = range(len(tp.args)) + for i in rng: + prnt(' PyObject *arg%d;' % i) + prnt() + prnt(' if (!PyArg_ParseTuple(args, "%s:%s", %s))' % ( + 'O' * numargs, name, ', '.join(['&arg%d' % i for i in rng]))) + prnt(' return NULL;') + prnt() + # + for i, type in enumerate(tp.args): + self._convert_funcarg_to_c(type, 'arg%d' % i, 'x%d' % i, + 'return NULL') + prnt() + # + prnt(' Py_BEGIN_ALLOW_THREADS') + prnt(' _cffi_restore_errno();') + prnt(' { %s%s(%s); }' % ( + result_code, name, + ', '.join(['x%d' % i for i in range(len(tp.args))]))) + prnt(' _cffi_save_errno();') + prnt(' Py_END_ALLOW_THREADS') + prnt() + # + prnt(' (void)self; /* unused */') + if numargs == 0: + prnt(' (void)noarg; /* unused */') + if result_code: + prnt(' pyresult = %s;' % + self._convert_expr_from_c(tp.result, 'result', 'result type')) + for freeline in freelines: + prnt(' ' + freeline) + prnt(' return pyresult;') + else: + for freeline in freelines: + prnt(' ' + freeline) + prnt(' Py_INCREF(Py_None);') + prnt(' return Py_None;') + prnt('}') + prnt() + + def _generate_cpy_function_method(self, tp, name): + if tp.ellipsis: + return + numargs = len(tp.args) + if numargs == 0: + meth = 'METH_NOARGS' + elif numargs == 1: + meth = 'METH_O' + else: + meth = 'METH_VARARGS' + self._prnt(' {"%s", _cffi_f_%s, %s, NULL},' % (name, name, meth)) + + _loading_cpy_function = _loaded_noop + + def _loaded_cpy_function(self, tp, name, module, library): + if tp.ellipsis: + return + func = getattr(module, name) + setattr(library, name, func) + self._types_of_builtin_functions[func] = tp + + # ---------- + # named structs + + _generate_cpy_struct_collecttype = _generate_nothing + def _generate_cpy_struct_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'struct', name) + def _generate_cpy_struct_method(self, tp, name): + self._generate_struct_or_union_method(tp, 'struct', name) + def _loading_cpy_struct(self, tp, name, module): + self._loading_struct_or_union(tp, 'struct', name, module) + def _loaded_cpy_struct(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + _generate_cpy_union_collecttype = _generate_nothing + def _generate_cpy_union_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'union', name) + def _generate_cpy_union_method(self, tp, name): + self._generate_struct_or_union_method(tp, 'union', name) + def _loading_cpy_union(self, tp, name, module): + self._loading_struct_or_union(tp, 'union', name, module) + def _loaded_cpy_union(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + def _generate_struct_or_union_decl(self, tp, prefix, name): + if tp.fldnames is None: + return # nothing to do with opaque structs + checkfuncname = '_cffi_check_%s_%s' % (prefix, name) + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + cname = ('%s %s' % (prefix, name)).strip() + # + prnt = self._prnt + prnt('static void %s(%s *p)' % (checkfuncname, cname)) + prnt('{') + prnt(' /* only to generate compile-time warnings or errors */') + prnt(' (void)p;') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if (isinstance(ftype, model.PrimitiveType) + and ftype.is_integer_type()) or fbitsize >= 0: + # accept all integers, but complain on float or double + prnt(' (void)((p->%s) << 1);' % fname) + else: + # only accept exactly the type declared. + try: + prnt(' { %s = &p->%s; (void)tmp; }' % ( + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) + except VerificationError as e: + prnt(' /* %s */' % str(e)) # cannot verify it, ignore + prnt('}') + prnt('static PyObject *') + prnt('%s(PyObject *self, PyObject *noarg)' % (layoutfuncname,)) + prnt('{') + prnt(' struct _cffi_aligncheck { char x; %s y; };' % cname) + prnt(' static Py_ssize_t nums[] = {') + prnt(' sizeof(%s),' % cname) + prnt(' offsetof(struct _cffi_aligncheck, y),') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + prnt(' offsetof(%s, %s),' % (cname, fname)) + if isinstance(ftype, model.ArrayType) and ftype.length is None: + prnt(' 0, /* %s */' % ftype._get_c_name()) + else: + prnt(' sizeof(((%s *)0)->%s),' % (cname, fname)) + prnt(' -1') + prnt(' };') + prnt(' (void)self; /* unused */') + prnt(' (void)noarg; /* unused */') + prnt(' return _cffi_get_struct_layout(nums);') + prnt(' /* the next line is not executed, but compiled */') + prnt(' %s(0);' % (checkfuncname,)) + prnt('}') + prnt() + + def _generate_struct_or_union_method(self, tp, prefix, name): + if tp.fldnames is None: + return # nothing to do with opaque structs + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + self._prnt(' {"%s", %s, METH_NOARGS, NULL},' % (layoutfuncname, + layoutfuncname)) + + def _loading_struct_or_union(self, tp, prefix, name, module): + if tp.fldnames is None: + return # nothing to do with opaque structs + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + # + function = getattr(module, layoutfuncname) + layout = function() + if isinstance(tp, model.StructOrUnion) and tp.partial: + # use the function()'s sizes and offsets to guide the + # layout of the struct + totalsize = layout[0] + totalalignment = layout[1] + fieldofs = layout[2::2] + fieldsize = layout[3::2] + tp.force_flatten() + assert len(fieldofs) == len(fieldsize) == len(tp.fldnames) + tp.fixedlayout = fieldofs, fieldsize, totalsize, totalalignment + else: + cname = ('%s %s' % (prefix, name)).strip() + self._struct_pending_verification[tp] = layout, cname + + def _loaded_struct_or_union(self, tp): + if tp.fldnames is None: + return # nothing to do with opaque structs + self.ffi._get_cached_btype(tp) # force 'fixedlayout' to be considered + + if tp in self._struct_pending_verification: + # check that the layout sizes and offsets match the real ones + def check(realvalue, expectedvalue, msg): + if realvalue != expectedvalue: + raise VerificationError( + "%s (we have %d, but C compiler says %d)" + % (msg, expectedvalue, realvalue)) + ffi = self.ffi + BStruct = ffi._get_cached_btype(tp) + layout, cname = self._struct_pending_verification.pop(tp) + check(layout[0], ffi.sizeof(BStruct), "wrong total size") + check(layout[1], ffi.alignof(BStruct), "wrong total alignment") + i = 2 + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + check(layout[i], ffi.offsetof(BStruct, fname), + "wrong offset for field %r" % (fname,)) + if layout[i+1] != 0: + BField = ffi._get_cached_btype(ftype) + check(layout[i+1], ffi.sizeof(BField), + "wrong size for field %r" % (fname,)) + i += 2 + assert i == len(layout) + + # ---------- + # 'anonymous' declarations. These are produced for anonymous structs + # or unions; the 'name' is obtained by a typedef. + + _generate_cpy_anonymous_collecttype = _generate_nothing + + def _generate_cpy_anonymous_decl(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_cpy_enum_decl(tp, name, '') + else: + self._generate_struct_or_union_decl(tp, '', name) + + def _generate_cpy_anonymous_method(self, tp, name): + if not isinstance(tp, model.EnumType): + self._generate_struct_or_union_method(tp, '', name) + + def _loading_cpy_anonymous(self, tp, name, module): + if isinstance(tp, model.EnumType): + self._loading_cpy_enum(tp, name, module) + else: + self._loading_struct_or_union(tp, '', name, module) + + def _loaded_cpy_anonymous(self, tp, name, module, **kwds): + if isinstance(tp, model.EnumType): + self._loaded_cpy_enum(tp, name, module, **kwds) + else: + self._loaded_struct_or_union(tp) + + # ---------- + # constants, likely declared with '#define' + + def _generate_cpy_const(self, is_int, name, tp=None, category='const', + vartp=None, delayed=True, size_too=False, + check_value=None): + prnt = self._prnt + funcname = '_cffi_%s_%s' % (category, name) + prnt('static int %s(PyObject *lib)' % funcname) + prnt('{') + prnt(' PyObject *o;') + prnt(' int res;') + if not is_int: + prnt(' %s;' % (vartp or tp).get_c_name(' i', name)) + else: + assert category == 'const' + # + if check_value is not None: + self._check_int_constant_value(name, check_value) + # + if not is_int: + if category == 'var': + realexpr = '&' + name + else: + realexpr = name + prnt(' i = (%s);' % (realexpr,)) + prnt(' o = %s;' % (self._convert_expr_from_c(tp, 'i', + 'variable type'),)) + assert delayed + else: + prnt(' o = _cffi_from_c_int_const(%s);' % name) + prnt(' if (o == NULL)') + prnt(' return -1;') + if size_too: + prnt(' {') + prnt(' PyObject *o1 = o;') + prnt(' o = Py_BuildValue("On", o1, (Py_ssize_t)sizeof(%s));' + % (name,)) + prnt(' Py_DECREF(o1);') + prnt(' if (o == NULL)') + prnt(' return -1;') + prnt(' }') + prnt(' res = PyObject_SetAttrString(lib, "%s", o);' % name) + prnt(' Py_DECREF(o);') + prnt(' if (res < 0)') + prnt(' return -1;') + prnt(' return %s;' % self._chained_list_constants[delayed]) + self._chained_list_constants[delayed] = funcname + '(lib)' + prnt('}') + prnt() + + def _generate_cpy_constant_collecttype(self, tp, name): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + if not is_int: + self._do_collect_type(tp) + + def _generate_cpy_constant_decl(self, tp, name): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + self._generate_cpy_const(is_int, name, tp) + + _generate_cpy_constant_method = _generate_nothing + _loading_cpy_constant = _loaded_noop + _loaded_cpy_constant = _loaded_noop + + # ---------- + # enums + + def _check_int_constant_value(self, name, value, err_prefix=''): + prnt = self._prnt + if value <= 0: + prnt(' if ((%s) > 0 || (long)(%s) != %dL) {' % ( + name, name, value)) + else: + prnt(' if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {' % ( + name, name, value)) + prnt(' char buf[64];') + prnt(' if ((%s) <= 0)' % name) + prnt(' snprintf(buf, 63, "%%ld", (long)(%s));' % name) + prnt(' else') + prnt(' snprintf(buf, 63, "%%lu", (unsigned long)(%s));' % + name) + prnt(' PyErr_Format(_cffi_VerificationError,') + prnt(' "%s%s has the real value %s, not %s",') + prnt(' "%s", "%s", buf, "%d");' % ( + err_prefix, name, value)) + prnt(' return -1;') + prnt(' }') + + def _enum_funcname(self, prefix, name): + # "$enum_$1" => "___D_enum____D_1" + name = name.replace('$', '___D_') + return '_cffi_e_%s_%s' % (prefix, name) + + def _generate_cpy_enum_decl(self, tp, name, prefix='enum'): + if tp.partial: + for enumerator in tp.enumerators: + self._generate_cpy_const(True, enumerator, delayed=False) + return + # + funcname = self._enum_funcname(prefix, name) + prnt = self._prnt + prnt('static int %s(PyObject *lib)' % funcname) + prnt('{') + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + self._check_int_constant_value(enumerator, enumvalue, + "enum %s: " % name) + prnt(' return %s;' % self._chained_list_constants[True]) + self._chained_list_constants[True] = funcname + '(lib)' + prnt('}') + prnt() + + _generate_cpy_enum_collecttype = _generate_nothing + _generate_cpy_enum_method = _generate_nothing + + def _loading_cpy_enum(self, tp, name, module): + if tp.partial: + enumvalues = [getattr(module, enumerator) + for enumerator in tp.enumerators] + tp.enumvalues = tuple(enumvalues) + tp.partial_resolved = True + + def _loaded_cpy_enum(self, tp, name, module, library): + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + setattr(library, enumerator, enumvalue) + + # ---------- + # macros: for now only for integers + + def _generate_cpy_macro_decl(self, tp, name): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + self._generate_cpy_const(True, name, check_value=check_value) + + _generate_cpy_macro_collecttype = _generate_nothing + _generate_cpy_macro_method = _generate_nothing + _loading_cpy_macro = _loaded_noop + _loaded_cpy_macro = _loaded_noop + + # ---------- + # global variables + + def _generate_cpy_variable_collecttype(self, tp, name): + if isinstance(tp, model.ArrayType): + tp_ptr = model.PointerType(tp.item) + else: + tp_ptr = model.PointerType(tp) + self._do_collect_type(tp_ptr) + + def _generate_cpy_variable_decl(self, tp, name): + if isinstance(tp, model.ArrayType): + tp_ptr = model.PointerType(tp.item) + self._generate_cpy_const(False, name, tp, vartp=tp_ptr, + size_too = tp.length_is_unknown()) + else: + tp_ptr = model.PointerType(tp) + self._generate_cpy_const(False, name, tp_ptr, category='var') + + _generate_cpy_variable_method = _generate_nothing + _loading_cpy_variable = _loaded_noop + + def _loaded_cpy_variable(self, tp, name, module, library): + value = getattr(library, name) + if isinstance(tp, model.ArrayType): # int a[5] is "constant" in the + # sense that "a=..." is forbidden + if tp.length_is_unknown(): + assert isinstance(value, tuple) + (value, size) = value + BItemType = self.ffi._get_cached_btype(tp.item) + length, rest = divmod(size, self.ffi.sizeof(BItemType)) + if rest != 0: + raise VerificationError( + "bad size: %r does not seem to be an array of %s" % + (name, tp.item)) + tp = tp.resolve_length(length) + # 'value' is a which we have to replace with + # a if the N is actually known + if tp.length is not None: + BArray = self.ffi._get_cached_btype(tp) + value = self.ffi.cast(BArray, value) + setattr(library, name, value) + return + # remove ptr= from the library instance, and replace + # it by a property on the class, which reads/writes into ptr[0]. + ptr = value + delattr(library, name) + def getter(library): + return ptr[0] + def setter(library, value): + ptr[0] = value + setattr(type(library), name, property(getter, setter)) + type(library)._cffi_dir.append(name) + + # ---------- + + def _generate_setup_custom(self): + prnt = self._prnt + prnt('static int _cffi_setup_custom(PyObject *lib)') + prnt('{') + prnt(' return %s;' % self._chained_list_constants[True]) + prnt('}') + +cffimod_header = r''' +#include +#include + +/* this block of #ifs should be kept exactly identical between + c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py + and cffi/_cffi_include.h */ +#if defined(_MSC_VER) +# include /* for alloca() */ +# if _MSC_VER < 1600 /* MSVC < 2010 */ + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; + typedef __int8 int_least8_t; + typedef __int16 int_least16_t; + typedef __int32 int_least32_t; + typedef __int64 int_least64_t; + typedef unsigned __int8 uint_least8_t; + typedef unsigned __int16 uint_least16_t; + typedef unsigned __int32 uint_least32_t; + typedef unsigned __int64 uint_least64_t; + typedef __int8 int_fast8_t; + typedef __int16 int_fast16_t; + typedef __int32 int_fast32_t; + typedef __int64 int_fast64_t; + typedef unsigned __int8 uint_fast8_t; + typedef unsigned __int16 uint_fast16_t; + typedef unsigned __int32 uint_fast32_t; + typedef unsigned __int64 uint_fast64_t; + typedef __int64 intmax_t; + typedef unsigned __int64 uintmax_t; +# else +# include +# endif +# if _MSC_VER < 1800 /* MSVC < 2013 */ +# ifndef __cplusplus + typedef unsigned char _Bool; +# endif +# endif +#else +# include +# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux) +# include +# endif +#endif + +#if PY_MAJOR_VERSION < 3 +# undef PyCapsule_CheckExact +# undef PyCapsule_GetPointer +# define PyCapsule_CheckExact(capsule) (PyCObject_Check(capsule)) +# define PyCapsule_GetPointer(capsule, name) \ + (PyCObject_AsVoidPtr(capsule)) +#endif + +#if PY_MAJOR_VERSION >= 3 +# define PyInt_FromLong PyLong_FromLong +#endif + +#define _cffi_from_c_double PyFloat_FromDouble +#define _cffi_from_c_float PyFloat_FromDouble +#define _cffi_from_c_long PyInt_FromLong +#define _cffi_from_c_ulong PyLong_FromUnsignedLong +#define _cffi_from_c_longlong PyLong_FromLongLong +#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong +#define _cffi_from_c__Bool PyBool_FromLong + +#define _cffi_to_c_double PyFloat_AsDouble +#define _cffi_to_c_float PyFloat_AsDouble + +#define _cffi_from_c_int_const(x) \ + (((x) > 0) ? \ + ((unsigned long long)(x) <= (unsigned long long)LONG_MAX) ? \ + PyInt_FromLong((long)(x)) : \ + PyLong_FromUnsignedLongLong((unsigned long long)(x)) : \ + ((long long)(x) >= (long long)LONG_MIN) ? \ + PyInt_FromLong((long)(x)) : \ + PyLong_FromLongLong((long long)(x))) + +#define _cffi_from_c_int(x, type) \ + (((type)-1) > 0 ? /* unsigned */ \ + (sizeof(type) < sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + sizeof(type) == sizeof(long) ? \ + PyLong_FromUnsignedLong((unsigned long)x) : \ + PyLong_FromUnsignedLongLong((unsigned long long)x)) : \ + (sizeof(type) <= sizeof(long) ? \ + PyInt_FromLong((long)x) : \ + PyLong_FromLongLong((long long)x))) + +#define _cffi_to_c_int(o, type) \ + ((type)( \ + sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o) \ + : (type)_cffi_to_c_i8(o)) : \ + sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o) \ + : (type)_cffi_to_c_i16(o)) : \ + sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o) \ + : (type)_cffi_to_c_i32(o)) : \ + sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o) \ + : (type)_cffi_to_c_i64(o)) : \ + (Py_FatalError("unsupported size for type " #type), (type)0))) + +#define _cffi_to_c_i8 \ + ((int(*)(PyObject *))_cffi_exports[1]) +#define _cffi_to_c_u8 \ + ((int(*)(PyObject *))_cffi_exports[2]) +#define _cffi_to_c_i16 \ + ((int(*)(PyObject *))_cffi_exports[3]) +#define _cffi_to_c_u16 \ + ((int(*)(PyObject *))_cffi_exports[4]) +#define _cffi_to_c_i32 \ + ((int(*)(PyObject *))_cffi_exports[5]) +#define _cffi_to_c_u32 \ + ((unsigned int(*)(PyObject *))_cffi_exports[6]) +#define _cffi_to_c_i64 \ + ((long long(*)(PyObject *))_cffi_exports[7]) +#define _cffi_to_c_u64 \ + ((unsigned long long(*)(PyObject *))_cffi_exports[8]) +#define _cffi_to_c_char \ + ((int(*)(PyObject *))_cffi_exports[9]) +#define _cffi_from_c_pointer \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[10]) +#define _cffi_to_c_pointer \ + ((char *(*)(PyObject *, CTypeDescrObject *))_cffi_exports[11]) +#define _cffi_get_struct_layout \ + ((PyObject *(*)(Py_ssize_t[]))_cffi_exports[12]) +#define _cffi_restore_errno \ + ((void(*)(void))_cffi_exports[13]) +#define _cffi_save_errno \ + ((void(*)(void))_cffi_exports[14]) +#define _cffi_from_c_char \ + ((PyObject *(*)(char))_cffi_exports[15]) +#define _cffi_from_c_deref \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[16]) +#define _cffi_to_c \ + ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[17]) +#define _cffi_from_c_struct \ + ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[18]) +#define _cffi_to_c_wchar_t \ + ((wchar_t(*)(PyObject *))_cffi_exports[19]) +#define _cffi_from_c_wchar_t \ + ((PyObject *(*)(wchar_t))_cffi_exports[20]) +#define _cffi_to_c_long_double \ + ((long double(*)(PyObject *))_cffi_exports[21]) +#define _cffi_to_c__Bool \ + ((_Bool(*)(PyObject *))_cffi_exports[22]) +#define _cffi_prepare_pointer_call_argument \ + ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23]) +#define _cffi_convert_array_from_object \ + ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) +#define _CFFI_NUM_EXPORTS 25 + +typedef struct _ctypedescr CTypeDescrObject; + +static void *_cffi_exports[_CFFI_NUM_EXPORTS]; +static PyObject *_cffi_types, *_cffi_VerificationError; + +static int _cffi_setup_custom(PyObject *lib); /* forward */ + +static PyObject *_cffi_setup(PyObject *self, PyObject *args) +{ + PyObject *library; + int was_alive = (_cffi_types != NULL); + (void)self; /* unused */ + if (!PyArg_ParseTuple(args, "OOO", &_cffi_types, &_cffi_VerificationError, + &library)) + return NULL; + Py_INCREF(_cffi_types); + Py_INCREF(_cffi_VerificationError); + if (_cffi_setup_custom(library) < 0) + return NULL; + return PyBool_FromLong(was_alive); +} + +union _cffi_union_alignment_u { + unsigned char m_char; + unsigned short m_short; + unsigned int m_int; + unsigned long m_long; + unsigned long long m_longlong; + float m_float; + double m_double; + long double m_longdouble; +}; + +struct _cffi_freeme_s { + struct _cffi_freeme_s *next; + union _cffi_union_alignment_u alignment; +}; + +#ifdef __GNUC__ + __attribute__((unused)) +#endif +static int _cffi_convert_array_argument(CTypeDescrObject *ctptr, PyObject *arg, + char **output_data, Py_ssize_t datasize, + struct _cffi_freeme_s **freeme) +{ + char *p; + if (datasize < 0) + return -1; + + p = *output_data; + if (p == NULL) { + struct _cffi_freeme_s *fp = (struct _cffi_freeme_s *)PyObject_Malloc( + offsetof(struct _cffi_freeme_s, alignment) + (size_t)datasize); + if (fp == NULL) + return -1; + fp->next = *freeme; + *freeme = fp; + p = *output_data = (char *)&fp->alignment; + } + memset((void *)p, 0, (size_t)datasize); + return _cffi_convert_array_from_object(p, ctptr, arg); +} + +#ifdef __GNUC__ + __attribute__((unused)) +#endif +static void _cffi_free_array_arguments(struct _cffi_freeme_s *freeme) +{ + do { + void *p = (void *)freeme; + freeme = freeme->next; + PyObject_Free(p); + } while (freeme != NULL); +} + +static int _cffi_init(void) +{ + PyObject *module, *c_api_object = NULL; + + module = PyImport_ImportModule("_cffi_backend"); + if (module == NULL) + goto failure; + + c_api_object = PyObject_GetAttrString(module, "_C_API"); + if (c_api_object == NULL) + goto failure; + if (!PyCapsule_CheckExact(c_api_object)) { + PyErr_SetNone(PyExc_ImportError); + goto failure; + } + memcpy(_cffi_exports, PyCapsule_GetPointer(c_api_object, "cffi"), + _CFFI_NUM_EXPORTS * sizeof(void *)); + + Py_DECREF(module); + Py_DECREF(c_api_object); + return 0; + + failure: + Py_XDECREF(module); + Py_XDECREF(c_api_object); + return -1; +} + +#define _cffi_type(num) ((CTypeDescrObject *)PyList_GET_ITEM(_cffi_types, num)) + +/**********/ +''' diff --git a/jwt/python/cffi/vengine_gen.py b/jwt/python/cffi/vengine_gen.py new file mode 100644 index 0000000..2642152 --- /dev/null +++ b/jwt/python/cffi/vengine_gen.py @@ -0,0 +1,675 @@ +# +# DEPRECATED: implementation for ffi.verify() +# +import sys, os +import types + +from . import model +from .error import VerificationError + + +class VGenericEngine(object): + _class_key = 'g' + _gen_python_module = False + + def __init__(self, verifier): + self.verifier = verifier + self.ffi = verifier.ffi + self.export_symbols = [] + self._struct_pending_verification = {} + + def patch_extension_kwds(self, kwds): + # add 'export_symbols' to the dictionary. Note that we add the + # list before filling it. When we fill it, it will thus also show + # up in kwds['export_symbols']. + kwds.setdefault('export_symbols', self.export_symbols) + + def find_module(self, module_name, path, so_suffixes): + for so_suffix in so_suffixes: + basename = module_name + so_suffix + if path is None: + path = sys.path + for dirname in path: + filename = os.path.join(dirname, basename) + if os.path.isfile(filename): + return filename + + def collect_types(self): + pass # not needed in the generic engine + + def _prnt(self, what=''): + self._f.write(what + '\n') + + def write_source_to_f(self): + prnt = self._prnt + # first paste some standard set of lines that are mostly '#include' + prnt(cffimod_header) + # then paste the C source given by the user, verbatim. + prnt(self.verifier.preamble) + # + # call generate_gen_xxx_decl(), for every xxx found from + # ffi._parser._declarations. This generates all the functions. + self._generate('decl') + # + # on Windows, distutils insists on putting init_cffi_xyz in + # 'export_symbols', so instead of fighting it, just give up and + # give it one + if sys.platform == 'win32': + if sys.version_info >= (3,): + prefix = 'PyInit_' + else: + prefix = 'init' + modname = self.verifier.get_module_name() + prnt("void %s%s(void) { }\n" % (prefix, modname)) + + def load_library(self, flags=0): + # import it with the CFFI backend + backend = self.ffi._backend + # needs to make a path that contains '/', on Posix + filename = os.path.join(os.curdir, self.verifier.modulefilename) + module = backend.load_library(filename, flags) + # + # call loading_gen_struct() to get the struct layout inferred by + # the C compiler + self._load(module, 'loading') + + # build the FFILibrary class and instance, this is a module subclass + # because modules are expected to have usually-constant-attributes and + # in PyPy this means the JIT is able to treat attributes as constant, + # which we want. + class FFILibrary(types.ModuleType): + _cffi_generic_module = module + _cffi_ffi = self.ffi + _cffi_dir = [] + def __dir__(self): + return FFILibrary._cffi_dir + library = FFILibrary("") + # + # finally, call the loaded_gen_xxx() functions. This will set + # up the 'library' object. + self._load(module, 'loaded', library=library) + return library + + def _get_declarations(self): + lst = [(key, tp) for (key, (tp, qual)) in + self.ffi._parser._declarations.items()] + lst.sort() + return lst + + def _generate(self, step_name): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + try: + method = getattr(self, '_generate_gen_%s_%s' % (kind, + step_name)) + except AttributeError: + raise VerificationError( + "not implemented in verify(): %r" % name) + try: + method(tp, realname) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _load(self, module, step_name, **kwds): + for name, tp in self._get_declarations(): + kind, realname = name.split(' ', 1) + method = getattr(self, '_%s_gen_%s' % (step_name, kind)) + try: + method(tp, realname, module, **kwds) + except Exception as e: + model.attach_exception_info(e, name) + raise + + def _generate_nothing(self, tp, name): + pass + + def _loaded_noop(self, tp, name, module, **kwds): + pass + + # ---------- + # typedefs: generates no code so far + + _generate_gen_typedef_decl = _generate_nothing + _loading_gen_typedef = _loaded_noop + _loaded_gen_typedef = _loaded_noop + + # ---------- + # function declarations + + def _generate_gen_function_decl(self, tp, name): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + # cannot support vararg functions better than this: check for its + # exact type (including the fixed arguments), and build it as a + # constant function pointer (no _cffi_f_%s wrapper) + self._generate_gen_const(False, name, tp) + return + prnt = self._prnt + numargs = len(tp.args) + argnames = [] + for i, type in enumerate(tp.args): + indirection = '' + if isinstance(type, model.StructOrUnion): + indirection = '*' + argnames.append('%sx%d' % (indirection, i)) + context = 'argument of %s' % name + arglist = [type.get_c_name(' %s' % arg, context) + for type, arg in zip(tp.args, argnames)] + tpresult = tp.result + if isinstance(tpresult, model.StructOrUnion): + arglist.insert(0, tpresult.get_c_name(' *r', context)) + tpresult = model.void_type + arglist = ', '.join(arglist) or 'void' + wrappername = '_cffi_f_%s' % name + self.export_symbols.append(wrappername) + if tp.abi: + abi = tp.abi + ' ' + else: + abi = '' + funcdecl = ' %s%s(%s)' % (abi, wrappername, arglist) + context = 'result of %s' % name + prnt(tpresult.get_c_name(funcdecl, context)) + prnt('{') + # + if isinstance(tp.result, model.StructOrUnion): + result_code = '*r = ' + elif not isinstance(tp.result, model.VoidType): + result_code = 'return ' + else: + result_code = '' + prnt(' %s%s(%s);' % (result_code, name, ', '.join(argnames))) + prnt('}') + prnt() + + _loading_gen_function = _loaded_noop + + def _loaded_gen_function(self, tp, name, module, library): + assert isinstance(tp, model.FunctionPtrType) + if tp.ellipsis: + newfunction = self._load_constant(False, tp, name, module) + else: + indirections = [] + base_tp = tp + if (any(isinstance(typ, model.StructOrUnion) for typ in tp.args) + or isinstance(tp.result, model.StructOrUnion)): + indirect_args = [] + for i, typ in enumerate(tp.args): + if isinstance(typ, model.StructOrUnion): + typ = model.PointerType(typ) + indirections.append((i, typ)) + indirect_args.append(typ) + indirect_result = tp.result + if isinstance(indirect_result, model.StructOrUnion): + if indirect_result.fldtypes is None: + raise TypeError("'%s' is used as result type, " + "but is opaque" % ( + indirect_result._get_c_name(),)) + indirect_result = model.PointerType(indirect_result) + indirect_args.insert(0, indirect_result) + indirections.insert(0, ("result", indirect_result)) + indirect_result = model.void_type + tp = model.FunctionPtrType(tuple(indirect_args), + indirect_result, tp.ellipsis) + BFunc = self.ffi._get_cached_btype(tp) + wrappername = '_cffi_f_%s' % name + newfunction = module.load_function(BFunc, wrappername) + for i, typ in indirections: + newfunction = self._make_struct_wrapper(newfunction, i, typ, + base_tp) + setattr(library, name, newfunction) + type(library)._cffi_dir.append(name) + + def _make_struct_wrapper(self, oldfunc, i, tp, base_tp): + backend = self.ffi._backend + BType = self.ffi._get_cached_btype(tp) + if i == "result": + ffi = self.ffi + def newfunc(*args): + res = ffi.new(BType) + oldfunc(res, *args) + return res[0] + else: + def newfunc(*args): + args = args[:i] + (backend.newp(BType, args[i]),) + args[i+1:] + return oldfunc(*args) + newfunc._cffi_base_type = base_tp + return newfunc + + # ---------- + # named structs + + def _generate_gen_struct_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'struct', name) + + def _loading_gen_struct(self, tp, name, module): + self._loading_struct_or_union(tp, 'struct', name, module) + + def _loaded_gen_struct(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + def _generate_gen_union_decl(self, tp, name): + assert name == tp.name + self._generate_struct_or_union_decl(tp, 'union', name) + + def _loading_gen_union(self, tp, name, module): + self._loading_struct_or_union(tp, 'union', name, module) + + def _loaded_gen_union(self, tp, name, module, **kwds): + self._loaded_struct_or_union(tp) + + def _generate_struct_or_union_decl(self, tp, prefix, name): + if tp.fldnames is None: + return # nothing to do with opaque structs + checkfuncname = '_cffi_check_%s_%s' % (prefix, name) + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + cname = ('%s %s' % (prefix, name)).strip() + # + prnt = self._prnt + prnt('static void %s(%s *p)' % (checkfuncname, cname)) + prnt('{') + prnt(' /* only to generate compile-time warnings or errors */') + prnt(' (void)p;') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if (isinstance(ftype, model.PrimitiveType) + and ftype.is_integer_type()) or fbitsize >= 0: + # accept all integers, but complain on float or double + prnt(' (void)((p->%s) << 1);' % fname) + else: + # only accept exactly the type declared. + try: + prnt(' { %s = &p->%s; (void)tmp; }' % ( + ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual), + fname)) + except VerificationError as e: + prnt(' /* %s */' % str(e)) # cannot verify it, ignore + prnt('}') + self.export_symbols.append(layoutfuncname) + prnt('intptr_t %s(intptr_t i)' % (layoutfuncname,)) + prnt('{') + prnt(' struct _cffi_aligncheck { char x; %s y; };' % cname) + prnt(' static intptr_t nums[] = {') + prnt(' sizeof(%s),' % cname) + prnt(' offsetof(struct _cffi_aligncheck, y),') + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + prnt(' offsetof(%s, %s),' % (cname, fname)) + if isinstance(ftype, model.ArrayType) and ftype.length is None: + prnt(' 0, /* %s */' % ftype._get_c_name()) + else: + prnt(' sizeof(((%s *)0)->%s),' % (cname, fname)) + prnt(' -1') + prnt(' };') + prnt(' return nums[i];') + prnt(' /* the next line is not executed, but compiled */') + prnt(' %s(0);' % (checkfuncname,)) + prnt('}') + prnt() + + def _loading_struct_or_union(self, tp, prefix, name, module): + if tp.fldnames is None: + return # nothing to do with opaque structs + layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name) + # + BFunc = self.ffi._typeof_locked("intptr_t(*)(intptr_t)")[0] + function = module.load_function(BFunc, layoutfuncname) + layout = [] + num = 0 + while True: + x = function(num) + if x < 0: break + layout.append(x) + num += 1 + if isinstance(tp, model.StructOrUnion) and tp.partial: + # use the function()'s sizes and offsets to guide the + # layout of the struct + totalsize = layout[0] + totalalignment = layout[1] + fieldofs = layout[2::2] + fieldsize = layout[3::2] + tp.force_flatten() + assert len(fieldofs) == len(fieldsize) == len(tp.fldnames) + tp.fixedlayout = fieldofs, fieldsize, totalsize, totalalignment + else: + cname = ('%s %s' % (prefix, name)).strip() + self._struct_pending_verification[tp] = layout, cname + + def _loaded_struct_or_union(self, tp): + if tp.fldnames is None: + return # nothing to do with opaque structs + self.ffi._get_cached_btype(tp) # force 'fixedlayout' to be considered + + if tp in self._struct_pending_verification: + # check that the layout sizes and offsets match the real ones + def check(realvalue, expectedvalue, msg): + if realvalue != expectedvalue: + raise VerificationError( + "%s (we have %d, but C compiler says %d)" + % (msg, expectedvalue, realvalue)) + ffi = self.ffi + BStruct = ffi._get_cached_btype(tp) + layout, cname = self._struct_pending_verification.pop(tp) + check(layout[0], ffi.sizeof(BStruct), "wrong total size") + check(layout[1], ffi.alignof(BStruct), "wrong total alignment") + i = 2 + for fname, ftype, fbitsize, fqual in tp.enumfields(): + if fbitsize >= 0: + continue # xxx ignore fbitsize for now + check(layout[i], ffi.offsetof(BStruct, fname), + "wrong offset for field %r" % (fname,)) + if layout[i+1] != 0: + BField = ffi._get_cached_btype(ftype) + check(layout[i+1], ffi.sizeof(BField), + "wrong size for field %r" % (fname,)) + i += 2 + assert i == len(layout) + + # ---------- + # 'anonymous' declarations. These are produced for anonymous structs + # or unions; the 'name' is obtained by a typedef. + + def _generate_gen_anonymous_decl(self, tp, name): + if isinstance(tp, model.EnumType): + self._generate_gen_enum_decl(tp, name, '') + else: + self._generate_struct_or_union_decl(tp, '', name) + + def _loading_gen_anonymous(self, tp, name, module): + if isinstance(tp, model.EnumType): + self._loading_gen_enum(tp, name, module, '') + else: + self._loading_struct_or_union(tp, '', name, module) + + def _loaded_gen_anonymous(self, tp, name, module, **kwds): + if isinstance(tp, model.EnumType): + self._loaded_gen_enum(tp, name, module, **kwds) + else: + self._loaded_struct_or_union(tp) + + # ---------- + # constants, likely declared with '#define' + + def _generate_gen_const(self, is_int, name, tp=None, category='const', + check_value=None): + prnt = self._prnt + funcname = '_cffi_%s_%s' % (category, name) + self.export_symbols.append(funcname) + if check_value is not None: + assert is_int + assert category == 'const' + prnt('int %s(char *out_error)' % funcname) + prnt('{') + self._check_int_constant_value(name, check_value) + prnt(' return 0;') + prnt('}') + elif is_int: + assert category == 'const' + prnt('int %s(long long *out_value)' % funcname) + prnt('{') + prnt(' *out_value = (long long)(%s);' % (name,)) + prnt(' return (%s) <= 0;' % (name,)) + prnt('}') + else: + assert tp is not None + assert check_value is None + if category == 'var': + ampersand = '&' + else: + ampersand = '' + extra = '' + if category == 'const' and isinstance(tp, model.StructOrUnion): + extra = 'const *' + ampersand = '&' + prnt(tp.get_c_name(' %s%s(void)' % (extra, funcname), name)) + prnt('{') + prnt(' return (%s%s);' % (ampersand, name)) + prnt('}') + prnt() + + def _generate_gen_constant_decl(self, tp, name): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + self._generate_gen_const(is_int, name, tp) + + _loading_gen_constant = _loaded_noop + + def _load_constant(self, is_int, tp, name, module, check_value=None): + funcname = '_cffi_const_%s' % name + if check_value is not None: + assert is_int + self._load_known_int_constant(module, funcname) + value = check_value + elif is_int: + BType = self.ffi._typeof_locked("long long*")[0] + BFunc = self.ffi._typeof_locked("int(*)(long long*)")[0] + function = module.load_function(BFunc, funcname) + p = self.ffi.new(BType) + negative = function(p) + value = int(p[0]) + if value < 0 and not negative: + BLongLong = self.ffi._typeof_locked("long long")[0] + value += (1 << (8*self.ffi.sizeof(BLongLong))) + else: + assert check_value is None + fntypeextra = '(*)(void)' + if isinstance(tp, model.StructOrUnion): + fntypeextra = '*' + fntypeextra + BFunc = self.ffi._typeof_locked(tp.get_c_name(fntypeextra, name))[0] + function = module.load_function(BFunc, funcname) + value = function() + if isinstance(tp, model.StructOrUnion): + value = value[0] + return value + + def _loaded_gen_constant(self, tp, name, module, library): + is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type() + value = self._load_constant(is_int, tp, name, module) + setattr(library, name, value) + type(library)._cffi_dir.append(name) + + # ---------- + # enums + + def _check_int_constant_value(self, name, value): + prnt = self._prnt + if value <= 0: + prnt(' if ((%s) > 0 || (long)(%s) != %dL) {' % ( + name, name, value)) + else: + prnt(' if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {' % ( + name, name, value)) + prnt(' char buf[64];') + prnt(' if ((%s) <= 0)' % name) + prnt(' sprintf(buf, "%%ld", (long)(%s));' % name) + prnt(' else') + prnt(' sprintf(buf, "%%lu", (unsigned long)(%s));' % + name) + prnt(' sprintf(out_error, "%s has the real value %s, not %s",') + prnt(' "%s", buf, "%d");' % (name[:100], value)) + prnt(' return -1;') + prnt(' }') + + def _load_known_int_constant(self, module, funcname): + BType = self.ffi._typeof_locked("char[]")[0] + BFunc = self.ffi._typeof_locked("int(*)(char*)")[0] + function = module.load_function(BFunc, funcname) + p = self.ffi.new(BType, 256) + if function(p) < 0: + error = self.ffi.string(p) + if sys.version_info >= (3,): + error = str(error, 'utf-8') + raise VerificationError(error) + + def _enum_funcname(self, prefix, name): + # "$enum_$1" => "___D_enum____D_1" + name = name.replace('$', '___D_') + return '_cffi_e_%s_%s' % (prefix, name) + + def _generate_gen_enum_decl(self, tp, name, prefix='enum'): + if tp.partial: + for enumerator in tp.enumerators: + self._generate_gen_const(True, enumerator) + return + # + funcname = self._enum_funcname(prefix, name) + self.export_symbols.append(funcname) + prnt = self._prnt + prnt('int %s(char *out_error)' % funcname) + prnt('{') + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + self._check_int_constant_value(enumerator, enumvalue) + prnt(' return 0;') + prnt('}') + prnt() + + def _loading_gen_enum(self, tp, name, module, prefix='enum'): + if tp.partial: + enumvalues = [self._load_constant(True, tp, enumerator, module) + for enumerator in tp.enumerators] + tp.enumvalues = tuple(enumvalues) + tp.partial_resolved = True + else: + funcname = self._enum_funcname(prefix, name) + self._load_known_int_constant(module, funcname) + + def _loaded_gen_enum(self, tp, name, module, library): + for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues): + setattr(library, enumerator, enumvalue) + type(library)._cffi_dir.append(enumerator) + + # ---------- + # macros: for now only for integers + + def _generate_gen_macro_decl(self, tp, name): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + self._generate_gen_const(True, name, check_value=check_value) + + _loading_gen_macro = _loaded_noop + + def _loaded_gen_macro(self, tp, name, module, library): + if tp == '...': + check_value = None + else: + check_value = tp # an integer + value = self._load_constant(True, tp, name, module, + check_value=check_value) + setattr(library, name, value) + type(library)._cffi_dir.append(name) + + # ---------- + # global variables + + def _generate_gen_variable_decl(self, tp, name): + if isinstance(tp, model.ArrayType): + if tp.length_is_unknown(): + prnt = self._prnt + funcname = '_cffi_sizeof_%s' % (name,) + self.export_symbols.append(funcname) + prnt("size_t %s(void)" % funcname) + prnt("{") + prnt(" return sizeof(%s);" % (name,)) + prnt("}") + tp_ptr = model.PointerType(tp.item) + self._generate_gen_const(False, name, tp_ptr) + else: + tp_ptr = model.PointerType(tp) + self._generate_gen_const(False, name, tp_ptr, category='var') + + _loading_gen_variable = _loaded_noop + + def _loaded_gen_variable(self, tp, name, module, library): + if isinstance(tp, model.ArrayType): # int a[5] is "constant" in the + # sense that "a=..." is forbidden + if tp.length_is_unknown(): + funcname = '_cffi_sizeof_%s' % (name,) + BFunc = self.ffi._typeof_locked('size_t(*)(void)')[0] + function = module.load_function(BFunc, funcname) + size = function() + BItemType = self.ffi._get_cached_btype(tp.item) + length, rest = divmod(size, self.ffi.sizeof(BItemType)) + if rest != 0: + raise VerificationError( + "bad size: %r does not seem to be an array of %s" % + (name, tp.item)) + tp = tp.resolve_length(length) + tp_ptr = model.PointerType(tp.item) + value = self._load_constant(False, tp_ptr, name, module) + # 'value' is a which we have to replace with + # a if the N is actually known + if tp.length is not None: + BArray = self.ffi._get_cached_btype(tp) + value = self.ffi.cast(BArray, value) + setattr(library, name, value) + type(library)._cffi_dir.append(name) + return + # remove ptr= from the library instance, and replace + # it by a property on the class, which reads/writes into ptr[0]. + funcname = '_cffi_var_%s' % name + BFunc = self.ffi._typeof_locked(tp.get_c_name('*(*)(void)', name))[0] + function = module.load_function(BFunc, funcname) + ptr = function() + def getter(library): + return ptr[0] + def setter(library, value): + ptr[0] = value + setattr(type(library), name, property(getter, setter)) + type(library)._cffi_dir.append(name) + +cffimod_header = r''' +#include +#include +#include +#include +#include /* XXX for ssize_t on some platforms */ + +/* this block of #ifs should be kept exactly identical between + c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py + and cffi/_cffi_include.h */ +#if defined(_MSC_VER) +# include /* for alloca() */ +# if _MSC_VER < 1600 /* MSVC < 2010 */ + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; + typedef __int8 int_least8_t; + typedef __int16 int_least16_t; + typedef __int32 int_least32_t; + typedef __int64 int_least64_t; + typedef unsigned __int8 uint_least8_t; + typedef unsigned __int16 uint_least16_t; + typedef unsigned __int32 uint_least32_t; + typedef unsigned __int64 uint_least64_t; + typedef __int8 int_fast8_t; + typedef __int16 int_fast16_t; + typedef __int32 int_fast32_t; + typedef __int64 int_fast64_t; + typedef unsigned __int8 uint_fast8_t; + typedef unsigned __int16 uint_fast16_t; + typedef unsigned __int32 uint_fast32_t; + typedef unsigned __int64 uint_fast64_t; + typedef __int64 intmax_t; + typedef unsigned __int64 uintmax_t; +# else +# include +# endif +# if _MSC_VER < 1800 /* MSVC < 2013 */ +# ifndef __cplusplus + typedef unsigned char _Bool; +# endif +# endif +#else +# include +# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux) +# include +# endif +#endif +''' diff --git a/jwt/python/cffi/verifier.py b/jwt/python/cffi/verifier.py new file mode 100644 index 0000000..a500c78 --- /dev/null +++ b/jwt/python/cffi/verifier.py @@ -0,0 +1,307 @@ +# +# DEPRECATED: implementation for ffi.verify() +# +import sys, os, binascii, shutil, io +from . import __version_verifier_modules__ +from . import ffiplatform +from .error import VerificationError + +if sys.version_info >= (3, 3): + import importlib.machinery + def _extension_suffixes(): + return importlib.machinery.EXTENSION_SUFFIXES[:] +else: + import imp + def _extension_suffixes(): + return [suffix for suffix, _, type in imp.get_suffixes() + if type == imp.C_EXTENSION] + + +if sys.version_info >= (3,): + NativeIO = io.StringIO +else: + class NativeIO(io.BytesIO): + def write(self, s): + if isinstance(s, unicode): + s = s.encode('ascii') + super(NativeIO, self).write(s) + + +class Verifier(object): + + def __init__(self, ffi, preamble, tmpdir=None, modulename=None, + ext_package=None, tag='', force_generic_engine=False, + source_extension='.c', flags=None, relative_to=None, **kwds): + if ffi._parser._uses_new_feature: + raise VerificationError( + "feature not supported with ffi.verify(), but only " + "with ffi.set_source(): %s" % (ffi._parser._uses_new_feature,)) + self.ffi = ffi + self.preamble = preamble + if not modulename: + flattened_kwds = ffiplatform.flatten(kwds) + vengine_class = _locate_engine_class(ffi, force_generic_engine) + self._vengine = vengine_class(self) + self._vengine.patch_extension_kwds(kwds) + self.flags = flags + self.kwds = self.make_relative_to(kwds, relative_to) + # + if modulename: + if tag: + raise TypeError("can't specify both 'modulename' and 'tag'") + else: + key = '\x00'.join(['%d.%d' % sys.version_info[:2], + __version_verifier_modules__, + preamble, flattened_kwds] + + ffi._cdefsources) + if sys.version_info >= (3,): + key = key.encode('utf-8') + k1 = hex(binascii.crc32(key[0::2]) & 0xffffffff) + k1 = k1.lstrip('0x').rstrip('L') + k2 = hex(binascii.crc32(key[1::2]) & 0xffffffff) + k2 = k2.lstrip('0').rstrip('L') + modulename = '_cffi_%s_%s%s%s' % (tag, self._vengine._class_key, + k1, k2) + suffix = _get_so_suffixes()[0] + self.tmpdir = tmpdir or _caller_dir_pycache() + self.sourcefilename = os.path.join(self.tmpdir, modulename + source_extension) + self.modulefilename = os.path.join(self.tmpdir, modulename + suffix) + self.ext_package = ext_package + self._has_source = False + self._has_module = False + + def write_source(self, file=None): + """Write the C source code. It is produced in 'self.sourcefilename', + which can be tweaked beforehand.""" + with self.ffi._lock: + if self._has_source and file is None: + raise VerificationError( + "source code already written") + self._write_source(file) + + def compile_module(self): + """Write the C source code (if not done already) and compile it. + This produces a dynamic link library in 'self.modulefilename'.""" + with self.ffi._lock: + if self._has_module: + raise VerificationError("module already compiled") + if not self._has_source: + self._write_source() + self._compile_module() + + def load_library(self): + """Get a C module from this Verifier instance. + Returns an instance of a FFILibrary class that behaves like the + objects returned by ffi.dlopen(), but that delegates all + operations to the C module. If necessary, the C code is written + and compiled first. + """ + with self.ffi._lock: + if not self._has_module: + self._locate_module() + if not self._has_module: + if not self._has_source: + self._write_source() + self._compile_module() + return self._load_library() + + def get_module_name(self): + basename = os.path.basename(self.modulefilename) + # kill both the .so extension and the other .'s, as introduced + # by Python 3: 'basename.cpython-33m.so' + basename = basename.split('.', 1)[0] + # and the _d added in Python 2 debug builds --- but try to be + # conservative and not kill a legitimate _d + if basename.endswith('_d') and hasattr(sys, 'gettotalrefcount'): + basename = basename[:-2] + return basename + + def get_extension(self): + ffiplatform._hack_at_distutils() # backward compatibility hack + if not self._has_source: + with self.ffi._lock: + if not self._has_source: + self._write_source() + sourcename = ffiplatform.maybe_relative_path(self.sourcefilename) + modname = self.get_module_name() + return ffiplatform.get_extension(sourcename, modname, **self.kwds) + + def generates_python_module(self): + return self._vengine._gen_python_module + + def make_relative_to(self, kwds, relative_to): + if relative_to and os.path.dirname(relative_to): + dirname = os.path.dirname(relative_to) + kwds = kwds.copy() + for key in ffiplatform.LIST_OF_FILE_NAMES: + if key in kwds: + lst = kwds[key] + if not isinstance(lst, (list, tuple)): + raise TypeError("keyword '%s' should be a list or tuple" + % (key,)) + lst = [os.path.join(dirname, fn) for fn in lst] + kwds[key] = lst + return kwds + + # ---------- + + def _locate_module(self): + if not os.path.isfile(self.modulefilename): + if self.ext_package: + try: + pkg = __import__(self.ext_package, None, None, ['__doc__']) + except ImportError: + return # cannot import the package itself, give up + # (e.g. it might be called differently before installation) + path = pkg.__path__ + else: + path = None + filename = self._vengine.find_module(self.get_module_name(), path, + _get_so_suffixes()) + if filename is None: + return + self.modulefilename = filename + self._vengine.collect_types() + self._has_module = True + + def _write_source_to(self, file): + self._vengine._f = file + try: + self._vengine.write_source_to_f() + finally: + del self._vengine._f + + def _write_source(self, file=None): + if file is not None: + self._write_source_to(file) + else: + # Write our source file to an in memory file. + f = NativeIO() + self._write_source_to(f) + source_data = f.getvalue() + + # Determine if this matches the current file + if os.path.exists(self.sourcefilename): + with open(self.sourcefilename, "r") as fp: + needs_written = not (fp.read() == source_data) + else: + needs_written = True + + # Actually write the file out if it doesn't match + if needs_written: + _ensure_dir(self.sourcefilename) + with open(self.sourcefilename, "w") as fp: + fp.write(source_data) + + # Set this flag + self._has_source = True + + def _compile_module(self): + # compile this C source + tmpdir = os.path.dirname(self.sourcefilename) + outputfilename = ffiplatform.compile(tmpdir, self.get_extension()) + try: + same = ffiplatform.samefile(outputfilename, self.modulefilename) + except OSError: + same = False + if not same: + _ensure_dir(self.modulefilename) + shutil.move(outputfilename, self.modulefilename) + self._has_module = True + + def _load_library(self): + assert self._has_module + if self.flags is not None: + return self._vengine.load_library(self.flags) + else: + return self._vengine.load_library() + +# ____________________________________________________________ + +_FORCE_GENERIC_ENGINE = False # for tests + +def _locate_engine_class(ffi, force_generic_engine): + if _FORCE_GENERIC_ENGINE: + force_generic_engine = True + if not force_generic_engine: + if '__pypy__' in sys.builtin_module_names: + force_generic_engine = True + else: + try: + import _cffi_backend + except ImportError: + _cffi_backend = '?' + if ffi._backend is not _cffi_backend: + force_generic_engine = True + if force_generic_engine: + from . import vengine_gen + return vengine_gen.VGenericEngine + else: + from . import vengine_cpy + return vengine_cpy.VCPythonEngine + +# ____________________________________________________________ + +_TMPDIR = None + +def _caller_dir_pycache(): + if _TMPDIR: + return _TMPDIR + result = os.environ.get('CFFI_TMPDIR') + if result: + return result + filename = sys._getframe(2).f_code.co_filename + return os.path.abspath(os.path.join(os.path.dirname(filename), + '__pycache__')) + +def set_tmpdir(dirname): + """Set the temporary directory to use instead of __pycache__.""" + global _TMPDIR + _TMPDIR = dirname + +def cleanup_tmpdir(tmpdir=None, keep_so=False): + """Clean up the temporary directory by removing all files in it + called `_cffi_*.{c,so}` as well as the `build` subdirectory.""" + tmpdir = tmpdir or _caller_dir_pycache() + try: + filelist = os.listdir(tmpdir) + except OSError: + return + if keep_so: + suffix = '.c' # only remove .c files + else: + suffix = _get_so_suffixes()[0].lower() + for fn in filelist: + if fn.lower().startswith('_cffi_') and ( + fn.lower().endswith(suffix) or fn.lower().endswith('.c')): + try: + os.unlink(os.path.join(tmpdir, fn)) + except OSError: + pass + clean_dir = [os.path.join(tmpdir, 'build')] + for dir in clean_dir: + try: + for fn in os.listdir(dir): + fn = os.path.join(dir, fn) + if os.path.isdir(fn): + clean_dir.append(fn) + else: + os.unlink(fn) + except OSError: + pass + +def _get_so_suffixes(): + suffixes = _extension_suffixes() + if not suffixes: + # bah, no C_EXTENSION available. Occurs on pypy without cpyext + if sys.platform == 'win32': + suffixes = [".pyd"] + else: + suffixes = [".so"] + + return suffixes + +def _ensure_dir(filename): + dirname = os.path.dirname(filename) + if dirname and not os.path.isdir(dirname): + os.makedirs(dirname) diff --git a/jwt/python/cryptography-41.0.3.dist-info/INSTALLER b/jwt/python/cryptography-41.0.3.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/jwt/python/cryptography-41.0.3.dist-info/LICENSE b/jwt/python/cryptography-41.0.3.dist-info/LICENSE new file mode 100644 index 0000000..b11f379 --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/LICENSE @@ -0,0 +1,3 @@ +This software is made available under the terms of *either* of the licenses +found in LICENSE.APACHE or LICENSE.BSD. Contributions to cryptography are made +under the terms of *both* these licenses. diff --git a/jwt/python/cryptography-41.0.3.dist-info/LICENSE.APACHE b/jwt/python/cryptography-41.0.3.dist-info/LICENSE.APACHE new file mode 100644 index 0000000..62589ed --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/LICENSE.APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/jwt/python/cryptography-41.0.3.dist-info/LICENSE.BSD b/jwt/python/cryptography-41.0.3.dist-info/LICENSE.BSD new file mode 100644 index 0000000..ec1a29d --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/LICENSE.BSD @@ -0,0 +1,27 @@ +Copyright (c) Individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of PyCA Cryptography nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/jwt/python/cryptography-41.0.3.dist-info/METADATA b/jwt/python/cryptography-41.0.3.dist-info/METADATA new file mode 100644 index 0000000..1eba09c --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/METADATA @@ -0,0 +1,133 @@ +Metadata-Version: 2.1 +Name: cryptography +Version: 41.0.3 +Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers. +Author-email: The Python Cryptographic Authority and individual contributors +License: Apache-2.0 OR BSD-3-Clause +Project-URL: homepage, https://github.com/pyca/cryptography +Project-URL: documentation, https://cryptography.io/ +Project-URL: source, https://github.com/pyca/cryptography/ +Project-URL: issues, https://github.com/pyca/cryptography/issues +Project-URL: changelog, https://cryptography.io/en/latest/changelog/ +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: License :: OSI Approved :: BSD License +Classifier: Natural Language :: English +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: POSIX +Classifier: Operating System :: POSIX :: BSD +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Security :: Cryptography +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENSE +License-File: LICENSE.APACHE +License-File: LICENSE.BSD +Requires-Dist: cffi (>=1.12) +Provides-Extra: docs +Requires-Dist: sphinx (>=5.3.0) ; extra == 'docs' +Requires-Dist: sphinx-rtd-theme (>=1.1.1) ; extra == 'docs' +Provides-Extra: docstest +Requires-Dist: pyenchant (>=1.6.11) ; extra == 'docstest' +Requires-Dist: twine (>=1.12.0) ; extra == 'docstest' +Requires-Dist: sphinxcontrib-spelling (>=4.0.1) ; extra == 'docstest' +Provides-Extra: nox +Requires-Dist: nox ; extra == 'nox' +Provides-Extra: pep8test +Requires-Dist: black ; extra == 'pep8test' +Requires-Dist: ruff ; extra == 'pep8test' +Requires-Dist: mypy ; extra == 'pep8test' +Requires-Dist: check-sdist ; extra == 'pep8test' +Provides-Extra: sdist +Requires-Dist: build ; extra == 'sdist' +Provides-Extra: ssh +Requires-Dist: bcrypt (>=3.1.5) ; extra == 'ssh' +Provides-Extra: test +Requires-Dist: pytest (>=6.2.0) ; extra == 'test' +Requires-Dist: pytest-benchmark ; extra == 'test' +Requires-Dist: pytest-cov ; extra == 'test' +Requires-Dist: pytest-xdist ; extra == 'test' +Requires-Dist: pretend ; extra == 'test' +Provides-Extra: test-randomorder +Requires-Dist: pytest-randomly ; extra == 'test-randomorder' + +pyca/cryptography +================= + +.. image:: https://img.shields.io/pypi/v/cryptography.svg + :target: https://pypi.org/project/cryptography/ + :alt: Latest Version + +.. image:: https://readthedocs.org/projects/cryptography/badge/?version=latest + :target: https://cryptography.io + :alt: Latest Docs + +.. image:: https://github.com/pyca/cryptography/workflows/CI/badge.svg?branch=main + :target: https://github.com/pyca/cryptography/actions?query=workflow%3ACI+branch%3Amain + + +``cryptography`` is a package which provides cryptographic recipes and +primitives to Python developers. Our goal is for it to be your "cryptographic +standard library". It supports Python 3.7+ and PyPy3 7.3.10+. + +``cryptography`` includes both high level recipes and low level interfaces to +common cryptographic algorithms such as symmetric ciphers, message digests, and +key derivation functions. For example, to encrypt something with +``cryptography``'s high level symmetric encryption recipe: + +.. code-block:: pycon + + >>> from cryptography.fernet import Fernet + >>> # Put this somewhere safe! + >>> key = Fernet.generate_key() + >>> f = Fernet(key) + >>> token = f.encrypt(b"A really secret message. Not for prying eyes.") + >>> token + b'...' + >>> f.decrypt(token) + b'A really secret message. Not for prying eyes.' + +You can find more information in the `documentation`_. + +You can install ``cryptography`` with: + +.. code-block:: console + + $ pip install cryptography + +For full details see `the installation documentation`_. + +Discussion +~~~~~~~~~~ + +If you run into bugs, you can file them in our `issue tracker`_. + +We maintain a `cryptography-dev`_ mailing list for development discussion. + +You can also join ``#pyca`` on ``irc.libera.chat`` to ask questions or get +involved. + +Security +~~~~~~~~ + +Need to report a security issue? Please consult our `security reporting`_ +documentation. + + +.. _`documentation`: https://cryptography.io/ +.. _`the installation documentation`: https://cryptography.io/en/latest/installation/ +.. _`issue tracker`: https://github.com/pyca/cryptography/issues +.. _`cryptography-dev`: https://mail.python.org/mailman/listinfo/cryptography-dev +.. _`security reporting`: https://cryptography.io/en/latest/security/ diff --git a/jwt/python/cryptography-41.0.3.dist-info/RECORD b/jwt/python/cryptography-41.0.3.dist-info/RECORD new file mode 100644 index 0000000..452f033 --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/RECORD @@ -0,0 +1,172 @@ +cryptography-41.0.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +cryptography-41.0.3.dist-info/LICENSE,sha256=Pgx8CRqUi4JTO6mP18u0BDLW8amsv4X1ki0vmak65rs,197 +cryptography-41.0.3.dist-info/LICENSE.APACHE,sha256=qsc7MUj20dcRHbyjIJn2jSbGRMaBOuHk8F9leaomY_4,11360 +cryptography-41.0.3.dist-info/LICENSE.BSD,sha256=YCxMdILeZHndLpeTzaJ15eY9dz2s0eymiSMqtwCPtPs,1532 +cryptography-41.0.3.dist-info/METADATA,sha256=fGKXAMLFFzeETs2WZI8i9seJnNtvEsWWxLx6Fk3sBTM,5175 +cryptography-41.0.3.dist-info/RECORD,, +cryptography-41.0.3.dist-info/WHEEL,sha256=E44f5mm0c9FVszd8tVo9b_r3SFjxQ7VIZjTMBOg4nG0,148 +cryptography-41.0.3.dist-info/top_level.txt,sha256=KNaT-Sn2K4uxNaEbe6mYdDn3qWDMlp4y-MtWfB73nJc,13 +cryptography/__about__.py,sha256=QMP22GBLX29OFkJ9LPAingf-MaCOruWiMbxHS1BLIXo,445 +cryptography/__init__.py,sha256=iVPlBlXWTJyiFeRedxcbMPhyHB34viOM10d72vGnWuE,364 +cryptography/__pycache__/__about__.cpython-311.pyc,, +cryptography/__pycache__/__init__.cpython-311.pyc,, +cryptography/__pycache__/exceptions.cpython-311.pyc,, +cryptography/__pycache__/fernet.cpython-311.pyc,, +cryptography/__pycache__/utils.cpython-311.pyc,, +cryptography/exceptions.py,sha256=EHe7XM2_OtdOM1bZE0ci-4GUhtOlEQ6fQXhK2Igf0qA,1118 +cryptography/fernet.py,sha256=TVZy4Dtkpl7kWIpvuKcNldE95IEjTQ0MfHgRsLdnDSM,6886 +cryptography/hazmat/__init__.py,sha256=5IwrLWrVp0AjEr_4FdWG_V057NSJGY_W4egNNsuct0g,455 +cryptography/hazmat/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/__pycache__/_oid.cpython-311.pyc,, +cryptography/hazmat/_oid.py,sha256=gxhMHKpu9Xsi6uHCGZ_-soYMXj_izOIFaxjUKWbCPeE,14441 +cryptography/hazmat/backends/__init__.py,sha256=O5jvKFQdZnXhKeqJ-HtulaEL9Ni7mr1mDzZY5kHlYhI,361 +cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__init__.py,sha256=p3jmJfnCag9iE5sdMrN6VvVEu55u46xaS_IjoI0SrmA,305 +cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc,, +cryptography/hazmat/backends/openssl/aead.py,sha256=s3zXcVQf0COIOuOzI8usebWpznGnyZ7GhnmlJYu7QXA,15967 +cryptography/hazmat/backends/openssl/backend.py,sha256=sNMXDL0YPS9vdXFoufEDFOQJh_uMfpUnErd1j1Rdzf0,73231 +cryptography/hazmat/backends/openssl/ciphers.py,sha256=lxWrvnufudsDI2bpwNs2c8XLILbAE2j2rMSD1nhnPVg,10358 +cryptography/hazmat/backends/openssl/cmac.py,sha256=pHgQOIRfR4cIDa5ltcKFtgjqPTXbOLyRQmmqv9JlbUk,3035 +cryptography/hazmat/backends/openssl/decode_asn1.py,sha256=kz6gys8wuJhrx4QyU6enYx7UatNHr0LB3TI1jH3oQ54,1148 +cryptography/hazmat/backends/openssl/ec.py,sha256=GKzh3mZKvgsM1jqM88-4XikHHalpV-Efyskclt8yxYg,11474 +cryptography/hazmat/backends/openssl/rsa.py,sha256=P_ak-2zvA6VBt_P0ldzTSCUkcjo2GhYt_HLn8CVvWtE,21825 +cryptography/hazmat/backends/openssl/utils.py,sha256=UoguO26QzwN4lsMAltsIrgAlbi3SOeSrexZs1-QPNu8,2190 +cryptography/hazmat/bindings/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/bindings/_rust.abi3.so,sha256=NoXkkoRL2bk3270hxaqUPt4KO9kC0ZEQcNte-_H6N_4,13435728 +cryptography/hazmat/bindings/_rust/__init__.pyi,sha256=IumK7zP9Ko3HjLLb5hwZiY2rbfmfsuyTZLLcHOMvSdk,981 +cryptography/hazmat/bindings/_rust/_openssl.pyi,sha256=mpNJLuYLbCVrd5i33FBTmWwL_55Dw7JPkSLlSX9Q7oI,230 +cryptography/hazmat/bindings/_rust/asn1.pyi,sha256=9CyI-grOsLQB_hfnhJPoG9dNOdJ7Zg6B0iUpzCowh44,592 +cryptography/hazmat/bindings/_rust/exceptions.pyi,sha256=exXr2xw_0pB1kk93cYbM3MohbzoUkjOms1ZMUi0uQZE,640 +cryptography/hazmat/bindings/_rust/ocsp.pyi,sha256=RzVaLkY0y9L8W8opAL_uVD8bySKxP23pSQtEbLOStXI,905 +cryptography/hazmat/bindings/_rust/openssl/__init__.pyi,sha256=j764U4RRBZbDuOfjQxRqU7rCf74kgM-3AnTIjLdRy3E,970 +cryptography/hazmat/bindings/_rust/openssl/dh.pyi,sha256=0FVY1t5qM9HV_ZKDIcdJI2a72i1fHKyTvYIJb5UnH4M,896 +cryptography/hazmat/bindings/_rust/openssl/dsa.pyi,sha256=43in4PCsm2kz_H7RQFLBKqhDsUmb4yWop6dpYeVDg-4,764 +cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi,sha256=E2GXAgibfRGqKxskH8MfZI8gHFoMJJOTjG7Elg2gOww,629 +cryptography/hazmat/bindings/_rust/openssl/ed448.pyi,sha256=pk_kx5Biq8O53d2joOT-cXuwCrbFPicV7iaqYdeiIAI,603 +cryptography/hazmat/bindings/_rust/openssl/hashes.pyi,sha256=J8HoN0GdtPcjRAfNHr5Elva_nkmQfq63L75_z9dd8Uc,573 +cryptography/hazmat/bindings/_rust/openssl/hmac.pyi,sha256=ZmLJ73pmxcZFC1XosWEiXMRYtvJJor3ZLdCQOJu85Cw,662 +cryptography/hazmat/bindings/_rust/openssl/kdf.pyi,sha256=wPS5c7NLspM2632II0I4iH1RSxZvSRtBOVqmpyQATfk,544 +cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi,sha256=9iogF7Q4i81IkOS-IMXp6HvxFF_3cNy_ucrAjVQnn14,540 +cryptography/hazmat/bindings/_rust/openssl/x25519.pyi,sha256=-1F5QDZfrdhmDLKTeSERuuDUHBTV-EhxIYk9mjpwcG4,616 +cryptography/hazmat/bindings/_rust/openssl/x448.pyi,sha256=SdL4blscYBEvuWY4SuNAY1s5zFaGj38eQ-bulVBZvFg,590 +cryptography/hazmat/bindings/_rust/pkcs7.pyi,sha256=VkTC78wjJgb_qrboOYIFPuFZ3W46zsr6zsxnlrOMwao,460 +cryptography/hazmat/bindings/_rust/x509.pyi,sha256=j6AbXBZSXeJHLSrXnaapbiPfle-znfk9uJUa_zqxgy4,1878 +cryptography/hazmat/bindings/openssl/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc,, +cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc,, +cryptography/hazmat/bindings/openssl/_conditional.py,sha256=DeECq7AKguhs390ZmxgItdqPLzyrKGJk-3KlHJMkXoY,9098 +cryptography/hazmat/bindings/openssl/binding.py,sha256=0x3kzvq2grHu4gbbgEIzEVrX6unp71EEs1hx0o-uuOM,6696 +cryptography/hazmat/primitives/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc,, +cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc,, +cryptography/hazmat/primitives/_asymmetric.py,sha256=RhgcouUB6HTiFDBrR1LxqkMjpUxIiNvQ1r_zJjRG6qQ,532 +cryptography/hazmat/primitives/_cipheralgorithm.py,sha256=7LPkpw-DrgyvmBMUjvXeBvojVZPtXhFgfelUftnxPGw,1093 +cryptography/hazmat/primitives/_serialization.py,sha256=U0DU0ZzOLJppCQsh9EJH6vGYoHotBolfNyRyx3wr1l0,5216 +cryptography/hazmat/primitives/asymmetric/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180 +cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc,, +cryptography/hazmat/primitives/asymmetric/dh.py,sha256=XsthqjvExWWOyePs0PxT4MestU9QeGuL-Hx7fWzTguQ,7013 +cryptography/hazmat/primitives/asymmetric/dsa.py,sha256=aaTY7EMLTzaWs-jhOMpMAfa2GnfhoqsCKZPKAs35L40,8263 +cryptography/hazmat/primitives/asymmetric/ec.py,sha256=L1WoWPYevJ6Pk2T1etbnHbvr6AeXFccckPNNiyUVoNM,12867 +cryptography/hazmat/primitives/asymmetric/ed25519.py,sha256=wl2NCCP4bZdUCqZGMkOOd6eaxjU1vXPAIwzUuFPE__w,3489 +cryptography/hazmat/primitives/asymmetric/ed448.py,sha256=2MCJ87qcyCCsjj0OvrfWFxPX8CgaC3d0mr78bt_vDIY,3440 +cryptography/hazmat/primitives/asymmetric/padding.py,sha256=6p8Ojiax_2tcm1aTnNOAkinriCJ67nSTxugg34f-hzk,2717 +cryptography/hazmat/primitives/asymmetric/rsa.py,sha256=vxvOryF00WL8mZQv9bs_-LlgobYLiPYfX246_j_ICtA,11623 +cryptography/hazmat/primitives/asymmetric/types.py,sha256=LnsOJym-wmPUJ7Knu_7bCNU3kIiELCd6krOaW_JU08I,2996 +cryptography/hazmat/primitives/asymmetric/utils.py,sha256=DPTs6T4F-UhwzFQTh-1fSEpQzazH2jf2xpIro3ItF4o,790 +cryptography/hazmat/primitives/asymmetric/x25519.py,sha256=8YJAIaU7w09jTnPU_cLwd98fMHIECgfA3R7P3Ktv-CA,3437 +cryptography/hazmat/primitives/asymmetric/x448.py,sha256=y-Yj-rgciiuH1g6FJLZftvAqgOnzT1on9gCisru7vBc,3358 +cryptography/hazmat/primitives/ciphers/__init__.py,sha256=kAyb9NSczqTrCWj0HEoVp3Cxo7AHW8ibPFQz-ZHsOtA,680 +cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc,, +cryptography/hazmat/primitives/ciphers/aead.py,sha256=DY7qKmbt0bgB1GB7i-fQrbjEfwFG8wfUfVHvc7DA2YY,12067 +cryptography/hazmat/primitives/ciphers/algorithms.py,sha256=SCDskXc9xyzsz0NjND6tAX8t17jYTbUB2sww1ub9GuY,5000 +cryptography/hazmat/primitives/ciphers/base.py,sha256=PqNDltHdDxBhLhgtfO707H07sSOLA6ZVwjZlalOJTAo,8286 +cryptography/hazmat/primitives/ciphers/modes.py,sha256=YJQXi4PJGIIZ1rgchbMH47Ed-YiUcUSjLPEOuV8rgGE,8361 +cryptography/hazmat/primitives/cmac.py,sha256=YaeWksCYaqVoqf9zHRThAJ95ZvPUioAOfXwZUWiPzD8,2065 +cryptography/hazmat/primitives/constant_time.py,sha256=xdunWT0nf8OvKdcqUhhlFKayGp4_PgVJRU2W1wLSr_A,422 +cryptography/hazmat/primitives/hashes.py,sha256=VJpnbK2sQN2bEqwRTOoCB4nuxYx5CnqFiScMJNyhsrI,5115 +cryptography/hazmat/primitives/hmac.py,sha256=RpB3z9z5skirCQrm7zQbtnp9pLMnAjrlTUvKqF5aDDc,423 +cryptography/hazmat/primitives/kdf/__init__.py,sha256=4XibZnrYq4hh5xBjWiIXzaYW6FKx8hPbVaa_cB9zS64,750 +cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc,, +cryptography/hazmat/primitives/kdf/concatkdf.py,sha256=wGYWgILmxQWnCPkbAH1RpsCHrdKgmYrCEVrCvXVGCo8,3726 +cryptography/hazmat/primitives/kdf/hkdf.py,sha256=bBYr1yUIbOlJIEd6ZoLYcXm_yd-H54An9kNcFIJ3kbo,3045 +cryptography/hazmat/primitives/kdf/kbkdf.py,sha256=qPL6TmDUmkus6CW3ylTJfG8N8egZhjQOyXrSyLLpnak,9232 +cryptography/hazmat/primitives/kdf/pbkdf2.py,sha256=1CCH9Q5gXUpnZd3c8d8bCXgpJ3s2hZZGBnuG7FH1waM,2012 +cryptography/hazmat/primitives/kdf/scrypt.py,sha256=4QONhjxA_ZtuQtQ7QV3FnbB8ftrFnM52B4HPfV7hFys,2354 +cryptography/hazmat/primitives/kdf/x963kdf.py,sha256=S3B4Enk2Yxj9txpairotaXkavuZqQ6t6MB5a28U02ek,2002 +cryptography/hazmat/primitives/keywrap.py,sha256=Qb_N2V_E1Dti5VtDXnrtTYtJDZ8aMpur8BY5yxrXclg,5678 +cryptography/hazmat/primitives/padding.py,sha256=8pCeLaqwQPSGf51j06U5C_INvgYWVWPv3m9mxUERGmU,6242 +cryptography/hazmat/primitives/poly1305.py,sha256=P5EPQV-RB_FJPahpg01u0Ts4S_PnAmsroxIGXbGeRRo,355 +cryptography/hazmat/primitives/serialization/__init__.py,sha256=6ZlL3EicEzoGdMOat86w8y_XICCnlHdCjFI97rMxRDg,1653 +cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc,, +cryptography/hazmat/primitives/serialization/base.py,sha256=VZjIIqnbb-x38qpg2Wf_IxZvqjsgcEzNQtQoeJiQfpw,1986 +cryptography/hazmat/primitives/serialization/pkcs12.py,sha256=NOzFxArlZhdjfgfugs8nERho1eyaxujXKGUKINchek4,6767 +cryptography/hazmat/primitives/serialization/pkcs7.py,sha256=BCvlPubXQOunb76emISK89PX9qXcBQI2CRPNe85VTZk,7392 +cryptography/hazmat/primitives/serialization/ssh.py,sha256=aLCYLPY3W1kerfCwadn5aYNzwcwIQl9c7RcsB8CKfuc,51027 +cryptography/hazmat/primitives/twofactor/__init__.py,sha256=tmMZGB-g4IU1r7lIFqASU019zr0uPp_wEBYcwdDCKCA,258 +cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc,, +cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc,, +cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc,, +cryptography/hazmat/primitives/twofactor/hotp.py,sha256=uZ0PSKYDZOL0aAobiw1Zd2HD0W2Ei1niUNC2v7Tnpc8,3010 +cryptography/hazmat/primitives/twofactor/totp.py,sha256=cMbWlAapOM1SfezEx9MoMHpCW9ingNXCg6OsGv4T8jc,1473 +cryptography/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +cryptography/utils.py,sha256=DfdXc9M4kmAboE2a0pPiISt5LVnW-jhhXURy8nDHae0,4018 +cryptography/x509/__init__.py,sha256=DzZE8bR-3iiVi3Wrcq7-g5Pm64fCr5aqsTNyi_rjJu0,7870 +cryptography/x509/__pycache__/__init__.cpython-311.pyc,, +cryptography/x509/__pycache__/base.cpython-311.pyc,, +cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc,, +cryptography/x509/__pycache__/extensions.cpython-311.pyc,, +cryptography/x509/__pycache__/general_name.cpython-311.pyc,, +cryptography/x509/__pycache__/name.cpython-311.pyc,, +cryptography/x509/__pycache__/ocsp.cpython-311.pyc,, +cryptography/x509/__pycache__/oid.cpython-311.pyc,, +cryptography/x509/base.py,sha256=FbS6EFE3uJ3O-zbFPRjsO6DckrNSN5TJNZMJcnzUWFQ,35677 +cryptography/x509/certificate_transparency.py,sha256=6HvzAD0dlSQVxy6tnDhGj0-pisp1MaJ9bxQNRr92inI,2261 +cryptography/x509/extensions.py,sha256=rFEcfZiFvcONs1ot03d68dAMK2U75w0s3g9mhyWBRcI,68365 +cryptography/x509/general_name.py,sha256=zm8GxNgVJuLD6rN488c5zdHhxp5gUxeRzw8enZMWDQ0,7868 +cryptography/x509/name.py,sha256=aZ2dpsinhkza3eTxT1vNmWuFMQ7fmcA0hs4npgnkf9Q,14855 +cryptography/x509/ocsp.py,sha256=48iW7xbZ9mZLELSEl7Wwjb4vYhOQ3KcNtqgKsAb_UD0,18534 +cryptography/x509/oid.py,sha256=fFosjGsnIB_w_0YrzZv1ggkSVwZl7xmY0zofKZNZkDA,829 diff --git a/jwt/python/cryptography-41.0.3.dist-info/WHEEL b/jwt/python/cryptography-41.0.3.dist-info/WHEEL new file mode 100644 index 0000000..9aa479e --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.41.0) +Root-Is-Purelib: false +Tag: cp37-abi3-manylinux_2_17_x86_64 +Tag: cp37-abi3-manylinux2014_x86_64 + diff --git a/jwt/python/cryptography-41.0.3.dist-info/top_level.txt b/jwt/python/cryptography-41.0.3.dist-info/top_level.txt new file mode 100644 index 0000000..0d38bc5 --- /dev/null +++ b/jwt/python/cryptography-41.0.3.dist-info/top_level.txt @@ -0,0 +1 @@ +cryptography diff --git a/jwt/python/cryptography/__about__.py b/jwt/python/cryptography/__about__.py new file mode 100644 index 0000000..27273ef --- /dev/null +++ b/jwt/python/cryptography/__about__.py @@ -0,0 +1,17 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +__all__ = [ + "__version__", + "__author__", + "__copyright__", +] + +__version__ = "41.0.3" + + +__author__ = "The Python Cryptographic Authority and individual contributors" +__copyright__ = f"Copyright 2013-2023 {__author__}" diff --git a/jwt/python/cryptography/__init__.py b/jwt/python/cryptography/__init__.py new file mode 100644 index 0000000..86b9a25 --- /dev/null +++ b/jwt/python/cryptography/__init__.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.__about__ import __author__, __copyright__, __version__ + +__all__ = [ + "__version__", + "__author__", + "__copyright__", +] diff --git a/jwt/python/cryptography/__pycache__/__about__.cpython-311.pyc b/jwt/python/cryptography/__pycache__/__about__.cpython-311.pyc new file mode 100644 index 0000000..2f43a0d Binary files /dev/null and b/jwt/python/cryptography/__pycache__/__about__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..ac92a4d Binary files /dev/null and b/jwt/python/cryptography/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/__pycache__/exceptions.cpython-311.pyc b/jwt/python/cryptography/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..1600a94 Binary files /dev/null and b/jwt/python/cryptography/__pycache__/exceptions.cpython-311.pyc differ diff --git a/jwt/python/cryptography/__pycache__/fernet.cpython-311.pyc b/jwt/python/cryptography/__pycache__/fernet.cpython-311.pyc new file mode 100644 index 0000000..de22a49 Binary files /dev/null and b/jwt/python/cryptography/__pycache__/fernet.cpython-311.pyc differ diff --git a/jwt/python/cryptography/__pycache__/utils.cpython-311.pyc b/jwt/python/cryptography/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..1b11710 Binary files /dev/null and b/jwt/python/cryptography/__pycache__/utils.cpython-311.pyc differ diff --git a/jwt/python/cryptography/exceptions.py b/jwt/python/cryptography/exceptions.py new file mode 100644 index 0000000..47fdd18 --- /dev/null +++ b/jwt/python/cryptography/exceptions.py @@ -0,0 +1,54 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions + +if typing.TYPE_CHECKING: + from cryptography.hazmat.bindings._rust import openssl as rust_openssl + +_Reasons = rust_exceptions._Reasons + + +class UnsupportedAlgorithm(Exception): + def __init__( + self, message: str, reason: typing.Optional[_Reasons] = None + ) -> None: + super().__init__(message) + self._reason = reason + + +class AlreadyFinalized(Exception): + pass + + +class AlreadyUpdated(Exception): + pass + + +class NotYetFinalized(Exception): + pass + + +class InvalidTag(Exception): + pass + + +class InvalidSignature(Exception): + pass + + +class InternalError(Exception): + def __init__( + self, msg: str, err_code: typing.List[rust_openssl.OpenSSLError] + ) -> None: + super().__init__(msg) + self.err_code = err_code + + +class InvalidKey(Exception): + pass diff --git a/jwt/python/cryptography/fernet.py b/jwt/python/cryptography/fernet.py new file mode 100644 index 0000000..ad8fb40 --- /dev/null +++ b/jwt/python/cryptography/fernet.py @@ -0,0 +1,221 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import base64 +import binascii +import os +import time +import typing + +from cryptography import utils +from cryptography.exceptions import InvalidSignature +from cryptography.hazmat.primitives import hashes, padding +from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes +from cryptography.hazmat.primitives.hmac import HMAC + + +class InvalidToken(Exception): + pass + + +_MAX_CLOCK_SKEW = 60 + + +class Fernet: + def __init__( + self, + key: typing.Union[bytes, str], + backend: typing.Any = None, + ) -> None: + try: + key = base64.urlsafe_b64decode(key) + except binascii.Error as exc: + raise ValueError( + "Fernet key must be 32 url-safe base64-encoded bytes." + ) from exc + if len(key) != 32: + raise ValueError( + "Fernet key must be 32 url-safe base64-encoded bytes." + ) + + self._signing_key = key[:16] + self._encryption_key = key[16:] + + @classmethod + def generate_key(cls) -> bytes: + return base64.urlsafe_b64encode(os.urandom(32)) + + def encrypt(self, data: bytes) -> bytes: + return self.encrypt_at_time(data, int(time.time())) + + def encrypt_at_time(self, data: bytes, current_time: int) -> bytes: + iv = os.urandom(16) + return self._encrypt_from_parts(data, current_time, iv) + + def _encrypt_from_parts( + self, data: bytes, current_time: int, iv: bytes + ) -> bytes: + utils._check_bytes("data", data) + + padder = padding.PKCS7(algorithms.AES.block_size).padder() + padded_data = padder.update(data) + padder.finalize() + encryptor = Cipher( + algorithms.AES(self._encryption_key), + modes.CBC(iv), + ).encryptor() + ciphertext = encryptor.update(padded_data) + encryptor.finalize() + + basic_parts = ( + b"\x80" + + current_time.to_bytes(length=8, byteorder="big") + + iv + + ciphertext + ) + + h = HMAC(self._signing_key, hashes.SHA256()) + h.update(basic_parts) + hmac = h.finalize() + return base64.urlsafe_b64encode(basic_parts + hmac) + + def decrypt( + self, token: typing.Union[bytes, str], ttl: typing.Optional[int] = None + ) -> bytes: + timestamp, data = Fernet._get_unverified_token_data(token) + if ttl is None: + time_info = None + else: + time_info = (ttl, int(time.time())) + return self._decrypt_data(data, timestamp, time_info) + + def decrypt_at_time( + self, token: typing.Union[bytes, str], ttl: int, current_time: int + ) -> bytes: + if ttl is None: + raise ValueError( + "decrypt_at_time() can only be used with a non-None ttl" + ) + timestamp, data = Fernet._get_unverified_token_data(token) + return self._decrypt_data(data, timestamp, (ttl, current_time)) + + def extract_timestamp(self, token: typing.Union[bytes, str]) -> int: + timestamp, data = Fernet._get_unverified_token_data(token) + # Verify the token was not tampered with. + self._verify_signature(data) + return timestamp + + @staticmethod + def _get_unverified_token_data( + token: typing.Union[bytes, str] + ) -> typing.Tuple[int, bytes]: + if not isinstance(token, (str, bytes)): + raise TypeError("token must be bytes or str") + + try: + data = base64.urlsafe_b64decode(token) + except (TypeError, binascii.Error): + raise InvalidToken + + if not data or data[0] != 0x80: + raise InvalidToken + + if len(data) < 9: + raise InvalidToken + + timestamp = int.from_bytes(data[1:9], byteorder="big") + return timestamp, data + + def _verify_signature(self, data: bytes) -> None: + h = HMAC(self._signing_key, hashes.SHA256()) + h.update(data[:-32]) + try: + h.verify(data[-32:]) + except InvalidSignature: + raise InvalidToken + + def _decrypt_data( + self, + data: bytes, + timestamp: int, + time_info: typing.Optional[typing.Tuple[int, int]], + ) -> bytes: + if time_info is not None: + ttl, current_time = time_info + if timestamp + ttl < current_time: + raise InvalidToken + + if current_time + _MAX_CLOCK_SKEW < timestamp: + raise InvalidToken + + self._verify_signature(data) + + iv = data[9:25] + ciphertext = data[25:-32] + decryptor = Cipher( + algorithms.AES(self._encryption_key), modes.CBC(iv) + ).decryptor() + plaintext_padded = decryptor.update(ciphertext) + try: + plaintext_padded += decryptor.finalize() + except ValueError: + raise InvalidToken + unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder() + + unpadded = unpadder.update(plaintext_padded) + try: + unpadded += unpadder.finalize() + except ValueError: + raise InvalidToken + return unpadded + + +class MultiFernet: + def __init__(self, fernets: typing.Iterable[Fernet]): + fernets = list(fernets) + if not fernets: + raise ValueError( + "MultiFernet requires at least one Fernet instance" + ) + self._fernets = fernets + + def encrypt(self, msg: bytes) -> bytes: + return self.encrypt_at_time(msg, int(time.time())) + + def encrypt_at_time(self, msg: bytes, current_time: int) -> bytes: + return self._fernets[0].encrypt_at_time(msg, current_time) + + def rotate(self, msg: typing.Union[bytes, str]) -> bytes: + timestamp, data = Fernet._get_unverified_token_data(msg) + for f in self._fernets: + try: + p = f._decrypt_data(data, timestamp, None) + break + except InvalidToken: + pass + else: + raise InvalidToken + + iv = os.urandom(16) + return self._fernets[0]._encrypt_from_parts(p, timestamp, iv) + + def decrypt( + self, msg: typing.Union[bytes, str], ttl: typing.Optional[int] = None + ) -> bytes: + for f in self._fernets: + try: + return f.decrypt(msg, ttl) + except InvalidToken: + pass + raise InvalidToken + + def decrypt_at_time( + self, msg: typing.Union[bytes, str], ttl: int, current_time: int + ) -> bytes: + for f in self._fernets: + try: + return f.decrypt_at_time(msg, ttl, current_time) + except InvalidToken: + pass + raise InvalidToken diff --git a/jwt/python/cryptography/hazmat/__init__.py b/jwt/python/cryptography/hazmat/__init__.py new file mode 100644 index 0000000..b9f1187 --- /dev/null +++ b/jwt/python/cryptography/hazmat/__init__.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +""" +Hazardous Materials + +This is a "Hazardous Materials" module. You should ONLY use it if you're +100% absolutely sure that you know what you're doing because this module +is full of land mines, dragons, and dinosaurs with laser guns. +""" diff --git a/jwt/python/cryptography/hazmat/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b645fd3 Binary files /dev/null and b/jwt/python/cryptography/hazmat/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/__pycache__/_oid.cpython-311.pyc b/jwt/python/cryptography/hazmat/__pycache__/_oid.cpython-311.pyc new file mode 100644 index 0000000..92ac8f5 Binary files /dev/null and b/jwt/python/cryptography/hazmat/__pycache__/_oid.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/_oid.py b/jwt/python/cryptography/hazmat/_oid.py new file mode 100644 index 0000000..01d4b34 --- /dev/null +++ b/jwt/python/cryptography/hazmat/_oid.py @@ -0,0 +1,299 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.bindings._rust import ( + ObjectIdentifier as ObjectIdentifier, +) +from cryptography.hazmat.primitives import hashes + + +class ExtensionOID: + SUBJECT_DIRECTORY_ATTRIBUTES = ObjectIdentifier("2.5.29.9") + SUBJECT_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.14") + KEY_USAGE = ObjectIdentifier("2.5.29.15") + SUBJECT_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.17") + ISSUER_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.18") + BASIC_CONSTRAINTS = ObjectIdentifier("2.5.29.19") + NAME_CONSTRAINTS = ObjectIdentifier("2.5.29.30") + CRL_DISTRIBUTION_POINTS = ObjectIdentifier("2.5.29.31") + CERTIFICATE_POLICIES = ObjectIdentifier("2.5.29.32") + POLICY_MAPPINGS = ObjectIdentifier("2.5.29.33") + AUTHORITY_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.35") + POLICY_CONSTRAINTS = ObjectIdentifier("2.5.29.36") + EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37") + FRESHEST_CRL = ObjectIdentifier("2.5.29.46") + INHIBIT_ANY_POLICY = ObjectIdentifier("2.5.29.54") + ISSUING_DISTRIBUTION_POINT = ObjectIdentifier("2.5.29.28") + AUTHORITY_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.1") + SUBJECT_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.11") + OCSP_NO_CHECK = ObjectIdentifier("1.3.6.1.5.5.7.48.1.5") + TLS_FEATURE = ObjectIdentifier("1.3.6.1.5.5.7.1.24") + CRL_NUMBER = ObjectIdentifier("2.5.29.20") + DELTA_CRL_INDICATOR = ObjectIdentifier("2.5.29.27") + PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier( + "1.3.6.1.4.1.11129.2.4.2" + ) + PRECERT_POISON = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.3") + SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.5") + MS_CERTIFICATE_TEMPLATE = ObjectIdentifier("1.3.6.1.4.1.311.21.7") + + +class OCSPExtensionOID: + NONCE = ObjectIdentifier("1.3.6.1.5.5.7.48.1.2") + ACCEPTABLE_RESPONSES = ObjectIdentifier("1.3.6.1.5.5.7.48.1.4") + + +class CRLEntryExtensionOID: + CERTIFICATE_ISSUER = ObjectIdentifier("2.5.29.29") + CRL_REASON = ObjectIdentifier("2.5.29.21") + INVALIDITY_DATE = ObjectIdentifier("2.5.29.24") + + +class NameOID: + COMMON_NAME = ObjectIdentifier("2.5.4.3") + COUNTRY_NAME = ObjectIdentifier("2.5.4.6") + LOCALITY_NAME = ObjectIdentifier("2.5.4.7") + STATE_OR_PROVINCE_NAME = ObjectIdentifier("2.5.4.8") + STREET_ADDRESS = ObjectIdentifier("2.5.4.9") + ORGANIZATION_NAME = ObjectIdentifier("2.5.4.10") + ORGANIZATIONAL_UNIT_NAME = ObjectIdentifier("2.5.4.11") + SERIAL_NUMBER = ObjectIdentifier("2.5.4.5") + SURNAME = ObjectIdentifier("2.5.4.4") + GIVEN_NAME = ObjectIdentifier("2.5.4.42") + TITLE = ObjectIdentifier("2.5.4.12") + INITIALS = ObjectIdentifier("2.5.4.43") + GENERATION_QUALIFIER = ObjectIdentifier("2.5.4.44") + X500_UNIQUE_IDENTIFIER = ObjectIdentifier("2.5.4.45") + DN_QUALIFIER = ObjectIdentifier("2.5.4.46") + PSEUDONYM = ObjectIdentifier("2.5.4.65") + USER_ID = ObjectIdentifier("0.9.2342.19200300.100.1.1") + DOMAIN_COMPONENT = ObjectIdentifier("0.9.2342.19200300.100.1.25") + EMAIL_ADDRESS = ObjectIdentifier("1.2.840.113549.1.9.1") + JURISDICTION_COUNTRY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.3") + JURISDICTION_LOCALITY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.1") + JURISDICTION_STATE_OR_PROVINCE_NAME = ObjectIdentifier( + "1.3.6.1.4.1.311.60.2.1.2" + ) + BUSINESS_CATEGORY = ObjectIdentifier("2.5.4.15") + POSTAL_ADDRESS = ObjectIdentifier("2.5.4.16") + POSTAL_CODE = ObjectIdentifier("2.5.4.17") + INN = ObjectIdentifier("1.2.643.3.131.1.1") + OGRN = ObjectIdentifier("1.2.643.100.1") + SNILS = ObjectIdentifier("1.2.643.100.3") + UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2") + + +class SignatureAlgorithmOID: + RSA_WITH_MD5 = ObjectIdentifier("1.2.840.113549.1.1.4") + RSA_WITH_SHA1 = ObjectIdentifier("1.2.840.113549.1.1.5") + # This is an alternate OID for RSA with SHA1 that is occasionally seen + _RSA_WITH_SHA1 = ObjectIdentifier("1.3.14.3.2.29") + RSA_WITH_SHA224 = ObjectIdentifier("1.2.840.113549.1.1.14") + RSA_WITH_SHA256 = ObjectIdentifier("1.2.840.113549.1.1.11") + RSA_WITH_SHA384 = ObjectIdentifier("1.2.840.113549.1.1.12") + RSA_WITH_SHA512 = ObjectIdentifier("1.2.840.113549.1.1.13") + RSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.13") + RSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.14") + RSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.15") + RSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.16") + RSASSA_PSS = ObjectIdentifier("1.2.840.113549.1.1.10") + ECDSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10045.4.1") + ECDSA_WITH_SHA224 = ObjectIdentifier("1.2.840.10045.4.3.1") + ECDSA_WITH_SHA256 = ObjectIdentifier("1.2.840.10045.4.3.2") + ECDSA_WITH_SHA384 = ObjectIdentifier("1.2.840.10045.4.3.3") + ECDSA_WITH_SHA512 = ObjectIdentifier("1.2.840.10045.4.3.4") + ECDSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.9") + ECDSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.10") + ECDSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.11") + ECDSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.12") + DSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10040.4.3") + DSA_WITH_SHA224 = ObjectIdentifier("2.16.840.1.101.3.4.3.1") + DSA_WITH_SHA256 = ObjectIdentifier("2.16.840.1.101.3.4.3.2") + DSA_WITH_SHA384 = ObjectIdentifier("2.16.840.1.101.3.4.3.3") + DSA_WITH_SHA512 = ObjectIdentifier("2.16.840.1.101.3.4.3.4") + ED25519 = ObjectIdentifier("1.3.101.112") + ED448 = ObjectIdentifier("1.3.101.113") + GOSTR3411_94_WITH_3410_2001 = ObjectIdentifier("1.2.643.2.2.3") + GOSTR3410_2012_WITH_3411_2012_256 = ObjectIdentifier("1.2.643.7.1.1.3.2") + GOSTR3410_2012_WITH_3411_2012_512 = ObjectIdentifier("1.2.643.7.1.1.3.3") + + +_SIG_OIDS_TO_HASH: typing.Dict[ + ObjectIdentifier, typing.Optional[hashes.HashAlgorithm] +] = { + SignatureAlgorithmOID.RSA_WITH_MD5: hashes.MD5(), + SignatureAlgorithmOID.RSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID._RSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID.RSA_WITH_SHA224: hashes.SHA224(), + SignatureAlgorithmOID.RSA_WITH_SHA256: hashes.SHA256(), + SignatureAlgorithmOID.RSA_WITH_SHA384: hashes.SHA384(), + SignatureAlgorithmOID.RSA_WITH_SHA512: hashes.SHA512(), + SignatureAlgorithmOID.RSA_WITH_SHA3_224: hashes.SHA3_224(), + SignatureAlgorithmOID.RSA_WITH_SHA3_256: hashes.SHA3_256(), + SignatureAlgorithmOID.RSA_WITH_SHA3_384: hashes.SHA3_384(), + SignatureAlgorithmOID.RSA_WITH_SHA3_512: hashes.SHA3_512(), + SignatureAlgorithmOID.ECDSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID.ECDSA_WITH_SHA224: hashes.SHA224(), + SignatureAlgorithmOID.ECDSA_WITH_SHA256: hashes.SHA256(), + SignatureAlgorithmOID.ECDSA_WITH_SHA384: hashes.SHA384(), + SignatureAlgorithmOID.ECDSA_WITH_SHA512: hashes.SHA512(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_224: hashes.SHA3_224(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_256: hashes.SHA3_256(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_384: hashes.SHA3_384(), + SignatureAlgorithmOID.ECDSA_WITH_SHA3_512: hashes.SHA3_512(), + SignatureAlgorithmOID.DSA_WITH_SHA1: hashes.SHA1(), + SignatureAlgorithmOID.DSA_WITH_SHA224: hashes.SHA224(), + SignatureAlgorithmOID.DSA_WITH_SHA256: hashes.SHA256(), + SignatureAlgorithmOID.ED25519: None, + SignatureAlgorithmOID.ED448: None, + SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: None, + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: None, + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: None, +} + + +class ExtendedKeyUsageOID: + SERVER_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.1") + CLIENT_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.2") + CODE_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.3") + EMAIL_PROTECTION = ObjectIdentifier("1.3.6.1.5.5.7.3.4") + TIME_STAMPING = ObjectIdentifier("1.3.6.1.5.5.7.3.8") + OCSP_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.9") + ANY_EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37.0") + SMARTCARD_LOGON = ObjectIdentifier("1.3.6.1.4.1.311.20.2.2") + KERBEROS_PKINIT_KDC = ObjectIdentifier("1.3.6.1.5.2.3.5") + IPSEC_IKE = ObjectIdentifier("1.3.6.1.5.5.7.3.17") + CERTIFICATE_TRANSPARENCY = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.4") + + +class AuthorityInformationAccessOID: + CA_ISSUERS = ObjectIdentifier("1.3.6.1.5.5.7.48.2") + OCSP = ObjectIdentifier("1.3.6.1.5.5.7.48.1") + + +class SubjectInformationAccessOID: + CA_REPOSITORY = ObjectIdentifier("1.3.6.1.5.5.7.48.5") + + +class CertificatePoliciesOID: + CPS_QUALIFIER = ObjectIdentifier("1.3.6.1.5.5.7.2.1") + CPS_USER_NOTICE = ObjectIdentifier("1.3.6.1.5.5.7.2.2") + ANY_POLICY = ObjectIdentifier("2.5.29.32.0") + + +class AttributeOID: + CHALLENGE_PASSWORD = ObjectIdentifier("1.2.840.113549.1.9.7") + UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2") + + +_OID_NAMES = { + NameOID.COMMON_NAME: "commonName", + NameOID.COUNTRY_NAME: "countryName", + NameOID.LOCALITY_NAME: "localityName", + NameOID.STATE_OR_PROVINCE_NAME: "stateOrProvinceName", + NameOID.STREET_ADDRESS: "streetAddress", + NameOID.ORGANIZATION_NAME: "organizationName", + NameOID.ORGANIZATIONAL_UNIT_NAME: "organizationalUnitName", + NameOID.SERIAL_NUMBER: "serialNumber", + NameOID.SURNAME: "surname", + NameOID.GIVEN_NAME: "givenName", + NameOID.TITLE: "title", + NameOID.GENERATION_QUALIFIER: "generationQualifier", + NameOID.X500_UNIQUE_IDENTIFIER: "x500UniqueIdentifier", + NameOID.DN_QUALIFIER: "dnQualifier", + NameOID.PSEUDONYM: "pseudonym", + NameOID.USER_ID: "userID", + NameOID.DOMAIN_COMPONENT: "domainComponent", + NameOID.EMAIL_ADDRESS: "emailAddress", + NameOID.JURISDICTION_COUNTRY_NAME: "jurisdictionCountryName", + NameOID.JURISDICTION_LOCALITY_NAME: "jurisdictionLocalityName", + NameOID.JURISDICTION_STATE_OR_PROVINCE_NAME: ( + "jurisdictionStateOrProvinceName" + ), + NameOID.BUSINESS_CATEGORY: "businessCategory", + NameOID.POSTAL_ADDRESS: "postalAddress", + NameOID.POSTAL_CODE: "postalCode", + NameOID.INN: "INN", + NameOID.OGRN: "OGRN", + NameOID.SNILS: "SNILS", + NameOID.UNSTRUCTURED_NAME: "unstructuredName", + SignatureAlgorithmOID.RSA_WITH_MD5: "md5WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA1: "sha1WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA224: "sha224WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA256: "sha256WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA384: "sha384WithRSAEncryption", + SignatureAlgorithmOID.RSA_WITH_SHA512: "sha512WithRSAEncryption", + SignatureAlgorithmOID.RSASSA_PSS: "RSASSA-PSS", + SignatureAlgorithmOID.ECDSA_WITH_SHA1: "ecdsa-with-SHA1", + SignatureAlgorithmOID.ECDSA_WITH_SHA224: "ecdsa-with-SHA224", + SignatureAlgorithmOID.ECDSA_WITH_SHA256: "ecdsa-with-SHA256", + SignatureAlgorithmOID.ECDSA_WITH_SHA384: "ecdsa-with-SHA384", + SignatureAlgorithmOID.ECDSA_WITH_SHA512: "ecdsa-with-SHA512", + SignatureAlgorithmOID.DSA_WITH_SHA1: "dsa-with-sha1", + SignatureAlgorithmOID.DSA_WITH_SHA224: "dsa-with-sha224", + SignatureAlgorithmOID.DSA_WITH_SHA256: "dsa-with-sha256", + SignatureAlgorithmOID.ED25519: "ed25519", + SignatureAlgorithmOID.ED448: "ed448", + SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: ( + "GOST R 34.11-94 with GOST R 34.10-2001" + ), + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: ( + "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" + ), + SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: ( + "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" + ), + ExtendedKeyUsageOID.SERVER_AUTH: "serverAuth", + ExtendedKeyUsageOID.CLIENT_AUTH: "clientAuth", + ExtendedKeyUsageOID.CODE_SIGNING: "codeSigning", + ExtendedKeyUsageOID.EMAIL_PROTECTION: "emailProtection", + ExtendedKeyUsageOID.TIME_STAMPING: "timeStamping", + ExtendedKeyUsageOID.OCSP_SIGNING: "OCSPSigning", + ExtendedKeyUsageOID.SMARTCARD_LOGON: "msSmartcardLogin", + ExtendedKeyUsageOID.KERBEROS_PKINIT_KDC: "pkInitKDC", + ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES: "subjectDirectoryAttributes", + ExtensionOID.SUBJECT_KEY_IDENTIFIER: "subjectKeyIdentifier", + ExtensionOID.KEY_USAGE: "keyUsage", + ExtensionOID.SUBJECT_ALTERNATIVE_NAME: "subjectAltName", + ExtensionOID.ISSUER_ALTERNATIVE_NAME: "issuerAltName", + ExtensionOID.BASIC_CONSTRAINTS: "basicConstraints", + ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS: ( + "signedCertificateTimestampList" + ), + ExtensionOID.SIGNED_CERTIFICATE_TIMESTAMPS: ( + "signedCertificateTimestampList" + ), + ExtensionOID.PRECERT_POISON: "ctPoison", + ExtensionOID.MS_CERTIFICATE_TEMPLATE: "msCertificateTemplate", + CRLEntryExtensionOID.CRL_REASON: "cRLReason", + CRLEntryExtensionOID.INVALIDITY_DATE: "invalidityDate", + CRLEntryExtensionOID.CERTIFICATE_ISSUER: "certificateIssuer", + ExtensionOID.NAME_CONSTRAINTS: "nameConstraints", + ExtensionOID.CRL_DISTRIBUTION_POINTS: "cRLDistributionPoints", + ExtensionOID.CERTIFICATE_POLICIES: "certificatePolicies", + ExtensionOID.POLICY_MAPPINGS: "policyMappings", + ExtensionOID.AUTHORITY_KEY_IDENTIFIER: "authorityKeyIdentifier", + ExtensionOID.POLICY_CONSTRAINTS: "policyConstraints", + ExtensionOID.EXTENDED_KEY_USAGE: "extendedKeyUsage", + ExtensionOID.FRESHEST_CRL: "freshestCRL", + ExtensionOID.INHIBIT_ANY_POLICY: "inhibitAnyPolicy", + ExtensionOID.ISSUING_DISTRIBUTION_POINT: ("issuingDistributionPoint"), + ExtensionOID.AUTHORITY_INFORMATION_ACCESS: "authorityInfoAccess", + ExtensionOID.SUBJECT_INFORMATION_ACCESS: "subjectInfoAccess", + ExtensionOID.OCSP_NO_CHECK: "OCSPNoCheck", + ExtensionOID.CRL_NUMBER: "cRLNumber", + ExtensionOID.DELTA_CRL_INDICATOR: "deltaCRLIndicator", + ExtensionOID.TLS_FEATURE: "TLSFeature", + AuthorityInformationAccessOID.OCSP: "OCSP", + AuthorityInformationAccessOID.CA_ISSUERS: "caIssuers", + SubjectInformationAccessOID.CA_REPOSITORY: "caRepository", + CertificatePoliciesOID.CPS_QUALIFIER: "id-qt-cps", + CertificatePoliciesOID.CPS_USER_NOTICE: "id-qt-unotice", + OCSPExtensionOID.NONCE: "OCSPNonce", + AttributeOID.CHALLENGE_PASSWORD: "challengePassword", +} diff --git a/jwt/python/cryptography/hazmat/backends/__init__.py b/jwt/python/cryptography/hazmat/backends/__init__.py new file mode 100644 index 0000000..b4400aa --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/__init__.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from typing import Any + + +def default_backend() -> Any: + from cryptography.hazmat.backends.openssl.backend import backend + + return backend diff --git a/jwt/python/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..f474f9f Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__init__.py b/jwt/python/cryptography/hazmat/backends/openssl/__init__.py new file mode 100644 index 0000000..51b0447 --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/__init__.py @@ -0,0 +1,9 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.backends.openssl.backend import backend + +__all__ = ["backend"] diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e860eba Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc new file mode 100644 index 0000000..7d21854 Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc new file mode 100644 index 0000000..39613a8 Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc new file mode 100644 index 0000000..b27709b Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc new file mode 100644 index 0000000..bba7f38 Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc new file mode 100644 index 0000000..6e95d5b Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc new file mode 100644 index 0000000..dc39362 Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc new file mode 100644 index 0000000..74a1dd7 Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..a62b70b Binary files /dev/null and b/jwt/python/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/backends/openssl/aead.py b/jwt/python/cryptography/hazmat/backends/openssl/aead.py new file mode 100644 index 0000000..b36f535 --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/aead.py @@ -0,0 +1,527 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import InvalidTag + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + from cryptography.hazmat.primitives.ciphers.aead import ( + AESCCM, + AESGCM, + AESOCB3, + AESSIV, + ChaCha20Poly1305, + ) + + _AEADTypes = typing.Union[ + AESCCM, AESGCM, AESOCB3, AESSIV, ChaCha20Poly1305 + ] + + +def _is_evp_aead_supported_cipher( + backend: Backend, cipher: _AEADTypes +) -> bool: + """ + Checks whether the given cipher is supported through + EVP_AEAD rather than the normal OpenSSL EVP_CIPHER API. + """ + from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305 + + return backend._lib.Cryptography_HAS_EVP_AEAD and isinstance( + cipher, ChaCha20Poly1305 + ) + + +def _aead_cipher_supported(backend: Backend, cipher: _AEADTypes) -> bool: + if _is_evp_aead_supported_cipher(backend, cipher): + return True + else: + cipher_name = _evp_cipher_cipher_name(cipher) + if backend._fips_enabled and cipher_name not in backend._fips_aead: + return False + # SIV isn't loaded through get_cipherbyname but instead a new fetch API + # only available in 3.0+. But if we know we're on 3.0+ then we know + # it's supported. + if cipher_name.endswith(b"-siv"): + return backend._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER == 1 + else: + return ( + backend._lib.EVP_get_cipherbyname(cipher_name) + != backend._ffi.NULL + ) + + +def _aead_create_ctx( + backend: Backend, + cipher: _AEADTypes, + key: bytes, +): + if _is_evp_aead_supported_cipher(backend, cipher): + return _evp_aead_create_ctx(backend, cipher, key) + else: + return _evp_cipher_create_ctx(backend, cipher, key) + + +def _encrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + if _is_evp_aead_supported_cipher(backend, cipher): + return _evp_aead_encrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + else: + return _evp_cipher_encrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + + +def _decrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + if _is_evp_aead_supported_cipher(backend, cipher): + return _evp_aead_decrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + else: + return _evp_cipher_decrypt( + backend, cipher, nonce, data, associated_data, tag_length, ctx + ) + + +def _evp_aead_create_ctx( + backend: Backend, + cipher: _AEADTypes, + key: bytes, + tag_len: typing.Optional[int] = None, +): + aead_cipher = _evp_aead_get_cipher(backend, cipher) + assert aead_cipher is not None + key_ptr = backend._ffi.from_buffer(key) + tag_len = ( + backend._lib.EVP_AEAD_DEFAULT_TAG_LENGTH + if tag_len is None + else tag_len + ) + ctx = backend._lib.Cryptography_EVP_AEAD_CTX_new( + aead_cipher, key_ptr, len(key), tag_len + ) + backend.openssl_assert(ctx != backend._ffi.NULL) + ctx = backend._ffi.gc(ctx, backend._lib.EVP_AEAD_CTX_free) + return ctx + + +def _evp_aead_get_cipher(backend: Backend, cipher: _AEADTypes): + from cryptography.hazmat.primitives.ciphers.aead import ( + ChaCha20Poly1305, + ) + + # Currently only ChaCha20-Poly1305 is supported using this API + assert isinstance(cipher, ChaCha20Poly1305) + return backend._lib.EVP_aead_chacha20_poly1305() + + +def _evp_aead_encrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any, +) -> bytes: + assert ctx is not None + + aead_cipher = _evp_aead_get_cipher(backend, cipher) + assert aead_cipher is not None + + out_len = backend._ffi.new("size_t *") + # max_out_len should be in_len plus the result of + # EVP_AEAD_max_overhead. + max_out_len = len(data) + backend._lib.EVP_AEAD_max_overhead(aead_cipher) + out_buf = backend._ffi.new("uint8_t[]", max_out_len) + data_ptr = backend._ffi.from_buffer(data) + nonce_ptr = backend._ffi.from_buffer(nonce) + aad = b"".join(associated_data) + aad_ptr = backend._ffi.from_buffer(aad) + + res = backend._lib.EVP_AEAD_CTX_seal( + ctx, + out_buf, + out_len, + max_out_len, + nonce_ptr, + len(nonce), + data_ptr, + len(data), + aad_ptr, + len(aad), + ) + backend.openssl_assert(res == 1) + encrypted_data = backend._ffi.buffer(out_buf, out_len[0])[:] + return encrypted_data + + +def _evp_aead_decrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any, +) -> bytes: + if len(data) < tag_length: + raise InvalidTag + + assert ctx is not None + + out_len = backend._ffi.new("size_t *") + # max_out_len should at least in_len + max_out_len = len(data) + out_buf = backend._ffi.new("uint8_t[]", max_out_len) + data_ptr = backend._ffi.from_buffer(data) + nonce_ptr = backend._ffi.from_buffer(nonce) + aad = b"".join(associated_data) + aad_ptr = backend._ffi.from_buffer(aad) + + res = backend._lib.EVP_AEAD_CTX_open( + ctx, + out_buf, + out_len, + max_out_len, + nonce_ptr, + len(nonce), + data_ptr, + len(data), + aad_ptr, + len(aad), + ) + + if res == 0: + backend._consume_errors() + raise InvalidTag + + decrypted_data = backend._ffi.buffer(out_buf, out_len[0])[:] + return decrypted_data + + +_ENCRYPT = 1 +_DECRYPT = 0 + + +def _evp_cipher_cipher_name(cipher: _AEADTypes) -> bytes: + from cryptography.hazmat.primitives.ciphers.aead import ( + AESCCM, + AESGCM, + AESOCB3, + AESSIV, + ChaCha20Poly1305, + ) + + if isinstance(cipher, ChaCha20Poly1305): + return b"chacha20-poly1305" + elif isinstance(cipher, AESCCM): + return f"aes-{len(cipher._key) * 8}-ccm".encode("ascii") + elif isinstance(cipher, AESOCB3): + return f"aes-{len(cipher._key) * 8}-ocb".encode("ascii") + elif isinstance(cipher, AESSIV): + return f"aes-{len(cipher._key) * 8 // 2}-siv".encode("ascii") + else: + assert isinstance(cipher, AESGCM) + return f"aes-{len(cipher._key) * 8}-gcm".encode("ascii") + + +def _evp_cipher(cipher_name: bytes, backend: Backend): + if cipher_name.endswith(b"-siv"): + evp_cipher = backend._lib.EVP_CIPHER_fetch( + backend._ffi.NULL, + cipher_name, + backend._ffi.NULL, + ) + backend.openssl_assert(evp_cipher != backend._ffi.NULL) + evp_cipher = backend._ffi.gc(evp_cipher, backend._lib.EVP_CIPHER_free) + else: + evp_cipher = backend._lib.EVP_get_cipherbyname(cipher_name) + backend.openssl_assert(evp_cipher != backend._ffi.NULL) + + return evp_cipher + + +def _evp_cipher_create_ctx( + backend: Backend, + cipher: _AEADTypes, + key: bytes, +): + ctx = backend._lib.EVP_CIPHER_CTX_new() + backend.openssl_assert(ctx != backend._ffi.NULL) + ctx = backend._ffi.gc(ctx, backend._lib.EVP_CIPHER_CTX_free) + cipher_name = _evp_cipher_cipher_name(cipher) + evp_cipher = _evp_cipher(cipher_name, backend) + key_ptr = backend._ffi.from_buffer(key) + res = backend._lib.EVP_CipherInit_ex( + ctx, + evp_cipher, + backend._ffi.NULL, + key_ptr, + backend._ffi.NULL, + 0, + ) + backend.openssl_assert(res != 0) + return ctx + + +def _evp_cipher_aead_setup( + backend: Backend, + cipher_name: bytes, + key: bytes, + nonce: bytes, + tag: typing.Optional[bytes], + tag_len: int, + operation: int, +): + evp_cipher = _evp_cipher(cipher_name, backend) + ctx = backend._lib.EVP_CIPHER_CTX_new() + ctx = backend._ffi.gc(ctx, backend._lib.EVP_CIPHER_CTX_free) + res = backend._lib.EVP_CipherInit_ex( + ctx, + evp_cipher, + backend._ffi.NULL, + backend._ffi.NULL, + backend._ffi.NULL, + int(operation == _ENCRYPT), + ) + backend.openssl_assert(res != 0) + # CCM requires the IVLEN to be set before calling SET_TAG on decrypt + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + backend._lib.EVP_CTRL_AEAD_SET_IVLEN, + len(nonce), + backend._ffi.NULL, + ) + backend.openssl_assert(res != 0) + if operation == _DECRYPT: + assert tag is not None + _evp_cipher_set_tag(backend, ctx, tag) + elif cipher_name.endswith(b"-ccm"): + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + backend._lib.EVP_CTRL_AEAD_SET_TAG, + tag_len, + backend._ffi.NULL, + ) + backend.openssl_assert(res != 0) + + nonce_ptr = backend._ffi.from_buffer(nonce) + key_ptr = backend._ffi.from_buffer(key) + res = backend._lib.EVP_CipherInit_ex( + ctx, + backend._ffi.NULL, + backend._ffi.NULL, + key_ptr, + nonce_ptr, + int(operation == _ENCRYPT), + ) + backend.openssl_assert(res != 0) + return ctx + + +def _evp_cipher_set_tag(backend, ctx, tag: bytes) -> None: + tag_ptr = backend._ffi.from_buffer(tag) + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag_ptr + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_set_nonce_operation( + backend, ctx, nonce: bytes, operation: int +) -> None: + nonce_ptr = backend._ffi.from_buffer(nonce) + res = backend._lib.EVP_CipherInit_ex( + ctx, + backend._ffi.NULL, + backend._ffi.NULL, + backend._ffi.NULL, + nonce_ptr, + int(operation == _ENCRYPT), + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_set_length(backend: Backend, ctx, data_len: int) -> None: + intptr = backend._ffi.new("int *") + res = backend._lib.EVP_CipherUpdate( + ctx, backend._ffi.NULL, intptr, backend._ffi.NULL, data_len + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_process_aad( + backend: Backend, ctx, associated_data: bytes +) -> None: + outlen = backend._ffi.new("int *") + a_data_ptr = backend._ffi.from_buffer(associated_data) + res = backend._lib.EVP_CipherUpdate( + ctx, backend._ffi.NULL, outlen, a_data_ptr, len(associated_data) + ) + backend.openssl_assert(res != 0) + + +def _evp_cipher_process_data(backend: Backend, ctx, data: bytes) -> bytes: + outlen = backend._ffi.new("int *") + buf = backend._ffi.new("unsigned char[]", len(data)) + data_ptr = backend._ffi.from_buffer(data) + res = backend._lib.EVP_CipherUpdate(ctx, buf, outlen, data_ptr, len(data)) + if res == 0: + # AES SIV can error here if the data is invalid on decrypt + backend._consume_errors() + raise InvalidTag + return backend._ffi.buffer(buf, outlen[0])[:] + + +def _evp_cipher_encrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + from cryptography.hazmat.primitives.ciphers.aead import AESCCM, AESSIV + + if ctx is None: + cipher_name = _evp_cipher_cipher_name(cipher) + ctx = _evp_cipher_aead_setup( + backend, + cipher_name, + cipher._key, + nonce, + None, + tag_length, + _ENCRYPT, + ) + else: + _evp_cipher_set_nonce_operation(backend, ctx, nonce, _ENCRYPT) + + # CCM requires us to pass the length of the data before processing + # anything. + # However calling this with any other AEAD results in an error + if isinstance(cipher, AESCCM): + _evp_cipher_set_length(backend, ctx, len(data)) + + for ad in associated_data: + _evp_cipher_process_aad(backend, ctx, ad) + processed_data = _evp_cipher_process_data(backend, ctx, data) + outlen = backend._ffi.new("int *") + # All AEADs we support besides OCB are streaming so they return nothing + # in finalization. OCB can return up to (16 byte block - 1) bytes so + # we need a buffer here too. + buf = backend._ffi.new("unsigned char[]", 16) + res = backend._lib.EVP_CipherFinal_ex(ctx, buf, outlen) + backend.openssl_assert(res != 0) + processed_data += backend._ffi.buffer(buf, outlen[0])[:] + tag_buf = backend._ffi.new("unsigned char[]", tag_length) + res = backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, backend._lib.EVP_CTRL_AEAD_GET_TAG, tag_length, tag_buf + ) + backend.openssl_assert(res != 0) + tag = backend._ffi.buffer(tag_buf)[:] + + if isinstance(cipher, AESSIV): + # RFC 5297 defines the output as IV || C, where the tag we generate + # is the "IV" and C is the ciphertext. This is the opposite of our + # other AEADs, which are Ciphertext || Tag + backend.openssl_assert(len(tag) == 16) + return tag + processed_data + else: + return processed_data + tag + + +def _evp_cipher_decrypt( + backend: Backend, + cipher: _AEADTypes, + nonce: bytes, + data: bytes, + associated_data: typing.List[bytes], + tag_length: int, + ctx: typing.Any = None, +) -> bytes: + from cryptography.hazmat.primitives.ciphers.aead import AESCCM, AESSIV + + if len(data) < tag_length: + raise InvalidTag + + if isinstance(cipher, AESSIV): + # RFC 5297 defines the output as IV || C, where the tag we generate + # is the "IV" and C is the ciphertext. This is the opposite of our + # other AEADs, which are Ciphertext || Tag + tag = data[:tag_length] + data = data[tag_length:] + else: + tag = data[-tag_length:] + data = data[:-tag_length] + if ctx is None: + cipher_name = _evp_cipher_cipher_name(cipher) + ctx = _evp_cipher_aead_setup( + backend, + cipher_name, + cipher._key, + nonce, + tag, + tag_length, + _DECRYPT, + ) + else: + _evp_cipher_set_nonce_operation(backend, ctx, nonce, _DECRYPT) + _evp_cipher_set_tag(backend, ctx, tag) + + # CCM requires us to pass the length of the data before processing + # anything. + # However calling this with any other AEAD results in an error + if isinstance(cipher, AESCCM): + _evp_cipher_set_length(backend, ctx, len(data)) + + for ad in associated_data: + _evp_cipher_process_aad(backend, ctx, ad) + # CCM has a different error path if the tag doesn't match. Errors are + # raised in Update and Final is irrelevant. + if isinstance(cipher, AESCCM): + outlen = backend._ffi.new("int *") + buf = backend._ffi.new("unsigned char[]", len(data)) + d_ptr = backend._ffi.from_buffer(data) + res = backend._lib.EVP_CipherUpdate(ctx, buf, outlen, d_ptr, len(data)) + if res != 1: + backend._consume_errors() + raise InvalidTag + + processed_data = backend._ffi.buffer(buf, outlen[0])[:] + else: + processed_data = _evp_cipher_process_data(backend, ctx, data) + outlen = backend._ffi.new("int *") + # OCB can return up to 15 bytes (16 byte block - 1) in finalization + buf = backend._ffi.new("unsigned char[]", 16) + res = backend._lib.EVP_CipherFinal_ex(ctx, buf, outlen) + processed_data += backend._ffi.buffer(buf, outlen[0])[:] + if res == 0: + backend._consume_errors() + raise InvalidTag + + return processed_data diff --git a/jwt/python/cryptography/hazmat/backends/openssl/backend.py b/jwt/python/cryptography/hazmat/backends/openssl/backend.py new file mode 100644 index 0000000..02d5109 --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/backend.py @@ -0,0 +1,1935 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import collections +import contextlib +import itertools +import typing +from contextlib import contextmanager + +from cryptography import utils, x509 +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.backends.openssl import aead +from cryptography.hazmat.backends.openssl.ciphers import _CipherContext +from cryptography.hazmat.backends.openssl.cmac import _CMACContext +from cryptography.hazmat.backends.openssl.ec import ( + _EllipticCurvePrivateKey, + _EllipticCurvePublicKey, +) +from cryptography.hazmat.backends.openssl.rsa import ( + _RSAPrivateKey, + _RSAPublicKey, +) +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.bindings.openssl import binding +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives._asymmetric import AsymmetricPadding +from cryptography.hazmat.primitives.asymmetric import ( + dh, + dsa, + ec, + ed448, + ed25519, + rsa, + x448, + x25519, +) +from cryptography.hazmat.primitives.asymmetric.padding import ( + MGF1, + OAEP, + PSS, + PKCS1v15, +) +from cryptography.hazmat.primitives.asymmetric.types import ( + PrivateKeyTypes, + PublicKeyTypes, +) +from cryptography.hazmat.primitives.ciphers import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) +from cryptography.hazmat.primitives.ciphers.algorithms import ( + AES, + AES128, + AES256, + ARC4, + SM4, + Camellia, + ChaCha20, + TripleDES, + _BlowfishInternal, + _CAST5Internal, + _IDEAInternal, + _SEEDInternal, +) +from cryptography.hazmat.primitives.ciphers.modes import ( + CBC, + CFB, + CFB8, + CTR, + ECB, + GCM, + OFB, + XTS, + Mode, +) +from cryptography.hazmat.primitives.serialization import ssh +from cryptography.hazmat.primitives.serialization.pkcs12 import ( + PBES, + PKCS12Certificate, + PKCS12KeyAndCertificates, + PKCS12PrivateKeyTypes, + _PKCS12CATypes, +) + +_MemoryBIO = collections.namedtuple("_MemoryBIO", ["bio", "char_ptr"]) + + +# Not actually supported, just used as a marker for some serialization tests. +class _RC2: + pass + + +class Backend: + """ + OpenSSL API binding interfaces. + """ + + name = "openssl" + + # FIPS has opinions about acceptable algorithms and key sizes, but the + # disallowed algorithms are still present in OpenSSL. They just error if + # you try to use them. To avoid that we allowlist the algorithms in + # FIPS 140-3. This isn't ideal, but FIPS 140-3 is trash so here we are. + _fips_aead = { + b"aes-128-ccm", + b"aes-192-ccm", + b"aes-256-ccm", + b"aes-128-gcm", + b"aes-192-gcm", + b"aes-256-gcm", + } + # TripleDES encryption is disallowed/deprecated throughout 2023 in + # FIPS 140-3. To keep it simple we denylist any use of TripleDES (TDEA). + _fips_ciphers = (AES,) + # Sometimes SHA1 is still permissible. That logic is contained + # within the various *_supported methods. + _fips_hashes = ( + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + hashes.SHA512_224, + hashes.SHA512_256, + hashes.SHA3_224, + hashes.SHA3_256, + hashes.SHA3_384, + hashes.SHA3_512, + hashes.SHAKE128, + hashes.SHAKE256, + ) + _fips_ecdh_curves = ( + ec.SECP224R1, + ec.SECP256R1, + ec.SECP384R1, + ec.SECP521R1, + ) + _fips_rsa_min_key_size = 2048 + _fips_rsa_min_public_exponent = 65537 + _fips_dsa_min_modulus = 1 << 2048 + _fips_dh_min_key_size = 2048 + _fips_dh_min_modulus = 1 << _fips_dh_min_key_size + + def __init__(self) -> None: + self._binding = binding.Binding() + self._ffi = self._binding.ffi + self._lib = self._binding.lib + self._fips_enabled = rust_openssl.is_fips_enabled() + + self._cipher_registry: typing.Dict[ + typing.Tuple[typing.Type[CipherAlgorithm], typing.Type[Mode]], + typing.Callable, + ] = {} + self._register_default_ciphers() + self._dh_types = [self._lib.EVP_PKEY_DH] + if self._lib.Cryptography_HAS_EVP_PKEY_DHX: + self._dh_types.append(self._lib.EVP_PKEY_DHX) + + def __repr__(self) -> str: + return "".format( + self.openssl_version_text(), + self._fips_enabled, + self._binding._legacy_provider_loaded, + ) + + def openssl_assert( + self, + ok: bool, + errors: typing.Optional[typing.List[rust_openssl.OpenSSLError]] = None, + ) -> None: + return binding._openssl_assert(self._lib, ok, errors=errors) + + def _enable_fips(self) -> None: + # This function enables FIPS mode for OpenSSL 3.0.0 on installs that + # have the FIPS provider installed properly. + self._binding._enable_fips() + assert rust_openssl.is_fips_enabled() + self._fips_enabled = rust_openssl.is_fips_enabled() + + def openssl_version_text(self) -> str: + """ + Friendly string name of the loaded OpenSSL library. This is not + necessarily the same version as it was compiled against. + + Example: OpenSSL 1.1.1d 10 Sep 2019 + """ + return self._ffi.string( + self._lib.OpenSSL_version(self._lib.OPENSSL_VERSION) + ).decode("ascii") + + def openssl_version_number(self) -> int: + return self._lib.OpenSSL_version_num() + + def _evp_md_from_algorithm(self, algorithm: hashes.HashAlgorithm): + if algorithm.name == "blake2b" or algorithm.name == "blake2s": + alg = "{}{}".format( + algorithm.name, algorithm.digest_size * 8 + ).encode("ascii") + else: + alg = algorithm.name.encode("ascii") + + evp_md = self._lib.EVP_get_digestbyname(alg) + return evp_md + + def _evp_md_non_null_from_algorithm(self, algorithm: hashes.HashAlgorithm): + evp_md = self._evp_md_from_algorithm(algorithm) + self.openssl_assert(evp_md != self._ffi.NULL) + return evp_md + + def hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + if self._fips_enabled and not isinstance(algorithm, self._fips_hashes): + return False + + evp_md = self._evp_md_from_algorithm(algorithm) + return evp_md != self._ffi.NULL + + def signature_hash_supported( + self, algorithm: hashes.HashAlgorithm + ) -> bool: + # Dedicated check for hashing algorithm use in message digest for + # signatures, e.g. RSA PKCS#1 v1.5 SHA1 (sha1WithRSAEncryption). + if self._fips_enabled and isinstance(algorithm, hashes.SHA1): + return False + return self.hash_supported(algorithm) + + def scrypt_supported(self) -> bool: + if self._fips_enabled: + return False + else: + return self._lib.Cryptography_HAS_SCRYPT == 1 + + def hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + # FIPS mode still allows SHA1 for HMAC + if self._fips_enabled and isinstance(algorithm, hashes.SHA1): + return True + + return self.hash_supported(algorithm) + + def cipher_supported(self, cipher: CipherAlgorithm, mode: Mode) -> bool: + if self._fips_enabled: + # FIPS mode requires AES. TripleDES is disallowed/deprecated in + # FIPS 140-3. + if not isinstance(cipher, self._fips_ciphers): + return False + + try: + adapter = self._cipher_registry[type(cipher), type(mode)] + except KeyError: + return False + evp_cipher = adapter(self, cipher, mode) + return self._ffi.NULL != evp_cipher + + def register_cipher_adapter(self, cipher_cls, mode_cls, adapter) -> None: + if (cipher_cls, mode_cls) in self._cipher_registry: + raise ValueError( + "Duplicate registration for: {} {}.".format( + cipher_cls, mode_cls + ) + ) + self._cipher_registry[cipher_cls, mode_cls] = adapter + + def _register_default_ciphers(self) -> None: + for cipher_cls in [AES, AES128, AES256]: + for mode_cls in [CBC, CTR, ECB, OFB, CFB, CFB8, GCM]: + self.register_cipher_adapter( + cipher_cls, + mode_cls, + GetCipherByName( + "{cipher.name}-{cipher.key_size}-{mode.name}" + ), + ) + for mode_cls in [CBC, CTR, ECB, OFB, CFB]: + self.register_cipher_adapter( + Camellia, + mode_cls, + GetCipherByName("{cipher.name}-{cipher.key_size}-{mode.name}"), + ) + for mode_cls in [CBC, CFB, CFB8, OFB]: + self.register_cipher_adapter( + TripleDES, mode_cls, GetCipherByName("des-ede3-{mode.name}") + ) + self.register_cipher_adapter( + TripleDES, ECB, GetCipherByName("des-ede3") + ) + self.register_cipher_adapter( + ChaCha20, type(None), GetCipherByName("chacha20") + ) + self.register_cipher_adapter(AES, XTS, _get_xts_cipher) + for mode_cls in [ECB, CBC, OFB, CFB, CTR]: + self.register_cipher_adapter( + SM4, mode_cls, GetCipherByName("sm4-{mode.name}") + ) + # Don't register legacy ciphers if they're unavailable. Hypothetically + # this wouldn't be necessary because we test availability by seeing if + # we get an EVP_CIPHER * in the _CipherContext __init__, but OpenSSL 3 + # will return a valid pointer even though the cipher is unavailable. + if ( + self._binding._legacy_provider_loaded + or not self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER + ): + for mode_cls in [CBC, CFB, OFB, ECB]: + self.register_cipher_adapter( + _BlowfishInternal, + mode_cls, + GetCipherByName("bf-{mode.name}"), + ) + for mode_cls in [CBC, CFB, OFB, ECB]: + self.register_cipher_adapter( + _SEEDInternal, + mode_cls, + GetCipherByName("seed-{mode.name}"), + ) + for cipher_cls, mode_cls in itertools.product( + [_CAST5Internal, _IDEAInternal], + [CBC, OFB, CFB, ECB], + ): + self.register_cipher_adapter( + cipher_cls, + mode_cls, + GetCipherByName("{cipher.name}-{mode.name}"), + ) + self.register_cipher_adapter( + ARC4, type(None), GetCipherByName("rc4") + ) + # We don't actually support RC2, this is just used by some tests. + self.register_cipher_adapter( + _RC2, type(None), GetCipherByName("rc2") + ) + + def create_symmetric_encryption_ctx( + self, cipher: CipherAlgorithm, mode: Mode + ) -> _CipherContext: + return _CipherContext(self, cipher, mode, _CipherContext._ENCRYPT) + + def create_symmetric_decryption_ctx( + self, cipher: CipherAlgorithm, mode: Mode + ) -> _CipherContext: + return _CipherContext(self, cipher, mode, _CipherContext._DECRYPT) + + def pbkdf2_hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + return self.hmac_supported(algorithm) + + def _consume_errors(self) -> typing.List[rust_openssl.OpenSSLError]: + return rust_openssl.capture_error_stack() + + def _bn_to_int(self, bn) -> int: + assert bn != self._ffi.NULL + self.openssl_assert(not self._lib.BN_is_negative(bn)) + + bn_num_bytes = self._lib.BN_num_bytes(bn) + bin_ptr = self._ffi.new("unsigned char[]", bn_num_bytes) + bin_len = self._lib.BN_bn2bin(bn, bin_ptr) + # A zero length means the BN has value 0 + self.openssl_assert(bin_len >= 0) + val = int.from_bytes(self._ffi.buffer(bin_ptr)[:bin_len], "big") + return val + + def _int_to_bn(self, num: int): + """ + Converts a python integer to a BIGNUM. The returned BIGNUM will not + be garbage collected (to support adding them to structs that take + ownership of the object). Be sure to register it for GC if it will + be discarded after use. + """ + binary = num.to_bytes(int(num.bit_length() / 8.0 + 1), "big") + bn_ptr = self._lib.BN_bin2bn(binary, len(binary), self._ffi.NULL) + self.openssl_assert(bn_ptr != self._ffi.NULL) + return bn_ptr + + def generate_rsa_private_key( + self, public_exponent: int, key_size: int + ) -> rsa.RSAPrivateKey: + rsa._verify_rsa_parameters(public_exponent, key_size) + + rsa_cdata = self._lib.RSA_new() + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + + bn = self._int_to_bn(public_exponent) + bn = self._ffi.gc(bn, self._lib.BN_free) + + res = self._lib.RSA_generate_key_ex( + rsa_cdata, key_size, bn, self._ffi.NULL + ) + self.openssl_assert(res == 1) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + + # We can skip RSA key validation here since we just generated the key + return _RSAPrivateKey( + self, rsa_cdata, evp_pkey, unsafe_skip_rsa_key_validation=True + ) + + def generate_rsa_parameters_supported( + self, public_exponent: int, key_size: int + ) -> bool: + return ( + public_exponent >= 3 + and public_exponent & 1 != 0 + and key_size >= 512 + ) + + def load_rsa_private_numbers( + self, + numbers: rsa.RSAPrivateNumbers, + unsafe_skip_rsa_key_validation: bool, + ) -> rsa.RSAPrivateKey: + rsa._check_private_key_components( + numbers.p, + numbers.q, + numbers.d, + numbers.dmp1, + numbers.dmq1, + numbers.iqmp, + numbers.public_numbers.e, + numbers.public_numbers.n, + ) + rsa_cdata = self._lib.RSA_new() + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + p = self._int_to_bn(numbers.p) + q = self._int_to_bn(numbers.q) + d = self._int_to_bn(numbers.d) + dmp1 = self._int_to_bn(numbers.dmp1) + dmq1 = self._int_to_bn(numbers.dmq1) + iqmp = self._int_to_bn(numbers.iqmp) + e = self._int_to_bn(numbers.public_numbers.e) + n = self._int_to_bn(numbers.public_numbers.n) + res = self._lib.RSA_set0_factors(rsa_cdata, p, q) + self.openssl_assert(res == 1) + res = self._lib.RSA_set0_key(rsa_cdata, n, e, d) + self.openssl_assert(res == 1) + res = self._lib.RSA_set0_crt_params(rsa_cdata, dmp1, dmq1, iqmp) + self.openssl_assert(res == 1) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + + return _RSAPrivateKey( + self, + rsa_cdata, + evp_pkey, + unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation, + ) + + def load_rsa_public_numbers( + self, numbers: rsa.RSAPublicNumbers + ) -> rsa.RSAPublicKey: + rsa._check_public_key_components(numbers.e, numbers.n) + rsa_cdata = self._lib.RSA_new() + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + e = self._int_to_bn(numbers.e) + n = self._int_to_bn(numbers.n) + res = self._lib.RSA_set0_key(rsa_cdata, n, e, self._ffi.NULL) + self.openssl_assert(res == 1) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + + def _create_evp_pkey_gc(self): + evp_pkey = self._lib.EVP_PKEY_new() + self.openssl_assert(evp_pkey != self._ffi.NULL) + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + return evp_pkey + + def _rsa_cdata_to_evp_pkey(self, rsa_cdata): + evp_pkey = self._create_evp_pkey_gc() + res = self._lib.EVP_PKEY_set1_RSA(evp_pkey, rsa_cdata) + self.openssl_assert(res == 1) + return evp_pkey + + def _bytes_to_bio(self, data: bytes) -> _MemoryBIO: + """ + Return a _MemoryBIO namedtuple of (BIO, char*). + + The char* is the storage for the BIO and it must stay alive until the + BIO is finished with. + """ + data_ptr = self._ffi.from_buffer(data) + bio = self._lib.BIO_new_mem_buf(data_ptr, len(data)) + self.openssl_assert(bio != self._ffi.NULL) + + return _MemoryBIO(self._ffi.gc(bio, self._lib.BIO_free), data_ptr) + + def _create_mem_bio_gc(self): + """ + Creates an empty memory BIO. + """ + bio_method = self._lib.BIO_s_mem() + self.openssl_assert(bio_method != self._ffi.NULL) + bio = self._lib.BIO_new(bio_method) + self.openssl_assert(bio != self._ffi.NULL) + bio = self._ffi.gc(bio, self._lib.BIO_free) + return bio + + def _read_mem_bio(self, bio) -> bytes: + """ + Reads a memory BIO. This only works on memory BIOs. + """ + buf = self._ffi.new("char **") + buf_len = self._lib.BIO_get_mem_data(bio, buf) + self.openssl_assert(buf_len > 0) + self.openssl_assert(buf[0] != self._ffi.NULL) + bio_data = self._ffi.buffer(buf[0], buf_len)[:] + return bio_data + + def _evp_pkey_to_private_key( + self, evp_pkey, unsafe_skip_rsa_key_validation: bool + ) -> PrivateKeyTypes: + """ + Return the appropriate type of PrivateKey given an evp_pkey cdata + pointer. + """ + + key_type = self._lib.EVP_PKEY_id(evp_pkey) + + if key_type == self._lib.EVP_PKEY_RSA: + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + return _RSAPrivateKey( + self, + rsa_cdata, + evp_pkey, + unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation, + ) + elif ( + key_type == self._lib.EVP_PKEY_RSA_PSS + and not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + and not self._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E + ): + # At the moment the way we handle RSA PSS keys is to strip the + # PSS constraints from them and treat them as normal RSA keys + # Unfortunately the RSA * itself tracks this data so we need to + # extract, serialize, and reload it without the constraints. + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + bio = self._create_mem_bio_gc() + res = self._lib.i2d_RSAPrivateKey_bio(bio, rsa_cdata) + self.openssl_assert(res == 1) + return self.load_der_private_key( + self._read_mem_bio(bio), + password=None, + unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation, + ) + elif key_type == self._lib.EVP_PKEY_DSA: + return rust_openssl.dsa.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_EC: + ec_cdata = self._lib.EVP_PKEY_get1_EC_KEY(evp_pkey) + self.openssl_assert(ec_cdata != self._ffi.NULL) + ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free) + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + elif key_type in self._dh_types: + return rust_openssl.dh.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED25519", None): + # EVP_PKEY_ED25519 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed25519.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_X448", None): + # EVP_PKEY_X448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.x448.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_X25519: + return rust_openssl.x25519.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED448", None): + # EVP_PKEY_ED448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed448.private_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + else: + raise UnsupportedAlgorithm("Unsupported key type.") + + def _evp_pkey_to_public_key(self, evp_pkey) -> PublicKeyTypes: + """ + Return the appropriate type of PublicKey given an evp_pkey cdata + pointer. + """ + + key_type = self._lib.EVP_PKEY_id(evp_pkey) + + if key_type == self._lib.EVP_PKEY_RSA: + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + elif ( + key_type == self._lib.EVP_PKEY_RSA_PSS + and not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + and not self._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E + ): + rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey) + self.openssl_assert(rsa_cdata != self._ffi.NULL) + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + bio = self._create_mem_bio_gc() + res = self._lib.i2d_RSAPublicKey_bio(bio, rsa_cdata) + self.openssl_assert(res == 1) + return self.load_der_public_key(self._read_mem_bio(bio)) + elif key_type == self._lib.EVP_PKEY_DSA: + return rust_openssl.dsa.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_EC: + ec_cdata = self._lib.EVP_PKEY_get1_EC_KEY(evp_pkey) + if ec_cdata == self._ffi.NULL: + errors = self._consume_errors() + raise ValueError("Unable to load EC key", errors) + ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free) + return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey) + elif key_type in self._dh_types: + return rust_openssl.dh.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED25519", None): + # EVP_PKEY_ED25519 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed25519.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_X448", None): + # EVP_PKEY_X448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.x448.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == self._lib.EVP_PKEY_X25519: + return rust_openssl.x25519.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + elif key_type == getattr(self._lib, "EVP_PKEY_ED448", None): + # EVP_PKEY_ED448 is not present in CRYPTOGRAPHY_IS_LIBRESSL + return rust_openssl.ed448.public_key_from_ptr( + int(self._ffi.cast("uintptr_t", evp_pkey)) + ) + else: + raise UnsupportedAlgorithm("Unsupported key type.") + + def _oaep_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + if self._fips_enabled and isinstance(algorithm, hashes.SHA1): + return False + + return isinstance( + algorithm, + ( + hashes.SHA1, + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + ), + ) + + def rsa_padding_supported(self, padding: AsymmetricPadding) -> bool: + if isinstance(padding, PKCS1v15): + return True + elif isinstance(padding, PSS) and isinstance(padding._mgf, MGF1): + # SHA1 is permissible in MGF1 in FIPS even when SHA1 is blocked + # as signature algorithm. + if self._fips_enabled and isinstance( + padding._mgf._algorithm, hashes.SHA1 + ): + return True + else: + return self.hash_supported(padding._mgf._algorithm) + elif isinstance(padding, OAEP) and isinstance(padding._mgf, MGF1): + return self._oaep_hash_supported( + padding._mgf._algorithm + ) and self._oaep_hash_supported(padding._algorithm) + else: + return False + + def rsa_encryption_supported(self, padding: AsymmetricPadding) -> bool: + if self._fips_enabled and isinstance(padding, PKCS1v15): + return False + else: + return self.rsa_padding_supported(padding) + + def generate_dsa_parameters(self, key_size: int) -> dsa.DSAParameters: + if key_size not in (1024, 2048, 3072, 4096): + raise ValueError( + "Key size must be 1024, 2048, 3072, or 4096 bits." + ) + + return rust_openssl.dsa.generate_parameters(key_size) + + def generate_dsa_private_key( + self, parameters: dsa.DSAParameters + ) -> dsa.DSAPrivateKey: + return parameters.generate_private_key() + + def generate_dsa_private_key_and_parameters( + self, key_size: int + ) -> dsa.DSAPrivateKey: + parameters = self.generate_dsa_parameters(key_size) + return self.generate_dsa_private_key(parameters) + + def load_dsa_private_numbers( + self, numbers: dsa.DSAPrivateNumbers + ) -> dsa.DSAPrivateKey: + dsa._check_dsa_private_numbers(numbers) + return rust_openssl.dsa.from_private_numbers(numbers) + + def load_dsa_public_numbers( + self, numbers: dsa.DSAPublicNumbers + ) -> dsa.DSAPublicKey: + dsa._check_dsa_parameters(numbers.parameter_numbers) + return rust_openssl.dsa.from_public_numbers(numbers) + + def load_dsa_parameter_numbers( + self, numbers: dsa.DSAParameterNumbers + ) -> dsa.DSAParameters: + dsa._check_dsa_parameters(numbers) + return rust_openssl.dsa.from_parameter_numbers(numbers) + + def dsa_supported(self) -> bool: + return ( + not self._lib.CRYPTOGRAPHY_IS_BORINGSSL and not self._fips_enabled + ) + + def dsa_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool: + if not self.dsa_supported(): + return False + return self.signature_hash_supported(algorithm) + + def cmac_algorithm_supported(self, algorithm) -> bool: + return self.cipher_supported( + algorithm, CBC(b"\x00" * algorithm.block_size) + ) + + def create_cmac_ctx(self, algorithm: BlockCipherAlgorithm) -> _CMACContext: + return _CMACContext(self, algorithm) + + def load_pem_private_key( + self, + data: bytes, + password: typing.Optional[bytes], + unsafe_skip_rsa_key_validation: bool, + ) -> PrivateKeyTypes: + return self._load_key( + self._lib.PEM_read_bio_PrivateKey, + data, + password, + unsafe_skip_rsa_key_validation, + ) + + def load_pem_public_key(self, data: bytes) -> PublicKeyTypes: + mem_bio = self._bytes_to_bio(data) + # In OpenSSL 3.0.x the PEM_read_bio_PUBKEY function will invoke + # the default password callback if you pass an encrypted private + # key. This is very, very, very bad as the default callback can + # trigger an interactive console prompt, which will hang the + # Python process. We therefore provide our own callback to + # catch this and error out properly. + userdata = self._ffi.new("CRYPTOGRAPHY_PASSWORD_DATA *") + evp_pkey = self._lib.PEM_read_bio_PUBKEY( + mem_bio.bio, + self._ffi.NULL, + self._ffi.addressof( + self._lib._original_lib, "Cryptography_pem_password_cb" + ), + userdata, + ) + if evp_pkey != self._ffi.NULL: + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + return self._evp_pkey_to_public_key(evp_pkey) + else: + # It's not a (RSA/DSA/ECDSA) subjectPublicKeyInfo, but we still + # need to check to see if it is a pure PKCS1 RSA public key (not + # embedded in a subjectPublicKeyInfo) + self._consume_errors() + res = self._lib.BIO_reset(mem_bio.bio) + self.openssl_assert(res == 1) + rsa_cdata = self._lib.PEM_read_bio_RSAPublicKey( + mem_bio.bio, + self._ffi.NULL, + self._ffi.addressof( + self._lib._original_lib, "Cryptography_pem_password_cb" + ), + userdata, + ) + if rsa_cdata != self._ffi.NULL: + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + else: + self._handle_key_loading_error() + + def load_pem_parameters(self, data: bytes) -> dh.DHParameters: + return rust_openssl.dh.from_pem_parameters(data) + + def load_der_private_key( + self, + data: bytes, + password: typing.Optional[bytes], + unsafe_skip_rsa_key_validation: bool, + ) -> PrivateKeyTypes: + # OpenSSL has a function called d2i_AutoPrivateKey that in theory + # handles this automatically, however it doesn't handle encrypted + # private keys. Instead we try to load the key two different ways. + # First we'll try to load it as a traditional key. + bio_data = self._bytes_to_bio(data) + key = self._evp_pkey_from_der_traditional_key(bio_data, password) + if key: + return self._evp_pkey_to_private_key( + key, unsafe_skip_rsa_key_validation + ) + else: + # Finally we try to load it with the method that handles encrypted + # PKCS8 properly. + return self._load_key( + self._lib.d2i_PKCS8PrivateKey_bio, + data, + password, + unsafe_skip_rsa_key_validation, + ) + + def _evp_pkey_from_der_traditional_key(self, bio_data, password): + key = self._lib.d2i_PrivateKey_bio(bio_data.bio, self._ffi.NULL) + if key != self._ffi.NULL: + key = self._ffi.gc(key, self._lib.EVP_PKEY_free) + if password is not None: + raise TypeError( + "Password was given but private key is not encrypted." + ) + + return key + else: + self._consume_errors() + return None + + def load_der_public_key(self, data: bytes) -> PublicKeyTypes: + mem_bio = self._bytes_to_bio(data) + evp_pkey = self._lib.d2i_PUBKEY_bio(mem_bio.bio, self._ffi.NULL) + if evp_pkey != self._ffi.NULL: + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + return self._evp_pkey_to_public_key(evp_pkey) + else: + # It's not a (RSA/DSA/ECDSA) subjectPublicKeyInfo, but we still + # need to check to see if it is a pure PKCS1 RSA public key (not + # embedded in a subjectPublicKeyInfo) + self._consume_errors() + res = self._lib.BIO_reset(mem_bio.bio) + self.openssl_assert(res == 1) + rsa_cdata = self._lib.d2i_RSAPublicKey_bio( + mem_bio.bio, self._ffi.NULL + ) + if rsa_cdata != self._ffi.NULL: + rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free) + evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata) + return _RSAPublicKey(self, rsa_cdata, evp_pkey) + else: + self._handle_key_loading_error() + + def load_der_parameters(self, data: bytes) -> dh.DHParameters: + return rust_openssl.dh.from_der_parameters(data) + + def _cert2ossl(self, cert: x509.Certificate) -> typing.Any: + data = cert.public_bytes(serialization.Encoding.DER) + mem_bio = self._bytes_to_bio(data) + x509 = self._lib.d2i_X509_bio(mem_bio.bio, self._ffi.NULL) + self.openssl_assert(x509 != self._ffi.NULL) + x509 = self._ffi.gc(x509, self._lib.X509_free) + return x509 + + def _ossl2cert(self, x509_ptr: typing.Any) -> x509.Certificate: + bio = self._create_mem_bio_gc() + res = self._lib.i2d_X509_bio(bio, x509_ptr) + self.openssl_assert(res == 1) + return x509.load_der_x509_certificate(self._read_mem_bio(bio)) + + def _key2ossl(self, key: PKCS12PrivateKeyTypes) -> typing.Any: + data = key.private_bytes( + serialization.Encoding.DER, + serialization.PrivateFormat.PKCS8, + serialization.NoEncryption(), + ) + mem_bio = self._bytes_to_bio(data) + + evp_pkey = self._lib.d2i_PrivateKey_bio( + mem_bio.bio, + self._ffi.NULL, + ) + self.openssl_assert(evp_pkey != self._ffi.NULL) + return self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + + def _load_key( + self, openssl_read_func, data, password, unsafe_skip_rsa_key_validation + ) -> PrivateKeyTypes: + mem_bio = self._bytes_to_bio(data) + + userdata = self._ffi.new("CRYPTOGRAPHY_PASSWORD_DATA *") + if password is not None: + utils._check_byteslike("password", password) + password_ptr = self._ffi.from_buffer(password) + userdata.password = password_ptr + userdata.length = len(password) + + evp_pkey = openssl_read_func( + mem_bio.bio, + self._ffi.NULL, + self._ffi.addressof( + self._lib._original_lib, "Cryptography_pem_password_cb" + ), + userdata, + ) + + if evp_pkey == self._ffi.NULL: + if userdata.error != 0: + self._consume_errors() + if userdata.error == -1: + raise TypeError( + "Password was not given but private key is encrypted" + ) + else: + assert userdata.error == -2 + raise ValueError( + "Passwords longer than {} bytes are not supported " + "by this backend.".format(userdata.maxsize - 1) + ) + else: + self._handle_key_loading_error() + + evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free) + + if password is not None and userdata.called == 0: + raise TypeError( + "Password was given but private key is not encrypted." + ) + + assert ( + password is not None and userdata.called == 1 + ) or password is None + + return self._evp_pkey_to_private_key( + evp_pkey, unsafe_skip_rsa_key_validation + ) + + def _handle_key_loading_error(self) -> typing.NoReturn: + errors = self._consume_errors() + + if not errors: + raise ValueError( + "Could not deserialize key data. The data may be in an " + "incorrect format or it may be encrypted with an unsupported " + "algorithm." + ) + + elif ( + errors[0]._lib_reason_match( + self._lib.ERR_LIB_EVP, self._lib.EVP_R_BAD_DECRYPT + ) + or errors[0]._lib_reason_match( + self._lib.ERR_LIB_PKCS12, + self._lib.PKCS12_R_PKCS12_CIPHERFINAL_ERROR, + ) + or ( + self._lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + self._lib.ERR_LIB_PROV, + self._lib.PROV_R_BAD_DECRYPT, + ) + ) + ): + raise ValueError("Bad decrypt. Incorrect password?") + + elif any( + error._lib_reason_match( + self._lib.ERR_LIB_EVP, + self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM, + ) + for error in errors + ): + raise ValueError("Unsupported public key algorithm.") + + else: + raise ValueError( + "Could not deserialize key data. The data may be in an " + "incorrect format, it may be encrypted with an unsupported " + "algorithm, or it may be an unsupported key type (e.g. EC " + "curves with explicit parameters).", + errors, + ) + + def elliptic_curve_supported(self, curve: ec.EllipticCurve) -> bool: + try: + curve_nid = self._elliptic_curve_to_nid(curve) + except UnsupportedAlgorithm: + curve_nid = self._lib.NID_undef + + group = self._lib.EC_GROUP_new_by_curve_name(curve_nid) + + if group == self._ffi.NULL: + self._consume_errors() + return False + else: + self.openssl_assert(curve_nid != self._lib.NID_undef) + self._lib.EC_GROUP_free(group) + return True + + def elliptic_curve_signature_algorithm_supported( + self, + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, + curve: ec.EllipticCurve, + ) -> bool: + # We only support ECDSA right now. + if not isinstance(signature_algorithm, ec.ECDSA): + return False + + return self.elliptic_curve_supported(curve) + + def generate_elliptic_curve_private_key( + self, curve: ec.EllipticCurve + ) -> ec.EllipticCurvePrivateKey: + """ + Generate a new private key on the named curve. + """ + + if self.elliptic_curve_supported(curve): + ec_cdata = self._ec_key_new_by_curve(curve) + + res = self._lib.EC_KEY_generate_key(ec_cdata) + self.openssl_assert(res == 1) + + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + else: + raise UnsupportedAlgorithm( + f"Backend object does not support {curve.name}.", + _Reasons.UNSUPPORTED_ELLIPTIC_CURVE, + ) + + def load_elliptic_curve_private_numbers( + self, numbers: ec.EllipticCurvePrivateNumbers + ) -> ec.EllipticCurvePrivateKey: + public = numbers.public_numbers + + ec_cdata = self._ec_key_new_by_curve(public.curve) + + private_value = self._ffi.gc( + self._int_to_bn(numbers.private_value), self._lib.BN_clear_free + ) + res = self._lib.EC_KEY_set_private_key(ec_cdata, private_value) + if res != 1: + self._consume_errors() + raise ValueError("Invalid EC key.") + + with self._tmp_bn_ctx() as bn_ctx: + self._ec_key_set_public_key_affine_coordinates( + ec_cdata, public.x, public.y, bn_ctx + ) + # derive the expected public point and compare it to the one we + # just set based on the values we were given. If they don't match + # this isn't a valid key pair. + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + set_point = backend._lib.EC_KEY_get0_public_key(ec_cdata) + self.openssl_assert(set_point != self._ffi.NULL) + computed_point = self._lib.EC_POINT_new(group) + self.openssl_assert(computed_point != self._ffi.NULL) + computed_point = self._ffi.gc( + computed_point, self._lib.EC_POINT_free + ) + res = self._lib.EC_POINT_mul( + group, + computed_point, + private_value, + self._ffi.NULL, + self._ffi.NULL, + bn_ctx, + ) + self.openssl_assert(res == 1) + if ( + self._lib.EC_POINT_cmp( + group, set_point, computed_point, bn_ctx + ) + != 0 + ): + raise ValueError("Invalid EC key.") + + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + + def load_elliptic_curve_public_numbers( + self, numbers: ec.EllipticCurvePublicNumbers + ) -> ec.EllipticCurvePublicKey: + ec_cdata = self._ec_key_new_by_curve(numbers.curve) + with self._tmp_bn_ctx() as bn_ctx: + self._ec_key_set_public_key_affine_coordinates( + ec_cdata, numbers.x, numbers.y, bn_ctx + ) + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey) + + def load_elliptic_curve_public_bytes( + self, curve: ec.EllipticCurve, point_bytes: bytes + ) -> ec.EllipticCurvePublicKey: + ec_cdata = self._ec_key_new_by_curve(curve) + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + point = self._lib.EC_POINT_new(group) + self.openssl_assert(point != self._ffi.NULL) + point = self._ffi.gc(point, self._lib.EC_POINT_free) + with self._tmp_bn_ctx() as bn_ctx: + res = self._lib.EC_POINT_oct2point( + group, point, point_bytes, len(point_bytes), bn_ctx + ) + if res != 1: + self._consume_errors() + raise ValueError("Invalid public bytes for the given curve") + + res = self._lib.EC_KEY_set_public_key(ec_cdata, point) + self.openssl_assert(res == 1) + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey) + + def derive_elliptic_curve_private_key( + self, private_value: int, curve: ec.EllipticCurve + ) -> ec.EllipticCurvePrivateKey: + ec_cdata = self._ec_key_new_by_curve(curve) + + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + + point = self._lib.EC_POINT_new(group) + self.openssl_assert(point != self._ffi.NULL) + point = self._ffi.gc(point, self._lib.EC_POINT_free) + + value = self._int_to_bn(private_value) + value = self._ffi.gc(value, self._lib.BN_clear_free) + + with self._tmp_bn_ctx() as bn_ctx: + res = self._lib.EC_POINT_mul( + group, point, value, self._ffi.NULL, self._ffi.NULL, bn_ctx + ) + self.openssl_assert(res == 1) + + bn_x = self._lib.BN_CTX_get(bn_ctx) + bn_y = self._lib.BN_CTX_get(bn_ctx) + + res = self._lib.EC_POINT_get_affine_coordinates( + group, point, bn_x, bn_y, bn_ctx + ) + if res != 1: + self._consume_errors() + raise ValueError("Unable to derive key from private_value") + + res = self._lib.EC_KEY_set_public_key(ec_cdata, point) + self.openssl_assert(res == 1) + private = self._int_to_bn(private_value) + private = self._ffi.gc(private, self._lib.BN_clear_free) + res = self._lib.EC_KEY_set_private_key(ec_cdata, private) + self.openssl_assert(res == 1) + + evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata) + + return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey) + + def _ec_key_new_by_curve(self, curve: ec.EllipticCurve): + curve_nid = self._elliptic_curve_to_nid(curve) + return self._ec_key_new_by_curve_nid(curve_nid) + + def _ec_key_new_by_curve_nid(self, curve_nid: int): + ec_cdata = self._lib.EC_KEY_new_by_curve_name(curve_nid) + self.openssl_assert(ec_cdata != self._ffi.NULL) + return self._ffi.gc(ec_cdata, self._lib.EC_KEY_free) + + def elliptic_curve_exchange_algorithm_supported( + self, algorithm: ec.ECDH, curve: ec.EllipticCurve + ) -> bool: + if self._fips_enabled and not isinstance( + curve, self._fips_ecdh_curves + ): + return False + + return self.elliptic_curve_supported(curve) and isinstance( + algorithm, ec.ECDH + ) + + def _ec_cdata_to_evp_pkey(self, ec_cdata): + evp_pkey = self._create_evp_pkey_gc() + res = self._lib.EVP_PKEY_set1_EC_KEY(evp_pkey, ec_cdata) + self.openssl_assert(res == 1) + return evp_pkey + + def _elliptic_curve_to_nid(self, curve: ec.EllipticCurve) -> int: + """ + Get the NID for a curve name. + """ + + curve_aliases = {"secp192r1": "prime192v1", "secp256r1": "prime256v1"} + + curve_name = curve_aliases.get(curve.name, curve.name) + + curve_nid = self._lib.OBJ_sn2nid(curve_name.encode()) + if curve_nid == self._lib.NID_undef: + raise UnsupportedAlgorithm( + f"{curve.name} is not a supported elliptic curve", + _Reasons.UNSUPPORTED_ELLIPTIC_CURVE, + ) + return curve_nid + + @contextmanager + def _tmp_bn_ctx(self): + bn_ctx = self._lib.BN_CTX_new() + self.openssl_assert(bn_ctx != self._ffi.NULL) + bn_ctx = self._ffi.gc(bn_ctx, self._lib.BN_CTX_free) + self._lib.BN_CTX_start(bn_ctx) + try: + yield bn_ctx + finally: + self._lib.BN_CTX_end(bn_ctx) + + def _ec_key_set_public_key_affine_coordinates( + self, + ec_cdata, + x: int, + y: int, + bn_ctx, + ) -> None: + """ + Sets the public key point in the EC_KEY context to the affine x and y + values. + """ + + if x < 0 or y < 0: + raise ValueError( + "Invalid EC key. Both x and y must be non-negative." + ) + + x = self._ffi.gc(self._int_to_bn(x), self._lib.BN_free) + y = self._ffi.gc(self._int_to_bn(y), self._lib.BN_free) + group = self._lib.EC_KEY_get0_group(ec_cdata) + self.openssl_assert(group != self._ffi.NULL) + point = self._lib.EC_POINT_new(group) + self.openssl_assert(point != self._ffi.NULL) + point = self._ffi.gc(point, self._lib.EC_POINT_free) + res = self._lib.EC_POINT_set_affine_coordinates( + group, point, x, y, bn_ctx + ) + if res != 1: + self._consume_errors() + raise ValueError("Invalid EC key.") + res = self._lib.EC_KEY_set_public_key(ec_cdata, point) + self.openssl_assert(res == 1) + + def _private_key_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PrivateFormat, + encryption_algorithm: serialization.KeySerializationEncryption, + key, + evp_pkey, + cdata, + ) -> bytes: + # validate argument types + if not isinstance(encoding, serialization.Encoding): + raise TypeError("encoding must be an item from the Encoding enum") + if not isinstance(format, serialization.PrivateFormat): + raise TypeError( + "format must be an item from the PrivateFormat enum" + ) + if not isinstance( + encryption_algorithm, serialization.KeySerializationEncryption + ): + raise TypeError( + "Encryption algorithm must be a KeySerializationEncryption " + "instance" + ) + + # validate password + if isinstance(encryption_algorithm, serialization.NoEncryption): + password = b"" + elif isinstance( + encryption_algorithm, serialization.BestAvailableEncryption + ): + password = encryption_algorithm.password + if len(password) > 1023: + raise ValueError( + "Passwords longer than 1023 bytes are not supported by " + "this backend" + ) + elif ( + isinstance( + encryption_algorithm, serialization._KeySerializationEncryption + ) + and encryption_algorithm._format + is format + is serialization.PrivateFormat.OpenSSH + ): + password = encryption_algorithm.password + else: + raise ValueError("Unsupported encryption type") + + # PKCS8 + PEM/DER + if format is serialization.PrivateFormat.PKCS8: + if encoding is serialization.Encoding.PEM: + write_bio = self._lib.PEM_write_bio_PKCS8PrivateKey + elif encoding is serialization.Encoding.DER: + write_bio = self._lib.i2d_PKCS8PrivateKey_bio + else: + raise ValueError("Unsupported encoding for PKCS8") + return self._private_key_bytes_via_bio( + write_bio, evp_pkey, password + ) + + # TraditionalOpenSSL + PEM/DER + if format is serialization.PrivateFormat.TraditionalOpenSSL: + if self._fips_enabled and not isinstance( + encryption_algorithm, serialization.NoEncryption + ): + raise ValueError( + "Encrypted traditional OpenSSL format is not " + "supported in FIPS mode." + ) + key_type = self._lib.EVP_PKEY_id(evp_pkey) + + if encoding is serialization.Encoding.PEM: + if key_type == self._lib.EVP_PKEY_RSA: + write_bio = self._lib.PEM_write_bio_RSAPrivateKey + else: + assert key_type == self._lib.EVP_PKEY_EC + write_bio = self._lib.PEM_write_bio_ECPrivateKey + return self._private_key_bytes_via_bio( + write_bio, cdata, password + ) + + if encoding is serialization.Encoding.DER: + if password: + raise ValueError( + "Encryption is not supported for DER encoded " + "traditional OpenSSL keys" + ) + if key_type == self._lib.EVP_PKEY_RSA: + write_bio = self._lib.i2d_RSAPrivateKey_bio + else: + assert key_type == self._lib.EVP_PKEY_EC + write_bio = self._lib.i2d_ECPrivateKey_bio + return self._bio_func_output(write_bio, cdata) + + raise ValueError("Unsupported encoding for TraditionalOpenSSL") + + # OpenSSH + PEM + if format is serialization.PrivateFormat.OpenSSH: + if encoding is serialization.Encoding.PEM: + return ssh._serialize_ssh_private_key( + key, password, encryption_algorithm + ) + + raise ValueError( + "OpenSSH private key format can only be used" + " with PEM encoding" + ) + + # Anything that key-specific code was supposed to handle earlier, + # like Raw. + raise ValueError("format is invalid with this key") + + def _private_key_bytes_via_bio( + self, write_bio, evp_pkey, password + ) -> bytes: + if not password: + evp_cipher = self._ffi.NULL + else: + # This is a curated value that we will update over time. + evp_cipher = self._lib.EVP_get_cipherbyname(b"aes-256-cbc") + + return self._bio_func_output( + write_bio, + evp_pkey, + evp_cipher, + password, + len(password), + self._ffi.NULL, + self._ffi.NULL, + ) + + def _bio_func_output(self, write_bio, *args) -> bytes: + bio = self._create_mem_bio_gc() + res = write_bio(bio, *args) + self.openssl_assert(res == 1) + return self._read_mem_bio(bio) + + def _public_key_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PublicFormat, + key, + evp_pkey, + cdata, + ) -> bytes: + if not isinstance(encoding, serialization.Encoding): + raise TypeError("encoding must be an item from the Encoding enum") + if not isinstance(format, serialization.PublicFormat): + raise TypeError( + "format must be an item from the PublicFormat enum" + ) + + # SubjectPublicKeyInfo + PEM/DER + if format is serialization.PublicFormat.SubjectPublicKeyInfo: + if encoding is serialization.Encoding.PEM: + write_bio = self._lib.PEM_write_bio_PUBKEY + elif encoding is serialization.Encoding.DER: + write_bio = self._lib.i2d_PUBKEY_bio + else: + raise ValueError( + "SubjectPublicKeyInfo works only with PEM or DER encoding" + ) + return self._bio_func_output(write_bio, evp_pkey) + + # PKCS1 + PEM/DER + if format is serialization.PublicFormat.PKCS1: + # Only RSA is supported here. + key_type = self._lib.EVP_PKEY_id(evp_pkey) + if key_type != self._lib.EVP_PKEY_RSA: + raise ValueError("PKCS1 format is supported only for RSA keys") + + if encoding is serialization.Encoding.PEM: + write_bio = self._lib.PEM_write_bio_RSAPublicKey + elif encoding is serialization.Encoding.DER: + write_bio = self._lib.i2d_RSAPublicKey_bio + else: + raise ValueError("PKCS1 works only with PEM or DER encoding") + return self._bio_func_output(write_bio, cdata) + + # OpenSSH + OpenSSH + if format is serialization.PublicFormat.OpenSSH: + if encoding is serialization.Encoding.OpenSSH: + return ssh.serialize_ssh_public_key(key) + + raise ValueError( + "OpenSSH format must be used with OpenSSH encoding" + ) + + # Anything that key-specific code was supposed to handle earlier, + # like Raw, CompressedPoint, UncompressedPoint + raise ValueError("format is invalid with this key") + + def dh_supported(self) -> bool: + return not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + + def generate_dh_parameters( + self, generator: int, key_size: int + ) -> dh.DHParameters: + return rust_openssl.dh.generate_parameters(generator, key_size) + + def generate_dh_private_key( + self, parameters: dh.DHParameters + ) -> dh.DHPrivateKey: + return parameters.generate_private_key() + + def generate_dh_private_key_and_parameters( + self, generator: int, key_size: int + ) -> dh.DHPrivateKey: + return self.generate_dh_private_key( + self.generate_dh_parameters(generator, key_size) + ) + + def load_dh_private_numbers( + self, numbers: dh.DHPrivateNumbers + ) -> dh.DHPrivateKey: + return rust_openssl.dh.from_private_numbers(numbers) + + def load_dh_public_numbers( + self, numbers: dh.DHPublicNumbers + ) -> dh.DHPublicKey: + return rust_openssl.dh.from_public_numbers(numbers) + + def load_dh_parameter_numbers( + self, numbers: dh.DHParameterNumbers + ) -> dh.DHParameters: + return rust_openssl.dh.from_parameter_numbers(numbers) + + def dh_parameters_supported( + self, p: int, g: int, q: typing.Optional[int] = None + ) -> bool: + try: + rust_openssl.dh.from_parameter_numbers( + dh.DHParameterNumbers(p=p, g=g, q=q) + ) + except ValueError: + return False + else: + return True + + def dh_x942_serialization_supported(self) -> bool: + return self._lib.Cryptography_HAS_EVP_PKEY_DHX == 1 + + def x25519_load_public_bytes(self, data: bytes) -> x25519.X25519PublicKey: + return rust_openssl.x25519.from_public_bytes(data) + + def x25519_load_private_bytes( + self, data: bytes + ) -> x25519.X25519PrivateKey: + return rust_openssl.x25519.from_private_bytes(data) + + def x25519_generate_key(self) -> x25519.X25519PrivateKey: + return rust_openssl.x25519.generate_key() + + def x25519_supported(self) -> bool: + if self._fips_enabled: + return False + return not self._lib.CRYPTOGRAPHY_LIBRESSL_LESS_THAN_370 + + def x448_load_public_bytes(self, data: bytes) -> x448.X448PublicKey: + return rust_openssl.x448.from_public_bytes(data) + + def x448_load_private_bytes(self, data: bytes) -> x448.X448PrivateKey: + return rust_openssl.x448.from_private_bytes(data) + + def x448_generate_key(self) -> x448.X448PrivateKey: + return rust_openssl.x448.generate_key() + + def x448_supported(self) -> bool: + if self._fips_enabled: + return False + return ( + not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + ) + + def ed25519_supported(self) -> bool: + if self._fips_enabled: + return False + return self._lib.CRYPTOGRAPHY_HAS_WORKING_ED25519 + + def ed25519_load_public_bytes( + self, data: bytes + ) -> ed25519.Ed25519PublicKey: + return rust_openssl.ed25519.from_public_bytes(data) + + def ed25519_load_private_bytes( + self, data: bytes + ) -> ed25519.Ed25519PrivateKey: + return rust_openssl.ed25519.from_private_bytes(data) + + def ed25519_generate_key(self) -> ed25519.Ed25519PrivateKey: + return rust_openssl.ed25519.generate_key() + + def ed448_supported(self) -> bool: + if self._fips_enabled: + return False + return ( + not self._lib.CRYPTOGRAPHY_IS_LIBRESSL + and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + ) + + def ed448_load_public_bytes(self, data: bytes) -> ed448.Ed448PublicKey: + return rust_openssl.ed448.from_public_bytes(data) + + def ed448_load_private_bytes(self, data: bytes) -> ed448.Ed448PrivateKey: + return rust_openssl.ed448.from_private_bytes(data) + + def ed448_generate_key(self) -> ed448.Ed448PrivateKey: + return rust_openssl.ed448.generate_key() + + def aead_cipher_supported(self, cipher) -> bool: + return aead._aead_cipher_supported(self, cipher) + + def _zero_data(self, data, length: int) -> None: + # We clear things this way because at the moment we're not + # sure of a better way that can guarantee it overwrites the + # memory of a bytearray and doesn't just replace the underlying char *. + for i in range(length): + data[i] = 0 + + @contextlib.contextmanager + def _zeroed_null_terminated_buf(self, data): + """ + This method takes bytes, which can be a bytestring or a mutable + buffer like a bytearray, and yields a null-terminated version of that + data. This is required because PKCS12_parse doesn't take a length with + its password char * and ffi.from_buffer doesn't provide null + termination. So, to support zeroing the data via bytearray we + need to build this ridiculous construct that copies the memory, but + zeroes it after use. + """ + if data is None: + yield self._ffi.NULL + else: + data_len = len(data) + buf = self._ffi.new("char[]", data_len + 1) + self._ffi.memmove(buf, data, data_len) + try: + yield buf + finally: + # Cast to a uint8_t * so we can assign by integer + self._zero_data(self._ffi.cast("uint8_t *", buf), data_len) + + def load_key_and_certificates_from_pkcs12( + self, data: bytes, password: typing.Optional[bytes] + ) -> typing.Tuple[ + typing.Optional[PrivateKeyTypes], + typing.Optional[x509.Certificate], + typing.List[x509.Certificate], + ]: + pkcs12 = self.load_pkcs12(data, password) + return ( + pkcs12.key, + pkcs12.cert.certificate if pkcs12.cert else None, + [cert.certificate for cert in pkcs12.additional_certs], + ) + + def load_pkcs12( + self, data: bytes, password: typing.Optional[bytes] + ) -> PKCS12KeyAndCertificates: + if password is not None: + utils._check_byteslike("password", password) + + bio = self._bytes_to_bio(data) + p12 = self._lib.d2i_PKCS12_bio(bio.bio, self._ffi.NULL) + if p12 == self._ffi.NULL: + self._consume_errors() + raise ValueError("Could not deserialize PKCS12 data") + + p12 = self._ffi.gc(p12, self._lib.PKCS12_free) + evp_pkey_ptr = self._ffi.new("EVP_PKEY **") + x509_ptr = self._ffi.new("X509 **") + sk_x509_ptr = self._ffi.new("Cryptography_STACK_OF_X509 **") + with self._zeroed_null_terminated_buf(password) as password_buf: + res = self._lib.PKCS12_parse( + p12, password_buf, evp_pkey_ptr, x509_ptr, sk_x509_ptr + ) + if res == 0: + self._consume_errors() + raise ValueError("Invalid password or PKCS12 data") + + cert = None + key = None + additional_certificates = [] + + if evp_pkey_ptr[0] != self._ffi.NULL: + evp_pkey = self._ffi.gc(evp_pkey_ptr[0], self._lib.EVP_PKEY_free) + # We don't support turning off RSA key validation when loading + # PKCS12 keys + key = self._evp_pkey_to_private_key( + evp_pkey, unsafe_skip_rsa_key_validation=False + ) + + if x509_ptr[0] != self._ffi.NULL: + x509 = self._ffi.gc(x509_ptr[0], self._lib.X509_free) + cert_obj = self._ossl2cert(x509) + name = None + maybe_name = self._lib.X509_alias_get0(x509, self._ffi.NULL) + if maybe_name != self._ffi.NULL: + name = self._ffi.string(maybe_name) + cert = PKCS12Certificate(cert_obj, name) + + if sk_x509_ptr[0] != self._ffi.NULL: + sk_x509 = self._ffi.gc(sk_x509_ptr[0], self._lib.sk_X509_free) + num = self._lib.sk_X509_num(sk_x509_ptr[0]) + + # In OpenSSL < 3.0.0 PKCS12 parsing reverses the order of the + # certificates. + indices: typing.Iterable[int] + if ( + self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER + or self._lib.CRYPTOGRAPHY_IS_BORINGSSL + ): + indices = range(num) + else: + indices = reversed(range(num)) + + for i in indices: + x509 = self._lib.sk_X509_value(sk_x509, i) + self.openssl_assert(x509 != self._ffi.NULL) + x509 = self._ffi.gc(x509, self._lib.X509_free) + addl_cert = self._ossl2cert(x509) + addl_name = None + maybe_name = self._lib.X509_alias_get0(x509, self._ffi.NULL) + if maybe_name != self._ffi.NULL: + addl_name = self._ffi.string(maybe_name) + additional_certificates.append( + PKCS12Certificate(addl_cert, addl_name) + ) + + return PKCS12KeyAndCertificates(key, cert, additional_certificates) + + def serialize_key_and_certificates_to_pkcs12( + self, + name: typing.Optional[bytes], + key: typing.Optional[PKCS12PrivateKeyTypes], + cert: typing.Optional[x509.Certificate], + cas: typing.Optional[typing.List[_PKCS12CATypes]], + encryption_algorithm: serialization.KeySerializationEncryption, + ) -> bytes: + password = None + if name is not None: + utils._check_bytes("name", name) + + if isinstance(encryption_algorithm, serialization.NoEncryption): + nid_cert = -1 + nid_key = -1 + pkcs12_iter = 0 + mac_iter = 0 + mac_alg = self._ffi.NULL + elif isinstance( + encryption_algorithm, serialization.BestAvailableEncryption + ): + # PKCS12 encryption is hopeless trash and can never be fixed. + # OpenSSL 3 supports PBESv2, but Libre and Boring do not, so + # we use PBESv1 with 3DES on the older paths. + if self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER: + nid_cert = self._lib.NID_aes_256_cbc + nid_key = self._lib.NID_aes_256_cbc + else: + nid_cert = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + nid_key = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + # At least we can set this higher than OpenSSL's default + pkcs12_iter = 20000 + # mac_iter chosen for compatibility reasons, see: + # https://www.openssl.org/docs/man1.1.1/man3/PKCS12_create.html + # Did we mention how lousy PKCS12 encryption is? + mac_iter = 1 + # MAC algorithm can only be set on OpenSSL 3.0.0+ + mac_alg = self._ffi.NULL + password = encryption_algorithm.password + elif ( + isinstance( + encryption_algorithm, serialization._KeySerializationEncryption + ) + and encryption_algorithm._format + is serialization.PrivateFormat.PKCS12 + ): + # Default to OpenSSL's defaults. Behavior will vary based on the + # version of OpenSSL cryptography is compiled against. + nid_cert = 0 + nid_key = 0 + # Use the default iters we use in best available + pkcs12_iter = 20000 + # See the Best Available comment for why this is 1 + mac_iter = 1 + password = encryption_algorithm.password + keycertalg = encryption_algorithm._key_cert_algorithm + if keycertalg is PBES.PBESv1SHA1And3KeyTripleDESCBC: + nid_cert = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + nid_key = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC + elif keycertalg is PBES.PBESv2SHA256AndAES256CBC: + if not self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER: + raise UnsupportedAlgorithm( + "PBESv2 is not supported by this version of OpenSSL" + ) + nid_cert = self._lib.NID_aes_256_cbc + nid_key = self._lib.NID_aes_256_cbc + else: + assert keycertalg is None + # We use OpenSSL's defaults + + if encryption_algorithm._hmac_hash is not None: + if not self._lib.Cryptography_HAS_PKCS12_SET_MAC: + raise UnsupportedAlgorithm( + "Setting MAC algorithm is not supported by this " + "version of OpenSSL." + ) + mac_alg = self._evp_md_non_null_from_algorithm( + encryption_algorithm._hmac_hash + ) + self.openssl_assert(mac_alg != self._ffi.NULL) + else: + mac_alg = self._ffi.NULL + + if encryption_algorithm._kdf_rounds is not None: + pkcs12_iter = encryption_algorithm._kdf_rounds + + else: + raise ValueError("Unsupported key encryption type") + + if cas is None or len(cas) == 0: + sk_x509 = self._ffi.NULL + else: + sk_x509 = self._lib.sk_X509_new_null() + sk_x509 = self._ffi.gc(sk_x509, self._lib.sk_X509_free) + + # This list is to keep the x509 values alive until end of function + ossl_cas = [] + for ca in cas: + if isinstance(ca, PKCS12Certificate): + ca_alias = ca.friendly_name + ossl_ca = self._cert2ossl(ca.certificate) + if ca_alias is None: + res = self._lib.X509_alias_set1( + ossl_ca, self._ffi.NULL, -1 + ) + else: + res = self._lib.X509_alias_set1( + ossl_ca, ca_alias, len(ca_alias) + ) + self.openssl_assert(res == 1) + else: + ossl_ca = self._cert2ossl(ca) + ossl_cas.append(ossl_ca) + res = self._lib.sk_X509_push(sk_x509, ossl_ca) + backend.openssl_assert(res >= 1) + + with self._zeroed_null_terminated_buf(password) as password_buf: + with self._zeroed_null_terminated_buf(name) as name_buf: + ossl_cert = self._cert2ossl(cert) if cert else self._ffi.NULL + ossl_pkey = ( + self._key2ossl(key) if key is not None else self._ffi.NULL + ) + + p12 = self._lib.PKCS12_create( + password_buf, + name_buf, + ossl_pkey, + ossl_cert, + sk_x509, + nid_key, + nid_cert, + pkcs12_iter, + mac_iter, + 0, + ) + + if ( + self._lib.Cryptography_HAS_PKCS12_SET_MAC + and mac_alg != self._ffi.NULL + ): + self._lib.PKCS12_set_mac( + p12, + password_buf, + -1, + self._ffi.NULL, + 0, + mac_iter, + mac_alg, + ) + + self.openssl_assert(p12 != self._ffi.NULL) + p12 = self._ffi.gc(p12, self._lib.PKCS12_free) + + bio = self._create_mem_bio_gc() + res = self._lib.i2d_PKCS12_bio(bio, p12) + self.openssl_assert(res > 0) + return self._read_mem_bio(bio) + + def poly1305_supported(self) -> bool: + if self._fips_enabled: + return False + return self._lib.Cryptography_HAS_POLY1305 == 1 + + def pkcs7_supported(self) -> bool: + return not self._lib.CRYPTOGRAPHY_IS_BORINGSSL + + def load_pem_pkcs7_certificates( + self, data: bytes + ) -> typing.List[x509.Certificate]: + utils._check_bytes("data", data) + bio = self._bytes_to_bio(data) + p7 = self._lib.PEM_read_bio_PKCS7( + bio.bio, self._ffi.NULL, self._ffi.NULL, self._ffi.NULL + ) + if p7 == self._ffi.NULL: + self._consume_errors() + raise ValueError("Unable to parse PKCS7 data") + + p7 = self._ffi.gc(p7, self._lib.PKCS7_free) + return self._load_pkcs7_certificates(p7) + + def load_der_pkcs7_certificates( + self, data: bytes + ) -> typing.List[x509.Certificate]: + utils._check_bytes("data", data) + bio = self._bytes_to_bio(data) + p7 = self._lib.d2i_PKCS7_bio(bio.bio, self._ffi.NULL) + if p7 == self._ffi.NULL: + self._consume_errors() + raise ValueError("Unable to parse PKCS7 data") + + p7 = self._ffi.gc(p7, self._lib.PKCS7_free) + return self._load_pkcs7_certificates(p7) + + def _load_pkcs7_certificates(self, p7) -> typing.List[x509.Certificate]: + nid = self._lib.OBJ_obj2nid(p7.type) + self.openssl_assert(nid != self._lib.NID_undef) + if nid != self._lib.NID_pkcs7_signed: + raise UnsupportedAlgorithm( + "Only basic signed structures are currently supported. NID" + " for this data was {}".format(nid), + _Reasons.UNSUPPORTED_SERIALIZATION, + ) + + sk_x509 = p7.d.sign.cert + num = self._lib.sk_X509_num(sk_x509) + certs = [] + for i in range(num): + x509 = self._lib.sk_X509_value(sk_x509, i) + self.openssl_assert(x509 != self._ffi.NULL) + cert = self._ossl2cert(x509) + certs.append(cert) + + return certs + + +class GetCipherByName: + def __init__(self, fmt: str): + self._fmt = fmt + + def __call__(self, backend: Backend, cipher: CipherAlgorithm, mode: Mode): + cipher_name = self._fmt.format(cipher=cipher, mode=mode).lower() + evp_cipher = backend._lib.EVP_get_cipherbyname( + cipher_name.encode("ascii") + ) + + # try EVP_CIPHER_fetch if present + if ( + evp_cipher == backend._ffi.NULL + and backend._lib.Cryptography_HAS_300_EVP_CIPHER + ): + evp_cipher = backend._lib.EVP_CIPHER_fetch( + backend._ffi.NULL, + cipher_name.encode("ascii"), + backend._ffi.NULL, + ) + + backend._consume_errors() + return evp_cipher + + +def _get_xts_cipher(backend: Backend, cipher: AES, mode): + cipher_name = f"aes-{cipher.key_size // 2}-xts" + return backend._lib.EVP_get_cipherbyname(cipher_name.encode("ascii")) + + +backend = Backend() diff --git a/jwt/python/cryptography/hazmat/backends/openssl/ciphers.py b/jwt/python/cryptography/hazmat/backends/openssl/ciphers.py new file mode 100644 index 0000000..bc42adb --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/ciphers.py @@ -0,0 +1,281 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import InvalidTag, UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.primitives import ciphers +from cryptography.hazmat.primitives.ciphers import algorithms, modes + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +class _CipherContext: + _ENCRYPT = 1 + _DECRYPT = 0 + _MAX_CHUNK_SIZE = 2**30 - 1 + + def __init__(self, backend: Backend, cipher, mode, operation: int) -> None: + self._backend = backend + self._cipher = cipher + self._mode = mode + self._operation = operation + self._tag: typing.Optional[bytes] = None + + if isinstance(self._cipher, ciphers.BlockCipherAlgorithm): + self._block_size_bytes = self._cipher.block_size // 8 + else: + self._block_size_bytes = 1 + + ctx = self._backend._lib.EVP_CIPHER_CTX_new() + ctx = self._backend._ffi.gc( + ctx, self._backend._lib.EVP_CIPHER_CTX_free + ) + + registry = self._backend._cipher_registry + try: + adapter = registry[type(cipher), type(mode)] + except KeyError: + raise UnsupportedAlgorithm( + "cipher {} in {} mode is not supported " + "by this backend.".format( + cipher.name, mode.name if mode else mode + ), + _Reasons.UNSUPPORTED_CIPHER, + ) + + evp_cipher = adapter(self._backend, cipher, mode) + if evp_cipher == self._backend._ffi.NULL: + msg = f"cipher {cipher.name} " + if mode is not None: + msg += f"in {mode.name} mode " + msg += ( + "is not supported by this backend (Your version of OpenSSL " + "may be too old. Current version: {}.)" + ).format(self._backend.openssl_version_text()) + raise UnsupportedAlgorithm(msg, _Reasons.UNSUPPORTED_CIPHER) + + if isinstance(mode, modes.ModeWithInitializationVector): + iv_nonce = self._backend._ffi.from_buffer( + mode.initialization_vector + ) + elif isinstance(mode, modes.ModeWithTweak): + iv_nonce = self._backend._ffi.from_buffer(mode.tweak) + elif isinstance(mode, modes.ModeWithNonce): + iv_nonce = self._backend._ffi.from_buffer(mode.nonce) + elif isinstance(cipher, algorithms.ChaCha20): + iv_nonce = self._backend._ffi.from_buffer(cipher.nonce) + else: + iv_nonce = self._backend._ffi.NULL + # begin init with cipher and operation type + res = self._backend._lib.EVP_CipherInit_ex( + ctx, + evp_cipher, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + operation, + ) + self._backend.openssl_assert(res != 0) + # set the key length to handle variable key ciphers + res = self._backend._lib.EVP_CIPHER_CTX_set_key_length( + ctx, len(cipher.key) + ) + self._backend.openssl_assert(res != 0) + if isinstance(mode, modes.GCM): + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + self._backend._lib.EVP_CTRL_AEAD_SET_IVLEN, + len(iv_nonce), + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(res != 0) + if mode.tag is not None: + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + ctx, + self._backend._lib.EVP_CTRL_AEAD_SET_TAG, + len(mode.tag), + mode.tag, + ) + self._backend.openssl_assert(res != 0) + self._tag = mode.tag + + # pass key/iv + res = self._backend._lib.EVP_CipherInit_ex( + ctx, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + self._backend._ffi.from_buffer(cipher.key), + iv_nonce, + operation, + ) + + # Check for XTS mode duplicate keys error + errors = self._backend._consume_errors() + lib = self._backend._lib + if res == 0 and ( + ( + not lib.CRYPTOGRAPHY_IS_LIBRESSL + and errors[0]._lib_reason_match( + lib.ERR_LIB_EVP, lib.EVP_R_XTS_DUPLICATED_KEYS + ) + ) + or ( + lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + lib.ERR_LIB_PROV, lib.PROV_R_XTS_DUPLICATED_KEYS + ) + ) + ): + raise ValueError("In XTS mode duplicated keys are not allowed") + + self._backend.openssl_assert(res != 0, errors=errors) + + # We purposely disable padding here as it's handled higher up in the + # API. + self._backend._lib.EVP_CIPHER_CTX_set_padding(ctx, 0) + self._ctx = ctx + + def update(self, data: bytes) -> bytes: + buf = bytearray(len(data) + self._block_size_bytes - 1) + n = self.update_into(data, buf) + return bytes(buf[:n]) + + def update_into(self, data: bytes, buf: bytes) -> int: + total_data_len = len(data) + if len(buf) < (total_data_len + self._block_size_bytes - 1): + raise ValueError( + "buffer must be at least {} bytes for this " + "payload".format(len(data) + self._block_size_bytes - 1) + ) + + data_processed = 0 + total_out = 0 + outlen = self._backend._ffi.new("int *") + baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True) + baseinbuf = self._backend._ffi.from_buffer(data) + + while data_processed != total_data_len: + outbuf = baseoutbuf + total_out + inbuf = baseinbuf + data_processed + inlen = min(self._MAX_CHUNK_SIZE, total_data_len - data_processed) + + res = self._backend._lib.EVP_CipherUpdate( + self._ctx, outbuf, outlen, inbuf, inlen + ) + if res == 0 and isinstance(self._mode, modes.XTS): + self._backend._consume_errors() + raise ValueError( + "In XTS mode you must supply at least a full block in the " + "first update call. For AES this is 16 bytes." + ) + else: + self._backend.openssl_assert(res != 0) + data_processed += inlen + total_out += outlen[0] + + return total_out + + def finalize(self) -> bytes: + if ( + self._operation == self._DECRYPT + and isinstance(self._mode, modes.ModeWithAuthenticationTag) + and self.tag is None + ): + raise ValueError( + "Authentication tag must be provided when decrypting." + ) + + buf = self._backend._ffi.new("unsigned char[]", self._block_size_bytes) + outlen = self._backend._ffi.new("int *") + res = self._backend._lib.EVP_CipherFinal_ex(self._ctx, buf, outlen) + if res == 0: + errors = self._backend._consume_errors() + + if not errors and isinstance(self._mode, modes.GCM): + raise InvalidTag + + lib = self._backend._lib + self._backend.openssl_assert( + errors[0]._lib_reason_match( + lib.ERR_LIB_EVP, + lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH, + ) + or ( + lib.Cryptography_HAS_PROVIDERS + and errors[0]._lib_reason_match( + lib.ERR_LIB_PROV, + lib.PROV_R_WRONG_FINAL_BLOCK_LENGTH, + ) + ) + or ( + lib.CRYPTOGRAPHY_IS_BORINGSSL + and errors[0].reason + == lib.CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH + ), + errors=errors, + ) + raise ValueError( + "The length of the provided data is not a multiple of " + "the block length." + ) + + if ( + isinstance(self._mode, modes.GCM) + and self._operation == self._ENCRYPT + ): + tag_buf = self._backend._ffi.new( + "unsigned char[]", self._block_size_bytes + ) + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + self._ctx, + self._backend._lib.EVP_CTRL_AEAD_GET_TAG, + self._block_size_bytes, + tag_buf, + ) + self._backend.openssl_assert(res != 0) + self._tag = self._backend._ffi.buffer(tag_buf)[:] + + res = self._backend._lib.EVP_CIPHER_CTX_reset(self._ctx) + self._backend.openssl_assert(res == 1) + return self._backend._ffi.buffer(buf)[: outlen[0]] + + def finalize_with_tag(self, tag: bytes) -> bytes: + tag_len = len(tag) + if tag_len < self._mode._min_tag_length: + raise ValueError( + "Authentication tag must be {} bytes or longer.".format( + self._mode._min_tag_length + ) + ) + elif tag_len > self._block_size_bytes: + raise ValueError( + "Authentication tag cannot be more than {} bytes.".format( + self._block_size_bytes + ) + ) + res = self._backend._lib.EVP_CIPHER_CTX_ctrl( + self._ctx, self._backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag + ) + self._backend.openssl_assert(res != 0) + self._tag = tag + return self.finalize() + + def authenticate_additional_data(self, data: bytes) -> None: + outlen = self._backend._ffi.new("int *") + res = self._backend._lib.EVP_CipherUpdate( + self._ctx, + self._backend._ffi.NULL, + outlen, + self._backend._ffi.from_buffer(data), + len(data), + ) + self._backend.openssl_assert(res != 0) + + @property + def tag(self) -> typing.Optional[bytes]: + return self._tag diff --git a/jwt/python/cryptography/hazmat/backends/openssl/cmac.py b/jwt/python/cryptography/hazmat/backends/openssl/cmac.py new file mode 100644 index 0000000..bdd7fec --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/cmac.py @@ -0,0 +1,89 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import ( + InvalidSignature, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.primitives import constant_time +from cryptography.hazmat.primitives.ciphers.modes import CBC + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + from cryptography.hazmat.primitives import ciphers + + +class _CMACContext: + def __init__( + self, + backend: Backend, + algorithm: ciphers.BlockCipherAlgorithm, + ctx=None, + ) -> None: + if not backend.cmac_algorithm_supported(algorithm): + raise UnsupportedAlgorithm( + "This backend does not support CMAC.", + _Reasons.UNSUPPORTED_CIPHER, + ) + + self._backend = backend + self._key = algorithm.key + self._algorithm = algorithm + self._output_length = algorithm.block_size // 8 + + if ctx is None: + registry = self._backend._cipher_registry + adapter = registry[type(algorithm), CBC] + + evp_cipher = adapter(self._backend, algorithm, CBC) + + ctx = self._backend._lib.CMAC_CTX_new() + + self._backend.openssl_assert(ctx != self._backend._ffi.NULL) + ctx = self._backend._ffi.gc(ctx, self._backend._lib.CMAC_CTX_free) + + key_ptr = self._backend._ffi.from_buffer(self._key) + res = self._backend._lib.CMAC_Init( + ctx, + key_ptr, + len(self._key), + evp_cipher, + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(res == 1) + + self._ctx = ctx + + def update(self, data: bytes) -> None: + res = self._backend._lib.CMAC_Update(self._ctx, data, len(data)) + self._backend.openssl_assert(res == 1) + + def finalize(self) -> bytes: + buf = self._backend._ffi.new("unsigned char[]", self._output_length) + length = self._backend._ffi.new("size_t *", self._output_length) + res = self._backend._lib.CMAC_Final(self._ctx, buf, length) + self._backend.openssl_assert(res == 1) + + self._ctx = None + + return self._backend._ffi.buffer(buf)[:] + + def copy(self) -> _CMACContext: + copied_ctx = self._backend._lib.CMAC_CTX_new() + copied_ctx = self._backend._ffi.gc( + copied_ctx, self._backend._lib.CMAC_CTX_free + ) + res = self._backend._lib.CMAC_CTX_copy(copied_ctx, self._ctx) + self._backend.openssl_assert(res == 1) + return _CMACContext(self._backend, self._algorithm, ctx=copied_ctx) + + def verify(self, signature: bytes) -> None: + digest = self.finalize() + if not constant_time.bytes_eq(digest, signature): + raise InvalidSignature("Signature did not match digest.") diff --git a/jwt/python/cryptography/hazmat/backends/openssl/decode_asn1.py b/jwt/python/cryptography/hazmat/backends/openssl/decode_asn1.py new file mode 100644 index 0000000..bf123b6 --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/decode_asn1.py @@ -0,0 +1,32 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography import x509 + +# CRLReason ::= ENUMERATED { +# unspecified (0), +# keyCompromise (1), +# cACompromise (2), +# affiliationChanged (3), +# superseded (4), +# cessationOfOperation (5), +# certificateHold (6), +# -- value 7 is not used +# removeFromCRL (8), +# privilegeWithdrawn (9), +# aACompromise (10) } +_CRL_ENTRY_REASON_ENUM_TO_CODE = { + x509.ReasonFlags.unspecified: 0, + x509.ReasonFlags.key_compromise: 1, + x509.ReasonFlags.ca_compromise: 2, + x509.ReasonFlags.affiliation_changed: 3, + x509.ReasonFlags.superseded: 4, + x509.ReasonFlags.cessation_of_operation: 5, + x509.ReasonFlags.certificate_hold: 6, + x509.ReasonFlags.remove_from_crl: 8, + x509.ReasonFlags.privilege_withdrawn: 9, + x509.ReasonFlags.aa_compromise: 10, +} diff --git a/jwt/python/cryptography/hazmat/backends/openssl/ec.py b/jwt/python/cryptography/hazmat/backends/openssl/ec.py new file mode 100644 index 0000000..9821bd1 --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/ec.py @@ -0,0 +1,328 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.exceptions import ( + InvalidSignature, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.backends.openssl.utils import ( + _calculate_digest_and_algorithm, + _evp_pkey_derive, +) +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives.asymmetric import ec + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +def _check_signature_algorithm( + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, +) -> None: + if not isinstance(signature_algorithm, ec.ECDSA): + raise UnsupportedAlgorithm( + "Unsupported elliptic curve signature algorithm.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + +def _ec_key_curve_sn(backend: Backend, ec_key) -> str: + group = backend._lib.EC_KEY_get0_group(ec_key) + backend.openssl_assert(group != backend._ffi.NULL) + + nid = backend._lib.EC_GROUP_get_curve_name(group) + # The following check is to find EC keys with unnamed curves and raise + # an error for now. + if nid == backend._lib.NID_undef: + raise ValueError( + "ECDSA keys with explicit parameters are unsupported at this time" + ) + + # This is like the above check, but it also catches the case where you + # explicitly encoded a curve with the same parameters as a named curve. + # Don't do that. + if ( + not backend._lib.CRYPTOGRAPHY_IS_LIBRESSL + and backend._lib.EC_GROUP_get_asn1_flag(group) == 0 + ): + raise ValueError( + "ECDSA keys with explicit parameters are unsupported at this time" + ) + + curve_name = backend._lib.OBJ_nid2sn(nid) + backend.openssl_assert(curve_name != backend._ffi.NULL) + + sn = backend._ffi.string(curve_name).decode("ascii") + return sn + + +def _mark_asn1_named_ec_curve(backend: Backend, ec_cdata): + """ + Set the named curve flag on the EC_KEY. This causes OpenSSL to + serialize EC keys along with their curve OID which makes + deserialization easier. + """ + + backend._lib.EC_KEY_set_asn1_flag( + ec_cdata, backend._lib.OPENSSL_EC_NAMED_CURVE + ) + + +def _check_key_infinity(backend: Backend, ec_cdata) -> None: + point = backend._lib.EC_KEY_get0_public_key(ec_cdata) + backend.openssl_assert(point != backend._ffi.NULL) + group = backend._lib.EC_KEY_get0_group(ec_cdata) + backend.openssl_assert(group != backend._ffi.NULL) + if backend._lib.EC_POINT_is_at_infinity(group, point): + raise ValueError( + "Cannot load an EC public key where the point is at infinity" + ) + + +def _sn_to_elliptic_curve(backend: Backend, sn: str) -> ec.EllipticCurve: + try: + return ec._CURVE_TYPES[sn]() + except KeyError: + raise UnsupportedAlgorithm( + f"{sn} is not a supported elliptic curve", + _Reasons.UNSUPPORTED_ELLIPTIC_CURVE, + ) + + +def _ecdsa_sig_sign( + backend: Backend, private_key: _EllipticCurvePrivateKey, data: bytes +) -> bytes: + max_size = backend._lib.ECDSA_size(private_key._ec_key) + backend.openssl_assert(max_size > 0) + + sigbuf = backend._ffi.new("unsigned char[]", max_size) + siglen_ptr = backend._ffi.new("unsigned int[]", 1) + res = backend._lib.ECDSA_sign( + 0, data, len(data), sigbuf, siglen_ptr, private_key._ec_key + ) + backend.openssl_assert(res == 1) + return backend._ffi.buffer(sigbuf)[: siglen_ptr[0]] + + +def _ecdsa_sig_verify( + backend: Backend, + public_key: _EllipticCurvePublicKey, + signature: bytes, + data: bytes, +) -> None: + res = backend._lib.ECDSA_verify( + 0, data, len(data), signature, len(signature), public_key._ec_key + ) + if res != 1: + backend._consume_errors() + raise InvalidSignature + + +class _EllipticCurvePrivateKey(ec.EllipticCurvePrivateKey): + def __init__(self, backend: Backend, ec_key_cdata, evp_pkey): + self._backend = backend + self._ec_key = ec_key_cdata + self._evp_pkey = evp_pkey + + sn = _ec_key_curve_sn(backend, ec_key_cdata) + self._curve = _sn_to_elliptic_curve(backend, sn) + _mark_asn1_named_ec_curve(backend, ec_key_cdata) + _check_key_infinity(backend, ec_key_cdata) + + @property + def curve(self) -> ec.EllipticCurve: + return self._curve + + @property + def key_size(self) -> int: + return self.curve.key_size + + def exchange( + self, algorithm: ec.ECDH, peer_public_key: ec.EllipticCurvePublicKey + ) -> bytes: + if not ( + self._backend.elliptic_curve_exchange_algorithm_supported( + algorithm, self.curve + ) + ): + raise UnsupportedAlgorithm( + "This backend does not support the ECDH algorithm.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + if peer_public_key.curve.name != self.curve.name: + raise ValueError( + "peer_public_key and self are not on the same curve" + ) + + return _evp_pkey_derive(self._backend, self._evp_pkey, peer_public_key) + + def public_key(self) -> ec.EllipticCurvePublicKey: + group = self._backend._lib.EC_KEY_get0_group(self._ec_key) + self._backend.openssl_assert(group != self._backend._ffi.NULL) + + curve_nid = self._backend._lib.EC_GROUP_get_curve_name(group) + public_ec_key = self._backend._ec_key_new_by_curve_nid(curve_nid) + + point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key) + self._backend.openssl_assert(point != self._backend._ffi.NULL) + + res = self._backend._lib.EC_KEY_set_public_key(public_ec_key, point) + self._backend.openssl_assert(res == 1) + + evp_pkey = self._backend._ec_cdata_to_evp_pkey(public_ec_key) + + return _EllipticCurvePublicKey(self._backend, public_ec_key, evp_pkey) + + def private_numbers(self) -> ec.EllipticCurvePrivateNumbers: + bn = self._backend._lib.EC_KEY_get0_private_key(self._ec_key) + private_value = self._backend._bn_to_int(bn) + return ec.EllipticCurvePrivateNumbers( + private_value=private_value, + public_numbers=self.public_key().public_numbers(), + ) + + def private_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PrivateFormat, + encryption_algorithm: serialization.KeySerializationEncryption, + ) -> bytes: + return self._backend._private_key_bytes( + encoding, + format, + encryption_algorithm, + self, + self._evp_pkey, + self._ec_key, + ) + + def sign( + self, + data: bytes, + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, + ) -> bytes: + _check_signature_algorithm(signature_algorithm) + data, _ = _calculate_digest_and_algorithm( + data, + signature_algorithm.algorithm, + ) + return _ecdsa_sig_sign(self._backend, self, data) + + +class _EllipticCurvePublicKey(ec.EllipticCurvePublicKey): + def __init__(self, backend: Backend, ec_key_cdata, evp_pkey): + self._backend = backend + self._ec_key = ec_key_cdata + self._evp_pkey = evp_pkey + + sn = _ec_key_curve_sn(backend, ec_key_cdata) + self._curve = _sn_to_elliptic_curve(backend, sn) + _mark_asn1_named_ec_curve(backend, ec_key_cdata) + _check_key_infinity(backend, ec_key_cdata) + + @property + def curve(self) -> ec.EllipticCurve: + return self._curve + + @property + def key_size(self) -> int: + return self.curve.key_size + + def __eq__(self, other: object) -> bool: + if not isinstance(other, _EllipticCurvePublicKey): + return NotImplemented + + return ( + self._backend._lib.EVP_PKEY_cmp(self._evp_pkey, other._evp_pkey) + == 1 + ) + + def public_numbers(self) -> ec.EllipticCurvePublicNumbers: + group = self._backend._lib.EC_KEY_get0_group(self._ec_key) + self._backend.openssl_assert(group != self._backend._ffi.NULL) + + point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key) + self._backend.openssl_assert(point != self._backend._ffi.NULL) + + with self._backend._tmp_bn_ctx() as bn_ctx: + bn_x = self._backend._lib.BN_CTX_get(bn_ctx) + bn_y = self._backend._lib.BN_CTX_get(bn_ctx) + + res = self._backend._lib.EC_POINT_get_affine_coordinates( + group, point, bn_x, bn_y, bn_ctx + ) + self._backend.openssl_assert(res == 1) + + x = self._backend._bn_to_int(bn_x) + y = self._backend._bn_to_int(bn_y) + + return ec.EllipticCurvePublicNumbers(x=x, y=y, curve=self._curve) + + def _encode_point(self, format: serialization.PublicFormat) -> bytes: + if format is serialization.PublicFormat.CompressedPoint: + conversion = self._backend._lib.POINT_CONVERSION_COMPRESSED + else: + assert format is serialization.PublicFormat.UncompressedPoint + conversion = self._backend._lib.POINT_CONVERSION_UNCOMPRESSED + + group = self._backend._lib.EC_KEY_get0_group(self._ec_key) + self._backend.openssl_assert(group != self._backend._ffi.NULL) + point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key) + self._backend.openssl_assert(point != self._backend._ffi.NULL) + with self._backend._tmp_bn_ctx() as bn_ctx: + buflen = self._backend._lib.EC_POINT_point2oct( + group, point, conversion, self._backend._ffi.NULL, 0, bn_ctx + ) + self._backend.openssl_assert(buflen > 0) + buf = self._backend._ffi.new("char[]", buflen) + res = self._backend._lib.EC_POINT_point2oct( + group, point, conversion, buf, buflen, bn_ctx + ) + self._backend.openssl_assert(buflen == res) + + return self._backend._ffi.buffer(buf)[:] + + def public_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PublicFormat, + ) -> bytes: + if ( + encoding is serialization.Encoding.X962 + or format is serialization.PublicFormat.CompressedPoint + or format is serialization.PublicFormat.UncompressedPoint + ): + if encoding is not serialization.Encoding.X962 or format not in ( + serialization.PublicFormat.CompressedPoint, + serialization.PublicFormat.UncompressedPoint, + ): + raise ValueError( + "X962 encoding must be used with CompressedPoint or " + "UncompressedPoint format" + ) + + return self._encode_point(format) + else: + return self._backend._public_key_bytes( + encoding, format, self, self._evp_pkey, None + ) + + def verify( + self, + signature: bytes, + data: bytes, + signature_algorithm: ec.EllipticCurveSignatureAlgorithm, + ) -> None: + _check_signature_algorithm(signature_algorithm) + data, _ = _calculate_digest_and_algorithm( + data, + signature_algorithm.algorithm, + ) + _ecdsa_sig_verify(self._backend, self, signature, data) diff --git a/jwt/python/cryptography/hazmat/backends/openssl/rsa.py b/jwt/python/cryptography/hazmat/backends/openssl/rsa.py new file mode 100644 index 0000000..ef27d4e --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/rsa.py @@ -0,0 +1,599 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import threading +import typing + +from cryptography.exceptions import ( + InvalidSignature, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.backends.openssl.utils import ( + _calculate_digest_and_algorithm, +) +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils +from cryptography.hazmat.primitives.asymmetric.padding import ( + MGF1, + OAEP, + PSS, + AsymmetricPadding, + PKCS1v15, + _Auto, + _DigestLength, + _MaxLength, + calculate_max_pss_salt_length, +) +from cryptography.hazmat.primitives.asymmetric.rsa import ( + RSAPrivateKey, + RSAPrivateNumbers, + RSAPublicKey, + RSAPublicNumbers, +) + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +def _get_rsa_pss_salt_length( + backend: Backend, + pss: PSS, + key: typing.Union[RSAPrivateKey, RSAPublicKey], + hash_algorithm: hashes.HashAlgorithm, +) -> int: + salt = pss._salt_length + + if isinstance(salt, _MaxLength): + return calculate_max_pss_salt_length(key, hash_algorithm) + elif isinstance(salt, _DigestLength): + return hash_algorithm.digest_size + elif isinstance(salt, _Auto): + if isinstance(key, RSAPrivateKey): + raise ValueError( + "PSS salt length can only be set to AUTO when verifying" + ) + return backend._lib.RSA_PSS_SALTLEN_AUTO + else: + return salt + + +def _enc_dec_rsa( + backend: Backend, + key: typing.Union[_RSAPrivateKey, _RSAPublicKey], + data: bytes, + padding: AsymmetricPadding, +) -> bytes: + if not isinstance(padding, AsymmetricPadding): + raise TypeError("Padding must be an instance of AsymmetricPadding.") + + if isinstance(padding, PKCS1v15): + padding_enum = backend._lib.RSA_PKCS1_PADDING + elif isinstance(padding, OAEP): + padding_enum = backend._lib.RSA_PKCS1_OAEP_PADDING + + if not isinstance(padding._mgf, MGF1): + raise UnsupportedAlgorithm( + "Only MGF1 is supported by this backend.", + _Reasons.UNSUPPORTED_MGF, + ) + + if not backend.rsa_padding_supported(padding): + raise UnsupportedAlgorithm( + "This combination of padding and hash algorithm is not " + "supported by this backend.", + _Reasons.UNSUPPORTED_PADDING, + ) + + else: + raise UnsupportedAlgorithm( + f"{padding.name} is not supported by this backend.", + _Reasons.UNSUPPORTED_PADDING, + ) + + return _enc_dec_rsa_pkey_ctx(backend, key, data, padding_enum, padding) + + +def _enc_dec_rsa_pkey_ctx( + backend: Backend, + key: typing.Union[_RSAPrivateKey, _RSAPublicKey], + data: bytes, + padding_enum: int, + padding: AsymmetricPadding, +) -> bytes: + init: typing.Callable[[typing.Any], int] + crypt: typing.Callable[[typing.Any, typing.Any, int, bytes, int], int] + if isinstance(key, _RSAPublicKey): + init = backend._lib.EVP_PKEY_encrypt_init + crypt = backend._lib.EVP_PKEY_encrypt + else: + init = backend._lib.EVP_PKEY_decrypt_init + crypt = backend._lib.EVP_PKEY_decrypt + + pkey_ctx = backend._lib.EVP_PKEY_CTX_new(key._evp_pkey, backend._ffi.NULL) + backend.openssl_assert(pkey_ctx != backend._ffi.NULL) + pkey_ctx = backend._ffi.gc(pkey_ctx, backend._lib.EVP_PKEY_CTX_free) + res = init(pkey_ctx) + backend.openssl_assert(res == 1) + res = backend._lib.EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, padding_enum) + backend.openssl_assert(res > 0) + buf_size = backend._lib.EVP_PKEY_size(key._evp_pkey) + backend.openssl_assert(buf_size > 0) + if isinstance(padding, OAEP): + mgf1_md = backend._evp_md_non_null_from_algorithm( + padding._mgf._algorithm + ) + res = backend._lib.EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, mgf1_md) + backend.openssl_assert(res > 0) + oaep_md = backend._evp_md_non_null_from_algorithm(padding._algorithm) + res = backend._lib.EVP_PKEY_CTX_set_rsa_oaep_md(pkey_ctx, oaep_md) + backend.openssl_assert(res > 0) + + if ( + isinstance(padding, OAEP) + and padding._label is not None + and len(padding._label) > 0 + ): + # set0_rsa_oaep_label takes ownership of the char * so we need to + # copy it into some new memory + labelptr = backend._lib.OPENSSL_malloc(len(padding._label)) + backend.openssl_assert(labelptr != backend._ffi.NULL) + backend._ffi.memmove(labelptr, padding._label, len(padding._label)) + res = backend._lib.EVP_PKEY_CTX_set0_rsa_oaep_label( + pkey_ctx, labelptr, len(padding._label) + ) + backend.openssl_assert(res == 1) + + outlen = backend._ffi.new("size_t *", buf_size) + buf = backend._ffi.new("unsigned char[]", buf_size) + # Everything from this line onwards is written with the goal of being as + # constant-time as is practical given the constraints of Python and our + # API. See Bleichenbacher's '98 attack on RSA, and its many many variants. + # As such, you should not attempt to change this (particularly to "clean it + # up") without understanding why it was written this way (see + # Chesterton's Fence), and without measuring to verify you have not + # introduced observable time differences. + res = crypt(pkey_ctx, buf, outlen, data, len(data)) + resbuf = backend._ffi.buffer(buf)[: outlen[0]] + backend._lib.ERR_clear_error() + if res <= 0: + raise ValueError("Encryption/decryption failed.") + return resbuf + + +def _rsa_sig_determine_padding( + backend: Backend, + key: typing.Union[_RSAPrivateKey, _RSAPublicKey], + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], +) -> int: + if not isinstance(padding, AsymmetricPadding): + raise TypeError("Expected provider of AsymmetricPadding.") + + pkey_size = backend._lib.EVP_PKEY_size(key._evp_pkey) + backend.openssl_assert(pkey_size > 0) + + if isinstance(padding, PKCS1v15): + # Hash algorithm is ignored for PKCS1v15-padding, may be None. + padding_enum = backend._lib.RSA_PKCS1_PADDING + elif isinstance(padding, PSS): + if not isinstance(padding._mgf, MGF1): + raise UnsupportedAlgorithm( + "Only MGF1 is supported by this backend.", + _Reasons.UNSUPPORTED_MGF, + ) + + # PSS padding requires a hash algorithm + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of hashes.HashAlgorithm.") + + # Size of key in bytes - 2 is the maximum + # PSS signature length (salt length is checked later) + if pkey_size - algorithm.digest_size - 2 < 0: + raise ValueError( + "Digest too large for key size. Use a larger " + "key or different digest." + ) + + padding_enum = backend._lib.RSA_PKCS1_PSS_PADDING + else: + raise UnsupportedAlgorithm( + f"{padding.name} is not supported by this backend.", + _Reasons.UNSUPPORTED_PADDING, + ) + + return padding_enum + + +# Hash algorithm can be absent (None) to initialize the context without setting +# any message digest algorithm. This is currently only valid for the PKCS1v15 +# padding type, where it means that the signature data is encoded/decoded +# as provided, without being wrapped in a DigestInfo structure. +def _rsa_sig_setup( + backend: Backend, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + key: typing.Union[_RSAPublicKey, _RSAPrivateKey], + init_func: typing.Callable[[typing.Any], int], +): + padding_enum = _rsa_sig_determine_padding(backend, key, padding, algorithm) + pkey_ctx = backend._lib.EVP_PKEY_CTX_new(key._evp_pkey, backend._ffi.NULL) + backend.openssl_assert(pkey_ctx != backend._ffi.NULL) + pkey_ctx = backend._ffi.gc(pkey_ctx, backend._lib.EVP_PKEY_CTX_free) + res = init_func(pkey_ctx) + if res != 1: + errors = backend._consume_errors() + raise ValueError("Unable to sign/verify with this key", errors) + + if algorithm is not None: + evp_md = backend._evp_md_non_null_from_algorithm(algorithm) + res = backend._lib.EVP_PKEY_CTX_set_signature_md(pkey_ctx, evp_md) + if res <= 0: + backend._consume_errors() + raise UnsupportedAlgorithm( + "{} is not supported by this backend for RSA signing.".format( + algorithm.name + ), + _Reasons.UNSUPPORTED_HASH, + ) + res = backend._lib.EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, padding_enum) + if res <= 0: + backend._consume_errors() + raise UnsupportedAlgorithm( + "{} is not supported for the RSA signature operation.".format( + padding.name + ), + _Reasons.UNSUPPORTED_PADDING, + ) + if isinstance(padding, PSS): + assert isinstance(algorithm, hashes.HashAlgorithm) + res = backend._lib.EVP_PKEY_CTX_set_rsa_pss_saltlen( + pkey_ctx, + _get_rsa_pss_salt_length(backend, padding, key, algorithm), + ) + backend.openssl_assert(res > 0) + + mgf1_md = backend._evp_md_non_null_from_algorithm( + padding._mgf._algorithm + ) + res = backend._lib.EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, mgf1_md) + backend.openssl_assert(res > 0) + + return pkey_ctx + + +def _rsa_sig_sign( + backend: Backend, + padding: AsymmetricPadding, + algorithm: hashes.HashAlgorithm, + private_key: _RSAPrivateKey, + data: bytes, +) -> bytes: + pkey_ctx = _rsa_sig_setup( + backend, + padding, + algorithm, + private_key, + backend._lib.EVP_PKEY_sign_init, + ) + buflen = backend._ffi.new("size_t *") + res = backend._lib.EVP_PKEY_sign( + pkey_ctx, backend._ffi.NULL, buflen, data, len(data) + ) + backend.openssl_assert(res == 1) + buf = backend._ffi.new("unsigned char[]", buflen[0]) + res = backend._lib.EVP_PKEY_sign(pkey_ctx, buf, buflen, data, len(data)) + if res != 1: + errors = backend._consume_errors() + raise ValueError( + "Digest or salt length too long for key size. Use a larger key " + "or shorter salt length if you are specifying a PSS salt", + errors, + ) + + return backend._ffi.buffer(buf)[:] + + +def _rsa_sig_verify( + backend: Backend, + padding: AsymmetricPadding, + algorithm: hashes.HashAlgorithm, + public_key: _RSAPublicKey, + signature: bytes, + data: bytes, +) -> None: + pkey_ctx = _rsa_sig_setup( + backend, + padding, + algorithm, + public_key, + backend._lib.EVP_PKEY_verify_init, + ) + res = backend._lib.EVP_PKEY_verify( + pkey_ctx, signature, len(signature), data, len(data) + ) + # The previous call can return negative numbers in the event of an + # error. This is not a signature failure but we need to fail if it + # occurs. + backend.openssl_assert(res >= 0) + if res == 0: + backend._consume_errors() + raise InvalidSignature + + +def _rsa_sig_recover( + backend: Backend, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + public_key: _RSAPublicKey, + signature: bytes, +) -> bytes: + pkey_ctx = _rsa_sig_setup( + backend, + padding, + algorithm, + public_key, + backend._lib.EVP_PKEY_verify_recover_init, + ) + + # Attempt to keep the rest of the code in this function as constant/time + # as possible. See the comment in _enc_dec_rsa_pkey_ctx. Note that the + # buflen parameter is used even though its value may be undefined in the + # error case. Due to the tolerant nature of Python slicing this does not + # trigger any exceptions. + maxlen = backend._lib.EVP_PKEY_size(public_key._evp_pkey) + backend.openssl_assert(maxlen > 0) + buf = backend._ffi.new("unsigned char[]", maxlen) + buflen = backend._ffi.new("size_t *", maxlen) + res = backend._lib.EVP_PKEY_verify_recover( + pkey_ctx, buf, buflen, signature, len(signature) + ) + resbuf = backend._ffi.buffer(buf)[: buflen[0]] + backend._lib.ERR_clear_error() + # Assume that all parameter errors are handled during the setup phase and + # any error here is due to invalid signature. + if res != 1: + raise InvalidSignature + return resbuf + + +class _RSAPrivateKey(RSAPrivateKey): + _evp_pkey: object + _rsa_cdata: object + _key_size: int + + def __init__( + self, + backend: Backend, + rsa_cdata, + evp_pkey, + *, + unsafe_skip_rsa_key_validation: bool, + ): + res: int + # RSA_check_key is slower in OpenSSL 3.0.0 due to improved + # primality checking. In normal use this is unlikely to be a problem + # since users don't load new keys constantly, but for TESTING we've + # added an init arg that allows skipping the checks. You should not + # use this in production code unless you understand the consequences. + if not unsafe_skip_rsa_key_validation: + res = backend._lib.RSA_check_key(rsa_cdata) + if res != 1: + errors = backend._consume_errors() + raise ValueError("Invalid private key", errors) + # 2 is prime and passes an RSA key check, so we also check + # if p and q are odd just to be safe. + p = backend._ffi.new("BIGNUM **") + q = backend._ffi.new("BIGNUM **") + backend._lib.RSA_get0_factors(rsa_cdata, p, q) + backend.openssl_assert(p[0] != backend._ffi.NULL) + backend.openssl_assert(q[0] != backend._ffi.NULL) + p_odd = backend._lib.BN_is_odd(p[0]) + q_odd = backend._lib.BN_is_odd(q[0]) + if p_odd != 1 or q_odd != 1: + errors = backend._consume_errors() + raise ValueError("Invalid private key", errors) + + self._backend = backend + self._rsa_cdata = rsa_cdata + self._evp_pkey = evp_pkey + # Used for lazy blinding + self._blinded = False + self._blinding_lock = threading.Lock() + + n = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key( + self._rsa_cdata, + n, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._key_size = self._backend._lib.BN_num_bits(n[0]) + + def _enable_blinding(self) -> None: + # If you call blind on an already blinded RSA key OpenSSL will turn + # it off and back on, which is a performance hit we want to avoid. + if not self._blinded: + with self._blinding_lock: + self._non_threadsafe_enable_blinding() + + def _non_threadsafe_enable_blinding(self) -> None: + # This is only a separate function to allow for testing to cover both + # branches. It should never be invoked except through _enable_blinding. + # Check if it's not True again in case another thread raced past the + # first non-locked check. + if not self._blinded: + res = self._backend._lib.RSA_blinding_on( + self._rsa_cdata, self._backend._ffi.NULL + ) + self._backend.openssl_assert(res == 1) + self._blinded = True + + @property + def key_size(self) -> int: + return self._key_size + + def decrypt(self, ciphertext: bytes, padding: AsymmetricPadding) -> bytes: + self._enable_blinding() + key_size_bytes = (self.key_size + 7) // 8 + if key_size_bytes != len(ciphertext): + raise ValueError("Ciphertext length must be equal to key size.") + + return _enc_dec_rsa(self._backend, self, ciphertext, padding) + + def public_key(self) -> RSAPublicKey: + ctx = self._backend._lib.RSAPublicKey_dup(self._rsa_cdata) + self._backend.openssl_assert(ctx != self._backend._ffi.NULL) + ctx = self._backend._ffi.gc(ctx, self._backend._lib.RSA_free) + evp_pkey = self._backend._rsa_cdata_to_evp_pkey(ctx) + return _RSAPublicKey(self._backend, ctx, evp_pkey) + + def private_numbers(self) -> RSAPrivateNumbers: + n = self._backend._ffi.new("BIGNUM **") + e = self._backend._ffi.new("BIGNUM **") + d = self._backend._ffi.new("BIGNUM **") + p = self._backend._ffi.new("BIGNUM **") + q = self._backend._ffi.new("BIGNUM **") + dmp1 = self._backend._ffi.new("BIGNUM **") + dmq1 = self._backend._ffi.new("BIGNUM **") + iqmp = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key(self._rsa_cdata, n, e, d) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(e[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(d[0] != self._backend._ffi.NULL) + self._backend._lib.RSA_get0_factors(self._rsa_cdata, p, q) + self._backend.openssl_assert(p[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(q[0] != self._backend._ffi.NULL) + self._backend._lib.RSA_get0_crt_params( + self._rsa_cdata, dmp1, dmq1, iqmp + ) + self._backend.openssl_assert(dmp1[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(dmq1[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(iqmp[0] != self._backend._ffi.NULL) + return RSAPrivateNumbers( + p=self._backend._bn_to_int(p[0]), + q=self._backend._bn_to_int(q[0]), + d=self._backend._bn_to_int(d[0]), + dmp1=self._backend._bn_to_int(dmp1[0]), + dmq1=self._backend._bn_to_int(dmq1[0]), + iqmp=self._backend._bn_to_int(iqmp[0]), + public_numbers=RSAPublicNumbers( + e=self._backend._bn_to_int(e[0]), + n=self._backend._bn_to_int(n[0]), + ), + ) + + def private_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PrivateFormat, + encryption_algorithm: serialization.KeySerializationEncryption, + ) -> bytes: + return self._backend._private_key_bytes( + encoding, + format, + encryption_algorithm, + self, + self._evp_pkey, + self._rsa_cdata, + ) + + def sign( + self, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> bytes: + self._enable_blinding() + data, algorithm = _calculate_digest_and_algorithm(data, algorithm) + return _rsa_sig_sign(self._backend, padding, algorithm, self, data) + + +class _RSAPublicKey(RSAPublicKey): + _evp_pkey: object + _rsa_cdata: object + _key_size: int + + def __init__(self, backend: Backend, rsa_cdata, evp_pkey): + self._backend = backend + self._rsa_cdata = rsa_cdata + self._evp_pkey = evp_pkey + + n = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key( + self._rsa_cdata, + n, + self._backend._ffi.NULL, + self._backend._ffi.NULL, + ) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._key_size = self._backend._lib.BN_num_bits(n[0]) + + @property + def key_size(self) -> int: + return self._key_size + + def __eq__(self, other: object) -> bool: + if not isinstance(other, _RSAPublicKey): + return NotImplemented + + return ( + self._backend._lib.EVP_PKEY_cmp(self._evp_pkey, other._evp_pkey) + == 1 + ) + + def encrypt(self, plaintext: bytes, padding: AsymmetricPadding) -> bytes: + return _enc_dec_rsa(self._backend, self, plaintext, padding) + + def public_numbers(self) -> RSAPublicNumbers: + n = self._backend._ffi.new("BIGNUM **") + e = self._backend._ffi.new("BIGNUM **") + self._backend._lib.RSA_get0_key( + self._rsa_cdata, n, e, self._backend._ffi.NULL + ) + self._backend.openssl_assert(n[0] != self._backend._ffi.NULL) + self._backend.openssl_assert(e[0] != self._backend._ffi.NULL) + return RSAPublicNumbers( + e=self._backend._bn_to_int(e[0]), + n=self._backend._bn_to_int(n[0]), + ) + + def public_bytes( + self, + encoding: serialization.Encoding, + format: serialization.PublicFormat, + ) -> bytes: + return self._backend._public_key_bytes( + encoding, format, self, self._evp_pkey, self._rsa_cdata + ) + + def verify( + self, + signature: bytes, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> None: + data, algorithm = _calculate_digest_and_algorithm(data, algorithm) + _rsa_sig_verify( + self._backend, padding, algorithm, self, signature, data + ) + + def recover_data_from_signature( + self, + signature: bytes, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + ) -> bytes: + if isinstance(algorithm, asym_utils.Prehashed): + raise TypeError( + "Prehashed is only supported in the sign and verify methods. " + "It cannot be used with recover_data_from_signature." + ) + return _rsa_sig_recover( + self._backend, padding, algorithm, self, signature + ) diff --git a/jwt/python/cryptography/hazmat/backends/openssl/utils.py b/jwt/python/cryptography/hazmat/backends/openssl/utils.py new file mode 100644 index 0000000..5b404de --- /dev/null +++ b/jwt/python/cryptography/hazmat/backends/openssl/utils.py @@ -0,0 +1,63 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric.utils import Prehashed + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.backend import Backend + + +def _evp_pkey_derive(backend: Backend, evp_pkey, peer_public_key) -> bytes: + ctx = backend._lib.EVP_PKEY_CTX_new(evp_pkey, backend._ffi.NULL) + backend.openssl_assert(ctx != backend._ffi.NULL) + ctx = backend._ffi.gc(ctx, backend._lib.EVP_PKEY_CTX_free) + res = backend._lib.EVP_PKEY_derive_init(ctx) + backend.openssl_assert(res == 1) + + if backend._lib.Cryptography_HAS_EVP_PKEY_SET_PEER_EX: + res = backend._lib.EVP_PKEY_derive_set_peer_ex( + ctx, peer_public_key._evp_pkey, 0 + ) + else: + res = backend._lib.EVP_PKEY_derive_set_peer( + ctx, peer_public_key._evp_pkey + ) + backend.openssl_assert(res == 1) + + keylen = backend._ffi.new("size_t *") + res = backend._lib.EVP_PKEY_derive(ctx, backend._ffi.NULL, keylen) + backend.openssl_assert(res == 1) + backend.openssl_assert(keylen[0] > 0) + buf = backend._ffi.new("unsigned char[]", keylen[0]) + res = backend._lib.EVP_PKEY_derive(ctx, buf, keylen) + if res != 1: + errors = backend._consume_errors() + raise ValueError("Error computing shared key.", errors) + + return backend._ffi.buffer(buf, keylen[0])[:] + + +def _calculate_digest_and_algorithm( + data: bytes, + algorithm: typing.Union[Prehashed, hashes.HashAlgorithm], +) -> typing.Tuple[bytes, hashes.HashAlgorithm]: + if not isinstance(algorithm, Prehashed): + hash_ctx = hashes.Hash(algorithm) + hash_ctx.update(data) + data = hash_ctx.finalize() + else: + algorithm = algorithm._algorithm + + if len(data) != algorithm.digest_size: + raise ValueError( + "The provided data must be the same length as the hash " + "algorithm's digest size." + ) + + return (data, algorithm) diff --git a/jwt/python/cryptography/hazmat/bindings/__init__.py b/jwt/python/cryptography/hazmat/bindings/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/jwt/python/cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..6d0ef6b Binary files /dev/null and b/jwt/python/cryptography/hazmat/bindings/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/bindings/_rust.abi3.so b/jwt/python/cryptography/hazmat/bindings/_rust.abi3.so new file mode 100755 index 0000000..b5f12d9 Binary files /dev/null and b/jwt/python/cryptography/hazmat/bindings/_rust.abi3.so differ diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/__init__.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/__init__.pyi new file mode 100644 index 0000000..94a37a2 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/__init__.pyi @@ -0,0 +1,34 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import types +import typing + +def check_pkcs7_padding(data: bytes) -> bool: ... +def check_ansix923_padding(data: bytes) -> bool: ... + +class ObjectIdentifier: + def __init__(self, val: str) -> None: ... + @property + def dotted_string(self) -> str: ... + @property + def _name(self) -> str: ... + +T = typing.TypeVar("T") + +class FixedPool(typing.Generic[T]): + def __init__( + self, + create: typing.Callable[[], T], + ) -> None: ... + def acquire(self) -> PoolAcquisition[T]: ... + +class PoolAcquisition(typing.Generic[T]): + def __enter__(self) -> T: ... + def __exit__( + self, + exc_type: typing.Optional[typing.Type[BaseException]], + exc_value: typing.Optional[BaseException], + exc_tb: typing.Optional[types.TracebackType], + ) -> None: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/_openssl.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/_openssl.pyi new file mode 100644 index 0000000..8010008 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/_openssl.pyi @@ -0,0 +1,8 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +lib = typing.Any +ffi = typing.Any diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/asn1.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/asn1.pyi new file mode 100644 index 0000000..a8369ba --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/asn1.pyi @@ -0,0 +1,16 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +class TestCertificate: + not_after_tag: int + not_before_tag: int + issuer_value_tags: typing.List[int] + subject_value_tags: typing.List[int] + +def decode_dss_signature(signature: bytes) -> typing.Tuple[int, int]: ... +def encode_dss_signature(r: int, s: int) -> bytes: ... +def parse_spki_for_data(data: bytes) -> bytes: ... +def test_parse_certificate(data: bytes) -> TestCertificate: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/exceptions.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/exceptions.pyi new file mode 100644 index 0000000..09f46b1 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/exceptions.pyi @@ -0,0 +1,17 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +class _Reasons: + BACKEND_MISSING_INTERFACE: _Reasons + UNSUPPORTED_HASH: _Reasons + UNSUPPORTED_CIPHER: _Reasons + UNSUPPORTED_PADDING: _Reasons + UNSUPPORTED_MGF: _Reasons + UNSUPPORTED_PUBLIC_KEY_ALGORITHM: _Reasons + UNSUPPORTED_ELLIPTIC_CURVE: _Reasons + UNSUPPORTED_SERIALIZATION: _Reasons + UNSUPPORTED_X509: _Reasons + UNSUPPORTED_EXCHANGE_ALGORITHM: _Reasons + UNSUPPORTED_DIFFIE_HELLMAN: _Reasons + UNSUPPORTED_MAC: _Reasons diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/ocsp.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/ocsp.pyi new file mode 100644 index 0000000..4671eb9 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/ocsp.pyi @@ -0,0 +1,25 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes +from cryptography.x509.ocsp import ( + OCSPRequest, + OCSPRequestBuilder, + OCSPResponse, + OCSPResponseBuilder, + OCSPResponseStatus, +) + +def load_der_ocsp_request(data: bytes) -> OCSPRequest: ... +def load_der_ocsp_response(data: bytes) -> OCSPResponse: ... +def create_ocsp_request(builder: OCSPRequestBuilder) -> OCSPRequest: ... +def create_ocsp_response( + status: OCSPResponseStatus, + builder: typing.Optional[OCSPResponseBuilder], + private_key: typing.Optional[PrivateKeyTypes], + hash_algorithm: typing.Optional[hashes.HashAlgorithm], +) -> OCSPResponse: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi new file mode 100644 index 0000000..82f30d2 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi @@ -0,0 +1,47 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.bindings._rust.openssl import ( + dh, + dsa, + ed448, + ed25519, + hashes, + hmac, + kdf, + poly1305, + x448, + x25519, +) + +__all__ = [ + "openssl_version", + "raise_openssl_error", + "dh", + "dsa", + "hashes", + "hmac", + "kdf", + "ed448", + "ed25519", + "poly1305", + "x448", + "x25519", +] + +def openssl_version() -> int: ... +def raise_openssl_error() -> typing.NoReturn: ... +def capture_error_stack() -> typing.List[OpenSSLError]: ... +def is_fips_enabled() -> bool: ... + +class OpenSSLError: + @property + def lib(self) -> int: ... + @property + def reason(self) -> int: ... + @property + def reason_text(self) -> bytes: ... + def _lib_reason_match(self, lib: int, reason: int) -> bool: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/dh.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/dh.pyi new file mode 100644 index 0000000..bfd005d --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/dh.pyi @@ -0,0 +1,22 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import dh + +MIN_MODULUS_SIZE: int + +class DHPrivateKey: ... +class DHPublicKey: ... +class DHParameters: ... + +def generate_parameters(generator: int, key_size: int) -> dh.DHParameters: ... +def private_key_from_ptr(ptr: int) -> dh.DHPrivateKey: ... +def public_key_from_ptr(ptr: int) -> dh.DHPublicKey: ... +def from_pem_parameters(data: bytes) -> dh.DHParameters: ... +def from_der_parameters(data: bytes) -> dh.DHParameters: ... +def from_private_numbers(numbers: dh.DHPrivateNumbers) -> dh.DHPrivateKey: ... +def from_public_numbers(numbers: dh.DHPublicNumbers) -> dh.DHPublicKey: ... +def from_parameter_numbers( + numbers: dh.DHParameterNumbers, +) -> dh.DHParameters: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi new file mode 100644 index 0000000..5a56f25 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi @@ -0,0 +1,20 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import dsa + +class DSAPrivateKey: ... +class DSAPublicKey: ... +class DSAParameters: ... + +def generate_parameters(key_size: int) -> dsa.DSAParameters: ... +def private_key_from_ptr(ptr: int) -> dsa.DSAPrivateKey: ... +def public_key_from_ptr(ptr: int) -> dsa.DSAPublicKey: ... +def from_private_numbers( + numbers: dsa.DSAPrivateNumbers, +) -> dsa.DSAPrivateKey: ... +def from_public_numbers(numbers: dsa.DSAPublicNumbers) -> dsa.DSAPublicKey: ... +def from_parameter_numbers( + numbers: dsa.DSAParameterNumbers, +) -> dsa.DSAParameters: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi new file mode 100644 index 0000000..c7f127f --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import ed25519 + +class Ed25519PrivateKey: ... +class Ed25519PublicKey: ... + +def generate_key() -> ed25519.Ed25519PrivateKey: ... +def private_key_from_ptr(ptr: int) -> ed25519.Ed25519PrivateKey: ... +def public_key_from_ptr(ptr: int) -> ed25519.Ed25519PublicKey: ... +def from_private_bytes(data: bytes) -> ed25519.Ed25519PrivateKey: ... +def from_public_bytes(data: bytes) -> ed25519.Ed25519PublicKey: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi new file mode 100644 index 0000000..1cf5f17 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import ed448 + +class Ed448PrivateKey: ... +class Ed448PublicKey: ... + +def generate_key() -> ed448.Ed448PrivateKey: ... +def private_key_from_ptr(ptr: int) -> ed448.Ed448PrivateKey: ... +def public_key_from_ptr(ptr: int) -> ed448.Ed448PublicKey: ... +def from_private_bytes(data: bytes) -> ed448.Ed448PrivateKey: ... +def from_public_bytes(data: bytes) -> ed448.Ed448PublicKey: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi new file mode 100644 index 0000000..ca5f42a --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi @@ -0,0 +1,17 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.primitives import hashes + +class Hash(hashes.HashContext): + def __init__( + self, algorithm: hashes.HashAlgorithm, backend: typing.Any = None + ) -> None: ... + @property + def algorithm(self) -> hashes.HashAlgorithm: ... + def update(self, data: bytes) -> None: ... + def finalize(self) -> bytes: ... + def copy(self) -> Hash: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi new file mode 100644 index 0000000..e38d9b5 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi @@ -0,0 +1,21 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography.hazmat.primitives import hashes + +class HMAC(hashes.HashContext): + def __init__( + self, + key: bytes, + algorithm: hashes.HashAlgorithm, + backend: typing.Any = None, + ) -> None: ... + @property + def algorithm(self) -> hashes.HashAlgorithm: ... + def update(self, data: bytes) -> None: ... + def finalize(self) -> bytes: ... + def verify(self, signature: bytes) -> None: ... + def copy(self) -> HMAC: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi new file mode 100644 index 0000000..034a8fe --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi @@ -0,0 +1,22 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.hashes import HashAlgorithm + +def derive_pbkdf2_hmac( + key_material: bytes, + algorithm: HashAlgorithm, + salt: bytes, + iterations: int, + length: int, +) -> bytes: ... +def derive_scrypt( + key_material: bytes, + salt: bytes, + n: int, + r: int, + p: int, + max_mem: int, + length: int, +) -> bytes: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi new file mode 100644 index 0000000..2e9b0a9 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +class Poly1305: + def __init__(self, key: bytes) -> None: ... + @staticmethod + def generate_tag(key: bytes, data: bytes) -> bytes: ... + @staticmethod + def verify_tag(key: bytes, data: bytes, tag: bytes) -> None: ... + def update(self, data: bytes) -> None: ... + def finalize(self) -> bytes: ... + def verify(self, tag: bytes) -> None: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi new file mode 100644 index 0000000..90f7cbd --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import x25519 + +class X25519PrivateKey: ... +class X25519PublicKey: ... + +def generate_key() -> x25519.X25519PrivateKey: ... +def private_key_from_ptr(ptr: int) -> x25519.X25519PrivateKey: ... +def public_key_from_ptr(ptr: int) -> x25519.X25519PublicKey: ... +def from_private_bytes(data: bytes) -> x25519.X25519PrivateKey: ... +def from_public_bytes(data: bytes) -> x25519.X25519PublicKey: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/openssl/x448.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/x448.pyi new file mode 100644 index 0000000..d326c8d --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/openssl/x448.pyi @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from cryptography.hazmat.primitives.asymmetric import x448 + +class X448PrivateKey: ... +class X448PublicKey: ... + +def generate_key() -> x448.X448PrivateKey: ... +def private_key_from_ptr(ptr: int) -> x448.X448PrivateKey: ... +def public_key_from_ptr(ptr: int) -> x448.X448PublicKey: ... +def from_private_bytes(data: bytes) -> x448.X448PrivateKey: ... +def from_public_bytes(data: bytes) -> x448.X448PublicKey: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/pkcs7.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/pkcs7.pyi new file mode 100644 index 0000000..66bd850 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/pkcs7.pyi @@ -0,0 +1,15 @@ +import typing + +from cryptography import x509 +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives.serialization import pkcs7 + +def serialize_certificates( + certs: typing.List[x509.Certificate], + encoding: serialization.Encoding, +) -> bytes: ... +def sign_and_serialize( + builder: pkcs7.PKCS7SignatureBuilder, + encoding: serialization.Encoding, + options: typing.Iterable[pkcs7.PKCS7Options], +) -> bytes: ... diff --git a/jwt/python/cryptography/hazmat/bindings/_rust/x509.pyi b/jwt/python/cryptography/hazmat/bindings/_rust/x509.pyi new file mode 100644 index 0000000..24b2f5e --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/_rust/x509.pyi @@ -0,0 +1,44 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +import typing + +from cryptography import x509 +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric.padding import PSS, PKCS1v15 +from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes + +def load_pem_x509_certificate(data: bytes) -> x509.Certificate: ... +def load_pem_x509_certificates( + data: bytes, +) -> typing.List[x509.Certificate]: ... +def load_der_x509_certificate(data: bytes) -> x509.Certificate: ... +def load_pem_x509_crl(data: bytes) -> x509.CertificateRevocationList: ... +def load_der_x509_crl(data: bytes) -> x509.CertificateRevocationList: ... +def load_pem_x509_csr(data: bytes) -> x509.CertificateSigningRequest: ... +def load_der_x509_csr(data: bytes) -> x509.CertificateSigningRequest: ... +def encode_name_bytes(name: x509.Name) -> bytes: ... +def encode_extension_value(extension: x509.ExtensionType) -> bytes: ... +def create_x509_certificate( + builder: x509.CertificateBuilder, + private_key: PrivateKeyTypes, + hash_algorithm: typing.Optional[hashes.HashAlgorithm], + padding: typing.Optional[typing.Union[PKCS1v15, PSS]], +) -> x509.Certificate: ... +def create_x509_csr( + builder: x509.CertificateSigningRequestBuilder, + private_key: PrivateKeyTypes, + hash_algorithm: typing.Optional[hashes.HashAlgorithm], +) -> x509.CertificateSigningRequest: ... +def create_x509_crl( + builder: x509.CertificateRevocationListBuilder, + private_key: PrivateKeyTypes, + hash_algorithm: typing.Optional[hashes.HashAlgorithm], +) -> x509.CertificateRevocationList: ... + +class Sct: ... +class Certificate: ... +class RevokedCertificate: ... +class CertificateRevocationList: ... +class CertificateSigningRequest: ... diff --git a/jwt/python/cryptography/hazmat/bindings/openssl/__init__.py b/jwt/python/cryptography/hazmat/bindings/openssl/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/openssl/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d985039 Binary files /dev/null and b/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc b/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc new file mode 100644 index 0000000..a0f7c39 Binary files /dev/null and b/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc b/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc new file mode 100644 index 0000000..0e26694 Binary files /dev/null and b/jwt/python/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/bindings/openssl/_conditional.py b/jwt/python/cryptography/hazmat/bindings/openssl/_conditional.py new file mode 100644 index 0000000..5e8ecd0 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/openssl/_conditional.py @@ -0,0 +1,329 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + + +def cryptography_has_set_cert_cb() -> typing.List[str]: + return [ + "SSL_CTX_set_cert_cb", + "SSL_set_cert_cb", + ] + + +def cryptography_has_ssl_st() -> typing.List[str]: + return [ + "SSL_ST_BEFORE", + "SSL_ST_OK", + "SSL_ST_INIT", + "SSL_ST_RENEGOTIATE", + ] + + +def cryptography_has_tls_st() -> typing.List[str]: + return [ + "TLS_ST_BEFORE", + "TLS_ST_OK", + ] + + +def cryptography_has_evp_pkey_dhx() -> typing.List[str]: + return [ + "EVP_PKEY_DHX", + ] + + +def cryptography_has_mem_functions() -> typing.List[str]: + return [ + "Cryptography_CRYPTO_set_mem_functions", + ] + + +def cryptography_has_x509_store_ctx_get_issuer() -> typing.List[str]: + return [ + "X509_STORE_set_get_issuer", + ] + + +def cryptography_has_ed448() -> typing.List[str]: + return [ + "EVP_PKEY_ED448", + "NID_ED448", + ] + + +def cryptography_has_ed25519() -> typing.List[str]: + return [ + "NID_ED25519", + "EVP_PKEY_ED25519", + ] + + +def cryptography_has_poly1305() -> typing.List[str]: + return [ + "NID_poly1305", + "EVP_PKEY_POLY1305", + ] + + +def cryptography_has_evp_digestfinal_xof() -> typing.List[str]: + return [ + "EVP_DigestFinalXOF", + ] + + +def cryptography_has_fips() -> typing.List[str]: + return [ + "FIPS_mode_set", + "FIPS_mode", + ] + + +def cryptography_has_ssl_sigalgs() -> typing.List[str]: + return [ + "SSL_CTX_set1_sigalgs_list", + ] + + +def cryptography_has_psk() -> typing.List[str]: + return [ + "SSL_CTX_use_psk_identity_hint", + "SSL_CTX_set_psk_server_callback", + "SSL_CTX_set_psk_client_callback", + ] + + +def cryptography_has_psk_tlsv13() -> typing.List[str]: + return [ + "SSL_CTX_set_psk_find_session_callback", + "SSL_CTX_set_psk_use_session_callback", + "Cryptography_SSL_SESSION_new", + "SSL_CIPHER_find", + "SSL_SESSION_set1_master_key", + "SSL_SESSION_set_cipher", + "SSL_SESSION_set_protocol_version", + ] + + +def cryptography_has_custom_ext() -> typing.List[str]: + return [ + "SSL_CTX_add_client_custom_ext", + "SSL_CTX_add_server_custom_ext", + "SSL_extension_supported", + ] + + +def cryptography_has_tlsv13_functions() -> typing.List[str]: + return [ + "SSL_VERIFY_POST_HANDSHAKE", + "SSL_CTX_set_ciphersuites", + "SSL_verify_client_post_handshake", + "SSL_CTX_set_post_handshake_auth", + "SSL_set_post_handshake_auth", + "SSL_SESSION_get_max_early_data", + "SSL_write_early_data", + "SSL_read_early_data", + "SSL_CTX_set_max_early_data", + ] + + +def cryptography_has_raw_key() -> typing.List[str]: + return [ + "EVP_PKEY_new_raw_private_key", + "EVP_PKEY_new_raw_public_key", + "EVP_PKEY_get_raw_private_key", + "EVP_PKEY_get_raw_public_key", + ] + + +def cryptography_has_engine() -> typing.List[str]: + return [ + "ENGINE_by_id", + "ENGINE_init", + "ENGINE_finish", + "ENGINE_get_default_RAND", + "ENGINE_set_default_RAND", + "ENGINE_unregister_RAND", + "ENGINE_ctrl_cmd", + "ENGINE_free", + "ENGINE_get_name", + "ENGINE_ctrl_cmd_string", + "ENGINE_load_builtin_engines", + "ENGINE_load_private_key", + "ENGINE_load_public_key", + "SSL_CTX_set_client_cert_engine", + ] + + +def cryptography_has_verified_chain() -> typing.List[str]: + return [ + "SSL_get0_verified_chain", + ] + + +def cryptography_has_srtp() -> typing.List[str]: + return [ + "SSL_CTX_set_tlsext_use_srtp", + "SSL_set_tlsext_use_srtp", + "SSL_get_selected_srtp_profile", + ] + + +def cryptography_has_providers() -> typing.List[str]: + return [ + "OSSL_PROVIDER_load", + "OSSL_PROVIDER_unload", + "ERR_LIB_PROV", + "PROV_R_WRONG_FINAL_BLOCK_LENGTH", + "PROV_R_BAD_DECRYPT", + ] + + +def cryptography_has_op_no_renegotiation() -> typing.List[str]: + return [ + "SSL_OP_NO_RENEGOTIATION", + ] + + +def cryptography_has_dtls_get_data_mtu() -> typing.List[str]: + return [ + "DTLS_get_data_mtu", + ] + + +def cryptography_has_300_fips() -> typing.List[str]: + return [ + "EVP_default_properties_is_fips_enabled", + "EVP_default_properties_enable_fips", + ] + + +def cryptography_has_ssl_cookie() -> typing.List[str]: + return [ + "SSL_OP_COOKIE_EXCHANGE", + "DTLSv1_listen", + "SSL_CTX_set_cookie_generate_cb", + "SSL_CTX_set_cookie_verify_cb", + ] + + +def cryptography_has_pkcs7_funcs() -> typing.List[str]: + return [ + "SMIME_write_PKCS7", + "PEM_write_bio_PKCS7_stream", + "PKCS7_sign_add_signer", + "PKCS7_final", + "PKCS7_verify", + "SMIME_read_PKCS7", + "PKCS7_get0_signers", + ] + + +def cryptography_has_bn_flags() -> typing.List[str]: + return [ + "BN_FLG_CONSTTIME", + "BN_set_flags", + "BN_prime_checks_for_size", + ] + + +def cryptography_has_evp_pkey_dh() -> typing.List[str]: + return [ + "EVP_PKEY_set1_DH", + ] + + +def cryptography_has_300_evp_cipher() -> typing.List[str]: + return ["EVP_CIPHER_fetch", "EVP_CIPHER_free"] + + +def cryptography_has_unexpected_eof_while_reading() -> typing.List[str]: + return ["SSL_R_UNEXPECTED_EOF_WHILE_READING"] + + +def cryptography_has_pkcs12_set_mac() -> typing.List[str]: + return ["PKCS12_set_mac"] + + +def cryptography_has_ssl_op_ignore_unexpected_eof() -> typing.List[str]: + return [ + "SSL_OP_IGNORE_UNEXPECTED_EOF", + ] + + +def cryptography_has_get_extms_support() -> typing.List[str]: + return ["SSL_get_extms_support"] + + +def cryptography_has_evp_pkey_set_peer_ex() -> typing.List[str]: + return ["EVP_PKEY_derive_set_peer_ex"] + + +def cryptography_has_evp_aead() -> typing.List[str]: + return [ + "EVP_aead_chacha20_poly1305", + "EVP_AEAD_CTX_free", + "EVP_AEAD_CTX_seal", + "EVP_AEAD_CTX_open", + "EVP_AEAD_max_overhead", + "Cryptography_EVP_AEAD_CTX_new", + ] + + +# This is a mapping of +# {condition: function-returning-names-dependent-on-that-condition} so we can +# loop over them and delete unsupported names at runtime. It will be removed +# when cffi supports #if in cdef. We use functions instead of just a dict of +# lists so we can use coverage to measure which are used. +CONDITIONAL_NAMES = { + "Cryptography_HAS_SET_CERT_CB": cryptography_has_set_cert_cb, + "Cryptography_HAS_SSL_ST": cryptography_has_ssl_st, + "Cryptography_HAS_TLS_ST": cryptography_has_tls_st, + "Cryptography_HAS_EVP_PKEY_DHX": cryptography_has_evp_pkey_dhx, + "Cryptography_HAS_MEM_FUNCTIONS": cryptography_has_mem_functions, + "Cryptography_HAS_X509_STORE_CTX_GET_ISSUER": ( + cryptography_has_x509_store_ctx_get_issuer + ), + "Cryptography_HAS_ED448": cryptography_has_ed448, + "Cryptography_HAS_ED25519": cryptography_has_ed25519, + "Cryptography_HAS_POLY1305": cryptography_has_poly1305, + "Cryptography_HAS_FIPS": cryptography_has_fips, + "Cryptography_HAS_SIGALGS": cryptography_has_ssl_sigalgs, + "Cryptography_HAS_PSK": cryptography_has_psk, + "Cryptography_HAS_PSK_TLSv1_3": cryptography_has_psk_tlsv13, + "Cryptography_HAS_CUSTOM_EXT": cryptography_has_custom_ext, + "Cryptography_HAS_TLSv1_3_FUNCTIONS": cryptography_has_tlsv13_functions, + "Cryptography_HAS_RAW_KEY": cryptography_has_raw_key, + "Cryptography_HAS_EVP_DIGESTFINAL_XOF": ( + cryptography_has_evp_digestfinal_xof + ), + "Cryptography_HAS_ENGINE": cryptography_has_engine, + "Cryptography_HAS_VERIFIED_CHAIN": cryptography_has_verified_chain, + "Cryptography_HAS_SRTP": cryptography_has_srtp, + "Cryptography_HAS_PROVIDERS": cryptography_has_providers, + "Cryptography_HAS_OP_NO_RENEGOTIATION": ( + cryptography_has_op_no_renegotiation + ), + "Cryptography_HAS_DTLS_GET_DATA_MTU": cryptography_has_dtls_get_data_mtu, + "Cryptography_HAS_300_FIPS": cryptography_has_300_fips, + "Cryptography_HAS_SSL_COOKIE": cryptography_has_ssl_cookie, + "Cryptography_HAS_PKCS7_FUNCS": cryptography_has_pkcs7_funcs, + "Cryptography_HAS_BN_FLAGS": cryptography_has_bn_flags, + "Cryptography_HAS_EVP_PKEY_DH": cryptography_has_evp_pkey_dh, + "Cryptography_HAS_300_EVP_CIPHER": cryptography_has_300_evp_cipher, + "Cryptography_HAS_UNEXPECTED_EOF_WHILE_READING": ( + cryptography_has_unexpected_eof_while_reading + ), + "Cryptography_HAS_PKCS12_SET_MAC": cryptography_has_pkcs12_set_mac, + "Cryptography_HAS_SSL_OP_IGNORE_UNEXPECTED_EOF": ( + cryptography_has_ssl_op_ignore_unexpected_eof + ), + "Cryptography_HAS_GET_EXTMS_SUPPORT": cryptography_has_get_extms_support, + "Cryptography_HAS_EVP_PKEY_SET_PEER_EX": ( + cryptography_has_evp_pkey_set_peer_ex + ), + "Cryptography_HAS_EVP_AEAD": (cryptography_has_evp_aead), +} diff --git a/jwt/python/cryptography/hazmat/bindings/openssl/binding.py b/jwt/python/cryptography/hazmat/bindings/openssl/binding.py new file mode 100644 index 0000000..b50d631 --- /dev/null +++ b/jwt/python/cryptography/hazmat/bindings/openssl/binding.py @@ -0,0 +1,179 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import os +import sys +import threading +import types +import typing +import warnings + +import cryptography +from cryptography.exceptions import InternalError +from cryptography.hazmat.bindings._rust import _openssl, openssl +from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES + + +def _openssl_assert( + lib, + ok: bool, + errors: typing.Optional[typing.List[openssl.OpenSSLError]] = None, +) -> None: + if not ok: + if errors is None: + errors = openssl.capture_error_stack() + + raise InternalError( + "Unknown OpenSSL error. This error is commonly encountered when " + "another library is not cleaning up the OpenSSL error stack. If " + "you are using cryptography with another library that uses " + "OpenSSL try disabling it before reporting a bug. Otherwise " + "please file an issue at https://github.com/pyca/cryptography/" + "issues with information on how to reproduce " + "this. ({!r})".format(errors), + errors, + ) + + +def _legacy_provider_error(loaded: bool) -> None: + if not loaded: + raise RuntimeError( + "OpenSSL 3.0's legacy provider failed to load. This is a fatal " + "error by default, but cryptography supports running without " + "legacy algorithms by setting the environment variable " + "CRYPTOGRAPHY_OPENSSL_NO_LEGACY. If you did not expect this error," + " you have likely made a mistake with your OpenSSL configuration." + ) + + +def build_conditional_library( + lib: typing.Any, + conditional_names: typing.Dict[str, typing.Callable[[], typing.List[str]]], +) -> typing.Any: + conditional_lib = types.ModuleType("lib") + conditional_lib._original_lib = lib # type: ignore[attr-defined] + excluded_names = set() + for condition, names_cb in conditional_names.items(): + if not getattr(lib, condition): + excluded_names.update(names_cb()) + + for attr in dir(lib): + if attr not in excluded_names: + setattr(conditional_lib, attr, getattr(lib, attr)) + + return conditional_lib + + +class Binding: + """ + OpenSSL API wrapper. + """ + + lib: typing.ClassVar = None + ffi = _openssl.ffi + _lib_loaded = False + _init_lock = threading.Lock() + _legacy_provider: typing.Any = ffi.NULL + _legacy_provider_loaded = False + _default_provider: typing.Any = ffi.NULL + + def __init__(self) -> None: + self._ensure_ffi_initialized() + + def _enable_fips(self) -> None: + # This function enables FIPS mode for OpenSSL 3.0.0 on installs that + # have the FIPS provider installed properly. + _openssl_assert(self.lib, self.lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER) + self._base_provider = self.lib.OSSL_PROVIDER_load( + self.ffi.NULL, b"base" + ) + _openssl_assert(self.lib, self._base_provider != self.ffi.NULL) + self.lib._fips_provider = self.lib.OSSL_PROVIDER_load( + self.ffi.NULL, b"fips" + ) + _openssl_assert(self.lib, self.lib._fips_provider != self.ffi.NULL) + + res = self.lib.EVP_default_properties_enable_fips(self.ffi.NULL, 1) + _openssl_assert(self.lib, res == 1) + + @classmethod + def _ensure_ffi_initialized(cls) -> None: + with cls._init_lock: + if not cls._lib_loaded: + cls.lib = build_conditional_library( + _openssl.lib, CONDITIONAL_NAMES + ) + cls._lib_loaded = True + # As of OpenSSL 3.0.0 we must register a legacy cipher provider + # to get RC2 (needed for junk asymmetric private key + # serialization), RC4, Blowfish, IDEA, SEED, etc. These things + # are ugly legacy, but we aren't going to get rid of them + # any time soon. + if cls.lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER: + if not os.environ.get("CRYPTOGRAPHY_OPENSSL_NO_LEGACY"): + cls._legacy_provider = cls.lib.OSSL_PROVIDER_load( + cls.ffi.NULL, b"legacy" + ) + cls._legacy_provider_loaded = ( + cls._legacy_provider != cls.ffi.NULL + ) + _legacy_provider_error(cls._legacy_provider_loaded) + + cls._default_provider = cls.lib.OSSL_PROVIDER_load( + cls.ffi.NULL, b"default" + ) + _openssl_assert( + cls.lib, cls._default_provider != cls.ffi.NULL + ) + + @classmethod + def init_static_locks(cls) -> None: + cls._ensure_ffi_initialized() + + +def _verify_package_version(version: str) -> None: + # Occasionally we run into situations where the version of the Python + # package does not match the version of the shared object that is loaded. + # This may occur in environments where multiple versions of cryptography + # are installed and available in the python path. To avoid errors cropping + # up later this code checks that the currently imported package and the + # shared object that were loaded have the same version and raise an + # ImportError if they do not + so_package_version = _openssl.ffi.string( + _openssl.lib.CRYPTOGRAPHY_PACKAGE_VERSION + ) + if version.encode("ascii") != so_package_version: + raise ImportError( + "The version of cryptography does not match the loaded " + "shared object. This can happen if you have multiple copies of " + "cryptography installed in your Python path. Please try creating " + "a new virtual environment to resolve this issue. " + "Loaded python version: {}, shared object version: {}".format( + version, so_package_version + ) + ) + + _openssl_assert( + _openssl.lib, + _openssl.lib.OpenSSL_version_num() == openssl.openssl_version(), + ) + + +_verify_package_version(cryptography.__version__) + +Binding.init_static_locks() + +if ( + sys.platform == "win32" + and os.environ.get("PROCESSOR_ARCHITEW6432") is not None +): + warnings.warn( + "You are using cryptography on a 32-bit Python on a 64-bit Windows " + "Operating System. Cryptography will be significantly faster if you " + "switch to using a 64-bit Python.", + UserWarning, + stacklevel=2, + ) diff --git a/jwt/python/cryptography/hazmat/primitives/__init__.py b/jwt/python/cryptography/hazmat/primitives/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1a59cde Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc new file mode 100644 index 0000000..aac4fad Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc new file mode 100644 index 0000000..e061f96 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc new file mode 100644 index 0000000..010c1ef Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc new file mode 100644 index 0000000..bb43fd6 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/cmac.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc new file mode 100644 index 0000000..32c2408 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc new file mode 100644 index 0000000..eb71d3c Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/hashes.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc new file mode 100644 index 0000000..674ee64 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/hmac.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc new file mode 100644 index 0000000..5d67e36 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc new file mode 100644 index 0000000..e85b7e8 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/padding.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc new file mode 100644 index 0000000..a0927fc Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/_asymmetric.py b/jwt/python/cryptography/hazmat/primitives/_asymmetric.py new file mode 100644 index 0000000..ea55ffd --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/_asymmetric.py @@ -0,0 +1,19 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +# This exists to break an import cycle. It is normally accessible from the +# asymmetric padding module. + + +class AsymmetricPadding(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this padding (e.g. "PSS", "PKCS1"). + """ diff --git a/jwt/python/cryptography/hazmat/primitives/_cipheralgorithm.py b/jwt/python/cryptography/hazmat/primitives/_cipheralgorithm.py new file mode 100644 index 0000000..3b880b6 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/_cipheralgorithm.py @@ -0,0 +1,45 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +# This exists to break an import cycle. It is normally accessible from the +# ciphers module. + + +class CipherAlgorithm(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this mode (e.g. "AES", "Camellia"). + """ + + @property + @abc.abstractmethod + def key_sizes(self) -> typing.FrozenSet[int]: + """ + Valid key sizes for this algorithm in bits + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The size of the key being used as an integer in bits (e.g. 128, 256). + """ + + +class BlockCipherAlgorithm(CipherAlgorithm): + key: bytes + + @property + @abc.abstractmethod + def block_size(self) -> int: + """ + The size of a block as an integer in bits (e.g. 64, 128). + """ diff --git a/jwt/python/cryptography/hazmat/primitives/_serialization.py b/jwt/python/cryptography/hazmat/primitives/_serialization.py new file mode 100644 index 0000000..34f3fbc --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/_serialization.py @@ -0,0 +1,170 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.hazmat.primitives.hashes import HashAlgorithm + +# This exists to break an import cycle. These classes are normally accessible +# from the serialization module. + + +class PBES(utils.Enum): + PBESv1SHA1And3KeyTripleDESCBC = "PBESv1 using SHA1 and 3-Key TripleDES" + PBESv2SHA256AndAES256CBC = "PBESv2 using SHA256 PBKDF2 and AES256 CBC" + + +class Encoding(utils.Enum): + PEM = "PEM" + DER = "DER" + OpenSSH = "OpenSSH" + Raw = "Raw" + X962 = "ANSI X9.62" + SMIME = "S/MIME" + + +class PrivateFormat(utils.Enum): + PKCS8 = "PKCS8" + TraditionalOpenSSL = "TraditionalOpenSSL" + Raw = "Raw" + OpenSSH = "OpenSSH" + PKCS12 = "PKCS12" + + def encryption_builder(self) -> KeySerializationEncryptionBuilder: + if self not in (PrivateFormat.OpenSSH, PrivateFormat.PKCS12): + raise ValueError( + "encryption_builder only supported with PrivateFormat.OpenSSH" + " and PrivateFormat.PKCS12" + ) + return KeySerializationEncryptionBuilder(self) + + +class PublicFormat(utils.Enum): + SubjectPublicKeyInfo = "X.509 subjectPublicKeyInfo with PKCS#1" + PKCS1 = "Raw PKCS#1" + OpenSSH = "OpenSSH" + Raw = "Raw" + CompressedPoint = "X9.62 Compressed Point" + UncompressedPoint = "X9.62 Uncompressed Point" + + +class ParameterFormat(utils.Enum): + PKCS3 = "PKCS3" + + +class KeySerializationEncryption(metaclass=abc.ABCMeta): + pass + + +class BestAvailableEncryption(KeySerializationEncryption): + def __init__(self, password: bytes): + if not isinstance(password, bytes) or len(password) == 0: + raise ValueError("Password must be 1 or more bytes.") + + self.password = password + + +class NoEncryption(KeySerializationEncryption): + pass + + +class KeySerializationEncryptionBuilder: + def __init__( + self, + format: PrivateFormat, + *, + _kdf_rounds: typing.Optional[int] = None, + _hmac_hash: typing.Optional[HashAlgorithm] = None, + _key_cert_algorithm: typing.Optional[PBES] = None, + ) -> None: + self._format = format + + self._kdf_rounds = _kdf_rounds + self._hmac_hash = _hmac_hash + self._key_cert_algorithm = _key_cert_algorithm + + def kdf_rounds(self, rounds: int) -> KeySerializationEncryptionBuilder: + if self._kdf_rounds is not None: + raise ValueError("kdf_rounds already set") + + if not isinstance(rounds, int): + raise TypeError("kdf_rounds must be an integer") + + if rounds < 1: + raise ValueError("kdf_rounds must be a positive integer") + + return KeySerializationEncryptionBuilder( + self._format, + _kdf_rounds=rounds, + _hmac_hash=self._hmac_hash, + _key_cert_algorithm=self._key_cert_algorithm, + ) + + def hmac_hash( + self, algorithm: HashAlgorithm + ) -> KeySerializationEncryptionBuilder: + if self._format is not PrivateFormat.PKCS12: + raise TypeError( + "hmac_hash only supported with PrivateFormat.PKCS12" + ) + + if self._hmac_hash is not None: + raise ValueError("hmac_hash already set") + return KeySerializationEncryptionBuilder( + self._format, + _kdf_rounds=self._kdf_rounds, + _hmac_hash=algorithm, + _key_cert_algorithm=self._key_cert_algorithm, + ) + + def key_cert_algorithm( + self, algorithm: PBES + ) -> KeySerializationEncryptionBuilder: + if self._format is not PrivateFormat.PKCS12: + raise TypeError( + "key_cert_algorithm only supported with " + "PrivateFormat.PKCS12" + ) + if self._key_cert_algorithm is not None: + raise ValueError("key_cert_algorithm already set") + return KeySerializationEncryptionBuilder( + self._format, + _kdf_rounds=self._kdf_rounds, + _hmac_hash=self._hmac_hash, + _key_cert_algorithm=algorithm, + ) + + def build(self, password: bytes) -> KeySerializationEncryption: + if not isinstance(password, bytes) or len(password) == 0: + raise ValueError("Password must be 1 or more bytes.") + + return _KeySerializationEncryption( + self._format, + password, + kdf_rounds=self._kdf_rounds, + hmac_hash=self._hmac_hash, + key_cert_algorithm=self._key_cert_algorithm, + ) + + +class _KeySerializationEncryption(KeySerializationEncryption): + def __init__( + self, + format: PrivateFormat, + password: bytes, + *, + kdf_rounds: typing.Optional[int], + hmac_hash: typing.Optional[HashAlgorithm], + key_cert_algorithm: typing.Optional[PBES], + ): + self._format = format + self.password = password + + self._kdf_rounds = kdf_rounds + self._hmac_hash = hmac_hash + self._key_cert_algorithm = key_cert_algorithm diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__init__.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/__init__.py new file mode 100644 index 0000000..b509336 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/__init__.py @@ -0,0 +1,3 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..ede5f72 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc new file mode 100644 index 0000000..e08ec6b Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc new file mode 100644 index 0000000..ee12879 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc new file mode 100644 index 0000000..d27ca2e Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc new file mode 100644 index 0000000..e669f30 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc new file mode 100644 index 0000000..ec4d488 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc new file mode 100644 index 0000000..0a57226 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc new file mode 100644 index 0000000..90e4359 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc new file mode 100644 index 0000000..a9a09f0 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..ef1acfb Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc new file mode 100644 index 0000000..197f16e Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc new file mode 100644 index 0000000..d01d6c0 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/dh.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/dh.py new file mode 100644 index 0000000..751bcc4 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/dh.py @@ -0,0 +1,261 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +def generate_parameters( + generator: int, key_size: int, backend: typing.Any = None +) -> DHParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_dh_parameters(generator, key_size) + + +class DHParameterNumbers: + def __init__(self, p: int, g: int, q: typing.Optional[int] = None) -> None: + if not isinstance(p, int) or not isinstance(g, int): + raise TypeError("p and g must be integers") + if q is not None and not isinstance(q, int): + raise TypeError("q must be integer or None") + + if g < 2: + raise ValueError("DH generator must be 2 or greater") + + if p.bit_length() < rust_openssl.dh.MIN_MODULUS_SIZE: + raise ValueError( + f"p (modulus) must be at least " + f"{rust_openssl.dh.MIN_MODULUS_SIZE}-bit" + ) + + self._p = p + self._g = g + self._q = q + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DHParameterNumbers): + return NotImplemented + + return ( + self._p == other._p and self._g == other._g and self._q == other._q + ) + + def parameters(self, backend: typing.Any = None) -> DHParameters: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dh_parameter_numbers(self) + + @property + def p(self) -> int: + return self._p + + @property + def g(self) -> int: + return self._g + + @property + def q(self) -> typing.Optional[int]: + return self._q + + +class DHPublicNumbers: + def __init__(self, y: int, parameter_numbers: DHParameterNumbers) -> None: + if not isinstance(y, int): + raise TypeError("y must be an integer.") + + if not isinstance(parameter_numbers, DHParameterNumbers): + raise TypeError( + "parameters must be an instance of DHParameterNumbers." + ) + + self._y = y + self._parameter_numbers = parameter_numbers + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DHPublicNumbers): + return NotImplemented + + return ( + self._y == other._y + and self._parameter_numbers == other._parameter_numbers + ) + + def public_key(self, backend: typing.Any = None) -> DHPublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dh_public_numbers(self) + + @property + def y(self) -> int: + return self._y + + @property + def parameter_numbers(self) -> DHParameterNumbers: + return self._parameter_numbers + + +class DHPrivateNumbers: + def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None: + if not isinstance(x, int): + raise TypeError("x must be an integer.") + + if not isinstance(public_numbers, DHPublicNumbers): + raise TypeError( + "public_numbers must be an instance of " "DHPublicNumbers." + ) + + self._x = x + self._public_numbers = public_numbers + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DHPrivateNumbers): + return NotImplemented + + return ( + self._x == other._x + and self._public_numbers == other._public_numbers + ) + + def private_key(self, backend: typing.Any = None) -> DHPrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dh_private_numbers(self) + + @property + def public_numbers(self) -> DHPublicNumbers: + return self._public_numbers + + @property + def x(self) -> int: + return self._x + + +class DHParameters(metaclass=abc.ABCMeta): + @abc.abstractmethod + def generate_private_key(self) -> DHPrivateKey: + """ + Generates and returns a DHPrivateKey. + """ + + @abc.abstractmethod + def parameter_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.ParameterFormat, + ) -> bytes: + """ + Returns the parameters serialized as bytes. + """ + + @abc.abstractmethod + def parameter_numbers(self) -> DHParameterNumbers: + """ + Returns a DHParameterNumbers. + """ + + +DHParametersWithSerialization = DHParameters +DHParameters.register(rust_openssl.dh.DHParameters) + + +class DHPublicKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def parameters(self) -> DHParameters: + """ + The DHParameters object associated with this public key. + """ + + @abc.abstractmethod + def public_numbers(self) -> DHPublicNumbers: + """ + Returns a DHPublicNumbers. + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +DHPublicKeyWithSerialization = DHPublicKey +DHPublicKey.register(rust_openssl.dh.DHPublicKey) + + +class DHPrivateKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def public_key(self) -> DHPublicKey: + """ + The DHPublicKey associated with this private key. + """ + + @abc.abstractmethod + def parameters(self) -> DHParameters: + """ + The DHParameters object associated with this private key. + """ + + @abc.abstractmethod + def exchange(self, peer_public_key: DHPublicKey) -> bytes: + """ + Given peer's DHPublicKey, carry out the key exchange and + return shared key as bytes. + """ + + @abc.abstractmethod + def private_numbers(self) -> DHPrivateNumbers: + """ + Returns a DHPrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +DHPrivateKeyWithSerialization = DHPrivateKey +DHPrivateKey.register(rust_openssl.dh.DHPrivateKey) diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/dsa.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/dsa.py new file mode 100644 index 0000000..a8c52de --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/dsa.py @@ -0,0 +1,299 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization, hashes +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils + + +class DSAParameters(metaclass=abc.ABCMeta): + @abc.abstractmethod + def generate_private_key(self) -> DSAPrivateKey: + """ + Generates and returns a DSAPrivateKey. + """ + + @abc.abstractmethod + def parameter_numbers(self) -> DSAParameterNumbers: + """ + Returns a DSAParameterNumbers. + """ + + +DSAParametersWithNumbers = DSAParameters +DSAParameters.register(rust_openssl.dsa.DSAParameters) + + +class DSAPrivateKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def public_key(self) -> DSAPublicKey: + """ + The DSAPublicKey associated with this private key. + """ + + @abc.abstractmethod + def parameters(self) -> DSAParameters: + """ + The DSAParameters object associated with this private key. + """ + + @abc.abstractmethod + def sign( + self, + data: bytes, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> bytes: + """ + Signs the data + """ + + @abc.abstractmethod + def private_numbers(self) -> DSAPrivateNumbers: + """ + Returns a DSAPrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +DSAPrivateKeyWithSerialization = DSAPrivateKey +DSAPrivateKey.register(rust_openssl.dsa.DSAPrivateKey) + + +class DSAPublicKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the prime modulus. + """ + + @abc.abstractmethod + def parameters(self) -> DSAParameters: + """ + The DSAParameters object associated with this public key. + """ + + @abc.abstractmethod + def public_numbers(self) -> DSAPublicNumbers: + """ + Returns a DSAPublicNumbers. + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def verify( + self, + signature: bytes, + data: bytes, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> None: + """ + Verifies the signature of the data. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +DSAPublicKeyWithSerialization = DSAPublicKey +DSAPublicKey.register(rust_openssl.dsa.DSAPublicKey) + + +class DSAParameterNumbers: + def __init__(self, p: int, q: int, g: int): + if ( + not isinstance(p, int) + or not isinstance(q, int) + or not isinstance(g, int) + ): + raise TypeError( + "DSAParameterNumbers p, q, and g arguments must be integers." + ) + + self._p = p + self._q = q + self._g = g + + @property + def p(self) -> int: + return self._p + + @property + def q(self) -> int: + return self._q + + @property + def g(self) -> int: + return self._g + + def parameters(self, backend: typing.Any = None) -> DSAParameters: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dsa_parameter_numbers(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DSAParameterNumbers): + return NotImplemented + + return self.p == other.p and self.q == other.q and self.g == other.g + + def __repr__(self) -> str: + return ( + "".format(self=self) + ) + + +class DSAPublicNumbers: + def __init__(self, y: int, parameter_numbers: DSAParameterNumbers): + if not isinstance(y, int): + raise TypeError("DSAPublicNumbers y argument must be an integer.") + + if not isinstance(parameter_numbers, DSAParameterNumbers): + raise TypeError( + "parameter_numbers must be a DSAParameterNumbers instance." + ) + + self._y = y + self._parameter_numbers = parameter_numbers + + @property + def y(self) -> int: + return self._y + + @property + def parameter_numbers(self) -> DSAParameterNumbers: + return self._parameter_numbers + + def public_key(self, backend: typing.Any = None) -> DSAPublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dsa_public_numbers(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DSAPublicNumbers): + return NotImplemented + + return ( + self.y == other.y + and self.parameter_numbers == other.parameter_numbers + ) + + def __repr__(self) -> str: + return ( + "".format(self=self) + ) + + +class DSAPrivateNumbers: + def __init__(self, x: int, public_numbers: DSAPublicNumbers): + if not isinstance(x, int): + raise TypeError("DSAPrivateNumbers x argument must be an integer.") + + if not isinstance(public_numbers, DSAPublicNumbers): + raise TypeError( + "public_numbers must be a DSAPublicNumbers instance." + ) + self._public_numbers = public_numbers + self._x = x + + @property + def x(self) -> int: + return self._x + + @property + def public_numbers(self) -> DSAPublicNumbers: + return self._public_numbers + + def private_key(self, backend: typing.Any = None) -> DSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_dsa_private_numbers(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DSAPrivateNumbers): + return NotImplemented + + return ( + self.x == other.x and self.public_numbers == other.public_numbers + ) + + +def generate_parameters( + key_size: int, backend: typing.Any = None +) -> DSAParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_dsa_parameters(key_size) + + +def generate_private_key( + key_size: int, backend: typing.Any = None +) -> DSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_dsa_private_key_and_parameters(key_size) + + +def _check_dsa_parameters(parameters: DSAParameterNumbers) -> None: + if parameters.p.bit_length() not in [1024, 2048, 3072, 4096]: + raise ValueError( + "p must be exactly 1024, 2048, 3072, or 4096 bits long" + ) + if parameters.q.bit_length() not in [160, 224, 256]: + raise ValueError("q must be exactly 160, 224, or 256 bits long") + + if not (1 < parameters.g < parameters.p): + raise ValueError("g, p don't satisfy 1 < g < p.") + + +def _check_dsa_private_numbers(numbers: DSAPrivateNumbers) -> None: + parameters = numbers.public_numbers.parameter_numbers + _check_dsa_parameters(parameters) + if numbers.x <= 0 or numbers.x >= parameters.q: + raise ValueError("x must be > 0 and < q.") + + if numbers.public_numbers.y != pow(parameters.g, numbers.x, parameters.p): + raise ValueError("y must be equal to (g ** x % p).") diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/ec.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/ec.py new file mode 100644 index 0000000..ddfaabf --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/ec.py @@ -0,0 +1,490 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.hazmat._oid import ObjectIdentifier +from cryptography.hazmat.primitives import _serialization, hashes +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils + + +class EllipticCurveOID: + SECP192R1 = ObjectIdentifier("1.2.840.10045.3.1.1") + SECP224R1 = ObjectIdentifier("1.3.132.0.33") + SECP256K1 = ObjectIdentifier("1.3.132.0.10") + SECP256R1 = ObjectIdentifier("1.2.840.10045.3.1.7") + SECP384R1 = ObjectIdentifier("1.3.132.0.34") + SECP521R1 = ObjectIdentifier("1.3.132.0.35") + BRAINPOOLP256R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.7") + BRAINPOOLP384R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.11") + BRAINPOOLP512R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.13") + SECT163K1 = ObjectIdentifier("1.3.132.0.1") + SECT163R2 = ObjectIdentifier("1.3.132.0.15") + SECT233K1 = ObjectIdentifier("1.3.132.0.26") + SECT233R1 = ObjectIdentifier("1.3.132.0.27") + SECT283K1 = ObjectIdentifier("1.3.132.0.16") + SECT283R1 = ObjectIdentifier("1.3.132.0.17") + SECT409K1 = ObjectIdentifier("1.3.132.0.36") + SECT409R1 = ObjectIdentifier("1.3.132.0.37") + SECT571K1 = ObjectIdentifier("1.3.132.0.38") + SECT571R1 = ObjectIdentifier("1.3.132.0.39") + + +class EllipticCurve(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + The name of the curve. e.g. secp256r1. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + Bit size of a secret scalar for the curve. + """ + + +class EllipticCurveSignatureAlgorithm(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def algorithm( + self, + ) -> typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm]: + """ + The digest algorithm used with this signature. + """ + + +class EllipticCurvePrivateKey(metaclass=abc.ABCMeta): + @abc.abstractmethod + def exchange( + self, algorithm: ECDH, peer_public_key: EllipticCurvePublicKey + ) -> bytes: + """ + Performs a key exchange operation using the provided algorithm with the + provided peer's public key. + """ + + @abc.abstractmethod + def public_key(self) -> EllipticCurvePublicKey: + """ + The EllipticCurvePublicKey for this private key. + """ + + @property + @abc.abstractmethod + def curve(self) -> EllipticCurve: + """ + The EllipticCurve that this key is on. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + Bit size of a secret scalar for the curve. + """ + + @abc.abstractmethod + def sign( + self, + data: bytes, + signature_algorithm: EllipticCurveSignatureAlgorithm, + ) -> bytes: + """ + Signs the data + """ + + @abc.abstractmethod + def private_numbers(self) -> EllipticCurvePrivateNumbers: + """ + Returns an EllipticCurvePrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +EllipticCurvePrivateKeyWithSerialization = EllipticCurvePrivateKey + + +class EllipticCurvePublicKey(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def curve(self) -> EllipticCurve: + """ + The EllipticCurve that this key is on. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + Bit size of a secret scalar for the curve. + """ + + @abc.abstractmethod + def public_numbers(self) -> EllipticCurvePublicNumbers: + """ + Returns an EllipticCurvePublicNumbers. + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def verify( + self, + signature: bytes, + data: bytes, + signature_algorithm: EllipticCurveSignatureAlgorithm, + ) -> None: + """ + Verifies the signature of the data. + """ + + @classmethod + def from_encoded_point( + cls, curve: EllipticCurve, data: bytes + ) -> EllipticCurvePublicKey: + utils._check_bytes("data", data) + + if not isinstance(curve, EllipticCurve): + raise TypeError("curve must be an EllipticCurve instance") + + if len(data) == 0: + raise ValueError("data must not be an empty byte string") + + if data[0] not in [0x02, 0x03, 0x04]: + raise ValueError("Unsupported elliptic curve point type") + + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.load_elliptic_curve_public_bytes(curve, data) + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +EllipticCurvePublicKeyWithSerialization = EllipticCurvePublicKey + + +class SECT571R1(EllipticCurve): + name = "sect571r1" + key_size = 570 + + +class SECT409R1(EllipticCurve): + name = "sect409r1" + key_size = 409 + + +class SECT283R1(EllipticCurve): + name = "sect283r1" + key_size = 283 + + +class SECT233R1(EllipticCurve): + name = "sect233r1" + key_size = 233 + + +class SECT163R2(EllipticCurve): + name = "sect163r2" + key_size = 163 + + +class SECT571K1(EllipticCurve): + name = "sect571k1" + key_size = 571 + + +class SECT409K1(EllipticCurve): + name = "sect409k1" + key_size = 409 + + +class SECT283K1(EllipticCurve): + name = "sect283k1" + key_size = 283 + + +class SECT233K1(EllipticCurve): + name = "sect233k1" + key_size = 233 + + +class SECT163K1(EllipticCurve): + name = "sect163k1" + key_size = 163 + + +class SECP521R1(EllipticCurve): + name = "secp521r1" + key_size = 521 + + +class SECP384R1(EllipticCurve): + name = "secp384r1" + key_size = 384 + + +class SECP256R1(EllipticCurve): + name = "secp256r1" + key_size = 256 + + +class SECP256K1(EllipticCurve): + name = "secp256k1" + key_size = 256 + + +class SECP224R1(EllipticCurve): + name = "secp224r1" + key_size = 224 + + +class SECP192R1(EllipticCurve): + name = "secp192r1" + key_size = 192 + + +class BrainpoolP256R1(EllipticCurve): + name = "brainpoolP256r1" + key_size = 256 + + +class BrainpoolP384R1(EllipticCurve): + name = "brainpoolP384r1" + key_size = 384 + + +class BrainpoolP512R1(EllipticCurve): + name = "brainpoolP512r1" + key_size = 512 + + +_CURVE_TYPES: typing.Dict[str, typing.Type[EllipticCurve]] = { + "prime192v1": SECP192R1, + "prime256v1": SECP256R1, + "secp192r1": SECP192R1, + "secp224r1": SECP224R1, + "secp256r1": SECP256R1, + "secp384r1": SECP384R1, + "secp521r1": SECP521R1, + "secp256k1": SECP256K1, + "sect163k1": SECT163K1, + "sect233k1": SECT233K1, + "sect283k1": SECT283K1, + "sect409k1": SECT409K1, + "sect571k1": SECT571K1, + "sect163r2": SECT163R2, + "sect233r1": SECT233R1, + "sect283r1": SECT283R1, + "sect409r1": SECT409R1, + "sect571r1": SECT571R1, + "brainpoolP256r1": BrainpoolP256R1, + "brainpoolP384r1": BrainpoolP384R1, + "brainpoolP512r1": BrainpoolP512R1, +} + + +class ECDSA(EllipticCurveSignatureAlgorithm): + def __init__( + self, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ): + self._algorithm = algorithm + + @property + def algorithm( + self, + ) -> typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm]: + return self._algorithm + + +def generate_private_key( + curve: EllipticCurve, backend: typing.Any = None +) -> EllipticCurvePrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.generate_elliptic_curve_private_key(curve) + + +def derive_private_key( + private_value: int, + curve: EllipticCurve, + backend: typing.Any = None, +) -> EllipticCurvePrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + if not isinstance(private_value, int): + raise TypeError("private_value must be an integer type.") + + if private_value <= 0: + raise ValueError("private_value must be a positive integer.") + + if not isinstance(curve, EllipticCurve): + raise TypeError("curve must provide the EllipticCurve interface.") + + return ossl.derive_elliptic_curve_private_key(private_value, curve) + + +class EllipticCurvePublicNumbers: + def __init__(self, x: int, y: int, curve: EllipticCurve): + if not isinstance(x, int) or not isinstance(y, int): + raise TypeError("x and y must be integers.") + + if not isinstance(curve, EllipticCurve): + raise TypeError("curve must provide the EllipticCurve interface.") + + self._y = y + self._x = x + self._curve = curve + + def public_key(self, backend: typing.Any = None) -> EllipticCurvePublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_elliptic_curve_public_numbers(self) + + @property + def curve(self) -> EllipticCurve: + return self._curve + + @property + def x(self) -> int: + return self._x + + @property + def y(self) -> int: + return self._y + + def __eq__(self, other: object) -> bool: + if not isinstance(other, EllipticCurvePublicNumbers): + return NotImplemented + + return ( + self.x == other.x + and self.y == other.y + and self.curve.name == other.curve.name + and self.curve.key_size == other.curve.key_size + ) + + def __hash__(self) -> int: + return hash((self.x, self.y, self.curve.name, self.curve.key_size)) + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + +class EllipticCurvePrivateNumbers: + def __init__( + self, private_value: int, public_numbers: EllipticCurvePublicNumbers + ): + if not isinstance(private_value, int): + raise TypeError("private_value must be an integer.") + + if not isinstance(public_numbers, EllipticCurvePublicNumbers): + raise TypeError( + "public_numbers must be an EllipticCurvePublicNumbers " + "instance." + ) + + self._private_value = private_value + self._public_numbers = public_numbers + + def private_key( + self, backend: typing.Any = None + ) -> EllipticCurvePrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_elliptic_curve_private_numbers(self) + + @property + def private_value(self) -> int: + return self._private_value + + @property + def public_numbers(self) -> EllipticCurvePublicNumbers: + return self._public_numbers + + def __eq__(self, other: object) -> bool: + if not isinstance(other, EllipticCurvePrivateNumbers): + return NotImplemented + + return ( + self.private_value == other.private_value + and self.public_numbers == other.public_numbers + ) + + def __hash__(self) -> int: + return hash((self.private_value, self.public_numbers)) + + +class ECDH: + pass + + +_OID_TO_CURVE = { + EllipticCurveOID.SECP192R1: SECP192R1, + EllipticCurveOID.SECP224R1: SECP224R1, + EllipticCurveOID.SECP256K1: SECP256K1, + EllipticCurveOID.SECP256R1: SECP256R1, + EllipticCurveOID.SECP384R1: SECP384R1, + EllipticCurveOID.SECP521R1: SECP521R1, + EllipticCurveOID.BRAINPOOLP256R1: BrainpoolP256R1, + EllipticCurveOID.BRAINPOOLP384R1: BrainpoolP384R1, + EllipticCurveOID.BRAINPOOLP512R1: BrainpoolP512R1, + EllipticCurveOID.SECT163K1: SECT163K1, + EllipticCurveOID.SECT163R2: SECT163R2, + EllipticCurveOID.SECT233K1: SECT233K1, + EllipticCurveOID.SECT233R1: SECT233R1, + EllipticCurveOID.SECT283K1: SECT283K1, + EllipticCurveOID.SECT283R1: SECT283R1, + EllipticCurveOID.SECT409K1: SECT409K1, + EllipticCurveOID.SECT409R1: SECT409R1, + EllipticCurveOID.SECT571K1: SECT571K1, + EllipticCurveOID.SECT571R1: SECT571R1, +} + + +def get_curve_for_oid(oid: ObjectIdentifier) -> typing.Type[EllipticCurve]: + try: + return _OID_TO_CURVE[oid] + except KeyError: + raise LookupError( + "The provided object identifier has no matching elliptic " + "curve class" + ) diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/ed25519.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/ed25519.py new file mode 100644 index 0000000..f26e54d --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/ed25519.py @@ -0,0 +1,118 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class Ed25519PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> Ed25519PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed25519_supported(): + raise UnsupportedAlgorithm( + "ed25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed25519_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def verify(self, signature: bytes, data: bytes) -> None: + """ + Verify the signature. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +if hasattr(rust_openssl, "ed25519"): + Ed25519PublicKey.register(rust_openssl.ed25519.Ed25519PublicKey) + + +class Ed25519PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> Ed25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed25519_supported(): + raise UnsupportedAlgorithm( + "ed25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed25519_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> Ed25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed25519_supported(): + raise UnsupportedAlgorithm( + "ed25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed25519_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> Ed25519PublicKey: + """ + The Ed25519PublicKey derived from the private key. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + @abc.abstractmethod + def sign(self, data: bytes) -> bytes: + """ + Signs the data. + """ + + +if hasattr(rust_openssl, "x25519"): + Ed25519PrivateKey.register(rust_openssl.ed25519.Ed25519PrivateKey) diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/ed448.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/ed448.py new file mode 100644 index 0000000..a9a34b2 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/ed448.py @@ -0,0 +1,117 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class Ed448PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> Ed448PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed448_supported(): + raise UnsupportedAlgorithm( + "ed448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed448_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def verify(self, signature: bytes, data: bytes) -> None: + """ + Verify the signature. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +if hasattr(rust_openssl, "ed448"): + Ed448PublicKey.register(rust_openssl.ed448.Ed448PublicKey) + + +class Ed448PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> Ed448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed448_supported(): + raise UnsupportedAlgorithm( + "ed448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + return backend.ed448_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> Ed448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.ed448_supported(): + raise UnsupportedAlgorithm( + "ed448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM, + ) + + return backend.ed448_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> Ed448PublicKey: + """ + The Ed448PublicKey derived from the private key. + """ + + @abc.abstractmethod + def sign(self, data: bytes) -> bytes: + """ + Signs the data. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + +if hasattr(rust_openssl, "x448"): + Ed448PrivateKey.register(rust_openssl.ed448.Ed448PrivateKey) diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/padding.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/padding.py new file mode 100644 index 0000000..7198808 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/padding.py @@ -0,0 +1,102 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives._asymmetric import ( + AsymmetricPadding as AsymmetricPadding, +) +from cryptography.hazmat.primitives.asymmetric import rsa + + +class PKCS1v15(AsymmetricPadding): + name = "EMSA-PKCS1-v1_5" + + +class _MaxLength: + "Sentinel value for `MAX_LENGTH`." + + +class _Auto: + "Sentinel value for `AUTO`." + + +class _DigestLength: + "Sentinel value for `DIGEST_LENGTH`." + + +class PSS(AsymmetricPadding): + MAX_LENGTH = _MaxLength() + AUTO = _Auto() + DIGEST_LENGTH = _DigestLength() + name = "EMSA-PSS" + _salt_length: typing.Union[int, _MaxLength, _Auto, _DigestLength] + + def __init__( + self, + mgf: MGF, + salt_length: typing.Union[int, _MaxLength, _Auto, _DigestLength], + ) -> None: + self._mgf = mgf + + if not isinstance( + salt_length, (int, _MaxLength, _Auto, _DigestLength) + ): + raise TypeError( + "salt_length must be an integer, MAX_LENGTH, " + "DIGEST_LENGTH, or AUTO" + ) + + if isinstance(salt_length, int) and salt_length < 0: + raise ValueError("salt_length must be zero or greater.") + + self._salt_length = salt_length + + +class OAEP(AsymmetricPadding): + name = "EME-OAEP" + + def __init__( + self, + mgf: MGF, + algorithm: hashes.HashAlgorithm, + label: typing.Optional[bytes], + ): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of hashes.HashAlgorithm.") + + self._mgf = mgf + self._algorithm = algorithm + self._label = label + + +class MGF(metaclass=abc.ABCMeta): + _algorithm: hashes.HashAlgorithm + + +class MGF1(MGF): + MAX_LENGTH = _MaxLength() + + def __init__(self, algorithm: hashes.HashAlgorithm): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of hashes.HashAlgorithm.") + + self._algorithm = algorithm + + +def calculate_max_pss_salt_length( + key: typing.Union[rsa.RSAPrivateKey, rsa.RSAPublicKey], + hash_algorithm: hashes.HashAlgorithm, +) -> int: + if not isinstance(key, (rsa.RSAPrivateKey, rsa.RSAPublicKey)): + raise TypeError("key must be an RSA public or private key") + # bit length - 1 per RFC 3447 + emlen = (key.key_size + 6) // 8 + salt_length = emlen - hash_algorithm.digest_size - 2 + assert salt_length >= 0 + return salt_length diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/rsa.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/rsa.py new file mode 100644 index 0000000..b740f01 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/rsa.py @@ -0,0 +1,439 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing +from math import gcd + +from cryptography.hazmat.primitives import _serialization, hashes +from cryptography.hazmat.primitives._asymmetric import AsymmetricPadding +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils + + +class RSAPrivateKey(metaclass=abc.ABCMeta): + @abc.abstractmethod + def decrypt(self, ciphertext: bytes, padding: AsymmetricPadding) -> bytes: + """ + Decrypts the provided ciphertext. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the public modulus. + """ + + @abc.abstractmethod + def public_key(self) -> RSAPublicKey: + """ + The RSAPublicKey associated with this private key. + """ + + @abc.abstractmethod + def sign( + self, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> bytes: + """ + Signs the data. + """ + + @abc.abstractmethod + def private_numbers(self) -> RSAPrivateNumbers: + """ + Returns an RSAPrivateNumbers. + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + +RSAPrivateKeyWithSerialization = RSAPrivateKey + + +class RSAPublicKey(metaclass=abc.ABCMeta): + @abc.abstractmethod + def encrypt(self, plaintext: bytes, padding: AsymmetricPadding) -> bytes: + """ + Encrypts the given plaintext. + """ + + @property + @abc.abstractmethod + def key_size(self) -> int: + """ + The bit length of the public modulus. + """ + + @abc.abstractmethod + def public_numbers(self) -> RSAPublicNumbers: + """ + Returns an RSAPublicNumbers + """ + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + Returns the key serialized as bytes. + """ + + @abc.abstractmethod + def verify( + self, + signature: bytes, + data: bytes, + padding: AsymmetricPadding, + algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm], + ) -> None: + """ + Verifies the signature of the data. + """ + + @abc.abstractmethod + def recover_data_from_signature( + self, + signature: bytes, + padding: AsymmetricPadding, + algorithm: typing.Optional[hashes.HashAlgorithm], + ) -> bytes: + """ + Recovers the original data from the signature. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +RSAPublicKeyWithSerialization = RSAPublicKey + + +def generate_private_key( + public_exponent: int, + key_size: int, + backend: typing.Any = None, +) -> RSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + _verify_rsa_parameters(public_exponent, key_size) + return ossl.generate_rsa_private_key(public_exponent, key_size) + + +def _verify_rsa_parameters(public_exponent: int, key_size: int) -> None: + if public_exponent not in (3, 65537): + raise ValueError( + "public_exponent must be either 3 (for legacy compatibility) or " + "65537. Almost everyone should choose 65537 here!" + ) + + if key_size < 512: + raise ValueError("key_size must be at least 512-bits.") + + +def _check_private_key_components( + p: int, + q: int, + private_exponent: int, + dmp1: int, + dmq1: int, + iqmp: int, + public_exponent: int, + modulus: int, +) -> None: + if modulus < 3: + raise ValueError("modulus must be >= 3.") + + if p >= modulus: + raise ValueError("p must be < modulus.") + + if q >= modulus: + raise ValueError("q must be < modulus.") + + if dmp1 >= modulus: + raise ValueError("dmp1 must be < modulus.") + + if dmq1 >= modulus: + raise ValueError("dmq1 must be < modulus.") + + if iqmp >= modulus: + raise ValueError("iqmp must be < modulus.") + + if private_exponent >= modulus: + raise ValueError("private_exponent must be < modulus.") + + if public_exponent < 3 or public_exponent >= modulus: + raise ValueError("public_exponent must be >= 3 and < modulus.") + + if public_exponent & 1 == 0: + raise ValueError("public_exponent must be odd.") + + if dmp1 & 1 == 0: + raise ValueError("dmp1 must be odd.") + + if dmq1 & 1 == 0: + raise ValueError("dmq1 must be odd.") + + if p * q != modulus: + raise ValueError("p*q must equal modulus.") + + +def _check_public_key_components(e: int, n: int) -> None: + if n < 3: + raise ValueError("n must be >= 3.") + + if e < 3 or e >= n: + raise ValueError("e must be >= 3 and < n.") + + if e & 1 == 0: + raise ValueError("e must be odd.") + + +def _modinv(e: int, m: int) -> int: + """ + Modular Multiplicative Inverse. Returns x such that: (x*e) mod m == 1 + """ + x1, x2 = 1, 0 + a, b = e, m + while b > 0: + q, r = divmod(a, b) + xn = x1 - q * x2 + a, b, x1, x2 = b, r, x2, xn + return x1 % m + + +def rsa_crt_iqmp(p: int, q: int) -> int: + """ + Compute the CRT (q ** -1) % p value from RSA primes p and q. + """ + return _modinv(q, p) + + +def rsa_crt_dmp1(private_exponent: int, p: int) -> int: + """ + Compute the CRT private_exponent % (p - 1) value from the RSA + private_exponent (d) and p. + """ + return private_exponent % (p - 1) + + +def rsa_crt_dmq1(private_exponent: int, q: int) -> int: + """ + Compute the CRT private_exponent % (q - 1) value from the RSA + private_exponent (d) and q. + """ + return private_exponent % (q - 1) + + +# Controls the number of iterations rsa_recover_prime_factors will perform +# to obtain the prime factors. Each iteration increments by 2 so the actual +# maximum attempts is half this number. +_MAX_RECOVERY_ATTEMPTS = 1000 + + +def rsa_recover_prime_factors( + n: int, e: int, d: int +) -> typing.Tuple[int, int]: + """ + Compute factors p and q from the private exponent d. We assume that n has + no more than two factors. This function is adapted from code in PyCrypto. + """ + # See 8.2.2(i) in Handbook of Applied Cryptography. + ktot = d * e - 1 + # The quantity d*e-1 is a multiple of phi(n), even, + # and can be represented as t*2^s. + t = ktot + while t % 2 == 0: + t = t // 2 + # Cycle through all multiplicative inverses in Zn. + # The algorithm is non-deterministic, but there is a 50% chance + # any candidate a leads to successful factoring. + # See "Digitalized Signatures and Public Key Functions as Intractable + # as Factorization", M. Rabin, 1979 + spotted = False + a = 2 + while not spotted and a < _MAX_RECOVERY_ATTEMPTS: + k = t + # Cycle through all values a^{t*2^i}=a^k + while k < ktot: + cand = pow(a, k, n) + # Check if a^k is a non-trivial root of unity (mod n) + if cand != 1 and cand != (n - 1) and pow(cand, 2, n) == 1: + # We have found a number such that (cand-1)(cand+1)=0 (mod n). + # Either of the terms divides n. + p = gcd(cand + 1, n) + spotted = True + break + k *= 2 + # This value was not any good... let's try another! + a += 2 + if not spotted: + raise ValueError("Unable to compute factors p and q from exponent d.") + # Found ! + q, r = divmod(n, p) + assert r == 0 + p, q = sorted((p, q), reverse=True) + return (p, q) + + +class RSAPrivateNumbers: + def __init__( + self, + p: int, + q: int, + d: int, + dmp1: int, + dmq1: int, + iqmp: int, + public_numbers: RSAPublicNumbers, + ): + if ( + not isinstance(p, int) + or not isinstance(q, int) + or not isinstance(d, int) + or not isinstance(dmp1, int) + or not isinstance(dmq1, int) + or not isinstance(iqmp, int) + ): + raise TypeError( + "RSAPrivateNumbers p, q, d, dmp1, dmq1, iqmp arguments must" + " all be an integers." + ) + + if not isinstance(public_numbers, RSAPublicNumbers): + raise TypeError( + "RSAPrivateNumbers public_numbers must be an RSAPublicNumbers" + " instance." + ) + + self._p = p + self._q = q + self._d = d + self._dmp1 = dmp1 + self._dmq1 = dmq1 + self._iqmp = iqmp + self._public_numbers = public_numbers + + @property + def p(self) -> int: + return self._p + + @property + def q(self) -> int: + return self._q + + @property + def d(self) -> int: + return self._d + + @property + def dmp1(self) -> int: + return self._dmp1 + + @property + def dmq1(self) -> int: + return self._dmq1 + + @property + def iqmp(self) -> int: + return self._iqmp + + @property + def public_numbers(self) -> RSAPublicNumbers: + return self._public_numbers + + def private_key( + self, + backend: typing.Any = None, + *, + unsafe_skip_rsa_key_validation: bool = False, + ) -> RSAPrivateKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_rsa_private_numbers( + self, unsafe_skip_rsa_key_validation + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RSAPrivateNumbers): + return NotImplemented + + return ( + self.p == other.p + and self.q == other.q + and self.d == other.d + and self.dmp1 == other.dmp1 + and self.dmq1 == other.dmq1 + and self.iqmp == other.iqmp + and self.public_numbers == other.public_numbers + ) + + def __hash__(self) -> int: + return hash( + ( + self.p, + self.q, + self.d, + self.dmp1, + self.dmq1, + self.iqmp, + self.public_numbers, + ) + ) + + +class RSAPublicNumbers: + def __init__(self, e: int, n: int): + if not isinstance(e, int) or not isinstance(n, int): + raise TypeError("RSAPublicNumbers arguments must be integers.") + + self._e = e + self._n = n + + @property + def e(self) -> int: + return self._e + + @property + def n(self) -> int: + return self._n + + def public_key(self, backend: typing.Any = None) -> RSAPublicKey: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + return ossl.load_rsa_public_numbers(self) + + def __repr__(self) -> str: + return "".format(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RSAPublicNumbers): + return NotImplemented + + return self.e == other.e and self.n == other.n + + def __hash__(self) -> int: + return hash((self.e, self.n)) diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/types.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/types.py new file mode 100644 index 0000000..1fe4eaf --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/types.py @@ -0,0 +1,111 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.hazmat.primitives.asymmetric import ( + dh, + dsa, + ec, + ed448, + ed25519, + rsa, + x448, + x25519, +) + +# Every asymmetric key type +PublicKeyTypes = typing.Union[ + dh.DHPublicKey, + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, + x25519.X25519PublicKey, + x448.X448PublicKey, +] +PUBLIC_KEY_TYPES = PublicKeyTypes +utils.deprecated( + PUBLIC_KEY_TYPES, + __name__, + "Use PublicKeyTypes instead", + utils.DeprecatedIn40, + name="PUBLIC_KEY_TYPES", +) +# Every asymmetric key type +PrivateKeyTypes = typing.Union[ + dh.DHPrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + x25519.X25519PrivateKey, + x448.X448PrivateKey, +] +PRIVATE_KEY_TYPES = PrivateKeyTypes +utils.deprecated( + PRIVATE_KEY_TYPES, + __name__, + "Use PrivateKeyTypes instead", + utils.DeprecatedIn40, + name="PRIVATE_KEY_TYPES", +) +# Just the key types we allow to be used for x509 signing. This mirrors +# the certificate public key types +CertificateIssuerPrivateKeyTypes = typing.Union[ + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, +] +CERTIFICATE_PRIVATE_KEY_TYPES = CertificateIssuerPrivateKeyTypes +utils.deprecated( + CERTIFICATE_PRIVATE_KEY_TYPES, + __name__, + "Use CertificateIssuerPrivateKeyTypes instead", + utils.DeprecatedIn40, + name="CERTIFICATE_PRIVATE_KEY_TYPES", +) +# Just the key types we allow to be used for x509 signing. This mirrors +# the certificate private key types +CertificateIssuerPublicKeyTypes = typing.Union[ + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, +] +CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES = CertificateIssuerPublicKeyTypes +utils.deprecated( + CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES, + __name__, + "Use CertificateIssuerPublicKeyTypes instead", + utils.DeprecatedIn40, + name="CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES", +) +# This type removes DHPublicKey. x448/x25519 can be a public key +# but cannot be used in signing so they are allowed here. +CertificatePublicKeyTypes = typing.Union[ + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, + x25519.X25519PublicKey, + x448.X448PublicKey, +] +CERTIFICATE_PUBLIC_KEY_TYPES = CertificatePublicKeyTypes +utils.deprecated( + CERTIFICATE_PUBLIC_KEY_TYPES, + __name__, + "Use CertificatePublicKeyTypes instead", + utils.DeprecatedIn40, + name="CERTIFICATE_PUBLIC_KEY_TYPES", +) diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/utils.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/utils.py new file mode 100644 index 0000000..826b956 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/utils.py @@ -0,0 +1,24 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.bindings._rust import asn1 +from cryptography.hazmat.primitives import hashes + +decode_dss_signature = asn1.decode_dss_signature +encode_dss_signature = asn1.encode_dss_signature + + +class Prehashed: + def __init__(self, algorithm: hashes.HashAlgorithm): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise TypeError("Expected instance of HashAlgorithm.") + + self._algorithm = algorithm + self._digest_size = algorithm.digest_size + + @property + def digest_size(self) -> int: + return self._digest_size diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/x25519.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/x25519.py new file mode 100644 index 0000000..699054c --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/x25519.py @@ -0,0 +1,113 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class X25519PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> X25519PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x25519_supported(): + raise UnsupportedAlgorithm( + "X25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x25519_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +# For LibreSSL +if hasattr(rust_openssl, "x25519"): + X25519PublicKey.register(rust_openssl.x25519.X25519PublicKey) + + +class X25519PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> X25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x25519_supported(): + raise UnsupportedAlgorithm( + "X25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + return backend.x25519_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> X25519PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x25519_supported(): + raise UnsupportedAlgorithm( + "X25519 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x25519_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> X25519PublicKey: + """ + Returns the public key assosciated with this private key + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + @abc.abstractmethod + def exchange(self, peer_public_key: X25519PublicKey) -> bytes: + """ + Performs a key exchange operation using the provided peer's public key. + """ + + +# For LibreSSL +if hasattr(rust_openssl, "x25519"): + X25519PrivateKey.register(rust_openssl.x25519.X25519PrivateKey) diff --git a/jwt/python/cryptography/hazmat/primitives/asymmetric/x448.py b/jwt/python/cryptography/hazmat/primitives/asymmetric/x448.py new file mode 100644 index 0000000..abf7848 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/asymmetric/x448.py @@ -0,0 +1,111 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import _serialization + + +class X448PublicKey(metaclass=abc.ABCMeta): + @classmethod + def from_public_bytes(cls, data: bytes) -> X448PublicKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x448_supported(): + raise UnsupportedAlgorithm( + "X448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x448_load_public_bytes(data) + + @abc.abstractmethod + def public_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PublicFormat, + ) -> bytes: + """ + The serialized bytes of the public key. + """ + + @abc.abstractmethod + def public_bytes_raw(self) -> bytes: + """ + The raw bytes of the public key. + Equivalent to public_bytes(Raw, Raw). + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + +if hasattr(rust_openssl, "x448"): + X448PublicKey.register(rust_openssl.x448.X448PublicKey) + + +class X448PrivateKey(metaclass=abc.ABCMeta): + @classmethod + def generate(cls) -> X448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x448_supported(): + raise UnsupportedAlgorithm( + "X448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + return backend.x448_generate_key() + + @classmethod + def from_private_bytes(cls, data: bytes) -> X448PrivateKey: + from cryptography.hazmat.backends.openssl.backend import backend + + if not backend.x448_supported(): + raise UnsupportedAlgorithm( + "X448 is not supported by this version of OpenSSL.", + _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM, + ) + + return backend.x448_load_private_bytes(data) + + @abc.abstractmethod + def public_key(self) -> X448PublicKey: + """ + Returns the public key associated with this private key + """ + + @abc.abstractmethod + def private_bytes( + self, + encoding: _serialization.Encoding, + format: _serialization.PrivateFormat, + encryption_algorithm: _serialization.KeySerializationEncryption, + ) -> bytes: + """ + The serialized bytes of the private key. + """ + + @abc.abstractmethod + def private_bytes_raw(self) -> bytes: + """ + The raw bytes of the private key. + Equivalent to private_bytes(Raw, Raw, NoEncryption()). + """ + + @abc.abstractmethod + def exchange(self, peer_public_key: X448PublicKey) -> bytes: + """ + Performs a key exchange operation using the provided peer's public key. + """ + + +if hasattr(rust_openssl, "x448"): + X448PrivateKey.register(rust_openssl.x448.X448PrivateKey) diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/__init__.py b/jwt/python/cryptography/hazmat/primitives/ciphers/__init__.py new file mode 100644 index 0000000..cc88fbf --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/ciphers/__init__.py @@ -0,0 +1,27 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.primitives._cipheralgorithm import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) +from cryptography.hazmat.primitives.ciphers.base import ( + AEADCipherContext, + AEADDecryptionContext, + AEADEncryptionContext, + Cipher, + CipherContext, +) + +__all__ = [ + "Cipher", + "CipherAlgorithm", + "BlockCipherAlgorithm", + "CipherContext", + "AEADCipherContext", + "AEADDecryptionContext", + "AEADEncryptionContext", +] diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b958ad0 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc new file mode 100644 index 0000000..c0a7b5b Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc new file mode 100644 index 0000000..511cf81 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..8910d4a Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc new file mode 100644 index 0000000..a2e7eae Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/aead.py b/jwt/python/cryptography/hazmat/primitives/ciphers/aead.py new file mode 100644 index 0000000..957b2d2 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/ciphers/aead.py @@ -0,0 +1,378 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import os +import typing + +from cryptography import exceptions, utils +from cryptography.hazmat.backends.openssl import aead +from cryptography.hazmat.backends.openssl.backend import backend +from cryptography.hazmat.bindings._rust import FixedPool + + +class ChaCha20Poly1305: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "ChaCha20Poly1305 is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + utils._check_byteslike("key", key) + + if len(key) != 32: + raise ValueError("ChaCha20Poly1305 key must be 32 bytes.") + + self._key = key + self._pool = FixedPool(self._create_fn) + + @classmethod + def generate_key(cls) -> bytes: + return os.urandom(32) + + def _create_fn(self): + return aead._aead_create_ctx(backend, self, self._key) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + with self._pool.acquire() as ctx: + return aead._encrypt( + backend, self, nonce, data, [associated_data], 16, ctx + ) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + with self._pool.acquire() as ctx: + return aead._decrypt( + backend, self, nonce, data, [associated_data], 16, ctx + ) + + def _check_params( + self, + nonce: bytes, + data: bytes, + associated_data: bytes, + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if len(nonce) != 12: + raise ValueError("Nonce must be 12 bytes") + + +class AESCCM: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes, tag_length: int = 16): + utils._check_byteslike("key", key) + if len(key) not in (16, 24, 32): + raise ValueError("AESCCM key must be 128, 192, or 256 bits.") + + self._key = key + if not isinstance(tag_length, int): + raise TypeError("tag_length must be an integer") + + if tag_length not in (4, 6, 8, 10, 12, 14, 16): + raise ValueError("Invalid tag_length") + + self._tag_length = tag_length + + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "AESCCM is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (128, 192, 256): + raise ValueError("bit_length must be 128, 192, or 256") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + self._validate_lengths(nonce, len(data)) + return aead._encrypt( + backend, self, nonce, data, [associated_data], self._tag_length + ) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + return aead._decrypt( + backend, self, nonce, data, [associated_data], self._tag_length + ) + + def _validate_lengths(self, nonce: bytes, data_len: int) -> None: + # For information about computing this, see + # https://tools.ietf.org/html/rfc3610#section-2.1 + l_val = 15 - len(nonce) + if 2 ** (8 * l_val) < data_len: + raise ValueError("Data too long for nonce") + + def _check_params( + self, nonce: bytes, data: bytes, associated_data: bytes + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if not 7 <= len(nonce) <= 13: + raise ValueError("Nonce must be between 7 and 13 bytes") + + +class AESGCM: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + utils._check_byteslike("key", key) + if len(key) not in (16, 24, 32): + raise ValueError("AESGCM key must be 128, 192, or 256 bits.") + + self._key = key + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (128, 192, 256): + raise ValueError("bit_length must be 128, 192, or 256") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + return aead._encrypt(backend, self, nonce, data, [associated_data], 16) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + return aead._decrypt(backend, self, nonce, data, [associated_data], 16) + + def _check_params( + self, + nonce: bytes, + data: bytes, + associated_data: bytes, + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if len(nonce) < 8 or len(nonce) > 128: + raise ValueError("Nonce must be between 8 and 128 bytes") + + +class AESOCB3: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + utils._check_byteslike("key", key) + if len(key) not in (16, 24, 32): + raise ValueError("AESOCB3 key must be 128, 192, or 256 bits.") + + self._key = key + + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "OCB3 is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (128, 192, 256): + raise ValueError("bit_length must be 128, 192, or 256") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE: + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + self._check_params(nonce, data, associated_data) + return aead._encrypt(backend, self, nonce, data, [associated_data], 16) + + def decrypt( + self, + nonce: bytes, + data: bytes, + associated_data: typing.Optional[bytes], + ) -> bytes: + if associated_data is None: + associated_data = b"" + + self._check_params(nonce, data, associated_data) + return aead._decrypt(backend, self, nonce, data, [associated_data], 16) + + def _check_params( + self, + nonce: bytes, + data: bytes, + associated_data: bytes, + ) -> None: + utils._check_byteslike("nonce", nonce) + utils._check_byteslike("data", data) + utils._check_byteslike("associated_data", associated_data) + if len(nonce) < 12 or len(nonce) > 15: + raise ValueError("Nonce must be between 12 and 15 bytes") + + +class AESSIV: + _MAX_SIZE = 2**31 - 1 + + def __init__(self, key: bytes): + utils._check_byteslike("key", key) + if len(key) not in (32, 48, 64): + raise ValueError("AESSIV key must be 256, 384, or 512 bits.") + + self._key = key + + if not backend.aead_cipher_supported(self): + raise exceptions.UnsupportedAlgorithm( + "AES-SIV is not supported by this version of OpenSSL", + exceptions._Reasons.UNSUPPORTED_CIPHER, + ) + + @classmethod + def generate_key(cls, bit_length: int) -> bytes: + if not isinstance(bit_length, int): + raise TypeError("bit_length must be an integer") + + if bit_length not in (256, 384, 512): + raise ValueError("bit_length must be 256, 384, or 512") + + return os.urandom(bit_length // 8) + + def encrypt( + self, + data: bytes, + associated_data: typing.Optional[typing.List[bytes]], + ) -> bytes: + if associated_data is None: + associated_data = [] + + self._check_params(data, associated_data) + + if len(data) > self._MAX_SIZE or any( + len(ad) > self._MAX_SIZE for ad in associated_data + ): + # This is OverflowError to match what cffi would raise + raise OverflowError( + "Data or associated data too long. Max 2**31 - 1 bytes" + ) + + return aead._encrypt(backend, self, b"", data, associated_data, 16) + + def decrypt( + self, + data: bytes, + associated_data: typing.Optional[typing.List[bytes]], + ) -> bytes: + if associated_data is None: + associated_data = [] + + self._check_params(data, associated_data) + + return aead._decrypt(backend, self, b"", data, associated_data, 16) + + def _check_params( + self, + data: bytes, + associated_data: typing.List[bytes], + ) -> None: + utils._check_byteslike("data", data) + if len(data) == 0: + raise ValueError("data must not be zero length") + + if not isinstance(associated_data, list): + raise TypeError( + "associated_data must be a list of bytes-like objects or None" + ) + for x in associated_data: + utils._check_byteslike("associated_data elements", x) diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/algorithms.py b/jwt/python/cryptography/hazmat/primitives/ciphers/algorithms.py new file mode 100644 index 0000000..4bfc5d8 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/ciphers/algorithms.py @@ -0,0 +1,228 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography import utils +from cryptography.hazmat.primitives.ciphers import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) + + +def _verify_key_size(algorithm: CipherAlgorithm, key: bytes) -> bytes: + # Verify that the key is instance of bytes + utils._check_byteslike("key", key) + + # Verify that the key size matches the expected key size + if len(key) * 8 not in algorithm.key_sizes: + raise ValueError( + "Invalid key size ({}) for {}.".format( + len(key) * 8, algorithm.name + ) + ) + return key + + +class AES(BlockCipherAlgorithm): + name = "AES" + block_size = 128 + # 512 added to support AES-256-XTS, which uses 512-bit keys + key_sizes = frozenset([128, 192, 256, 512]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class AES128(BlockCipherAlgorithm): + name = "AES" + block_size = 128 + key_sizes = frozenset([128]) + key_size = 128 + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + +class AES256(BlockCipherAlgorithm): + name = "AES" + block_size = 128 + key_sizes = frozenset([256]) + key_size = 256 + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + +class Camellia(BlockCipherAlgorithm): + name = "camellia" + block_size = 128 + key_sizes = frozenset([128, 192, 256]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class TripleDES(BlockCipherAlgorithm): + name = "3DES" + block_size = 64 + key_sizes = frozenset([64, 128, 192]) + + def __init__(self, key: bytes): + if len(key) == 8: + key += key + key + elif len(key) == 16: + key += key[:8] + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class Blowfish(BlockCipherAlgorithm): + name = "Blowfish" + block_size = 64 + key_sizes = frozenset(range(32, 449, 8)) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_BlowfishInternal = Blowfish +utils.deprecated( + Blowfish, + __name__, + "Blowfish has been deprecated", + utils.DeprecatedIn37, + name="Blowfish", +) + + +class CAST5(BlockCipherAlgorithm): + name = "CAST5" + block_size = 64 + key_sizes = frozenset(range(40, 129, 8)) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_CAST5Internal = CAST5 +utils.deprecated( + CAST5, + __name__, + "CAST5 has been deprecated", + utils.DeprecatedIn37, + name="CAST5", +) + + +class ARC4(CipherAlgorithm): + name = "RC4" + key_sizes = frozenset([40, 56, 64, 80, 128, 160, 192, 256]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class IDEA(BlockCipherAlgorithm): + name = "IDEA" + block_size = 64 + key_sizes = frozenset([128]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_IDEAInternal = IDEA +utils.deprecated( + IDEA, + __name__, + "IDEA has been deprecated", + utils.DeprecatedIn37, + name="IDEA", +) + + +class SEED(BlockCipherAlgorithm): + name = "SEED" + block_size = 128 + key_sizes = frozenset([128]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +_SEEDInternal = SEED +utils.deprecated( + SEED, + __name__, + "SEED has been deprecated", + utils.DeprecatedIn37, + name="SEED", +) + + +class ChaCha20(CipherAlgorithm): + name = "ChaCha20" + key_sizes = frozenset([256]) + + def __init__(self, key: bytes, nonce: bytes): + self.key = _verify_key_size(self, key) + utils._check_byteslike("nonce", nonce) + + if len(nonce) != 16: + raise ValueError("nonce must be 128-bits (16 bytes)") + + self._nonce = nonce + + @property + def nonce(self) -> bytes: + return self._nonce + + @property + def key_size(self) -> int: + return len(self.key) * 8 + + +class SM4(BlockCipherAlgorithm): + name = "SM4" + block_size = 128 + key_sizes = frozenset([128]) + + def __init__(self, key: bytes): + self.key = _verify_key_size(self, key) + + @property + def key_size(self) -> int: + return len(self.key) * 8 diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/base.py b/jwt/python/cryptography/hazmat/primitives/ciphers/base.py new file mode 100644 index 0000000..38a2ebb --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/ciphers/base.py @@ -0,0 +1,269 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.exceptions import ( + AlreadyFinalized, + AlreadyUpdated, + NotYetFinalized, +) +from cryptography.hazmat.primitives._cipheralgorithm import CipherAlgorithm +from cryptography.hazmat.primitives.ciphers import modes + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.ciphers import ( + _CipherContext as _BackendCipherContext, + ) + + +class CipherContext(metaclass=abc.ABCMeta): + @abc.abstractmethod + def update(self, data: bytes) -> bytes: + """ + Processes the provided bytes through the cipher and returns the results + as bytes. + """ + + @abc.abstractmethod + def update_into(self, data: bytes, buf: bytes) -> int: + """ + Processes the provided bytes and writes the resulting data into the + provided buffer. Returns the number of bytes written. + """ + + @abc.abstractmethod + def finalize(self) -> bytes: + """ + Returns the results of processing the final block as bytes. + """ + + +class AEADCipherContext(CipherContext, metaclass=abc.ABCMeta): + @abc.abstractmethod + def authenticate_additional_data(self, data: bytes) -> None: + """ + Authenticates the provided bytes. + """ + + +class AEADDecryptionContext(AEADCipherContext, metaclass=abc.ABCMeta): + @abc.abstractmethod + def finalize_with_tag(self, tag: bytes) -> bytes: + """ + Returns the results of processing the final block as bytes and allows + delayed passing of the authentication tag. + """ + + +class AEADEncryptionContext(AEADCipherContext, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def tag(self) -> bytes: + """ + Returns tag bytes. This is only available after encryption is + finalized. + """ + + +Mode = typing.TypeVar( + "Mode", bound=typing.Optional[modes.Mode], covariant=True +) + + +class Cipher(typing.Generic[Mode]): + def __init__( + self, + algorithm: CipherAlgorithm, + mode: Mode, + backend: typing.Any = None, + ) -> None: + if not isinstance(algorithm, CipherAlgorithm): + raise TypeError("Expected interface of CipherAlgorithm.") + + if mode is not None: + # mypy needs this assert to narrow the type from our generic + # type. Maybe it won't some time in the future. + assert isinstance(mode, modes.Mode) + mode.validate_for_algorithm(algorithm) + + self.algorithm = algorithm + self.mode = mode + + @typing.overload + def encryptor( + self: Cipher[modes.ModeWithAuthenticationTag], + ) -> AEADEncryptionContext: + ... + + @typing.overload + def encryptor( + self: _CIPHER_TYPE, + ) -> CipherContext: + ... + + def encryptor(self): + if isinstance(self.mode, modes.ModeWithAuthenticationTag): + if self.mode.tag is not None: + raise ValueError( + "Authentication tag must be None when encrypting." + ) + from cryptography.hazmat.backends.openssl.backend import backend + + ctx = backend.create_symmetric_encryption_ctx( + self.algorithm, self.mode + ) + return self._wrap_ctx(ctx, encrypt=True) + + @typing.overload + def decryptor( + self: Cipher[modes.ModeWithAuthenticationTag], + ) -> AEADDecryptionContext: + ... + + @typing.overload + def decryptor( + self: _CIPHER_TYPE, + ) -> CipherContext: + ... + + def decryptor(self): + from cryptography.hazmat.backends.openssl.backend import backend + + ctx = backend.create_symmetric_decryption_ctx( + self.algorithm, self.mode + ) + return self._wrap_ctx(ctx, encrypt=False) + + def _wrap_ctx( + self, ctx: _BackendCipherContext, encrypt: bool + ) -> typing.Union[ + AEADEncryptionContext, AEADDecryptionContext, CipherContext + ]: + if isinstance(self.mode, modes.ModeWithAuthenticationTag): + if encrypt: + return _AEADEncryptionContext(ctx) + else: + return _AEADDecryptionContext(ctx) + else: + return _CipherContext(ctx) + + +_CIPHER_TYPE = Cipher[ + typing.Union[ + modes.ModeWithNonce, + modes.ModeWithTweak, + None, + modes.ECB, + modes.ModeWithInitializationVector, + ] +] + + +class _CipherContext(CipherContext): + _ctx: typing.Optional[_BackendCipherContext] + + def __init__(self, ctx: _BackendCipherContext) -> None: + self._ctx = ctx + + def update(self, data: bytes) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return self._ctx.update(data) + + def update_into(self, data: bytes, buf: bytes) -> int: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return self._ctx.update_into(data, buf) + + def finalize(self) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + data = self._ctx.finalize() + self._ctx = None + return data + + +class _AEADCipherContext(AEADCipherContext): + _ctx: typing.Optional[_BackendCipherContext] + _tag: typing.Optional[bytes] + + def __init__(self, ctx: _BackendCipherContext) -> None: + self._ctx = ctx + self._bytes_processed = 0 + self._aad_bytes_processed = 0 + self._tag = None + self._updated = False + + def _check_limit(self, data_size: int) -> None: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + self._updated = True + self._bytes_processed += data_size + if self._bytes_processed > self._ctx._mode._MAX_ENCRYPTED_BYTES: + raise ValueError( + "{} has a maximum encrypted byte limit of {}".format( + self._ctx._mode.name, self._ctx._mode._MAX_ENCRYPTED_BYTES + ) + ) + + def update(self, data: bytes) -> bytes: + self._check_limit(len(data)) + # mypy needs this assert even though _check_limit already checked + assert self._ctx is not None + return self._ctx.update(data) + + def update_into(self, data: bytes, buf: bytes) -> int: + self._check_limit(len(data)) + # mypy needs this assert even though _check_limit already checked + assert self._ctx is not None + return self._ctx.update_into(data, buf) + + def finalize(self) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + data = self._ctx.finalize() + self._tag = self._ctx.tag + self._ctx = None + return data + + def authenticate_additional_data(self, data: bytes) -> None: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + if self._updated: + raise AlreadyUpdated("Update has been called on this context.") + + self._aad_bytes_processed += len(data) + if self._aad_bytes_processed > self._ctx._mode._MAX_AAD_BYTES: + raise ValueError( + "{} has a maximum AAD byte limit of {}".format( + self._ctx._mode.name, self._ctx._mode._MAX_AAD_BYTES + ) + ) + + self._ctx.authenticate_additional_data(data) + + +class _AEADDecryptionContext(_AEADCipherContext, AEADDecryptionContext): + def finalize_with_tag(self, tag: bytes) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + data = self._ctx.finalize_with_tag(tag) + self._tag = self._ctx.tag + self._ctx = None + return data + + +class _AEADEncryptionContext(_AEADCipherContext, AEADEncryptionContext): + @property + def tag(self) -> bytes: + if self._ctx is not None: + raise NotYetFinalized( + "You must finalize encryption before " "getting the tag." + ) + assert self._tag is not None + return self._tag diff --git a/jwt/python/cryptography/hazmat/primitives/ciphers/modes.py b/jwt/python/cryptography/hazmat/primitives/ciphers/modes.py new file mode 100644 index 0000000..d8ea188 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/ciphers/modes.py @@ -0,0 +1,274 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.exceptions import UnsupportedAlgorithm, _Reasons +from cryptography.hazmat.primitives._cipheralgorithm import ( + BlockCipherAlgorithm, + CipherAlgorithm, +) +from cryptography.hazmat.primitives.ciphers import algorithms + + +class Mode(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this mode (e.g. "ECB", "CBC"). + """ + + @abc.abstractmethod + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + """ + Checks that all the necessary invariants of this (mode, algorithm) + combination are met. + """ + + +class ModeWithInitializationVector(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def initialization_vector(self) -> bytes: + """ + The value of the initialization vector for this mode as bytes. + """ + + +class ModeWithTweak(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def tweak(self) -> bytes: + """ + The value of the tweak for this mode as bytes. + """ + + +class ModeWithNonce(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def nonce(self) -> bytes: + """ + The value of the nonce for this mode as bytes. + """ + + +class ModeWithAuthenticationTag(Mode, metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def tag(self) -> typing.Optional[bytes]: + """ + The value of the tag supplied to the constructor of this mode. + """ + + +def _check_aes_key_length(self: Mode, algorithm: CipherAlgorithm) -> None: + if algorithm.key_size > 256 and algorithm.name == "AES": + raise ValueError( + "Only 128, 192, and 256 bit keys are allowed for this AES mode" + ) + + +def _check_iv_length( + self: ModeWithInitializationVector, algorithm: BlockCipherAlgorithm +) -> None: + if len(self.initialization_vector) * 8 != algorithm.block_size: + raise ValueError( + "Invalid IV size ({}) for {}.".format( + len(self.initialization_vector), self.name + ) + ) + + +def _check_nonce_length( + nonce: bytes, name: str, algorithm: CipherAlgorithm +) -> None: + if not isinstance(algorithm, BlockCipherAlgorithm): + raise UnsupportedAlgorithm( + f"{name} requires a block cipher algorithm", + _Reasons.UNSUPPORTED_CIPHER, + ) + if len(nonce) * 8 != algorithm.block_size: + raise ValueError(f"Invalid nonce size ({len(nonce)}) for {name}.") + + +def _check_iv_and_key_length( + self: ModeWithInitializationVector, algorithm: CipherAlgorithm +) -> None: + if not isinstance(algorithm, BlockCipherAlgorithm): + raise UnsupportedAlgorithm( + f"{self} requires a block cipher algorithm", + _Reasons.UNSUPPORTED_CIPHER, + ) + _check_aes_key_length(self, algorithm) + _check_iv_length(self, algorithm) + + +class CBC(ModeWithInitializationVector): + name = "CBC" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class XTS(ModeWithTweak): + name = "XTS" + + def __init__(self, tweak: bytes): + utils._check_byteslike("tweak", tweak) + + if len(tweak) != 16: + raise ValueError("tweak must be 128-bits (16 bytes)") + + self._tweak = tweak + + @property + def tweak(self) -> bytes: + return self._tweak + + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + if isinstance(algorithm, (algorithms.AES128, algorithms.AES256)): + raise TypeError( + "The AES128 and AES256 classes do not support XTS, please use " + "the standard AES class instead." + ) + + if algorithm.key_size not in (256, 512): + raise ValueError( + "The XTS specification requires a 256-bit key for AES-128-XTS" + " and 512-bit key for AES-256-XTS" + ) + + +class ECB(Mode): + name = "ECB" + + validate_for_algorithm = _check_aes_key_length + + +class OFB(ModeWithInitializationVector): + name = "OFB" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class CFB(ModeWithInitializationVector): + name = "CFB" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class CFB8(ModeWithInitializationVector): + name = "CFB8" + + def __init__(self, initialization_vector: bytes): + utils._check_byteslike("initialization_vector", initialization_vector) + self._initialization_vector = initialization_vector + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + validate_for_algorithm = _check_iv_and_key_length + + +class CTR(ModeWithNonce): + name = "CTR" + + def __init__(self, nonce: bytes): + utils._check_byteslike("nonce", nonce) + self._nonce = nonce + + @property + def nonce(self) -> bytes: + return self._nonce + + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + _check_aes_key_length(self, algorithm) + _check_nonce_length(self.nonce, self.name, algorithm) + + +class GCM(ModeWithInitializationVector, ModeWithAuthenticationTag): + name = "GCM" + _MAX_ENCRYPTED_BYTES = (2**39 - 256) // 8 + _MAX_AAD_BYTES = (2**64) // 8 + + def __init__( + self, + initialization_vector: bytes, + tag: typing.Optional[bytes] = None, + min_tag_length: int = 16, + ): + # OpenSSL 3.0.0 constrains GCM IVs to [64, 1024] bits inclusive + # This is a sane limit anyway so we'll enforce it here. + utils._check_byteslike("initialization_vector", initialization_vector) + if len(initialization_vector) < 8 or len(initialization_vector) > 128: + raise ValueError( + "initialization_vector must be between 8 and 128 bytes (64 " + "and 1024 bits)." + ) + self._initialization_vector = initialization_vector + if tag is not None: + utils._check_bytes("tag", tag) + if min_tag_length < 4: + raise ValueError("min_tag_length must be >= 4") + if len(tag) < min_tag_length: + raise ValueError( + "Authentication tag must be {} bytes or longer.".format( + min_tag_length + ) + ) + self._tag = tag + self._min_tag_length = min_tag_length + + @property + def tag(self) -> typing.Optional[bytes]: + return self._tag + + @property + def initialization_vector(self) -> bytes: + return self._initialization_vector + + def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: + _check_aes_key_length(self, algorithm) + if not isinstance(algorithm, BlockCipherAlgorithm): + raise UnsupportedAlgorithm( + "GCM requires a block cipher algorithm", + _Reasons.UNSUPPORTED_CIPHER, + ) + block_size_bytes = algorithm.block_size // 8 + if self._tag is not None and len(self._tag) > block_size_bytes: + raise ValueError( + "Authentication tag cannot be more than {} bytes.".format( + block_size_bytes + ) + ) diff --git a/jwt/python/cryptography/hazmat/primitives/cmac.py b/jwt/python/cryptography/hazmat/primitives/cmac.py new file mode 100644 index 0000000..8aa1d79 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/cmac.py @@ -0,0 +1,65 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized +from cryptography.hazmat.primitives import ciphers + +if typing.TYPE_CHECKING: + from cryptography.hazmat.backends.openssl.cmac import _CMACContext + + +class CMAC: + _ctx: typing.Optional[_CMACContext] + _algorithm: ciphers.BlockCipherAlgorithm + + def __init__( + self, + algorithm: ciphers.BlockCipherAlgorithm, + backend: typing.Any = None, + ctx: typing.Optional[_CMACContext] = None, + ) -> None: + if not isinstance(algorithm, ciphers.BlockCipherAlgorithm): + raise TypeError("Expected instance of BlockCipherAlgorithm.") + self._algorithm = algorithm + + if ctx is None: + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + self._ctx = ossl.create_cmac_ctx(self._algorithm) + else: + self._ctx = ctx + + def update(self, data: bytes) -> None: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + + utils._check_bytes("data", data) + self._ctx.update(data) + + def finalize(self) -> bytes: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + digest = self._ctx.finalize() + self._ctx = None + return digest + + def verify(self, signature: bytes) -> None: + utils._check_bytes("signature", signature) + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + + ctx, self._ctx = self._ctx, None + ctx.verify(signature) + + def copy(self) -> CMAC: + if self._ctx is None: + raise AlreadyFinalized("Context was already finalized.") + return CMAC(self._algorithm, ctx=self._ctx.copy()) diff --git a/jwt/python/cryptography/hazmat/primitives/constant_time.py b/jwt/python/cryptography/hazmat/primitives/constant_time.py new file mode 100644 index 0000000..3975c71 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/constant_time.py @@ -0,0 +1,14 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import hmac + + +def bytes_eq(a: bytes, b: bytes) -> bool: + if not isinstance(a, bytes) or not isinstance(b, bytes): + raise TypeError("a and b must be bytes.") + + return hmac.compare_digest(a, b) diff --git a/jwt/python/cryptography/hazmat/primitives/hashes.py b/jwt/python/cryptography/hazmat/primitives/hashes.py new file mode 100644 index 0000000..b6a7ff1 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/hashes.py @@ -0,0 +1,243 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl + +__all__ = [ + "HashAlgorithm", + "HashContext", + "Hash", + "ExtendableOutputFunction", + "SHA1", + "SHA512_224", + "SHA512_256", + "SHA224", + "SHA256", + "SHA384", + "SHA512", + "SHA3_224", + "SHA3_256", + "SHA3_384", + "SHA3_512", + "SHAKE128", + "SHAKE256", + "MD5", + "BLAKE2b", + "BLAKE2s", + "SM3", +] + + +class HashAlgorithm(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def name(self) -> str: + """ + A string naming this algorithm (e.g. "sha256", "md5"). + """ + + @property + @abc.abstractmethod + def digest_size(self) -> int: + """ + The size of the resulting digest in bytes. + """ + + @property + @abc.abstractmethod + def block_size(self) -> typing.Optional[int]: + """ + The internal block size of the hash function, or None if the hash + function does not use blocks internally (e.g. SHA3). + """ + + +class HashContext(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def algorithm(self) -> HashAlgorithm: + """ + A HashAlgorithm that will be used by this context. + """ + + @abc.abstractmethod + def update(self, data: bytes) -> None: + """ + Processes the provided bytes through the hash. + """ + + @abc.abstractmethod + def finalize(self) -> bytes: + """ + Finalizes the hash context and returns the hash digest as bytes. + """ + + @abc.abstractmethod + def copy(self) -> HashContext: + """ + Return a HashContext that is a copy of the current context. + """ + + +Hash = rust_openssl.hashes.Hash +HashContext.register(Hash) + + +class ExtendableOutputFunction(metaclass=abc.ABCMeta): + """ + An interface for extendable output functions. + """ + + +class SHA1(HashAlgorithm): + name = "sha1" + digest_size = 20 + block_size = 64 + + +class SHA512_224(HashAlgorithm): # noqa: N801 + name = "sha512-224" + digest_size = 28 + block_size = 128 + + +class SHA512_256(HashAlgorithm): # noqa: N801 + name = "sha512-256" + digest_size = 32 + block_size = 128 + + +class SHA224(HashAlgorithm): + name = "sha224" + digest_size = 28 + block_size = 64 + + +class SHA256(HashAlgorithm): + name = "sha256" + digest_size = 32 + block_size = 64 + + +class SHA384(HashAlgorithm): + name = "sha384" + digest_size = 48 + block_size = 128 + + +class SHA512(HashAlgorithm): + name = "sha512" + digest_size = 64 + block_size = 128 + + +class SHA3_224(HashAlgorithm): # noqa: N801 + name = "sha3-224" + digest_size = 28 + block_size = None + + +class SHA3_256(HashAlgorithm): # noqa: N801 + name = "sha3-256" + digest_size = 32 + block_size = None + + +class SHA3_384(HashAlgorithm): # noqa: N801 + name = "sha3-384" + digest_size = 48 + block_size = None + + +class SHA3_512(HashAlgorithm): # noqa: N801 + name = "sha3-512" + digest_size = 64 + block_size = None + + +class SHAKE128(HashAlgorithm, ExtendableOutputFunction): + name = "shake128" + block_size = None + + def __init__(self, digest_size: int): + if not isinstance(digest_size, int): + raise TypeError("digest_size must be an integer") + + if digest_size < 1: + raise ValueError("digest_size must be a positive integer") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class SHAKE256(HashAlgorithm, ExtendableOutputFunction): + name = "shake256" + block_size = None + + def __init__(self, digest_size: int): + if not isinstance(digest_size, int): + raise TypeError("digest_size must be an integer") + + if digest_size < 1: + raise ValueError("digest_size must be a positive integer") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class MD5(HashAlgorithm): + name = "md5" + digest_size = 16 + block_size = 64 + + +class BLAKE2b(HashAlgorithm): + name = "blake2b" + _max_digest_size = 64 + _min_digest_size = 1 + block_size = 128 + + def __init__(self, digest_size: int): + if digest_size != 64: + raise ValueError("Digest size must be 64") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class BLAKE2s(HashAlgorithm): + name = "blake2s" + block_size = 64 + _max_digest_size = 32 + _min_digest_size = 1 + + def __init__(self, digest_size: int): + if digest_size != 32: + raise ValueError("Digest size must be 32") + + self._digest_size = digest_size + + @property + def digest_size(self) -> int: + return self._digest_size + + +class SM3(HashAlgorithm): + name = "sm3" + digest_size = 32 + block_size = 64 diff --git a/jwt/python/cryptography/hazmat/primitives/hmac.py b/jwt/python/cryptography/hazmat/primitives/hmac.py new file mode 100644 index 0000000..a9442d5 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/hmac.py @@ -0,0 +1,13 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import hashes + +__all__ = ["HMAC"] + +HMAC = rust_openssl.hmac.HMAC +hashes.HashContext.register(HMAC) diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__init__.py b/jwt/python/cryptography/hazmat/primitives/kdf/__init__.py new file mode 100644 index 0000000..79bb459 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/kdf/__init__.py @@ -0,0 +1,23 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc + + +class KeyDerivationFunction(metaclass=abc.ABCMeta): + @abc.abstractmethod + def derive(self, key_material: bytes) -> bytes: + """ + Deterministically generates and returns a new key based on the existing + key material. + """ + + @abc.abstractmethod + def verify(self, key_material: bytes, expected_key: bytes) -> None: + """ + Checks whether the key generated by the key material matches the + expected derived key. Raises an exception if they do not match. + """ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..7eb3b69 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc new file mode 100644 index 0000000..14bfc96 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc new file mode 100644 index 0000000..e00178f Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc new file mode 100644 index 0000000..6a9c0ff Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc new file mode 100644 index 0000000..c232dda Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc new file mode 100644 index 0000000..80ff4bb Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc new file mode 100644 index 0000000..a99ac91 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/concatkdf.py b/jwt/python/cryptography/hazmat/primitives/kdf/concatkdf.py new file mode 100644 index 0000000..d5ea58a --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/kdf/concatkdf.py @@ -0,0 +1,124 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized, InvalidKey +from cryptography.hazmat.primitives import constant_time, hashes, hmac +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +def _int_to_u32be(n: int) -> bytes: + return n.to_bytes(length=4, byteorder="big") + + +def _common_args_checks( + algorithm: hashes.HashAlgorithm, + length: int, + otherinfo: typing.Optional[bytes], +) -> None: + max_length = algorithm.digest_size * (2**32 - 1) + if length > max_length: + raise ValueError(f"Cannot derive keys larger than {max_length} bits.") + if otherinfo is not None: + utils._check_bytes("otherinfo", otherinfo) + + +def _concatkdf_derive( + key_material: bytes, + length: int, + auxfn: typing.Callable[[], hashes.HashContext], + otherinfo: bytes, +) -> bytes: + utils._check_byteslike("key_material", key_material) + output = [b""] + outlen = 0 + counter = 1 + + while length > outlen: + h = auxfn() + h.update(_int_to_u32be(counter)) + h.update(key_material) + h.update(otherinfo) + output.append(h.finalize()) + outlen += len(output[-1]) + counter += 1 + + return b"".join(output)[:length] + + +class ConcatKDFHash(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + otherinfo: typing.Optional[bytes], + backend: typing.Any = None, + ): + _common_args_checks(algorithm, length, otherinfo) + self._algorithm = algorithm + self._length = length + self._otherinfo: bytes = otherinfo if otherinfo is not None else b"" + + self._used = False + + def _hash(self) -> hashes.Hash: + return hashes.Hash(self._algorithm) + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized + self._used = True + return _concatkdf_derive( + key_material, self._length, self._hash, self._otherinfo + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey + + +class ConcatKDFHMAC(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + salt: typing.Optional[bytes], + otherinfo: typing.Optional[bytes], + backend: typing.Any = None, + ): + _common_args_checks(algorithm, length, otherinfo) + self._algorithm = algorithm + self._length = length + self._otherinfo: bytes = otherinfo if otherinfo is not None else b"" + + if algorithm.block_size is None: + raise TypeError(f"{algorithm.name} is unsupported for ConcatKDF") + + if salt is None: + salt = b"\x00" * algorithm.block_size + else: + utils._check_bytes("salt", salt) + + self._salt = salt + + self._used = False + + def _hmac(self) -> hmac.HMAC: + return hmac.HMAC(self._salt, self._algorithm) + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized + self._used = True + return _concatkdf_derive( + key_material, self._length, self._hmac, self._otherinfo + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/hkdf.py b/jwt/python/cryptography/hazmat/primitives/kdf/hkdf.py new file mode 100644 index 0000000..d476894 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/kdf/hkdf.py @@ -0,0 +1,101 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized, InvalidKey +from cryptography.hazmat.primitives import constant_time, hashes, hmac +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +class HKDF(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + salt: typing.Optional[bytes], + info: typing.Optional[bytes], + backend: typing.Any = None, + ): + self._algorithm = algorithm + + if salt is None: + salt = b"\x00" * self._algorithm.digest_size + else: + utils._check_bytes("salt", salt) + + self._salt = salt + + self._hkdf_expand = HKDFExpand(self._algorithm, length, info) + + def _extract(self, key_material: bytes) -> bytes: + h = hmac.HMAC(self._salt, self._algorithm) + h.update(key_material) + return h.finalize() + + def derive(self, key_material: bytes) -> bytes: + utils._check_byteslike("key_material", key_material) + return self._hkdf_expand.derive(self._extract(key_material)) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey + + +class HKDFExpand(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + info: typing.Optional[bytes], + backend: typing.Any = None, + ): + self._algorithm = algorithm + + max_length = 255 * algorithm.digest_size + + if length > max_length: + raise ValueError( + f"Cannot derive keys larger than {max_length} octets." + ) + + self._length = length + + if info is None: + info = b"" + else: + utils._check_bytes("info", info) + + self._info = info + + self._used = False + + def _expand(self, key_material: bytes) -> bytes: + output = [b""] + counter = 1 + + while self._algorithm.digest_size * (len(output) - 1) < self._length: + h = hmac.HMAC(key_material, self._algorithm) + h.update(output[-1]) + h.update(self._info) + h.update(bytes([counter])) + output.append(h.finalize()) + counter += 1 + + return b"".join(output)[: self._length] + + def derive(self, key_material: bytes) -> bytes: + utils._check_byteslike("key_material", key_material) + if self._used: + raise AlreadyFinalized + + self._used = True + return self._expand(key_material) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/kbkdf.py b/jwt/python/cryptography/hazmat/primitives/kdf/kbkdf.py new file mode 100644 index 0000000..9677638 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/kdf/kbkdf.py @@ -0,0 +1,299 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import ( + AlreadyFinalized, + InvalidKey, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.primitives import ( + ciphers, + cmac, + constant_time, + hashes, + hmac, +) +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +class Mode(utils.Enum): + CounterMode = "ctr" + + +class CounterLocation(utils.Enum): + BeforeFixed = "before_fixed" + AfterFixed = "after_fixed" + MiddleFixed = "middle_fixed" + + +class _KBKDFDeriver: + def __init__( + self, + prf: typing.Callable, + mode: Mode, + length: int, + rlen: int, + llen: typing.Optional[int], + location: CounterLocation, + break_location: typing.Optional[int], + label: typing.Optional[bytes], + context: typing.Optional[bytes], + fixed: typing.Optional[bytes], + ): + assert callable(prf) + + if not isinstance(mode, Mode): + raise TypeError("mode must be of type Mode") + + if not isinstance(location, CounterLocation): + raise TypeError("location must be of type CounterLocation") + + if break_location is None and location is CounterLocation.MiddleFixed: + raise ValueError("Please specify a break_location") + + if ( + break_location is not None + and location != CounterLocation.MiddleFixed + ): + raise ValueError( + "break_location is ignored when location is not" + " CounterLocation.MiddleFixed" + ) + + if break_location is not None and not isinstance(break_location, int): + raise TypeError("break_location must be an integer") + + if break_location is not None and break_location < 0: + raise ValueError("break_location must be a positive integer") + + if (label or context) and fixed: + raise ValueError( + "When supplying fixed data, " "label and context are ignored." + ) + + if rlen is None or not self._valid_byte_length(rlen): + raise ValueError("rlen must be between 1 and 4") + + if llen is None and fixed is None: + raise ValueError("Please specify an llen") + + if llen is not None and not isinstance(llen, int): + raise TypeError("llen must be an integer") + + if label is None: + label = b"" + + if context is None: + context = b"" + + utils._check_bytes("label", label) + utils._check_bytes("context", context) + self._prf = prf + self._mode = mode + self._length = length + self._rlen = rlen + self._llen = llen + self._location = location + self._break_location = break_location + self._label = label + self._context = context + self._used = False + self._fixed_data = fixed + + @staticmethod + def _valid_byte_length(value: int) -> bool: + if not isinstance(value, int): + raise TypeError("value must be of type int") + + value_bin = utils.int_to_bytes(1, value) + if not 1 <= len(value_bin) <= 4: + return False + return True + + def derive(self, key_material: bytes, prf_output_size: int) -> bytes: + if self._used: + raise AlreadyFinalized + + utils._check_byteslike("key_material", key_material) + self._used = True + + # inverse floor division (equivalent to ceiling) + rounds = -(-self._length // prf_output_size) + + output = [b""] + + # For counter mode, the number of iterations shall not be + # larger than 2^r-1, where r <= 32 is the binary length of the counter + # This ensures that the counter values used as an input to the + # PRF will not repeat during a particular call to the KDF function. + r_bin = utils.int_to_bytes(1, self._rlen) + if rounds > pow(2, len(r_bin) * 8) - 1: + raise ValueError("There are too many iterations.") + + fixed = self._generate_fixed_input() + + if self._location == CounterLocation.BeforeFixed: + data_before_ctr = b"" + data_after_ctr = fixed + elif self._location == CounterLocation.AfterFixed: + data_before_ctr = fixed + data_after_ctr = b"" + else: + if isinstance( + self._break_location, int + ) and self._break_location > len(fixed): + raise ValueError("break_location offset > len(fixed)") + data_before_ctr = fixed[: self._break_location] + data_after_ctr = fixed[self._break_location :] + + for i in range(1, rounds + 1): + h = self._prf(key_material) + + counter = utils.int_to_bytes(i, self._rlen) + input_data = data_before_ctr + counter + data_after_ctr + + h.update(input_data) + + output.append(h.finalize()) + + return b"".join(output)[: self._length] + + def _generate_fixed_input(self) -> bytes: + if self._fixed_data and isinstance(self._fixed_data, bytes): + return self._fixed_data + + l_val = utils.int_to_bytes(self._length * 8, self._llen) + + return b"".join([self._label, b"\x00", self._context, l_val]) + + +class KBKDFHMAC(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + mode: Mode, + length: int, + rlen: int, + llen: typing.Optional[int], + location: CounterLocation, + label: typing.Optional[bytes], + context: typing.Optional[bytes], + fixed: typing.Optional[bytes], + backend: typing.Any = None, + *, + break_location: typing.Optional[int] = None, + ): + if not isinstance(algorithm, hashes.HashAlgorithm): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported hash algorithm.", + _Reasons.UNSUPPORTED_HASH, + ) + + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.hmac_supported(algorithm): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported hmac algorithm.", + _Reasons.UNSUPPORTED_HASH, + ) + + self._algorithm = algorithm + + self._deriver = _KBKDFDeriver( + self._prf, + mode, + length, + rlen, + llen, + location, + break_location, + label, + context, + fixed, + ) + + def _prf(self, key_material: bytes) -> hmac.HMAC: + return hmac.HMAC(key_material, self._algorithm) + + def derive(self, key_material: bytes) -> bytes: + return self._deriver.derive(key_material, self._algorithm.digest_size) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey + + +class KBKDFCMAC(KeyDerivationFunction): + def __init__( + self, + algorithm, + mode: Mode, + length: int, + rlen: int, + llen: typing.Optional[int], + location: CounterLocation, + label: typing.Optional[bytes], + context: typing.Optional[bytes], + fixed: typing.Optional[bytes], + backend: typing.Any = None, + *, + break_location: typing.Optional[int] = None, + ): + if not issubclass( + algorithm, ciphers.BlockCipherAlgorithm + ) or not issubclass(algorithm, ciphers.CipherAlgorithm): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported cipher algorithm.", + _Reasons.UNSUPPORTED_CIPHER, + ) + + self._algorithm = algorithm + self._cipher: typing.Optional[ciphers.BlockCipherAlgorithm] = None + + self._deriver = _KBKDFDeriver( + self._prf, + mode, + length, + rlen, + llen, + location, + break_location, + label, + context, + fixed, + ) + + def _prf(self, _: bytes) -> cmac.CMAC: + assert self._cipher is not None + + return cmac.CMAC(self._cipher) + + def derive(self, key_material: bytes) -> bytes: + self._cipher = self._algorithm(key_material) + + assert self._cipher is not None + + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.cmac_algorithm_supported(self._cipher): + raise UnsupportedAlgorithm( + "Algorithm supplied is not a supported cipher algorithm.", + _Reasons.UNSUPPORTED_CIPHER, + ) + + return self._deriver.derive(key_material, self._cipher.block_size // 8) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/pbkdf2.py b/jwt/python/cryptography/hazmat/primitives/kdf/pbkdf2.py new file mode 100644 index 0000000..623e1ca --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/kdf/pbkdf2.py @@ -0,0 +1,64 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import ( + AlreadyFinalized, + InvalidKey, + UnsupportedAlgorithm, + _Reasons, +) +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import constant_time, hashes +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +class PBKDF2HMAC(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + salt: bytes, + iterations: int, + backend: typing.Any = None, + ): + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.pbkdf2_hmac_supported(algorithm): + raise UnsupportedAlgorithm( + "{} is not supported for PBKDF2 by this backend.".format( + algorithm.name + ), + _Reasons.UNSUPPORTED_HASH, + ) + self._used = False + self._algorithm = algorithm + self._length = length + utils._check_bytes("salt", salt) + self._salt = salt + self._iterations = iterations + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized("PBKDF2 instances can only be used once.") + self._used = True + + return rust_openssl.kdf.derive_pbkdf2_hmac( + key_material, + self._algorithm, + self._salt, + self._iterations, + self._length, + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + derived_key = self.derive(key_material) + if not constant_time.bytes_eq(derived_key, expected_key): + raise InvalidKey("Keys do not match.") diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/scrypt.py b/jwt/python/cryptography/hazmat/primitives/kdf/scrypt.py new file mode 100644 index 0000000..05a4f67 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/kdf/scrypt.py @@ -0,0 +1,80 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import sys +import typing + +from cryptography import utils +from cryptography.exceptions import ( + AlreadyFinalized, + InvalidKey, + UnsupportedAlgorithm, +) +from cryptography.hazmat.bindings._rust import openssl as rust_openssl +from cryptography.hazmat.primitives import constant_time +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + +# This is used by the scrypt tests to skip tests that require more memory +# than the MEM_LIMIT +_MEM_LIMIT = sys.maxsize // 2 + + +class Scrypt(KeyDerivationFunction): + def __init__( + self, + salt: bytes, + length: int, + n: int, + r: int, + p: int, + backend: typing.Any = None, + ): + from cryptography.hazmat.backends.openssl.backend import ( + backend as ossl, + ) + + if not ossl.scrypt_supported(): + raise UnsupportedAlgorithm( + "This version of OpenSSL does not support scrypt" + ) + self._length = length + utils._check_bytes("salt", salt) + if n < 2 or (n & (n - 1)) != 0: + raise ValueError("n must be greater than 1 and be a power of 2.") + + if r < 1: + raise ValueError("r must be greater than or equal to 1.") + + if p < 1: + raise ValueError("p must be greater than or equal to 1.") + + self._used = False + self._salt = salt + self._n = n + self._r = r + self._p = p + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized("Scrypt instances can only be used once.") + self._used = True + + utils._check_byteslike("key_material", key_material) + + return rust_openssl.kdf.derive_scrypt( + key_material, + self._salt, + self._n, + self._r, + self._p, + _MEM_LIMIT, + self._length, + ) + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + derived_key = self.derive(key_material) + if not constant_time.bytes_eq(derived_key, expected_key): + raise InvalidKey("Keys do not match.") diff --git a/jwt/python/cryptography/hazmat/primitives/kdf/x963kdf.py b/jwt/python/cryptography/hazmat/primitives/kdf/x963kdf.py new file mode 100644 index 0000000..17acc51 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/kdf/x963kdf.py @@ -0,0 +1,61 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized, InvalidKey +from cryptography.hazmat.primitives import constant_time, hashes +from cryptography.hazmat.primitives.kdf import KeyDerivationFunction + + +def _int_to_u32be(n: int) -> bytes: + return n.to_bytes(length=4, byteorder="big") + + +class X963KDF(KeyDerivationFunction): + def __init__( + self, + algorithm: hashes.HashAlgorithm, + length: int, + sharedinfo: typing.Optional[bytes], + backend: typing.Any = None, + ): + max_len = algorithm.digest_size * (2**32 - 1) + if length > max_len: + raise ValueError(f"Cannot derive keys larger than {max_len} bits.") + if sharedinfo is not None: + utils._check_bytes("sharedinfo", sharedinfo) + + self._algorithm = algorithm + self._length = length + self._sharedinfo = sharedinfo + self._used = False + + def derive(self, key_material: bytes) -> bytes: + if self._used: + raise AlreadyFinalized + self._used = True + utils._check_byteslike("key_material", key_material) + output = [b""] + outlen = 0 + counter = 1 + + while self._length > outlen: + h = hashes.Hash(self._algorithm) + h.update(key_material) + h.update(_int_to_u32be(counter)) + if self._sharedinfo is not None: + h.update(self._sharedinfo) + output.append(h.finalize()) + outlen += len(output[-1]) + counter += 1 + + return b"".join(output)[: self._length] + + def verify(self, key_material: bytes, expected_key: bytes) -> None: + if not constant_time.bytes_eq(self.derive(key_material), expected_key): + raise InvalidKey diff --git a/jwt/python/cryptography/hazmat/primitives/keywrap.py b/jwt/python/cryptography/hazmat/primitives/keywrap.py new file mode 100644 index 0000000..59b0326 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/keywrap.py @@ -0,0 +1,177 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives.ciphers import Cipher +from cryptography.hazmat.primitives.ciphers.algorithms import AES +from cryptography.hazmat.primitives.ciphers.modes import ECB +from cryptography.hazmat.primitives.constant_time import bytes_eq + + +def _wrap_core( + wrapping_key: bytes, + a: bytes, + r: typing.List[bytes], +) -> bytes: + # RFC 3394 Key Wrap - 2.2.1 (index method) + encryptor = Cipher(AES(wrapping_key), ECB()).encryptor() + n = len(r) + for j in range(6): + for i in range(n): + # every encryption operation is a discrete 16 byte chunk (because + # AES has a 128-bit block size) and since we're using ECB it is + # safe to reuse the encryptor for the entire operation + b = encryptor.update(a + r[i]) + a = ( + int.from_bytes(b[:8], byteorder="big") ^ ((n * j) + i + 1) + ).to_bytes(length=8, byteorder="big") + r[i] = b[-8:] + + assert encryptor.finalize() == b"" + + return a + b"".join(r) + + +def aes_key_wrap( + wrapping_key: bytes, + key_to_wrap: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + if len(key_to_wrap) < 16: + raise ValueError("The key to wrap must be at least 16 bytes") + + if len(key_to_wrap) % 8 != 0: + raise ValueError("The key to wrap must be a multiple of 8 bytes") + + a = b"\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6" + r = [key_to_wrap[i : i + 8] for i in range(0, len(key_to_wrap), 8)] + return _wrap_core(wrapping_key, a, r) + + +def _unwrap_core( + wrapping_key: bytes, + a: bytes, + r: typing.List[bytes], +) -> typing.Tuple[bytes, typing.List[bytes]]: + # Implement RFC 3394 Key Unwrap - 2.2.2 (index method) + decryptor = Cipher(AES(wrapping_key), ECB()).decryptor() + n = len(r) + for j in reversed(range(6)): + for i in reversed(range(n)): + atr = ( + int.from_bytes(a, byteorder="big") ^ ((n * j) + i + 1) + ).to_bytes(length=8, byteorder="big") + r[i] + # every decryption operation is a discrete 16 byte chunk so + # it is safe to reuse the decryptor for the entire operation + b = decryptor.update(atr) + a = b[:8] + r[i] = b[-8:] + + assert decryptor.finalize() == b"" + return a, r + + +def aes_key_wrap_with_padding( + wrapping_key: bytes, + key_to_wrap: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + aiv = b"\xA6\x59\x59\xA6" + len(key_to_wrap).to_bytes( + length=4, byteorder="big" + ) + # pad the key to wrap if necessary + pad = (8 - (len(key_to_wrap) % 8)) % 8 + key_to_wrap = key_to_wrap + b"\x00" * pad + if len(key_to_wrap) == 8: + # RFC 5649 - 4.1 - exactly 8 octets after padding + encryptor = Cipher(AES(wrapping_key), ECB()).encryptor() + b = encryptor.update(aiv + key_to_wrap) + assert encryptor.finalize() == b"" + return b + else: + r = [key_to_wrap[i : i + 8] for i in range(0, len(key_to_wrap), 8)] + return _wrap_core(wrapping_key, aiv, r) + + +def aes_key_unwrap_with_padding( + wrapping_key: bytes, + wrapped_key: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapped_key) < 16: + raise InvalidUnwrap("Must be at least 16 bytes") + + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + if len(wrapped_key) == 16: + # RFC 5649 - 4.2 - exactly two 64-bit blocks + decryptor = Cipher(AES(wrapping_key), ECB()).decryptor() + out = decryptor.update(wrapped_key) + assert decryptor.finalize() == b"" + a = out[:8] + data = out[8:] + n = 1 + else: + r = [wrapped_key[i : i + 8] for i in range(0, len(wrapped_key), 8)] + encrypted_aiv = r.pop(0) + n = len(r) + a, r = _unwrap_core(wrapping_key, encrypted_aiv, r) + data = b"".join(r) + + # 1) Check that MSB(32,A) = A65959A6. + # 2) Check that 8*(n-1) < LSB(32,A) <= 8*n. If so, let + # MLI = LSB(32,A). + # 3) Let b = (8*n)-MLI, and then check that the rightmost b octets of + # the output data are zero. + mli = int.from_bytes(a[4:], byteorder="big") + b = (8 * n) - mli + if ( + not bytes_eq(a[:4], b"\xa6\x59\x59\xa6") + or not 8 * (n - 1) < mli <= 8 * n + or (b != 0 and not bytes_eq(data[-b:], b"\x00" * b)) + ): + raise InvalidUnwrap() + + if b == 0: + return data + else: + return data[:-b] + + +def aes_key_unwrap( + wrapping_key: bytes, + wrapped_key: bytes, + backend: typing.Any = None, +) -> bytes: + if len(wrapped_key) < 24: + raise InvalidUnwrap("Must be at least 24 bytes") + + if len(wrapped_key) % 8 != 0: + raise InvalidUnwrap("The wrapped key must be a multiple of 8 bytes") + + if len(wrapping_key) not in [16, 24, 32]: + raise ValueError("The wrapping key must be a valid AES key length") + + aiv = b"\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6" + r = [wrapped_key[i : i + 8] for i in range(0, len(wrapped_key), 8)] + a = r.pop(0) + a, r = _unwrap_core(wrapping_key, a, r) + if not bytes_eq(a, aiv): + raise InvalidUnwrap() + + return b"".join(r) + + +class InvalidUnwrap(Exception): + pass diff --git a/jwt/python/cryptography/hazmat/primitives/padding.py b/jwt/python/cryptography/hazmat/primitives/padding.py new file mode 100644 index 0000000..fde3094 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/padding.py @@ -0,0 +1,225 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import typing + +from cryptography import utils +from cryptography.exceptions import AlreadyFinalized +from cryptography.hazmat.bindings._rust import ( + check_ansix923_padding, + check_pkcs7_padding, +) + + +class PaddingContext(metaclass=abc.ABCMeta): + @abc.abstractmethod + def update(self, data: bytes) -> bytes: + """ + Pads the provided bytes and returns any available data as bytes. + """ + + @abc.abstractmethod + def finalize(self) -> bytes: + """ + Finalize the padding, returns bytes. + """ + + +def _byte_padding_check(block_size: int) -> None: + if not (0 <= block_size <= 2040): + raise ValueError("block_size must be in range(0, 2041).") + + if block_size % 8 != 0: + raise ValueError("block_size must be a multiple of 8.") + + +def _byte_padding_update( + buffer_: typing.Optional[bytes], data: bytes, block_size: int +) -> typing.Tuple[bytes, bytes]: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + utils._check_byteslike("data", data) + + buffer_ += bytes(data) + + finished_blocks = len(buffer_) // (block_size // 8) + + result = buffer_[: finished_blocks * (block_size // 8)] + buffer_ = buffer_[finished_blocks * (block_size // 8) :] + + return buffer_, result + + +def _byte_padding_pad( + buffer_: typing.Optional[bytes], + block_size: int, + paddingfn: typing.Callable[[int], bytes], +) -> bytes: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + pad_size = block_size // 8 - len(buffer_) + return buffer_ + paddingfn(pad_size) + + +def _byte_unpadding_update( + buffer_: typing.Optional[bytes], data: bytes, block_size: int +) -> typing.Tuple[bytes, bytes]: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + utils._check_byteslike("data", data) + + buffer_ += bytes(data) + + finished_blocks = max(len(buffer_) // (block_size // 8) - 1, 0) + + result = buffer_[: finished_blocks * (block_size // 8)] + buffer_ = buffer_[finished_blocks * (block_size // 8) :] + + return buffer_, result + + +def _byte_unpadding_check( + buffer_: typing.Optional[bytes], + block_size: int, + checkfn: typing.Callable[[bytes], int], +) -> bytes: + if buffer_ is None: + raise AlreadyFinalized("Context was already finalized.") + + if len(buffer_) != block_size // 8: + raise ValueError("Invalid padding bytes.") + + valid = checkfn(buffer_) + + if not valid: + raise ValueError("Invalid padding bytes.") + + pad_size = buffer_[-1] + return buffer_[:-pad_size] + + +class PKCS7: + def __init__(self, block_size: int): + _byte_padding_check(block_size) + self.block_size = block_size + + def padder(self) -> PaddingContext: + return _PKCS7PaddingContext(self.block_size) + + def unpadder(self) -> PaddingContext: + return _PKCS7UnpaddingContext(self.block_size) + + +class _PKCS7PaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_padding_update( + self._buffer, data, self.block_size + ) + return result + + def _padding(self, size: int) -> bytes: + return bytes([size]) * size + + def finalize(self) -> bytes: + result = _byte_padding_pad( + self._buffer, self.block_size, self._padding + ) + self._buffer = None + return result + + +class _PKCS7UnpaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_unpadding_update( + self._buffer, data, self.block_size + ) + return result + + def finalize(self) -> bytes: + result = _byte_unpadding_check( + self._buffer, self.block_size, check_pkcs7_padding + ) + self._buffer = None + return result + + +class ANSIX923: + def __init__(self, block_size: int): + _byte_padding_check(block_size) + self.block_size = block_size + + def padder(self) -> PaddingContext: + return _ANSIX923PaddingContext(self.block_size) + + def unpadder(self) -> PaddingContext: + return _ANSIX923UnpaddingContext(self.block_size) + + +class _ANSIX923PaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_padding_update( + self._buffer, data, self.block_size + ) + return result + + def _padding(self, size: int) -> bytes: + return bytes([0]) * (size - 1) + bytes([size]) + + def finalize(self) -> bytes: + result = _byte_padding_pad( + self._buffer, self.block_size, self._padding + ) + self._buffer = None + return result + + +class _ANSIX923UnpaddingContext(PaddingContext): + _buffer: typing.Optional[bytes] + + def __init__(self, block_size: int): + self.block_size = block_size + # TODO: more copies than necessary, we should use zero-buffer (#193) + self._buffer = b"" + + def update(self, data: bytes) -> bytes: + self._buffer, result = _byte_unpadding_update( + self._buffer, data, self.block_size + ) + return result + + def finalize(self) -> bytes: + result = _byte_unpadding_check( + self._buffer, + self.block_size, + check_ansix923_padding, + ) + self._buffer = None + return result diff --git a/jwt/python/cryptography/hazmat/primitives/poly1305.py b/jwt/python/cryptography/hazmat/primitives/poly1305.py new file mode 100644 index 0000000..7f5a77a --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/poly1305.py @@ -0,0 +1,11 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.bindings._rust import openssl as rust_openssl + +__all__ = ["Poly1305"] + +Poly1305 = rust_openssl.poly1305.Poly1305 diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/__init__.py b/jwt/python/cryptography/hazmat/primitives/serialization/__init__.py new file mode 100644 index 0000000..b6c9a5c --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/serialization/__init__.py @@ -0,0 +1,63 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat.primitives._serialization import ( + BestAvailableEncryption, + Encoding, + KeySerializationEncryption, + NoEncryption, + ParameterFormat, + PrivateFormat, + PublicFormat, + _KeySerializationEncryption, +) +from cryptography.hazmat.primitives.serialization.base import ( + load_der_parameters, + load_der_private_key, + load_der_public_key, + load_pem_parameters, + load_pem_private_key, + load_pem_public_key, +) +from cryptography.hazmat.primitives.serialization.ssh import ( + SSHCertificate, + SSHCertificateBuilder, + SSHCertificateType, + SSHCertPrivateKeyTypes, + SSHCertPublicKeyTypes, + SSHPrivateKeyTypes, + SSHPublicKeyTypes, + load_ssh_private_key, + load_ssh_public_identity, + load_ssh_public_key, +) + +__all__ = [ + "load_der_parameters", + "load_der_private_key", + "load_der_public_key", + "load_pem_parameters", + "load_pem_private_key", + "load_pem_public_key", + "load_ssh_private_key", + "load_ssh_public_identity", + "load_ssh_public_key", + "Encoding", + "PrivateFormat", + "PublicFormat", + "ParameterFormat", + "KeySerializationEncryption", + "BestAvailableEncryption", + "NoEncryption", + "_KeySerializationEncryption", + "SSHCertificateBuilder", + "SSHCertificate", + "SSHCertificateType", + "SSHCertPublicKeyTypes", + "SSHCertPrivateKeyTypes", + "SSHPrivateKeyTypes", + "SSHPublicKeyTypes", +] diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..774a7ac Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..d8ac2b2 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc new file mode 100644 index 0000000..4003b12 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc new file mode 100644 index 0000000..f55a23c Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc new file mode 100644 index 0000000..5f23e8c Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/base.py b/jwt/python/cryptography/hazmat/primitives/serialization/base.py new file mode 100644 index 0000000..18a96cc --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/serialization/base.py @@ -0,0 +1,73 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives.asymmetric import dh +from cryptography.hazmat.primitives.asymmetric.types import ( + PrivateKeyTypes, + PublicKeyTypes, +) + + +def load_pem_private_key( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, + *, + unsafe_skip_rsa_key_validation: bool = False, +) -> PrivateKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pem_private_key( + data, password, unsafe_skip_rsa_key_validation + ) + + +def load_pem_public_key( + data: bytes, backend: typing.Any = None +) -> PublicKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pem_public_key(data) + + +def load_pem_parameters( + data: bytes, backend: typing.Any = None +) -> dh.DHParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pem_parameters(data) + + +def load_der_private_key( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, + *, + unsafe_skip_rsa_key_validation: bool = False, +) -> PrivateKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_der_private_key( + data, password, unsafe_skip_rsa_key_validation + ) + + +def load_der_public_key( + data: bytes, backend: typing.Any = None +) -> PublicKeyTypes: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_der_public_key(data) + + +def load_der_parameters( + data: bytes, backend: typing.Any = None +) -> dh.DHParameters: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_der_parameters(data) diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/pkcs12.py b/jwt/python/cryptography/hazmat/primitives/serialization/pkcs12.py new file mode 100644 index 0000000..27133a3 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/serialization/pkcs12.py @@ -0,0 +1,229 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography import x509 +from cryptography.hazmat.primitives import serialization +from cryptography.hazmat.primitives._serialization import PBES as PBES +from cryptography.hazmat.primitives.asymmetric import ( + dsa, + ec, + ed448, + ed25519, + rsa, +) +from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes + +__all__ = [ + "PBES", + "PKCS12PrivateKeyTypes", + "PKCS12Certificate", + "PKCS12KeyAndCertificates", + "load_key_and_certificates", + "load_pkcs12", + "serialize_key_and_certificates", +] + +PKCS12PrivateKeyTypes = typing.Union[ + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, +] + + +class PKCS12Certificate: + def __init__( + self, + cert: x509.Certificate, + friendly_name: typing.Optional[bytes], + ): + if not isinstance(cert, x509.Certificate): + raise TypeError("Expecting x509.Certificate object") + if friendly_name is not None and not isinstance(friendly_name, bytes): + raise TypeError("friendly_name must be bytes or None") + self._cert = cert + self._friendly_name = friendly_name + + @property + def friendly_name(self) -> typing.Optional[bytes]: + return self._friendly_name + + @property + def certificate(self) -> x509.Certificate: + return self._cert + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PKCS12Certificate): + return NotImplemented + + return ( + self.certificate == other.certificate + and self.friendly_name == other.friendly_name + ) + + def __hash__(self) -> int: + return hash((self.certificate, self.friendly_name)) + + def __repr__(self) -> str: + return "".format( + self.certificate, self.friendly_name + ) + + +class PKCS12KeyAndCertificates: + def __init__( + self, + key: typing.Optional[PrivateKeyTypes], + cert: typing.Optional[PKCS12Certificate], + additional_certs: typing.List[PKCS12Certificate], + ): + if key is not None and not isinstance( + key, + ( + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + ), + ): + raise TypeError( + "Key must be RSA, DSA, EllipticCurve, ED25519, or ED448" + " private key, or None." + ) + if cert is not None and not isinstance(cert, PKCS12Certificate): + raise TypeError("cert must be a PKCS12Certificate object or None") + if not all( + isinstance(add_cert, PKCS12Certificate) + for add_cert in additional_certs + ): + raise TypeError( + "all values in additional_certs must be PKCS12Certificate" + " objects" + ) + self._key = key + self._cert = cert + self._additional_certs = additional_certs + + @property + def key(self) -> typing.Optional[PrivateKeyTypes]: + return self._key + + @property + def cert(self) -> typing.Optional[PKCS12Certificate]: + return self._cert + + @property + def additional_certs(self) -> typing.List[PKCS12Certificate]: + return self._additional_certs + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PKCS12KeyAndCertificates): + return NotImplemented + + return ( + self.key == other.key + and self.cert == other.cert + and self.additional_certs == other.additional_certs + ) + + def __hash__(self) -> int: + return hash((self.key, self.cert, tuple(self.additional_certs))) + + def __repr__(self) -> str: + fmt = ( + "" + ) + return fmt.format(self.key, self.cert, self.additional_certs) + + +def load_key_and_certificates( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, +) -> typing.Tuple[ + typing.Optional[PrivateKeyTypes], + typing.Optional[x509.Certificate], + typing.List[x509.Certificate], +]: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_key_and_certificates_from_pkcs12(data, password) + + +def load_pkcs12( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, +) -> PKCS12KeyAndCertificates: + from cryptography.hazmat.backends.openssl.backend import backend as ossl + + return ossl.load_pkcs12(data, password) + + +_PKCS12CATypes = typing.Union[ + x509.Certificate, + PKCS12Certificate, +] + + +def serialize_key_and_certificates( + name: typing.Optional[bytes], + key: typing.Optional[PKCS12PrivateKeyTypes], + cert: typing.Optional[x509.Certificate], + cas: typing.Optional[typing.Iterable[_PKCS12CATypes]], + encryption_algorithm: serialization.KeySerializationEncryption, +) -> bytes: + if key is not None and not isinstance( + key, + ( + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, + ), + ): + raise TypeError( + "Key must be RSA, DSA, EllipticCurve, ED25519, or ED448" + " private key, or None." + ) + if cert is not None and not isinstance(cert, x509.Certificate): + raise TypeError("cert must be a certificate or None") + + if cas is not None: + cas = list(cas) + if not all( + isinstance( + val, + ( + x509.Certificate, + PKCS12Certificate, + ), + ) + for val in cas + ): + raise TypeError("all values in cas must be certificates") + + if not isinstance( + encryption_algorithm, serialization.KeySerializationEncryption + ): + raise TypeError( + "Key encryption algorithm must be a " + "KeySerializationEncryption instance" + ) + + if key is None and cert is None and not cas: + raise ValueError("You must supply at least one of key, cert, or cas") + + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.serialize_key_and_certificates_to_pkcs12( + name, key, cert, cas, encryption_algorithm + ) diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/pkcs7.py b/jwt/python/cryptography/hazmat/primitives/serialization/pkcs7.py new file mode 100644 index 0000000..9998bca --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/serialization/pkcs7.py @@ -0,0 +1,235 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import email.base64mime +import email.generator +import email.message +import email.policy +import io +import typing + +from cryptography import utils, x509 +from cryptography.hazmat.bindings._rust import pkcs7 as rust_pkcs7 +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import ec, rsa +from cryptography.utils import _check_byteslike + + +def load_pem_pkcs7_certificates(data: bytes) -> typing.List[x509.Certificate]: + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.load_pem_pkcs7_certificates(data) + + +def load_der_pkcs7_certificates(data: bytes) -> typing.List[x509.Certificate]: + from cryptography.hazmat.backends.openssl.backend import backend + + return backend.load_der_pkcs7_certificates(data) + + +def serialize_certificates( + certs: typing.List[x509.Certificate], + encoding: serialization.Encoding, +) -> bytes: + return rust_pkcs7.serialize_certificates(certs, encoding) + + +PKCS7HashTypes = typing.Union[ + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, +] + +PKCS7PrivateKeyTypes = typing.Union[ + rsa.RSAPrivateKey, ec.EllipticCurvePrivateKey +] + + +class PKCS7Options(utils.Enum): + Text = "Add text/plain MIME type" + Binary = "Don't translate input data into canonical MIME format" + DetachedSignature = "Don't embed data in the PKCS7 structure" + NoCapabilities = "Don't embed SMIME capabilities" + NoAttributes = "Don't embed authenticatedAttributes" + NoCerts = "Don't embed signer certificate" + + +class PKCS7SignatureBuilder: + def __init__( + self, + data: typing.Optional[bytes] = None, + signers: typing.List[ + typing.Tuple[ + x509.Certificate, + PKCS7PrivateKeyTypes, + PKCS7HashTypes, + ] + ] = [], + additional_certs: typing.List[x509.Certificate] = [], + ): + self._data = data + self._signers = signers + self._additional_certs = additional_certs + + def set_data(self, data: bytes) -> PKCS7SignatureBuilder: + _check_byteslike("data", data) + if self._data is not None: + raise ValueError("data may only be set once") + + return PKCS7SignatureBuilder(data, self._signers) + + def add_signer( + self, + certificate: x509.Certificate, + private_key: PKCS7PrivateKeyTypes, + hash_algorithm: PKCS7HashTypes, + ) -> PKCS7SignatureBuilder: + if not isinstance( + hash_algorithm, + ( + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + ), + ): + raise TypeError( + "hash_algorithm must be one of hashes.SHA224, " + "SHA256, SHA384, or SHA512" + ) + if not isinstance(certificate, x509.Certificate): + raise TypeError("certificate must be a x509.Certificate") + + if not isinstance( + private_key, (rsa.RSAPrivateKey, ec.EllipticCurvePrivateKey) + ): + raise TypeError("Only RSA & EC keys are supported at this time.") + + return PKCS7SignatureBuilder( + self._data, + self._signers + [(certificate, private_key, hash_algorithm)], + ) + + def add_certificate( + self, certificate: x509.Certificate + ) -> PKCS7SignatureBuilder: + if not isinstance(certificate, x509.Certificate): + raise TypeError("certificate must be a x509.Certificate") + + return PKCS7SignatureBuilder( + self._data, self._signers, self._additional_certs + [certificate] + ) + + def sign( + self, + encoding: serialization.Encoding, + options: typing.Iterable[PKCS7Options], + backend: typing.Any = None, + ) -> bytes: + if len(self._signers) == 0: + raise ValueError("Must have at least one signer") + if self._data is None: + raise ValueError("You must add data to sign") + options = list(options) + if not all(isinstance(x, PKCS7Options) for x in options): + raise ValueError("options must be from the PKCS7Options enum") + if encoding not in ( + serialization.Encoding.PEM, + serialization.Encoding.DER, + serialization.Encoding.SMIME, + ): + raise ValueError( + "Must be PEM, DER, or SMIME from the Encoding enum" + ) + + # Text is a meaningless option unless it is accompanied by + # DetachedSignature + if ( + PKCS7Options.Text in options + and PKCS7Options.DetachedSignature not in options + ): + raise ValueError( + "When passing the Text option you must also pass " + "DetachedSignature" + ) + + if PKCS7Options.Text in options and encoding in ( + serialization.Encoding.DER, + serialization.Encoding.PEM, + ): + raise ValueError( + "The Text option is only available for SMIME serialization" + ) + + # No attributes implies no capabilities so we'll error if you try to + # pass both. + if ( + PKCS7Options.NoAttributes in options + and PKCS7Options.NoCapabilities in options + ): + raise ValueError( + "NoAttributes is a superset of NoCapabilities. Do not pass " + "both values." + ) + + return rust_pkcs7.sign_and_serialize(self, encoding, options) + + +def _smime_encode( + data: bytes, signature: bytes, micalg: str, text_mode: bool +) -> bytes: + # This function works pretty hard to replicate what OpenSSL does + # precisely. For good and for ill. + + m = email.message.Message() + m.add_header("MIME-Version", "1.0") + m.add_header( + "Content-Type", + "multipart/signed", + protocol="application/x-pkcs7-signature", + micalg=micalg, + ) + + m.preamble = "This is an S/MIME signed message\n" + + msg_part = OpenSSLMimePart() + msg_part.set_payload(data) + if text_mode: + msg_part.add_header("Content-Type", "text/plain") + m.attach(msg_part) + + sig_part = email.message.MIMEPart() + sig_part.add_header( + "Content-Type", "application/x-pkcs7-signature", name="smime.p7s" + ) + sig_part.add_header("Content-Transfer-Encoding", "base64") + sig_part.add_header( + "Content-Disposition", "attachment", filename="smime.p7s" + ) + sig_part.set_payload( + email.base64mime.body_encode(signature, maxlinelen=65) + ) + del sig_part["MIME-Version"] + m.attach(sig_part) + + fp = io.BytesIO() + g = email.generator.BytesGenerator( + fp, + maxheaderlen=0, + mangle_from_=False, + policy=m.policy.clone(linesep="\r\n"), + ) + g.flatten(m) + return fp.getvalue() + + +class OpenSSLMimePart(email.message.MIMEPart): + # A MIMEPart subclass that replicates OpenSSL's behavior of not including + # a newline if there are no headers. + def _write_headers(self, generator) -> None: + if list(self.raw_items()): + generator._write_headers(self) diff --git a/jwt/python/cryptography/hazmat/primitives/serialization/ssh.py b/jwt/python/cryptography/hazmat/primitives/serialization/ssh.py new file mode 100644 index 0000000..35e53c1 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/serialization/ssh.py @@ -0,0 +1,1534 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import binascii +import enum +import os +import re +import typing +import warnings +from base64 import encodebytes as _base64_encode +from dataclasses import dataclass + +from cryptography import utils +from cryptography.exceptions import UnsupportedAlgorithm +from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.primitives.asymmetric import ( + dsa, + ec, + ed25519, + padding, + rsa, +) +from cryptography.hazmat.primitives.asymmetric import utils as asym_utils +from cryptography.hazmat.primitives.ciphers import ( + AEADDecryptionContext, + Cipher, + algorithms, + modes, +) +from cryptography.hazmat.primitives.serialization import ( + Encoding, + KeySerializationEncryption, + NoEncryption, + PrivateFormat, + PublicFormat, + _KeySerializationEncryption, +) + +try: + from bcrypt import kdf as _bcrypt_kdf + + _bcrypt_supported = True +except ImportError: + _bcrypt_supported = False + + def _bcrypt_kdf( + password: bytes, + salt: bytes, + desired_key_bytes: int, + rounds: int, + ignore_few_rounds: bool = False, + ) -> bytes: + raise UnsupportedAlgorithm("Need bcrypt module") + + +_SSH_ED25519 = b"ssh-ed25519" +_SSH_RSA = b"ssh-rsa" +_SSH_DSA = b"ssh-dss" +_ECDSA_NISTP256 = b"ecdsa-sha2-nistp256" +_ECDSA_NISTP384 = b"ecdsa-sha2-nistp384" +_ECDSA_NISTP521 = b"ecdsa-sha2-nistp521" +_CERT_SUFFIX = b"-cert-v01@openssh.com" + +# These are not key types, only algorithms, so they cannot appear +# as a public key type +_SSH_RSA_SHA256 = b"rsa-sha2-256" +_SSH_RSA_SHA512 = b"rsa-sha2-512" + +_SSH_PUBKEY_RC = re.compile(rb"\A(\S+)[ \t]+(\S+)") +_SK_MAGIC = b"openssh-key-v1\0" +_SK_START = b"-----BEGIN OPENSSH PRIVATE KEY-----" +_SK_END = b"-----END OPENSSH PRIVATE KEY-----" +_BCRYPT = b"bcrypt" +_NONE = b"none" +_DEFAULT_CIPHER = b"aes256-ctr" +_DEFAULT_ROUNDS = 16 + +# re is only way to work on bytes-like data +_PEM_RC = re.compile(_SK_START + b"(.*?)" + _SK_END, re.DOTALL) + +# padding for max blocksize +_PADDING = memoryview(bytearray(range(1, 1 + 16))) + + +@dataclass +class _SSHCipher: + alg: typing.Type[algorithms.AES] + key_len: int + mode: typing.Union[ + typing.Type[modes.CTR], + typing.Type[modes.CBC], + typing.Type[modes.GCM], + ] + block_len: int + iv_len: int + tag_len: typing.Optional[int] + is_aead: bool + + +# ciphers that are actually used in key wrapping +_SSH_CIPHERS: typing.Dict[bytes, _SSHCipher] = { + b"aes256-ctr": _SSHCipher( + alg=algorithms.AES, + key_len=32, + mode=modes.CTR, + block_len=16, + iv_len=16, + tag_len=None, + is_aead=False, + ), + b"aes256-cbc": _SSHCipher( + alg=algorithms.AES, + key_len=32, + mode=modes.CBC, + block_len=16, + iv_len=16, + tag_len=None, + is_aead=False, + ), + b"aes256-gcm@openssh.com": _SSHCipher( + alg=algorithms.AES, + key_len=32, + mode=modes.GCM, + block_len=16, + iv_len=12, + tag_len=16, + is_aead=True, + ), +} + +# map local curve name to key type +_ECDSA_KEY_TYPE = { + "secp256r1": _ECDSA_NISTP256, + "secp384r1": _ECDSA_NISTP384, + "secp521r1": _ECDSA_NISTP521, +} + + +def _get_ssh_key_type( + key: typing.Union[SSHPrivateKeyTypes, SSHPublicKeyTypes] +) -> bytes: + if isinstance(key, ec.EllipticCurvePrivateKey): + key_type = _ecdsa_key_type(key.public_key()) + elif isinstance(key, ec.EllipticCurvePublicKey): + key_type = _ecdsa_key_type(key) + elif isinstance(key, (rsa.RSAPrivateKey, rsa.RSAPublicKey)): + key_type = _SSH_RSA + elif isinstance(key, (dsa.DSAPrivateKey, dsa.DSAPublicKey)): + key_type = _SSH_DSA + elif isinstance( + key, (ed25519.Ed25519PrivateKey, ed25519.Ed25519PublicKey) + ): + key_type = _SSH_ED25519 + else: + raise ValueError("Unsupported key type") + + return key_type + + +def _ecdsa_key_type(public_key: ec.EllipticCurvePublicKey) -> bytes: + """Return SSH key_type and curve_name for private key.""" + curve = public_key.curve + if curve.name not in _ECDSA_KEY_TYPE: + raise ValueError( + f"Unsupported curve for ssh private key: {curve.name!r}" + ) + return _ECDSA_KEY_TYPE[curve.name] + + +def _ssh_pem_encode( + data: bytes, + prefix: bytes = _SK_START + b"\n", + suffix: bytes = _SK_END + b"\n", +) -> bytes: + return b"".join([prefix, _base64_encode(data), suffix]) + + +def _check_block_size(data: bytes, block_len: int) -> None: + """Require data to be full blocks""" + if not data or len(data) % block_len != 0: + raise ValueError("Corrupt data: missing padding") + + +def _check_empty(data: bytes) -> None: + """All data should have been parsed.""" + if data: + raise ValueError("Corrupt data: unparsed data") + + +def _init_cipher( + ciphername: bytes, + password: typing.Optional[bytes], + salt: bytes, + rounds: int, +) -> Cipher[typing.Union[modes.CBC, modes.CTR, modes.GCM]]: + """Generate key + iv and return cipher.""" + if not password: + raise ValueError("Key is password-protected.") + + ciph = _SSH_CIPHERS[ciphername] + seed = _bcrypt_kdf( + password, salt, ciph.key_len + ciph.iv_len, rounds, True + ) + return Cipher( + ciph.alg(seed[: ciph.key_len]), + ciph.mode(seed[ciph.key_len :]), + ) + + +def _get_u32(data: memoryview) -> typing.Tuple[int, memoryview]: + """Uint32""" + if len(data) < 4: + raise ValueError("Invalid data") + return int.from_bytes(data[:4], byteorder="big"), data[4:] + + +def _get_u64(data: memoryview) -> typing.Tuple[int, memoryview]: + """Uint64""" + if len(data) < 8: + raise ValueError("Invalid data") + return int.from_bytes(data[:8], byteorder="big"), data[8:] + + +def _get_sshstr(data: memoryview) -> typing.Tuple[memoryview, memoryview]: + """Bytes with u32 length prefix""" + n, data = _get_u32(data) + if n > len(data): + raise ValueError("Invalid data") + return data[:n], data[n:] + + +def _get_mpint(data: memoryview) -> typing.Tuple[int, memoryview]: + """Big integer.""" + val, data = _get_sshstr(data) + if val and val[0] > 0x7F: + raise ValueError("Invalid data") + return int.from_bytes(val, "big"), data + + +def _to_mpint(val: int) -> bytes: + """Storage format for signed bigint.""" + if val < 0: + raise ValueError("negative mpint not allowed") + if not val: + return b"" + nbytes = (val.bit_length() + 8) // 8 + return utils.int_to_bytes(val, nbytes) + + +class _FragList: + """Build recursive structure without data copy.""" + + flist: typing.List[bytes] + + def __init__( + self, init: typing.Optional[typing.List[bytes]] = None + ) -> None: + self.flist = [] + if init: + self.flist.extend(init) + + def put_raw(self, val: bytes) -> None: + """Add plain bytes""" + self.flist.append(val) + + def put_u32(self, val: int) -> None: + """Big-endian uint32""" + self.flist.append(val.to_bytes(length=4, byteorder="big")) + + def put_u64(self, val: int) -> None: + """Big-endian uint64""" + self.flist.append(val.to_bytes(length=8, byteorder="big")) + + def put_sshstr(self, val: typing.Union[bytes, _FragList]) -> None: + """Bytes prefixed with u32 length""" + if isinstance(val, (bytes, memoryview, bytearray)): + self.put_u32(len(val)) + self.flist.append(val) + else: + self.put_u32(val.size()) + self.flist.extend(val.flist) + + def put_mpint(self, val: int) -> None: + """Big-endian bigint prefixed with u32 length""" + self.put_sshstr(_to_mpint(val)) + + def size(self) -> int: + """Current number of bytes""" + return sum(map(len, self.flist)) + + def render(self, dstbuf: memoryview, pos: int = 0) -> int: + """Write into bytearray""" + for frag in self.flist: + flen = len(frag) + start, pos = pos, pos + flen + dstbuf[start:pos] = frag + return pos + + def tobytes(self) -> bytes: + """Return as bytes""" + buf = memoryview(bytearray(self.size())) + self.render(buf) + return buf.tobytes() + + +class _SSHFormatRSA: + """Format for RSA keys. + + Public: + mpint e, n + Private: + mpint n, e, d, iqmp, p, q + """ + + def get_public(self, data: memoryview): + """RSA public fields""" + e, data = _get_mpint(data) + n, data = _get_mpint(data) + return (e, n), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[rsa.RSAPublicKey, memoryview]: + """Make RSA public key from data.""" + (e, n), data = self.get_public(data) + public_numbers = rsa.RSAPublicNumbers(e, n) + public_key = public_numbers.public_key() + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[rsa.RSAPrivateKey, memoryview]: + """Make RSA private key from data.""" + n, data = _get_mpint(data) + e, data = _get_mpint(data) + d, data = _get_mpint(data) + iqmp, data = _get_mpint(data) + p, data = _get_mpint(data) + q, data = _get_mpint(data) + + if (e, n) != pubfields: + raise ValueError("Corrupt data: rsa field mismatch") + dmp1 = rsa.rsa_crt_dmp1(d, p) + dmq1 = rsa.rsa_crt_dmq1(d, q) + public_numbers = rsa.RSAPublicNumbers(e, n) + private_numbers = rsa.RSAPrivateNumbers( + p, q, d, dmp1, dmq1, iqmp, public_numbers + ) + private_key = private_numbers.private_key() + return private_key, data + + def encode_public( + self, public_key: rsa.RSAPublicKey, f_pub: _FragList + ) -> None: + """Write RSA public key""" + pubn = public_key.public_numbers() + f_pub.put_mpint(pubn.e) + f_pub.put_mpint(pubn.n) + + def encode_private( + self, private_key: rsa.RSAPrivateKey, f_priv: _FragList + ) -> None: + """Write RSA private key""" + private_numbers = private_key.private_numbers() + public_numbers = private_numbers.public_numbers + + f_priv.put_mpint(public_numbers.n) + f_priv.put_mpint(public_numbers.e) + + f_priv.put_mpint(private_numbers.d) + f_priv.put_mpint(private_numbers.iqmp) + f_priv.put_mpint(private_numbers.p) + f_priv.put_mpint(private_numbers.q) + + +class _SSHFormatDSA: + """Format for DSA keys. + + Public: + mpint p, q, g, y + Private: + mpint p, q, g, y, x + """ + + def get_public( + self, data: memoryview + ) -> typing.Tuple[typing.Tuple, memoryview]: + """DSA public fields""" + p, data = _get_mpint(data) + q, data = _get_mpint(data) + g, data = _get_mpint(data) + y, data = _get_mpint(data) + return (p, q, g, y), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[dsa.DSAPublicKey, memoryview]: + """Make DSA public key from data.""" + (p, q, g, y), data = self.get_public(data) + parameter_numbers = dsa.DSAParameterNumbers(p, q, g) + public_numbers = dsa.DSAPublicNumbers(y, parameter_numbers) + self._validate(public_numbers) + public_key = public_numbers.public_key() + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[dsa.DSAPrivateKey, memoryview]: + """Make DSA private key from data.""" + (p, q, g, y), data = self.get_public(data) + x, data = _get_mpint(data) + + if (p, q, g, y) != pubfields: + raise ValueError("Corrupt data: dsa field mismatch") + parameter_numbers = dsa.DSAParameterNumbers(p, q, g) + public_numbers = dsa.DSAPublicNumbers(y, parameter_numbers) + self._validate(public_numbers) + private_numbers = dsa.DSAPrivateNumbers(x, public_numbers) + private_key = private_numbers.private_key() + return private_key, data + + def encode_public( + self, public_key: dsa.DSAPublicKey, f_pub: _FragList + ) -> None: + """Write DSA public key""" + public_numbers = public_key.public_numbers() + parameter_numbers = public_numbers.parameter_numbers + self._validate(public_numbers) + + f_pub.put_mpint(parameter_numbers.p) + f_pub.put_mpint(parameter_numbers.q) + f_pub.put_mpint(parameter_numbers.g) + f_pub.put_mpint(public_numbers.y) + + def encode_private( + self, private_key: dsa.DSAPrivateKey, f_priv: _FragList + ) -> None: + """Write DSA private key""" + self.encode_public(private_key.public_key(), f_priv) + f_priv.put_mpint(private_key.private_numbers().x) + + def _validate(self, public_numbers: dsa.DSAPublicNumbers) -> None: + parameter_numbers = public_numbers.parameter_numbers + if parameter_numbers.p.bit_length() != 1024: + raise ValueError("SSH supports only 1024 bit DSA keys") + + +class _SSHFormatECDSA: + """Format for ECDSA keys. + + Public: + str curve + bytes point + Private: + str curve + bytes point + mpint secret + """ + + def __init__(self, ssh_curve_name: bytes, curve: ec.EllipticCurve): + self.ssh_curve_name = ssh_curve_name + self.curve = curve + + def get_public( + self, data: memoryview + ) -> typing.Tuple[typing.Tuple, memoryview]: + """ECDSA public fields""" + curve, data = _get_sshstr(data) + point, data = _get_sshstr(data) + if curve != self.ssh_curve_name: + raise ValueError("Curve name mismatch") + if point[0] != 4: + raise NotImplementedError("Need uncompressed point") + return (curve, point), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[ec.EllipticCurvePublicKey, memoryview]: + """Make ECDSA public key from data.""" + (curve_name, point), data = self.get_public(data) + public_key = ec.EllipticCurvePublicKey.from_encoded_point( + self.curve, point.tobytes() + ) + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[ec.EllipticCurvePrivateKey, memoryview]: + """Make ECDSA private key from data.""" + (curve_name, point), data = self.get_public(data) + secret, data = _get_mpint(data) + + if (curve_name, point) != pubfields: + raise ValueError("Corrupt data: ecdsa field mismatch") + private_key = ec.derive_private_key(secret, self.curve) + return private_key, data + + def encode_public( + self, public_key: ec.EllipticCurvePublicKey, f_pub: _FragList + ) -> None: + """Write ECDSA public key""" + point = public_key.public_bytes( + Encoding.X962, PublicFormat.UncompressedPoint + ) + f_pub.put_sshstr(self.ssh_curve_name) + f_pub.put_sshstr(point) + + def encode_private( + self, private_key: ec.EllipticCurvePrivateKey, f_priv: _FragList + ) -> None: + """Write ECDSA private key""" + public_key = private_key.public_key() + private_numbers = private_key.private_numbers() + + self.encode_public(public_key, f_priv) + f_priv.put_mpint(private_numbers.private_value) + + +class _SSHFormatEd25519: + """Format for Ed25519 keys. + + Public: + bytes point + Private: + bytes point + bytes secret_and_point + """ + + def get_public( + self, data: memoryview + ) -> typing.Tuple[typing.Tuple, memoryview]: + """Ed25519 public fields""" + point, data = _get_sshstr(data) + return (point,), data + + def load_public( + self, data: memoryview + ) -> typing.Tuple[ed25519.Ed25519PublicKey, memoryview]: + """Make Ed25519 public key from data.""" + (point,), data = self.get_public(data) + public_key = ed25519.Ed25519PublicKey.from_public_bytes( + point.tobytes() + ) + return public_key, data + + def load_private( + self, data: memoryview, pubfields + ) -> typing.Tuple[ed25519.Ed25519PrivateKey, memoryview]: + """Make Ed25519 private key from data.""" + (point,), data = self.get_public(data) + keypair, data = _get_sshstr(data) + + secret = keypair[:32] + point2 = keypair[32:] + if point != point2 or (point,) != pubfields: + raise ValueError("Corrupt data: ed25519 field mismatch") + private_key = ed25519.Ed25519PrivateKey.from_private_bytes(secret) + return private_key, data + + def encode_public( + self, public_key: ed25519.Ed25519PublicKey, f_pub: _FragList + ) -> None: + """Write Ed25519 public key""" + raw_public_key = public_key.public_bytes( + Encoding.Raw, PublicFormat.Raw + ) + f_pub.put_sshstr(raw_public_key) + + def encode_private( + self, private_key: ed25519.Ed25519PrivateKey, f_priv: _FragList + ) -> None: + """Write Ed25519 private key""" + public_key = private_key.public_key() + raw_private_key = private_key.private_bytes( + Encoding.Raw, PrivateFormat.Raw, NoEncryption() + ) + raw_public_key = public_key.public_bytes( + Encoding.Raw, PublicFormat.Raw + ) + f_keypair = _FragList([raw_private_key, raw_public_key]) + + self.encode_public(public_key, f_priv) + f_priv.put_sshstr(f_keypair) + + +_KEY_FORMATS = { + _SSH_RSA: _SSHFormatRSA(), + _SSH_DSA: _SSHFormatDSA(), + _SSH_ED25519: _SSHFormatEd25519(), + _ECDSA_NISTP256: _SSHFormatECDSA(b"nistp256", ec.SECP256R1()), + _ECDSA_NISTP384: _SSHFormatECDSA(b"nistp384", ec.SECP384R1()), + _ECDSA_NISTP521: _SSHFormatECDSA(b"nistp521", ec.SECP521R1()), +} + + +def _lookup_kformat(key_type: bytes): + """Return valid format or throw error""" + if not isinstance(key_type, bytes): + key_type = memoryview(key_type).tobytes() + if key_type in _KEY_FORMATS: + return _KEY_FORMATS[key_type] + raise UnsupportedAlgorithm(f"Unsupported key type: {key_type!r}") + + +SSHPrivateKeyTypes = typing.Union[ + ec.EllipticCurvePrivateKey, + rsa.RSAPrivateKey, + dsa.DSAPrivateKey, + ed25519.Ed25519PrivateKey, +] + + +def load_ssh_private_key( + data: bytes, + password: typing.Optional[bytes], + backend: typing.Any = None, +) -> SSHPrivateKeyTypes: + """Load private key from OpenSSH custom encoding.""" + utils._check_byteslike("data", data) + if password is not None: + utils._check_bytes("password", password) + + m = _PEM_RC.search(data) + if not m: + raise ValueError("Not OpenSSH private key format") + p1 = m.start(1) + p2 = m.end(1) + data = binascii.a2b_base64(memoryview(data)[p1:p2]) + if not data.startswith(_SK_MAGIC): + raise ValueError("Not OpenSSH private key format") + data = memoryview(data)[len(_SK_MAGIC) :] + + # parse header + ciphername, data = _get_sshstr(data) + kdfname, data = _get_sshstr(data) + kdfoptions, data = _get_sshstr(data) + nkeys, data = _get_u32(data) + if nkeys != 1: + raise ValueError("Only one key supported") + + # load public key data + pubdata, data = _get_sshstr(data) + pub_key_type, pubdata = _get_sshstr(pubdata) + kformat = _lookup_kformat(pub_key_type) + pubfields, pubdata = kformat.get_public(pubdata) + _check_empty(pubdata) + + if (ciphername, kdfname) != (_NONE, _NONE): + ciphername_bytes = ciphername.tobytes() + if ciphername_bytes not in _SSH_CIPHERS: + raise UnsupportedAlgorithm( + f"Unsupported cipher: {ciphername_bytes!r}" + ) + if kdfname != _BCRYPT: + raise UnsupportedAlgorithm(f"Unsupported KDF: {kdfname!r}") + blklen = _SSH_CIPHERS[ciphername_bytes].block_len + tag_len = _SSH_CIPHERS[ciphername_bytes].tag_len + # load secret data + edata, data = _get_sshstr(data) + # see https://bugzilla.mindrot.org/show_bug.cgi?id=3553 for + # information about how OpenSSH handles AEAD tags + if _SSH_CIPHERS[ciphername_bytes].is_aead: + tag = bytes(data) + if len(tag) != tag_len: + raise ValueError("Corrupt data: invalid tag length for cipher") + else: + _check_empty(data) + _check_block_size(edata, blklen) + salt, kbuf = _get_sshstr(kdfoptions) + rounds, kbuf = _get_u32(kbuf) + _check_empty(kbuf) + ciph = _init_cipher(ciphername_bytes, password, salt.tobytes(), rounds) + dec = ciph.decryptor() + edata = memoryview(dec.update(edata)) + if _SSH_CIPHERS[ciphername_bytes].is_aead: + assert isinstance(dec, AEADDecryptionContext) + _check_empty(dec.finalize_with_tag(tag)) + else: + # _check_block_size requires data to be a full block so there + # should be no output from finalize + _check_empty(dec.finalize()) + else: + # load secret data + edata, data = _get_sshstr(data) + _check_empty(data) + blklen = 8 + _check_block_size(edata, blklen) + ck1, edata = _get_u32(edata) + ck2, edata = _get_u32(edata) + if ck1 != ck2: + raise ValueError("Corrupt data: broken checksum") + + # load per-key struct + key_type, edata = _get_sshstr(edata) + if key_type != pub_key_type: + raise ValueError("Corrupt data: key type mismatch") + private_key, edata = kformat.load_private(edata, pubfields) + comment, edata = _get_sshstr(edata) + + # yes, SSH does padding check *after* all other parsing is done. + # need to follow as it writes zero-byte padding too. + if edata != _PADDING[: len(edata)]: + raise ValueError("Corrupt data: invalid padding") + + if isinstance(private_key, dsa.DSAPrivateKey): + warnings.warn( + "SSH DSA keys are deprecated and will be removed in a future " + "release.", + utils.DeprecatedIn40, + stacklevel=2, + ) + + return private_key + + +def _serialize_ssh_private_key( + private_key: SSHPrivateKeyTypes, + password: bytes, + encryption_algorithm: KeySerializationEncryption, +) -> bytes: + """Serialize private key with OpenSSH custom encoding.""" + utils._check_bytes("password", password) + if isinstance(private_key, dsa.DSAPrivateKey): + warnings.warn( + "SSH DSA key support is deprecated and will be " + "removed in a future release", + utils.DeprecatedIn40, + stacklevel=4, + ) + + key_type = _get_ssh_key_type(private_key) + kformat = _lookup_kformat(key_type) + + # setup parameters + f_kdfoptions = _FragList() + if password: + ciphername = _DEFAULT_CIPHER + blklen = _SSH_CIPHERS[ciphername].block_len + kdfname = _BCRYPT + rounds = _DEFAULT_ROUNDS + if ( + isinstance(encryption_algorithm, _KeySerializationEncryption) + and encryption_algorithm._kdf_rounds is not None + ): + rounds = encryption_algorithm._kdf_rounds + salt = os.urandom(16) + f_kdfoptions.put_sshstr(salt) + f_kdfoptions.put_u32(rounds) + ciph = _init_cipher(ciphername, password, salt, rounds) + else: + ciphername = kdfname = _NONE + blklen = 8 + ciph = None + nkeys = 1 + checkval = os.urandom(4) + comment = b"" + + # encode public and private parts together + f_public_key = _FragList() + f_public_key.put_sshstr(key_type) + kformat.encode_public(private_key.public_key(), f_public_key) + + f_secrets = _FragList([checkval, checkval]) + f_secrets.put_sshstr(key_type) + kformat.encode_private(private_key, f_secrets) + f_secrets.put_sshstr(comment) + f_secrets.put_raw(_PADDING[: blklen - (f_secrets.size() % blklen)]) + + # top-level structure + f_main = _FragList() + f_main.put_raw(_SK_MAGIC) + f_main.put_sshstr(ciphername) + f_main.put_sshstr(kdfname) + f_main.put_sshstr(f_kdfoptions) + f_main.put_u32(nkeys) + f_main.put_sshstr(f_public_key) + f_main.put_sshstr(f_secrets) + + # copy result info bytearray + slen = f_secrets.size() + mlen = f_main.size() + buf = memoryview(bytearray(mlen + blklen)) + f_main.render(buf) + ofs = mlen - slen + + # encrypt in-place + if ciph is not None: + ciph.encryptor().update_into(buf[ofs:mlen], buf[ofs:]) + + return _ssh_pem_encode(buf[:mlen]) + + +SSHPublicKeyTypes = typing.Union[ + ec.EllipticCurvePublicKey, + rsa.RSAPublicKey, + dsa.DSAPublicKey, + ed25519.Ed25519PublicKey, +] + +SSHCertPublicKeyTypes = typing.Union[ + ec.EllipticCurvePublicKey, + rsa.RSAPublicKey, + ed25519.Ed25519PublicKey, +] + + +class SSHCertificateType(enum.Enum): + USER = 1 + HOST = 2 + + +class SSHCertificate: + def __init__( + self, + _nonce: memoryview, + _public_key: SSHPublicKeyTypes, + _serial: int, + _cctype: int, + _key_id: memoryview, + _valid_principals: typing.List[bytes], + _valid_after: int, + _valid_before: int, + _critical_options: typing.Dict[bytes, bytes], + _extensions: typing.Dict[bytes, bytes], + _sig_type: memoryview, + _sig_key: memoryview, + _inner_sig_type: memoryview, + _signature: memoryview, + _tbs_cert_body: memoryview, + _cert_key_type: bytes, + _cert_body: memoryview, + ): + self._nonce = _nonce + self._public_key = _public_key + self._serial = _serial + try: + self._type = SSHCertificateType(_cctype) + except ValueError: + raise ValueError("Invalid certificate type") + self._key_id = _key_id + self._valid_principals = _valid_principals + self._valid_after = _valid_after + self._valid_before = _valid_before + self._critical_options = _critical_options + self._extensions = _extensions + self._sig_type = _sig_type + self._sig_key = _sig_key + self._inner_sig_type = _inner_sig_type + self._signature = _signature + self._cert_key_type = _cert_key_type + self._cert_body = _cert_body + self._tbs_cert_body = _tbs_cert_body + + @property + def nonce(self) -> bytes: + return bytes(self._nonce) + + def public_key(self) -> SSHCertPublicKeyTypes: + # make mypy happy until we remove DSA support entirely and + # the underlying union won't have a disallowed type + return typing.cast(SSHCertPublicKeyTypes, self._public_key) + + @property + def serial(self) -> int: + return self._serial + + @property + def type(self) -> SSHCertificateType: + return self._type + + @property + def key_id(self) -> bytes: + return bytes(self._key_id) + + @property + def valid_principals(self) -> typing.List[bytes]: + return self._valid_principals + + @property + def valid_before(self) -> int: + return self._valid_before + + @property + def valid_after(self) -> int: + return self._valid_after + + @property + def critical_options(self) -> typing.Dict[bytes, bytes]: + return self._critical_options + + @property + def extensions(self) -> typing.Dict[bytes, bytes]: + return self._extensions + + def signature_key(self) -> SSHCertPublicKeyTypes: + sigformat = _lookup_kformat(self._sig_type) + signature_key, sigkey_rest = sigformat.load_public(self._sig_key) + _check_empty(sigkey_rest) + return signature_key + + def public_bytes(self) -> bytes: + return ( + bytes(self._cert_key_type) + + b" " + + binascii.b2a_base64(bytes(self._cert_body), newline=False) + ) + + def verify_cert_signature(self) -> None: + signature_key = self.signature_key() + if isinstance(signature_key, ed25519.Ed25519PublicKey): + signature_key.verify( + bytes(self._signature), bytes(self._tbs_cert_body) + ) + elif isinstance(signature_key, ec.EllipticCurvePublicKey): + # The signature is encoded as a pair of big-endian integers + r, data = _get_mpint(self._signature) + s, data = _get_mpint(data) + _check_empty(data) + computed_sig = asym_utils.encode_dss_signature(r, s) + hash_alg = _get_ec_hash_alg(signature_key.curve) + signature_key.verify( + computed_sig, bytes(self._tbs_cert_body), ec.ECDSA(hash_alg) + ) + else: + assert isinstance(signature_key, rsa.RSAPublicKey) + if self._inner_sig_type == _SSH_RSA: + hash_alg = hashes.SHA1() + elif self._inner_sig_type == _SSH_RSA_SHA256: + hash_alg = hashes.SHA256() + else: + assert self._inner_sig_type == _SSH_RSA_SHA512 + hash_alg = hashes.SHA512() + signature_key.verify( + bytes(self._signature), + bytes(self._tbs_cert_body), + padding.PKCS1v15(), + hash_alg, + ) + + +def _get_ec_hash_alg(curve: ec.EllipticCurve) -> hashes.HashAlgorithm: + if isinstance(curve, ec.SECP256R1): + return hashes.SHA256() + elif isinstance(curve, ec.SECP384R1): + return hashes.SHA384() + else: + assert isinstance(curve, ec.SECP521R1) + return hashes.SHA512() + + +def _load_ssh_public_identity( + data: bytes, + _legacy_dsa_allowed=False, +) -> typing.Union[SSHCertificate, SSHPublicKeyTypes]: + utils._check_byteslike("data", data) + + m = _SSH_PUBKEY_RC.match(data) + if not m: + raise ValueError("Invalid line format") + key_type = orig_key_type = m.group(1) + key_body = m.group(2) + with_cert = False + if key_type.endswith(_CERT_SUFFIX): + with_cert = True + key_type = key_type[: -len(_CERT_SUFFIX)] + if key_type == _SSH_DSA and not _legacy_dsa_allowed: + raise UnsupportedAlgorithm( + "DSA keys aren't supported in SSH certificates" + ) + kformat = _lookup_kformat(key_type) + + try: + rest = memoryview(binascii.a2b_base64(key_body)) + except (TypeError, binascii.Error): + raise ValueError("Invalid format") + + if with_cert: + cert_body = rest + inner_key_type, rest = _get_sshstr(rest) + if inner_key_type != orig_key_type: + raise ValueError("Invalid key format") + if with_cert: + nonce, rest = _get_sshstr(rest) + public_key, rest = kformat.load_public(rest) + if with_cert: + serial, rest = _get_u64(rest) + cctype, rest = _get_u32(rest) + key_id, rest = _get_sshstr(rest) + principals, rest = _get_sshstr(rest) + valid_principals = [] + while principals: + principal, principals = _get_sshstr(principals) + valid_principals.append(bytes(principal)) + valid_after, rest = _get_u64(rest) + valid_before, rest = _get_u64(rest) + crit_options, rest = _get_sshstr(rest) + critical_options = _parse_exts_opts(crit_options) + exts, rest = _get_sshstr(rest) + extensions = _parse_exts_opts(exts) + # Get the reserved field, which is unused. + _, rest = _get_sshstr(rest) + sig_key_raw, rest = _get_sshstr(rest) + sig_type, sig_key = _get_sshstr(sig_key_raw) + if sig_type == _SSH_DSA and not _legacy_dsa_allowed: + raise UnsupportedAlgorithm( + "DSA signatures aren't supported in SSH certificates" + ) + # Get the entire cert body and subtract the signature + tbs_cert_body = cert_body[: -len(rest)] + signature_raw, rest = _get_sshstr(rest) + _check_empty(rest) + inner_sig_type, sig_rest = _get_sshstr(signature_raw) + # RSA certs can have multiple algorithm types + if ( + sig_type == _SSH_RSA + and inner_sig_type + not in [_SSH_RSA_SHA256, _SSH_RSA_SHA512, _SSH_RSA] + ) or (sig_type != _SSH_RSA and inner_sig_type != sig_type): + raise ValueError("Signature key type does not match") + signature, sig_rest = _get_sshstr(sig_rest) + _check_empty(sig_rest) + return SSHCertificate( + nonce, + public_key, + serial, + cctype, + key_id, + valid_principals, + valid_after, + valid_before, + critical_options, + extensions, + sig_type, + sig_key, + inner_sig_type, + signature, + tbs_cert_body, + orig_key_type, + cert_body, + ) + else: + _check_empty(rest) + return public_key + + +def load_ssh_public_identity( + data: bytes, +) -> typing.Union[SSHCertificate, SSHPublicKeyTypes]: + return _load_ssh_public_identity(data) + + +def _parse_exts_opts(exts_opts: memoryview) -> typing.Dict[bytes, bytes]: + result: typing.Dict[bytes, bytes] = {} + last_name = None + while exts_opts: + name, exts_opts = _get_sshstr(exts_opts) + bname: bytes = bytes(name) + if bname in result: + raise ValueError("Duplicate name") + if last_name is not None and bname < last_name: + raise ValueError("Fields not lexically sorted") + value, exts_opts = _get_sshstr(exts_opts) + if len(value) > 0: + try: + value, extra = _get_sshstr(value) + except ValueError: + warnings.warn( + "This certificate has an incorrect encoding for critical " + "options or extensions. This will be an exception in " + "cryptography 42", + utils.DeprecatedIn41, + stacklevel=4, + ) + else: + if len(extra) > 0: + raise ValueError("Unexpected extra data after value") + result[bname] = bytes(value) + last_name = bname + return result + + +def load_ssh_public_key( + data: bytes, backend: typing.Any = None +) -> SSHPublicKeyTypes: + cert_or_key = _load_ssh_public_identity(data, _legacy_dsa_allowed=True) + public_key: SSHPublicKeyTypes + if isinstance(cert_or_key, SSHCertificate): + public_key = cert_or_key.public_key() + else: + public_key = cert_or_key + + if isinstance(public_key, dsa.DSAPublicKey): + warnings.warn( + "SSH DSA keys are deprecated and will be removed in a future " + "release.", + utils.DeprecatedIn40, + stacklevel=2, + ) + return public_key + + +def serialize_ssh_public_key(public_key: SSHPublicKeyTypes) -> bytes: + """One-line public key format for OpenSSH""" + if isinstance(public_key, dsa.DSAPublicKey): + warnings.warn( + "SSH DSA key support is deprecated and will be " + "removed in a future release", + utils.DeprecatedIn40, + stacklevel=4, + ) + key_type = _get_ssh_key_type(public_key) + kformat = _lookup_kformat(key_type) + + f_pub = _FragList() + f_pub.put_sshstr(key_type) + kformat.encode_public(public_key, f_pub) + + pub = binascii.b2a_base64(f_pub.tobytes()).strip() + return b"".join([key_type, b" ", pub]) + + +SSHCertPrivateKeyTypes = typing.Union[ + ec.EllipticCurvePrivateKey, + rsa.RSAPrivateKey, + ed25519.Ed25519PrivateKey, +] + + +# This is an undocumented limit enforced in the openssh codebase for sshd and +# ssh-keygen, but it is undefined in the ssh certificates spec. +_SSHKEY_CERT_MAX_PRINCIPALS = 256 + + +class SSHCertificateBuilder: + def __init__( + self, + _public_key: typing.Optional[SSHCertPublicKeyTypes] = None, + _serial: typing.Optional[int] = None, + _type: typing.Optional[SSHCertificateType] = None, + _key_id: typing.Optional[bytes] = None, + _valid_principals: typing.List[bytes] = [], + _valid_for_all_principals: bool = False, + _valid_before: typing.Optional[int] = None, + _valid_after: typing.Optional[int] = None, + _critical_options: typing.List[typing.Tuple[bytes, bytes]] = [], + _extensions: typing.List[typing.Tuple[bytes, bytes]] = [], + ): + self._public_key = _public_key + self._serial = _serial + self._type = _type + self._key_id = _key_id + self._valid_principals = _valid_principals + self._valid_for_all_principals = _valid_for_all_principals + self._valid_before = _valid_before + self._valid_after = _valid_after + self._critical_options = _critical_options + self._extensions = _extensions + + def public_key( + self, public_key: SSHCertPublicKeyTypes + ) -> SSHCertificateBuilder: + if not isinstance( + public_key, + ( + ec.EllipticCurvePublicKey, + rsa.RSAPublicKey, + ed25519.Ed25519PublicKey, + ), + ): + raise TypeError("Unsupported key type") + if self._public_key is not None: + raise ValueError("public_key already set") + + return SSHCertificateBuilder( + _public_key=public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def serial(self, serial: int) -> SSHCertificateBuilder: + if not isinstance(serial, int): + raise TypeError("serial must be an integer") + if not 0 <= serial < 2**64: + raise ValueError("serial must be between 0 and 2**64") + if self._serial is not None: + raise ValueError("serial already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def type(self, type: SSHCertificateType) -> SSHCertificateBuilder: + if not isinstance(type, SSHCertificateType): + raise TypeError("type must be an SSHCertificateType") + if self._type is not None: + raise ValueError("type already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def key_id(self, key_id: bytes) -> SSHCertificateBuilder: + if not isinstance(key_id, bytes): + raise TypeError("key_id must be bytes") + if self._key_id is not None: + raise ValueError("key_id already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_principals( + self, valid_principals: typing.List[bytes] + ) -> SSHCertificateBuilder: + if self._valid_for_all_principals: + raise ValueError( + "Principals can't be set because the cert is valid " + "for all principals" + ) + if ( + not all(isinstance(x, bytes) for x in valid_principals) + or not valid_principals + ): + raise TypeError( + "principals must be a list of bytes and can't be empty" + ) + if self._valid_principals: + raise ValueError("valid_principals already set") + + if len(valid_principals) > _SSHKEY_CERT_MAX_PRINCIPALS: + raise ValueError( + "Reached or exceeded the maximum number of valid_principals" + ) + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_for_all_principals(self): + if self._valid_principals: + raise ValueError( + "valid_principals already set, can't set " + "valid_for_all_principals" + ) + if self._valid_for_all_principals: + raise ValueError("valid_for_all_principals already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=True, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_before( + self, valid_before: typing.Union[int, float] + ) -> SSHCertificateBuilder: + if not isinstance(valid_before, (int, float)): + raise TypeError("valid_before must be an int or float") + valid_before = int(valid_before) + if valid_before < 0 or valid_before >= 2**64: + raise ValueError("valid_before must [0, 2**64)") + if self._valid_before is not None: + raise ValueError("valid_before already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def valid_after( + self, valid_after: typing.Union[int, float] + ) -> SSHCertificateBuilder: + if not isinstance(valid_after, (int, float)): + raise TypeError("valid_after must be an int or float") + valid_after = int(valid_after) + if valid_after < 0 or valid_after >= 2**64: + raise ValueError("valid_after must [0, 2**64)") + if self._valid_after is not None: + raise ValueError("valid_after already set") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions, + ) + + def add_critical_option( + self, name: bytes, value: bytes + ) -> SSHCertificateBuilder: + if not isinstance(name, bytes) or not isinstance(value, bytes): + raise TypeError("name and value must be bytes") + # This is O(n**2) + if name in [name for name, _ in self._critical_options]: + raise ValueError("Duplicate critical option name") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options + [(name, value)], + _extensions=self._extensions, + ) + + def add_extension( + self, name: bytes, value: bytes + ) -> SSHCertificateBuilder: + if not isinstance(name, bytes) or not isinstance(value, bytes): + raise TypeError("name and value must be bytes") + # This is O(n**2) + if name in [name for name, _ in self._extensions]: + raise ValueError("Duplicate extension name") + + return SSHCertificateBuilder( + _public_key=self._public_key, + _serial=self._serial, + _type=self._type, + _key_id=self._key_id, + _valid_principals=self._valid_principals, + _valid_for_all_principals=self._valid_for_all_principals, + _valid_before=self._valid_before, + _valid_after=self._valid_after, + _critical_options=self._critical_options, + _extensions=self._extensions + [(name, value)], + ) + + def sign(self, private_key: SSHCertPrivateKeyTypes) -> SSHCertificate: + if not isinstance( + private_key, + ( + ec.EllipticCurvePrivateKey, + rsa.RSAPrivateKey, + ed25519.Ed25519PrivateKey, + ), + ): + raise TypeError("Unsupported private key type") + + if self._public_key is None: + raise ValueError("public_key must be set") + + # Not required + serial = 0 if self._serial is None else self._serial + + if self._type is None: + raise ValueError("type must be set") + + # Not required + key_id = b"" if self._key_id is None else self._key_id + + # A zero length list is valid, but means the certificate + # is valid for any principal of the specified type. We require + # the user to explicitly set valid_for_all_principals to get + # that behavior. + if not self._valid_principals and not self._valid_for_all_principals: + raise ValueError( + "valid_principals must be set if valid_for_all_principals " + "is False" + ) + + if self._valid_before is None: + raise ValueError("valid_before must be set") + + if self._valid_after is None: + raise ValueError("valid_after must be set") + + if self._valid_after > self._valid_before: + raise ValueError("valid_after must be earlier than valid_before") + + # lexically sort our byte strings + self._critical_options.sort(key=lambda x: x[0]) + self._extensions.sort(key=lambda x: x[0]) + + key_type = _get_ssh_key_type(self._public_key) + cert_prefix = key_type + _CERT_SUFFIX + + # Marshal the bytes to be signed + nonce = os.urandom(32) + kformat = _lookup_kformat(key_type) + f = _FragList() + f.put_sshstr(cert_prefix) + f.put_sshstr(nonce) + kformat.encode_public(self._public_key, f) + f.put_u64(serial) + f.put_u32(self._type.value) + f.put_sshstr(key_id) + fprincipals = _FragList() + for p in self._valid_principals: + fprincipals.put_sshstr(p) + f.put_sshstr(fprincipals.tobytes()) + f.put_u64(self._valid_after) + f.put_u64(self._valid_before) + fcrit = _FragList() + for name, value in self._critical_options: + fcrit.put_sshstr(name) + if len(value) > 0: + foptval = _FragList() + foptval.put_sshstr(value) + fcrit.put_sshstr(foptval.tobytes()) + else: + fcrit.put_sshstr(value) + f.put_sshstr(fcrit.tobytes()) + fext = _FragList() + for name, value in self._extensions: + fext.put_sshstr(name) + if len(value) > 0: + fextval = _FragList() + fextval.put_sshstr(value) + fext.put_sshstr(fextval.tobytes()) + else: + fext.put_sshstr(value) + f.put_sshstr(fext.tobytes()) + f.put_sshstr(b"") # RESERVED FIELD + # encode CA public key + ca_type = _get_ssh_key_type(private_key) + caformat = _lookup_kformat(ca_type) + caf = _FragList() + caf.put_sshstr(ca_type) + caformat.encode_public(private_key.public_key(), caf) + f.put_sshstr(caf.tobytes()) + # Sigs according to the rules defined for the CA's public key + # (RFC4253 section 6.6 for ssh-rsa, RFC5656 for ECDSA, + # and RFC8032 for Ed25519). + if isinstance(private_key, ed25519.Ed25519PrivateKey): + signature = private_key.sign(f.tobytes()) + fsig = _FragList() + fsig.put_sshstr(ca_type) + fsig.put_sshstr(signature) + f.put_sshstr(fsig.tobytes()) + elif isinstance(private_key, ec.EllipticCurvePrivateKey): + hash_alg = _get_ec_hash_alg(private_key.curve) + signature = private_key.sign(f.tobytes(), ec.ECDSA(hash_alg)) + r, s = asym_utils.decode_dss_signature(signature) + fsig = _FragList() + fsig.put_sshstr(ca_type) + fsigblob = _FragList() + fsigblob.put_mpint(r) + fsigblob.put_mpint(s) + fsig.put_sshstr(fsigblob.tobytes()) + f.put_sshstr(fsig.tobytes()) + + else: + assert isinstance(private_key, rsa.RSAPrivateKey) + # Just like Golang, we're going to use SHA512 for RSA + # https://cs.opensource.google/go/x/crypto/+/refs/tags/ + # v0.4.0:ssh/certs.go;l=445 + # RFC 8332 defines SHA256 and 512 as options + fsig = _FragList() + fsig.put_sshstr(_SSH_RSA_SHA512) + signature = private_key.sign( + f.tobytes(), padding.PKCS1v15(), hashes.SHA512() + ) + fsig.put_sshstr(signature) + f.put_sshstr(fsig.tobytes()) + + cert_data = binascii.b2a_base64(f.tobytes()).strip() + # load_ssh_public_identity returns a union, but this is + # guaranteed to be an SSHCertificate, so we cast to make + # mypy happy. + return typing.cast( + SSHCertificate, + load_ssh_public_identity(b"".join([cert_prefix, b" ", cert_data])), + ) diff --git a/jwt/python/cryptography/hazmat/primitives/twofactor/__init__.py b/jwt/python/cryptography/hazmat/primitives/twofactor/__init__.py new file mode 100644 index 0000000..c1af423 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/twofactor/__init__.py @@ -0,0 +1,9 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + + +class InvalidToken(Exception): + pass diff --git a/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..92a3399 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc new file mode 100644 index 0000000..65bbc66 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc b/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc new file mode 100644 index 0000000..f6204f2 Binary files /dev/null and b/jwt/python/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-311.pyc differ diff --git a/jwt/python/cryptography/hazmat/primitives/twofactor/hotp.py b/jwt/python/cryptography/hazmat/primitives/twofactor/hotp.py new file mode 100644 index 0000000..2067108 --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/twofactor/hotp.py @@ -0,0 +1,92 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import base64 +import typing +from urllib.parse import quote, urlencode + +from cryptography.hazmat.primitives import constant_time, hmac +from cryptography.hazmat.primitives.hashes import SHA1, SHA256, SHA512 +from cryptography.hazmat.primitives.twofactor import InvalidToken + +HOTPHashTypes = typing.Union[SHA1, SHA256, SHA512] + + +def _generate_uri( + hotp: HOTP, + type_name: str, + account_name: str, + issuer: typing.Optional[str], + extra_parameters: typing.List[typing.Tuple[str, int]], +) -> str: + parameters = [ + ("digits", hotp._length), + ("secret", base64.b32encode(hotp._key)), + ("algorithm", hotp._algorithm.name.upper()), + ] + + if issuer is not None: + parameters.append(("issuer", issuer)) + + parameters.extend(extra_parameters) + + label = ( + f"{quote(issuer)}:{quote(account_name)}" + if issuer + else quote(account_name) + ) + return f"otpauth://{type_name}/{label}?{urlencode(parameters)}" + + +class HOTP: + def __init__( + self, + key: bytes, + length: int, + algorithm: HOTPHashTypes, + backend: typing.Any = None, + enforce_key_length: bool = True, + ) -> None: + if len(key) < 16 and enforce_key_length is True: + raise ValueError("Key length has to be at least 128 bits.") + + if not isinstance(length, int): + raise TypeError("Length parameter must be an integer type.") + + if length < 6 or length > 8: + raise ValueError("Length of HOTP has to be between 6 and 8.") + + if not isinstance(algorithm, (SHA1, SHA256, SHA512)): + raise TypeError("Algorithm must be SHA1, SHA256 or SHA512.") + + self._key = key + self._length = length + self._algorithm = algorithm + + def generate(self, counter: int) -> bytes: + truncated_value = self._dynamic_truncate(counter) + hotp = truncated_value % (10**self._length) + return "{0:0{1}}".format(hotp, self._length).encode() + + def verify(self, hotp: bytes, counter: int) -> None: + if not constant_time.bytes_eq(self.generate(counter), hotp): + raise InvalidToken("Supplied HOTP value does not match.") + + def _dynamic_truncate(self, counter: int) -> int: + ctx = hmac.HMAC(self._key, self._algorithm) + ctx.update(counter.to_bytes(length=8, byteorder="big")) + hmac_value = ctx.finalize() + + offset = hmac_value[len(hmac_value) - 1] & 0b1111 + p = hmac_value[offset : offset + 4] + return int.from_bytes(p, byteorder="big") & 0x7FFFFFFF + + def get_provisioning_uri( + self, account_name: str, counter: int, issuer: typing.Optional[str] + ) -> str: + return _generate_uri( + self, "hotp", account_name, issuer, [("counter", int(counter))] + ) diff --git a/jwt/python/cryptography/hazmat/primitives/twofactor/totp.py b/jwt/python/cryptography/hazmat/primitives/twofactor/totp.py new file mode 100644 index 0000000..daddcea --- /dev/null +++ b/jwt/python/cryptography/hazmat/primitives/twofactor/totp.py @@ -0,0 +1,50 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import typing + +from cryptography.hazmat.primitives import constant_time +from cryptography.hazmat.primitives.twofactor import InvalidToken +from cryptography.hazmat.primitives.twofactor.hotp import ( + HOTP, + HOTPHashTypes, + _generate_uri, +) + + +class TOTP: + def __init__( + self, + key: bytes, + length: int, + algorithm: HOTPHashTypes, + time_step: int, + backend: typing.Any = None, + enforce_key_length: bool = True, + ): + self._time_step = time_step + self._hotp = HOTP( + key, length, algorithm, enforce_key_length=enforce_key_length + ) + + def generate(self, time: typing.Union[int, float]) -> bytes: + counter = int(time / self._time_step) + return self._hotp.generate(counter) + + def verify(self, totp: bytes, time: int) -> None: + if not constant_time.bytes_eq(self.generate(time), totp): + raise InvalidToken("Supplied TOTP value does not match.") + + def get_provisioning_uri( + self, account_name: str, issuer: typing.Optional[str] + ) -> str: + return _generate_uri( + self._hotp, + "totp", + account_name, + issuer, + [("period", int(self._time_step))], + ) diff --git a/jwt/python/cryptography/py.typed b/jwt/python/cryptography/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/jwt/python/cryptography/utils.py b/jwt/python/cryptography/utils.py new file mode 100644 index 0000000..7191681 --- /dev/null +++ b/jwt/python/cryptography/utils.py @@ -0,0 +1,130 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import enum +import sys +import types +import typing +import warnings + + +# We use a UserWarning subclass, instead of DeprecationWarning, because CPython +# decided deprecation warnings should be invisble by default. +class CryptographyDeprecationWarning(UserWarning): + pass + + +# Several APIs were deprecated with no specific end-of-life date because of the +# ubiquity of their use. They should not be removed until we agree on when that +# cycle ends. +DeprecatedIn36 = CryptographyDeprecationWarning +DeprecatedIn37 = CryptographyDeprecationWarning +DeprecatedIn40 = CryptographyDeprecationWarning +DeprecatedIn41 = CryptographyDeprecationWarning + + +def _check_bytes(name: str, value: bytes) -> None: + if not isinstance(value, bytes): + raise TypeError(f"{name} must be bytes") + + +def _check_byteslike(name: str, value: bytes) -> None: + try: + memoryview(value) + except TypeError: + raise TypeError(f"{name} must be bytes-like") + + +def int_to_bytes(integer: int, length: typing.Optional[int] = None) -> bytes: + return integer.to_bytes( + length or (integer.bit_length() + 7) // 8 or 1, "big" + ) + + +def _extract_buffer_length(obj: typing.Any) -> typing.Tuple[typing.Any, int]: + from cryptography.hazmat.bindings._rust import _openssl + + buf = _openssl.ffi.from_buffer(obj) + return buf, int(_openssl.ffi.cast("uintptr_t", buf)) + + +class InterfaceNotImplemented(Exception): + pass + + +class _DeprecatedValue: + def __init__(self, value: object, message: str, warning_class): + self.value = value + self.message = message + self.warning_class = warning_class + + +class _ModuleWithDeprecations(types.ModuleType): + def __init__(self, module: types.ModuleType): + super().__init__(module.__name__) + self.__dict__["_module"] = module + + def __getattr__(self, attr: str) -> object: + obj = getattr(self._module, attr) + if isinstance(obj, _DeprecatedValue): + warnings.warn(obj.message, obj.warning_class, stacklevel=2) + obj = obj.value + return obj + + def __setattr__(self, attr: str, value: object) -> None: + setattr(self._module, attr, value) + + def __delattr__(self, attr: str) -> None: + obj = getattr(self._module, attr) + if isinstance(obj, _DeprecatedValue): + warnings.warn(obj.message, obj.warning_class, stacklevel=2) + + delattr(self._module, attr) + + def __dir__(self) -> typing.Sequence[str]: + return ["_module"] + dir(self._module) + + +def deprecated( + value: object, + module_name: str, + message: str, + warning_class: typing.Type[Warning], + name: typing.Optional[str] = None, +) -> _DeprecatedValue: + module = sys.modules[module_name] + if not isinstance(module, _ModuleWithDeprecations): + sys.modules[module_name] = module = _ModuleWithDeprecations(module) + dv = _DeprecatedValue(value, message, warning_class) + # Maintain backwards compatibility with `name is None` for pyOpenSSL. + if name is not None: + setattr(module, name, dv) + return dv + + +def cached_property(func: typing.Callable) -> property: + cached_name = f"_cached_{func}" + sentinel = object() + + def inner(instance: object): + cache = getattr(instance, cached_name, sentinel) + if cache is not sentinel: + return cache + result = func(instance) + setattr(instance, cached_name, result) + return result + + return property(inner) + + +# Python 3.10 changed representation of enums. We use well-defined object +# representation and string representation from Python 3.9. +class Enum(enum.Enum): + def __repr__(self) -> str: + return f"<{self.__class__.__name__}.{self._name_}: {self._value_!r}>" + + def __str__(self) -> str: + return f"{self.__class__.__name__}.{self._name_}" diff --git a/jwt/python/cryptography/x509/__init__.py b/jwt/python/cryptography/x509/__init__.py new file mode 100644 index 0000000..d77694a --- /dev/null +++ b/jwt/python/cryptography/x509/__init__.py @@ -0,0 +1,255 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.x509 import certificate_transparency +from cryptography.x509.base import ( + Attribute, + AttributeNotFound, + Attributes, + Certificate, + CertificateBuilder, + CertificateRevocationList, + CertificateRevocationListBuilder, + CertificateSigningRequest, + CertificateSigningRequestBuilder, + InvalidVersion, + RevokedCertificate, + RevokedCertificateBuilder, + Version, + load_der_x509_certificate, + load_der_x509_crl, + load_der_x509_csr, + load_pem_x509_certificate, + load_pem_x509_certificates, + load_pem_x509_crl, + load_pem_x509_csr, + random_serial_number, +) +from cryptography.x509.extensions import ( + AccessDescription, + AuthorityInformationAccess, + AuthorityKeyIdentifier, + BasicConstraints, + CertificateIssuer, + CertificatePolicies, + CRLDistributionPoints, + CRLNumber, + CRLReason, + DeltaCRLIndicator, + DistributionPoint, + DuplicateExtension, + ExtendedKeyUsage, + Extension, + ExtensionNotFound, + Extensions, + ExtensionType, + FreshestCRL, + GeneralNames, + InhibitAnyPolicy, + InvalidityDate, + IssuerAlternativeName, + IssuingDistributionPoint, + KeyUsage, + MSCertificateTemplate, + NameConstraints, + NoticeReference, + OCSPAcceptableResponses, + OCSPNoCheck, + OCSPNonce, + PolicyConstraints, + PolicyInformation, + PrecertificateSignedCertificateTimestamps, + PrecertPoison, + ReasonFlags, + SignedCertificateTimestamps, + SubjectAlternativeName, + SubjectInformationAccess, + SubjectKeyIdentifier, + TLSFeature, + TLSFeatureType, + UnrecognizedExtension, + UserNotice, +) +from cryptography.x509.general_name import ( + DirectoryName, + DNSName, + GeneralName, + IPAddress, + OtherName, + RegisteredID, + RFC822Name, + UniformResourceIdentifier, + UnsupportedGeneralNameType, +) +from cryptography.x509.name import ( + Name, + NameAttribute, + RelativeDistinguishedName, +) +from cryptography.x509.oid import ( + AuthorityInformationAccessOID, + CertificatePoliciesOID, + CRLEntryExtensionOID, + ExtendedKeyUsageOID, + ExtensionOID, + NameOID, + ObjectIdentifier, + SignatureAlgorithmOID, +) + +OID_AUTHORITY_INFORMATION_ACCESS = ExtensionOID.AUTHORITY_INFORMATION_ACCESS +OID_AUTHORITY_KEY_IDENTIFIER = ExtensionOID.AUTHORITY_KEY_IDENTIFIER +OID_BASIC_CONSTRAINTS = ExtensionOID.BASIC_CONSTRAINTS +OID_CERTIFICATE_POLICIES = ExtensionOID.CERTIFICATE_POLICIES +OID_CRL_DISTRIBUTION_POINTS = ExtensionOID.CRL_DISTRIBUTION_POINTS +OID_EXTENDED_KEY_USAGE = ExtensionOID.EXTENDED_KEY_USAGE +OID_FRESHEST_CRL = ExtensionOID.FRESHEST_CRL +OID_INHIBIT_ANY_POLICY = ExtensionOID.INHIBIT_ANY_POLICY +OID_ISSUER_ALTERNATIVE_NAME = ExtensionOID.ISSUER_ALTERNATIVE_NAME +OID_KEY_USAGE = ExtensionOID.KEY_USAGE +OID_NAME_CONSTRAINTS = ExtensionOID.NAME_CONSTRAINTS +OID_OCSP_NO_CHECK = ExtensionOID.OCSP_NO_CHECK +OID_POLICY_CONSTRAINTS = ExtensionOID.POLICY_CONSTRAINTS +OID_POLICY_MAPPINGS = ExtensionOID.POLICY_MAPPINGS +OID_SUBJECT_ALTERNATIVE_NAME = ExtensionOID.SUBJECT_ALTERNATIVE_NAME +OID_SUBJECT_DIRECTORY_ATTRIBUTES = ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES +OID_SUBJECT_INFORMATION_ACCESS = ExtensionOID.SUBJECT_INFORMATION_ACCESS +OID_SUBJECT_KEY_IDENTIFIER = ExtensionOID.SUBJECT_KEY_IDENTIFIER + +OID_DSA_WITH_SHA1 = SignatureAlgorithmOID.DSA_WITH_SHA1 +OID_DSA_WITH_SHA224 = SignatureAlgorithmOID.DSA_WITH_SHA224 +OID_DSA_WITH_SHA256 = SignatureAlgorithmOID.DSA_WITH_SHA256 +OID_ECDSA_WITH_SHA1 = SignatureAlgorithmOID.ECDSA_WITH_SHA1 +OID_ECDSA_WITH_SHA224 = SignatureAlgorithmOID.ECDSA_WITH_SHA224 +OID_ECDSA_WITH_SHA256 = SignatureAlgorithmOID.ECDSA_WITH_SHA256 +OID_ECDSA_WITH_SHA384 = SignatureAlgorithmOID.ECDSA_WITH_SHA384 +OID_ECDSA_WITH_SHA512 = SignatureAlgorithmOID.ECDSA_WITH_SHA512 +OID_RSA_WITH_MD5 = SignatureAlgorithmOID.RSA_WITH_MD5 +OID_RSA_WITH_SHA1 = SignatureAlgorithmOID.RSA_WITH_SHA1 +OID_RSA_WITH_SHA224 = SignatureAlgorithmOID.RSA_WITH_SHA224 +OID_RSA_WITH_SHA256 = SignatureAlgorithmOID.RSA_WITH_SHA256 +OID_RSA_WITH_SHA384 = SignatureAlgorithmOID.RSA_WITH_SHA384 +OID_RSA_WITH_SHA512 = SignatureAlgorithmOID.RSA_WITH_SHA512 +OID_RSASSA_PSS = SignatureAlgorithmOID.RSASSA_PSS + +OID_COMMON_NAME = NameOID.COMMON_NAME +OID_COUNTRY_NAME = NameOID.COUNTRY_NAME +OID_DOMAIN_COMPONENT = NameOID.DOMAIN_COMPONENT +OID_DN_QUALIFIER = NameOID.DN_QUALIFIER +OID_EMAIL_ADDRESS = NameOID.EMAIL_ADDRESS +OID_GENERATION_QUALIFIER = NameOID.GENERATION_QUALIFIER +OID_GIVEN_NAME = NameOID.GIVEN_NAME +OID_LOCALITY_NAME = NameOID.LOCALITY_NAME +OID_ORGANIZATIONAL_UNIT_NAME = NameOID.ORGANIZATIONAL_UNIT_NAME +OID_ORGANIZATION_NAME = NameOID.ORGANIZATION_NAME +OID_PSEUDONYM = NameOID.PSEUDONYM +OID_SERIAL_NUMBER = NameOID.SERIAL_NUMBER +OID_STATE_OR_PROVINCE_NAME = NameOID.STATE_OR_PROVINCE_NAME +OID_SURNAME = NameOID.SURNAME +OID_TITLE = NameOID.TITLE + +OID_CLIENT_AUTH = ExtendedKeyUsageOID.CLIENT_AUTH +OID_CODE_SIGNING = ExtendedKeyUsageOID.CODE_SIGNING +OID_EMAIL_PROTECTION = ExtendedKeyUsageOID.EMAIL_PROTECTION +OID_OCSP_SIGNING = ExtendedKeyUsageOID.OCSP_SIGNING +OID_SERVER_AUTH = ExtendedKeyUsageOID.SERVER_AUTH +OID_TIME_STAMPING = ExtendedKeyUsageOID.TIME_STAMPING + +OID_ANY_POLICY = CertificatePoliciesOID.ANY_POLICY +OID_CPS_QUALIFIER = CertificatePoliciesOID.CPS_QUALIFIER +OID_CPS_USER_NOTICE = CertificatePoliciesOID.CPS_USER_NOTICE + +OID_CERTIFICATE_ISSUER = CRLEntryExtensionOID.CERTIFICATE_ISSUER +OID_CRL_REASON = CRLEntryExtensionOID.CRL_REASON +OID_INVALIDITY_DATE = CRLEntryExtensionOID.INVALIDITY_DATE + +OID_CA_ISSUERS = AuthorityInformationAccessOID.CA_ISSUERS +OID_OCSP = AuthorityInformationAccessOID.OCSP + +__all__ = [ + "certificate_transparency", + "load_pem_x509_certificate", + "load_pem_x509_certificates", + "load_der_x509_certificate", + "load_pem_x509_csr", + "load_der_x509_csr", + "load_pem_x509_crl", + "load_der_x509_crl", + "random_serial_number", + "Attribute", + "AttributeNotFound", + "Attributes", + "InvalidVersion", + "DeltaCRLIndicator", + "DuplicateExtension", + "ExtensionNotFound", + "UnsupportedGeneralNameType", + "NameAttribute", + "Name", + "RelativeDistinguishedName", + "ObjectIdentifier", + "ExtensionType", + "Extensions", + "Extension", + "ExtendedKeyUsage", + "FreshestCRL", + "IssuingDistributionPoint", + "TLSFeature", + "TLSFeatureType", + "OCSPAcceptableResponses", + "OCSPNoCheck", + "BasicConstraints", + "CRLNumber", + "KeyUsage", + "AuthorityInformationAccess", + "SubjectInformationAccess", + "AccessDescription", + "CertificatePolicies", + "PolicyInformation", + "UserNotice", + "NoticeReference", + "SubjectKeyIdentifier", + "NameConstraints", + "CRLDistributionPoints", + "DistributionPoint", + "ReasonFlags", + "InhibitAnyPolicy", + "SubjectAlternativeName", + "IssuerAlternativeName", + "AuthorityKeyIdentifier", + "GeneralNames", + "GeneralName", + "RFC822Name", + "DNSName", + "UniformResourceIdentifier", + "RegisteredID", + "DirectoryName", + "IPAddress", + "OtherName", + "Certificate", + "CertificateRevocationList", + "CertificateRevocationListBuilder", + "CertificateSigningRequest", + "RevokedCertificate", + "RevokedCertificateBuilder", + "CertificateSigningRequestBuilder", + "CertificateBuilder", + "Version", + "OID_CA_ISSUERS", + "OID_OCSP", + "CertificateIssuer", + "CRLReason", + "InvalidityDate", + "UnrecognizedExtension", + "PolicyConstraints", + "PrecertificateSignedCertificateTimestamps", + "PrecertPoison", + "OCSPNonce", + "SignedCertificateTimestamps", + "SignatureAlgorithmOID", + "NameOID", + "MSCertificateTemplate", +] diff --git a/jwt/python/cryptography/x509/__pycache__/__init__.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..c0d1de4 Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/__pycache__/base.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..69ca8ab Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/base.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc new file mode 100644 index 0000000..b1e8141 Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/certificate_transparency.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/__pycache__/extensions.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/extensions.cpython-311.pyc new file mode 100644 index 0000000..571e3b5 Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/extensions.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/__pycache__/general_name.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/general_name.cpython-311.pyc new file mode 100644 index 0000000..57d9f7e Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/general_name.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/__pycache__/name.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/name.cpython-311.pyc new file mode 100644 index 0000000..b75d69b Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/name.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/__pycache__/ocsp.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/ocsp.cpython-311.pyc new file mode 100644 index 0000000..6e81399 Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/ocsp.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/__pycache__/oid.cpython-311.pyc b/jwt/python/cryptography/x509/__pycache__/oid.cpython-311.pyc new file mode 100644 index 0000000..df28d31 Binary files /dev/null and b/jwt/python/cryptography/x509/__pycache__/oid.cpython-311.pyc differ diff --git a/jwt/python/cryptography/x509/base.py b/jwt/python/cryptography/x509/base.py new file mode 100644 index 0000000..576385e --- /dev/null +++ b/jwt/python/cryptography/x509/base.py @@ -0,0 +1,1173 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime +import os +import typing + +from cryptography import utils +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import ( + dsa, + ec, + ed448, + ed25519, + padding, + rsa, + x448, + x25519, +) +from cryptography.hazmat.primitives.asymmetric.types import ( + CertificateIssuerPrivateKeyTypes, + CertificateIssuerPublicKeyTypes, + CertificatePublicKeyTypes, +) +from cryptography.x509.extensions import ( + Extension, + Extensions, + ExtensionType, + _make_sequence_methods, +) +from cryptography.x509.name import Name, _ASN1Type +from cryptography.x509.oid import ObjectIdentifier + +_EARLIEST_UTC_TIME = datetime.datetime(1950, 1, 1) + +# This must be kept in sync with sign.rs's list of allowable types in +# identify_hash_type +_AllowedHashTypes = typing.Union[ + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, + hashes.SHA3_224, + hashes.SHA3_256, + hashes.SHA3_384, + hashes.SHA3_512, +] + + +class AttributeNotFound(Exception): + def __init__(self, msg: str, oid: ObjectIdentifier) -> None: + super().__init__(msg) + self.oid = oid + + +def _reject_duplicate_extension( + extension: Extension[ExtensionType], + extensions: typing.List[Extension[ExtensionType]], +) -> None: + # This is quadratic in the number of extensions + for e in extensions: + if e.oid == extension.oid: + raise ValueError("This extension has already been set.") + + +def _reject_duplicate_attribute( + oid: ObjectIdentifier, + attributes: typing.List[ + typing.Tuple[ObjectIdentifier, bytes, typing.Optional[int]] + ], +) -> None: + # This is quadratic in the number of attributes + for attr_oid, _, _ in attributes: + if attr_oid == oid: + raise ValueError("This attribute has already been set.") + + +def _convert_to_naive_utc_time(time: datetime.datetime) -> datetime.datetime: + """Normalizes a datetime to a naive datetime in UTC. + + time -- datetime to normalize. Assumed to be in UTC if not timezone + aware. + """ + if time.tzinfo is not None: + offset = time.utcoffset() + offset = offset if offset else datetime.timedelta() + return time.replace(tzinfo=None) - offset + else: + return time + + +class Attribute: + def __init__( + self, + oid: ObjectIdentifier, + value: bytes, + _type: int = _ASN1Type.UTF8String.value, + ) -> None: + self._oid = oid + self._value = value + self._type = _type + + @property + def oid(self) -> ObjectIdentifier: + return self._oid + + @property + def value(self) -> bytes: + return self._value + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Attribute): + return NotImplemented + + return ( + self.oid == other.oid + and self.value == other.value + and self._type == other._type + ) + + def __hash__(self) -> int: + return hash((self.oid, self.value, self._type)) + + +class Attributes: + def __init__( + self, + attributes: typing.Iterable[Attribute], + ) -> None: + self._attributes = list(attributes) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_attributes") + + def __repr__(self) -> str: + return f"" + + def get_attribute_for_oid(self, oid: ObjectIdentifier) -> Attribute: + for attr in self: + if attr.oid == oid: + return attr + + raise AttributeNotFound(f"No {oid} attribute was found", oid) + + +class Version(utils.Enum): + v1 = 0 + v3 = 2 + + +class InvalidVersion(Exception): + def __init__(self, msg: str, parsed_version: int) -> None: + super().__init__(msg) + self.parsed_version = parsed_version + + +class Certificate(metaclass=abc.ABCMeta): + @abc.abstractmethod + def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes: + """ + Returns bytes using digest passed. + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + Returns certificate serial number + """ + + @property + @abc.abstractmethod + def version(self) -> Version: + """ + Returns the certificate version + """ + + @abc.abstractmethod + def public_key(self) -> CertificatePublicKeyTypes: + """ + Returns the public key + """ + + @property + @abc.abstractmethod + def not_valid_before(self) -> datetime.datetime: + """ + Not before time (represented as UTC datetime) + """ + + @property + @abc.abstractmethod + def not_valid_after(self) -> datetime.datetime: + """ + Not after time (represented as UTC datetime) + """ + + @property + @abc.abstractmethod + def issuer(self) -> Name: + """ + Returns the issuer name object. + """ + + @property + @abc.abstractmethod + def subject(self) -> Name: + """ + Returns the subject name object. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + in the certificate. + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> ObjectIdentifier: + """ + Returns the ObjectIdentifier of the signature algorithm. + """ + + @property + @abc.abstractmethod + def signature_algorithm_parameters( + self, + ) -> typing.Union[None, padding.PSS, padding.PKCS1v15, ec.ECDSA]: + """ + Returns the signature algorithm parameters. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns an Extensions object. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature bytes. + """ + + @property + @abc.abstractmethod + def tbs_certificate_bytes(self) -> bytes: + """ + Returns the tbsCertificate payload bytes as defined in RFC 5280. + """ + + @property + @abc.abstractmethod + def tbs_precertificate_bytes(self) -> bytes: + """ + Returns the tbsCertificate payload bytes with the SCT list extension + stripped. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + @abc.abstractmethod + def __hash__(self) -> int: + """ + Computes a hash. + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the certificate to PEM or DER format. + """ + + @abc.abstractmethod + def verify_directly_issued_by(self, issuer: Certificate) -> None: + """ + This method verifies that certificate issuer name matches the + issuer subject name and that the certificate is signed by the + issuer's private key. No other validation is performed. + """ + + +# Runtime isinstance checks need this since the rust class is not a subclass. +Certificate.register(rust_x509.Certificate) + + +class RevokedCertificate(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + Returns the serial number of the revoked certificate. + """ + + @property + @abc.abstractmethod + def revocation_date(self) -> datetime.datetime: + """ + Returns the date of when this certificate was revoked. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns an Extensions object containing a list of Revoked extensions. + """ + + +# Runtime isinstance checks need this since the rust class is not a subclass. +RevokedCertificate.register(rust_x509.RevokedCertificate) + + +class _RawRevokedCertificate(RevokedCertificate): + def __init__( + self, + serial_number: int, + revocation_date: datetime.datetime, + extensions: Extensions, + ): + self._serial_number = serial_number + self._revocation_date = revocation_date + self._extensions = extensions + + @property + def serial_number(self) -> int: + return self._serial_number + + @property + def revocation_date(self) -> datetime.datetime: + return self._revocation_date + + @property + def extensions(self) -> Extensions: + return self._extensions + + +class CertificateRevocationList(metaclass=abc.ABCMeta): + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the CRL to PEM or DER format. + """ + + @abc.abstractmethod + def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes: + """ + Returns bytes using digest passed. + """ + + @abc.abstractmethod + def get_revoked_certificate_by_serial_number( + self, serial_number: int + ) -> typing.Optional[RevokedCertificate]: + """ + Returns an instance of RevokedCertificate or None if the serial_number + is not in the CRL. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + in the certificate. + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> ObjectIdentifier: + """ + Returns the ObjectIdentifier of the signature algorithm. + """ + + @property + @abc.abstractmethod + def issuer(self) -> Name: + """ + Returns the X509Name with the issuer of this CRL. + """ + + @property + @abc.abstractmethod + def next_update(self) -> typing.Optional[datetime.datetime]: + """ + Returns the date of next update for this CRL. + """ + + @property + @abc.abstractmethod + def last_update(self) -> datetime.datetime: + """ + Returns the date of last update for this CRL. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns an Extensions object containing a list of CRL extensions. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature bytes. + """ + + @property + @abc.abstractmethod + def tbs_certlist_bytes(self) -> bytes: + """ + Returns the tbsCertList payload bytes as defined in RFC 5280. + """ + + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + @abc.abstractmethod + def __len__(self) -> int: + """ + Number of revoked certificates in the CRL. + """ + + @typing.overload + def __getitem__(self, idx: int) -> RevokedCertificate: + ... + + @typing.overload + def __getitem__(self, idx: slice) -> typing.List[RevokedCertificate]: + ... + + @abc.abstractmethod + def __getitem__( + self, idx: typing.Union[int, slice] + ) -> typing.Union[RevokedCertificate, typing.List[RevokedCertificate]]: + """ + Returns a revoked certificate (or slice of revoked certificates). + """ + + @abc.abstractmethod + def __iter__(self) -> typing.Iterator[RevokedCertificate]: + """ + Iterator over the revoked certificates + """ + + @abc.abstractmethod + def is_signature_valid( + self, public_key: CertificateIssuerPublicKeyTypes + ) -> bool: + """ + Verifies signature of revocation list against given public key. + """ + + +CertificateRevocationList.register(rust_x509.CertificateRevocationList) + + +class CertificateSigningRequest(metaclass=abc.ABCMeta): + @abc.abstractmethod + def __eq__(self, other: object) -> bool: + """ + Checks equality. + """ + + @abc.abstractmethod + def __hash__(self) -> int: + """ + Computes a hash. + """ + + @abc.abstractmethod + def public_key(self) -> CertificatePublicKeyTypes: + """ + Returns the public key + """ + + @property + @abc.abstractmethod + def subject(self) -> Name: + """ + Returns the subject name object. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + in the certificate. + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> ObjectIdentifier: + """ + Returns the ObjectIdentifier of the signature algorithm. + """ + + @property + @abc.abstractmethod + def extensions(self) -> Extensions: + """ + Returns the extensions in the signing request. + """ + + @property + @abc.abstractmethod + def attributes(self) -> Attributes: + """ + Returns an Attributes object. + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Encodes the request to PEM or DER format. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature bytes. + """ + + @property + @abc.abstractmethod + def tbs_certrequest_bytes(self) -> bytes: + """ + Returns the PKCS#10 CertificationRequestInfo bytes as defined in RFC + 2986. + """ + + @property + @abc.abstractmethod + def is_signature_valid(self) -> bool: + """ + Verifies signature of signing request. + """ + + @abc.abstractmethod + def get_attribute_for_oid(self, oid: ObjectIdentifier) -> bytes: + """ + Get the attribute value for a given OID. + """ + + +# Runtime isinstance checks need this since the rust class is not a subclass. +CertificateSigningRequest.register(rust_x509.CertificateSigningRequest) + + +# Backend argument preserved for API compatibility, but ignored. +def load_pem_x509_certificate( + data: bytes, backend: typing.Any = None +) -> Certificate: + return rust_x509.load_pem_x509_certificate(data) + + +def load_pem_x509_certificates(data: bytes) -> typing.List[Certificate]: + return rust_x509.load_pem_x509_certificates(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_der_x509_certificate( + data: bytes, backend: typing.Any = None +) -> Certificate: + return rust_x509.load_der_x509_certificate(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_pem_x509_csr( + data: bytes, backend: typing.Any = None +) -> CertificateSigningRequest: + return rust_x509.load_pem_x509_csr(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_der_x509_csr( + data: bytes, backend: typing.Any = None +) -> CertificateSigningRequest: + return rust_x509.load_der_x509_csr(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_pem_x509_crl( + data: bytes, backend: typing.Any = None +) -> CertificateRevocationList: + return rust_x509.load_pem_x509_crl(data) + + +# Backend argument preserved for API compatibility, but ignored. +def load_der_x509_crl( + data: bytes, backend: typing.Any = None +) -> CertificateRevocationList: + return rust_x509.load_der_x509_crl(data) + + +class CertificateSigningRequestBuilder: + def __init__( + self, + subject_name: typing.Optional[Name] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + attributes: typing.List[ + typing.Tuple[ObjectIdentifier, bytes, typing.Optional[int]] + ] = [], + ): + """ + Creates an empty X.509 certificate request (v1). + """ + self._subject_name = subject_name + self._extensions = extensions + self._attributes = attributes + + def subject_name(self, name: Name) -> CertificateSigningRequestBuilder: + """ + Sets the certificate requestor's distinguished name. + """ + if not isinstance(name, Name): + raise TypeError("Expecting x509.Name object.") + if self._subject_name is not None: + raise ValueError("The subject name may only be set once.") + return CertificateSigningRequestBuilder( + name, self._extensions, self._attributes + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> CertificateSigningRequestBuilder: + """ + Adds an X.509 extension to the certificate request. + """ + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return CertificateSigningRequestBuilder( + self._subject_name, + self._extensions + [extension], + self._attributes, + ) + + def add_attribute( + self, + oid: ObjectIdentifier, + value: bytes, + *, + _tag: typing.Optional[_ASN1Type] = None, + ) -> CertificateSigningRequestBuilder: + """ + Adds an X.509 attribute with an OID and associated value. + """ + if not isinstance(oid, ObjectIdentifier): + raise TypeError("oid must be an ObjectIdentifier") + + if not isinstance(value, bytes): + raise TypeError("value must be bytes") + + if _tag is not None and not isinstance(_tag, _ASN1Type): + raise TypeError("tag must be _ASN1Type") + + _reject_duplicate_attribute(oid, self._attributes) + + if _tag is not None: + tag = _tag.value + else: + tag = None + + return CertificateSigningRequestBuilder( + self._subject_name, + self._extensions, + self._attributes + [(oid, value, tag)], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[_AllowedHashTypes], + backend: typing.Any = None, + ) -> CertificateSigningRequest: + """ + Signs the request using the requestor's private key. + """ + if self._subject_name is None: + raise ValueError("A CertificateSigningRequest must have a subject") + return rust_x509.create_x509_csr(self, private_key, algorithm) + + +class CertificateBuilder: + _extensions: typing.List[Extension[ExtensionType]] + + def __init__( + self, + issuer_name: typing.Optional[Name] = None, + subject_name: typing.Optional[Name] = None, + public_key: typing.Optional[CertificatePublicKeyTypes] = None, + serial_number: typing.Optional[int] = None, + not_valid_before: typing.Optional[datetime.datetime] = None, + not_valid_after: typing.Optional[datetime.datetime] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + ) -> None: + self._version = Version.v3 + self._issuer_name = issuer_name + self._subject_name = subject_name + self._public_key = public_key + self._serial_number = serial_number + self._not_valid_before = not_valid_before + self._not_valid_after = not_valid_after + self._extensions = extensions + + def issuer_name(self, name: Name) -> CertificateBuilder: + """ + Sets the CA's distinguished name. + """ + if not isinstance(name, Name): + raise TypeError("Expecting x509.Name object.") + if self._issuer_name is not None: + raise ValueError("The issuer name may only be set once.") + return CertificateBuilder( + name, + self._subject_name, + self._public_key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def subject_name(self, name: Name) -> CertificateBuilder: + """ + Sets the requestor's distinguished name. + """ + if not isinstance(name, Name): + raise TypeError("Expecting x509.Name object.") + if self._subject_name is not None: + raise ValueError("The subject name may only be set once.") + return CertificateBuilder( + self._issuer_name, + name, + self._public_key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def public_key( + self, + key: CertificatePublicKeyTypes, + ) -> CertificateBuilder: + """ + Sets the requestor's public key (as found in the signing request). + """ + if not isinstance( + key, + ( + dsa.DSAPublicKey, + rsa.RSAPublicKey, + ec.EllipticCurvePublicKey, + ed25519.Ed25519PublicKey, + ed448.Ed448PublicKey, + x25519.X25519PublicKey, + x448.X448PublicKey, + ), + ): + raise TypeError( + "Expecting one of DSAPublicKey, RSAPublicKey," + " EllipticCurvePublicKey, Ed25519PublicKey," + " Ed448PublicKey, X25519PublicKey, or " + "X448PublicKey." + ) + if self._public_key is not None: + raise ValueError("The public key may only be set once.") + return CertificateBuilder( + self._issuer_name, + self._subject_name, + key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def serial_number(self, number: int) -> CertificateBuilder: + """ + Sets the certificate serial number. + """ + if not isinstance(number, int): + raise TypeError("Serial number must be of integral type.") + if self._serial_number is not None: + raise ValueError("The serial number may only be set once.") + if number <= 0: + raise ValueError("The serial number should be positive.") + + # ASN.1 integers are always signed, so most significant bit must be + # zero. + if number.bit_length() >= 160: # As defined in RFC 5280 + raise ValueError( + "The serial number should not be more than 159 " "bits." + ) + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + number, + self._not_valid_before, + self._not_valid_after, + self._extensions, + ) + + def not_valid_before(self, time: datetime.datetime) -> CertificateBuilder: + """ + Sets the certificate activation time. + """ + if not isinstance(time, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._not_valid_before is not None: + raise ValueError("The not valid before may only be set once.") + time = _convert_to_naive_utc_time(time) + if time < _EARLIEST_UTC_TIME: + raise ValueError( + "The not valid before date must be on or after" + " 1950 January 1)." + ) + if self._not_valid_after is not None and time > self._not_valid_after: + raise ValueError( + "The not valid before date must be before the not valid after " + "date." + ) + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + self._serial_number, + time, + self._not_valid_after, + self._extensions, + ) + + def not_valid_after(self, time: datetime.datetime) -> CertificateBuilder: + """ + Sets the certificate expiration time. + """ + if not isinstance(time, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._not_valid_after is not None: + raise ValueError("The not valid after may only be set once.") + time = _convert_to_naive_utc_time(time) + if time < _EARLIEST_UTC_TIME: + raise ValueError( + "The not valid after date must be on or after" + " 1950 January 1." + ) + if ( + self._not_valid_before is not None + and time < self._not_valid_before + ): + raise ValueError( + "The not valid after date must be after the not valid before " + "date." + ) + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + self._serial_number, + self._not_valid_before, + time, + self._extensions, + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> CertificateBuilder: + """ + Adds an X.509 extension to the certificate. + """ + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return CertificateBuilder( + self._issuer_name, + self._subject_name, + self._public_key, + self._serial_number, + self._not_valid_before, + self._not_valid_after, + self._extensions + [extension], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[_AllowedHashTypes], + backend: typing.Any = None, + *, + rsa_padding: typing.Optional[ + typing.Union[padding.PSS, padding.PKCS1v15] + ] = None, + ) -> Certificate: + """ + Signs the certificate using the CA's private key. + """ + if self._subject_name is None: + raise ValueError("A certificate must have a subject name") + + if self._issuer_name is None: + raise ValueError("A certificate must have an issuer name") + + if self._serial_number is None: + raise ValueError("A certificate must have a serial number") + + if self._not_valid_before is None: + raise ValueError("A certificate must have a not valid before time") + + if self._not_valid_after is None: + raise ValueError("A certificate must have a not valid after time") + + if self._public_key is None: + raise ValueError("A certificate must have a public key") + + if rsa_padding is not None: + if not isinstance(rsa_padding, (padding.PSS, padding.PKCS1v15)): + raise TypeError("Padding must be PSS or PKCS1v15") + if not isinstance(private_key, rsa.RSAPrivateKey): + raise TypeError("Padding is only supported for RSA keys") + + return rust_x509.create_x509_certificate( + self, private_key, algorithm, rsa_padding + ) + + +class CertificateRevocationListBuilder: + _extensions: typing.List[Extension[ExtensionType]] + _revoked_certificates: typing.List[RevokedCertificate] + + def __init__( + self, + issuer_name: typing.Optional[Name] = None, + last_update: typing.Optional[datetime.datetime] = None, + next_update: typing.Optional[datetime.datetime] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + revoked_certificates: typing.List[RevokedCertificate] = [], + ): + self._issuer_name = issuer_name + self._last_update = last_update + self._next_update = next_update + self._extensions = extensions + self._revoked_certificates = revoked_certificates + + def issuer_name( + self, issuer_name: Name + ) -> CertificateRevocationListBuilder: + if not isinstance(issuer_name, Name): + raise TypeError("Expecting x509.Name object.") + if self._issuer_name is not None: + raise ValueError("The issuer name may only be set once.") + return CertificateRevocationListBuilder( + issuer_name, + self._last_update, + self._next_update, + self._extensions, + self._revoked_certificates, + ) + + def last_update( + self, last_update: datetime.datetime + ) -> CertificateRevocationListBuilder: + if not isinstance(last_update, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._last_update is not None: + raise ValueError("Last update may only be set once.") + last_update = _convert_to_naive_utc_time(last_update) + if last_update < _EARLIEST_UTC_TIME: + raise ValueError( + "The last update date must be on or after" " 1950 January 1." + ) + if self._next_update is not None and last_update > self._next_update: + raise ValueError( + "The last update date must be before the next update date." + ) + return CertificateRevocationListBuilder( + self._issuer_name, + last_update, + self._next_update, + self._extensions, + self._revoked_certificates, + ) + + def next_update( + self, next_update: datetime.datetime + ) -> CertificateRevocationListBuilder: + if not isinstance(next_update, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._next_update is not None: + raise ValueError("Last update may only be set once.") + next_update = _convert_to_naive_utc_time(next_update) + if next_update < _EARLIEST_UTC_TIME: + raise ValueError( + "The last update date must be on or after" " 1950 January 1." + ) + if self._last_update is not None and next_update < self._last_update: + raise ValueError( + "The next update date must be after the last update date." + ) + return CertificateRevocationListBuilder( + self._issuer_name, + self._last_update, + next_update, + self._extensions, + self._revoked_certificates, + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> CertificateRevocationListBuilder: + """ + Adds an X.509 extension to the certificate revocation list. + """ + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + return CertificateRevocationListBuilder( + self._issuer_name, + self._last_update, + self._next_update, + self._extensions + [extension], + self._revoked_certificates, + ) + + def add_revoked_certificate( + self, revoked_certificate: RevokedCertificate + ) -> CertificateRevocationListBuilder: + """ + Adds a revoked certificate to the CRL. + """ + if not isinstance(revoked_certificate, RevokedCertificate): + raise TypeError("Must be an instance of RevokedCertificate") + + return CertificateRevocationListBuilder( + self._issuer_name, + self._last_update, + self._next_update, + self._extensions, + self._revoked_certificates + [revoked_certificate], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[_AllowedHashTypes], + backend: typing.Any = None, + ) -> CertificateRevocationList: + if self._issuer_name is None: + raise ValueError("A CRL must have an issuer name") + + if self._last_update is None: + raise ValueError("A CRL must have a last update time") + + if self._next_update is None: + raise ValueError("A CRL must have a next update time") + + return rust_x509.create_x509_crl(self, private_key, algorithm) + + +class RevokedCertificateBuilder: + def __init__( + self, + serial_number: typing.Optional[int] = None, + revocation_date: typing.Optional[datetime.datetime] = None, + extensions: typing.List[Extension[ExtensionType]] = [], + ): + self._serial_number = serial_number + self._revocation_date = revocation_date + self._extensions = extensions + + def serial_number(self, number: int) -> RevokedCertificateBuilder: + if not isinstance(number, int): + raise TypeError("Serial number must be of integral type.") + if self._serial_number is not None: + raise ValueError("The serial number may only be set once.") + if number <= 0: + raise ValueError("The serial number should be positive") + + # ASN.1 integers are always signed, so most significant bit must be + # zero. + if number.bit_length() >= 160: # As defined in RFC 5280 + raise ValueError( + "The serial number should not be more than 159 " "bits." + ) + return RevokedCertificateBuilder( + number, self._revocation_date, self._extensions + ) + + def revocation_date( + self, time: datetime.datetime + ) -> RevokedCertificateBuilder: + if not isinstance(time, datetime.datetime): + raise TypeError("Expecting datetime object.") + if self._revocation_date is not None: + raise ValueError("The revocation date may only be set once.") + time = _convert_to_naive_utc_time(time) + if time < _EARLIEST_UTC_TIME: + raise ValueError( + "The revocation date must be on or after" " 1950 January 1." + ) + return RevokedCertificateBuilder( + self._serial_number, time, self._extensions + ) + + def add_extension( + self, extval: ExtensionType, critical: bool + ) -> RevokedCertificateBuilder: + if not isinstance(extval, ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + return RevokedCertificateBuilder( + self._serial_number, + self._revocation_date, + self._extensions + [extension], + ) + + def build(self, backend: typing.Any = None) -> RevokedCertificate: + if self._serial_number is None: + raise ValueError("A revoked certificate must have a serial number") + if self._revocation_date is None: + raise ValueError( + "A revoked certificate must have a revocation date" + ) + return _RawRevokedCertificate( + self._serial_number, + self._revocation_date, + Extensions(self._extensions), + ) + + +def random_serial_number() -> int: + return int.from_bytes(os.urandom(20), "big") >> 1 diff --git a/jwt/python/cryptography/x509/certificate_transparency.py b/jwt/python/cryptography/x509/certificate_transparency.py new file mode 100644 index 0000000..73647ee --- /dev/null +++ b/jwt/python/cryptography/x509/certificate_transparency.py @@ -0,0 +1,97 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime + +from cryptography import utils +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.hazmat.primitives.hashes import HashAlgorithm + + +class LogEntryType(utils.Enum): + X509_CERTIFICATE = 0 + PRE_CERTIFICATE = 1 + + +class Version(utils.Enum): + v1 = 0 + + +class SignatureAlgorithm(utils.Enum): + """ + Signature algorithms that are valid for SCTs. + + These are exactly the same as SignatureAlgorithm in RFC 5246 (TLS 1.2). + + See: + """ + + ANONYMOUS = 0 + RSA = 1 + DSA = 2 + ECDSA = 3 + + +class SignedCertificateTimestamp(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def version(self) -> Version: + """ + Returns the SCT version. + """ + + @property + @abc.abstractmethod + def log_id(self) -> bytes: + """ + Returns an identifier indicating which log this SCT is for. + """ + + @property + @abc.abstractmethod + def timestamp(self) -> datetime.datetime: + """ + Returns the timestamp for this SCT. + """ + + @property + @abc.abstractmethod + def entry_type(self) -> LogEntryType: + """ + Returns whether this is an SCT for a certificate or pre-certificate. + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm(self) -> HashAlgorithm: + """ + Returns the hash algorithm used for the SCT's signature. + """ + + @property + @abc.abstractmethod + def signature_algorithm(self) -> SignatureAlgorithm: + """ + Returns the signing algorithm used for the SCT's signature. + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + Returns the signature for this SCT. + """ + + @property + @abc.abstractmethod + def extension_bytes(self) -> bytes: + """ + Returns the raw bytes of any extensions for this SCT. + """ + + +SignedCertificateTimestamp.register(rust_x509.Sct) diff --git a/jwt/python/cryptography/x509/extensions.py b/jwt/python/cryptography/x509/extensions.py new file mode 100644 index 0000000..ac99592 --- /dev/null +++ b/jwt/python/cryptography/x509/extensions.py @@ -0,0 +1,2215 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime +import hashlib +import ipaddress +import typing + +from cryptography import utils +from cryptography.hazmat.bindings._rust import asn1 +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.hazmat.primitives import constant_time, serialization +from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePublicKey +from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey +from cryptography.hazmat.primitives.asymmetric.types import ( + CertificateIssuerPublicKeyTypes, + CertificatePublicKeyTypes, +) +from cryptography.x509.certificate_transparency import ( + SignedCertificateTimestamp, +) +from cryptography.x509.general_name import ( + DirectoryName, + DNSName, + GeneralName, + IPAddress, + OtherName, + RegisteredID, + RFC822Name, + UniformResourceIdentifier, + _IPAddressTypes, +) +from cryptography.x509.name import Name, RelativeDistinguishedName +from cryptography.x509.oid import ( + CRLEntryExtensionOID, + ExtensionOID, + ObjectIdentifier, + OCSPExtensionOID, +) + +ExtensionTypeVar = typing.TypeVar( + "ExtensionTypeVar", bound="ExtensionType", covariant=True +) + + +def _key_identifier_from_public_key( + public_key: CertificatePublicKeyTypes, +) -> bytes: + if isinstance(public_key, RSAPublicKey): + data = public_key.public_bytes( + serialization.Encoding.DER, + serialization.PublicFormat.PKCS1, + ) + elif isinstance(public_key, EllipticCurvePublicKey): + data = public_key.public_bytes( + serialization.Encoding.X962, + serialization.PublicFormat.UncompressedPoint, + ) + else: + # This is a very slow way to do this. + serialized = public_key.public_bytes( + serialization.Encoding.DER, + serialization.PublicFormat.SubjectPublicKeyInfo, + ) + data = asn1.parse_spki_for_data(serialized) + + return hashlib.sha1(data).digest() + + +def _make_sequence_methods(field_name: str): + def len_method(self) -> int: + return len(getattr(self, field_name)) + + def iter_method(self): + return iter(getattr(self, field_name)) + + def getitem_method(self, idx): + return getattr(self, field_name)[idx] + + return len_method, iter_method, getitem_method + + +class DuplicateExtension(Exception): + def __init__(self, msg: str, oid: ObjectIdentifier) -> None: + super().__init__(msg) + self.oid = oid + + +class ExtensionNotFound(Exception): + def __init__(self, msg: str, oid: ObjectIdentifier) -> None: + super().__init__(msg) + self.oid = oid + + +class ExtensionType(metaclass=abc.ABCMeta): + oid: typing.ClassVar[ObjectIdentifier] + + def public_bytes(self) -> bytes: + """ + Serializes the extension type to DER. + """ + raise NotImplementedError( + "public_bytes is not implemented for extension type {!r}".format( + self + ) + ) + + +class Extensions: + def __init__( + self, extensions: typing.Iterable[Extension[ExtensionType]] + ) -> None: + self._extensions = list(extensions) + + def get_extension_for_oid( + self, oid: ObjectIdentifier + ) -> Extension[ExtensionType]: + for ext in self: + if ext.oid == oid: + return ext + + raise ExtensionNotFound(f"No {oid} extension was found", oid) + + def get_extension_for_class( + self, extclass: typing.Type[ExtensionTypeVar] + ) -> Extension[ExtensionTypeVar]: + if extclass is UnrecognizedExtension: + raise TypeError( + "UnrecognizedExtension can't be used with " + "get_extension_for_class because more than one instance of the" + " class may be present." + ) + + for ext in self: + if isinstance(ext.value, extclass): + return ext + + raise ExtensionNotFound( + f"No {extclass} extension was found", extclass.oid + ) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_extensions") + + def __repr__(self) -> str: + return f"" + + +class CRLNumber(ExtensionType): + oid = ExtensionOID.CRL_NUMBER + + def __init__(self, crl_number: int) -> None: + if not isinstance(crl_number, int): + raise TypeError("crl_number must be an integer") + + self._crl_number = crl_number + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CRLNumber): + return NotImplemented + + return self.crl_number == other.crl_number + + def __hash__(self) -> int: + return hash(self.crl_number) + + def __repr__(self) -> str: + return f"" + + @property + def crl_number(self) -> int: + return self._crl_number + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class AuthorityKeyIdentifier(ExtensionType): + oid = ExtensionOID.AUTHORITY_KEY_IDENTIFIER + + def __init__( + self, + key_identifier: typing.Optional[bytes], + authority_cert_issuer: typing.Optional[typing.Iterable[GeneralName]], + authority_cert_serial_number: typing.Optional[int], + ) -> None: + if (authority_cert_issuer is None) != ( + authority_cert_serial_number is None + ): + raise ValueError( + "authority_cert_issuer and authority_cert_serial_number " + "must both be present or both None" + ) + + if authority_cert_issuer is not None: + authority_cert_issuer = list(authority_cert_issuer) + if not all( + isinstance(x, GeneralName) for x in authority_cert_issuer + ): + raise TypeError( + "authority_cert_issuer must be a list of GeneralName " + "objects" + ) + + if authority_cert_serial_number is not None and not isinstance( + authority_cert_serial_number, int + ): + raise TypeError("authority_cert_serial_number must be an integer") + + self._key_identifier = key_identifier + self._authority_cert_issuer = authority_cert_issuer + self._authority_cert_serial_number = authority_cert_serial_number + + # This takes a subset of CertificatePublicKeyTypes because an issuer + # cannot have an X25519/X448 key. This introduces some unfortunate + # asymmetry that requires typing users to explicitly + # narrow their type, but we should make this accurate and not just + # convenient. + @classmethod + def from_issuer_public_key( + cls, public_key: CertificateIssuerPublicKeyTypes + ) -> AuthorityKeyIdentifier: + digest = _key_identifier_from_public_key(public_key) + return cls( + key_identifier=digest, + authority_cert_issuer=None, + authority_cert_serial_number=None, + ) + + @classmethod + def from_issuer_subject_key_identifier( + cls, ski: SubjectKeyIdentifier + ) -> AuthorityKeyIdentifier: + return cls( + key_identifier=ski.digest, + authority_cert_issuer=None, + authority_cert_serial_number=None, + ) + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, AuthorityKeyIdentifier): + return NotImplemented + + return ( + self.key_identifier == other.key_identifier + and self.authority_cert_issuer == other.authority_cert_issuer + and self.authority_cert_serial_number + == other.authority_cert_serial_number + ) + + def __hash__(self) -> int: + if self.authority_cert_issuer is None: + aci = None + else: + aci = tuple(self.authority_cert_issuer) + return hash( + (self.key_identifier, aci, self.authority_cert_serial_number) + ) + + @property + def key_identifier(self) -> typing.Optional[bytes]: + return self._key_identifier + + @property + def authority_cert_issuer( + self, + ) -> typing.Optional[typing.List[GeneralName]]: + return self._authority_cert_issuer + + @property + def authority_cert_serial_number(self) -> typing.Optional[int]: + return self._authority_cert_serial_number + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class SubjectKeyIdentifier(ExtensionType): + oid = ExtensionOID.SUBJECT_KEY_IDENTIFIER + + def __init__(self, digest: bytes) -> None: + self._digest = digest + + @classmethod + def from_public_key( + cls, public_key: CertificatePublicKeyTypes + ) -> SubjectKeyIdentifier: + return cls(_key_identifier_from_public_key(public_key)) + + @property + def digest(self) -> bytes: + return self._digest + + @property + def key_identifier(self) -> bytes: + return self._digest + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SubjectKeyIdentifier): + return NotImplemented + + return constant_time.bytes_eq(self.digest, other.digest) + + def __hash__(self) -> int: + return hash(self.digest) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class AuthorityInformationAccess(ExtensionType): + oid = ExtensionOID.AUTHORITY_INFORMATION_ACCESS + + def __init__( + self, descriptions: typing.Iterable[AccessDescription] + ) -> None: + descriptions = list(descriptions) + if not all(isinstance(x, AccessDescription) for x in descriptions): + raise TypeError( + "Every item in the descriptions list must be an " + "AccessDescription" + ) + + self._descriptions = descriptions + + __len__, __iter__, __getitem__ = _make_sequence_methods("_descriptions") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, AuthorityInformationAccess): + return NotImplemented + + return self._descriptions == other._descriptions + + def __hash__(self) -> int: + return hash(tuple(self._descriptions)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class SubjectInformationAccess(ExtensionType): + oid = ExtensionOID.SUBJECT_INFORMATION_ACCESS + + def __init__( + self, descriptions: typing.Iterable[AccessDescription] + ) -> None: + descriptions = list(descriptions) + if not all(isinstance(x, AccessDescription) for x in descriptions): + raise TypeError( + "Every item in the descriptions list must be an " + "AccessDescription" + ) + + self._descriptions = descriptions + + __len__, __iter__, __getitem__ = _make_sequence_methods("_descriptions") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SubjectInformationAccess): + return NotImplemented + + return self._descriptions == other._descriptions + + def __hash__(self) -> int: + return hash(tuple(self._descriptions)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class AccessDescription: + def __init__( + self, access_method: ObjectIdentifier, access_location: GeneralName + ) -> None: + if not isinstance(access_method, ObjectIdentifier): + raise TypeError("access_method must be an ObjectIdentifier") + + if not isinstance(access_location, GeneralName): + raise TypeError("access_location must be a GeneralName") + + self._access_method = access_method + self._access_location = access_location + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, AccessDescription): + return NotImplemented + + return ( + self.access_method == other.access_method + and self.access_location == other.access_location + ) + + def __hash__(self) -> int: + return hash((self.access_method, self.access_location)) + + @property + def access_method(self) -> ObjectIdentifier: + return self._access_method + + @property + def access_location(self) -> GeneralName: + return self._access_location + + +class BasicConstraints(ExtensionType): + oid = ExtensionOID.BASIC_CONSTRAINTS + + def __init__(self, ca: bool, path_length: typing.Optional[int]) -> None: + if not isinstance(ca, bool): + raise TypeError("ca must be a boolean value") + + if path_length is not None and not ca: + raise ValueError("path_length must be None when ca is False") + + if path_length is not None and ( + not isinstance(path_length, int) or path_length < 0 + ): + raise TypeError( + "path_length must be a non-negative integer or None" + ) + + self._ca = ca + self._path_length = path_length + + @property + def ca(self) -> bool: + return self._ca + + @property + def path_length(self) -> typing.Optional[int]: + return self._path_length + + def __repr__(self) -> str: + return ( + "" + ).format(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, BasicConstraints): + return NotImplemented + + return self.ca == other.ca and self.path_length == other.path_length + + def __hash__(self) -> int: + return hash((self.ca, self.path_length)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class DeltaCRLIndicator(ExtensionType): + oid = ExtensionOID.DELTA_CRL_INDICATOR + + def __init__(self, crl_number: int) -> None: + if not isinstance(crl_number, int): + raise TypeError("crl_number must be an integer") + + self._crl_number = crl_number + + @property + def crl_number(self) -> int: + return self._crl_number + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DeltaCRLIndicator): + return NotImplemented + + return self.crl_number == other.crl_number + + def __hash__(self) -> int: + return hash(self.crl_number) + + def __repr__(self) -> str: + return f"" + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CRLDistributionPoints(ExtensionType): + oid = ExtensionOID.CRL_DISTRIBUTION_POINTS + + def __init__( + self, distribution_points: typing.Iterable[DistributionPoint] + ) -> None: + distribution_points = list(distribution_points) + if not all( + isinstance(x, DistributionPoint) for x in distribution_points + ): + raise TypeError( + "distribution_points must be a list of DistributionPoint " + "objects" + ) + + self._distribution_points = distribution_points + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_distribution_points" + ) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CRLDistributionPoints): + return NotImplemented + + return self._distribution_points == other._distribution_points + + def __hash__(self) -> int: + return hash(tuple(self._distribution_points)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class FreshestCRL(ExtensionType): + oid = ExtensionOID.FRESHEST_CRL + + def __init__( + self, distribution_points: typing.Iterable[DistributionPoint] + ) -> None: + distribution_points = list(distribution_points) + if not all( + isinstance(x, DistributionPoint) for x in distribution_points + ): + raise TypeError( + "distribution_points must be a list of DistributionPoint " + "objects" + ) + + self._distribution_points = distribution_points + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_distribution_points" + ) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, FreshestCRL): + return NotImplemented + + return self._distribution_points == other._distribution_points + + def __hash__(self) -> int: + return hash(tuple(self._distribution_points)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class DistributionPoint: + def __init__( + self, + full_name: typing.Optional[typing.Iterable[GeneralName]], + relative_name: typing.Optional[RelativeDistinguishedName], + reasons: typing.Optional[typing.FrozenSet[ReasonFlags]], + crl_issuer: typing.Optional[typing.Iterable[GeneralName]], + ) -> None: + if full_name and relative_name: + raise ValueError( + "You cannot provide both full_name and relative_name, at " + "least one must be None." + ) + if not full_name and not relative_name and not crl_issuer: + raise ValueError( + "Either full_name, relative_name or crl_issuer must be " + "provided." + ) + + if full_name is not None: + full_name = list(full_name) + if not all(isinstance(x, GeneralName) for x in full_name): + raise TypeError( + "full_name must be a list of GeneralName objects" + ) + + if relative_name: + if not isinstance(relative_name, RelativeDistinguishedName): + raise TypeError( + "relative_name must be a RelativeDistinguishedName" + ) + + if crl_issuer is not None: + crl_issuer = list(crl_issuer) + if not all(isinstance(x, GeneralName) for x in crl_issuer): + raise TypeError( + "crl_issuer must be None or a list of general names" + ) + + if reasons and ( + not isinstance(reasons, frozenset) + or not all(isinstance(x, ReasonFlags) for x in reasons) + ): + raise TypeError("reasons must be None or frozenset of ReasonFlags") + + if reasons and ( + ReasonFlags.unspecified in reasons + or ReasonFlags.remove_from_crl in reasons + ): + raise ValueError( + "unspecified and remove_from_crl are not valid reasons in a " + "DistributionPoint" + ) + + self._full_name = full_name + self._relative_name = relative_name + self._reasons = reasons + self._crl_issuer = crl_issuer + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DistributionPoint): + return NotImplemented + + return ( + self.full_name == other.full_name + and self.relative_name == other.relative_name + and self.reasons == other.reasons + and self.crl_issuer == other.crl_issuer + ) + + def __hash__(self) -> int: + if self.full_name is not None: + fn: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple( + self.full_name + ) + else: + fn = None + + if self.crl_issuer is not None: + crl_issuer: typing.Optional[ + typing.Tuple[GeneralName, ...] + ] = tuple(self.crl_issuer) + else: + crl_issuer = None + + return hash((fn, self.relative_name, self.reasons, crl_issuer)) + + @property + def full_name(self) -> typing.Optional[typing.List[GeneralName]]: + return self._full_name + + @property + def relative_name(self) -> typing.Optional[RelativeDistinguishedName]: + return self._relative_name + + @property + def reasons(self) -> typing.Optional[typing.FrozenSet[ReasonFlags]]: + return self._reasons + + @property + def crl_issuer(self) -> typing.Optional[typing.List[GeneralName]]: + return self._crl_issuer + + +class ReasonFlags(utils.Enum): + unspecified = "unspecified" + key_compromise = "keyCompromise" + ca_compromise = "cACompromise" + affiliation_changed = "affiliationChanged" + superseded = "superseded" + cessation_of_operation = "cessationOfOperation" + certificate_hold = "certificateHold" + privilege_withdrawn = "privilegeWithdrawn" + aa_compromise = "aACompromise" + remove_from_crl = "removeFromCRL" + + +# These are distribution point bit string mappings. Not to be confused with +# CRLReason reason flags bit string mappings. +# ReasonFlags ::= BIT STRING { +# unused (0), +# keyCompromise (1), +# cACompromise (2), +# affiliationChanged (3), +# superseded (4), +# cessationOfOperation (5), +# certificateHold (6), +# privilegeWithdrawn (7), +# aACompromise (8) } +_REASON_BIT_MAPPING = { + 1: ReasonFlags.key_compromise, + 2: ReasonFlags.ca_compromise, + 3: ReasonFlags.affiliation_changed, + 4: ReasonFlags.superseded, + 5: ReasonFlags.cessation_of_operation, + 6: ReasonFlags.certificate_hold, + 7: ReasonFlags.privilege_withdrawn, + 8: ReasonFlags.aa_compromise, +} + +_CRLREASONFLAGS = { + ReasonFlags.key_compromise: 1, + ReasonFlags.ca_compromise: 2, + ReasonFlags.affiliation_changed: 3, + ReasonFlags.superseded: 4, + ReasonFlags.cessation_of_operation: 5, + ReasonFlags.certificate_hold: 6, + ReasonFlags.privilege_withdrawn: 7, + ReasonFlags.aa_compromise: 8, +} + + +class PolicyConstraints(ExtensionType): + oid = ExtensionOID.POLICY_CONSTRAINTS + + def __init__( + self, + require_explicit_policy: typing.Optional[int], + inhibit_policy_mapping: typing.Optional[int], + ) -> None: + if require_explicit_policy is not None and not isinstance( + require_explicit_policy, int + ): + raise TypeError( + "require_explicit_policy must be a non-negative integer or " + "None" + ) + + if inhibit_policy_mapping is not None and not isinstance( + inhibit_policy_mapping, int + ): + raise TypeError( + "inhibit_policy_mapping must be a non-negative integer or None" + ) + + if inhibit_policy_mapping is None and require_explicit_policy is None: + raise ValueError( + "At least one of require_explicit_policy and " + "inhibit_policy_mapping must not be None" + ) + + self._require_explicit_policy = require_explicit_policy + self._inhibit_policy_mapping = inhibit_policy_mapping + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PolicyConstraints): + return NotImplemented + + return ( + self.require_explicit_policy == other.require_explicit_policy + and self.inhibit_policy_mapping == other.inhibit_policy_mapping + ) + + def __hash__(self) -> int: + return hash( + (self.require_explicit_policy, self.inhibit_policy_mapping) + ) + + @property + def require_explicit_policy(self) -> typing.Optional[int]: + return self._require_explicit_policy + + @property + def inhibit_policy_mapping(self) -> typing.Optional[int]: + return self._inhibit_policy_mapping + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CertificatePolicies(ExtensionType): + oid = ExtensionOID.CERTIFICATE_POLICIES + + def __init__(self, policies: typing.Iterable[PolicyInformation]) -> None: + policies = list(policies) + if not all(isinstance(x, PolicyInformation) for x in policies): + raise TypeError( + "Every item in the policies list must be a " + "PolicyInformation" + ) + + self._policies = policies + + __len__, __iter__, __getitem__ = _make_sequence_methods("_policies") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CertificatePolicies): + return NotImplemented + + return self._policies == other._policies + + def __hash__(self) -> int: + return hash(tuple(self._policies)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class PolicyInformation: + def __init__( + self, + policy_identifier: ObjectIdentifier, + policy_qualifiers: typing.Optional[ + typing.Iterable[typing.Union[str, UserNotice]] + ], + ) -> None: + if not isinstance(policy_identifier, ObjectIdentifier): + raise TypeError("policy_identifier must be an ObjectIdentifier") + + self._policy_identifier = policy_identifier + + if policy_qualifiers is not None: + policy_qualifiers = list(policy_qualifiers) + if not all( + isinstance(x, (str, UserNotice)) for x in policy_qualifiers + ): + raise TypeError( + "policy_qualifiers must be a list of strings and/or " + "UserNotice objects or None" + ) + + self._policy_qualifiers = policy_qualifiers + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PolicyInformation): + return NotImplemented + + return ( + self.policy_identifier == other.policy_identifier + and self.policy_qualifiers == other.policy_qualifiers + ) + + def __hash__(self) -> int: + if self.policy_qualifiers is not None: + pq: typing.Optional[ + typing.Tuple[typing.Union[str, UserNotice], ...] + ] = tuple(self.policy_qualifiers) + else: + pq = None + + return hash((self.policy_identifier, pq)) + + @property + def policy_identifier(self) -> ObjectIdentifier: + return self._policy_identifier + + @property + def policy_qualifiers( + self, + ) -> typing.Optional[typing.List[typing.Union[str, UserNotice]]]: + return self._policy_qualifiers + + +class UserNotice: + def __init__( + self, + notice_reference: typing.Optional[NoticeReference], + explicit_text: typing.Optional[str], + ) -> None: + if notice_reference and not isinstance( + notice_reference, NoticeReference + ): + raise TypeError( + "notice_reference must be None or a NoticeReference" + ) + + self._notice_reference = notice_reference + self._explicit_text = explicit_text + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, UserNotice): + return NotImplemented + + return ( + self.notice_reference == other.notice_reference + and self.explicit_text == other.explicit_text + ) + + def __hash__(self) -> int: + return hash((self.notice_reference, self.explicit_text)) + + @property + def notice_reference(self) -> typing.Optional[NoticeReference]: + return self._notice_reference + + @property + def explicit_text(self) -> typing.Optional[str]: + return self._explicit_text + + +class NoticeReference: + def __init__( + self, + organization: typing.Optional[str], + notice_numbers: typing.Iterable[int], + ) -> None: + self._organization = organization + notice_numbers = list(notice_numbers) + if not all(isinstance(x, int) for x in notice_numbers): + raise TypeError("notice_numbers must be a list of integers") + + self._notice_numbers = notice_numbers + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, NoticeReference): + return NotImplemented + + return ( + self.organization == other.organization + and self.notice_numbers == other.notice_numbers + ) + + def __hash__(self) -> int: + return hash((self.organization, tuple(self.notice_numbers))) + + @property + def organization(self) -> typing.Optional[str]: + return self._organization + + @property + def notice_numbers(self) -> typing.List[int]: + return self._notice_numbers + + +class ExtendedKeyUsage(ExtensionType): + oid = ExtensionOID.EXTENDED_KEY_USAGE + + def __init__(self, usages: typing.Iterable[ObjectIdentifier]) -> None: + usages = list(usages) + if not all(isinstance(x, ObjectIdentifier) for x in usages): + raise TypeError( + "Every item in the usages list must be an ObjectIdentifier" + ) + + self._usages = usages + + __len__, __iter__, __getitem__ = _make_sequence_methods("_usages") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, ExtendedKeyUsage): + return NotImplemented + + return self._usages == other._usages + + def __hash__(self) -> int: + return hash(tuple(self._usages)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class OCSPNoCheck(ExtensionType): + oid = ExtensionOID.OCSP_NO_CHECK + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OCSPNoCheck): + return NotImplemented + + return True + + def __hash__(self) -> int: + return hash(OCSPNoCheck) + + def __repr__(self) -> str: + return "" + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class PrecertPoison(ExtensionType): + oid = ExtensionOID.PRECERT_POISON + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PrecertPoison): + return NotImplemented + + return True + + def __hash__(self) -> int: + return hash(PrecertPoison) + + def __repr__(self) -> str: + return "" + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class TLSFeature(ExtensionType): + oid = ExtensionOID.TLS_FEATURE + + def __init__(self, features: typing.Iterable[TLSFeatureType]) -> None: + features = list(features) + if ( + not all(isinstance(x, TLSFeatureType) for x in features) + or len(features) == 0 + ): + raise TypeError( + "features must be a list of elements from the TLSFeatureType " + "enum" + ) + + self._features = features + + __len__, __iter__, __getitem__ = _make_sequence_methods("_features") + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, TLSFeature): + return NotImplemented + + return self._features == other._features + + def __hash__(self) -> int: + return hash(tuple(self._features)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class TLSFeatureType(utils.Enum): + # status_request is defined in RFC 6066 and is used for what is commonly + # called OCSP Must-Staple when present in the TLS Feature extension in an + # X.509 certificate. + status_request = 5 + # status_request_v2 is defined in RFC 6961 and allows multiple OCSP + # responses to be provided. It is not currently in use by clients or + # servers. + status_request_v2 = 17 + + +_TLS_FEATURE_TYPE_TO_ENUM = {x.value: x for x in TLSFeatureType} + + +class InhibitAnyPolicy(ExtensionType): + oid = ExtensionOID.INHIBIT_ANY_POLICY + + def __init__(self, skip_certs: int) -> None: + if not isinstance(skip_certs, int): + raise TypeError("skip_certs must be an integer") + + if skip_certs < 0: + raise ValueError("skip_certs must be a non-negative integer") + + self._skip_certs = skip_certs + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, InhibitAnyPolicy): + return NotImplemented + + return self.skip_certs == other.skip_certs + + def __hash__(self) -> int: + return hash(self.skip_certs) + + @property + def skip_certs(self) -> int: + return self._skip_certs + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class KeyUsage(ExtensionType): + oid = ExtensionOID.KEY_USAGE + + def __init__( + self, + digital_signature: bool, + content_commitment: bool, + key_encipherment: bool, + data_encipherment: bool, + key_agreement: bool, + key_cert_sign: bool, + crl_sign: bool, + encipher_only: bool, + decipher_only: bool, + ) -> None: + if not key_agreement and (encipher_only or decipher_only): + raise ValueError( + "encipher_only and decipher_only can only be true when " + "key_agreement is true" + ) + + self._digital_signature = digital_signature + self._content_commitment = content_commitment + self._key_encipherment = key_encipherment + self._data_encipherment = data_encipherment + self._key_agreement = key_agreement + self._key_cert_sign = key_cert_sign + self._crl_sign = crl_sign + self._encipher_only = encipher_only + self._decipher_only = decipher_only + + @property + def digital_signature(self) -> bool: + return self._digital_signature + + @property + def content_commitment(self) -> bool: + return self._content_commitment + + @property + def key_encipherment(self) -> bool: + return self._key_encipherment + + @property + def data_encipherment(self) -> bool: + return self._data_encipherment + + @property + def key_agreement(self) -> bool: + return self._key_agreement + + @property + def key_cert_sign(self) -> bool: + return self._key_cert_sign + + @property + def crl_sign(self) -> bool: + return self._crl_sign + + @property + def encipher_only(self) -> bool: + if not self.key_agreement: + raise ValueError( + "encipher_only is undefined unless key_agreement is true" + ) + else: + return self._encipher_only + + @property + def decipher_only(self) -> bool: + if not self.key_agreement: + raise ValueError( + "decipher_only is undefined unless key_agreement is true" + ) + else: + return self._decipher_only + + def __repr__(self) -> str: + try: + encipher_only = self.encipher_only + decipher_only = self.decipher_only + except ValueError: + # Users found None confusing because even though encipher/decipher + # have no meaning unless key_agreement is true, to construct an + # instance of the class you still need to pass False. + encipher_only = False + decipher_only = False + + return ( + "" + ).format(self, encipher_only, decipher_only) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, KeyUsage): + return NotImplemented + + return ( + self.digital_signature == other.digital_signature + and self.content_commitment == other.content_commitment + and self.key_encipherment == other.key_encipherment + and self.data_encipherment == other.data_encipherment + and self.key_agreement == other.key_agreement + and self.key_cert_sign == other.key_cert_sign + and self.crl_sign == other.crl_sign + and self._encipher_only == other._encipher_only + and self._decipher_only == other._decipher_only + ) + + def __hash__(self) -> int: + return hash( + ( + self.digital_signature, + self.content_commitment, + self.key_encipherment, + self.data_encipherment, + self.key_agreement, + self.key_cert_sign, + self.crl_sign, + self._encipher_only, + self._decipher_only, + ) + ) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class NameConstraints(ExtensionType): + oid = ExtensionOID.NAME_CONSTRAINTS + + def __init__( + self, + permitted_subtrees: typing.Optional[typing.Iterable[GeneralName]], + excluded_subtrees: typing.Optional[typing.Iterable[GeneralName]], + ) -> None: + if permitted_subtrees is not None: + permitted_subtrees = list(permitted_subtrees) + if not permitted_subtrees: + raise ValueError( + "permitted_subtrees must be a non-empty list or None" + ) + if not all(isinstance(x, GeneralName) for x in permitted_subtrees): + raise TypeError( + "permitted_subtrees must be a list of GeneralName objects " + "or None" + ) + + self._validate_tree(permitted_subtrees) + + if excluded_subtrees is not None: + excluded_subtrees = list(excluded_subtrees) + if not excluded_subtrees: + raise ValueError( + "excluded_subtrees must be a non-empty list or None" + ) + if not all(isinstance(x, GeneralName) for x in excluded_subtrees): + raise TypeError( + "excluded_subtrees must be a list of GeneralName objects " + "or None" + ) + + self._validate_tree(excluded_subtrees) + + if permitted_subtrees is None and excluded_subtrees is None: + raise ValueError( + "At least one of permitted_subtrees and excluded_subtrees " + "must not be None" + ) + + self._permitted_subtrees = permitted_subtrees + self._excluded_subtrees = excluded_subtrees + + def __eq__(self, other: object) -> bool: + if not isinstance(other, NameConstraints): + return NotImplemented + + return ( + self.excluded_subtrees == other.excluded_subtrees + and self.permitted_subtrees == other.permitted_subtrees + ) + + def _validate_tree(self, tree: typing.Iterable[GeneralName]) -> None: + self._validate_ip_name(tree) + self._validate_dns_name(tree) + + def _validate_ip_name(self, tree: typing.Iterable[GeneralName]) -> None: + if any( + isinstance(name, IPAddress) + and not isinstance( + name.value, (ipaddress.IPv4Network, ipaddress.IPv6Network) + ) + for name in tree + ): + raise TypeError( + "IPAddress name constraints must be an IPv4Network or" + " IPv6Network object" + ) + + def _validate_dns_name(self, tree: typing.Iterable[GeneralName]) -> None: + if any( + isinstance(name, DNSName) and "*" in name.value for name in tree + ): + raise ValueError( + "DNSName name constraints must not contain the '*' wildcard" + " character" + ) + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __hash__(self) -> int: + if self.permitted_subtrees is not None: + ps: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple( + self.permitted_subtrees + ) + else: + ps = None + + if self.excluded_subtrees is not None: + es: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple( + self.excluded_subtrees + ) + else: + es = None + + return hash((ps, es)) + + @property + def permitted_subtrees( + self, + ) -> typing.Optional[typing.List[GeneralName]]: + return self._permitted_subtrees + + @property + def excluded_subtrees( + self, + ) -> typing.Optional[typing.List[GeneralName]]: + return self._excluded_subtrees + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class Extension(typing.Generic[ExtensionTypeVar]): + def __init__( + self, oid: ObjectIdentifier, critical: bool, value: ExtensionTypeVar + ) -> None: + if not isinstance(oid, ObjectIdentifier): + raise TypeError( + "oid argument must be an ObjectIdentifier instance." + ) + + if not isinstance(critical, bool): + raise TypeError("critical must be a boolean value") + + self._oid = oid + self._critical = critical + self._value = value + + @property + def oid(self) -> ObjectIdentifier: + return self._oid + + @property + def critical(self) -> bool: + return self._critical + + @property + def value(self) -> ExtensionTypeVar: + return self._value + + def __repr__(self) -> str: + return ( + "" + ).format(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Extension): + return NotImplemented + + return ( + self.oid == other.oid + and self.critical == other.critical + and self.value == other.value + ) + + def __hash__(self) -> int: + return hash((self.oid, self.critical, self.value)) + + +class GeneralNames: + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + general_names = list(general_names) + if not all(isinstance(x, GeneralName) for x in general_names): + raise TypeError( + "Every item in the general_names list must be an " + "object conforming to the GeneralName interface" + ) + + self._general_names = general_names + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + # Return the value of each GeneralName, except for OtherName instances + # which we return directly because it has two important properties not + # just one value. + objs = (i for i in self if isinstance(i, type)) + if type != OtherName: + return [i.value for i in objs] + return list(objs) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, GeneralNames): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(tuple(self._general_names)) + + +class SubjectAlternativeName(ExtensionType): + oid = ExtensionOID.SUBJECT_ALTERNATIVE_NAME + + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + self._general_names = GeneralNames(general_names) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + return self._general_names.get_values_for_type(type) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SubjectAlternativeName): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(self._general_names) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class IssuerAlternativeName(ExtensionType): + oid = ExtensionOID.ISSUER_ALTERNATIVE_NAME + + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + self._general_names = GeneralNames(general_names) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + return self._general_names.get_values_for_type(type) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, IssuerAlternativeName): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(self._general_names) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CertificateIssuer(ExtensionType): + oid = CRLEntryExtensionOID.CERTIFICATE_ISSUER + + def __init__(self, general_names: typing.Iterable[GeneralName]) -> None: + self._general_names = GeneralNames(general_names) + + __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names") + + @typing.overload + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[UniformResourceIdentifier], + typing.Type[RFC822Name], + ], + ) -> typing.List[str]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[DirectoryName], + ) -> typing.List[Name]: + ... + + @typing.overload + def get_values_for_type( + self, + type: typing.Type[RegisteredID], + ) -> typing.List[ObjectIdentifier]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[IPAddress] + ) -> typing.List[_IPAddressTypes]: + ... + + @typing.overload + def get_values_for_type( + self, type: typing.Type[OtherName] + ) -> typing.List[OtherName]: + ... + + def get_values_for_type( + self, + type: typing.Union[ + typing.Type[DNSName], + typing.Type[DirectoryName], + typing.Type[IPAddress], + typing.Type[OtherName], + typing.Type[RFC822Name], + typing.Type[RegisteredID], + typing.Type[UniformResourceIdentifier], + ], + ) -> typing.Union[ + typing.List[_IPAddressTypes], + typing.List[str], + typing.List[OtherName], + typing.List[Name], + typing.List[ObjectIdentifier], + ]: + return self._general_names.get_values_for_type(type) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CertificateIssuer): + return NotImplemented + + return self._general_names == other._general_names + + def __hash__(self) -> int: + return hash(self._general_names) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class CRLReason(ExtensionType): + oid = CRLEntryExtensionOID.CRL_REASON + + def __init__(self, reason: ReasonFlags) -> None: + if not isinstance(reason, ReasonFlags): + raise TypeError("reason must be an element from ReasonFlags") + + self._reason = reason + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CRLReason): + return NotImplemented + + return self.reason == other.reason + + def __hash__(self) -> int: + return hash(self.reason) + + @property + def reason(self) -> ReasonFlags: + return self._reason + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class InvalidityDate(ExtensionType): + oid = CRLEntryExtensionOID.INVALIDITY_DATE + + def __init__(self, invalidity_date: datetime.datetime) -> None: + if not isinstance(invalidity_date, datetime.datetime): + raise TypeError("invalidity_date must be a datetime.datetime") + + self._invalidity_date = invalidity_date + + def __repr__(self) -> str: + return "".format( + self._invalidity_date + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, InvalidityDate): + return NotImplemented + + return self.invalidity_date == other.invalidity_date + + def __hash__(self) -> int: + return hash(self.invalidity_date) + + @property + def invalidity_date(self) -> datetime.datetime: + return self._invalidity_date + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class PrecertificateSignedCertificateTimestamps(ExtensionType): + oid = ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS + + def __init__( + self, + signed_certificate_timestamps: typing.Iterable[ + SignedCertificateTimestamp + ], + ) -> None: + signed_certificate_timestamps = list(signed_certificate_timestamps) + if not all( + isinstance(sct, SignedCertificateTimestamp) + for sct in signed_certificate_timestamps + ): + raise TypeError( + "Every item in the signed_certificate_timestamps list must be " + "a SignedCertificateTimestamp" + ) + self._signed_certificate_timestamps = signed_certificate_timestamps + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_signed_certificate_timestamps" + ) + + def __repr__(self) -> str: + return "".format( + list(self) + ) + + def __hash__(self) -> int: + return hash(tuple(self._signed_certificate_timestamps)) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, PrecertificateSignedCertificateTimestamps): + return NotImplemented + + return ( + self._signed_certificate_timestamps + == other._signed_certificate_timestamps + ) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class SignedCertificateTimestamps(ExtensionType): + oid = ExtensionOID.SIGNED_CERTIFICATE_TIMESTAMPS + + def __init__( + self, + signed_certificate_timestamps: typing.Iterable[ + SignedCertificateTimestamp + ], + ) -> None: + signed_certificate_timestamps = list(signed_certificate_timestamps) + if not all( + isinstance(sct, SignedCertificateTimestamp) + for sct in signed_certificate_timestamps + ): + raise TypeError( + "Every item in the signed_certificate_timestamps list must be " + "a SignedCertificateTimestamp" + ) + self._signed_certificate_timestamps = signed_certificate_timestamps + + __len__, __iter__, __getitem__ = _make_sequence_methods( + "_signed_certificate_timestamps" + ) + + def __repr__(self) -> str: + return f"" + + def __hash__(self) -> int: + return hash(tuple(self._signed_certificate_timestamps)) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, SignedCertificateTimestamps): + return NotImplemented + + return ( + self._signed_certificate_timestamps + == other._signed_certificate_timestamps + ) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class OCSPNonce(ExtensionType): + oid = OCSPExtensionOID.NONCE + + def __init__(self, nonce: bytes) -> None: + if not isinstance(nonce, bytes): + raise TypeError("nonce must be bytes") + + self._nonce = nonce + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OCSPNonce): + return NotImplemented + + return self.nonce == other.nonce + + def __hash__(self) -> int: + return hash(self.nonce) + + def __repr__(self) -> str: + return f"" + + @property + def nonce(self) -> bytes: + return self._nonce + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class OCSPAcceptableResponses(ExtensionType): + oid = OCSPExtensionOID.ACCEPTABLE_RESPONSES + + def __init__(self, responses: typing.Iterable[ObjectIdentifier]) -> None: + responses = list(responses) + if any(not isinstance(r, ObjectIdentifier) for r in responses): + raise TypeError("All responses must be ObjectIdentifiers") + + self._responses = responses + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OCSPAcceptableResponses): + return NotImplemented + + return self._responses == other._responses + + def __hash__(self) -> int: + return hash(tuple(self._responses)) + + def __repr__(self) -> str: + return f"" + + def __iter__(self) -> typing.Iterator[ObjectIdentifier]: + return iter(self._responses) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class IssuingDistributionPoint(ExtensionType): + oid = ExtensionOID.ISSUING_DISTRIBUTION_POINT + + def __init__( + self, + full_name: typing.Optional[typing.Iterable[GeneralName]], + relative_name: typing.Optional[RelativeDistinguishedName], + only_contains_user_certs: bool, + only_contains_ca_certs: bool, + only_some_reasons: typing.Optional[typing.FrozenSet[ReasonFlags]], + indirect_crl: bool, + only_contains_attribute_certs: bool, + ) -> None: + if full_name is not None: + full_name = list(full_name) + + if only_some_reasons and ( + not isinstance(only_some_reasons, frozenset) + or not all(isinstance(x, ReasonFlags) for x in only_some_reasons) + ): + raise TypeError( + "only_some_reasons must be None or frozenset of ReasonFlags" + ) + + if only_some_reasons and ( + ReasonFlags.unspecified in only_some_reasons + or ReasonFlags.remove_from_crl in only_some_reasons + ): + raise ValueError( + "unspecified and remove_from_crl are not valid reasons in an " + "IssuingDistributionPoint" + ) + + if not ( + isinstance(only_contains_user_certs, bool) + and isinstance(only_contains_ca_certs, bool) + and isinstance(indirect_crl, bool) + and isinstance(only_contains_attribute_certs, bool) + ): + raise TypeError( + "only_contains_user_certs, only_contains_ca_certs, " + "indirect_crl and only_contains_attribute_certs " + "must all be boolean." + ) + + crl_constraints = [ + only_contains_user_certs, + only_contains_ca_certs, + indirect_crl, + only_contains_attribute_certs, + ] + + if len([x for x in crl_constraints if x]) > 1: + raise ValueError( + "Only one of the following can be set to True: " + "only_contains_user_certs, only_contains_ca_certs, " + "indirect_crl, only_contains_attribute_certs" + ) + + if not any( + [ + only_contains_user_certs, + only_contains_ca_certs, + indirect_crl, + only_contains_attribute_certs, + full_name, + relative_name, + only_some_reasons, + ] + ): + raise ValueError( + "Cannot create empty extension: " + "if only_contains_user_certs, only_contains_ca_certs, " + "indirect_crl, and only_contains_attribute_certs are all False" + ", then either full_name, relative_name, or only_some_reasons " + "must have a value." + ) + + self._only_contains_user_certs = only_contains_user_certs + self._only_contains_ca_certs = only_contains_ca_certs + self._indirect_crl = indirect_crl + self._only_contains_attribute_certs = only_contains_attribute_certs + self._only_some_reasons = only_some_reasons + self._full_name = full_name + self._relative_name = relative_name + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, IssuingDistributionPoint): + return NotImplemented + + return ( + self.full_name == other.full_name + and self.relative_name == other.relative_name + and self.only_contains_user_certs == other.only_contains_user_certs + and self.only_contains_ca_certs == other.only_contains_ca_certs + and self.only_some_reasons == other.only_some_reasons + and self.indirect_crl == other.indirect_crl + and self.only_contains_attribute_certs + == other.only_contains_attribute_certs + ) + + def __hash__(self) -> int: + return hash( + ( + self.full_name, + self.relative_name, + self.only_contains_user_certs, + self.only_contains_ca_certs, + self.only_some_reasons, + self.indirect_crl, + self.only_contains_attribute_certs, + ) + ) + + @property + def full_name(self) -> typing.Optional[typing.List[GeneralName]]: + return self._full_name + + @property + def relative_name(self) -> typing.Optional[RelativeDistinguishedName]: + return self._relative_name + + @property + def only_contains_user_certs(self) -> bool: + return self._only_contains_user_certs + + @property + def only_contains_ca_certs(self) -> bool: + return self._only_contains_ca_certs + + @property + def only_some_reasons( + self, + ) -> typing.Optional[typing.FrozenSet[ReasonFlags]]: + return self._only_some_reasons + + @property + def indirect_crl(self) -> bool: + return self._indirect_crl + + @property + def only_contains_attribute_certs(self) -> bool: + return self._only_contains_attribute_certs + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class MSCertificateTemplate(ExtensionType): + oid = ExtensionOID.MS_CERTIFICATE_TEMPLATE + + def __init__( + self, + template_id: ObjectIdentifier, + major_version: typing.Optional[int], + minor_version: typing.Optional[int], + ) -> None: + if not isinstance(template_id, ObjectIdentifier): + raise TypeError("oid must be an ObjectIdentifier") + self._template_id = template_id + if ( + major_version is not None and not isinstance(major_version, int) + ) or ( + minor_version is not None and not isinstance(minor_version, int) + ): + raise TypeError( + "major_version and minor_version must be integers or None" + ) + self._major_version = major_version + self._minor_version = minor_version + + @property + def template_id(self) -> ObjectIdentifier: + return self._template_id + + @property + def major_version(self) -> typing.Optional[int]: + return self._major_version + + @property + def minor_version(self) -> typing.Optional[int]: + return self._minor_version + + def __repr__(self) -> str: + return ( + f"" + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, MSCertificateTemplate): + return NotImplemented + + return ( + self.template_id == other.template_id + and self.major_version == other.major_version + and self.minor_version == other.minor_version + ) + + def __hash__(self) -> int: + return hash((self.template_id, self.major_version, self.minor_version)) + + def public_bytes(self) -> bytes: + return rust_x509.encode_extension_value(self) + + +class UnrecognizedExtension(ExtensionType): + def __init__(self, oid: ObjectIdentifier, value: bytes) -> None: + if not isinstance(oid, ObjectIdentifier): + raise TypeError("oid must be an ObjectIdentifier") + self._oid = oid + self._value = value + + @property + def oid(self) -> ObjectIdentifier: # type: ignore[override] + return self._oid + + @property + def value(self) -> bytes: + return self._value + + def __repr__(self) -> str: + return ( + "".format(self) + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, UnrecognizedExtension): + return NotImplemented + + return self.oid == other.oid and self.value == other.value + + def __hash__(self) -> int: + return hash((self.oid, self.value)) + + def public_bytes(self) -> bytes: + return self.value diff --git a/jwt/python/cryptography/x509/general_name.py b/jwt/python/cryptography/x509/general_name.py new file mode 100644 index 0000000..79271af --- /dev/null +++ b/jwt/python/cryptography/x509/general_name.py @@ -0,0 +1,283 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import ipaddress +import typing +from email.utils import parseaddr + +from cryptography.x509.name import Name +from cryptography.x509.oid import ObjectIdentifier + +_IPAddressTypes = typing.Union[ + ipaddress.IPv4Address, + ipaddress.IPv6Address, + ipaddress.IPv4Network, + ipaddress.IPv6Network, +] + + +class UnsupportedGeneralNameType(Exception): + pass + + +class GeneralName(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def value(self) -> typing.Any: + """ + Return the value of the object + """ + + +class RFC822Name(GeneralName): + def __init__(self, value: str) -> None: + if isinstance(value, str): + try: + value.encode("ascii") + except UnicodeEncodeError: + raise ValueError( + "RFC822Name values should be passed as an A-label string. " + "This means unicode characters should be encoded via " + "a library like idna." + ) + else: + raise TypeError("value must be string") + + name, address = parseaddr(value) + if name or not address: + # parseaddr has found a name (e.g. Name ) or the entire + # value is an empty string. + raise ValueError("Invalid rfc822name value") + + self._value = value + + @property + def value(self) -> str: + return self._value + + @classmethod + def _init_without_validation(cls, value: str) -> RFC822Name: + instance = cls.__new__(cls) + instance._value = value + return instance + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RFC822Name): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class DNSName(GeneralName): + def __init__(self, value: str) -> None: + if isinstance(value, str): + try: + value.encode("ascii") + except UnicodeEncodeError: + raise ValueError( + "DNSName values should be passed as an A-label string. " + "This means unicode characters should be encoded via " + "a library like idna." + ) + else: + raise TypeError("value must be string") + + self._value = value + + @property + def value(self) -> str: + return self._value + + @classmethod + def _init_without_validation(cls, value: str) -> DNSName: + instance = cls.__new__(cls) + instance._value = value + return instance + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DNSName): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class UniformResourceIdentifier(GeneralName): + def __init__(self, value: str) -> None: + if isinstance(value, str): + try: + value.encode("ascii") + except UnicodeEncodeError: + raise ValueError( + "URI values should be passed as an A-label string. " + "This means unicode characters should be encoded via " + "a library like idna." + ) + else: + raise TypeError("value must be string") + + self._value = value + + @property + def value(self) -> str: + return self._value + + @classmethod + def _init_without_validation(cls, value: str) -> UniformResourceIdentifier: + instance = cls.__new__(cls) + instance._value = value + return instance + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, UniformResourceIdentifier): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class DirectoryName(GeneralName): + def __init__(self, value: Name) -> None: + if not isinstance(value, Name): + raise TypeError("value must be a Name") + + self._value = value + + @property + def value(self) -> Name: + return self._value + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, DirectoryName): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class RegisteredID(GeneralName): + def __init__(self, value: ObjectIdentifier) -> None: + if not isinstance(value, ObjectIdentifier): + raise TypeError("value must be an ObjectIdentifier") + + self._value = value + + @property + def value(self) -> ObjectIdentifier: + return self._value + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RegisteredID): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class IPAddress(GeneralName): + def __init__(self, value: _IPAddressTypes) -> None: + if not isinstance( + value, + ( + ipaddress.IPv4Address, + ipaddress.IPv6Address, + ipaddress.IPv4Network, + ipaddress.IPv6Network, + ), + ): + raise TypeError( + "value must be an instance of ipaddress.IPv4Address, " + "ipaddress.IPv6Address, ipaddress.IPv4Network, or " + "ipaddress.IPv6Network" + ) + + self._value = value + + @property + def value(self) -> _IPAddressTypes: + return self._value + + def _packed(self) -> bytes: + if isinstance( + self.value, (ipaddress.IPv4Address, ipaddress.IPv6Address) + ): + return self.value.packed + else: + return ( + self.value.network_address.packed + self.value.netmask.packed + ) + + def __repr__(self) -> str: + return f"" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, IPAddress): + return NotImplemented + + return self.value == other.value + + def __hash__(self) -> int: + return hash(self.value) + + +class OtherName(GeneralName): + def __init__(self, type_id: ObjectIdentifier, value: bytes) -> None: + if not isinstance(type_id, ObjectIdentifier): + raise TypeError("type_id must be an ObjectIdentifier") + if not isinstance(value, bytes): + raise TypeError("value must be a binary string") + + self._type_id = type_id + self._value = value + + @property + def type_id(self) -> ObjectIdentifier: + return self._type_id + + @property + def value(self) -> bytes: + return self._value + + def __repr__(self) -> str: + return "".format( + self.type_id, self.value + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OtherName): + return NotImplemented + + return self.type_id == other.type_id and self.value == other.value + + def __hash__(self) -> int: + return hash((self.type_id, self.value)) diff --git a/jwt/python/cryptography/x509/name.py b/jwt/python/cryptography/x509/name.py new file mode 100644 index 0000000..ff98e87 --- /dev/null +++ b/jwt/python/cryptography/x509/name.py @@ -0,0 +1,462 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import binascii +import re +import sys +import typing +import warnings + +from cryptography import utils +from cryptography.hazmat.bindings._rust import x509 as rust_x509 +from cryptography.x509.oid import NameOID, ObjectIdentifier + + +class _ASN1Type(utils.Enum): + BitString = 3 + OctetString = 4 + UTF8String = 12 + NumericString = 18 + PrintableString = 19 + T61String = 20 + IA5String = 22 + UTCTime = 23 + GeneralizedTime = 24 + VisibleString = 26 + UniversalString = 28 + BMPString = 30 + + +_ASN1_TYPE_TO_ENUM = {i.value: i for i in _ASN1Type} +_NAMEOID_DEFAULT_TYPE: typing.Dict[ObjectIdentifier, _ASN1Type] = { + NameOID.COUNTRY_NAME: _ASN1Type.PrintableString, + NameOID.JURISDICTION_COUNTRY_NAME: _ASN1Type.PrintableString, + NameOID.SERIAL_NUMBER: _ASN1Type.PrintableString, + NameOID.DN_QUALIFIER: _ASN1Type.PrintableString, + NameOID.EMAIL_ADDRESS: _ASN1Type.IA5String, + NameOID.DOMAIN_COMPONENT: _ASN1Type.IA5String, +} + +# Type alias +_OidNameMap = typing.Mapping[ObjectIdentifier, str] +_NameOidMap = typing.Mapping[str, ObjectIdentifier] + +#: Short attribute names from RFC 4514: +#: https://tools.ietf.org/html/rfc4514#page-7 +_NAMEOID_TO_NAME: _OidNameMap = { + NameOID.COMMON_NAME: "CN", + NameOID.LOCALITY_NAME: "L", + NameOID.STATE_OR_PROVINCE_NAME: "ST", + NameOID.ORGANIZATION_NAME: "O", + NameOID.ORGANIZATIONAL_UNIT_NAME: "OU", + NameOID.COUNTRY_NAME: "C", + NameOID.STREET_ADDRESS: "STREET", + NameOID.DOMAIN_COMPONENT: "DC", + NameOID.USER_ID: "UID", +} +_NAME_TO_NAMEOID = {v: k for k, v in _NAMEOID_TO_NAME.items()} + + +def _escape_dn_value(val: typing.Union[str, bytes]) -> str: + """Escape special characters in RFC4514 Distinguished Name value.""" + + if not val: + return "" + + # RFC 4514 Section 2.4 defines the value as being the # (U+0023) character + # followed by the hexadecimal encoding of the octets. + if isinstance(val, bytes): + return "#" + binascii.hexlify(val).decode("utf8") + + # See https://tools.ietf.org/html/rfc4514#section-2.4 + val = val.replace("\\", "\\\\") + val = val.replace('"', '\\"') + val = val.replace("+", "\\+") + val = val.replace(",", "\\,") + val = val.replace(";", "\\;") + val = val.replace("<", "\\<") + val = val.replace(">", "\\>") + val = val.replace("\0", "\\00") + + if val[0] in ("#", " "): + val = "\\" + val + if val[-1] == " ": + val = val[:-1] + "\\ " + + return val + + +def _unescape_dn_value(val: str) -> str: + if not val: + return "" + + # See https://tools.ietf.org/html/rfc4514#section-3 + + # special = escaped / SPACE / SHARP / EQUALS + # escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE + def sub(m): + val = m.group(1) + # Regular escape + if len(val) == 1: + return val + # Hex-value scape + return chr(int(val, 16)) + + return _RFC4514NameParser._PAIR_RE.sub(sub, val) + + +class NameAttribute: + def __init__( + self, + oid: ObjectIdentifier, + value: typing.Union[str, bytes], + _type: typing.Optional[_ASN1Type] = None, + *, + _validate: bool = True, + ) -> None: + if not isinstance(oid, ObjectIdentifier): + raise TypeError( + "oid argument must be an ObjectIdentifier instance." + ) + if _type == _ASN1Type.BitString: + if oid != NameOID.X500_UNIQUE_IDENTIFIER: + raise TypeError( + "oid must be X500_UNIQUE_IDENTIFIER for BitString type." + ) + if not isinstance(value, bytes): + raise TypeError("value must be bytes for BitString") + else: + if not isinstance(value, str): + raise TypeError("value argument must be a str") + + if ( + oid == NameOID.COUNTRY_NAME + or oid == NameOID.JURISDICTION_COUNTRY_NAME + ): + assert isinstance(value, str) + c_len = len(value.encode("utf8")) + if c_len != 2 and _validate is True: + raise ValueError( + "Country name must be a 2 character country code" + ) + elif c_len != 2: + warnings.warn( + "Country names should be two characters, but the " + "attribute is {} characters in length.".format(c_len), + stacklevel=2, + ) + + # The appropriate ASN1 string type varies by OID and is defined across + # multiple RFCs including 2459, 3280, and 5280. In general UTF8String + # is preferred (2459), but 3280 and 5280 specify several OIDs with + # alternate types. This means when we see the sentinel value we need + # to look up whether the OID has a non-UTF8 type. If it does, set it + # to that. Otherwise, UTF8! + if _type is None: + _type = _NAMEOID_DEFAULT_TYPE.get(oid, _ASN1Type.UTF8String) + + if not isinstance(_type, _ASN1Type): + raise TypeError("_type must be from the _ASN1Type enum") + + self._oid = oid + self._value = value + self._type = _type + + @property + def oid(self) -> ObjectIdentifier: + return self._oid + + @property + def value(self) -> typing.Union[str, bytes]: + return self._value + + @property + def rfc4514_attribute_name(self) -> str: + """ + The short attribute name (for example "CN") if available, + otherwise the OID dotted string. + """ + return _NAMEOID_TO_NAME.get(self.oid, self.oid.dotted_string) + + def rfc4514_string( + self, attr_name_overrides: typing.Optional[_OidNameMap] = None + ) -> str: + """ + Format as RFC4514 Distinguished Name string. + + Use short attribute name if available, otherwise fall back to OID + dotted string. + """ + attr_name = ( + attr_name_overrides.get(self.oid) if attr_name_overrides else None + ) + if attr_name is None: + attr_name = self.rfc4514_attribute_name + + return f"{attr_name}={_escape_dn_value(self.value)}" + + def __eq__(self, other: object) -> bool: + if not isinstance(other, NameAttribute): + return NotImplemented + + return self.oid == other.oid and self.value == other.value + + def __hash__(self) -> int: + return hash((self.oid, self.value)) + + def __repr__(self) -> str: + return "".format(self) + + +class RelativeDistinguishedName: + def __init__(self, attributes: typing.Iterable[NameAttribute]): + attributes = list(attributes) + if not attributes: + raise ValueError("a relative distinguished name cannot be empty") + if not all(isinstance(x, NameAttribute) for x in attributes): + raise TypeError("attributes must be an iterable of NameAttribute") + + # Keep list and frozenset to preserve attribute order where it matters + self._attributes = attributes + self._attribute_set = frozenset(attributes) + + if len(self._attribute_set) != len(attributes): + raise ValueError("duplicate attributes are not allowed") + + def get_attributes_for_oid( + self, oid: ObjectIdentifier + ) -> typing.List[NameAttribute]: + return [i for i in self if i.oid == oid] + + def rfc4514_string( + self, attr_name_overrides: typing.Optional[_OidNameMap] = None + ) -> str: + """ + Format as RFC4514 Distinguished Name string. + + Within each RDN, attributes are joined by '+', although that is rarely + used in certificates. + """ + return "+".join( + attr.rfc4514_string(attr_name_overrides) + for attr in self._attributes + ) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, RelativeDistinguishedName): + return NotImplemented + + return self._attribute_set == other._attribute_set + + def __hash__(self) -> int: + return hash(self._attribute_set) + + def __iter__(self) -> typing.Iterator[NameAttribute]: + return iter(self._attributes) + + def __len__(self) -> int: + return len(self._attributes) + + def __repr__(self) -> str: + return f"" + + +class Name: + @typing.overload + def __init__(self, attributes: typing.Iterable[NameAttribute]) -> None: + ... + + @typing.overload + def __init__( + self, attributes: typing.Iterable[RelativeDistinguishedName] + ) -> None: + ... + + def __init__( + self, + attributes: typing.Iterable[ + typing.Union[NameAttribute, RelativeDistinguishedName] + ], + ) -> None: + attributes = list(attributes) + if all(isinstance(x, NameAttribute) for x in attributes): + self._attributes = [ + RelativeDistinguishedName([typing.cast(NameAttribute, x)]) + for x in attributes + ] + elif all(isinstance(x, RelativeDistinguishedName) for x in attributes): + self._attributes = typing.cast( + typing.List[RelativeDistinguishedName], attributes + ) + else: + raise TypeError( + "attributes must be a list of NameAttribute" + " or a list RelativeDistinguishedName" + ) + + @classmethod + def from_rfc4514_string( + cls, + data: str, + attr_name_overrides: typing.Optional[_NameOidMap] = None, + ) -> Name: + return _RFC4514NameParser(data, attr_name_overrides or {}).parse() + + def rfc4514_string( + self, attr_name_overrides: typing.Optional[_OidNameMap] = None + ) -> str: + """ + Format as RFC4514 Distinguished Name string. + For example 'CN=foobar.com,O=Foo Corp,C=US' + + An X.509 name is a two-level structure: a list of sets of attributes. + Each list element is separated by ',' and within each list element, set + elements are separated by '+'. The latter is almost never used in + real world certificates. According to RFC4514 section 2.1 the + RDNSequence must be reversed when converting to string representation. + """ + return ",".join( + attr.rfc4514_string(attr_name_overrides) + for attr in reversed(self._attributes) + ) + + def get_attributes_for_oid( + self, oid: ObjectIdentifier + ) -> typing.List[NameAttribute]: + return [i for i in self if i.oid == oid] + + @property + def rdns(self) -> typing.List[RelativeDistinguishedName]: + return self._attributes + + def public_bytes(self, backend: typing.Any = None) -> bytes: + return rust_x509.encode_name_bytes(self) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Name): + return NotImplemented + + return self._attributes == other._attributes + + def __hash__(self) -> int: + # TODO: this is relatively expensive, if this looks like a bottleneck + # for you, consider optimizing! + return hash(tuple(self._attributes)) + + def __iter__(self) -> typing.Iterator[NameAttribute]: + for rdn in self._attributes: + for ava in rdn: + yield ava + + def __len__(self) -> int: + return sum(len(rdn) for rdn in self._attributes) + + def __repr__(self) -> str: + rdns = ",".join(attr.rfc4514_string() for attr in self._attributes) + return f"" + + +class _RFC4514NameParser: + _OID_RE = re.compile(r"(0|([1-9]\d*))(\.(0|([1-9]\d*)))+") + _DESCR_RE = re.compile(r"[a-zA-Z][a-zA-Z\d-]*") + + _PAIR = r"\\([\\ #=\"\+,;<>]|[\da-zA-Z]{2})" + _PAIR_RE = re.compile(_PAIR) + _LUTF1 = r"[\x01-\x1f\x21\x24-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]" + _SUTF1 = r"[\x01-\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]" + _TUTF1 = r"[\x01-\x1F\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]" + _UTFMB = rf"[\x80-{chr(sys.maxunicode)}]" + _LEADCHAR = rf"{_LUTF1}|{_UTFMB}" + _STRINGCHAR = rf"{_SUTF1}|{_UTFMB}" + _TRAILCHAR = rf"{_TUTF1}|{_UTFMB}" + _STRING_RE = re.compile( + rf""" + ( + ({_LEADCHAR}|{_PAIR}) + ( + ({_STRINGCHAR}|{_PAIR})* + ({_TRAILCHAR}|{_PAIR}) + )? + )? + """, + re.VERBOSE, + ) + _HEXSTRING_RE = re.compile(r"#([\da-zA-Z]{2})+") + + def __init__(self, data: str, attr_name_overrides: _NameOidMap) -> None: + self._data = data + self._idx = 0 + + self._attr_name_overrides = attr_name_overrides + + def _has_data(self) -> bool: + return self._idx < len(self._data) + + def _peek(self) -> typing.Optional[str]: + if self._has_data(): + return self._data[self._idx] + return None + + def _read_char(self, ch: str) -> None: + if self._peek() != ch: + raise ValueError + self._idx += 1 + + def _read_re(self, pat) -> str: + match = pat.match(self._data, pos=self._idx) + if match is None: + raise ValueError + val = match.group() + self._idx += len(val) + return val + + def parse(self) -> Name: + """ + Parses the `data` string and converts it to a Name. + + According to RFC4514 section 2.1 the RDNSequence must be + reversed when converting to string representation. So, when + we parse it, we need to reverse again to get the RDNs on the + correct order. + """ + rdns = [self._parse_rdn()] + + while self._has_data(): + self._read_char(",") + rdns.append(self._parse_rdn()) + + return Name(reversed(rdns)) + + def _parse_rdn(self) -> RelativeDistinguishedName: + nas = [self._parse_na()] + while self._peek() == "+": + self._read_char("+") + nas.append(self._parse_na()) + + return RelativeDistinguishedName(nas) + + def _parse_na(self) -> NameAttribute: + try: + oid_value = self._read_re(self._OID_RE) + except ValueError: + name = self._read_re(self._DESCR_RE) + oid = self._attr_name_overrides.get( + name, _NAME_TO_NAMEOID.get(name) + ) + if oid is None: + raise ValueError + else: + oid = ObjectIdentifier(oid_value) + + self._read_char("=") + if self._peek() == "#": + value = self._read_re(self._HEXSTRING_RE) + value = binascii.unhexlify(value[1:]).decode() + else: + raw_value = self._read_re(self._STRING_RE) + value = _unescape_dn_value(raw_value) + + return NameAttribute(oid, value) diff --git a/jwt/python/cryptography/x509/ocsp.py b/jwt/python/cryptography/x509/ocsp.py new file mode 100644 index 0000000..7054795 --- /dev/null +++ b/jwt/python/cryptography/x509/ocsp.py @@ -0,0 +1,622 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +import abc +import datetime +import typing + +from cryptography import utils, x509 +from cryptography.hazmat.bindings._rust import ocsp +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric.types import ( + CertificateIssuerPrivateKeyTypes, +) +from cryptography.x509.base import ( + _EARLIEST_UTC_TIME, + _convert_to_naive_utc_time, + _reject_duplicate_extension, +) + + +class OCSPResponderEncoding(utils.Enum): + HASH = "By Hash" + NAME = "By Name" + + +class OCSPResponseStatus(utils.Enum): + SUCCESSFUL = 0 + MALFORMED_REQUEST = 1 + INTERNAL_ERROR = 2 + TRY_LATER = 3 + SIG_REQUIRED = 5 + UNAUTHORIZED = 6 + + +_ALLOWED_HASHES = ( + hashes.SHA1, + hashes.SHA224, + hashes.SHA256, + hashes.SHA384, + hashes.SHA512, +) + + +def _verify_algorithm(algorithm: hashes.HashAlgorithm) -> None: + if not isinstance(algorithm, _ALLOWED_HASHES): + raise ValueError( + "Algorithm must be SHA1, SHA224, SHA256, SHA384, or SHA512" + ) + + +class OCSPCertStatus(utils.Enum): + GOOD = 0 + REVOKED = 1 + UNKNOWN = 2 + + +class _SingleResponse: + def __init__( + self, + cert: x509.Certificate, + issuer: x509.Certificate, + algorithm: hashes.HashAlgorithm, + cert_status: OCSPCertStatus, + this_update: datetime.datetime, + next_update: typing.Optional[datetime.datetime], + revocation_time: typing.Optional[datetime.datetime], + revocation_reason: typing.Optional[x509.ReasonFlags], + ): + if not isinstance(cert, x509.Certificate) or not isinstance( + issuer, x509.Certificate + ): + raise TypeError("cert and issuer must be a Certificate") + + _verify_algorithm(algorithm) + if not isinstance(this_update, datetime.datetime): + raise TypeError("this_update must be a datetime object") + if next_update is not None and not isinstance( + next_update, datetime.datetime + ): + raise TypeError("next_update must be a datetime object or None") + + self._cert = cert + self._issuer = issuer + self._algorithm = algorithm + self._this_update = this_update + self._next_update = next_update + + if not isinstance(cert_status, OCSPCertStatus): + raise TypeError( + "cert_status must be an item from the OCSPCertStatus enum" + ) + if cert_status is not OCSPCertStatus.REVOKED: + if revocation_time is not None: + raise ValueError( + "revocation_time can only be provided if the certificate " + "is revoked" + ) + if revocation_reason is not None: + raise ValueError( + "revocation_reason can only be provided if the certificate" + " is revoked" + ) + else: + if not isinstance(revocation_time, datetime.datetime): + raise TypeError("revocation_time must be a datetime object") + + revocation_time = _convert_to_naive_utc_time(revocation_time) + if revocation_time < _EARLIEST_UTC_TIME: + raise ValueError( + "The revocation_time must be on or after" + " 1950 January 1." + ) + + if revocation_reason is not None and not isinstance( + revocation_reason, x509.ReasonFlags + ): + raise TypeError( + "revocation_reason must be an item from the ReasonFlags " + "enum or None" + ) + + self._cert_status = cert_status + self._revocation_time = revocation_time + self._revocation_reason = revocation_reason + + +class OCSPRequest(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def issuer_key_hash(self) -> bytes: + """ + The hash of the issuer public key + """ + + @property + @abc.abstractmethod + def issuer_name_hash(self) -> bytes: + """ + The hash of the issuer name + """ + + @property + @abc.abstractmethod + def hash_algorithm(self) -> hashes.HashAlgorithm: + """ + The hash algorithm used in the issuer name and key hashes + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + The serial number of the cert whose status is being checked + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the request to DER + """ + + @property + @abc.abstractmethod + def extensions(self) -> x509.Extensions: + """ + The list of request extensions. Not single request extensions. + """ + + +class OCSPSingleResponse(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def certificate_status(self) -> OCSPCertStatus: + """ + The status of the certificate (an element from the OCSPCertStatus enum) + """ + + @property + @abc.abstractmethod + def revocation_time(self) -> typing.Optional[datetime.datetime]: + """ + The date of when the certificate was revoked or None if not + revoked. + """ + + @property + @abc.abstractmethod + def revocation_reason(self) -> typing.Optional[x509.ReasonFlags]: + """ + The reason the certificate was revoked or None if not specified or + not revoked. + """ + + @property + @abc.abstractmethod + def this_update(self) -> datetime.datetime: + """ + The most recent time at which the status being indicated is known by + the responder to have been correct + """ + + @property + @abc.abstractmethod + def next_update(self) -> typing.Optional[datetime.datetime]: + """ + The time when newer information will be available + """ + + @property + @abc.abstractmethod + def issuer_key_hash(self) -> bytes: + """ + The hash of the issuer public key + """ + + @property + @abc.abstractmethod + def issuer_name_hash(self) -> bytes: + """ + The hash of the issuer name + """ + + @property + @abc.abstractmethod + def hash_algorithm(self) -> hashes.HashAlgorithm: + """ + The hash algorithm used in the issuer name and key hashes + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + The serial number of the cert whose status is being checked + """ + + +class OCSPResponse(metaclass=abc.ABCMeta): + @property + @abc.abstractmethod + def responses(self) -> typing.Iterator[OCSPSingleResponse]: + """ + An iterator over the individual SINGLERESP structures in the + response + """ + + @property + @abc.abstractmethod + def response_status(self) -> OCSPResponseStatus: + """ + The status of the response. This is a value from the OCSPResponseStatus + enumeration + """ + + @property + @abc.abstractmethod + def signature_algorithm_oid(self) -> x509.ObjectIdentifier: + """ + The ObjectIdentifier of the signature algorithm + """ + + @property + @abc.abstractmethod + def signature_hash_algorithm( + self, + ) -> typing.Optional[hashes.HashAlgorithm]: + """ + Returns a HashAlgorithm corresponding to the type of the digest signed + """ + + @property + @abc.abstractmethod + def signature(self) -> bytes: + """ + The signature bytes + """ + + @property + @abc.abstractmethod + def tbs_response_bytes(self) -> bytes: + """ + The tbsResponseData bytes + """ + + @property + @abc.abstractmethod + def certificates(self) -> typing.List[x509.Certificate]: + """ + A list of certificates used to help build a chain to verify the OCSP + response. This situation occurs when the OCSP responder uses a delegate + certificate. + """ + + @property + @abc.abstractmethod + def responder_key_hash(self) -> typing.Optional[bytes]: + """ + The responder's key hash or None + """ + + @property + @abc.abstractmethod + def responder_name(self) -> typing.Optional[x509.Name]: + """ + The responder's Name or None + """ + + @property + @abc.abstractmethod + def produced_at(self) -> datetime.datetime: + """ + The time the response was produced + """ + + @property + @abc.abstractmethod + def certificate_status(self) -> OCSPCertStatus: + """ + The status of the certificate (an element from the OCSPCertStatus enum) + """ + + @property + @abc.abstractmethod + def revocation_time(self) -> typing.Optional[datetime.datetime]: + """ + The date of when the certificate was revoked or None if not + revoked. + """ + + @property + @abc.abstractmethod + def revocation_reason(self) -> typing.Optional[x509.ReasonFlags]: + """ + The reason the certificate was revoked or None if not specified or + not revoked. + """ + + @property + @abc.abstractmethod + def this_update(self) -> datetime.datetime: + """ + The most recent time at which the status being indicated is known by + the responder to have been correct + """ + + @property + @abc.abstractmethod + def next_update(self) -> typing.Optional[datetime.datetime]: + """ + The time when newer information will be available + """ + + @property + @abc.abstractmethod + def issuer_key_hash(self) -> bytes: + """ + The hash of the issuer public key + """ + + @property + @abc.abstractmethod + def issuer_name_hash(self) -> bytes: + """ + The hash of the issuer name + """ + + @property + @abc.abstractmethod + def hash_algorithm(self) -> hashes.HashAlgorithm: + """ + The hash algorithm used in the issuer name and key hashes + """ + + @property + @abc.abstractmethod + def serial_number(self) -> int: + """ + The serial number of the cert whose status is being checked + """ + + @property + @abc.abstractmethod + def extensions(self) -> x509.Extensions: + """ + The list of response extensions. Not single response extensions. + """ + + @property + @abc.abstractmethod + def single_extensions(self) -> x509.Extensions: + """ + The list of single response extensions. Not response extensions. + """ + + @abc.abstractmethod + def public_bytes(self, encoding: serialization.Encoding) -> bytes: + """ + Serializes the response to DER + """ + + +class OCSPRequestBuilder: + def __init__( + self, + request: typing.Optional[ + typing.Tuple[ + x509.Certificate, x509.Certificate, hashes.HashAlgorithm + ] + ] = None, + request_hash: typing.Optional[ + typing.Tuple[bytes, bytes, int, hashes.HashAlgorithm] + ] = None, + extensions: typing.List[x509.Extension[x509.ExtensionType]] = [], + ) -> None: + self._request = request + self._request_hash = request_hash + self._extensions = extensions + + def add_certificate( + self, + cert: x509.Certificate, + issuer: x509.Certificate, + algorithm: hashes.HashAlgorithm, + ) -> OCSPRequestBuilder: + if self._request is not None or self._request_hash is not None: + raise ValueError("Only one certificate can be added to a request") + + _verify_algorithm(algorithm) + if not isinstance(cert, x509.Certificate) or not isinstance( + issuer, x509.Certificate + ): + raise TypeError("cert and issuer must be a Certificate") + + return OCSPRequestBuilder( + (cert, issuer, algorithm), self._request_hash, self._extensions + ) + + def add_certificate_by_hash( + self, + issuer_name_hash: bytes, + issuer_key_hash: bytes, + serial_number: int, + algorithm: hashes.HashAlgorithm, + ) -> OCSPRequestBuilder: + if self._request is not None or self._request_hash is not None: + raise ValueError("Only one certificate can be added to a request") + + if not isinstance(serial_number, int): + raise TypeError("serial_number must be an integer") + + _verify_algorithm(algorithm) + utils._check_bytes("issuer_name_hash", issuer_name_hash) + utils._check_bytes("issuer_key_hash", issuer_key_hash) + if algorithm.digest_size != len( + issuer_name_hash + ) or algorithm.digest_size != len(issuer_key_hash): + raise ValueError( + "issuer_name_hash and issuer_key_hash must be the same length " + "as the digest size of the algorithm" + ) + + return OCSPRequestBuilder( + self._request, + (issuer_name_hash, issuer_key_hash, serial_number, algorithm), + self._extensions, + ) + + def add_extension( + self, extval: x509.ExtensionType, critical: bool + ) -> OCSPRequestBuilder: + if not isinstance(extval, x509.ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = x509.Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return OCSPRequestBuilder( + self._request, self._request_hash, self._extensions + [extension] + ) + + def build(self) -> OCSPRequest: + if self._request is None and self._request_hash is None: + raise ValueError("You must add a certificate before building") + + return ocsp.create_ocsp_request(self) + + +class OCSPResponseBuilder: + def __init__( + self, + response: typing.Optional[_SingleResponse] = None, + responder_id: typing.Optional[ + typing.Tuple[x509.Certificate, OCSPResponderEncoding] + ] = None, + certs: typing.Optional[typing.List[x509.Certificate]] = None, + extensions: typing.List[x509.Extension[x509.ExtensionType]] = [], + ): + self._response = response + self._responder_id = responder_id + self._certs = certs + self._extensions = extensions + + def add_response( + self, + cert: x509.Certificate, + issuer: x509.Certificate, + algorithm: hashes.HashAlgorithm, + cert_status: OCSPCertStatus, + this_update: datetime.datetime, + next_update: typing.Optional[datetime.datetime], + revocation_time: typing.Optional[datetime.datetime], + revocation_reason: typing.Optional[x509.ReasonFlags], + ) -> OCSPResponseBuilder: + if self._response is not None: + raise ValueError("Only one response per OCSPResponse.") + + singleresp = _SingleResponse( + cert, + issuer, + algorithm, + cert_status, + this_update, + next_update, + revocation_time, + revocation_reason, + ) + return OCSPResponseBuilder( + singleresp, + self._responder_id, + self._certs, + self._extensions, + ) + + def responder_id( + self, encoding: OCSPResponderEncoding, responder_cert: x509.Certificate + ) -> OCSPResponseBuilder: + if self._responder_id is not None: + raise ValueError("responder_id can only be set once") + if not isinstance(responder_cert, x509.Certificate): + raise TypeError("responder_cert must be a Certificate") + if not isinstance(encoding, OCSPResponderEncoding): + raise TypeError( + "encoding must be an element from OCSPResponderEncoding" + ) + + return OCSPResponseBuilder( + self._response, + (responder_cert, encoding), + self._certs, + self._extensions, + ) + + def certificates( + self, certs: typing.Iterable[x509.Certificate] + ) -> OCSPResponseBuilder: + if self._certs is not None: + raise ValueError("certificates may only be set once") + certs = list(certs) + if len(certs) == 0: + raise ValueError("certs must not be an empty list") + if not all(isinstance(x, x509.Certificate) for x in certs): + raise TypeError("certs must be a list of Certificates") + return OCSPResponseBuilder( + self._response, + self._responder_id, + certs, + self._extensions, + ) + + def add_extension( + self, extval: x509.ExtensionType, critical: bool + ) -> OCSPResponseBuilder: + if not isinstance(extval, x509.ExtensionType): + raise TypeError("extension must be an ExtensionType") + + extension = x509.Extension(extval.oid, critical, extval) + _reject_duplicate_extension(extension, self._extensions) + + return OCSPResponseBuilder( + self._response, + self._responder_id, + self._certs, + self._extensions + [extension], + ) + + def sign( + self, + private_key: CertificateIssuerPrivateKeyTypes, + algorithm: typing.Optional[hashes.HashAlgorithm], + ) -> OCSPResponse: + if self._response is None: + raise ValueError("You must add a response before signing") + if self._responder_id is None: + raise ValueError("You must add a responder_id before signing") + + return ocsp.create_ocsp_response( + OCSPResponseStatus.SUCCESSFUL, self, private_key, algorithm + ) + + @classmethod + def build_unsuccessful( + cls, response_status: OCSPResponseStatus + ) -> OCSPResponse: + if not isinstance(response_status, OCSPResponseStatus): + raise TypeError( + "response_status must be an item from OCSPResponseStatus" + ) + if response_status is OCSPResponseStatus.SUCCESSFUL: + raise ValueError("response_status cannot be SUCCESSFUL") + + return ocsp.create_ocsp_response(response_status, None, None, None) + + +def load_der_ocsp_request(data: bytes) -> OCSPRequest: + return ocsp.load_der_ocsp_request(data) + + +def load_der_ocsp_response(data: bytes) -> OCSPResponse: + return ocsp.load_der_ocsp_response(data) diff --git a/jwt/python/cryptography/x509/oid.py b/jwt/python/cryptography/x509/oid.py new file mode 100644 index 0000000..cda50cc --- /dev/null +++ b/jwt/python/cryptography/x509/oid.py @@ -0,0 +1,33 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import annotations + +from cryptography.hazmat._oid import ( + AttributeOID, + AuthorityInformationAccessOID, + CertificatePoliciesOID, + CRLEntryExtensionOID, + ExtendedKeyUsageOID, + ExtensionOID, + NameOID, + ObjectIdentifier, + OCSPExtensionOID, + SignatureAlgorithmOID, + SubjectInformationAccessOID, +) + +__all__ = [ + "AttributeOID", + "AuthorityInformationAccessOID", + "CRLEntryExtensionOID", + "CertificatePoliciesOID", + "ExtendedKeyUsageOID", + "ExtensionOID", + "NameOID", + "OCSPExtensionOID", + "ObjectIdentifier", + "SignatureAlgorithmOID", + "SubjectInformationAccessOID", +] diff --git a/jwt/python/jwt-1.3.1.dist-info/INSTALLER b/jwt/python/jwt-1.3.1.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/jwt/python/jwt-1.3.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/jwt/python/jwt-1.3.1.dist-info/LICENSE b/jwt/python/jwt-1.3.1.dist-info/LICENSE new file mode 100644 index 0000000..9cf69c1 --- /dev/null +++ b/jwt/python/jwt-1.3.1.dist-info/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017 Gehirn Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/jwt/python/jwt-1.3.1.dist-info/METADATA b/jwt/python/jwt-1.3.1.dist-info/METADATA new file mode 100644 index 0000000..1d222a8 --- /dev/null +++ b/jwt/python/jwt-1.3.1.dist-info/METADATA @@ -0,0 +1,146 @@ +Metadata-Version: 2.1 +Name: jwt +Version: 1.3.1 +Summary: JSON Web Token library for Python 3. +Home-page: https://github.com/GehirnInc/python-jwt +Author: Kohei YOSHIDA +Author-email: kohei.yoshida@gehirn.co.jp +License: UNKNOWN +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Security +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >= 3.6 +Requires-Dist: cryptography (!=3.4.0,>=3.1) + +.. image:: https://travis-ci.org/GehirnInc/python-jwt.svg?branch=master + :target: https://travis-ci.org/GehirnInc/python-jwt +.. image:: https://coveralls.io/repos/GehirnInc/python-jwt/badge.png?branch=master + :target: https://coveralls.io/r/GehirnInc/python-jwt?branch=master +.. image:: https://badge.fury.io/py/jwt.svg?dummy + :target: http://badge.fury.io/py/jwt + +python-jwt +========== + +*python-jwt* is a JSON Web Token (JWT) implementation in Python developed by `Gehirn Inc`_. + + +Examples +-------- + +.. code-block:: python + + import json + from datetime import datetime, timedelta, timezone + + from jwt import ( + JWT, + jwk_from_dict, + jwk_from_pem, + ) + from jwt.utils import get_int_from_datetime + + + instance = JWT() + + message = { + 'iss': 'https://example.com/', + 'sub': 'yosida95', + 'iat': get_int_from_datetime(datetime.now(timezone.utc)), + 'exp': get_int_from_datetime( + datetime.now(timezone.utc) + timedelta(hours=1)), + } + + """ + Encode the message to JWT(JWS). + """ + + # Load a RSA key from a JWK dict. + signing_key = jwk_from_dict({ + 'kty': 'RSA', + 'e': 'AQAB', + 'n': '...', + 'd': '...'}) + # Or load a RSA key from a PEM file. + with open('rsa_private_key.pem', 'rb') as fh: + signing_key = jwk_from_pem(fh.read()) + # You can also load an octet key in the same manner as the RSA. + # signing_key = jwk_from_dict({'kty': 'oct', 'k': '...'}) + + compact_jws = instance.encode(message, signing_key, alg='RS256') + + """ + Decode the JWT with verifying the signature. + """ + + # Load a public key from PEM file corresponding to the signing private key. + with open('rsa_public_key.json', 'r') as fh: + verifying_key = jwk_from_dict(json.load(fh)) + + message_received = instance.decode( + compact_jws, verifying_key, do_time_check=True) + + """ + Successfuly retrieved the `message` from the `compact_jws` + """ + assert message == message_received + + +Installation +------------ + +You can install python-jwt with pip. + +.. code-block:: shell + + $ pip install jwt + + +Implementation Details +------------------------- + +Supported Algorithms +~~~~~~~~~~~~~~~~~~~~ + +- Unsecured + + - none (disabled by default for security) + +- Symmetric + + - HS256 + - HS384 + - HS512 + +- Asymmetric + + - PS256 + - PS384 + - PS512 + - RS256 + - RS384 + - RS512 + +Supported Python Versions +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Python 3.6+ + + +License +------- +python-jwt is licensed under the Apache License version 2. See ./LICENSE.rst. + + +.. _Gehirn Inc: http://www.gehirn.co.jp/ + + diff --git a/jwt/python/jwt-1.3.1.dist-info/RECORD b/jwt/python/jwt-1.3.1.dist-info/RECORD new file mode 100644 index 0000000..cece7fd --- /dev/null +++ b/jwt/python/jwt-1.3.1.dist-info/RECORD @@ -0,0 +1,24 @@ +jwt-1.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +jwt-1.3.1.dist-info/LICENSE,sha256=k8azE68RcLJ3OnQA3SRI1ebXxCDW2EAO_HhROs6xuzE,11341 +jwt-1.3.1.dist-info/METADATA,sha256=Symw7Jt6qIHlxr29twpnSLA-lh9nZHgdcwIxEanHe-M,3439 +jwt-1.3.1.dist-info/RECORD,, +jwt-1.3.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +jwt-1.3.1.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 +jwt-1.3.1.dist-info/top_level.txt,sha256=RP5DHNyJbMq2ka0FmfTgoSaQzh7e3r5XuCWCO8a00k8,4 +jwt/__init__.py,sha256=_fcS7PLAyhWBShVlSGKYcmUNBTcRFDEymTG6ROXahac,1233 +jwt/__pycache__/__init__.cpython-311.pyc,, +jwt/__pycache__/exceptions.cpython-311.pyc,, +jwt/__pycache__/jwa.cpython-311.pyc,, +jwt/__pycache__/jwk.cpython-311.pyc,, +jwt/__pycache__/jwkset.cpython-311.pyc,, +jwt/__pycache__/jws.cpython-311.pyc,, +jwt/__pycache__/jwt.cpython-311.pyc,, +jwt/__pycache__/utils.cpython-311.pyc,, +jwt/exceptions.py,sha256=IbWr8886syf-DdCHKmS6leAN1zHh6Jx9iBhFE4G47VU,1056 +jwt/jwa.py,sha256=0oN1ymjHOqNl6gMpBlPd07-Am2ZCejSf3Btgn4CINdA,6003 +jwt/jwk.py,sha256=P-HBDICpGDyROp8jZGIr5jzFxBkB9NnLaWg1s1SxH30,13549 +jwt/jwkset.py,sha256=fKnzEkf0j6D0qt0z5qTbfl7JV0a9tHqBWc6LmO7CL38,1895 +jwt/jws.py,sha256=_ZcFxpXXPKWtkTI2YTMPoWo8IfKO_WpFmxOYObxyeY8,3445 +jwt/jwt.py,sha256=MuIyOXudmNruv-lXVfYKUOVD2yKVSI3Q9VJ4HxApT6M,4693 +jwt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +jwt/utils.py,sha256=4bwUBehyYzHJwTokeTXmSs_GRh59zmZf1-cPS9sbHgI,2050 diff --git a/jwt/python/jwt-1.3.1.dist-info/REQUESTED b/jwt/python/jwt-1.3.1.dist-info/REQUESTED new file mode 100644 index 0000000..e69de29 diff --git a/jwt/python/jwt-1.3.1.dist-info/WHEEL b/jwt/python/jwt-1.3.1.dist-info/WHEEL new file mode 100644 index 0000000..5bad85f --- /dev/null +++ b/jwt/python/jwt-1.3.1.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/jwt/python/jwt-1.3.1.dist-info/top_level.txt b/jwt/python/jwt-1.3.1.dist-info/top_level.txt new file mode 100644 index 0000000..27ccc9b --- /dev/null +++ b/jwt/python/jwt-1.3.1.dist-info/top_level.txt @@ -0,0 +1 @@ +jwt diff --git a/jwt/python/jwt/__init__.py b/jwt/python/jwt/__init__.py new file mode 100644 index 0000000..3ce590c --- /dev/null +++ b/jwt/python/jwt/__init__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .jwa import std_hash_by_alg +from .jwk import ( + AbstractJWKBase, + jwk_from_dict, + jwk_from_bytes, + jwk_from_pem, + jwk_from_der, + supported_key_types, +) +from .jwkset import JWKSet +from .jwa import ( + AbstractSigningAlgorithm, + supported_signing_algorithms, +) +from .jwt import JWT + + +__all__ = [ + # .jwa + 'std_hash_by_alg', + # .jwk + 'AbstractJWKBase', + 'jwk_from_bytes', + 'jwk_from_dict', + 'jwk_from_pem', + 'jwk_from_der', + 'supported_key_types', + # .jwkset + 'JWKSet', + # .jws + 'AbstractSigningAlgorithm', + 'supported_signing_algorithms', + # .jwt + 'JWT', +] diff --git a/jwt/python/jwt/__pycache__/__init__.cpython-311.pyc b/jwt/python/jwt/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..3745ab4 Binary files /dev/null and b/jwt/python/jwt/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/jwt/__pycache__/exceptions.cpython-311.pyc b/jwt/python/jwt/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..f10fc6d Binary files /dev/null and b/jwt/python/jwt/__pycache__/exceptions.cpython-311.pyc differ diff --git a/jwt/python/jwt/__pycache__/jwa.cpython-311.pyc b/jwt/python/jwt/__pycache__/jwa.cpython-311.pyc new file mode 100644 index 0000000..647f42f Binary files /dev/null and b/jwt/python/jwt/__pycache__/jwa.cpython-311.pyc differ diff --git a/jwt/python/jwt/__pycache__/jwk.cpython-311.pyc b/jwt/python/jwt/__pycache__/jwk.cpython-311.pyc new file mode 100644 index 0000000..4e4449c Binary files /dev/null and b/jwt/python/jwt/__pycache__/jwk.cpython-311.pyc differ diff --git a/jwt/python/jwt/__pycache__/jwkset.cpython-311.pyc b/jwt/python/jwt/__pycache__/jwkset.cpython-311.pyc new file mode 100644 index 0000000..29b0057 Binary files /dev/null and b/jwt/python/jwt/__pycache__/jwkset.cpython-311.pyc differ diff --git a/jwt/python/jwt/__pycache__/jws.cpython-311.pyc b/jwt/python/jwt/__pycache__/jws.cpython-311.pyc new file mode 100644 index 0000000..b0dca9a Binary files /dev/null and b/jwt/python/jwt/__pycache__/jws.cpython-311.pyc differ diff --git a/jwt/python/jwt/__pycache__/jwt.cpython-311.pyc b/jwt/python/jwt/__pycache__/jwt.cpython-311.pyc new file mode 100644 index 0000000..8ac8ed9 Binary files /dev/null and b/jwt/python/jwt/__pycache__/jwt.cpython-311.pyc differ diff --git a/jwt/python/jwt/__pycache__/utils.cpython-311.pyc b/jwt/python/jwt/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..9b9105d Binary files /dev/null and b/jwt/python/jwt/__pycache__/utils.cpython-311.pyc differ diff --git a/jwt/python/jwt/exceptions.py b/jwt/python/jwt/exceptions.py new file mode 100644 index 0000000..ec4b9e1 --- /dev/null +++ b/jwt/python/jwt/exceptions.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +class JWTException(Exception): + """ + common base class for all exceptions used in python-jwt + """ + + +class MalformedJWKError(JWTException): + pass + + +class UnsupportedKeyTypeError(JWTException): + pass + + +class InvalidKeyTypeError(JWTException): + pass + + +class JWSEncodeError(JWTException): + pass + + +class JWSDecodeError(JWTException): + pass + + +class JWTEncodeError(JWTException): + pass + + +class JWTDecodeError(JWTException): + pass diff --git a/jwt/python/jwt/jwa.py b/jwt/python/jwt/jwa.py new file mode 100644 index 0000000..f5986cd --- /dev/null +++ b/jwt/python/jwt/jwa.py @@ -0,0 +1,198 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import hashlib +import hmac +from typing import ( + Any, + Dict, + Callable, + Optional, +) + +from cryptography.hazmat.primitives.asymmetric import padding +from cryptography.hazmat.primitives.hashes import ( + SHA256, + SHA384, + SHA512, +) + +from .exceptions import InvalidKeyTypeError +from .jwk import AbstractJWKBase + + +def std_hash_by_alg(alg: str) -> Callable[[bytes], object]: + if alg.endswith('S256'): + return hashlib.sha256 + if alg.endswith('S384'): + return hashlib.sha384 + if alg.endswith('S512'): + return hashlib.sha512 + raise ValueError('{} is not supported'.format(alg)) + + +class AbstractSigningAlgorithm: + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + raise NotImplementedError() # pragma: no cover + + def verify(self, message: bytes, key: Optional[AbstractJWKBase], + signature: bytes) -> bool: + raise NotImplementedError() # pragma: no cover + + +class NoneAlgorithm(AbstractSigningAlgorithm): + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + return b'' + + def verify(self, message: bytes, key: Optional[AbstractJWKBase], + signature: bytes) -> bool: + return hmac.compare_digest(signature, b'') + + +none = NoneAlgorithm() + + +class HMACAlgorithm(AbstractSigningAlgorithm): + + def __init__(self, hash_fun: Callable[[], object]) -> None: + self.hash_fun = hash_fun + + def _check_key(self, key: Optional[AbstractJWKBase]) -> AbstractJWKBase: + if not key or key.get_kty() != 'oct': + raise InvalidKeyTypeError('Octet key is required') + return key + + def _sign(self, message: bytes, key: bytes) -> bytes: + return hmac.new(key, message, self.hash_fun).digest() + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + key = self._check_key(key) + return key.sign(message, signer=self._sign) + + def verify(self, message: bytes, key: Optional[AbstractJWKBase], + signature: bytes) -> bool: + key = self._check_key(key) + return key.verify(message, signature, signer=self._sign) + + +HS256 = HMACAlgorithm(hashlib.sha256) +HS384 = HMACAlgorithm(hashlib.sha384) +HS512 = HMACAlgorithm(hashlib.sha512) + + +class RSAAlgorithm(AbstractSigningAlgorithm): + + def __init__(self, hash_fun: object) -> None: + self.hash_fun = hash_fun + + def _check_key( + self, + key: Optional[AbstractJWKBase], + must_sign_key: bool = False, + ) -> AbstractJWKBase: + if not key or key.get_kty() != 'RSA': + raise InvalidKeyTypeError('RSA key is required') + if must_sign_key and not key.is_sign_key(): + raise InvalidKeyTypeError( + 'a RSA private key is required, but passed is RSA public key') + return key + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + key = self._check_key(key, must_sign_key=True) + return key.sign(message, hash_fun=self.hash_fun, + padding=padding.PKCS1v15()) + + def verify( + self, + message: bytes, + key: Optional[AbstractJWKBase], + signature: bytes, + ) -> bool: + key = self._check_key(key) + return key.verify(message, signature, hash_fun=self.hash_fun, + padding=padding.PKCS1v15()) + + +RS256 = RSAAlgorithm(SHA256) +RS384 = RSAAlgorithm(SHA384) +RS512 = RSAAlgorithm(SHA512) + + +class PSSRSAAlgorithm(AbstractSigningAlgorithm): + def __init__(self, hash_fun: Callable[[], Any]) -> None: + self.hash_fun = hash_fun + + def _check_key( + self, + key: Optional[AbstractJWKBase], + must_sign_key: bool = False, + ) -> AbstractJWKBase: + if not key or key.get_kty() != 'RSA': + raise InvalidKeyTypeError('RSA key is required') + if must_sign_key and not key.is_sign_key(): + raise InvalidKeyTypeError( + 'a RSA private key is required, but passed is RSA public key') + return key + + def sign(self, message: bytes, key: Optional[AbstractJWKBase]) -> bytes: + key = self._check_key(key, must_sign_key=True) + return key.sign( + message, + hash_fun=self.hash_fun, + padding=padding.PSS( # type: ignore[no-untyped-call] + mgf=padding.MGF1(self.hash_fun()), + salt_length=self.hash_fun().digest_size, + ), + ) + + def verify( + self, + message: bytes, + key: Optional[AbstractJWKBase], + signature: bytes + ) -> bool: + key = self._check_key(key) + return key.verify( + message, + signature, + hash_fun=self.hash_fun, + padding=padding.PSS( # type: ignore[no-untyped-call] + mgf=padding.MGF1(self.hash_fun()), + salt_length=self.hash_fun().digest_size, + ), + ) + + +PS256 = PSSRSAAlgorithm(SHA256) +PS384 = PSSRSAAlgorithm(SHA384) +PS512 = PSSRSAAlgorithm(SHA512) + + +def supported_signing_algorithms() -> Dict[str, AbstractSigningAlgorithm]: + # NOTE(yosida95): exclude vulnerable 'none' algorithm by default. + return { + 'HS256': HS256, + 'HS384': HS384, + 'HS512': HS512, + 'RS256': RS256, + 'RS384': RS384, + 'RS512': RS512, + 'PS256': PS256, + 'PS384': PS384, + 'PS512': PS512, + } diff --git a/jwt/python/jwt/jwk.py b/jwt/python/jwt/jwk.py new file mode 100644 index 0000000..e1a4936 --- /dev/null +++ b/jwt/python/jwt/jwk.py @@ -0,0 +1,427 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import hmac +from warnings import warn +from abc import ( + ABC, + abstractmethod, +) +from typing import ( + Any, + Callable, + Dict, + Mapping, + Type, + TypeVar, + Union, + Optional +) +from functools import wraps + +import cryptography.hazmat.primitives.serialization as serialization_module +from cryptography.exceptions import InvalidSignature +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives.asymmetric import padding +from cryptography.hazmat.primitives.asymmetric.rsa import ( + rsa_crt_dmp1, + rsa_crt_dmq1, + rsa_crt_iqmp, + rsa_recover_prime_factors, + RSAPrivateKey, + RSAPrivateNumbers, + RSAPublicKey, + RSAPublicNumbers, +) +from cryptography.hazmat.primitives.hashes import HashAlgorithm + +from .exceptions import ( + MalformedJWKError, + UnsupportedKeyTypeError, +) +from .utils import ( + b64encode, + b64decode, + uint_b64encode, + uint_b64decode, +) + +_AJWK = TypeVar("_AJWK", bound="AbstractJWKBase") +_T = TypeVar("_T") + + +class AbstractJWKBase(ABC): + + @abstractmethod + def get_kty(self) -> str: + pass # pragma: no cover + + @abstractmethod + def get_kid(self) -> str: + pass # pragma: no cover + + @abstractmethod + def is_sign_key(self) -> bool: + pass # pragma: no cover + + @abstractmethod + def sign(self, message: bytes, **options) -> bytes: + pass # pragma: no cover + + @abstractmethod + def verify(self, message: bytes, signature: bytes, **options) -> bool: + pass # pragma: no cover + + @abstractmethod + def to_dict(self, public_only: bool = True) -> Dict[str, str]: + pass # pragma: no cover + + @classmethod + @abstractmethod + def from_dict(cls: Type[_AJWK], dct: Dict[str, object]) -> _AJWK: + pass # pragma: no cover + + +class OctetJWK(AbstractJWKBase): + + def __init__(self, key: bytes, kid=None, **options) -> None: + super(AbstractJWKBase, self).__init__() + self.key = key + self.kid = kid + + optnames = {'use', 'key_ops', 'alg', 'x5u', 'x5c', 'x5t', 'x5t#s256'} + self.options = {k: v for k, v in options.items() if k in optnames} + + def get_kty(self): + return 'oct' + + def get_kid(self): + return self.kid + + def is_sign_key(self) -> bool: + return True + + def _get_signer(self, options) -> Callable[[bytes, bytes], bytes]: + return options['signer'] + + def sign(self, message: bytes, **options) -> bytes: + signer = self._get_signer(options) + return signer(message, self.key) + + def verify(self, message: bytes, signature: bytes, **options) -> bool: + signer = self._get_signer(options) + return hmac.compare_digest(signature, signer(message, self.key)) + + def to_dict(self, public_only=True): + dct = { + 'kty': 'oct', + 'k': b64encode(self.key), + } + dct.update(self.options) + if self.kid: + dct['kid'] = self.kid + return dct + + @classmethod + def from_dict(cls, dct): + try: + return cls(b64decode(dct['k']), **dct) + except KeyError as why: + raise MalformedJWKError('k is required') from why + + +class RSAJWK(AbstractJWKBase): + """ + https://tools.ietf.org/html/rfc7518.html#section-6.3.1 + """ + + def __init__(self, keyobj: Union[RSAPrivateKey, RSAPublicKey], + **options) -> None: + super(AbstractJWKBase, self).__init__() + self.keyobj = keyobj + + optnames = {'use', 'key_ops', 'alg', 'kid', + 'x5u', 'x5c', 'x5t', 'x5t#s256', } + self.options = {k: v for k, v in options.items() if k in optnames} + + def is_sign_key(self) -> bool: + return isinstance(self.keyobj, RSAPrivateKey) + + def _get_hash_fun(self, options) -> Callable[[], HashAlgorithm]: + return options['hash_fun'] + + def _get_padding(self, options) -> padding.AsymmetricPadding: + try: + return options['padding'] + except KeyError: + warn('you should not use RSAJWK.verify/sign without jwa ' + 'intermiediary, used legacy padding') + return padding.PKCS1v15() + + def sign(self, message: bytes, **options) -> bytes: + if isinstance(self.keyobj, RSAPublicKey): + raise ValueError("Requires a private key.") + hash_fun = self._get_hash_fun(options) + _padding = self._get_padding(options) + return self.keyobj.sign(message, _padding, hash_fun()) + + def verify(self, message: bytes, signature: bytes, **options) -> bool: + hash_fun = self._get_hash_fun(options) + _padding = self._get_padding(options) + if isinstance(self.keyobj, RSAPrivateKey): + pubkey = self.keyobj.public_key() + else: + pubkey = self.keyobj + try: + pubkey.verify(signature, message, _padding, hash_fun()) + return True + except InvalidSignature: + return False + + def get_kty(self): + return 'RSA' + + def get_kid(self): + return self.options.get('kid') + + def to_dict(self, public_only=True): + dct = { + 'kty': 'RSA', + } + dct.update(self.options) + + if isinstance(self.keyobj, RSAPrivateKey): + priv_numbers = self.keyobj.private_numbers() + pub_numbers = priv_numbers.public_numbers + dct.update({ + 'e': uint_b64encode(pub_numbers.e), + 'n': uint_b64encode(pub_numbers.n), + }) + if not public_only: + dct.update({ + 'e': uint_b64encode(pub_numbers.e), + 'n': uint_b64encode(pub_numbers.n), + 'd': uint_b64encode(priv_numbers.d), + 'p': uint_b64encode(priv_numbers.p), + 'q': uint_b64encode(priv_numbers.q), + 'dp': uint_b64encode(priv_numbers.dmp1), + 'dq': uint_b64encode(priv_numbers.dmq1), + 'qi': uint_b64encode(priv_numbers.iqmp), + }) + return dct + pub_numbers = self.keyobj.public_numbers() + dct.update({ + 'e': uint_b64encode(pub_numbers.e), + 'n': uint_b64encode(pub_numbers.n), + }) + return dct + + @classmethod + def from_dict(cls, dct): + if 'oth' in dct: + raise UnsupportedKeyTypeError( + 'RSA keys with multiples primes are not supported') + + try: + e = uint_b64decode(dct['e']) + n = uint_b64decode(dct['n']) + except KeyError as why: + raise MalformedJWKError('e and n are required') from why + pub_numbers = RSAPublicNumbers(e, n) + if 'd' not in dct: + return cls( + pub_numbers.public_key(backend=default_backend()), **dct) + d = uint_b64decode(dct['d']) + + privparams = {'p', 'q', 'dp', 'dq', 'qi'} + product = set(dct.keys()) & privparams + if len(product) == 0: + p, q = rsa_recover_prime_factors(n, e, d) + priv_numbers = RSAPrivateNumbers( + d=d, + p=p, + q=q, + dmp1=rsa_crt_dmp1(d, p), + dmq1=rsa_crt_dmq1(d, q), + iqmp=rsa_crt_iqmp(p, q), + public_numbers=pub_numbers) + elif product == privparams: + priv_numbers = RSAPrivateNumbers( + d=d, + p=uint_b64decode(dct['p']), + q=uint_b64decode(dct['q']), + dmp1=uint_b64decode(dct['dp']), + dmq1=uint_b64decode(dct['dq']), + iqmp=uint_b64decode(dct['qi']), + public_numbers=pub_numbers) + else: + # If the producer includes any of the other private key parameters, + # then all of the others MUST be present, with the exception of + # "oth", which MUST only be present when more than two prime + # factors were used. + raise MalformedJWKError( + 'p, q, dp, dq, qi MUST be present or' + 'all of them MUST be absent') + return cls(priv_numbers.private_key(backend=default_backend()), **dct) + + +def supported_key_types() -> Dict[str, Type[AbstractJWKBase]]: + return { + 'oct': OctetJWK, + 'RSA': RSAJWK, + } + + +def jwk_from_dict(dct: Mapping[str, Any]) -> AbstractJWKBase: + if not isinstance(dct, dict): # pragma: no cover + raise TypeError('dct must be a dict') + if 'kty' not in dct: + raise MalformedJWKError('kty MUST be present') + + supported = supported_key_types() + kty = dct['kty'] + if kty not in supported: + raise UnsupportedKeyTypeError('unsupported key type: {}'.format(kty)) + return supported[kty].from_dict(dct) + + +PublicKeyLoaderT = Union[str, Callable[[bytes, object], object]] +PrivateKeyLoaderT = Union[ + str, + Callable[[bytes, Optional[str], object], object]] +_Loader = TypeVar("_Loader", PublicKeyLoaderT, PrivateKeyLoaderT) +_C = TypeVar("_C", bound=Callable[..., Any]) + + +# The above LoaderTs should actually not be Union, and this function should be +# typed something like this. But, this will lose any kwargs from the typing +# information. Probably needs: https://github.com/python/mypy/issues/3157 +# (func: Callable[[bytes, _Loader], _T]) +# -> Callable[[bytes, Union[str, _Loader]], _T] +def jwk_from_bytes_argument_conversion(func: _C) -> _C: + if not ('private' in func.__name__ or 'public' in func.__name__): + raise Exception("the wrapped function must have either public" + " or private in it's name") + + @wraps(func) + def wrapper(content, loader, **kwargs): + # now convert it to a Callable if it's a string + if isinstance(loader, str): + loader = getattr(serialization_module, loader) + + if kwargs.get('options') is None: + kwargs['options'] = {} + + return func(content, loader, **kwargs) + return wrapper # type: ignore[return-value] + + +@jwk_from_bytes_argument_conversion +def jwk_from_private_bytes( + content: bytes, + private_loader: PrivateKeyLoaderT, + *, + password: Optional[str] = None, + backend: Optional[object] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + """This function is meant to be called from jwk_from_bytes""" + if options is None: + options = {} + try: + privkey = private_loader(content, password, backend) # type: ignore[operator] # noqa: E501 + if isinstance(privkey, RSAPrivateKey): + return RSAJWK(privkey, **options) + raise UnsupportedKeyTypeError('unsupported key type') + except ValueError as ex: + raise UnsupportedKeyTypeError('this is probably a public key') from ex + + +@jwk_from_bytes_argument_conversion +def jwk_from_public_bytes( + content: bytes, + public_loader: PublicKeyLoaderT, + *, + backend: Optional[object] = None, + options: Optional[Mapping[str, object]] = None +) -> AbstractJWKBase: + """This function is meant to be called from jwk_from_bytes""" + if options is None: + options = {} + try: + pubkey = public_loader(content, backend) # type: ignore[operator] + if isinstance(pubkey, RSAPublicKey): + return RSAJWK(pubkey, **options) + raise UnsupportedKeyTypeError( + 'unsupported key type') # pragma: no cover + except ValueError as why: + raise UnsupportedKeyTypeError('could not deserialize') from why + + +def jwk_from_bytes( + content: bytes, + private_loader: PrivateKeyLoaderT, + public_loader: PublicKeyLoaderT, + *, + private_password: Optional[str] = None, + backend: Optional[object] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + try: + return jwk_from_private_bytes( + content, + private_loader, + password=private_password, + backend=backend, + options=options, + ) + except UnsupportedKeyTypeError: + return jwk_from_public_bytes( + content, + public_loader, + backend=backend, + options=options, + ) + + +def jwk_from_pem( + pem_content: bytes, + private_password: Optional[str] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + return jwk_from_bytes( + pem_content, + private_loader='load_pem_private_key', + public_loader='load_pem_public_key', + private_password=private_password, + backend=None, + options=options, + ) + + +def jwk_from_der( + der_content: bytes, + private_password: Optional[str] = None, + options: Optional[Mapping[str, object]] = None, +) -> AbstractJWKBase: + return jwk_from_bytes( + der_content, + private_loader='load_der_private_key', + public_loader='load_der_public_key', + private_password=private_password, + backend=None, + options=options, + ) diff --git a/jwt/python/jwt/jwkset.py b/jwt/python/jwt/jwkset.py new file mode 100644 index 0000000..4c7056f --- /dev/null +++ b/jwt/python/jwt/jwkset.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from collections import UserList +from typing import TYPE_CHECKING + +from .jwk import AbstractJWKBase, jwk_from_dict + +if TYPE_CHECKING: + UserListBase = UserList[AbstractJWKBase] +else: + UserListBase = UserList + + +class JWKSet(UserListBase): + + def filter_keys(self, kid=None, kty=None): + # When "kid" values are used within a JWK Set, different + # keys within the JWK Set SHOULD use distinct "kid" values. (One + # example in which different keys might use the same "kid" value is if + # they have different "kty" (key type) values but are considered to be + # equivalent alternatives by the application using them.) + + if kid and kty: + return [key for key in self.data + if key.get_kty() == kty and key.get_kid() == kid] + if kid: + return [key for key in self.data if key.get_kid() == kid] + if kty: + return [key for key in self.data if key.get_kty() == kty] + + return self.data.copy() + + def to_dict(self, public_only=True): + keys = [key.to_dict(public_only=public_only) for key in self.data] + return {'keys': keys} + + @classmethod + def from_dict(cls, dct): + keys = [jwk_from_dict(key_dct) for key_dct in dct.get('keys', [])] + return cls(keys) diff --git a/jwt/python/jwt/jws.py b/jwt/python/jwt/jws.py new file mode 100644 index 0000000..18367b6 --- /dev/null +++ b/jwt/python/jwt/jws.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from typing import ( + AbstractSet, + Dict, + Optional, + Tuple, +) + +from .exceptions import ( + JWSEncodeError, + JWSDecodeError, +) +from .jwa import ( + supported_signing_algorithms, + AbstractSigningAlgorithm, +) +from .jwk import AbstractJWKBase +from .utils import ( + b64encode, + b64decode, +) + +__all__ = ['JWS'] + + +class JWS: + + def __init__(self) -> None: + self._supported_algs = supported_signing_algorithms() + + def _retrieve_alg(self, alg: str) -> AbstractSigningAlgorithm: + try: + return self._supported_algs[alg] + except KeyError: + raise JWSDecodeError('Unsupported signing algorithm.') + + def encode(self, message: bytes, key: Optional[AbstractJWKBase] = None, + alg='HS256', + optional_headers: Optional[Dict[str, str]] = None) -> str: + if alg not in self._supported_algs: # pragma: no cover + raise JWSEncodeError('unsupported algorithm: {}'.format(alg)) + alg_impl = self._retrieve_alg(alg) + + header = optional_headers.copy() if optional_headers else {} + header['alg'] = alg + + header_b64 = b64encode( + json.dumps(header, separators=(',', ':')).encode('ascii')) + message_b64 = b64encode(message) + signing_message = header_b64 + '.' + message_b64 + + signature = alg_impl.sign(signing_message.encode('ascii'), key) + signature_b64 = b64encode(signature) + + return signing_message + '.' + signature_b64 + + def _decode_segments( + self, message: str) -> Tuple[Dict[str, str], bytes, bytes, str]: + try: + signing_message, signature_b64 = message.rsplit('.', 1) + header_b64, message_b64 = signing_message.split('.') + except ValueError: + raise JWSDecodeError('malformed JWS payload') + + header = json.loads(b64decode(header_b64).decode('ascii')) + message_bin = b64decode(message_b64) + signature = b64decode(signature_b64) + return header, message_bin, signature, signing_message + + def decode(self, message: str, key: Optional[AbstractJWKBase] = None, + do_verify=True, + algorithms: Optional[AbstractSet[str]] = None) -> bytes: + if algorithms is None: + algorithms = set(supported_signing_algorithms().keys()) + + header, message_bin, signature, signing_message = \ + self._decode_segments(message) + + alg_value = header['alg'] + if alg_value not in algorithms: + raise JWSDecodeError('Unsupported signing algorithm.') + + alg_impl = self._retrieve_alg(alg_value) + if do_verify and not alg_impl.verify( + signing_message.encode('ascii'), key, signature): + raise JWSDecodeError('JWS passed could not be validated') + + return message_bin diff --git a/jwt/python/jwt/jwt.py b/jwt/python/jwt/jwt.py new file mode 100644 index 0000000..1c15b1a --- /dev/null +++ b/jwt/python/jwt/jwt.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from datetime import datetime, timezone +from typing import AbstractSet, Any, Dict, Optional + +from jwt.utils import ( + get_time_from_int, +) +from .exceptions import ( + JWSEncodeError, + JWSDecodeError, + JWTEncodeError, + JWTDecodeError, +) +from .jwk import AbstractJWKBase +from .jws import JWS + + +class JWT: + + def __init__(self): + self._jws = JWS() + + def encode(self, payload: Dict[str, Any], + key: Optional[AbstractJWKBase] = None, alg='HS256', + optional_headers: Optional[Dict[str, str]] = None) -> str: + if not isinstance(self, JWT): # pragma: no cover + # https://github.com/GehirnInc/python-jwt/issues/15 + raise RuntimeError( + 'encode must be called on a jwt.JWT() instance. ' + 'Do jwt.JWT().encode(...)') + if not isinstance(payload, dict): # pragma: no cover + raise TypeError('payload must be a dict') + if not (key is None + or isinstance(key, AbstractJWKBase)): # pragma: no cover + raise TypeError( + 'key must be an instance of a class implements ' + 'jwt.AbstractJWKBase') + if not (optional_headers is None + or isinstance(optional_headers, dict)): # pragma: no cover + raise TypeError('optional_headers must be a dict') + + try: + message = json.dumps(payload).encode('utf-8') + except ValueError as why: + raise JWTEncodeError( + 'payload must be able to be encoded to JSON') from why + + optional_headers = optional_headers and optional_headers.copy() or {} + optional_headers['typ'] = 'JWT' + try: + return self._jws.encode(message, key, alg, optional_headers) + except JWSEncodeError as why: + raise JWTEncodeError('failed to encode to JWT') from why + + def decode(self, message: str, key: Optional[AbstractJWKBase] = None, + do_verify=True, algorithms: Optional[AbstractSet[str]] = None, + do_time_check: bool = True) -> Dict[str, Any]: + if not isinstance(self, JWT): # pragma: no cover + # https://github.com/GehirnInc/python-jwt/issues/15 + raise RuntimeError( + 'decode must be called on a jwt.JWT() instance. ' + 'Do jwt.JWT().decode(...)') + if not isinstance(message, str): # pragma: no cover + raise TypeError('message must be a str') + if not (key is None + or isinstance(key, AbstractJWKBase)): # pragma: no cover + raise TypeError( + 'key must be an instance of a class implements ' + 'jwt.AbstractJWKBase') + + # utc now with timezone + now = datetime.now(timezone.utc) + try: + message_bin = self._jws.decode(message, key, do_verify, algorithms) + except JWSDecodeError as why: + raise JWTDecodeError('failed to decode JWT') from why + try: + payload = json.loads(message_bin.decode('utf-8')) + except ValueError as why: + raise JWTDecodeError( + 'a payload of the JWT is not valid JSON') from why + + # The "exp" (expiration time) claim identifies the expiration time on + # or after which the JWT MUST NOT be accepted for processing. + if 'exp' in payload and do_time_check: + try: + exp = get_time_from_int(payload['exp']) + except TypeError: + raise JWTDecodeError("Invalid Expired value") + if now >= exp: + raise JWTDecodeError("JWT Expired") + + # The "nbf" (not before) claim identifies the time before which the JWT + # MUST NOT be accepted for processing. + if 'nbf' in payload and do_time_check: + try: + nbf = get_time_from_int(payload['nbf']) + except TypeError: + raise JWTDecodeError('Invalid "Not valid yet" value') + if now < nbf: + raise JWTDecodeError("JWT Not valid yet") + + return payload diff --git a/jwt/python/jwt/py.typed b/jwt/python/jwt/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/jwt/python/jwt/utils.py b/jwt/python/jwt/utils.py new file mode 100644 index 0000000..48f139f --- /dev/null +++ b/jwt/python/jwt/utils.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2017 Gehirn Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from base64 import ( + urlsafe_b64encode, + urlsafe_b64decode, +) +from datetime import datetime, timezone + + +def b64encode(s: bytes) -> str: + s_bin = urlsafe_b64encode(s) + s_bin = s_bin.replace(b'=', b'') + return s_bin.decode('ascii') + + +def b64decode(s: str) -> bytes: + s_bin = s.encode('ascii') + s_bin += b'=' * (4 - len(s_bin) % 4) + return urlsafe_b64decode(s_bin) + + +def uint_b64encode(value: int) -> str: + length = 1 + rem = value >> 8 + while rem: + length += 1 + rem >>= 8 + + uint_bin = value.to_bytes(length, 'big', signed=False) + return b64encode(uint_bin) + + +def uint_b64decode(uint_b64: str) -> int: + uint_bin = b64decode(uint_b64) + + value = 0 + for b in uint_bin: + value <<= 8 + value += int(b) + return value + + +def get_time_from_int(value: int) -> datetime: + """ + :param value: seconds since the Epoch + :return: datetime + """ + if not isinstance(value, int): # pragma: no cover + raise TypeError('an int is required') + return datetime.fromtimestamp(value, timezone.utc) + + +def get_int_from_datetime(value: datetime) -> int: + """ + :param value: datetime with or without timezone, if don't contains timezone + it will managed as it is UTC + :return: Seconds since the Epoch + """ + if not isinstance(value, datetime): # pragma: no cover + raise TypeError('a datetime is required') + return int(value.timestamp()) diff --git a/jwt/python/pycparser-2.21.dist-info/INSTALLER b/jwt/python/pycparser-2.21.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/jwt/python/pycparser-2.21.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/jwt/python/pycparser-2.21.dist-info/LICENSE b/jwt/python/pycparser-2.21.dist-info/LICENSE new file mode 100644 index 0000000..ea215f2 --- /dev/null +++ b/jwt/python/pycparser-2.21.dist-info/LICENSE @@ -0,0 +1,27 @@ +pycparser -- A C parser in Python + +Copyright (c) 2008-2020, Eli Bendersky +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of Eli Bendersky nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/jwt/python/pycparser-2.21.dist-info/METADATA b/jwt/python/pycparser-2.21.dist-info/METADATA new file mode 100644 index 0000000..1d0fbd6 --- /dev/null +++ b/jwt/python/pycparser-2.21.dist-info/METADATA @@ -0,0 +1,31 @@ +Metadata-Version: 2.1 +Name: pycparser +Version: 2.21 +Summary: C parser in Python +Home-page: https://github.com/eliben/pycparser +Author: Eli Bendersky +Author-email: eliben@gmail.com +Maintainer: Eli Bendersky +License: BSD +Platform: Cross Platform +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* + + +pycparser is a complete parser of the C language, written in +pure Python using the PLY parsing library. +It parses C code into an AST and can serve as a front-end for +C compilers or analysis tools. + + diff --git a/jwt/python/pycparser-2.21.dist-info/RECORD b/jwt/python/pycparser-2.21.dist-info/RECORD new file mode 100644 index 0000000..2049707 --- /dev/null +++ b/jwt/python/pycparser-2.21.dist-info/RECORD @@ -0,0 +1,41 @@ +pycparser-2.21.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +pycparser-2.21.dist-info/LICENSE,sha256=Pn3yW437ZYyakVAZMNTZQ7BQh6g0fH4rQyVhavU1BHs,1536 +pycparser-2.21.dist-info/METADATA,sha256=GvTEQA9yKj0nvP4mknfoGpMvjaJXCQjQANcQHrRrAxc,1108 +pycparser-2.21.dist-info/RECORD,, +pycparser-2.21.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110 +pycparser-2.21.dist-info/top_level.txt,sha256=c-lPcS74L_8KoH7IE6PQF5ofyirRQNV4VhkbSFIPeWM,10 +pycparser/__init__.py,sha256=WUEp5D0fuHBH9Q8c1fYvR2eKWfj-CNghLf2MMlQLI1I,2815 +pycparser/__pycache__/__init__.cpython-311.pyc,, +pycparser/__pycache__/_ast_gen.cpython-311.pyc,, +pycparser/__pycache__/_build_tables.cpython-311.pyc,, +pycparser/__pycache__/ast_transforms.cpython-311.pyc,, +pycparser/__pycache__/c_ast.cpython-311.pyc,, +pycparser/__pycache__/c_generator.cpython-311.pyc,, +pycparser/__pycache__/c_lexer.cpython-311.pyc,, +pycparser/__pycache__/c_parser.cpython-311.pyc,, +pycparser/__pycache__/lextab.cpython-311.pyc,, +pycparser/__pycache__/plyparser.cpython-311.pyc,, +pycparser/__pycache__/yacctab.cpython-311.pyc,, +pycparser/_ast_gen.py,sha256=0JRVnDW-Jw-3IjVlo8je9rbAcp6Ko7toHAnB5zi7h0Q,10555 +pycparser/_build_tables.py,sha256=oZCd3Plhq-vkV-QuEsaahcf-jUI6-HgKsrAL9gvFzuU,1039 +pycparser/_c_ast.cfg,sha256=ld5ezE9yzIJFIVAUfw7ezJSlMi4nXKNCzfmqjOyQTNo,4255 +pycparser/ast_transforms.py,sha256=GTMYlUgWmXd5wJVyovXY1qzzAqjxzCpVVg0664dKGBs,5691 +pycparser/c_ast.py,sha256=HWeOrfYdCY0u5XaYhE1i60uVyE3yMWdcxzECUX-DqJw,31445 +pycparser/c_generator.py,sha256=yi6Mcqxv88J5ue8k5-mVGxh3iJ37iD4QyF-sWcGjC-8,17772 +pycparser/c_lexer.py,sha256=xCpjIb6vOUebBJpdifidb08y7XgAsO3T1gNGXJT93-w,17167 +pycparser/c_parser.py,sha256=_8y3i52bL6SUK21KmEEl0qzHxe-0eZRzjZGkWg8gQ4A,73680 +pycparser/lextab.py,sha256=fIxBAHYRC418oKF52M7xb8_KMj3K-tHx0TzZiKwxjPM,8504 +pycparser/ply/__init__.py,sha256=q4s86QwRsYRa20L9ueSxfh-hPihpftBjDOvYa2_SS2Y,102 +pycparser/ply/__pycache__/__init__.cpython-311.pyc,, +pycparser/ply/__pycache__/cpp.cpython-311.pyc,, +pycparser/ply/__pycache__/ctokens.cpython-311.pyc,, +pycparser/ply/__pycache__/lex.cpython-311.pyc,, +pycparser/ply/__pycache__/yacc.cpython-311.pyc,, +pycparser/ply/__pycache__/ygen.cpython-311.pyc,, +pycparser/ply/cpp.py,sha256=UtC3ylTWp5_1MKA-PLCuwKQR8zSOnlGuGGIdzj8xS98,33282 +pycparser/ply/ctokens.py,sha256=MKksnN40TehPhgVfxCJhjj_BjL943apreABKYz-bl0Y,3177 +pycparser/ply/lex.py,sha256=7Qol57x702HZwjA3ZLp-84CUEWq1EehW-N67Wzghi-M,42918 +pycparser/ply/yacc.py,sha256=eatSDkRLgRr6X3-hoDk_SQQv065R0BdL2K7fQ54CgVM,137323 +pycparser/ply/ygen.py,sha256=2JYNeYtrPz1JzLSLO3d4GsS8zJU8jY_I_CR1VI9gWrA,2251 +pycparser/plyparser.py,sha256=8tLOoEytcapvWrr1JfCf7Dog-wulBtS1YrDs8S7JfMo,4875 +pycparser/yacctab.py,sha256=j_fVNIyDWDRVk7eWMqQtlBw2AwUSV5JTrtT58l7zis0,205652 diff --git a/jwt/python/pycparser-2.21.dist-info/WHEEL b/jwt/python/pycparser-2.21.dist-info/WHEEL new file mode 100644 index 0000000..ef99c6c --- /dev/null +++ b/jwt/python/pycparser-2.21.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.34.2) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/jwt/python/pycparser-2.21.dist-info/top_level.txt b/jwt/python/pycparser-2.21.dist-info/top_level.txt new file mode 100644 index 0000000..dc1c9e1 --- /dev/null +++ b/jwt/python/pycparser-2.21.dist-info/top_level.txt @@ -0,0 +1 @@ +pycparser diff --git a/jwt/python/pycparser/__init__.py b/jwt/python/pycparser/__init__.py new file mode 100644 index 0000000..d82eb2d --- /dev/null +++ b/jwt/python/pycparser/__init__.py @@ -0,0 +1,90 @@ +#----------------------------------------------------------------- +# pycparser: __init__.py +# +# This package file exports some convenience functions for +# interacting with pycparser +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- +__all__ = ['c_lexer', 'c_parser', 'c_ast'] +__version__ = '2.21' + +import io +from subprocess import check_output +from .c_parser import CParser + + +def preprocess_file(filename, cpp_path='cpp', cpp_args=''): + """ Preprocess a file using cpp. + + filename: + Name of the file you want to preprocess. + + cpp_path: + cpp_args: + Refer to the documentation of parse_file for the meaning of these + arguments. + + When successful, returns the preprocessed file's contents. + Errors from cpp will be printed out. + """ + path_list = [cpp_path] + if isinstance(cpp_args, list): + path_list += cpp_args + elif cpp_args != '': + path_list += [cpp_args] + path_list += [filename] + + try: + # Note the use of universal_newlines to treat all newlines + # as \n for Python's purpose + text = check_output(path_list, universal_newlines=True) + except OSError as e: + raise RuntimeError("Unable to invoke 'cpp'. " + + 'Make sure its path was passed correctly\n' + + ('Original error: %s' % e)) + + return text + + +def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='', + parser=None): + """ Parse a C file using pycparser. + + filename: + Name of the file you want to parse. + + use_cpp: + Set to True if you want to execute the C pre-processor + on the file prior to parsing it. + + cpp_path: + If use_cpp is True, this is the path to 'cpp' on your + system. If no path is provided, it attempts to just + execute 'cpp', so it must be in your PATH. + + cpp_args: + If use_cpp is True, set this to the command line arguments strings + to cpp. Be careful with quotes - it's best to pass a raw string + (r'') here. For example: + r'-I../utils/fake_libc_include' + If several arguments are required, pass a list of strings. + + parser: + Optional parser object to be used instead of the default CParser + + When successful, an AST is returned. ParseError can be + thrown if the file doesn't parse successfully. + + Errors from cpp will be printed out. + """ + if use_cpp: + text = preprocess_file(filename, cpp_path, cpp_args) + else: + with io.open(filename) as f: + text = f.read() + + if parser is None: + parser = CParser() + return parser.parse(text, filename) diff --git a/jwt/python/pycparser/__pycache__/__init__.cpython-311.pyc b/jwt/python/pycparser/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..cf8e2c8 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/_ast_gen.cpython-311.pyc b/jwt/python/pycparser/__pycache__/_ast_gen.cpython-311.pyc new file mode 100644 index 0000000..b8849f7 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/_ast_gen.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/_build_tables.cpython-311.pyc b/jwt/python/pycparser/__pycache__/_build_tables.cpython-311.pyc new file mode 100644 index 0000000..cebb5e6 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/_build_tables.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/ast_transforms.cpython-311.pyc b/jwt/python/pycparser/__pycache__/ast_transforms.cpython-311.pyc new file mode 100644 index 0000000..aed4851 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/ast_transforms.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/c_ast.cpython-311.pyc b/jwt/python/pycparser/__pycache__/c_ast.cpython-311.pyc new file mode 100644 index 0000000..c8878db Binary files /dev/null and b/jwt/python/pycparser/__pycache__/c_ast.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/c_generator.cpython-311.pyc b/jwt/python/pycparser/__pycache__/c_generator.cpython-311.pyc new file mode 100644 index 0000000..9df5995 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/c_generator.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/c_lexer.cpython-311.pyc b/jwt/python/pycparser/__pycache__/c_lexer.cpython-311.pyc new file mode 100644 index 0000000..4b107a9 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/c_lexer.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/c_parser.cpython-311.pyc b/jwt/python/pycparser/__pycache__/c_parser.cpython-311.pyc new file mode 100644 index 0000000..b3ddea3 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/c_parser.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/lextab.cpython-311.pyc b/jwt/python/pycparser/__pycache__/lextab.cpython-311.pyc new file mode 100644 index 0000000..c67e313 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/lextab.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/plyparser.cpython-311.pyc b/jwt/python/pycparser/__pycache__/plyparser.cpython-311.pyc new file mode 100644 index 0000000..d3bba7f Binary files /dev/null and b/jwt/python/pycparser/__pycache__/plyparser.cpython-311.pyc differ diff --git a/jwt/python/pycparser/__pycache__/yacctab.cpython-311.pyc b/jwt/python/pycparser/__pycache__/yacctab.cpython-311.pyc new file mode 100644 index 0000000..42a0f32 Binary files /dev/null and b/jwt/python/pycparser/__pycache__/yacctab.cpython-311.pyc differ diff --git a/jwt/python/pycparser/_ast_gen.py b/jwt/python/pycparser/_ast_gen.py new file mode 100644 index 0000000..0f7d330 --- /dev/null +++ b/jwt/python/pycparser/_ast_gen.py @@ -0,0 +1,336 @@ +#----------------------------------------------------------------- +# _ast_gen.py +# +# Generates the AST Node classes from a specification given in +# a configuration file +# +# The design of this module was inspired by astgen.py from the +# Python 2.5 code-base. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- +from string import Template + + +class ASTCodeGenerator(object): + def __init__(self, cfg_filename='_c_ast.cfg'): + """ Initialize the code generator from a configuration + file. + """ + self.cfg_filename = cfg_filename + self.node_cfg = [NodeCfg(name, contents) + for (name, contents) in self.parse_cfgfile(cfg_filename)] + + def generate(self, file=None): + """ Generates the code into file, an open file buffer. + """ + src = Template(_PROLOGUE_COMMENT).substitute( + cfg_filename=self.cfg_filename) + + src += _PROLOGUE_CODE + for node_cfg in self.node_cfg: + src += node_cfg.generate_source() + '\n\n' + + file.write(src) + + def parse_cfgfile(self, filename): + """ Parse the configuration file and yield pairs of + (name, contents) for each node. + """ + with open(filename, "r") as f: + for line in f: + line = line.strip() + if not line or line.startswith('#'): + continue + colon_i = line.find(':') + lbracket_i = line.find('[') + rbracket_i = line.find(']') + if colon_i < 1 or lbracket_i <= colon_i or rbracket_i <= lbracket_i: + raise RuntimeError("Invalid line in %s:\n%s\n" % (filename, line)) + + name = line[:colon_i] + val = line[lbracket_i + 1:rbracket_i] + vallist = [v.strip() for v in val.split(',')] if val else [] + yield name, vallist + + +class NodeCfg(object): + """ Node configuration. + + name: node name + contents: a list of contents - attributes and child nodes + See comment at the top of the configuration file for details. + """ + + def __init__(self, name, contents): + self.name = name + self.all_entries = [] + self.attr = [] + self.child = [] + self.seq_child = [] + + for entry in contents: + clean_entry = entry.rstrip('*') + self.all_entries.append(clean_entry) + + if entry.endswith('**'): + self.seq_child.append(clean_entry) + elif entry.endswith('*'): + self.child.append(clean_entry) + else: + self.attr.append(entry) + + def generate_source(self): + src = self._gen_init() + src += '\n' + self._gen_children() + src += '\n' + self._gen_iter() + src += '\n' + self._gen_attr_names() + return src + + def _gen_init(self): + src = "class %s(Node):\n" % self.name + + if self.all_entries: + args = ', '.join(self.all_entries) + slots = ', '.join("'{0}'".format(e) for e in self.all_entries) + slots += ", 'coord', '__weakref__'" + arglist = '(self, %s, coord=None)' % args + else: + slots = "'coord', '__weakref__'" + arglist = '(self, coord=None)' + + src += " __slots__ = (%s)\n" % slots + src += " def __init__%s:\n" % arglist + + for name in self.all_entries + ['coord']: + src += " self.%s = %s\n" % (name, name) + + return src + + def _gen_children(self): + src = ' def children(self):\n' + + if self.all_entries: + src += ' nodelist = []\n' + + for child in self.child: + src += ( + ' if self.%(child)s is not None:' + + ' nodelist.append(("%(child)s", self.%(child)s))\n') % ( + dict(child=child)) + + for seq_child in self.seq_child: + src += ( + ' for i, child in enumerate(self.%(child)s or []):\n' + ' nodelist.append(("%(child)s[%%d]" %% i, child))\n') % ( + dict(child=seq_child)) + + src += ' return tuple(nodelist)\n' + else: + src += ' return ()\n' + + return src + + def _gen_iter(self): + src = ' def __iter__(self):\n' + + if self.all_entries: + for child in self.child: + src += ( + ' if self.%(child)s is not None:\n' + + ' yield self.%(child)s\n') % (dict(child=child)) + + for seq_child in self.seq_child: + src += ( + ' for child in (self.%(child)s or []):\n' + ' yield child\n') % (dict(child=seq_child)) + + if not (self.child or self.seq_child): + # Empty generator + src += ( + ' return\n' + + ' yield\n') + else: + # Empty generator + src += ( + ' return\n' + + ' yield\n') + + return src + + def _gen_attr_names(self): + src = " attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')' + return src + + +_PROLOGUE_COMMENT = \ +r'''#----------------------------------------------------------------- +# ** ATTENTION ** +# This code was automatically generated from the file: +# $cfg_filename +# +# Do not modify it directly. Modify the configuration file and +# run the generator again. +# ** ** *** ** ** +# +# pycparser: c_ast.py +# +# AST Node classes. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +''' + +_PROLOGUE_CODE = r''' +import sys + +def _repr(obj): + """ + Get the representation of an object, with dedicated pprint-like format for lists. + """ + if isinstance(obj, list): + return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]' + else: + return repr(obj) + +class Node(object): + __slots__ = () + """ Abstract base class for AST nodes. + """ + def __repr__(self): + """ Generates a python representation of the current node + """ + result = self.__class__.__name__ + '(' + + indent = '' + separator = '' + for name in self.__slots__[:-2]: + result += separator + result += indent + result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__))))) + + separator = ',' + indent = '\n ' + (' ' * len(self.__class__.__name__)) + + result += indent + ')' + + return result + + def children(self): + """ A sequence of all children that are Nodes + """ + pass + + def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): + """ Pretty print the Node and all its attributes and + children (recursively) to a buffer. + + buf: + Open IO buffer into which the Node is printed. + + offset: + Initial offset (amount of leading spaces) + + attrnames: + True if you want to see the attribute names in + name=value pairs. False to only see the values. + + nodenames: + True if you want to see the actual node names + within their parents. + + showcoord: + Do you want the coordinates of each Node to be + displayed. + """ + lead = ' ' * offset + if nodenames and _my_node_name is not None: + buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ') + else: + buf.write(lead + self.__class__.__name__+ ': ') + + if self.attr_names: + if attrnames: + nvlist = [(n, getattr(self,n)) for n in self.attr_names] + attrstr = ', '.join('%s=%s' % nv for nv in nvlist) + else: + vlist = [getattr(self, n) for n in self.attr_names] + attrstr = ', '.join('%s' % v for v in vlist) + buf.write(attrstr) + + if showcoord: + buf.write(' (at %s)' % self.coord) + buf.write('\n') + + for (child_name, child) in self.children(): + child.show( + buf, + offset=offset + 2, + attrnames=attrnames, + nodenames=nodenames, + showcoord=showcoord, + _my_node_name=child_name) + + +class NodeVisitor(object): + """ A base NodeVisitor class for visiting c_ast nodes. + Subclass it and define your own visit_XXX methods, where + XXX is the class name you want to visit with these + methods. + + For example: + + class ConstantVisitor(NodeVisitor): + def __init__(self): + self.values = [] + + def visit_Constant(self, node): + self.values.append(node.value) + + Creates a list of values of all the constant nodes + encountered below the given node. To use it: + + cv = ConstantVisitor() + cv.visit(node) + + Notes: + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was + defined will not be visited - if you need this, call + generic_visit() on the node. + You can use: + NodeVisitor.generic_visit(self, node) + * Modeled after Python's own AST visiting facilities + (the ast module of Python 3.0) + """ + + _method_cache = None + + def visit(self, node): + """ Visit a node. + """ + + if self._method_cache is None: + self._method_cache = {} + + visitor = self._method_cache.get(node.__class__.__name__, None) + if visitor is None: + method = 'visit_' + node.__class__.__name__ + visitor = getattr(self, method, self.generic_visit) + self._method_cache[node.__class__.__name__] = visitor + + return visitor(node) + + def generic_visit(self, node): + """ Called if no explicit visitor function exists for a + node. Implements preorder visiting of the node. + """ + for c in node: + self.visit(c) + +''' diff --git a/jwt/python/pycparser/_build_tables.py b/jwt/python/pycparser/_build_tables.py new file mode 100644 index 0000000..958381a --- /dev/null +++ b/jwt/python/pycparser/_build_tables.py @@ -0,0 +1,37 @@ +#----------------------------------------------------------------- +# pycparser: _build_tables.py +# +# A dummy for generating the lexing/parsing tables and and +# compiling them into .pyc for faster execution in optimized mode. +# Also generates AST code from the configuration file. +# Should be called from the pycparser directory. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +# Insert '.' and '..' as first entries to the search path for modules. +# Restricted environments like embeddable python do not include the +# current working directory on startup. +import sys +sys.path[0:0] = ['.', '..'] + +# Generate c_ast.py +from _ast_gen import ASTCodeGenerator +ast_gen = ASTCodeGenerator('_c_ast.cfg') +ast_gen.generate(open('c_ast.py', 'w')) + +from pycparser import c_parser + +# Generates the tables +# +c_parser.CParser( + lex_optimize=True, + yacc_debug=False, + yacc_optimize=True) + +# Load to compile into .pyc +# +import lextab +import yacctab +import c_ast diff --git a/jwt/python/pycparser/_c_ast.cfg b/jwt/python/pycparser/_c_ast.cfg new file mode 100644 index 0000000..0626533 --- /dev/null +++ b/jwt/python/pycparser/_c_ast.cfg @@ -0,0 +1,195 @@ +#----------------------------------------------------------------- +# pycparser: _c_ast.cfg +# +# Defines the AST Node classes used in pycparser. +# +# Each entry is a Node sub-class name, listing the attributes +# and child nodes of the class: +# * - a child node +# ** - a sequence of child nodes +# - an attribute +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +# ArrayDecl is a nested declaration of an array with the given type. +# dim: the dimension (for example, constant 42) +# dim_quals: list of dimension qualifiers, to support C99's allowing 'const' +# and 'static' within the array dimension in function declarations. +ArrayDecl: [type*, dim*, dim_quals] + +ArrayRef: [name*, subscript*] + +# op: =, +=, /= etc. +# +Assignment: [op, lvalue*, rvalue*] + +Alignas: [alignment*] + +BinaryOp: [op, left*, right*] + +Break: [] + +Case: [expr*, stmts**] + +Cast: [to_type*, expr*] + +# Compound statement in C99 is a list of block items (declarations or +# statements). +# +Compound: [block_items**] + +# Compound literal (anonymous aggregate) for C99. +# (type-name) {initializer_list} +# type: the typename +# init: InitList for the initializer list +# +CompoundLiteral: [type*, init*] + +# type: int, char, float, string, etc. +# +Constant: [type, value] + +Continue: [] + +# name: the variable being declared +# quals: list of qualifiers (const, volatile) +# funcspec: list function specifiers (i.e. inline in C99) +# storage: list of storage specifiers (extern, register, etc.) +# type: declaration type (probably nested with all the modifiers) +# init: initialization value, or None +# bitsize: bit field size, or None +# +Decl: [name, quals, align, storage, funcspec, type*, init*, bitsize*] + +DeclList: [decls**] + +Default: [stmts**] + +DoWhile: [cond*, stmt*] + +# Represents the ellipsis (...) parameter in a function +# declaration +# +EllipsisParam: [] + +# An empty statement (a semicolon ';' on its own) +# +EmptyStatement: [] + +# Enumeration type specifier +# name: an optional ID +# values: an EnumeratorList +# +Enum: [name, values*] + +# A name/value pair for enumeration values +# +Enumerator: [name, value*] + +# A list of enumerators +# +EnumeratorList: [enumerators**] + +# A list of expressions separated by the comma operator. +# +ExprList: [exprs**] + +# This is the top of the AST, representing a single C file (a +# translation unit in K&R jargon). It contains a list of +# "external-declaration"s, which is either declarations (Decl), +# Typedef or function definitions (FuncDef). +# +FileAST: [ext**] + +# for (init; cond; next) stmt +# +For: [init*, cond*, next*, stmt*] + +# name: Id +# args: ExprList +# +FuncCall: [name*, args*] + +# type (args) +# +FuncDecl: [args*, type*] + +# Function definition: a declarator for the function name and +# a body, which is a compound statement. +# There's an optional list of parameter declarations for old +# K&R-style definitions +# +FuncDef: [decl*, param_decls**, body*] + +Goto: [name] + +ID: [name] + +# Holder for types that are a simple identifier (e.g. the built +# ins void, char etc. and typedef-defined types) +# +IdentifierType: [names] + +If: [cond*, iftrue*, iffalse*] + +# An initialization list used for compound literals. +# +InitList: [exprs**] + +Label: [name, stmt*] + +# A named initializer for C99. +# The name of a NamedInitializer is a sequence of Nodes, because +# names can be hierarchical and contain constant expressions. +# +NamedInitializer: [name**, expr*] + +# a list of comma separated function parameter declarations +# +ParamList: [params**] + +PtrDecl: [quals, type*] + +Return: [expr*] + +StaticAssert: [cond*, message*] + +# name: struct tag name +# decls: declaration of members +# +Struct: [name, decls**] + +# type: . or -> +# name.field or name->field +# +StructRef: [name*, type, field*] + +Switch: [cond*, stmt*] + +# cond ? iftrue : iffalse +# +TernaryOp: [cond*, iftrue*, iffalse*] + +# A base type declaration +# +TypeDecl: [declname, quals, align, type*] + +# A typedef declaration. +# Very similar to Decl, but without some attributes +# +Typedef: [name, quals, storage, type*] + +Typename: [name, quals, align, type*] + +UnaryOp: [op, expr*] + +# name: union tag name +# decls: declaration of members +# +Union: [name, decls**] + +While: [cond*, stmt*] + +Pragma: [string] diff --git a/jwt/python/pycparser/ast_transforms.py b/jwt/python/pycparser/ast_transforms.py new file mode 100644 index 0000000..367dcf5 --- /dev/null +++ b/jwt/python/pycparser/ast_transforms.py @@ -0,0 +1,164 @@ +#------------------------------------------------------------------------------ +# pycparser: ast_transforms.py +# +# Some utilities used by the parser to create a friendlier AST. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ + +from . import c_ast + + +def fix_switch_cases(switch_node): + """ The 'case' statements in a 'switch' come out of parsing with one + child node, so subsequent statements are just tucked to the parent + Compound. Additionally, consecutive (fall-through) case statements + come out messy. This is a peculiarity of the C grammar. The following: + + switch (myvar) { + case 10: + k = 10; + p = k + 1; + return 10; + case 20: + case 30: + return 20; + default: + break; + } + + Creates this tree (pseudo-dump): + + Switch + ID: myvar + Compound: + Case 10: + k = 10 + p = k + 1 + return 10 + Case 20: + Case 30: + return 20 + Default: + break + + The goal of this transform is to fix this mess, turning it into the + following: + + Switch + ID: myvar + Compound: + Case 10: + k = 10 + p = k + 1 + return 10 + Case 20: + Case 30: + return 20 + Default: + break + + A fixed AST node is returned. The argument may be modified. + """ + assert isinstance(switch_node, c_ast.Switch) + if not isinstance(switch_node.stmt, c_ast.Compound): + return switch_node + + # The new Compound child for the Switch, which will collect children in the + # correct order + new_compound = c_ast.Compound([], switch_node.stmt.coord) + + # The last Case/Default node + last_case = None + + # Goes over the children of the Compound below the Switch, adding them + # either directly below new_compound or below the last Case as appropriate + # (for `switch(cond) {}`, block_items would have been None) + for child in (switch_node.stmt.block_items or []): + if isinstance(child, (c_ast.Case, c_ast.Default)): + # If it's a Case/Default: + # 1. Add it to the Compound and mark as "last case" + # 2. If its immediate child is also a Case or Default, promote it + # to a sibling. + new_compound.block_items.append(child) + _extract_nested_case(child, new_compound.block_items) + last_case = new_compound.block_items[-1] + else: + # Other statements are added as children to the last case, if it + # exists. + if last_case is None: + new_compound.block_items.append(child) + else: + last_case.stmts.append(child) + + switch_node.stmt = new_compound + return switch_node + + +def _extract_nested_case(case_node, stmts_list): + """ Recursively extract consecutive Case statements that are made nested + by the parser and add them to the stmts_list. + """ + if isinstance(case_node.stmts[0], (c_ast.Case, c_ast.Default)): + stmts_list.append(case_node.stmts.pop()) + _extract_nested_case(stmts_list[-1], stmts_list) + + +def fix_atomic_specifiers(decl): + """ Atomic specifiers like _Atomic(type) are unusually structured, + conferring a qualifier upon the contained type. + + This function fixes a decl with atomic specifiers to have a sane AST + structure, by removing spurious Typename->TypeDecl pairs and attaching + the _Atomic qualifier in the right place. + """ + # There can be multiple levels of _Atomic in a decl; fix them until a + # fixed point is reached. + while True: + decl, found = _fix_atomic_specifiers_once(decl) + if not found: + break + + # Make sure to add an _Atomic qual on the topmost decl if needed. Also + # restore the declname on the innermost TypeDecl (it gets placed in the + # wrong place during construction). + typ = decl + while not isinstance(typ, c_ast.TypeDecl): + try: + typ = typ.type + except AttributeError: + return decl + if '_Atomic' in typ.quals and '_Atomic' not in decl.quals: + decl.quals.append('_Atomic') + if typ.declname is None: + typ.declname = decl.name + + return decl + + +def _fix_atomic_specifiers_once(decl): + """ Performs one 'fix' round of atomic specifiers. + Returns (modified_decl, found) where found is True iff a fix was made. + """ + parent = decl + grandparent = None + node = decl.type + while node is not None: + if isinstance(node, c_ast.Typename) and '_Atomic' in node.quals: + break + try: + grandparent = parent + parent = node + node = node.type + except AttributeError: + # If we've reached a node without a `type` field, it means we won't + # find what we're looking for at this point; give up the search + # and return the original decl unmodified. + return decl, False + + assert isinstance(parent, c_ast.TypeDecl) + grandparent.type = node.type + if '_Atomic' not in node.type.quals: + node.type.quals.append('_Atomic') + return decl, True diff --git a/jwt/python/pycparser/c_ast.py b/jwt/python/pycparser/c_ast.py new file mode 100644 index 0000000..6575a2a --- /dev/null +++ b/jwt/python/pycparser/c_ast.py @@ -0,0 +1,1125 @@ +#----------------------------------------------------------------- +# ** ATTENTION ** +# This code was automatically generated from the file: +# _c_ast.cfg +# +# Do not modify it directly. Modify the configuration file and +# run the generator again. +# ** ** *** ** ** +# +# pycparser: c_ast.py +# +# AST Node classes. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + + +import sys + +def _repr(obj): + """ + Get the representation of an object, with dedicated pprint-like format for lists. + """ + if isinstance(obj, list): + return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]' + else: + return repr(obj) + +class Node(object): + __slots__ = () + """ Abstract base class for AST nodes. + """ + def __repr__(self): + """ Generates a python representation of the current node + """ + result = self.__class__.__name__ + '(' + + indent = '' + separator = '' + for name in self.__slots__[:-2]: + result += separator + result += indent + result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__))))) + + separator = ',' + indent = '\n ' + (' ' * len(self.__class__.__name__)) + + result += indent + ')' + + return result + + def children(self): + """ A sequence of all children that are Nodes + """ + pass + + def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None): + """ Pretty print the Node and all its attributes and + children (recursively) to a buffer. + + buf: + Open IO buffer into which the Node is printed. + + offset: + Initial offset (amount of leading spaces) + + attrnames: + True if you want to see the attribute names in + name=value pairs. False to only see the values. + + nodenames: + True if you want to see the actual node names + within their parents. + + showcoord: + Do you want the coordinates of each Node to be + displayed. + """ + lead = ' ' * offset + if nodenames and _my_node_name is not None: + buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ') + else: + buf.write(lead + self.__class__.__name__+ ': ') + + if self.attr_names: + if attrnames: + nvlist = [(n, getattr(self,n)) for n in self.attr_names] + attrstr = ', '.join('%s=%s' % nv for nv in nvlist) + else: + vlist = [getattr(self, n) for n in self.attr_names] + attrstr = ', '.join('%s' % v for v in vlist) + buf.write(attrstr) + + if showcoord: + buf.write(' (at %s)' % self.coord) + buf.write('\n') + + for (child_name, child) in self.children(): + child.show( + buf, + offset=offset + 2, + attrnames=attrnames, + nodenames=nodenames, + showcoord=showcoord, + _my_node_name=child_name) + + +class NodeVisitor(object): + """ A base NodeVisitor class for visiting c_ast nodes. + Subclass it and define your own visit_XXX methods, where + XXX is the class name you want to visit with these + methods. + + For example: + + class ConstantVisitor(NodeVisitor): + def __init__(self): + self.values = [] + + def visit_Constant(self, node): + self.values.append(node.value) + + Creates a list of values of all the constant nodes + encountered below the given node. To use it: + + cv = ConstantVisitor() + cv.visit(node) + + Notes: + + * generic_visit() will be called for AST nodes for which + no visit_XXX method was defined. + * The children of nodes for which a visit_XXX was + defined will not be visited - if you need this, call + generic_visit() on the node. + You can use: + NodeVisitor.generic_visit(self, node) + * Modeled after Python's own AST visiting facilities + (the ast module of Python 3.0) + """ + + _method_cache = None + + def visit(self, node): + """ Visit a node. + """ + + if self._method_cache is None: + self._method_cache = {} + + visitor = self._method_cache.get(node.__class__.__name__, None) + if visitor is None: + method = 'visit_' + node.__class__.__name__ + visitor = getattr(self, method, self.generic_visit) + self._method_cache[node.__class__.__name__] = visitor + + return visitor(node) + + def generic_visit(self, node): + """ Called if no explicit visitor function exists for a + node. Implements preorder visiting of the node. + """ + for c in node: + self.visit(c) + +class ArrayDecl(Node): + __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__') + def __init__(self, type, dim, dim_quals, coord=None): + self.type = type + self.dim = dim + self.dim_quals = dim_quals + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + if self.dim is not None: nodelist.append(("dim", self.dim)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + if self.dim is not None: + yield self.dim + + attr_names = ('dim_quals', ) + +class ArrayRef(Node): + __slots__ = ('name', 'subscript', 'coord', '__weakref__') + def __init__(self, name, subscript, coord=None): + self.name = name + self.subscript = subscript + self.coord = coord + + def children(self): + nodelist = [] + if self.name is not None: nodelist.append(("name", self.name)) + if self.subscript is not None: nodelist.append(("subscript", self.subscript)) + return tuple(nodelist) + + def __iter__(self): + if self.name is not None: + yield self.name + if self.subscript is not None: + yield self.subscript + + attr_names = () + +class Assignment(Node): + __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__') + def __init__(self, op, lvalue, rvalue, coord=None): + self.op = op + self.lvalue = lvalue + self.rvalue = rvalue + self.coord = coord + + def children(self): + nodelist = [] + if self.lvalue is not None: nodelist.append(("lvalue", self.lvalue)) + if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue)) + return tuple(nodelist) + + def __iter__(self): + if self.lvalue is not None: + yield self.lvalue + if self.rvalue is not None: + yield self.rvalue + + attr_names = ('op', ) + +class Alignas(Node): + __slots__ = ('alignment', 'coord', '__weakref__') + def __init__(self, alignment, coord=None): + self.alignment = alignment + self.coord = coord + + def children(self): + nodelist = [] + if self.alignment is not None: nodelist.append(("alignment", self.alignment)) + return tuple(nodelist) + + def __iter__(self): + if self.alignment is not None: + yield self.alignment + + attr_names = () + +class BinaryOp(Node): + __slots__ = ('op', 'left', 'right', 'coord', '__weakref__') + def __init__(self, op, left, right, coord=None): + self.op = op + self.left = left + self.right = right + self.coord = coord + + def children(self): + nodelist = [] + if self.left is not None: nodelist.append(("left", self.left)) + if self.right is not None: nodelist.append(("right", self.right)) + return tuple(nodelist) + + def __iter__(self): + if self.left is not None: + yield self.left + if self.right is not None: + yield self.right + + attr_names = ('op', ) + +class Break(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class Case(Node): + __slots__ = ('expr', 'stmts', 'coord', '__weakref__') + def __init__(self, expr, stmts, coord=None): + self.expr = expr + self.stmts = stmts + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + for i, child in enumerate(self.stmts or []): + nodelist.append(("stmts[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + for child in (self.stmts or []): + yield child + + attr_names = () + +class Cast(Node): + __slots__ = ('to_type', 'expr', 'coord', '__weakref__') + def __init__(self, to_type, expr, coord=None): + self.to_type = to_type + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.to_type is not None: nodelist.append(("to_type", self.to_type)) + if self.expr is not None: nodelist.append(("expr", self.expr)) + return tuple(nodelist) + + def __iter__(self): + if self.to_type is not None: + yield self.to_type + if self.expr is not None: + yield self.expr + + attr_names = () + +class Compound(Node): + __slots__ = ('block_items', 'coord', '__weakref__') + def __init__(self, block_items, coord=None): + self.block_items = block_items + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.block_items or []): + nodelist.append(("block_items[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.block_items or []): + yield child + + attr_names = () + +class CompoundLiteral(Node): + __slots__ = ('type', 'init', 'coord', '__weakref__') + def __init__(self, type, init, coord=None): + self.type = type + self.init = init + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + if self.init is not None: nodelist.append(("init", self.init)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + if self.init is not None: + yield self.init + + attr_names = () + +class Constant(Node): + __slots__ = ('type', 'value', 'coord', '__weakref__') + def __init__(self, type, value, coord=None): + self.type = type + self.value = value + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('type', 'value', ) + +class Continue(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class Decl(Node): + __slots__ = ('name', 'quals', 'align', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__') + def __init__(self, name, quals, align, storage, funcspec, type, init, bitsize, coord=None): + self.name = name + self.quals = quals + self.align = align + self.storage = storage + self.funcspec = funcspec + self.type = type + self.init = init + self.bitsize = bitsize + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + if self.init is not None: nodelist.append(("init", self.init)) + if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + if self.init is not None: + yield self.init + if self.bitsize is not None: + yield self.bitsize + + attr_names = ('name', 'quals', 'align', 'storage', 'funcspec', ) + +class DeclList(Node): + __slots__ = ('decls', 'coord', '__weakref__') + def __init__(self, decls, coord=None): + self.decls = decls + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.decls or []): + nodelist.append(("decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.decls or []): + yield child + + attr_names = () + +class Default(Node): + __slots__ = ('stmts', 'coord', '__weakref__') + def __init__(self, stmts, coord=None): + self.stmts = stmts + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.stmts or []): + nodelist.append(("stmts[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.stmts or []): + yield child + + attr_names = () + +class DoWhile(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') + def __init__(self, cond, stmt, coord=None): + self.cond = cond + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class EllipsisParam(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class EmptyStatement(Node): + __slots__ = ('coord', '__weakref__') + def __init__(self, coord=None): + self.coord = coord + + def children(self): + return () + + def __iter__(self): + return + yield + + attr_names = () + +class Enum(Node): + __slots__ = ('name', 'values', 'coord', '__weakref__') + def __init__(self, name, values, coord=None): + self.name = name + self.values = values + self.coord = coord + + def children(self): + nodelist = [] + if self.values is not None: nodelist.append(("values", self.values)) + return tuple(nodelist) + + def __iter__(self): + if self.values is not None: + yield self.values + + attr_names = ('name', ) + +class Enumerator(Node): + __slots__ = ('name', 'value', 'coord', '__weakref__') + def __init__(self, name, value, coord=None): + self.name = name + self.value = value + self.coord = coord + + def children(self): + nodelist = [] + if self.value is not None: nodelist.append(("value", self.value)) + return tuple(nodelist) + + def __iter__(self): + if self.value is not None: + yield self.value + + attr_names = ('name', ) + +class EnumeratorList(Node): + __slots__ = ('enumerators', 'coord', '__weakref__') + def __init__(self, enumerators, coord=None): + self.enumerators = enumerators + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.enumerators or []): + nodelist.append(("enumerators[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.enumerators or []): + yield child + + attr_names = () + +class ExprList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') + def __init__(self, exprs, coord=None): + self.exprs = exprs + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.exprs or []): + nodelist.append(("exprs[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.exprs or []): + yield child + + attr_names = () + +class FileAST(Node): + __slots__ = ('ext', 'coord', '__weakref__') + def __init__(self, ext, coord=None): + self.ext = ext + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.ext or []): + nodelist.append(("ext[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.ext or []): + yield child + + attr_names = () + +class For(Node): + __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__') + def __init__(self, init, cond, next, stmt, coord=None): + self.init = init + self.cond = cond + self.next = next + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.init is not None: nodelist.append(("init", self.init)) + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.next is not None: nodelist.append(("next", self.next)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.init is not None: + yield self.init + if self.cond is not None: + yield self.cond + if self.next is not None: + yield self.next + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class FuncCall(Node): + __slots__ = ('name', 'args', 'coord', '__weakref__') + def __init__(self, name, args, coord=None): + self.name = name + self.args = args + self.coord = coord + + def children(self): + nodelist = [] + if self.name is not None: nodelist.append(("name", self.name)) + if self.args is not None: nodelist.append(("args", self.args)) + return tuple(nodelist) + + def __iter__(self): + if self.name is not None: + yield self.name + if self.args is not None: + yield self.args + + attr_names = () + +class FuncDecl(Node): + __slots__ = ('args', 'type', 'coord', '__weakref__') + def __init__(self, args, type, coord=None): + self.args = args + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.args is not None: nodelist.append(("args", self.args)) + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.args is not None: + yield self.args + if self.type is not None: + yield self.type + + attr_names = () + +class FuncDef(Node): + __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__') + def __init__(self, decl, param_decls, body, coord=None): + self.decl = decl + self.param_decls = param_decls + self.body = body + self.coord = coord + + def children(self): + nodelist = [] + if self.decl is not None: nodelist.append(("decl", self.decl)) + if self.body is not None: nodelist.append(("body", self.body)) + for i, child in enumerate(self.param_decls or []): + nodelist.append(("param_decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + if self.decl is not None: + yield self.decl + if self.body is not None: + yield self.body + for child in (self.param_decls or []): + yield child + + attr_names = () + +class Goto(Node): + __slots__ = ('name', 'coord', '__weakref__') + def __init__(self, name, coord=None): + self.name = name + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('name', ) + +class ID(Node): + __slots__ = ('name', 'coord', '__weakref__') + def __init__(self, name, coord=None): + self.name = name + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('name', ) + +class IdentifierType(Node): + __slots__ = ('names', 'coord', '__weakref__') + def __init__(self, names, coord=None): + self.names = names + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('names', ) + +class If(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') + def __init__(self, cond, iftrue, iffalse, coord=None): + self.cond = cond + self.iftrue = iftrue + self.iffalse = iffalse + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue)) + if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.iftrue is not None: + yield self.iftrue + if self.iffalse is not None: + yield self.iffalse + + attr_names = () + +class InitList(Node): + __slots__ = ('exprs', 'coord', '__weakref__') + def __init__(self, exprs, coord=None): + self.exprs = exprs + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.exprs or []): + nodelist.append(("exprs[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.exprs or []): + yield child + + attr_names = () + +class Label(Node): + __slots__ = ('name', 'stmt', 'coord', '__weakref__') + def __init__(self, name, stmt, coord=None): + self.name = name + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.stmt is not None: + yield self.stmt + + attr_names = ('name', ) + +class NamedInitializer(Node): + __slots__ = ('name', 'expr', 'coord', '__weakref__') + def __init__(self, name, expr, coord=None): + self.name = name + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + for i, child in enumerate(self.name or []): + nodelist.append(("name[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + for child in (self.name or []): + yield child + + attr_names = () + +class ParamList(Node): + __slots__ = ('params', 'coord', '__weakref__') + def __init__(self, params, coord=None): + self.params = params + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.params or []): + nodelist.append(("params[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.params or []): + yield child + + attr_names = () + +class PtrDecl(Node): + __slots__ = ('quals', 'type', 'coord', '__weakref__') + def __init__(self, quals, type, coord=None): + self.quals = quals + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('quals', ) + +class Return(Node): + __slots__ = ('expr', 'coord', '__weakref__') + def __init__(self, expr, coord=None): + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + + attr_names = () + +class StaticAssert(Node): + __slots__ = ('cond', 'message', 'coord', '__weakref__') + def __init__(self, cond, message, coord=None): + self.cond = cond + self.message = message + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.message is not None: nodelist.append(("message", self.message)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.message is not None: + yield self.message + + attr_names = () + +class Struct(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') + def __init__(self, name, decls, coord=None): + self.name = name + self.decls = decls + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.decls or []): + nodelist.append(("decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.decls or []): + yield child + + attr_names = ('name', ) + +class StructRef(Node): + __slots__ = ('name', 'type', 'field', 'coord', '__weakref__') + def __init__(self, name, type, field, coord=None): + self.name = name + self.type = type + self.field = field + self.coord = coord + + def children(self): + nodelist = [] + if self.name is not None: nodelist.append(("name", self.name)) + if self.field is not None: nodelist.append(("field", self.field)) + return tuple(nodelist) + + def __iter__(self): + if self.name is not None: + yield self.name + if self.field is not None: + yield self.field + + attr_names = ('type', ) + +class Switch(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') + def __init__(self, cond, stmt, coord=None): + self.cond = cond + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class TernaryOp(Node): + __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__') + def __init__(self, cond, iftrue, iffalse, coord=None): + self.cond = cond + self.iftrue = iftrue + self.iffalse = iffalse + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue)) + if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.iftrue is not None: + yield self.iftrue + if self.iffalse is not None: + yield self.iffalse + + attr_names = () + +class TypeDecl(Node): + __slots__ = ('declname', 'quals', 'align', 'type', 'coord', '__weakref__') + def __init__(self, declname, quals, align, type, coord=None): + self.declname = declname + self.quals = quals + self.align = align + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('declname', 'quals', 'align', ) + +class Typedef(Node): + __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, storage, type, coord=None): + self.name = name + self.quals = quals + self.storage = storage + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('name', 'quals', 'storage', ) + +class Typename(Node): + __slots__ = ('name', 'quals', 'align', 'type', 'coord', '__weakref__') + def __init__(self, name, quals, align, type, coord=None): + self.name = name + self.quals = quals + self.align = align + self.type = type + self.coord = coord + + def children(self): + nodelist = [] + if self.type is not None: nodelist.append(("type", self.type)) + return tuple(nodelist) + + def __iter__(self): + if self.type is not None: + yield self.type + + attr_names = ('name', 'quals', 'align', ) + +class UnaryOp(Node): + __slots__ = ('op', 'expr', 'coord', '__weakref__') + def __init__(self, op, expr, coord=None): + self.op = op + self.expr = expr + self.coord = coord + + def children(self): + nodelist = [] + if self.expr is not None: nodelist.append(("expr", self.expr)) + return tuple(nodelist) + + def __iter__(self): + if self.expr is not None: + yield self.expr + + attr_names = ('op', ) + +class Union(Node): + __slots__ = ('name', 'decls', 'coord', '__weakref__') + def __init__(self, name, decls, coord=None): + self.name = name + self.decls = decls + self.coord = coord + + def children(self): + nodelist = [] + for i, child in enumerate(self.decls or []): + nodelist.append(("decls[%d]" % i, child)) + return tuple(nodelist) + + def __iter__(self): + for child in (self.decls or []): + yield child + + attr_names = ('name', ) + +class While(Node): + __slots__ = ('cond', 'stmt', 'coord', '__weakref__') + def __init__(self, cond, stmt, coord=None): + self.cond = cond + self.stmt = stmt + self.coord = coord + + def children(self): + nodelist = [] + if self.cond is not None: nodelist.append(("cond", self.cond)) + if self.stmt is not None: nodelist.append(("stmt", self.stmt)) + return tuple(nodelist) + + def __iter__(self): + if self.cond is not None: + yield self.cond + if self.stmt is not None: + yield self.stmt + + attr_names = () + +class Pragma(Node): + __slots__ = ('string', 'coord', '__weakref__') + def __init__(self, string, coord=None): + self.string = string + self.coord = coord + + def children(self): + nodelist = [] + return tuple(nodelist) + + def __iter__(self): + return + yield + + attr_names = ('string', ) + diff --git a/jwt/python/pycparser/c_generator.py b/jwt/python/pycparser/c_generator.py new file mode 100644 index 0000000..1057b2c --- /dev/null +++ b/jwt/python/pycparser/c_generator.py @@ -0,0 +1,502 @@ +#------------------------------------------------------------------------------ +# pycparser: c_generator.py +# +# C code generator from pycparser AST nodes. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ +from . import c_ast + + +class CGenerator(object): + """ Uses the same visitor pattern as c_ast.NodeVisitor, but modified to + return a value from each visit method, using string accumulation in + generic_visit. + """ + def __init__(self, reduce_parentheses=False): + """ Constructs C-code generator + + reduce_parentheses: + if True, eliminates needless parentheses on binary operators + """ + # Statements start with indentation of self.indent_level spaces, using + # the _make_indent method. + self.indent_level = 0 + self.reduce_parentheses = reduce_parentheses + + def _make_indent(self): + return ' ' * self.indent_level + + def visit(self, node): + method = 'visit_' + node.__class__.__name__ + return getattr(self, method, self.generic_visit)(node) + + def generic_visit(self, node): + if node is None: + return '' + else: + return ''.join(self.visit(c) for c_name, c in node.children()) + + def visit_Constant(self, n): + return n.value + + def visit_ID(self, n): + return n.name + + def visit_Pragma(self, n): + ret = '#pragma' + if n.string: + ret += ' ' + n.string + return ret + + def visit_ArrayRef(self, n): + arrref = self._parenthesize_unless_simple(n.name) + return arrref + '[' + self.visit(n.subscript) + ']' + + def visit_StructRef(self, n): + sref = self._parenthesize_unless_simple(n.name) + return sref + n.type + self.visit(n.field) + + def visit_FuncCall(self, n): + fref = self._parenthesize_unless_simple(n.name) + return fref + '(' + self.visit(n.args) + ')' + + def visit_UnaryOp(self, n): + if n.op == 'sizeof': + # Always parenthesize the argument of sizeof since it can be + # a name. + return 'sizeof(%s)' % self.visit(n.expr) + else: + operand = self._parenthesize_unless_simple(n.expr) + if n.op == 'p++': + return '%s++' % operand + elif n.op == 'p--': + return '%s--' % operand + else: + return '%s%s' % (n.op, operand) + + # Precedence map of binary operators: + precedence_map = { + # Should be in sync with c_parser.CParser.precedence + # Higher numbers are stronger binding + '||': 0, # weakest binding + '&&': 1, + '|': 2, + '^': 3, + '&': 4, + '==': 5, '!=': 5, + '>': 6, '>=': 6, '<': 6, '<=': 6, + '>>': 7, '<<': 7, + '+': 8, '-': 8, + '*': 9, '/': 9, '%': 9 # strongest binding + } + + def visit_BinaryOp(self, n): + # Note: all binary operators are left-to-right associative + # + # If `n.left.op` has a stronger or equally binding precedence in + # comparison to `n.op`, no parenthesis are needed for the left: + # e.g., `(a*b) + c` is equivalent to `a*b + c`, as well as + # `(a+b) - c` is equivalent to `a+b - c` (same precedence). + # If the left operator is weaker binding than the current, then + # parentheses are necessary: + # e.g., `(a+b) * c` is NOT equivalent to `a+b * c`. + lval_str = self._parenthesize_if( + n.left, + lambda d: not (self._is_simple_node(d) or + self.reduce_parentheses and isinstance(d, c_ast.BinaryOp) and + self.precedence_map[d.op] >= self.precedence_map[n.op])) + # If `n.right.op` has a stronger -but not equal- binding precedence, + # parenthesis can be omitted on the right: + # e.g., `a + (b*c)` is equivalent to `a + b*c`. + # If the right operator is weaker or equally binding, then parentheses + # are necessary: + # e.g., `a * (b+c)` is NOT equivalent to `a * b+c` and + # `a - (b+c)` is NOT equivalent to `a - b+c` (same precedence). + rval_str = self._parenthesize_if( + n.right, + lambda d: not (self._is_simple_node(d) or + self.reduce_parentheses and isinstance(d, c_ast.BinaryOp) and + self.precedence_map[d.op] > self.precedence_map[n.op])) + return '%s %s %s' % (lval_str, n.op, rval_str) + + def visit_Assignment(self, n): + rval_str = self._parenthesize_if( + n.rvalue, + lambda n: isinstance(n, c_ast.Assignment)) + return '%s %s %s' % (self.visit(n.lvalue), n.op, rval_str) + + def visit_IdentifierType(self, n): + return ' '.join(n.names) + + def _visit_expr(self, n): + if isinstance(n, c_ast.InitList): + return '{' + self.visit(n) + '}' + elif isinstance(n, c_ast.ExprList): + return '(' + self.visit(n) + ')' + else: + return self.visit(n) + + def visit_Decl(self, n, no_type=False): + # no_type is used when a Decl is part of a DeclList, where the type is + # explicitly only for the first declaration in a list. + # + s = n.name if no_type else self._generate_decl(n) + if n.bitsize: s += ' : ' + self.visit(n.bitsize) + if n.init: + s += ' = ' + self._visit_expr(n.init) + return s + + def visit_DeclList(self, n): + s = self.visit(n.decls[0]) + if len(n.decls) > 1: + s += ', ' + ', '.join(self.visit_Decl(decl, no_type=True) + for decl in n.decls[1:]) + return s + + def visit_Typedef(self, n): + s = '' + if n.storage: s += ' '.join(n.storage) + ' ' + s += self._generate_type(n.type) + return s + + def visit_Cast(self, n): + s = '(' + self._generate_type(n.to_type, emit_declname=False) + ')' + return s + ' ' + self._parenthesize_unless_simple(n.expr) + + def visit_ExprList(self, n): + visited_subexprs = [] + for expr in n.exprs: + visited_subexprs.append(self._visit_expr(expr)) + return ', '.join(visited_subexprs) + + def visit_InitList(self, n): + visited_subexprs = [] + for expr in n.exprs: + visited_subexprs.append(self._visit_expr(expr)) + return ', '.join(visited_subexprs) + + def visit_Enum(self, n): + return self._generate_struct_union_enum(n, name='enum') + + def visit_Alignas(self, n): + return '_Alignas({})'.format(self.visit(n.alignment)) + + def visit_Enumerator(self, n): + if not n.value: + return '{indent}{name},\n'.format( + indent=self._make_indent(), + name=n.name, + ) + else: + return '{indent}{name} = {value},\n'.format( + indent=self._make_indent(), + name=n.name, + value=self.visit(n.value), + ) + + def visit_FuncDef(self, n): + decl = self.visit(n.decl) + self.indent_level = 0 + body = self.visit(n.body) + if n.param_decls: + knrdecls = ';\n'.join(self.visit(p) for p in n.param_decls) + return decl + '\n' + knrdecls + ';\n' + body + '\n' + else: + return decl + '\n' + body + '\n' + + def visit_FileAST(self, n): + s = '' + for ext in n.ext: + if isinstance(ext, c_ast.FuncDef): + s += self.visit(ext) + elif isinstance(ext, c_ast.Pragma): + s += self.visit(ext) + '\n' + else: + s += self.visit(ext) + ';\n' + return s + + def visit_Compound(self, n): + s = self._make_indent() + '{\n' + self.indent_level += 2 + if n.block_items: + s += ''.join(self._generate_stmt(stmt) for stmt in n.block_items) + self.indent_level -= 2 + s += self._make_indent() + '}\n' + return s + + def visit_CompoundLiteral(self, n): + return '(' + self.visit(n.type) + '){' + self.visit(n.init) + '}' + + + def visit_EmptyStatement(self, n): + return ';' + + def visit_ParamList(self, n): + return ', '.join(self.visit(param) for param in n.params) + + def visit_Return(self, n): + s = 'return' + if n.expr: s += ' ' + self.visit(n.expr) + return s + ';' + + def visit_Break(self, n): + return 'break;' + + def visit_Continue(self, n): + return 'continue;' + + def visit_TernaryOp(self, n): + s = '(' + self._visit_expr(n.cond) + ') ? ' + s += '(' + self._visit_expr(n.iftrue) + ') : ' + s += '(' + self._visit_expr(n.iffalse) + ')' + return s + + def visit_If(self, n): + s = 'if (' + if n.cond: s += self.visit(n.cond) + s += ')\n' + s += self._generate_stmt(n.iftrue, add_indent=True) + if n.iffalse: + s += self._make_indent() + 'else\n' + s += self._generate_stmt(n.iffalse, add_indent=True) + return s + + def visit_For(self, n): + s = 'for (' + if n.init: s += self.visit(n.init) + s += ';' + if n.cond: s += ' ' + self.visit(n.cond) + s += ';' + if n.next: s += ' ' + self.visit(n.next) + s += ')\n' + s += self._generate_stmt(n.stmt, add_indent=True) + return s + + def visit_While(self, n): + s = 'while (' + if n.cond: s += self.visit(n.cond) + s += ')\n' + s += self._generate_stmt(n.stmt, add_indent=True) + return s + + def visit_DoWhile(self, n): + s = 'do\n' + s += self._generate_stmt(n.stmt, add_indent=True) + s += self._make_indent() + 'while (' + if n.cond: s += self.visit(n.cond) + s += ');' + return s + + def visit_StaticAssert(self, n): + s = '_Static_assert(' + s += self.visit(n.cond) + if n.message: + s += ',' + s += self.visit(n.message) + s += ')' + return s + + def visit_Switch(self, n): + s = 'switch (' + self.visit(n.cond) + ')\n' + s += self._generate_stmt(n.stmt, add_indent=True) + return s + + def visit_Case(self, n): + s = 'case ' + self.visit(n.expr) + ':\n' + for stmt in n.stmts: + s += self._generate_stmt(stmt, add_indent=True) + return s + + def visit_Default(self, n): + s = 'default:\n' + for stmt in n.stmts: + s += self._generate_stmt(stmt, add_indent=True) + return s + + def visit_Label(self, n): + return n.name + ':\n' + self._generate_stmt(n.stmt) + + def visit_Goto(self, n): + return 'goto ' + n.name + ';' + + def visit_EllipsisParam(self, n): + return '...' + + def visit_Struct(self, n): + return self._generate_struct_union_enum(n, 'struct') + + def visit_Typename(self, n): + return self._generate_type(n.type) + + def visit_Union(self, n): + return self._generate_struct_union_enum(n, 'union') + + def visit_NamedInitializer(self, n): + s = '' + for name in n.name: + if isinstance(name, c_ast.ID): + s += '.' + name.name + else: + s += '[' + self.visit(name) + ']' + s += ' = ' + self._visit_expr(n.expr) + return s + + def visit_FuncDecl(self, n): + return self._generate_type(n) + + def visit_ArrayDecl(self, n): + return self._generate_type(n, emit_declname=False) + + def visit_TypeDecl(self, n): + return self._generate_type(n, emit_declname=False) + + def visit_PtrDecl(self, n): + return self._generate_type(n, emit_declname=False) + + def _generate_struct_union_enum(self, n, name): + """ Generates code for structs, unions, and enums. name should be + 'struct', 'union', or 'enum'. + """ + if name in ('struct', 'union'): + members = n.decls + body_function = self._generate_struct_union_body + else: + assert name == 'enum' + members = None if n.values is None else n.values.enumerators + body_function = self._generate_enum_body + s = name + ' ' + (n.name or '') + if members is not None: + # None means no members + # Empty sequence means an empty list of members + s += '\n' + s += self._make_indent() + self.indent_level += 2 + s += '{\n' + s += body_function(members) + self.indent_level -= 2 + s += self._make_indent() + '}' + return s + + def _generate_struct_union_body(self, members): + return ''.join(self._generate_stmt(decl) for decl in members) + + def _generate_enum_body(self, members): + # `[:-2] + '\n'` removes the final `,` from the enumerator list + return ''.join(self.visit(value) for value in members)[:-2] + '\n' + + def _generate_stmt(self, n, add_indent=False): + """ Generation from a statement node. This method exists as a wrapper + for individual visit_* methods to handle different treatment of + some statements in this context. + """ + typ = type(n) + if add_indent: self.indent_level += 2 + indent = self._make_indent() + if add_indent: self.indent_level -= 2 + + if typ in ( + c_ast.Decl, c_ast.Assignment, c_ast.Cast, c_ast.UnaryOp, + c_ast.BinaryOp, c_ast.TernaryOp, c_ast.FuncCall, c_ast.ArrayRef, + c_ast.StructRef, c_ast.Constant, c_ast.ID, c_ast.Typedef, + c_ast.ExprList): + # These can also appear in an expression context so no semicolon + # is added to them automatically + # + return indent + self.visit(n) + ';\n' + elif typ in (c_ast.Compound,): + # No extra indentation required before the opening brace of a + # compound - because it consists of multiple lines it has to + # compute its own indentation. + # + return self.visit(n) + elif typ in (c_ast.If,): + return indent + self.visit(n) + else: + return indent + self.visit(n) + '\n' + + def _generate_decl(self, n): + """ Generation from a Decl node. + """ + s = '' + if n.funcspec: s = ' '.join(n.funcspec) + ' ' + if n.storage: s += ' '.join(n.storage) + ' ' + if n.align: s += self.visit(n.align[0]) + ' ' + s += self._generate_type(n.type) + return s + + def _generate_type(self, n, modifiers=[], emit_declname = True): + """ Recursive generation from a type node. n is the type node. + modifiers collects the PtrDecl, ArrayDecl and FuncDecl modifiers + encountered on the way down to a TypeDecl, to allow proper + generation from it. + """ + typ = type(n) + #~ print(n, modifiers) + + if typ == c_ast.TypeDecl: + s = '' + if n.quals: s += ' '.join(n.quals) + ' ' + s += self.visit(n.type) + + nstr = n.declname if n.declname and emit_declname else '' + # Resolve modifiers. + # Wrap in parens to distinguish pointer to array and pointer to + # function syntax. + # + for i, modifier in enumerate(modifiers): + if isinstance(modifier, c_ast.ArrayDecl): + if (i != 0 and + isinstance(modifiers[i - 1], c_ast.PtrDecl)): + nstr = '(' + nstr + ')' + nstr += '[' + if modifier.dim_quals: + nstr += ' '.join(modifier.dim_quals) + ' ' + nstr += self.visit(modifier.dim) + ']' + elif isinstance(modifier, c_ast.FuncDecl): + if (i != 0 and + isinstance(modifiers[i - 1], c_ast.PtrDecl)): + nstr = '(' + nstr + ')' + nstr += '(' + self.visit(modifier.args) + ')' + elif isinstance(modifier, c_ast.PtrDecl): + if modifier.quals: + nstr = '* %s%s' % (' '.join(modifier.quals), + ' ' + nstr if nstr else '') + else: + nstr = '*' + nstr + if nstr: s += ' ' + nstr + return s + elif typ == c_ast.Decl: + return self._generate_decl(n.type) + elif typ == c_ast.Typename: + return self._generate_type(n.type, emit_declname = emit_declname) + elif typ == c_ast.IdentifierType: + return ' '.join(n.names) + ' ' + elif typ in (c_ast.ArrayDecl, c_ast.PtrDecl, c_ast.FuncDecl): + return self._generate_type(n.type, modifiers + [n], + emit_declname = emit_declname) + else: + return self.visit(n) + + def _parenthesize_if(self, n, condition): + """ Visits 'n' and returns its string representation, parenthesized + if the condition function applied to the node returns True. + """ + s = self._visit_expr(n) + if condition(n): + return '(' + s + ')' + else: + return s + + def _parenthesize_unless_simple(self, n): + """ Common use case for _parenthesize_if + """ + return self._parenthesize_if(n, lambda d: not self._is_simple_node(d)) + + def _is_simple_node(self, n): + """ Returns True for nodes that are "simple" - i.e. nodes that always + have higher precedence than operators. + """ + return isinstance(n, (c_ast.Constant, c_ast.ID, c_ast.ArrayRef, + c_ast.StructRef, c_ast.FuncCall)) diff --git a/jwt/python/pycparser/c_lexer.py b/jwt/python/pycparser/c_lexer.py new file mode 100644 index 0000000..d68d8eb --- /dev/null +++ b/jwt/python/pycparser/c_lexer.py @@ -0,0 +1,554 @@ +#------------------------------------------------------------------------------ +# pycparser: c_lexer.py +# +# CLexer class: lexer for the C language +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ +import re + +from .ply import lex +from .ply.lex import TOKEN + + +class CLexer(object): + """ A lexer for the C language. After building it, set the + input text with input(), and call token() to get new + tokens. + + The public attribute filename can be set to an initial + filename, but the lexer will update it upon #line + directives. + """ + def __init__(self, error_func, on_lbrace_func, on_rbrace_func, + type_lookup_func): + """ Create a new Lexer. + + error_func: + An error function. Will be called with an error + message, line and column as arguments, in case of + an error during lexing. + + on_lbrace_func, on_rbrace_func: + Called when an LBRACE or RBRACE is encountered + (likely to push/pop type_lookup_func's scope) + + type_lookup_func: + A type lookup function. Given a string, it must + return True IFF this string is a name of a type + that was defined with a typedef earlier. + """ + self.error_func = error_func + self.on_lbrace_func = on_lbrace_func + self.on_rbrace_func = on_rbrace_func + self.type_lookup_func = type_lookup_func + self.filename = '' + + # Keeps track of the last token returned from self.token() + self.last_token = None + + # Allow either "# line" or "# " to support GCC's + # cpp output + # + self.line_pattern = re.compile(r'([ \t]*line\W)|([ \t]*\d+)') + self.pragma_pattern = re.compile(r'[ \t]*pragma\W') + + def build(self, **kwargs): + """ Builds the lexer from the specification. Must be + called after the lexer object is created. + + This method exists separately, because the PLY + manual warns against calling lex.lex inside + __init__ + """ + self.lexer = lex.lex(object=self, **kwargs) + + def reset_lineno(self): + """ Resets the internal line number counter of the lexer. + """ + self.lexer.lineno = 1 + + def input(self, text): + self.lexer.input(text) + + def token(self): + self.last_token = self.lexer.token() + return self.last_token + + def find_tok_column(self, token): + """ Find the column of the token in its line. + """ + last_cr = self.lexer.lexdata.rfind('\n', 0, token.lexpos) + return token.lexpos - last_cr + + ######################-- PRIVATE --###################### + + ## + ## Internal auxiliary methods + ## + def _error(self, msg, token): + location = self._make_tok_location(token) + self.error_func(msg, location[0], location[1]) + self.lexer.skip(1) + + def _make_tok_location(self, token): + return (token.lineno, self.find_tok_column(token)) + + ## + ## Reserved keywords + ## + keywords = ( + 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', + 'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', + 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', + 'REGISTER', 'OFFSETOF', + 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', + 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', + 'VOLATILE', 'WHILE', '__INT128', + ) + + keywords_new = ( + '_BOOL', '_COMPLEX', + '_NORETURN', '_THREAD_LOCAL', '_STATIC_ASSERT', + '_ATOMIC', '_ALIGNOF', '_ALIGNAS', + ) + + keyword_map = {} + + for keyword in keywords: + keyword_map[keyword.lower()] = keyword + + for keyword in keywords_new: + keyword_map[keyword[:2].upper() + keyword[2:].lower()] = keyword + + ## + ## All the tokens recognized by the lexer + ## + tokens = keywords + keywords_new + ( + # Identifiers + 'ID', + + # Type identifiers (identifiers previously defined as + # types with typedef) + 'TYPEID', + + # constants + 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'INT_CONST_CHAR', + 'FLOAT_CONST', 'HEX_FLOAT_CONST', + 'CHAR_CONST', + 'WCHAR_CONST', + 'U8CHAR_CONST', + 'U16CHAR_CONST', + 'U32CHAR_CONST', + + # String literals + 'STRING_LITERAL', + 'WSTRING_LITERAL', + 'U8STRING_LITERAL', + 'U16STRING_LITERAL', + 'U32STRING_LITERAL', + + # Operators + 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD', + 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', + 'LOR', 'LAND', 'LNOT', + 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', + + # Assignment + 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', + 'PLUSEQUAL', 'MINUSEQUAL', + 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', + 'OREQUAL', + + # Increment/decrement + 'PLUSPLUS', 'MINUSMINUS', + + # Structure dereference (->) + 'ARROW', + + # Conditional operator (?) + 'CONDOP', + + # Delimiters + 'LPAREN', 'RPAREN', # ( ) + 'LBRACKET', 'RBRACKET', # [ ] + 'LBRACE', 'RBRACE', # { } + 'COMMA', 'PERIOD', # . , + 'SEMI', 'COLON', # ; : + + # Ellipsis (...) + 'ELLIPSIS', + + # pre-processor + 'PPHASH', # '#' + 'PPPRAGMA', # 'pragma' + 'PPPRAGMASTR', + ) + + ## + ## Regexes for use in tokens + ## + ## + + # valid C identifiers (K&R2: A.2.3), plus '$' (supported by some compilers) + identifier = r'[a-zA-Z_$][0-9a-zA-Z_$]*' + + hex_prefix = '0[xX]' + hex_digits = '[0-9a-fA-F]+' + bin_prefix = '0[bB]' + bin_digits = '[01]+' + + # integer constants (K&R2: A.2.5.1) + integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?' + decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')' + octal_constant = '0[0-7]*'+integer_suffix_opt + hex_constant = hex_prefix+hex_digits+integer_suffix_opt + bin_constant = bin_prefix+bin_digits+integer_suffix_opt + + bad_octal_constant = '0[0-7]*[89]' + + # character constants (K&R2: A.2.5.2) + # Note: a-zA-Z and '.-~^_!=&;,' are allowed as escape chars to support #line + # directives with Windows paths as filenames (..\..\dir\file) + # For the same reason, decimal_escape allows all digit sequences. We want to + # parse all correct code, even if it means to sometimes parse incorrect + # code. + # + # The original regexes were taken verbatim from the C syntax definition, + # and were later modified to avoid worst-case exponential running time. + # + # simple_escape = r"""([a-zA-Z._~!=&\^\-\\?'"])""" + # decimal_escape = r"""(\d+)""" + # hex_escape = r"""(x[0-9a-fA-F]+)""" + # bad_escape = r"""([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-7])""" + # + # The following modifications were made to avoid the ambiguity that allowed backtracking: + # (https://github.com/eliben/pycparser/issues/61) + # + # - \x was removed from simple_escape, unless it was not followed by a hex digit, to avoid ambiguity with hex_escape. + # - hex_escape allows one or more hex characters, but requires that the next character(if any) is not hex + # - decimal_escape allows one or more decimal characters, but requires that the next character(if any) is not a decimal + # - bad_escape does not allow any decimals (8-9), to avoid conflicting with the permissive decimal_escape. + # + # Without this change, python's `re` module would recursively try parsing each ambiguous escape sequence in multiple ways. + # e.g. `\123` could be parsed as `\1`+`23`, `\12`+`3`, and `\123`. + + simple_escape = r"""([a-wyzA-Z._~!=&\^\-\\?'"]|x(?![0-9a-fA-F]))""" + decimal_escape = r"""(\d+)(?!\d)""" + hex_escape = r"""(x[0-9a-fA-F]+)(?![0-9a-fA-F])""" + bad_escape = r"""([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-9])""" + + escape_sequence = r"""(\\("""+simple_escape+'|'+decimal_escape+'|'+hex_escape+'))' + + # This complicated regex with lookahead might be slow for strings, so because all of the valid escapes (including \x) allowed + # 0 or more non-escaped characters after the first character, simple_escape+decimal_escape+hex_escape got simplified to + + escape_sequence_start_in_string = r"""(\\[0-9a-zA-Z._~!=&\^\-\\?'"])""" + + cconst_char = r"""([^'\\\n]|"""+escape_sequence+')' + char_const = "'"+cconst_char+"'" + wchar_const = 'L'+char_const + u8char_const = 'u8'+char_const + u16char_const = 'u'+char_const + u32char_const = 'U'+char_const + multicharacter_constant = "'"+cconst_char+"{2,4}'" + unmatched_quote = "('"+cconst_char+"*\\n)|('"+cconst_char+"*$)" + bad_char_const = r"""('"""+cconst_char+"""[^'\n]+')|('')|('"""+bad_escape+r"""[^'\n]*')""" + + # string literals (K&R2: A.2.6) + string_char = r"""([^"\\\n]|"""+escape_sequence_start_in_string+')' + string_literal = '"'+string_char+'*"' + wstring_literal = 'L'+string_literal + u8string_literal = 'u8'+string_literal + u16string_literal = 'u'+string_literal + u32string_literal = 'U'+string_literal + bad_string_literal = '"'+string_char+'*'+bad_escape+string_char+'*"' + + # floating constants (K&R2: A.2.5.3) + exponent_part = r"""([eE][-+]?[0-9]+)""" + fractional_constant = r"""([0-9]*\.[0-9]+)|([0-9]+\.)""" + floating_constant = '(((('+fractional_constant+')'+exponent_part+'?)|([0-9]+'+exponent_part+'))[FfLl]?)' + binary_exponent_part = r'''([pP][+-]?[0-9]+)''' + hex_fractional_constant = '((('+hex_digits+r""")?\."""+hex_digits+')|('+hex_digits+r"""\.))""" + hex_floating_constant = '('+hex_prefix+'('+hex_digits+'|'+hex_fractional_constant+')'+binary_exponent_part+'[FfLl]?)' + + ## + ## Lexer states: used for preprocessor \n-terminated directives + ## + states = ( + # ppline: preprocessor line directives + # + ('ppline', 'exclusive'), + + # pppragma: pragma + # + ('pppragma', 'exclusive'), + ) + + def t_PPHASH(self, t): + r'[ \t]*\#' + if self.line_pattern.match(t.lexer.lexdata, pos=t.lexer.lexpos): + t.lexer.begin('ppline') + self.pp_line = self.pp_filename = None + elif self.pragma_pattern.match(t.lexer.lexdata, pos=t.lexer.lexpos): + t.lexer.begin('pppragma') + else: + t.type = 'PPHASH' + return t + + ## + ## Rules for the ppline state + ## + @TOKEN(string_literal) + def t_ppline_FILENAME(self, t): + if self.pp_line is None: + self._error('filename before line number in #line', t) + else: + self.pp_filename = t.value.lstrip('"').rstrip('"') + + @TOKEN(decimal_constant) + def t_ppline_LINE_NUMBER(self, t): + if self.pp_line is None: + self.pp_line = t.value + else: + # Ignore: GCC's cpp sometimes inserts a numeric flag + # after the file name + pass + + def t_ppline_NEWLINE(self, t): + r'\n' + if self.pp_line is None: + self._error('line number missing in #line', t) + else: + self.lexer.lineno = int(self.pp_line) + + if self.pp_filename is not None: + self.filename = self.pp_filename + + t.lexer.begin('INITIAL') + + def t_ppline_PPLINE(self, t): + r'line' + pass + + t_ppline_ignore = ' \t' + + def t_ppline_error(self, t): + self._error('invalid #line directive', t) + + ## + ## Rules for the pppragma state + ## + def t_pppragma_NEWLINE(self, t): + r'\n' + t.lexer.lineno += 1 + t.lexer.begin('INITIAL') + + def t_pppragma_PPPRAGMA(self, t): + r'pragma' + return t + + t_pppragma_ignore = ' \t' + + def t_pppragma_STR(self, t): + '.+' + t.type = 'PPPRAGMASTR' + return t + + def t_pppragma_error(self, t): + self._error('invalid #pragma directive', t) + + ## + ## Rules for the normal state + ## + t_ignore = ' \t' + + # Newlines + def t_NEWLINE(self, t): + r'\n+' + t.lexer.lineno += t.value.count("\n") + + # Operators + t_PLUS = r'\+' + t_MINUS = r'-' + t_TIMES = r'\*' + t_DIVIDE = r'/' + t_MOD = r'%' + t_OR = r'\|' + t_AND = r'&' + t_NOT = r'~' + t_XOR = r'\^' + t_LSHIFT = r'<<' + t_RSHIFT = r'>>' + t_LOR = r'\|\|' + t_LAND = r'&&' + t_LNOT = r'!' + t_LT = r'<' + t_GT = r'>' + t_LE = r'<=' + t_GE = r'>=' + t_EQ = r'==' + t_NE = r'!=' + + # Assignment operators + t_EQUALS = r'=' + t_TIMESEQUAL = r'\*=' + t_DIVEQUAL = r'/=' + t_MODEQUAL = r'%=' + t_PLUSEQUAL = r'\+=' + t_MINUSEQUAL = r'-=' + t_LSHIFTEQUAL = r'<<=' + t_RSHIFTEQUAL = r'>>=' + t_ANDEQUAL = r'&=' + t_OREQUAL = r'\|=' + t_XOREQUAL = r'\^=' + + # Increment/decrement + t_PLUSPLUS = r'\+\+' + t_MINUSMINUS = r'--' + + # -> + t_ARROW = r'->' + + # ? + t_CONDOP = r'\?' + + # Delimiters + t_LPAREN = r'\(' + t_RPAREN = r'\)' + t_LBRACKET = r'\[' + t_RBRACKET = r'\]' + t_COMMA = r',' + t_PERIOD = r'\.' + t_SEMI = r';' + t_COLON = r':' + t_ELLIPSIS = r'\.\.\.' + + # Scope delimiters + # To see why on_lbrace_func is needed, consider: + # typedef char TT; + # void foo(int TT) { TT = 10; } + # TT x = 5; + # Outside the function, TT is a typedef, but inside (starting and ending + # with the braces) it's a parameter. The trouble begins with yacc's + # lookahead token. If we open a new scope in brace_open, then TT has + # already been read and incorrectly interpreted as TYPEID. So, we need + # to open and close scopes from within the lexer. + # Similar for the TT immediately outside the end of the function. + # + @TOKEN(r'\{') + def t_LBRACE(self, t): + self.on_lbrace_func() + return t + @TOKEN(r'\}') + def t_RBRACE(self, t): + self.on_rbrace_func() + return t + + t_STRING_LITERAL = string_literal + + # The following floating and integer constants are defined as + # functions to impose a strict order (otherwise, decimal + # is placed before the others because its regex is longer, + # and this is bad) + # + @TOKEN(floating_constant) + def t_FLOAT_CONST(self, t): + return t + + @TOKEN(hex_floating_constant) + def t_HEX_FLOAT_CONST(self, t): + return t + + @TOKEN(hex_constant) + def t_INT_CONST_HEX(self, t): + return t + + @TOKEN(bin_constant) + def t_INT_CONST_BIN(self, t): + return t + + @TOKEN(bad_octal_constant) + def t_BAD_CONST_OCT(self, t): + msg = "Invalid octal constant" + self._error(msg, t) + + @TOKEN(octal_constant) + def t_INT_CONST_OCT(self, t): + return t + + @TOKEN(decimal_constant) + def t_INT_CONST_DEC(self, t): + return t + + # Must come before bad_char_const, to prevent it from + # catching valid char constants as invalid + # + @TOKEN(multicharacter_constant) + def t_INT_CONST_CHAR(self, t): + return t + + @TOKEN(char_const) + def t_CHAR_CONST(self, t): + return t + + @TOKEN(wchar_const) + def t_WCHAR_CONST(self, t): + return t + + @TOKEN(u8char_const) + def t_U8CHAR_CONST(self, t): + return t + + @TOKEN(u16char_const) + def t_U16CHAR_CONST(self, t): + return t + + @TOKEN(u32char_const) + def t_U32CHAR_CONST(self, t): + return t + + @TOKEN(unmatched_quote) + def t_UNMATCHED_QUOTE(self, t): + msg = "Unmatched '" + self._error(msg, t) + + @TOKEN(bad_char_const) + def t_BAD_CHAR_CONST(self, t): + msg = "Invalid char constant %s" % t.value + self._error(msg, t) + + @TOKEN(wstring_literal) + def t_WSTRING_LITERAL(self, t): + return t + + @TOKEN(u8string_literal) + def t_U8STRING_LITERAL(self, t): + return t + + @TOKEN(u16string_literal) + def t_U16STRING_LITERAL(self, t): + return t + + @TOKEN(u32string_literal) + def t_U32STRING_LITERAL(self, t): + return t + + # unmatched string literals are caught by the preprocessor + + @TOKEN(bad_string_literal) + def t_BAD_STRING_LITERAL(self, t): + msg = "String contains invalid escape code" + self._error(msg, t) + + @TOKEN(identifier) + def t_ID(self, t): + t.type = self.keyword_map.get(t.value, "ID") + if t.type == 'ID' and self.type_lookup_func(t.value): + t.type = "TYPEID" + return t + + def t_error(self, t): + msg = 'Illegal character %s' % repr(t.value[0]) + self._error(msg, t) diff --git a/jwt/python/pycparser/c_parser.py b/jwt/python/pycparser/c_parser.py new file mode 100644 index 0000000..640a759 --- /dev/null +++ b/jwt/python/pycparser/c_parser.py @@ -0,0 +1,1936 @@ +#------------------------------------------------------------------------------ +# pycparser: c_parser.py +# +# CParser class: Parser and AST builder for the C language +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#------------------------------------------------------------------------------ +from .ply import yacc + +from . import c_ast +from .c_lexer import CLexer +from .plyparser import PLYParser, ParseError, parameterized, template +from .ast_transforms import fix_switch_cases, fix_atomic_specifiers + + +@template +class CParser(PLYParser): + def __init__( + self, + lex_optimize=True, + lexer=CLexer, + lextab='pycparser.lextab', + yacc_optimize=True, + yacctab='pycparser.yacctab', + yacc_debug=False, + taboutputdir=''): + """ Create a new CParser. + + Some arguments for controlling the debug/optimization + level of the parser are provided. The defaults are + tuned for release/performance mode. + The simple rules for using them are: + *) When tweaking CParser/CLexer, set these to False + *) When releasing a stable parser, set to True + + lex_optimize: + Set to False when you're modifying the lexer. + Otherwise, changes in the lexer won't be used, if + some lextab.py file exists. + When releasing with a stable lexer, set to True + to save the re-generation of the lexer table on + each run. + + lexer: + Set this parameter to define the lexer to use if + you're not using the default CLexer. + + lextab: + Points to the lex table that's used for optimized + mode. Only if you're modifying the lexer and want + some tests to avoid re-generating the table, make + this point to a local lex table file (that's been + earlier generated with lex_optimize=True) + + yacc_optimize: + Set to False when you're modifying the parser. + Otherwise, changes in the parser won't be used, if + some parsetab.py file exists. + When releasing with a stable parser, set to True + to save the re-generation of the parser table on + each run. + + yacctab: + Points to the yacc table that's used for optimized + mode. Only if you're modifying the parser, make + this point to a local yacc table file + + yacc_debug: + Generate a parser.out file that explains how yacc + built the parsing table from the grammar. + + taboutputdir: + Set this parameter to control the location of generated + lextab and yacctab files. + """ + self.clex = lexer( + error_func=self._lex_error_func, + on_lbrace_func=self._lex_on_lbrace_func, + on_rbrace_func=self._lex_on_rbrace_func, + type_lookup_func=self._lex_type_lookup_func) + + self.clex.build( + optimize=lex_optimize, + lextab=lextab, + outputdir=taboutputdir) + self.tokens = self.clex.tokens + + rules_with_opt = [ + 'abstract_declarator', + 'assignment_expression', + 'declaration_list', + 'declaration_specifiers_no_type', + 'designation', + 'expression', + 'identifier_list', + 'init_declarator_list', + 'id_init_declarator_list', + 'initializer_list', + 'parameter_type_list', + 'block_item_list', + 'type_qualifier_list', + 'struct_declarator_list' + ] + + for rule in rules_with_opt: + self._create_opt_rule(rule) + + self.cparser = yacc.yacc( + module=self, + start='translation_unit_or_empty', + debug=yacc_debug, + optimize=yacc_optimize, + tabmodule=yacctab, + outputdir=taboutputdir) + + # Stack of scopes for keeping track of symbols. _scope_stack[-1] is + # the current (topmost) scope. Each scope is a dictionary that + # specifies whether a name is a type. If _scope_stack[n][name] is + # True, 'name' is currently a type in the scope. If it's False, + # 'name' is used in the scope but not as a type (for instance, if we + # saw: int name; + # If 'name' is not a key in _scope_stack[n] then 'name' was not defined + # in this scope at all. + self._scope_stack = [dict()] + + # Keeps track of the last token given to yacc (the lookahead token) + self._last_yielded_token = None + + def parse(self, text, filename='', debug=False): + """ Parses C code and returns an AST. + + text: + A string containing the C source code + + filename: + Name of the file being parsed (for meaningful + error messages) + + debug: + Debug flag to YACC + """ + self.clex.filename = filename + self.clex.reset_lineno() + self._scope_stack = [dict()] + self._last_yielded_token = None + return self.cparser.parse( + input=text, + lexer=self.clex, + debug=debug) + + ######################-- PRIVATE --###################### + + def _push_scope(self): + self._scope_stack.append(dict()) + + def _pop_scope(self): + assert len(self._scope_stack) > 1 + self._scope_stack.pop() + + def _add_typedef_name(self, name, coord): + """ Add a new typedef name (ie a TYPEID) to the current scope + """ + if not self._scope_stack[-1].get(name, True): + self._parse_error( + "Typedef %r previously declared as non-typedef " + "in this scope" % name, coord) + self._scope_stack[-1][name] = True + + def _add_identifier(self, name, coord): + """ Add a new object, function, or enum member name (ie an ID) to the + current scope + """ + if self._scope_stack[-1].get(name, False): + self._parse_error( + "Non-typedef %r previously declared as typedef " + "in this scope" % name, coord) + self._scope_stack[-1][name] = False + + def _is_type_in_scope(self, name): + """ Is *name* a typedef-name in the current scope? + """ + for scope in reversed(self._scope_stack): + # If name is an identifier in this scope it shadows typedefs in + # higher scopes. + in_scope = scope.get(name) + if in_scope is not None: return in_scope + return False + + def _lex_error_func(self, msg, line, column): + self._parse_error(msg, self._coord(line, column)) + + def _lex_on_lbrace_func(self): + self._push_scope() + + def _lex_on_rbrace_func(self): + self._pop_scope() + + def _lex_type_lookup_func(self, name): + """ Looks up types that were previously defined with + typedef. + Passed to the lexer for recognizing identifiers that + are types. + """ + is_type = self._is_type_in_scope(name) + return is_type + + def _get_yacc_lookahead_token(self): + """ We need access to yacc's lookahead token in certain cases. + This is the last token yacc requested from the lexer, so we + ask the lexer. + """ + return self.clex.last_token + + # To understand what's going on here, read sections A.8.5 and + # A.8.6 of K&R2 very carefully. + # + # A C type consists of a basic type declaration, with a list + # of modifiers. For example: + # + # int *c[5]; + # + # The basic declaration here is 'int c', and the pointer and + # the array are the modifiers. + # + # Basic declarations are represented by TypeDecl (from module c_ast) and the + # modifiers are FuncDecl, PtrDecl and ArrayDecl. + # + # The standard states that whenever a new modifier is parsed, it should be + # added to the end of the list of modifiers. For example: + # + # K&R2 A.8.6.2: Array Declarators + # + # In a declaration T D where D has the form + # D1 [constant-expression-opt] + # and the type of the identifier in the declaration T D1 is + # "type-modifier T", the type of the + # identifier of D is "type-modifier array of T" + # + # This is what this method does. The declarator it receives + # can be a list of declarators ending with TypeDecl. It + # tacks the modifier to the end of this list, just before + # the TypeDecl. + # + # Additionally, the modifier may be a list itself. This is + # useful for pointers, that can come as a chain from the rule + # p_pointer. In this case, the whole modifier list is spliced + # into the new location. + def _type_modify_decl(self, decl, modifier): + """ Tacks a type modifier on a declarator, and returns + the modified declarator. + + Note: the declarator and modifier may be modified + """ + #~ print '****' + #~ decl.show(offset=3) + #~ modifier.show(offset=3) + #~ print '****' + + modifier_head = modifier + modifier_tail = modifier + + # The modifier may be a nested list. Reach its tail. + while modifier_tail.type: + modifier_tail = modifier_tail.type + + # If the decl is a basic type, just tack the modifier onto it. + if isinstance(decl, c_ast.TypeDecl): + modifier_tail.type = decl + return modifier + else: + # Otherwise, the decl is a list of modifiers. Reach + # its tail and splice the modifier onto the tail, + # pointing to the underlying basic type. + decl_tail = decl + + while not isinstance(decl_tail.type, c_ast.TypeDecl): + decl_tail = decl_tail.type + + modifier_tail.type = decl_tail.type + decl_tail.type = modifier_head + return decl + + # Due to the order in which declarators are constructed, + # they have to be fixed in order to look like a normal AST. + # + # When a declaration arrives from syntax construction, it has + # these problems: + # * The innermost TypeDecl has no type (because the basic + # type is only known at the uppermost declaration level) + # * The declaration has no variable name, since that is saved + # in the innermost TypeDecl + # * The typename of the declaration is a list of type + # specifiers, and not a node. Here, basic identifier types + # should be separated from more complex types like enums + # and structs. + # + # This method fixes these problems. + def _fix_decl_name_type(self, decl, typename): + """ Fixes a declaration. Modifies decl. + """ + # Reach the underlying basic type + # + type = decl + while not isinstance(type, c_ast.TypeDecl): + type = type.type + + decl.name = type.declname + type.quals = decl.quals[:] + + # The typename is a list of types. If any type in this + # list isn't an IdentifierType, it must be the only + # type in the list (it's illegal to declare "int enum ..") + # If all the types are basic, they're collected in the + # IdentifierType holder. + for tn in typename: + if not isinstance(tn, c_ast.IdentifierType): + if len(typename) > 1: + self._parse_error( + "Invalid multiple types specified", tn.coord) + else: + type.type = tn + return decl + + if not typename: + # Functions default to returning int + # + if not isinstance(decl.type, c_ast.FuncDecl): + self._parse_error( + "Missing type in declaration", decl.coord) + type.type = c_ast.IdentifierType( + ['int'], + coord=decl.coord) + else: + # At this point, we know that typename is a list of IdentifierType + # nodes. Concatenate all the names into a single list. + # + type.type = c_ast.IdentifierType( + [name for id in typename for name in id.names], + coord=typename[0].coord) + return decl + + def _add_declaration_specifier(self, declspec, newspec, kind, append=False): + """ Declaration specifiers are represented by a dictionary + with the entries: + * qual: a list of type qualifiers + * storage: a list of storage type qualifiers + * type: a list of type specifiers + * function: a list of function specifiers + * alignment: a list of alignment specifiers + + This method is given a declaration specifier, and a + new specifier of a given kind. + If `append` is True, the new specifier is added to the end of + the specifiers list, otherwise it's added at the beginning. + Returns the declaration specifier, with the new + specifier incorporated. + """ + spec = declspec or dict(qual=[], storage=[], type=[], function=[], alignment=[]) + + if append: + spec[kind].append(newspec) + else: + spec[kind].insert(0, newspec) + + return spec + + def _build_declarations(self, spec, decls, typedef_namespace=False): + """ Builds a list of declarations all sharing the given specifiers. + If typedef_namespace is true, each declared name is added + to the "typedef namespace", which also includes objects, + functions, and enum constants. + """ + is_typedef = 'typedef' in spec['storage'] + declarations = [] + + # Bit-fields are allowed to be unnamed. + if decls[0].get('bitsize') is not None: + pass + + # When redeclaring typedef names as identifiers in inner scopes, a + # problem can occur where the identifier gets grouped into + # spec['type'], leaving decl as None. This can only occur for the + # first declarator. + elif decls[0]['decl'] is None: + if len(spec['type']) < 2 or len(spec['type'][-1].names) != 1 or \ + not self._is_type_in_scope(spec['type'][-1].names[0]): + coord = '?' + for t in spec['type']: + if hasattr(t, 'coord'): + coord = t.coord + break + self._parse_error('Invalid declaration', coord) + + # Make this look as if it came from "direct_declarator:ID" + decls[0]['decl'] = c_ast.TypeDecl( + declname=spec['type'][-1].names[0], + type=None, + quals=None, + align=spec['alignment'], + coord=spec['type'][-1].coord) + # Remove the "new" type's name from the end of spec['type'] + del spec['type'][-1] + + # A similar problem can occur where the declaration ends up looking + # like an abstract declarator. Give it a name if this is the case. + elif not isinstance(decls[0]['decl'], ( + c_ast.Enum, c_ast.Struct, c_ast.Union, c_ast.IdentifierType)): + decls_0_tail = decls[0]['decl'] + while not isinstance(decls_0_tail, c_ast.TypeDecl): + decls_0_tail = decls_0_tail.type + if decls_0_tail.declname is None: + decls_0_tail.declname = spec['type'][-1].names[0] + del spec['type'][-1] + + for decl in decls: + assert decl['decl'] is not None + if is_typedef: + declaration = c_ast.Typedef( + name=None, + quals=spec['qual'], + storage=spec['storage'], + type=decl['decl'], + coord=decl['decl'].coord) + else: + declaration = c_ast.Decl( + name=None, + quals=spec['qual'], + align=spec['alignment'], + storage=spec['storage'], + funcspec=spec['function'], + type=decl['decl'], + init=decl.get('init'), + bitsize=decl.get('bitsize'), + coord=decl['decl'].coord) + + if isinstance(declaration.type, ( + c_ast.Enum, c_ast.Struct, c_ast.Union, + c_ast.IdentifierType)): + fixed_decl = declaration + else: + fixed_decl = self._fix_decl_name_type(declaration, spec['type']) + + # Add the type name defined by typedef to a + # symbol table (for usage in the lexer) + if typedef_namespace: + if is_typedef: + self._add_typedef_name(fixed_decl.name, fixed_decl.coord) + else: + self._add_identifier(fixed_decl.name, fixed_decl.coord) + + fixed_decl = fix_atomic_specifiers(fixed_decl) + declarations.append(fixed_decl) + + return declarations + + def _build_function_definition(self, spec, decl, param_decls, body): + """ Builds a function definition. + """ + if 'typedef' in spec['storage']: + self._parse_error("Invalid typedef", decl.coord) + + declaration = self._build_declarations( + spec=spec, + decls=[dict(decl=decl, init=None)], + typedef_namespace=True)[0] + + return c_ast.FuncDef( + decl=declaration, + param_decls=param_decls, + body=body, + coord=decl.coord) + + def _select_struct_union_class(self, token): + """ Given a token (either STRUCT or UNION), selects the + appropriate AST class. + """ + if token == 'struct': + return c_ast.Struct + else: + return c_ast.Union + + ## + ## Precedence and associativity of operators + ## + # If this changes, c_generator.CGenerator.precedence_map needs to change as + # well + precedence = ( + ('left', 'LOR'), + ('left', 'LAND'), + ('left', 'OR'), + ('left', 'XOR'), + ('left', 'AND'), + ('left', 'EQ', 'NE'), + ('left', 'GT', 'GE', 'LT', 'LE'), + ('left', 'RSHIFT', 'LSHIFT'), + ('left', 'PLUS', 'MINUS'), + ('left', 'TIMES', 'DIVIDE', 'MOD') + ) + + ## + ## Grammar productions + ## Implementation of the BNF defined in K&R2 A.13 + ## + + # Wrapper around a translation unit, to allow for empty input. + # Not strictly part of the C99 Grammar, but useful in practice. + def p_translation_unit_or_empty(self, p): + """ translation_unit_or_empty : translation_unit + | empty + """ + if p[1] is None: + p[0] = c_ast.FileAST([]) + else: + p[0] = c_ast.FileAST(p[1]) + + def p_translation_unit_1(self, p): + """ translation_unit : external_declaration + """ + # Note: external_declaration is already a list + p[0] = p[1] + + def p_translation_unit_2(self, p): + """ translation_unit : translation_unit external_declaration + """ + p[1].extend(p[2]) + p[0] = p[1] + + # Declarations always come as lists (because they can be + # several in one line), so we wrap the function definition + # into a list as well, to make the return value of + # external_declaration homogeneous. + def p_external_declaration_1(self, p): + """ external_declaration : function_definition + """ + p[0] = [p[1]] + + def p_external_declaration_2(self, p): + """ external_declaration : declaration + """ + p[0] = p[1] + + def p_external_declaration_3(self, p): + """ external_declaration : pp_directive + | pppragma_directive + """ + p[0] = [p[1]] + + def p_external_declaration_4(self, p): + """ external_declaration : SEMI + """ + p[0] = [] + + def p_external_declaration_5(self, p): + """ external_declaration : static_assert + """ + p[0] = p[1] + + def p_static_assert_declaration(self, p): + """ static_assert : _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN + | _STATIC_ASSERT LPAREN constant_expression RPAREN + """ + if len(p) == 5: + p[0] = [c_ast.StaticAssert(p[3], None, self._token_coord(p, 1))] + else: + p[0] = [c_ast.StaticAssert(p[3], p[5], self._token_coord(p, 1))] + + def p_pp_directive(self, p): + """ pp_directive : PPHASH + """ + self._parse_error('Directives not supported yet', + self._token_coord(p, 1)) + + def p_pppragma_directive(self, p): + """ pppragma_directive : PPPRAGMA + | PPPRAGMA PPPRAGMASTR + """ + if len(p) == 3: + p[0] = c_ast.Pragma(p[2], self._token_coord(p, 2)) + else: + p[0] = c_ast.Pragma("", self._token_coord(p, 1)) + + # In function definitions, the declarator can be followed by + # a declaration list, for old "K&R style" function definitios. + def p_function_definition_1(self, p): + """ function_definition : id_declarator declaration_list_opt compound_statement + """ + # no declaration specifiers - 'int' becomes the default type + spec = dict( + qual=[], + alignment=[], + storage=[], + type=[c_ast.IdentifierType(['int'], + coord=self._token_coord(p, 1))], + function=[]) + + p[0] = self._build_function_definition( + spec=spec, + decl=p[1], + param_decls=p[2], + body=p[3]) + + def p_function_definition_2(self, p): + """ function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement + """ + spec = p[1] + + p[0] = self._build_function_definition( + spec=spec, + decl=p[2], + param_decls=p[3], + body=p[4]) + + # Note, according to C18 A.2.2 6.7.10 static_assert-declaration _Static_assert + # is a declaration, not a statement. We additionally recognise it as a statement + # to fix parsing of _Static_assert inside the functions. + # + def p_statement(self, p): + """ statement : labeled_statement + | expression_statement + | compound_statement + | selection_statement + | iteration_statement + | jump_statement + | pppragma_directive + | static_assert + """ + p[0] = p[1] + + # A pragma is generally considered a decorator rather than an actual + # statement. Still, for the purposes of analyzing an abstract syntax tree of + # C code, pragma's should not be ignored and were previously treated as a + # statement. This presents a problem for constructs that take a statement + # such as labeled_statements, selection_statements, and + # iteration_statements, causing a misleading structure in the AST. For + # example, consider the following C code. + # + # for (int i = 0; i < 3; i++) + # #pragma omp critical + # sum += 1; + # + # This code will compile and execute "sum += 1;" as the body of the for + # loop. Previous implementations of PyCParser would render the AST for this + # block of code as follows: + # + # For: + # DeclList: + # Decl: i, [], [], [] + # TypeDecl: i, [] + # IdentifierType: ['int'] + # Constant: int, 0 + # BinaryOp: < + # ID: i + # Constant: int, 3 + # UnaryOp: p++ + # ID: i + # Pragma: omp critical + # Assignment: += + # ID: sum + # Constant: int, 1 + # + # This AST misleadingly takes the Pragma as the body of the loop and the + # assignment then becomes a sibling of the loop. + # + # To solve edge cases like these, the pragmacomp_or_statement rule groups + # a pragma and its following statement (which would otherwise be orphaned) + # using a compound block, effectively turning the above code into: + # + # for (int i = 0; i < 3; i++) { + # #pragma omp critical + # sum += 1; + # } + def p_pragmacomp_or_statement(self, p): + """ pragmacomp_or_statement : pppragma_directive statement + | statement + """ + if isinstance(p[1], c_ast.Pragma) and len(p) == 3: + p[0] = c_ast.Compound( + block_items=[p[1], p[2]], + coord=self._token_coord(p, 1)) + else: + p[0] = p[1] + + # In C, declarations can come several in a line: + # int x, *px, romulo = 5; + # + # However, for the AST, we will split them to separate Decl + # nodes. + # + # This rule splits its declarations and always returns a list + # of Decl nodes, even if it's one element long. + # + def p_decl_body(self, p): + """ decl_body : declaration_specifiers init_declarator_list_opt + | declaration_specifiers_no_type id_init_declarator_list_opt + """ + spec = p[1] + + # p[2] (init_declarator_list_opt) is either a list or None + # + if p[2] is None: + # By the standard, you must have at least one declarator unless + # declaring a structure tag, a union tag, or the members of an + # enumeration. + # + ty = spec['type'] + s_u_or_e = (c_ast.Struct, c_ast.Union, c_ast.Enum) + if len(ty) == 1 and isinstance(ty[0], s_u_or_e): + decls = [c_ast.Decl( + name=None, + quals=spec['qual'], + align=spec['alignment'], + storage=spec['storage'], + funcspec=spec['function'], + type=ty[0], + init=None, + bitsize=None, + coord=ty[0].coord)] + + # However, this case can also occur on redeclared identifiers in + # an inner scope. The trouble is that the redeclared type's name + # gets grouped into declaration_specifiers; _build_declarations + # compensates for this. + # + else: + decls = self._build_declarations( + spec=spec, + decls=[dict(decl=None, init=None)], + typedef_namespace=True) + + else: + decls = self._build_declarations( + spec=spec, + decls=p[2], + typedef_namespace=True) + + p[0] = decls + + # The declaration has been split to a decl_body sub-rule and + # SEMI, because having them in a single rule created a problem + # for defining typedefs. + # + # If a typedef line was directly followed by a line using the + # type defined with the typedef, the type would not be + # recognized. This is because to reduce the declaration rule, + # the parser's lookahead asked for the token after SEMI, which + # was the type from the next line, and the lexer had no chance + # to see the updated type symbol table. + # + # Splitting solves this problem, because after seeing SEMI, + # the parser reduces decl_body, which actually adds the new + # type into the table to be seen by the lexer before the next + # line is reached. + def p_declaration(self, p): + """ declaration : decl_body SEMI + """ + p[0] = p[1] + + # Since each declaration is a list of declarations, this + # rule will combine all the declarations and return a single + # list + # + def p_declaration_list(self, p): + """ declaration_list : declaration + | declaration_list declaration + """ + p[0] = p[1] if len(p) == 2 else p[1] + p[2] + + # To know when declaration-specifiers end and declarators begin, + # we require declaration-specifiers to have at least one + # type-specifier, and disallow typedef-names after we've seen any + # type-specifier. These are both required by the spec. + # + def p_declaration_specifiers_no_type_1(self, p): + """ declaration_specifiers_no_type : type_qualifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'qual') + + def p_declaration_specifiers_no_type_2(self, p): + """ declaration_specifiers_no_type : storage_class_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'storage') + + def p_declaration_specifiers_no_type_3(self, p): + """ declaration_specifiers_no_type : function_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'function') + + # Without this, `typedef _Atomic(T) U` will parse incorrectly because the + # _Atomic qualifier will match, instead of the specifier. + def p_declaration_specifiers_no_type_4(self, p): + """ declaration_specifiers_no_type : atomic_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'type') + + def p_declaration_specifiers_no_type_5(self, p): + """ declaration_specifiers_no_type : alignment_specifier declaration_specifiers_no_type_opt + """ + p[0] = self._add_declaration_specifier(p[2], p[1], 'alignment') + + def p_declaration_specifiers_1(self, p): + """ declaration_specifiers : declaration_specifiers type_qualifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'qual', append=True) + + def p_declaration_specifiers_2(self, p): + """ declaration_specifiers : declaration_specifiers storage_class_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'storage', append=True) + + def p_declaration_specifiers_3(self, p): + """ declaration_specifiers : declaration_specifiers function_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'function', append=True) + + def p_declaration_specifiers_4(self, p): + """ declaration_specifiers : declaration_specifiers type_specifier_no_typeid + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True) + + def p_declaration_specifiers_5(self, p): + """ declaration_specifiers : type_specifier + """ + p[0] = self._add_declaration_specifier(None, p[1], 'type') + + def p_declaration_specifiers_6(self, p): + """ declaration_specifiers : declaration_specifiers_no_type type_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True) + + def p_declaration_specifiers_7(self, p): + """ declaration_specifiers : declaration_specifiers alignment_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'alignment', append=True) + + def p_storage_class_specifier(self, p): + """ storage_class_specifier : AUTO + | REGISTER + | STATIC + | EXTERN + | TYPEDEF + | _THREAD_LOCAL + """ + p[0] = p[1] + + def p_function_specifier(self, p): + """ function_specifier : INLINE + | _NORETURN + """ + p[0] = p[1] + + def p_type_specifier_no_typeid(self, p): + """ type_specifier_no_typeid : VOID + | _BOOL + | CHAR + | SHORT + | INT + | LONG + | FLOAT + | DOUBLE + | _COMPLEX + | SIGNED + | UNSIGNED + | __INT128 + """ + p[0] = c_ast.IdentifierType([p[1]], coord=self._token_coord(p, 1)) + + def p_type_specifier(self, p): + """ type_specifier : typedef_name + | enum_specifier + | struct_or_union_specifier + | type_specifier_no_typeid + | atomic_specifier + """ + p[0] = p[1] + + # See section 6.7.2.4 of the C11 standard. + def p_atomic_specifier(self, p): + """ atomic_specifier : _ATOMIC LPAREN type_name RPAREN + """ + typ = p[3] + typ.quals.append('_Atomic') + p[0] = typ + + def p_type_qualifier(self, p): + """ type_qualifier : CONST + | RESTRICT + | VOLATILE + | _ATOMIC + """ + p[0] = p[1] + + def p_init_declarator_list(self, p): + """ init_declarator_list : init_declarator + | init_declarator_list COMMA init_declarator + """ + p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]] + + # Returns a {decl= : init=} dictionary + # If there's no initializer, uses None + # + def p_init_declarator(self, p): + """ init_declarator : declarator + | declarator EQUALS initializer + """ + p[0] = dict(decl=p[1], init=(p[3] if len(p) > 2 else None)) + + def p_id_init_declarator_list(self, p): + """ id_init_declarator_list : id_init_declarator + | id_init_declarator_list COMMA init_declarator + """ + p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]] + + def p_id_init_declarator(self, p): + """ id_init_declarator : id_declarator + | id_declarator EQUALS initializer + """ + p[0] = dict(decl=p[1], init=(p[3] if len(p) > 2 else None)) + + # Require at least one type specifier in a specifier-qualifier-list + # + def p_specifier_qualifier_list_1(self, p): + """ specifier_qualifier_list : specifier_qualifier_list type_specifier_no_typeid + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True) + + def p_specifier_qualifier_list_2(self, p): + """ specifier_qualifier_list : specifier_qualifier_list type_qualifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'qual', append=True) + + def p_specifier_qualifier_list_3(self, p): + """ specifier_qualifier_list : type_specifier + """ + p[0] = self._add_declaration_specifier(None, p[1], 'type') + + def p_specifier_qualifier_list_4(self, p): + """ specifier_qualifier_list : type_qualifier_list type_specifier + """ + p[0] = dict(qual=p[1], alignment=[], storage=[], type=[p[2]], function=[]) + + def p_specifier_qualifier_list_5(self, p): + """ specifier_qualifier_list : alignment_specifier + """ + p[0] = dict(qual=[], alignment=[p[1]], storage=[], type=[], function=[]) + + def p_specifier_qualifier_list_6(self, p): + """ specifier_qualifier_list : specifier_qualifier_list alignment_specifier + """ + p[0] = self._add_declaration_specifier(p[1], p[2], 'alignment') + + # TYPEID is allowed here (and in other struct/enum related tag names), because + # struct/enum tags reside in their own namespace and can be named the same as types + # + def p_struct_or_union_specifier_1(self, p): + """ struct_or_union_specifier : struct_or_union ID + | struct_or_union TYPEID + """ + klass = self._select_struct_union_class(p[1]) + # None means no list of members + p[0] = klass( + name=p[2], + decls=None, + coord=self._token_coord(p, 2)) + + def p_struct_or_union_specifier_2(self, p): + """ struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close + | struct_or_union brace_open brace_close + """ + klass = self._select_struct_union_class(p[1]) + if len(p) == 4: + # Empty sequence means an empty list of members + p[0] = klass( + name=None, + decls=[], + coord=self._token_coord(p, 2)) + else: + p[0] = klass( + name=None, + decls=p[3], + coord=self._token_coord(p, 2)) + + + def p_struct_or_union_specifier_3(self, p): + """ struct_or_union_specifier : struct_or_union ID brace_open struct_declaration_list brace_close + | struct_or_union ID brace_open brace_close + | struct_or_union TYPEID brace_open struct_declaration_list brace_close + | struct_or_union TYPEID brace_open brace_close + """ + klass = self._select_struct_union_class(p[1]) + if len(p) == 5: + # Empty sequence means an empty list of members + p[0] = klass( + name=p[2], + decls=[], + coord=self._token_coord(p, 2)) + else: + p[0] = klass( + name=p[2], + decls=p[4], + coord=self._token_coord(p, 2)) + + def p_struct_or_union(self, p): + """ struct_or_union : STRUCT + | UNION + """ + p[0] = p[1] + + # Combine all declarations into a single list + # + def p_struct_declaration_list(self, p): + """ struct_declaration_list : struct_declaration + | struct_declaration_list struct_declaration + """ + if len(p) == 2: + p[0] = p[1] or [] + else: + p[0] = p[1] + (p[2] or []) + + def p_struct_declaration_1(self, p): + """ struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI + """ + spec = p[1] + assert 'typedef' not in spec['storage'] + + if p[2] is not None: + decls = self._build_declarations( + spec=spec, + decls=p[2]) + + elif len(spec['type']) == 1: + # Anonymous struct/union, gcc extension, C1x feature. + # Although the standard only allows structs/unions here, I see no + # reason to disallow other types since some compilers have typedefs + # here, and pycparser isn't about rejecting all invalid code. + # + node = spec['type'][0] + if isinstance(node, c_ast.Node): + decl_type = node + else: + decl_type = c_ast.IdentifierType(node) + + decls = self._build_declarations( + spec=spec, + decls=[dict(decl=decl_type)]) + + else: + # Structure/union members can have the same names as typedefs. + # The trouble is that the member's name gets grouped into + # specifier_qualifier_list; _build_declarations compensates. + # + decls = self._build_declarations( + spec=spec, + decls=[dict(decl=None, init=None)]) + + p[0] = decls + + def p_struct_declaration_2(self, p): + """ struct_declaration : SEMI + """ + p[0] = None + + def p_struct_declaration_3(self, p): + """ struct_declaration : pppragma_directive + """ + p[0] = [p[1]] + + def p_struct_declarator_list(self, p): + """ struct_declarator_list : struct_declarator + | struct_declarator_list COMMA struct_declarator + """ + p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]] + + # struct_declarator passes up a dict with the keys: decl (for + # the underlying declarator) and bitsize (for the bitsize) + # + def p_struct_declarator_1(self, p): + """ struct_declarator : declarator + """ + p[0] = {'decl': p[1], 'bitsize': None} + + def p_struct_declarator_2(self, p): + """ struct_declarator : declarator COLON constant_expression + | COLON constant_expression + """ + if len(p) > 3: + p[0] = {'decl': p[1], 'bitsize': p[3]} + else: + p[0] = {'decl': c_ast.TypeDecl(None, None, None, None), 'bitsize': p[2]} + + def p_enum_specifier_1(self, p): + """ enum_specifier : ENUM ID + | ENUM TYPEID + """ + p[0] = c_ast.Enum(p[2], None, self._token_coord(p, 1)) + + def p_enum_specifier_2(self, p): + """ enum_specifier : ENUM brace_open enumerator_list brace_close + """ + p[0] = c_ast.Enum(None, p[3], self._token_coord(p, 1)) + + def p_enum_specifier_3(self, p): + """ enum_specifier : ENUM ID brace_open enumerator_list brace_close + | ENUM TYPEID brace_open enumerator_list brace_close + """ + p[0] = c_ast.Enum(p[2], p[4], self._token_coord(p, 1)) + + def p_enumerator_list(self, p): + """ enumerator_list : enumerator + | enumerator_list COMMA + | enumerator_list COMMA enumerator + """ + if len(p) == 2: + p[0] = c_ast.EnumeratorList([p[1]], p[1].coord) + elif len(p) == 3: + p[0] = p[1] + else: + p[1].enumerators.append(p[3]) + p[0] = p[1] + + def p_alignment_specifier(self, p): + """ alignment_specifier : _ALIGNAS LPAREN type_name RPAREN + | _ALIGNAS LPAREN constant_expression RPAREN + """ + p[0] = c_ast.Alignas(p[3], self._token_coord(p, 1)) + + def p_enumerator(self, p): + """ enumerator : ID + | ID EQUALS constant_expression + """ + if len(p) == 2: + enumerator = c_ast.Enumerator( + p[1], None, + self._token_coord(p, 1)) + else: + enumerator = c_ast.Enumerator( + p[1], p[3], + self._token_coord(p, 1)) + self._add_identifier(enumerator.name, enumerator.coord) + + p[0] = enumerator + + def p_declarator(self, p): + """ declarator : id_declarator + | typeid_declarator + """ + p[0] = p[1] + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_xxx_declarator_1(self, p): + """ xxx_declarator : direct_xxx_declarator + """ + p[0] = p[1] + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_xxx_declarator_2(self, p): + """ xxx_declarator : pointer direct_xxx_declarator + """ + p[0] = self._type_modify_decl(p[2], p[1]) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_1(self, p): + """ direct_xxx_declarator : yyy + """ + p[0] = c_ast.TypeDecl( + declname=p[1], + type=None, + quals=None, + align=None, + coord=self._token_coord(p, 1)) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID')) + def p_direct_xxx_declarator_2(self, p): + """ direct_xxx_declarator : LPAREN xxx_declarator RPAREN + """ + p[0] = p[2] + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_3(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET + """ + quals = (p[3] if len(p) > 5 else []) or [] + # Accept dimension qualifiers + # Per C99 6.7.5.3 p7 + arr = c_ast.ArrayDecl( + type=None, + dim=p[4] if len(p) > 5 else p[3], + dim_quals=quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_4(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET + | direct_xxx_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET + """ + # Using slice notation for PLY objects doesn't work in Python 3 for the + # version of PLY embedded with pycparser; see PLY Google Code issue 30. + # Work around that here by listing the two elements separately. + listed_quals = [item if isinstance(item, list) else [item] + for item in [p[3],p[4]]] + dim_quals = [qual for sublist in listed_quals for qual in sublist + if qual is not None] + arr = c_ast.ArrayDecl( + type=None, + dim=p[5], + dim_quals=dim_quals, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + # Special for VLAs + # + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_5(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET + """ + arr = c_ast.ArrayDecl( + type=None, + dim=c_ast.ID(p[4], self._token_coord(p, 4)), + dim_quals=p[3] if p[3] is not None else [], + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID')) + def p_direct_xxx_declarator_6(self, p): + """ direct_xxx_declarator : direct_xxx_declarator LPAREN parameter_type_list RPAREN + | direct_xxx_declarator LPAREN identifier_list_opt RPAREN + """ + func = c_ast.FuncDecl( + args=p[3], + type=None, + coord=p[1].coord) + + # To see why _get_yacc_lookahead_token is needed, consider: + # typedef char TT; + # void foo(int TT) { TT = 10; } + # Outside the function, TT is a typedef, but inside (starting and + # ending with the braces) it's a parameter. The trouble begins with + # yacc's lookahead token. We don't know if we're declaring or + # defining a function until we see LBRACE, but if we wait for yacc to + # trigger a rule on that token, then TT will have already been read + # and incorrectly interpreted as TYPEID. We need to add the + # parameters to the scope the moment the lexer sees LBRACE. + # + if self._get_yacc_lookahead_token().type == "LBRACE": + if func.args is not None: + for param in func.args.params: + if isinstance(param, c_ast.EllipsisParam): break + self._add_identifier(param.name, param.coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=func) + + def p_pointer(self, p): + """ pointer : TIMES type_qualifier_list_opt + | TIMES type_qualifier_list_opt pointer + """ + coord = self._token_coord(p, 1) + # Pointer decls nest from inside out. This is important when different + # levels have different qualifiers. For example: + # + # char * const * p; + # + # Means "pointer to const pointer to char" + # + # While: + # + # char ** const p; + # + # Means "const pointer to pointer to char" + # + # So when we construct PtrDecl nestings, the leftmost pointer goes in + # as the most nested type. + nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord) + if len(p) > 3: + tail_type = p[3] + while tail_type.type is not None: + tail_type = tail_type.type + tail_type.type = nested_type + p[0] = p[3] + else: + p[0] = nested_type + + def p_type_qualifier_list(self, p): + """ type_qualifier_list : type_qualifier + | type_qualifier_list type_qualifier + """ + p[0] = [p[1]] if len(p) == 2 else p[1] + [p[2]] + + def p_parameter_type_list(self, p): + """ parameter_type_list : parameter_list + | parameter_list COMMA ELLIPSIS + """ + if len(p) > 2: + p[1].params.append(c_ast.EllipsisParam(self._token_coord(p, 3))) + + p[0] = p[1] + + def p_parameter_list(self, p): + """ parameter_list : parameter_declaration + | parameter_list COMMA parameter_declaration + """ + if len(p) == 2: # single parameter + p[0] = c_ast.ParamList([p[1]], p[1].coord) + else: + p[1].params.append(p[3]) + p[0] = p[1] + + # From ISO/IEC 9899:TC2, 6.7.5.3.11: + # "If, in a parameter declaration, an identifier can be treated either + # as a typedef name or as a parameter name, it shall be taken as a + # typedef name." + # + # Inside a parameter declaration, once we've reduced declaration specifiers, + # if we shift in an LPAREN and see a TYPEID, it could be either an abstract + # declarator or a declarator nested inside parens. This rule tells us to + # always treat it as an abstract declarator. Therefore, we only accept + # `id_declarator`s and `typeid_noparen_declarator`s. + def p_parameter_declaration_1(self, p): + """ parameter_declaration : declaration_specifiers id_declarator + | declaration_specifiers typeid_noparen_declarator + """ + spec = p[1] + if not spec['type']: + spec['type'] = [c_ast.IdentifierType(['int'], + coord=self._token_coord(p, 1))] + p[0] = self._build_declarations( + spec=spec, + decls=[dict(decl=p[2])])[0] + + def p_parameter_declaration_2(self, p): + """ parameter_declaration : declaration_specifiers abstract_declarator_opt + """ + spec = p[1] + if not spec['type']: + spec['type'] = [c_ast.IdentifierType(['int'], + coord=self._token_coord(p, 1))] + + # Parameters can have the same names as typedefs. The trouble is that + # the parameter's name gets grouped into declaration_specifiers, making + # it look like an old-style declaration; compensate. + # + if len(spec['type']) > 1 and len(spec['type'][-1].names) == 1 and \ + self._is_type_in_scope(spec['type'][-1].names[0]): + decl = self._build_declarations( + spec=spec, + decls=[dict(decl=p[2], init=None)])[0] + + # This truly is an old-style parameter declaration + # + else: + decl = c_ast.Typename( + name='', + quals=spec['qual'], + align=None, + type=p[2] or c_ast.TypeDecl(None, None, None, None), + coord=self._token_coord(p, 2)) + typename = spec['type'] + decl = self._fix_decl_name_type(decl, typename) + + p[0] = decl + + def p_identifier_list(self, p): + """ identifier_list : identifier + | identifier_list COMMA identifier + """ + if len(p) == 2: # single parameter + p[0] = c_ast.ParamList([p[1]], p[1].coord) + else: + p[1].params.append(p[3]) + p[0] = p[1] + + def p_initializer_1(self, p): + """ initializer : assignment_expression + """ + p[0] = p[1] + + def p_initializer_2(self, p): + """ initializer : brace_open initializer_list_opt brace_close + | brace_open initializer_list COMMA brace_close + """ + if p[2] is None: + p[0] = c_ast.InitList([], self._token_coord(p, 1)) + else: + p[0] = p[2] + + def p_initializer_list(self, p): + """ initializer_list : designation_opt initializer + | initializer_list COMMA designation_opt initializer + """ + if len(p) == 3: # single initializer + init = p[2] if p[1] is None else c_ast.NamedInitializer(p[1], p[2]) + p[0] = c_ast.InitList([init], p[2].coord) + else: + init = p[4] if p[3] is None else c_ast.NamedInitializer(p[3], p[4]) + p[1].exprs.append(init) + p[0] = p[1] + + def p_designation(self, p): + """ designation : designator_list EQUALS + """ + p[0] = p[1] + + # Designators are represented as a list of nodes, in the order in which + # they're written in the code. + # + def p_designator_list(self, p): + """ designator_list : designator + | designator_list designator + """ + p[0] = [p[1]] if len(p) == 2 else p[1] + [p[2]] + + def p_designator(self, p): + """ designator : LBRACKET constant_expression RBRACKET + | PERIOD identifier + """ + p[0] = p[2] + + def p_type_name(self, p): + """ type_name : specifier_qualifier_list abstract_declarator_opt + """ + typename = c_ast.Typename( + name='', + quals=p[1]['qual'][:], + align=None, + type=p[2] or c_ast.TypeDecl(None, None, None, None), + coord=self._token_coord(p, 2)) + + p[0] = self._fix_decl_name_type(typename, p[1]['type']) + + def p_abstract_declarator_1(self, p): + """ abstract_declarator : pointer + """ + dummytype = c_ast.TypeDecl(None, None, None, None) + p[0] = self._type_modify_decl( + decl=dummytype, + modifier=p[1]) + + def p_abstract_declarator_2(self, p): + """ abstract_declarator : pointer direct_abstract_declarator + """ + p[0] = self._type_modify_decl(p[2], p[1]) + + def p_abstract_declarator_3(self, p): + """ abstract_declarator : direct_abstract_declarator + """ + p[0] = p[1] + + # Creating and using direct_abstract_declarator_opt here + # instead of listing both direct_abstract_declarator and the + # lack of it in the beginning of _1 and _2 caused two + # shift/reduce errors. + # + def p_direct_abstract_declarator_1(self, p): + """ direct_abstract_declarator : LPAREN abstract_declarator RPAREN """ + p[0] = p[2] + + def p_direct_abstract_declarator_2(self, p): + """ direct_abstract_declarator : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET + """ + arr = c_ast.ArrayDecl( + type=None, + dim=p[3], + dim_quals=[], + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_abstract_declarator_3(self, p): + """ direct_abstract_declarator : LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET + """ + quals = (p[2] if len(p) > 4 else []) or [] + p[0] = c_ast.ArrayDecl( + type=c_ast.TypeDecl(None, None, None, None), + dim=p[3] if len(p) > 4 else p[2], + dim_quals=quals, + coord=self._token_coord(p, 1)) + + def p_direct_abstract_declarator_4(self, p): + """ direct_abstract_declarator : direct_abstract_declarator LBRACKET TIMES RBRACKET + """ + arr = c_ast.ArrayDecl( + type=None, + dim=c_ast.ID(p[3], self._token_coord(p, 3)), + dim_quals=[], + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=arr) + + def p_direct_abstract_declarator_5(self, p): + """ direct_abstract_declarator : LBRACKET TIMES RBRACKET + """ + p[0] = c_ast.ArrayDecl( + type=c_ast.TypeDecl(None, None, None, None), + dim=c_ast.ID(p[3], self._token_coord(p, 3)), + dim_quals=[], + coord=self._token_coord(p, 1)) + + def p_direct_abstract_declarator_6(self, p): + """ direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN + """ + func = c_ast.FuncDecl( + args=p[3], + type=None, + coord=p[1].coord) + + p[0] = self._type_modify_decl(decl=p[1], modifier=func) + + def p_direct_abstract_declarator_7(self, p): + """ direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN + """ + p[0] = c_ast.FuncDecl( + args=p[2], + type=c_ast.TypeDecl(None, None, None, None), + coord=self._token_coord(p, 1)) + + # declaration is a list, statement isn't. To make it consistent, block_item + # will always be a list + # + def p_block_item(self, p): + """ block_item : declaration + | statement + """ + p[0] = p[1] if isinstance(p[1], list) else [p[1]] + + # Since we made block_item a list, this just combines lists + # + def p_block_item_list(self, p): + """ block_item_list : block_item + | block_item_list block_item + """ + # Empty block items (plain ';') produce [None], so ignore them + p[0] = p[1] if (len(p) == 2 or p[2] == [None]) else p[1] + p[2] + + def p_compound_statement_1(self, p): + """ compound_statement : brace_open block_item_list_opt brace_close """ + p[0] = c_ast.Compound( + block_items=p[2], + coord=self._token_coord(p, 1)) + + def p_labeled_statement_1(self, p): + """ labeled_statement : ID COLON pragmacomp_or_statement """ + p[0] = c_ast.Label(p[1], p[3], self._token_coord(p, 1)) + + def p_labeled_statement_2(self, p): + """ labeled_statement : CASE constant_expression COLON pragmacomp_or_statement """ + p[0] = c_ast.Case(p[2], [p[4]], self._token_coord(p, 1)) + + def p_labeled_statement_3(self, p): + """ labeled_statement : DEFAULT COLON pragmacomp_or_statement """ + p[0] = c_ast.Default([p[3]], self._token_coord(p, 1)) + + def p_selection_statement_1(self, p): + """ selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement """ + p[0] = c_ast.If(p[3], p[5], None, self._token_coord(p, 1)) + + def p_selection_statement_2(self, p): + """ selection_statement : IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement """ + p[0] = c_ast.If(p[3], p[5], p[7], self._token_coord(p, 1)) + + def p_selection_statement_3(self, p): + """ selection_statement : SWITCH LPAREN expression RPAREN pragmacomp_or_statement """ + p[0] = fix_switch_cases( + c_ast.Switch(p[3], p[5], self._token_coord(p, 1))) + + def p_iteration_statement_1(self, p): + """ iteration_statement : WHILE LPAREN expression RPAREN pragmacomp_or_statement """ + p[0] = c_ast.While(p[3], p[5], self._token_coord(p, 1)) + + def p_iteration_statement_2(self, p): + """ iteration_statement : DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI """ + p[0] = c_ast.DoWhile(p[5], p[2], self._token_coord(p, 1)) + + def p_iteration_statement_3(self, p): + """ iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement """ + p[0] = c_ast.For(p[3], p[5], p[7], p[9], self._token_coord(p, 1)) + + def p_iteration_statement_4(self, p): + """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement """ + p[0] = c_ast.For(c_ast.DeclList(p[3], self._token_coord(p, 1)), + p[4], p[6], p[8], self._token_coord(p, 1)) + + def p_jump_statement_1(self, p): + """ jump_statement : GOTO ID SEMI """ + p[0] = c_ast.Goto(p[2], self._token_coord(p, 1)) + + def p_jump_statement_2(self, p): + """ jump_statement : BREAK SEMI """ + p[0] = c_ast.Break(self._token_coord(p, 1)) + + def p_jump_statement_3(self, p): + """ jump_statement : CONTINUE SEMI """ + p[0] = c_ast.Continue(self._token_coord(p, 1)) + + def p_jump_statement_4(self, p): + """ jump_statement : RETURN expression SEMI + | RETURN SEMI + """ + p[0] = c_ast.Return(p[2] if len(p) == 4 else None, self._token_coord(p, 1)) + + def p_expression_statement(self, p): + """ expression_statement : expression_opt SEMI """ + if p[1] is None: + p[0] = c_ast.EmptyStatement(self._token_coord(p, 2)) + else: + p[0] = p[1] + + def p_expression(self, p): + """ expression : assignment_expression + | expression COMMA assignment_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + if not isinstance(p[1], c_ast.ExprList): + p[1] = c_ast.ExprList([p[1]], p[1].coord) + + p[1].exprs.append(p[3]) + p[0] = p[1] + + def p_parenthesized_compound_expression(self, p): + """ assignment_expression : LPAREN compound_statement RPAREN """ + p[0] = p[2] + + def p_typedef_name(self, p): + """ typedef_name : TYPEID """ + p[0] = c_ast.IdentifierType([p[1]], coord=self._token_coord(p, 1)) + + def p_assignment_expression(self, p): + """ assignment_expression : conditional_expression + | unary_expression assignment_operator assignment_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + p[0] = c_ast.Assignment(p[2], p[1], p[3], p[1].coord) + + # K&R2 defines these as many separate rules, to encode + # precedence and associativity. Why work hard ? I'll just use + # the built in precedence/associativity specification feature + # of PLY. (see precedence declaration above) + # + def p_assignment_operator(self, p): + """ assignment_operator : EQUALS + | XOREQUAL + | TIMESEQUAL + | DIVEQUAL + | MODEQUAL + | PLUSEQUAL + | MINUSEQUAL + | LSHIFTEQUAL + | RSHIFTEQUAL + | ANDEQUAL + | OREQUAL + """ + p[0] = p[1] + + def p_constant_expression(self, p): + """ constant_expression : conditional_expression """ + p[0] = p[1] + + def p_conditional_expression(self, p): + """ conditional_expression : binary_expression + | binary_expression CONDOP expression COLON conditional_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + p[0] = c_ast.TernaryOp(p[1], p[3], p[5], p[1].coord) + + def p_binary_expression(self, p): + """ binary_expression : cast_expression + | binary_expression TIMES binary_expression + | binary_expression DIVIDE binary_expression + | binary_expression MOD binary_expression + | binary_expression PLUS binary_expression + | binary_expression MINUS binary_expression + | binary_expression RSHIFT binary_expression + | binary_expression LSHIFT binary_expression + | binary_expression LT binary_expression + | binary_expression LE binary_expression + | binary_expression GE binary_expression + | binary_expression GT binary_expression + | binary_expression EQ binary_expression + | binary_expression NE binary_expression + | binary_expression AND binary_expression + | binary_expression OR binary_expression + | binary_expression XOR binary_expression + | binary_expression LAND binary_expression + | binary_expression LOR binary_expression + """ + if len(p) == 2: + p[0] = p[1] + else: + p[0] = c_ast.BinaryOp(p[2], p[1], p[3], p[1].coord) + + def p_cast_expression_1(self, p): + """ cast_expression : unary_expression """ + p[0] = p[1] + + def p_cast_expression_2(self, p): + """ cast_expression : LPAREN type_name RPAREN cast_expression """ + p[0] = c_ast.Cast(p[2], p[4], self._token_coord(p, 1)) + + def p_unary_expression_1(self, p): + """ unary_expression : postfix_expression """ + p[0] = p[1] + + def p_unary_expression_2(self, p): + """ unary_expression : PLUSPLUS unary_expression + | MINUSMINUS unary_expression + | unary_operator cast_expression + """ + p[0] = c_ast.UnaryOp(p[1], p[2], p[2].coord) + + def p_unary_expression_3(self, p): + """ unary_expression : SIZEOF unary_expression + | SIZEOF LPAREN type_name RPAREN + | _ALIGNOF LPAREN type_name RPAREN + """ + p[0] = c_ast.UnaryOp( + p[1], + p[2] if len(p) == 3 else p[3], + self._token_coord(p, 1)) + + def p_unary_operator(self, p): + """ unary_operator : AND + | TIMES + | PLUS + | MINUS + | NOT + | LNOT + """ + p[0] = p[1] + + def p_postfix_expression_1(self, p): + """ postfix_expression : primary_expression """ + p[0] = p[1] + + def p_postfix_expression_2(self, p): + """ postfix_expression : postfix_expression LBRACKET expression RBRACKET """ + p[0] = c_ast.ArrayRef(p[1], p[3], p[1].coord) + + def p_postfix_expression_3(self, p): + """ postfix_expression : postfix_expression LPAREN argument_expression_list RPAREN + | postfix_expression LPAREN RPAREN + """ + p[0] = c_ast.FuncCall(p[1], p[3] if len(p) == 5 else None, p[1].coord) + + def p_postfix_expression_4(self, p): + """ postfix_expression : postfix_expression PERIOD ID + | postfix_expression PERIOD TYPEID + | postfix_expression ARROW ID + | postfix_expression ARROW TYPEID + """ + field = c_ast.ID(p[3], self._token_coord(p, 3)) + p[0] = c_ast.StructRef(p[1], p[2], field, p[1].coord) + + def p_postfix_expression_5(self, p): + """ postfix_expression : postfix_expression PLUSPLUS + | postfix_expression MINUSMINUS + """ + p[0] = c_ast.UnaryOp('p' + p[2], p[1], p[1].coord) + + def p_postfix_expression_6(self, p): + """ postfix_expression : LPAREN type_name RPAREN brace_open initializer_list brace_close + | LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close + """ + p[0] = c_ast.CompoundLiteral(p[2], p[5]) + + def p_primary_expression_1(self, p): + """ primary_expression : identifier """ + p[0] = p[1] + + def p_primary_expression_2(self, p): + """ primary_expression : constant """ + p[0] = p[1] + + def p_primary_expression_3(self, p): + """ primary_expression : unified_string_literal + | unified_wstring_literal + """ + p[0] = p[1] + + def p_primary_expression_4(self, p): + """ primary_expression : LPAREN expression RPAREN """ + p[0] = p[2] + + def p_primary_expression_5(self, p): + """ primary_expression : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN + """ + coord = self._token_coord(p, 1) + p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord), + c_ast.ExprList([p[3], p[5]], coord), + coord) + + def p_offsetof_member_designator(self, p): + """ offsetof_member_designator : identifier + | offsetof_member_designator PERIOD identifier + | offsetof_member_designator LBRACKET expression RBRACKET + """ + if len(p) == 2: + p[0] = p[1] + elif len(p) == 4: + p[0] = c_ast.StructRef(p[1], p[2], p[3], p[1].coord) + elif len(p) == 5: + p[0] = c_ast.ArrayRef(p[1], p[3], p[1].coord) + else: + raise NotImplementedError("Unexpected parsing state. len(p): %u" % len(p)) + + def p_argument_expression_list(self, p): + """ argument_expression_list : assignment_expression + | argument_expression_list COMMA assignment_expression + """ + if len(p) == 2: # single expr + p[0] = c_ast.ExprList([p[1]], p[1].coord) + else: + p[1].exprs.append(p[3]) + p[0] = p[1] + + def p_identifier(self, p): + """ identifier : ID """ + p[0] = c_ast.ID(p[1], self._token_coord(p, 1)) + + def p_constant_1(self, p): + """ constant : INT_CONST_DEC + | INT_CONST_OCT + | INT_CONST_HEX + | INT_CONST_BIN + | INT_CONST_CHAR + """ + uCount = 0 + lCount = 0 + for x in p[1][-3:]: + if x in ('l', 'L'): + lCount += 1 + elif x in ('u', 'U'): + uCount += 1 + t = '' + if uCount > 1: + raise ValueError('Constant cannot have more than one u/U suffix.') + elif lCount > 2: + raise ValueError('Constant cannot have more than two l/L suffix.') + prefix = 'unsigned ' * uCount + 'long ' * lCount + p[0] = c_ast.Constant( + prefix + 'int', p[1], self._token_coord(p, 1)) + + def p_constant_2(self, p): + """ constant : FLOAT_CONST + | HEX_FLOAT_CONST + """ + if 'x' in p[1].lower(): + t = 'float' + else: + if p[1][-1] in ('f', 'F'): + t = 'float' + elif p[1][-1] in ('l', 'L'): + t = 'long double' + else: + t = 'double' + + p[0] = c_ast.Constant( + t, p[1], self._token_coord(p, 1)) + + def p_constant_3(self, p): + """ constant : CHAR_CONST + | WCHAR_CONST + | U8CHAR_CONST + | U16CHAR_CONST + | U32CHAR_CONST + """ + p[0] = c_ast.Constant( + 'char', p[1], self._token_coord(p, 1)) + + # The "unified" string and wstring literal rules are for supporting + # concatenation of adjacent string literals. + # I.e. "hello " "world" is seen by the C compiler as a single string literal + # with the value "hello world" + # + def p_unified_string_literal(self, p): + """ unified_string_literal : STRING_LITERAL + | unified_string_literal STRING_LITERAL + """ + if len(p) == 2: # single literal + p[0] = c_ast.Constant( + 'string', p[1], self._token_coord(p, 1)) + else: + p[1].value = p[1].value[:-1] + p[2][1:] + p[0] = p[1] + + def p_unified_wstring_literal(self, p): + """ unified_wstring_literal : WSTRING_LITERAL + | U8STRING_LITERAL + | U16STRING_LITERAL + | U32STRING_LITERAL + | unified_wstring_literal WSTRING_LITERAL + | unified_wstring_literal U8STRING_LITERAL + | unified_wstring_literal U16STRING_LITERAL + | unified_wstring_literal U32STRING_LITERAL + """ + if len(p) == 2: # single literal + p[0] = c_ast.Constant( + 'string', p[1], self._token_coord(p, 1)) + else: + p[1].value = p[1].value.rstrip()[:-1] + p[2][2:] + p[0] = p[1] + + def p_brace_open(self, p): + """ brace_open : LBRACE + """ + p[0] = p[1] + p.set_lineno(0, p.lineno(1)) + + def p_brace_close(self, p): + """ brace_close : RBRACE + """ + p[0] = p[1] + p.set_lineno(0, p.lineno(1)) + + def p_empty(self, p): + 'empty : ' + p[0] = None + + def p_error(self, p): + # If error recovery is added here in the future, make sure + # _get_yacc_lookahead_token still works! + # + if p: + self._parse_error( + 'before: %s' % p.value, + self._coord(lineno=p.lineno, + column=self.clex.find_tok_column(p))) + else: + self._parse_error('At end of input', self.clex.filename) diff --git a/jwt/python/pycparser/lextab.py b/jwt/python/pycparser/lextab.py new file mode 100644 index 0000000..444b465 --- /dev/null +++ b/jwt/python/pycparser/lextab.py @@ -0,0 +1,10 @@ +# lextab.py. This file automatically created by PLY (version 3.10). Don't edit! +_tabversion = '3.10' +_lextokens = set(('INT_CONST_CHAR', 'VOID', 'LBRACKET', 'WCHAR_CONST', 'FLOAT_CONST', 'MINUS', 'RPAREN', 'STRUCT', 'LONG', 'PLUS', 'ELLIPSIS', 'U32STRING_LITERAL', 'GT', 'GOTO', 'ENUM', 'PERIOD', 'GE', 'INT_CONST_DEC', 'ARROW', '_STATIC_ASSERT', '__INT128', 'HEX_FLOAT_CONST', 'DOUBLE', 'MINUSEQUAL', 'INT_CONST_OCT', 'TIMESEQUAL', 'OR', 'SHORT', 'RETURN', 'RSHIFTEQUAL', '_ALIGNAS', 'RESTRICT', 'STATIC', 'SIZEOF', 'UNSIGNED', 'PLUSPLUS', 'COLON', 'WSTRING_LITERAL', 'DIVIDE', 'FOR', 'UNION', 'EQUALS', 'ELSE', 'ANDEQUAL', 'EQ', 'AND', 'TYPEID', 'LBRACE', 'PPHASH', 'INT', 'SIGNED', 'CONTINUE', 'NOT', 'OREQUAL', 'MOD', 'RSHIFT', 'DEFAULT', '_NORETURN', 'CHAR', 'WHILE', 'DIVEQUAL', '_ALIGNOF', 'EXTERN', 'LNOT', 'CASE', 'LAND', 'REGISTER', 'MODEQUAL', 'NE', 'SWITCH', 'INT_CONST_HEX', '_COMPLEX', 'PPPRAGMASTR', 'PLUSEQUAL', 'U32CHAR_CONST', 'CONDOP', 'U8STRING_LITERAL', 'BREAK', 'VOLATILE', 'PPPRAGMA', 'INLINE', 'INT_CONST_BIN', 'DO', 'U8CHAR_CONST', 'CONST', 'U16STRING_LITERAL', 'LOR', 'CHAR_CONST', 'LSHIFT', 'RBRACE', '_BOOL', 'LE', 'SEMI', '_THREAD_LOCAL', 'LT', 'COMMA', 'U16CHAR_CONST', 'OFFSETOF', '_ATOMIC', 'TYPEDEF', 'XOR', 'AUTO', 'TIMES', 'LPAREN', 'MINUSMINUS', 'ID', 'IF', 'STRING_LITERAL', 'FLOAT', 'XOREQUAL', 'LSHIFTEQUAL', 'RBRACKET')) +_lexreflags = 64 +_lexliterals = '' +_lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'} +_lexstatere = {'ppline': [('(?P"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\\n)|(?Pline)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P\\n)|(?Ppragma)|(?P.+)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR')])], 'INITIAL': [('(?P[ \\t]*\\#)|(?P\\n+)|(?P\\{)|(?P\\})|(?P((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX'), None, None, None, None, None, None, None, ('t_INT_CONST_BIN', 'INT_CONST_BIN')]), ('(?P0[0-7]*[89])|(?P0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F])))){2,4}\')|(?P\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?PL\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?Pu8\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?Pu\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?PU\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_INT_CONST_CHAR', 'INT_CONST_CHAR'), None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_U8CHAR_CONST', 'U8CHAR_CONST'), None, None, None, None, None, None, ('t_U16CHAR_CONST', 'U16CHAR_CONST'), None, None, None, None, None, None, ('t_U32CHAR_CONST', 'U32CHAR_CONST')]), ('(?P(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*$))|(?P(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])[^\'\\n]*\'))|(?PL"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?Pu8"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?Pu"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?PU"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P\\.\\.\\.)|(?P\\+\\+)|(?P\\|\\|)|(?P\\^=)|(?P\\|=)|(?P<<=)|(?P>>=)|(?P\\+=)|(?P\\*=)', [None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, ('t_U8STRING_LITERAL', 'U8STRING_LITERAL'), None, None, ('t_U16STRING_LITERAL', 'U16STRING_LITERAL'), None, None, ('t_U32STRING_LITERAL', 'U32STRING_LITERAL'), None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL')]), ('(?P\\+)|(?P%=)|(?P/=)|(?P\\])|(?P\\?)|(?P\\^)|(?P<<)|(?P<=)|(?P\\()|(?P->)|(?P==)|(?P!=)|(?P--)|(?P\\|)|(?P\\*)|(?P\\[)|(?P>=)|(?P\\))|(?P&&)|(?P>>)|(?P-=)|(?P\\.)|(?P&=)|(?P=)|(?P<)|(?P,)|(?P/)|(?P&)|(?P%)|(?P;)|(?P-)|(?P>)|(?P:)|(?P~)|(?P!)', [None, (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]} +_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t', 'INITIAL': ' \t'} +_lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'} +_lexstateeoff = {} diff --git a/jwt/python/pycparser/ply/__init__.py b/jwt/python/pycparser/ply/__init__.py new file mode 100644 index 0000000..6e53cdd --- /dev/null +++ b/jwt/python/pycparser/ply/__init__.py @@ -0,0 +1,5 @@ +# PLY package +# Author: David Beazley (dave@dabeaz.com) + +__version__ = '3.9' +__all__ = ['lex','yacc'] diff --git a/jwt/python/pycparser/ply/__pycache__/__init__.cpython-311.pyc b/jwt/python/pycparser/ply/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..0ebdac1 Binary files /dev/null and b/jwt/python/pycparser/ply/__pycache__/__init__.cpython-311.pyc differ diff --git a/jwt/python/pycparser/ply/__pycache__/cpp.cpython-311.pyc b/jwt/python/pycparser/ply/__pycache__/cpp.cpython-311.pyc new file mode 100644 index 0000000..28f4f3e Binary files /dev/null and b/jwt/python/pycparser/ply/__pycache__/cpp.cpython-311.pyc differ diff --git a/jwt/python/pycparser/ply/__pycache__/ctokens.cpython-311.pyc b/jwt/python/pycparser/ply/__pycache__/ctokens.cpython-311.pyc new file mode 100644 index 0000000..08f64a8 Binary files /dev/null and b/jwt/python/pycparser/ply/__pycache__/ctokens.cpython-311.pyc differ diff --git a/jwt/python/pycparser/ply/__pycache__/lex.cpython-311.pyc b/jwt/python/pycparser/ply/__pycache__/lex.cpython-311.pyc new file mode 100644 index 0000000..b4e8537 Binary files /dev/null and b/jwt/python/pycparser/ply/__pycache__/lex.cpython-311.pyc differ diff --git a/jwt/python/pycparser/ply/__pycache__/yacc.cpython-311.pyc b/jwt/python/pycparser/ply/__pycache__/yacc.cpython-311.pyc new file mode 100644 index 0000000..eadaca8 Binary files /dev/null and b/jwt/python/pycparser/ply/__pycache__/yacc.cpython-311.pyc differ diff --git a/jwt/python/pycparser/ply/__pycache__/ygen.cpython-311.pyc b/jwt/python/pycparser/ply/__pycache__/ygen.cpython-311.pyc new file mode 100644 index 0000000..4427edf Binary files /dev/null and b/jwt/python/pycparser/ply/__pycache__/ygen.cpython-311.pyc differ diff --git a/jwt/python/pycparser/ply/cpp.py b/jwt/python/pycparser/ply/cpp.py new file mode 100644 index 0000000..86273ea --- /dev/null +++ b/jwt/python/pycparser/ply/cpp.py @@ -0,0 +1,905 @@ +# ----------------------------------------------------------------------------- +# cpp.py +# +# Author: David Beazley (http://www.dabeaz.com) +# Copyright (C) 2017 +# All rights reserved +# +# This module implements an ANSI-C style lexical preprocessor for PLY. +# ----------------------------------------------------------------------------- +import sys + +# Some Python 3 compatibility shims +if sys.version_info.major < 3: + STRING_TYPES = (str, unicode) +else: + STRING_TYPES = str + xrange = range + +# ----------------------------------------------------------------------------- +# Default preprocessor lexer definitions. These tokens are enough to get +# a basic preprocessor working. Other modules may import these if they want +# ----------------------------------------------------------------------------- + +tokens = ( + 'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT1', 'CPP_COMMENT2', 'CPP_POUND','CPP_DPOUND' +) + +literals = "+-*/%|&~^<>=!?()[]{}.,;:\\\'\"" + +# Whitespace +def t_CPP_WS(t): + r'\s+' + t.lexer.lineno += t.value.count("\n") + return t + +t_CPP_POUND = r'\#' +t_CPP_DPOUND = r'\#\#' + +# Identifier +t_CPP_ID = r'[A-Za-z_][\w_]*' + +# Integer literal +def CPP_INTEGER(t): + r'(((((0x)|(0X))[0-9a-fA-F]+)|(\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)' + return t + +t_CPP_INTEGER = CPP_INTEGER + +# Floating literal +t_CPP_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' + +# String literal +def t_CPP_STRING(t): + r'\"([^\\\n]|(\\(.|\n)))*?\"' + t.lexer.lineno += t.value.count("\n") + return t + +# Character constant 'c' or L'c' +def t_CPP_CHAR(t): + r'(L)?\'([^\\\n]|(\\(.|\n)))*?\'' + t.lexer.lineno += t.value.count("\n") + return t + +# Comment +def t_CPP_COMMENT1(t): + r'(/\*(.|\n)*?\*/)' + ncr = t.value.count("\n") + t.lexer.lineno += ncr + # replace with one space or a number of '\n' + t.type = 'CPP_WS'; t.value = '\n' * ncr if ncr else ' ' + return t + +# Line comment +def t_CPP_COMMENT2(t): + r'(//.*?(\n|$))' + # replace with '/n' + t.type = 'CPP_WS'; t.value = '\n' + return t + +def t_error(t): + t.type = t.value[0] + t.value = t.value[0] + t.lexer.skip(1) + return t + +import re +import copy +import time +import os.path + +# ----------------------------------------------------------------------------- +# trigraph() +# +# Given an input string, this function replaces all trigraph sequences. +# The following mapping is used: +# +# ??= # +# ??/ \ +# ??' ^ +# ??( [ +# ??) ] +# ??! | +# ??< { +# ??> } +# ??- ~ +# ----------------------------------------------------------------------------- + +_trigraph_pat = re.compile(r'''\?\?[=/\'\(\)\!<>\-]''') +_trigraph_rep = { + '=':'#', + '/':'\\', + "'":'^', + '(':'[', + ')':']', + '!':'|', + '<':'{', + '>':'}', + '-':'~' +} + +def trigraph(input): + return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input) + +# ------------------------------------------------------------------ +# Macro object +# +# This object holds information about preprocessor macros +# +# .name - Macro name (string) +# .value - Macro value (a list of tokens) +# .arglist - List of argument names +# .variadic - Boolean indicating whether or not variadic macro +# .vararg - Name of the variadic parameter +# +# When a macro is created, the macro replacement token sequence is +# pre-scanned and used to create patch lists that are later used +# during macro expansion +# ------------------------------------------------------------------ + +class Macro(object): + def __init__(self,name,value,arglist=None,variadic=False): + self.name = name + self.value = value + self.arglist = arglist + self.variadic = variadic + if variadic: + self.vararg = arglist[-1] + self.source = None + +# ------------------------------------------------------------------ +# Preprocessor object +# +# Object representing a preprocessor. Contains macro definitions, +# include directories, and other information +# ------------------------------------------------------------------ + +class Preprocessor(object): + def __init__(self,lexer=None): + if lexer is None: + lexer = lex.lexer + self.lexer = lexer + self.macros = { } + self.path = [] + self.temp_path = [] + + # Probe the lexer for selected tokens + self.lexprobe() + + tm = time.localtime() + self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm)) + self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm)) + self.parser = None + + # ----------------------------------------------------------------------------- + # tokenize() + # + # Utility function. Given a string of text, tokenize into a list of tokens + # ----------------------------------------------------------------------------- + + def tokenize(self,text): + tokens = [] + self.lexer.input(text) + while True: + tok = self.lexer.token() + if not tok: break + tokens.append(tok) + return tokens + + # --------------------------------------------------------------------- + # error() + # + # Report a preprocessor error/warning of some kind + # ---------------------------------------------------------------------- + + def error(self,file,line,msg): + print("%s:%d %s" % (file,line,msg)) + + # ---------------------------------------------------------------------- + # lexprobe() + # + # This method probes the preprocessor lexer object to discover + # the token types of symbols that are important to the preprocessor. + # If this works right, the preprocessor will simply "work" + # with any suitable lexer regardless of how tokens have been named. + # ---------------------------------------------------------------------- + + def lexprobe(self): + + # Determine the token type for identifiers + self.lexer.input("identifier") + tok = self.lexer.token() + if not tok or tok.value != "identifier": + print("Couldn't determine identifier type") + else: + self.t_ID = tok.type + + # Determine the token type for integers + self.lexer.input("12345") + tok = self.lexer.token() + if not tok or int(tok.value) != 12345: + print("Couldn't determine integer type") + else: + self.t_INTEGER = tok.type + self.t_INTEGER_TYPE = type(tok.value) + + # Determine the token type for strings enclosed in double quotes + self.lexer.input("\"filename\"") + tok = self.lexer.token() + if not tok or tok.value != "\"filename\"": + print("Couldn't determine string type") + else: + self.t_STRING = tok.type + + # Determine the token type for whitespace--if any + self.lexer.input(" ") + tok = self.lexer.token() + if not tok or tok.value != " ": + self.t_SPACE = None + else: + self.t_SPACE = tok.type + + # Determine the token type for newlines + self.lexer.input("\n") + tok = self.lexer.token() + if not tok or tok.value != "\n": + self.t_NEWLINE = None + print("Couldn't determine token for newlines") + else: + self.t_NEWLINE = tok.type + + self.t_WS = (self.t_SPACE, self.t_NEWLINE) + + # Check for other characters used by the preprocessor + chars = [ '<','>','#','##','\\','(',')',',','.'] + for c in chars: + self.lexer.input(c) + tok = self.lexer.token() + if not tok or tok.value != c: + print("Unable to lex '%s' required for preprocessor" % c) + + # ---------------------------------------------------------------------- + # add_path() + # + # Adds a search path to the preprocessor. + # ---------------------------------------------------------------------- + + def add_path(self,path): + self.path.append(path) + + # ---------------------------------------------------------------------- + # group_lines() + # + # Given an input string, this function splits it into lines. Trailing whitespace + # is removed. Any line ending with \ is grouped with the next line. This + # function forms the lowest level of the preprocessor---grouping into text into + # a line-by-line format. + # ---------------------------------------------------------------------- + + def group_lines(self,input): + lex = self.lexer.clone() + lines = [x.rstrip() for x in input.splitlines()] + for i in xrange(len(lines)): + j = i+1 + while lines[i].endswith('\\') and (j < len(lines)): + lines[i] = lines[i][:-1]+lines[j] + lines[j] = "" + j += 1 + + input = "\n".join(lines) + lex.input(input) + lex.lineno = 1 + + current_line = [] + while True: + tok = lex.token() + if not tok: + break + current_line.append(tok) + if tok.type in self.t_WS and '\n' in tok.value: + yield current_line + current_line = [] + + if current_line: + yield current_line + + # ---------------------------------------------------------------------- + # tokenstrip() + # + # Remove leading/trailing whitespace tokens from a token list + # ---------------------------------------------------------------------- + + def tokenstrip(self,tokens): + i = 0 + while i < len(tokens) and tokens[i].type in self.t_WS: + i += 1 + del tokens[:i] + i = len(tokens)-1 + while i >= 0 and tokens[i].type in self.t_WS: + i -= 1 + del tokens[i+1:] + return tokens + + + # ---------------------------------------------------------------------- + # collect_args() + # + # Collects comma separated arguments from a list of tokens. The arguments + # must be enclosed in parenthesis. Returns a tuple (tokencount,args,positions) + # where tokencount is the number of tokens consumed, args is a list of arguments, + # and positions is a list of integers containing the starting index of each + # argument. Each argument is represented by a list of tokens. + # + # When collecting arguments, leading and trailing whitespace is removed + # from each argument. + # + # This function properly handles nested parenthesis and commas---these do not + # define new arguments. + # ---------------------------------------------------------------------- + + def collect_args(self,tokenlist): + args = [] + positions = [] + current_arg = [] + nesting = 1 + tokenlen = len(tokenlist) + + # Search for the opening '('. + i = 0 + while (i < tokenlen) and (tokenlist[i].type in self.t_WS): + i += 1 + + if (i < tokenlen) and (tokenlist[i].value == '('): + positions.append(i+1) + else: + self.error(self.source,tokenlist[0].lineno,"Missing '(' in macro arguments") + return 0, [], [] + + i += 1 + + while i < tokenlen: + t = tokenlist[i] + if t.value == '(': + current_arg.append(t) + nesting += 1 + elif t.value == ')': + nesting -= 1 + if nesting == 0: + if current_arg: + args.append(self.tokenstrip(current_arg)) + positions.append(i) + return i+1,args,positions + current_arg.append(t) + elif t.value == ',' and nesting == 1: + args.append(self.tokenstrip(current_arg)) + positions.append(i+1) + current_arg = [] + else: + current_arg.append(t) + i += 1 + + # Missing end argument + self.error(self.source,tokenlist[-1].lineno,"Missing ')' in macro arguments") + return 0, [],[] + + # ---------------------------------------------------------------------- + # macro_prescan() + # + # Examine the macro value (token sequence) and identify patch points + # This is used to speed up macro expansion later on---we'll know + # right away where to apply patches to the value to form the expansion + # ---------------------------------------------------------------------- + + def macro_prescan(self,macro): + macro.patch = [] # Standard macro arguments + macro.str_patch = [] # String conversion expansion + macro.var_comma_patch = [] # Variadic macro comma patch + i = 0 + while i < len(macro.value): + if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist: + argnum = macro.arglist.index(macro.value[i].value) + # Conversion of argument to a string + if i > 0 and macro.value[i-1].value == '#': + macro.value[i] = copy.copy(macro.value[i]) + macro.value[i].type = self.t_STRING + del macro.value[i-1] + macro.str_patch.append((argnum,i-1)) + continue + # Concatenation + elif (i > 0 and macro.value[i-1].value == '##'): + macro.patch.append(('c',argnum,i-1)) + del macro.value[i-1] + continue + elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'): + macro.patch.append(('c',argnum,i)) + i += 1 + continue + # Standard expansion + else: + macro.patch.append(('e',argnum,i)) + elif macro.value[i].value == '##': + if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \ + ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \ + (macro.value[i+1].value == macro.vararg): + macro.var_comma_patch.append(i-1) + i += 1 + macro.patch.sort(key=lambda x: x[2],reverse=True) + + # ---------------------------------------------------------------------- + # macro_expand_args() + # + # Given a Macro and list of arguments (each a token list), this method + # returns an expanded version of a macro. The return value is a token sequence + # representing the replacement macro tokens + # ---------------------------------------------------------------------- + + def macro_expand_args(self,macro,args): + # Make a copy of the macro token sequence + rep = [copy.copy(_x) for _x in macro.value] + + # Make string expansion patches. These do not alter the length of the replacement sequence + + str_expansion = {} + for argnum, i in macro.str_patch: + if argnum not in str_expansion: + str_expansion[argnum] = ('"%s"' % "".join([x.value for x in args[argnum]])).replace("\\","\\\\") + rep[i] = copy.copy(rep[i]) + rep[i].value = str_expansion[argnum] + + # Make the variadic macro comma patch. If the variadic macro argument is empty, we get rid + comma_patch = False + if macro.variadic and not args[-1]: + for i in macro.var_comma_patch: + rep[i] = None + comma_patch = True + + # Make all other patches. The order of these matters. It is assumed that the patch list + # has been sorted in reverse order of patch location since replacements will cause the + # size of the replacement sequence to expand from the patch point. + + expanded = { } + for ptype, argnum, i in macro.patch: + # Concatenation. Argument is left unexpanded + if ptype == 'c': + rep[i:i+1] = args[argnum] + # Normal expansion. Argument is macro expanded first + elif ptype == 'e': + if argnum not in expanded: + expanded[argnum] = self.expand_macros(args[argnum]) + rep[i:i+1] = expanded[argnum] + + # Get rid of removed comma if necessary + if comma_patch: + rep = [_i for _i in rep if _i] + + return rep + + + # ---------------------------------------------------------------------- + # expand_macros() + # + # Given a list of tokens, this function performs macro expansion. + # The expanded argument is a dictionary that contains macros already + # expanded. This is used to prevent infinite recursion. + # ---------------------------------------------------------------------- + + def expand_macros(self,tokens,expanded=None): + if expanded is None: + expanded = {} + i = 0 + while i < len(tokens): + t = tokens[i] + if t.type == self.t_ID: + if t.value in self.macros and t.value not in expanded: + # Yes, we found a macro match + expanded[t.value] = True + + m = self.macros[t.value] + if not m.arglist: + # A simple macro + ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded) + for e in ex: + e.lineno = t.lineno + tokens[i:i+1] = ex + i += len(ex) + else: + # A macro with arguments + j = i + 1 + while j < len(tokens) and tokens[j].type in self.t_WS: + j += 1 + if tokens[j].value == '(': + tokcount,args,positions = self.collect_args(tokens[j:]) + if not m.variadic and len(args) != len(m.arglist): + self.error(self.source,t.lineno,"Macro %s requires %d arguments" % (t.value,len(m.arglist))) + i = j + tokcount + elif m.variadic and len(args) < len(m.arglist)-1: + if len(m.arglist) > 2: + self.error(self.source,t.lineno,"Macro %s must have at least %d arguments" % (t.value, len(m.arglist)-1)) + else: + self.error(self.source,t.lineno,"Macro %s must have at least %d argument" % (t.value, len(m.arglist)-1)) + i = j + tokcount + else: + if m.variadic: + if len(args) == len(m.arglist)-1: + args.append([]) + else: + args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1] + del args[len(m.arglist):] + + # Get macro replacement text + rep = self.macro_expand_args(m,args) + rep = self.expand_macros(rep,expanded) + for r in rep: + r.lineno = t.lineno + tokens[i:j+tokcount] = rep + i += len(rep) + del expanded[t.value] + continue + elif t.value == '__LINE__': + t.type = self.t_INTEGER + t.value = self.t_INTEGER_TYPE(t.lineno) + + i += 1 + return tokens + + # ---------------------------------------------------------------------- + # evalexpr() + # + # Evaluate an expression token sequence for the purposes of evaluating + # integral expressions. + # ---------------------------------------------------------------------- + + def evalexpr(self,tokens): + # tokens = tokenize(line) + # Search for defined macros + i = 0 + while i < len(tokens): + if tokens[i].type == self.t_ID and tokens[i].value == 'defined': + j = i + 1 + needparen = False + result = "0L" + while j < len(tokens): + if tokens[j].type in self.t_WS: + j += 1 + continue + elif tokens[j].type == self.t_ID: + if tokens[j].value in self.macros: + result = "1L" + else: + result = "0L" + if not needparen: break + elif tokens[j].value == '(': + needparen = True + elif tokens[j].value == ')': + break + else: + self.error(self.source,tokens[i].lineno,"Malformed defined()") + j += 1 + tokens[i].type = self.t_INTEGER + tokens[i].value = self.t_INTEGER_TYPE(result) + del tokens[i+1:j+1] + i += 1 + tokens = self.expand_macros(tokens) + for i,t in enumerate(tokens): + if t.type == self.t_ID: + tokens[i] = copy.copy(t) + tokens[i].type = self.t_INTEGER + tokens[i].value = self.t_INTEGER_TYPE("0L") + elif t.type == self.t_INTEGER: + tokens[i] = copy.copy(t) + # Strip off any trailing suffixes + tokens[i].value = str(tokens[i].value) + while tokens[i].value[-1] not in "0123456789abcdefABCDEF": + tokens[i].value = tokens[i].value[:-1] + + expr = "".join([str(x.value) for x in tokens]) + expr = expr.replace("&&"," and ") + expr = expr.replace("||"," or ") + expr = expr.replace("!"," not ") + try: + result = eval(expr) + except Exception: + self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression") + result = 0 + return result + + # ---------------------------------------------------------------------- + # parsegen() + # + # Parse an input string/ + # ---------------------------------------------------------------------- + def parsegen(self,input,source=None): + + # Replace trigraph sequences + t = trigraph(input) + lines = self.group_lines(t) + + if not source: + source = "" + + self.define("__FILE__ \"%s\"" % source) + + self.source = source + chunk = [] + enable = True + iftrigger = False + ifstack = [] + + for x in lines: + for i,tok in enumerate(x): + if tok.type not in self.t_WS: break + if tok.value == '#': + # Preprocessor directive + + # insert necessary whitespace instead of eaten tokens + for tok in x: + if tok.type in self.t_WS and '\n' in tok.value: + chunk.append(tok) + + dirtokens = self.tokenstrip(x[i+1:]) + if dirtokens: + name = dirtokens[0].value + args = self.tokenstrip(dirtokens[1:]) + else: + name = "" + args = [] + + if name == 'define': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + self.define(args) + elif name == 'include': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + oldfile = self.macros['__FILE__'] + for tok in self.include(args): + yield tok + self.macros['__FILE__'] = oldfile + self.source = source + elif name == 'undef': + if enable: + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + self.undef(args) + elif name == 'ifdef': + ifstack.append((enable,iftrigger)) + if enable: + if not args[0].value in self.macros: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'ifndef': + ifstack.append((enable,iftrigger)) + if enable: + if args[0].value in self.macros: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'if': + ifstack.append((enable,iftrigger)) + if enable: + result = self.evalexpr(args) + if not result: + enable = False + iftrigger = False + else: + iftrigger = True + elif name == 'elif': + if ifstack: + if ifstack[-1][0]: # We only pay attention if outer "if" allows this + if enable: # If already true, we flip enable False + enable = False + elif not iftrigger: # If False, but not triggered yet, we'll check expression + result = self.evalexpr(args) + if result: + enable = True + iftrigger = True + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #elif") + + elif name == 'else': + if ifstack: + if ifstack[-1][0]: + if enable: + enable = False + elif not iftrigger: + enable = True + iftrigger = True + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #else") + + elif name == 'endif': + if ifstack: + enable,iftrigger = ifstack.pop() + else: + self.error(self.source,dirtokens[0].lineno,"Misplaced #endif") + else: + # Unknown preprocessor directive + pass + + else: + # Normal text + if enable: + chunk.extend(x) + + for tok in self.expand_macros(chunk): + yield tok + chunk = [] + + # ---------------------------------------------------------------------- + # include() + # + # Implementation of file-inclusion + # ---------------------------------------------------------------------- + + def include(self,tokens): + # Try to extract the filename and then process an include file + if not tokens: + return + if tokens: + if tokens[0].value != '<' and tokens[0].type != self.t_STRING: + tokens = self.expand_macros(tokens) + + if tokens[0].value == '<': + # Include <...> + i = 1 + while i < len(tokens): + if tokens[i].value == '>': + break + i += 1 + else: + print("Malformed #include <...>") + return + filename = "".join([x.value for x in tokens[1:i]]) + path = self.path + [""] + self.temp_path + elif tokens[0].type == self.t_STRING: + filename = tokens[0].value[1:-1] + path = self.temp_path + [""] + self.path + else: + print("Malformed #include statement") + return + for p in path: + iname = os.path.join(p,filename) + try: + data = open(iname,"r").read() + dname = os.path.dirname(iname) + if dname: + self.temp_path.insert(0,dname) + for tok in self.parsegen(data,filename): + yield tok + if dname: + del self.temp_path[0] + break + except IOError: + pass + else: + print("Couldn't find '%s'" % filename) + + # ---------------------------------------------------------------------- + # define() + # + # Define a new macro + # ---------------------------------------------------------------------- + + def define(self,tokens): + if isinstance(tokens,STRING_TYPES): + tokens = self.tokenize(tokens) + + linetok = tokens + try: + name = linetok[0] + if len(linetok) > 1: + mtype = linetok[1] + else: + mtype = None + if not mtype: + m = Macro(name.value,[]) + self.macros[name.value] = m + elif mtype.type in self.t_WS: + # A normal macro + m = Macro(name.value,self.tokenstrip(linetok[2:])) + self.macros[name.value] = m + elif mtype.value == '(': + # A macro with arguments + tokcount, args, positions = self.collect_args(linetok[1:]) + variadic = False + for a in args: + if variadic: + print("No more arguments may follow a variadic argument") + break + astr = "".join([str(_i.value) for _i in a]) + if astr == "...": + variadic = True + a[0].type = self.t_ID + a[0].value = '__VA_ARGS__' + variadic = True + del a[1:] + continue + elif astr[-3:] == "..." and a[0].type == self.t_ID: + variadic = True + del a[1:] + # If, for some reason, "." is part of the identifier, strip off the name for the purposes + # of macro expansion + if a[0].value[-3:] == '...': + a[0].value = a[0].value[:-3] + continue + if len(a) > 1 or a[0].type != self.t_ID: + print("Invalid macro argument") + break + else: + mvalue = self.tokenstrip(linetok[1+tokcount:]) + i = 0 + while i < len(mvalue): + if i+1 < len(mvalue): + if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##': + del mvalue[i] + continue + elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS: + del mvalue[i+1] + i += 1 + m = Macro(name.value,mvalue,[x[0].value for x in args],variadic) + self.macro_prescan(m) + self.macros[name.value] = m + else: + print("Bad macro definition") + except LookupError: + print("Bad macro definition") + + # ---------------------------------------------------------------------- + # undef() + # + # Undefine a macro + # ---------------------------------------------------------------------- + + def undef(self,tokens): + id = tokens[0].value + try: + del self.macros[id] + except LookupError: + pass + + # ---------------------------------------------------------------------- + # parse() + # + # Parse input text. + # ---------------------------------------------------------------------- + def parse(self,input,source=None,ignore={}): + self.ignore = ignore + self.parser = self.parsegen(input,source) + + # ---------------------------------------------------------------------- + # token() + # + # Method to return individual tokens + # ---------------------------------------------------------------------- + def token(self): + try: + while True: + tok = next(self.parser) + if tok.type not in self.ignore: return tok + except StopIteration: + self.parser = None + return None + +if __name__ == '__main__': + import ply.lex as lex + lexer = lex.lex() + + # Run a preprocessor + import sys + f = open(sys.argv[1]) + input = f.read() + + p = Preprocessor(lexer) + p.parse(input,sys.argv[1]) + while True: + tok = p.token() + if not tok: break + print(p.source, tok) diff --git a/jwt/python/pycparser/ply/ctokens.py b/jwt/python/pycparser/ply/ctokens.py new file mode 100644 index 0000000..f6f6952 --- /dev/null +++ b/jwt/python/pycparser/ply/ctokens.py @@ -0,0 +1,133 @@ +# ---------------------------------------------------------------------- +# ctokens.py +# +# Token specifications for symbols in ANSI C and C++. This file is +# meant to be used as a library in other tokenizers. +# ---------------------------------------------------------------------- + +# Reserved words + +tokens = [ + # Literals (identifier, integer constant, float constant, string constant, char const) + 'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER', + + # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=) + 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO', + 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', + 'LOR', 'LAND', 'LNOT', + 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', + + # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=) + 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL', + 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL', + + # Increment/decrement (++,--) + 'INCREMENT', 'DECREMENT', + + # Structure dereference (->) + 'ARROW', + + # Ternary operator (?) + 'TERNARY', + + # Delimeters ( ) [ ] { } , . ; : + 'LPAREN', 'RPAREN', + 'LBRACKET', 'RBRACKET', + 'LBRACE', 'RBRACE', + 'COMMA', 'PERIOD', 'SEMI', 'COLON', + + # Ellipsis (...) + 'ELLIPSIS', +] + +# Operators +t_PLUS = r'\+' +t_MINUS = r'-' +t_TIMES = r'\*' +t_DIVIDE = r'/' +t_MODULO = r'%' +t_OR = r'\|' +t_AND = r'&' +t_NOT = r'~' +t_XOR = r'\^' +t_LSHIFT = r'<<' +t_RSHIFT = r'>>' +t_LOR = r'\|\|' +t_LAND = r'&&' +t_LNOT = r'!' +t_LT = r'<' +t_GT = r'>' +t_LE = r'<=' +t_GE = r'>=' +t_EQ = r'==' +t_NE = r'!=' + +# Assignment operators + +t_EQUALS = r'=' +t_TIMESEQUAL = r'\*=' +t_DIVEQUAL = r'/=' +t_MODEQUAL = r'%=' +t_PLUSEQUAL = r'\+=' +t_MINUSEQUAL = r'-=' +t_LSHIFTEQUAL = r'<<=' +t_RSHIFTEQUAL = r'>>=' +t_ANDEQUAL = r'&=' +t_OREQUAL = r'\|=' +t_XOREQUAL = r'\^=' + +# Increment/decrement +t_INCREMENT = r'\+\+' +t_DECREMENT = r'--' + +# -> +t_ARROW = r'->' + +# ? +t_TERNARY = r'\?' + +# Delimeters +t_LPAREN = r'\(' +t_RPAREN = r'\)' +t_LBRACKET = r'\[' +t_RBRACKET = r'\]' +t_LBRACE = r'\{' +t_RBRACE = r'\}' +t_COMMA = r',' +t_PERIOD = r'\.' +t_SEMI = r';' +t_COLON = r':' +t_ELLIPSIS = r'\.\.\.' + +# Identifiers +t_ID = r'[A-Za-z_][A-Za-z0-9_]*' + +# Integer literal +t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?' + +# Floating literal +t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' + +# String literal +t_STRING = r'\"([^\\\n]|(\\.))*?\"' + +# Character constant 'c' or L'c' +t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\'' + +# Comment (C-Style) +def t_COMMENT(t): + r'/\*(.|\n)*?\*/' + t.lexer.lineno += t.value.count('\n') + return t + +# Comment (C++-Style) +def t_CPPCOMMENT(t): + r'//.*\n' + t.lexer.lineno += 1 + return t + + + + + + diff --git a/jwt/python/pycparser/ply/lex.py b/jwt/python/pycparser/ply/lex.py new file mode 100644 index 0000000..4bdd76c --- /dev/null +++ b/jwt/python/pycparser/ply/lex.py @@ -0,0 +1,1099 @@ +# ----------------------------------------------------------------------------- +# ply: lex.py +# +# Copyright (C) 2001-2017 +# David M. Beazley (Dabeaz LLC) +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the David Beazley or Dabeaz LLC may be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------------------------- + +__version__ = '3.10' +__tabversion__ = '3.10' + +import re +import sys +import types +import copy +import os +import inspect + +# This tuple contains known string types +try: + # Python 2.6 + StringTypes = (types.StringType, types.UnicodeType) +except AttributeError: + # Python 3.0 + StringTypes = (str, bytes) + +# This regular expression is used to match valid token names +_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$') + +# Exception thrown when invalid token encountered and no default error +# handler is defined. +class LexError(Exception): + def __init__(self, message, s): + self.args = (message,) + self.text = s + + +# Token class. This class is used to represent the tokens produced. +class LexToken(object): + def __str__(self): + return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos) + + def __repr__(self): + return str(self) + + +# This object is a stand-in for a logging object created by the +# logging module. + +class PlyLogger(object): + def __init__(self, f): + self.f = f + + def critical(self, msg, *args, **kwargs): + self.f.write((msg % args) + '\n') + + def warning(self, msg, *args, **kwargs): + self.f.write('WARNING: ' + (msg % args) + '\n') + + def error(self, msg, *args, **kwargs): + self.f.write('ERROR: ' + (msg % args) + '\n') + + info = critical + debug = critical + + +# Null logger is used when no output is generated. Does nothing. +class NullLogger(object): + def __getattribute__(self, name): + return self + + def __call__(self, *args, **kwargs): + return self + + +# ----------------------------------------------------------------------------- +# === Lexing Engine === +# +# The following Lexer class implements the lexer runtime. There are only +# a few public methods and attributes: +# +# input() - Store a new string in the lexer +# token() - Get the next token +# clone() - Clone the lexer +# +# lineno - Current line number +# lexpos - Current position in the input string +# ----------------------------------------------------------------------------- + +class Lexer: + def __init__(self): + self.lexre = None # Master regular expression. This is a list of + # tuples (re, findex) where re is a compiled + # regular expression and findex is a list + # mapping regex group numbers to rules + self.lexretext = None # Current regular expression strings + self.lexstatere = {} # Dictionary mapping lexer states to master regexs + self.lexstateretext = {} # Dictionary mapping lexer states to regex strings + self.lexstaterenames = {} # Dictionary mapping lexer states to symbol names + self.lexstate = 'INITIAL' # Current lexer state + self.lexstatestack = [] # Stack of lexer states + self.lexstateinfo = None # State information + self.lexstateignore = {} # Dictionary of ignored characters for each state + self.lexstateerrorf = {} # Dictionary of error functions for each state + self.lexstateeoff = {} # Dictionary of eof functions for each state + self.lexreflags = 0 # Optional re compile flags + self.lexdata = None # Actual input data (as a string) + self.lexpos = 0 # Current position in input text + self.lexlen = 0 # Length of the input text + self.lexerrorf = None # Error rule (if any) + self.lexeoff = None # EOF rule (if any) + self.lextokens = None # List of valid tokens + self.lexignore = '' # Ignored characters + self.lexliterals = '' # Literal characters that can be passed through + self.lexmodule = None # Module + self.lineno = 1 # Current line number + self.lexoptimize = False # Optimized mode + + def clone(self, object=None): + c = copy.copy(self) + + # If the object parameter has been supplied, it means we are attaching the + # lexer to a new object. In this case, we have to rebind all methods in + # the lexstatere and lexstateerrorf tables. + + if object: + newtab = {} + for key, ritem in self.lexstatere.items(): + newre = [] + for cre, findex in ritem: + newfindex = [] + for f in findex: + if not f or not f[0]: + newfindex.append(f) + continue + newfindex.append((getattr(object, f[0].__name__), f[1])) + newre.append((cre, newfindex)) + newtab[key] = newre + c.lexstatere = newtab + c.lexstateerrorf = {} + for key, ef in self.lexstateerrorf.items(): + c.lexstateerrorf[key] = getattr(object, ef.__name__) + c.lexmodule = object + return c + + # ------------------------------------------------------------ + # writetab() - Write lexer information to a table file + # ------------------------------------------------------------ + def writetab(self, lextab, outputdir=''): + if isinstance(lextab, types.ModuleType): + raise IOError("Won't overwrite existing lextab module") + basetabmodule = lextab.split('.')[-1] + filename = os.path.join(outputdir, basetabmodule) + '.py' + with open(filename, 'w') as tf: + tf.write('# %s.py. This file automatically created by PLY (version %s). Don\'t edit!\n' % (basetabmodule, __version__)) + tf.write('_tabversion = %s\n' % repr(__tabversion__)) + tf.write('_lextokens = set(%s)\n' % repr(tuple(self.lextokens))) + tf.write('_lexreflags = %s\n' % repr(self.lexreflags)) + tf.write('_lexliterals = %s\n' % repr(self.lexliterals)) + tf.write('_lexstateinfo = %s\n' % repr(self.lexstateinfo)) + + # Rewrite the lexstatere table, replacing function objects with function names + tabre = {} + for statename, lre in self.lexstatere.items(): + titem = [] + for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]): + titem.append((retext, _funcs_to_names(func, renames))) + tabre[statename] = titem + + tf.write('_lexstatere = %s\n' % repr(tabre)) + tf.write('_lexstateignore = %s\n' % repr(self.lexstateignore)) + + taberr = {} + for statename, ef in self.lexstateerrorf.items(): + taberr[statename] = ef.__name__ if ef else None + tf.write('_lexstateerrorf = %s\n' % repr(taberr)) + + tabeof = {} + for statename, ef in self.lexstateeoff.items(): + tabeof[statename] = ef.__name__ if ef else None + tf.write('_lexstateeoff = %s\n' % repr(tabeof)) + + # ------------------------------------------------------------ + # readtab() - Read lexer information from a tab file + # ------------------------------------------------------------ + def readtab(self, tabfile, fdict): + if isinstance(tabfile, types.ModuleType): + lextab = tabfile + else: + exec('import %s' % tabfile) + lextab = sys.modules[tabfile] + + if getattr(lextab, '_tabversion', '0.0') != __tabversion__: + raise ImportError('Inconsistent PLY version') + + self.lextokens = lextab._lextokens + self.lexreflags = lextab._lexreflags + self.lexliterals = lextab._lexliterals + self.lextokens_all = self.lextokens | set(self.lexliterals) + self.lexstateinfo = lextab._lexstateinfo + self.lexstateignore = lextab._lexstateignore + self.lexstatere = {} + self.lexstateretext = {} + for statename, lre in lextab._lexstatere.items(): + titem = [] + txtitem = [] + for pat, func_name in lre: + titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict))) + + self.lexstatere[statename] = titem + self.lexstateretext[statename] = txtitem + + self.lexstateerrorf = {} + for statename, ef in lextab._lexstateerrorf.items(): + self.lexstateerrorf[statename] = fdict[ef] + + self.lexstateeoff = {} + for statename, ef in lextab._lexstateeoff.items(): + self.lexstateeoff[statename] = fdict[ef] + + self.begin('INITIAL') + + # ------------------------------------------------------------ + # input() - Push a new string into the lexer + # ------------------------------------------------------------ + def input(self, s): + # Pull off the first character to see if s looks like a string + c = s[:1] + if not isinstance(c, StringTypes): + raise ValueError('Expected a string') + self.lexdata = s + self.lexpos = 0 + self.lexlen = len(s) + + # ------------------------------------------------------------ + # begin() - Changes the lexing state + # ------------------------------------------------------------ + def begin(self, state): + if state not in self.lexstatere: + raise ValueError('Undefined state') + self.lexre = self.lexstatere[state] + self.lexretext = self.lexstateretext[state] + self.lexignore = self.lexstateignore.get(state, '') + self.lexerrorf = self.lexstateerrorf.get(state, None) + self.lexeoff = self.lexstateeoff.get(state, None) + self.lexstate = state + + # ------------------------------------------------------------ + # push_state() - Changes the lexing state and saves old on stack + # ------------------------------------------------------------ + def push_state(self, state): + self.lexstatestack.append(self.lexstate) + self.begin(state) + + # ------------------------------------------------------------ + # pop_state() - Restores the previous state + # ------------------------------------------------------------ + def pop_state(self): + self.begin(self.lexstatestack.pop()) + + # ------------------------------------------------------------ + # current_state() - Returns the current lexing state + # ------------------------------------------------------------ + def current_state(self): + return self.lexstate + + # ------------------------------------------------------------ + # skip() - Skip ahead n characters + # ------------------------------------------------------------ + def skip(self, n): + self.lexpos += n + + # ------------------------------------------------------------ + # opttoken() - Return the next token from the Lexer + # + # Note: This function has been carefully implemented to be as fast + # as possible. Don't make changes unless you really know what + # you are doing + # ------------------------------------------------------------ + def token(self): + # Make local copies of frequently referenced attributes + lexpos = self.lexpos + lexlen = self.lexlen + lexignore = self.lexignore + lexdata = self.lexdata + + while lexpos < lexlen: + # This code provides some short-circuit code for whitespace, tabs, and other ignored characters + if lexdata[lexpos] in lexignore: + lexpos += 1 + continue + + # Look for a regular expression match + for lexre, lexindexfunc in self.lexre: + m = lexre.match(lexdata, lexpos) + if not m: + continue + + # Create a token for return + tok = LexToken() + tok.value = m.group() + tok.lineno = self.lineno + tok.lexpos = lexpos + + i = m.lastindex + func, tok.type = lexindexfunc[i] + + if not func: + # If no token type was set, it's an ignored token + if tok.type: + self.lexpos = m.end() + return tok + else: + lexpos = m.end() + break + + lexpos = m.end() + + # If token is processed by a function, call it + + tok.lexer = self # Set additional attributes useful in token rules + self.lexmatch = m + self.lexpos = lexpos + + newtok = func(tok) + + # Every function must return a token, if nothing, we just move to next token + if not newtok: + lexpos = self.lexpos # This is here in case user has updated lexpos. + lexignore = self.lexignore # This is here in case there was a state change + break + + # Verify type of the token. If not in the token map, raise an error + if not self.lexoptimize: + if newtok.type not in self.lextokens_all: + raise LexError("%s:%d: Rule '%s' returned an unknown token type '%s'" % ( + func.__code__.co_filename, func.__code__.co_firstlineno, + func.__name__, newtok.type), lexdata[lexpos:]) + + return newtok + else: + # No match, see if in literals + if lexdata[lexpos] in self.lexliterals: + tok = LexToken() + tok.value = lexdata[lexpos] + tok.lineno = self.lineno + tok.type = tok.value + tok.lexpos = lexpos + self.lexpos = lexpos + 1 + return tok + + # No match. Call t_error() if defined. + if self.lexerrorf: + tok = LexToken() + tok.value = self.lexdata[lexpos:] + tok.lineno = self.lineno + tok.type = 'error' + tok.lexer = self + tok.lexpos = lexpos + self.lexpos = lexpos + newtok = self.lexerrorf(tok) + if lexpos == self.lexpos: + # Error method didn't change text position at all. This is an error. + raise LexError("Scanning error. Illegal character '%s'" % (lexdata[lexpos]), lexdata[lexpos:]) + lexpos = self.lexpos + if not newtok: + continue + return newtok + + self.lexpos = lexpos + raise LexError("Illegal character '%s' at index %d" % (lexdata[lexpos], lexpos), lexdata[lexpos:]) + + if self.lexeoff: + tok = LexToken() + tok.type = 'eof' + tok.value = '' + tok.lineno = self.lineno + tok.lexpos = lexpos + tok.lexer = self + self.lexpos = lexpos + newtok = self.lexeoff(tok) + return newtok + + self.lexpos = lexpos + 1 + if self.lexdata is None: + raise RuntimeError('No input string given with input()') + return None + + # Iterator interface + def __iter__(self): + return self + + def next(self): + t = self.token() + if t is None: + raise StopIteration + return t + + __next__ = next + +# ----------------------------------------------------------------------------- +# ==== Lex Builder === +# +# The functions and classes below are used to collect lexing information +# and build a Lexer object from it. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# _get_regex(func) +# +# Returns the regular expression assigned to a function either as a doc string +# or as a .regex attribute attached by the @TOKEN decorator. +# ----------------------------------------------------------------------------- +def _get_regex(func): + return getattr(func, 'regex', func.__doc__) + +# ----------------------------------------------------------------------------- +# get_caller_module_dict() +# +# This function returns a dictionary containing all of the symbols defined within +# a caller further down the call stack. This is used to get the environment +# associated with the yacc() call if none was provided. +# ----------------------------------------------------------------------------- +def get_caller_module_dict(levels): + f = sys._getframe(levels) + ldict = f.f_globals.copy() + if f.f_globals != f.f_locals: + ldict.update(f.f_locals) + return ldict + +# ----------------------------------------------------------------------------- +# _funcs_to_names() +# +# Given a list of regular expression functions, this converts it to a list +# suitable for output to a table file +# ----------------------------------------------------------------------------- +def _funcs_to_names(funclist, namelist): + result = [] + for f, name in zip(funclist, namelist): + if f and f[0]: + result.append((name, f[1])) + else: + result.append(f) + return result + +# ----------------------------------------------------------------------------- +# _names_to_funcs() +# +# Given a list of regular expression function names, this converts it back to +# functions. +# ----------------------------------------------------------------------------- +def _names_to_funcs(namelist, fdict): + result = [] + for n in namelist: + if n and n[0]: + result.append((fdict[n[0]], n[1])) + else: + result.append(n) + return result + +# ----------------------------------------------------------------------------- +# _form_master_re() +# +# This function takes a list of all of the regex components and attempts to +# form the master regular expression. Given limitations in the Python re +# module, it may be necessary to break the master regex into separate expressions. +# ----------------------------------------------------------------------------- +def _form_master_re(relist, reflags, ldict, toknames): + if not relist: + return [] + regex = '|'.join(relist) + try: + lexre = re.compile(regex, reflags) + + # Build the index to function map for the matching engine + lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1) + lexindexnames = lexindexfunc[:] + + for f, i in lexre.groupindex.items(): + handle = ldict.get(f, None) + if type(handle) in (types.FunctionType, types.MethodType): + lexindexfunc[i] = (handle, toknames[f]) + lexindexnames[i] = f + elif handle is not None: + lexindexnames[i] = f + if f.find('ignore_') > 0: + lexindexfunc[i] = (None, None) + else: + lexindexfunc[i] = (None, toknames[f]) + + return [(lexre, lexindexfunc)], [regex], [lexindexnames] + except Exception: + m = int(len(relist)/2) + if m == 0: + m = 1 + llist, lre, lnames = _form_master_re(relist[:m], reflags, ldict, toknames) + rlist, rre, rnames = _form_master_re(relist[m:], reflags, ldict, toknames) + return (llist+rlist), (lre+rre), (lnames+rnames) + +# ----------------------------------------------------------------------------- +# def _statetoken(s,names) +# +# Given a declaration name s of the form "t_" and a dictionary whose keys are +# state names, this function returns a tuple (states,tokenname) where states +# is a tuple of state names and tokenname is the name of the token. For example, +# calling this with s = "t_foo_bar_SPAM" might return (('foo','bar'),'SPAM') +# ----------------------------------------------------------------------------- +def _statetoken(s, names): + nonstate = 1 + parts = s.split('_') + for i, part in enumerate(parts[1:], 1): + if part not in names and part != 'ANY': + break + + if i > 1: + states = tuple(parts[1:i]) + else: + states = ('INITIAL',) + + if 'ANY' in states: + states = tuple(names) + + tokenname = '_'.join(parts[i:]) + return (states, tokenname) + + +# ----------------------------------------------------------------------------- +# LexerReflect() +# +# This class represents information needed to build a lexer as extracted from a +# user's input file. +# ----------------------------------------------------------------------------- +class LexerReflect(object): + def __init__(self, ldict, log=None, reflags=0): + self.ldict = ldict + self.error_func = None + self.tokens = [] + self.reflags = reflags + self.stateinfo = {'INITIAL': 'inclusive'} + self.modules = set() + self.error = False + self.log = PlyLogger(sys.stderr) if log is None else log + + # Get all of the basic information + def get_all(self): + self.get_tokens() + self.get_literals() + self.get_states() + self.get_rules() + + # Validate all of the information + def validate_all(self): + self.validate_tokens() + self.validate_literals() + self.validate_rules() + return self.error + + # Get the tokens map + def get_tokens(self): + tokens = self.ldict.get('tokens', None) + if not tokens: + self.log.error('No token list is defined') + self.error = True + return + + if not isinstance(tokens, (list, tuple)): + self.log.error('tokens must be a list or tuple') + self.error = True + return + + if not tokens: + self.log.error('tokens is empty') + self.error = True + return + + self.tokens = tokens + + # Validate the tokens + def validate_tokens(self): + terminals = {} + for n in self.tokens: + if not _is_identifier.match(n): + self.log.error("Bad token name '%s'", n) + self.error = True + if n in terminals: + self.log.warning("Token '%s' multiply defined", n) + terminals[n] = 1 + + # Get the literals specifier + def get_literals(self): + self.literals = self.ldict.get('literals', '') + if not self.literals: + self.literals = '' + + # Validate literals + def validate_literals(self): + try: + for c in self.literals: + if not isinstance(c, StringTypes) or len(c) > 1: + self.log.error('Invalid literal %s. Must be a single character', repr(c)) + self.error = True + + except TypeError: + self.log.error('Invalid literals specification. literals must be a sequence of characters') + self.error = True + + def get_states(self): + self.states = self.ldict.get('states', None) + # Build statemap + if self.states: + if not isinstance(self.states, (tuple, list)): + self.log.error('states must be defined as a tuple or list') + self.error = True + else: + for s in self.states: + if not isinstance(s, tuple) or len(s) != 2: + self.log.error("Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')", repr(s)) + self.error = True + continue + name, statetype = s + if not isinstance(name, StringTypes): + self.log.error('State name %s must be a string', repr(name)) + self.error = True + continue + if not (statetype == 'inclusive' or statetype == 'exclusive'): + self.log.error("State type for state %s must be 'inclusive' or 'exclusive'", name) + self.error = True + continue + if name in self.stateinfo: + self.log.error("State '%s' already defined", name) + self.error = True + continue + self.stateinfo[name] = statetype + + # Get all of the symbols with a t_ prefix and sort them into various + # categories (functions, strings, error functions, and ignore characters) + + def get_rules(self): + tsymbols = [f for f in self.ldict if f[:2] == 't_'] + + # Now build up a list of functions and a list of strings + self.toknames = {} # Mapping of symbols to token names + self.funcsym = {} # Symbols defined as functions + self.strsym = {} # Symbols defined as strings + self.ignore = {} # Ignore strings by state + self.errorf = {} # Error functions by state + self.eoff = {} # EOF functions by state + + for s in self.stateinfo: + self.funcsym[s] = [] + self.strsym[s] = [] + + if len(tsymbols) == 0: + self.log.error('No rules of the form t_rulename are defined') + self.error = True + return + + for f in tsymbols: + t = self.ldict[f] + states, tokname = _statetoken(f, self.stateinfo) + self.toknames[f] = tokname + + if hasattr(t, '__call__'): + if tokname == 'error': + for s in states: + self.errorf[s] = t + elif tokname == 'eof': + for s in states: + self.eoff[s] = t + elif tokname == 'ignore': + line = t.__code__.co_firstlineno + file = t.__code__.co_filename + self.log.error("%s:%d: Rule '%s' must be defined as a string", file, line, t.__name__) + self.error = True + else: + for s in states: + self.funcsym[s].append((f, t)) + elif isinstance(t, StringTypes): + if tokname == 'ignore': + for s in states: + self.ignore[s] = t + if '\\' in t: + self.log.warning("%s contains a literal backslash '\\'", f) + + elif tokname == 'error': + self.log.error("Rule '%s' must be defined as a function", f) + self.error = True + else: + for s in states: + self.strsym[s].append((f, t)) + else: + self.log.error('%s not defined as a function or string', f) + self.error = True + + # Sort the functions by line number + for f in self.funcsym.values(): + f.sort(key=lambda x: x[1].__code__.co_firstlineno) + + # Sort the strings by regular expression length + for s in self.strsym.values(): + s.sort(key=lambda x: len(x[1]), reverse=True) + + # Validate all of the t_rules collected + def validate_rules(self): + for state in self.stateinfo: + # Validate all rules defined by functions + + for fname, f in self.funcsym[state]: + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + module = inspect.getmodule(f) + self.modules.add(module) + + tokname = self.toknames[fname] + if isinstance(f, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + nargs = f.__code__.co_argcount + if nargs > reqargs: + self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__) + self.error = True + continue + + if nargs < reqargs: + self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__) + self.error = True + continue + + if not _get_regex(f): + self.log.error("%s:%d: No regular expression defined for rule '%s'", file, line, f.__name__) + self.error = True + continue + + try: + c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags) + if c.match(''): + self.log.error("%s:%d: Regular expression for rule '%s' matches empty string", file, line, f.__name__) + self.error = True + except re.error as e: + self.log.error("%s:%d: Invalid regular expression for rule '%s'. %s", file, line, f.__name__, e) + if '#' in _get_regex(f): + self.log.error("%s:%d. Make sure '#' in rule '%s' is escaped with '\\#'", file, line, f.__name__) + self.error = True + + # Validate all rules defined by strings + for name, r in self.strsym[state]: + tokname = self.toknames[name] + if tokname == 'error': + self.log.error("Rule '%s' must be defined as a function", name) + self.error = True + continue + + if tokname not in self.tokens and tokname.find('ignore_') < 0: + self.log.error("Rule '%s' defined for an unspecified token %s", name, tokname) + self.error = True + continue + + try: + c = re.compile('(?P<%s>%s)' % (name, r), self.reflags) + if (c.match('')): + self.log.error("Regular expression for rule '%s' matches empty string", name) + self.error = True + except re.error as e: + self.log.error("Invalid regular expression for rule '%s'. %s", name, e) + if '#' in r: + self.log.error("Make sure '#' in rule '%s' is escaped with '\\#'", name) + self.error = True + + if not self.funcsym[state] and not self.strsym[state]: + self.log.error("No rules defined for state '%s'", state) + self.error = True + + # Validate the error function + efunc = self.errorf.get(state, None) + if efunc: + f = efunc + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + module = inspect.getmodule(f) + self.modules.add(module) + + if isinstance(f, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + nargs = f.__code__.co_argcount + if nargs > reqargs: + self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__) + self.error = True + + if nargs < reqargs: + self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__) + self.error = True + + for module in self.modules: + self.validate_module(module) + + # ----------------------------------------------------------------------------- + # validate_module() + # + # This checks to see if there are duplicated t_rulename() functions or strings + # in the parser input file. This is done using a simple regular expression + # match on each line in the source code of the given module. + # ----------------------------------------------------------------------------- + + def validate_module(self, module): + try: + lines, linen = inspect.getsourcelines(module) + except IOError: + return + + fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(') + sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=') + + counthash = {} + linen += 1 + for line in lines: + m = fre.match(line) + if not m: + m = sre.match(line) + if m: + name = m.group(1) + prev = counthash.get(name) + if not prev: + counthash[name] = linen + else: + filename = inspect.getsourcefile(module) + self.log.error('%s:%d: Rule %s redefined. Previously defined on line %d', filename, linen, name, prev) + self.error = True + linen += 1 + +# ----------------------------------------------------------------------------- +# lex(module) +# +# Build all of the regular expression rules from definitions in the supplied module +# ----------------------------------------------------------------------------- +def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab', + reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None): + + if lextab is None: + lextab = 'lextab' + + global lexer + + ldict = None + stateinfo = {'INITIAL': 'inclusive'} + lexobj = Lexer() + lexobj.lexoptimize = optimize + global token, input + + if errorlog is None: + errorlog = PlyLogger(sys.stderr) + + if debug: + if debuglog is None: + debuglog = PlyLogger(sys.stderr) + + # Get the module dictionary used for the lexer + if object: + module = object + + # Get the module dictionary used for the parser + if module: + _items = [(k, getattr(module, k)) for k in dir(module)] + ldict = dict(_items) + # If no __file__ attribute is available, try to obtain it from the __module__ instead + if '__file__' not in ldict: + ldict['__file__'] = sys.modules[ldict['__module__']].__file__ + else: + ldict = get_caller_module_dict(2) + + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = ldict.get('__package__') + if pkg and isinstance(lextab, str): + if '.' not in lextab: + lextab = pkg + '.' + lextab + + # Collect parser information from the dictionary + linfo = LexerReflect(ldict, log=errorlog, reflags=reflags) + linfo.get_all() + if not optimize: + if linfo.validate_all(): + raise SyntaxError("Can't build lexer") + + if optimize and lextab: + try: + lexobj.readtab(lextab, ldict) + token = lexobj.token + input = lexobj.input + lexer = lexobj + return lexobj + + except ImportError: + pass + + # Dump some basic debugging information + if debug: + debuglog.info('lex: tokens = %r', linfo.tokens) + debuglog.info('lex: literals = %r', linfo.literals) + debuglog.info('lex: states = %r', linfo.stateinfo) + + # Build a dictionary of valid token names + lexobj.lextokens = set() + for n in linfo.tokens: + lexobj.lextokens.add(n) + + # Get literals specification + if isinstance(linfo.literals, (list, tuple)): + lexobj.lexliterals = type(linfo.literals[0])().join(linfo.literals) + else: + lexobj.lexliterals = linfo.literals + + lexobj.lextokens_all = lexobj.lextokens | set(lexobj.lexliterals) + + # Get the stateinfo dictionary + stateinfo = linfo.stateinfo + + regexs = {} + # Build the master regular expressions + for state in stateinfo: + regex_list = [] + + # Add rules defined by functions first + for fname, f in linfo.funcsym[state]: + line = f.__code__.co_firstlineno + file = f.__code__.co_filename + regex_list.append('(?P<%s>%s)' % (fname, _get_regex(f))) + if debug: + debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", fname, _get_regex(f), state) + + # Now add all of the simple rules + for name, r in linfo.strsym[state]: + regex_list.append('(?P<%s>%s)' % (name, r)) + if debug: + debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", name, r, state) + + regexs[state] = regex_list + + # Build the master regular expressions + + if debug: + debuglog.info('lex: ==== MASTER REGEXS FOLLOW ====') + + for state in regexs: + lexre, re_text, re_names = _form_master_re(regexs[state], reflags, ldict, linfo.toknames) + lexobj.lexstatere[state] = lexre + lexobj.lexstateretext[state] = re_text + lexobj.lexstaterenames[state] = re_names + if debug: + for i, text in enumerate(re_text): + debuglog.info("lex: state '%s' : regex[%d] = '%s'", state, i, text) + + # For inclusive states, we need to add the regular expressions from the INITIAL state + for state, stype in stateinfo.items(): + if state != 'INITIAL' and stype == 'inclusive': + lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL']) + lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL']) + lexobj.lexstaterenames[state].extend(lexobj.lexstaterenames['INITIAL']) + + lexobj.lexstateinfo = stateinfo + lexobj.lexre = lexobj.lexstatere['INITIAL'] + lexobj.lexretext = lexobj.lexstateretext['INITIAL'] + lexobj.lexreflags = reflags + + # Set up ignore variables + lexobj.lexstateignore = linfo.ignore + lexobj.lexignore = lexobj.lexstateignore.get('INITIAL', '') + + # Set up error functions + lexobj.lexstateerrorf = linfo.errorf + lexobj.lexerrorf = linfo.errorf.get('INITIAL', None) + if not lexobj.lexerrorf: + errorlog.warning('No t_error rule is defined') + + # Set up eof functions + lexobj.lexstateeoff = linfo.eoff + lexobj.lexeoff = linfo.eoff.get('INITIAL', None) + + # Check state information for ignore and error rules + for s, stype in stateinfo.items(): + if stype == 'exclusive': + if s not in linfo.errorf: + errorlog.warning("No error rule is defined for exclusive state '%s'", s) + if s not in linfo.ignore and lexobj.lexignore: + errorlog.warning("No ignore rule is defined for exclusive state '%s'", s) + elif stype == 'inclusive': + if s not in linfo.errorf: + linfo.errorf[s] = linfo.errorf.get('INITIAL', None) + if s not in linfo.ignore: + linfo.ignore[s] = linfo.ignore.get('INITIAL', '') + + # Create global versions of the token() and input() functions + token = lexobj.token + input = lexobj.input + lexer = lexobj + + # If in optimize mode, we write the lextab + if lextab and optimize: + if outputdir is None: + # If no output directory is set, the location of the output files + # is determined according to the following rules: + # - If lextab specifies a package, files go into that package directory + # - Otherwise, files go in the same directory as the specifying module + if isinstance(lextab, types.ModuleType): + srcfile = lextab.__file__ + else: + if '.' not in lextab: + srcfile = ldict['__file__'] + else: + parts = lextab.split('.') + pkgname = '.'.join(parts[:-1]) + exec('import %s' % pkgname) + srcfile = getattr(sys.modules[pkgname], '__file__', '') + outputdir = os.path.dirname(srcfile) + try: + lexobj.writetab(lextab, outputdir) + except IOError as e: + errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e)) + + return lexobj + +# ----------------------------------------------------------------------------- +# runmain() +# +# This runs the lexer as a main program +# ----------------------------------------------------------------------------- + +def runmain(lexer=None, data=None): + if not data: + try: + filename = sys.argv[1] + f = open(filename) + data = f.read() + f.close() + except IndexError: + sys.stdout.write('Reading from standard input (type EOF to end):\n') + data = sys.stdin.read() + + if lexer: + _input = lexer.input + else: + _input = input + _input(data) + if lexer: + _token = lexer.token + else: + _token = token + + while True: + tok = _token() + if not tok: + break + sys.stdout.write('(%s,%r,%d,%d)\n' % (tok.type, tok.value, tok.lineno, tok.lexpos)) + +# ----------------------------------------------------------------------------- +# @TOKEN(regex) +# +# This decorator function can be used to set the regex expression on a function +# when its docstring might need to be set in an alternative way +# ----------------------------------------------------------------------------- + +def TOKEN(r): + def set_regex(f): + if hasattr(r, '__call__'): + f.regex = _get_regex(r) + else: + f.regex = r + return f + return set_regex + +# Alternative spelling of the TOKEN decorator +Token = TOKEN diff --git a/jwt/python/pycparser/ply/yacc.py b/jwt/python/pycparser/ply/yacc.py new file mode 100644 index 0000000..20b4f28 --- /dev/null +++ b/jwt/python/pycparser/ply/yacc.py @@ -0,0 +1,3494 @@ +# ----------------------------------------------------------------------------- +# ply: yacc.py +# +# Copyright (C) 2001-2017 +# David M. Beazley (Dabeaz LLC) +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the David Beazley or Dabeaz LLC may be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ----------------------------------------------------------------------------- +# +# This implements an LR parser that is constructed from grammar rules defined +# as Python functions. The grammer is specified by supplying the BNF inside +# Python documentation strings. The inspiration for this technique was borrowed +# from John Aycock's Spark parsing system. PLY might be viewed as cross between +# Spark and the GNU bison utility. +# +# The current implementation is only somewhat object-oriented. The +# LR parser itself is defined in terms of an object (which allows multiple +# parsers to co-exist). However, most of the variables used during table +# construction are defined in terms of global variables. Users shouldn't +# notice unless they are trying to define multiple parsers at the same +# time using threads (in which case they should have their head examined). +# +# This implementation supports both SLR and LALR(1) parsing. LALR(1) +# support was originally implemented by Elias Ioup (ezioup@alumni.uchicago.edu), +# using the algorithm found in Aho, Sethi, and Ullman "Compilers: Principles, +# Techniques, and Tools" (The Dragon Book). LALR(1) has since been replaced +# by the more efficient DeRemer and Pennello algorithm. +# +# :::::::: WARNING ::::::: +# +# Construction of LR parsing tables is fairly complicated and expensive. +# To make this module run fast, a *LOT* of work has been put into +# optimization---often at the expensive of readability and what might +# consider to be good Python "coding style." Modify the code at your +# own risk! +# ---------------------------------------------------------------------------- + +import re +import types +import sys +import os.path +import inspect +import base64 +import warnings + +__version__ = '3.10' +__tabversion__ = '3.10' + +#----------------------------------------------------------------------------- +# === User configurable parameters === +# +# Change these to modify the default behavior of yacc (if you wish) +#----------------------------------------------------------------------------- + +yaccdebug = True # Debugging mode. If set, yacc generates a + # a 'parser.out' file in the current directory + +debug_file = 'parser.out' # Default name of the debugging file +tab_module = 'parsetab' # Default name of the table module +default_lr = 'LALR' # Default LR table generation method + +error_count = 3 # Number of symbols that must be shifted to leave recovery mode + +yaccdevel = False # Set to True if developing yacc. This turns off optimized + # implementations of certain functions. + +resultlimit = 40 # Size limit of results when running in debug mode. + +pickle_protocol = 0 # Protocol to use when writing pickle files + +# String type-checking compatibility +if sys.version_info[0] < 3: + string_types = basestring +else: + string_types = str + +MAXINT = sys.maxsize + +# This object is a stand-in for a logging object created by the +# logging module. PLY will use this by default to create things +# such as the parser.out file. If a user wants more detailed +# information, they can create their own logging object and pass +# it into PLY. + +class PlyLogger(object): + def __init__(self, f): + self.f = f + + def debug(self, msg, *args, **kwargs): + self.f.write((msg % args) + '\n') + + info = debug + + def warning(self, msg, *args, **kwargs): + self.f.write('WARNING: ' + (msg % args) + '\n') + + def error(self, msg, *args, **kwargs): + self.f.write('ERROR: ' + (msg % args) + '\n') + + critical = debug + +# Null logger is used when no output is generated. Does nothing. +class NullLogger(object): + def __getattribute__(self, name): + return self + + def __call__(self, *args, **kwargs): + return self + +# Exception raised for yacc-related errors +class YaccError(Exception): + pass + +# Format the result message that the parser produces when running in debug mode. +def format_result(r): + repr_str = repr(r) + if '\n' in repr_str: + repr_str = repr(repr_str) + if len(repr_str) > resultlimit: + repr_str = repr_str[:resultlimit] + ' ...' + result = '<%s @ 0x%x> (%s)' % (type(r).__name__, id(r), repr_str) + return result + +# Format stack entries when the parser is running in debug mode +def format_stack_entry(r): + repr_str = repr(r) + if '\n' in repr_str: + repr_str = repr(repr_str) + if len(repr_str) < 16: + return repr_str + else: + return '<%s @ 0x%x>' % (type(r).__name__, id(r)) + +# Panic mode error recovery support. This feature is being reworked--much of the +# code here is to offer a deprecation/backwards compatible transition + +_errok = None +_token = None +_restart = None +_warnmsg = '''PLY: Don't use global functions errok(), token(), and restart() in p_error(). +Instead, invoke the methods on the associated parser instance: + + def p_error(p): + ... + # Use parser.errok(), parser.token(), parser.restart() + ... + + parser = yacc.yacc() +''' + +def errok(): + warnings.warn(_warnmsg) + return _errok() + +def restart(): + warnings.warn(_warnmsg) + return _restart() + +def token(): + warnings.warn(_warnmsg) + return _token() + +# Utility function to call the p_error() function with some deprecation hacks +def call_errorfunc(errorfunc, token, parser): + global _errok, _token, _restart + _errok = parser.errok + _token = parser.token + _restart = parser.restart + r = errorfunc(token) + try: + del _errok, _token, _restart + except NameError: + pass + return r + +#----------------------------------------------------------------------------- +# === LR Parsing Engine === +# +# The following classes are used for the LR parser itself. These are not +# used during table construction and are independent of the actual LR +# table generation algorithm +#----------------------------------------------------------------------------- + +# This class is used to hold non-terminal grammar symbols during parsing. +# It normally has the following attributes set: +# .type = Grammar symbol type +# .value = Symbol value +# .lineno = Starting line number +# .endlineno = Ending line number (optional, set automatically) +# .lexpos = Starting lex position +# .endlexpos = Ending lex position (optional, set automatically) + +class YaccSymbol: + def __str__(self): + return self.type + + def __repr__(self): + return str(self) + +# This class is a wrapper around the objects actually passed to each +# grammar rule. Index lookup and assignment actually assign the +# .value attribute of the underlying YaccSymbol object. +# The lineno() method returns the line number of a given +# item (or 0 if not defined). The linespan() method returns +# a tuple of (startline,endline) representing the range of lines +# for a symbol. The lexspan() method returns a tuple (lexpos,endlexpos) +# representing the range of positional information for a symbol. + +class YaccProduction: + def __init__(self, s, stack=None): + self.slice = s + self.stack = stack + self.lexer = None + self.parser = None + + def __getitem__(self, n): + if isinstance(n, slice): + return [s.value for s in self.slice[n]] + elif n >= 0: + return self.slice[n].value + else: + return self.stack[n].value + + def __setitem__(self, n, v): + self.slice[n].value = v + + def __getslice__(self, i, j): + return [s.value for s in self.slice[i:j]] + + def __len__(self): + return len(self.slice) + + def lineno(self, n): + return getattr(self.slice[n], 'lineno', 0) + + def set_lineno(self, n, lineno): + self.slice[n].lineno = lineno + + def linespan(self, n): + startline = getattr(self.slice[n], 'lineno', 0) + endline = getattr(self.slice[n], 'endlineno', startline) + return startline, endline + + def lexpos(self, n): + return getattr(self.slice[n], 'lexpos', 0) + + def lexspan(self, n): + startpos = getattr(self.slice[n], 'lexpos', 0) + endpos = getattr(self.slice[n], 'endlexpos', startpos) + return startpos, endpos + + def error(self): + raise SyntaxError + +# ----------------------------------------------------------------------------- +# == LRParser == +# +# The LR Parsing engine. +# ----------------------------------------------------------------------------- + +class LRParser: + def __init__(self, lrtab, errorf): + self.productions = lrtab.lr_productions + self.action = lrtab.lr_action + self.goto = lrtab.lr_goto + self.errorfunc = errorf + self.set_defaulted_states() + self.errorok = True + + def errok(self): + self.errorok = True + + def restart(self): + del self.statestack[:] + del self.symstack[:] + sym = YaccSymbol() + sym.type = '$end' + self.symstack.append(sym) + self.statestack.append(0) + + # Defaulted state support. + # This method identifies parser states where there is only one possible reduction action. + # For such states, the parser can make a choose to make a rule reduction without consuming + # the next look-ahead token. This delayed invocation of the tokenizer can be useful in + # certain kinds of advanced parsing situations where the lexer and parser interact with + # each other or change states (i.e., manipulation of scope, lexer states, etc.). + # + # See: https://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions + def set_defaulted_states(self): + self.defaulted_states = {} + for state, actions in self.action.items(): + rules = list(actions.values()) + if len(rules) == 1 and rules[0] < 0: + self.defaulted_states[state] = rules[0] + + def disable_defaulted_states(self): + self.defaulted_states = {} + + def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + if debug or yaccdevel: + if isinstance(debug, int): + debug = PlyLogger(sys.stderr) + return self.parsedebug(input, lexer, debug, tracking, tokenfunc) + elif tracking: + return self.parseopt(input, lexer, debug, tracking, tokenfunc) + else: + return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) + + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parsedebug(). + # + # This is the debugging enabled version of parse(). All changes made to the + # parsing engine should be made here. Optimized versions of this function + # are automatically created by the ply/ygen.py script. This script cuts out + # sections enclosed in markers such as this: + # + # #--! DEBUG + # statements + # #--! DEBUG + # + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parsedebug-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + #--! DEBUG + debug.info('PLY: PARSE DEBUG START') + #--! DEBUG + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + #--! DEBUG + debug.debug('') + debug.debug('State : %s', state) + #--! DEBUG + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + #--! DEBUG + debug.debug('Defaulted state %s: Reduce using %d', state, -t) + #--! DEBUG + + #--! DEBUG + debug.debug('Stack : %s', + ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) + #--! DEBUG + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + #--! DEBUG + debug.debug('Action : Shift and goto state %s', t) + #--! DEBUG + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + #--! DEBUG + if plen: + debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, + '['+','.join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+']', + goto[statestack[-1-plen]][pname]) + else: + debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, [], + goto[statestack[-1]][pname]) + + #--! DEBUG + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + #--! TRACKING + if tracking: + t1 = targ[1] + sym.lineno = t1.lineno + sym.lexpos = t1.lexpos + t1 = targ[-1] + sym.endlineno = getattr(t1, 'endlineno', t1.lineno) + sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos) + #--! TRACKING + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + #--! DEBUG + debug.info('Result : %s', format_result(pslice[0])) + #--! DEBUG + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + #--! TRACKING + if tracking: + sym.lineno = lexer.lineno + sym.lexpos = lexer.lexpos + #--! TRACKING + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + #--! DEBUG + debug.info('Result : %s', format_result(pslice[0])) + #--! DEBUG + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + #--! DEBUG + debug.info('Done : Returning %s', format_result(result)) + debug.info('PLY: PARSE DEBUG END') + #--! DEBUG + return result + + if t is None: + + #--! DEBUG + debug.error('Error : %s', + ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) + #--! DEBUG + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + #--! TRACKING + if tracking: + sym.endlineno = getattr(lookahead, 'lineno', sym.lineno) + sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos) + #--! TRACKING + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + #--! TRACKING + if tracking: + lookahead.lineno = sym.lineno + lookahead.lexpos = sym.lexpos + #--! TRACKING + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parsedebug-end + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parseopt(). + # + # Optimized version of parse() method. DO NOT EDIT THIS CODE DIRECTLY! + # This code is automatically generated by the ply/ygen.py script. Make + # changes to the parsedebug() method instead. + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parseopt-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + #--! TRACKING + if tracking: + t1 = targ[1] + sym.lineno = t1.lineno + sym.lexpos = t1.lexpos + t1 = targ[-1] + sym.endlineno = getattr(t1, 'endlineno', t1.lineno) + sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos) + #--! TRACKING + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + #--! TRACKING + if tracking: + sym.lineno = lexer.lineno + sym.lexpos = lexer.lexpos + #--! TRACKING + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + return result + + if t is None: + + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + #--! TRACKING + if tracking: + sym.endlineno = getattr(lookahead, 'lineno', sym.lineno) + sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos) + #--! TRACKING + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + #--! TRACKING + if tracking: + lookahead.lineno = sym.lineno + lookahead.lexpos = sym.lexpos + #--! TRACKING + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parseopt-end + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # parseopt_notrack(). + # + # Optimized version of parseopt() with line number tracking removed. + # DO NOT EDIT THIS CODE DIRECTLY. This code is automatically generated + # by the ply/ygen.py script. Make changes to the parsedebug() method instead. + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None): + #--! parseopt-notrack-start + lookahead = None # Current lookahead symbol + lookaheadstack = [] # Stack of lookahead symbols + actions = self.action # Local reference to action table (to avoid lookup on self.) + goto = self.goto # Local reference to goto table (to avoid lookup on self.) + prod = self.productions # Local reference to production list (to avoid lookup on self.) + defaulted_states = self.defaulted_states # Local reference to defaulted states + pslice = YaccProduction(None) # Production object passed to grammar rules + errorcount = 0 # Used during error recovery + + + # If no lexer was given, we will try to use the lex module + if not lexer: + from . import lex + lexer = lex.lexer + + # Set up the lexer and parser objects on pslice + pslice.lexer = lexer + pslice.parser = self + + # If input was supplied, pass to lexer + if input is not None: + lexer.input(input) + + if tokenfunc is None: + # Tokenize function + get_token = lexer.token + else: + get_token = tokenfunc + + # Set the parser() token method (sometimes used in error recovery) + self.token = get_token + + # Set up the state and symbol stacks + + statestack = [] # Stack of parsing states + self.statestack = statestack + symstack = [] # Stack of grammar symbols + self.symstack = symstack + + pslice.stack = symstack # Put in the production + errtoken = None # Err token + + # The start state is assumed to be (0,$end) + + statestack.append(0) + sym = YaccSymbol() + sym.type = '$end' + symstack.append(sym) + state = 0 + while True: + # Get the next symbol on the input. If a lookahead symbol + # is already set, we just use that. Otherwise, we'll pull + # the next token off of the lookaheadstack or from the lexer + + + if state not in defaulted_states: + if not lookahead: + if not lookaheadstack: + lookahead = get_token() # Get the next token + else: + lookahead = lookaheadstack.pop() + if not lookahead: + lookahead = YaccSymbol() + lookahead.type = '$end' + + # Check the action table + ltype = lookahead.type + t = actions[state].get(ltype) + else: + t = defaulted_states[state] + + + if t is not None: + if t > 0: + # shift a symbol on the stack + statestack.append(t) + state = t + + + symstack.append(lookahead) + lookahead = None + + # Decrease error count on successful shift + if errorcount: + errorcount -= 1 + continue + + if t < 0: + # reduce a symbol on the stack, emit a production + p = prod[-t] + pname = p.name + plen = p.len + + # Get production function + sym = YaccSymbol() + sym.type = pname # Production name + sym.value = None + + + if plen: + targ = symstack[-plen-1:] + targ[0] = sym + + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # below as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + del symstack[-plen:] + self.state = state + p.callable(pslice) + del statestack[-plen:] + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + symstack.extend(targ[1:-1]) # Put the production slice back on the stack + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + else: + + + targ = [sym] + + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + # The code enclosed in this section is duplicated + # above as a performance optimization. Make sure + # changes get made in both locations. + + pslice.slice = targ + + try: + # Call the grammar rule with our special slice object + self.state = state + p.callable(pslice) + symstack.append(sym) + state = goto[statestack[-1]][pname] + statestack.append(state) + except SyntaxError: + # If an error was set. Enter error recovery state + lookaheadstack.append(lookahead) # Save the current lookahead token + statestack.pop() # Pop back one state (before the reduce) + state = statestack[-1] + sym.type = 'error' + sym.value = 'error' + lookahead = sym + errorcount = error_count + self.errorok = False + + continue + # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if t == 0: + n = symstack[-1] + result = getattr(n, 'value', None) + return result + + if t is None: + + + # We have some kind of parsing error here. To handle + # this, we are going to push the current token onto + # the tokenstack and replace it with an 'error' token. + # If there are any synchronization rules, they may + # catch it. + # + # In addition to pushing the error token, we call call + # the user defined p_error() function if this is the + # first syntax error. This function is only called if + # errorcount == 0. + if errorcount == 0 or self.errorok: + errorcount = error_count + self.errorok = False + errtoken = lookahead + if errtoken.type == '$end': + errtoken = None # End of file! + if self.errorfunc: + if errtoken and not hasattr(errtoken, 'lexer'): + errtoken.lexer = lexer + self.state = state + tok = call_errorfunc(self.errorfunc, errtoken, self) + if self.errorok: + # User must have done some kind of panic + # mode recovery on their own. The + # returned token is the next lookahead + lookahead = tok + errtoken = None + continue + else: + if errtoken: + if hasattr(errtoken, 'lineno'): + lineno = lookahead.lineno + else: + lineno = 0 + if lineno: + sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type)) + else: + sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type) + else: + sys.stderr.write('yacc: Parse error in input. EOF\n') + return + + else: + errorcount = error_count + + # case 1: the statestack only has 1 entry on it. If we're in this state, the + # entire parse has been rolled back and we're completely hosed. The token is + # discarded and we just keep going. + + if len(statestack) <= 1 and lookahead.type != '$end': + lookahead = None + errtoken = None + state = 0 + # Nuke the pushback stack + del lookaheadstack[:] + continue + + # case 2: the statestack has a couple of entries on it, but we're + # at the end of the file. nuke the top entry and generate an error token + + # Start nuking entries on the stack + if lookahead.type == '$end': + # Whoa. We're really hosed here. Bail out + return + + if lookahead.type != 'error': + sym = symstack[-1] + if sym.type == 'error': + # Hmmm. Error is on top of stack, we'll just nuke input + # symbol and continue + lookahead = None + continue + + # Create the error symbol for the first time and make it the new lookahead symbol + t = YaccSymbol() + t.type = 'error' + + if hasattr(lookahead, 'lineno'): + t.lineno = t.endlineno = lookahead.lineno + if hasattr(lookahead, 'lexpos'): + t.lexpos = t.endlexpos = lookahead.lexpos + t.value = lookahead + lookaheadstack.append(lookahead) + lookahead = t + else: + sym = symstack.pop() + statestack.pop() + state = statestack[-1] + + continue + + # Call an error function here + raise RuntimeError('yacc: internal parser error!!!\n') + + #--! parseopt-notrack-end + +# ----------------------------------------------------------------------------- +# === Grammar Representation === +# +# The following functions, classes, and variables are used to represent and +# manipulate the rules that make up a grammar. +# ----------------------------------------------------------------------------- + +# regex matching identifiers +_is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$') + +# ----------------------------------------------------------------------------- +# class Production: +# +# This class stores the raw information about a single production or grammar rule. +# A grammar rule refers to a specification such as this: +# +# expr : expr PLUS term +# +# Here are the basic attributes defined on all productions +# +# name - Name of the production. For example 'expr' +# prod - A list of symbols on the right side ['expr','PLUS','term'] +# prec - Production precedence level +# number - Production number. +# func - Function that executes on reduce +# file - File where production function is defined +# lineno - Line number where production function is defined +# +# The following attributes are defined or optional. +# +# len - Length of the production (number of symbols on right hand side) +# usyms - Set of unique symbols found in the production +# ----------------------------------------------------------------------------- + +class Production(object): + reduced = 0 + def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0): + self.name = name + self.prod = tuple(prod) + self.number = number + self.func = func + self.callable = None + self.file = file + self.line = line + self.prec = precedence + + # Internal settings used during table construction + + self.len = len(self.prod) # Length of the production + + # Create a list of unique production symbols used in the production + self.usyms = [] + for s in self.prod: + if s not in self.usyms: + self.usyms.append(s) + + # List of all LR items for the production + self.lr_items = [] + self.lr_next = None + + # Create a string representation + if self.prod: + self.str = '%s -> %s' % (self.name, ' '.join(self.prod)) + else: + self.str = '%s -> ' % self.name + + def __str__(self): + return self.str + + def __repr__(self): + return 'Production(' + str(self) + ')' + + def __len__(self): + return len(self.prod) + + def __nonzero__(self): + return 1 + + def __getitem__(self, index): + return self.prod[index] + + # Return the nth lr_item from the production (or None if at the end) + def lr_item(self, n): + if n > len(self.prod): + return None + p = LRItem(self, n) + # Precompute the list of productions immediately following. + try: + p.lr_after = Prodnames[p.prod[n+1]] + except (IndexError, KeyError): + p.lr_after = [] + try: + p.lr_before = p.prod[n-1] + except IndexError: + p.lr_before = None + return p + + # Bind the production function name to a callable + def bind(self, pdict): + if self.func: + self.callable = pdict[self.func] + +# This class serves as a minimal standin for Production objects when +# reading table data from files. It only contains information +# actually used by the LR parsing engine, plus some additional +# debugging information. +class MiniProduction(object): + def __init__(self, str, name, len, func, file, line): + self.name = name + self.len = len + self.func = func + self.callable = None + self.file = file + self.line = line + self.str = str + + def __str__(self): + return self.str + + def __repr__(self): + return 'MiniProduction(%s)' % self.str + + # Bind the production function name to a callable + def bind(self, pdict): + if self.func: + self.callable = pdict[self.func] + + +# ----------------------------------------------------------------------------- +# class LRItem +# +# This class represents a specific stage of parsing a production rule. For +# example: +# +# expr : expr . PLUS term +# +# In the above, the "." represents the current location of the parse. Here +# basic attributes: +# +# name - Name of the production. For example 'expr' +# prod - A list of symbols on the right side ['expr','.', 'PLUS','term'] +# number - Production number. +# +# lr_next Next LR item. Example, if we are ' expr -> expr . PLUS term' +# then lr_next refers to 'expr -> expr PLUS . term' +# lr_index - LR item index (location of the ".") in the prod list. +# lookaheads - LALR lookahead symbols for this item +# len - Length of the production (number of symbols on right hand side) +# lr_after - List of all productions that immediately follow +# lr_before - Grammar symbol immediately before +# ----------------------------------------------------------------------------- + +class LRItem(object): + def __init__(self, p, n): + self.name = p.name + self.prod = list(p.prod) + self.number = p.number + self.lr_index = n + self.lookaheads = {} + self.prod.insert(n, '.') + self.prod = tuple(self.prod) + self.len = len(self.prod) + self.usyms = p.usyms + + def __str__(self): + if self.prod: + s = '%s -> %s' % (self.name, ' '.join(self.prod)) + else: + s = '%s -> ' % self.name + return s + + def __repr__(self): + return 'LRItem(' + str(self) + ')' + +# ----------------------------------------------------------------------------- +# rightmost_terminal() +# +# Return the rightmost terminal from a list of symbols. Used in add_production() +# ----------------------------------------------------------------------------- +def rightmost_terminal(symbols, terminals): + i = len(symbols) - 1 + while i >= 0: + if symbols[i] in terminals: + return symbols[i] + i -= 1 + return None + +# ----------------------------------------------------------------------------- +# === GRAMMAR CLASS === +# +# The following class represents the contents of the specified grammar along +# with various computed properties such as first sets, follow sets, LR items, etc. +# This data is used for critical parts of the table generation process later. +# ----------------------------------------------------------------------------- + +class GrammarError(YaccError): + pass + +class Grammar(object): + def __init__(self, terminals): + self.Productions = [None] # A list of all of the productions. The first + # entry is always reserved for the purpose of + # building an augmented grammar + + self.Prodnames = {} # A dictionary mapping the names of nonterminals to a list of all + # productions of that nonterminal. + + self.Prodmap = {} # A dictionary that is only used to detect duplicate + # productions. + + self.Terminals = {} # A dictionary mapping the names of terminal symbols to a + # list of the rules where they are used. + + for term in terminals: + self.Terminals[term] = [] + + self.Terminals['error'] = [] + + self.Nonterminals = {} # A dictionary mapping names of nonterminals to a list + # of rule numbers where they are used. + + self.First = {} # A dictionary of precomputed FIRST(x) symbols + + self.Follow = {} # A dictionary of precomputed FOLLOW(x) symbols + + self.Precedence = {} # Precedence rules for each terminal. Contains tuples of the + # form ('right',level) or ('nonassoc', level) or ('left',level) + + self.UsedPrecedence = set() # Precedence rules that were actually used by the grammer. + # This is only used to provide error checking and to generate + # a warning about unused precedence rules. + + self.Start = None # Starting symbol for the grammar + + + def __len__(self): + return len(self.Productions) + + def __getitem__(self, index): + return self.Productions[index] + + # ----------------------------------------------------------------------------- + # set_precedence() + # + # Sets the precedence for a given terminal. assoc is the associativity such as + # 'left','right', or 'nonassoc'. level is a numeric level. + # + # ----------------------------------------------------------------------------- + + def set_precedence(self, term, assoc, level): + assert self.Productions == [None], 'Must call set_precedence() before add_production()' + if term in self.Precedence: + raise GrammarError('Precedence already specified for terminal %r' % term) + if assoc not in ['left', 'right', 'nonassoc']: + raise GrammarError("Associativity must be one of 'left','right', or 'nonassoc'") + self.Precedence[term] = (assoc, level) + + # ----------------------------------------------------------------------------- + # add_production() + # + # Given an action function, this function assembles a production rule and + # computes its precedence level. + # + # The production rule is supplied as a list of symbols. For example, + # a rule such as 'expr : expr PLUS term' has a production name of 'expr' and + # symbols ['expr','PLUS','term']. + # + # Precedence is determined by the precedence of the right-most non-terminal + # or the precedence of a terminal specified by %prec. + # + # A variety of error checks are performed to make sure production symbols + # are valid and that %prec is used correctly. + # ----------------------------------------------------------------------------- + + def add_production(self, prodname, syms, func=None, file='', line=0): + + if prodname in self.Terminals: + raise GrammarError('%s:%d: Illegal rule name %r. Already defined as a token' % (file, line, prodname)) + if prodname == 'error': + raise GrammarError('%s:%d: Illegal rule name %r. error is a reserved word' % (file, line, prodname)) + if not _is_identifier.match(prodname): + raise GrammarError('%s:%d: Illegal rule name %r' % (file, line, prodname)) + + # Look for literal tokens + for n, s in enumerate(syms): + if s[0] in "'\"": + try: + c = eval(s) + if (len(c) > 1): + raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' % + (file, line, s, prodname)) + if c not in self.Terminals: + self.Terminals[c] = [] + syms[n] = c + continue + except SyntaxError: + pass + if not _is_identifier.match(s) and s != '%prec': + raise GrammarError('%s:%d: Illegal name %r in rule %r' % (file, line, s, prodname)) + + # Determine the precedence level + if '%prec' in syms: + if syms[-1] == '%prec': + raise GrammarError('%s:%d: Syntax error. Nothing follows %%prec' % (file, line)) + if syms[-2] != '%prec': + raise GrammarError('%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule' % + (file, line)) + precname = syms[-1] + prodprec = self.Precedence.get(precname) + if not prodprec: + raise GrammarError('%s:%d: Nothing known about the precedence of %r' % (file, line, precname)) + else: + self.UsedPrecedence.add(precname) + del syms[-2:] # Drop %prec from the rule + else: + # If no %prec, precedence is determined by the rightmost terminal symbol + precname = rightmost_terminal(syms, self.Terminals) + prodprec = self.Precedence.get(precname, ('right', 0)) + + # See if the rule is already in the rulemap + map = '%s -> %s' % (prodname, syms) + if map in self.Prodmap: + m = self.Prodmap[map] + raise GrammarError('%s:%d: Duplicate rule %s. ' % (file, line, m) + + 'Previous definition at %s:%d' % (m.file, m.line)) + + # From this point on, everything is valid. Create a new Production instance + pnumber = len(self.Productions) + if prodname not in self.Nonterminals: + self.Nonterminals[prodname] = [] + + # Add the production number to Terminals and Nonterminals + for t in syms: + if t in self.Terminals: + self.Terminals[t].append(pnumber) + else: + if t not in self.Nonterminals: + self.Nonterminals[t] = [] + self.Nonterminals[t].append(pnumber) + + # Create a production and add it to the list of productions + p = Production(pnumber, prodname, syms, prodprec, func, file, line) + self.Productions.append(p) + self.Prodmap[map] = p + + # Add to the global productions list + try: + self.Prodnames[prodname].append(p) + except KeyError: + self.Prodnames[prodname] = [p] + + # ----------------------------------------------------------------------------- + # set_start() + # + # Sets the starting symbol and creates the augmented grammar. Production + # rule 0 is S' -> start where start is the start symbol. + # ----------------------------------------------------------------------------- + + def set_start(self, start=None): + if not start: + start = self.Productions[1].name + if start not in self.Nonterminals: + raise GrammarError('start symbol %s undefined' % start) + self.Productions[0] = Production(0, "S'", [start]) + self.Nonterminals[start].append(0) + self.Start = start + + # ----------------------------------------------------------------------------- + # find_unreachable() + # + # Find all of the nonterminal symbols that can't be reached from the starting + # symbol. Returns a list of nonterminals that can't be reached. + # ----------------------------------------------------------------------------- + + def find_unreachable(self): + + # Mark all symbols that are reachable from a symbol s + def mark_reachable_from(s): + if s in reachable: + return + reachable.add(s) + for p in self.Prodnames.get(s, []): + for r in p.prod: + mark_reachable_from(r) + + reachable = set() + mark_reachable_from(self.Productions[0].prod[0]) + return [s for s in self.Nonterminals if s not in reachable] + + # ----------------------------------------------------------------------------- + # infinite_cycles() + # + # This function looks at the various parsing rules and tries to detect + # infinite recursion cycles (grammar rules where there is no possible way + # to derive a string of only terminals). + # ----------------------------------------------------------------------------- + + def infinite_cycles(self): + terminates = {} + + # Terminals: + for t in self.Terminals: + terminates[t] = True + + terminates['$end'] = True + + # Nonterminals: + + # Initialize to false: + for n in self.Nonterminals: + terminates[n] = False + + # Then propagate termination until no change: + while True: + some_change = False + for (n, pl) in self.Prodnames.items(): + # Nonterminal n terminates iff any of its productions terminates. + for p in pl: + # Production p terminates iff all of its rhs symbols terminate. + for s in p.prod: + if not terminates[s]: + # The symbol s does not terminate, + # so production p does not terminate. + p_terminates = False + break + else: + # didn't break from the loop, + # so every symbol s terminates + # so production p terminates. + p_terminates = True + + if p_terminates: + # symbol n terminates! + if not terminates[n]: + terminates[n] = True + some_change = True + # Don't need to consider any more productions for this n. + break + + if not some_change: + break + + infinite = [] + for (s, term) in terminates.items(): + if not term: + if s not in self.Prodnames and s not in self.Terminals and s != 'error': + # s is used-but-not-defined, and we've already warned of that, + # so it would be overkill to say that it's also non-terminating. + pass + else: + infinite.append(s) + + return infinite + + # ----------------------------------------------------------------------------- + # undefined_symbols() + # + # Find all symbols that were used the grammar, but not defined as tokens or + # grammar rules. Returns a list of tuples (sym, prod) where sym in the symbol + # and prod is the production where the symbol was used. + # ----------------------------------------------------------------------------- + def undefined_symbols(self): + result = [] + for p in self.Productions: + if not p: + continue + + for s in p.prod: + if s not in self.Prodnames and s not in self.Terminals and s != 'error': + result.append((s, p)) + return result + + # ----------------------------------------------------------------------------- + # unused_terminals() + # + # Find all terminals that were defined, but not used by the grammar. Returns + # a list of all symbols. + # ----------------------------------------------------------------------------- + def unused_terminals(self): + unused_tok = [] + for s, v in self.Terminals.items(): + if s != 'error' and not v: + unused_tok.append(s) + + return unused_tok + + # ------------------------------------------------------------------------------ + # unused_rules() + # + # Find all grammar rules that were defined, but not used (maybe not reachable) + # Returns a list of productions. + # ------------------------------------------------------------------------------ + + def unused_rules(self): + unused_prod = [] + for s, v in self.Nonterminals.items(): + if not v: + p = self.Prodnames[s][0] + unused_prod.append(p) + return unused_prod + + # ----------------------------------------------------------------------------- + # unused_precedence() + # + # Returns a list of tuples (term,precedence) corresponding to precedence + # rules that were never used by the grammar. term is the name of the terminal + # on which precedence was applied and precedence is a string such as 'left' or + # 'right' corresponding to the type of precedence. + # ----------------------------------------------------------------------------- + + def unused_precedence(self): + unused = [] + for termname in self.Precedence: + if not (termname in self.Terminals or termname in self.UsedPrecedence): + unused.append((termname, self.Precedence[termname][0])) + + return unused + + # ------------------------------------------------------------------------- + # _first() + # + # Compute the value of FIRST1(beta) where beta is a tuple of symbols. + # + # During execution of compute_first1, the result may be incomplete. + # Afterward (e.g., when called from compute_follow()), it will be complete. + # ------------------------------------------------------------------------- + def _first(self, beta): + + # We are computing First(x1,x2,x3,...,xn) + result = [] + for x in beta: + x_produces_empty = False + + # Add all the non- symbols of First[x] to the result. + for f in self.First[x]: + if f == '': + x_produces_empty = True + else: + if f not in result: + result.append(f) + + if x_produces_empty: + # We have to consider the next x in beta, + # i.e. stay in the loop. + pass + else: + # We don't have to consider any further symbols in beta. + break + else: + # There was no 'break' from the loop, + # so x_produces_empty was true for all x in beta, + # so beta produces empty as well. + result.append('') + + return result + + # ------------------------------------------------------------------------- + # compute_first() + # + # Compute the value of FIRST1(X) for all symbols + # ------------------------------------------------------------------------- + def compute_first(self): + if self.First: + return self.First + + # Terminals: + for t in self.Terminals: + self.First[t] = [t] + + self.First['$end'] = ['$end'] + + # Nonterminals: + + # Initialize to the empty set: + for n in self.Nonterminals: + self.First[n] = [] + + # Then propagate symbols until no change: + while True: + some_change = False + for n in self.Nonterminals: + for p in self.Prodnames[n]: + for f in self._first(p.prod): + if f not in self.First[n]: + self.First[n].append(f) + some_change = True + if not some_change: + break + + return self.First + + # --------------------------------------------------------------------- + # compute_follow() + # + # Computes all of the follow sets for every non-terminal symbol. The + # follow set is the set of all symbols that might follow a given + # non-terminal. See the Dragon book, 2nd Ed. p. 189. + # --------------------------------------------------------------------- + def compute_follow(self, start=None): + # If already computed, return the result + if self.Follow: + return self.Follow + + # If first sets not computed yet, do that first. + if not self.First: + self.compute_first() + + # Add '$end' to the follow list of the start symbol + for k in self.Nonterminals: + self.Follow[k] = [] + + if not start: + start = self.Productions[1].name + + self.Follow[start] = ['$end'] + + while True: + didadd = False + for p in self.Productions[1:]: + # Here is the production set + for i, B in enumerate(p.prod): + if B in self.Nonterminals: + # Okay. We got a non-terminal in a production + fst = self._first(p.prod[i+1:]) + hasempty = False + for f in fst: + if f != '' and f not in self.Follow[B]: + self.Follow[B].append(f) + didadd = True + if f == '': + hasempty = True + if hasempty or i == (len(p.prod)-1): + # Add elements of follow(a) to follow(b) + for f in self.Follow[p.name]: + if f not in self.Follow[B]: + self.Follow[B].append(f) + didadd = True + if not didadd: + break + return self.Follow + + + # ----------------------------------------------------------------------------- + # build_lritems() + # + # This function walks the list of productions and builds a complete set of the + # LR items. The LR items are stored in two ways: First, they are uniquely + # numbered and placed in the list _lritems. Second, a linked list of LR items + # is built for each production. For example: + # + # E -> E PLUS E + # + # Creates the list + # + # [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ] + # ----------------------------------------------------------------------------- + + def build_lritems(self): + for p in self.Productions: + lastlri = p + i = 0 + lr_items = [] + while True: + if i > len(p): + lri = None + else: + lri = LRItem(p, i) + # Precompute the list of productions immediately following + try: + lri.lr_after = self.Prodnames[lri.prod[i+1]] + except (IndexError, KeyError): + lri.lr_after = [] + try: + lri.lr_before = lri.prod[i-1] + except IndexError: + lri.lr_before = None + + lastlri.lr_next = lri + if not lri: + break + lr_items.append(lri) + lastlri = lri + i += 1 + p.lr_items = lr_items + +# ----------------------------------------------------------------------------- +# == Class LRTable == +# +# This basic class represents a basic table of LR parsing information. +# Methods for generating the tables are not defined here. They are defined +# in the derived class LRGeneratedTable. +# ----------------------------------------------------------------------------- + +class VersionError(YaccError): + pass + +class LRTable(object): + def __init__(self): + self.lr_action = None + self.lr_goto = None + self.lr_productions = None + self.lr_method = None + + def read_table(self, module): + if isinstance(module, types.ModuleType): + parsetab = module + else: + exec('import %s' % module) + parsetab = sys.modules[module] + + if parsetab._tabversion != __tabversion__: + raise VersionError('yacc table file version is out of date') + + self.lr_action = parsetab._lr_action + self.lr_goto = parsetab._lr_goto + + self.lr_productions = [] + for p in parsetab._lr_productions: + self.lr_productions.append(MiniProduction(*p)) + + self.lr_method = parsetab._lr_method + return parsetab._lr_signature + + def read_pickle(self, filename): + try: + import cPickle as pickle + except ImportError: + import pickle + + if not os.path.exists(filename): + raise ImportError + + in_f = open(filename, 'rb') + + tabversion = pickle.load(in_f) + if tabversion != __tabversion__: + raise VersionError('yacc table file version is out of date') + self.lr_method = pickle.load(in_f) + signature = pickle.load(in_f) + self.lr_action = pickle.load(in_f) + self.lr_goto = pickle.load(in_f) + productions = pickle.load(in_f) + + self.lr_productions = [] + for p in productions: + self.lr_productions.append(MiniProduction(*p)) + + in_f.close() + return signature + + # Bind all production function names to callable objects in pdict + def bind_callables(self, pdict): + for p in self.lr_productions: + p.bind(pdict) + + +# ----------------------------------------------------------------------------- +# === LR Generator === +# +# The following classes and functions are used to generate LR parsing tables on +# a grammar. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# digraph() +# traverse() +# +# The following two functions are used to compute set valued functions +# of the form: +# +# F(x) = F'(x) U U{F(y) | x R y} +# +# This is used to compute the values of Read() sets as well as FOLLOW sets +# in LALR(1) generation. +# +# Inputs: X - An input set +# R - A relation +# FP - Set-valued function +# ------------------------------------------------------------------------------ + +def digraph(X, R, FP): + N = {} + for x in X: + N[x] = 0 + stack = [] + F = {} + for x in X: + if N[x] == 0: + traverse(x, N, stack, F, X, R, FP) + return F + +def traverse(x, N, stack, F, X, R, FP): + stack.append(x) + d = len(stack) + N[x] = d + F[x] = FP(x) # F(X) <- F'(x) + + rel = R(x) # Get y's related to x + for y in rel: + if N[y] == 0: + traverse(y, N, stack, F, X, R, FP) + N[x] = min(N[x], N[y]) + for a in F.get(y, []): + if a not in F[x]: + F[x].append(a) + if N[x] == d: + N[stack[-1]] = MAXINT + F[stack[-1]] = F[x] + element = stack.pop() + while element != x: + N[stack[-1]] = MAXINT + F[stack[-1]] = F[x] + element = stack.pop() + +class LALRError(YaccError): + pass + +# ----------------------------------------------------------------------------- +# == LRGeneratedTable == +# +# This class implements the LR table generation algorithm. There are no +# public methods except for write() +# ----------------------------------------------------------------------------- + +class LRGeneratedTable(LRTable): + def __init__(self, grammar, method='LALR', log=None): + if method not in ['SLR', 'LALR']: + raise LALRError('Unsupported method %s' % method) + + self.grammar = grammar + self.lr_method = method + + # Set up the logger + if not log: + log = NullLogger() + self.log = log + + # Internal attributes + self.lr_action = {} # Action table + self.lr_goto = {} # Goto table + self.lr_productions = grammar.Productions # Copy of grammar Production array + self.lr_goto_cache = {} # Cache of computed gotos + self.lr0_cidhash = {} # Cache of closures + + self._add_count = 0 # Internal counter used to detect cycles + + # Diagonistic information filled in by the table generator + self.sr_conflict = 0 + self.rr_conflict = 0 + self.conflicts = [] # List of conflicts + + self.sr_conflicts = [] + self.rr_conflicts = [] + + # Build the tables + self.grammar.build_lritems() + self.grammar.compute_first() + self.grammar.compute_follow() + self.lr_parse_table() + + # Compute the LR(0) closure operation on I, where I is a set of LR(0) items. + + def lr0_closure(self, I): + self._add_count += 1 + + # Add everything in I to J + J = I[:] + didadd = True + while didadd: + didadd = False + for j in J: + for x in j.lr_after: + if getattr(x, 'lr0_added', 0) == self._add_count: + continue + # Add B --> .G to J + J.append(x.lr_next) + x.lr0_added = self._add_count + didadd = True + + return J + + # Compute the LR(0) goto function goto(I,X) where I is a set + # of LR(0) items and X is a grammar symbol. This function is written + # in a way that guarantees uniqueness of the generated goto sets + # (i.e. the same goto set will never be returned as two different Python + # objects). With uniqueness, we can later do fast set comparisons using + # id(obj) instead of element-wise comparison. + + def lr0_goto(self, I, x): + # First we look for a previously cached entry + g = self.lr_goto_cache.get((id(I), x)) + if g: + return g + + # Now we generate the goto set in a way that guarantees uniqueness + # of the result + + s = self.lr_goto_cache.get(x) + if not s: + s = {} + self.lr_goto_cache[x] = s + + gs = [] + for p in I: + n = p.lr_next + if n and n.lr_before == x: + s1 = s.get(id(n)) + if not s1: + s1 = {} + s[id(n)] = s1 + gs.append(n) + s = s1 + g = s.get('$end') + if not g: + if gs: + g = self.lr0_closure(gs) + s['$end'] = g + else: + s['$end'] = gs + self.lr_goto_cache[(id(I), x)] = g + return g + + # Compute the LR(0) sets of item function + def lr0_items(self): + C = [self.lr0_closure([self.grammar.Productions[0].lr_next])] + i = 0 + for I in C: + self.lr0_cidhash[id(I)] = i + i += 1 + + # Loop over the items in C and each grammar symbols + i = 0 + while i < len(C): + I = C[i] + i += 1 + + # Collect all of the symbols that could possibly be in the goto(I,X) sets + asyms = {} + for ii in I: + for s in ii.usyms: + asyms[s] = None + + for x in asyms: + g = self.lr0_goto(I, x) + if not g or id(g) in self.lr0_cidhash: + continue + self.lr0_cidhash[id(g)] = len(C) + C.append(g) + + return C + + # ----------------------------------------------------------------------------- + # ==== LALR(1) Parsing ==== + # + # LALR(1) parsing is almost exactly the same as SLR except that instead of + # relying upon Follow() sets when performing reductions, a more selective + # lookahead set that incorporates the state of the LR(0) machine is utilized. + # Thus, we mainly just have to focus on calculating the lookahead sets. + # + # The method used here is due to DeRemer and Pennelo (1982). + # + # DeRemer, F. L., and T. J. Pennelo: "Efficient Computation of LALR(1) + # Lookahead Sets", ACM Transactions on Programming Languages and Systems, + # Vol. 4, No. 4, Oct. 1982, pp. 615-649 + # + # Further details can also be found in: + # + # J. Tremblay and P. Sorenson, "The Theory and Practice of Compiler Writing", + # McGraw-Hill Book Company, (1985). + # + # ----------------------------------------------------------------------------- + + # ----------------------------------------------------------------------------- + # compute_nullable_nonterminals() + # + # Creates a dictionary containing all of the non-terminals that might produce + # an empty production. + # ----------------------------------------------------------------------------- + + def compute_nullable_nonterminals(self): + nullable = set() + num_nullable = 0 + while True: + for p in self.grammar.Productions[1:]: + if p.len == 0: + nullable.add(p.name) + continue + for t in p.prod: + if t not in nullable: + break + else: + nullable.add(p.name) + if len(nullable) == num_nullable: + break + num_nullable = len(nullable) + return nullable + + # ----------------------------------------------------------------------------- + # find_nonterminal_trans(C) + # + # Given a set of LR(0) items, this functions finds all of the non-terminal + # transitions. These are transitions in which a dot appears immediately before + # a non-terminal. Returns a list of tuples of the form (state,N) where state + # is the state number and N is the nonterminal symbol. + # + # The input C is the set of LR(0) items. + # ----------------------------------------------------------------------------- + + def find_nonterminal_transitions(self, C): + trans = [] + for stateno, state in enumerate(C): + for p in state: + if p.lr_index < p.len - 1: + t = (stateno, p.prod[p.lr_index+1]) + if t[1] in self.grammar.Nonterminals: + if t not in trans: + trans.append(t) + return trans + + # ----------------------------------------------------------------------------- + # dr_relation() + # + # Computes the DR(p,A) relationships for non-terminal transitions. The input + # is a tuple (state,N) where state is a number and N is a nonterminal symbol. + # + # Returns a list of terminals. + # ----------------------------------------------------------------------------- + + def dr_relation(self, C, trans, nullable): + dr_set = {} + state, N = trans + terms = [] + + g = self.lr0_goto(C[state], N) + for p in g: + if p.lr_index < p.len - 1: + a = p.prod[p.lr_index+1] + if a in self.grammar.Terminals: + if a not in terms: + terms.append(a) + + # This extra bit is to handle the start state + if state == 0 and N == self.grammar.Productions[0].prod[0]: + terms.append('$end') + + return terms + + # ----------------------------------------------------------------------------- + # reads_relation() + # + # Computes the READS() relation (p,A) READS (t,C). + # ----------------------------------------------------------------------------- + + def reads_relation(self, C, trans, empty): + # Look for empty transitions + rel = [] + state, N = trans + + g = self.lr0_goto(C[state], N) + j = self.lr0_cidhash.get(id(g), -1) + for p in g: + if p.lr_index < p.len - 1: + a = p.prod[p.lr_index + 1] + if a in empty: + rel.append((j, a)) + + return rel + + # ----------------------------------------------------------------------------- + # compute_lookback_includes() + # + # Determines the lookback and includes relations + # + # LOOKBACK: + # + # This relation is determined by running the LR(0) state machine forward. + # For example, starting with a production "N : . A B C", we run it forward + # to obtain "N : A B C ." We then build a relationship between this final + # state and the starting state. These relationships are stored in a dictionary + # lookdict. + # + # INCLUDES: + # + # Computes the INCLUDE() relation (p,A) INCLUDES (p',B). + # + # This relation is used to determine non-terminal transitions that occur + # inside of other non-terminal transition states. (p,A) INCLUDES (p', B) + # if the following holds: + # + # B -> LAT, where T -> epsilon and p' -L-> p + # + # L is essentially a prefix (which may be empty), T is a suffix that must be + # able to derive an empty string. State p' must lead to state p with the string L. + # + # ----------------------------------------------------------------------------- + + def compute_lookback_includes(self, C, trans, nullable): + lookdict = {} # Dictionary of lookback relations + includedict = {} # Dictionary of include relations + + # Make a dictionary of non-terminal transitions + dtrans = {} + for t in trans: + dtrans[t] = 1 + + # Loop over all transitions and compute lookbacks and includes + for state, N in trans: + lookb = [] + includes = [] + for p in C[state]: + if p.name != N: + continue + + # Okay, we have a name match. We now follow the production all the way + # through the state machine until we get the . on the right hand side + + lr_index = p.lr_index + j = state + while lr_index < p.len - 1: + lr_index = lr_index + 1 + t = p.prod[lr_index] + + # Check to see if this symbol and state are a non-terminal transition + if (j, t) in dtrans: + # Yes. Okay, there is some chance that this is an includes relation + # the only way to know for certain is whether the rest of the + # production derives empty + + li = lr_index + 1 + while li < p.len: + if p.prod[li] in self.grammar.Terminals: + break # No forget it + if p.prod[li] not in nullable: + break + li = li + 1 + else: + # Appears to be a relation between (j,t) and (state,N) + includes.append((j, t)) + + g = self.lr0_goto(C[j], t) # Go to next set + j = self.lr0_cidhash.get(id(g), -1) # Go to next state + + # When we get here, j is the final state, now we have to locate the production + for r in C[j]: + if r.name != p.name: + continue + if r.len != p.len: + continue + i = 0 + # This look is comparing a production ". A B C" with "A B C ." + while i < r.lr_index: + if r.prod[i] != p.prod[i+1]: + break + i = i + 1 + else: + lookb.append((j, r)) + for i in includes: + if i not in includedict: + includedict[i] = [] + includedict[i].append((state, N)) + lookdict[(state, N)] = lookb + + return lookdict, includedict + + # ----------------------------------------------------------------------------- + # compute_read_sets() + # + # Given a set of LR(0) items, this function computes the read sets. + # + # Inputs: C = Set of LR(0) items + # ntrans = Set of nonterminal transitions + # nullable = Set of empty transitions + # + # Returns a set containing the read sets + # ----------------------------------------------------------------------------- + + def compute_read_sets(self, C, ntrans, nullable): + FP = lambda x: self.dr_relation(C, x, nullable) + R = lambda x: self.reads_relation(C, x, nullable) + F = digraph(ntrans, R, FP) + return F + + # ----------------------------------------------------------------------------- + # compute_follow_sets() + # + # Given a set of LR(0) items, a set of non-terminal transitions, a readset, + # and an include set, this function computes the follow sets + # + # Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)} + # + # Inputs: + # ntrans = Set of nonterminal transitions + # readsets = Readset (previously computed) + # inclsets = Include sets (previously computed) + # + # Returns a set containing the follow sets + # ----------------------------------------------------------------------------- + + def compute_follow_sets(self, ntrans, readsets, inclsets): + FP = lambda x: readsets[x] + R = lambda x: inclsets.get(x, []) + F = digraph(ntrans, R, FP) + return F + + # ----------------------------------------------------------------------------- + # add_lookaheads() + # + # Attaches the lookahead symbols to grammar rules. + # + # Inputs: lookbacks - Set of lookback relations + # followset - Computed follow set + # + # This function directly attaches the lookaheads to productions contained + # in the lookbacks set + # ----------------------------------------------------------------------------- + + def add_lookaheads(self, lookbacks, followset): + for trans, lb in lookbacks.items(): + # Loop over productions in lookback + for state, p in lb: + if state not in p.lookaheads: + p.lookaheads[state] = [] + f = followset.get(trans, []) + for a in f: + if a not in p.lookaheads[state]: + p.lookaheads[state].append(a) + + # ----------------------------------------------------------------------------- + # add_lalr_lookaheads() + # + # This function does all of the work of adding lookahead information for use + # with LALR parsing + # ----------------------------------------------------------------------------- + + def add_lalr_lookaheads(self, C): + # Determine all of the nullable nonterminals + nullable = self.compute_nullable_nonterminals() + + # Find all non-terminal transitions + trans = self.find_nonterminal_transitions(C) + + # Compute read sets + readsets = self.compute_read_sets(C, trans, nullable) + + # Compute lookback/includes relations + lookd, included = self.compute_lookback_includes(C, trans, nullable) + + # Compute LALR FOLLOW sets + followsets = self.compute_follow_sets(trans, readsets, included) + + # Add all of the lookaheads + self.add_lookaheads(lookd, followsets) + + # ----------------------------------------------------------------------------- + # lr_parse_table() + # + # This function constructs the parse tables for SLR or LALR + # ----------------------------------------------------------------------------- + def lr_parse_table(self): + Productions = self.grammar.Productions + Precedence = self.grammar.Precedence + goto = self.lr_goto # Goto array + action = self.lr_action # Action array + log = self.log # Logger for output + + actionp = {} # Action production array (temporary) + + log.info('Parsing method: %s', self.lr_method) + + # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items + # This determines the number of states + + C = self.lr0_items() + + if self.lr_method == 'LALR': + self.add_lalr_lookaheads(C) + + # Build the parser table, state by state + st = 0 + for I in C: + # Loop over each production in I + actlist = [] # List of actions + st_action = {} + st_actionp = {} + st_goto = {} + log.info('') + log.info('state %d', st) + log.info('') + for p in I: + log.info(' (%d) %s', p.number, p) + log.info('') + + for p in I: + if p.len == p.lr_index + 1: + if p.name == "S'": + # Start symbol. Accept! + st_action['$end'] = 0 + st_actionp['$end'] = p + else: + # We are at the end of a production. Reduce! + if self.lr_method == 'LALR': + laheads = p.lookaheads[st] + else: + laheads = self.grammar.Follow[p.name] + for a in laheads: + actlist.append((a, p, 'reduce using rule %d (%s)' % (p.number, p))) + r = st_action.get(a) + if r is not None: + # Whoa. Have a shift/reduce or reduce/reduce conflict + if r > 0: + # Need to decide on shift or reduce here + # By default we favor shifting. Need to add + # some precedence rules here. + + # Shift precedence comes from the token + sprec, slevel = Precedence.get(a, ('right', 0)) + + # Reduce precedence comes from rule being reduced (p) + rprec, rlevel = Productions[p.number].prec + + if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')): + # We really need to reduce here. + st_action[a] = -p.number + st_actionp[a] = p + if not slevel and not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as reduce', a) + self.sr_conflicts.append((st, a, 'reduce')) + Productions[p.number].reduced += 1 + elif (slevel == rlevel) and (rprec == 'nonassoc'): + st_action[a] = None + else: + # Hmmm. Guess we'll keep the shift + if not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as shift', a) + self.sr_conflicts.append((st, a, 'shift')) + elif r < 0: + # Reduce/reduce conflict. In this case, we favor the rule + # that was defined first in the grammar file + oldp = Productions[-r] + pp = Productions[p.number] + if oldp.line > pp.line: + st_action[a] = -p.number + st_actionp[a] = p + chosenp, rejectp = pp, oldp + Productions[p.number].reduced += 1 + Productions[oldp.number].reduced -= 1 + else: + chosenp, rejectp = oldp, pp + self.rr_conflicts.append((st, chosenp, rejectp)) + log.info(' ! reduce/reduce conflict for %s resolved using rule %d (%s)', + a, st_actionp[a].number, st_actionp[a]) + else: + raise LALRError('Unknown conflict in state %d' % st) + else: + st_action[a] = -p.number + st_actionp[a] = p + Productions[p.number].reduced += 1 + else: + i = p.lr_index + a = p.prod[i+1] # Get symbol right after the "." + if a in self.grammar.Terminals: + g = self.lr0_goto(I, a) + j = self.lr0_cidhash.get(id(g), -1) + if j >= 0: + # We are in a shift state + actlist.append((a, p, 'shift and go to state %d' % j)) + r = st_action.get(a) + if r is not None: + # Whoa have a shift/reduce or shift/shift conflict + if r > 0: + if r != j: + raise LALRError('Shift/shift conflict in state %d' % st) + elif r < 0: + # Do a precedence check. + # - if precedence of reduce rule is higher, we reduce. + # - if precedence of reduce is same and left assoc, we reduce. + # - otherwise we shift + + # Shift precedence comes from the token + sprec, slevel = Precedence.get(a, ('right', 0)) + + # Reduce precedence comes from the rule that could have been reduced + rprec, rlevel = Productions[st_actionp[a].number].prec + + if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')): + # We decide to shift here... highest precedence to shift + Productions[st_actionp[a].number].reduced -= 1 + st_action[a] = j + st_actionp[a] = p + if not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as shift', a) + self.sr_conflicts.append((st, a, 'shift')) + elif (slevel == rlevel) and (rprec == 'nonassoc'): + st_action[a] = None + else: + # Hmmm. Guess we'll keep the reduce + if not slevel and not rlevel: + log.info(' ! shift/reduce conflict for %s resolved as reduce', a) + self.sr_conflicts.append((st, a, 'reduce')) + + else: + raise LALRError('Unknown conflict in state %d' % st) + else: + st_action[a] = j + st_actionp[a] = p + + # Print the actions associated with each terminal + _actprint = {} + for a, p, m in actlist: + if a in st_action: + if p is st_actionp[a]: + log.info(' %-15s %s', a, m) + _actprint[(a, m)] = 1 + log.info('') + # Print the actions that were not used. (debugging) + not_used = 0 + for a, p, m in actlist: + if a in st_action: + if p is not st_actionp[a]: + if not (a, m) in _actprint: + log.debug(' ! %-15s [ %s ]', a, m) + not_used = 1 + _actprint[(a, m)] = 1 + if not_used: + log.debug('') + + # Construct the goto table for this state + + nkeys = {} + for ii in I: + for s in ii.usyms: + if s in self.grammar.Nonterminals: + nkeys[s] = None + for n in nkeys: + g = self.lr0_goto(I, n) + j = self.lr0_cidhash.get(id(g), -1) + if j >= 0: + st_goto[n] = j + log.info(' %-30s shift and go to state %d', n, j) + + action[st] = st_action + actionp[st] = st_actionp + goto[st] = st_goto + st += 1 + + # ----------------------------------------------------------------------------- + # write() + # + # This function writes the LR parsing tables to a file + # ----------------------------------------------------------------------------- + + def write_table(self, tabmodule, outputdir='', signature=''): + if isinstance(tabmodule, types.ModuleType): + raise IOError("Won't overwrite existing tabmodule") + + basemodulename = tabmodule.split('.')[-1] + filename = os.path.join(outputdir, basemodulename) + '.py' + try: + f = open(filename, 'w') + + f.write(''' +# %s +# This file is automatically generated. Do not edit. +_tabversion = %r + +_lr_method = %r + +_lr_signature = %r + ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature)) + + # Change smaller to 0 to go back to original tables + smaller = 1 + + # Factor out names to try and make smaller + if smaller: + items = {} + + for s, nd in self.lr_action.items(): + for name, v in nd.items(): + i = items.get(name) + if not i: + i = ([], []) + items[name] = i + i[0].append(s) + i[1].append(v) + + f.write('\n_lr_action_items = {') + for k, v in items.items(): + f.write('%r:([' % k) + for i in v[0]: + f.write('%r,' % i) + f.write('],[') + for i in v[1]: + f.write('%r,' % i) + + f.write(']),') + f.write('}\n') + + f.write(''' +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items +''') + + else: + f.write('\n_lr_action = { ') + for k, v in self.lr_action.items(): + f.write('(%r,%r):%r,' % (k[0], k[1], v)) + f.write('}\n') + + if smaller: + # Factor out names to try and make smaller + items = {} + + for s, nd in self.lr_goto.items(): + for name, v in nd.items(): + i = items.get(name) + if not i: + i = ([], []) + items[name] = i + i[0].append(s) + i[1].append(v) + + f.write('\n_lr_goto_items = {') + for k, v in items.items(): + f.write('%r:([' % k) + for i in v[0]: + f.write('%r,' % i) + f.write('],[') + for i in v[1]: + f.write('%r,' % i) + + f.write(']),') + f.write('}\n') + + f.write(''' +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +''') + else: + f.write('\n_lr_goto = { ') + for k, v in self.lr_goto.items(): + f.write('(%r,%r):%r,' % (k[0], k[1], v)) + f.write('}\n') + + # Write production table + f.write('_lr_productions = [\n') + for p in self.lr_productions: + if p.func: + f.write(' (%r,%r,%d,%r,%r,%d),\n' % (p.str, p.name, p.len, + p.func, os.path.basename(p.file), p.line)) + else: + f.write(' (%r,%r,%d,None,None,None),\n' % (str(p), p.name, p.len)) + f.write(']\n') + f.close() + + except IOError as e: + raise + + + # ----------------------------------------------------------------------------- + # pickle_table() + # + # This function pickles the LR parsing tables to a supplied file object + # ----------------------------------------------------------------------------- + + def pickle_table(self, filename, signature=''): + try: + import cPickle as pickle + except ImportError: + import pickle + with open(filename, 'wb') as outf: + pickle.dump(__tabversion__, outf, pickle_protocol) + pickle.dump(self.lr_method, outf, pickle_protocol) + pickle.dump(signature, outf, pickle_protocol) + pickle.dump(self.lr_action, outf, pickle_protocol) + pickle.dump(self.lr_goto, outf, pickle_protocol) + + outp = [] + for p in self.lr_productions: + if p.func: + outp.append((p.str, p.name, p.len, p.func, os.path.basename(p.file), p.line)) + else: + outp.append((str(p), p.name, p.len, None, None, None)) + pickle.dump(outp, outf, pickle_protocol) + +# ----------------------------------------------------------------------------- +# === INTROSPECTION === +# +# The following functions and classes are used to implement the PLY +# introspection features followed by the yacc() function itself. +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# get_caller_module_dict() +# +# This function returns a dictionary containing all of the symbols defined within +# a caller further down the call stack. This is used to get the environment +# associated with the yacc() call if none was provided. +# ----------------------------------------------------------------------------- + +def get_caller_module_dict(levels): + f = sys._getframe(levels) + ldict = f.f_globals.copy() + if f.f_globals != f.f_locals: + ldict.update(f.f_locals) + return ldict + +# ----------------------------------------------------------------------------- +# parse_grammar() +# +# This takes a raw grammar rule string and parses it into production data +# ----------------------------------------------------------------------------- +def parse_grammar(doc, file, line): + grammar = [] + # Split the doc string into lines + pstrings = doc.splitlines() + lastp = None + dline = line + for ps in pstrings: + dline += 1 + p = ps.split() + if not p: + continue + try: + if p[0] == '|': + # This is a continuation of a previous rule + if not lastp: + raise SyntaxError("%s:%d: Misplaced '|'" % (file, dline)) + prodname = lastp + syms = p[1:] + else: + prodname = p[0] + lastp = prodname + syms = p[2:] + assign = p[1] + if assign != ':' and assign != '::=': + raise SyntaxError("%s:%d: Syntax error. Expected ':'" % (file, dline)) + + grammar.append((file, dline, prodname, syms)) + except SyntaxError: + raise + except Exception: + raise SyntaxError('%s:%d: Syntax error in rule %r' % (file, dline, ps.strip())) + + return grammar + +# ----------------------------------------------------------------------------- +# ParserReflect() +# +# This class represents information extracted for building a parser including +# start symbol, error function, tokens, precedence list, action functions, +# etc. +# ----------------------------------------------------------------------------- +class ParserReflect(object): + def __init__(self, pdict, log=None): + self.pdict = pdict + self.start = None + self.error_func = None + self.tokens = None + self.modules = set() + self.grammar = [] + self.error = False + + if log is None: + self.log = PlyLogger(sys.stderr) + else: + self.log = log + + # Get all of the basic information + def get_all(self): + self.get_start() + self.get_error_func() + self.get_tokens() + self.get_precedence() + self.get_pfunctions() + + # Validate all of the information + def validate_all(self): + self.validate_start() + self.validate_error_func() + self.validate_tokens() + self.validate_precedence() + self.validate_pfunctions() + self.validate_modules() + return self.error + + # Compute a signature over the grammar + def signature(self): + parts = [] + try: + if self.start: + parts.append(self.start) + if self.prec: + parts.append(''.join([''.join(p) for p in self.prec])) + if self.tokens: + parts.append(' '.join(self.tokens)) + for f in self.pfuncs: + if f[3]: + parts.append(f[3]) + except (TypeError, ValueError): + pass + return ''.join(parts) + + # ----------------------------------------------------------------------------- + # validate_modules() + # + # This method checks to see if there are duplicated p_rulename() functions + # in the parser module file. Without this function, it is really easy for + # users to make mistakes by cutting and pasting code fragments (and it's a real + # bugger to try and figure out why the resulting parser doesn't work). Therefore, + # we just do a little regular expression pattern matching of def statements + # to try and detect duplicates. + # ----------------------------------------------------------------------------- + + def validate_modules(self): + # Match def p_funcname( + fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(') + + for module in self.modules: + try: + lines, linen = inspect.getsourcelines(module) + except IOError: + continue + + counthash = {} + for linen, line in enumerate(lines): + linen += 1 + m = fre.match(line) + if m: + name = m.group(1) + prev = counthash.get(name) + if not prev: + counthash[name] = linen + else: + filename = inspect.getsourcefile(module) + self.log.warning('%s:%d: Function %s redefined. Previously defined on line %d', + filename, linen, name, prev) + + # Get the start symbol + def get_start(self): + self.start = self.pdict.get('start') + + # Validate the start symbol + def validate_start(self): + if self.start is not None: + if not isinstance(self.start, string_types): + self.log.error("'start' must be a string") + + # Look for error handler + def get_error_func(self): + self.error_func = self.pdict.get('p_error') + + # Validate the error function + def validate_error_func(self): + if self.error_func: + if isinstance(self.error_func, types.FunctionType): + ismethod = 0 + elif isinstance(self.error_func, types.MethodType): + ismethod = 1 + else: + self.log.error("'p_error' defined, but is not a function or method") + self.error = True + return + + eline = self.error_func.__code__.co_firstlineno + efile = self.error_func.__code__.co_filename + module = inspect.getmodule(self.error_func) + self.modules.add(module) + + argcount = self.error_func.__code__.co_argcount - ismethod + if argcount != 1: + self.log.error('%s:%d: p_error() requires 1 argument', efile, eline) + self.error = True + + # Get the tokens map + def get_tokens(self): + tokens = self.pdict.get('tokens') + if not tokens: + self.log.error('No token list is defined') + self.error = True + return + + if not isinstance(tokens, (list, tuple)): + self.log.error('tokens must be a list or tuple') + self.error = True + return + + if not tokens: + self.log.error('tokens is empty') + self.error = True + return + + self.tokens = tokens + + # Validate the tokens + def validate_tokens(self): + # Validate the tokens. + if 'error' in self.tokens: + self.log.error("Illegal token name 'error'. Is a reserved word") + self.error = True + return + + terminals = set() + for n in self.tokens: + if n in terminals: + self.log.warning('Token %r multiply defined', n) + terminals.add(n) + + # Get the precedence map (if any) + def get_precedence(self): + self.prec = self.pdict.get('precedence') + + # Validate and parse the precedence map + def validate_precedence(self): + preclist = [] + if self.prec: + if not isinstance(self.prec, (list, tuple)): + self.log.error('precedence must be a list or tuple') + self.error = True + return + for level, p in enumerate(self.prec): + if not isinstance(p, (list, tuple)): + self.log.error('Bad precedence table') + self.error = True + return + + if len(p) < 2: + self.log.error('Malformed precedence entry %s. Must be (assoc, term, ..., term)', p) + self.error = True + return + assoc = p[0] + if not isinstance(assoc, string_types): + self.log.error('precedence associativity must be a string') + self.error = True + return + for term in p[1:]: + if not isinstance(term, string_types): + self.log.error('precedence items must be strings') + self.error = True + return + preclist.append((term, assoc, level+1)) + self.preclist = preclist + + # Get all p_functions from the grammar + def get_pfunctions(self): + p_functions = [] + for name, item in self.pdict.items(): + if not name.startswith('p_') or name == 'p_error': + continue + if isinstance(item, (types.FunctionType, types.MethodType)): + line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno) + module = inspect.getmodule(item) + p_functions.append((line, module, name, item.__doc__)) + + # Sort all of the actions by line number; make sure to stringify + # modules to make them sortable, since `line` may not uniquely sort all + # p functions + p_functions.sort(key=lambda p_function: ( + p_function[0], + str(p_function[1]), + p_function[2], + p_function[3])) + self.pfuncs = p_functions + + # Validate all of the p_functions + def validate_pfunctions(self): + grammar = [] + # Check for non-empty symbols + if len(self.pfuncs) == 0: + self.log.error('no rules of the form p_rulename are defined') + self.error = True + return + + for line, module, name, doc in self.pfuncs: + file = inspect.getsourcefile(module) + func = self.pdict[name] + if isinstance(func, types.MethodType): + reqargs = 2 + else: + reqargs = 1 + if func.__code__.co_argcount > reqargs: + self.log.error('%s:%d: Rule %r has too many arguments', file, line, func.__name__) + self.error = True + elif func.__code__.co_argcount < reqargs: + self.log.error('%s:%d: Rule %r requires an argument', file, line, func.__name__) + self.error = True + elif not func.__doc__: + self.log.warning('%s:%d: No documentation string specified in function %r (ignored)', + file, line, func.__name__) + else: + try: + parsed_g = parse_grammar(doc, file, line) + for g in parsed_g: + grammar.append((name, g)) + except SyntaxError as e: + self.log.error(str(e)) + self.error = True + + # Looks like a valid grammar rule + # Mark the file in which defined. + self.modules.add(module) + + # Secondary validation step that looks for p_ definitions that are not functions + # or functions that look like they might be grammar rules. + + for n, v in self.pdict.items(): + if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)): + continue + if n.startswith('t_'): + continue + if n.startswith('p_') and n != 'p_error': + self.log.warning('%r not defined as a function', n) + if ((isinstance(v, types.FunctionType) and v.__code__.co_argcount == 1) or + (isinstance(v, types.MethodType) and v.__func__.__code__.co_argcount == 2)): + if v.__doc__: + try: + doc = v.__doc__.split(' ') + if doc[1] == ':': + self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix', + v.__code__.co_filename, v.__code__.co_firstlineno, n) + except IndexError: + pass + + self.grammar = grammar + +# ----------------------------------------------------------------------------- +# yacc(module) +# +# Build a parser +# ----------------------------------------------------------------------------- + +def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None, + check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file, + outputdir=None, debuglog=None, errorlog=None, picklefile=None): + + if tabmodule is None: + tabmodule = tab_module + + # Reference to the parsing method of the last built parser + global parse + + # If pickling is enabled, table files are not created + if picklefile: + write_tables = 0 + + if errorlog is None: + errorlog = PlyLogger(sys.stderr) + + # Get the module dictionary used for the parser + if module: + _items = [(k, getattr(module, k)) for k in dir(module)] + pdict = dict(_items) + # If no __file__ attribute is available, try to obtain it from the __module__ instead + if '__file__' not in pdict: + pdict['__file__'] = sys.modules[pdict['__module__']].__file__ + else: + pdict = get_caller_module_dict(2) + + if outputdir is None: + # If no output directory is set, the location of the output files + # is determined according to the following rules: + # - If tabmodule specifies a package, files go into that package directory + # - Otherwise, files go in the same directory as the specifying module + if isinstance(tabmodule, types.ModuleType): + srcfile = tabmodule.__file__ + else: + if '.' not in tabmodule: + srcfile = pdict['__file__'] + else: + parts = tabmodule.split('.') + pkgname = '.'.join(parts[:-1]) + exec('import %s' % pkgname) + srcfile = getattr(sys.modules[pkgname], '__file__', '') + outputdir = os.path.dirname(srcfile) + + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = pdict.get('__package__') + if pkg and isinstance(tabmodule, str): + if '.' not in tabmodule: + tabmodule = pkg + '.' + tabmodule + + + + # Set start symbol if it's specified directly using an argument + if start is not None: + pdict['start'] = start + + # Collect parser information from the dictionary + pinfo = ParserReflect(pdict, log=errorlog) + pinfo.get_all() + + if pinfo.error: + raise YaccError('Unable to build parser') + + # Check signature against table files (if any) + signature = pinfo.signature() + + # Read the tables + try: + lr = LRTable() + if picklefile: + read_signature = lr.read_pickle(picklefile) + else: + read_signature = lr.read_table(tabmodule) + if optimize or (read_signature == signature): + try: + lr.bind_callables(pinfo.pdict) + parser = LRParser(lr, pinfo.error_func) + parse = parser.parse + return parser + except Exception as e: + errorlog.warning('There was a problem loading the table file: %r', e) + except VersionError as e: + errorlog.warning(str(e)) + except ImportError: + pass + + if debuglog is None: + if debug: + try: + debuglog = PlyLogger(open(os.path.join(outputdir, debugfile), 'w')) + except IOError as e: + errorlog.warning("Couldn't open %r. %s" % (debugfile, e)) + debuglog = NullLogger() + else: + debuglog = NullLogger() + + debuglog.info('Created by PLY version %s (http://www.dabeaz.com/ply)', __version__) + + errors = False + + # Validate the parser information + if pinfo.validate_all(): + raise YaccError('Unable to build parser') + + if not pinfo.error_func: + errorlog.warning('no p_error() function is defined') + + # Create a grammar object + grammar = Grammar(pinfo.tokens) + + # Set precedence level for terminals + for term, assoc, level in pinfo.preclist: + try: + grammar.set_precedence(term, assoc, level) + except GrammarError as e: + errorlog.warning('%s', e) + + # Add productions to the grammar + for funcname, gram in pinfo.grammar: + file, line, prodname, syms = gram + try: + grammar.add_production(prodname, syms, funcname, file, line) + except GrammarError as e: + errorlog.error('%s', e) + errors = True + + # Set the grammar start symbols + try: + if start is None: + grammar.set_start(pinfo.start) + else: + grammar.set_start(start) + except GrammarError as e: + errorlog.error(str(e)) + errors = True + + if errors: + raise YaccError('Unable to build parser') + + # Verify the grammar structure + undefined_symbols = grammar.undefined_symbols() + for sym, prod in undefined_symbols: + errorlog.error('%s:%d: Symbol %r used, but not defined as a token or a rule', prod.file, prod.line, sym) + errors = True + + unused_terminals = grammar.unused_terminals() + if unused_terminals: + debuglog.info('') + debuglog.info('Unused terminals:') + debuglog.info('') + for term in unused_terminals: + errorlog.warning('Token %r defined, but not used', term) + debuglog.info(' %s', term) + + # Print out all productions to the debug log + if debug: + debuglog.info('') + debuglog.info('Grammar') + debuglog.info('') + for n, p in enumerate(grammar.Productions): + debuglog.info('Rule %-5d %s', n, p) + + # Find unused non-terminals + unused_rules = grammar.unused_rules() + for prod in unused_rules: + errorlog.warning('%s:%d: Rule %r defined, but not used', prod.file, prod.line, prod.name) + + if len(unused_terminals) == 1: + errorlog.warning('There is 1 unused token') + if len(unused_terminals) > 1: + errorlog.warning('There are %d unused tokens', len(unused_terminals)) + + if len(unused_rules) == 1: + errorlog.warning('There is 1 unused rule') + if len(unused_rules) > 1: + errorlog.warning('There are %d unused rules', len(unused_rules)) + + if debug: + debuglog.info('') + debuglog.info('Terminals, with rules where they appear') + debuglog.info('') + terms = list(grammar.Terminals) + terms.sort() + for term in terms: + debuglog.info('%-20s : %s', term, ' '.join([str(s) for s in grammar.Terminals[term]])) + + debuglog.info('') + debuglog.info('Nonterminals, with rules where they appear') + debuglog.info('') + nonterms = list(grammar.Nonterminals) + nonterms.sort() + for nonterm in nonterms: + debuglog.info('%-20s : %s', nonterm, ' '.join([str(s) for s in grammar.Nonterminals[nonterm]])) + debuglog.info('') + + if check_recursion: + unreachable = grammar.find_unreachable() + for u in unreachable: + errorlog.warning('Symbol %r is unreachable', u) + + infinite = grammar.infinite_cycles() + for inf in infinite: + errorlog.error('Infinite recursion detected for symbol %r', inf) + errors = True + + unused_prec = grammar.unused_precedence() + for term, assoc in unused_prec: + errorlog.error('Precedence rule %r defined for unknown symbol %r', assoc, term) + errors = True + + if errors: + raise YaccError('Unable to build parser') + + # Run the LRGeneratedTable on the grammar + if debug: + errorlog.debug('Generating %s tables', method) + + lr = LRGeneratedTable(grammar, method, debuglog) + + if debug: + num_sr = len(lr.sr_conflicts) + + # Report shift/reduce and reduce/reduce conflicts + if num_sr == 1: + errorlog.warning('1 shift/reduce conflict') + elif num_sr > 1: + errorlog.warning('%d shift/reduce conflicts', num_sr) + + num_rr = len(lr.rr_conflicts) + if num_rr == 1: + errorlog.warning('1 reduce/reduce conflict') + elif num_rr > 1: + errorlog.warning('%d reduce/reduce conflicts', num_rr) + + # Write out conflicts to the output file + if debug and (lr.sr_conflicts or lr.rr_conflicts): + debuglog.warning('') + debuglog.warning('Conflicts:') + debuglog.warning('') + + for state, tok, resolution in lr.sr_conflicts: + debuglog.warning('shift/reduce conflict for %s in state %d resolved as %s', tok, state, resolution) + + already_reported = set() + for state, rule, rejected in lr.rr_conflicts: + if (state, id(rule), id(rejected)) in already_reported: + continue + debuglog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule) + debuglog.warning('rejected rule (%s) in state %d', rejected, state) + errorlog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule) + errorlog.warning('rejected rule (%s) in state %d', rejected, state) + already_reported.add((state, id(rule), id(rejected))) + + warned_never = [] + for state, rule, rejected in lr.rr_conflicts: + if not rejected.reduced and (rejected not in warned_never): + debuglog.warning('Rule (%s) is never reduced', rejected) + errorlog.warning('Rule (%s) is never reduced', rejected) + warned_never.append(rejected) + + # Write the table file if requested + if write_tables: + try: + lr.write_table(tabmodule, outputdir, signature) + except IOError as e: + errorlog.warning("Couldn't create %r. %s" % (tabmodule, e)) + + # Write a pickled version of the tables + if picklefile: + try: + lr.pickle_table(picklefile, signature) + except IOError as e: + errorlog.warning("Couldn't create %r. %s" % (picklefile, e)) + + # Build the parser + lr.bind_callables(pinfo.pdict) + parser = LRParser(lr, pinfo.error_func) + + parse = parser.parse + return parser diff --git a/jwt/python/pycparser/ply/ygen.py b/jwt/python/pycparser/ply/ygen.py new file mode 100644 index 0000000..acf5ca1 --- /dev/null +++ b/jwt/python/pycparser/ply/ygen.py @@ -0,0 +1,74 @@ +# ply: ygen.py +# +# This is a support program that auto-generates different versions of the YACC parsing +# function with different features removed for the purposes of performance. +# +# Users should edit the method LParser.parsedebug() in yacc.py. The source code +# for that method is then used to create the other methods. See the comments in +# yacc.py for further details. + +import os.path +import shutil + +def get_source_range(lines, tag): + srclines = enumerate(lines) + start_tag = '#--! %s-start' % tag + end_tag = '#--! %s-end' % tag + + for start_index, line in srclines: + if line.strip().startswith(start_tag): + break + + for end_index, line in srclines: + if line.strip().endswith(end_tag): + break + + return (start_index + 1, end_index) + +def filter_section(lines, tag): + filtered_lines = [] + include = True + tag_text = '#--! %s' % tag + for line in lines: + if line.strip().startswith(tag_text): + include = not include + elif include: + filtered_lines.append(line) + return filtered_lines + +def main(): + dirname = os.path.dirname(__file__) + shutil.copy2(os.path.join(dirname, 'yacc.py'), os.path.join(dirname, 'yacc.py.bak')) + with open(os.path.join(dirname, 'yacc.py'), 'r') as f: + lines = f.readlines() + + parse_start, parse_end = get_source_range(lines, 'parsedebug') + parseopt_start, parseopt_end = get_source_range(lines, 'parseopt') + parseopt_notrack_start, parseopt_notrack_end = get_source_range(lines, 'parseopt-notrack') + + # Get the original source + orig_lines = lines[parse_start:parse_end] + + # Filter the DEBUG sections out + parseopt_lines = filter_section(orig_lines, 'DEBUG') + + # Filter the TRACKING sections out + parseopt_notrack_lines = filter_section(parseopt_lines, 'TRACKING') + + # Replace the parser source sections with updated versions + lines[parseopt_notrack_start:parseopt_notrack_end] = parseopt_notrack_lines + lines[parseopt_start:parseopt_end] = parseopt_lines + + lines = [line.rstrip()+'\n' for line in lines] + with open(os.path.join(dirname, 'yacc.py'), 'w') as f: + f.writelines(lines) + + print('Updated yacc.py') + +if __name__ == '__main__': + main() + + + + + diff --git a/jwt/python/pycparser/plyparser.py b/jwt/python/pycparser/plyparser.py new file mode 100644 index 0000000..b8f4c43 --- /dev/null +++ b/jwt/python/pycparser/plyparser.py @@ -0,0 +1,133 @@ +#----------------------------------------------------------------- +# plyparser.py +# +# PLYParser class and other utilities for simplifying programming +# parsers with PLY +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# License: BSD +#----------------------------------------------------------------- + +import warnings + +class Coord(object): + """ Coordinates of a syntactic element. Consists of: + - File name + - Line number + - (optional) column number, for the Lexer + """ + __slots__ = ('file', 'line', 'column', '__weakref__') + def __init__(self, file, line, column=None): + self.file = file + self.line = line + self.column = column + + def __str__(self): + str = "%s:%s" % (self.file, self.line) + if self.column: str += ":%s" % self.column + return str + + +class ParseError(Exception): pass + + +class PLYParser(object): + def _create_opt_rule(self, rulename): + """ Given a rule name, creates an optional ply.yacc rule + for it. The name of the optional rule is + _opt + """ + optname = rulename + '_opt' + + def optrule(self, p): + p[0] = p[1] + + optrule.__doc__ = '%s : empty\n| %s' % (optname, rulename) + optrule.__name__ = 'p_%s' % optname + setattr(self.__class__, optrule.__name__, optrule) + + def _coord(self, lineno, column=None): + return Coord( + file=self.clex.filename, + line=lineno, + column=column) + + def _token_coord(self, p, token_idx): + """ Returns the coordinates for the YaccProduction object 'p' indexed + with 'token_idx'. The coordinate includes the 'lineno' and + 'column'. Both follow the lex semantic, starting from 1. + """ + last_cr = p.lexer.lexer.lexdata.rfind('\n', 0, p.lexpos(token_idx)) + if last_cr < 0: + last_cr = -1 + column = (p.lexpos(token_idx) - (last_cr)) + return self._coord(p.lineno(token_idx), column) + + def _parse_error(self, msg, coord): + raise ParseError("%s: %s" % (coord, msg)) + + +def parameterized(*params): + """ Decorator to create parameterized rules. + + Parameterized rule methods must be named starting with 'p_' and contain + 'xxx', and their docstrings may contain 'xxx' and 'yyy'. These will be + replaced by the given parameter tuples. For example, ``p_xxx_rule()`` with + docstring 'xxx_rule : yyy' when decorated with + ``@parameterized(('id', 'ID'))`` produces ``p_id_rule()`` with the docstring + 'id_rule : ID'. Using multiple tuples produces multiple rules. + """ + def decorate(rule_func): + rule_func._params = params + return rule_func + return decorate + + +def template(cls): + """ Class decorator to generate rules from parameterized rule templates. + + See `parameterized` for more information on parameterized rules. + """ + issued_nodoc_warning = False + for attr_name in dir(cls): + if attr_name.startswith('p_'): + method = getattr(cls, attr_name) + if hasattr(method, '_params'): + # Remove the template method + delattr(cls, attr_name) + # Create parameterized rules from this method; only run this if + # the method has a docstring. This is to address an issue when + # pycparser's users are installed in -OO mode which strips + # docstrings away. + # See: https://github.com/eliben/pycparser/pull/198/ and + # https://github.com/eliben/pycparser/issues/197 + # for discussion. + if method.__doc__ is not None: + _create_param_rules(cls, method) + elif not issued_nodoc_warning: + warnings.warn( + 'parsing methods must have __doc__ for pycparser to work properly', + RuntimeWarning, + stacklevel=2) + issued_nodoc_warning = True + return cls + + +def _create_param_rules(cls, func): + """ Create ply.yacc rules based on a parameterized rule function + + Generates new methods (one per each pair of parameters) based on the + template rule function `func`, and attaches them to `cls`. The rule + function's parameters must be accessible via its `_params` attribute. + """ + for xxx, yyy in func._params: + # Use the template method's body for each new method + def param_rule(self, p): + func(self, p) + + # Substitute in the params for the grammar rule and function name + param_rule.__doc__ = func.__doc__.replace('xxx', xxx).replace('yyy', yyy) + param_rule.__name__ = func.__name__.replace('xxx', xxx) + + # Attach the new method to the class + setattr(cls, param_rule.__name__, param_rule) diff --git a/jwt/python/pycparser/yacctab.py b/jwt/python/pycparser/yacctab.py new file mode 100644 index 0000000..0622c36 --- /dev/null +++ b/jwt/python/pycparser/yacctab.py @@ -0,0 +1,366 @@ + +# yacctab.py +# This file is automatically generated. Do not edit. +_tabversion = '3.10' + +_lr_method = 'LALR' + +_lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EXTERN FLOAT FOR GOTO IF INLINE INT LONG REGISTER OFFSETOF RESTRICT RETURN SHORT SIGNED SIZEOF STATIC STRUCT SWITCH TYPEDEF UNION UNSIGNED VOID VOLATILE WHILE __INT128 _BOOL _COMPLEX _NORETURN _THREAD_LOCAL _STATIC_ASSERT _ATOMIC _ALIGNOF _ALIGNAS ID TYPEID INT_CONST_DEC INT_CONST_OCT INT_CONST_HEX INT_CONST_BIN INT_CONST_CHAR FLOAT_CONST HEX_FLOAT_CONST CHAR_CONST WCHAR_CONST U8CHAR_CONST U16CHAR_CONST U32CHAR_CONST STRING_LITERAL WSTRING_LITERAL U8STRING_LITERAL U16STRING_LITERAL U32STRING_LITERAL PLUS MINUS TIMES DIVIDE MOD OR AND NOT XOR LSHIFT RSHIFT LOR LAND LNOT LT LE GT GE EQ NE EQUALS TIMESEQUAL DIVEQUAL MODEQUAL PLUSEQUAL MINUSEQUAL LSHIFTEQUAL RSHIFTEQUAL ANDEQUAL XOREQUAL OREQUAL PLUSPLUS MINUSMINUS ARROW CONDOP LPAREN RPAREN LBRACKET RBRACKET LBRACE RBRACE COMMA PERIOD SEMI COLON ELLIPSIS PPHASH PPPRAGMA PPPRAGMASTRabstract_declarator_opt : empty\n| abstract_declaratorassignment_expression_opt : empty\n| assignment_expressionblock_item_list_opt : empty\n| block_item_listdeclaration_list_opt : empty\n| declaration_listdeclaration_specifiers_no_type_opt : empty\n| declaration_specifiers_no_typedesignation_opt : empty\n| designationexpression_opt : empty\n| expressionid_init_declarator_list_opt : empty\n| id_init_declarator_listidentifier_list_opt : empty\n| identifier_listinit_declarator_list_opt : empty\n| init_declarator_listinitializer_list_opt : empty\n| initializer_listparameter_type_list_opt : empty\n| parameter_type_liststruct_declarator_list_opt : empty\n| struct_declarator_listtype_qualifier_list_opt : empty\n| type_qualifier_list direct_id_declarator : ID\n direct_id_declarator : LPAREN id_declarator RPAREN\n direct_id_declarator : direct_id_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_id_declarator : direct_id_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n | direct_id_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n direct_id_declarator : direct_id_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n direct_id_declarator : direct_id_declarator LPAREN parameter_type_list RPAREN\n | direct_id_declarator LPAREN identifier_list_opt RPAREN\n direct_typeid_declarator : TYPEID\n direct_typeid_declarator : LPAREN typeid_declarator RPAREN\n direct_typeid_declarator : direct_typeid_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_typeid_declarator : direct_typeid_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n | direct_typeid_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n direct_typeid_declarator : direct_typeid_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n direct_typeid_declarator : direct_typeid_declarator LPAREN parameter_type_list RPAREN\n | direct_typeid_declarator LPAREN identifier_list_opt RPAREN\n direct_typeid_noparen_declarator : TYPEID\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n | direct_typeid_noparen_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n direct_typeid_noparen_declarator : direct_typeid_noparen_declarator LPAREN parameter_type_list RPAREN\n | direct_typeid_noparen_declarator LPAREN identifier_list_opt RPAREN\n id_declarator : direct_id_declarator\n id_declarator : pointer direct_id_declarator\n typeid_declarator : direct_typeid_declarator\n typeid_declarator : pointer direct_typeid_declarator\n typeid_noparen_declarator : direct_typeid_noparen_declarator\n typeid_noparen_declarator : pointer direct_typeid_noparen_declarator\n translation_unit_or_empty : translation_unit\n | empty\n translation_unit : external_declaration\n translation_unit : translation_unit external_declaration\n external_declaration : function_definition\n external_declaration : declaration\n external_declaration : pp_directive\n | pppragma_directive\n external_declaration : SEMI\n external_declaration : static_assert\n static_assert : _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN\n | _STATIC_ASSERT LPAREN constant_expression RPAREN\n pp_directive : PPHASH\n pppragma_directive : PPPRAGMA\n | PPPRAGMA PPPRAGMASTR\n function_definition : id_declarator declaration_list_opt compound_statement\n function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement\n statement : labeled_statement\n | expression_statement\n | compound_statement\n | selection_statement\n | iteration_statement\n | jump_statement\n | pppragma_directive\n | static_assert\n pragmacomp_or_statement : pppragma_directive statement\n | statement\n decl_body : declaration_specifiers init_declarator_list_opt\n | declaration_specifiers_no_type id_init_declarator_list_opt\n declaration : decl_body SEMI\n declaration_list : declaration\n | declaration_list declaration\n declaration_specifiers_no_type : type_qualifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : storage_class_specifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : function_specifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : atomic_specifier declaration_specifiers_no_type_opt\n declaration_specifiers_no_type : alignment_specifier declaration_specifiers_no_type_opt\n declaration_specifiers : declaration_specifiers type_qualifier\n declaration_specifiers : declaration_specifiers storage_class_specifier\n declaration_specifiers : declaration_specifiers function_specifier\n declaration_specifiers : declaration_specifiers type_specifier_no_typeid\n declaration_specifiers : type_specifier\n declaration_specifiers : declaration_specifiers_no_type type_specifier\n declaration_specifiers : declaration_specifiers alignment_specifier\n storage_class_specifier : AUTO\n | REGISTER\n | STATIC\n | EXTERN\n | TYPEDEF\n | _THREAD_LOCAL\n function_specifier : INLINE\n | _NORETURN\n type_specifier_no_typeid : VOID\n | _BOOL\n | CHAR\n | SHORT\n | INT\n | LONG\n | FLOAT\n | DOUBLE\n | _COMPLEX\n | SIGNED\n | UNSIGNED\n | __INT128\n type_specifier : typedef_name\n | enum_specifier\n | struct_or_union_specifier\n | type_specifier_no_typeid\n | atomic_specifier\n atomic_specifier : _ATOMIC LPAREN type_name RPAREN\n type_qualifier : CONST\n | RESTRICT\n | VOLATILE\n | _ATOMIC\n init_declarator_list : init_declarator\n | init_declarator_list COMMA init_declarator\n init_declarator : declarator\n | declarator EQUALS initializer\n id_init_declarator_list : id_init_declarator\n | id_init_declarator_list COMMA init_declarator\n id_init_declarator : id_declarator\n | id_declarator EQUALS initializer\n specifier_qualifier_list : specifier_qualifier_list type_specifier_no_typeid\n specifier_qualifier_list : specifier_qualifier_list type_qualifier\n specifier_qualifier_list : type_specifier\n specifier_qualifier_list : type_qualifier_list type_specifier\n specifier_qualifier_list : alignment_specifier\n specifier_qualifier_list : specifier_qualifier_list alignment_specifier\n struct_or_union_specifier : struct_or_union ID\n | struct_or_union TYPEID\n struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close\n | struct_or_union brace_open brace_close\n struct_or_union_specifier : struct_or_union ID brace_open struct_declaration_list brace_close\n | struct_or_union ID brace_open brace_close\n | struct_or_union TYPEID brace_open struct_declaration_list brace_close\n | struct_or_union TYPEID brace_open brace_close\n struct_or_union : STRUCT\n | UNION\n struct_declaration_list : struct_declaration\n | struct_declaration_list struct_declaration\n struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI\n struct_declaration : SEMI\n struct_declaration : pppragma_directive\n struct_declarator_list : struct_declarator\n | struct_declarator_list COMMA struct_declarator\n struct_declarator : declarator\n struct_declarator : declarator COLON constant_expression\n | COLON constant_expression\n enum_specifier : ENUM ID\n | ENUM TYPEID\n enum_specifier : ENUM brace_open enumerator_list brace_close\n enum_specifier : ENUM ID brace_open enumerator_list brace_close\n | ENUM TYPEID brace_open enumerator_list brace_close\n enumerator_list : enumerator\n | enumerator_list COMMA\n | enumerator_list COMMA enumerator\n alignment_specifier : _ALIGNAS LPAREN type_name RPAREN\n | _ALIGNAS LPAREN constant_expression RPAREN\n enumerator : ID\n | ID EQUALS constant_expression\n declarator : id_declarator\n | typeid_declarator\n pointer : TIMES type_qualifier_list_opt\n | TIMES type_qualifier_list_opt pointer\n type_qualifier_list : type_qualifier\n | type_qualifier_list type_qualifier\n parameter_type_list : parameter_list\n | parameter_list COMMA ELLIPSIS\n parameter_list : parameter_declaration\n | parameter_list COMMA parameter_declaration\n parameter_declaration : declaration_specifiers id_declarator\n | declaration_specifiers typeid_noparen_declarator\n parameter_declaration : declaration_specifiers abstract_declarator_opt\n identifier_list : identifier\n | identifier_list COMMA identifier\n initializer : assignment_expression\n initializer : brace_open initializer_list_opt brace_close\n | brace_open initializer_list COMMA brace_close\n initializer_list : designation_opt initializer\n | initializer_list COMMA designation_opt initializer\n designation : designator_list EQUALS\n designator_list : designator\n | designator_list designator\n designator : LBRACKET constant_expression RBRACKET\n | PERIOD identifier\n type_name : specifier_qualifier_list abstract_declarator_opt\n abstract_declarator : pointer\n abstract_declarator : pointer direct_abstract_declarator\n abstract_declarator : direct_abstract_declarator\n direct_abstract_declarator : LPAREN abstract_declarator RPAREN direct_abstract_declarator : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET\n direct_abstract_declarator : LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n direct_abstract_declarator : direct_abstract_declarator LBRACKET TIMES RBRACKET\n direct_abstract_declarator : LBRACKET TIMES RBRACKET\n direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN\n direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN\n block_item : declaration\n | statement\n block_item_list : block_item\n | block_item_list block_item\n compound_statement : brace_open block_item_list_opt brace_close labeled_statement : ID COLON pragmacomp_or_statement labeled_statement : CASE constant_expression COLON pragmacomp_or_statement labeled_statement : DEFAULT COLON pragmacomp_or_statement selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement selection_statement : IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement selection_statement : SWITCH LPAREN expression RPAREN pragmacomp_or_statement iteration_statement : WHILE LPAREN expression RPAREN pragmacomp_or_statement iteration_statement : DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement jump_statement : GOTO ID SEMI jump_statement : BREAK SEMI jump_statement : CONTINUE SEMI jump_statement : RETURN expression SEMI\n | RETURN SEMI\n expression_statement : expression_opt SEMI expression : assignment_expression\n | expression COMMA assignment_expression\n assignment_expression : LPAREN compound_statement RPAREN typedef_name : TYPEID assignment_expression : conditional_expression\n | unary_expression assignment_operator assignment_expression\n assignment_operator : EQUALS\n | XOREQUAL\n | TIMESEQUAL\n | DIVEQUAL\n | MODEQUAL\n | PLUSEQUAL\n | MINUSEQUAL\n | LSHIFTEQUAL\n | RSHIFTEQUAL\n | ANDEQUAL\n | OREQUAL\n constant_expression : conditional_expression conditional_expression : binary_expression\n | binary_expression CONDOP expression COLON conditional_expression\n binary_expression : cast_expression\n | binary_expression TIMES binary_expression\n | binary_expression DIVIDE binary_expression\n | binary_expression MOD binary_expression\n | binary_expression PLUS binary_expression\n | binary_expression MINUS binary_expression\n | binary_expression RSHIFT binary_expression\n | binary_expression LSHIFT binary_expression\n | binary_expression LT binary_expression\n | binary_expression LE binary_expression\n | binary_expression GE binary_expression\n | binary_expression GT binary_expression\n | binary_expression EQ binary_expression\n | binary_expression NE binary_expression\n | binary_expression AND binary_expression\n | binary_expression OR binary_expression\n | binary_expression XOR binary_expression\n | binary_expression LAND binary_expression\n | binary_expression LOR binary_expression\n cast_expression : unary_expression cast_expression : LPAREN type_name RPAREN cast_expression unary_expression : postfix_expression unary_expression : PLUSPLUS unary_expression\n | MINUSMINUS unary_expression\n | unary_operator cast_expression\n unary_expression : SIZEOF unary_expression\n | SIZEOF LPAREN type_name RPAREN\n | _ALIGNOF LPAREN type_name RPAREN\n unary_operator : AND\n | TIMES\n | PLUS\n | MINUS\n | NOT\n | LNOT\n postfix_expression : primary_expression postfix_expression : postfix_expression LBRACKET expression RBRACKET postfix_expression : postfix_expression LPAREN argument_expression_list RPAREN\n | postfix_expression LPAREN RPAREN\n postfix_expression : postfix_expression PERIOD ID\n | postfix_expression PERIOD TYPEID\n | postfix_expression ARROW ID\n | postfix_expression ARROW TYPEID\n postfix_expression : postfix_expression PLUSPLUS\n | postfix_expression MINUSMINUS\n postfix_expression : LPAREN type_name RPAREN brace_open initializer_list brace_close\n | LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close\n primary_expression : identifier primary_expression : constant primary_expression : unified_string_literal\n | unified_wstring_literal\n primary_expression : LPAREN expression RPAREN primary_expression : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN\n offsetof_member_designator : identifier\n | offsetof_member_designator PERIOD identifier\n | offsetof_member_designator LBRACKET expression RBRACKET\n argument_expression_list : assignment_expression\n | argument_expression_list COMMA assignment_expression\n identifier : ID constant : INT_CONST_DEC\n | INT_CONST_OCT\n | INT_CONST_HEX\n | INT_CONST_BIN\n | INT_CONST_CHAR\n constant : FLOAT_CONST\n | HEX_FLOAT_CONST\n constant : CHAR_CONST\n | WCHAR_CONST\n | U8CHAR_CONST\n | U16CHAR_CONST\n | U32CHAR_CONST\n unified_string_literal : STRING_LITERAL\n | unified_string_literal STRING_LITERAL\n unified_wstring_literal : WSTRING_LITERAL\n | U8STRING_LITERAL\n | U16STRING_LITERAL\n | U32STRING_LITERAL\n | unified_wstring_literal WSTRING_LITERAL\n | unified_wstring_literal U8STRING_LITERAL\n | unified_wstring_literal U16STRING_LITERAL\n | unified_wstring_literal U32STRING_LITERAL\n brace_open : LBRACE\n brace_close : RBRACE\n empty : ' + +_lr_action_items = {'INT_CONST_CHAR':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,132,-335,-28,-182,-27,132,-337,-87,-72,-337,132,-286,-285,132,132,-283,-287,-288,132,-284,132,132,132,-336,-183,132,132,-28,-337,132,-28,-337,-337,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,-337,-76,-79,-82,-75,132,-77,132,132,-81,-215,-214,-80,-216,132,-78,132,132,-69,-284,132,132,-284,132,132,-244,-247,-245,-241,-242,-246,-248,132,-250,-251,-243,-249,-12,132,132,-11,132,132,132,132,-234,-233,132,-231,132,132,-217,132,-230,132,-84,-218,132,132,132,-337,-337,-198,132,132,132,-337,-284,-229,-232,132,-221,132,-83,-219,-68,132,-28,-337,132,-11,132,132,-220,132,132,132,-284,132,132,132,-337,132,-225,-224,-222,-84,132,132,132,-226,-223,132,-228,-227,]),'VOID':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[6,-337,-113,-128,6,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,6,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,6,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,6,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,6,-131,-95,-101,-97,6,-53,-126,6,-88,6,6,-93,6,-147,-335,-146,6,-167,-166,-182,-100,-126,6,-87,-90,-94,-92,-61,-72,6,-144,-142,6,6,6,-73,6,-89,6,6,6,-149,-159,-160,-156,-336,6,-183,-30,6,6,-74,6,6,6,6,-174,-175,6,-143,-140,6,-141,-145,-76,-79,-82,-75,-77,6,-81,-215,-214,-80,-216,-78,-127,6,-153,6,-151,-148,-157,-168,-69,-36,-35,6,6,6,-234,-233,6,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,6,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LBRACKET':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,71,73,76,77,80,81,82,86,96,97,98,100,101,103,104,105,106,109,111,127,132,133,134,136,138,139,140,141,142,143,145,147,148,152,153,154,156,160,161,163,164,166,167,168,169,176,177,187,191,198,199,200,211,216,227,230,235,236,237,238,240,241,261,263,269,275,276,278,279,280,283,310,312,314,316,317,328,340,341,342,344,345,347,355,356,371,376,402,403,404,405,407,411,414,442,443,448,449,453,454,457,458,464,465,470,472,474,482,483,488,489,490,492,511,512,518,519,520,526,527,529,530,531,532,544,545,547,550,551,559,560,563,565,570,571,572,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,117,-123,-117,-119,-114,-130,-118,-103,-96,-98,128,-131,-37,-95,-101,-97,117,-147,-335,-146,-167,-166,-28,-180,-182,-27,-100,-126,128,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-314,-142,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,265,-323,-312,282,-149,-336,-183,-181,-30,282,-38,373,-326,-334,-332,-331,-333,-174,-175,-298,-297,-143,-140,282,282,-141,-145,421,-312,-127,-153,-151,-148,-168,-36,-35,282,282,459,-45,-44,-43,-199,373,-296,-295,-294,-293,-292,-305,421,-152,-150,-170,-169,-31,-34,282,459,-39,-42,-202,373,-200,-290,-291,373,-213,-207,-211,-33,-32,-41,-40,-201,549,-307,-209,-208,-210,-212,-51,-50,-306,373,-299,-46,-49,-308,-300,-48,-47,-309,]),'WCHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,133,-335,-28,-182,-27,133,-337,-87,-72,-337,133,-286,-285,133,133,-283,-287,-288,133,-284,133,133,133,-336,-183,133,133,-28,-337,133,-28,-337,-337,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-337,-76,-79,-82,-75,133,-77,133,133,-81,-215,-214,-80,-216,133,-78,133,133,-69,-284,133,133,-284,133,133,-244,-247,-245,-241,-242,-246,-248,133,-250,-251,-243,-249,-12,133,133,-11,133,133,133,133,-234,-233,133,-231,133,133,-217,133,-230,133,-84,-218,133,133,133,-337,-337,-198,133,133,133,-337,-284,-229,-232,133,-221,133,-83,-219,-68,133,-28,-337,133,-11,133,133,-220,133,133,133,-284,133,133,133,-337,133,-225,-224,-222,-84,133,133,133,-226,-223,133,-228,-227,]),'FLOAT_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,134,-335,-28,-182,-27,134,-337,-87,-72,-337,134,-286,-285,134,134,-283,-287,-288,134,-284,134,134,134,-336,-183,134,134,-28,-337,134,-28,-337,-337,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,-337,-76,-79,-82,-75,134,-77,134,134,-81,-215,-214,-80,-216,134,-78,134,134,-69,-284,134,134,-284,134,134,-244,-247,-245,-241,-242,-246,-248,134,-250,-251,-243,-249,-12,134,134,-11,134,134,134,134,-234,-233,134,-231,134,134,-217,134,-230,134,-84,-218,134,134,134,-337,-337,-198,134,134,134,-337,-284,-229,-232,134,-221,134,-83,-219,-68,134,-28,-337,134,-11,134,134,-220,134,134,134,-284,134,134,134,-337,134,-225,-224,-222,-84,134,134,134,-226,-223,134,-228,-227,]),'MINUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,135,-335,-28,-182,-27,135,-337,-87,-72,-337,135,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,135,-327,135,-283,-287,-325,-304,-322,-302,-255,-315,-289,245,-328,-316,-288,-329,-320,-276,-323,135,-284,135,135,-312,135,-336,-183,135,135,-28,-337,135,-28,-337,-274,-337,135,-326,135,-280,135,-277,-334,-332,-331,-333,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-298,-297,135,135,-279,-278,-337,-76,-79,-82,-75,135,-77,135,135,-81,-215,-214,-80,-216,135,-78,-312,135,135,-69,-284,135,135,-284,135,135,-244,-247,-245,-241,-242,-246,-248,135,-250,-251,-243,-249,-12,135,135,-11,245,245,245,-260,245,245,245,-259,245,245,-257,-256,245,245,245,245,245,-258,-296,-295,-294,-293,-292,-305,135,135,135,135,-234,-233,135,-231,135,135,-217,135,-230,135,-84,-218,135,135,135,-337,-337,-198,135,-281,-282,135,-290,-291,135,-275,-337,-284,-229,-232,135,-221,135,-83,-219,-68,135,-28,-337,135,-11,135,135,-220,135,135,135,-284,135,135,-306,135,-337,-299,135,-225,-224,-222,-84,-300,135,135,135,-226,-223,135,-228,-227,]),'RPAREN':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,71,73,76,77,80,81,82,86,96,98,100,101,103,104,105,106,107,109,111,118,125,127,129,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,157,158,159,160,161,162,163,164,166,167,168,169,176,177,178,183,187,191,198,199,200,203,207,208,209,210,211,212,213,215,216,221,222,224,225,230,232,234,235,236,237,238,240,241,261,263,266,268,269,270,271,272,273,274,275,276,277,278,279,280,281,283,294,312,314,316,317,328,340,341,342,343,344,345,346,347,348,355,356,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,408,409,411,414,415,416,417,418,422,433,439,442,443,448,449,452,453,454,457,458,460,461,462,463,464,465,468,476,478,480,482,483,486,487,489,490,492,495,501,503,507,511,512,516,517,518,519,524,525,526,527,529,530,531,532,544,545,547,551,553,556,559,560,563,565,566,567,570,571,572,573,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-103,-96,-98,-54,-131,-37,-95,-101,-97,-53,-147,-146,-167,-166,-28,-180,-182,-27,200,-100,-126,-337,216,-55,-337,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,240,-255,241,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-337,-252,312,-149,-336,-183,-181,-30,332,340,-17,341,-186,-337,-18,-184,-191,-38,355,356,-274,-239,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,407,-279,-143,411,413,-235,-278,-203,-140,-204,-1,-337,-141,-145,-2,-206,-14,-127,-153,-151,-148,-168,-36,-35,-337,-190,-204,-56,-188,-45,-189,-44,-43,476,477,478,479,480,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-310,483,-305,-205,-23,-24,489,490,-337,-13,-218,-152,-150,-170,-169,510,-31,-34,-204,-57,-337,-192,-185,-187,-39,-42,-240,-237,-281,-282,-290,-291,-236,-275,-213,-207,-211,532,535,537,539,-33,-32,544,545,-41,-40,-254,-311,547,-307,-209,-208,-210,-212,-51,-50,-306,-299,-337,568,-46,-49,-308,-300,-337,574,-48,-47,-309,577,]),'STRUCT':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[24,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,24,-65,-102,-337,-131,-108,-63,-129,24,-29,-62,-70,-52,-337,-337,-337,-130,24,-71,-103,-337,-9,-131,-91,-10,24,24,-53,-337,-88,24,24,-93,24,-335,24,-182,24,-87,-90,-94,-92,-61,-72,24,24,24,-73,24,-89,24,24,24,-159,-160,-156,-336,-183,-30,24,-74,24,24,24,24,-174,-175,24,24,-76,-79,-82,-75,-77,24,-81,-215,-214,-80,-216,-78,-127,24,24,-157,-69,-36,-35,24,24,24,-234,-233,24,-231,-217,-230,-81,-84,-218,-158,-31,-34,24,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LONG':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[23,-337,-113,-128,23,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,23,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,23,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,23,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,23,-131,-95,-101,-97,23,-53,-126,23,-88,23,23,-93,23,-147,-335,-146,23,-167,-166,-182,-100,-126,23,-87,-90,-94,-92,-61,-72,23,-144,-142,23,23,23,-73,23,-89,23,23,23,-149,-159,-160,-156,-336,23,-183,-30,23,23,-74,23,23,23,23,-174,-175,23,-143,-140,23,-141,-145,-76,-79,-82,-75,-77,23,-81,-215,-214,-80,-216,-78,-127,23,-153,23,-151,-148,-157,-168,-69,-36,-35,23,23,23,-234,-233,23,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,23,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PLUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,137,-335,-28,-182,-27,137,-337,-87,-72,-337,137,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,137,-327,137,-283,-287,-325,-304,-322,-302,-255,-315,-289,249,-328,-316,-288,-329,-320,-276,-323,137,-284,137,137,-312,137,-336,-183,137,137,-28,-337,137,-28,-337,-274,-337,137,-326,137,-280,137,-277,-334,-332,-331,-333,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-298,-297,137,137,-279,-278,-337,-76,-79,-82,-75,137,-77,137,137,-81,-215,-214,-80,-216,137,-78,-312,137,137,-69,-284,137,137,-284,137,137,-244,-247,-245,-241,-242,-246,-248,137,-250,-251,-243,-249,-12,137,137,-11,249,249,249,-260,249,249,249,-259,249,249,-257,-256,249,249,249,249,249,-258,-296,-295,-294,-293,-292,-305,137,137,137,137,-234,-233,137,-231,137,137,-217,137,-230,137,-84,-218,137,137,137,-337,-337,-198,137,-281,-282,137,-290,-291,137,-275,-337,-284,-229,-232,137,-221,137,-83,-219,-68,137,-28,-337,137,-11,137,137,-220,137,137,137,-284,137,137,-306,137,-337,-299,137,-225,-224,-222,-84,-300,137,137,137,-226,-223,137,-228,-227,]),'ELLIPSIS':([350,],[462,]),'U32STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,139,-335,-28,-182,-27,139,-337,-87,-72,-337,139,-286,-285,-330,139,-327,139,-283,-287,235,-328,-288,-329,139,-284,139,139,139,-336,-183,139,139,-28,-337,139,-28,-337,-337,139,139,139,-334,-332,-331,-333,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,-337,-76,-79,-82,-75,139,-77,139,139,-81,-215,-214,-80,-216,139,-78,139,139,-69,-284,139,139,-284,139,139,-244,-247,-245,-241,-242,-246,-248,139,-250,-251,-243,-249,-12,139,139,-11,139,139,139,139,-234,-233,139,-231,139,139,-217,139,-230,139,-84,-218,139,139,139,-337,-337,-198,139,139,139,-337,-284,-229,-232,139,-221,139,-83,-219,-68,139,-28,-337,139,-11,139,139,-220,139,139,139,-284,139,139,139,-337,139,-225,-224,-222,-84,139,139,139,-226,-223,139,-228,-227,]),'GT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,250,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,250,-262,-260,-264,250,-263,-259,-266,250,-257,-256,-265,250,250,250,250,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'GOTO':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,287,-336,-76,-79,-82,-75,-77,287,-81,-215,-214,-80,-216,287,-78,-69,-234,-233,-231,287,-217,-230,287,-84,-218,287,-229,-232,-221,287,-83,-219,-68,287,-220,287,287,-225,-224,-222,-84,287,287,-226,-223,287,-228,-227,]),'ENUM':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[32,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,32,-65,-102,-337,-131,-108,-63,-129,32,-29,-62,-70,-52,-337,-337,-337,-130,32,-71,-103,-337,-9,-131,-91,-10,32,32,-53,-337,-88,32,32,-93,32,-335,32,-182,32,-87,-90,-94,-92,-61,-72,32,32,32,-73,32,-89,32,32,32,-159,-160,-156,-336,-183,-30,32,-74,32,32,32,32,-174,-175,32,32,-76,-79,-82,-75,-77,32,-81,-215,-214,-80,-216,-78,-127,32,32,-157,-69,-36,-35,32,32,32,-234,-233,32,-231,-217,-230,-81,-84,-218,-158,-31,-34,32,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PERIOD':([97,132,133,134,136,138,139,140,141,143,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,227,230,235,236,237,238,261,263,310,371,376,402,403,404,405,407,411,470,472,474,482,483,488,520,526,527,547,550,551,563,565,572,],[-335,-317,-321,-318,-303,-324,-330,-313,-319,-301,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,264,-323,-312,-336,372,-326,-334,-332,-331,-333,-298,-297,-312,-199,372,-296,-295,-294,-293,-292,-305,-202,372,-200,-290,-291,372,-201,548,-307,-306,372,-299,-308,-300,-309,]),'GE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,254,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,254,-262,-260,-264,254,-263,-259,-266,254,-257,-256,-265,254,254,254,254,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'INT_CONST_DEC':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,140,-335,-28,-182,-27,140,-337,-87,-72,-337,140,-286,-285,140,140,-283,-287,-288,140,-284,140,140,140,-336,-183,140,140,-28,-337,140,-28,-337,-337,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,-337,-76,-79,-82,-75,140,-77,140,140,-81,-215,-214,-80,-216,140,-78,140,140,-69,-284,140,140,-284,140,140,-244,-247,-245,-241,-242,-246,-248,140,-250,-251,-243,-249,-12,140,140,-11,140,140,140,140,-234,-233,140,-231,140,140,-217,140,-230,140,-84,-218,140,140,140,-337,-337,-198,140,140,140,-337,-284,-229,-232,140,-221,140,-83,-219,-68,140,-28,-337,140,-11,140,140,-220,140,140,140,-284,140,140,140,-337,140,-225,-224,-222,-84,140,140,140,-226,-223,140,-228,-227,]),'ARROW':([132,133,134,136,138,139,140,141,143,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,230,235,236,237,238,261,263,310,402,403,404,405,407,411,482,483,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,262,-323,-312,-336,-326,-334,-332,-331,-333,-298,-297,-312,-296,-295,-294,-293,-292,-305,-290,-291,-306,-299,-300,]),'_STATIC_ASSERT':([0,14,16,17,19,25,38,45,47,59,61,97,119,123,124,180,181,191,223,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[41,-64,-60,-67,-66,-65,-63,-62,-70,41,-71,-335,-87,-61,-72,-73,41,-336,-74,-76,-79,-82,-75,-77,41,-81,-215,-214,-80,-216,41,-78,-69,-234,-233,-231,41,-217,-230,41,-84,-218,41,-229,-232,-221,41,-83,-219,-68,41,-220,41,41,-225,-224,-222,-84,41,41,-226,-223,41,-228,-227,]),'CHAR':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[46,-337,-113,-128,46,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,46,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,46,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,46,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,46,-131,-95,-101,-97,46,-53,-126,46,-88,46,46,-93,46,-147,-335,-146,46,-167,-166,-182,-100,-126,46,-87,-90,-94,-92,-61,-72,46,-144,-142,46,46,46,-73,46,-89,46,46,46,-149,-159,-160,-156,-336,46,-183,-30,46,46,-74,46,46,46,46,-174,-175,46,-143,-140,46,-141,-145,-76,-79,-82,-75,-77,46,-81,-215,-214,-80,-216,-78,-127,46,-153,46,-151,-148,-157,-168,-69,-36,-35,46,46,46,-234,-233,46,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,46,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'HEX_FLOAT_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,141,-335,-28,-182,-27,141,-337,-87,-72,-337,141,-286,-285,141,141,-283,-287,-288,141,-284,141,141,141,-336,-183,141,141,-28,-337,141,-28,-337,-337,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,-337,-76,-79,-82,-75,141,-77,141,141,-81,-215,-214,-80,-216,141,-78,141,141,-69,-284,141,141,-284,141,141,-244,-247,-245,-241,-242,-246,-248,141,-250,-251,-243,-249,-12,141,141,-11,141,141,141,141,-234,-233,141,-231,141,141,-217,141,-230,141,-84,-218,141,141,141,-337,-337,-198,141,141,141,-337,-284,-229,-232,141,-221,141,-83,-219,-68,141,-28,-337,141,-11,141,141,-220,141,141,141,-284,141,141,141,-337,141,-225,-224,-222,-84,141,141,141,-226,-223,141,-228,-227,]),'DOUBLE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[50,-337,-113,-128,50,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,50,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,50,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,50,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,50,-131,-95,-101,-97,50,-53,-126,50,-88,50,50,-93,50,-147,-335,-146,50,-167,-166,-182,-100,-126,50,-87,-90,-94,-92,-61,-72,50,-144,-142,50,50,50,-73,50,-89,50,50,50,-149,-159,-160,-156,-336,50,-183,-30,50,50,-74,50,50,50,50,-174,-175,50,-143,-140,50,-141,-145,-76,-79,-82,-75,-77,50,-81,-215,-214,-80,-216,-78,-127,50,-153,50,-151,-148,-157,-168,-69,-36,-35,50,50,50,-234,-233,50,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,50,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'MINUSEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,358,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'INT_CONST_OCT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,145,-335,-28,-182,-27,145,-337,-87,-72,-337,145,-286,-285,145,145,-283,-287,-288,145,-284,145,145,145,-336,-183,145,145,-28,-337,145,-28,-337,-337,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-337,-76,-79,-82,-75,145,-77,145,145,-81,-215,-214,-80,-216,145,-78,145,145,-69,-284,145,145,-284,145,145,-244,-247,-245,-241,-242,-246,-248,145,-250,-251,-243,-249,-12,145,145,-11,145,145,145,145,-234,-233,145,-231,145,145,-217,145,-230,145,-84,-218,145,145,145,-337,-337,-198,145,145,145,-337,-284,-229,-232,145,-221,145,-83,-219,-68,145,-28,-337,145,-11,145,145,-220,145,145,145,-284,145,145,145,-337,145,-225,-224,-222,-84,145,145,145,-226,-223,145,-228,-227,]),'TIMESEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,367,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'OR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,259,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,259,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,259,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SHORT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[2,-337,-113,-128,2,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,2,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,2,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,2,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,2,-131,-95,-101,-97,2,-53,-126,2,-88,2,2,-93,2,-147,-335,-146,2,-167,-166,-182,-100,-126,2,-87,-90,-94,-92,-61,-72,2,-144,-142,2,2,2,-73,2,-89,2,2,2,-149,-159,-160,-156,-336,2,-183,-30,2,2,-74,2,2,2,2,-174,-175,2,-143,-140,2,-141,-145,-76,-79,-82,-75,-77,2,-81,-215,-214,-80,-216,-78,-127,2,-153,2,-151,-148,-157,-168,-69,-36,-35,2,2,2,-234,-233,2,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,2,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'RETURN':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,290,-336,-76,-79,-82,-75,-77,290,-81,-215,-214,-80,-216,290,-78,-69,-234,-233,-231,290,-217,-230,290,-84,-218,290,-229,-232,-221,290,-83,-219,-68,290,-220,290,290,-225,-224,-222,-84,290,290,-226,-223,290,-228,-227,]),'RSHIFTEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,368,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'_ALIGNAS':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,109,111,118,119,123,124,129,142,147,174,177,180,181,182,184,185,186,187,188,189,190,191,192,200,211,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[8,8,-113,-128,8,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,8,-120,-115,-65,-102,8,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,8,8,-119,8,-114,-130,8,-118,-71,-103,8,-131,-96,-98,8,-131,-95,-101,-97,8,-53,8,8,-88,8,8,-147,-335,-146,8,-167,-166,-100,-126,8,-87,-61,-72,8,-144,-142,8,8,-73,8,-89,8,8,8,-149,-159,-160,-156,-336,8,-30,8,-74,8,8,8,8,-174,-175,8,-143,-140,8,-141,-145,-76,-79,-82,-75,-77,8,-81,-215,-214,-80,-216,-78,-127,8,-153,8,-151,-148,-157,-168,-69,-36,-35,8,8,8,-234,-233,8,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,8,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'RESTRICT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[39,39,-113,-128,39,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,39,-120,-115,-65,-102,39,-131,-108,-238,-111,39,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,39,39,-119,39,-114,-130,39,-118,-71,-103,39,-131,-96,-98,39,-131,-95,-101,-97,39,-53,39,39,-88,39,39,-147,-335,-146,39,-167,-166,39,-182,-100,-126,39,39,-87,-61,-72,39,39,-144,-142,39,39,39,-73,39,-89,39,39,39,-149,-159,-160,-156,-336,39,-183,-30,39,39,39,39,39,-74,39,39,39,39,-174,-175,39,-143,-140,39,-141,-145,39,-76,-79,-82,-75,-77,39,-81,-215,-214,-80,-216,-78,-127,39,-153,39,-151,-148,-157,-168,-69,-36,-35,39,39,39,-234,-233,39,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,39,39,-229,-232,-221,-83,-219,-68,-33,-32,39,39,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'STATIC':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,105,109,111,117,118,119,123,124,128,129,180,181,182,187,191,198,200,205,211,219,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,536,554,555,557,558,575,576,578,579,],[10,10,-113,-128,10,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,10,-120,-115,-65,-102,10,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,10,10,-119,10,-114,-130,10,-118,-71,-103,10,-131,-96,-98,10,-131,-95,-101,-97,-53,10,10,-88,10,-147,-335,-146,-167,-166,-182,-100,-126,206,10,-87,-61,-72,220,10,-73,10,-89,-149,-336,-183,-30,338,10,353,-74,-174,-175,10,-76,-79,-82,-75,-77,10,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,10,10,10,-234,-233,10,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,515,10,-229,-232,-221,-83,-219,-68,-33,-32,542,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'SIZEOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,146,-335,-28,-182,-27,146,-337,-87,-72,-337,146,-286,-285,146,146,-283,-287,-288,146,-284,146,146,146,-336,-183,146,146,-28,-337,146,-28,-337,-337,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,-337,-76,-79,-82,-75,146,-77,146,146,-81,-215,-214,-80,-216,146,-78,146,146,-69,-284,146,146,-284,146,146,-244,-247,-245,-241,-242,-246,-248,146,-250,-251,-243,-249,-12,146,146,-11,146,146,146,146,-234,-233,146,-231,146,146,-217,146,-230,146,-84,-218,146,146,146,-337,-337,-198,146,146,146,-337,-284,-229,-232,146,-221,146,-83,-219,-68,146,-28,-337,146,-11,146,146,-220,146,146,146,-284,146,146,146,-337,146,-225,-224,-222,-84,146,146,146,-226,-223,146,-228,-227,]),'UNSIGNED':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[22,-337,-113,-128,22,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,22,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,22,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,22,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,22,-131,-95,-101,-97,22,-53,-126,22,-88,22,22,-93,22,-147,-335,-146,22,-167,-166,-182,-100,-126,22,-87,-90,-94,-92,-61,-72,22,-144,-142,22,22,22,-73,22,-89,22,22,22,-149,-159,-160,-156,-336,22,-183,-30,22,22,-74,22,22,22,22,-174,-175,22,-143,-140,22,-141,-145,-76,-79,-82,-75,-77,22,-81,-215,-214,-80,-216,-78,-127,22,-153,22,-151,-148,-157,-168,-69,-36,-35,22,22,22,-234,-233,22,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,22,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'UNION':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[28,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,28,-65,-102,-337,-131,-108,-63,-129,28,-29,-62,-70,-52,-337,-337,-337,-130,28,-71,-103,-337,-9,-131,-91,-10,28,28,-53,-337,-88,28,28,-93,28,-335,28,-182,28,-87,-90,-94,-92,-61,-72,28,28,28,-73,28,-89,28,28,28,-159,-160,-156,-336,-183,-30,28,-74,28,28,28,28,-174,-175,28,28,-76,-79,-82,-75,-77,28,-81,-215,-214,-80,-216,-78,-127,28,28,-157,-69,-36,-35,28,28,28,-234,-233,28,-231,-217,-230,-81,-84,-218,-158,-31,-34,28,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'COLON':([2,3,5,6,12,22,23,33,34,36,39,42,43,44,46,48,49,50,54,56,58,60,73,74,76,77,86,96,98,100,101,111,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,179,187,191,192,200,216,224,225,230,232,234,235,236,237,238,240,241,261,263,268,269,272,273,275,279,280,295,310,312,314,316,317,324,328,340,341,355,356,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,407,411,431,442,443,445,448,449,453,454,464,465,468,476,478,480,482,483,486,487,511,512,518,519,524,547,551,565,],[-113,-128,-124,-110,-125,-120,-115,-238,-111,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-54,-179,-131,-37,-53,-147,-146,-167,-166,-126,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-178,-149,-336,319,-30,-38,-274,-239,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,-235,-278,-140,-141,-145,429,440,-127,-153,-151,-148,447,-168,-36,-35,-44,-43,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,481,-270,-258,-296,-295,-294,-293,-292,-305,502,-152,-150,319,-170,-169,-31,-34,-39,-42,-240,-237,-281,-282,-290,-291,-236,-275,-33,-32,-41,-40,-254,-306,-299,-300,]),'$end':([0,9,14,16,17,19,25,38,45,47,57,59,61,119,123,124,180,191,223,332,439,510,],[-337,0,-64,-60,-67,-66,-65,-63,-62,-70,-59,-58,-71,-87,-61,-72,-73,-336,-74,-69,-218,-68,]),'WSTRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,148,-335,-28,-182,-27,148,-337,-87,-72,-337,148,-286,-285,-330,148,-327,148,-283,-287,237,-328,-288,-329,148,-284,148,148,148,-336,-183,148,148,-28,-337,148,-28,-337,-337,148,148,148,-334,-332,-331,-333,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-337,-76,-79,-82,-75,148,-77,148,148,-81,-215,-214,-80,-216,148,-78,148,148,-69,-284,148,148,-284,148,148,-244,-247,-245,-241,-242,-246,-248,148,-250,-251,-243,-249,-12,148,148,-11,148,148,148,148,-234,-233,148,-231,148,148,-217,148,-230,148,-84,-218,148,148,148,-337,-337,-198,148,148,148,-337,-284,-229,-232,148,-221,148,-83,-219,-68,148,-28,-337,148,-11,148,148,-220,148,148,148,-284,148,148,148,-337,148,-225,-224,-222,-84,148,148,148,-226,-223,148,-228,-227,]),'DIVIDE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,252,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,252,252,252,252,252,252,252,252,252,252,-257,-256,252,252,252,252,252,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'FOR':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,292,-336,-76,-79,-82,-75,-77,292,-81,-215,-214,-80,-216,292,-78,-69,-234,-233,-231,292,-217,-230,292,-84,-218,292,-229,-232,-221,292,-83,-219,-68,292,-220,292,292,-225,-224,-222,-84,292,292,-226,-223,292,-228,-227,]),'PLUSPLUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,145,146,148,149,150,151,152,153,154,156,160,161,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,482,483,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,149,-335,-28,-182,-27,149,-337,-87,-72,-337,149,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-314,149,-327,149,-283,-287,-325,-304,-322,-302,-315,-289,-328,-316,-288,-329,-320,263,-323,149,-284,149,149,-312,149,-336,-183,149,149,-28,-337,149,-28,-337,-337,149,-326,149,149,-334,-332,-331,-333,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-298,-297,149,149,-337,-76,-79,-82,-75,149,-77,149,149,-81,-215,-214,-80,-216,149,-78,-312,149,149,-69,-284,149,149,-284,149,149,-244,-247,-245,-241,-242,-246,-248,149,-250,-251,-243,-249,-12,149,149,-11,-296,-295,-294,-293,-292,-305,149,149,149,149,-234,-233,149,-231,149,149,-217,149,-230,149,-84,-218,149,149,149,-337,-337,-198,149,149,-290,-291,149,-337,-284,-229,-232,149,-221,149,-83,-219,-68,149,-28,-337,149,-11,149,149,-220,149,149,149,-284,149,149,-306,149,-337,-299,149,-225,-224,-222,-84,-300,149,149,149,-226,-223,149,-228,-227,]),'EQUALS':([42,48,73,74,75,77,78,86,110,127,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,179,191,197,200,216,224,230,232,234,235,236,237,238,261,263,268,273,310,340,341,355,356,371,376,402,403,404,405,407,411,453,454,464,465,470,474,478,480,482,483,487,511,512,518,519,520,547,551,565,],[-29,-52,-54,-179,-178,-37,131,-53,201,-55,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-178,-336,329,-30,-38,360,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-36,-35,-44,-43,-199,475,-296,-295,-294,-293,-292,-305,-31,-34,-39,-42,-202,-200,-281,-282,-290,-291,-275,-33,-32,-41,-40,-201,-306,-299,-300,]),'ELSE':([61,124,191,284,285,286,289,291,300,303,308,332,424,425,428,435,437,438,439,496,497,500,505,506,510,536,554,555,557,558,575,576,578,579,],[-71,-72,-336,-76,-79,-82,-75,-77,-81,-80,-78,-69,-234,-233,-231,-230,-81,-84,-218,-229,-232,-221,-83,-219,-68,-220,-225,-224,-222,569,-226,-223,-228,-227,]),'ANDEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,365,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'EQ':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,256,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,256,-262,-260,-264,-268,-263,-259,-266,256,-257,-256,-265,256,-267,256,256,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'AND':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,150,-335,-28,-182,-27,150,-337,-87,-72,-337,150,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,150,-327,150,-283,-287,-325,-304,-322,-302,-255,-315,-289,257,-328,-316,-288,-329,-320,-276,-323,150,-284,150,150,-312,150,-336,-183,150,150,-28,-337,150,-28,-337,-274,-337,150,-326,150,-280,150,-277,-334,-332,-331,-333,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,-298,-297,150,150,-279,-278,-337,-76,-79,-82,-75,150,-77,150,150,-81,-215,-214,-80,-216,150,-78,-312,150,150,-69,-284,150,150,-284,150,150,-244,-247,-245,-241,-242,-246,-248,150,-250,-251,-243,-249,-12,150,150,-11,-261,257,-262,-260,-264,-268,-263,-259,-266,257,-257,-256,-265,257,-267,-269,257,-258,-296,-295,-294,-293,-292,-305,150,150,150,150,-234,-233,150,-231,150,150,-217,150,-230,150,-84,-218,150,150,150,-337,-337,-198,150,-281,-282,150,-290,-291,150,-275,-337,-284,-229,-232,150,-221,150,-83,-219,-68,150,-28,-337,150,-11,150,150,-220,150,150,150,-284,150,150,-306,150,-337,-299,150,-225,-224,-222,-84,-300,150,150,150,-226,-223,150,-228,-227,]),'TYPEID':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,103,104,105,106,109,111,118,119,120,121,122,123,124,126,129,142,147,172,174,180,181,182,184,185,186,187,188,189,190,191,192,198,199,200,202,211,214,223,229,231,233,239,240,241,262,264,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,344,350,422,424,425,427,428,432,435,437,438,439,442,443,445,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[33,-337,-113,-128,77,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,33,-120,-115,-154,-65,-102,-126,-155,-131,-108,96,100,-238,-111,-337,-122,-63,-129,33,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,33,-118,-71,-103,-337,-9,-131,-91,-10,-96,77,-98,77,33,-131,-95,-101,-97,33,-53,-126,77,-88,33,33,-93,33,-147,-335,-146,33,-167,-166,-28,-180,-182,-27,-100,-126,33,-87,-90,-94,-92,-61,-72,77,33,-144,-142,33,33,-73,33,-89,33,33,33,-149,-159,-160,-156,-336,77,-183,-181,-30,77,347,33,-74,33,33,33,33,-174,-175,402,404,33,-143,-140,33,-141,-145,-76,-79,-82,-75,-77,33,-81,-215,-214,-80,-216,-78,-127,33,-153,33,-151,-148,-157,-168,-69,-36,-35,33,347,33,33,-234,-233,33,-231,-217,-230,-81,-84,-218,-152,-150,77,-158,-170,-169,-31,-34,33,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LBRACE':([21,24,28,31,32,42,48,61,75,86,88,90,92,93,96,97,98,100,101,119,124,130,131,181,182,191,200,201,227,229,284,285,286,289,291,298,300,301,302,303,305,307,308,332,340,341,369,375,377,413,424,425,428,429,432,435,437,438,439,440,453,454,472,475,477,478,479,488,496,497,500,502,505,506,510,511,512,521,522,535,536,537,539,550,554,555,557,558,569,574,575,576,577,578,579,],[-337,-154,-155,97,97,-29,-52,-71,-337,-53,-7,-88,97,-8,97,-335,97,97,97,-87,-72,97,97,97,-89,-336,-30,97,-337,97,-76,-79,-82,-75,-77,97,-81,-215,-214,-80,-216,97,-78,-69,-36,-35,-12,97,-11,97,-234,-233,-231,97,-217,-230,97,-84,-218,97,-31,-34,-337,-198,97,97,97,-337,-229,-232,-221,97,-83,-219,-68,-33,-32,97,-11,97,-220,97,97,-337,-225,-224,-222,-84,97,97,-226,-223,97,-228,-227,]),'PPHASH':([0,14,16,17,19,25,38,45,47,59,61,119,123,124,180,191,223,332,439,510,],[47,-64,-60,-67,-66,-65,-63,-62,-70,47,-71,-87,-61,-72,-73,-336,-74,-69,-218,-68,]),'INT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[56,-337,-113,-128,56,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,56,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,56,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,56,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,56,-131,-95,-101,-97,56,-53,-126,56,-88,56,56,-93,56,-147,-335,-146,56,-167,-166,-182,-100,-126,56,-87,-90,-94,-92,-61,-72,56,-144,-142,56,56,56,-73,56,-89,56,56,56,-149,-159,-160,-156,-336,56,-183,-30,56,56,-74,56,56,56,56,-174,-175,56,-143,-140,56,-141,-145,-76,-79,-82,-75,-77,56,-81,-215,-214,-80,-216,-78,-127,56,-153,56,-151,-148,-157,-168,-69,-36,-35,56,56,56,-234,-233,56,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,56,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'SIGNED':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[54,-337,-113,-128,54,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,54,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,54,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,54,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,54,-131,-95,-101,-97,54,-53,-126,54,-88,54,54,-93,54,-147,-335,-146,54,-167,-166,-182,-100,-126,54,-87,-90,-94,-92,-61,-72,54,-144,-142,54,54,54,-73,54,-89,54,54,54,-149,-159,-160,-156,-336,54,-183,-30,54,54,-74,54,54,54,54,-174,-175,54,-143,-140,54,-141,-145,-76,-79,-82,-75,-77,54,-81,-215,-214,-80,-216,-78,-127,54,-153,54,-151,-148,-157,-168,-69,-36,-35,54,54,54,-234,-233,54,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,54,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'CONTINUE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,293,-336,-76,-79,-82,-75,-77,293,-81,-215,-214,-80,-216,293,-78,-69,-234,-233,-231,293,-217,-230,293,-84,-218,293,-229,-232,-221,293,-83,-219,-68,293,-220,293,293,-225,-224,-222,-84,293,293,-226,-223,293,-228,-227,]),'NOT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,151,-335,-28,-182,-27,151,-337,-87,-72,-337,151,-286,-285,151,151,-283,-287,-288,151,-284,151,151,151,-336,-183,151,151,-28,-337,151,-28,-337,-337,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,-337,-76,-79,-82,-75,151,-77,151,151,-81,-215,-214,-80,-216,151,-78,151,151,-69,-284,151,151,-284,151,151,-244,-247,-245,-241,-242,-246,-248,151,-250,-251,-243,-249,-12,151,151,-11,151,151,151,151,-234,-233,151,-231,151,151,-217,151,-230,151,-84,-218,151,151,151,-337,-337,-198,151,151,151,-337,-284,-229,-232,151,-221,151,-83,-219,-68,151,-28,-337,151,-11,151,151,-220,151,151,151,-284,151,151,151,-337,151,-225,-224,-222,-84,151,151,151,-226,-223,151,-228,-227,]),'OREQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,366,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'MOD':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,260,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,260,260,260,260,260,260,260,260,260,260,-257,-256,260,260,260,260,260,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'RSHIFT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,242,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,242,-262,-260,242,242,242,-259,242,242,-257,-256,242,242,242,242,242,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'DEFAULT':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,295,-336,-76,-79,-82,-75,-77,295,-81,-215,-214,-80,-216,295,-78,-69,-234,-233,-231,295,-217,-230,295,-84,-218,295,-229,-232,-221,295,-83,-219,-68,295,-220,295,295,-225,-224,-222,-84,295,295,-226,-223,295,-228,-227,]),'_NORETURN':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[20,20,-113,-128,20,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,20,-120,-115,-65,-102,20,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,20,20,-119,20,-114,-130,20,-118,-71,-103,20,-131,-96,-98,20,-131,-95,-101,-97,-53,20,20,-88,20,-147,-335,-146,-167,-166,-100,-126,20,-87,-61,-72,20,-73,20,-89,-149,-336,-30,20,-74,-174,-175,20,-76,-79,-82,-75,-77,20,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,20,20,20,-234,-233,20,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,20,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'__INT128':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[43,-337,-113,-128,43,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,43,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,43,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,43,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,43,-131,-95,-101,-97,43,-53,-126,43,-88,43,43,-93,43,-147,-335,-146,43,-167,-166,-182,-100,-126,43,-87,-90,-94,-92,-61,-72,43,-144,-142,43,43,43,-73,43,-89,43,43,43,-149,-159,-160,-156,-336,43,-183,-30,43,43,-74,43,43,43,43,-174,-175,43,-143,-140,43,-141,-145,-76,-79,-82,-75,-77,43,-81,-215,-214,-80,-216,-78,-127,43,-153,43,-151,-148,-157,-168,-69,-36,-35,43,43,43,-234,-233,43,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,43,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'WHILE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,436,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,296,-336,-76,-79,-82,-75,-77,296,-81,-215,-214,-80,-216,296,-78,-69,-234,-233,-231,296,-217,-230,504,296,-84,-218,296,-229,-232,-221,296,-83,-219,-68,296,-220,296,296,-225,-224,-222,-84,296,296,-226,-223,296,-228,-227,]),'U8CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,154,-335,-28,-182,-27,154,-337,-87,-72,-337,154,-286,-285,154,154,-283,-287,-288,154,-284,154,154,154,-336,-183,154,154,-28,-337,154,-28,-337,-337,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,-337,-76,-79,-82,-75,154,-77,154,154,-81,-215,-214,-80,-216,154,-78,154,154,-69,-284,154,154,-284,154,154,-244,-247,-245,-241,-242,-246,-248,154,-250,-251,-243,-249,-12,154,154,-11,154,154,154,154,-234,-233,154,-231,154,154,-217,154,-230,154,-84,-218,154,154,154,-337,-337,-198,154,154,154,-337,-284,-229,-232,154,-221,154,-83,-219,-68,154,-28,-337,154,-11,154,154,-220,154,154,154,-284,154,154,154,-337,154,-225,-224,-222,-84,154,154,154,-226,-223,154,-228,-227,]),'_ALIGNOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,155,-335,-28,-182,-27,155,-337,-87,-72,-337,155,-286,-285,155,155,-283,-287,-288,155,-284,155,155,155,-336,-183,155,155,-28,-337,155,-28,-337,-337,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,-337,-76,-79,-82,-75,155,-77,155,155,-81,-215,-214,-80,-216,155,-78,155,155,-69,-284,155,155,-284,155,155,-244,-247,-245,-241,-242,-246,-248,155,-250,-251,-243,-249,-12,155,155,-11,155,155,155,155,-234,-233,155,-231,155,155,-217,155,-230,155,-84,-218,155,155,155,-337,-337,-198,155,155,155,-337,-284,-229,-232,155,-221,155,-83,-219,-68,155,-28,-337,155,-11,155,155,-220,155,155,155,-284,155,155,155,-337,155,-225,-224,-222,-84,155,155,155,-226,-223,155,-228,-227,]),'EXTERN':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[13,13,-113,-128,13,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,13,-120,-115,-65,-102,13,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,13,13,-119,13,-114,-130,13,-118,-71,-103,13,-131,-96,-98,13,-131,-95,-101,-97,-53,13,13,-88,13,-147,-335,-146,-167,-166,-100,-126,13,-87,-61,-72,13,-73,13,-89,-149,-336,-30,13,-74,-174,-175,13,-76,-79,-82,-75,-77,13,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,13,13,13,-234,-233,13,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,13,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'CASE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,297,-336,-76,-79,-82,-75,-77,297,-81,-215,-214,-80,-216,297,-78,-69,-234,-233,-231,297,-217,-230,297,-84,-218,297,-229,-232,-221,297,-83,-219,-68,297,-220,297,297,-225,-224,-222,-84,297,297,-226,-223,297,-228,-227,]),'LAND':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,255,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,255,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'REGISTER':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[62,62,-113,-128,62,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,62,-120,-115,-65,-102,62,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,62,62,-119,62,-114,-130,62,-118,-71,-103,62,-131,-96,-98,62,-131,-95,-101,-97,-53,62,62,-88,62,-147,-335,-146,-167,-166,-100,-126,62,-87,-61,-72,62,-73,62,-89,-149,-336,-30,62,-74,-174,-175,62,-76,-79,-82,-75,-77,62,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,62,62,62,-234,-233,62,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,62,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'MODEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,359,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'NE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,247,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,247,-262,-260,-264,-268,-263,-259,-266,247,-257,-256,-265,247,-267,247,247,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SWITCH':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,299,-336,-76,-79,-82,-75,-77,299,-81,-215,-214,-80,-216,299,-78,-69,-234,-233,-231,299,-217,-230,299,-84,-218,299,-229,-232,-221,299,-83,-219,-68,299,-220,299,299,-225,-224,-222,-84,299,299,-226,-223,299,-228,-227,]),'INT_CONST_HEX':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,160,-335,-28,-182,-27,160,-337,-87,-72,-337,160,-286,-285,160,160,-283,-287,-288,160,-284,160,160,160,-336,-183,160,160,-28,-337,160,-28,-337,-337,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,-337,-76,-79,-82,-75,160,-77,160,160,-81,-215,-214,-80,-216,160,-78,160,160,-69,-284,160,160,-284,160,160,-244,-247,-245,-241,-242,-246,-248,160,-250,-251,-243,-249,-12,160,160,-11,160,160,160,160,-234,-233,160,-231,160,160,-217,160,-230,160,-84,-218,160,160,160,-337,-337,-198,160,160,160,-337,-284,-229,-232,160,-221,160,-83,-219,-68,160,-28,-337,160,-11,160,160,-220,160,160,160,-284,160,160,160,-337,160,-225,-224,-222,-84,160,160,160,-226,-223,160,-228,-227,]),'_COMPLEX':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[60,-337,-113,-128,60,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,60,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,60,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,60,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,60,-131,-95,-101,-97,60,-53,-126,60,-88,60,60,-93,60,-147,-335,-146,60,-167,-166,-182,-100,-126,60,-87,-90,-94,-92,-61,-72,60,-144,-142,60,60,60,-73,60,-89,60,60,60,-149,-159,-160,-156,-336,60,-183,-30,60,60,-74,60,60,60,60,-174,-175,60,-143,-140,60,-141,-145,-76,-79,-82,-75,-77,60,-81,-215,-214,-80,-216,-78,-127,60,-153,60,-151,-148,-157,-168,-69,-36,-35,60,60,60,-234,-233,60,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,60,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PPPRAGMASTR':([61,],[124,]),'PLUSEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,362,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'U32CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,138,-335,-28,-182,-27,138,-337,-87,-72,-337,138,-286,-285,138,138,-283,-287,-288,138,-284,138,138,138,-336,-183,138,138,-28,-337,138,-28,-337,-337,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-337,-76,-79,-82,-75,138,-77,138,138,-81,-215,-214,-80,-216,138,-78,138,138,-69,-284,138,138,-284,138,138,-244,-247,-245,-241,-242,-246,-248,138,-250,-251,-243,-249,-12,138,138,-11,138,138,138,138,-234,-233,138,-231,138,138,-217,138,-230,138,-84,-218,138,138,138,-337,-337,-198,138,138,138,-337,-284,-229,-232,138,-221,138,-83,-219,-68,138,-28,-337,138,-11,138,138,-220,138,138,138,-284,138,138,138,-337,138,-225,-224,-222,-84,138,138,138,-226,-223,138,-228,-227,]),'CONDOP':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,258,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'U8STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,163,-335,-28,-182,-27,163,-337,-87,-72,-337,163,-286,-285,-330,163,-327,163,-283,-287,236,-328,-288,-329,163,-284,163,163,163,-336,-183,163,163,-28,-337,163,-28,-337,-337,163,163,163,-334,-332,-331,-333,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,-337,-76,-79,-82,-75,163,-77,163,163,-81,-215,-214,-80,-216,163,-78,163,163,-69,-284,163,163,-284,163,163,-244,-247,-245,-241,-242,-246,-248,163,-250,-251,-243,-249,-12,163,163,-11,163,163,163,163,-234,-233,163,-231,163,163,-217,163,-230,163,-84,-218,163,163,163,-337,-337,-198,163,163,163,-337,-284,-229,-232,163,-221,163,-83,-219,-68,163,-28,-337,163,-11,163,163,-220,163,163,163,-284,163,163,163,-337,163,-225,-224,-222,-84,163,163,163,-226,-223,163,-228,-227,]),'BREAK':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,304,-336,-76,-79,-82,-75,-77,304,-81,-215,-214,-80,-216,304,-78,-69,-234,-233,-231,304,-217,-230,304,-84,-218,304,-229,-232,-221,304,-83,-219,-68,304,-220,304,304,-225,-224,-222,-84,304,304,-226,-223,304,-228,-227,]),'VOLATILE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[58,58,-113,-128,58,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,58,-120,-115,-65,-102,58,-131,-108,-238,-111,58,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,58,58,-119,58,-114,-130,58,-118,-71,-103,58,-131,-96,-98,58,-131,-95,-101,-97,58,-53,58,58,-88,58,58,-147,-335,-146,58,-167,-166,58,-182,-100,-126,58,58,-87,-61,-72,58,58,-144,-142,58,58,58,-73,58,-89,58,58,58,-149,-159,-160,-156,-336,58,-183,-30,58,58,58,58,58,-74,58,58,58,58,-174,-175,58,-143,-140,58,-141,-145,58,-76,-79,-82,-75,-77,58,-81,-215,-214,-80,-216,-78,-127,58,-153,58,-151,-148,-157,-168,-69,-36,-35,58,58,58,-234,-233,58,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,58,58,-229,-232,-221,-83,-219,-68,-33,-32,58,58,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PPPRAGMA':([0,14,16,17,19,25,38,45,47,59,61,97,99,119,123,124,180,181,184,185,186,188,189,190,191,223,284,285,286,289,291,298,300,301,302,303,305,307,308,313,315,318,332,424,425,428,429,432,435,437,438,439,440,446,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[61,-64,-60,-67,-66,-65,-63,-62,-70,61,-71,-335,61,-87,-61,-72,-73,61,61,61,61,-159,-160,-156,-336,-74,-76,-79,-82,-75,-77,61,-81,-215,-214,-80,-216,61,-78,61,61,-157,-69,-234,-233,-231,61,-217,-230,61,-84,-218,61,-158,-229,-232,-221,61,-83,-219,-68,61,-220,61,61,-225,-224,-222,-84,61,61,-226,-223,61,-228,-227,]),'INLINE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[30,30,-113,-128,30,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,30,-120,-115,-65,-102,30,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,30,30,-119,30,-114,-130,30,-118,-71,-103,30,-131,-96,-98,30,-131,-95,-101,-97,-53,30,30,-88,30,-147,-335,-146,-167,-166,-100,-126,30,-87,-61,-72,30,-73,30,-89,-149,-336,-30,30,-74,-174,-175,30,-76,-79,-82,-75,-77,30,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,30,30,30,-234,-233,30,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,30,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'INT_CONST_BIN':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,164,-335,-28,-182,-27,164,-337,-87,-72,-337,164,-286,-285,164,164,-283,-287,-288,164,-284,164,164,164,-336,-183,164,164,-28,-337,164,-28,-337,-337,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,-337,-76,-79,-82,-75,164,-77,164,164,-81,-215,-214,-80,-216,164,-78,164,164,-69,-284,164,164,-284,164,164,-244,-247,-245,-241,-242,-246,-248,164,-250,-251,-243,-249,-12,164,164,-11,164,164,164,164,-234,-233,164,-231,164,164,-217,164,-230,164,-84,-218,164,164,164,-337,-337,-198,164,164,164,-337,-284,-229,-232,164,-221,164,-83,-219,-68,164,-28,-337,164,-11,164,164,-220,164,164,164,-284,164,164,164,-337,164,-225,-224,-222,-84,164,164,164,-226,-223,164,-228,-227,]),'DO':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,307,-336,-76,-79,-82,-75,-77,307,-81,-215,-214,-80,-216,307,-78,-69,-234,-233,-231,307,-217,-230,307,-84,-218,307,-229,-232,-221,307,-83,-219,-68,307,-220,307,307,-225,-224,-222,-84,307,307,-226,-223,307,-228,-227,]),'LNOT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,165,-335,-28,-182,-27,165,-337,-87,-72,-337,165,-286,-285,165,165,-283,-287,-288,165,-284,165,165,165,-336,-183,165,165,-28,-337,165,-28,-337,-337,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,-337,-76,-79,-82,-75,165,-77,165,165,-81,-215,-214,-80,-216,165,-78,165,165,-69,-284,165,165,-284,165,165,-244,-247,-245,-241,-242,-246,-248,165,-250,-251,-243,-249,-12,165,165,-11,165,165,165,165,-234,-233,165,-231,165,165,-217,165,-230,165,-84,-218,165,165,165,-337,-337,-198,165,165,165,-337,-284,-229,-232,165,-221,165,-83,-219,-68,165,-28,-337,165,-11,165,165,-220,165,165,165,-284,165,165,165,-337,165,-225,-224,-222,-84,165,165,165,-226,-223,165,-228,-227,]),'CONST':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[3,3,-113,-128,3,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,3,-120,-115,-65,-102,3,-131,-108,-238,-111,3,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,3,3,-119,3,-114,-130,3,-118,-71,-103,3,-131,-96,-98,3,-131,-95,-101,-97,3,-53,3,3,-88,3,3,-147,-335,-146,3,-167,-166,3,-182,-100,-126,3,3,-87,-61,-72,3,3,-144,-142,3,3,3,-73,3,-89,3,3,3,-149,-159,-160,-156,-336,3,-183,-30,3,3,3,3,3,-74,3,3,3,3,-174,-175,3,-143,-140,3,-141,-145,3,-76,-79,-82,-75,-77,3,-81,-215,-214,-80,-216,-78,-127,3,-153,3,-151,-148,-157,-168,-69,-36,-35,3,3,3,-234,-233,3,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,3,3,-229,-232,-221,-83,-219,-68,-33,-32,3,3,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LSHIFT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,244,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,244,-262,-260,244,244,244,-259,244,244,-257,-256,244,244,244,244,244,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'LOR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,243,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,167,-335,-28,-182,-27,167,-337,-87,-72,-337,167,-286,-285,167,167,-283,-287,-288,167,-284,167,167,167,-336,-183,167,167,-28,-337,167,-28,-337,-337,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,-337,-76,-79,-82,-75,167,-77,167,167,-81,-215,-214,-80,-216,167,-78,167,167,-69,-284,167,167,-284,167,167,-244,-247,-245,-241,-242,-246,-248,167,-250,-251,-243,-249,-12,167,167,-11,167,167,167,167,-234,-233,167,-231,167,167,-217,167,-230,167,-84,-218,167,167,167,-337,-337,-198,167,167,167,-337,-284,-229,-232,167,-221,167,-83,-219,-68,167,-28,-337,167,-11,167,167,-220,167,167,167,-284,167,167,167,-337,167,-225,-224,-222,-84,167,167,167,-226,-223,167,-228,-227,]),'U16STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,166,-335,-28,-182,-27,166,-337,-87,-72,-337,166,-286,-285,-330,166,-327,166,-283,-287,238,-328,-288,-329,166,-284,166,166,166,-336,-183,166,166,-28,-337,166,-28,-337,-337,166,166,166,-334,-332,-331,-333,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,-337,-76,-79,-82,-75,166,-77,166,166,-81,-215,-214,-80,-216,166,-78,166,166,-69,-284,166,166,-284,166,166,-244,-247,-245,-241,-242,-246,-248,166,-250,-251,-243,-249,-12,166,166,-11,166,166,166,166,-234,-233,166,-231,166,166,-217,166,-230,166,-84,-218,166,166,166,-337,-337,-198,166,166,166,-337,-284,-229,-232,166,-221,166,-83,-219,-68,166,-28,-337,166,-11,166,166,-220,166,166,166,-284,166,166,166,-337,166,-225,-224,-222,-84,166,166,166,-226,-223,166,-228,-227,]),'RBRACE':([61,97,99,119,124,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,181,184,185,186,188,189,190,191,195,196,197,224,225,227,228,230,232,234,235,236,237,238,261,263,268,273,284,285,286,289,291,298,300,301,302,303,305,306,308,309,313,315,318,325,326,327,332,370,374,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,424,425,428,432,435,437,438,439,446,450,451,468,469,472,473,476,478,480,482,483,487,496,497,500,505,506,510,523,524,528,536,546,547,550,551,554,555,557,558,565,575,576,578,579,],[-71,-335,191,-87,-72,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-337,191,191,191,-159,-160,-156,-336,-171,191,-176,-274,-239,-337,-193,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-76,-79,-82,-75,-77,-6,-81,-215,-214,-80,-216,-5,-78,191,191,191,-157,191,191,-172,-69,191,-22,-21,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-234,-233,-231,-217,-230,-81,-84,-218,-158,-173,-177,-240,-194,191,-196,-237,-281,-282,-290,-291,-275,-229,-232,-221,-83,-219,-68,-195,-254,191,-220,-197,-306,191,-299,-225,-224,-222,-84,-300,-226,-223,-228,-227,]),'_BOOL':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[34,-337,-113,-128,34,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,34,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,34,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,34,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,34,-131,-95,-101,-97,34,-53,-126,34,-88,34,34,-93,34,-147,-335,-146,34,-167,-166,-182,-100,-126,34,-87,-90,-94,-92,-61,-72,34,-144,-142,34,34,34,-73,34,-89,34,34,34,-149,-159,-160,-156,-336,34,-183,-30,34,34,-74,34,34,34,34,-174,-175,34,-143,-140,34,-141,-145,-76,-79,-82,-75,-77,34,-81,-215,-214,-80,-216,-78,-127,34,-153,34,-151,-148,-157,-168,-69,-36,-35,34,34,34,-234,-233,34,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,34,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,246,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,246,-262,-260,-264,246,-263,-259,-266,246,-257,-256,-265,246,246,246,246,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SEMI':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,86,87,89,91,94,96,97,98,99,100,101,108,109,110,111,113,114,115,119,120,121,122,123,124,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,179,180,181,184,185,186,187,188,189,190,191,192,200,216,217,223,224,225,226,228,230,232,234,235,236,237,238,240,241,261,263,268,269,272,273,275,279,280,284,285,286,288,289,290,291,293,294,298,300,301,302,303,304,305,306,307,308,310,312,313,314,315,316,317,318,320,321,322,323,324,328,330,331,332,340,341,355,356,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,423,424,425,426,427,428,429,432,433,435,437,438,439,440,442,443,444,446,448,449,453,454,464,465,468,469,476,478,480,482,483,486,487,496,497,498,499,500,502,505,506,508,509,510,511,512,518,519,523,524,533,534,535,536,537,539,547,551,552,554,555,557,558,565,568,569,574,575,576,577,578,579,],[19,-337,-113,-128,-337,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,-337,-29,-121,-116,-62,-112,-70,-52,-123,-117,119,-337,-337,-119,-337,-114,-130,19,-118,-71,-103,-337,-9,-131,-91,-10,-96,-20,-98,-54,-179,-178,-131,-37,-134,-85,-95,-101,-97,-19,-132,-53,-126,-337,-337,-93,-147,-335,-146,188,-167,-166,-136,-100,-138,-126,-16,-86,-15,-87,-90,-94,-92,-61,-72,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-178,-73,-337,188,188,188,-149,-159,-160,-156,-336,-337,-30,-38,-133,-74,-274,-239,-135,-193,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,-235,-278,-140,-141,-145,-76,-79,-82,424,-75,425,-77,428,-14,-337,-81,-215,-214,-80,435,-216,-13,-337,-78,-312,-127,188,-153,188,-151,-148,-157,-26,-25,446,-161,-163,-168,-139,-137,-69,-36,-35,-44,-43,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,496,-234,-233,497,-337,-231,-337,-217,-13,-230,-81,-84,-218,-337,-152,-150,-165,-158,-170,-169,-31,-34,-39,-42,-240,-194,-237,-281,-282,-290,-291,-236,-275,-229,-232,533,-337,-221,-337,-83,-219,-162,-164,-68,-33,-32,-41,-40,-195,-254,-337,553,-337,-220,-337,-337,-306,-299,566,-225,-224,-222,-84,-300,575,-337,-337,-226,-223,-337,-228,-227,]),'_THREAD_LOCAL':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[11,11,-113,-128,11,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,11,-120,-115,-65,-102,11,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,11,11,-119,11,-114,-130,11,-118,-71,-103,11,-131,-96,-98,11,-131,-95,-101,-97,-53,11,11,-88,11,-147,-335,-146,-167,-166,-100,-126,11,-87,-61,-72,11,-73,11,-89,-149,-336,-30,11,-74,-174,-175,11,-76,-79,-82,-75,-77,11,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,11,11,11,-234,-233,11,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,11,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,248,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,248,-262,-260,-264,248,-263,-259,-266,248,-257,-256,-265,248,248,248,248,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'COMMA':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,70,71,73,74,75,76,77,78,80,81,82,84,86,96,98,100,101,103,104,105,106,108,109,110,111,113,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,177,178,179,187,191,195,196,197,198,199,200,203,210,211,212,213,215,216,217,224,225,226,228,230,232,234,235,236,237,238,240,241,261,263,268,269,270,272,273,274,275,276,277,279,280,281,283,294,310,312,314,316,317,320,323,324,325,326,327,328,330,331,340,341,343,344,345,346,347,348,355,356,374,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,414,426,442,443,444,448,449,450,451,453,454,458,461,463,464,465,468,469,473,476,478,480,482,483,486,487,489,490,492,501,503,507,508,509,511,512,518,519,523,524,525,528,529,530,531,532,544,545,546,547,551,556,559,560,564,565,570,571,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-103,-96,126,-98,-54,-179,-178,-131,-37,-134,-95,-101,-97,-132,-53,-147,-146,-167,-166,-28,-180,-182,-27,-136,-100,-138,-126,202,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-337,-252,-178,-149,-336,-171,327,-176,-183,-181,-30,333,-186,-337,349,350,-191,-38,-133,-274,-239,-135,-193,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,412,-235,-278,-203,-140,-204,-1,-141,-145,-2,-206,412,-312,-127,-153,-151,-148,445,-161,-163,327,327,-172,-168,-139,-137,-36,-35,-190,-204,-56,-188,-45,-189,-44,-43,472,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,412,-270,-258,-296,-295,-294,-293,412,-292,-310,484,485,-305,-205,412,-152,-150,-165,-170,-169,-173,-177,-31,-34,-57,-192,-187,-39,-42,-240,-194,-196,-237,-281,-282,-290,-291,-236,-275,-213,-207,-211,412,412,412,-162,-164,-33,-32,-41,-40,-195,-254,-311,550,-209,-208,-210,-212,-51,-50,-197,-306,-299,412,-46,-49,412,-300,-48,-47,]),'U16CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,169,-335,-28,-182,-27,169,-337,-87,-72,-337,169,-286,-285,169,169,-283,-287,-288,169,-284,169,169,169,-336,-183,169,169,-28,-337,169,-28,-337,-337,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,-337,-76,-79,-82,-75,169,-77,169,169,-81,-215,-214,-80,-216,169,-78,169,169,-69,-284,169,169,-284,169,169,-244,-247,-245,-241,-242,-246,-248,169,-250,-251,-243,-249,-12,169,169,-11,169,169,169,169,-234,-233,169,-231,169,169,-217,169,-230,169,-84,-218,169,169,169,-337,-337,-198,169,169,169,-337,-284,-229,-232,169,-221,169,-83,-219,-68,169,-28,-337,169,-11,169,169,-220,169,169,169,-284,169,169,169,-337,169,-225,-224,-222,-84,169,169,169,-226,-223,169,-228,-227,]),'OFFSETOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,170,-335,-28,-182,-27,170,-337,-87,-72,-337,170,-286,-285,170,170,-283,-287,-288,170,-284,170,170,170,-336,-183,170,170,-28,-337,170,-28,-337,-337,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,-337,-76,-79,-82,-75,170,-77,170,170,-81,-215,-214,-80,-216,170,-78,170,170,-69,-284,170,170,-284,170,170,-244,-247,-245,-241,-242,-246,-248,170,-250,-251,-243,-249,-12,170,170,-11,170,170,170,170,-234,-233,170,-231,170,170,-217,170,-230,170,-84,-218,170,170,170,-337,-337,-198,170,170,170,-337,-284,-229,-232,170,-221,170,-83,-219,-68,170,-28,-337,170,-11,170,170,-220,170,170,170,-284,170,170,170,-337,170,-225,-224,-222,-84,170,170,170,-226,-223,170,-228,-227,]),'_ATOMIC':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,103,105,109,111,117,118,119,120,121,122,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,214,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[29,65,-113,-128,76,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,65,-120,-115,-65,-102,65,-131,-108,-238,-111,76,-122,-63,-129,112,-29,-121,-116,-62,-112,-70,-52,-123,-117,65,65,-119,65,-114,-130,29,-118,-71,-103,65,-9,-131,-91,-10,-96,-98,65,-131,-95,-101,-97,29,-53,65,76,-88,112,65,-93,29,-147,-335,-146,29,-167,-166,76,-182,-100,-126,76,29,-87,-90,-94,-92,-61,-72,76,29,-144,-142,65,29,76,-73,65,-89,29,29,29,-149,-159,-160,-156,-336,76,-183,-30,76,76,76,112,76,76,-74,29,29,29,29,-174,-175,29,-143,-140,29,-141,-145,76,-76,-79,-82,-75,-77,65,-81,-215,-214,-80,-216,-78,-127,29,-153,29,-151,-148,-157,-168,-69,-36,-35,29,29,29,-234,-233,65,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,76,29,-229,-232,-221,-83,-219,-68,-33,-32,76,76,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'TYPEDEF':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[7,7,-113,-128,7,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,7,-120,-115,-65,-102,7,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,7,7,-119,7,-114,-130,7,-118,-71,-103,7,-131,-96,-98,7,-131,-95,-101,-97,-53,7,7,-88,7,-147,-335,-146,-167,-166,-100,-126,7,-87,-61,-72,7,-73,7,-89,-149,-336,-30,7,-74,-174,-175,7,-76,-79,-82,-75,-77,7,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,7,7,7,-234,-233,7,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,7,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'XOR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,251,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,251,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,251,-267,-269,251,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'AUTO':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[26,26,-113,-128,26,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,26,-120,-115,-65,-102,26,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,26,26,-119,26,-114,-130,26,-118,-71,-103,26,-131,-96,-98,26,-131,-95,-101,-97,-53,26,26,-88,26,-147,-335,-146,-167,-166,-100,-126,26,-87,-61,-72,26,-73,26,-89,-149,-336,-30,26,-74,-174,-175,26,-76,-79,-82,-75,-77,26,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,26,26,26,-234,-233,26,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,26,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'DIVEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,357,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'TIMES':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,22,23,25,26,27,29,30,33,34,35,36,37,38,39,40,43,44,45,46,47,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,76,80,81,82,85,87,89,91,94,96,97,98,100,101,103,104,105,106,109,111,116,117,119,120,121,122,123,124,126,128,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,177,180,181,187,191,192,198,201,202,204,205,206,211,218,219,220,223,224,227,229,230,231,232,233,234,235,236,237,238,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,269,273,275,278,279,280,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,312,314,316,317,319,328,329,332,336,338,339,342,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[35,-337,-113,-128,35,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,-131,-108,-238,-111,-337,-122,35,-63,-129,35,-121,-116,-62,-112,-70,-123,-117,-337,-337,-119,-337,-114,-130,35,-118,-71,-103,-337,-9,-131,-91,-10,-96,35,-98,-131,-95,-101,-97,173,-126,35,35,-93,-147,-335,-146,-167,-166,-28,35,-182,-27,-100,-126,173,-337,-87,-90,-94,-92,-61,-72,35,-337,173,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-144,-301,-274,-314,173,-142,-327,173,-283,-287,-325,-304,-322,-302,-255,-315,-289,253,-328,-316,-288,-329,-320,-276,-323,173,-284,173,173,-312,35,-73,173,-149,-336,35,-183,173,35,336,-28,-337,35,352,-28,-337,-74,-274,-337,173,-326,173,-280,173,-277,-334,-332,-331,-333,-174,-175,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,-298,-297,173,173,-279,-143,-278,-140,35,-141,-145,420,-76,-79,-82,-75,173,-77,173,173,-81,-215,-214,-80,-216,173,-78,-312,-127,-153,-151,-148,173,-168,173,-69,-284,173,173,35,-284,173,173,-244,-247,-245,-241,-242,-246,-248,173,-250,-251,-243,-249,-12,173,173,-11,253,253,253,253,253,253,253,253,253,253,-257,-256,253,253,253,253,253,-258,-296,-295,-294,-293,-292,-305,173,173,173,494,-234,-233,173,-231,173,173,-217,173,-230,173,-84,-218,173,173,-152,-150,35,173,-170,-169,-337,-337,-198,173,-281,-282,173,-290,-291,173,-275,-337,-284,-229,-232,173,-221,173,-83,-219,-68,541,-28,-337,173,-11,173,173,-220,173,173,173,-284,173,173,-306,173,-337,-299,173,-225,-224,-222,-84,-300,173,173,173,-226,-223,173,-228,-227,]),'LPAREN':([0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,22,23,25,26,27,29,30,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,73,76,77,80,81,82,85,86,87,89,91,94,96,97,98,100,101,103,104,105,106,109,111,112,116,117,119,120,121,122,123,124,126,127,128,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,160,161,163,164,165,166,167,168,169,170,171,173,174,175,176,177,180,181,187,191,192,198,199,200,201,202,204,205,206,211,216,218,219,220,223,227,229,230,231,233,235,236,237,238,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,269,275,276,278,279,280,282,283,284,285,286,289,290,291,292,296,297,298,299,300,301,302,303,305,307,308,310,311,312,314,316,317,319,328,329,332,336,338,339,340,341,342,344,345,347,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,414,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,453,454,457,458,459,464,465,472,475,477,481,482,483,484,488,489,490,492,494,496,497,499,500,502,504,505,506,510,511,512,513,514,515,518,519,521,522,529,530,531,532,533,535,536,537,538,539,541,542,543,544,545,547,549,550,551,553,554,555,557,558,559,560,565,566,569,570,571,574,575,576,577,578,579,],[37,-337,-113,-128,69,-124,-110,-106,85,-104,-107,-125,-105,-64,37,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,95,-108,-238,-111,-337,-122,37,-63,-129,37,116,-29,-121,-116,-62,-112,-70,118,-123,-117,-337,-337,-119,-337,-114,-130,37,-118,-71,-103,-337,-9,95,-91,-10,-96,69,-98,69,129,-131,-37,-95,-101,-97,174,118,-126,69,37,-93,-147,-335,-146,-167,-166,-28,-180,-182,-27,-100,-126,95,174,-337,-87,-90,-94,-92,-61,-72,69,129,-337,229,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-144,-301,-314,231,-142,-327,233,-283,-287,-325,-304,-322,239,-302,-315,-289,-328,-316,-288,-329,-320,266,-323,267,174,-284,229,233,-312,278,-73,229,-149,-336,69,-183,-181,-30,229,69,229,-28,-337,342,-38,229,-28,-337,-74,-337,229,-326,229,229,-334,-332,-331,-333,-174,-175,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,229,174,174,-298,-297,229,229,-143,-140,278,278,-141,-145,-337,422,-76,-79,-82,-75,229,-77,427,430,174,229,434,-81,-215,-214,-80,-216,229,-78,-312,441,-127,-153,-151,-148,174,-168,174,-69,-284,229,229,-36,-35,342,342,460,-45,-284,229,229,-44,-43,-244,-247,-245,-241,-242,-246,-248,229,-250,-251,-243,-249,-12,174,229,-11,-296,-295,-294,-293,-292,-305,229,174,422,229,229,-234,-233,229,-231,229,229,-217,229,-230,229,-84,-218,229,229,-152,-150,69,174,-170,-169,-31,-34,342,460,-337,-39,-42,-337,-198,174,174,-290,-291,229,-337,-213,-207,-211,-284,-229,-232,229,-221,229,538,-83,-219,-68,-33,-32,229,-28,-337,-41,-40,229,-11,-209,-208,-210,-212,229,229,-220,229,229,229,-284,229,229,-51,-50,-306,229,-337,-299,229,-225,-224,-222,-84,-46,-49,-300,229,229,-48,-47,229,-226,-223,229,-228,-227,]),'MINUSMINUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,145,146,148,149,150,151,152,153,154,156,160,161,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,482,483,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,175,-335,-28,-182,-27,175,-337,-87,-72,-337,175,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-314,175,-327,175,-283,-287,-325,-304,-322,-302,-315,-289,-328,-316,-288,-329,-320,261,-323,175,-284,175,175,-312,175,-336,-183,175,175,-28,-337,175,-28,-337,-337,175,-326,175,175,-334,-332,-331,-333,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,-298,-297,175,175,-337,-76,-79,-82,-75,175,-77,175,175,-81,-215,-214,-80,-216,175,-78,-312,175,175,-69,-284,175,175,-284,175,175,-244,-247,-245,-241,-242,-246,-248,175,-250,-251,-243,-249,-12,175,175,-11,-296,-295,-294,-293,-292,-305,175,175,175,175,-234,-233,175,-231,175,175,-217,175,-230,175,-84,-218,175,175,175,-337,-337,-198,175,175,-290,-291,175,-337,-284,-229,-232,175,-221,175,-83,-219,-68,175,-28,-337,175,-11,175,175,-220,175,175,175,-284,175,175,-306,175,-337,-299,175,-225,-224,-222,-84,-300,175,175,175,-226,-223,175,-228,-227,]),'ID':([0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,43,44,45,46,47,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,76,80,81,82,85,87,89,91,94,96,97,98,100,101,102,103,104,105,106,109,111,116,117,118,119,120,121,122,123,124,126,128,129,131,135,137,142,146,147,149,150,151,165,171,173,174,175,180,181,187,191,192,193,194,198,199,201,202,204,205,206,211,218,219,220,223,227,229,231,233,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,262,264,265,266,269,275,279,280,282,284,285,286,287,289,290,291,297,298,300,301,302,303,305,307,308,312,314,316,317,319,327,328,329,332,336,338,339,342,344,349,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,372,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,457,459,460,472,475,477,481,484,485,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,548,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[42,-337,-113,-128,42,-124,-110,-106,-104,-107,-125,-105,-64,42,-60,-67,-99,-66,-109,-120,-115,-154,-65,-102,-126,-155,-131,-108,98,101,-238,-111,-337,-122,42,-63,-129,42,-121,-116,-62,-112,-70,-123,-117,-337,-337,-119,-337,-114,-130,42,-118,-71,-103,-337,-9,-131,-91,-10,-96,42,-98,42,-131,-95,-101,-97,176,-126,42,42,-93,-147,-335,-146,-167,-166,197,-28,-180,-182,-27,-100,-126,176,-337,176,-87,-90,-94,-92,-61,-72,42,-337,176,176,-286,-285,-144,176,-142,176,-283,-287,-288,176,-284,176,176,-73,310,-149,-336,42,197,197,-183,-181,176,42,176,-28,-337,42,176,-28,-337,-74,-337,176,176,176,-174,-175,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,403,405,176,176,-143,-140,-141,-145,-337,-76,-79,-82,423,-75,176,-77,176,310,-81,-215,-214,-80,-216,310,-78,-127,-153,-151,-148,176,197,-168,176,-69,-284,176,176,42,42,176,-284,176,176,-244,-247,-245,-241,-242,-246,-248,176,-250,-251,-243,-249,-12,176,176,176,-11,176,176,176,176,-234,-233,176,-231,310,176,-217,176,-230,310,-84,-218,310,176,-152,-150,42,176,-170,-169,42,-337,176,-337,-198,176,176,176,176,-337,-284,-229,-232,176,-221,310,-83,-219,-68,176,-28,-337,176,-11,176,310,-220,310,176,310,-284,176,176,176,176,-337,176,-225,-224,-222,-84,176,310,310,-226,-223,310,-228,-227,]),'IF':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,311,-336,-76,-79,-82,-75,-77,311,-81,-215,-214,-80,-216,311,-78,-69,-234,-233,-231,311,-217,-230,311,-84,-218,311,-229,-232,-221,311,-83,-219,-68,311,-220,311,311,-225,-224,-222,-84,311,311,-226,-223,311,-228,-227,]),'STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,136,137,146,149,150,151,152,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,333,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,452,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,152,-335,-28,-182,-27,152,-337,-87,-72,-337,152,-286,230,-285,152,152,-283,-287,-325,-288,152,-284,152,152,152,-336,-183,152,152,-28,-337,152,-28,-337,-337,152,-326,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-337,-76,-79,-82,-75,152,-77,152,152,-81,-215,-214,-80,-216,152,-78,152,152,-69,152,-284,152,152,-284,152,152,-244,-247,-245,-241,-242,-246,-248,152,-250,-251,-243,-249,-12,152,152,-11,152,152,152,152,-234,-233,152,-231,152,152,-217,152,-230,152,-84,-218,152,152,152,230,-337,-337,-198,152,152,152,-337,-284,-229,-232,152,-221,152,-83,-219,-68,152,-28,-337,152,-11,152,152,-220,152,152,152,-284,152,152,152,-337,152,-225,-224,-222,-84,152,152,152,-226,-223,152,-228,-227,]),'FLOAT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[44,-337,-113,-128,44,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,44,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,44,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,44,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,44,-131,-95,-101,-97,44,-53,-126,44,-88,44,44,-93,44,-147,-335,-146,44,-167,-166,-182,-100,-126,44,-87,-90,-94,-92,-61,-72,44,-144,-142,44,44,44,-73,44,-89,44,44,44,-149,-159,-160,-156,-336,44,-183,-30,44,44,-74,44,44,44,44,-174,-175,44,-143,-140,44,-141,-145,-76,-79,-82,-75,-77,44,-81,-215,-214,-80,-216,-78,-127,44,-153,44,-151,-148,-157,-168,-69,-36,-35,44,44,44,-234,-233,44,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,44,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'XOREQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,361,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'LSHIFTEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,363,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'RBRACKET':([3,39,58,76,103,105,106,117,128,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,191,198,204,205,218,219,224,225,230,232,234,235,236,237,238,261,263,268,272,273,282,334,335,336,337,351,352,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,406,407,411,419,420,421,455,456,459,466,467,468,471,476,478,480,482,483,486,487,491,493,494,513,514,524,540,541,547,551,561,562,564,565,],[-128,-129,-130,-131,-28,-182,-27,-337,-337,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-336,-183,-337,-28,-337,-28,-274,-239,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-235,-278,-337,453,-4,454,-3,464,465,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,482,-292,-305,-337,492,-337,511,512,-337,518,519,-240,520,-237,-281,-282,-290,-291,-236,-275,529,530,531,-337,-28,-254,559,560,-306,-299,570,571,572,-300,]),} + +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items + +_lr_goto_items = {'expression_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[284,284,284,284,284,284,284,284,284,284,284,284,284,]),'struct_or_union_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'init_declarator_list':([4,89,],[70,70,]),'init_declarator_list_opt':([4,89,],[79,79,]),'iteration_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[285,285,285,285,285,285,285,285,285,285,285,285,285,]),'static_assert':([0,59,181,298,307,429,437,440,502,535,537,539,569,574,577,],[17,17,286,286,286,286,286,286,286,286,286,286,286,286,286,]),'unified_string_literal':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,333,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,452,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,]),'assignment_expression_opt':([204,218,419,421,513,],[334,351,491,493,540,]),'brace_open':([31,32,92,96,98,100,101,130,131,181,201,229,298,307,375,413,429,437,440,477,478,479,502,521,535,537,539,569,574,577,],[99,102,181,184,185,193,194,181,227,181,227,181,181,181,227,488,181,181,181,488,488,488,181,227,181,181,181,181,181,181,]),'enumerator':([102,193,194,327,],[195,195,195,450,]),'typeid_noparen_declarator':([211,],[348,]),'type_qualifier_list_opt':([35,117,128,206,220,282,459,515,],[104,204,218,339,354,419,513,543,]),'declaration_specifiers_no_type_opt':([1,27,52,53,55,63,87,],[66,94,120,121,122,94,94,]),'expression_opt':([181,298,307,427,429,437,440,499,502,533,535,537,539,553,566,569,574,577,],[288,288,288,498,288,288,288,534,288,552,288,288,288,567,573,288,288,288,]),'designation':([227,472,488,550,],[369,369,369,369,]),'parameter_list':([118,129,278,342,422,460,],[213,213,213,213,213,213,]),'alignment_specifier':([0,1,4,21,27,52,53,55,59,63,75,85,87,89,93,95,99,118,129,174,177,181,184,185,186,192,211,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[53,53,81,53,53,53,53,53,53,53,53,142,53,81,53,142,142,53,53,142,280,53,142,142,142,280,81,142,142,142,142,142,53,53,142,142,53,53,53,53,53,]),'labeled_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[289,289,289,289,289,289,289,289,289,289,289,289,289,]),'abstract_declarator':([177,211,278,342,],[281,281,418,418,]),'translation_unit':([0,],[59,]),'init_declarator':([4,89,126,202,],[84,84,217,331,]),'direct_abstract_declarator':([177,211,276,278,342,344,457,],[283,283,414,283,283,414,414,]),'designator_list':([227,472,488,550,],[376,376,376,376,]),'identifier':([85,116,118,129,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,349,353,354,364,372,373,375,412,413,419,421,427,429,430,434,437,440,441,447,460,477,481,484,485,499,502,513,521,533,535,537,538,539,542,543,548,549,553,566,569,574,577,],[143,143,215,215,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,461,143,143,143,470,143,143,143,143,143,143,143,143,143,143,143,143,143,143,215,143,143,143,527,143,143,143,143,143,143,143,143,143,143,143,563,143,143,143,143,143,143,]),'offsetof_member_designator':([485,],[526,]),'unary_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[144,144,224,232,234,144,224,273,224,224,224,224,224,224,224,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,224,144,144,224,224,224,144,224,224,144,144,224,224,224,224,224,144,224,224,144,224,224,224,224,224,224,224,224,224,144,144,144,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,]),'abstract_declarator_opt':([177,211,],[274,343,]),'initializer':([131,201,375,521,],[226,330,473,546,]),'direct_id_declarator':([0,4,15,37,40,59,69,72,89,91,126,192,202,211,342,344,445,457,],[48,48,86,48,48,48,48,86,48,48,48,48,48,48,48,86,48,86,]),'struct_declaration_list':([99,184,185,],[186,313,315,]),'pp_directive':([0,59,],[14,14,]),'declaration_list':([21,75,],[93,93,]),'id_init_declarator':([40,91,],[108,108,]),'type_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[18,18,109,18,18,147,109,18,147,147,18,18,269,147,18,147,147,147,109,147,147,147,147,147,18,18,147,147,18,18,18,18,18,]),'compound_statement':([92,130,181,229,298,307,429,437,440,502,535,537,539,569,574,577,],[180,223,291,378,291,291,291,291,291,291,291,291,291,291,291,291,]),'pointer':([0,4,37,40,59,69,89,91,104,126,177,192,202,211,278,342,445,],[15,72,15,15,15,72,72,15,199,72,276,72,72,344,276,457,72,]),'typeid_declarator':([4,69,89,126,192,202,445,],[74,125,74,74,74,74,74,]),'id_init_declarator_list':([40,91,],[113,113,]),'declarator':([4,89,126,192,202,445,],[78,78,78,324,78,324,]),'argument_expression_list':([266,],[409,]),'struct_declarator_list_opt':([192,],[322,]),'block_item_list':([181,],[298,]),'parameter_type_list_opt':([278,342,422,],[417,417,495,]),'struct_declarator':([192,445,],[323,508,]),'type_qualifier':([0,1,4,21,27,35,52,53,55,59,63,75,85,87,89,93,95,99,103,117,118,128,129,172,174,177,181,184,185,186,192,205,206,211,219,220,229,231,233,239,267,278,282,298,313,315,342,350,422,427,459,460,514,515,],[52,52,80,52,52,105,52,52,52,52,52,52,105,52,80,52,105,105,198,105,52,105,52,198,105,279,52,105,105,105,279,198,105,80,198,105,105,105,105,105,105,52,105,52,105,105,52,52,52,52,105,52,198,105,]),'assignment_operator':([224,],[364,]),'expression':([174,181,229,231,233,258,265,290,298,307,427,429,430,434,437,440,441,499,502,533,535,537,538,539,549,553,566,569,574,577,],[270,294,270,270,270,399,406,426,294,294,294,294,501,503,294,294,507,294,294,294,294,294,556,294,564,294,294,294,294,294,]),'storage_class_specifier':([0,1,4,21,27,52,53,55,59,63,75,87,89,93,118,129,181,211,278,298,342,350,422,427,460,],[1,1,68,1,1,1,1,1,1,1,1,1,68,1,1,1,1,68,1,1,1,1,1,1,1,]),'unified_wstring_literal':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,]),'translation_unit_or_empty':([0,],[9,]),'initializer_list_opt':([227,],[370,]),'brace_close':([99,184,185,186,196,309,313,315,325,326,370,472,528,550,],[187,314,316,317,328,439,442,443,448,449,469,523,551,565,]),'direct_typeid_declarator':([4,69,72,89,126,192,202,445,],[73,73,127,73,73,73,73,73,]),'external_declaration':([0,59,],[16,123,]),'pragmacomp_or_statement':([307,429,440,502,535,537,539,569,574,577,],[436,500,506,536,554,555,557,576,578,579,]),'type_name':([85,95,174,229,231,233,239,267,],[157,183,271,379,380,381,382,410,]),'typedef_name':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,]),'pppragma_directive':([0,59,99,181,184,185,186,298,307,313,315,429,437,440,502,535,537,539,569,574,577,],[25,25,189,300,189,189,189,300,437,189,189,437,300,437,437,437,437,437,437,437,437,]),'statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[301,301,438,438,505,438,438,438,438,558,438,438,438,]),'cast_expression':([85,116,131,171,174,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[158,158,158,268,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,487,158,158,158,158,158,158,158,158,158,158,487,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,]),'atomic_specifier':([0,1,21,27,40,52,53,55,59,63,75,85,87,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[27,63,87,63,111,63,63,63,27,63,87,111,63,111,87,111,111,27,27,111,111,87,111,111,111,111,111,111,111,111,111,27,87,111,111,27,27,27,87,27,]),'struct_declarator_list':([192,],[320,]),'empty':([0,1,4,21,27,35,40,52,53,55,63,75,87,89,91,117,118,128,129,177,181,192,204,206,211,218,220,227,278,282,298,307,342,419,421,422,427,429,437,440,459,460,472,488,499,502,513,515,533,535,537,539,550,553,566,569,574,577,],[57,64,83,88,64,106,115,64,64,64,64,88,64,83,115,106,208,106,208,277,306,321,337,106,277,337,106,377,415,106,433,433,415,337,337,415,433,433,433,433,106,208,522,522,433,433,337,106,433,433,433,433,522,433,433,433,433,433,]),'parameter_declaration':([118,129,278,342,350,422,460,],[210,210,210,210,463,210,210,]),'primary_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,]),'declaration':([0,21,59,75,93,181,298,427,],[38,90,38,90,182,302,302,499,]),'declaration_specifiers_no_type':([0,1,21,27,52,53,55,59,63,75,87,93,118,129,181,278,298,342,350,422,427,460,],[40,67,91,67,67,67,67,40,67,91,67,91,214,214,91,214,91,214,214,214,91,214,]),'jump_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[303,303,303,303,303,303,303,303,303,303,303,303,303,]),'enumerator_list':([102,193,194,],[196,325,326,]),'block_item':([181,298,],[305,432,]),'constant_expression':([85,116,297,319,329,373,447,],[159,203,431,444,451,471,509,]),'identifier_list_opt':([118,129,460,],[207,221,516,]),'constant':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,]),'type_specifier_no_typeid':([0,4,21,40,59,75,85,89,91,93,95,99,118,129,172,174,177,181,184,185,186,192,211,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[12,71,12,12,12,12,12,71,12,12,12,12,12,12,12,12,275,12,12,12,12,275,71,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,]),'struct_declaration':([99,184,185,186,313,315,],[190,190,190,318,318,318,]),'direct_typeid_noparen_declarator':([211,344,],[345,458,]),'id_declarator':([0,4,37,40,59,69,89,91,126,192,202,211,342,445,],[21,75,107,110,21,107,179,110,179,179,179,346,107,179,]),'selection_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[308,308,308,308,308,308,308,308,308,308,308,308,308,]),'postfix_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,]),'initializer_list':([227,488,],[374,528,]),'unary_operator':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,]),'struct_or_union':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,]),'block_item_list_opt':([181,],[309,]),'assignment_expression':([131,174,181,201,204,218,229,231,233,258,265,266,290,298,307,338,339,353,354,364,375,412,419,421,427,429,430,434,437,440,441,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[228,272,272,228,335,335,272,272,272,272,272,408,272,272,272,455,456,466,467,468,228,486,335,335,272,272,272,272,272,272,272,525,272,272,335,228,272,272,272,272,272,561,562,272,272,272,272,272,272,]),'designation_opt':([227,472,488,550,],[375,521,375,521,]),'parameter_type_list':([118,129,278,342,422,460,],[209,222,416,416,416,517,]),'type_qualifier_list':([35,85,95,99,117,128,174,184,185,186,206,220,229,231,233,239,267,282,313,315,459,515,],[103,172,172,172,205,219,172,172,172,172,103,103,172,172,172,172,172,103,172,172,514,103,]),'designator':([227,376,472,488,550,],[371,474,371,371,371,]),'id_init_declarator_list_opt':([40,91,],[114,114,]),'declaration_specifiers':([0,21,59,75,93,118,129,181,278,298,342,350,422,427,460,],[4,89,4,89,89,211,211,89,211,89,211,211,211,89,211,]),'identifier_list':([118,129,460,],[212,212,212,]),'declaration_list_opt':([21,75,],[92,130,]),'function_definition':([0,59,],[45,45,]),'binary_expression':([85,116,131,174,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,419,421,427,429,430,434,437,440,441,447,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[162,162,162,162,162,162,162,162,162,162,162,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,162,400,401,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,]),'enum_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,]),'decl_body':([0,21,59,75,93,181,298,427,],[51,51,51,51,51,51,51,51,]),'function_specifier':([0,1,4,21,27,52,53,55,59,63,75,87,89,93,118,129,181,211,278,298,342,350,422,427,460,],[55,55,82,55,55,55,55,55,55,55,55,55,82,55,55,55,55,82,55,55,55,55,55,55,55,]),'specifier_qualifier_list':([85,95,99,174,184,185,186,229,231,233,239,267,313,315,],[177,177,192,177,192,192,192,177,177,177,177,177,192,192,]),'conditional_expression':([85,116,131,174,181,201,204,218,229,231,233,258,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,419,421,427,429,430,434,437,440,441,447,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[178,178,225,225,225,225,225,225,225,225,225,225,225,225,225,178,225,225,178,178,225,225,225,225,225,178,225,225,225,225,225,225,225,225,225,225,225,178,524,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,]),} + +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +_lr_productions = [ + ("S' -> translation_unit_or_empty","S'",1,None,None,None), + ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','plyparser.py',43), + ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','plyparser.py',44), + ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','plyparser.py',43), + ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','plyparser.py',44), + ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','plyparser.py',43), + ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','plyparser.py',44), + ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','plyparser.py',43), + ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','plyparser.py',44), + ('declaration_specifiers_no_type_opt -> empty','declaration_specifiers_no_type_opt',1,'p_declaration_specifiers_no_type_opt','plyparser.py',43), + ('declaration_specifiers_no_type_opt -> declaration_specifiers_no_type','declaration_specifiers_no_type_opt',1,'p_declaration_specifiers_no_type_opt','plyparser.py',44), + ('designation_opt -> empty','designation_opt',1,'p_designation_opt','plyparser.py',43), + ('designation_opt -> designation','designation_opt',1,'p_designation_opt','plyparser.py',44), + ('expression_opt -> empty','expression_opt',1,'p_expression_opt','plyparser.py',43), + ('expression_opt -> expression','expression_opt',1,'p_expression_opt','plyparser.py',44), + ('id_init_declarator_list_opt -> empty','id_init_declarator_list_opt',1,'p_id_init_declarator_list_opt','plyparser.py',43), + ('id_init_declarator_list_opt -> id_init_declarator_list','id_init_declarator_list_opt',1,'p_id_init_declarator_list_opt','plyparser.py',44), + ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','plyparser.py',43), + ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','plyparser.py',44), + ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','plyparser.py',43), + ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','plyparser.py',44), + ('initializer_list_opt -> empty','initializer_list_opt',1,'p_initializer_list_opt','plyparser.py',43), + ('initializer_list_opt -> initializer_list','initializer_list_opt',1,'p_initializer_list_opt','plyparser.py',44), + ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','plyparser.py',43), + ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','plyparser.py',44), + ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','plyparser.py',43), + ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','plyparser.py',44), + ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','plyparser.py',43), + ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','plyparser.py',44), + ('direct_id_declarator -> ID','direct_id_declarator',1,'p_direct_id_declarator_1','plyparser.py',126), + ('direct_id_declarator -> LPAREN id_declarator RPAREN','direct_id_declarator',3,'p_direct_id_declarator_2','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_id_declarator',5,'p_direct_id_declarator_3','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_id_declarator',6,'p_direct_id_declarator_4','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_id_declarator',6,'p_direct_id_declarator_4','plyparser.py',127), + ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_id_declarator',5,'p_direct_id_declarator_5','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LPAREN parameter_type_list RPAREN','direct_id_declarator',4,'p_direct_id_declarator_6','plyparser.py',126), + ('direct_id_declarator -> direct_id_declarator LPAREN identifier_list_opt RPAREN','direct_id_declarator',4,'p_direct_id_declarator_6','plyparser.py',127), + ('direct_typeid_declarator -> TYPEID','direct_typeid_declarator',1,'p_direct_typeid_declarator_1','plyparser.py',126), + ('direct_typeid_declarator -> LPAREN typeid_declarator RPAREN','direct_typeid_declarator',3,'p_direct_typeid_declarator_2','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_typeid_declarator',5,'p_direct_typeid_declarator_3','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_typeid_declarator',6,'p_direct_typeid_declarator_4','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_typeid_declarator',6,'p_direct_typeid_declarator_4','plyparser.py',127), + ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_typeid_declarator',5,'p_direct_typeid_declarator_5','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LPAREN parameter_type_list RPAREN','direct_typeid_declarator',4,'p_direct_typeid_declarator_6','plyparser.py',126), + ('direct_typeid_declarator -> direct_typeid_declarator LPAREN identifier_list_opt RPAREN','direct_typeid_declarator',4,'p_direct_typeid_declarator_6','plyparser.py',127), + ('direct_typeid_noparen_declarator -> TYPEID','direct_typeid_noparen_declarator',1,'p_direct_typeid_noparen_declarator_1','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_typeid_noparen_declarator',5,'p_direct_typeid_noparen_declarator_3','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_typeid_noparen_declarator',6,'p_direct_typeid_noparen_declarator_4','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_typeid_noparen_declarator',6,'p_direct_typeid_noparen_declarator_4','plyparser.py',127), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_typeid_noparen_declarator',5,'p_direct_typeid_noparen_declarator_5','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LPAREN parameter_type_list RPAREN','direct_typeid_noparen_declarator',4,'p_direct_typeid_noparen_declarator_6','plyparser.py',126), + ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LPAREN identifier_list_opt RPAREN','direct_typeid_noparen_declarator',4,'p_direct_typeid_noparen_declarator_6','plyparser.py',127), + ('id_declarator -> direct_id_declarator','id_declarator',1,'p_id_declarator_1','plyparser.py',126), + ('id_declarator -> pointer direct_id_declarator','id_declarator',2,'p_id_declarator_2','plyparser.py',126), + ('typeid_declarator -> direct_typeid_declarator','typeid_declarator',1,'p_typeid_declarator_1','plyparser.py',126), + ('typeid_declarator -> pointer direct_typeid_declarator','typeid_declarator',2,'p_typeid_declarator_2','plyparser.py',126), + ('typeid_noparen_declarator -> direct_typeid_noparen_declarator','typeid_noparen_declarator',1,'p_typeid_noparen_declarator_1','plyparser.py',126), + ('typeid_noparen_declarator -> pointer direct_typeid_noparen_declarator','typeid_noparen_declarator',2,'p_typeid_noparen_declarator_2','plyparser.py',126), + ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','c_parser.py',509), + ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','c_parser.py',510), + ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','c_parser.py',518), + ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','c_parser.py',524), + ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','c_parser.py',534), + ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','c_parser.py',539), + ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','c_parser.py',544), + ('external_declaration -> pppragma_directive','external_declaration',1,'p_external_declaration_3','c_parser.py',545), + ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','c_parser.py',550), + ('external_declaration -> static_assert','external_declaration',1,'p_external_declaration_5','c_parser.py',555), + ('static_assert -> _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN','static_assert',6,'p_static_assert_declaration','c_parser.py',560), + ('static_assert -> _STATIC_ASSERT LPAREN constant_expression RPAREN','static_assert',4,'p_static_assert_declaration','c_parser.py',561), + ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','c_parser.py',569), + ('pppragma_directive -> PPPRAGMA','pppragma_directive',1,'p_pppragma_directive','c_parser.py',575), + ('pppragma_directive -> PPPRAGMA PPPRAGMASTR','pppragma_directive',2,'p_pppragma_directive','c_parser.py',576), + ('function_definition -> id_declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','c_parser.py',586), + ('function_definition -> declaration_specifiers id_declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','c_parser.py',604), + ('statement -> labeled_statement','statement',1,'p_statement','c_parser.py',619), + ('statement -> expression_statement','statement',1,'p_statement','c_parser.py',620), + ('statement -> compound_statement','statement',1,'p_statement','c_parser.py',621), + ('statement -> selection_statement','statement',1,'p_statement','c_parser.py',622), + ('statement -> iteration_statement','statement',1,'p_statement','c_parser.py',623), + ('statement -> jump_statement','statement',1,'p_statement','c_parser.py',624), + ('statement -> pppragma_directive','statement',1,'p_statement','c_parser.py',625), + ('statement -> static_assert','statement',1,'p_statement','c_parser.py',626), + ('pragmacomp_or_statement -> pppragma_directive statement','pragmacomp_or_statement',2,'p_pragmacomp_or_statement','c_parser.py',674), + ('pragmacomp_or_statement -> statement','pragmacomp_or_statement',1,'p_pragmacomp_or_statement','c_parser.py',675), + ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','c_parser.py',694), + ('decl_body -> declaration_specifiers_no_type id_init_declarator_list_opt','decl_body',2,'p_decl_body','c_parser.py',695), + ('declaration -> decl_body SEMI','declaration',2,'p_declaration','c_parser.py',755), + ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','c_parser.py',764), + ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','c_parser.py',765), + ('declaration_specifiers_no_type -> type_qualifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_1','c_parser.py',775), + ('declaration_specifiers_no_type -> storage_class_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_2','c_parser.py',780), + ('declaration_specifiers_no_type -> function_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_3','c_parser.py',785), + ('declaration_specifiers_no_type -> atomic_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_4','c_parser.py',792), + ('declaration_specifiers_no_type -> alignment_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_5','c_parser.py',797), + ('declaration_specifiers -> declaration_specifiers type_qualifier','declaration_specifiers',2,'p_declaration_specifiers_1','c_parser.py',802), + ('declaration_specifiers -> declaration_specifiers storage_class_specifier','declaration_specifiers',2,'p_declaration_specifiers_2','c_parser.py',807), + ('declaration_specifiers -> declaration_specifiers function_specifier','declaration_specifiers',2,'p_declaration_specifiers_3','c_parser.py',812), + ('declaration_specifiers -> declaration_specifiers type_specifier_no_typeid','declaration_specifiers',2,'p_declaration_specifiers_4','c_parser.py',817), + ('declaration_specifiers -> type_specifier','declaration_specifiers',1,'p_declaration_specifiers_5','c_parser.py',822), + ('declaration_specifiers -> declaration_specifiers_no_type type_specifier','declaration_specifiers',2,'p_declaration_specifiers_6','c_parser.py',827), + ('declaration_specifiers -> declaration_specifiers alignment_specifier','declaration_specifiers',2,'p_declaration_specifiers_7','c_parser.py',832), + ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',837), + ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',838), + ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',839), + ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',840), + ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',841), + ('storage_class_specifier -> _THREAD_LOCAL','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',842), + ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','c_parser.py',847), + ('function_specifier -> _NORETURN','function_specifier',1,'p_function_specifier','c_parser.py',848), + ('type_specifier_no_typeid -> VOID','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',853), + ('type_specifier_no_typeid -> _BOOL','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',854), + ('type_specifier_no_typeid -> CHAR','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',855), + ('type_specifier_no_typeid -> SHORT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',856), + ('type_specifier_no_typeid -> INT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',857), + ('type_specifier_no_typeid -> LONG','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',858), + ('type_specifier_no_typeid -> FLOAT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',859), + ('type_specifier_no_typeid -> DOUBLE','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',860), + ('type_specifier_no_typeid -> _COMPLEX','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',861), + ('type_specifier_no_typeid -> SIGNED','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',862), + ('type_specifier_no_typeid -> UNSIGNED','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',863), + ('type_specifier_no_typeid -> __INT128','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',864), + ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier','c_parser.py',869), + ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier','c_parser.py',870), + ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier','c_parser.py',871), + ('type_specifier -> type_specifier_no_typeid','type_specifier',1,'p_type_specifier','c_parser.py',872), + ('type_specifier -> atomic_specifier','type_specifier',1,'p_type_specifier','c_parser.py',873), + ('atomic_specifier -> _ATOMIC LPAREN type_name RPAREN','atomic_specifier',4,'p_atomic_specifier','c_parser.py',879), + ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','c_parser.py',886), + ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','c_parser.py',887), + ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','c_parser.py',888), + ('type_qualifier -> _ATOMIC','type_qualifier',1,'p_type_qualifier','c_parser.py',889), + ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list','c_parser.py',894), + ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list','c_parser.py',895), + ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','c_parser.py',903), + ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','c_parser.py',904), + ('id_init_declarator_list -> id_init_declarator','id_init_declarator_list',1,'p_id_init_declarator_list','c_parser.py',909), + ('id_init_declarator_list -> id_init_declarator_list COMMA init_declarator','id_init_declarator_list',3,'p_id_init_declarator_list','c_parser.py',910), + ('id_init_declarator -> id_declarator','id_init_declarator',1,'p_id_init_declarator','c_parser.py',915), + ('id_init_declarator -> id_declarator EQUALS initializer','id_init_declarator',3,'p_id_init_declarator','c_parser.py',916), + ('specifier_qualifier_list -> specifier_qualifier_list type_specifier_no_typeid','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','c_parser.py',923), + ('specifier_qualifier_list -> specifier_qualifier_list type_qualifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','c_parser.py',928), + ('specifier_qualifier_list -> type_specifier','specifier_qualifier_list',1,'p_specifier_qualifier_list_3','c_parser.py',933), + ('specifier_qualifier_list -> type_qualifier_list type_specifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_4','c_parser.py',938), + ('specifier_qualifier_list -> alignment_specifier','specifier_qualifier_list',1,'p_specifier_qualifier_list_5','c_parser.py',943), + ('specifier_qualifier_list -> specifier_qualifier_list alignment_specifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_6','c_parser.py',948), + ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','c_parser.py',956), + ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','c_parser.py',957), + ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','c_parser.py',967), + ('struct_or_union_specifier -> struct_or_union brace_open brace_close','struct_or_union_specifier',3,'p_struct_or_union_specifier_2','c_parser.py',968), + ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','c_parser.py',985), + ('struct_or_union_specifier -> struct_or_union ID brace_open brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_3','c_parser.py',986), + ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','c_parser.py',987), + ('struct_or_union_specifier -> struct_or_union TYPEID brace_open brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_3','c_parser.py',988), + ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','c_parser.py',1004), + ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','c_parser.py',1005), + ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','c_parser.py',1012), + ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','c_parser.py',1013), + ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','c_parser.py',1021), + ('struct_declaration -> SEMI','struct_declaration',1,'p_struct_declaration_2','c_parser.py',1059), + ('struct_declaration -> pppragma_directive','struct_declaration',1,'p_struct_declaration_3','c_parser.py',1064), + ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','c_parser.py',1069), + ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','c_parser.py',1070), + ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','c_parser.py',1078), + ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','c_parser.py',1083), + ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','c_parser.py',1084), + ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','c_parser.py',1092), + ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','c_parser.py',1093), + ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','c_parser.py',1098), + ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','c_parser.py',1103), + ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','c_parser.py',1104), + ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','c_parser.py',1109), + ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','c_parser.py',1110), + ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','c_parser.py',1111), + ('alignment_specifier -> _ALIGNAS LPAREN type_name RPAREN','alignment_specifier',4,'p_alignment_specifier','c_parser.py',1122), + ('alignment_specifier -> _ALIGNAS LPAREN constant_expression RPAREN','alignment_specifier',4,'p_alignment_specifier','c_parser.py',1123), + ('enumerator -> ID','enumerator',1,'p_enumerator','c_parser.py',1128), + ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','c_parser.py',1129), + ('declarator -> id_declarator','declarator',1,'p_declarator','c_parser.py',1144), + ('declarator -> typeid_declarator','declarator',1,'p_declarator','c_parser.py',1145), + ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','c_parser.py',1257), + ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','c_parser.py',1258), + ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','c_parser.py',1287), + ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','c_parser.py',1288), + ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','c_parser.py',1293), + ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','c_parser.py',1294), + ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','c_parser.py',1302), + ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','c_parser.py',1303), + ('parameter_declaration -> declaration_specifiers id_declarator','parameter_declaration',2,'p_parameter_declaration_1','c_parser.py',1322), + ('parameter_declaration -> declaration_specifiers typeid_noparen_declarator','parameter_declaration',2,'p_parameter_declaration_1','c_parser.py',1323), + ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','c_parser.py',1334), + ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','c_parser.py',1366), + ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','c_parser.py',1367), + ('initializer -> assignment_expression','initializer',1,'p_initializer_1','c_parser.py',1376), + ('initializer -> brace_open initializer_list_opt brace_close','initializer',3,'p_initializer_2','c_parser.py',1381), + ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','c_parser.py',1382), + ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','c_parser.py',1390), + ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','c_parser.py',1391), + ('designation -> designator_list EQUALS','designation',2,'p_designation','c_parser.py',1402), + ('designator_list -> designator','designator_list',1,'p_designator_list','c_parser.py',1410), + ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','c_parser.py',1411), + ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','c_parser.py',1416), + ('designator -> PERIOD identifier','designator',2,'p_designator','c_parser.py',1417), + ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','c_parser.py',1422), + ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','c_parser.py',1434), + ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','c_parser.py',1442), + ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','c_parser.py',1447), + ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','c_parser.py',1457), + ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','c_parser.py',1461), + ('direct_abstract_declarator -> LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_3','c_parser.py',1472), + ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','c_parser.py',1482), + ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','c_parser.py',1493), + ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','c_parser.py',1502), + ('direct_abstract_declarator -> LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_7','c_parser.py',1512), + ('block_item -> declaration','block_item',1,'p_block_item','c_parser.py',1523), + ('block_item -> statement','block_item',1,'p_block_item','c_parser.py',1524), + ('block_item_list -> block_item','block_item_list',1,'p_block_item_list','c_parser.py',1531), + ('block_item_list -> block_item_list block_item','block_item_list',2,'p_block_item_list','c_parser.py',1532), + ('compound_statement -> brace_open block_item_list_opt brace_close','compound_statement',3,'p_compound_statement_1','c_parser.py',1538), + ('labeled_statement -> ID COLON pragmacomp_or_statement','labeled_statement',3,'p_labeled_statement_1','c_parser.py',1544), + ('labeled_statement -> CASE constant_expression COLON pragmacomp_or_statement','labeled_statement',4,'p_labeled_statement_2','c_parser.py',1548), + ('labeled_statement -> DEFAULT COLON pragmacomp_or_statement','labeled_statement',3,'p_labeled_statement_3','c_parser.py',1552), + ('selection_statement -> IF LPAREN expression RPAREN pragmacomp_or_statement','selection_statement',5,'p_selection_statement_1','c_parser.py',1556), + ('selection_statement -> IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement','selection_statement',7,'p_selection_statement_2','c_parser.py',1560), + ('selection_statement -> SWITCH LPAREN expression RPAREN pragmacomp_or_statement','selection_statement',5,'p_selection_statement_3','c_parser.py',1564), + ('iteration_statement -> WHILE LPAREN expression RPAREN pragmacomp_or_statement','iteration_statement',5,'p_iteration_statement_1','c_parser.py',1569), + ('iteration_statement -> DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI','iteration_statement',7,'p_iteration_statement_2','c_parser.py',1573), + ('iteration_statement -> FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement','iteration_statement',9,'p_iteration_statement_3','c_parser.py',1577), + ('iteration_statement -> FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement','iteration_statement',8,'p_iteration_statement_4','c_parser.py',1581), + ('jump_statement -> GOTO ID SEMI','jump_statement',3,'p_jump_statement_1','c_parser.py',1586), + ('jump_statement -> BREAK SEMI','jump_statement',2,'p_jump_statement_2','c_parser.py',1590), + ('jump_statement -> CONTINUE SEMI','jump_statement',2,'p_jump_statement_3','c_parser.py',1594), + ('jump_statement -> RETURN expression SEMI','jump_statement',3,'p_jump_statement_4','c_parser.py',1598), + ('jump_statement -> RETURN SEMI','jump_statement',2,'p_jump_statement_4','c_parser.py',1599), + ('expression_statement -> expression_opt SEMI','expression_statement',2,'p_expression_statement','c_parser.py',1604), + ('expression -> assignment_expression','expression',1,'p_expression','c_parser.py',1611), + ('expression -> expression COMMA assignment_expression','expression',3,'p_expression','c_parser.py',1612), + ('assignment_expression -> LPAREN compound_statement RPAREN','assignment_expression',3,'p_parenthesized_compound_expression','c_parser.py',1624), + ('typedef_name -> TYPEID','typedef_name',1,'p_typedef_name','c_parser.py',1628), + ('assignment_expression -> conditional_expression','assignment_expression',1,'p_assignment_expression','c_parser.py',1632), + ('assignment_expression -> unary_expression assignment_operator assignment_expression','assignment_expression',3,'p_assignment_expression','c_parser.py',1633), + ('assignment_operator -> EQUALS','assignment_operator',1,'p_assignment_operator','c_parser.py',1646), + ('assignment_operator -> XOREQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1647), + ('assignment_operator -> TIMESEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1648), + ('assignment_operator -> DIVEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1649), + ('assignment_operator -> MODEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1650), + ('assignment_operator -> PLUSEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1651), + ('assignment_operator -> MINUSEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1652), + ('assignment_operator -> LSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1653), + ('assignment_operator -> RSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1654), + ('assignment_operator -> ANDEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1655), + ('assignment_operator -> OREQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1656), + ('constant_expression -> conditional_expression','constant_expression',1,'p_constant_expression','c_parser.py',1661), + ('conditional_expression -> binary_expression','conditional_expression',1,'p_conditional_expression','c_parser.py',1665), + ('conditional_expression -> binary_expression CONDOP expression COLON conditional_expression','conditional_expression',5,'p_conditional_expression','c_parser.py',1666), + ('binary_expression -> cast_expression','binary_expression',1,'p_binary_expression','c_parser.py',1674), + ('binary_expression -> binary_expression TIMES binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1675), + ('binary_expression -> binary_expression DIVIDE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1676), + ('binary_expression -> binary_expression MOD binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1677), + ('binary_expression -> binary_expression PLUS binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1678), + ('binary_expression -> binary_expression MINUS binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1679), + ('binary_expression -> binary_expression RSHIFT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1680), + ('binary_expression -> binary_expression LSHIFT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1681), + ('binary_expression -> binary_expression LT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1682), + ('binary_expression -> binary_expression LE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1683), + ('binary_expression -> binary_expression GE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1684), + ('binary_expression -> binary_expression GT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1685), + ('binary_expression -> binary_expression EQ binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1686), + ('binary_expression -> binary_expression NE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1687), + ('binary_expression -> binary_expression AND binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1688), + ('binary_expression -> binary_expression OR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1689), + ('binary_expression -> binary_expression XOR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1690), + ('binary_expression -> binary_expression LAND binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1691), + ('binary_expression -> binary_expression LOR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1692), + ('cast_expression -> unary_expression','cast_expression',1,'p_cast_expression_1','c_parser.py',1700), + ('cast_expression -> LPAREN type_name RPAREN cast_expression','cast_expression',4,'p_cast_expression_2','c_parser.py',1704), + ('unary_expression -> postfix_expression','unary_expression',1,'p_unary_expression_1','c_parser.py',1708), + ('unary_expression -> PLUSPLUS unary_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1712), + ('unary_expression -> MINUSMINUS unary_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1713), + ('unary_expression -> unary_operator cast_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1714), + ('unary_expression -> SIZEOF unary_expression','unary_expression',2,'p_unary_expression_3','c_parser.py',1719), + ('unary_expression -> SIZEOF LPAREN type_name RPAREN','unary_expression',4,'p_unary_expression_3','c_parser.py',1720), + ('unary_expression -> _ALIGNOF LPAREN type_name RPAREN','unary_expression',4,'p_unary_expression_3','c_parser.py',1721), + ('unary_operator -> AND','unary_operator',1,'p_unary_operator','c_parser.py',1729), + ('unary_operator -> TIMES','unary_operator',1,'p_unary_operator','c_parser.py',1730), + ('unary_operator -> PLUS','unary_operator',1,'p_unary_operator','c_parser.py',1731), + ('unary_operator -> MINUS','unary_operator',1,'p_unary_operator','c_parser.py',1732), + ('unary_operator -> NOT','unary_operator',1,'p_unary_operator','c_parser.py',1733), + ('unary_operator -> LNOT','unary_operator',1,'p_unary_operator','c_parser.py',1734), + ('postfix_expression -> primary_expression','postfix_expression',1,'p_postfix_expression_1','c_parser.py',1739), + ('postfix_expression -> postfix_expression LBRACKET expression RBRACKET','postfix_expression',4,'p_postfix_expression_2','c_parser.py',1743), + ('postfix_expression -> postfix_expression LPAREN argument_expression_list RPAREN','postfix_expression',4,'p_postfix_expression_3','c_parser.py',1747), + ('postfix_expression -> postfix_expression LPAREN RPAREN','postfix_expression',3,'p_postfix_expression_3','c_parser.py',1748), + ('postfix_expression -> postfix_expression PERIOD ID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1753), + ('postfix_expression -> postfix_expression PERIOD TYPEID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1754), + ('postfix_expression -> postfix_expression ARROW ID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1755), + ('postfix_expression -> postfix_expression ARROW TYPEID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1756), + ('postfix_expression -> postfix_expression PLUSPLUS','postfix_expression',2,'p_postfix_expression_5','c_parser.py',1762), + ('postfix_expression -> postfix_expression MINUSMINUS','postfix_expression',2,'p_postfix_expression_5','c_parser.py',1763), + ('postfix_expression -> LPAREN type_name RPAREN brace_open initializer_list brace_close','postfix_expression',6,'p_postfix_expression_6','c_parser.py',1768), + ('postfix_expression -> LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close','postfix_expression',7,'p_postfix_expression_6','c_parser.py',1769), + ('primary_expression -> identifier','primary_expression',1,'p_primary_expression_1','c_parser.py',1774), + ('primary_expression -> constant','primary_expression',1,'p_primary_expression_2','c_parser.py',1778), + ('primary_expression -> unified_string_literal','primary_expression',1,'p_primary_expression_3','c_parser.py',1782), + ('primary_expression -> unified_wstring_literal','primary_expression',1,'p_primary_expression_3','c_parser.py',1783), + ('primary_expression -> LPAREN expression RPAREN','primary_expression',3,'p_primary_expression_4','c_parser.py',1788), + ('primary_expression -> OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN','primary_expression',6,'p_primary_expression_5','c_parser.py',1792), + ('offsetof_member_designator -> identifier','offsetof_member_designator',1,'p_offsetof_member_designator','c_parser.py',1800), + ('offsetof_member_designator -> offsetof_member_designator PERIOD identifier','offsetof_member_designator',3,'p_offsetof_member_designator','c_parser.py',1801), + ('offsetof_member_designator -> offsetof_member_designator LBRACKET expression RBRACKET','offsetof_member_designator',4,'p_offsetof_member_designator','c_parser.py',1802), + ('argument_expression_list -> assignment_expression','argument_expression_list',1,'p_argument_expression_list','c_parser.py',1814), + ('argument_expression_list -> argument_expression_list COMMA assignment_expression','argument_expression_list',3,'p_argument_expression_list','c_parser.py',1815), + ('identifier -> ID','identifier',1,'p_identifier','c_parser.py',1824), + ('constant -> INT_CONST_DEC','constant',1,'p_constant_1','c_parser.py',1828), + ('constant -> INT_CONST_OCT','constant',1,'p_constant_1','c_parser.py',1829), + ('constant -> INT_CONST_HEX','constant',1,'p_constant_1','c_parser.py',1830), + ('constant -> INT_CONST_BIN','constant',1,'p_constant_1','c_parser.py',1831), + ('constant -> INT_CONST_CHAR','constant',1,'p_constant_1','c_parser.py',1832), + ('constant -> FLOAT_CONST','constant',1,'p_constant_2','c_parser.py',1851), + ('constant -> HEX_FLOAT_CONST','constant',1,'p_constant_2','c_parser.py',1852), + ('constant -> CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1868), + ('constant -> WCHAR_CONST','constant',1,'p_constant_3','c_parser.py',1869), + ('constant -> U8CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1870), + ('constant -> U16CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1871), + ('constant -> U32CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1872), + ('unified_string_literal -> STRING_LITERAL','unified_string_literal',1,'p_unified_string_literal','c_parser.py',1883), + ('unified_string_literal -> unified_string_literal STRING_LITERAL','unified_string_literal',2,'p_unified_string_literal','c_parser.py',1884), + ('unified_wstring_literal -> WSTRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1894), + ('unified_wstring_literal -> U8STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1895), + ('unified_wstring_literal -> U16STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1896), + ('unified_wstring_literal -> U32STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1897), + ('unified_wstring_literal -> unified_wstring_literal WSTRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1898), + ('unified_wstring_literal -> unified_wstring_literal U8STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1899), + ('unified_wstring_literal -> unified_wstring_literal U16STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1900), + ('unified_wstring_literal -> unified_wstring_literal U32STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1901), + ('brace_open -> LBRACE','brace_open',1,'p_brace_open','c_parser.py',1911), + ('brace_close -> RBRACE','brace_close',1,'p_brace_close','c_parser.py',1917), + ('empty -> ','empty',0,'p_empty','c_parser.py',1923), +] diff --git a/lambda_function.py b/lambda_function.py new file mode 100644 index 0000000..b5f541a --- /dev/null +++ b/lambda_function.py @@ -0,0 +1,3 @@ +import sys +def handler(event, context): + return 'Hello from AWS Lambda using Python' + sys.version + '!' diff --git a/lattice/.DS_Store b/lattice/.DS_Store new file mode 100644 index 0000000..f357b76 Binary files /dev/null and b/lattice/.DS_Store differ diff --git a/lattice/lattice.zip b/lattice/lattice.zip new file mode 100644 index 0000000..666c629 Binary files /dev/null and b/lattice/lattice.zip differ diff --git a/lattice/python/lattice.py b/lattice/python/lattice.py new file mode 100644 index 0000000..bc901bd --- /dev/null +++ b/lattice/python/lattice.py @@ -0,0 +1,419 @@ +"""Query Meshify for data.""" +import json +import csv +from os import getenv +import getpass +import pickle +from pathlib import Path +import requests +import click + + +MESHIFY_BASE_URL = "https://194.p2121.net/api/" #getenv("MESHIFY_BASE_URL") +MESHIFY_USERNAME = "reportuser@henrypump.com" #getenv("MESHIFY_USERNAME") +MESHIFY_PASSWORD = "Kk8kMU2cc6vqVy" #getenv("MESHIFY_PASSWORD") +MESHIFY_AUTH = None + + +class NameNotFound(Exception): + """Thrown when a name is not found in a list of stuff.""" + + def __init__(self, message, name, list_of_stuff, *args): + """Initialize the NameNotFound Exception.""" + self.message = message + self.name = name + self.list_of_stuff = list_of_stuff + super(NameNotFound, self).__init__(message, name, list_of_stuff, *args) + + +def dict_filter(it, *keys): + """Filter dictionary results.""" + for d in it: + yield dict((k, d[k]) for k in keys) + + +def check_setup(): + """Check the global parameters.""" + global MESHIFY_USERNAME, MESHIFY_PASSWORD, MESHIFY_AUTH, MESHIFY_BASE_URL + if not MESHIFY_USERNAME or not MESHIFY_PASSWORD: + print("Simplify the usage by setting the meshify username and password as environment variables MESHIFY_USERNAME and MESHIFY_PASSWORD") + MESHIFY_USERNAME = input("Meshify Username: ") + MESHIFY_PASSWORD = getpass.getpass("Meshify Password: ") + + MESHIFY_AUTH = requests.auth.HTTPBasicAuth(MESHIFY_USERNAME, MESHIFY_PASSWORD) + + if not MESHIFY_BASE_URL: + print("Simplify the usage by setting the environment variable MESHIFY_BASE_URL") + MESHIFY_BASE_URL = input("Meshify Base URL: ") + + +def find_by_name(name, list_of_stuff): + """Find an object in a list of stuff by its name parameter.""" + for x in list_of_stuff: + if x['name'] == name: + return x + raise NameNotFound("Name not found!", name, list_of_stuff) + + +def GET(endpoint): + """Make a query to the meshify API.""" + check_setup() + if endpoint[0] == "/": + endpoint = endpoint[1:] + q_url = MESHIFY_BASE_URL + endpoint + q_req = requests.get(q_url, auth=MESHIFY_AUTH) + return json.loads(q_req.text) if q_req.status_code == 200 else [] + + +def post_meshify_api(endpoint, data): + """Post data to the meshify API.""" + check_setup() + q_url = MESHIFY_BASE_URL + endpoint + q_req = requests.post(q_url, data=json.dumps(data), auth=MESHIFY_AUTH) + if q_req.status_code != 200: + print(q_req.status_code) + return json.loads(q_req.text) if q_req.status_code == 200 else [] + + +def getNodeTypes(): + return GET("nodetypes") + +def getNodes(): + return GET("nodes") + +def getFolders(): + return GET("folders") + +def getChannelValues(nodeId): + return GET("data/current?nodeId={}".format(nodeId)) + +def getUsers(): + return GET("users") + +def decode_channel_parameters(channel): + """Decode a channel object's parameters into human-readable format.""" + channel_types = { + 1: 'device', + 5: 'static', + 6: 'user input', + 7: 'system' + } + + io_options = { + 0: 'readonly', + 1: 'readwrite' + } + + datatype_options = { + 1: "float", + 2: 'string', + 3: 'integer', + 4: 'boolean', + 5: 'datetime', + 6: 'timespan', + 7: 'file', + 8: 'latlng' + } + + channel['channelType'] = channel_types[channel['channelType']] + channel['io'] = io_options[channel['io']] + channel['dataType'] = datatype_options[channel['dataType']] + return channel + + +def encode_channel_parameters(channel): + """Encode a channel object from human-readable format.""" + channel_types = { + 'device': 1, + 'static': 5, + 'user input': 6, + 'system': 7 + } + + io_options = { + 'readonly': False, + 'readwrite': True + } + + datatype_options = { + "float": 1, + 'string': 2, + 'integer': 3, + 'boolean': 4, + 'datetime': 5, + 'timespan': 6, + 'file': 7, + 'latlng': 8 + } + try: + channel['deviceTypeId'] = int(channel['deviceTypeId']) + channel['fromMe'] = channel['fromMe'].lower() == 'true' + channel['channelType'] = channel_types[channel['channelType'].lower()] + channel['io'] = io_options[channel['io'].lower()] + channel['dataType'] = datatype_options[channel['dataType'].lower()] + # channel['id'] = 1 + return channel + except KeyError as e: + click.echo("Unable to convert channel {} due to bad key: {}".format(channel['name'], e)) + + +def make_modbusmap_channel(i, chan, device_type_name): + """Make a channel object for a row in the CSV.""" + json_obj = { + "ah": "", + "bytary": None, + "al": "", + "vn": chan['subTitle'], # Name + "ct": "number", # ChangeType + "le": "16", # Length(16 or 32) + "grp": str(chan['guaranteedReportPeriod']), # GuaranteedReportPeriod + "la": None, + "chn": chan['name'], # ChannelName + "un": "1", # DeviceNumber + "dn": device_type_name, # deviceName + "vm": None, + "lrt": "0", + "da": "300", # DeviceAddress + "a": chan['helpExplanation'], # TagName + "c": str(chan['change']), # Change + "misc_u": str(chan['units']), # Units + "f": "1", # FunctionCode + "mrt": str(chan['minReportTime']), # MinimumReportTime + "m": "none", # multiplier + "m1ch": "2-{}".format(i), + "mv": "0", # MultiplierValue + "s": "On", + "r": "{}-{}".format(chan['min'], chan['max']), # range + "t": "int" # type + } + return json_obj + + +def combine_modbusmap_and_channel(channel_obj, modbus_map): + """Add the parameters from the modbus map to the channel object.""" + channel_part = modbus_map["1"]["addresses"]["300"] + for c in channel_part: + if channel_part[c]["chn"] == channel_obj['name']: + channel_obj['units'] = channel_part[c]["misc_u"] + try: + min_max_range = channel_part[c]["r"].split("-") + channel_obj['min'] = int(min_max_range[0]) + channel_obj['max'] = int(min_max_range[1]) + except Exception: + channel_obj['min'] = None + channel_obj['max'] = None + + channel_obj['change'] = float(channel_part[c]["c"]) + channel_obj['guaranteedReportPeriod'] = int(channel_part[c]["grp"]) + channel_obj['minReportTime'] = int(channel_part[c]["mrt"]) + return channel_obj + return False + + +@click.group() +def cli(): + """Command Line Interface.""" + pass + + +@click.command() +@click.argument("device_type_name") +@click.option("-o", '--output-file', default=None, help="Where to put the CSV of channels.") +@click.option("-m", '--modbusmap-file', default="modbusMap.p", help="The location of the modbusMap.p file") +def get_channel_csv(device_type_name, output_file, modbusmap_file): + """Query the meshify API and create a CSV of the current channels.""" + channel_fieldnames = [ + 'id', + 'name', + 'deviceTypeId', + 'fromMe', + 'io', + 'subTitle', + 'helpExplanation', + 'channelType', + 'dataType', + 'defaultValue', + 'regex', + 'regexErrMsg', + 'units', + 'min', + 'max', + 'change', + 'guaranteedReportPeriod', + 'minReportTime' + ] + devicetypes = GET('devicetypes') + this_devicetype = find_by_name(device_type_name, devicetypes) + channels = GET('devicetypes/{}/channels'.format(this_devicetype['id'])) + modbus_map = None + + if Path(modbusmap_file).exists(): + with open(modbusmap_file, 'rb') as open_mbs_file: + modbus_map = pickle.load(open_mbs_file) + + if not output_file: + output_file = 'channels_{}.csv'.format(device_type_name) + + with open(output_file, 'w') as csvfile: + writer = csv.DictWriter(csvfile, fieldnames=channel_fieldnames) + + writer.writeheader() + for ch in channels: + if not modbus_map: + ch['units'] = None + ch['min'] = None + ch['max'] = None + ch['change'] = None + ch['guaranteedReportPeriod'] = None + ch['minReportTime'] = None + else: + combined = combine_modbusmap_and_channel(ch, modbus_map) + if combined: + ch = combined + writer.writerow(decode_channel_parameters(ch)) + + click.echo("Wrote channels to {}".format(output_file)) + + +@click.command() +@click.argument("device_type_name") +@click.argument("csv_file") +def post_channel_csv(device_type_name, csv_file): + """Post values from a CSV to Meshify Channel API.""" + devicetypes = GET('devicetypes') + this_devicetype = find_by_name(device_type_name, devicetypes) + + with open(csv_file, 'r') as inp_file: + reader = csv.DictReader(inp_file) + for row in dict_filter(reader, 'name', + 'deviceTypeId', + 'fromMe', + 'io', + 'subTitle', + 'helpExplanation', + 'channelType', + 'dataType', + 'defaultValue', + 'regex', + 'regexErrMsg'): + # print(row) + # print(encode_channel_parameters(row)) + # click.echo(json.dumps(encode_channel_parameters(row), indent=4)) + if post_meshify_api('devicetypes/{}/channels'.format(this_devicetype['id']), encode_channel_parameters(row)): + click.echo("Successfully added channel {}".format(row['name'])) + else: + click.echo("Unable to add channel {}".format(row['name'])) + + +@click.command() +def print_channel_options(): + """Print channel options for use with the csv files.""" + channel_types = ['device', 'static', 'user input', 'system'] + io_options = ['readonly', 'readwrite'] + datatype_options = [ + "float", + 'string', + 'integer', + 'boolean', + 'datetime', + 'timespan', + 'file', + 'latlng' + ] + + click.echo("\n\nchannelType options") + click.echo("===================") + for chan in channel_types: + click.echo(chan) + + click.echo("\n\nio options") + click.echo("==========") + for i in io_options: + click.echo(i) + + click.echo("\n\ndataType options") + click.echo("================") + for d in datatype_options: + click.echo(d) + + +@click.command() +@click.argument("device_type_name") +@click.argument("csv_file") +def create_modbusMap(device_type_name, csv_file): + """Create modbusMap.p from channel csv file.""" + modbusMap = { + "1": { + "c": "ETHERNET/IP", + "b": "192.168.1.10", + "addresses": { + "300": {} + }, + "f": "Off", + "p": "", + "s": "1" + }, + "2": { + "c": "M1-485", + "b": "9600", + "addresses": {}, + "f": "Off", + "p": "None", + "s": "1" + } + } + ind = 1 + with open(csv_file, 'r') as inp_file: + reader = csv.DictReader(inp_file) + for row in reader: + modbusMap["1"]["addresses"]["300"]["2-{}".format(ind)] = make_modbusmap_channel(ind, row, device_type_name) + ind += 1 + with open("modbusMap.p", 'wb') as mod_map_file: + pickle.dump(modbusMap, mod_map_file, protocol=0) + + with open("modbusMap.json", 'w') as json_file: + json.dump(modbusMap, json_file, indent=4) + + +@click.command() +@click.option("-i", "--input-file", default="modbusMap.p", help="The modbus map pickle file to convert.") +@click.option("-o", "--output", default="modbusMap.json", help="The modbus map json file output filename.") +def pickle_to_json(input_file, output): + """Convert a pickle file to a json file.""" + if not Path(input_file).exists(): + click.echo("Pickle file {} does not exist".format(input_file)) + return + + with open(input_file, 'rb') as picklefile: + input_contents = pickle.load(picklefile) + + with open(output, 'w') as outfile: + json.dump(input_contents, outfile, indent=4) + click.echo("Wrote from {} to {}.".format(input_file, output)) + +@click.command() +@click.option("-i", "--input-file", default="modbusMap.json", help="The modbus map json file to convert.") +@click.option("-o", "--output", default="modbusMap.p", help="The modbus map pickle file output filename.") +def json_to_pickle(input_file, output): + """Convert a pickle file to a json file.""" + if not Path(input_file).exists(): + click.echo("JSON file {} does not exist".format(input_file)) + return + + with open(input_file, 'rb') as json_file: + input_contents = json.load(json_file) + + with open(output, 'wb') as outfile: + pickle.dump(input_contents, outfile, protocol=0) + click.echo("Wrote from {} to {}.".format(input_file, output)) + + +cli.add_command(get_channel_csv) +cli.add_command(post_channel_csv) +cli.add_command(print_channel_options) +cli.add_command(create_modbusMap) +cli.add_command(pickle_to_json) +cli.add_command(json_to_pickle) + +if __name__ == '__main__': + cli() diff --git a/requests/python/bin/normalizer b/requests/python/bin/normalizer new file mode 100755 index 0000000..f51dc01 --- /dev/null +++ b/requests/python/bin/normalizer @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from charset_normalizer.cli.normalizer import cli_detect +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(cli_detect()) diff --git a/requests/python/certifi-2023.7.22.dist-info/INSTALLER b/requests/python/certifi-2023.7.22.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/requests/python/certifi-2023.7.22.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/requests/python/certifi-2023.7.22.dist-info/LICENSE b/requests/python/certifi-2023.7.22.dist-info/LICENSE new file mode 100644 index 0000000..0a64774 --- /dev/null +++ b/requests/python/certifi-2023.7.22.dist-info/LICENSE @@ -0,0 +1,21 @@ +This package contains a modified version of ca-bundle.crt: + +ca-bundle.crt -- Bundle of CA Root Certificates + +Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011# +This is a bundle of X.509 certificates of public Certificate Authorities +(CA). These were automatically extracted from Mozilla's root certificates +file (certdata.txt). This file can be found in the mozilla source tree: +https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt +It contains the certificates in PEM format and therefore +can be directly used with curl / libcurl / php_curl, or with +an Apache+mod_ssl webserver for SSL client authentication. +Just configure this file as the SSLCACertificateFile.# + +***** BEGIN LICENSE BLOCK ***** +This Source Code Form is subject to the terms of the Mozilla Public License, +v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain +one at http://mozilla.org/MPL/2.0/. + +***** END LICENSE BLOCK ***** +@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $ diff --git a/requests/python/certifi-2023.7.22.dist-info/METADATA b/requests/python/certifi-2023.7.22.dist-info/METADATA new file mode 100644 index 0000000..07f4991 --- /dev/null +++ b/requests/python/certifi-2023.7.22.dist-info/METADATA @@ -0,0 +1,69 @@ +Metadata-Version: 2.1 +Name: certifi +Version: 2023.7.22 +Summary: Python package for providing Mozilla's CA Bundle. +Home-page: https://github.com/certifi/python-certifi +Author: Kenneth Reitz +Author-email: me@kennethreitz.com +License: MPL-2.0 +Project-URL: Source, https://github.com/certifi/python-certifi +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0) +Classifier: Natural Language :: English +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Requires-Python: >=3.6 +License-File: LICENSE + +Certifi: Python SSL Certificates +================================ + +Certifi provides Mozilla's carefully curated collection of Root Certificates for +validating the trustworthiness of SSL certificates while verifying the identity +of TLS hosts. It has been extracted from the `Requests`_ project. + +Installation +------------ + +``certifi`` is available on PyPI. Simply install it with ``pip``:: + + $ pip install certifi + +Usage +----- + +To reference the installed certificate authority (CA) bundle, you can use the +built-in function:: + + >>> import certifi + + >>> certifi.where() + '/usr/local/lib/python3.7/site-packages/certifi/cacert.pem' + +Or from the command line:: + + $ python -m certifi + /usr/local/lib/python3.7/site-packages/certifi/cacert.pem + +Enjoy! + +.. _`Requests`: https://requests.readthedocs.io/en/master/ + +Addition/Removal of Certificates +-------------------------------- + +Certifi does not support any addition/removal or other modification of the +CA trust store content. This project is intended to provide a reliable and +highly portable root of trust to python deployments. Look to upstream projects +for methods to use alternate trust. + + diff --git a/requests/python/certifi-2023.7.22.dist-info/RECORD b/requests/python/certifi-2023.7.22.dist-info/RECORD new file mode 100644 index 0000000..aabc30c --- /dev/null +++ b/requests/python/certifi-2023.7.22.dist-info/RECORD @@ -0,0 +1,14 @@ +certifi-2023.7.22.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +certifi-2023.7.22.dist-info/LICENSE,sha256=oC9sY4-fuE0G93ZMOrCF2K9-2luTwWbaVDEkeQd8b7A,1052 +certifi-2023.7.22.dist-info/METADATA,sha256=oyc8gd32SOVo0IGolt8-bR7FnZ9Z99GoHoGE6ACcvFA,2191 +certifi-2023.7.22.dist-info/RECORD,, +certifi-2023.7.22.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 +certifi-2023.7.22.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8 +certifi/__init__.py,sha256=L_j-d0kYuA_MzA2_2hraF1ovf6KT6DTquRdV3paQwOk,94 +certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243 +certifi/__pycache__/__init__.cpython-311.pyc,, +certifi/__pycache__/__main__.cpython-311.pyc,, +certifi/__pycache__/core.cpython-311.pyc,, +certifi/cacert.pem,sha256=eU0Dn_3yd8BH4m8sfVj4Glhl2KDrcCSg-sEWT-pNJ88,281617 +certifi/core.py,sha256=lhewz0zFb2b4ULsQurElmloYwQoecjWzPqY67P8T7iM,4219 +certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 diff --git a/requests/python/certifi-2023.7.22.dist-info/WHEEL b/requests/python/certifi-2023.7.22.dist-info/WHEEL new file mode 100644 index 0000000..5bad85f --- /dev/null +++ b/requests/python/certifi-2023.7.22.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.37.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/requests/python/certifi-2023.7.22.dist-info/top_level.txt b/requests/python/certifi-2023.7.22.dist-info/top_level.txt new file mode 100644 index 0000000..963eac5 --- /dev/null +++ b/requests/python/certifi-2023.7.22.dist-info/top_level.txt @@ -0,0 +1 @@ +certifi diff --git a/requests/python/certifi/__init__.py b/requests/python/certifi/__init__.py new file mode 100644 index 0000000..8ce89ce --- /dev/null +++ b/requests/python/certifi/__init__.py @@ -0,0 +1,4 @@ +from .core import contents, where + +__all__ = ["contents", "where"] +__version__ = "2023.07.22" diff --git a/requests/python/certifi/__main__.py b/requests/python/certifi/__main__.py new file mode 100644 index 0000000..8945b5d --- /dev/null +++ b/requests/python/certifi/__main__.py @@ -0,0 +1,12 @@ +import argparse + +from certifi import contents, where + +parser = argparse.ArgumentParser() +parser.add_argument("-c", "--contents", action="store_true") +args = parser.parse_args() + +if args.contents: + print(contents()) +else: + print(where()) diff --git a/requests/python/certifi/__pycache__/__init__.cpython-311.pyc b/requests/python/certifi/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..5f757ec Binary files /dev/null and b/requests/python/certifi/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/certifi/__pycache__/__main__.cpython-311.pyc b/requests/python/certifi/__pycache__/__main__.cpython-311.pyc new file mode 100644 index 0000000..08f8bd2 Binary files /dev/null and b/requests/python/certifi/__pycache__/__main__.cpython-311.pyc differ diff --git a/requests/python/certifi/__pycache__/core.cpython-311.pyc b/requests/python/certifi/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..5beb895 Binary files /dev/null and b/requests/python/certifi/__pycache__/core.cpython-311.pyc differ diff --git a/requests/python/certifi/cacert.pem b/requests/python/certifi/cacert.pem new file mode 100644 index 0000000..0212369 --- /dev/null +++ b/requests/python/certifi/cacert.pem @@ -0,0 +1,4635 @@ + +# Issuer: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA +# Subject: CN=GlobalSign Root CA O=GlobalSign nv-sa OU=Root CA +# Label: "GlobalSign Root CA" +# Serial: 4835703278459707669005204 +# MD5 Fingerprint: 3e:45:52:15:09:51:92:e1:b7:5d:37:9f:b1:87:29:8a +# SHA1 Fingerprint: b1:bc:96:8b:d4:f4:9d:62:2a:a8:9a:81:f2:15:01:52:a4:1d:82:9c +# SHA256 Fingerprint: eb:d4:10:40:e4:bb:3e:c7:42:c9:e3:81:d3:1e:f2:a4:1a:48:b6:68:5c:96:e7:ce:f3:c1:df:6c:d4:33:1c:99 +-----BEGIN CERTIFICATE----- +MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG +A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv +b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw +MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i +YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT +aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ +jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp +xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp +1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG +snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ +U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 +9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E +BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B +AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz +yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE +38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP +AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad +DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME +HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== +-----END CERTIFICATE----- + +# Issuer: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited +# Subject: CN=Entrust.net Certification Authority (2048) O=Entrust.net OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/(c) 1999 Entrust.net Limited +# Label: "Entrust.net Premium 2048 Secure Server CA" +# Serial: 946069240 +# MD5 Fingerprint: ee:29:31:bc:32:7e:9a:e6:e8:b5:f7:51:b4:34:71:90 +# SHA1 Fingerprint: 50:30:06:09:1d:97:d4:f5:ae:39:f7:cb:e7:92:7d:7d:65:2d:34:31 +# SHA256 Fingerprint: 6d:c4:71:72:e0:1c:bc:b0:bf:62:58:0d:89:5f:e2:b8:ac:9a:d4:f8:73:80:1e:0c:10:b9:c8:37:d2:1e:b1:77 +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 +MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq +K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe +sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX +MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT +XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ +HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH +4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub +j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo +U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf +zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b +u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ +bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er +fF6adulZkMV8gzURZVE= +-----END CERTIFICATE----- + +# Issuer: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust +# Subject: CN=Baltimore CyberTrust Root O=Baltimore OU=CyberTrust +# Label: "Baltimore CyberTrust Root" +# Serial: 33554617 +# MD5 Fingerprint: ac:b6:94:a5:9c:17:e0:d7:91:52:9b:b1:97:06:a6:e4 +# SHA1 Fingerprint: d4:de:20:d0:5e:66:fc:53:fe:1a:50:88:2c:78:db:28:52:ca:e4:74 +# SHA256 Fingerprint: 16:af:57:a9:f6:76:b0:ab:12:60:95:aa:5e:ba:de:f2:2a:b3:11:19:d6:44:ac:95:cd:4b:93:db:f3:f2:6a:eb +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ +RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD +VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX +DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y +ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy +VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr +mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr +IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK +mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu +XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy +dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye +jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 +BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 +DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 +9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx +jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 +Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz +ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS +R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. +# Subject: CN=Entrust Root Certification Authority O=Entrust, Inc. OU=www.entrust.net/CPS is incorporated by reference/(c) 2006 Entrust, Inc. +# Label: "Entrust Root Certification Authority" +# Serial: 1164660820 +# MD5 Fingerprint: d6:a5:c3:ed:5d:dd:3e:00:c1:3d:87:92:1f:1d:3f:e4 +# SHA1 Fingerprint: b3:1e:b1:b7:40:e3:6c:84:02:da:dc:37:d4:4d:f5:d4:67:49:52:f9 +# SHA256 Fingerprint: 73:c1:76:43:4f:1b:c6:d5:ad:f4:5b:0e:76:e7:27:28:7c:8d:e5:76:16:c1:e6:e6:14:1a:2b:2c:bc:7d:8e:4c +-----BEGIN CERTIFICATE----- +MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 +Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW +KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl +cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw +NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw +NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy +ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV +BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo +Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 +4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 +KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI +rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi +94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB +sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi +gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo +kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE +vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA +A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t +O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua +AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP +9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ +eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m +0vdXcDazv/wor3ElhVsT/h5/WrQ8 +-----END CERTIFICATE----- + +# Issuer: CN=AAA Certificate Services O=Comodo CA Limited +# Subject: CN=AAA Certificate Services O=Comodo CA Limited +# Label: "Comodo AAA Services root" +# Serial: 1 +# MD5 Fingerprint: 49:79:04:b0:eb:87:19:ac:47:b0:bc:11:51:9b:74:d0 +# SHA1 Fingerprint: d1:eb:23:a4:6d:17:d6:8f:d9:25:64:c2:f1:f1:60:17:64:d8:e3:49 +# SHA256 Fingerprint: d7:a7:a0:fb:5d:7e:27:31:d7:71:e9:48:4e:bc:de:f7:1d:5f:0c:3e:0a:29:48:78:2b:c8:3e:e0:ea:69:9e:f4 +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj +YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM +GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua +BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe +3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 +YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR +rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm +ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU +oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v +QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t +b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF +AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q +GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz +Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 +G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi +l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 +smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 2 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 2 O=QuoVadis Limited +# Label: "QuoVadis Root CA 2" +# Serial: 1289 +# MD5 Fingerprint: 5e:39:7b:dd:f8:ba:ec:82:e9:ac:62:ba:0c:54:00:2b +# SHA1 Fingerprint: ca:3a:fb:cf:12:40:36:4b:44:b2:16:20:88:80:48:39:19:93:7c:f7 +# SHA256 Fingerprint: 85:a0:dd:7d:d7:20:ad:b7:ff:05:f8:3d:54:2b:20:9d:c7:ff:45:28:f7:d6:77:b1:83:89:fe:a5:e5:c4:9e:86 +-----BEGIN CERTIFICATE----- +MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa +GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg +Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J +WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB +rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp ++ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 +ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i +Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz +PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og +/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH +oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI +yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud +EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 +A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL +MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT +ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f +BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn +g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl +fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K +WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha +B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc +hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR +TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD +mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z +ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y +4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza +8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 3" +# Serial: 1478 +# MD5 Fingerprint: 31:85:3c:62:94:97:63:b9:aa:fd:89:4e:af:6f:e0:cf +# SHA1 Fingerprint: 1f:49:14:f7:d8:74:95:1d:dd:ae:02:c0:be:fd:3a:2d:82:75:51:85 +# SHA256 Fingerprint: 18:f1:fc:7f:20:5d:f8:ad:dd:eb:7f:e0:07:dd:57:e3:af:37:5a:9c:4d:8d:73:54:6b:f4:f1:fe:d1:e1:8d:35 +-----BEGIN CERTIFICATE----- +MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x +GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv +b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV +BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W +YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM +V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB +4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr +H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd +8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv +vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT +mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe +btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc +T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt +WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ +c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A +4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD +VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG +CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 +aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 +aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu +dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw +czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G +A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC +TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg +Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 +7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem +d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd ++LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B +4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN +t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x +DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 +k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s +zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j +Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT +mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK +4SVhM7JZG+Ju1zdXtg2pEto= +-----END CERTIFICATE----- + +# Issuer: O=SECOM Trust.net OU=Security Communication RootCA1 +# Subject: O=SECOM Trust.net OU=Security Communication RootCA1 +# Label: "Security Communication Root CA" +# Serial: 0 +# MD5 Fingerprint: f1:bc:63:6a:54:e0:b5:27:f5:cd:e7:1a:e3:4d:6e:4a +# SHA1 Fingerprint: 36:b1:2b:49:f9:81:9e:d7:4c:9e:bc:38:0f:c6:56:8f:5d:ac:b2:f7 +# SHA256 Fingerprint: e7:5e:72:ed:9f:56:0e:ec:6e:b4:80:00:73:a4:3f:c3:ad:19:19:5a:39:22:82:01:78:95:97:4a:99:02:6b:6c +-----BEGIN CERTIFICATE----- +MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY +MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t +dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 +WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD +VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 +9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ +DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 +Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N +QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ +xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G +A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG +kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr +Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 +Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU +JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot +RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== +-----END CERTIFICATE----- + +# Issuer: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com +# Subject: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com +# Label: "XRamp Global CA Root" +# Serial: 107108908803651509692980124233745014957 +# MD5 Fingerprint: a1:0b:44:b3:ca:10:d8:00:6e:9d:0f:d8:0f:92:0a:d1 +# SHA1 Fingerprint: b8:01:86:d1:eb:9c:86:a5:41:04:cf:30:54:f3:4c:52:b7:e5:58:c6 +# SHA256 Fingerprint: ce:cd:dc:90:50:99:d8:da:df:c5:b1:d2:09:b7:37:cb:e2:c1:8c:fb:2c:10:c0:ff:0b:cf:0d:32:86:fc:1a:a2 +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB +gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk +MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY +UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx +NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 +dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy +dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 +38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP +KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q +DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 +qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa +JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi +PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P +BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs +jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 +eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD +ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR +vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt +qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa +IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy +i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ +O+7ETPTsJ3xCwnR8gooJybQDJbw= +-----END CERTIFICATE----- + +# Issuer: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority +# Subject: O=The Go Daddy Group, Inc. OU=Go Daddy Class 2 Certification Authority +# Label: "Go Daddy Class 2 CA" +# Serial: 0 +# MD5 Fingerprint: 91:de:06:25:ab:da:fd:32:17:0c:bb:25:17:2a:84:67 +# SHA1 Fingerprint: 27:96:ba:e6:3f:18:01:e2:77:26:1b:a0:d7:77:70:02:8f:20:ee:e4 +# SHA256 Fingerprint: c3:84:6b:f2:4b:9e:93:ca:64:27:4c:0e:c6:7c:1e:cc:5e:02:4f:fc:ac:d2:d7:40:19:35:0e:81:fe:54:6a:e4 +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh +MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE +YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 +MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo +ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg +MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN +ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA +PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w +wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi +EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY +avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ +YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE +sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h +/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 +IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD +ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy +OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P +TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER +dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf +ReYNnyicsbkqWletNw+vHX/bvZ8= +-----END CERTIFICATE----- + +# Issuer: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority +# Subject: O=Starfield Technologies, Inc. OU=Starfield Class 2 Certification Authority +# Label: "Starfield Class 2 CA" +# Serial: 0 +# MD5 Fingerprint: 32:4a:4b:bb:c8:63:69:9b:be:74:9a:c6:dd:1d:46:24 +# SHA1 Fingerprint: ad:7e:1c:28:b0:64:ef:8f:60:03:40:20:14:c3:d0:e3:37:0e:b5:8a +# SHA256 Fingerprint: 14:65:fa:20:53:97:b8:76:fa:a6:f0:a9:95:8e:55:90:e4:0f:cc:7f:aa:4f:b7:c2:c8:67:75:21:fb:5f:b6:58 +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl +MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp +U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw +NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE +ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp +ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 +DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf +8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN ++lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 +X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa +K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA +1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G +A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR +zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 +YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD +bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w +DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 +L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D +eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl +xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp +VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY +WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root CA" +# Serial: 17154717934120587862167794914071425081 +# MD5 Fingerprint: 87:ce:0b:7b:2a:0e:49:00:e1:58:71:9b:37:a8:93:72 +# SHA1 Fingerprint: 05:63:b8:63:0d:62:d7:5a:bb:c8:ab:1e:4b:df:b5:a8:99:b2:4d:43 +# SHA256 Fingerprint: 3e:90:99:b5:01:5e:8f:48:6c:00:bc:ea:9d:11:1e:e7:21:fa:ba:35:5a:89:bc:f1:df:69:56:1e:3d:c6:32:5c +-----BEGIN CERTIFICATE----- +MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c +JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP +mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ +wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 +VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ +AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB +AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun +pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC +dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf +fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm +NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx +H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe ++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root CA" +# Serial: 10944719598952040374951832963794454346 +# MD5 Fingerprint: 79:e4:a9:84:0d:7d:3a:96:d7:c0:4f:e2:43:4c:89:2e +# SHA1 Fingerprint: a8:98:5d:3a:65:e5:e5:c4:b2:d7:d6:6d:40:c6:dd:2f:b1:9c:54:36 +# SHA256 Fingerprint: 43:48:a0:e9:44:4c:78:cb:26:5e:05:8d:5e:89:44:b4:d8:4f:96:62:bd:26:db:25:7f:89:34:a4:43:c7:01:61 +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert High Assurance EV Root CA O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert High Assurance EV Root CA" +# Serial: 3553400076410547919724730734378100087 +# MD5 Fingerprint: d4:74:de:57:5c:39:b2:d3:9c:85:83:c5:c0:65:49:8a +# SHA1 Fingerprint: 5f:b7:ee:06:33:e2:59:db:ad:0c:4c:9a:e6:d3:8f:1a:61:c7:dc:25 +# SHA256 Fingerprint: 74:31:e5:f4:c3:c1:ce:46:90:77:4f:0b:61:e0:54:40:88:3b:a9:a0:1e:d0:0b:a6:ab:d7:80:6e:d3:b1:18:cf +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j +ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL +MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 +LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug +RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm ++9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW +PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM +xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB +Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 +hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg +EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA +FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec +nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z +eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF +hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 +Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe +vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep ++OkuE6N36B9K +-----END CERTIFICATE----- + +# Issuer: CN=SwissSign Gold CA - G2 O=SwissSign AG +# Subject: CN=SwissSign Gold CA - G2 O=SwissSign AG +# Label: "SwissSign Gold CA - G2" +# Serial: 13492815561806991280 +# MD5 Fingerprint: 24:77:d9:a8:91:d1:3b:fa:88:2d:c2:ff:f8:cd:33:93 +# SHA1 Fingerprint: d8:c5:38:8a:b7:30:1b:1b:6e:d4:7a:e6:45:25:3a:6f:9f:1a:27:61 +# SHA256 Fingerprint: 62:dd:0b:e9:b9:f5:0a:16:3e:a0:f8:e7:5c:05:3b:1e:ca:57:ea:55:c8:68:8f:64:7c:68:81:f2:c8:35:7b:95 +-----BEGIN CERTIFICATE----- +MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln +biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF +MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT +d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 +76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ +bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c +6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE +emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd +MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt +MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y +MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y +FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi +aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM +gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB +qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 +lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn +8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov +L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 +45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO +UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 +O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC +bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv +GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a +77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC +hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 +92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp +Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w +ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt +Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ +-----END CERTIFICATE----- + +# Issuer: CN=SwissSign Silver CA - G2 O=SwissSign AG +# Subject: CN=SwissSign Silver CA - G2 O=SwissSign AG +# Label: "SwissSign Silver CA - G2" +# Serial: 5700383053117599563 +# MD5 Fingerprint: e0:06:a1:c9:7d:cf:c9:fc:0d:c0:56:75:96:d8:62:13 +# SHA1 Fingerprint: 9b:aa:e5:9f:56:ee:21:cb:43:5a:be:25:93:df:a7:f0:40:d1:1d:cb +# SHA256 Fingerprint: be:6c:4d:a2:bb:b9:ba:59:b6:f3:93:97:68:37:42:46:c3:c0:05:99:3f:a9:8f:02:0d:1d:ed:be:d4:8a:81:d5 +-----BEGIN CERTIFICATE----- +MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE +BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu +IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow +RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY +U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv +Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br +YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF +nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH +6ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt +eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/ +c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ +MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH +HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf +jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6 +5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB +rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU +F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c +wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 +cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB +AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp +WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9 +xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ +2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ +IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8 +aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X +em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR +dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/ +OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+ +hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy +tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u +-----END CERTIFICATE----- + +# Issuer: CN=SecureTrust CA O=SecureTrust Corporation +# Subject: CN=SecureTrust CA O=SecureTrust Corporation +# Label: "SecureTrust CA" +# Serial: 17199774589125277788362757014266862032 +# MD5 Fingerprint: dc:32:c3:a7:6d:25:57:c7:68:09:9d:ea:2d:a9:a2:d1 +# SHA1 Fingerprint: 87:82:c6:c3:04:35:3b:cf:d2:96:92:d2:59:3e:7d:44:d9:34:ff:11 +# SHA256 Fingerprint: f1:c1:b5:0a:e5:a2:0d:d8:03:0e:c9:f6:bc:24:82:3d:d3:67:b5:25:57:59:b4:e7:1b:61:fc:e9:f7:37:5d:73 +-----BEGIN CERTIFICATE----- +MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz +MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv +cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz +Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO +0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao +wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj +7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS +8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT +BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg +JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC +NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 +6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ +3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm +D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS +CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR +3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= +-----END CERTIFICATE----- + +# Issuer: CN=Secure Global CA O=SecureTrust Corporation +# Subject: CN=Secure Global CA O=SecureTrust Corporation +# Label: "Secure Global CA" +# Serial: 9751836167731051554232119481456978597 +# MD5 Fingerprint: cf:f4:27:0d:d4:ed:dc:65:16:49:6d:3d:da:bf:6e:de +# SHA1 Fingerprint: 3a:44:73:5a:e5:81:90:1f:24:86:61:46:1e:3b:9c:c4:5f:f5:3a:1b +# SHA256 Fingerprint: 42:00:f5:04:3a:c8:59:0e:bb:52:7d:20:9e:d1:50:30:29:fb:cb:d4:1c:a1:b5:06:ec:27:f1:5a:de:7d:ac:69 +-----BEGIN CERTIFICATE----- +MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK +MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x +GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx +MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg +Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ +iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa +/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ +jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI +HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 +sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w +gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw +KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG +AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L +URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO +H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm +I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY +iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc +f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW +-----END CERTIFICATE----- + +# Issuer: CN=COMODO Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO Certification Authority O=COMODO CA Limited +# Label: "COMODO Certification Authority" +# Serial: 104350513648249232941998508985834464573 +# MD5 Fingerprint: 5c:48:dc:f7:42:72:ec:56:94:6d:1c:cc:71:35:80:75 +# SHA1 Fingerprint: 66:31:bf:9e:f7:4f:9e:b6:c9:d5:a6:0c:ba:6a:be:d1:f7:bd:ef:7b +# SHA256 Fingerprint: 0c:2c:d6:3d:f7:80:6f:a3:99:ed:e8:09:11:6b:57:5b:f8:79:89:f0:65:18:f9:80:8c:86:05:03:17:8b:af:66 +-----BEGIN CERTIFICATE----- +MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB +gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV +BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw +MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl +YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P +RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 +UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI +2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 +Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp ++2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ +DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O +nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW +/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g +PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u +QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY +SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv +IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ +RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 +zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd +BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB +ZQ== +-----END CERTIFICATE----- + +# Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited +# Label: "COMODO ECC Certification Authority" +# Serial: 41578283867086692638256921589707938090 +# MD5 Fingerprint: 7c:62:ff:74:9d:31:53:5e:68:4a:d5:78:aa:1e:bf:23 +# SHA1 Fingerprint: 9f:74:4e:9f:2b:4d:ba:ec:0f:31:2c:50:b6:56:3b:8e:2d:93:c3:11 +# SHA256 Fingerprint: 17:93:92:7a:06:14:54:97:89:ad:ce:2f:8f:34:f7:f0:b6:6d:0f:3a:e3:a3:b8:4d:21:ec:15:db:ba:4f:ad:c7 +-----BEGIN CERTIFICATE----- +MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT +IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwMzA2MDAw +MDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy +ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N +T0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSR +FtSrYpn1PlILBs5BAH+X4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0J +cfRK9ChQtP6IHG4/bC8vCVlbpVsLM5niwz2J+Wos77LTBumjQjBAMB0GA1UdDgQW +BBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VGFAkK+qDm +fQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdv +GDeAU/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= +-----END CERTIFICATE----- + +# Issuer: CN=Certigna O=Dhimyotis +# Subject: CN=Certigna O=Dhimyotis +# Label: "Certigna" +# Serial: 18364802974209362175 +# MD5 Fingerprint: ab:57:a6:5b:7d:42:82:19:b5:d8:58:26:28:5e:fd:ff +# SHA1 Fingerprint: b1:2e:13:63:45:86:a4:6f:1a:b2:60:68:37:58:2d:c4:ac:fd:94:97 +# SHA256 Fingerprint: e3:b6:a2:db:2e:d7:ce:48:84:2f:7a:c5:32:41:c7:b7:1d:54:14:4b:fb:40:c1:1f:3f:1d:0b:42:f5:ee:a1:2d +-----BEGIN CERTIFICATE----- +MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV +BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X +DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ +BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 +QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny +gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw +zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q +130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 +JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw +DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw +ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT +AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj +AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG +9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h +bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc +fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu +HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w +t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw +WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== +-----END CERTIFICATE----- + +# Issuer: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority +# Subject: O=Chunghwa Telecom Co., Ltd. OU=ePKI Root Certification Authority +# Label: "ePKI Root Certification Authority" +# Serial: 28956088682735189655030529057352760477 +# MD5 Fingerprint: 1b:2e:00:ca:26:06:90:3d:ad:fe:6f:15:68:d3:6b:b3 +# SHA1 Fingerprint: 67:65:0d:f1:7e:8e:7e:5b:82:40:a4:f4:56:4b:cf:e2:3d:69:c6:f0 +# SHA256 Fingerprint: c0:a6:f4:dc:63:a2:4b:fd:cf:54:ef:2a:6a:08:2a:0a:72:de:35:80:3e:2f:f5:ff:52:7a:e5:d8:72:06:df:d5 +-----BEGIN CERTIFICATE----- +MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe +MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 +ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe +Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw +IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL +SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH +SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh +ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X +DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 +TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ +fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA +sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU +WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS +nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH +dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip +NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC +AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF +MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH +ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB +uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl +PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP +JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ +gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 +j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 +5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB +o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS +/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z +Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE +W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D +hNQ+IIX3Sj0rnP0qCglN6oH4EZw= +-----END CERTIFICATE----- + +# Issuer: O=certSIGN OU=certSIGN ROOT CA +# Subject: O=certSIGN OU=certSIGN ROOT CA +# Label: "certSIGN ROOT CA" +# Serial: 35210227249154 +# MD5 Fingerprint: 18:98:c0:d6:e9:3a:fc:f9:b0:f5:0c:f7:4b:01:44:17 +# SHA1 Fingerprint: fa:b7:ee:36:97:26:62:fb:2d:b0:2a:f6:bf:03:fd:e8:7c:4b:2f:9b +# SHA256 Fingerprint: ea:a9:62:c4:fa:4a:6b:af:eb:e4:15:19:6d:35:1c:cd:88:8d:4f:53:f3:fa:8a:e6:d7:c4:66:a9:4e:60:42:bb +-----BEGIN CERTIFICATE----- +MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT +AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD +QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP +MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do +0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ +UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d +RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ +OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv +JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C +AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O +BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ +LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY +MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ +44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I +Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw +i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN +9u6wWk5JRFRYX0KD +-----END CERTIFICATE----- + +# Issuer: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) +# Subject: CN=NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny O=NetLock Kft. OU=Tan\xfas\xedtv\xe1nykiad\xf3k (Certification Services) +# Label: "NetLock Arany (Class Gold) F\u0151tan\xfas\xedtv\xe1ny" +# Serial: 80544274841616 +# MD5 Fingerprint: c5:a1:b7:ff:73:dd:d6:d7:34:32:18:df:fc:3c:ad:88 +# SHA1 Fingerprint: 06:08:3f:59:3f:15:a1:04:a0:69:a4:6b:a9:03:d0:06:b7:97:09:91 +# SHA256 Fingerprint: 6c:61:da:c3:a2:de:f0:31:50:6b:e0:36:d2:a6:fe:40:19:94:fb:d1:3d:f9:c8:d4:66:59:92:74:c4:46:ec:98 +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG +EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 +MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl +cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR +dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB +pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM +b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm +aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz +IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT +lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz +AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 +VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG +ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 +BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG +AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M +U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh +bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C ++C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC +bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F +uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 +XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= +-----END CERTIFICATE----- + +# Issuer: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. +# Subject: CN=SecureSign RootCA11 O=Japan Certification Services, Inc. +# Label: "SecureSign RootCA11" +# Serial: 1 +# MD5 Fingerprint: b7:52:74:e2:92:b4:80:93:f2:75:e4:cc:d7:f2:ea:26 +# SHA1 Fingerprint: 3b:c4:9f:48:f8:f3:73:a0:9c:1e:bd:f8:5b:b1:c3:65:c7:d8:11:b3 +# SHA256 Fingerprint: bf:0f:ee:fb:9e:3a:58:1a:d5:f9:e9:db:75:89:98:57:43:d2:61:08:5c:4d:31:4f:6f:5d:72:59:aa:42:16:12 +-----BEGIN CERTIFICATE----- +MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDEr +MCkGA1UEChMiSmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoG +A1UEAxMTU2VjdXJlU2lnbiBSb290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0 +MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSswKQYDVQQKEyJKYXBhbiBDZXJ0aWZp +Y2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1cmVTaWduIFJvb3RD +QTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvLTJsz +i1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8 +h9uuywGOwvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOV +MdrAG/LuYpmGYz+/3ZMqg6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9 +UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rPO7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni +8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitAbpSACW22s293bzUIUPsC +h8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZXt94wDgYD +VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB +AKChOBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xm +KbabfSVSSUOrTC4rbnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQ +X5Ucv+2rIrVls4W6ng+4reV6G4pQOh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWr +QbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01y8hSyn+B/tlr0/cR7SXf+Of5 +pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061lgeLKBObjBmN +QSdJQO7e5iNEOdyhIta6A/I= +-----END CERTIFICATE----- + +# Issuer: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. +# Subject: CN=Microsec e-Szigno Root CA 2009 O=Microsec Ltd. +# Label: "Microsec e-Szigno Root CA 2009" +# Serial: 14014712776195784473 +# MD5 Fingerprint: f8:49:f4:03:bc:44:2d:83:be:48:69:7d:29:64:fc:b1 +# SHA1 Fingerprint: 89:df:74:fe:5c:f4:0f:4a:80:f9:e3:37:7d:54:da:91:e1:01:31:8e +# SHA256 Fingerprint: 3c:5f:81:fe:a5:fa:b8:2c:64:bf:a2:ea:ec:af:cd:e8:e0:77:fc:86:20:a7:ca:e5:37:16:3d:f3:6e:db:f3:78 +-----BEGIN CERTIFICATE----- +MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD +VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 +ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G +CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y +OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx +FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp +Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o +dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP +kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc +cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U +fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 +N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC +xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 ++rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM +Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG +SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h +mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk +ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 +tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c +2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t +HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R3 +# Label: "GlobalSign Root CA - R3" +# Serial: 4835703278459759426209954 +# MD5 Fingerprint: c5:df:b8:49:ca:05:13:55:ee:2d:ba:1a:c3:3e:b0:28 +# SHA1 Fingerprint: d6:9b:56:11:48:f0:1c:77:c5:45:78:c1:09:26:df:5b:85:69:76:ad +# SHA256 Fingerprint: cb:b5:22:d7:b7:f1:27:ad:6a:01:13:86:5b:df:1c:d4:10:2e:7d:07:59:af:63:5a:7c:f4:72:0d:c9:63:c5:3b +-----BEGIN CERTIFICATE----- +MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G +A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp +Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 +MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG +A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 +RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT +gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm +KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd +QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ +XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw +DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o +LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU +RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp +jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK +6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX +mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs +Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH +WD9f +-----END CERTIFICATE----- + +# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" +# Serial: 6047274297262753887 +# MD5 Fingerprint: 73:3a:74:7a:ec:bb:a3:96:a6:c2:e4:e2:c8:9b:c0:c3 +# SHA1 Fingerprint: ae:c5:fb:3f:c8:e1:bf:c4:e5:4f:03:07:5a:9a:e8:00:b7:f7:b6:fa +# SHA256 Fingerprint: 04:04:80:28:bf:1f:28:64:d4:8f:9a:d4:d8:32:94:36:6a:82:88:56:55:3f:3b:14:30:3f:90:14:7f:5d:40:ef +-----BEGIN CERTIFICATE----- +MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UE +BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h +cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEy +MzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg +Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 +thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM +cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG +L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i +NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h +X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b +m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy +Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja +EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T +KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF +6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh +OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNHDhpkLzCBpgYD +VR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp +cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBv +ACAAZABlACAAbABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBl +AGwAbwBuAGEAIAAwADgAMAAxADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF +661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx51tkljYyGOylMnfX40S2wBEqgLk9 +am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qkR71kMrv2JYSiJ0L1 +ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaPT481 +PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS +3a/DTg4fJl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5k +SeTy36LssUzAKh3ntLFlosS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF +3dvd6qJ2gHN99ZwExEWN57kci57q13XRcrHedUTnQn3iV2t93Jm8PYMo6oCTjcVM +ZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoRsaS8I8nkvof/uZS2+F0g +StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz +Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB +jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V +-----END CERTIFICATE----- + +# Issuer: CN=Izenpe.com O=IZENPE S.A. +# Subject: CN=Izenpe.com O=IZENPE S.A. +# Label: "Izenpe.com" +# Serial: 917563065490389241595536686991402621 +# MD5 Fingerprint: a6:b0:cd:85:80:da:5c:50:34:a3:39:90:2f:55:67:73 +# SHA1 Fingerprint: 2f:78:3d:25:52:18:a7:4a:65:39:71:b5:2c:a2:9c:45:15:6f:e9:19 +# SHA256 Fingerprint: 25:30:cc:8e:98:32:15:02:ba:d9:6f:9b:1f:ba:1b:09:9e:2d:29:9e:0f:45:48:bb:91:4f:36:3b:c0:d4:53:1f +-----BEGIN CERTIFICATE----- +MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 +MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 +ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD +VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j +b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq +scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO +xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H +LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX +uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD +yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ +JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q +rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN +BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L +hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB +QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ +HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu +Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg +QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB +BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx +MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA +A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb +laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 +awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo +JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw +LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT +VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk +LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb +UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ +QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ +naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls +QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== +-----END CERTIFICATE----- + +# Issuer: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. +# Subject: CN=Go Daddy Root Certificate Authority - G2 O=GoDaddy.com, Inc. +# Label: "Go Daddy Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: 80:3a:bc:22:c1:e6:fb:8d:9b:3b:27:4a:32:1b:9a:01 +# SHA1 Fingerprint: 47:be:ab:c9:22:ea:e8:0e:78:78:34:62:a7:9f:45:c2:54:fd:e6:8b +# SHA256 Fingerprint: 45:14:0b:32:47:eb:9c:c8:c5:b4:f0:d7:b5:30:91:f7:32:92:08:9e:6e:5a:63:e2:74:9d:d3:ac:a9:19:8e:da +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT +EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp +ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz +NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH +EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE +AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD +E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH +/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy +DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh +GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR +tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA +AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX +WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu +9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr +gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo +2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO +LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI +4uJEvlz36hz1 +-----END CERTIFICATE----- + +# Issuer: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Subject: CN=Starfield Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Label: "Starfield Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: d6:39:81:c6:52:7e:96:69:fc:fc:ca:66:ed:05:f2:96 +# SHA1 Fingerprint: b5:1c:06:7c:ee:2b:0c:3d:f8:55:ab:2d:92:f4:fe:39:d4:e7:0f:0e +# SHA256 Fingerprint: 2c:e1:cb:0b:f9:d2:f9:e1:02:99:3f:be:21:51:52:c3:b2:dd:0c:ab:de:1c:68:e5:31:9b:83:91:54:db:b7:f5 +-----BEGIN CERTIFICATE----- +MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT +HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs +ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw +MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 +b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj +aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp +Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg +nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 +HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N +Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN +dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 +HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO +BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G +CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU +sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 +4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg +8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K +pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 +mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 +-----END CERTIFICATE----- + +# Issuer: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Subject: CN=Starfield Services Root Certificate Authority - G2 O=Starfield Technologies, Inc. +# Label: "Starfield Services Root Certificate Authority - G2" +# Serial: 0 +# MD5 Fingerprint: 17:35:74:af:7b:61:1c:eb:f4:f9:3c:e2:ee:40:f9:a2 +# SHA1 Fingerprint: 92:5a:8f:8d:2c:6d:04:e0:66:5f:59:6a:ff:22:d8:63:e8:25:6f:3f +# SHA256 Fingerprint: 56:8d:69:05:a2:c8:87:08:a4:b3:02:51:90:ed:cf:ed:b1:97:4a:60:6a:13:c6:e5:29:0f:cb:2a:e6:3e:da:b5 +-----BEGIN CERTIFICATE----- +MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT +HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs +ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 +MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy +ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy +dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p +OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 +8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K +Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe +hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk +6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw +DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q +AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI +bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB +ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z +qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd +iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn +0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN +sSi6 +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Commercial O=AffirmTrust +# Subject: CN=AffirmTrust Commercial O=AffirmTrust +# Label: "AffirmTrust Commercial" +# Serial: 8608355977964138876 +# MD5 Fingerprint: 82:92:ba:5b:ef:cd:8a:6f:a6:3d:55:f9:84:f6:d6:b7 +# SHA1 Fingerprint: f9:b5:b6:32:45:5f:9c:be:ec:57:5f:80:dc:e9:6e:2c:c7:b2:78:b7 +# SHA256 Fingerprint: 03:76:ab:1d:54:c5:f9:80:3c:e4:b2:e2:01:a0:ee:7e:ef:7b:57:b6:36:e8:a9:3c:9b:8d:48:60:c9:6f:5f:a7 +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz +dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL +MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp +cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP +Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr +ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL +MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1 +yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr +VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/ +nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ +KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG +XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj +vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt +Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g +N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC +nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Networking O=AffirmTrust +# Subject: CN=AffirmTrust Networking O=AffirmTrust +# Label: "AffirmTrust Networking" +# Serial: 8957382827206547757 +# MD5 Fingerprint: 42:65:ca:be:01:9a:9a:4c:a9:8c:41:49:cd:c0:d5:7f +# SHA1 Fingerprint: 29:36:21:02:8b:20:ed:02:f5:66:c5:32:d1:d6:ed:90:9f:45:00:2f +# SHA256 Fingerprint: 0a:81:ec:5a:92:97:77:f1:45:90:4a:f3:8d:5d:50:9f:66:b5:e2:c5:8f:cd:b5:31:05:8b:0e:17:f3:f0:b4:1b +-----BEGIN CERTIFICATE----- +MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz +dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL +MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp +cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y +YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua +kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL +QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp +6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG +yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i +QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ +KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO +tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu +QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ +Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u +olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 +x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Premium O=AffirmTrust +# Subject: CN=AffirmTrust Premium O=AffirmTrust +# Label: "AffirmTrust Premium" +# Serial: 7893706540734352110 +# MD5 Fingerprint: c4:5d:0e:48:b6:ac:28:30:4e:0a:bc:f9:38:16:87:57 +# SHA1 Fingerprint: d8:a6:33:2c:e0:03:6f:b1:85:f6:63:4f:7d:6a:06:65:26:32:28:27 +# SHA256 Fingerprint: 70:a7:3f:7f:37:6b:60:07:42:48:90:45:34:b1:14:82:d5:bf:0e:69:8e:cc:49:8d:f5:25:77:eb:f2:e9:3b:9a +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE +BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz +dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG +A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U +cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf +qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ +JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ ++jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS +s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5 +HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7 +70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG +V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S +qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S +5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia +C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX +OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE +FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ +BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2 +KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg +Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B +8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ +MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc +0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ +u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF +u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH +YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 +GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO +RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e +KeC2uAloGRwYQw== +-----END CERTIFICATE----- + +# Issuer: CN=AffirmTrust Premium ECC O=AffirmTrust +# Subject: CN=AffirmTrust Premium ECC O=AffirmTrust +# Label: "AffirmTrust Premium ECC" +# Serial: 8401224907861490260 +# MD5 Fingerprint: 64:b0:09:55:cf:b1:d5:99:e2:be:13:ab:a6:5d:ea:4d +# SHA1 Fingerprint: b8:23:6b:00:2f:1d:16:86:53:01:55:6c:11:a4:37:ca:eb:ff:c3:bb +# SHA256 Fingerprint: bd:71:fd:f6:da:97:e4:cf:62:d1:64:7a:dd:25:81:b0:7d:79:ad:f8:39:7e:b4:ec:ba:9c:5e:84:88:82:14:23 +-----BEGIN CERTIFICATE----- +MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC +VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ +cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ +BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt +VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D +0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 +ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G +A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G +A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs +aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I +flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Network CA O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Network CA" +# Serial: 279744 +# MD5 Fingerprint: d5:e9:81:40:c5:18:69:fc:46:2c:89:75:62:0f:aa:78 +# SHA1 Fingerprint: 07:e0:32:e0:20:b7:2c:3f:19:2f:06:28:a2:59:3a:19:a7:0f:06:9e +# SHA256 Fingerprint: 5c:58:46:8d:55:f5:8e:49:7e:74:39:82:d2:b5:00:10:b6:d1:65:37:4a:cf:83:a7:d4:a3:2d:b7:68:c4:40:8e +-----BEGIN CERTIFICATE----- +MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM +MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D +ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU +cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 +WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg +Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw +IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH +UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM +TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU +BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM +kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x +AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV +HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y +sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL +I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 +J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY +VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI +03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= +-----END CERTIFICATE----- + +# Issuer: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA +# Subject: CN=TWCA Root Certification Authority O=TAIWAN-CA OU=Root CA +# Label: "TWCA Root Certification Authority" +# Serial: 1 +# MD5 Fingerprint: aa:08:8f:f6:f9:7b:b7:f2:b1:a7:1e:9b:ea:ea:bd:79 +# SHA1 Fingerprint: cf:9e:87:6d:d3:eb:fc:42:26:97:a3:b5:a3:7a:a0:76:a9:06:23:48 +# SHA256 Fingerprint: bf:d8:8f:e1:10:1c:41:ae:3e:80:1b:f8:be:56:35:0e:e9:ba:d1:a6:b9:bd:51:5e:dc:5c:6d:5b:87:11:ac:44 +-----BEGIN CERTIFICATE----- +MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES +MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU +V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz +WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO +LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm +aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE +AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH +K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX +RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z +rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx +3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq +hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC +MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls +XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D +lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn +aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ +YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== +-----END CERTIFICATE----- + +# Issuer: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 +# Subject: O=SECOM Trust Systems CO.,LTD. OU=Security Communication RootCA2 +# Label: "Security Communication RootCA2" +# Serial: 0 +# MD5 Fingerprint: 6c:39:7d:a4:0e:55:59:b2:3f:d6:41:b1:12:50:de:43 +# SHA1 Fingerprint: 5f:3b:8c:f2:f8:10:b3:7d:78:b4:ce:ec:19:19:c3:73:34:b9:c7:74 +# SHA256 Fingerprint: 51:3b:2c:ec:b8:10:d4:cd:e5:dd:85:39:1a:df:c6:c2:dd:60:d8:7b:b7:36:d2:b5:21:48:4a:a4:7a:0e:be:f6 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl +MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe +U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX +DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy +dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj +YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV +OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr +zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM +VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ +hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO +ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw +awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs +OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 +DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF +coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc +okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 +t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy +1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ +SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 +-----END CERTIFICATE----- + +# Issuer: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 +# Subject: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967 +# Label: "Actalis Authentication Root CA" +# Serial: 6271844772424770508 +# MD5 Fingerprint: 69:c1:0d:4f:07:a3:1b:c3:fe:56:3d:04:bc:11:f6:a6 +# SHA1 Fingerprint: f3:73:b3:87:06:5a:28:84:8a:f2:f3:4a:ce:19:2b:dd:c7:8e:9c:ac +# SHA256 Fingerprint: 55:92:60:84:ec:96:3a:64:b9:6e:2a:be:01:ce:0b:a8:6a:64:fb:fe:bc:c7:aa:b5:af:c1:55:b3:7f:d7:60:66 +-----BEGIN CERTIFICATE----- +MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE +BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w +MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 +IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC +SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 +ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv +UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX +4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 +KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ +gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb +rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ +51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F +be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe +KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F +v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn +fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 +jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz +ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt +ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL +e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 +jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz +WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V +SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j +pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX +X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok +fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R +K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU +ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU +LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT +LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== +-----END CERTIFICATE----- + +# Issuer: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 +# Subject: CN=Buypass Class 2 Root CA O=Buypass AS-983163327 +# Label: "Buypass Class 2 Root CA" +# Serial: 2 +# MD5 Fingerprint: 46:a7:d2:fe:45:fb:64:5a:a8:59:90:9b:78:44:9b:29 +# SHA1 Fingerprint: 49:0a:75:74:de:87:0a:47:fe:58:ee:f6:c7:6b:eb:c6:0b:12:40:99 +# SHA256 Fingerprint: 9a:11:40:25:19:7c:5b:b9:5d:94:e6:3d:55:cd:43:79:08:47:b6:46:b2:3c:df:11:ad:a4:a0:0e:ff:15:fb:48 +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd +MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg +Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow +TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw +HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB +BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr +6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV +L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 +1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx +MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ +QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB +arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr +Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi +FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS +P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN +9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP +AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz +uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h +9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s +A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t +OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo ++fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 +KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 +DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us +H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ +I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 +5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h +3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz +Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= +-----END CERTIFICATE----- + +# Issuer: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 +# Subject: CN=Buypass Class 3 Root CA O=Buypass AS-983163327 +# Label: "Buypass Class 3 Root CA" +# Serial: 2 +# MD5 Fingerprint: 3d:3b:18:9e:2c:64:5a:e8:d5:88:ce:0e:f9:37:c2:ec +# SHA1 Fingerprint: da:fa:f7:fa:66:84:ec:06:8f:14:50:bd:c7:c2:81:a5:bc:a9:64:57 +# SHA256 Fingerprint: ed:f7:eb:bc:a2:7a:2a:38:4d:38:7b:7d:40:10:c6:66:e2:ed:b4:84:3e:4c:29:b4:ae:1d:5b:93:32:e6:b2:4d +-----BEGIN CERTIFICATE----- +MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd +MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg +Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow +TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw +HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB +BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y +ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E +N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 +tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX +0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c +/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X +KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY +zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS +O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D +34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP +K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 +AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv +Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj +QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV +cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS +IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 +HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa +O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv +033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u +dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE +kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 +3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD +u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq +4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= +-----END CERTIFICATE----- + +# Issuer: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Subject: CN=T-TeleSec GlobalRoot Class 3 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Label: "T-TeleSec GlobalRoot Class 3" +# Serial: 1 +# MD5 Fingerprint: ca:fb:40:a8:4e:39:92:8a:1d:fe:8e:2f:c4:27:ea:ef +# SHA1 Fingerprint: 55:a6:72:3e:cb:f2:ec:cd:c3:23:74:70:19:9d:2a:be:11:e3:81:d1 +# SHA256 Fingerprint: fd:73:da:d3:1c:64:4f:f1:b4:3b:ef:0c:cd:da:96:71:0b:9c:d9:87:5e:ca:7e:31:70:7a:f3:e9:6d:52:2b:bd +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx +KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd +BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl +YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 +OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy +aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 +ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN +8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ +RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 +hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 +ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM +EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 +A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy +WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ +1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 +6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT +91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml +e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p +TpPDpFQUWw== +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH +# Subject: CN=D-TRUST Root Class 3 CA 2 2009 O=D-Trust GmbH +# Label: "D-TRUST Root Class 3 CA 2 2009" +# Serial: 623603 +# MD5 Fingerprint: cd:e0:25:69:8d:47:ac:9c:89:35:90:f7:fd:51:3d:2f +# SHA1 Fingerprint: 58:e8:ab:b0:36:15:33:fb:80:f7:9b:1b:6d:29:d3:ff:8d:5f:00:f0 +# SHA256 Fingerprint: 49:e7:a4:42:ac:f0:ea:62:87:05:00:54:b5:25:64:b6:50:e4:f4:9e:42:e3:48:d6:aa:38:e0:39:e9:57:b1:c1 +-----BEGIN CERTIFICATE----- +MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF +MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD +bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha +ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM +HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 +UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 +tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R +ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM +lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp +/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G +A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G +A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj +dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy +MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl +cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js +L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL +BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni +acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 +o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K +zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 +PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y +Johw1+qRzT65ysCQblrGXnRl11z+o+I= +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH +# Subject: CN=D-TRUST Root Class 3 CA 2 EV 2009 O=D-Trust GmbH +# Label: "D-TRUST Root Class 3 CA 2 EV 2009" +# Serial: 623604 +# MD5 Fingerprint: aa:c6:43:2c:5e:2d:cd:c4:34:c0:50:4f:11:02:4f:b6 +# SHA1 Fingerprint: 96:c9:1b:0b:95:b4:10:98:42:fa:d0:d8:22:79:fe:60:fa:b9:16:83 +# SHA256 Fingerprint: ee:c5:49:6b:98:8c:e9:86:25:b9:34:09:2e:ec:29:08:be:d0:b0:f3:16:c2:d4:73:0c:84:ea:f1:f3:d3:48:81 +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF +MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD +bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw +NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV +BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn +ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 +3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z +qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR +p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 +HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw +ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea +HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw +Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh +c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E +RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt +dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku +Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp +3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 +nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF +CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na +xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX +KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 +-----END CERTIFICATE----- + +# Issuer: CN=CA Disig Root R2 O=Disig a.s. +# Subject: CN=CA Disig Root R2 O=Disig a.s. +# Label: "CA Disig Root R2" +# Serial: 10572350602393338211 +# MD5 Fingerprint: 26:01:fb:d8:27:a7:17:9a:45:54:38:1a:43:01:3b:03 +# SHA1 Fingerprint: b5:61:eb:ea:a4:de:e4:25:4b:69:1a:98:a5:57:47:c2:34:c7:d9:71 +# SHA256 Fingerprint: e2:3d:4a:03:6d:7b:70:e9:f5:95:b1:42:20:79:d2:b9:1e:df:bb:1f:b6:51:a0:63:3e:aa:8a:9d:c5:f8:07:03 +-----BEGIN CERTIFICATE----- +MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV +BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu +MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy +MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx +EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw +ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe +NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH +PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I +x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe +QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR +yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO +QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 +H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ +QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD +i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs +nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 +rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud +DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI +hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM +tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf +GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb +lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka ++elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal +TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i +nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 +gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr +G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os +zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x +L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL +-----END CERTIFICATE----- + +# Issuer: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV +# Subject: CN=ACCVRAIZ1 O=ACCV OU=PKIACCV +# Label: "ACCVRAIZ1" +# Serial: 6828503384748696800 +# MD5 Fingerprint: d0:a0:5a:ee:05:b6:09:94:21:a1:7d:f1:b2:29:82:02 +# SHA1 Fingerprint: 93:05:7a:88:15:c6:4f:ce:88:2f:fa:91:16:52:28:78:bc:53:64:17 +# SHA256 Fingerprint: 9a:6e:c0:12:e1:a7:da:9d:be:34:19:4d:47:8a:d7:c0:db:18:22:fb:07:1d:f1:29:81:49:6e:d1:04:38:41:13 +-----BEGIN CERTIFICATE----- +MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE +AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw +CQYDVQQGEwJFUzAeFw0xMTA1MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQ +BgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwHUEtJQUNDVjENMAsGA1UECgwEQUND +VjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCb +qau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gMjmoY +HtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWo +G2ioPej0RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpA +lHPrzg5XPAOBOp0KoVdDaaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhr +IA8wKFSVf+DuzgpmndFALW4ir50awQUZ0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/ +0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDGWuzndN9wrqODJerWx5eH +k6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs78yM2x/47 +4KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMO +m3WR5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpa +cXpkatcnYGMN285J9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPl +uUsXQA+xtrn13k/c4LOsOxFwYIRKQ26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYI +KwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRwOi8vd3d3LmFjY3YuZXMvZmls +ZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEuY3J0MB8GCCsG +AQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2 +VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeT +VfZW6oHlNsyMHj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIG +CCsGAQUFBwICMIIBFB6CARAAQQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUA +cgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBhAO0AegAgAGQAZQAgAGwAYQAgAEEA +QwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUAYwBuAG8AbABvAGcA +7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBjAHQA +cgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAA +QwBQAFMAIABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUA +czAwBggrBgEFBQcCARYkaHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2Mu +aHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRt +aW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2MV9kZXIuY3JsMA4GA1Ud +DwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZIhvcNAQEF +BQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdp +D70ER9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gU +JyCpZET/LtZ1qmxNYEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+m +AM/EKXMRNt6GGT6d7hmKG9Ww7Y49nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepD +vV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJTS+xJlsndQAJxGJ3KQhfnlms +tn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3sCPdK6jT2iWH +7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h +I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szA +h1xA2syVP1XgNce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xF +d3+YJ5oyXSrjhO7FmGYvliAd3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2H +pPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3pEfbRD0tVNEYqi4Y7 +-----END CERTIFICATE----- + +# Issuer: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA +# Subject: CN=TWCA Global Root CA O=TAIWAN-CA OU=Root CA +# Label: "TWCA Global Root CA" +# Serial: 3262 +# MD5 Fingerprint: f9:03:7e:cf:e6:9e:3c:73:7a:2a:90:07:69:ff:2b:96 +# SHA1 Fingerprint: 9c:bb:48:53:f6:a4:f6:d3:52:a4:e8:32:52:55:60:13:f5:ad:af:65 +# SHA256 Fingerprint: 59:76:90:07:f7:68:5d:0f:cd:50:87:2f:9f:95:d5:75:5a:5b:2b:45:7d:81:f3:69:2b:61:0a:98:67:2f:0e:1b +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx +EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT +VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 +NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT +B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF +10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz +0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh +MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH +zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc +46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 +yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi +laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP +oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA +BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE +qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm +4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL +1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn +LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF +H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo +RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ +nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh +15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW +6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW +nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j +wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz +aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy +KwbQBM0= +-----END CERTIFICATE----- + +# Issuer: CN=TeliaSonera Root CA v1 O=TeliaSonera +# Subject: CN=TeliaSonera Root CA v1 O=TeliaSonera +# Label: "TeliaSonera Root CA v1" +# Serial: 199041966741090107964904287217786801558 +# MD5 Fingerprint: 37:41:49:1b:18:56:9a:26:f5:ad:c2:66:fb:40:a5:4c +# SHA1 Fingerprint: 43:13:bb:96:f1:d5:86:9b:c1:4e:6a:92:f6:cf:f6:34:69:87:82:37 +# SHA256 Fingerprint: dd:69:36:fe:21:f8:f0:77:c1:23:a1:a5:21:c1:22:24:f7:22:55:b7:3e:03:a7:26:06:93:e8:a2:4b:0f:a3:89 +-----BEGIN CERTIFICATE----- +MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw +NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv +b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD +VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F +VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 +7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X +Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ +/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs +81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm +dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe +Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu +sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 +pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs +slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ +arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD +VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG +9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl +dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx +0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj +TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed +Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 +Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI +OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 +vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW +t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn +HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx +SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= +-----END CERTIFICATE----- + +# Issuer: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Subject: CN=T-TeleSec GlobalRoot Class 2 O=T-Systems Enterprise Services GmbH OU=T-Systems Trust Center +# Label: "T-TeleSec GlobalRoot Class 2" +# Serial: 1 +# MD5 Fingerprint: 2b:9b:9e:e4:7b:6c:1f:00:72:1a:cc:c1:77:79:df:6a +# SHA1 Fingerprint: 59:0d:2d:7d:88:4f:40:2e:61:7e:a5:62:32:17:65:cf:17:d8:94:e9 +# SHA256 Fingerprint: 91:e2:f5:78:8d:58:10:eb:a7:ba:58:73:7d:e1:54:8a:8e:ca:cd:01:45:98:bc:0b:14:3e:04:1b:17:05:25:52 +-----BEGIN CERTIFICATE----- +MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx +KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd +BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl +YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 +OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy +aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 +ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd +AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC +FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi +1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq +jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ +wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ +WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy +NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC +uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw +IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 +g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN +9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP +BSeOE6Fuwg== +-----END CERTIFICATE----- + +# Issuer: CN=Atos TrustedRoot 2011 O=Atos +# Subject: CN=Atos TrustedRoot 2011 O=Atos +# Label: "Atos TrustedRoot 2011" +# Serial: 6643877497813316402 +# MD5 Fingerprint: ae:b9:c4:32:4b:ac:7f:5d:66:cc:77:94:bb:2a:77:56 +# SHA1 Fingerprint: 2b:b1:f5:3e:55:0c:1d:c5:f1:d4:e6:b7:6a:46:4b:55:06:02:ac:21 +# SHA256 Fingerprint: f3:56:be:a2:44:b7:a9:1e:b3:5d:53:ca:9a:d7:86:4a:ce:01:8e:2d:35:d5:f8:f9:6d:df:68:a6:f4:1a:a4:74 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE +AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG +EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM +FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC +REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp +Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM +VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+ +SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ +4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L +cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi +eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV +HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG +A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3 +DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j +vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP +DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc +maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D +lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv +KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 1 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 1 G3" +# Serial: 687049649626669250736271037606554624078720034195 +# MD5 Fingerprint: a4:bc:5b:3f:fe:37:9a:fa:64:f0:e2:fa:05:3d:0b:ab +# SHA1 Fingerprint: 1b:8e:ea:57:96:29:1a:c9:39:ea:b8:0a:81:1a:73:73:c0:93:79:67 +# SHA256 Fingerprint: 8a:86:6f:d1:b2:76:b5:7e:57:8e:92:1c:65:82:8a:2b:ed:58:e9:f2:f2:88:05:41:34:b7:f1:f4:bf:c9:cc:74 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00 +MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakEPBtV +wedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWe +rNrwU8lmPNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF341 +68Xfuw6cwI2H44g4hWf6Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh +4Pw5qlPafX7PGglTvF0FBM+hSo+LdoINofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXp +UhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/lg6AnhF4EwfWQvTA9xO+o +abw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV7qJZjqlc +3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/G +KubX9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSt +hfbZxbGL0eUQMk1fiyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KO +Tk0k+17kBL5yG6YnLUlamXrXXAkgt3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOt +zCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZIhvcNAQELBQAD +ggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC +MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2 +cDMT/uFPpiN3GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUN +qXsCHKnQO18LwIE6PWThv6ctTr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5 +YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP+V04ikkwj+3x6xn0dxoxGE1nVGwv +b2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh3jRJjehZrJ3ydlo2 +8hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fawx/k +NSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNj +ZgKAvQU6O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhp +q1467HxpvMc7hU6eFbm0FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFt +nh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOVhMJKzRwuJIczYOXD +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 2 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 2 G3" +# Serial: 390156079458959257446133169266079962026824725800 +# MD5 Fingerprint: af:0c:86:6e:bf:40:2d:7f:0b:3e:12:50:ba:12:3d:06 +# SHA1 Fingerprint: 09:3c:61:f3:8b:8b:dc:7d:55:df:75:38:02:05:00:e1:25:f5:c8:36 +# SHA256 Fingerprint: 8f:e4:fb:0a:f9:3a:4d:0d:67:db:0b:eb:b2:3e:37:c7:1b:f3:25:dc:bc:dd:24:0e:a0:4d:af:58:b4:7e:18:40 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00 +MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFhZiFf +qq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMW +n4rjyduYNM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ym +c5GQYaYDFCDy54ejiK2toIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+ +O7q414AB+6XrW7PFXmAqMaCvN+ggOp+oMiwMzAkd056OXbxMmO7FGmh77FOm6RQ1 +o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+lV0POKa2Mq1W/xPtbAd0j +IaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZoL1NesNKq +IcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz +8eQQsSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43eh +vNURG3YBZwjgQQvD6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l +7ZizlWNof/k19N+IxWA1ksB8aRxhlRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALG +cC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZIhvcNAQELBQAD +ggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66 +AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RC +roijQ1h5fq7KpVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0Ga +W/ZZGYjeVYg3UQt4XAoeo0L9x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4n +lv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgzdWqTHBLmYF5vHX/JHyPLhGGfHoJE ++V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6XU/IyAgkwo1jwDQHV +csaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+NwmNtd +dbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNg +KCLjsZWDzYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeM +HVOyToV7BjjHLPj4sHKNJeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4 +WSr2Rz0ZiC3oheGe7IUIarFsNMkd7EgrO3jtZsSOeWmD3n+M +-----END CERTIFICATE----- + +# Issuer: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited +# Subject: CN=QuoVadis Root CA 3 G3 O=QuoVadis Limited +# Label: "QuoVadis Root CA 3 G3" +# Serial: 268090761170461462463995952157327242137089239581 +# MD5 Fingerprint: df:7d:b9:ad:54:6f:68:a1:df:89:57:03:97:43:b0:d7 +# SHA1 Fingerprint: 48:12:bd:92:3c:a8:c4:39:06:e7:30:6d:27:96:e6:a4:cf:22:2e:7d +# SHA256 Fingerprint: 88:ef:81:de:20:2e:b0:18:45:2e:43:f8:64:72:5c:ea:5f:bd:1f:c2:d9:d2:05:73:07:09:c5:d8:b8:69:0f:46 +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQEL +BQAwSDELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAc +BgNVBAMTFVF1b1ZhZGlzIFJvb3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00 +MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM +aW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMgRzMwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286IxSR +/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNu +FoM7pmRLMon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXR +U7Ox7sWTaYI+FrUoRqHe6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+c +ra1AdHkrAj80//ogaX3T7mH1urPnMNA3I4ZyYUUpSFlob3emLoG+B01vr87ERROR +FHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3UVDmrJqMz6nWB2i3ND0/k +A9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f75li59wzw +eyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634Ryl +sSqiMd5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBp +VzgeAVuNVejH38DMdyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0Q +A4XN8f+MFrXBsj6IbGB/kE+V9/YtrQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ +ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZIhvcNAQELBQAD +ggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px +KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnI +FUBhynLWcKzSt/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5Wvv +oxXqA/4Ti2Tk08HS6IT7SdEQTXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFg +u/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9DuDcpmvJRPpq3t/O5jrFc/ZSXPsoaP +0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGibIh6BJpsQBJFxwAYf +3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmDhPbl +8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+ +DhcI00iX0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HN +PlopNLk9hM6xZdRZkZFWdSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ +ywaZWWDYWGWVjUTR939+J399roD1B0y2PpxxVJkES/1Y+Zj0 +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root G2 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root G2" +# Serial: 15385348160840213938643033620894905419 +# MD5 Fingerprint: 92:38:b9:f8:63:24:82:65:2c:57:33:e6:fe:81:8f:9d +# SHA1 Fingerprint: a1:4b:48:d9:43:ee:0a:0e:40:90:4f:3c:e0:a4:c0:91:93:51:5d:3f +# SHA256 Fingerprint: 7d:05:eb:b6:82:33:9f:8c:94:51:ee:09:4e:eb:fe:fa:79:53:a1:14:ed:b2:f4:49:49:45:2f:ab:7d:2f:c1:85 +-----BEGIN CERTIFICATE----- +MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA +n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc +biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp +EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA +bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu +YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB +AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW +BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI +QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I +0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni +lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 +B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv +ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo +IhNzbM8m9Yop5w== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Assured ID Root G3 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Assured ID Root G3" +# Serial: 15459312981008553731928384953135426796 +# MD5 Fingerprint: 7c:7f:65:31:0c:81:df:8d:ba:3e:99:e2:5c:ad:6e:fb +# SHA1 Fingerprint: f5:17:a2:4f:9a:48:c6:c9:f8:a2:00:26:9f:dc:0f:48:2c:ab:30:89 +# SHA256 Fingerprint: 7e:37:cb:8b:4c:47:09:0c:ab:36:55:1b:a6:f4:5d:b8:40:68:0f:ba:16:6a:95:2d:b1:00:71:7f:43:05:3f:c2 +-----BEGIN CERTIFICATE----- +MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw +CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu +ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg +RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu +Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq +hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf +Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q +RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ +BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD +AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY +JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv +6pZjamVFkpUBtA== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root G2 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root G2" +# Serial: 4293743540046975378534879503202253541 +# MD5 Fingerprint: e4:a6:8a:c8:54:ac:52:42:46:0a:fd:72:48:1b:2a:44 +# SHA1 Fingerprint: df:3c:24:f9:bf:d6:66:76:1b:26:80:73:fe:06:d1:cc:8d:4f:82:a4 +# SHA256 Fingerprint: cb:3c:cb:b7:60:31:e5:e0:13:8f:8d:d3:9a:23:f9:de:47:ff:c3:5e:43:c1:14:4c:ea:27:d4:6a:5a:b1:cb:5f +-----BEGIN CERTIFICATE----- +MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH +MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI +2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx +1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ +q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz +tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ +vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV +5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY +1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 +NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG +Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 +8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe +pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl +MrY= +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Global Root G3 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Global Root G3" +# Serial: 7089244469030293291760083333884364146 +# MD5 Fingerprint: f5:5d:a4:50:a5:fb:28:7e:1e:0f:0d:cc:96:57:56:ca +# SHA1 Fingerprint: 7e:04:de:89:6a:3e:66:6d:00:e6:87:d3:3f:fa:d9:3b:e8:3d:34:9e +# SHA256 Fingerprint: 31:ad:66:48:f8:10:41:38:c7:38:f3:9e:a4:32:01:33:39:3e:3a:18:cc:02:29:6e:f9:7c:2a:c9:ef:67:31:d0 +-----BEGIN CERTIFICATE----- +MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw +CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu +ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe +Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw +EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x +IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF +K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG +fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO +Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd +BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx +AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ +oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 +sycX +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com +# Subject: CN=DigiCert Trusted Root G4 O=DigiCert Inc OU=www.digicert.com +# Label: "DigiCert Trusted Root G4" +# Serial: 7451500558977370777930084869016614236 +# MD5 Fingerprint: 78:f2:fc:aa:60:1f:2f:b4:eb:c9:37:ba:53:2e:75:49 +# SHA1 Fingerprint: dd:fb:16:cd:49:31:c9:73:a2:03:7d:3f:c8:3a:4d:7d:77:5d:05:e4 +# SHA256 Fingerprint: 55:2f:7b:dc:f1:a7:af:9e:6c:e6:72:01:7f:4f:12:ab:f7:72:40:c7:8e:76:1a:c2:03:d1:d9:d2:0a:c8:99:88 +-----BEGIN CERTIFICATE----- +MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg +RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV +UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu +Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y +ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If +xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV +ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO +DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ +jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ +CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi +EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM +fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY +uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK +chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t +9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD +ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 +SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd ++SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc +fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa +sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N +cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N +0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie +4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI +r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 +/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm +gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ +-----END CERTIFICATE----- + +# Issuer: CN=COMODO RSA Certification Authority O=COMODO CA Limited +# Subject: CN=COMODO RSA Certification Authority O=COMODO CA Limited +# Label: "COMODO RSA Certification Authority" +# Serial: 101909084537582093308941363524873193117 +# MD5 Fingerprint: 1b:31:b0:71:40:36:cc:14:36:91:ad:c4:3e:fd:ec:18 +# SHA1 Fingerprint: af:e5:d2:44:a8:d1:19:42:30:ff:47:9f:e2:f8:97:bb:cd:7a:8c:b4 +# SHA256 Fingerprint: 52:f0:e1:c4:e5:8e:c6:29:29:1b:60:31:7f:07:46:71:b8:5d:7e:a8:0d:5b:07:27:34:63:53:4b:32:b4:02:34 +-----BEGIN CERTIFICATE----- +MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB +hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV +BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5 +MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT +EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR +Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR +6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X +pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC +9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV +/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf +Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z ++pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w +qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah +SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC +u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf +Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq +crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E +FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB +/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl +wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM +4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV +2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna +FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ +CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK +boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke +jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL +S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb +QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl +0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB +NVOFBkpdn627G190 +-----END CERTIFICATE----- + +# Issuer: CN=USERTrust RSA Certification Authority O=The USERTRUST Network +# Subject: CN=USERTrust RSA Certification Authority O=The USERTRUST Network +# Label: "USERTrust RSA Certification Authority" +# Serial: 2645093764781058787591871645665788717 +# MD5 Fingerprint: 1b:fe:69:d1:91:b7:19:33:a3:72:a8:0f:e1:55:e5:b5 +# SHA1 Fingerprint: 2b:8f:1b:57:33:0d:bb:a2:d0:7a:6c:51:f7:0e:e9:0d:da:b9:ad:8e +# SHA256 Fingerprint: e7:93:c9:b0:2f:d8:aa:13:e2:1c:31:22:8a:cc:b0:81:19:64:3b:74:9c:89:89:64:b1:74:6d:46:c3:d4:cb:d2 +-----BEGIN CERTIFICATE----- +MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCB +iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl +cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV +BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAw +MjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNV +BAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU +aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2Vy +dGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCAEmUXNg7D2wiz0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B +3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2jY0K2dvKpOyuR+OJv0OwWIJAJPuLodMkY +tJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFnRghRy4YUVD+8M/5+bJz/ +Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O+T23LLb2 +VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT +79uq/nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6 +c0Plfg6lZrEpfDKEY1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmT +Yo61Zs8liM2EuLE/pDkP2QKe6xJMlXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97l +c6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8yexDJtC/QV9AqURE9JnnV4ee +UB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+eLf8ZxXhyVeE +Hg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd +BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8G +A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPF +Up/L+M+ZBn8b2kMVn54CVVeWFPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KO +VWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ7l8wXEskEVX/JJpuXior7gtNn3/3 +ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQEg9zKC7F4iRO/Fjs +8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM8WcR +iQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYze +Sf7dNXGiFSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZ +XHlKYC6SQK5MNyosycdiyA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/ +qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9cJ2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRB +VXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGwsAvgnEzDHNb842m1R0aB +L6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gxQ+6IHdfG +jjxDah2nGN59PRbxYvnKkKj9 +-----END CERTIFICATE----- + +# Issuer: CN=USERTrust ECC Certification Authority O=The USERTRUST Network +# Subject: CN=USERTrust ECC Certification Authority O=The USERTRUST Network +# Label: "USERTrust ECC Certification Authority" +# Serial: 123013823720199481456569720443997572134 +# MD5 Fingerprint: fa:68:bc:d9:b5:7f:ad:fd:c9:1d:06:83:28:cc:24:c1 +# SHA1 Fingerprint: d1:cb:ca:5d:b2:d5:2a:7f:69:3b:67:4d:e5:f0:5a:1d:0c:95:7d:f0 +# SHA256 Fingerprint: 4f:f4:60:d5:4b:9c:86:da:bf:bc:fc:57:12:e0:40:0d:2b:ed:3f:bc:4d:4f:bd:aa:86:e0:6a:dc:d2:a9:ad:7a +-----BEGIN CERTIFICATE----- +MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL +MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl +eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT +JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx +MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT +Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg +VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm +aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo +I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng +o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G +A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB +zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW +RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R5 +# Label: "GlobalSign ECC Root CA - R5" +# Serial: 32785792099990507226680698011560947931244 +# MD5 Fingerprint: 9f:ad:3b:1c:02:1e:8a:ba:17:74:38:81:0c:a2:bc:08 +# SHA1 Fingerprint: 1f:24:c6:30:cd:a4:18:ef:20:69:ff:ad:4f:dd:5f:46:3a:1b:69:aa +# SHA256 Fingerprint: 17:9f:bc:14:8a:3d:d0:0f:d2:4e:a1:34:58:cc:43:bf:a7:f5:9c:81:82:d7:83:a5:13:f6:eb:ec:10:0c:89:24 +-----BEGIN CERTIFICATE----- +MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk +MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH +bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX +DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD +QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc +8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke +hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI +KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg +515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO +xwy8p2Fp8fc74SrL+SvzZpA3 +-----END CERTIFICATE----- + +# Issuer: CN=IdenTrust Commercial Root CA 1 O=IdenTrust +# Subject: CN=IdenTrust Commercial Root CA 1 O=IdenTrust +# Label: "IdenTrust Commercial Root CA 1" +# Serial: 13298821034946342390520003877796839426 +# MD5 Fingerprint: b3:3e:77:73:75:ee:a0:d3:e3:7e:49:63:49:59:bb:c7 +# SHA1 Fingerprint: df:71:7e:aa:4a:d9:4e:c9:55:84:99:60:2d:48:de:5f:bc:f0:3a:25 +# SHA256 Fingerprint: 5d:56:49:9b:e4:d2:e0:8b:cf:ca:d0:8a:3e:38:72:3d:50:50:3b:de:70:69:48:e4:2f:55:60:30:19:e5:28:ae +-----BEGIN CERTIFICATE----- +MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBK +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVu +VHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQw +MTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MScw +JQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENBIDEwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ldhNlT +3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU ++ehcCuz/mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gp +S0l4PJNgiCL8mdo2yMKi1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1 +bVoE/c40yiTcdCMbXTMTEl3EASX2MN0CXZ/g1Ue9tOsbobtJSdifWwLziuQkkORi +T0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl3ZBWzvurpWCdxJ35UrCL +vYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzyNeVJSQjK +Vsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZK +dHzVWYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHT +c+XvvqDtMwt0viAgxGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hv +l7yTmvmcEpB4eoCHFddydJxVdHixuuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5N +iGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZIhvcNAQELBQAD +ggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH +6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwt +LRvM7Kqas6pgghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93 +nAbowacYXVKV7cndJZ5t+qntozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3 ++wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmVYjzlVYA211QC//G5Xc7UI2/YRYRK +W2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUXfeu+h1sXIFRRk0pT +AwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/rokTLq +l1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG +4iZZRHUe2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZ +mUlO+KWA2yUPHGNiiskzZ2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A +7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7RcGzM7vRX+Bi6hG6H +-----END CERTIFICATE----- + +# Issuer: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust +# Subject: CN=IdenTrust Public Sector Root CA 1 O=IdenTrust +# Label: "IdenTrust Public Sector Root CA 1" +# Serial: 13298821034946342390521976156843933698 +# MD5 Fingerprint: 37:06:a5:b0:fc:89:9d:ba:f4:6b:8c:1a:64:cd:d5:ba +# SHA1 Fingerprint: ba:29:41:60:77:98:3f:f4:f3:ef:f2:31:05:3b:2e:ea:6d:4d:45:fd +# SHA256 Fingerprint: 30:d0:89:5a:9a:44:8a:26:20:91:63:55:22:d1:f5:20:10:b5:86:7a:ca:e1:2c:78:ef:95:8f:d4:f4:38:9f:2f +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBN +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVu +VHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcN +MzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJVUzESMBAGA1UEChMJSWRlblRydXN0 +MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBSb290IENBIDEwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTyP4o7 +ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGy +RBb06tD6Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlS +bdsHyo+1W/CD80/HLaXIrcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF +/YTLNiCBWS2ab21ISGHKTN9T0a9SvESfqy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R +3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoSmJxZZoY+rfGwyj4GD3vw +EUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFnol57plzy +9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9V +GxyhLrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ +2fjXctscvG29ZV/viDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsV +WaFHVCkugyhfHMKiq3IXAAaOReyL4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gD +W/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMwDQYJKoZIhvcN +AQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj +t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHV +DRDtfULAj+7AmgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9 +TaDKQGXSc3z1i9kKlT/YPyNtGtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8G +lwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFtm6/n6J91eEyrRjuazr8FGF1NFTwW +mhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMxNRF4eKLg6TCMf4Df +WN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4Mhn5 ++bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJ +tshquDDIajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhA +GaQdp/lLQzfcaFpPz+vCZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv +8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ3Wl9af0AVqW3rLatt8o+Ae+c +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - G2 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2009 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - G2" +# Serial: 1246989352 +# MD5 Fingerprint: 4b:e2:c9:91:96:65:0c:f4:0e:5a:93:92:a0:0a:fe:b2 +# SHA1 Fingerprint: 8c:f4:27:fd:79:0c:3a:d1:66:06:8d:e8:1e:57:ef:bb:93:22:72:d4 +# SHA256 Fingerprint: 43:df:57:74:b0:3e:7f:ef:5f:e4:0d:93:1a:7b:ed:f1:bb:2e:6b:42:73:8c:4e:6d:38:41:10:3d:3a:a7:f3:39 +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 +cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs +IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz +dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy +NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu +dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt +dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 +aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T +RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN +cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW +wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 +U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 +jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN +BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ +jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ +Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v +1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R +nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH +VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - EC1 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2012 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - EC1" +# Serial: 51543124481930649114116133369 +# MD5 Fingerprint: b6:7e:1d:f0:58:c5:49:6c:24:3b:3d:ed:98:18:ed:bc +# SHA1 Fingerprint: 20:d8:06:40:df:9b:25:f5:12:25:3a:11:ea:f7:59:8a:eb:14:b5:47 +# SHA256 Fingerprint: 02:ed:0e:b2:8c:14:da:45:16:5c:56:67:91:70:0d:64:51:d7:fb:56:f0:b2:ab:1d:3b:8e:b0:70:e5:6e:df:f5 +-----BEGIN CERTIFICATE----- +MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG +A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 +d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu +dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq +RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy +MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD +VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 +L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g +Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi +A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt +ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH +Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O +BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC +R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX +hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G +-----END CERTIFICATE----- + +# Issuer: CN=CFCA EV ROOT O=China Financial Certification Authority +# Subject: CN=CFCA EV ROOT O=China Financial Certification Authority +# Label: "CFCA EV ROOT" +# Serial: 407555286 +# MD5 Fingerprint: 74:e1:b6:ed:26:7a:7a:44:30:33:94:ab:7b:27:81:30 +# SHA1 Fingerprint: e2:b8:29:4b:55:84:ab:6b:58:c2:90:46:6c:ac:3f:b8:39:8f:84:83 +# SHA256 Fingerprint: 5c:c3:d7:8e:4e:1d:5e:45:54:7a:04:e6:87:3e:64:f9:0c:f9:53:6d:1c:cc:2e:f8:00:f3:55:c4:c5:fd:70:fd +-----BEGIN CERTIFICATE----- +MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD +TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y +aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx +MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j +aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP +T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03 +sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL +TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5 +/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp +7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz +EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt +hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP +a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot +aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg +TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV +PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv +cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL +tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd +BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB +ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT +ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL +jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS +ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy +P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19 +xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d +Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN +5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe +/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z +AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ +5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su +-----END CERTIFICATE----- + +# Issuer: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed +# Subject: CN=OISTE WISeKey Global Root GB CA O=WISeKey OU=OISTE Foundation Endorsed +# Label: "OISTE WISeKey Global Root GB CA" +# Serial: 157768595616588414422159278966750757568 +# MD5 Fingerprint: a4:eb:b9:61:28:2e:b7:2f:98:b0:35:26:90:99:51:1d +# SHA1 Fingerprint: 0f:f9:40:76:18:d3:d7:6a:4b:98:f0:a8:35:9e:0c:fd:27:ac:cc:ed +# SHA256 Fingerprint: 6b:9c:08:e8:6e:b0:f7:67:cf:ad:65:cd:98:b6:21:49:e5:49:4a:67:f5:84:5e:7b:d1:ed:01:9f:27:b8:6b:d6 +-----BEGIN CERTIFICATE----- +MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBt +MQswCQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUg +Rm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9i +YWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAwMzJaFw0zOTEyMDExNTEwMzFaMG0x +CzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBG +b3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh +bCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3 +HEokKtaXscriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGx +WuR51jIjK+FTzJlFXHtPrby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX +1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNk +u7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4oQnc/nSMbsrY9gBQHTC5P +99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvgGUpuuy9r +M2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUB +BAMCAQAwDQYJKoZIhvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrgh +cViXfa43FK8+5/ea4n32cZiZBKpDdHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5 +gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0VQreUGdNZtGn//3ZwLWoo4rO +ZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEuiHZeeevJuQHHf +aPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic +Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= +-----END CERTIFICATE----- + +# Issuer: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. +# Subject: CN=SZAFIR ROOT CA2 O=Krajowa Izba Rozliczeniowa S.A. +# Label: "SZAFIR ROOT CA2" +# Serial: 357043034767186914217277344587386743377558296292 +# MD5 Fingerprint: 11:64:c1:89:b0:24:b1:8c:b1:07:7e:89:9e:51:9e:99 +# SHA1 Fingerprint: e2:52:fa:95:3f:ed:db:24:60:bd:6e:28:f3:9c:cc:cf:5e:b3:3f:de +# SHA256 Fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe +-----BEGIN CERTIFICATE----- +MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQEL +BQAwUTELMAkGA1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6 +ZW5pb3dhIFMuQS4xGDAWBgNVBAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkw +NzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9L +cmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYDVQQDDA9TWkFGSVIg +Uk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5QqEvN +QLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT +3PSQ1hNKDJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw +3gAeqDRHu5rr/gsUvTaE2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr6 +3fE9biCloBK0TXC5ztdyO4mTp4CEHCdJckm1/zuVnsHMyAHs6A6KCpbns6aH5db5 +BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwiieDhZNRnvDF5YTy7ykHN +XGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsF +AAOCAQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw +8PRBEew/R40/cof5O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOG +nXkZ7/e7DDWQw4rtTw/1zBLZpD67oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCP +oky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul4+vJhaAlIDf7js4MNIThPIGy +d05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6+/NNIxuZMzSg +LvWpCz/UXeHPhJ/iGcJfitYgHuNztw== +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Network CA 2 O=Unizeto Technologies S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Network CA 2" +# Serial: 44979900017204383099463764357512596969 +# MD5 Fingerprint: 6d:46:9e:d9:25:6d:08:23:5b:5e:74:7d:1e:27:db:f2 +# SHA1 Fingerprint: d3:dd:48:3e:2b:bf:4c:05:e8:af:10:f5:fa:76:26:cf:d3:dc:30:92 +# SHA256 Fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 +-----BEGIN CERTIFICATE----- +MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCB +gDELMAkGA1UEBhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMu +QS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIG +A1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29yayBDQSAyMCIYDzIwMTExMDA2MDgz +OTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQTDEiMCAGA1UEChMZ +VW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3 +b3JrIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWA +DGSdhhuWZGc/IjoedQF97/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn +0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+oCgCXhVqqndwpyeI1B+twTUrWwbNWuKFB +OJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40bRr5HMNUuctHFY9rnY3lE +fktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2puTRZCr+E +Sv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1m +o130GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02i +sx7QBlrd9pPPV3WZ9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOW +OZV7bIBaTxNyxtd9KXpEulKkKtVBRgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgez +Tv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pyehizKV/Ma5ciSixqClnrDvFAS +adgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vMBhBgu4M1t15n +3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMC +AQYwDQYJKoZIhvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQ +F/xlhMcQSZDe28cmk4gmb3DWAl45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTf +CVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuAL55MYIR4PSFk1vtBHxgP58l1cb29 +XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMoclm2q8KMZiYcdywm +djWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tMpkT/ +WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jb +AoJnwTnbw3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksq +P/ujmv5zMnHCnsZy4YpoJ/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Ko +b7a6bINDd82Kkhehnlt4Fj1F4jNy3eFmypnTycUm/Q1oBEauttmbjL4ZvrHG8hnj +XALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLXis7VmFxWlgPF7ncGNf/P +5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7zAYspsbi +DrW5viSP +-----END CERTIFICATE----- + +# Issuer: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Subject: CN=Hellenic Academic and Research Institutions RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Label: "Hellenic Academic and Research Institutions RootCA 2015" +# Serial: 0 +# MD5 Fingerprint: ca:ff:e2:db:03:d9:cb:4b:e9:0f:ad:84:fd:7b:18:ce +# SHA1 Fingerprint: 01:0c:06:95:a6:98:19:14:ff:bf:5f:c6:b0:b6:95:ea:29:e9:12:a6 +# SHA256 Fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 +-----BEGIN CERTIFICATE----- +MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1Ix +DzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5k +IFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMT +N0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9v +dENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAxMTIxWjCBpjELMAkG +A1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNh +ZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkx +QDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 +dGlvbnMgUm9vdENBIDIwMTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC +AQDC+Kk/G4n8PDwEXT2QNrCROnk8ZlrvbTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA +4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+ehiGsxr/CL0BgzuNtFajT0 +AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+6PAQZe10 +4S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06C +ojXdFPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV +9Cz82XBST3i4vTwri5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrD +gfgXy5I2XdGj2HUb4Ysn6npIQf1FGQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6 +Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2fu/Z8VFRfS0myGlZYeCsargq +NhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9muiNX6hME6wGko +LfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc +Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNV +HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVd +ctA4GGqd83EkVAswDQYJKoZIhvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0I +XtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+D1hYc2Ryx+hFjtyp8iY/xnmMsVMI +M4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrMd/K4kPFox/la/vot +9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+yd+2V +Z5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/ea +j8GsGsVn82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnh +X9izjFk0WaSrT2y7HxjbdavYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQ +l033DlZdwJVqwjbDG2jJ9SrcR5q+ss7FJej6A7na+RZukYT1HCjI/CbM1xyQVqdf +bzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVtJ94Cj8rDtSvK6evIIVM4 +pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGaJI7ZjnHK +e7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0 +vm9qp/UsQu0yrbYhnr68 +-----END CERTIFICATE----- + +# Issuer: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Subject: CN=Hellenic Academic and Research Institutions ECC RootCA 2015 O=Hellenic Academic and Research Institutions Cert. Authority +# Label: "Hellenic Academic and Research Institutions ECC RootCA 2015" +# Serial: 0 +# MD5 Fingerprint: 81:e5:b4:17:eb:c2:f5:e1:4b:0d:41:7b:49:92:fe:ef +# SHA1 Fingerprint: 9f:f1:71:8d:92:d5:9a:f3:7d:74:97:b4:bc:6f:84:68:0b:ba:b6:66 +# SHA256 Fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b1:15:82:dc:48:7b:48:33 +-----BEGIN CERTIFICATE----- +MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzAN +BgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl +c2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hl +bGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgRUNDIFJv +b3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEwMzcxMlowgaoxCzAJ +BgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmljIEFj +YWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5 +MUQwQgYDVQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0 +dXRpb25zIEVDQyBSb290Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKg +QehLgoRc4vgxEZmGZE4JJS+dQS8KrjVPdJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJa +jq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoKVlp8aQuqgAkkbH7BRqNC +MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLQi +C4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaep +lSTAGiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7Sof +TUwJCA3sS61kFyjndc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR +-----END CERTIFICATE----- + +# Issuer: CN=ISRG Root X1 O=Internet Security Research Group +# Subject: CN=ISRG Root X1 O=Internet Security Research Group +# Label: "ISRG Root X1" +# Serial: 172886928669790476064670243504169061120 +# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e +# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8 +# SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- + +# Issuer: O=FNMT-RCM OU=AC RAIZ FNMT-RCM +# Subject: O=FNMT-RCM OU=AC RAIZ FNMT-RCM +# Label: "AC RAIZ FNMT-RCM" +# Serial: 485876308206448804701554682760554759 +# MD5 Fingerprint: e2:09:04:b4:d3:bd:d1:a0:14:fd:1a:d2:47:c4:57:1d +# SHA1 Fingerprint: ec:50:35:07:b2:15:c4:95:62:19:e2:a8:9a:5b:42:99:2c:4c:2c:20 +# SHA256 Fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsx +CzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJ +WiBGTk1ULVJDTTAeFw0wODEwMjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJ +BgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBG +Tk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALpxgHpMhm5/ +yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcfqQgf +BBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAz +WHFctPVrbtQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxF +tBDXaEAUwED653cXeuYLj2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z +374jNUUeAlz+taibmSXaXvMiwzn15Cou08YfxGyqxRxqAQVKL9LFwag0Jl1mpdIC +IfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mwWsXmo8RZZUc1g16p6DUL +mbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnTtOmlcYF7 +wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peS +MKGJ47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2 +ZSysV4999AeU14ECll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMet +UqIJ5G+GR4of6ygnXYMgrwTJbFaai0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUw +AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPd9xf3E6Jobd2Sn9R2gzL+H +YJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwOi8vd3d3 +LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD +nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1 +RXxlDPiyN8+sD8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYM +LVN0V2Ue1bLdI4E7pWYjJ2cJj+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf +77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrTQfv6MooqtyuGC2mDOL7Nii4LcK2N +JpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW+YJF1DngoABd15jm +fZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7Ixjp +6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp +1txyM/1d8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B +9kiABdcPUXmsEKvU7ANm5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wok +RqEIr9baRRmW1FMdW4R58MD3R++Lj8UGrp1MYp3/RgT408m2ECVAdf4WqslKYIYv +uu8wd+RU4riEmViAqhOLUTpPSPaLtrM= +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 1 O=Amazon +# Subject: CN=Amazon Root CA 1 O=Amazon +# Label: "Amazon Root CA 1" +# Serial: 143266978916655856878034712317230054538369994 +# MD5 Fingerprint: 43:c6:bf:ae:ec:fe:ad:2f:18:c6:88:68:30:fc:c8:e6 +# SHA1 Fingerprint: 8d:a7:f9:65:ec:5e:fc:37:91:0f:1c:6e:59:fd:c1:cc:6a:6e:de:16 +# SHA256 Fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e +-----BEGIN CERTIFICATE----- +MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF +ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 +b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL +MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv +b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj +ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM +9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw +IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6 +VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L +93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm +jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA +A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI +U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs +N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv +o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU +5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy +rqXRfboQnoZsG4q5WTP468SQvvG5 +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 2 O=Amazon +# Subject: CN=Amazon Root CA 2 O=Amazon +# Label: "Amazon Root CA 2" +# Serial: 143266982885963551818349160658925006970653239 +# MD5 Fingerprint: c8:e5:8d:ce:a8:42:e2:7a:c0:2a:5c:7c:9e:26:bf:66 +# SHA1 Fingerprint: 5a:8c:ef:45:d7:a6:98:59:76:7a:8c:8b:44:96:b5:78:cf:47:4b:1a +# SHA256 Fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF +ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6 +b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL +MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv +b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK +gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ +W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg +1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K +8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r +2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me +z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR +8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj +mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz +7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6 ++XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI +0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB +Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm +UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2 +LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY ++gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS +k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl +7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm +btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl +urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+ +fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63 +n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE +76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H +9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT +4PsJYGw= +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 3 O=Amazon +# Subject: CN=Amazon Root CA 3 O=Amazon +# Label: "Amazon Root CA 3" +# Serial: 143266986699090766294700635381230934788665930 +# MD5 Fingerprint: a0:d4:ef:0b:f7:b5:d8:49:95:2a:ec:f5:c4:fc:81:87 +# SHA1 Fingerprint: 0d:44:dd:8c:3c:8c:1a:1a:58:75:64:81:e9:0f:2e:2a:ff:b3:d2:6e +# SHA256 Fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:69:f5:03:43:b4:6d:b3:a4 +-----BEGIN CERTIFICATE----- +MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5 +MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g +Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG +A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg +Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl +ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j +QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr +ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr +BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM +YyRIHN8wfdVoOw== +-----END CERTIFICATE----- + +# Issuer: CN=Amazon Root CA 4 O=Amazon +# Subject: CN=Amazon Root CA 4 O=Amazon +# Label: "Amazon Root CA 4" +# Serial: 143266989758080763974105200630763877849284878 +# MD5 Fingerprint: 89:bc:27:d5:eb:17:8d:06:6a:69:d5:fd:89:47:b4:cd +# SHA1 Fingerprint: f6:10:84:07:d6:f8:bb:67:98:0c:c2:e2:44:c2:eb:ae:1c:ef:63:be +# SHA256 Fingerprint: e3:5d:28:41:9e:d0:20:25:cf:a6:90:38:cd:62:39:62:45:8d:a5:c6:95:fb:de:a3:c2:2b:0b:fb:25:89:70:92 +-----BEGIN CERTIFICATE----- +MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5 +MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g +Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG +A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg +Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi +9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk +M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB +MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw +CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW +1KyLa2tJElMzrdfkviT8tQp21KW8EA== +-----END CERTIFICATE----- + +# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1" +# Serial: 1 +# MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49 +# SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca +# SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 +-----BEGIN CERTIFICATE----- +MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx +GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp +bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w +KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0 +BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy +dW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYDVQQG +EwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXll +IEJpbGltc2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklU +QUsxLTArBgNVBAsTJEthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBT +TTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11IFNNIFNTTCBLb2sgU2VydGlmaWthc2kg +LSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr3UwM6q7 +a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y86Ij5iySr +LqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INr +N3wcwv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2X +YacQuFWQfw4tJzh03+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/ +iSIzL+aFCr2lqBs23tPcLG07xxO9WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4f +AJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQUZT/HiobGPN08VFw1+DrtUgxH +V8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh +AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPf +IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4 +lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c +8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf +lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= +-----END CERTIFICATE----- + +# Issuer: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. +# Subject: CN=GDCA TrustAUTH R5 ROOT O=GUANG DONG CERTIFICATE AUTHORITY CO.,LTD. +# Label: "GDCA TrustAUTH R5 ROOT" +# Serial: 9009899650740120186 +# MD5 Fingerprint: 63:cc:d9:3d:34:35:5c:6f:53:a3:e2:08:70:48:1f:b4 +# SHA1 Fingerprint: 0f:36:38:5b:81:1a:25:c3:9b:31:4e:83:ca:e9:34:66:70:cc:74:b4 +# SHA256 Fingerprint: bf:ff:8f:d0:44:33:48:7d:6a:8a:a6:0c:1a:29:76:7a:9f:c2:bb:b0:5e:42:0f:71:3a:13:b9:92:89:1d:38:93 +-----BEGIN CERTIFICATE----- +MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UE +BhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ +IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0 +MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVowYjELMAkGA1UEBhMCQ04xMjAwBgNV +BAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8w +HQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJj +Dp6L3TQsAlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBj +TnnEt1u9ol2x8kECK62pOqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+u +KU49tm7srsHwJ5uu4/Ts765/94Y9cnrrpftZTqfrlYwiOXnhLQiPzLyRuEH3FMEj +qcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ9Cy5WmYqsBebnh52nUpm +MUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQxXABZG12 +ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloP +zgsMR6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3Gk +L30SgLdTMEZeS1SZD2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeC +jGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4oR24qoAATILnsn8JuLwwoC8N9VKejveSswoA +HQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx9hoh49pwBiFYFIeFd3mqgnkC +AwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlRMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg +p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZm +DRd9FBUb1Ov9H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5 +COmSdI31R9KrO9b7eGZONn356ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ry +L3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd+PwyvzeG5LuOmCd+uh8W4XAR8gPf +JWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQHtZa37dG/OaG+svg +IHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBDF8Io +2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV +09tL7ECQ8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQ +XR4EzzffHqhmsYzmIGrv/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrq +T8p+ck0LcIymSLumoRT2+1hEmRSuqguTaaApJUqlyyvdimYHFngVV3Eb7PVHhPOe +MTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g== +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com Root Certification Authority RSA O=SSL Corporation +# Subject: CN=SSL.com Root Certification Authority RSA O=SSL Corporation +# Label: "SSL.com Root Certification Authority RSA" +# Serial: 8875640296558310041 +# MD5 Fingerprint: 86:69:12:c0:70:f1:ec:ac:ac:c2:d5:bc:a5:5b:a1:29 +# SHA1 Fingerprint: b7:ab:33:08:d1:ea:44:77:ba:14:80:12:5a:6f:bd:a9:36:49:0c:bb +# SHA256 Fingerprint: 85:66:6a:56:2e:e0:be:5c:e9:25:c1:d8:89:0a:6f:76:a8:7e:c1:6d:4d:7d:5f:29:ea:74:19:cf:20:12:3b:69 +-----BEGIN CERTIFICATE----- +MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UE +BhMCVVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQK +DA9TU0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYwMjEyMTczOTM5WhcNNDEwMjEyMTcz +OTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv +dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv +bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcN +AQEBBQADggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2R +xFdHaxh3a3by/ZPkPQ/CFp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aX +qhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcC +C52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/geoeOy3ZExqysdBP+lSgQ3 +6YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkpk8zruFvh +/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrF +YD3ZfBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93E +JNyAKoFBbZQ+yODJgUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVc +US4cK38acijnALXRdMbX5J+tB5O2UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8 +ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi81xtZPCvM8hnIk2snYxnP/Okm ++Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4sbE6x/c+cCbqi +M+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV +HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4G +A1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGV +cpNxJK1ok1iOMq8bs3AD/CUrdIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBc +Hadm47GUBwwyOabqG7B52B2ccETjit3E+ZUfijhDPwGFpUenPUayvOUiaPd7nNgs +PgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAslu1OJD7OAUN5F7kR/ +q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjqerQ0 +cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jr +a6x+3uxjMxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90I +H37hVZkLId6Tngr75qNJvTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/Y +K9f1JmzJBjSWFupwWRoyeXkLtoh/D1JIPb9s2KJELtFOt3JY04kTlf5Eq/jXixtu +nLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406ywKBjYZC6VWg3dGq2ktuf +oYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NIWuuA8ShY +Ic2wBlX7Jz9TkHCpBB5XJ7k= +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com Root Certification Authority ECC O=SSL Corporation +# Subject: CN=SSL.com Root Certification Authority ECC O=SSL Corporation +# Label: "SSL.com Root Certification Authority ECC" +# Serial: 8495723813297216424 +# MD5 Fingerprint: 2e:da:e4:39:7f:9c:8f:37:d1:70:9f:26:17:51:3a:8e +# SHA1 Fingerprint: c3:19:7c:39:24:e6:54:af:1b:c4:ab:20:95:7a:e2:c3:0e:13:02:6a +# SHA256 Fingerprint: 34:17:bb:06:cc:60:07:da:1b:96:1c:92:0b:8a:b4:ce:3f:ad:82:0e:4a:a3:0b:9a:cb:c4:a7:4e:bd:ce:bc:65 +-----BEGIN CERTIFICATE----- +MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMC +VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T +U0wgQ29ycG9yYXRpb24xMTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0 +aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNDAzWhcNNDEwMjEyMTgxNDAz +WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hvdXN0 +b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNvbSBS +b290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI +7Z4INcgn64mMU1jrYor+8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPg +CemB+vNH06NjMGEwHQYDVR0OBBYEFILRhXMw5zUE044CkvvlpNHEIejNMA8GA1Ud +EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTTjgKS++Wk0cQh6M0wDgYD +VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T +kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+ +gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation +# Subject: CN=SSL.com EV Root Certification Authority RSA R2 O=SSL Corporation +# Label: "SSL.com EV Root Certification Authority RSA R2" +# Serial: 6248227494352943350 +# MD5 Fingerprint: e1:1e:31:58:1a:ae:54:53:02:f6:17:6a:11:7b:4d:95 +# SHA1 Fingerprint: 74:3a:f0:52:9b:d0:32:a0:f4:4a:83:cd:d4:ba:a9:7b:7c:2e:c4:9a +# SHA256 Fingerprint: 2e:7b:f1:6c:c2:24:85:a7:bb:e2:aa:86:96:75:07:61:b0:ae:39:be:3b:2f:e9:d0:cc:6d:4e:f7:34:91:42:5c +-----BEGIN CERTIFICATE----- +MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNV +BAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UE +CgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2Vy +dGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMB4XDTE3MDUzMTE4MTQzN1oXDTQy +MDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEQMA4G +A1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYDVQQD +DC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvq +M0fNTPl9fb69LT3w23jhhqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssuf +OePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7wcXHswxzpY6IXFJ3vG2fThVUCAtZJycxa +4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTOZw+oz12WGQvE43LrrdF9 +HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+B6KjBSYR +aZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcA +b9ZhCBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQ +Gp8hLH94t2S42Oim9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQV +PWKchjgGAGYS5Fl2WlPAApiiECtoRHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMO +pgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+SlmJuwgUHfbSguPvuUCYHBBXtSu +UDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48+qvWBkofZ6aY +MBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV +HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa4 +9QaAJadz20ZpqJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBW +s47LCp1Jjr+kxJG7ZhcFUZh1++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5 +Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nxY/hoLVUE0fKNsKTPvDxeH3jnpaAg +cLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2GguDKBAdRUNf/ktUM +79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDzOFSz +/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXt +ll9ldDz7CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEm +Kf7GUmG6sXP/wwyc5WxqlD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKK +QbNmC1r7fSOl8hqw/96bg5Qu0T/fkreRrwU7ZcegbLHNYhLDkBvjJc40vG93drEQ +w/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooi +S9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07 +mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation +# Subject: CN=SSL.com EV Root Certification Authority ECC O=SSL Corporation +# Label: "SSL.com EV Root Certification Authority ECC" +# Serial: 3182246526754555285 +# MD5 Fingerprint: 59:53:22:65:83:42:01:54:c0:ce:42:b9:5a:7c:f2:90 +# SHA1 Fingerprint: 4c:dd:51:a3:d1:f5:20:32:14:b0:c6:c5:32:23:03:91:c7:46:42:6d +# SHA256 Fingerprint: 22:a2:c1:f7:bd:ed:70:4c:c1:e7:01:b5:f4:08:c3:10:88:0f:e9:56:b5:de:2a:4a:44:f9:9c:87:3a:25:a7:c8 +-----BEGIN CERTIFICATE----- +MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMC +VVMxDjAMBgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9T +U0wgQ29ycG9yYXRpb24xNDAyBgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEyMTgxNTIzWhcNNDEwMjEyMTgx +NTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAOBgNVBAcMB0hv +dXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NMLmNv +bSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49 +AgEGBSuBBAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMA +VIbc/R/fALhBYlzccBYy3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1Kthku +WnBaBu2+8KGwytAJKaNjMGEwHQYDVR0OBBYEFFvKXuXe0oGqzagtZFG22XKbl+ZP +MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe5d7SgarNqC1kUbbZcpuX +5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJN+vp1RPZ +ytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZg +h5Mmm7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign Root CA - R6 +# Label: "GlobalSign Root CA - R6" +# Serial: 1417766617973444989252670301619537 +# MD5 Fingerprint: 4f:dd:07:e4:d4:22:64:39:1e:0c:37:42:ea:d1:c6:ae +# SHA1 Fingerprint: 80:94:64:0e:b5:a7:a1:ca:11:9c:1f:dd:d5:9f:81:02:63:a7:fb:d1 +# SHA256 Fingerprint: 2c:ab:ea:fe:37:d0:6c:a2:2a:ba:73:91:c0:03:3d:25:98:29:52:c4:53:64:73:49:76:3a:3a:b5:ad:6c:cf:69 +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEg +MB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2Jh +bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQx +MjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjET +MBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCAiIwDQYJ +KoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQssgrRI +xutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1k +ZguSgMpE3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxD +aNc9PIrFsmbVkJq3MQbFvuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJw +LnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqMPKq0pPbzlUoSB239jLKJz9CgYXfIWHSw +1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+azayOeSsJDa38O+2HBNX +k7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05OWgtH8wY2 +SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/h +bguyCLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4n +WUx2OVvq+aWh2IMP0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpY +rZxCRXluDocZXFSxZba/jJvcE+kNb7gu3GduyYsRtYQUigAZcIN5kZeR1Bonvzce +MgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNVHSMEGDAWgBSu +bAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN +nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGt +Ixg93eFyRJa0lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr61 +55wsTLxDKZmOMNOsIeDjHfrYBzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLj +vUYAGm0CuiVdjaExUd1URhxN25mW7xocBFymFe944Hn+Xds+qkxV/ZoVqW/hpvvf +cDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr3TsTjxKM4kEaSHpz +oHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB10jZp +nOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfs +pA9MRf/TuTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+v +JJUEeKgDu+6B5dpffItKoZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R +8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+tJDfLRVpOoERIyNiwmcUVhAn21klJwGW4 +5hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA= +-----END CERTIFICATE----- + +# Issuer: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed +# Subject: CN=OISTE WISeKey Global Root GC CA O=WISeKey OU=OISTE Foundation Endorsed +# Label: "OISTE WISeKey Global Root GC CA" +# Serial: 44084345621038548146064804565436152554 +# MD5 Fingerprint: a9:d6:b9:2d:2f:93:64:f8:a5:69:ca:91:e9:68:07:23 +# SHA1 Fingerprint: e0:11:84:5e:34:de:be:88:81:b9:9c:f6:16:26:d1:96:1f:c3:b9:31 +# SHA256 Fingerprint: 85:60:f9:1c:36:24:da:ba:95:70:b5:fe:a0:db:e3:6f:f1:1a:83:23:be:94:86:85:4f:b3:f3:4a:55:71:19:8d +-----BEGIN CERTIFICATE----- +MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQsw +CQYDVQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91 +bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwg +Um9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRaFw00MjA1MDkwOTU4MzNaMG0xCzAJ +BgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQLExlPSVNURSBGb3Vu +ZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2JhbCBS +b290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4ni +eUqjFqdrVCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4W +p2OQ0jnUsYd4XxiWD1AbNTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7T +rYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0EAwMDaAAwZQIwJsdpW9zV +57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtkAjEA2zQg +Mgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9 +-----END CERTIFICATE----- + +# Issuer: CN=UCA Global G2 Root O=UniTrust +# Subject: CN=UCA Global G2 Root O=UniTrust +# Label: "UCA Global G2 Root" +# Serial: 124779693093741543919145257850076631279 +# MD5 Fingerprint: 80:fe:f0:c4:4a:f0:5c:62:32:9f:1c:ba:78:a9:50:f8 +# SHA1 Fingerprint: 28:f9:78:16:19:7a:ff:18:25:18:aa:44:fe:c1:a0:ce:5c:b6:4c:8a +# SHA256 Fingerprint: 9b:ea:11:c9:76:fe:01:47:64:c1:be:56:a6:f9:14:b5:a5:60:31:7a:bd:99:88:39:33:82:e5:16:1a:a0:49:3c +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9 +MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBH +bG9iYWwgRzIgUm9vdDAeFw0xNjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0x +CzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlUcnVzdDEbMBkGA1UEAwwSVUNBIEds +b2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxeYr +b3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmToni9 +kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzm +VHqUwCoV8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/R +VogvGjqNO7uCEeBHANBSh6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDc +C/Vkw85DvG1xudLeJ1uK6NjGruFZfc8oLTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIj +tm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/R+zvWr9LesGtOxdQXGLY +D0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBeKW4bHAyv +j5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6Dl +NaBa4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6 +iIis7nCs+dwp4wwcOxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznP +O6Q0ibd5Ei9Hxeepl2n8pndntd978XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/ +BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFIHEjMz15DD/pQwIX4wV +ZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo5sOASD0Ee/oj +L3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5 +1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl +1qnN3e92mI0ADs0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oU +b3n09tDh05S60FdRvScFDcH9yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LV +PtateJLbXDzz2K36uGt/xDYotgIVilQsnLAXc47QN6MUPJiVAAwpBVueSUmxX8fj +y88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHojhJi6IjMtX9Gl8Cb +EGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZkbxqg +DMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI ++Vg7RE+xygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGy +YiGqhkCyLmTTX8jjfhFnRR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bX +UB+K+wb1whnw0A== +-----END CERTIFICATE----- + +# Issuer: CN=UCA Extended Validation Root O=UniTrust +# Subject: CN=UCA Extended Validation Root O=UniTrust +# Label: "UCA Extended Validation Root" +# Serial: 106100277556486529736699587978573607008 +# MD5 Fingerprint: a1:f3:5f:43:c6:34:9b:da:bf:8c:7e:05:53:ad:96:e2 +# SHA1 Fingerprint: a3:a1:b0:6f:24:61:23:4a:e3:36:a5:c2:37:fc:a6:ff:dd:f0:d7:3a +# SHA256 Fingerprint: d4:3a:f9:b3:54:73:75:5c:96:84:fc:06:d7:d8:cb:70:ee:5c:28:e7:73:fb:29:4e:b4:1e:e7:17:22:92:4d:24 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBH +MQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBF +eHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMx +MDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNV +BAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrsiWog +D4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvS +sPGP2KxFRv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aop +O2z6+I9tTcg1367r3CTueUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dk +sHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR59mzLC52LqGj3n5qiAno8geK+LLNEOfi +c0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH0mK1lTnj8/FtDw5lhIpj +VMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KRel7sFsLz +KuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/ +TuDvB0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41G +sx2VYVdWf6/wFlthWG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs +1+lvK9JKBZP8nm9rZ/+I8U6laUpSNwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQD +fwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS3H5aBZ8eNJr34RQwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADaN +l8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR +ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQ +VBcZEhrxH9cMaVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5 +c6sq1WnIeJEmMX3ixzDx/BR4dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp +4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb+7lsq+KePRXBOy5nAliRn+/4Qh8s +t2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOWF3sGPjLtx7dCvHaj +2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwiGpWO +vpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2C +xR9GUeOcGMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmx +cmtpzyKEC2IPrNkZAJSidjzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbM +fjKaiJUINlK73nZfdklJrX+9ZSCyycErdhh2n1ax +-----END CERTIFICATE----- + +# Issuer: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 +# Subject: CN=Certigna Root CA O=Dhimyotis OU=0002 48146308100036 +# Label: "Certigna Root CA" +# Serial: 269714418870597844693661054334862075617 +# MD5 Fingerprint: 0e:5c:30:62:27:eb:5b:bc:d7:ae:62:ba:e9:d5:df:77 +# SHA1 Fingerprint: 2d:0d:52:14:ff:9e:ad:99:24:01:74:20:47:6e:6c:85:27:27:f5:43 +# SHA256 Fingerprint: d4:8d:3d:23:ee:db:50:a4:59:e5:51:97:60:1c:27:77:4b:9d:7b:18:c9:4d:5a:05:95:11:a1:02:50:b9:31:68 +-----BEGIN CERTIFICATE----- +MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAw +WjELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAw +MiA0ODE0NjMwODEwMDAzNjEZMBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0x +MzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjdaMFoxCzAJBgNVBAYTAkZSMRIwEAYD +VQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYzMDgxMDAwMzYxGTAX +BgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw +ggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sO +ty3tRQgXstmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9M +CiBtnyN6tMbaLOQdLNyzKNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPu +I9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8JXrJhFwLrN1CTivngqIkicuQstDuI7pm +TLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16XdG+RCYyKfHx9WzMfgIh +C59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq4NYKpkDf +ePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3Yz +IoejwpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWT +Co/1VTp2lc5ZmIoJlXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1k +JWumIWmbat10TWuXekG9qxf5kBdIjzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5 +hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp//TBt2dzhauH8XwIDAQABo4IB +GjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of +1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczov +L3d3d3cuY2VydGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilo +dHRwOi8vY3JsLmNlcnRpZ25hLmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYr +aHR0cDovL2NybC5kaGlteW90aXMuY29tL2NlcnRpZ25hcm9vdGNhLmNybDANBgkq +hkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOItOoldaDgvUSILSo3L +6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxPTGRG +HVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH6 +0BGM+RFq7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncB +lA2c5uk5jR+mUYyZDDl34bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdi +o2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1 +gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS6Cvu5zHbugRqh5jnxV/v +faci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaYtlu3zM63 +Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayh +jWZSaX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw +3kAP+HwV96LOPNdeE4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0= +-----END CERTIFICATE----- + +# Issuer: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI +# Subject: CN=emSign Root CA - G1 O=eMudhra Technologies Limited OU=emSign PKI +# Label: "emSign Root CA - G1" +# Serial: 235931866688319308814040 +# MD5 Fingerprint: 9c:42:84:57:dd:cb:0b:a7:2e:95:ad:b6:f3:da:bc:ac +# SHA1 Fingerprint: 8a:c7:ad:8f:73:ac:4e:c1:b5:75:4d:a5:40:f4:fc:cf:7c:b5:8e:8c +# SHA256 Fingerprint: 40:f6:af:03:46:a9:9a:a1:cd:1d:55:5a:4e:9c:ce:62:c7:f9:63:46:03:ee:40:66:15:83:3d:c8:c8:d0:03:67 +-----BEGIN CERTIFICATE----- +MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYD +VQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBU +ZWNobm9sb2dpZXMgTGltaXRlZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBH +MTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgxODMwMDBaMGcxCzAJBgNVBAYTAklO +MRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVkaHJhIFRlY2hub2xv +Z2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQz +f2N4aLTNLnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO +8oG0x5ZOrRkVUkr+PHB1cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aq +d7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHWDV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhM +tTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ6DqS0hdW5TUaQBw+jSzt +Od9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrHhQIDAQAB +o0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQD +AgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31x +PaOfG1vR2vjTnGs2vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjM +wiI/aTvFthUvozXGaCocV685743QNcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6d +GNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q+Mri/Tm3R7nrft8EI6/6nAYH +6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeihU80Bv2noWgby +RQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx +iN66zB+Afko= +-----END CERTIFICATE----- + +# Issuer: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI +# Subject: CN=emSign ECC Root CA - G3 O=eMudhra Technologies Limited OU=emSign PKI +# Label: "emSign ECC Root CA - G3" +# Serial: 287880440101571086945156 +# MD5 Fingerprint: ce:0b:72:d1:9f:88:8e:d0:50:03:e8:e3:b8:8b:67:40 +# SHA1 Fingerprint: 30:43:fa:4f:f2:57:dc:a0:c3:80:ee:2e:58:ea:78:b2:3f:e6:bb:c1 +# SHA256 Fingerprint: 86:a1:ec:ba:08:9c:4a:8d:3b:be:27:34:c6:12:ba:34:1d:81:3e:04:3c:f9:e8:a8:62:cd:5c:57:a3:6b:be:6b +-----BEGIN CERTIFICATE----- +MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG +EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo +bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g +RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ +TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s +b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw +djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 +WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS +fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB +zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq +hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB +CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD ++JbNR6iC8hZVdyR+EhCVBCyj +-----END CERTIFICATE----- + +# Issuer: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI +# Subject: CN=emSign Root CA - C1 O=eMudhra Inc OU=emSign PKI +# Label: "emSign Root CA - C1" +# Serial: 825510296613316004955058 +# MD5 Fingerprint: d8:e3:5d:01:21:fa:78:5a:b0:df:ba:d2:ee:2a:5f:68 +# SHA1 Fingerprint: e7:2e:f1:df:fc:b2:09:28:cf:5d:d4:d5:67:37:b1:51:cb:86:4f:01 +# SHA256 Fingerprint: 12:56:09:aa:30:1d:a0:a2:49:b9:7a:82:39:cb:6a:34:21:6f:44:dc:ac:9f:39:54:b1:42:92:f2:e8:c8:60:8f +-----BEGIN CERTIFICATE----- +MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkG +A1UEBhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEg +SW5jMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAw +MFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln +biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNpZ24gUm9v +dCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+upufGZ +BczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZ +HdPIWoU/Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH +3DspVpNqs8FqOp099cGXOFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvH +GPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4VI5b2P/AgNBbeCsbEBEV5f6f9vtKppa+c +xSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleoomslMuoaJuvimUnzYnu3Yy1 +aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+XJGFehiq +TbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87 +/kOXSTKZEhVb3xEp/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4 +kqNPEjE2NuLe/gDEo2APJ62gsIq1NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrG +YQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9wC68AivTxEDkigcxHpvOJpkT ++xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQBmIMMMAVSKeo +WXzhriKi4gp6D/piq1JM4fHfyr6DDUI= +-----END CERTIFICATE----- + +# Issuer: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI +# Subject: CN=emSign ECC Root CA - C3 O=eMudhra Inc OU=emSign PKI +# Label: "emSign ECC Root CA - C3" +# Serial: 582948710642506000014504 +# MD5 Fingerprint: 3e:53:b3:a3:81:ee:d7:10:f8:d3:b0:1d:17:92:f5:d5 +# SHA1 Fingerprint: b6:af:43:c2:9b:81:53:7d:f6:ef:6b:c3:1f:1f:60:15:0c:ee:48:66 +# SHA256 Fingerprint: bc:4d:80:9b:15:18:9d:78:db:3e:1d:8c:f4:f9:72:6a:79:5d:a1:64:3c:a5:f1:35:8e:1d:db:0e:dc:0d:7e:b3 +-----BEGIN CERTIFICATE----- +MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQG +EwJVUzETMBEGA1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMx +IDAeBgNVBAMTF2VtU2lnbiBFQ0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAw +MFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UEBhMCVVMxEzARBgNVBAsTCmVtU2ln +biBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQDExdlbVNpZ24gRUND +IFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd6bci +MK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4Ojavti +sIGJAnB9SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0O +BBYEFPtaSNCAIEDyqOkAB2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB +Af8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQC02C8Cif22TGK6Q04ThHK1rt0c +3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwUZOR8loMRnLDRWmFLpg9J +0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== +-----END CERTIFICATE----- + +# Issuer: CN=Hongkong Post Root CA 3 O=Hongkong Post +# Subject: CN=Hongkong Post Root CA 3 O=Hongkong Post +# Label: "Hongkong Post Root CA 3" +# Serial: 46170865288971385588281144162979347873371282084 +# MD5 Fingerprint: 11:fc:9f:bd:73:30:02:8a:fd:3f:f3:58:b9:cb:20:f0 +# SHA1 Fingerprint: 58:a2:d0:ec:20:52:81:5b:c1:f3:f8:64:02:24:4e:c2:8e:02:4b:02 +# SHA256 Fingerprint: 5a:2f:c0:3f:0c:83:b0:90:bb:fa:40:60:4b:09:88:44:6c:76:36:18:3d:f9:84:6e:17:10:1a:44:7f:b8:ef:d6 +-----BEGIN CERTIFICATE----- +MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQEL +BQAwbzELMAkGA1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJ +SG9uZyBLb25nMRYwFAYDVQQKEw1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25n +a29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2MDMwMjI5NDZaFw00MjA2MDMwMjI5 +NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtvbmcxEjAQBgNVBAcT +CUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMXSG9u +Z2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK +AoICAQCziNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFO +dem1p+/l6TWZ5Mwc50tfjTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mI +VoBc+L0sPOFMV4i707mV78vH9toxdCim5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV +9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOesL4jpNrcyCse2m5FHomY +2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj0mRiikKY +vLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+Tt +bNe/JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZb +x39ri1UbSsUgYT2uy1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+ +l2oBlKN8W4UdKjk60FSh0Tlxnf0h+bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YK +TE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsGxVd7GYYKecsAyVKvQv83j+Gj +Hno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwIDAQABo2MwYTAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e +i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEw +DQYJKoZIhvcNAQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG +7BJ8dNVI0lkUmcDrudHr9EgwW62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCk +MpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWldy8joRTnU+kLBEUx3XZL7av9YROXr +gZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov+BS5gLNdTaqX4fnk +GMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDceqFS +3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJm +Ozj/2ZQw9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+ +l6mc1X5VTMbeRRAc6uk7nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6c +JfTzPV4e0hz5sy229zdcxsshTrD3mUcYhcErulWuBurQB7Lcq9CClnXO0lD+mefP +L5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB60PZ2Pierc+xYw5F9KBa +LJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fqdBb9HxEG +mpv0 +-----END CERTIFICATE----- + +# Issuer: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only +# Subject: CN=Entrust Root Certification Authority - G4 O=Entrust, Inc. OU=See www.entrust.net/legal-terms/(c) 2015 Entrust, Inc. - for authorized use only +# Label: "Entrust Root Certification Authority - G4" +# Serial: 289383649854506086828220374796556676440 +# MD5 Fingerprint: 89:53:f1:83:23:b7:7c:8e:05:f1:8c:71:38:4e:1f:88 +# SHA1 Fingerprint: 14:88:4e:86:26:37:b0:26:af:59:62:5c:40:77:ec:35:29:ba:96:01 +# SHA256 Fingerprint: db:35:17:d1:f6:73:2a:2d:5a:b9:7c:53:3e:c7:07:79:ee:32:70:a6:2f:b4:ac:42:38:37:24:60:e6:f0:1e:88 +-----BEGIN CERTIFICATE----- +MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAw +gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL +Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg +MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw +BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0 +MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1 +c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJ +bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3Qg +Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0MIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3DumSXbcr3DbVZwbPLqGgZ +2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV3imz/f3E +T+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j +5pds8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAM +C1rlLAHGVK/XqsEQe9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73T +DtTUXm6Hnmo9RR3RXRv06QqsYJn7ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNX +wbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5XxNMhIWNlUpEbsZmOeX7m640A +2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV7rtNOzK+mndm +nqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8 +dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwl +N4y6mACXi0mWHv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNj +c0kCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9nMA0GCSqGSIb3DQEBCwUAA4ICAQAS +5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4QjbRaZIxowLByQzTS +Gwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht7LGr +hFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/ +B7NTeLUKYvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uI +AeV8KEsD+UmDfLJ/fOPtjqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbw +H5Lk6rWS02FREAutp9lfx1/cH6NcjKF+m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+ +b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKWRGhXxNUzzxkvFMSUHHuk +2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjAJOgc47Ol +IQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk +5F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuY +n/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw== +-----END CERTIFICATE----- + +# Issuer: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation +# Subject: CN=Microsoft ECC Root Certificate Authority 2017 O=Microsoft Corporation +# Label: "Microsoft ECC Root Certificate Authority 2017" +# Serial: 136839042543790627607696632466672567020 +# MD5 Fingerprint: dd:a1:03:e6:4a:93:10:d1:bf:f0:19:42:cb:fe:ed:67 +# SHA1 Fingerprint: 99:9a:64:c3:7f:f4:7d:9f:ab:95:f1:47:69:89:14:60:ee:c4:c3:c5 +# SHA256 Fingerprint: 35:8d:f3:9d:76:4a:f9:e1:b7:66:e9:c9:72:df:35:2e:e1:5c:fa:c2:27:af:6a:d1:d7:0e:8e:4a:6e:dc:ba:02 +-----BEGIN CERTIFICATE----- +MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQsw +CQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYD +VQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIw +MTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4MjMxNjA0WjBlMQswCQYDVQQGEwJV +UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNy +b3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQBgcq +hkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZR +ogPZnZH6thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYb +hGBKia/teQ87zvH2RPUBeMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8E +BTADAQH/MB0GA1UdDgQWBBTIy5lycFIM+Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3 +FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlfXu5gKcs68tvWMoQZP3zV +L8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaReNtUjGUB +iudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M= +-----END CERTIFICATE----- + +# Issuer: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation +# Subject: CN=Microsoft RSA Root Certificate Authority 2017 O=Microsoft Corporation +# Label: "Microsoft RSA Root Certificate Authority 2017" +# Serial: 40975477897264996090493496164228220339 +# MD5 Fingerprint: 10:ff:00:ff:cf:c9:f8:c7:7a:c0:ee:35:8e:c9:0f:47 +# SHA1 Fingerprint: 73:a5:e6:4a:3b:ff:83:16:ff:0e:dc:cc:61:8a:90:6e:4e:ae:4d:74 +# SHA256 Fingerprint: c7:41:f7:0f:4b:2a:8d:88:bf:2e:71:c1:41:22:ef:53:ef:10:eb:a0:cf:a5:e6:4c:fa:20:f4:18:85:30:73:e0 +-----BEGIN CERTIFICATE----- +MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBl +MQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw +NAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 +IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIwNzE4MjMwMDIzWjBlMQswCQYDVQQG +EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1N +aWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZ +Nt9GkMml7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0 +ZdDMbRnMlfl7rEqUrQ7eS0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1 +HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw71VdyvD/IybLeS2v4I2wDwAW9lcfNcztm +gGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+dkC0zVJhUXAoP8XFWvLJ +jEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49FyGcohJUc +aDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaG +YaRSMLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6 +W6IYZVcSn2i51BVrlMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4K +UGsTuqwPN1q3ErWQgR5WrlcihtnJ0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH ++FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJClTUFLkqqNfs+avNJVgyeY+Q +W5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/ +BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC +NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZC +LgLNFgVZJ8og6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OC +gMNPOsduET/m4xaRhPtthH80dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6 +tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk+ONVFT24bcMKpBLBaYVu32TxU5nh +SnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex/2kskZGT4d9Mozd2 +TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDyAmH3 +pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGR +xpl/j8nWZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiApp +GWSZI1b7rCoucL5mxAyE7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9 +dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKTc0QWbej09+CVgI+WXTik9KveCjCHk9hN +AHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D5KbvtwEwXlGjefVwaaZB +RA+GsCyRxj3qrg+E +-----END CERTIFICATE----- + +# Issuer: CN=e-Szigno Root CA 2017 O=Microsec Ltd. +# Subject: CN=e-Szigno Root CA 2017 O=Microsec Ltd. +# Label: "e-Szigno Root CA 2017" +# Serial: 411379200276854331539784714 +# MD5 Fingerprint: de:1f:f6:9e:84:ae:a7:b4:21:ce:1e:58:7d:d1:84:98 +# SHA1 Fingerprint: 89:d4:83:03:4f:9e:9a:48:80:5f:72:37:d4:a9:a6:ef:cb:7c:1f:d1 +# SHA256 Fingerprint: be:b0:0b:30:83:9b:9b:c3:2c:32:e4:44:79:05:95:06:41:f2:64:21:b1:5e:d0:89:19:8b:51:8a:e2:ea:1b:99 +-----BEGIN CERTIFICATE----- +MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNV +BAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRk +LjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJv +b3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZaFw00MjA4MjIxMjA3MDZaMHExCzAJ +BgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMg +THRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25v +IFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtv +xie+RJCxs1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+H +Wyx7xf58etqjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBSHERUI0arBeAyxr87GyZDvvzAEwDAfBgNVHSMEGDAWgBSHERUI0arB +eAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEAtVfd14pVCzbhhkT61Nlo +jbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxOsvxyqltZ ++efcMQ== +-----END CERTIFICATE----- + +# Issuer: O=CERTSIGN SA OU=certSIGN ROOT CA G2 +# Subject: O=CERTSIGN SA OU=certSIGN ROOT CA G2 +# Label: "certSIGN Root CA G2" +# Serial: 313609486401300475190 +# MD5 Fingerprint: 8c:f1:75:8a:c6:19:cf:94:b7:f7:65:20:87:c3:97:c7 +# SHA1 Fingerprint: 26:f9:93:b4:ed:3d:28:27:b0:b9:4b:a7:e9:15:1d:a3:8d:92:e5:32 +# SHA256 Fingerprint: 65:7c:fe:2f:a7:3f:aa:38:46:25:71:f3:32:a2:36:3a:46:fc:e7:02:09:51:71:07:02:cd:fb:b6:ee:da:33:05 +-----BEGIN CERTIFICATE----- +MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNV +BAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04g +Uk9PVCBDQSBHMjAeFw0xNzAyMDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJ +BgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJ +R04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDF +dRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05N0Iw +vlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZ +uIt4ImfkabBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhp +n+Sc8CnTXPnGFiWeI8MgwT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKs +cpc/I1mbySKEwQdPzH/iV8oScLumZfNpdWO9lfsbl83kqK/20U6o2YpxJM02PbyW +xPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91QqhngLjYl/rNUssuHLoPj1P +rCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732jcZZroiF +DsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fx +DTvf95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgy +LcsUDFDYg2WD7rlcz8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6C +eWRgKRM+o/1Pcmqr4tTluCRVLERLiohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB +/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCIS1mxteg4BXrzkwJ +d8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOBywaK8SJJ6ejq +kX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC +b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQl +qiCA2ClV9+BB/AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0 +OJD7uNGzcgbJceaBxXntC6Z58hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+c +NywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5BiKDUyUM/FHE5r7iOZULJK2v0ZXk +ltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklWatKcsWMy5WHgUyIO +pwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tUSxfj +03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZk +PuXaTH4MNMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE +1LlSVHJ7liXMvGnjSG4N0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MX +QRBdJ3NghVdJIgc= +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global Certification Authority" +# Serial: 1846098327275375458322922162 +# MD5 Fingerprint: f8:1c:18:2d:2f:ba:5f:6d:a1:6c:bc:c7:ab:91:c7:0e +# SHA1 Fingerprint: 2f:8f:36:4f:e1:58:97:44:21:59:87:a5:2a:9a:d0:69:95:26:7f:b5 +# SHA256 Fingerprint: 97:55:20:15:f5:dd:fc:3c:87:88:c0:06:94:45:55:40:88:94:45:00:84:f1:00:86:70:86:bc:1a:2b:b5:8d:c8 +-----BEGIN CERTIFICATE----- +MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQsw +CQYDVQQGEwJVUzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28x +ITAfBgNVBAoMGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1 +c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMx +OTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJVUzERMA8GA1UECAwI +SWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2ZSBI +b2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZp +Y2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB +ALldUShLPDeS0YLOvR29zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0Xzn +swuvCAAJWX/NKSqIk4cXGIDtiLK0thAfLdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu +7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4BqstTnoApTAbqOl5F2brz8 +1Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9oWN0EACyW +80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotP +JqX+OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1l +RtzuzWniTY+HKE40Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfw +hI0Vcnyh78zyiGG69Gm7DIwLdVcEuE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10 +coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm+9jaJXLE9gCxInm943xZYkqc +BW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqjifLJS3tBEW1n +twiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud +EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1Ud +DwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W +0OhUKDtkLSGm+J1WE2pIPU/HPinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfe +uyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0HZJDmHvUqoai7PF35owgLEQzxPy0Q +lG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla4gt5kNdXElE1GYhB +aCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5RvbbE +sLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPT +MaCm/zjdzyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qe +qu5AvzSxnI9O4fKSTx+O856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxh +VicGaeVyQYHTtgGJoC86cnn+OjC/QezHYj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8 +h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu3R3y4G5OBVixwJAWKqQ9 +EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP29FpHOTK +yeC2nOnOcXHebD8WpHk= +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global ECC P256 Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global ECC P256 Certification Authority" +# Serial: 4151900041497450638097112925 +# MD5 Fingerprint: 5b:44:e3:8d:5d:36:86:26:e8:0d:05:d2:59:a7:83:54 +# SHA1 Fingerprint: b4:90:82:dd:45:0c:be:8b:5b:b1:66:d3:e2:a4:08:26:cd:ed:42:cf +# SHA256 Fingerprint: 94:5b:bc:82:5e:a5:54:f4:89:d1:fd:51:a7:3d:df:2e:a6:24:ac:70:19:a0:52:05:22:5c:22:a7:8c:cf:a8:b4 +-----BEGIN CERTIFICATE----- +MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYD +VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf +BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 +YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x +NzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYDVQQGEwJVUzERMA8G +A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 +d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF +Q0MgUDI1NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqG +SM49AwEHA0IABH77bOYj43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoN +FWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqmP62jQzBBMA8GA1UdEwEB/wQFMAMBAf8w +DwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt0UrrdaVKEJmzsaGLSvcw +CgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjzRM4q3wgh +DDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7 +-----END CERTIFICATE----- + +# Issuer: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. +# Subject: CN=Trustwave Global ECC P384 Certification Authority O=Trustwave Holdings, Inc. +# Label: "Trustwave Global ECC P384 Certification Authority" +# Serial: 2704997926503831671788816187 +# MD5 Fingerprint: ea:cf:60:c4:3b:b9:15:29:40:a1:97:ed:78:27:93:d6 +# SHA1 Fingerprint: e7:f3:a3:c8:cf:6f:c3:04:2e:6d:0e:67:32:c5:9e:68:95:0d:5e:d2 +# SHA256 Fingerprint: 55:90:38:59:c8:c0:c3:eb:b8:75:9e:ce:4e:25:57:22:5f:f5:75:8b:bd:38:eb:d4:82:76:60:1e:1b:d5:80:97 +-----BEGIN CERTIFICATE----- +MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYD +VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAf +BgNVBAoTGFRydXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3 +YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0x +NzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYDVQQGEwJVUzERMA8G +A1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0 +d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBF +Q0MgUDM4NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuB +BAAiA2IABGvaDXU1CDFHBa5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJ +j9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr/TklZvFe/oyujUF5nQlgziip04pt89ZF +1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwYAMB0G +A1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNnADBkAjA3 +AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC +MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu +Sw== +-----END CERTIFICATE----- + +# Issuer: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. +# Subject: CN=NAVER Global Root Certification Authority O=NAVER BUSINESS PLATFORM Corp. +# Label: "NAVER Global Root Certification Authority" +# Serial: 9013692873798656336226253319739695165984492813 +# MD5 Fingerprint: c8:7e:41:f6:25:3b:f5:09:b3:17:e8:46:3d:bf:d0:9b +# SHA1 Fingerprint: 8f:6b:f2:a9:27:4a:da:14:a0:c4:f4:8e:61:27:f9:c0:1e:78:5d:d1 +# SHA256 Fingerprint: 88:f4:38:dc:f8:ff:d1:fa:8f:42:91:15:ff:e5:f8:2a:e1:e0:6e:0c:70:c3:75:fa:ad:71:7b:34:a4:9e:72:65 +-----BEGIN CERTIFICATE----- +MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEM +BQAwaTELMAkGA1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRG +T1JNIENvcnAuMTIwMAYDVQQDDClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0 +aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4NDJaFw0zNzA4MTgyMzU5NTlaMGkx +CzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVTUyBQTEFURk9STSBD +b3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVA +iQqrDZBbUGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH +38dq6SZeWYp34+hInDEW+j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lE +HoSTGEq0n+USZGnQJoViAbbJAh2+g1G7XNr4rRVqmfeSVPc0W+m/6imBEtRTkZaz +kVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2aacp+yPOiNgSnABIqKYP +szuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4Yb8Obtoq +vC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHf +nZ3zVHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaG +YQ5fG8Ir4ozVu53BA0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo +0es+nPxdGoMuK8u180SdOqcXYZaicdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3a +CJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejyYhbLgGvtPe31HzClrkvJE+2K +AQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNVHQ4EFgQU0p+I +36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB +Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoN +qo0hV4/GPnrK21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatj +cu3cvuzHV+YwIHHW1xDBE1UBjCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm ++LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bxhYTeodoS76TiEJd6eN4MUZeoIUCL +hr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTgE34h5prCy8VCZLQe +lHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTHD8z7 +p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8 +piKCk5XQA76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLR +LBT/DShycpWbXgnbiUSYqqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX +5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oGI/hGoiLtk/bdmuYqh7GYVPEi92tF4+KO +dh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmgkpzNNIaRkPpkUZ3+/uul +9XXeifdy +-----END CERTIFICATE----- + +# Issuer: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres +# Subject: CN=AC RAIZ FNMT-RCM SERVIDORES SEGUROS O=FNMT-RCM OU=Ceres +# Label: "AC RAIZ FNMT-RCM SERVIDORES SEGUROS" +# Serial: 131542671362353147877283741781055151509 +# MD5 Fingerprint: 19:36:9c:52:03:2f:d2:d1:bb:23:cc:dd:1e:12:55:bb +# SHA1 Fingerprint: 62:ff:d9:9e:c0:65:0d:03:ce:75:93:d2:ed:3f:2d:32:c9:e3:e5:4a +# SHA256 Fingerprint: 55:41:53:b1:3d:2c:f9:dd:b7:53:bf:be:1a:4e:0a:e0:8d:0a:a4:18:70:58:fe:60:a2:b8:62:b2:e4:b8:7b:cb +-----BEGIN CERTIFICATE----- +MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQsw +CQYDVQQGEwJFUzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgw +FgYDVQRhDA9WQVRFUy1RMjgyNjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1S +Q00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4MTIyMDA5MzczM1oXDTQzMTIyMDA5 +MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQtUkNNMQ4wDAYDVQQL +DAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNBQyBS +QUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LH +sbI6GA60XYyzZl2hNPk2LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oK +Um8BA06Oi6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqGSM49BAMDA2kAMGYCMQCu +SuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoDzBOQn5IC +MQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJy +v+c= +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign Root R46 O=GlobalSign nv-sa +# Subject: CN=GlobalSign Root R46 O=GlobalSign nv-sa +# Label: "GlobalSign Root R46" +# Serial: 1552617688466950547958867513931858518042577 +# MD5 Fingerprint: c4:14:30:e4:fa:66:43:94:2a:6a:1b:24:5f:19:d0:ef +# SHA1 Fingerprint: 53:a2:b0:4b:ca:6b:d6:45:e6:39:8a:8e:c4:0d:d2:bf:77:c3:a2:90 +# SHA256 Fingerprint: 4f:a3:12:6d:8d:3a:11:d1:c4:85:5a:4f:80:7c:ba:d6:cf:91:9d:3a:5a:88:b0:3b:ea:2c:63:72:d9:3c:40:c9 +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUA +MEYxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYD +VQQDExNHbG9iYWxTaWduIFJvb3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMy +MDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYt +c2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08EsCVeJ +OaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQG +vGIFAha/r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud +316HCkD7rRlr+/fKYIje2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo +0q3v84RLHIf8E6M6cqJaESvWJ3En7YEtbWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSE +y132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvjK8Cd+RTyG/FWaha/LIWF +zXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD412lPFzYE ++cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCN +I/onccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzs +x2sZy/N78CsHpdlseVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqa +ByFrgY/bxFn63iLABJzjqls2k+g9vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC +4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEMBQADggIBAHx4 +7PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg +JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti +2kM3S+LGteWygxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIk +pnnpHs6i58FZFZ8d4kuaPp92CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRF +FRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZmOUdkLG5NrmJ7v2B0GbhWrJKsFjLt +rWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qqJZ4d16GLuc1CLgSk +ZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwyeqiv5 +u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP +4vkYxboznxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6 +N3ec592kD3ZDZopD8p/7DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3 +vouXsXgxT7PntgMTzlSdriVZzH81Xwj3QEUxeCp6 +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign Root E46 O=GlobalSign nv-sa +# Subject: CN=GlobalSign Root E46 O=GlobalSign nv-sa +# Label: "GlobalSign Root E46" +# Serial: 1552617690338932563915843282459653771421763 +# MD5 Fingerprint: b5:b8:66:ed:de:08:83:e3:c9:e2:01:34:06:ac:51:6f +# SHA1 Fingerprint: 39:b4:6c:d5:fe:80:06:eb:e2:2f:4a:bb:08:33:a0:af:db:b9:dd:84 +# SHA256 Fingerprint: cb:b9:c4:4d:84:b8:04:3e:10:50:ea:31:a6:9f:51:49:55:d7:bf:d2:e2:c6:b4:93:01:01:9a:d6:1d:9f:50:58 +-----BEGIN CERTIFICATE----- +MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYx +CzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQD +ExNHbG9iYWxTaWduIFJvb3QgRTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAw +MDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2Ex +HDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkBjtjq +R+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGdd +yXqBPCCjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud +DgQWBBQxCpCPtsad0kRLgLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ +7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZkvLtoURMMA/cVi4RguYv/Uo7njLwcAjA8 ++RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+CAezNIm8BZ/3Hobui3A= +-----END CERTIFICATE----- + +# Issuer: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH +# Subject: CN=GLOBALTRUST 2020 O=e-commerce monitoring GmbH +# Label: "GLOBALTRUST 2020" +# Serial: 109160994242082918454945253 +# MD5 Fingerprint: 8a:c7:6f:cb:6d:e3:cc:a2:f1:7c:83:fa:0e:78:d7:e8 +# SHA1 Fingerprint: d0:67:c1:13:51:01:0c:aa:d0:c7:6a:65:37:31:16:26:4f:53:71:a2 +# SHA256 Fingerprint: 9a:29:6a:51:82:d1:d4:51:a2:e3:7f:43:9b:74:da:af:a2:67:52:33:29:f9:0f:9a:0d:20:07:c3:34:e2:3c:9a +-----BEGIN CERTIFICATE----- +MIIFgjCCA2qgAwIBAgILWku9WvtPilv6ZeUwDQYJKoZIhvcNAQELBQAwTTELMAkG +A1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9uaXRvcmluZyBHbWJIMRkw +FwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMB4XDTIwMDIxMDAwMDAwMFoXDTQwMDYx +MDAwMDAwMFowTTELMAkGA1UEBhMCQVQxIzAhBgNVBAoTGmUtY29tbWVyY2UgbW9u +aXRvcmluZyBHbWJIMRkwFwYDVQQDExBHTE9CQUxUUlVTVCAyMDIwMIICIjANBgkq +hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAri5WrRsc7/aVj6B3GyvTY4+ETUWiD59b +RatZe1E0+eyLinjF3WuvvcTfk0Uev5E4C64OFudBc/jbu9G4UeDLgztzOG53ig9Z +YybNpyrOVPu44sB8R85gfD+yc/LAGbaKkoc1DZAoouQVBGM+uq/ufF7MpotQsjj3 +QWPKzv9pj2gOlTblzLmMCcpL3TGQlsjMH/1WljTbjhzqLL6FLmPdqqmV0/0plRPw +yJiT2S0WR5ARg6I6IqIoV6Lr/sCMKKCmfecqQjuCgGOlYx8ZzHyyZqjC0203b+J+ +BlHZRYQfEs4kUmSFC0iAToexIiIwquuuvuAC4EDosEKAA1GqtH6qRNdDYfOiaxaJ +SaSjpCuKAsR49GiKweR6NrFvG5Ybd0mN1MkGco/PU+PcF4UgStyYJ9ORJitHHmkH +r96i5OTUawuzXnzUJIBHKWk7buis/UDr2O1xcSvy6Fgd60GXIsUf1DnQJ4+H4xj0 +4KlGDfV0OoIu0G4skaMxXDtG6nsEEFZegB31pWXogvziB4xiRfUg3kZwhqG8k9Me +dKZssCz3AwyIDMvUclOGvGBG85hqwvG/Q/lwIHfKN0F5VVJjjVsSn8VoxIidrPIw +q7ejMZdnrY8XD2zHc+0klGvIg5rQmjdJBKuxFshsSUktq6HQjJLyQUp5ISXbY9e2 +nKd+Qmn7OmMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC +AQYwHQYDVR0OBBYEFNwuH9FhN3nkq9XVsxJxaD1qaJwiMB8GA1UdIwQYMBaAFNwu +H9FhN3nkq9XVsxJxaD1qaJwiMA0GCSqGSIb3DQEBCwUAA4ICAQCR8EICaEDuw2jA +VC/f7GLDw56KoDEoqoOOpFaWEhCGVrqXctJUMHytGdUdaG/7FELYjQ7ztdGl4wJC +XtzoRlgHNQIw4Lx0SsFDKv/bGtCwr2zD/cuz9X9tAy5ZVp0tLTWMstZDFyySCstd +6IwPS3BD0IL/qMy/pJTAvoe9iuOTe8aPmxadJ2W8esVCgmxcB9CpwYhgROmYhRZf ++I/KARDOJcP5YBugxZfD0yyIMaK9MOzQ0MAS8cE54+X1+NZK3TTN+2/BT+MAi1bi +kvcoskJ3ciNnxz8RFbLEAwW+uxF7Cr+obuf/WEPPm2eggAe2HcqtbepBEX4tdJP7 +wry+UUTF72glJ4DjyKDUEuzZpTcdN3y0kcra1LGWge9oXHYQSa9+pTeAsRxSvTOB +TI/53WXZFM2KJVj04sWDpQmQ1GwUY7VA3+vA/MRYfg0UFodUJ25W5HCEuGwyEn6C +MUO+1918oa2u1qsgEu8KwxCMSZY13At1XrFP1U80DhEgB3VDRemjEdqso5nCtnkn +4rnvyOL2NSl6dPrFf4IFYqYK6miyeUcGbvJXqBUzxvd4Sj1Ce2t+/vdG6tHrju+I +aFvowdlxfv1k7/9nR4hYJS8+hge9+6jlgqispdNpQ80xiEmEU5LAsTkbOYMBMMTy +qfrQA71yN2BWHzZ8vTmR9W0Nv3vXkg== +-----END CERTIFICATE----- + +# Issuer: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz +# Subject: CN=ANF Secure Server Root CA O=ANF Autoridad de Certificacion OU=ANF CA Raiz +# Label: "ANF Secure Server Root CA" +# Serial: 996390341000653745 +# MD5 Fingerprint: 26:a6:44:5a:d9:af:4e:2f:b2:1d:b6:65:b0:4e:e8:96 +# SHA1 Fingerprint: 5b:6e:68:d0:cc:15:b6:a0:5f:1e:c1:5f:ae:02:fc:6b:2f:5d:6f:74 +# SHA256 Fingerprint: fb:8f:ec:75:91:69:b9:10:6b:1e:51:16:44:c6:18:c5:13:04:37:3f:6c:06:43:08:8d:8b:ef:fd:1b:99:75:99 +-----BEGIN CERTIFICATE----- +MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNV +BAUTCUc2MzI4NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlk +YWQgZGUgQ2VydGlmaWNhY2lvbjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNV +BAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3QgQ0EwHhcNMTkwOTA0MTAwMDM4WhcN +MzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEwMQswCQYDVQQGEwJF +UzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQwEgYD +VQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9v +dCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCj +cqQZAZ2cC4Ffc0m6p6zzBE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9q +yGFOtibBTI3/TO80sh9l2Ll49a2pcbnvT1gdpd50IJeh7WhM3pIXS7yr/2WanvtH +2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcvB2VSAKduyK9o7PQUlrZX +H1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXsezx76W0OL +zc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyR +p1RMVwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQz +W7i1o0TJrH93PB0j7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/ +SiOL9V8BY9KHcyi1Swr1+KuCLH5zJTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJn +LNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe8TZBAQIvfXOn3kLMTOmJDVb3 +n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVOHj1tyRRM4y5B +u8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj +o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC +AgEATh65isagmD9uw2nAalxJUqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L +9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzxj6ptBZNscsdW699QIyjlRRA96Gej +rw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDtdD+4E5UGUcjohybK +pFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM5gf0 +vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjq +OknkJjCb5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ +/zo1PqVUSlJZS2Db7v54EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ9 +2zg/LFis6ELhDtjTO0wugumDLmsx2d1Hhk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI ++PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGyg77FGr8H6lnco4g175x2 +MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3r5+qPeoo +tt7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw= +-----END CERTIFICATE----- + +# Issuer: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Subject: CN=Certum EC-384 CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Label: "Certum EC-384 CA" +# Serial: 160250656287871593594747141429395092468 +# MD5 Fingerprint: b6:65:b3:96:60:97:12:a1:ec:4e:e1:3d:a3:c6:c9:f1 +# SHA1 Fingerprint: f3:3e:78:3c:ac:df:f4:a2:cc:ac:67:55:69:56:d7:e5:16:3c:e1:ed +# SHA256 Fingerprint: 6b:32:80:85:62:53:18:aa:50:d1:73:c9:8d:8b:da:09:d5:7e:27:41:3d:11:4c:f7:87:a0:f5:d0:6c:03:0c:f6 +-----BEGIN CERTIFICATE----- +MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQsw +CQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScw +JQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMT +EENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2MDcyNDU0WhcNNDMwMzI2MDcyNDU0 +WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBT +LkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGTAX +BgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATE +KI6rGFtqvm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7Tm +Fy8as10CW4kjPMIRBSqniBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68Kj +QjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI0GZnQkdjrzife81r1HfS+8 +EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjADVS2m5hjEfO/J +UG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0QoSZ/6vn +nvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k= +-----END CERTIFICATE----- + +# Issuer: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Subject: CN=Certum Trusted Root CA O=Asseco Data Systems S.A. OU=Certum Certification Authority +# Label: "Certum Trusted Root CA" +# Serial: 40870380103424195783807378461123655149 +# MD5 Fingerprint: 51:e1:c2:e7:fe:4c:84:af:59:0e:2f:f4:54:6f:ea:29 +# SHA1 Fingerprint: c8:83:44:c0:18:ae:9f:cc:f1:87:b7:8f:22:d1:c5:d7:45:84:ba:e5 +# SHA256 Fingerprint: fe:76:96:57:38:55:77:3e:37:a9:5e:7a:d4:d9:cc:96:c3:01:57:c1:5d:31:76:5b:a9:b1:57:04:e1:ae:78:fd +-----BEGIN CERTIFICATE----- +MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6 +MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEu +MScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNV +BAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwHhcNMTgwMzE2MTIxMDEzWhcNNDMw +MzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEg +U3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRo +b3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZ +n0EGze2jusDbCSzBfN8pfktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/q +p1x4EaTByIVcJdPTsuclzxFUl6s1wB52HO8AU5853BSlLCIls3Jy/I2z5T4IHhQq +NwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2fJmItdUDmj0VDT06qKhF +8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGtg/BKEiJ3 +HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGa +mqi4NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi +7VdNIuJGmj8PkTQkfVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSF +ytKAQd8FqKPVhJBPC/PgP5sZ0jeJP/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0P +qafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSYnjYJdmZm/Bo/6khUHL4wvYBQ +v3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHKHRzQ+8S1h9E6 +Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1 +vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQAD +ggIBAEii1QALLtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4 +WxmB82M+w85bj/UvXgF2Ez8sALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvo +zMrnadyHncI013nR03e4qllY/p0m+jiGPp2Kh2RX5Rc64vmNueMzeMGQ2Ljdt4NR +5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8CYyqOhNf6DR5UMEQ +GfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA4kZf +5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq +0Uc9NneoWWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7D +P78v3DSk+yshzWePS/Tj6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTM +qJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmTOPQD8rv7gmsHINFSH5pkAnuYZttcTVoP +0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZckbxJF0WddCajJFdr60qZf +E2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb +-----END CERTIFICATE----- + +# Issuer: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique +# Subject: CN=TunTrust Root CA O=Agence Nationale de Certification Electronique +# Label: "TunTrust Root CA" +# Serial: 108534058042236574382096126452369648152337120275 +# MD5 Fingerprint: 85:13:b9:90:5b:36:5c:b6:5e:b8:5a:f8:e0:31:57:b4 +# SHA1 Fingerprint: cf:e9:70:84:0f:e0:73:0f:9d:f6:0c:7f:2c:4b:ee:20:46:34:9c:bb +# SHA256 Fingerprint: 2e:44:10:2a:b5:8c:b8:54:19:45:1c:8e:19:d9:ac:f3:66:2c:af:bc:61:4b:6a:53:96:0a:30:f7:d0:e2:eb:41 +-----BEGIN CERTIFICATE----- +MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQEL +BQAwYTELMAkGA1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUg +Q2VydGlmaWNhdGlvbiBFbGVjdHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJv +b3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQwNDI2MDg1NzU2WjBhMQswCQYDVQQG +EwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBDZXJ0aWZpY2F0aW9u +IEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIwDQYJ +KoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZ +n56eY+hz2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd +2JQDoOw05TDENX37Jk0bbjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgF +VwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZ +GoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAdgjH8KcwAWJeRTIAAHDOF +li/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViWVSHbhlnU +r8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2 +eY8fTpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIb +MlEsPvLfe/ZdeikZjuXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISg +jwBUFfyRbVinljvrS5YnzWuioYasDXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB +7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwSVXAkPcvCFDVDXSdOvsC9qnyW +5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI04Y+oXNZtPdE +ITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0 +90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+z +xiD2BkewhpMl0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYu +QEkHDVneixCwSQXi/5E/S7fdAo74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4 +FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRYYdZ2vyJ/0Adqp2RT8JeNnYA/u8EH +22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJpadbGNjHh/PqAulxP +xOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65xxBzn +dFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5 +Xc0yGYuPjCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7b +nV2UqL1g52KAdoGDDIzMMEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQ +CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH +u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj +d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o= +-----END CERTIFICATE----- + +# Issuer: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Subject: CN=HARICA TLS RSA Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Label: "HARICA TLS RSA Root CA 2021" +# Serial: 76817823531813593706434026085292783742 +# MD5 Fingerprint: 65:47:9b:58:86:dd:2c:f0:fc:a2:84:1f:1e:96:c4:91 +# SHA1 Fingerprint: 02:2d:05:82:fa:88:ce:14:0c:06:79:de:7f:14:10:e9:45:d7:a5:6d +# SHA256 Fingerprint: d9:5d:0e:8e:da:79:52:5b:f9:be:b1:1b:14:d2:10:0d:32:94:98:5f:0c:62:d9:fa:bd:9c:d9:99:ec:cb:7b:1d +-----BEGIN CERTIFICATE----- +MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBs +MQswCQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl +c2VhcmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0Eg +Um9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUzOFoXDTQ1MDIxMzEwNTUzN1owbDEL +MAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl +YXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNBIFJv +b3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569l +mwVnlskNJLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE +4VGC/6zStGndLuwRo0Xua2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uv +a9of08WRiFukiZLRgeaMOVig1mlDqa2YUlhu2wr7a89o+uOkXjpFc5gH6l8Cct4M +pbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K5FrZx40d/JiZ+yykgmvw +Kh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEvdmn8kN3b +LW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcY +AuUR0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqB +AGMUuTNe3QvboEUHGjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYq +E613TBoYm5EPWNgGVMWX+Ko/IIqmhaZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHr +W2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQCPxrvrNQKlr9qEgYRtaQQJKQ +CoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAU +X15QvWiWkKQUEapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3 +f5Z2EMVGpdAgS1D0NTsY9FVqQRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxaja +H6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxDQpSbIPDRzbLrLFPCU3hKTwSUQZqP +JzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcRj88YxeMn/ibvBZ3P +zzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5vZSt +jBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0 +/L5H9MG0qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pT +BGIBnfHAT+7hOtSLIBD6Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79 +aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW +xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU +63ZTGI0RmLo= +-----END CERTIFICATE----- + +# Issuer: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Subject: CN=HARICA TLS ECC Root CA 2021 O=Hellenic Academic and Research Institutions CA +# Label: "HARICA TLS ECC Root CA 2021" +# Serial: 137515985548005187474074462014555733966 +# MD5 Fingerprint: ae:f7:4c:e5:66:35:d1:b7:9b:8c:22:93:74:d3:4b:b0 +# SHA1 Fingerprint: bc:b0:c1:9d:e9:98:92:70:19:38:57:e9:8d:a7:b4:5d:6e:ee:01:48 +# SHA256 Fingerprint: 3f:99:cc:47:4a:cf:ce:4d:fe:d5:87:94:66:5e:47:8d:15:47:73:9f:2e:78:0f:1b:b4:ca:9b:13:30:97:d4:01 +-----BEGIN CERTIFICATE----- +MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQsw +CQYDVQQGEwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2Vh +cmNoIEluc3RpdHV0aW9ucyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9v +dCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoXDTQ1MDIxMzExMDEwOVowbDELMAkG +A1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj +aCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJvb3Qg +Q0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7 +KKrxcm1lAEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9Y +STHMmE5gEYd103KUkE+bECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQD +AgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAircJRQO9gcS3ujwLEXQNw +SaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/QwCZ61IygN +nxS2PFOiTAZpffpskcYqSUXm7LcT4Tps +-----END CERTIFICATE----- + +# Issuer: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Subject: CN=Autoridad de Certificacion Firmaprofesional CIF A62634068 +# Label: "Autoridad de Certificacion Firmaprofesional CIF A62634068" +# Serial: 1977337328857672817 +# MD5 Fingerprint: 4e:6e:9b:54:4c:ca:b7:fa:48:e4:90:b1:15:4b:1c:a3 +# SHA1 Fingerprint: 0b:be:c2:27:22:49:cb:39:aa:db:35:5c:53:e3:8c:ae:78:ff:b6:fe +# SHA256 Fingerprint: 57:de:05:83:ef:d2:b2:6e:03:61:da:99:da:9d:f4:64:8d:ef:7e:e8:44:1c:3b:72:8a:fa:9b:cd:e0:f9:b2:6a +-----BEGIN CERTIFICATE----- +MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UE +BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h +cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1 +MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg +Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 +thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM +cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG +L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i +NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h +X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b +m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy +Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja +EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T +KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF +6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh +OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1UdDgQWBBRlzeurNR4APn7VdMAc +tHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4wgZswgZgGBFUd +IAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j +b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABC +AG8AbgBhAG4AbwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAw +ADEANzAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9m +iWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL4QjbEwj4KKE1soCzC1HA01aajTNF +Sa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDbLIpgD7dvlAceHabJ +hfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1ilI45P +Vf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZE +EAEeiGaPcjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV +1aUsIC+nmCjuRfzxuIgALI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2t +CsvMo2ebKHTEm9caPARYpoKdrcd7b/+Alun4jWq9GJAd/0kakFI3ky88Al2CdgtR +5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH9IBk9W6VULgRfhVwOEqw +f9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpfNIbnYrX9 +ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNK +GbqEZycPvEJdvSRUDewdcAZfpLz6IHxV +-----END CERTIFICATE----- + +# Issuer: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. +# Subject: CN=vTrus ECC Root CA O=iTrusChina Co.,Ltd. +# Label: "vTrus ECC Root CA" +# Serial: 630369271402956006249506845124680065938238527194 +# MD5 Fingerprint: de:4b:c1:f5:52:8c:9b:43:e1:3e:8f:55:54:17:8d:85 +# SHA1 Fingerprint: f6:9c:db:b0:fc:f6:02:13:b6:52:32:a6:a3:91:3f:16:70:da:c3:e1 +# SHA256 Fingerprint: 30:fb:ba:2c:32:23:8e:2a:98:54:7a:f9:79:31:e5:50:42:8b:9b:3f:1c:8e:eb:66:33:dc:fa:86:c5:b2:7d:d3 +-----BEGIN CERTIFICATE----- +MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMw +RzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAY +BgNVBAMTEXZUcnVzIEVDQyBSb290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDcz +MTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28u +LEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYwEAYHKoZIzj0CAQYF +K4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+cToL0 +v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUd +e4BdS49nTPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYD +VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIw +V53dVvHH4+m4SVBrm2nDb+zDfSXkV5UTQJtS0zvzQBm8JsctBp61ezaf9SXUY2sA +AjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQLYgmRWAD5Tfs0aNoJrSEG +GJTO +-----END CERTIFICATE----- + +# Issuer: CN=vTrus Root CA O=iTrusChina Co.,Ltd. +# Subject: CN=vTrus Root CA O=iTrusChina Co.,Ltd. +# Label: "vTrus Root CA" +# Serial: 387574501246983434957692974888460947164905180485 +# MD5 Fingerprint: b8:c9:37:df:fa:6b:31:84:64:c5:ea:11:6a:1b:75:fc +# SHA1 Fingerprint: 84:1a:69:fb:f5:cd:1a:25:34:13:3d:e3:f8:fc:b8:99:d0:c9:14:b7 +# SHA256 Fingerprint: 8a:71:de:65:59:33:6f:42:6c:26:e5:38:80:d0:0d:88:a1:8d:a4:c6:a9:1f:0d:cb:61:94:e2:06:c5:c9:63:87 +-----BEGIN CERTIFICATE----- +MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQEL +BQAwQzELMAkGA1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4x +FjAUBgNVBAMTDXZUcnVzIFJvb3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMx +MDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoGA1UEChMTaVRydXNDaGluYSBDby4s +THRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZotsSKYc +IrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykU +AyyNJJrIZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+ +GrPSbcKvdmaVayqwlHeFXgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z9 +8Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KAYPxMvDVTAWqXcoKv8R1w6Jz1717CbMdH +flqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70kLJrxLT5ZOrpGgrIDajt +J8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2AXPKBlim +0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZN +pGvu/9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQ +UqqzApVg+QxMaPnu1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHW +OXSuTEGC2/KmSNGzm/MzqvOmwMVO9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMB +AAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYgscasGrz2iTAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAKbqSSaet +8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd +nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1j +bhd47F18iMjrjld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvM +Kar5CKXiNxTKsbhm7xqC5PD48acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIiv +TDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJnxDHO2zTlJQNgJXtxmOTAGytfdELS +S8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554WgicEFOwE30z9J4nfr +I8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4sEb9 +b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNB +UvupLnKWnyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1P +Ti07NEPhmg4NpGaXutIcSkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929ven +sBxXVsFy6K2ir40zSbofitzmdHxghm+Hl3s= +-----END CERTIFICATE----- + +# Issuer: CN=ISRG Root X2 O=Internet Security Research Group +# Subject: CN=ISRG Root X2 O=Internet Security Research Group +# Label: "ISRG Root X2" +# Serial: 87493402998870891108772069816698636114 +# MD5 Fingerprint: d3:9e:c4:1e:23:3c:a6:df:cf:a3:7e:6d:e0:14:e6:e5 +# SHA1 Fingerprint: bd:b1:b9:3c:d5:97:8d:45:c6:26:14:55:f8:db:95:c7:5a:d1:53:af +# SHA256 Fingerprint: 69:72:9b:8e:15:a8:6e:fc:17:7a:57:af:b7:17:1d:fc:64:ad:d2:8c:2f:ca:8c:f1:50:7e:34:45:3c:cb:14:70 +-----BEGIN CERTIFICATE----- +MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw +CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg +R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 +MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT +ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw +EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW ++1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 +ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI +zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW +tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 +/q4AaOeMSQ+2b1tbFfLn +-----END CERTIFICATE----- + +# Issuer: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. +# Subject: CN=HiPKI Root CA - G1 O=Chunghwa Telecom Co., Ltd. +# Label: "HiPKI Root CA - G1" +# Serial: 60966262342023497858655262305426234976 +# MD5 Fingerprint: 69:45:df:16:65:4b:e8:68:9a:8f:76:5f:ff:80:9e:d3 +# SHA1 Fingerprint: 6a:92:e4:a8:ee:1b:ec:96:45:37:e3:29:57:49:cd:96:e3:e5:d2:60 +# SHA256 Fingerprint: f0:15:ce:3c:c2:39:bf:ef:06:4b:e9:f1:d2:c4:17:e1:a0:26:4a:0a:94:be:1f:0c:8d:12:18:64:eb:69:49:cc +-----BEGIN CERTIFICATE----- +MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBP +MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 +ZC4xGzAZBgNVBAMMEkhpUEtJIFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRa +Fw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3 +YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kgUm9vdCBDQSAtIEcx +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0o9Qw +qNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twv +Vcg3Px+kwJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6 +lZgRZq2XNdZ1AYDgr/SEYYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnz +Qs7ZngyzsHeXZJzA9KMuH5UHsBffMNsAGJZMoYFL3QRtU6M9/Aes1MU3guvklQgZ +KILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfdhSi8MEyr48KxRURHH+CK +FgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj1jOXTyFj +HluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDr +y+K49a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ +/W3c1pzAtH2lsN0/Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgM +a/aOEmem8rJY5AIJEzypuxC00jBF8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6 +fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQDAgGGMA0GCSqG +SIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi +7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqc +SE5XCV0vrPSltJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6Fza +ZsT0pPBWGTMpWmWSBUdGSquEwx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9Tc +XzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07QJNBAsNB1CI69aO4I1258EHBGG3zg +iLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv5wiZqAxeJoBF1Pho +L5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+GpzjLrF +Ne85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wr +kkVbbiVghUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+ +vhV4nYWBSipX3tUZQ9rbyltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQU +YDksswBVLuT1sw5XxJFBAJw/6KXf6vb/yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ== +-----END CERTIFICATE----- + +# Issuer: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 +# Subject: CN=GlobalSign O=GlobalSign OU=GlobalSign ECC Root CA - R4 +# Label: "GlobalSign ECC Root CA - R4" +# Serial: 159662223612894884239637590694 +# MD5 Fingerprint: 26:29:f8:6d:e1:88:bf:a2:65:7f:aa:c4:cd:0f:7f:fc +# SHA1 Fingerprint: 6b:a0:b0:98:e1:71:ef:5a:ad:fe:48:15:80:77:10:f4:bd:6f:0b:28 +# SHA256 Fingerprint: b0:85:d7:0b:96:4f:19:1a:73:e4:af:0d:54:ae:7a:0e:07:aa:fd:af:9b:71:dd:08:62:13:8a:b7:32:5a:24:a2 +-----BEGIN CERTIFICATE----- +MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYD +VQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2Jh +bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgw +MTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9iYWxTaWduIEVDQyBSb290IENBIC0g +UjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wWTAT +BgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkWymOx +uYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNV +HQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/ ++wpu+74zyTyjhNUwCgYIKoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147 +bmF0774BxL4YSFlhgjICICadVGNA3jdgUM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R1 O=Google Trust Services LLC +# Subject: CN=GTS Root R1 O=Google Trust Services LLC +# Label: "GTS Root R1" +# Serial: 159662320309726417404178440727 +# MD5 Fingerprint: 05:fe:d0:bf:71:a8:a3:76:63:da:01:e0:d8:52:dc:40 +# SHA1 Fingerprint: e5:8c:1c:c4:91:3b:38:63:4b:e9:10:6e:e3:ad:8e:6b:9d:d9:81:4a +# SHA256 Fingerprint: d9:47:43:2a:bd:e7:b7:fa:90:fc:2e:6b:59:10:1b:12:80:e0:e1:c7:e4:e4:0f:a3:c6:88:7f:ff:57:a7:f4:cf +-----BEGIN CERTIFICATE----- +MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw +CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU +MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw +MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp +Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo +27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w +Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw +TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl +qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH +szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8 +Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk +MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92 +wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p +aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN +VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID +AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb +C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe +QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy +h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4 +7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J +ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef +MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/ +Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT +6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ +0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm +2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb +bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R2 O=Google Trust Services LLC +# Subject: CN=GTS Root R2 O=Google Trust Services LLC +# Label: "GTS Root R2" +# Serial: 159662449406622349769042896298 +# MD5 Fingerprint: 1e:39:c0:53:e6:1e:29:82:0b:ca:52:55:36:5d:57:dc +# SHA1 Fingerprint: 9a:44:49:76:32:db:de:fa:d0:bc:fb:5a:7b:17:bd:9e:56:09:24:94 +# SHA256 Fingerprint: 8d:25:cd:97:22:9d:bf:70:35:6b:da:4e:b3:cc:73:40:31:e2:4c:f0:0f:af:cf:d3:2d:c7:6e:b5:84:1c:7e:a8 +-----BEGIN CERTIFICATE----- +MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw +CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU +MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw +MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp +Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA +A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt +nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY +6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu +MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k +RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg +f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV ++3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo +dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW +Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa +G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq +gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID +AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H +vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8 +0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC +B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u +NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg +yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev +HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6 +xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR +TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg +JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV +7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl +6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R3 O=Google Trust Services LLC +# Subject: CN=GTS Root R3 O=Google Trust Services LLC +# Label: "GTS Root R3" +# Serial: 159662495401136852707857743206 +# MD5 Fingerprint: 3e:e7:9d:58:02:94:46:51:94:e5:e0:22:4a:8b:e7:73 +# SHA1 Fingerprint: ed:e5:71:80:2b:c8:92:b9:5b:83:3c:d2:32:68:3f:09:cd:a0:1e:46 +# SHA256 Fingerprint: 34:d8:a7:3e:e2:08:d9:bc:db:0d:95:65:20:93:4b:4e:40:e6:94:82:59:6e:8b:6f:73:c8:42:6b:01:0a:6f:48 +-----BEGIN CERTIFICATE----- +MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYD +VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG +A1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw +WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz +IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNi +AAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout736G +jOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL2 +4CejQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7 +VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azTL818+FsuVbu/3ZL3pAzcMeGiAjEA/Jdm +ZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV11RZt+cRLInUue4X +-----END CERTIFICATE----- + +# Issuer: CN=GTS Root R4 O=Google Trust Services LLC +# Subject: CN=GTS Root R4 O=Google Trust Services LLC +# Label: "GTS Root R4" +# Serial: 159662532700760215368942768210 +# MD5 Fingerprint: 43:96:83:77:19:4d:76:b3:9d:65:52:e4:1d:22:a5:e8 +# SHA1 Fingerprint: 77:d3:03:67:b5:e0:0c:15:f6:0c:38:61:df:7c:e1:3b:92:46:4d:47 +# SHA256 Fingerprint: 34:9d:fa:40:58:c5:e2:63:12:3b:39:8a:e7:95:57:3c:4e:13:13:c8:3f:e6:8f:93:55:6c:d5:e8:03:1b:3c:7d +-----BEGIN CERTIFICATE----- +MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD +VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG +A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw +WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz +IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi +AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi +QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR +HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D +9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8 +p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD +-----END CERTIFICATE----- + +# Issuer: CN=Telia Root CA v2 O=Telia Finland Oyj +# Subject: CN=Telia Root CA v2 O=Telia Finland Oyj +# Label: "Telia Root CA v2" +# Serial: 7288924052977061235122729490515358 +# MD5 Fingerprint: 0e:8f:ac:aa:82:df:85:b1:f4:dc:10:1c:fc:99:d9:48 +# SHA1 Fingerprint: b9:99:cd:d1:73:50:8a:c4:47:05:08:9c:8c:88:fb:be:a0:2b:40:cd +# SHA256 Fingerprint: 24:2b:69:74:2f:cb:1e:5b:2a:bf:98:89:8b:94:57:21:87:54:4e:5b:4d:99:11:78:65:73:62:1f:6a:74:b8:2c +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQx +CzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UE +AwwQVGVsaWEgUm9vdCBDQSB2MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1 +NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZ +MBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ76zBq +AMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9 +vVYiQJ3q9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9 +lRdU2HhE8Qx3FZLgmEKnpNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTOD +n3WhUidhOPFZPY5Q4L15POdslv5e2QJltI5c0BE0312/UqeBAMN/mUWZFdUXyApT +7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW5olWK8jjfN7j/4nlNW4o +6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNrRBH0pUPC +TEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6 +WT0EBXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63R +DolUK5X6wK0dmBR4M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZI +pEYslOqodmJHixBTB0hXbOKSTbauBcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGj +YzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7Wxy+G2CQ5MB0GA1UdDgQWBBRy +rOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw +AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ +8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi +0f6X+J8wfBj5tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMM +A8iZGok1GTzTyVR8qPAs5m4HeW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBS +SRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+Cy748fdHif64W1lZYudogsYMVoe+K +TTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygCQMez2P2ccGrGKMOF +6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15h2Er +3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMt +Ty3EHD70sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pT +VmBds9hCG1xLEooc6+t9xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAW +ysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQraVplI/owd8k+BsHMYeB2F326CjYSlKA +rBPuUBQemMc= +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH +# Subject: CN=D-TRUST BR Root CA 1 2020 O=D-Trust GmbH +# Label: "D-TRUST BR Root CA 1 2020" +# Serial: 165870826978392376648679885835942448534 +# MD5 Fingerprint: b5:aa:4b:d5:ed:f7:e3:55:2e:8f:72:0a:f3:75:b8:ed +# SHA1 Fingerprint: 1f:5b:98:f0:e3:b5:f7:74:3c:ed:e6:b0:36:7d:32:cd:f4:09:41:67 +# SHA256 Fingerprint: e5:9a:aa:81:60:09:c2:2b:ff:5b:25:ba:d3:7d:f3:06:f0:49:79:7c:1f:81:d8:5a:b0:89:e6:57:bd:8f:00:44 +-----BEGIN CERTIFICATE----- +MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQsw +CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS +VVNUIEJSIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5 +NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG +A1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB +BAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7dPYS +zuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0 +QVK5buXuQqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/ +VbNafAkl1bK6CKBrqx9tMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g +PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2JyX3Jvb3Rf +Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l +dC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 +c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO +PQQDAwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFW +wKrY7RjEsK70PvomAjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHV +dWNbFJWcHwHP2NVypw87 +-----END CERTIFICATE----- + +# Issuer: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH +# Subject: CN=D-TRUST EV Root CA 1 2020 O=D-Trust GmbH +# Label: "D-TRUST EV Root CA 1 2020" +# Serial: 126288379621884218666039612629459926992 +# MD5 Fingerprint: 8c:2d:9d:70:9f:48:99:11:06:11:fb:e9:cb:30:c0:6e +# SHA1 Fingerprint: 61:db:8c:21:59:69:03:90:d8:7c:9c:12:86:54:cf:9d:3d:f4:dd:07 +# SHA256 Fingerprint: 08:17:0d:1a:a3:64:53:90:1a:2f:95:92:45:e3:47:db:0c:8d:37:ab:aa:bc:56:b8:1a:a1:00:dc:95:89:70:db +-----BEGIN CERTIFICATE----- +MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw +CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS +VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5 +NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG +A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB +BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC +/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD +wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3 +OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g +PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf +Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l +dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1 +c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO +PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA +y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb +gfM0agPnIjhQW+0ZT0MW +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. +# Subject: CN=DigiCert TLS ECC P384 Root G5 O=DigiCert, Inc. +# Label: "DigiCert TLS ECC P384 Root G5" +# Serial: 13129116028163249804115411775095713523 +# MD5 Fingerprint: d3:71:04:6a:43:1c:db:a6:59:e1:a8:a3:aa:c5:71:ed +# SHA1 Fingerprint: 17:f3:de:5e:9f:0f:19:e9:8e:f6:1f:32:26:6e:20:c4:07:ae:30:ee +# SHA256 Fingerprint: 01:8e:13:f0:77:25:32:cf:80:9b:d1:b1:72:81:86:72:83:fc:48:c6:e1:3b:e9:c6:98:12:85:4a:49:0c:1b:05 +-----BEGIN CERTIFICATE----- +MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURp +Z2lDZXJ0IFRMUyBFQ0MgUDM4NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2 +MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJ +bmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQgUm9vdCBHNTB2MBAG +ByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1TzvdlHJS +7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp +0zVozptjn4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICIS +B4CIfBFqMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49 +BAMDA2gAMGUCMQCJao1H5+z8blUD2WdsJk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQ +LgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIxAJSdYsiJvRmEFOml+wG4 +DXZDjC5Ty3zfDBeWUA== +-----END CERTIFICATE----- + +# Issuer: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. +# Subject: CN=DigiCert TLS RSA4096 Root G5 O=DigiCert, Inc. +# Label: "DigiCert TLS RSA4096 Root G5" +# Serial: 11930366277458970227240571539258396554 +# MD5 Fingerprint: ac:fe:f7:34:96:a9:f2:b3:b4:12:4b:e4:27:41:6f:e1 +# SHA1 Fingerprint: a7:88:49:dc:5d:7c:75:8c:8c:de:39:98:56:b3:aa:d0:b2:a5:71:35 +# SHA256 Fingerprint: 37:1a:00:dc:05:33:b3:72:1a:7e:eb:40:e8:41:9e:70:79:9d:2b:0a:0f:2c:1d:80:69:31:65:f7:ce:c4:ad:75 +-----BEGIN CERTIFICATE----- +MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBN +MQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMT +HERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcN +NDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQs +IEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS87IE+ +ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG0 +2C+JFvuUAT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgp +wgscONyfMXdcvyej/Cestyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZM +pG2T6T867jp8nVid9E6P/DsjyG244gXazOvswzH016cpVIDPRFtMbzCe88zdH5RD +nU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnVDdXifBBiqmvwPXbzP6Po +sMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9qTXeXAaDx +Zre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cd +Lvvyz6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvX +KyY//SovcfXWJL5/MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNe +XoVPzthwiHvOAbWWl9fNff2C+MIkwcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPL +tgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4EFgQUUTMc7TZArxfTJc1paPKv +TiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN +AQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw +GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7H +PNtQOa27PShNlnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLF +O4uJ+DQtpBflF+aZfTCIITfNMBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQ +REtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/u4cnYiWB39yhL/btp/96j1EuMPik +AdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9GOUrYU9DzLjtxpdRv +/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh47a+ +p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilw +MUc/dNAUFvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WF +qUITVuwhd4GTWgzqltlJyqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCK +ovfepEWFJqgejF0pW8hL2JpqA15w8oVPbEtoL8pU9ozaMv7Da4M/OMZ+ +-----END CERTIFICATE----- + +# Issuer: CN=Certainly Root R1 O=Certainly +# Subject: CN=Certainly Root R1 O=Certainly +# Label: "Certainly Root R1" +# Serial: 188833316161142517227353805653483829216 +# MD5 Fingerprint: 07:70:d4:3e:82:87:a0:fa:33:36:13:f4:fa:33:e7:12 +# SHA1 Fingerprint: a0:50:ee:0f:28:71:f4:27:b2:12:6d:6f:50:96:25:ba:cc:86:42:af +# SHA256 Fingerprint: 77:b8:2c:d8:64:4c:43:05:f7:ac:c5:cb:15:6b:45:67:50:04:03:3d:51:c6:0c:62:02:a8:e0:c3:34:67:d3:a0 +-----BEGIN CERTIFICATE----- +MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAw +PTELMAkGA1UEBhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2Vy +dGFpbmx5IFJvb3QgUjEwHhcNMjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9 +MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0 +YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANA2 +1B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O5MQT +vqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbed +aFySpvXl8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b0 +1C7jcvk2xusVtyWMOvwlDbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5 +r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGIXsXwClTNSaa/ApzSRKft43jvRl5tcdF5 +cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkNKPl6I7ENPT2a/Z2B7yyQ +wHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQAjeZjOVJ +6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA +2CnbrlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyH +Wyf5QBGenDPBt+U1VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMR +eiFPCyEQtkA6qyI6BJyLm4SGcprSp6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB +/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTgqj8ljZ9EXME66C6u +d0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAszHQNTVfSVcOQr +PbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d +8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi +1wrykXprOQ4vMMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrd +rRT90+7iIgXr0PK3aBLXWopBGsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9di +taY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+gjwN/KUD+nsa2UUeYNrEjvn8K8l7 +lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgHJBu6haEaBQmAupVj +yTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7fpYn +Kx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLy +yCwzk5Iwx06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5n +wXARPbv0+Em34yaXOp/SX3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6 +OV+KmalBWQewLK8= +-----END CERTIFICATE----- + +# Issuer: CN=Certainly Root E1 O=Certainly +# Subject: CN=Certainly Root E1 O=Certainly +# Label: "Certainly Root E1" +# Serial: 8168531406727139161245376702891150584 +# MD5 Fingerprint: 0a:9e:ca:cd:3e:52:50:c6:36:f3:4b:a3:ed:a7:53:e9 +# SHA1 Fingerprint: f9:e1:6d:dc:01:89:cf:d5:82:45:63:3e:c5:37:7d:c2:eb:93:6f:2b +# SHA256 Fingerprint: b4:58:5f:22:e4:ac:75:6a:4e:86:12:a1:36:1c:5d:9d:03:1a:93:fd:84:fe:bb:77:8f:a3:06:8b:0f:c4:2d:c2 +-----BEGIN CERTIFICATE----- +MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQsw +CQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlu +bHkgUm9vdCBFMTAeFw0yMTA0MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJ +BgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlubHkxGjAYBgNVBAMTEUNlcnRhaW5s +eSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4fxzf7flHh4axpMCK ++IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9YBk2 +QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4 +hevIIgcwCgYIKoZIzj0EAwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozm +ut6Dacpps6kFtZaSF4fC0urQe87YQVt8rgIwRt7qy12a7DLCZRawTDBcMPPaTnOG +BtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR +-----END CERTIFICATE----- + +# Issuer: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD. +# Subject: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD. +# Label: "Security Communication RootCA3" +# Serial: 16247922307909811815 +# MD5 Fingerprint: 1c:9a:16:ff:9e:5c:e0:4d:8a:14:01:f4:35:5d:29:26 +# SHA1 Fingerprint: c3:03:c8:22:74:92:e5:61:a2:9c:5f:79:91:2b:1e:44:13:91:30:3a +# SHA256 Fingerprint: 24:a5:5c:2a:b0:51:44:2d:06:17:76:65:41:23:9a:4a:d0:32:d7:c5:51:75:aa:34:ff:de:2f:bc:4f:5c:52:94 +-----BEGIN CERTIFICATE----- +MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNV +BAYTAkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScw +JQYDVQQDEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2 +MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc +U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UEAxMeU2VjdXJpdHkg +Q29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEA48lySfcw3gl8qUCBWNO0Ot26YQ+TUG5pPDXC7ltzkBtnTCHsXzW7OT4r +CmDvu20rhvtxosis5FaU+cmvsXLUIKx00rgVrVH+hXShuRD+BYD5UpOzQD11EKzA +lrenfna84xtSGc4RHwsENPXY9Wk8d/Nk9A2qhd7gCVAEF5aEt8iKvE1y/By7z/MG +TfmfZPd+pmaGNXHIEYBMwXFAWB6+oHP2/D5Q4eAvJj1+XCO1eXDe+uDRpdYMQXF7 +9+qMHIjH7Iv10S9VlkZ8WjtYO/u62C21Jdp6Ts9EriGmnpjKIG58u4iFW/vAEGK7 +8vknR+/RiTlDxN/e4UG/VHMgly1s2vPUB6PmudhvrvyMGS7TZ2crldtYXLVqAvO4 +g160a75BflcJdURQVc1aEWEhCmHCqYj9E7wtiS/NYeCVvsq1e+F7NGcLH7YMx3we +GVPKp7FKFSBWFHA9K4IsD50VHUeAR/94mQ4xr28+j+2GaR57GIgUssL8gjMunEst ++3A7caoreyYn8xrC3PsXuKHqy6C0rtOUfnrQq8PsOC0RLoi/1D+tEjtCrI8Cbn3M +0V9hvqG8OmpI6iZVIhZdXw3/JzOfGAN0iltSIEdrRU0id4xVJ/CvHozJgyJUt5rQ +T9nO/NkuHJYosQLTA70lUhw0Zk8jq/R3gpYd0VcwCBEF/VfR2ccCAwEAAaNCMEAw +HQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS +YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PA +FNr0Y/Dq9HHuTofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd +9XbXv8S2gVj/yP9kaWJ5rW4OH3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQI +UYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASxYfQAW0q3nHE3GYV5v4GwxxMOdnE+ +OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZXSEIx2C/pHF7uNke +gr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml+LLf +iAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUV +nuiZIesnKwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD +2NCcnWXL0CsnMQMeNuE9dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI// +1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm6Vwdp6POXiUyK+OVrCoHzrQoeIY8Laad +TdJ0MN1kURXbg4NR16/9M51NZg== +-----END CERTIFICATE----- + +# Issuer: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. +# Subject: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD. +# Label: "Security Communication ECC RootCA1" +# Serial: 15446673492073852651 +# MD5 Fingerprint: 7e:43:b0:92:68:ec:05:43:4c:98:ab:5d:35:2e:7e:86 +# SHA1 Fingerprint: b8:0e:26:a9:bf:d2:b2:3b:c0:ef:46:c9:ba:c7:bb:f6:1d:0d:41:41 +# SHA256 Fingerprint: e7:4f:bd:a5:5b:d5:64:c4:73:a3:6b:44:1a:a7:99:c8:a6:8e:07:74:40:e8:28:8b:9f:a1:e5:0e:4b:ba:ca:11 +-----BEGIN CERTIFICATE----- +MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYT +AkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYD +VQQDEyJTZWN1cml0eSBDb21tdW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYx +NjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTELMAkGA1UEBhMCSlAxJTAjBgNVBAoT +HFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNVBAMTIlNlY3VyaXR5 +IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQAIgNi +AASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+Cnnfdl +dB9sELLo5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpK +ULGjQjBAMB0GA1UdDgQWBBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8E +BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu +9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O +be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k= +-----END CERTIFICATE----- + +# Issuer: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY +# Subject: CN=BJCA Global Root CA1 O=BEIJING CERTIFICATE AUTHORITY +# Label: "BJCA Global Root CA1" +# Serial: 113562791157148395269083148143378328608 +# MD5 Fingerprint: 42:32:99:76:43:33:36:24:35:07:82:9b:28:f9:d0:90 +# SHA1 Fingerprint: d5:ec:8d:7b:4c:ba:79:f4:e7:e8:cb:9d:6b:ae:77:83:10:03:21:6a +# SHA256 Fingerprint: f3:89:6f:88:fe:7c:0a:88:27:66:a7:fa:6a:d2:74:9f:b5:7a:7f:3e:98:fb:76:9c:1f:a7:b0:9c:2c:44:d5:ae +-----BEGIN CERTIFICATE----- +MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBU +MQswCQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRI +T1JJVFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAz +MTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJF +SUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2Jh +bCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFmCL3Z +xRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZ +spDyRhySsTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O5 +58dnJCNPYwpj9mZ9S1WnP3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgR +at7GGPZHOiJBhyL8xIkoVNiMpTAK+BcWyqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll +5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRjeulumijWML3mG90Vr4Tq +nMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNnMoH1V6XK +V0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/ +pj+bOT0CFqMYs2esWz8sgytnOYFcuX6U1WTdno9uruh8W7TXakdI136z1C2OVnZO +z2nxbkRs1CTqjSShGL+9V/6pmTW12xB3uD1IutbB5/EjPtffhZ0nPNRAvQoMvfXn +jSXWgXSHRtQpdaJCbPdzied9v3pKH9MiyRVVz99vfFXQpIsHETdfg6YmV6YBW37+ +WGgHqel62bno/1Afq8K0wM7o6v0PvY1NuLxxAgMBAAGjQjBAMB0GA1UdDgQWBBTF +7+3M2I0hxkjk49cULqcWk+WYATAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE +AwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAUoKsITQfI/Ki2Pm4rzc2IInRNwPWaZ+4 +YRC6ojGYWUfo0Q0lHhVBDOAqVdVXUsv45Mdpox1NcQJeXyFFYEhcCY5JEMEE3Kli +awLwQ8hOnThJdMkycFRtwUf8jrQ2ntScvd0g1lPJGKm1Vrl2i5VnZu69mP6u775u ++2D2/VnGKhs/I0qUJDAnyIm860Qkmss9vk/Ves6OF8tiwdneHg56/0OGNFK8YT88 +X7vZdrRTvJez/opMEi4r89fO4aL/3Xtw+zuhTaRjAv04l5U/BXCga99igUOLtFkN +SoxUnMW7gZ/NfaXvCyUeOiDbHPwfmGcCCtRzRBPbUYQaVQNW4AB+dAb/OMRyHdOo +P2gxXdMJxy6MW2Pg6Nwe0uxhHvLe5e/2mXZgLR6UcnHGCyoyx5JO1UbXHfmpGQrI ++pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRz +znfSxqxx4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9 +eVzYH6Eze9mCUAyTF6ps3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2 +YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4SSPfSKcOYKMryMguTjClPPGAyzQWWYezy +r/6zcCwupvI= +-----END CERTIFICATE----- + +# Issuer: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY +# Subject: CN=BJCA Global Root CA2 O=BEIJING CERTIFICATE AUTHORITY +# Label: "BJCA Global Root CA2" +# Serial: 58605626836079930195615843123109055211 +# MD5 Fingerprint: 5e:0a:f6:47:5f:a6:14:e8:11:01:95:3f:4d:01:eb:3c +# SHA1 Fingerprint: f4:27:86:eb:6e:b8:6d:88:31:67:02:fb:ba:66:a4:53:00:aa:7a:a6 +# SHA256 Fingerprint: 57:4d:f6:93:1e:27:80:39:66:7b:72:0a:fd:c1:60:0f:c2:7e:b6:6d:d3:09:29:79:fb:73:85:64:87:21:28:82 +-----BEGIN CERTIFICATE----- +MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQsw +CQYDVQQGEwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJ +VFkxHTAbBgNVBAMMFEJKQ0EgR2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgy +MVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJ +TkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRCSkNBIEdsb2JhbCBS +b290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jlSR9B +IgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK+ ++kpRuDCK/eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJK +sVF/BvDRgh9Obl+rg/xI1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA +94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8gUXOQwKhbYdDFUDn9hf7B +43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w== +-----END CERTIFICATE----- + +# Issuer: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited +# Subject: CN=Sectigo Public Server Authentication Root E46 O=Sectigo Limited +# Label: "Sectigo Public Server Authentication Root E46" +# Serial: 88989738453351742415770396670917916916 +# MD5 Fingerprint: 28:23:f8:b2:98:5c:37:16:3b:3e:46:13:4e:b0:b3:01 +# SHA1 Fingerprint: ec:8a:39:6c:40:f0:2e:bc:42:75:d4:9f:ab:1c:1a:5b:67:be:d2:9a +# SHA256 Fingerprint: c9:0f:26:f0:fb:1b:40:18:b2:22:27:51:9b:5c:a2:b5:3e:2c:a5:b3:be:5c:f1:8e:fe:1b:ef:47:38:0c:53:83 +-----BEGIN CERTIFICATE----- +MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQsw +CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T +ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcN +MjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYG +A1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT +ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccC +WvkEN/U0NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+ +6xnOQ6OjQjBAMB0GA1UdDgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8B +Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjAn7qRa +qCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RHlAFWovgzJQxC36oCMB3q +4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21USAGKcw== +-----END CERTIFICATE----- + +# Issuer: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited +# Subject: CN=Sectigo Public Server Authentication Root R46 O=Sectigo Limited +# Label: "Sectigo Public Server Authentication Root R46" +# Serial: 156256931880233212765902055439220583700 +# MD5 Fingerprint: 32:10:09:52:00:d5:7e:6c:43:df:15:c0:b1:16:93:e5 +# SHA1 Fingerprint: ad:98:f9:f3:e4:7d:75:3b:65:d4:82:b3:a4:52:17:bb:6e:f5:e4:38 +# SHA256 Fingerprint: 7b:b6:47:a6:2a:ee:ac:88:bf:25:7a:a5:22:d0:1f:fe:a3:95:e0:ab:45:c7:3f:93:f6:56:54:ec:38:f2:5a:06 +-----BEGIN CERTIFICATE----- +MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBf +MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQD +Ey1TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYw +HhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEY +MBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1Ymxp +YyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDa +ef0rty2k1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnz +SDBh+oF8HqcIStw+KxwfGExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xf +iOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMPFF1bFOdLvt30yNoDN9HWOaEhUTCDsG3X +ME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vuZDCQOc2TZYEhMbUjUDM3 +IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5QazYw6A3OAS +VYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgE +SJ/AwSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu ++Zd4KKTIRJLpfSYFplhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt +8uaZFURww3y8nDnAtOFr94MlI1fZEoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+L +HaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW6aWWrL3DkJiy4Pmi1KZHQ3xt +zwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWIIUkwDgYDVR0P +AQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c +mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQ +YKlJfp/imTYpE0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52 +gDY9hAaLMyZlbcp+nv4fjFg4exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZA +Fv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M0ejf5lG5Nkc/kLnHvALcWxxPDkjB +JYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI84HxZmduTILA7rpX +DhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9mpFui +TdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5 +dHn5HrwdVw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65 +LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp +0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmmJ1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAY +QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation +# Subject: CN=SSL.com TLS RSA Root CA 2022 O=SSL Corporation +# Label: "SSL.com TLS RSA Root CA 2022" +# Serial: 148535279242832292258835760425842727825 +# MD5 Fingerprint: d8:4e:c6:59:30:d8:fe:a0:d6:7a:5a:2c:2c:69:78:da +# SHA1 Fingerprint: ec:2c:83:40:72:af:26:95:10:ff:0e:f2:03:ee:31:70:f6:78:9d:ca +# SHA256 Fingerprint: 8f:af:7d:2e:2c:b4:70:9b:b8:e0:b3:36:66:bf:75:a5:dd:45:b5:de:48:0f:8e:a8:d4:bf:e6:be:bc:17:f2:ed +-----BEGIN CERTIFICATE----- +MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBO +MQswCQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQD +DBxTU0wuY29tIFRMUyBSU0EgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloX +DTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jw +b3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJvb3QgQ0EgMjAyMjCC +AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u9nTP +L3tYPc48DRAokC+X94xI2KDYJbFMsBFMF3NQ0CJKY7uB0ylu1bUJPiYYf7ISf5OY +t6/wNr/y7hienDtSxUcZXXTzZGbVXcdotL8bHAajvI9AI7YexoS9UcQbOcGV0ins +S657Lb85/bRi3pZ7QcacoOAGcvvwB5cJOYF0r/c0WRFXCsJbwST0MXMwgsadugL3 +PnxEX4MN8/HdIGkWCVDi1FW24IBydm5MR7d1VVm0U3TZlMZBrViKMWYPHqIbKUBO +L9975hYsLfy/7PO0+r4Y9ptJ1O4Fbtk085zx7AGL0SDGD6C1vBdOSHtRwvzpXGk3 +R2azaPgVKPC506QVzFpPulJwoxJF3ca6TvvC0PeoUidtbnm1jPx7jMEWTO6Af77w +dr5BUxIzrlo4QqvXDz5BjXYHMtWrifZOZ9mxQnUjbvPNQrL8VfVThxc7wDNY8VLS ++YCk8OjwO4s4zKTGkH8PnP2L0aPP2oOnaclQNtVcBdIKQXTbYxE3waWglksejBYS +d66UNHsef8JmAOSqg+qKkK3ONkRN0VHpvB/zagX9wHQfJRlAUW7qglFA35u5CCoG +AtUjHBPW6dvbxrB6y3snm/vg1UYk7RBLY0ulBY+6uB0rpvqR4pJSvezrZ5dtmi2f +gTIFZzL7SAg/2SW4BCUvAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j +BBgwFoAU+y437uOEeicuzRk1sTN8/9REQrkwHQYDVR0OBBYEFPsuN+7jhHonLs0Z +NbEzfP/UREK5MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAjYlt +hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsM +QtfhWsSWTVTNj8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvf +R4iyrT7gJ4eLSYwfqUdYe5byiB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJ +DPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjUo3KUQyxi4U5cMj29TH0ZR6LDSeeW +P4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqoENjwuSfr98t67wVy +lrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7EgkaibMOlq +bLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2w +AgDHbICivRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3q +r5nsLFR+jM4uElZI7xc7P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sji +Mho6/4UIyYOf8kpIEFR3N+2ivEC+5BB09+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU +98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA= +-----END CERTIFICATE----- + +# Issuer: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation +# Subject: CN=SSL.com TLS ECC Root CA 2022 O=SSL Corporation +# Label: "SSL.com TLS ECC Root CA 2022" +# Serial: 26605119622390491762507526719404364228 +# MD5 Fingerprint: 99:d7:5c:f1:51:36:cc:e9:ce:d9:19:2e:77:71:56:c5 +# SHA1 Fingerprint: 9f:5f:d9:1a:54:6d:f5:0c:71:f0:ee:7a:bd:17:49:98:84:73:e2:39 +# SHA256 Fingerprint: c3:2f:fd:9f:46:f9:36:d1:6c:36:73:99:09:59:43:4b:9a:d6:0a:af:bb:9e:7c:f3:36:54:f1:44:cc:1b:a1:43 +-----BEGIN CERTIFICATE----- +MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw +CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT +U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2 +MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh +dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG +ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm +acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN +SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME +GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW +uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp +15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN +b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g== +-----END CERTIFICATE----- + +# Issuer: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos +# Subject: CN=Atos TrustedRoot Root CA ECC TLS 2021 O=Atos +# Label: "Atos TrustedRoot Root CA ECC TLS 2021" +# Serial: 81873346711060652204712539181482831616 +# MD5 Fingerprint: 16:9f:ad:f1:70:ad:79:d6:ed:29:b4:d1:c5:79:70:a8 +# SHA1 Fingerprint: 9e:bc:75:10:42:b3:02:f3:81:f4:f7:30:62:d4:8f:c3:a7:51:b2:dd +# SHA256 Fingerprint: b2:fa:e5:3e:14:cc:d7:ab:92:12:06:47:01:ae:27:9c:1d:89:88:fa:cb:77:5f:a8:a0:08:91:4e:66:39:88:a8 +-----BEGIN CERTIFICATE----- +MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4w +LAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0w +CwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0 +MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBF +Q0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMHYwEAYHKoZI +zj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6KDP/X +tXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4 +AjJn8ZQSb+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2 +KCXWfeBmmnoJsmo7jjPXNtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMD +aAAwZQIwW5kp85wxtolrbNa9d+F851F+uDrNozZffPc8dz7kUK2o59JZDCaOMDtu +CCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGYa3cpetskz2VAv9LcjBHo +9H1/IISpQuQo +-----END CERTIFICATE----- + +# Issuer: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos +# Subject: CN=Atos TrustedRoot Root CA RSA TLS 2021 O=Atos +# Label: "Atos TrustedRoot Root CA RSA TLS 2021" +# Serial: 111436099570196163832749341232207667876 +# MD5 Fingerprint: d4:d3:46:b8:9a:c0:9c:76:5d:9e:3a:c3:b9:99:31:d2 +# SHA1 Fingerprint: 18:52:3b:0d:06:37:e4:d6:3a:df:23:e4:98:fb:5b:16:fb:86:74:48 +# SHA256 Fingerprint: 81:a9:08:8e:a5:9f:b3:64:c5:48:a6:f8:55:59:09:9b:6f:04:05:ef:bf:18:e5:32:4e:c9:f4:57:ba:00:11:2f +-----BEGIN CERTIFICATE----- +MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBM +MS4wLAYDVQQDDCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIx +MQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00 +MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0b3MgVHJ1c3RlZFJvb3QgUm9vdCBD +QSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYTAkRFMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BBl01Z +4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYv +Ye+W/CBGvevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZ +kmGbzSoXfduP9LVq6hdKZChmFSlsAvFr1bqjM9xaZ6cF4r9lthawEO3NUDPJcFDs +GY6wx/J0W2tExn2WuZgIWWbeKQGb9Cpt0xU6kGpn8bRrZtkh68rZYnxGEFzedUln +nkL5/nWpo63/dgpnQOPF943HhZpZnmKaau1Fh5hnstVKPNe0OwANwI8f4UDErmwh +3El+fsqyjW22v5MvoVw+j8rtgI5Y4dtXz4U2OLJxpAmMkokIiEjxQGMYsluMWuPD +0xeqqxmjLBvk1cbiZnrXghmmOxYsL3GHX0WelXOTwkKBIROW1527k2gV+p2kHYzy +geBYBr3JtuP2iV2J+axEoctr+hbxx1A9JNr3w+SH1VbxT5Aw+kUJWdo0zuATHAR8 +ANSbhqRAvNncTFd+rrcztl524WWLZt+NyteYr842mIycg5kDcPOvdO3GDjbnvezB +c6eUWsuSZIKmAMFwoW4sKeFYV+xafJlrJaSQOoD0IJ2azsct+bJLKZWD6TWNp0lI +pw9MGZHQ9b8Q4HECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU +dEmZ0f+0emhFdcN+tNzMzjkz2ggwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB +DAUAA4ICAQAjQ1MkYlxt/T7Cz1UAbMVWiLkO3TriJQ2VSpfKgInuKs1l+NsW4AmS +4BjHeJi78+xCUvuppILXTdiK/ORO/auQxDh1MoSf/7OwKwIzNsAQkG8dnK/haZPs +o0UvFJ/1TCplQ3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJ +qM7F78PRreBrAwA0JrRUITWXAdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuyw +xfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9GslA9hGCZcbUztVdF5kJHdWoOsAgM +rr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2VktafcxBPTy+av5EzH4 +AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9qTFsR +0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuY +o7Ey7Nmj1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5 +dDTedk+SKlOxJTnbPP/lPqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcE +oji2jbDwN/zIIX8/syQbPYtuzE2wFg2WHYMfRsCbvUOZ58SWLs5fyQ== +-----END CERTIFICATE----- diff --git a/requests/python/certifi/core.py b/requests/python/certifi/core.py new file mode 100644 index 0000000..de02898 --- /dev/null +++ b/requests/python/certifi/core.py @@ -0,0 +1,108 @@ +""" +certifi.py +~~~~~~~~~~ + +This module returns the installation location of cacert.pem or its contents. +""" +import sys + + +if sys.version_info >= (3, 11): + + from importlib.resources import as_file, files + + _CACERT_CTX = None + _CACERT_PATH = None + + def where() -> str: + # This is slightly terrible, but we want to delay extracting the file + # in cases where we're inside of a zipimport situation until someone + # actually calls where(), but we don't want to re-extract the file + # on every call of where(), so we'll do it once then store it in a + # global variable. + global _CACERT_CTX + global _CACERT_PATH + if _CACERT_PATH is None: + # This is slightly janky, the importlib.resources API wants you to + # manage the cleanup of this file, so it doesn't actually return a + # path, it returns a context manager that will give you the path + # when you enter it and will do any cleanup when you leave it. In + # the common case of not needing a temporary file, it will just + # return the file system location and the __exit__() is a no-op. + # + # We also have to hold onto the actual context manager, because + # it will do the cleanup whenever it gets garbage collected, so + # we will also store that at the global level as well. + _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem")) + _CACERT_PATH = str(_CACERT_CTX.__enter__()) + + return _CACERT_PATH + + def contents() -> str: + return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii") + +elif sys.version_info >= (3, 7): + + from importlib.resources import path as get_path, read_text + + _CACERT_CTX = None + _CACERT_PATH = None + + def where() -> str: + # This is slightly terrible, but we want to delay extracting the + # file in cases where we're inside of a zipimport situation until + # someone actually calls where(), but we don't want to re-extract + # the file on every call of where(), so we'll do it once then store + # it in a global variable. + global _CACERT_CTX + global _CACERT_PATH + if _CACERT_PATH is None: + # This is slightly janky, the importlib.resources API wants you + # to manage the cleanup of this file, so it doesn't actually + # return a path, it returns a context manager that will give + # you the path when you enter it and will do any cleanup when + # you leave it. In the common case of not needing a temporary + # file, it will just return the file system location and the + # __exit__() is a no-op. + # + # We also have to hold onto the actual context manager, because + # it will do the cleanup whenever it gets garbage collected, so + # we will also store that at the global level as well. + _CACERT_CTX = get_path("certifi", "cacert.pem") + _CACERT_PATH = str(_CACERT_CTX.__enter__()) + + return _CACERT_PATH + + def contents() -> str: + return read_text("certifi", "cacert.pem", encoding="ascii") + +else: + import os + import types + from typing import Union + + Package = Union[types.ModuleType, str] + Resource = Union[str, "os.PathLike"] + + # This fallback will work for Python versions prior to 3.7 that lack the + # importlib.resources module but relies on the existing `where` function + # so won't address issues with environments like PyOxidizer that don't set + # __file__ on modules. + def read_text( + package: Package, + resource: Resource, + encoding: str = 'utf-8', + errors: str = 'strict' + ) -> str: + with open(where(), encoding=encoding) as data: + return data.read() + + # If we don't have importlib.resources, then we will just do the old logic + # of assuming we're on the filesystem and munge the path directly. + def where() -> str: + f = os.path.dirname(__file__) + + return os.path.join(f, "cacert.pem") + + def contents() -> str: + return read_text("certifi", "cacert.pem", encoding="ascii") diff --git a/requests/python/certifi/py.typed b/requests/python/certifi/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/requests/python/charset_normalizer-3.2.0.dist-info/INSTALLER b/requests/python/charset_normalizer-3.2.0.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/requests/python/charset_normalizer-3.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/requests/python/charset_normalizer-3.2.0.dist-info/LICENSE b/requests/python/charset_normalizer-3.2.0.dist-info/LICENSE new file mode 100644 index 0000000..ad82355 --- /dev/null +++ b/requests/python/charset_normalizer-3.2.0.dist-info/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 TAHRI Ahmed R. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/requests/python/charset_normalizer-3.2.0.dist-info/METADATA b/requests/python/charset_normalizer-3.2.0.dist-info/METADATA new file mode 100644 index 0000000..ca190e1 --- /dev/null +++ b/requests/python/charset_normalizer-3.2.0.dist-info/METADATA @@ -0,0 +1,628 @@ +Metadata-Version: 2.1 +Name: charset-normalizer +Version: 3.2.0 +Summary: The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet. +Home-page: https://github.com/Ousret/charset_normalizer +Author: Ahmed TAHRI +Author-email: ahmed.tahri@cloudnursery.dev +License: MIT +Project-URL: Bug Reports, https://github.com/Ousret/charset_normalizer/issues +Project-URL: Documentation, https://charset-normalizer.readthedocs.io/en/latest +Keywords: encoding,charset,charset-detector,detector,normalization,unicode,chardet,detect +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: MIT License +Classifier: Intended Audience :: Developers +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Text Processing :: Linguistic +Classifier: Topic :: Utilities +Classifier: Typing :: Typed +Requires-Python: >=3.7.0 +Description-Content-Type: text/markdown +License-File: LICENSE +Provides-Extra: unicode_backport + +

Charset Detection, for Everyone 👋

+ +

+ The Real First Universal Charset Detector
+ + + + + Download Count Total + + + + +

+ +> A library that helps you read text from an unknown charset encoding.
Motivated by `chardet`, +> I'm trying to resolve the issue by taking a new approach. +> All IANA character set names for which the Python core library provides codecs are supported. + +

+ >>>>> 👉 Try Me Online Now, Then Adopt Me 👈 <<<<< +

+ +This project offers you an alternative to **Universal Charset Encoding Detector**, also known as **Chardet**. + +| Feature | [Chardet](https://github.com/chardet/chardet) | Charset Normalizer | [cChardet](https://github.com/PyYoshi/cChardet) | +|--------------------------------------------------|:---------------------------------------------:|:------------------------------------------------------------------------------------------------------:|:-----------------------------------------------:| +| `Fast` | ❌
| ✅
| ✅
| +| `Universal**` | ❌ | ✅ | ❌ | +| `Reliable` **without** distinguishable standards | ❌ | ✅ | ✅ | +| `Reliable` **with** distinguishable standards | ✅ | ✅ | ✅ | +| `License` | LGPL-2.1
_restrictive_ | MIT | MPL-1.1
_restrictive_ | +| `Native Python` | ✅ | ✅ | ❌ | +| `Detect spoken language` | ❌ | ✅ | N/A | +| `UnicodeDecodeError Safety` | ❌ | ✅ | ❌ | +| `Whl Size` | 193.6 kB | 40 kB | ~200 kB | +| `Supported Encoding` | 33 | 🎉 [90](https://charset-normalizer.readthedocs.io/en/latest/user/support.html#supported-encodings) | 40 | + +

+Reading Normalized TextCat Reading Text + +*\*\* : They are clearly using specific code for a specific encoding even if covering most of used one*
+Did you got there because of the logs? See [https://charset-normalizer.readthedocs.io/en/latest/user/miscellaneous.html](https://charset-normalizer.readthedocs.io/en/latest/user/miscellaneous.html) + +## ⚡ Performance + +This package offer better performance than its counterpart Chardet. Here are some numbers. + +| Package | Accuracy | Mean per file (ms) | File per sec (est) | +|-----------------------------------------------|:--------:|:------------------:|:------------------:| +| [chardet](https://github.com/chardet/chardet) | 86 % | 200 ms | 5 file/sec | +| charset-normalizer | **98 %** | **10 ms** | 100 file/sec | + +| Package | 99th percentile | 95th percentile | 50th percentile | +|-----------------------------------------------|:---------------:|:---------------:|:---------------:| +| [chardet](https://github.com/chardet/chardet) | 1200 ms | 287 ms | 23 ms | +| charset-normalizer | 100 ms | 50 ms | 5 ms | + +Chardet's performance on larger file (1MB+) are very poor. Expect huge difference on large payload. + +> Stats are generated using 400+ files using default parameters. More details on used files, see GHA workflows. +> And yes, these results might change at any time. The dataset can be updated to include more files. +> The actual delays heavily depends on your CPU capabilities. The factors should remain the same. +> Keep in mind that the stats are generous and that Chardet accuracy vs our is measured using Chardet initial capability +> (eg. Supported Encoding) Challenge-them if you want. + +## ✨ Installation + +Using pip: + +```sh +pip install charset-normalizer -U +``` + +## 🚀 Basic Usage + +### CLI +This package comes with a CLI. + +``` +usage: normalizer [-h] [-v] [-a] [-n] [-m] [-r] [-f] [-t THRESHOLD] + file [file ...] + +The Real First Universal Charset Detector. Discover originating encoding used +on text file. Normalize text to unicode. + +positional arguments: + files File(s) to be analysed + +optional arguments: + -h, --help show this help message and exit + -v, --verbose Display complementary information about file if any. + Stdout will contain logs about the detection process. + -a, --with-alternative + Output complementary possibilities if any. Top-level + JSON WILL be a list. + -n, --normalize Permit to normalize input file. If not set, program + does not write anything. + -m, --minimal Only output the charset detected to STDOUT. Disabling + JSON output. + -r, --replace Replace file when trying to normalize it instead of + creating a new one. + -f, --force Replace file without asking if you are sure, use this + flag with caution. + -t THRESHOLD, --threshold THRESHOLD + Define a custom maximum amount of chaos allowed in + decoded content. 0. <= chaos <= 1. + --version Show version information and exit. +``` + +```bash +normalizer ./data/sample.1.fr.srt +``` + +🎉 Since version 1.4.0 the CLI produce easily usable stdout result in JSON format. + +```json +{ + "path": "/home/default/projects/charset_normalizer/data/sample.1.fr.srt", + "encoding": "cp1252", + "encoding_aliases": [ + "1252", + "windows_1252" + ], + "alternative_encodings": [ + "cp1254", + "cp1256", + "cp1258", + "iso8859_14", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_9", + "latin_1", + "mbcs" + ], + "language": "French", + "alphabets": [ + "Basic Latin", + "Latin-1 Supplement" + ], + "has_sig_or_bom": false, + "chaos": 0.149, + "coherence": 97.152, + "unicode_path": null, + "is_preferred": true +} +``` + +### Python +*Just print out normalized text* +```python +from charset_normalizer import from_path + +results = from_path('./my_subtitle.srt') + +print(str(results.best())) +``` + +*Upgrade your code without effort* +```python +from charset_normalizer import detect +``` + +The above code will behave the same as **chardet**. We ensure that we offer the best (reasonable) BC result possible. + +See the docs for advanced usage : [readthedocs.io](https://charset-normalizer.readthedocs.io/en/latest/) + +## 😇 Why + +When I started using Chardet, I noticed that it was not suited to my expectations, and I wanted to propose a +reliable alternative using a completely different method. Also! I never back down on a good challenge! + +I **don't care** about the **originating charset** encoding, because **two different tables** can +produce **two identical rendered string.** +What I want is to get readable text, the best I can. + +In a way, **I'm brute forcing text decoding.** How cool is that ? 😎 + +Don't confuse package **ftfy** with charset-normalizer or chardet. ftfy goal is to repair unicode string whereas charset-normalizer to convert raw file in unknown encoding to unicode. + +## 🍰 How + + - Discard all charset encoding table that could not fit the binary content. + - Measure noise, or the mess once opened (by chunks) with a corresponding charset encoding. + - Extract matches with the lowest mess detected. + - Additionally, we measure coherence / probe for a language. + +**Wait a minute**, what is noise/mess and coherence according to **YOU ?** + +*Noise :* I opened hundred of text files, **written by humans**, with the wrong encoding table. **I observed**, then +**I established** some ground rules about **what is obvious** when **it seems like** a mess. + I know that my interpretation of what is noise is probably incomplete, feel free to contribute in order to + improve or rewrite it. + +*Coherence :* For each language there is on earth, we have computed ranked letter appearance occurrences (the best we can). So I thought +that intel is worth something here. So I use those records against decoded text to check if I can detect intelligent design. + +## ⚡ Known limitations + + - Language detection is unreliable when text contains two or more languages sharing identical letters. (eg. HTML (english tags) + Turkish content (Sharing Latin characters)) + - Every charset detector heavily depends on sufficient content. In common cases, do not bother run detection on very tiny content. + +## ⚠️ About Python EOLs + +**If you are running:** + +- Python >=2.7,<3.5: Unsupported +- Python 3.5: charset-normalizer < 2.1 +- Python 3.6: charset-normalizer < 3.1 + +Upgrade your Python interpreter as soon as possible. + +## 👤 Contributing + +Contributions, issues and feature requests are very much welcome.
+Feel free to check [issues page](https://github.com/ousret/charset_normalizer/issues) if you want to contribute. + +## 📝 License + +Copyright © [Ahmed TAHRI @Ousret](https://github.com/Ousret).
+This project is [MIT](https://github.com/Ousret/charset_normalizer/blob/master/LICENSE) licensed. + +Characters frequencies used in this project © 2012 [Denny Vrandečić](http://simia.net/letters/) + +## 💼 For Enterprise + +Professional support for charset-normalizer is available as part of the [Tidelift +Subscription][1]. Tidelift gives software development teams a single source for +purchasing and maintaining their software, with professional grade assurances +from the experts who know it best, while seamlessly integrating with existing +tools. + +[1]: https://tidelift.com/subscription/pkg/pypi-charset-normalizer?utm_source=pypi-charset-normalizer&utm_medium=readme + +# Changelog +All notable changes to charset-normalizer will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## [3.2.0](https://github.com/Ousret/charset_normalizer/compare/3.1.0...3.2.0) (2023-06-07) + +### Changed +- Typehint for function `from_path` no longer enforce `PathLike` as its first argument +- Minor improvement over the global detection reliability + +### Added +- Introduce function `is_binary` that relies on main capabilities, and optimized to detect binaries +- Propagate `enable_fallback` argument throughout `from_bytes`, `from_path`, and `from_fp` that allow a deeper control over the detection (default True) +- Explicit support for Python 3.12 + +### Fixed +- Edge case detection failure where a file would contain 'very-long' camel cased word (Issue #289) + +## [3.1.0](https://github.com/Ousret/charset_normalizer/compare/3.0.1...3.1.0) (2023-03-06) + +### Added +- Argument `should_rename_legacy` for legacy function `detect` and disregard any new arguments without errors (PR #262) + +### Removed +- Support for Python 3.6 (PR #260) + +### Changed +- Optional speedup provided by mypy/c 1.0.1 + +## [3.0.1](https://github.com/Ousret/charset_normalizer/compare/3.0.0...3.0.1) (2022-11-18) + +### Fixed +- Multi-bytes cutter/chunk generator did not always cut correctly (PR #233) + +### Changed +- Speedup provided by mypy/c 0.990 on Python >= 3.7 + +## [3.0.0](https://github.com/Ousret/charset_normalizer/compare/2.1.1...3.0.0) (2022-10-20) + +### Added +- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results +- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES +- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio +- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) + +### Changed +- Build with static metadata using 'build' frontend +- Make the language detection stricter +- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 + +### Fixed +- CLI with opt --normalize fail when using full path for files +- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it +- Sphinx warnings when generating the documentation + +### Removed +- Coherence detector no longer return 'Simple English' instead return 'English' +- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' +- Breaking: Method `first()` and `best()` from CharsetMatch +- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) +- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches +- Breaking: Top-level function `normalize` +- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch +- Support for the backport `unicodedata2` + +## [3.0.0rc1](https://github.com/Ousret/charset_normalizer/compare/3.0.0b2...3.0.0rc1) (2022-10-18) + +### Added +- Extend the capability of explain=True when cp_isolation contains at most two entries (min one), will log in details of the Mess-detector results +- Support for alternative language frequency set in charset_normalizer.assets.FREQUENCIES +- Add parameter `language_threshold` in `from_bytes`, `from_path` and `from_fp` to adjust the minimum expected coherence ratio + +### Changed +- Build with static metadata using 'build' frontend +- Make the language detection stricter + +### Fixed +- CLI with opt --normalize fail when using full path for files +- TooManyAccentuatedPlugin induce false positive on the mess detection when too few alpha character have been fed to it + +### Removed +- Coherence detector no longer return 'Simple English' instead return 'English' +- Coherence detector no longer return 'Classical Chinese' instead return 'Chinese' + +## [3.0.0b2](https://github.com/Ousret/charset_normalizer/compare/3.0.0b1...3.0.0b2) (2022-08-21) + +### Added +- `normalizer --version` now specify if current version provide extra speedup (meaning mypyc compilation whl) + +### Removed +- Breaking: Method `first()` and `best()` from CharsetMatch +- UTF-7 will no longer appear as "detected" without a recognized SIG/mark (is unreliable/conflict with ASCII) + +### Fixed +- Sphinx warnings when generating the documentation + +## [3.0.0b1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...3.0.0b1) (2022-08-15) + +### Changed +- Optional: Module `md.py` can be compiled using Mypyc to provide an extra speedup up to 4x faster than v2.1 + +### Removed +- Breaking: Class aliases CharsetDetector, CharsetDoctor, CharsetNormalizerMatch and CharsetNormalizerMatches +- Breaking: Top-level function `normalize` +- Breaking: Properties `chaos_secondary_pass`, `coherence_non_latin` and `w_counter` from CharsetMatch +- Support for the backport `unicodedata2` + +## [2.1.1](https://github.com/Ousret/charset_normalizer/compare/2.1.0...2.1.1) (2022-08-19) + +### Deprecated +- Function `normalize` scheduled for removal in 3.0 + +### Changed +- Removed useless call to decode in fn is_unprintable (#206) + +### Fixed +- Third-party library (i18n xgettext) crashing not recognizing utf_8 (PEP 263) with underscore from [@aleksandernovikov](https://github.com/aleksandernovikov) (#204) + +## [2.1.0](https://github.com/Ousret/charset_normalizer/compare/2.0.12...2.1.0) (2022-06-19) + +### Added +- Output the Unicode table version when running the CLI with `--version` (PR #194) + +### Changed +- Re-use decoded buffer for single byte character sets from [@nijel](https://github.com/nijel) (PR #175) +- Fixing some performance bottlenecks from [@deedy5](https://github.com/deedy5) (PR #183) + +### Fixed +- Workaround potential bug in cpython with Zero Width No-Break Space located in Arabic Presentation Forms-B, Unicode 1.1 not acknowledged as space (PR #175) +- CLI default threshold aligned with the API threshold from [@oleksandr-kuzmenko](https://github.com/oleksandr-kuzmenko) (PR #181) + +### Removed +- Support for Python 3.5 (PR #192) + +### Deprecated +- Use of backport unicodedata from `unicodedata2` as Python is quickly catching up, scheduled for removal in 3.0 (PR #194) + +## [2.0.12](https://github.com/Ousret/charset_normalizer/compare/2.0.11...2.0.12) (2022-02-12) + +### Fixed +- ASCII miss-detection on rare cases (PR #170) + +## [2.0.11](https://github.com/Ousret/charset_normalizer/compare/2.0.10...2.0.11) (2022-01-30) + +### Added +- Explicit support for Python 3.11 (PR #164) + +### Changed +- The logging behavior have been completely reviewed, now using only TRACE and DEBUG levels (PR #163 #165) + +## [2.0.10](https://github.com/Ousret/charset_normalizer/compare/2.0.9...2.0.10) (2022-01-04) + +### Fixed +- Fallback match entries might lead to UnicodeDecodeError for large bytes sequence (PR #154) + +### Changed +- Skipping the language-detection (CD) on ASCII (PR #155) + +## [2.0.9](https://github.com/Ousret/charset_normalizer/compare/2.0.8...2.0.9) (2021-12-03) + +### Changed +- Moderating the logging impact (since 2.0.8) for specific environments (PR #147) + +### Fixed +- Wrong logging level applied when setting kwarg `explain` to True (PR #146) + +## [2.0.8](https://github.com/Ousret/charset_normalizer/compare/2.0.7...2.0.8) (2021-11-24) +### Changed +- Improvement over Vietnamese detection (PR #126) +- MD improvement on trailing data and long foreign (non-pure latin) data (PR #124) +- Efficiency improvements in cd/alphabet_languages from [@adbar](https://github.com/adbar) (PR #122) +- call sum() without an intermediary list following PEP 289 recommendations from [@adbar](https://github.com/adbar) (PR #129) +- Code style as refactored by Sourcery-AI (PR #131) +- Minor adjustment on the MD around european words (PR #133) +- Remove and replace SRTs from assets / tests (PR #139) +- Initialize the library logger with a `NullHandler` by default from [@nmaynes](https://github.com/nmaynes) (PR #135) +- Setting kwarg `explain` to True will add provisionally (bounded to function lifespan) a specific stream handler (PR #135) + +### Fixed +- Fix large (misleading) sequence giving UnicodeDecodeError (PR #137) +- Avoid using too insignificant chunk (PR #137) + +### Added +- Add and expose function `set_logging_handler` to configure a specific StreamHandler from [@nmaynes](https://github.com/nmaynes) (PR #135) +- Add `CHANGELOG.md` entries, format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) (PR #141) + +## [2.0.7](https://github.com/Ousret/charset_normalizer/compare/2.0.6...2.0.7) (2021-10-11) +### Added +- Add support for Kazakh (Cyrillic) language detection (PR #109) + +### Changed +- Further, improve inferring the language from a given single-byte code page (PR #112) +- Vainly trying to leverage PEP263 when PEP3120 is not supported (PR #116) +- Refactoring for potential performance improvements in loops from [@adbar](https://github.com/adbar) (PR #113) +- Various detection improvement (MD+CD) (PR #117) + +### Removed +- Remove redundant logging entry about detected language(s) (PR #115) + +### Fixed +- Fix a minor inconsistency between Python 3.5 and other versions regarding language detection (PR #117 #102) + +## [2.0.6](https://github.com/Ousret/charset_normalizer/compare/2.0.5...2.0.6) (2021-09-18) +### Fixed +- Unforeseen regression with the loss of the backward-compatibility with some older minor of Python 3.5.x (PR #100) +- Fix CLI crash when using --minimal output in certain cases (PR #103) + +### Changed +- Minor improvement to the detection efficiency (less than 1%) (PR #106 #101) + +## [2.0.5](https://github.com/Ousret/charset_normalizer/compare/2.0.4...2.0.5) (2021-09-14) +### Changed +- The project now comply with: flake8, mypy, isort and black to ensure a better overall quality (PR #81) +- The BC-support with v1.x was improved, the old staticmethods are restored (PR #82) +- The Unicode detection is slightly improved (PR #93) +- Add syntax sugar \_\_bool\_\_ for results CharsetMatches list-container (PR #91) + +### Removed +- The project no longer raise warning on tiny content given for detection, will be simply logged as warning instead (PR #92) + +### Fixed +- In some rare case, the chunks extractor could cut in the middle of a multi-byte character and could mislead the mess detection (PR #95) +- Some rare 'space' characters could trip up the UnprintablePlugin/Mess detection (PR #96) +- The MANIFEST.in was not exhaustive (PR #78) + +## [2.0.4](https://github.com/Ousret/charset_normalizer/compare/2.0.3...2.0.4) (2021-07-30) +### Fixed +- The CLI no longer raise an unexpected exception when no encoding has been found (PR #70) +- Fix accessing the 'alphabets' property when the payload contains surrogate characters (PR #68) +- The logger could mislead (explain=True) on detected languages and the impact of one MBCS match (PR #72) +- Submatch factoring could be wrong in rare edge cases (PR #72) +- Multiple files given to the CLI were ignored when publishing results to STDOUT. (After the first path) (PR #72) +- Fix line endings from CRLF to LF for certain project files (PR #67) + +### Changed +- Adjust the MD to lower the sensitivity, thus improving the global detection reliability (PR #69 #76) +- Allow fallback on specified encoding if any (PR #71) + +## [2.0.3](https://github.com/Ousret/charset_normalizer/compare/2.0.2...2.0.3) (2021-07-16) +### Changed +- Part of the detection mechanism has been improved to be less sensitive, resulting in more accurate detection results. Especially ASCII. (PR #63) +- According to the community wishes, the detection will fall back on ASCII or UTF-8 in a last-resort case. (PR #64) + +## [2.0.2](https://github.com/Ousret/charset_normalizer/compare/2.0.1...2.0.2) (2021-07-15) +### Fixed +- Empty/Too small JSON payload miss-detection fixed. Report from [@tseaver](https://github.com/tseaver) (PR #59) + +### Changed +- Don't inject unicodedata2 into sys.modules from [@akx](https://github.com/akx) (PR #57) + +## [2.0.1](https://github.com/Ousret/charset_normalizer/compare/2.0.0...2.0.1) (2021-07-13) +### Fixed +- Make it work where there isn't a filesystem available, dropping assets frequencies.json. Report from [@sethmlarson](https://github.com/sethmlarson). (PR #55) +- Using explain=False permanently disable the verbose output in the current runtime (PR #47) +- One log entry (language target preemptive) was not show in logs when using explain=True (PR #47) +- Fix undesired exception (ValueError) on getitem of instance CharsetMatches (PR #52) + +### Changed +- Public function normalize default args values were not aligned with from_bytes (PR #53) + +### Added +- You may now use charset aliases in cp_isolation and cp_exclusion arguments (PR #47) + +## [2.0.0](https://github.com/Ousret/charset_normalizer/compare/1.4.1...2.0.0) (2021-07-02) +### Changed +- 4x to 5 times faster than the previous 1.4.0 release. At least 2x faster than Chardet. +- Accent has been made on UTF-8 detection, should perform rather instantaneous. +- The backward compatibility with Chardet has been greatly improved. The legacy detect function returns an identical charset name whenever possible. +- The detection mechanism has been slightly improved, now Turkish content is detected correctly (most of the time) +- The program has been rewritten to ease the readability and maintainability. (+Using static typing)+ +- utf_7 detection has been reinstated. + +### Removed +- This package no longer require anything when used with Python 3.5 (Dropped cached_property) +- Removed support for these languages: Catalan, Esperanto, Kazakh, Baque, Volapük, Azeri, Galician, Nynorsk, Macedonian, and Serbocroatian. +- The exception hook on UnicodeDecodeError has been removed. + +### Deprecated +- Methods coherence_non_latin, w_counter, chaos_secondary_pass of the class CharsetMatch are now deprecated and scheduled for removal in v3.0 + +### Fixed +- The CLI output used the relative path of the file(s). Should be absolute. + +## [1.4.1](https://github.com/Ousret/charset_normalizer/compare/1.4.0...1.4.1) (2021-05-28) +### Fixed +- Logger configuration/usage no longer conflict with others (PR #44) + +## [1.4.0](https://github.com/Ousret/charset_normalizer/compare/1.3.9...1.4.0) (2021-05-21) +### Removed +- Using standard logging instead of using the package loguru. +- Dropping nose test framework in favor of the maintained pytest. +- Choose to not use dragonmapper package to help with gibberish Chinese/CJK text. +- Require cached_property only for Python 3.5 due to constraint. Dropping for every other interpreter version. +- Stop support for UTF-7 that does not contain a SIG. +- Dropping PrettyTable, replaced with pure JSON output in CLI. + +### Fixed +- BOM marker in a CharsetNormalizerMatch instance could be False in rare cases even if obviously present. Due to the sub-match factoring process. +- Not searching properly for the BOM when trying utf32/16 parent codec. + +### Changed +- Improving the package final size by compressing frequencies.json. +- Huge improvement over the larges payload. + +### Added +- CLI now produces JSON consumable output. +- Return ASCII if given sequences fit. Given reasonable confidence. + +## [1.3.9](https://github.com/Ousret/charset_normalizer/compare/1.3.8...1.3.9) (2021-05-13) + +### Fixed +- In some very rare cases, you may end up getting encode/decode errors due to a bad bytes payload (PR #40) + +## [1.3.8](https://github.com/Ousret/charset_normalizer/compare/1.3.7...1.3.8) (2021-05-12) + +### Fixed +- Empty given payload for detection may cause an exception if trying to access the `alphabets` property. (PR #39) + +## [1.3.7](https://github.com/Ousret/charset_normalizer/compare/1.3.6...1.3.7) (2021-05-12) + +### Fixed +- The legacy detect function should return UTF-8-SIG if sig is present in the payload. (PR #38) + +## [1.3.6](https://github.com/Ousret/charset_normalizer/compare/1.3.5...1.3.6) (2021-02-09) + +### Changed +- Amend the previous release to allow prettytable 2.0 (PR #35) + +## [1.3.5](https://github.com/Ousret/charset_normalizer/compare/1.3.4...1.3.5) (2021-02-08) + +### Fixed +- Fix error while using the package with a python pre-release interpreter (PR #33) + +### Changed +- Dependencies refactoring, constraints revised. + +### Added +- Add python 3.9 and 3.10 to the supported interpreters + +MIT License + +Copyright (c) 2019 TAHRI Ahmed R. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/requests/python/charset_normalizer-3.2.0.dist-info/RECORD b/requests/python/charset_normalizer-3.2.0.dist-info/RECORD new file mode 100644 index 0000000..5cd4703 --- /dev/null +++ b/requests/python/charset_normalizer-3.2.0.dist-info/RECORD @@ -0,0 +1,35 @@ +../../bin/normalizer,sha256=s96Kuek2W41Ri7tEiehraywrWWFl5pttBZvlFrupd74,252 +charset_normalizer-3.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +charset_normalizer-3.2.0.dist-info/LICENSE,sha256=6zGgxaT7Cbik4yBV0lweX5w1iidS_vPNcgIT0cz-4kE,1070 +charset_normalizer-3.2.0.dist-info/METADATA,sha256=K2QHhX9fQ7jFxO7y4IQk7TqYZSH7iTyxgTJQxA65EH0,31284 +charset_normalizer-3.2.0.dist-info/RECORD,, +charset_normalizer-3.2.0.dist-info/WHEEL,sha256=8KU227XctfdX2qUwyjQUO-ciQuZtmyPUCKmeGV6Byto,152 +charset_normalizer-3.2.0.dist-info/entry_points.txt,sha256=uYo8aIGLWv8YgWfSna5HnfY_En4pkF1w4bgawNAXzP0,76 +charset_normalizer-3.2.0.dist-info/top_level.txt,sha256=7ASyzePr8_xuZWJsnqJjIBtyV8vhEo0wBCv1MPRRi3Q,19 +charset_normalizer/__init__.py,sha256=UzI3xC8PhmcLRMzSgPb6minTmRq0kWznnCBJ8ZCc2XI,1577 +charset_normalizer/__pycache__/__init__.cpython-311.pyc,, +charset_normalizer/__pycache__/api.cpython-311.pyc,, +charset_normalizer/__pycache__/cd.cpython-311.pyc,, +charset_normalizer/__pycache__/constant.cpython-311.pyc,, +charset_normalizer/__pycache__/legacy.cpython-311.pyc,, +charset_normalizer/__pycache__/md.cpython-311.pyc,, +charset_normalizer/__pycache__/models.cpython-311.pyc,, +charset_normalizer/__pycache__/utils.cpython-311.pyc,, +charset_normalizer/__pycache__/version.cpython-311.pyc,, +charset_normalizer/api.py,sha256=WOlWjy6wT8SeMYFpaGbXZFN1TMXa-s8vZYfkL4G29iQ,21097 +charset_normalizer/assets/__init__.py,sha256=wpRfujN7GJuEE5wHHo3wEDVoJ5ovzRIxsImyimCBfGU,20069 +charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc,, +charset_normalizer/cd.py,sha256=mZuiTSKq4XpweSDD2H4T4R3Axtaa-QS0tpEWdpMuAzQ,12554 +charset_normalizer/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc,, +charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc,, +charset_normalizer/cli/normalizer.py,sha256=2F-xURZJzo063Ye-2RLJ2wcmURpbKeAzKwpiws65dAs,9744 +charset_normalizer/constant.py,sha256=PmCeoKXqq3ZbCtCUpKHwwFBIv9DXMT_an1yd24q28mA,19101 +charset_normalizer/legacy.py,sha256=T-QuVMsMeDiQEk8WSszMrzVJg_14AMeSkmHdRYhdl1k,2071 +charset_normalizer/md.cpython-311-x86_64-linux-gnu.so,sha256=drk8jTNY7lZ9fU8bZ_e8bFSbF5erdCt5BCN8lI49IZ0,17496 +charset_normalizer/md.py,sha256=gEWM354DqBsiSoNkKzFrIW4KRFQjQLbqYnbHAdBwj74,18682 +charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so,sha256=YZtTuQgOU2p-fpmS6PZJBbjPI0M-IDmYj_7urdONnIQ,418056 +charset_normalizer/models.py,sha256=mC11wo84l00u2o03TRNX7M5ItBAbPUKKXgJSFxA35GY,11492 +charset_normalizer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +charset_normalizer/utils.py,sha256=HdwmBy9vRqcRVGHKZqYWtpiS5wA35cLjnlVQCm0Bq9s,11578 +charset_normalizer/version.py,sha256=LbH8odlzMnwR4xZF9wCsnGXQA19axDO7HZ-J9hegIX0,79 diff --git a/requests/python/charset_normalizer-3.2.0.dist-info/WHEEL b/requests/python/charset_normalizer-3.2.0.dist-info/WHEEL new file mode 100644 index 0000000..3bed0cb --- /dev/null +++ b/requests/python/charset_normalizer-3.2.0.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.40.0) +Root-Is-Purelib: false +Tag: cp311-cp311-manylinux_2_17_x86_64 +Tag: cp311-cp311-manylinux2014_x86_64 + diff --git a/requests/python/charset_normalizer-3.2.0.dist-info/entry_points.txt b/requests/python/charset_normalizer-3.2.0.dist-info/entry_points.txt new file mode 100644 index 0000000..a06d360 --- /dev/null +++ b/requests/python/charset_normalizer-3.2.0.dist-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +normalizer = charset_normalizer.cli.normalizer:cli_detect diff --git a/requests/python/charset_normalizer-3.2.0.dist-info/top_level.txt b/requests/python/charset_normalizer-3.2.0.dist-info/top_level.txt new file mode 100644 index 0000000..66958f0 --- /dev/null +++ b/requests/python/charset_normalizer-3.2.0.dist-info/top_level.txt @@ -0,0 +1 @@ +charset_normalizer diff --git a/requests/python/charset_normalizer/__init__.py b/requests/python/charset_normalizer/__init__.py new file mode 100644 index 0000000..55991fc --- /dev/null +++ b/requests/python/charset_normalizer/__init__.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +""" +Charset-Normalizer +~~~~~~~~~~~~~~ +The Real First Universal Charset Detector. +A library that helps you read text from an unknown charset encoding. +Motivated by chardet, This package is trying to resolve the issue by taking a new approach. +All IANA character set names for which the Python core library provides codecs are supported. + +Basic usage: + >>> from charset_normalizer import from_bytes + >>> results = from_bytes('Bсеки човек има право на образование. Oбразованието!'.encode('utf_8')) + >>> best_guess = results.best() + >>> str(best_guess) + 'Bсеки човек има право на образование. Oбразованието!' + +Others methods and usages are available - see the full documentation +at . +:copyright: (c) 2021 by Ahmed TAHRI +:license: MIT, see LICENSE for more details. +""" +import logging + +from .api import from_bytes, from_fp, from_path, is_binary +from .legacy import detect +from .models import CharsetMatch, CharsetMatches +from .utils import set_logging_handler +from .version import VERSION, __version__ + +__all__ = ( + "from_fp", + "from_path", + "from_bytes", + "is_binary", + "detect", + "CharsetMatch", + "CharsetMatches", + "__version__", + "VERSION", + "set_logging_handler", +) + +# Attach a NullHandler to the top level logger by default +# https://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library + +logging.getLogger("charset_normalizer").addHandler(logging.NullHandler()) diff --git a/requests/python/charset_normalizer/__pycache__/__init__.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e7d23ae Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/api.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/api.cpython-311.pyc new file mode 100644 index 0000000..369c017 Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/api.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/cd.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/cd.cpython-311.pyc new file mode 100644 index 0000000..40417de Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/cd.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/constant.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/constant.cpython-311.pyc new file mode 100644 index 0000000..d26dee0 Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/constant.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/legacy.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/legacy.cpython-311.pyc new file mode 100644 index 0000000..97756d8 Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/legacy.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/md.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/md.cpython-311.pyc new file mode 100644 index 0000000..c564ae1 Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/md.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/models.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..b5bd4c1 Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/models.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/utils.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..87869b7 Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/utils.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/__pycache__/version.cpython-311.pyc b/requests/python/charset_normalizer/__pycache__/version.cpython-311.pyc new file mode 100644 index 0000000..d7dc94f Binary files /dev/null and b/requests/python/charset_normalizer/__pycache__/version.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/api.py b/requests/python/charset_normalizer/api.py new file mode 100644 index 0000000..0ba08e3 --- /dev/null +++ b/requests/python/charset_normalizer/api.py @@ -0,0 +1,626 @@ +import logging +from os import PathLike +from typing import BinaryIO, List, Optional, Set, Union + +from .cd import ( + coherence_ratio, + encoding_languages, + mb_encoding_languages, + merge_coherence_ratios, +) +from .constant import IANA_SUPPORTED, TOO_BIG_SEQUENCE, TOO_SMALL_SEQUENCE, TRACE +from .md import mess_ratio +from .models import CharsetMatch, CharsetMatches +from .utils import ( + any_specified_encoding, + cut_sequence_chunks, + iana_name, + identify_sig_or_bom, + is_cp_similar, + is_multi_byte_encoding, + should_strip_sig_or_bom, +) + +# Will most likely be controversial +# logging.addLevelName(TRACE, "TRACE") +logger = logging.getLogger("charset_normalizer") +explain_handler = logging.StreamHandler() +explain_handler.setFormatter( + logging.Formatter("%(asctime)s | %(levelname)s | %(message)s") +) + + +def from_bytes( + sequences: Union[bytes, bytearray], + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.2, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = True, +) -> CharsetMatches: + """ + Given a raw bytes sequence, return the best possibles charset usable to render str objects. + If there is no results, it is a strong indicator that the source is binary/not text. + By default, the process will extract 5 blocks of 512o each to assess the mess and coherence of a given sequence. + And will give up a particular code page after 20% of measured mess. Those criteria are customizable at will. + + The preemptive behavior DOES NOT replace the traditional detection workflow, it prioritize a particular code page + but never take it for granted. Can improve the performance. + + You may want to focus your attention to some code page or/and not others, use cp_isolation and cp_exclusion for that + purpose. + + This function will strip the SIG in the payload/sequence every time except on UTF-16, UTF-32. + By default the library does not setup any handler other than the NullHandler, if you choose to set the 'explain' + toggle to True it will alter the logger configuration to add a StreamHandler that is suitable for debugging. + Custom logging format and handler can be set manually. + """ + + if not isinstance(sequences, (bytearray, bytes)): + raise TypeError( + "Expected object of type bytes or bytearray, got: {0}".format( + type(sequences) + ) + ) + + if explain: + previous_logger_level: int = logger.level + logger.addHandler(explain_handler) + logger.setLevel(TRACE) + + length: int = len(sequences) + + if length == 0: + logger.debug("Encoding detection on empty bytes, assuming utf_8 intention.") + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level or logging.WARNING) + return CharsetMatches([CharsetMatch(sequences, "utf_8", 0.0, False, [], "")]) + + if cp_isolation is not None: + logger.log( + TRACE, + "cp_isolation is set. use this flag for debugging purpose. " + "limited list of encoding allowed : %s.", + ", ".join(cp_isolation), + ) + cp_isolation = [iana_name(cp, False) for cp in cp_isolation] + else: + cp_isolation = [] + + if cp_exclusion is not None: + logger.log( + TRACE, + "cp_exclusion is set. use this flag for debugging purpose. " + "limited list of encoding excluded : %s.", + ", ".join(cp_exclusion), + ) + cp_exclusion = [iana_name(cp, False) for cp in cp_exclusion] + else: + cp_exclusion = [] + + if length <= (chunk_size * steps): + logger.log( + TRACE, + "override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.", + steps, + chunk_size, + length, + ) + steps = 1 + chunk_size = length + + if steps > 1 and length / steps < chunk_size: + chunk_size = int(length / steps) + + is_too_small_sequence: bool = len(sequences) < TOO_SMALL_SEQUENCE + is_too_large_sequence: bool = len(sequences) >= TOO_BIG_SEQUENCE + + if is_too_small_sequence: + logger.log( + TRACE, + "Trying to detect encoding from a tiny portion of ({}) byte(s).".format( + length + ), + ) + elif is_too_large_sequence: + logger.log( + TRACE, + "Using lazy str decoding because the payload is quite large, ({}) byte(s).".format( + length + ), + ) + + prioritized_encodings: List[str] = [] + + specified_encoding: Optional[str] = ( + any_specified_encoding(sequences) if preemptive_behaviour else None + ) + + if specified_encoding is not None: + prioritized_encodings.append(specified_encoding) + logger.log( + TRACE, + "Detected declarative mark in sequence. Priority +1 given for %s.", + specified_encoding, + ) + + tested: Set[str] = set() + tested_but_hard_failure: List[str] = [] + tested_but_soft_failure: List[str] = [] + + fallback_ascii: Optional[CharsetMatch] = None + fallback_u8: Optional[CharsetMatch] = None + fallback_specified: Optional[CharsetMatch] = None + + results: CharsetMatches = CharsetMatches() + + sig_encoding, sig_payload = identify_sig_or_bom(sequences) + + if sig_encoding is not None: + prioritized_encodings.append(sig_encoding) + logger.log( + TRACE, + "Detected a SIG or BOM mark on first %i byte(s). Priority +1 given for %s.", + len(sig_payload), + sig_encoding, + ) + + prioritized_encodings.append("ascii") + + if "utf_8" not in prioritized_encodings: + prioritized_encodings.append("utf_8") + + for encoding_iana in prioritized_encodings + IANA_SUPPORTED: + if cp_isolation and encoding_iana not in cp_isolation: + continue + + if cp_exclusion and encoding_iana in cp_exclusion: + continue + + if encoding_iana in tested: + continue + + tested.add(encoding_iana) + + decoded_payload: Optional[str] = None + bom_or_sig_available: bool = sig_encoding == encoding_iana + strip_sig_or_bom: bool = bom_or_sig_available and should_strip_sig_or_bom( + encoding_iana + ) + + if encoding_iana in {"utf_16", "utf_32"} and not bom_or_sig_available: + logger.log( + TRACE, + "Encoding %s won't be tested as-is because it require a BOM. Will try some sub-encoder LE/BE.", + encoding_iana, + ) + continue + if encoding_iana in {"utf_7"} and not bom_or_sig_available: + logger.log( + TRACE, + "Encoding %s won't be tested as-is because detection is unreliable without BOM/SIG.", + encoding_iana, + ) + continue + + try: + is_multi_byte_decoder: bool = is_multi_byte_encoding(encoding_iana) + except (ModuleNotFoundError, ImportError): + logger.log( + TRACE, + "Encoding %s does not provide an IncrementalDecoder", + encoding_iana, + ) + continue + + try: + if is_too_large_sequence and is_multi_byte_decoder is False: + str( + sequences[: int(50e4)] + if strip_sig_or_bom is False + else sequences[len(sig_payload) : int(50e4)], + encoding=encoding_iana, + ) + else: + decoded_payload = str( + sequences + if strip_sig_or_bom is False + else sequences[len(sig_payload) :], + encoding=encoding_iana, + ) + except (UnicodeDecodeError, LookupError) as e: + if not isinstance(e, LookupError): + logger.log( + TRACE, + "Code page %s does not fit given bytes sequence at ALL. %s", + encoding_iana, + str(e), + ) + tested_but_hard_failure.append(encoding_iana) + continue + + similar_soft_failure_test: bool = False + + for encoding_soft_failed in tested_but_soft_failure: + if is_cp_similar(encoding_iana, encoding_soft_failed): + similar_soft_failure_test = True + break + + if similar_soft_failure_test: + logger.log( + TRACE, + "%s is deemed too similar to code page %s and was consider unsuited already. Continuing!", + encoding_iana, + encoding_soft_failed, + ) + continue + + r_ = range( + 0 if not bom_or_sig_available else len(sig_payload), + length, + int(length / steps), + ) + + multi_byte_bonus: bool = ( + is_multi_byte_decoder + and decoded_payload is not None + and len(decoded_payload) < length + ) + + if multi_byte_bonus: + logger.log( + TRACE, + "Code page %s is a multi byte encoding table and it appear that at least one character " + "was encoded using n-bytes.", + encoding_iana, + ) + + max_chunk_gave_up: int = int(len(r_) / 4) + + max_chunk_gave_up = max(max_chunk_gave_up, 2) + early_stop_count: int = 0 + lazy_str_hard_failure = False + + md_chunks: List[str] = [] + md_ratios = [] + + try: + for chunk in cut_sequence_chunks( + sequences, + encoding_iana, + r_, + chunk_size, + bom_or_sig_available, + strip_sig_or_bom, + sig_payload, + is_multi_byte_decoder, + decoded_payload, + ): + md_chunks.append(chunk) + + md_ratios.append( + mess_ratio( + chunk, + threshold, + explain is True and 1 <= len(cp_isolation) <= 2, + ) + ) + + if md_ratios[-1] >= threshold: + early_stop_count += 1 + + if (early_stop_count >= max_chunk_gave_up) or ( + bom_or_sig_available and strip_sig_or_bom is False + ): + break + except ( + UnicodeDecodeError + ) as e: # Lazy str loading may have missed something there + logger.log( + TRACE, + "LazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %s", + encoding_iana, + str(e), + ) + early_stop_count = max_chunk_gave_up + lazy_str_hard_failure = True + + # We might want to check the sequence again with the whole content + # Only if initial MD tests passes + if ( + not lazy_str_hard_failure + and is_too_large_sequence + and not is_multi_byte_decoder + ): + try: + sequences[int(50e3) :].decode(encoding_iana, errors="strict") + except UnicodeDecodeError as e: + logger.log( + TRACE, + "LazyStr Loading: After final lookup, code page %s does not fit given bytes sequence at ALL. %s", + encoding_iana, + str(e), + ) + tested_but_hard_failure.append(encoding_iana) + continue + + mean_mess_ratio: float = sum(md_ratios) / len(md_ratios) if md_ratios else 0.0 + if mean_mess_ratio >= threshold or early_stop_count >= max_chunk_gave_up: + tested_but_soft_failure.append(encoding_iana) + logger.log( + TRACE, + "%s was excluded because of initial chaos probing. Gave up %i time(s). " + "Computed mean chaos is %f %%.", + encoding_iana, + early_stop_count, + round(mean_mess_ratio * 100, ndigits=3), + ) + # Preparing those fallbacks in case we got nothing. + if ( + enable_fallback + and encoding_iana in ["ascii", "utf_8", specified_encoding] + and not lazy_str_hard_failure + ): + fallback_entry = CharsetMatch( + sequences, encoding_iana, threshold, False, [], decoded_payload + ) + if encoding_iana == specified_encoding: + fallback_specified = fallback_entry + elif encoding_iana == "ascii": + fallback_ascii = fallback_entry + else: + fallback_u8 = fallback_entry + continue + + logger.log( + TRACE, + "%s passed initial chaos probing. Mean measured chaos is %f %%", + encoding_iana, + round(mean_mess_ratio * 100, ndigits=3), + ) + + if not is_multi_byte_decoder: + target_languages: List[str] = encoding_languages(encoding_iana) + else: + target_languages = mb_encoding_languages(encoding_iana) + + if target_languages: + logger.log( + TRACE, + "{} should target any language(s) of {}".format( + encoding_iana, str(target_languages) + ), + ) + + cd_ratios = [] + + # We shall skip the CD when its about ASCII + # Most of the time its not relevant to run "language-detection" on it. + if encoding_iana != "ascii": + for chunk in md_chunks: + chunk_languages = coherence_ratio( + chunk, + language_threshold, + ",".join(target_languages) if target_languages else None, + ) + + cd_ratios.append(chunk_languages) + + cd_ratios_merged = merge_coherence_ratios(cd_ratios) + + if cd_ratios_merged: + logger.log( + TRACE, + "We detected language {} using {}".format( + cd_ratios_merged, encoding_iana + ), + ) + + results.append( + CharsetMatch( + sequences, + encoding_iana, + mean_mess_ratio, + bom_or_sig_available, + cd_ratios_merged, + decoded_payload, + ) + ) + + if ( + encoding_iana in [specified_encoding, "ascii", "utf_8"] + and mean_mess_ratio < 0.1 + ): + logger.debug( + "Encoding detection: %s is most likely the one.", encoding_iana + ) + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level) + return CharsetMatches([results[encoding_iana]]) + + if encoding_iana == sig_encoding: + logger.debug( + "Encoding detection: %s is most likely the one as we detected a BOM or SIG within " + "the beginning of the sequence.", + encoding_iana, + ) + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level) + return CharsetMatches([results[encoding_iana]]) + + if len(results) == 0: + if fallback_u8 or fallback_ascii or fallback_specified: + logger.log( + TRACE, + "Nothing got out of the detection process. Using ASCII/UTF-8/Specified fallback.", + ) + + if fallback_specified: + logger.debug( + "Encoding detection: %s will be used as a fallback match", + fallback_specified.encoding, + ) + results.append(fallback_specified) + elif ( + (fallback_u8 and fallback_ascii is None) + or ( + fallback_u8 + and fallback_ascii + and fallback_u8.fingerprint != fallback_ascii.fingerprint + ) + or (fallback_u8 is not None) + ): + logger.debug("Encoding detection: utf_8 will be used as a fallback match") + results.append(fallback_u8) + elif fallback_ascii: + logger.debug("Encoding detection: ascii will be used as a fallback match") + results.append(fallback_ascii) + + if results: + logger.debug( + "Encoding detection: Found %s as plausible (best-candidate) for content. With %i alternatives.", + results.best().encoding, # type: ignore + len(results) - 1, + ) + else: + logger.debug("Encoding detection: Unable to determine any suitable charset.") + + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level) + + return results + + +def from_fp( + fp: BinaryIO, + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.20, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = True, +) -> CharsetMatches: + """ + Same thing than the function from_bytes but using a file pointer that is already ready. + Will not close the file pointer. + """ + return from_bytes( + fp.read(), + steps, + chunk_size, + threshold, + cp_isolation, + cp_exclusion, + preemptive_behaviour, + explain, + language_threshold, + enable_fallback, + ) + + +def from_path( + path: Union[str, bytes, PathLike], # type: ignore[type-arg] + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.20, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = True, +) -> CharsetMatches: + """ + Same thing than the function from_bytes but with one extra step. Opening and reading given file path in binary mode. + Can raise IOError. + """ + with open(path, "rb") as fp: + return from_fp( + fp, + steps, + chunk_size, + threshold, + cp_isolation, + cp_exclusion, + preemptive_behaviour, + explain, + language_threshold, + enable_fallback, + ) + + +def is_binary( + fp_or_path_or_payload: Union[PathLike, str, BinaryIO, bytes], # type: ignore[type-arg] + steps: int = 5, + chunk_size: int = 512, + threshold: float = 0.20, + cp_isolation: Optional[List[str]] = None, + cp_exclusion: Optional[List[str]] = None, + preemptive_behaviour: bool = True, + explain: bool = False, + language_threshold: float = 0.1, + enable_fallback: bool = False, +) -> bool: + """ + Detect if the given input (file, bytes, or path) points to a binary file. aka. not a string. + Based on the same main heuristic algorithms and default kwargs at the sole exception that fallbacks match + are disabled to be stricter around ASCII-compatible but unlikely to be a string. + """ + if isinstance(fp_or_path_or_payload, (str, PathLike)): + guesses = from_path( + fp_or_path_or_payload, + steps=steps, + chunk_size=chunk_size, + threshold=threshold, + cp_isolation=cp_isolation, + cp_exclusion=cp_exclusion, + preemptive_behaviour=preemptive_behaviour, + explain=explain, + language_threshold=language_threshold, + enable_fallback=enable_fallback, + ) + elif isinstance( + fp_or_path_or_payload, + ( + bytes, + bytearray, + ), + ): + guesses = from_bytes( + fp_or_path_or_payload, + steps=steps, + chunk_size=chunk_size, + threshold=threshold, + cp_isolation=cp_isolation, + cp_exclusion=cp_exclusion, + preemptive_behaviour=preemptive_behaviour, + explain=explain, + language_threshold=language_threshold, + enable_fallback=enable_fallback, + ) + else: + guesses = from_fp( + fp_or_path_or_payload, + steps=steps, + chunk_size=chunk_size, + threshold=threshold, + cp_isolation=cp_isolation, + cp_exclusion=cp_exclusion, + preemptive_behaviour=preemptive_behaviour, + explain=explain, + language_threshold=language_threshold, + enable_fallback=enable_fallback, + ) + + return not guesses diff --git a/requests/python/charset_normalizer/assets/__init__.py b/requests/python/charset_normalizer/assets/__init__.py new file mode 100644 index 0000000..9075930 --- /dev/null +++ b/requests/python/charset_normalizer/assets/__init__.py @@ -0,0 +1,1440 @@ +# -*- coding: utf-8 -*- +from typing import Dict, List + +# Language label that contain the em dash "—" +# character are to be considered alternative seq to origin +FREQUENCIES: Dict[str, List[str]] = { + "English": [ + "e", + "a", + "t", + "i", + "o", + "n", + "s", + "r", + "h", + "l", + "d", + "c", + "u", + "m", + "f", + "p", + "g", + "w", + "y", + "b", + "v", + "k", + "x", + "j", + "z", + "q", + ], + "English—": [ + "e", + "a", + "t", + "i", + "o", + "n", + "s", + "r", + "h", + "l", + "d", + "c", + "m", + "u", + "f", + "p", + "g", + "w", + "b", + "y", + "v", + "k", + "j", + "x", + "z", + "q", + ], + "German": [ + "e", + "n", + "i", + "r", + "s", + "t", + "a", + "d", + "h", + "u", + "l", + "g", + "o", + "c", + "m", + "b", + "f", + "k", + "w", + "z", + "p", + "v", + "ü", + "ä", + "ö", + "j", + ], + "French": [ + "e", + "a", + "s", + "n", + "i", + "t", + "r", + "l", + "u", + "o", + "d", + "c", + "p", + "m", + "é", + "v", + "g", + "f", + "b", + "h", + "q", + "à", + "x", + "è", + "y", + "j", + ], + "Dutch": [ + "e", + "n", + "a", + "i", + "r", + "t", + "o", + "d", + "s", + "l", + "g", + "h", + "v", + "m", + "u", + "k", + "c", + "p", + "b", + "w", + "j", + "z", + "f", + "y", + "x", + "ë", + ], + "Italian": [ + "e", + "i", + "a", + "o", + "n", + "l", + "t", + "r", + "s", + "c", + "d", + "u", + "p", + "m", + "g", + "v", + "f", + "b", + "z", + "h", + "q", + "è", + "à", + "k", + "y", + "ò", + ], + "Polish": [ + "a", + "i", + "o", + "e", + "n", + "r", + "z", + "w", + "s", + "c", + "t", + "k", + "y", + "d", + "p", + "m", + "u", + "l", + "j", + "ł", + "g", + "b", + "h", + "ą", + "ę", + "ó", + ], + "Spanish": [ + "e", + "a", + "o", + "n", + "s", + "r", + "i", + "l", + "d", + "t", + "c", + "u", + "m", + "p", + "b", + "g", + "v", + "f", + "y", + "ó", + "h", + "q", + "í", + "j", + "z", + "á", + ], + "Russian": [ + "о", + "а", + "е", + "и", + "н", + "с", + "т", + "р", + "в", + "л", + "к", + "м", + "д", + "п", + "у", + "г", + "я", + "ы", + "з", + "б", + "й", + "ь", + "ч", + "х", + "ж", + "ц", + ], + # Jap-Kanji + "Japanese": [ + "人", + "一", + "大", + "亅", + "丁", + "丨", + "竹", + "笑", + "口", + "日", + "今", + "二", + "彳", + "行", + "十", + "土", + "丶", + "寸", + "寺", + "時", + "乙", + "丿", + "乂", + "气", + "気", + "冂", + "巾", + "亠", + "市", + "目", + "儿", + "見", + "八", + "小", + "凵", + "県", + "月", + "彐", + "門", + "間", + "木", + "東", + "山", + "出", + "本", + "中", + "刀", + "分", + "耳", + "又", + "取", + "最", + "言", + "田", + "心", + "思", + "刂", + "前", + "京", + "尹", + "事", + "生", + "厶", + "云", + "会", + "未", + "来", + "白", + "冫", + "楽", + "灬", + "馬", + "尸", + "尺", + "駅", + "明", + "耂", + "者", + "了", + "阝", + "都", + "高", + "卜", + "占", + "厂", + "广", + "店", + "子", + "申", + "奄", + "亻", + "俺", + "上", + "方", + "冖", + "学", + "衣", + "艮", + "食", + "自", + ], + # Jap-Katakana + "Japanese—": [ + "ー", + "ン", + "ス", + "・", + "ル", + "ト", + "リ", + "イ", + "ア", + "ラ", + "ッ", + "ク", + "ド", + "シ", + "レ", + "ジ", + "タ", + "フ", + "ロ", + "カ", + "テ", + "マ", + "ィ", + "グ", + "バ", + "ム", + "プ", + "オ", + "コ", + "デ", + "ニ", + "ウ", + "メ", + "サ", + "ビ", + "ナ", + "ブ", + "ャ", + "エ", + "ュ", + "チ", + "キ", + "ズ", + "ダ", + "パ", + "ミ", + "ェ", + "ョ", + "ハ", + "セ", + "ベ", + "ガ", + "モ", + "ツ", + "ネ", + "ボ", + "ソ", + "ノ", + "ァ", + "ヴ", + "ワ", + "ポ", + "ペ", + "ピ", + "ケ", + "ゴ", + "ギ", + "ザ", + "ホ", + "ゲ", + "ォ", + "ヤ", + "ヒ", + "ユ", + "ヨ", + "ヘ", + "ゼ", + "ヌ", + "ゥ", + "ゾ", + "ヶ", + "ヂ", + "ヲ", + "ヅ", + "ヵ", + "ヱ", + "ヰ", + "ヮ", + "ヽ", + "゠", + "ヾ", + "ヷ", + "ヿ", + "ヸ", + "ヹ", + "ヺ", + ], + # Jap-Hiragana + "Japanese——": [ + "の", + "に", + "る", + "た", + "と", + "は", + "し", + "い", + "を", + "で", + "て", + "が", + "な", + "れ", + "か", + "ら", + "さ", + "っ", + "り", + "す", + "あ", + "も", + "こ", + "ま", + "う", + "く", + "よ", + "き", + "ん", + "め", + "お", + "け", + "そ", + "つ", + "だ", + "や", + "え", + "ど", + "わ", + "ち", + "み", + "せ", + "じ", + "ば", + "へ", + "び", + "ず", + "ろ", + "ほ", + "げ", + "む", + "べ", + "ひ", + "ょ", + "ゆ", + "ぶ", + "ご", + "ゃ", + "ね", + "ふ", + "ぐ", + "ぎ", + "ぼ", + "ゅ", + "づ", + "ざ", + "ぞ", + "ぬ", + "ぜ", + "ぱ", + "ぽ", + "ぷ", + "ぴ", + "ぃ", + "ぁ", + "ぇ", + "ぺ", + "ゞ", + "ぢ", + "ぉ", + "ぅ", + "ゐ", + "ゝ", + "ゑ", + "゛", + "゜", + "ゎ", + "ゔ", + "゚", + "ゟ", + "゙", + "ゕ", + "ゖ", + ], + "Portuguese": [ + "a", + "e", + "o", + "s", + "i", + "r", + "d", + "n", + "t", + "m", + "u", + "c", + "l", + "p", + "g", + "v", + "b", + "f", + "h", + "ã", + "q", + "é", + "ç", + "á", + "z", + "í", + ], + "Swedish": [ + "e", + "a", + "n", + "r", + "t", + "s", + "i", + "l", + "d", + "o", + "m", + "k", + "g", + "v", + "h", + "f", + "u", + "p", + "ä", + "c", + "b", + "ö", + "å", + "y", + "j", + "x", + ], + "Chinese": [ + "的", + "一", + "是", + "不", + "了", + "在", + "人", + "有", + "我", + "他", + "这", + "个", + "们", + "中", + "来", + "上", + "大", + "为", + "和", + "国", + "地", + "到", + "以", + "说", + "时", + "要", + "就", + "出", + "会", + "可", + "也", + "你", + "对", + "生", + "能", + "而", + "子", + "那", + "得", + "于", + "着", + "下", + "自", + "之", + "年", + "过", + "发", + "后", + "作", + "里", + "用", + "道", + "行", + "所", + "然", + "家", + "种", + "事", + "成", + "方", + "多", + "经", + "么", + "去", + "法", + "学", + "如", + "都", + "同", + "现", + "当", + "没", + "动", + "面", + "起", + "看", + "定", + "天", + "分", + "还", + "进", + "好", + "小", + "部", + "其", + "些", + "主", + "样", + "理", + "心", + "她", + "本", + "前", + "开", + "但", + "因", + "只", + "从", + "想", + "实", + ], + "Ukrainian": [ + "о", + "а", + "н", + "і", + "и", + "р", + "в", + "т", + "е", + "с", + "к", + "л", + "у", + "д", + "м", + "п", + "з", + "я", + "ь", + "б", + "г", + "й", + "ч", + "х", + "ц", + "ї", + ], + "Norwegian": [ + "e", + "r", + "n", + "t", + "a", + "s", + "i", + "o", + "l", + "d", + "g", + "k", + "m", + "v", + "f", + "p", + "u", + "b", + "h", + "å", + "y", + "j", + "ø", + "c", + "æ", + "w", + ], + "Finnish": [ + "a", + "i", + "n", + "t", + "e", + "s", + "l", + "o", + "u", + "k", + "ä", + "m", + "r", + "v", + "j", + "h", + "p", + "y", + "d", + "ö", + "g", + "c", + "b", + "f", + "w", + "z", + ], + "Vietnamese": [ + "n", + "h", + "t", + "i", + "c", + "g", + "a", + "o", + "u", + "m", + "l", + "r", + "à", + "đ", + "s", + "e", + "v", + "p", + "b", + "y", + "ư", + "d", + "á", + "k", + "ộ", + "ế", + ], + "Czech": [ + "o", + "e", + "a", + "n", + "t", + "s", + "i", + "l", + "v", + "r", + "k", + "d", + "u", + "m", + "p", + "í", + "c", + "h", + "z", + "á", + "y", + "j", + "b", + "ě", + "é", + "ř", + ], + "Hungarian": [ + "e", + "a", + "t", + "l", + "s", + "n", + "k", + "r", + "i", + "o", + "z", + "á", + "é", + "g", + "m", + "b", + "y", + "v", + "d", + "h", + "u", + "p", + "j", + "ö", + "f", + "c", + ], + "Korean": [ + "이", + "다", + "에", + "의", + "는", + "로", + "하", + "을", + "가", + "고", + "지", + "서", + "한", + "은", + "기", + "으", + "년", + "대", + "사", + "시", + "를", + "리", + "도", + "인", + "스", + "일", + ], + "Indonesian": [ + "a", + "n", + "e", + "i", + "r", + "t", + "u", + "s", + "d", + "k", + "m", + "l", + "g", + "p", + "b", + "o", + "h", + "y", + "j", + "c", + "w", + "f", + "v", + "z", + "x", + "q", + ], + "Turkish": [ + "a", + "e", + "i", + "n", + "r", + "l", + "ı", + "k", + "d", + "t", + "s", + "m", + "y", + "u", + "o", + "b", + "ü", + "ş", + "v", + "g", + "z", + "h", + "c", + "p", + "ç", + "ğ", + ], + "Romanian": [ + "e", + "i", + "a", + "r", + "n", + "t", + "u", + "l", + "o", + "c", + "s", + "d", + "p", + "m", + "ă", + "f", + "v", + "î", + "g", + "b", + "ș", + "ț", + "z", + "h", + "â", + "j", + ], + "Farsi": [ + "ا", + "ی", + "ر", + "د", + "ن", + "ه", + "و", + "م", + "ت", + "ب", + "س", + "ل", + "ک", + "ش", + "ز", + "ف", + "گ", + "ع", + "خ", + "ق", + "ج", + "آ", + "پ", + "ح", + "ط", + "ص", + ], + "Arabic": [ + "ا", + "ل", + "ي", + "م", + "و", + "ن", + "ر", + "ت", + "ب", + "ة", + "ع", + "د", + "س", + "ف", + "ه", + "ك", + "ق", + "أ", + "ح", + "ج", + "ش", + "ط", + "ص", + "ى", + "خ", + "إ", + ], + "Danish": [ + "e", + "r", + "n", + "t", + "a", + "i", + "s", + "d", + "l", + "o", + "g", + "m", + "k", + "f", + "v", + "u", + "b", + "h", + "p", + "å", + "y", + "ø", + "æ", + "c", + "j", + "w", + ], + "Serbian": [ + "а", + "и", + "о", + "е", + "н", + "р", + "с", + "у", + "т", + "к", + "ј", + "в", + "д", + "м", + "п", + "л", + "г", + "з", + "б", + "a", + "i", + "e", + "o", + "n", + "ц", + "ш", + ], + "Lithuanian": [ + "i", + "a", + "s", + "o", + "r", + "e", + "t", + "n", + "u", + "k", + "m", + "l", + "p", + "v", + "d", + "j", + "g", + "ė", + "b", + "y", + "ų", + "š", + "ž", + "c", + "ą", + "į", + ], + "Slovene": [ + "e", + "a", + "i", + "o", + "n", + "r", + "s", + "l", + "t", + "j", + "v", + "k", + "d", + "p", + "m", + "u", + "z", + "b", + "g", + "h", + "č", + "c", + "š", + "ž", + "f", + "y", + ], + "Slovak": [ + "o", + "a", + "e", + "n", + "i", + "r", + "v", + "t", + "s", + "l", + "k", + "d", + "m", + "p", + "u", + "c", + "h", + "j", + "b", + "z", + "á", + "y", + "ý", + "í", + "č", + "é", + ], + "Hebrew": [ + "י", + "ו", + "ה", + "ל", + "ר", + "ב", + "ת", + "מ", + "א", + "ש", + "נ", + "ע", + "ם", + "ד", + "ק", + "ח", + "פ", + "ס", + "כ", + "ג", + "ט", + "צ", + "ן", + "ז", + "ך", + ], + "Bulgarian": [ + "а", + "и", + "о", + "е", + "н", + "т", + "р", + "с", + "в", + "л", + "к", + "д", + "п", + "м", + "з", + "г", + "я", + "ъ", + "у", + "б", + "ч", + "ц", + "й", + "ж", + "щ", + "х", + ], + "Croatian": [ + "a", + "i", + "o", + "e", + "n", + "r", + "j", + "s", + "t", + "u", + "k", + "l", + "v", + "d", + "m", + "p", + "g", + "z", + "b", + "c", + "č", + "h", + "š", + "ž", + "ć", + "f", + ], + "Hindi": [ + "क", + "र", + "स", + "न", + "त", + "म", + "ह", + "प", + "य", + "ल", + "व", + "ज", + "द", + "ग", + "ब", + "श", + "ट", + "अ", + "ए", + "थ", + "भ", + "ड", + "च", + "ध", + "ष", + "इ", + ], + "Estonian": [ + "a", + "i", + "e", + "s", + "t", + "l", + "u", + "n", + "o", + "k", + "r", + "d", + "m", + "v", + "g", + "p", + "j", + "h", + "ä", + "b", + "õ", + "ü", + "f", + "c", + "ö", + "y", + ], + "Thai": [ + "า", + "น", + "ร", + "อ", + "ก", + "เ", + "ง", + "ม", + "ย", + "ล", + "ว", + "ด", + "ท", + "ส", + "ต", + "ะ", + "ป", + "บ", + "ค", + "ห", + "แ", + "จ", + "พ", + "ช", + "ข", + "ใ", + ], + "Greek": [ + "α", + "τ", + "ο", + "ι", + "ε", + "ν", + "ρ", + "σ", + "κ", + "η", + "π", + "ς", + "υ", + "μ", + "λ", + "ί", + "ό", + "ά", + "γ", + "έ", + "δ", + "ή", + "ω", + "χ", + "θ", + "ύ", + ], + "Tamil": [ + "க", + "த", + "ப", + "ட", + "ர", + "ம", + "ல", + "ன", + "வ", + "ற", + "ய", + "ள", + "ச", + "ந", + "இ", + "ண", + "அ", + "ஆ", + "ழ", + "ங", + "எ", + "உ", + "ஒ", + "ஸ", + ], + "Kazakh": [ + "а", + "ы", + "е", + "н", + "т", + "р", + "л", + "і", + "д", + "с", + "м", + "қ", + "к", + "о", + "б", + "и", + "у", + "ғ", + "ж", + "ң", + "з", + "ш", + "й", + "п", + "г", + "ө", + ], +} diff --git a/requests/python/charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc b/requests/python/charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d01ef7d Binary files /dev/null and b/requests/python/charset_normalizer/assets/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/cd.py b/requests/python/charset_normalizer/cd.py new file mode 100644 index 0000000..6e56fe8 --- /dev/null +++ b/requests/python/charset_normalizer/cd.py @@ -0,0 +1,390 @@ +import importlib +from codecs import IncrementalDecoder +from collections import Counter +from functools import lru_cache +from typing import Counter as TypeCounter, Dict, List, Optional, Tuple + +from .assets import FREQUENCIES +from .constant import KO_NAMES, LANGUAGE_SUPPORTED_COUNT, TOO_SMALL_SEQUENCE, ZH_NAMES +from .md import is_suspiciously_successive_range +from .models import CoherenceMatches +from .utils import ( + is_accentuated, + is_latin, + is_multi_byte_encoding, + is_unicode_range_secondary, + unicode_range, +) + + +def encoding_unicode_range(iana_name: str) -> List[str]: + """ + Return associated unicode ranges in a single byte code page. + """ + if is_multi_byte_encoding(iana_name): + raise IOError("Function not supported on multi-byte code page") + + decoder = importlib.import_module( + "encodings.{}".format(iana_name) + ).IncrementalDecoder + + p: IncrementalDecoder = decoder(errors="ignore") + seen_ranges: Dict[str, int] = {} + character_count: int = 0 + + for i in range(0x40, 0xFF): + chunk: str = p.decode(bytes([i])) + + if chunk: + character_range: Optional[str] = unicode_range(chunk) + + if character_range is None: + continue + + if is_unicode_range_secondary(character_range) is False: + if character_range not in seen_ranges: + seen_ranges[character_range] = 0 + seen_ranges[character_range] += 1 + character_count += 1 + + return sorted( + [ + character_range + for character_range in seen_ranges + if seen_ranges[character_range] / character_count >= 0.15 + ] + ) + + +def unicode_range_languages(primary_range: str) -> List[str]: + """ + Return inferred languages used with a unicode range. + """ + languages: List[str] = [] + + for language, characters in FREQUENCIES.items(): + for character in characters: + if unicode_range(character) == primary_range: + languages.append(language) + break + + return languages + + +@lru_cache() +def encoding_languages(iana_name: str) -> List[str]: + """ + Single-byte encoding language association. Some code page are heavily linked to particular language(s). + This function does the correspondence. + """ + unicode_ranges: List[str] = encoding_unicode_range(iana_name) + primary_range: Optional[str] = None + + for specified_range in unicode_ranges: + if "Latin" not in specified_range: + primary_range = specified_range + break + + if primary_range is None: + return ["Latin Based"] + + return unicode_range_languages(primary_range) + + +@lru_cache() +def mb_encoding_languages(iana_name: str) -> List[str]: + """ + Multi-byte encoding language association. Some code page are heavily linked to particular language(s). + This function does the correspondence. + """ + if ( + iana_name.startswith("shift_") + or iana_name.startswith("iso2022_jp") + or iana_name.startswith("euc_j") + or iana_name == "cp932" + ): + return ["Japanese"] + if iana_name.startswith("gb") or iana_name in ZH_NAMES: + return ["Chinese"] + if iana_name.startswith("iso2022_kr") or iana_name in KO_NAMES: + return ["Korean"] + + return [] + + +@lru_cache(maxsize=LANGUAGE_SUPPORTED_COUNT) +def get_target_features(language: str) -> Tuple[bool, bool]: + """ + Determine main aspects from a supported language if it contains accents and if is pure Latin. + """ + target_have_accents: bool = False + target_pure_latin: bool = True + + for character in FREQUENCIES[language]: + if not target_have_accents and is_accentuated(character): + target_have_accents = True + if target_pure_latin and is_latin(character) is False: + target_pure_latin = False + + return target_have_accents, target_pure_latin + + +def alphabet_languages( + characters: List[str], ignore_non_latin: bool = False +) -> List[str]: + """ + Return associated languages associated to given characters. + """ + languages: List[Tuple[str, float]] = [] + + source_have_accents = any(is_accentuated(character) for character in characters) + + for language, language_characters in FREQUENCIES.items(): + target_have_accents, target_pure_latin = get_target_features(language) + + if ignore_non_latin and target_pure_latin is False: + continue + + if target_have_accents is False and source_have_accents: + continue + + character_count: int = len(language_characters) + + character_match_count: int = len( + [c for c in language_characters if c in characters] + ) + + ratio: float = character_match_count / character_count + + if ratio >= 0.2: + languages.append((language, ratio)) + + languages = sorted(languages, key=lambda x: x[1], reverse=True) + + return [compatible_language[0] for compatible_language in languages] + + +def characters_popularity_compare( + language: str, ordered_characters: List[str] +) -> float: + """ + Determine if a ordered characters list (by occurrence from most appearance to rarest) match a particular language. + The result is a ratio between 0. (absolutely no correspondence) and 1. (near perfect fit). + Beware that is function is not strict on the match in order to ease the detection. (Meaning close match is 1.) + """ + if language not in FREQUENCIES: + raise ValueError("{} not available".format(language)) + + character_approved_count: int = 0 + FREQUENCIES_language_set = set(FREQUENCIES[language]) + + ordered_characters_count: int = len(ordered_characters) + target_language_characters_count: int = len(FREQUENCIES[language]) + + large_alphabet: bool = target_language_characters_count > 26 + + for character, character_rank in zip( + ordered_characters, range(0, ordered_characters_count) + ): + if character not in FREQUENCIES_language_set: + continue + + character_rank_in_language: int = FREQUENCIES[language].index(character) + expected_projection_ratio: float = ( + target_language_characters_count / ordered_characters_count + ) + character_rank_projection: int = int(character_rank * expected_projection_ratio) + + if ( + large_alphabet is False + and abs(character_rank_projection - character_rank_in_language) > 4 + ): + continue + + if ( + large_alphabet is True + and abs(character_rank_projection - character_rank_in_language) + < target_language_characters_count / 3 + ): + character_approved_count += 1 + continue + + characters_before_source: List[str] = FREQUENCIES[language][ + 0:character_rank_in_language + ] + characters_after_source: List[str] = FREQUENCIES[language][ + character_rank_in_language: + ] + characters_before: List[str] = ordered_characters[0:character_rank] + characters_after: List[str] = ordered_characters[character_rank:] + + before_match_count: int = len( + set(characters_before) & set(characters_before_source) + ) + + after_match_count: int = len( + set(characters_after) & set(characters_after_source) + ) + + if len(characters_before_source) == 0 and before_match_count <= 4: + character_approved_count += 1 + continue + + if len(characters_after_source) == 0 and after_match_count <= 4: + character_approved_count += 1 + continue + + if ( + before_match_count / len(characters_before_source) >= 0.4 + or after_match_count / len(characters_after_source) >= 0.4 + ): + character_approved_count += 1 + continue + + return character_approved_count / len(ordered_characters) + + +def alpha_unicode_split(decoded_sequence: str) -> List[str]: + """ + Given a decoded text sequence, return a list of str. Unicode range / alphabet separation. + Ex. a text containing English/Latin with a bit a Hebrew will return two items in the resulting list; + One containing the latin letters and the other hebrew. + """ + layers: Dict[str, str] = {} + + for character in decoded_sequence: + if character.isalpha() is False: + continue + + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + continue + + layer_target_range: Optional[str] = None + + for discovered_range in layers: + if ( + is_suspiciously_successive_range(discovered_range, character_range) + is False + ): + layer_target_range = discovered_range + break + + if layer_target_range is None: + layer_target_range = character_range + + if layer_target_range not in layers: + layers[layer_target_range] = character.lower() + continue + + layers[layer_target_range] += character.lower() + + return list(layers.values()) + + +def merge_coherence_ratios(results: List[CoherenceMatches]) -> CoherenceMatches: + """ + This function merge results previously given by the function coherence_ratio. + The return type is the same as coherence_ratio. + """ + per_language_ratios: Dict[str, List[float]] = {} + for result in results: + for sub_result in result: + language, ratio = sub_result + if language not in per_language_ratios: + per_language_ratios[language] = [ratio] + continue + per_language_ratios[language].append(ratio) + + merge = [ + ( + language, + round( + sum(per_language_ratios[language]) / len(per_language_ratios[language]), + 4, + ), + ) + for language in per_language_ratios + ] + + return sorted(merge, key=lambda x: x[1], reverse=True) + + +def filter_alt_coherence_matches(results: CoherenceMatches) -> CoherenceMatches: + """ + We shall NOT return "English—" in CoherenceMatches because it is an alternative + of "English". This function only keeps the best match and remove the em-dash in it. + """ + index_results: Dict[str, List[float]] = dict() + + for result in results: + language, ratio = result + no_em_name: str = language.replace("—", "") + + if no_em_name not in index_results: + index_results[no_em_name] = [] + + index_results[no_em_name].append(ratio) + + if any(len(index_results[e]) > 1 for e in index_results): + filtered_results: CoherenceMatches = [] + + for language in index_results: + filtered_results.append((language, max(index_results[language]))) + + return filtered_results + + return results + + +@lru_cache(maxsize=2048) +def coherence_ratio( + decoded_sequence: str, threshold: float = 0.1, lg_inclusion: Optional[str] = None +) -> CoherenceMatches: + """ + Detect ANY language that can be identified in given sequence. The sequence will be analysed by layers. + A layer = Character extraction by alphabets/ranges. + """ + + results: List[Tuple[str, float]] = [] + ignore_non_latin: bool = False + + sufficient_match_count: int = 0 + + lg_inclusion_list = lg_inclusion.split(",") if lg_inclusion is not None else [] + if "Latin Based" in lg_inclusion_list: + ignore_non_latin = True + lg_inclusion_list.remove("Latin Based") + + for layer in alpha_unicode_split(decoded_sequence): + sequence_frequencies: TypeCounter[str] = Counter(layer) + most_common = sequence_frequencies.most_common() + + character_count: int = sum(o for c, o in most_common) + + if character_count <= TOO_SMALL_SEQUENCE: + continue + + popular_character_ordered: List[str] = [c for c, o in most_common] + + for language in lg_inclusion_list or alphabet_languages( + popular_character_ordered, ignore_non_latin + ): + ratio: float = characters_popularity_compare( + language, popular_character_ordered + ) + + if ratio < threshold: + continue + elif ratio >= 0.8: + sufficient_match_count += 1 + + results.append((language, round(ratio, 4))) + + if sufficient_match_count >= 3: + break + + return sorted( + filter_alt_coherence_matches(results), key=lambda x: x[1], reverse=True + ) diff --git a/requests/python/charset_normalizer/cli/__init__.py b/requests/python/charset_normalizer/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requests/python/charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc b/requests/python/charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..c9486e8 Binary files /dev/null and b/requests/python/charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc b/requests/python/charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc new file mode 100644 index 0000000..997f5ae Binary files /dev/null and b/requests/python/charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc differ diff --git a/requests/python/charset_normalizer/cli/normalizer.py b/requests/python/charset_normalizer/cli/normalizer.py new file mode 100644 index 0000000..f4bcbaa --- /dev/null +++ b/requests/python/charset_normalizer/cli/normalizer.py @@ -0,0 +1,296 @@ +import argparse +import sys +from json import dumps +from os.path import abspath, basename, dirname, join, realpath +from platform import python_version +from typing import List, Optional +from unicodedata import unidata_version + +import charset_normalizer.md as md_module +from charset_normalizer import from_fp +from charset_normalizer.models import CliDetectionResult +from charset_normalizer.version import __version__ + + +def query_yes_no(question: str, default: str = "yes") -> bool: + """Ask a yes/no question via input() and return their answer. + + "question" is a string that is presented to the user. + "default" is the presumed answer if the user just hits . + It must be "yes" (the default), "no" or None (meaning + an answer is required of the user). + + The "answer" return value is True for "yes" or False for "no". + + Credit goes to (c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input + """ + valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False} + if default is None: + prompt = " [y/n] " + elif default == "yes": + prompt = " [Y/n] " + elif default == "no": + prompt = " [y/N] " + else: + raise ValueError("invalid default answer: '%s'" % default) + + while True: + sys.stdout.write(question + prompt) + choice = input().lower() + if default is not None and choice == "": + return valid[default] + elif choice in valid: + return valid[choice] + else: + sys.stdout.write("Please respond with 'yes' or 'no' " "(or 'y' or 'n').\n") + + +def cli_detect(argv: Optional[List[str]] = None) -> int: + """ + CLI assistant using ARGV and ArgumentParser + :param argv: + :return: 0 if everything is fine, anything else equal trouble + """ + parser = argparse.ArgumentParser( + description="The Real First Universal Charset Detector. " + "Discover originating encoding used on text file. " + "Normalize text to unicode." + ) + + parser.add_argument( + "files", type=argparse.FileType("rb"), nargs="+", help="File(s) to be analysed" + ) + parser.add_argument( + "-v", + "--verbose", + action="store_true", + default=False, + dest="verbose", + help="Display complementary information about file if any. " + "Stdout will contain logs about the detection process.", + ) + parser.add_argument( + "-a", + "--with-alternative", + action="store_true", + default=False, + dest="alternatives", + help="Output complementary possibilities if any. Top-level JSON WILL be a list.", + ) + parser.add_argument( + "-n", + "--normalize", + action="store_true", + default=False, + dest="normalize", + help="Permit to normalize input file. If not set, program does not write anything.", + ) + parser.add_argument( + "-m", + "--minimal", + action="store_true", + default=False, + dest="minimal", + help="Only output the charset detected to STDOUT. Disabling JSON output.", + ) + parser.add_argument( + "-r", + "--replace", + action="store_true", + default=False, + dest="replace", + help="Replace file when trying to normalize it instead of creating a new one.", + ) + parser.add_argument( + "-f", + "--force", + action="store_true", + default=False, + dest="force", + help="Replace file without asking if you are sure, use this flag with caution.", + ) + parser.add_argument( + "-t", + "--threshold", + action="store", + default=0.2, + type=float, + dest="threshold", + help="Define a custom maximum amount of chaos allowed in decoded content. 0. <= chaos <= 1.", + ) + parser.add_argument( + "--version", + action="version", + version="Charset-Normalizer {} - Python {} - Unicode {} - SpeedUp {}".format( + __version__, + python_version(), + unidata_version, + "OFF" if md_module.__file__.lower().endswith(".py") else "ON", + ), + help="Show version information and exit.", + ) + + args = parser.parse_args(argv) + + if args.replace is True and args.normalize is False: + print("Use --replace in addition of --normalize only.", file=sys.stderr) + return 1 + + if args.force is True and args.replace is False: + print("Use --force in addition of --replace only.", file=sys.stderr) + return 1 + + if args.threshold < 0.0 or args.threshold > 1.0: + print("--threshold VALUE should be between 0. AND 1.", file=sys.stderr) + return 1 + + x_ = [] + + for my_file in args.files: + matches = from_fp(my_file, threshold=args.threshold, explain=args.verbose) + + best_guess = matches.best() + + if best_guess is None: + print( + 'Unable to identify originating encoding for "{}". {}'.format( + my_file.name, + "Maybe try increasing maximum amount of chaos." + if args.threshold < 1.0 + else "", + ), + file=sys.stderr, + ) + x_.append( + CliDetectionResult( + abspath(my_file.name), + None, + [], + [], + "Unknown", + [], + False, + 1.0, + 0.0, + None, + True, + ) + ) + else: + x_.append( + CliDetectionResult( + abspath(my_file.name), + best_guess.encoding, + best_guess.encoding_aliases, + [ + cp + for cp in best_guess.could_be_from_charset + if cp != best_guess.encoding + ], + best_guess.language, + best_guess.alphabets, + best_guess.bom, + best_guess.percent_chaos, + best_guess.percent_coherence, + None, + True, + ) + ) + + if len(matches) > 1 and args.alternatives: + for el in matches: + if el != best_guess: + x_.append( + CliDetectionResult( + abspath(my_file.name), + el.encoding, + el.encoding_aliases, + [ + cp + for cp in el.could_be_from_charset + if cp != el.encoding + ], + el.language, + el.alphabets, + el.bom, + el.percent_chaos, + el.percent_coherence, + None, + False, + ) + ) + + if args.normalize is True: + if best_guess.encoding.startswith("utf") is True: + print( + '"{}" file does not need to be normalized, as it already came from unicode.'.format( + my_file.name + ), + file=sys.stderr, + ) + if my_file.closed is False: + my_file.close() + continue + + dir_path = dirname(realpath(my_file.name)) + file_name = basename(realpath(my_file.name)) + + o_: List[str] = file_name.split(".") + + if args.replace is False: + o_.insert(-1, best_guess.encoding) + if my_file.closed is False: + my_file.close() + elif ( + args.force is False + and query_yes_no( + 'Are you sure to normalize "{}" by replacing it ?'.format( + my_file.name + ), + "no", + ) + is False + ): + if my_file.closed is False: + my_file.close() + continue + + try: + x_[0].unicode_path = join(dir_path, ".".join(o_)) + + with open(x_[0].unicode_path, "w", encoding="utf-8") as fp: + fp.write(str(best_guess)) + except IOError as e: + print(str(e), file=sys.stderr) + if my_file.closed is False: + my_file.close() + return 2 + + if my_file.closed is False: + my_file.close() + + if args.minimal is False: + print( + dumps( + [el.__dict__ for el in x_] if len(x_) > 1 else x_[0].__dict__, + ensure_ascii=True, + indent=4, + ) + ) + else: + for my_file in args.files: + print( + ", ".join( + [ + el.encoding or "undefined" + for el in x_ + if el.path == abspath(my_file.name) + ] + ) + ) + + return 0 + + +if __name__ == "__main__": + cli_detect() diff --git a/requests/python/charset_normalizer/constant.py b/requests/python/charset_normalizer/constant.py new file mode 100644 index 0000000..3188108 --- /dev/null +++ b/requests/python/charset_normalizer/constant.py @@ -0,0 +1,495 @@ +from codecs import BOM_UTF8, BOM_UTF16_BE, BOM_UTF16_LE, BOM_UTF32_BE, BOM_UTF32_LE +from encodings.aliases import aliases +from re import IGNORECASE, compile as re_compile +from typing import Dict, List, Set, Union + +from .assets import FREQUENCIES + +# Contain for each eligible encoding a list of/item bytes SIG/BOM +ENCODING_MARKS: Dict[str, Union[bytes, List[bytes]]] = { + "utf_8": BOM_UTF8, + "utf_7": [ + b"\x2b\x2f\x76\x38", + b"\x2b\x2f\x76\x39", + b"\x2b\x2f\x76\x2b", + b"\x2b\x2f\x76\x2f", + b"\x2b\x2f\x76\x38\x2d", + ], + "gb18030": b"\x84\x31\x95\x33", + "utf_32": [BOM_UTF32_BE, BOM_UTF32_LE], + "utf_16": [BOM_UTF16_BE, BOM_UTF16_LE], +} + +TOO_SMALL_SEQUENCE: int = 32 +TOO_BIG_SEQUENCE: int = int(10e6) + +UTF8_MAXIMAL_ALLOCATION: int = 1112064 + +UNICODE_RANGES_COMBINED: Dict[str, range] = { + "Control character": range(31 + 1), + "Basic Latin": range(32, 127 + 1), + "Latin-1 Supplement": range(128, 255 + 1), + "Latin Extended-A": range(256, 383 + 1), + "Latin Extended-B": range(384, 591 + 1), + "IPA Extensions": range(592, 687 + 1), + "Spacing Modifier Letters": range(688, 767 + 1), + "Combining Diacritical Marks": range(768, 879 + 1), + "Greek and Coptic": range(880, 1023 + 1), + "Cyrillic": range(1024, 1279 + 1), + "Cyrillic Supplement": range(1280, 1327 + 1), + "Armenian": range(1328, 1423 + 1), + "Hebrew": range(1424, 1535 + 1), + "Arabic": range(1536, 1791 + 1), + "Syriac": range(1792, 1871 + 1), + "Arabic Supplement": range(1872, 1919 + 1), + "Thaana": range(1920, 1983 + 1), + "NKo": range(1984, 2047 + 1), + "Samaritan": range(2048, 2111 + 1), + "Mandaic": range(2112, 2143 + 1), + "Syriac Supplement": range(2144, 2159 + 1), + "Arabic Extended-A": range(2208, 2303 + 1), + "Devanagari": range(2304, 2431 + 1), + "Bengali": range(2432, 2559 + 1), + "Gurmukhi": range(2560, 2687 + 1), + "Gujarati": range(2688, 2815 + 1), + "Oriya": range(2816, 2943 + 1), + "Tamil": range(2944, 3071 + 1), + "Telugu": range(3072, 3199 + 1), + "Kannada": range(3200, 3327 + 1), + "Malayalam": range(3328, 3455 + 1), + "Sinhala": range(3456, 3583 + 1), + "Thai": range(3584, 3711 + 1), + "Lao": range(3712, 3839 + 1), + "Tibetan": range(3840, 4095 + 1), + "Myanmar": range(4096, 4255 + 1), + "Georgian": range(4256, 4351 + 1), + "Hangul Jamo": range(4352, 4607 + 1), + "Ethiopic": range(4608, 4991 + 1), + "Ethiopic Supplement": range(4992, 5023 + 1), + "Cherokee": range(5024, 5119 + 1), + "Unified Canadian Aboriginal Syllabics": range(5120, 5759 + 1), + "Ogham": range(5760, 5791 + 1), + "Runic": range(5792, 5887 + 1), + "Tagalog": range(5888, 5919 + 1), + "Hanunoo": range(5920, 5951 + 1), + "Buhid": range(5952, 5983 + 1), + "Tagbanwa": range(5984, 6015 + 1), + "Khmer": range(6016, 6143 + 1), + "Mongolian": range(6144, 6319 + 1), + "Unified Canadian Aboriginal Syllabics Extended": range(6320, 6399 + 1), + "Limbu": range(6400, 6479 + 1), + "Tai Le": range(6480, 6527 + 1), + "New Tai Lue": range(6528, 6623 + 1), + "Khmer Symbols": range(6624, 6655 + 1), + "Buginese": range(6656, 6687 + 1), + "Tai Tham": range(6688, 6831 + 1), + "Combining Diacritical Marks Extended": range(6832, 6911 + 1), + "Balinese": range(6912, 7039 + 1), + "Sundanese": range(7040, 7103 + 1), + "Batak": range(7104, 7167 + 1), + "Lepcha": range(7168, 7247 + 1), + "Ol Chiki": range(7248, 7295 + 1), + "Cyrillic Extended C": range(7296, 7311 + 1), + "Sundanese Supplement": range(7360, 7375 + 1), + "Vedic Extensions": range(7376, 7423 + 1), + "Phonetic Extensions": range(7424, 7551 + 1), + "Phonetic Extensions Supplement": range(7552, 7615 + 1), + "Combining Diacritical Marks Supplement": range(7616, 7679 + 1), + "Latin Extended Additional": range(7680, 7935 + 1), + "Greek Extended": range(7936, 8191 + 1), + "General Punctuation": range(8192, 8303 + 1), + "Superscripts and Subscripts": range(8304, 8351 + 1), + "Currency Symbols": range(8352, 8399 + 1), + "Combining Diacritical Marks for Symbols": range(8400, 8447 + 1), + "Letterlike Symbols": range(8448, 8527 + 1), + "Number Forms": range(8528, 8591 + 1), + "Arrows": range(8592, 8703 + 1), + "Mathematical Operators": range(8704, 8959 + 1), + "Miscellaneous Technical": range(8960, 9215 + 1), + "Control Pictures": range(9216, 9279 + 1), + "Optical Character Recognition": range(9280, 9311 + 1), + "Enclosed Alphanumerics": range(9312, 9471 + 1), + "Box Drawing": range(9472, 9599 + 1), + "Block Elements": range(9600, 9631 + 1), + "Geometric Shapes": range(9632, 9727 + 1), + "Miscellaneous Symbols": range(9728, 9983 + 1), + "Dingbats": range(9984, 10175 + 1), + "Miscellaneous Mathematical Symbols-A": range(10176, 10223 + 1), + "Supplemental Arrows-A": range(10224, 10239 + 1), + "Braille Patterns": range(10240, 10495 + 1), + "Supplemental Arrows-B": range(10496, 10623 + 1), + "Miscellaneous Mathematical Symbols-B": range(10624, 10751 + 1), + "Supplemental Mathematical Operators": range(10752, 11007 + 1), + "Miscellaneous Symbols and Arrows": range(11008, 11263 + 1), + "Glagolitic": range(11264, 11359 + 1), + "Latin Extended-C": range(11360, 11391 + 1), + "Coptic": range(11392, 11519 + 1), + "Georgian Supplement": range(11520, 11567 + 1), + "Tifinagh": range(11568, 11647 + 1), + "Ethiopic Extended": range(11648, 11743 + 1), + "Cyrillic Extended-A": range(11744, 11775 + 1), + "Supplemental Punctuation": range(11776, 11903 + 1), + "CJK Radicals Supplement": range(11904, 12031 + 1), + "Kangxi Radicals": range(12032, 12255 + 1), + "Ideographic Description Characters": range(12272, 12287 + 1), + "CJK Symbols and Punctuation": range(12288, 12351 + 1), + "Hiragana": range(12352, 12447 + 1), + "Katakana": range(12448, 12543 + 1), + "Bopomofo": range(12544, 12591 + 1), + "Hangul Compatibility Jamo": range(12592, 12687 + 1), + "Kanbun": range(12688, 12703 + 1), + "Bopomofo Extended": range(12704, 12735 + 1), + "CJK Strokes": range(12736, 12783 + 1), + "Katakana Phonetic Extensions": range(12784, 12799 + 1), + "Enclosed CJK Letters and Months": range(12800, 13055 + 1), + "CJK Compatibility": range(13056, 13311 + 1), + "CJK Unified Ideographs Extension A": range(13312, 19903 + 1), + "Yijing Hexagram Symbols": range(19904, 19967 + 1), + "CJK Unified Ideographs": range(19968, 40959 + 1), + "Yi Syllables": range(40960, 42127 + 1), + "Yi Radicals": range(42128, 42191 + 1), + "Lisu": range(42192, 42239 + 1), + "Vai": range(42240, 42559 + 1), + "Cyrillic Extended-B": range(42560, 42655 + 1), + "Bamum": range(42656, 42751 + 1), + "Modifier Tone Letters": range(42752, 42783 + 1), + "Latin Extended-D": range(42784, 43007 + 1), + "Syloti Nagri": range(43008, 43055 + 1), + "Common Indic Number Forms": range(43056, 43071 + 1), + "Phags-pa": range(43072, 43135 + 1), + "Saurashtra": range(43136, 43231 + 1), + "Devanagari Extended": range(43232, 43263 + 1), + "Kayah Li": range(43264, 43311 + 1), + "Rejang": range(43312, 43359 + 1), + "Hangul Jamo Extended-A": range(43360, 43391 + 1), + "Javanese": range(43392, 43487 + 1), + "Myanmar Extended-B": range(43488, 43519 + 1), + "Cham": range(43520, 43615 + 1), + "Myanmar Extended-A": range(43616, 43647 + 1), + "Tai Viet": range(43648, 43743 + 1), + "Meetei Mayek Extensions": range(43744, 43775 + 1), + "Ethiopic Extended-A": range(43776, 43823 + 1), + "Latin Extended-E": range(43824, 43887 + 1), + "Cherokee Supplement": range(43888, 43967 + 1), + "Meetei Mayek": range(43968, 44031 + 1), + "Hangul Syllables": range(44032, 55215 + 1), + "Hangul Jamo Extended-B": range(55216, 55295 + 1), + "High Surrogates": range(55296, 56191 + 1), + "High Private Use Surrogates": range(56192, 56319 + 1), + "Low Surrogates": range(56320, 57343 + 1), + "Private Use Area": range(57344, 63743 + 1), + "CJK Compatibility Ideographs": range(63744, 64255 + 1), + "Alphabetic Presentation Forms": range(64256, 64335 + 1), + "Arabic Presentation Forms-A": range(64336, 65023 + 1), + "Variation Selectors": range(65024, 65039 + 1), + "Vertical Forms": range(65040, 65055 + 1), + "Combining Half Marks": range(65056, 65071 + 1), + "CJK Compatibility Forms": range(65072, 65103 + 1), + "Small Form Variants": range(65104, 65135 + 1), + "Arabic Presentation Forms-B": range(65136, 65279 + 1), + "Halfwidth and Fullwidth Forms": range(65280, 65519 + 1), + "Specials": range(65520, 65535 + 1), + "Linear B Syllabary": range(65536, 65663 + 1), + "Linear B Ideograms": range(65664, 65791 + 1), + "Aegean Numbers": range(65792, 65855 + 1), + "Ancient Greek Numbers": range(65856, 65935 + 1), + "Ancient Symbols": range(65936, 65999 + 1), + "Phaistos Disc": range(66000, 66047 + 1), + "Lycian": range(66176, 66207 + 1), + "Carian": range(66208, 66271 + 1), + "Coptic Epact Numbers": range(66272, 66303 + 1), + "Old Italic": range(66304, 66351 + 1), + "Gothic": range(66352, 66383 + 1), + "Old Permic": range(66384, 66431 + 1), + "Ugaritic": range(66432, 66463 + 1), + "Old Persian": range(66464, 66527 + 1), + "Deseret": range(66560, 66639 + 1), + "Shavian": range(66640, 66687 + 1), + "Osmanya": range(66688, 66735 + 1), + "Osage": range(66736, 66815 + 1), + "Elbasan": range(66816, 66863 + 1), + "Caucasian Albanian": range(66864, 66927 + 1), + "Linear A": range(67072, 67455 + 1), + "Cypriot Syllabary": range(67584, 67647 + 1), + "Imperial Aramaic": range(67648, 67679 + 1), + "Palmyrene": range(67680, 67711 + 1), + "Nabataean": range(67712, 67759 + 1), + "Hatran": range(67808, 67839 + 1), + "Phoenician": range(67840, 67871 + 1), + "Lydian": range(67872, 67903 + 1), + "Meroitic Hieroglyphs": range(67968, 67999 + 1), + "Meroitic Cursive": range(68000, 68095 + 1), + "Kharoshthi": range(68096, 68191 + 1), + "Old South Arabian": range(68192, 68223 + 1), + "Old North Arabian": range(68224, 68255 + 1), + "Manichaean": range(68288, 68351 + 1), + "Avestan": range(68352, 68415 + 1), + "Inscriptional Parthian": range(68416, 68447 + 1), + "Inscriptional Pahlavi": range(68448, 68479 + 1), + "Psalter Pahlavi": range(68480, 68527 + 1), + "Old Turkic": range(68608, 68687 + 1), + "Old Hungarian": range(68736, 68863 + 1), + "Rumi Numeral Symbols": range(69216, 69247 + 1), + "Brahmi": range(69632, 69759 + 1), + "Kaithi": range(69760, 69839 + 1), + "Sora Sompeng": range(69840, 69887 + 1), + "Chakma": range(69888, 69967 + 1), + "Mahajani": range(69968, 70015 + 1), + "Sharada": range(70016, 70111 + 1), + "Sinhala Archaic Numbers": range(70112, 70143 + 1), + "Khojki": range(70144, 70223 + 1), + "Multani": range(70272, 70319 + 1), + "Khudawadi": range(70320, 70399 + 1), + "Grantha": range(70400, 70527 + 1), + "Newa": range(70656, 70783 + 1), + "Tirhuta": range(70784, 70879 + 1), + "Siddham": range(71040, 71167 + 1), + "Modi": range(71168, 71263 + 1), + "Mongolian Supplement": range(71264, 71295 + 1), + "Takri": range(71296, 71375 + 1), + "Ahom": range(71424, 71487 + 1), + "Warang Citi": range(71840, 71935 + 1), + "Zanabazar Square": range(72192, 72271 + 1), + "Soyombo": range(72272, 72367 + 1), + "Pau Cin Hau": range(72384, 72447 + 1), + "Bhaiksuki": range(72704, 72815 + 1), + "Marchen": range(72816, 72895 + 1), + "Masaram Gondi": range(72960, 73055 + 1), + "Cuneiform": range(73728, 74751 + 1), + "Cuneiform Numbers and Punctuation": range(74752, 74879 + 1), + "Early Dynastic Cuneiform": range(74880, 75087 + 1), + "Egyptian Hieroglyphs": range(77824, 78895 + 1), + "Anatolian Hieroglyphs": range(82944, 83583 + 1), + "Bamum Supplement": range(92160, 92735 + 1), + "Mro": range(92736, 92783 + 1), + "Bassa Vah": range(92880, 92927 + 1), + "Pahawh Hmong": range(92928, 93071 + 1), + "Miao": range(93952, 94111 + 1), + "Ideographic Symbols and Punctuation": range(94176, 94207 + 1), + "Tangut": range(94208, 100351 + 1), + "Tangut Components": range(100352, 101119 + 1), + "Kana Supplement": range(110592, 110847 + 1), + "Kana Extended-A": range(110848, 110895 + 1), + "Nushu": range(110960, 111359 + 1), + "Duployan": range(113664, 113823 + 1), + "Shorthand Format Controls": range(113824, 113839 + 1), + "Byzantine Musical Symbols": range(118784, 119039 + 1), + "Musical Symbols": range(119040, 119295 + 1), + "Ancient Greek Musical Notation": range(119296, 119375 + 1), + "Tai Xuan Jing Symbols": range(119552, 119647 + 1), + "Counting Rod Numerals": range(119648, 119679 + 1), + "Mathematical Alphanumeric Symbols": range(119808, 120831 + 1), + "Sutton SignWriting": range(120832, 121519 + 1), + "Glagolitic Supplement": range(122880, 122927 + 1), + "Mende Kikakui": range(124928, 125151 + 1), + "Adlam": range(125184, 125279 + 1), + "Arabic Mathematical Alphabetic Symbols": range(126464, 126719 + 1), + "Mahjong Tiles": range(126976, 127023 + 1), + "Domino Tiles": range(127024, 127135 + 1), + "Playing Cards": range(127136, 127231 + 1), + "Enclosed Alphanumeric Supplement": range(127232, 127487 + 1), + "Enclosed Ideographic Supplement": range(127488, 127743 + 1), + "Miscellaneous Symbols and Pictographs": range(127744, 128511 + 1), + "Emoticons range(Emoji)": range(128512, 128591 + 1), + "Ornamental Dingbats": range(128592, 128639 + 1), + "Transport and Map Symbols": range(128640, 128767 + 1), + "Alchemical Symbols": range(128768, 128895 + 1), + "Geometric Shapes Extended": range(128896, 129023 + 1), + "Supplemental Arrows-C": range(129024, 129279 + 1), + "Supplemental Symbols and Pictographs": range(129280, 129535 + 1), + "CJK Unified Ideographs Extension B": range(131072, 173791 + 1), + "CJK Unified Ideographs Extension C": range(173824, 177983 + 1), + "CJK Unified Ideographs Extension D": range(177984, 178207 + 1), + "CJK Unified Ideographs Extension E": range(178208, 183983 + 1), + "CJK Unified Ideographs Extension F": range(183984, 191471 + 1), + "CJK Compatibility Ideographs Supplement": range(194560, 195103 + 1), + "Tags": range(917504, 917631 + 1), + "Variation Selectors Supplement": range(917760, 917999 + 1), +} + + +UNICODE_SECONDARY_RANGE_KEYWORD: List[str] = [ + "Supplement", + "Extended", + "Extensions", + "Modifier", + "Marks", + "Punctuation", + "Symbols", + "Forms", + "Operators", + "Miscellaneous", + "Drawing", + "Block", + "Shapes", + "Supplemental", + "Tags", +] + +RE_POSSIBLE_ENCODING_INDICATION = re_compile( + r"(?:(?:encoding)|(?:charset)|(?:coding))(?:[\:= ]{1,10})(?:[\"\']?)([a-zA-Z0-9\-_]+)(?:[\"\']?)", + IGNORECASE, +) + +IANA_SUPPORTED: List[str] = sorted( + filter( + lambda x: x.endswith("_codec") is False + and x not in {"rot_13", "tactis", "mbcs"}, + list(set(aliases.values())), + ) +) + +IANA_SUPPORTED_COUNT: int = len(IANA_SUPPORTED) + +# pre-computed code page that are similar using the function cp_similarity. +IANA_SUPPORTED_SIMILAR: Dict[str, List[str]] = { + "cp037": ["cp1026", "cp1140", "cp273", "cp500"], + "cp1026": ["cp037", "cp1140", "cp273", "cp500"], + "cp1125": ["cp866"], + "cp1140": ["cp037", "cp1026", "cp273", "cp500"], + "cp1250": ["iso8859_2"], + "cp1251": ["kz1048", "ptcp154"], + "cp1252": ["iso8859_15", "iso8859_9", "latin_1"], + "cp1253": ["iso8859_7"], + "cp1254": ["iso8859_15", "iso8859_9", "latin_1"], + "cp1257": ["iso8859_13"], + "cp273": ["cp037", "cp1026", "cp1140", "cp500"], + "cp437": ["cp850", "cp858", "cp860", "cp861", "cp862", "cp863", "cp865"], + "cp500": ["cp037", "cp1026", "cp1140", "cp273"], + "cp850": ["cp437", "cp857", "cp858", "cp865"], + "cp857": ["cp850", "cp858", "cp865"], + "cp858": ["cp437", "cp850", "cp857", "cp865"], + "cp860": ["cp437", "cp861", "cp862", "cp863", "cp865"], + "cp861": ["cp437", "cp860", "cp862", "cp863", "cp865"], + "cp862": ["cp437", "cp860", "cp861", "cp863", "cp865"], + "cp863": ["cp437", "cp860", "cp861", "cp862", "cp865"], + "cp865": ["cp437", "cp850", "cp857", "cp858", "cp860", "cp861", "cp862", "cp863"], + "cp866": ["cp1125"], + "iso8859_10": ["iso8859_14", "iso8859_15", "iso8859_4", "iso8859_9", "latin_1"], + "iso8859_11": ["tis_620"], + "iso8859_13": ["cp1257"], + "iso8859_14": [ + "iso8859_10", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_9", + "latin_1", + ], + "iso8859_15": [ + "cp1252", + "cp1254", + "iso8859_10", + "iso8859_14", + "iso8859_16", + "iso8859_3", + "iso8859_9", + "latin_1", + ], + "iso8859_16": [ + "iso8859_14", + "iso8859_15", + "iso8859_2", + "iso8859_3", + "iso8859_9", + "latin_1", + ], + "iso8859_2": ["cp1250", "iso8859_16", "iso8859_4"], + "iso8859_3": ["iso8859_14", "iso8859_15", "iso8859_16", "iso8859_9", "latin_1"], + "iso8859_4": ["iso8859_10", "iso8859_2", "iso8859_9", "latin_1"], + "iso8859_7": ["cp1253"], + "iso8859_9": [ + "cp1252", + "cp1254", + "cp1258", + "iso8859_10", + "iso8859_14", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_4", + "latin_1", + ], + "kz1048": ["cp1251", "ptcp154"], + "latin_1": [ + "cp1252", + "cp1254", + "cp1258", + "iso8859_10", + "iso8859_14", + "iso8859_15", + "iso8859_16", + "iso8859_3", + "iso8859_4", + "iso8859_9", + ], + "mac_iceland": ["mac_roman", "mac_turkish"], + "mac_roman": ["mac_iceland", "mac_turkish"], + "mac_turkish": ["mac_iceland", "mac_roman"], + "ptcp154": ["cp1251", "kz1048"], + "tis_620": ["iso8859_11"], +} + + +CHARDET_CORRESPONDENCE: Dict[str, str] = { + "iso2022_kr": "ISO-2022-KR", + "iso2022_jp": "ISO-2022-JP", + "euc_kr": "EUC-KR", + "tis_620": "TIS-620", + "utf_32": "UTF-32", + "euc_jp": "EUC-JP", + "koi8_r": "KOI8-R", + "iso8859_1": "ISO-8859-1", + "iso8859_2": "ISO-8859-2", + "iso8859_5": "ISO-8859-5", + "iso8859_6": "ISO-8859-6", + "iso8859_7": "ISO-8859-7", + "iso8859_8": "ISO-8859-8", + "utf_16": "UTF-16", + "cp855": "IBM855", + "mac_cyrillic": "MacCyrillic", + "gb2312": "GB2312", + "gb18030": "GB18030", + "cp932": "CP932", + "cp866": "IBM866", + "utf_8": "utf-8", + "utf_8_sig": "UTF-8-SIG", + "shift_jis": "SHIFT_JIS", + "big5": "Big5", + "cp1250": "windows-1250", + "cp1251": "windows-1251", + "cp1252": "Windows-1252", + "cp1253": "windows-1253", + "cp1255": "windows-1255", + "cp1256": "windows-1256", + "cp1254": "Windows-1254", + "cp949": "CP949", +} + + +COMMON_SAFE_ASCII_CHARACTERS: Set[str] = { + "<", + ">", + "=", + ":", + "/", + "&", + ";", + "{", + "}", + "[", + "]", + ",", + "|", + '"', + "-", +} + + +KO_NAMES: Set[str] = {"johab", "cp949", "euc_kr"} +ZH_NAMES: Set[str] = {"big5", "cp950", "big5hkscs", "hz"} + +LANGUAGE_SUPPORTED_COUNT: int = len(FREQUENCIES) + +# Logging LEVEL below DEBUG +TRACE: int = 5 diff --git a/requests/python/charset_normalizer/legacy.py b/requests/python/charset_normalizer/legacy.py new file mode 100644 index 0000000..43aad21 --- /dev/null +++ b/requests/python/charset_normalizer/legacy.py @@ -0,0 +1,54 @@ +from typing import Any, Dict, Optional, Union +from warnings import warn + +from .api import from_bytes +from .constant import CHARDET_CORRESPONDENCE + + +def detect( + byte_str: bytes, should_rename_legacy: bool = False, **kwargs: Any +) -> Dict[str, Optional[Union[str, float]]]: + """ + chardet legacy method + Detect the encoding of the given byte string. It should be mostly backward-compatible. + Encoding name will match Chardet own writing whenever possible. (Not on encoding name unsupported by it) + This function is deprecated and should be used to migrate your project easily, consult the documentation for + further information. Not planned for removal. + + :param byte_str: The byte sequence to examine. + :param should_rename_legacy: Should we rename legacy encodings + to their more modern equivalents? + """ + if len(kwargs): + warn( + f"charset-normalizer disregard arguments '{','.join(list(kwargs.keys()))}' in legacy function detect()" + ) + + if not isinstance(byte_str, (bytearray, bytes)): + raise TypeError( # pragma: nocover + "Expected object of type bytes or bytearray, got: " + "{0}".format(type(byte_str)) + ) + + if isinstance(byte_str, bytearray): + byte_str = bytes(byte_str) + + r = from_bytes(byte_str).best() + + encoding = r.encoding if r is not None else None + language = r.language if r is not None and r.language != "Unknown" else "" + confidence = 1.0 - r.chaos if r is not None else None + + # Note: CharsetNormalizer does not return 'UTF-8-SIG' as the sig get stripped in the detection/normalization process + # but chardet does return 'utf-8-sig' and it is a valid codec name. + if r is not None and encoding == "utf_8" and r.bom: + encoding += "_sig" + + if should_rename_legacy is False and encoding in CHARDET_CORRESPONDENCE: + encoding = CHARDET_CORRESPONDENCE[encoding] + + return { + "encoding": encoding, + "language": language, + "confidence": confidence, + } diff --git a/requests/python/charset_normalizer/md.cpython-311-x86_64-linux-gnu.so b/requests/python/charset_normalizer/md.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..38fda6e Binary files /dev/null and b/requests/python/charset_normalizer/md.cpython-311-x86_64-linux-gnu.so differ diff --git a/requests/python/charset_normalizer/md.py b/requests/python/charset_normalizer/md.py new file mode 100644 index 0000000..13aa062 --- /dev/null +++ b/requests/python/charset_normalizer/md.py @@ -0,0 +1,582 @@ +from functools import lru_cache +from logging import getLogger +from typing import List, Optional + +from .constant import ( + COMMON_SAFE_ASCII_CHARACTERS, + TRACE, + UNICODE_SECONDARY_RANGE_KEYWORD, +) +from .utils import ( + is_accentuated, + is_ascii, + is_case_variable, + is_cjk, + is_emoticon, + is_hangul, + is_hiragana, + is_katakana, + is_latin, + is_punctuation, + is_separator, + is_symbol, + is_thai, + is_unprintable, + remove_accent, + unicode_range, +) + + +class MessDetectorPlugin: + """ + Base abstract class used for mess detection plugins. + All detectors MUST extend and implement given methods. + """ + + def eligible(self, character: str) -> bool: + """ + Determine if given character should be fed in. + """ + raise NotImplementedError # pragma: nocover + + def feed(self, character: str) -> None: + """ + The main routine to be executed upon character. + Insert the logic in witch the text would be considered chaotic. + """ + raise NotImplementedError # pragma: nocover + + def reset(self) -> None: # pragma: no cover + """ + Permit to reset the plugin to the initial state. + """ + raise NotImplementedError + + @property + def ratio(self) -> float: + """ + Compute the chaos ratio based on what your feed() has seen. + Must NOT be lower than 0.; No restriction gt 0. + """ + raise NotImplementedError # pragma: nocover + + +class TooManySymbolOrPunctuationPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._punctuation_count: int = 0 + self._symbol_count: int = 0 + self._character_count: int = 0 + + self._last_printable_char: Optional[str] = None + self._frenzy_symbol_in_word: bool = False + + def eligible(self, character: str) -> bool: + return character.isprintable() + + def feed(self, character: str) -> None: + self._character_count += 1 + + if ( + character != self._last_printable_char + and character not in COMMON_SAFE_ASCII_CHARACTERS + ): + if is_punctuation(character): + self._punctuation_count += 1 + elif ( + character.isdigit() is False + and is_symbol(character) + and is_emoticon(character) is False + ): + self._symbol_count += 2 + + self._last_printable_char = character + + def reset(self) -> None: # pragma: no cover + self._punctuation_count = 0 + self._character_count = 0 + self._symbol_count = 0 + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + ratio_of_punctuation: float = ( + self._punctuation_count + self._symbol_count + ) / self._character_count + + return ratio_of_punctuation if ratio_of_punctuation >= 0.3 else 0.0 + + +class TooManyAccentuatedPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._character_count: int = 0 + self._accentuated_count: int = 0 + + def eligible(self, character: str) -> bool: + return character.isalpha() + + def feed(self, character: str) -> None: + self._character_count += 1 + + if is_accentuated(character): + self._accentuated_count += 1 + + def reset(self) -> None: # pragma: no cover + self._character_count = 0 + self._accentuated_count = 0 + + @property + def ratio(self) -> float: + if self._character_count == 0 or self._character_count < 8: + return 0.0 + ratio_of_accentuation: float = self._accentuated_count / self._character_count + return ratio_of_accentuation if ratio_of_accentuation >= 0.35 else 0.0 + + +class UnprintablePlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._unprintable_count: int = 0 + self._character_count: int = 0 + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + if is_unprintable(character): + self._unprintable_count += 1 + self._character_count += 1 + + def reset(self) -> None: # pragma: no cover + self._unprintable_count = 0 + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + return (self._unprintable_count * 8) / self._character_count + + +class SuspiciousDuplicateAccentPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._successive_count: int = 0 + self._character_count: int = 0 + + self._last_latin_character: Optional[str] = None + + def eligible(self, character: str) -> bool: + return character.isalpha() and is_latin(character) + + def feed(self, character: str) -> None: + self._character_count += 1 + if ( + self._last_latin_character is not None + and is_accentuated(character) + and is_accentuated(self._last_latin_character) + ): + if character.isupper() and self._last_latin_character.isupper(): + self._successive_count += 1 + # Worse if its the same char duplicated with different accent. + if remove_accent(character) == remove_accent(self._last_latin_character): + self._successive_count += 1 + self._last_latin_character = character + + def reset(self) -> None: # pragma: no cover + self._successive_count = 0 + self._character_count = 0 + self._last_latin_character = None + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + return (self._successive_count * 2) / self._character_count + + +class SuspiciousRange(MessDetectorPlugin): + def __init__(self) -> None: + self._suspicious_successive_range_count: int = 0 + self._character_count: int = 0 + self._last_printable_seen: Optional[str] = None + + def eligible(self, character: str) -> bool: + return character.isprintable() + + def feed(self, character: str) -> None: + self._character_count += 1 + + if ( + character.isspace() + or is_punctuation(character) + or character in COMMON_SAFE_ASCII_CHARACTERS + ): + self._last_printable_seen = None + return + + if self._last_printable_seen is None: + self._last_printable_seen = character + return + + unicode_range_a: Optional[str] = unicode_range(self._last_printable_seen) + unicode_range_b: Optional[str] = unicode_range(character) + + if is_suspiciously_successive_range(unicode_range_a, unicode_range_b): + self._suspicious_successive_range_count += 1 + + self._last_printable_seen = character + + def reset(self) -> None: # pragma: no cover + self._character_count = 0 + self._suspicious_successive_range_count = 0 + self._last_printable_seen = None + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + ratio_of_suspicious_range_usage: float = ( + self._suspicious_successive_range_count * 2 + ) / self._character_count + + if ratio_of_suspicious_range_usage < 0.1: + return 0.0 + + return ratio_of_suspicious_range_usage + + +class SuperWeirdWordPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._word_count: int = 0 + self._bad_word_count: int = 0 + self._foreign_long_count: int = 0 + + self._is_current_word_bad: bool = False + self._foreign_long_watch: bool = False + + self._character_count: int = 0 + self._bad_character_count: int = 0 + + self._buffer: str = "" + self._buffer_accent_count: int = 0 + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + if character.isalpha(): + self._buffer += character + if is_accentuated(character): + self._buffer_accent_count += 1 + if ( + self._foreign_long_watch is False + and (is_latin(character) is False or is_accentuated(character)) + and is_cjk(character) is False + and is_hangul(character) is False + and is_katakana(character) is False + and is_hiragana(character) is False + and is_thai(character) is False + ): + self._foreign_long_watch = True + return + if not self._buffer: + return + if ( + character.isspace() or is_punctuation(character) or is_separator(character) + ) and self._buffer: + self._word_count += 1 + buffer_length: int = len(self._buffer) + + self._character_count += buffer_length + + if buffer_length >= 4: + if self._buffer_accent_count / buffer_length > 0.34: + self._is_current_word_bad = True + # Word/Buffer ending with an upper case accentuated letter are so rare, + # that we will consider them all as suspicious. Same weight as foreign_long suspicious. + if is_accentuated(self._buffer[-1]) and self._buffer[-1].isupper(): + self._foreign_long_count += 1 + self._is_current_word_bad = True + if buffer_length >= 24 and self._foreign_long_watch: + camel_case_dst = [ + i + for c, i in zip(self._buffer, range(0, buffer_length)) + if c.isupper() + ] + probable_camel_cased: bool = False + + if camel_case_dst and (len(camel_case_dst) / buffer_length <= 0.3): + probable_camel_cased = True + + if not probable_camel_cased: + self._foreign_long_count += 1 + self._is_current_word_bad = True + + if self._is_current_word_bad: + self._bad_word_count += 1 + self._bad_character_count += len(self._buffer) + self._is_current_word_bad = False + + self._foreign_long_watch = False + self._buffer = "" + self._buffer_accent_count = 0 + elif ( + character not in {"<", ">", "-", "=", "~", "|", "_"} + and character.isdigit() is False + and is_symbol(character) + ): + self._is_current_word_bad = True + self._buffer += character + + def reset(self) -> None: # pragma: no cover + self._buffer = "" + self._is_current_word_bad = False + self._foreign_long_watch = False + self._bad_word_count = 0 + self._word_count = 0 + self._character_count = 0 + self._bad_character_count = 0 + self._foreign_long_count = 0 + + @property + def ratio(self) -> float: + if self._word_count <= 10 and self._foreign_long_count == 0: + return 0.0 + + return self._bad_character_count / self._character_count + + +class CjkInvalidStopPlugin(MessDetectorPlugin): + """ + GB(Chinese) based encoding often render the stop incorrectly when the content does not fit and + can be easily detected. Searching for the overuse of '丅' and '丄'. + """ + + def __init__(self) -> None: + self._wrong_stop_count: int = 0 + self._cjk_character_count: int = 0 + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + if character in {"丅", "丄"}: + self._wrong_stop_count += 1 + return + if is_cjk(character): + self._cjk_character_count += 1 + + def reset(self) -> None: # pragma: no cover + self._wrong_stop_count = 0 + self._cjk_character_count = 0 + + @property + def ratio(self) -> float: + if self._cjk_character_count < 16: + return 0.0 + return self._wrong_stop_count / self._cjk_character_count + + +class ArchaicUpperLowerPlugin(MessDetectorPlugin): + def __init__(self) -> None: + self._buf: bool = False + + self._character_count_since_last_sep: int = 0 + + self._successive_upper_lower_count: int = 0 + self._successive_upper_lower_count_final: int = 0 + + self._character_count: int = 0 + + self._last_alpha_seen: Optional[str] = None + self._current_ascii_only: bool = True + + def eligible(self, character: str) -> bool: + return True + + def feed(self, character: str) -> None: + is_concerned = character.isalpha() and is_case_variable(character) + chunk_sep = is_concerned is False + + if chunk_sep and self._character_count_since_last_sep > 0: + if ( + self._character_count_since_last_sep <= 64 + and character.isdigit() is False + and self._current_ascii_only is False + ): + self._successive_upper_lower_count_final += ( + self._successive_upper_lower_count + ) + + self._successive_upper_lower_count = 0 + self._character_count_since_last_sep = 0 + self._last_alpha_seen = None + self._buf = False + self._character_count += 1 + self._current_ascii_only = True + + return + + if self._current_ascii_only is True and is_ascii(character) is False: + self._current_ascii_only = False + + if self._last_alpha_seen is not None: + if (character.isupper() and self._last_alpha_seen.islower()) or ( + character.islower() and self._last_alpha_seen.isupper() + ): + if self._buf is True: + self._successive_upper_lower_count += 2 + self._buf = False + else: + self._buf = True + else: + self._buf = False + + self._character_count += 1 + self._character_count_since_last_sep += 1 + self._last_alpha_seen = character + + def reset(self) -> None: # pragma: no cover + self._character_count = 0 + self._character_count_since_last_sep = 0 + self._successive_upper_lower_count = 0 + self._successive_upper_lower_count_final = 0 + self._last_alpha_seen = None + self._buf = False + self._current_ascii_only = True + + @property + def ratio(self) -> float: + if self._character_count == 0: + return 0.0 + + return self._successive_upper_lower_count_final / self._character_count + + +@lru_cache(maxsize=1024) +def is_suspiciously_successive_range( + unicode_range_a: Optional[str], unicode_range_b: Optional[str] +) -> bool: + """ + Determine if two Unicode range seen next to each other can be considered as suspicious. + """ + if unicode_range_a is None or unicode_range_b is None: + return True + + if unicode_range_a == unicode_range_b: + return False + + if "Latin" in unicode_range_a and "Latin" in unicode_range_b: + return False + + if "Emoticons" in unicode_range_a or "Emoticons" in unicode_range_b: + return False + + # Latin characters can be accompanied with a combining diacritical mark + # eg. Vietnamese. + if ("Latin" in unicode_range_a or "Latin" in unicode_range_b) and ( + "Combining" in unicode_range_a or "Combining" in unicode_range_b + ): + return False + + keywords_range_a, keywords_range_b = unicode_range_a.split( + " " + ), unicode_range_b.split(" ") + + for el in keywords_range_a: + if el in UNICODE_SECONDARY_RANGE_KEYWORD: + continue + if el in keywords_range_b: + return False + + # Japanese Exception + range_a_jp_chars, range_b_jp_chars = ( + unicode_range_a + in ( + "Hiragana", + "Katakana", + ), + unicode_range_b in ("Hiragana", "Katakana"), + ) + if (range_a_jp_chars or range_b_jp_chars) and ( + "CJK" in unicode_range_a or "CJK" in unicode_range_b + ): + return False + if range_a_jp_chars and range_b_jp_chars: + return False + + if "Hangul" in unicode_range_a or "Hangul" in unicode_range_b: + if "CJK" in unicode_range_a or "CJK" in unicode_range_b: + return False + if unicode_range_a == "Basic Latin" or unicode_range_b == "Basic Latin": + return False + + # Chinese/Japanese use dedicated range for punctuation and/or separators. + if ("CJK" in unicode_range_a or "CJK" in unicode_range_b) or ( + unicode_range_a in ["Katakana", "Hiragana"] + and unicode_range_b in ["Katakana", "Hiragana"] + ): + if "Punctuation" in unicode_range_a or "Punctuation" in unicode_range_b: + return False + if "Forms" in unicode_range_a or "Forms" in unicode_range_b: + return False + + return True + + +@lru_cache(maxsize=2048) +def mess_ratio( + decoded_sequence: str, maximum_threshold: float = 0.2, debug: bool = False +) -> float: + """ + Compute a mess ratio given a decoded bytes sequence. The maximum threshold does stop the computation earlier. + """ + + detectors: List[MessDetectorPlugin] = [ + md_class() for md_class in MessDetectorPlugin.__subclasses__() + ] + + length: int = len(decoded_sequence) + 1 + + mean_mess_ratio: float = 0.0 + + if length < 512: + intermediary_mean_mess_ratio_calc: int = 32 + elif length <= 1024: + intermediary_mean_mess_ratio_calc = 64 + else: + intermediary_mean_mess_ratio_calc = 128 + + for character, index in zip(decoded_sequence + "\n", range(length)): + for detector in detectors: + if detector.eligible(character): + detector.feed(character) + + if ( + index > 0 and index % intermediary_mean_mess_ratio_calc == 0 + ) or index == length - 1: + mean_mess_ratio = sum(dt.ratio for dt in detectors) + + if mean_mess_ratio >= maximum_threshold: + break + + if debug: + logger = getLogger("charset_normalizer") + + logger.log( + TRACE, + "Mess-detector extended-analysis start. " + f"intermediary_mean_mess_ratio_calc={intermediary_mean_mess_ratio_calc} mean_mess_ratio={mean_mess_ratio} " + f"maximum_threshold={maximum_threshold}", + ) + + if len(decoded_sequence) > 16: + logger.log(TRACE, f"Starting with: {decoded_sequence[:16]}") + logger.log(TRACE, f"Ending with: {decoded_sequence[-16::]}") + + for dt in detectors: # pragma: nocover + logger.log(TRACE, f"{dt.__class__}: {dt.ratio}") + + return round(mean_mess_ratio, 3) diff --git a/requests/python/charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so b/requests/python/charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..b9b97c9 Binary files /dev/null and b/requests/python/charset_normalizer/md__mypyc.cpython-311-x86_64-linux-gnu.so differ diff --git a/requests/python/charset_normalizer/models.py b/requests/python/charset_normalizer/models.py new file mode 100644 index 0000000..7f8ca38 --- /dev/null +++ b/requests/python/charset_normalizer/models.py @@ -0,0 +1,337 @@ +from encodings.aliases import aliases +from hashlib import sha256 +from json import dumps +from typing import Any, Dict, Iterator, List, Optional, Tuple, Union + +from .constant import TOO_BIG_SEQUENCE +from .utils import iana_name, is_multi_byte_encoding, unicode_range + + +class CharsetMatch: + def __init__( + self, + payload: bytes, + guessed_encoding: str, + mean_mess_ratio: float, + has_sig_or_bom: bool, + languages: "CoherenceMatches", + decoded_payload: Optional[str] = None, + ): + self._payload: bytes = payload + + self._encoding: str = guessed_encoding + self._mean_mess_ratio: float = mean_mess_ratio + self._languages: CoherenceMatches = languages + self._has_sig_or_bom: bool = has_sig_or_bom + self._unicode_ranges: Optional[List[str]] = None + + self._leaves: List[CharsetMatch] = [] + self._mean_coherence_ratio: float = 0.0 + + self._output_payload: Optional[bytes] = None + self._output_encoding: Optional[str] = None + + self._string: Optional[str] = decoded_payload + + def __eq__(self, other: object) -> bool: + if not isinstance(other, CharsetMatch): + raise TypeError( + "__eq__ cannot be invoked on {} and {}.".format( + str(other.__class__), str(self.__class__) + ) + ) + return self.encoding == other.encoding and self.fingerprint == other.fingerprint + + def __lt__(self, other: object) -> bool: + """ + Implemented to make sorted available upon CharsetMatches items. + """ + if not isinstance(other, CharsetMatch): + raise ValueError + + chaos_difference: float = abs(self.chaos - other.chaos) + coherence_difference: float = abs(self.coherence - other.coherence) + + # Below 1% difference --> Use Coherence + if chaos_difference < 0.01 and coherence_difference > 0.02: + # When having a tough decision, use the result that decoded as many multi-byte as possible. + if chaos_difference == 0.0 and self.coherence == other.coherence: + return self.multi_byte_usage > other.multi_byte_usage + return self.coherence > other.coherence + + return self.chaos < other.chaos + + @property + def multi_byte_usage(self) -> float: + return 1.0 - len(str(self)) / len(self.raw) + + def __str__(self) -> str: + # Lazy Str Loading + if self._string is None: + self._string = str(self._payload, self._encoding, "strict") + return self._string + + def __repr__(self) -> str: + return "".format(self.encoding, self.fingerprint) + + def add_submatch(self, other: "CharsetMatch") -> None: + if not isinstance(other, CharsetMatch) or other == self: + raise ValueError( + "Unable to add instance <{}> as a submatch of a CharsetMatch".format( + other.__class__ + ) + ) + + other._string = None # Unload RAM usage; dirty trick. + self._leaves.append(other) + + @property + def encoding(self) -> str: + return self._encoding + + @property + def encoding_aliases(self) -> List[str]: + """ + Encoding name are known by many name, using this could help when searching for IBM855 when it's listed as CP855. + """ + also_known_as: List[str] = [] + for u, p in aliases.items(): + if self.encoding == u: + also_known_as.append(p) + elif self.encoding == p: + also_known_as.append(u) + return also_known_as + + @property + def bom(self) -> bool: + return self._has_sig_or_bom + + @property + def byte_order_mark(self) -> bool: + return self._has_sig_or_bom + + @property + def languages(self) -> List[str]: + """ + Return the complete list of possible languages found in decoded sequence. + Usually not really useful. Returned list may be empty even if 'language' property return something != 'Unknown'. + """ + return [e[0] for e in self._languages] + + @property + def language(self) -> str: + """ + Most probable language found in decoded sequence. If none were detected or inferred, the property will return + "Unknown". + """ + if not self._languages: + # Trying to infer the language based on the given encoding + # Its either English or we should not pronounce ourselves in certain cases. + if "ascii" in self.could_be_from_charset: + return "English" + + # doing it there to avoid circular import + from charset_normalizer.cd import encoding_languages, mb_encoding_languages + + languages = ( + mb_encoding_languages(self.encoding) + if is_multi_byte_encoding(self.encoding) + else encoding_languages(self.encoding) + ) + + if len(languages) == 0 or "Latin Based" in languages: + return "Unknown" + + return languages[0] + + return self._languages[0][0] + + @property + def chaos(self) -> float: + return self._mean_mess_ratio + + @property + def coherence(self) -> float: + if not self._languages: + return 0.0 + return self._languages[0][1] + + @property + def percent_chaos(self) -> float: + return round(self.chaos * 100, ndigits=3) + + @property + def percent_coherence(self) -> float: + return round(self.coherence * 100, ndigits=3) + + @property + def raw(self) -> bytes: + """ + Original untouched bytes. + """ + return self._payload + + @property + def submatch(self) -> List["CharsetMatch"]: + return self._leaves + + @property + def has_submatch(self) -> bool: + return len(self._leaves) > 0 + + @property + def alphabets(self) -> List[str]: + if self._unicode_ranges is not None: + return self._unicode_ranges + # list detected ranges + detected_ranges: List[Optional[str]] = [ + unicode_range(char) for char in str(self) + ] + # filter and sort + self._unicode_ranges = sorted(list({r for r in detected_ranges if r})) + return self._unicode_ranges + + @property + def could_be_from_charset(self) -> List[str]: + """ + The complete list of encoding that output the exact SAME str result and therefore could be the originating + encoding. + This list does include the encoding available in property 'encoding'. + """ + return [self._encoding] + [m.encoding for m in self._leaves] + + def output(self, encoding: str = "utf_8") -> bytes: + """ + Method to get re-encoded bytes payload using given target encoding. Default to UTF-8. + Any errors will be simply ignored by the encoder NOT replaced. + """ + if self._output_encoding is None or self._output_encoding != encoding: + self._output_encoding = encoding + self._output_payload = str(self).encode(encoding, "replace") + + return self._output_payload # type: ignore + + @property + def fingerprint(self) -> str: + """ + Retrieve the unique SHA256 computed using the transformed (re-encoded) payload. Not the original one. + """ + return sha256(self.output()).hexdigest() + + +class CharsetMatches: + """ + Container with every CharsetMatch items ordered by default from most probable to the less one. + Act like a list(iterable) but does not implements all related methods. + """ + + def __init__(self, results: Optional[List[CharsetMatch]] = None): + self._results: List[CharsetMatch] = sorted(results) if results else [] + + def __iter__(self) -> Iterator[CharsetMatch]: + yield from self._results + + def __getitem__(self, item: Union[int, str]) -> CharsetMatch: + """ + Retrieve a single item either by its position or encoding name (alias may be used here). + Raise KeyError upon invalid index or encoding not present in results. + """ + if isinstance(item, int): + return self._results[item] + if isinstance(item, str): + item = iana_name(item, False) + for result in self._results: + if item in result.could_be_from_charset: + return result + raise KeyError + + def __len__(self) -> int: + return len(self._results) + + def __bool__(self) -> bool: + return len(self._results) > 0 + + def append(self, item: CharsetMatch) -> None: + """ + Insert a single match. Will be inserted accordingly to preserve sort. + Can be inserted as a submatch. + """ + if not isinstance(item, CharsetMatch): + raise ValueError( + "Cannot append instance '{}' to CharsetMatches".format( + str(item.__class__) + ) + ) + # We should disable the submatch factoring when the input file is too heavy (conserve RAM usage) + if len(item.raw) <= TOO_BIG_SEQUENCE: + for match in self._results: + if match.fingerprint == item.fingerprint and match.chaos == item.chaos: + match.add_submatch(item) + return + self._results.append(item) + self._results = sorted(self._results) + + def best(self) -> Optional["CharsetMatch"]: + """ + Simply return the first match. Strict equivalent to matches[0]. + """ + if not self._results: + return None + return self._results[0] + + def first(self) -> Optional["CharsetMatch"]: + """ + Redundant method, call the method best(). Kept for BC reasons. + """ + return self.best() + + +CoherenceMatch = Tuple[str, float] +CoherenceMatches = List[CoherenceMatch] + + +class CliDetectionResult: + def __init__( + self, + path: str, + encoding: Optional[str], + encoding_aliases: List[str], + alternative_encodings: List[str], + language: str, + alphabets: List[str], + has_sig_or_bom: bool, + chaos: float, + coherence: float, + unicode_path: Optional[str], + is_preferred: bool, + ): + self.path: str = path + self.unicode_path: Optional[str] = unicode_path + self.encoding: Optional[str] = encoding + self.encoding_aliases: List[str] = encoding_aliases + self.alternative_encodings: List[str] = alternative_encodings + self.language: str = language + self.alphabets: List[str] = alphabets + self.has_sig_or_bom: bool = has_sig_or_bom + self.chaos: float = chaos + self.coherence: float = coherence + self.is_preferred: bool = is_preferred + + @property + def __dict__(self) -> Dict[str, Any]: # type: ignore + return { + "path": self.path, + "encoding": self.encoding, + "encoding_aliases": self.encoding_aliases, + "alternative_encodings": self.alternative_encodings, + "language": self.language, + "alphabets": self.alphabets, + "has_sig_or_bom": self.has_sig_or_bom, + "chaos": self.chaos, + "coherence": self.coherence, + "unicode_path": self.unicode_path, + "is_preferred": self.is_preferred, + } + + def to_json(self) -> str: + return dumps(self.__dict__, ensure_ascii=True, indent=4) diff --git a/requests/python/charset_normalizer/py.typed b/requests/python/charset_normalizer/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/requests/python/charset_normalizer/utils.py b/requests/python/charset_normalizer/utils.py new file mode 100644 index 0000000..bf2767a --- /dev/null +++ b/requests/python/charset_normalizer/utils.py @@ -0,0 +1,414 @@ +import importlib +import logging +import unicodedata +from codecs import IncrementalDecoder +from encodings.aliases import aliases +from functools import lru_cache +from re import findall +from typing import Generator, List, Optional, Set, Tuple, Union + +from _multibytecodec import MultibyteIncrementalDecoder + +from .constant import ( + ENCODING_MARKS, + IANA_SUPPORTED_SIMILAR, + RE_POSSIBLE_ENCODING_INDICATION, + UNICODE_RANGES_COMBINED, + UNICODE_SECONDARY_RANGE_KEYWORD, + UTF8_MAXIMAL_ALLOCATION, +) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_accentuated(character: str) -> bool: + try: + description: str = unicodedata.name(character) + except ValueError: + return False + return ( + "WITH GRAVE" in description + or "WITH ACUTE" in description + or "WITH CEDILLA" in description + or "WITH DIAERESIS" in description + or "WITH CIRCUMFLEX" in description + or "WITH TILDE" in description + ) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def remove_accent(character: str) -> str: + decomposed: str = unicodedata.decomposition(character) + if not decomposed: + return character + + codes: List[str] = decomposed.split(" ") + + return chr(int(codes[0], 16)) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def unicode_range(character: str) -> Optional[str]: + """ + Retrieve the Unicode range official name from a single character. + """ + character_ord: int = ord(character) + + for range_name, ord_range in UNICODE_RANGES_COMBINED.items(): + if character_ord in ord_range: + return range_name + + return None + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_latin(character: str) -> bool: + try: + description: str = unicodedata.name(character) + except ValueError: + return False + return "LATIN" in description + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_ascii(character: str) -> bool: + try: + character.encode("ascii") + except UnicodeEncodeError: + return False + return True + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_punctuation(character: str) -> bool: + character_category: str = unicodedata.category(character) + + if "P" in character_category: + return True + + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + return False + + return "Punctuation" in character_range + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_symbol(character: str) -> bool: + character_category: str = unicodedata.category(character) + + if "S" in character_category or "N" in character_category: + return True + + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + return False + + return "Forms" in character_range + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_emoticon(character: str) -> bool: + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + return False + + return "Emoticons" in character_range + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_separator(character: str) -> bool: + if character.isspace() or character in {"|", "+", "<", ">"}: + return True + + character_category: str = unicodedata.category(character) + + return "Z" in character_category or character_category in {"Po", "Pd", "Pc"} + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_case_variable(character: str) -> bool: + return character.islower() != character.isupper() + + +def is_private_use_only(character: str) -> bool: + character_category: str = unicodedata.category(character) + + return character_category == "Co" + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_cjk(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "CJK" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_hiragana(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "HIRAGANA" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_katakana(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "KATAKANA" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_hangul(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "HANGUL" in character_name + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_thai(character: str) -> bool: + try: + character_name = unicodedata.name(character) + except ValueError: + return False + + return "THAI" in character_name + + +@lru_cache(maxsize=len(UNICODE_RANGES_COMBINED)) +def is_unicode_range_secondary(range_name: str) -> bool: + return any(keyword in range_name for keyword in UNICODE_SECONDARY_RANGE_KEYWORD) + + +@lru_cache(maxsize=UTF8_MAXIMAL_ALLOCATION) +def is_unprintable(character: str) -> bool: + return ( + character.isspace() is False # includes \n \t \r \v + and character.isprintable() is False + and character != "\x1A" # Why? Its the ASCII substitute character. + and character != "\ufeff" # bug discovered in Python, + # Zero Width No-Break Space located in Arabic Presentation Forms-B, Unicode 1.1 not acknowledged as space. + ) + + +def any_specified_encoding(sequence: bytes, search_zone: int = 4096) -> Optional[str]: + """ + Extract using ASCII-only decoder any specified encoding in the first n-bytes. + """ + if not isinstance(sequence, bytes): + raise TypeError + + seq_len: int = len(sequence) + + results: List[str] = findall( + RE_POSSIBLE_ENCODING_INDICATION, + sequence[: min(seq_len, search_zone)].decode("ascii", errors="ignore"), + ) + + if len(results) == 0: + return None + + for specified_encoding in results: + specified_encoding = specified_encoding.lower().replace("-", "_") + + encoding_alias: str + encoding_iana: str + + for encoding_alias, encoding_iana in aliases.items(): + if encoding_alias == specified_encoding: + return encoding_iana + if encoding_iana == specified_encoding: + return encoding_iana + + return None + + +@lru_cache(maxsize=128) +def is_multi_byte_encoding(name: str) -> bool: + """ + Verify is a specific encoding is a multi byte one based on it IANA name + """ + return name in { + "utf_8", + "utf_8_sig", + "utf_16", + "utf_16_be", + "utf_16_le", + "utf_32", + "utf_32_le", + "utf_32_be", + "utf_7", + } or issubclass( + importlib.import_module("encodings.{}".format(name)).IncrementalDecoder, + MultibyteIncrementalDecoder, + ) + + +def identify_sig_or_bom(sequence: bytes) -> Tuple[Optional[str], bytes]: + """ + Identify and extract SIG/BOM in given sequence. + """ + + for iana_encoding in ENCODING_MARKS: + marks: Union[bytes, List[bytes]] = ENCODING_MARKS[iana_encoding] + + if isinstance(marks, bytes): + marks = [marks] + + for mark in marks: + if sequence.startswith(mark): + return iana_encoding, mark + + return None, b"" + + +def should_strip_sig_or_bom(iana_encoding: str) -> bool: + return iana_encoding not in {"utf_16", "utf_32"} + + +def iana_name(cp_name: str, strict: bool = True) -> str: + cp_name = cp_name.lower().replace("-", "_") + + encoding_alias: str + encoding_iana: str + + for encoding_alias, encoding_iana in aliases.items(): + if cp_name in [encoding_alias, encoding_iana]: + return encoding_iana + + if strict: + raise ValueError("Unable to retrieve IANA for '{}'".format(cp_name)) + + return cp_name + + +def range_scan(decoded_sequence: str) -> List[str]: + ranges: Set[str] = set() + + for character in decoded_sequence: + character_range: Optional[str] = unicode_range(character) + + if character_range is None: + continue + + ranges.add(character_range) + + return list(ranges) + + +def cp_similarity(iana_name_a: str, iana_name_b: str) -> float: + if is_multi_byte_encoding(iana_name_a) or is_multi_byte_encoding(iana_name_b): + return 0.0 + + decoder_a = importlib.import_module( + "encodings.{}".format(iana_name_a) + ).IncrementalDecoder + decoder_b = importlib.import_module( + "encodings.{}".format(iana_name_b) + ).IncrementalDecoder + + id_a: IncrementalDecoder = decoder_a(errors="ignore") + id_b: IncrementalDecoder = decoder_b(errors="ignore") + + character_match_count: int = 0 + + for i in range(255): + to_be_decoded: bytes = bytes([i]) + if id_a.decode(to_be_decoded) == id_b.decode(to_be_decoded): + character_match_count += 1 + + return character_match_count / 254 + + +def is_cp_similar(iana_name_a: str, iana_name_b: str) -> bool: + """ + Determine if two code page are at least 80% similar. IANA_SUPPORTED_SIMILAR dict was generated using + the function cp_similarity. + """ + return ( + iana_name_a in IANA_SUPPORTED_SIMILAR + and iana_name_b in IANA_SUPPORTED_SIMILAR[iana_name_a] + ) + + +def set_logging_handler( + name: str = "charset_normalizer", + level: int = logging.INFO, + format_string: str = "%(asctime)s | %(levelname)s | %(message)s", +) -> None: + logger = logging.getLogger(name) + logger.setLevel(level) + + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter(format_string)) + logger.addHandler(handler) + + +def cut_sequence_chunks( + sequences: bytes, + encoding_iana: str, + offsets: range, + chunk_size: int, + bom_or_sig_available: bool, + strip_sig_or_bom: bool, + sig_payload: bytes, + is_multi_byte_decoder: bool, + decoded_payload: Optional[str] = None, +) -> Generator[str, None, None]: + if decoded_payload and is_multi_byte_decoder is False: + for i in offsets: + chunk = decoded_payload[i : i + chunk_size] + if not chunk: + break + yield chunk + else: + for i in offsets: + chunk_end = i + chunk_size + if chunk_end > len(sequences) + 8: + continue + + cut_sequence = sequences[i : i + chunk_size] + + if bom_or_sig_available and strip_sig_or_bom is False: + cut_sequence = sig_payload + cut_sequence + + chunk = cut_sequence.decode( + encoding_iana, + errors="ignore" if is_multi_byte_decoder else "strict", + ) + + # multi-byte bad cutting detector and adjustment + # not the cleanest way to perform that fix but clever enough for now. + if is_multi_byte_decoder and i > 0: + chunk_partial_size_chk: int = min(chunk_size, 16) + + if ( + decoded_payload + and chunk[:chunk_partial_size_chk] not in decoded_payload + ): + for j in range(i, i - 4, -1): + cut_sequence = sequences[j:chunk_end] + + if bom_or_sig_available and strip_sig_or_bom is False: + cut_sequence = sig_payload + cut_sequence + + chunk = cut_sequence.decode(encoding_iana, errors="ignore") + + if chunk[:chunk_partial_size_chk] in decoded_payload: + break + + yield chunk diff --git a/requests/python/charset_normalizer/version.py b/requests/python/charset_normalizer/version.py new file mode 100644 index 0000000..5eed49a --- /dev/null +++ b/requests/python/charset_normalizer/version.py @@ -0,0 +1,6 @@ +""" +Expose version +""" + +__version__ = "3.2.0" +VERSION = __version__.split(".") diff --git a/requests/python/idna-3.4.dist-info/INSTALLER b/requests/python/idna-3.4.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/requests/python/idna-3.4.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/requests/python/idna-3.4.dist-info/LICENSE.md b/requests/python/idna-3.4.dist-info/LICENSE.md new file mode 100644 index 0000000..b6f8732 --- /dev/null +++ b/requests/python/idna-3.4.dist-info/LICENSE.md @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2013-2021, Kim Davies +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/requests/python/idna-3.4.dist-info/METADATA b/requests/python/idna-3.4.dist-info/METADATA new file mode 100644 index 0000000..07f6193 --- /dev/null +++ b/requests/python/idna-3.4.dist-info/METADATA @@ -0,0 +1,242 @@ +Metadata-Version: 2.1 +Name: idna +Version: 3.4 +Summary: Internationalized Domain Names in Applications (IDNA) +Author-email: Kim Davies +Requires-Python: >=3.5 +Description-Content-Type: text/x-rst +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: System Administrators +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: Name Service (DNS) +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Utilities +Project-URL: Changelog, https://github.com/kjd/idna/blob/master/HISTORY.rst +Project-URL: Issue tracker, https://github.com/kjd/idna/issues +Project-URL: Source, https://github.com/kjd/idna + +Internationalized Domain Names in Applications (IDNA) +===================================================== + +Support for the Internationalized Domain Names in +Applications (IDNA) protocol as specified in `RFC 5891 +`_. This is the latest version of +the protocol and is sometimes referred to as “IDNA 2008”. + +This library also provides support for Unicode Technical +Standard 46, `Unicode IDNA Compatibility Processing +`_. + +This acts as a suitable replacement for the “encodings.idna” +module that comes with the Python standard library, but which +only supports the older superseded IDNA specification (`RFC 3490 +`_). + +Basic functions are simply executed: + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('ドメイン.テスト') + b'xn--eckwd4c7c.xn--zckzah' + >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) + ドメイン.テスト + + +Installation +------------ + +This package is available for installation from PyPI: + +.. code-block:: bash + + $ python3 -m pip install idna + + +Usage +----- + +For typical usage, the ``encode`` and ``decode`` functions will take a +domain name argument and perform a conversion to A-labels or U-labels +respectively. + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('ドメイン.テスト') + b'xn--eckwd4c7c.xn--zckzah' + >>> print(idna.decode('xn--eckwd4c7c.xn--zckzah')) + ドメイン.テスト + +You may use the codec encoding and decoding methods using the +``idna.codec`` module: + +.. code-block:: pycon + + >>> import idna.codec + >>> print('домен.испытание'.encode('idna')) + b'xn--d1acufc.xn--80akhbyknj4f' + >>> print(b'xn--d1acufc.xn--80akhbyknj4f'.decode('idna')) + домен.испытание + +Conversions can be applied at a per-label basis using the ``ulabel`` or +``alabel`` functions if necessary: + +.. code-block:: pycon + + >>> idna.alabel('测试') + b'xn--0zwm56d' + +Compatibility Mapping (UTS #46) ++++++++++++++++++++++++++++++++ + +As described in `RFC 5895 `_, the +IDNA specification does not normalize input from different potential +ways a user may input a domain name. This functionality, known as +a “mapping”, is considered by the specification to be a local +user-interface issue distinct from IDNA conversion functionality. + +This library provides one such mapping, that was developed by the +Unicode Consortium. Known as `Unicode IDNA Compatibility Processing +`_, it provides for both a regular +mapping for typical applications, as well as a transitional mapping to +help migrate from older IDNA 2003 applications. + +For example, “Königsgäßchen” is not a permissible label as *LATIN +CAPITAL LETTER K* is not allowed (nor are capital letters in general). +UTS 46 will convert this into lower case prior to applying the IDNA +conversion. + +.. code-block:: pycon + + >>> import idna + >>> idna.encode('Königsgäßchen') + ... + idna.core.InvalidCodepoint: Codepoint U+004B at position 1 of 'Königsgäßchen' not allowed + >>> idna.encode('Königsgäßchen', uts46=True) + b'xn--knigsgchen-b4a3dun' + >>> print(idna.decode('xn--knigsgchen-b4a3dun')) + königsgäßchen + +Transitional processing provides conversions to help transition from +the older 2003 standard to the current standard. For example, in the +original IDNA specification, the *LATIN SMALL LETTER SHARP S* (ß) was +converted into two *LATIN SMALL LETTER S* (ss), whereas in the current +IDNA specification this conversion is not performed. + +.. code-block:: pycon + + >>> idna.encode('Königsgäßchen', uts46=True, transitional=True) + 'xn--knigsgsschen-lcb0w' + +Implementors should use transitional processing with caution, only in +rare cases where conversion from legacy labels to current labels must be +performed (i.e. IDNA implementations that pre-date 2008). For typical +applications that just need to convert labels, transitional processing +is unlikely to be beneficial and could produce unexpected incompatible +results. + +``encodings.idna`` Compatibility +++++++++++++++++++++++++++++++++ + +Function calls from the Python built-in ``encodings.idna`` module are +mapped to their IDNA 2008 equivalents using the ``idna.compat`` module. +Simply substitute the ``import`` clause in your code to refer to the new +module name. + +Exceptions +---------- + +All errors raised during the conversion following the specification +should raise an exception derived from the ``idna.IDNAError`` base +class. + +More specific exceptions that may be generated as ``idna.IDNABidiError`` +when the error reflects an illegal combination of left-to-right and +right-to-left characters in a label; ``idna.InvalidCodepoint`` when +a specific codepoint is an illegal character in an IDN label (i.e. +INVALID); and ``idna.InvalidCodepointContext`` when the codepoint is +illegal based on its positional context (i.e. it is CONTEXTO or CONTEXTJ +but the contextual requirements are not satisfied.) + +Building and Diagnostics +------------------------ + +The IDNA and UTS 46 functionality relies upon pre-calculated lookup +tables for performance. These tables are derived from computing against +eligibility criteria in the respective standards. These tables are +computed using the command-line script ``tools/idna-data``. + +This tool will fetch relevant codepoint data from the Unicode repository +and perform the required calculations to identify eligibility. There are +three main modes: + +* ``idna-data make-libdata``. Generates ``idnadata.py`` and + ``uts46data.py``, the pre-calculated lookup tables using for IDNA and + UTS 46 conversions. Implementors who wish to track this library against + a different Unicode version may use this tool to manually generate a + different version of the ``idnadata.py`` and ``uts46data.py`` files. + +* ``idna-data make-table``. Generate a table of the IDNA disposition + (e.g. PVALID, CONTEXTJ, CONTEXTO) in the format found in Appendix + B.1 of RFC 5892 and the pre-computed tables published by `IANA + `_. + +* ``idna-data U+0061``. Prints debugging output on the various + properties associated with an individual Unicode codepoint (in this + case, U+0061), that are used to assess the IDNA and UTS 46 status of a + codepoint. This is helpful in debugging or analysis. + +The tool accepts a number of arguments, described using ``idna-data +-h``. Most notably, the ``--version`` argument allows the specification +of the version of Unicode to use in computing the table data. For +example, ``idna-data --version 9.0.0 make-libdata`` will generate +library data against Unicode 9.0.0. + + +Additional Notes +---------------- + +* **Packages**. The latest tagged release version is published in the + `Python Package Index `_. + +* **Version support**. This library supports Python 3.5 and higher. + As this library serves as a low-level toolkit for a variety of + applications, many of which strive for broad compatibility with older + Python versions, there is no rush to remove older intepreter support. + Removing support for older versions should be well justified in that the + maintenance burden has become too high. + +* **Python 2**. Python 2 is supported by version 2.x of this library. + While active development of the version 2.x series has ended, notable + issues being corrected may be backported to 2.x. Use "idna<3" in your + requirements file if you need this library for a Python 2 application. + +* **Testing**. The library has a test suite based on each rule of the + IDNA specification, as well as tests that are provided as part of the + Unicode Technical Standard 46, `Unicode IDNA Compatibility Processing + `_. + +* **Emoji**. It is an occasional request to support emoji domains in + this library. Encoding of symbols like emoji is expressly prohibited by + the technical standard IDNA 2008 and emoji domains are broadly phased + out across the domain industry due to associated security risks. For + now, applications that wish need to support these non-compliant labels + may wish to consider trying the encode/decode operation in this library + first, and then falling back to using `encodings.idna`. See `the Github + project `_ for more discussion. + diff --git a/requests/python/idna-3.4.dist-info/RECORD b/requests/python/idna-3.4.dist-info/RECORD new file mode 100644 index 0000000..5da1ae1 --- /dev/null +++ b/requests/python/idna-3.4.dist-info/RECORD @@ -0,0 +1,22 @@ +idna-3.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +idna-3.4.dist-info/LICENSE.md,sha256=otbk2UC9JNvnuWRc3hmpeSzFHbeuDVrNMBrIYMqj6DY,1523 +idna-3.4.dist-info/METADATA,sha256=8aLSf9MFS7oB26pZh2hprg7eJp0UJSc-3rpf_evp4DA,9830 +idna-3.4.dist-info/RECORD,, +idna-3.4.dist-info/WHEEL,sha256=4TfKIB_xu-04bc2iKz6_zFt-gEFEEDU_31HGhqzOCE8,81 +idna/__init__.py,sha256=KJQN1eQBr8iIK5SKrJ47lXvxG0BJ7Lm38W4zT0v_8lk,849 +idna/__pycache__/__init__.cpython-311.pyc,, +idna/__pycache__/codec.cpython-311.pyc,, +idna/__pycache__/compat.cpython-311.pyc,, +idna/__pycache__/core.cpython-311.pyc,, +idna/__pycache__/idnadata.cpython-311.pyc,, +idna/__pycache__/intranges.cpython-311.pyc,, +idna/__pycache__/package_data.cpython-311.pyc,, +idna/__pycache__/uts46data.cpython-311.pyc,, +idna/codec.py,sha256=6ly5odKfqrytKT9_7UrlGklHnf1DSK2r9C6cSM4sa28,3374 +idna/compat.py,sha256=0_sOEUMT4CVw9doD3vyRhX80X19PwqFoUBs7gWsFME4,321 +idna/core.py,sha256=1JxchwKzkxBSn7R_oCE12oBu3eVux0VzdxolmIad24M,12950 +idna/idnadata.py,sha256=xUjqKqiJV8Ho_XzBpAtv5JFoVPSupK-SUXvtjygUHqw,44375 +idna/intranges.py,sha256=YBr4fRYuWH7kTKS2tXlFjM24ZF1Pdvcir-aywniInqg,1881 +idna/package_data.py,sha256=C_jHJzmX8PI4xq0jpzmcTMxpb5lDsq4o5VyxQzlVrZE,21 +idna/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +idna/uts46data.py,sha256=zvjZU24s58_uAS850Mcd0NnD0X7_gCMAMjzWNIeUJdc,206539 diff --git a/requests/python/idna-3.4.dist-info/WHEEL b/requests/python/idna-3.4.dist-info/WHEEL new file mode 100644 index 0000000..668ba4d --- /dev/null +++ b/requests/python/idna-3.4.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.7.1 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/requests/python/idna/__init__.py b/requests/python/idna/__init__.py new file mode 100644 index 0000000..a40eeaf --- /dev/null +++ b/requests/python/idna/__init__.py @@ -0,0 +1,44 @@ +from .package_data import __version__ +from .core import ( + IDNABidiError, + IDNAError, + InvalidCodepoint, + InvalidCodepointContext, + alabel, + check_bidi, + check_hyphen_ok, + check_initial_combiner, + check_label, + check_nfc, + decode, + encode, + ulabel, + uts46_remap, + valid_contextj, + valid_contexto, + valid_label_length, + valid_string_length, +) +from .intranges import intranges_contain + +__all__ = [ + "IDNABidiError", + "IDNAError", + "InvalidCodepoint", + "InvalidCodepointContext", + "alabel", + "check_bidi", + "check_hyphen_ok", + "check_initial_combiner", + "check_label", + "check_nfc", + "decode", + "encode", + "intranges_contain", + "ulabel", + "uts46_remap", + "valid_contextj", + "valid_contexto", + "valid_label_length", + "valid_string_length", +] diff --git a/requests/python/idna/__pycache__/__init__.cpython-311.pyc b/requests/python/idna/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1e3e2e1 Binary files /dev/null and b/requests/python/idna/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/idna/__pycache__/codec.cpython-311.pyc b/requests/python/idna/__pycache__/codec.cpython-311.pyc new file mode 100644 index 0000000..c65aab9 Binary files /dev/null and b/requests/python/idna/__pycache__/codec.cpython-311.pyc differ diff --git a/requests/python/idna/__pycache__/compat.cpython-311.pyc b/requests/python/idna/__pycache__/compat.cpython-311.pyc new file mode 100644 index 0000000..68ee71b Binary files /dev/null and b/requests/python/idna/__pycache__/compat.cpython-311.pyc differ diff --git a/requests/python/idna/__pycache__/core.cpython-311.pyc b/requests/python/idna/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..1bd0f9d Binary files /dev/null and b/requests/python/idna/__pycache__/core.cpython-311.pyc differ diff --git a/requests/python/idna/__pycache__/idnadata.cpython-311.pyc b/requests/python/idna/__pycache__/idnadata.cpython-311.pyc new file mode 100644 index 0000000..dd314e7 Binary files /dev/null and b/requests/python/idna/__pycache__/idnadata.cpython-311.pyc differ diff --git a/requests/python/idna/__pycache__/intranges.cpython-311.pyc b/requests/python/idna/__pycache__/intranges.cpython-311.pyc new file mode 100644 index 0000000..7536a50 Binary files /dev/null and b/requests/python/idna/__pycache__/intranges.cpython-311.pyc differ diff --git a/requests/python/idna/__pycache__/package_data.cpython-311.pyc b/requests/python/idna/__pycache__/package_data.cpython-311.pyc new file mode 100644 index 0000000..a6f1dd9 Binary files /dev/null and b/requests/python/idna/__pycache__/package_data.cpython-311.pyc differ diff --git a/requests/python/idna/__pycache__/uts46data.cpython-311.pyc b/requests/python/idna/__pycache__/uts46data.cpython-311.pyc new file mode 100644 index 0000000..6cb226b Binary files /dev/null and b/requests/python/idna/__pycache__/uts46data.cpython-311.pyc differ diff --git a/requests/python/idna/codec.py b/requests/python/idna/codec.py new file mode 100644 index 0000000..1ca9ba6 --- /dev/null +++ b/requests/python/idna/codec.py @@ -0,0 +1,112 @@ +from .core import encode, decode, alabel, ulabel, IDNAError +import codecs +import re +from typing import Tuple, Optional + +_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]') + +class Codec(codecs.Codec): + + def encode(self, data: str, errors: str = 'strict') -> Tuple[bytes, int]: + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return b"", 0 + + return encode(data), len(data) + + def decode(self, data: bytes, errors: str = 'strict') -> Tuple[str, int]: + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return '', 0 + + return decode(data), len(data) + +class IncrementalEncoder(codecs.BufferedIncrementalEncoder): + def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[str, int]: # type: ignore + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return "", 0 + + labels = _unicode_dots_re.split(data) + trailing_dot = '' + if labels: + if not labels[-1]: + trailing_dot = '.' + del labels[-1] + elif not final: + # Keep potentially unfinished label until the next call + del labels[-1] + if labels: + trailing_dot = '.' + + result = [] + size = 0 + for label in labels: + result.append(alabel(label)) + if size: + size += 1 + size += len(label) + + # Join with U+002E + result_str = '.'.join(result) + trailing_dot # type: ignore + size += len(trailing_dot) + return result_str, size + +class IncrementalDecoder(codecs.BufferedIncrementalDecoder): + def _buffer_decode(self, data: str, errors: str, final: bool) -> Tuple[str, int]: # type: ignore + if errors != 'strict': + raise IDNAError('Unsupported error handling \"{}\"'.format(errors)) + + if not data: + return ('', 0) + + labels = _unicode_dots_re.split(data) + trailing_dot = '' + if labels: + if not labels[-1]: + trailing_dot = '.' + del labels[-1] + elif not final: + # Keep potentially unfinished label until the next call + del labels[-1] + if labels: + trailing_dot = '.' + + result = [] + size = 0 + for label in labels: + result.append(ulabel(label)) + if size: + size += 1 + size += len(label) + + result_str = '.'.join(result) + trailing_dot + size += len(trailing_dot) + return (result_str, size) + + +class StreamWriter(Codec, codecs.StreamWriter): + pass + + +class StreamReader(Codec, codecs.StreamReader): + pass + + +def getregentry() -> codecs.CodecInfo: + # Compatibility as a search_function for codecs.register() + return codecs.CodecInfo( + name='idna', + encode=Codec().encode, # type: ignore + decode=Codec().decode, # type: ignore + incrementalencoder=IncrementalEncoder, + incrementaldecoder=IncrementalDecoder, + streamwriter=StreamWriter, + streamreader=StreamReader, + ) diff --git a/requests/python/idna/compat.py b/requests/python/idna/compat.py new file mode 100644 index 0000000..786e6bd --- /dev/null +++ b/requests/python/idna/compat.py @@ -0,0 +1,13 @@ +from .core import * +from .codec import * +from typing import Any, Union + +def ToASCII(label: str) -> bytes: + return encode(label) + +def ToUnicode(label: Union[bytes, bytearray]) -> str: + return decode(label) + +def nameprep(s: Any) -> None: + raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol') + diff --git a/requests/python/idna/core.py b/requests/python/idna/core.py new file mode 100644 index 0000000..4f30037 --- /dev/null +++ b/requests/python/idna/core.py @@ -0,0 +1,400 @@ +from . import idnadata +import bisect +import unicodedata +import re +from typing import Union, Optional +from .intranges import intranges_contain + +_virama_combining_class = 9 +_alabel_prefix = b'xn--' +_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]') + +class IDNAError(UnicodeError): + """ Base exception for all IDNA-encoding related problems """ + pass + + +class IDNABidiError(IDNAError): + """ Exception when bidirectional requirements are not satisfied """ + pass + + +class InvalidCodepoint(IDNAError): + """ Exception when a disallowed or unallocated codepoint is used """ + pass + + +class InvalidCodepointContext(IDNAError): + """ Exception when the codepoint is not valid in the context it is used """ + pass + + +def _combining_class(cp: int) -> int: + v = unicodedata.combining(chr(cp)) + if v == 0: + if not unicodedata.name(chr(cp)): + raise ValueError('Unknown character in unicodedata') + return v + +def _is_script(cp: str, script: str) -> bool: + return intranges_contain(ord(cp), idnadata.scripts[script]) + +def _punycode(s: str) -> bytes: + return s.encode('punycode') + +def _unot(s: int) -> str: + return 'U+{:04X}'.format(s) + + +def valid_label_length(label: Union[bytes, str]) -> bool: + if len(label) > 63: + return False + return True + + +def valid_string_length(label: Union[bytes, str], trailing_dot: bool) -> bool: + if len(label) > (254 if trailing_dot else 253): + return False + return True + + +def check_bidi(label: str, check_ltr: bool = False) -> bool: + # Bidi rules should only be applied if string contains RTL characters + bidi_label = False + for (idx, cp) in enumerate(label, 1): + direction = unicodedata.bidirectional(cp) + if direction == '': + # String likely comes from a newer version of Unicode + raise IDNABidiError('Unknown directionality in label {} at position {}'.format(repr(label), idx)) + if direction in ['R', 'AL', 'AN']: + bidi_label = True + if not bidi_label and not check_ltr: + return True + + # Bidi rule 1 + direction = unicodedata.bidirectional(label[0]) + if direction in ['R', 'AL']: + rtl = True + elif direction == 'L': + rtl = False + else: + raise IDNABidiError('First codepoint in label {} must be directionality L, R or AL'.format(repr(label))) + + valid_ending = False + number_type = None # type: Optional[str] + for (idx, cp) in enumerate(label, 1): + direction = unicodedata.bidirectional(cp) + + if rtl: + # Bidi rule 2 + if not direction in ['R', 'AL', 'AN', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: + raise IDNABidiError('Invalid direction for codepoint at position {} in a right-to-left label'.format(idx)) + # Bidi rule 3 + if direction in ['R', 'AL', 'EN', 'AN']: + valid_ending = True + elif direction != 'NSM': + valid_ending = False + # Bidi rule 4 + if direction in ['AN', 'EN']: + if not number_type: + number_type = direction + else: + if number_type != direction: + raise IDNABidiError('Can not mix numeral types in a right-to-left label') + else: + # Bidi rule 5 + if not direction in ['L', 'EN', 'ES', 'CS', 'ET', 'ON', 'BN', 'NSM']: + raise IDNABidiError('Invalid direction for codepoint at position {} in a left-to-right label'.format(idx)) + # Bidi rule 6 + if direction in ['L', 'EN']: + valid_ending = True + elif direction != 'NSM': + valid_ending = False + + if not valid_ending: + raise IDNABidiError('Label ends with illegal codepoint directionality') + + return True + + +def check_initial_combiner(label: str) -> bool: + if unicodedata.category(label[0])[0] == 'M': + raise IDNAError('Label begins with an illegal combining character') + return True + + +def check_hyphen_ok(label: str) -> bool: + if label[2:4] == '--': + raise IDNAError('Label has disallowed hyphens in 3rd and 4th position') + if label[0] == '-' or label[-1] == '-': + raise IDNAError('Label must not start or end with a hyphen') + return True + + +def check_nfc(label: str) -> None: + if unicodedata.normalize('NFC', label) != label: + raise IDNAError('Label must be in Normalization Form C') + + +def valid_contextj(label: str, pos: int) -> bool: + cp_value = ord(label[pos]) + + if cp_value == 0x200c: + + if pos > 0: + if _combining_class(ord(label[pos - 1])) == _virama_combining_class: + return True + + ok = False + for i in range(pos-1, -1, -1): + joining_type = idnadata.joining_types.get(ord(label[i])) + if joining_type == ord('T'): + continue + if joining_type in [ord('L'), ord('D')]: + ok = True + break + + if not ok: + return False + + ok = False + for i in range(pos+1, len(label)): + joining_type = idnadata.joining_types.get(ord(label[i])) + if joining_type == ord('T'): + continue + if joining_type in [ord('R'), ord('D')]: + ok = True + break + return ok + + if cp_value == 0x200d: + + if pos > 0: + if _combining_class(ord(label[pos - 1])) == _virama_combining_class: + return True + return False + + else: + + return False + + +def valid_contexto(label: str, pos: int, exception: bool = False) -> bool: + cp_value = ord(label[pos]) + + if cp_value == 0x00b7: + if 0 < pos < len(label)-1: + if ord(label[pos - 1]) == 0x006c and ord(label[pos + 1]) == 0x006c: + return True + return False + + elif cp_value == 0x0375: + if pos < len(label)-1 and len(label) > 1: + return _is_script(label[pos + 1], 'Greek') + return False + + elif cp_value == 0x05f3 or cp_value == 0x05f4: + if pos > 0: + return _is_script(label[pos - 1], 'Hebrew') + return False + + elif cp_value == 0x30fb: + for cp in label: + if cp == '\u30fb': + continue + if _is_script(cp, 'Hiragana') or _is_script(cp, 'Katakana') or _is_script(cp, 'Han'): + return True + return False + + elif 0x660 <= cp_value <= 0x669: + for cp in label: + if 0x6f0 <= ord(cp) <= 0x06f9: + return False + return True + + elif 0x6f0 <= cp_value <= 0x6f9: + for cp in label: + if 0x660 <= ord(cp) <= 0x0669: + return False + return True + + return False + + +def check_label(label: Union[str, bytes, bytearray]) -> None: + if isinstance(label, (bytes, bytearray)): + label = label.decode('utf-8') + if len(label) == 0: + raise IDNAError('Empty Label') + + check_nfc(label) + check_hyphen_ok(label) + check_initial_combiner(label) + + for (pos, cp) in enumerate(label): + cp_value = ord(cp) + if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']): + continue + elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']): + try: + if not valid_contextj(label, pos): + raise InvalidCodepointContext('Joiner {} not allowed at position {} in {}'.format( + _unot(cp_value), pos+1, repr(label))) + except ValueError: + raise IDNAError('Unknown codepoint adjacent to joiner {} at position {} in {}'.format( + _unot(cp_value), pos+1, repr(label))) + elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']): + if not valid_contexto(label, pos): + raise InvalidCodepointContext('Codepoint {} not allowed at position {} in {}'.format(_unot(cp_value), pos+1, repr(label))) + else: + raise InvalidCodepoint('Codepoint {} at position {} of {} not allowed'.format(_unot(cp_value), pos+1, repr(label))) + + check_bidi(label) + + +def alabel(label: str) -> bytes: + try: + label_bytes = label.encode('ascii') + ulabel(label_bytes) + if not valid_label_length(label_bytes): + raise IDNAError('Label too long') + return label_bytes + except UnicodeEncodeError: + pass + + if not label: + raise IDNAError('No Input') + + label = str(label) + check_label(label) + label_bytes = _punycode(label) + label_bytes = _alabel_prefix + label_bytes + + if not valid_label_length(label_bytes): + raise IDNAError('Label too long') + + return label_bytes + + +def ulabel(label: Union[str, bytes, bytearray]) -> str: + if not isinstance(label, (bytes, bytearray)): + try: + label_bytes = label.encode('ascii') + except UnicodeEncodeError: + check_label(label) + return label + else: + label_bytes = label + + label_bytes = label_bytes.lower() + if label_bytes.startswith(_alabel_prefix): + label_bytes = label_bytes[len(_alabel_prefix):] + if not label_bytes: + raise IDNAError('Malformed A-label, no Punycode eligible content found') + if label_bytes.decode('ascii')[-1] == '-': + raise IDNAError('A-label must not end with a hyphen') + else: + check_label(label_bytes) + return label_bytes.decode('ascii') + + try: + label = label_bytes.decode('punycode') + except UnicodeError: + raise IDNAError('Invalid A-label') + check_label(label) + return label + + +def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False) -> str: + """Re-map the characters in the string according to UTS46 processing.""" + from .uts46data import uts46data + output = '' + + for pos, char in enumerate(domain): + code_point = ord(char) + try: + uts46row = uts46data[code_point if code_point < 256 else + bisect.bisect_left(uts46data, (code_point, 'Z')) - 1] + status = uts46row[1] + replacement = None # type: Optional[str] + if len(uts46row) == 3: + replacement = uts46row[2] # type: ignore + if (status == 'V' or + (status == 'D' and not transitional) or + (status == '3' and not std3_rules and replacement is None)): + output += char + elif replacement is not None and (status == 'M' or + (status == '3' and not std3_rules) or + (status == 'D' and transitional)): + output += replacement + elif status != 'I': + raise IndexError() + except IndexError: + raise InvalidCodepoint( + 'Codepoint {} not allowed at position {} in {}'.format( + _unot(code_point), pos + 1, repr(domain))) + + return unicodedata.normalize('NFC', output) + + +def encode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False, transitional: bool = False) -> bytes: + if isinstance(s, (bytes, bytearray)): + try: + s = s.decode('ascii') + except UnicodeDecodeError: + raise IDNAError('should pass a unicode string to the function rather than a byte string.') + if uts46: + s = uts46_remap(s, std3_rules, transitional) + trailing_dot = False + result = [] + if strict: + labels = s.split('.') + else: + labels = _unicode_dots_re.split(s) + if not labels or labels == ['']: + raise IDNAError('Empty domain') + if labels[-1] == '': + del labels[-1] + trailing_dot = True + for label in labels: + s = alabel(label) + if s: + result.append(s) + else: + raise IDNAError('Empty label') + if trailing_dot: + result.append(b'') + s = b'.'.join(result) + if not valid_string_length(s, trailing_dot): + raise IDNAError('Domain too long') + return s + + +def decode(s: Union[str, bytes, bytearray], strict: bool = False, uts46: bool = False, std3_rules: bool = False) -> str: + try: + if isinstance(s, (bytes, bytearray)): + s = s.decode('ascii') + except UnicodeDecodeError: + raise IDNAError('Invalid ASCII in A-label') + if uts46: + s = uts46_remap(s, std3_rules, False) + trailing_dot = False + result = [] + if not strict: + labels = _unicode_dots_re.split(s) + else: + labels = s.split('.') + if not labels or labels == ['']: + raise IDNAError('Empty domain') + if not labels[-1]: + del labels[-1] + trailing_dot = True + for label in labels: + s = ulabel(label) + if s: + result.append(s) + else: + raise IDNAError('Empty label') + if trailing_dot: + result.append('') + return '.'.join(result) diff --git a/requests/python/idna/idnadata.py b/requests/python/idna/idnadata.py new file mode 100644 index 0000000..67db462 --- /dev/null +++ b/requests/python/idna/idnadata.py @@ -0,0 +1,2151 @@ +# This file is automatically generated by tools/idna-data + +__version__ = '15.0.0' +scripts = { + 'Greek': ( + 0x37000000374, + 0x37500000378, + 0x37a0000037e, + 0x37f00000380, + 0x38400000385, + 0x38600000387, + 0x3880000038b, + 0x38c0000038d, + 0x38e000003a2, + 0x3a3000003e2, + 0x3f000000400, + 0x1d2600001d2b, + 0x1d5d00001d62, + 0x1d6600001d6b, + 0x1dbf00001dc0, + 0x1f0000001f16, + 0x1f1800001f1e, + 0x1f2000001f46, + 0x1f4800001f4e, + 0x1f5000001f58, + 0x1f5900001f5a, + 0x1f5b00001f5c, + 0x1f5d00001f5e, + 0x1f5f00001f7e, + 0x1f8000001fb5, + 0x1fb600001fc5, + 0x1fc600001fd4, + 0x1fd600001fdc, + 0x1fdd00001ff0, + 0x1ff200001ff5, + 0x1ff600001fff, + 0x212600002127, + 0xab650000ab66, + 0x101400001018f, + 0x101a0000101a1, + 0x1d2000001d246, + ), + 'Han': ( + 0x2e8000002e9a, + 0x2e9b00002ef4, + 0x2f0000002fd6, + 0x300500003006, + 0x300700003008, + 0x30210000302a, + 0x30380000303c, + 0x340000004dc0, + 0x4e000000a000, + 0xf9000000fa6e, + 0xfa700000fada, + 0x16fe200016fe4, + 0x16ff000016ff2, + 0x200000002a6e0, + 0x2a7000002b73a, + 0x2b7400002b81e, + 0x2b8200002cea2, + 0x2ceb00002ebe1, + 0x2f8000002fa1e, + 0x300000003134b, + 0x31350000323b0, + ), + 'Hebrew': ( + 0x591000005c8, + 0x5d0000005eb, + 0x5ef000005f5, + 0xfb1d0000fb37, + 0xfb380000fb3d, + 0xfb3e0000fb3f, + 0xfb400000fb42, + 0xfb430000fb45, + 0xfb460000fb50, + ), + 'Hiragana': ( + 0x304100003097, + 0x309d000030a0, + 0x1b0010001b120, + 0x1b1320001b133, + 0x1b1500001b153, + 0x1f2000001f201, + ), + 'Katakana': ( + 0x30a1000030fb, + 0x30fd00003100, + 0x31f000003200, + 0x32d0000032ff, + 0x330000003358, + 0xff660000ff70, + 0xff710000ff9e, + 0x1aff00001aff4, + 0x1aff50001affc, + 0x1affd0001afff, + 0x1b0000001b001, + 0x1b1200001b123, + 0x1b1550001b156, + 0x1b1640001b168, + ), +} +joining_types = { + 0x600: 85, + 0x601: 85, + 0x602: 85, + 0x603: 85, + 0x604: 85, + 0x605: 85, + 0x608: 85, + 0x60b: 85, + 0x620: 68, + 0x621: 85, + 0x622: 82, + 0x623: 82, + 0x624: 82, + 0x625: 82, + 0x626: 68, + 0x627: 82, + 0x628: 68, + 0x629: 82, + 0x62a: 68, + 0x62b: 68, + 0x62c: 68, + 0x62d: 68, + 0x62e: 68, + 0x62f: 82, + 0x630: 82, + 0x631: 82, + 0x632: 82, + 0x633: 68, + 0x634: 68, + 0x635: 68, + 0x636: 68, + 0x637: 68, + 0x638: 68, + 0x639: 68, + 0x63a: 68, + 0x63b: 68, + 0x63c: 68, + 0x63d: 68, + 0x63e: 68, + 0x63f: 68, + 0x640: 67, + 0x641: 68, + 0x642: 68, + 0x643: 68, + 0x644: 68, + 0x645: 68, + 0x646: 68, + 0x647: 68, + 0x648: 82, + 0x649: 68, + 0x64a: 68, + 0x66e: 68, + 0x66f: 68, + 0x671: 82, + 0x672: 82, + 0x673: 82, + 0x674: 85, + 0x675: 82, + 0x676: 82, + 0x677: 82, + 0x678: 68, + 0x679: 68, + 0x67a: 68, + 0x67b: 68, + 0x67c: 68, + 0x67d: 68, + 0x67e: 68, + 0x67f: 68, + 0x680: 68, + 0x681: 68, + 0x682: 68, + 0x683: 68, + 0x684: 68, + 0x685: 68, + 0x686: 68, + 0x687: 68, + 0x688: 82, + 0x689: 82, + 0x68a: 82, + 0x68b: 82, + 0x68c: 82, + 0x68d: 82, + 0x68e: 82, + 0x68f: 82, + 0x690: 82, + 0x691: 82, + 0x692: 82, + 0x693: 82, + 0x694: 82, + 0x695: 82, + 0x696: 82, + 0x697: 82, + 0x698: 82, + 0x699: 82, + 0x69a: 68, + 0x69b: 68, + 0x69c: 68, + 0x69d: 68, + 0x69e: 68, + 0x69f: 68, + 0x6a0: 68, + 0x6a1: 68, + 0x6a2: 68, + 0x6a3: 68, + 0x6a4: 68, + 0x6a5: 68, + 0x6a6: 68, + 0x6a7: 68, + 0x6a8: 68, + 0x6a9: 68, + 0x6aa: 68, + 0x6ab: 68, + 0x6ac: 68, + 0x6ad: 68, + 0x6ae: 68, + 0x6af: 68, + 0x6b0: 68, + 0x6b1: 68, + 0x6b2: 68, + 0x6b3: 68, + 0x6b4: 68, + 0x6b5: 68, + 0x6b6: 68, + 0x6b7: 68, + 0x6b8: 68, + 0x6b9: 68, + 0x6ba: 68, + 0x6bb: 68, + 0x6bc: 68, + 0x6bd: 68, + 0x6be: 68, + 0x6bf: 68, + 0x6c0: 82, + 0x6c1: 68, + 0x6c2: 68, + 0x6c3: 82, + 0x6c4: 82, + 0x6c5: 82, + 0x6c6: 82, + 0x6c7: 82, + 0x6c8: 82, + 0x6c9: 82, + 0x6ca: 82, + 0x6cb: 82, + 0x6cc: 68, + 0x6cd: 82, + 0x6ce: 68, + 0x6cf: 82, + 0x6d0: 68, + 0x6d1: 68, + 0x6d2: 82, + 0x6d3: 82, + 0x6d5: 82, + 0x6dd: 85, + 0x6ee: 82, + 0x6ef: 82, + 0x6fa: 68, + 0x6fb: 68, + 0x6fc: 68, + 0x6ff: 68, + 0x70f: 84, + 0x710: 82, + 0x712: 68, + 0x713: 68, + 0x714: 68, + 0x715: 82, + 0x716: 82, + 0x717: 82, + 0x718: 82, + 0x719: 82, + 0x71a: 68, + 0x71b: 68, + 0x71c: 68, + 0x71d: 68, + 0x71e: 82, + 0x71f: 68, + 0x720: 68, + 0x721: 68, + 0x722: 68, + 0x723: 68, + 0x724: 68, + 0x725: 68, + 0x726: 68, + 0x727: 68, + 0x728: 82, + 0x729: 68, + 0x72a: 82, + 0x72b: 68, + 0x72c: 82, + 0x72d: 68, + 0x72e: 68, + 0x72f: 82, + 0x74d: 82, + 0x74e: 68, + 0x74f: 68, + 0x750: 68, + 0x751: 68, + 0x752: 68, + 0x753: 68, + 0x754: 68, + 0x755: 68, + 0x756: 68, + 0x757: 68, + 0x758: 68, + 0x759: 82, + 0x75a: 82, + 0x75b: 82, + 0x75c: 68, + 0x75d: 68, + 0x75e: 68, + 0x75f: 68, + 0x760: 68, + 0x761: 68, + 0x762: 68, + 0x763: 68, + 0x764: 68, + 0x765: 68, + 0x766: 68, + 0x767: 68, + 0x768: 68, + 0x769: 68, + 0x76a: 68, + 0x76b: 82, + 0x76c: 82, + 0x76d: 68, + 0x76e: 68, + 0x76f: 68, + 0x770: 68, + 0x771: 82, + 0x772: 68, + 0x773: 82, + 0x774: 82, + 0x775: 68, + 0x776: 68, + 0x777: 68, + 0x778: 82, + 0x779: 82, + 0x77a: 68, + 0x77b: 68, + 0x77c: 68, + 0x77d: 68, + 0x77e: 68, + 0x77f: 68, + 0x7ca: 68, + 0x7cb: 68, + 0x7cc: 68, + 0x7cd: 68, + 0x7ce: 68, + 0x7cf: 68, + 0x7d0: 68, + 0x7d1: 68, + 0x7d2: 68, + 0x7d3: 68, + 0x7d4: 68, + 0x7d5: 68, + 0x7d6: 68, + 0x7d7: 68, + 0x7d8: 68, + 0x7d9: 68, + 0x7da: 68, + 0x7db: 68, + 0x7dc: 68, + 0x7dd: 68, + 0x7de: 68, + 0x7df: 68, + 0x7e0: 68, + 0x7e1: 68, + 0x7e2: 68, + 0x7e3: 68, + 0x7e4: 68, + 0x7e5: 68, + 0x7e6: 68, + 0x7e7: 68, + 0x7e8: 68, + 0x7e9: 68, + 0x7ea: 68, + 0x7fa: 67, + 0x840: 82, + 0x841: 68, + 0x842: 68, + 0x843: 68, + 0x844: 68, + 0x845: 68, + 0x846: 82, + 0x847: 82, + 0x848: 68, + 0x849: 82, + 0x84a: 68, + 0x84b: 68, + 0x84c: 68, + 0x84d: 68, + 0x84e: 68, + 0x84f: 68, + 0x850: 68, + 0x851: 68, + 0x852: 68, + 0x853: 68, + 0x854: 82, + 0x855: 68, + 0x856: 82, + 0x857: 82, + 0x858: 82, + 0x860: 68, + 0x861: 85, + 0x862: 68, + 0x863: 68, + 0x864: 68, + 0x865: 68, + 0x866: 85, + 0x867: 82, + 0x868: 68, + 0x869: 82, + 0x86a: 82, + 0x870: 82, + 0x871: 82, + 0x872: 82, + 0x873: 82, + 0x874: 82, + 0x875: 82, + 0x876: 82, + 0x877: 82, + 0x878: 82, + 0x879: 82, + 0x87a: 82, + 0x87b: 82, + 0x87c: 82, + 0x87d: 82, + 0x87e: 82, + 0x87f: 82, + 0x880: 82, + 0x881: 82, + 0x882: 82, + 0x883: 67, + 0x884: 67, + 0x885: 67, + 0x886: 68, + 0x887: 85, + 0x888: 85, + 0x889: 68, + 0x88a: 68, + 0x88b: 68, + 0x88c: 68, + 0x88d: 68, + 0x88e: 82, + 0x890: 85, + 0x891: 85, + 0x8a0: 68, + 0x8a1: 68, + 0x8a2: 68, + 0x8a3: 68, + 0x8a4: 68, + 0x8a5: 68, + 0x8a6: 68, + 0x8a7: 68, + 0x8a8: 68, + 0x8a9: 68, + 0x8aa: 82, + 0x8ab: 82, + 0x8ac: 82, + 0x8ad: 85, + 0x8ae: 82, + 0x8af: 68, + 0x8b0: 68, + 0x8b1: 82, + 0x8b2: 82, + 0x8b3: 68, + 0x8b4: 68, + 0x8b5: 68, + 0x8b6: 68, + 0x8b7: 68, + 0x8b8: 68, + 0x8b9: 82, + 0x8ba: 68, + 0x8bb: 68, + 0x8bc: 68, + 0x8bd: 68, + 0x8be: 68, + 0x8bf: 68, + 0x8c0: 68, + 0x8c1: 68, + 0x8c2: 68, + 0x8c3: 68, + 0x8c4: 68, + 0x8c5: 68, + 0x8c6: 68, + 0x8c7: 68, + 0x8c8: 68, + 0x8e2: 85, + 0x1806: 85, + 0x1807: 68, + 0x180a: 67, + 0x180e: 85, + 0x1820: 68, + 0x1821: 68, + 0x1822: 68, + 0x1823: 68, + 0x1824: 68, + 0x1825: 68, + 0x1826: 68, + 0x1827: 68, + 0x1828: 68, + 0x1829: 68, + 0x182a: 68, + 0x182b: 68, + 0x182c: 68, + 0x182d: 68, + 0x182e: 68, + 0x182f: 68, + 0x1830: 68, + 0x1831: 68, + 0x1832: 68, + 0x1833: 68, + 0x1834: 68, + 0x1835: 68, + 0x1836: 68, + 0x1837: 68, + 0x1838: 68, + 0x1839: 68, + 0x183a: 68, + 0x183b: 68, + 0x183c: 68, + 0x183d: 68, + 0x183e: 68, + 0x183f: 68, + 0x1840: 68, + 0x1841: 68, + 0x1842: 68, + 0x1843: 68, + 0x1844: 68, + 0x1845: 68, + 0x1846: 68, + 0x1847: 68, + 0x1848: 68, + 0x1849: 68, + 0x184a: 68, + 0x184b: 68, + 0x184c: 68, + 0x184d: 68, + 0x184e: 68, + 0x184f: 68, + 0x1850: 68, + 0x1851: 68, + 0x1852: 68, + 0x1853: 68, + 0x1854: 68, + 0x1855: 68, + 0x1856: 68, + 0x1857: 68, + 0x1858: 68, + 0x1859: 68, + 0x185a: 68, + 0x185b: 68, + 0x185c: 68, + 0x185d: 68, + 0x185e: 68, + 0x185f: 68, + 0x1860: 68, + 0x1861: 68, + 0x1862: 68, + 0x1863: 68, + 0x1864: 68, + 0x1865: 68, + 0x1866: 68, + 0x1867: 68, + 0x1868: 68, + 0x1869: 68, + 0x186a: 68, + 0x186b: 68, + 0x186c: 68, + 0x186d: 68, + 0x186e: 68, + 0x186f: 68, + 0x1870: 68, + 0x1871: 68, + 0x1872: 68, + 0x1873: 68, + 0x1874: 68, + 0x1875: 68, + 0x1876: 68, + 0x1877: 68, + 0x1878: 68, + 0x1880: 85, + 0x1881: 85, + 0x1882: 85, + 0x1883: 85, + 0x1884: 85, + 0x1885: 84, + 0x1886: 84, + 0x1887: 68, + 0x1888: 68, + 0x1889: 68, + 0x188a: 68, + 0x188b: 68, + 0x188c: 68, + 0x188d: 68, + 0x188e: 68, + 0x188f: 68, + 0x1890: 68, + 0x1891: 68, + 0x1892: 68, + 0x1893: 68, + 0x1894: 68, + 0x1895: 68, + 0x1896: 68, + 0x1897: 68, + 0x1898: 68, + 0x1899: 68, + 0x189a: 68, + 0x189b: 68, + 0x189c: 68, + 0x189d: 68, + 0x189e: 68, + 0x189f: 68, + 0x18a0: 68, + 0x18a1: 68, + 0x18a2: 68, + 0x18a3: 68, + 0x18a4: 68, + 0x18a5: 68, + 0x18a6: 68, + 0x18a7: 68, + 0x18a8: 68, + 0x18aa: 68, + 0x200c: 85, + 0x200d: 67, + 0x202f: 85, + 0x2066: 85, + 0x2067: 85, + 0x2068: 85, + 0x2069: 85, + 0xa840: 68, + 0xa841: 68, + 0xa842: 68, + 0xa843: 68, + 0xa844: 68, + 0xa845: 68, + 0xa846: 68, + 0xa847: 68, + 0xa848: 68, + 0xa849: 68, + 0xa84a: 68, + 0xa84b: 68, + 0xa84c: 68, + 0xa84d: 68, + 0xa84e: 68, + 0xa84f: 68, + 0xa850: 68, + 0xa851: 68, + 0xa852: 68, + 0xa853: 68, + 0xa854: 68, + 0xa855: 68, + 0xa856: 68, + 0xa857: 68, + 0xa858: 68, + 0xa859: 68, + 0xa85a: 68, + 0xa85b: 68, + 0xa85c: 68, + 0xa85d: 68, + 0xa85e: 68, + 0xa85f: 68, + 0xa860: 68, + 0xa861: 68, + 0xa862: 68, + 0xa863: 68, + 0xa864: 68, + 0xa865: 68, + 0xa866: 68, + 0xa867: 68, + 0xa868: 68, + 0xa869: 68, + 0xa86a: 68, + 0xa86b: 68, + 0xa86c: 68, + 0xa86d: 68, + 0xa86e: 68, + 0xa86f: 68, + 0xa870: 68, + 0xa871: 68, + 0xa872: 76, + 0xa873: 85, + 0x10ac0: 68, + 0x10ac1: 68, + 0x10ac2: 68, + 0x10ac3: 68, + 0x10ac4: 68, + 0x10ac5: 82, + 0x10ac6: 85, + 0x10ac7: 82, + 0x10ac8: 85, + 0x10ac9: 82, + 0x10aca: 82, + 0x10acb: 85, + 0x10acc: 85, + 0x10acd: 76, + 0x10ace: 82, + 0x10acf: 82, + 0x10ad0: 82, + 0x10ad1: 82, + 0x10ad2: 82, + 0x10ad3: 68, + 0x10ad4: 68, + 0x10ad5: 68, + 0x10ad6: 68, + 0x10ad7: 76, + 0x10ad8: 68, + 0x10ad9: 68, + 0x10ada: 68, + 0x10adb: 68, + 0x10adc: 68, + 0x10add: 82, + 0x10ade: 68, + 0x10adf: 68, + 0x10ae0: 68, + 0x10ae1: 82, + 0x10ae2: 85, + 0x10ae3: 85, + 0x10ae4: 82, + 0x10aeb: 68, + 0x10aec: 68, + 0x10aed: 68, + 0x10aee: 68, + 0x10aef: 82, + 0x10b80: 68, + 0x10b81: 82, + 0x10b82: 68, + 0x10b83: 82, + 0x10b84: 82, + 0x10b85: 82, + 0x10b86: 68, + 0x10b87: 68, + 0x10b88: 68, + 0x10b89: 82, + 0x10b8a: 68, + 0x10b8b: 68, + 0x10b8c: 82, + 0x10b8d: 68, + 0x10b8e: 82, + 0x10b8f: 82, + 0x10b90: 68, + 0x10b91: 82, + 0x10ba9: 82, + 0x10baa: 82, + 0x10bab: 82, + 0x10bac: 82, + 0x10bad: 68, + 0x10bae: 68, + 0x10baf: 85, + 0x10d00: 76, + 0x10d01: 68, + 0x10d02: 68, + 0x10d03: 68, + 0x10d04: 68, + 0x10d05: 68, + 0x10d06: 68, + 0x10d07: 68, + 0x10d08: 68, + 0x10d09: 68, + 0x10d0a: 68, + 0x10d0b: 68, + 0x10d0c: 68, + 0x10d0d: 68, + 0x10d0e: 68, + 0x10d0f: 68, + 0x10d10: 68, + 0x10d11: 68, + 0x10d12: 68, + 0x10d13: 68, + 0x10d14: 68, + 0x10d15: 68, + 0x10d16: 68, + 0x10d17: 68, + 0x10d18: 68, + 0x10d19: 68, + 0x10d1a: 68, + 0x10d1b: 68, + 0x10d1c: 68, + 0x10d1d: 68, + 0x10d1e: 68, + 0x10d1f: 68, + 0x10d20: 68, + 0x10d21: 68, + 0x10d22: 82, + 0x10d23: 68, + 0x10f30: 68, + 0x10f31: 68, + 0x10f32: 68, + 0x10f33: 82, + 0x10f34: 68, + 0x10f35: 68, + 0x10f36: 68, + 0x10f37: 68, + 0x10f38: 68, + 0x10f39: 68, + 0x10f3a: 68, + 0x10f3b: 68, + 0x10f3c: 68, + 0x10f3d: 68, + 0x10f3e: 68, + 0x10f3f: 68, + 0x10f40: 68, + 0x10f41: 68, + 0x10f42: 68, + 0x10f43: 68, + 0x10f44: 68, + 0x10f45: 85, + 0x10f51: 68, + 0x10f52: 68, + 0x10f53: 68, + 0x10f54: 82, + 0x10f70: 68, + 0x10f71: 68, + 0x10f72: 68, + 0x10f73: 68, + 0x10f74: 82, + 0x10f75: 82, + 0x10f76: 68, + 0x10f77: 68, + 0x10f78: 68, + 0x10f79: 68, + 0x10f7a: 68, + 0x10f7b: 68, + 0x10f7c: 68, + 0x10f7d: 68, + 0x10f7e: 68, + 0x10f7f: 68, + 0x10f80: 68, + 0x10f81: 68, + 0x10fb0: 68, + 0x10fb1: 85, + 0x10fb2: 68, + 0x10fb3: 68, + 0x10fb4: 82, + 0x10fb5: 82, + 0x10fb6: 82, + 0x10fb7: 85, + 0x10fb8: 68, + 0x10fb9: 82, + 0x10fba: 82, + 0x10fbb: 68, + 0x10fbc: 68, + 0x10fbd: 82, + 0x10fbe: 68, + 0x10fbf: 68, + 0x10fc0: 85, + 0x10fc1: 68, + 0x10fc2: 82, + 0x10fc3: 82, + 0x10fc4: 68, + 0x10fc5: 85, + 0x10fc6: 85, + 0x10fc7: 85, + 0x10fc8: 85, + 0x10fc9: 82, + 0x10fca: 68, + 0x10fcb: 76, + 0x110bd: 85, + 0x110cd: 85, + 0x1e900: 68, + 0x1e901: 68, + 0x1e902: 68, + 0x1e903: 68, + 0x1e904: 68, + 0x1e905: 68, + 0x1e906: 68, + 0x1e907: 68, + 0x1e908: 68, + 0x1e909: 68, + 0x1e90a: 68, + 0x1e90b: 68, + 0x1e90c: 68, + 0x1e90d: 68, + 0x1e90e: 68, + 0x1e90f: 68, + 0x1e910: 68, + 0x1e911: 68, + 0x1e912: 68, + 0x1e913: 68, + 0x1e914: 68, + 0x1e915: 68, + 0x1e916: 68, + 0x1e917: 68, + 0x1e918: 68, + 0x1e919: 68, + 0x1e91a: 68, + 0x1e91b: 68, + 0x1e91c: 68, + 0x1e91d: 68, + 0x1e91e: 68, + 0x1e91f: 68, + 0x1e920: 68, + 0x1e921: 68, + 0x1e922: 68, + 0x1e923: 68, + 0x1e924: 68, + 0x1e925: 68, + 0x1e926: 68, + 0x1e927: 68, + 0x1e928: 68, + 0x1e929: 68, + 0x1e92a: 68, + 0x1e92b: 68, + 0x1e92c: 68, + 0x1e92d: 68, + 0x1e92e: 68, + 0x1e92f: 68, + 0x1e930: 68, + 0x1e931: 68, + 0x1e932: 68, + 0x1e933: 68, + 0x1e934: 68, + 0x1e935: 68, + 0x1e936: 68, + 0x1e937: 68, + 0x1e938: 68, + 0x1e939: 68, + 0x1e93a: 68, + 0x1e93b: 68, + 0x1e93c: 68, + 0x1e93d: 68, + 0x1e93e: 68, + 0x1e93f: 68, + 0x1e940: 68, + 0x1e941: 68, + 0x1e942: 68, + 0x1e943: 68, + 0x1e94b: 84, +} +codepoint_classes = { + 'PVALID': ( + 0x2d0000002e, + 0x300000003a, + 0x610000007b, + 0xdf000000f7, + 0xf800000100, + 0x10100000102, + 0x10300000104, + 0x10500000106, + 0x10700000108, + 0x1090000010a, + 0x10b0000010c, + 0x10d0000010e, + 0x10f00000110, + 0x11100000112, + 0x11300000114, + 0x11500000116, + 0x11700000118, + 0x1190000011a, + 0x11b0000011c, + 0x11d0000011e, + 0x11f00000120, + 0x12100000122, + 0x12300000124, + 0x12500000126, + 0x12700000128, + 0x1290000012a, + 0x12b0000012c, + 0x12d0000012e, + 0x12f00000130, + 0x13100000132, + 0x13500000136, + 0x13700000139, + 0x13a0000013b, + 0x13c0000013d, + 0x13e0000013f, + 0x14200000143, + 0x14400000145, + 0x14600000147, + 0x14800000149, + 0x14b0000014c, + 0x14d0000014e, + 0x14f00000150, + 0x15100000152, + 0x15300000154, + 0x15500000156, + 0x15700000158, + 0x1590000015a, + 0x15b0000015c, + 0x15d0000015e, + 0x15f00000160, + 0x16100000162, + 0x16300000164, + 0x16500000166, + 0x16700000168, + 0x1690000016a, + 0x16b0000016c, + 0x16d0000016e, + 0x16f00000170, + 0x17100000172, + 0x17300000174, + 0x17500000176, + 0x17700000178, + 0x17a0000017b, + 0x17c0000017d, + 0x17e0000017f, + 0x18000000181, + 0x18300000184, + 0x18500000186, + 0x18800000189, + 0x18c0000018e, + 0x19200000193, + 0x19500000196, + 0x1990000019c, + 0x19e0000019f, + 0x1a1000001a2, + 0x1a3000001a4, + 0x1a5000001a6, + 0x1a8000001a9, + 0x1aa000001ac, + 0x1ad000001ae, + 0x1b0000001b1, + 0x1b4000001b5, + 0x1b6000001b7, + 0x1b9000001bc, + 0x1bd000001c4, + 0x1ce000001cf, + 0x1d0000001d1, + 0x1d2000001d3, + 0x1d4000001d5, + 0x1d6000001d7, + 0x1d8000001d9, + 0x1da000001db, + 0x1dc000001de, + 0x1df000001e0, + 0x1e1000001e2, + 0x1e3000001e4, + 0x1e5000001e6, + 0x1e7000001e8, + 0x1e9000001ea, + 0x1eb000001ec, + 0x1ed000001ee, + 0x1ef000001f1, + 0x1f5000001f6, + 0x1f9000001fa, + 0x1fb000001fc, + 0x1fd000001fe, + 0x1ff00000200, + 0x20100000202, + 0x20300000204, + 0x20500000206, + 0x20700000208, + 0x2090000020a, + 0x20b0000020c, + 0x20d0000020e, + 0x20f00000210, + 0x21100000212, + 0x21300000214, + 0x21500000216, + 0x21700000218, + 0x2190000021a, + 0x21b0000021c, + 0x21d0000021e, + 0x21f00000220, + 0x22100000222, + 0x22300000224, + 0x22500000226, + 0x22700000228, + 0x2290000022a, + 0x22b0000022c, + 0x22d0000022e, + 0x22f00000230, + 0x23100000232, + 0x2330000023a, + 0x23c0000023d, + 0x23f00000241, + 0x24200000243, + 0x24700000248, + 0x2490000024a, + 0x24b0000024c, + 0x24d0000024e, + 0x24f000002b0, + 0x2b9000002c2, + 0x2c6000002d2, + 0x2ec000002ed, + 0x2ee000002ef, + 0x30000000340, + 0x34200000343, + 0x3460000034f, + 0x35000000370, + 0x37100000372, + 0x37300000374, + 0x37700000378, + 0x37b0000037e, + 0x39000000391, + 0x3ac000003cf, + 0x3d7000003d8, + 0x3d9000003da, + 0x3db000003dc, + 0x3dd000003de, + 0x3df000003e0, + 0x3e1000003e2, + 0x3e3000003e4, + 0x3e5000003e6, + 0x3e7000003e8, + 0x3e9000003ea, + 0x3eb000003ec, + 0x3ed000003ee, + 0x3ef000003f0, + 0x3f3000003f4, + 0x3f8000003f9, + 0x3fb000003fd, + 0x43000000460, + 0x46100000462, + 0x46300000464, + 0x46500000466, + 0x46700000468, + 0x4690000046a, + 0x46b0000046c, + 0x46d0000046e, + 0x46f00000470, + 0x47100000472, + 0x47300000474, + 0x47500000476, + 0x47700000478, + 0x4790000047a, + 0x47b0000047c, + 0x47d0000047e, + 0x47f00000480, + 0x48100000482, + 0x48300000488, + 0x48b0000048c, + 0x48d0000048e, + 0x48f00000490, + 0x49100000492, + 0x49300000494, + 0x49500000496, + 0x49700000498, + 0x4990000049a, + 0x49b0000049c, + 0x49d0000049e, + 0x49f000004a0, + 0x4a1000004a2, + 0x4a3000004a4, + 0x4a5000004a6, + 0x4a7000004a8, + 0x4a9000004aa, + 0x4ab000004ac, + 0x4ad000004ae, + 0x4af000004b0, + 0x4b1000004b2, + 0x4b3000004b4, + 0x4b5000004b6, + 0x4b7000004b8, + 0x4b9000004ba, + 0x4bb000004bc, + 0x4bd000004be, + 0x4bf000004c0, + 0x4c2000004c3, + 0x4c4000004c5, + 0x4c6000004c7, + 0x4c8000004c9, + 0x4ca000004cb, + 0x4cc000004cd, + 0x4ce000004d0, + 0x4d1000004d2, + 0x4d3000004d4, + 0x4d5000004d6, + 0x4d7000004d8, + 0x4d9000004da, + 0x4db000004dc, + 0x4dd000004de, + 0x4df000004e0, + 0x4e1000004e2, + 0x4e3000004e4, + 0x4e5000004e6, + 0x4e7000004e8, + 0x4e9000004ea, + 0x4eb000004ec, + 0x4ed000004ee, + 0x4ef000004f0, + 0x4f1000004f2, + 0x4f3000004f4, + 0x4f5000004f6, + 0x4f7000004f8, + 0x4f9000004fa, + 0x4fb000004fc, + 0x4fd000004fe, + 0x4ff00000500, + 0x50100000502, + 0x50300000504, + 0x50500000506, + 0x50700000508, + 0x5090000050a, + 0x50b0000050c, + 0x50d0000050e, + 0x50f00000510, + 0x51100000512, + 0x51300000514, + 0x51500000516, + 0x51700000518, + 0x5190000051a, + 0x51b0000051c, + 0x51d0000051e, + 0x51f00000520, + 0x52100000522, + 0x52300000524, + 0x52500000526, + 0x52700000528, + 0x5290000052a, + 0x52b0000052c, + 0x52d0000052e, + 0x52f00000530, + 0x5590000055a, + 0x56000000587, + 0x58800000589, + 0x591000005be, + 0x5bf000005c0, + 0x5c1000005c3, + 0x5c4000005c6, + 0x5c7000005c8, + 0x5d0000005eb, + 0x5ef000005f3, + 0x6100000061b, + 0x62000000640, + 0x64100000660, + 0x66e00000675, + 0x679000006d4, + 0x6d5000006dd, + 0x6df000006e9, + 0x6ea000006f0, + 0x6fa00000700, + 0x7100000074b, + 0x74d000007b2, + 0x7c0000007f6, + 0x7fd000007fe, + 0x8000000082e, + 0x8400000085c, + 0x8600000086b, + 0x87000000888, + 0x8890000088f, + 0x898000008e2, + 0x8e300000958, + 0x96000000964, + 0x96600000970, + 0x97100000984, + 0x9850000098d, + 0x98f00000991, + 0x993000009a9, + 0x9aa000009b1, + 0x9b2000009b3, + 0x9b6000009ba, + 0x9bc000009c5, + 0x9c7000009c9, + 0x9cb000009cf, + 0x9d7000009d8, + 0x9e0000009e4, + 0x9e6000009f2, + 0x9fc000009fd, + 0x9fe000009ff, + 0xa0100000a04, + 0xa0500000a0b, + 0xa0f00000a11, + 0xa1300000a29, + 0xa2a00000a31, + 0xa3200000a33, + 0xa3500000a36, + 0xa3800000a3a, + 0xa3c00000a3d, + 0xa3e00000a43, + 0xa4700000a49, + 0xa4b00000a4e, + 0xa5100000a52, + 0xa5c00000a5d, + 0xa6600000a76, + 0xa8100000a84, + 0xa8500000a8e, + 0xa8f00000a92, + 0xa9300000aa9, + 0xaaa00000ab1, + 0xab200000ab4, + 0xab500000aba, + 0xabc00000ac6, + 0xac700000aca, + 0xacb00000ace, + 0xad000000ad1, + 0xae000000ae4, + 0xae600000af0, + 0xaf900000b00, + 0xb0100000b04, + 0xb0500000b0d, + 0xb0f00000b11, + 0xb1300000b29, + 0xb2a00000b31, + 0xb3200000b34, + 0xb3500000b3a, + 0xb3c00000b45, + 0xb4700000b49, + 0xb4b00000b4e, + 0xb5500000b58, + 0xb5f00000b64, + 0xb6600000b70, + 0xb7100000b72, + 0xb8200000b84, + 0xb8500000b8b, + 0xb8e00000b91, + 0xb9200000b96, + 0xb9900000b9b, + 0xb9c00000b9d, + 0xb9e00000ba0, + 0xba300000ba5, + 0xba800000bab, + 0xbae00000bba, + 0xbbe00000bc3, + 0xbc600000bc9, + 0xbca00000bce, + 0xbd000000bd1, + 0xbd700000bd8, + 0xbe600000bf0, + 0xc0000000c0d, + 0xc0e00000c11, + 0xc1200000c29, + 0xc2a00000c3a, + 0xc3c00000c45, + 0xc4600000c49, + 0xc4a00000c4e, + 0xc5500000c57, + 0xc5800000c5b, + 0xc5d00000c5e, + 0xc6000000c64, + 0xc6600000c70, + 0xc8000000c84, + 0xc8500000c8d, + 0xc8e00000c91, + 0xc9200000ca9, + 0xcaa00000cb4, + 0xcb500000cba, + 0xcbc00000cc5, + 0xcc600000cc9, + 0xcca00000cce, + 0xcd500000cd7, + 0xcdd00000cdf, + 0xce000000ce4, + 0xce600000cf0, + 0xcf100000cf4, + 0xd0000000d0d, + 0xd0e00000d11, + 0xd1200000d45, + 0xd4600000d49, + 0xd4a00000d4f, + 0xd5400000d58, + 0xd5f00000d64, + 0xd6600000d70, + 0xd7a00000d80, + 0xd8100000d84, + 0xd8500000d97, + 0xd9a00000db2, + 0xdb300000dbc, + 0xdbd00000dbe, + 0xdc000000dc7, + 0xdca00000dcb, + 0xdcf00000dd5, + 0xdd600000dd7, + 0xdd800000de0, + 0xde600000df0, + 0xdf200000df4, + 0xe0100000e33, + 0xe3400000e3b, + 0xe4000000e4f, + 0xe5000000e5a, + 0xe8100000e83, + 0xe8400000e85, + 0xe8600000e8b, + 0xe8c00000ea4, + 0xea500000ea6, + 0xea700000eb3, + 0xeb400000ebe, + 0xec000000ec5, + 0xec600000ec7, + 0xec800000ecf, + 0xed000000eda, + 0xede00000ee0, + 0xf0000000f01, + 0xf0b00000f0c, + 0xf1800000f1a, + 0xf2000000f2a, + 0xf3500000f36, + 0xf3700000f38, + 0xf3900000f3a, + 0xf3e00000f43, + 0xf4400000f48, + 0xf4900000f4d, + 0xf4e00000f52, + 0xf5300000f57, + 0xf5800000f5c, + 0xf5d00000f69, + 0xf6a00000f6d, + 0xf7100000f73, + 0xf7400000f75, + 0xf7a00000f81, + 0xf8200000f85, + 0xf8600000f93, + 0xf9400000f98, + 0xf9900000f9d, + 0xf9e00000fa2, + 0xfa300000fa7, + 0xfa800000fac, + 0xfad00000fb9, + 0xfba00000fbd, + 0xfc600000fc7, + 0x10000000104a, + 0x10500000109e, + 0x10d0000010fb, + 0x10fd00001100, + 0x120000001249, + 0x124a0000124e, + 0x125000001257, + 0x125800001259, + 0x125a0000125e, + 0x126000001289, + 0x128a0000128e, + 0x1290000012b1, + 0x12b2000012b6, + 0x12b8000012bf, + 0x12c0000012c1, + 0x12c2000012c6, + 0x12c8000012d7, + 0x12d800001311, + 0x131200001316, + 0x13180000135b, + 0x135d00001360, + 0x138000001390, + 0x13a0000013f6, + 0x14010000166d, + 0x166f00001680, + 0x16810000169b, + 0x16a0000016eb, + 0x16f1000016f9, + 0x170000001716, + 0x171f00001735, + 0x174000001754, + 0x17600000176d, + 0x176e00001771, + 0x177200001774, + 0x1780000017b4, + 0x17b6000017d4, + 0x17d7000017d8, + 0x17dc000017de, + 0x17e0000017ea, + 0x18100000181a, + 0x182000001879, + 0x1880000018ab, + 0x18b0000018f6, + 0x19000000191f, + 0x19200000192c, + 0x19300000193c, + 0x19460000196e, + 0x197000001975, + 0x1980000019ac, + 0x19b0000019ca, + 0x19d0000019da, + 0x1a0000001a1c, + 0x1a2000001a5f, + 0x1a6000001a7d, + 0x1a7f00001a8a, + 0x1a9000001a9a, + 0x1aa700001aa8, + 0x1ab000001abe, + 0x1abf00001acf, + 0x1b0000001b4d, + 0x1b5000001b5a, + 0x1b6b00001b74, + 0x1b8000001bf4, + 0x1c0000001c38, + 0x1c4000001c4a, + 0x1c4d00001c7e, + 0x1cd000001cd3, + 0x1cd400001cfb, + 0x1d0000001d2c, + 0x1d2f00001d30, + 0x1d3b00001d3c, + 0x1d4e00001d4f, + 0x1d6b00001d78, + 0x1d7900001d9b, + 0x1dc000001e00, + 0x1e0100001e02, + 0x1e0300001e04, + 0x1e0500001e06, + 0x1e0700001e08, + 0x1e0900001e0a, + 0x1e0b00001e0c, + 0x1e0d00001e0e, + 0x1e0f00001e10, + 0x1e1100001e12, + 0x1e1300001e14, + 0x1e1500001e16, + 0x1e1700001e18, + 0x1e1900001e1a, + 0x1e1b00001e1c, + 0x1e1d00001e1e, + 0x1e1f00001e20, + 0x1e2100001e22, + 0x1e2300001e24, + 0x1e2500001e26, + 0x1e2700001e28, + 0x1e2900001e2a, + 0x1e2b00001e2c, + 0x1e2d00001e2e, + 0x1e2f00001e30, + 0x1e3100001e32, + 0x1e3300001e34, + 0x1e3500001e36, + 0x1e3700001e38, + 0x1e3900001e3a, + 0x1e3b00001e3c, + 0x1e3d00001e3e, + 0x1e3f00001e40, + 0x1e4100001e42, + 0x1e4300001e44, + 0x1e4500001e46, + 0x1e4700001e48, + 0x1e4900001e4a, + 0x1e4b00001e4c, + 0x1e4d00001e4e, + 0x1e4f00001e50, + 0x1e5100001e52, + 0x1e5300001e54, + 0x1e5500001e56, + 0x1e5700001e58, + 0x1e5900001e5a, + 0x1e5b00001e5c, + 0x1e5d00001e5e, + 0x1e5f00001e60, + 0x1e6100001e62, + 0x1e6300001e64, + 0x1e6500001e66, + 0x1e6700001e68, + 0x1e6900001e6a, + 0x1e6b00001e6c, + 0x1e6d00001e6e, + 0x1e6f00001e70, + 0x1e7100001e72, + 0x1e7300001e74, + 0x1e7500001e76, + 0x1e7700001e78, + 0x1e7900001e7a, + 0x1e7b00001e7c, + 0x1e7d00001e7e, + 0x1e7f00001e80, + 0x1e8100001e82, + 0x1e8300001e84, + 0x1e8500001e86, + 0x1e8700001e88, + 0x1e8900001e8a, + 0x1e8b00001e8c, + 0x1e8d00001e8e, + 0x1e8f00001e90, + 0x1e9100001e92, + 0x1e9300001e94, + 0x1e9500001e9a, + 0x1e9c00001e9e, + 0x1e9f00001ea0, + 0x1ea100001ea2, + 0x1ea300001ea4, + 0x1ea500001ea6, + 0x1ea700001ea8, + 0x1ea900001eaa, + 0x1eab00001eac, + 0x1ead00001eae, + 0x1eaf00001eb0, + 0x1eb100001eb2, + 0x1eb300001eb4, + 0x1eb500001eb6, + 0x1eb700001eb8, + 0x1eb900001eba, + 0x1ebb00001ebc, + 0x1ebd00001ebe, + 0x1ebf00001ec0, + 0x1ec100001ec2, + 0x1ec300001ec4, + 0x1ec500001ec6, + 0x1ec700001ec8, + 0x1ec900001eca, + 0x1ecb00001ecc, + 0x1ecd00001ece, + 0x1ecf00001ed0, + 0x1ed100001ed2, + 0x1ed300001ed4, + 0x1ed500001ed6, + 0x1ed700001ed8, + 0x1ed900001eda, + 0x1edb00001edc, + 0x1edd00001ede, + 0x1edf00001ee0, + 0x1ee100001ee2, + 0x1ee300001ee4, + 0x1ee500001ee6, + 0x1ee700001ee8, + 0x1ee900001eea, + 0x1eeb00001eec, + 0x1eed00001eee, + 0x1eef00001ef0, + 0x1ef100001ef2, + 0x1ef300001ef4, + 0x1ef500001ef6, + 0x1ef700001ef8, + 0x1ef900001efa, + 0x1efb00001efc, + 0x1efd00001efe, + 0x1eff00001f08, + 0x1f1000001f16, + 0x1f2000001f28, + 0x1f3000001f38, + 0x1f4000001f46, + 0x1f5000001f58, + 0x1f6000001f68, + 0x1f7000001f71, + 0x1f7200001f73, + 0x1f7400001f75, + 0x1f7600001f77, + 0x1f7800001f79, + 0x1f7a00001f7b, + 0x1f7c00001f7d, + 0x1fb000001fb2, + 0x1fb600001fb7, + 0x1fc600001fc7, + 0x1fd000001fd3, + 0x1fd600001fd8, + 0x1fe000001fe3, + 0x1fe400001fe8, + 0x1ff600001ff7, + 0x214e0000214f, + 0x218400002185, + 0x2c3000002c60, + 0x2c6100002c62, + 0x2c6500002c67, + 0x2c6800002c69, + 0x2c6a00002c6b, + 0x2c6c00002c6d, + 0x2c7100002c72, + 0x2c7300002c75, + 0x2c7600002c7c, + 0x2c8100002c82, + 0x2c8300002c84, + 0x2c8500002c86, + 0x2c8700002c88, + 0x2c8900002c8a, + 0x2c8b00002c8c, + 0x2c8d00002c8e, + 0x2c8f00002c90, + 0x2c9100002c92, + 0x2c9300002c94, + 0x2c9500002c96, + 0x2c9700002c98, + 0x2c9900002c9a, + 0x2c9b00002c9c, + 0x2c9d00002c9e, + 0x2c9f00002ca0, + 0x2ca100002ca2, + 0x2ca300002ca4, + 0x2ca500002ca6, + 0x2ca700002ca8, + 0x2ca900002caa, + 0x2cab00002cac, + 0x2cad00002cae, + 0x2caf00002cb0, + 0x2cb100002cb2, + 0x2cb300002cb4, + 0x2cb500002cb6, + 0x2cb700002cb8, + 0x2cb900002cba, + 0x2cbb00002cbc, + 0x2cbd00002cbe, + 0x2cbf00002cc0, + 0x2cc100002cc2, + 0x2cc300002cc4, + 0x2cc500002cc6, + 0x2cc700002cc8, + 0x2cc900002cca, + 0x2ccb00002ccc, + 0x2ccd00002cce, + 0x2ccf00002cd0, + 0x2cd100002cd2, + 0x2cd300002cd4, + 0x2cd500002cd6, + 0x2cd700002cd8, + 0x2cd900002cda, + 0x2cdb00002cdc, + 0x2cdd00002cde, + 0x2cdf00002ce0, + 0x2ce100002ce2, + 0x2ce300002ce5, + 0x2cec00002ced, + 0x2cee00002cf2, + 0x2cf300002cf4, + 0x2d0000002d26, + 0x2d2700002d28, + 0x2d2d00002d2e, + 0x2d3000002d68, + 0x2d7f00002d97, + 0x2da000002da7, + 0x2da800002daf, + 0x2db000002db7, + 0x2db800002dbf, + 0x2dc000002dc7, + 0x2dc800002dcf, + 0x2dd000002dd7, + 0x2dd800002ddf, + 0x2de000002e00, + 0x2e2f00002e30, + 0x300500003008, + 0x302a0000302e, + 0x303c0000303d, + 0x304100003097, + 0x30990000309b, + 0x309d0000309f, + 0x30a1000030fb, + 0x30fc000030ff, + 0x310500003130, + 0x31a0000031c0, + 0x31f000003200, + 0x340000004dc0, + 0x4e000000a48d, + 0xa4d00000a4fe, + 0xa5000000a60d, + 0xa6100000a62c, + 0xa6410000a642, + 0xa6430000a644, + 0xa6450000a646, + 0xa6470000a648, + 0xa6490000a64a, + 0xa64b0000a64c, + 0xa64d0000a64e, + 0xa64f0000a650, + 0xa6510000a652, + 0xa6530000a654, + 0xa6550000a656, + 0xa6570000a658, + 0xa6590000a65a, + 0xa65b0000a65c, + 0xa65d0000a65e, + 0xa65f0000a660, + 0xa6610000a662, + 0xa6630000a664, + 0xa6650000a666, + 0xa6670000a668, + 0xa6690000a66a, + 0xa66b0000a66c, + 0xa66d0000a670, + 0xa6740000a67e, + 0xa67f0000a680, + 0xa6810000a682, + 0xa6830000a684, + 0xa6850000a686, + 0xa6870000a688, + 0xa6890000a68a, + 0xa68b0000a68c, + 0xa68d0000a68e, + 0xa68f0000a690, + 0xa6910000a692, + 0xa6930000a694, + 0xa6950000a696, + 0xa6970000a698, + 0xa6990000a69a, + 0xa69b0000a69c, + 0xa69e0000a6e6, + 0xa6f00000a6f2, + 0xa7170000a720, + 0xa7230000a724, + 0xa7250000a726, + 0xa7270000a728, + 0xa7290000a72a, + 0xa72b0000a72c, + 0xa72d0000a72e, + 0xa72f0000a732, + 0xa7330000a734, + 0xa7350000a736, + 0xa7370000a738, + 0xa7390000a73a, + 0xa73b0000a73c, + 0xa73d0000a73e, + 0xa73f0000a740, + 0xa7410000a742, + 0xa7430000a744, + 0xa7450000a746, + 0xa7470000a748, + 0xa7490000a74a, + 0xa74b0000a74c, + 0xa74d0000a74e, + 0xa74f0000a750, + 0xa7510000a752, + 0xa7530000a754, + 0xa7550000a756, + 0xa7570000a758, + 0xa7590000a75a, + 0xa75b0000a75c, + 0xa75d0000a75e, + 0xa75f0000a760, + 0xa7610000a762, + 0xa7630000a764, + 0xa7650000a766, + 0xa7670000a768, + 0xa7690000a76a, + 0xa76b0000a76c, + 0xa76d0000a76e, + 0xa76f0000a770, + 0xa7710000a779, + 0xa77a0000a77b, + 0xa77c0000a77d, + 0xa77f0000a780, + 0xa7810000a782, + 0xa7830000a784, + 0xa7850000a786, + 0xa7870000a789, + 0xa78c0000a78d, + 0xa78e0000a790, + 0xa7910000a792, + 0xa7930000a796, + 0xa7970000a798, + 0xa7990000a79a, + 0xa79b0000a79c, + 0xa79d0000a79e, + 0xa79f0000a7a0, + 0xa7a10000a7a2, + 0xa7a30000a7a4, + 0xa7a50000a7a6, + 0xa7a70000a7a8, + 0xa7a90000a7aa, + 0xa7af0000a7b0, + 0xa7b50000a7b6, + 0xa7b70000a7b8, + 0xa7b90000a7ba, + 0xa7bb0000a7bc, + 0xa7bd0000a7be, + 0xa7bf0000a7c0, + 0xa7c10000a7c2, + 0xa7c30000a7c4, + 0xa7c80000a7c9, + 0xa7ca0000a7cb, + 0xa7d10000a7d2, + 0xa7d30000a7d4, + 0xa7d50000a7d6, + 0xa7d70000a7d8, + 0xa7d90000a7da, + 0xa7f20000a7f5, + 0xa7f60000a7f8, + 0xa7fa0000a828, + 0xa82c0000a82d, + 0xa8400000a874, + 0xa8800000a8c6, + 0xa8d00000a8da, + 0xa8e00000a8f8, + 0xa8fb0000a8fc, + 0xa8fd0000a92e, + 0xa9300000a954, + 0xa9800000a9c1, + 0xa9cf0000a9da, + 0xa9e00000a9ff, + 0xaa000000aa37, + 0xaa400000aa4e, + 0xaa500000aa5a, + 0xaa600000aa77, + 0xaa7a0000aac3, + 0xaadb0000aade, + 0xaae00000aaf0, + 0xaaf20000aaf7, + 0xab010000ab07, + 0xab090000ab0f, + 0xab110000ab17, + 0xab200000ab27, + 0xab280000ab2f, + 0xab300000ab5b, + 0xab600000ab69, + 0xabc00000abeb, + 0xabec0000abee, + 0xabf00000abfa, + 0xac000000d7a4, + 0xfa0e0000fa10, + 0xfa110000fa12, + 0xfa130000fa15, + 0xfa1f0000fa20, + 0xfa210000fa22, + 0xfa230000fa25, + 0xfa270000fa2a, + 0xfb1e0000fb1f, + 0xfe200000fe30, + 0xfe730000fe74, + 0x100000001000c, + 0x1000d00010027, + 0x100280001003b, + 0x1003c0001003e, + 0x1003f0001004e, + 0x100500001005e, + 0x10080000100fb, + 0x101fd000101fe, + 0x102800001029d, + 0x102a0000102d1, + 0x102e0000102e1, + 0x1030000010320, + 0x1032d00010341, + 0x103420001034a, + 0x103500001037b, + 0x103800001039e, + 0x103a0000103c4, + 0x103c8000103d0, + 0x104280001049e, + 0x104a0000104aa, + 0x104d8000104fc, + 0x1050000010528, + 0x1053000010564, + 0x10597000105a2, + 0x105a3000105b2, + 0x105b3000105ba, + 0x105bb000105bd, + 0x1060000010737, + 0x1074000010756, + 0x1076000010768, + 0x1078000010786, + 0x10787000107b1, + 0x107b2000107bb, + 0x1080000010806, + 0x1080800010809, + 0x1080a00010836, + 0x1083700010839, + 0x1083c0001083d, + 0x1083f00010856, + 0x1086000010877, + 0x108800001089f, + 0x108e0000108f3, + 0x108f4000108f6, + 0x1090000010916, + 0x109200001093a, + 0x10980000109b8, + 0x109be000109c0, + 0x10a0000010a04, + 0x10a0500010a07, + 0x10a0c00010a14, + 0x10a1500010a18, + 0x10a1900010a36, + 0x10a3800010a3b, + 0x10a3f00010a40, + 0x10a6000010a7d, + 0x10a8000010a9d, + 0x10ac000010ac8, + 0x10ac900010ae7, + 0x10b0000010b36, + 0x10b4000010b56, + 0x10b6000010b73, + 0x10b8000010b92, + 0x10c0000010c49, + 0x10cc000010cf3, + 0x10d0000010d28, + 0x10d3000010d3a, + 0x10e8000010eaa, + 0x10eab00010ead, + 0x10eb000010eb2, + 0x10efd00010f1d, + 0x10f2700010f28, + 0x10f3000010f51, + 0x10f7000010f86, + 0x10fb000010fc5, + 0x10fe000010ff7, + 0x1100000011047, + 0x1106600011076, + 0x1107f000110bb, + 0x110c2000110c3, + 0x110d0000110e9, + 0x110f0000110fa, + 0x1110000011135, + 0x1113600011140, + 0x1114400011148, + 0x1115000011174, + 0x1117600011177, + 0x11180000111c5, + 0x111c9000111cd, + 0x111ce000111db, + 0x111dc000111dd, + 0x1120000011212, + 0x1121300011238, + 0x1123e00011242, + 0x1128000011287, + 0x1128800011289, + 0x1128a0001128e, + 0x1128f0001129e, + 0x1129f000112a9, + 0x112b0000112eb, + 0x112f0000112fa, + 0x1130000011304, + 0x113050001130d, + 0x1130f00011311, + 0x1131300011329, + 0x1132a00011331, + 0x1133200011334, + 0x113350001133a, + 0x1133b00011345, + 0x1134700011349, + 0x1134b0001134e, + 0x1135000011351, + 0x1135700011358, + 0x1135d00011364, + 0x113660001136d, + 0x1137000011375, + 0x114000001144b, + 0x114500001145a, + 0x1145e00011462, + 0x11480000114c6, + 0x114c7000114c8, + 0x114d0000114da, + 0x11580000115b6, + 0x115b8000115c1, + 0x115d8000115de, + 0x1160000011641, + 0x1164400011645, + 0x116500001165a, + 0x11680000116b9, + 0x116c0000116ca, + 0x117000001171b, + 0x1171d0001172c, + 0x117300001173a, + 0x1174000011747, + 0x118000001183b, + 0x118c0000118ea, + 0x118ff00011907, + 0x119090001190a, + 0x1190c00011914, + 0x1191500011917, + 0x1191800011936, + 0x1193700011939, + 0x1193b00011944, + 0x119500001195a, + 0x119a0000119a8, + 0x119aa000119d8, + 0x119da000119e2, + 0x119e3000119e5, + 0x11a0000011a3f, + 0x11a4700011a48, + 0x11a5000011a9a, + 0x11a9d00011a9e, + 0x11ab000011af9, + 0x11c0000011c09, + 0x11c0a00011c37, + 0x11c3800011c41, + 0x11c5000011c5a, + 0x11c7200011c90, + 0x11c9200011ca8, + 0x11ca900011cb7, + 0x11d0000011d07, + 0x11d0800011d0a, + 0x11d0b00011d37, + 0x11d3a00011d3b, + 0x11d3c00011d3e, + 0x11d3f00011d48, + 0x11d5000011d5a, + 0x11d6000011d66, + 0x11d6700011d69, + 0x11d6a00011d8f, + 0x11d9000011d92, + 0x11d9300011d99, + 0x11da000011daa, + 0x11ee000011ef7, + 0x11f0000011f11, + 0x11f1200011f3b, + 0x11f3e00011f43, + 0x11f5000011f5a, + 0x11fb000011fb1, + 0x120000001239a, + 0x1248000012544, + 0x12f9000012ff1, + 0x1300000013430, + 0x1344000013456, + 0x1440000014647, + 0x1680000016a39, + 0x16a4000016a5f, + 0x16a6000016a6a, + 0x16a7000016abf, + 0x16ac000016aca, + 0x16ad000016aee, + 0x16af000016af5, + 0x16b0000016b37, + 0x16b4000016b44, + 0x16b5000016b5a, + 0x16b6300016b78, + 0x16b7d00016b90, + 0x16e6000016e80, + 0x16f0000016f4b, + 0x16f4f00016f88, + 0x16f8f00016fa0, + 0x16fe000016fe2, + 0x16fe300016fe5, + 0x16ff000016ff2, + 0x17000000187f8, + 0x1880000018cd6, + 0x18d0000018d09, + 0x1aff00001aff4, + 0x1aff50001affc, + 0x1affd0001afff, + 0x1b0000001b123, + 0x1b1320001b133, + 0x1b1500001b153, + 0x1b1550001b156, + 0x1b1640001b168, + 0x1b1700001b2fc, + 0x1bc000001bc6b, + 0x1bc700001bc7d, + 0x1bc800001bc89, + 0x1bc900001bc9a, + 0x1bc9d0001bc9f, + 0x1cf000001cf2e, + 0x1cf300001cf47, + 0x1da000001da37, + 0x1da3b0001da6d, + 0x1da750001da76, + 0x1da840001da85, + 0x1da9b0001daa0, + 0x1daa10001dab0, + 0x1df000001df1f, + 0x1df250001df2b, + 0x1e0000001e007, + 0x1e0080001e019, + 0x1e01b0001e022, + 0x1e0230001e025, + 0x1e0260001e02b, + 0x1e0300001e06e, + 0x1e08f0001e090, + 0x1e1000001e12d, + 0x1e1300001e13e, + 0x1e1400001e14a, + 0x1e14e0001e14f, + 0x1e2900001e2af, + 0x1e2c00001e2fa, + 0x1e4d00001e4fa, + 0x1e7e00001e7e7, + 0x1e7e80001e7ec, + 0x1e7ed0001e7ef, + 0x1e7f00001e7ff, + 0x1e8000001e8c5, + 0x1e8d00001e8d7, + 0x1e9220001e94c, + 0x1e9500001e95a, + 0x200000002a6e0, + 0x2a7000002b73a, + 0x2b7400002b81e, + 0x2b8200002cea2, + 0x2ceb00002ebe1, + 0x300000003134b, + 0x31350000323b0, + ), + 'CONTEXTJ': ( + 0x200c0000200e, + ), + 'CONTEXTO': ( + 0xb7000000b8, + 0x37500000376, + 0x5f3000005f5, + 0x6600000066a, + 0x6f0000006fa, + 0x30fb000030fc, + ), +} diff --git a/requests/python/idna/intranges.py b/requests/python/idna/intranges.py new file mode 100644 index 0000000..6a43b04 --- /dev/null +++ b/requests/python/idna/intranges.py @@ -0,0 +1,54 @@ +""" +Given a list of integers, made up of (hopefully) a small number of long runs +of consecutive integers, compute a representation of the form +((start1, end1), (start2, end2) ...). Then answer the question "was x present +in the original list?" in time O(log(# runs)). +""" + +import bisect +from typing import List, Tuple + +def intranges_from_list(list_: List[int]) -> Tuple[int, ...]: + """Represent a list of integers as a sequence of ranges: + ((start_0, end_0), (start_1, end_1), ...), such that the original + integers are exactly those x such that start_i <= x < end_i for some i. + + Ranges are encoded as single integers (start << 32 | end), not as tuples. + """ + + sorted_list = sorted(list_) + ranges = [] + last_write = -1 + for i in range(len(sorted_list)): + if i+1 < len(sorted_list): + if sorted_list[i] == sorted_list[i+1]-1: + continue + current_range = sorted_list[last_write+1:i+1] + ranges.append(_encode_range(current_range[0], current_range[-1] + 1)) + last_write = i + + return tuple(ranges) + +def _encode_range(start: int, end: int) -> int: + return (start << 32) | end + +def _decode_range(r: int) -> Tuple[int, int]: + return (r >> 32), (r & ((1 << 32) - 1)) + + +def intranges_contain(int_: int, ranges: Tuple[int, ...]) -> bool: + """Determine if `int_` falls into one of the ranges in `ranges`.""" + tuple_ = _encode_range(int_, 0) + pos = bisect.bisect_left(ranges, tuple_) + # we could be immediately ahead of a tuple (start, end) + # with start < int_ <= end + if pos > 0: + left, right = _decode_range(ranges[pos-1]) + if left <= int_ < right: + return True + # or we could be immediately behind a tuple (int_, end) + if pos < len(ranges): + left, _ = _decode_range(ranges[pos]) + if left == int_: + return True + return False diff --git a/requests/python/idna/package_data.py b/requests/python/idna/package_data.py new file mode 100644 index 0000000..8501893 --- /dev/null +++ b/requests/python/idna/package_data.py @@ -0,0 +1,2 @@ +__version__ = '3.4' + diff --git a/requests/python/idna/py.typed b/requests/python/idna/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/requests/python/idna/uts46data.py b/requests/python/idna/uts46data.py new file mode 100644 index 0000000..186796c --- /dev/null +++ b/requests/python/idna/uts46data.py @@ -0,0 +1,8600 @@ +# This file is automatically generated by tools/idna-data +# vim: set fileencoding=utf-8 : + +from typing import List, Tuple, Union + + +"""IDNA Mapping Table from UTS46.""" + + +__version__ = '15.0.0' +def _seg_0() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x0, '3'), + (0x1, '3'), + (0x2, '3'), + (0x3, '3'), + (0x4, '3'), + (0x5, '3'), + (0x6, '3'), + (0x7, '3'), + (0x8, '3'), + (0x9, '3'), + (0xA, '3'), + (0xB, '3'), + (0xC, '3'), + (0xD, '3'), + (0xE, '3'), + (0xF, '3'), + (0x10, '3'), + (0x11, '3'), + (0x12, '3'), + (0x13, '3'), + (0x14, '3'), + (0x15, '3'), + (0x16, '3'), + (0x17, '3'), + (0x18, '3'), + (0x19, '3'), + (0x1A, '3'), + (0x1B, '3'), + (0x1C, '3'), + (0x1D, '3'), + (0x1E, '3'), + (0x1F, '3'), + (0x20, '3'), + (0x21, '3'), + (0x22, '3'), + (0x23, '3'), + (0x24, '3'), + (0x25, '3'), + (0x26, '3'), + (0x27, '3'), + (0x28, '3'), + (0x29, '3'), + (0x2A, '3'), + (0x2B, '3'), + (0x2C, '3'), + (0x2D, 'V'), + (0x2E, 'V'), + (0x2F, '3'), + (0x30, 'V'), + (0x31, 'V'), + (0x32, 'V'), + (0x33, 'V'), + (0x34, 'V'), + (0x35, 'V'), + (0x36, 'V'), + (0x37, 'V'), + (0x38, 'V'), + (0x39, 'V'), + (0x3A, '3'), + (0x3B, '3'), + (0x3C, '3'), + (0x3D, '3'), + (0x3E, '3'), + (0x3F, '3'), + (0x40, '3'), + (0x41, 'M', 'a'), + (0x42, 'M', 'b'), + (0x43, 'M', 'c'), + (0x44, 'M', 'd'), + (0x45, 'M', 'e'), + (0x46, 'M', 'f'), + (0x47, 'M', 'g'), + (0x48, 'M', 'h'), + (0x49, 'M', 'i'), + (0x4A, 'M', 'j'), + (0x4B, 'M', 'k'), + (0x4C, 'M', 'l'), + (0x4D, 'M', 'm'), + (0x4E, 'M', 'n'), + (0x4F, 'M', 'o'), + (0x50, 'M', 'p'), + (0x51, 'M', 'q'), + (0x52, 'M', 'r'), + (0x53, 'M', 's'), + (0x54, 'M', 't'), + (0x55, 'M', 'u'), + (0x56, 'M', 'v'), + (0x57, 'M', 'w'), + (0x58, 'M', 'x'), + (0x59, 'M', 'y'), + (0x5A, 'M', 'z'), + (0x5B, '3'), + (0x5C, '3'), + (0x5D, '3'), + (0x5E, '3'), + (0x5F, '3'), + (0x60, '3'), + (0x61, 'V'), + (0x62, 'V'), + (0x63, 'V'), + ] + +def _seg_1() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x64, 'V'), + (0x65, 'V'), + (0x66, 'V'), + (0x67, 'V'), + (0x68, 'V'), + (0x69, 'V'), + (0x6A, 'V'), + (0x6B, 'V'), + (0x6C, 'V'), + (0x6D, 'V'), + (0x6E, 'V'), + (0x6F, 'V'), + (0x70, 'V'), + (0x71, 'V'), + (0x72, 'V'), + (0x73, 'V'), + (0x74, 'V'), + (0x75, 'V'), + (0x76, 'V'), + (0x77, 'V'), + (0x78, 'V'), + (0x79, 'V'), + (0x7A, 'V'), + (0x7B, '3'), + (0x7C, '3'), + (0x7D, '3'), + (0x7E, '3'), + (0x7F, '3'), + (0x80, 'X'), + (0x81, 'X'), + (0x82, 'X'), + (0x83, 'X'), + (0x84, 'X'), + (0x85, 'X'), + (0x86, 'X'), + (0x87, 'X'), + (0x88, 'X'), + (0x89, 'X'), + (0x8A, 'X'), + (0x8B, 'X'), + (0x8C, 'X'), + (0x8D, 'X'), + (0x8E, 'X'), + (0x8F, 'X'), + (0x90, 'X'), + (0x91, 'X'), + (0x92, 'X'), + (0x93, 'X'), + (0x94, 'X'), + (0x95, 'X'), + (0x96, 'X'), + (0x97, 'X'), + (0x98, 'X'), + (0x99, 'X'), + (0x9A, 'X'), + (0x9B, 'X'), + (0x9C, 'X'), + (0x9D, 'X'), + (0x9E, 'X'), + (0x9F, 'X'), + (0xA0, '3', ' '), + (0xA1, 'V'), + (0xA2, 'V'), + (0xA3, 'V'), + (0xA4, 'V'), + (0xA5, 'V'), + (0xA6, 'V'), + (0xA7, 'V'), + (0xA8, '3', ' ̈'), + (0xA9, 'V'), + (0xAA, 'M', 'a'), + (0xAB, 'V'), + (0xAC, 'V'), + (0xAD, 'I'), + (0xAE, 'V'), + (0xAF, '3', ' ̄'), + (0xB0, 'V'), + (0xB1, 'V'), + (0xB2, 'M', '2'), + (0xB3, 'M', '3'), + (0xB4, '3', ' ́'), + (0xB5, 'M', 'μ'), + (0xB6, 'V'), + (0xB7, 'V'), + (0xB8, '3', ' ̧'), + (0xB9, 'M', '1'), + (0xBA, 'M', 'o'), + (0xBB, 'V'), + (0xBC, 'M', '1⁄4'), + (0xBD, 'M', '1⁄2'), + (0xBE, 'M', '3⁄4'), + (0xBF, 'V'), + (0xC0, 'M', 'à'), + (0xC1, 'M', 'á'), + (0xC2, 'M', 'â'), + (0xC3, 'M', 'ã'), + (0xC4, 'M', 'ä'), + (0xC5, 'M', 'å'), + (0xC6, 'M', 'æ'), + (0xC7, 'M', 'ç'), + ] + +def _seg_2() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xC8, 'M', 'è'), + (0xC9, 'M', 'é'), + (0xCA, 'M', 'ê'), + (0xCB, 'M', 'ë'), + (0xCC, 'M', 'ì'), + (0xCD, 'M', 'í'), + (0xCE, 'M', 'î'), + (0xCF, 'M', 'ï'), + (0xD0, 'M', 'ð'), + (0xD1, 'M', 'ñ'), + (0xD2, 'M', 'ò'), + (0xD3, 'M', 'ó'), + (0xD4, 'M', 'ô'), + (0xD5, 'M', 'õ'), + (0xD6, 'M', 'ö'), + (0xD7, 'V'), + (0xD8, 'M', 'ø'), + (0xD9, 'M', 'ù'), + (0xDA, 'M', 'ú'), + (0xDB, 'M', 'û'), + (0xDC, 'M', 'ü'), + (0xDD, 'M', 'ý'), + (0xDE, 'M', 'þ'), + (0xDF, 'D', 'ss'), + (0xE0, 'V'), + (0xE1, 'V'), + (0xE2, 'V'), + (0xE3, 'V'), + (0xE4, 'V'), + (0xE5, 'V'), + (0xE6, 'V'), + (0xE7, 'V'), + (0xE8, 'V'), + (0xE9, 'V'), + (0xEA, 'V'), + (0xEB, 'V'), + (0xEC, 'V'), + (0xED, 'V'), + (0xEE, 'V'), + (0xEF, 'V'), + (0xF0, 'V'), + (0xF1, 'V'), + (0xF2, 'V'), + (0xF3, 'V'), + (0xF4, 'V'), + (0xF5, 'V'), + (0xF6, 'V'), + (0xF7, 'V'), + (0xF8, 'V'), + (0xF9, 'V'), + (0xFA, 'V'), + (0xFB, 'V'), + (0xFC, 'V'), + (0xFD, 'V'), + (0xFE, 'V'), + (0xFF, 'V'), + (0x100, 'M', 'ā'), + (0x101, 'V'), + (0x102, 'M', 'ă'), + (0x103, 'V'), + (0x104, 'M', 'ą'), + (0x105, 'V'), + (0x106, 'M', 'ć'), + (0x107, 'V'), + (0x108, 'M', 'ĉ'), + (0x109, 'V'), + (0x10A, 'M', 'ċ'), + (0x10B, 'V'), + (0x10C, 'M', 'č'), + (0x10D, 'V'), + (0x10E, 'M', 'ď'), + (0x10F, 'V'), + (0x110, 'M', 'đ'), + (0x111, 'V'), + (0x112, 'M', 'ē'), + (0x113, 'V'), + (0x114, 'M', 'ĕ'), + (0x115, 'V'), + (0x116, 'M', 'ė'), + (0x117, 'V'), + (0x118, 'M', 'ę'), + (0x119, 'V'), + (0x11A, 'M', 'ě'), + (0x11B, 'V'), + (0x11C, 'M', 'ĝ'), + (0x11D, 'V'), + (0x11E, 'M', 'ğ'), + (0x11F, 'V'), + (0x120, 'M', 'ġ'), + (0x121, 'V'), + (0x122, 'M', 'ģ'), + (0x123, 'V'), + (0x124, 'M', 'ĥ'), + (0x125, 'V'), + (0x126, 'M', 'ħ'), + (0x127, 'V'), + (0x128, 'M', 'ĩ'), + (0x129, 'V'), + (0x12A, 'M', 'ī'), + (0x12B, 'V'), + ] + +def _seg_3() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x12C, 'M', 'ĭ'), + (0x12D, 'V'), + (0x12E, 'M', 'į'), + (0x12F, 'V'), + (0x130, 'M', 'i̇'), + (0x131, 'V'), + (0x132, 'M', 'ij'), + (0x134, 'M', 'ĵ'), + (0x135, 'V'), + (0x136, 'M', 'ķ'), + (0x137, 'V'), + (0x139, 'M', 'ĺ'), + (0x13A, 'V'), + (0x13B, 'M', 'ļ'), + (0x13C, 'V'), + (0x13D, 'M', 'ľ'), + (0x13E, 'V'), + (0x13F, 'M', 'l·'), + (0x141, 'M', 'ł'), + (0x142, 'V'), + (0x143, 'M', 'ń'), + (0x144, 'V'), + (0x145, 'M', 'ņ'), + (0x146, 'V'), + (0x147, 'M', 'ň'), + (0x148, 'V'), + (0x149, 'M', 'ʼn'), + (0x14A, 'M', 'ŋ'), + (0x14B, 'V'), + (0x14C, 'M', 'ō'), + (0x14D, 'V'), + (0x14E, 'M', 'ŏ'), + (0x14F, 'V'), + (0x150, 'M', 'ő'), + (0x151, 'V'), + (0x152, 'M', 'œ'), + (0x153, 'V'), + (0x154, 'M', 'ŕ'), + (0x155, 'V'), + (0x156, 'M', 'ŗ'), + (0x157, 'V'), + (0x158, 'M', 'ř'), + (0x159, 'V'), + (0x15A, 'M', 'ś'), + (0x15B, 'V'), + (0x15C, 'M', 'ŝ'), + (0x15D, 'V'), + (0x15E, 'M', 'ş'), + (0x15F, 'V'), + (0x160, 'M', 'š'), + (0x161, 'V'), + (0x162, 'M', 'ţ'), + (0x163, 'V'), + (0x164, 'M', 'ť'), + (0x165, 'V'), + (0x166, 'M', 'ŧ'), + (0x167, 'V'), + (0x168, 'M', 'ũ'), + (0x169, 'V'), + (0x16A, 'M', 'ū'), + (0x16B, 'V'), + (0x16C, 'M', 'ŭ'), + (0x16D, 'V'), + (0x16E, 'M', 'ů'), + (0x16F, 'V'), + (0x170, 'M', 'ű'), + (0x171, 'V'), + (0x172, 'M', 'ų'), + (0x173, 'V'), + (0x174, 'M', 'ŵ'), + (0x175, 'V'), + (0x176, 'M', 'ŷ'), + (0x177, 'V'), + (0x178, 'M', 'ÿ'), + (0x179, 'M', 'ź'), + (0x17A, 'V'), + (0x17B, 'M', 'ż'), + (0x17C, 'V'), + (0x17D, 'M', 'ž'), + (0x17E, 'V'), + (0x17F, 'M', 's'), + (0x180, 'V'), + (0x181, 'M', 'ɓ'), + (0x182, 'M', 'ƃ'), + (0x183, 'V'), + (0x184, 'M', 'ƅ'), + (0x185, 'V'), + (0x186, 'M', 'ɔ'), + (0x187, 'M', 'ƈ'), + (0x188, 'V'), + (0x189, 'M', 'ɖ'), + (0x18A, 'M', 'ɗ'), + (0x18B, 'M', 'ƌ'), + (0x18C, 'V'), + (0x18E, 'M', 'ǝ'), + (0x18F, 'M', 'ə'), + (0x190, 'M', 'ɛ'), + (0x191, 'M', 'ƒ'), + (0x192, 'V'), + (0x193, 'M', 'ɠ'), + ] + +def _seg_4() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x194, 'M', 'ɣ'), + (0x195, 'V'), + (0x196, 'M', 'ɩ'), + (0x197, 'M', 'ɨ'), + (0x198, 'M', 'ƙ'), + (0x199, 'V'), + (0x19C, 'M', 'ɯ'), + (0x19D, 'M', 'ɲ'), + (0x19E, 'V'), + (0x19F, 'M', 'ɵ'), + (0x1A0, 'M', 'ơ'), + (0x1A1, 'V'), + (0x1A2, 'M', 'ƣ'), + (0x1A3, 'V'), + (0x1A4, 'M', 'ƥ'), + (0x1A5, 'V'), + (0x1A6, 'M', 'ʀ'), + (0x1A7, 'M', 'ƨ'), + (0x1A8, 'V'), + (0x1A9, 'M', 'ʃ'), + (0x1AA, 'V'), + (0x1AC, 'M', 'ƭ'), + (0x1AD, 'V'), + (0x1AE, 'M', 'ʈ'), + (0x1AF, 'M', 'ư'), + (0x1B0, 'V'), + (0x1B1, 'M', 'ʊ'), + (0x1B2, 'M', 'ʋ'), + (0x1B3, 'M', 'ƴ'), + (0x1B4, 'V'), + (0x1B5, 'M', 'ƶ'), + (0x1B6, 'V'), + (0x1B7, 'M', 'ʒ'), + (0x1B8, 'M', 'ƹ'), + (0x1B9, 'V'), + (0x1BC, 'M', 'ƽ'), + (0x1BD, 'V'), + (0x1C4, 'M', 'dž'), + (0x1C7, 'M', 'lj'), + (0x1CA, 'M', 'nj'), + (0x1CD, 'M', 'ǎ'), + (0x1CE, 'V'), + (0x1CF, 'M', 'ǐ'), + (0x1D0, 'V'), + (0x1D1, 'M', 'ǒ'), + (0x1D2, 'V'), + (0x1D3, 'M', 'ǔ'), + (0x1D4, 'V'), + (0x1D5, 'M', 'ǖ'), + (0x1D6, 'V'), + (0x1D7, 'M', 'ǘ'), + (0x1D8, 'V'), + (0x1D9, 'M', 'ǚ'), + (0x1DA, 'V'), + (0x1DB, 'M', 'ǜ'), + (0x1DC, 'V'), + (0x1DE, 'M', 'ǟ'), + (0x1DF, 'V'), + (0x1E0, 'M', 'ǡ'), + (0x1E1, 'V'), + (0x1E2, 'M', 'ǣ'), + (0x1E3, 'V'), + (0x1E4, 'M', 'ǥ'), + (0x1E5, 'V'), + (0x1E6, 'M', 'ǧ'), + (0x1E7, 'V'), + (0x1E8, 'M', 'ǩ'), + (0x1E9, 'V'), + (0x1EA, 'M', 'ǫ'), + (0x1EB, 'V'), + (0x1EC, 'M', 'ǭ'), + (0x1ED, 'V'), + (0x1EE, 'M', 'ǯ'), + (0x1EF, 'V'), + (0x1F1, 'M', 'dz'), + (0x1F4, 'M', 'ǵ'), + (0x1F5, 'V'), + (0x1F6, 'M', 'ƕ'), + (0x1F7, 'M', 'ƿ'), + (0x1F8, 'M', 'ǹ'), + (0x1F9, 'V'), + (0x1FA, 'M', 'ǻ'), + (0x1FB, 'V'), + (0x1FC, 'M', 'ǽ'), + (0x1FD, 'V'), + (0x1FE, 'M', 'ǿ'), + (0x1FF, 'V'), + (0x200, 'M', 'ȁ'), + (0x201, 'V'), + (0x202, 'M', 'ȃ'), + (0x203, 'V'), + (0x204, 'M', 'ȅ'), + (0x205, 'V'), + (0x206, 'M', 'ȇ'), + (0x207, 'V'), + (0x208, 'M', 'ȉ'), + (0x209, 'V'), + (0x20A, 'M', 'ȋ'), + (0x20B, 'V'), + (0x20C, 'M', 'ȍ'), + ] + +def _seg_5() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x20D, 'V'), + (0x20E, 'M', 'ȏ'), + (0x20F, 'V'), + (0x210, 'M', 'ȑ'), + (0x211, 'V'), + (0x212, 'M', 'ȓ'), + (0x213, 'V'), + (0x214, 'M', 'ȕ'), + (0x215, 'V'), + (0x216, 'M', 'ȗ'), + (0x217, 'V'), + (0x218, 'M', 'ș'), + (0x219, 'V'), + (0x21A, 'M', 'ț'), + (0x21B, 'V'), + (0x21C, 'M', 'ȝ'), + (0x21D, 'V'), + (0x21E, 'M', 'ȟ'), + (0x21F, 'V'), + (0x220, 'M', 'ƞ'), + (0x221, 'V'), + (0x222, 'M', 'ȣ'), + (0x223, 'V'), + (0x224, 'M', 'ȥ'), + (0x225, 'V'), + (0x226, 'M', 'ȧ'), + (0x227, 'V'), + (0x228, 'M', 'ȩ'), + (0x229, 'V'), + (0x22A, 'M', 'ȫ'), + (0x22B, 'V'), + (0x22C, 'M', 'ȭ'), + (0x22D, 'V'), + (0x22E, 'M', 'ȯ'), + (0x22F, 'V'), + (0x230, 'M', 'ȱ'), + (0x231, 'V'), + (0x232, 'M', 'ȳ'), + (0x233, 'V'), + (0x23A, 'M', 'ⱥ'), + (0x23B, 'M', 'ȼ'), + (0x23C, 'V'), + (0x23D, 'M', 'ƚ'), + (0x23E, 'M', 'ⱦ'), + (0x23F, 'V'), + (0x241, 'M', 'ɂ'), + (0x242, 'V'), + (0x243, 'M', 'ƀ'), + (0x244, 'M', 'ʉ'), + (0x245, 'M', 'ʌ'), + (0x246, 'M', 'ɇ'), + (0x247, 'V'), + (0x248, 'M', 'ɉ'), + (0x249, 'V'), + (0x24A, 'M', 'ɋ'), + (0x24B, 'V'), + (0x24C, 'M', 'ɍ'), + (0x24D, 'V'), + (0x24E, 'M', 'ɏ'), + (0x24F, 'V'), + (0x2B0, 'M', 'h'), + (0x2B1, 'M', 'ɦ'), + (0x2B2, 'M', 'j'), + (0x2B3, 'M', 'r'), + (0x2B4, 'M', 'ɹ'), + (0x2B5, 'M', 'ɻ'), + (0x2B6, 'M', 'ʁ'), + (0x2B7, 'M', 'w'), + (0x2B8, 'M', 'y'), + (0x2B9, 'V'), + (0x2D8, '3', ' ̆'), + (0x2D9, '3', ' ̇'), + (0x2DA, '3', ' ̊'), + (0x2DB, '3', ' ̨'), + (0x2DC, '3', ' ̃'), + (0x2DD, '3', ' ̋'), + (0x2DE, 'V'), + (0x2E0, 'M', 'ɣ'), + (0x2E1, 'M', 'l'), + (0x2E2, 'M', 's'), + (0x2E3, 'M', 'x'), + (0x2E4, 'M', 'ʕ'), + (0x2E5, 'V'), + (0x340, 'M', '̀'), + (0x341, 'M', '́'), + (0x342, 'V'), + (0x343, 'M', '̓'), + (0x344, 'M', '̈́'), + (0x345, 'M', 'ι'), + (0x346, 'V'), + (0x34F, 'I'), + (0x350, 'V'), + (0x370, 'M', 'ͱ'), + (0x371, 'V'), + (0x372, 'M', 'ͳ'), + (0x373, 'V'), + (0x374, 'M', 'ʹ'), + (0x375, 'V'), + (0x376, 'M', 'ͷ'), + (0x377, 'V'), + ] + +def _seg_6() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x378, 'X'), + (0x37A, '3', ' ι'), + (0x37B, 'V'), + (0x37E, '3', ';'), + (0x37F, 'M', 'ϳ'), + (0x380, 'X'), + (0x384, '3', ' ́'), + (0x385, '3', ' ̈́'), + (0x386, 'M', 'ά'), + (0x387, 'M', '·'), + (0x388, 'M', 'έ'), + (0x389, 'M', 'ή'), + (0x38A, 'M', 'ί'), + (0x38B, 'X'), + (0x38C, 'M', 'ό'), + (0x38D, 'X'), + (0x38E, 'M', 'ύ'), + (0x38F, 'M', 'ώ'), + (0x390, 'V'), + (0x391, 'M', 'α'), + (0x392, 'M', 'β'), + (0x393, 'M', 'γ'), + (0x394, 'M', 'δ'), + (0x395, 'M', 'ε'), + (0x396, 'M', 'ζ'), + (0x397, 'M', 'η'), + (0x398, 'M', 'θ'), + (0x399, 'M', 'ι'), + (0x39A, 'M', 'κ'), + (0x39B, 'M', 'λ'), + (0x39C, 'M', 'μ'), + (0x39D, 'M', 'ν'), + (0x39E, 'M', 'ξ'), + (0x39F, 'M', 'ο'), + (0x3A0, 'M', 'π'), + (0x3A1, 'M', 'ρ'), + (0x3A2, 'X'), + (0x3A3, 'M', 'σ'), + (0x3A4, 'M', 'τ'), + (0x3A5, 'M', 'υ'), + (0x3A6, 'M', 'φ'), + (0x3A7, 'M', 'χ'), + (0x3A8, 'M', 'ψ'), + (0x3A9, 'M', 'ω'), + (0x3AA, 'M', 'ϊ'), + (0x3AB, 'M', 'ϋ'), + (0x3AC, 'V'), + (0x3C2, 'D', 'σ'), + (0x3C3, 'V'), + (0x3CF, 'M', 'ϗ'), + (0x3D0, 'M', 'β'), + (0x3D1, 'M', 'θ'), + (0x3D2, 'M', 'υ'), + (0x3D3, 'M', 'ύ'), + (0x3D4, 'M', 'ϋ'), + (0x3D5, 'M', 'φ'), + (0x3D6, 'M', 'π'), + (0x3D7, 'V'), + (0x3D8, 'M', 'ϙ'), + (0x3D9, 'V'), + (0x3DA, 'M', 'ϛ'), + (0x3DB, 'V'), + (0x3DC, 'M', 'ϝ'), + (0x3DD, 'V'), + (0x3DE, 'M', 'ϟ'), + (0x3DF, 'V'), + (0x3E0, 'M', 'ϡ'), + (0x3E1, 'V'), + (0x3E2, 'M', 'ϣ'), + (0x3E3, 'V'), + (0x3E4, 'M', 'ϥ'), + (0x3E5, 'V'), + (0x3E6, 'M', 'ϧ'), + (0x3E7, 'V'), + (0x3E8, 'M', 'ϩ'), + (0x3E9, 'V'), + (0x3EA, 'M', 'ϫ'), + (0x3EB, 'V'), + (0x3EC, 'M', 'ϭ'), + (0x3ED, 'V'), + (0x3EE, 'M', 'ϯ'), + (0x3EF, 'V'), + (0x3F0, 'M', 'κ'), + (0x3F1, 'M', 'ρ'), + (0x3F2, 'M', 'σ'), + (0x3F3, 'V'), + (0x3F4, 'M', 'θ'), + (0x3F5, 'M', 'ε'), + (0x3F6, 'V'), + (0x3F7, 'M', 'ϸ'), + (0x3F8, 'V'), + (0x3F9, 'M', 'σ'), + (0x3FA, 'M', 'ϻ'), + (0x3FB, 'V'), + (0x3FD, 'M', 'ͻ'), + (0x3FE, 'M', 'ͼ'), + (0x3FF, 'M', 'ͽ'), + (0x400, 'M', 'ѐ'), + (0x401, 'M', 'ё'), + (0x402, 'M', 'ђ'), + ] + +def _seg_7() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x403, 'M', 'ѓ'), + (0x404, 'M', 'є'), + (0x405, 'M', 'ѕ'), + (0x406, 'M', 'і'), + (0x407, 'M', 'ї'), + (0x408, 'M', 'ј'), + (0x409, 'M', 'љ'), + (0x40A, 'M', 'њ'), + (0x40B, 'M', 'ћ'), + (0x40C, 'M', 'ќ'), + (0x40D, 'M', 'ѝ'), + (0x40E, 'M', 'ў'), + (0x40F, 'M', 'џ'), + (0x410, 'M', 'а'), + (0x411, 'M', 'б'), + (0x412, 'M', 'в'), + (0x413, 'M', 'г'), + (0x414, 'M', 'д'), + (0x415, 'M', 'е'), + (0x416, 'M', 'ж'), + (0x417, 'M', 'з'), + (0x418, 'M', 'и'), + (0x419, 'M', 'й'), + (0x41A, 'M', 'к'), + (0x41B, 'M', 'л'), + (0x41C, 'M', 'м'), + (0x41D, 'M', 'н'), + (0x41E, 'M', 'о'), + (0x41F, 'M', 'п'), + (0x420, 'M', 'р'), + (0x421, 'M', 'с'), + (0x422, 'M', 'т'), + (0x423, 'M', 'у'), + (0x424, 'M', 'ф'), + (0x425, 'M', 'х'), + (0x426, 'M', 'ц'), + (0x427, 'M', 'ч'), + (0x428, 'M', 'ш'), + (0x429, 'M', 'щ'), + (0x42A, 'M', 'ъ'), + (0x42B, 'M', 'ы'), + (0x42C, 'M', 'ь'), + (0x42D, 'M', 'э'), + (0x42E, 'M', 'ю'), + (0x42F, 'M', 'я'), + (0x430, 'V'), + (0x460, 'M', 'ѡ'), + (0x461, 'V'), + (0x462, 'M', 'ѣ'), + (0x463, 'V'), + (0x464, 'M', 'ѥ'), + (0x465, 'V'), + (0x466, 'M', 'ѧ'), + (0x467, 'V'), + (0x468, 'M', 'ѩ'), + (0x469, 'V'), + (0x46A, 'M', 'ѫ'), + (0x46B, 'V'), + (0x46C, 'M', 'ѭ'), + (0x46D, 'V'), + (0x46E, 'M', 'ѯ'), + (0x46F, 'V'), + (0x470, 'M', 'ѱ'), + (0x471, 'V'), + (0x472, 'M', 'ѳ'), + (0x473, 'V'), + (0x474, 'M', 'ѵ'), + (0x475, 'V'), + (0x476, 'M', 'ѷ'), + (0x477, 'V'), + (0x478, 'M', 'ѹ'), + (0x479, 'V'), + (0x47A, 'M', 'ѻ'), + (0x47B, 'V'), + (0x47C, 'M', 'ѽ'), + (0x47D, 'V'), + (0x47E, 'M', 'ѿ'), + (0x47F, 'V'), + (0x480, 'M', 'ҁ'), + (0x481, 'V'), + (0x48A, 'M', 'ҋ'), + (0x48B, 'V'), + (0x48C, 'M', 'ҍ'), + (0x48D, 'V'), + (0x48E, 'M', 'ҏ'), + (0x48F, 'V'), + (0x490, 'M', 'ґ'), + (0x491, 'V'), + (0x492, 'M', 'ғ'), + (0x493, 'V'), + (0x494, 'M', 'ҕ'), + (0x495, 'V'), + (0x496, 'M', 'җ'), + (0x497, 'V'), + (0x498, 'M', 'ҙ'), + (0x499, 'V'), + (0x49A, 'M', 'қ'), + (0x49B, 'V'), + (0x49C, 'M', 'ҝ'), + (0x49D, 'V'), + ] + +def _seg_8() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x49E, 'M', 'ҟ'), + (0x49F, 'V'), + (0x4A0, 'M', 'ҡ'), + (0x4A1, 'V'), + (0x4A2, 'M', 'ң'), + (0x4A3, 'V'), + (0x4A4, 'M', 'ҥ'), + (0x4A5, 'V'), + (0x4A6, 'M', 'ҧ'), + (0x4A7, 'V'), + (0x4A8, 'M', 'ҩ'), + (0x4A9, 'V'), + (0x4AA, 'M', 'ҫ'), + (0x4AB, 'V'), + (0x4AC, 'M', 'ҭ'), + (0x4AD, 'V'), + (0x4AE, 'M', 'ү'), + (0x4AF, 'V'), + (0x4B0, 'M', 'ұ'), + (0x4B1, 'V'), + (0x4B2, 'M', 'ҳ'), + (0x4B3, 'V'), + (0x4B4, 'M', 'ҵ'), + (0x4B5, 'V'), + (0x4B6, 'M', 'ҷ'), + (0x4B7, 'V'), + (0x4B8, 'M', 'ҹ'), + (0x4B9, 'V'), + (0x4BA, 'M', 'һ'), + (0x4BB, 'V'), + (0x4BC, 'M', 'ҽ'), + (0x4BD, 'V'), + (0x4BE, 'M', 'ҿ'), + (0x4BF, 'V'), + (0x4C0, 'X'), + (0x4C1, 'M', 'ӂ'), + (0x4C2, 'V'), + (0x4C3, 'M', 'ӄ'), + (0x4C4, 'V'), + (0x4C5, 'M', 'ӆ'), + (0x4C6, 'V'), + (0x4C7, 'M', 'ӈ'), + (0x4C8, 'V'), + (0x4C9, 'M', 'ӊ'), + (0x4CA, 'V'), + (0x4CB, 'M', 'ӌ'), + (0x4CC, 'V'), + (0x4CD, 'M', 'ӎ'), + (0x4CE, 'V'), + (0x4D0, 'M', 'ӑ'), + (0x4D1, 'V'), + (0x4D2, 'M', 'ӓ'), + (0x4D3, 'V'), + (0x4D4, 'M', 'ӕ'), + (0x4D5, 'V'), + (0x4D6, 'M', 'ӗ'), + (0x4D7, 'V'), + (0x4D8, 'M', 'ә'), + (0x4D9, 'V'), + (0x4DA, 'M', 'ӛ'), + (0x4DB, 'V'), + (0x4DC, 'M', 'ӝ'), + (0x4DD, 'V'), + (0x4DE, 'M', 'ӟ'), + (0x4DF, 'V'), + (0x4E0, 'M', 'ӡ'), + (0x4E1, 'V'), + (0x4E2, 'M', 'ӣ'), + (0x4E3, 'V'), + (0x4E4, 'M', 'ӥ'), + (0x4E5, 'V'), + (0x4E6, 'M', 'ӧ'), + (0x4E7, 'V'), + (0x4E8, 'M', 'ө'), + (0x4E9, 'V'), + (0x4EA, 'M', 'ӫ'), + (0x4EB, 'V'), + (0x4EC, 'M', 'ӭ'), + (0x4ED, 'V'), + (0x4EE, 'M', 'ӯ'), + (0x4EF, 'V'), + (0x4F0, 'M', 'ӱ'), + (0x4F1, 'V'), + (0x4F2, 'M', 'ӳ'), + (0x4F3, 'V'), + (0x4F4, 'M', 'ӵ'), + (0x4F5, 'V'), + (0x4F6, 'M', 'ӷ'), + (0x4F7, 'V'), + (0x4F8, 'M', 'ӹ'), + (0x4F9, 'V'), + (0x4FA, 'M', 'ӻ'), + (0x4FB, 'V'), + (0x4FC, 'M', 'ӽ'), + (0x4FD, 'V'), + (0x4FE, 'M', 'ӿ'), + (0x4FF, 'V'), + (0x500, 'M', 'ԁ'), + (0x501, 'V'), + (0x502, 'M', 'ԃ'), + ] + +def _seg_9() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x503, 'V'), + (0x504, 'M', 'ԅ'), + (0x505, 'V'), + (0x506, 'M', 'ԇ'), + (0x507, 'V'), + (0x508, 'M', 'ԉ'), + (0x509, 'V'), + (0x50A, 'M', 'ԋ'), + (0x50B, 'V'), + (0x50C, 'M', 'ԍ'), + (0x50D, 'V'), + (0x50E, 'M', 'ԏ'), + (0x50F, 'V'), + (0x510, 'M', 'ԑ'), + (0x511, 'V'), + (0x512, 'M', 'ԓ'), + (0x513, 'V'), + (0x514, 'M', 'ԕ'), + (0x515, 'V'), + (0x516, 'M', 'ԗ'), + (0x517, 'V'), + (0x518, 'M', 'ԙ'), + (0x519, 'V'), + (0x51A, 'M', 'ԛ'), + (0x51B, 'V'), + (0x51C, 'M', 'ԝ'), + (0x51D, 'V'), + (0x51E, 'M', 'ԟ'), + (0x51F, 'V'), + (0x520, 'M', 'ԡ'), + (0x521, 'V'), + (0x522, 'M', 'ԣ'), + (0x523, 'V'), + (0x524, 'M', 'ԥ'), + (0x525, 'V'), + (0x526, 'M', 'ԧ'), + (0x527, 'V'), + (0x528, 'M', 'ԩ'), + (0x529, 'V'), + (0x52A, 'M', 'ԫ'), + (0x52B, 'V'), + (0x52C, 'M', 'ԭ'), + (0x52D, 'V'), + (0x52E, 'M', 'ԯ'), + (0x52F, 'V'), + (0x530, 'X'), + (0x531, 'M', 'ա'), + (0x532, 'M', 'բ'), + (0x533, 'M', 'գ'), + (0x534, 'M', 'դ'), + (0x535, 'M', 'ե'), + (0x536, 'M', 'զ'), + (0x537, 'M', 'է'), + (0x538, 'M', 'ը'), + (0x539, 'M', 'թ'), + (0x53A, 'M', 'ժ'), + (0x53B, 'M', 'ի'), + (0x53C, 'M', 'լ'), + (0x53D, 'M', 'խ'), + (0x53E, 'M', 'ծ'), + (0x53F, 'M', 'կ'), + (0x540, 'M', 'հ'), + (0x541, 'M', 'ձ'), + (0x542, 'M', 'ղ'), + (0x543, 'M', 'ճ'), + (0x544, 'M', 'մ'), + (0x545, 'M', 'յ'), + (0x546, 'M', 'ն'), + (0x547, 'M', 'շ'), + (0x548, 'M', 'ո'), + (0x549, 'M', 'չ'), + (0x54A, 'M', 'պ'), + (0x54B, 'M', 'ջ'), + (0x54C, 'M', 'ռ'), + (0x54D, 'M', 'ս'), + (0x54E, 'M', 'վ'), + (0x54F, 'M', 'տ'), + (0x550, 'M', 'ր'), + (0x551, 'M', 'ց'), + (0x552, 'M', 'ւ'), + (0x553, 'M', 'փ'), + (0x554, 'M', 'ք'), + (0x555, 'M', 'օ'), + (0x556, 'M', 'ֆ'), + (0x557, 'X'), + (0x559, 'V'), + (0x587, 'M', 'եւ'), + (0x588, 'V'), + (0x58B, 'X'), + (0x58D, 'V'), + (0x590, 'X'), + (0x591, 'V'), + (0x5C8, 'X'), + (0x5D0, 'V'), + (0x5EB, 'X'), + (0x5EF, 'V'), + (0x5F5, 'X'), + (0x606, 'V'), + (0x61C, 'X'), + (0x61D, 'V'), + ] + +def _seg_10() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x675, 'M', 'اٴ'), + (0x676, 'M', 'وٴ'), + (0x677, 'M', 'ۇٴ'), + (0x678, 'M', 'يٴ'), + (0x679, 'V'), + (0x6DD, 'X'), + (0x6DE, 'V'), + (0x70E, 'X'), + (0x710, 'V'), + (0x74B, 'X'), + (0x74D, 'V'), + (0x7B2, 'X'), + (0x7C0, 'V'), + (0x7FB, 'X'), + (0x7FD, 'V'), + (0x82E, 'X'), + (0x830, 'V'), + (0x83F, 'X'), + (0x840, 'V'), + (0x85C, 'X'), + (0x85E, 'V'), + (0x85F, 'X'), + (0x860, 'V'), + (0x86B, 'X'), + (0x870, 'V'), + (0x88F, 'X'), + (0x898, 'V'), + (0x8E2, 'X'), + (0x8E3, 'V'), + (0x958, 'M', 'क़'), + (0x959, 'M', 'ख़'), + (0x95A, 'M', 'ग़'), + (0x95B, 'M', 'ज़'), + (0x95C, 'M', 'ड़'), + (0x95D, 'M', 'ढ़'), + (0x95E, 'M', 'फ़'), + (0x95F, 'M', 'य़'), + (0x960, 'V'), + (0x984, 'X'), + (0x985, 'V'), + (0x98D, 'X'), + (0x98F, 'V'), + (0x991, 'X'), + (0x993, 'V'), + (0x9A9, 'X'), + (0x9AA, 'V'), + (0x9B1, 'X'), + (0x9B2, 'V'), + (0x9B3, 'X'), + (0x9B6, 'V'), + (0x9BA, 'X'), + (0x9BC, 'V'), + (0x9C5, 'X'), + (0x9C7, 'V'), + (0x9C9, 'X'), + (0x9CB, 'V'), + (0x9CF, 'X'), + (0x9D7, 'V'), + (0x9D8, 'X'), + (0x9DC, 'M', 'ড়'), + (0x9DD, 'M', 'ঢ়'), + (0x9DE, 'X'), + (0x9DF, 'M', 'য়'), + (0x9E0, 'V'), + (0x9E4, 'X'), + (0x9E6, 'V'), + (0x9FF, 'X'), + (0xA01, 'V'), + (0xA04, 'X'), + (0xA05, 'V'), + (0xA0B, 'X'), + (0xA0F, 'V'), + (0xA11, 'X'), + (0xA13, 'V'), + (0xA29, 'X'), + (0xA2A, 'V'), + (0xA31, 'X'), + (0xA32, 'V'), + (0xA33, 'M', 'ਲ਼'), + (0xA34, 'X'), + (0xA35, 'V'), + (0xA36, 'M', 'ਸ਼'), + (0xA37, 'X'), + (0xA38, 'V'), + (0xA3A, 'X'), + (0xA3C, 'V'), + (0xA3D, 'X'), + (0xA3E, 'V'), + (0xA43, 'X'), + (0xA47, 'V'), + (0xA49, 'X'), + (0xA4B, 'V'), + (0xA4E, 'X'), + (0xA51, 'V'), + (0xA52, 'X'), + (0xA59, 'M', 'ਖ਼'), + (0xA5A, 'M', 'ਗ਼'), + (0xA5B, 'M', 'ਜ਼'), + (0xA5C, 'V'), + (0xA5D, 'X'), + ] + +def _seg_11() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA5E, 'M', 'ਫ਼'), + (0xA5F, 'X'), + (0xA66, 'V'), + (0xA77, 'X'), + (0xA81, 'V'), + (0xA84, 'X'), + (0xA85, 'V'), + (0xA8E, 'X'), + (0xA8F, 'V'), + (0xA92, 'X'), + (0xA93, 'V'), + (0xAA9, 'X'), + (0xAAA, 'V'), + (0xAB1, 'X'), + (0xAB2, 'V'), + (0xAB4, 'X'), + (0xAB5, 'V'), + (0xABA, 'X'), + (0xABC, 'V'), + (0xAC6, 'X'), + (0xAC7, 'V'), + (0xACA, 'X'), + (0xACB, 'V'), + (0xACE, 'X'), + (0xAD0, 'V'), + (0xAD1, 'X'), + (0xAE0, 'V'), + (0xAE4, 'X'), + (0xAE6, 'V'), + (0xAF2, 'X'), + (0xAF9, 'V'), + (0xB00, 'X'), + (0xB01, 'V'), + (0xB04, 'X'), + (0xB05, 'V'), + (0xB0D, 'X'), + (0xB0F, 'V'), + (0xB11, 'X'), + (0xB13, 'V'), + (0xB29, 'X'), + (0xB2A, 'V'), + (0xB31, 'X'), + (0xB32, 'V'), + (0xB34, 'X'), + (0xB35, 'V'), + (0xB3A, 'X'), + (0xB3C, 'V'), + (0xB45, 'X'), + (0xB47, 'V'), + (0xB49, 'X'), + (0xB4B, 'V'), + (0xB4E, 'X'), + (0xB55, 'V'), + (0xB58, 'X'), + (0xB5C, 'M', 'ଡ଼'), + (0xB5D, 'M', 'ଢ଼'), + (0xB5E, 'X'), + (0xB5F, 'V'), + (0xB64, 'X'), + (0xB66, 'V'), + (0xB78, 'X'), + (0xB82, 'V'), + (0xB84, 'X'), + (0xB85, 'V'), + (0xB8B, 'X'), + (0xB8E, 'V'), + (0xB91, 'X'), + (0xB92, 'V'), + (0xB96, 'X'), + (0xB99, 'V'), + (0xB9B, 'X'), + (0xB9C, 'V'), + (0xB9D, 'X'), + (0xB9E, 'V'), + (0xBA0, 'X'), + (0xBA3, 'V'), + (0xBA5, 'X'), + (0xBA8, 'V'), + (0xBAB, 'X'), + (0xBAE, 'V'), + (0xBBA, 'X'), + (0xBBE, 'V'), + (0xBC3, 'X'), + (0xBC6, 'V'), + (0xBC9, 'X'), + (0xBCA, 'V'), + (0xBCE, 'X'), + (0xBD0, 'V'), + (0xBD1, 'X'), + (0xBD7, 'V'), + (0xBD8, 'X'), + (0xBE6, 'V'), + (0xBFB, 'X'), + (0xC00, 'V'), + (0xC0D, 'X'), + (0xC0E, 'V'), + (0xC11, 'X'), + (0xC12, 'V'), + (0xC29, 'X'), + (0xC2A, 'V'), + ] + +def _seg_12() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xC3A, 'X'), + (0xC3C, 'V'), + (0xC45, 'X'), + (0xC46, 'V'), + (0xC49, 'X'), + (0xC4A, 'V'), + (0xC4E, 'X'), + (0xC55, 'V'), + (0xC57, 'X'), + (0xC58, 'V'), + (0xC5B, 'X'), + (0xC5D, 'V'), + (0xC5E, 'X'), + (0xC60, 'V'), + (0xC64, 'X'), + (0xC66, 'V'), + (0xC70, 'X'), + (0xC77, 'V'), + (0xC8D, 'X'), + (0xC8E, 'V'), + (0xC91, 'X'), + (0xC92, 'V'), + (0xCA9, 'X'), + (0xCAA, 'V'), + (0xCB4, 'X'), + (0xCB5, 'V'), + (0xCBA, 'X'), + (0xCBC, 'V'), + (0xCC5, 'X'), + (0xCC6, 'V'), + (0xCC9, 'X'), + (0xCCA, 'V'), + (0xCCE, 'X'), + (0xCD5, 'V'), + (0xCD7, 'X'), + (0xCDD, 'V'), + (0xCDF, 'X'), + (0xCE0, 'V'), + (0xCE4, 'X'), + (0xCE6, 'V'), + (0xCF0, 'X'), + (0xCF1, 'V'), + (0xCF4, 'X'), + (0xD00, 'V'), + (0xD0D, 'X'), + (0xD0E, 'V'), + (0xD11, 'X'), + (0xD12, 'V'), + (0xD45, 'X'), + (0xD46, 'V'), + (0xD49, 'X'), + (0xD4A, 'V'), + (0xD50, 'X'), + (0xD54, 'V'), + (0xD64, 'X'), + (0xD66, 'V'), + (0xD80, 'X'), + (0xD81, 'V'), + (0xD84, 'X'), + (0xD85, 'V'), + (0xD97, 'X'), + (0xD9A, 'V'), + (0xDB2, 'X'), + (0xDB3, 'V'), + (0xDBC, 'X'), + (0xDBD, 'V'), + (0xDBE, 'X'), + (0xDC0, 'V'), + (0xDC7, 'X'), + (0xDCA, 'V'), + (0xDCB, 'X'), + (0xDCF, 'V'), + (0xDD5, 'X'), + (0xDD6, 'V'), + (0xDD7, 'X'), + (0xDD8, 'V'), + (0xDE0, 'X'), + (0xDE6, 'V'), + (0xDF0, 'X'), + (0xDF2, 'V'), + (0xDF5, 'X'), + (0xE01, 'V'), + (0xE33, 'M', 'ํา'), + (0xE34, 'V'), + (0xE3B, 'X'), + (0xE3F, 'V'), + (0xE5C, 'X'), + (0xE81, 'V'), + (0xE83, 'X'), + (0xE84, 'V'), + (0xE85, 'X'), + (0xE86, 'V'), + (0xE8B, 'X'), + (0xE8C, 'V'), + (0xEA4, 'X'), + (0xEA5, 'V'), + (0xEA6, 'X'), + (0xEA7, 'V'), + (0xEB3, 'M', 'ໍາ'), + (0xEB4, 'V'), + ] + +def _seg_13() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xEBE, 'X'), + (0xEC0, 'V'), + (0xEC5, 'X'), + (0xEC6, 'V'), + (0xEC7, 'X'), + (0xEC8, 'V'), + (0xECF, 'X'), + (0xED0, 'V'), + (0xEDA, 'X'), + (0xEDC, 'M', 'ຫນ'), + (0xEDD, 'M', 'ຫມ'), + (0xEDE, 'V'), + (0xEE0, 'X'), + (0xF00, 'V'), + (0xF0C, 'M', '་'), + (0xF0D, 'V'), + (0xF43, 'M', 'གྷ'), + (0xF44, 'V'), + (0xF48, 'X'), + (0xF49, 'V'), + (0xF4D, 'M', 'ཌྷ'), + (0xF4E, 'V'), + (0xF52, 'M', 'དྷ'), + (0xF53, 'V'), + (0xF57, 'M', 'བྷ'), + (0xF58, 'V'), + (0xF5C, 'M', 'ཛྷ'), + (0xF5D, 'V'), + (0xF69, 'M', 'ཀྵ'), + (0xF6A, 'V'), + (0xF6D, 'X'), + (0xF71, 'V'), + (0xF73, 'M', 'ཱི'), + (0xF74, 'V'), + (0xF75, 'M', 'ཱུ'), + (0xF76, 'M', 'ྲྀ'), + (0xF77, 'M', 'ྲཱྀ'), + (0xF78, 'M', 'ླྀ'), + (0xF79, 'M', 'ླཱྀ'), + (0xF7A, 'V'), + (0xF81, 'M', 'ཱྀ'), + (0xF82, 'V'), + (0xF93, 'M', 'ྒྷ'), + (0xF94, 'V'), + (0xF98, 'X'), + (0xF99, 'V'), + (0xF9D, 'M', 'ྜྷ'), + (0xF9E, 'V'), + (0xFA2, 'M', 'ྡྷ'), + (0xFA3, 'V'), + (0xFA7, 'M', 'ྦྷ'), + (0xFA8, 'V'), + (0xFAC, 'M', 'ྫྷ'), + (0xFAD, 'V'), + (0xFB9, 'M', 'ྐྵ'), + (0xFBA, 'V'), + (0xFBD, 'X'), + (0xFBE, 'V'), + (0xFCD, 'X'), + (0xFCE, 'V'), + (0xFDB, 'X'), + (0x1000, 'V'), + (0x10A0, 'X'), + (0x10C7, 'M', 'ⴧ'), + (0x10C8, 'X'), + (0x10CD, 'M', 'ⴭ'), + (0x10CE, 'X'), + (0x10D0, 'V'), + (0x10FC, 'M', 'ნ'), + (0x10FD, 'V'), + (0x115F, 'X'), + (0x1161, 'V'), + (0x1249, 'X'), + (0x124A, 'V'), + (0x124E, 'X'), + (0x1250, 'V'), + (0x1257, 'X'), + (0x1258, 'V'), + (0x1259, 'X'), + (0x125A, 'V'), + (0x125E, 'X'), + (0x1260, 'V'), + (0x1289, 'X'), + (0x128A, 'V'), + (0x128E, 'X'), + (0x1290, 'V'), + (0x12B1, 'X'), + (0x12B2, 'V'), + (0x12B6, 'X'), + (0x12B8, 'V'), + (0x12BF, 'X'), + (0x12C0, 'V'), + (0x12C1, 'X'), + (0x12C2, 'V'), + (0x12C6, 'X'), + (0x12C8, 'V'), + (0x12D7, 'X'), + (0x12D8, 'V'), + (0x1311, 'X'), + (0x1312, 'V'), + ] + +def _seg_14() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1316, 'X'), + (0x1318, 'V'), + (0x135B, 'X'), + (0x135D, 'V'), + (0x137D, 'X'), + (0x1380, 'V'), + (0x139A, 'X'), + (0x13A0, 'V'), + (0x13F6, 'X'), + (0x13F8, 'M', 'Ᏸ'), + (0x13F9, 'M', 'Ᏹ'), + (0x13FA, 'M', 'Ᏺ'), + (0x13FB, 'M', 'Ᏻ'), + (0x13FC, 'M', 'Ᏼ'), + (0x13FD, 'M', 'Ᏽ'), + (0x13FE, 'X'), + (0x1400, 'V'), + (0x1680, 'X'), + (0x1681, 'V'), + (0x169D, 'X'), + (0x16A0, 'V'), + (0x16F9, 'X'), + (0x1700, 'V'), + (0x1716, 'X'), + (0x171F, 'V'), + (0x1737, 'X'), + (0x1740, 'V'), + (0x1754, 'X'), + (0x1760, 'V'), + (0x176D, 'X'), + (0x176E, 'V'), + (0x1771, 'X'), + (0x1772, 'V'), + (0x1774, 'X'), + (0x1780, 'V'), + (0x17B4, 'X'), + (0x17B6, 'V'), + (0x17DE, 'X'), + (0x17E0, 'V'), + (0x17EA, 'X'), + (0x17F0, 'V'), + (0x17FA, 'X'), + (0x1800, 'V'), + (0x1806, 'X'), + (0x1807, 'V'), + (0x180B, 'I'), + (0x180E, 'X'), + (0x180F, 'I'), + (0x1810, 'V'), + (0x181A, 'X'), + (0x1820, 'V'), + (0x1879, 'X'), + (0x1880, 'V'), + (0x18AB, 'X'), + (0x18B0, 'V'), + (0x18F6, 'X'), + (0x1900, 'V'), + (0x191F, 'X'), + (0x1920, 'V'), + (0x192C, 'X'), + (0x1930, 'V'), + (0x193C, 'X'), + (0x1940, 'V'), + (0x1941, 'X'), + (0x1944, 'V'), + (0x196E, 'X'), + (0x1970, 'V'), + (0x1975, 'X'), + (0x1980, 'V'), + (0x19AC, 'X'), + (0x19B0, 'V'), + (0x19CA, 'X'), + (0x19D0, 'V'), + (0x19DB, 'X'), + (0x19DE, 'V'), + (0x1A1C, 'X'), + (0x1A1E, 'V'), + (0x1A5F, 'X'), + (0x1A60, 'V'), + (0x1A7D, 'X'), + (0x1A7F, 'V'), + (0x1A8A, 'X'), + (0x1A90, 'V'), + (0x1A9A, 'X'), + (0x1AA0, 'V'), + (0x1AAE, 'X'), + (0x1AB0, 'V'), + (0x1ACF, 'X'), + (0x1B00, 'V'), + (0x1B4D, 'X'), + (0x1B50, 'V'), + (0x1B7F, 'X'), + (0x1B80, 'V'), + (0x1BF4, 'X'), + (0x1BFC, 'V'), + (0x1C38, 'X'), + (0x1C3B, 'V'), + (0x1C4A, 'X'), + (0x1C4D, 'V'), + (0x1C80, 'M', 'в'), + ] + +def _seg_15() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1C81, 'M', 'д'), + (0x1C82, 'M', 'о'), + (0x1C83, 'M', 'с'), + (0x1C84, 'M', 'т'), + (0x1C86, 'M', 'ъ'), + (0x1C87, 'M', 'ѣ'), + (0x1C88, 'M', 'ꙋ'), + (0x1C89, 'X'), + (0x1C90, 'M', 'ა'), + (0x1C91, 'M', 'ბ'), + (0x1C92, 'M', 'გ'), + (0x1C93, 'M', 'დ'), + (0x1C94, 'M', 'ე'), + (0x1C95, 'M', 'ვ'), + (0x1C96, 'M', 'ზ'), + (0x1C97, 'M', 'თ'), + (0x1C98, 'M', 'ი'), + (0x1C99, 'M', 'კ'), + (0x1C9A, 'M', 'ლ'), + (0x1C9B, 'M', 'მ'), + (0x1C9C, 'M', 'ნ'), + (0x1C9D, 'M', 'ო'), + (0x1C9E, 'M', 'პ'), + (0x1C9F, 'M', 'ჟ'), + (0x1CA0, 'M', 'რ'), + (0x1CA1, 'M', 'ს'), + (0x1CA2, 'M', 'ტ'), + (0x1CA3, 'M', 'უ'), + (0x1CA4, 'M', 'ფ'), + (0x1CA5, 'M', 'ქ'), + (0x1CA6, 'M', 'ღ'), + (0x1CA7, 'M', 'ყ'), + (0x1CA8, 'M', 'შ'), + (0x1CA9, 'M', 'ჩ'), + (0x1CAA, 'M', 'ც'), + (0x1CAB, 'M', 'ძ'), + (0x1CAC, 'M', 'წ'), + (0x1CAD, 'M', 'ჭ'), + (0x1CAE, 'M', 'ხ'), + (0x1CAF, 'M', 'ჯ'), + (0x1CB0, 'M', 'ჰ'), + (0x1CB1, 'M', 'ჱ'), + (0x1CB2, 'M', 'ჲ'), + (0x1CB3, 'M', 'ჳ'), + (0x1CB4, 'M', 'ჴ'), + (0x1CB5, 'M', 'ჵ'), + (0x1CB6, 'M', 'ჶ'), + (0x1CB7, 'M', 'ჷ'), + (0x1CB8, 'M', 'ჸ'), + (0x1CB9, 'M', 'ჹ'), + (0x1CBA, 'M', 'ჺ'), + (0x1CBB, 'X'), + (0x1CBD, 'M', 'ჽ'), + (0x1CBE, 'M', 'ჾ'), + (0x1CBF, 'M', 'ჿ'), + (0x1CC0, 'V'), + (0x1CC8, 'X'), + (0x1CD0, 'V'), + (0x1CFB, 'X'), + (0x1D00, 'V'), + (0x1D2C, 'M', 'a'), + (0x1D2D, 'M', 'æ'), + (0x1D2E, 'M', 'b'), + (0x1D2F, 'V'), + (0x1D30, 'M', 'd'), + (0x1D31, 'M', 'e'), + (0x1D32, 'M', 'ǝ'), + (0x1D33, 'M', 'g'), + (0x1D34, 'M', 'h'), + (0x1D35, 'M', 'i'), + (0x1D36, 'M', 'j'), + (0x1D37, 'M', 'k'), + (0x1D38, 'M', 'l'), + (0x1D39, 'M', 'm'), + (0x1D3A, 'M', 'n'), + (0x1D3B, 'V'), + (0x1D3C, 'M', 'o'), + (0x1D3D, 'M', 'ȣ'), + (0x1D3E, 'M', 'p'), + (0x1D3F, 'M', 'r'), + (0x1D40, 'M', 't'), + (0x1D41, 'M', 'u'), + (0x1D42, 'M', 'w'), + (0x1D43, 'M', 'a'), + (0x1D44, 'M', 'ɐ'), + (0x1D45, 'M', 'ɑ'), + (0x1D46, 'M', 'ᴂ'), + (0x1D47, 'M', 'b'), + (0x1D48, 'M', 'd'), + (0x1D49, 'M', 'e'), + (0x1D4A, 'M', 'ə'), + (0x1D4B, 'M', 'ɛ'), + (0x1D4C, 'M', 'ɜ'), + (0x1D4D, 'M', 'g'), + (0x1D4E, 'V'), + (0x1D4F, 'M', 'k'), + (0x1D50, 'M', 'm'), + (0x1D51, 'M', 'ŋ'), + (0x1D52, 'M', 'o'), + (0x1D53, 'M', 'ɔ'), + ] + +def _seg_16() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D54, 'M', 'ᴖ'), + (0x1D55, 'M', 'ᴗ'), + (0x1D56, 'M', 'p'), + (0x1D57, 'M', 't'), + (0x1D58, 'M', 'u'), + (0x1D59, 'M', 'ᴝ'), + (0x1D5A, 'M', 'ɯ'), + (0x1D5B, 'M', 'v'), + (0x1D5C, 'M', 'ᴥ'), + (0x1D5D, 'M', 'β'), + (0x1D5E, 'M', 'γ'), + (0x1D5F, 'M', 'δ'), + (0x1D60, 'M', 'φ'), + (0x1D61, 'M', 'χ'), + (0x1D62, 'M', 'i'), + (0x1D63, 'M', 'r'), + (0x1D64, 'M', 'u'), + (0x1D65, 'M', 'v'), + (0x1D66, 'M', 'β'), + (0x1D67, 'M', 'γ'), + (0x1D68, 'M', 'ρ'), + (0x1D69, 'M', 'φ'), + (0x1D6A, 'M', 'χ'), + (0x1D6B, 'V'), + (0x1D78, 'M', 'н'), + (0x1D79, 'V'), + (0x1D9B, 'M', 'ɒ'), + (0x1D9C, 'M', 'c'), + (0x1D9D, 'M', 'ɕ'), + (0x1D9E, 'M', 'ð'), + (0x1D9F, 'M', 'ɜ'), + (0x1DA0, 'M', 'f'), + (0x1DA1, 'M', 'ɟ'), + (0x1DA2, 'M', 'ɡ'), + (0x1DA3, 'M', 'ɥ'), + (0x1DA4, 'M', 'ɨ'), + (0x1DA5, 'M', 'ɩ'), + (0x1DA6, 'M', 'ɪ'), + (0x1DA7, 'M', 'ᵻ'), + (0x1DA8, 'M', 'ʝ'), + (0x1DA9, 'M', 'ɭ'), + (0x1DAA, 'M', 'ᶅ'), + (0x1DAB, 'M', 'ʟ'), + (0x1DAC, 'M', 'ɱ'), + (0x1DAD, 'M', 'ɰ'), + (0x1DAE, 'M', 'ɲ'), + (0x1DAF, 'M', 'ɳ'), + (0x1DB0, 'M', 'ɴ'), + (0x1DB1, 'M', 'ɵ'), + (0x1DB2, 'M', 'ɸ'), + (0x1DB3, 'M', 'ʂ'), + (0x1DB4, 'M', 'ʃ'), + (0x1DB5, 'M', 'ƫ'), + (0x1DB6, 'M', 'ʉ'), + (0x1DB7, 'M', 'ʊ'), + (0x1DB8, 'M', 'ᴜ'), + (0x1DB9, 'M', 'ʋ'), + (0x1DBA, 'M', 'ʌ'), + (0x1DBB, 'M', 'z'), + (0x1DBC, 'M', 'ʐ'), + (0x1DBD, 'M', 'ʑ'), + (0x1DBE, 'M', 'ʒ'), + (0x1DBF, 'M', 'θ'), + (0x1DC0, 'V'), + (0x1E00, 'M', 'ḁ'), + (0x1E01, 'V'), + (0x1E02, 'M', 'ḃ'), + (0x1E03, 'V'), + (0x1E04, 'M', 'ḅ'), + (0x1E05, 'V'), + (0x1E06, 'M', 'ḇ'), + (0x1E07, 'V'), + (0x1E08, 'M', 'ḉ'), + (0x1E09, 'V'), + (0x1E0A, 'M', 'ḋ'), + (0x1E0B, 'V'), + (0x1E0C, 'M', 'ḍ'), + (0x1E0D, 'V'), + (0x1E0E, 'M', 'ḏ'), + (0x1E0F, 'V'), + (0x1E10, 'M', 'ḑ'), + (0x1E11, 'V'), + (0x1E12, 'M', 'ḓ'), + (0x1E13, 'V'), + (0x1E14, 'M', 'ḕ'), + (0x1E15, 'V'), + (0x1E16, 'M', 'ḗ'), + (0x1E17, 'V'), + (0x1E18, 'M', 'ḙ'), + (0x1E19, 'V'), + (0x1E1A, 'M', 'ḛ'), + (0x1E1B, 'V'), + (0x1E1C, 'M', 'ḝ'), + (0x1E1D, 'V'), + (0x1E1E, 'M', 'ḟ'), + (0x1E1F, 'V'), + (0x1E20, 'M', 'ḡ'), + (0x1E21, 'V'), + (0x1E22, 'M', 'ḣ'), + (0x1E23, 'V'), + ] + +def _seg_17() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E24, 'M', 'ḥ'), + (0x1E25, 'V'), + (0x1E26, 'M', 'ḧ'), + (0x1E27, 'V'), + (0x1E28, 'M', 'ḩ'), + (0x1E29, 'V'), + (0x1E2A, 'M', 'ḫ'), + (0x1E2B, 'V'), + (0x1E2C, 'M', 'ḭ'), + (0x1E2D, 'V'), + (0x1E2E, 'M', 'ḯ'), + (0x1E2F, 'V'), + (0x1E30, 'M', 'ḱ'), + (0x1E31, 'V'), + (0x1E32, 'M', 'ḳ'), + (0x1E33, 'V'), + (0x1E34, 'M', 'ḵ'), + (0x1E35, 'V'), + (0x1E36, 'M', 'ḷ'), + (0x1E37, 'V'), + (0x1E38, 'M', 'ḹ'), + (0x1E39, 'V'), + (0x1E3A, 'M', 'ḻ'), + (0x1E3B, 'V'), + (0x1E3C, 'M', 'ḽ'), + (0x1E3D, 'V'), + (0x1E3E, 'M', 'ḿ'), + (0x1E3F, 'V'), + (0x1E40, 'M', 'ṁ'), + (0x1E41, 'V'), + (0x1E42, 'M', 'ṃ'), + (0x1E43, 'V'), + (0x1E44, 'M', 'ṅ'), + (0x1E45, 'V'), + (0x1E46, 'M', 'ṇ'), + (0x1E47, 'V'), + (0x1E48, 'M', 'ṉ'), + (0x1E49, 'V'), + (0x1E4A, 'M', 'ṋ'), + (0x1E4B, 'V'), + (0x1E4C, 'M', 'ṍ'), + (0x1E4D, 'V'), + (0x1E4E, 'M', 'ṏ'), + (0x1E4F, 'V'), + (0x1E50, 'M', 'ṑ'), + (0x1E51, 'V'), + (0x1E52, 'M', 'ṓ'), + (0x1E53, 'V'), + (0x1E54, 'M', 'ṕ'), + (0x1E55, 'V'), + (0x1E56, 'M', 'ṗ'), + (0x1E57, 'V'), + (0x1E58, 'M', 'ṙ'), + (0x1E59, 'V'), + (0x1E5A, 'M', 'ṛ'), + (0x1E5B, 'V'), + (0x1E5C, 'M', 'ṝ'), + (0x1E5D, 'V'), + (0x1E5E, 'M', 'ṟ'), + (0x1E5F, 'V'), + (0x1E60, 'M', 'ṡ'), + (0x1E61, 'V'), + (0x1E62, 'M', 'ṣ'), + (0x1E63, 'V'), + (0x1E64, 'M', 'ṥ'), + (0x1E65, 'V'), + (0x1E66, 'M', 'ṧ'), + (0x1E67, 'V'), + (0x1E68, 'M', 'ṩ'), + (0x1E69, 'V'), + (0x1E6A, 'M', 'ṫ'), + (0x1E6B, 'V'), + (0x1E6C, 'M', 'ṭ'), + (0x1E6D, 'V'), + (0x1E6E, 'M', 'ṯ'), + (0x1E6F, 'V'), + (0x1E70, 'M', 'ṱ'), + (0x1E71, 'V'), + (0x1E72, 'M', 'ṳ'), + (0x1E73, 'V'), + (0x1E74, 'M', 'ṵ'), + (0x1E75, 'V'), + (0x1E76, 'M', 'ṷ'), + (0x1E77, 'V'), + (0x1E78, 'M', 'ṹ'), + (0x1E79, 'V'), + (0x1E7A, 'M', 'ṻ'), + (0x1E7B, 'V'), + (0x1E7C, 'M', 'ṽ'), + (0x1E7D, 'V'), + (0x1E7E, 'M', 'ṿ'), + (0x1E7F, 'V'), + (0x1E80, 'M', 'ẁ'), + (0x1E81, 'V'), + (0x1E82, 'M', 'ẃ'), + (0x1E83, 'V'), + (0x1E84, 'M', 'ẅ'), + (0x1E85, 'V'), + (0x1E86, 'M', 'ẇ'), + (0x1E87, 'V'), + ] + +def _seg_18() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E88, 'M', 'ẉ'), + (0x1E89, 'V'), + (0x1E8A, 'M', 'ẋ'), + (0x1E8B, 'V'), + (0x1E8C, 'M', 'ẍ'), + (0x1E8D, 'V'), + (0x1E8E, 'M', 'ẏ'), + (0x1E8F, 'V'), + (0x1E90, 'M', 'ẑ'), + (0x1E91, 'V'), + (0x1E92, 'M', 'ẓ'), + (0x1E93, 'V'), + (0x1E94, 'M', 'ẕ'), + (0x1E95, 'V'), + (0x1E9A, 'M', 'aʾ'), + (0x1E9B, 'M', 'ṡ'), + (0x1E9C, 'V'), + (0x1E9E, 'M', 'ss'), + (0x1E9F, 'V'), + (0x1EA0, 'M', 'ạ'), + (0x1EA1, 'V'), + (0x1EA2, 'M', 'ả'), + (0x1EA3, 'V'), + (0x1EA4, 'M', 'ấ'), + (0x1EA5, 'V'), + (0x1EA6, 'M', 'ầ'), + (0x1EA7, 'V'), + (0x1EA8, 'M', 'ẩ'), + (0x1EA9, 'V'), + (0x1EAA, 'M', 'ẫ'), + (0x1EAB, 'V'), + (0x1EAC, 'M', 'ậ'), + (0x1EAD, 'V'), + (0x1EAE, 'M', 'ắ'), + (0x1EAF, 'V'), + (0x1EB0, 'M', 'ằ'), + (0x1EB1, 'V'), + (0x1EB2, 'M', 'ẳ'), + (0x1EB3, 'V'), + (0x1EB4, 'M', 'ẵ'), + (0x1EB5, 'V'), + (0x1EB6, 'M', 'ặ'), + (0x1EB7, 'V'), + (0x1EB8, 'M', 'ẹ'), + (0x1EB9, 'V'), + (0x1EBA, 'M', 'ẻ'), + (0x1EBB, 'V'), + (0x1EBC, 'M', 'ẽ'), + (0x1EBD, 'V'), + (0x1EBE, 'M', 'ế'), + (0x1EBF, 'V'), + (0x1EC0, 'M', 'ề'), + (0x1EC1, 'V'), + (0x1EC2, 'M', 'ể'), + (0x1EC3, 'V'), + (0x1EC4, 'M', 'ễ'), + (0x1EC5, 'V'), + (0x1EC6, 'M', 'ệ'), + (0x1EC7, 'V'), + (0x1EC8, 'M', 'ỉ'), + (0x1EC9, 'V'), + (0x1ECA, 'M', 'ị'), + (0x1ECB, 'V'), + (0x1ECC, 'M', 'ọ'), + (0x1ECD, 'V'), + (0x1ECE, 'M', 'ỏ'), + (0x1ECF, 'V'), + (0x1ED0, 'M', 'ố'), + (0x1ED1, 'V'), + (0x1ED2, 'M', 'ồ'), + (0x1ED3, 'V'), + (0x1ED4, 'M', 'ổ'), + (0x1ED5, 'V'), + (0x1ED6, 'M', 'ỗ'), + (0x1ED7, 'V'), + (0x1ED8, 'M', 'ộ'), + (0x1ED9, 'V'), + (0x1EDA, 'M', 'ớ'), + (0x1EDB, 'V'), + (0x1EDC, 'M', 'ờ'), + (0x1EDD, 'V'), + (0x1EDE, 'M', 'ở'), + (0x1EDF, 'V'), + (0x1EE0, 'M', 'ỡ'), + (0x1EE1, 'V'), + (0x1EE2, 'M', 'ợ'), + (0x1EE3, 'V'), + (0x1EE4, 'M', 'ụ'), + (0x1EE5, 'V'), + (0x1EE6, 'M', 'ủ'), + (0x1EE7, 'V'), + (0x1EE8, 'M', 'ứ'), + (0x1EE9, 'V'), + (0x1EEA, 'M', 'ừ'), + (0x1EEB, 'V'), + (0x1EEC, 'M', 'ử'), + (0x1EED, 'V'), + (0x1EEE, 'M', 'ữ'), + (0x1EEF, 'V'), + (0x1EF0, 'M', 'ự'), + ] + +def _seg_19() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1EF1, 'V'), + (0x1EF2, 'M', 'ỳ'), + (0x1EF3, 'V'), + (0x1EF4, 'M', 'ỵ'), + (0x1EF5, 'V'), + (0x1EF6, 'M', 'ỷ'), + (0x1EF7, 'V'), + (0x1EF8, 'M', 'ỹ'), + (0x1EF9, 'V'), + (0x1EFA, 'M', 'ỻ'), + (0x1EFB, 'V'), + (0x1EFC, 'M', 'ỽ'), + (0x1EFD, 'V'), + (0x1EFE, 'M', 'ỿ'), + (0x1EFF, 'V'), + (0x1F08, 'M', 'ἀ'), + (0x1F09, 'M', 'ἁ'), + (0x1F0A, 'M', 'ἂ'), + (0x1F0B, 'M', 'ἃ'), + (0x1F0C, 'M', 'ἄ'), + (0x1F0D, 'M', 'ἅ'), + (0x1F0E, 'M', 'ἆ'), + (0x1F0F, 'M', 'ἇ'), + (0x1F10, 'V'), + (0x1F16, 'X'), + (0x1F18, 'M', 'ἐ'), + (0x1F19, 'M', 'ἑ'), + (0x1F1A, 'M', 'ἒ'), + (0x1F1B, 'M', 'ἓ'), + (0x1F1C, 'M', 'ἔ'), + (0x1F1D, 'M', 'ἕ'), + (0x1F1E, 'X'), + (0x1F20, 'V'), + (0x1F28, 'M', 'ἠ'), + (0x1F29, 'M', 'ἡ'), + (0x1F2A, 'M', 'ἢ'), + (0x1F2B, 'M', 'ἣ'), + (0x1F2C, 'M', 'ἤ'), + (0x1F2D, 'M', 'ἥ'), + (0x1F2E, 'M', 'ἦ'), + (0x1F2F, 'M', 'ἧ'), + (0x1F30, 'V'), + (0x1F38, 'M', 'ἰ'), + (0x1F39, 'M', 'ἱ'), + (0x1F3A, 'M', 'ἲ'), + (0x1F3B, 'M', 'ἳ'), + (0x1F3C, 'M', 'ἴ'), + (0x1F3D, 'M', 'ἵ'), + (0x1F3E, 'M', 'ἶ'), + (0x1F3F, 'M', 'ἷ'), + (0x1F40, 'V'), + (0x1F46, 'X'), + (0x1F48, 'M', 'ὀ'), + (0x1F49, 'M', 'ὁ'), + (0x1F4A, 'M', 'ὂ'), + (0x1F4B, 'M', 'ὃ'), + (0x1F4C, 'M', 'ὄ'), + (0x1F4D, 'M', 'ὅ'), + (0x1F4E, 'X'), + (0x1F50, 'V'), + (0x1F58, 'X'), + (0x1F59, 'M', 'ὑ'), + (0x1F5A, 'X'), + (0x1F5B, 'M', 'ὓ'), + (0x1F5C, 'X'), + (0x1F5D, 'M', 'ὕ'), + (0x1F5E, 'X'), + (0x1F5F, 'M', 'ὗ'), + (0x1F60, 'V'), + (0x1F68, 'M', 'ὠ'), + (0x1F69, 'M', 'ὡ'), + (0x1F6A, 'M', 'ὢ'), + (0x1F6B, 'M', 'ὣ'), + (0x1F6C, 'M', 'ὤ'), + (0x1F6D, 'M', 'ὥ'), + (0x1F6E, 'M', 'ὦ'), + (0x1F6F, 'M', 'ὧ'), + (0x1F70, 'V'), + (0x1F71, 'M', 'ά'), + (0x1F72, 'V'), + (0x1F73, 'M', 'έ'), + (0x1F74, 'V'), + (0x1F75, 'M', 'ή'), + (0x1F76, 'V'), + (0x1F77, 'M', 'ί'), + (0x1F78, 'V'), + (0x1F79, 'M', 'ό'), + (0x1F7A, 'V'), + (0x1F7B, 'M', 'ύ'), + (0x1F7C, 'V'), + (0x1F7D, 'M', 'ώ'), + (0x1F7E, 'X'), + (0x1F80, 'M', 'ἀι'), + (0x1F81, 'M', 'ἁι'), + (0x1F82, 'M', 'ἂι'), + (0x1F83, 'M', 'ἃι'), + (0x1F84, 'M', 'ἄι'), + (0x1F85, 'M', 'ἅι'), + (0x1F86, 'M', 'ἆι'), + (0x1F87, 'M', 'ἇι'), + ] + +def _seg_20() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1F88, 'M', 'ἀι'), + (0x1F89, 'M', 'ἁι'), + (0x1F8A, 'M', 'ἂι'), + (0x1F8B, 'M', 'ἃι'), + (0x1F8C, 'M', 'ἄι'), + (0x1F8D, 'M', 'ἅι'), + (0x1F8E, 'M', 'ἆι'), + (0x1F8F, 'M', 'ἇι'), + (0x1F90, 'M', 'ἠι'), + (0x1F91, 'M', 'ἡι'), + (0x1F92, 'M', 'ἢι'), + (0x1F93, 'M', 'ἣι'), + (0x1F94, 'M', 'ἤι'), + (0x1F95, 'M', 'ἥι'), + (0x1F96, 'M', 'ἦι'), + (0x1F97, 'M', 'ἧι'), + (0x1F98, 'M', 'ἠι'), + (0x1F99, 'M', 'ἡι'), + (0x1F9A, 'M', 'ἢι'), + (0x1F9B, 'M', 'ἣι'), + (0x1F9C, 'M', 'ἤι'), + (0x1F9D, 'M', 'ἥι'), + (0x1F9E, 'M', 'ἦι'), + (0x1F9F, 'M', 'ἧι'), + (0x1FA0, 'M', 'ὠι'), + (0x1FA1, 'M', 'ὡι'), + (0x1FA2, 'M', 'ὢι'), + (0x1FA3, 'M', 'ὣι'), + (0x1FA4, 'M', 'ὤι'), + (0x1FA5, 'M', 'ὥι'), + (0x1FA6, 'M', 'ὦι'), + (0x1FA7, 'M', 'ὧι'), + (0x1FA8, 'M', 'ὠι'), + (0x1FA9, 'M', 'ὡι'), + (0x1FAA, 'M', 'ὢι'), + (0x1FAB, 'M', 'ὣι'), + (0x1FAC, 'M', 'ὤι'), + (0x1FAD, 'M', 'ὥι'), + (0x1FAE, 'M', 'ὦι'), + (0x1FAF, 'M', 'ὧι'), + (0x1FB0, 'V'), + (0x1FB2, 'M', 'ὰι'), + (0x1FB3, 'M', 'αι'), + (0x1FB4, 'M', 'άι'), + (0x1FB5, 'X'), + (0x1FB6, 'V'), + (0x1FB7, 'M', 'ᾶι'), + (0x1FB8, 'M', 'ᾰ'), + (0x1FB9, 'M', 'ᾱ'), + (0x1FBA, 'M', 'ὰ'), + (0x1FBB, 'M', 'ά'), + (0x1FBC, 'M', 'αι'), + (0x1FBD, '3', ' ̓'), + (0x1FBE, 'M', 'ι'), + (0x1FBF, '3', ' ̓'), + (0x1FC0, '3', ' ͂'), + (0x1FC1, '3', ' ̈͂'), + (0x1FC2, 'M', 'ὴι'), + (0x1FC3, 'M', 'ηι'), + (0x1FC4, 'M', 'ήι'), + (0x1FC5, 'X'), + (0x1FC6, 'V'), + (0x1FC7, 'M', 'ῆι'), + (0x1FC8, 'M', 'ὲ'), + (0x1FC9, 'M', 'έ'), + (0x1FCA, 'M', 'ὴ'), + (0x1FCB, 'M', 'ή'), + (0x1FCC, 'M', 'ηι'), + (0x1FCD, '3', ' ̓̀'), + (0x1FCE, '3', ' ̓́'), + (0x1FCF, '3', ' ̓͂'), + (0x1FD0, 'V'), + (0x1FD3, 'M', 'ΐ'), + (0x1FD4, 'X'), + (0x1FD6, 'V'), + (0x1FD8, 'M', 'ῐ'), + (0x1FD9, 'M', 'ῑ'), + (0x1FDA, 'M', 'ὶ'), + (0x1FDB, 'M', 'ί'), + (0x1FDC, 'X'), + (0x1FDD, '3', ' ̔̀'), + (0x1FDE, '3', ' ̔́'), + (0x1FDF, '3', ' ̔͂'), + (0x1FE0, 'V'), + (0x1FE3, 'M', 'ΰ'), + (0x1FE4, 'V'), + (0x1FE8, 'M', 'ῠ'), + (0x1FE9, 'M', 'ῡ'), + (0x1FEA, 'M', 'ὺ'), + (0x1FEB, 'M', 'ύ'), + (0x1FEC, 'M', 'ῥ'), + (0x1FED, '3', ' ̈̀'), + (0x1FEE, '3', ' ̈́'), + (0x1FEF, '3', '`'), + (0x1FF0, 'X'), + (0x1FF2, 'M', 'ὼι'), + (0x1FF3, 'M', 'ωι'), + (0x1FF4, 'M', 'ώι'), + (0x1FF5, 'X'), + (0x1FF6, 'V'), + ] + +def _seg_21() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1FF7, 'M', 'ῶι'), + (0x1FF8, 'M', 'ὸ'), + (0x1FF9, 'M', 'ό'), + (0x1FFA, 'M', 'ὼ'), + (0x1FFB, 'M', 'ώ'), + (0x1FFC, 'M', 'ωι'), + (0x1FFD, '3', ' ́'), + (0x1FFE, '3', ' ̔'), + (0x1FFF, 'X'), + (0x2000, '3', ' '), + (0x200B, 'I'), + (0x200C, 'D', ''), + (0x200E, 'X'), + (0x2010, 'V'), + (0x2011, 'M', '‐'), + (0x2012, 'V'), + (0x2017, '3', ' ̳'), + (0x2018, 'V'), + (0x2024, 'X'), + (0x2027, 'V'), + (0x2028, 'X'), + (0x202F, '3', ' '), + (0x2030, 'V'), + (0x2033, 'M', '′′'), + (0x2034, 'M', '′′′'), + (0x2035, 'V'), + (0x2036, 'M', '‵‵'), + (0x2037, 'M', '‵‵‵'), + (0x2038, 'V'), + (0x203C, '3', '!!'), + (0x203D, 'V'), + (0x203E, '3', ' ̅'), + (0x203F, 'V'), + (0x2047, '3', '??'), + (0x2048, '3', '?!'), + (0x2049, '3', '!?'), + (0x204A, 'V'), + (0x2057, 'M', '′′′′'), + (0x2058, 'V'), + (0x205F, '3', ' '), + (0x2060, 'I'), + (0x2061, 'X'), + (0x2064, 'I'), + (0x2065, 'X'), + (0x2070, 'M', '0'), + (0x2071, 'M', 'i'), + (0x2072, 'X'), + (0x2074, 'M', '4'), + (0x2075, 'M', '5'), + (0x2076, 'M', '6'), + (0x2077, 'M', '7'), + (0x2078, 'M', '8'), + (0x2079, 'M', '9'), + (0x207A, '3', '+'), + (0x207B, 'M', '−'), + (0x207C, '3', '='), + (0x207D, '3', '('), + (0x207E, '3', ')'), + (0x207F, 'M', 'n'), + (0x2080, 'M', '0'), + (0x2081, 'M', '1'), + (0x2082, 'M', '2'), + (0x2083, 'M', '3'), + (0x2084, 'M', '4'), + (0x2085, 'M', '5'), + (0x2086, 'M', '6'), + (0x2087, 'M', '7'), + (0x2088, 'M', '8'), + (0x2089, 'M', '9'), + (0x208A, '3', '+'), + (0x208B, 'M', '−'), + (0x208C, '3', '='), + (0x208D, '3', '('), + (0x208E, '3', ')'), + (0x208F, 'X'), + (0x2090, 'M', 'a'), + (0x2091, 'M', 'e'), + (0x2092, 'M', 'o'), + (0x2093, 'M', 'x'), + (0x2094, 'M', 'ə'), + (0x2095, 'M', 'h'), + (0x2096, 'M', 'k'), + (0x2097, 'M', 'l'), + (0x2098, 'M', 'm'), + (0x2099, 'M', 'n'), + (0x209A, 'M', 'p'), + (0x209B, 'M', 's'), + (0x209C, 'M', 't'), + (0x209D, 'X'), + (0x20A0, 'V'), + (0x20A8, 'M', 'rs'), + (0x20A9, 'V'), + (0x20C1, 'X'), + (0x20D0, 'V'), + (0x20F1, 'X'), + (0x2100, '3', 'a/c'), + (0x2101, '3', 'a/s'), + (0x2102, 'M', 'c'), + (0x2103, 'M', '°c'), + (0x2104, 'V'), + ] + +def _seg_22() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2105, '3', 'c/o'), + (0x2106, '3', 'c/u'), + (0x2107, 'M', 'ɛ'), + (0x2108, 'V'), + (0x2109, 'M', '°f'), + (0x210A, 'M', 'g'), + (0x210B, 'M', 'h'), + (0x210F, 'M', 'ħ'), + (0x2110, 'M', 'i'), + (0x2112, 'M', 'l'), + (0x2114, 'V'), + (0x2115, 'M', 'n'), + (0x2116, 'M', 'no'), + (0x2117, 'V'), + (0x2119, 'M', 'p'), + (0x211A, 'M', 'q'), + (0x211B, 'M', 'r'), + (0x211E, 'V'), + (0x2120, 'M', 'sm'), + (0x2121, 'M', 'tel'), + (0x2122, 'M', 'tm'), + (0x2123, 'V'), + (0x2124, 'M', 'z'), + (0x2125, 'V'), + (0x2126, 'M', 'ω'), + (0x2127, 'V'), + (0x2128, 'M', 'z'), + (0x2129, 'V'), + (0x212A, 'M', 'k'), + (0x212B, 'M', 'å'), + (0x212C, 'M', 'b'), + (0x212D, 'M', 'c'), + (0x212E, 'V'), + (0x212F, 'M', 'e'), + (0x2131, 'M', 'f'), + (0x2132, 'X'), + (0x2133, 'M', 'm'), + (0x2134, 'M', 'o'), + (0x2135, 'M', 'א'), + (0x2136, 'M', 'ב'), + (0x2137, 'M', 'ג'), + (0x2138, 'M', 'ד'), + (0x2139, 'M', 'i'), + (0x213A, 'V'), + (0x213B, 'M', 'fax'), + (0x213C, 'M', 'π'), + (0x213D, 'M', 'γ'), + (0x213F, 'M', 'π'), + (0x2140, 'M', '∑'), + (0x2141, 'V'), + (0x2145, 'M', 'd'), + (0x2147, 'M', 'e'), + (0x2148, 'M', 'i'), + (0x2149, 'M', 'j'), + (0x214A, 'V'), + (0x2150, 'M', '1⁄7'), + (0x2151, 'M', '1⁄9'), + (0x2152, 'M', '1⁄10'), + (0x2153, 'M', '1⁄3'), + (0x2154, 'M', '2⁄3'), + (0x2155, 'M', '1⁄5'), + (0x2156, 'M', '2⁄5'), + (0x2157, 'M', '3⁄5'), + (0x2158, 'M', '4⁄5'), + (0x2159, 'M', '1⁄6'), + (0x215A, 'M', '5⁄6'), + (0x215B, 'M', '1⁄8'), + (0x215C, 'M', '3⁄8'), + (0x215D, 'M', '5⁄8'), + (0x215E, 'M', '7⁄8'), + (0x215F, 'M', '1⁄'), + (0x2160, 'M', 'i'), + (0x2161, 'M', 'ii'), + (0x2162, 'M', 'iii'), + (0x2163, 'M', 'iv'), + (0x2164, 'M', 'v'), + (0x2165, 'M', 'vi'), + (0x2166, 'M', 'vii'), + (0x2167, 'M', 'viii'), + (0x2168, 'M', 'ix'), + (0x2169, 'M', 'x'), + (0x216A, 'M', 'xi'), + (0x216B, 'M', 'xii'), + (0x216C, 'M', 'l'), + (0x216D, 'M', 'c'), + (0x216E, 'M', 'd'), + (0x216F, 'M', 'm'), + (0x2170, 'M', 'i'), + (0x2171, 'M', 'ii'), + (0x2172, 'M', 'iii'), + (0x2173, 'M', 'iv'), + (0x2174, 'M', 'v'), + (0x2175, 'M', 'vi'), + (0x2176, 'M', 'vii'), + (0x2177, 'M', 'viii'), + (0x2178, 'M', 'ix'), + (0x2179, 'M', 'x'), + (0x217A, 'M', 'xi'), + (0x217B, 'M', 'xii'), + (0x217C, 'M', 'l'), + ] + +def _seg_23() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x217D, 'M', 'c'), + (0x217E, 'M', 'd'), + (0x217F, 'M', 'm'), + (0x2180, 'V'), + (0x2183, 'X'), + (0x2184, 'V'), + (0x2189, 'M', '0⁄3'), + (0x218A, 'V'), + (0x218C, 'X'), + (0x2190, 'V'), + (0x222C, 'M', '∫∫'), + (0x222D, 'M', '∫∫∫'), + (0x222E, 'V'), + (0x222F, 'M', '∮∮'), + (0x2230, 'M', '∮∮∮'), + (0x2231, 'V'), + (0x2260, '3'), + (0x2261, 'V'), + (0x226E, '3'), + (0x2270, 'V'), + (0x2329, 'M', '〈'), + (0x232A, 'M', '〉'), + (0x232B, 'V'), + (0x2427, 'X'), + (0x2440, 'V'), + (0x244B, 'X'), + (0x2460, 'M', '1'), + (0x2461, 'M', '2'), + (0x2462, 'M', '3'), + (0x2463, 'M', '4'), + (0x2464, 'M', '5'), + (0x2465, 'M', '6'), + (0x2466, 'M', '7'), + (0x2467, 'M', '8'), + (0x2468, 'M', '9'), + (0x2469, 'M', '10'), + (0x246A, 'M', '11'), + (0x246B, 'M', '12'), + (0x246C, 'M', '13'), + (0x246D, 'M', '14'), + (0x246E, 'M', '15'), + (0x246F, 'M', '16'), + (0x2470, 'M', '17'), + (0x2471, 'M', '18'), + (0x2472, 'M', '19'), + (0x2473, 'M', '20'), + (0x2474, '3', '(1)'), + (0x2475, '3', '(2)'), + (0x2476, '3', '(3)'), + (0x2477, '3', '(4)'), + (0x2478, '3', '(5)'), + (0x2479, '3', '(6)'), + (0x247A, '3', '(7)'), + (0x247B, '3', '(8)'), + (0x247C, '3', '(9)'), + (0x247D, '3', '(10)'), + (0x247E, '3', '(11)'), + (0x247F, '3', '(12)'), + (0x2480, '3', '(13)'), + (0x2481, '3', '(14)'), + (0x2482, '3', '(15)'), + (0x2483, '3', '(16)'), + (0x2484, '3', '(17)'), + (0x2485, '3', '(18)'), + (0x2486, '3', '(19)'), + (0x2487, '3', '(20)'), + (0x2488, 'X'), + (0x249C, '3', '(a)'), + (0x249D, '3', '(b)'), + (0x249E, '3', '(c)'), + (0x249F, '3', '(d)'), + (0x24A0, '3', '(e)'), + (0x24A1, '3', '(f)'), + (0x24A2, '3', '(g)'), + (0x24A3, '3', '(h)'), + (0x24A4, '3', '(i)'), + (0x24A5, '3', '(j)'), + (0x24A6, '3', '(k)'), + (0x24A7, '3', '(l)'), + (0x24A8, '3', '(m)'), + (0x24A9, '3', '(n)'), + (0x24AA, '3', '(o)'), + (0x24AB, '3', '(p)'), + (0x24AC, '3', '(q)'), + (0x24AD, '3', '(r)'), + (0x24AE, '3', '(s)'), + (0x24AF, '3', '(t)'), + (0x24B0, '3', '(u)'), + (0x24B1, '3', '(v)'), + (0x24B2, '3', '(w)'), + (0x24B3, '3', '(x)'), + (0x24B4, '3', '(y)'), + (0x24B5, '3', '(z)'), + (0x24B6, 'M', 'a'), + (0x24B7, 'M', 'b'), + (0x24B8, 'M', 'c'), + (0x24B9, 'M', 'd'), + (0x24BA, 'M', 'e'), + (0x24BB, 'M', 'f'), + (0x24BC, 'M', 'g'), + ] + +def _seg_24() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x24BD, 'M', 'h'), + (0x24BE, 'M', 'i'), + (0x24BF, 'M', 'j'), + (0x24C0, 'M', 'k'), + (0x24C1, 'M', 'l'), + (0x24C2, 'M', 'm'), + (0x24C3, 'M', 'n'), + (0x24C4, 'M', 'o'), + (0x24C5, 'M', 'p'), + (0x24C6, 'M', 'q'), + (0x24C7, 'M', 'r'), + (0x24C8, 'M', 's'), + (0x24C9, 'M', 't'), + (0x24CA, 'M', 'u'), + (0x24CB, 'M', 'v'), + (0x24CC, 'M', 'w'), + (0x24CD, 'M', 'x'), + (0x24CE, 'M', 'y'), + (0x24CF, 'M', 'z'), + (0x24D0, 'M', 'a'), + (0x24D1, 'M', 'b'), + (0x24D2, 'M', 'c'), + (0x24D3, 'M', 'd'), + (0x24D4, 'M', 'e'), + (0x24D5, 'M', 'f'), + (0x24D6, 'M', 'g'), + (0x24D7, 'M', 'h'), + (0x24D8, 'M', 'i'), + (0x24D9, 'M', 'j'), + (0x24DA, 'M', 'k'), + (0x24DB, 'M', 'l'), + (0x24DC, 'M', 'm'), + (0x24DD, 'M', 'n'), + (0x24DE, 'M', 'o'), + (0x24DF, 'M', 'p'), + (0x24E0, 'M', 'q'), + (0x24E1, 'M', 'r'), + (0x24E2, 'M', 's'), + (0x24E3, 'M', 't'), + (0x24E4, 'M', 'u'), + (0x24E5, 'M', 'v'), + (0x24E6, 'M', 'w'), + (0x24E7, 'M', 'x'), + (0x24E8, 'M', 'y'), + (0x24E9, 'M', 'z'), + (0x24EA, 'M', '0'), + (0x24EB, 'V'), + (0x2A0C, 'M', '∫∫∫∫'), + (0x2A0D, 'V'), + (0x2A74, '3', '::='), + (0x2A75, '3', '=='), + (0x2A76, '3', '==='), + (0x2A77, 'V'), + (0x2ADC, 'M', '⫝̸'), + (0x2ADD, 'V'), + (0x2B74, 'X'), + (0x2B76, 'V'), + (0x2B96, 'X'), + (0x2B97, 'V'), + (0x2C00, 'M', 'ⰰ'), + (0x2C01, 'M', 'ⰱ'), + (0x2C02, 'M', 'ⰲ'), + (0x2C03, 'M', 'ⰳ'), + (0x2C04, 'M', 'ⰴ'), + (0x2C05, 'M', 'ⰵ'), + (0x2C06, 'M', 'ⰶ'), + (0x2C07, 'M', 'ⰷ'), + (0x2C08, 'M', 'ⰸ'), + (0x2C09, 'M', 'ⰹ'), + (0x2C0A, 'M', 'ⰺ'), + (0x2C0B, 'M', 'ⰻ'), + (0x2C0C, 'M', 'ⰼ'), + (0x2C0D, 'M', 'ⰽ'), + (0x2C0E, 'M', 'ⰾ'), + (0x2C0F, 'M', 'ⰿ'), + (0x2C10, 'M', 'ⱀ'), + (0x2C11, 'M', 'ⱁ'), + (0x2C12, 'M', 'ⱂ'), + (0x2C13, 'M', 'ⱃ'), + (0x2C14, 'M', 'ⱄ'), + (0x2C15, 'M', 'ⱅ'), + (0x2C16, 'M', 'ⱆ'), + (0x2C17, 'M', 'ⱇ'), + (0x2C18, 'M', 'ⱈ'), + (0x2C19, 'M', 'ⱉ'), + (0x2C1A, 'M', 'ⱊ'), + (0x2C1B, 'M', 'ⱋ'), + (0x2C1C, 'M', 'ⱌ'), + (0x2C1D, 'M', 'ⱍ'), + (0x2C1E, 'M', 'ⱎ'), + (0x2C1F, 'M', 'ⱏ'), + (0x2C20, 'M', 'ⱐ'), + (0x2C21, 'M', 'ⱑ'), + (0x2C22, 'M', 'ⱒ'), + (0x2C23, 'M', 'ⱓ'), + (0x2C24, 'M', 'ⱔ'), + (0x2C25, 'M', 'ⱕ'), + (0x2C26, 'M', 'ⱖ'), + (0x2C27, 'M', 'ⱗ'), + (0x2C28, 'M', 'ⱘ'), + ] + +def _seg_25() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2C29, 'M', 'ⱙ'), + (0x2C2A, 'M', 'ⱚ'), + (0x2C2B, 'M', 'ⱛ'), + (0x2C2C, 'M', 'ⱜ'), + (0x2C2D, 'M', 'ⱝ'), + (0x2C2E, 'M', 'ⱞ'), + (0x2C2F, 'M', 'ⱟ'), + (0x2C30, 'V'), + (0x2C60, 'M', 'ⱡ'), + (0x2C61, 'V'), + (0x2C62, 'M', 'ɫ'), + (0x2C63, 'M', 'ᵽ'), + (0x2C64, 'M', 'ɽ'), + (0x2C65, 'V'), + (0x2C67, 'M', 'ⱨ'), + (0x2C68, 'V'), + (0x2C69, 'M', 'ⱪ'), + (0x2C6A, 'V'), + (0x2C6B, 'M', 'ⱬ'), + (0x2C6C, 'V'), + (0x2C6D, 'M', 'ɑ'), + (0x2C6E, 'M', 'ɱ'), + (0x2C6F, 'M', 'ɐ'), + (0x2C70, 'M', 'ɒ'), + (0x2C71, 'V'), + (0x2C72, 'M', 'ⱳ'), + (0x2C73, 'V'), + (0x2C75, 'M', 'ⱶ'), + (0x2C76, 'V'), + (0x2C7C, 'M', 'j'), + (0x2C7D, 'M', 'v'), + (0x2C7E, 'M', 'ȿ'), + (0x2C7F, 'M', 'ɀ'), + (0x2C80, 'M', 'ⲁ'), + (0x2C81, 'V'), + (0x2C82, 'M', 'ⲃ'), + (0x2C83, 'V'), + (0x2C84, 'M', 'ⲅ'), + (0x2C85, 'V'), + (0x2C86, 'M', 'ⲇ'), + (0x2C87, 'V'), + (0x2C88, 'M', 'ⲉ'), + (0x2C89, 'V'), + (0x2C8A, 'M', 'ⲋ'), + (0x2C8B, 'V'), + (0x2C8C, 'M', 'ⲍ'), + (0x2C8D, 'V'), + (0x2C8E, 'M', 'ⲏ'), + (0x2C8F, 'V'), + (0x2C90, 'M', 'ⲑ'), + (0x2C91, 'V'), + (0x2C92, 'M', 'ⲓ'), + (0x2C93, 'V'), + (0x2C94, 'M', 'ⲕ'), + (0x2C95, 'V'), + (0x2C96, 'M', 'ⲗ'), + (0x2C97, 'V'), + (0x2C98, 'M', 'ⲙ'), + (0x2C99, 'V'), + (0x2C9A, 'M', 'ⲛ'), + (0x2C9B, 'V'), + (0x2C9C, 'M', 'ⲝ'), + (0x2C9D, 'V'), + (0x2C9E, 'M', 'ⲟ'), + (0x2C9F, 'V'), + (0x2CA0, 'M', 'ⲡ'), + (0x2CA1, 'V'), + (0x2CA2, 'M', 'ⲣ'), + (0x2CA3, 'V'), + (0x2CA4, 'M', 'ⲥ'), + (0x2CA5, 'V'), + (0x2CA6, 'M', 'ⲧ'), + (0x2CA7, 'V'), + (0x2CA8, 'M', 'ⲩ'), + (0x2CA9, 'V'), + (0x2CAA, 'M', 'ⲫ'), + (0x2CAB, 'V'), + (0x2CAC, 'M', 'ⲭ'), + (0x2CAD, 'V'), + (0x2CAE, 'M', 'ⲯ'), + (0x2CAF, 'V'), + (0x2CB0, 'M', 'ⲱ'), + (0x2CB1, 'V'), + (0x2CB2, 'M', 'ⲳ'), + (0x2CB3, 'V'), + (0x2CB4, 'M', 'ⲵ'), + (0x2CB5, 'V'), + (0x2CB6, 'M', 'ⲷ'), + (0x2CB7, 'V'), + (0x2CB8, 'M', 'ⲹ'), + (0x2CB9, 'V'), + (0x2CBA, 'M', 'ⲻ'), + (0x2CBB, 'V'), + (0x2CBC, 'M', 'ⲽ'), + (0x2CBD, 'V'), + (0x2CBE, 'M', 'ⲿ'), + (0x2CBF, 'V'), + (0x2CC0, 'M', 'ⳁ'), + (0x2CC1, 'V'), + (0x2CC2, 'M', 'ⳃ'), + ] + +def _seg_26() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2CC3, 'V'), + (0x2CC4, 'M', 'ⳅ'), + (0x2CC5, 'V'), + (0x2CC6, 'M', 'ⳇ'), + (0x2CC7, 'V'), + (0x2CC8, 'M', 'ⳉ'), + (0x2CC9, 'V'), + (0x2CCA, 'M', 'ⳋ'), + (0x2CCB, 'V'), + (0x2CCC, 'M', 'ⳍ'), + (0x2CCD, 'V'), + (0x2CCE, 'M', 'ⳏ'), + (0x2CCF, 'V'), + (0x2CD0, 'M', 'ⳑ'), + (0x2CD1, 'V'), + (0x2CD2, 'M', 'ⳓ'), + (0x2CD3, 'V'), + (0x2CD4, 'M', 'ⳕ'), + (0x2CD5, 'V'), + (0x2CD6, 'M', 'ⳗ'), + (0x2CD7, 'V'), + (0x2CD8, 'M', 'ⳙ'), + (0x2CD9, 'V'), + (0x2CDA, 'M', 'ⳛ'), + (0x2CDB, 'V'), + (0x2CDC, 'M', 'ⳝ'), + (0x2CDD, 'V'), + (0x2CDE, 'M', 'ⳟ'), + (0x2CDF, 'V'), + (0x2CE0, 'M', 'ⳡ'), + (0x2CE1, 'V'), + (0x2CE2, 'M', 'ⳣ'), + (0x2CE3, 'V'), + (0x2CEB, 'M', 'ⳬ'), + (0x2CEC, 'V'), + (0x2CED, 'M', 'ⳮ'), + (0x2CEE, 'V'), + (0x2CF2, 'M', 'ⳳ'), + (0x2CF3, 'V'), + (0x2CF4, 'X'), + (0x2CF9, 'V'), + (0x2D26, 'X'), + (0x2D27, 'V'), + (0x2D28, 'X'), + (0x2D2D, 'V'), + (0x2D2E, 'X'), + (0x2D30, 'V'), + (0x2D68, 'X'), + (0x2D6F, 'M', 'ⵡ'), + (0x2D70, 'V'), + (0x2D71, 'X'), + (0x2D7F, 'V'), + (0x2D97, 'X'), + (0x2DA0, 'V'), + (0x2DA7, 'X'), + (0x2DA8, 'V'), + (0x2DAF, 'X'), + (0x2DB0, 'V'), + (0x2DB7, 'X'), + (0x2DB8, 'V'), + (0x2DBF, 'X'), + (0x2DC0, 'V'), + (0x2DC7, 'X'), + (0x2DC8, 'V'), + (0x2DCF, 'X'), + (0x2DD0, 'V'), + (0x2DD7, 'X'), + (0x2DD8, 'V'), + (0x2DDF, 'X'), + (0x2DE0, 'V'), + (0x2E5E, 'X'), + (0x2E80, 'V'), + (0x2E9A, 'X'), + (0x2E9B, 'V'), + (0x2E9F, 'M', '母'), + (0x2EA0, 'V'), + (0x2EF3, 'M', '龟'), + (0x2EF4, 'X'), + (0x2F00, 'M', '一'), + (0x2F01, 'M', '丨'), + (0x2F02, 'M', '丶'), + (0x2F03, 'M', '丿'), + (0x2F04, 'M', '乙'), + (0x2F05, 'M', '亅'), + (0x2F06, 'M', '二'), + (0x2F07, 'M', '亠'), + (0x2F08, 'M', '人'), + (0x2F09, 'M', '儿'), + (0x2F0A, 'M', '入'), + (0x2F0B, 'M', '八'), + (0x2F0C, 'M', '冂'), + (0x2F0D, 'M', '冖'), + (0x2F0E, 'M', '冫'), + (0x2F0F, 'M', '几'), + (0x2F10, 'M', '凵'), + (0x2F11, 'M', '刀'), + (0x2F12, 'M', '力'), + (0x2F13, 'M', '勹'), + (0x2F14, 'M', '匕'), + (0x2F15, 'M', '匚'), + ] + +def _seg_27() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F16, 'M', '匸'), + (0x2F17, 'M', '十'), + (0x2F18, 'M', '卜'), + (0x2F19, 'M', '卩'), + (0x2F1A, 'M', '厂'), + (0x2F1B, 'M', '厶'), + (0x2F1C, 'M', '又'), + (0x2F1D, 'M', '口'), + (0x2F1E, 'M', '囗'), + (0x2F1F, 'M', '土'), + (0x2F20, 'M', '士'), + (0x2F21, 'M', '夂'), + (0x2F22, 'M', '夊'), + (0x2F23, 'M', '夕'), + (0x2F24, 'M', '大'), + (0x2F25, 'M', '女'), + (0x2F26, 'M', '子'), + (0x2F27, 'M', '宀'), + (0x2F28, 'M', '寸'), + (0x2F29, 'M', '小'), + (0x2F2A, 'M', '尢'), + (0x2F2B, 'M', '尸'), + (0x2F2C, 'M', '屮'), + (0x2F2D, 'M', '山'), + (0x2F2E, 'M', '巛'), + (0x2F2F, 'M', '工'), + (0x2F30, 'M', '己'), + (0x2F31, 'M', '巾'), + (0x2F32, 'M', '干'), + (0x2F33, 'M', '幺'), + (0x2F34, 'M', '广'), + (0x2F35, 'M', '廴'), + (0x2F36, 'M', '廾'), + (0x2F37, 'M', '弋'), + (0x2F38, 'M', '弓'), + (0x2F39, 'M', '彐'), + (0x2F3A, 'M', '彡'), + (0x2F3B, 'M', '彳'), + (0x2F3C, 'M', '心'), + (0x2F3D, 'M', '戈'), + (0x2F3E, 'M', '戶'), + (0x2F3F, 'M', '手'), + (0x2F40, 'M', '支'), + (0x2F41, 'M', '攴'), + (0x2F42, 'M', '文'), + (0x2F43, 'M', '斗'), + (0x2F44, 'M', '斤'), + (0x2F45, 'M', '方'), + (0x2F46, 'M', '无'), + (0x2F47, 'M', '日'), + (0x2F48, 'M', '曰'), + (0x2F49, 'M', '月'), + (0x2F4A, 'M', '木'), + (0x2F4B, 'M', '欠'), + (0x2F4C, 'M', '止'), + (0x2F4D, 'M', '歹'), + (0x2F4E, 'M', '殳'), + (0x2F4F, 'M', '毋'), + (0x2F50, 'M', '比'), + (0x2F51, 'M', '毛'), + (0x2F52, 'M', '氏'), + (0x2F53, 'M', '气'), + (0x2F54, 'M', '水'), + (0x2F55, 'M', '火'), + (0x2F56, 'M', '爪'), + (0x2F57, 'M', '父'), + (0x2F58, 'M', '爻'), + (0x2F59, 'M', '爿'), + (0x2F5A, 'M', '片'), + (0x2F5B, 'M', '牙'), + (0x2F5C, 'M', '牛'), + (0x2F5D, 'M', '犬'), + (0x2F5E, 'M', '玄'), + (0x2F5F, 'M', '玉'), + (0x2F60, 'M', '瓜'), + (0x2F61, 'M', '瓦'), + (0x2F62, 'M', '甘'), + (0x2F63, 'M', '生'), + (0x2F64, 'M', '用'), + (0x2F65, 'M', '田'), + (0x2F66, 'M', '疋'), + (0x2F67, 'M', '疒'), + (0x2F68, 'M', '癶'), + (0x2F69, 'M', '白'), + (0x2F6A, 'M', '皮'), + (0x2F6B, 'M', '皿'), + (0x2F6C, 'M', '目'), + (0x2F6D, 'M', '矛'), + (0x2F6E, 'M', '矢'), + (0x2F6F, 'M', '石'), + (0x2F70, 'M', '示'), + (0x2F71, 'M', '禸'), + (0x2F72, 'M', '禾'), + (0x2F73, 'M', '穴'), + (0x2F74, 'M', '立'), + (0x2F75, 'M', '竹'), + (0x2F76, 'M', '米'), + (0x2F77, 'M', '糸'), + (0x2F78, 'M', '缶'), + (0x2F79, 'M', '网'), + ] + +def _seg_28() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F7A, 'M', '羊'), + (0x2F7B, 'M', '羽'), + (0x2F7C, 'M', '老'), + (0x2F7D, 'M', '而'), + (0x2F7E, 'M', '耒'), + (0x2F7F, 'M', '耳'), + (0x2F80, 'M', '聿'), + (0x2F81, 'M', '肉'), + (0x2F82, 'M', '臣'), + (0x2F83, 'M', '自'), + (0x2F84, 'M', '至'), + (0x2F85, 'M', '臼'), + (0x2F86, 'M', '舌'), + (0x2F87, 'M', '舛'), + (0x2F88, 'M', '舟'), + (0x2F89, 'M', '艮'), + (0x2F8A, 'M', '色'), + (0x2F8B, 'M', '艸'), + (0x2F8C, 'M', '虍'), + (0x2F8D, 'M', '虫'), + (0x2F8E, 'M', '血'), + (0x2F8F, 'M', '行'), + (0x2F90, 'M', '衣'), + (0x2F91, 'M', '襾'), + (0x2F92, 'M', '見'), + (0x2F93, 'M', '角'), + (0x2F94, 'M', '言'), + (0x2F95, 'M', '谷'), + (0x2F96, 'M', '豆'), + (0x2F97, 'M', '豕'), + (0x2F98, 'M', '豸'), + (0x2F99, 'M', '貝'), + (0x2F9A, 'M', '赤'), + (0x2F9B, 'M', '走'), + (0x2F9C, 'M', '足'), + (0x2F9D, 'M', '身'), + (0x2F9E, 'M', '車'), + (0x2F9F, 'M', '辛'), + (0x2FA0, 'M', '辰'), + (0x2FA1, 'M', '辵'), + (0x2FA2, 'M', '邑'), + (0x2FA3, 'M', '酉'), + (0x2FA4, 'M', '釆'), + (0x2FA5, 'M', '里'), + (0x2FA6, 'M', '金'), + (0x2FA7, 'M', '長'), + (0x2FA8, 'M', '門'), + (0x2FA9, 'M', '阜'), + (0x2FAA, 'M', '隶'), + (0x2FAB, 'M', '隹'), + (0x2FAC, 'M', '雨'), + (0x2FAD, 'M', '靑'), + (0x2FAE, 'M', '非'), + (0x2FAF, 'M', '面'), + (0x2FB0, 'M', '革'), + (0x2FB1, 'M', '韋'), + (0x2FB2, 'M', '韭'), + (0x2FB3, 'M', '音'), + (0x2FB4, 'M', '頁'), + (0x2FB5, 'M', '風'), + (0x2FB6, 'M', '飛'), + (0x2FB7, 'M', '食'), + (0x2FB8, 'M', '首'), + (0x2FB9, 'M', '香'), + (0x2FBA, 'M', '馬'), + (0x2FBB, 'M', '骨'), + (0x2FBC, 'M', '高'), + (0x2FBD, 'M', '髟'), + (0x2FBE, 'M', '鬥'), + (0x2FBF, 'M', '鬯'), + (0x2FC0, 'M', '鬲'), + (0x2FC1, 'M', '鬼'), + (0x2FC2, 'M', '魚'), + (0x2FC3, 'M', '鳥'), + (0x2FC4, 'M', '鹵'), + (0x2FC5, 'M', '鹿'), + (0x2FC6, 'M', '麥'), + (0x2FC7, 'M', '麻'), + (0x2FC8, 'M', '黃'), + (0x2FC9, 'M', '黍'), + (0x2FCA, 'M', '黑'), + (0x2FCB, 'M', '黹'), + (0x2FCC, 'M', '黽'), + (0x2FCD, 'M', '鼎'), + (0x2FCE, 'M', '鼓'), + (0x2FCF, 'M', '鼠'), + (0x2FD0, 'M', '鼻'), + (0x2FD1, 'M', '齊'), + (0x2FD2, 'M', '齒'), + (0x2FD3, 'M', '龍'), + (0x2FD4, 'M', '龜'), + (0x2FD5, 'M', '龠'), + (0x2FD6, 'X'), + (0x3000, '3', ' '), + (0x3001, 'V'), + (0x3002, 'M', '.'), + (0x3003, 'V'), + (0x3036, 'M', '〒'), + (0x3037, 'V'), + (0x3038, 'M', '十'), + ] + +def _seg_29() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3039, 'M', '卄'), + (0x303A, 'M', '卅'), + (0x303B, 'V'), + (0x3040, 'X'), + (0x3041, 'V'), + (0x3097, 'X'), + (0x3099, 'V'), + (0x309B, '3', ' ゙'), + (0x309C, '3', ' ゚'), + (0x309D, 'V'), + (0x309F, 'M', 'より'), + (0x30A0, 'V'), + (0x30FF, 'M', 'コト'), + (0x3100, 'X'), + (0x3105, 'V'), + (0x3130, 'X'), + (0x3131, 'M', 'ᄀ'), + (0x3132, 'M', 'ᄁ'), + (0x3133, 'M', 'ᆪ'), + (0x3134, 'M', 'ᄂ'), + (0x3135, 'M', 'ᆬ'), + (0x3136, 'M', 'ᆭ'), + (0x3137, 'M', 'ᄃ'), + (0x3138, 'M', 'ᄄ'), + (0x3139, 'M', 'ᄅ'), + (0x313A, 'M', 'ᆰ'), + (0x313B, 'M', 'ᆱ'), + (0x313C, 'M', 'ᆲ'), + (0x313D, 'M', 'ᆳ'), + (0x313E, 'M', 'ᆴ'), + (0x313F, 'M', 'ᆵ'), + (0x3140, 'M', 'ᄚ'), + (0x3141, 'M', 'ᄆ'), + (0x3142, 'M', 'ᄇ'), + (0x3143, 'M', 'ᄈ'), + (0x3144, 'M', 'ᄡ'), + (0x3145, 'M', 'ᄉ'), + (0x3146, 'M', 'ᄊ'), + (0x3147, 'M', 'ᄋ'), + (0x3148, 'M', 'ᄌ'), + (0x3149, 'M', 'ᄍ'), + (0x314A, 'M', 'ᄎ'), + (0x314B, 'M', 'ᄏ'), + (0x314C, 'M', 'ᄐ'), + (0x314D, 'M', 'ᄑ'), + (0x314E, 'M', 'ᄒ'), + (0x314F, 'M', 'ᅡ'), + (0x3150, 'M', 'ᅢ'), + (0x3151, 'M', 'ᅣ'), + (0x3152, 'M', 'ᅤ'), + (0x3153, 'M', 'ᅥ'), + (0x3154, 'M', 'ᅦ'), + (0x3155, 'M', 'ᅧ'), + (0x3156, 'M', 'ᅨ'), + (0x3157, 'M', 'ᅩ'), + (0x3158, 'M', 'ᅪ'), + (0x3159, 'M', 'ᅫ'), + (0x315A, 'M', 'ᅬ'), + (0x315B, 'M', 'ᅭ'), + (0x315C, 'M', 'ᅮ'), + (0x315D, 'M', 'ᅯ'), + (0x315E, 'M', 'ᅰ'), + (0x315F, 'M', 'ᅱ'), + (0x3160, 'M', 'ᅲ'), + (0x3161, 'M', 'ᅳ'), + (0x3162, 'M', 'ᅴ'), + (0x3163, 'M', 'ᅵ'), + (0x3164, 'X'), + (0x3165, 'M', 'ᄔ'), + (0x3166, 'M', 'ᄕ'), + (0x3167, 'M', 'ᇇ'), + (0x3168, 'M', 'ᇈ'), + (0x3169, 'M', 'ᇌ'), + (0x316A, 'M', 'ᇎ'), + (0x316B, 'M', 'ᇓ'), + (0x316C, 'M', 'ᇗ'), + (0x316D, 'M', 'ᇙ'), + (0x316E, 'M', 'ᄜ'), + (0x316F, 'M', 'ᇝ'), + (0x3170, 'M', 'ᇟ'), + (0x3171, 'M', 'ᄝ'), + (0x3172, 'M', 'ᄞ'), + (0x3173, 'M', 'ᄠ'), + (0x3174, 'M', 'ᄢ'), + (0x3175, 'M', 'ᄣ'), + (0x3176, 'M', 'ᄧ'), + (0x3177, 'M', 'ᄩ'), + (0x3178, 'M', 'ᄫ'), + (0x3179, 'M', 'ᄬ'), + (0x317A, 'M', 'ᄭ'), + (0x317B, 'M', 'ᄮ'), + (0x317C, 'M', 'ᄯ'), + (0x317D, 'M', 'ᄲ'), + (0x317E, 'M', 'ᄶ'), + (0x317F, 'M', 'ᅀ'), + (0x3180, 'M', 'ᅇ'), + (0x3181, 'M', 'ᅌ'), + (0x3182, 'M', 'ᇱ'), + (0x3183, 'M', 'ᇲ'), + (0x3184, 'M', 'ᅗ'), + ] + +def _seg_30() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3185, 'M', 'ᅘ'), + (0x3186, 'M', 'ᅙ'), + (0x3187, 'M', 'ᆄ'), + (0x3188, 'M', 'ᆅ'), + (0x3189, 'M', 'ᆈ'), + (0x318A, 'M', 'ᆑ'), + (0x318B, 'M', 'ᆒ'), + (0x318C, 'M', 'ᆔ'), + (0x318D, 'M', 'ᆞ'), + (0x318E, 'M', 'ᆡ'), + (0x318F, 'X'), + (0x3190, 'V'), + (0x3192, 'M', '一'), + (0x3193, 'M', '二'), + (0x3194, 'M', '三'), + (0x3195, 'M', '四'), + (0x3196, 'M', '上'), + (0x3197, 'M', '中'), + (0x3198, 'M', '下'), + (0x3199, 'M', '甲'), + (0x319A, 'M', '乙'), + (0x319B, 'M', '丙'), + (0x319C, 'M', '丁'), + (0x319D, 'M', '天'), + (0x319E, 'M', '地'), + (0x319F, 'M', '人'), + (0x31A0, 'V'), + (0x31E4, 'X'), + (0x31F0, 'V'), + (0x3200, '3', '(ᄀ)'), + (0x3201, '3', '(ᄂ)'), + (0x3202, '3', '(ᄃ)'), + (0x3203, '3', '(ᄅ)'), + (0x3204, '3', '(ᄆ)'), + (0x3205, '3', '(ᄇ)'), + (0x3206, '3', '(ᄉ)'), + (0x3207, '3', '(ᄋ)'), + (0x3208, '3', '(ᄌ)'), + (0x3209, '3', '(ᄎ)'), + (0x320A, '3', '(ᄏ)'), + (0x320B, '3', '(ᄐ)'), + (0x320C, '3', '(ᄑ)'), + (0x320D, '3', '(ᄒ)'), + (0x320E, '3', '(가)'), + (0x320F, '3', '(나)'), + (0x3210, '3', '(다)'), + (0x3211, '3', '(라)'), + (0x3212, '3', '(마)'), + (0x3213, '3', '(바)'), + (0x3214, '3', '(사)'), + (0x3215, '3', '(아)'), + (0x3216, '3', '(자)'), + (0x3217, '3', '(차)'), + (0x3218, '3', '(카)'), + (0x3219, '3', '(타)'), + (0x321A, '3', '(파)'), + (0x321B, '3', '(하)'), + (0x321C, '3', '(주)'), + (0x321D, '3', '(오전)'), + (0x321E, '3', '(오후)'), + (0x321F, 'X'), + (0x3220, '3', '(一)'), + (0x3221, '3', '(二)'), + (0x3222, '3', '(三)'), + (0x3223, '3', '(四)'), + (0x3224, '3', '(五)'), + (0x3225, '3', '(六)'), + (0x3226, '3', '(七)'), + (0x3227, '3', '(八)'), + (0x3228, '3', '(九)'), + (0x3229, '3', '(十)'), + (0x322A, '3', '(月)'), + (0x322B, '3', '(火)'), + (0x322C, '3', '(水)'), + (0x322D, '3', '(木)'), + (0x322E, '3', '(金)'), + (0x322F, '3', '(土)'), + (0x3230, '3', '(日)'), + (0x3231, '3', '(株)'), + (0x3232, '3', '(有)'), + (0x3233, '3', '(社)'), + (0x3234, '3', '(名)'), + (0x3235, '3', '(特)'), + (0x3236, '3', '(財)'), + (0x3237, '3', '(祝)'), + (0x3238, '3', '(労)'), + (0x3239, '3', '(代)'), + (0x323A, '3', '(呼)'), + (0x323B, '3', '(学)'), + (0x323C, '3', '(監)'), + (0x323D, '3', '(企)'), + (0x323E, '3', '(資)'), + (0x323F, '3', '(協)'), + (0x3240, '3', '(祭)'), + (0x3241, '3', '(休)'), + (0x3242, '3', '(自)'), + (0x3243, '3', '(至)'), + (0x3244, 'M', '問'), + (0x3245, 'M', '幼'), + (0x3246, 'M', '文'), + ] + +def _seg_31() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3247, 'M', '箏'), + (0x3248, 'V'), + (0x3250, 'M', 'pte'), + (0x3251, 'M', '21'), + (0x3252, 'M', '22'), + (0x3253, 'M', '23'), + (0x3254, 'M', '24'), + (0x3255, 'M', '25'), + (0x3256, 'M', '26'), + (0x3257, 'M', '27'), + (0x3258, 'M', '28'), + (0x3259, 'M', '29'), + (0x325A, 'M', '30'), + (0x325B, 'M', '31'), + (0x325C, 'M', '32'), + (0x325D, 'M', '33'), + (0x325E, 'M', '34'), + (0x325F, 'M', '35'), + (0x3260, 'M', 'ᄀ'), + (0x3261, 'M', 'ᄂ'), + (0x3262, 'M', 'ᄃ'), + (0x3263, 'M', 'ᄅ'), + (0x3264, 'M', 'ᄆ'), + (0x3265, 'M', 'ᄇ'), + (0x3266, 'M', 'ᄉ'), + (0x3267, 'M', 'ᄋ'), + (0x3268, 'M', 'ᄌ'), + (0x3269, 'M', 'ᄎ'), + (0x326A, 'M', 'ᄏ'), + (0x326B, 'M', 'ᄐ'), + (0x326C, 'M', 'ᄑ'), + (0x326D, 'M', 'ᄒ'), + (0x326E, 'M', '가'), + (0x326F, 'M', '나'), + (0x3270, 'M', '다'), + (0x3271, 'M', '라'), + (0x3272, 'M', '마'), + (0x3273, 'M', '바'), + (0x3274, 'M', '사'), + (0x3275, 'M', '아'), + (0x3276, 'M', '자'), + (0x3277, 'M', '차'), + (0x3278, 'M', '카'), + (0x3279, 'M', '타'), + (0x327A, 'M', '파'), + (0x327B, 'M', '하'), + (0x327C, 'M', '참고'), + (0x327D, 'M', '주의'), + (0x327E, 'M', '우'), + (0x327F, 'V'), + (0x3280, 'M', '一'), + (0x3281, 'M', '二'), + (0x3282, 'M', '三'), + (0x3283, 'M', '四'), + (0x3284, 'M', '五'), + (0x3285, 'M', '六'), + (0x3286, 'M', '七'), + (0x3287, 'M', '八'), + (0x3288, 'M', '九'), + (0x3289, 'M', '十'), + (0x328A, 'M', '月'), + (0x328B, 'M', '火'), + (0x328C, 'M', '水'), + (0x328D, 'M', '木'), + (0x328E, 'M', '金'), + (0x328F, 'M', '土'), + (0x3290, 'M', '日'), + (0x3291, 'M', '株'), + (0x3292, 'M', '有'), + (0x3293, 'M', '社'), + (0x3294, 'M', '名'), + (0x3295, 'M', '特'), + (0x3296, 'M', '財'), + (0x3297, 'M', '祝'), + (0x3298, 'M', '労'), + (0x3299, 'M', '秘'), + (0x329A, 'M', '男'), + (0x329B, 'M', '女'), + (0x329C, 'M', '適'), + (0x329D, 'M', '優'), + (0x329E, 'M', '印'), + (0x329F, 'M', '注'), + (0x32A0, 'M', '項'), + (0x32A1, 'M', '休'), + (0x32A2, 'M', '写'), + (0x32A3, 'M', '正'), + (0x32A4, 'M', '上'), + (0x32A5, 'M', '中'), + (0x32A6, 'M', '下'), + (0x32A7, 'M', '左'), + (0x32A8, 'M', '右'), + (0x32A9, 'M', '医'), + (0x32AA, 'M', '宗'), + (0x32AB, 'M', '学'), + (0x32AC, 'M', '監'), + (0x32AD, 'M', '企'), + (0x32AE, 'M', '資'), + (0x32AF, 'M', '協'), + (0x32B0, 'M', '夜'), + (0x32B1, 'M', '36'), + ] + +def _seg_32() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x32B2, 'M', '37'), + (0x32B3, 'M', '38'), + (0x32B4, 'M', '39'), + (0x32B5, 'M', '40'), + (0x32B6, 'M', '41'), + (0x32B7, 'M', '42'), + (0x32B8, 'M', '43'), + (0x32B9, 'M', '44'), + (0x32BA, 'M', '45'), + (0x32BB, 'M', '46'), + (0x32BC, 'M', '47'), + (0x32BD, 'M', '48'), + (0x32BE, 'M', '49'), + (0x32BF, 'M', '50'), + (0x32C0, 'M', '1月'), + (0x32C1, 'M', '2月'), + (0x32C2, 'M', '3月'), + (0x32C3, 'M', '4月'), + (0x32C4, 'M', '5月'), + (0x32C5, 'M', '6月'), + (0x32C6, 'M', '7月'), + (0x32C7, 'M', '8月'), + (0x32C8, 'M', '9月'), + (0x32C9, 'M', '10月'), + (0x32CA, 'M', '11月'), + (0x32CB, 'M', '12月'), + (0x32CC, 'M', 'hg'), + (0x32CD, 'M', 'erg'), + (0x32CE, 'M', 'ev'), + (0x32CF, 'M', 'ltd'), + (0x32D0, 'M', 'ア'), + (0x32D1, 'M', 'イ'), + (0x32D2, 'M', 'ウ'), + (0x32D3, 'M', 'エ'), + (0x32D4, 'M', 'オ'), + (0x32D5, 'M', 'カ'), + (0x32D6, 'M', 'キ'), + (0x32D7, 'M', 'ク'), + (0x32D8, 'M', 'ケ'), + (0x32D9, 'M', 'コ'), + (0x32DA, 'M', 'サ'), + (0x32DB, 'M', 'シ'), + (0x32DC, 'M', 'ス'), + (0x32DD, 'M', 'セ'), + (0x32DE, 'M', 'ソ'), + (0x32DF, 'M', 'タ'), + (0x32E0, 'M', 'チ'), + (0x32E1, 'M', 'ツ'), + (0x32E2, 'M', 'テ'), + (0x32E3, 'M', 'ト'), + (0x32E4, 'M', 'ナ'), + (0x32E5, 'M', 'ニ'), + (0x32E6, 'M', 'ヌ'), + (0x32E7, 'M', 'ネ'), + (0x32E8, 'M', 'ノ'), + (0x32E9, 'M', 'ハ'), + (0x32EA, 'M', 'ヒ'), + (0x32EB, 'M', 'フ'), + (0x32EC, 'M', 'ヘ'), + (0x32ED, 'M', 'ホ'), + (0x32EE, 'M', 'マ'), + (0x32EF, 'M', 'ミ'), + (0x32F0, 'M', 'ム'), + (0x32F1, 'M', 'メ'), + (0x32F2, 'M', 'モ'), + (0x32F3, 'M', 'ヤ'), + (0x32F4, 'M', 'ユ'), + (0x32F5, 'M', 'ヨ'), + (0x32F6, 'M', 'ラ'), + (0x32F7, 'M', 'リ'), + (0x32F8, 'M', 'ル'), + (0x32F9, 'M', 'レ'), + (0x32FA, 'M', 'ロ'), + (0x32FB, 'M', 'ワ'), + (0x32FC, 'M', 'ヰ'), + (0x32FD, 'M', 'ヱ'), + (0x32FE, 'M', 'ヲ'), + (0x32FF, 'M', '令和'), + (0x3300, 'M', 'アパート'), + (0x3301, 'M', 'アルファ'), + (0x3302, 'M', 'アンペア'), + (0x3303, 'M', 'アール'), + (0x3304, 'M', 'イニング'), + (0x3305, 'M', 'インチ'), + (0x3306, 'M', 'ウォン'), + (0x3307, 'M', 'エスクード'), + (0x3308, 'M', 'エーカー'), + (0x3309, 'M', 'オンス'), + (0x330A, 'M', 'オーム'), + (0x330B, 'M', 'カイリ'), + (0x330C, 'M', 'カラット'), + (0x330D, 'M', 'カロリー'), + (0x330E, 'M', 'ガロン'), + (0x330F, 'M', 'ガンマ'), + (0x3310, 'M', 'ギガ'), + (0x3311, 'M', 'ギニー'), + (0x3312, 'M', 'キュリー'), + (0x3313, 'M', 'ギルダー'), + (0x3314, 'M', 'キロ'), + (0x3315, 'M', 'キログラム'), + ] + +def _seg_33() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x3316, 'M', 'キロメートル'), + (0x3317, 'M', 'キロワット'), + (0x3318, 'M', 'グラム'), + (0x3319, 'M', 'グラムトン'), + (0x331A, 'M', 'クルゼイロ'), + (0x331B, 'M', 'クローネ'), + (0x331C, 'M', 'ケース'), + (0x331D, 'M', 'コルナ'), + (0x331E, 'M', 'コーポ'), + (0x331F, 'M', 'サイクル'), + (0x3320, 'M', 'サンチーム'), + (0x3321, 'M', 'シリング'), + (0x3322, 'M', 'センチ'), + (0x3323, 'M', 'セント'), + (0x3324, 'M', 'ダース'), + (0x3325, 'M', 'デシ'), + (0x3326, 'M', 'ドル'), + (0x3327, 'M', 'トン'), + (0x3328, 'M', 'ナノ'), + (0x3329, 'M', 'ノット'), + (0x332A, 'M', 'ハイツ'), + (0x332B, 'M', 'パーセント'), + (0x332C, 'M', 'パーツ'), + (0x332D, 'M', 'バーレル'), + (0x332E, 'M', 'ピアストル'), + (0x332F, 'M', 'ピクル'), + (0x3330, 'M', 'ピコ'), + (0x3331, 'M', 'ビル'), + (0x3332, 'M', 'ファラッド'), + (0x3333, 'M', 'フィート'), + (0x3334, 'M', 'ブッシェル'), + (0x3335, 'M', 'フラン'), + (0x3336, 'M', 'ヘクタール'), + (0x3337, 'M', 'ペソ'), + (0x3338, 'M', 'ペニヒ'), + (0x3339, 'M', 'ヘルツ'), + (0x333A, 'M', 'ペンス'), + (0x333B, 'M', 'ページ'), + (0x333C, 'M', 'ベータ'), + (0x333D, 'M', 'ポイント'), + (0x333E, 'M', 'ボルト'), + (0x333F, 'M', 'ホン'), + (0x3340, 'M', 'ポンド'), + (0x3341, 'M', 'ホール'), + (0x3342, 'M', 'ホーン'), + (0x3343, 'M', 'マイクロ'), + (0x3344, 'M', 'マイル'), + (0x3345, 'M', 'マッハ'), + (0x3346, 'M', 'マルク'), + (0x3347, 'M', 'マンション'), + (0x3348, 'M', 'ミクロン'), + (0x3349, 'M', 'ミリ'), + (0x334A, 'M', 'ミリバール'), + (0x334B, 'M', 'メガ'), + (0x334C, 'M', 'メガトン'), + (0x334D, 'M', 'メートル'), + (0x334E, 'M', 'ヤード'), + (0x334F, 'M', 'ヤール'), + (0x3350, 'M', 'ユアン'), + (0x3351, 'M', 'リットル'), + (0x3352, 'M', 'リラ'), + (0x3353, 'M', 'ルピー'), + (0x3354, 'M', 'ルーブル'), + (0x3355, 'M', 'レム'), + (0x3356, 'M', 'レントゲン'), + (0x3357, 'M', 'ワット'), + (0x3358, 'M', '0点'), + (0x3359, 'M', '1点'), + (0x335A, 'M', '2点'), + (0x335B, 'M', '3点'), + (0x335C, 'M', '4点'), + (0x335D, 'M', '5点'), + (0x335E, 'M', '6点'), + (0x335F, 'M', '7点'), + (0x3360, 'M', '8点'), + (0x3361, 'M', '9点'), + (0x3362, 'M', '10点'), + (0x3363, 'M', '11点'), + (0x3364, 'M', '12点'), + (0x3365, 'M', '13点'), + (0x3366, 'M', '14点'), + (0x3367, 'M', '15点'), + (0x3368, 'M', '16点'), + (0x3369, 'M', '17点'), + (0x336A, 'M', '18点'), + (0x336B, 'M', '19点'), + (0x336C, 'M', '20点'), + (0x336D, 'M', '21点'), + (0x336E, 'M', '22点'), + (0x336F, 'M', '23点'), + (0x3370, 'M', '24点'), + (0x3371, 'M', 'hpa'), + (0x3372, 'M', 'da'), + (0x3373, 'M', 'au'), + (0x3374, 'M', 'bar'), + (0x3375, 'M', 'ov'), + (0x3376, 'M', 'pc'), + (0x3377, 'M', 'dm'), + (0x3378, 'M', 'dm2'), + (0x3379, 'M', 'dm3'), + ] + +def _seg_34() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x337A, 'M', 'iu'), + (0x337B, 'M', '平成'), + (0x337C, 'M', '昭和'), + (0x337D, 'M', '大正'), + (0x337E, 'M', '明治'), + (0x337F, 'M', '株式会社'), + (0x3380, 'M', 'pa'), + (0x3381, 'M', 'na'), + (0x3382, 'M', 'μa'), + (0x3383, 'M', 'ma'), + (0x3384, 'M', 'ka'), + (0x3385, 'M', 'kb'), + (0x3386, 'M', 'mb'), + (0x3387, 'M', 'gb'), + (0x3388, 'M', 'cal'), + (0x3389, 'M', 'kcal'), + (0x338A, 'M', 'pf'), + (0x338B, 'M', 'nf'), + (0x338C, 'M', 'μf'), + (0x338D, 'M', 'μg'), + (0x338E, 'M', 'mg'), + (0x338F, 'M', 'kg'), + (0x3390, 'M', 'hz'), + (0x3391, 'M', 'khz'), + (0x3392, 'M', 'mhz'), + (0x3393, 'M', 'ghz'), + (0x3394, 'M', 'thz'), + (0x3395, 'M', 'μl'), + (0x3396, 'M', 'ml'), + (0x3397, 'M', 'dl'), + (0x3398, 'M', 'kl'), + (0x3399, 'M', 'fm'), + (0x339A, 'M', 'nm'), + (0x339B, 'M', 'μm'), + (0x339C, 'M', 'mm'), + (0x339D, 'M', 'cm'), + (0x339E, 'M', 'km'), + (0x339F, 'M', 'mm2'), + (0x33A0, 'M', 'cm2'), + (0x33A1, 'M', 'm2'), + (0x33A2, 'M', 'km2'), + (0x33A3, 'M', 'mm3'), + (0x33A4, 'M', 'cm3'), + (0x33A5, 'M', 'm3'), + (0x33A6, 'M', 'km3'), + (0x33A7, 'M', 'm∕s'), + (0x33A8, 'M', 'm∕s2'), + (0x33A9, 'M', 'pa'), + (0x33AA, 'M', 'kpa'), + (0x33AB, 'M', 'mpa'), + (0x33AC, 'M', 'gpa'), + (0x33AD, 'M', 'rad'), + (0x33AE, 'M', 'rad∕s'), + (0x33AF, 'M', 'rad∕s2'), + (0x33B0, 'M', 'ps'), + (0x33B1, 'M', 'ns'), + (0x33B2, 'M', 'μs'), + (0x33B3, 'M', 'ms'), + (0x33B4, 'M', 'pv'), + (0x33B5, 'M', 'nv'), + (0x33B6, 'M', 'μv'), + (0x33B7, 'M', 'mv'), + (0x33B8, 'M', 'kv'), + (0x33B9, 'M', 'mv'), + (0x33BA, 'M', 'pw'), + (0x33BB, 'M', 'nw'), + (0x33BC, 'M', 'μw'), + (0x33BD, 'M', 'mw'), + (0x33BE, 'M', 'kw'), + (0x33BF, 'M', 'mw'), + (0x33C0, 'M', 'kω'), + (0x33C1, 'M', 'mω'), + (0x33C2, 'X'), + (0x33C3, 'M', 'bq'), + (0x33C4, 'M', 'cc'), + (0x33C5, 'M', 'cd'), + (0x33C6, 'M', 'c∕kg'), + (0x33C7, 'X'), + (0x33C8, 'M', 'db'), + (0x33C9, 'M', 'gy'), + (0x33CA, 'M', 'ha'), + (0x33CB, 'M', 'hp'), + (0x33CC, 'M', 'in'), + (0x33CD, 'M', 'kk'), + (0x33CE, 'M', 'km'), + (0x33CF, 'M', 'kt'), + (0x33D0, 'M', 'lm'), + (0x33D1, 'M', 'ln'), + (0x33D2, 'M', 'log'), + (0x33D3, 'M', 'lx'), + (0x33D4, 'M', 'mb'), + (0x33D5, 'M', 'mil'), + (0x33D6, 'M', 'mol'), + (0x33D7, 'M', 'ph'), + (0x33D8, 'X'), + (0x33D9, 'M', 'ppm'), + (0x33DA, 'M', 'pr'), + (0x33DB, 'M', 'sr'), + (0x33DC, 'M', 'sv'), + (0x33DD, 'M', 'wb'), + ] + +def _seg_35() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x33DE, 'M', 'v∕m'), + (0x33DF, 'M', 'a∕m'), + (0x33E0, 'M', '1日'), + (0x33E1, 'M', '2日'), + (0x33E2, 'M', '3日'), + (0x33E3, 'M', '4日'), + (0x33E4, 'M', '5日'), + (0x33E5, 'M', '6日'), + (0x33E6, 'M', '7日'), + (0x33E7, 'M', '8日'), + (0x33E8, 'M', '9日'), + (0x33E9, 'M', '10日'), + (0x33EA, 'M', '11日'), + (0x33EB, 'M', '12日'), + (0x33EC, 'M', '13日'), + (0x33ED, 'M', '14日'), + (0x33EE, 'M', '15日'), + (0x33EF, 'M', '16日'), + (0x33F0, 'M', '17日'), + (0x33F1, 'M', '18日'), + (0x33F2, 'M', '19日'), + (0x33F3, 'M', '20日'), + (0x33F4, 'M', '21日'), + (0x33F5, 'M', '22日'), + (0x33F6, 'M', '23日'), + (0x33F7, 'M', '24日'), + (0x33F8, 'M', '25日'), + (0x33F9, 'M', '26日'), + (0x33FA, 'M', '27日'), + (0x33FB, 'M', '28日'), + (0x33FC, 'M', '29日'), + (0x33FD, 'M', '30日'), + (0x33FE, 'M', '31日'), + (0x33FF, 'M', 'gal'), + (0x3400, 'V'), + (0xA48D, 'X'), + (0xA490, 'V'), + (0xA4C7, 'X'), + (0xA4D0, 'V'), + (0xA62C, 'X'), + (0xA640, 'M', 'ꙁ'), + (0xA641, 'V'), + (0xA642, 'M', 'ꙃ'), + (0xA643, 'V'), + (0xA644, 'M', 'ꙅ'), + (0xA645, 'V'), + (0xA646, 'M', 'ꙇ'), + (0xA647, 'V'), + (0xA648, 'M', 'ꙉ'), + (0xA649, 'V'), + (0xA64A, 'M', 'ꙋ'), + (0xA64B, 'V'), + (0xA64C, 'M', 'ꙍ'), + (0xA64D, 'V'), + (0xA64E, 'M', 'ꙏ'), + (0xA64F, 'V'), + (0xA650, 'M', 'ꙑ'), + (0xA651, 'V'), + (0xA652, 'M', 'ꙓ'), + (0xA653, 'V'), + (0xA654, 'M', 'ꙕ'), + (0xA655, 'V'), + (0xA656, 'M', 'ꙗ'), + (0xA657, 'V'), + (0xA658, 'M', 'ꙙ'), + (0xA659, 'V'), + (0xA65A, 'M', 'ꙛ'), + (0xA65B, 'V'), + (0xA65C, 'M', 'ꙝ'), + (0xA65D, 'V'), + (0xA65E, 'M', 'ꙟ'), + (0xA65F, 'V'), + (0xA660, 'M', 'ꙡ'), + (0xA661, 'V'), + (0xA662, 'M', 'ꙣ'), + (0xA663, 'V'), + (0xA664, 'M', 'ꙥ'), + (0xA665, 'V'), + (0xA666, 'M', 'ꙧ'), + (0xA667, 'V'), + (0xA668, 'M', 'ꙩ'), + (0xA669, 'V'), + (0xA66A, 'M', 'ꙫ'), + (0xA66B, 'V'), + (0xA66C, 'M', 'ꙭ'), + (0xA66D, 'V'), + (0xA680, 'M', 'ꚁ'), + (0xA681, 'V'), + (0xA682, 'M', 'ꚃ'), + (0xA683, 'V'), + (0xA684, 'M', 'ꚅ'), + (0xA685, 'V'), + (0xA686, 'M', 'ꚇ'), + (0xA687, 'V'), + (0xA688, 'M', 'ꚉ'), + (0xA689, 'V'), + (0xA68A, 'M', 'ꚋ'), + (0xA68B, 'V'), + (0xA68C, 'M', 'ꚍ'), + (0xA68D, 'V'), + ] + +def _seg_36() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA68E, 'M', 'ꚏ'), + (0xA68F, 'V'), + (0xA690, 'M', 'ꚑ'), + (0xA691, 'V'), + (0xA692, 'M', 'ꚓ'), + (0xA693, 'V'), + (0xA694, 'M', 'ꚕ'), + (0xA695, 'V'), + (0xA696, 'M', 'ꚗ'), + (0xA697, 'V'), + (0xA698, 'M', 'ꚙ'), + (0xA699, 'V'), + (0xA69A, 'M', 'ꚛ'), + (0xA69B, 'V'), + (0xA69C, 'M', 'ъ'), + (0xA69D, 'M', 'ь'), + (0xA69E, 'V'), + (0xA6F8, 'X'), + (0xA700, 'V'), + (0xA722, 'M', 'ꜣ'), + (0xA723, 'V'), + (0xA724, 'M', 'ꜥ'), + (0xA725, 'V'), + (0xA726, 'M', 'ꜧ'), + (0xA727, 'V'), + (0xA728, 'M', 'ꜩ'), + (0xA729, 'V'), + (0xA72A, 'M', 'ꜫ'), + (0xA72B, 'V'), + (0xA72C, 'M', 'ꜭ'), + (0xA72D, 'V'), + (0xA72E, 'M', 'ꜯ'), + (0xA72F, 'V'), + (0xA732, 'M', 'ꜳ'), + (0xA733, 'V'), + (0xA734, 'M', 'ꜵ'), + (0xA735, 'V'), + (0xA736, 'M', 'ꜷ'), + (0xA737, 'V'), + (0xA738, 'M', 'ꜹ'), + (0xA739, 'V'), + (0xA73A, 'M', 'ꜻ'), + (0xA73B, 'V'), + (0xA73C, 'M', 'ꜽ'), + (0xA73D, 'V'), + (0xA73E, 'M', 'ꜿ'), + (0xA73F, 'V'), + (0xA740, 'M', 'ꝁ'), + (0xA741, 'V'), + (0xA742, 'M', 'ꝃ'), + (0xA743, 'V'), + (0xA744, 'M', 'ꝅ'), + (0xA745, 'V'), + (0xA746, 'M', 'ꝇ'), + (0xA747, 'V'), + (0xA748, 'M', 'ꝉ'), + (0xA749, 'V'), + (0xA74A, 'M', 'ꝋ'), + (0xA74B, 'V'), + (0xA74C, 'M', 'ꝍ'), + (0xA74D, 'V'), + (0xA74E, 'M', 'ꝏ'), + (0xA74F, 'V'), + (0xA750, 'M', 'ꝑ'), + (0xA751, 'V'), + (0xA752, 'M', 'ꝓ'), + (0xA753, 'V'), + (0xA754, 'M', 'ꝕ'), + (0xA755, 'V'), + (0xA756, 'M', 'ꝗ'), + (0xA757, 'V'), + (0xA758, 'M', 'ꝙ'), + (0xA759, 'V'), + (0xA75A, 'M', 'ꝛ'), + (0xA75B, 'V'), + (0xA75C, 'M', 'ꝝ'), + (0xA75D, 'V'), + (0xA75E, 'M', 'ꝟ'), + (0xA75F, 'V'), + (0xA760, 'M', 'ꝡ'), + (0xA761, 'V'), + (0xA762, 'M', 'ꝣ'), + (0xA763, 'V'), + (0xA764, 'M', 'ꝥ'), + (0xA765, 'V'), + (0xA766, 'M', 'ꝧ'), + (0xA767, 'V'), + (0xA768, 'M', 'ꝩ'), + (0xA769, 'V'), + (0xA76A, 'M', 'ꝫ'), + (0xA76B, 'V'), + (0xA76C, 'M', 'ꝭ'), + (0xA76D, 'V'), + (0xA76E, 'M', 'ꝯ'), + (0xA76F, 'V'), + (0xA770, 'M', 'ꝯ'), + (0xA771, 'V'), + (0xA779, 'M', 'ꝺ'), + (0xA77A, 'V'), + (0xA77B, 'M', 'ꝼ'), + ] + +def _seg_37() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA77C, 'V'), + (0xA77D, 'M', 'ᵹ'), + (0xA77E, 'M', 'ꝿ'), + (0xA77F, 'V'), + (0xA780, 'M', 'ꞁ'), + (0xA781, 'V'), + (0xA782, 'M', 'ꞃ'), + (0xA783, 'V'), + (0xA784, 'M', 'ꞅ'), + (0xA785, 'V'), + (0xA786, 'M', 'ꞇ'), + (0xA787, 'V'), + (0xA78B, 'M', 'ꞌ'), + (0xA78C, 'V'), + (0xA78D, 'M', 'ɥ'), + (0xA78E, 'V'), + (0xA790, 'M', 'ꞑ'), + (0xA791, 'V'), + (0xA792, 'M', 'ꞓ'), + (0xA793, 'V'), + (0xA796, 'M', 'ꞗ'), + (0xA797, 'V'), + (0xA798, 'M', 'ꞙ'), + (0xA799, 'V'), + (0xA79A, 'M', 'ꞛ'), + (0xA79B, 'V'), + (0xA79C, 'M', 'ꞝ'), + (0xA79D, 'V'), + (0xA79E, 'M', 'ꞟ'), + (0xA79F, 'V'), + (0xA7A0, 'M', 'ꞡ'), + (0xA7A1, 'V'), + (0xA7A2, 'M', 'ꞣ'), + (0xA7A3, 'V'), + (0xA7A4, 'M', 'ꞥ'), + (0xA7A5, 'V'), + (0xA7A6, 'M', 'ꞧ'), + (0xA7A7, 'V'), + (0xA7A8, 'M', 'ꞩ'), + (0xA7A9, 'V'), + (0xA7AA, 'M', 'ɦ'), + (0xA7AB, 'M', 'ɜ'), + (0xA7AC, 'M', 'ɡ'), + (0xA7AD, 'M', 'ɬ'), + (0xA7AE, 'M', 'ɪ'), + (0xA7AF, 'V'), + (0xA7B0, 'M', 'ʞ'), + (0xA7B1, 'M', 'ʇ'), + (0xA7B2, 'M', 'ʝ'), + (0xA7B3, 'M', 'ꭓ'), + (0xA7B4, 'M', 'ꞵ'), + (0xA7B5, 'V'), + (0xA7B6, 'M', 'ꞷ'), + (0xA7B7, 'V'), + (0xA7B8, 'M', 'ꞹ'), + (0xA7B9, 'V'), + (0xA7BA, 'M', 'ꞻ'), + (0xA7BB, 'V'), + (0xA7BC, 'M', 'ꞽ'), + (0xA7BD, 'V'), + (0xA7BE, 'M', 'ꞿ'), + (0xA7BF, 'V'), + (0xA7C0, 'M', 'ꟁ'), + (0xA7C1, 'V'), + (0xA7C2, 'M', 'ꟃ'), + (0xA7C3, 'V'), + (0xA7C4, 'M', 'ꞔ'), + (0xA7C5, 'M', 'ʂ'), + (0xA7C6, 'M', 'ᶎ'), + (0xA7C7, 'M', 'ꟈ'), + (0xA7C8, 'V'), + (0xA7C9, 'M', 'ꟊ'), + (0xA7CA, 'V'), + (0xA7CB, 'X'), + (0xA7D0, 'M', 'ꟑ'), + (0xA7D1, 'V'), + (0xA7D2, 'X'), + (0xA7D3, 'V'), + (0xA7D4, 'X'), + (0xA7D5, 'V'), + (0xA7D6, 'M', 'ꟗ'), + (0xA7D7, 'V'), + (0xA7D8, 'M', 'ꟙ'), + (0xA7D9, 'V'), + (0xA7DA, 'X'), + (0xA7F2, 'M', 'c'), + (0xA7F3, 'M', 'f'), + (0xA7F4, 'M', 'q'), + (0xA7F5, 'M', 'ꟶ'), + (0xA7F6, 'V'), + (0xA7F8, 'M', 'ħ'), + (0xA7F9, 'M', 'œ'), + (0xA7FA, 'V'), + (0xA82D, 'X'), + (0xA830, 'V'), + (0xA83A, 'X'), + (0xA840, 'V'), + (0xA878, 'X'), + (0xA880, 'V'), + (0xA8C6, 'X'), + ] + +def _seg_38() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xA8CE, 'V'), + (0xA8DA, 'X'), + (0xA8E0, 'V'), + (0xA954, 'X'), + (0xA95F, 'V'), + (0xA97D, 'X'), + (0xA980, 'V'), + (0xA9CE, 'X'), + (0xA9CF, 'V'), + (0xA9DA, 'X'), + (0xA9DE, 'V'), + (0xA9FF, 'X'), + (0xAA00, 'V'), + (0xAA37, 'X'), + (0xAA40, 'V'), + (0xAA4E, 'X'), + (0xAA50, 'V'), + (0xAA5A, 'X'), + (0xAA5C, 'V'), + (0xAAC3, 'X'), + (0xAADB, 'V'), + (0xAAF7, 'X'), + (0xAB01, 'V'), + (0xAB07, 'X'), + (0xAB09, 'V'), + (0xAB0F, 'X'), + (0xAB11, 'V'), + (0xAB17, 'X'), + (0xAB20, 'V'), + (0xAB27, 'X'), + (0xAB28, 'V'), + (0xAB2F, 'X'), + (0xAB30, 'V'), + (0xAB5C, 'M', 'ꜧ'), + (0xAB5D, 'M', 'ꬷ'), + (0xAB5E, 'M', 'ɫ'), + (0xAB5F, 'M', 'ꭒ'), + (0xAB60, 'V'), + (0xAB69, 'M', 'ʍ'), + (0xAB6A, 'V'), + (0xAB6C, 'X'), + (0xAB70, 'M', 'Ꭰ'), + (0xAB71, 'M', 'Ꭱ'), + (0xAB72, 'M', 'Ꭲ'), + (0xAB73, 'M', 'Ꭳ'), + (0xAB74, 'M', 'Ꭴ'), + (0xAB75, 'M', 'Ꭵ'), + (0xAB76, 'M', 'Ꭶ'), + (0xAB77, 'M', 'Ꭷ'), + (0xAB78, 'M', 'Ꭸ'), + (0xAB79, 'M', 'Ꭹ'), + (0xAB7A, 'M', 'Ꭺ'), + (0xAB7B, 'M', 'Ꭻ'), + (0xAB7C, 'M', 'Ꭼ'), + (0xAB7D, 'M', 'Ꭽ'), + (0xAB7E, 'M', 'Ꭾ'), + (0xAB7F, 'M', 'Ꭿ'), + (0xAB80, 'M', 'Ꮀ'), + (0xAB81, 'M', 'Ꮁ'), + (0xAB82, 'M', 'Ꮂ'), + (0xAB83, 'M', 'Ꮃ'), + (0xAB84, 'M', 'Ꮄ'), + (0xAB85, 'M', 'Ꮅ'), + (0xAB86, 'M', 'Ꮆ'), + (0xAB87, 'M', 'Ꮇ'), + (0xAB88, 'M', 'Ꮈ'), + (0xAB89, 'M', 'Ꮉ'), + (0xAB8A, 'M', 'Ꮊ'), + (0xAB8B, 'M', 'Ꮋ'), + (0xAB8C, 'M', 'Ꮌ'), + (0xAB8D, 'M', 'Ꮍ'), + (0xAB8E, 'M', 'Ꮎ'), + (0xAB8F, 'M', 'Ꮏ'), + (0xAB90, 'M', 'Ꮐ'), + (0xAB91, 'M', 'Ꮑ'), + (0xAB92, 'M', 'Ꮒ'), + (0xAB93, 'M', 'Ꮓ'), + (0xAB94, 'M', 'Ꮔ'), + (0xAB95, 'M', 'Ꮕ'), + (0xAB96, 'M', 'Ꮖ'), + (0xAB97, 'M', 'Ꮗ'), + (0xAB98, 'M', 'Ꮘ'), + (0xAB99, 'M', 'Ꮙ'), + (0xAB9A, 'M', 'Ꮚ'), + (0xAB9B, 'M', 'Ꮛ'), + (0xAB9C, 'M', 'Ꮜ'), + (0xAB9D, 'M', 'Ꮝ'), + (0xAB9E, 'M', 'Ꮞ'), + (0xAB9F, 'M', 'Ꮟ'), + (0xABA0, 'M', 'Ꮠ'), + (0xABA1, 'M', 'Ꮡ'), + (0xABA2, 'M', 'Ꮢ'), + (0xABA3, 'M', 'Ꮣ'), + (0xABA4, 'M', 'Ꮤ'), + (0xABA5, 'M', 'Ꮥ'), + (0xABA6, 'M', 'Ꮦ'), + (0xABA7, 'M', 'Ꮧ'), + (0xABA8, 'M', 'Ꮨ'), + (0xABA9, 'M', 'Ꮩ'), + (0xABAA, 'M', 'Ꮪ'), + ] + +def _seg_39() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xABAB, 'M', 'Ꮫ'), + (0xABAC, 'M', 'Ꮬ'), + (0xABAD, 'M', 'Ꮭ'), + (0xABAE, 'M', 'Ꮮ'), + (0xABAF, 'M', 'Ꮯ'), + (0xABB0, 'M', 'Ꮰ'), + (0xABB1, 'M', 'Ꮱ'), + (0xABB2, 'M', 'Ꮲ'), + (0xABB3, 'M', 'Ꮳ'), + (0xABB4, 'M', 'Ꮴ'), + (0xABB5, 'M', 'Ꮵ'), + (0xABB6, 'M', 'Ꮶ'), + (0xABB7, 'M', 'Ꮷ'), + (0xABB8, 'M', 'Ꮸ'), + (0xABB9, 'M', 'Ꮹ'), + (0xABBA, 'M', 'Ꮺ'), + (0xABBB, 'M', 'Ꮻ'), + (0xABBC, 'M', 'Ꮼ'), + (0xABBD, 'M', 'Ꮽ'), + (0xABBE, 'M', 'Ꮾ'), + (0xABBF, 'M', 'Ꮿ'), + (0xABC0, 'V'), + (0xABEE, 'X'), + (0xABF0, 'V'), + (0xABFA, 'X'), + (0xAC00, 'V'), + (0xD7A4, 'X'), + (0xD7B0, 'V'), + (0xD7C7, 'X'), + (0xD7CB, 'V'), + (0xD7FC, 'X'), + (0xF900, 'M', '豈'), + (0xF901, 'M', '更'), + (0xF902, 'M', '車'), + (0xF903, 'M', '賈'), + (0xF904, 'M', '滑'), + (0xF905, 'M', '串'), + (0xF906, 'M', '句'), + (0xF907, 'M', '龜'), + (0xF909, 'M', '契'), + (0xF90A, 'M', '金'), + (0xF90B, 'M', '喇'), + (0xF90C, 'M', '奈'), + (0xF90D, 'M', '懶'), + (0xF90E, 'M', '癩'), + (0xF90F, 'M', '羅'), + (0xF910, 'M', '蘿'), + (0xF911, 'M', '螺'), + (0xF912, 'M', '裸'), + (0xF913, 'M', '邏'), + (0xF914, 'M', '樂'), + (0xF915, 'M', '洛'), + (0xF916, 'M', '烙'), + (0xF917, 'M', '珞'), + (0xF918, 'M', '落'), + (0xF919, 'M', '酪'), + (0xF91A, 'M', '駱'), + (0xF91B, 'M', '亂'), + (0xF91C, 'M', '卵'), + (0xF91D, 'M', '欄'), + (0xF91E, 'M', '爛'), + (0xF91F, 'M', '蘭'), + (0xF920, 'M', '鸞'), + (0xF921, 'M', '嵐'), + (0xF922, 'M', '濫'), + (0xF923, 'M', '藍'), + (0xF924, 'M', '襤'), + (0xF925, 'M', '拉'), + (0xF926, 'M', '臘'), + (0xF927, 'M', '蠟'), + (0xF928, 'M', '廊'), + (0xF929, 'M', '朗'), + (0xF92A, 'M', '浪'), + (0xF92B, 'M', '狼'), + (0xF92C, 'M', '郎'), + (0xF92D, 'M', '來'), + (0xF92E, 'M', '冷'), + (0xF92F, 'M', '勞'), + (0xF930, 'M', '擄'), + (0xF931, 'M', '櫓'), + (0xF932, 'M', '爐'), + (0xF933, 'M', '盧'), + (0xF934, 'M', '老'), + (0xF935, 'M', '蘆'), + (0xF936, 'M', '虜'), + (0xF937, 'M', '路'), + (0xF938, 'M', '露'), + (0xF939, 'M', '魯'), + (0xF93A, 'M', '鷺'), + (0xF93B, 'M', '碌'), + (0xF93C, 'M', '祿'), + (0xF93D, 'M', '綠'), + (0xF93E, 'M', '菉'), + (0xF93F, 'M', '錄'), + (0xF940, 'M', '鹿'), + (0xF941, 'M', '論'), + (0xF942, 'M', '壟'), + (0xF943, 'M', '弄'), + (0xF944, 'M', '籠'), + (0xF945, 'M', '聾'), + ] + +def _seg_40() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xF946, 'M', '牢'), + (0xF947, 'M', '磊'), + (0xF948, 'M', '賂'), + (0xF949, 'M', '雷'), + (0xF94A, 'M', '壘'), + (0xF94B, 'M', '屢'), + (0xF94C, 'M', '樓'), + (0xF94D, 'M', '淚'), + (0xF94E, 'M', '漏'), + (0xF94F, 'M', '累'), + (0xF950, 'M', '縷'), + (0xF951, 'M', '陋'), + (0xF952, 'M', '勒'), + (0xF953, 'M', '肋'), + (0xF954, 'M', '凜'), + (0xF955, 'M', '凌'), + (0xF956, 'M', '稜'), + (0xF957, 'M', '綾'), + (0xF958, 'M', '菱'), + (0xF959, 'M', '陵'), + (0xF95A, 'M', '讀'), + (0xF95B, 'M', '拏'), + (0xF95C, 'M', '樂'), + (0xF95D, 'M', '諾'), + (0xF95E, 'M', '丹'), + (0xF95F, 'M', '寧'), + (0xF960, 'M', '怒'), + (0xF961, 'M', '率'), + (0xF962, 'M', '異'), + (0xF963, 'M', '北'), + (0xF964, 'M', '磻'), + (0xF965, 'M', '便'), + (0xF966, 'M', '復'), + (0xF967, 'M', '不'), + (0xF968, 'M', '泌'), + (0xF969, 'M', '數'), + (0xF96A, 'M', '索'), + (0xF96B, 'M', '參'), + (0xF96C, 'M', '塞'), + (0xF96D, 'M', '省'), + (0xF96E, 'M', '葉'), + (0xF96F, 'M', '說'), + (0xF970, 'M', '殺'), + (0xF971, 'M', '辰'), + (0xF972, 'M', '沈'), + (0xF973, 'M', '拾'), + (0xF974, 'M', '若'), + (0xF975, 'M', '掠'), + (0xF976, 'M', '略'), + (0xF977, 'M', '亮'), + (0xF978, 'M', '兩'), + (0xF979, 'M', '凉'), + (0xF97A, 'M', '梁'), + (0xF97B, 'M', '糧'), + (0xF97C, 'M', '良'), + (0xF97D, 'M', '諒'), + (0xF97E, 'M', '量'), + (0xF97F, 'M', '勵'), + (0xF980, 'M', '呂'), + (0xF981, 'M', '女'), + (0xF982, 'M', '廬'), + (0xF983, 'M', '旅'), + (0xF984, 'M', '濾'), + (0xF985, 'M', '礪'), + (0xF986, 'M', '閭'), + (0xF987, 'M', '驪'), + (0xF988, 'M', '麗'), + (0xF989, 'M', '黎'), + (0xF98A, 'M', '力'), + (0xF98B, 'M', '曆'), + (0xF98C, 'M', '歷'), + (0xF98D, 'M', '轢'), + (0xF98E, 'M', '年'), + (0xF98F, 'M', '憐'), + (0xF990, 'M', '戀'), + (0xF991, 'M', '撚'), + (0xF992, 'M', '漣'), + (0xF993, 'M', '煉'), + (0xF994, 'M', '璉'), + (0xF995, 'M', '秊'), + (0xF996, 'M', '練'), + (0xF997, 'M', '聯'), + (0xF998, 'M', '輦'), + (0xF999, 'M', '蓮'), + (0xF99A, 'M', '連'), + (0xF99B, 'M', '鍊'), + (0xF99C, 'M', '列'), + (0xF99D, 'M', '劣'), + (0xF99E, 'M', '咽'), + (0xF99F, 'M', '烈'), + (0xF9A0, 'M', '裂'), + (0xF9A1, 'M', '說'), + (0xF9A2, 'M', '廉'), + (0xF9A3, 'M', '念'), + (0xF9A4, 'M', '捻'), + (0xF9A5, 'M', '殮'), + (0xF9A6, 'M', '簾'), + (0xF9A7, 'M', '獵'), + (0xF9A8, 'M', '令'), + (0xF9A9, 'M', '囹'), + ] + +def _seg_41() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xF9AA, 'M', '寧'), + (0xF9AB, 'M', '嶺'), + (0xF9AC, 'M', '怜'), + (0xF9AD, 'M', '玲'), + (0xF9AE, 'M', '瑩'), + (0xF9AF, 'M', '羚'), + (0xF9B0, 'M', '聆'), + (0xF9B1, 'M', '鈴'), + (0xF9B2, 'M', '零'), + (0xF9B3, 'M', '靈'), + (0xF9B4, 'M', '領'), + (0xF9B5, 'M', '例'), + (0xF9B6, 'M', '禮'), + (0xF9B7, 'M', '醴'), + (0xF9B8, 'M', '隸'), + (0xF9B9, 'M', '惡'), + (0xF9BA, 'M', '了'), + (0xF9BB, 'M', '僚'), + (0xF9BC, 'M', '寮'), + (0xF9BD, 'M', '尿'), + (0xF9BE, 'M', '料'), + (0xF9BF, 'M', '樂'), + (0xF9C0, 'M', '燎'), + (0xF9C1, 'M', '療'), + (0xF9C2, 'M', '蓼'), + (0xF9C3, 'M', '遼'), + (0xF9C4, 'M', '龍'), + (0xF9C5, 'M', '暈'), + (0xF9C6, 'M', '阮'), + (0xF9C7, 'M', '劉'), + (0xF9C8, 'M', '杻'), + (0xF9C9, 'M', '柳'), + (0xF9CA, 'M', '流'), + (0xF9CB, 'M', '溜'), + (0xF9CC, 'M', '琉'), + (0xF9CD, 'M', '留'), + (0xF9CE, 'M', '硫'), + (0xF9CF, 'M', '紐'), + (0xF9D0, 'M', '類'), + (0xF9D1, 'M', '六'), + (0xF9D2, 'M', '戮'), + (0xF9D3, 'M', '陸'), + (0xF9D4, 'M', '倫'), + (0xF9D5, 'M', '崙'), + (0xF9D6, 'M', '淪'), + (0xF9D7, 'M', '輪'), + (0xF9D8, 'M', '律'), + (0xF9D9, 'M', '慄'), + (0xF9DA, 'M', '栗'), + (0xF9DB, 'M', '率'), + (0xF9DC, 'M', '隆'), + (0xF9DD, 'M', '利'), + (0xF9DE, 'M', '吏'), + (0xF9DF, 'M', '履'), + (0xF9E0, 'M', '易'), + (0xF9E1, 'M', '李'), + (0xF9E2, 'M', '梨'), + (0xF9E3, 'M', '泥'), + (0xF9E4, 'M', '理'), + (0xF9E5, 'M', '痢'), + (0xF9E6, 'M', '罹'), + (0xF9E7, 'M', '裏'), + (0xF9E8, 'M', '裡'), + (0xF9E9, 'M', '里'), + (0xF9EA, 'M', '離'), + (0xF9EB, 'M', '匿'), + (0xF9EC, 'M', '溺'), + (0xF9ED, 'M', '吝'), + (0xF9EE, 'M', '燐'), + (0xF9EF, 'M', '璘'), + (0xF9F0, 'M', '藺'), + (0xF9F1, 'M', '隣'), + (0xF9F2, 'M', '鱗'), + (0xF9F3, 'M', '麟'), + (0xF9F4, 'M', '林'), + (0xF9F5, 'M', '淋'), + (0xF9F6, 'M', '臨'), + (0xF9F7, 'M', '立'), + (0xF9F8, 'M', '笠'), + (0xF9F9, 'M', '粒'), + (0xF9FA, 'M', '狀'), + (0xF9FB, 'M', '炙'), + (0xF9FC, 'M', '識'), + (0xF9FD, 'M', '什'), + (0xF9FE, 'M', '茶'), + (0xF9FF, 'M', '刺'), + (0xFA00, 'M', '切'), + (0xFA01, 'M', '度'), + (0xFA02, 'M', '拓'), + (0xFA03, 'M', '糖'), + (0xFA04, 'M', '宅'), + (0xFA05, 'M', '洞'), + (0xFA06, 'M', '暴'), + (0xFA07, 'M', '輻'), + (0xFA08, 'M', '行'), + (0xFA09, 'M', '降'), + (0xFA0A, 'M', '見'), + (0xFA0B, 'M', '廓'), + (0xFA0C, 'M', '兀'), + (0xFA0D, 'M', '嗀'), + ] + +def _seg_42() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFA0E, 'V'), + (0xFA10, 'M', '塚'), + (0xFA11, 'V'), + (0xFA12, 'M', '晴'), + (0xFA13, 'V'), + (0xFA15, 'M', '凞'), + (0xFA16, 'M', '猪'), + (0xFA17, 'M', '益'), + (0xFA18, 'M', '礼'), + (0xFA19, 'M', '神'), + (0xFA1A, 'M', '祥'), + (0xFA1B, 'M', '福'), + (0xFA1C, 'M', '靖'), + (0xFA1D, 'M', '精'), + (0xFA1E, 'M', '羽'), + (0xFA1F, 'V'), + (0xFA20, 'M', '蘒'), + (0xFA21, 'V'), + (0xFA22, 'M', '諸'), + (0xFA23, 'V'), + (0xFA25, 'M', '逸'), + (0xFA26, 'M', '都'), + (0xFA27, 'V'), + (0xFA2A, 'M', '飯'), + (0xFA2B, 'M', '飼'), + (0xFA2C, 'M', '館'), + (0xFA2D, 'M', '鶴'), + (0xFA2E, 'M', '郞'), + (0xFA2F, 'M', '隷'), + (0xFA30, 'M', '侮'), + (0xFA31, 'M', '僧'), + (0xFA32, 'M', '免'), + (0xFA33, 'M', '勉'), + (0xFA34, 'M', '勤'), + (0xFA35, 'M', '卑'), + (0xFA36, 'M', '喝'), + (0xFA37, 'M', '嘆'), + (0xFA38, 'M', '器'), + (0xFA39, 'M', '塀'), + (0xFA3A, 'M', '墨'), + (0xFA3B, 'M', '層'), + (0xFA3C, 'M', '屮'), + (0xFA3D, 'M', '悔'), + (0xFA3E, 'M', '慨'), + (0xFA3F, 'M', '憎'), + (0xFA40, 'M', '懲'), + (0xFA41, 'M', '敏'), + (0xFA42, 'M', '既'), + (0xFA43, 'M', '暑'), + (0xFA44, 'M', '梅'), + (0xFA45, 'M', '海'), + (0xFA46, 'M', '渚'), + (0xFA47, 'M', '漢'), + (0xFA48, 'M', '煮'), + (0xFA49, 'M', '爫'), + (0xFA4A, 'M', '琢'), + (0xFA4B, 'M', '碑'), + (0xFA4C, 'M', '社'), + (0xFA4D, 'M', '祉'), + (0xFA4E, 'M', '祈'), + (0xFA4F, 'M', '祐'), + (0xFA50, 'M', '祖'), + (0xFA51, 'M', '祝'), + (0xFA52, 'M', '禍'), + (0xFA53, 'M', '禎'), + (0xFA54, 'M', '穀'), + (0xFA55, 'M', '突'), + (0xFA56, 'M', '節'), + (0xFA57, 'M', '練'), + (0xFA58, 'M', '縉'), + (0xFA59, 'M', '繁'), + (0xFA5A, 'M', '署'), + (0xFA5B, 'M', '者'), + (0xFA5C, 'M', '臭'), + (0xFA5D, 'M', '艹'), + (0xFA5F, 'M', '著'), + (0xFA60, 'M', '褐'), + (0xFA61, 'M', '視'), + (0xFA62, 'M', '謁'), + (0xFA63, 'M', '謹'), + (0xFA64, 'M', '賓'), + (0xFA65, 'M', '贈'), + (0xFA66, 'M', '辶'), + (0xFA67, 'M', '逸'), + (0xFA68, 'M', '難'), + (0xFA69, 'M', '響'), + (0xFA6A, 'M', '頻'), + (0xFA6B, 'M', '恵'), + (0xFA6C, 'M', '𤋮'), + (0xFA6D, 'M', '舘'), + (0xFA6E, 'X'), + (0xFA70, 'M', '並'), + (0xFA71, 'M', '况'), + (0xFA72, 'M', '全'), + (0xFA73, 'M', '侀'), + (0xFA74, 'M', '充'), + (0xFA75, 'M', '冀'), + (0xFA76, 'M', '勇'), + (0xFA77, 'M', '勺'), + (0xFA78, 'M', '喝'), + ] + +def _seg_43() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFA79, 'M', '啕'), + (0xFA7A, 'M', '喙'), + (0xFA7B, 'M', '嗢'), + (0xFA7C, 'M', '塚'), + (0xFA7D, 'M', '墳'), + (0xFA7E, 'M', '奄'), + (0xFA7F, 'M', '奔'), + (0xFA80, 'M', '婢'), + (0xFA81, 'M', '嬨'), + (0xFA82, 'M', '廒'), + (0xFA83, 'M', '廙'), + (0xFA84, 'M', '彩'), + (0xFA85, 'M', '徭'), + (0xFA86, 'M', '惘'), + (0xFA87, 'M', '慎'), + (0xFA88, 'M', '愈'), + (0xFA89, 'M', '憎'), + (0xFA8A, 'M', '慠'), + (0xFA8B, 'M', '懲'), + (0xFA8C, 'M', '戴'), + (0xFA8D, 'M', '揄'), + (0xFA8E, 'M', '搜'), + (0xFA8F, 'M', '摒'), + (0xFA90, 'M', '敖'), + (0xFA91, 'M', '晴'), + (0xFA92, 'M', '朗'), + (0xFA93, 'M', '望'), + (0xFA94, 'M', '杖'), + (0xFA95, 'M', '歹'), + (0xFA96, 'M', '殺'), + (0xFA97, 'M', '流'), + (0xFA98, 'M', '滛'), + (0xFA99, 'M', '滋'), + (0xFA9A, 'M', '漢'), + (0xFA9B, 'M', '瀞'), + (0xFA9C, 'M', '煮'), + (0xFA9D, 'M', '瞧'), + (0xFA9E, 'M', '爵'), + (0xFA9F, 'M', '犯'), + (0xFAA0, 'M', '猪'), + (0xFAA1, 'M', '瑱'), + (0xFAA2, 'M', '甆'), + (0xFAA3, 'M', '画'), + (0xFAA4, 'M', '瘝'), + (0xFAA5, 'M', '瘟'), + (0xFAA6, 'M', '益'), + (0xFAA7, 'M', '盛'), + (0xFAA8, 'M', '直'), + (0xFAA9, 'M', '睊'), + (0xFAAA, 'M', '着'), + (0xFAAB, 'M', '磌'), + (0xFAAC, 'M', '窱'), + (0xFAAD, 'M', '節'), + (0xFAAE, 'M', '类'), + (0xFAAF, 'M', '絛'), + (0xFAB0, 'M', '練'), + (0xFAB1, 'M', '缾'), + (0xFAB2, 'M', '者'), + (0xFAB3, 'M', '荒'), + (0xFAB4, 'M', '華'), + (0xFAB5, 'M', '蝹'), + (0xFAB6, 'M', '襁'), + (0xFAB7, 'M', '覆'), + (0xFAB8, 'M', '視'), + (0xFAB9, 'M', '調'), + (0xFABA, 'M', '諸'), + (0xFABB, 'M', '請'), + (0xFABC, 'M', '謁'), + (0xFABD, 'M', '諾'), + (0xFABE, 'M', '諭'), + (0xFABF, 'M', '謹'), + (0xFAC0, 'M', '變'), + (0xFAC1, 'M', '贈'), + (0xFAC2, 'M', '輸'), + (0xFAC3, 'M', '遲'), + (0xFAC4, 'M', '醙'), + (0xFAC5, 'M', '鉶'), + (0xFAC6, 'M', '陼'), + (0xFAC7, 'M', '難'), + (0xFAC8, 'M', '靖'), + (0xFAC9, 'M', '韛'), + (0xFACA, 'M', '響'), + (0xFACB, 'M', '頋'), + (0xFACC, 'M', '頻'), + (0xFACD, 'M', '鬒'), + (0xFACE, 'M', '龜'), + (0xFACF, 'M', '𢡊'), + (0xFAD0, 'M', '𢡄'), + (0xFAD1, 'M', '𣏕'), + (0xFAD2, 'M', '㮝'), + (0xFAD3, 'M', '䀘'), + (0xFAD4, 'M', '䀹'), + (0xFAD5, 'M', '𥉉'), + (0xFAD6, 'M', '𥳐'), + (0xFAD7, 'M', '𧻓'), + (0xFAD8, 'M', '齃'), + (0xFAD9, 'M', '龎'), + (0xFADA, 'X'), + (0xFB00, 'M', 'ff'), + (0xFB01, 'M', 'fi'), + ] + +def _seg_44() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFB02, 'M', 'fl'), + (0xFB03, 'M', 'ffi'), + (0xFB04, 'M', 'ffl'), + (0xFB05, 'M', 'st'), + (0xFB07, 'X'), + (0xFB13, 'M', 'մն'), + (0xFB14, 'M', 'մե'), + (0xFB15, 'M', 'մի'), + (0xFB16, 'M', 'վն'), + (0xFB17, 'M', 'մխ'), + (0xFB18, 'X'), + (0xFB1D, 'M', 'יִ'), + (0xFB1E, 'V'), + (0xFB1F, 'M', 'ײַ'), + (0xFB20, 'M', 'ע'), + (0xFB21, 'M', 'א'), + (0xFB22, 'M', 'ד'), + (0xFB23, 'M', 'ה'), + (0xFB24, 'M', 'כ'), + (0xFB25, 'M', 'ל'), + (0xFB26, 'M', 'ם'), + (0xFB27, 'M', 'ר'), + (0xFB28, 'M', 'ת'), + (0xFB29, '3', '+'), + (0xFB2A, 'M', 'שׁ'), + (0xFB2B, 'M', 'שׂ'), + (0xFB2C, 'M', 'שּׁ'), + (0xFB2D, 'M', 'שּׂ'), + (0xFB2E, 'M', 'אַ'), + (0xFB2F, 'M', 'אָ'), + (0xFB30, 'M', 'אּ'), + (0xFB31, 'M', 'בּ'), + (0xFB32, 'M', 'גּ'), + (0xFB33, 'M', 'דּ'), + (0xFB34, 'M', 'הּ'), + (0xFB35, 'M', 'וּ'), + (0xFB36, 'M', 'זּ'), + (0xFB37, 'X'), + (0xFB38, 'M', 'טּ'), + (0xFB39, 'M', 'יּ'), + (0xFB3A, 'M', 'ךּ'), + (0xFB3B, 'M', 'כּ'), + (0xFB3C, 'M', 'לּ'), + (0xFB3D, 'X'), + (0xFB3E, 'M', 'מּ'), + (0xFB3F, 'X'), + (0xFB40, 'M', 'נּ'), + (0xFB41, 'M', 'סּ'), + (0xFB42, 'X'), + (0xFB43, 'M', 'ףּ'), + (0xFB44, 'M', 'פּ'), + (0xFB45, 'X'), + (0xFB46, 'M', 'צּ'), + (0xFB47, 'M', 'קּ'), + (0xFB48, 'M', 'רּ'), + (0xFB49, 'M', 'שּ'), + (0xFB4A, 'M', 'תּ'), + (0xFB4B, 'M', 'וֹ'), + (0xFB4C, 'M', 'בֿ'), + (0xFB4D, 'M', 'כֿ'), + (0xFB4E, 'M', 'פֿ'), + (0xFB4F, 'M', 'אל'), + (0xFB50, 'M', 'ٱ'), + (0xFB52, 'M', 'ٻ'), + (0xFB56, 'M', 'پ'), + (0xFB5A, 'M', 'ڀ'), + (0xFB5E, 'M', 'ٺ'), + (0xFB62, 'M', 'ٿ'), + (0xFB66, 'M', 'ٹ'), + (0xFB6A, 'M', 'ڤ'), + (0xFB6E, 'M', 'ڦ'), + (0xFB72, 'M', 'ڄ'), + (0xFB76, 'M', 'ڃ'), + (0xFB7A, 'M', 'چ'), + (0xFB7E, 'M', 'ڇ'), + (0xFB82, 'M', 'ڍ'), + (0xFB84, 'M', 'ڌ'), + (0xFB86, 'M', 'ڎ'), + (0xFB88, 'M', 'ڈ'), + (0xFB8A, 'M', 'ژ'), + (0xFB8C, 'M', 'ڑ'), + (0xFB8E, 'M', 'ک'), + (0xFB92, 'M', 'گ'), + (0xFB96, 'M', 'ڳ'), + (0xFB9A, 'M', 'ڱ'), + (0xFB9E, 'M', 'ں'), + (0xFBA0, 'M', 'ڻ'), + (0xFBA4, 'M', 'ۀ'), + (0xFBA6, 'M', 'ہ'), + (0xFBAA, 'M', 'ھ'), + (0xFBAE, 'M', 'ے'), + (0xFBB0, 'M', 'ۓ'), + (0xFBB2, 'V'), + (0xFBC3, 'X'), + (0xFBD3, 'M', 'ڭ'), + (0xFBD7, 'M', 'ۇ'), + (0xFBD9, 'M', 'ۆ'), + (0xFBDB, 'M', 'ۈ'), + (0xFBDD, 'M', 'ۇٴ'), + (0xFBDE, 'M', 'ۋ'), + ] + +def _seg_45() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFBE0, 'M', 'ۅ'), + (0xFBE2, 'M', 'ۉ'), + (0xFBE4, 'M', 'ې'), + (0xFBE8, 'M', 'ى'), + (0xFBEA, 'M', 'ئا'), + (0xFBEC, 'M', 'ئە'), + (0xFBEE, 'M', 'ئو'), + (0xFBF0, 'M', 'ئۇ'), + (0xFBF2, 'M', 'ئۆ'), + (0xFBF4, 'M', 'ئۈ'), + (0xFBF6, 'M', 'ئې'), + (0xFBF9, 'M', 'ئى'), + (0xFBFC, 'M', 'ی'), + (0xFC00, 'M', 'ئج'), + (0xFC01, 'M', 'ئح'), + (0xFC02, 'M', 'ئم'), + (0xFC03, 'M', 'ئى'), + (0xFC04, 'M', 'ئي'), + (0xFC05, 'M', 'بج'), + (0xFC06, 'M', 'بح'), + (0xFC07, 'M', 'بخ'), + (0xFC08, 'M', 'بم'), + (0xFC09, 'M', 'بى'), + (0xFC0A, 'M', 'بي'), + (0xFC0B, 'M', 'تج'), + (0xFC0C, 'M', 'تح'), + (0xFC0D, 'M', 'تخ'), + (0xFC0E, 'M', 'تم'), + (0xFC0F, 'M', 'تى'), + (0xFC10, 'M', 'تي'), + (0xFC11, 'M', 'ثج'), + (0xFC12, 'M', 'ثم'), + (0xFC13, 'M', 'ثى'), + (0xFC14, 'M', 'ثي'), + (0xFC15, 'M', 'جح'), + (0xFC16, 'M', 'جم'), + (0xFC17, 'M', 'حج'), + (0xFC18, 'M', 'حم'), + (0xFC19, 'M', 'خج'), + (0xFC1A, 'M', 'خح'), + (0xFC1B, 'M', 'خم'), + (0xFC1C, 'M', 'سج'), + (0xFC1D, 'M', 'سح'), + (0xFC1E, 'M', 'سخ'), + (0xFC1F, 'M', 'سم'), + (0xFC20, 'M', 'صح'), + (0xFC21, 'M', 'صم'), + (0xFC22, 'M', 'ضج'), + (0xFC23, 'M', 'ضح'), + (0xFC24, 'M', 'ضخ'), + (0xFC25, 'M', 'ضم'), + (0xFC26, 'M', 'طح'), + (0xFC27, 'M', 'طم'), + (0xFC28, 'M', 'ظم'), + (0xFC29, 'M', 'عج'), + (0xFC2A, 'M', 'عم'), + (0xFC2B, 'M', 'غج'), + (0xFC2C, 'M', 'غم'), + (0xFC2D, 'M', 'فج'), + (0xFC2E, 'M', 'فح'), + (0xFC2F, 'M', 'فخ'), + (0xFC30, 'M', 'فم'), + (0xFC31, 'M', 'فى'), + (0xFC32, 'M', 'في'), + (0xFC33, 'M', 'قح'), + (0xFC34, 'M', 'قم'), + (0xFC35, 'M', 'قى'), + (0xFC36, 'M', 'قي'), + (0xFC37, 'M', 'كا'), + (0xFC38, 'M', 'كج'), + (0xFC39, 'M', 'كح'), + (0xFC3A, 'M', 'كخ'), + (0xFC3B, 'M', 'كل'), + (0xFC3C, 'M', 'كم'), + (0xFC3D, 'M', 'كى'), + (0xFC3E, 'M', 'كي'), + (0xFC3F, 'M', 'لج'), + (0xFC40, 'M', 'لح'), + (0xFC41, 'M', 'لخ'), + (0xFC42, 'M', 'لم'), + (0xFC43, 'M', 'لى'), + (0xFC44, 'M', 'لي'), + (0xFC45, 'M', 'مج'), + (0xFC46, 'M', 'مح'), + (0xFC47, 'M', 'مخ'), + (0xFC48, 'M', 'مم'), + (0xFC49, 'M', 'مى'), + (0xFC4A, 'M', 'مي'), + (0xFC4B, 'M', 'نج'), + (0xFC4C, 'M', 'نح'), + (0xFC4D, 'M', 'نخ'), + (0xFC4E, 'M', 'نم'), + (0xFC4F, 'M', 'نى'), + (0xFC50, 'M', 'ني'), + (0xFC51, 'M', 'هج'), + (0xFC52, 'M', 'هم'), + (0xFC53, 'M', 'هى'), + (0xFC54, 'M', 'هي'), + (0xFC55, 'M', 'يج'), + (0xFC56, 'M', 'يح'), + ] + +def _seg_46() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFC57, 'M', 'يخ'), + (0xFC58, 'M', 'يم'), + (0xFC59, 'M', 'يى'), + (0xFC5A, 'M', 'يي'), + (0xFC5B, 'M', 'ذٰ'), + (0xFC5C, 'M', 'رٰ'), + (0xFC5D, 'M', 'ىٰ'), + (0xFC5E, '3', ' ٌّ'), + (0xFC5F, '3', ' ٍّ'), + (0xFC60, '3', ' َّ'), + (0xFC61, '3', ' ُّ'), + (0xFC62, '3', ' ِّ'), + (0xFC63, '3', ' ّٰ'), + (0xFC64, 'M', 'ئر'), + (0xFC65, 'M', 'ئز'), + (0xFC66, 'M', 'ئم'), + (0xFC67, 'M', 'ئن'), + (0xFC68, 'M', 'ئى'), + (0xFC69, 'M', 'ئي'), + (0xFC6A, 'M', 'بر'), + (0xFC6B, 'M', 'بز'), + (0xFC6C, 'M', 'بم'), + (0xFC6D, 'M', 'بن'), + (0xFC6E, 'M', 'بى'), + (0xFC6F, 'M', 'بي'), + (0xFC70, 'M', 'تر'), + (0xFC71, 'M', 'تز'), + (0xFC72, 'M', 'تم'), + (0xFC73, 'M', 'تن'), + (0xFC74, 'M', 'تى'), + (0xFC75, 'M', 'تي'), + (0xFC76, 'M', 'ثر'), + (0xFC77, 'M', 'ثز'), + (0xFC78, 'M', 'ثم'), + (0xFC79, 'M', 'ثن'), + (0xFC7A, 'M', 'ثى'), + (0xFC7B, 'M', 'ثي'), + (0xFC7C, 'M', 'فى'), + (0xFC7D, 'M', 'في'), + (0xFC7E, 'M', 'قى'), + (0xFC7F, 'M', 'قي'), + (0xFC80, 'M', 'كا'), + (0xFC81, 'M', 'كل'), + (0xFC82, 'M', 'كم'), + (0xFC83, 'M', 'كى'), + (0xFC84, 'M', 'كي'), + (0xFC85, 'M', 'لم'), + (0xFC86, 'M', 'لى'), + (0xFC87, 'M', 'لي'), + (0xFC88, 'M', 'ما'), + (0xFC89, 'M', 'مم'), + (0xFC8A, 'M', 'نر'), + (0xFC8B, 'M', 'نز'), + (0xFC8C, 'M', 'نم'), + (0xFC8D, 'M', 'نن'), + (0xFC8E, 'M', 'نى'), + (0xFC8F, 'M', 'ني'), + (0xFC90, 'M', 'ىٰ'), + (0xFC91, 'M', 'ير'), + (0xFC92, 'M', 'يز'), + (0xFC93, 'M', 'يم'), + (0xFC94, 'M', 'ين'), + (0xFC95, 'M', 'يى'), + (0xFC96, 'M', 'يي'), + (0xFC97, 'M', 'ئج'), + (0xFC98, 'M', 'ئح'), + (0xFC99, 'M', 'ئخ'), + (0xFC9A, 'M', 'ئم'), + (0xFC9B, 'M', 'ئه'), + (0xFC9C, 'M', 'بج'), + (0xFC9D, 'M', 'بح'), + (0xFC9E, 'M', 'بخ'), + (0xFC9F, 'M', 'بم'), + (0xFCA0, 'M', 'به'), + (0xFCA1, 'M', 'تج'), + (0xFCA2, 'M', 'تح'), + (0xFCA3, 'M', 'تخ'), + (0xFCA4, 'M', 'تم'), + (0xFCA5, 'M', 'ته'), + (0xFCA6, 'M', 'ثم'), + (0xFCA7, 'M', 'جح'), + (0xFCA8, 'M', 'جم'), + (0xFCA9, 'M', 'حج'), + (0xFCAA, 'M', 'حم'), + (0xFCAB, 'M', 'خج'), + (0xFCAC, 'M', 'خم'), + (0xFCAD, 'M', 'سج'), + (0xFCAE, 'M', 'سح'), + (0xFCAF, 'M', 'سخ'), + (0xFCB0, 'M', 'سم'), + (0xFCB1, 'M', 'صح'), + (0xFCB2, 'M', 'صخ'), + (0xFCB3, 'M', 'صم'), + (0xFCB4, 'M', 'ضج'), + (0xFCB5, 'M', 'ضح'), + (0xFCB6, 'M', 'ضخ'), + (0xFCB7, 'M', 'ضم'), + (0xFCB8, 'M', 'طح'), + (0xFCB9, 'M', 'ظم'), + (0xFCBA, 'M', 'عج'), + ] + +def _seg_47() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFCBB, 'M', 'عم'), + (0xFCBC, 'M', 'غج'), + (0xFCBD, 'M', 'غم'), + (0xFCBE, 'M', 'فج'), + (0xFCBF, 'M', 'فح'), + (0xFCC0, 'M', 'فخ'), + (0xFCC1, 'M', 'فم'), + (0xFCC2, 'M', 'قح'), + (0xFCC3, 'M', 'قم'), + (0xFCC4, 'M', 'كج'), + (0xFCC5, 'M', 'كح'), + (0xFCC6, 'M', 'كخ'), + (0xFCC7, 'M', 'كل'), + (0xFCC8, 'M', 'كم'), + (0xFCC9, 'M', 'لج'), + (0xFCCA, 'M', 'لح'), + (0xFCCB, 'M', 'لخ'), + (0xFCCC, 'M', 'لم'), + (0xFCCD, 'M', 'له'), + (0xFCCE, 'M', 'مج'), + (0xFCCF, 'M', 'مح'), + (0xFCD0, 'M', 'مخ'), + (0xFCD1, 'M', 'مم'), + (0xFCD2, 'M', 'نج'), + (0xFCD3, 'M', 'نح'), + (0xFCD4, 'M', 'نخ'), + (0xFCD5, 'M', 'نم'), + (0xFCD6, 'M', 'نه'), + (0xFCD7, 'M', 'هج'), + (0xFCD8, 'M', 'هم'), + (0xFCD9, 'M', 'هٰ'), + (0xFCDA, 'M', 'يج'), + (0xFCDB, 'M', 'يح'), + (0xFCDC, 'M', 'يخ'), + (0xFCDD, 'M', 'يم'), + (0xFCDE, 'M', 'يه'), + (0xFCDF, 'M', 'ئم'), + (0xFCE0, 'M', 'ئه'), + (0xFCE1, 'M', 'بم'), + (0xFCE2, 'M', 'به'), + (0xFCE3, 'M', 'تم'), + (0xFCE4, 'M', 'ته'), + (0xFCE5, 'M', 'ثم'), + (0xFCE6, 'M', 'ثه'), + (0xFCE7, 'M', 'سم'), + (0xFCE8, 'M', 'سه'), + (0xFCE9, 'M', 'شم'), + (0xFCEA, 'M', 'شه'), + (0xFCEB, 'M', 'كل'), + (0xFCEC, 'M', 'كم'), + (0xFCED, 'M', 'لم'), + (0xFCEE, 'M', 'نم'), + (0xFCEF, 'M', 'نه'), + (0xFCF0, 'M', 'يم'), + (0xFCF1, 'M', 'يه'), + (0xFCF2, 'M', 'ـَّ'), + (0xFCF3, 'M', 'ـُّ'), + (0xFCF4, 'M', 'ـِّ'), + (0xFCF5, 'M', 'طى'), + (0xFCF6, 'M', 'طي'), + (0xFCF7, 'M', 'عى'), + (0xFCF8, 'M', 'عي'), + (0xFCF9, 'M', 'غى'), + (0xFCFA, 'M', 'غي'), + (0xFCFB, 'M', 'سى'), + (0xFCFC, 'M', 'سي'), + (0xFCFD, 'M', 'شى'), + (0xFCFE, 'M', 'شي'), + (0xFCFF, 'M', 'حى'), + (0xFD00, 'M', 'حي'), + (0xFD01, 'M', 'جى'), + (0xFD02, 'M', 'جي'), + (0xFD03, 'M', 'خى'), + (0xFD04, 'M', 'خي'), + (0xFD05, 'M', 'صى'), + (0xFD06, 'M', 'صي'), + (0xFD07, 'M', 'ضى'), + (0xFD08, 'M', 'ضي'), + (0xFD09, 'M', 'شج'), + (0xFD0A, 'M', 'شح'), + (0xFD0B, 'M', 'شخ'), + (0xFD0C, 'M', 'شم'), + (0xFD0D, 'M', 'شر'), + (0xFD0E, 'M', 'سر'), + (0xFD0F, 'M', 'صر'), + (0xFD10, 'M', 'ضر'), + (0xFD11, 'M', 'طى'), + (0xFD12, 'M', 'طي'), + (0xFD13, 'M', 'عى'), + (0xFD14, 'M', 'عي'), + (0xFD15, 'M', 'غى'), + (0xFD16, 'M', 'غي'), + (0xFD17, 'M', 'سى'), + (0xFD18, 'M', 'سي'), + (0xFD19, 'M', 'شى'), + (0xFD1A, 'M', 'شي'), + (0xFD1B, 'M', 'حى'), + (0xFD1C, 'M', 'حي'), + (0xFD1D, 'M', 'جى'), + (0xFD1E, 'M', 'جي'), + ] + +def _seg_48() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFD1F, 'M', 'خى'), + (0xFD20, 'M', 'خي'), + (0xFD21, 'M', 'صى'), + (0xFD22, 'M', 'صي'), + (0xFD23, 'M', 'ضى'), + (0xFD24, 'M', 'ضي'), + (0xFD25, 'M', 'شج'), + (0xFD26, 'M', 'شح'), + (0xFD27, 'M', 'شخ'), + (0xFD28, 'M', 'شم'), + (0xFD29, 'M', 'شر'), + (0xFD2A, 'M', 'سر'), + (0xFD2B, 'M', 'صر'), + (0xFD2C, 'M', 'ضر'), + (0xFD2D, 'M', 'شج'), + (0xFD2E, 'M', 'شح'), + (0xFD2F, 'M', 'شخ'), + (0xFD30, 'M', 'شم'), + (0xFD31, 'M', 'سه'), + (0xFD32, 'M', 'شه'), + (0xFD33, 'M', 'طم'), + (0xFD34, 'M', 'سج'), + (0xFD35, 'M', 'سح'), + (0xFD36, 'M', 'سخ'), + (0xFD37, 'M', 'شج'), + (0xFD38, 'M', 'شح'), + (0xFD39, 'M', 'شخ'), + (0xFD3A, 'M', 'طم'), + (0xFD3B, 'M', 'ظم'), + (0xFD3C, 'M', 'اً'), + (0xFD3E, 'V'), + (0xFD50, 'M', 'تجم'), + (0xFD51, 'M', 'تحج'), + (0xFD53, 'M', 'تحم'), + (0xFD54, 'M', 'تخم'), + (0xFD55, 'M', 'تمج'), + (0xFD56, 'M', 'تمح'), + (0xFD57, 'M', 'تمخ'), + (0xFD58, 'M', 'جمح'), + (0xFD5A, 'M', 'حمي'), + (0xFD5B, 'M', 'حمى'), + (0xFD5C, 'M', 'سحج'), + (0xFD5D, 'M', 'سجح'), + (0xFD5E, 'M', 'سجى'), + (0xFD5F, 'M', 'سمح'), + (0xFD61, 'M', 'سمج'), + (0xFD62, 'M', 'سمم'), + (0xFD64, 'M', 'صحح'), + (0xFD66, 'M', 'صمم'), + (0xFD67, 'M', 'شحم'), + (0xFD69, 'M', 'شجي'), + (0xFD6A, 'M', 'شمخ'), + (0xFD6C, 'M', 'شمم'), + (0xFD6E, 'M', 'ضحى'), + (0xFD6F, 'M', 'ضخم'), + (0xFD71, 'M', 'طمح'), + (0xFD73, 'M', 'طمم'), + (0xFD74, 'M', 'طمي'), + (0xFD75, 'M', 'عجم'), + (0xFD76, 'M', 'عمم'), + (0xFD78, 'M', 'عمى'), + (0xFD79, 'M', 'غمم'), + (0xFD7A, 'M', 'غمي'), + (0xFD7B, 'M', 'غمى'), + (0xFD7C, 'M', 'فخم'), + (0xFD7E, 'M', 'قمح'), + (0xFD7F, 'M', 'قمم'), + (0xFD80, 'M', 'لحم'), + (0xFD81, 'M', 'لحي'), + (0xFD82, 'M', 'لحى'), + (0xFD83, 'M', 'لجج'), + (0xFD85, 'M', 'لخم'), + (0xFD87, 'M', 'لمح'), + (0xFD89, 'M', 'محج'), + (0xFD8A, 'M', 'محم'), + (0xFD8B, 'M', 'محي'), + (0xFD8C, 'M', 'مجح'), + (0xFD8D, 'M', 'مجم'), + (0xFD8E, 'M', 'مخج'), + (0xFD8F, 'M', 'مخم'), + (0xFD90, 'X'), + (0xFD92, 'M', 'مجخ'), + (0xFD93, 'M', 'همج'), + (0xFD94, 'M', 'همم'), + (0xFD95, 'M', 'نحم'), + (0xFD96, 'M', 'نحى'), + (0xFD97, 'M', 'نجم'), + (0xFD99, 'M', 'نجى'), + (0xFD9A, 'M', 'نمي'), + (0xFD9B, 'M', 'نمى'), + (0xFD9C, 'M', 'يمم'), + (0xFD9E, 'M', 'بخي'), + (0xFD9F, 'M', 'تجي'), + (0xFDA0, 'M', 'تجى'), + (0xFDA1, 'M', 'تخي'), + (0xFDA2, 'M', 'تخى'), + (0xFDA3, 'M', 'تمي'), + (0xFDA4, 'M', 'تمى'), + (0xFDA5, 'M', 'جمي'), + (0xFDA6, 'M', 'جحى'), + ] + +def _seg_49() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFDA7, 'M', 'جمى'), + (0xFDA8, 'M', 'سخى'), + (0xFDA9, 'M', 'صحي'), + (0xFDAA, 'M', 'شحي'), + (0xFDAB, 'M', 'ضحي'), + (0xFDAC, 'M', 'لجي'), + (0xFDAD, 'M', 'لمي'), + (0xFDAE, 'M', 'يحي'), + (0xFDAF, 'M', 'يجي'), + (0xFDB0, 'M', 'يمي'), + (0xFDB1, 'M', 'ممي'), + (0xFDB2, 'M', 'قمي'), + (0xFDB3, 'M', 'نحي'), + (0xFDB4, 'M', 'قمح'), + (0xFDB5, 'M', 'لحم'), + (0xFDB6, 'M', 'عمي'), + (0xFDB7, 'M', 'كمي'), + (0xFDB8, 'M', 'نجح'), + (0xFDB9, 'M', 'مخي'), + (0xFDBA, 'M', 'لجم'), + (0xFDBB, 'M', 'كمم'), + (0xFDBC, 'M', 'لجم'), + (0xFDBD, 'M', 'نجح'), + (0xFDBE, 'M', 'جحي'), + (0xFDBF, 'M', 'حجي'), + (0xFDC0, 'M', 'مجي'), + (0xFDC1, 'M', 'فمي'), + (0xFDC2, 'M', 'بحي'), + (0xFDC3, 'M', 'كمم'), + (0xFDC4, 'M', 'عجم'), + (0xFDC5, 'M', 'صمم'), + (0xFDC6, 'M', 'سخي'), + (0xFDC7, 'M', 'نجي'), + (0xFDC8, 'X'), + (0xFDCF, 'V'), + (0xFDD0, 'X'), + (0xFDF0, 'M', 'صلے'), + (0xFDF1, 'M', 'قلے'), + (0xFDF2, 'M', 'الله'), + (0xFDF3, 'M', 'اكبر'), + (0xFDF4, 'M', 'محمد'), + (0xFDF5, 'M', 'صلعم'), + (0xFDF6, 'M', 'رسول'), + (0xFDF7, 'M', 'عليه'), + (0xFDF8, 'M', 'وسلم'), + (0xFDF9, 'M', 'صلى'), + (0xFDFA, '3', 'صلى الله عليه وسلم'), + (0xFDFB, '3', 'جل جلاله'), + (0xFDFC, 'M', 'ریال'), + (0xFDFD, 'V'), + (0xFE00, 'I'), + (0xFE10, '3', ','), + (0xFE11, 'M', '、'), + (0xFE12, 'X'), + (0xFE13, '3', ':'), + (0xFE14, '3', ';'), + (0xFE15, '3', '!'), + (0xFE16, '3', '?'), + (0xFE17, 'M', '〖'), + (0xFE18, 'M', '〗'), + (0xFE19, 'X'), + (0xFE20, 'V'), + (0xFE30, 'X'), + (0xFE31, 'M', '—'), + (0xFE32, 'M', '–'), + (0xFE33, '3', '_'), + (0xFE35, '3', '('), + (0xFE36, '3', ')'), + (0xFE37, '3', '{'), + (0xFE38, '3', '}'), + (0xFE39, 'M', '〔'), + (0xFE3A, 'M', '〕'), + (0xFE3B, 'M', '【'), + (0xFE3C, 'M', '】'), + (0xFE3D, 'M', '《'), + (0xFE3E, 'M', '》'), + (0xFE3F, 'M', '〈'), + (0xFE40, 'M', '〉'), + (0xFE41, 'M', '「'), + (0xFE42, 'M', '」'), + (0xFE43, 'M', '『'), + (0xFE44, 'M', '』'), + (0xFE45, 'V'), + (0xFE47, '3', '['), + (0xFE48, '3', ']'), + (0xFE49, '3', ' ̅'), + (0xFE4D, '3', '_'), + (0xFE50, '3', ','), + (0xFE51, 'M', '、'), + (0xFE52, 'X'), + (0xFE54, '3', ';'), + (0xFE55, '3', ':'), + (0xFE56, '3', '?'), + (0xFE57, '3', '!'), + (0xFE58, 'M', '—'), + (0xFE59, '3', '('), + (0xFE5A, '3', ')'), + (0xFE5B, '3', '{'), + (0xFE5C, '3', '}'), + (0xFE5D, 'M', '〔'), + ] + +def _seg_50() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFE5E, 'M', '〕'), + (0xFE5F, '3', '#'), + (0xFE60, '3', '&'), + (0xFE61, '3', '*'), + (0xFE62, '3', '+'), + (0xFE63, 'M', '-'), + (0xFE64, '3', '<'), + (0xFE65, '3', '>'), + (0xFE66, '3', '='), + (0xFE67, 'X'), + (0xFE68, '3', '\\'), + (0xFE69, '3', '$'), + (0xFE6A, '3', '%'), + (0xFE6B, '3', '@'), + (0xFE6C, 'X'), + (0xFE70, '3', ' ً'), + (0xFE71, 'M', 'ـً'), + (0xFE72, '3', ' ٌ'), + (0xFE73, 'V'), + (0xFE74, '3', ' ٍ'), + (0xFE75, 'X'), + (0xFE76, '3', ' َ'), + (0xFE77, 'M', 'ـَ'), + (0xFE78, '3', ' ُ'), + (0xFE79, 'M', 'ـُ'), + (0xFE7A, '3', ' ِ'), + (0xFE7B, 'M', 'ـِ'), + (0xFE7C, '3', ' ّ'), + (0xFE7D, 'M', 'ـّ'), + (0xFE7E, '3', ' ْ'), + (0xFE7F, 'M', 'ـْ'), + (0xFE80, 'M', 'ء'), + (0xFE81, 'M', 'آ'), + (0xFE83, 'M', 'أ'), + (0xFE85, 'M', 'ؤ'), + (0xFE87, 'M', 'إ'), + (0xFE89, 'M', 'ئ'), + (0xFE8D, 'M', 'ا'), + (0xFE8F, 'M', 'ب'), + (0xFE93, 'M', 'ة'), + (0xFE95, 'M', 'ت'), + (0xFE99, 'M', 'ث'), + (0xFE9D, 'M', 'ج'), + (0xFEA1, 'M', 'ح'), + (0xFEA5, 'M', 'خ'), + (0xFEA9, 'M', 'د'), + (0xFEAB, 'M', 'ذ'), + (0xFEAD, 'M', 'ر'), + (0xFEAF, 'M', 'ز'), + (0xFEB1, 'M', 'س'), + (0xFEB5, 'M', 'ش'), + (0xFEB9, 'M', 'ص'), + (0xFEBD, 'M', 'ض'), + (0xFEC1, 'M', 'ط'), + (0xFEC5, 'M', 'ظ'), + (0xFEC9, 'M', 'ع'), + (0xFECD, 'M', 'غ'), + (0xFED1, 'M', 'ف'), + (0xFED5, 'M', 'ق'), + (0xFED9, 'M', 'ك'), + (0xFEDD, 'M', 'ل'), + (0xFEE1, 'M', 'م'), + (0xFEE5, 'M', 'ن'), + (0xFEE9, 'M', 'ه'), + (0xFEED, 'M', 'و'), + (0xFEEF, 'M', 'ى'), + (0xFEF1, 'M', 'ي'), + (0xFEF5, 'M', 'لآ'), + (0xFEF7, 'M', 'لأ'), + (0xFEF9, 'M', 'لإ'), + (0xFEFB, 'M', 'لا'), + (0xFEFD, 'X'), + (0xFEFF, 'I'), + (0xFF00, 'X'), + (0xFF01, '3', '!'), + (0xFF02, '3', '"'), + (0xFF03, '3', '#'), + (0xFF04, '3', '$'), + (0xFF05, '3', '%'), + (0xFF06, '3', '&'), + (0xFF07, '3', '\''), + (0xFF08, '3', '('), + (0xFF09, '3', ')'), + (0xFF0A, '3', '*'), + (0xFF0B, '3', '+'), + (0xFF0C, '3', ','), + (0xFF0D, 'M', '-'), + (0xFF0E, 'M', '.'), + (0xFF0F, '3', '/'), + (0xFF10, 'M', '0'), + (0xFF11, 'M', '1'), + (0xFF12, 'M', '2'), + (0xFF13, 'M', '3'), + (0xFF14, 'M', '4'), + (0xFF15, 'M', '5'), + (0xFF16, 'M', '6'), + (0xFF17, 'M', '7'), + (0xFF18, 'M', '8'), + (0xFF19, 'M', '9'), + (0xFF1A, '3', ':'), + ] + +def _seg_51() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFF1B, '3', ';'), + (0xFF1C, '3', '<'), + (0xFF1D, '3', '='), + (0xFF1E, '3', '>'), + (0xFF1F, '3', '?'), + (0xFF20, '3', '@'), + (0xFF21, 'M', 'a'), + (0xFF22, 'M', 'b'), + (0xFF23, 'M', 'c'), + (0xFF24, 'M', 'd'), + (0xFF25, 'M', 'e'), + (0xFF26, 'M', 'f'), + (0xFF27, 'M', 'g'), + (0xFF28, 'M', 'h'), + (0xFF29, 'M', 'i'), + (0xFF2A, 'M', 'j'), + (0xFF2B, 'M', 'k'), + (0xFF2C, 'M', 'l'), + (0xFF2D, 'M', 'm'), + (0xFF2E, 'M', 'n'), + (0xFF2F, 'M', 'o'), + (0xFF30, 'M', 'p'), + (0xFF31, 'M', 'q'), + (0xFF32, 'M', 'r'), + (0xFF33, 'M', 's'), + (0xFF34, 'M', 't'), + (0xFF35, 'M', 'u'), + (0xFF36, 'M', 'v'), + (0xFF37, 'M', 'w'), + (0xFF38, 'M', 'x'), + (0xFF39, 'M', 'y'), + (0xFF3A, 'M', 'z'), + (0xFF3B, '3', '['), + (0xFF3C, '3', '\\'), + (0xFF3D, '3', ']'), + (0xFF3E, '3', '^'), + (0xFF3F, '3', '_'), + (0xFF40, '3', '`'), + (0xFF41, 'M', 'a'), + (0xFF42, 'M', 'b'), + (0xFF43, 'M', 'c'), + (0xFF44, 'M', 'd'), + (0xFF45, 'M', 'e'), + (0xFF46, 'M', 'f'), + (0xFF47, 'M', 'g'), + (0xFF48, 'M', 'h'), + (0xFF49, 'M', 'i'), + (0xFF4A, 'M', 'j'), + (0xFF4B, 'M', 'k'), + (0xFF4C, 'M', 'l'), + (0xFF4D, 'M', 'm'), + (0xFF4E, 'M', 'n'), + (0xFF4F, 'M', 'o'), + (0xFF50, 'M', 'p'), + (0xFF51, 'M', 'q'), + (0xFF52, 'M', 'r'), + (0xFF53, 'M', 's'), + (0xFF54, 'M', 't'), + (0xFF55, 'M', 'u'), + (0xFF56, 'M', 'v'), + (0xFF57, 'M', 'w'), + (0xFF58, 'M', 'x'), + (0xFF59, 'M', 'y'), + (0xFF5A, 'M', 'z'), + (0xFF5B, '3', '{'), + (0xFF5C, '3', '|'), + (0xFF5D, '3', '}'), + (0xFF5E, '3', '~'), + (0xFF5F, 'M', '⦅'), + (0xFF60, 'M', '⦆'), + (0xFF61, 'M', '.'), + (0xFF62, 'M', '「'), + (0xFF63, 'M', '」'), + (0xFF64, 'M', '、'), + (0xFF65, 'M', '・'), + (0xFF66, 'M', 'ヲ'), + (0xFF67, 'M', 'ァ'), + (0xFF68, 'M', 'ィ'), + (0xFF69, 'M', 'ゥ'), + (0xFF6A, 'M', 'ェ'), + (0xFF6B, 'M', 'ォ'), + (0xFF6C, 'M', 'ャ'), + (0xFF6D, 'M', 'ュ'), + (0xFF6E, 'M', 'ョ'), + (0xFF6F, 'M', 'ッ'), + (0xFF70, 'M', 'ー'), + (0xFF71, 'M', 'ア'), + (0xFF72, 'M', 'イ'), + (0xFF73, 'M', 'ウ'), + (0xFF74, 'M', 'エ'), + (0xFF75, 'M', 'オ'), + (0xFF76, 'M', 'カ'), + (0xFF77, 'M', 'キ'), + (0xFF78, 'M', 'ク'), + (0xFF79, 'M', 'ケ'), + (0xFF7A, 'M', 'コ'), + (0xFF7B, 'M', 'サ'), + (0xFF7C, 'M', 'シ'), + (0xFF7D, 'M', 'ス'), + (0xFF7E, 'M', 'セ'), + ] + +def _seg_52() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFF7F, 'M', 'ソ'), + (0xFF80, 'M', 'タ'), + (0xFF81, 'M', 'チ'), + (0xFF82, 'M', 'ツ'), + (0xFF83, 'M', 'テ'), + (0xFF84, 'M', 'ト'), + (0xFF85, 'M', 'ナ'), + (0xFF86, 'M', 'ニ'), + (0xFF87, 'M', 'ヌ'), + (0xFF88, 'M', 'ネ'), + (0xFF89, 'M', 'ノ'), + (0xFF8A, 'M', 'ハ'), + (0xFF8B, 'M', 'ヒ'), + (0xFF8C, 'M', 'フ'), + (0xFF8D, 'M', 'ヘ'), + (0xFF8E, 'M', 'ホ'), + (0xFF8F, 'M', 'マ'), + (0xFF90, 'M', 'ミ'), + (0xFF91, 'M', 'ム'), + (0xFF92, 'M', 'メ'), + (0xFF93, 'M', 'モ'), + (0xFF94, 'M', 'ヤ'), + (0xFF95, 'M', 'ユ'), + (0xFF96, 'M', 'ヨ'), + (0xFF97, 'M', 'ラ'), + (0xFF98, 'M', 'リ'), + (0xFF99, 'M', 'ル'), + (0xFF9A, 'M', 'レ'), + (0xFF9B, 'M', 'ロ'), + (0xFF9C, 'M', 'ワ'), + (0xFF9D, 'M', 'ン'), + (0xFF9E, 'M', '゙'), + (0xFF9F, 'M', '゚'), + (0xFFA0, 'X'), + (0xFFA1, 'M', 'ᄀ'), + (0xFFA2, 'M', 'ᄁ'), + (0xFFA3, 'M', 'ᆪ'), + (0xFFA4, 'M', 'ᄂ'), + (0xFFA5, 'M', 'ᆬ'), + (0xFFA6, 'M', 'ᆭ'), + (0xFFA7, 'M', 'ᄃ'), + (0xFFA8, 'M', 'ᄄ'), + (0xFFA9, 'M', 'ᄅ'), + (0xFFAA, 'M', 'ᆰ'), + (0xFFAB, 'M', 'ᆱ'), + (0xFFAC, 'M', 'ᆲ'), + (0xFFAD, 'M', 'ᆳ'), + (0xFFAE, 'M', 'ᆴ'), + (0xFFAF, 'M', 'ᆵ'), + (0xFFB0, 'M', 'ᄚ'), + (0xFFB1, 'M', 'ᄆ'), + (0xFFB2, 'M', 'ᄇ'), + (0xFFB3, 'M', 'ᄈ'), + (0xFFB4, 'M', 'ᄡ'), + (0xFFB5, 'M', 'ᄉ'), + (0xFFB6, 'M', 'ᄊ'), + (0xFFB7, 'M', 'ᄋ'), + (0xFFB8, 'M', 'ᄌ'), + (0xFFB9, 'M', 'ᄍ'), + (0xFFBA, 'M', 'ᄎ'), + (0xFFBB, 'M', 'ᄏ'), + (0xFFBC, 'M', 'ᄐ'), + (0xFFBD, 'M', 'ᄑ'), + (0xFFBE, 'M', 'ᄒ'), + (0xFFBF, 'X'), + (0xFFC2, 'M', 'ᅡ'), + (0xFFC3, 'M', 'ᅢ'), + (0xFFC4, 'M', 'ᅣ'), + (0xFFC5, 'M', 'ᅤ'), + (0xFFC6, 'M', 'ᅥ'), + (0xFFC7, 'M', 'ᅦ'), + (0xFFC8, 'X'), + (0xFFCA, 'M', 'ᅧ'), + (0xFFCB, 'M', 'ᅨ'), + (0xFFCC, 'M', 'ᅩ'), + (0xFFCD, 'M', 'ᅪ'), + (0xFFCE, 'M', 'ᅫ'), + (0xFFCF, 'M', 'ᅬ'), + (0xFFD0, 'X'), + (0xFFD2, 'M', 'ᅭ'), + (0xFFD3, 'M', 'ᅮ'), + (0xFFD4, 'M', 'ᅯ'), + (0xFFD5, 'M', 'ᅰ'), + (0xFFD6, 'M', 'ᅱ'), + (0xFFD7, 'M', 'ᅲ'), + (0xFFD8, 'X'), + (0xFFDA, 'M', 'ᅳ'), + (0xFFDB, 'M', 'ᅴ'), + (0xFFDC, 'M', 'ᅵ'), + (0xFFDD, 'X'), + (0xFFE0, 'M', '¢'), + (0xFFE1, 'M', '£'), + (0xFFE2, 'M', '¬'), + (0xFFE3, '3', ' ̄'), + (0xFFE4, 'M', '¦'), + (0xFFE5, 'M', '¥'), + (0xFFE6, 'M', '₩'), + (0xFFE7, 'X'), + (0xFFE8, 'M', '│'), + (0xFFE9, 'M', '←'), + ] + +def _seg_53() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0xFFEA, 'M', '↑'), + (0xFFEB, 'M', '→'), + (0xFFEC, 'M', '↓'), + (0xFFED, 'M', '■'), + (0xFFEE, 'M', '○'), + (0xFFEF, 'X'), + (0x10000, 'V'), + (0x1000C, 'X'), + (0x1000D, 'V'), + (0x10027, 'X'), + (0x10028, 'V'), + (0x1003B, 'X'), + (0x1003C, 'V'), + (0x1003E, 'X'), + (0x1003F, 'V'), + (0x1004E, 'X'), + (0x10050, 'V'), + (0x1005E, 'X'), + (0x10080, 'V'), + (0x100FB, 'X'), + (0x10100, 'V'), + (0x10103, 'X'), + (0x10107, 'V'), + (0x10134, 'X'), + (0x10137, 'V'), + (0x1018F, 'X'), + (0x10190, 'V'), + (0x1019D, 'X'), + (0x101A0, 'V'), + (0x101A1, 'X'), + (0x101D0, 'V'), + (0x101FE, 'X'), + (0x10280, 'V'), + (0x1029D, 'X'), + (0x102A0, 'V'), + (0x102D1, 'X'), + (0x102E0, 'V'), + (0x102FC, 'X'), + (0x10300, 'V'), + (0x10324, 'X'), + (0x1032D, 'V'), + (0x1034B, 'X'), + (0x10350, 'V'), + (0x1037B, 'X'), + (0x10380, 'V'), + (0x1039E, 'X'), + (0x1039F, 'V'), + (0x103C4, 'X'), + (0x103C8, 'V'), + (0x103D6, 'X'), + (0x10400, 'M', '𐐨'), + (0x10401, 'M', '𐐩'), + (0x10402, 'M', '𐐪'), + (0x10403, 'M', '𐐫'), + (0x10404, 'M', '𐐬'), + (0x10405, 'M', '𐐭'), + (0x10406, 'M', '𐐮'), + (0x10407, 'M', '𐐯'), + (0x10408, 'M', '𐐰'), + (0x10409, 'M', '𐐱'), + (0x1040A, 'M', '𐐲'), + (0x1040B, 'M', '𐐳'), + (0x1040C, 'M', '𐐴'), + (0x1040D, 'M', '𐐵'), + (0x1040E, 'M', '𐐶'), + (0x1040F, 'M', '𐐷'), + (0x10410, 'M', '𐐸'), + (0x10411, 'M', '𐐹'), + (0x10412, 'M', '𐐺'), + (0x10413, 'M', '𐐻'), + (0x10414, 'M', '𐐼'), + (0x10415, 'M', '𐐽'), + (0x10416, 'M', '𐐾'), + (0x10417, 'M', '𐐿'), + (0x10418, 'M', '𐑀'), + (0x10419, 'M', '𐑁'), + (0x1041A, 'M', '𐑂'), + (0x1041B, 'M', '𐑃'), + (0x1041C, 'M', '𐑄'), + (0x1041D, 'M', '𐑅'), + (0x1041E, 'M', '𐑆'), + (0x1041F, 'M', '𐑇'), + (0x10420, 'M', '𐑈'), + (0x10421, 'M', '𐑉'), + (0x10422, 'M', '𐑊'), + (0x10423, 'M', '𐑋'), + (0x10424, 'M', '𐑌'), + (0x10425, 'M', '𐑍'), + (0x10426, 'M', '𐑎'), + (0x10427, 'M', '𐑏'), + (0x10428, 'V'), + (0x1049E, 'X'), + (0x104A0, 'V'), + (0x104AA, 'X'), + (0x104B0, 'M', '𐓘'), + (0x104B1, 'M', '𐓙'), + (0x104B2, 'M', '𐓚'), + (0x104B3, 'M', '𐓛'), + (0x104B4, 'M', '𐓜'), + (0x104B5, 'M', '𐓝'), + ] + +def _seg_54() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x104B6, 'M', '𐓞'), + (0x104B7, 'M', '𐓟'), + (0x104B8, 'M', '𐓠'), + (0x104B9, 'M', '𐓡'), + (0x104BA, 'M', '𐓢'), + (0x104BB, 'M', '𐓣'), + (0x104BC, 'M', '𐓤'), + (0x104BD, 'M', '𐓥'), + (0x104BE, 'M', '𐓦'), + (0x104BF, 'M', '𐓧'), + (0x104C0, 'M', '𐓨'), + (0x104C1, 'M', '𐓩'), + (0x104C2, 'M', '𐓪'), + (0x104C3, 'M', '𐓫'), + (0x104C4, 'M', '𐓬'), + (0x104C5, 'M', '𐓭'), + (0x104C6, 'M', '𐓮'), + (0x104C7, 'M', '𐓯'), + (0x104C8, 'M', '𐓰'), + (0x104C9, 'M', '𐓱'), + (0x104CA, 'M', '𐓲'), + (0x104CB, 'M', '𐓳'), + (0x104CC, 'M', '𐓴'), + (0x104CD, 'M', '𐓵'), + (0x104CE, 'M', '𐓶'), + (0x104CF, 'M', '𐓷'), + (0x104D0, 'M', '𐓸'), + (0x104D1, 'M', '𐓹'), + (0x104D2, 'M', '𐓺'), + (0x104D3, 'M', '𐓻'), + (0x104D4, 'X'), + (0x104D8, 'V'), + (0x104FC, 'X'), + (0x10500, 'V'), + (0x10528, 'X'), + (0x10530, 'V'), + (0x10564, 'X'), + (0x1056F, 'V'), + (0x10570, 'M', '𐖗'), + (0x10571, 'M', '𐖘'), + (0x10572, 'M', '𐖙'), + (0x10573, 'M', '𐖚'), + (0x10574, 'M', '𐖛'), + (0x10575, 'M', '𐖜'), + (0x10576, 'M', '𐖝'), + (0x10577, 'M', '𐖞'), + (0x10578, 'M', '𐖟'), + (0x10579, 'M', '𐖠'), + (0x1057A, 'M', '𐖡'), + (0x1057B, 'X'), + (0x1057C, 'M', '𐖣'), + (0x1057D, 'M', '𐖤'), + (0x1057E, 'M', '𐖥'), + (0x1057F, 'M', '𐖦'), + (0x10580, 'M', '𐖧'), + (0x10581, 'M', '𐖨'), + (0x10582, 'M', '𐖩'), + (0x10583, 'M', '𐖪'), + (0x10584, 'M', '𐖫'), + (0x10585, 'M', '𐖬'), + (0x10586, 'M', '𐖭'), + (0x10587, 'M', '𐖮'), + (0x10588, 'M', '𐖯'), + (0x10589, 'M', '𐖰'), + (0x1058A, 'M', '𐖱'), + (0x1058B, 'X'), + (0x1058C, 'M', '𐖳'), + (0x1058D, 'M', '𐖴'), + (0x1058E, 'M', '𐖵'), + (0x1058F, 'M', '𐖶'), + (0x10590, 'M', '𐖷'), + (0x10591, 'M', '𐖸'), + (0x10592, 'M', '𐖹'), + (0x10593, 'X'), + (0x10594, 'M', '𐖻'), + (0x10595, 'M', '𐖼'), + (0x10596, 'X'), + (0x10597, 'V'), + (0x105A2, 'X'), + (0x105A3, 'V'), + (0x105B2, 'X'), + (0x105B3, 'V'), + (0x105BA, 'X'), + (0x105BB, 'V'), + (0x105BD, 'X'), + (0x10600, 'V'), + (0x10737, 'X'), + (0x10740, 'V'), + (0x10756, 'X'), + (0x10760, 'V'), + (0x10768, 'X'), + (0x10780, 'V'), + (0x10781, 'M', 'ː'), + (0x10782, 'M', 'ˑ'), + (0x10783, 'M', 'æ'), + (0x10784, 'M', 'ʙ'), + (0x10785, 'M', 'ɓ'), + (0x10786, 'X'), + (0x10787, 'M', 'ʣ'), + (0x10788, 'M', 'ꭦ'), + ] + +def _seg_55() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x10789, 'M', 'ʥ'), + (0x1078A, 'M', 'ʤ'), + (0x1078B, 'M', 'ɖ'), + (0x1078C, 'M', 'ɗ'), + (0x1078D, 'M', 'ᶑ'), + (0x1078E, 'M', 'ɘ'), + (0x1078F, 'M', 'ɞ'), + (0x10790, 'M', 'ʩ'), + (0x10791, 'M', 'ɤ'), + (0x10792, 'M', 'ɢ'), + (0x10793, 'M', 'ɠ'), + (0x10794, 'M', 'ʛ'), + (0x10795, 'M', 'ħ'), + (0x10796, 'M', 'ʜ'), + (0x10797, 'M', 'ɧ'), + (0x10798, 'M', 'ʄ'), + (0x10799, 'M', 'ʪ'), + (0x1079A, 'M', 'ʫ'), + (0x1079B, 'M', 'ɬ'), + (0x1079C, 'M', '𝼄'), + (0x1079D, 'M', 'ꞎ'), + (0x1079E, 'M', 'ɮ'), + (0x1079F, 'M', '𝼅'), + (0x107A0, 'M', 'ʎ'), + (0x107A1, 'M', '𝼆'), + (0x107A2, 'M', 'ø'), + (0x107A3, 'M', 'ɶ'), + (0x107A4, 'M', 'ɷ'), + (0x107A5, 'M', 'q'), + (0x107A6, 'M', 'ɺ'), + (0x107A7, 'M', '𝼈'), + (0x107A8, 'M', 'ɽ'), + (0x107A9, 'M', 'ɾ'), + (0x107AA, 'M', 'ʀ'), + (0x107AB, 'M', 'ʨ'), + (0x107AC, 'M', 'ʦ'), + (0x107AD, 'M', 'ꭧ'), + (0x107AE, 'M', 'ʧ'), + (0x107AF, 'M', 'ʈ'), + (0x107B0, 'M', 'ⱱ'), + (0x107B1, 'X'), + (0x107B2, 'M', 'ʏ'), + (0x107B3, 'M', 'ʡ'), + (0x107B4, 'M', 'ʢ'), + (0x107B5, 'M', 'ʘ'), + (0x107B6, 'M', 'ǀ'), + (0x107B7, 'M', 'ǁ'), + (0x107B8, 'M', 'ǂ'), + (0x107B9, 'M', '𝼊'), + (0x107BA, 'M', '𝼞'), + (0x107BB, 'X'), + (0x10800, 'V'), + (0x10806, 'X'), + (0x10808, 'V'), + (0x10809, 'X'), + (0x1080A, 'V'), + (0x10836, 'X'), + (0x10837, 'V'), + (0x10839, 'X'), + (0x1083C, 'V'), + (0x1083D, 'X'), + (0x1083F, 'V'), + (0x10856, 'X'), + (0x10857, 'V'), + (0x1089F, 'X'), + (0x108A7, 'V'), + (0x108B0, 'X'), + (0x108E0, 'V'), + (0x108F3, 'X'), + (0x108F4, 'V'), + (0x108F6, 'X'), + (0x108FB, 'V'), + (0x1091C, 'X'), + (0x1091F, 'V'), + (0x1093A, 'X'), + (0x1093F, 'V'), + (0x10940, 'X'), + (0x10980, 'V'), + (0x109B8, 'X'), + (0x109BC, 'V'), + (0x109D0, 'X'), + (0x109D2, 'V'), + (0x10A04, 'X'), + (0x10A05, 'V'), + (0x10A07, 'X'), + (0x10A0C, 'V'), + (0x10A14, 'X'), + (0x10A15, 'V'), + (0x10A18, 'X'), + (0x10A19, 'V'), + (0x10A36, 'X'), + (0x10A38, 'V'), + (0x10A3B, 'X'), + (0x10A3F, 'V'), + (0x10A49, 'X'), + (0x10A50, 'V'), + (0x10A59, 'X'), + (0x10A60, 'V'), + (0x10AA0, 'X'), + (0x10AC0, 'V'), + ] + +def _seg_56() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x10AE7, 'X'), + (0x10AEB, 'V'), + (0x10AF7, 'X'), + (0x10B00, 'V'), + (0x10B36, 'X'), + (0x10B39, 'V'), + (0x10B56, 'X'), + (0x10B58, 'V'), + (0x10B73, 'X'), + (0x10B78, 'V'), + (0x10B92, 'X'), + (0x10B99, 'V'), + (0x10B9D, 'X'), + (0x10BA9, 'V'), + (0x10BB0, 'X'), + (0x10C00, 'V'), + (0x10C49, 'X'), + (0x10C80, 'M', '𐳀'), + (0x10C81, 'M', '𐳁'), + (0x10C82, 'M', '𐳂'), + (0x10C83, 'M', '𐳃'), + (0x10C84, 'M', '𐳄'), + (0x10C85, 'M', '𐳅'), + (0x10C86, 'M', '𐳆'), + (0x10C87, 'M', '𐳇'), + (0x10C88, 'M', '𐳈'), + (0x10C89, 'M', '𐳉'), + (0x10C8A, 'M', '𐳊'), + (0x10C8B, 'M', '𐳋'), + (0x10C8C, 'M', '𐳌'), + (0x10C8D, 'M', '𐳍'), + (0x10C8E, 'M', '𐳎'), + (0x10C8F, 'M', '𐳏'), + (0x10C90, 'M', '𐳐'), + (0x10C91, 'M', '𐳑'), + (0x10C92, 'M', '𐳒'), + (0x10C93, 'M', '𐳓'), + (0x10C94, 'M', '𐳔'), + (0x10C95, 'M', '𐳕'), + (0x10C96, 'M', '𐳖'), + (0x10C97, 'M', '𐳗'), + (0x10C98, 'M', '𐳘'), + (0x10C99, 'M', '𐳙'), + (0x10C9A, 'M', '𐳚'), + (0x10C9B, 'M', '𐳛'), + (0x10C9C, 'M', '𐳜'), + (0x10C9D, 'M', '𐳝'), + (0x10C9E, 'M', '𐳞'), + (0x10C9F, 'M', '𐳟'), + (0x10CA0, 'M', '𐳠'), + (0x10CA1, 'M', '𐳡'), + (0x10CA2, 'M', '𐳢'), + (0x10CA3, 'M', '𐳣'), + (0x10CA4, 'M', '𐳤'), + (0x10CA5, 'M', '𐳥'), + (0x10CA6, 'M', '𐳦'), + (0x10CA7, 'M', '𐳧'), + (0x10CA8, 'M', '𐳨'), + (0x10CA9, 'M', '𐳩'), + (0x10CAA, 'M', '𐳪'), + (0x10CAB, 'M', '𐳫'), + (0x10CAC, 'M', '𐳬'), + (0x10CAD, 'M', '𐳭'), + (0x10CAE, 'M', '𐳮'), + (0x10CAF, 'M', '𐳯'), + (0x10CB0, 'M', '𐳰'), + (0x10CB1, 'M', '𐳱'), + (0x10CB2, 'M', '𐳲'), + (0x10CB3, 'X'), + (0x10CC0, 'V'), + (0x10CF3, 'X'), + (0x10CFA, 'V'), + (0x10D28, 'X'), + (0x10D30, 'V'), + (0x10D3A, 'X'), + (0x10E60, 'V'), + (0x10E7F, 'X'), + (0x10E80, 'V'), + (0x10EAA, 'X'), + (0x10EAB, 'V'), + (0x10EAE, 'X'), + (0x10EB0, 'V'), + (0x10EB2, 'X'), + (0x10EFD, 'V'), + (0x10F28, 'X'), + (0x10F30, 'V'), + (0x10F5A, 'X'), + (0x10F70, 'V'), + (0x10F8A, 'X'), + (0x10FB0, 'V'), + (0x10FCC, 'X'), + (0x10FE0, 'V'), + (0x10FF7, 'X'), + (0x11000, 'V'), + (0x1104E, 'X'), + (0x11052, 'V'), + (0x11076, 'X'), + (0x1107F, 'V'), + (0x110BD, 'X'), + (0x110BE, 'V'), + ] + +def _seg_57() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x110C3, 'X'), + (0x110D0, 'V'), + (0x110E9, 'X'), + (0x110F0, 'V'), + (0x110FA, 'X'), + (0x11100, 'V'), + (0x11135, 'X'), + (0x11136, 'V'), + (0x11148, 'X'), + (0x11150, 'V'), + (0x11177, 'X'), + (0x11180, 'V'), + (0x111E0, 'X'), + (0x111E1, 'V'), + (0x111F5, 'X'), + (0x11200, 'V'), + (0x11212, 'X'), + (0x11213, 'V'), + (0x11242, 'X'), + (0x11280, 'V'), + (0x11287, 'X'), + (0x11288, 'V'), + (0x11289, 'X'), + (0x1128A, 'V'), + (0x1128E, 'X'), + (0x1128F, 'V'), + (0x1129E, 'X'), + (0x1129F, 'V'), + (0x112AA, 'X'), + (0x112B0, 'V'), + (0x112EB, 'X'), + (0x112F0, 'V'), + (0x112FA, 'X'), + (0x11300, 'V'), + (0x11304, 'X'), + (0x11305, 'V'), + (0x1130D, 'X'), + (0x1130F, 'V'), + (0x11311, 'X'), + (0x11313, 'V'), + (0x11329, 'X'), + (0x1132A, 'V'), + (0x11331, 'X'), + (0x11332, 'V'), + (0x11334, 'X'), + (0x11335, 'V'), + (0x1133A, 'X'), + (0x1133B, 'V'), + (0x11345, 'X'), + (0x11347, 'V'), + (0x11349, 'X'), + (0x1134B, 'V'), + (0x1134E, 'X'), + (0x11350, 'V'), + (0x11351, 'X'), + (0x11357, 'V'), + (0x11358, 'X'), + (0x1135D, 'V'), + (0x11364, 'X'), + (0x11366, 'V'), + (0x1136D, 'X'), + (0x11370, 'V'), + (0x11375, 'X'), + (0x11400, 'V'), + (0x1145C, 'X'), + (0x1145D, 'V'), + (0x11462, 'X'), + (0x11480, 'V'), + (0x114C8, 'X'), + (0x114D0, 'V'), + (0x114DA, 'X'), + (0x11580, 'V'), + (0x115B6, 'X'), + (0x115B8, 'V'), + (0x115DE, 'X'), + (0x11600, 'V'), + (0x11645, 'X'), + (0x11650, 'V'), + (0x1165A, 'X'), + (0x11660, 'V'), + (0x1166D, 'X'), + (0x11680, 'V'), + (0x116BA, 'X'), + (0x116C0, 'V'), + (0x116CA, 'X'), + (0x11700, 'V'), + (0x1171B, 'X'), + (0x1171D, 'V'), + (0x1172C, 'X'), + (0x11730, 'V'), + (0x11747, 'X'), + (0x11800, 'V'), + (0x1183C, 'X'), + (0x118A0, 'M', '𑣀'), + (0x118A1, 'M', '𑣁'), + (0x118A2, 'M', '𑣂'), + (0x118A3, 'M', '𑣃'), + (0x118A4, 'M', '𑣄'), + (0x118A5, 'M', '𑣅'), + (0x118A6, 'M', '𑣆'), + ] + +def _seg_58() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x118A7, 'M', '𑣇'), + (0x118A8, 'M', '𑣈'), + (0x118A9, 'M', '𑣉'), + (0x118AA, 'M', '𑣊'), + (0x118AB, 'M', '𑣋'), + (0x118AC, 'M', '𑣌'), + (0x118AD, 'M', '𑣍'), + (0x118AE, 'M', '𑣎'), + (0x118AF, 'M', '𑣏'), + (0x118B0, 'M', '𑣐'), + (0x118B1, 'M', '𑣑'), + (0x118B2, 'M', '𑣒'), + (0x118B3, 'M', '𑣓'), + (0x118B4, 'M', '𑣔'), + (0x118B5, 'M', '𑣕'), + (0x118B6, 'M', '𑣖'), + (0x118B7, 'M', '𑣗'), + (0x118B8, 'M', '𑣘'), + (0x118B9, 'M', '𑣙'), + (0x118BA, 'M', '𑣚'), + (0x118BB, 'M', '𑣛'), + (0x118BC, 'M', '𑣜'), + (0x118BD, 'M', '𑣝'), + (0x118BE, 'M', '𑣞'), + (0x118BF, 'M', '𑣟'), + (0x118C0, 'V'), + (0x118F3, 'X'), + (0x118FF, 'V'), + (0x11907, 'X'), + (0x11909, 'V'), + (0x1190A, 'X'), + (0x1190C, 'V'), + (0x11914, 'X'), + (0x11915, 'V'), + (0x11917, 'X'), + (0x11918, 'V'), + (0x11936, 'X'), + (0x11937, 'V'), + (0x11939, 'X'), + (0x1193B, 'V'), + (0x11947, 'X'), + (0x11950, 'V'), + (0x1195A, 'X'), + (0x119A0, 'V'), + (0x119A8, 'X'), + (0x119AA, 'V'), + (0x119D8, 'X'), + (0x119DA, 'V'), + (0x119E5, 'X'), + (0x11A00, 'V'), + (0x11A48, 'X'), + (0x11A50, 'V'), + (0x11AA3, 'X'), + (0x11AB0, 'V'), + (0x11AF9, 'X'), + (0x11B00, 'V'), + (0x11B0A, 'X'), + (0x11C00, 'V'), + (0x11C09, 'X'), + (0x11C0A, 'V'), + (0x11C37, 'X'), + (0x11C38, 'V'), + (0x11C46, 'X'), + (0x11C50, 'V'), + (0x11C6D, 'X'), + (0x11C70, 'V'), + (0x11C90, 'X'), + (0x11C92, 'V'), + (0x11CA8, 'X'), + (0x11CA9, 'V'), + (0x11CB7, 'X'), + (0x11D00, 'V'), + (0x11D07, 'X'), + (0x11D08, 'V'), + (0x11D0A, 'X'), + (0x11D0B, 'V'), + (0x11D37, 'X'), + (0x11D3A, 'V'), + (0x11D3B, 'X'), + (0x11D3C, 'V'), + (0x11D3E, 'X'), + (0x11D3F, 'V'), + (0x11D48, 'X'), + (0x11D50, 'V'), + (0x11D5A, 'X'), + (0x11D60, 'V'), + (0x11D66, 'X'), + (0x11D67, 'V'), + (0x11D69, 'X'), + (0x11D6A, 'V'), + (0x11D8F, 'X'), + (0x11D90, 'V'), + (0x11D92, 'X'), + (0x11D93, 'V'), + (0x11D99, 'X'), + (0x11DA0, 'V'), + (0x11DAA, 'X'), + (0x11EE0, 'V'), + (0x11EF9, 'X'), + (0x11F00, 'V'), + ] + +def _seg_59() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x11F11, 'X'), + (0x11F12, 'V'), + (0x11F3B, 'X'), + (0x11F3E, 'V'), + (0x11F5A, 'X'), + (0x11FB0, 'V'), + (0x11FB1, 'X'), + (0x11FC0, 'V'), + (0x11FF2, 'X'), + (0x11FFF, 'V'), + (0x1239A, 'X'), + (0x12400, 'V'), + (0x1246F, 'X'), + (0x12470, 'V'), + (0x12475, 'X'), + (0x12480, 'V'), + (0x12544, 'X'), + (0x12F90, 'V'), + (0x12FF3, 'X'), + (0x13000, 'V'), + (0x13430, 'X'), + (0x13440, 'V'), + (0x13456, 'X'), + (0x14400, 'V'), + (0x14647, 'X'), + (0x16800, 'V'), + (0x16A39, 'X'), + (0x16A40, 'V'), + (0x16A5F, 'X'), + (0x16A60, 'V'), + (0x16A6A, 'X'), + (0x16A6E, 'V'), + (0x16ABF, 'X'), + (0x16AC0, 'V'), + (0x16ACA, 'X'), + (0x16AD0, 'V'), + (0x16AEE, 'X'), + (0x16AF0, 'V'), + (0x16AF6, 'X'), + (0x16B00, 'V'), + (0x16B46, 'X'), + (0x16B50, 'V'), + (0x16B5A, 'X'), + (0x16B5B, 'V'), + (0x16B62, 'X'), + (0x16B63, 'V'), + (0x16B78, 'X'), + (0x16B7D, 'V'), + (0x16B90, 'X'), + (0x16E40, 'M', '𖹠'), + (0x16E41, 'M', '𖹡'), + (0x16E42, 'M', '𖹢'), + (0x16E43, 'M', '𖹣'), + (0x16E44, 'M', '𖹤'), + (0x16E45, 'M', '𖹥'), + (0x16E46, 'M', '𖹦'), + (0x16E47, 'M', '𖹧'), + (0x16E48, 'M', '𖹨'), + (0x16E49, 'M', '𖹩'), + (0x16E4A, 'M', '𖹪'), + (0x16E4B, 'M', '𖹫'), + (0x16E4C, 'M', '𖹬'), + (0x16E4D, 'M', '𖹭'), + (0x16E4E, 'M', '𖹮'), + (0x16E4F, 'M', '𖹯'), + (0x16E50, 'M', '𖹰'), + (0x16E51, 'M', '𖹱'), + (0x16E52, 'M', '𖹲'), + (0x16E53, 'M', '𖹳'), + (0x16E54, 'M', '𖹴'), + (0x16E55, 'M', '𖹵'), + (0x16E56, 'M', '𖹶'), + (0x16E57, 'M', '𖹷'), + (0x16E58, 'M', '𖹸'), + (0x16E59, 'M', '𖹹'), + (0x16E5A, 'M', '𖹺'), + (0x16E5B, 'M', '𖹻'), + (0x16E5C, 'M', '𖹼'), + (0x16E5D, 'M', '𖹽'), + (0x16E5E, 'M', '𖹾'), + (0x16E5F, 'M', '𖹿'), + (0x16E60, 'V'), + (0x16E9B, 'X'), + (0x16F00, 'V'), + (0x16F4B, 'X'), + (0x16F4F, 'V'), + (0x16F88, 'X'), + (0x16F8F, 'V'), + (0x16FA0, 'X'), + (0x16FE0, 'V'), + (0x16FE5, 'X'), + (0x16FF0, 'V'), + (0x16FF2, 'X'), + (0x17000, 'V'), + (0x187F8, 'X'), + (0x18800, 'V'), + (0x18CD6, 'X'), + (0x18D00, 'V'), + (0x18D09, 'X'), + (0x1AFF0, 'V'), + ] + +def _seg_60() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1AFF4, 'X'), + (0x1AFF5, 'V'), + (0x1AFFC, 'X'), + (0x1AFFD, 'V'), + (0x1AFFF, 'X'), + (0x1B000, 'V'), + (0x1B123, 'X'), + (0x1B132, 'V'), + (0x1B133, 'X'), + (0x1B150, 'V'), + (0x1B153, 'X'), + (0x1B155, 'V'), + (0x1B156, 'X'), + (0x1B164, 'V'), + (0x1B168, 'X'), + (0x1B170, 'V'), + (0x1B2FC, 'X'), + (0x1BC00, 'V'), + (0x1BC6B, 'X'), + (0x1BC70, 'V'), + (0x1BC7D, 'X'), + (0x1BC80, 'V'), + (0x1BC89, 'X'), + (0x1BC90, 'V'), + (0x1BC9A, 'X'), + (0x1BC9C, 'V'), + (0x1BCA0, 'I'), + (0x1BCA4, 'X'), + (0x1CF00, 'V'), + (0x1CF2E, 'X'), + (0x1CF30, 'V'), + (0x1CF47, 'X'), + (0x1CF50, 'V'), + (0x1CFC4, 'X'), + (0x1D000, 'V'), + (0x1D0F6, 'X'), + (0x1D100, 'V'), + (0x1D127, 'X'), + (0x1D129, 'V'), + (0x1D15E, 'M', '𝅗𝅥'), + (0x1D15F, 'M', '𝅘𝅥'), + (0x1D160, 'M', '𝅘𝅥𝅮'), + (0x1D161, 'M', '𝅘𝅥𝅯'), + (0x1D162, 'M', '𝅘𝅥𝅰'), + (0x1D163, 'M', '𝅘𝅥𝅱'), + (0x1D164, 'M', '𝅘𝅥𝅲'), + (0x1D165, 'V'), + (0x1D173, 'X'), + (0x1D17B, 'V'), + (0x1D1BB, 'M', '𝆹𝅥'), + (0x1D1BC, 'M', '𝆺𝅥'), + (0x1D1BD, 'M', '𝆹𝅥𝅮'), + (0x1D1BE, 'M', '𝆺𝅥𝅮'), + (0x1D1BF, 'M', '𝆹𝅥𝅯'), + (0x1D1C0, 'M', '𝆺𝅥𝅯'), + (0x1D1C1, 'V'), + (0x1D1EB, 'X'), + (0x1D200, 'V'), + (0x1D246, 'X'), + (0x1D2C0, 'V'), + (0x1D2D4, 'X'), + (0x1D2E0, 'V'), + (0x1D2F4, 'X'), + (0x1D300, 'V'), + (0x1D357, 'X'), + (0x1D360, 'V'), + (0x1D379, 'X'), + (0x1D400, 'M', 'a'), + (0x1D401, 'M', 'b'), + (0x1D402, 'M', 'c'), + (0x1D403, 'M', 'd'), + (0x1D404, 'M', 'e'), + (0x1D405, 'M', 'f'), + (0x1D406, 'M', 'g'), + (0x1D407, 'M', 'h'), + (0x1D408, 'M', 'i'), + (0x1D409, 'M', 'j'), + (0x1D40A, 'M', 'k'), + (0x1D40B, 'M', 'l'), + (0x1D40C, 'M', 'm'), + (0x1D40D, 'M', 'n'), + (0x1D40E, 'M', 'o'), + (0x1D40F, 'M', 'p'), + (0x1D410, 'M', 'q'), + (0x1D411, 'M', 'r'), + (0x1D412, 'M', 's'), + (0x1D413, 'M', 't'), + (0x1D414, 'M', 'u'), + (0x1D415, 'M', 'v'), + (0x1D416, 'M', 'w'), + (0x1D417, 'M', 'x'), + (0x1D418, 'M', 'y'), + (0x1D419, 'M', 'z'), + (0x1D41A, 'M', 'a'), + (0x1D41B, 'M', 'b'), + (0x1D41C, 'M', 'c'), + (0x1D41D, 'M', 'd'), + (0x1D41E, 'M', 'e'), + (0x1D41F, 'M', 'f'), + (0x1D420, 'M', 'g'), + ] + +def _seg_61() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D421, 'M', 'h'), + (0x1D422, 'M', 'i'), + (0x1D423, 'M', 'j'), + (0x1D424, 'M', 'k'), + (0x1D425, 'M', 'l'), + (0x1D426, 'M', 'm'), + (0x1D427, 'M', 'n'), + (0x1D428, 'M', 'o'), + (0x1D429, 'M', 'p'), + (0x1D42A, 'M', 'q'), + (0x1D42B, 'M', 'r'), + (0x1D42C, 'M', 's'), + (0x1D42D, 'M', 't'), + (0x1D42E, 'M', 'u'), + (0x1D42F, 'M', 'v'), + (0x1D430, 'M', 'w'), + (0x1D431, 'M', 'x'), + (0x1D432, 'M', 'y'), + (0x1D433, 'M', 'z'), + (0x1D434, 'M', 'a'), + (0x1D435, 'M', 'b'), + (0x1D436, 'M', 'c'), + (0x1D437, 'M', 'd'), + (0x1D438, 'M', 'e'), + (0x1D439, 'M', 'f'), + (0x1D43A, 'M', 'g'), + (0x1D43B, 'M', 'h'), + (0x1D43C, 'M', 'i'), + (0x1D43D, 'M', 'j'), + (0x1D43E, 'M', 'k'), + (0x1D43F, 'M', 'l'), + (0x1D440, 'M', 'm'), + (0x1D441, 'M', 'n'), + (0x1D442, 'M', 'o'), + (0x1D443, 'M', 'p'), + (0x1D444, 'M', 'q'), + (0x1D445, 'M', 'r'), + (0x1D446, 'M', 's'), + (0x1D447, 'M', 't'), + (0x1D448, 'M', 'u'), + (0x1D449, 'M', 'v'), + (0x1D44A, 'M', 'w'), + (0x1D44B, 'M', 'x'), + (0x1D44C, 'M', 'y'), + (0x1D44D, 'M', 'z'), + (0x1D44E, 'M', 'a'), + (0x1D44F, 'M', 'b'), + (0x1D450, 'M', 'c'), + (0x1D451, 'M', 'd'), + (0x1D452, 'M', 'e'), + (0x1D453, 'M', 'f'), + (0x1D454, 'M', 'g'), + (0x1D455, 'X'), + (0x1D456, 'M', 'i'), + (0x1D457, 'M', 'j'), + (0x1D458, 'M', 'k'), + (0x1D459, 'M', 'l'), + (0x1D45A, 'M', 'm'), + (0x1D45B, 'M', 'n'), + (0x1D45C, 'M', 'o'), + (0x1D45D, 'M', 'p'), + (0x1D45E, 'M', 'q'), + (0x1D45F, 'M', 'r'), + (0x1D460, 'M', 's'), + (0x1D461, 'M', 't'), + (0x1D462, 'M', 'u'), + (0x1D463, 'M', 'v'), + (0x1D464, 'M', 'w'), + (0x1D465, 'M', 'x'), + (0x1D466, 'M', 'y'), + (0x1D467, 'M', 'z'), + (0x1D468, 'M', 'a'), + (0x1D469, 'M', 'b'), + (0x1D46A, 'M', 'c'), + (0x1D46B, 'M', 'd'), + (0x1D46C, 'M', 'e'), + (0x1D46D, 'M', 'f'), + (0x1D46E, 'M', 'g'), + (0x1D46F, 'M', 'h'), + (0x1D470, 'M', 'i'), + (0x1D471, 'M', 'j'), + (0x1D472, 'M', 'k'), + (0x1D473, 'M', 'l'), + (0x1D474, 'M', 'm'), + (0x1D475, 'M', 'n'), + (0x1D476, 'M', 'o'), + (0x1D477, 'M', 'p'), + (0x1D478, 'M', 'q'), + (0x1D479, 'M', 'r'), + (0x1D47A, 'M', 's'), + (0x1D47B, 'M', 't'), + (0x1D47C, 'M', 'u'), + (0x1D47D, 'M', 'v'), + (0x1D47E, 'M', 'w'), + (0x1D47F, 'M', 'x'), + (0x1D480, 'M', 'y'), + (0x1D481, 'M', 'z'), + (0x1D482, 'M', 'a'), + (0x1D483, 'M', 'b'), + (0x1D484, 'M', 'c'), + ] + +def _seg_62() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D485, 'M', 'd'), + (0x1D486, 'M', 'e'), + (0x1D487, 'M', 'f'), + (0x1D488, 'M', 'g'), + (0x1D489, 'M', 'h'), + (0x1D48A, 'M', 'i'), + (0x1D48B, 'M', 'j'), + (0x1D48C, 'M', 'k'), + (0x1D48D, 'M', 'l'), + (0x1D48E, 'M', 'm'), + (0x1D48F, 'M', 'n'), + (0x1D490, 'M', 'o'), + (0x1D491, 'M', 'p'), + (0x1D492, 'M', 'q'), + (0x1D493, 'M', 'r'), + (0x1D494, 'M', 's'), + (0x1D495, 'M', 't'), + (0x1D496, 'M', 'u'), + (0x1D497, 'M', 'v'), + (0x1D498, 'M', 'w'), + (0x1D499, 'M', 'x'), + (0x1D49A, 'M', 'y'), + (0x1D49B, 'M', 'z'), + (0x1D49C, 'M', 'a'), + (0x1D49D, 'X'), + (0x1D49E, 'M', 'c'), + (0x1D49F, 'M', 'd'), + (0x1D4A0, 'X'), + (0x1D4A2, 'M', 'g'), + (0x1D4A3, 'X'), + (0x1D4A5, 'M', 'j'), + (0x1D4A6, 'M', 'k'), + (0x1D4A7, 'X'), + (0x1D4A9, 'M', 'n'), + (0x1D4AA, 'M', 'o'), + (0x1D4AB, 'M', 'p'), + (0x1D4AC, 'M', 'q'), + (0x1D4AD, 'X'), + (0x1D4AE, 'M', 's'), + (0x1D4AF, 'M', 't'), + (0x1D4B0, 'M', 'u'), + (0x1D4B1, 'M', 'v'), + (0x1D4B2, 'M', 'w'), + (0x1D4B3, 'M', 'x'), + (0x1D4B4, 'M', 'y'), + (0x1D4B5, 'M', 'z'), + (0x1D4B6, 'M', 'a'), + (0x1D4B7, 'M', 'b'), + (0x1D4B8, 'M', 'c'), + (0x1D4B9, 'M', 'd'), + (0x1D4BA, 'X'), + (0x1D4BB, 'M', 'f'), + (0x1D4BC, 'X'), + (0x1D4BD, 'M', 'h'), + (0x1D4BE, 'M', 'i'), + (0x1D4BF, 'M', 'j'), + (0x1D4C0, 'M', 'k'), + (0x1D4C1, 'M', 'l'), + (0x1D4C2, 'M', 'm'), + (0x1D4C3, 'M', 'n'), + (0x1D4C4, 'X'), + (0x1D4C5, 'M', 'p'), + (0x1D4C6, 'M', 'q'), + (0x1D4C7, 'M', 'r'), + (0x1D4C8, 'M', 's'), + (0x1D4C9, 'M', 't'), + (0x1D4CA, 'M', 'u'), + (0x1D4CB, 'M', 'v'), + (0x1D4CC, 'M', 'w'), + (0x1D4CD, 'M', 'x'), + (0x1D4CE, 'M', 'y'), + (0x1D4CF, 'M', 'z'), + (0x1D4D0, 'M', 'a'), + (0x1D4D1, 'M', 'b'), + (0x1D4D2, 'M', 'c'), + (0x1D4D3, 'M', 'd'), + (0x1D4D4, 'M', 'e'), + (0x1D4D5, 'M', 'f'), + (0x1D4D6, 'M', 'g'), + (0x1D4D7, 'M', 'h'), + (0x1D4D8, 'M', 'i'), + (0x1D4D9, 'M', 'j'), + (0x1D4DA, 'M', 'k'), + (0x1D4DB, 'M', 'l'), + (0x1D4DC, 'M', 'm'), + (0x1D4DD, 'M', 'n'), + (0x1D4DE, 'M', 'o'), + (0x1D4DF, 'M', 'p'), + (0x1D4E0, 'M', 'q'), + (0x1D4E1, 'M', 'r'), + (0x1D4E2, 'M', 's'), + (0x1D4E3, 'M', 't'), + (0x1D4E4, 'M', 'u'), + (0x1D4E5, 'M', 'v'), + (0x1D4E6, 'M', 'w'), + (0x1D4E7, 'M', 'x'), + (0x1D4E8, 'M', 'y'), + (0x1D4E9, 'M', 'z'), + (0x1D4EA, 'M', 'a'), + (0x1D4EB, 'M', 'b'), + ] + +def _seg_63() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D4EC, 'M', 'c'), + (0x1D4ED, 'M', 'd'), + (0x1D4EE, 'M', 'e'), + (0x1D4EF, 'M', 'f'), + (0x1D4F0, 'M', 'g'), + (0x1D4F1, 'M', 'h'), + (0x1D4F2, 'M', 'i'), + (0x1D4F3, 'M', 'j'), + (0x1D4F4, 'M', 'k'), + (0x1D4F5, 'M', 'l'), + (0x1D4F6, 'M', 'm'), + (0x1D4F7, 'M', 'n'), + (0x1D4F8, 'M', 'o'), + (0x1D4F9, 'M', 'p'), + (0x1D4FA, 'M', 'q'), + (0x1D4FB, 'M', 'r'), + (0x1D4FC, 'M', 's'), + (0x1D4FD, 'M', 't'), + (0x1D4FE, 'M', 'u'), + (0x1D4FF, 'M', 'v'), + (0x1D500, 'M', 'w'), + (0x1D501, 'M', 'x'), + (0x1D502, 'M', 'y'), + (0x1D503, 'M', 'z'), + (0x1D504, 'M', 'a'), + (0x1D505, 'M', 'b'), + (0x1D506, 'X'), + (0x1D507, 'M', 'd'), + (0x1D508, 'M', 'e'), + (0x1D509, 'M', 'f'), + (0x1D50A, 'M', 'g'), + (0x1D50B, 'X'), + (0x1D50D, 'M', 'j'), + (0x1D50E, 'M', 'k'), + (0x1D50F, 'M', 'l'), + (0x1D510, 'M', 'm'), + (0x1D511, 'M', 'n'), + (0x1D512, 'M', 'o'), + (0x1D513, 'M', 'p'), + (0x1D514, 'M', 'q'), + (0x1D515, 'X'), + (0x1D516, 'M', 's'), + (0x1D517, 'M', 't'), + (0x1D518, 'M', 'u'), + (0x1D519, 'M', 'v'), + (0x1D51A, 'M', 'w'), + (0x1D51B, 'M', 'x'), + (0x1D51C, 'M', 'y'), + (0x1D51D, 'X'), + (0x1D51E, 'M', 'a'), + (0x1D51F, 'M', 'b'), + (0x1D520, 'M', 'c'), + (0x1D521, 'M', 'd'), + (0x1D522, 'M', 'e'), + (0x1D523, 'M', 'f'), + (0x1D524, 'M', 'g'), + (0x1D525, 'M', 'h'), + (0x1D526, 'M', 'i'), + (0x1D527, 'M', 'j'), + (0x1D528, 'M', 'k'), + (0x1D529, 'M', 'l'), + (0x1D52A, 'M', 'm'), + (0x1D52B, 'M', 'n'), + (0x1D52C, 'M', 'o'), + (0x1D52D, 'M', 'p'), + (0x1D52E, 'M', 'q'), + (0x1D52F, 'M', 'r'), + (0x1D530, 'M', 's'), + (0x1D531, 'M', 't'), + (0x1D532, 'M', 'u'), + (0x1D533, 'M', 'v'), + (0x1D534, 'M', 'w'), + (0x1D535, 'M', 'x'), + (0x1D536, 'M', 'y'), + (0x1D537, 'M', 'z'), + (0x1D538, 'M', 'a'), + (0x1D539, 'M', 'b'), + (0x1D53A, 'X'), + (0x1D53B, 'M', 'd'), + (0x1D53C, 'M', 'e'), + (0x1D53D, 'M', 'f'), + (0x1D53E, 'M', 'g'), + (0x1D53F, 'X'), + (0x1D540, 'M', 'i'), + (0x1D541, 'M', 'j'), + (0x1D542, 'M', 'k'), + (0x1D543, 'M', 'l'), + (0x1D544, 'M', 'm'), + (0x1D545, 'X'), + (0x1D546, 'M', 'o'), + (0x1D547, 'X'), + (0x1D54A, 'M', 's'), + (0x1D54B, 'M', 't'), + (0x1D54C, 'M', 'u'), + (0x1D54D, 'M', 'v'), + (0x1D54E, 'M', 'w'), + (0x1D54F, 'M', 'x'), + (0x1D550, 'M', 'y'), + (0x1D551, 'X'), + (0x1D552, 'M', 'a'), + ] + +def _seg_64() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D553, 'M', 'b'), + (0x1D554, 'M', 'c'), + (0x1D555, 'M', 'd'), + (0x1D556, 'M', 'e'), + (0x1D557, 'M', 'f'), + (0x1D558, 'M', 'g'), + (0x1D559, 'M', 'h'), + (0x1D55A, 'M', 'i'), + (0x1D55B, 'M', 'j'), + (0x1D55C, 'M', 'k'), + (0x1D55D, 'M', 'l'), + (0x1D55E, 'M', 'm'), + (0x1D55F, 'M', 'n'), + (0x1D560, 'M', 'o'), + (0x1D561, 'M', 'p'), + (0x1D562, 'M', 'q'), + (0x1D563, 'M', 'r'), + (0x1D564, 'M', 's'), + (0x1D565, 'M', 't'), + (0x1D566, 'M', 'u'), + (0x1D567, 'M', 'v'), + (0x1D568, 'M', 'w'), + (0x1D569, 'M', 'x'), + (0x1D56A, 'M', 'y'), + (0x1D56B, 'M', 'z'), + (0x1D56C, 'M', 'a'), + (0x1D56D, 'M', 'b'), + (0x1D56E, 'M', 'c'), + (0x1D56F, 'M', 'd'), + (0x1D570, 'M', 'e'), + (0x1D571, 'M', 'f'), + (0x1D572, 'M', 'g'), + (0x1D573, 'M', 'h'), + (0x1D574, 'M', 'i'), + (0x1D575, 'M', 'j'), + (0x1D576, 'M', 'k'), + (0x1D577, 'M', 'l'), + (0x1D578, 'M', 'm'), + (0x1D579, 'M', 'n'), + (0x1D57A, 'M', 'o'), + (0x1D57B, 'M', 'p'), + (0x1D57C, 'M', 'q'), + (0x1D57D, 'M', 'r'), + (0x1D57E, 'M', 's'), + (0x1D57F, 'M', 't'), + (0x1D580, 'M', 'u'), + (0x1D581, 'M', 'v'), + (0x1D582, 'M', 'w'), + (0x1D583, 'M', 'x'), + (0x1D584, 'M', 'y'), + (0x1D585, 'M', 'z'), + (0x1D586, 'M', 'a'), + (0x1D587, 'M', 'b'), + (0x1D588, 'M', 'c'), + (0x1D589, 'M', 'd'), + (0x1D58A, 'M', 'e'), + (0x1D58B, 'M', 'f'), + (0x1D58C, 'M', 'g'), + (0x1D58D, 'M', 'h'), + (0x1D58E, 'M', 'i'), + (0x1D58F, 'M', 'j'), + (0x1D590, 'M', 'k'), + (0x1D591, 'M', 'l'), + (0x1D592, 'M', 'm'), + (0x1D593, 'M', 'n'), + (0x1D594, 'M', 'o'), + (0x1D595, 'M', 'p'), + (0x1D596, 'M', 'q'), + (0x1D597, 'M', 'r'), + (0x1D598, 'M', 's'), + (0x1D599, 'M', 't'), + (0x1D59A, 'M', 'u'), + (0x1D59B, 'M', 'v'), + (0x1D59C, 'M', 'w'), + (0x1D59D, 'M', 'x'), + (0x1D59E, 'M', 'y'), + (0x1D59F, 'M', 'z'), + (0x1D5A0, 'M', 'a'), + (0x1D5A1, 'M', 'b'), + (0x1D5A2, 'M', 'c'), + (0x1D5A3, 'M', 'd'), + (0x1D5A4, 'M', 'e'), + (0x1D5A5, 'M', 'f'), + (0x1D5A6, 'M', 'g'), + (0x1D5A7, 'M', 'h'), + (0x1D5A8, 'M', 'i'), + (0x1D5A9, 'M', 'j'), + (0x1D5AA, 'M', 'k'), + (0x1D5AB, 'M', 'l'), + (0x1D5AC, 'M', 'm'), + (0x1D5AD, 'M', 'n'), + (0x1D5AE, 'M', 'o'), + (0x1D5AF, 'M', 'p'), + (0x1D5B0, 'M', 'q'), + (0x1D5B1, 'M', 'r'), + (0x1D5B2, 'M', 's'), + (0x1D5B3, 'M', 't'), + (0x1D5B4, 'M', 'u'), + (0x1D5B5, 'M', 'v'), + (0x1D5B6, 'M', 'w'), + ] + +def _seg_65() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D5B7, 'M', 'x'), + (0x1D5B8, 'M', 'y'), + (0x1D5B9, 'M', 'z'), + (0x1D5BA, 'M', 'a'), + (0x1D5BB, 'M', 'b'), + (0x1D5BC, 'M', 'c'), + (0x1D5BD, 'M', 'd'), + (0x1D5BE, 'M', 'e'), + (0x1D5BF, 'M', 'f'), + (0x1D5C0, 'M', 'g'), + (0x1D5C1, 'M', 'h'), + (0x1D5C2, 'M', 'i'), + (0x1D5C3, 'M', 'j'), + (0x1D5C4, 'M', 'k'), + (0x1D5C5, 'M', 'l'), + (0x1D5C6, 'M', 'm'), + (0x1D5C7, 'M', 'n'), + (0x1D5C8, 'M', 'o'), + (0x1D5C9, 'M', 'p'), + (0x1D5CA, 'M', 'q'), + (0x1D5CB, 'M', 'r'), + (0x1D5CC, 'M', 's'), + (0x1D5CD, 'M', 't'), + (0x1D5CE, 'M', 'u'), + (0x1D5CF, 'M', 'v'), + (0x1D5D0, 'M', 'w'), + (0x1D5D1, 'M', 'x'), + (0x1D5D2, 'M', 'y'), + (0x1D5D3, 'M', 'z'), + (0x1D5D4, 'M', 'a'), + (0x1D5D5, 'M', 'b'), + (0x1D5D6, 'M', 'c'), + (0x1D5D7, 'M', 'd'), + (0x1D5D8, 'M', 'e'), + (0x1D5D9, 'M', 'f'), + (0x1D5DA, 'M', 'g'), + (0x1D5DB, 'M', 'h'), + (0x1D5DC, 'M', 'i'), + (0x1D5DD, 'M', 'j'), + (0x1D5DE, 'M', 'k'), + (0x1D5DF, 'M', 'l'), + (0x1D5E0, 'M', 'm'), + (0x1D5E1, 'M', 'n'), + (0x1D5E2, 'M', 'o'), + (0x1D5E3, 'M', 'p'), + (0x1D5E4, 'M', 'q'), + (0x1D5E5, 'M', 'r'), + (0x1D5E6, 'M', 's'), + (0x1D5E7, 'M', 't'), + (0x1D5E8, 'M', 'u'), + (0x1D5E9, 'M', 'v'), + (0x1D5EA, 'M', 'w'), + (0x1D5EB, 'M', 'x'), + (0x1D5EC, 'M', 'y'), + (0x1D5ED, 'M', 'z'), + (0x1D5EE, 'M', 'a'), + (0x1D5EF, 'M', 'b'), + (0x1D5F0, 'M', 'c'), + (0x1D5F1, 'M', 'd'), + (0x1D5F2, 'M', 'e'), + (0x1D5F3, 'M', 'f'), + (0x1D5F4, 'M', 'g'), + (0x1D5F5, 'M', 'h'), + (0x1D5F6, 'M', 'i'), + (0x1D5F7, 'M', 'j'), + (0x1D5F8, 'M', 'k'), + (0x1D5F9, 'M', 'l'), + (0x1D5FA, 'M', 'm'), + (0x1D5FB, 'M', 'n'), + (0x1D5FC, 'M', 'o'), + (0x1D5FD, 'M', 'p'), + (0x1D5FE, 'M', 'q'), + (0x1D5FF, 'M', 'r'), + (0x1D600, 'M', 's'), + (0x1D601, 'M', 't'), + (0x1D602, 'M', 'u'), + (0x1D603, 'M', 'v'), + (0x1D604, 'M', 'w'), + (0x1D605, 'M', 'x'), + (0x1D606, 'M', 'y'), + (0x1D607, 'M', 'z'), + (0x1D608, 'M', 'a'), + (0x1D609, 'M', 'b'), + (0x1D60A, 'M', 'c'), + (0x1D60B, 'M', 'd'), + (0x1D60C, 'M', 'e'), + (0x1D60D, 'M', 'f'), + (0x1D60E, 'M', 'g'), + (0x1D60F, 'M', 'h'), + (0x1D610, 'M', 'i'), + (0x1D611, 'M', 'j'), + (0x1D612, 'M', 'k'), + (0x1D613, 'M', 'l'), + (0x1D614, 'M', 'm'), + (0x1D615, 'M', 'n'), + (0x1D616, 'M', 'o'), + (0x1D617, 'M', 'p'), + (0x1D618, 'M', 'q'), + (0x1D619, 'M', 'r'), + (0x1D61A, 'M', 's'), + ] + +def _seg_66() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D61B, 'M', 't'), + (0x1D61C, 'M', 'u'), + (0x1D61D, 'M', 'v'), + (0x1D61E, 'M', 'w'), + (0x1D61F, 'M', 'x'), + (0x1D620, 'M', 'y'), + (0x1D621, 'M', 'z'), + (0x1D622, 'M', 'a'), + (0x1D623, 'M', 'b'), + (0x1D624, 'M', 'c'), + (0x1D625, 'M', 'd'), + (0x1D626, 'M', 'e'), + (0x1D627, 'M', 'f'), + (0x1D628, 'M', 'g'), + (0x1D629, 'M', 'h'), + (0x1D62A, 'M', 'i'), + (0x1D62B, 'M', 'j'), + (0x1D62C, 'M', 'k'), + (0x1D62D, 'M', 'l'), + (0x1D62E, 'M', 'm'), + (0x1D62F, 'M', 'n'), + (0x1D630, 'M', 'o'), + (0x1D631, 'M', 'p'), + (0x1D632, 'M', 'q'), + (0x1D633, 'M', 'r'), + (0x1D634, 'M', 's'), + (0x1D635, 'M', 't'), + (0x1D636, 'M', 'u'), + (0x1D637, 'M', 'v'), + (0x1D638, 'M', 'w'), + (0x1D639, 'M', 'x'), + (0x1D63A, 'M', 'y'), + (0x1D63B, 'M', 'z'), + (0x1D63C, 'M', 'a'), + (0x1D63D, 'M', 'b'), + (0x1D63E, 'M', 'c'), + (0x1D63F, 'M', 'd'), + (0x1D640, 'M', 'e'), + (0x1D641, 'M', 'f'), + (0x1D642, 'M', 'g'), + (0x1D643, 'M', 'h'), + (0x1D644, 'M', 'i'), + (0x1D645, 'M', 'j'), + (0x1D646, 'M', 'k'), + (0x1D647, 'M', 'l'), + (0x1D648, 'M', 'm'), + (0x1D649, 'M', 'n'), + (0x1D64A, 'M', 'o'), + (0x1D64B, 'M', 'p'), + (0x1D64C, 'M', 'q'), + (0x1D64D, 'M', 'r'), + (0x1D64E, 'M', 's'), + (0x1D64F, 'M', 't'), + (0x1D650, 'M', 'u'), + (0x1D651, 'M', 'v'), + (0x1D652, 'M', 'w'), + (0x1D653, 'M', 'x'), + (0x1D654, 'M', 'y'), + (0x1D655, 'M', 'z'), + (0x1D656, 'M', 'a'), + (0x1D657, 'M', 'b'), + (0x1D658, 'M', 'c'), + (0x1D659, 'M', 'd'), + (0x1D65A, 'M', 'e'), + (0x1D65B, 'M', 'f'), + (0x1D65C, 'M', 'g'), + (0x1D65D, 'M', 'h'), + (0x1D65E, 'M', 'i'), + (0x1D65F, 'M', 'j'), + (0x1D660, 'M', 'k'), + (0x1D661, 'M', 'l'), + (0x1D662, 'M', 'm'), + (0x1D663, 'M', 'n'), + (0x1D664, 'M', 'o'), + (0x1D665, 'M', 'p'), + (0x1D666, 'M', 'q'), + (0x1D667, 'M', 'r'), + (0x1D668, 'M', 's'), + (0x1D669, 'M', 't'), + (0x1D66A, 'M', 'u'), + (0x1D66B, 'M', 'v'), + (0x1D66C, 'M', 'w'), + (0x1D66D, 'M', 'x'), + (0x1D66E, 'M', 'y'), + (0x1D66F, 'M', 'z'), + (0x1D670, 'M', 'a'), + (0x1D671, 'M', 'b'), + (0x1D672, 'M', 'c'), + (0x1D673, 'M', 'd'), + (0x1D674, 'M', 'e'), + (0x1D675, 'M', 'f'), + (0x1D676, 'M', 'g'), + (0x1D677, 'M', 'h'), + (0x1D678, 'M', 'i'), + (0x1D679, 'M', 'j'), + (0x1D67A, 'M', 'k'), + (0x1D67B, 'M', 'l'), + (0x1D67C, 'M', 'm'), + (0x1D67D, 'M', 'n'), + (0x1D67E, 'M', 'o'), + ] + +def _seg_67() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D67F, 'M', 'p'), + (0x1D680, 'M', 'q'), + (0x1D681, 'M', 'r'), + (0x1D682, 'M', 's'), + (0x1D683, 'M', 't'), + (0x1D684, 'M', 'u'), + (0x1D685, 'M', 'v'), + (0x1D686, 'M', 'w'), + (0x1D687, 'M', 'x'), + (0x1D688, 'M', 'y'), + (0x1D689, 'M', 'z'), + (0x1D68A, 'M', 'a'), + (0x1D68B, 'M', 'b'), + (0x1D68C, 'M', 'c'), + (0x1D68D, 'M', 'd'), + (0x1D68E, 'M', 'e'), + (0x1D68F, 'M', 'f'), + (0x1D690, 'M', 'g'), + (0x1D691, 'M', 'h'), + (0x1D692, 'M', 'i'), + (0x1D693, 'M', 'j'), + (0x1D694, 'M', 'k'), + (0x1D695, 'M', 'l'), + (0x1D696, 'M', 'm'), + (0x1D697, 'M', 'n'), + (0x1D698, 'M', 'o'), + (0x1D699, 'M', 'p'), + (0x1D69A, 'M', 'q'), + (0x1D69B, 'M', 'r'), + (0x1D69C, 'M', 's'), + (0x1D69D, 'M', 't'), + (0x1D69E, 'M', 'u'), + (0x1D69F, 'M', 'v'), + (0x1D6A0, 'M', 'w'), + (0x1D6A1, 'M', 'x'), + (0x1D6A2, 'M', 'y'), + (0x1D6A3, 'M', 'z'), + (0x1D6A4, 'M', 'ı'), + (0x1D6A5, 'M', 'ȷ'), + (0x1D6A6, 'X'), + (0x1D6A8, 'M', 'α'), + (0x1D6A9, 'M', 'β'), + (0x1D6AA, 'M', 'γ'), + (0x1D6AB, 'M', 'δ'), + (0x1D6AC, 'M', 'ε'), + (0x1D6AD, 'M', 'ζ'), + (0x1D6AE, 'M', 'η'), + (0x1D6AF, 'M', 'θ'), + (0x1D6B0, 'M', 'ι'), + (0x1D6B1, 'M', 'κ'), + (0x1D6B2, 'M', 'λ'), + (0x1D6B3, 'M', 'μ'), + (0x1D6B4, 'M', 'ν'), + (0x1D6B5, 'M', 'ξ'), + (0x1D6B6, 'M', 'ο'), + (0x1D6B7, 'M', 'π'), + (0x1D6B8, 'M', 'ρ'), + (0x1D6B9, 'M', 'θ'), + (0x1D6BA, 'M', 'σ'), + (0x1D6BB, 'M', 'τ'), + (0x1D6BC, 'M', 'υ'), + (0x1D6BD, 'M', 'φ'), + (0x1D6BE, 'M', 'χ'), + (0x1D6BF, 'M', 'ψ'), + (0x1D6C0, 'M', 'ω'), + (0x1D6C1, 'M', '∇'), + (0x1D6C2, 'M', 'α'), + (0x1D6C3, 'M', 'β'), + (0x1D6C4, 'M', 'γ'), + (0x1D6C5, 'M', 'δ'), + (0x1D6C6, 'M', 'ε'), + (0x1D6C7, 'M', 'ζ'), + (0x1D6C8, 'M', 'η'), + (0x1D6C9, 'M', 'θ'), + (0x1D6CA, 'M', 'ι'), + (0x1D6CB, 'M', 'κ'), + (0x1D6CC, 'M', 'λ'), + (0x1D6CD, 'M', 'μ'), + (0x1D6CE, 'M', 'ν'), + (0x1D6CF, 'M', 'ξ'), + (0x1D6D0, 'M', 'ο'), + (0x1D6D1, 'M', 'π'), + (0x1D6D2, 'M', 'ρ'), + (0x1D6D3, 'M', 'σ'), + (0x1D6D5, 'M', 'τ'), + (0x1D6D6, 'M', 'υ'), + (0x1D6D7, 'M', 'φ'), + (0x1D6D8, 'M', 'χ'), + (0x1D6D9, 'M', 'ψ'), + (0x1D6DA, 'M', 'ω'), + (0x1D6DB, 'M', '∂'), + (0x1D6DC, 'M', 'ε'), + (0x1D6DD, 'M', 'θ'), + (0x1D6DE, 'M', 'κ'), + (0x1D6DF, 'M', 'φ'), + (0x1D6E0, 'M', 'ρ'), + (0x1D6E1, 'M', 'π'), + (0x1D6E2, 'M', 'α'), + (0x1D6E3, 'M', 'β'), + (0x1D6E4, 'M', 'γ'), + ] + +def _seg_68() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D6E5, 'M', 'δ'), + (0x1D6E6, 'M', 'ε'), + (0x1D6E7, 'M', 'ζ'), + (0x1D6E8, 'M', 'η'), + (0x1D6E9, 'M', 'θ'), + (0x1D6EA, 'M', 'ι'), + (0x1D6EB, 'M', 'κ'), + (0x1D6EC, 'M', 'λ'), + (0x1D6ED, 'M', 'μ'), + (0x1D6EE, 'M', 'ν'), + (0x1D6EF, 'M', 'ξ'), + (0x1D6F0, 'M', 'ο'), + (0x1D6F1, 'M', 'π'), + (0x1D6F2, 'M', 'ρ'), + (0x1D6F3, 'M', 'θ'), + (0x1D6F4, 'M', 'σ'), + (0x1D6F5, 'M', 'τ'), + (0x1D6F6, 'M', 'υ'), + (0x1D6F7, 'M', 'φ'), + (0x1D6F8, 'M', 'χ'), + (0x1D6F9, 'M', 'ψ'), + (0x1D6FA, 'M', 'ω'), + (0x1D6FB, 'M', '∇'), + (0x1D6FC, 'M', 'α'), + (0x1D6FD, 'M', 'β'), + (0x1D6FE, 'M', 'γ'), + (0x1D6FF, 'M', 'δ'), + (0x1D700, 'M', 'ε'), + (0x1D701, 'M', 'ζ'), + (0x1D702, 'M', 'η'), + (0x1D703, 'M', 'θ'), + (0x1D704, 'M', 'ι'), + (0x1D705, 'M', 'κ'), + (0x1D706, 'M', 'λ'), + (0x1D707, 'M', 'μ'), + (0x1D708, 'M', 'ν'), + (0x1D709, 'M', 'ξ'), + (0x1D70A, 'M', 'ο'), + (0x1D70B, 'M', 'π'), + (0x1D70C, 'M', 'ρ'), + (0x1D70D, 'M', 'σ'), + (0x1D70F, 'M', 'τ'), + (0x1D710, 'M', 'υ'), + (0x1D711, 'M', 'φ'), + (0x1D712, 'M', 'χ'), + (0x1D713, 'M', 'ψ'), + (0x1D714, 'M', 'ω'), + (0x1D715, 'M', '∂'), + (0x1D716, 'M', 'ε'), + (0x1D717, 'M', 'θ'), + (0x1D718, 'M', 'κ'), + (0x1D719, 'M', 'φ'), + (0x1D71A, 'M', 'ρ'), + (0x1D71B, 'M', 'π'), + (0x1D71C, 'M', 'α'), + (0x1D71D, 'M', 'β'), + (0x1D71E, 'M', 'γ'), + (0x1D71F, 'M', 'δ'), + (0x1D720, 'M', 'ε'), + (0x1D721, 'M', 'ζ'), + (0x1D722, 'M', 'η'), + (0x1D723, 'M', 'θ'), + (0x1D724, 'M', 'ι'), + (0x1D725, 'M', 'κ'), + (0x1D726, 'M', 'λ'), + (0x1D727, 'M', 'μ'), + (0x1D728, 'M', 'ν'), + (0x1D729, 'M', 'ξ'), + (0x1D72A, 'M', 'ο'), + (0x1D72B, 'M', 'π'), + (0x1D72C, 'M', 'ρ'), + (0x1D72D, 'M', 'θ'), + (0x1D72E, 'M', 'σ'), + (0x1D72F, 'M', 'τ'), + (0x1D730, 'M', 'υ'), + (0x1D731, 'M', 'φ'), + (0x1D732, 'M', 'χ'), + (0x1D733, 'M', 'ψ'), + (0x1D734, 'M', 'ω'), + (0x1D735, 'M', '∇'), + (0x1D736, 'M', 'α'), + (0x1D737, 'M', 'β'), + (0x1D738, 'M', 'γ'), + (0x1D739, 'M', 'δ'), + (0x1D73A, 'M', 'ε'), + (0x1D73B, 'M', 'ζ'), + (0x1D73C, 'M', 'η'), + (0x1D73D, 'M', 'θ'), + (0x1D73E, 'M', 'ι'), + (0x1D73F, 'M', 'κ'), + (0x1D740, 'M', 'λ'), + (0x1D741, 'M', 'μ'), + (0x1D742, 'M', 'ν'), + (0x1D743, 'M', 'ξ'), + (0x1D744, 'M', 'ο'), + (0x1D745, 'M', 'π'), + (0x1D746, 'M', 'ρ'), + (0x1D747, 'M', 'σ'), + (0x1D749, 'M', 'τ'), + (0x1D74A, 'M', 'υ'), + ] + +def _seg_69() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D74B, 'M', 'φ'), + (0x1D74C, 'M', 'χ'), + (0x1D74D, 'M', 'ψ'), + (0x1D74E, 'M', 'ω'), + (0x1D74F, 'M', '∂'), + (0x1D750, 'M', 'ε'), + (0x1D751, 'M', 'θ'), + (0x1D752, 'M', 'κ'), + (0x1D753, 'M', 'φ'), + (0x1D754, 'M', 'ρ'), + (0x1D755, 'M', 'π'), + (0x1D756, 'M', 'α'), + (0x1D757, 'M', 'β'), + (0x1D758, 'M', 'γ'), + (0x1D759, 'M', 'δ'), + (0x1D75A, 'M', 'ε'), + (0x1D75B, 'M', 'ζ'), + (0x1D75C, 'M', 'η'), + (0x1D75D, 'M', 'θ'), + (0x1D75E, 'M', 'ι'), + (0x1D75F, 'M', 'κ'), + (0x1D760, 'M', 'λ'), + (0x1D761, 'M', 'μ'), + (0x1D762, 'M', 'ν'), + (0x1D763, 'M', 'ξ'), + (0x1D764, 'M', 'ο'), + (0x1D765, 'M', 'π'), + (0x1D766, 'M', 'ρ'), + (0x1D767, 'M', 'θ'), + (0x1D768, 'M', 'σ'), + (0x1D769, 'M', 'τ'), + (0x1D76A, 'M', 'υ'), + (0x1D76B, 'M', 'φ'), + (0x1D76C, 'M', 'χ'), + (0x1D76D, 'M', 'ψ'), + (0x1D76E, 'M', 'ω'), + (0x1D76F, 'M', '∇'), + (0x1D770, 'M', 'α'), + (0x1D771, 'M', 'β'), + (0x1D772, 'M', 'γ'), + (0x1D773, 'M', 'δ'), + (0x1D774, 'M', 'ε'), + (0x1D775, 'M', 'ζ'), + (0x1D776, 'M', 'η'), + (0x1D777, 'M', 'θ'), + (0x1D778, 'M', 'ι'), + (0x1D779, 'M', 'κ'), + (0x1D77A, 'M', 'λ'), + (0x1D77B, 'M', 'μ'), + (0x1D77C, 'M', 'ν'), + (0x1D77D, 'M', 'ξ'), + (0x1D77E, 'M', 'ο'), + (0x1D77F, 'M', 'π'), + (0x1D780, 'M', 'ρ'), + (0x1D781, 'M', 'σ'), + (0x1D783, 'M', 'τ'), + (0x1D784, 'M', 'υ'), + (0x1D785, 'M', 'φ'), + (0x1D786, 'M', 'χ'), + (0x1D787, 'M', 'ψ'), + (0x1D788, 'M', 'ω'), + (0x1D789, 'M', '∂'), + (0x1D78A, 'M', 'ε'), + (0x1D78B, 'M', 'θ'), + (0x1D78C, 'M', 'κ'), + (0x1D78D, 'M', 'φ'), + (0x1D78E, 'M', 'ρ'), + (0x1D78F, 'M', 'π'), + (0x1D790, 'M', 'α'), + (0x1D791, 'M', 'β'), + (0x1D792, 'M', 'γ'), + (0x1D793, 'M', 'δ'), + (0x1D794, 'M', 'ε'), + (0x1D795, 'M', 'ζ'), + (0x1D796, 'M', 'η'), + (0x1D797, 'M', 'θ'), + (0x1D798, 'M', 'ι'), + (0x1D799, 'M', 'κ'), + (0x1D79A, 'M', 'λ'), + (0x1D79B, 'M', 'μ'), + (0x1D79C, 'M', 'ν'), + (0x1D79D, 'M', 'ξ'), + (0x1D79E, 'M', 'ο'), + (0x1D79F, 'M', 'π'), + (0x1D7A0, 'M', 'ρ'), + (0x1D7A1, 'M', 'θ'), + (0x1D7A2, 'M', 'σ'), + (0x1D7A3, 'M', 'τ'), + (0x1D7A4, 'M', 'υ'), + (0x1D7A5, 'M', 'φ'), + (0x1D7A6, 'M', 'χ'), + (0x1D7A7, 'M', 'ψ'), + (0x1D7A8, 'M', 'ω'), + (0x1D7A9, 'M', '∇'), + (0x1D7AA, 'M', 'α'), + (0x1D7AB, 'M', 'β'), + (0x1D7AC, 'M', 'γ'), + (0x1D7AD, 'M', 'δ'), + (0x1D7AE, 'M', 'ε'), + (0x1D7AF, 'M', 'ζ'), + ] + +def _seg_70() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1D7B0, 'M', 'η'), + (0x1D7B1, 'M', 'θ'), + (0x1D7B2, 'M', 'ι'), + (0x1D7B3, 'M', 'κ'), + (0x1D7B4, 'M', 'λ'), + (0x1D7B5, 'M', 'μ'), + (0x1D7B6, 'M', 'ν'), + (0x1D7B7, 'M', 'ξ'), + (0x1D7B8, 'M', 'ο'), + (0x1D7B9, 'M', 'π'), + (0x1D7BA, 'M', 'ρ'), + (0x1D7BB, 'M', 'σ'), + (0x1D7BD, 'M', 'τ'), + (0x1D7BE, 'M', 'υ'), + (0x1D7BF, 'M', 'φ'), + (0x1D7C0, 'M', 'χ'), + (0x1D7C1, 'M', 'ψ'), + (0x1D7C2, 'M', 'ω'), + (0x1D7C3, 'M', '∂'), + (0x1D7C4, 'M', 'ε'), + (0x1D7C5, 'M', 'θ'), + (0x1D7C6, 'M', 'κ'), + (0x1D7C7, 'M', 'φ'), + (0x1D7C8, 'M', 'ρ'), + (0x1D7C9, 'M', 'π'), + (0x1D7CA, 'M', 'ϝ'), + (0x1D7CC, 'X'), + (0x1D7CE, 'M', '0'), + (0x1D7CF, 'M', '1'), + (0x1D7D0, 'M', '2'), + (0x1D7D1, 'M', '3'), + (0x1D7D2, 'M', '4'), + (0x1D7D3, 'M', '5'), + (0x1D7D4, 'M', '6'), + (0x1D7D5, 'M', '7'), + (0x1D7D6, 'M', '8'), + (0x1D7D7, 'M', '9'), + (0x1D7D8, 'M', '0'), + (0x1D7D9, 'M', '1'), + (0x1D7DA, 'M', '2'), + (0x1D7DB, 'M', '3'), + (0x1D7DC, 'M', '4'), + (0x1D7DD, 'M', '5'), + (0x1D7DE, 'M', '6'), + (0x1D7DF, 'M', '7'), + (0x1D7E0, 'M', '8'), + (0x1D7E1, 'M', '9'), + (0x1D7E2, 'M', '0'), + (0x1D7E3, 'M', '1'), + (0x1D7E4, 'M', '2'), + (0x1D7E5, 'M', '3'), + (0x1D7E6, 'M', '4'), + (0x1D7E7, 'M', '5'), + (0x1D7E8, 'M', '6'), + (0x1D7E9, 'M', '7'), + (0x1D7EA, 'M', '8'), + (0x1D7EB, 'M', '9'), + (0x1D7EC, 'M', '0'), + (0x1D7ED, 'M', '1'), + (0x1D7EE, 'M', '2'), + (0x1D7EF, 'M', '3'), + (0x1D7F0, 'M', '4'), + (0x1D7F1, 'M', '5'), + (0x1D7F2, 'M', '6'), + (0x1D7F3, 'M', '7'), + (0x1D7F4, 'M', '8'), + (0x1D7F5, 'M', '9'), + (0x1D7F6, 'M', '0'), + (0x1D7F7, 'M', '1'), + (0x1D7F8, 'M', '2'), + (0x1D7F9, 'M', '3'), + (0x1D7FA, 'M', '4'), + (0x1D7FB, 'M', '5'), + (0x1D7FC, 'M', '6'), + (0x1D7FD, 'M', '7'), + (0x1D7FE, 'M', '8'), + (0x1D7FF, 'M', '9'), + (0x1D800, 'V'), + (0x1DA8C, 'X'), + (0x1DA9B, 'V'), + (0x1DAA0, 'X'), + (0x1DAA1, 'V'), + (0x1DAB0, 'X'), + (0x1DF00, 'V'), + (0x1DF1F, 'X'), + (0x1DF25, 'V'), + (0x1DF2B, 'X'), + (0x1E000, 'V'), + (0x1E007, 'X'), + (0x1E008, 'V'), + (0x1E019, 'X'), + (0x1E01B, 'V'), + (0x1E022, 'X'), + (0x1E023, 'V'), + (0x1E025, 'X'), + (0x1E026, 'V'), + (0x1E02B, 'X'), + (0x1E030, 'M', 'а'), + (0x1E031, 'M', 'б'), + (0x1E032, 'M', 'в'), + ] + +def _seg_71() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E033, 'M', 'г'), + (0x1E034, 'M', 'д'), + (0x1E035, 'M', 'е'), + (0x1E036, 'M', 'ж'), + (0x1E037, 'M', 'з'), + (0x1E038, 'M', 'и'), + (0x1E039, 'M', 'к'), + (0x1E03A, 'M', 'л'), + (0x1E03B, 'M', 'м'), + (0x1E03C, 'M', 'о'), + (0x1E03D, 'M', 'п'), + (0x1E03E, 'M', 'р'), + (0x1E03F, 'M', 'с'), + (0x1E040, 'M', 'т'), + (0x1E041, 'M', 'у'), + (0x1E042, 'M', 'ф'), + (0x1E043, 'M', 'х'), + (0x1E044, 'M', 'ц'), + (0x1E045, 'M', 'ч'), + (0x1E046, 'M', 'ш'), + (0x1E047, 'M', 'ы'), + (0x1E048, 'M', 'э'), + (0x1E049, 'M', 'ю'), + (0x1E04A, 'M', 'ꚉ'), + (0x1E04B, 'M', 'ә'), + (0x1E04C, 'M', 'і'), + (0x1E04D, 'M', 'ј'), + (0x1E04E, 'M', 'ө'), + (0x1E04F, 'M', 'ү'), + (0x1E050, 'M', 'ӏ'), + (0x1E051, 'M', 'а'), + (0x1E052, 'M', 'б'), + (0x1E053, 'M', 'в'), + (0x1E054, 'M', 'г'), + (0x1E055, 'M', 'д'), + (0x1E056, 'M', 'е'), + (0x1E057, 'M', 'ж'), + (0x1E058, 'M', 'з'), + (0x1E059, 'M', 'и'), + (0x1E05A, 'M', 'к'), + (0x1E05B, 'M', 'л'), + (0x1E05C, 'M', 'о'), + (0x1E05D, 'M', 'п'), + (0x1E05E, 'M', 'с'), + (0x1E05F, 'M', 'у'), + (0x1E060, 'M', 'ф'), + (0x1E061, 'M', 'х'), + (0x1E062, 'M', 'ц'), + (0x1E063, 'M', 'ч'), + (0x1E064, 'M', 'ш'), + (0x1E065, 'M', 'ъ'), + (0x1E066, 'M', 'ы'), + (0x1E067, 'M', 'ґ'), + (0x1E068, 'M', 'і'), + (0x1E069, 'M', 'ѕ'), + (0x1E06A, 'M', 'џ'), + (0x1E06B, 'M', 'ҫ'), + (0x1E06C, 'M', 'ꙑ'), + (0x1E06D, 'M', 'ұ'), + (0x1E06E, 'X'), + (0x1E08F, 'V'), + (0x1E090, 'X'), + (0x1E100, 'V'), + (0x1E12D, 'X'), + (0x1E130, 'V'), + (0x1E13E, 'X'), + (0x1E140, 'V'), + (0x1E14A, 'X'), + (0x1E14E, 'V'), + (0x1E150, 'X'), + (0x1E290, 'V'), + (0x1E2AF, 'X'), + (0x1E2C0, 'V'), + (0x1E2FA, 'X'), + (0x1E2FF, 'V'), + (0x1E300, 'X'), + (0x1E4D0, 'V'), + (0x1E4FA, 'X'), + (0x1E7E0, 'V'), + (0x1E7E7, 'X'), + (0x1E7E8, 'V'), + (0x1E7EC, 'X'), + (0x1E7ED, 'V'), + (0x1E7EF, 'X'), + (0x1E7F0, 'V'), + (0x1E7FF, 'X'), + (0x1E800, 'V'), + (0x1E8C5, 'X'), + (0x1E8C7, 'V'), + (0x1E8D7, 'X'), + (0x1E900, 'M', '𞤢'), + (0x1E901, 'M', '𞤣'), + (0x1E902, 'M', '𞤤'), + (0x1E903, 'M', '𞤥'), + (0x1E904, 'M', '𞤦'), + (0x1E905, 'M', '𞤧'), + (0x1E906, 'M', '𞤨'), + (0x1E907, 'M', '𞤩'), + (0x1E908, 'M', '𞤪'), + (0x1E909, 'M', '𞤫'), + ] + +def _seg_72() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1E90A, 'M', '𞤬'), + (0x1E90B, 'M', '𞤭'), + (0x1E90C, 'M', '𞤮'), + (0x1E90D, 'M', '𞤯'), + (0x1E90E, 'M', '𞤰'), + (0x1E90F, 'M', '𞤱'), + (0x1E910, 'M', '𞤲'), + (0x1E911, 'M', '𞤳'), + (0x1E912, 'M', '𞤴'), + (0x1E913, 'M', '𞤵'), + (0x1E914, 'M', '𞤶'), + (0x1E915, 'M', '𞤷'), + (0x1E916, 'M', '𞤸'), + (0x1E917, 'M', '𞤹'), + (0x1E918, 'M', '𞤺'), + (0x1E919, 'M', '𞤻'), + (0x1E91A, 'M', '𞤼'), + (0x1E91B, 'M', '𞤽'), + (0x1E91C, 'M', '𞤾'), + (0x1E91D, 'M', '𞤿'), + (0x1E91E, 'M', '𞥀'), + (0x1E91F, 'M', '𞥁'), + (0x1E920, 'M', '𞥂'), + (0x1E921, 'M', '𞥃'), + (0x1E922, 'V'), + (0x1E94C, 'X'), + (0x1E950, 'V'), + (0x1E95A, 'X'), + (0x1E95E, 'V'), + (0x1E960, 'X'), + (0x1EC71, 'V'), + (0x1ECB5, 'X'), + (0x1ED01, 'V'), + (0x1ED3E, 'X'), + (0x1EE00, 'M', 'ا'), + (0x1EE01, 'M', 'ب'), + (0x1EE02, 'M', 'ج'), + (0x1EE03, 'M', 'د'), + (0x1EE04, 'X'), + (0x1EE05, 'M', 'و'), + (0x1EE06, 'M', 'ز'), + (0x1EE07, 'M', 'ح'), + (0x1EE08, 'M', 'ط'), + (0x1EE09, 'M', 'ي'), + (0x1EE0A, 'M', 'ك'), + (0x1EE0B, 'M', 'ل'), + (0x1EE0C, 'M', 'م'), + (0x1EE0D, 'M', 'ن'), + (0x1EE0E, 'M', 'س'), + (0x1EE0F, 'M', 'ع'), + (0x1EE10, 'M', 'ف'), + (0x1EE11, 'M', 'ص'), + (0x1EE12, 'M', 'ق'), + (0x1EE13, 'M', 'ر'), + (0x1EE14, 'M', 'ش'), + (0x1EE15, 'M', 'ت'), + (0x1EE16, 'M', 'ث'), + (0x1EE17, 'M', 'خ'), + (0x1EE18, 'M', 'ذ'), + (0x1EE19, 'M', 'ض'), + (0x1EE1A, 'M', 'ظ'), + (0x1EE1B, 'M', 'غ'), + (0x1EE1C, 'M', 'ٮ'), + (0x1EE1D, 'M', 'ں'), + (0x1EE1E, 'M', 'ڡ'), + (0x1EE1F, 'M', 'ٯ'), + (0x1EE20, 'X'), + (0x1EE21, 'M', 'ب'), + (0x1EE22, 'M', 'ج'), + (0x1EE23, 'X'), + (0x1EE24, 'M', 'ه'), + (0x1EE25, 'X'), + (0x1EE27, 'M', 'ح'), + (0x1EE28, 'X'), + (0x1EE29, 'M', 'ي'), + (0x1EE2A, 'M', 'ك'), + (0x1EE2B, 'M', 'ل'), + (0x1EE2C, 'M', 'م'), + (0x1EE2D, 'M', 'ن'), + (0x1EE2E, 'M', 'س'), + (0x1EE2F, 'M', 'ع'), + (0x1EE30, 'M', 'ف'), + (0x1EE31, 'M', 'ص'), + (0x1EE32, 'M', 'ق'), + (0x1EE33, 'X'), + (0x1EE34, 'M', 'ش'), + (0x1EE35, 'M', 'ت'), + (0x1EE36, 'M', 'ث'), + (0x1EE37, 'M', 'خ'), + (0x1EE38, 'X'), + (0x1EE39, 'M', 'ض'), + (0x1EE3A, 'X'), + (0x1EE3B, 'M', 'غ'), + (0x1EE3C, 'X'), + (0x1EE42, 'M', 'ج'), + (0x1EE43, 'X'), + (0x1EE47, 'M', 'ح'), + (0x1EE48, 'X'), + (0x1EE49, 'M', 'ي'), + (0x1EE4A, 'X'), + ] + +def _seg_73() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1EE4B, 'M', 'ل'), + (0x1EE4C, 'X'), + (0x1EE4D, 'M', 'ن'), + (0x1EE4E, 'M', 'س'), + (0x1EE4F, 'M', 'ع'), + (0x1EE50, 'X'), + (0x1EE51, 'M', 'ص'), + (0x1EE52, 'M', 'ق'), + (0x1EE53, 'X'), + (0x1EE54, 'M', 'ش'), + (0x1EE55, 'X'), + (0x1EE57, 'M', 'خ'), + (0x1EE58, 'X'), + (0x1EE59, 'M', 'ض'), + (0x1EE5A, 'X'), + (0x1EE5B, 'M', 'غ'), + (0x1EE5C, 'X'), + (0x1EE5D, 'M', 'ں'), + (0x1EE5E, 'X'), + (0x1EE5F, 'M', 'ٯ'), + (0x1EE60, 'X'), + (0x1EE61, 'M', 'ب'), + (0x1EE62, 'M', 'ج'), + (0x1EE63, 'X'), + (0x1EE64, 'M', 'ه'), + (0x1EE65, 'X'), + (0x1EE67, 'M', 'ح'), + (0x1EE68, 'M', 'ط'), + (0x1EE69, 'M', 'ي'), + (0x1EE6A, 'M', 'ك'), + (0x1EE6B, 'X'), + (0x1EE6C, 'M', 'م'), + (0x1EE6D, 'M', 'ن'), + (0x1EE6E, 'M', 'س'), + (0x1EE6F, 'M', 'ع'), + (0x1EE70, 'M', 'ف'), + (0x1EE71, 'M', 'ص'), + (0x1EE72, 'M', 'ق'), + (0x1EE73, 'X'), + (0x1EE74, 'M', 'ش'), + (0x1EE75, 'M', 'ت'), + (0x1EE76, 'M', 'ث'), + (0x1EE77, 'M', 'خ'), + (0x1EE78, 'X'), + (0x1EE79, 'M', 'ض'), + (0x1EE7A, 'M', 'ظ'), + (0x1EE7B, 'M', 'غ'), + (0x1EE7C, 'M', 'ٮ'), + (0x1EE7D, 'X'), + (0x1EE7E, 'M', 'ڡ'), + (0x1EE7F, 'X'), + (0x1EE80, 'M', 'ا'), + (0x1EE81, 'M', 'ب'), + (0x1EE82, 'M', 'ج'), + (0x1EE83, 'M', 'د'), + (0x1EE84, 'M', 'ه'), + (0x1EE85, 'M', 'و'), + (0x1EE86, 'M', 'ز'), + (0x1EE87, 'M', 'ح'), + (0x1EE88, 'M', 'ط'), + (0x1EE89, 'M', 'ي'), + (0x1EE8A, 'X'), + (0x1EE8B, 'M', 'ل'), + (0x1EE8C, 'M', 'م'), + (0x1EE8D, 'M', 'ن'), + (0x1EE8E, 'M', 'س'), + (0x1EE8F, 'M', 'ع'), + (0x1EE90, 'M', 'ف'), + (0x1EE91, 'M', 'ص'), + (0x1EE92, 'M', 'ق'), + (0x1EE93, 'M', 'ر'), + (0x1EE94, 'M', 'ش'), + (0x1EE95, 'M', 'ت'), + (0x1EE96, 'M', 'ث'), + (0x1EE97, 'M', 'خ'), + (0x1EE98, 'M', 'ذ'), + (0x1EE99, 'M', 'ض'), + (0x1EE9A, 'M', 'ظ'), + (0x1EE9B, 'M', 'غ'), + (0x1EE9C, 'X'), + (0x1EEA1, 'M', 'ب'), + (0x1EEA2, 'M', 'ج'), + (0x1EEA3, 'M', 'د'), + (0x1EEA4, 'X'), + (0x1EEA5, 'M', 'و'), + (0x1EEA6, 'M', 'ز'), + (0x1EEA7, 'M', 'ح'), + (0x1EEA8, 'M', 'ط'), + (0x1EEA9, 'M', 'ي'), + (0x1EEAA, 'X'), + (0x1EEAB, 'M', 'ل'), + (0x1EEAC, 'M', 'م'), + (0x1EEAD, 'M', 'ن'), + (0x1EEAE, 'M', 'س'), + (0x1EEAF, 'M', 'ع'), + (0x1EEB0, 'M', 'ف'), + (0x1EEB1, 'M', 'ص'), + (0x1EEB2, 'M', 'ق'), + (0x1EEB3, 'M', 'ر'), + (0x1EEB4, 'M', 'ش'), + ] + +def _seg_74() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1EEB5, 'M', 'ت'), + (0x1EEB6, 'M', 'ث'), + (0x1EEB7, 'M', 'خ'), + (0x1EEB8, 'M', 'ذ'), + (0x1EEB9, 'M', 'ض'), + (0x1EEBA, 'M', 'ظ'), + (0x1EEBB, 'M', 'غ'), + (0x1EEBC, 'X'), + (0x1EEF0, 'V'), + (0x1EEF2, 'X'), + (0x1F000, 'V'), + (0x1F02C, 'X'), + (0x1F030, 'V'), + (0x1F094, 'X'), + (0x1F0A0, 'V'), + (0x1F0AF, 'X'), + (0x1F0B1, 'V'), + (0x1F0C0, 'X'), + (0x1F0C1, 'V'), + (0x1F0D0, 'X'), + (0x1F0D1, 'V'), + (0x1F0F6, 'X'), + (0x1F101, '3', '0,'), + (0x1F102, '3', '1,'), + (0x1F103, '3', '2,'), + (0x1F104, '3', '3,'), + (0x1F105, '3', '4,'), + (0x1F106, '3', '5,'), + (0x1F107, '3', '6,'), + (0x1F108, '3', '7,'), + (0x1F109, '3', '8,'), + (0x1F10A, '3', '9,'), + (0x1F10B, 'V'), + (0x1F110, '3', '(a)'), + (0x1F111, '3', '(b)'), + (0x1F112, '3', '(c)'), + (0x1F113, '3', '(d)'), + (0x1F114, '3', '(e)'), + (0x1F115, '3', '(f)'), + (0x1F116, '3', '(g)'), + (0x1F117, '3', '(h)'), + (0x1F118, '3', '(i)'), + (0x1F119, '3', '(j)'), + (0x1F11A, '3', '(k)'), + (0x1F11B, '3', '(l)'), + (0x1F11C, '3', '(m)'), + (0x1F11D, '3', '(n)'), + (0x1F11E, '3', '(o)'), + (0x1F11F, '3', '(p)'), + (0x1F120, '3', '(q)'), + (0x1F121, '3', '(r)'), + (0x1F122, '3', '(s)'), + (0x1F123, '3', '(t)'), + (0x1F124, '3', '(u)'), + (0x1F125, '3', '(v)'), + (0x1F126, '3', '(w)'), + (0x1F127, '3', '(x)'), + (0x1F128, '3', '(y)'), + (0x1F129, '3', '(z)'), + (0x1F12A, 'M', '〔s〕'), + (0x1F12B, 'M', 'c'), + (0x1F12C, 'M', 'r'), + (0x1F12D, 'M', 'cd'), + (0x1F12E, 'M', 'wz'), + (0x1F12F, 'V'), + (0x1F130, 'M', 'a'), + (0x1F131, 'M', 'b'), + (0x1F132, 'M', 'c'), + (0x1F133, 'M', 'd'), + (0x1F134, 'M', 'e'), + (0x1F135, 'M', 'f'), + (0x1F136, 'M', 'g'), + (0x1F137, 'M', 'h'), + (0x1F138, 'M', 'i'), + (0x1F139, 'M', 'j'), + (0x1F13A, 'M', 'k'), + (0x1F13B, 'M', 'l'), + (0x1F13C, 'M', 'm'), + (0x1F13D, 'M', 'n'), + (0x1F13E, 'M', 'o'), + (0x1F13F, 'M', 'p'), + (0x1F140, 'M', 'q'), + (0x1F141, 'M', 'r'), + (0x1F142, 'M', 's'), + (0x1F143, 'M', 't'), + (0x1F144, 'M', 'u'), + (0x1F145, 'M', 'v'), + (0x1F146, 'M', 'w'), + (0x1F147, 'M', 'x'), + (0x1F148, 'M', 'y'), + (0x1F149, 'M', 'z'), + (0x1F14A, 'M', 'hv'), + (0x1F14B, 'M', 'mv'), + (0x1F14C, 'M', 'sd'), + (0x1F14D, 'M', 'ss'), + (0x1F14E, 'M', 'ppv'), + (0x1F14F, 'M', 'wc'), + (0x1F150, 'V'), + (0x1F16A, 'M', 'mc'), + (0x1F16B, 'M', 'md'), + ] + +def _seg_75() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1F16C, 'M', 'mr'), + (0x1F16D, 'V'), + (0x1F190, 'M', 'dj'), + (0x1F191, 'V'), + (0x1F1AE, 'X'), + (0x1F1E6, 'V'), + (0x1F200, 'M', 'ほか'), + (0x1F201, 'M', 'ココ'), + (0x1F202, 'M', 'サ'), + (0x1F203, 'X'), + (0x1F210, 'M', '手'), + (0x1F211, 'M', '字'), + (0x1F212, 'M', '双'), + (0x1F213, 'M', 'デ'), + (0x1F214, 'M', '二'), + (0x1F215, 'M', '多'), + (0x1F216, 'M', '解'), + (0x1F217, 'M', '天'), + (0x1F218, 'M', '交'), + (0x1F219, 'M', '映'), + (0x1F21A, 'M', '無'), + (0x1F21B, 'M', '料'), + (0x1F21C, 'M', '前'), + (0x1F21D, 'M', '後'), + (0x1F21E, 'M', '再'), + (0x1F21F, 'M', '新'), + (0x1F220, 'M', '初'), + (0x1F221, 'M', '終'), + (0x1F222, 'M', '生'), + (0x1F223, 'M', '販'), + (0x1F224, 'M', '声'), + (0x1F225, 'M', '吹'), + (0x1F226, 'M', '演'), + (0x1F227, 'M', '投'), + (0x1F228, 'M', '捕'), + (0x1F229, 'M', '一'), + (0x1F22A, 'M', '三'), + (0x1F22B, 'M', '遊'), + (0x1F22C, 'M', '左'), + (0x1F22D, 'M', '中'), + (0x1F22E, 'M', '右'), + (0x1F22F, 'M', '指'), + (0x1F230, 'M', '走'), + (0x1F231, 'M', '打'), + (0x1F232, 'M', '禁'), + (0x1F233, 'M', '空'), + (0x1F234, 'M', '合'), + (0x1F235, 'M', '満'), + (0x1F236, 'M', '有'), + (0x1F237, 'M', '月'), + (0x1F238, 'M', '申'), + (0x1F239, 'M', '割'), + (0x1F23A, 'M', '営'), + (0x1F23B, 'M', '配'), + (0x1F23C, 'X'), + (0x1F240, 'M', '〔本〕'), + (0x1F241, 'M', '〔三〕'), + (0x1F242, 'M', '〔二〕'), + (0x1F243, 'M', '〔安〕'), + (0x1F244, 'M', '〔点〕'), + (0x1F245, 'M', '〔打〕'), + (0x1F246, 'M', '〔盗〕'), + (0x1F247, 'M', '〔勝〕'), + (0x1F248, 'M', '〔敗〕'), + (0x1F249, 'X'), + (0x1F250, 'M', '得'), + (0x1F251, 'M', '可'), + (0x1F252, 'X'), + (0x1F260, 'V'), + (0x1F266, 'X'), + (0x1F300, 'V'), + (0x1F6D8, 'X'), + (0x1F6DC, 'V'), + (0x1F6ED, 'X'), + (0x1F6F0, 'V'), + (0x1F6FD, 'X'), + (0x1F700, 'V'), + (0x1F777, 'X'), + (0x1F77B, 'V'), + (0x1F7DA, 'X'), + (0x1F7E0, 'V'), + (0x1F7EC, 'X'), + (0x1F7F0, 'V'), + (0x1F7F1, 'X'), + (0x1F800, 'V'), + (0x1F80C, 'X'), + (0x1F810, 'V'), + (0x1F848, 'X'), + (0x1F850, 'V'), + (0x1F85A, 'X'), + (0x1F860, 'V'), + (0x1F888, 'X'), + (0x1F890, 'V'), + (0x1F8AE, 'X'), + (0x1F8B0, 'V'), + (0x1F8B2, 'X'), + (0x1F900, 'V'), + (0x1FA54, 'X'), + (0x1FA60, 'V'), + (0x1FA6E, 'X'), + ] + +def _seg_76() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x1FA70, 'V'), + (0x1FA7D, 'X'), + (0x1FA80, 'V'), + (0x1FA89, 'X'), + (0x1FA90, 'V'), + (0x1FABE, 'X'), + (0x1FABF, 'V'), + (0x1FAC6, 'X'), + (0x1FACE, 'V'), + (0x1FADC, 'X'), + (0x1FAE0, 'V'), + (0x1FAE9, 'X'), + (0x1FAF0, 'V'), + (0x1FAF9, 'X'), + (0x1FB00, 'V'), + (0x1FB93, 'X'), + (0x1FB94, 'V'), + (0x1FBCB, 'X'), + (0x1FBF0, 'M', '0'), + (0x1FBF1, 'M', '1'), + (0x1FBF2, 'M', '2'), + (0x1FBF3, 'M', '3'), + (0x1FBF4, 'M', '4'), + (0x1FBF5, 'M', '5'), + (0x1FBF6, 'M', '6'), + (0x1FBF7, 'M', '7'), + (0x1FBF8, 'M', '8'), + (0x1FBF9, 'M', '9'), + (0x1FBFA, 'X'), + (0x20000, 'V'), + (0x2A6E0, 'X'), + (0x2A700, 'V'), + (0x2B73A, 'X'), + (0x2B740, 'V'), + (0x2B81E, 'X'), + (0x2B820, 'V'), + (0x2CEA2, 'X'), + (0x2CEB0, 'V'), + (0x2EBE1, 'X'), + (0x2F800, 'M', '丽'), + (0x2F801, 'M', '丸'), + (0x2F802, 'M', '乁'), + (0x2F803, 'M', '𠄢'), + (0x2F804, 'M', '你'), + (0x2F805, 'M', '侮'), + (0x2F806, 'M', '侻'), + (0x2F807, 'M', '倂'), + (0x2F808, 'M', '偺'), + (0x2F809, 'M', '備'), + (0x2F80A, 'M', '僧'), + (0x2F80B, 'M', '像'), + (0x2F80C, 'M', '㒞'), + (0x2F80D, 'M', '𠘺'), + (0x2F80E, 'M', '免'), + (0x2F80F, 'M', '兔'), + (0x2F810, 'M', '兤'), + (0x2F811, 'M', '具'), + (0x2F812, 'M', '𠔜'), + (0x2F813, 'M', '㒹'), + (0x2F814, 'M', '內'), + (0x2F815, 'M', '再'), + (0x2F816, 'M', '𠕋'), + (0x2F817, 'M', '冗'), + (0x2F818, 'M', '冤'), + (0x2F819, 'M', '仌'), + (0x2F81A, 'M', '冬'), + (0x2F81B, 'M', '况'), + (0x2F81C, 'M', '𩇟'), + (0x2F81D, 'M', '凵'), + (0x2F81E, 'M', '刃'), + (0x2F81F, 'M', '㓟'), + (0x2F820, 'M', '刻'), + (0x2F821, 'M', '剆'), + (0x2F822, 'M', '割'), + (0x2F823, 'M', '剷'), + (0x2F824, 'M', '㔕'), + (0x2F825, 'M', '勇'), + (0x2F826, 'M', '勉'), + (0x2F827, 'M', '勤'), + (0x2F828, 'M', '勺'), + (0x2F829, 'M', '包'), + (0x2F82A, 'M', '匆'), + (0x2F82B, 'M', '北'), + (0x2F82C, 'M', '卉'), + (0x2F82D, 'M', '卑'), + (0x2F82E, 'M', '博'), + (0x2F82F, 'M', '即'), + (0x2F830, 'M', '卽'), + (0x2F831, 'M', '卿'), + (0x2F834, 'M', '𠨬'), + (0x2F835, 'M', '灰'), + (0x2F836, 'M', '及'), + (0x2F837, 'M', '叟'), + (0x2F838, 'M', '𠭣'), + (0x2F839, 'M', '叫'), + (0x2F83A, 'M', '叱'), + (0x2F83B, 'M', '吆'), + (0x2F83C, 'M', '咞'), + (0x2F83D, 'M', '吸'), + (0x2F83E, 'M', '呈'), + ] + +def _seg_77() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F83F, 'M', '周'), + (0x2F840, 'M', '咢'), + (0x2F841, 'M', '哶'), + (0x2F842, 'M', '唐'), + (0x2F843, 'M', '啓'), + (0x2F844, 'M', '啣'), + (0x2F845, 'M', '善'), + (0x2F847, 'M', '喙'), + (0x2F848, 'M', '喫'), + (0x2F849, 'M', '喳'), + (0x2F84A, 'M', '嗂'), + (0x2F84B, 'M', '圖'), + (0x2F84C, 'M', '嘆'), + (0x2F84D, 'M', '圗'), + (0x2F84E, 'M', '噑'), + (0x2F84F, 'M', '噴'), + (0x2F850, 'M', '切'), + (0x2F851, 'M', '壮'), + (0x2F852, 'M', '城'), + (0x2F853, 'M', '埴'), + (0x2F854, 'M', '堍'), + (0x2F855, 'M', '型'), + (0x2F856, 'M', '堲'), + (0x2F857, 'M', '報'), + (0x2F858, 'M', '墬'), + (0x2F859, 'M', '𡓤'), + (0x2F85A, 'M', '売'), + (0x2F85B, 'M', '壷'), + (0x2F85C, 'M', '夆'), + (0x2F85D, 'M', '多'), + (0x2F85E, 'M', '夢'), + (0x2F85F, 'M', '奢'), + (0x2F860, 'M', '𡚨'), + (0x2F861, 'M', '𡛪'), + (0x2F862, 'M', '姬'), + (0x2F863, 'M', '娛'), + (0x2F864, 'M', '娧'), + (0x2F865, 'M', '姘'), + (0x2F866, 'M', '婦'), + (0x2F867, 'M', '㛮'), + (0x2F868, 'X'), + (0x2F869, 'M', '嬈'), + (0x2F86A, 'M', '嬾'), + (0x2F86C, 'M', '𡧈'), + (0x2F86D, 'M', '寃'), + (0x2F86E, 'M', '寘'), + (0x2F86F, 'M', '寧'), + (0x2F870, 'M', '寳'), + (0x2F871, 'M', '𡬘'), + (0x2F872, 'M', '寿'), + (0x2F873, 'M', '将'), + (0x2F874, 'X'), + (0x2F875, 'M', '尢'), + (0x2F876, 'M', '㞁'), + (0x2F877, 'M', '屠'), + (0x2F878, 'M', '屮'), + (0x2F879, 'M', '峀'), + (0x2F87A, 'M', '岍'), + (0x2F87B, 'M', '𡷤'), + (0x2F87C, 'M', '嵃'), + (0x2F87D, 'M', '𡷦'), + (0x2F87E, 'M', '嵮'), + (0x2F87F, 'M', '嵫'), + (0x2F880, 'M', '嵼'), + (0x2F881, 'M', '巡'), + (0x2F882, 'M', '巢'), + (0x2F883, 'M', '㠯'), + (0x2F884, 'M', '巽'), + (0x2F885, 'M', '帨'), + (0x2F886, 'M', '帽'), + (0x2F887, 'M', '幩'), + (0x2F888, 'M', '㡢'), + (0x2F889, 'M', '𢆃'), + (0x2F88A, 'M', '㡼'), + (0x2F88B, 'M', '庰'), + (0x2F88C, 'M', '庳'), + (0x2F88D, 'M', '庶'), + (0x2F88E, 'M', '廊'), + (0x2F88F, 'M', '𪎒'), + (0x2F890, 'M', '廾'), + (0x2F891, 'M', '𢌱'), + (0x2F893, 'M', '舁'), + (0x2F894, 'M', '弢'), + (0x2F896, 'M', '㣇'), + (0x2F897, 'M', '𣊸'), + (0x2F898, 'M', '𦇚'), + (0x2F899, 'M', '形'), + (0x2F89A, 'M', '彫'), + (0x2F89B, 'M', '㣣'), + (0x2F89C, 'M', '徚'), + (0x2F89D, 'M', '忍'), + (0x2F89E, 'M', '志'), + (0x2F89F, 'M', '忹'), + (0x2F8A0, 'M', '悁'), + (0x2F8A1, 'M', '㤺'), + (0x2F8A2, 'M', '㤜'), + (0x2F8A3, 'M', '悔'), + (0x2F8A4, 'M', '𢛔'), + (0x2F8A5, 'M', '惇'), + (0x2F8A6, 'M', '慈'), + ] + +def _seg_78() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F8A7, 'M', '慌'), + (0x2F8A8, 'M', '慎'), + (0x2F8A9, 'M', '慌'), + (0x2F8AA, 'M', '慺'), + (0x2F8AB, 'M', '憎'), + (0x2F8AC, 'M', '憲'), + (0x2F8AD, 'M', '憤'), + (0x2F8AE, 'M', '憯'), + (0x2F8AF, 'M', '懞'), + (0x2F8B0, 'M', '懲'), + (0x2F8B1, 'M', '懶'), + (0x2F8B2, 'M', '成'), + (0x2F8B3, 'M', '戛'), + (0x2F8B4, 'M', '扝'), + (0x2F8B5, 'M', '抱'), + (0x2F8B6, 'M', '拔'), + (0x2F8B7, 'M', '捐'), + (0x2F8B8, 'M', '𢬌'), + (0x2F8B9, 'M', '挽'), + (0x2F8BA, 'M', '拼'), + (0x2F8BB, 'M', '捨'), + (0x2F8BC, 'M', '掃'), + (0x2F8BD, 'M', '揤'), + (0x2F8BE, 'M', '𢯱'), + (0x2F8BF, 'M', '搢'), + (0x2F8C0, 'M', '揅'), + (0x2F8C1, 'M', '掩'), + (0x2F8C2, 'M', '㨮'), + (0x2F8C3, 'M', '摩'), + (0x2F8C4, 'M', '摾'), + (0x2F8C5, 'M', '撝'), + (0x2F8C6, 'M', '摷'), + (0x2F8C7, 'M', '㩬'), + (0x2F8C8, 'M', '敏'), + (0x2F8C9, 'M', '敬'), + (0x2F8CA, 'M', '𣀊'), + (0x2F8CB, 'M', '旣'), + (0x2F8CC, 'M', '書'), + (0x2F8CD, 'M', '晉'), + (0x2F8CE, 'M', '㬙'), + (0x2F8CF, 'M', '暑'), + (0x2F8D0, 'M', '㬈'), + (0x2F8D1, 'M', '㫤'), + (0x2F8D2, 'M', '冒'), + (0x2F8D3, 'M', '冕'), + (0x2F8D4, 'M', '最'), + (0x2F8D5, 'M', '暜'), + (0x2F8D6, 'M', '肭'), + (0x2F8D7, 'M', '䏙'), + (0x2F8D8, 'M', '朗'), + (0x2F8D9, 'M', '望'), + (0x2F8DA, 'M', '朡'), + (0x2F8DB, 'M', '杞'), + (0x2F8DC, 'M', '杓'), + (0x2F8DD, 'M', '𣏃'), + (0x2F8DE, 'M', '㭉'), + (0x2F8DF, 'M', '柺'), + (0x2F8E0, 'M', '枅'), + (0x2F8E1, 'M', '桒'), + (0x2F8E2, 'M', '梅'), + (0x2F8E3, 'M', '𣑭'), + (0x2F8E4, 'M', '梎'), + (0x2F8E5, 'M', '栟'), + (0x2F8E6, 'M', '椔'), + (0x2F8E7, 'M', '㮝'), + (0x2F8E8, 'M', '楂'), + (0x2F8E9, 'M', '榣'), + (0x2F8EA, 'M', '槪'), + (0x2F8EB, 'M', '檨'), + (0x2F8EC, 'M', '𣚣'), + (0x2F8ED, 'M', '櫛'), + (0x2F8EE, 'M', '㰘'), + (0x2F8EF, 'M', '次'), + (0x2F8F0, 'M', '𣢧'), + (0x2F8F1, 'M', '歔'), + (0x2F8F2, 'M', '㱎'), + (0x2F8F3, 'M', '歲'), + (0x2F8F4, 'M', '殟'), + (0x2F8F5, 'M', '殺'), + (0x2F8F6, 'M', '殻'), + (0x2F8F7, 'M', '𣪍'), + (0x2F8F8, 'M', '𡴋'), + (0x2F8F9, 'M', '𣫺'), + (0x2F8FA, 'M', '汎'), + (0x2F8FB, 'M', '𣲼'), + (0x2F8FC, 'M', '沿'), + (0x2F8FD, 'M', '泍'), + (0x2F8FE, 'M', '汧'), + (0x2F8FF, 'M', '洖'), + (0x2F900, 'M', '派'), + (0x2F901, 'M', '海'), + (0x2F902, 'M', '流'), + (0x2F903, 'M', '浩'), + (0x2F904, 'M', '浸'), + (0x2F905, 'M', '涅'), + (0x2F906, 'M', '𣴞'), + (0x2F907, 'M', '洴'), + (0x2F908, 'M', '港'), + (0x2F909, 'M', '湮'), + (0x2F90A, 'M', '㴳'), + ] + +def _seg_79() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F90B, 'M', '滋'), + (0x2F90C, 'M', '滇'), + (0x2F90D, 'M', '𣻑'), + (0x2F90E, 'M', '淹'), + (0x2F90F, 'M', '潮'), + (0x2F910, 'M', '𣽞'), + (0x2F911, 'M', '𣾎'), + (0x2F912, 'M', '濆'), + (0x2F913, 'M', '瀹'), + (0x2F914, 'M', '瀞'), + (0x2F915, 'M', '瀛'), + (0x2F916, 'M', '㶖'), + (0x2F917, 'M', '灊'), + (0x2F918, 'M', '災'), + (0x2F919, 'M', '灷'), + (0x2F91A, 'M', '炭'), + (0x2F91B, 'M', '𠔥'), + (0x2F91C, 'M', '煅'), + (0x2F91D, 'M', '𤉣'), + (0x2F91E, 'M', '熜'), + (0x2F91F, 'X'), + (0x2F920, 'M', '爨'), + (0x2F921, 'M', '爵'), + (0x2F922, 'M', '牐'), + (0x2F923, 'M', '𤘈'), + (0x2F924, 'M', '犀'), + (0x2F925, 'M', '犕'), + (0x2F926, 'M', '𤜵'), + (0x2F927, 'M', '𤠔'), + (0x2F928, 'M', '獺'), + (0x2F929, 'M', '王'), + (0x2F92A, 'M', '㺬'), + (0x2F92B, 'M', '玥'), + (0x2F92C, 'M', '㺸'), + (0x2F92E, 'M', '瑇'), + (0x2F92F, 'M', '瑜'), + (0x2F930, 'M', '瑱'), + (0x2F931, 'M', '璅'), + (0x2F932, 'M', '瓊'), + (0x2F933, 'M', '㼛'), + (0x2F934, 'M', '甤'), + (0x2F935, 'M', '𤰶'), + (0x2F936, 'M', '甾'), + (0x2F937, 'M', '𤲒'), + (0x2F938, 'M', '異'), + (0x2F939, 'M', '𢆟'), + (0x2F93A, 'M', '瘐'), + (0x2F93B, 'M', '𤾡'), + (0x2F93C, 'M', '𤾸'), + (0x2F93D, 'M', '𥁄'), + (0x2F93E, 'M', '㿼'), + (0x2F93F, 'M', '䀈'), + (0x2F940, 'M', '直'), + (0x2F941, 'M', '𥃳'), + (0x2F942, 'M', '𥃲'), + (0x2F943, 'M', '𥄙'), + (0x2F944, 'M', '𥄳'), + (0x2F945, 'M', '眞'), + (0x2F946, 'M', '真'), + (0x2F948, 'M', '睊'), + (0x2F949, 'M', '䀹'), + (0x2F94A, 'M', '瞋'), + (0x2F94B, 'M', '䁆'), + (0x2F94C, 'M', '䂖'), + (0x2F94D, 'M', '𥐝'), + (0x2F94E, 'M', '硎'), + (0x2F94F, 'M', '碌'), + (0x2F950, 'M', '磌'), + (0x2F951, 'M', '䃣'), + (0x2F952, 'M', '𥘦'), + (0x2F953, 'M', '祖'), + (0x2F954, 'M', '𥚚'), + (0x2F955, 'M', '𥛅'), + (0x2F956, 'M', '福'), + (0x2F957, 'M', '秫'), + (0x2F958, 'M', '䄯'), + (0x2F959, 'M', '穀'), + (0x2F95A, 'M', '穊'), + (0x2F95B, 'M', '穏'), + (0x2F95C, 'M', '𥥼'), + (0x2F95D, 'M', '𥪧'), + (0x2F95F, 'X'), + (0x2F960, 'M', '䈂'), + (0x2F961, 'M', '𥮫'), + (0x2F962, 'M', '篆'), + (0x2F963, 'M', '築'), + (0x2F964, 'M', '䈧'), + (0x2F965, 'M', '𥲀'), + (0x2F966, 'M', '糒'), + (0x2F967, 'M', '䊠'), + (0x2F968, 'M', '糨'), + (0x2F969, 'M', '糣'), + (0x2F96A, 'M', '紀'), + (0x2F96B, 'M', '𥾆'), + (0x2F96C, 'M', '絣'), + (0x2F96D, 'M', '䌁'), + (0x2F96E, 'M', '緇'), + (0x2F96F, 'M', '縂'), + (0x2F970, 'M', '繅'), + (0x2F971, 'M', '䌴'), + ] + +def _seg_80() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F972, 'M', '𦈨'), + (0x2F973, 'M', '𦉇'), + (0x2F974, 'M', '䍙'), + (0x2F975, 'M', '𦋙'), + (0x2F976, 'M', '罺'), + (0x2F977, 'M', '𦌾'), + (0x2F978, 'M', '羕'), + (0x2F979, 'M', '翺'), + (0x2F97A, 'M', '者'), + (0x2F97B, 'M', '𦓚'), + (0x2F97C, 'M', '𦔣'), + (0x2F97D, 'M', '聠'), + (0x2F97E, 'M', '𦖨'), + (0x2F97F, 'M', '聰'), + (0x2F980, 'M', '𣍟'), + (0x2F981, 'M', '䏕'), + (0x2F982, 'M', '育'), + (0x2F983, 'M', '脃'), + (0x2F984, 'M', '䐋'), + (0x2F985, 'M', '脾'), + (0x2F986, 'M', '媵'), + (0x2F987, 'M', '𦞧'), + (0x2F988, 'M', '𦞵'), + (0x2F989, 'M', '𣎓'), + (0x2F98A, 'M', '𣎜'), + (0x2F98B, 'M', '舁'), + (0x2F98C, 'M', '舄'), + (0x2F98D, 'M', '辞'), + (0x2F98E, 'M', '䑫'), + (0x2F98F, 'M', '芑'), + (0x2F990, 'M', '芋'), + (0x2F991, 'M', '芝'), + (0x2F992, 'M', '劳'), + (0x2F993, 'M', '花'), + (0x2F994, 'M', '芳'), + (0x2F995, 'M', '芽'), + (0x2F996, 'M', '苦'), + (0x2F997, 'M', '𦬼'), + (0x2F998, 'M', '若'), + (0x2F999, 'M', '茝'), + (0x2F99A, 'M', '荣'), + (0x2F99B, 'M', '莭'), + (0x2F99C, 'M', '茣'), + (0x2F99D, 'M', '莽'), + (0x2F99E, 'M', '菧'), + (0x2F99F, 'M', '著'), + (0x2F9A0, 'M', '荓'), + (0x2F9A1, 'M', '菊'), + (0x2F9A2, 'M', '菌'), + (0x2F9A3, 'M', '菜'), + (0x2F9A4, 'M', '𦰶'), + (0x2F9A5, 'M', '𦵫'), + (0x2F9A6, 'M', '𦳕'), + (0x2F9A7, 'M', '䔫'), + (0x2F9A8, 'M', '蓱'), + (0x2F9A9, 'M', '蓳'), + (0x2F9AA, 'M', '蔖'), + (0x2F9AB, 'M', '𧏊'), + (0x2F9AC, 'M', '蕤'), + (0x2F9AD, 'M', '𦼬'), + (0x2F9AE, 'M', '䕝'), + (0x2F9AF, 'M', '䕡'), + (0x2F9B0, 'M', '𦾱'), + (0x2F9B1, 'M', '𧃒'), + (0x2F9B2, 'M', '䕫'), + (0x2F9B3, 'M', '虐'), + (0x2F9B4, 'M', '虜'), + (0x2F9B5, 'M', '虧'), + (0x2F9B6, 'M', '虩'), + (0x2F9B7, 'M', '蚩'), + (0x2F9B8, 'M', '蚈'), + (0x2F9B9, 'M', '蜎'), + (0x2F9BA, 'M', '蛢'), + (0x2F9BB, 'M', '蝹'), + (0x2F9BC, 'M', '蜨'), + (0x2F9BD, 'M', '蝫'), + (0x2F9BE, 'M', '螆'), + (0x2F9BF, 'X'), + (0x2F9C0, 'M', '蟡'), + (0x2F9C1, 'M', '蠁'), + (0x2F9C2, 'M', '䗹'), + (0x2F9C3, 'M', '衠'), + (0x2F9C4, 'M', '衣'), + (0x2F9C5, 'M', '𧙧'), + (0x2F9C6, 'M', '裗'), + (0x2F9C7, 'M', '裞'), + (0x2F9C8, 'M', '䘵'), + (0x2F9C9, 'M', '裺'), + (0x2F9CA, 'M', '㒻'), + (0x2F9CB, 'M', '𧢮'), + (0x2F9CC, 'M', '𧥦'), + (0x2F9CD, 'M', '䚾'), + (0x2F9CE, 'M', '䛇'), + (0x2F9CF, 'M', '誠'), + (0x2F9D0, 'M', '諭'), + (0x2F9D1, 'M', '變'), + (0x2F9D2, 'M', '豕'), + (0x2F9D3, 'M', '𧲨'), + (0x2F9D4, 'M', '貫'), + (0x2F9D5, 'M', '賁'), + ] + +def _seg_81() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]: + return [ + (0x2F9D6, 'M', '贛'), + (0x2F9D7, 'M', '起'), + (0x2F9D8, 'M', '𧼯'), + (0x2F9D9, 'M', '𠠄'), + (0x2F9DA, 'M', '跋'), + (0x2F9DB, 'M', '趼'), + (0x2F9DC, 'M', '跰'), + (0x2F9DD, 'M', '𠣞'), + (0x2F9DE, 'M', '軔'), + (0x2F9DF, 'M', '輸'), + (0x2F9E0, 'M', '𨗒'), + (0x2F9E1, 'M', '𨗭'), + (0x2F9E2, 'M', '邔'), + (0x2F9E3, 'M', '郱'), + (0x2F9E4, 'M', '鄑'), + (0x2F9E5, 'M', '𨜮'), + (0x2F9E6, 'M', '鄛'), + (0x2F9E7, 'M', '鈸'), + (0x2F9E8, 'M', '鋗'), + (0x2F9E9, 'M', '鋘'), + (0x2F9EA, 'M', '鉼'), + (0x2F9EB, 'M', '鏹'), + (0x2F9EC, 'M', '鐕'), + (0x2F9ED, 'M', '𨯺'), + (0x2F9EE, 'M', '開'), + (0x2F9EF, 'M', '䦕'), + (0x2F9F0, 'M', '閷'), + (0x2F9F1, 'M', '𨵷'), + (0x2F9F2, 'M', '䧦'), + (0x2F9F3, 'M', '雃'), + (0x2F9F4, 'M', '嶲'), + (0x2F9F5, 'M', '霣'), + (0x2F9F6, 'M', '𩅅'), + (0x2F9F7, 'M', '𩈚'), + (0x2F9F8, 'M', '䩮'), + (0x2F9F9, 'M', '䩶'), + (0x2F9FA, 'M', '韠'), + (0x2F9FB, 'M', '𩐊'), + (0x2F9FC, 'M', '䪲'), + (0x2F9FD, 'M', '𩒖'), + (0x2F9FE, 'M', '頋'), + (0x2FA00, 'M', '頩'), + (0x2FA01, 'M', '𩖶'), + (0x2FA02, 'M', '飢'), + (0x2FA03, 'M', '䬳'), + (0x2FA04, 'M', '餩'), + (0x2FA05, 'M', '馧'), + (0x2FA06, 'M', '駂'), + (0x2FA07, 'M', '駾'), + (0x2FA08, 'M', '䯎'), + (0x2FA09, 'M', '𩬰'), + (0x2FA0A, 'M', '鬒'), + (0x2FA0B, 'M', '鱀'), + (0x2FA0C, 'M', '鳽'), + (0x2FA0D, 'M', '䳎'), + (0x2FA0E, 'M', '䳭'), + (0x2FA0F, 'M', '鵧'), + (0x2FA10, 'M', '𪃎'), + (0x2FA11, 'M', '䳸'), + (0x2FA12, 'M', '𪄅'), + (0x2FA13, 'M', '𪈎'), + (0x2FA14, 'M', '𪊑'), + (0x2FA15, 'M', '麻'), + (0x2FA16, 'M', '䵖'), + (0x2FA17, 'M', '黹'), + (0x2FA18, 'M', '黾'), + (0x2FA19, 'M', '鼅'), + (0x2FA1A, 'M', '鼏'), + (0x2FA1B, 'M', '鼖'), + (0x2FA1C, 'M', '鼻'), + (0x2FA1D, 'M', '𪘀'), + (0x2FA1E, 'X'), + (0x30000, 'V'), + (0x3134B, 'X'), + (0x31350, 'V'), + (0x323B0, 'X'), + (0xE0100, 'I'), + (0xE01F0, 'X'), + ] + +uts46data = tuple( + _seg_0() + + _seg_1() + + _seg_2() + + _seg_3() + + _seg_4() + + _seg_5() + + _seg_6() + + _seg_7() + + _seg_8() + + _seg_9() + + _seg_10() + + _seg_11() + + _seg_12() + + _seg_13() + + _seg_14() + + _seg_15() + + _seg_16() + + _seg_17() + + _seg_18() + + _seg_19() + + _seg_20() + + _seg_21() + + _seg_22() + + _seg_23() + + _seg_24() + + _seg_25() + + _seg_26() + + _seg_27() + + _seg_28() + + _seg_29() + + _seg_30() + + _seg_31() + + _seg_32() + + _seg_33() + + _seg_34() + + _seg_35() + + _seg_36() + + _seg_37() + + _seg_38() + + _seg_39() + + _seg_40() + + _seg_41() + + _seg_42() + + _seg_43() + + _seg_44() + + _seg_45() + + _seg_46() + + _seg_47() + + _seg_48() + + _seg_49() + + _seg_50() + + _seg_51() + + _seg_52() + + _seg_53() + + _seg_54() + + _seg_55() + + _seg_56() + + _seg_57() + + _seg_58() + + _seg_59() + + _seg_60() + + _seg_61() + + _seg_62() + + _seg_63() + + _seg_64() + + _seg_65() + + _seg_66() + + _seg_67() + + _seg_68() + + _seg_69() + + _seg_70() + + _seg_71() + + _seg_72() + + _seg_73() + + _seg_74() + + _seg_75() + + _seg_76() + + _seg_77() + + _seg_78() + + _seg_79() + + _seg_80() + + _seg_81() +) # type: Tuple[Union[Tuple[int, str], Tuple[int, str, str]], ...] diff --git a/requests/python/requests-2.31.0.dist-info/INSTALLER b/requests/python/requests-2.31.0.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/requests/python/requests-2.31.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/requests/python/requests-2.31.0.dist-info/LICENSE b/requests/python/requests-2.31.0.dist-info/LICENSE new file mode 100644 index 0000000..67db858 --- /dev/null +++ b/requests/python/requests-2.31.0.dist-info/LICENSE @@ -0,0 +1,175 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. diff --git a/requests/python/requests-2.31.0.dist-info/METADATA b/requests/python/requests-2.31.0.dist-info/METADATA new file mode 100644 index 0000000..05779fa --- /dev/null +++ b/requests/python/requests-2.31.0.dist-info/METADATA @@ -0,0 +1,122 @@ +Metadata-Version: 2.1 +Name: requests +Version: 2.31.0 +Summary: Python HTTP for Humans. +Home-page: https://requests.readthedocs.io +Author: Kenneth Reitz +Author-email: me@kennethreitz.org +License: Apache 2.0 +Project-URL: Documentation, https://requests.readthedocs.io +Project-URL: Source, https://github.com/psf/requests +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: charset-normalizer (<4,>=2) +Requires-Dist: idna (<4,>=2.5) +Requires-Dist: urllib3 (<3,>=1.21.1) +Requires-Dist: certifi (>=2017.4.17) +Provides-Extra: security +Provides-Extra: socks +Requires-Dist: PySocks (!=1.5.7,>=1.5.6) ; extra == 'socks' +Provides-Extra: use_chardet_on_py3 +Requires-Dist: chardet (<6,>=3.0.2) ; extra == 'use_chardet_on_py3' + +# Requests + +**Requests** is a simple, yet elegant, HTTP library. + +```python +>>> import requests +>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass')) +>>> r.status_code +200 +>>> r.headers['content-type'] +'application/json; charset=utf8' +>>> r.encoding +'utf-8' +>>> r.text +'{"authenticated": true, ...' +>>> r.json() +{'authenticated': True, ...} +``` + +Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your `PUT` & `POST` data — but nowadays, just use the `json` method! + +Requests is one of the most downloaded Python packages today, pulling in around `30M downloads / week`— according to GitHub, Requests is currently [depended upon](https://github.com/psf/requests/network/dependents?package_id=UGFja2FnZS01NzA4OTExNg%3D%3D) by `1,000,000+` repositories. You may certainly put your trust in this code. + +[![Downloads](https://pepy.tech/badge/requests/month)](https://pepy.tech/project/requests) +[![Supported Versions](https://img.shields.io/pypi/pyversions/requests.svg)](https://pypi.org/project/requests) +[![Contributors](https://img.shields.io/github/contributors/psf/requests.svg)](https://github.com/psf/requests/graphs/contributors) + +## Installing Requests and Supported Versions + +Requests is available on PyPI: + +```console +$ python -m pip install requests +``` + +Requests officially supports Python 3.7+. + +## Supported Features & Best–Practices + +Requests is ready for the demands of building robust and reliable HTTP–speaking applications, for the needs of today. + +- Keep-Alive & Connection Pooling +- International Domains and URLs +- Sessions with Cookie Persistence +- Browser-style TLS/SSL Verification +- Basic & Digest Authentication +- Familiar `dict`–like Cookies +- Automatic Content Decompression and Decoding +- Multi-part File Uploads +- SOCKS Proxy Support +- Connection Timeouts +- Streaming Downloads +- Automatic honoring of `.netrc` +- Chunked HTTP Requests + +## API Reference and User Guide available on [Read the Docs](https://requests.readthedocs.io) + +[![Read the Docs](https://raw.githubusercontent.com/psf/requests/main/ext/ss.png)](https://requests.readthedocs.io) + +## Cloning the repository + +When cloning the Requests repository, you may need to add the `-c +fetch.fsck.badTimezone=ignore` flag to avoid an error about a bad commit (see +[this issue](https://github.com/psf/requests/issues/2690) for more background): + +```shell +git clone -c fetch.fsck.badTimezone=ignore https://github.com/psf/requests.git +``` + +You can also apply this setting to your global Git config: + +```shell +git config --global fetch.fsck.badTimezone ignore +``` + +--- + +[![Kenneth Reitz](https://raw.githubusercontent.com/psf/requests/main/ext/kr.png)](https://kennethreitz.org) [![Python Software Foundation](https://raw.githubusercontent.com/psf/requests/main/ext/psf.png)](https://www.python.org/psf) + + diff --git a/requests/python/requests-2.31.0.dist-info/RECORD b/requests/python/requests-2.31.0.dist-info/RECORD new file mode 100644 index 0000000..abb6ac6 --- /dev/null +++ b/requests/python/requests-2.31.0.dist-info/RECORD @@ -0,0 +1,43 @@ +requests-2.31.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +requests-2.31.0.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142 +requests-2.31.0.dist-info/METADATA,sha256=eCPokOnbb0FROLrfl0R5EpDvdufsb9CaN4noJH__54I,4634 +requests-2.31.0.dist-info/RECORD,, +requests-2.31.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +requests-2.31.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92 +requests-2.31.0.dist-info/top_level.txt,sha256=fMSVmHfb5rbGOo6xv-O_tUX6j-WyixssE-SnwcDRxNQ,9 +requests/__init__.py,sha256=LvmKhjIz8mHaKXthC2Mv5ykZ1d92voyf3oJpd-VuAig,4963 +requests/__pycache__/__init__.cpython-311.pyc,, +requests/__pycache__/__version__.cpython-311.pyc,, +requests/__pycache__/_internal_utils.cpython-311.pyc,, +requests/__pycache__/adapters.cpython-311.pyc,, +requests/__pycache__/api.cpython-311.pyc,, +requests/__pycache__/auth.cpython-311.pyc,, +requests/__pycache__/certs.cpython-311.pyc,, +requests/__pycache__/compat.cpython-311.pyc,, +requests/__pycache__/cookies.cpython-311.pyc,, +requests/__pycache__/exceptions.cpython-311.pyc,, +requests/__pycache__/help.cpython-311.pyc,, +requests/__pycache__/hooks.cpython-311.pyc,, +requests/__pycache__/models.cpython-311.pyc,, +requests/__pycache__/packages.cpython-311.pyc,, +requests/__pycache__/sessions.cpython-311.pyc,, +requests/__pycache__/status_codes.cpython-311.pyc,, +requests/__pycache__/structures.cpython-311.pyc,, +requests/__pycache__/utils.cpython-311.pyc,, +requests/__version__.py,sha256=ssI3Ezt7PaxgkOW45GhtwPUclo_SO_ygtIm4A74IOfw,435 +requests/_internal_utils.py,sha256=nMQymr4hs32TqVo5AbCrmcJEhvPUh7xXlluyqwslLiQ,1495 +requests/adapters.py,sha256=v_FmjU5KZ76k-YttShZYB5RprIzhhL8Y3zgW9p4eBQ8,19553 +requests/api.py,sha256=q61xcXq4tmiImrvcSVLTbFyCiD2F-L_-hWKGbz4y8vg,6449 +requests/auth.py,sha256=h-HLlVx9j8rKV5hfSAycP2ApOSglTz77R0tz7qCbbEE,10187 +requests/certs.py,sha256=Z9Sb410Anv6jUFTyss0jFFhU6xst8ctELqfy8Ev23gw,429 +requests/compat.py,sha256=yxntVOSEHGMrn7FNr_32EEam1ZNAdPRdSE13_yaHzTk,1451 +requests/cookies.py,sha256=kD3kNEcCj-mxbtf5fJsSaT86eGoEYpD3X0CSgpzl7BM,18560 +requests/exceptions.py,sha256=DhveFBclVjTRxhRduVpO-GbMYMID2gmjdLfNEqNpI_U,3811 +requests/help.py,sha256=gPX5d_H7Xd88aDABejhqGgl9B1VFRTt5BmiYvL3PzIQ,3875 +requests/hooks.py,sha256=CiuysiHA39V5UfcCBXFIx83IrDpuwfN9RcTUgv28ftQ,733 +requests/models.py,sha256=-DlKi0or8gFAM6VzutobXvvBW_2wrJuOF5NfndTIddA,35223 +requests/packages.py,sha256=DXgv-FJIczZITmv0vEBAhWj4W-5CGCIN_ksvgR17Dvs,957 +requests/sessions.py,sha256=-LvTzrPtetSTrR3buxu4XhdgMrJFLB1q5D7P--L2Xhw,30373 +requests/status_codes.py,sha256=FvHmT5uH-_uimtRz5hH9VCbt7VV-Nei2J9upbej6j8g,4235 +requests/structures.py,sha256=-IbmhVz06S-5aPSZuUthZ6-6D9XOjRuTXHOabY041XM,2912 +requests/utils.py,sha256=6sx2X3cIVA8BgWOg8odxFy-_lbWDFETU8HI4fU4Rmqw,33448 diff --git a/requests/python/requests-2.31.0.dist-info/REQUESTED b/requests/python/requests-2.31.0.dist-info/REQUESTED new file mode 100644 index 0000000..e69de29 diff --git a/requests/python/requests-2.31.0.dist-info/WHEEL b/requests/python/requests-2.31.0.dist-info/WHEEL new file mode 100644 index 0000000..1f37c02 --- /dev/null +++ b/requests/python/requests-2.31.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.40.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/requests/python/requests-2.31.0.dist-info/top_level.txt b/requests/python/requests-2.31.0.dist-info/top_level.txt new file mode 100644 index 0000000..f229360 --- /dev/null +++ b/requests/python/requests-2.31.0.dist-info/top_level.txt @@ -0,0 +1 @@ +requests diff --git a/requests/python/requests/__init__.py b/requests/python/requests/__init__.py new file mode 100644 index 0000000..300a16c --- /dev/null +++ b/requests/python/requests/__init__.py @@ -0,0 +1,180 @@ +# __ +# /__) _ _ _ _ _/ _ +# / ( (- (/ (/ (- _) / _) +# / + +""" +Requests HTTP Library +~~~~~~~~~~~~~~~~~~~~~ + +Requests is an HTTP library, written in Python, for human beings. +Basic GET usage: + + >>> import requests + >>> r = requests.get('https://www.python.org') + >>> r.status_code + 200 + >>> b'Python is a programming language' in r.content + True + +... or POST: + + >>> payload = dict(key1='value1', key2='value2') + >>> r = requests.post('https://httpbin.org/post', data=payload) + >>> print(r.text) + { + ... + "form": { + "key1": "value1", + "key2": "value2" + }, + ... + } + +The other HTTP methods are supported - see `requests.api`. Full documentation +is at . + +:copyright: (c) 2017 by Kenneth Reitz. +:license: Apache 2.0, see LICENSE for more details. +""" + +import warnings + +import urllib3 + +from .exceptions import RequestsDependencyWarning + +try: + from charset_normalizer import __version__ as charset_normalizer_version +except ImportError: + charset_normalizer_version = None + +try: + from chardet import __version__ as chardet_version +except ImportError: + chardet_version = None + + +def check_compatibility(urllib3_version, chardet_version, charset_normalizer_version): + urllib3_version = urllib3_version.split(".") + assert urllib3_version != ["dev"] # Verify urllib3 isn't installed from git. + + # Sometimes, urllib3 only reports its version as 16.1. + if len(urllib3_version) == 2: + urllib3_version.append("0") + + # Check urllib3 for compatibility. + major, minor, patch = urllib3_version # noqa: F811 + major, minor, patch = int(major), int(minor), int(patch) + # urllib3 >= 1.21.1 + assert major >= 1 + if major == 1: + assert minor >= 21 + + # Check charset_normalizer for compatibility. + if chardet_version: + major, minor, patch = chardet_version.split(".")[:3] + major, minor, patch = int(major), int(minor), int(patch) + # chardet_version >= 3.0.2, < 6.0.0 + assert (3, 0, 2) <= (major, minor, patch) < (6, 0, 0) + elif charset_normalizer_version: + major, minor, patch = charset_normalizer_version.split(".")[:3] + major, minor, patch = int(major), int(minor), int(patch) + # charset_normalizer >= 2.0.0 < 4.0.0 + assert (2, 0, 0) <= (major, minor, patch) < (4, 0, 0) + else: + raise Exception("You need either charset_normalizer or chardet installed") + + +def _check_cryptography(cryptography_version): + # cryptography < 1.3.4 + try: + cryptography_version = list(map(int, cryptography_version.split("."))) + except ValueError: + return + + if cryptography_version < [1, 3, 4]: + warning = "Old version of cryptography ({}) may cause slowdown.".format( + cryptography_version + ) + warnings.warn(warning, RequestsDependencyWarning) + + +# Check imported dependencies for compatibility. +try: + check_compatibility( + urllib3.__version__, chardet_version, charset_normalizer_version + ) +except (AssertionError, ValueError): + warnings.warn( + "urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " + "version!".format( + urllib3.__version__, chardet_version, charset_normalizer_version + ), + RequestsDependencyWarning, + ) + +# Attempt to enable urllib3's fallback for SNI support +# if the standard library doesn't support SNI or the +# 'ssl' library isn't available. +try: + try: + import ssl + except ImportError: + ssl = None + + if not getattr(ssl, "HAS_SNI", False): + from urllib3.contrib import pyopenssl + + pyopenssl.inject_into_urllib3() + + # Check cryptography version + from cryptography import __version__ as cryptography_version + + _check_cryptography(cryptography_version) +except ImportError: + pass + +# urllib3's DependencyWarnings should be silenced. +from urllib3.exceptions import DependencyWarning + +warnings.simplefilter("ignore", DependencyWarning) + +# Set default logging handler to avoid "No handler found" warnings. +import logging +from logging import NullHandler + +from . import packages, utils +from .__version__ import ( + __author__, + __author_email__, + __build__, + __cake__, + __copyright__, + __description__, + __license__, + __title__, + __url__, + __version__, +) +from .api import delete, get, head, options, patch, post, put, request +from .exceptions import ( + ConnectionError, + ConnectTimeout, + FileModeWarning, + HTTPError, + JSONDecodeError, + ReadTimeout, + RequestException, + Timeout, + TooManyRedirects, + URLRequired, +) +from .models import PreparedRequest, Request, Response +from .sessions import Session, session +from .status_codes import codes + +logging.getLogger(__name__).addHandler(NullHandler()) + +# FileModeWarnings go off per the default. +warnings.simplefilter("default", FileModeWarning, append=True) diff --git a/requests/python/requests/__pycache__/__init__.cpython-311.pyc b/requests/python/requests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e541c98 Binary files /dev/null and b/requests/python/requests/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/__version__.cpython-311.pyc b/requests/python/requests/__pycache__/__version__.cpython-311.pyc new file mode 100644 index 0000000..e0e072c Binary files /dev/null and b/requests/python/requests/__pycache__/__version__.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/_internal_utils.cpython-311.pyc b/requests/python/requests/__pycache__/_internal_utils.cpython-311.pyc new file mode 100644 index 0000000..8492ba0 Binary files /dev/null and b/requests/python/requests/__pycache__/_internal_utils.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/adapters.cpython-311.pyc b/requests/python/requests/__pycache__/adapters.cpython-311.pyc new file mode 100644 index 0000000..b9bf20b Binary files /dev/null and b/requests/python/requests/__pycache__/adapters.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/api.cpython-311.pyc b/requests/python/requests/__pycache__/api.cpython-311.pyc new file mode 100644 index 0000000..fe789a7 Binary files /dev/null and b/requests/python/requests/__pycache__/api.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/auth.cpython-311.pyc b/requests/python/requests/__pycache__/auth.cpython-311.pyc new file mode 100644 index 0000000..4097e67 Binary files /dev/null and b/requests/python/requests/__pycache__/auth.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/certs.cpython-311.pyc b/requests/python/requests/__pycache__/certs.cpython-311.pyc new file mode 100644 index 0000000..13ffd8f Binary files /dev/null and b/requests/python/requests/__pycache__/certs.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/compat.cpython-311.pyc b/requests/python/requests/__pycache__/compat.cpython-311.pyc new file mode 100644 index 0000000..fe1bbb2 Binary files /dev/null and b/requests/python/requests/__pycache__/compat.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/cookies.cpython-311.pyc b/requests/python/requests/__pycache__/cookies.cpython-311.pyc new file mode 100644 index 0000000..5d56ea1 Binary files /dev/null and b/requests/python/requests/__pycache__/cookies.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/exceptions.cpython-311.pyc b/requests/python/requests/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..fc56679 Binary files /dev/null and b/requests/python/requests/__pycache__/exceptions.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/help.cpython-311.pyc b/requests/python/requests/__pycache__/help.cpython-311.pyc new file mode 100644 index 0000000..f6e4071 Binary files /dev/null and b/requests/python/requests/__pycache__/help.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/hooks.cpython-311.pyc b/requests/python/requests/__pycache__/hooks.cpython-311.pyc new file mode 100644 index 0000000..8c8e15e Binary files /dev/null and b/requests/python/requests/__pycache__/hooks.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/models.cpython-311.pyc b/requests/python/requests/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..1bfe1da Binary files /dev/null and b/requests/python/requests/__pycache__/models.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/packages.cpython-311.pyc b/requests/python/requests/__pycache__/packages.cpython-311.pyc new file mode 100644 index 0000000..c9d92d4 Binary files /dev/null and b/requests/python/requests/__pycache__/packages.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/sessions.cpython-311.pyc b/requests/python/requests/__pycache__/sessions.cpython-311.pyc new file mode 100644 index 0000000..81b900b Binary files /dev/null and b/requests/python/requests/__pycache__/sessions.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/status_codes.cpython-311.pyc b/requests/python/requests/__pycache__/status_codes.cpython-311.pyc new file mode 100644 index 0000000..fd03f8a Binary files /dev/null and b/requests/python/requests/__pycache__/status_codes.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/structures.cpython-311.pyc b/requests/python/requests/__pycache__/structures.cpython-311.pyc new file mode 100644 index 0000000..846abbe Binary files /dev/null and b/requests/python/requests/__pycache__/structures.cpython-311.pyc differ diff --git a/requests/python/requests/__pycache__/utils.cpython-311.pyc b/requests/python/requests/__pycache__/utils.cpython-311.pyc new file mode 100644 index 0000000..4178568 Binary files /dev/null and b/requests/python/requests/__pycache__/utils.cpython-311.pyc differ diff --git a/requests/python/requests/__version__.py b/requests/python/requests/__version__.py new file mode 100644 index 0000000..5063c3f --- /dev/null +++ b/requests/python/requests/__version__.py @@ -0,0 +1,14 @@ +# .-. .-. .-. . . .-. .-. .-. .-. +# |( |- |.| | | |- `-. | `-. +# ' ' `-' `-`.`-' `-' `-' ' `-' + +__title__ = "requests" +__description__ = "Python HTTP for Humans." +__url__ = "https://requests.readthedocs.io" +__version__ = "2.31.0" +__build__ = 0x023100 +__author__ = "Kenneth Reitz" +__author_email__ = "me@kennethreitz.org" +__license__ = "Apache 2.0" +__copyright__ = "Copyright Kenneth Reitz" +__cake__ = "\u2728 \U0001f370 \u2728" diff --git a/requests/python/requests/_internal_utils.py b/requests/python/requests/_internal_utils.py new file mode 100644 index 0000000..f2cf635 --- /dev/null +++ b/requests/python/requests/_internal_utils.py @@ -0,0 +1,50 @@ +""" +requests._internal_utils +~~~~~~~~~~~~~~ + +Provides utility functions that are consumed internally by Requests +which depend on extremely few external helpers (such as compat) +""" +import re + +from .compat import builtin_str + +_VALID_HEADER_NAME_RE_BYTE = re.compile(rb"^[^:\s][^:\r\n]*$") +_VALID_HEADER_NAME_RE_STR = re.compile(r"^[^:\s][^:\r\n]*$") +_VALID_HEADER_VALUE_RE_BYTE = re.compile(rb"^\S[^\r\n]*$|^$") +_VALID_HEADER_VALUE_RE_STR = re.compile(r"^\S[^\r\n]*$|^$") + +_HEADER_VALIDATORS_STR = (_VALID_HEADER_NAME_RE_STR, _VALID_HEADER_VALUE_RE_STR) +_HEADER_VALIDATORS_BYTE = (_VALID_HEADER_NAME_RE_BYTE, _VALID_HEADER_VALUE_RE_BYTE) +HEADER_VALIDATORS = { + bytes: _HEADER_VALIDATORS_BYTE, + str: _HEADER_VALIDATORS_STR, +} + + +def to_native_string(string, encoding="ascii"): + """Given a string object, regardless of type, returns a representation of + that string in the native string type, encoding and decoding where + necessary. This assumes ASCII unless told otherwise. + """ + if isinstance(string, builtin_str): + out = string + else: + out = string.decode(encoding) + + return out + + +def unicode_is_ascii(u_string): + """Determine if unicode string only contains ASCII characters. + + :param str u_string: unicode string to check. Must be unicode + and not Python 2 `str`. + :rtype: bool + """ + assert isinstance(u_string, str) + try: + u_string.encode("ascii") + return True + except UnicodeEncodeError: + return False diff --git a/requests/python/requests/adapters.py b/requests/python/requests/adapters.py new file mode 100644 index 0000000..78e3bb6 --- /dev/null +++ b/requests/python/requests/adapters.py @@ -0,0 +1,538 @@ +""" +requests.adapters +~~~~~~~~~~~~~~~~~ + +This module contains the transport adapters that Requests uses to define +and maintain connections. +""" + +import os.path +import socket # noqa: F401 + +from urllib3.exceptions import ClosedPoolError, ConnectTimeoutError +from urllib3.exceptions import HTTPError as _HTTPError +from urllib3.exceptions import InvalidHeader as _InvalidHeader +from urllib3.exceptions import ( + LocationValueError, + MaxRetryError, + NewConnectionError, + ProtocolError, +) +from urllib3.exceptions import ProxyError as _ProxyError +from urllib3.exceptions import ReadTimeoutError, ResponseError +from urllib3.exceptions import SSLError as _SSLError +from urllib3.poolmanager import PoolManager, proxy_from_url +from urllib3.util import Timeout as TimeoutSauce +from urllib3.util import parse_url +from urllib3.util.retry import Retry + +from .auth import _basic_auth_str +from .compat import basestring, urlparse +from .cookies import extract_cookies_to_jar +from .exceptions import ( + ConnectionError, + ConnectTimeout, + InvalidHeader, + InvalidProxyURL, + InvalidSchema, + InvalidURL, + ProxyError, + ReadTimeout, + RetryError, + SSLError, +) +from .models import Response +from .structures import CaseInsensitiveDict +from .utils import ( + DEFAULT_CA_BUNDLE_PATH, + extract_zipped_paths, + get_auth_from_url, + get_encoding_from_headers, + prepend_scheme_if_needed, + select_proxy, + urldefragauth, +) + +try: + from urllib3.contrib.socks import SOCKSProxyManager +except ImportError: + + def SOCKSProxyManager(*args, **kwargs): + raise InvalidSchema("Missing dependencies for SOCKS support.") + + +DEFAULT_POOLBLOCK = False +DEFAULT_POOLSIZE = 10 +DEFAULT_RETRIES = 0 +DEFAULT_POOL_TIMEOUT = None + + +class BaseAdapter: + """The Base Transport Adapter""" + + def __init__(self): + super().__init__() + + def send( + self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None + ): + """Sends PreparedRequest object. Returns Response object. + + :param request: The :class:`PreparedRequest ` being sent. + :param stream: (optional) Whether to stream the request content. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use + :param cert: (optional) Any user-provided SSL certificate to be trusted. + :param proxies: (optional) The proxies dictionary to apply to the request. + """ + raise NotImplementedError + + def close(self): + """Cleans up adapter specific items.""" + raise NotImplementedError + + +class HTTPAdapter(BaseAdapter): + """The built-in HTTP Adapter for urllib3. + + Provides a general-case interface for Requests sessions to contact HTTP and + HTTPS urls by implementing the Transport Adapter interface. This class will + usually be created by the :class:`Session ` class under the + covers. + + :param pool_connections: The number of urllib3 connection pools to cache. + :param pool_maxsize: The maximum number of connections to save in the pool. + :param max_retries: The maximum number of retries each connection + should attempt. Note, this applies only to failed DNS lookups, socket + connections and connection timeouts, never to requests where data has + made it to the server. By default, Requests does not retry failed + connections. If you need granular control over the conditions under + which we retry a request, import urllib3's ``Retry`` class and pass + that instead. + :param pool_block: Whether the connection pool should block for connections. + + Usage:: + + >>> import requests + >>> s = requests.Session() + >>> a = requests.adapters.HTTPAdapter(max_retries=3) + >>> s.mount('http://', a) + """ + + __attrs__ = [ + "max_retries", + "config", + "_pool_connections", + "_pool_maxsize", + "_pool_block", + ] + + def __init__( + self, + pool_connections=DEFAULT_POOLSIZE, + pool_maxsize=DEFAULT_POOLSIZE, + max_retries=DEFAULT_RETRIES, + pool_block=DEFAULT_POOLBLOCK, + ): + if max_retries == DEFAULT_RETRIES: + self.max_retries = Retry(0, read=False) + else: + self.max_retries = Retry.from_int(max_retries) + self.config = {} + self.proxy_manager = {} + + super().__init__() + + self._pool_connections = pool_connections + self._pool_maxsize = pool_maxsize + self._pool_block = pool_block + + self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block) + + def __getstate__(self): + return {attr: getattr(self, attr, None) for attr in self.__attrs__} + + def __setstate__(self, state): + # Can't handle by adding 'proxy_manager' to self.__attrs__ because + # self.poolmanager uses a lambda function, which isn't pickleable. + self.proxy_manager = {} + self.config = {} + + for attr, value in state.items(): + setattr(self, attr, value) + + self.init_poolmanager( + self._pool_connections, self._pool_maxsize, block=self._pool_block + ) + + def init_poolmanager( + self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs + ): + """Initializes a urllib3 PoolManager. + + This method should not be called from user code, and is only + exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param connections: The number of urllib3 connection pools to cache. + :param maxsize: The maximum number of connections to save in the pool. + :param block: Block when no free connections are available. + :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. + """ + # save these values for pickling + self._pool_connections = connections + self._pool_maxsize = maxsize + self._pool_block = block + + self.poolmanager = PoolManager( + num_pools=connections, + maxsize=maxsize, + block=block, + **pool_kwargs, + ) + + def proxy_manager_for(self, proxy, **proxy_kwargs): + """Return urllib3 ProxyManager for the given proxy. + + This method should not be called from user code, and is only + exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param proxy: The proxy to return a urllib3 ProxyManager for. + :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. + :returns: ProxyManager + :rtype: urllib3.ProxyManager + """ + if proxy in self.proxy_manager: + manager = self.proxy_manager[proxy] + elif proxy.lower().startswith("socks"): + username, password = get_auth_from_url(proxy) + manager = self.proxy_manager[proxy] = SOCKSProxyManager( + proxy, + username=username, + password=password, + num_pools=self._pool_connections, + maxsize=self._pool_maxsize, + block=self._pool_block, + **proxy_kwargs, + ) + else: + proxy_headers = self.proxy_headers(proxy) + manager = self.proxy_manager[proxy] = proxy_from_url( + proxy, + proxy_headers=proxy_headers, + num_pools=self._pool_connections, + maxsize=self._pool_maxsize, + block=self._pool_block, + **proxy_kwargs, + ) + + return manager + + def cert_verify(self, conn, url, verify, cert): + """Verify a SSL certificate. This method should not be called from user + code, and is only exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param conn: The urllib3 connection object associated with the cert. + :param url: The requested URL. + :param verify: Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use + :param cert: The SSL certificate to verify. + """ + if url.lower().startswith("https") and verify: + + cert_loc = None + + # Allow self-specified cert location. + if verify is not True: + cert_loc = verify + + if not cert_loc: + cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH) + + if not cert_loc or not os.path.exists(cert_loc): + raise OSError( + f"Could not find a suitable TLS CA certificate bundle, " + f"invalid path: {cert_loc}" + ) + + conn.cert_reqs = "CERT_REQUIRED" + + if not os.path.isdir(cert_loc): + conn.ca_certs = cert_loc + else: + conn.ca_cert_dir = cert_loc + else: + conn.cert_reqs = "CERT_NONE" + conn.ca_certs = None + conn.ca_cert_dir = None + + if cert: + if not isinstance(cert, basestring): + conn.cert_file = cert[0] + conn.key_file = cert[1] + else: + conn.cert_file = cert + conn.key_file = None + if conn.cert_file and not os.path.exists(conn.cert_file): + raise OSError( + f"Could not find the TLS certificate file, " + f"invalid path: {conn.cert_file}" + ) + if conn.key_file and not os.path.exists(conn.key_file): + raise OSError( + f"Could not find the TLS key file, invalid path: {conn.key_file}" + ) + + def build_response(self, req, resp): + """Builds a :class:`Response ` object from a urllib3 + response. This should not be called from user code, and is only exposed + for use when subclassing the + :class:`HTTPAdapter ` + + :param req: The :class:`PreparedRequest ` used to generate the response. + :param resp: The urllib3 response object. + :rtype: requests.Response + """ + response = Response() + + # Fallback to None if there's no status_code, for whatever reason. + response.status_code = getattr(resp, "status", None) + + # Make headers case-insensitive. + response.headers = CaseInsensitiveDict(getattr(resp, "headers", {})) + + # Set encoding. + response.encoding = get_encoding_from_headers(response.headers) + response.raw = resp + response.reason = response.raw.reason + + if isinstance(req.url, bytes): + response.url = req.url.decode("utf-8") + else: + response.url = req.url + + # Add new cookies from the server. + extract_cookies_to_jar(response.cookies, req, resp) + + # Give the Response some context. + response.request = req + response.connection = self + + return response + + def get_connection(self, url, proxies=None): + """Returns a urllib3 connection for the given URL. This should not be + called from user code, and is only exposed for use when subclassing the + :class:`HTTPAdapter `. + + :param url: The URL to connect to. + :param proxies: (optional) A Requests-style dictionary of proxies used on this request. + :rtype: urllib3.ConnectionPool + """ + proxy = select_proxy(url, proxies) + + if proxy: + proxy = prepend_scheme_if_needed(proxy, "http") + proxy_url = parse_url(proxy) + if not proxy_url.host: + raise InvalidProxyURL( + "Please check proxy URL. It is malformed " + "and could be missing the host." + ) + proxy_manager = self.proxy_manager_for(proxy) + conn = proxy_manager.connection_from_url(url) + else: + # Only scheme should be lower case + parsed = urlparse(url) + url = parsed.geturl() + conn = self.poolmanager.connection_from_url(url) + + return conn + + def close(self): + """Disposes of any internal state. + + Currently, this closes the PoolManager and any active ProxyManager, + which closes any pooled connections. + """ + self.poolmanager.clear() + for proxy in self.proxy_manager.values(): + proxy.clear() + + def request_url(self, request, proxies): + """Obtain the url to use when making the final request. + + If the message is being sent through a HTTP proxy, the full URL has to + be used. Otherwise, we should only use the path portion of the URL. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param request: The :class:`PreparedRequest ` being sent. + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. + :rtype: str + """ + proxy = select_proxy(request.url, proxies) + scheme = urlparse(request.url).scheme + + is_proxied_http_request = proxy and scheme != "https" + using_socks_proxy = False + if proxy: + proxy_scheme = urlparse(proxy).scheme.lower() + using_socks_proxy = proxy_scheme.startswith("socks") + + url = request.path_url + if is_proxied_http_request and not using_socks_proxy: + url = urldefragauth(request.url) + + return url + + def add_headers(self, request, **kwargs): + """Add any headers needed by the connection. As of v2.0 this does + nothing by default, but is left for overriding by users that subclass + the :class:`HTTPAdapter `. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param request: The :class:`PreparedRequest ` to add headers to. + :param kwargs: The keyword arguments from the call to send(). + """ + pass + + def proxy_headers(self, proxy): + """Returns a dictionary of the headers to add to any request sent + through a proxy. This works with urllib3 magic to ensure that they are + correctly sent to the proxy, rather than in a tunnelled request if + CONNECT is being used. + + This should not be called from user code, and is only exposed for use + when subclassing the + :class:`HTTPAdapter `. + + :param proxy: The url of the proxy being used for this request. + :rtype: dict + """ + headers = {} + username, password = get_auth_from_url(proxy) + + if username: + headers["Proxy-Authorization"] = _basic_auth_str(username, password) + + return headers + + def send( + self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None + ): + """Sends PreparedRequest object. Returns Response object. + + :param request: The :class:`PreparedRequest ` being sent. + :param stream: (optional) Whether to stream the request content. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple or urllib3 Timeout object + :param verify: (optional) Either a boolean, in which case it controls whether + we verify the server's TLS certificate, or a string, in which case it + must be a path to a CA bundle to use + :param cert: (optional) Any user-provided SSL certificate to be trusted. + :param proxies: (optional) The proxies dictionary to apply to the request. + :rtype: requests.Response + """ + + try: + conn = self.get_connection(request.url, proxies) + except LocationValueError as e: + raise InvalidURL(e, request=request) + + self.cert_verify(conn, request.url, verify, cert) + url = self.request_url(request, proxies) + self.add_headers( + request, + stream=stream, + timeout=timeout, + verify=verify, + cert=cert, + proxies=proxies, + ) + + chunked = not (request.body is None or "Content-Length" in request.headers) + + if isinstance(timeout, tuple): + try: + connect, read = timeout + timeout = TimeoutSauce(connect=connect, read=read) + except ValueError: + raise ValueError( + f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " + f"or a single float to set both timeouts to the same value." + ) + elif isinstance(timeout, TimeoutSauce): + pass + else: + timeout = TimeoutSauce(connect=timeout, read=timeout) + + try: + resp = conn.urlopen( + method=request.method, + url=url, + body=request.body, + headers=request.headers, + redirect=False, + assert_same_host=False, + preload_content=False, + decode_content=False, + retries=self.max_retries, + timeout=timeout, + chunked=chunked, + ) + + except (ProtocolError, OSError) as err: + raise ConnectionError(err, request=request) + + except MaxRetryError as e: + if isinstance(e.reason, ConnectTimeoutError): + # TODO: Remove this in 3.0.0: see #2811 + if not isinstance(e.reason, NewConnectionError): + raise ConnectTimeout(e, request=request) + + if isinstance(e.reason, ResponseError): + raise RetryError(e, request=request) + + if isinstance(e.reason, _ProxyError): + raise ProxyError(e, request=request) + + if isinstance(e.reason, _SSLError): + # This branch is for urllib3 v1.22 and later. + raise SSLError(e, request=request) + + raise ConnectionError(e, request=request) + + except ClosedPoolError as e: + raise ConnectionError(e, request=request) + + except _ProxyError as e: + raise ProxyError(e) + + except (_SSLError, _HTTPError) as e: + if isinstance(e, _SSLError): + # This branch is for urllib3 versions earlier than v1.22 + raise SSLError(e, request=request) + elif isinstance(e, ReadTimeoutError): + raise ReadTimeout(e, request=request) + elif isinstance(e, _InvalidHeader): + raise InvalidHeader(e, request=request) + else: + raise + + return self.build_response(request, resp) diff --git a/requests/python/requests/api.py b/requests/python/requests/api.py new file mode 100644 index 0000000..cd0b3ee --- /dev/null +++ b/requests/python/requests/api.py @@ -0,0 +1,157 @@ +""" +requests.api +~~~~~~~~~~~~ + +This module implements the Requests API. + +:copyright: (c) 2012 by Kenneth Reitz. +:license: Apache2, see LICENSE for more details. +""" + +from . import sessions + + +def request(method, url, **kwargs): + """Constructs and sends a :class:`Request `. + + :param method: method for the new :class:`Request` object: ``GET``, ``OPTIONS``, ``HEAD``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the query string for the :class:`Request`. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. + :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. + :param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload. + ``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')`` + or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string + defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers + to add for the file. + :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. + :param timeout: (optional) How many seconds to wait for the server to send data + before giving up, as a float, or a :ref:`(connect timeout, read + timeout) ` tuple. + :type timeout: float or tuple + :param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``. + :type allow_redirects: bool + :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy. + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use. Defaults to ``True``. + :param stream: (optional) if ``False``, the response content will be immediately downloaded. + :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. + :return: :class:`Response ` object + :rtype: requests.Response + + Usage:: + + >>> import requests + >>> req = requests.request('GET', 'https://httpbin.org/get') + >>> req + + """ + + # By using the 'with' statement we are sure the session is closed, thus we + # avoid leaving sockets open which can trigger a ResourceWarning in some + # cases, and look like a memory leak in others. + with sessions.Session() as session: + return session.request(method=method, url=url, **kwargs) + + +def get(url, params=None, **kwargs): + r"""Sends a GET request. + + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary, list of tuples or bytes to send + in the query string for the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("get", url, params=params, **kwargs) + + +def options(url, **kwargs): + r"""Sends an OPTIONS request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("options", url, **kwargs) + + +def head(url, **kwargs): + r"""Sends a HEAD request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. If + `allow_redirects` is not provided, it will be set to `False` (as + opposed to the default :meth:`request` behavior). + :return: :class:`Response ` object + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", False) + return request("head", url, **kwargs) + + +def post(url, data=None, json=None, **kwargs): + r"""Sends a POST request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("post", url, data=data, json=json, **kwargs) + + +def put(url, data=None, **kwargs): + r"""Sends a PUT request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("put", url, data=data, **kwargs) + + +def patch(url, data=None, **kwargs): + r"""Sends a PATCH request. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) A JSON serializable Python object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("patch", url, data=data, **kwargs) + + +def delete(url, **kwargs): + r"""Sends a DELETE request. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :return: :class:`Response ` object + :rtype: requests.Response + """ + + return request("delete", url, **kwargs) diff --git a/requests/python/requests/auth.py b/requests/python/requests/auth.py new file mode 100644 index 0000000..9733686 --- /dev/null +++ b/requests/python/requests/auth.py @@ -0,0 +1,315 @@ +""" +requests.auth +~~~~~~~~~~~~~ + +This module contains the authentication handlers for Requests. +""" + +import hashlib +import os +import re +import threading +import time +import warnings +from base64 import b64encode + +from ._internal_utils import to_native_string +from .compat import basestring, str, urlparse +from .cookies import extract_cookies_to_jar +from .utils import parse_dict_header + +CONTENT_TYPE_FORM_URLENCODED = "application/x-www-form-urlencoded" +CONTENT_TYPE_MULTI_PART = "multipart/form-data" + + +def _basic_auth_str(username, password): + """Returns a Basic Auth string.""" + + # "I want us to put a big-ol' comment on top of it that + # says that this behaviour is dumb but we need to preserve + # it because people are relying on it." + # - Lukasa + # + # These are here solely to maintain backwards compatibility + # for things like ints. This will be removed in 3.0.0. + if not isinstance(username, basestring): + warnings.warn( + "Non-string usernames will no longer be supported in Requests " + "3.0.0. Please convert the object you've passed in ({!r}) to " + "a string or bytes object in the near future to avoid " + "problems.".format(username), + category=DeprecationWarning, + ) + username = str(username) + + if not isinstance(password, basestring): + warnings.warn( + "Non-string passwords will no longer be supported in Requests " + "3.0.0. Please convert the object you've passed in ({!r}) to " + "a string or bytes object in the near future to avoid " + "problems.".format(type(password)), + category=DeprecationWarning, + ) + password = str(password) + # -- End Removal -- + + if isinstance(username, str): + username = username.encode("latin1") + + if isinstance(password, str): + password = password.encode("latin1") + + authstr = "Basic " + to_native_string( + b64encode(b":".join((username, password))).strip() + ) + + return authstr + + +class AuthBase: + """Base class that all auth implementations derive from""" + + def __call__(self, r): + raise NotImplementedError("Auth hooks must be callable.") + + +class HTTPBasicAuth(AuthBase): + """Attaches HTTP Basic Authentication to the given Request object.""" + + def __init__(self, username, password): + self.username = username + self.password = password + + def __eq__(self, other): + return all( + [ + self.username == getattr(other, "username", None), + self.password == getattr(other, "password", None), + ] + ) + + def __ne__(self, other): + return not self == other + + def __call__(self, r): + r.headers["Authorization"] = _basic_auth_str(self.username, self.password) + return r + + +class HTTPProxyAuth(HTTPBasicAuth): + """Attaches HTTP Proxy Authentication to a given Request object.""" + + def __call__(self, r): + r.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) + return r + + +class HTTPDigestAuth(AuthBase): + """Attaches HTTP Digest Authentication to the given Request object.""" + + def __init__(self, username, password): + self.username = username + self.password = password + # Keep state in per-thread local storage + self._thread_local = threading.local() + + def init_per_thread_state(self): + # Ensure state is initialized just once per-thread + if not hasattr(self._thread_local, "init"): + self._thread_local.init = True + self._thread_local.last_nonce = "" + self._thread_local.nonce_count = 0 + self._thread_local.chal = {} + self._thread_local.pos = None + self._thread_local.num_401_calls = None + + def build_digest_header(self, method, url): + """ + :rtype: str + """ + + realm = self._thread_local.chal["realm"] + nonce = self._thread_local.chal["nonce"] + qop = self._thread_local.chal.get("qop") + algorithm = self._thread_local.chal.get("algorithm") + opaque = self._thread_local.chal.get("opaque") + hash_utf8 = None + + if algorithm is None: + _algorithm = "MD5" + else: + _algorithm = algorithm.upper() + # lambdas assume digest modules are imported at the top level + if _algorithm == "MD5" or _algorithm == "MD5-SESS": + + def md5_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.md5(x).hexdigest() + + hash_utf8 = md5_utf8 + elif _algorithm == "SHA": + + def sha_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha1(x).hexdigest() + + hash_utf8 = sha_utf8 + elif _algorithm == "SHA-256": + + def sha256_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha256(x).hexdigest() + + hash_utf8 = sha256_utf8 + elif _algorithm == "SHA-512": + + def sha512_utf8(x): + if isinstance(x, str): + x = x.encode("utf-8") + return hashlib.sha512(x).hexdigest() + + hash_utf8 = sha512_utf8 + + KD = lambda s, d: hash_utf8(f"{s}:{d}") # noqa:E731 + + if hash_utf8 is None: + return None + + # XXX not implemented yet + entdig = None + p_parsed = urlparse(url) + #: path is request-uri defined in RFC 2616 which should not be empty + path = p_parsed.path or "/" + if p_parsed.query: + path += f"?{p_parsed.query}" + + A1 = f"{self.username}:{realm}:{self.password}" + A2 = f"{method}:{path}" + + HA1 = hash_utf8(A1) + HA2 = hash_utf8(A2) + + if nonce == self._thread_local.last_nonce: + self._thread_local.nonce_count += 1 + else: + self._thread_local.nonce_count = 1 + ncvalue = f"{self._thread_local.nonce_count:08x}" + s = str(self._thread_local.nonce_count).encode("utf-8") + s += nonce.encode("utf-8") + s += time.ctime().encode("utf-8") + s += os.urandom(8) + + cnonce = hashlib.sha1(s).hexdigest()[:16] + if _algorithm == "MD5-SESS": + HA1 = hash_utf8(f"{HA1}:{nonce}:{cnonce}") + + if not qop: + respdig = KD(HA1, f"{nonce}:{HA2}") + elif qop == "auth" or "auth" in qop.split(","): + noncebit = f"{nonce}:{ncvalue}:{cnonce}:auth:{HA2}" + respdig = KD(HA1, noncebit) + else: + # XXX handle auth-int. + return None + + self._thread_local.last_nonce = nonce + + # XXX should the partial digests be encoded too? + base = ( + f'username="{self.username}", realm="{realm}", nonce="{nonce}", ' + f'uri="{path}", response="{respdig}"' + ) + if opaque: + base += f', opaque="{opaque}"' + if algorithm: + base += f', algorithm="{algorithm}"' + if entdig: + base += f', digest="{entdig}"' + if qop: + base += f', qop="auth", nc={ncvalue}, cnonce="{cnonce}"' + + return f"Digest {base}" + + def handle_redirect(self, r, **kwargs): + """Reset num_401_calls counter on redirects.""" + if r.is_redirect: + self._thread_local.num_401_calls = 1 + + def handle_401(self, r, **kwargs): + """ + Takes the given response and tries digest-auth, if needed. + + :rtype: requests.Response + """ + + # If response is not 4xx, do not auth + # See https://github.com/psf/requests/issues/3772 + if not 400 <= r.status_code < 500: + self._thread_local.num_401_calls = 1 + return r + + if self._thread_local.pos is not None: + # Rewind the file position indicator of the body to where + # it was to resend the request. + r.request.body.seek(self._thread_local.pos) + s_auth = r.headers.get("www-authenticate", "") + + if "digest" in s_auth.lower() and self._thread_local.num_401_calls < 2: + + self._thread_local.num_401_calls += 1 + pat = re.compile(r"digest ", flags=re.IGNORECASE) + self._thread_local.chal = parse_dict_header(pat.sub("", s_auth, count=1)) + + # Consume content and release the original connection + # to allow our new request to reuse the same one. + r.content + r.close() + prep = r.request.copy() + extract_cookies_to_jar(prep._cookies, r.request, r.raw) + prep.prepare_cookies(prep._cookies) + + prep.headers["Authorization"] = self.build_digest_header( + prep.method, prep.url + ) + _r = r.connection.send(prep, **kwargs) + _r.history.append(r) + _r.request = prep + + return _r + + self._thread_local.num_401_calls = 1 + return r + + def __call__(self, r): + # Initialize per-thread state, if needed + self.init_per_thread_state() + # If we have a saved nonce, skip the 401 + if self._thread_local.last_nonce: + r.headers["Authorization"] = self.build_digest_header(r.method, r.url) + try: + self._thread_local.pos = r.body.tell() + except AttributeError: + # In the case of HTTPDigestAuth being reused and the body of + # the previous request was a file-like object, pos has the + # file position of the previous body. Ensure it's set to + # None. + self._thread_local.pos = None + r.register_hook("response", self.handle_401) + r.register_hook("response", self.handle_redirect) + self._thread_local.num_401_calls = 1 + + return r + + def __eq__(self, other): + return all( + [ + self.username == getattr(other, "username", None), + self.password == getattr(other, "password", None), + ] + ) + + def __ne__(self, other): + return not self == other diff --git a/requests/python/requests/certs.py b/requests/python/requests/certs.py new file mode 100644 index 0000000..be422c3 --- /dev/null +++ b/requests/python/requests/certs.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +""" +requests.certs +~~~~~~~~~~~~~~ + +This module returns the preferred default CA certificate bundle. There is +only one — the one from the certifi package. + +If you are packaging Requests, e.g., for a Linux distribution or a managed +environment, you can change the definition of where() to return a separately +packaged CA bundle. +""" +from certifi import where + +if __name__ == "__main__": + print(where()) diff --git a/requests/python/requests/compat.py b/requests/python/requests/compat.py new file mode 100644 index 0000000..6776163 --- /dev/null +++ b/requests/python/requests/compat.py @@ -0,0 +1,79 @@ +""" +requests.compat +~~~~~~~~~~~~~~~ + +This module previously handled import compatibility issues +between Python 2 and Python 3. It remains for backwards +compatibility until the next major version. +""" + +try: + import chardet +except ImportError: + import charset_normalizer as chardet + +import sys + +# ------- +# Pythons +# ------- + +# Syntax sugar. +_ver = sys.version_info + +#: Python 2.x? +is_py2 = _ver[0] == 2 + +#: Python 3.x? +is_py3 = _ver[0] == 3 + +# json/simplejson module import resolution +has_simplejson = False +try: + import simplejson as json + + has_simplejson = True +except ImportError: + import json + +if has_simplejson: + from simplejson import JSONDecodeError +else: + from json import JSONDecodeError + +# Keep OrderedDict for backwards compatibility. +from collections import OrderedDict +from collections.abc import Callable, Mapping, MutableMapping +from http import cookiejar as cookielib +from http.cookies import Morsel +from io import StringIO + +# -------------- +# Legacy Imports +# -------------- +from urllib.parse import ( + quote, + quote_plus, + unquote, + unquote_plus, + urldefrag, + urlencode, + urljoin, + urlparse, + urlsplit, + urlunparse, +) +from urllib.request import ( + getproxies, + getproxies_environment, + parse_http_list, + proxy_bypass, + proxy_bypass_environment, +) + +builtin_str = str +str = str +bytes = bytes +basestring = (str, bytes) +numeric_types = (int, float) +integer_types = (int,) diff --git a/requests/python/requests/cookies.py b/requests/python/requests/cookies.py new file mode 100644 index 0000000..bf54ab2 --- /dev/null +++ b/requests/python/requests/cookies.py @@ -0,0 +1,561 @@ +""" +requests.cookies +~~~~~~~~~~~~~~~~ + +Compatibility code to be able to use `cookielib.CookieJar` with requests. + +requests.utils imports from here, so be careful with imports. +""" + +import calendar +import copy +import time + +from ._internal_utils import to_native_string +from .compat import Morsel, MutableMapping, cookielib, urlparse, urlunparse + +try: + import threading +except ImportError: + import dummy_threading as threading + + +class MockRequest: + """Wraps a `requests.Request` to mimic a `urllib2.Request`. + + The code in `cookielib.CookieJar` expects this interface in order to correctly + manage cookie policies, i.e., determine whether a cookie can be set, given the + domains of the request and the cookie. + + The original request object is read-only. The client is responsible for collecting + the new headers via `get_new_headers()` and interpreting them appropriately. You + probably want `get_cookie_header`, defined below. + """ + + def __init__(self, request): + self._r = request + self._new_headers = {} + self.type = urlparse(self._r.url).scheme + + def get_type(self): + return self.type + + def get_host(self): + return urlparse(self._r.url).netloc + + def get_origin_req_host(self): + return self.get_host() + + def get_full_url(self): + # Only return the response's URL if the user hadn't set the Host + # header + if not self._r.headers.get("Host"): + return self._r.url + # If they did set it, retrieve it and reconstruct the expected domain + host = to_native_string(self._r.headers["Host"], encoding="utf-8") + parsed = urlparse(self._r.url) + # Reconstruct the URL as we expect it + return urlunparse( + [ + parsed.scheme, + host, + parsed.path, + parsed.params, + parsed.query, + parsed.fragment, + ] + ) + + def is_unverifiable(self): + return True + + def has_header(self, name): + return name in self._r.headers or name in self._new_headers + + def get_header(self, name, default=None): + return self._r.headers.get(name, self._new_headers.get(name, default)) + + def add_header(self, key, val): + """cookielib has no legitimate use for this method; add it back if you find one.""" + raise NotImplementedError( + "Cookie headers should be added with add_unredirected_header()" + ) + + def add_unredirected_header(self, name, value): + self._new_headers[name] = value + + def get_new_headers(self): + return self._new_headers + + @property + def unverifiable(self): + return self.is_unverifiable() + + @property + def origin_req_host(self): + return self.get_origin_req_host() + + @property + def host(self): + return self.get_host() + + +class MockResponse: + """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. + + ...what? Basically, expose the parsed HTTP headers from the server response + the way `cookielib` expects to see them. + """ + + def __init__(self, headers): + """Make a MockResponse for `cookielib` to read. + + :param headers: a httplib.HTTPMessage or analogous carrying the headers + """ + self._headers = headers + + def info(self): + return self._headers + + def getheaders(self, name): + self._headers.getheaders(name) + + +def extract_cookies_to_jar(jar, request, response): + """Extract the cookies from the response into a CookieJar. + + :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar) + :param request: our own requests.Request object + :param response: urllib3.HTTPResponse object + """ + if not (hasattr(response, "_original_response") and response._original_response): + return + # the _original_response field is the wrapped httplib.HTTPResponse object, + req = MockRequest(request) + # pull out the HTTPMessage with the headers and put it in the mock: + res = MockResponse(response._original_response.msg) + jar.extract_cookies(res, req) + + +def get_cookie_header(jar, request): + """ + Produce an appropriate Cookie header string to be sent with `request`, or None. + + :rtype: str + """ + r = MockRequest(request) + jar.add_cookie_header(r) + return r.get_new_headers().get("Cookie") + + +def remove_cookie_by_name(cookiejar, name, domain=None, path=None): + """Unsets a cookie by name, by default over all domains and paths. + + Wraps CookieJar.clear(), is O(n). + """ + clearables = [] + for cookie in cookiejar: + if cookie.name != name: + continue + if domain is not None and domain != cookie.domain: + continue + if path is not None and path != cookie.path: + continue + clearables.append((cookie.domain, cookie.path, cookie.name)) + + for domain, path, name in clearables: + cookiejar.clear(domain, path, name) + + +class CookieConflictError(RuntimeError): + """There are two cookies that meet the criteria specified in the cookie jar. + Use .get and .set and include domain and path args in order to be more specific. + """ + + +class RequestsCookieJar(cookielib.CookieJar, MutableMapping): + """Compatibility class; is a cookielib.CookieJar, but exposes a dict + interface. + + This is the CookieJar we create by default for requests and sessions that + don't specify one, since some clients may expect response.cookies and + session.cookies to support dict operations. + + Requests does not use the dict interface internally; it's just for + compatibility with external client code. All requests code should work + out of the box with externally provided instances of ``CookieJar``, e.g. + ``LWPCookieJar`` and ``FileCookieJar``. + + Unlike a regular CookieJar, this class is pickleable. + + .. warning:: dictionary operations that are normally O(1) may be O(n). + """ + + def get(self, name, default=None, domain=None, path=None): + """Dict-like get() that also supports optional domain and path args in + order to resolve naming collisions from using one cookie jar over + multiple domains. + + .. warning:: operation is O(n), not O(1). + """ + try: + return self._find_no_duplicates(name, domain, path) + except KeyError: + return default + + def set(self, name, value, **kwargs): + """Dict-like set() that also supports optional domain and path args in + order to resolve naming collisions from using one cookie jar over + multiple domains. + """ + # support client code that unsets cookies by assignment of a None value: + if value is None: + remove_cookie_by_name( + self, name, domain=kwargs.get("domain"), path=kwargs.get("path") + ) + return + + if isinstance(value, Morsel): + c = morsel_to_cookie(value) + else: + c = create_cookie(name, value, **kwargs) + self.set_cookie(c) + return c + + def iterkeys(self): + """Dict-like iterkeys() that returns an iterator of names of cookies + from the jar. + + .. seealso:: itervalues() and iteritems(). + """ + for cookie in iter(self): + yield cookie.name + + def keys(self): + """Dict-like keys() that returns a list of names of cookies from the + jar. + + .. seealso:: values() and items(). + """ + return list(self.iterkeys()) + + def itervalues(self): + """Dict-like itervalues() that returns an iterator of values of cookies + from the jar. + + .. seealso:: iterkeys() and iteritems(). + """ + for cookie in iter(self): + yield cookie.value + + def values(self): + """Dict-like values() that returns a list of values of cookies from the + jar. + + .. seealso:: keys() and items(). + """ + return list(self.itervalues()) + + def iteritems(self): + """Dict-like iteritems() that returns an iterator of name-value tuples + from the jar. + + .. seealso:: iterkeys() and itervalues(). + """ + for cookie in iter(self): + yield cookie.name, cookie.value + + def items(self): + """Dict-like items() that returns a list of name-value tuples from the + jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a + vanilla python dict of key value pairs. + + .. seealso:: keys() and values(). + """ + return list(self.iteritems()) + + def list_domains(self): + """Utility method to list all the domains in the jar.""" + domains = [] + for cookie in iter(self): + if cookie.domain not in domains: + domains.append(cookie.domain) + return domains + + def list_paths(self): + """Utility method to list all the paths in the jar.""" + paths = [] + for cookie in iter(self): + if cookie.path not in paths: + paths.append(cookie.path) + return paths + + def multiple_domains(self): + """Returns True if there are multiple domains in the jar. + Returns False otherwise. + + :rtype: bool + """ + domains = [] + for cookie in iter(self): + if cookie.domain is not None and cookie.domain in domains: + return True + domains.append(cookie.domain) + return False # there is only one domain in jar + + def get_dict(self, domain=None, path=None): + """Takes as an argument an optional domain and path and returns a plain + old Python dict of name-value pairs of cookies that meet the + requirements. + + :rtype: dict + """ + dictionary = {} + for cookie in iter(self): + if (domain is None or cookie.domain == domain) and ( + path is None or cookie.path == path + ): + dictionary[cookie.name] = cookie.value + return dictionary + + def __contains__(self, name): + try: + return super().__contains__(name) + except CookieConflictError: + return True + + def __getitem__(self, name): + """Dict-like __getitem__() for compatibility with client code. Throws + exception if there are more than one cookie with name. In that case, + use the more explicit get() method instead. + + .. warning:: operation is O(n), not O(1). + """ + return self._find_no_duplicates(name) + + def __setitem__(self, name, value): + """Dict-like __setitem__ for compatibility with client code. Throws + exception if there is already a cookie of that name in the jar. In that + case, use the more explicit set() method instead. + """ + self.set(name, value) + + def __delitem__(self, name): + """Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s + ``remove_cookie_by_name()``. + """ + remove_cookie_by_name(self, name) + + def set_cookie(self, cookie, *args, **kwargs): + if ( + hasattr(cookie.value, "startswith") + and cookie.value.startswith('"') + and cookie.value.endswith('"') + ): + cookie.value = cookie.value.replace('\\"', "") + return super().set_cookie(cookie, *args, **kwargs) + + def update(self, other): + """Updates this jar with cookies from another CookieJar or dict-like""" + if isinstance(other, cookielib.CookieJar): + for cookie in other: + self.set_cookie(copy.copy(cookie)) + else: + super().update(other) + + def _find(self, name, domain=None, path=None): + """Requests uses this method internally to get cookie values. + + If there are conflicting cookies, _find arbitrarily chooses one. + See _find_no_duplicates if you want an exception thrown if there are + conflicting cookies. + + :param name: a string containing name of cookie + :param domain: (optional) string containing domain of cookie + :param path: (optional) string containing path of cookie + :return: cookie.value + """ + for cookie in iter(self): + if cookie.name == name: + if domain is None or cookie.domain == domain: + if path is None or cookie.path == path: + return cookie.value + + raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") + + def _find_no_duplicates(self, name, domain=None, path=None): + """Both ``__get_item__`` and ``get`` call this function: it's never + used elsewhere in Requests. + + :param name: a string containing name of cookie + :param domain: (optional) string containing domain of cookie + :param path: (optional) string containing path of cookie + :raises KeyError: if cookie is not found + :raises CookieConflictError: if there are multiple cookies + that match name and optionally domain and path + :return: cookie.value + """ + toReturn = None + for cookie in iter(self): + if cookie.name == name: + if domain is None or cookie.domain == domain: + if path is None or cookie.path == path: + if toReturn is not None: + # if there are multiple cookies that meet passed in criteria + raise CookieConflictError( + f"There are multiple cookies with name, {name!r}" + ) + # we will eventually return this as long as no cookie conflict + toReturn = cookie.value + + if toReturn: + return toReturn + raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}") + + def __getstate__(self): + """Unlike a normal CookieJar, this class is pickleable.""" + state = self.__dict__.copy() + # remove the unpickleable RLock object + state.pop("_cookies_lock") + return state + + def __setstate__(self, state): + """Unlike a normal CookieJar, this class is pickleable.""" + self.__dict__.update(state) + if "_cookies_lock" not in self.__dict__: + self._cookies_lock = threading.RLock() + + def copy(self): + """Return a copy of this RequestsCookieJar.""" + new_cj = RequestsCookieJar() + new_cj.set_policy(self.get_policy()) + new_cj.update(self) + return new_cj + + def get_policy(self): + """Return the CookiePolicy instance used.""" + return self._policy + + +def _copy_cookie_jar(jar): + if jar is None: + return None + + if hasattr(jar, "copy"): + # We're dealing with an instance of RequestsCookieJar + return jar.copy() + # We're dealing with a generic CookieJar instance + new_jar = copy.copy(jar) + new_jar.clear() + for cookie in jar: + new_jar.set_cookie(copy.copy(cookie)) + return new_jar + + +def create_cookie(name, value, **kwargs): + """Make a cookie from underspecified parameters. + + By default, the pair of `name` and `value` will be set for the domain '' + and sent on every request (this is sometimes called a "supercookie"). + """ + result = { + "version": 0, + "name": name, + "value": value, + "port": None, + "domain": "", + "path": "/", + "secure": False, + "expires": None, + "discard": True, + "comment": None, + "comment_url": None, + "rest": {"HttpOnly": None}, + "rfc2109": False, + } + + badargs = set(kwargs) - set(result) + if badargs: + raise TypeError( + f"create_cookie() got unexpected keyword arguments: {list(badargs)}" + ) + + result.update(kwargs) + result["port_specified"] = bool(result["port"]) + result["domain_specified"] = bool(result["domain"]) + result["domain_initial_dot"] = result["domain"].startswith(".") + result["path_specified"] = bool(result["path"]) + + return cookielib.Cookie(**result) + + +def morsel_to_cookie(morsel): + """Convert a Morsel object into a Cookie containing the one k/v pair.""" + + expires = None + if morsel["max-age"]: + try: + expires = int(time.time() + int(morsel["max-age"])) + except ValueError: + raise TypeError(f"max-age: {morsel['max-age']} must be integer") + elif morsel["expires"]: + time_template = "%a, %d-%b-%Y %H:%M:%S GMT" + expires = calendar.timegm(time.strptime(morsel["expires"], time_template)) + return create_cookie( + comment=morsel["comment"], + comment_url=bool(morsel["comment"]), + discard=False, + domain=morsel["domain"], + expires=expires, + name=morsel.key, + path=morsel["path"], + port=None, + rest={"HttpOnly": morsel["httponly"]}, + rfc2109=False, + secure=bool(morsel["secure"]), + value=morsel.value, + version=morsel["version"] or 0, + ) + + +def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): + """Returns a CookieJar from a key/value dictionary. + + :param cookie_dict: Dict of key/values to insert into CookieJar. + :param cookiejar: (optional) A cookiejar to add the cookies to. + :param overwrite: (optional) If False, will not replace cookies + already in the jar with new ones. + :rtype: CookieJar + """ + if cookiejar is None: + cookiejar = RequestsCookieJar() + + if cookie_dict is not None: + names_from_jar = [cookie.name for cookie in cookiejar] + for name in cookie_dict: + if overwrite or (name not in names_from_jar): + cookiejar.set_cookie(create_cookie(name, cookie_dict[name])) + + return cookiejar + + +def merge_cookies(cookiejar, cookies): + """Add cookies to cookiejar and returns a merged CookieJar. + + :param cookiejar: CookieJar object to add the cookies to. + :param cookies: Dictionary or CookieJar object to be added. + :rtype: CookieJar + """ + if not isinstance(cookiejar, cookielib.CookieJar): + raise ValueError("You can only merge into CookieJar") + + if isinstance(cookies, dict): + cookiejar = cookiejar_from_dict(cookies, cookiejar=cookiejar, overwrite=False) + elif isinstance(cookies, cookielib.CookieJar): + try: + cookiejar.update(cookies) + except AttributeError: + for cookie_in_jar in cookies: + cookiejar.set_cookie(cookie_in_jar) + + return cookiejar diff --git a/requests/python/requests/exceptions.py b/requests/python/requests/exceptions.py new file mode 100644 index 0000000..e1cedf8 --- /dev/null +++ b/requests/python/requests/exceptions.py @@ -0,0 +1,141 @@ +""" +requests.exceptions +~~~~~~~~~~~~~~~~~~~ + +This module contains the set of Requests' exceptions. +""" +from urllib3.exceptions import HTTPError as BaseHTTPError + +from .compat import JSONDecodeError as CompatJSONDecodeError + + +class RequestException(IOError): + """There was an ambiguous exception that occurred while handling your + request. + """ + + def __init__(self, *args, **kwargs): + """Initialize RequestException with `request` and `response` objects.""" + response = kwargs.pop("response", None) + self.response = response + self.request = kwargs.pop("request", None) + if response is not None and not self.request and hasattr(response, "request"): + self.request = self.response.request + super().__init__(*args, **kwargs) + + +class InvalidJSONError(RequestException): + """A JSON error occurred.""" + + +class JSONDecodeError(InvalidJSONError, CompatJSONDecodeError): + """Couldn't decode the text into json""" + + def __init__(self, *args, **kwargs): + """ + Construct the JSONDecodeError instance first with all + args. Then use it's args to construct the IOError so that + the json specific args aren't used as IOError specific args + and the error message from JSONDecodeError is preserved. + """ + CompatJSONDecodeError.__init__(self, *args) + InvalidJSONError.__init__(self, *self.args, **kwargs) + + +class HTTPError(RequestException): + """An HTTP error occurred.""" + + +class ConnectionError(RequestException): + """A Connection error occurred.""" + + +class ProxyError(ConnectionError): + """A proxy error occurred.""" + + +class SSLError(ConnectionError): + """An SSL error occurred.""" + + +class Timeout(RequestException): + """The request timed out. + + Catching this error will catch both + :exc:`~requests.exceptions.ConnectTimeout` and + :exc:`~requests.exceptions.ReadTimeout` errors. + """ + + +class ConnectTimeout(ConnectionError, Timeout): + """The request timed out while trying to connect to the remote server. + + Requests that produced this error are safe to retry. + """ + + +class ReadTimeout(Timeout): + """The server did not send any data in the allotted amount of time.""" + + +class URLRequired(RequestException): + """A valid URL is required to make a request.""" + + +class TooManyRedirects(RequestException): + """Too many redirects.""" + + +class MissingSchema(RequestException, ValueError): + """The URL scheme (e.g. http or https) is missing.""" + + +class InvalidSchema(RequestException, ValueError): + """The URL scheme provided is either invalid or unsupported.""" + + +class InvalidURL(RequestException, ValueError): + """The URL provided was somehow invalid.""" + + +class InvalidHeader(RequestException, ValueError): + """The header value provided was somehow invalid.""" + + +class InvalidProxyURL(InvalidURL): + """The proxy URL provided is invalid.""" + + +class ChunkedEncodingError(RequestException): + """The server declared chunked encoding but sent an invalid chunk.""" + + +class ContentDecodingError(RequestException, BaseHTTPError): + """Failed to decode response content.""" + + +class StreamConsumedError(RequestException, TypeError): + """The content for this response was already consumed.""" + + +class RetryError(RequestException): + """Custom retries logic failed""" + + +class UnrewindableBodyError(RequestException): + """Requests encountered an error when trying to rewind a body.""" + + +# Warnings + + +class RequestsWarning(Warning): + """Base warning for Requests.""" + + +class FileModeWarning(RequestsWarning, DeprecationWarning): + """A file was opened in text mode, but Requests determined its binary length.""" + + +class RequestsDependencyWarning(RequestsWarning): + """An imported dependency doesn't match the expected version range.""" diff --git a/requests/python/requests/help.py b/requests/python/requests/help.py new file mode 100644 index 0000000..8fbcd65 --- /dev/null +++ b/requests/python/requests/help.py @@ -0,0 +1,134 @@ +"""Module containing bug report helper(s).""" + +import json +import platform +import ssl +import sys + +import idna +import urllib3 + +from . import __version__ as requests_version + +try: + import charset_normalizer +except ImportError: + charset_normalizer = None + +try: + import chardet +except ImportError: + chardet = None + +try: + from urllib3.contrib import pyopenssl +except ImportError: + pyopenssl = None + OpenSSL = None + cryptography = None +else: + import cryptography + import OpenSSL + + +def _implementation(): + """Return a dict with the Python implementation and version. + + Provide both the name and the version of the Python implementation + currently running. For example, on CPython 3.10.3 it will return + {'name': 'CPython', 'version': '3.10.3'}. + + This function works best on CPython and PyPy: in particular, it probably + doesn't work for Jython or IronPython. Future investigation should be done + to work out the correct shape of the code for those platforms. + """ + implementation = platform.python_implementation() + + if implementation == "CPython": + implementation_version = platform.python_version() + elif implementation == "PyPy": + implementation_version = "{}.{}.{}".format( + sys.pypy_version_info.major, + sys.pypy_version_info.minor, + sys.pypy_version_info.micro, + ) + if sys.pypy_version_info.releaselevel != "final": + implementation_version = "".join( + [implementation_version, sys.pypy_version_info.releaselevel] + ) + elif implementation == "Jython": + implementation_version = platform.python_version() # Complete Guess + elif implementation == "IronPython": + implementation_version = platform.python_version() # Complete Guess + else: + implementation_version = "Unknown" + + return {"name": implementation, "version": implementation_version} + + +def info(): + """Generate information for a bug report.""" + try: + platform_info = { + "system": platform.system(), + "release": platform.release(), + } + except OSError: + platform_info = { + "system": "Unknown", + "release": "Unknown", + } + + implementation_info = _implementation() + urllib3_info = {"version": urllib3.__version__} + charset_normalizer_info = {"version": None} + chardet_info = {"version": None} + if charset_normalizer: + charset_normalizer_info = {"version": charset_normalizer.__version__} + if chardet: + chardet_info = {"version": chardet.__version__} + + pyopenssl_info = { + "version": None, + "openssl_version": "", + } + if OpenSSL: + pyopenssl_info = { + "version": OpenSSL.__version__, + "openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}", + } + cryptography_info = { + "version": getattr(cryptography, "__version__", ""), + } + idna_info = { + "version": getattr(idna, "__version__", ""), + } + + system_ssl = ssl.OPENSSL_VERSION_NUMBER + system_ssl_info = {"version": f"{system_ssl:x}" if system_ssl is not None else ""} + + return { + "platform": platform_info, + "implementation": implementation_info, + "system_ssl": system_ssl_info, + "using_pyopenssl": pyopenssl is not None, + "using_charset_normalizer": chardet is None, + "pyOpenSSL": pyopenssl_info, + "urllib3": urllib3_info, + "chardet": chardet_info, + "charset_normalizer": charset_normalizer_info, + "cryptography": cryptography_info, + "idna": idna_info, + "requests": { + "version": requests_version, + }, + } + + +def main(): + """Pretty-print the bug information as JSON.""" + print(json.dumps(info(), sort_keys=True, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/requests/python/requests/hooks.py b/requests/python/requests/hooks.py new file mode 100644 index 0000000..d181ba2 --- /dev/null +++ b/requests/python/requests/hooks.py @@ -0,0 +1,33 @@ +""" +requests.hooks +~~~~~~~~~~~~~~ + +This module provides the capabilities for the Requests hooks system. + +Available hooks: + +``response``: + The response generated from a Request. +""" +HOOKS = ["response"] + + +def default_hooks(): + return {event: [] for event in HOOKS} + + +# TODO: response is the only one + + +def dispatch_hook(key, hooks, hook_data, **kwargs): + """Dispatches a hook dictionary on a given piece of data.""" + hooks = hooks or {} + hooks = hooks.get(key) + if hooks: + if hasattr(hooks, "__call__"): + hooks = [hooks] + for hook in hooks: + _hook_data = hook(hook_data, **kwargs) + if _hook_data is not None: + hook_data = _hook_data + return hook_data diff --git a/requests/python/requests/models.py b/requests/python/requests/models.py new file mode 100644 index 0000000..617a413 --- /dev/null +++ b/requests/python/requests/models.py @@ -0,0 +1,1034 @@ +""" +requests.models +~~~~~~~~~~~~~~~ + +This module contains the primary objects that power Requests. +""" + +import datetime + +# Import encoding now, to avoid implicit import later. +# Implicit import within threads may cause LookupError when standard library is in a ZIP, +# such as in Embedded Python. See https://github.com/psf/requests/issues/3578. +import encodings.idna # noqa: F401 +from io import UnsupportedOperation + +from urllib3.exceptions import ( + DecodeError, + LocationParseError, + ProtocolError, + ReadTimeoutError, + SSLError, +) +from urllib3.fields import RequestField +from urllib3.filepost import encode_multipart_formdata +from urllib3.util import parse_url + +from ._internal_utils import to_native_string, unicode_is_ascii +from .auth import HTTPBasicAuth +from .compat import ( + Callable, + JSONDecodeError, + Mapping, + basestring, + builtin_str, + chardet, + cookielib, +) +from .compat import json as complexjson +from .compat import urlencode, urlsplit, urlunparse +from .cookies import _copy_cookie_jar, cookiejar_from_dict, get_cookie_header +from .exceptions import ( + ChunkedEncodingError, + ConnectionError, + ContentDecodingError, + HTTPError, + InvalidJSONError, + InvalidURL, +) +from .exceptions import JSONDecodeError as RequestsJSONDecodeError +from .exceptions import MissingSchema +from .exceptions import SSLError as RequestsSSLError +from .exceptions import StreamConsumedError +from .hooks import default_hooks +from .status_codes import codes +from .structures import CaseInsensitiveDict +from .utils import ( + check_header_validity, + get_auth_from_url, + guess_filename, + guess_json_utf, + iter_slices, + parse_header_links, + requote_uri, + stream_decode_response_unicode, + super_len, + to_key_val_list, +) + +#: The set of HTTP status codes that indicate an automatically +#: processable redirect. +REDIRECT_STATI = ( + codes.moved, # 301 + codes.found, # 302 + codes.other, # 303 + codes.temporary_redirect, # 307 + codes.permanent_redirect, # 308 +) + +DEFAULT_REDIRECT_LIMIT = 30 +CONTENT_CHUNK_SIZE = 10 * 1024 +ITER_CHUNK_SIZE = 512 + + +class RequestEncodingMixin: + @property + def path_url(self): + """Build the path URL to use.""" + + url = [] + + p = urlsplit(self.url) + + path = p.path + if not path: + path = "/" + + url.append(path) + + query = p.query + if query: + url.append("?") + url.append(query) + + return "".join(url) + + @staticmethod + def _encode_params(data): + """Encode parameters in a piece of data. + + Will successfully encode parameters when passed as a dict or a list of + 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary + if parameters are supplied as a dict. + """ + + if isinstance(data, (str, bytes)): + return data + elif hasattr(data, "read"): + return data + elif hasattr(data, "__iter__"): + result = [] + for k, vs in to_key_val_list(data): + if isinstance(vs, basestring) or not hasattr(vs, "__iter__"): + vs = [vs] + for v in vs: + if v is not None: + result.append( + ( + k.encode("utf-8") if isinstance(k, str) else k, + v.encode("utf-8") if isinstance(v, str) else v, + ) + ) + return urlencode(result, doseq=True) + else: + return data + + @staticmethod + def _encode_files(files, data): + """Build the body for a multipart/form-data request. + + Will successfully encode files when passed as a dict or a list of + tuples. Order is retained if data is a list of tuples but arbitrary + if parameters are supplied as a dict. + The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) + or 4-tuples (filename, fileobj, contentype, custom_headers). + """ + if not files: + raise ValueError("Files must be provided.") + elif isinstance(data, basestring): + raise ValueError("Data must not be a string.") + + new_fields = [] + fields = to_key_val_list(data or {}) + files = to_key_val_list(files or {}) + + for field, val in fields: + if isinstance(val, basestring) or not hasattr(val, "__iter__"): + val = [val] + for v in val: + if v is not None: + # Don't call str() on bytestrings: in Py3 it all goes wrong. + if not isinstance(v, bytes): + v = str(v) + + new_fields.append( + ( + field.decode("utf-8") + if isinstance(field, bytes) + else field, + v.encode("utf-8") if isinstance(v, str) else v, + ) + ) + + for (k, v) in files: + # support for explicit filename + ft = None + fh = None + if isinstance(v, (tuple, list)): + if len(v) == 2: + fn, fp = v + elif len(v) == 3: + fn, fp, ft = v + else: + fn, fp, ft, fh = v + else: + fn = guess_filename(v) or k + fp = v + + if isinstance(fp, (str, bytes, bytearray)): + fdata = fp + elif hasattr(fp, "read"): + fdata = fp.read() + elif fp is None: + continue + else: + fdata = fp + + rf = RequestField(name=k, data=fdata, filename=fn, headers=fh) + rf.make_multipart(content_type=ft) + new_fields.append(rf) + + body, content_type = encode_multipart_formdata(new_fields) + + return body, content_type + + +class RequestHooksMixin: + def register_hook(self, event, hook): + """Properly register a hook.""" + + if event not in self.hooks: + raise ValueError(f'Unsupported event specified, with event name "{event}"') + + if isinstance(hook, Callable): + self.hooks[event].append(hook) + elif hasattr(hook, "__iter__"): + self.hooks[event].extend(h for h in hook if isinstance(h, Callable)) + + def deregister_hook(self, event, hook): + """Deregister a previously registered hook. + Returns True if the hook existed, False if not. + """ + + try: + self.hooks[event].remove(hook) + return True + except ValueError: + return False + + +class Request(RequestHooksMixin): + """A user-created :class:`Request ` object. + + Used to prepare a :class:`PreparedRequest `, which is sent to the server. + + :param method: HTTP method to use. + :param url: URL to send. + :param headers: dictionary of headers to send. + :param files: dictionary of {filename: fileobject} files to multipart upload. + :param data: the body to attach to the request. If a dictionary or + list of tuples ``[(key, value)]`` is provided, form-encoding will + take place. + :param json: json for the body to attach to the request (if files or data is not specified). + :param params: URL parameters to append to the URL. If a dictionary or + list of tuples ``[(key, value)]`` is provided, form-encoding will + take place. + :param auth: Auth handler or (user, pass) tuple. + :param cookies: dictionary or CookieJar of cookies to attach to this request. + :param hooks: dictionary of callback hooks, for internal usage. + + Usage:: + + >>> import requests + >>> req = requests.Request('GET', 'https://httpbin.org/get') + >>> req.prepare() + + """ + + def __init__( + self, + method=None, + url=None, + headers=None, + files=None, + data=None, + params=None, + auth=None, + cookies=None, + hooks=None, + json=None, + ): + + # Default empty dicts for dict params. + data = [] if data is None else data + files = [] if files is None else files + headers = {} if headers is None else headers + params = {} if params is None else params + hooks = {} if hooks is None else hooks + + self.hooks = default_hooks() + for (k, v) in list(hooks.items()): + self.register_hook(event=k, hook=v) + + self.method = method + self.url = url + self.headers = headers + self.files = files + self.data = data + self.json = json + self.params = params + self.auth = auth + self.cookies = cookies + + def __repr__(self): + return f"" + + def prepare(self): + """Constructs a :class:`PreparedRequest ` for transmission and returns it.""" + p = PreparedRequest() + p.prepare( + method=self.method, + url=self.url, + headers=self.headers, + files=self.files, + data=self.data, + json=self.json, + params=self.params, + auth=self.auth, + cookies=self.cookies, + hooks=self.hooks, + ) + return p + + +class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): + """The fully mutable :class:`PreparedRequest ` object, + containing the exact bytes that will be sent to the server. + + Instances are generated from a :class:`Request ` object, and + should not be instantiated manually; doing so may produce undesirable + effects. + + Usage:: + + >>> import requests + >>> req = requests.Request('GET', 'https://httpbin.org/get') + >>> r = req.prepare() + >>> r + + + >>> s = requests.Session() + >>> s.send(r) + + """ + + def __init__(self): + #: HTTP verb to send to the server. + self.method = None + #: HTTP URL to send the request to. + self.url = None + #: dictionary of HTTP headers. + self.headers = None + # The `CookieJar` used to create the Cookie header will be stored here + # after prepare_cookies is called + self._cookies = None + #: request body to send to the server. + self.body = None + #: dictionary of callback hooks, for internal usage. + self.hooks = default_hooks() + #: integer denoting starting position of a readable file-like body. + self._body_position = None + + def prepare( + self, + method=None, + url=None, + headers=None, + files=None, + data=None, + params=None, + auth=None, + cookies=None, + hooks=None, + json=None, + ): + """Prepares the entire request with the given parameters.""" + + self.prepare_method(method) + self.prepare_url(url, params) + self.prepare_headers(headers) + self.prepare_cookies(cookies) + self.prepare_body(data, files, json) + self.prepare_auth(auth, url) + + # Note that prepare_auth must be last to enable authentication schemes + # such as OAuth to work on a fully prepared request. + + # This MUST go after prepare_auth. Authenticators could add a hook + self.prepare_hooks(hooks) + + def __repr__(self): + return f"" + + def copy(self): + p = PreparedRequest() + p.method = self.method + p.url = self.url + p.headers = self.headers.copy() if self.headers is not None else None + p._cookies = _copy_cookie_jar(self._cookies) + p.body = self.body + p.hooks = self.hooks + p._body_position = self._body_position + return p + + def prepare_method(self, method): + """Prepares the given HTTP method.""" + self.method = method + if self.method is not None: + self.method = to_native_string(self.method.upper()) + + @staticmethod + def _get_idna_encoded_host(host): + import idna + + try: + host = idna.encode(host, uts46=True).decode("utf-8") + except idna.IDNAError: + raise UnicodeError + return host + + def prepare_url(self, url, params): + """Prepares the given HTTP URL.""" + #: Accept objects that have string representations. + #: We're unable to blindly call unicode/str functions + #: as this will include the bytestring indicator (b'') + #: on python 3.x. + #: https://github.com/psf/requests/pull/2238 + if isinstance(url, bytes): + url = url.decode("utf8") + else: + url = str(url) + + # Remove leading whitespaces from url + url = url.lstrip() + + # Don't do any URL preparation for non-HTTP schemes like `mailto`, + # `data` etc to work around exceptions from `url_parse`, which + # handles RFC 3986 only. + if ":" in url and not url.lower().startswith("http"): + self.url = url + return + + # Support for unicode domain names and paths. + try: + scheme, auth, host, port, path, query, fragment = parse_url(url) + except LocationParseError as e: + raise InvalidURL(*e.args) + + if not scheme: + raise MissingSchema( + f"Invalid URL {url!r}: No scheme supplied. " + f"Perhaps you meant https://{url}?" + ) + + if not host: + raise InvalidURL(f"Invalid URL {url!r}: No host supplied") + + # In general, we want to try IDNA encoding the hostname if the string contains + # non-ASCII characters. This allows users to automatically get the correct IDNA + # behaviour. For strings containing only ASCII characters, we need to also verify + # it doesn't start with a wildcard (*), before allowing the unencoded hostname. + if not unicode_is_ascii(host): + try: + host = self._get_idna_encoded_host(host) + except UnicodeError: + raise InvalidURL("URL has an invalid label.") + elif host.startswith(("*", ".")): + raise InvalidURL("URL has an invalid label.") + + # Carefully reconstruct the network location + netloc = auth or "" + if netloc: + netloc += "@" + netloc += host + if port: + netloc += f":{port}" + + # Bare domains aren't valid URLs. + if not path: + path = "/" + + if isinstance(params, (str, bytes)): + params = to_native_string(params) + + enc_params = self._encode_params(params) + if enc_params: + if query: + query = f"{query}&{enc_params}" + else: + query = enc_params + + url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment])) + self.url = url + + def prepare_headers(self, headers): + """Prepares the given HTTP headers.""" + + self.headers = CaseInsensitiveDict() + if headers: + for header in headers.items(): + # Raise exception on invalid header value. + check_header_validity(header) + name, value = header + self.headers[to_native_string(name)] = value + + def prepare_body(self, data, files, json=None): + """Prepares the given HTTP body data.""" + + # Check if file, fo, generator, iterator. + # If not, run through normal process. + + # Nottin' on you. + body = None + content_type = None + + if not data and json is not None: + # urllib3 requires a bytes-like body. Python 2's json.dumps + # provides this natively, but Python 3 gives a Unicode string. + content_type = "application/json" + + try: + body = complexjson.dumps(json, allow_nan=False) + except ValueError as ve: + raise InvalidJSONError(ve, request=self) + + if not isinstance(body, bytes): + body = body.encode("utf-8") + + is_stream = all( + [ + hasattr(data, "__iter__"), + not isinstance(data, (basestring, list, tuple, Mapping)), + ] + ) + + if is_stream: + try: + length = super_len(data) + except (TypeError, AttributeError, UnsupportedOperation): + length = None + + body = data + + if getattr(body, "tell", None) is not None: + # Record the current file position before reading. + # This will allow us to rewind a file in the event + # of a redirect. + try: + self._body_position = body.tell() + except OSError: + # This differentiates from None, allowing us to catch + # a failed `tell()` later when trying to rewind the body + self._body_position = object() + + if files: + raise NotImplementedError( + "Streamed bodies and files are mutually exclusive." + ) + + if length: + self.headers["Content-Length"] = builtin_str(length) + else: + self.headers["Transfer-Encoding"] = "chunked" + else: + # Multi-part file uploads. + if files: + (body, content_type) = self._encode_files(files, data) + else: + if data: + body = self._encode_params(data) + if isinstance(data, basestring) or hasattr(data, "read"): + content_type = None + else: + content_type = "application/x-www-form-urlencoded" + + self.prepare_content_length(body) + + # Add content-type if it wasn't explicitly provided. + if content_type and ("content-type" not in self.headers): + self.headers["Content-Type"] = content_type + + self.body = body + + def prepare_content_length(self, body): + """Prepare Content-Length header based on request method and body""" + if body is not None: + length = super_len(body) + if length: + # If length exists, set it. Otherwise, we fallback + # to Transfer-Encoding: chunked. + self.headers["Content-Length"] = builtin_str(length) + elif ( + self.method not in ("GET", "HEAD") + and self.headers.get("Content-Length") is None + ): + # Set Content-Length to 0 for methods that can have a body + # but don't provide one. (i.e. not GET or HEAD) + self.headers["Content-Length"] = "0" + + def prepare_auth(self, auth, url=""): + """Prepares the given HTTP auth data.""" + + # If no Auth is explicitly provided, extract it from the URL first. + if auth is None: + url_auth = get_auth_from_url(self.url) + auth = url_auth if any(url_auth) else None + + if auth: + if isinstance(auth, tuple) and len(auth) == 2: + # special-case basic HTTP auth + auth = HTTPBasicAuth(*auth) + + # Allow auth to make its changes. + r = auth(self) + + # Update self to reflect the auth changes. + self.__dict__.update(r.__dict__) + + # Recompute Content-Length + self.prepare_content_length(self.body) + + def prepare_cookies(self, cookies): + """Prepares the given HTTP cookie data. + + This function eventually generates a ``Cookie`` header from the + given cookies using cookielib. Due to cookielib's design, the header + will not be regenerated if it already exists, meaning this function + can only be called once for the life of the + :class:`PreparedRequest ` object. Any subsequent calls + to ``prepare_cookies`` will have no actual effect, unless the "Cookie" + header is removed beforehand. + """ + if isinstance(cookies, cookielib.CookieJar): + self._cookies = cookies + else: + self._cookies = cookiejar_from_dict(cookies) + + cookie_header = get_cookie_header(self._cookies, self) + if cookie_header is not None: + self.headers["Cookie"] = cookie_header + + def prepare_hooks(self, hooks): + """Prepares the given hooks.""" + # hooks can be passed as None to the prepare method and to this + # method. To prevent iterating over None, simply use an empty list + # if hooks is False-y + hooks = hooks or [] + for event in hooks: + self.register_hook(event, hooks[event]) + + +class Response: + """The :class:`Response ` object, which contains a + server's response to an HTTP request. + """ + + __attrs__ = [ + "_content", + "status_code", + "headers", + "url", + "history", + "encoding", + "reason", + "cookies", + "elapsed", + "request", + ] + + def __init__(self): + self._content = False + self._content_consumed = False + self._next = None + + #: Integer Code of responded HTTP Status, e.g. 404 or 200. + self.status_code = None + + #: Case-insensitive Dictionary of Response Headers. + #: For example, ``headers['content-encoding']`` will return the + #: value of a ``'Content-Encoding'`` response header. + self.headers = CaseInsensitiveDict() + + #: File-like object representation of response (for advanced usage). + #: Use of ``raw`` requires that ``stream=True`` be set on the request. + #: This requirement does not apply for use internally to Requests. + self.raw = None + + #: Final URL location of Response. + self.url = None + + #: Encoding to decode with when accessing r.text. + self.encoding = None + + #: A list of :class:`Response ` objects from + #: the history of the Request. Any redirect responses will end + #: up here. The list is sorted from the oldest to the most recent request. + self.history = [] + + #: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK". + self.reason = None + + #: A CookieJar of Cookies the server sent back. + self.cookies = cookiejar_from_dict({}) + + #: The amount of time elapsed between sending the request + #: and the arrival of the response (as a timedelta). + #: This property specifically measures the time taken between sending + #: the first byte of the request and finishing parsing the headers. It + #: is therefore unaffected by consuming the response content or the + #: value of the ``stream`` keyword argument. + self.elapsed = datetime.timedelta(0) + + #: The :class:`PreparedRequest ` object to which this + #: is a response. + self.request = None + + def __enter__(self): + return self + + def __exit__(self, *args): + self.close() + + def __getstate__(self): + # Consume everything; accessing the content attribute makes + # sure the content has been fully read. + if not self._content_consumed: + self.content + + return {attr: getattr(self, attr, None) for attr in self.__attrs__} + + def __setstate__(self, state): + for name, value in state.items(): + setattr(self, name, value) + + # pickled objects do not have .raw + setattr(self, "_content_consumed", True) + setattr(self, "raw", None) + + def __repr__(self): + return f"" + + def __bool__(self): + """Returns True if :attr:`status_code` is less than 400. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code, is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + return self.ok + + def __nonzero__(self): + """Returns True if :attr:`status_code` is less than 400. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code, is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + return self.ok + + def __iter__(self): + """Allows you to use a response as an iterator.""" + return self.iter_content(128) + + @property + def ok(self): + """Returns True if :attr:`status_code` is less than 400, False if not. + + This attribute checks if the status code of the response is between + 400 and 600 to see if there was a client error or a server error. If + the status code is between 200 and 400, this will return True. This + is **not** a check to see if the response code is ``200 OK``. + """ + try: + self.raise_for_status() + except HTTPError: + return False + return True + + @property + def is_redirect(self): + """True if this Response is a well-formed HTTP redirect that could have + been processed automatically (by :meth:`Session.resolve_redirects`). + """ + return "location" in self.headers and self.status_code in REDIRECT_STATI + + @property + def is_permanent_redirect(self): + """True if this Response one of the permanent versions of redirect.""" + return "location" in self.headers and self.status_code in ( + codes.moved_permanently, + codes.permanent_redirect, + ) + + @property + def next(self): + """Returns a PreparedRequest for the next request in a redirect chain, if there is one.""" + return self._next + + @property + def apparent_encoding(self): + """The apparent encoding, provided by the charset_normalizer or chardet libraries.""" + return chardet.detect(self.content)["encoding"] + + def iter_content(self, chunk_size=1, decode_unicode=False): + """Iterates over the response data. When stream=True is set on the + request, this avoids reading the content at once into memory for + large responses. The chunk size is the number of bytes it should + read into memory. This is not necessarily the length of each item + returned as decoding can take place. + + chunk_size must be of type int or None. A value of None will + function differently depending on the value of `stream`. + stream=True will read data as it arrives in whatever size the + chunks are received. If stream=False, data is returned as + a single chunk. + + If decode_unicode is True, content will be decoded using the best + available encoding based on the response. + """ + + def generate(): + # Special case for urllib3. + if hasattr(self.raw, "stream"): + try: + yield from self.raw.stream(chunk_size, decode_content=True) + except ProtocolError as e: + raise ChunkedEncodingError(e) + except DecodeError as e: + raise ContentDecodingError(e) + except ReadTimeoutError as e: + raise ConnectionError(e) + except SSLError as e: + raise RequestsSSLError(e) + else: + # Standard file-like object. + while True: + chunk = self.raw.read(chunk_size) + if not chunk: + break + yield chunk + + self._content_consumed = True + + if self._content_consumed and isinstance(self._content, bool): + raise StreamConsumedError() + elif chunk_size is not None and not isinstance(chunk_size, int): + raise TypeError( + f"chunk_size must be an int, it is instead a {type(chunk_size)}." + ) + # simulate reading small chunks of the content + reused_chunks = iter_slices(self._content, chunk_size) + + stream_chunks = generate() + + chunks = reused_chunks if self._content_consumed else stream_chunks + + if decode_unicode: + chunks = stream_decode_response_unicode(chunks, self) + + return chunks + + def iter_lines( + self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=False, delimiter=None + ): + """Iterates over the response data, one line at a time. When + stream=True is set on the request, this avoids reading the + content at once into memory for large responses. + + .. note:: This method is not reentrant safe. + """ + + pending = None + + for chunk in self.iter_content( + chunk_size=chunk_size, decode_unicode=decode_unicode + ): + + if pending is not None: + chunk = pending + chunk + + if delimiter: + lines = chunk.split(delimiter) + else: + lines = chunk.splitlines() + + if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]: + pending = lines.pop() + else: + pending = None + + yield from lines + + if pending is not None: + yield pending + + @property + def content(self): + """Content of the response, in bytes.""" + + if self._content is False: + # Read the contents. + if self._content_consumed: + raise RuntimeError("The content for this response was already consumed") + + if self.status_code == 0 or self.raw is None: + self._content = None + else: + self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b"" + + self._content_consumed = True + # don't need to release the connection; that's been handled by urllib3 + # since we exhausted the data. + return self._content + + @property + def text(self): + """Content of the response, in unicode. + + If Response.encoding is None, encoding will be guessed using + ``charset_normalizer`` or ``chardet``. + + The encoding of the response content is determined based solely on HTTP + headers, following RFC 2616 to the letter. If you can take advantage of + non-HTTP knowledge to make a better guess at the encoding, you should + set ``r.encoding`` appropriately before accessing this property. + """ + + # Try charset from content-type + content = None + encoding = self.encoding + + if not self.content: + return "" + + # Fallback to auto-detected encoding. + if self.encoding is None: + encoding = self.apparent_encoding + + # Decode unicode from given encoding. + try: + content = str(self.content, encoding, errors="replace") + except (LookupError, TypeError): + # A LookupError is raised if the encoding was not found which could + # indicate a misspelling or similar mistake. + # + # A TypeError can be raised if encoding is None + # + # So we try blindly encoding. + content = str(self.content, errors="replace") + + return content + + def json(self, **kwargs): + r"""Returns the json-encoded content of a response, if any. + + :param \*\*kwargs: Optional arguments that ``json.loads`` takes. + :raises requests.exceptions.JSONDecodeError: If the response body does not + contain valid json. + """ + + if not self.encoding and self.content and len(self.content) > 3: + # No encoding set. JSON RFC 4627 section 3 states we should expect + # UTF-8, -16 or -32. Detect which one to use; If the detection or + # decoding fails, fall back to `self.text` (using charset_normalizer to make + # a best guess). + encoding = guess_json_utf(self.content) + if encoding is not None: + try: + return complexjson.loads(self.content.decode(encoding), **kwargs) + except UnicodeDecodeError: + # Wrong UTF codec detected; usually because it's not UTF-8 + # but some other 8-bit codec. This is an RFC violation, + # and the server didn't bother to tell us what codec *was* + # used. + pass + except JSONDecodeError as e: + raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) + + try: + return complexjson.loads(self.text, **kwargs) + except JSONDecodeError as e: + # Catch JSON-related errors and raise as requests.JSONDecodeError + # This aliases json.JSONDecodeError and simplejson.JSONDecodeError + raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) + + @property + def links(self): + """Returns the parsed header links of the response, if any.""" + + header = self.headers.get("link") + + resolved_links = {} + + if header: + links = parse_header_links(header) + + for link in links: + key = link.get("rel") or link.get("url") + resolved_links[key] = link + + return resolved_links + + def raise_for_status(self): + """Raises :class:`HTTPError`, if one occurred.""" + + http_error_msg = "" + if isinstance(self.reason, bytes): + # We attempt to decode utf-8 first because some servers + # choose to localize their reason strings. If the string + # isn't utf-8, we fall back to iso-8859-1 for all other + # encodings. (See PR #3538) + try: + reason = self.reason.decode("utf-8") + except UnicodeDecodeError: + reason = self.reason.decode("iso-8859-1") + else: + reason = self.reason + + if 400 <= self.status_code < 500: + http_error_msg = ( + f"{self.status_code} Client Error: {reason} for url: {self.url}" + ) + + elif 500 <= self.status_code < 600: + http_error_msg = ( + f"{self.status_code} Server Error: {reason} for url: {self.url}" + ) + + if http_error_msg: + raise HTTPError(http_error_msg, response=self) + + def close(self): + """Releases the connection back to the pool. Once this method has been + called the underlying ``raw`` object must not be accessed again. + + *Note: Should not normally need to be called explicitly.* + """ + if not self._content_consumed: + self.raw.close() + + release_conn = getattr(self.raw, "release_conn", None) + if release_conn is not None: + release_conn() diff --git a/requests/python/requests/packages.py b/requests/python/requests/packages.py new file mode 100644 index 0000000..77c45c9 --- /dev/null +++ b/requests/python/requests/packages.py @@ -0,0 +1,28 @@ +import sys + +try: + import chardet +except ImportError: + import warnings + + import charset_normalizer as chardet + + warnings.filterwarnings("ignore", "Trying to detect", module="charset_normalizer") + +# This code exists for backwards compatibility reasons. +# I don't like it either. Just look the other way. :) + +for package in ("urllib3", "idna"): + locals()[package] = __import__(package) + # This traversal is apparently necessary such that the identities are + # preserved (requests.packages.urllib3.* is urllib3.*) + for mod in list(sys.modules): + if mod == package or mod.startswith(f"{package}."): + sys.modules[f"requests.packages.{mod}"] = sys.modules[mod] + +target = chardet.__name__ +for mod in list(sys.modules): + if mod == target or mod.startswith(f"{target}."): + target = target.replace(target, "chardet") + sys.modules[f"requests.packages.{target}"] = sys.modules[mod] +# Kinda cool, though, right? diff --git a/requests/python/requests/sessions.py b/requests/python/requests/sessions.py new file mode 100644 index 0000000..dbcf2a7 --- /dev/null +++ b/requests/python/requests/sessions.py @@ -0,0 +1,833 @@ +""" +requests.sessions +~~~~~~~~~~~~~~~~~ + +This module provides a Session object to manage and persist settings across +requests (cookies, auth, proxies). +""" +import os +import sys +import time +from collections import OrderedDict +from datetime import timedelta + +from ._internal_utils import to_native_string +from .adapters import HTTPAdapter +from .auth import _basic_auth_str +from .compat import Mapping, cookielib, urljoin, urlparse +from .cookies import ( + RequestsCookieJar, + cookiejar_from_dict, + extract_cookies_to_jar, + merge_cookies, +) +from .exceptions import ( + ChunkedEncodingError, + ContentDecodingError, + InvalidSchema, + TooManyRedirects, +) +from .hooks import default_hooks, dispatch_hook + +# formerly defined here, reexposed here for backward compatibility +from .models import ( # noqa: F401 + DEFAULT_REDIRECT_LIMIT, + REDIRECT_STATI, + PreparedRequest, + Request, +) +from .status_codes import codes +from .structures import CaseInsensitiveDict +from .utils import ( # noqa: F401 + DEFAULT_PORTS, + default_headers, + get_auth_from_url, + get_environ_proxies, + get_netrc_auth, + requote_uri, + resolve_proxies, + rewind_body, + should_bypass_proxies, + to_key_val_list, +) + +# Preferred clock, based on which one is more accurate on a given system. +if sys.platform == "win32": + preferred_clock = time.perf_counter +else: + preferred_clock = time.time + + +def merge_setting(request_setting, session_setting, dict_class=OrderedDict): + """Determines appropriate setting for a given request, taking into account + the explicit setting on that request, and the setting in the session. If a + setting is a dictionary, they will be merged together using `dict_class` + """ + + if session_setting is None: + return request_setting + + if request_setting is None: + return session_setting + + # Bypass if not a dictionary (e.g. verify) + if not ( + isinstance(session_setting, Mapping) and isinstance(request_setting, Mapping) + ): + return request_setting + + merged_setting = dict_class(to_key_val_list(session_setting)) + merged_setting.update(to_key_val_list(request_setting)) + + # Remove keys that are set to None. Extract keys first to avoid altering + # the dictionary during iteration. + none_keys = [k for (k, v) in merged_setting.items() if v is None] + for key in none_keys: + del merged_setting[key] + + return merged_setting + + +def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict): + """Properly merges both requests and session hooks. + + This is necessary because when request_hooks == {'response': []}, the + merge breaks Session hooks entirely. + """ + if session_hooks is None or session_hooks.get("response") == []: + return request_hooks + + if request_hooks is None or request_hooks.get("response") == []: + return session_hooks + + return merge_setting(request_hooks, session_hooks, dict_class) + + +class SessionRedirectMixin: + def get_redirect_target(self, resp): + """Receives a Response. Returns a redirect URI or ``None``""" + # Due to the nature of how requests processes redirects this method will + # be called at least once upon the original response and at least twice + # on each subsequent redirect response (if any). + # If a custom mixin is used to handle this logic, it may be advantageous + # to cache the redirect location onto the response object as a private + # attribute. + if resp.is_redirect: + location = resp.headers["location"] + # Currently the underlying http module on py3 decode headers + # in latin1, but empirical evidence suggests that latin1 is very + # rarely used with non-ASCII characters in HTTP headers. + # It is more likely to get UTF8 header rather than latin1. + # This causes incorrect handling of UTF8 encoded location headers. + # To solve this, we re-encode the location in latin1. + location = location.encode("latin1") + return to_native_string(location, "utf8") + return None + + def should_strip_auth(self, old_url, new_url): + """Decide whether Authorization header should be removed when redirecting""" + old_parsed = urlparse(old_url) + new_parsed = urlparse(new_url) + if old_parsed.hostname != new_parsed.hostname: + return True + # Special case: allow http -> https redirect when using the standard + # ports. This isn't specified by RFC 7235, but is kept to avoid + # breaking backwards compatibility with older versions of requests + # that allowed any redirects on the same host. + if ( + old_parsed.scheme == "http" + and old_parsed.port in (80, None) + and new_parsed.scheme == "https" + and new_parsed.port in (443, None) + ): + return False + + # Handle default port usage corresponding to scheme. + changed_port = old_parsed.port != new_parsed.port + changed_scheme = old_parsed.scheme != new_parsed.scheme + default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None) + if ( + not changed_scheme + and old_parsed.port in default_port + and new_parsed.port in default_port + ): + return False + + # Standard case: root URI must match + return changed_port or changed_scheme + + def resolve_redirects( + self, + resp, + req, + stream=False, + timeout=None, + verify=True, + cert=None, + proxies=None, + yield_requests=False, + **adapter_kwargs, + ): + """Receives a Response. Returns a generator of Responses or Requests.""" + + hist = [] # keep track of history + + url = self.get_redirect_target(resp) + previous_fragment = urlparse(req.url).fragment + while url: + prepared_request = req.copy() + + # Update history and keep track of redirects. + # resp.history must ignore the original request in this loop + hist.append(resp) + resp.history = hist[1:] + + try: + resp.content # Consume socket so it can be released + except (ChunkedEncodingError, ContentDecodingError, RuntimeError): + resp.raw.read(decode_content=False) + + if len(resp.history) >= self.max_redirects: + raise TooManyRedirects( + f"Exceeded {self.max_redirects} redirects.", response=resp + ) + + # Release the connection back into the pool. + resp.close() + + # Handle redirection without scheme (see: RFC 1808 Section 4) + if url.startswith("//"): + parsed_rurl = urlparse(resp.url) + url = ":".join([to_native_string(parsed_rurl.scheme), url]) + + # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2) + parsed = urlparse(url) + if parsed.fragment == "" and previous_fragment: + parsed = parsed._replace(fragment=previous_fragment) + elif parsed.fragment: + previous_fragment = parsed.fragment + url = parsed.geturl() + + # Facilitate relative 'location' headers, as allowed by RFC 7231. + # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource') + # Compliant with RFC3986, we percent encode the url. + if not parsed.netloc: + url = urljoin(resp.url, requote_uri(url)) + else: + url = requote_uri(url) + + prepared_request.url = to_native_string(url) + + self.rebuild_method(prepared_request, resp) + + # https://github.com/psf/requests/issues/1084 + if resp.status_code not in ( + codes.temporary_redirect, + codes.permanent_redirect, + ): + # https://github.com/psf/requests/issues/3490 + purged_headers = ("Content-Length", "Content-Type", "Transfer-Encoding") + for header in purged_headers: + prepared_request.headers.pop(header, None) + prepared_request.body = None + + headers = prepared_request.headers + headers.pop("Cookie", None) + + # Extract any cookies sent on the response to the cookiejar + # in the new request. Because we've mutated our copied prepared + # request, use the old one that we haven't yet touched. + extract_cookies_to_jar(prepared_request._cookies, req, resp.raw) + merge_cookies(prepared_request._cookies, self.cookies) + prepared_request.prepare_cookies(prepared_request._cookies) + + # Rebuild auth and proxy information. + proxies = self.rebuild_proxies(prepared_request, proxies) + self.rebuild_auth(prepared_request, resp) + + # A failed tell() sets `_body_position` to `object()`. This non-None + # value ensures `rewindable` will be True, allowing us to raise an + # UnrewindableBodyError, instead of hanging the connection. + rewindable = prepared_request._body_position is not None and ( + "Content-Length" in headers or "Transfer-Encoding" in headers + ) + + # Attempt to rewind consumed file-like object. + if rewindable: + rewind_body(prepared_request) + + # Override the original request. + req = prepared_request + + if yield_requests: + yield req + else: + + resp = self.send( + req, + stream=stream, + timeout=timeout, + verify=verify, + cert=cert, + proxies=proxies, + allow_redirects=False, + **adapter_kwargs, + ) + + extract_cookies_to_jar(self.cookies, prepared_request, resp.raw) + + # extract redirect url, if any, for the next loop + url = self.get_redirect_target(resp) + yield resp + + def rebuild_auth(self, prepared_request, response): + """When being redirected we may want to strip authentication from the + request to avoid leaking credentials. This method intelligently removes + and reapplies authentication where possible to avoid credential loss. + """ + headers = prepared_request.headers + url = prepared_request.url + + if "Authorization" in headers and self.should_strip_auth( + response.request.url, url + ): + # If we get redirected to a new host, we should strip out any + # authentication headers. + del headers["Authorization"] + + # .netrc might have more auth for us on our new host. + new_auth = get_netrc_auth(url) if self.trust_env else None + if new_auth is not None: + prepared_request.prepare_auth(new_auth) + + def rebuild_proxies(self, prepared_request, proxies): + """This method re-evaluates the proxy configuration by considering the + environment variables. If we are redirected to a URL covered by + NO_PROXY, we strip the proxy configuration. Otherwise, we set missing + proxy keys for this URL (in case they were stripped by a previous + redirect). + + This method also replaces the Proxy-Authorization header where + necessary. + + :rtype: dict + """ + headers = prepared_request.headers + scheme = urlparse(prepared_request.url).scheme + new_proxies = resolve_proxies(prepared_request, proxies, self.trust_env) + + if "Proxy-Authorization" in headers: + del headers["Proxy-Authorization"] + + try: + username, password = get_auth_from_url(new_proxies[scheme]) + except KeyError: + username, password = None, None + + # urllib3 handles proxy authorization for us in the standard adapter. + # Avoid appending this to TLS tunneled requests where it may be leaked. + if not scheme.startswith('https') and username and password: + headers["Proxy-Authorization"] = _basic_auth_str(username, password) + + return new_proxies + + def rebuild_method(self, prepared_request, response): + """When being redirected we may want to change the method of the request + based on certain specs or browser behavior. + """ + method = prepared_request.method + + # https://tools.ietf.org/html/rfc7231#section-6.4.4 + if response.status_code == codes.see_other and method != "HEAD": + method = "GET" + + # Do what the browsers do, despite standards... + # First, turn 302s into GETs. + if response.status_code == codes.found and method != "HEAD": + method = "GET" + + # Second, if a POST is responded to with a 301, turn it into a GET. + # This bizarre behaviour is explained in Issue 1704. + if response.status_code == codes.moved and method == "POST": + method = "GET" + + prepared_request.method = method + + +class Session(SessionRedirectMixin): + """A Requests session. + + Provides cookie persistence, connection-pooling, and configuration. + + Basic Usage:: + + >>> import requests + >>> s = requests.Session() + >>> s.get('https://httpbin.org/get') + + + Or as a context manager:: + + >>> with requests.Session() as s: + ... s.get('https://httpbin.org/get') + + """ + + __attrs__ = [ + "headers", + "cookies", + "auth", + "proxies", + "hooks", + "params", + "verify", + "cert", + "adapters", + "stream", + "trust_env", + "max_redirects", + ] + + def __init__(self): + + #: A case-insensitive dictionary of headers to be sent on each + #: :class:`Request ` sent from this + #: :class:`Session `. + self.headers = default_headers() + + #: Default Authentication tuple or object to attach to + #: :class:`Request `. + self.auth = None + + #: Dictionary mapping protocol or protocol and host to the URL of the proxy + #: (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to + #: be used on each :class:`Request `. + self.proxies = {} + + #: Event-handling hooks. + self.hooks = default_hooks() + + #: Dictionary of querystring data to attach to each + #: :class:`Request `. The dictionary values may be lists for + #: representing multivalued query parameters. + self.params = {} + + #: Stream response content default. + self.stream = False + + #: SSL Verification default. + #: Defaults to `True`, requiring requests to verify the TLS certificate at the + #: remote end. + #: If verify is set to `False`, requests will accept any TLS certificate + #: presented by the server, and will ignore hostname mismatches and/or + #: expired certificates, which will make your application vulnerable to + #: man-in-the-middle (MitM) attacks. + #: Only set this to `False` for testing. + self.verify = True + + #: SSL client certificate default, if String, path to ssl client + #: cert file (.pem). If Tuple, ('cert', 'key') pair. + self.cert = None + + #: Maximum number of redirects allowed. If the request exceeds this + #: limit, a :class:`TooManyRedirects` exception is raised. + #: This defaults to requests.models.DEFAULT_REDIRECT_LIMIT, which is + #: 30. + self.max_redirects = DEFAULT_REDIRECT_LIMIT + + #: Trust environment settings for proxy configuration, default + #: authentication and similar. + self.trust_env = True + + #: A CookieJar containing all currently outstanding cookies set on this + #: session. By default it is a + #: :class:`RequestsCookieJar `, but + #: may be any other ``cookielib.CookieJar`` compatible object. + self.cookies = cookiejar_from_dict({}) + + # Default connection adapters. + self.adapters = OrderedDict() + self.mount("https://", HTTPAdapter()) + self.mount("http://", HTTPAdapter()) + + def __enter__(self): + return self + + def __exit__(self, *args): + self.close() + + def prepare_request(self, request): + """Constructs a :class:`PreparedRequest ` for + transmission and returns it. The :class:`PreparedRequest` has settings + merged from the :class:`Request ` instance and those of the + :class:`Session`. + + :param request: :class:`Request` instance to prepare with this + session's settings. + :rtype: requests.PreparedRequest + """ + cookies = request.cookies or {} + + # Bootstrap CookieJar. + if not isinstance(cookies, cookielib.CookieJar): + cookies = cookiejar_from_dict(cookies) + + # Merge with session cookies + merged_cookies = merge_cookies( + merge_cookies(RequestsCookieJar(), self.cookies), cookies + ) + + # Set environment's basic authentication if not explicitly set. + auth = request.auth + if self.trust_env and not auth and not self.auth: + auth = get_netrc_auth(request.url) + + p = PreparedRequest() + p.prepare( + method=request.method.upper(), + url=request.url, + files=request.files, + data=request.data, + json=request.json, + headers=merge_setting( + request.headers, self.headers, dict_class=CaseInsensitiveDict + ), + params=merge_setting(request.params, self.params), + auth=merge_setting(auth, self.auth), + cookies=merged_cookies, + hooks=merge_hooks(request.hooks, self.hooks), + ) + return p + + def request( + self, + method, + url, + params=None, + data=None, + headers=None, + cookies=None, + files=None, + auth=None, + timeout=None, + allow_redirects=True, + proxies=None, + hooks=None, + stream=None, + verify=None, + cert=None, + json=None, + ): + """Constructs a :class:`Request `, prepares it and sends it. + Returns :class:`Response ` object. + + :param method: method for the new :class:`Request` object. + :param url: URL for the new :class:`Request` object. + :param params: (optional) Dictionary or bytes to be sent in the query + string for the :class:`Request`. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) json to send in the body of the + :class:`Request`. + :param headers: (optional) Dictionary of HTTP Headers to send with the + :class:`Request`. + :param cookies: (optional) Dict or CookieJar object to send with the + :class:`Request`. + :param files: (optional) Dictionary of ``'filename': file-like-objects`` + for multipart encoding upload. + :param auth: (optional) Auth tuple or callable to enable + Basic/Digest/Custom HTTP Auth. + :param timeout: (optional) How long to wait for the server to send + data before giving up, as a float, or a :ref:`(connect timeout, + read timeout) ` tuple. + :type timeout: float or tuple + :param allow_redirects: (optional) Set to True by default. + :type allow_redirects: bool + :param proxies: (optional) Dictionary mapping protocol or protocol and + hostname to the URL of the proxy. + :param stream: (optional) whether to immediately download the response + content. Defaults to ``False``. + :param verify: (optional) Either a boolean, in which case it controls whether we verify + the server's TLS certificate, or a string, in which case it must be a path + to a CA bundle to use. Defaults to ``True``. When set to + ``False``, requests will accept any TLS certificate presented by + the server, and will ignore hostname mismatches and/or expired + certificates, which will make your application vulnerable to + man-in-the-middle (MitM) attacks. Setting verify to ``False`` + may be useful during local development or testing. + :param cert: (optional) if String, path to ssl client cert file (.pem). + If Tuple, ('cert', 'key') pair. + :rtype: requests.Response + """ + # Create the Request. + req = Request( + method=method.upper(), + url=url, + headers=headers, + files=files, + data=data or {}, + json=json, + params=params or {}, + auth=auth, + cookies=cookies, + hooks=hooks, + ) + prep = self.prepare_request(req) + + proxies = proxies or {} + + settings = self.merge_environment_settings( + prep.url, proxies, stream, verify, cert + ) + + # Send the request. + send_kwargs = { + "timeout": timeout, + "allow_redirects": allow_redirects, + } + send_kwargs.update(settings) + resp = self.send(prep, **send_kwargs) + + return resp + + def get(self, url, **kwargs): + r"""Sends a GET request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", True) + return self.request("GET", url, **kwargs) + + def options(self, url, **kwargs): + r"""Sends a OPTIONS request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", True) + return self.request("OPTIONS", url, **kwargs) + + def head(self, url, **kwargs): + r"""Sends a HEAD request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + kwargs.setdefault("allow_redirects", False) + return self.request("HEAD", url, **kwargs) + + def post(self, url, data=None, json=None, **kwargs): + r"""Sends a POST request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param json: (optional) json to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("POST", url, data=data, json=json, **kwargs) + + def put(self, url, data=None, **kwargs): + r"""Sends a PUT request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("PUT", url, data=data, **kwargs) + + def patch(self, url, data=None, **kwargs): + r"""Sends a PATCH request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param data: (optional) Dictionary, list of tuples, bytes, or file-like + object to send in the body of the :class:`Request`. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("PATCH", url, data=data, **kwargs) + + def delete(self, url, **kwargs): + r"""Sends a DELETE request. Returns :class:`Response` object. + + :param url: URL for the new :class:`Request` object. + :param \*\*kwargs: Optional arguments that ``request`` takes. + :rtype: requests.Response + """ + + return self.request("DELETE", url, **kwargs) + + def send(self, request, **kwargs): + """Send a given PreparedRequest. + + :rtype: requests.Response + """ + # Set defaults that the hooks can utilize to ensure they always have + # the correct parameters to reproduce the previous request. + kwargs.setdefault("stream", self.stream) + kwargs.setdefault("verify", self.verify) + kwargs.setdefault("cert", self.cert) + if "proxies" not in kwargs: + kwargs["proxies"] = resolve_proxies(request, self.proxies, self.trust_env) + + # It's possible that users might accidentally send a Request object. + # Guard against that specific failure case. + if isinstance(request, Request): + raise ValueError("You can only send PreparedRequests.") + + # Set up variables needed for resolve_redirects and dispatching of hooks + allow_redirects = kwargs.pop("allow_redirects", True) + stream = kwargs.get("stream") + hooks = request.hooks + + # Get the appropriate adapter to use + adapter = self.get_adapter(url=request.url) + + # Start time (approximately) of the request + start = preferred_clock() + + # Send the request + r = adapter.send(request, **kwargs) + + # Total elapsed time of the request (approximately) + elapsed = preferred_clock() - start + r.elapsed = timedelta(seconds=elapsed) + + # Response manipulation hooks + r = dispatch_hook("response", hooks, r, **kwargs) + + # Persist cookies + if r.history: + + # If the hooks create history then we want those cookies too + for resp in r.history: + extract_cookies_to_jar(self.cookies, resp.request, resp.raw) + + extract_cookies_to_jar(self.cookies, request, r.raw) + + # Resolve redirects if allowed. + if allow_redirects: + # Redirect resolving generator. + gen = self.resolve_redirects(r, request, **kwargs) + history = [resp for resp in gen] + else: + history = [] + + # Shuffle things around if there's history. + if history: + # Insert the first (original) request at the start + history.insert(0, r) + # Get the last request made + r = history.pop() + r.history = history + + # If redirects aren't being followed, store the response on the Request for Response.next(). + if not allow_redirects: + try: + r._next = next( + self.resolve_redirects(r, request, yield_requests=True, **kwargs) + ) + except StopIteration: + pass + + if not stream: + r.content + + return r + + def merge_environment_settings(self, url, proxies, stream, verify, cert): + """ + Check the environment and merge it with some settings. + + :rtype: dict + """ + # Gather clues from the surrounding environment. + if self.trust_env: + # Set environment's proxies. + no_proxy = proxies.get("no_proxy") if proxies is not None else None + env_proxies = get_environ_proxies(url, no_proxy=no_proxy) + for (k, v) in env_proxies.items(): + proxies.setdefault(k, v) + + # Look for requests environment configuration + # and be compatible with cURL. + if verify is True or verify is None: + verify = ( + os.environ.get("REQUESTS_CA_BUNDLE") + or os.environ.get("CURL_CA_BUNDLE") + or verify + ) + + # Merge all the kwargs. + proxies = merge_setting(proxies, self.proxies) + stream = merge_setting(stream, self.stream) + verify = merge_setting(verify, self.verify) + cert = merge_setting(cert, self.cert) + + return {"proxies": proxies, "stream": stream, "verify": verify, "cert": cert} + + def get_adapter(self, url): + """ + Returns the appropriate connection adapter for the given URL. + + :rtype: requests.adapters.BaseAdapter + """ + for (prefix, adapter) in self.adapters.items(): + + if url.lower().startswith(prefix.lower()): + return adapter + + # Nothing matches :-/ + raise InvalidSchema(f"No connection adapters were found for {url!r}") + + def close(self): + """Closes all adapters and as such the session""" + for v in self.adapters.values(): + v.close() + + def mount(self, prefix, adapter): + """Registers a connection adapter to a prefix. + + Adapters are sorted in descending order by prefix length. + """ + self.adapters[prefix] = adapter + keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] + + for key in keys_to_move: + self.adapters[key] = self.adapters.pop(key) + + def __getstate__(self): + state = {attr: getattr(self, attr, None) for attr in self.__attrs__} + return state + + def __setstate__(self, state): + for attr, value in state.items(): + setattr(self, attr, value) + + +def session(): + """ + Returns a :class:`Session` for context-management. + + .. deprecated:: 1.0.0 + + This method has been deprecated since version 1.0.0 and is only kept for + backwards compatibility. New code should use :class:`~requests.sessions.Session` + to create a session. This may be removed at a future date. + + :rtype: Session + """ + return Session() diff --git a/requests/python/requests/status_codes.py b/requests/python/requests/status_codes.py new file mode 100644 index 0000000..4bd072b --- /dev/null +++ b/requests/python/requests/status_codes.py @@ -0,0 +1,128 @@ +r""" +The ``codes`` object defines a mapping from common names for HTTP statuses +to their numerical codes, accessible either as attributes or as dictionary +items. + +Example:: + + >>> import requests + >>> requests.codes['temporary_redirect'] + 307 + >>> requests.codes.teapot + 418 + >>> requests.codes['\o/'] + 200 + +Some codes have multiple names, and both upper- and lower-case versions of +the names are allowed. For example, ``codes.ok``, ``codes.OK``, and +``codes.okay`` all correspond to the HTTP status code 200. +""" + +from .structures import LookupDict + +_codes = { + # Informational. + 100: ("continue",), + 101: ("switching_protocols",), + 102: ("processing",), + 103: ("checkpoint",), + 122: ("uri_too_long", "request_uri_too_long"), + 200: ("ok", "okay", "all_ok", "all_okay", "all_good", "\\o/", "✓"), + 201: ("created",), + 202: ("accepted",), + 203: ("non_authoritative_info", "non_authoritative_information"), + 204: ("no_content",), + 205: ("reset_content", "reset"), + 206: ("partial_content", "partial"), + 207: ("multi_status", "multiple_status", "multi_stati", "multiple_stati"), + 208: ("already_reported",), + 226: ("im_used",), + # Redirection. + 300: ("multiple_choices",), + 301: ("moved_permanently", "moved", "\\o-"), + 302: ("found",), + 303: ("see_other", "other"), + 304: ("not_modified",), + 305: ("use_proxy",), + 306: ("switch_proxy",), + 307: ("temporary_redirect", "temporary_moved", "temporary"), + 308: ( + "permanent_redirect", + "resume_incomplete", + "resume", + ), # "resume" and "resume_incomplete" to be removed in 3.0 + # Client Error. + 400: ("bad_request", "bad"), + 401: ("unauthorized",), + 402: ("payment_required", "payment"), + 403: ("forbidden",), + 404: ("not_found", "-o-"), + 405: ("method_not_allowed", "not_allowed"), + 406: ("not_acceptable",), + 407: ("proxy_authentication_required", "proxy_auth", "proxy_authentication"), + 408: ("request_timeout", "timeout"), + 409: ("conflict",), + 410: ("gone",), + 411: ("length_required",), + 412: ("precondition_failed", "precondition"), + 413: ("request_entity_too_large",), + 414: ("request_uri_too_large",), + 415: ("unsupported_media_type", "unsupported_media", "media_type"), + 416: ( + "requested_range_not_satisfiable", + "requested_range", + "range_not_satisfiable", + ), + 417: ("expectation_failed",), + 418: ("im_a_teapot", "teapot", "i_am_a_teapot"), + 421: ("misdirected_request",), + 422: ("unprocessable_entity", "unprocessable"), + 423: ("locked",), + 424: ("failed_dependency", "dependency"), + 425: ("unordered_collection", "unordered"), + 426: ("upgrade_required", "upgrade"), + 428: ("precondition_required", "precondition"), + 429: ("too_many_requests", "too_many"), + 431: ("header_fields_too_large", "fields_too_large"), + 444: ("no_response", "none"), + 449: ("retry_with", "retry"), + 450: ("blocked_by_windows_parental_controls", "parental_controls"), + 451: ("unavailable_for_legal_reasons", "legal_reasons"), + 499: ("client_closed_request",), + # Server Error. + 500: ("internal_server_error", "server_error", "/o\\", "✗"), + 501: ("not_implemented",), + 502: ("bad_gateway",), + 503: ("service_unavailable", "unavailable"), + 504: ("gateway_timeout",), + 505: ("http_version_not_supported", "http_version"), + 506: ("variant_also_negotiates",), + 507: ("insufficient_storage",), + 509: ("bandwidth_limit_exceeded", "bandwidth"), + 510: ("not_extended",), + 511: ("network_authentication_required", "network_auth", "network_authentication"), +} + +codes = LookupDict(name="status_codes") + + +def _init(): + for code, titles in _codes.items(): + for title in titles: + setattr(codes, title, code) + if not title.startswith(("\\", "/")): + setattr(codes, title.upper(), code) + + def doc(code): + names = ", ".join(f"``{n}``" for n in _codes[code]) + return "* %d: %s" % (code, names) + + global __doc__ + __doc__ = ( + __doc__ + "\n" + "\n".join(doc(code) for code in sorted(_codes)) + if __doc__ is not None + else None + ) + + +_init() diff --git a/requests/python/requests/structures.py b/requests/python/requests/structures.py new file mode 100644 index 0000000..188e13e --- /dev/null +++ b/requests/python/requests/structures.py @@ -0,0 +1,99 @@ +""" +requests.structures +~~~~~~~~~~~~~~~~~~~ + +Data structures that power Requests. +""" + +from collections import OrderedDict + +from .compat import Mapping, MutableMapping + + +class CaseInsensitiveDict(MutableMapping): + """A case-insensitive ``dict``-like object. + + Implements all methods and operations of + ``MutableMapping`` as well as dict's ``copy``. Also + provides ``lower_items``. + + All keys are expected to be strings. The structure remembers the + case of the last key to be set, and ``iter(instance)``, + ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` + will contain case-sensitive keys. However, querying and contains + testing is case insensitive:: + + cid = CaseInsensitiveDict() + cid['Accept'] = 'application/json' + cid['aCCEPT'] == 'application/json' # True + list(cid) == ['Accept'] # True + + For example, ``headers['content-encoding']`` will return the + value of a ``'Content-Encoding'`` response header, regardless + of how the header name was originally stored. + + If the constructor, ``.update``, or equality comparison + operations are given keys that have equal ``.lower()``s, the + behavior is undefined. + """ + + def __init__(self, data=None, **kwargs): + self._store = OrderedDict() + if data is None: + data = {} + self.update(data, **kwargs) + + def __setitem__(self, key, value): + # Use the lowercased key for lookups, but store the actual + # key alongside the value. + self._store[key.lower()] = (key, value) + + def __getitem__(self, key): + return self._store[key.lower()][1] + + def __delitem__(self, key): + del self._store[key.lower()] + + def __iter__(self): + return (casedkey for casedkey, mappedvalue in self._store.values()) + + def __len__(self): + return len(self._store) + + def lower_items(self): + """Like iteritems(), but with all lowercase keys.""" + return ((lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items()) + + def __eq__(self, other): + if isinstance(other, Mapping): + other = CaseInsensitiveDict(other) + else: + return NotImplemented + # Compare insensitively + return dict(self.lower_items()) == dict(other.lower_items()) + + # Copy is required + def copy(self): + return CaseInsensitiveDict(self._store.values()) + + def __repr__(self): + return str(dict(self.items())) + + +class LookupDict(dict): + """Dictionary lookup object.""" + + def __init__(self, name=None): + self.name = name + super().__init__() + + def __repr__(self): + return f"" + + def __getitem__(self, key): + # We allow fall-through here, so values default to None + + return self.__dict__.get(key, None) + + def get(self, key, default=None): + return self.__dict__.get(key, default) diff --git a/requests/python/requests/utils.py b/requests/python/requests/utils.py new file mode 100644 index 0000000..a367417 --- /dev/null +++ b/requests/python/requests/utils.py @@ -0,0 +1,1094 @@ +""" +requests.utils +~~~~~~~~~~~~~~ + +This module provides utility functions that are used within Requests +that are also useful for external consumption. +""" + +import codecs +import contextlib +import io +import os +import re +import socket +import struct +import sys +import tempfile +import warnings +import zipfile +from collections import OrderedDict + +from urllib3.util import make_headers, parse_url + +from . import certs +from .__version__ import __version__ + +# to_native_string is unused here, but imported here for backwards compatibility +from ._internal_utils import ( # noqa: F401 + _HEADER_VALIDATORS_BYTE, + _HEADER_VALIDATORS_STR, + HEADER_VALIDATORS, + to_native_string, +) +from .compat import ( + Mapping, + basestring, + bytes, + getproxies, + getproxies_environment, + integer_types, +) +from .compat import parse_http_list as _parse_list_header +from .compat import ( + proxy_bypass, + proxy_bypass_environment, + quote, + str, + unquote, + urlparse, + urlunparse, +) +from .cookies import cookiejar_from_dict +from .exceptions import ( + FileModeWarning, + InvalidHeader, + InvalidURL, + UnrewindableBodyError, +) +from .structures import CaseInsensitiveDict + +NETRC_FILES = (".netrc", "_netrc") + +DEFAULT_CA_BUNDLE_PATH = certs.where() + +DEFAULT_PORTS = {"http": 80, "https": 443} + +# Ensure that ', ' is used to preserve previous delimiter behavior. +DEFAULT_ACCEPT_ENCODING = ", ".join( + re.split(r",\s*", make_headers(accept_encoding=True)["accept-encoding"]) +) + + +if sys.platform == "win32": + # provide a proxy_bypass version on Windows without DNS lookups + + def proxy_bypass_registry(host): + try: + import winreg + except ImportError: + return False + + try: + internetSettings = winreg.OpenKey( + winreg.HKEY_CURRENT_USER, + r"Software\Microsoft\Windows\CurrentVersion\Internet Settings", + ) + # ProxyEnable could be REG_SZ or REG_DWORD, normalizing it + proxyEnable = int(winreg.QueryValueEx(internetSettings, "ProxyEnable")[0]) + # ProxyOverride is almost always a string + proxyOverride = winreg.QueryValueEx(internetSettings, "ProxyOverride")[0] + except (OSError, ValueError): + return False + if not proxyEnable or not proxyOverride: + return False + + # make a check value list from the registry entry: replace the + # '' string by the localhost entry and the corresponding + # canonical entry. + proxyOverride = proxyOverride.split(";") + # now check if we match one of the registry values. + for test in proxyOverride: + if test == "": + if "." not in host: + return True + test = test.replace(".", r"\.") # mask dots + test = test.replace("*", r".*") # change glob sequence + test = test.replace("?", r".") # change glob char + if re.match(test, host, re.I): + return True + return False + + def proxy_bypass(host): # noqa + """Return True, if the host should be bypassed. + + Checks proxy settings gathered from the environment, if specified, + or the registry. + """ + if getproxies_environment(): + return proxy_bypass_environment(host) + else: + return proxy_bypass_registry(host) + + +def dict_to_sequence(d): + """Returns an internal sequence dictionary update.""" + + if hasattr(d, "items"): + d = d.items() + + return d + + +def super_len(o): + total_length = None + current_position = 0 + + if hasattr(o, "__len__"): + total_length = len(o) + + elif hasattr(o, "len"): + total_length = o.len + + elif hasattr(o, "fileno"): + try: + fileno = o.fileno() + except (io.UnsupportedOperation, AttributeError): + # AttributeError is a surprising exception, seeing as how we've just checked + # that `hasattr(o, 'fileno')`. It happens for objects obtained via + # `Tarfile.extractfile()`, per issue 5229. + pass + else: + total_length = os.fstat(fileno).st_size + + # Having used fstat to determine the file length, we need to + # confirm that this file was opened up in binary mode. + if "b" not in o.mode: + warnings.warn( + ( + "Requests has determined the content-length for this " + "request using the binary size of the file: however, the " + "file has been opened in text mode (i.e. without the 'b' " + "flag in the mode). This may lead to an incorrect " + "content-length. In Requests 3.0, support will be removed " + "for files in text mode." + ), + FileModeWarning, + ) + + if hasattr(o, "tell"): + try: + current_position = o.tell() + except OSError: + # This can happen in some weird situations, such as when the file + # is actually a special file descriptor like stdin. In this + # instance, we don't know what the length is, so set it to zero and + # let requests chunk it instead. + if total_length is not None: + current_position = total_length + else: + if hasattr(o, "seek") and total_length is None: + # StringIO and BytesIO have seek but no usable fileno + try: + # seek to end of file + o.seek(0, 2) + total_length = o.tell() + + # seek back to current position to support + # partially read file-like objects + o.seek(current_position or 0) + except OSError: + total_length = 0 + + if total_length is None: + total_length = 0 + + return max(0, total_length - current_position) + + +def get_netrc_auth(url, raise_errors=False): + """Returns the Requests tuple auth for a given url from netrc.""" + + netrc_file = os.environ.get("NETRC") + if netrc_file is not None: + netrc_locations = (netrc_file,) + else: + netrc_locations = (f"~/{f}" for f in NETRC_FILES) + + try: + from netrc import NetrcParseError, netrc + + netrc_path = None + + for f in netrc_locations: + try: + loc = os.path.expanduser(f) + except KeyError: + # os.path.expanduser can fail when $HOME is undefined and + # getpwuid fails. See https://bugs.python.org/issue20164 & + # https://github.com/psf/requests/issues/1846 + return + + if os.path.exists(loc): + netrc_path = loc + break + + # Abort early if there isn't one. + if netrc_path is None: + return + + ri = urlparse(url) + + # Strip port numbers from netloc. This weird `if...encode`` dance is + # used for Python 3.2, which doesn't support unicode literals. + splitstr = b":" + if isinstance(url, str): + splitstr = splitstr.decode("ascii") + host = ri.netloc.split(splitstr)[0] + + try: + _netrc = netrc(netrc_path).authenticators(host) + if _netrc: + # Return with login / password + login_i = 0 if _netrc[0] else 1 + return (_netrc[login_i], _netrc[2]) + except (NetrcParseError, OSError): + # If there was a parsing error or a permissions issue reading the file, + # we'll just skip netrc auth unless explicitly asked to raise errors. + if raise_errors: + raise + + # App Engine hackiness. + except (ImportError, AttributeError): + pass + + +def guess_filename(obj): + """Tries to guess the filename of the given object.""" + name = getattr(obj, "name", None) + if name and isinstance(name, basestring) and name[0] != "<" and name[-1] != ">": + return os.path.basename(name) + + +def extract_zipped_paths(path): + """Replace nonexistent paths that look like they refer to a member of a zip + archive with the location of an extracted copy of the target, or else + just return the provided path unchanged. + """ + if os.path.exists(path): + # this is already a valid path, no need to do anything further + return path + + # find the first valid part of the provided path and treat that as a zip archive + # assume the rest of the path is the name of a member in the archive + archive, member = os.path.split(path) + while archive and not os.path.exists(archive): + archive, prefix = os.path.split(archive) + if not prefix: + # If we don't check for an empty prefix after the split (in other words, archive remains unchanged after the split), + # we _can_ end up in an infinite loop on a rare corner case affecting a small number of users + break + member = "/".join([prefix, member]) + + if not zipfile.is_zipfile(archive): + return path + + zip_file = zipfile.ZipFile(archive) + if member not in zip_file.namelist(): + return path + + # we have a valid zip archive and a valid member of that archive + tmp = tempfile.gettempdir() + extracted_path = os.path.join(tmp, member.split("/")[-1]) + if not os.path.exists(extracted_path): + # use read + write to avoid the creating nested folders, we only want the file, avoids mkdir racing condition + with atomic_open(extracted_path) as file_handler: + file_handler.write(zip_file.read(member)) + return extracted_path + + +@contextlib.contextmanager +def atomic_open(filename): + """Write a file to the disk in an atomic fashion""" + tmp_descriptor, tmp_name = tempfile.mkstemp(dir=os.path.dirname(filename)) + try: + with os.fdopen(tmp_descriptor, "wb") as tmp_handler: + yield tmp_handler + os.replace(tmp_name, filename) + except BaseException: + os.remove(tmp_name) + raise + + +def from_key_val_list(value): + """Take an object and test to see if it can be represented as a + dictionary. Unless it can not be represented as such, return an + OrderedDict, e.g., + + :: + + >>> from_key_val_list([('key', 'val')]) + OrderedDict([('key', 'val')]) + >>> from_key_val_list('string') + Traceback (most recent call last): + ... + ValueError: cannot encode objects that are not 2-tuples + >>> from_key_val_list({'key': 'val'}) + OrderedDict([('key', 'val')]) + + :rtype: OrderedDict + """ + if value is None: + return None + + if isinstance(value, (str, bytes, bool, int)): + raise ValueError("cannot encode objects that are not 2-tuples") + + return OrderedDict(value) + + +def to_key_val_list(value): + """Take an object and test to see if it can be represented as a + dictionary. If it can be, return a list of tuples, e.g., + + :: + + >>> to_key_val_list([('key', 'val')]) + [('key', 'val')] + >>> to_key_val_list({'key': 'val'}) + [('key', 'val')] + >>> to_key_val_list('string') + Traceback (most recent call last): + ... + ValueError: cannot encode objects that are not 2-tuples + + :rtype: list + """ + if value is None: + return None + + if isinstance(value, (str, bytes, bool, int)): + raise ValueError("cannot encode objects that are not 2-tuples") + + if isinstance(value, Mapping): + value = value.items() + + return list(value) + + +# From mitsuhiko/werkzeug (used with permission). +def parse_list_header(value): + """Parse lists as described by RFC 2068 Section 2. + + In particular, parse comma-separated lists where the elements of + the list may include quoted-strings. A quoted-string could + contain a comma. A non-quoted string could have quotes in the + middle. Quotes are removed automatically after parsing. + + It basically works like :func:`parse_set_header` just that items + may appear multiple times and case sensitivity is preserved. + + The return value is a standard :class:`list`: + + >>> parse_list_header('token, "quoted value"') + ['token', 'quoted value'] + + To create a header from the :class:`list` again, use the + :func:`dump_header` function. + + :param value: a string with a list header. + :return: :class:`list` + :rtype: list + """ + result = [] + for item in _parse_list_header(value): + if item[:1] == item[-1:] == '"': + item = unquote_header_value(item[1:-1]) + result.append(item) + return result + + +# From mitsuhiko/werkzeug (used with permission). +def parse_dict_header(value): + """Parse lists of key, value pairs as described by RFC 2068 Section 2 and + convert them into a python dict: + + >>> d = parse_dict_header('foo="is a fish", bar="as well"') + >>> type(d) is dict + True + >>> sorted(d.items()) + [('bar', 'as well'), ('foo', 'is a fish')] + + If there is no value for a key it will be `None`: + + >>> parse_dict_header('key_without_value') + {'key_without_value': None} + + To create a header from the :class:`dict` again, use the + :func:`dump_header` function. + + :param value: a string with a dict header. + :return: :class:`dict` + :rtype: dict + """ + result = {} + for item in _parse_list_header(value): + if "=" not in item: + result[item] = None + continue + name, value = item.split("=", 1) + if value[:1] == value[-1:] == '"': + value = unquote_header_value(value[1:-1]) + result[name] = value + return result + + +# From mitsuhiko/werkzeug (used with permission). +def unquote_header_value(value, is_filename=False): + r"""Unquotes a header value. (Reversal of :func:`quote_header_value`). + This does not use the real unquoting but what browsers are actually + using for quoting. + + :param value: the header value to unquote. + :rtype: str + """ + if value and value[0] == value[-1] == '"': + # this is not the real unquoting, but fixing this so that the + # RFC is met will result in bugs with internet explorer and + # probably some other browsers as well. IE for example is + # uploading files with "C:\foo\bar.txt" as filename + value = value[1:-1] + + # if this is a filename and the starting characters look like + # a UNC path, then just return the value without quotes. Using the + # replace sequence below on a UNC path has the effect of turning + # the leading double slash into a single slash and then + # _fix_ie_filename() doesn't work correctly. See #458. + if not is_filename or value[:2] != "\\\\": + return value.replace("\\\\", "\\").replace('\\"', '"') + return value + + +def dict_from_cookiejar(cj): + """Returns a key/value dictionary from a CookieJar. + + :param cj: CookieJar object to extract cookies from. + :rtype: dict + """ + + cookie_dict = {} + + for cookie in cj: + cookie_dict[cookie.name] = cookie.value + + return cookie_dict + + +def add_dict_to_cookiejar(cj, cookie_dict): + """Returns a CookieJar from a key/value dictionary. + + :param cj: CookieJar to insert cookies into. + :param cookie_dict: Dict of key/values to insert into CookieJar. + :rtype: CookieJar + """ + + return cookiejar_from_dict(cookie_dict, cj) + + +def get_encodings_from_content(content): + """Returns encodings from given content string. + + :param content: bytestring to extract encodings from. + """ + warnings.warn( + ( + "In requests 3.0, get_encodings_from_content will be removed. For " + "more information, please see the discussion on issue #2266. (This" + " warning should only appear once.)" + ), + DeprecationWarning, + ) + + charset_re = re.compile(r']', flags=re.I) + pragma_re = re.compile(r']', flags=re.I) + xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]') + + return ( + charset_re.findall(content) + + pragma_re.findall(content) + + xml_re.findall(content) + ) + + +def _parse_content_type_header(header): + """Returns content type and parameters from given header + + :param header: string + :return: tuple containing content type and dictionary of + parameters + """ + + tokens = header.split(";") + content_type, params = tokens[0].strip(), tokens[1:] + params_dict = {} + items_to_strip = "\"' " + + for param in params: + param = param.strip() + if param: + key, value = param, True + index_of_equals = param.find("=") + if index_of_equals != -1: + key = param[:index_of_equals].strip(items_to_strip) + value = param[index_of_equals + 1 :].strip(items_to_strip) + params_dict[key.lower()] = value + return content_type, params_dict + + +def get_encoding_from_headers(headers): + """Returns encodings from given HTTP Header Dict. + + :param headers: dictionary to extract encoding from. + :rtype: str + """ + + content_type = headers.get("content-type") + + if not content_type: + return None + + content_type, params = _parse_content_type_header(content_type) + + if "charset" in params: + return params["charset"].strip("'\"") + + if "text" in content_type: + return "ISO-8859-1" + + if "application/json" in content_type: + # Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset + return "utf-8" + + +def stream_decode_response_unicode(iterator, r): + """Stream decodes an iterator.""" + + if r.encoding is None: + yield from iterator + return + + decoder = codecs.getincrementaldecoder(r.encoding)(errors="replace") + for chunk in iterator: + rv = decoder.decode(chunk) + if rv: + yield rv + rv = decoder.decode(b"", final=True) + if rv: + yield rv + + +def iter_slices(string, slice_length): + """Iterate over slices of a string.""" + pos = 0 + if slice_length is None or slice_length <= 0: + slice_length = len(string) + while pos < len(string): + yield string[pos : pos + slice_length] + pos += slice_length + + +def get_unicode_from_response(r): + """Returns the requested content back in unicode. + + :param r: Response object to get unicode content from. + + Tried: + + 1. charset from content-type + 2. fall back and replace all unicode characters + + :rtype: str + """ + warnings.warn( + ( + "In requests 3.0, get_unicode_from_response will be removed. For " + "more information, please see the discussion on issue #2266. (This" + " warning should only appear once.)" + ), + DeprecationWarning, + ) + + tried_encodings = [] + + # Try charset from content-type + encoding = get_encoding_from_headers(r.headers) + + if encoding: + try: + return str(r.content, encoding) + except UnicodeError: + tried_encodings.append(encoding) + + # Fall back: + try: + return str(r.content, encoding, errors="replace") + except TypeError: + return r.content + + +# The unreserved URI characters (RFC 3986) +UNRESERVED_SET = frozenset( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~" +) + + +def unquote_unreserved(uri): + """Un-escape any percent-escape sequences in a URI that are unreserved + characters. This leaves all reserved, illegal and non-ASCII bytes encoded. + + :rtype: str + """ + parts = uri.split("%") + for i in range(1, len(parts)): + h = parts[i][0:2] + if len(h) == 2 and h.isalnum(): + try: + c = chr(int(h, 16)) + except ValueError: + raise InvalidURL(f"Invalid percent-escape sequence: '{h}'") + + if c in UNRESERVED_SET: + parts[i] = c + parts[i][2:] + else: + parts[i] = f"%{parts[i]}" + else: + parts[i] = f"%{parts[i]}" + return "".join(parts) + + +def requote_uri(uri): + """Re-quote the given URI. + + This function passes the given URI through an unquote/quote cycle to + ensure that it is fully and consistently quoted. + + :rtype: str + """ + safe_with_percent = "!#$%&'()*+,/:;=?@[]~" + safe_without_percent = "!#$&'()*+,/:;=?@[]~" + try: + # Unquote only the unreserved characters + # Then quote only illegal characters (do not quote reserved, + # unreserved, or '%') + return quote(unquote_unreserved(uri), safe=safe_with_percent) + except InvalidURL: + # We couldn't unquote the given URI, so let's try quoting it, but + # there may be unquoted '%'s in the URI. We need to make sure they're + # properly quoted so they do not cause issues elsewhere. + return quote(uri, safe=safe_without_percent) + + +def address_in_network(ip, net): + """This function allows you to check if an IP belongs to a network subnet + + Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24 + returns False if ip = 192.168.1.1 and net = 192.168.100.0/24 + + :rtype: bool + """ + ipaddr = struct.unpack("=L", socket.inet_aton(ip))[0] + netaddr, bits = net.split("/") + netmask = struct.unpack("=L", socket.inet_aton(dotted_netmask(int(bits))))[0] + network = struct.unpack("=L", socket.inet_aton(netaddr))[0] & netmask + return (ipaddr & netmask) == (network & netmask) + + +def dotted_netmask(mask): + """Converts mask from /xx format to xxx.xxx.xxx.xxx + + Example: if mask is 24 function returns 255.255.255.0 + + :rtype: str + """ + bits = 0xFFFFFFFF ^ (1 << 32 - mask) - 1 + return socket.inet_ntoa(struct.pack(">I", bits)) + + +def is_ipv4_address(string_ip): + """ + :rtype: bool + """ + try: + socket.inet_aton(string_ip) + except OSError: + return False + return True + + +def is_valid_cidr(string_network): + """ + Very simple check of the cidr format in no_proxy variable. + + :rtype: bool + """ + if string_network.count("/") == 1: + try: + mask = int(string_network.split("/")[1]) + except ValueError: + return False + + if mask < 1 or mask > 32: + return False + + try: + socket.inet_aton(string_network.split("/")[0]) + except OSError: + return False + else: + return False + return True + + +@contextlib.contextmanager +def set_environ(env_name, value): + """Set the environment variable 'env_name' to 'value' + + Save previous value, yield, and then restore the previous value stored in + the environment variable 'env_name'. + + If 'value' is None, do nothing""" + value_changed = value is not None + if value_changed: + old_value = os.environ.get(env_name) + os.environ[env_name] = value + try: + yield + finally: + if value_changed: + if old_value is None: + del os.environ[env_name] + else: + os.environ[env_name] = old_value + + +def should_bypass_proxies(url, no_proxy): + """ + Returns whether we should bypass proxies or not. + + :rtype: bool + """ + # Prioritize lowercase environment variables over uppercase + # to keep a consistent behaviour with other http projects (curl, wget). + def get_proxy(key): + return os.environ.get(key) or os.environ.get(key.upper()) + + # First check whether no_proxy is defined. If it is, check that the URL + # we're getting isn't in the no_proxy list. + no_proxy_arg = no_proxy + if no_proxy is None: + no_proxy = get_proxy("no_proxy") + parsed = urlparse(url) + + if parsed.hostname is None: + # URLs don't always have hostnames, e.g. file:/// urls. + return True + + if no_proxy: + # We need to check whether we match here. We need to see if we match + # the end of the hostname, both with and without the port. + no_proxy = (host for host in no_proxy.replace(" ", "").split(",") if host) + + if is_ipv4_address(parsed.hostname): + for proxy_ip in no_proxy: + if is_valid_cidr(proxy_ip): + if address_in_network(parsed.hostname, proxy_ip): + return True + elif parsed.hostname == proxy_ip: + # If no_proxy ip was defined in plain IP notation instead of cidr notation & + # matches the IP of the index + return True + else: + host_with_port = parsed.hostname + if parsed.port: + host_with_port += f":{parsed.port}" + + for host in no_proxy: + if parsed.hostname.endswith(host) or host_with_port.endswith(host): + # The URL does match something in no_proxy, so we don't want + # to apply the proxies on this URL. + return True + + with set_environ("no_proxy", no_proxy_arg): + # parsed.hostname can be `None` in cases such as a file URI. + try: + bypass = proxy_bypass(parsed.hostname) + except (TypeError, socket.gaierror): + bypass = False + + if bypass: + return True + + return False + + +def get_environ_proxies(url, no_proxy=None): + """ + Return a dict of environment proxies. + + :rtype: dict + """ + if should_bypass_proxies(url, no_proxy=no_proxy): + return {} + else: + return getproxies() + + +def select_proxy(url, proxies): + """Select a proxy for the url, if applicable. + + :param url: The url being for the request + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs + """ + proxies = proxies or {} + urlparts = urlparse(url) + if urlparts.hostname is None: + return proxies.get(urlparts.scheme, proxies.get("all")) + + proxy_keys = [ + urlparts.scheme + "://" + urlparts.hostname, + urlparts.scheme, + "all://" + urlparts.hostname, + "all", + ] + proxy = None + for proxy_key in proxy_keys: + if proxy_key in proxies: + proxy = proxies[proxy_key] + break + + return proxy + + +def resolve_proxies(request, proxies, trust_env=True): + """This method takes proxy information from a request and configuration + input to resolve a mapping of target proxies. This will consider settings + such a NO_PROXY to strip proxy configurations. + + :param request: Request or PreparedRequest + :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs + :param trust_env: Boolean declaring whether to trust environment configs + + :rtype: dict + """ + proxies = proxies if proxies is not None else {} + url = request.url + scheme = urlparse(url).scheme + no_proxy = proxies.get("no_proxy") + new_proxies = proxies.copy() + + if trust_env and not should_bypass_proxies(url, no_proxy=no_proxy): + environ_proxies = get_environ_proxies(url, no_proxy=no_proxy) + + proxy = environ_proxies.get(scheme, environ_proxies.get("all")) + + if proxy: + new_proxies.setdefault(scheme, proxy) + return new_proxies + + +def default_user_agent(name="python-requests"): + """ + Return a string representing the default user agent. + + :rtype: str + """ + return f"{name}/{__version__}" + + +def default_headers(): + """ + :rtype: requests.structures.CaseInsensitiveDict + """ + return CaseInsensitiveDict( + { + "User-Agent": default_user_agent(), + "Accept-Encoding": DEFAULT_ACCEPT_ENCODING, + "Accept": "*/*", + "Connection": "keep-alive", + } + ) + + +def parse_header_links(value): + """Return a list of parsed link headers proxies. + + i.e. Link: ; rel=front; type="image/jpeg",; rel=back;type="image/jpeg" + + :rtype: list + """ + + links = [] + + replace_chars = " '\"" + + value = value.strip(replace_chars) + if not value: + return links + + for val in re.split(", *<", value): + try: + url, params = val.split(";", 1) + except ValueError: + url, params = val, "" + + link = {"url": url.strip("<> '\"")} + + for param in params.split(";"): + try: + key, value = param.split("=") + except ValueError: + break + + link[key.strip(replace_chars)] = value.strip(replace_chars) + + links.append(link) + + return links + + +# Null bytes; no need to recreate these on each call to guess_json_utf +_null = "\x00".encode("ascii") # encoding to ASCII for Python 3 +_null2 = _null * 2 +_null3 = _null * 3 + + +def guess_json_utf(data): + """ + :rtype: str + """ + # JSON always starts with two ASCII characters, so detection is as + # easy as counting the nulls and from their location and count + # determine the encoding. Also detect a BOM, if present. + sample = data[:4] + if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE): + return "utf-32" # BOM included + if sample[:3] == codecs.BOM_UTF8: + return "utf-8-sig" # BOM included, MS style (discouraged) + if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE): + return "utf-16" # BOM included + nullcount = sample.count(_null) + if nullcount == 0: + return "utf-8" + if nullcount == 2: + if sample[::2] == _null2: # 1st and 3rd are null + return "utf-16-be" + if sample[1::2] == _null2: # 2nd and 4th are null + return "utf-16-le" + # Did not detect 2 valid UTF-16 ascii-range characters + if nullcount == 3: + if sample[:3] == _null3: + return "utf-32-be" + if sample[1:] == _null3: + return "utf-32-le" + # Did not detect a valid UTF-32 ascii-range character + return None + + +def prepend_scheme_if_needed(url, new_scheme): + """Given a URL that may or may not have a scheme, prepend the given scheme. + Does not replace a present scheme with the one provided as an argument. + + :rtype: str + """ + parsed = parse_url(url) + scheme, auth, host, port, path, query, fragment = parsed + + # A defect in urlparse determines that there isn't a netloc present in some + # urls. We previously assumed parsing was overly cautious, and swapped the + # netloc and path. Due to a lack of tests on the original defect, this is + # maintained with parse_url for backwards compatibility. + netloc = parsed.netloc + if not netloc: + netloc, path = path, netloc + + if auth: + # parse_url doesn't provide the netloc with auth + # so we'll add it ourselves. + netloc = "@".join([auth, netloc]) + if scheme is None: + scheme = new_scheme + if path is None: + path = "" + + return urlunparse((scheme, netloc, path, "", query, fragment)) + + +def get_auth_from_url(url): + """Given a url with authentication components, extract them into a tuple of + username,password. + + :rtype: (str,str) + """ + parsed = urlparse(url) + + try: + auth = (unquote(parsed.username), unquote(parsed.password)) + except (AttributeError, TypeError): + auth = ("", "") + + return auth + + +def check_header_validity(header): + """Verifies that header parts don't contain leading whitespace + reserved characters, or return characters. + + :param header: tuple, in the format (name, value). + """ + name, value = header + _validate_header_part(header, name, 0) + _validate_header_part(header, value, 1) + + +def _validate_header_part(header, header_part, header_validator_index): + if isinstance(header_part, str): + validator = _HEADER_VALIDATORS_STR[header_validator_index] + elif isinstance(header_part, bytes): + validator = _HEADER_VALIDATORS_BYTE[header_validator_index] + else: + raise InvalidHeader( + f"Header part ({header_part!r}) from {header} " + f"must be of type str or bytes, not {type(header_part)}" + ) + + if not validator.match(header_part): + header_kind = "name" if header_validator_index == 0 else "value" + raise InvalidHeader( + f"Invalid leading whitespace, reserved character(s), or return" + f"character(s) in header {header_kind}: {header_part!r}" + ) + + +def urldefragauth(url): + """ + Given a url remove the fragment and the authentication part. + + :rtype: str + """ + scheme, netloc, path, params, query, fragment = urlparse(url) + + # see func:`prepend_scheme_if_needed` + if not netloc: + netloc, path = path, netloc + + netloc = netloc.rsplit("@", 1)[-1] + + return urlunparse((scheme, netloc, path, params, query, "")) + + +def rewind_body(prepared_request): + """Move file pointer back to its recorded starting position + so it can be read again on redirect. + """ + body_seek = getattr(prepared_request.body, "seek", None) + if body_seek is not None and isinstance( + prepared_request._body_position, integer_types + ): + try: + body_seek(prepared_request._body_position) + except OSError: + raise UnrewindableBodyError( + "An error occurred when rewinding request body for redirect." + ) + else: + raise UnrewindableBodyError("Unable to rewind request body for redirect.") diff --git a/requests/python/urllib3-2.0.4.dist-info/INSTALLER b/requests/python/urllib3-2.0.4.dist-info/INSTALLER new file mode 100644 index 0000000..a1b589e --- /dev/null +++ b/requests/python/urllib3-2.0.4.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/requests/python/urllib3-2.0.4.dist-info/METADATA b/requests/python/urllib3-2.0.4.dist-info/METADATA new file mode 100644 index 0000000..e7c094f --- /dev/null +++ b/requests/python/urllib3-2.0.4.dist-info/METADATA @@ -0,0 +1,158 @@ +Metadata-Version: 2.1 +Name: urllib3 +Version: 2.0.4 +Summary: HTTP library with thread-safe connection pooling, file post, and more. +Project-URL: Changelog, https://github.com/urllib3/urllib3/blob/main/CHANGES.rst +Project-URL: Documentation, https://urllib3.readthedocs.io +Project-URL: Code, https://github.com/urllib3/urllib3 +Project-URL: Issue tracker, https://github.com/urllib3/urllib3/issues +Author-email: Andrey Petrov +Maintainer-email: Seth Michael Larson , Quentin Pradet +License-File: LICENSE.txt +Keywords: filepost,http,httplib,https,pooling,ssl,threadsafe,urllib +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Topic :: Internet :: WWW/HTTP +Classifier: Topic :: Software Development :: Libraries +Requires-Python: >=3.7 +Provides-Extra: brotli +Requires-Dist: brotli>=1.0.9; platform_python_implementation == 'CPython' and extra == 'brotli' +Requires-Dist: brotlicffi>=0.8.0; platform_python_implementation != 'CPython' and extra == 'brotli' +Provides-Extra: secure +Requires-Dist: certifi; extra == 'secure' +Requires-Dist: cryptography>=1.9; extra == 'secure' +Requires-Dist: idna>=2.0.0; extra == 'secure' +Requires-Dist: pyopenssl>=17.1.0; extra == 'secure' +Requires-Dist: urllib3-secure-extra; extra == 'secure' +Provides-Extra: socks +Requires-Dist: pysocks!=1.5.7,<2.0,>=1.5.6; extra == 'socks' +Provides-Extra: zstd +Requires-Dist: zstandard>=0.18.0; extra == 'zstd' +Description-Content-Type: text/markdown + +

+ +![urllib3](https://github.com/urllib3/urllib3/raw/main/docs/_static/banner_github.svg) + +

+ +

+ PyPI Version + Python Versions + Join our Discord + Coverage Status + Build Status on GitHub + Documentation Status
+ OpenSSF Scorecard + SLSA 3 + CII Best Practices +

+ +urllib3 is a powerful, *user-friendly* HTTP client for Python. Much of the +Python ecosystem already uses urllib3 and you should too. +urllib3 brings many critical features that are missing from the Python +standard libraries: + +- Thread safety. +- Connection pooling. +- Client-side SSL/TLS verification. +- File uploads with multipart encoding. +- Helpers for retrying requests and dealing with HTTP redirects. +- Support for gzip, deflate, brotli, and zstd encoding. +- Proxy support for HTTP and SOCKS. +- 100% test coverage. + +urllib3 is powerful and easy to use: + +```python3 +>>> import urllib3 +>>> resp = urllib3.request("GET", "http://httpbin.org/robots.txt") +>>> resp.status +200 +>>> resp.data +b"User-agent: *\nDisallow: /deny\n" +``` + +## Installing + +urllib3 can be installed with [pip](https://pip.pypa.io): + +```bash +$ python -m pip install urllib3 +``` + +Alternatively, you can grab the latest source code from [GitHub](https://github.com/urllib3/urllib3): + +```bash +$ git clone https://github.com/urllib3/urllib3.git +$ cd urllib3 +$ pip install . +``` + + +## Documentation + +urllib3 has usage and reference documentation at [urllib3.readthedocs.io](https://urllib3.readthedocs.io). + + +## Community + +urllib3 has a [community Discord channel](https://discord.gg/urllib3) for asking questions and +collaborating with other contributors. Drop by and say hello 👋 + + +## Contributing + +urllib3 happily accepts contributions. Please see our +[contributing documentation](https://urllib3.readthedocs.io/en/latest/contributing.html) +for some tips on getting started. + + +## Security Disclosures + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure with maintainers. + + +## Maintainers + +- [@sethmlarson](https://github.com/sethmlarson) (Seth M. Larson) +- [@pquentin](https://github.com/pquentin) (Quentin Pradet) +- [@theacodes](https://github.com/theacodes) (Thea Flowers) +- [@haikuginger](https://github.com/haikuginger) (Jess Shapiro) +- [@lukasa](https://github.com/lukasa) (Cory Benfield) +- [@sigmavirus24](https://github.com/sigmavirus24) (Ian Stapleton Cordasco) +- [@shazow](https://github.com/shazow) (Andrey Petrov) + +👋 + + +## Sponsorship + +If your company benefits from this library, please consider [sponsoring its +development](https://urllib3.readthedocs.io/en/latest/sponsors.html). + + +## For Enterprise + +Professional support for urllib3 is available as part of the [Tidelift +Subscription][1]. Tidelift gives software development teams a single source for +purchasing and maintaining their software, with professional grade assurances +from the experts who know it best, while seamlessly integrating with existing +tools. + +[1]: https://tidelift.com/subscription/pkg/pypi-urllib3?utm_source=pypi-urllib3&utm_medium=referral&utm_campaign=readme diff --git a/requests/python/urllib3-2.0.4.dist-info/RECORD b/requests/python/urllib3-2.0.4.dist-info/RECORD new file mode 100644 index 0000000..5ae1ecc --- /dev/null +++ b/requests/python/urllib3-2.0.4.dist-info/RECORD @@ -0,0 +1,70 @@ +urllib3-2.0.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +urllib3-2.0.4.dist-info/METADATA,sha256=hqexOXqgsYEGm5SMWGrhOHKgm4jxLM7lFPbit444zXY,6591 +urllib3-2.0.4.dist-info/RECORD,, +urllib3-2.0.4.dist-info/WHEEL,sha256=9QBuHhg6FNW7lppboF2vKVbCGTVzsFykgRQjjlajrhA,87 +urllib3-2.0.4.dist-info/licenses/LICENSE.txt,sha256=Ew46ZNX91dCWp1JpRjSn2d8oRGnehuVzIQAmgEHj1oY,1093 +urllib3/__init__.py,sha256=OV22EiB-j4tci8776nQPuyOorDZSvsbzlS1_3SP9fmo,5307 +urllib3/__pycache__/__init__.cpython-311.pyc,, +urllib3/__pycache__/_base_connection.cpython-311.pyc,, +urllib3/__pycache__/_collections.cpython-311.pyc,, +urllib3/__pycache__/_request_methods.cpython-311.pyc,, +urllib3/__pycache__/_version.cpython-311.pyc,, +urllib3/__pycache__/connection.cpython-311.pyc,, +urllib3/__pycache__/connectionpool.cpython-311.pyc,, +urllib3/__pycache__/exceptions.cpython-311.pyc,, +urllib3/__pycache__/fields.cpython-311.pyc,, +urllib3/__pycache__/filepost.cpython-311.pyc,, +urllib3/__pycache__/poolmanager.cpython-311.pyc,, +urllib3/__pycache__/response.cpython-311.pyc,, +urllib3/_base_connection.py,sha256=Zx9RKhOpdcV6EuNZUYpwSy_i3Y-HgBQxl72rprYBD9I,5651 +urllib3/_collections.py,sha256=GYCDeODxROILJVRL9E9hprePDegUqh5LdggY_9UPBAw,16817 +urllib3/_request_methods.py,sha256=rTM3FfErdUIVfuqGYJvrnI-HLvBePTLDWKdzosJoyx4,7756 +urllib3/_version.py,sha256=sfuelPE6Hyx1lJZ4flqCAEV9EUMtHOhQK_9Zr_XZQIQ,98 +urllib3/connection.py,sha256=ynxJhsCnkmi6PFtbF-dbPoewZDr420SVFzQuLXU9BF0,33830 +urllib3/connectionpool.py,sha256=Sj7x6xkQHYe9I4xHBOBgkpeFQXog3nmmsLdtQJU3A4k,42961 +urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +urllib3/contrib/__pycache__/__init__.cpython-311.pyc,, +urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc,, +urllib3/contrib/__pycache__/securetransport.cpython-311.pyc,, +urllib3/contrib/__pycache__/socks.cpython-311.pyc,, +urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc,, +urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc,, +urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc,, +urllib3/contrib/_securetransport/bindings.py,sha256=N8r6aifbJ-dNS5v-YTPsBl7d0R1GhTi6FiUOdZMGdoo,14452 +urllib3/contrib/_securetransport/low_level.py,sha256=14Dhp_jima5J824obfFX5oBORYiAnULtUJ_TB8CEscY,16220 +urllib3/contrib/pyopenssl.py,sha256=mezuGWCrkZqlESm2CbLLTmKTt16ky-wADega-HSeq9U,19437 +urllib3/contrib/securetransport.py,sha256=tDglxxJvySdRih4JsawEKHitPytWUBJ6glrDrje4yM8,34121 +urllib3/contrib/socks.py,sha256=xbqs-P-UHH5L5a_dKvxKetFyV9lKuxkcV9K9Oiyd-gI,7715 +urllib3/exceptions.py,sha256=rOVHX1HOAb_TZwJZTqprLRTNAJQUWnrXDYaR8XBk1tY,9385 +urllib3/fields.py,sha256=XvSMfnSMqeOn9o-6Eb3Fl9MN2MNjiHsmEff_HR5jhEI,11026 +urllib3/filepost.py,sha256=-9qJT11cNGjO9dqnI20-oErZuTvNaM18xZZPCjZSbOE,2395 +urllib3/poolmanager.py,sha256=0StMnGCE-r0vuQygEsTpeaQjEQVBIyBb640rD1Bovfw,22648 +urllib3/py.typed,sha256=UaCuPFa3H8UAakbt-5G8SPacldTOGvJv18pPjUJ5gDY,93 +urllib3/response.py,sha256=jN5lRBnFn6gCqfP7NjuQJepLmll2W6p8SE6t8EU_C04,40092 +urllib3/util/__init__.py,sha256=WsFx_PdwI25do8AcdW-Xj3rvUrI3NsgeQULp6S0sPeU,1051 +urllib3/util/__pycache__/__init__.cpython-311.pyc,, +urllib3/util/__pycache__/connection.cpython-311.pyc,, +urllib3/util/__pycache__/proxy.cpython-311.pyc,, +urllib3/util/__pycache__/request.cpython-311.pyc,, +urllib3/util/__pycache__/response.cpython-311.pyc,, +urllib3/util/__pycache__/retry.cpython-311.pyc,, +urllib3/util/__pycache__/ssl_.cpython-311.pyc,, +urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc,, +urllib3/util/__pycache__/ssltransport.cpython-311.pyc,, +urllib3/util/__pycache__/timeout.cpython-311.pyc,, +urllib3/util/__pycache__/url.cpython-311.pyc,, +urllib3/util/__pycache__/util.cpython-311.pyc,, +urllib3/util/__pycache__/wait.cpython-311.pyc,, +urllib3/util/connection.py,sha256=QeUUEuNmhznpuKNPL-B0IVOkMdMCu8oJX62OC0Vpzug,4462 +urllib3/util/proxy.py,sha256=seP8-Q5B6bB0dMtwPj-YcZZQ30vHuLqRu-tI0JZ2fzs,1148 +urllib3/util/request.py,sha256=5w7bjcFNwXffvFyqogq8KmJhKagKdiiD5EusYH-rxgU,8083 +urllib3/util/response.py,sha256=vQE639uoEhj1vpjEdxu5lNIhJCSUZkd7pqllUI0BZOA,3374 +urllib3/util/retry.py,sha256=EgWJcUb_2BrMT1Z-HLBwkQva_CCwHDWZ-0jdTZin0TM,18374 +urllib3/util/ssl_.py,sha256=uCuWbQhktyOwdHI91g4Ri3CD4SloVInYA58G6vKpqcw,19244 +urllib3/util/ssl_match_hostname.py,sha256=gaWqixoYtQ_GKO8fcRGFj3VXeMoqyxQQuUTPgWeiL_M,5812 +urllib3/util/ssltransport.py,sha256=jGmDxXI-nPBfMib-kjksI5TxUQyooYpekd0sjo1ibdg,9045 +urllib3/util/timeout.py,sha256=iXlm7hqG7ij7y27z23giTzsjyg3KIiVyjhsQsiWLDHA,10529 +urllib3/util/url.py,sha256=wHORhp80RAXyTlAIkTqLFzSrkU7J34ZDxX-tN65MBZk,15213 +urllib3/util/util.py,sha256=j3lbZK1jPyiwD34T8IgJzdWEZVT-4E-0vYIJi9UjeNA,1146 +urllib3/util/wait.py,sha256=_ph8IrUR3sqPqi0OopQgJUlH4wzkGeM5CiyA7XGGtmI,4423 diff --git a/requests/python/urllib3-2.0.4.dist-info/WHEEL b/requests/python/urllib3-2.0.4.dist-info/WHEEL new file mode 100644 index 0000000..ba1a8af --- /dev/null +++ b/requests/python/urllib3-2.0.4.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.18.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/requests/python/urllib3-2.0.4.dist-info/licenses/LICENSE.txt b/requests/python/urllib3-2.0.4.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000..e6183d0 --- /dev/null +++ b/requests/python/urllib3-2.0.4.dist-info/licenses/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2008-2020 Andrey Petrov and contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/requests/python/urllib3/__init__.py b/requests/python/urllib3/__init__.py new file mode 100644 index 0000000..32c1f00 --- /dev/null +++ b/requests/python/urllib3/__init__.py @@ -0,0 +1,166 @@ +""" +Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more +""" + +from __future__ import annotations + +# Set default logging handler to avoid "No handler found" warnings. +import logging +import typing +import warnings +from logging import NullHandler + +from . import exceptions +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from ._version import __version__ +from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url +from .filepost import _TYPE_FIELDS, encode_multipart_formdata +from .poolmanager import PoolManager, ProxyManager, proxy_from_url +from .response import BaseHTTPResponse, HTTPResponse +from .util.request import make_headers +from .util.retry import Retry +from .util.timeout import Timeout + +# Ensure that Python is compiled with OpenSSL 1.1.1+ +# If the 'ssl' module isn't available at all that's +# fine, we only care if the module is available. +try: + import ssl +except ImportError: + pass +else: + if not ssl.OPENSSL_VERSION.startswith("OpenSSL "): # Defensive: + warnings.warn( + "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently " + f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " + "See: https://github.com/urllib3/urllib3/issues/3020", + exceptions.NotOpenSSLWarning, + ) + elif ssl.OPENSSL_VERSION_INFO < (1, 1, 1): # Defensive: + raise ImportError( + "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently " + f"the 'ssl' module is compiled with {ssl.OPENSSL_VERSION!r}. " + "See: https://github.com/urllib3/urllib3/issues/2168" + ) + +# === NOTE TO REPACKAGERS AND VENDORS === +# Please delete this block, this logic is only +# for urllib3 being distributed via PyPI. +# See: https://github.com/urllib3/urllib3/issues/2680 +try: + import urllib3_secure_extra # type: ignore # noqa: F401 +except ModuleNotFoundError: + pass +else: + warnings.warn( + "'urllib3[secure]' extra is deprecated and will be removed " + "in urllib3 v2.1.0. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2680", + category=DeprecationWarning, + stacklevel=2, + ) + +__author__ = "Andrey Petrov (andrey.petrov@shazow.net)" +__license__ = "MIT" +__version__ = __version__ + +__all__ = ( + "HTTPConnectionPool", + "HTTPHeaderDict", + "HTTPSConnectionPool", + "PoolManager", + "ProxyManager", + "HTTPResponse", + "Retry", + "Timeout", + "add_stderr_logger", + "connection_from_url", + "disable_warnings", + "encode_multipart_formdata", + "make_headers", + "proxy_from_url", + "request", + "BaseHTTPResponse", +) + +logging.getLogger(__name__).addHandler(NullHandler()) + + +def add_stderr_logger( + level: int = logging.DEBUG, +) -> logging.StreamHandler[typing.TextIO]: + """ + Helper for quickly adding a StreamHandler to the logger. Useful for + debugging. + + Returns the handler after adding it. + """ + # This method needs to be in this __init__.py to get the __name__ correct + # even if urllib3 is vendored within another package. + logger = logging.getLogger(__name__) + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(message)s")) + logger.addHandler(handler) + logger.setLevel(level) + logger.debug("Added a stderr logging handler to logger: %s", __name__) + return handler + + +# ... Clean up. +del NullHandler + + +# All warning filters *must* be appended unless you're really certain that they +# shouldn't be: otherwise, it's very hard for users to use most Python +# mechanisms to silence them. +# SecurityWarning's always go off by default. +warnings.simplefilter("always", exceptions.SecurityWarning, append=True) +# InsecurePlatformWarning's don't vary between requests, so we keep it default. +warnings.simplefilter("default", exceptions.InsecurePlatformWarning, append=True) + + +def disable_warnings(category: type[Warning] = exceptions.HTTPWarning) -> None: + """ + Helper for quickly disabling all urllib3 warnings. + """ + warnings.simplefilter("ignore", category) + + +_DEFAULT_POOL = PoolManager() + + +def request( + method: str, + url: str, + *, + body: _TYPE_BODY | None = None, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + preload_content: bool | None = True, + decode_content: bool | None = True, + redirect: bool | None = True, + retries: Retry | bool | int | None = None, + timeout: Timeout | float | int | None = 3, + json: typing.Any | None = None, +) -> BaseHTTPResponse: + """ + A convenience, top-level request method. It uses a module-global ``PoolManager`` instance. + Therefore, its side effects could be shared across dependencies relying on it. + To avoid side effects create a new ``PoolManager`` instance and use it instead. + The method does not accept low-level ``**urlopen_kw`` keyword arguments. + """ + + return _DEFAULT_POOL.request( + method, + url, + body=body, + fields=fields, + headers=headers, + preload_content=preload_content, + decode_content=decode_content, + redirect=redirect, + retries=retries, + timeout=timeout, + json=json, + ) diff --git a/requests/python/urllib3/__pycache__/__init__.cpython-311.pyc b/requests/python/urllib3/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..7458e5c Binary files /dev/null and b/requests/python/urllib3/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/_base_connection.cpython-311.pyc b/requests/python/urllib3/__pycache__/_base_connection.cpython-311.pyc new file mode 100644 index 0000000..8fee680 Binary files /dev/null and b/requests/python/urllib3/__pycache__/_base_connection.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/_collections.cpython-311.pyc b/requests/python/urllib3/__pycache__/_collections.cpython-311.pyc new file mode 100644 index 0000000..b1724ab Binary files /dev/null and b/requests/python/urllib3/__pycache__/_collections.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/_request_methods.cpython-311.pyc b/requests/python/urllib3/__pycache__/_request_methods.cpython-311.pyc new file mode 100644 index 0000000..73dbdaf Binary files /dev/null and b/requests/python/urllib3/__pycache__/_request_methods.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/_version.cpython-311.pyc b/requests/python/urllib3/__pycache__/_version.cpython-311.pyc new file mode 100644 index 0000000..98be416 Binary files /dev/null and b/requests/python/urllib3/__pycache__/_version.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/connection.cpython-311.pyc b/requests/python/urllib3/__pycache__/connection.cpython-311.pyc new file mode 100644 index 0000000..7d47c35 Binary files /dev/null and b/requests/python/urllib3/__pycache__/connection.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/connectionpool.cpython-311.pyc b/requests/python/urllib3/__pycache__/connectionpool.cpython-311.pyc new file mode 100644 index 0000000..f82fcf7 Binary files /dev/null and b/requests/python/urllib3/__pycache__/connectionpool.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/exceptions.cpython-311.pyc b/requests/python/urllib3/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..9d957ab Binary files /dev/null and b/requests/python/urllib3/__pycache__/exceptions.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/fields.cpython-311.pyc b/requests/python/urllib3/__pycache__/fields.cpython-311.pyc new file mode 100644 index 0000000..f9432fe Binary files /dev/null and b/requests/python/urllib3/__pycache__/fields.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/filepost.cpython-311.pyc b/requests/python/urllib3/__pycache__/filepost.cpython-311.pyc new file mode 100644 index 0000000..50637b8 Binary files /dev/null and b/requests/python/urllib3/__pycache__/filepost.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/poolmanager.cpython-311.pyc b/requests/python/urllib3/__pycache__/poolmanager.cpython-311.pyc new file mode 100644 index 0000000..e4cad52 Binary files /dev/null and b/requests/python/urllib3/__pycache__/poolmanager.cpython-311.pyc differ diff --git a/requests/python/urllib3/__pycache__/response.cpython-311.pyc b/requests/python/urllib3/__pycache__/response.cpython-311.pyc new file mode 100644 index 0000000..d9ce24c Binary files /dev/null and b/requests/python/urllib3/__pycache__/response.cpython-311.pyc differ diff --git a/requests/python/urllib3/_base_connection.py b/requests/python/urllib3/_base_connection.py new file mode 100644 index 0000000..3afed76 --- /dev/null +++ b/requests/python/urllib3/_base_connection.py @@ -0,0 +1,173 @@ +from __future__ import annotations + +import typing + +from .util.connection import _TYPE_SOCKET_OPTIONS +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT +from .util.url import Url + +_TYPE_BODY = typing.Union[bytes, typing.IO[typing.Any], typing.Iterable[bytes], str] + + +class ProxyConfig(typing.NamedTuple): + ssl_context: ssl.SSLContext | None + use_forwarding_for_https: bool + assert_hostname: None | str | Literal[False] + assert_fingerprint: str | None + + +class _ResponseOptions(typing.NamedTuple): + # TODO: Remove this in favor of a better + # HTTP request/response lifecycle tracking. + request_method: str + request_url: str + preload_content: bool + decode_content: bool + enforce_content_length: bool + + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Literal, Protocol + + from .response import BaseHTTPResponse + + class BaseHTTPConnection(Protocol): + default_port: typing.ClassVar[int] + default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] + + host: str + port: int + timeout: None | ( + float + ) # Instance doesn't store _DEFAULT_TIMEOUT, must be resolved. + blocksize: int + source_address: tuple[str, int] | None + socket_options: _TYPE_SOCKET_OPTIONS | None + + proxy: Url | None + proxy_config: ProxyConfig | None + + is_verified: bool + proxy_is_verified: bool | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: _TYPE_SOCKET_OPTIONS | None = ..., + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + ) -> None: + ... + + def set_tunnel( + self, + host: str, + port: int | None = None, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: + ... + + def connect(self) -> None: + ... + + def request( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + # We know *at least* botocore is depending on the order of the + # first 3 parameters so to be safe we only mark the later ones + # as keyword-only to ensure we have space to extend. + *, + chunked: bool = False, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> None: + ... + + def getresponse(self) -> BaseHTTPResponse: + ... + + def close(self) -> None: + ... + + @property + def is_closed(self) -> bool: + """Whether the connection either is brand new or has been previously closed. + If this property is True then both ``is_connected`` and ``has_connected_to_proxy`` + properties must be False. + """ + + @property + def is_connected(self) -> bool: + """Whether the connection is actively connected to any origin (proxy or target)""" + + @property + def has_connected_to_proxy(self) -> bool: + """Whether the connection has successfully connected to its proxy. + This returns False if no proxy is in use. Used to determine whether + errors are coming from the proxy layer or from tunnelling to the target origin. + """ + + class BaseHTTPSConnection(BaseHTTPConnection, Protocol): + default_port: typing.ClassVar[int] + default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS] + + # Certificate verification methods + cert_reqs: int | str | None + assert_hostname: None | str | Literal[False] + assert_fingerprint: str | None + ssl_context: ssl.SSLContext | None + + # Trusted CAs + ca_certs: str | None + ca_cert_dir: str | None + ca_cert_data: None | str | bytes + + # TLS version + ssl_minimum_version: int | None + ssl_maximum_version: int | None + ssl_version: int | str | None # Deprecated + + # Client certificates + cert_file: str | None + key_file: str | None + key_password: str | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: _TYPE_SOCKET_OPTIONS | None = ..., + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + cert_reqs: int | str | None = None, + assert_hostname: None | str | Literal[False] = None, + assert_fingerprint: str | None = None, + server_hostname: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_certs: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + ssl_version: int | str | None = None, # Deprecated + cert_file: str | None = None, + key_file: str | None = None, + key_password: str | None = None, + ) -> None: + ... diff --git a/requests/python/urllib3/_collections.py b/requests/python/urllib3/_collections.py new file mode 100644 index 0000000..7f9dca7 --- /dev/null +++ b/requests/python/urllib3/_collections.py @@ -0,0 +1,463 @@ +from __future__ import annotations + +import typing +from collections import OrderedDict +from enum import Enum, auto +from threading import RLock + +if typing.TYPE_CHECKING: + # We can only import Protocol if TYPE_CHECKING because it's a development + # dependency, and is not available at runtime. + from typing_extensions import Protocol + + class HasGettableStringKeys(Protocol): + def keys(self) -> typing.Iterator[str]: + ... + + def __getitem__(self, key: str) -> str: + ... + + +__all__ = ["RecentlyUsedContainer", "HTTPHeaderDict"] + + +# Key type +_KT = typing.TypeVar("_KT") +# Value type +_VT = typing.TypeVar("_VT") +# Default type +_DT = typing.TypeVar("_DT") + +ValidHTTPHeaderSource = typing.Union[ + "HTTPHeaderDict", + typing.Mapping[str, str], + typing.Iterable[typing.Tuple[str, str]], + "HasGettableStringKeys", +] + + +class _Sentinel(Enum): + not_passed = auto() + + +def ensure_can_construct_http_header_dict( + potential: object, +) -> ValidHTTPHeaderSource | None: + if isinstance(potential, HTTPHeaderDict): + return potential + elif isinstance(potential, typing.Mapping): + # Full runtime checking of the contents of a Mapping is expensive, so for the + # purposes of typechecking, we assume that any Mapping is the right shape. + return typing.cast(typing.Mapping[str, str], potential) + elif isinstance(potential, typing.Iterable): + # Similarly to Mapping, full runtime checking of the contents of an Iterable is + # expensive, so for the purposes of typechecking, we assume that any Iterable + # is the right shape. + return typing.cast(typing.Iterable[typing.Tuple[str, str]], potential) + elif hasattr(potential, "keys") and hasattr(potential, "__getitem__"): + return typing.cast("HasGettableStringKeys", potential) + else: + return None + + +class RecentlyUsedContainer(typing.Generic[_KT, _VT], typing.MutableMapping[_KT, _VT]): + """ + Provides a thread-safe dict-like container which maintains up to + ``maxsize`` keys while throwing away the least-recently-used keys beyond + ``maxsize``. + + :param maxsize: + Maximum number of recent elements to retain. + + :param dispose_func: + Every time an item is evicted from the container, + ``dispose_func(value)`` is called. Callback which will get called + """ + + _container: typing.OrderedDict[_KT, _VT] + _maxsize: int + dispose_func: typing.Callable[[_VT], None] | None + lock: RLock + + def __init__( + self, + maxsize: int = 10, + dispose_func: typing.Callable[[_VT], None] | None = None, + ) -> None: + super().__init__() + self._maxsize = maxsize + self.dispose_func = dispose_func + self._container = OrderedDict() + self.lock = RLock() + + def __getitem__(self, key: _KT) -> _VT: + # Re-insert the item, moving it to the end of the eviction line. + with self.lock: + item = self._container.pop(key) + self._container[key] = item + return item + + def __setitem__(self, key: _KT, value: _VT) -> None: + evicted_item = None + with self.lock: + # Possibly evict the existing value of 'key' + try: + # If the key exists, we'll overwrite it, which won't change the + # size of the pool. Because accessing a key should move it to + # the end of the eviction line, we pop it out first. + evicted_item = key, self._container.pop(key) + self._container[key] = value + except KeyError: + # When the key does not exist, we insert the value first so that + # evicting works in all cases, including when self._maxsize is 0 + self._container[key] = value + if len(self._container) > self._maxsize: + # If we didn't evict an existing value, and we've hit our maximum + # size, then we have to evict the least recently used item from + # the beginning of the container. + evicted_item = self._container.popitem(last=False) + + # After releasing the lock on the pool, dispose of any evicted value. + if evicted_item is not None and self.dispose_func: + _, evicted_value = evicted_item + self.dispose_func(evicted_value) + + def __delitem__(self, key: _KT) -> None: + with self.lock: + value = self._container.pop(key) + + if self.dispose_func: + self.dispose_func(value) + + def __len__(self) -> int: + with self.lock: + return len(self._container) + + def __iter__(self) -> typing.NoReturn: + raise NotImplementedError( + "Iteration over this class is unlikely to be threadsafe." + ) + + def clear(self) -> None: + with self.lock: + # Copy pointers to all values, then wipe the mapping + values = list(self._container.values()) + self._container.clear() + + if self.dispose_func: + for value in values: + self.dispose_func(value) + + def keys(self) -> set[_KT]: # type: ignore[override] + with self.lock: + return set(self._container.keys()) + + +class HTTPHeaderDictItemView(typing.Set[typing.Tuple[str, str]]): + """ + HTTPHeaderDict is unusual for a Mapping[str, str] in that it has two modes of + address. + + If we directly try to get an item with a particular name, we will get a string + back that is the concatenated version of all the values: + + >>> d['X-Header-Name'] + 'Value1, Value2, Value3' + + However, if we iterate over an HTTPHeaderDict's items, we will optionally combine + these values based on whether combine=True was called when building up the dictionary + + >>> d = HTTPHeaderDict({"A": "1", "B": "foo"}) + >>> d.add("A", "2", combine=True) + >>> d.add("B", "bar") + >>> list(d.items()) + [ + ('A', '1, 2'), + ('B', 'foo'), + ('B', 'bar'), + ] + + This class conforms to the interface required by the MutableMapping ABC while + also giving us the nonstandard iteration behavior we want; items with duplicate + keys, ordered by time of first insertion. + """ + + _headers: HTTPHeaderDict + + def __init__(self, headers: HTTPHeaderDict) -> None: + self._headers = headers + + def __len__(self) -> int: + return len(list(self._headers.iteritems())) + + def __iter__(self) -> typing.Iterator[tuple[str, str]]: + return self._headers.iteritems() + + def __contains__(self, item: object) -> bool: + if isinstance(item, tuple) and len(item) == 2: + passed_key, passed_val = item + if isinstance(passed_key, str) and isinstance(passed_val, str): + return self._headers._has_value_for_header(passed_key, passed_val) + return False + + +class HTTPHeaderDict(typing.MutableMapping[str, str]): + """ + :param headers: + An iterable of field-value pairs. Must not contain multiple field names + when compared case-insensitively. + + :param kwargs: + Additional field-value pairs to pass in to ``dict.update``. + + A ``dict`` like container for storing HTTP Headers. + + Field names are stored and compared case-insensitively in compliance with + RFC 7230. Iteration provides the first case-sensitive key seen for each + case-insensitive pair. + + Using ``__setitem__`` syntax overwrites fields that compare equal + case-insensitively in order to maintain ``dict``'s api. For fields that + compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add`` + in a loop. + + If multiple fields that are equal case-insensitively are passed to the + constructor or ``.update``, the behavior is undefined and some will be + lost. + + >>> headers = HTTPHeaderDict() + >>> headers.add('Set-Cookie', 'foo=bar') + >>> headers.add('set-cookie', 'baz=quxx') + >>> headers['content-length'] = '7' + >>> headers['SET-cookie'] + 'foo=bar, baz=quxx' + >>> headers['Content-Length'] + '7' + """ + + _container: typing.MutableMapping[str, list[str]] + + def __init__(self, headers: ValidHTTPHeaderSource | None = None, **kwargs: str): + super().__init__() + self._container = {} # 'dict' is insert-ordered in Python 3.7+ + if headers is not None: + if isinstance(headers, HTTPHeaderDict): + self._copy_from(headers) + else: + self.extend(headers) + if kwargs: + self.extend(kwargs) + + def __setitem__(self, key: str, val: str) -> None: + # avoid a bytes/str comparison by decoding before httplib + if isinstance(key, bytes): + key = key.decode("latin-1") + self._container[key.lower()] = [key, val] + + def __getitem__(self, key: str) -> str: + val = self._container[key.lower()] + return ", ".join(val[1:]) + + def __delitem__(self, key: str) -> None: + del self._container[key.lower()] + + def __contains__(self, key: object) -> bool: + if isinstance(key, str): + return key.lower() in self._container + return False + + def setdefault(self, key: str, default: str = "") -> str: + return super().setdefault(key, default) + + def __eq__(self, other: object) -> bool: + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return False + else: + other_as_http_header_dict = type(self)(maybe_constructable) + + return {k.lower(): v for k, v in self.itermerged()} == { + k.lower(): v for k, v in other_as_http_header_dict.itermerged() + } + + def __ne__(self, other: object) -> bool: + return not self.__eq__(other) + + def __len__(self) -> int: + return len(self._container) + + def __iter__(self) -> typing.Iterator[str]: + # Only provide the originally cased names + for vals in self._container.values(): + yield vals[0] + + def discard(self, key: str) -> None: + try: + del self[key] + except KeyError: + pass + + def add(self, key: str, val: str, *, combine: bool = False) -> None: + """Adds a (name, value) pair, doesn't overwrite the value if it already + exists. + + If this is called with combine=True, instead of adding a new header value + as a distinct item during iteration, this will instead append the value to + any existing header value with a comma. If no existing header value exists + for the key, then the value will simply be added, ignoring the combine parameter. + + >>> headers = HTTPHeaderDict(foo='bar') + >>> headers.add('Foo', 'baz') + >>> headers['foo'] + 'bar, baz' + >>> list(headers.items()) + [('foo', 'bar'), ('foo', 'baz')] + >>> headers.add('foo', 'quz', combine=True) + >>> list(headers.items()) + [('foo', 'bar, baz, quz')] + """ + # avoid a bytes/str comparison by decoding before httplib + if isinstance(key, bytes): + key = key.decode("latin-1") + key_lower = key.lower() + new_vals = [key, val] + # Keep the common case aka no item present as fast as possible + vals = self._container.setdefault(key_lower, new_vals) + if new_vals is not vals: + # if there are values here, then there is at least the initial + # key/value pair + assert len(vals) >= 2 + if combine: + vals[-1] = vals[-1] + ", " + val + else: + vals.append(val) + + def extend(self, *args: ValidHTTPHeaderSource, **kwargs: str) -> None: + """Generic import function for any type of header-like object. + Adapted version of MutableMapping.update in order to insert items + with self.add instead of self.__setitem__ + """ + if len(args) > 1: + raise TypeError( + f"extend() takes at most 1 positional arguments ({len(args)} given)" + ) + other = args[0] if len(args) >= 1 else () + + if isinstance(other, HTTPHeaderDict): + for key, val in other.iteritems(): + self.add(key, val) + elif isinstance(other, typing.Mapping): + for key, val in other.items(): + self.add(key, val) + elif isinstance(other, typing.Iterable): + other = typing.cast(typing.Iterable[typing.Tuple[str, str]], other) + for key, value in other: + self.add(key, value) + elif hasattr(other, "keys") and hasattr(other, "__getitem__"): + # THIS IS NOT A TYPESAFE BRANCH + # In this branch, the object has a `keys` attr but is not a Mapping or any of + # the other types indicated in the method signature. We do some stuff with + # it as though it partially implements the Mapping interface, but we're not + # doing that stuff safely AT ALL. + for key in other.keys(): + self.add(key, other[key]) + + for key, value in kwargs.items(): + self.add(key, value) + + @typing.overload + def getlist(self, key: str) -> list[str]: + ... + + @typing.overload + def getlist(self, key: str, default: _DT) -> list[str] | _DT: + ... + + def getlist( + self, key: str, default: _Sentinel | _DT = _Sentinel.not_passed + ) -> list[str] | _DT: + """Returns a list of all the values for the named field. Returns an + empty list if the key doesn't exist.""" + try: + vals = self._container[key.lower()] + except KeyError: + if default is _Sentinel.not_passed: + # _DT is unbound; empty list is instance of List[str] + return [] + # _DT is bound; default is instance of _DT + return default + else: + # _DT may or may not be bound; vals[1:] is instance of List[str], which + # meets our external interface requirement of `Union[List[str], _DT]`. + return vals[1:] + + # Backwards compatibility for httplib + getheaders = getlist + getallmatchingheaders = getlist + iget = getlist + + # Backwards compatibility for http.cookiejar + get_all = getlist + + def __repr__(self) -> str: + return f"{type(self).__name__}({dict(self.itermerged())})" + + def _copy_from(self, other: HTTPHeaderDict) -> None: + for key in other: + val = other.getlist(key) + self._container[key.lower()] = [key, *val] + + def copy(self) -> HTTPHeaderDict: + clone = type(self)() + clone._copy_from(self) + return clone + + def iteritems(self) -> typing.Iterator[tuple[str, str]]: + """Iterate over all header lines, including duplicate ones.""" + for key in self: + vals = self._container[key.lower()] + for val in vals[1:]: + yield vals[0], val + + def itermerged(self) -> typing.Iterator[tuple[str, str]]: + """Iterate over all headers, merging duplicate ones together.""" + for key in self: + val = self._container[key.lower()] + yield val[0], ", ".join(val[1:]) + + def items(self) -> HTTPHeaderDictItemView: # type: ignore[override] + return HTTPHeaderDictItemView(self) + + def _has_value_for_header(self, header_name: str, potential_value: str) -> bool: + if header_name in self: + return potential_value in self._container[header_name.lower()][1:] + return False + + def __ior__(self, other: object) -> HTTPHeaderDict: + # Supports extending a header dict in-place using operator |= + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + self.extend(maybe_constructable) + return self + + def __or__(self, other: object) -> HTTPHeaderDict: + # Supports merging header dicts using operator | + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + result = self.copy() + result.extend(maybe_constructable) + return result + + def __ror__(self, other: object) -> HTTPHeaderDict: + # Supports merging header dicts using operator | when other is on left side + # combining items with add instead of __setitem__ + maybe_constructable = ensure_can_construct_http_header_dict(other) + if maybe_constructable is None: + return NotImplemented + result = type(self)(maybe_constructable) + result.extend(self) + return result diff --git a/requests/python/urllib3/_request_methods.py b/requests/python/urllib3/_request_methods.py new file mode 100644 index 0000000..1d0f346 --- /dev/null +++ b/requests/python/urllib3/_request_methods.py @@ -0,0 +1,217 @@ +from __future__ import annotations + +import json as _json +import typing +from urllib.parse import urlencode + +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from .filepost import _TYPE_FIELDS, encode_multipart_formdata +from .response import BaseHTTPResponse + +__all__ = ["RequestMethods"] + +_TYPE_ENCODE_URL_FIELDS = typing.Union[ + typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]], + typing.Mapping[str, typing.Union[str, bytes]], +] + + +class RequestMethods: + """ + Convenience mixin for classes who implement a :meth:`urlopen` method, such + as :class:`urllib3.HTTPConnectionPool` and + :class:`urllib3.PoolManager`. + + Provides behavior for making common types of HTTP request methods and + decides which type of request field encoding to use. + + Specifically, + + :meth:`.request_encode_url` is for sending requests whose fields are + encoded in the URL (such as GET, HEAD, DELETE). + + :meth:`.request_encode_body` is for sending requests whose fields are + encoded in the *body* of the request using multipart or www-form-urlencoded + (such as for POST, PUT, PATCH). + + :meth:`.request` is for making any kind of request, it will look up the + appropriate encoding format and use one of the above two methods to make + the request. + + Initializer parameters: + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + """ + + _encode_url_methods = {"DELETE", "GET", "HEAD", "OPTIONS"} + + def __init__(self, headers: typing.Mapping[str, str] | None = None) -> None: + self.headers = headers or {} + + def urlopen( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + encode_multipart: bool = True, + multipart_boundary: str | None = None, + **kw: typing.Any, + ) -> BaseHTTPResponse: # Abstract + raise NotImplementedError( + "Classes extending RequestMethods must implement " + "their own ``urlopen`` method." + ) + + def request( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + json: typing.Any | None = None, + **urlopen_kw: typing.Any, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the appropriate encoding of + ``fields`` based on the ``method`` used. + + This is a convenience method that requires the least amount of manual + effort. It can be used in most situations, while still having the + option to drop down to more specific methods when necessary, such as + :meth:`request_encode_url`, :meth:`request_encode_body`, + or even the lowest level :meth:`urlopen`. + """ + method = method.upper() + + if json is not None and body is not None: + raise TypeError( + "request got values for both 'body' and 'json' parameters which are mutually exclusive" + ) + + if json is not None: + if headers is None: + headers = self.headers.copy() # type: ignore + if not ("content-type" in map(str.lower, headers.keys())): + headers["Content-Type"] = "application/json" # type: ignore + + body = _json.dumps(json, separators=(",", ":"), ensure_ascii=False).encode( + "utf-8" + ) + + if body is not None: + urlopen_kw["body"] = body + + if method in self._encode_url_methods: + return self.request_encode_url( + method, + url, + fields=fields, # type: ignore[arg-type] + headers=headers, + **urlopen_kw, + ) + else: + return self.request_encode_body( + method, url, fields=fields, headers=headers, **urlopen_kw + ) + + def request_encode_url( + self, + method: str, + url: str, + fields: _TYPE_ENCODE_URL_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + **urlopen_kw: str, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the ``fields`` encoded in + the url. This is useful for request methods like GET, HEAD, DELETE, etc. + """ + if headers is None: + headers = self.headers + + extra_kw: dict[str, typing.Any] = {"headers": headers} + extra_kw.update(urlopen_kw) + + if fields: + url += "?" + urlencode(fields) + + return self.urlopen(method, url, **extra_kw) + + def request_encode_body( + self, + method: str, + url: str, + fields: _TYPE_FIELDS | None = None, + headers: typing.Mapping[str, str] | None = None, + encode_multipart: bool = True, + multipart_boundary: str | None = None, + **urlopen_kw: str, + ) -> BaseHTTPResponse: + """ + Make a request using :meth:`urlopen` with the ``fields`` encoded in + the body. This is useful for request methods like POST, PUT, PATCH, etc. + + When ``encode_multipart=True`` (default), then + :func:`urllib3.encode_multipart_formdata` is used to encode + the payload with the appropriate content type. Otherwise + :func:`urllib.parse.urlencode` is used with the + 'application/x-www-form-urlencoded' content type. + + Multipart encoding must be used when posting files, and it's reasonably + safe to use it in other times too. However, it may break request + signing, such as with OAuth. + + Supports an optional ``fields`` parameter of key/value strings AND + key/filetuple. A filetuple is a (filename, data, MIME type) tuple where + the MIME type is optional. For example:: + + fields = { + 'foo': 'bar', + 'fakefile': ('foofile.txt', 'contents of foofile'), + 'realfile': ('barfile.txt', open('realfile').read()), + 'typedfile': ('bazfile.bin', open('bazfile').read(), + 'image/jpeg'), + 'nonamefile': 'contents of nonamefile field', + } + + When uploading a file, providing a filename (the first parameter of the + tuple) is optional but recommended to best mimic behavior of browsers. + + Note that if ``headers`` are supplied, the 'Content-Type' header will + be overwritten because it depends on the dynamic random boundary string + which is used to compose the body of the request. The random boundary + string can be explicitly set with the ``multipart_boundary`` parameter. + """ + if headers is None: + headers = self.headers + + extra_kw: dict[str, typing.Any] = {"headers": HTTPHeaderDict(headers)} + body: bytes | str + + if fields: + if "body" in urlopen_kw: + raise TypeError( + "request got values for both 'fields' and 'body', can only specify one." + ) + + if encode_multipart: + body, content_type = encode_multipart_formdata( + fields, boundary=multipart_boundary + ) + else: + body, content_type = ( + urlencode(fields), # type: ignore[arg-type] + "application/x-www-form-urlencoded", + ) + + extra_kw["body"] = body + extra_kw["headers"].setdefault("Content-Type", content_type) + + extra_kw.update(urlopen_kw) + + return self.urlopen(method, url, **extra_kw) diff --git a/requests/python/urllib3/_version.py b/requests/python/urllib3/_version.py new file mode 100644 index 0000000..782af43 --- /dev/null +++ b/requests/python/urllib3/_version.py @@ -0,0 +1,4 @@ +# This file is protected via CODEOWNERS +from __future__ import annotations + +__version__ = "2.0.4" diff --git a/requests/python/urllib3/connection.py b/requests/python/urllib3/connection.py new file mode 100644 index 0000000..10109fa --- /dev/null +++ b/requests/python/urllib3/connection.py @@ -0,0 +1,906 @@ +from __future__ import annotations + +import datetime +import logging +import os +import re +import socket +import sys +import typing +import warnings +from http.client import HTTPConnection as _HTTPConnection +from http.client import HTTPException as HTTPException # noqa: F401 +from http.client import ResponseNotReady +from socket import timeout as SocketTimeout + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + + from .response import HTTPResponse + from .util.ssl_ import _TYPE_PEER_CERT_RET_DICT + from .util.ssltransport import SSLTransport + +from ._collections import HTTPHeaderDict +from .util.response import assert_header_parsing +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT, Timeout +from .util.util import to_str +from .util.wait import wait_for_read + +try: # Compiled with SSL? + import ssl + + BaseSSLError = ssl.SSLError +except (ImportError, AttributeError): + ssl = None # type: ignore[assignment] + + class BaseSSLError(BaseException): # type: ignore[no-redef] + pass + + +from ._base_connection import _TYPE_BODY +from ._base_connection import ProxyConfig as ProxyConfig +from ._base_connection import _ResponseOptions as _ResponseOptions +from ._version import __version__ +from .exceptions import ( + ConnectTimeoutError, + HeaderParsingError, + NameResolutionError, + NewConnectionError, + ProxyError, + SystemTimeWarning, +) +from .util import SKIP_HEADER, SKIPPABLE_HEADERS, connection, ssl_ +from .util.request import body_to_chunks +from .util.ssl_ import assert_fingerprint as _assert_fingerprint +from .util.ssl_ import ( + create_urllib3_context, + is_ipaddress, + resolve_cert_reqs, + resolve_ssl_version, + ssl_wrap_socket, +) +from .util.ssl_match_hostname import CertificateError, match_hostname +from .util.url import Url + +# Not a no-op, we're adding this to the namespace so it can be imported. +ConnectionError = ConnectionError +BrokenPipeError = BrokenPipeError + + +log = logging.getLogger(__name__) + +port_by_scheme = {"http": 80, "https": 443} + +# When it comes time to update this value as a part of regular maintenance +# (ie test_recent_date is failing) update it to ~6 months before the current date. +RECENT_DATE = datetime.date(2022, 1, 1) + +_CONTAINS_CONTROL_CHAR_RE = re.compile(r"[^-!#$%&'*+.^_`|~0-9a-zA-Z]") + +_HAS_SYS_AUDIT = hasattr(sys, "audit") + + +class HTTPConnection(_HTTPConnection): + """ + Based on :class:`http.client.HTTPConnection` but provides an extra constructor + backwards-compatibility layer between older and newer Pythons. + + Additional keyword parameters are used to configure attributes of the connection. + Accepted parameters include: + + - ``source_address``: Set the source address for the current connection. + - ``socket_options``: Set specific options on the underlying socket. If not specified, then + defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling + Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy. + + For example, if you wish to enable TCP Keep Alive in addition to the defaults, + you might pass: + + .. code-block:: python + + HTTPConnection.default_socket_options + [ + (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), + ] + + Or you may want to disable the defaults by passing an empty list (e.g., ``[]``). + """ + + default_port: typing.ClassVar[int] = port_by_scheme["http"] # type: ignore[misc] + + #: Disable Nagle's algorithm by default. + #: ``[(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]`` + default_socket_options: typing.ClassVar[connection._TYPE_SOCKET_OPTIONS] = [ + (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + ] + + #: Whether this connection verifies the host's certificate. + is_verified: bool = False + + #: Whether this proxy connection verified the proxy host's certificate. + # If no proxy is currently connected to the value will be ``None``. + proxy_is_verified: bool | None = None + + blocksize: int + source_address: tuple[str, int] | None + socket_options: connection._TYPE_SOCKET_OPTIONS | None + + _has_connected_to_proxy: bool + _response_options: _ResponseOptions | None + _tunnel_host: str | None + _tunnel_port: int | None + _tunnel_scheme: str | None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: None + | (connection._TYPE_SOCKET_OPTIONS) = default_socket_options, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + ) -> None: + super().__init__( + host=host, + port=port, + timeout=Timeout.resolve_default_timeout(timeout), + source_address=source_address, + blocksize=blocksize, + ) + self.socket_options = socket_options + self.proxy = proxy + self.proxy_config = proxy_config + + self._has_connected_to_proxy = False + self._response_options = None + self._tunnel_host: str | None = None + self._tunnel_port: int | None = None + self._tunnel_scheme: str | None = None + + # https://github.com/python/mypy/issues/4125 + # Mypy treats this as LSP violation, which is considered a bug. + # If `host` is made a property it violates LSP, because a writeable attribute is overridden with a read-only one. + # However, there is also a `host` setter so LSP is not violated. + # Potentially, a `@host.deleter` might be needed depending on how this issue will be fixed. + @property + def host(self) -> str: + """ + Getter method to remove any trailing dots that indicate the hostname is an FQDN. + + In general, SSL certificates don't include the trailing dot indicating a + fully-qualified domain name, and thus, they don't validate properly when + checked against a domain name that includes the dot. In addition, some + servers may not expect to receive the trailing dot when provided. + + However, the hostname with trailing dot is critical to DNS resolution; doing a + lookup with the trailing dot will properly only resolve the appropriate FQDN, + whereas a lookup without a trailing dot will search the system's search domain + list. Thus, it's important to keep the original host around for use only in + those cases where it's appropriate (i.e., when doing DNS lookup to establish the + actual TCP connection across which we're going to send HTTP requests). + """ + return self._dns_host.rstrip(".") + + @host.setter + def host(self, value: str) -> None: + """ + Setter for the `host` property. + + We assume that only urllib3 uses the _dns_host attribute; httplib itself + only uses `host`, and it seems reasonable that other libraries follow suit. + """ + self._dns_host = value + + def _new_conn(self) -> socket.socket: + """Establish a socket connection and set nodelay settings on it. + + :return: New socket connection. + """ + try: + sock = connection.create_connection( + (self._dns_host, self.port), + self.timeout, + source_address=self.source_address, + socket_options=self.socket_options, + ) + except socket.gaierror as e: + raise NameResolutionError(self.host, self, e) from e + except SocketTimeout as e: + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + + except OSError as e: + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + # Audit hooks are only available in Python 3.8+ + if _HAS_SYS_AUDIT: + sys.audit("http.client.connect", self, self.host, self.port) + + return sock + + def set_tunnel( + self, + host: str, + port: int | None = None, + headers: typing.Mapping[str, str] | None = None, + scheme: str = "http", + ) -> None: + if scheme not in ("http", "https"): + raise ValueError( + f"Invalid proxy scheme for tunneling: {scheme!r}, must be either 'http' or 'https'" + ) + super().set_tunnel(host, port=port, headers=headers) + self._tunnel_scheme = scheme + + def connect(self) -> None: + self.sock = self._new_conn() + if self._tunnel_host: + # If we're tunneling it means we're connected to our proxy. + self._has_connected_to_proxy = True + + # TODO: Fix tunnel so it doesn't depend on self.sock state. + self._tunnel() # type: ignore[attr-defined] + + # If there's a proxy to be connected to we are fully connected. + # This is set twice (once above and here) due to forwarding proxies + # not using tunnelling. + self._has_connected_to_proxy = bool(self.proxy) + + @property + def is_closed(self) -> bool: + return self.sock is None + + @property + def is_connected(self) -> bool: + if self.sock is None: + return False + return not wait_for_read(self.sock, timeout=0.0) + + @property + def has_connected_to_proxy(self) -> bool: + return self._has_connected_to_proxy + + def close(self) -> None: + try: + super().close() + finally: + # Reset all stateful properties so connection + # can be re-used without leaking prior configs. + self.sock = None + self.is_verified = False + self.proxy_is_verified = None + self._has_connected_to_proxy = False + self._response_options = None + self._tunnel_host = None + self._tunnel_port = None + self._tunnel_scheme = None + + def putrequest( + self, + method: str, + url: str, + skip_host: bool = False, + skip_accept_encoding: bool = False, + ) -> None: + """""" + # Empty docstring because the indentation of CPython's implementation + # is broken but we don't want this method in our documentation. + match = _CONTAINS_CONTROL_CHAR_RE.search(method) + if match: + raise ValueError( + f"Method cannot contain non-token characters {method!r} (found at least {match.group()!r})" + ) + + return super().putrequest( + method, url, skip_host=skip_host, skip_accept_encoding=skip_accept_encoding + ) + + def putheader(self, header: str, *values: str) -> None: + """""" + if not any(isinstance(v, str) and v == SKIP_HEADER for v in values): + super().putheader(header, *values) + elif to_str(header.lower()) not in SKIPPABLE_HEADERS: + skippable_headers = "', '".join( + [str.title(header) for header in sorted(SKIPPABLE_HEADERS)] + ) + raise ValueError( + f"urllib3.util.SKIP_HEADER only supports '{skippable_headers}'" + ) + + # `request` method's signature intentionally violates LSP. + # urllib3's API is different from `http.client.HTTPConnection` and the subclassing is only incidental. + def request( # type: ignore[override] + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + *, + chunked: bool = False, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> None: + # Update the inner socket's timeout value to send the request. + # This only triggers if the connection is re-used. + if self.sock is not None: + self.sock.settimeout(self.timeout) + + # Store these values to be fed into the HTTPResponse + # object later. TODO: Remove this in favor of a real + # HTTP lifecycle mechanism. + + # We have to store these before we call .request() + # because sometimes we can still salvage a response + # off the wire even if we aren't able to completely + # send the request body. + self._response_options = _ResponseOptions( + request_method=method, + request_url=url, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + if headers is None: + headers = {} + header_keys = frozenset(to_str(k.lower()) for k in headers) + skip_accept_encoding = "accept-encoding" in header_keys + skip_host = "host" in header_keys + self.putrequest( + method, url, skip_accept_encoding=skip_accept_encoding, skip_host=skip_host + ) + + # Transform the body into an iterable of sendall()-able chunks + # and detect if an explicit Content-Length is doable. + chunks_and_cl = body_to_chunks(body, method=method, blocksize=self.blocksize) + chunks = chunks_and_cl.chunks + content_length = chunks_and_cl.content_length + + # When chunked is explicit set to 'True' we respect that. + if chunked: + if "transfer-encoding" not in header_keys: + self.putheader("Transfer-Encoding", "chunked") + else: + # Detect whether a framing mechanism is already in use. If so + # we respect that value, otherwise we pick chunked vs content-length + # depending on the type of 'body'. + if "content-length" in header_keys: + chunked = False + elif "transfer-encoding" in header_keys: + chunked = True + + # Otherwise we go off the recommendation of 'body_to_chunks()'. + else: + chunked = False + if content_length is None: + if chunks is not None: + chunked = True + self.putheader("Transfer-Encoding", "chunked") + else: + self.putheader("Content-Length", str(content_length)) + + # Now that framing headers are out of the way we send all the other headers. + if "user-agent" not in header_keys: + self.putheader("User-Agent", _get_default_user_agent()) + for header, value in headers.items(): + self.putheader(header, value) + self.endheaders() + + # If we're given a body we start sending that in chunks. + if chunks is not None: + for chunk in chunks: + # Sending empty chunks isn't allowed for TE: chunked + # as it indicates the end of the body. + if not chunk: + continue + if isinstance(chunk, str): + chunk = chunk.encode("utf-8") + if chunked: + self.send(b"%x\r\n%b\r\n" % (len(chunk), chunk)) + else: + self.send(chunk) + + # Regardless of whether we have a body or not, if we're in + # chunked mode we want to send an explicit empty chunk. + if chunked: + self.send(b"0\r\n\r\n") + + def request_chunked( + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + ) -> None: + """ + Alternative to the common request method, which sends the + body with chunked encoding and not as one block + """ + warnings.warn( + "HTTPConnection.request_chunked() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead use HTTPConnection.request(..., chunked=True).", + category=DeprecationWarning, + stacklevel=2, + ) + self.request(method, url, body=body, headers=headers, chunked=True) + + def getresponse( # type: ignore[override] + self, + ) -> HTTPResponse: + """ + Get the response from the server. + + If the HTTPConnection is in the correct state, returns an instance of HTTPResponse or of whatever object is returned by the response_class variable. + + If a request has not been sent or if a previous response has not be handled, ResponseNotReady is raised. If the HTTP response indicates that the connection should be closed, then it will be closed before the response is returned. When the connection is closed, the underlying socket is closed. + """ + # Raise the same error as http.client.HTTPConnection + if self._response_options is None: + raise ResponseNotReady() + + # Reset this attribute for being used again. + resp_options = self._response_options + self._response_options = None + + # Since the connection's timeout value may have been updated + # we need to set the timeout on the socket. + self.sock.settimeout(self.timeout) + + # This is needed here to avoid circular import errors + from .response import HTTPResponse + + # Get the response from http.client.HTTPConnection + httplib_response = super().getresponse() + + try: + assert_header_parsing(httplib_response.msg) + except (HeaderParsingError, TypeError) as hpe: + log.warning( + "Failed to parse headers (url=%s): %s", + _url_from_connection(self, resp_options.request_url), + hpe, + exc_info=True, + ) + + headers = HTTPHeaderDict(httplib_response.msg.items()) + + response = HTTPResponse( + body=httplib_response, + headers=headers, + status=httplib_response.status, + version=httplib_response.version, + reason=httplib_response.reason, + preload_content=resp_options.preload_content, + decode_content=resp_options.decode_content, + original_response=httplib_response, + enforce_content_length=resp_options.enforce_content_length, + request_method=resp_options.request_method, + request_url=resp_options.request_url, + ) + return response + + +class HTTPSConnection(HTTPConnection): + """ + Many of the parameters to this constructor are passed to the underlying SSL + socket by means of :py:func:`urllib3.util.ssl_wrap_socket`. + """ + + default_port = port_by_scheme["https"] # type: ignore[misc] + + cert_reqs: int | str | None = None + ca_certs: str | None = None + ca_cert_dir: str | None = None + ca_cert_data: None | str | bytes = None + ssl_version: int | str | None = None + ssl_minimum_version: int | None = None + ssl_maximum_version: int | None = None + assert_fingerprint: str | None = None + + def __init__( + self, + host: str, + port: int | None = None, + *, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, + socket_options: None + | (connection._TYPE_SOCKET_OPTIONS) = HTTPConnection.default_socket_options, + proxy: Url | None = None, + proxy_config: ProxyConfig | None = None, + cert_reqs: int | str | None = None, + assert_hostname: None | str | Literal[False] = None, + assert_fingerprint: str | None = None, + server_hostname: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_certs: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, + ssl_version: int | str | None = None, # Deprecated + cert_file: str | None = None, + key_file: str | None = None, + key_password: str | None = None, + ) -> None: + super().__init__( + host, + port=port, + timeout=timeout, + source_address=source_address, + blocksize=blocksize, + socket_options=socket_options, + proxy=proxy, + proxy_config=proxy_config, + ) + + self.key_file = key_file + self.cert_file = cert_file + self.key_password = key_password + self.ssl_context = ssl_context + self.server_hostname = server_hostname + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + self.ssl_version = ssl_version + self.ssl_minimum_version = ssl_minimum_version + self.ssl_maximum_version = ssl_maximum_version + self.ca_certs = ca_certs and os.path.expanduser(ca_certs) + self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) + self.ca_cert_data = ca_cert_data + + # cert_reqs depends on ssl_context so calculate last. + if cert_reqs is None: + if self.ssl_context is not None: + cert_reqs = self.ssl_context.verify_mode + else: + cert_reqs = resolve_cert_reqs(None) + self.cert_reqs = cert_reqs + + def set_cert( + self, + key_file: str | None = None, + cert_file: str | None = None, + cert_reqs: int | str | None = None, + key_password: str | None = None, + ca_certs: str | None = None, + assert_hostname: None | str | Literal[False] = None, + assert_fingerprint: str | None = None, + ca_cert_dir: str | None = None, + ca_cert_data: None | str | bytes = None, + ) -> None: + """ + This method should only be called once, before the connection is used. + """ + warnings.warn( + "HTTPSConnection.set_cert() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead provide the parameters to the " + "HTTPSConnection constructor.", + category=DeprecationWarning, + stacklevel=2, + ) + + # If cert_reqs is not provided we'll assume CERT_REQUIRED unless we also + # have an SSLContext object in which case we'll use its verify_mode. + if cert_reqs is None: + if self.ssl_context is not None: + cert_reqs = self.ssl_context.verify_mode + else: + cert_reqs = resolve_cert_reqs(None) + + self.key_file = key_file + self.cert_file = cert_file + self.cert_reqs = cert_reqs + self.key_password = key_password + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + self.ca_certs = ca_certs and os.path.expanduser(ca_certs) + self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir) + self.ca_cert_data = ca_cert_data + + def connect(self) -> None: + sock: socket.socket | ssl.SSLSocket + self.sock = sock = self._new_conn() + server_hostname: str = self.host + tls_in_tls = False + + # Do we need to establish a tunnel? + if self._tunnel_host is not None: + # We're tunneling to an HTTPS origin so need to do TLS-in-TLS. + if self._tunnel_scheme == "https": + self.sock = sock = self._connect_tls_proxy(self.host, sock) + tls_in_tls = True + + # If we're tunneling it means we're connected to our proxy. + self._has_connected_to_proxy = True + + self._tunnel() # type: ignore[attr-defined] + # Override the host with the one we're requesting data from. + server_hostname = self._tunnel_host + + if self.server_hostname is not None: + server_hostname = self.server_hostname + + is_time_off = datetime.date.today() < RECENT_DATE + if is_time_off: + warnings.warn( + ( + f"System time is way off (before {RECENT_DATE}). This will probably " + "lead to SSL verification errors" + ), + SystemTimeWarning, + ) + + sock_and_verified = _ssl_wrap_socket_and_match_hostname( + sock=sock, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + ca_cert_data=self.ca_cert_data, + cert_file=self.cert_file, + key_file=self.key_file, + key_password=self.key_password, + server_hostname=server_hostname, + ssl_context=self.ssl_context, + tls_in_tls=tls_in_tls, + assert_hostname=self.assert_hostname, + assert_fingerprint=self.assert_fingerprint, + ) + self.sock = sock_and_verified.socket + self.is_verified = sock_and_verified.is_verified + + # If there's a proxy to be connected to we are fully connected. + # This is set twice (once above and here) due to forwarding proxies + # not using tunnelling. + self._has_connected_to_proxy = bool(self.proxy) + + def _connect_tls_proxy(self, hostname: str, sock: socket.socket) -> ssl.SSLSocket: + """ + Establish a TLS connection to the proxy using the provided SSL context. + """ + # `_connect_tls_proxy` is called when self._tunnel_host is truthy. + proxy_config = typing.cast(ProxyConfig, self.proxy_config) + ssl_context = proxy_config.ssl_context + sock_and_verified = _ssl_wrap_socket_and_match_hostname( + sock, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + ca_cert_data=self.ca_cert_data, + server_hostname=hostname, + ssl_context=ssl_context, + assert_hostname=proxy_config.assert_hostname, + assert_fingerprint=proxy_config.assert_fingerprint, + # Features that aren't implemented for proxies yet: + cert_file=None, + key_file=None, + key_password=None, + tls_in_tls=False, + ) + self.proxy_is_verified = sock_and_verified.is_verified + return sock_and_verified.socket # type: ignore[return-value] + + +class _WrappedAndVerifiedSocket(typing.NamedTuple): + """ + Wrapped socket and whether the connection is + verified after the TLS handshake + """ + + socket: ssl.SSLSocket | SSLTransport + is_verified: bool + + +def _ssl_wrap_socket_and_match_hostname( + sock: socket.socket, + *, + cert_reqs: None | str | int, + ssl_version: None | str | int, + ssl_minimum_version: int | None, + ssl_maximum_version: int | None, + cert_file: str | None, + key_file: str | None, + key_password: str | None, + ca_certs: str | None, + ca_cert_dir: str | None, + ca_cert_data: None | str | bytes, + assert_hostname: None | str | Literal[False], + assert_fingerprint: str | None, + server_hostname: str | None, + ssl_context: ssl.SSLContext | None, + tls_in_tls: bool = False, +) -> _WrappedAndVerifiedSocket: + """Logic for constructing an SSLContext from all TLS parameters, passing + that down into ssl_wrap_socket, and then doing certificate verification + either via hostname or fingerprint. This function exists to guarantee + that both proxies and targets have the same behavior when connecting via TLS. + """ + default_ssl_context = False + if ssl_context is None: + default_ssl_context = True + context = create_urllib3_context( + ssl_version=resolve_ssl_version(ssl_version), + ssl_minimum_version=ssl_minimum_version, + ssl_maximum_version=ssl_maximum_version, + cert_reqs=resolve_cert_reqs(cert_reqs), + ) + else: + context = ssl_context + + context.verify_mode = resolve_cert_reqs(cert_reqs) + + # In some cases, we want to verify hostnames ourselves + if ( + # `ssl` can't verify fingerprints or alternate hostnames + assert_fingerprint + or assert_hostname + # assert_hostname can be set to False to disable hostname checking + or assert_hostname is False + # We still support OpenSSL 1.0.2, which prevents us from verifying + # hostnames easily: https://github.com/pyca/pyopenssl/pull/933 + or ssl_.IS_PYOPENSSL + or not ssl_.HAS_NEVER_CHECK_COMMON_NAME + ): + context.check_hostname = False + + # Try to load OS default certs if none are given. + # We need to do the hasattr() check for our custom + # pyOpenSSL and SecureTransport SSLContext objects + # because neither support load_default_certs(). + if ( + not ca_certs + and not ca_cert_dir + and not ca_cert_data + and default_ssl_context + and hasattr(context, "load_default_certs") + ): + context.load_default_certs() + + # Ensure that IPv6 addresses are in the proper format and don't have a + # scope ID. Python's SSL module fails to recognize scoped IPv6 addresses + # and interprets them as DNS hostnames. + if server_hostname is not None: + normalized = server_hostname.strip("[]") + if "%" in normalized: + normalized = normalized[: normalized.rfind("%")] + if is_ipaddress(normalized): + server_hostname = normalized + + ssl_sock = ssl_wrap_socket( + sock=sock, + keyfile=key_file, + certfile=cert_file, + key_password=key_password, + ca_certs=ca_certs, + ca_cert_dir=ca_cert_dir, + ca_cert_data=ca_cert_data, + server_hostname=server_hostname, + ssl_context=context, + tls_in_tls=tls_in_tls, + ) + + try: + if assert_fingerprint: + _assert_fingerprint( + ssl_sock.getpeercert(binary_form=True), assert_fingerprint + ) + elif ( + context.verify_mode != ssl.CERT_NONE + and not context.check_hostname + and assert_hostname is not False + ): + cert: _TYPE_PEER_CERT_RET_DICT = ssl_sock.getpeercert() # type: ignore[assignment] + + # Need to signal to our match_hostname whether to use 'commonName' or not. + # If we're using our own constructed SSLContext we explicitly set 'False' + # because PyPy hard-codes 'True' from SSLContext.hostname_checks_common_name. + if default_ssl_context: + hostname_checks_common_name = False + else: + hostname_checks_common_name = ( + getattr(context, "hostname_checks_common_name", False) or False + ) + + _match_hostname( + cert, + assert_hostname or server_hostname, # type: ignore[arg-type] + hostname_checks_common_name, + ) + + return _WrappedAndVerifiedSocket( + socket=ssl_sock, + is_verified=context.verify_mode == ssl.CERT_REQUIRED + or bool(assert_fingerprint), + ) + except BaseException: + ssl_sock.close() + raise + + +def _match_hostname( + cert: _TYPE_PEER_CERT_RET_DICT | None, + asserted_hostname: str, + hostname_checks_common_name: bool = False, +) -> None: + # Our upstream implementation of ssl.match_hostname() + # only applies this normalization to IP addresses so it doesn't + # match DNS SANs so we do the same thing! + stripped_hostname = asserted_hostname.strip("[]") + if is_ipaddress(stripped_hostname): + asserted_hostname = stripped_hostname + + try: + match_hostname(cert, asserted_hostname, hostname_checks_common_name) + except CertificateError as e: + log.warning( + "Certificate did not match expected hostname: %s. Certificate: %s", + asserted_hostname, + cert, + ) + # Add cert to exception and reraise so client code can inspect + # the cert when catching the exception, if they want to + e._peer_cert = cert # type: ignore[attr-defined] + raise + + +def _wrap_proxy_error(err: Exception, proxy_scheme: str | None) -> ProxyError: + # Look for the phrase 'wrong version number', if found + # then we should warn the user that we're very sure that + # this proxy is HTTP-only and they have a configuration issue. + error_normalized = " ".join(re.split("[^a-z]", str(err).lower())) + is_likely_http_proxy = ( + "wrong version number" in error_normalized + or "unknown protocol" in error_normalized + ) + http_proxy_warning = ( + ". Your proxy appears to only use HTTP and not HTTPS, " + "try changing your proxy URL to be HTTP. See: " + "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" + "#https-proxy-error-http-proxy" + ) + new_err = ProxyError( + f"Unable to connect to proxy" + f"{http_proxy_warning if is_likely_http_proxy and proxy_scheme == 'https' else ''}", + err, + ) + new_err.__cause__ = err + return new_err + + +def _get_default_user_agent() -> str: + return f"python-urllib3/{__version__}" + + +class DummyConnection: + """Used to detect a failed ConnectionCls import.""" + + +if not ssl: + HTTPSConnection = DummyConnection # type: ignore[misc, assignment] # noqa: F811 + + +VerifiedHTTPSConnection = HTTPSConnection + + +def _url_from_connection( + conn: HTTPConnection | HTTPSConnection, path: str | None = None +) -> str: + """Returns the URL from a given connection. This is mainly used for testing and logging.""" + + scheme = "https" if isinstance(conn, HTTPSConnection) else "http" + + return Url(scheme=scheme, host=conn.host, port=conn.port, path=path).url diff --git a/requests/python/urllib3/connectionpool.py b/requests/python/urllib3/connectionpool.py new file mode 100644 index 0000000..2479405 --- /dev/null +++ b/requests/python/urllib3/connectionpool.py @@ -0,0 +1,1178 @@ +from __future__ import annotations + +import errno +import logging +import queue +import sys +import typing +import warnings +import weakref +from socket import timeout as SocketTimeout +from types import TracebackType + +from ._base_connection import _TYPE_BODY +from ._request_methods import RequestMethods +from .connection import ( + BaseSSLError, + BrokenPipeError, + DummyConnection, + HTTPConnection, + HTTPException, + HTTPSConnection, + ProxyConfig, + _wrap_proxy_error, +) +from .connection import port_by_scheme as port_by_scheme +from .exceptions import ( + ClosedPoolError, + EmptyPoolError, + FullPoolError, + HostChangedError, + InsecureRequestWarning, + LocationValueError, + MaxRetryError, + NewConnectionError, + ProtocolError, + ProxyError, + ReadTimeoutError, + SSLError, + TimeoutError, +) +from .response import BaseHTTPResponse +from .util.connection import is_connection_dropped +from .util.proxy import connection_requires_http_tunnel +from .util.request import _TYPE_BODY_POSITION, set_file_position +from .util.retry import Retry +from .util.ssl_match_hostname import CertificateError +from .util.timeout import _DEFAULT_TIMEOUT, _TYPE_DEFAULT, Timeout +from .util.url import Url, _encode_target +from .util.url import _normalize_host as normalize_host +from .util.url import parse_url +from .util.util import to_str + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Literal + + from ._base_connection import BaseHTTPConnection, BaseHTTPSConnection + +log = logging.getLogger(__name__) + +_TYPE_TIMEOUT = typing.Union[Timeout, float, _TYPE_DEFAULT, None] + +_SelfT = typing.TypeVar("_SelfT") + + +# Pool objects +class ConnectionPool: + """ + Base class for all connection pools, such as + :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. + + .. note:: + ConnectionPool.urlopen() does not normalize or percent-encode target URIs + which is useful if your target server doesn't support percent-encoded + target URIs. + """ + + scheme: str | None = None + QueueCls = queue.LifoQueue + + def __init__(self, host: str, port: int | None = None) -> None: + if not host: + raise LocationValueError("No host specified.") + + self.host = _normalize_host(host, scheme=self.scheme) + self.port = port + + # This property uses 'normalize_host()' (not '_normalize_host()') + # to avoid removing square braces around IPv6 addresses. + # This value is sent to `HTTPConnection.set_tunnel()` if called + # because square braces are required for HTTP CONNECT tunneling. + self._tunnel_host = normalize_host(host, scheme=self.scheme).lower() + + def __str__(self) -> str: + return f"{type(self).__name__}(host={self.host!r}, port={self.port!r})" + + def __enter__(self: _SelfT) -> _SelfT: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> Literal[False]: + self.close() + # Return False to re-raise any potential exceptions + return False + + def close(self) -> None: + """ + Close all pooled connections and disable the pool. + """ + + +# This is taken from http://hg.python.org/cpython/file/7aaba721ebc0/Lib/socket.py#l252 +_blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK} + + +class HTTPConnectionPool(ConnectionPool, RequestMethods): + """ + Thread-safe connection pool for one host. + + :param host: + Host used for this HTTP Connection (e.g. "localhost"), passed into + :class:`http.client.HTTPConnection`. + + :param port: + Port used for this HTTP Connection (None is equivalent to 80), passed + into :class:`http.client.HTTPConnection`. + + :param timeout: + Socket timeout in seconds for each individual connection. This can + be a float or integer, which sets the timeout for the HTTP request, + or an instance of :class:`urllib3.util.Timeout` which gives you more + fine-grained control over request timeouts. After the constructor has + been parsed, this is always a `urllib3.util.Timeout` object. + + :param maxsize: + Number of connections to save that can be reused. More than 1 is useful + in multithreaded situations. If ``block`` is set to False, more + connections will be created but they will not be saved once they've + been used. + + :param block: + If set to True, no more than ``maxsize`` connections will be used at + a time. When no free connections are available, the call will block + until a connection has been released. This is a useful side effect for + particular multithreaded situations where one does not want to use more + than maxsize connections per host to prevent flooding. + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + + :param retries: + Retry configuration to use by default with requests in this pool. + + :param _proxy: + Parsed proxy URL, should not be used directly, instead, see + :class:`urllib3.ProxyManager` + + :param _proxy_headers: + A dictionary with proxy headers, should not be used directly, + instead, see :class:`urllib3.ProxyManager` + + :param \\**conn_kw: + Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, + :class:`urllib3.connection.HTTPSConnection` instances. + """ + + scheme = "http" + ConnectionCls: ( + type[BaseHTTPConnection] | type[BaseHTTPSConnection] + ) = HTTPConnection + + def __init__( + self, + host: str, + port: int | None = None, + timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, + maxsize: int = 1, + block: bool = False, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + _proxy: Url | None = None, + _proxy_headers: typing.Mapping[str, str] | None = None, + _proxy_config: ProxyConfig | None = None, + **conn_kw: typing.Any, + ): + ConnectionPool.__init__(self, host, port) + RequestMethods.__init__(self, headers) + + if not isinstance(timeout, Timeout): + timeout = Timeout.from_float(timeout) + + if retries is None: + retries = Retry.DEFAULT + + self.timeout = timeout + self.retries = retries + + self.pool: queue.LifoQueue[typing.Any] | None = self.QueueCls(maxsize) + self.block = block + + self.proxy = _proxy + self.proxy_headers = _proxy_headers or {} + self.proxy_config = _proxy_config + + # Fill the queue up so that doing get() on it will block properly + for _ in range(maxsize): + self.pool.put(None) + + # These are mostly for testing and debugging purposes. + self.num_connections = 0 + self.num_requests = 0 + self.conn_kw = conn_kw + + if self.proxy: + # Enable Nagle's algorithm for proxies, to avoid packet fragmentation. + # We cannot know if the user has added default socket options, so we cannot replace the + # list. + self.conn_kw.setdefault("socket_options", []) + + self.conn_kw["proxy"] = self.proxy + self.conn_kw["proxy_config"] = self.proxy_config + + # Do not pass 'self' as callback to 'finalize'. + # Then the 'finalize' would keep an endless living (leak) to self. + # By just passing a reference to the pool allows the garbage collector + # to free self if nobody else has a reference to it. + pool = self.pool + + # Close all the HTTPConnections in the pool before the + # HTTPConnectionPool object is garbage collected. + weakref.finalize(self, _close_pool_connections, pool) + + def _new_conn(self) -> BaseHTTPConnection: + """ + Return a fresh :class:`HTTPConnection`. + """ + self.num_connections += 1 + log.debug( + "Starting new HTTP connection (%d): %s:%s", + self.num_connections, + self.host, + self.port or "80", + ) + + conn = self.ConnectionCls( + host=self.host, + port=self.port, + timeout=self.timeout.connect_timeout, + **self.conn_kw, + ) + return conn + + def _get_conn(self, timeout: float | None = None) -> BaseHTTPConnection: + """ + Get a connection. Will return a pooled connection if one is available. + + If no connections are available and :prop:`.block` is ``False``, then a + fresh connection is returned. + + :param timeout: + Seconds to wait before giving up and raising + :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and + :prop:`.block` is ``True``. + """ + conn = None + + if self.pool is None: + raise ClosedPoolError(self, "Pool is closed.") + + try: + conn = self.pool.get(block=self.block, timeout=timeout) + + except AttributeError: # self.pool is None + raise ClosedPoolError(self, "Pool is closed.") from None # Defensive: + + except queue.Empty: + if self.block: + raise EmptyPoolError( + self, + "Pool is empty and a new connection can't be opened due to blocking mode.", + ) from None + pass # Oh well, we'll create a new connection then + + # If this is a persistent connection, check if it got disconnected + if conn and is_connection_dropped(conn): + log.debug("Resetting dropped connection: %s", self.host) + conn.close() + + return conn or self._new_conn() + + def _put_conn(self, conn: BaseHTTPConnection | None) -> None: + """ + Put a connection back into the pool. + + :param conn: + Connection object for the current host and port as returned by + :meth:`._new_conn` or :meth:`._get_conn`. + + If the pool is already full, the connection is closed and discarded + because we exceeded maxsize. If connections are discarded frequently, + then maxsize should be increased. + + If the pool is closed, then the connection will be closed and discarded. + """ + if self.pool is not None: + try: + self.pool.put(conn, block=False) + return # Everything is dandy, done. + except AttributeError: + # self.pool is None. + pass + except queue.Full: + # Connection never got put back into the pool, close it. + if conn: + conn.close() + + if self.block: + # This should never happen if you got the conn from self._get_conn + raise FullPoolError( + self, + "Pool reached maximum size and no more connections are allowed.", + ) from None + + log.warning( + "Connection pool is full, discarding connection: %s. Connection pool size: %s", + self.host, + self.pool.qsize(), + ) + + # Connection never got put back into the pool, close it. + if conn: + conn.close() + + def _validate_conn(self, conn: BaseHTTPConnection) -> None: + """ + Called right before a request is made, after the socket is created. + """ + + def _prepare_proxy(self, conn: BaseHTTPConnection) -> None: + # Nothing to do for HTTP connections. + pass + + def _get_timeout(self, timeout: _TYPE_TIMEOUT) -> Timeout: + """Helper that always returns a :class:`urllib3.util.Timeout`""" + if timeout is _DEFAULT_TIMEOUT: + return self.timeout.clone() + + if isinstance(timeout, Timeout): + return timeout.clone() + else: + # User passed us an int/float. This is for backwards compatibility, + # can be removed later + return Timeout.from_float(timeout) + + def _raise_timeout( + self, + err: BaseSSLError | OSError | SocketTimeout, + url: str, + timeout_value: _TYPE_TIMEOUT | None, + ) -> None: + """Is the error actually a timeout? Will raise a ReadTimeout or pass""" + + if isinstance(err, SocketTimeout): + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err + + # See the above comment about EAGAIN in Python 3. + if hasattr(err, "errno") and err.errno in _blocking_errnos: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err + + def _make_request( + self, + conn: BaseHTTPConnection, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | None = None, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + chunked: bool = False, + response_conn: BaseHTTPConnection | None = None, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> BaseHTTPResponse: + """ + Perform a request on a given urllib connection object taken from our + pool. + + :param conn: + a connection from one of our connection pools + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + Pass ``None`` to retry until you receive a response. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param response_conn: + Set this to ``None`` if you will handle releasing the connection or + set the connection to have the response release it. + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + self.num_requests += 1 + + timeout_obj = self._get_timeout(timeout) + timeout_obj.start_connect() + conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) + + try: + # Trigger any extra validation we need to do. + try: + self._validate_conn(conn) + except (SocketTimeout, BaseSSLError) as e: + self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) + raise + + # _validate_conn() starts the connection to an HTTPS proxy + # so we need to wrap errors with 'ProxyError' here too. + except ( + OSError, + NewConnectionError, + TimeoutError, + BaseSSLError, + CertificateError, + SSLError, + ) as e: + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + # If the connection didn't successfully connect to it's proxy + # then there + if isinstance( + new_e, (OSError, NewConnectionError, TimeoutError, SSLError) + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + raise new_e + + # conn.request() calls http.client.*.request, not the method in + # urllib3.request. It also calls makefile (recv) on the socket. + try: + conn.request( + method, + url, + body=body, + headers=headers, + chunked=chunked, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + # We are swallowing BrokenPipeError (errno.EPIPE) since the server is + # legitimately able to close the connection after sending a valid response. + # With this behaviour, the received response is still readable. + except BrokenPipeError: + pass + except OSError as e: + # MacOS/Linux + # EPROTOTYPE is needed on macOS + # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/ + if e.errno != errno.EPROTOTYPE: + raise + + # Reset the timeout for the recv() on the socket + read_timeout = timeout_obj.read_timeout + + if not conn.is_closed: + # In Python 3 socket.py will catch EAGAIN and return None when you + # try and read into the file pointer created by http.client, which + # instead raises a BadStatusLine exception. Instead of catching + # the exception and assuming all BadStatusLine exceptions are read + # timeouts, check for a zero timeout before making the request. + if read_timeout == 0: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={read_timeout})" + ) + conn.timeout = read_timeout + + # Receive the response from the server + try: + response = conn.getresponse() + except (BaseSSLError, OSError) as e: + self._raise_timeout(err=e, url=url, timeout_value=read_timeout) + raise + + # Set properties that are used by the pooling layer. + response.retries = retries + response._connection = response_conn # type: ignore[attr-defined] + response._pool = self # type: ignore[attr-defined] + + log.debug( + '%s://%s:%s "%s %s %s" %s %s', + self.scheme, + self.host, + self.port, + method, + url, + # HTTP version + conn._http_vsn_str, # type: ignore[attr-defined] + response.status, + response.length_remaining, # type: ignore[attr-defined] + ) + + return response + + def close(self) -> None: + """ + Close all pooled connections and disable the pool. + """ + if self.pool is None: + return + # Disable access to the pool + old_pool, self.pool = self.pool, None + + # Close all the HTTPConnections in the pool. + _close_pool_connections(old_pool) + + def is_same_host(self, url: str) -> bool: + """ + Check if the given ``url`` is a member of the same host as this + connection pool. + """ + if url.startswith("/"): + return True + + # TODO: Add optional support for socket.gethostbyname checking. + scheme, _, host, port, *_ = parse_url(url) + scheme = scheme or "http" + if host is not None: + host = _normalize_host(host, scheme=scheme) + + # Use explicit default port for comparison when none is given + if self.port and not port: + port = port_by_scheme.get(scheme) + elif not self.port and port == port_by_scheme.get(scheme): + port = None + + return (scheme, host, port) == (self.scheme, self.host, self.port) + + def urlopen( # type: ignore[override] + self, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + redirect: bool = True, + assert_same_host: bool = True, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + pool_timeout: int | None = None, + release_conn: bool | None = None, + chunked: bool = False, + body_pos: _TYPE_BODY_POSITION | None = None, + preload_content: bool = True, + decode_content: bool = True, + **response_kw: typing.Any, + ) -> BaseHTTPResponse: + """ + Get a connection from the pool and perform an HTTP request. This is the + lowest level call for making a request, so you'll need to specify all + the raw details. + + .. note:: + + More commonly, it's appropriate to use a convenience method + such as :meth:`request`. + + .. note:: + + `release_conn` will only behave as expected if + `preload_content=False` because we want to make + `preload_content=False` the default behaviour someday soon without + breaking backwards compatibility. + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + Pass ``None`` to retry until you receive a response. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param redirect: + If True, automatically handle redirects (status codes 301, 302, + 303, 307, 308). Each redirect counts as a retry. Disabling retries + will disable redirect, too. + + :param assert_same_host: + If ``True``, will make sure that the host of the pool requests is + consistent else will raise HostChangedError. When ``False``, you can + use the pool on an HTTP proxy and request foreign hosts. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param pool_timeout: + If set and the pool is set to block=True, then this method will + block for ``pool_timeout`` seconds and raise EmptyPoolError if no + connection is available within the time period. + + :param bool preload_content: + If True, the response's body will be preloaded into memory. + + :param bool decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param release_conn: + If False, then the urlopen call will not release the connection + back into the pool once a response is received (but will release if + you read the entire contents of the response such as when + `preload_content=True`). This is useful if you're not preloading + the response's content immediately. You will need to call + ``r.release_conn()`` on the response ``r`` to return the connection + back into the pool. If None, it takes the value of ``preload_content`` + which defaults to ``True``. + + :param bool chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param int body_pos: + Position to seek to in file-like body in the event of a retry or + redirect. Typically this won't need to be set because urllib3 will + auto-populate the value when needed. + """ + parsed_url = parse_url(url) + destination_scheme = parsed_url.scheme + + if headers is None: + headers = self.headers + + if not isinstance(retries, Retry): + retries = Retry.from_int(retries, redirect=redirect, default=self.retries) + + if release_conn is None: + release_conn = preload_content + + # Check host + if assert_same_host and not self.is_same_host(url): + raise HostChangedError(self, url, retries) + + # Ensure that the URL we're connecting to is properly encoded + if url.startswith("/"): + url = to_str(_encode_target(url)) + else: + url = to_str(parsed_url.url) + + conn = None + + # Track whether `conn` needs to be released before + # returning/raising/recursing. Update this variable if necessary, and + # leave `release_conn` constant throughout the function. That way, if + # the function recurses, the original value of `release_conn` will be + # passed down into the recursive call, and its value will be respected. + # + # See issue #651 [1] for details. + # + # [1] + release_this_conn = release_conn + + http_tunnel_required = connection_requires_http_tunnel( + self.proxy, self.proxy_config, destination_scheme + ) + + # Merge the proxy headers. Only done when not using HTTP CONNECT. We + # have to copy the headers dict so we can safely change it without those + # changes being reflected in anyone else's copy. + if not http_tunnel_required: + headers = headers.copy() # type: ignore[attr-defined] + headers.update(self.proxy_headers) # type: ignore[union-attr] + + # Must keep the exception bound to a separate variable or else Python 3 + # complains about UnboundLocalError. + err = None + + # Keep track of whether we cleanly exited the except block. This + # ensures we do proper cleanup in finally. + clean_exit = False + + # Rewind body position, if needed. Record current position + # for future rewinds in the event of a redirect/retry. + body_pos = set_file_position(body, body_pos) + + try: + # Request a connection from the queue. + timeout_obj = self._get_timeout(timeout) + conn = self._get_conn(timeout=pool_timeout) + + conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] + + # Is this a closed/new connection that requires CONNECT tunnelling? + if self.proxy is not None and http_tunnel_required and conn.is_closed: + try: + self._prepare_proxy(conn) + except (BaseSSLError, OSError, SocketTimeout) as e: + self._raise_timeout( + err=e, url=self.proxy.url, timeout_value=conn.timeout + ) + raise + + # If we're going to release the connection in ``finally:``, then + # the response doesn't need to know about the connection. Otherwise + # it will also try to release it and we'll have a double-release + # mess. + response_conn = conn if not release_conn else None + + # Make the request on the HTTPConnection object + response = self._make_request( + conn, + method, + url, + timeout=timeout_obj, + body=body, + headers=headers, + chunked=chunked, + retries=retries, + response_conn=response_conn, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Everything went great! + clean_exit = True + + except EmptyPoolError: + # Didn't get a connection from the pool, no need to clean up + clean_exit = True + release_this_conn = False + raise + + except ( + TimeoutError, + HTTPException, + OSError, + ProtocolError, + BaseSSLError, + SSLError, + CertificateError, + ProxyError, + ) as e: + # Discard the connection for these exceptions. It will be + # replaced during the next _get_conn() call. + clean_exit = False + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + if isinstance( + new_e, + ( + OSError, + NewConnectionError, + TimeoutError, + SSLError, + HTTPException, + ), + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + elif isinstance(new_e, (OSError, HTTPException)): + new_e = ProtocolError("Connection aborted.", new_e) + + retries = retries.increment( + method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2] + ) + retries.sleep() + + # Keep track of the error for the retry warning. + err = e + + finally: + if not clean_exit: + # We hit some kind of exception, handled or otherwise. We need + # to throw the connection away unless explicitly told not to. + # Close the connection, set the variable to None, and make sure + # we put the None back in the pool to avoid leaking it. + if conn: + conn.close() + conn = None + release_this_conn = True + + if release_this_conn: + # Put the connection back to be reused. If the connection is + # expired then it will be None, which will get replaced with a + # fresh connection during _get_conn. + self._put_conn(conn) + + if not conn: + # Try again + log.warning( + "Retrying (%r) after connection broken by '%r': %s", retries, err, url + ) + return self.urlopen( + method, + url, + body, + headers, + retries, + redirect, + assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Handle redirect? + redirect_location = redirect and response.get_redirect_location() + if redirect_location: + if response.status == 303: + method = "GET" + + try: + retries = retries.increment(method, url, response=response, _pool=self) + except MaxRetryError: + if retries.raise_on_redirect: + response.drain_conn() + raise + return response + + response.drain_conn() + retries.sleep_for_retry(response) + log.debug("Redirecting %s -> %s", url, redirect_location) + return self.urlopen( + method, + redirect_location, + body, + headers, + retries=retries, + redirect=redirect, + assert_same_host=assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + # Check if we should retry the HTTP response. + has_retry_after = bool(response.headers.get("Retry-After")) + if retries.is_retry(method, response.status, has_retry_after): + try: + retries = retries.increment(method, url, response=response, _pool=self) + except MaxRetryError: + if retries.raise_on_status: + response.drain_conn() + raise + return response + + response.drain_conn() + retries.sleep(response) + log.debug("Retry: %s", url) + return self.urlopen( + method, + url, + body, + headers, + retries=retries, + redirect=redirect, + assert_same_host=assert_same_host, + timeout=timeout, + pool_timeout=pool_timeout, + release_conn=release_conn, + chunked=chunked, + body_pos=body_pos, + preload_content=preload_content, + decode_content=decode_content, + **response_kw, + ) + + return response + + +class HTTPSConnectionPool(HTTPConnectionPool): + """ + Same as :class:`.HTTPConnectionPool`, but HTTPS. + + :class:`.HTTPSConnection` uses one of ``assert_fingerprint``, + ``assert_hostname`` and ``host`` in this order to verify connections. + If ``assert_hostname`` is False, no verification is done. + + The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``, + ``ca_cert_dir``, ``ssl_version``, ``key_password`` are only used if :mod:`ssl` + is available and are fed into :meth:`urllib3.util.ssl_wrap_socket` to upgrade + the connection socket into an SSL socket. + """ + + scheme = "https" + ConnectionCls: type[BaseHTTPSConnection] = HTTPSConnection + + def __init__( + self, + host: str, + port: int | None = None, + timeout: _TYPE_TIMEOUT | None = _DEFAULT_TIMEOUT, + maxsize: int = 1, + block: bool = False, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | bool | int | None = None, + _proxy: Url | None = None, + _proxy_headers: typing.Mapping[str, str] | None = None, + key_file: str | None = None, + cert_file: str | None = None, + cert_reqs: int | str | None = None, + key_password: str | None = None, + ca_certs: str | None = None, + ssl_version: int | str | None = None, + ssl_minimum_version: ssl.TLSVersion | None = None, + ssl_maximum_version: ssl.TLSVersion | None = None, + assert_hostname: str | Literal[False] | None = None, + assert_fingerprint: str | None = None, + ca_cert_dir: str | None = None, + **conn_kw: typing.Any, + ) -> None: + super().__init__( + host, + port, + timeout, + maxsize, + block, + headers, + retries, + _proxy, + _proxy_headers, + **conn_kw, + ) + + self.key_file = key_file + self.cert_file = cert_file + self.cert_reqs = cert_reqs + self.key_password = key_password + self.ca_certs = ca_certs + self.ca_cert_dir = ca_cert_dir + self.ssl_version = ssl_version + self.ssl_minimum_version = ssl_minimum_version + self.ssl_maximum_version = ssl_maximum_version + self.assert_hostname = assert_hostname + self.assert_fingerprint = assert_fingerprint + + def _prepare_proxy(self, conn: HTTPSConnection) -> None: # type: ignore[override] + """Establishes a tunnel connection through HTTP CONNECT.""" + if self.proxy and self.proxy.scheme == "https": + tunnel_scheme = "https" + else: + tunnel_scheme = "http" + + conn.set_tunnel( + scheme=tunnel_scheme, + host=self._tunnel_host, + port=self.port, + headers=self.proxy_headers, + ) + conn.connect() + + def _new_conn(self) -> BaseHTTPSConnection: + """ + Return a fresh :class:`urllib3.connection.HTTPConnection`. + """ + self.num_connections += 1 + log.debug( + "Starting new HTTPS connection (%d): %s:%s", + self.num_connections, + self.host, + self.port or "443", + ) + + if not self.ConnectionCls or self.ConnectionCls is DummyConnection: # type: ignore[comparison-overlap] + raise ImportError( + "Can't connect to HTTPS URL because the SSL module is not available." + ) + + actual_host: str = self.host + actual_port = self.port + if self.proxy is not None and self.proxy.host is not None: + actual_host = self.proxy.host + actual_port = self.proxy.port + + return self.ConnectionCls( + host=actual_host, + port=actual_port, + timeout=self.timeout.connect_timeout, + cert_file=self.cert_file, + key_file=self.key_file, + key_password=self.key_password, + cert_reqs=self.cert_reqs, + ca_certs=self.ca_certs, + ca_cert_dir=self.ca_cert_dir, + assert_hostname=self.assert_hostname, + assert_fingerprint=self.assert_fingerprint, + ssl_version=self.ssl_version, + ssl_minimum_version=self.ssl_minimum_version, + ssl_maximum_version=self.ssl_maximum_version, + **self.conn_kw, + ) + + def _validate_conn(self, conn: BaseHTTPConnection) -> None: + """ + Called right before a request is made, after the socket is created. + """ + super()._validate_conn(conn) + + # Force connect early to allow us to validate the connection. + if conn.is_closed: + conn.connect() + + if not conn.is_verified: + warnings.warn( + ( + f"Unverified HTTPS request is being made to host '{conn.host}'. " + "Adding certificate verification is strongly advised. See: " + "https://urllib3.readthedocs.io/en/latest/advanced-usage.html" + "#tls-warnings" + ), + InsecureRequestWarning, + ) + + +def connection_from_url(url: str, **kw: typing.Any) -> HTTPConnectionPool: + """ + Given a url, return an :class:`.ConnectionPool` instance of its host. + + This is a shortcut for not having to parse out the scheme, host, and port + of the url before creating an :class:`.ConnectionPool` instance. + + :param url: + Absolute URL string that must include the scheme. Port is optional. + + :param \\**kw: + Passes additional parameters to the constructor of the appropriate + :class:`.ConnectionPool`. Useful for specifying things like + timeout, maxsize, headers, etc. + + Example:: + + >>> conn = connection_from_url('http://google.com/') + >>> r = conn.request('GET', '/') + """ + scheme, _, host, port, *_ = parse_url(url) + scheme = scheme or "http" + port = port or port_by_scheme.get(scheme, 80) + if scheme == "https": + return HTTPSConnectionPool(host, port=port, **kw) # type: ignore[arg-type] + else: + return HTTPConnectionPool(host, port=port, **kw) # type: ignore[arg-type] + + +@typing.overload +def _normalize_host(host: None, scheme: str | None) -> None: + ... + + +@typing.overload +def _normalize_host(host: str, scheme: str | None) -> str: + ... + + +def _normalize_host(host: str | None, scheme: str | None) -> str | None: + """ + Normalize hosts for comparisons and use with sockets. + """ + + host = normalize_host(host, scheme) + + # httplib doesn't like it when we include brackets in IPv6 addresses + # Specifically, if we include brackets but also pass the port then + # httplib crazily doubles up the square brackets on the Host header. + # Instead, we need to make sure we never pass ``None`` as the port. + # However, for backward compatibility reasons we can't actually + # *assert* that. See http://bugs.python.org/issue28539 + if host and host.startswith("[") and host.endswith("]"): + host = host[1:-1] + return host + + +def _url_from_pool( + pool: HTTPConnectionPool | HTTPSConnectionPool, path: str | None = None +) -> str: + """Returns the URL from a given connection pool. This is mainly used for testing and logging.""" + return Url(scheme=pool.scheme, host=pool.host, port=pool.port, path=path).url + + +def _close_pool_connections(pool: queue.LifoQueue[typing.Any]) -> None: + """Drains a queue of connections and closes each one.""" + try: + while True: + conn = pool.get(block=False) + if conn: + conn.close() + except queue.Empty: + pass # Done. diff --git a/requests/python/urllib3/contrib/__init__.py b/requests/python/urllib3/contrib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requests/python/urllib3/contrib/__pycache__/__init__.cpython-311.pyc b/requests/python/urllib3/contrib/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..bf5a8e2 Binary files /dev/null and b/requests/python/urllib3/contrib/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc b/requests/python/urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc new file mode 100644 index 0000000..3ecc28a Binary files /dev/null and b/requests/python/urllib3/contrib/__pycache__/pyopenssl.cpython-311.pyc differ diff --git a/requests/python/urllib3/contrib/__pycache__/securetransport.cpython-311.pyc b/requests/python/urllib3/contrib/__pycache__/securetransport.cpython-311.pyc new file mode 100644 index 0000000..9da032c Binary files /dev/null and b/requests/python/urllib3/contrib/__pycache__/securetransport.cpython-311.pyc differ diff --git a/requests/python/urllib3/contrib/__pycache__/socks.cpython-311.pyc b/requests/python/urllib3/contrib/__pycache__/socks.cpython-311.pyc new file mode 100644 index 0000000..db2545f Binary files /dev/null and b/requests/python/urllib3/contrib/__pycache__/socks.cpython-311.pyc differ diff --git a/requests/python/urllib3/contrib/_securetransport/__init__.py b/requests/python/urllib3/contrib/_securetransport/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requests/python/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc b/requests/python/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..63fca0b Binary files /dev/null and b/requests/python/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc b/requests/python/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc new file mode 100644 index 0000000..01ac614 Binary files /dev/null and b/requests/python/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-311.pyc differ diff --git a/requests/python/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc b/requests/python/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc new file mode 100644 index 0000000..3a28c1d Binary files /dev/null and b/requests/python/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-311.pyc differ diff --git a/requests/python/urllib3/contrib/_securetransport/bindings.py b/requests/python/urllib3/contrib/_securetransport/bindings.py new file mode 100644 index 0000000..3e4cd46 --- /dev/null +++ b/requests/python/urllib3/contrib/_securetransport/bindings.py @@ -0,0 +1,430 @@ +# type: ignore + +""" +This module uses ctypes to bind a whole bunch of functions and constants from +SecureTransport. The goal here is to provide the low-level API to +SecureTransport. These are essentially the C-level functions and constants, and +they're pretty gross to work with. + +This code is a bastardised version of the code found in Will Bond's oscrypto +library. An enormous debt is owed to him for blazing this trail for us. For +that reason, this code should be considered to be covered both by urllib3's +license and by oscrypto's: + + Copyright (c) 2015-2016 Will Bond + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +""" + +from __future__ import annotations + +import platform +from ctypes import ( + CDLL, + CFUNCTYPE, + POINTER, + c_bool, + c_byte, + c_char_p, + c_int32, + c_long, + c_size_t, + c_uint32, + c_ulong, + c_void_p, +) +from ctypes.util import find_library + +if platform.system() != "Darwin": + raise ImportError("Only macOS is supported") + +version = platform.mac_ver()[0] +version_info = tuple(map(int, version.split("."))) +if version_info < (10, 8): + raise OSError( + f"Only OS X 10.8 and newer are supported, not {version_info[0]}.{version_info[1]}" + ) + + +def load_cdll(name: str, macos10_16_path: str) -> CDLL: + """Loads a CDLL by name, falling back to known path on 10.16+""" + try: + # Big Sur is technically 11 but we use 10.16 due to the Big Sur + # beta being labeled as 10.16. + path: str | None + if version_info >= (10, 16): + path = macos10_16_path + else: + path = find_library(name) + if not path: + raise OSError # Caught and reraised as 'ImportError' + return CDLL(path, use_errno=True) + except OSError: + raise ImportError(f"The library {name} failed to load") from None + + +Security = load_cdll( + "Security", "/System/Library/Frameworks/Security.framework/Security" +) +CoreFoundation = load_cdll( + "CoreFoundation", + "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", +) + + +Boolean = c_bool +CFIndex = c_long +CFStringEncoding = c_uint32 +CFData = c_void_p +CFString = c_void_p +CFArray = c_void_p +CFMutableArray = c_void_p +CFDictionary = c_void_p +CFError = c_void_p +CFType = c_void_p +CFTypeID = c_ulong + +CFTypeRef = POINTER(CFType) +CFAllocatorRef = c_void_p + +OSStatus = c_int32 + +CFDataRef = POINTER(CFData) +CFStringRef = POINTER(CFString) +CFArrayRef = POINTER(CFArray) +CFMutableArrayRef = POINTER(CFMutableArray) +CFDictionaryRef = POINTER(CFDictionary) +CFArrayCallBacks = c_void_p +CFDictionaryKeyCallBacks = c_void_p +CFDictionaryValueCallBacks = c_void_p + +SecCertificateRef = POINTER(c_void_p) +SecExternalFormat = c_uint32 +SecExternalItemType = c_uint32 +SecIdentityRef = POINTER(c_void_p) +SecItemImportExportFlags = c_uint32 +SecItemImportExportKeyParameters = c_void_p +SecKeychainRef = POINTER(c_void_p) +SSLProtocol = c_uint32 +SSLCipherSuite = c_uint32 +SSLContextRef = POINTER(c_void_p) +SecTrustRef = POINTER(c_void_p) +SSLConnectionRef = c_uint32 +SecTrustResultType = c_uint32 +SecTrustOptionFlags = c_uint32 +SSLProtocolSide = c_uint32 +SSLConnectionType = c_uint32 +SSLSessionOption = c_uint32 + + +try: + Security.SecItemImport.argtypes = [ + CFDataRef, + CFStringRef, + POINTER(SecExternalFormat), + POINTER(SecExternalItemType), + SecItemImportExportFlags, + POINTER(SecItemImportExportKeyParameters), + SecKeychainRef, + POINTER(CFArrayRef), + ] + Security.SecItemImport.restype = OSStatus + + Security.SecCertificateGetTypeID.argtypes = [] + Security.SecCertificateGetTypeID.restype = CFTypeID + + Security.SecIdentityGetTypeID.argtypes = [] + Security.SecIdentityGetTypeID.restype = CFTypeID + + Security.SecKeyGetTypeID.argtypes = [] + Security.SecKeyGetTypeID.restype = CFTypeID + + Security.SecCertificateCreateWithData.argtypes = [CFAllocatorRef, CFDataRef] + Security.SecCertificateCreateWithData.restype = SecCertificateRef + + Security.SecCertificateCopyData.argtypes = [SecCertificateRef] + Security.SecCertificateCopyData.restype = CFDataRef + + Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p] + Security.SecCopyErrorMessageString.restype = CFStringRef + + Security.SecIdentityCreateWithCertificate.argtypes = [ + CFTypeRef, + SecCertificateRef, + POINTER(SecIdentityRef), + ] + Security.SecIdentityCreateWithCertificate.restype = OSStatus + + Security.SecKeychainCreate.argtypes = [ + c_char_p, + c_uint32, + c_void_p, + Boolean, + c_void_p, + POINTER(SecKeychainRef), + ] + Security.SecKeychainCreate.restype = OSStatus + + Security.SecKeychainDelete.argtypes = [SecKeychainRef] + Security.SecKeychainDelete.restype = OSStatus + + Security.SecPKCS12Import.argtypes = [ + CFDataRef, + CFDictionaryRef, + POINTER(CFArrayRef), + ] + Security.SecPKCS12Import.restype = OSStatus + + SSLReadFunc = CFUNCTYPE(OSStatus, SSLConnectionRef, c_void_p, POINTER(c_size_t)) + SSLWriteFunc = CFUNCTYPE( + OSStatus, SSLConnectionRef, POINTER(c_byte), POINTER(c_size_t) + ) + + Security.SSLSetIOFuncs.argtypes = [SSLContextRef, SSLReadFunc, SSLWriteFunc] + Security.SSLSetIOFuncs.restype = OSStatus + + Security.SSLSetPeerID.argtypes = [SSLContextRef, c_char_p, c_size_t] + Security.SSLSetPeerID.restype = OSStatus + + Security.SSLSetCertificate.argtypes = [SSLContextRef, CFArrayRef] + Security.SSLSetCertificate.restype = OSStatus + + Security.SSLSetCertificateAuthorities.argtypes = [SSLContextRef, CFTypeRef, Boolean] + Security.SSLSetCertificateAuthorities.restype = OSStatus + + Security.SSLSetConnection.argtypes = [SSLContextRef, SSLConnectionRef] + Security.SSLSetConnection.restype = OSStatus + + Security.SSLSetPeerDomainName.argtypes = [SSLContextRef, c_char_p, c_size_t] + Security.SSLSetPeerDomainName.restype = OSStatus + + Security.SSLHandshake.argtypes = [SSLContextRef] + Security.SSLHandshake.restype = OSStatus + + Security.SSLRead.argtypes = [SSLContextRef, c_char_p, c_size_t, POINTER(c_size_t)] + Security.SSLRead.restype = OSStatus + + Security.SSLWrite.argtypes = [SSLContextRef, c_char_p, c_size_t, POINTER(c_size_t)] + Security.SSLWrite.restype = OSStatus + + Security.SSLClose.argtypes = [SSLContextRef] + Security.SSLClose.restype = OSStatus + + Security.SSLGetNumberSupportedCiphers.argtypes = [SSLContextRef, POINTER(c_size_t)] + Security.SSLGetNumberSupportedCiphers.restype = OSStatus + + Security.SSLGetSupportedCiphers.argtypes = [ + SSLContextRef, + POINTER(SSLCipherSuite), + POINTER(c_size_t), + ] + Security.SSLGetSupportedCiphers.restype = OSStatus + + Security.SSLSetEnabledCiphers.argtypes = [ + SSLContextRef, + POINTER(SSLCipherSuite), + c_size_t, + ] + Security.SSLSetEnabledCiphers.restype = OSStatus + + Security.SSLGetNumberEnabledCiphers.argtype = [SSLContextRef, POINTER(c_size_t)] + Security.SSLGetNumberEnabledCiphers.restype = OSStatus + + Security.SSLGetEnabledCiphers.argtypes = [ + SSLContextRef, + POINTER(SSLCipherSuite), + POINTER(c_size_t), + ] + Security.SSLGetEnabledCiphers.restype = OSStatus + + Security.SSLGetNegotiatedCipher.argtypes = [SSLContextRef, POINTER(SSLCipherSuite)] + Security.SSLGetNegotiatedCipher.restype = OSStatus + + Security.SSLGetNegotiatedProtocolVersion.argtypes = [ + SSLContextRef, + POINTER(SSLProtocol), + ] + Security.SSLGetNegotiatedProtocolVersion.restype = OSStatus + + Security.SSLCopyPeerTrust.argtypes = [SSLContextRef, POINTER(SecTrustRef)] + Security.SSLCopyPeerTrust.restype = OSStatus + + Security.SecTrustSetAnchorCertificates.argtypes = [SecTrustRef, CFArrayRef] + Security.SecTrustSetAnchorCertificates.restype = OSStatus + + Security.SecTrustSetAnchorCertificatesOnly.argstypes = [SecTrustRef, Boolean] + Security.SecTrustSetAnchorCertificatesOnly.restype = OSStatus + + Security.SecTrustEvaluate.argtypes = [SecTrustRef, POINTER(SecTrustResultType)] + Security.SecTrustEvaluate.restype = OSStatus + + Security.SecTrustGetCertificateCount.argtypes = [SecTrustRef] + Security.SecTrustGetCertificateCount.restype = CFIndex + + Security.SecTrustGetCertificateAtIndex.argtypes = [SecTrustRef, CFIndex] + Security.SecTrustGetCertificateAtIndex.restype = SecCertificateRef + + Security.SSLCreateContext.argtypes = [ + CFAllocatorRef, + SSLProtocolSide, + SSLConnectionType, + ] + Security.SSLCreateContext.restype = SSLContextRef + + Security.SSLSetSessionOption.argtypes = [SSLContextRef, SSLSessionOption, Boolean] + Security.SSLSetSessionOption.restype = OSStatus + + Security.SSLSetProtocolVersionMin.argtypes = [SSLContextRef, SSLProtocol] + Security.SSLSetProtocolVersionMin.restype = OSStatus + + Security.SSLSetProtocolVersionMax.argtypes = [SSLContextRef, SSLProtocol] + Security.SSLSetProtocolVersionMax.restype = OSStatus + + try: + Security.SSLSetALPNProtocols.argtypes = [SSLContextRef, CFArrayRef] + Security.SSLSetALPNProtocols.restype = OSStatus + except AttributeError: + # Supported only in 10.12+ + pass + + Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p] + Security.SecCopyErrorMessageString.restype = CFStringRef + + Security.SSLReadFunc = SSLReadFunc + Security.SSLWriteFunc = SSLWriteFunc + Security.SSLContextRef = SSLContextRef + Security.SSLProtocol = SSLProtocol + Security.SSLCipherSuite = SSLCipherSuite + Security.SecIdentityRef = SecIdentityRef + Security.SecKeychainRef = SecKeychainRef + Security.SecTrustRef = SecTrustRef + Security.SecTrustResultType = SecTrustResultType + Security.SecExternalFormat = SecExternalFormat + Security.OSStatus = OSStatus + + Security.kSecImportExportPassphrase = CFStringRef.in_dll( + Security, "kSecImportExportPassphrase" + ) + Security.kSecImportItemIdentity = CFStringRef.in_dll( + Security, "kSecImportItemIdentity" + ) + + # CoreFoundation time! + CoreFoundation.CFRetain.argtypes = [CFTypeRef] + CoreFoundation.CFRetain.restype = CFTypeRef + + CoreFoundation.CFRelease.argtypes = [CFTypeRef] + CoreFoundation.CFRelease.restype = None + + CoreFoundation.CFGetTypeID.argtypes = [CFTypeRef] + CoreFoundation.CFGetTypeID.restype = CFTypeID + + CoreFoundation.CFStringCreateWithCString.argtypes = [ + CFAllocatorRef, + c_char_p, + CFStringEncoding, + ] + CoreFoundation.CFStringCreateWithCString.restype = CFStringRef + + CoreFoundation.CFStringGetCStringPtr.argtypes = [CFStringRef, CFStringEncoding] + CoreFoundation.CFStringGetCStringPtr.restype = c_char_p + + CoreFoundation.CFStringGetCString.argtypes = [ + CFStringRef, + c_char_p, + CFIndex, + CFStringEncoding, + ] + CoreFoundation.CFStringGetCString.restype = c_bool + + CoreFoundation.CFDataCreate.argtypes = [CFAllocatorRef, c_char_p, CFIndex] + CoreFoundation.CFDataCreate.restype = CFDataRef + + CoreFoundation.CFDataGetLength.argtypes = [CFDataRef] + CoreFoundation.CFDataGetLength.restype = CFIndex + + CoreFoundation.CFDataGetBytePtr.argtypes = [CFDataRef] + CoreFoundation.CFDataGetBytePtr.restype = c_void_p + + CoreFoundation.CFDictionaryCreate.argtypes = [ + CFAllocatorRef, + POINTER(CFTypeRef), + POINTER(CFTypeRef), + CFIndex, + CFDictionaryKeyCallBacks, + CFDictionaryValueCallBacks, + ] + CoreFoundation.CFDictionaryCreate.restype = CFDictionaryRef + + CoreFoundation.CFDictionaryGetValue.argtypes = [CFDictionaryRef, CFTypeRef] + CoreFoundation.CFDictionaryGetValue.restype = CFTypeRef + + CoreFoundation.CFArrayCreate.argtypes = [ + CFAllocatorRef, + POINTER(CFTypeRef), + CFIndex, + CFArrayCallBacks, + ] + CoreFoundation.CFArrayCreate.restype = CFArrayRef + + CoreFoundation.CFArrayCreateMutable.argtypes = [ + CFAllocatorRef, + CFIndex, + CFArrayCallBacks, + ] + CoreFoundation.CFArrayCreateMutable.restype = CFMutableArrayRef + + CoreFoundation.CFArrayAppendValue.argtypes = [CFMutableArrayRef, c_void_p] + CoreFoundation.CFArrayAppendValue.restype = None + + CoreFoundation.CFArrayGetCount.argtypes = [CFArrayRef] + CoreFoundation.CFArrayGetCount.restype = CFIndex + + CoreFoundation.CFArrayGetValueAtIndex.argtypes = [CFArrayRef, CFIndex] + CoreFoundation.CFArrayGetValueAtIndex.restype = c_void_p + + CoreFoundation.kCFAllocatorDefault = CFAllocatorRef.in_dll( + CoreFoundation, "kCFAllocatorDefault" + ) + CoreFoundation.kCFTypeArrayCallBacks = c_void_p.in_dll( + CoreFoundation, "kCFTypeArrayCallBacks" + ) + CoreFoundation.kCFTypeDictionaryKeyCallBacks = c_void_p.in_dll( + CoreFoundation, "kCFTypeDictionaryKeyCallBacks" + ) + CoreFoundation.kCFTypeDictionaryValueCallBacks = c_void_p.in_dll( + CoreFoundation, "kCFTypeDictionaryValueCallBacks" + ) + + CoreFoundation.CFTypeRef = CFTypeRef + CoreFoundation.CFArrayRef = CFArrayRef + CoreFoundation.CFStringRef = CFStringRef + CoreFoundation.CFDictionaryRef = CFDictionaryRef + +except AttributeError: + raise ImportError("Error initializing ctypes") from None + + +class CFConst: + """ + A class object that acts as essentially a namespace for CoreFoundation + constants. + """ + + kCFStringEncodingUTF8 = CFStringEncoding(0x08000100) diff --git a/requests/python/urllib3/contrib/_securetransport/low_level.py b/requests/python/urllib3/contrib/_securetransport/low_level.py new file mode 100644 index 0000000..e235699 --- /dev/null +++ b/requests/python/urllib3/contrib/_securetransport/low_level.py @@ -0,0 +1,474 @@ +""" +Low-level helpers for the SecureTransport bindings. + +These are Python functions that are not directly related to the high-level APIs +but are necessary to get them to work. They include a whole bunch of low-level +CoreFoundation messing about and memory management. The concerns in this module +are almost entirely about trying to avoid memory leaks and providing +appropriate and useful assistance to the higher-level code. +""" +from __future__ import annotations + +import base64 +import ctypes +import itertools +import os +import re +import ssl +import struct +import tempfile +import typing + +from .bindings import ( # type: ignore[attr-defined] + CFArray, + CFConst, + CFData, + CFDictionary, + CFMutableArray, + CFString, + CFTypeRef, + CoreFoundation, + SecKeychainRef, + Security, +) + +# This regular expression is used to grab PEM data out of a PEM bundle. +_PEM_CERTS_RE = re.compile( + b"-----BEGIN CERTIFICATE-----\n(.*?)\n-----END CERTIFICATE-----", re.DOTALL +) + + +def _cf_data_from_bytes(bytestring: bytes) -> CFData: + """ + Given a bytestring, create a CFData object from it. This CFData object must + be CFReleased by the caller. + """ + return CoreFoundation.CFDataCreate( + CoreFoundation.kCFAllocatorDefault, bytestring, len(bytestring) + ) + + +def _cf_dictionary_from_tuples( + tuples: list[tuple[typing.Any, typing.Any]] +) -> CFDictionary: + """ + Given a list of Python tuples, create an associated CFDictionary. + """ + dictionary_size = len(tuples) + + # We need to get the dictionary keys and values out in the same order. + keys = (t[0] for t in tuples) + values = (t[1] for t in tuples) + cf_keys = (CoreFoundation.CFTypeRef * dictionary_size)(*keys) + cf_values = (CoreFoundation.CFTypeRef * dictionary_size)(*values) + + return CoreFoundation.CFDictionaryCreate( + CoreFoundation.kCFAllocatorDefault, + cf_keys, + cf_values, + dictionary_size, + CoreFoundation.kCFTypeDictionaryKeyCallBacks, + CoreFoundation.kCFTypeDictionaryValueCallBacks, + ) + + +def _cfstr(py_bstr: bytes) -> CFString: + """ + Given a Python binary data, create a CFString. + The string must be CFReleased by the caller. + """ + c_str = ctypes.c_char_p(py_bstr) + cf_str = CoreFoundation.CFStringCreateWithCString( + CoreFoundation.kCFAllocatorDefault, + c_str, + CFConst.kCFStringEncodingUTF8, + ) + return cf_str + + +def _create_cfstring_array(lst: list[bytes]) -> CFMutableArray: + """ + Given a list of Python binary data, create an associated CFMutableArray. + The array must be CFReleased by the caller. + + Raises an ssl.SSLError on failure. + """ + cf_arr = None + try: + cf_arr = CoreFoundation.CFArrayCreateMutable( + CoreFoundation.kCFAllocatorDefault, + 0, + ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), + ) + if not cf_arr: + raise MemoryError("Unable to allocate memory!") + for item in lst: + cf_str = _cfstr(item) + if not cf_str: + raise MemoryError("Unable to allocate memory!") + try: + CoreFoundation.CFArrayAppendValue(cf_arr, cf_str) + finally: + CoreFoundation.CFRelease(cf_str) + except BaseException as e: + if cf_arr: + CoreFoundation.CFRelease(cf_arr) + raise ssl.SSLError(f"Unable to allocate array: {e}") from None + return cf_arr + + +def _cf_string_to_unicode(value: CFString) -> str | None: + """ + Creates a Unicode string from a CFString object. Used entirely for error + reporting. + + Yes, it annoys me quite a lot that this function is this complex. + """ + value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p)) + + string = CoreFoundation.CFStringGetCStringPtr( + value_as_void_p, CFConst.kCFStringEncodingUTF8 + ) + if string is None: + buffer = ctypes.create_string_buffer(1024) + result = CoreFoundation.CFStringGetCString( + value_as_void_p, buffer, 1024, CFConst.kCFStringEncodingUTF8 + ) + if not result: + raise OSError("Error copying C string from CFStringRef") + string = buffer.value + if string is not None: + string = string.decode("utf-8") + return string # type: ignore[no-any-return] + + +def _assert_no_error( + error: int, exception_class: type[BaseException] | None = None +) -> None: + """ + Checks the return code and throws an exception if there is an error to + report + """ + if error == 0: + return + + cf_error_string = Security.SecCopyErrorMessageString(error, None) + output = _cf_string_to_unicode(cf_error_string) + CoreFoundation.CFRelease(cf_error_string) + + if output is None or output == "": + output = f"OSStatus {error}" + + if exception_class is None: + exception_class = ssl.SSLError + + raise exception_class(output) + + +def _cert_array_from_pem(pem_bundle: bytes) -> CFArray: + """ + Given a bundle of certs in PEM format, turns them into a CFArray of certs + that can be used to validate a cert chain. + """ + # Normalize the PEM bundle's line endings. + pem_bundle = pem_bundle.replace(b"\r\n", b"\n") + + der_certs = [ + base64.b64decode(match.group(1)) for match in _PEM_CERTS_RE.finditer(pem_bundle) + ] + if not der_certs: + raise ssl.SSLError("No root certificates specified") + + cert_array = CoreFoundation.CFArrayCreateMutable( + CoreFoundation.kCFAllocatorDefault, + 0, + ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), + ) + if not cert_array: + raise ssl.SSLError("Unable to allocate memory!") + + try: + for der_bytes in der_certs: + certdata = _cf_data_from_bytes(der_bytes) + if not certdata: + raise ssl.SSLError("Unable to allocate memory!") + cert = Security.SecCertificateCreateWithData( + CoreFoundation.kCFAllocatorDefault, certdata + ) + CoreFoundation.CFRelease(certdata) + if not cert: + raise ssl.SSLError("Unable to build cert object!") + + CoreFoundation.CFArrayAppendValue(cert_array, cert) + CoreFoundation.CFRelease(cert) + except Exception: + # We need to free the array before the exception bubbles further. + # We only want to do that if an error occurs: otherwise, the caller + # should free. + CoreFoundation.CFRelease(cert_array) + raise + + return cert_array + + +def _is_cert(item: CFTypeRef) -> bool: + """ + Returns True if a given CFTypeRef is a certificate. + """ + expected = Security.SecCertificateGetTypeID() + return CoreFoundation.CFGetTypeID(item) == expected # type: ignore[no-any-return] + + +def _is_identity(item: CFTypeRef) -> bool: + """ + Returns True if a given CFTypeRef is an identity. + """ + expected = Security.SecIdentityGetTypeID() + return CoreFoundation.CFGetTypeID(item) == expected # type: ignore[no-any-return] + + +def _temporary_keychain() -> tuple[SecKeychainRef, str]: + """ + This function creates a temporary Mac keychain that we can use to work with + credentials. This keychain uses a one-time password and a temporary file to + store the data. We expect to have one keychain per socket. The returned + SecKeychainRef must be freed by the caller, including calling + SecKeychainDelete. + + Returns a tuple of the SecKeychainRef and the path to the temporary + directory that contains it. + """ + # Unfortunately, SecKeychainCreate requires a path to a keychain. This + # means we cannot use mkstemp to use a generic temporary file. Instead, + # we're going to create a temporary directory and a filename to use there. + # This filename will be 8 random bytes expanded into base64. We also need + # some random bytes to password-protect the keychain we're creating, so we + # ask for 40 random bytes. + random_bytes = os.urandom(40) + filename = base64.b16encode(random_bytes[:8]).decode("utf-8") + password = base64.b16encode(random_bytes[8:]) # Must be valid UTF-8 + tempdirectory = tempfile.mkdtemp() + + keychain_path = os.path.join(tempdirectory, filename).encode("utf-8") + + # We now want to create the keychain itself. + keychain = Security.SecKeychainRef() + status = Security.SecKeychainCreate( + keychain_path, len(password), password, False, None, ctypes.byref(keychain) + ) + _assert_no_error(status) + + # Having created the keychain, we want to pass it off to the caller. + return keychain, tempdirectory + + +def _load_items_from_file( + keychain: SecKeychainRef, path: str +) -> tuple[list[CFTypeRef], list[CFTypeRef]]: + """ + Given a single file, loads all the trust objects from it into arrays and + the keychain. + Returns a tuple of lists: the first list is a list of identities, the + second a list of certs. + """ + certificates = [] + identities = [] + result_array = None + + with open(path, "rb") as f: + raw_filedata = f.read() + + try: + filedata = CoreFoundation.CFDataCreate( + CoreFoundation.kCFAllocatorDefault, raw_filedata, len(raw_filedata) + ) + result_array = CoreFoundation.CFArrayRef() + result = Security.SecItemImport( + filedata, # cert data + None, # Filename, leaving it out for now + None, # What the type of the file is, we don't care + None, # what's in the file, we don't care + 0, # import flags + None, # key params, can include passphrase in the future + keychain, # The keychain to insert into + ctypes.byref(result_array), # Results + ) + _assert_no_error(result) + + # A CFArray is not very useful to us as an intermediary + # representation, so we are going to extract the objects we want + # and then free the array. We don't need to keep hold of keys: the + # keychain already has them! + result_count = CoreFoundation.CFArrayGetCount(result_array) + for index in range(result_count): + item = CoreFoundation.CFArrayGetValueAtIndex(result_array, index) + item = ctypes.cast(item, CoreFoundation.CFTypeRef) + + if _is_cert(item): + CoreFoundation.CFRetain(item) + certificates.append(item) + elif _is_identity(item): + CoreFoundation.CFRetain(item) + identities.append(item) + finally: + if result_array: + CoreFoundation.CFRelease(result_array) + + CoreFoundation.CFRelease(filedata) + + return (identities, certificates) + + +def _load_client_cert_chain(keychain: SecKeychainRef, *paths: str | None) -> CFArray: + """ + Load certificates and maybe keys from a number of files. Has the end goal + of returning a CFArray containing one SecIdentityRef, and then zero or more + SecCertificateRef objects, suitable for use as a client certificate trust + chain. + """ + # Ok, the strategy. + # + # This relies on knowing that macOS will not give you a SecIdentityRef + # unless you have imported a key into a keychain. This is a somewhat + # artificial limitation of macOS (for example, it doesn't necessarily + # affect iOS), but there is nothing inside Security.framework that lets you + # get a SecIdentityRef without having a key in a keychain. + # + # So the policy here is we take all the files and iterate them in order. + # Each one will use SecItemImport to have one or more objects loaded from + # it. We will also point at a keychain that macOS can use to work with the + # private key. + # + # Once we have all the objects, we'll check what we actually have. If we + # already have a SecIdentityRef in hand, fab: we'll use that. Otherwise, + # we'll take the first certificate (which we assume to be our leaf) and + # ask the keychain to give us a SecIdentityRef with that cert's associated + # key. + # + # We'll then return a CFArray containing the trust chain: one + # SecIdentityRef and then zero-or-more SecCertificateRef objects. The + # responsibility for freeing this CFArray will be with the caller. This + # CFArray must remain alive for the entire connection, so in practice it + # will be stored with a single SSLSocket, along with the reference to the + # keychain. + certificates = [] + identities = [] + + # Filter out bad paths. + filtered_paths = (path for path in paths if path) + + try: + for file_path in filtered_paths: + new_identities, new_certs = _load_items_from_file(keychain, file_path) + identities.extend(new_identities) + certificates.extend(new_certs) + + # Ok, we have everything. The question is: do we have an identity? If + # not, we want to grab one from the first cert we have. + if not identities: + new_identity = Security.SecIdentityRef() + status = Security.SecIdentityCreateWithCertificate( + keychain, certificates[0], ctypes.byref(new_identity) + ) + _assert_no_error(status) + identities.append(new_identity) + + # We now want to release the original certificate, as we no longer + # need it. + CoreFoundation.CFRelease(certificates.pop(0)) + + # We now need to build a new CFArray that holds the trust chain. + trust_chain = CoreFoundation.CFArrayCreateMutable( + CoreFoundation.kCFAllocatorDefault, + 0, + ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks), + ) + for item in itertools.chain(identities, certificates): + # ArrayAppendValue does a CFRetain on the item. That's fine, + # because the finally block will release our other refs to them. + CoreFoundation.CFArrayAppendValue(trust_chain, item) + + return trust_chain + finally: + for obj in itertools.chain(identities, certificates): + CoreFoundation.CFRelease(obj) + + +TLS_PROTOCOL_VERSIONS = { + "SSLv2": (0, 2), + "SSLv3": (3, 0), + "TLSv1": (3, 1), + "TLSv1.1": (3, 2), + "TLSv1.2": (3, 3), +} + + +def _build_tls_unknown_ca_alert(version: str) -> bytes: + """ + Builds a TLS alert record for an unknown CA. + """ + ver_maj, ver_min = TLS_PROTOCOL_VERSIONS[version] + severity_fatal = 0x02 + description_unknown_ca = 0x30 + msg = struct.pack(">BB", severity_fatal, description_unknown_ca) + msg_len = len(msg) + record_type_alert = 0x15 + record = struct.pack(">BBBH", record_type_alert, ver_maj, ver_min, msg_len) + msg + return record + + +class SecurityConst: + """ + A class object that acts as essentially a namespace for Security constants. + """ + + kSSLSessionOptionBreakOnServerAuth = 0 + + kSSLProtocol2 = 1 + kSSLProtocol3 = 2 + kTLSProtocol1 = 4 + kTLSProtocol11 = 7 + kTLSProtocol12 = 8 + # SecureTransport does not support TLS 1.3 even if there's a constant for it + kTLSProtocol13 = 10 + kTLSProtocolMaxSupported = 999 + + kSSLClientSide = 1 + kSSLStreamType = 0 + + kSecFormatPEMSequence = 10 + + kSecTrustResultInvalid = 0 + kSecTrustResultProceed = 1 + # This gap is present on purpose: this was kSecTrustResultConfirm, which + # is deprecated. + kSecTrustResultDeny = 3 + kSecTrustResultUnspecified = 4 + kSecTrustResultRecoverableTrustFailure = 5 + kSecTrustResultFatalTrustFailure = 6 + kSecTrustResultOtherError = 7 + + errSSLProtocol = -9800 + errSSLWouldBlock = -9803 + errSSLClosedGraceful = -9805 + errSSLClosedNoNotify = -9816 + errSSLClosedAbort = -9806 + + errSSLXCertChainInvalid = -9807 + errSSLCrypto = -9809 + errSSLInternal = -9810 + errSSLCertExpired = -9814 + errSSLCertNotYetValid = -9815 + errSSLUnknownRootCert = -9812 + errSSLNoRootCert = -9813 + errSSLHostNameMismatch = -9843 + errSSLPeerHandshakeFail = -9824 + errSSLPeerUserCancelled = -9839 + errSSLWeakPeerEphemeralDHKey = -9850 + errSSLServerAuthCompleted = -9841 + errSSLRecordOverflow = -9847 + + errSecVerifyFailed = -67808 + errSecNoTrustSettings = -25263 + errSecItemNotFound = -25300 + errSecInvalidTrustSettings = -25262 diff --git a/requests/python/urllib3/contrib/pyopenssl.py b/requests/python/urllib3/contrib/pyopenssl.py new file mode 100644 index 0000000..0089cd2 --- /dev/null +++ b/requests/python/urllib3/contrib/pyopenssl.py @@ -0,0 +1,557 @@ +""" +Module for using pyOpenSSL as a TLS backend. This module was relevant before +the standard library ``ssl`` module supported SNI, but now that we've dropped +support for Python 2.7 all relevant Python versions support SNI so +**this module is no longer recommended**. + +This needs the following packages installed: + +* `pyOpenSSL`_ (tested with 16.0.0) +* `cryptography`_ (minimum 1.3.4, from pyopenssl) +* `idna`_ (minimum 2.0, from cryptography) + +However, pyOpenSSL depends on cryptography, which depends on idna, so while we +use all three directly here we end up having relatively few packages required. + +You can install them with the following command: + +.. code-block:: bash + + $ python -m pip install pyopenssl cryptography idna + +To activate certificate checking, call +:func:`~urllib3.contrib.pyopenssl.inject_into_urllib3` from your Python code +before you begin making HTTP requests. This can be done in a ``sitecustomize`` +module, or at any other time before your application begins using ``urllib3``, +like this: + +.. code-block:: python + + try: + import urllib3.contrib.pyopenssl + urllib3.contrib.pyopenssl.inject_into_urllib3() + except ImportError: + pass + +.. _pyopenssl: https://www.pyopenssl.org +.. _cryptography: https://cryptography.io +.. _idna: https://github.com/kjd/idna +""" + +from __future__ import annotations + +import OpenSSL.SSL # type: ignore[import] +from cryptography import x509 + +try: + from cryptography.x509 import UnsupportedExtension # type: ignore[attr-defined] +except ImportError: + # UnsupportedExtension is gone in cryptography >= 2.1.0 + class UnsupportedExtension(Exception): # type: ignore[no-redef] + pass + + +import logging +import ssl +import typing +import warnings +from io import BytesIO +from socket import socket as socket_cls +from socket import timeout + +from .. import util + +warnings.warn( + "'urllib3.contrib.pyopenssl' module is deprecated and will be removed " + "in urllib3 v2.1.0. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2680", + category=DeprecationWarning, + stacklevel=2, +) + +if typing.TYPE_CHECKING: + from OpenSSL.crypto import X509 # type: ignore[import] + + +__all__ = ["inject_into_urllib3", "extract_from_urllib3"] + +# Map from urllib3 to PyOpenSSL compatible parameter-values. +_openssl_versions = { + util.ssl_.PROTOCOL_TLS: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] + util.ssl_.PROTOCOL_TLS_CLIENT: OpenSSL.SSL.SSLv23_METHOD, # type: ignore[attr-defined] + ssl.PROTOCOL_TLSv1: OpenSSL.SSL.TLSv1_METHOD, +} + +if hasattr(ssl, "PROTOCOL_TLSv1_1") and hasattr(OpenSSL.SSL, "TLSv1_1_METHOD"): + _openssl_versions[ssl.PROTOCOL_TLSv1_1] = OpenSSL.SSL.TLSv1_1_METHOD + +if hasattr(ssl, "PROTOCOL_TLSv1_2") and hasattr(OpenSSL.SSL, "TLSv1_2_METHOD"): + _openssl_versions[ssl.PROTOCOL_TLSv1_2] = OpenSSL.SSL.TLSv1_2_METHOD + + +_stdlib_to_openssl_verify = { + ssl.CERT_NONE: OpenSSL.SSL.VERIFY_NONE, + ssl.CERT_OPTIONAL: OpenSSL.SSL.VERIFY_PEER, + ssl.CERT_REQUIRED: OpenSSL.SSL.VERIFY_PEER + + OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT, +} +_openssl_to_stdlib_verify = {v: k for k, v in _stdlib_to_openssl_verify.items()} + +# The SSLvX values are the most likely to be missing in the future +# but we check them all just to be sure. +_OP_NO_SSLv2_OR_SSLv3: int = getattr(OpenSSL.SSL, "OP_NO_SSLv2", 0) | getattr( + OpenSSL.SSL, "OP_NO_SSLv3", 0 +) +_OP_NO_TLSv1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1", 0) +_OP_NO_TLSv1_1: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_1", 0) +_OP_NO_TLSv1_2: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_2", 0) +_OP_NO_TLSv1_3: int = getattr(OpenSSL.SSL, "OP_NO_TLSv1_3", 0) + +_openssl_to_ssl_minimum_version: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.TLSv1: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1, + ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1, + ssl.TLSVersion.TLSv1_3: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 + ), + ssl.TLSVersion.MAXIMUM_SUPPORTED: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 + ), +} +_openssl_to_ssl_maximum_version: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: ( + _OP_NO_SSLv2_OR_SSLv3 + | _OP_NO_TLSv1 + | _OP_NO_TLSv1_1 + | _OP_NO_TLSv1_2 + | _OP_NO_TLSv1_3 + ), + ssl.TLSVersion.TLSv1: ( + _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_1 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3 + ), + ssl.TLSVersion.TLSv1_1: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_2 | _OP_NO_TLSv1_3, + ssl.TLSVersion.TLSv1_2: _OP_NO_SSLv2_OR_SSLv3 | _OP_NO_TLSv1_3, + ssl.TLSVersion.TLSv1_3: _OP_NO_SSLv2_OR_SSLv3, + ssl.TLSVersion.MAXIMUM_SUPPORTED: _OP_NO_SSLv2_OR_SSLv3, +} + +# OpenSSL will only write 16K at a time +SSL_WRITE_BLOCKSIZE = 16384 + +orig_util_SSLContext = util.ssl_.SSLContext + + +log = logging.getLogger(__name__) + + +def inject_into_urllib3() -> None: + "Monkey-patch urllib3 with PyOpenSSL-backed SSL-support." + + _validate_dependencies_met() + + util.SSLContext = PyOpenSSLContext # type: ignore[assignment] + util.ssl_.SSLContext = PyOpenSSLContext # type: ignore[assignment] + util.IS_PYOPENSSL = True + util.ssl_.IS_PYOPENSSL = True + + +def extract_from_urllib3() -> None: + "Undo monkey-patching by :func:`inject_into_urllib3`." + + util.SSLContext = orig_util_SSLContext + util.ssl_.SSLContext = orig_util_SSLContext + util.IS_PYOPENSSL = False + util.ssl_.IS_PYOPENSSL = False + + +def _validate_dependencies_met() -> None: + """ + Verifies that PyOpenSSL's package-level dependencies have been met. + Throws `ImportError` if they are not met. + """ + # Method added in `cryptography==1.1`; not available in older versions + from cryptography.x509.extensions import Extensions + + if getattr(Extensions, "get_extension_for_class", None) is None: + raise ImportError( + "'cryptography' module missing required functionality. " + "Try upgrading to v1.3.4 or newer." + ) + + # pyOpenSSL 0.14 and above use cryptography for OpenSSL bindings. The _x509 + # attribute is only present on those versions. + from OpenSSL.crypto import X509 + + x509 = X509() + if getattr(x509, "_x509", None) is None: + raise ImportError( + "'pyOpenSSL' module missing required functionality. " + "Try upgrading to v0.14 or newer." + ) + + +def _dnsname_to_stdlib(name: str) -> str | None: + """ + Converts a dNSName SubjectAlternativeName field to the form used by the + standard library on the given Python version. + + Cryptography produces a dNSName as a unicode string that was idna-decoded + from ASCII bytes. We need to idna-encode that string to get it back, and + then on Python 3 we also need to convert to unicode via UTF-8 (the stdlib + uses PyUnicode_FromStringAndSize on it, which decodes via UTF-8). + + If the name cannot be idna-encoded then we return None signalling that + the name given should be skipped. + """ + + def idna_encode(name: str) -> bytes | None: + """ + Borrowed wholesale from the Python Cryptography Project. It turns out + that we can't just safely call `idna.encode`: it can explode for + wildcard names. This avoids that problem. + """ + import idna + + try: + for prefix in ["*.", "."]: + if name.startswith(prefix): + name = name[len(prefix) :] + return prefix.encode("ascii") + idna.encode(name) + return idna.encode(name) + except idna.core.IDNAError: + return None + + # Don't send IPv6 addresses through the IDNA encoder. + if ":" in name: + return name + + encoded_name = idna_encode(name) + if encoded_name is None: + return None + return encoded_name.decode("utf-8") + + +def get_subj_alt_name(peer_cert: X509) -> list[tuple[str, str]]: + """ + Given an PyOpenSSL certificate, provides all the subject alternative names. + """ + cert = peer_cert.to_cryptography() + + # We want to find the SAN extension. Ask Cryptography to locate it (it's + # faster than looping in Python) + try: + ext = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value + except x509.ExtensionNotFound: + # No such extension, return the empty list. + return [] + except ( + x509.DuplicateExtension, + UnsupportedExtension, + x509.UnsupportedGeneralNameType, + UnicodeError, + ) as e: + # A problem has been found with the quality of the certificate. Assume + # no SAN field is present. + log.warning( + "A problem was encountered with the certificate that prevented " + "urllib3 from finding the SubjectAlternativeName field. This can " + "affect certificate validation. The error was %s", + e, + ) + return [] + + # We want to return dNSName and iPAddress fields. We need to cast the IPs + # back to strings because the match_hostname function wants them as + # strings. + # Sadly the DNS names need to be idna encoded and then, on Python 3, UTF-8 + # decoded. This is pretty frustrating, but that's what the standard library + # does with certificates, and so we need to attempt to do the same. + # We also want to skip over names which cannot be idna encoded. + names = [ + ("DNS", name) + for name in map(_dnsname_to_stdlib, ext.get_values_for_type(x509.DNSName)) + if name is not None + ] + names.extend( + ("IP Address", str(name)) for name in ext.get_values_for_type(x509.IPAddress) + ) + + return names + + +class WrappedSocket: + """API-compatibility wrapper for Python OpenSSL's Connection-class.""" + + def __init__( + self, + connection: OpenSSL.SSL.Connection, + socket: socket_cls, + suppress_ragged_eofs: bool = True, + ) -> None: + self.connection = connection + self.socket = socket + self.suppress_ragged_eofs = suppress_ragged_eofs + self._io_refs = 0 + self._closed = False + + def fileno(self) -> int: + return self.socket.fileno() + + # Copy-pasted from Python 3.5 source code + def _decref_socketios(self) -> None: + if self._io_refs > 0: + self._io_refs -= 1 + if self._closed: + self.close() + + def recv(self, *args: typing.Any, **kwargs: typing.Any) -> bytes: + try: + data = self.connection.recv(*args, **kwargs) + except OpenSSL.SSL.SysCallError as e: + if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): + return b"" + else: + raise OSError(e.args[0], str(e)) from e + except OpenSSL.SSL.ZeroReturnError: + if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: + return b"" + else: + raise + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(self.socket, self.socket.gettimeout()): + raise timeout("The read operation timed out") from e + else: + return self.recv(*args, **kwargs) + + # TLS 1.3 post-handshake authentication + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"read error: {e!r}") from e + else: + return data # type: ignore[no-any-return] + + def recv_into(self, *args: typing.Any, **kwargs: typing.Any) -> int: + try: + return self.connection.recv_into(*args, **kwargs) # type: ignore[no-any-return] + except OpenSSL.SSL.SysCallError as e: + if self.suppress_ragged_eofs and e.args == (-1, "Unexpected EOF"): + return 0 + else: + raise OSError(e.args[0], str(e)) from e + except OpenSSL.SSL.ZeroReturnError: + if self.connection.get_shutdown() == OpenSSL.SSL.RECEIVED_SHUTDOWN: + return 0 + else: + raise + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(self.socket, self.socket.gettimeout()): + raise timeout("The read operation timed out") from e + else: + return self.recv_into(*args, **kwargs) + + # TLS 1.3 post-handshake authentication + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"read error: {e!r}") from e + + def settimeout(self, timeout: float) -> None: + return self.socket.settimeout(timeout) + + def _send_until_done(self, data: bytes) -> int: + while True: + try: + return self.connection.send(data) # type: ignore[no-any-return] + except OpenSSL.SSL.WantWriteError as e: + if not util.wait_for_write(self.socket, self.socket.gettimeout()): + raise timeout() from e + continue + except OpenSSL.SSL.SysCallError as e: + raise OSError(e.args[0], str(e)) from e + + def sendall(self, data: bytes) -> None: + total_sent = 0 + while total_sent < len(data): + sent = self._send_until_done( + data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] + ) + total_sent += sent + + def shutdown(self) -> None: + # FIXME rethrow compatible exceptions should we ever use this + self.connection.shutdown() + + def close(self) -> None: + self._closed = True + if self._io_refs <= 0: + self._real_close() + + def _real_close(self) -> None: + try: + return self.connection.close() # type: ignore[no-any-return] + except OpenSSL.SSL.Error: + return + + def getpeercert( + self, binary_form: bool = False + ) -> dict[str, list[typing.Any]] | None: + x509 = self.connection.get_peer_certificate() + + if not x509: + return x509 # type: ignore[no-any-return] + + if binary_form: + return OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_ASN1, x509) # type: ignore[no-any-return] + + return { + "subject": ((("commonName", x509.get_subject().CN),),), # type: ignore[dict-item] + "subjectAltName": get_subj_alt_name(x509), + } + + def version(self) -> str: + return self.connection.get_protocol_version_name() # type: ignore[no-any-return] + + +WrappedSocket.makefile = socket_cls.makefile # type: ignore[attr-defined] + + +class PyOpenSSLContext: + """ + I am a wrapper class for the PyOpenSSL ``Context`` object. I am responsible + for translating the interface of the standard library ``SSLContext`` object + to calls into PyOpenSSL. + """ + + def __init__(self, protocol: int) -> None: + self.protocol = _openssl_versions[protocol] + self._ctx = OpenSSL.SSL.Context(self.protocol) + self._options = 0 + self.check_hostname = False + self._minimum_version: int = ssl.TLSVersion.MINIMUM_SUPPORTED + self._maximum_version: int = ssl.TLSVersion.MAXIMUM_SUPPORTED + + @property + def options(self) -> int: + return self._options + + @options.setter + def options(self, value: int) -> None: + self._options = value + self._set_ctx_options() + + @property + def verify_mode(self) -> int: + return _openssl_to_stdlib_verify[self._ctx.get_verify_mode()] + + @verify_mode.setter + def verify_mode(self, value: ssl.VerifyMode) -> None: + self._ctx.set_verify(_stdlib_to_openssl_verify[value], _verify_callback) + + def set_default_verify_paths(self) -> None: + self._ctx.set_default_verify_paths() + + def set_ciphers(self, ciphers: bytes | str) -> None: + if isinstance(ciphers, str): + ciphers = ciphers.encode("utf-8") + self._ctx.set_cipher_list(ciphers) + + def load_verify_locations( + self, + cafile: str | None = None, + capath: str | None = None, + cadata: bytes | None = None, + ) -> None: + if cafile is not None: + cafile = cafile.encode("utf-8") # type: ignore[assignment] + if capath is not None: + capath = capath.encode("utf-8") # type: ignore[assignment] + try: + self._ctx.load_verify_locations(cafile, capath) + if cadata is not None: + self._ctx.load_verify_locations(BytesIO(cadata)) + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"unable to load trusted certificates: {e!r}") from e + + def load_cert_chain( + self, + certfile: str, + keyfile: str | None = None, + password: str | None = None, + ) -> None: + try: + self._ctx.use_certificate_chain_file(certfile) + if password is not None: + if not isinstance(password, bytes): + password = password.encode("utf-8") # type: ignore[assignment] + self._ctx.set_passwd_cb(lambda *_: password) + self._ctx.use_privatekey_file(keyfile or certfile) + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"Unable to load certificate chain: {e!r}") from e + + def set_alpn_protocols(self, protocols: list[bytes | str]) -> None: + protocols = [util.util.to_bytes(p, "ascii") for p in protocols] + return self._ctx.set_alpn_protos(protocols) # type: ignore[no-any-return] + + def wrap_socket( + self, + sock: socket_cls, + server_side: bool = False, + do_handshake_on_connect: bool = True, + suppress_ragged_eofs: bool = True, + server_hostname: bytes | str | None = None, + ) -> WrappedSocket: + cnx = OpenSSL.SSL.Connection(self._ctx, sock) + + # If server_hostname is an IP, don't use it for SNI, per RFC6066 Section 3 + if server_hostname and not util.ssl_.is_ipaddress(server_hostname): + if isinstance(server_hostname, str): + server_hostname = server_hostname.encode("utf-8") + cnx.set_tlsext_host_name(server_hostname) + + cnx.set_connect_state() + + while True: + try: + cnx.do_handshake() + except OpenSSL.SSL.WantReadError as e: + if not util.wait_for_read(sock, sock.gettimeout()): + raise timeout("select timed out") from e + continue + except OpenSSL.SSL.Error as e: + raise ssl.SSLError(f"bad handshake: {e!r}") from e + break + + return WrappedSocket(cnx, sock) + + def _set_ctx_options(self) -> None: + self._ctx.set_options( + self._options + | _openssl_to_ssl_minimum_version[self._minimum_version] + | _openssl_to_ssl_maximum_version[self._maximum_version] + ) + + @property + def minimum_version(self) -> int: + return self._minimum_version + + @minimum_version.setter + def minimum_version(self, minimum_version: int) -> None: + self._minimum_version = minimum_version + self._set_ctx_options() + + @property + def maximum_version(self) -> int: + return self._maximum_version + + @maximum_version.setter + def maximum_version(self, maximum_version: int) -> None: + self._maximum_version = maximum_version + self._set_ctx_options() + + +def _verify_callback( + cnx: OpenSSL.SSL.Connection, + x509: X509, + err_no: int, + err_depth: int, + return_code: int, +) -> bool: + return err_no == 0 diff --git a/requests/python/urllib3/contrib/securetransport.py b/requests/python/urllib3/contrib/securetransport.py new file mode 100644 index 0000000..11beb3d --- /dev/null +++ b/requests/python/urllib3/contrib/securetransport.py @@ -0,0 +1,913 @@ +""" +SecureTranport support for urllib3 via ctypes. + +This makes platform-native TLS available to urllib3 users on macOS without the +use of a compiler. This is an important feature because the Python Package +Index is moving to become a TLSv1.2-or-higher server, and the default OpenSSL +that ships with macOS is not capable of doing TLSv1.2. The only way to resolve +this is to give macOS users an alternative solution to the problem, and that +solution is to use SecureTransport. + +We use ctypes here because this solution must not require a compiler. That's +because pip is not allowed to require a compiler either. + +This is not intended to be a seriously long-term solution to this problem. +The hope is that PEP 543 will eventually solve this issue for us, at which +point we can retire this contrib module. But in the short term, we need to +solve the impending tire fire that is Python on Mac without this kind of +contrib module. So...here we are. + +To use this module, simply import and inject it:: + + import urllib3.contrib.securetransport + urllib3.contrib.securetransport.inject_into_urllib3() + +Happy TLSing! + +This code is a bastardised version of the code found in Will Bond's oscrypto +library. An enormous debt is owed to him for blazing this trail for us. For +that reason, this code should be considered to be covered both by urllib3's +license and by oscrypto's: + +.. code-block:: + + Copyright (c) 2015-2016 Will Bond + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +""" + +from __future__ import annotations + +import contextlib +import ctypes +import errno +import os.path +import shutil +import socket +import ssl +import struct +import threading +import typing +import warnings +import weakref +from socket import socket as socket_cls + +from .. import util +from ._securetransport.bindings import ( # type: ignore[attr-defined] + CoreFoundation, + Security, +) +from ._securetransport.low_level import ( + SecurityConst, + _assert_no_error, + _build_tls_unknown_ca_alert, + _cert_array_from_pem, + _create_cfstring_array, + _load_client_cert_chain, + _temporary_keychain, +) + +warnings.warn( + "'urllib3.contrib.securetransport' module is deprecated and will be removed " + "in urllib3 v2.1.0. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2681", + category=DeprecationWarning, + stacklevel=2, +) + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + +__all__ = ["inject_into_urllib3", "extract_from_urllib3"] + +orig_util_SSLContext = util.ssl_.SSLContext + +# This dictionary is used by the read callback to obtain a handle to the +# calling wrapped socket. This is a pretty silly approach, but for now it'll +# do. I feel like I should be able to smuggle a handle to the wrapped socket +# directly in the SSLConnectionRef, but for now this approach will work I +# guess. +# +# We need to lock around this structure for inserts, but we don't do it for +# reads/writes in the callbacks. The reasoning here goes as follows: +# +# 1. It is not possible to call into the callbacks before the dictionary is +# populated, so once in the callback the id must be in the dictionary. +# 2. The callbacks don't mutate the dictionary, they only read from it, and +# so cannot conflict with any of the insertions. +# +# This is good: if we had to lock in the callbacks we'd drastically slow down +# the performance of this code. +_connection_refs: weakref.WeakValueDictionary[ + int, WrappedSocket +] = weakref.WeakValueDictionary() +_connection_ref_lock = threading.Lock() + +# Limit writes to 16kB. This is OpenSSL's limit, but we'll cargo-cult it over +# for no better reason than we need *a* limit, and this one is right there. +SSL_WRITE_BLOCKSIZE = 16384 + +# Basically this is simple: for PROTOCOL_SSLv23 we turn it into a low of +# TLSv1 and a high of TLSv1.2. For everything else, we pin to that version. +# TLSv1 to 1.2 are supported on macOS 10.8+ +_protocol_to_min_max = { + util.ssl_.PROTOCOL_TLS: (SecurityConst.kTLSProtocol1, SecurityConst.kTLSProtocol12), # type: ignore[attr-defined] + util.ssl_.PROTOCOL_TLS_CLIENT: ( # type: ignore[attr-defined] + SecurityConst.kTLSProtocol1, + SecurityConst.kTLSProtocol12, + ), +} + +if hasattr(ssl, "PROTOCOL_SSLv2"): + _protocol_to_min_max[ssl.PROTOCOL_SSLv2] = ( + SecurityConst.kSSLProtocol2, + SecurityConst.kSSLProtocol2, + ) +if hasattr(ssl, "PROTOCOL_SSLv3"): + _protocol_to_min_max[ssl.PROTOCOL_SSLv3] = ( + SecurityConst.kSSLProtocol3, + SecurityConst.kSSLProtocol3, + ) +if hasattr(ssl, "PROTOCOL_TLSv1"): + _protocol_to_min_max[ssl.PROTOCOL_TLSv1] = ( + SecurityConst.kTLSProtocol1, + SecurityConst.kTLSProtocol1, + ) +if hasattr(ssl, "PROTOCOL_TLSv1_1"): + _protocol_to_min_max[ssl.PROTOCOL_TLSv1_1] = ( + SecurityConst.kTLSProtocol11, + SecurityConst.kTLSProtocol11, + ) +if hasattr(ssl, "PROTOCOL_TLSv1_2"): + _protocol_to_min_max[ssl.PROTOCOL_TLSv1_2] = ( + SecurityConst.kTLSProtocol12, + SecurityConst.kTLSProtocol12, + ) + + +_tls_version_to_st: dict[int, int] = { + ssl.TLSVersion.MINIMUM_SUPPORTED: SecurityConst.kTLSProtocol1, + ssl.TLSVersion.TLSv1: SecurityConst.kTLSProtocol1, + ssl.TLSVersion.TLSv1_1: SecurityConst.kTLSProtocol11, + ssl.TLSVersion.TLSv1_2: SecurityConst.kTLSProtocol12, + ssl.TLSVersion.MAXIMUM_SUPPORTED: SecurityConst.kTLSProtocol12, +} + + +def inject_into_urllib3() -> None: + """ + Monkey-patch urllib3 with SecureTransport-backed SSL-support. + """ + util.SSLContext = SecureTransportContext # type: ignore[assignment] + util.ssl_.SSLContext = SecureTransportContext # type: ignore[assignment] + util.IS_SECURETRANSPORT = True + util.ssl_.IS_SECURETRANSPORT = True + + +def extract_from_urllib3() -> None: + """ + Undo monkey-patching by :func:`inject_into_urllib3`. + """ + util.SSLContext = orig_util_SSLContext + util.ssl_.SSLContext = orig_util_SSLContext + util.IS_SECURETRANSPORT = False + util.ssl_.IS_SECURETRANSPORT = False + + +def _read_callback( + connection_id: int, data_buffer: int, data_length_pointer: bytearray +) -> int: + """ + SecureTransport read callback. This is called by ST to request that data + be returned from the socket. + """ + wrapped_socket = None + try: + wrapped_socket = _connection_refs.get(connection_id) + if wrapped_socket is None: + return SecurityConst.errSSLInternal + base_socket = wrapped_socket.socket + + requested_length = data_length_pointer[0] + + timeout = wrapped_socket.gettimeout() + error = None + read_count = 0 + + try: + while read_count < requested_length: + if timeout is None or timeout >= 0: + if not util.wait_for_read(base_socket, timeout): + raise OSError(errno.EAGAIN, "timed out") + + remaining = requested_length - read_count + buffer = (ctypes.c_char * remaining).from_address( + data_buffer + read_count + ) + chunk_size = base_socket.recv_into(buffer, remaining) + read_count += chunk_size + if not chunk_size: + if not read_count: + return SecurityConst.errSSLClosedGraceful + break + except OSError as e: + error = e.errno + + if error is not None and error != errno.EAGAIN: + data_length_pointer[0] = read_count + if error == errno.ECONNRESET or error == errno.EPIPE: + return SecurityConst.errSSLClosedAbort + raise + + data_length_pointer[0] = read_count + + if read_count != requested_length: + return SecurityConst.errSSLWouldBlock + + return 0 + except Exception as e: + if wrapped_socket is not None: + wrapped_socket._exception = e + return SecurityConst.errSSLInternal + + +def _write_callback( + connection_id: int, data_buffer: int, data_length_pointer: bytearray +) -> int: + """ + SecureTransport write callback. This is called by ST to request that data + actually be sent on the network. + """ + wrapped_socket = None + try: + wrapped_socket = _connection_refs.get(connection_id) + if wrapped_socket is None: + return SecurityConst.errSSLInternal + base_socket = wrapped_socket.socket + + bytes_to_write = data_length_pointer[0] + data = ctypes.string_at(data_buffer, bytes_to_write) + + timeout = wrapped_socket.gettimeout() + error = None + sent = 0 + + try: + while sent < bytes_to_write: + if timeout is None or timeout >= 0: + if not util.wait_for_write(base_socket, timeout): + raise OSError(errno.EAGAIN, "timed out") + chunk_sent = base_socket.send(data) + sent += chunk_sent + + # This has some needless copying here, but I'm not sure there's + # much value in optimising this data path. + data = data[chunk_sent:] + except OSError as e: + error = e.errno + + if error is not None and error != errno.EAGAIN: + data_length_pointer[0] = sent + if error == errno.ECONNRESET or error == errno.EPIPE: + return SecurityConst.errSSLClosedAbort + raise + + data_length_pointer[0] = sent + + if sent != bytes_to_write: + return SecurityConst.errSSLWouldBlock + + return 0 + except Exception as e: + if wrapped_socket is not None: + wrapped_socket._exception = e + return SecurityConst.errSSLInternal + + +# We need to keep these two objects references alive: if they get GC'd while +# in use then SecureTransport could attempt to call a function that is in freed +# memory. That would be...uh...bad. Yeah, that's the word. Bad. +_read_callback_pointer = Security.SSLReadFunc(_read_callback) +_write_callback_pointer = Security.SSLWriteFunc(_write_callback) + + +class WrappedSocket: + """ + API-compatibility wrapper for Python's OpenSSL wrapped socket object. + """ + + def __init__(self, socket: socket_cls) -> None: + self.socket = socket + self.context = None + self._io_refs = 0 + self._closed = False + self._real_closed = False + self._exception: Exception | None = None + self._keychain = None + self._keychain_dir: str | None = None + self._client_cert_chain = None + + # We save off the previously-configured timeout and then set it to + # zero. This is done because we use select and friends to handle the + # timeouts, but if we leave the timeout set on the lower socket then + # Python will "kindly" call select on that socket again for us. Avoid + # that by forcing the timeout to zero. + self._timeout = self.socket.gettimeout() + self.socket.settimeout(0) + + @contextlib.contextmanager + def _raise_on_error(self) -> typing.Generator[None, None, None]: + """ + A context manager that can be used to wrap calls that do I/O from + SecureTransport. If any of the I/O callbacks hit an exception, this + context manager will correctly propagate the exception after the fact. + This avoids silently swallowing those exceptions. + + It also correctly forces the socket closed. + """ + self._exception = None + + # We explicitly don't catch around this yield because in the unlikely + # event that an exception was hit in the block we don't want to swallow + # it. + yield + if self._exception is not None: + exception, self._exception = self._exception, None + self._real_close() + raise exception + + def _set_alpn_protocols(self, protocols: list[bytes] | None) -> None: + """ + Sets up the ALPN protocols on the context. + """ + if not protocols: + return + protocols_arr = _create_cfstring_array(protocols) + try: + result = Security.SSLSetALPNProtocols(self.context, protocols_arr) + _assert_no_error(result) + finally: + CoreFoundation.CFRelease(protocols_arr) + + def _custom_validate(self, verify: bool, trust_bundle: bytes | None) -> None: + """ + Called when we have set custom validation. We do this in two cases: + first, when cert validation is entirely disabled; and second, when + using a custom trust DB. + Raises an SSLError if the connection is not trusted. + """ + # If we disabled cert validation, just say: cool. + if not verify or trust_bundle is None: + return + + successes = ( + SecurityConst.kSecTrustResultUnspecified, + SecurityConst.kSecTrustResultProceed, + ) + try: + trust_result = self._evaluate_trust(trust_bundle) + if trust_result in successes: + return + reason = f"error code: {int(trust_result)}" + exc = None + except Exception as e: + # Do not trust on error + reason = f"exception: {e!r}" + exc = e + + # SecureTransport does not send an alert nor shuts down the connection. + rec = _build_tls_unknown_ca_alert(self.version()) + self.socket.sendall(rec) + # close the connection immediately + # l_onoff = 1, activate linger + # l_linger = 0, linger for 0 seoncds + opts = struct.pack("ii", 1, 0) + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, opts) + self._real_close() + raise ssl.SSLError(f"certificate verify failed, {reason}") from exc + + def _evaluate_trust(self, trust_bundle: bytes) -> int: + # We want data in memory, so load it up. + if os.path.isfile(trust_bundle): + with open(trust_bundle, "rb") as f: + trust_bundle = f.read() + + cert_array = None + trust = Security.SecTrustRef() + + try: + # Get a CFArray that contains the certs we want. + cert_array = _cert_array_from_pem(trust_bundle) + + # Ok, now the hard part. We want to get the SecTrustRef that ST has + # created for this connection, shove our CAs into it, tell ST to + # ignore everything else it knows, and then ask if it can build a + # chain. This is a buuuunch of code. + result = Security.SSLCopyPeerTrust(self.context, ctypes.byref(trust)) + _assert_no_error(result) + if not trust: + raise ssl.SSLError("Failed to copy trust reference") + + result = Security.SecTrustSetAnchorCertificates(trust, cert_array) + _assert_no_error(result) + + result = Security.SecTrustSetAnchorCertificatesOnly(trust, True) + _assert_no_error(result) + + trust_result = Security.SecTrustResultType() + result = Security.SecTrustEvaluate(trust, ctypes.byref(trust_result)) + _assert_no_error(result) + finally: + if trust: + CoreFoundation.CFRelease(trust) + + if cert_array is not None: + CoreFoundation.CFRelease(cert_array) + + return trust_result.value # type: ignore[no-any-return] + + def handshake( + self, + server_hostname: bytes | str | None, + verify: bool, + trust_bundle: bytes | None, + min_version: int, + max_version: int, + client_cert: str | None, + client_key: str | None, + client_key_passphrase: typing.Any, + alpn_protocols: list[bytes] | None, + ) -> None: + """ + Actually performs the TLS handshake. This is run automatically by + wrapped socket, and shouldn't be needed in user code. + """ + # First, we do the initial bits of connection setup. We need to create + # a context, set its I/O funcs, and set the connection reference. + self.context = Security.SSLCreateContext( + None, SecurityConst.kSSLClientSide, SecurityConst.kSSLStreamType + ) + result = Security.SSLSetIOFuncs( + self.context, _read_callback_pointer, _write_callback_pointer + ) + _assert_no_error(result) + + # Here we need to compute the handle to use. We do this by taking the + # id of self modulo 2**31 - 1. If this is already in the dictionary, we + # just keep incrementing by one until we find a free space. + with _connection_ref_lock: + handle = id(self) % 2147483647 + while handle in _connection_refs: + handle = (handle + 1) % 2147483647 + _connection_refs[handle] = self + + result = Security.SSLSetConnection(self.context, handle) + _assert_no_error(result) + + # If we have a server hostname, we should set that too. + # RFC6066 Section 3 tells us not to use SNI when the host is an IP, but we have + # to do it anyway to match server_hostname against the server certificate + if server_hostname: + if not isinstance(server_hostname, bytes): + server_hostname = server_hostname.encode("utf-8") + + result = Security.SSLSetPeerDomainName( + self.context, server_hostname, len(server_hostname) + ) + _assert_no_error(result) + + # Setup the ALPN protocols. + self._set_alpn_protocols(alpn_protocols) + + # Set the minimum and maximum TLS versions. + result = Security.SSLSetProtocolVersionMin(self.context, min_version) + _assert_no_error(result) + + result = Security.SSLSetProtocolVersionMax(self.context, max_version) + _assert_no_error(result) + + # If there's a trust DB, we need to use it. We do that by telling + # SecureTransport to break on server auth. We also do that if we don't + # want to validate the certs at all: we just won't actually do any + # authing in that case. + if not verify or trust_bundle is not None: + result = Security.SSLSetSessionOption( + self.context, SecurityConst.kSSLSessionOptionBreakOnServerAuth, True + ) + _assert_no_error(result) + + # If there's a client cert, we need to use it. + if client_cert: + self._keychain, self._keychain_dir = _temporary_keychain() + self._client_cert_chain = _load_client_cert_chain( + self._keychain, client_cert, client_key + ) + result = Security.SSLSetCertificate(self.context, self._client_cert_chain) + _assert_no_error(result) + + while True: + with self._raise_on_error(): + result = Security.SSLHandshake(self.context) + + if result == SecurityConst.errSSLWouldBlock: + raise socket.timeout("handshake timed out") + elif result == SecurityConst.errSSLServerAuthCompleted: + self._custom_validate(verify, trust_bundle) + continue + else: + _assert_no_error(result) + break + + def fileno(self) -> int: + return self.socket.fileno() + + # Copy-pasted from Python 3.5 source code + def _decref_socketios(self) -> None: + if self._io_refs > 0: + self._io_refs -= 1 + if self._closed: + self.close() + + def recv(self, bufsiz: int) -> bytes: + buffer = ctypes.create_string_buffer(bufsiz) + bytes_read = self.recv_into(buffer, bufsiz) + data = buffer[:bytes_read] + return typing.cast(bytes, data) + + def recv_into( + self, buffer: ctypes.Array[ctypes.c_char], nbytes: int | None = None + ) -> int: + # Read short on EOF. + if self._real_closed: + return 0 + + if nbytes is None: + nbytes = len(buffer) + + buffer = (ctypes.c_char * nbytes).from_buffer(buffer) + processed_bytes = ctypes.c_size_t(0) + + with self._raise_on_error(): + result = Security.SSLRead( + self.context, buffer, nbytes, ctypes.byref(processed_bytes) + ) + + # There are some result codes that we want to treat as "not always + # errors". Specifically, those are errSSLWouldBlock, + # errSSLClosedGraceful, and errSSLClosedNoNotify. + if result == SecurityConst.errSSLWouldBlock: + # If we didn't process any bytes, then this was just a time out. + # However, we can get errSSLWouldBlock in situations when we *did* + # read some data, and in those cases we should just read "short" + # and return. + if processed_bytes.value == 0: + # Timed out, no data read. + raise socket.timeout("recv timed out") + elif result in ( + SecurityConst.errSSLClosedGraceful, + SecurityConst.errSSLClosedNoNotify, + ): + # The remote peer has closed this connection. We should do so as + # well. Note that we don't actually return here because in + # principle this could actually be fired along with return data. + # It's unlikely though. + self._real_close() + else: + _assert_no_error(result) + + # Ok, we read and probably succeeded. We should return whatever data + # was actually read. + return processed_bytes.value + + def settimeout(self, timeout: float) -> None: + self._timeout = timeout + + def gettimeout(self) -> float | None: + return self._timeout + + def send(self, data: bytes) -> int: + processed_bytes = ctypes.c_size_t(0) + + with self._raise_on_error(): + result = Security.SSLWrite( + self.context, data, len(data), ctypes.byref(processed_bytes) + ) + + if result == SecurityConst.errSSLWouldBlock and processed_bytes.value == 0: + # Timed out + raise socket.timeout("send timed out") + else: + _assert_no_error(result) + + # We sent, and probably succeeded. Tell them how much we sent. + return processed_bytes.value + + def sendall(self, data: bytes) -> None: + total_sent = 0 + while total_sent < len(data): + sent = self.send(data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE]) + total_sent += sent + + def shutdown(self) -> None: + with self._raise_on_error(): + Security.SSLClose(self.context) + + def close(self) -> None: + self._closed = True + # TODO: should I do clean shutdown here? Do I have to? + if self._io_refs <= 0: + self._real_close() + + def _real_close(self) -> None: + self._real_closed = True + if self.context: + CoreFoundation.CFRelease(self.context) + self.context = None + if self._client_cert_chain: + CoreFoundation.CFRelease(self._client_cert_chain) + self._client_cert_chain = None + if self._keychain: + Security.SecKeychainDelete(self._keychain) + CoreFoundation.CFRelease(self._keychain) + shutil.rmtree(self._keychain_dir) + self._keychain = self._keychain_dir = None + return self.socket.close() + + def getpeercert(self, binary_form: bool = False) -> bytes | None: + # Urgh, annoying. + # + # Here's how we do this: + # + # 1. Call SSLCopyPeerTrust to get hold of the trust object for this + # connection. + # 2. Call SecTrustGetCertificateAtIndex for index 0 to get the leaf. + # 3. To get the CN, call SecCertificateCopyCommonName and process that + # string so that it's of the appropriate type. + # 4. To get the SAN, we need to do something a bit more complex: + # a. Call SecCertificateCopyValues to get the data, requesting + # kSecOIDSubjectAltName. + # b. Mess about with this dictionary to try to get the SANs out. + # + # This is gross. Really gross. It's going to be a few hundred LoC extra + # just to repeat something that SecureTransport can *already do*. So my + # operating assumption at this time is that what we want to do is + # instead to just flag to urllib3 that it shouldn't do its own hostname + # validation when using SecureTransport. + if not binary_form: + raise ValueError("SecureTransport only supports dumping binary certs") + trust = Security.SecTrustRef() + certdata = None + der_bytes = None + + try: + # Grab the trust store. + result = Security.SSLCopyPeerTrust(self.context, ctypes.byref(trust)) + _assert_no_error(result) + if not trust: + # Probably we haven't done the handshake yet. No biggie. + return None + + cert_count = Security.SecTrustGetCertificateCount(trust) + if not cert_count: + # Also a case that might happen if we haven't handshaked. + # Handshook? Handshaken? + return None + + leaf = Security.SecTrustGetCertificateAtIndex(trust, 0) + assert leaf + + # Ok, now we want the DER bytes. + certdata = Security.SecCertificateCopyData(leaf) + assert certdata + + data_length = CoreFoundation.CFDataGetLength(certdata) + data_buffer = CoreFoundation.CFDataGetBytePtr(certdata) + der_bytes = ctypes.string_at(data_buffer, data_length) + finally: + if certdata: + CoreFoundation.CFRelease(certdata) + if trust: + CoreFoundation.CFRelease(trust) + + return der_bytes + + def version(self) -> str: + protocol = Security.SSLProtocol() + result = Security.SSLGetNegotiatedProtocolVersion( + self.context, ctypes.byref(protocol) + ) + _assert_no_error(result) + if protocol.value == SecurityConst.kTLSProtocol13: + raise ssl.SSLError("SecureTransport does not support TLS 1.3") + elif protocol.value == SecurityConst.kTLSProtocol12: + return "TLSv1.2" + elif protocol.value == SecurityConst.kTLSProtocol11: + return "TLSv1.1" + elif protocol.value == SecurityConst.kTLSProtocol1: + return "TLSv1" + elif protocol.value == SecurityConst.kSSLProtocol3: + return "SSLv3" + elif protocol.value == SecurityConst.kSSLProtocol2: + return "SSLv2" + else: + raise ssl.SSLError(f"Unknown TLS version: {protocol!r}") + + +def makefile( + self: socket_cls, + mode: ( + Literal["r"] | Literal["w"] | Literal["rw"] | Literal["wr"] | Literal[""] + ) = "r", + buffering: int | None = None, + *args: typing.Any, + **kwargs: typing.Any, +) -> typing.BinaryIO | typing.TextIO: + # We disable buffering with SecureTransport because it conflicts with + # the buffering that ST does internally (see issue #1153 for more). + buffering = 0 + return socket_cls.makefile(self, mode, buffering, *args, **kwargs) + + +WrappedSocket.makefile = makefile # type: ignore[attr-defined] + + +class SecureTransportContext: + """ + I am a wrapper class for the SecureTransport library, to translate the + interface of the standard library ``SSLContext`` object to calls into + SecureTransport. + """ + + def __init__(self, protocol: int) -> None: + self._minimum_version: int = ssl.TLSVersion.MINIMUM_SUPPORTED + self._maximum_version: int = ssl.TLSVersion.MAXIMUM_SUPPORTED + if protocol not in (None, ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLS_CLIENT): + self._min_version, self._max_version = _protocol_to_min_max[protocol] + + self._options = 0 + self._verify = False + self._trust_bundle: bytes | None = None + self._client_cert: str | None = None + self._client_key: str | None = None + self._client_key_passphrase = None + self._alpn_protocols: list[bytes] | None = None + + @property + def check_hostname(self) -> Literal[True]: + """ + SecureTransport cannot have its hostname checking disabled. For more, + see the comment on getpeercert() in this file. + """ + return True + + @check_hostname.setter + def check_hostname(self, value: typing.Any) -> None: + """ + SecureTransport cannot have its hostname checking disabled. For more, + see the comment on getpeercert() in this file. + """ + + @property + def options(self) -> int: + # TODO: Well, crap. + # + # So this is the bit of the code that is the most likely to cause us + # trouble. Essentially we need to enumerate all of the SSL options that + # users might want to use and try to see if we can sensibly translate + # them, or whether we should just ignore them. + return self._options + + @options.setter + def options(self, value: int) -> None: + # TODO: Update in line with above. + self._options = value + + @property + def verify_mode(self) -> int: + return ssl.CERT_REQUIRED if self._verify else ssl.CERT_NONE + + @verify_mode.setter + def verify_mode(self, value: int) -> None: + self._verify = value == ssl.CERT_REQUIRED + + def set_default_verify_paths(self) -> None: + # So, this has to do something a bit weird. Specifically, what it does + # is nothing. + # + # This means that, if we had previously had load_verify_locations + # called, this does not undo that. We need to do that because it turns + # out that the rest of the urllib3 code will attempt to load the + # default verify paths if it hasn't been told about any paths, even if + # the context itself was sometime earlier. We resolve that by just + # ignoring it. + pass + + def load_default_certs(self) -> None: + return self.set_default_verify_paths() + + def set_ciphers(self, ciphers: typing.Any) -> None: + raise ValueError("SecureTransport doesn't support custom cipher strings") + + def load_verify_locations( + self, + cafile: str | None = None, + capath: str | None = None, + cadata: bytes | None = None, + ) -> None: + # OK, we only really support cadata and cafile. + if capath is not None: + raise ValueError("SecureTransport does not support cert directories") + + # Raise if cafile does not exist. + if cafile is not None: + with open(cafile): + pass + + self._trust_bundle = cafile or cadata # type: ignore[assignment] + + def load_cert_chain( + self, + certfile: str, + keyfile: str | None = None, + password: str | None = None, + ) -> None: + self._client_cert = certfile + self._client_key = keyfile + self._client_cert_passphrase = password + + def set_alpn_protocols(self, protocols: list[str | bytes]) -> None: + """ + Sets the ALPN protocols that will later be set on the context. + + Raises a NotImplementedError if ALPN is not supported. + """ + if not hasattr(Security, "SSLSetALPNProtocols"): + raise NotImplementedError( + "SecureTransport supports ALPN only in macOS 10.12+" + ) + self._alpn_protocols = [util.util.to_bytes(p, "ascii") for p in protocols] + + def wrap_socket( + self, + sock: socket_cls, + server_side: bool = False, + do_handshake_on_connect: bool = True, + suppress_ragged_eofs: bool = True, + server_hostname: bytes | str | None = None, + ) -> WrappedSocket: + # So, what do we do here? Firstly, we assert some properties. This is a + # stripped down shim, so there is some functionality we don't support. + # See PEP 543 for the real deal. + assert not server_side + assert do_handshake_on_connect + assert suppress_ragged_eofs + + # Ok, we're good to go. Now we want to create the wrapped socket object + # and store it in the appropriate place. + wrapped_socket = WrappedSocket(sock) + + # Now we can handshake + wrapped_socket.handshake( + server_hostname, + self._verify, + self._trust_bundle, + _tls_version_to_st[self._minimum_version], + _tls_version_to_st[self._maximum_version], + self._client_cert, + self._client_key, + self._client_key_passphrase, + self._alpn_protocols, + ) + return wrapped_socket + + @property + def minimum_version(self) -> int: + return self._minimum_version + + @minimum_version.setter + def minimum_version(self, minimum_version: int) -> None: + self._minimum_version = minimum_version + + @property + def maximum_version(self) -> int: + return self._maximum_version + + @maximum_version.setter + def maximum_version(self, maximum_version: int) -> None: + self._maximum_version = maximum_version diff --git a/requests/python/urllib3/contrib/socks.py b/requests/python/urllib3/contrib/socks.py new file mode 100644 index 0000000..5e552dd --- /dev/null +++ b/requests/python/urllib3/contrib/socks.py @@ -0,0 +1,233 @@ +""" +This module contains provisional support for SOCKS proxies from within +urllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and +SOCKS5. To enable its functionality, either install PySocks or install this +module with the ``socks`` extra. + +The SOCKS implementation supports the full range of urllib3 features. It also +supports the following SOCKS features: + +- SOCKS4A (``proxy_url='socks4a://...``) +- SOCKS4 (``proxy_url='socks4://...``) +- SOCKS5 with remote DNS (``proxy_url='socks5h://...``) +- SOCKS5 with local DNS (``proxy_url='socks5://...``) +- Usernames and passwords for the SOCKS proxy + +.. note:: + It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in + your ``proxy_url`` to ensure that DNS resolution is done from the remote + server instead of client-side when connecting to a domain name. + +SOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5 +supports IPv4, IPv6, and domain names. + +When connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url`` +will be sent as the ``userid`` section of the SOCKS request: + +.. code-block:: python + + proxy_url="socks4a://@proxy-host" + +When connecting to a SOCKS5 proxy the ``username`` and ``password`` portion +of the ``proxy_url`` will be sent as the username/password to authenticate +with the proxy: + +.. code-block:: python + + proxy_url="socks5h://:@proxy-host" + +""" + +from __future__ import annotations + +try: + import socks # type: ignore[import] +except ImportError: + import warnings + + from ..exceptions import DependencyWarning + + warnings.warn( + ( + "SOCKS support in urllib3 requires the installation of optional " + "dependencies: specifically, PySocks. For more information, see " + "https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies" + ), + DependencyWarning, + ) + raise + +import typing +from socket import timeout as SocketTimeout + +from ..connection import HTTPConnection, HTTPSConnection +from ..connectionpool import HTTPConnectionPool, HTTPSConnectionPool +from ..exceptions import ConnectTimeoutError, NewConnectionError +from ..poolmanager import PoolManager +from ..util.url import parse_url + +try: + import ssl +except ImportError: + ssl = None # type: ignore[assignment] + +try: + from typing import TypedDict + + class _TYPE_SOCKS_OPTIONS(TypedDict): + socks_version: int + proxy_host: str | None + proxy_port: str | None + username: str | None + password: str | None + rdns: bool + +except ImportError: # Python 3.7 + _TYPE_SOCKS_OPTIONS = typing.Dict[str, typing.Any] # type: ignore[misc, assignment] + + +class SOCKSConnection(HTTPConnection): + """ + A plain-text HTTP connection that connects via a SOCKS proxy. + """ + + def __init__( + self, + _socks_options: _TYPE_SOCKS_OPTIONS, + *args: typing.Any, + **kwargs: typing.Any, + ) -> None: + self._socks_options = _socks_options + super().__init__(*args, **kwargs) + + def _new_conn(self) -> socks.socksocket: + """ + Establish a new connection via the SOCKS proxy. + """ + extra_kw: dict[str, typing.Any] = {} + if self.source_address: + extra_kw["source_address"] = self.source_address + + if self.socket_options: + extra_kw["socket_options"] = self.socket_options + + try: + conn = socks.create_connection( + (self.host, self.port), + proxy_type=self._socks_options["socks_version"], + proxy_addr=self._socks_options["proxy_host"], + proxy_port=self._socks_options["proxy_port"], + proxy_username=self._socks_options["username"], + proxy_password=self._socks_options["password"], + proxy_rdns=self._socks_options["rdns"], + timeout=self.timeout, + **extra_kw, + ) + + except SocketTimeout as e: + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + + except socks.ProxyError as e: + # This is fragile as hell, but it seems to be the only way to raise + # useful errors here. + if e.socket_err: + error = e.socket_err + if isinstance(error, SocketTimeout): + raise ConnectTimeoutError( + self, + f"Connection to {self.host} timed out. (connect timeout={self.timeout})", + ) from e + else: + # Adding `from e` messes with coverage somehow, so it's omitted. + # See #2386. + raise NewConnectionError( + self, f"Failed to establish a new connection: {error}" + ) + else: + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + except OSError as e: # Defensive: PySocks should catch all these. + raise NewConnectionError( + self, f"Failed to establish a new connection: {e}" + ) from e + + return conn + + +# We don't need to duplicate the Verified/Unverified distinction from +# urllib3/connection.py here because the HTTPSConnection will already have been +# correctly set to either the Verified or Unverified form by that module. This +# means the SOCKSHTTPSConnection will automatically be the correct type. +class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection): + pass + + +class SOCKSHTTPConnectionPool(HTTPConnectionPool): + ConnectionCls = SOCKSConnection + + +class SOCKSHTTPSConnectionPool(HTTPSConnectionPool): + ConnectionCls = SOCKSHTTPSConnection + + +class SOCKSProxyManager(PoolManager): + """ + A version of the urllib3 ProxyManager that routes connections via the + defined SOCKS proxy. + """ + + pool_classes_by_scheme = { + "http": SOCKSHTTPConnectionPool, + "https": SOCKSHTTPSConnectionPool, + } + + def __init__( + self, + proxy_url: str, + username: str | None = None, + password: str | None = None, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + **connection_pool_kw: typing.Any, + ): + parsed = parse_url(proxy_url) + + if username is None and password is None and parsed.auth is not None: + split = parsed.auth.split(":") + if len(split) == 2: + username, password = split + if parsed.scheme == "socks5": + socks_version = socks.PROXY_TYPE_SOCKS5 + rdns = False + elif parsed.scheme == "socks5h": + socks_version = socks.PROXY_TYPE_SOCKS5 + rdns = True + elif parsed.scheme == "socks4": + socks_version = socks.PROXY_TYPE_SOCKS4 + rdns = False + elif parsed.scheme == "socks4a": + socks_version = socks.PROXY_TYPE_SOCKS4 + rdns = True + else: + raise ValueError(f"Unable to determine SOCKS version from {proxy_url}") + + self.proxy_url = proxy_url + + socks_options = { + "socks_version": socks_version, + "proxy_host": parsed.host, + "proxy_port": parsed.port, + "username": username, + "password": password, + "rdns": rdns, + } + connection_pool_kw["_socks_options"] = socks_options + + super().__init__(num_pools, headers, **connection_pool_kw) + + self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme diff --git a/requests/python/urllib3/exceptions.py b/requests/python/urllib3/exceptions.py new file mode 100644 index 0000000..5bb9236 --- /dev/null +++ b/requests/python/urllib3/exceptions.py @@ -0,0 +1,318 @@ +from __future__ import annotations + +import socket +import typing +import warnings +from email.errors import MessageDefect +from http.client import IncompleteRead as httplib_IncompleteRead + +if typing.TYPE_CHECKING: + from .connection import HTTPConnection + from .connectionpool import ConnectionPool + from .response import HTTPResponse + from .util.retry import Retry + +# Base Exceptions + + +class HTTPError(Exception): + """Base exception used by this module.""" + + +class HTTPWarning(Warning): + """Base warning used by this module.""" + + +_TYPE_REDUCE_RESULT = typing.Tuple[ + typing.Callable[..., object], typing.Tuple[object, ...] +] + + +class PoolError(HTTPError): + """Base exception for errors caused within a pool.""" + + def __init__(self, pool: ConnectionPool, message: str) -> None: + self.pool = pool + super().__init__(f"{pool}: {message}") + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, None) + + +class RequestError(PoolError): + """Base exception for PoolErrors that have associated URLs.""" + + def __init__(self, pool: ConnectionPool, url: str, message: str) -> None: + self.url = url + super().__init__(pool, message) + + def __reduce__(self) -> _TYPE_REDUCE_RESULT: + # For pickling purposes. + return self.__class__, (None, self.url, None) + + +class SSLError(HTTPError): + """Raised when SSL certificate fails in an HTTPS connection.""" + + +class ProxyError(HTTPError): + """Raised when the connection to a proxy fails.""" + + # The original error is also available as __cause__. + original_error: Exception + + def __init__(self, message: str, error: Exception) -> None: + super().__init__(message, error) + self.original_error = error + + +class DecodeError(HTTPError): + """Raised when automatic decoding based on Content-Type fails.""" + + +class ProtocolError(HTTPError): + """Raised when something unexpected happens mid-request/response.""" + + +#: Renamed to ProtocolError but aliased for backwards compatibility. +ConnectionError = ProtocolError + + +# Leaf Exceptions + + +class MaxRetryError(RequestError): + """Raised when the maximum number of retries is exceeded. + + :param pool: The connection pool + :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool` + :param str url: The requested Url + :param reason: The underlying error + :type reason: :class:`Exception` + + """ + + def __init__( + self, pool: ConnectionPool, url: str, reason: Exception | None = None + ) -> None: + self.reason = reason + + message = f"Max retries exceeded with url: {url} (Caused by {reason!r})" + + super().__init__(pool, url, message) + + +class HostChangedError(RequestError): + """Raised when an existing pool gets a request for a foreign host.""" + + def __init__( + self, pool: ConnectionPool, url: str, retries: Retry | int = 3 + ) -> None: + message = f"Tried to open a foreign host with url: {url}" + super().__init__(pool, url, message) + self.retries = retries + + +class TimeoutStateError(HTTPError): + """Raised when passing an invalid state to a timeout""" + + +class TimeoutError(HTTPError): + """Raised when a socket timeout error occurs. + + Catching this error will catch both :exc:`ReadTimeoutErrors + ` and :exc:`ConnectTimeoutErrors `. + """ + + +class ReadTimeoutError(TimeoutError, RequestError): + """Raised when a socket timeout occurs while receiving data from a server""" + + +# This timeout error does not have a URL attached and needs to inherit from the +# base HTTPError +class ConnectTimeoutError(TimeoutError): + """Raised when a socket timeout occurs while connecting to a server""" + + +class NewConnectionError(ConnectTimeoutError, HTTPError): + """Raised when we fail to establish a new connection. Usually ECONNREFUSED.""" + + def __init__(self, conn: HTTPConnection, message: str) -> None: + self.conn = conn + super().__init__(f"{conn}: {message}") + + @property + def pool(self) -> HTTPConnection: + warnings.warn( + "The 'pool' property is deprecated and will be removed " + "in urllib3 v2.1.0. Use 'conn' instead.", + DeprecationWarning, + stacklevel=2, + ) + + return self.conn + + +class NameResolutionError(NewConnectionError): + """Raised when host name resolution fails.""" + + def __init__(self, host: str, conn: HTTPConnection, reason: socket.gaierror): + message = f"Failed to resolve '{host}' ({reason})" + super().__init__(conn, message) + + +class EmptyPoolError(PoolError): + """Raised when a pool runs out of connections and no more are allowed.""" + + +class FullPoolError(PoolError): + """Raised when we try to add a connection to a full pool in blocking mode.""" + + +class ClosedPoolError(PoolError): + """Raised when a request enters a pool after the pool has been closed.""" + + +class LocationValueError(ValueError, HTTPError): + """Raised when there is something wrong with a given URL input.""" + + +class LocationParseError(LocationValueError): + """Raised when get_host or similar fails to parse the URL input.""" + + def __init__(self, location: str) -> None: + message = f"Failed to parse: {location}" + super().__init__(message) + + self.location = location + + +class URLSchemeUnknown(LocationValueError): + """Raised when a URL input has an unsupported scheme.""" + + def __init__(self, scheme: str): + message = f"Not supported URL scheme {scheme}" + super().__init__(message) + + self.scheme = scheme + + +class ResponseError(HTTPError): + """Used as a container for an error reason supplied in a MaxRetryError.""" + + GENERIC_ERROR = "too many error responses" + SPECIFIC_ERROR = "too many {status_code} error responses" + + +class SecurityWarning(HTTPWarning): + """Warned when performing security reducing actions""" + + +class InsecureRequestWarning(SecurityWarning): + """Warned when making an unverified HTTPS request.""" + + +class NotOpenSSLWarning(SecurityWarning): + """Warned when using unsupported SSL library""" + + +class SystemTimeWarning(SecurityWarning): + """Warned when system time is suspected to be wrong""" + + +class InsecurePlatformWarning(SecurityWarning): + """Warned when certain TLS/SSL configuration is not available on a platform.""" + + +class DependencyWarning(HTTPWarning): + """ + Warned when an attempt is made to import a module with missing optional + dependencies. + """ + + +class ResponseNotChunked(ProtocolError, ValueError): + """Response needs to be chunked in order to read it as chunks.""" + + +class BodyNotHttplibCompatible(HTTPError): + """ + Body should be :class:`http.client.HTTPResponse` like + (have an fp attribute which returns raw chunks) for read_chunked(). + """ + + +class IncompleteRead(HTTPError, httplib_IncompleteRead): + """ + Response length doesn't match expected Content-Length + + Subclass of :class:`http.client.IncompleteRead` to allow int value + for ``partial`` to avoid creating large objects on streamed reads. + """ + + def __init__(self, partial: int, expected: int) -> None: + self.partial = partial # type: ignore[assignment] + self.expected = expected + + def __repr__(self) -> str: + return "IncompleteRead(%i bytes read, %i more expected)" % ( + self.partial, # type: ignore[str-format] + self.expected, + ) + + +class InvalidChunkLength(HTTPError, httplib_IncompleteRead): + """Invalid chunk length in a chunked response.""" + + def __init__(self, response: HTTPResponse, length: bytes) -> None: + self.partial: int = response.tell() # type: ignore[assignment] + self.expected: int | None = response.length_remaining + self.response = response + self.length = length + + def __repr__(self) -> str: + return "InvalidChunkLength(got length %r, %i bytes read)" % ( + self.length, + self.partial, + ) + + +class InvalidHeader(HTTPError): + """The header provided was somehow invalid.""" + + +class ProxySchemeUnknown(AssertionError, URLSchemeUnknown): + """ProxyManager does not support the supplied scheme""" + + # TODO(t-8ch): Stop inheriting from AssertionError in v2.0. + + def __init__(self, scheme: str | None) -> None: + # 'localhost' is here because our URL parser parses + # localhost:8080 -> scheme=localhost, remove if we fix this. + if scheme == "localhost": + scheme = None + if scheme is None: + message = "Proxy URL had no scheme, should start with http:// or https://" + else: + message = f"Proxy URL had unsupported scheme {scheme}, should use http:// or https://" + super().__init__(message) + + +class ProxySchemeUnsupported(ValueError): + """Fetching HTTPS resources through HTTPS proxies is unsupported""" + + +class HeaderParsingError(HTTPError): + """Raised by assert_header_parsing, but we convert it to a log.warning statement.""" + + def __init__( + self, defects: list[MessageDefect], unparsed_data: bytes | str | None + ) -> None: + message = f"{defects or 'Unknown'}, unparsed data: {unparsed_data!r}" + super().__init__(message) + + +class UnrewindableBodyError(HTTPError): + """urllib3 encountered an error when trying to rewind a body""" diff --git a/requests/python/urllib3/fields.py b/requests/python/urllib3/fields.py new file mode 100644 index 0000000..51d898e --- /dev/null +++ b/requests/python/urllib3/fields.py @@ -0,0 +1,345 @@ +from __future__ import annotations + +import email.utils +import mimetypes +import typing + +_TYPE_FIELD_VALUE = typing.Union[str, bytes] +_TYPE_FIELD_VALUE_TUPLE = typing.Union[ + _TYPE_FIELD_VALUE, + typing.Tuple[str, _TYPE_FIELD_VALUE], + typing.Tuple[str, _TYPE_FIELD_VALUE, str], +] + + +def guess_content_type( + filename: str | None, default: str = "application/octet-stream" +) -> str: + """ + Guess the "Content-Type" of a file. + + :param filename: + The filename to guess the "Content-Type" of using :mod:`mimetypes`. + :param default: + If no "Content-Type" can be guessed, default to `default`. + """ + if filename: + return mimetypes.guess_type(filename)[0] or default + return default + + +def format_header_param_rfc2231(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Helper function to format and quote a single header parameter using the + strategy defined in RFC 2231. + + Particularly useful for header parameters which might contain + non-ASCII values, like file names. This follows + `RFC 2388 Section 4.4 `_. + + :param name: + The name of the parameter, a string expected to be ASCII only. + :param value: + The value of the parameter, provided as ``bytes`` or `str``. + :returns: + An RFC-2231-formatted unicode string. + + .. deprecated:: 2.0.0 + Will be removed in urllib3 v2.1.0. This is not valid for + ``multipart/form-data`` header parameters. + """ + import warnings + + warnings.warn( + "'format_header_param_rfc2231' is deprecated and will be " + "removed in urllib3 v2.1.0. This is not valid for " + "multipart/form-data header parameters.", + DeprecationWarning, + stacklevel=2, + ) + + if isinstance(value, bytes): + value = value.decode("utf-8") + + if not any(ch in value for ch in '"\\\r\n'): + result = f'{name}="{value}"' + try: + result.encode("ascii") + except (UnicodeEncodeError, UnicodeDecodeError): + pass + else: + return result + + value = email.utils.encode_rfc2231(value, "utf-8") + value = f"{name}*={value}" + + return value + + +def format_multipart_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Format and quote a single multipart header parameter. + + This follows the `WHATWG HTML Standard`_ as of 2021/06/10, matching + the behavior of current browser and curl versions. Values are + assumed to be UTF-8. The ``\\n``, ``\\r``, and ``"`` characters are + percent encoded. + + .. _WHATWG HTML Standard: + https://html.spec.whatwg.org/multipage/ + form-control-infrastructure.html#multipart-form-data + + :param name: + The name of the parameter, an ASCII-only ``str``. + :param value: + The value of the parameter, a ``str`` or UTF-8 encoded + ``bytes``. + :returns: + A string ``name="value"`` with the escaped value. + + .. versionchanged:: 2.0.0 + Matches the WHATWG HTML Standard as of 2021/06/10. Control + characters are no longer percent encoded. + + .. versionchanged:: 2.0.0 + Renamed from ``format_header_param_html5`` and + ``format_header_param``. The old names will be removed in + urllib3 v2.1.0. + """ + if isinstance(value, bytes): + value = value.decode("utf-8") + + # percent encode \n \r " + value = value.translate({10: "%0A", 13: "%0D", 34: "%22"}) + return f'{name}="{value}"' + + +def format_header_param_html5(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + .. deprecated:: 2.0.0 + Renamed to :func:`format_multipart_header_param`. Will be + removed in urllib3 v2.1.0. + """ + import warnings + + warnings.warn( + "'format_header_param_html5' has been renamed to " + "'format_multipart_header_param'. The old name will be " + "removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + return format_multipart_header_param(name, value) + + +def format_header_param(name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + .. deprecated:: 2.0.0 + Renamed to :func:`format_multipart_header_param`. Will be + removed in urllib3 v2.1.0. + """ + import warnings + + warnings.warn( + "'format_header_param' has been renamed to " + "'format_multipart_header_param'. The old name will be " + "removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + return format_multipart_header_param(name, value) + + +class RequestField: + """ + A data container for request body parameters. + + :param name: + The name of this request field. Must be unicode. + :param data: + The data/value body. + :param filename: + An optional filename of the request field. Must be unicode. + :param headers: + An optional dict-like object of headers to initially use for the field. + + .. versionchanged:: 2.0.0 + The ``header_formatter`` parameter is deprecated and will + be removed in urllib3 v2.1.0. + """ + + def __init__( + self, + name: str, + data: _TYPE_FIELD_VALUE, + filename: str | None = None, + headers: typing.Mapping[str, str] | None = None, + header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, + ): + self._name = name + self._filename = filename + self.data = data + self.headers: dict[str, str | None] = {} + if headers: + self.headers = dict(headers) + + if header_formatter is not None: + import warnings + + warnings.warn( + "The 'header_formatter' parameter is deprecated and " + "will be removed in urllib3 v2.1.0.", + DeprecationWarning, + stacklevel=2, + ) + self.header_formatter = header_formatter + else: + self.header_formatter = format_multipart_header_param + + @classmethod + def from_tuples( + cls, + fieldname: str, + value: _TYPE_FIELD_VALUE_TUPLE, + header_formatter: typing.Callable[[str, _TYPE_FIELD_VALUE], str] | None = None, + ) -> RequestField: + """ + A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. + + Supports constructing :class:`~urllib3.fields.RequestField` from + parameter of key/value strings AND key/filetuple. A filetuple is a + (filename, data, MIME type) tuple where the MIME type is optional. + For example:: + + 'foo': 'bar', + 'fakefile': ('foofile.txt', 'contents of foofile'), + 'realfile': ('barfile.txt', open('realfile').read()), + 'typedfile': ('bazfile.bin', open('bazfile').read(), 'image/jpeg'), + 'nonamefile': 'contents of nonamefile field', + + Field names and filenames must be unicode. + """ + filename: str | None + content_type: str | None + data: _TYPE_FIELD_VALUE + + if isinstance(value, tuple): + if len(value) == 3: + filename, data, content_type = typing.cast( + typing.Tuple[str, _TYPE_FIELD_VALUE, str], value + ) + else: + filename, data = typing.cast( + typing.Tuple[str, _TYPE_FIELD_VALUE], value + ) + content_type = guess_content_type(filename) + else: + filename = None + content_type = None + data = value + + request_param = cls( + fieldname, data, filename=filename, header_formatter=header_formatter + ) + request_param.make_multipart(content_type=content_type) + + return request_param + + def _render_part(self, name: str, value: _TYPE_FIELD_VALUE) -> str: + """ + Override this method to change how each multipart header + parameter is formatted. By default, this calls + :func:`format_multipart_header_param`. + + :param name: + The name of the parameter, an ASCII-only ``str``. + :param value: + The value of the parameter, a ``str`` or UTF-8 encoded + ``bytes``. + + :meta public: + """ + return self.header_formatter(name, value) + + def _render_parts( + self, + header_parts: ( + dict[str, _TYPE_FIELD_VALUE | None] + | typing.Sequence[tuple[str, _TYPE_FIELD_VALUE | None]] + ), + ) -> str: + """ + Helper function to format and quote a single header. + + Useful for single headers that are composed of multiple items. E.g., + 'Content-Disposition' fields. + + :param header_parts: + A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format + as `k1="v1"; k2="v2"; ...`. + """ + iterable: typing.Iterable[tuple[str, _TYPE_FIELD_VALUE | None]] + + parts = [] + if isinstance(header_parts, dict): + iterable = header_parts.items() + else: + iterable = header_parts + + for name, value in iterable: + if value is not None: + parts.append(self._render_part(name, value)) + + return "; ".join(parts) + + def render_headers(self) -> str: + """ + Renders the headers for this request field. + """ + lines = [] + + sort_keys = ["Content-Disposition", "Content-Type", "Content-Location"] + for sort_key in sort_keys: + if self.headers.get(sort_key, False): + lines.append(f"{sort_key}: {self.headers[sort_key]}") + + for header_name, header_value in self.headers.items(): + if header_name not in sort_keys: + if header_value: + lines.append(f"{header_name}: {header_value}") + + lines.append("\r\n") + return "\r\n".join(lines) + + def make_multipart( + self, + content_disposition: str | None = None, + content_type: str | None = None, + content_location: str | None = None, + ) -> None: + """ + Makes this request field into a multipart request field. + + This method overrides "Content-Disposition", "Content-Type" and + "Content-Location" headers to the request parameter. + + :param content_disposition: + The 'Content-Disposition' of the request body. Defaults to 'form-data' + :param content_type: + The 'Content-Type' of the request body. + :param content_location: + The 'Content-Location' of the request body. + + """ + content_disposition = (content_disposition or "form-data") + "; ".join( + [ + "", + self._render_parts( + (("name", self._name), ("filename", self._filename)) + ), + ] + ) + + self.headers["Content-Disposition"] = content_disposition + self.headers["Content-Type"] = content_type + self.headers["Content-Location"] = content_location diff --git a/requests/python/urllib3/filepost.py b/requests/python/urllib3/filepost.py new file mode 100644 index 0000000..1c90a21 --- /dev/null +++ b/requests/python/urllib3/filepost.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +import binascii +import codecs +import os +import typing +from io import BytesIO + +from .fields import _TYPE_FIELD_VALUE_TUPLE, RequestField + +writer = codecs.lookup("utf-8")[3] + +_TYPE_FIELDS_SEQUENCE = typing.Sequence[ + typing.Union[typing.Tuple[str, _TYPE_FIELD_VALUE_TUPLE], RequestField] +] +_TYPE_FIELDS = typing.Union[ + _TYPE_FIELDS_SEQUENCE, + typing.Mapping[str, _TYPE_FIELD_VALUE_TUPLE], +] + + +def choose_boundary() -> str: + """ + Our embarrassingly-simple replacement for mimetools.choose_boundary. + """ + return binascii.hexlify(os.urandom(16)).decode() + + +def iter_field_objects(fields: _TYPE_FIELDS) -> typing.Iterable[RequestField]: + """ + Iterate over fields. + + Supports list of (k, v) tuples and dicts, and lists of + :class:`~urllib3.fields.RequestField`. + + """ + iterable: typing.Iterable[RequestField | tuple[str, _TYPE_FIELD_VALUE_TUPLE]] + + if isinstance(fields, typing.Mapping): + iterable = fields.items() + else: + iterable = fields + + for field in iterable: + if isinstance(field, RequestField): + yield field + else: + yield RequestField.from_tuples(*field) + + +def encode_multipart_formdata( + fields: _TYPE_FIELDS, boundary: str | None = None +) -> tuple[bytes, str]: + """ + Encode a dictionary of ``fields`` using the multipart/form-data MIME format. + + :param fields: + Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). + Values are processed by :func:`urllib3.fields.RequestField.from_tuples`. + + :param boundary: + If not specified, then a random boundary will be generated using + :func:`urllib3.filepost.choose_boundary`. + """ + body = BytesIO() + if boundary is None: + boundary = choose_boundary() + + for field in iter_field_objects(fields): + body.write(f"--{boundary}\r\n".encode("latin-1")) + + writer(body).write(field.render_headers()) + data = field.data + + if isinstance(data, int): + data = str(data) # Backwards compatibility + + if isinstance(data, str): + writer(body).write(data) + else: + body.write(data) + + body.write(b"\r\n") + + body.write(f"--{boundary}--\r\n".encode("latin-1")) + + content_type = f"multipart/form-data; boundary={boundary}" + + return body.getvalue(), content_type diff --git a/requests/python/urllib3/poolmanager.py b/requests/python/urllib3/poolmanager.py new file mode 100644 index 0000000..02b2f62 --- /dev/null +++ b/requests/python/urllib3/poolmanager.py @@ -0,0 +1,634 @@ +from __future__ import annotations + +import functools +import logging +import typing +import warnings +from types import TracebackType +from urllib.parse import urljoin + +from ._collections import RecentlyUsedContainer +from ._request_methods import RequestMethods +from .connection import ProxyConfig +from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, port_by_scheme +from .exceptions import ( + LocationValueError, + MaxRetryError, + ProxySchemeUnknown, + URLSchemeUnknown, +) +from .response import BaseHTTPResponse +from .util.connection import _TYPE_SOCKET_OPTIONS +from .util.proxy import connection_requires_http_tunnel +from .util.retry import Retry +from .util.timeout import Timeout +from .util.url import Url, parse_url + +if typing.TYPE_CHECKING: + import ssl + + from typing_extensions import Literal + +__all__ = ["PoolManager", "ProxyManager", "proxy_from_url"] + + +log = logging.getLogger(__name__) + +SSL_KEYWORDS = ( + "key_file", + "cert_file", + "cert_reqs", + "ca_certs", + "ssl_version", + "ssl_minimum_version", + "ssl_maximum_version", + "ca_cert_dir", + "ssl_context", + "key_password", + "server_hostname", +) +# Default value for `blocksize` - a new parameter introduced to +# http.client.HTTPConnection & http.client.HTTPSConnection in Python 3.7 +_DEFAULT_BLOCKSIZE = 16384 + +_SelfT = typing.TypeVar("_SelfT") + + +class PoolKey(typing.NamedTuple): + """ + All known keyword arguments that could be provided to the pool manager, its + pools, or the underlying connections. + + All custom key schemes should include the fields in this key at a minimum. + """ + + key_scheme: str + key_host: str + key_port: int | None + key_timeout: Timeout | float | int | None + key_retries: Retry | bool | int | None + key_block: bool | None + key_source_address: tuple[str, int] | None + key_key_file: str | None + key_key_password: str | None + key_cert_file: str | None + key_cert_reqs: str | None + key_ca_certs: str | None + key_ssl_version: int | str | None + key_ssl_minimum_version: ssl.TLSVersion | None + key_ssl_maximum_version: ssl.TLSVersion | None + key_ca_cert_dir: str | None + key_ssl_context: ssl.SSLContext | None + key_maxsize: int | None + key_headers: frozenset[tuple[str, str]] | None + key__proxy: Url | None + key__proxy_headers: frozenset[tuple[str, str]] | None + key__proxy_config: ProxyConfig | None + key_socket_options: _TYPE_SOCKET_OPTIONS | None + key__socks_options: frozenset[tuple[str, str]] | None + key_assert_hostname: bool | str | None + key_assert_fingerprint: str | None + key_server_hostname: str | None + key_blocksize: int | None + + +def _default_key_normalizer( + key_class: type[PoolKey], request_context: dict[str, typing.Any] +) -> PoolKey: + """ + Create a pool key out of a request context dictionary. + + According to RFC 3986, both the scheme and host are case-insensitive. + Therefore, this function normalizes both before constructing the pool + key for an HTTPS request. If you wish to change this behaviour, provide + alternate callables to ``key_fn_by_scheme``. + + :param key_class: + The class to use when constructing the key. This should be a namedtuple + with the ``scheme`` and ``host`` keys at a minimum. + :type key_class: namedtuple + :param request_context: + A dictionary-like object that contain the context for a request. + :type request_context: dict + + :return: A namedtuple that can be used as a connection pool key. + :rtype: PoolKey + """ + # Since we mutate the dictionary, make a copy first + context = request_context.copy() + context["scheme"] = context["scheme"].lower() + context["host"] = context["host"].lower() + + # These are both dictionaries and need to be transformed into frozensets + for key in ("headers", "_proxy_headers", "_socks_options"): + if key in context and context[key] is not None: + context[key] = frozenset(context[key].items()) + + # The socket_options key may be a list and needs to be transformed into a + # tuple. + socket_opts = context.get("socket_options") + if socket_opts is not None: + context["socket_options"] = tuple(socket_opts) + + # Map the kwargs to the names in the namedtuple - this is necessary since + # namedtuples can't have fields starting with '_'. + for key in list(context.keys()): + context["key_" + key] = context.pop(key) + + # Default to ``None`` for keys missing from the context + for field in key_class._fields: + if field not in context: + context[field] = None + + # Default key_blocksize to _DEFAULT_BLOCKSIZE if missing from the context + if context.get("key_blocksize") is None: + context["key_blocksize"] = _DEFAULT_BLOCKSIZE + + return key_class(**context) + + +#: A dictionary that maps a scheme to a callable that creates a pool key. +#: This can be used to alter the way pool keys are constructed, if desired. +#: Each PoolManager makes a copy of this dictionary so they can be configured +#: globally here, or individually on the instance. +key_fn_by_scheme = { + "http": functools.partial(_default_key_normalizer, PoolKey), + "https": functools.partial(_default_key_normalizer, PoolKey), +} + +pool_classes_by_scheme = {"http": HTTPConnectionPool, "https": HTTPSConnectionPool} + + +class PoolManager(RequestMethods): + """ + Allows for arbitrary requests while transparently keeping track of + necessary connection pools for you. + + :param num_pools: + Number of connection pools to cache before discarding the least + recently used pool. + + :param headers: + Headers to include with all requests, unless other headers are given + explicitly. + + :param \\**connection_pool_kw: + Additional parameters are used to create fresh + :class:`urllib3.connectionpool.ConnectionPool` instances. + + Example: + + .. code-block:: python + + import urllib3 + + http = urllib3.PoolManager(num_pools=2) + + resp1 = http.request("GET", "https://google.com/") + resp2 = http.request("GET", "https://google.com/mail") + resp3 = http.request("GET", "https://yahoo.com/") + + print(len(http.pools)) + # 2 + + """ + + proxy: Url | None = None + proxy_config: ProxyConfig | None = None + + def __init__( + self, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + **connection_pool_kw: typing.Any, + ) -> None: + super().__init__(headers) + self.connection_pool_kw = connection_pool_kw + + self.pools: RecentlyUsedContainer[PoolKey, HTTPConnectionPool] + self.pools = RecentlyUsedContainer(num_pools) + + # Locally set the pool classes and keys so other PoolManagers can + # override them. + self.pool_classes_by_scheme = pool_classes_by_scheme + self.key_fn_by_scheme = key_fn_by_scheme.copy() + + def __enter__(self: _SelfT) -> _SelfT: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> Literal[False]: + self.clear() + # Return False to re-raise any potential exceptions + return False + + def _new_pool( + self, + scheme: str, + host: str, + port: int, + request_context: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + """ + Create a new :class:`urllib3.connectionpool.ConnectionPool` based on host, port, scheme, and + any additional pool keyword arguments. + + If ``request_context`` is provided, it is provided as keyword arguments + to the pool class used. This method is used to actually create the + connection pools handed out by :meth:`connection_from_url` and + companion methods. It is intended to be overridden for customization. + """ + pool_cls: type[HTTPConnectionPool] = self.pool_classes_by_scheme[scheme] + if request_context is None: + request_context = self.connection_pool_kw.copy() + + # Default blocksize to _DEFAULT_BLOCKSIZE if missing or explicitly + # set to 'None' in the request_context. + if request_context.get("blocksize") is None: + request_context["blocksize"] = _DEFAULT_BLOCKSIZE + + # Although the context has everything necessary to create the pool, + # this function has historically only used the scheme, host, and port + # in the positional args. When an API change is acceptable these can + # be removed. + for key in ("scheme", "host", "port"): + request_context.pop(key, None) + + if scheme == "http": + for kw in SSL_KEYWORDS: + request_context.pop(kw, None) + + return pool_cls(host, port, **request_context) + + def clear(self) -> None: + """ + Empty our store of pools and direct them all to close. + + This will not affect in-flight connections, but they will not be + re-used after completion. + """ + self.pools.clear() + + def connection_from_host( + self, + host: str | None, + port: int | None = None, + scheme: str | None = "http", + pool_kwargs: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme. + + If ``port`` isn't given, it will be derived from the ``scheme`` using + ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is + provided, it is merged with the instance's ``connection_pool_kw`` + variable and used to create the new connection pool, if one is + needed. + """ + + if not host: + raise LocationValueError("No host specified.") + + request_context = self._merge_pool_kwargs(pool_kwargs) + request_context["scheme"] = scheme or "http" + if not port: + port = port_by_scheme.get(request_context["scheme"].lower(), 80) + request_context["port"] = port + request_context["host"] = host + + return self.connection_from_context(request_context) + + def connection_from_context( + self, request_context: dict[str, typing.Any] + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. + + ``request_context`` must at least contain the ``scheme`` key and its + value must be a key in ``key_fn_by_scheme`` instance variable. + """ + if "strict" in request_context: + warnings.warn( + "The 'strict' parameter is no longer needed on Python 3+. " + "This will raise an error in urllib3 v2.1.0.", + DeprecationWarning, + ) + request_context.pop("strict") + + scheme = request_context["scheme"].lower() + pool_key_constructor = self.key_fn_by_scheme.get(scheme) + if not pool_key_constructor: + raise URLSchemeUnknown(scheme) + pool_key = pool_key_constructor(request_context) + + return self.connection_from_pool_key(pool_key, request_context=request_context) + + def connection_from_pool_key( + self, pool_key: PoolKey, request_context: dict[str, typing.Any] + ) -> HTTPConnectionPool: + """ + Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. + + ``pool_key`` should be a namedtuple that only contains immutable + objects. At a minimum it must have the ``scheme``, ``host``, and + ``port`` fields. + """ + with self.pools.lock: + # If the scheme, host, or port doesn't match existing open + # connections, open a new ConnectionPool. + pool = self.pools.get(pool_key) + if pool: + return pool + + # Make a fresh ConnectionPool of the desired type + scheme = request_context["scheme"] + host = request_context["host"] + port = request_context["port"] + pool = self._new_pool(scheme, host, port, request_context=request_context) + self.pools[pool_key] = pool + + return pool + + def connection_from_url( + self, url: str, pool_kwargs: dict[str, typing.Any] | None = None + ) -> HTTPConnectionPool: + """ + Similar to :func:`urllib3.connectionpool.connection_from_url`. + + If ``pool_kwargs`` is not provided and a new pool needs to be + constructed, ``self.connection_pool_kw`` is used to initialize + the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` + is provided, it is used instead. Note that if a new pool does not + need to be created for the request, the provided ``pool_kwargs`` are + not used. + """ + u = parse_url(url) + return self.connection_from_host( + u.host, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs + ) + + def _merge_pool_kwargs( + self, override: dict[str, typing.Any] | None + ) -> dict[str, typing.Any]: + """ + Merge a dictionary of override values for self.connection_pool_kw. + + This does not modify self.connection_pool_kw and returns a new dict. + Any keys in the override dictionary with a value of ``None`` are + removed from the merged dictionary. + """ + base_pool_kwargs = self.connection_pool_kw.copy() + if override: + for key, value in override.items(): + if value is None: + try: + del base_pool_kwargs[key] + except KeyError: + pass + else: + base_pool_kwargs[key] = value + return base_pool_kwargs + + def _proxy_requires_url_absolute_form(self, parsed_url: Url) -> bool: + """ + Indicates if the proxy requires the complete destination URL in the + request. Normally this is only needed when not using an HTTP CONNECT + tunnel. + """ + if self.proxy is None: + return False + + return not connection_requires_http_tunnel( + self.proxy, self.proxy_config, parsed_url.scheme + ) + + def urlopen( # type: ignore[override] + self, method: str, url: str, redirect: bool = True, **kw: typing.Any + ) -> BaseHTTPResponse: + """ + Same as :meth:`urllib3.HTTPConnectionPool.urlopen` + with custom cross-host redirect logic and only sends the request-uri + portion of the ``url``. + + The given ``url`` parameter must be absolute, such that an appropriate + :class:`urllib3.connectionpool.ConnectionPool` can be chosen for it. + """ + u = parse_url(url) + + if u.scheme is None: + warnings.warn( + "URLs without a scheme (ie 'https://') are deprecated and will raise an error " + "in a future version of urllib3. To avoid this DeprecationWarning ensure all URLs " + "start with 'https://' or 'http://'. Read more in this issue: " + "https://github.com/urllib3/urllib3/issues/2920", + category=DeprecationWarning, + stacklevel=2, + ) + + conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme) + + kw["assert_same_host"] = False + kw["redirect"] = False + + if "headers" not in kw: + kw["headers"] = self.headers + + if self._proxy_requires_url_absolute_form(u): + response = conn.urlopen(method, url, **kw) + else: + response = conn.urlopen(method, u.request_uri, **kw) + + redirect_location = redirect and response.get_redirect_location() + if not redirect_location: + return response + + # Support relative URLs for redirecting. + redirect_location = urljoin(url, redirect_location) + + # RFC 7231, Section 6.4.4 + if response.status == 303: + method = "GET" + + retries = kw.get("retries") + if not isinstance(retries, Retry): + retries = Retry.from_int(retries, redirect=redirect) + + # Strip headers marked as unsafe to forward to the redirected location. + # Check remove_headers_on_redirect to avoid a potential network call within + # conn.is_same_host() which may use socket.gethostbyname() in the future. + if retries.remove_headers_on_redirect and not conn.is_same_host( + redirect_location + ): + new_headers = kw["headers"].copy() + for header in kw["headers"]: + if header.lower() in retries.remove_headers_on_redirect: + new_headers.pop(header, None) + kw["headers"] = new_headers + + try: + retries = retries.increment(method, url, response=response, _pool=conn) + except MaxRetryError: + if retries.raise_on_redirect: + response.drain_conn() + raise + return response + + kw["retries"] = retries + kw["redirect"] = redirect + + log.info("Redirecting %s -> %s", url, redirect_location) + + response.drain_conn() + return self.urlopen(method, redirect_location, **kw) + + +class ProxyManager(PoolManager): + """ + Behaves just like :class:`PoolManager`, but sends all requests through + the defined proxy, using the CONNECT method for HTTPS URLs. + + :param proxy_url: + The URL of the proxy to be used. + + :param proxy_headers: + A dictionary containing headers that will be sent to the proxy. In case + of HTTP they are being sent with each request, while in the + HTTPS/CONNECT case they are sent only once. Could be used for proxy + authentication. + + :param proxy_ssl_context: + The proxy SSL context is used to establish the TLS connection to the + proxy when using HTTPS proxies. + + :param use_forwarding_for_https: + (Defaults to False) If set to True will forward requests to the HTTPS + proxy to be made on behalf of the client instead of creating a TLS + tunnel via the CONNECT method. **Enabling this flag means that request + and response headers and content will be visible from the HTTPS proxy** + whereas tunneling keeps request and response headers and content + private. IP address, target hostname, SNI, and port are always visible + to an HTTPS proxy even when this flag is disabled. + + :param proxy_assert_hostname: + The hostname of the certificate to verify against. + + :param proxy_assert_fingerprint: + The fingerprint of the certificate to verify against. + + Example: + + .. code-block:: python + + import urllib3 + + proxy = urllib3.ProxyManager("https://localhost:3128/") + + resp1 = proxy.request("GET", "https://google.com/") + resp2 = proxy.request("GET", "https://httpbin.org/") + + print(len(proxy.pools)) + # 1 + + resp3 = proxy.request("GET", "https://httpbin.org/") + resp4 = proxy.request("GET", "https://twitter.com/") + + print(len(proxy.pools)) + # 3 + + """ + + def __init__( + self, + proxy_url: str, + num_pools: int = 10, + headers: typing.Mapping[str, str] | None = None, + proxy_headers: typing.Mapping[str, str] | None = None, + proxy_ssl_context: ssl.SSLContext | None = None, + use_forwarding_for_https: bool = False, + proxy_assert_hostname: None | str | Literal[False] = None, + proxy_assert_fingerprint: str | None = None, + **connection_pool_kw: typing.Any, + ) -> None: + if isinstance(proxy_url, HTTPConnectionPool): + str_proxy_url = f"{proxy_url.scheme}://{proxy_url.host}:{proxy_url.port}" + else: + str_proxy_url = proxy_url + proxy = parse_url(str_proxy_url) + + if proxy.scheme not in ("http", "https"): + raise ProxySchemeUnknown(proxy.scheme) + + if not proxy.port: + port = port_by_scheme.get(proxy.scheme, 80) + proxy = proxy._replace(port=port) + + self.proxy = proxy + self.proxy_headers = proxy_headers or {} + self.proxy_ssl_context = proxy_ssl_context + self.proxy_config = ProxyConfig( + proxy_ssl_context, + use_forwarding_for_https, + proxy_assert_hostname, + proxy_assert_fingerprint, + ) + + connection_pool_kw["_proxy"] = self.proxy + connection_pool_kw["_proxy_headers"] = self.proxy_headers + connection_pool_kw["_proxy_config"] = self.proxy_config + + super().__init__(num_pools, headers, **connection_pool_kw) + + def connection_from_host( + self, + host: str | None, + port: int | None = None, + scheme: str | None = "http", + pool_kwargs: dict[str, typing.Any] | None = None, + ) -> HTTPConnectionPool: + if scheme == "https": + return super().connection_from_host( + host, port, scheme, pool_kwargs=pool_kwargs + ) + + return super().connection_from_host( + self.proxy.host, self.proxy.port, self.proxy.scheme, pool_kwargs=pool_kwargs # type: ignore[union-attr] + ) + + def _set_proxy_headers( + self, url: str, headers: typing.Mapping[str, str] | None = None + ) -> typing.Mapping[str, str]: + """ + Sets headers needed by proxies: specifically, the Accept and Host + headers. Only sets headers not provided by the user. + """ + headers_ = {"Accept": "*/*"} + + netloc = parse_url(url).netloc + if netloc: + headers_["Host"] = netloc + + if headers: + headers_.update(headers) + return headers_ + + def urlopen( # type: ignore[override] + self, method: str, url: str, redirect: bool = True, **kw: typing.Any + ) -> BaseHTTPResponse: + "Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute." + u = parse_url(url) + if not connection_requires_http_tunnel(self.proxy, self.proxy_config, u.scheme): + # For connections using HTTP CONNECT, httplib sets the necessary + # headers on the CONNECT to the proxy. If we're not using CONNECT, + # we'll definitely need to set 'Host' at the very least. + headers = kw.get("headers", self.headers) + kw["headers"] = self._set_proxy_headers(url, headers) + + return super().urlopen(method, url, redirect=redirect, **kw) + + +def proxy_from_url(url: str, **kw: typing.Any) -> ProxyManager: + return ProxyManager(proxy_url=url, **kw) diff --git a/requests/python/urllib3/py.typed b/requests/python/urllib3/py.typed new file mode 100644 index 0000000..5f3ea3d --- /dev/null +++ b/requests/python/urllib3/py.typed @@ -0,0 +1,2 @@ +# Instruct type checkers to look for inline type annotations in this package. +# See PEP 561. diff --git a/requests/python/urllib3/response.py b/requests/python/urllib3/response.py new file mode 100644 index 0000000..50e4d88 --- /dev/null +++ b/requests/python/urllib3/response.py @@ -0,0 +1,1136 @@ +from __future__ import annotations + +import collections +import io +import json as _json +import logging +import re +import sys +import typing +import warnings +import zlib +from contextlib import contextmanager +from http.client import HTTPMessage as _HttplibHTTPMessage +from http.client import HTTPResponse as _HttplibHTTPResponse +from socket import timeout as SocketTimeout + +try: + try: + import brotlicffi as brotli # type: ignore[import] + except ImportError: + import brotli # type: ignore[import] +except ImportError: + brotli = None + +try: + import zstandard as zstd # type: ignore[import] + + # The package 'zstandard' added the 'eof' property starting + # in v0.18.0 which we require to ensure a complete and + # valid zstd stream was fed into the ZstdDecoder. + # See: https://github.com/urllib3/urllib3/pull/2624 + _zstd_version = _zstd_version = tuple( + map(int, re.search(r"^([0-9]+)\.([0-9]+)", zstd.__version__).groups()) # type: ignore[union-attr] + ) + if _zstd_version < (0, 18): # Defensive: + zstd = None + +except (AttributeError, ImportError, ValueError): # Defensive: + zstd = None + +from . import util +from ._base_connection import _TYPE_BODY +from ._collections import HTTPHeaderDict +from .connection import BaseSSLError, HTTPConnection, HTTPException +from .exceptions import ( + BodyNotHttplibCompatible, + DecodeError, + HTTPError, + IncompleteRead, + InvalidChunkLength, + InvalidHeader, + ProtocolError, + ReadTimeoutError, + ResponseNotChunked, + SSLError, +) +from .util.response import is_fp_closed, is_response_to_head +from .util.retry import Retry + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + + from .connectionpool import HTTPConnectionPool + +log = logging.getLogger(__name__) + + +class ContentDecoder: + def decompress(self, data: bytes) -> bytes: + raise NotImplementedError() + + def flush(self) -> bytes: + raise NotImplementedError() + + +class DeflateDecoder(ContentDecoder): + def __init__(self) -> None: + self._first_try = True + self._data = b"" + self._obj = zlib.decompressobj() + + def decompress(self, data: bytes) -> bytes: + if not data: + return data + + if not self._first_try: + return self._obj.decompress(data) + + self._data += data + try: + decompressed = self._obj.decompress(data) + if decompressed: + self._first_try = False + self._data = None # type: ignore[assignment] + return decompressed + except zlib.error: + self._first_try = False + self._obj = zlib.decompressobj(-zlib.MAX_WBITS) + try: + return self.decompress(self._data) + finally: + self._data = None # type: ignore[assignment] + + def flush(self) -> bytes: + return self._obj.flush() + + +class GzipDecoderState: + FIRST_MEMBER = 0 + OTHER_MEMBERS = 1 + SWALLOW_DATA = 2 + + +class GzipDecoder(ContentDecoder): + def __init__(self) -> None: + self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) + self._state = GzipDecoderState.FIRST_MEMBER + + def decompress(self, data: bytes) -> bytes: + ret = bytearray() + if self._state == GzipDecoderState.SWALLOW_DATA or not data: + return bytes(ret) + while True: + try: + ret += self._obj.decompress(data) + except zlib.error: + previous_state = self._state + # Ignore data after the first error + self._state = GzipDecoderState.SWALLOW_DATA + if previous_state == GzipDecoderState.OTHER_MEMBERS: + # Allow trailing garbage acceptable in other gzip clients + return bytes(ret) + raise + data = self._obj.unused_data + if not data: + return bytes(ret) + self._state = GzipDecoderState.OTHER_MEMBERS + self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) + + def flush(self) -> bytes: + return self._obj.flush() + + +if brotli is not None: + + class BrotliDecoder(ContentDecoder): + # Supports both 'brotlipy' and 'Brotli' packages + # since they share an import name. The top branches + # are for 'brotlipy' and bottom branches for 'Brotli' + def __init__(self) -> None: + self._obj = brotli.Decompressor() + if hasattr(self._obj, "decompress"): + setattr(self, "decompress", self._obj.decompress) + else: + setattr(self, "decompress", self._obj.process) + + def flush(self) -> bytes: + if hasattr(self._obj, "flush"): + return self._obj.flush() # type: ignore[no-any-return] + return b"" + + +if zstd is not None: + + class ZstdDecoder(ContentDecoder): + def __init__(self) -> None: + self._obj = zstd.ZstdDecompressor().decompressobj() + + def decompress(self, data: bytes) -> bytes: + if not data: + return b"" + data_parts = [self._obj.decompress(data)] + while self._obj.eof and self._obj.unused_data: + unused_data = self._obj.unused_data + self._obj = zstd.ZstdDecompressor().decompressobj() + data_parts.append(self._obj.decompress(unused_data)) + return b"".join(data_parts) + + def flush(self) -> bytes: + ret = self._obj.flush() # note: this is a no-op + if not self._obj.eof: + raise DecodeError("Zstandard data is incomplete") + return ret # type: ignore[no-any-return] + + +class MultiDecoder(ContentDecoder): + """ + From RFC7231: + If one or more encodings have been applied to a representation, the + sender that applied the encodings MUST generate a Content-Encoding + header field that lists the content codings in the order in which + they were applied. + """ + + def __init__(self, modes: str) -> None: + self._decoders = [_get_decoder(m.strip()) for m in modes.split(",")] + + def flush(self) -> bytes: + return self._decoders[0].flush() + + def decompress(self, data: bytes) -> bytes: + for d in reversed(self._decoders): + data = d.decompress(data) + return data + + +def _get_decoder(mode: str) -> ContentDecoder: + if "," in mode: + return MultiDecoder(mode) + + if mode == "gzip": + return GzipDecoder() + + if brotli is not None and mode == "br": + return BrotliDecoder() + + if zstd is not None and mode == "zstd": + return ZstdDecoder() + + return DeflateDecoder() + + +class BytesQueueBuffer: + """Memory-efficient bytes buffer + + To return decoded data in read() and still follow the BufferedIOBase API, we need a + buffer to always return the correct amount of bytes. + + This buffer should be filled using calls to put() + + Our maximum memory usage is determined by the sum of the size of: + + * self.buffer, which contains the full data + * the largest chunk that we will copy in get() + + The worst case scenario is a single chunk, in which case we'll make a full copy of + the data inside get(). + """ + + def __init__(self) -> None: + self.buffer: typing.Deque[bytes] = collections.deque() + self._size: int = 0 + + def __len__(self) -> int: + return self._size + + def put(self, data: bytes) -> None: + self.buffer.append(data) + self._size += len(data) + + def get(self, n: int) -> bytes: + if n == 0: + return b"" + elif not self.buffer: + raise RuntimeError("buffer is empty") + elif n < 0: + raise ValueError("n should be > 0") + + fetched = 0 + ret = io.BytesIO() + while fetched < n: + remaining = n - fetched + chunk = self.buffer.popleft() + chunk_length = len(chunk) + if remaining < chunk_length: + left_chunk, right_chunk = chunk[:remaining], chunk[remaining:] + ret.write(left_chunk) + self.buffer.appendleft(right_chunk) + self._size -= remaining + break + else: + ret.write(chunk) + self._size -= chunk_length + fetched += chunk_length + + if not self.buffer: + break + + return ret.getvalue() + + +class BaseHTTPResponse(io.IOBase): + CONTENT_DECODERS = ["gzip", "deflate"] + if brotli is not None: + CONTENT_DECODERS += ["br"] + if zstd is not None: + CONTENT_DECODERS += ["zstd"] + REDIRECT_STATUSES = [301, 302, 303, 307, 308] + + DECODER_ERROR_CLASSES: tuple[type[Exception], ...] = (IOError, zlib.error) + if brotli is not None: + DECODER_ERROR_CLASSES += (brotli.error,) + + if zstd is not None: + DECODER_ERROR_CLASSES += (zstd.ZstdError,) + + def __init__( + self, + *, + headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, + status: int, + version: int, + reason: str | None, + decode_content: bool, + request_url: str | None, + retries: Retry | None = None, + ) -> None: + if isinstance(headers, HTTPHeaderDict): + self.headers = headers + else: + self.headers = HTTPHeaderDict(headers) # type: ignore[arg-type] + self.status = status + self.version = version + self.reason = reason + self.decode_content = decode_content + self._has_decoded_content = False + self._request_url: str | None = request_url + self.retries = retries + + self.chunked = False + tr_enc = self.headers.get("transfer-encoding", "").lower() + # Don't incur the penalty of creating a list and then discarding it + encodings = (enc.strip() for enc in tr_enc.split(",")) + if "chunked" in encodings: + self.chunked = True + + self._decoder: ContentDecoder | None = None + + def get_redirect_location(self) -> str | None | Literal[False]: + """ + Should we redirect and where to? + + :returns: Truthy redirect location string if we got a redirect status + code and valid location. ``None`` if redirect status and no + location. ``False`` if not a redirect status code. + """ + if self.status in self.REDIRECT_STATUSES: + return self.headers.get("location") + return False + + @property + def data(self) -> bytes: + raise NotImplementedError() + + def json(self) -> typing.Any: + """ + Parses the body of the HTTP response as JSON. + + To use a custom JSON decoder pass the result of :attr:`HTTPResponse.data` to the decoder. + + This method can raise either `UnicodeDecodeError` or `json.JSONDecodeError`. + + Read more :ref:`here `. + """ + data = self.data.decode("utf-8") + return _json.loads(data) + + @property + def url(self) -> str | None: + raise NotImplementedError() + + @url.setter + def url(self, url: str | None) -> None: + raise NotImplementedError() + + @property + def connection(self) -> HTTPConnection | None: + raise NotImplementedError() + + @property + def retries(self) -> Retry | None: + return self._retries + + @retries.setter + def retries(self, retries: Retry | None) -> None: + # Override the request_url if retries has a redirect location. + if retries is not None and retries.history: + self.url = retries.history[-1].redirect_location + self._retries = retries + + def stream( + self, amt: int | None = 2**16, decode_content: bool | None = None + ) -> typing.Iterator[bytes]: + raise NotImplementedError() + + def read( + self, + amt: int | None = None, + decode_content: bool | None = None, + cache_content: bool = False, + ) -> bytes: + raise NotImplementedError() + + def read_chunked( + self, + amt: int | None = None, + decode_content: bool | None = None, + ) -> typing.Iterator[bytes]: + raise NotImplementedError() + + def release_conn(self) -> None: + raise NotImplementedError() + + def drain_conn(self) -> None: + raise NotImplementedError() + + def close(self) -> None: + raise NotImplementedError() + + def _init_decoder(self) -> None: + """ + Set-up the _decoder attribute if necessary. + """ + # Note: content-encoding value should be case-insensitive, per RFC 7230 + # Section 3.2 + content_encoding = self.headers.get("content-encoding", "").lower() + if self._decoder is None: + if content_encoding in self.CONTENT_DECODERS: + self._decoder = _get_decoder(content_encoding) + elif "," in content_encoding: + encodings = [ + e.strip() + for e in content_encoding.split(",") + if e.strip() in self.CONTENT_DECODERS + ] + if encodings: + self._decoder = _get_decoder(content_encoding) + + def _decode( + self, data: bytes, decode_content: bool | None, flush_decoder: bool + ) -> bytes: + """ + Decode the data passed in and potentially flush the decoder. + """ + if not decode_content: + if self._has_decoded_content: + raise RuntimeError( + "Calling read(decode_content=False) is not supported after " + "read(decode_content=True) was called." + ) + return data + + try: + if self._decoder: + data = self._decoder.decompress(data) + self._has_decoded_content = True + except self.DECODER_ERROR_CLASSES as e: + content_encoding = self.headers.get("content-encoding", "").lower() + raise DecodeError( + "Received response with content-encoding: %s, but " + "failed to decode it." % content_encoding, + e, + ) from e + if flush_decoder: + data += self._flush_decoder() + + return data + + def _flush_decoder(self) -> bytes: + """ + Flushes the decoder. Should only be called if the decoder is actually + being used. + """ + if self._decoder: + return self._decoder.decompress(b"") + self._decoder.flush() + return b"" + + # Compatibility methods for `io` module + def readinto(self, b: bytearray) -> int: + temp = self.read(len(b)) + if len(temp) == 0: + return 0 + else: + b[: len(temp)] = temp + return len(temp) + + # Compatibility methods for http.client.HTTPResponse + def getheaders(self) -> HTTPHeaderDict: + warnings.warn( + "HTTPResponse.getheaders() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.", + category=DeprecationWarning, + stacklevel=2, + ) + return self.headers + + def getheader(self, name: str, default: str | None = None) -> str | None: + warnings.warn( + "HTTPResponse.getheader() is deprecated and will be removed " + "in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).", + category=DeprecationWarning, + stacklevel=2, + ) + return self.headers.get(name, default) + + # Compatibility method for http.cookiejar + def info(self) -> HTTPHeaderDict: + return self.headers + + def geturl(self) -> str | None: + return self.url + + +class HTTPResponse(BaseHTTPResponse): + """ + HTTP Response container. + + Backwards-compatible with :class:`http.client.HTTPResponse` but the response ``body`` is + loaded and decoded on-demand when the ``data`` property is accessed. This + class is also compatible with the Python standard library's :mod:`io` + module, and can hence be treated as a readable object in the context of that + framework. + + Extra parameters for behaviour not present in :class:`http.client.HTTPResponse`: + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param original_response: + When this HTTPResponse wrapper is generated from an :class:`http.client.HTTPResponse` + object, it's convenient to include the original for debug purposes. It's + otherwise unused. + + :param retries: + The retries contains the last :class:`~urllib3.util.retry.Retry` that + was used during the request. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + + def __init__( + self, + body: _TYPE_BODY = "", + headers: typing.Mapping[str, str] | typing.Mapping[bytes, bytes] | None = None, + status: int = 0, + version: int = 0, + reason: str | None = None, + preload_content: bool = True, + decode_content: bool = True, + original_response: _HttplibHTTPResponse | None = None, + pool: HTTPConnectionPool | None = None, + connection: HTTPConnection | None = None, + msg: _HttplibHTTPMessage | None = None, + retries: Retry | None = None, + enforce_content_length: bool = True, + request_method: str | None = None, + request_url: str | None = None, + auto_close: bool = True, + ) -> None: + super().__init__( + headers=headers, + status=status, + version=version, + reason=reason, + decode_content=decode_content, + request_url=request_url, + retries=retries, + ) + + self.enforce_content_length = enforce_content_length + self.auto_close = auto_close + + self._body = None + self._fp: _HttplibHTTPResponse | None = None + self._original_response = original_response + self._fp_bytes_read = 0 + self.msg = msg + + if body and isinstance(body, (str, bytes)): + self._body = body + + self._pool = pool + self._connection = connection + + if hasattr(body, "read"): + self._fp = body # type: ignore[assignment] + + # Are we using the chunked-style of transfer encoding? + self.chunk_left: int | None = None + + # Determine length of response + self.length_remaining = self._init_length(request_method) + + # Used to return the correct amount of bytes for partial read()s + self._decoded_buffer = BytesQueueBuffer() + + # If requested, preload the body. + if preload_content and not self._body: + self._body = self.read(decode_content=decode_content) + + def release_conn(self) -> None: + if not self._pool or not self._connection: + return None + + self._pool._put_conn(self._connection) + self._connection = None + + def drain_conn(self) -> None: + """ + Read and discard any remaining HTTP response data in the response connection. + + Unread data in the HTTPResponse connection blocks the connection from being released back to the pool. + """ + try: + self.read() + except (HTTPError, OSError, BaseSSLError, HTTPException): + pass + + @property + def data(self) -> bytes: + # For backwards-compat with earlier urllib3 0.4 and earlier. + if self._body: + return self._body # type: ignore[return-value] + + if self._fp: + return self.read(cache_content=True) + + return None # type: ignore[return-value] + + @property + def connection(self) -> HTTPConnection | None: + return self._connection + + def isclosed(self) -> bool: + return is_fp_closed(self._fp) + + def tell(self) -> int: + """ + Obtain the number of bytes pulled over the wire so far. May differ from + the amount of content returned by :meth:``urllib3.response.HTTPResponse.read`` + if bytes are encoded on the wire (e.g, compressed). + """ + return self._fp_bytes_read + + def _init_length(self, request_method: str | None) -> int | None: + """ + Set initial length value for Response content if available. + """ + length: int | None + content_length: str | None = self.headers.get("content-length") + + if content_length is not None: + if self.chunked: + # This Response will fail with an IncompleteRead if it can't be + # received as chunked. This method falls back to attempt reading + # the response before raising an exception. + log.warning( + "Received response with both Content-Length and " + "Transfer-Encoding set. This is expressly forbidden " + "by RFC 7230 sec 3.3.2. Ignoring Content-Length and " + "attempting to process response as Transfer-Encoding: " + "chunked." + ) + return None + + try: + # RFC 7230 section 3.3.2 specifies multiple content lengths can + # be sent in a single Content-Length header + # (e.g. Content-Length: 42, 42). This line ensures the values + # are all valid ints and that as long as the `set` length is 1, + # all values are the same. Otherwise, the header is invalid. + lengths = {int(val) for val in content_length.split(",")} + if len(lengths) > 1: + raise InvalidHeader( + "Content-Length contained multiple " + "unmatching values (%s)" % content_length + ) + length = lengths.pop() + except ValueError: + length = None + else: + if length < 0: + length = None + + else: # if content_length is None + length = None + + # Convert status to int for comparison + # In some cases, httplib returns a status of "_UNKNOWN" + try: + status = int(self.status) + except ValueError: + status = 0 + + # Check for responses that shouldn't include a body + if status in (204, 304) or 100 <= status < 200 or request_method == "HEAD": + length = 0 + + return length + + @contextmanager + def _error_catcher(self) -> typing.Generator[None, None, None]: + """ + Catch low-level python exceptions, instead re-raising urllib3 + variants, so that low-level exceptions are not leaked in the + high-level api. + + On exit, release the connection back to the pool. + """ + clean_exit = False + + try: + try: + yield + + except SocketTimeout as e: + # FIXME: Ideally we'd like to include the url in the ReadTimeoutError but + # there is yet no clean way to get at it from this context. + raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] + + except BaseSSLError as e: + # FIXME: Is there a better way to differentiate between SSLErrors? + if "read operation timed out" not in str(e): + # SSL errors related to framing/MAC get wrapped and reraised here + raise SSLError(e) from e + + raise ReadTimeoutError(self._pool, None, "Read timed out.") from e # type: ignore[arg-type] + + except (HTTPException, OSError) as e: + # This includes IncompleteRead. + raise ProtocolError(f"Connection broken: {e!r}", e) from e + + # If no exception is thrown, we should avoid cleaning up + # unnecessarily. + clean_exit = True + finally: + # If we didn't terminate cleanly, we need to throw away our + # connection. + if not clean_exit: + # The response may not be closed but we're not going to use it + # anymore so close it now to ensure that the connection is + # released back to the pool. + if self._original_response: + self._original_response.close() + + # Closing the response may not actually be sufficient to close + # everything, so if we have a hold of the connection close that + # too. + if self._connection: + self._connection.close() + + # If we hold the original response but it's closed now, we should + # return the connection back to the pool. + if self._original_response and self._original_response.isclosed(): + self.release_conn() + + def _fp_read(self, amt: int | None = None) -> bytes: + """ + Read a response with the thought that reading the number of bytes + larger than can fit in a 32-bit int at a time via SSL in some + known cases leads to an overflow error that has to be prevented + if `amt` or `self.length_remaining` indicate that a problem may + happen. + + The known cases: + * 3.8 <= CPython < 3.9.7 because of a bug + https://github.com/urllib3/urllib3/issues/2513#issuecomment-1152559900. + * urllib3 injected with pyOpenSSL-backed SSL-support. + * CPython < 3.10 only when `amt` does not fit 32-bit int. + """ + assert self._fp + c_int_max = 2**31 - 1 + if ( + ( + (amt and amt > c_int_max) + or (self.length_remaining and self.length_remaining > c_int_max) + ) + and not util.IS_SECURETRANSPORT + and (util.IS_PYOPENSSL or sys.version_info < (3, 10)) + ): + buffer = io.BytesIO() + # Besides `max_chunk_amt` being a maximum chunk size, it + # affects memory overhead of reading a response by this + # method in CPython. + # `c_int_max` equal to 2 GiB - 1 byte is the actual maximum + # chunk size that does not lead to an overflow error, but + # 256 MiB is a compromise. + max_chunk_amt = 2**28 + while amt is None or amt != 0: + if amt is not None: + chunk_amt = min(amt, max_chunk_amt) + amt -= chunk_amt + else: + chunk_amt = max_chunk_amt + data = self._fp.read(chunk_amt) + if not data: + break + buffer.write(data) + del data # to reduce peak memory usage by `max_chunk_amt`. + return buffer.getvalue() + else: + # StringIO doesn't like amt=None + return self._fp.read(amt) if amt is not None else self._fp.read() + + def _raw_read( + self, + amt: int | None = None, + ) -> bytes: + """ + Reads `amt` of bytes from the socket. + """ + if self._fp is None: + return None # type: ignore[return-value] + + fp_closed = getattr(self._fp, "closed", False) + + with self._error_catcher(): + data = self._fp_read(amt) if not fp_closed else b"" + if amt is not None and amt != 0 and not data: + # Platform-specific: Buggy versions of Python. + # Close the connection when no data is returned + # + # This is redundant to what httplib/http.client _should_ + # already do. However, versions of python released before + # December 15, 2012 (http://bugs.python.org/issue16298) do + # not properly close the connection in all cases. There is + # no harm in redundantly calling close. + self._fp.close() + if ( + self.enforce_content_length + and self.length_remaining is not None + and self.length_remaining != 0 + ): + # This is an edge case that httplib failed to cover due + # to concerns of backward compatibility. We're + # addressing it here to make sure IncompleteRead is + # raised during streaming, so all calls with incorrect + # Content-Length are caught. + raise IncompleteRead(self._fp_bytes_read, self.length_remaining) + + if data: + self._fp_bytes_read += len(data) + if self.length_remaining is not None: + self.length_remaining -= len(data) + return data + + def read( + self, + amt: int | None = None, + decode_content: bool | None = None, + cache_content: bool = False, + ) -> bytes: + """ + Similar to :meth:`http.client.HTTPResponse.read`, but with two additional + parameters: ``decode_content`` and ``cache_content``. + + :param amt: + How much of the content to read. If specified, caching is skipped + because it doesn't make sense to cache partial content as the full + response. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param cache_content: + If True, will save the returned data such that the same result is + returned despite of the state of the underlying file object. This + is useful if you want the ``.data`` property to continue working + after having ``.read()`` the file object. (Overridden if ``amt`` is + set.) + """ + self._init_decoder() + if decode_content is None: + decode_content = self.decode_content + + if amt is not None: + cache_content = False + + if len(self._decoded_buffer) >= amt: + return self._decoded_buffer.get(amt) + + data = self._raw_read(amt) + + flush_decoder = False + if amt is None: + flush_decoder = True + elif amt != 0 and not data: + flush_decoder = True + + if not data and len(self._decoded_buffer) == 0: + return data + + if amt is None: + data = self._decode(data, decode_content, flush_decoder) + if cache_content: + self._body = data + else: + # do not waste memory on buffer when not decoding + if not decode_content: + if self._has_decoded_content: + raise RuntimeError( + "Calling read(decode_content=False) is not supported after " + "read(decode_content=True) was called." + ) + return data + + decoded_data = self._decode(data, decode_content, flush_decoder) + self._decoded_buffer.put(decoded_data) + + while len(self._decoded_buffer) < amt and data: + # TODO make sure to initially read enough data to get past the headers + # For example, the GZ file header takes 10 bytes, we don't want to read + # it one byte at a time + data = self._raw_read(amt) + decoded_data = self._decode(data, decode_content, flush_decoder) + self._decoded_buffer.put(decoded_data) + data = self._decoded_buffer.get(amt) + + return data + + def stream( + self, amt: int | None = 2**16, decode_content: bool | None = None + ) -> typing.Generator[bytes, None, None]: + """ + A generator wrapper for the read() method. A call will block until + ``amt`` bytes have been read from the connection or until the + connection is closed. + + :param amt: + How much of the content to read. The generator will return up to + much data per iteration, but may return less. This is particularly + likely when using compressed data. However, the empty string will + never be returned. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + if self.chunked and self.supports_chunked_reads(): + yield from self.read_chunked(amt, decode_content=decode_content) + else: + while not is_fp_closed(self._fp) or len(self._decoded_buffer) > 0: + data = self.read(amt=amt, decode_content=decode_content) + + if data: + yield data + + # Overrides from io.IOBase + def readable(self) -> bool: + return True + + def close(self) -> None: + if not self.closed and self._fp: + self._fp.close() + + if self._connection: + self._connection.close() + + if not self.auto_close: + io.IOBase.close(self) + + @property + def closed(self) -> bool: + if not self.auto_close: + return io.IOBase.closed.__get__(self) # type: ignore[no-any-return] + elif self._fp is None: + return True + elif hasattr(self._fp, "isclosed"): + return self._fp.isclosed() + elif hasattr(self._fp, "closed"): + return self._fp.closed + else: + return True + + def fileno(self) -> int: + if self._fp is None: + raise OSError("HTTPResponse has no file to get a fileno from") + elif hasattr(self._fp, "fileno"): + return self._fp.fileno() + else: + raise OSError( + "The file-like object this HTTPResponse is wrapped " + "around has no file descriptor" + ) + + def flush(self) -> None: + if ( + self._fp is not None + and hasattr(self._fp, "flush") + and not getattr(self._fp, "closed", False) + ): + return self._fp.flush() + + def supports_chunked_reads(self) -> bool: + """ + Checks if the underlying file-like object looks like a + :class:`http.client.HTTPResponse` object. We do this by testing for + the fp attribute. If it is present we assume it returns raw chunks as + processed by read_chunked(). + """ + return hasattr(self._fp, "fp") + + def _update_chunk_length(self) -> None: + # First, we'll figure out length of a chunk and then + # we'll try to read it from socket. + if self.chunk_left is not None: + return None + line = self._fp.fp.readline() # type: ignore[union-attr] + line = line.split(b";", 1)[0] + try: + self.chunk_left = int(line, 16) + except ValueError: + # Invalid chunked protocol response, abort. + self.close() + raise InvalidChunkLength(self, line) from None + + def _handle_chunk(self, amt: int | None) -> bytes: + returned_chunk = None + if amt is None: + chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] + returned_chunk = chunk + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + elif self.chunk_left is not None and amt < self.chunk_left: + value = self._fp._safe_read(amt) # type: ignore[union-attr] + self.chunk_left = self.chunk_left - amt + returned_chunk = value + elif amt == self.chunk_left: + value = self._fp._safe_read(amt) # type: ignore[union-attr] + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + returned_chunk = value + else: # amt > self.chunk_left + returned_chunk = self._fp._safe_read(self.chunk_left) # type: ignore[union-attr] + self._fp._safe_read(2) # type: ignore[union-attr] # Toss the CRLF at the end of the chunk. + self.chunk_left = None + return returned_chunk # type: ignore[no-any-return] + + def read_chunked( + self, amt: int | None = None, decode_content: bool | None = None + ) -> typing.Generator[bytes, None, None]: + """ + Similar to :meth:`HTTPResponse.read`, but with an additional + parameter: ``decode_content``. + + :param amt: + How much of the content to read. If specified, caching is skipped + because it doesn't make sense to cache partial content as the full + response. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + """ + self._init_decoder() + # FIXME: Rewrite this method and make it a class with a better structured logic. + if not self.chunked: + raise ResponseNotChunked( + "Response is not chunked. " + "Header 'transfer-encoding: chunked' is missing." + ) + if not self.supports_chunked_reads(): + raise BodyNotHttplibCompatible( + "Body should be http.client.HTTPResponse like. " + "It should have have an fp attribute which returns raw chunks." + ) + + with self._error_catcher(): + # Don't bother reading the body of a HEAD request. + if self._original_response and is_response_to_head(self._original_response): + self._original_response.close() + return None + + # If a response is already read and closed + # then return immediately. + if self._fp.fp is None: # type: ignore[union-attr] + return None + + while True: + self._update_chunk_length() + if self.chunk_left == 0: + break + chunk = self._handle_chunk(amt) + decoded = self._decode( + chunk, decode_content=decode_content, flush_decoder=False + ) + if decoded: + yield decoded + + if decode_content: + # On CPython and PyPy, we should never need to flush the + # decoder. However, on Jython we *might* need to, so + # lets defensively do it anyway. + decoded = self._flush_decoder() + if decoded: # Platform-specific: Jython. + yield decoded + + # Chunk content ends with \r\n: discard it. + while self._fp is not None: + line = self._fp.fp.readline() + if not line: + # Some sites may not end with '\r\n'. + break + if line == b"\r\n": + break + + # We read everything; close the "file". + if self._original_response: + self._original_response.close() + + @property + def url(self) -> str | None: + """ + Returns the URL that was the source of this response. + If the request that generated this response redirected, this method + will return the final redirect location. + """ + return self._request_url + + @url.setter + def url(self, url: str) -> None: + self._request_url = url + + def __iter__(self) -> typing.Iterator[bytes]: + buffer: list[bytes] = [] + for chunk in self.stream(decode_content=True): + if b"\n" in chunk: + chunks = chunk.split(b"\n") + yield b"".join(buffer) + chunks[0] + b"\n" + for x in chunks[1:-1]: + yield x + b"\n" + if chunks[-1]: + buffer = [chunks[-1]] + else: + buffer = [] + else: + buffer.append(chunk) + if buffer: + yield b"".join(buffer) diff --git a/requests/python/urllib3/util/__init__.py b/requests/python/urllib3/util/__init__.py new file mode 100644 index 0000000..ff56c55 --- /dev/null +++ b/requests/python/urllib3/util/__init__.py @@ -0,0 +1,44 @@ +# For backwards compatibility, provide imports that used to be here. +from __future__ import annotations + +from .connection import is_connection_dropped +from .request import SKIP_HEADER, SKIPPABLE_HEADERS, make_headers +from .response import is_fp_closed +from .retry import Retry +from .ssl_ import ( + ALPN_PROTOCOLS, + IS_PYOPENSSL, + IS_SECURETRANSPORT, + SSLContext, + assert_fingerprint, + create_urllib3_context, + resolve_cert_reqs, + resolve_ssl_version, + ssl_wrap_socket, +) +from .timeout import Timeout +from .url import Url, parse_url +from .wait import wait_for_read, wait_for_write + +__all__ = ( + "IS_PYOPENSSL", + "IS_SECURETRANSPORT", + "SSLContext", + "ALPN_PROTOCOLS", + "Retry", + "Timeout", + "Url", + "assert_fingerprint", + "create_urllib3_context", + "is_connection_dropped", + "is_fp_closed", + "parse_url", + "make_headers", + "resolve_cert_reqs", + "resolve_ssl_version", + "ssl_wrap_socket", + "wait_for_read", + "wait_for_write", + "SKIP_HEADER", + "SKIPPABLE_HEADERS", +) diff --git a/requests/python/urllib3/util/__pycache__/__init__.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..7612e14 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/__init__.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/connection.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/connection.cpython-311.pyc new file mode 100644 index 0000000..f19e348 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/connection.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/proxy.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/proxy.cpython-311.pyc new file mode 100644 index 0000000..59eacf1 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/proxy.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/request.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/request.cpython-311.pyc new file mode 100644 index 0000000..479a890 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/request.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/response.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/response.cpython-311.pyc new file mode 100644 index 0000000..9b41e40 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/response.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/retry.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/retry.cpython-311.pyc new file mode 100644 index 0000000..7028678 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/retry.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/ssl_.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/ssl_.cpython-311.pyc new file mode 100644 index 0000000..8b7c5cc Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/ssl_.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc new file mode 100644 index 0000000..45dad56 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/ssl_match_hostname.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/ssltransport.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/ssltransport.cpython-311.pyc new file mode 100644 index 0000000..08d0642 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/ssltransport.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/timeout.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/timeout.cpython-311.pyc new file mode 100644 index 0000000..146bb8b Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/timeout.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/url.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/url.cpython-311.pyc new file mode 100644 index 0000000..2e13bc0 Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/url.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/util.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/util.cpython-311.pyc new file mode 100644 index 0000000..98b597c Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/util.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/__pycache__/wait.cpython-311.pyc b/requests/python/urllib3/util/__pycache__/wait.cpython-311.pyc new file mode 100644 index 0000000..b324cce Binary files /dev/null and b/requests/python/urllib3/util/__pycache__/wait.cpython-311.pyc differ diff --git a/requests/python/urllib3/util/connection.py b/requests/python/urllib3/util/connection.py new file mode 100644 index 0000000..5c7da73 --- /dev/null +++ b/requests/python/urllib3/util/connection.py @@ -0,0 +1,137 @@ +from __future__ import annotations + +import socket +import typing + +from ..exceptions import LocationParseError +from .timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT + +_TYPE_SOCKET_OPTIONS = typing.Sequence[typing.Tuple[int, int, typing.Union[int, bytes]]] + +if typing.TYPE_CHECKING: + from .._base_connection import BaseHTTPConnection + + +def is_connection_dropped(conn: BaseHTTPConnection) -> bool: # Platform-specific + """ + Returns True if the connection is dropped and should be closed. + :param conn: :class:`urllib3.connection.HTTPConnection` object. + """ + return not conn.is_connected + + +# This function is copied from socket.py in the Python 2.7 standard +# library test suite. Added to its signature is only `socket_options`. +# One additional modification is that we avoid binding to IPv6 servers +# discovered in DNS if the system doesn't have IPv6 functionality. +def create_connection( + address: tuple[str, int], + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + source_address: tuple[str, int] | None = None, + socket_options: _TYPE_SOCKET_OPTIONS | None = None, +) -> socket.socket: + """Connect to *address* and return the socket object. + + Convenience function. Connect to *address* (a 2-tuple ``(host, + port)``) and return the socket object. Passing the optional + *timeout* parameter will set the timeout on the socket instance + before attempting to connect. If no *timeout* is supplied, the + global default timeout setting returned by :func:`socket.getdefaulttimeout` + is used. If *source_address* is set it must be a tuple of (host, port) + for the socket to bind as a source address before making the connection. + An host of '' or port 0 tells the OS to use the default. + """ + + host, port = address + if host.startswith("["): + host = host.strip("[]") + err = None + + # Using the value from allowed_gai_family() in the context of getaddrinfo lets + # us select whether to work with IPv4 DNS records, IPv6 records, or both. + # The original create_connection function always returns all records. + family = allowed_gai_family() + + try: + host.encode("idna") + except UnicodeError: + raise LocationParseError(f"'{host}', label empty or too long") from None + + for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): + af, socktype, proto, canonname, sa = res + sock = None + try: + sock = socket.socket(af, socktype, proto) + + # If provided, set socket level options before connecting. + _set_socket_options(sock, socket_options) + + if timeout is not _DEFAULT_TIMEOUT: + sock.settimeout(timeout) + if source_address: + sock.bind(source_address) + sock.connect(sa) + # Break explicitly a reference cycle + err = None + return sock + + except OSError as _: + err = _ + if sock is not None: + sock.close() + + if err is not None: + try: + raise err + finally: + # Break explicitly a reference cycle + err = None + else: + raise OSError("getaddrinfo returns an empty list") + + +def _set_socket_options( + sock: socket.socket, options: _TYPE_SOCKET_OPTIONS | None +) -> None: + if options is None: + return + + for opt in options: + sock.setsockopt(*opt) + + +def allowed_gai_family() -> socket.AddressFamily: + """This function is designed to work in the context of + getaddrinfo, where family=socket.AF_UNSPEC is the default and + will perform a DNS search for both IPv6 and IPv4 records.""" + + family = socket.AF_INET + if HAS_IPV6: + family = socket.AF_UNSPEC + return family + + +def _has_ipv6(host: str) -> bool: + """Returns True if the system can bind an IPv6 address.""" + sock = None + has_ipv6 = False + + if socket.has_ipv6: + # has_ipv6 returns true if cPython was compiled with IPv6 support. + # It does not tell us if the system has IPv6 support enabled. To + # determine that we must bind to an IPv6 address. + # https://github.com/urllib3/urllib3/pull/611 + # https://bugs.python.org/issue658327 + try: + sock = socket.socket(socket.AF_INET6) + sock.bind((host, 0)) + has_ipv6 = True + except Exception: + pass + + if sock: + sock.close() + return has_ipv6 + + +HAS_IPV6 = _has_ipv6("::1") diff --git a/requests/python/urllib3/util/proxy.py b/requests/python/urllib3/util/proxy.py new file mode 100644 index 0000000..908fc66 --- /dev/null +++ b/requests/python/urllib3/util/proxy.py @@ -0,0 +1,43 @@ +from __future__ import annotations + +import typing + +from .url import Url + +if typing.TYPE_CHECKING: + from ..connection import ProxyConfig + + +def connection_requires_http_tunnel( + proxy_url: Url | None = None, + proxy_config: ProxyConfig | None = None, + destination_scheme: str | None = None, +) -> bool: + """ + Returns True if the connection requires an HTTP CONNECT through the proxy. + + :param URL proxy_url: + URL of the proxy. + :param ProxyConfig proxy_config: + Proxy configuration from poolmanager.py + :param str destination_scheme: + The scheme of the destination. (i.e https, http, etc) + """ + # If we're not using a proxy, no way to use a tunnel. + if proxy_url is None: + return False + + # HTTP destinations never require tunneling, we always forward. + if destination_scheme == "http": + return False + + # Support for forwarding with HTTPS proxies and HTTPS destinations. + if ( + proxy_url.scheme == "https" + and proxy_config + and proxy_config.use_forwarding_for_https + ): + return False + + # Otherwise always use a tunnel. + return True diff --git a/requests/python/urllib3/util/request.py b/requests/python/urllib3/util/request.py new file mode 100644 index 0000000..7d6866f --- /dev/null +++ b/requests/python/urllib3/util/request.py @@ -0,0 +1,256 @@ +from __future__ import annotations + +import io +import typing +from base64 import b64encode +from enum import Enum + +from ..exceptions import UnrewindableBodyError +from .util import to_bytes + +if typing.TYPE_CHECKING: + from typing_extensions import Final + +# Pass as a value within ``headers`` to skip +# emitting some HTTP headers that are added automatically. +# The only headers that are supported are ``Accept-Encoding``, +# ``Host``, and ``User-Agent``. +SKIP_HEADER = "@@@SKIP_HEADER@@@" +SKIPPABLE_HEADERS = frozenset(["accept-encoding", "host", "user-agent"]) + +ACCEPT_ENCODING = "gzip,deflate" +try: + try: + import brotlicffi as _unused_module_brotli # type: ignore[import] # noqa: F401 + except ImportError: + import brotli as _unused_module_brotli # type: ignore[import] # noqa: F401 +except ImportError: + pass +else: + ACCEPT_ENCODING += ",br" +try: + import zstandard as _unused_module_zstd # type: ignore[import] # noqa: F401 +except ImportError: + pass +else: + ACCEPT_ENCODING += ",zstd" + + +class _TYPE_FAILEDTELL(Enum): + token = 0 + + +_FAILEDTELL: Final[_TYPE_FAILEDTELL] = _TYPE_FAILEDTELL.token + +_TYPE_BODY_POSITION = typing.Union[int, _TYPE_FAILEDTELL] + +# When sending a request with these methods we aren't expecting +# a body so don't need to set an explicit 'Content-Length: 0' +# The reason we do this in the negative instead of tracking methods +# which 'should' have a body is because unknown methods should be +# treated as if they were 'POST' which *does* expect a body. +_METHODS_NOT_EXPECTING_BODY = {"GET", "HEAD", "DELETE", "TRACE", "OPTIONS", "CONNECT"} + + +def make_headers( + keep_alive: bool | None = None, + accept_encoding: bool | list[str] | str | None = None, + user_agent: str | None = None, + basic_auth: str | None = None, + proxy_basic_auth: str | None = None, + disable_cache: bool | None = None, +) -> dict[str, str]: + """ + Shortcuts for generating request headers. + + :param keep_alive: + If ``True``, adds 'connection: keep-alive' header. + + :param accept_encoding: + Can be a boolean, list, or string. + ``True`` translates to 'gzip,deflate'. If either the ``brotli`` or + ``brotlicffi`` package is installed 'gzip,deflate,br' is used instead. + List will get joined by comma. + String will be used as provided. + + :param user_agent: + String representing the user-agent you want, such as + "python-urllib3/0.6" + + :param basic_auth: + Colon-separated username:password string for 'authorization: basic ...' + auth header. + + :param proxy_basic_auth: + Colon-separated username:password string for 'proxy-authorization: basic ...' + auth header. + + :param disable_cache: + If ``True``, adds 'cache-control: no-cache' header. + + Example: + + .. code-block:: python + + import urllib3 + + print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0")) + # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'} + print(urllib3.util.make_headers(accept_encoding=True)) + # {'accept-encoding': 'gzip,deflate'} + """ + headers: dict[str, str] = {} + if accept_encoding: + if isinstance(accept_encoding, str): + pass + elif isinstance(accept_encoding, list): + accept_encoding = ",".join(accept_encoding) + else: + accept_encoding = ACCEPT_ENCODING + headers["accept-encoding"] = accept_encoding + + if user_agent: + headers["user-agent"] = user_agent + + if keep_alive: + headers["connection"] = "keep-alive" + + if basic_auth: + headers[ + "authorization" + ] = f"Basic {b64encode(basic_auth.encode('latin-1')).decode()}" + + if proxy_basic_auth: + headers[ + "proxy-authorization" + ] = f"Basic {b64encode(proxy_basic_auth.encode('latin-1')).decode()}" + + if disable_cache: + headers["cache-control"] = "no-cache" + + return headers + + +def set_file_position( + body: typing.Any, pos: _TYPE_BODY_POSITION | None +) -> _TYPE_BODY_POSITION | None: + """ + If a position is provided, move file to that point. + Otherwise, we'll attempt to record a position for future use. + """ + if pos is not None: + rewind_body(body, pos) + elif getattr(body, "tell", None) is not None: + try: + pos = body.tell() + except OSError: + # This differentiates from None, allowing us to catch + # a failed `tell()` later when trying to rewind the body. + pos = _FAILEDTELL + + return pos + + +def rewind_body(body: typing.IO[typing.AnyStr], body_pos: _TYPE_BODY_POSITION) -> None: + """ + Attempt to rewind body to a certain position. + Primarily used for request redirects and retries. + + :param body: + File-like object that supports seek. + + :param int pos: + Position to seek to in file. + """ + body_seek = getattr(body, "seek", None) + if body_seek is not None and isinstance(body_pos, int): + try: + body_seek(body_pos) + except OSError as e: + raise UnrewindableBodyError( + "An error occurred when rewinding request body for redirect/retry." + ) from e + elif body_pos is _FAILEDTELL: + raise UnrewindableBodyError( + "Unable to record file position for rewinding " + "request body during a redirect/retry." + ) + else: + raise ValueError( + f"body_pos must be of type integer, instead it was {type(body_pos)}." + ) + + +class ChunksAndContentLength(typing.NamedTuple): + chunks: typing.Iterable[bytes] | None + content_length: int | None + + +def body_to_chunks( + body: typing.Any | None, method: str, blocksize: int +) -> ChunksAndContentLength: + """Takes the HTTP request method, body, and blocksize and + transforms them into an iterable of chunks to pass to + socket.sendall() and an optional 'Content-Length' header. + + A 'Content-Length' of 'None' indicates the length of the body + can't be determined so should use 'Transfer-Encoding: chunked' + for framing instead. + """ + + chunks: typing.Iterable[bytes] | None + content_length: int | None + + # No body, we need to make a recommendation on 'Content-Length' + # based on whether that request method is expected to have + # a body or not. + if body is None: + chunks = None + if method.upper() not in _METHODS_NOT_EXPECTING_BODY: + content_length = 0 + else: + content_length = None + + # Bytes or strings become bytes + elif isinstance(body, (str, bytes)): + chunks = (to_bytes(body),) + content_length = len(chunks[0]) + + # File-like object, TODO: use seek() and tell() for length? + elif hasattr(body, "read"): + + def chunk_readable() -> typing.Iterable[bytes]: + nonlocal body, blocksize + encode = isinstance(body, io.TextIOBase) + while True: + datablock = body.read(blocksize) + if not datablock: + break + if encode: + datablock = datablock.encode("iso-8859-1") + yield datablock + + chunks = chunk_readable() + content_length = None + + # Otherwise we need to start checking via duck-typing. + else: + try: + # Check if the body implements the buffer API. + mv = memoryview(body) + except TypeError: + try: + # Check if the body is an iterable + chunks = iter(body) + content_length = None + except TypeError: + raise TypeError( + f"'body' must be a bytes-like object, file-like " + f"object, or iterable. Instead was {body!r}" + ) from None + else: + # Since it implements the buffer API can be passed directly to socket.sendall() + chunks = (body,) + content_length = mv.nbytes + + return ChunksAndContentLength(chunks=chunks, content_length=content_length) diff --git a/requests/python/urllib3/util/response.py b/requests/python/urllib3/util/response.py new file mode 100644 index 0000000..0f45786 --- /dev/null +++ b/requests/python/urllib3/util/response.py @@ -0,0 +1,101 @@ +from __future__ import annotations + +import http.client as httplib +from email.errors import MultipartInvariantViolationDefect, StartBoundaryNotFoundDefect + +from ..exceptions import HeaderParsingError + + +def is_fp_closed(obj: object) -> bool: + """ + Checks whether a given file-like object is closed. + + :param obj: + The file-like object to check. + """ + + try: + # Check `isclosed()` first, in case Python3 doesn't set `closed`. + # GH Issue #928 + return obj.isclosed() # type: ignore[no-any-return, attr-defined] + except AttributeError: + pass + + try: + # Check via the official file-like-object way. + return obj.closed # type: ignore[no-any-return, attr-defined] + except AttributeError: + pass + + try: + # Check if the object is a container for another file-like object that + # gets released on exhaustion (e.g. HTTPResponse). + return obj.fp is None # type: ignore[attr-defined] + except AttributeError: + pass + + raise ValueError("Unable to determine whether fp is closed.") + + +def assert_header_parsing(headers: httplib.HTTPMessage) -> None: + """ + Asserts whether all headers have been successfully parsed. + Extracts encountered errors from the result of parsing headers. + + Only works on Python 3. + + :param http.client.HTTPMessage headers: Headers to verify. + + :raises urllib3.exceptions.HeaderParsingError: + If parsing errors are found. + """ + + # This will fail silently if we pass in the wrong kind of parameter. + # To make debugging easier add an explicit check. + if not isinstance(headers, httplib.HTTPMessage): + raise TypeError(f"expected httplib.Message, got {type(headers)}.") + + unparsed_data = None + + # get_payload is actually email.message.Message.get_payload; + # we're only interested in the result if it's not a multipart message + if not headers.is_multipart(): + payload = headers.get_payload() + + if isinstance(payload, (bytes, str)): + unparsed_data = payload + + # httplib is assuming a response body is available + # when parsing headers even when httplib only sends + # header data to parse_headers() This results in + # defects on multipart responses in particular. + # See: https://github.com/urllib3/urllib3/issues/800 + + # So we ignore the following defects: + # - StartBoundaryNotFoundDefect: + # The claimed start boundary was never found. + # - MultipartInvariantViolationDefect: + # A message claimed to be a multipart but no subparts were found. + defects = [ + defect + for defect in headers.defects + if not isinstance( + defect, (StartBoundaryNotFoundDefect, MultipartInvariantViolationDefect) + ) + ] + + if defects or unparsed_data: + raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data) + + +def is_response_to_head(response: httplib.HTTPResponse) -> bool: + """ + Checks whether the request of a response has been a HEAD-request. + + :param http.client.HTTPResponse response: + Response to check if the originating request + used 'HEAD' as a method. + """ + # FIXME: Can we do this somehow without accessing private httplib _method? + method_str = response._method # type: str # type: ignore[attr-defined] + return method_str.upper() == "HEAD" diff --git a/requests/python/urllib3/util/retry.py b/requests/python/urllib3/util/retry.py new file mode 100644 index 0000000..ea48afe --- /dev/null +++ b/requests/python/urllib3/util/retry.py @@ -0,0 +1,529 @@ +from __future__ import annotations + +import email +import logging +import random +import re +import time +import typing +from itertools import takewhile +from types import TracebackType + +from ..exceptions import ( + ConnectTimeoutError, + InvalidHeader, + MaxRetryError, + ProtocolError, + ProxyError, + ReadTimeoutError, + ResponseError, +) +from .util import reraise + +if typing.TYPE_CHECKING: + from ..connectionpool import ConnectionPool + from ..response import BaseHTTPResponse + +log = logging.getLogger(__name__) + + +# Data structure for representing the metadata of requests that result in a retry. +class RequestHistory(typing.NamedTuple): + method: str | None + url: str | None + error: Exception | None + status: int | None + redirect_location: str | None + + +class Retry: + """Retry configuration. + + Each retry attempt will create a new Retry object with updated values, so + they can be safely reused. + + Retries can be defined as a default for a pool: + + .. code-block:: python + + retries = Retry(connect=5, read=2, redirect=5) + http = PoolManager(retries=retries) + response = http.request("GET", "https://example.com/") + + Or per-request (which overrides the default for the pool): + + .. code-block:: python + + response = http.request("GET", "https://example.com/", retries=Retry(10)) + + Retries can be disabled by passing ``False``: + + .. code-block:: python + + response = http.request("GET", "https://example.com/", retries=False) + + Errors will be wrapped in :class:`~urllib3.exceptions.MaxRetryError` unless + retries are disabled, in which case the causing exception will be raised. + + :param int total: + Total number of retries to allow. Takes precedence over other counts. + + Set to ``None`` to remove this constraint and fall back on other + counts. + + Set to ``0`` to fail on the first retry. + + Set to ``False`` to disable and imply ``raise_on_redirect=False``. + + :param int connect: + How many connection-related errors to retry on. + + These are errors raised before the request is sent to the remote server, + which we assume has not triggered the server to process the request. + + Set to ``0`` to fail on the first retry of this type. + + :param int read: + How many times to retry on read errors. + + These errors are raised after the request was sent to the server, so the + request may have side-effects. + + Set to ``0`` to fail on the first retry of this type. + + :param int redirect: + How many redirects to perform. Limit this to avoid infinite redirect + loops. + + A redirect is a HTTP response with a status code 301, 302, 303, 307 or + 308. + + Set to ``0`` to fail on the first retry of this type. + + Set to ``False`` to disable and imply ``raise_on_redirect=False``. + + :param int status: + How many times to retry on bad status codes. + + These are retries made on responses, where status code matches + ``status_forcelist``. + + Set to ``0`` to fail on the first retry of this type. + + :param int other: + How many times to retry on other errors. + + Other errors are errors that are not connect, read, redirect or status errors. + These errors might be raised after the request was sent to the server, so the + request might have side-effects. + + Set to ``0`` to fail on the first retry of this type. + + If ``total`` is not set, it's a good idea to set this to 0 to account + for unexpected edge cases and avoid infinite retry loops. + + :param Collection allowed_methods: + Set of uppercased HTTP method verbs that we should retry on. + + By default, we only retry on methods which are considered to be + idempotent (multiple requests with the same parameters end with the + same state). See :attr:`Retry.DEFAULT_ALLOWED_METHODS`. + + Set to a ``None`` value to retry on any verb. + + :param Collection status_forcelist: + A set of integer HTTP status codes that we should force a retry on. + A retry is initiated if the request method is in ``allowed_methods`` + and the response status code is in ``status_forcelist``. + + By default, this is disabled with ``None``. + + :param float backoff_factor: + A backoff factor to apply between attempts after the second try + (most errors are resolved immediately by a second try without a + delay). urllib3 will sleep for:: + + {backoff factor} * (2 ** ({number of previous retries})) + + seconds. If `backoff_jitter` is non-zero, this sleep is extended by:: + + random.uniform(0, {backoff jitter}) + + seconds. For example, if the backoff_factor is 0.1, then :func:`Retry.sleep` will + sleep for [0.0s, 0.2s, 0.4s, 0.8s, ...] between retries. No backoff will ever + be longer than `backoff_max`. + + By default, backoff is disabled (factor set to 0). + + :param bool raise_on_redirect: Whether, if the number of redirects is + exhausted, to raise a MaxRetryError, or to return a response with a + response code in the 3xx range. + + :param bool raise_on_status: Similar meaning to ``raise_on_redirect``: + whether we should raise an exception, or return a response, + if status falls in ``status_forcelist`` range and retries have + been exhausted. + + :param tuple history: The history of the request encountered during + each call to :meth:`~Retry.increment`. The list is in the order + the requests occurred. Each list item is of class :class:`RequestHistory`. + + :param bool respect_retry_after_header: + Whether to respect Retry-After header on status codes defined as + :attr:`Retry.RETRY_AFTER_STATUS_CODES` or not. + + :param Collection remove_headers_on_redirect: + Sequence of headers to remove from the request when a response + indicating a redirect is returned before firing off the redirected + request. + """ + + #: Default methods to be used for ``allowed_methods`` + DEFAULT_ALLOWED_METHODS = frozenset( + ["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"] + ) + + #: Default status codes to be used for ``status_forcelist`` + RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503]) + + #: Default headers to be used for ``remove_headers_on_redirect`` + DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Authorization"]) + + #: Default maximum backoff time. + DEFAULT_BACKOFF_MAX = 120 + + # Backward compatibility; assigned outside of the class. + DEFAULT: typing.ClassVar[Retry] + + def __init__( + self, + total: bool | int | None = 10, + connect: int | None = None, + read: int | None = None, + redirect: bool | int | None = None, + status: int | None = None, + other: int | None = None, + allowed_methods: typing.Collection[str] | None = DEFAULT_ALLOWED_METHODS, + status_forcelist: typing.Collection[int] | None = None, + backoff_factor: float = 0, + backoff_max: float = DEFAULT_BACKOFF_MAX, + raise_on_redirect: bool = True, + raise_on_status: bool = True, + history: tuple[RequestHistory, ...] | None = None, + respect_retry_after_header: bool = True, + remove_headers_on_redirect: typing.Collection[ + str + ] = DEFAULT_REMOVE_HEADERS_ON_REDIRECT, + backoff_jitter: float = 0.0, + ) -> None: + self.total = total + self.connect = connect + self.read = read + self.status = status + self.other = other + + if redirect is False or total is False: + redirect = 0 + raise_on_redirect = False + + self.redirect = redirect + self.status_forcelist = status_forcelist or set() + self.allowed_methods = allowed_methods + self.backoff_factor = backoff_factor + self.backoff_max = backoff_max + self.raise_on_redirect = raise_on_redirect + self.raise_on_status = raise_on_status + self.history = history or () + self.respect_retry_after_header = respect_retry_after_header + self.remove_headers_on_redirect = frozenset( + h.lower() for h in remove_headers_on_redirect + ) + self.backoff_jitter = backoff_jitter + + def new(self, **kw: typing.Any) -> Retry: + params = dict( + total=self.total, + connect=self.connect, + read=self.read, + redirect=self.redirect, + status=self.status, + other=self.other, + allowed_methods=self.allowed_methods, + status_forcelist=self.status_forcelist, + backoff_factor=self.backoff_factor, + backoff_max=self.backoff_max, + raise_on_redirect=self.raise_on_redirect, + raise_on_status=self.raise_on_status, + history=self.history, + remove_headers_on_redirect=self.remove_headers_on_redirect, + respect_retry_after_header=self.respect_retry_after_header, + backoff_jitter=self.backoff_jitter, + ) + + params.update(kw) + return type(self)(**params) # type: ignore[arg-type] + + @classmethod + def from_int( + cls, + retries: Retry | bool | int | None, + redirect: bool | int | None = True, + default: Retry | bool | int | None = None, + ) -> Retry: + """Backwards-compatibility for the old retries format.""" + if retries is None: + retries = default if default is not None else cls.DEFAULT + + if isinstance(retries, Retry): + return retries + + redirect = bool(redirect) and None + new_retries = cls(retries, redirect=redirect) + log.debug("Converted retries value: %r -> %r", retries, new_retries) + return new_retries + + def get_backoff_time(self) -> float: + """Formula for computing the current backoff + + :rtype: float + """ + # We want to consider only the last consecutive errors sequence (Ignore redirects). + consecutive_errors_len = len( + list( + takewhile(lambda x: x.redirect_location is None, reversed(self.history)) + ) + ) + if consecutive_errors_len <= 1: + return 0 + + backoff_value = self.backoff_factor * (2 ** (consecutive_errors_len - 1)) + if self.backoff_jitter != 0.0: + backoff_value += random.random() * self.backoff_jitter + return float(max(0, min(self.backoff_max, backoff_value))) + + def parse_retry_after(self, retry_after: str) -> float: + seconds: float + # Whitespace: https://tools.ietf.org/html/rfc7230#section-3.2.4 + if re.match(r"^\s*[0-9]+\s*$", retry_after): + seconds = int(retry_after) + else: + retry_date_tuple = email.utils.parsedate_tz(retry_after) + if retry_date_tuple is None: + raise InvalidHeader(f"Invalid Retry-After header: {retry_after}") + + retry_date = email.utils.mktime_tz(retry_date_tuple) + seconds = retry_date - time.time() + + seconds = max(seconds, 0) + + return seconds + + def get_retry_after(self, response: BaseHTTPResponse) -> float | None: + """Get the value of Retry-After in seconds.""" + + retry_after = response.headers.get("Retry-After") + + if retry_after is None: + return None + + return self.parse_retry_after(retry_after) + + def sleep_for_retry(self, response: BaseHTTPResponse) -> bool: + retry_after = self.get_retry_after(response) + if retry_after: + time.sleep(retry_after) + return True + + return False + + def _sleep_backoff(self) -> None: + backoff = self.get_backoff_time() + if backoff <= 0: + return + time.sleep(backoff) + + def sleep(self, response: BaseHTTPResponse | None = None) -> None: + """Sleep between retry attempts. + + This method will respect a server's ``Retry-After`` response header + and sleep the duration of the time requested. If that is not present, it + will use an exponential backoff. By default, the backoff factor is 0 and + this method will return immediately. + """ + + if self.respect_retry_after_header and response: + slept = self.sleep_for_retry(response) + if slept: + return + + self._sleep_backoff() + + def _is_connection_error(self, err: Exception) -> bool: + """Errors when we're fairly sure that the server did not receive the + request, so it should be safe to retry. + """ + if isinstance(err, ProxyError): + err = err.original_error + return isinstance(err, ConnectTimeoutError) + + def _is_read_error(self, err: Exception) -> bool: + """Errors that occur after the request has been started, so we should + assume that the server began processing it. + """ + return isinstance(err, (ReadTimeoutError, ProtocolError)) + + def _is_method_retryable(self, method: str) -> bool: + """Checks if a given HTTP method should be retried upon, depending if + it is included in the allowed_methods + """ + if self.allowed_methods and method.upper() not in self.allowed_methods: + return False + return True + + def is_retry( + self, method: str, status_code: int, has_retry_after: bool = False + ) -> bool: + """Is this method/status code retryable? (Based on allowlists and control + variables such as the number of total retries to allow, whether to + respect the Retry-After header, whether this header is present, and + whether the returned status code is on the list of status codes to + be retried upon on the presence of the aforementioned header) + """ + if not self._is_method_retryable(method): + return False + + if self.status_forcelist and status_code in self.status_forcelist: + return True + + return bool( + self.total + and self.respect_retry_after_header + and has_retry_after + and (status_code in self.RETRY_AFTER_STATUS_CODES) + ) + + def is_exhausted(self) -> bool: + """Are we out of retries?""" + retry_counts = [ + x + for x in ( + self.total, + self.connect, + self.read, + self.redirect, + self.status, + self.other, + ) + if x + ] + if not retry_counts: + return False + + return min(retry_counts) < 0 + + def increment( + self, + method: str | None = None, + url: str | None = None, + response: BaseHTTPResponse | None = None, + error: Exception | None = None, + _pool: ConnectionPool | None = None, + _stacktrace: TracebackType | None = None, + ) -> Retry: + """Return a new Retry object with incremented retry counters. + + :param response: A response object, or None, if the server did not + return a response. + :type response: :class:`~urllib3.response.BaseHTTPResponse` + :param Exception error: An error encountered during the request, or + None if the response was received successfully. + + :return: A new ``Retry`` object. + """ + if self.total is False and error: + # Disabled, indicate to re-raise the error. + raise reraise(type(error), error, _stacktrace) + + total = self.total + if total is not None: + total -= 1 + + connect = self.connect + read = self.read + redirect = self.redirect + status_count = self.status + other = self.other + cause = "unknown" + status = None + redirect_location = None + + if error and self._is_connection_error(error): + # Connect retry? + if connect is False: + raise reraise(type(error), error, _stacktrace) + elif connect is not None: + connect -= 1 + + elif error and self._is_read_error(error): + # Read retry? + if read is False or method is None or not self._is_method_retryable(method): + raise reraise(type(error), error, _stacktrace) + elif read is not None: + read -= 1 + + elif error: + # Other retry? + if other is not None: + other -= 1 + + elif response and response.get_redirect_location(): + # Redirect retry? + if redirect is not None: + redirect -= 1 + cause = "too many redirects" + response_redirect_location = response.get_redirect_location() + if response_redirect_location: + redirect_location = response_redirect_location + status = response.status + + else: + # Incrementing because of a server error like a 500 in + # status_forcelist and the given method is in the allowed_methods + cause = ResponseError.GENERIC_ERROR + if response and response.status: + if status_count is not None: + status_count -= 1 + cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) + status = response.status + + history = self.history + ( + RequestHistory(method, url, error, status, redirect_location), + ) + + new_retry = self.new( + total=total, + connect=connect, + read=read, + redirect=redirect, + status=status_count, + other=other, + history=history, + ) + + if new_retry.is_exhausted(): + reason = error or ResponseError(cause) + raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] + + log.debug("Incremented Retry for (url='%s'): %r", url, new_retry) + + return new_retry + + def __repr__(self) -> str: + return ( + f"{type(self).__name__}(total={self.total}, connect={self.connect}, " + f"read={self.read}, redirect={self.redirect}, status={self.status})" + ) + + +# For backwards compatibility (equivalent to pre-v1.9): +Retry.DEFAULT = Retry(3) diff --git a/requests/python/urllib3/util/ssl_.py b/requests/python/urllib3/util/ssl_.py new file mode 100644 index 0000000..7762803 --- /dev/null +++ b/requests/python/urllib3/util/ssl_.py @@ -0,0 +1,513 @@ +from __future__ import annotations + +import hmac +import os +import socket +import sys +import typing +import warnings +from binascii import unhexlify +from hashlib import md5, sha1, sha256 + +from ..exceptions import ProxySchemeUnsupported, SSLError +from .url import _BRACELESS_IPV6_ADDRZ_RE, _IPV4_RE + +SSLContext = None +SSLTransport = None +HAS_NEVER_CHECK_COMMON_NAME = False +IS_PYOPENSSL = False +IS_SECURETRANSPORT = False +ALPN_PROTOCOLS = ["http/1.1"] + +_TYPE_VERSION_INFO = typing.Tuple[int, int, int, str, int] + +# Maps the length of a digest to a possible hash function producing this digest +HASHFUNC_MAP = {32: md5, 40: sha1, 64: sha256} + + +def _is_bpo_43522_fixed( + implementation_name: str, + version_info: _TYPE_VERSION_INFO, + pypy_version_info: _TYPE_VERSION_INFO | None, +) -> bool: + """Return True for CPython 3.8.9+, 3.9.3+ or 3.10+ and PyPy 7.3.8+ where + setting SSLContext.hostname_checks_common_name to False works. + + Outside of CPython and PyPy we don't know which implementations work + or not so we conservatively use our hostname matching as we know that works + on all implementations. + + https://github.com/urllib3/urllib3/issues/2192#issuecomment-821832963 + https://foss.heptapod.net/pypy/pypy/-/issues/3539 + """ + if implementation_name == "pypy": + # https://foss.heptapod.net/pypy/pypy/-/issues/3129 + return pypy_version_info >= (7, 3, 8) and version_info >= (3, 8) # type: ignore[operator] + elif implementation_name == "cpython": + major_minor = version_info[:2] + micro = version_info[2] + return ( + (major_minor == (3, 8) and micro >= 9) + or (major_minor == (3, 9) and micro >= 3) + or major_minor >= (3, 10) + ) + else: # Defensive: + return False + + +def _is_has_never_check_common_name_reliable( + openssl_version: str, + openssl_version_number: int, + implementation_name: str, + version_info: _TYPE_VERSION_INFO, + pypy_version_info: _TYPE_VERSION_INFO | None, +) -> bool: + # As of May 2023, all released versions of LibreSSL fail to reject certificates with + # only common names, see https://github.com/urllib3/urllib3/pull/3024 + is_openssl = openssl_version.startswith("OpenSSL ") + # Before fixing OpenSSL issue #14579, the SSL_new() API was not copying hostflags + # like X509_CHECK_FLAG_NEVER_CHECK_SUBJECT, which tripped up CPython. + # https://github.com/openssl/openssl/issues/14579 + # This was released in OpenSSL 1.1.1l+ (>=0x101010cf) + is_openssl_issue_14579_fixed = openssl_version_number >= 0x101010CF + + return is_openssl and ( + is_openssl_issue_14579_fixed + or _is_bpo_43522_fixed(implementation_name, version_info, pypy_version_info) + ) + + +if typing.TYPE_CHECKING: + from ssl import VerifyMode + + from typing_extensions import Literal, TypedDict + + from .ssltransport import SSLTransport as SSLTransportType + + class _TYPE_PEER_CERT_RET_DICT(TypedDict, total=False): + subjectAltName: tuple[tuple[str, str], ...] + subject: tuple[tuple[tuple[str, str], ...], ...] + serialNumber: str + + +# Mapping from 'ssl.PROTOCOL_TLSX' to 'TLSVersion.X' +_SSL_VERSION_TO_TLS_VERSION: dict[int, int] = {} + +try: # Do we have ssl at all? + import ssl + from ssl import ( # type: ignore[assignment] + CERT_REQUIRED, + HAS_NEVER_CHECK_COMMON_NAME, + OP_NO_COMPRESSION, + OP_NO_TICKET, + OPENSSL_VERSION, + OPENSSL_VERSION_NUMBER, + PROTOCOL_TLS, + PROTOCOL_TLS_CLIENT, + OP_NO_SSLv2, + OP_NO_SSLv3, + SSLContext, + TLSVersion, + ) + + PROTOCOL_SSLv23 = PROTOCOL_TLS + + # Setting SSLContext.hostname_checks_common_name = False didn't work before CPython + # 3.8.9, 3.9.3, and 3.10 (but OK on PyPy) or OpenSSL 1.1.1l+ + if HAS_NEVER_CHECK_COMMON_NAME and not _is_has_never_check_common_name_reliable( + OPENSSL_VERSION, + OPENSSL_VERSION_NUMBER, + sys.implementation.name, + sys.version_info, + sys.pypy_version_info if sys.implementation.name == "pypy" else None, # type: ignore[attr-defined] + ): + HAS_NEVER_CHECK_COMMON_NAME = False + + # Need to be careful here in case old TLS versions get + # removed in future 'ssl' module implementations. + for attr in ("TLSv1", "TLSv1_1", "TLSv1_2"): + try: + _SSL_VERSION_TO_TLS_VERSION[getattr(ssl, f"PROTOCOL_{attr}")] = getattr( + TLSVersion, attr + ) + except AttributeError: # Defensive: + continue + + from .ssltransport import SSLTransport # type: ignore[assignment] +except ImportError: + OP_NO_COMPRESSION = 0x20000 # type: ignore[assignment] + OP_NO_TICKET = 0x4000 # type: ignore[assignment] + OP_NO_SSLv2 = 0x1000000 # type: ignore[assignment] + OP_NO_SSLv3 = 0x2000000 # type: ignore[assignment] + PROTOCOL_SSLv23 = PROTOCOL_TLS = 2 # type: ignore[assignment] + PROTOCOL_TLS_CLIENT = 16 # type: ignore[assignment] + + +_TYPE_PEER_CERT_RET = typing.Union["_TYPE_PEER_CERT_RET_DICT", bytes, None] + + +def assert_fingerprint(cert: bytes | None, fingerprint: str) -> None: + """ + Checks if given fingerprint matches the supplied certificate. + + :param cert: + Certificate as bytes object. + :param fingerprint: + Fingerprint as string of hexdigits, can be interspersed by colons. + """ + + if cert is None: + raise SSLError("No certificate for the peer.") + + fingerprint = fingerprint.replace(":", "").lower() + digest_length = len(fingerprint) + hashfunc = HASHFUNC_MAP.get(digest_length) + if not hashfunc: + raise SSLError(f"Fingerprint of invalid length: {fingerprint}") + + # We need encode() here for py32; works on py2 and p33. + fingerprint_bytes = unhexlify(fingerprint.encode()) + + cert_digest = hashfunc(cert).digest() + + if not hmac.compare_digest(cert_digest, fingerprint_bytes): + raise SSLError( + f'Fingerprints did not match. Expected "{fingerprint}", got "{cert_digest.hex()}"' + ) + + +def resolve_cert_reqs(candidate: None | int | str) -> VerifyMode: + """ + Resolves the argument to a numeric constant, which can be passed to + the wrap_socket function/method from the ssl module. + Defaults to :data:`ssl.CERT_REQUIRED`. + If given a string it is assumed to be the name of the constant in the + :mod:`ssl` module or its abbreviation. + (So you can specify `REQUIRED` instead of `CERT_REQUIRED`. + If it's neither `None` nor a string we assume it is already the numeric + constant which can directly be passed to wrap_socket. + """ + if candidate is None: + return CERT_REQUIRED + + if isinstance(candidate, str): + res = getattr(ssl, candidate, None) + if res is None: + res = getattr(ssl, "CERT_" + candidate) + return res # type: ignore[no-any-return] + + return candidate # type: ignore[return-value] + + +def resolve_ssl_version(candidate: None | int | str) -> int: + """ + like resolve_cert_reqs + """ + if candidate is None: + return PROTOCOL_TLS + + if isinstance(candidate, str): + res = getattr(ssl, candidate, None) + if res is None: + res = getattr(ssl, "PROTOCOL_" + candidate) + return typing.cast(int, res) + + return candidate + + +def create_urllib3_context( + ssl_version: int | None = None, + cert_reqs: int | None = None, + options: int | None = None, + ciphers: str | None = None, + ssl_minimum_version: int | None = None, + ssl_maximum_version: int | None = None, +) -> ssl.SSLContext: + """Creates and configures an :class:`ssl.SSLContext` instance for use with urllib3. + + :param ssl_version: + The desired protocol version to use. This will default to + PROTOCOL_SSLv23 which will negotiate the highest protocol that both + the server and your installation of OpenSSL support. + + This parameter is deprecated instead use 'ssl_minimum_version'. + :param ssl_minimum_version: + The minimum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. + :param ssl_maximum_version: + The maximum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value. + Not recommended to set to anything other than 'ssl.TLSVersion.MAXIMUM_SUPPORTED' which is the + default value. + :param cert_reqs: + Whether to require the certificate verification. This defaults to + ``ssl.CERT_REQUIRED``. + :param options: + Specific OpenSSL options. These default to ``ssl.OP_NO_SSLv2``, + ``ssl.OP_NO_SSLv3``, ``ssl.OP_NO_COMPRESSION``, and ``ssl.OP_NO_TICKET``. + :param ciphers: + Which cipher suites to allow the server to select. Defaults to either system configured + ciphers if OpenSSL 1.1.1+, otherwise uses a secure default set of ciphers. + :returns: + Constructed SSLContext object with specified options + :rtype: SSLContext + """ + if SSLContext is None: + raise TypeError("Can't create an SSLContext object without an ssl module") + + # This means 'ssl_version' was specified as an exact value. + if ssl_version not in (None, PROTOCOL_TLS, PROTOCOL_TLS_CLIENT): + # Disallow setting 'ssl_version' and 'ssl_minimum|maximum_version' + # to avoid conflicts. + if ssl_minimum_version is not None or ssl_maximum_version is not None: + raise ValueError( + "Can't specify both 'ssl_version' and either " + "'ssl_minimum_version' or 'ssl_maximum_version'" + ) + + # 'ssl_version' is deprecated and will be removed in the future. + else: + # Use 'ssl_minimum_version' and 'ssl_maximum_version' instead. + ssl_minimum_version = _SSL_VERSION_TO_TLS_VERSION.get( + ssl_version, TLSVersion.MINIMUM_SUPPORTED + ) + ssl_maximum_version = _SSL_VERSION_TO_TLS_VERSION.get( + ssl_version, TLSVersion.MAXIMUM_SUPPORTED + ) + + # This warning message is pushing users to use 'ssl_minimum_version' + # instead of both min/max. Best practice is to only set the minimum version and + # keep the maximum version to be it's default value: 'TLSVersion.MAXIMUM_SUPPORTED' + warnings.warn( + "'ssl_version' option is deprecated and will be " + "removed in urllib3 v2.1.0. Instead use 'ssl_minimum_version'", + category=DeprecationWarning, + stacklevel=2, + ) + + # PROTOCOL_TLS is deprecated in Python 3.10 so we always use PROTOCOL_TLS_CLIENT + context = SSLContext(PROTOCOL_TLS_CLIENT) + + if ssl_minimum_version is not None: + context.minimum_version = ssl_minimum_version + else: # Python <3.10 defaults to 'MINIMUM_SUPPORTED' so explicitly set TLSv1.2 here + context.minimum_version = TLSVersion.TLSv1_2 + + if ssl_maximum_version is not None: + context.maximum_version = ssl_maximum_version + + # Unless we're given ciphers defer to either system ciphers in + # the case of OpenSSL 1.1.1+ or use our own secure default ciphers. + if ciphers: + context.set_ciphers(ciphers) + + # Setting the default here, as we may have no ssl module on import + cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs + + if options is None: + options = 0 + # SSLv2 is easily broken and is considered harmful and dangerous + options |= OP_NO_SSLv2 + # SSLv3 has several problems and is now dangerous + options |= OP_NO_SSLv3 + # Disable compression to prevent CRIME attacks for OpenSSL 1.0+ + # (issue #309) + options |= OP_NO_COMPRESSION + # TLSv1.2 only. Unless set explicitly, do not request tickets. + # This may save some bandwidth on wire, and although the ticket is encrypted, + # there is a risk associated with it being on wire, + # if the server is not rotating its ticketing keys properly. + options |= OP_NO_TICKET + + context.options |= options + + # Enable post-handshake authentication for TLS 1.3, see GH #1634. PHA is + # necessary for conditional client cert authentication with TLS 1.3. + # The attribute is None for OpenSSL <= 1.1.0 or does not exist in older + # versions of Python. We only enable on Python 3.7.4+ or if certificate + # verification is enabled to work around Python issue #37428 + # See: https://bugs.python.org/issue37428 + if (cert_reqs == ssl.CERT_REQUIRED or sys.version_info >= (3, 7, 4)) and getattr( + context, "post_handshake_auth", None + ) is not None: + context.post_handshake_auth = True + + # The order of the below lines setting verify_mode and check_hostname + # matter due to safe-guards SSLContext has to prevent an SSLContext with + # check_hostname=True, verify_mode=NONE/OPTIONAL. + # We always set 'check_hostname=False' for pyOpenSSL so we rely on our own + # 'ssl.match_hostname()' implementation. + if cert_reqs == ssl.CERT_REQUIRED and not IS_PYOPENSSL: + context.verify_mode = cert_reqs + context.check_hostname = True + else: + context.check_hostname = False + context.verify_mode = cert_reqs + + try: + context.hostname_checks_common_name = False + except AttributeError: # Defensive: for CPython < 3.8.9 and 3.9.3; for PyPy < 7.3.8 + pass + + # Enable logging of TLS session keys via defacto standard environment variable + # 'SSLKEYLOGFILE', if the feature is available (Python 3.8+). Skip empty values. + if hasattr(context, "keylog_filename"): + sslkeylogfile = os.environ.get("SSLKEYLOGFILE") + if sslkeylogfile: + context.keylog_filename = sslkeylogfile + + return context + + +@typing.overload +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = ..., + certfile: str | None = ..., + cert_reqs: int | None = ..., + ca_certs: str | None = ..., + server_hostname: str | None = ..., + ssl_version: int | None = ..., + ciphers: str | None = ..., + ssl_context: ssl.SSLContext | None = ..., + ca_cert_dir: str | None = ..., + key_password: str | None = ..., + ca_cert_data: None | str | bytes = ..., + tls_in_tls: Literal[False] = ..., +) -> ssl.SSLSocket: + ... + + +@typing.overload +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = ..., + certfile: str | None = ..., + cert_reqs: int | None = ..., + ca_certs: str | None = ..., + server_hostname: str | None = ..., + ssl_version: int | None = ..., + ciphers: str | None = ..., + ssl_context: ssl.SSLContext | None = ..., + ca_cert_dir: str | None = ..., + key_password: str | None = ..., + ca_cert_data: None | str | bytes = ..., + tls_in_tls: bool = ..., +) -> ssl.SSLSocket | SSLTransportType: + ... + + +def ssl_wrap_socket( + sock: socket.socket, + keyfile: str | None = None, + certfile: str | None = None, + cert_reqs: int | None = None, + ca_certs: str | None = None, + server_hostname: str | None = None, + ssl_version: int | None = None, + ciphers: str | None = None, + ssl_context: ssl.SSLContext | None = None, + ca_cert_dir: str | None = None, + key_password: str | None = None, + ca_cert_data: None | str | bytes = None, + tls_in_tls: bool = False, +) -> ssl.SSLSocket | SSLTransportType: + """ + All arguments except for server_hostname, ssl_context, and ca_cert_dir have + the same meaning as they do when using :func:`ssl.wrap_socket`. + + :param server_hostname: + When SNI is supported, the expected hostname of the certificate + :param ssl_context: + A pre-made :class:`SSLContext` object. If none is provided, one will + be created using :func:`create_urllib3_context`. + :param ciphers: + A string of ciphers we wish the client to support. + :param ca_cert_dir: + A directory containing CA certificates in multiple separate files, as + supported by OpenSSL's -CApath flag or the capath argument to + SSLContext.load_verify_locations(). + :param key_password: + Optional password if the keyfile is encrypted. + :param ca_cert_data: + Optional string containing CA certificates in PEM format suitable for + passing as the cadata parameter to SSLContext.load_verify_locations() + :param tls_in_tls: + Use SSLTransport to wrap the existing socket. + """ + context = ssl_context + if context is None: + # Note: This branch of code and all the variables in it are only used in tests. + # We should consider deprecating and removing this code. + context = create_urllib3_context(ssl_version, cert_reqs, ciphers=ciphers) + + if ca_certs or ca_cert_dir or ca_cert_data: + try: + context.load_verify_locations(ca_certs, ca_cert_dir, ca_cert_data) + except OSError as e: + raise SSLError(e) from e + + elif ssl_context is None and hasattr(context, "load_default_certs"): + # try to load OS default certs; works well on Windows. + context.load_default_certs() + + # Attempt to detect if we get the goofy behavior of the + # keyfile being encrypted and OpenSSL asking for the + # passphrase via the terminal and instead error out. + if keyfile and key_password is None and _is_key_file_encrypted(keyfile): + raise SSLError("Client private key is encrypted, password is required") + + if certfile: + if key_password is None: + context.load_cert_chain(certfile, keyfile) + else: + context.load_cert_chain(certfile, keyfile, key_password) + + try: + context.set_alpn_protocols(ALPN_PROTOCOLS) + except NotImplementedError: # Defensive: in CI, we always have set_alpn_protocols + pass + + ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) + return ssl_sock + + +def is_ipaddress(hostname: str | bytes) -> bool: + """Detects whether the hostname given is an IPv4 or IPv6 address. + Also detects IPv6 addresses with Zone IDs. + + :param str hostname: Hostname to examine. + :return: True if the hostname is an IP address, False otherwise. + """ + if isinstance(hostname, bytes): + # IDN A-label bytes are ASCII compatible. + hostname = hostname.decode("ascii") + return bool(_IPV4_RE.match(hostname) or _BRACELESS_IPV6_ADDRZ_RE.match(hostname)) + + +def _is_key_file_encrypted(key_file: str) -> bool: + """Detects if a key file is encrypted or not.""" + with open(key_file) as f: + for line in f: + # Look for Proc-Type: 4,ENCRYPTED + if "ENCRYPTED" in line: + return True + + return False + + +def _ssl_wrap_socket_impl( + sock: socket.socket, + ssl_context: ssl.SSLContext, + tls_in_tls: bool, + server_hostname: str | None = None, +) -> ssl.SSLSocket | SSLTransportType: + if tls_in_tls: + if not SSLTransport: + # Import error, ssl is not available. + raise ProxySchemeUnsupported( + "TLS in TLS requires support for the 'ssl' module" + ) + + SSLTransport._validate_ssl_context_for_tls_in_tls(ssl_context) + return SSLTransport(sock, ssl_context, server_hostname) + + return ssl_context.wrap_socket(sock, server_hostname=server_hostname) diff --git a/requests/python/urllib3/util/ssl_match_hostname.py b/requests/python/urllib3/util/ssl_match_hostname.py new file mode 100644 index 0000000..453cfd4 --- /dev/null +++ b/requests/python/urllib3/util/ssl_match_hostname.py @@ -0,0 +1,159 @@ +"""The match_hostname() function from Python 3.5, essential when using SSL.""" + +# Note: This file is under the PSF license as the code comes from the python +# stdlib. http://docs.python.org/3/license.html +# It is modified to remove commonName support. + +from __future__ import annotations + +import ipaddress +import re +import typing +from ipaddress import IPv4Address, IPv6Address + +if typing.TYPE_CHECKING: + from .ssl_ import _TYPE_PEER_CERT_RET_DICT + +__version__ = "3.5.0.1" + + +class CertificateError(ValueError): + pass + + +def _dnsname_match( + dn: typing.Any, hostname: str, max_wildcards: int = 1 +) -> typing.Match[str] | None | bool: + """Matching according to RFC 6125, section 6.4.3 + + http://tools.ietf.org/html/rfc6125#section-6.4.3 + """ + pats = [] + if not dn: + return False + + # Ported from python3-syntax: + # leftmost, *remainder = dn.split(r'.') + parts = dn.split(r".") + leftmost = parts[0] + remainder = parts[1:] + + wildcards = leftmost.count("*") + if wildcards > max_wildcards: + # Issue #17980: avoid denials of service by refusing more + # than one wildcard per fragment. A survey of established + # policy among SSL implementations showed it to be a + # reasonable choice. + raise CertificateError( + "too many wildcards in certificate DNS name: " + repr(dn) + ) + + # speed up common case w/o wildcards + if not wildcards: + return bool(dn.lower() == hostname.lower()) + + # RFC 6125, section 6.4.3, subitem 1. + # The client SHOULD NOT attempt to match a presented identifier in which + # the wildcard character comprises a label other than the left-most label. + if leftmost == "*": + # When '*' is a fragment by itself, it matches a non-empty dotless + # fragment. + pats.append("[^.]+") + elif leftmost.startswith("xn--") or hostname.startswith("xn--"): + # RFC 6125, section 6.4.3, subitem 3. + # The client SHOULD NOT attempt to match a presented identifier + # where the wildcard character is embedded within an A-label or + # U-label of an internationalized domain name. + pats.append(re.escape(leftmost)) + else: + # Otherwise, '*' matches any dotless string, e.g. www* + pats.append(re.escape(leftmost).replace(r"\*", "[^.]*")) + + # add the remaining fragments, ignore any wildcards + for frag in remainder: + pats.append(re.escape(frag)) + + pat = re.compile(r"\A" + r"\.".join(pats) + r"\Z", re.IGNORECASE) + return pat.match(hostname) + + +def _ipaddress_match(ipname: str, host_ip: IPv4Address | IPv6Address) -> bool: + """Exact matching of IP addresses. + + RFC 9110 section 4.3.5: "A reference identity of IP-ID contains the decoded + bytes of the IP address. An IP version 4 address is 4 octets, and an IP + version 6 address is 16 octets. [...] A reference identity of type IP-ID + matches if the address is identical to an iPAddress value of the + subjectAltName extension of the certificate." + """ + # OpenSSL may add a trailing newline to a subjectAltName's IP address + # Divergence from upstream: ipaddress can't handle byte str + ip = ipaddress.ip_address(ipname.rstrip()) + return bool(ip.packed == host_ip.packed) + + +def match_hostname( + cert: _TYPE_PEER_CERT_RET_DICT | None, + hostname: str, + hostname_checks_common_name: bool = False, +) -> None: + """Verify that *cert* (in decoded format as returned by + SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 + rules are followed, but IP addresses are not accepted for *hostname*. + + CertificateError is raised on failure. On success, the function + returns nothing. + """ + if not cert: + raise ValueError( + "empty or no certificate, match_hostname needs a " + "SSL socket or SSL context with either " + "CERT_OPTIONAL or CERT_REQUIRED" + ) + try: + # Divergence from upstream: ipaddress can't handle byte str + # + # The ipaddress module shipped with Python < 3.9 does not support + # scoped IPv6 addresses so we unconditionally strip the Zone IDs for + # now. Once we drop support for Python 3.9 we can remove this branch. + if "%" in hostname: + host_ip = ipaddress.ip_address(hostname[: hostname.rfind("%")]) + else: + host_ip = ipaddress.ip_address(hostname) + + except ValueError: + # Not an IP address (common case) + host_ip = None + dnsnames = [] + san: tuple[tuple[str, str], ...] = cert.get("subjectAltName", ()) + key: str + value: str + for key, value in san: + if key == "DNS": + if host_ip is None and _dnsname_match(value, hostname): + return + dnsnames.append(value) + elif key == "IP Address": + if host_ip is not None and _ipaddress_match(value, host_ip): + return + dnsnames.append(value) + + # We only check 'commonName' if it's enabled and we're not verifying + # an IP address. IP addresses aren't valid within 'commonName'. + if hostname_checks_common_name and host_ip is None and not dnsnames: + for sub in cert.get("subject", ()): + for key, value in sub: + if key == "commonName": + if _dnsname_match(value, hostname): + return + dnsnames.append(value) + + if len(dnsnames) > 1: + raise CertificateError( + "hostname %r " + "doesn't match either of %s" % (hostname, ", ".join(map(repr, dnsnames))) + ) + elif len(dnsnames) == 1: + raise CertificateError(f"hostname {hostname!r} doesn't match {dnsnames[0]!r}") + else: + raise CertificateError("no appropriate subjectAltName fields were found") diff --git a/requests/python/urllib3/util/ssltransport.py b/requests/python/urllib3/util/ssltransport.py new file mode 100644 index 0000000..5ec8647 --- /dev/null +++ b/requests/python/urllib3/util/ssltransport.py @@ -0,0 +1,280 @@ +from __future__ import annotations + +import io +import socket +import ssl +import typing + +from ..exceptions import ProxySchemeUnsupported + +if typing.TYPE_CHECKING: + from typing_extensions import Literal + + from .ssl_ import _TYPE_PEER_CERT_RET, _TYPE_PEER_CERT_RET_DICT + + +_SelfT = typing.TypeVar("_SelfT", bound="SSLTransport") +_WriteBuffer = typing.Union[bytearray, memoryview] +_ReturnValue = typing.TypeVar("_ReturnValue") + +SSL_BLOCKSIZE = 16384 + + +class SSLTransport: + """ + The SSLTransport wraps an existing socket and establishes an SSL connection. + + Contrary to Python's implementation of SSLSocket, it allows you to chain + multiple TLS connections together. It's particularly useful if you need to + implement TLS within TLS. + + The class supports most of the socket API operations. + """ + + @staticmethod + def _validate_ssl_context_for_tls_in_tls(ssl_context: ssl.SSLContext) -> None: + """ + Raises a ProxySchemeUnsupported if the provided ssl_context can't be used + for TLS in TLS. + + The only requirement is that the ssl_context provides the 'wrap_bio' + methods. + """ + + if not hasattr(ssl_context, "wrap_bio"): + raise ProxySchemeUnsupported( + "TLS in TLS requires SSLContext.wrap_bio() which isn't " + "available on non-native SSLContext" + ) + + def __init__( + self, + socket: socket.socket, + ssl_context: ssl.SSLContext, + server_hostname: str | None = None, + suppress_ragged_eofs: bool = True, + ) -> None: + """ + Create an SSLTransport around socket using the provided ssl_context. + """ + self.incoming = ssl.MemoryBIO() + self.outgoing = ssl.MemoryBIO() + + self.suppress_ragged_eofs = suppress_ragged_eofs + self.socket = socket + + self.sslobj = ssl_context.wrap_bio( + self.incoming, self.outgoing, server_hostname=server_hostname + ) + + # Perform initial handshake. + self._ssl_io_loop(self.sslobj.do_handshake) + + def __enter__(self: _SelfT) -> _SelfT: + return self + + def __exit__(self, *_: typing.Any) -> None: + self.close() + + def fileno(self) -> int: + return self.socket.fileno() + + def read(self, len: int = 1024, buffer: typing.Any | None = None) -> int | bytes: + return self._wrap_ssl_read(len, buffer) + + def recv(self, buflen: int = 1024, flags: int = 0) -> int | bytes: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv") + return self._wrap_ssl_read(buflen) + + def recv_into( + self, + buffer: _WriteBuffer, + nbytes: int | None = None, + flags: int = 0, + ) -> None | int | bytes: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to recv_into") + if nbytes is None: + nbytes = len(buffer) + return self.read(nbytes, buffer) + + def sendall(self, data: bytes, flags: int = 0) -> None: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to sendall") + count = 0 + with memoryview(data) as view, view.cast("B") as byte_view: + amount = len(byte_view) + while count < amount: + v = self.send(byte_view[count:]) + count += v + + def send(self, data: bytes, flags: int = 0) -> int: + if flags != 0: + raise ValueError("non-zero flags not allowed in calls to send") + return self._ssl_io_loop(self.sslobj.write, data) + + def makefile( + self, + mode: str, + buffering: int | None = None, + *, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + ) -> typing.BinaryIO | typing.TextIO | socket.SocketIO: + """ + Python's httpclient uses makefile and buffered io when reading HTTP + messages and we need to support it. + + This is unfortunately a copy and paste of socket.py makefile with small + changes to point to the socket directly. + """ + if not set(mode) <= {"r", "w", "b"}: + raise ValueError(f"invalid mode {mode!r} (only r, w, b allowed)") + + writing = "w" in mode + reading = "r" in mode or not writing + assert reading or writing + binary = "b" in mode + rawmode = "" + if reading: + rawmode += "r" + if writing: + rawmode += "w" + raw = socket.SocketIO(self, rawmode) # type: ignore[arg-type] + self.socket._io_refs += 1 # type: ignore[attr-defined] + if buffering is None: + buffering = -1 + if buffering < 0: + buffering = io.DEFAULT_BUFFER_SIZE + if buffering == 0: + if not binary: + raise ValueError("unbuffered streams must be binary") + return raw + buffer: typing.BinaryIO + if reading and writing: + buffer = io.BufferedRWPair(raw, raw, buffering) # type: ignore[assignment] + elif reading: + buffer = io.BufferedReader(raw, buffering) + else: + assert writing + buffer = io.BufferedWriter(raw, buffering) + if binary: + return buffer + text = io.TextIOWrapper(buffer, encoding, errors, newline) + text.mode = mode # type: ignore[misc] + return text + + def unwrap(self) -> None: + self._ssl_io_loop(self.sslobj.unwrap) + + def close(self) -> None: + self.socket.close() + + @typing.overload + def getpeercert( + self, binary_form: Literal[False] = ... + ) -> _TYPE_PEER_CERT_RET_DICT | None: + ... + + @typing.overload + def getpeercert(self, binary_form: Literal[True]) -> bytes | None: + ... + + def getpeercert(self, binary_form: bool = False) -> _TYPE_PEER_CERT_RET: + return self.sslobj.getpeercert(binary_form) # type: ignore[return-value] + + def version(self) -> str | None: + return self.sslobj.version() + + def cipher(self) -> tuple[str, str, int] | None: + return self.sslobj.cipher() + + def selected_alpn_protocol(self) -> str | None: + return self.sslobj.selected_alpn_protocol() + + def selected_npn_protocol(self) -> str | None: + return self.sslobj.selected_npn_protocol() + + def shared_ciphers(self) -> list[tuple[str, str, int]] | None: + return self.sslobj.shared_ciphers() + + def compression(self) -> str | None: + return self.sslobj.compression() + + def settimeout(self, value: float | None) -> None: + self.socket.settimeout(value) + + def gettimeout(self) -> float | None: + return self.socket.gettimeout() + + def _decref_socketios(self) -> None: + self.socket._decref_socketios() # type: ignore[attr-defined] + + def _wrap_ssl_read(self, len: int, buffer: bytearray | None = None) -> int | bytes: + try: + return self._ssl_io_loop(self.sslobj.read, len, buffer) + except ssl.SSLError as e: + if e.errno == ssl.SSL_ERROR_EOF and self.suppress_ragged_eofs: + return 0 # eof, return 0. + else: + raise + + # func is sslobj.do_handshake or sslobj.unwrap + @typing.overload + def _ssl_io_loop(self, func: typing.Callable[[], None]) -> None: + ... + + # func is sslobj.write, arg1 is data + @typing.overload + def _ssl_io_loop(self, func: typing.Callable[[bytes], int], arg1: bytes) -> int: + ... + + # func is sslobj.read, arg1 is len, arg2 is buffer + @typing.overload + def _ssl_io_loop( + self, + func: typing.Callable[[int, bytearray | None], bytes], + arg1: int, + arg2: bytearray | None, + ) -> bytes: + ... + + def _ssl_io_loop( + self, + func: typing.Callable[..., _ReturnValue], + arg1: None | bytes | int = None, + arg2: bytearray | None = None, + ) -> _ReturnValue: + """Performs an I/O loop between incoming/outgoing and the socket.""" + should_loop = True + ret = None + + while should_loop: + errno = None + try: + if arg1 is None and arg2 is None: + ret = func() + elif arg2 is None: + ret = func(arg1) + else: + ret = func(arg1, arg2) + except ssl.SSLError as e: + if e.errno not in (ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE): + # WANT_READ, and WANT_WRITE are expected, others are not. + raise e + errno = e.errno + + buf = self.outgoing.read() + self.socket.sendall(buf) + + if errno is None: + should_loop = False + elif errno == ssl.SSL_ERROR_WANT_READ: + buf = self.socket.recv(SSL_BLOCKSIZE) + if buf: + self.incoming.write(buf) + else: + self.incoming.write_eof() + return typing.cast(_ReturnValue, ret) diff --git a/requests/python/urllib3/util/timeout.py b/requests/python/urllib3/util/timeout.py new file mode 100644 index 0000000..ec090f6 --- /dev/null +++ b/requests/python/urllib3/util/timeout.py @@ -0,0 +1,279 @@ +from __future__ import annotations + +import time +import typing +from enum import Enum +from socket import getdefaulttimeout + +from ..exceptions import TimeoutStateError + +if typing.TYPE_CHECKING: + from typing_extensions import Final + + +class _TYPE_DEFAULT(Enum): + # This value should never be passed to socket.settimeout() so for safety we use a -1. + # socket.settimout() raises a ValueError for negative values. + token = -1 + + +_DEFAULT_TIMEOUT: Final[_TYPE_DEFAULT] = _TYPE_DEFAULT.token + +_TYPE_TIMEOUT = typing.Optional[typing.Union[float, _TYPE_DEFAULT]] + + +class Timeout: + """Timeout configuration. + + Timeouts can be defined as a default for a pool: + + .. code-block:: python + + import urllib3 + + timeout = urllib3.util.Timeout(connect=2.0, read=7.0) + + http = urllib3.PoolManager(timeout=timeout) + + resp = http.request("GET", "https://example.com/") + + print(resp.status) + + Or per-request (which overrides the default for the pool): + + .. code-block:: python + + response = http.request("GET", "https://example.com/", timeout=Timeout(10)) + + Timeouts can be disabled by setting all the parameters to ``None``: + + .. code-block:: python + + no_timeout = Timeout(connect=None, read=None) + response = http.request("GET", "https://example.com/", timeout=no_timeout) + + + :param total: + This combines the connect and read timeouts into one; the read timeout + will be set to the time leftover from the connect attempt. In the + event that both a connect timeout and a total are specified, or a read + timeout and a total are specified, the shorter timeout will be applied. + + Defaults to None. + + :type total: int, float, or None + + :param connect: + The maximum amount of time (in seconds) to wait for a connection + attempt to a server to succeed. Omitting the parameter will default the + connect timeout to the system default, probably `the global default + timeout in socket.py + `_. + None will set an infinite timeout for connection attempts. + + :type connect: int, float, or None + + :param read: + The maximum amount of time (in seconds) to wait between consecutive + read operations for a response from the server. Omitting the parameter + will default the read timeout to the system default, probably `the + global default timeout in socket.py + `_. + None will set an infinite timeout. + + :type read: int, float, or None + + .. note:: + + Many factors can affect the total amount of time for urllib3 to return + an HTTP response. + + For example, Python's DNS resolver does not obey the timeout specified + on the socket. Other factors that can affect total request time include + high CPU load, high swap, the program running at a low priority level, + or other behaviors. + + In addition, the read and total timeouts only measure the time between + read operations on the socket connecting the client and the server, + not the total amount of time for the request to return a complete + response. For most requests, the timeout is raised because the server + has not sent the first byte in the specified time. This is not always + the case; if a server streams one byte every fifteen seconds, a timeout + of 20 seconds will not trigger, even though the request will take + several minutes to complete. + + If your goal is to cut off any request after a set amount of wall clock + time, consider having a second "watcher" thread to cut off a slow + request. + """ + + #: A sentinel object representing the default timeout value + DEFAULT_TIMEOUT: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT + + def __init__( + self, + total: _TYPE_TIMEOUT = None, + connect: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + read: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + ) -> None: + self._connect = self._validate_timeout(connect, "connect") + self._read = self._validate_timeout(read, "read") + self.total = self._validate_timeout(total, "total") + self._start_connect: float | None = None + + def __repr__(self) -> str: + return f"{type(self).__name__}(connect={self._connect!r}, read={self._read!r}, total={self.total!r})" + + # __str__ provided for backwards compatibility + __str__ = __repr__ + + @staticmethod + def resolve_default_timeout(timeout: _TYPE_TIMEOUT) -> float | None: + return getdefaulttimeout() if timeout is _DEFAULT_TIMEOUT else timeout + + @classmethod + def _validate_timeout(cls, value: _TYPE_TIMEOUT, name: str) -> _TYPE_TIMEOUT: + """Check that a timeout attribute is valid. + + :param value: The timeout value to validate + :param name: The name of the timeout attribute to validate. This is + used to specify in error messages. + :return: The validated and casted version of the given value. + :raises ValueError: If it is a numeric value less than or equal to + zero, or the type is not an integer, float, or None. + """ + if value is None or value is _DEFAULT_TIMEOUT: + return value + + if isinstance(value, bool): + raise ValueError( + "Timeout cannot be a boolean value. It must " + "be an int, float or None." + ) + try: + float(value) + except (TypeError, ValueError): + raise ValueError( + "Timeout value %s was %s, but it must be an " + "int, float or None." % (name, value) + ) from None + + try: + if value <= 0: + raise ValueError( + "Attempted to set %s timeout to %s, but the " + "timeout cannot be set to a value less " + "than or equal to 0." % (name, value) + ) + except TypeError: + raise ValueError( + "Timeout value %s was %s, but it must be an " + "int, float or None." % (name, value) + ) from None + + return value + + @classmethod + def from_float(cls, timeout: _TYPE_TIMEOUT) -> Timeout: + """Create a new Timeout from a legacy timeout value. + + The timeout value used by httplib.py sets the same timeout on the + connect(), and recv() socket requests. This creates a :class:`Timeout` + object that sets the individual timeouts to the ``timeout`` value + passed to this function. + + :param timeout: The legacy timeout value. + :type timeout: integer, float, :attr:`urllib3.util.Timeout.DEFAULT_TIMEOUT`, or None + :return: Timeout object + :rtype: :class:`Timeout` + """ + return Timeout(read=timeout, connect=timeout) + + def clone(self) -> Timeout: + """Create a copy of the timeout object + + Timeout properties are stored per-pool but each request needs a fresh + Timeout object to ensure each one has its own start/stop configured. + + :return: a copy of the timeout object + :rtype: :class:`Timeout` + """ + # We can't use copy.deepcopy because that will also create a new object + # for _GLOBAL_DEFAULT_TIMEOUT, which socket.py uses as a sentinel to + # detect the user default. + return Timeout(connect=self._connect, read=self._read, total=self.total) + + def start_connect(self) -> float: + """Start the timeout clock, used during a connect() attempt + + :raises urllib3.exceptions.TimeoutStateError: if you attempt + to start a timer that has been started already. + """ + if self._start_connect is not None: + raise TimeoutStateError("Timeout timer has already been started.") + self._start_connect = time.monotonic() + return self._start_connect + + def get_connect_duration(self) -> float: + """Gets the time elapsed since the call to :meth:`start_connect`. + + :return: Elapsed time in seconds. + :rtype: float + :raises urllib3.exceptions.TimeoutStateError: if you attempt + to get duration for a timer that hasn't been started. + """ + if self._start_connect is None: + raise TimeoutStateError( + "Can't get connect duration for timer that has not started." + ) + return time.monotonic() - self._start_connect + + @property + def connect_timeout(self) -> _TYPE_TIMEOUT: + """Get the value to use when setting a connection timeout. + + This will be a positive float or integer, the value None + (never timeout), or the default system timeout. + + :return: Connect timeout. + :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None + """ + if self.total is None: + return self._connect + + if self._connect is None or self._connect is _DEFAULT_TIMEOUT: + return self.total + + return min(self._connect, self.total) # type: ignore[type-var] + + @property + def read_timeout(self) -> float | None: + """Get the value for the read timeout. + + This assumes some time has elapsed in the connection timeout and + computes the read timeout appropriately. + + If self.total is set, the read timeout is dependent on the amount of + time taken by the connect timeout. If the connection time has not been + established, a :exc:`~urllib3.exceptions.TimeoutStateError` will be + raised. + + :return: Value to use for the read timeout. + :rtype: int, float or None + :raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect` + has not yet been called on this object. + """ + if ( + self.total is not None + and self.total is not _DEFAULT_TIMEOUT + and self._read is not None + and self._read is not _DEFAULT_TIMEOUT + ): + # In case the connect timeout has not yet been established. + if self._start_connect is None: + return self._read + return max(0, min(self.total - self.get_connect_duration(), self._read)) + elif self.total is not None and self.total is not _DEFAULT_TIMEOUT: + return max(0, self.total - self.get_connect_duration()) + else: + return self.resolve_default_timeout(self._read) diff --git a/requests/python/urllib3/util/url.py b/requests/python/urllib3/util/url.py new file mode 100644 index 0000000..d53ea93 --- /dev/null +++ b/requests/python/urllib3/util/url.py @@ -0,0 +1,471 @@ +from __future__ import annotations + +import re +import typing + +from ..exceptions import LocationParseError +from .util import to_str + +# We only want to normalize urls with an HTTP(S) scheme. +# urllib3 infers URLs without a scheme (None) to be http. +_NORMALIZABLE_SCHEMES = ("http", "https", None) + +# Almost all of these patterns were derived from the +# 'rfc3986' module: https://github.com/python-hyper/rfc3986 +_PERCENT_RE = re.compile(r"%[a-fA-F0-9]{2}") +_SCHEME_RE = re.compile(r"^(?:[a-zA-Z][a-zA-Z0-9+-]*:|/)") +_URI_RE = re.compile( + r"^(?:([a-zA-Z][a-zA-Z0-9+.-]*):)?" + r"(?://([^\\/?#]*))?" + r"([^?#]*)" + r"(?:\?([^#]*))?" + r"(?:#(.*))?$", + re.UNICODE | re.DOTALL, +) + +_IPV4_PAT = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" +_HEX_PAT = "[0-9A-Fa-f]{1,4}" +_LS32_PAT = "(?:{hex}:{hex}|{ipv4})".format(hex=_HEX_PAT, ipv4=_IPV4_PAT) +_subs = {"hex": _HEX_PAT, "ls32": _LS32_PAT} +_variations = [ + # 6( h16 ":" ) ls32 + "(?:%(hex)s:){6}%(ls32)s", + # "::" 5( h16 ":" ) ls32 + "::(?:%(hex)s:){5}%(ls32)s", + # [ h16 ] "::" 4( h16 ":" ) ls32 + "(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)s", + # [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + "(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)s", + # [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + "(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)s", + # [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + "(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)s", + # [ *4( h16 ":" ) h16 ] "::" ls32 + "(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)s", + # [ *5( h16 ":" ) h16 ] "::" h16 + "(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)s", + # [ *6( h16 ":" ) h16 ] "::" + "(?:(?:%(hex)s:){0,6}%(hex)s)?::", +] + +_UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~" +_IPV6_PAT = "(?:" + "|".join([x % _subs for x in _variations]) + ")" +_ZONE_ID_PAT = "(?:%25|%)(?:[" + _UNRESERVED_PAT + "]|%[a-fA-F0-9]{2})+" +_IPV6_ADDRZ_PAT = r"\[" + _IPV6_PAT + r"(?:" + _ZONE_ID_PAT + r")?\]" +_REG_NAME_PAT = r"(?:[^\[\]%:/?#]|%[a-fA-F0-9]{2})*" +_TARGET_RE = re.compile(r"^(/[^?#]*)(?:\?([^#]*))?(?:#.*)?$") + +_IPV4_RE = re.compile("^" + _IPV4_PAT + "$") +_IPV6_RE = re.compile("^" + _IPV6_PAT + "$") +_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT + "$") +_BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + _IPV6_ADDRZ_PAT[2:-2] + "$") +_ZONE_ID_RE = re.compile("(" + _ZONE_ID_PAT + r")\]$") + +_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|[1-9][0-9]{0,4}))?$") % ( + _REG_NAME_PAT, + _IPV4_PAT, + _IPV6_ADDRZ_PAT, +) +_HOST_PORT_RE = re.compile(_HOST_PORT_PAT, re.UNICODE | re.DOTALL) + +_UNRESERVED_CHARS = set( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~" +) +_SUB_DELIM_CHARS = set("!$&'()*+,;=") +_USERINFO_CHARS = _UNRESERVED_CHARS | _SUB_DELIM_CHARS | {":"} +_PATH_CHARS = _USERINFO_CHARS | {"@", "/"} +_QUERY_CHARS = _FRAGMENT_CHARS = _PATH_CHARS | {"?"} + + +class Url( + typing.NamedTuple( + "Url", + [ + ("scheme", typing.Optional[str]), + ("auth", typing.Optional[str]), + ("host", typing.Optional[str]), + ("port", typing.Optional[int]), + ("path", typing.Optional[str]), + ("query", typing.Optional[str]), + ("fragment", typing.Optional[str]), + ], + ) +): + """ + Data structure for representing an HTTP URL. Used as a return value for + :func:`parse_url`. Both the scheme and host are normalized as they are + both case-insensitive according to RFC 3986. + """ + + def __new__( # type: ignore[no-untyped-def] + cls, + scheme: str | None = None, + auth: str | None = None, + host: str | None = None, + port: int | None = None, + path: str | None = None, + query: str | None = None, + fragment: str | None = None, + ): + if path and not path.startswith("/"): + path = "/" + path + if scheme is not None: + scheme = scheme.lower() + return super().__new__(cls, scheme, auth, host, port, path, query, fragment) + + @property + def hostname(self) -> str | None: + """For backwards-compatibility with urlparse. We're nice like that.""" + return self.host + + @property + def request_uri(self) -> str: + """Absolute path including the query string.""" + uri = self.path or "/" + + if self.query is not None: + uri += "?" + self.query + + return uri + + @property + def authority(self) -> str | None: + """ + Authority component as defined in RFC 3986 3.2. + This includes userinfo (auth), host and port. + + i.e. + userinfo@host:port + """ + userinfo = self.auth + netloc = self.netloc + if netloc is None or userinfo is None: + return netloc + else: + return f"{userinfo}@{netloc}" + + @property + def netloc(self) -> str | None: + """ + Network location including host and port. + + If you need the equivalent of urllib.parse's ``netloc``, + use the ``authority`` property instead. + """ + if self.host is None: + return None + if self.port: + return f"{self.host}:{self.port}" + return self.host + + @property + def url(self) -> str: + """ + Convert self into a url + + This function should more or less round-trip with :func:`.parse_url`. The + returned url may not be exactly the same as the url inputted to + :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls + with a blank port will have : removed). + + Example: + + .. code-block:: python + + import urllib3 + + U = urllib3.util.parse_url("https://google.com/mail/") + + print(U.url) + # "https://google.com/mail/" + + print( urllib3.util.Url("https", "username:password", + "host.com", 80, "/path", "query", "fragment" + ).url + ) + # "https://username:password@host.com:80/path?query#fragment" + """ + scheme, auth, host, port, path, query, fragment = self + url = "" + + # We use "is not None" we want things to happen with empty strings (or 0 port) + if scheme is not None: + url += scheme + "://" + if auth is not None: + url += auth + "@" + if host is not None: + url += host + if port is not None: + url += ":" + str(port) + if path is not None: + url += path + if query is not None: + url += "?" + query + if fragment is not None: + url += "#" + fragment + + return url + + def __str__(self) -> str: + return self.url + + +@typing.overload +def _encode_invalid_chars( + component: str, allowed_chars: typing.Container[str] +) -> str: # Abstract + ... + + +@typing.overload +def _encode_invalid_chars( + component: None, allowed_chars: typing.Container[str] +) -> None: # Abstract + ... + + +def _encode_invalid_chars( + component: str | None, allowed_chars: typing.Container[str] +) -> str | None: + """Percent-encodes a URI component without reapplying + onto an already percent-encoded component. + """ + if component is None: + return component + + component = to_str(component) + + # Normalize existing percent-encoded bytes. + # Try to see if the component we're encoding is already percent-encoded + # so we can skip all '%' characters but still encode all others. + component, percent_encodings = _PERCENT_RE.subn( + lambda match: match.group(0).upper(), component + ) + + uri_bytes = component.encode("utf-8", "surrogatepass") + is_percent_encoded = percent_encodings == uri_bytes.count(b"%") + encoded_component = bytearray() + + for i in range(0, len(uri_bytes)): + # Will return a single character bytestring + byte = uri_bytes[i : i + 1] + byte_ord = ord(byte) + if (is_percent_encoded and byte == b"%") or ( + byte_ord < 128 and byte.decode() in allowed_chars + ): + encoded_component += byte + continue + encoded_component.extend(b"%" + (hex(byte_ord)[2:].encode().zfill(2).upper())) + + return encoded_component.decode() + + +def _remove_path_dot_segments(path: str) -> str: + # See http://tools.ietf.org/html/rfc3986#section-5.2.4 for pseudo-code + segments = path.split("/") # Turn the path into a list of segments + output = [] # Initialize the variable to use to store output + + for segment in segments: + # '.' is the current directory, so ignore it, it is superfluous + if segment == ".": + continue + # Anything other than '..', should be appended to the output + if segment != "..": + output.append(segment) + # In this case segment == '..', if we can, we should pop the last + # element + elif output: + output.pop() + + # If the path starts with '/' and the output is empty or the first string + # is non-empty + if path.startswith("/") and (not output or output[0]): + output.insert(0, "") + + # If the path starts with '/.' or '/..' ensure we add one more empty + # string to add a trailing '/' + if path.endswith(("/.", "/..")): + output.append("") + + return "/".join(output) + + +@typing.overload +def _normalize_host(host: None, scheme: str | None) -> None: + ... + + +@typing.overload +def _normalize_host(host: str, scheme: str | None) -> str: + ... + + +def _normalize_host(host: str | None, scheme: str | None) -> str | None: + if host: + if scheme in _NORMALIZABLE_SCHEMES: + is_ipv6 = _IPV6_ADDRZ_RE.match(host) + if is_ipv6: + # IPv6 hosts of the form 'a::b%zone' are encoded in a URL as + # such per RFC 6874: 'a::b%25zone'. Unquote the ZoneID + # separator as necessary to return a valid RFC 4007 scoped IP. + match = _ZONE_ID_RE.search(host) + if match: + start, end = match.span(1) + zone_id = host[start:end] + + if zone_id.startswith("%25") and zone_id != "%25": + zone_id = zone_id[3:] + else: + zone_id = zone_id[1:] + zone_id = _encode_invalid_chars(zone_id, _UNRESERVED_CHARS) + return f"{host[:start].lower()}%{zone_id}{host[end:]}" + else: + return host.lower() + elif not _IPV4_RE.match(host): + return to_str( + b".".join([_idna_encode(label) for label in host.split(".")]), + "ascii", + ) + return host + + +def _idna_encode(name: str) -> bytes: + if not name.isascii(): + try: + import idna + except ImportError: + raise LocationParseError( + "Unable to parse URL without the 'idna' module" + ) from None + + try: + return idna.encode(name.lower(), strict=True, std3_rules=True) + except idna.IDNAError: + raise LocationParseError( + f"Name '{name}' is not a valid IDNA label" + ) from None + + return name.lower().encode("ascii") + + +def _encode_target(target: str) -> str: + """Percent-encodes a request target so that there are no invalid characters + + Pre-condition for this function is that 'target' must start with '/'. + If that is the case then _TARGET_RE will always produce a match. + """ + match = _TARGET_RE.match(target) + if not match: # Defensive: + raise LocationParseError(f"{target!r} is not a valid request URI") + + path, query = match.groups() + encoded_target = _encode_invalid_chars(path, _PATH_CHARS) + if query is not None: + query = _encode_invalid_chars(query, _QUERY_CHARS) + encoded_target += "?" + query + return encoded_target + + +def parse_url(url: str) -> Url: + """ + Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is + performed to parse incomplete urls. Fields not provided will be None. + This parser is RFC 3986 and RFC 6874 compliant. + + The parser logic and helper functions are based heavily on + work done in the ``rfc3986`` module. + + :param str url: URL to parse into a :class:`.Url` namedtuple. + + Partly backwards-compatible with :mod:`urllib.parse`. + + Example: + + .. code-block:: python + + import urllib3 + + print( urllib3.util.parse_url('http://google.com/mail/')) + # Url(scheme='http', host='google.com', port=None, path='/mail/', ...) + + print( urllib3.util.parse_url('google.com:80')) + # Url(scheme=None, host='google.com', port=80, path=None, ...) + + print( urllib3.util.parse_url('/foo?bar')) + # Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...) + """ + if not url: + # Empty + return Url() + + source_url = url + if not _SCHEME_RE.search(url): + url = "//" + url + + scheme: str | None + authority: str | None + auth: str | None + host: str | None + port: str | None + port_int: int | None + path: str | None + query: str | None + fragment: str | None + + try: + scheme, authority, path, query, fragment = _URI_RE.match(url).groups() # type: ignore[union-attr] + normalize_uri = scheme is None or scheme.lower() in _NORMALIZABLE_SCHEMES + + if scheme: + scheme = scheme.lower() + + if authority: + auth, _, host_port = authority.rpartition("@") + auth = auth or None + host, port = _HOST_PORT_RE.match(host_port).groups() # type: ignore[union-attr] + if auth and normalize_uri: + auth = _encode_invalid_chars(auth, _USERINFO_CHARS) + if port == "": + port = None + else: + auth, host, port = None, None, None + + if port is not None: + port_int = int(port) + if not (0 <= port_int <= 65535): + raise LocationParseError(url) + else: + port_int = None + + host = _normalize_host(host, scheme) + + if normalize_uri and path: + path = _remove_path_dot_segments(path) + path = _encode_invalid_chars(path, _PATH_CHARS) + if normalize_uri and query: + query = _encode_invalid_chars(query, _QUERY_CHARS) + if normalize_uri and fragment: + fragment = _encode_invalid_chars(fragment, _FRAGMENT_CHARS) + + except (ValueError, AttributeError) as e: + raise LocationParseError(source_url) from e + + # For the sake of backwards compatibility we put empty + # string values for path if there are any defined values + # beyond the path in the URL. + # TODO: Remove this when we break backwards compatibility. + if not path: + if query is not None or fragment is not None: + path = "" + else: + path = None + + return Url( + scheme=scheme, + auth=auth, + host=host, + port=port_int, + path=path, + query=query, + fragment=fragment, + ) diff --git a/requests/python/urllib3/util/util.py b/requests/python/urllib3/util/util.py new file mode 100644 index 0000000..35c77e4 --- /dev/null +++ b/requests/python/urllib3/util/util.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +import typing +from types import TracebackType + + +def to_bytes( + x: str | bytes, encoding: str | None = None, errors: str | None = None +) -> bytes: + if isinstance(x, bytes): + return x + elif not isinstance(x, str): + raise TypeError(f"not expecting type {type(x).__name__}") + if encoding or errors: + return x.encode(encoding or "utf-8", errors=errors or "strict") + return x.encode() + + +def to_str( + x: str | bytes, encoding: str | None = None, errors: str | None = None +) -> str: + if isinstance(x, str): + return x + elif not isinstance(x, bytes): + raise TypeError(f"not expecting type {type(x).__name__}") + if encoding or errors: + return x.decode(encoding or "utf-8", errors=errors or "strict") + return x.decode() + + +def reraise( + tp: type[BaseException] | None, + value: BaseException, + tb: TracebackType | None = None, +) -> typing.NoReturn: + try: + if value.__traceback__ is not tb: + raise value.with_traceback(tb) + raise value + finally: + value = None # type: ignore[assignment] + tb = None diff --git a/requests/python/urllib3/util/wait.py b/requests/python/urllib3/util/wait.py new file mode 100644 index 0000000..aeca0c7 --- /dev/null +++ b/requests/python/urllib3/util/wait.py @@ -0,0 +1,124 @@ +from __future__ import annotations + +import select +import socket +from functools import partial + +__all__ = ["wait_for_read", "wait_for_write"] + + +# How should we wait on sockets? +# +# There are two types of APIs you can use for waiting on sockets: the fancy +# modern stateful APIs like epoll/kqueue, and the older stateless APIs like +# select/poll. The stateful APIs are more efficient when you have a lots of +# sockets to keep track of, because you can set them up once and then use them +# lots of times. But we only ever want to wait on a single socket at a time +# and don't want to keep track of state, so the stateless APIs are actually +# more efficient. So we want to use select() or poll(). +# +# Now, how do we choose between select() and poll()? On traditional Unixes, +# select() has a strange calling convention that makes it slow, or fail +# altogether, for high-numbered file descriptors. The point of poll() is to fix +# that, so on Unixes, we prefer poll(). +# +# On Windows, there is no poll() (or at least Python doesn't provide a wrapper +# for it), but that's OK, because on Windows, select() doesn't have this +# strange calling convention; plain select() works fine. +# +# So: on Windows we use select(), and everywhere else we use poll(). We also +# fall back to select() in case poll() is somehow broken or missing. + + +def select_wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + if not read and not write: + raise RuntimeError("must specify at least one of read=True, write=True") + rcheck = [] + wcheck = [] + if read: + rcheck.append(sock) + if write: + wcheck.append(sock) + # When doing a non-blocking connect, most systems signal success by + # marking the socket writable. Windows, though, signals success by marked + # it as "exceptional". We paper over the difference by checking the write + # sockets for both conditions. (The stdlib selectors module does the same + # thing.) + fn = partial(select.select, rcheck, wcheck, wcheck) + rready, wready, xready = fn(timeout) + return bool(rready or wready or xready) + + +def poll_wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + if not read and not write: + raise RuntimeError("must specify at least one of read=True, write=True") + mask = 0 + if read: + mask |= select.POLLIN + if write: + mask |= select.POLLOUT + poll_obj = select.poll() + poll_obj.register(sock, mask) + + # For some reason, poll() takes timeout in milliseconds + def do_poll(t: float | None) -> list[tuple[int, int]]: + if t is not None: + t *= 1000 + return poll_obj.poll(t) + + return bool(do_poll(timeout)) + + +def _have_working_poll() -> bool: + # Apparently some systems have a select.poll that fails as soon as you try + # to use it, either due to strange configuration or broken monkeypatching + # from libraries like eventlet/greenlet. + try: + poll_obj = select.poll() + poll_obj.poll(0) + except (AttributeError, OSError): + return False + else: + return True + + +def wait_for_socket( + sock: socket.socket, + read: bool = False, + write: bool = False, + timeout: float | None = None, +) -> bool: + # We delay choosing which implementation to use until the first time we're + # called. We could do it at import time, but then we might make the wrong + # decision if someone goes wild with monkeypatching select.poll after + # we're imported. + global wait_for_socket + if _have_working_poll(): + wait_for_socket = poll_wait_for_socket + elif hasattr(select, "select"): + wait_for_socket = select_wait_for_socket + return wait_for_socket(sock, read, write, timeout) + + +def wait_for_read(sock: socket.socket, timeout: float | None = None) -> bool: + """Waits for reading to be available on a given socket. + Returns True if the socket is readable, or False if the timeout expired. + """ + return wait_for_socket(sock, read=True, timeout=timeout) + + +def wait_for_write(sock: socket.socket, timeout: float | None = None) -> bool: + """Waits for writing to be available on a given socket. + Returns True if the socket is readable, or False if the timeout expired. + """ + return wait_for_socket(sock, write=True, timeout=timeout) diff --git a/requests/requests.zip b/requests/requests.zip new file mode 100644 index 0000000..1de6d7c Binary files /dev/null and b/requests/requests.zip differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..576e36e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +boto3 +click==8.1.3 +Requests==2.31.0 +Shapely==2.0.1 +tb_rest_client==3.5 +xlsxwriter==3.1.2 diff --git a/shapely/.DS_Store b/shapely/.DS_Store new file mode 100644 index 0000000..4588261 Binary files /dev/null and b/shapely/.DS_Store differ diff --git a/shapely/python/.DS_Store b/shapely/python/.DS_Store new file mode 100644 index 0000000..c8b696d Binary files /dev/null and b/shapely/python/.DS_Store differ diff --git a/shapely/python/bin/f2py b/shapely/python/bin/f2py new file mode 100755 index 0000000..8133eea --- /dev/null +++ b/shapely/python/bin/f2py @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/shapely/python/bin/f2py3 b/shapely/python/bin/f2py3 new file mode 100755 index 0000000..8133eea --- /dev/null +++ b/shapely/python/bin/f2py3 @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/shapely/python/bin/f2py3.11 b/shapely/python/bin/f2py3.11 new file mode 100755 index 0000000..8133eea --- /dev/null +++ b/shapely/python/bin/f2py3.11 @@ -0,0 +1,8 @@ +#!/var/lang/bin/python3.11 +# -*- coding: utf-8 -*- +import re +import sys +from numpy.f2py.f2py2e import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/shapely/python/shapely.libs/libgeos-ee7a1634.so.3.11.1 b/shapely/python/shapely.libs/libgeos-ee7a1634.so.3.11.1 new file mode 100755 index 0000000..43b8646 Binary files /dev/null and b/shapely/python/shapely.libs/libgeos-ee7a1634.so.3.11.1 differ diff --git a/shapely/python/shapely.libs/libgeos_c-5ef8a841.so.1.17.1 b/shapely/python/shapely.libs/libgeos_c-5ef8a841.so.1.17.1 new file mode 100755 index 0000000..6a848df Binary files /dev/null and b/shapely/python/shapely.libs/libgeos_c-5ef8a841.so.1.17.1 differ diff --git a/shapely/python/shapely/.DS_Store b/shapely/python/shapely/.DS_Store new file mode 100644 index 0000000..c3b716b Binary files /dev/null and b/shapely/python/shapely/.DS_Store differ diff --git a/shapely/python/shapely/__init__.py b/shapely/python/shapely/__init__.py new file mode 100644 index 0000000..5341ddf --- /dev/null +++ b/shapely/python/shapely/__init__.py @@ -0,0 +1,33 @@ +from .lib import GEOSException # NOQA +from .lib import Geometry # NOQA +from .lib import geos_version, geos_version_string # NOQA +from .lib import geos_capi_version, geos_capi_version_string # NOQA +from .errors import setup_signal_checks # NOQA +from ._geometry import * # NOQA +from .creation import * # NOQA +from .constructive import * # NOQA +from .predicates import * # NOQA +from .measurement import * # NOQA +from .set_operations import * # NOQA +from .linear import * # NOQA +from .coordinates import * # NOQA +from .strtree import * # NOQA +from .io import * # NOQA + +# Submodule always needs to be imported to ensure Geometry subclasses are registered +from shapely.geometry import ( # NOQA + Point, + LineString, + Polygon, + MultiPoint, + MultiLineString, + MultiPolygon, + GeometryCollection, + LinearRing, +) + +from . import _version + +__version__ = _version.get_versions()["version"] + +setup_signal_checks() diff --git a/shapely/python/shapely/__pycache__/__init__.cpython-311.pyc b/shapely/python/shapely/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..5c062bf Binary files /dev/null and b/shapely/python/shapely/__pycache__/__init__.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/_enum.cpython-311.pyc b/shapely/python/shapely/__pycache__/_enum.cpython-311.pyc new file mode 100644 index 0000000..38059d3 Binary files /dev/null and b/shapely/python/shapely/__pycache__/_enum.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/_geometry.cpython-311.pyc b/shapely/python/shapely/__pycache__/_geometry.cpython-311.pyc new file mode 100644 index 0000000..3cfa625 Binary files /dev/null and b/shapely/python/shapely/__pycache__/_geometry.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/_ragged_array.cpython-311.pyc b/shapely/python/shapely/__pycache__/_ragged_array.cpython-311.pyc new file mode 100644 index 0000000..6440efb Binary files /dev/null and b/shapely/python/shapely/__pycache__/_ragged_array.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/_version.cpython-311.pyc b/shapely/python/shapely/__pycache__/_version.cpython-311.pyc new file mode 100644 index 0000000..35df216 Binary files /dev/null and b/shapely/python/shapely/__pycache__/_version.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/affinity.cpython-311.pyc b/shapely/python/shapely/__pycache__/affinity.cpython-311.pyc new file mode 100644 index 0000000..515972b Binary files /dev/null and b/shapely/python/shapely/__pycache__/affinity.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/constructive.cpython-311.pyc b/shapely/python/shapely/__pycache__/constructive.cpython-311.pyc new file mode 100644 index 0000000..d9f799e Binary files /dev/null and b/shapely/python/shapely/__pycache__/constructive.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/coordinates.cpython-311.pyc b/shapely/python/shapely/__pycache__/coordinates.cpython-311.pyc new file mode 100644 index 0000000..53a6c8b Binary files /dev/null and b/shapely/python/shapely/__pycache__/coordinates.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/coords.cpython-311.pyc b/shapely/python/shapely/__pycache__/coords.cpython-311.pyc new file mode 100644 index 0000000..f518bc6 Binary files /dev/null and b/shapely/python/shapely/__pycache__/coords.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/creation.cpython-311.pyc b/shapely/python/shapely/__pycache__/creation.cpython-311.pyc new file mode 100644 index 0000000..ac4b357 Binary files /dev/null and b/shapely/python/shapely/__pycache__/creation.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/decorators.cpython-311.pyc b/shapely/python/shapely/__pycache__/decorators.cpython-311.pyc new file mode 100644 index 0000000..783ca97 Binary files /dev/null and b/shapely/python/shapely/__pycache__/decorators.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/errors.cpython-311.pyc b/shapely/python/shapely/__pycache__/errors.cpython-311.pyc new file mode 100644 index 0000000..b9cf7f8 Binary files /dev/null and b/shapely/python/shapely/__pycache__/errors.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/geos.cpython-311.pyc b/shapely/python/shapely/__pycache__/geos.cpython-311.pyc new file mode 100644 index 0000000..50b458d Binary files /dev/null and b/shapely/python/shapely/__pycache__/geos.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/io.cpython-311.pyc b/shapely/python/shapely/__pycache__/io.cpython-311.pyc new file mode 100644 index 0000000..6c84e63 Binary files /dev/null and b/shapely/python/shapely/__pycache__/io.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/linear.cpython-311.pyc b/shapely/python/shapely/__pycache__/linear.cpython-311.pyc new file mode 100644 index 0000000..6e34e08 Binary files /dev/null and b/shapely/python/shapely/__pycache__/linear.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/measurement.cpython-311.pyc b/shapely/python/shapely/__pycache__/measurement.cpython-311.pyc new file mode 100644 index 0000000..6428206 Binary files /dev/null and b/shapely/python/shapely/__pycache__/measurement.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/ops.cpython-311.pyc b/shapely/python/shapely/__pycache__/ops.cpython-311.pyc new file mode 100644 index 0000000..66541a9 Binary files /dev/null and b/shapely/python/shapely/__pycache__/ops.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/plotting.cpython-311.pyc b/shapely/python/shapely/__pycache__/plotting.cpython-311.pyc new file mode 100644 index 0000000..2b6d594 Binary files /dev/null and b/shapely/python/shapely/__pycache__/plotting.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/predicates.cpython-311.pyc b/shapely/python/shapely/__pycache__/predicates.cpython-311.pyc new file mode 100644 index 0000000..1fd02c8 Binary files /dev/null and b/shapely/python/shapely/__pycache__/predicates.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/prepared.cpython-311.pyc b/shapely/python/shapely/__pycache__/prepared.cpython-311.pyc new file mode 100644 index 0000000..beb0d91 Binary files /dev/null and b/shapely/python/shapely/__pycache__/prepared.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/set_operations.cpython-311.pyc b/shapely/python/shapely/__pycache__/set_operations.cpython-311.pyc new file mode 100644 index 0000000..7e2f63a Binary files /dev/null and b/shapely/python/shapely/__pycache__/set_operations.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/speedups.cpython-311.pyc b/shapely/python/shapely/__pycache__/speedups.cpython-311.pyc new file mode 100644 index 0000000..9557d09 Binary files /dev/null and b/shapely/python/shapely/__pycache__/speedups.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/strtree.cpython-311.pyc b/shapely/python/shapely/__pycache__/strtree.cpython-311.pyc new file mode 100644 index 0000000..0a37ea1 Binary files /dev/null and b/shapely/python/shapely/__pycache__/strtree.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/testing.cpython-311.pyc b/shapely/python/shapely/__pycache__/testing.cpython-311.pyc new file mode 100644 index 0000000..ebc31b9 Binary files /dev/null and b/shapely/python/shapely/__pycache__/testing.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/validation.cpython-311.pyc b/shapely/python/shapely/__pycache__/validation.cpython-311.pyc new file mode 100644 index 0000000..2031395 Binary files /dev/null and b/shapely/python/shapely/__pycache__/validation.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/wkb.cpython-311.pyc b/shapely/python/shapely/__pycache__/wkb.cpython-311.pyc new file mode 100644 index 0000000..a43a142 Binary files /dev/null and b/shapely/python/shapely/__pycache__/wkb.cpython-311.pyc differ diff --git a/shapely/python/shapely/__pycache__/wkt.cpython-311.pyc b/shapely/python/shapely/__pycache__/wkt.cpython-311.pyc new file mode 100644 index 0000000..064341f Binary files /dev/null and b/shapely/python/shapely/__pycache__/wkt.cpython-311.pyc differ diff --git a/shapely/python/shapely/_enum.py b/shapely/python/shapely/_enum.py new file mode 100644 index 0000000..c5cdb5a --- /dev/null +++ b/shapely/python/shapely/_enum.py @@ -0,0 +1,23 @@ +from enum import IntEnum + + +class ParamEnum(IntEnum): + """Wraps IntEnum to provide validation of a requested item. + + Intended for enums used for function parameters. + + Use enum.get_value(item) for this behavior instead of builtin enum[item]. + """ + + @classmethod + def get_value(cls, item): + """Validate incoming item and raise a ValueError with valid options if not present.""" + try: + return cls[item].value + except KeyError: + valid_options = {e.name for e in cls} + raise ValueError( + "'{}' is not a valid option, must be one of '{}'".format( + item, "', '".join(valid_options) + ) + ) diff --git a/shapely/python/shapely/_geometry.py b/shapely/python/shapely/_geometry.py new file mode 100644 index 0000000..50f7efa --- /dev/null +++ b/shapely/python/shapely/_geometry.py @@ -0,0 +1,886 @@ +import warnings +from enum import IntEnum + +import numpy as np + +from . import _geometry_helpers, geos_version, lib +from ._enum import ParamEnum +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "GeometryType", + "get_type_id", + "get_dimensions", + "get_coordinate_dimension", + "get_num_coordinates", + "get_srid", + "set_srid", + "get_x", + "get_y", + "get_z", + "get_exterior_ring", + "get_num_points", + "get_num_interior_rings", + "get_num_geometries", + "get_point", + "get_interior_ring", + "get_geometry", + "get_parts", + "get_rings", + "get_precision", + "set_precision", + "force_2d", + "force_3d", +] + + +class GeometryType(IntEnum): + """The enumeration of GEOS geometry types""" + + MISSING = -1 + POINT = 0 + LINESTRING = 1 + LINEARRING = 2 + POLYGON = 3 + MULTIPOINT = 4 + MULTILINESTRING = 5 + MULTIPOLYGON = 6 + GEOMETRYCOLLECTION = 7 + + +# generic + + +@multithreading_enabled +def get_type_id(geometry, **kwargs): + """Returns the type ID of a geometry. + + - None (missing) is -1 + - POINT is 0 + - LINESTRING is 1 + - LINEARRING is 2 + - POLYGON is 3 + - MULTIPOINT is 4 + - MULTILINESTRING is 5 + - MULTIPOLYGON is 6 + - GEOMETRYCOLLECTION is 7 + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + GeometryType + + Examples + -------- + >>> from shapely import LineString, Point + >>> get_type_id(LineString([(0, 0), (1, 1), (2, 2), (3, 3)])) + 1 + >>> get_type_id([Point(1, 2), Point(2, 3)]).tolist() + [0, 0] + """ + return lib.get_type_id(geometry, **kwargs) + + +@multithreading_enabled +def get_dimensions(geometry, **kwargs): + """Returns the inherent dimensionality of a geometry. + + The inherent dimension is 0 for points, 1 for linestrings and linearrings, + and 2 for polygons. For geometrycollections it is the max of the containing + elements. Empty collections and None values return -1. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, Point, Polygon + >>> point = Point(0, 0) + >>> get_dimensions(point) + 0 + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> get_dimensions(polygon) + 2 + >>> get_dimensions(GeometryCollection([point, polygon])) + 2 + >>> get_dimensions(GeometryCollection([])) + -1 + >>> get_dimensions(None) + -1 + """ + return lib.get_dimensions(geometry, **kwargs) + + +@multithreading_enabled +def get_coordinate_dimension(geometry, **kwargs): + """Returns the dimensionality of the coordinates in a geometry (2 or 3). + + Returns -1 for missing geometries (``None`` values). Note that if the first Z + coordinate equals ``nan``, this function will return ``2``. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> get_coordinate_dimension(Point(0, 0)) + 2 + >>> get_coordinate_dimension(Point(0, 0, 1)) + 3 + >>> get_coordinate_dimension(None) + -1 + >>> get_coordinate_dimension(Point(0, 0, float("nan"))) + 2 + """ + return lib.get_coordinate_dimension(geometry, **kwargs) + + +@multithreading_enabled +def get_num_coordinates(geometry, **kwargs): + """Returns the total number of coordinates in a geometry. + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Point + >>> point = Point(0, 0) + >>> get_num_coordinates(point) + 1 + >>> get_num_coordinates(Point(0, 0, 0)) + 1 + >>> line = LineString([(0, 0), (1, 1)]) + >>> get_num_coordinates(line) + 2 + >>> get_num_coordinates(GeometryCollection([point, line])) + 3 + >>> get_num_coordinates(None) + 0 + """ + return lib.get_num_coordinates(geometry, **kwargs) + + +@multithreading_enabled +def get_srid(geometry, **kwargs): + """Returns the SRID of a geometry. + + Returns -1 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + set_srid + + Examples + -------- + >>> from shapely import Point + >>> point = Point(0, 0) + >>> get_srid(point) + 0 + >>> with_srid = set_srid(point, 4326) + >>> get_srid(with_srid) + 4326 + """ + return lib.get_srid(geometry, **kwargs) + + +@multithreading_enabled +def set_srid(geometry, srid, **kwargs): + """Returns a geometry with its SRID set. + + Parameters + ---------- + geometry : Geometry or array_like + srid : int + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_srid + + Examples + -------- + >>> from shapely import Point + >>> point = Point(0, 0) + >>> get_srid(point) + 0 + >>> with_srid = set_srid(point, 4326) + >>> get_srid(with_srid) + 4326 + """ + return lib.set_srid(geometry, np.intc(srid), **kwargs) + + +# points + + +@multithreading_enabled +def get_x(point, **kwargs): + """Returns the x-coordinate of a point + + Parameters + ---------- + point : Geometry or array_like + Non-point geometries will result in NaN being returned. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_y, get_z + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_x(Point(1, 2)) + 1.0 + >>> get_x(MultiPoint([(1, 1), (1, 2)])) + nan + """ + return lib.get_x(point, **kwargs) + + +@multithreading_enabled +def get_y(point, **kwargs): + """Returns the y-coordinate of a point + + Parameters + ---------- + point : Geometry or array_like + Non-point geometries will result in NaN being returned. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_x, get_z + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_y(Point(1, 2)) + 2.0 + >>> get_y(MultiPoint([(1, 1), (1, 2)])) + nan + """ + return lib.get_y(point, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def get_z(point, **kwargs): + """Returns the z-coordinate of a point. + + Parameters + ---------- + point : Geometry or array_like + Non-point geometries or geometries without 3rd dimension will result + in NaN being returned. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_x, get_y + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_z(Point(1, 2, 3)) + 3.0 + >>> get_z(Point(1, 2)) + nan + >>> get_z(MultiPoint([(1, 1, 1), (2, 2, 2)])) + nan + """ + return lib.get_z(point, **kwargs) + + +# linestrings + + +@multithreading_enabled +def get_point(geometry, index, **kwargs): + """Returns the nth point of a linestring or linearring. + + Parameters + ---------- + geometry : Geometry or array_like + index : int or array_like + Negative values count from the end of the linestring backwards. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_num_points + + Examples + -------- + >>> from shapely import LinearRing, LineString, MultiPoint, Point + >>> line = LineString([(0, 0), (1, 1), (2, 2), (3, 3)]) + >>> get_point(line, 1) + + >>> get_point(line, -2) + + >>> get_point(line, [0, 3]).tolist() + [, ] + + The functcion works the same for LinearRing input: + + >>> get_point(LinearRing([(0, 0), (1, 1), (2, 2), (0, 0)]), 1) + + + For non-linear geometries it returns None: + + >>> get_point(MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)]), 1) is None + True + >>> get_point(Point(1, 1), 0) is None + True + """ + return lib.get_point(geometry, np.intc(index), **kwargs) + + +@multithreading_enabled +def get_num_points(geometry, **kwargs): + """Returns number of points in a linestring or linearring. + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + The number of points in geometries other than linestring or linearring + equals zero. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_point + get_num_geometries + + Examples + -------- + >>> from shapely import LineString, MultiPoint + >>> get_num_points(LineString([(0, 0), (1, 1), (2, 2), (3, 3)])) + 4 + >>> get_num_points(MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)])) + 0 + >>> get_num_points(None) + 0 + """ + return lib.get_num_points(geometry, **kwargs) + + +# polygons + + +@multithreading_enabled +def get_exterior_ring(geometry, **kwargs): + """Returns the exterior ring of a polygon. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_interior_ring + + Examples + -------- + >>> from shapely import Point, Polygon + >>> get_exterior_ring(Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])) + + >>> get_exterior_ring(Point(1, 1)) is None + True + """ + return lib.get_exterior_ring(geometry, **kwargs) + + +@multithreading_enabled +def get_interior_ring(geometry, index, **kwargs): + """Returns the nth interior ring of a polygon. + + Parameters + ---------- + geometry : Geometry or array_like + index : int or array_like + Negative values count from the end of the interior rings backwards. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_exterior_ring + get_num_interior_rings + + Examples + -------- + >>> from shapely import Point, Polygon + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> get_interior_ring(polygon_with_hole, 0) + + >>> get_interior_ring(polygon_with_hole, 1) is None + True + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> get_interior_ring(polygon, 0) is None + True + >>> get_interior_ring(Point(0, 0), 0) is None + True + """ + return lib.get_interior_ring(geometry, np.intc(index), **kwargs) + + +@multithreading_enabled +def get_num_interior_rings(geometry, **kwargs): + """Returns number of internal rings in a polygon + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + The number of interior rings in non-polygons equals zero. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_exterior_ring + get_interior_ring + + Examples + -------- + >>> from shapely import Point, Polygon + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> get_num_interior_rings(polygon) + 0 + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> get_num_interior_rings(polygon_with_hole) + 1 + >>> get_num_interior_rings(Point(0, 0)) + 0 + >>> get_num_interior_rings(None) + 0 + """ + return lib.get_num_interior_rings(geometry, **kwargs) + + +# collections + + +@multithreading_enabled +def get_geometry(geometry, index, **kwargs): + """Returns the nth geometry from a collection of geometries. + + Parameters + ---------- + geometry : Geometry or array_like + index : int or array_like + Negative values count from the end of the collection backwards. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Notes + ----- + - simple geometries act as length-1 collections + - out-of-range values return None + + See also + -------- + get_num_geometries, get_parts + + Examples + -------- + >>> from shapely import Point, MultiPoint + >>> multipoint = MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)]) + >>> get_geometry(multipoint, 1) + + >>> get_geometry(multipoint, -1) + + >>> get_geometry(multipoint, 5) is None + True + >>> get_geometry(Point(1, 1), 0) + + >>> get_geometry(Point(1, 1), 1) is None + True + """ + return lib.get_geometry(geometry, np.intc(index), **kwargs) + + +def get_parts(geometry, return_index=False): + """Gets parts of each GeometryCollection or Multi* geometry object; returns + a copy of each geometry in the GeometryCollection or Multi* geometry object. + + Note: This does not return the individual parts of Multi* geometry objects in + a GeometryCollection. You may need to call this function multiple times to + return individual parts of Multi* geometry objects in a GeometryCollection. + + Parameters + ---------- + geometry : Geometry or array_like + return_index : bool, default False + If True, will return a tuple of ndarrays of (parts, indexes), where indexes + are the indexes of the original geometries in the source array. + + Returns + ------- + ndarray of parts or tuple of (parts, indexes) + + See also + -------- + get_geometry, get_rings + + Examples + -------- + >>> from shapely import MultiPoint + >>> get_parts(MultiPoint([(0, 1), (2, 3)])).tolist() + [, ] + >>> parts, index = get_parts([MultiPoint([(0, 1)]), MultiPoint([(4, 5), (6, 7)])], \ +return_index=True) + >>> parts.tolist() + [, , ] + >>> index.tolist() + [0, 1, 1] + """ + geometry = np.asarray(geometry, dtype=np.object_) + geometry = np.atleast_1d(geometry) + + if geometry.ndim != 1: + raise ValueError("Array should be one dimensional") + + if return_index: + return _geometry_helpers.get_parts(geometry) + + return _geometry_helpers.get_parts(geometry)[0] + + +def get_rings(geometry, return_index=False): + """Gets rings of Polygon geometry object. + + For each Polygon, the first returned ring is always the exterior ring + and potential subsequent rings are interior rings. + + If the geometry is not a Polygon, nothing is returned (empty array for + scalar geometry input or no element in output array for array input). + + Parameters + ---------- + geometry : Geometry or array_like + return_index : bool, default False + If True, will return a tuple of ndarrays of (rings, indexes), where + indexes are the indexes of the original geometries in the source array. + + Returns + ------- + ndarray of rings or tuple of (rings, indexes) + + See also + -------- + get_exterior_ring, get_interior_ring, get_parts + + Examples + -------- + >>> from shapely import Polygon + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> get_rings(polygon_with_hole).tolist() + [, + ] + + With ``return_index=True``: + + >>> polygon = Polygon([(0, 0), (2, 0), (2, 2), (0, 2), (0, 0)]) + >>> rings, index = get_rings([polygon, polygon_with_hole], return_index=True) + >>> rings.tolist() + [, + , + ] + >>> index.tolist() + [0, 1, 1] + """ + geometry = np.asarray(geometry, dtype=np.object_) + geometry = np.atleast_1d(geometry) + + if geometry.ndim != 1: + raise ValueError("Array should be one dimensional") + + if return_index: + return _geometry_helpers.get_parts(geometry, extract_rings=True) + + return _geometry_helpers.get_parts(geometry, extract_rings=True)[0] + + +@multithreading_enabled +def get_num_geometries(geometry, **kwargs): + """Returns number of geometries in a collection. + + Returns 0 for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + The number of geometries in points, linestrings, linearrings and + polygons equals one. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_num_points + get_geometry + + Examples + -------- + >>> from shapely import MultiPoint, Point + >>> get_num_geometries(MultiPoint([(0, 0), (1, 1), (2, 2), (3, 3)])) + 4 + >>> get_num_geometries(Point(1, 1)) + 1 + >>> get_num_geometries(None) + 0 + """ + return lib.get_num_geometries(geometry, **kwargs) + + +@requires_geos("3.6.0") +@multithreading_enabled +def get_precision(geometry, **kwargs): + """Get the precision of a geometry. + + If a precision has not been previously set, it will be 0 (double + precision). Otherwise, it will return the precision grid size that was + set on a geometry. + + Returns NaN for not-a-geometry values. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + set_precision + + Examples + -------- + >>> from shapely import Point + >>> point = Point(1, 1) + >>> get_precision(point) + 0.0 + >>> geometry = set_precision(point, 1.0) + >>> get_precision(geometry) + 1.0 + >>> get_precision(None) + nan + """ + return lib.get_precision(geometry, **kwargs) + + +class SetPrecisionMode(ParamEnum): + valid_output = 0 + pointwise = 1 + keep_collapsed = 2 + + +@requires_geos("3.6.0") +@multithreading_enabled +def set_precision(geometry, grid_size, mode="valid_output", **kwargs): + """Returns geometry with the precision set to a precision grid size. + + By default, geometries use double precision coordinates (grid_size = 0). + + Coordinates will be rounded if a precision grid is less precise than the + input geometry. Duplicated vertices will be dropped from lines and + polygons for grid sizes greater than 0. Line and polygon geometries may + collapse to empty geometries if all vertices are closer together than + grid_size. Z values, if present, will not be modified. + + Note: subsequent operations will always be performed in the precision of + the geometry with higher precision (smaller "grid_size"). That same + precision will be attached to the operation outputs. + + Also note: input geometries should be geometrically valid; unexpected + results may occur if input geometries are not. + + Returns None if geometry is None. + + Parameters + ---------- + geometry : Geometry or array_like + grid_size : float + Precision grid size. If 0, will use double precision (will not modify + geometry if precision grid size was not previously set). If this + value is more precise than input geometry, the input geometry will + not be modified. + mode : {'valid_output', 'pointwise', 'keep_collapsed'}, default 'valid_output' + This parameter determines how to handle invalid output geometries. There are three modes: + + 1. `'valid_output'` (default): The output is always valid. Collapsed geometry elements + (including both polygons and lines) are removed. Duplicate vertices are removed. + 2. `'pointwise'`: Precision reduction is performed pointwise. Output geometry + may be invalid due to collapse or self-intersection. Duplicate vertices are not + removed. In GEOS this option is called NO_TOPO. + + .. note:: + + 'pointwise' mode requires at least GEOS 3.10. It is accepted in earlier versions, + but the results may be unexpected. + 3. `'keep_collapsed'`: Like the default mode, except that collapsed linear geometry + elements are preserved. Collapsed polygonal input elements are removed. Duplicate + vertices are removed. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_precision + + Examples + -------- + >>> from shapely import LineString, Point + >>> set_precision(Point(0.9, 0.9), 1.0) + + >>> set_precision(Point(0.9, 0.9, 0.9), 1.0) + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0, 1), (1, 1)]), 1.0) + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0.1, 0.1)]), 1.0, mode="valid_output") + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0.1, 0.1)]), 1.0, mode="pointwise") + + >>> set_precision(LineString([(0, 0), (0, 0.1), (0.1, 0.1)]), 1.0, mode="keep_collapsed") + + >>> set_precision(None, 1.0) is None + True + """ + if isinstance(mode, str): + mode = SetPrecisionMode.get_value(mode) + elif not np.isscalar(mode): + raise TypeError("mode only accepts scalar values") + if mode == SetPrecisionMode.pointwise and geos_version < (3, 10, 0): + warnings.warn( + "'pointwise' is only supported for GEOS 3.10", + UserWarning, + stacklevel=2, + ) + return lib.set_precision(geometry, grid_size, np.intc(mode), **kwargs) + + +@multithreading_enabled +def force_2d(geometry, **kwargs): + """Forces the dimensionality of a geometry to 2D. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon, from_wkt + >>> force_2d(Point(0, 0, 1)) + + >>> force_2d(Point(0, 0)) + + >>> force_2d(LineString([(0, 0, 0), (0, 1, 1), (1, 1, 2)])) + + >>> force_2d(from_wkt("POLYGON Z EMPTY")) + + >>> force_2d(None) is None + True + """ + return lib.force_2d(geometry, **kwargs) + + +@multithreading_enabled +def force_3d(geometry, z=0.0, **kwargs): + """Forces the dimensionality of a geometry to 3D. + + 2D geometries will get the provided Z coordinate; Z coordinates of 3D geometries + are unchanged (unless they are nan). + + Note that for empty geometries, 3D is only supported since GEOS 3.9 and then + still only for simple geometries (non-collections). + + Parameters + ---------- + geometry : Geometry or array_like + z : float or array_like, default 0.0 + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> force_3d(Point(0, 0), z=3) + + >>> force_3d(Point(0, 0, 0), z=3) + + >>> force_3d(LineString([(0, 0), (0, 1), (1, 1)])) + + >>> force_3d(None) is None + True + """ + if np.isnan(z).any(): + raise ValueError("It is not allowed to set the Z coordinate to NaN.") + return lib.force_3d(geometry, z, **kwargs) diff --git a/shapely/python/shapely/_geometry_helpers.cpython-311-x86_64-linux-gnu.so b/shapely/python/shapely/_geometry_helpers.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..1285b17 Binary files /dev/null and b/shapely/python/shapely/_geometry_helpers.cpython-311-x86_64-linux-gnu.so differ diff --git a/shapely/python/shapely/_geos.cpython-311-x86_64-linux-gnu.so b/shapely/python/shapely/_geos.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..5f5494f Binary files /dev/null and b/shapely/python/shapely/_geos.cpython-311-x86_64-linux-gnu.so differ diff --git a/shapely/python/shapely/_geos.pxd b/shapely/python/shapely/_geos.pxd new file mode 100644 index 0000000..0374690 --- /dev/null +++ b/shapely/python/shapely/_geos.pxd @@ -0,0 +1,51 @@ +""" +Provides a wrapper for GEOS types and functions. + +Note: GEOS functions in Cython must be called using the get_geos_handle context manager. +Example: + with get_geos_handle() as geos_handle: + SomeGEOSFunc(geos_handle, ...) +""" + +cdef extern from "geos_c.h": + # Types + ctypedef void *GEOSContextHandle_t + ctypedef struct GEOSGeometry + ctypedef struct GEOSCoordSequence + ctypedef void (*GEOSMessageHandler_r)(const char *message, void *userdata) + + # GEOS Context & Messaging + GEOSContextHandle_t GEOS_init_r() nogil + void GEOS_finish_r(GEOSContextHandle_t handle) nogil + void GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t handle, GEOSMessageHandler_r ef, void* userData) nogil + void GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t handle, GEOSMessageHandler_r nf, void* userData) nogil + + # Geometry functions + const GEOSGeometry* GEOSGetGeometryN_r(GEOSContextHandle_t handle, const GEOSGeometry* g, int n) nogil + const GEOSGeometry* GEOSGetExteriorRing_r(GEOSContextHandle_t handle, const GEOSGeometry* g) nogil + const GEOSGeometry* GEOSGetInteriorRingN_r(GEOSContextHandle_t handle, const GEOSGeometry* g, int n) nogil + int GEOSGeomTypeId_r(GEOSContextHandle_t handle, GEOSGeometry* g) nogil + + # Geometry creation / destruction + GEOSGeometry* GEOSGeom_clone_r(GEOSContextHandle_t handle, const GEOSGeometry* g) nogil + GEOSGeometry* GEOSGeom_createPoint_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + GEOSGeometry* GEOSGeom_createLineString_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + GEOSGeometry* GEOSGeom_createLinearRing_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + GEOSGeometry* GEOSGeom_createEmptyPolygon_r(GEOSContextHandle_t handle) nogil + GEOSGeometry* GEOSGeom_createPolygon_r(GEOSContextHandle_t handle, GEOSGeometry* shell, GEOSGeometry** holes, unsigned int nholes) nogil + GEOSGeometry* GEOSGeom_createCollection_r(GEOSContextHandle_t handle, int type, GEOSGeometry** geoms, unsigned int ngeoms) nogil + void GEOSGeom_destroy_r(GEOSContextHandle_t handle, GEOSGeometry* g) nogil + + # Coordinate sequences + GEOSCoordSequence* GEOSCoordSeq_create_r(GEOSContextHandle_t handle, unsigned int size, unsigned int dims) nogil + void GEOSCoordSeq_destroy_r(GEOSContextHandle_t handle, GEOSCoordSequence* s) nogil + int GEOSCoordSeq_setX_r(GEOSContextHandle_t handle, GEOSCoordSequence* s, unsigned int idx, double val) nogil + int GEOSCoordSeq_setY_r(GEOSContextHandle_t handle, GEOSCoordSequence* s, unsigned int idx, double val) nogil + int GEOSCoordSeq_setZ_r(GEOSContextHandle_t handle, GEOSCoordSequence* s, unsigned int idx, double val) nogil + + +cdef class get_geos_handle: + cdef GEOSContextHandle_t handle + cdef char* last_error + cdef char* last_warning + cdef GEOSContextHandle_t __enter__(self) diff --git a/shapely/python/shapely/_pygeos_api.pxd b/shapely/python/shapely/_pygeos_api.pxd new file mode 100644 index 0000000..d15acdd --- /dev/null +++ b/shapely/python/shapely/_pygeos_api.pxd @@ -0,0 +1,35 @@ +""" +Provides a wrapper for the shapely.lib C API for use in Cython. +Internally, the shapely C extension uses a PyCapsule to provide run-time access +to function pointers within the C API. + +To use these functions, you must first call the following function in each Cython module: +`import_shapely_c_api()` + +This uses a macro to dynamically load the functions from pointers in the PyCapsule. +Each C function in shapely.lib exposed in the C API must be specially-wrapped to enable +this capability. + +Segfaults will occur if the C API is not imported properly. +""" + +cimport numpy as np +from cpython.ref cimport PyObject + +from shapely._geos cimport GEOSContextHandle_t, GEOSCoordSequence, GEOSGeometry + + +cdef extern from "c_api.h": + # shapely.lib C API loader; returns -1 on error + # MUST be called before calling other C API functions + int import_shapely_c_api() except -1 + + # C functions provided by the shapely.lib C API + # Note: GeometryObjects are always managed as Python objects + # in Cython to avoid memory leaks, not PyObject* (even though + # they are declared that way in the header file). + object PyGEOS_CreateGeometry(GEOSGeometry *ptr, GEOSContextHandle_t ctx) + char PyGEOS_GetGEOSGeometry(PyObject *obj, GEOSGeometry **out) nogil + GEOSCoordSequence* PyGEOS_CoordSeq_FromBuffer(GEOSContextHandle_t ctx, const double* buf, + unsigned int size, unsigned int dims, + char ring_closure) nogil diff --git a/shapely/python/shapely/_ragged_array.py b/shapely/python/shapely/_ragged_array.py new file mode 100644 index 0000000..933c47b --- /dev/null +++ b/shapely/python/shapely/_ragged_array.py @@ -0,0 +1,452 @@ +""" +This modules provides a conversion to / from a ragged (or "jagged") array +representation of the geometries. + +A ragged array is an irregular array of arrays of which each element can have +a different length. As a result, such an array cannot be represented as a +standard, rectangular nD array. +The coordinates of geometries can be represented as arrays of arrays of +coordinate pairs (possibly multiple levels of nesting, depending on the +geometry type). + + +Geometries, as a ragged array of coordinates, can be efficiently represented +as contiguous arrays of coordinates provided that there is another data +structure that keeps track of which range of coordinate values corresponds +to a given geometry. This can be done using offsets, counts, or indices. + +This module currently implements offsets into the coordinates array. This +is the ragged array representation defined by the the Apache Arrow project +as "variable size list array" (https://arrow.apache.org/docs/format/Columnar.html#variable-size-list-layout). +See for example https://cfconventions.org/Data/cf-conventions/cf-conventions-1.9/cf-conventions.html#representations-features +for different options. + +The exact usage of the Arrow list array with varying degrees of nesting for the +different geometry types is defined by the GeoArrow project: +https://github.com/geoarrow/geoarrow + +""" +import numpy as np + +from . import creation +from ._geometry import ( + GeometryType, + get_coordinate_dimension, + get_parts, + get_rings, + get_type_id, +) +from .coordinates import get_coordinates +from .predicates import is_empty + +__all__ = ["to_ragged_array", "from_ragged_array"] + + +# # GEOS -> coords/offset arrays (to_ragged_array) + + +def _get_arrays_point(arr, include_z): + # only one array of coordinates + coords = get_coordinates(arr, include_z=include_z) + + # empty points are represented by NaNs + empties = is_empty(arr) + if empties.any(): + indices = np.nonzero(empties)[0] + indices = indices - np.arange(len(indices)) + coords = np.insert(coords, indices, np.nan, axis=0) + + return coords, () + + +def _indices_to_offsets(indices, n): + offsets = np.insert(np.bincount(indices).cumsum(), 0, 0) + if len(offsets) != n + 1: + # last geometries might be empty or missing + offsets = np.pad( + offsets, + (0, n + 1 - len(offsets)), + "constant", + constant_values=offsets[-1], + ) + return offsets + + +def _get_arrays_multipoint(arr, include_z): + # explode/flatten the MultiPoints + _, part_indices = get_parts(arr, return_index=True) + # the offsets into the multipoint parts + offsets = _indices_to_offsets(part_indices, len(arr)) + + # only one array of coordinates + coords = get_coordinates(arr, include_z=include_z) + + return coords, (offsets,) + + +def _get_arrays_linestring(arr, include_z): + # the coords and offsets into the coordinates of the linestrings + coords, indices = get_coordinates(arr, return_index=True, include_z=include_z) + offsets = _indices_to_offsets(indices, len(arr)) + + return coords, (offsets,) + + +def _get_arrays_multilinestring(arr, include_z): + # explode/flatten the MultiLineStrings + arr_flat, part_indices = get_parts(arr, return_index=True) + # the offsets into the multilinestring parts + offsets2 = _indices_to_offsets(part_indices, len(arr)) + + # the coords and offsets into the coordinates of the linestrings + coords, indices = get_coordinates(arr_flat, return_index=True, include_z=include_z) + offsets1 = np.insert(np.bincount(indices).cumsum(), 0, 0) + + return coords, (offsets1, offsets2) + + +def _get_arrays_polygon(arr, include_z): + # explode/flatten the Polygons into Rings + arr_flat, ring_indices = get_rings(arr, return_index=True) + # the offsets into the exterior/interior rings of the multipolygon parts + offsets2 = _indices_to_offsets(ring_indices, len(arr)) + + # the coords and offsets into the coordinates of the rings + coords, indices = get_coordinates(arr_flat, return_index=True, include_z=include_z) + offsets1 = np.insert(np.bincount(indices).cumsum(), 0, 0) + + return coords, (offsets1, offsets2) + + +def _get_arrays_multipolygon(arr, include_z): + # explode/flatten the MultiPolygons + arr_flat, part_indices = get_parts(arr, return_index=True) + # the offsets into the multipolygon parts + offsets3 = _indices_to_offsets(part_indices, len(arr)) + + # explode/flatten the Polygons into Rings + arr_flat2, ring_indices = get_rings(arr_flat, return_index=True) + # the offsets into the exterior/interior rings of the multipolygon parts + offsets2 = np.insert(np.bincount(ring_indices).cumsum(), 0, 0) + + # the coords and offsets into the coordinates of the rings + coords, indices = get_coordinates(arr_flat2, return_index=True, include_z=include_z) + offsets1 = np.insert(np.bincount(indices).cumsum(), 0, 0) + + return coords, (offsets1, offsets2, offsets3) + + +def to_ragged_array(geometries, include_z=None): + """ + Converts geometries to a ragged array representation using a contiguous + array of coordinates and offset arrays. + + This function converts an array of geometries to a ragged array + (i.e. irregular array of arrays) of coordinates, represented in memory + using a single contiguous array of the coordinates, and + up to 3 offset arrays that keep track where each sub-array + starts and ends. + + This follows the in-memory layout of the variable size list arrays defined + by Apache Arrow, as specified for geometries by the GeoArrow project: + https://github.com/geoarrow/geoarrow. + + Parameters + ---------- + geometries : array_like + Array of geometries (1-dimensional). + include_z : bool, default None + If False, return 2D geometries. If True, include the third dimension + in the output (if a geometry has no third dimension, the z-coordinates + will be NaN). By default, will infer the dimensionality from the + input geometries. Note that this inference can be unreliable with + empty geometries (for a guaranteed result, it is recommended to + specify the keyword). + + Returns + ------- + tuple of (geometry_type, coords, offsets) + geometry_type : GeometryType + The type of the input geometries (required information for + roundtrip). + coords : np.ndarray + Contiguous array of shape (n, 2) or (n, 3) of all coordinates + of all input geometries. + offsets: tuple of np.ndarray + Offset arrays that make it possible to reconstruct the + geometries from the flat coordinates array. The number of + offset arrays depends on the geometry type. See + https://github.com/geoarrow/geoarrow/blob/main/format.md + for details. + + Notes + ----- + Mixed singular and multi geometry types of the same basic type are + allowed (e.g., Point and MultiPoint) and all singular types will be + treated as multi types. + GeometryCollections and other mixed geometry types are not supported. + + See also + -------- + from_ragged_array + + Examples + -------- + Consider a Polygon with one hole (interior ring): + + >>> import shapely + >>> polygon = shapely.Polygon( + ... [(0, 0), (10, 0), (10, 10), (0, 10)], + ... holes=[[(2, 2), (3, 2), (2, 3)]] + ... ) + >>> polygon + + + This polygon can be thought of as a list of rings (first ring is the + exterior ring, subsequent rings are the interior rings), and each ring + as a list of coordinate pairs. This is very similar to how GeoJSON + represents the coordinates: + + >>> import json + >>> json.loads(shapely.to_geojson(polygon))["coordinates"] + [[[0.0, 0.0], [10.0, 0.0], [10.0, 10.0], [0.0, 10.0], [0.0, 0.0]], + [[2.0, 2.0], [3.0, 2.0], [2.0, 3.0], [2.0, 2.0]]] + + This function will return a similar list of lists of lists, but + using a single contiguous array of coordinates, and multiple arrays of + offsets: + + >>> geometry_type, coords, offsets = shapely.to_ragged_array([polygon]) + >>> geometry_type + + >>> coords + array([[ 0., 0.], + [10., 0.], + [10., 10.], + [ 0., 10.], + [ 0., 0.], + [ 2., 2.], + [ 3., 2.], + [ 2., 3.], + [ 2., 2.]]) + + >>> offsets + (array([0, 5, 9]), array([0, 2])) + + As an example how to interpret the offsets: the i-th ring in the + coordinates is represented by ``offsets[0][i]`` to ``offsets[0][i+1]``: + + >>> exterior_ring_start, exterior_ring_end = offsets[0][0], offsets[0][1] + >>> coords[exterior_ring_start:exterior_ring_end] + array([[ 0., 0.], + [10., 0.], + [10., 10.], + [ 0., 10.], + [ 0., 0.]]) + + """ + geometries = np.asarray(geometries) + if include_z is None: + include_z = np.any( + get_coordinate_dimension(geometries[~is_empty(geometries)]) == 3 + ) + + geom_types = np.unique(get_type_id(geometries)) + # ignore missing values (type of -1) + geom_types = geom_types[geom_types >= 0] + + if len(geom_types) == 1: + typ = GeometryType(geom_types[0]) + if typ == GeometryType.POINT: + coords, offsets = _get_arrays_point(geometries, include_z) + elif typ == GeometryType.LINESTRING: + coords, offsets = _get_arrays_linestring(geometries, include_z) + elif typ == GeometryType.POLYGON: + coords, offsets = _get_arrays_polygon(geometries, include_z) + elif typ == GeometryType.MULTIPOINT: + coords, offsets = _get_arrays_multipoint(geometries, include_z) + elif typ == GeometryType.MULTILINESTRING: + coords, offsets = _get_arrays_multilinestring(geometries, include_z) + elif typ == GeometryType.MULTIPOLYGON: + coords, offsets = _get_arrays_multipolygon(geometries, include_z) + else: + raise ValueError(f"Geometry type {typ.name} is not supported") + + elif len(geom_types) == 2: + if set(geom_types) == {GeometryType.POINT, GeometryType.MULTIPOINT}: + typ = GeometryType.MULTIPOINT + coords, offsets = _get_arrays_multipoint(geometries, include_z) + elif set(geom_types) == {GeometryType.LINESTRING, GeometryType.MULTILINESTRING}: + typ = GeometryType.MULTILINESTRING + coords, offsets = _get_arrays_multilinestring(geometries, include_z) + elif set(geom_types) == {GeometryType.POLYGON, GeometryType.MULTIPOLYGON}: + typ = GeometryType.MULTIPOLYGON + coords, offsets = _get_arrays_multipolygon(geometries, include_z) + else: + raise ValueError( + "Geometry type combination is not supported " + f"({[GeometryType(t).name for t in geom_types]})" + ) + else: + raise ValueError( + "Geometry type combination is not supported " + f"({[GeometryType(t).name for t in geom_types]})" + ) + + return typ, coords, offsets + + +# # coords/offset arrays -> GEOS (from_ragged_array) + + +def _point_from_flatcoords(coords): + result = creation.points(coords) + + # Older versions of GEOS (<= 3.9) don't automatically convert NaNs + # to empty points -> do manually + empties = np.isnan(coords).all(axis=1) + if empties.any(): + result[empties] = creation.empty(1, geom_type=GeometryType.POINT).item() + + return result + + +def _multipoint_from_flatcoords(coords, offsets): + # recreate points + points = creation.points(coords) + + # recreate multipoints + multipoint_parts = np.diff(offsets) + multipoint_indices = np.repeat(np.arange(len(multipoint_parts)), multipoint_parts) + + result = np.empty(len(offsets) - 1, dtype=object) + result = creation.multipoints(points, indices=multipoint_indices, out=result) + result[multipoint_parts == 0] = creation.empty( + 1, geom_type=GeometryType.MULTIPOINT + ).item() + + return result + + +def _linestring_from_flatcoords(coords, offsets): + # recreate linestrings + linestring_n = np.diff(offsets) + linestring_indices = np.repeat(np.arange(len(linestring_n)), linestring_n) + + result = np.empty(len(offsets) - 1, dtype=object) + result = creation.linestrings(coords, indices=linestring_indices, out=result) + result[linestring_n == 0] = creation.empty( + 1, geom_type=GeometryType.LINESTRING + ).item() + return result + + +def _multilinestrings_from_flatcoords(coords, offsets1, offsets2): + # recreate linestrings + linestrings = _linestring_from_flatcoords(coords, offsets1) + + # recreate multilinestrings + multilinestring_parts = np.diff(offsets2) + multilinestring_indices = np.repeat( + np.arange(len(multilinestring_parts)), multilinestring_parts + ) + + result = np.empty(len(offsets2) - 1, dtype=object) + result = creation.multilinestrings( + linestrings, indices=multilinestring_indices, out=result + ) + result[multilinestring_parts == 0] = creation.empty( + 1, geom_type=GeometryType.MULTILINESTRING + ).item() + + return result + + +def _polygon_from_flatcoords(coords, offsets1, offsets2): + # recreate rings + ring_lengths = np.diff(offsets1) + ring_indices = np.repeat(np.arange(len(ring_lengths)), ring_lengths) + rings = creation.linearrings(coords, indices=ring_indices) + + # recreate polygons + polygon_rings_n = np.diff(offsets2) + polygon_indices = np.repeat(np.arange(len(polygon_rings_n)), polygon_rings_n) + result = np.empty(len(offsets2) - 1, dtype=object) + result = creation.polygons(rings, indices=polygon_indices, out=result) + result[polygon_rings_n == 0] = creation.empty( + 1, geom_type=GeometryType.POLYGON + ).item() + + return result + + +def _multipolygons_from_flatcoords(coords, offsets1, offsets2, offsets3): + # recreate polygons + polygons = _polygon_from_flatcoords(coords, offsets1, offsets2) + + # recreate multipolygons + multipolygon_parts = np.diff(offsets3) + multipolygon_indices = np.repeat( + np.arange(len(multipolygon_parts)), multipolygon_parts + ) + result = np.empty(len(offsets3) - 1, dtype=object) + result = creation.multipolygons(polygons, indices=multipolygon_indices, out=result) + result[multipolygon_parts == 0] = creation.empty( + 1, geom_type=GeometryType.MULTIPOLYGON + ).item() + + return result + + +def from_ragged_array(geometry_type, coords, offsets=None): + """ + Creates geometries from a contiguous array of coordinates + and offset arrays. + + This function creates geometries from the ragged array representation + as returned by ``to_ragged_array``. + + This follows the in-memory layout of the variable size list arrays defined + by Apache Arrow, as specified for geometries by the GeoArrow project: + https://github.com/geoarrow/geoarrow. + + See :func:`to_ragged_array` for more details. + + Parameters + ---------- + geometry_type : GeometryType + The type of geometry to create. + coords : np.ndarray + Contiguous array of shape (n, 2) or (n, 3) of all coordinates + for the geometries. + offsets: tuple of np.ndarray + Offset arrays that allow to reconstruct the geometries based on the + flat coordinates array. The number of offset arrays depends on the + geometry type. See + https://github.com/geoarrow/geoarrow/blob/main/format.md for details. + + Returns + ------- + np.ndarray + Array of geometries (1-dimensional). + + See Also + -------- + to_ragged_array + + """ + if geometry_type == GeometryType.POINT: + assert offsets is None or len(offsets) == 0 + return _point_from_flatcoords(coords) + if geometry_type == GeometryType.LINESTRING: + return _linestring_from_flatcoords(coords, *offsets) + if geometry_type == GeometryType.POLYGON: + return _polygon_from_flatcoords(coords, *offsets) + elif geometry_type == GeometryType.MULTIPOINT: + return _multipoint_from_flatcoords(coords, *offsets) + elif geometry_type == GeometryType.MULTILINESTRING: + return _multilinestrings_from_flatcoords(coords, *offsets) + elif geometry_type == GeometryType.MULTIPOLYGON: + return _multipolygons_from_flatcoords(coords, *offsets) + else: + raise ValueError(f"Geometry type {geometry_type.name} is not supported") diff --git a/shapely/python/shapely/_version.py b/shapely/python/shapely/_version.py new file mode 100644 index 0000000..8e42307 --- /dev/null +++ b/shapely/python/shapely/_version.py @@ -0,0 +1,21 @@ + +# This file was generated by 'versioneer.py' (0.28) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. + +import json + +version_json = ''' +{ + "date": "2023-01-30T08:49:38+0100", + "dirty": false, + "error": null, + "full-revisionid": "5f0352897968e82283a61fe6b201df87993628fb", + "version": "2.0.1" +} +''' # END VERSION_JSON + + +def get_versions(): + return json.loads(version_json) diff --git a/shapely/python/shapely/affinity.py b/shapely/python/shapely/affinity.py new file mode 100644 index 0000000..d71caaf --- /dev/null +++ b/shapely/python/shapely/affinity.py @@ -0,0 +1,250 @@ +"""Affine transforms, both in general and specific, named transforms.""" + +from math import cos, pi, sin, tan + +import numpy as np + +import shapely + +__all__ = ["affine_transform", "rotate", "scale", "skew", "translate"] + + +def affine_transform(geom, matrix): + r"""Return a transformed geometry using an affine transformation matrix. + + The coefficient matrix is provided as a list or tuple with 6 or 12 items + for 2D or 3D transformations, respectively. + + For 2D affine transformations, the 6 parameter matrix is:: + + [a, b, d, e, xoff, yoff] + + which represents the augmented matrix:: + + [x'] / a b xoff \ [x] + [y'] = | d e yoff | [y] + [1 ] \ 0 0 1 / [1] + + or the equations for the transformed coordinates:: + + x' = a * x + b * y + xoff + y' = d * x + e * y + yoff + + For 3D affine transformations, the 12 parameter matrix is:: + + [a, b, c, d, e, f, g, h, i, xoff, yoff, zoff] + + which represents the augmented matrix:: + + [x'] / a b c xoff \ [x] + [y'] = | d e f yoff | [y] + [z'] | g h i zoff | [z] + [1 ] \ 0 0 0 1 / [1] + + or the equations for the transformed coordinates:: + + x' = a * x + b * y + c * z + xoff + y' = d * x + e * y + f * z + yoff + z' = g * x + h * y + i * z + zoff + """ + if len(matrix) == 6: + ndim = 2 + a, b, d, e, xoff, yoff = matrix + if geom.has_z: + ndim = 3 + i = 1.0 + c = f = g = h = zoff = 0.0 + elif len(matrix) == 12: + ndim = 3 + a, b, c, d, e, f, g, h, i, xoff, yoff, zoff = matrix + if not geom.has_z: + ndim = 2 + else: + raise ValueError("'matrix' expects either 6 or 12 coefficients") + if ndim == 2: + A = np.array([[a, b], [d, e]], dtype=float) + off = np.array([xoff, yoff], dtype=float) + else: + A = np.array([[a, b, c], [d, e, f], [g, h, i]], dtype=float) + off = np.array([xoff, yoff, zoff], dtype=float) + + def _affine_coords(coords): + return np.matmul(A, coords.T).T + off + + return shapely.transform(geom, _affine_coords, include_z=ndim == 3) + + +def interpret_origin(geom, origin, ndim): + """Returns interpreted coordinate tuple for origin parameter. + + This is a helper function for other transform functions. + + The point of origin can be a keyword 'center' for the 2D bounding box + center, 'centroid' for the geometry's 2D centroid, a Point object or a + coordinate tuple (x0, y0, z0). + """ + # get coordinate tuple from 'origin' from keyword or Point type + if origin == "center": + # bounding box center + minx, miny, maxx, maxy = geom.bounds + origin = ((maxx + minx) / 2.0, (maxy + miny) / 2.0) + elif origin == "centroid": + origin = geom.centroid.coords[0] + elif isinstance(origin, str): + raise ValueError(f"'origin' keyword {origin!r} is not recognized") + elif getattr(origin, "geom_type", None) == "Point": + origin = origin.coords[0] + + # origin should now be tuple-like + if len(origin) not in (2, 3): + raise ValueError("Expected number of items in 'origin' to be " "either 2 or 3") + if ndim == 2: + return origin[0:2] + else: # 3D coordinate + if len(origin) == 2: + return origin + (0.0,) + else: + return origin + + +def rotate(geom, angle, origin="center", use_radians=False): + r"""Returns a rotated geometry on a 2D plane. + + The angle of rotation can be specified in either degrees (default) or + radians by setting ``use_radians=True``. Positive angles are + counter-clockwise and negative are clockwise rotations. + + The point of origin can be a keyword 'center' for the bounding box + center (default), 'centroid' for the geometry's centroid, a Point object + or a coordinate tuple (x0, y0). + + The affine transformation matrix for 2D rotation is: + + / cos(r) -sin(r) xoff \ + | sin(r) cos(r) yoff | + \ 0 0 1 / + + where the offsets are calculated from the origin Point(x0, y0): + + xoff = x0 - x0 * cos(r) + y0 * sin(r) + yoff = y0 - x0 * sin(r) - y0 * cos(r) + """ + if geom.is_empty: + return geom + if not use_radians: # convert from degrees + angle = angle * pi / 180.0 + cosp = cos(angle) + sinp = sin(angle) + if abs(cosp) < 2.5e-16: + cosp = 0.0 + if abs(sinp) < 2.5e-16: + sinp = 0.0 + x0, y0 = interpret_origin(geom, origin, 2) + + # fmt: off + matrix = (cosp, -sinp, 0.0, + sinp, cosp, 0.0, + 0.0, 0.0, 1.0, + x0 - x0 * cosp + y0 * sinp, y0 - x0 * sinp - y0 * cosp, 0.0) + # fmt: on + return affine_transform(geom, matrix) + + +def scale(geom, xfact=1.0, yfact=1.0, zfact=1.0, origin="center"): + r"""Returns a scaled geometry, scaled by factors along each dimension. + + The point of origin can be a keyword 'center' for the 2D bounding box + center (default), 'centroid' for the geometry's 2D centroid, a Point + object or a coordinate tuple (x0, y0, z0). + + Negative scale factors will mirror or reflect coordinates. + + The general 3D affine transformation matrix for scaling is: + + / xfact 0 0 xoff \ + | 0 yfact 0 yoff | + | 0 0 zfact zoff | + \ 0 0 0 1 / + + where the offsets are calculated from the origin Point(x0, y0, z0): + + xoff = x0 - x0 * xfact + yoff = y0 - y0 * yfact + zoff = z0 - z0 * zfact + """ + if geom.is_empty: + return geom + x0, y0, z0 = interpret_origin(geom, origin, 3) + + # fmt: off + matrix = (xfact, 0.0, 0.0, + 0.0, yfact, 0.0, + 0.0, 0.0, zfact, + x0 - x0 * xfact, y0 - y0 * yfact, z0 - z0 * zfact) + # fmt: on + return affine_transform(geom, matrix) + + +def skew(geom, xs=0.0, ys=0.0, origin="center", use_radians=False): + r"""Returns a skewed geometry, sheared by angles along x and y dimensions. + + The shear angle can be specified in either degrees (default) or radians + by setting ``use_radians=True``. + + The point of origin can be a keyword 'center' for the bounding box + center (default), 'centroid' for the geometry's centroid, a Point object + or a coordinate tuple (x0, y0). + + The general 2D affine transformation matrix for skewing is: + + / 1 tan(xs) xoff \ + | tan(ys) 1 yoff | + \ 0 0 1 / + + where the offsets are calculated from the origin Point(x0, y0): + + xoff = -y0 * tan(xs) + yoff = -x0 * tan(ys) + """ + if geom.is_empty: + return geom + if not use_radians: # convert from degrees + xs = xs * pi / 180.0 + ys = ys * pi / 180.0 + tanx = tan(xs) + tany = tan(ys) + if abs(tanx) < 2.5e-16: + tanx = 0.0 + if abs(tany) < 2.5e-16: + tany = 0.0 + x0, y0 = interpret_origin(geom, origin, 2) + + # fmt: off + matrix = (1.0, tanx, 0.0, + tany, 1.0, 0.0, + 0.0, 0.0, 1.0, + -y0 * tanx, -x0 * tany, 0.0) + # fmt: on + return affine_transform(geom, matrix) + + +def translate(geom, xoff=0.0, yoff=0.0, zoff=0.0): + r"""Returns a translated geometry shifted by offsets along each dimension. + + The general 3D affine transformation matrix for translation is: + + / 1 0 0 xoff \ + | 0 1 0 yoff | + | 0 0 1 zoff | + \ 0 0 0 1 / + """ + if geom.is_empty: + return geom + + # fmt: off + matrix = (1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + xoff, yoff, zoff) + # fmt: on + return affine_transform(geom, matrix) diff --git a/shapely/python/shapely/algorithms/__init__.py b/shapely/python/shapely/algorithms/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/shapely/python/shapely/algorithms/__pycache__/__init__.cpython-311.pyc b/shapely/python/shapely/algorithms/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..f0fdb20 Binary files /dev/null and b/shapely/python/shapely/algorithms/__pycache__/__init__.cpython-311.pyc differ diff --git a/shapely/python/shapely/algorithms/__pycache__/cga.cpython-311.pyc b/shapely/python/shapely/algorithms/__pycache__/cga.cpython-311.pyc new file mode 100644 index 0000000..8381e8a Binary files /dev/null and b/shapely/python/shapely/algorithms/__pycache__/cga.cpython-311.pyc differ diff --git a/shapely/python/shapely/algorithms/__pycache__/polylabel.cpython-311.pyc b/shapely/python/shapely/algorithms/__pycache__/polylabel.cpython-311.pyc new file mode 100644 index 0000000..a1b7d7f Binary files /dev/null and b/shapely/python/shapely/algorithms/__pycache__/polylabel.cpython-311.pyc differ diff --git a/shapely/python/shapely/algorithms/cga.py b/shapely/python/shapely/algorithms/cga.py new file mode 100644 index 0000000..2b78652 --- /dev/null +++ b/shapely/python/shapely/algorithms/cga.py @@ -0,0 +1,24 @@ +import numpy as np + +import shapely + + +def signed_area(ring): + """Return the signed area enclosed by a ring in linear time using the + algorithm at: https://web.archive.org/web/20080209143651/http://cgafaq.info:80/wiki/Polygon_Area + """ + coords = np.array(ring.coords)[:, :2] + xs, ys = np.vstack([coords, coords[1]]).T + return np.sum(xs[1:-1] * (ys[2:] - ys[:-2])) / 2.0 + + +def is_ccw_impl(name=None): + """Predicate implementation""" + + def is_ccw_op(ring): + return signed_area(ring) >= 0.0 + + if shapely.geos_version >= (3, 7, 0): + return shapely.is_ccw + else: + return is_ccw_op diff --git a/shapely/python/shapely/algorithms/polylabel.py b/shapely/python/shapely/algorithms/polylabel.py new file mode 100644 index 0000000..d72ffbe --- /dev/null +++ b/shapely/python/shapely/algorithms/polylabel.py @@ -0,0 +1,139 @@ +from heapq import heappop, heappush + +from ..errors import TopologicalError +from ..geometry import Point + + +class Cell: + """A `Cell`'s centroid property is a potential solution to finding the pole + of inaccessibility for a given polygon. Rich comparison operators are used + for sorting `Cell` objects in a priority queue based on the potential + maximum distance of any theoretical point within a cell to a given + polygon's exterior boundary. + """ + + def __init__(self, x, y, h, polygon): + self.x = x + self.y = y + self.h = h # half of cell size + self.centroid = Point(x, y) # cell centroid, potential solution + + # distance from cell centroid to polygon exterior + self.distance = self._dist(polygon) + + # max distance to polygon exterior within a cell + self.max_distance = self.distance + h * 1.4142135623730951 # sqrt(2) + + # rich comparison operators for sorting in minimum priority queue + def __lt__(self, other): + return self.max_distance > other.max_distance + + def __le__(self, other): + return self.max_distance >= other.max_distance + + def __eq__(self, other): + return self.max_distance == other.max_distance + + def __ne__(self, other): + return self.max_distance != other.max_distance + + def __gt__(self, other): + return self.max_distance < other.max_distance + + def __ge__(self, other): + return self.max_distance <= other.max_distance + + def _dist(self, polygon): + """Signed distance from Cell centroid to polygon outline. The returned + value is negative if the point is outside of the polygon exterior + boundary. + """ + inside = polygon.contains(self.centroid) + distance = self.centroid.distance(polygon.exterior) + for interior in polygon.interiors: + distance = min(distance, self.centroid.distance(interior)) + if inside: + return distance + return -distance + + +def polylabel(polygon, tolerance=1.0): + """Finds pole of inaccessibility for a given polygon. Based on + Vladimir Agafonkin's https://github.com/mapbox/polylabel + + Parameters + ---------- + polygon : shapely.geometry.Polygon + tolerance : int or float, optional + `tolerance` represents the highest resolution in units of the + input geometry that will be considered for a solution. (default + value is 1.0). + + Returns + ------- + shapely.geometry.Point + A point representing the pole of inaccessibility for the given input + polygon. + + Raises + ------ + shapely.errors.TopologicalError + If the input polygon is not a valid geometry. + + Example + ------- + >>> from shapely import LineString + >>> polygon = LineString([(0, 0), (50, 200), (100, 100), (20, 50), + ... (-100, -20), (-150, -200)]).buffer(100) + >>> polylabel(polygon, tolerance=10).wkt + 'POINT (59.35615556364569 121.83919629746435)' + """ + if not polygon.is_valid: + raise TopologicalError("Invalid polygon") + minx, miny, maxx, maxy = polygon.bounds + width = maxx - minx + height = maxy - miny + cell_size = min(width, height) + h = cell_size / 2.0 + cell_queue = [] + + # First best cell approximation is one constructed from the centroid + # of the polygon + x, y = polygon.centroid.coords[0] + best_cell = Cell(x, y, 0, polygon) + + # Special case for rectangular polygons avoiding floating point error + bbox_cell = Cell(minx + width / 2.0, miny + height / 2, 0, polygon) + if bbox_cell.distance > best_cell.distance: + best_cell = bbox_cell + + # build a regular square grid covering the polygon + x = minx + while x < maxx: + y = miny + while y < maxy: + heappush(cell_queue, Cell(x + h, y + h, h, polygon)) + y += cell_size + x += cell_size + + # minimum priority queue + while cell_queue: + cell = heappop(cell_queue) + + # update the best cell if we find a better one + if cell.distance > best_cell.distance: + best_cell = cell + + # continue to the next iteration if we can't find a better solution + # based on tolerance + if cell.max_distance - best_cell.distance <= tolerance: + continue + + # split the cell into quadrants + h = cell.h / 2.0 + heappush(cell_queue, Cell(cell.x - h, cell.y - h, h, polygon)) + heappush(cell_queue, Cell(cell.x + h, cell.y - h, h, polygon)) + heappush(cell_queue, Cell(cell.x - h, cell.y + h, h, polygon)) + heappush(cell_queue, Cell(cell.x + h, cell.y + h, h, polygon)) + + return best_cell.centroid diff --git a/shapely/python/shapely/constructive.py b/shapely/python/shapely/constructive.py new file mode 100644 index 0000000..bda4be3 --- /dev/null +++ b/shapely/python/shapely/constructive.py @@ -0,0 +1,1036 @@ +import numpy as np + +from . import lib +from ._enum import ParamEnum +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "BufferCapStyle", + "BufferJoinStyle", + "boundary", + "buffer", + "offset_curve", + "centroid", + "clip_by_rect", + "concave_hull", + "convex_hull", + "delaunay_triangles", + "segmentize", + "envelope", + "extract_unique_points", + "build_area", + "make_valid", + "normalize", + "node", + "point_on_surface", + "polygonize", + "polygonize_full", + "remove_repeated_points", + "reverse", + "simplify", + "snap", + "voronoi_polygons", + "oriented_envelope", + "minimum_rotated_rectangle", + "minimum_bounding_circle", +] + + +class BufferCapStyle(ParamEnum): + round = 1 + flat = 2 + square = 3 + + +class BufferJoinStyle(ParamEnum): + round = 1 + mitre = 2 + bevel = 3 + + +@multithreading_enabled +def boundary(geometry, **kwargs): + """Returns the topological boundary of a geometry. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return None for geometrycollections. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LinearRing, LineString, \ +MultiLineString, MultiPoint, Point, Polygon + >>> boundary(Point(0, 0)) + + >>> boundary(LineString([(0, 0), (1, 1), (1, 2)])) + + >>> boundary(LinearRing([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> boundary(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> boundary(MultiPoint([(0, 0), (1, 2)])) + + >>> boundary(MultiLineString([[(0, 0), (1, 1)], [(0, 1), (1, 0)]])) + + >>> boundary(GeometryCollection([Point(0, 0)])) is None + True + """ + return lib.boundary(geometry, **kwargs) + + +@multithreading_enabled +def buffer( + geometry, + distance, + quad_segs=8, + cap_style="round", + join_style="round", + mitre_limit=5.0, + single_sided=False, + **kwargs +): + """ + Computes the buffer of a geometry for positive and negative buffer distance. + + The buffer of a geometry is defined as the Minkowski sum (or difference, + for negative distance) of the geometry with a circle with radius equal + to the absolute value of the buffer distance. + + The buffer operation always returns a polygonal result. The negative + or zero-distance buffer of lines and points is always empty. + + Parameters + ---------- + geometry : Geometry or array_like + distance : float or array_like + Specifies the circle radius in the Minkowski sum (or difference). + quad_segs : int, default 8 + Specifies the number of linear segments in a quarter circle in the + approximation of circular arcs. + cap_style : shapely.BufferCapStyle or {'round', 'square', 'flat'}, default 'round' + Specifies the shape of buffered line endings. BufferCapStyle.round ('round') + results in circular line endings (see ``quad_segs``). Both BufferCapStyle.square + ('square') and BufferCapStyle.flat ('flat') result in rectangular line endings, + only BufferCapStyle.flat ('flat') will end at the original vertex, + while BufferCapStyle.square ('square') involves adding the buffer width. + join_style : shapely.BufferJoinStyle or {'round', 'mitre', 'bevel'}, default 'round' + Specifies the shape of buffered line midpoints. BufferJoinStyle.round ('round') + results in rounded shapes. BufferJoinStyle.bevel ('bevel') results in a beveled + edge that touches the original vertex. BufferJoinStyle.mitre ('mitre') results + in a single vertex that is beveled depending on the ``mitre_limit`` parameter. + mitre_limit : float, default 5.0 + Crops of 'mitre'-style joins if the point is displaced from the + buffered vertex by more than this limit. + single_sided : bool, default False + Only buffer at one side of the geometry. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon, BufferCapStyle, BufferJoinStyle + >>> buffer(Point(10, 10), 2, quad_segs=1) + + >>> buffer(Point(10, 10), 2, quad_segs=2) + + >>> buffer(Point(10, 10), -2, quad_segs=1) + + >>> line = LineString([(10, 10), (20, 10)]) + >>> buffer(line, 2, cap_style="square") + + >>> buffer(line, 2, cap_style="flat") + + >>> buffer(line, 2, single_sided=True, cap_style="flat") + + >>> line2 = LineString([(10, 10), (20, 10), (20, 20)]) + >>> buffer(line2, 2, cap_style="flat", join_style="bevel") + + >>> buffer(line2, 2, cap_style="flat", join_style="mitre") + + >>> buffer(line2, 2, cap_style="flat", join_style="mitre", mitre_limit=1) + + >>> square = Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]) + >>> buffer(square, 2, join_style="mitre") + + >>> buffer(square, -2, join_style="mitre") + + >>> buffer(square, -5, join_style="mitre") + + >>> buffer(line, float("nan")) is None + True + """ + if isinstance(cap_style, str): + cap_style = BufferCapStyle.get_value(cap_style) + if isinstance(join_style, str): + join_style = BufferJoinStyle.get_value(join_style) + if not np.isscalar(quad_segs): + raise TypeError("quad_segs only accepts scalar values") + if not np.isscalar(cap_style): + raise TypeError("cap_style only accepts scalar values") + if not np.isscalar(join_style): + raise TypeError("join_style only accepts scalar values") + if not np.isscalar(mitre_limit): + raise TypeError("mitre_limit only accepts scalar values") + if not np.isscalar(single_sided): + raise TypeError("single_sided only accepts scalar values") + return lib.buffer( + geometry, + distance, + np.intc(quad_segs), + np.intc(cap_style), + np.intc(join_style), + mitre_limit, + np.bool_(single_sided), + **kwargs + ) + + +@multithreading_enabled +def offset_curve( + geometry, distance, quad_segs=8, join_style="round", mitre_limit=5.0, **kwargs +): + """ + Returns a (Multi)LineString at a distance from the object + on its right or its left side. + + For positive distance the offset will be at the left side of the input + line. For a negative distance it will be at the right side. In general, + this function tries to preserve the direction of the input. + + Note: the behaviour regarding orientation of the resulting line depends + on the GEOS version. With GEOS < 3.11, the line retains the same + direction for a left offset (positive distance) or has opposite direction + for a right offset (negative distance), and this behaviour was documented + as such in previous Shapely versions. Starting with GEOS 3.11, the + function tries to preserve the orientation of the original line. + + Parameters + ---------- + geometry : Geometry or array_like + distance : float or array_like + Specifies the offset distance from the input geometry. Negative + for right side offset, positive for left side offset. + quad_segs : int, default 8 + Specifies the number of linear segments in a quarter circle in the + approximation of circular arcs. + join_style : {'round', 'bevel', 'mitre'}, default 'round' + Specifies the shape of outside corners. 'round' results in + rounded shapes. 'bevel' results in a beveled edge that touches the + original vertex. 'mitre' results in a single vertex that is beveled + depending on the ``mitre_limit`` parameter. + mitre_limit : float, default 5.0 + Crops of 'mitre'-style joins if the point is displaced from the + buffered vertex by more than this limit. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line = LineString([(0, 0), (0, 2)]) + >>> offset_curve(line, 2) + + >>> offset_curve(line, -2) + + """ + if isinstance(join_style, str): + join_style = BufferJoinStyle.get_value(join_style) + if not np.isscalar(quad_segs): + raise TypeError("quad_segs only accepts scalar values") + if not np.isscalar(join_style): + raise TypeError("join_style only accepts scalar values") + if not np.isscalar(mitre_limit): + raise TypeError("mitre_limit only accepts scalar values") + return lib.offset_curve( + geometry, + distance, + np.intc(quad_segs), + np.intc(join_style), + np.double(mitre_limit), + **kwargs + ) + + +@multithreading_enabled +def centroid(geometry, **kwargs): + """Computes the geometric center (center-of-mass) of a geometry. + + For multipoints this is computed as the mean of the input coordinates. + For multilinestrings the centroid is weighted by the length of each + line segment. For multipolygons the centroid is weighted by the area of + each polygon. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Polygon + >>> centroid(Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)])) + + >>> centroid(LineString([(0, 0), (2, 2), (10, 10)])) + + >>> centroid(MultiPoint([(0, 0), (10, 10)])) + + >>> centroid(Polygon()) + + """ + return lib.centroid(geometry, **kwargs) + + +@multithreading_enabled +def clip_by_rect(geometry, xmin, ymin, xmax, ymax, **kwargs): + """ + Returns the portion of a geometry within a rectangle. + + The geometry is clipped in a fast but possibly dirty way. The output is + not guaranteed to be valid. No exceptions will be raised for topological + errors. + + Note: empty geometries or geometries that do not overlap with the + specified bounds will result in GEOMETRYCOLLECTION EMPTY. + + Parameters + ---------- + geometry : Geometry or array_like + The geometry to be clipped + xmin : float + Minimum x value of the rectangle + ymin : float + Minimum y value of the rectangle + xmax : float + Maximum x value of the rectangle + ymax : float + Maximum y value of the rectangle + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> line = LineString([(0, 0), (10, 10)]) + >>> clip_by_rect(line, 0., 0., 1., 1.) + + >>> polygon = Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]) + >>> clip_by_rect(polygon, 0., 0., 1., 1.) + + """ + if not all(np.isscalar(val) for val in [xmin, ymin, xmax, ymax]): + raise TypeError("xmin/ymin/xmax/ymax only accepts scalar values") + return lib.clip_by_rect( + geometry, + np.double(xmin), + np.double(ymin), + np.double(xmax), + np.double(ymax), + **kwargs + ) + + +@requires_geos("3.11.0") +@multithreading_enabled +def concave_hull(geometry, ratio=0.0, allow_holes=False, **kwargs): + """Computes a concave geometry that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + ratio : float, default 0.0 + Number in the range [0, 1]. Higher numbers will include fewer vertices + in the hull. + allow_holes : bool, default False + If set to True, the concave hull may have holes. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiPoint, Polygon + >>> concave_hull(MultiPoint([(0, 0), (0, 3), (1, 1), (3, 0), (3, 3)]), ratio=0.1) + + >>> concave_hull(MultiPoint([(0, 0), (0, 3), (1, 1), (3, 0), (3, 3)]), ratio=1.0) + + >>> concave_hull(Polygon()) + + """ + if not np.isscalar(ratio): + raise TypeError("ratio must be scalar") + if not np.isscalar(allow_holes): + raise TypeError("allow_holes must be scalar") + return lib.concave_hull(geometry, np.double(ratio), np.bool_(allow_holes), **kwargs) + + +@multithreading_enabled +def convex_hull(geometry, **kwargs): + """Computes the minimum convex geometry that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiPoint, Polygon + >>> convex_hull(MultiPoint([(0, 0), (10, 0), (10, 10)])) + + >>> convex_hull(Polygon()) + + """ + return lib.convex_hull(geometry, **kwargs) + + +@multithreading_enabled +def delaunay_triangles(geometry, tolerance=0.0, only_edges=False, **kwargs): + """Computes a Delaunay triangulation around the vertices of an input + geometry. + + The output is a geometrycollection containing polygons (default) + or linestrings (see only_edges). Returns an None if an input geometry + contains less than 3 vertices. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like, default 0.0 + Snap input vertices together if their distance is less than this value. + only_edges : bool or array_like, default False + If set to True, the triangulation will return a collection of + linestrings instead of polygons. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Polygon + >>> points = MultiPoint([(50, 30), (60, 30), (100, 100)]) + >>> delaunay_triangles(points) + + >>> delaunay_triangles(points, only_edges=True) + + >>> delaunay_triangles(MultiPoint([(50, 30), (51, 30), (60, 30), (100, 100)]), \ +tolerance=2) + + >>> delaunay_triangles(Polygon([(50, 30), (60, 30), (100, 100), (50, 30)])) + + >>> delaunay_triangles(LineString([(50, 30), (60, 30), (100, 100)])) + + >>> delaunay_triangles(GeometryCollection([])) + + """ + return lib.delaunay_triangles(geometry, tolerance, only_edges, **kwargs) + + +@multithreading_enabled +def envelope(geometry, **kwargs): + """Computes the minimum bounding box that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point + >>> envelope(LineString([(0, 0), (10, 10)])) + + >>> envelope(MultiPoint([(0, 0), (10, 10)])) + + >>> envelope(Point(0, 0)) + + >>> envelope(GeometryCollection([])) + + """ + return lib.envelope(geometry, **kwargs) + + +@multithreading_enabled +def extract_unique_points(geometry, **kwargs): + """Returns all distinct vertices of an input geometry as a multipoint. + + Note that only 2 dimensions of the vertices are considered when testing + for equality. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Point, Polygon + >>> extract_unique_points(Point(0, 0)) + + >>> extract_unique_points(LineString([(0, 0), (1, 1), (1, 1)])) + + >>> extract_unique_points(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> extract_unique_points(MultiPoint([(0, 0), (1, 1), (0, 0)])) + + >>> extract_unique_points(LineString()) + + """ + return lib.extract_unique_points(geometry, **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def build_area(geometry, **kwargs): + """Creates an areal geometry formed by the constituent linework of given geometry. + + Equivalent of the PostGIS ST_BuildArea() function. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, Polygon + >>> polygon1 = Polygon([(0, 0), (3, 0), (3, 3), (0, 3), (0, 0)]) + >>> polygon2 = Polygon([(1, 1), (1, 2), (2, 2), (1, 1)]) + >>> build_area(GeometryCollection([polygon1, polygon2])) + + """ + return lib.build_area(geometry, **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def make_valid(geometry, **kwargs): + """Repairs invalid geometries. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import is_valid, Polygon + >>> polygon = Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)]) + >>> is_valid(polygon) + False + >>> make_valid(polygon) + + """ + return lib.make_valid(geometry, **kwargs) + + +@multithreading_enabled +def normalize(geometry, **kwargs): + """Converts Geometry to normal form (or canonical form). + + This method orders the coordinates, rings of a polygon and parts of + multi geometries consistently. Typically useful for testing purposes + (for example in combination with ``equals_exact``). + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiLineString + >>> line = MultiLineString([[(0, 0), (1, 1)], [(2, 2), (3, 3)]]) + >>> normalize(line) + + """ + return lib.normalize(geometry, **kwargs) + + +@multithreading_enabled +def point_on_surface(geometry, **kwargs): + """Returns a point that intersects an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Polygon + >>> point_on_surface(Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)])) + + >>> point_on_surface(LineString([(0, 0), (2, 2), (10, 10)])) + + >>> point_on_surface(MultiPoint([(0, 0), (10, 10)])) + + >>> point_on_surface(Polygon()) + + """ + return lib.point_on_surface(geometry, **kwargs) + + +@multithreading_enabled +def node(geometry, **kwargs): + """ + Returns the fully noded version of the linear input as MultiLineString. + + Given a linear input geometry, this function returns a new MultiLineString + in which no lines cross each other but only touch at and points. To + obtain this, all intersections between segments are computed and added + to the segments, and duplicate segments are removed. + + Non-linear input (points) will result in an empty MultiLineString. + + This function can for example be used to create a fully-noded linework + suitable to passed as input to ``polygonize``. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 0), (1,1), (0, 1), (1, 0)]) + >>> node(line) + + >>> node(Point(1, 1)) + + """ + return lib.node(geometry, **kwargs) + + +def polygonize(geometries, **kwargs): + """Creates polygons formed from the linework of a set of Geometries. + + Polygonizes an array of Geometries that contain linework which + represents the edges of a planar graph. Any type of Geometry may be + provided as input; only the constituent lines and rings will be used to + create the output polygons. + + Lines or rings that when combined do not completely close a polygon + will result in an empty GeometryCollection. Duplicate segments are + ignored. + + This function returns the polygons within a GeometryCollection. + Individual Polygons can be obtained using ``get_geometry`` to get + a single polygon or ``get_parts`` to get an array of polygons. + MultiPolygons can be constructed from the output using + ``shapely.multipolygons(shapely.get_parts(shapely.polygonize(geometries)))``. + + Parameters + ---------- + geometries : array_like + An array of geometries. + axis : int + Axis along which the geometries are polygonized. + The default is to perform a reduction over the last dimension + of the input array. A 1D array results in a scalar geometry. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Returns + ------- + GeometryCollection or array of GeometryCollections + + See Also + -------- + get_parts, get_geometry + polygonize_full + node + + Examples + -------- + >>> from shapely import LineString + >>> lines = [ + ... LineString([(0, 0), (1, 1)]), + ... LineString([(0, 0), (0, 1)]), + ... LineString([(0, 1), (1, 1)]) + ... ] + >>> polygonize(lines) + + """ + return lib.polygonize(geometries, **kwargs) + + +def polygonize_full(geometries, **kwargs): + """Creates polygons formed from the linework of a set of Geometries and + return all extra outputs as well. + + Polygonizes an array of Geometries that contain linework which + represents the edges of a planar graph. Any type of Geometry may be + provided as input; only the constituent lines and rings will be used to + create the output polygons. + + This function performs the same polygonization as ``polygonize`` but does + not only return the polygonal result but all extra outputs as well. The + return value consists of 4 elements: + + * The polygonal valid output + * **Cut edges**: edges connected on both ends but not part of polygonal output + * **dangles**: edges connected on one end but not part of polygonal output + * **invalid rings**: polygons formed but which are not valid + + This function returns the geometries within GeometryCollections. + Individual geometries can be obtained using ``get_geometry`` to get + a single geometry or ``get_parts`` to get an array of geometries. + + Parameters + ---------- + geometries : array_like + An array of geometries. + axis : int + Axis along which the geometries are polygonized. + The default is to perform a reduction over the last dimension + of the input array. A 1D array results in a scalar geometry. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Returns + ------- + (polygons, cuts, dangles, invalid) + tuple of 4 GeometryCollections or arrays of GeometryCollections + + See Also + -------- + polygonize + + Examples + -------- + >>> from shapely import LineString + >>> lines = [ + ... LineString([(0, 0), (1, 1)]), + ... LineString([(0, 0), (0, 1), (1, 1)]), + ... LineString([(0, 1), (1, 1)]) + ... ] + >>> polygonize_full(lines) # doctest: +NORMALIZE_WHITESPACE + (, + , + , + ) + """ + return lib.polygonize_full(geometries, **kwargs) + + +@requires_geos("3.11.0") +@multithreading_enabled +def remove_repeated_points(geometry, tolerance=0.0, **kwargs): + """Returns a copy of a Geometry with repeated points removed. + + From the start of the coordinate sequence, each next point within the + tolerance is removed. + + Removing repeated points with a non-zero tolerance may result in an invalid + geometry being returned. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like, default=0.0 + Use 0.0 to remove only exactly repeated points. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> remove_repeated_points(LineString([(0,0), (0,0), (1,0)]), tolerance=0) + + >>> remove_repeated_points(Polygon([(0, 0), (0, .5), (0, 1), (.5, 1), (0,0)]), tolerance=.5) + + """ + return lib.remove_repeated_points(geometry, tolerance, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def reverse(geometry, **kwargs): + """Returns a copy of a Geometry with the order of coordinates reversed. + + If a Geometry is a polygon with interior rings, the interior rings are also + reversed. + + Points are unchanged. None is returned where Geometry is None. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_ccw : Checks if a Geometry is clockwise. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> reverse(LineString([(0, 0), (1, 2)])) + + >>> reverse(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) + + >>> reverse(None) is None + True + """ + + return lib.reverse(geometry, **kwargs) + + +@requires_geos("3.10.0") +@multithreading_enabled +def segmentize(geometry, max_segment_length, **kwargs): + """Adds vertices to line segments based on maximum segment length. + + Additional vertices will be added to every line segment in an input geometry + so that segments are no longer than the provided maximum segment length. New + vertices will evenly subdivide each segment. + + Only linear components of input geometries are densified; other geometries + are returned unmodified. + + Parameters + ---------- + geometry : Geometry or array_like + max_segment_length : float or array_like + Additional vertices will be added so that all line segments are no + longer than this value. Must be greater than 0. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> line = LineString([(0, 0), (0, 10)]) + >>> segmentize(line, max_segment_length=5) + + >>> polygon = Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]) + >>> segmentize(polygon, max_segment_length=5) + + >>> segmentize(None, max_segment_length=5) is None + True + """ + return lib.segmentize(geometry, max_segment_length, **kwargs) + + +@multithreading_enabled +def simplify(geometry, tolerance, preserve_topology=True, **kwargs): + """Returns a simplified version of an input geometry using the + Douglas-Peucker algorithm. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like + The maximum allowed geometry displacement. The higher this value, the + smaller the number of vertices in the resulting geometry. + preserve_topology : bool, default True + By default (True), the operation will avoid creating invalid + geometries (checking for collapses, ring-intersections, etc), but + this is computationally more expensive. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> line = LineString([(0, 0), (1, 10), (0, 20)]) + >>> simplify(line, tolerance=0.9) + + >>> simplify(line, tolerance=1) + + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> simplify(polygon_with_hole, tolerance=4, preserve_topology=True) + + >>> simplify(polygon_with_hole, tolerance=4, preserve_topology=False) + + """ + if preserve_topology: + return lib.simplify_preserve_topology(geometry, tolerance, **kwargs) + else: + return lib.simplify(geometry, tolerance, **kwargs) + + +@multithreading_enabled +def snap(geometry, reference, tolerance, **kwargs): + """Snaps an input geometry to reference geometry's vertices. + + The tolerance is used to control where snapping is performed. + The result geometry is the input geometry with the vertices snapped. + If no snapping occurs then the input geometry is returned unchanged. + + Parameters + ---------- + geometry : Geometry or array_like + reference : Geometry or array_like + tolerance : float or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> point = Point(0.5, 2.5) + >>> target_point = Point(0, 2) + >>> snap(point, target_point, tolerance=1) + + >>> snap(point, target_point, tolerance=0.49) + + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> snap(polygon, Point(8, 10), tolerance=5) + + >>> snap(polygon, LineString([(8, 10), (8, 0)]), tolerance=5) + + """ + return lib.snap(geometry, reference, tolerance, **kwargs) + + +@multithreading_enabled +def voronoi_polygons( + geometry, tolerance=0.0, extend_to=None, only_edges=False, **kwargs +): + """Computes a Voronoi diagram from the vertices of an input geometry. + + The output is a geometrycollection containing polygons (default) + or linestrings (see only_edges). Returns empty if an input geometry + contains less than 2 vertices or if the provided extent has zero area. + + Parameters + ---------- + geometry : Geometry or array_like + tolerance : float or array_like, default 0.0 + Snap input vertices together if their distance is less than this value. + extend_to : Geometry or array_like, optional + If provided, the diagram will be extended to cover the envelope of this + geometry (unless this envelope is smaller than the input geometry). + only_edges : bool or array_like, default False + If set to True, the triangulation will return a collection of + linestrings instead of polygons. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiPoint, normalize, Point + >>> points = MultiPoint([(2, 2), (4, 2)]) + >>> normalize(voronoi_polygons(points)) + + >>> voronoi_polygons(points, only_edges=True) + + >>> voronoi_polygons(MultiPoint([(2, 2), (4, 2), (4.2, 2)]), 0.5, only_edges=True) + + >>> voronoi_polygons(points, extend_to=LineString([(0, 0), (10, 10)]), only_edges=True) + + >>> voronoi_polygons(LineString([(2, 2), (4, 2)]), only_edges=True) + + >>> voronoi_polygons(Point(2, 2)) + + """ + return lib.voronoi_polygons(geometry, tolerance, extend_to, only_edges, **kwargs) + + +@requires_geos("3.6.0") +@multithreading_enabled +def oriented_envelope(geometry, **kwargs): + """ + Computes the oriented envelope (minimum rotated rectangle) + that encloses an input geometry. + + Unlike envelope this rectangle is not constrained to be parallel to the + coordinate axes. If the convex hull of the object is a degenerate (line + or point) this degenerate is returned. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + >>> oriented_envelope(MultiPoint([(0, 0), (10, 0), (10, 10)])) + + >>> oriented_envelope(LineString([(1, 1), (5, 1), (10, 10)])) + + >>> oriented_envelope(Polygon([(1, 1), (15, 1), (5, 10), (1, 1)])) + + >>> oriented_envelope(LineString([(1, 1), (10, 1)])) + + >>> oriented_envelope(Point(2, 2)) + + >>> oriented_envelope(GeometryCollection([])) + + """ + return lib.oriented_envelope(geometry, **kwargs) + + +minimum_rotated_rectangle = oriented_envelope + + +@requires_geos("3.8.0") +@multithreading_enabled +def minimum_bounding_circle(geometry, **kwargs): + """Computes the minimum bounding circle that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + >>> minimum_bounding_circle(Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])) + + >>> minimum_bounding_circle(LineString([(1, 1), (10, 10)])) + + >>> minimum_bounding_circle(MultiPoint([(2, 2), (4, 2)])) + + >>> minimum_bounding_circle(Point(0, 1)) + + >>> minimum_bounding_circle(GeometryCollection([])) + + + See also + -------- + minimum_bounding_radius + """ + return lib.minimum_bounding_circle(geometry, **kwargs) diff --git a/shapely/python/shapely/coordinates.py b/shapely/python/shapely/coordinates.py new file mode 100644 index 0000000..e453c9c --- /dev/null +++ b/shapely/python/shapely/coordinates.py @@ -0,0 +1,198 @@ +import numpy as np + +from . import lib + +__all__ = ["transform", "count_coordinates", "get_coordinates", "set_coordinates"] + + +def transform(geometry, transformation, include_z=False): + """Returns a copy of a geometry array with a function applied to its + coordinates. + + With the default of ``include_z=False``, all returned geometries will be + two-dimensional; the third dimension will be discarded, if present. + When specifying ``include_z=True``, the returned geometries preserve + the dimensionality of the respective input geometries. + + Parameters + ---------- + geometry : Geometry or array_like + transformation : function + A function that transforms a (N, 2) or (N, 3) ndarray of float64 to + another (N, 2) or (N, 3) ndarray of float64. + include_z : bool, default False + If True, include the third dimension in the coordinates array + that is passed to the ``transformation`` function. If a + geometry has no third dimension, the z-coordinates passed to the + function will be NaN. + + Examples + -------- + >>> from shapely import LineString, Point + >>> transform(Point(0, 0), lambda x: x + 1) + + >>> transform(LineString([(2, 2), (4, 4)]), lambda x: x * [2, 3]) + + >>> transform(None, lambda x: x) is None + True + >>> transform([Point(0, 0), None], lambda x: x).tolist() + [, None] + + By default, the third dimension is ignored: + + >>> transform(Point(0, 0, 0), lambda x: x + 1) + + >>> transform(Point(0, 0, 0), lambda x: x + 1, include_z=True) + + """ + geometry_arr = np.array(geometry, dtype=np.object_) # makes a copy + coordinates = lib.get_coordinates(geometry_arr, include_z, False) + new_coordinates = transformation(coordinates) + # check the array to yield understandable error messages + if not isinstance(new_coordinates, np.ndarray): + raise ValueError("The provided transformation did not return a numpy array") + if new_coordinates.dtype != np.float64: + raise ValueError( + "The provided transformation returned an array with an unexpected " + f"dtype ({new_coordinates.dtype})" + ) + if new_coordinates.shape != coordinates.shape: + # if the shape is too small we will get a segfault + raise ValueError( + "The provided transformation returned an array with an unexpected " + f"shape ({new_coordinates.shape})" + ) + geometry_arr = lib.set_coordinates(geometry_arr, new_coordinates) + if geometry_arr.ndim == 0 and not isinstance(geometry, np.ndarray): + return geometry_arr.item() + return geometry_arr + + +def count_coordinates(geometry): + """Counts the number of coordinate pairs in a geometry array. + + Parameters + ---------- + geometry : Geometry or array_like + + Examples + -------- + >>> from shapely import LineString, Point + >>> count_coordinates(Point(0, 0)) + 1 + >>> count_coordinates(LineString([(2, 2), (4, 2)])) + 2 + >>> count_coordinates(None) + 0 + >>> count_coordinates([Point(0, 0), None]) + 1 + """ + return lib.count_coordinates(np.asarray(geometry, dtype=np.object_)) + + +def get_coordinates(geometry, include_z=False, return_index=False): + """Gets coordinates from a geometry array as an array of floats. + + The shape of the returned array is (N, 2), with N being the number of + coordinate pairs. With the default of ``include_z=False``, three-dimensional + data is ignored. When specifying ``include_z=True``, the shape of the + returned array is (N, 3). + + Parameters + ---------- + geometry : Geometry or array_like + include_z : bool, default False + If, True include the third dimension in the output. If a geometry + has no third dimension, the z-coordinates will be NaN. + return_index : bool, default False + If True, also return the index of each returned geometry as a separate + ndarray of integers. For multidimensional arrays, this indexes into the + flattened array (in C contiguous order). + + Examples + -------- + >>> from shapely import LineString, Point + >>> get_coordinates(Point(0, 0)).tolist() + [[0.0, 0.0]] + >>> get_coordinates(LineString([(2, 2), (4, 4)])).tolist() + [[2.0, 2.0], [4.0, 4.0]] + >>> get_coordinates(None) + array([], shape=(0, 2), dtype=float64) + + By default the third dimension is ignored: + + >>> get_coordinates(Point(0, 0, 0)).tolist() + [[0.0, 0.0]] + >>> get_coordinates(Point(0, 0, 0), include_z=True).tolist() + [[0.0, 0.0, 0.0]] + + When return_index=True, indexes are returned also: + + >>> geometries = [LineString([(2, 2), (4, 4)]), Point(0, 0)] + >>> coordinates, index = get_coordinates(geometries, return_index=True) + >>> coordinates.tolist(), index.tolist() + ([[2.0, 2.0], [4.0, 4.0], [0.0, 0.0]], [0, 0, 1]) + """ + return lib.get_coordinates( + np.asarray(geometry, dtype=np.object_), include_z, return_index + ) + + +def set_coordinates(geometry, coordinates): + """Adapts the coordinates of a geometry array in-place. + + If the coordinates array has shape (N, 2), all returned geometries + will be two-dimensional, and the third dimension will be discarded, + if present. If the coordinates array has shape (N, 3), the returned + geometries preserve the dimensionality of the input geometries. + + .. warning:: + + The geometry array is modified in-place! If you do not want to + modify the original array, you can do + ``set_coordinates(arr.copy(), newcoords)``. + + Parameters + ---------- + geometry : Geometry or array_like + coordinates: array_like + + See Also + -------- + transform : Returns a copy of a geometry array with a function applied to its + coordinates. + + Examples + -------- + >>> from shapely import LineString, Point + >>> set_coordinates(Point(0, 0), [[1, 1]]) + + >>> set_coordinates([Point(0, 0), LineString([(0, 0), (0, 0)])], [[1, 2], [3, 4], [5, 6]]).tolist() + [, ] + >>> set_coordinates([None, Point(0, 0)], [[1, 2]]).tolist() + [None, ] + + Third dimension of input geometry is discarded if coordinates array does + not include one: + + >>> set_coordinates(Point(0, 0, 0), [[1, 1]]) + + >>> set_coordinates(Point(0, 0, 0), [[1, 1, 1]]) + + """ + geometry_arr = np.asarray(geometry, dtype=np.object_) + coordinates = np.atleast_2d(np.asarray(coordinates)).astype(np.float64) + if coordinates.ndim != 2: + raise ValueError( + "The coordinate array should have dimension of 2 " + f"(has {coordinates.ndim})" + ) + n_coords = lib.count_coordinates(geometry_arr) + if (coordinates.shape[0] != n_coords) or (coordinates.shape[1] not in {2, 3}): + raise ValueError( + f"The coordinate array has an invalid shape {coordinates.shape}" + ) + lib.set_coordinates(geometry_arr, coordinates) + if geometry_arr.ndim == 0 and not isinstance(geometry, np.ndarray): + return geometry_arr.item() + return geometry_arr diff --git a/shapely/python/shapely/coords.py b/shapely/python/shapely/coords.py new file mode 100644 index 0000000..9056f2a --- /dev/null +++ b/shapely/python/shapely/coords.py @@ -0,0 +1,62 @@ +"""Coordinate sequence utilities +""" +from array import array + + +class CoordinateSequence: + """ + Iterative access to coordinate tuples from the parent geometry's coordinate + sequence. + + Example: + + >>> from shapely.wkt import loads + >>> g = loads('POINT (0.0 0.0)') + >>> list(g.coords) + [(0.0, 0.0)] + + """ + + def __init__(self, coords): + self._coords = coords + + def __len__(self): + return self._coords.shape[0] + + def __iter__(self): + for i in range(self.__len__()): + yield tuple(self._coords[i].tolist()) + + def __getitem__(self, key): + m = self.__len__() + if isinstance(key, int): + if key + m < 0 or key >= m: + raise IndexError("index out of range") + if key < 0: + i = m + key + else: + i = key + return tuple(self._coords[i].tolist()) + elif isinstance(key, slice): + res = [] + start, stop, stride = key.indices(m) + for i in range(start, stop, stride): + res.append(tuple(self._coords[i].tolist())) + return res + else: + raise TypeError("key must be an index or slice") + + def __array__(self, dtype=None): + return self._coords + + @property + def xy(self): + """X and Y arrays""" + m = self.__len__() + x = array("d") + y = array("d") + for i in range(m): + xy = self._coords[i].tolist() + x.append(xy[0]) + y.append(xy[1]) + return x, y diff --git a/shapely/python/shapely/creation.py b/shapely/python/shapely/creation.py new file mode 100644 index 0000000..8592c6e --- /dev/null +++ b/shapely/python/shapely/creation.py @@ -0,0 +1,565 @@ +import numpy as np + +from . import Geometry, GeometryType, lib +from ._geometry_helpers import collections_1d, simple_geometries_1d +from .decorators import multithreading_enabled +from .io import from_wkt + +__all__ = [ + "points", + "linestrings", + "linearrings", + "polygons", + "multipoints", + "multilinestrings", + "multipolygons", + "geometrycollections", + "box", + "prepare", + "destroy_prepared", + "empty", +] + + +def _xyz_to_coords(x, y, z): + if y is None: + return x + if z is None: + coords = np.broadcast_arrays(x, y) + else: + coords = np.broadcast_arrays(x, y, z) + return np.stack(coords, axis=-1) + + +@multithreading_enabled +def points(coords, y=None, z=None, indices=None, out=None, **kwargs): + """Create an array of points. + + Parameters + ---------- + coords : array_like + An array of coordinate tuples (2- or 3-dimensional) or, if ``y`` is + provided, an array of x coordinates. + y : array_like, optional + z : array_like, optional + indices : array_like, optional + Indices into the target array where input coordinates belong. If + provided, the coords should be 2D with shape (N, 2) or (N, 3) and + indices should be an array of shape (N,) with integers in increasing + order. Missing indices result in a ValueError unless ``out`` is + provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + >>> points([[0, 1], [4, 5]]).tolist() + [, ] + >>> points([0, 1, 2]) + + + Notes + ----- + + - GEOS >=3.10 automatically converts POINT (nan nan) to POINT EMPTY. + - Usage of the ``y`` and ``z`` arguments will prevents lazy evaluation in ``dask``. + Instead provide the coordinates as an array with shape ``(..., 2)`` or ``(..., 3)`` using only the ``coords`` argument. + """ + coords = _xyz_to_coords(coords, y, z) + if indices is None: + return lib.points(coords, out=out, **kwargs) + else: + return simple_geometries_1d(coords, indices, GeometryType.POINT, out=out) + + +@multithreading_enabled +def linestrings(coords, y=None, z=None, indices=None, out=None, **kwargs): + """Create an array of linestrings. + + This function will raise an exception if a linestring contains less than + two points. + + Parameters + ---------- + coords : array_like + An array of lists of coordinate tuples (2- or 3-dimensional) or, if ``y`` + is provided, an array of lists of x coordinates + y : array_like, optional + z : array_like, optional + indices : array_like, optional + Indices into the target array where input coordinates belong. If + provided, the coords should be 2D with shape (N, 2) or (N, 3) and + indices should be an array of shape (N,) with integers in increasing + order. Missing indices result in a ValueError unless ``out`` is + provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + >>> linestrings([[[0, 1], [4, 5]], [[2, 3], [5, 6]]]).tolist() + [, ] + >>> linestrings([[0, 1], [4, 5], [2, 3], [5, 6], [7, 8]], indices=[0, 0, 1, 1, 1]).tolist() + [, ] + + Notes + ----- + - Usage of the ``y`` and ``z`` arguments will prevents lazy evaluation in ``dask``. + Instead provide the coordinates as a ``(..., 2)`` or ``(..., 3)`` array using only ``coords``. + """ + coords = _xyz_to_coords(coords, y, z) + if indices is None: + return lib.linestrings(coords, out=out, **kwargs) + else: + return simple_geometries_1d(coords, indices, GeometryType.LINESTRING, out=out) + + +@multithreading_enabled +def linearrings(coords, y=None, z=None, indices=None, out=None, **kwargs): + """Create an array of linearrings. + + If the provided coords do not constitute a closed linestring, or if there + are only 3 provided coords, the first + coordinate is duplicated at the end to close the ring. This function will + raise an exception if a linearring contains less than three points or if + the terminal coordinates contain NaN (not-a-number). + + Parameters + ---------- + coords : array_like + An array of lists of coordinate tuples (2- or 3-dimensional) or, if ``y`` + is provided, an array of lists of x coordinates + y : array_like, optional + z : array_like, optional + indices : array_like, optional + Indices into the target array where input coordinates belong. If + provided, the coords should be 2D with shape (N, 2) or (N, 3) and + indices should be an array of shape (N,) with integers in increasing + order. Missing indices result in a ValueError unless ``out`` is + provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + linestrings + + Examples + -------- + >>> linearrings([[0, 0], [0, 1], [1, 1], [0, 0]]) + + >>> linearrings([[0, 0], [0, 1], [1, 1]]) + + + Notes + ----- + - Usage of the ``y`` and ``z`` arguments will prevents lazy evaluation in ``dask``. + Instead provide the coordinates as a ``(..., 2)`` or ``(..., 3)`` array using only ``coords``. + """ + coords = _xyz_to_coords(coords, y, z) + if indices is None: + return lib.linearrings(coords, out=out, **kwargs) + else: + return simple_geometries_1d(coords, indices, GeometryType.LINEARRING, out=out) + + +@multithreading_enabled +def polygons(geometries, holes=None, indices=None, out=None, **kwargs): + """Create an array of polygons. + + Parameters + ---------- + geometries : array_like + An array of linearrings or coordinates (see linearrings). + Unless ``indices`` are given (see description below), this + include the outer shells only. The ``holes`` argument should be used + to create polygons with holes. + holes : array_like, optional + An array of lists of linearrings that constitute holes for each shell. + Not to be used in combination with ``indices``. + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, the holes are expected to be present inside ``geometries``; + the first geometry for each index is the outer shell + and all subsequent geometries in that index are the holes. + Both geometries and indices should be 1D and have matching sizes. + Indices should be in increasing order. Missing indices result in a ValueError + unless ``out`` is provided, in which case the original value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + Polygons are constructed from rings: + + >>> ring_1 = linearrings([[0, 0], [0, 10], [10, 10], [10, 0]]) + >>> ring_2 = linearrings([[2, 6], [2, 7], [3, 7], [3, 6]]) + >>> polygons([ring_1, ring_2])[0] + + >>> polygons([ring_1, ring_2])[1] + + + Or from coordinates directly: + + >>> polygons([[0, 0], [0, 10], [10, 10], [10, 0]]) + + + Adding holes can be done using the ``holes`` keyword argument: + + >>> polygons(ring_1, holes=[ring_2]) + + + Or using the ``indices`` argument: + + >>> polygons([ring_1, ring_2], indices=[0, 1])[0] + + >>> polygons([ring_1, ring_2], indices=[0, 1])[1] + + >>> polygons([ring_1, ring_2], indices=[0, 0])[0] + + + Missing input values (``None``) are ignored and may result in an + empty polygon: + + >>> polygons(None) + + >>> polygons(ring_1, holes=[None]) + + >>> polygons([ring_1, None], indices=[0, 0])[0] + + """ + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = linearrings(geometries) + + if indices is not None: + if holes is not None: + raise TypeError("Cannot specify separate holes array when using indices.") + return collections_1d(geometries, indices, GeometryType.POLYGON, out=out) + + if holes is None: + # no holes provided: initialize an empty holes array matching shells + shape = geometries.shape + (0,) if isinstance(geometries, np.ndarray) else (0,) + holes = np.empty(shape, dtype=object) + else: + holes = np.asarray(holes) + # convert holes coordinates into linearrings + if np.issubdtype(holes.dtype, np.number): + holes = linearrings(holes) + + return lib.polygons(geometries, holes, out=out, **kwargs) + + +@multithreading_enabled +def box(xmin, ymin, xmax, ymax, ccw=True, **kwargs): + """Create box polygons. + + Parameters + ---------- + xmin : array_like + ymin : array_like + xmax : array_like + ymax : array_like + ccw : bool, default True + If True, box will be created in counterclockwise direction starting + from bottom right coordinate (xmax, ymin). + If False, box will be created in clockwise direction starting from + bottom left coordinate (xmin, ymin). + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> box(0, 0, 1, 1) + + >>> box(0, 0, 1, 1, ccw=False) + + + """ + return lib.box(xmin, ymin, xmax, ymax, ccw, **kwargs) + + +@multithreading_enabled +def multipoints(geometries, indices=None, out=None, **kwargs): + """Create multipoints from arrays of points + + Parameters + ---------- + geometries : array_like + An array of points or coordinates (see points). + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + Examples + -------- + Multipoints are constructed from points: + + >>> point_1 = points([1, 1]) + >>> point_2 = points([2, 2]) + >>> multipoints([point_1, point_2]) + + >>> multipoints([[point_1, point_2], [point_2, None]]).tolist() + [, ] + + Or from coordinates directly: + + >>> multipoints([[0, 0], [2, 2], [3, 3]]) + + + Multiple multipoints of different sizes can be constructed efficiently using the + ``indices`` keyword argument: + + >>> multipoints([point_1, point_2, point_2], indices=[0, 0, 1]).tolist() + [, ] + + Missing input values (``None``) are ignored and may result in an + empty multipoint: + + >>> multipoints([None]) + + >>> multipoints([point_1, None], indices=[0, 0]).tolist() + [] + >>> multipoints([point_1, None], indices=[0, 1]).tolist() + [, ] + """ + typ = GeometryType.MULTIPOINT + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = points(geometries) + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +@multithreading_enabled +def multilinestrings(geometries, indices=None, out=None, **kwargs): + """Create multilinestrings from arrays of linestrings + + Parameters + ---------- + geometries : array_like + An array of linestrings or coordinates (see linestrings). + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + multipoints + """ + typ = GeometryType.MULTILINESTRING + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = linestrings(geometries) + + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +@multithreading_enabled +def multipolygons(geometries, indices=None, out=None, **kwargs): + """Create multipolygons from arrays of polygons + + Parameters + ---------- + geometries : array_like + An array of polygons or coordinates (see polygons). + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + multipoints + """ + typ = GeometryType.MULTIPOLYGON + geometries = np.asarray(geometries) + if not isinstance(geometries, Geometry) and np.issubdtype( + geometries.dtype, np.number + ): + geometries = polygons(geometries) + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +@multithreading_enabled +def geometrycollections(geometries, indices=None, out=None, **kwargs): + """Create geometrycollections from arrays of geometries + + Parameters + ---------- + geometries : array_like + An array of geometries + indices : array_like, optional + Indices into the target array where input geometries belong. If + provided, both geometries and indices should be 1D and have matching + sizes. Indices should be in increasing order. Missing indices result + in a ValueError unless ``out`` is provided, in which case the original + value in ``out`` is kept. + out : ndarray, optional + An array (with dtype object) to output the geometries into. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + Ignored if ``indices`` is provided. + + See also + -------- + multipoints + """ + typ = GeometryType.GEOMETRYCOLLECTION + if indices is None: + return lib.create_collection(geometries, typ, out=out, **kwargs) + else: + return collections_1d(geometries, indices, typ, out=out) + + +def prepare(geometry, **kwargs): + """Prepare a geometry, improving performance of other operations. + + A prepared geometry is a normal geometry with added information such as an + index on the line segments. This improves the performance of the following operations: + contains, contains_properly, covered_by, covers, crosses, disjoint, intersects, + overlaps, touches, and within. + + Note that if a prepared geometry is modified, the newly created Geometry object is + not prepared. In that case, ``prepare`` should be called again. + + This function does not recompute previously prepared geometries; + it is efficient to call this function on an array that partially contains prepared geometries. + + This function does not return any values; geometries are modified in place. + + Parameters + ---------- + geometry : Geometry or array_like + Geometries are changed in place + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_prepared : Identify whether a geometry is prepared already. + destroy_prepared : Destroy the prepared part of a geometry. + + Examples + -------- + >>> from shapely import Point, buffer, prepare, contains_properly + >>> poly = buffer(Point(1.0, 1.0), 1) + >>> prepare(poly) + >>> contains_properly(poly, [Point(0.0, 0.0), Point(0.5, 0.5)]).tolist() + [False, True] + """ + lib.prepare(geometry, **kwargs) + + +def destroy_prepared(geometry, **kwargs): + """Destroy the prepared part of a geometry, freeing up memory. + + Note that the prepared geometry will always be cleaned up if the geometry itself + is dereferenced. This function needs only be called in very specific circumstances, + such as freeing up memory without losing the geometries, or benchmarking. + + Parameters + ---------- + geometry : Geometry or array_like + Geometries are changed inplace + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare + """ + lib.destroy_prepared(geometry, **kwargs) + + +def empty(shape, geom_type=None, order="C"): + """Create a geometry array prefilled with None or with empty geometries. + + Parameters + ---------- + shape : int or tuple of int + Shape of the empty array, e.g., ``(2, 3)`` or ``2``. + geom_type : shapely.GeometryType, optional + The desired geometry type in case the array should be prefilled + with empty geometries. Default ``None``. + order : {'C', 'F'}, optional, default: 'C' + Whether to store multi-dimensional data in row-major + (C-style) or column-major (Fortran-style) order in + memory. + + Examples + -------- + >>> empty((2, 3)).tolist() + [[None, None, None], [None, None, None]] + >>> empty(2, geom_type=GeometryType.POINT).tolist() + [, ] + """ + if geom_type is None: + return np.empty(shape, dtype=object, order=order) + + geom_type = GeometryType(geom_type) # cast int to GeometryType + if geom_type is GeometryType.MISSING: + return np.empty(shape, dtype=object, order=order) + + fill_value = from_wkt(geom_type.name + " EMPTY") + return np.full(shape, fill_value, dtype=object, order=order) diff --git a/shapely/python/shapely/decorators.py b/shapely/python/shapely/decorators.py new file mode 100644 index 0000000..cae6a0d --- /dev/null +++ b/shapely/python/shapely/decorators.py @@ -0,0 +1,82 @@ +import os +from functools import wraps + +import numpy as np + +from . import lib +from .errors import UnsupportedGEOSVersionError + + +class requires_geos: + def __init__(self, version): + if version.count(".") != 2: + raise ValueError("Version must be .. format") + self.version = tuple(int(x) for x in version.split(".")) + + def __call__(self, func): + is_compatible = lib.geos_version >= self.version + is_doc_build = os.environ.get("SPHINX_DOC_BUILD") == "1" # set in docs/conf.py + if is_compatible and not is_doc_build: + return func # return directly, do not change the docstring + + msg = "'{}' requires at least GEOS {}.{}.{}.".format( + func.__name__, *self.version + ) + if is_compatible: + + @wraps(func) + def wrapped(*args, **kwargs): + return func(*args, **kwargs) + + else: + + @wraps(func) + def wrapped(*args, **kwargs): + raise UnsupportedGEOSVersionError(msg) + + doc = wrapped.__doc__ + if doc: + # Insert the message at the first double newline + position = doc.find("\n\n") + 2 + # Figure out the indentation level + indent = 2 + while True: + if doc[position + indent] == " ": + indent += 1 + else: + break + wrapped.__doc__ = doc.replace( + "\n\n", "\n\n{}.. note:: {}\n\n".format(" " * indent, msg), 1 + ) + + return wrapped + + +def multithreading_enabled(func): + """Prepare multithreading by setting the writable flags of object type + ndarrays to False. + + NB: multithreading also requires the GIL to be released, which is done in + the C extension (ufuncs.c).""" + + @wraps(func) + def wrapped(*args, **kwargs): + array_args = [ + arg for arg in args if isinstance(arg, np.ndarray) and arg.dtype == object + ] + [ + arg + for name, arg in kwargs.items() + if name not in {"where", "out"} + and isinstance(arg, np.ndarray) + and arg.dtype == object + ] + old_flags = [arr.flags.writeable for arr in array_args] + try: + for arr in array_args: + arr.flags.writeable = False + return func(*args, **kwargs) + finally: + for arr, old_flag in zip(array_args, old_flags): + arr.flags.writeable = old_flag + + return wrapped diff --git a/shapely/python/shapely/errors.py b/shapely/python/shapely/errors.py new file mode 100644 index 0000000..8610472 --- /dev/null +++ b/shapely/python/shapely/errors.py @@ -0,0 +1,81 @@ +"""Shapely errors.""" +import threading + +from shapely.lib import _setup_signal_checks, GEOSException, ShapelyError # NOQA + + +def setup_signal_checks(interval=10000): + """This enables Python signal checks in the ufunc inner loops. + + Doing so allows termination (using CTRL+C) of operations on large arrays of vectors. + + Parameters + ---------- + interval : int, default 10000 + Check for interrupts every x iterations. The higher the number, the slower + shapely will respond to a signal. However, at low values there will be a negative effect + on performance. The default of 10000 does not have any measureable effects on performance. + + Notes + ----- + For more information on signals consult the Python docs: + + https://docs.python.org/3/library/signal.html + """ + if interval <= 0: + raise ValueError("Signal checks interval must be greater than zero.") + + _setup_signal_checks(interval, threading.main_thread().ident) + + +class UnsupportedGEOSVersionError(ShapelyError): + """Raised when the GEOS library version does not support a certain operation.""" + + +class DimensionError(ShapelyError): + """An error in the number of coordinate dimensions.""" + + +class TopologicalError(ShapelyError): + """A geometry is invalid or topologically incorrect.""" + + +class ShapelyDeprecationWarning(FutureWarning): + """ + Warning for features that will be removed or behaviour that will be + changed in a future release. + """ + + +class EmptyPartError(ShapelyError): + """An error signifying an empty part was encountered when creating a multi-part.""" + + +class GeometryTypeError(ShapelyError): + """ + An error raised when the type of the geometry in question is + unrecognized or inappropriate. + """ + + +def __getattr__(name): + import warnings + + # Alias Shapely 1.8 error classes to ShapelyError with deprecation warning + if name in [ + "ReadingError", + "WKBReadingError", + "WKTReadingError", + "PredicateError", + "InvalidGeometryError", + ]: + warnings.warn( + f"{name} is deprecated and will be removed in a future version. " + "Use ShapelyError instead (functions previously raising {name} " + "will now raise a ShapelyError instead).", + DeprecationWarning, + stacklevel=2, + ) + return ShapelyError + + raise AttributeError(f"module 'shapely.errors' has no attribute '{name}'") diff --git a/shapely/python/shapely/geometry/__init__.py b/shapely/python/shapely/geometry/__init__.py new file mode 100644 index 0000000..dd92266 --- /dev/null +++ b/shapely/python/shapely/geometry/__init__.py @@ -0,0 +1,28 @@ +"""Geometry classes and factories +""" + +from .base import CAP_STYLE, JOIN_STYLE +from .collection import GeometryCollection +from .geo import box, mapping, shape +from .linestring import LineString +from .multilinestring import MultiLineString +from .multipoint import MultiPoint +from .multipolygon import MultiPolygon +from .point import Point +from .polygon import LinearRing, Polygon + +__all__ = [ + "box", + "shape", + "mapping", + "Point", + "LineString", + "Polygon", + "MultiPoint", + "MultiLineString", + "MultiPolygon", + "GeometryCollection", + "LinearRing", + "CAP_STYLE", + "JOIN_STYLE", +] diff --git a/shapely/python/shapely/geometry/__pycache__/__init__.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b292376 Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/__init__.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/base.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/base.cpython-311.pyc new file mode 100644 index 0000000..003cff6 Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/base.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/collection.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/collection.cpython-311.pyc new file mode 100644 index 0000000..8083e7f Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/collection.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/conftest.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/conftest.cpython-311.pyc new file mode 100644 index 0000000..709317e Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/conftest.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/geo.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/geo.cpython-311.pyc new file mode 100644 index 0000000..bbe648d Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/geo.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/linestring.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/linestring.cpython-311.pyc new file mode 100644 index 0000000..9c8f36b Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/linestring.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/multilinestring.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/multilinestring.cpython-311.pyc new file mode 100644 index 0000000..3241902 Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/multilinestring.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/multipoint.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/multipoint.cpython-311.pyc new file mode 100644 index 0000000..f436d01 Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/multipoint.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/multipolygon.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/multipolygon.cpython-311.pyc new file mode 100644 index 0000000..c6d9a8b Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/multipolygon.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/point.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/point.cpython-311.pyc new file mode 100644 index 0000000..693a2fc Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/point.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/__pycache__/polygon.cpython-311.pyc b/shapely/python/shapely/geometry/__pycache__/polygon.cpython-311.pyc new file mode 100644 index 0000000..7f86f1e Binary files /dev/null and b/shapely/python/shapely/geometry/__pycache__/polygon.cpython-311.pyc differ diff --git a/shapely/python/shapely/geometry/base.py b/shapely/python/shapely/geometry/base.py new file mode 100644 index 0000000..a035570 --- /dev/null +++ b/shapely/python/shapely/geometry/base.py @@ -0,0 +1,994 @@ +"""Base geometry class and utilities + +Note: a third, z, coordinate value may be used when constructing +geometry objects, but has no effect on geometric analysis. All +operations are performed in the x-y plane. Thus, geometries with +different z values may intersect or be equal. +""" +import re +from warnings import warn + +import numpy as np + +import shapely +from shapely._geometry_helpers import _geom_factory +from shapely.constructive import BufferCapStyle, BufferJoinStyle +from shapely.coords import CoordinateSequence +from shapely.errors import GeometryTypeError, GEOSException, ShapelyDeprecationWarning + +GEOMETRY_TYPES = [ + "Point", + "LineString", + "LinearRing", + "Polygon", + "MultiPoint", + "MultiLineString", + "MultiPolygon", + "GeometryCollection", +] + + +def geom_factory(g, parent=None): + """ + Creates a Shapely geometry instance from a pointer to a GEOS geometry. + + .. warning:: + The GEOS library used to create the the GEOS geometry pointer + and the GEOS library used by Shapely must be exactly the same, or + unexpected results or segfaults may occur. + + .. deprecated:: 2.0 + Deprecated in Shapely 2.0, and will be removed in a future version. + """ + warn( + "The 'geom_factory' function is deprecated in Shapely 2.0, and will be " + "removed in a future version", + DeprecationWarning, + stacklevel=2, + ) + return _geom_factory(g) + + +def dump_coords(geom): + """Dump coordinates of a geometry in the same order as data packing""" + if not isinstance(geom, BaseGeometry): + raise ValueError( + "Must be instance of a geometry class; found " + geom.__class__.__name__ + ) + elif geom.geom_type in ("Point", "LineString", "LinearRing"): + return geom.coords[:] + elif geom.geom_type == "Polygon": + return geom.exterior.coords[:] + [i.coords[:] for i in geom.interiors] + elif geom.geom_type.startswith("Multi") or geom.geom_type == "GeometryCollection": + # Recursive call + return [dump_coords(part) for part in geom.geoms] + else: + raise GeometryTypeError("Unhandled geometry type: " + repr(geom.geom_type)) + + +def _maybe_unpack(result): + if result.ndim == 0: + # convert numpy 0-d array / scalar to python scalar + return result.item() + else: + # >=1 dim array + return result + + +class CAP_STYLE: + round = BufferCapStyle.round + flat = BufferCapStyle.flat + square = BufferCapStyle.square + + +class JOIN_STYLE: + round = BufferJoinStyle.round + mitre = BufferJoinStyle.mitre + bevel = BufferJoinStyle.bevel + + +class BaseGeometry(shapely.Geometry): + """ + Provides GEOS spatial predicates and topological operations. + + """ + + __slots__ = [] + + def __new__(self): + warn( + "Directly calling the base class 'BaseGeometry()' is deprecated, and " + "will raise an error in the future. To create an empty geometry, " + "use one of the subclasses instead, for example 'GeometryCollection()'.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") + + @property + def _ndim(self): + return shapely.get_coordinate_dimension(self) + + def __bool__(self): + return self.is_empty is False + + def __nonzero__(self): + return self.__bool__() + + def __format__(self, format_spec): + """Format a geometry using a format specification.""" + # bypass regexp for simple cases + if format_spec == "": + return shapely.to_wkt(self, rounding_precision=-1) + elif format_spec == "x": + return shapely.to_wkb(self, hex=True).lower() + elif format_spec == "X": + return shapely.to_wkb(self, hex=True) + + # fmt: off + format_spec_regexp = ( + "(?:0?\\.(?P[0-9]+))?" + "(?P[fFgGxX]?)" + ) + # fmt: on + match = re.fullmatch(format_spec_regexp, format_spec) + if match is None: + raise ValueError(f"invalid format specifier: {format_spec}") + + prec, fmt_code = match.groups() + + if prec: + prec = int(prec) + else: + # GEOS has a default rounding_precision -1 + prec = -1 + + if not fmt_code: + fmt_code = "g" + + if fmt_code in ("g", "G"): + res = shapely.to_wkt(self, rounding_precision=prec, trim=True) + elif fmt_code in ("f", "F"): + res = shapely.to_wkt(self, rounding_precision=prec, trim=False) + elif fmt_code in ("x", "X"): + raise ValueError("hex representation does not specify precision") + else: + raise NotImplementedError(f"unhandled fmt_code: {fmt_code}") + + if fmt_code.isupper(): + return res.upper() + else: + return res + + def __repr__(self): + try: + wkt = super().__str__() + except (GEOSException, ValueError): + # we never want a repr() to fail; that can be very confusing + return "".format( + self.__class__.__name__ + ) + + # the total length is limited to 80 characters including brackets + max_length = 78 + if len(wkt) > max_length: + return f"<{wkt[: max_length - 3]}...>" + + return f"<{wkt}>" + + def __str__(self): + return self.wkt + + def __reduce__(self): + return (shapely.from_wkb, (shapely.to_wkb(self, include_srid=True),)) + + # Operators + # --------- + + def __and__(self, other): + return self.intersection(other) + + def __or__(self, other): + return self.union(other) + + def __sub__(self, other): + return self.difference(other) + + def __xor__(self, other): + return self.symmetric_difference(other) + + # Coordinate access + # ----------------- + + @property + def coords(self): + """Access to geometry's coordinates (CoordinateSequence)""" + coords_array = shapely.get_coordinates(self, include_z=self.has_z) + return CoordinateSequence(coords_array) + + @property + def xy(self): + """Separate arrays of X and Y coordinate values""" + raise NotImplementedError + + # Python feature protocol + + @property + def __geo_interface__(self): + """Dictionary representation of the geometry""" + raise NotImplementedError + + # Type of geometry and its representations + # ---------------------------------------- + + def geometryType(self): + warn( + "The 'GeometryType()' method is deprecated, and will be removed in " + "the future. You can use the 'geom_type' attribute instead.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return self.geom_type + + @property + def type(self): + warn( + "The 'type' attribute is deprecated, and will be removed in " + "the future. You can use the 'geom_type' attribute instead.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return self.geom_type + + @property + def wkt(self): + """WKT representation of the geometry""" + # TODO(shapely-2.0) keep default of not trimming? + return shapely.to_wkt(self, rounding_precision=-1) + + @property + def wkb(self): + """WKB representation of the geometry""" + return shapely.to_wkb(self) + + @property + def wkb_hex(self): + """WKB hex representation of the geometry""" + return shapely.to_wkb(self, hex=True) + + def svg(self, scale_factor=1.0, **kwargs): + """Raises NotImplementedError""" + raise NotImplementedError + + def _repr_svg_(self): + """SVG representation for iPython notebook""" + svg_top = ( + '" + else: + # Establish SVG canvas that will fit all the data + small space + xmin, ymin, xmax, ymax = self.bounds + if xmin == xmax and ymin == ymax: + # This is a point; buffer using an arbitrary size + xmin, ymin, xmax, ymax = self.buffer(1).bounds + else: + # Expand bounds by a fraction of the data ranges + expand = 0.04 # or 4%, same as R plots + widest_part = max([xmax - xmin, ymax - ymin]) + expand_amount = widest_part * expand + xmin -= expand_amount + ymin -= expand_amount + xmax += expand_amount + ymax += expand_amount + dx = xmax - xmin + dy = ymax - ymin + width = min([max([100.0, dx]), 300]) + height = min([max([100.0, dy]), 300]) + try: + scale_factor = max([dx, dy]) / max([width, height]) + except ZeroDivisionError: + scale_factor = 1.0 + view_box = f"{xmin} {ymin} {dx} {dy}" + transform = f"matrix(1,0,0,-1,0,{ymax + ymin})" + return svg_top + ( + 'width="{1}" height="{2}" viewBox="{0}" ' + 'preserveAspectRatio="xMinYMin meet">' + '{4}' + ).format(view_box, width, height, transform, self.svg(scale_factor)) + + @property + def geom_type(self): + """Name of the geometry's type, such as 'Point'""" + return GEOMETRY_TYPES[shapely.get_type_id(self)] + + # Real-valued properties and methods + # ---------------------------------- + + @property + def area(self): + """Unitless area of the geometry (float)""" + return float(shapely.area(self)) + + def distance(self, other): + """Unitless distance to other geometry (float)""" + return _maybe_unpack(shapely.distance(self, other)) + + def hausdorff_distance(self, other): + """Unitless hausdorff distance to other geometry (float)""" + return _maybe_unpack(shapely.hausdorff_distance(self, other)) + + @property + def length(self): + """Unitless length of the geometry (float)""" + return float(shapely.length(self)) + + @property + def minimum_clearance(self): + """Unitless distance by which a node could be moved to produce an invalid geometry (float)""" + return float(shapely.minimum_clearance(self)) + + # Topological properties + # ---------------------- + + @property + def boundary(self): + """Returns a lower dimension geometry that bounds the object + + The boundary of a polygon is a line, the boundary of a line is a + collection of points. The boundary of a point is an empty (null) + collection. + """ + return shapely.boundary(self) + + @property + def bounds(self): + """Returns minimum bounding region (minx, miny, maxx, maxy)""" + return tuple(shapely.bounds(self).tolist()) + + @property + def centroid(self): + """Returns the geometric center of the object""" + return shapely.centroid(self) + + def point_on_surface(self): + """Returns a point guaranteed to be within the object, cheaply. + + Alias of `representative_point`. + """ + return shapely.point_on_surface(self) + + def representative_point(self): + """Returns a point guaranteed to be within the object, cheaply. + + Alias of `point_on_surface`. + """ + return shapely.point_on_surface(self) + + @property + def convex_hull(self): + """Imagine an elastic band stretched around the geometry: that's a + convex hull, more or less + + The convex hull of a three member multipoint, for example, is a + triangular polygon. + """ + return shapely.convex_hull(self) + + @property + def envelope(self): + """A figure that envelopes the geometry""" + return shapely.envelope(self) + + @property + def oriented_envelope(self): + """ + Returns the oriented envelope (minimum rotated rectangle) that + encloses the geometry. + + Unlike envelope this rectangle is not constrained to be parallel to the + coordinate axes. If the convex hull of the object is a degenerate (line + or point) this degenerate is returned. + + Alias of `minimum_rotated_rectangle`. + """ + return shapely.oriented_envelope(self) + + @property + def minimum_rotated_rectangle(self): + """ + Returns the oriented envelope (minimum rotated rectangle) that + encloses the geometry. + + Unlike `envelope` this rectangle is not constrained to be parallel to the + coordinate axes. If the convex hull of the object is a degenerate (line + or point) this degenerate is returned. + + Alias of `oriented_envelope`. + """ + return shapely.oriented_envelope(self) + + def buffer( + self, + distance, + quad_segs=16, + cap_style="round", + join_style="round", + mitre_limit=5.0, + single_sided=False, + **kwargs, + ): + """Get a geometry that represents all points within a distance + of this geometry. + + A positive distance produces a dilation, a negative distance an + erosion. A very small or zero distance may sometimes be used to + "tidy" a polygon. + + Parameters + ---------- + distance : float + The distance to buffer around the object. + resolution : int, optional + The resolution of the buffer around each vertex of the + object. + quad_segs : int, optional + Sets the number of line segments used to approximate an + angle fillet. + cap_style : shapely.BufferCapStyle or {'round', 'square', 'flat'}, default 'round' + Specifies the shape of buffered line endings. BufferCapStyle.round ('round') + results in circular line endings (see ``quad_segs``). Both BufferCapStyle.square + ('square') and BufferCapStyle.flat ('flat') result in rectangular line endings, + only BufferCapStyle.flat ('flat') will end at the original vertex, + while BufferCapStyle.square ('square') involves adding the buffer width. + join_style : shapely.BufferJoinStyle or {'round', 'mitre', 'bevel'}, default 'round' + Specifies the shape of buffered line midpoints. BufferJoinStyle.ROUND ('round') + results in rounded shapes. BufferJoinStyle.bevel ('bevel') results in a beveled + edge that touches the original vertex. BufferJoinStyle.mitre ('mitre') results + in a single vertex that is beveled depending on the ``mitre_limit`` parameter. + mitre_limit : float, optional + The mitre limit ratio is used for very sharp corners. The + mitre ratio is the ratio of the distance from the corner to + the end of the mitred offset corner. When two line segments + meet at a sharp angle, a miter join will extend the original + geometry. To prevent unreasonable geometry, the mitre limit + allows controlling the maximum length of the join corner. + Corners with a ratio which exceed the limit will be beveled. + single_side : bool, optional + The side used is determined by the sign of the buffer + distance: + + a positive distance indicates the left-hand side + a negative distance indicates the right-hand side + + The single-sided buffer of point geometries is the same as + the regular buffer. The End Cap Style for single-sided + buffers is always ignored, and forced to the equivalent of + CAP_FLAT. + quadsegs : int, optional + Deprecated alias for `quad_segs`. + + Returns + ------- + Geometry + + Notes + ----- + The return value is a strictly two-dimensional geometry. All + Z coordinates of the original geometry will be ignored. + + Examples + -------- + >>> from shapely.wkt import loads + >>> g = loads('POINT (0.0 0.0)') + + 16-gon approx of a unit radius circle: + + >>> g.buffer(1.0).area # doctest: +ELLIPSIS + 3.1365484905459... + + 128-gon approximation: + + >>> g.buffer(1.0, 128).area # doctest: +ELLIPSIS + 3.141513801144... + + triangle approximation: + + >>> g.buffer(1.0, 3).area + 3.0 + >>> list(g.buffer(1.0, cap_style=BufferCapStyle.square).exterior.coords) + [(1.0, 1.0), (1.0, -1.0), (-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0)] + >>> g.buffer(1.0, cap_style=BufferCapStyle.square).area + 4.0 + + """ + quadsegs = kwargs.pop("quadsegs", None) + if quadsegs is not None: + warn( + "The `quadsegs` argument is deprecated. Use `quad_segs` instead.", + FutureWarning, + ) + quad_segs = quadsegs + + # TODO deprecate `resolution` keyword for shapely 2.1 + resolution = kwargs.pop("resolution", None) + if resolution is not None: + quad_segs = resolution + if kwargs: + kwarg = list(kwargs.keys())[0] # noqa + raise TypeError(f"buffer() got an unexpected keyword argument '{kwarg}'") + + if mitre_limit == 0.0: + raise ValueError("Cannot compute offset from zero-length line segment") + elif not np.isfinite(distance).all(): + raise ValueError("buffer distance must be finite") + + return shapely.buffer( + self, + distance, + quad_segs=quad_segs, + cap_style=cap_style, + join_style=join_style, + mitre_limit=mitre_limit, + single_sided=single_sided, + ) + + def simplify(self, tolerance, preserve_topology=True): + """Returns a simplified geometry produced by the Douglas-Peucker + algorithm + + Coordinates of the simplified geometry will be no more than the + tolerance distance from the original. Unless the topology preserving + option is used, the algorithm may produce self-intersecting or + otherwise invalid geometries. + """ + return shapely.simplify(self, tolerance, preserve_topology=preserve_topology) + + def normalize(self): + """Converts geometry to normal form (or canonical form). + + This method orders the coordinates, rings of a polygon and parts of + multi geometries consistently. Typically useful for testing purposes + (for example in combination with `equals_exact`). + + Examples + -------- + >>> from shapely import MultiLineString + >>> line = MultiLineString([[(0, 0), (1, 1)], [(3, 3), (2, 2)]]) + >>> line.normalize() + + """ + return shapely.normalize(self) + + # Overlay operations + # --------------------------- + + def difference(self, other, grid_size=None): + """ + Returns the difference of the geometries. + + Refer to `shapely.difference` for full documentation. + """ + return shapely.difference(self, other, grid_size=grid_size) + + def intersection(self, other, grid_size=None): + """ + Returns the intersection of the geometries. + + Refer to `shapely.intersection` for full documentation. + """ + return shapely.intersection(self, other, grid_size=grid_size) + + def symmetric_difference(self, other, grid_size=None): + """ + Returns the symmetric difference of the geometries. + + Refer to `shapely.symmetric_difference` for full documentation. + """ + return shapely.symmetric_difference(self, other, grid_size=grid_size) + + def union(self, other, grid_size=None): + """ + Returns the union of the geometries. + + Refer to `shapely.union` for full documentation. + """ + return shapely.union(self, other, grid_size=grid_size) + + # Unary predicates + # ---------------- + + @property + def has_z(self): + """True if the geometry's coordinate sequence(s) have z values (are + 3-dimensional)""" + return bool(shapely.has_z(self)) + + @property + def is_empty(self): + """True if the set of points in this geometry is empty, else False""" + return bool(shapely.is_empty(self)) + + @property + def is_ring(self): + """True if the geometry is a closed ring, else False""" + return bool(shapely.is_ring(self)) + + @property + def is_closed(self): + """True if the geometry is closed, else False + + Applicable only to 1-D geometries.""" + if self.geom_type == "LinearRing": + return True + return bool(shapely.is_closed(self)) + + @property + def is_simple(self): + """True if the geometry is simple, meaning that any self-intersections + are only at boundary points, else False""" + return bool(shapely.is_simple(self)) + + @property + def is_valid(self): + """True if the geometry is valid (definition depends on sub-class), + else False""" + return bool(shapely.is_valid(self)) + + # Binary predicates + # ----------------- + + def relate(self, other): + """Returns the DE-9IM intersection matrix for the two geometries + (string)""" + return shapely.relate(self, other) + + def covers(self, other): + """Returns True if the geometry covers the other, else False""" + return _maybe_unpack(shapely.covers(self, other)) + + def covered_by(self, other): + """Returns True if the geometry is covered by the other, else False""" + return _maybe_unpack(shapely.covered_by(self, other)) + + def contains(self, other): + """Returns True if the geometry contains the other, else False""" + return _maybe_unpack(shapely.contains(self, other)) + + def contains_properly(self, other): + """ + Returns True if the geometry completely contains the other, with no + common boundary points, else False + + Refer to `shapely.contains_properly` for full documentation. + """ + return _maybe_unpack(shapely.contains_properly(self, other)) + + def crosses(self, other): + """Returns True if the geometries cross, else False""" + return _maybe_unpack(shapely.crosses(self, other)) + + def disjoint(self, other): + """Returns True if geometries are disjoint, else False""" + return _maybe_unpack(shapely.disjoint(self, other)) + + def equals(self, other): + """Returns True if geometries are equal, else False. + + This method considers point-set equality (or topological + equality), and is equivalent to (self.within(other) & + self.contains(other)). + + Examples + -------- + >>> LineString( + ... [(0, 0), (2, 2)] + ... ).equals( + ... LineString([(0, 0), (1, 1), (2, 2)]) + ... ) + True + + Returns + ------- + bool + + """ + return _maybe_unpack(shapely.equals(self, other)) + + def intersects(self, other): + """Returns True if geometries intersect, else False""" + return _maybe_unpack(shapely.intersects(self, other)) + + def overlaps(self, other): + """Returns True if geometries overlap, else False""" + return _maybe_unpack(shapely.overlaps(self, other)) + + def touches(self, other): + """Returns True if geometries touch, else False""" + return _maybe_unpack(shapely.touches(self, other)) + + def within(self, other): + """Returns True if geometry is within the other, else False""" + return _maybe_unpack(shapely.within(self, other)) + + def dwithin(self, other, distance): + """ + Returns True if geometry is within a given distance from the other, else False. + + Refer to `shapely.dwithin` for full documentation. + """ + return _maybe_unpack(shapely.dwithin(self, other, distance)) + + def equals_exact(self, other, tolerance): + """True if geometries are equal to within a specified + tolerance. + + Parameters + ---------- + other : BaseGeometry + The other geometry object in this comparison. + tolerance : float + Absolute tolerance in the same units as coordinates. + + This method considers coordinate equality, which requires + coordinates to be equal and in the same order for all components + of a geometry. + + Because of this it is possible for "equals()" to be True for two + geometries and "equals_exact()" to be False. + + Examples + -------- + >>> LineString( + ... [(0, 0), (2, 2)] + ... ).equals_exact( + ... LineString([(0, 0), (1, 1), (2, 2)]), + ... 1e-6 + ... ) + False + + Returns + ------- + bool + + """ + return _maybe_unpack(shapely.equals_exact(self, other, tolerance)) + + def almost_equals(self, other, decimal=6): + """True if geometries are equal at all coordinates to a + specified decimal place. + + .. deprecated:: 1.8.0 + The 'almost_equals()' method is deprecated + and will be removed in Shapely 2.1 because the name is + confusing. The 'equals_exact()' method should be used + instead. + + Refers to approximate coordinate equality, which requires + coordinates to be approximately equal and in the same order for + all components of a geometry. + + Because of this it is possible for "equals()" to be True for two + geometries and "almost_equals()" to be False. + + Examples + -------- + >>> LineString( + ... [(0, 0), (2, 2)] + ... ).equals_exact( + ... LineString([(0, 0), (1, 1), (2, 2)]), + ... 1e-6 + ... ) + False + + Returns + ------- + bool + + """ + warn( + "The 'almost_equals()' method is deprecated and will be " + "removed in Shapely 2.1; use 'equals_exact()' instead", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return self.equals_exact(other, 0.5 * 10 ** (-decimal)) + + def relate_pattern(self, other, pattern): + """Returns True if the DE-9IM string code for the relationship between + the geometries satisfies the pattern, else False""" + return _maybe_unpack(shapely.relate_pattern(self, other, pattern)) + + # Linear referencing + # ------------------ + + def line_locate_point(self, other, normalized=False): + """Returns the distance along this geometry to a point nearest the + specified point + + If the normalized arg is True, return the distance normalized to the + length of the linear geometry. + + Alias of `project`. + """ + return shapely.line_locate_point(self, other, normalized=normalized) + + def project(self, other, normalized=False): + """Returns the distance along this geometry to a point nearest the + specified point + + If the normalized arg is True, return the distance normalized to the + length of the linear geometry. + + Alias of `line_locate_point`. + """ + return shapely.line_locate_point(self, other, normalized=normalized) + + def line_interpolate_point(self, distance, normalized=False): + """Return a point at the specified distance along a linear geometry + + Negative length values are taken as measured in the reverse + direction from the end of the geometry. Out-of-range index + values are handled by clamping them to the valid range of values. + If the normalized arg is True, the distance will be interpreted as a + fraction of the geometry's length. + + Alias of `interpolate`. + """ + return shapely.line_interpolate_point(self, distance, normalized=normalized) + + def interpolate(self, distance, normalized=False): + """Return a point at the specified distance along a linear geometry + + Negative length values are taken as measured in the reverse + direction from the end of the geometry. Out-of-range index + values are handled by clamping them to the valid range of values. + If the normalized arg is True, the distance will be interpreted as a + fraction of the geometry's length. + + Alias of `line_interpolate_point`. + """ + return shapely.line_interpolate_point(self, distance, normalized=normalized) + + def segmentize(self, max_segment_length): + """Adds vertices to line segments based on maximum segment length. + + Additional vertices will be added to every line segment in an input geometry + so that segments are no longer than the provided maximum segment length. New + vertices will evenly subdivide each segment. + + Only linear components of input geometries are densified; other geometries + are returned unmodified. + + Parameters + ---------- + max_segment_length : float or array_like + Additional vertices will be added so that all line segments are no + longer this value. Must be greater than 0. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> LineString([(0, 0), (0, 10)]).segmentize(max_segment_length=5) + + >>> Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]).segmentize(max_segment_length=5) + + """ + return shapely.segmentize(self, max_segment_length) + + def reverse(self): + """Returns a copy of this geometry with the order of coordinates reversed. + + If the geometry is a polygon with interior rings, the interior rings are also + reversed. + + Points are unchanged. + + See also + -------- + is_ccw : Checks if a geometry is clockwise. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> LineString([(0, 0), (1, 2)]).reverse() + + >>> Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]).reverse() + + """ + return shapely.reverse(self) + + +class BaseMultipartGeometry(BaseGeometry): + + __slots__ = [] + + @property + def coords(self): + raise NotImplementedError( + "Sub-geometries may have coordinate sequences, " + "but multi-part geometries do not" + ) + + @property + def geoms(self): + return GeometrySequence(self) + + def __bool__(self): + return self.is_empty is False + + def svg(self, scale_factor=1.0, color=None): + """Returns a group of SVG elements for the multipart geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + color : str, optional + Hex string for stroke or fill color. Default is to use "#66cc99" + if geometry is valid, and "#ff3333" if invalid. + """ + if self.is_empty: + return "" + if color is None: + color = "#66cc99" if self.is_valid else "#ff3333" + return "" + "".join(p.svg(scale_factor, color) for p in self.geoms) + "" + + +class GeometrySequence: + """ + Iterative access to members of a homogeneous multipart geometry. + """ + + # Attributes + # ---------- + # _parent : object + # Parent (Shapely) geometry + _parent = None + + def __init__(self, parent): + self._parent = parent + + def _get_geom_item(self, i): + return shapely.get_geometry(self._parent, i) + + def __iter__(self): + for i in range(self.__len__()): + yield self._get_geom_item(i) + + def __len__(self): + return shapely.get_num_geometries(self._parent) + + def __getitem__(self, key): + m = self.__len__() + if isinstance(key, (int, np.integer)): + if key + m < 0 or key >= m: + raise IndexError("index out of range") + if key < 0: + i = m + key + else: + i = key + return self._get_geom_item(i) + elif isinstance(key, slice): + res = [] + start, stop, stride = key.indices(m) + for i in range(start, stop, stride): + res.append(self._get_geom_item(i)) + return type(self._parent)(res or None) + else: + raise TypeError("key must be an index or slice") + + +class EmptyGeometry(BaseGeometry): + def __new__(self): + """Create an empty geometry.""" + warn( + "The 'EmptyGeometry()' constructor to create an empty geometry is " + "deprecated, and will raise an error in the future. Use one of the " + "geometry subclasses instead, for example 'GeometryCollection()'.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") diff --git a/shapely/python/shapely/geometry/collection.py b/shapely/python/shapely/geometry/collection.py new file mode 100644 index 0000000..83a85bc --- /dev/null +++ b/shapely/python/shapely/geometry/collection.py @@ -0,0 +1,58 @@ +"""Multi-part collections of geometries +""" + +import shapely +from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry + + +class GeometryCollection(BaseMultipartGeometry): + """ + A collection of one or more geometries that may contain more than one type + of geometry. + + Parameters + ---------- + geoms : list + A list of shapely geometry instances, which may be of varying + geometry types. + + Attributes + ---------- + geoms : sequence + A sequence of Shapely geometry instances + + Examples + -------- + Create a GeometryCollection with a Point and a LineString + + >>> from shapely import LineString, Point + >>> p = Point(51, -1) + >>> l = LineString([(52, -1), (49, 2)]) + >>> gc = GeometryCollection([p, l]) + """ + + __slots__ = [] + + def __new__(self, geoms=None): + if not geoms: + # TODO better empty constructor + return shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") + if isinstance(geoms, BaseGeometry): + # TODO(shapely-2.0) do we actually want to split Multi-part geometries? + # this is needed for the split() tests + if hasattr(geoms, "geoms"): + geoms = geoms.geoms + else: + geoms = [geoms] + + return shapely.geometrycollections(geoms) + + @property + def __geo_interface__(self): + geometries = [] + for geom in self.geoms: + geometries.append(geom.__geo_interface__) + return dict(type="GeometryCollection", geometries=geometries) + + +shapely.lib.registry[7] = GeometryCollection diff --git a/shapely/python/shapely/geometry/conftest.py b/shapely/python/shapely/geometry/conftest.py new file mode 100644 index 0000000..e248019 --- /dev/null +++ b/shapely/python/shapely/geometry/conftest.py @@ -0,0 +1,10 @@ +"""Autouse fixtures for doctests.""" + +import pytest + +from .linestring import LineString + + +@pytest.fixture(autouse=True) +def add_linestring(doctest_namespace): + doctest_namespace["LineString"] = LineString diff --git a/shapely/python/shapely/geometry/geo.py b/shapely/python/shapely/geometry/geo.py new file mode 100644 index 0000000..aec2827 --- /dev/null +++ b/shapely/python/shapely/geometry/geo.py @@ -0,0 +1,136 @@ +""" +Geometry factories based on the geo interface +""" +import numpy as np + +from shapely.errors import GeometryTypeError + +from .collection import GeometryCollection +from .linestring import LineString +from .multilinestring import MultiLineString +from .multipoint import MultiPoint +from .multipolygon import MultiPolygon +from .point import Point +from .polygon import LinearRing, Polygon + + +def _is_coordinates_empty(coordinates): + """Helper to identify if coordinates or subset of coordinates are empty""" + + if coordinates is None: + return True + + if isinstance(coordinates, (list, tuple, np.ndarray)): + if len(coordinates) == 0: + return True + return all(map(_is_coordinates_empty, coordinates)) + else: + return False + + +def _empty_shape_for_no_coordinates(geom_type): + """Return empty counterpart for geom_type""" + if geom_type == "point": + return Point() + elif geom_type == "multipoint": + return MultiPoint() + elif geom_type == "linestring": + return LineString() + elif geom_type == "multilinestring": + return MultiLineString() + elif geom_type == "polygon": + return Polygon() + elif geom_type == "multipolygon": + return MultiPolygon() + else: + raise GeometryTypeError(f"Unknown geometry type: {geom_type!r}") + + +def box(minx, miny, maxx, maxy, ccw=True): + """Returns a rectangular polygon with configurable normal vector""" + coords = [(maxx, miny), (maxx, maxy), (minx, maxy), (minx, miny)] + if not ccw: + coords = coords[::-1] + return Polygon(coords) + + +def shape(context): + """ + Returns a new, independent geometry with coordinates *copied* from the + context. Changes to the original context will not be reflected in the + geometry object. + + Parameters + ---------- + context : + a GeoJSON-like dict, which provides a "type" member describing the type + of the geometry and "coordinates" member providing a list of coordinates, + or an object which implements __geo_interface__. + + Returns + ------- + Geometry object + + Examples + -------- + Create a Point from GeoJSON, and then create a copy using __geo_interface__. + + >>> context = {'type': 'Point', 'coordinates': [0, 1]} + >>> geom = shape(context) + >>> geom.geom_type == 'Point' + True + >>> geom.wkt + 'POINT (0 1)' + >>> geom2 = shape(geom) + >>> geom == geom2 + True + """ + if hasattr(context, "__geo_interface__"): + ob = context.__geo_interface__ + else: + ob = context + geom_type = ob.get("type").lower() + if "coordinates" in ob and _is_coordinates_empty(ob["coordinates"]): + return _empty_shape_for_no_coordinates(geom_type) + elif geom_type == "point": + return Point(ob["coordinates"]) + elif geom_type == "linestring": + return LineString(ob["coordinates"]) + elif geom_type == "linearring": + return LinearRing(ob["coordinates"]) + elif geom_type == "polygon": + return Polygon(ob["coordinates"][0], ob["coordinates"][1:]) + elif geom_type == "multipoint": + return MultiPoint(ob["coordinates"]) + elif geom_type == "multilinestring": + return MultiLineString(ob["coordinates"]) + elif geom_type == "multipolygon": + return MultiPolygon([[c[0], c[1:]] for c in ob["coordinates"]]) + elif geom_type == "geometrycollection": + geoms = [shape(g) for g in ob.get("geometries", [])] + return GeometryCollection(geoms) + else: + raise GeometryTypeError(f"Unknown geometry type: {geom_type!r}") + + +def mapping(ob): + """ + Returns a GeoJSON-like mapping from a Geometry or any + object which implements __geo_interface__ + + Parameters + ---------- + ob : + An object which implements __geo_interface__. + + Returns + ------- + dict + + Examples + -------- + >>> pt = Point(0, 0) + >>> mapping(pt) + {'type': 'Point', 'coordinates': (0.0, 0.0)} + """ + return ob.__geo_interface__ diff --git a/shapely/python/shapely/geometry/linestring.py b/shapely/python/shapely/geometry/linestring.py new file mode 100644 index 0000000..fdb7936 --- /dev/null +++ b/shapely/python/shapely/geometry/linestring.py @@ -0,0 +1,188 @@ +"""Line strings and related utilities +""" +import numpy as np + +import shapely +from shapely.geometry.base import BaseGeometry, JOIN_STYLE +from shapely.geometry.point import Point + +__all__ = ["LineString"] + + +class LineString(BaseGeometry): + """ + A geometry type composed of one or more line segments. + + A LineString is a one-dimensional feature and has a non-zero length but + zero area. It may approximate a curve and need not be straight. Unlike a + LinearRing, a LineString is not closed. + + Parameters + ---------- + coordinates : sequence + A sequence of (x, y, [,z]) numeric coordinate pairs or triples, or + an array-like with shape (N, 2) or (N, 3). + Also can be a sequence of Point objects. + + Examples + -------- + Create a LineString with two segments + + >>> a = LineString([[0, 0], [1, 0], [1, 1]]) + >>> a.length + 2.0 + """ + + __slots__ = [] + + def __new__(self, coordinates=None): + if coordinates is None: + # empty geometry + # TODO better constructor + return shapely.from_wkt("LINESTRING EMPTY") + elif isinstance(coordinates, LineString): + if type(coordinates) == LineString: + # return original objects since geometries are immutable + return coordinates + else: + # LinearRing + # TODO convert LinearRing to LineString more directly + coordinates = coordinates.coords + else: + if hasattr(coordinates, "__array__"): + coordinates = np.asarray(coordinates) + if isinstance(coordinates, np.ndarray) and np.issubdtype( + coordinates.dtype, np.number + ): + pass + else: + # check coordinates on points + def _coords(o): + if isinstance(o, Point): + return o.coords[0] + else: + return [float(c) for c in o] + + coordinates = [_coords(o) for o in coordinates] + + if len(coordinates) == 0: + # empty geometry + # TODO better constructor + should shapely.linestrings handle this? + return shapely.from_wkt("LINESTRING EMPTY") + + geom = shapely.linestrings(coordinates) + if not isinstance(geom, LineString): + raise ValueError("Invalid values passed to LineString constructor") + return geom + + @property + def __geo_interface__(self): + return {"type": "LineString", "coordinates": tuple(self.coords)} + + def svg(self, scale_factor=1.0, stroke_color=None, opacity=None): + """Returns SVG polyline element for the LineString geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + stroke_color : str, optional + Hex string for stroke color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.8 + """ + if self.is_empty: + return "" + if stroke_color is None: + stroke_color = "#66cc99" if self.is_valid else "#ff3333" + if opacity is None: + opacity = 0.8 + pnt_format = " ".join(["{},{}".format(*c) for c in self.coords]) + return ( + '' + ).format(pnt_format, 2.0 * scale_factor, stroke_color, opacity) + + @property + def xy(self): + """Separate arrays of X and Y coordinate values + + Example: + + >>> x, y = LineString([(0, 0), (1, 1)]).xy + >>> list(x) + [0.0, 1.0] + >>> list(y) + [0.0, 1.0] + """ + return self.coords.xy + + def offset_curve( + self, + distance, + quad_segs=16, + join_style=JOIN_STYLE.round, + mitre_limit=5.0, + ): + """Returns a LineString or MultiLineString geometry at a distance from + the object on its right or its left side. + + The side is determined by the sign of the `distance` parameter + (negative for right side offset, positive for left side offset). The + resolution of the buffer around each vertex of the object increases + by increasing the `quad_segs` keyword parameter. + + The join style is for outside corners between line segments. Accepted + values are JOIN_STYLE.round (1), JOIN_STYLE.mitre (2), and + JOIN_STYLE.bevel (3). + + The mitre ratio limit is used for very sharp corners. It is the ratio + of the distance from the corner to the end of the mitred offset corner. + When two line segments meet at a sharp angle, a miter join will extend + far beyond the original geometry. To prevent unreasonable geometry, the + mitre limit allows controlling the maximum length of the join corner. + Corners with a ratio which exceed the limit will be beveled. + + Note: the behaviour regarding orientation of the resulting line + depends on the GEOS version. With GEOS < 3.11, the line retains the + same direction for a left offset (positive distance) or has reverse + direction for a right offset (negative distance), and this behaviour + was documented as such in previous Shapely versions. Starting with + GEOS 3.11, the function tries to preserve the orientation of the + original line. + """ + if mitre_limit == 0.0: + raise ValueError("Cannot compute offset from zero-length line segment") + elif not np.isfinite(distance): + raise ValueError("offset_curve distance must be finite") + return shapely.offset_curve(self, distance, quad_segs, join_style, mitre_limit) + + def parallel_offset( + self, + distance, + side="right", + resolution=16, + join_style=JOIN_STYLE.round, + mitre_limit=5.0, + ): + """ + Alternative method to :meth:`offset_curve` method. + + Older alternative method to the :meth:`offset_curve` method, but uses + ``resolution`` instead of ``quad_segs`` and a ``side`` keyword + ('left' or 'right') instead of sign of the distance. This method is + kept for backwards compatibility for now, but is is recommended to + use :meth:`offset_curve` instead. + """ + if side == "right": + distance *= -1 + return self.offset_curve( + distance, + quad_segs=resolution, + join_style=join_style, + mitre_limit=mitre_limit, + ) + + +shapely.lib.registry[1] = LineString diff --git a/shapely/python/shapely/geometry/multilinestring.py b/shapely/python/shapely/geometry/multilinestring.py new file mode 100644 index 0000000..8138220 --- /dev/null +++ b/shapely/python/shapely/geometry/multilinestring.py @@ -0,0 +1,93 @@ +"""Collections of linestrings and related utilities +""" + +import shapely +from shapely.errors import EmptyPartError +from shapely.geometry import linestring +from shapely.geometry.base import BaseMultipartGeometry + +__all__ = ["MultiLineString"] + + +class MultiLineString(BaseMultipartGeometry): + """ + A collection of one or more LineStrings. + + A MultiLineString has non-zero length and zero area. + + Parameters + ---------- + lines : sequence + A sequence LineStrings, or a sequence of line-like coordinate + sequences or array-likes (see accepted input for LineString). + + Attributes + ---------- + geoms : sequence + A sequence of LineStrings + + Examples + -------- + Construct a MultiLineString containing two LineStrings. + + >>> lines = MultiLineString([[[0, 0], [1, 2]], [[4, 4], [5, 6]]]) + """ + + __slots__ = [] + + def __new__(self, lines=None): + if not lines: + # allow creation of empty multilinestrings, to support unpickling + # TODO better empty constructor + return shapely.from_wkt("MULTILINESTRING EMPTY") + elif isinstance(lines, MultiLineString): + return lines + + lines = getattr(lines, "geoms", lines) + m = len(lines) + subs = [] + for i in range(m): + line = linestring.LineString(lines[i]) + if line.is_empty: + raise EmptyPartError( + "Can't create MultiLineString with empty component" + ) + subs.append(line) + + if len(lines) == 0: + return shapely.from_wkt("MULTILINESTRING EMPTY") + + return shapely.multilinestrings(subs) + + @property + def __geo_interface__(self): + return { + "type": "MultiLineString", + "coordinates": tuple(tuple(c for c in g.coords) for g in self.geoms), + } + + def svg(self, scale_factor=1.0, stroke_color=None, opacity=None): + """Returns a group of SVG polyline elements for the LineString geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + stroke_color : str, optional + Hex string for stroke color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.8 + """ + if self.is_empty: + return "" + if stroke_color is None: + stroke_color = "#66cc99" if self.is_valid else "#ff3333" + return ( + "" + + "".join(p.svg(scale_factor, stroke_color, opacity) for p in self.geoms) + + "" + ) + + +shapely.lib.registry[5] = MultiLineString diff --git a/shapely/python/shapely/geometry/multipoint.py b/shapely/python/shapely/geometry/multipoint.py new file mode 100644 index 0000000..f08486d --- /dev/null +++ b/shapely/python/shapely/geometry/multipoint.py @@ -0,0 +1,95 @@ +"""Collections of points and related utilities +""" + +import shapely +from shapely.errors import EmptyPartError +from shapely.geometry import point +from shapely.geometry.base import BaseMultipartGeometry + +__all__ = ["MultiPoint"] + + +class MultiPoint(BaseMultipartGeometry): + """ + A collection of one or more Points. + + A MultiPoint has zero area and zero length. + + Parameters + ---------- + points : sequence + A sequence of Points, or a sequence of (x, y [,z]) numeric coordinate + pairs or triples, or an array-like of shape (N, 2) or (N, 3). + + Attributes + ---------- + geoms : sequence + A sequence of Points + + Examples + -------- + Construct a MultiPoint containing two Points + + >>> from shapely import Point + >>> ob = MultiPoint([[0.0, 0.0], [1.0, 2.0]]) + >>> len(ob.geoms) + 2 + >>> type(ob.geoms[0]) == Point + True + """ + + __slots__ = [] + + def __new__(self, points=None): + if points is None: + # allow creation of empty multipoints, to support unpickling + # TODO better empty constructor + return shapely.from_wkt("MULTIPOINT EMPTY") + elif isinstance(points, MultiPoint): + return points + + m = len(points) + subs = [] + for i in range(m): + p = point.Point(points[i]) + if p.is_empty: + raise EmptyPartError("Can't create MultiPoint with empty component") + subs.append(p) + + if len(points) == 0: + return shapely.from_wkt("MULTIPOINT EMPTY") + + return shapely.multipoints(subs) + + @property + def __geo_interface__(self): + return { + "type": "MultiPoint", + "coordinates": tuple(g.coords[0] for g in self.geoms), + } + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns a group of SVG circle elements for the MultiPoint geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG circle diameters. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + return ( + "" + + "".join(p.svg(scale_factor, fill_color, opacity) for p in self.geoms) + + "" + ) + + +shapely.lib.registry[4] = MultiPoint diff --git a/shapely/python/shapely/geometry/multipolygon.py b/shapely/python/shapely/geometry/multipolygon.py new file mode 100644 index 0000000..394ac7f --- /dev/null +++ b/shapely/python/shapely/geometry/multipolygon.py @@ -0,0 +1,123 @@ +"""Collections of polygons and related utilities +""" + +import shapely +from shapely.geometry import polygon +from shapely.geometry.base import BaseMultipartGeometry + +__all__ = ["MultiPolygon"] + + +class MultiPolygon(BaseMultipartGeometry): + """ + A collection of one or more Polygons. + + If component polygons overlap the collection is invalid and some + operations on it may fail. + + Parameters + ---------- + polygons : sequence + A sequence of Polygons, or a sequence of (shell, holes) tuples + where shell is the sequence representation of a linear ring + (see LinearRing) and holes is a sequence of such linear rings. + + Attributes + ---------- + geoms : sequence + A sequence of `Polygon` instances + + Examples + -------- + Construct a MultiPolygon from a sequence of coordinate tuples + + >>> from shapely import Polygon + >>> ob = MultiPolygon([ + ... ( + ... ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + ... [((0.1,0.1), (0.1,0.2), (0.2,0.2), (0.2,0.1))] + ... ) + ... ]) + >>> len(ob.geoms) + 1 + >>> type(ob.geoms[0]) == Polygon + True + """ + + __slots__ = [] + + def __new__(self, polygons=None): + if not polygons: + # allow creation of empty multipolygons, to support unpickling + # TODO better empty constructor + return shapely.from_wkt("MULTIPOLYGON EMPTY") + elif isinstance(polygons, MultiPolygon): + return polygons + + polygons = getattr(polygons, "geoms", polygons) + polygons = [ + p + for p in polygons + if p and not (isinstance(p, polygon.Polygon) and p.is_empty) + ] + + L = len(polygons) + + # Bail immediately if we have no input points. + if L == 0: + return shapely.from_wkt("MULTIPOLYGON EMPTY") + + # This function does not accept sequences of MultiPolygons: there is + # no implicit flattening. + if isinstance(polygons[0], MultiPolygon): + raise ValueError("Sequences of multi-polygons are not valid arguments") + + subs = [] + for i in range(L): + ob = polygons[i] + if not isinstance(ob, polygon.Polygon): + shell = ob[0] + holes = ob[1] + p = polygon.Polygon(shell, holes) + else: + p = polygon.Polygon(ob) + subs.append(p) + + return shapely.multipolygons(subs) + + @property + def __geo_interface__(self): + allcoords = [] + for geom in self.geoms: + coords = [] + coords.append(tuple(geom.exterior.coords)) + for hole in geom.interiors: + coords.append(tuple(hole.coords)) + allcoords.append(tuple(coords)) + return {"type": "MultiPolygon", "coordinates": allcoords} + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns group of SVG path elements for the MultiPolygon geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + return ( + "" + + "".join(p.svg(scale_factor, fill_color, opacity) for p in self.geoms) + + "" + ) + + +shapely.lib.registry[6] = MultiPolygon diff --git a/shapely/python/shapely/geometry/point.py b/shapely/python/shapely/geometry/point.py new file mode 100644 index 0000000..982c639 --- /dev/null +++ b/shapely/python/shapely/geometry/point.py @@ -0,0 +1,145 @@ +"""Points and related utilities +""" +import numpy as np + +import shapely +from shapely.errors import DimensionError +from shapely.geometry.base import BaseGeometry + +__all__ = ["Point"] + + +class Point(BaseGeometry): + """ + A geometry type that represents a single coordinate with + x,y and possibly z values. + + A point is a zero-dimensional feature and has zero length and zero area. + + Parameters + ---------- + args : float, or sequence of floats + The coordinates can either be passed as a single parameter, or as + individual float values using multiple parameters: + + 1) 1 parameter: a sequence or array-like of with 2 or 3 values. + 2) 2 or 3 parameters (float): x, y, and possibly z. + + Attributes + ---------- + x, y, z : float + Coordinate values + + Examples + -------- + Constructing the Point using separate parameters for x and y: + + >>> p = Point(1.0, -1.0) + + Constructing the Point using a list of x, y coordinates: + + >>> p = Point([1.0, -1.0]) + >>> print(p) + POINT (1 -1) + >>> p.y + -1.0 + >>> p.x + 1.0 + """ + + __slots__ = [] + + def __new__(self, *args): + if len(args) == 0: + # empty geometry + # TODO better constructor + return shapely.from_wkt("POINT EMPTY") + elif len(args) > 3: + raise TypeError(f"Point() takes at most 3 arguments ({len(args)} given)") + elif len(args) == 1: + coords = args[0] + if isinstance(coords, Point): + return coords + + # Accept either (x, y) or [(x, y)] + if not hasattr(coords, "__getitem__"): # generators + coords = list(coords) + coords = np.asarray(coords).squeeze() + else: + # 2 or 3 args + coords = np.array(args).squeeze() + + if coords.ndim > 1: + raise ValueError( + f"Point() takes only scalar or 1-size vector arguments, got {args}" + ) + if not np.issubdtype(coords.dtype, np.number): + coords = [float(c) for c in coords] + geom = shapely.points(coords) + if not isinstance(geom, Point): + raise ValueError("Invalid values passed to Point constructor") + return geom + + # Coordinate getters and setters + + @property + def x(self): + """Return x coordinate.""" + return shapely.get_x(self) + + @property + def y(self): + """Return y coordinate.""" + return shapely.get_y(self) + + @property + def z(self): + """Return z coordinate.""" + if not shapely.has_z(self): + raise DimensionError("This point has no z coordinate.") + # return shapely.get_z(self) -> get_z only supported for GEOS 3.7+ + return self.coords[0][2] + + @property + def __geo_interface__(self): + return {"type": "Point", "coordinates": self.coords[0]} + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns SVG circle element for the Point geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG circle diameter. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + if opacity is None: + opacity = 0.6 + return ( + '' + ).format(self, 3.0 * scale_factor, 1.0 * scale_factor, fill_color, opacity) + + @property + def xy(self): + """Separate arrays of X and Y coordinate values + + Example: + >>> x, y = Point(0, 0).xy + >>> list(x) + [0.0] + >>> list(y) + [0.0] + """ + return self.coords.xy + + +shapely.lib.registry[0] = Point diff --git a/shapely/python/shapely/geometry/polygon.py b/shapely/python/shapely/geometry/polygon.py new file mode 100644 index 0000000..9e0abce --- /dev/null +++ b/shapely/python/shapely/geometry/polygon.py @@ -0,0 +1,326 @@ +"""Polygons and their linear ring components +""" + +import numpy as np + +import shapely +from shapely.algorithms.cga import is_ccw_impl, signed_area +from shapely.errors import TopologicalError +from shapely.geometry.base import BaseGeometry +from shapely.geometry.linestring import LineString +from shapely.geometry.point import Point + +__all__ = ["Polygon", "LinearRing"] + + +def _unpickle_linearring(wkb): + linestring = shapely.from_wkb(wkb) + srid = shapely.get_srid(linestring) + linearring = shapely.linearrings(shapely.get_coordinates(linestring)) + if srid: + linearring = shapely.set_srid(linearring, srid) + return linearring + + +class LinearRing(LineString): + """ + A geometry type composed of one or more line segments + that forms a closed loop. + + A LinearRing is a closed, one-dimensional feature. + A LinearRing that crosses itself or touches itself at a single point is + invalid and operations on it may fail. + + Parameters + ---------- + coordinates : sequence + A sequence of (x, y [,z]) numeric coordinate pairs or triples, or + an array-like with shape (N, 2) or (N, 3). + Also can be a sequence of Point objects. + + Notes + ----- + Rings are automatically closed. There is no need to specify a final + coordinate pair identical to the first. + + Examples + -------- + Construct a square ring. + + >>> ring = LinearRing( ((0, 0), (0, 1), (1 ,1 ), (1 , 0)) ) + >>> ring.is_closed + True + >>> list(ring.coords) + [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)] + >>> ring.length + 4.0 + + """ + + __slots__ = [] + + def __new__(self, coordinates=None): + if coordinates is None: + # empty geometry + # TODO better way? + return shapely.from_wkt("LINEARRING EMPTY") + elif isinstance(coordinates, LineString): + if type(coordinates) == LinearRing: + # return original objects since geometries are immutable + return coordinates + elif not coordinates.is_valid: + raise TopologicalError("An input LineString must be valid.") + else: + # LineString + # TODO convert LineString to LinearRing more directly? + coordinates = coordinates.coords + + else: + if hasattr(coordinates, "__array__"): + coordinates = np.asarray(coordinates) + if isinstance(coordinates, np.ndarray) and np.issubdtype( + coordinates.dtype, np.number + ): + pass + else: + # check coordinates on points + def _coords(o): + if isinstance(o, Point): + return o.coords[0] + else: + return [float(c) for c in o] + + coordinates = np.array([_coords(o) for o in coordinates]) + if not np.issubdtype(coordinates.dtype, np.number): + # conversion of coords to 2D array failed, this might be due + # to inconsistent coordinate dimensionality + raise ValueError("Inconsistent coordinate dimensionality") + + if len(coordinates) == 0: + # empty geometry + # TODO better constructor + should shapely.linearrings handle this? + return shapely.from_wkt("LINEARRING EMPTY") + + geom = shapely.linearrings(coordinates) + if not isinstance(geom, LinearRing): + raise ValueError("Invalid values passed to LinearRing constructor") + return geom + + @property + def __geo_interface__(self): + return {"type": "LinearRing", "coordinates": tuple(self.coords)} + + def __reduce__(self): + """WKB doesn't differentiate between LineString and LinearRing so we + need to move the coordinate sequence into the correct geometry type""" + return (_unpickle_linearring, (shapely.to_wkb(self, include_srid=True),)) + + @property + def is_ccw(self): + """True is the ring is oriented counter clock-wise""" + return bool(is_ccw_impl()(self)) + + @property + def is_simple(self): + """True if the geometry is simple, meaning that any self-intersections + are only at boundary points, else False""" + return bool(shapely.is_simple(self)) + + +shapely.lib.registry[2] = LinearRing + + +class InteriorRingSequence: + + _parent = None + _ndim = None + _index = 0 + _length = 0 + + def __init__(self, parent): + self._parent = parent + self._ndim = parent._ndim + + def __iter__(self): + self._index = 0 + self._length = self.__len__() + return self + + def __next__(self): + if self._index < self._length: + ring = self._get_ring(self._index) + self._index += 1 + return ring + else: + raise StopIteration + + def __len__(self): + return shapely.get_num_interior_rings(self._parent) + + def __getitem__(self, key): + m = self.__len__() + if isinstance(key, int): + if key + m < 0 or key >= m: + raise IndexError("index out of range") + if key < 0: + i = m + key + else: + i = key + return self._get_ring(i) + elif isinstance(key, slice): + res = [] + start, stop, stride = key.indices(m) + for i in range(start, stop, stride): + res.append(self._get_ring(i)) + return res + else: + raise TypeError("key must be an index or slice") + + def _get_ring(self, i): + return shapely.get_interior_ring(self._parent, i) + + +class Polygon(BaseGeometry): + """ + A geometry type representing an area that is enclosed by a linear ring. + + A polygon is a two-dimensional feature and has a non-zero area. It may + have one or more negative-space "holes" which are also bounded by linear + rings. If any rings cross each other, the feature is invalid and + operations on it may fail. + + Parameters + ---------- + shell : sequence + A sequence of (x, y [,z]) numeric coordinate pairs or triples, or + an array-like with shape (N, 2) or (N, 3). + Also can be a sequence of Point objects. + holes : sequence + A sequence of objects which satisfy the same requirements as the + shell parameters above + + Attributes + ---------- + exterior : LinearRing + The ring which bounds the positive space of the polygon. + interiors : sequence + A sequence of rings which bound all existing holes. + + Examples + -------- + Create a square polygon with no holes + + >>> coords = ((0., 0.), (0., 1.), (1., 1.), (1., 0.), (0., 0.)) + >>> polygon = Polygon(coords) + >>> polygon.area + 1.0 + """ + + __slots__ = [] + + def __new__(self, shell=None, holes=None): + if shell is None: + # empty geometry + # TODO better way? + return shapely.from_wkt("POLYGON EMPTY") + elif isinstance(shell, Polygon): + # return original objects since geometries are immutable + return shell + else: + shell = LinearRing(shell) + + if holes is not None: + if len(holes) == 0: + # shapely constructor cannot handle holes=[] + holes = None + else: + holes = [LinearRing(ring) for ring in holes] + + geom = shapely.polygons(shell, holes=holes) + if not isinstance(geom, Polygon): + raise ValueError("Invalid values passed to Polygon constructor") + return geom + + @property + def exterior(self): + return shapely.get_exterior_ring(self) + + @property + def interiors(self): + if self.is_empty: + return [] + return InteriorRingSequence(self) + + @property + def coords(self): + raise NotImplementedError( + "Component rings have coordinate sequences, but the polygon does not" + ) + + @property + def __geo_interface__(self): + if self.exterior == LinearRing(): + coords = [] + else: + coords = [tuple(self.exterior.coords)] + for hole in self.interiors: + coords.append(tuple(hole.coords)) + return {"type": "Polygon", "coordinates": tuple(coords)} + + def svg(self, scale_factor=1.0, fill_color=None, opacity=None): + """Returns SVG path element for the Polygon geometry. + + Parameters + ========== + scale_factor : float + Multiplication factor for the SVG stroke-width. Default is 1. + fill_color : str, optional + Hex string for fill color. Default is to use "#66cc99" if + geometry is valid, and "#ff3333" if invalid. + opacity : float + Float number between 0 and 1 for color opacity. Default value is 0.6 + """ + if self.is_empty: + return "" + if fill_color is None: + fill_color = "#66cc99" if self.is_valid else "#ff3333" + if opacity is None: + opacity = 0.6 + exterior_coords = [["{},{}".format(*c) for c in self.exterior.coords]] + interior_coords = [ + ["{},{}".format(*c) for c in interior.coords] for interior in self.interiors + ] + path = " ".join( + [ + "M {} L {} z".format(coords[0], " L ".join(coords[1:])) + for coords in exterior_coords + interior_coords + ] + ) + return ( + '' + ).format(2.0 * scale_factor, path, fill_color, opacity) + + @classmethod + def from_bounds(cls, xmin, ymin, xmax, ymax): + """Construct a `Polygon()` from spatial bounds.""" + return cls([(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)]) + + +shapely.lib.registry[3] = Polygon + + +def orient(polygon, sign=1.0): + s = float(sign) + rings = [] + ring = polygon.exterior + if signed_area(ring) / s >= 0.0: + rings.append(ring) + else: + rings.append(list(ring.coords)[::-1]) + for ring in polygon.interiors: + if signed_area(ring) / s <= 0.0: + rings.append(ring) + else: + rings.append(list(ring.coords)[::-1]) + return Polygon(rings[0], rings[1:]) diff --git a/shapely/python/shapely/geos.py b/shapely/python/shapely/geos.py new file mode 100644 index 0000000..3648d0d --- /dev/null +++ b/shapely/python/shapely/geos.py @@ -0,0 +1,8 @@ +""" +Proxies for libgeos, GEOS-specific exceptions, and utilities +""" +import shapely + +geos_version_string = shapely.geos_capi_version_string +geos_version = shapely.geos_version +geos_capi_version = shapely.geos_capi_version diff --git a/shapely/python/shapely/io.py b/shapely/python/shapely/io.py new file mode 100644 index 0000000..705fe57 --- /dev/null +++ b/shapely/python/shapely/io.py @@ -0,0 +1,378 @@ +import numpy as np + +from . import lib +from ._enum import ParamEnum + +# include ragged array functions here for reference documentation purpose +from ._ragged_array import from_ragged_array, to_ragged_array +from .decorators import requires_geos +from .errors import UnsupportedGEOSVersionError + +__all__ = [ + "from_geojson", + "from_ragged_array", + "from_wkb", + "from_wkt", + "to_geojson", + "to_ragged_array", + "to_wkb", + "to_wkt", +] + + +# Allowed options for handling WKB/WKT decoding errors +# Note: cannot use standard constructor since "raise" is a keyword +DecodingErrorOptions = ParamEnum( + "DecodingErrorOptions", {"ignore": 0, "warn": 1, "raise": 2} +) + +WKBFlavorOptions = ParamEnum("WKBFlavorOptions", {"extended": 1, "iso": 2}) + + +def to_wkt( + geometry, + rounding_precision=6, + trim=True, + output_dimension=3, + old_3d=False, + **kwargs, +): + """ + Converts to the Well-Known Text (WKT) representation of a Geometry. + + The Well-known Text format is defined in the `OGC Simple Features + Specification for SQL `__. + + The following limitations apply to WKT serialization: + + - for GEOS <= 3.8 a multipoint with an empty sub-geometry will raise an exception + - for GEOS <= 3.8 empty geometries are always serialized to 2D + - for GEOS >= 3.9 only simple empty geometries can be 3D, collections are still + always 2D + + Parameters + ---------- + geometry : Geometry or array_like + rounding_precision : int, default 6 + The rounding precision when writing the WKT string. Set to a value of + -1 to indicate the full precision. + trim : bool, default True + If True, trim unnecessary decimals (trailing zeros). + output_dimension : int, default 3 + The output dimension for the WKT string. Supported values are 2 and 3. + Specifying 3 means that up to 3 dimensions will be written but 2D + geometries will still be represented as 2D in the WKT string. + old_3d : bool, default False + Enable old style 3D/4D WKT generation. By default, new style 3D/4D WKT + (ie. "POINT Z (10 20 30)") is returned, but with ``old_3d=True`` + the WKT will be formatted in the style "POINT (10 20 30)". + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> to_wkt(Point(0, 0)) + 'POINT (0 0)' + >>> to_wkt(Point(0, 0), rounding_precision=3, trim=False) + 'POINT (0.000 0.000)' + >>> to_wkt(Point(0, 0), rounding_precision=-1, trim=False) + 'POINT (0.0000000000000000 0.0000000000000000)' + >>> to_wkt(Point(1, 2, 3), trim=True) + 'POINT Z (1 2 3)' + >>> to_wkt(Point(1, 2, 3), trim=True, output_dimension=2) + 'POINT (1 2)' + >>> to_wkt(Point(1, 2, 3), trim=True, old_3d=True) + 'POINT (1 2 3)' + + Notes + ----- + The defaults differ from the default of the GEOS library. To mimic this, + use:: + + to_wkt(geometry, rounding_precision=-1, trim=False, output_dimension=2) + + """ + if not np.isscalar(rounding_precision): + raise TypeError("rounding_precision only accepts scalar values") + if not np.isscalar(trim): + raise TypeError("trim only accepts scalar values") + if not np.isscalar(output_dimension): + raise TypeError("output_dimension only accepts scalar values") + if not np.isscalar(old_3d): + raise TypeError("old_3d only accepts scalar values") + + return lib.to_wkt( + geometry, + np.intc(rounding_precision), + np.bool_(trim), + np.intc(output_dimension), + np.bool_(old_3d), + **kwargs, + ) + + +def to_wkb( + geometry, + hex=False, + output_dimension=3, + byte_order=-1, + include_srid=False, + flavor="extended", + **kwargs, +): + r""" + Converts to the Well-Known Binary (WKB) representation of a Geometry. + + The Well-Known Binary format is defined in the `OGC Simple Features + Specification for SQL `__. + + The following limitations apply to WKB serialization: + + - linearrings will be converted to linestrings + - a point with only NaN coordinates is converted to an empty point + - for GEOS <= 3.7, empty points are always serialized to 3D if + output_dimension=3, and to 2D if output_dimension=2 + - for GEOS == 3.8, empty points are always serialized to 2D + + Parameters + ---------- + geometry : Geometry or array_like + hex : bool, default False + If true, export the WKB as a hexidecimal string. The default is to + return a binary bytes object. + output_dimension : int, default 3 + The output dimension for the WKB. Supported values are 2 and 3. + Specifying 3 means that up to 3 dimensions will be written but 2D + geometries will still be represented as 2D in the WKB represenation. + byte_order : int, default -1 + Defaults to native machine byte order (-1). Use 0 to force big endian + and 1 for little endian. + include_srid : bool, default False + If True, the SRID is be included in WKB (this is an extension + to the OGC WKB specification). Not allowed when flavor is "iso". + flavor : {"iso", "extended"}, default "extended" + Which flavor of WKB will be returned. The flavor determines how + extra dimensionality is encoded with the type number, and whether + SRID can be included in the WKB. ISO flavor is "more standard" for + 3D output, and does not support SRID embedding. + Both flavors are equivalent when ``output_dimension=2`` (or with 2D + geometries) and ``include_srid=False``. + The `from_wkb` function can read both flavors. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> point = Point(1, 1) + >>> to_wkb(point, byte_order=1) + b'\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?' + >>> to_wkb(point, hex=True, byte_order=1) + '0101000000000000000000F03F000000000000F03F' + """ + if not np.isscalar(hex): + raise TypeError("hex only accepts scalar values") + if not np.isscalar(output_dimension): + raise TypeError("output_dimension only accepts scalar values") + if not np.isscalar(byte_order): + raise TypeError("byte_order only accepts scalar values") + if not np.isscalar(include_srid): + raise TypeError("include_srid only accepts scalar values") + if not np.isscalar(flavor): + raise TypeError("flavor only accepts scalar values") + if lib.geos_version < (3, 10, 0) and flavor == "iso": + raise UnsupportedGEOSVersionError( + 'The "iso" option requires at least GEOS 3.10.0' + ) + if flavor == "iso" and include_srid: + raise ValueError('flavor="iso" and include_srid=True cannot be used together') + flavor = WKBFlavorOptions.get_value(flavor) + + return lib.to_wkb( + geometry, + np.bool_(hex), + np.intc(output_dimension), + np.intc(byte_order), + np.bool_(include_srid), + np.intc(flavor), + **kwargs, + ) + + +@requires_geos("3.10.0") +def to_geojson(geometry, indent=None, **kwargs): + """Converts to the GeoJSON representation of a Geometry. + + The GeoJSON format is defined in the `RFC 7946 `__. + NaN (not-a-number) coordinates will be written as 'null'. + + The following are currently unsupported: + + - Geometries of type LINEARRING: these are output as 'null'. + - Three-dimensional geometries: the third dimension is ignored. + + Parameters + ---------- + geometry : str, bytes or array_like + indent : int, optional + If indent is a non-negative integer, then GeoJSON will be formatted. + An indent level of 0 will only insert newlines. None (the default) + selects the most compact representation. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point + >>> point = Point(1, 1) + >>> to_geojson(point) + '{"type":"Point","coordinates":[1.0,1.0]}' + >>> print(to_geojson(point, indent=2)) + { + "type": "Point", + "coordinates": [ + 1.0, + 1.0 + ] + } + """ + # GEOS Tickets: + # - handle linearrings: https://trac.osgeo.org/geos/ticket/1140 + # - support 3D: https://trac.osgeo.org/geos/ticket/1141 + if indent is None: + indent = -1 + elif not np.isscalar(indent): + raise TypeError("indent only accepts scalar values") + elif indent < 0: + raise ValueError("indent cannot be negative") + + return lib.to_geojson(geometry, np.intc(indent), **kwargs) + + +def from_wkt(geometry, on_invalid="raise", **kwargs): + """ + Creates geometries from the Well-Known Text (WKT) representation. + + The Well-known Text format is defined in the `OGC Simple Features + Specification for SQL `__. + + Parameters + ---------- + geometry : str or array_like + The WKT string(s) to convert. + on_invalid : {"raise", "warn", "ignore"}, default "raise" + - raise: an exception will be raised if WKT input geometries are invalid. + - warn: a warning will be raised and invalid WKT geometries will be + returned as ``None``. + - ignore: invalid WKT geometries will be returned as ``None`` without a warning. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from_wkt('POINT (0 0)') + + """ + if not np.isscalar(on_invalid): + raise TypeError("on_invalid only accepts scalar values") + + invalid_handler = np.uint8(DecodingErrorOptions.get_value(on_invalid)) + + return lib.from_wkt(geometry, invalid_handler, **kwargs) + + +def from_wkb(geometry, on_invalid="raise", **kwargs): + r""" + Creates geometries from the Well-Known Binary (WKB) representation. + + The Well-Known Binary format is defined in the `OGC Simple Features + Specification for SQL `__. + + + Parameters + ---------- + geometry : str or array_like + The WKB byte object(s) to convert. + on_invalid : {"raise", "warn", "ignore"}, default "raise" + - raise: an exception will be raised if a WKB input geometry is invalid. + - warn: a warning will be raised and invalid WKB geometries will be + returned as ``None``. + - ignore: invalid WKB geometries will be returned as ``None`` without a warning. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from_wkb(b'\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?') + + """ + + if not np.isscalar(on_invalid): + raise TypeError("on_invalid only accepts scalar values") + + invalid_handler = np.uint8(DecodingErrorOptions.get_value(on_invalid)) + + # ensure the input has object dtype, to avoid numpy inferring it as a + # fixed-length string dtype (which removes trailing null bytes upon access + # of array elements) + geometry = np.asarray(geometry, dtype=object) + return lib.from_wkb(geometry, invalid_handler, **kwargs) + + +@requires_geos("3.10.1") +def from_geojson(geometry, on_invalid="raise", **kwargs): + """Creates geometries from GeoJSON representations (strings). + + If a GeoJSON is a FeatureCollection, it is read as a single geometry + (with type GEOMETRYCOLLECTION). This may be unpacked using the ``pygeos.get_parts``. + Properties are not read. + + The GeoJSON format is defined in `RFC 7946 `__. + + The following are currently unsupported: + + - Three-dimensional geometries: the third dimension is ignored. + - Geometries having 'null' in the coordinates. + + Parameters + ---------- + geometry : str, bytes or array_like + The GeoJSON string or byte object(s) to convert. + on_invalid : {"raise", "warn", "ignore"}, default "raise" + - raise: an exception will be raised if an input GeoJSON is invalid. + - warn: a warning will be raised and invalid input geometries will be + returned as ``None``. + - ignore: invalid input geometries will be returned as ``None`` without a warning. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_parts + + Examples + -------- + >>> from_geojson('{"type": "Point","coordinates": [1, 2]}') + + """ + # GEOS Tickets: + # - support 3D: https://trac.osgeo.org/geos/ticket/1141 + # - handle null coordinates: https://trac.osgeo.org/geos/ticket/1142 + if not np.isscalar(on_invalid): + raise TypeError("on_invalid only accepts scalar values") + + invalid_handler = np.uint8(DecodingErrorOptions.get_value(on_invalid)) + + # ensure the input has object dtype, to avoid numpy inferring it as a + # fixed-length string dtype (which removes trailing null bytes upon access + # of array elements) + geometry = np.asarray(geometry, dtype=object) + + return lib.from_geojson(geometry, invalid_handler, **kwargs) diff --git a/shapely/python/shapely/lib.cpython-311-x86_64-linux-gnu.so b/shapely/python/shapely/lib.cpython-311-x86_64-linux-gnu.so new file mode 100755 index 0000000..009a7e0 Binary files /dev/null and b/shapely/python/shapely/lib.cpython-311-x86_64-linux-gnu.so differ diff --git a/shapely/python/shapely/linear.py b/shapely/python/shapely/linear.py new file mode 100644 index 0000000..6512dd5 --- /dev/null +++ b/shapely/python/shapely/linear.py @@ -0,0 +1,208 @@ +from . import lib +from .decorators import multithreading_enabled +from .errors import UnsupportedGEOSVersionError + +__all__ = [ + "line_interpolate_point", + "line_locate_point", + "line_merge", + "shared_paths", + "shortest_line", +] + + +@multithreading_enabled +def line_interpolate_point(line, distance, normalized=False, **kwargs): + """Returns a point interpolated at given distance on a line. + + Parameters + ---------- + line : Geometry or array_like + For multilinestrings or geometrycollections, the first geometry is taken + and the rest is ignored. This function raises a TypeError for non-linear + geometries. For empty linear geometries, empty points are returned. + distance : float or array_like + Negative values measure distance from the end of the line. Out-of-range + values will be clipped to the line endings. + normalized : bool, default False + If True, the distance is a fraction of the total + line length instead of the absolute distance. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 2), (0, 10)]) + >>> line_interpolate_point(line, 2) + + >>> line_interpolate_point(line, 100) + + >>> line_interpolate_point(line, -2) + + >>> line_interpolate_point(line, [0.25, -0.25], normalized=True).tolist() + [, ] + >>> line_interpolate_point(LineString(), 1) + + """ + if normalized: + return lib.line_interpolate_point_normalized(line, distance) + else: + return lib.line_interpolate_point(line, distance) + + +@multithreading_enabled +def line_locate_point(line, other, normalized=False, **kwargs): + """Returns the distance to the line origin of given point. + + If given point does not intersect with the line, the point will first be + projected onto the line after which the distance is taken. + + Parameters + ---------- + line : Geometry or array_like + point : Geometry or array_like + normalized : bool, default False + If True, the distance is a fraction of the total + line length instead of the absolute distance. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 2), (0, 10)]) + >>> point = Point(4, 4) + >>> line_locate_point(line, point) + 2.0 + >>> line_locate_point(line, point, normalized=True) + 0.25 + >>> line_locate_point(line, Point(0, 18)) + 8.0 + >>> line_locate_point(LineString(), point) + nan + """ + if normalized: + return lib.line_locate_point_normalized(line, other) + else: + return lib.line_locate_point(line, other) + + +@multithreading_enabled +def line_merge(line, directed=False, **kwargs): + """Returns (Multi)LineStrings formed by combining the lines in a + MultiLineString. + + Lines are joined together at their endpoints in case two lines are + intersecting. Lines are not joined when 3 or more lines are intersecting at + the endpoints. Line elements that cannot be joined are kept as is in the + resulting MultiLineString. + + The direction of each merged LineString will be that of the majority of the + LineStrings from which it was derived. Except if ``directed=True`` is + specified, then the operation will not change the order of points within + lines and so only lines which can be joined with no change in direction + are merged. + + Parameters + ---------- + line : Geometry or array_like + directed : bool, default False + Only combine lines if possible without changing point order. + Requires GEOS >= 3.11.0 + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiLineString + >>> line_merge(MultiLineString([[(0, 2), (0, 10)], [(0, 10), (5, 10)]])) + + >>> line_merge(MultiLineString([[(0, 2), (0, 10)], [(0, 11), (5, 10)]])) + + >>> line_merge(MultiLineString()) + + >>> line_merge(MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]])) + + >>> line_merge(MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]]), directed=True) + + """ + if directed: + if lib.geos_version < (3, 11, 0): + raise UnsupportedGEOSVersionError( + "'{}' requires at least GEOS {}.{}.{}.".format( + "line_merge", *(3, 11, 0) + ) + ) + return lib.line_merge_directed(line, **kwargs) + return lib.line_merge(line, **kwargs) + + +@multithreading_enabled +def shared_paths(a, b, **kwargs): + """Returns the shared paths between geom1 and geom2. + + Both geometries should be linestrings or arrays of linestrings. + A geometrycollection or array of geometrycollections is returned + with two elements in each geometrycollection. The first element is a + multilinestring containing shared paths with the same direction + for both inputs. The second element is a multilinestring containing + shared paths with the opposite direction for the two inputs. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> line2 = LineString([(1, 0), (2, 0), (2, 1), (1, 1), (1, 0)]) + >>> shared_paths(line1, line2).wkt + 'GEOMETRYCOLLECTION (MULTILINESTRING EMPTY, MULTILINESTRING ((1 0, 1 1)))' + >>> line3 = LineString([(1, 1), (0, 1)]) + >>> shared_paths(line1, line3).wkt + 'GEOMETRYCOLLECTION (MULTILINESTRING ((1 1, 0 1)), MULTILINESTRING EMPTY)' + """ + return lib.shared_paths(a, b, **kwargs) + + +@multithreading_enabled +def shortest_line(a, b, **kwargs): + """ + Returns the shortest line between two geometries. + + The resulting line consists of two points, representing the nearest + points between the geometry pair. The line always starts in the first + geometry `a` and ends in he second geometry `b`. The endpoints of the + line will not necessarily be existing vertices of the input geometries + `a` and `b`, but can also be a point along a line segment. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) (for GEOS>=3.9) + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> line2 = LineString([(0, 3), (3, 0), (5, 3)]) + >>> shortest_line(line1, line2) + + """ + return lib.shortest_line(a, b, **kwargs) diff --git a/shapely/python/shapely/measurement.py b/shapely/python/shapely/measurement.py new file mode 100644 index 0000000..ccecd3e --- /dev/null +++ b/shapely/python/shapely/measurement.py @@ -0,0 +1,335 @@ +import warnings + +import numpy as np + +from . import lib +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "area", + "distance", + "bounds", + "total_bounds", + "length", + "hausdorff_distance", + "frechet_distance", + "minimum_clearance", + "minimum_bounding_radius", +] + + +@multithreading_enabled +def area(geometry, **kwargs): + """Computes the area of a (multi)polygon. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import MultiPolygon, Polygon + >>> polygon = Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)]) + >>> area(polygon) + 100.0 + >>> area(MultiPolygon([polygon, Polygon([(10, 10), (10, 20), (20, 20), (20, 10), (10, 10)])])) + 200.0 + >>> area(Polygon()) + 0.0 + >>> area(None) + nan + """ + return lib.area(geometry, **kwargs) + + +@multithreading_enabled +def distance(a, b, **kwargs): + """Computes the Cartesian distance between two geometries. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> point = Point(0, 0) + >>> distance(Point(10, 0), point) + 10.0 + >>> distance(LineString([(1, 1), (1, -1)]), point) + 1.0 + >>> distance(Polygon([(3, 0), (5, 0), (5, 5), (3, 5), (3, 0)]), point) + 3.0 + >>> distance(Point(), point) + nan + >>> distance(None, point) + nan + """ + return lib.distance(a, b, **kwargs) + + +@multithreading_enabled +def bounds(geometry, **kwargs): + """Computes the bounds (extent) of a geometry. + + For each geometry these 4 numbers are returned: min x, min y, max x, max y. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> bounds(Point(2, 3)).tolist() + [2.0, 3.0, 2.0, 3.0] + >>> bounds(LineString([(0, 0), (0, 2), (3, 2)])).tolist() + [0.0, 0.0, 3.0, 2.0] + >>> bounds(Polygon()).tolist() + [nan, nan, nan, nan] + >>> bounds(None).tolist() + [nan, nan, nan, nan] + """ + # We need to provide the `out` argument here for compatibility with + # numpy < 1.16. See https://github.com/numpy/numpy/issues/14949 + geometry_arr = np.asarray(geometry, dtype=np.object_) + out = np.empty(geometry_arr.shape + (4,), dtype="float64") + return lib.bounds(geometry_arr, out=out, **kwargs) + + +def total_bounds(geometry, **kwargs): + """Computes the total bounds (extent) of the geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Returns + ------- + numpy ndarray of [xmin, ymin, xmax, ymax] + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> total_bounds(Point(2, 3)).tolist() + [2.0, 3.0, 2.0, 3.0] + >>> total_bounds([Point(2, 3), Point(4, 5)]).tolist() + [2.0, 3.0, 4.0, 5.0] + >>> total_bounds([ + ... LineString([(0, 1), (0, 2), (3, 2)]), + ... LineString([(4, 4), (4, 6), (6, 7)]) + ... ]).tolist() + [0.0, 1.0, 6.0, 7.0] + >>> total_bounds(Polygon()).tolist() + [nan, nan, nan, nan] + >>> total_bounds([Polygon(), Point(2, 3)]).tolist() + [2.0, 3.0, 2.0, 3.0] + >>> total_bounds(None).tolist() + [nan, nan, nan, nan] + """ + b = bounds(geometry, **kwargs) + if b.ndim == 1: + return b + + with warnings.catch_warnings(): + # ignore 'All-NaN slice encountered' warnings + warnings.simplefilter("ignore", RuntimeWarning) + return np.array( + [ + np.nanmin(b[..., 0]), + np.nanmin(b[..., 1]), + np.nanmax(b[..., 2]), + np.nanmax(b[..., 3]), + ] + ) + + +@multithreading_enabled +def length(geometry, **kwargs): + """Computes the length of a (multi)linestring or polygon perimeter. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, MultiLineString, Polygon + >>> length(LineString([(0, 0), (0, 2), (3, 2)])) + 5.0 + >>> length(MultiLineString([ + ... LineString([(0, 0), (1, 0)]), + ... LineString([(1, 0), (2, 0)]) + ... ])) + 2.0 + >>> length(Polygon([(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)])) + 40.0 + >>> length(LineString()) + 0.0 + >>> length(None) + nan + """ + return lib.length(geometry, **kwargs) + + +@multithreading_enabled +def hausdorff_distance(a, b, densify=None, **kwargs): + """Compute the discrete Hausdorff distance between two geometries. + + The Hausdorff distance is a measure of similarity: it is the greatest + distance between any point in A and the closest point in B. The discrete + distance is an approximation of this metric: only vertices are considered. + The parameter 'densify' makes this approximation less coarse by splitting + the line segments between vertices before computing the distance. + + Parameters + ---------- + a, b : Geometry or array_like + densify : float or array_like, optional + The value of densify is required to be between 0 and 1. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(130, 0), (0, 0), (0, 150)]) + >>> line2 = LineString([(10, 10), (10, 150), (130, 10)]) + >>> hausdorff_distance(line1, line2) # doctest: +ELLIPSIS + 14.14... + >>> hausdorff_distance(line1, line2, densify=0.5) + 70.0 + >>> hausdorff_distance(line1, LineString()) + nan + >>> hausdorff_distance(line1, None) + nan + """ + if densify is None: + return lib.hausdorff_distance(a, b, **kwargs) + else: + return lib.hausdorff_distance_densify(a, b, densify, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def frechet_distance(a, b, densify=None, **kwargs): + """Compute the discrete Fréchet distance between two geometries. + + The Fréchet distance is a measure of similarity: it is the greatest + distance between any point in A and the closest point in B. The discrete + distance is an approximation of this metric: only vertices are considered. + The parameter 'densify' makes this approximation less coarse by splitting + the line segments between vertices before computing the distance. + + Fréchet distance sweep continuously along their respective curves + and the direction of curves is significant. This makes it a better measure + of similarity than Hausdorff distance for curve or surface matching. + + Parameters + ---------- + a, b : Geometry or array_like + densify : float or array_like, optional + The value of densify is required to be between 0 and 1. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (100, 0)]) + >>> line2 = LineString([(0, 0), (50, 50), (100, 0)]) + >>> frechet_distance(line1, line2) # doctest: +ELLIPSIS + 70.71... + >>> frechet_distance(line1, line2, densify=0.5) + 50.0 + >>> frechet_distance(line1, LineString()) + nan + >>> frechet_distance(line1, None) + nan + """ + if densify is None: + return lib.frechet_distance(a, b, **kwargs) + return lib.frechet_distance_densify(a, b, densify, **kwargs) + + +@requires_geos("3.6.0") +@multithreading_enabled +def minimum_clearance(geometry, **kwargs): + """Computes the Minimum Clearance distance. + + A geometry's "minimum clearance" is the smallest distance by which + a vertex of the geometry could be moved to produce an invalid geometry. + + If no minimum clearance exists for a geometry (for example, a single + point, or an empty geometry), infinity is returned. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Polygon + >>> polygon = Polygon([(0, 0), (0, 10), (5, 6), (10, 10), (10, 0), (5, 4), (0, 0)]) + >>> minimum_clearance(polygon) + 2.0 + >>> minimum_clearance(Polygon()) + inf + >>> minimum_clearance(None) + nan + """ + return lib.minimum_clearance(geometry, **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def minimum_bounding_radius(geometry, **kwargs): + """Computes the radius of the minimum bounding circle that encloses an input geometry. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + >>> minimum_bounding_radius(Polygon([(0, 5), (5, 10), (10, 5), (5, 0), (0, 5)])) + 5.0 + >>> minimum_bounding_radius(LineString([(1, 1), (1, 10)])) + 4.5 + >>> minimum_bounding_radius(MultiPoint([(2, 2), (4, 2)])) + 1.0 + >>> minimum_bounding_radius(Point(0, 1)) + 0.0 + >>> minimum_bounding_radius(GeometryCollection()) + 0.0 + + See also + -------- + minimum_bounding_circle + """ + return lib.minimum_bounding_radius(geometry, **kwargs) diff --git a/shapely/python/shapely/ops.py b/shapely/python/shapely/ops.py new file mode 100644 index 0000000..3d20ee0 --- /dev/null +++ b/shapely/python/shapely/ops.py @@ -0,0 +1,746 @@ +"""Support for various GEOS geometry operations +""" + +from warnings import warn + +import shapely +from shapely.algorithms.polylabel import polylabel # noqa +from shapely.errors import GeometryTypeError, ShapelyDeprecationWarning +from shapely.geometry import ( + GeometryCollection, + LineString, + MultiLineString, + MultiPoint, + Point, + Polygon, + shape, +) +from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry +from shapely.geometry.polygon import orient as orient_ +from shapely.prepared import prep + +__all__ = [ + "cascaded_union", + "linemerge", + "operator", + "polygonize", + "polygonize_full", + "transform", + "unary_union", + "triangulate", + "voronoi_diagram", + "split", + "nearest_points", + "validate", + "snap", + "shared_paths", + "clip_by_rect", + "orient", + "substring", +] + + +class CollectionOperator: + def shapeup(self, ob): + if isinstance(ob, BaseGeometry): + return ob + else: + try: + return shape(ob) + except (ValueError, AttributeError): + return LineString(ob) + + def polygonize(self, lines): + """Creates polygons from a source of lines + + The source may be a MultiLineString, a sequence of LineString objects, + or a sequence of objects than can be adapted to LineStrings. + """ + source = getattr(lines, "geoms", None) or lines + try: + source = iter(source) + except TypeError: + source = [source] + finally: + obs = [self.shapeup(line) for line in source] + collection = shapely.polygonize(obs) + return collection.geoms + + def polygonize_full(self, lines): + """Creates polygons from a source of lines, returning the polygons + and leftover geometries. + + The source may be a MultiLineString, a sequence of LineString objects, + or a sequence of objects than can be adapted to LineStrings. + + Returns a tuple of objects: (polygons, cut edges, dangles, invalid ring + lines). Each are a geometry collection. + + Dangles are edges which have one or both ends which are not incident on + another edge endpoint. Cut edges are connected at both ends but do not + form part of polygon. Invalid ring lines form rings which are invalid + (bowties, etc). + """ + source = getattr(lines, "geoms", None) or lines + try: + source = iter(source) + except TypeError: + source = [source] + finally: + obs = [self.shapeup(line) for line in source] + return shapely.polygonize_full(obs) + + def linemerge(self, lines, directed=False): + """Merges all connected lines from a source + + The source may be a MultiLineString, a sequence of LineString objects, + or a sequence of objects than can be adapted to LineStrings. Returns a + LineString or MultiLineString when lines are not contiguous. + """ + source = None + if getattr(lines, "geom_type", None) == "MultiLineString": + source = lines + elif hasattr(lines, "geoms"): + # other Multi geometries + source = MultiLineString([ls.coords for ls in lines.geoms]) + elif hasattr(lines, "__iter__"): + try: + source = MultiLineString([ls.coords for ls in lines]) + except AttributeError: + source = MultiLineString(lines) + if source is None: + raise ValueError(f"Cannot linemerge {lines}") + return shapely.line_merge(source, directed=directed) + + def cascaded_union(self, geoms): + """Returns the union of a sequence of geometries + + .. deprecated:: 1.8 + This function was superseded by :meth:`unary_union`. + """ + warn( + "The 'cascaded_union()' function is deprecated. " + "Use 'unary_union()' instead.", + ShapelyDeprecationWarning, + stacklevel=2, + ) + return shapely.union_all(geoms, axis=None) + + def unary_union(self, geoms): + """Returns the union of a sequence of geometries + + Usually used to convert a collection into the smallest set of polygons + that cover the same area. + """ + return shapely.union_all(geoms, axis=None) + + +operator = CollectionOperator() +polygonize = operator.polygonize +polygonize_full = operator.polygonize_full +linemerge = operator.linemerge +cascaded_union = operator.cascaded_union +unary_union = operator.unary_union + + +def triangulate(geom, tolerance=0.0, edges=False): + """Creates the Delaunay triangulation and returns a list of geometries + + The source may be any geometry type. All vertices of the geometry will be + used as the points of the triangulation. + + From the GEOS documentation: + tolerance is the snapping tolerance used to improve the robustness of + the triangulation computation. A tolerance of 0.0 specifies that no + snapping will take place. + + If edges is False, a list of Polygons (triangles) will be returned. + Otherwise the list of LineString edges is returned. + + """ + collection = shapely.delaunay_triangles(geom, tolerance=tolerance, only_edges=edges) + return [g for g in collection.geoms] + + +def voronoi_diagram(geom, envelope=None, tolerance=0.0, edges=False): + """ + Constructs a Voronoi Diagram [1] from the given geometry. + Returns a list of geometries. + + Parameters + ---------- + geom: geometry + the input geometry whose vertices will be used to calculate + the final diagram. + envelope: geometry, None + clipping envelope for the returned diagram, automatically + determined if None. The diagram will be clipped to the larger + of this envelope or an envelope surrounding the sites. + tolerance: float, 0.0 + sets the snapping tolerance used to improve the robustness + of the computation. A tolerance of 0.0 specifies that no + snapping will take place. + edges: bool, False + If False, return regions as polygons. Else, return only + edges e.g. LineStrings. + + GEOS documentation can be found at [2] + + Returns + ------- + GeometryCollection + geometries representing the Voronoi regions. + + Notes + ----- + The tolerance `argument` can be finicky and is known to cause the + algorithm to fail in several cases. If you're using `tolerance` + and getting a failure, try removing it. The test cases in + tests/test_voronoi_diagram.py show more details. + + + References + ---------- + [1] https://en.wikipedia.org/wiki/Voronoi_diagram + [2] https://geos.osgeo.org/doxygen/geos__c_8h_source.html (line 730) + """ + try: + result = shapely.voronoi_polygons( + geom, tolerance=tolerance, extend_to=envelope, only_edges=edges + ) + except shapely.GEOSException as err: + errstr = "Could not create Voronoi Diagram with the specified inputs " + errstr += f"({err!s})." + if tolerance: + errstr += " Try running again with default tolerance value." + raise ValueError(errstr) from err + + if result.geom_type != "GeometryCollection": + return GeometryCollection([result]) + return result + + +def validate(geom): + return shapely.is_valid_reason(geom) + + +def transform(func, geom): + """Applies `func` to all coordinates of `geom` and returns a new + geometry of the same type from the transformed coordinates. + + `func` maps x, y, and optionally z to output xp, yp, zp. The input + parameters may iterable types like lists or arrays or single values. + The output shall be of the same type. Scalars in, scalars out. + Lists in, lists out. + + For example, here is an identity function applicable to both types + of input. + + def id_func(x, y, z=None): + return tuple(filter(None, [x, y, z])) + + g2 = transform(id_func, g1) + + Using pyproj >= 2.1, this example will accurately project Shapely geometries: + + import pyproj + + wgs84 = pyproj.CRS('EPSG:4326') + utm = pyproj.CRS('EPSG:32618') + + project = pyproj.Transformer.from_crs(wgs84, utm, always_xy=True).transform + + g2 = transform(project, g1) + + Note that the always_xy kwarg is required here as Shapely geometries only support + X,Y coordinate ordering. + + Lambda expressions such as the one in + + g2 = transform(lambda x, y, z=None: (x+1.0, y+1.0), g1) + + also satisfy the requirements for `func`. + """ + if geom.is_empty: + return geom + if geom.geom_type in ("Point", "LineString", "LinearRing", "Polygon"): + + # First we try to apply func to x, y, z sequences. When func is + # optimized for sequences, this is the fastest, though zipping + # the results up to go back into the geometry constructors adds + # extra cost. + try: + if geom.geom_type in ("Point", "LineString", "LinearRing"): + return type(geom)(zip(*func(*zip(*geom.coords)))) + elif geom.geom_type == "Polygon": + shell = type(geom.exterior)(zip(*func(*zip(*geom.exterior.coords)))) + holes = list( + type(ring)(zip(*func(*zip(*ring.coords)))) + for ring in geom.interiors + ) + return type(geom)(shell, holes) + + # A func that assumes x, y, z are single values will likely raise a + # TypeError, in which case we'll try again. + except TypeError: + if geom.geom_type in ("Point", "LineString", "LinearRing"): + return type(geom)([func(*c) for c in geom.coords]) + elif geom.geom_type == "Polygon": + shell = type(geom.exterior)([func(*c) for c in geom.exterior.coords]) + holes = list( + type(ring)([func(*c) for c in ring.coords]) + for ring in geom.interiors + ) + return type(geom)(shell, holes) + + elif geom.geom_type.startswith("Multi") or geom.geom_type == "GeometryCollection": + return type(geom)([transform(func, part) for part in geom.geoms]) + else: + raise GeometryTypeError(f"Type {geom.geom_type!r} not recognized") + + +def nearest_points(g1, g2): + """Returns the calculated nearest points in the input geometries + + The points are returned in the same order as the input geometries. + """ + seq = shapely.shortest_line(g1, g2) + if seq is None: + if g1.is_empty: + raise ValueError("The first input geometry is empty") + else: + raise ValueError("The second input geometry is empty") + + p1 = shapely.get_point(seq, 0) + p2 = shapely.get_point(seq, 1) + return (p1, p2) + + +def snap(g1, g2, tolerance): + """Snap one geometry to another with a given tolerance + + Vertices of the first geometry are snapped to vertices of the second + geometry. The resulting snapped geometry is returned. The input geometries + are not modified. + + Parameters + ---------- + g1 : geometry + The first geometry + g2 : geometry + The second geometry + tolerance : float + The snapping tolerance + + Example + ------- + >>> square = Polygon([(1,1), (2, 1), (2, 2), (1, 2), (1, 1)]) + >>> line = LineString([(0,0), (0.8, 0.8), (1.8, 0.95), (2.6, 0.5)]) + >>> result = snap(line, square, 0.5) + >>> result.wkt + 'LINESTRING (0 0, 1 1, 2 1, 2.6 0.5)' + """ + return shapely.snap(g1, g2, tolerance) + + +def shared_paths(g1, g2): + """Find paths shared between the two given lineal geometries + + Returns a GeometryCollection with two elements: + - First element is a MultiLineString containing shared paths with the + same direction for both inputs. + - Second element is a MultiLineString containing shared paths with the + opposite direction for the two inputs. + + Parameters + ---------- + g1 : geometry + The first geometry + g2 : geometry + The second geometry + """ + if not isinstance(g1, LineString): + raise GeometryTypeError("First geometry must be a LineString") + if not isinstance(g2, LineString): + raise GeometryTypeError("Second geometry must be a LineString") + return shapely.shared_paths(g1, g2) + + +class SplitOp: + @staticmethod + def _split_polygon_with_line(poly, splitter): + """Split a Polygon with a LineString""" + if not isinstance(poly, Polygon): + raise GeometryTypeError("First argument must be a Polygon") + if not isinstance(splitter, LineString): + raise GeometryTypeError("Second argument must be a LineString") + + union = poly.boundary.union(splitter) + + # greatly improves split performance for big geometries with many + # holes (the following contains checks) with minimal overhead + # for common cases + poly = prep(poly) + + # some polygonized geometries may be holes, we do not want them + # that's why we test if the original polygon (poly) contains + # an inner point of polygonized geometry (pg) + return [ + pg for pg in polygonize(union) if poly.contains(pg.representative_point()) + ] + + @staticmethod + def _split_line_with_line(line, splitter): + """Split a LineString with another (Multi)LineString or (Multi)Polygon""" + + # if splitter is a polygon, pick it's boundary + if splitter.geom_type in ("Polygon", "MultiPolygon"): + splitter = splitter.boundary + + if not isinstance(line, LineString): + raise GeometryTypeError("First argument must be a LineString") + if not isinstance(splitter, LineString) and not isinstance( + splitter, MultiLineString + ): + raise GeometryTypeError( + "Second argument must be either a LineString or a MultiLineString" + ) + + # | s\l | Interior | Boundary | Exterior | + # |----------|----------|----------|----------| + # | Interior | 0 or F | * | * | At least one of these two must be 0 + # | Boundary | 0 or F | * | * | So either '0********' or '[0F]**0*****' + # | Exterior | * | * | * | No overlapping interiors ('1********') + relation = splitter.relate(line) + if relation[0] == "1": + # The lines overlap at some segment (linear intersection of interiors) + raise ValueError("Input geometry segment overlaps with the splitter.") + elif relation[0] == "0" or relation[3] == "0": + # The splitter crosses or touches the line's interior --> return multilinestring from the split + return line.difference(splitter) + else: + # The splitter does not cross or touch the line's interior --> return collection with identity line + return [line] + + @staticmethod + def _split_line_with_point(line, splitter): + """Split a LineString with a Point""" + if not isinstance(line, LineString): + raise GeometryTypeError("First argument must be a LineString") + if not isinstance(splitter, Point): + raise GeometryTypeError("Second argument must be a Point") + + # check if point is in the interior of the line + if not line.relate_pattern(splitter, "0********"): + # point not on line interior --> return collection with single identity line + # (REASONING: Returning a list with the input line reference and creating a + # GeometryCollection at the general split function prevents unnecessary copying + # of linestrings in multipoint splitting function) + return [line] + elif line.coords[0] == splitter.coords[0]: + # if line is a closed ring the previous test doesn't behave as desired + return [line] + + # point is on line, get the distance from the first point on line + distance_on_line = line.project(splitter) + coords = list(line.coords) + # split the line at the point and create two new lines + current_position = 0.0 + for i in range(len(coords) - 1): + point1 = coords[i] + point2 = coords[i + 1] + dx = point1[0] - point2[0] + dy = point1[1] - point2[1] + segment_length = (dx**2 + dy**2) ** 0.5 + current_position += segment_length + if distance_on_line == current_position: + # splitter is exactly on a vertex + return [LineString(coords[: i + 2]), LineString(coords[i + 1 :])] + elif distance_on_line < current_position: + # splitter is between two vertices + return [ + LineString(coords[: i + 1] + [splitter.coords[0]]), + LineString([splitter.coords[0]] + coords[i + 1 :]), + ] + return [line] + + @staticmethod + def _split_line_with_multipoint(line, splitter): + """Split a LineString with a MultiPoint""" + + if not isinstance(line, LineString): + raise GeometryTypeError("First argument must be a LineString") + if not isinstance(splitter, MultiPoint): + raise GeometryTypeError("Second argument must be a MultiPoint") + + chunks = [line] + for pt in splitter.geoms: + new_chunks = [] + for chunk in filter(lambda x: not x.is_empty, chunks): + # add the newly split 2 lines or the same line if not split + new_chunks.extend(SplitOp._split_line_with_point(chunk, pt)) + chunks = new_chunks + + return chunks + + @staticmethod + def split(geom, splitter): + """ + Splits a geometry by another geometry and returns a collection of geometries. This function is the theoretical + opposite of the union of the split geometry parts. If the splitter does not split the geometry, a collection + with a single geometry equal to the input geometry is returned. + The function supports: + - Splitting a (Multi)LineString by a (Multi)Point or (Multi)LineString or (Multi)Polygon + - Splitting a (Multi)Polygon by a LineString + + It may be convenient to snap the splitter with low tolerance to the geometry. For example in the case + of splitting a line by a point, the point must be exactly on the line, for the line to be correctly split. + When splitting a line by a polygon, the boundary of the polygon is used for the operation. + When splitting a line by another line, a ValueError is raised if the two overlap at some segment. + + Parameters + ---------- + geom : geometry + The geometry to be split + splitter : geometry + The geometry that will split the input geom + + Example + ------- + >>> pt = Point((1, 1)) + >>> line = LineString([(0,0), (2,2)]) + >>> result = split(line, pt) + >>> result.wkt + 'GEOMETRYCOLLECTION (LINESTRING (0 0, 1 1), LINESTRING (1 1, 2 2))' + """ + + if geom.geom_type in ("MultiLineString", "MultiPolygon"): + return GeometryCollection( + [i for part in geom.geoms for i in SplitOp.split(part, splitter).geoms] + ) + + elif geom.geom_type == "LineString": + if splitter.geom_type in ( + "LineString", + "MultiLineString", + "Polygon", + "MultiPolygon", + ): + split_func = SplitOp._split_line_with_line + elif splitter.geom_type == "Point": + split_func = SplitOp._split_line_with_point + elif splitter.geom_type == "MultiPoint": + split_func = SplitOp._split_line_with_multipoint + else: + raise GeometryTypeError( + f"Splitting a LineString with a {splitter.geom_type} is not supported" + ) + + elif geom.geom_type == "Polygon": + if splitter.geom_type == "LineString": + split_func = SplitOp._split_polygon_with_line + else: + raise GeometryTypeError( + f"Splitting a Polygon with a {splitter.geom_type} is not supported" + ) + + else: + raise GeometryTypeError( + f"Splitting {geom.geom_type} geometry is not supported" + ) + + return GeometryCollection(split_func(geom, splitter)) + + +split = SplitOp.split + + +def substring(geom, start_dist, end_dist, normalized=False): + """Return a line segment between specified distances along a LineString + + Negative distance values are taken as measured in the reverse + direction from the end of the geometry. Out-of-range index + values are handled by clamping them to the valid range of values. + + If the start distance equals the end distance, a Point is returned. + + If the start distance is actually beyond the end distance, then the + reversed substring is returned such that the start distance is + at the first coordinate. + + Parameters + ---------- + geom : LineString + The geometry to get a substring of. + start_dist : float + The distance along `geom` of the start of the substring. + end_dist : float + The distance along `geom` of the end of the substring. + normalized : bool, False + Whether the distance parameters are interpreted as a + fraction of the geometry's length. + + Returns + ------- + Union[Point, LineString] + The substring between `start_dist` and `end_dist` or a Point + if they are at the same location. + + Raises + ------ + TypeError + If `geom` is not a LineString. + + Examples + -------- + >>> from shapely.geometry import LineString + >>> from shapely.ops import substring + >>> ls = LineString((i, 0) for i in range(6)) + >>> ls.wkt + 'LINESTRING (0 0, 1 0, 2 0, 3 0, 4 0, 5 0)' + >>> substring(ls, start_dist=1, end_dist=3).wkt + 'LINESTRING (1 0, 2 0, 3 0)' + >>> substring(ls, start_dist=3, end_dist=1).wkt + 'LINESTRING (3 0, 2 0, 1 0)' + >>> substring(ls, start_dist=1, end_dist=-3).wkt + 'LINESTRING (1 0, 2 0)' + >>> substring(ls, start_dist=0.2, end_dist=-0.6, normalized=True).wkt + 'LINESTRING (1 0, 2 0)' + + Returning a `Point` when `start_dist` and `end_dist` are at the + same location. + + >>> substring(ls, 2.5, -2.5).wkt + 'POINT (2.5 0)' + """ + + if not isinstance(geom, LineString): + raise GeometryTypeError( + "Can only calculate a substring of LineString geometries. " + f"A {geom.geom_type} was provided." + ) + + # Filter out cases in which to return a point + if start_dist == end_dist: + return geom.interpolate(start_dist, normalized) + elif not normalized and start_dist >= geom.length and end_dist >= geom.length: + return geom.interpolate(geom.length, normalized) + elif not normalized and -start_dist >= geom.length and -end_dist >= geom.length: + return geom.interpolate(0, normalized) + elif normalized and start_dist >= 1 and end_dist >= 1: + return geom.interpolate(1, normalized) + elif normalized and -start_dist >= 1 and -end_dist >= 1: + return geom.interpolate(0, normalized) + + if normalized: + start_dist *= geom.length + end_dist *= geom.length + + # Filter out cases where distances meet at a middle point from opposite ends. + if start_dist < 0 < end_dist and abs(start_dist) + end_dist == geom.length: + return geom.interpolate(end_dist) + elif end_dist < 0 < start_dist and abs(end_dist) + start_dist == geom.length: + return geom.interpolate(start_dist) + + start_point = geom.interpolate(start_dist) + end_point = geom.interpolate(end_dist) + + if start_dist < 0: + start_dist = geom.length + start_dist # Values may still be negative, + if end_dist < 0: # but only in the out-of-range + end_dist = geom.length + end_dist # sense, not the wrap-around sense. + + reverse = start_dist > end_dist + if reverse: + start_dist, end_dist = end_dist, start_dist + + if start_dist < 0: + start_dist = 0 # to avoid duplicating the first vertex + + if reverse: + vertex_list = [(end_point.x, end_point.y)] + else: + vertex_list = [(start_point.x, start_point.y)] + + coords = list(geom.coords) + current_distance = 0 + for p1, p2 in zip(coords, coords[1:]): + if start_dist < current_distance < end_dist: + vertex_list.append(p1) + elif current_distance >= end_dist: + break + + current_distance += ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** 0.5 + + if reverse: + vertex_list.append((start_point.x, start_point.y)) + # reverse direction result + vertex_list = reversed(vertex_list) + else: + vertex_list.append((end_point.x, end_point.y)) + + return LineString(vertex_list) + + +def clip_by_rect(geom, xmin, ymin, xmax, ymax): + """Returns the portion of a geometry within a rectangle + + The geometry is clipped in a fast but possibly dirty way. The output is + not guaranteed to be valid. No exceptions will be raised for topological + errors. + + Parameters + ---------- + geom : geometry + The geometry to be clipped + xmin : float + Minimum x value of the rectangle + ymin : float + Minimum y value of the rectangle + xmax : float + Maximum x value of the rectangle + ymax : float + Maximum y value of the rectangle + + Notes + ----- + Requires GEOS >= 3.5.0 + New in 1.7. + """ + if geom.is_empty: + return geom + return shapely.clip_by_rect(geom, xmin, ymin, xmax, ymax) + + +def orient(geom, sign=1.0): + """A properly oriented copy of the given geometry. + + The signed area of the result will have the given sign. A sign of + 1.0 means that the coordinates of the product's exterior rings will + be oriented counter-clockwise. + + Parameters + ---------- + geom : Geometry + The original geometry. May be a Polygon, MultiPolygon, or + GeometryCollection. + sign : float, optional. + The sign of the result's signed area. + + Returns + ------- + Geometry + + """ + if isinstance(geom, BaseMultipartGeometry): + return geom.__class__( + list( + map( + lambda geom: orient(geom, sign), + geom.geoms, + ) + ) + ) + if isinstance(geom, (Polygon,)): + return orient_(geom, sign) + return geom diff --git a/shapely/python/shapely/plotting.py b/shapely/python/shapely/plotting.py new file mode 100644 index 0000000..02169fd --- /dev/null +++ b/shapely/python/shapely/plotting.py @@ -0,0 +1,217 @@ +""" +Plot single geometries using Matplotlib. + +Note: this module is experimental, and mainly targetting (interactive) +exploration, debugging and illustration purposes. + +""" + +import numpy as np + +import shapely + + +def _default_ax(): + import matplotlib.pyplot as plt + + ax = plt.gca() + ax.grid(True) + ax.set_aspect("equal") + return ax + + +def _path_from_polygon(polygon): + from matplotlib.path import Path + + if isinstance(polygon, shapely.MultiPolygon): + return Path.make_compound_path( + *[_path_from_polygon(poly) for poly in polygon.geoms] + ) + else: + return Path.make_compound_path( + Path(np.asarray(polygon.exterior.coords)[:, :2]), + *[Path(np.asarray(ring.coords)[:, :2]) for ring in polygon.interiors], + ) + + +def patch_from_polygon(polygon, **kwargs): + """ + Gets a Matplotlib patch from a (Multi)Polygon. + + Note: this function is experimental, and mainly targetting (interactive) + exploration, debugging and illustration purposes. + + Parameters + ---------- + polygon : shapely.Polygon or shapely.MultiPolygon + **kwargs + Additional keyword arguments passed to the matplotlib Patch. + + Returns + ------- + Matplotlib artist (PathPatch) + """ + from matplotlib.patches import PathPatch + + return PathPatch(_path_from_polygon(polygon), **kwargs) + + +def plot_polygon( + polygon, + ax=None, + add_points=True, + color=None, + facecolor=None, + edgecolor=None, + linewidth=None, + **kwargs +): + """ + Plot a (Multi)Polygon. + + Note: this function is experimental, and mainly targetting (interactive) + exploration, debugging and illustration purposes. + + Parameters + ---------- + polygon : shapely.Polygon or shapely.MultiPolygon + ax : matplotlib Axes, default None + The axes on which to draw the plot. If not specified, will get the + current active axes or create a new figure. + add_points : bool, default True + If True, also plot the coordinates (vertices) as points. + color : matplotlib color specification + Color for both the polygon fill (face) and boundary (edge). By default, + the fill is using an alpha of 0.3. You can specify `facecolor` and + `edgecolor` separately for greater control. + facecolor : matplotlib color specification + Color for the polygon fill. + edgecolor : matplotlib color specification + Color for the polygon boundary. + linewidth : float + The line width for the polygon boundary. + **kwargs + Additional keyword arguments passed to the matplotlib Patch. + + Returns + ------- + Matplotlib artist (PathPatch), if `add_points` is false. + A tuple of Matplotlib artists (PathPatch, Line2D), if `add_points` is true. + """ + from matplotlib import colors + + if ax is None: + ax = _default_ax() + + if color is None: + color = "C0" + color = colors.to_rgba(color) + + if facecolor is None: + facecolor = list(color) + facecolor[-1] = 0.3 + facecolor = tuple(facecolor) + + if edgecolor is None: + edgecolor = color + + patch = patch_from_polygon( + polygon, facecolor=facecolor, edgecolor=edgecolor, linewidth=linewidth, **kwargs + ) + ax.add_patch(patch) + ax.autoscale_view() + + if add_points: + line = plot_points(polygon, ax=ax, color=color) + return patch, line + + return patch + + +def plot_line(line, ax=None, add_points=True, color=None, linewidth=2, **kwargs): + """ + Plot a (Multi)LineString/LinearRing. + + Note: this function is experimental, and mainly targetting (interactive) + exploration, debugging and illustration purposes. + + Parameters + ---------- + line : shapely.LineString or shapely.LinearRing + ax : matplotlib Axes, default None + The axes on which to draw the plot. If not specified, will get the + current active axes or create a new figure. + add_points : bool, default True + If True, also plot the coordinates (vertices) as points. + color : matplotlib color specification + Color for the line (edgecolor under the hood) and pointes. + linewidth : float, default 2 + The line width for the polygon boundary. + **kwargs + Additional keyword arguments passed to the matplotlib Patch. + + Returns + ------- + Matplotlib artist (PathPatch) + """ + from matplotlib.patches import PathPatch + from matplotlib.path import Path + + if ax is None: + ax = _default_ax() + + if color is None: + color = "C0" + + if isinstance(line, shapely.MultiLineString): + path = Path.make_compound_path( + *[Path(np.asarray(mline.coords)[:, :2]) for mline in line.geoms] + ) + else: + path = Path(np.asarray(line.coords)[:, :2]) + + patch = PathPatch( + path, facecolor="none", edgecolor=color, linewidth=linewidth, **kwargs + ) + ax.add_patch(patch) + ax.autoscale_view() + + if add_points: + line = plot_points(line, ax=ax, color=color) + return patch, line + + return patch + + +def plot_points(geom, ax=None, color=None, marker="o", **kwargs): + """ + Plot a Point/MultiPoint or the vertices of any other geometry type. + + Parameters + ---------- + geom : shapely.Geometry + Any shapely Geometry object, from which all vertices are extracted + and plotted. + ax : matplotlib Axes, default None + The axes on which to draw the plot. If not specified, will get the + current active axes or create a new figure. + color : matplotlib color specification + Color for the filled points. You can use `markeredgecolor` and + `markeredgecolor` to have different edge and fill colors. + marker : str, default "o" + The matplotlib marker for the points. + **kwargs + Additional keyword arguments passed to matplotlib `plot` (Line2D). + + Returns + ------- + Matplotlib artist (Line2D) + """ + if ax is None: + ax = _default_ax() + + coords = shapely.get_coordinates(geom) + (line,) = ax.plot( + coords[:, 0], coords[:, 1], linestyle="", marker=marker, color=color, **kwargs + ) + return line diff --git a/shapely/python/shapely/predicates.py b/shapely/python/shapely/predicates.py new file mode 100644 index 0000000..52732ea --- /dev/null +++ b/shapely/python/shapely/predicates.py @@ -0,0 +1,1184 @@ +import warnings + +import numpy as np + +from . import lib +from .decorators import multithreading_enabled, requires_geos + +__all__ = [ + "has_z", + "is_ccw", + "is_closed", + "is_empty", + "is_geometry", + "is_missing", + "is_prepared", + "is_ring", + "is_simple", + "is_valid", + "is_valid_input", + "is_valid_reason", + "crosses", + "contains", + "contains_xy", + "contains_properly", + "covered_by", + "covers", + "disjoint", + "dwithin", + "equals", + "intersects", + "intersects_xy", + "overlaps", + "touches", + "within", + "equals_exact", + "relate", + "relate_pattern", +] + + +@multithreading_enabled +def has_z(geometry, **kwargs): + """Returns True if a geometry has a Z coordinate. + + Note that this function returns False if the (first) Z coordinate equals NaN or + if the geometry is empty. + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + get_coordinate_dimension + + Examples + -------- + >>> from shapely import Point + >>> has_z(Point(0, 0)) + False + >>> has_z(Point(0, 0, 0)) + True + >>> has_z(Point(0, 0, float("nan"))) + False + """ + return lib.has_z(geometry, **kwargs) + + +@requires_geos("3.7.0") +@multithreading_enabled +def is_ccw(geometry, **kwargs): + """Returns True if a linestring or linearring is counterclockwise. + + Note that there are no checks on whether lines are actually closed and + not self-intersecting, while this is a requirement for is_ccw. The recommended + usage of this function for linestrings is ``is_ccw(g) & is_simple(g)`` and for + linearrings ``is_ccw(g) & is_valid(g)``. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for non-linear goemetries and for + lines with fewer than 4 points (including the closing point). + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_simple : Checks if a linestring is closed and simple. + is_valid : Checks additionally if the geometry is simple. + + Examples + -------- + >>> from shapely import LinearRing, LineString, Point + >>> is_ccw(LinearRing([(0, 0), (0, 1), (1, 1), (0, 0)])) + False + >>> is_ccw(LinearRing([(0, 0), (1, 1), (0, 1), (0, 0)])) + True + >>> is_ccw(LineString([(0, 0), (1, 1), (0, 1)])) + False + >>> is_ccw(Point(0, 0)) + False + """ + return lib.is_ccw(geometry, **kwargs) + + +@multithreading_enabled +def is_closed(geometry, **kwargs): + """Returns True if a linestring's first and last points are equal. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for non-linestrings. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_ring : Checks additionally if the geometry is simple. + + Examples + -------- + >>> from shapely import LineString, Point + >>> is_closed(LineString([(0, 0), (1, 1)])) + False + >>> is_closed(LineString([(0, 0), (0, 1), (1, 1), (0, 0)])) + True + >>> is_closed(Point(0, 0)) + False + """ + return lib.is_closed(geometry, **kwargs) + + +@multithreading_enabled +def is_empty(geometry, **kwargs): + """Returns True if a geometry is an empty point, polygon, etc. + + Parameters + ---------- + geometry : Geometry or array_like + Any geometry type is accepted. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_missing : checks if the object is a geometry + + Examples + -------- + >>> from shapely import Point + >>> is_empty(Point()) + True + >>> is_empty(Point(0, 0)) + False + >>> is_empty(None) + False + """ + return lib.is_empty(geometry, **kwargs) + + +@multithreading_enabled +def is_geometry(geometry, **kwargs): + """Returns True if the object is a geometry + + Parameters + ---------- + geometry : any object or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_missing : check if an object is missing (None) + is_valid_input : check if an object is a geometry or None + + Examples + -------- + >>> from shapely import GeometryCollection, Point + >>> is_geometry(Point(0, 0)) + True + >>> is_geometry(GeometryCollection()) + True + >>> is_geometry(None) + False + >>> is_geometry("text") + False + """ + return lib.is_geometry(geometry, **kwargs) + + +@multithreading_enabled +def is_missing(geometry, **kwargs): + """Returns True if the object is not a geometry (None) + + Parameters + ---------- + geometry : any object or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_geometry : check if an object is a geometry + is_valid_input : check if an object is a geometry or None + is_empty : checks if the object is an empty geometry + + Examples + -------- + >>> from shapely import GeometryCollection, Point + >>> is_missing(Point(0, 0)) + False + >>> is_missing(GeometryCollection()) + False + >>> is_missing(None) + True + >>> is_missing("text") + False + """ + return lib.is_missing(geometry, **kwargs) + + +@multithreading_enabled +def is_prepared(geometry, **kwargs): + """Returns True if a Geometry is prepared. + + Note that it is not necessary to check if a geometry is already prepared + before preparing it. It is more efficient to call ``prepare`` directly + because it will skip geometries that are already prepared. + + This function will return False for missing geometries (None). + + Parameters + ---------- + geometry : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_valid_input : check if an object is a geometry or None + prepare : prepare a geometry + + Examples + -------- + >>> from shapely import Point, prepare + >>> geometry = Point(0, 0) + >>> is_prepared(Point(0, 0)) + False + >>> prepare(geometry) + >>> is_prepared(geometry) + True + >>> is_prepared(None) + False + """ + return lib.is_prepared(geometry, **kwargs) + + +@multithreading_enabled +def is_valid_input(geometry, **kwargs): + """Returns True if the object is a geometry or None + + Parameters + ---------- + geometry : any object or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_geometry : checks if an object is a geometry + is_missing : checks if an object is None + + Examples + -------- + >>> from shapely import GeometryCollection, Point + >>> is_valid_input(Point(0, 0)) + True + >>> is_valid_input(GeometryCollection()) + True + >>> is_valid_input(None) + True + >>> is_valid_input(1.0) + False + >>> is_valid_input("text") + False + """ + return lib.is_valid_input(geometry, **kwargs) + + +@multithreading_enabled +def is_ring(geometry, **kwargs): + """Returns True if a linestring is closed and simple. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for non-linestrings. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_closed : Checks only if the geometry is closed. + is_simple : Checks only if the geometry is simple. + + Examples + -------- + >>> from shapely import LineString, Point + >>> is_ring(Point(0, 0)) + False + >>> geom = LineString([(0, 0), (1, 1)]) + >>> is_closed(geom), is_simple(geom), is_ring(geom) + (False, True, False) + >>> geom = LineString([(0, 0), (0, 1), (1, 1), (0, 0)]) + >>> is_closed(geom), is_simple(geom), is_ring(geom) + (True, True, True) + >>> geom = LineString([(0, 0), (1, 1), (0, 1), (1, 0), (0, 0)]) + >>> is_closed(geom), is_simple(geom), is_ring(geom) + (True, False, False) + """ + return lib.is_ring(geometry, **kwargs) + + +@multithreading_enabled +def is_simple(geometry, **kwargs): + """Returns True if a Geometry has no anomalous geometric points, such as + self-intersections or self tangency. + + Note that polygons and linearrings are assumed to be simple. Use is_valid + to check these kind of geometries for self-intersections. + + Parameters + ---------- + geometry : Geometry or array_like + This function will return False for geometrycollections. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_ring : Checks additionally if the geometry is closed. + is_valid : Checks whether a geometry is well formed. + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> is_simple(Polygon([(1, 1), (2, 1), (2, 2), (1, 1)])) + True + >>> is_simple(LineString([(0, 0), (1, 1), (0, 1), (1, 0), (0, 0)])) + False + >>> is_simple(None) + False + """ + return lib.is_simple(geometry, **kwargs) + + +@multithreading_enabled +def is_valid(geometry, **kwargs): + """Returns True if a geometry is well formed. + + Parameters + ---------- + geometry : Geometry or array_like + Any geometry type is accepted. Returns False for missing values. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_valid_reason : Returns the reason in case of invalid. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Polygon + >>> is_valid(LineString([(0, 0), (1, 1)])) + True + >>> is_valid(Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)])) + False + >>> is_valid(GeometryCollection()) + True + >>> is_valid(None) + False + """ + # GEOS is valid will emit warnings for invalid geometries. Suppress them. + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + result = lib.is_valid(geometry, **kwargs) + return result + + +def is_valid_reason(geometry, **kwargs): + """Returns a string stating if a geometry is valid and if not, why. + + Parameters + ---------- + geometry : Geometry or array_like + Any geometry type is accepted. Returns None for missing values. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + is_valid : returns True or False + + Examples + -------- + >>> from shapely import LineString, Polygon + >>> is_valid_reason(LineString([(0, 0), (1, 1)])) + 'Valid Geometry' + >>> is_valid_reason(Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)])) + 'Ring Self-intersection[1 1]' + >>> is_valid_reason(None) is None + True + """ + return lib.is_valid_reason(geometry, **kwargs) + + +@multithreading_enabled +def crosses(a, b, **kwargs): + """Returns True if A and B spatially cross. + + A crosses B if they have some but not all interior points in common, + the intersection is one dimension less than the maximum dimension of A or B, + and the intersection is not equal to either A or B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, MultiPoint, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> # A contains B: + >>> crosses(line, Point(0.5, 0.5)) + False + >>> # A and B intersect at a point but do not share all points: + >>> crosses(line, MultiPoint([(0, 1), (0.5, 0.5)])) + True + >>> crosses(line, LineString([(0, 1), (1, 0)])) + True + >>> # A is contained by B; their intersection is a line (same dimension): + >>> crosses(line, LineString([(0, 0), (2, 2)])) + False + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> # A contains B: + >>> crosses(area, line) + False + >>> # A and B intersect with a line (lower dimension) but do not share all points: + >>> crosses(area, LineString([(0, 0), (2, 2)])) + True + >>> # A contains B: + >>> crosses(area, Point(0.5, 0.5)) + False + >>> # A contains some but not all points of B; they intersect at a point: + >>> crosses(area, MultiPoint([(2, 2), (0.5, 0.5)])) + True + """ + return lib.crosses(a, b, **kwargs) + + +@multithreading_enabled +def contains(a, b, **kwargs): + """Returns True if geometry B is completely inside geometry A. + + A contains B if no points of B lie in the exterior of A and at least one + point of the interior of B lies in the interior of A. + + Note: following this definition, a geometry does not contain its boundary, + but it does contain itself. See ``contains_properly`` for a version where + a geometry does not contain itself. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + within : ``contains(A, B) == within(B, A)`` + contains_properly : contains with no common boundary points + prepare : improve performance by preparing ``a`` (the first argument) + contains_xy : variant for checking against a Point with x, y coordinates + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> contains(line, Point(0, 0)) + False + >>> contains(line, Point(0.5, 0.5)) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> contains(area, Point(0, 0)) + False + >>> contains(area, line) + True + >>> contains(area, LineString([(0, 0), (2, 2)])) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> contains(polygon_with_hole, Point(1, 1)) + True + >>> contains(polygon_with_hole, Point(2, 2)) + False + >>> contains(polygon_with_hole, LineString([(1, 1), (5, 5)])) + False + >>> contains(area, area) + True + >>> contains(area, None) + False + """ + return lib.contains(a, b, **kwargs) + + +@multithreading_enabled +def contains_properly(a, b, **kwargs): + """Returns True if geometry B is completely inside geometry A, with no + common boundary points. + + A contains B properly if B intersects the interior of A but not the + boundary (or exterior). This means that a geometry A does not + "contain properly" itself, which contrasts with the ``contains`` function, + where common points on the boundary are allowed. + + Note: this function will prepare the geometries under the hood if needed. + You can prepare the geometries in advance to avoid repeated preparation + when calling this function multiple times. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + contains : contains which allows common boundary points + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import Polygon + >>> area1 = Polygon([(0, 0), (3, 0), (3, 3), (0, 3), (0, 0)]) + >>> area2 = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> area3 = Polygon([(1, 1), (2, 1), (2, 2), (1, 2), (1, 1)]) + + ``area1`` and ``area2`` have a common border: + + >>> contains(area1, area2) + True + >>> contains_properly(area1, area2) + False + + ``area3`` is completely inside ``area1`` with no common border: + + >>> contains(area1, area3) + True + >>> contains_properly(area1, area3) + True + """ + return lib.contains_properly(a, b, **kwargs) + + +@multithreading_enabled +def covered_by(a, b, **kwargs): + """Returns True if no point in geometry A is outside geometry B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + covers : ``covered_by(A, B) == covers(B, A)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> covered_by(Point(0, 0), line) + True + >>> covered_by(Point(0.5, 0.5), line) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> covered_by(Point(0, 0), area) + True + >>> covered_by(line, area) + True + >>> covered_by(LineString([(0, 0), (2, 2)]), area) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> covered_by(Point(1, 1), polygon_with_hole) + True + >>> covered_by(Point(2, 2), polygon_with_hole) + True + >>> covered_by(LineString([(1, 1), (5, 5)]), polygon_with_hole) + False + >>> covered_by(area, area) + True + >>> covered_by(None, area) + False + """ + return lib.covered_by(a, b, **kwargs) + + +@multithreading_enabled +def covers(a, b, **kwargs): + """Returns True if no point in geometry B is outside geometry A. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + covered_by : ``covers(A, B) == covered_by(B, A)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> covers(line, Point(0, 0)) + True + >>> covers(line, Point(0.5, 0.5)) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> covers(area, Point(0, 0)) + True + >>> covers(area, line) + True + >>> covers(area, LineString([(0, 0), (2, 2)])) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> covers(polygon_with_hole, Point(1, 1)) + True + >>> covers(polygon_with_hole, Point(2, 2)) + True + >>> covers(polygon_with_hole, LineString([(1, 1), (5, 5)])) + False + >>> covers(area, area) + True + >>> covers(area, None) + False + """ + return lib.covers(a, b, **kwargs) + + +@multithreading_enabled +def disjoint(a, b, **kwargs): + """Returns True if A and B do not share any point in space. + + Disjoint implies that overlaps, touches, within, and intersects are False. + Note missing (None) values are never disjoint. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + intersects : ``disjoint(A, B) == ~intersects(A, B)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Point + >>> line = LineString([(0, 0), (1, 1)]) + >>> disjoint(line, Point(0, 0)) + False + >>> disjoint(line, Point(0, 1)) + True + >>> disjoint(line, LineString([(0, 2), (2, 0)])) + False + >>> empty = GeometryCollection() + >>> disjoint(line, empty) + True + >>> disjoint(empty, empty) + True + >>> disjoint(empty, None) + False + >>> disjoint(None, None) + False + """ + return lib.disjoint(a, b, **kwargs) + + +@multithreading_enabled +def equals(a, b, **kwargs): + """Returns True if A and B are spatially equal. + + If A is within B and B is within A, A and B are considered equal. The + ordering of points can be different. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See Also + -------- + equals_exact : Check if A and B are structurally equal given a specified + tolerance. + + Examples + -------- + >>> from shapely import GeometryCollection, LineString, Polygon + >>> line = LineString([(0, 0), (5, 5), (10, 10)]) + >>> equals(line, LineString([(0, 0), (10, 10)])) + True + >>> equals(Polygon(), GeometryCollection()) + True + >>> equals(None, None) + False + """ + return lib.equals(a, b, **kwargs) + + +@multithreading_enabled +def intersects(a, b, **kwargs): + """Returns True if A and B share any portion of space. + + Intersects implies that overlaps, touches and within are True. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + disjoint : ``intersects(A, B) == ~disjoint(A, B)`` + prepare : improve performance by preparing ``a`` (the first argument) + intersects_xy : variant for checking against a Point with x, y coordinates + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 0), (1, 1)]) + >>> intersects(line, Point(0, 0)) + True + >>> intersects(line, Point(0, 1)) + False + >>> intersects(line, LineString([(0, 2), (2, 0)])) + True + >>> intersects(None, None) + False + """ + return lib.intersects(a, b, **kwargs) + + +@multithreading_enabled +def overlaps(a, b, **kwargs): + """Returns True if A and B spatially overlap. + + A and B overlap if they have some but not all points in common, have the + same dimension, and the intersection of the interiors of the two geometries + has the same dimension as the geometries themselves. That is, only polyons + can overlap other polygons and only lines can overlap other lines. + + If either A or B are None, the output is always False. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> poly = Polygon([(0, 0), (0, 4), (4, 4), (4, 0), (0, 0)]) + >>> # A and B share all points (are spatially equal): + >>> overlaps(poly, poly) + False + >>> # A contains B; all points of B are within A: + >>> overlaps(poly, Polygon([(0, 0), (0, 2), (2, 2), (2, 0), (0, 0)])) + False + >>> # A partially overlaps with B: + >>> overlaps(poly, Polygon([(2, 2), (2, 6), (6, 6), (6, 2), (2, 2)])) + True + >>> line = LineString([(2, 2), (6, 6)]) + >>> # A and B are different dimensions; they cannot overlap: + >>> overlaps(poly, line) + False + >>> overlaps(poly, Point(2, 2)) + False + >>> # A and B share some but not all points: + >>> overlaps(line, LineString([(0, 0), (4, 4)])) + True + >>> # A and B intersect only at a point (lower dimension); they do not overlap + >>> overlaps(line, LineString([(6, 0), (0, 6)])) + False + >>> overlaps(poly, None) + False + >>> overlaps(None, None) + False + """ + return lib.overlaps(a, b, **kwargs) + + +@multithreading_enabled +def touches(a, b, **kwargs): + """Returns True if the only points shared between A and B are on the + boundary of A and B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 2), (2, 0)]) + >>> touches(line, Point(0, 2)) + True + >>> touches(line, Point(1, 1)) + False + >>> touches(line, LineString([(0, 0), (1, 1)])) + True + >>> touches(line, LineString([(0, 0), (2, 2)])) + False + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> touches(area, Point(0.5, 0)) + True + >>> touches(area, Point(0.5, 0.5)) + False + >>> touches(area, line) + True + >>> touches(area, Polygon([(0, 1), (1, 1), (1, 2), (0, 2), (0, 1)])) + True + """ + return lib.touches(a, b, **kwargs) + + +@multithreading_enabled +def within(a, b, **kwargs): + """Returns True if geometry A is completely inside geometry B. + + A is within B if no points of A lie in the exterior of B and at least one + point of the interior of A lies in the interior of B. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + contains : ``within(A, B) == contains(B, A)`` + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import LineString, Point, Polygon + >>> line = LineString([(0, 0), (1, 1)]) + >>> within(Point(0, 0), line) + False + >>> within(Point(0.5, 0.5), line) + True + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> within(Point(0, 0), area) + False + >>> within(line, area) + True + >>> within(LineString([(0, 0), (2, 2)]), area) + False + >>> polygon_with_hole = Polygon( + ... [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + ... holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]] + ... ) + >>> within(Point(1, 1), polygon_with_hole) + True + >>> within(Point(2, 2), polygon_with_hole) + False + >>> within(LineString([(1, 1), (5, 5)]), polygon_with_hole) + False + >>> within(area, area) + True + >>> within(None, area) + False + """ + return lib.within(a, b, **kwargs) + + +@multithreading_enabled +def equals_exact(a, b, tolerance=0.0, **kwargs): + """Returns True if A and B are structurally equal. + + This method uses exact coordinate equality, which requires coordinates + to be equal (within specified tolerance) and and in the same order for all + components of a geometry. This is in contrast with the ``equals`` function + which uses spatial (topological) equality. + + Parameters + ---------- + a, b : Geometry or array_like + tolerance : float or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See Also + -------- + equals : Check if A and B are spatially equal. + + Examples + -------- + >>> from shapely import Point, Polygon + >>> point1 = Point(50, 50) + >>> point2 = Point(50.1, 50.1) + >>> equals_exact(point1, point2) + False + >>> equals_exact(point1, point2, tolerance=0.2) + True + >>> equals_exact(point1, None, tolerance=0.2) + False + + Difference between structucal and spatial equality: + + >>> polygon1 = Polygon([(0, 0), (1, 1), (0, 1), (0, 0)]) + >>> polygon2 = Polygon([(0, 0), (0, 1), (1, 1), (0, 0)]) + >>> equals_exact(polygon1, polygon2) + False + >>> equals(polygon1, polygon2) + True + """ + return lib.equals_exact(a, b, tolerance, **kwargs) + + +def relate(a, b, **kwargs): + """ + Returns a string representation of the DE-9IM intersection matrix. + + Parameters + ---------- + a, b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import LineString, Point + >>> point = Point(0, 0) + >>> line = LineString([(0, 0), (1, 1)]) + >>> relate(point, line) + 'F0FFFF102' + """ + return lib.relate(a, b, **kwargs) + + +@multithreading_enabled +def relate_pattern(a, b, pattern, **kwargs): + """ + Returns True if the DE-9IM string code for the relationship between + the geometries satisfies the pattern, else False. + + This function compares the DE-9IM code string for two geometries + against a specified pattern. If the string matches the pattern then + ``True`` is returned, otherwise ``False``. The pattern specified can + be an exact match (``0``, ``1`` or ``2``), a boolean match + (uppercase ``T`` or ``F``), or a wildcard (``*``). For example, + the pattern for the ``within`` predicate is ``'T*F**F***'``. + + Parameters + ---------- + a, b : Geometry or array_like + pattern : string + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + Examples + -------- + >>> from shapely import Point, Polygon + >>> point = Point(0.5, 0.5) + >>> square = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + >>> relate(point, square) + '0FFFFF212' + >>> relate_pattern(point, square, "T*F**F***") + True + """ + return lib.relate_pattern(a, b, pattern, **kwargs) + + +@multithreading_enabled +@requires_geos("3.10.0") +def dwithin(a, b, distance, **kwargs): + """ + Returns True if the geometries are within a given distance. + + Using this function is more efficient than computing the distance and + comparing the result. + + Parameters + ---------- + a, b : Geometry or array_like + distance : float + Negative distances always return False. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + distance : compute the actual distance between A and B + prepare : improve performance by preparing ``a`` (the first argument) + + Examples + -------- + >>> from shapely import Point + >>> point = Point(0.5, 0.5) + >>> dwithin(point, Point(2, 0.5), 2) + True + >>> dwithin(point, Point(2, 0.5), [2, 1.5, 1]).tolist() + [True, True, False] + >>> dwithin(point, Point(0.5, 0.5), 0) + True + >>> dwithin(point, None, 100) + False + """ + return lib.dwithin(a, b, distance, **kwargs) + + +@multithreading_enabled +def contains_xy(geom, x, y=None, **kwargs): + """ + Returns True if the Point (x, y) is completely inside geometry A. + + This is a special-case (and faster) variant of the `contains` function + which avoids having to create a Point object if you start from x/y + coordinates. + + Note that in the case of points, the `contains_properly` predicate is + equivalent to `contains`. + + See the docstring of `contains` for more details about the predicate. + + Parameters + ---------- + geom : Geometry or array_like + x, y : float or array_like + Coordinates as separate x and y arrays, or a single array of + coordinate x, y tuples. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + contains : variant taking two geometries as input + + Notes + ----- + If you compare a small number of polygons or lines with many points, + it can be beneficial to prepare the geometries in advance using + :func:`shapely.prepare`. + + Examples + -------- + >>> from shapely import Point, Polygon + >>> area = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + >>> contains(area, Point(0.5, 0.5)) + True + >>> contains_xy(area, 0.5, 0.5) + True + """ + if y is None: + coords = np.asarray(x) + x, y = coords[:, 0], coords[:, 1] + return lib.contains_xy(geom, x, y, **kwargs) + + +@multithreading_enabled +def intersects_xy(geom, x, y=None, **kwargs): + """ + Returns True if A and the Point (x, y) share any portion of space. + + This is a special-case (and faster) variant of the `intersects` function + which avoids having to create a Point object if you start from x/y + coordinates. + + See the docstring of `intersects` for more details about the predicate. + + Parameters + ---------- + geom : Geometry or array_like + x, y : float or array_like + Coordinates as separate x and y arrays, or a single array of + coordinate x, y tuples. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + intersects : variant taking two geometries as input + + Notes + ----- + If you compare a single or few geometries with many points, it can be + beneficial to prepare the geometries in advance using + :func:`shapely.prepare`. + + The `touches` predicate can be determined with this function by getting + the boundary of the geometries: ``intersects_xy(boundary(geom), x, y)``. + + Examples + -------- + >>> from shapely import LineString, Point + >>> line = LineString([(0, 0), (1, 1)]) + >>> intersects(line, Point(0, 0)) + True + >>> intersects_xy(line, 0, 0) + True + """ + if y is None: + coords = np.asarray(x) + x, y = coords[:, 0], coords[:, 1] + return lib.intersects_xy(geom, x, y, **kwargs) diff --git a/shapely/python/shapely/prepared.py b/shapely/python/shapely/prepared.py new file mode 100644 index 0000000..1070da7 --- /dev/null +++ b/shapely/python/shapely/prepared.py @@ -0,0 +1,77 @@ +""" +Support for GEOS prepared geometry operations. +""" +from pickle import PicklingError + +import shapely + + +class PreparedGeometry: + """ + A geometry prepared for efficient comparison to a set of other geometries. + + Example: + + >>> from shapely.geometry import Point, Polygon + >>> triangle = Polygon([(0.0, 0.0), (1.0, 1.0), (1.0, -1.0)]) + >>> p = prep(triangle) + >>> p.intersects(Point(0.5, 0.5)) + True + """ + + def __init__(self, context): + if isinstance(context, PreparedGeometry): + self.context = context.context + else: + shapely.prepare(context) + self.context = context + self.prepared = True + + def contains(self, other): + """Returns True if the geometry contains the other, else False""" + return self.context.contains(other) + + def contains_properly(self, other): + """Returns True if the geometry properly contains the other, else False""" + # TODO temporary hack until shapely exposes contains properly as predicate function + from shapely import STRtree + + tree = STRtree([other]) + idx = tree.query(self.context, predicate="contains_properly") + return bool(len(idx)) + + def covers(self, other): + """Returns True if the geometry covers the other, else False""" + return self.context.covers(other) + + def crosses(self, other): + """Returns True if the geometries cross, else False""" + return self.context.crosses(other) + + def disjoint(self, other): + """Returns True if geometries are disjoint, else False""" + return self.context.disjoint(other) + + def intersects(self, other): + """Returns True if geometries intersect, else False""" + return self.context.intersects(other) + + def overlaps(self, other): + """Returns True if geometries overlap, else False""" + return self.context.overlaps(other) + + def touches(self, other): + """Returns True if geometries touch, else False""" + return self.context.touches(other) + + def within(self, other): + """Returns True if geometry is within the other, else False""" + return self.context.within(other) + + def __reduce__(self): + raise PicklingError("Prepared geometries cannot be pickled.") + + +def prep(ob): + """Creates and returns a prepared geometric object.""" + return PreparedGeometry(ob) diff --git a/shapely/python/shapely/set_operations.py b/shapely/python/shapely/set_operations.py new file mode 100644 index 0000000..ffb42fd --- /dev/null +++ b/shapely/python/shapely/set_operations.py @@ -0,0 +1,514 @@ +import numpy as np + +from . import GeometryType, lib +from .decorators import multithreading_enabled, requires_geos +from .errors import UnsupportedGEOSVersionError + +__all__ = [ + "difference", + "intersection", + "intersection_all", + "symmetric_difference", + "symmetric_difference_all", + "unary_union", + "union", + "union_all", + "coverage_union", + "coverage_union_all", +] + + +@multithreading_enabled +def difference(a, b, grid_size=None, **kwargs): + """Returns the part of geometry A that does not intersect with geometry B. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize, Polygon + >>> line = LineString([(0, 0), (2, 2)]) + >>> difference(line, LineString([(1, 1), (3, 3)])) + + >>> difference(line, LineString()) + + >>> difference(line, None) is None + True + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(difference(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> difference(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.difference_prec(a, b, grid_size, **kwargs) + + return lib.difference(a, b, **kwargs) + + +@multithreading_enabled +def intersection(a, b, grid_size=None, **kwargs): + """Returns the geometry that is shared between input geometries. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + intersection_all + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize, Polygon + >>> line = LineString([(0, 0), (2, 2)]) + >>> intersection(line, LineString([(1, 1), (3, 3)])) + + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(intersection(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> intersection(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.intersection_prec(a, b, grid_size, **kwargs) + + return lib.intersection(a, b, **kwargs) + + +@multithreading_enabled +def intersection_all(geometries, axis=None, **kwargs): + """Returns the intersection of multiple geometries. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None, an empty GeometryCollection is + returned. + + Parameters + ---------- + geometries : array_like + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc.reduce docs `_. + + See also + -------- + intersection + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (2, 2)]) + >>> line2 = LineString([(1, 1), (3, 3)]) + >>> intersection_all([line1, line2]) + + >>> intersection_all([[line1, line2, None]], axis=1).tolist() + [] + >>> intersection_all([line1, None]) + + """ + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis(geometries, axis=axis, start=geometries.ndim) + + return lib.intersection_all(geometries, **kwargs) + + +@multithreading_enabled +def symmetric_difference(a, b, grid_size=None, **kwargs): + """Returns the geometry that represents the portions of input geometries + that do not intersect. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + symmetric_difference_all + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize + >>> line = LineString([(0, 0), (2, 2)]) + >>> symmetric_difference(line, LineString([(1, 1), (3, 3)])) + + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(symmetric_difference(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> symmetric_difference(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.symmetric_difference_prec(a, b, grid_size, **kwargs) + + return lib.symmetric_difference(a, b, **kwargs) + + +@multithreading_enabled +def symmetric_difference_all(geometries, axis=None, **kwargs): + """Returns the symmetric difference of multiple geometries. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None an empty GeometryCollection is + returned. + + Parameters + ---------- + geometries : array_like + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc.reduce docs `_. + + See also + -------- + symmetric_difference + + Examples + -------- + >>> from shapely import LineString + >>> line1 = LineString([(0, 0), (2, 2)]) + >>> line2 = LineString([(1, 1), (3, 3)]) + >>> symmetric_difference_all([line1, line2]) + + >>> symmetric_difference_all([[line1, line2, None]], axis=1).tolist() + [] + >>> symmetric_difference_all([line1, None]) + + >>> symmetric_difference_all([None, None]) + + """ + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis(geometries, axis=axis, start=geometries.ndim) + + return lib.symmetric_difference_all(geometries, **kwargs) + + +@multithreading_enabled +def union(a, b, grid_size=None, **kwargs): + """Merges geometries into one. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + union_all + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize + >>> line = LineString([(0, 0), (2, 2)]) + >>> union(line, LineString([(2, 2), (3, 3)])) + + >>> union(line, None) is None + True + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(union(box1, box2)) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> union(box1, box2, grid_size=1) + + """ + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.union_prec(a, b, grid_size, **kwargs) + + return lib.union(a, b, **kwargs) + + +@multithreading_enabled +def union_all(geometries, grid_size=None, axis=None, **kwargs): + """Returns the union of multiple geometries. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None an empty GeometryCollection is + returned. + + If grid_size is nonzero, input coordinates will be snapped to a precision + grid of that size and resulting coordinates will be snapped to that same + grid. If 0, this operation will use double precision coordinates. If None, + the highest precision of the inputs will be used, which may be previously + set using set_precision. Note: returned geometry does not have precision + set unless specified previously by set_precision. + + `unary_union` is an alias of `union_all`. + + Parameters + ---------- + geometries : array_like + grid_size : float, optional + Precision grid size; requires GEOS >= 3.9.0. Will use the highest + precision of the inputs by default. + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + union + set_precision + + Examples + -------- + >>> from shapely import box, LineString, normalize, Point + >>> line1 = LineString([(0, 0), (2, 2)]) + >>> line2 = LineString([(2, 2), (3, 3)]) + >>> union_all([line1, line2]) + + >>> union_all([[line1, line2, None]], axis=1).tolist() + [] + >>> box1 = box(0, 0, 2, 2) + >>> box2 = box(1, 1, 3, 3) + >>> normalize(union_all([box1, box2])) + + >>> box1 = box(0.1, 0.2, 2.1, 2.1) + >>> union_all([box1, box2], grid_size=1) + + >>> union_all([None, Point(0, 1)]) + + >>> union_all([None, None]) + + >>> union_all([]) + + """ + # for union_all, GEOS provides an efficient route through first creating + # GeometryCollections + # first roll the aggregation axis backwards + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis(geometries, axis=axis, start=geometries.ndim) + + # create_collection acts on the inner axis + collections = lib.create_collection(geometries, GeometryType.GEOMETRYCOLLECTION) + + if grid_size is not None: + if lib.geos_version < (3, 9, 0): + raise UnsupportedGEOSVersionError( + "grid_size parameter requires GEOS >= 3.9.0" + ) + + if not np.isscalar(grid_size): + raise ValueError("grid_size parameter only accepts scalar values") + + return lib.unary_union_prec(collections, grid_size, **kwargs) + + return lib.unary_union(collections, **kwargs) + + +unary_union = union_all + + +@requires_geos("3.8.0") +@multithreading_enabled +def coverage_union(a, b, **kwargs): + """Merges multiple polygons into one. This is an optimized version of + union which assumes the polygons to be non-overlapping. + + Parameters + ---------- + a : Geometry or array_like + b : Geometry or array_like + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + coverage_union_all + + Examples + -------- + >>> from shapely import normalize, Polygon + >>> polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + >>> normalize(coverage_union(polygon, Polygon([(1, 0), (1, 1), (2, 1), (2, 0), (1, 0)]))) + + + Union with None returns same polygon + >>> normalize(coverage_union(polygon, None)) + + """ + return coverage_union_all([a, b], **kwargs) + + +@requires_geos("3.8.0") +@multithreading_enabled +def coverage_union_all(geometries, axis=None, **kwargs): + """Returns the union of multiple polygons of a geometry collection. + This is an optimized version of union which assumes the polygons + to be non-overlapping. + + This function ignores None values when other Geometry elements are present. + If all elements of the given axis are None, an empty MultiPolygon is + returned. + + Parameters + ---------- + geometries : array_like + axis : int, optional + Axis along which the operation is performed. The default (None) + performs the operation over all axes, returning a scalar value. + Axis may be negative, in which case it counts from the last to the + first axis. + **kwargs + For other keyword-only arguments, see the + `NumPy ufunc docs `_. + + See also + -------- + coverage_union + + Examples + -------- + >>> from shapely import normalize, Polygon + >>> polygon_1 = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + >>> polygon_2 = Polygon([(1, 0), (1, 1), (2, 1), (2, 0), (1, 0)]) + >>> normalize(coverage_union_all([polygon_1, polygon_2])) + + >>> normalize(coverage_union_all([polygon_1, None])) + + >>> normalize(coverage_union_all([None, None])) + + """ + # coverage union in GEOS works over GeometryCollections + # first roll the aggregation axis backwards + geometries = np.asarray(geometries) + if axis is None: + geometries = geometries.ravel() + else: + geometries = np.rollaxis( + np.asarray(geometries), axis=axis, start=geometries.ndim + ) + # create_collection acts on the inner axis + collections = lib.create_collection(geometries, GeometryType.GEOMETRYCOLLECTION) + return lib.coverage_union(collections, **kwargs) diff --git a/shapely/python/shapely/speedups.py b/shapely/python/shapely/speedups.py new file mode 100644 index 0000000..0f33d5a --- /dev/null +++ b/shapely/python/shapely/speedups.py @@ -0,0 +1,36 @@ +import warnings + +__all__ = ["available", "enable", "disable", "enabled"] + + +available = True +enabled = True + + +_MSG = ( + "This function has no longer any effect, and will be removed in a " + "future release. Starting with Shapely 2.0, equivalent speedups are " + "always available" +) + + +def enable(): + """ + This function has no longer any effect, and will be removed in a future + release. + + Previously, this function enabled cython-based speedups. Starting with + Shapely 2.0, equivalent speedups are available in every installation. + """ + warnings.warn(_MSG, DeprecationWarning, stacklevel=2) + + +def disable(): + """ + This function has no longer any effect, and will be removed in a future + release. + + Previously, this function enabled cython-based speedups. Starting with + Shapely 2.0, equivalent speedups are available in every installation. + """ + warnings.warn(_MSG, DeprecationWarning, stacklevel=2) diff --git a/shapely/python/shapely/strtree.py b/shapely/python/shapely/strtree.py new file mode 100644 index 0000000..d582cd5 --- /dev/null +++ b/shapely/python/shapely/strtree.py @@ -0,0 +1,544 @@ +from typing import Any, Iterable, Union + +import numpy as np + +from . import lib +from ._enum import ParamEnum +from .decorators import requires_geos, UnsupportedGEOSVersionError +from .geometry.base import BaseGeometry +from .predicates import is_empty, is_missing + +__all__ = ["STRtree"] + + +class BinaryPredicate(ParamEnum): + """The enumeration of GEOS binary predicates types""" + + intersects = 1 + within = 2 + contains = 3 + overlaps = 4 + crosses = 5 + touches = 6 + covers = 7 + covered_by = 8 + contains_properly = 9 + + +class STRtree: + """ + A query-only R-tree spatial index created using the + Sort-Tile-Recursive (STR) [1]_ algorithm. + + The tree indexes the bounding boxes of each geometry. The tree is + constructed directly at initialization and nodes cannot be added or + removed after it has been created. + + All operations return indices of the input geometries. These indices + can be used to index into anything associated with the input geometries, + including the input geometries themselves, or custom items stored in + another object of the same length as the geometries. + + Bounding boxes limited to two dimensions and are axis-aligned (equivalent to + the ``bounds`` property of a geometry); any Z values present in geometries + are ignored for purposes of indexing within the tree. + + Any mixture of geometry types may be stored in the tree. + + Note: the tree is more efficient for querying when there are fewer + geometries that have overlapping bounding boxes and where there is greater + similarity between the outer boundary of a geometry and its bounding box. + For example, a MultiPolygon composed of widely-spaced individual Polygons + will have a large overall bounding box compared to the boundaries of its + individual Polygons, and the bounding box may also potentially overlap many + other geometries within the tree. This means that the resulting tree may be + less efficient to query than a tree constructed from individual Polygons. + + Parameters + ---------- + geoms : sequence + A sequence of geometry objects. + node_capacity : int, default 10 + The maximum number of child nodes per parent node in the tree. + + References + ---------- + .. [1] Leutenegger, Scott T.; Edgington, Jeffrey M.; Lopez, Mario A. + (February 1997). "STR: A Simple and Efficient Algorithm for + R-Tree Packing". + https://ia600900.us.archive.org/27/items/nasa_techdoc_19970016975/19970016975.pdf + """ + + def __init__( + self, + geoms: Iterable[BaseGeometry], + node_capacity: int = 10, + ): + # Keep references to geoms in a copied array so that this array is not + # modified while the tree depends on it remaining the same + self._geometries = np.array(geoms, dtype=np.object_, copy=True) + + # initialize GEOS STRtree + self._tree = lib.STRtree(self.geometries, node_capacity) + + def __len__(self): + return self._tree.count + + def __reduce__(self): + return (STRtree, (self.geometries,)) + + @property + def geometries(self): + """ + Geometries stored in the tree in the order used to construct the tree. + + The order of this array corresponds to the tree indices returned by + other STRtree methods. + + Do not attempt to modify items in the returned array. + + Returns + ------- + ndarray of Geometry objects + """ + return self._geometries + + def query(self, geometry, predicate=None, distance=None): + """ + Return the integer indices of all combinations of each input geometry + and tree geometries where the bounding box of each input geometry + intersects the bounding box of a tree geometry. + + If the input geometry is a scalar, this returns an array of shape (n, ) with + the indices of the matching tree geometries. If the input geometry is an + array_like, this returns an array with shape (2,n) where the subarrays + correspond to the indices of the input geometries and indices of the + tree geometries associated with each. To generate an array of pairs of + input geometry index and tree geometry index, simply transpose the + result. + + If a predicate is provided, the tree geometries are first queried based + on the bounding box of the input geometry and then are further filtered + to those that meet the predicate when comparing the input geometry to + the tree geometry: + predicate(geometry, tree_geometry) + + The 'dwithin' predicate requires GEOS >= 3.10. + + Bounding boxes are limited to two dimensions and are axis-aligned + (equivalent to the ``bounds`` property of a geometry); any Z values + present in input geometries are ignored when querying the tree. + + Any input geometry that is None or empty will never match geometries in + the tree. + + Parameters + ---------- + geometry : Geometry or array_like + Input geometries to query the tree and filter results using the + optional predicate. + predicate : {None, 'intersects', 'within', 'contains', 'overlaps', 'crosses',\ +'touches', 'covers', 'covered_by', 'contains_properly', 'dwithin'}, optional + The predicate to use for testing geometries from the tree + that are within the input geometry's bounding box. + distance : number or array_like, optional + Distances around each input geometry within which to query the tree + for the 'dwithin' predicate. If array_like, shape must be + broadcastable to shape of geometry. Required if predicate='dwithin'. + + Returns + ------- + ndarray with shape (n,) if geometry is a scalar + Contains tree geometry indices. + + OR + + ndarray with shape (2, n) if geometry is an array_like + The first subarray contains input geometry indices. + The second subarray contains tree geometry indices. + + Examples + -------- + >>> from shapely import box, Point + >>> import numpy as np + >>> points = [Point(0, 0), Point(1, 1), Point(2,2), Point(3, 3)] + >>> tree = STRtree(points) + + Query the tree using a scalar geometry: + + >>> indices = tree.query(box(0, 0, 1, 1)) + >>> indices.tolist() + [0, 1] + + Query using an array of geometries: + + >>> boxes = np.array([box(0, 0, 1, 1), box(2, 2, 3, 3)]) + >>> arr_indices = tree.query(boxes) + >>> arr_indices.tolist() + [[0, 0, 1, 1], [0, 1, 2, 3]] + + Or transpose to get all pairs of input and tree indices: + + >>> arr_indices.T.tolist() + [[0, 0], [0, 1], [1, 2], [1, 3]] + + Retrieve the tree geometries by results of query: + + >>> tree.geometries.take(indices).tolist() + [, ] + + Retrieve all pairs of input and tree geometries: + + >>> np.array([boxes.take(arr_indices[0]),\ +tree.geometries.take(arr_indices[1])]).T.tolist() + [[, ], + [, ], + [, ], + [, ]] + + Query using a predicate: + + >>> tree = STRtree([box(0, 0, 0.5, 0.5), box(0.5, 0.5, 1, 1), box(1, 1, 2, 2)]) + >>> tree.query(box(0, 0, 1, 1), predicate="contains").tolist() + [0, 1] + >>> tree.query(Point(0.75, 0.75), predicate="dwithin", distance=0.5).tolist() + [0, 1, 2] + + >>> tree.query(boxes, predicate="contains").tolist() + [[0, 0], [0, 1]] + >>> tree.query(boxes, predicate="dwithin", distance=0.5).tolist() + [[0, 0, 0, 1], [0, 1, 2, 2]] + + Retrieve custom items associated with tree geometries (records can + be in whatever data structure so long as geometries and custom data + can be extracted into arrays of the same length and order): + + >>> records = [ + ... {"geometry": Point(0, 0), "value": "A"}, + ... {"geometry": Point(2, 2), "value": "B"} + ... ] + >>> tree = STRtree([record["geometry"] for record in records]) + >>> items = np.array([record["value"] for record in records]) + >>> items.take(tree.query(box(0, 0, 1, 1))).tolist() + ['A'] + + + Notes + ----- + In the context of a spatial join, input geometries are the "left" + geometries that determine the order of the results, and tree geometries + are "right" geometries that are joined against the left geometries. This + effectively performs an inner join, where only those combinations of + geometries that can be joined based on overlapping bounding boxes or + optional predicate are returned. + """ + + geometry = np.asarray(geometry) + is_scalar = False + if geometry.ndim == 0: + geometry = np.expand_dims(geometry, 0) + is_scalar = True + + if predicate is None: + indices = self._tree.query(geometry, 0) + return indices[1] if is_scalar else indices + + # Requires GEOS >= 3.10 + elif predicate == "dwithin": + if lib.geos_version < (3, 10, 0): + raise UnsupportedGEOSVersionError( + "dwithin predicate requires GEOS >= 3.10" + ) + if distance is None: + raise ValueError( + "distance parameter must be provided for dwithin predicate" + ) + distance = np.asarray(distance, dtype="float64") + if distance.ndim > 1: + raise ValueError("Distance array should be one dimensional") + + try: + distance = np.broadcast_to(distance, geometry.shape) + except ValueError: + raise ValueError("Could not broadcast distance to match geometry") + + indices = self._tree.dwithin(geometry, distance) + return indices[1] if is_scalar else indices + + predicate = BinaryPredicate.get_value(predicate) + indices = self._tree.query(geometry, predicate) + return indices[1] if is_scalar else indices + + @requires_geos("3.6.0") + def nearest(self, geometry) -> Union[Any, None]: + """ + Return the index of the nearest geometry in the tree for each input + geometry based on distance within two-dimensional Cartesian space. + + This distance will be 0 when input geometries intersect tree geometries. + + If there are multiple equidistant or intersected geometries in the tree, + only a single result is returned for each input geometry, based on the + order that tree geometries are visited; this order may be + nondeterministic. + + If any input geometry is None or empty, an error is raised. Any Z + values present in input geometries are ignored when finding nearest + tree geometries. + + Parameters + ---------- + geometry : Geometry or array_like + Input geometries to query the tree. + + Returns + ------- + scalar or ndarray + Indices of geometries in tree. Return value will have the same shape + as the input. + + None is returned if this index is empty. This may change in + version 2.0. + + See also + -------- + query_nearest: returns all equidistant geometries, exclusive geometries, \ +and optional distances + + Examples + -------- + >>> from shapely.geometry import Point + >>> tree = STRtree([Point(i, i) for i in range(10)]) + + Query the tree for nearest using a scalar geometry: + + >>> index = tree.nearest(Point(2.2, 2.2)) + >>> index + 2 + >>> tree.geometries.take(index) + + + Query the tree for nearest using an array of geometries: + + >>> indices = tree.nearest([Point(2.2, 2.2), Point(4.4, 4.4)]) + >>> indices.tolist() + [2, 4] + >>> tree.geometries.take(indices).tolist() + [, ] + + Nearest only return one object if there are multiple equidistant results: + + >>> tree = STRtree ([Point(0, 0), Point(0, 0)]) + >>> tree.nearest(Point(0, 0)) + 0 + """ + if self._tree.count == 0: + return None + + geometry_arr = np.asarray(geometry, dtype=object) + if is_missing(geometry_arr).any() or is_empty(geometry_arr).any(): + raise ValueError( + "Cannot determine nearest geometry for empty geometry or " + "missing value (None)." + ) + # _tree.nearest returns ndarray with shape (2, 1) -> index in input + # geometries and index into tree geometries + indices = self._tree.nearest(np.atleast_1d(geometry_arr))[1] + + if geometry_arr.ndim == 0: + return indices[0] + else: + return indices + + @requires_geos("3.6.0") + def query_nearest( + self, + geometry, + max_distance=None, + return_distance=False, + exclusive=False, + all_matches=True, + ): + """Return the index of the nearest geometries in the tree for each input + geometry based on distance within two-dimensional Cartesian space. + + This distance will be 0 when input geometries intersect tree geometries. + + If there are multiple equidistant or intersected geometries in tree and + `all_matches` is True (the default), all matching tree geometries are + returned; otherwise only the first matching tree geometry is returned. + Tree indices are returned in the order they are visited for each input + geometry and may not be in ascending index order; no meaningful order is + implied. + + The max_distance used to search for nearest items in the tree may have a + significant impact on performance by reducing the number of input + geometries that are evaluated for nearest items in the tree. Only those + input geometries with at least one tree geometry within +/- max_distance + beyond their envelope will be evaluated. However, using a large + max_distance may have a negative performance impact because many tree + geometries will be queried for each input geometry. + + The distance, if returned, will be 0 for any intersected geometries in + the tree. + + Any geometry that is None or empty in the input geometries is omitted + from the output. Any Z values present in input geometries are ignored + when finding nearest tree geometries. + + Parameters + ---------- + geometry : Geometry or array_like + Input geometries to query the tree. + max_distance : float, optional + Maximum distance within which to query for nearest items in tree. + Must be greater than 0. + return_distance : bool, default False + If True, will return distances in addition to indices. + exclusive : bool, default False + If True, the nearest tree geometries that are equal to the input + geometry will not be returned. + all_matches : bool, default True + If True, all equidistant and intersected geometries will be returned + for each input geometry. + If False, only the first nearest geometry will be returned. + + Returns + ------- + tree indices or tuple of (tree indices, distances) if geometry is a scalar + indices is an ndarray of shape (n, ) and distances (if present) an + ndarray of shape (n, ) + + OR + + indices or tuple of (indices, distances) + indices is an ndarray of shape (2,n) and distances (if present) an + ndarray of shape (n). + The first subarray of indices contains input geometry indices. + The second subarray of indices contains tree geometry indices. + + See also + -------- + nearest: returns singular nearest geometry for each input + + Examples + -------- + >>> import numpy as np + >>> from shapely import box, Point + >>> points = [Point(0, 0), Point(1, 1), Point(2,2), Point(3, 3)] + >>> tree = STRtree(points) + + Find the nearest tree geometries to a scalar geometry: + + >>> indices = tree.query_nearest(Point(0.25, 0.25)) + >>> indices.tolist() + [0] + + Retrieve the tree geometries by results of query: + + >>> tree.geometries.take(indices).tolist() + [] + + Find the nearest tree geometries to an array of geometries: + + >>> query_points = np.array([Point(2.25, 2.25), Point(1, 1)]) + >>> arr_indices = tree.query_nearest(query_points) + >>> arr_indices.tolist() + [[0, 1], [2, 1]] + + Or transpose to get all pairs of input and tree indices: + + >>> arr_indices.T.tolist() + [[0, 2], [1, 1]] + + Retrieve all pairs of input and tree geometries: + + >>> list(zip(query_points.take(arr_indices[0]), tree.geometries.take(arr_indices[1]))) + [(, ), (, )] + + All intersecting geometries in the tree are returned by default: + + >>> tree.query_nearest(box(1,1,3,3)).tolist() + [1, 2, 3] + + Set all_matches to False to to return a single match per input geometry: + + >>> tree.query_nearest(box(1,1,3,3), all_matches=False).tolist() + [1] + + Return the distance to each nearest tree geometry: + + >>> index, distance = tree.query_nearest(Point(0.5, 0.5), return_distance=True) + >>> index.tolist() + [0, 1] + >>> distance.round(4).tolist() + [0.7071, 0.7071] + + Return the distance for each input and nearest tree geometry for an array + of geometries: + + >>> indices, distance = tree.query_nearest([Point(0.5, 0.5), Point(1, 1)], return_distance=True) + >>> indices.tolist() + [[0, 0, 1], [0, 1, 1]] + >>> distance.round(4).tolist() + [0.7071, 0.7071, 0.0] + + Retrieve custom items associated with tree geometries (records can + be in whatever data structure so long as geometries and custom data + can be extracted into arrays of the same length and order): + + >>> records = [ + ... {"geometry": Point(0, 0), "value": "A"}, + ... {"geometry": Point(2, 2), "value": "B"} + ... ] + >>> tree = STRtree([record["geometry"] for record in records]) + >>> items = np.array([record["value"] for record in records]) + >>> items.take(tree.query_nearest(Point(0.5, 0.5))).tolist() + ['A'] + """ + + geometry = np.asarray(geometry, dtype=object) + is_scalar = False + if geometry.ndim == 0: + geometry = np.expand_dims(geometry, 0) + is_scalar = True + + if max_distance is not None: + if not np.isscalar(max_distance): + raise ValueError("max_distance parameter only accepts scalar values") + + if max_distance <= 0: + raise ValueError("max_distance must be greater than 0") + + # a distance of 0 means no max_distance is used + max_distance = max_distance or 0 + + if not np.isscalar(exclusive): + raise ValueError("exclusive parameter only accepts scalar values") + + if exclusive not in {True, False}: + raise ValueError("exclusive parameter must be boolean") + + if not np.isscalar(all_matches): + raise ValueError("all_matches parameter only accepts scalar values") + + if all_matches not in {True, False}: + raise ValueError("all_matches parameter must be boolean") + + results = self._tree.query_nearest( + geometry, max_distance, exclusive, all_matches + ) + + # output indices are shape (n, ) + if is_scalar: + if not return_distance: + return results[0][1] + + else: + return (results[0][1], results[1]) + + # output indices are shape (2, n) + if not return_distance: + return results[0] + + return results diff --git a/shapely/python/shapely/testing.py b/shapely/python/shapely/testing.py new file mode 100644 index 0000000..e98ac5a --- /dev/null +++ b/shapely/python/shapely/testing.py @@ -0,0 +1,204 @@ +from functools import partial + +import numpy as np + +import shapely + +__all__ = ["assert_geometries_equal"] + + +def _equals_exact_with_ndim(x, y, tolerance): + dimension_equals = shapely.get_coordinate_dimension( + x + ) == shapely.get_coordinate_dimension(y) + with np.errstate(invalid="ignore"): + # Suppress 'invalid value encountered in equals_exact' with nan coordinates + geometry_equals = shapely.equals_exact(x, y, tolerance=tolerance) + return dimension_equals & geometry_equals + + +def _replace_nan(arr): + return np.where(np.isnan(arr), 0.0, arr) + + +def _assert_nan_coords_same(x, y, tolerance, err_msg, verbose): + x, y = np.broadcast_arrays(x, y) + x_coords = shapely.get_coordinates(x, include_z=True) + y_coords = shapely.get_coordinates(y, include_z=True) + + # Check the shapes (condition is copied from numpy test_array_equal) + if x_coords.shape != y_coords.shape: + return False + + # Check NaN positional equality + x_id = np.isnan(x_coords) + y_id = np.isnan(y_coords) + if not (x_id == y_id).all(): + msg = build_err_msg( + [x, y], + err_msg + "\nx and y nan coordinate location mismatch:", + verbose=verbose, + ) + raise AssertionError(msg) + + # If this passed, replace NaN with a number to be able to use equals_exact + x_no_nan = shapely.transform(x, _replace_nan, include_z=True) + y_no_nan = shapely.transform(y, _replace_nan, include_z=True) + + return _equals_exact_with_ndim(x_no_nan, y_no_nan, tolerance=tolerance) + + +def _assert_none_same(x, y, err_msg, verbose): + x_id = shapely.is_missing(x) + y_id = shapely.is_missing(y) + + if not (x_id == y_id).all(): + msg = build_err_msg( + [x, y], + err_msg + "\nx and y None location mismatch:", + verbose=verbose, + ) + raise AssertionError(msg) + + # If there is a scalar, then here we know the array has the same + # flag as it everywhere, so we should return the scalar flag. + if x.ndim == 0: + return bool(x_id) + elif y.ndim == 0: + return bool(y_id) + else: + return y_id + + +def assert_geometries_equal( + x, + y, + tolerance=1e-7, + equal_none=True, + equal_nan=True, + normalize=False, + err_msg="", + verbose=True, +): + """Raises an AssertionError if two geometry array_like objects are not equal. + + Given two array_like objects, check that the shape is equal and all elements of + these objects are equal. An exception is raised at shape mismatch or conflicting + values. In contrast to the standard usage in shapely, no assertion is raised if + both objects have NaNs/Nones in the same positions. + + Parameters + ---------- + x : Geometry or array_like + y : Geometry or array_like + equal_none : bool, default True + Whether to consider None elements equal to other None elements. + equal_nan : bool, default True + Whether to consider nan coordinates as equal to other nan coordinates. + normalize : bool, default False + Whether to normalize geometries prior to comparison. + err_msg : str, optional + The error message to be printed in case of failure. + verbose : bool, optional + If True, the conflicting values are appended to the error message. + """ + __tracebackhide__ = True # Hide traceback for py.test + if normalize: + x = shapely.normalize(x) + y = shapely.normalize(y) + x = np.array(x, copy=False) + y = np.array(y, copy=False) + + is_scalar = x.ndim == 0 or y.ndim == 0 + + # Check the shapes (condition is copied from numpy test_array_equal) + if not (is_scalar or x.shape == y.shape): + msg = build_err_msg( + [x, y], + err_msg + f"\n(shapes {x.shape}, {y.shape} mismatch)", + verbose=verbose, + ) + raise AssertionError(msg) + + flagged = False + if equal_none: + flagged = _assert_none_same(x, y, err_msg, verbose) + + if not np.isscalar(flagged): + x, y = x[~flagged], y[~flagged] + # Only do the comparison if actual values are left + if x.size == 0: + return + elif flagged: + # no sense doing comparison if everything is flagged. + return + + is_equal = _equals_exact_with_ndim(x, y, tolerance=tolerance) + if is_scalar and not np.isscalar(is_equal): + is_equal = bool(is_equal[0]) + + if np.all(is_equal): + return + elif not equal_nan: + msg = build_err_msg( + [x, y], + err_msg + f"\nNot equal to tolerance {tolerance:g}", + verbose=verbose, + ) + raise AssertionError(msg) + + # Optionally refine failing elements if NaN should be considered equal + if not np.isscalar(is_equal): + x, y = x[~is_equal], y[~is_equal] + # Only do the NaN check if actual values are left + if x.size == 0: + return + elif is_equal: + # no sense in checking for NaN if everything is equal. + return + + is_equal = _assert_nan_coords_same(x, y, tolerance, err_msg, verbose) + if not np.all(is_equal): + msg = build_err_msg( + [x, y], + err_msg + f"\nNot equal to tolerance {tolerance:g}", + verbose=verbose, + ) + raise AssertionError(msg) + + +## BELOW A COPY FROM numpy.testing._private.utils (numpy version 1.20.2) + + +def build_err_msg( + arrays, + err_msg, + header="Geometries are not equal:", + verbose=True, + names=("x", "y"), + precision=8, +): + msg = ["\n" + header] + if err_msg: + if err_msg.find("\n") == -1 and len(err_msg) < 79 - len(header): + msg = [msg[0] + " " + err_msg] + else: + msg.append(err_msg) + if verbose: + for i, a in enumerate(arrays): + + if isinstance(a, np.ndarray): + # precision argument is only needed if the objects are ndarrays + r_func = partial(np.array_repr, precision=precision) + else: + r_func = repr + + try: + r = r_func(a) + except Exception as exc: + r = f"[repr failed for <{type(a).__name__}>: {exc}]" + if r.count("\n") > 3: + r = "\n".join(r.splitlines()[:3]) + r += "..." + msg.append(f" {names[i]}: {r}") + return "\n".join(msg) diff --git a/shapely/python/shapely/tests/__init__.py b/shapely/python/shapely/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/shapely/python/shapely/tests/__pycache__/__init__.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..26f3f7a Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/__init__.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/common.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/common.cpython-311.pyc new file mode 100644 index 0000000..49a063d Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/common.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_constructive.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_constructive.cpython-311.pyc new file mode 100644 index 0000000..115b9f0 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_constructive.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_coordinates.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_coordinates.cpython-311.pyc new file mode 100644 index 0000000..8a312ea Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_coordinates.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_creation.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_creation.cpython-311.pyc new file mode 100644 index 0000000..4baef47 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_creation.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_creation_indices.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_creation_indices.cpython-311.pyc new file mode 100644 index 0000000..852b3f8 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_creation_indices.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_geometry.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_geometry.cpython-311.pyc new file mode 100644 index 0000000..f95272a Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_geometry.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_io.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_io.cpython-311.pyc new file mode 100644 index 0000000..e1297c9 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_io.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_linear.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_linear.cpython-311.pyc new file mode 100644 index 0000000..8e2fd74 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_linear.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_measurement.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_measurement.cpython-311.pyc new file mode 100644 index 0000000..d005ce4 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_measurement.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_misc.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_misc.cpython-311.pyc new file mode 100644 index 0000000..ed25284 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_misc.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_plotting.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_plotting.cpython-311.pyc new file mode 100644 index 0000000..48d905f Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_plotting.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_predicates.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_predicates.cpython-311.pyc new file mode 100644 index 0000000..c45d2ec Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_predicates.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_ragged_array.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_ragged_array.cpython-311.pyc new file mode 100644 index 0000000..785f085 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_ragged_array.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_set_operations.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_set_operations.cpython-311.pyc new file mode 100644 index 0000000..04ebf18 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_set_operations.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_strtree.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_strtree.cpython-311.pyc new file mode 100644 index 0000000..bf3b036 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_strtree.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/__pycache__/test_testing.cpython-311.pyc b/shapely/python/shapely/tests/__pycache__/test_testing.cpython-311.pyc new file mode 100644 index 0000000..0031218 Binary files /dev/null and b/shapely/python/shapely/tests/__pycache__/test_testing.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/common.py b/shapely/python/shapely/tests/common.py new file mode 100644 index 0000000..14eb5c9 --- /dev/null +++ b/shapely/python/shapely/tests/common.py @@ -0,0 +1,78 @@ +from contextlib import contextmanager + +import numpy as np +import pytest + +import shapely + +shapely20_todo = pytest.mark.xfail( + strict=False, reason="Not yet implemented for Shapely 2.0" +) + +point_polygon_testdata = ( + shapely.points(np.arange(6), np.arange(6)), + shapely.box(2, 2, 4, 4), +) +point = shapely.Point(2, 3) +line_string = shapely.LineString([(0, 0), (1, 0), (1, 1)]) +linear_ring = shapely.LinearRing([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) +polygon = shapely.Polygon([(0, 0), (2, 0), (2, 2), (0, 2), (0, 0)]) +multi_point = shapely.MultiPoint([(0, 0), (1, 2)]) +multi_line_string = shapely.MultiLineString([[(0, 0), (1, 2)]]) +multi_polygon = shapely.multipolygons( + [ + [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], + [(2.1, 2.1), (2.2, 2.1), (2.2, 2.2), (2.1, 2.2), (2.1, 2.1)], + ] +) +geometry_collection = shapely.GeometryCollection( + [shapely.Point(51, -1), shapely.LineString([(52, -1), (49, 2)])] +) +point_z = shapely.Point(2, 3, 4) +line_string_z = shapely.LineString([(0, 0, 4), (1, 0, 4), (1, 1, 4)]) +polygon_z = shapely.Polygon([(0, 0, 4), (2, 0, 4), (2, 2, 4), (0, 2, 4), (0, 0, 4)]) +geometry_collection_z = shapely.GeometryCollection([point_z, line_string_z]) +polygon_with_hole = shapely.Polygon( + [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], +) +empty_point = shapely.from_wkt("POINT EMPTY") +empty_point_z = shapely.from_wkt("POINT Z EMPTY") +empty_line_string = shapely.from_wkt("LINESTRING EMPTY") +empty_line_string_z = shapely.from_wkt("LINESTRING Z EMPTY") +empty_polygon = shapely.from_wkt("POLYGON EMPTY") +empty = shapely.from_wkt("GEOMETRYCOLLECTION EMPTY") +line_string_nan = shapely.LineString([(np.nan, np.nan), (np.nan, np.nan)]) +multi_point_z = shapely.MultiPoint([(0, 0, 4), (1, 2, 4)]) +multi_line_string_z = shapely.MultiLineString([[(0, 0, 4), (1, 2, 4)]]) +multi_polygon_z = shapely.multipolygons( + [ + [(0, 0, 4), (1, 0, 4), (1, 1, 4), (0, 1, 4), (0, 0, 4)], + [(2.1, 2.1, 4), (2.2, 2.1, 4), (2.2, 2.2, 4), (2.1, 2.2, 4), (2.1, 2.1, 4)], + ] +) +polygon_with_hole_z = shapely.Polygon( + [(0, 0, 4), (0, 10, 4), (10, 10, 4), (10, 0, 4), (0, 0, 4)], + holes=[[(2, 2, 4), (2, 4, 4), (4, 4, 4), (4, 2, 4), (2, 2, 4)]], +) + +all_types = ( + point, + line_string, + linear_ring, + polygon, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + empty, +) + + +@contextmanager +def ignore_invalid(condition=True): + if condition: + with np.errstate(invalid="ignore"): + yield + else: + yield diff --git a/shapely/python/shapely/tests/geometry/__init__.py b/shapely/python/shapely/tests/geometry/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/shapely/python/shapely/tests/geometry/__pycache__/__init__.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e38643b Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/__init__.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_collection.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_collection.cpython-311.pyc new file mode 100644 index 0000000..c47f6c8 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_collection.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_coords.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_coords.cpython-311.pyc new file mode 100644 index 0000000..d569e09 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_coords.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_decimal.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_decimal.cpython-311.pyc new file mode 100644 index 0000000..a3d9671 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_decimal.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_emptiness.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_emptiness.cpython-311.pyc new file mode 100644 index 0000000..378dc7b Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_emptiness.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_format.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_format.cpython-311.pyc new file mode 100644 index 0000000..d9bb778 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_format.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_geometry_base.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_geometry_base.cpython-311.pyc new file mode 100644 index 0000000..758ad81 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_geometry_base.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_hash.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_hash.cpython-311.pyc new file mode 100644 index 0000000..f1ccd10 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_hash.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_linestring.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_linestring.cpython-311.pyc new file mode 100644 index 0000000..440cb67 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_linestring.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_multi.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_multi.cpython-311.pyc new file mode 100644 index 0000000..f35149f Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_multi.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_multilinestring.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_multilinestring.cpython-311.pyc new file mode 100644 index 0000000..3c28739 Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_multilinestring.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_multipoint.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_multipoint.cpython-311.pyc new file mode 100644 index 0000000..f1db6de Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_multipoint.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_multipolygon.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_multipolygon.cpython-311.pyc new file mode 100644 index 0000000..0ef9a0a Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_multipolygon.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_point.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_point.cpython-311.pyc new file mode 100644 index 0000000..c8c6fad Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_point.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/__pycache__/test_polygon.cpython-311.pyc b/shapely/python/shapely/tests/geometry/__pycache__/test_polygon.cpython-311.pyc new file mode 100644 index 0000000..227045f Binary files /dev/null and b/shapely/python/shapely/tests/geometry/__pycache__/test_polygon.cpython-311.pyc differ diff --git a/shapely/python/shapely/tests/geometry/test_collection.py b/shapely/python/shapely/tests/geometry/test_collection.py new file mode 100644 index 0000000..606a667 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_collection.py @@ -0,0 +1,82 @@ +import numpy as np +import pytest + +from shapely import GeometryCollection, LineString, Point, wkt +from shapely.geometry import shape + + +@pytest.fixture() +def geometrycollection_geojson(): + return { + "type": "GeometryCollection", + "geometries": [ + {"type": "Point", "coordinates": (0, 3, 0)}, + {"type": "LineString", "coordinates": ((2, 0), (1, 0))}, + ], + } + + +@pytest.mark.parametrize( + "geom", + [ + GeometryCollection(), + shape({"type": "GeometryCollection", "geometries": []}), + wkt.loads("GEOMETRYCOLLECTION EMPTY"), + ], +) +def test_empty(geom): + assert geom.geom_type == "GeometryCollection" + assert geom.is_empty + assert len(geom.geoms) == 0 + assert list(geom.geoms) == [] + + +def test_empty_subgeoms(): + geom = GeometryCollection([Point(), LineString()]) + assert geom.geom_type == "GeometryCollection" + assert geom.is_empty + assert len(geom.geoms) == 2 + assert list(geom.geoms) == [Point(), LineString()] + + +def test_child_with_deleted_parent(): + # test that we can remove a collection while keeping + # children around + a = LineString([(0, 0), (1, 1), (1, 2), (2, 2)]) + b = LineString([(0, 0), (1, 1), (2, 1), (2, 2)]) + collection = a.intersection(b) + + child = collection.geoms[0] + # delete parent of child + del collection + + # access geometry, this should not seg fault as 1.2.15 did + assert child.wkt is not None + + +def test_from_geojson(geometrycollection_geojson): + geom = shape(geometrycollection_geojson) + assert geom.geom_type == "GeometryCollection" + assert len(geom.geoms) == 2 + + geom_types = [g.geom_type for g in geom.geoms] + assert "Point" in geom_types + assert "LineString" in geom_types + + +def test_geointerface(geometrycollection_geojson): + geom = shape(geometrycollection_geojson) + assert geom.__geo_interface__ == geometrycollection_geojson + + +def test_len_raises(geometrycollection_geojson): + geom = shape(geometrycollection_geojson) + with pytest.raises(TypeError): + len(geom) + + +def test_numpy_object_array(): + geom = GeometryCollection([LineString([(0, 0), (1, 1)])]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/shapely/python/shapely/tests/geometry/test_coords.py b/shapely/python/shapely/tests/geometry/test_coords.py new file mode 100644 index 0000000..6aa0d41 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_coords.py @@ -0,0 +1,86 @@ +import numpy as np +import pytest + +from shapely import LineString + + +class TestCoords: + """ + Shapely assumes contiguous C-order float64 data for internal ops. + Data should be converted to contiguous float64 if numpy exists. + c9a0707 broke this a little bit. + """ + + def test_data_promotion(self): + coords = np.array([[12, 34], [56, 78]], dtype=np.float32) + processed_coords = np.array(LineString(coords).coords) + + assert coords.tolist() == processed_coords.tolist() + + def test_data_destriding(self): + coords = np.array([[12, 34], [56, 78]], dtype=np.float32) + + # Easy way to introduce striding: reverse list order + processed_coords = np.array(LineString(coords[::-1]).coords) + + assert coords[::-1].tolist() == processed_coords.tolist() + + +class TestCoordsGetItem: + def test_index_2d_coords(self): + c = [(float(x), float(-x)) for x in range(4)] + g = LineString(c) + for i in range(-4, 4): + assert g.coords[i] == c[i] + with pytest.raises(IndexError): + g.coords[4] + with pytest.raises(IndexError): + g.coords[-5] + + def test_index_3d_coords(self): + c = [(float(x), float(-x), float(x * 2)) for x in range(4)] + g = LineString(c) + for i in range(-4, 4): + assert g.coords[i] == c[i] + with pytest.raises(IndexError): + g.coords[4] + with pytest.raises(IndexError): + g.coords[-5] + + def test_index_coords_misc(self): + g = LineString() # empty + with pytest.raises(IndexError): + g.coords[0] + with pytest.raises(TypeError): + g.coords[0.0] + + def test_slice_2d_coords(self): + c = [(float(x), float(-x)) for x in range(4)] + g = LineString(c) + assert g.coords[1:] == c[1:] + assert g.coords[:-1] == c[:-1] + assert g.coords[::-1] == c[::-1] + assert g.coords[::2] == c[::2] + assert g.coords[:4] == c[:4] + assert g.coords[4:] == c[4:] == [] + + def test_slice_3d_coords(self): + c = [(float(x), float(-x), float(x * 2)) for x in range(4)] + g = LineString(c) + assert g.coords[1:] == c[1:] + assert g.coords[:-1] == c[:-1] + assert g.coords[::-1] == c[::-1] + assert g.coords[::2] == c[::2] + assert g.coords[:4] == c[:4] + assert g.coords[4:] == c[4:] == [] + + +class TestXY: + """New geometry/coordseq method 'xy' makes numpy interop easier""" + + def test_arrays(self): + x, y = LineString([(0, 0), (1, 1)]).xy + assert len(x) == 2 + assert list(x) == [0.0, 1.0] + assert len(y) == 2 + assert list(y) == [0.0, 1.0] diff --git a/shapely/python/shapely/tests/geometry/test_decimal.py b/shapely/python/shapely/tests/geometry/test_decimal.py new file mode 100644 index 0000000..7c4317b --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_decimal.py @@ -0,0 +1,117 @@ +from decimal import Decimal + +import pytest + +from shapely import ( + GeometryCollection, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) + +items2d = [ + [(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)], + [(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)], +] + +items2d_mixed = [ + [ + (Decimal(0.0), Decimal(0.0)), + (Decimal(70.0), 120.0), + (140.0, Decimal(0.0)), + (0.0, 0.0), + ], + [ + (Decimal(60.0), Decimal(80.0)), + (Decimal(80.0), 80.0), + (70.0, Decimal(60.0)), + (60.0, 80.0), + ], +] + +items2d_decimal = [ + [ + (Decimal(0.0), Decimal(0.0)), + (Decimal(70.0), Decimal(120.0)), + (Decimal(140.0), Decimal(0.0)), + (Decimal(0.0), Decimal(0.0)), + ], + [ + (Decimal(60.0), Decimal(80.0)), + (Decimal(80.0), Decimal(80.0)), + (Decimal(70.0), Decimal(60.0)), + (Decimal(60.0), Decimal(80.0)), + ], +] + +items3d = [ + [(0.0, 0.0, 1), (70.0, 120.0, 2), (140.0, 0.0, 3), (0.0, 0.0, 1)], + [(60.0, 80.0, 1), (80.0, 80.0, 2), (70.0, 60.0, 3), (60.0, 80.0, 1)], +] + +items3d_mixed = [ + [ + (Decimal(0.0), Decimal(0.0), Decimal(1)), + (Decimal(70.0), 120.0, Decimal(2)), + (140.0, Decimal(0.0), 3), + (0.0, 0.0, 1), + ], + [ + (Decimal(60.0), Decimal(80.0), Decimal(1)), + (Decimal(80.0), 80.0, 2), + (70.0, Decimal(60.0), Decimal(3)), + (60.0, 80.0, 1), + ], +] + +items3d_decimal = [ + [ + (Decimal(0.0), Decimal(0.0), Decimal(1)), + (Decimal(70.0), Decimal(120.0), Decimal(2)), + (Decimal(140.0), Decimal(0.0), Decimal(3)), + (Decimal(0.0), Decimal(0.0), Decimal(1)), + ], + [ + (Decimal(60.0), Decimal(80.0), Decimal(1)), + (Decimal(80.0), Decimal(80.0), Decimal(2)), + (Decimal(70.0), Decimal(60.0), Decimal(3)), + (Decimal(60.0), Decimal(80.0), Decimal(1)), + ], +] + +all_geoms = [ + [ + Point(items[0][0]), + Point(*items[0][0]), + MultiPoint(items[0]), + LinearRing(items[0]), + LineString(items[0]), + MultiLineString(items), + Polygon(items[0]), + MultiPolygon( + [ + Polygon(items[1]), + Polygon(items[0], holes=items[1:]), + ] + ), + GeometryCollection([Point(items[0][0]), Polygon(items[0])]), + ] + for items in [ + items2d, + items2d_mixed, + items2d_decimal, + items3d, + items3d_mixed, + items3d_decimal, + ] +] + + +@pytest.mark.parametrize("geoms", list(zip(*all_geoms))) +def test_decimal(geoms): + assert geoms[0] == geoms[1] == geoms[2] + assert geoms[3] == geoms[4] == geoms[5] diff --git a/shapely/python/shapely/tests/geometry/test_emptiness.py b/shapely/python/shapely/tests/geometry/test_emptiness.py new file mode 100644 index 0000000..005b2b8 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_emptiness.py @@ -0,0 +1,98 @@ +import math + +import numpy as np +import pytest + +from shapely import ( + GeometryCollection, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) +from shapely.geometry import mapping, shape +from shapely.geometry.base import BaseGeometry, EmptyGeometry + + +def empty_generator(): + return iter([]) + + +class TestEmptiness: + def test_empty_class(self): + with pytest.warns(FutureWarning): + g = EmptyGeometry() + assert g.is_empty + + def test_empty_base(self): + with pytest.warns(FutureWarning): + g = BaseGeometry() + assert g.is_empty + + def test_empty_point(self): + assert Point().is_empty + + def test_empty_multipoint(self): + assert MultiPoint().is_empty + + def test_empty_geometry_collection(self): + assert GeometryCollection().is_empty + + def test_empty_linestring(self): + assert LineString().is_empty + assert LineString(None).is_empty + assert LineString([]).is_empty + assert LineString(empty_generator()).is_empty + + def test_empty_multilinestring(self): + assert MultiLineString([]).is_empty + + def test_empty_polygon(self): + assert Polygon().is_empty + assert Polygon(None).is_empty + assert Polygon([]).is_empty + assert Polygon(empty_generator()).is_empty + + def test_empty_multipolygon(self): + assert MultiPolygon([]).is_empty + + def test_empty_linear_ring(self): + assert LinearRing().is_empty + assert LinearRing(None).is_empty + assert LinearRing([]).is_empty + assert LinearRing(empty_generator()).is_empty + + +def test_numpy_object_array(): + geoms = [Point(), GeometryCollection()] + arr = np.empty(2, object) + arr[:] = geoms + + +def test_shape_empty(): + empty_mp = MultiPolygon() + empty_json = mapping(empty_mp) + empty_shape = shape(empty_json) + assert empty_shape.is_empty + + +@pytest.mark.parametrize( + "geom", + [ + Point(), + LineString(), + Polygon(), + MultiPoint(), + MultiLineString(), + MultiPolygon(), + GeometryCollection(), + LinearRing(), + ], +) +def test_empty_geometry_bounds(geom): + """The bounds of an empty geometry is a tuple of NaNs""" + assert len(geom.bounds) == 4 + assert all(math.isnan(v) for v in geom.bounds) diff --git a/shapely/python/shapely/tests/geometry/test_format.py b/shapely/python/shapely/tests/geometry/test_format.py new file mode 100644 index 0000000..6ae61a3 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_format.py @@ -0,0 +1,111 @@ +import pytest + +from shapely import Point, Polygon +from shapely.geos import geos_version + + +def test_format_invalid(): + # check invalid spec formats + pt = Point(1, 2) + test_list = [ + ("5G", ValueError, "invalid format specifier"), + (".f", ValueError, "invalid format specifier"), + ("0.2e", ValueError, "invalid format specifier"), + (".1x", ValueError, "hex representation does not specify precision"), + ] + for format_spec, err, match in test_list: + with pytest.raises(err, match=match): + format(pt, format_spec) + + +def test_format_point(): + # example coordinate data + xy1 = (0.12345678901234567, 1.2345678901234567e10) + xy2 = (-169.910918, -18.997564) + xyz3 = (630084, 4833438, 76) + + # list of tuples to test; see structure at top of the for-loop + test_list = [ + (".0f", xy1, "POINT (0 12345678901)", True), + (".1f", xy1, "POINT (0.1 12345678901.2)", True), + ("0.2f", xy2, "POINT (-169.91 -19.00)", True), + (".3F", (float("inf"), -float("inf")), "POINT (INF -INF)", True), + ] + if geos_version < (3, 10, 0): + # 'g' format varies depending on GEOS version + test_list += [ + (".1g", xy1, "POINT (0.1 1e+10)", True), + (".6G", xy1, "POINT (0.123457 1.23457E+10)", True), + ("0.12g", xy1, "POINT (0.123456789012 12345678901.2)", True), + ("0.4g", xy2, "POINT (-169.9 -19)", True), + ] + else: + test_list += [ + (".1g", xy1, "POINT (0.1 12345678901.2)", False), + (".6G", xy1, "POINT (0.123457 12345678901.234568)", False), + ("0.12g", xy1, "POINT (0.123456789012 12345678901.234568)", False), + ("g", xy2, "POINT (-169.910918 -18.997564)", False), + ("0.2g", xy2, "POINT (-169.91 -19)", False), + ] + # without precsions test GEOS rounding_precision=-1; different than Python + test_list += [ + ("f", (1, 2), f"POINT ({1:.16f} {2:.16f})", False), + ("F", xyz3, "POINT Z ({:.16f} {:.16f} {:.16f})".format(*xyz3), False), + ("g", xyz3, "POINT Z (630084 4833438 76)", False), + ] + for format_spec, coords, expt_wkt, same_python_float in test_list: + pt = Point(*coords) + # basic checks + assert f"{pt}" == pt.wkt + assert format(pt, "") == pt.wkt + assert format(pt, "x") == pt.wkb_hex.lower() + assert format(pt, "X") == pt.wkb_hex + # check formatted WKT to expected + assert format(pt, format_spec) == expt_wkt, format_spec + # check Python's format consistency + text_coords = expt_wkt[expt_wkt.index("(") + 1 : expt_wkt.index(")")] + is_same = [] + for coord, expt_coord in zip(coords, text_coords.split()): + py_fmt_float = format(float(coord), format_spec) + if same_python_float: + assert py_fmt_float == expt_coord, format_spec + else: + is_same.append(py_fmt_float == expt_coord) + if not same_python_float: + assert not all(is_same), f"{format_spec!r} with {expt_wkt}" + + +def test_format_polygon(): + # check basic cases + poly = Point(0, 0).buffer(10, 2) + assert f"{poly}" == poly.wkt + assert format(poly, "") == poly.wkt + assert format(poly, "x") == poly.wkb_hex.lower() + assert format(poly, "X") == poly.wkb_hex + + # Use f-strings with extra characters and rounding precision + assert f"<{poly:.2f}>" == ( + "" + ) + + # 'g' format varies depending on GEOS version + if geos_version < (3, 10, 0): + expected_2G = ( + "POLYGON ((10 0, 7.1 -7.1, 1.6E-14 -10, -7.1 -7.1, " + "-10 -3.2E-14, -7.1 7.1, -4.6E-14 10, 7.1 7.1, 10 0))" + ) + else: + expected_2G = ( + "POLYGON ((10 0, 7.07 -7.07, 0 -10, -7.07 -7.07, " + "-10 0, -7.07 7.07, 0 10, 7.07 7.07, 10 0))" + ) + assert f"{poly:.2G}" == expected_2G + + # check empty + empty = Polygon() + assert f"{empty}" == "POLYGON EMPTY" + assert format(empty, "") == empty.wkt + assert format(empty, ".2G") == empty.wkt + assert format(empty, "x") == empty.wkb_hex.lower() + assert format(empty, "X") == empty.wkb_hex diff --git a/shapely/python/shapely/tests/geometry/test_geometry_base.py b/shapely/python/shapely/tests/geometry/test_geometry_base.py new file mode 100644 index 0000000..526f6ea --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_geometry_base.py @@ -0,0 +1,274 @@ +import platform +import weakref + +import numpy as np +import pytest + +import shapely +from shapely import ( + GeometryCollection, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) +from shapely.errors import ShapelyDeprecationWarning +from shapely.testing import assert_geometries_equal + + +def test_polygon(): + assert bool(Polygon()) is False + + +def test_linestring(): + assert bool(LineString()) is False + + +def test_point(): + assert bool(Point()) is False + + +def test_geometry_collection(): + assert bool(GeometryCollection()) is False + + +geometries_all_types = [ + Point(1, 1), + LinearRing([(0, 0), (1, 1), (0, 1), (0, 0)]), + LineString([(0, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(0, 0), (1, 1), (0, 1), (0, 0)]), + MultiPoint([(1, 1)]), + MultiLineString([[(0, 0), (1, 1), (0, 1), (0, 0)]]), + MultiPolygon([Polygon([(0, 0), (1, 1), (0, 1), (0, 0)])]), + GeometryCollection([Point(1, 1)]), +] + + +@pytest.mark.skipif( + platform.python_implementation() == "PyPy", + reason="Setting custom attributes doesn't fail on PyPy", +) +@pytest.mark.parametrize("geom", geometries_all_types) +def test_setattr_disallowed(geom): + with pytest.raises(AttributeError): + geom.name = "test" + + +@pytest.mark.parametrize("geom", geometries_all_types) +def test_weakrefable(geom): + _ = weakref.ref(geom) + + +@pytest.mark.parametrize("geom", geometries_all_types) +def test_comparison_notimplemented(geom): + # comparing to a non-geometry class should return NotImplemented in __eq__ + # to ensure proper delegation to other (eg to ensure comparison of scalar + # with array works) + # https://github.com/shapely/shapely/issues/1056 + assert geom.__eq__(1) is NotImplemented + + # with array + arr = np.array([geom, geom], dtype=object) + + result = arr == geom + assert isinstance(result, np.ndarray) + assert result.all() + + result = geom == arr + assert isinstance(result, np.ndarray) + assert result.all() + + result = arr != geom + assert isinstance(result, np.ndarray) + assert not result.any() + + result = geom != arr + assert isinstance(result, np.ndarray) + assert not result.any() + + +def test_base_class_not_callable(): + with pytest.raises(TypeError): + shapely.Geometry("POINT (1 1)") + + +def test_GeometryType_deprecated(): + geom = Point(1, 1) + + with pytest.warns(ShapelyDeprecationWarning): + geom_type = geom.geometryType() + + assert geom_type == geom.geom_type + + +def test_type_deprecated(): + geom = Point(1, 1) + + with pytest.warns(ShapelyDeprecationWarning): + geom_type = geom.type + + assert geom_type == geom.geom_type + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_segmentize(): + line = LineString([(0, 0), (0, 10)]) + result = line.segmentize(max_segment_length=5) + assert result.equals(LineString([(0, 0), (0, 5), (0, 10)])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_reverse(): + coords = [(0, 0), (1, 2)] + line = LineString(coords) + result = line.reverse() + assert result.coords[:] == coords[::-1] + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize( + "op", ["union", "intersection", "difference", "symmetric_difference"] +) +@pytest.mark.parametrize("grid_size", [0, 1, 2]) +def test_binary_op_grid_size(op, grid_size): + geom1 = shapely.box(0, 0, 2.5, 2.5) + geom2 = shapely.box(2, 2, 3, 3) + + result = getattr(geom1, op)(geom2, grid_size=grid_size) + expected = getattr(shapely, op)(geom1, geom2, grid_size=grid_size) + assert result == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_dwithin(): + point = Point(1, 1) + line = LineString([(0, 0), (0, 10)]) + assert point.dwithin(line, 0.5) is False + assert point.dwithin(line, 1.5) is True + + +def test_contains_properly(): + polygon = Polygon([(0, 0), (10, 10), (10, -10)]) + line = LineString([(0, 0), (10, 0)]) + assert polygon.contains_properly(line) is False + assert polygon.contains(line) is True + + +@pytest.mark.parametrize( + "op", ["convex_hull", "envelope", "oriented_envelope", "minimum_rotated_rectangle"] +) +def test_constructive_properties(op): + geom = LineString([(0, 0), (0, 10), (10, 10)]) + result = getattr(geom, op) + expected = getattr(shapely, op)(geom) + assert result == expected + + +@pytest.mark.parametrize( + "op", + [ + "crosses", + "contains", + "contains_properly", + "covered_by", + "covers", + "disjoint", + "equals", + "intersects", + "overlaps", + "touches", + "within", + ], +) +def test_array_argument_binary_predicates(op): + polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + + result = getattr(polygon, op)(points) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(polygon, op)(p) for p in points], dtype=bool) + np.testing.assert_array_equal(result, expected) + + +@pytest.mark.parametrize( + "op, kwargs", + [ + pytest.param( + "dwithin", + dict(distance=0.5), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10" + ), + ), + ("equals_exact", dict(tolerance=0.01)), + ("relate_pattern", dict(pattern="T*F**F***")), + ], +) +def test_array_argument_binary_predicates2(op, kwargs): + polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + + result = getattr(polygon, op)(points, **kwargs) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(polygon, op)(p, **kwargs) for p in points], dtype=bool) + np.testing.assert_array_equal(result, expected) + + +@pytest.mark.parametrize( + "op", + [ + "difference", + "intersection", + "symmetric_difference", + "union", + ], +) +def test_array_argument_binary_geo(op): + box = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + polygons = shapely.buffer(shapely.points([(0, 0), (0.5, 0.5), (1, 1)]), 0.5) + + result = getattr(box, op)(polygons) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(box, op)(g) for g in polygons], dtype=object) + assert_geometries_equal(result, expected) + + +@pytest.mark.parametrize("op", ["distance", "hausdorff_distance"]) +def test_array_argument_float(op): + polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + + result = getattr(polygon, op)(points) + assert isinstance(result, np.ndarray) + expected = np.array([getattr(polygon, op)(p) for p in points], dtype="float64") + np.testing.assert_array_equal(result, expected) + + +def test_array_argument_linear(): + line = LineString([(0, 0), (0, 1), (1, 1)]) + distances = np.array([0, 0.5, 1]) + result = line.line_interpolate_point(distances) + assert isinstance(result, np.ndarray) + expected = np.array( + [line.line_interpolate_point(d) for d in distances], dtype=object + ) + assert_geometries_equal(result, expected) + + points = shapely.points([(0, 0), (0.5, 0.5), (1, 1)]) + result = line.line_locate_point(points) + assert isinstance(result, np.ndarray) + expected = np.array([line.line_locate_point(p) for p in points], dtype="float64") + np.testing.assert_array_equal(result, expected) + + +def test_array_argument_buffer(): + point = Point(1, 1) + distances = np.array([0, 0.5, 1]) + + result = point.buffer(distances) + assert isinstance(result, np.ndarray) + expected = np.array([point.buffer(d) for d in distances], dtype=object) + assert_geometries_equal(result, expected) diff --git a/shapely/python/shapely/tests/geometry/test_hash.py b/shapely/python/shapely/tests/geometry/test_hash.py new file mode 100644 index 0000000..f54f885 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_hash.py @@ -0,0 +1,28 @@ +import pytest + +import shapely +from shapely.affinity import translate +from shapely.geometry import GeometryCollection, LineString, MultiPoint, Point + + +@pytest.mark.parametrize( + "geom", + [ + Point(1, 2), + MultiPoint([(1, 2), (3, 4)]), + LineString([(1, 2), (3, 4)]), + Point(0, 0).buffer(1.0), + GeometryCollection([Point(1, 2), LineString([(1, 2), (3, 4)])]), + ], + ids=[ + "Point", + "MultiPoint", + "LineString", + "Polygon", + "GeometryCollection", + ], +) +def test_hash(geom): + h1 = hash(geom) + assert h1 == hash(shapely.from_wkb(geom.wkb)) + assert h1 != hash(translate(geom, 1.0, 2.0)) diff --git a/shapely/python/shapely/tests/geometry/test_linestring.py b/shapely/python/shapely/tests/geometry/test_linestring.py new file mode 100644 index 0000000..adf0ec2 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_linestring.py @@ -0,0 +1,213 @@ +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, LineString, Point +from shapely.coords import CoordinateSequence + + +def test_from_coordinate_sequence(): + # From coordinate tuples + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + assert len(line.coords) == 2 + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_from_coordinate_sequence_3D(): + line = LineString([(1.0, 2.0, 3.0), (3.0, 4.0, 5.0)]) + assert line.has_z + assert line.coords[:] == [(1.0, 2.0, 3.0), (3.0, 4.0, 5.0)] + + +def test_from_points(): + # From Points + line = LineString([Point(1.0, 2.0), Point(3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + line = LineString([Point(1.0, 2.0), Point(3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_from_mix(): + # From mix of tuples and Points + line = LineString([Point(1.0, 2.0), (2.0, 3.0), Point(3.0, 4.0)]) + assert line.coords[:] == [(1.0, 2.0), (2.0, 3.0), (3.0, 4.0)] + + +def test_from_linestring(): + # From another linestring + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + copy = LineString(line) + assert copy.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + assert copy.geom_type == "LineString" + + +def test_from_linearring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + ring = LinearRing(coords) + copy = LineString(ring) + assert copy.coords[:] == coords + assert copy.geom_type == "LineString" + + +def test_from_linestring_z(): + coords = [(1.0, 2.0, 3.0), (4.0, 5.0, 6.0)] + line = LineString(coords) + copy = LineString(line) + assert copy.coords[:] == coords + assert copy.geom_type == "LineString" + + +def test_from_generator(): + gen = (coord for coord in [(1.0, 2.0), (3.0, 4.0)]) + line = LineString(gen) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_from_empty(): + line = LineString() + assert line.is_empty + assert isinstance(line.coords, CoordinateSequence) + assert line.coords[:] == [] + + line = LineString([]) + assert line.is_empty + assert isinstance(line.coords, CoordinateSequence) + assert line.coords[:] == [] + + +def test_from_numpy(): + # Construct from a numpy array + line = LineString(np.array([[1.0, 2.0], [3.0, 4.0]])) + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + +def test_numpy_empty_linestring_coords(): + # Check empty + line = LineString([]) + la = np.asarray(line.coords) + + assert la.shape == (0, 2) + + +def test_numpy_object_array(): + geom = LineString([(0.0, 0.0), (0.0, 1.0)]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom + + +@pytest.mark.filterwarnings("ignore:Creating an ndarray from ragged nested sequences:") +def test_from_invalid_dim(): + # TODO(shapely-2.0) better error message? + # pytest.raises(ValueError, match="at least 2 coordinate tuples|at least 2 coordinates"): + with pytest.raises(shapely.GEOSException): + LineString([(1, 2)]) + + # exact error depends on numpy version + with pytest.raises((ValueError, TypeError)): + LineString([(1, 2, 3), (4, 5)]) + + with pytest.raises((ValueError, TypeError)): + LineString([(1, 2), (3, 4, 5)]) + + msg = r"The ordinate \(last\) dimension should be 2 or 3, got {}" + with pytest.raises(ValueError, match=msg.format(4)): + LineString([(1, 2, 3, 4), (4, 5, 6, 7)]) + + with pytest.raises(ValueError, match=msg.format(1)): + LineString([(1,), (4,)]) + + +def test_from_single_coordinate(): + """Test for issue #486""" + coords = [[-122.185933073564, 37.3629353839073]] + with pytest.raises(shapely.GEOSException): + ls = LineString(coords) + ls.geom_type # caused segfault before fix + + +class TestLineString: + def test_linestring(self): + + # From coordinate tuples + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + assert len(line.coords) == 2 + assert line.coords[:] == [(1.0, 2.0), (3.0, 4.0)] + + # Bounds + assert line.bounds == (1.0, 2.0, 3.0, 4.0) + + # Coordinate access + assert tuple(line.coords) == ((1.0, 2.0), (3.0, 4.0)) + assert line.coords[0] == (1.0, 2.0) + assert line.coords[1] == (3.0, 4.0) + with pytest.raises(IndexError): + line.coords[2] # index out of range + + # Geo interface + assert line.__geo_interface__ == { + "type": "LineString", + "coordinates": ((1.0, 2.0), (3.0, 4.0)), + } + + def test_linestring_empty(self): + # Test Non-operability of Null geometry + l_null = LineString() + assert l_null.wkt == "LINESTRING EMPTY" + assert l_null.length == 0.0 + + def test_equals_argument_order(self): + """ + Test equals predicate functions correctly regardless of the order + of the inputs. See issue #317. + """ + coords = ((0, 0), (1, 0), (1, 1), (0, 0)) + ls = LineString(coords) + lr = LinearRing(coords) + + assert ls.__eq__(lr) is False # previously incorrectly returned True + assert lr.__eq__(ls) is False + assert (ls == lr) is False + assert (lr == ls) is False + + ls_clone = LineString(coords) + lr_clone = LinearRing(coords) + + assert ls.__eq__(ls_clone) is True + assert lr.__eq__(lr_clone) is True + assert (ls == ls_clone) is True + assert (lr == lr_clone) is True + + def test_numpy_linestring_coords(self): + from numpy.testing import assert_array_equal + + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + expected = np.array([[1.0, 2.0], [3.0, 4.0]]) + + # Coordinate sequences can be adapted as well + la = np.asarray(line.coords) + assert_array_equal(la, expected) + + +def test_linestring_immutable(): + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + + with pytest.raises(AttributeError): + line.coords = [(-1.0, -1.0), (1.0, 1.0)] + + with pytest.raises(TypeError): + line.coords[0] = (-1.0, -1.0) + + +def test_linestring_array_coercion(): + # don't convert to array of coordinates, keep objects + line = LineString([(1.0, 2.0), (3.0, 4.0)]) + arr = np.array(line) + assert arr.ndim == 0 + assert arr.size == 1 + assert arr.dtype == np.dtype("object") + assert arr.item() == line diff --git a/shapely/python/shapely/tests/geometry/test_multi.py b/shapely/python/shapely/tests/geometry/test_multi.py new file mode 100644 index 0000000..08d4666 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_multi.py @@ -0,0 +1,11 @@ +import numpy as np + +test_int_types = [int, np.int16, np.int32, np.int64] + + +class MultiGeometryTestCase: + def subgeom_access_test(self, cls, geoms): + geom = cls(geoms) + for t in test_int_types: + for i, g in enumerate(geoms): + assert geom.geoms[t(i)] == geoms[i] diff --git a/shapely/python/shapely/tests/geometry/test_multilinestring.py b/shapely/python/shapely/tests/geometry/test_multilinestring.py new file mode 100644 index 0000000..f7545fa --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_multilinestring.py @@ -0,0 +1,79 @@ +import numpy as np +import pytest + +from shapely import LineString, MultiLineString +from shapely.errors import EmptyPartError +from shapely.geometry.base import dump_coords + +from .test_multi import MultiGeometryTestCase + + +class TestMultiLineString(MultiGeometryTestCase): + def test_multilinestring(self): + + # From coordinate tuples + geom = MultiLineString([[(1.0, 2.0), (3.0, 4.0)]]) + assert isinstance(geom, MultiLineString) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [[(1.0, 2.0), (3.0, 4.0)]] + + # From lines + a = LineString([(1.0, 2.0), (3.0, 4.0)]) + ml = MultiLineString([a]) + assert len(ml.geoms) == 1 + assert dump_coords(ml) == [[(1.0, 2.0), (3.0, 4.0)]] + + # From another multi-line + ml2 = MultiLineString(ml) + assert len(ml2.geoms) == 1 + assert dump_coords(ml2) == [[(1.0, 2.0), (3.0, 4.0)]] + + # Sub-geometry Access + geom = MultiLineString([(((0.0, 0.0), (1.0, 2.0)))]) + assert isinstance(geom.geoms[0], LineString) + assert dump_coords(geom.geoms[0]) == [(0.0, 0.0), (1.0, 2.0)] + with pytest.raises(IndexError): # index out of range + geom.geoms[1] + + # Geo interface + assert geom.__geo_interface__ == { + "type": "MultiLineString", + "coordinates": (((0.0, 0.0), (1.0, 2.0)),), + } + + def test_from_multilinestring_z(self): + coords1 = [(0.0, 1.0, 2.0), (3.0, 4.0, 5.0)] + coords2 = [(6.0, 7.0, 8.0), (9.0, 10.0, 11.0)] + + # From coordinate tuples + ml = MultiLineString([coords1, coords2]) + copy = MultiLineString(ml) + assert isinstance(copy, MultiLineString) + assert copy.geom_type == "MultiLineString" + assert len(copy.geoms) == 2 + assert dump_coords(copy.geoms[0]) == coords1 + assert dump_coords(copy.geoms[1]) == coords2 + + def test_numpy(self): + # Construct from a numpy array + geom = MultiLineString([np.array(((0.0, 0.0), (1.0, 2.0)))]) + assert isinstance(geom, MultiLineString) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [[(0.0, 0.0), (1.0, 2.0)]] + + def test_subgeom_access(self): + line0 = LineString([(0.0, 1.0), (2.0, 3.0)]) + line1 = LineString([(4.0, 5.0), (6.0, 7.0)]) + self.subgeom_access_test(MultiLineString, [line0, line1]) + + def test_create_multi_with_empty_component(self): + msg = "Can't create MultiLineString with empty component" + with pytest.raises(EmptyPartError, match=msg): + MultiLineString([LineString([(0, 0), (1, 1), (2, 2)]), LineString()]).wkt + + +def test_numpy_object_array(): + geom = MultiLineString([[[5.0, 6.0], [7.0, 8.0]]]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/shapely/python/shapely/tests/geometry/test_multipoint.py b/shapely/python/shapely/tests/geometry/test_multipoint.py new file mode 100644 index 0000000..ef039cf --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_multipoint.py @@ -0,0 +1,79 @@ +import numpy as np +import pytest + +from shapely import MultiPoint, Point +from shapely.errors import EmptyPartError +from shapely.geometry.base import dump_coords + +from .test_multi import MultiGeometryTestCase + + +class TestMultiPoint(MultiGeometryTestCase): + def test_multipoint(self): + + # From coordinate tuples + geom = MultiPoint([(1.0, 2.0), (3.0, 4.0)]) + assert len(geom.geoms) == 2 + assert dump_coords(geom) == [[(1.0, 2.0)], [(3.0, 4.0)]] + + # From points + geom = MultiPoint([Point(1.0, 2.0), Point(3.0, 4.0)]) + assert len(geom.geoms) == 2 + assert dump_coords(geom) == [[(1.0, 2.0)], [(3.0, 4.0)]] + + # From another multi-point + geom2 = MultiPoint(geom) + assert len(geom2.geoms) == 2 + assert dump_coords(geom2) == [[(1.0, 2.0)], [(3.0, 4.0)]] + + # Sub-geometry Access + assert isinstance(geom.geoms[0], Point) + assert geom.geoms[0].x == 1.0 + assert geom.geoms[0].y == 2.0 + with pytest.raises(IndexError): # index out of range + geom.geoms[2] + + # Geo interface + assert geom.__geo_interface__ == { + "type": "MultiPoint", + "coordinates": ((1.0, 2.0), (3.0, 4.0)), + } + + def test_multipoint_from_numpy(self): + # Construct from a numpy array + geom = MultiPoint(np.array([[0.0, 0.0], [1.0, 2.0]])) + assert isinstance(geom, MultiPoint) + assert len(geom.geoms) == 2 + assert dump_coords(geom) == [[(0.0, 0.0)], [(1.0, 2.0)]] + + def test_subgeom_access(self): + p0 = Point(1.0, 2.0) + p1 = Point(3.0, 4.0) + self.subgeom_access_test(MultiPoint, [p0, p1]) + + def test_create_multi_with_empty_component(self): + msg = "Can't create MultiPoint with empty component" + with pytest.raises(EmptyPartError, match=msg): + MultiPoint([Point(0, 0), Point()]).wkt + + +def test_multipoint_array_coercion(): + geom = MultiPoint([(1.0, 2.0), (3.0, 4.0)]) + arr = np.array(geom) + assert arr.ndim == 0 + assert arr.size == 1 + assert arr.dtype == np.dtype("object") + assert arr.item() == geom + + +def test_numpy_object_array(): + geom = MultiPoint([(1.0, 2.0), (3.0, 4.0)]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom + + +def test_len_raises(): + geom = MultiPoint([[5.0, 6.0], [7.0, 8.0]]) + with pytest.raises(TypeError): + len(geom) diff --git a/shapely/python/shapely/tests/geometry/test_multipolygon.py b/shapely/python/shapely/tests/geometry/test_multipolygon.py new file mode 100644 index 0000000..6ba3ae4 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_multipolygon.py @@ -0,0 +1,121 @@ +import numpy as np +import pytest + +from shapely import MultiPolygon, Polygon +from shapely.geometry.base import dump_coords + +from .test_multi import MultiGeometryTestCase + + +class TestMultiPolygon(MultiGeometryTestCase): + def test_multipolygon(self): + + # From coordinate tuples + coords = [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + ] + geom = MultiPolygon(coords) + assert isinstance(geom, MultiPolygon) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [ + [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + ] + + # Or from polygons + p = Polygon( + ((0, 0), (0, 1), (1, 1), (1, 0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + geom = MultiPolygon([p]) + assert len(geom.geoms) == 1 + assert dump_coords(geom) == [ + [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + ] + + # Or from another multi-polygon + geom2 = MultiPolygon(geom) + assert len(geom2.geoms) == 1 + assert dump_coords(geom2) == [ + [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + ] + + # Sub-geometry Access + assert isinstance(geom.geoms[0], Polygon) + assert dump_coords(geom.geoms[0]) == [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + [(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)], + ] + with pytest.raises(IndexError): # index out of range + geom.geoms[1] + + # Geo interface + assert geom.__geo_interface__ == { + "type": "MultiPolygon", + "coordinates": [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)), + ((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)), + ) + ], + } + + def test_subgeom_access(self): + poly0 = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)]) + poly1 = Polygon([(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25)]) + self.subgeom_access_test(MultiPolygon, [poly0, poly1]) + + +def test_fail_list_of_multipolygons(): + """A list of multipolygons is not a valid multipolygon ctor argument""" + multi = MultiPolygon( + [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + ] + ) + with pytest.raises(ValueError): + MultiPolygon([multi]) + + +def test_numpy_object_array(): + geom = MultiPolygon( + [ + ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), + [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))], + ) + ] + ) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/shapely/python/shapely/tests/geometry/test_point.py b/shapely/python/shapely/tests/geometry/test_point.py new file mode 100644 index 0000000..5edbcc4 --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_point.py @@ -0,0 +1,185 @@ +import numpy as np +import pytest + +from shapely import Point +from shapely.coords import CoordinateSequence +from shapely.errors import DimensionError + + +def test_from_coordinates(): + # 2D points + p = Point(1.0, 2.0) + assert p.coords[:] == [(1.0, 2.0)] + assert p.has_z is False + + # 3D Point + p = Point(1.0, 2.0, 3.0) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + assert p.has_z + + # empty + p = Point() + assert p.is_empty + assert isinstance(p.coords, CoordinateSequence) + assert p.coords[:] == [] + + +def test_from_sequence(): + # From single coordinate pair + p = Point((3.0, 4.0)) + assert p.coords[:] == [(3.0, 4.0)] + p = Point([3.0, 4.0]) + assert p.coords[:] == [(3.0, 4.0)] + + # From coordinate sequence + p = Point([(3.0, 4.0)]) + assert p.coords[:] == [(3.0, 4.0)] + p = Point([[3.0, 4.0]]) + assert p.coords[:] == [(3.0, 4.0)] + + # 3D + p = Point((3.0, 4.0, 5.0)) + assert p.coords[:] == [(3.0, 4.0, 5.0)] + p = Point([3.0, 4.0, 5.0]) + assert p.coords[:] == [(3.0, 4.0, 5.0)] + p = Point([(3.0, 4.0, 5.0)]) + assert p.coords[:] == [(3.0, 4.0, 5.0)] + + +def test_from_numpy(): + # Construct from a numpy array + p = Point(np.array([1.0, 2.0])) + assert p.coords[:] == [(1.0, 2.0)] + + p = Point(np.array([1.0, 2.0, 3.0])) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + + +def test_from_numpy_xy(): + # Construct from separate x, y numpy arrays - if those are length 1, + # this is allowed for compat with shapely 1.8 + # (https://github.com/shapely/shapely/issues/1587) + p = Point(np.array([1.0]), np.array([2.0])) + assert p.coords[:] == [(1.0, 2.0)] + + p = Point(np.array([1.0]), np.array([2.0]), np.array([3.0])) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + + +def test_from_point(): + # From another point + p = Point(3.0, 4.0) + q = Point(p) + assert q.coords[:] == [(3.0, 4.0)] + + p = Point(3.0, 4.0, 5.0) + q = Point(p) + assert q.coords[:] == [(3.0, 4.0, 5.0)] + + +def test_from_generator(): + gen = (coord for coord in [(1.0, 2.0)]) + p = Point(gen) + assert p.coords[:] == [(1.0, 2.0)] + + +def test_from_invalid(): + + with pytest.raises(TypeError, match="takes at most 3 arguments"): + Point(1, 2, 3, 4) + + # this worked in shapely 1.x, just ignoring the other coords + with pytest.raises( + ValueError, match="takes only scalar or 1-size vector arguments" + ): + Point([(2, 3), (11, 4)]) + + +class TestPoint: + def test_point(self): + + # Test 2D points + p = Point(1.0, 2.0) + assert p.x == 1.0 + assert p.y == 2.0 + assert p.coords[:] == [(1.0, 2.0)] + assert str(p) == p.wkt + assert p.has_z is False + with pytest.raises(DimensionError): + p.z + + # Check 3D + p = Point(1.0, 2.0, 3.0) + assert p.coords[:] == [(1.0, 2.0, 3.0)] + assert str(p) == p.wkt + assert p.has_z is True + assert p.z == 3.0 + + # Coordinate access + p = Point((3.0, 4.0)) + assert p.x == 3.0 + assert p.y == 4.0 + assert tuple(p.coords) == ((3.0, 4.0),) + assert p.coords[0] == (3.0, 4.0) + with pytest.raises(IndexError): # index out of range + p.coords[1] + + # Bounds + assert p.bounds == (3.0, 4.0, 3.0, 4.0) + + # Geo interface + assert p.__geo_interface__ == {"type": "Point", "coordinates": (3.0, 4.0)} + + def test_point_empty(self): + # Test Non-operability of Null geometry + p_null = Point() + assert p_null.wkt == "POINT EMPTY" + assert p_null.coords[:] == [] + assert p_null.area == 0.0 + + def test_coords(self): + # From Array.txt + p = Point(0.0, 0.0, 1.0) + coords = p.coords[0] + assert coords == (0.0, 0.0, 1.0) + + # Convert to Numpy array, passing through Python sequence + a = np.asarray(coords) + assert a.ndim == 1 + assert a.size == 3 + assert a.shape == (3,) + + +def test_point_immutable(): + p = Point(3.0, 4.0) + + with pytest.raises(AttributeError): + p.coords = (2.0, 1.0) + + with pytest.raises(TypeError): + p.coords[0] = (2.0, 1.0) + + +def test_point_array_coercion(): + # don't convert to array of coordinates, keep objects + p = Point(3.0, 4.0) + arr = np.array(p) + assert arr.ndim == 0 + assert arr.size == 1 + assert arr.dtype == np.dtype("object") + assert arr.item() == p + + +def test_numpy_empty_point_coords(): + pe = Point() + + # Access the coords + a = np.asarray(pe.coords) + assert a.shape == (0, 2) + + +def test_numpy_object_array(): + geom = Point(3.0, 4.0) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom diff --git a/shapely/python/shapely/tests/geometry/test_polygon.py b/shapely/python/shapely/tests/geometry/test_polygon.py new file mode 100644 index 0000000..60ed11b --- /dev/null +++ b/shapely/python/shapely/tests/geometry/test_polygon.py @@ -0,0 +1,463 @@ +"""Polygons and Linear Rings +""" +import numpy as np +import pytest + +from shapely import LinearRing, LineString, Point, Polygon +from shapely.coords import CoordinateSequence +from shapely.errors import TopologicalError +from shapely.wkb import loads as load_wkb + + +def test_empty_linearring_coords(): + assert LinearRing().coords[:] == [] + + +def test_linearring_from_coordinate_sequence(): + expected_coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert ring.coords[:] == expected_coords + + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert ring.coords[:] == expected_coords + + +def test_linearring_from_points(): + # From Points + expected_coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + ring = LinearRing([Point(0.0, 0.0), Point(0.0, 1.0), Point(1.0, 1.0)]) + assert ring.coords[:] == expected_coords + + +def test_linearring_from_closed_linestring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + line = LineString(coords) + ring = LinearRing(line) + assert len(ring.coords) == 4 + assert ring.coords[:] == coords + assert ring.geom_type == "LinearRing" + + +def test_linearring_from_unclosed_linestring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + line = LineString(coords[:-1]) # Pass in unclosed line + ring = LinearRing(line) + assert len(ring.coords) == 4 + assert ring.coords[:] == coords + assert ring.geom_type == "LinearRing" + + +def test_linearring_from_invalid(): + coords = [(0.0, 0.0), (0.0, 0.0), (0.0, 0.0)] + line = LineString(coords) + assert not line.is_valid + with pytest.raises(TopologicalError): + LinearRing(line) + + +def test_linearring_from_too_short_linestring(): + # Creation of LinearRing request at least 3 coordinates (unclosed) or + # 4 coordinates (closed) + coords = [(0.0, 0.0), (1.0, 1.0)] + line = LineString(coords) + with pytest.raises(ValueError, match="requires at least 4 coordinates"): + LinearRing(line) + + +def test_linearring_from_linearring(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + ring = LinearRing(coords) + assert ring.coords[:] == coords + + +def test_linearring_from_generator(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + gen = (coord for coord in coords) + ring = LinearRing(gen) + assert ring.coords[:] == coords + + +def test_linearring_from_empty(): + ring = LinearRing() + assert ring.is_empty + assert isinstance(ring.coords, CoordinateSequence) + assert ring.coords[:] == [] + + ring = LinearRing([]) + assert ring.is_empty + assert isinstance(ring.coords, CoordinateSequence) + assert ring.coords[:] == [] + + +def test_linearring_from_numpy(): + # Construct from a numpy array + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + + ring = LinearRing(np.array(coords)) + assert ring.coords[:] == [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + + +def test_numpy_linearring_coords(): + from numpy.testing import assert_array_equal + + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + ra = np.asarray(ring.coords) + expected = np.asarray([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)]) + assert_array_equal(ra, expected) + + +def test_numpy_empty_linearring_coords(): + ring = LinearRing() + assert np.asarray(ring.coords).shape == (0, 2) + + +def test_numpy_object_array(): + geom = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + ar = np.empty(1, object) + ar[:] = [geom] + assert ar[0] == geom + + +def test_polygon_from_coordinate_sequence(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + # Construct a polygon, exterior ring only + polygon = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 0 + + polygon = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0)]) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 0 + + +def test_polygon_from_coordinate_sequence_with_holes(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + + # Interior rings (holes) + polygon = Polygon(coords, [[(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25)]]) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 1 + assert len(polygon.interiors[0].coords) == 5 + + # Multiple interior rings with different length + coords = [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)] + holes = [ + [(1, 1), (2, 1), (2, 2), (1, 2), (1, 1)], + [(3, 3), (3, 4), (4, 5), (5, 4), (5, 3), (3, 3)], + ] + polygon = Polygon(coords, holes) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 2 + assert len(polygon.interiors[0].coords) == 5 + assert len(polygon.interiors[1].coords) == 6 + + +def test_polygon_from_linearring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + ring = LinearRing(coords) + + polygon = Polygon(ring) + assert polygon.exterior.coords[:] == coords + assert len(polygon.interiors) == 0 + + # from shell and holes linearrings + shell = LinearRing([(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)]) + holes = [ + LinearRing([(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)]), + LinearRing([(30.0, 10.0), (50.0, 10.0), (40.0, 30.0), (30.0, 10.0)]), + LinearRing([(90.0, 10), (110.0, 10.0), (100.0, 30.0), (90.0, 10.0)]), + ] + polygon = Polygon(shell, holes) + assert polygon.exterior.coords[:] == shell.coords[:] + assert len(polygon.interiors) == 3 + for i in range(3): + assert polygon.interiors[i].coords[:] == holes[i].coords[:] + + +def test_polygon_from_linestring(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + line = LineString(coords) + polygon = Polygon(line) + assert polygon.exterior.coords[:] == coords + + # from unclosed linestring + line = LineString(coords[:-1]) + polygon = Polygon(line) + assert polygon.exterior.coords[:] == coords + + +def test_polygon_from_points(): + polygon = Polygon([Point(0.0, 0.0), Point(0.0, 1.0), Point(1.0, 1.0)]) + expected_coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)] + assert polygon.exterior.coords[:] == expected_coords + + +def test_polygon_from_polygon(): + coords = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)] + polygon = Polygon(coords, [[(0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25)]]) + + # Test from another Polygon + copy = Polygon(polygon) + assert len(copy.exterior.coords) == 5 + assert len(copy.interiors) == 1 + assert len(copy.interiors[0].coords) == 5 + + +def test_polygon_from_invalid(): + # Error handling + with pytest.raises(ValueError): + # A LinearRing must have at least 3 coordinate tuples + Polygon([[1, 2], [2, 3]]) + + +def test_polygon_from_empty(): + polygon = Polygon() + assert polygon.is_empty + assert polygon.exterior.coords[:] == [] + + polygon = Polygon([]) + assert polygon.is_empty + assert polygon.exterior.coords[:] == [] + + +def test_polygon_from_numpy(): + a = np.array(((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0))) + polygon = Polygon(a) + assert len(polygon.exterior.coords) == 5 + assert polygon.exterior.coords[:] == [ + (0.0, 0.0), + (0.0, 1.0), + (1.0, 1.0), + (1.0, 0.0), + (0.0, 0.0), + ] + assert len(polygon.interiors) == 0 + + +def test_polygon_from_generator(): + coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)] + gen = (coord for coord in coords) + polygon = Polygon(gen) + assert polygon.exterior.coords[:] == coords + + +class TestPolygon: + def test_linearring(self): + + # Initialization + # Linear rings won't usually be created by users, but by polygons + coords = ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)) + ring = LinearRing(coords) + assert len(ring.coords) == 5 + assert ring.coords[0] == ring.coords[4] + assert ring.coords[0] == ring.coords[-1] + assert ring.is_ring is True + + def test_polygon(self): + coords = ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)) + + # Construct a polygon, exterior ring only + polygon = Polygon(coords) + assert len(polygon.exterior.coords) == 5 + + # Ring Access + assert isinstance(polygon.exterior, LinearRing) + ring = polygon.exterior + assert len(ring.coords) == 5 + assert ring.coords[0] == ring.coords[4] + assert ring.coords[0] == (0.0, 0.0) + assert ring.is_ring is True + assert len(polygon.interiors) == 0 + + # Create a new polygon from WKB + data = polygon.wkb + polygon = None + ring = None + polygon = load_wkb(data) + ring = polygon.exterior + assert len(ring.coords) == 5 + assert ring.coords[0] == ring.coords[4] + assert ring.coords[0] == (0.0, 0.0) + assert ring.is_ring is True + polygon = None + + # Interior rings (holes) + polygon = Polygon( + coords, [((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25))] + ) + assert len(polygon.exterior.coords) == 5 + assert len(polygon.interiors[0].coords) == 5 + with pytest.raises(IndexError): # index out of range + polygon.interiors[1] + + # Coordinate getter raises exceptions + with pytest.raises(NotImplementedError): + polygon.coords + + # Geo interface + assert polygon.__geo_interface__ == { + "type": "Polygon", + "coordinates": ( + ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)), + ((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)), + ), + } + + def test_linearring_empty(self): + # Test Non-operability of Null rings + r_null = LinearRing() + assert r_null.wkt == "LINEARRING EMPTY" + assert r_null.length == 0.0 + + def test_dimensions(self): + + # Background: see http://trac.gispython.org/lab/ticket/168 + # http://lists.gispython.org/pipermail/community/2008-August/001859.html + + coords = ((0.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0), (1.0, 0.0, 0.0)) + polygon = Polygon(coords) + assert polygon._ndim == 3 + gi = polygon.__geo_interface__ + assert gi["coordinates"] == ( + ( + (0.0, 0.0, 0.0), + (0.0, 1.0, 0.0), + (1.0, 1.0, 0.0), + (1.0, 0.0, 0.0), + (0.0, 0.0, 0.0), + ), + ) + + e = polygon.exterior + assert e._ndim == 3 + gi = e.__geo_interface__ + assert gi["coordinates"] == ( + (0.0, 0.0, 0.0), + (0.0, 1.0, 0.0), + (1.0, 1.0, 0.0), + (1.0, 0.0, 0.0), + (0.0, 0.0, 0.0), + ) + + def test_attribute_chains(self): + + # Attribute Chaining + # See also ticket #151. + p = Polygon([(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)]) + assert list(p.boundary.coords) == [ + (0.0, 0.0), + (0.0, 1.0), + (-1.0, 1.0), + (-1.0, 0.0), + (0.0, 0.0), + ] + + ec = list(Point(0.0, 0.0).buffer(1.0, 1).exterior.coords) + assert isinstance(ec, list) # TODO: this is a poor test + + # Test chained access to interiors + p = Polygon( + [(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)], + [[(-0.25, 0.25), (-0.25, 0.75), (-0.75, 0.75), (-0.75, 0.25)]], + ) + assert p.area == 0.75 + + """Not so much testing the exact values here, which are the + responsibility of the geometry engine (GEOS), but that we can get + chain functions and properties using anonymous references. + """ + assert list(p.interiors[0].coords) == [ + (-0.25, 0.25), + (-0.25, 0.75), + (-0.75, 0.75), + (-0.75, 0.25), + (-0.25, 0.25), + ] + xy = list(p.interiors[0].buffer(1).exterior.coords)[0] + assert len(xy) == 2 + + # Test multiple operators, boundary of a buffer + ec = list(p.buffer(1).boundary.coords) + assert isinstance(ec, list) # TODO: this is a poor test + + def test_empty_equality(self): + # Test equals operator, including empty geometries + # see issue #338 + + point1 = Point(0, 0) + polygon1 = Polygon([(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)]) + polygon2 = Polygon([(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0)]) + polygon_empty1 = Polygon() + polygon_empty2 = Polygon() + + assert point1 != polygon1 + assert polygon_empty1 == polygon_empty2 + assert polygon1 != polygon_empty1 + assert polygon1 == polygon2 + assert polygon_empty1 is not None + + def test_from_bounds(self): + xmin, ymin, xmax, ymax = -180, -90, 180, 90 + coords = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)] + assert Polygon(coords) == Polygon.from_bounds(xmin, ymin, xmax, ymax) + + def test_empty_polygon_exterior(self): + p = Polygon() + assert p.exterior == LinearRing() + + +def test_linearring_immutable(): + ring = LinearRing([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)]) + + with pytest.raises(AttributeError): + ring.coords = [(1.0, 1.0), (2.0, 2.0), (1.0, 2.0)] + + with pytest.raises(TypeError): + ring.coords[0] = (1.0, 1.0) + + +class TestLinearRingGetItem: + def test_index_linearring(self): + shell = LinearRing([(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)]) + holes = [ + LinearRing([(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)]), + LinearRing([(30.0, 10.0), (50.0, 10.0), (40.0, 30.0), (30.0, 10.0)]), + LinearRing([(90.0, 10), (110.0, 10.0), (100.0, 30.0), (90.0, 10.0)]), + ] + g = Polygon(shell, holes) + for i in range(-3, 3): + assert g.interiors[i].equals(holes[i]) + with pytest.raises(IndexError): + g.interiors[3] + with pytest.raises(IndexError): + g.interiors[-4] + + def test_index_linearring_misc(self): + g = Polygon() # empty + with pytest.raises(IndexError): + g.interiors[0] + with pytest.raises(TypeError): + g.interiors[0.0] + + def test_slice_linearring(self): + shell = LinearRing([(0.0, 0.0), (70.0, 120.0), (140.0, 0.0), (0.0, 0.0)]) + holes = [ + LinearRing([(60.0, 80.0), (80.0, 80.0), (70.0, 60.0), (60.0, 80.0)]), + LinearRing([(30.0, 10.0), (50.0, 10.0), (40.0, 30.0), (30.0, 10.0)]), + LinearRing([(90.0, 10), (110.0, 10.0), (100.0, 30.0), (90.0, 10.0)]), + ] + g = Polygon(shell, holes) + t = [a.equals(b) for (a, b) in zip(g.interiors[1:], holes[1:])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[:-1], holes[:-1])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[::-1], holes[::-1])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[::2], holes[::2])] + assert all(t) + t = [a.equals(b) for (a, b) in zip(g.interiors[:3], holes[:3])] + assert all(t) + assert g.interiors[3:] == holes[3:] == [] diff --git a/shapely/python/shapely/tests/test_constructive.py b/shapely/python/shapely/tests/test_constructive.py new file mode 100644 index 0000000..279cd33 --- /dev/null +++ b/shapely/python/shapely/tests/test_constructive.py @@ -0,0 +1,986 @@ +import numpy as np +import pytest + +import shapely +from shapely import ( + Geometry, + GeometryCollection, + GEOSException, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) +from shapely.testing import assert_geometries_equal + +from .common import ( + all_types, + empty, + empty_line_string, + empty_point, + empty_polygon, + ignore_invalid, + line_string, + multi_point, + point, + point_z, +) + +CONSTRUCTIVE_NO_ARGS = ( + shapely.boundary, + shapely.centroid, + shapely.convex_hull, + pytest.param( + shapely.concave_hull, + marks=pytest.mark.skipif( + shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11" + ), + ), + shapely.envelope, + shapely.extract_unique_points, + shapely.node, + shapely.normalize, + shapely.point_on_surface, +) + +CONSTRUCTIVE_FLOAT_ARG = ( + shapely.buffer, + shapely.offset_curve, + shapely.delaunay_triangles, + shapely.simplify, + shapely.voronoi_polygons, +) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", CONSTRUCTIVE_NO_ARGS) +def test_no_args_array(geometry, func): + actual = func([geometry, geometry]) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", CONSTRUCTIVE_FLOAT_ARG) +def test_float_arg_array(geometry, func): + if ( + func is shapely.offset_curve + and shapely.get_type_id(geometry) not in [1, 2] + and shapely.geos_version < (3, 11, 0) + ): + with pytest.raises(GEOSException, match="only accept linestrings"): + func([geometry, geometry], 0.0) + return + # voronoi_polygons emits an "invalid" warning when supplied with an empty + # point (see https://github.com/libgeos/geos/issues/515) + with ignore_invalid( + func is shapely.voronoi_polygons + and shapely.get_type_id(geometry) == 0 + and shapely.geos_version < (3, 12, 0) + ): + actual = func([geometry, geometry], 0.0) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("reference", all_types) +def test_snap_array(geometry, reference): + actual = shapely.snap([geometry, geometry], [reference, reference], tolerance=1.0) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + +@pytest.mark.parametrize("func", CONSTRUCTIVE_NO_ARGS) +def test_no_args_missing(func): + actual = func(None) + assert actual is None + + +@pytest.mark.parametrize("func", CONSTRUCTIVE_FLOAT_ARG) +def test_float_arg_missing(func): + actual = func(None, 1.0) + assert actual is None + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", CONSTRUCTIVE_FLOAT_ARG) +def test_float_arg_nan(geometry, func): + actual = func(geometry, float("nan")) + assert actual is None + + +def test_buffer_cap_style_invalid(): + with pytest.raises(ValueError, match="'invalid' is not a valid option"): + shapely.buffer(point, 1, cap_style="invalid") + + +def test_buffer_join_style_invalid(): + with pytest.raises(ValueError, match="'invalid' is not a valid option"): + shapely.buffer(point, 1, join_style="invalid") + + +def test_snap_none(): + actual = shapely.snap(None, point, tolerance=1.0) + assert actual is None + + +@pytest.mark.parametrize("geometry", all_types) +def test_snap_nan_float(geometry): + actual = shapely.snap(geometry, point, tolerance=np.nan) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_build_area_none(): + actual = shapely.build_area(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom,expected", + [ + (point, empty), # a point has no area + (line_string, empty), # a line string has no area + # geometry collection of two polygons are combined into one + ( + GeometryCollection( + [ + Polygon([(0, 0), (0, 3), (3, 3), (3, 0), (0, 0)]), + Polygon([(1, 1), (2, 2), (1, 2), (1, 1)]), + ] + ), + Polygon( + [(0, 0), (0, 3), (3, 3), (3, 0), (0, 0)], + holes=[[(1, 1), (2, 2), (1, 2), (1, 1)]], + ), + ), + (empty, empty), + ([empty], [empty]), + ], +) +def test_build_area(geom, expected): + actual = shapely.build_area(geom) + assert actual is not expected + assert actual == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_make_valid_none(): + actual = shapely.make_valid(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point), # a valid geometry stays the same (but is copied) + # an L shaped polygon without area is converted to a multilinestring + ( + Polygon([(0, 0), (1, 1), (1, 2), (1, 1), (0, 0)]), + MultiLineString([((1, 1), (1, 2)), ((0, 0), (1, 1))]), + ), + # a polygon with self-intersection (bowtie) is converted into polygons + ( + Polygon([(0, 0), (2, 2), (2, 0), (0, 2), (0, 0)]), + MultiPolygon( + [ + Polygon([(1, 1), (2, 2), (2, 0), (1, 1)]), + Polygon([(0, 0), (0, 2), (1, 1), (0, 0)]), + ] + ), + ), + (empty, empty), + ([empty], [empty]), + ], +) +def test_make_valid(geom, expected): + actual = shapely.make_valid(geom) + assert actual is not expected + # normalize needed to handle variation in output across GEOS versions + assert shapely.normalize(actual) == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom,expected", + [ + (all_types, all_types), + # first polygon is valid, second polygon has self-intersection + ( + [ + Polygon([(0, 0), (2, 2), (0, 2), (0, 0)]), + Polygon([(0, 0), (2, 2), (2, 0), (0, 2), (0, 0)]), + ], + [ + Polygon([(0, 0), (2, 2), (0, 2), (0, 0)]), + MultiPolygon( + [ + Polygon([(1, 1), (0, 0), (0, 2), (1, 1)]), + Polygon([(1, 1), (2, 2), (2, 0), (1, 1)]), + ] + ), + ], + ), + ([point, None, empty], [point, None, empty]), + ], +) +def test_make_valid_1d(geom, expected): + actual = shapely.make_valid(geom) + # normalize needed to handle variation in output across GEOS versions + assert np.all(shapely.normalize(actual) == shapely.normalize(expected)) + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point), # a point is always in normalized form + # order coordinates of linestrings and parts of multi-linestring + ( + MultiLineString([((1, 1), (0, 0)), ((1, 1), (1, 2))]), + MultiLineString([((1, 1), (1, 2)), ((0, 0), (1, 1))]), + ), + ], +) +def test_normalize(geom, expected): + actual = shapely.normalize(geom) + assert actual == expected + + +def test_offset_curve_empty(): + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Empty geometries emit an "invalid" warning + # (see https://github.com/libgeos/geos/issues/515) + actual = shapely.offset_curve(empty_line_string, 2.0) + assert shapely.is_empty(actual) + + +def test_offset_curve_distance_array(): + # check that kwargs are passed through + result = shapely.offset_curve([line_string, line_string], [-2.0, -3.0]) + assert result[0] == shapely.offset_curve(line_string, -2.0) + assert result[1] == shapely.offset_curve(line_string, -3.0) + + +def test_offset_curve_kwargs(): + # check that kwargs are passed through + result1 = shapely.offset_curve( + line_string, -2.0, quad_segs=2, join_style="mitre", mitre_limit=2.0 + ) + result2 = shapely.offset_curve(line_string, -2.0) + assert result1 != result2 + + +def test_offset_curve_non_scalar_kwargs(): + msg = "only accepts scalar values" + with pytest.raises(TypeError, match=msg): + shapely.offset_curve([line_string, line_string], 1, quad_segs=np.array([8, 9])) + + with pytest.raises(TypeError, match=msg): + shapely.offset_curve( + [line_string, line_string], 1, join_style=["round", "bevel"] + ) + + with pytest.raises(TypeError, match=msg): + shapely.offset_curve([line_string, line_string], 1, mitre_limit=[5.0, 6.0]) + + +def test_offset_curve_join_style_invalid(): + with pytest.raises(ValueError, match="'invalid' is not a valid option"): + shapely.offset_curve(line_string, 1.0, join_style="invalid") + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +@pytest.mark.parametrize( + "geom,expected", + [ + (LineString([(0, 0), (0, 0), (1, 0)]), LineString([(0, 0), (1, 0)])), + ( + LinearRing([(0, 0), (1, 2), (1, 2), (1, 3), (0, 0)]), + LinearRing([(0, 0), (1, 2), (1, 3), (0, 0)]), + ), + ( + Polygon([(0, 0), (0, 0), (1, 0), (1, 1), (1, 0), (0, 0)]), + Polygon([(0, 0), (1, 0), (1, 1), (1, 0), (0, 0)]), + ), + ( + Polygon( + [(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)], + holes=[[(2, 2), (2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], + ), + Polygon( + [(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)], + holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], + ), + ), + ( + MultiPolygon( + [ + Polygon([(0, 0), (0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(2, 2), (2, 2), (2, 3), (3, 3), (3, 2), (2, 2)]), + ] + ), + MultiPolygon( + [ + Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(2, 2), (2, 3), (3, 3), (3, 2), (2, 2)]), + ] + ), + ), + # points are unchanged + (point, point), + (point_z, point_z), + (multi_point, multi_point), + # empty geometries are unchanged + (empty_point, empty_point), + (empty_line_string, empty_line_string), + (empty, empty), + (empty_polygon, empty_polygon), + ], +) +def test_remove_repeated_points(geom, expected): + assert_geometries_equal(shapely.remove_repeated_points(geom, 0), expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 12, 0), reason="GEOS < 3.12") +@pytest.mark.parametrize( + "geom, tolerance", [[Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), 2]] +) +def test_remove_repeated_points_invalid_result(geom, tolerance): + # Requiring GEOS 3.12 instead of 3.11 + # (GEOS 3.11 had a bug causing this to intermittently not fail) + with pytest.raises(shapely.GEOSException, match="Invalid number of points"): + shapely.remove_repeated_points(geom, tolerance) + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +def test_remove_repeated_points_none(): + assert shapely.remove_repeated_points(None, 1) is None + assert shapely.remove_repeated_points([None], 1).tolist() == [None] + + geometry = LineString([(0, 0), (0, 0), (1, 1)]) + expected = LineString([(0, 0), (1, 1)]) + result = shapely.remove_repeated_points([None, geometry], 1) + assert result[0] is None + assert_geometries_equal(result[1], expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +@pytest.mark.parametrize("geom, tolerance", [("Not a geometry", 1), (1, 1)]) +def test_remove_repeated_points_invalid_type(geom, tolerance): + with pytest.raises(TypeError, match="One of the arguments is of incorrect type"): + shapely.remove_repeated_points(geom, tolerance) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom,expected", + [ + (LineString([(0, 0), (1, 2)]), LineString([(1, 2), (0, 0)])), + ( + LinearRing([(0, 0), (1, 2), (1, 3), (0, 0)]), + LinearRing([(0, 0), (1, 3), (1, 2), (0, 0)]), + ), + ( + Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]), + ), + ( + Polygon( + [(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)], + holes=[[(2, 2), (2, 4), (4, 4), (4, 2), (2, 2)]], + ), + Polygon( + [(0, 0), (0, 10), (10, 10), (10, 0), (0, 0)], + holes=[[(2, 2), (4, 2), (4, 4), (2, 4), (2, 2)]], + ), + ), + pytest.param( + MultiLineString([[(0, 0), (1, 2)], [(3, 3), (4, 4)]]), + MultiLineString([[(1, 2), (0, 0)], [(4, 4), (3, 3)]]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 8, 1), reason="GEOS < 3.8.1" + ), + ), + ( + MultiPolygon( + [ + Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]), + Polygon([(2, 2), (2, 3), (3, 3), (3, 2), (2, 2)]), + ] + ), + MultiPolygon( + [ + Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]), + Polygon([(2, 2), (3, 2), (3, 3), (2, 3), (2, 2)]), + ] + ), + ), + # points are unchanged + (point, point), + (point_z, point_z), + (multi_point, multi_point), + # empty geometries are unchanged + (empty_point, empty_point), + (empty_line_string, empty_line_string), + (empty, empty), + (empty_polygon, empty_polygon), + ], +) +def test_reverse(geom, expected): + assert_geometries_equal(shapely.reverse(geom), expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_reverse_none(): + assert shapely.reverse(None) is None + assert shapely.reverse([None]).tolist() == [None] + + geometry = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) + expected = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) + result = shapely.reverse([None, geometry]) + assert result[0] is None + assert_geometries_equal(result[1], expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize("geom", ["Not a geometry", 1]) +def test_reverse_invalid_type(geom): + with pytest.raises(TypeError, match="One of the arguments is of incorrect type"): + shapely.reverse(geom) + + +@pytest.mark.parametrize( + "geom,expected", + [ + # Point outside + (Point(0, 0), GeometryCollection()), + # Point inside + (Point(15, 15), Point(15, 15)), + # Point on boundary + (Point(15, 10), GeometryCollection()), + # Line outside + (LineString([(0, 0), (-5, 5)]), GeometryCollection()), + # Line inside + (LineString([(15, 15), (16, 15)]), LineString([(15, 15), (16, 15)])), + # Line on boundary + (LineString([(10, 15), (10, 10), (15, 10)]), GeometryCollection()), + # Line splitting rectangle + (LineString([(10, 5), (25, 20)]), LineString([(15, 10), (20, 15)])), + ], +) +def test_clip_by_rect(geom, expected): + actual = shapely.clip_by_rect(geom, 10, 10, 20, 20) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "geom, rect, expected", + [ + # Polygon hole (CCW) fully on rectangle boundary""" + ( + Polygon( + ((0, 0), (0, 30), (30, 30), (30, 0), (0, 0)), + holes=[((10, 10), (20, 10), (20, 20), (10, 20), (10, 10))], + ), + (10, 10, 20, 20), + GeometryCollection(), + ), + # Polygon hole (CW) fully on rectangle boundary""" + ( + Polygon( + ((0, 0), (0, 30), (30, 30), (30, 0), (0, 0)), + holes=[((10, 10), (10, 20), (20, 20), (20, 10), (10, 10))], + ), + (10, 10, 20, 20), + GeometryCollection(), + ), + # Polygon fully within rectangle""" + ( + Polygon( + ((1, 1), (1, 30), (30, 30), (30, 1), (1, 1)), + holes=[((10, 10), (20, 10), (20, 20), (10, 20), (10, 10))], + ), + (0, 0, 40, 40), + Polygon( + ((1, 1), (1, 30), (30, 30), (30, 1), (1, 1)), + holes=[((10, 10), (20, 10), (20, 20), (10, 20), (10, 10))], + ), + ), + # Polygon overlapping rectanglez + ( + Polygon( + [(0, 0), (0, 30), (30, 30), (30, 0), (0, 0)], + holes=[[(10, 10), (20, 10), (20, 20), (10, 20), (10, 10)]], + ), + (5, 5, 15, 15), + Polygon([(5, 5), (5, 15), (10, 15), (10, 10), (15, 10), (15, 5), (5, 5)]), + ), + ], +) +def test_clip_by_rect_polygon(geom, rect, expected): + actual = shapely.clip_by_rect(geom, *rect) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize("geometry", all_types) +def test_clip_by_rect_array(geometry): + actual = shapely.clip_by_rect([geometry, geometry], 0.0, 0.0, 1.0, 1.0) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + +def test_clip_by_rect_missing(): + actual = shapely.clip_by_rect(None, 0, 0, 1, 1) + assert actual is None + + +@pytest.mark.parametrize("geom", [empty, empty_line_string, empty_polygon]) +def test_clip_by_rect_empty(geom): + # TODO empty point + actual = shapely.clip_by_rect(geom, 0, 0, 1, 1) + assert actual == GeometryCollection() + + +def test_clip_by_rect_non_scalar_kwargs(): + msg = "only accepts scalar values" + with pytest.raises(TypeError, match=msg): + shapely.clip_by_rect([line_string, line_string], 0, 0, 1, np.array([0, 1])) + + +def test_polygonize(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + LineString([(1, 1), (1, 0)]), + LineString([(1, 0), (0, 0)]), + LineString([(5, 5), (6, 6)]), + Point(0, 0), + None, + ] + result = shapely.polygonize(lines) + assert shapely.get_type_id(result) == 7 # GeometryCollection + expected = GeometryCollection( + [ + Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]), + Polygon([(1, 1), (0, 0), (0, 1), (1, 1)]), + ] + ) + assert result == expected + + +def test_polygonize_array(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + expected = GeometryCollection([Polygon([(1, 1), (0, 0), (0, 1), (1, 1)])]) + result = shapely.polygonize(np.array(lines)) + assert isinstance(result, shapely.Geometry) + assert result == expected + + result = shapely.polygonize(np.array([lines])) + assert isinstance(result, np.ndarray) + assert result.shape == (1,) + assert result[0] == expected + + arr = np.array([lines, lines]) + assert arr.shape == (2, 3) + result = shapely.polygonize(arr) + assert isinstance(result, np.ndarray) + assert result.shape == (2,) + assert result[0] == expected + assert result[1] == expected + + arr = np.array([[lines, lines], [lines, lines], [lines, lines]]) + assert arr.shape == (3, 2, 3) + result = shapely.polygonize(arr) + assert isinstance(result, np.ndarray) + assert result.shape == (3, 2) + for res in result.flatten(): + assert res == expected + + +@pytest.mark.skipif( + np.__version__ < "1.15", + reason="axis keyword for generalized ufunc introduced in np 1.15", +) +def test_polygonize_array_axis(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + arr = np.array([lines, lines]) # shape (2, 3) + result = shapely.polygonize(arr, axis=1) + assert result.shape == (2,) + result = shapely.polygonize(arr, axis=0) + assert result.shape == (3,) + + +def test_polygonize_missing(): + # set of geometries that is all missing + result = shapely.polygonize([None, None]) + assert result == GeometryCollection() + + +def test_polygonize_full(): + lines = [ + None, + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + LineString([(1, 1), (1, 0)]), + None, + LineString([(1, 0), (0, 0)]), + LineString([(5, 5), (6, 6)]), + LineString([(1, 1), (100, 100)]), + Point(0, 0), + None, + ] + result = shapely.polygonize_full(lines) + assert len(result) == 4 + assert all(shapely.get_type_id(geom) == 7 for geom in result) # GeometryCollection + polygons, cuts, dangles, invalid = result + expected_polygons = GeometryCollection( + [ + Polygon([(0, 0), (1, 1), (1, 0), (0, 0)]), + Polygon([(1, 1), (0, 0), (0, 1), (1, 1)]), + ] + ) + assert polygons == expected_polygons + assert cuts == GeometryCollection() + expected_dangles = GeometryCollection( + [LineString([(1, 1), (100, 100)]), LineString([(5, 5), (6, 6)])] + ) + assert dangles == expected_dangles + assert invalid == GeometryCollection() + + +def test_polygonize_full_array(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + expected = GeometryCollection([Polygon([(1, 1), (0, 0), (0, 1), (1, 1)])]) + result = shapely.polygonize_full(np.array(lines)) + assert len(result) == 4 + assert all(isinstance(geom, shapely.Geometry) for geom in result) + assert result[0] == expected + assert all(geom == GeometryCollection() for geom in result[1:]) + + result = shapely.polygonize_full(np.array([lines])) + assert len(result) == 4 + assert all(isinstance(geom, np.ndarray) for geom in result) + assert all(geom.shape == (1,) for geom in result) + assert result[0][0] == expected + assert all(geom[0] == GeometryCollection() for geom in result[1:]) + + arr = np.array([lines, lines]) + assert arr.shape == (2, 3) + result = shapely.polygonize_full(arr) + assert len(result) == 4 + assert all(isinstance(arr, np.ndarray) for arr in result) + assert all(arr.shape == (2,) for arr in result) + assert result[0][0] == expected + assert result[0][1] == expected + assert all(g == GeometryCollection() for geom in result[1:] for g in geom) + + arr = np.array([[lines, lines], [lines, lines], [lines, lines]]) + assert arr.shape == (3, 2, 3) + result = shapely.polygonize_full(arr) + assert len(result) == 4 + assert all(isinstance(arr, np.ndarray) for arr in result) + assert all(arr.shape == (3, 2) for arr in result) + for res in result[0].flatten(): + assert res == expected + for arr in result[1:]: + for res in arr.flatten(): + assert res == GeometryCollection() + + +@pytest.mark.skipif( + np.__version__ < "1.15", + reason="axis keyword for generalized ufunc introduced in np 1.15", +) +def test_polygonize_full_array_axis(): + lines = [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (0, 1)]), + LineString([(0, 1), (1, 1)]), + ] + arr = np.array([lines, lines]) # shape (2, 3) + result = shapely.polygonize_full(arr, axis=1) + assert len(result) == 4 + assert all(arr.shape == (2,) for arr in result) + result = shapely.polygonize_full(arr, axis=0) + assert len(result) == 4 + assert all(arr.shape == (3,) for arr in result) + + +def test_polygonize_full_missing(): + # set of geometries that is all missing + result = shapely.polygonize_full([None, None]) + assert len(result) == 4 + assert all(geom == GeometryCollection() for geom in result) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("max_segment_length", [-1, 0]) +def test_segmentize_invalid_max_segment_length(geometry, max_segment_length): + with pytest.raises(GEOSException, match="IllegalArgumentException"): + shapely.segmentize(geometry, max_segment_length=max_segment_length) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("geometry", all_types) +def test_segmentize_max_segment_length_nan(geometry): + actual = shapely.segmentize(geometry, max_segment_length=np.nan) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry", [empty, empty_point, empty_line_string, empty_polygon] +) +def test_segmentize_empty(geometry): + actual = shapely.segmentize(geometry, max_segment_length=5) + assert_geometries_equal(actual, geometry) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("geometry", [point, point_z, multi_point]) +def test_segmentize_no_change(geometry): + actual = shapely.segmentize(geometry, max_segment_length=5) + assert_geometries_equal(actual, geometry) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_segmentize_none(): + assert shapely.segmentize(None, max_segment_length=5) is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,tolerance, expected", + [ + # tolerance greater than max edge length, no change + ( + LineString([(0, 0), (0, 10)]), + 20, + LineString([(0, 0), (0, 10)]), + ), + ( + Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]), + 20, + Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]), + ), + # tolerance causes one vertex per segment + ( + LineString([(0, 0), (0, 10)]), + 5, + LineString([(0, 0), (0, 5), (0, 10)]), + ), + ( + Polygon([(0, 0), (10, 0), (10, 10), (0, 10), (0, 0)]), + 5, + Polygon( + [ + (0, 0), + (5, 0), + (10, 0), + (10, 5), + (10, 10), + (5, 10), + (0, 10), + (0, 5), + (0, 0), + ] + ), + ), + # ensure input arrays are broadcast correctly + ( + [ + LineString([(0, 0), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + 5, + [ + LineString([(0, 0), (0, 5), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + ), + ( + [ + LineString([(0, 0), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + [5], + [ + LineString([(0, 0), (0, 5), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + ), + ( + [ + LineString([(0, 0), (0, 10)]), + LineString([(0, 0), (0, 2)]), + ], + [5, 1.5], + [ + LineString([(0, 0), (0, 5), (0, 10)]), + LineString([(0, 0), (0, 1), (0, 2)]), + ], + ), + ], +) +def test_segmentize(geometry, tolerance, expected): + actual = shapely.segmentize(geometry, tolerance) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize("geometry", all_types) +def test_minimum_bounding_circle_all_types(geometry): + actual = shapely.minimum_bounding_circle([geometry, geometry]) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + actual = shapely.minimum_bounding_circle(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + Polygon([(0, 5), (5, 10), (10, 5), (5, 0), (0, 5)]), + shapely.buffer(Point(5, 5), 5), + ), + ( + LineString([(1, 0), (1, 10)]), + shapely.buffer(Point(1, 5), 5), + ), + ( + MultiPoint([(2, 2), (4, 2)]), + shapely.buffer(Point(3, 2), 1), + ), + ( + Point(2, 2), + Point(2, 2), + ), + ( + GeometryCollection(), + Polygon(), + ), + ], +) +def test_minimum_bounding_circle(geometry, expected): + actual = shapely.minimum_bounding_circle(geometry) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("geometry", all_types) +def test_oriented_envelope_all_types(geometry): + actual = shapely.oriented_envelope([geometry, geometry]) + assert actual.shape == (2,) + assert actual[0] is None or isinstance(actual[0], Geometry) + + actual = shapely.oriented_envelope(None) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + MultiPoint([(0, 0), (10, 0), (10, 10)]), + Polygon([(0, 0), (5, -5), (15, 5), (10, 10), (0, 0)]), + ), + ( + LineString([(1, 1), (5, 1), (10, 10)]), + Polygon([(1, 1), (3, -1), (12, 8), (10, 10), (1, 1)]), + ), + ( + Polygon([(1, 1), (15, 1), (5, 10), (1, 1)]), + Polygon([(15, 1), (15, 10), (1, 10), (1, 1), (15, 1)]), + ), + ( + LineString([(1, 1), (10, 1)]), + LineString([(1, 1), (10, 1)]), + ), + ( + Point(2, 2), + Point(2, 2), + ), + ( + GeometryCollection(), + Polygon(), + ), + ], +) +def test_oriented_envelope(geometry, expected): + actual = shapely.oriented_envelope(geometry) + assert shapely.equals(actual, expected).all() + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + MultiPoint([(0, 0), (10, 0), (10, 10)]), + Polygon([(0, 0), (5, -5), (15, 5), (10, 10), (0, 0)]), + ), + ( + LineString([(1, 1), (5, 1), (10, 10)]), + Polygon([(1, 1), (3, -1), (12, 8), (10, 10), (1, 1)]), + ), + ( + Polygon([(1, 1), (15, 1), (5, 10), (1, 1)]), + Polygon([(15, 1), (15, 10), (1, 10), (1, 1), (15, 1)]), + ), + ( + LineString([(1, 1), (10, 1)]), + LineString([(1, 1), (10, 1)]), + ), + ( + Point(2, 2), + Point(2, 2), + ), + ( + GeometryCollection(), + Polygon(), + ), + ], +) +def test_minimum_rotated_rectangle(geometry, expected): + actual = shapely.minimum_rotated_rectangle(geometry) + assert shapely.equals(actual, expected).all() + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11") +def test_concave_hull_kwargs(): + p = Point(10, 10) + mp = MultiPoint(p.buffer(5).exterior.coords[:] + p.buffer(4).exterior.coords[:]) + + result1 = shapely.concave_hull(mp, ratio=0.5) + assert len(result1.interiors) == 0 + result2 = shapely.concave_hull(mp, ratio=0.5, allow_holes=True) + assert len(result2.interiors) == 1 + + result3 = shapely.concave_hull(mp, ratio=0) + result4 = shapely.concave_hull(mp, ratio=1) + assert shapely.get_num_coordinates(result4) < shapely.get_num_coordinates(result3) diff --git a/shapely/python/shapely/tests/test_coordinates.py b/shapely/python/shapely/tests/test_coordinates.py new file mode 100644 index 0000000..d9decc5 --- /dev/null +++ b/shapely/python/shapely/tests/test_coordinates.py @@ -0,0 +1,267 @@ +import numpy as np +import pytest +from numpy.testing import assert_allclose, assert_equal + +import shapely +from shapely import count_coordinates, get_coordinates, set_coordinates, transform + +from .common import ( + empty, + empty_line_string_z, + empty_point, + empty_point_z, + geometry_collection, + geometry_collection_z, + line_string, + line_string_z, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + point_z, + polygon, + polygon_with_hole, + polygon_z, +) + +nested_2 = shapely.geometrycollections([geometry_collection, point]) +nested_3 = shapely.geometrycollections([nested_2, point]) + + +@pytest.mark.parametrize( + "geoms,count", + [ + ([], 0), + ([empty], 0), + ([point, empty], 1), + ([empty, point, empty], 1), + ([point, None], 1), + ([None, point, None], 1), + ([point, point], 2), + ([point, point_z], 2), + ([line_string, linear_ring], 8), + ([polygon], 5), + ([polygon_with_hole], 10), + ([multi_point, multi_line_string], 4), + ([multi_polygon], 10), + ([geometry_collection], 3), + ([nested_2], 4), + ([nested_3], 5), + ], +) +def test_count_coords(geoms, count): + actual = count_coordinates(np.array(geoms, np.object_)) + assert actual == count + + +# fmt: off +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms,x,y", + [ + ([], [], []), + ([empty], [], []), + ([point, empty], [2], [3]), + ([empty, point, empty], [2], [3]), + ([point, None], [2], [3]), + ([None, point, None], [2], [3]), + ([point, point], [2, 2], [3, 3]), + ([line_string, linear_ring], [0, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 0, 1, 1, 0]), + ([polygon], [0, 2, 2, 0, 0], [0, 0, 2, 2, 0]), + ([polygon_with_hole], [0, 0, 10, 10, 0, 2, 2, 4, 4, 2], [0, 10, 10, 0, 0, 2, 4, 4, 2, 2]), + ([multi_point, multi_line_string], [0, 1, 0, 1], [0, 2, 0, 2]), + ([multi_polygon], [0, 1, 1, 0, 0, 2.1, 2.2, 2.2, 2.1, 2.1], [0, 0, 1, 1, 0, 2.1, 2.1, 2.2, 2.2, 2.1]), + ([geometry_collection], [51, 52, 49], [-1, -1, 2]), + ([nested_2], [51, 52, 49, 2], [-1, -1, 2, 3]), + ([nested_3], [51, 52, 49, 2, 2], [-1, -1, 2, 3, 3]), + ], +) # fmt: on +def test_get_coords(geoms, x, y, include_z): + actual = get_coordinates(np.array(geoms, np.object_), include_z=include_z) + if not include_z: + expected = np.array([x, y], np.float64).T + else: + expected = np.array([x, y, [np.nan] * len(x)], np.float64).T + assert_equal(actual, expected) + + +# fmt: off +@pytest.mark.parametrize( + "geoms,index", + [ + ([], []), + ([empty], []), + ([point, empty], [0]), + ([empty, point, empty], [1]), + ([point, None], [0]), + ([None, point, None], [1]), + ([point, point], [0, 1]), + ([point, line_string], [0, 1, 1, 1]), + ([line_string, point], [0, 0, 0, 1]), + ([line_string, linear_ring], [0, 0, 0, 1, 1, 1, 1, 1]), + ], +) # fmt: on +def test_get_coords_index(geoms, index): + _, actual = get_coordinates(np.array(geoms, np.object_), return_index=True) + expected = np.array(index, dtype=np.intp) + assert_equal(actual, expected) + + +@pytest.mark.parametrize("order", ["C", "F"]) +def test_get_coords_index_multidim(order): + geometry = np.array([[point, line_string], [empty, empty]], order=order) + expected = [0, 1, 1, 1] # would be [0, 2, 2, 2] with fortran order + _, actual = get_coordinates(geometry, return_index=True) + assert_equal(actual, expected) + + +# fmt: off +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms,x,y,z", + [ + ([point, point_z], [2, 2], [3, 3], [np.nan, 4]), + ([line_string_z], [0, 1, 1], [0, 0, 1], [4, 4, 4]), + ([polygon_z], [0, 2, 2, 0, 0], [0, 0, 2, 2, 0], [4, 4, 4, 4, 4]), + ([geometry_collection_z], [2, 0, 1, 1], [3, 0, 0, 1], [4, 4, 4, 4]), + ([point, empty_point], [2], [3], [np.nan]), + ], +) # fmt: on +def test_get_coords_3d(geoms, x, y, z, include_z): + actual = get_coordinates(np.array(geoms, np.object_), include_z=include_z) + if include_z: + expected = np.array([x, y, z], np.float64).T + else: + expected = np.array([x, y], np.float64).T + assert_equal(actual, expected) + + +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms,count,has_ring", + [ + ([], 0, False), + ([empty], 0, False), + ([empty_point], 0, False), + ([point, empty], 1, False), + ([empty, point, empty], 1, False), + ([point, None], 1, False), + ([None, point, None], 1, False), + ([point, point], 2, False), + ([point, point_z], 2, False), + ([line_string, linear_ring], 8, True), + ([line_string_z], 3, True), + ([polygon], 5, True), + ([polygon_z], 5, True), + ([polygon_with_hole], 10, True), + ([multi_point, multi_line_string], 4, False), + ([multi_polygon], 10, True), + ([geometry_collection], 3, False), + ([geometry_collection_z], 3, False), + ([nested_2], 4, False), + ([nested_3], 5, False), + ], +) +def test_set_coords(geoms, count, has_ring, include_z): + arr_geoms = np.array(geoms, np.object_) + n = 3 if include_z else 2 + coords = get_coordinates(arr_geoms, include_z=include_z) + np.random.random((1, n)) + new_geoms = set_coordinates(arr_geoms, coords) + assert_equal(coords, get_coordinates(new_geoms, include_z=include_z)) + + +def test_set_coords_nan(): + geoms = np.array([point]) + coords = np.array([[np.nan, np.inf]]) + new_geoms = set_coordinates(geoms, coords) + assert_equal(coords, get_coordinates(new_geoms)) + + +def test_set_coords_breaks_ring(): + with pytest.raises(shapely.GEOSException): + set_coordinates(linear_ring, np.random.random((5, 2))) + + +def test_set_coords_0dim(): + # a geometry input returns a geometry + actual = set_coordinates(point, [[1, 1]]) + assert isinstance(actual, shapely.Geometry) + # a 0-dim array input returns a 0-dim array + actual = set_coordinates(np.asarray(point), [[1, 1]]) + assert isinstance(actual, np.ndarray) + assert actual.ndim == 0 + + +@pytest.mark.parametrize("include_z", [True, False]) +def test_set_coords_mixed_dimension(include_z): + geoms = np.array([point, point_z], dtype=object) + coords = get_coordinates(geoms, include_z=include_z) + new_geoms = set_coordinates(geoms, coords * 2) + if include_z: + # preserve original dimensionality + assert not shapely.has_z(new_geoms[0]) + assert shapely.has_z(new_geoms[1]) + else: + # all 2D + assert not shapely.has_z(new_geoms).any() + + +@pytest.mark.parametrize("include_z", [True, False]) +@pytest.mark.parametrize( + "geoms", + [[], [empty], [None, point, None], [nested_3], [point, point_z], [line_string_z]], +) +def test_transform(geoms, include_z): + geoms = np.array(geoms, np.object_) + coordinates_before = get_coordinates(geoms, include_z=include_z) + new_geoms = transform(geoms, lambda x: x + 1, include_z=include_z) + assert new_geoms is not geoms + coordinates_after = get_coordinates(new_geoms, include_z=include_z) + assert_allclose(coordinates_before + 1, coordinates_after, equal_nan=True) + + +def test_transform_0dim(): + # a geometry input returns a geometry + actual = transform(point, lambda x: x + 1) + assert isinstance(actual, shapely.Geometry) + # a 0-dim array input returns a 0-dim array + actual = transform(np.asarray(point), lambda x: x + 1) + assert isinstance(actual, np.ndarray) + assert actual.ndim == 0 + + +def test_transform_check_shape(): + def remove_coord(arr): + return arr[:-1] + + with pytest.raises(ValueError): + transform(linear_ring, remove_coord) + + +def test_transform_correct_coordinate_dimension(): + # ensure that new geometry is 2D with include_z=False + geom = line_string_z + assert shapely.get_coordinate_dimension(geom) == 3 + new_geom = transform(geom, lambda x: x + 1, include_z=False) + assert shapely.get_coordinate_dimension(new_geom) == 2 + + +@pytest.mark.parametrize("geom", [ + pytest.param(empty_point_z, marks=pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="Empty points don't have a dimensionality before GEOS 3.9")), + empty_line_string_z, +]) +def test_transform_empty_preserve_z(geom): + assert shapely.get_coordinate_dimension(geom) == 3 + new_geom = transform(geom, lambda x: x + 1, include_z=True) + assert shapely.get_coordinate_dimension(new_geom) == 3 + + +@pytest.mark.parametrize("geom", [ + pytest.param(empty_point_z, marks=pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="Empty points don't have a dimensionality before GEOS 3.9")), + empty_line_string_z, +]) +def test_transform_remove_z(geom): + assert shapely.get_coordinate_dimension(geom) == 3 + new_geom = transform(geom, lambda x: x + 1, include_z=False) + assert shapely.get_coordinate_dimension(new_geom) == 2 diff --git a/shapely/python/shapely/tests/test_creation.py b/shapely/python/shapely/tests/test_creation.py new file mode 100644 index 0000000..88a54c7 --- /dev/null +++ b/shapely/python/shapely/tests/test_creation.py @@ -0,0 +1,548 @@ +import numpy as np +import pytest + +import shapely + +# Note: Point is not imported because it is overridden for testing +from shapely import ( + GeometryCollection, + GeometryType, + LinearRing, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Polygon, +) +from shapely.testing import assert_geometries_equal + +from .common import ( + empty_polygon, + geometry_collection, + line_string, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + polygon, +) + + +def box_tpl(x1, y1, x2, y2): + return (x2, y1), (x2, y2), (x1, y2), (x1, y1), (x2, y1) + + +def test_points_from_coords(): + actual = shapely.points([[0, 0], [2, 2]]) + assert_geometries_equal(actual, [shapely.Point(0, 0), shapely.Point(2, 2)]) + + +def test_points_from_xy(): + actual = shapely.points(2, [0, 1]) + assert_geometries_equal(actual, [shapely.Point(2, 0), shapely.Point(2, 1)]) + + +def test_points_from_xyz(): + actual = shapely.points(1, 1, [0, 1]) + assert_geometries_equal(actual, [shapely.Point(1, 1, 0), shapely.Point(1, 1, 1)]) + + +def test_points_invalid_ndim(): + with pytest.raises(ValueError, match="dimension should be 2 or 3, got 4"): + shapely.points([0, 1, 2, 3]) + + with pytest.raises(ValueError, match="dimension should be 2 or 3, got 1"): + shapely.points([0]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_points_nan_becomes_empty(): + actual = shapely.points(np.nan, np.nan) + assert_geometries_equal(actual, shapely.Point()) + + +def test_linestrings_from_coords(): + actual = shapely.linestrings([[[0, 0], [1, 1]], [[0, 0], [2, 2]]]) + assert_geometries_equal( + actual, + [ + LineString([(0, 0), (1, 1)]), + LineString([(0, 0), (2, 2)]), + ], + ) + + +def test_linestrings_from_xy(): + actual = shapely.linestrings([0, 1], [2, 3]) + assert_geometries_equal(actual, LineString([(0, 2), (1, 3)])) + + +def test_linestrings_from_xy_broadcast(): + x = [0, 1] # the same X coordinates for both linestrings + y = [2, 3], [4, 5] # each linestring has a different set of Y coordinates + actual = shapely.linestrings(x, y) + assert_geometries_equal( + actual, + [ + LineString([(0, 2), (1, 3)]), + LineString([(0, 4), (1, 5)]), + ], + ) + + +def test_linestrings_from_xyz(): + actual = shapely.linestrings([0, 1], [2, 3], 0) + assert_geometries_equal(actual, LineString([(0, 2, 0), (1, 3, 0)])) + + +@pytest.mark.parametrize("dim", [2, 3]) +def test_linestrings_buffer(dim): + coords = np.random.randn(10, 3, dim) + coords1 = np.asarray(coords, order="C") + result1 = shapely.linestrings(coords1) + + coords2 = np.asarray(coords1, order="F") + result2 = shapely.linestrings(coords2) + assert_geometries_equal(result1, result2) + + # creating (.., 8, 8*3) strided array so it uses copyFromArrays + coords3 = np.asarray(np.swapaxes(np.swapaxes(coords, 0, 2), 1, 0), order="F") + coords3 = np.swapaxes(np.swapaxes(coords3, 0, 2), 1, 2) + result3 = shapely.linestrings(coords3) + assert_geometries_equal(result1, result3) + + +def test_linestrings_invalid_shape_scalar(): + with pytest.raises(ValueError): + shapely.linestrings((1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linestrings of 1 2D point + (1, 1, 2), # 1 linestring of 1 2D point + (1, 2), # 1 linestring of 1 2D point (scalar) + ], +) +def test_linestrings_invalid_shape(shape): + with pytest.raises(shapely.GEOSException): + shapely.linestrings(np.ones(shape)) + + +def test_linestrings_invalid_ndim(): + msg = r"The ordinate \(last\) dimension should be 2 or 3, got {}" + + coords = np.ones((10, 2, 4), order="C") + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linestrings(coords) + + coords = np.ones((10, 2, 4), order="F") + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linestrings(coords) + + coords = np.swapaxes(np.swapaxes(np.ones((10, 2, 4)), 0, 2), 1, 0) + coords = np.swapaxes(np.swapaxes(np.asarray(coords, order="F"), 0, 2), 1, 2) + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linestrings(coords) + + # too few ordinates + coords = np.ones((10, 2, 1)) + with pytest.raises(ValueError, match=msg.format(1)): + shapely.linestrings(coords) + + +def test_linearrings(): + actual = shapely.linearrings(box_tpl(0, 0, 1, 1)) + assert_geometries_equal( + actual, LinearRing([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]) + ) + + +def test_linearrings_from_xy(): + actual = shapely.linearrings([0, 1, 2, 0], [3, 4, 5, 3]) + assert_geometries_equal(actual, LinearRing([(0, 3), (1, 4), (2, 5), (0, 3)])) + + +def test_linearrings_unclosed(): + actual = shapely.linearrings(box_tpl(0, 0, 1, 1)[:-1]) + assert_geometries_equal( + actual, LinearRing([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]) + ) + + +def test_linearrings_unclosed_all_coords_equal(): + actual = shapely.linearrings([(0, 0), (0, 0), (0, 0)]) + assert_geometries_equal(actual, LinearRing([(0, 0), (0, 0), (0, 0), (0, 0)])) + + +def test_linearrings_invalid_shape_scalar(): + with pytest.raises(ValueError): + shapely.linearrings((1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linearrings of 1 2D point + (1, 1, 2), # 1 linearring of 1 2D point + (1, 2), # 1 linearring of 1 2D point (scalar) + (2, 2, 2), # 2 linearrings of 2 2D points + (1, 2, 2), # 1 linearring of 2 2D points + (2, 2), # 1 linearring of 2 2D points (scalar) + ], +) +def test_linearrings_invalid_shape(shape): + coords = np.ones(shape) + with pytest.raises(ValueError): + shapely.linearrings(coords) + + # make sure the first coordinate != second coordinate + coords[..., 1] += 1 + with pytest.raises(ValueError): + shapely.linearrings(coords) + + +def test_linearrings_invalid_ndim(): + msg = r"The ordinate \(last\) dimension should be 2 or 3, got {}" + + coords1 = np.random.randn(10, 3, 4) + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linearrings(coords1) + + coords2 = np.hstack((coords1, coords1[:, [0], :])) + with pytest.raises(ValueError, match=msg.format(4)): + shapely.linearrings(coords2) + + # too few ordinates + coords3 = np.random.randn(10, 3, 1) + with pytest.raises(ValueError, match=msg.format(1)): + shapely.linestrings(coords3) + + +def test_linearrings_all_nan(): + coords = np.full((4, 2), np.nan) + with pytest.raises(shapely.GEOSException): + shapely.linearrings(coords) + + +@pytest.mark.parametrize("dim", [2, 3]) +@pytest.mark.parametrize("order", ["C", "F"]) +def test_linearrings_buffer(dim, order): + coords1 = np.random.randn(10, 4, dim) + coords1 = np.asarray(coords1, order=order) + result1 = shapely.linearrings(coords1) + + # with manual closure -> can directly copy from buffer if C order + coords2 = np.hstack((coords1, coords1[:, [0], :])) + coords2 = np.asarray(coords2, order=order) + result2 = shapely.linearrings(coords2) + assert_geometries_equal(result1, result2) + + # create scalar -> can also directly copy from buffer if F order + coords3 = np.asarray(coords2[0], order=order) + result3 = shapely.linearrings(coords3) + assert_geometries_equal(result3, result1[0]) + + +def test_polygon_from_linearring(): + actual = shapely.polygons(shapely.linearrings(box_tpl(0, 0, 1, 1))) + assert_geometries_equal(actual, Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)])) + + +def test_polygons_none(): + assert_geometries_equal(shapely.polygons(None), empty_polygon) + assert_geometries_equal(shapely.polygons(None, holes=[linear_ring]), empty_polygon) + + +def test_polygons(): + actual = shapely.polygons(box_tpl(0, 0, 1, 1)) + assert_geometries_equal(actual, Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)])) + + +def test_polygon_no_hole_list_raises(): + with pytest.raises(ValueError): + shapely.polygons(box_tpl(0, 0, 10, 10), box_tpl(1, 1, 2, 2)) + + +def test_polygon_no_hole_wrong_type(): + with pytest.raises((TypeError, shapely.GEOSException)): + shapely.polygons(point) + + +def test_polygon_with_hole_wrong_type(): + with pytest.raises((TypeError, shapely.GEOSException)): + shapely.polygons(point, [linear_ring]) + + +def test_polygon_wrong_hole_type(): + with pytest.raises((TypeError, shapely.GEOSException)): + shapely.polygons(linear_ring, [point]) + + +def test_polygon_with_1_hole(): + actual = shapely.polygons(box_tpl(0, 0, 10, 10), [box_tpl(1, 1, 2, 2)]) + assert shapely.area(actual) == 99.0 + + +def test_polygon_with_2_holes(): + actual = shapely.polygons( + box_tpl(0, 0, 10, 10), [box_tpl(1, 1, 2, 2), box_tpl(3, 3, 4, 4)] + ) + assert shapely.area(actual) == 98.0 + + +def test_polygon_with_none_hole(): + actual = shapely.polygons( + shapely.linearrings(box_tpl(0, 0, 10, 10)), + [ + shapely.linearrings(box_tpl(1, 1, 2, 2)), + None, + shapely.linearrings(box_tpl(3, 3, 4, 4)), + ], + ) + assert shapely.area(actual) == 98.0 + + +def test_2_polygons_with_same_hole(): + actual = shapely.polygons( + [box_tpl(0, 0, 10, 10), box_tpl(0, 0, 5, 5)], [box_tpl(1, 1, 2, 2)] + ) + assert shapely.area(actual).tolist() == [99.0, 24.0] + + +def test_2_polygons_with_2_same_holes(): + actual = shapely.polygons( + [box_tpl(0, 0, 10, 10), box_tpl(0, 0, 5, 5)], + [box_tpl(1, 1, 2, 2), box_tpl(3, 3, 4, 4)], + ) + assert shapely.area(actual).tolist() == [98.0, 23.0] + + +def test_2_polygons_with_different_holes(): + actual = shapely.polygons( + [box_tpl(0, 0, 10, 10), box_tpl(0, 0, 5, 5)], + [[box_tpl(1, 1, 3, 3)], [box_tpl(1, 1, 2, 2)]], + ) + assert shapely.area(actual).tolist() == [96.0, 24.0] + + +def test_polygons_not_enough_points_in_shell_scalar(): + with pytest.raises(ValueError): + shapely.polygons((1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linearrings of 1 2D point + (1, 1, 2), # 1 linearring of 1 2D point + (1, 2), # 1 linearring of 1 2D point (scalar) + (2, 2, 2), # 2 linearrings of 2 2D points + (1, 2, 2), # 1 linearring of 2 2D points + (2, 2), # 1 linearring of 2 2D points (scalar) + ], +) +def test_polygons_not_enough_points_in_shell(shape): + coords = np.ones(shape) + with pytest.raises(ValueError): + shapely.polygons(coords) + + # make sure the first coordinate != second coordinate + coords[..., 1] += 1 + with pytest.raises(ValueError): + shapely.polygons(coords) + + +def test_polygons_not_enough_points_in_holes_scalar(): + with pytest.raises(ValueError): + shapely.polygons(np.ones((1, 4, 2)), (1, 1)) + + +@pytest.mark.parametrize( + "shape", + [ + (2, 1, 2), # 2 linearrings of 1 2D point + (1, 1, 2), # 1 linearring of 1 2D point + (1, 2), # 1 linearring of 1 2D point (scalar) + (2, 2, 2), # 2 linearrings of 2 2D points + (1, 2, 2), # 1 linearring of 2 2D points + (2, 2), # 1 linearring of 2 2D points (scalar) + ], +) +def test_polygons_not_enough_points_in_holes(shape): + coords = np.ones(shape) + with pytest.raises(ValueError): + shapely.polygons(np.ones((1, 4, 2)), coords) + + # make sure the first coordinate != second coordinate + coords[..., 1] += 1 + with pytest.raises(ValueError): + shapely.polygons(np.ones((1, 4, 2)), coords) + + +@pytest.mark.parametrize( + "func,expected", + [ + (shapely.multipoints, MultiPoint()), + (shapely.multilinestrings, MultiLineString()), + (shapely.multipolygons, MultiPolygon()), + (shapely.geometrycollections, GeometryCollection()), + ], +) +def test_create_collection_only_none(func, expected): + actual = func(np.array([None], dtype=object)) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "func,sub_geom", + [ + (shapely.multipoints, point), + (shapely.multilinestrings, line_string), + (shapely.multilinestrings, linear_ring), + (shapely.multipolygons, polygon), + (shapely.geometrycollections, point), + (shapely.geometrycollections, line_string), + (shapely.geometrycollections, linear_ring), + (shapely.geometrycollections, polygon), + (shapely.geometrycollections, multi_point), + (shapely.geometrycollections, multi_line_string), + (shapely.geometrycollections, multi_polygon), + (shapely.geometrycollections, geometry_collection), + ], +) +def test_create_collection(func, sub_geom): + actual = func([sub_geom, sub_geom]) + assert shapely.get_num_geometries(actual) == 2 + + +@pytest.mark.parametrize( + "func,sub_geom", + [ + (shapely.multipoints, point), + (shapely.multilinestrings, line_string), + (shapely.multipolygons, polygon), + (shapely.geometrycollections, polygon), + ], +) +def test_create_collection_skips_none(func, sub_geom): + actual = func([sub_geom, None, None, sub_geom]) + assert shapely.get_num_geometries(actual) == 2 + + +@pytest.mark.parametrize( + "func,sub_geom", + [ + (shapely.multipoints, line_string), + (shapely.multipoints, geometry_collection), + (shapely.multipoints, multi_point), + (shapely.multilinestrings, point), + (shapely.multilinestrings, polygon), + (shapely.multilinestrings, multi_line_string), + (shapely.multipolygons, linear_ring), + (shapely.multipolygons, multi_point), + (shapely.multipolygons, multi_polygon), + ], +) +def test_create_collection_wrong_geom_type(func, sub_geom): + with pytest.raises(TypeError): + func([sub_geom]) + + +@pytest.mark.parametrize( + "coords,ccw,expected", + [ + ((0, 0, 1, 1), True, Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)])), + ( + (0, 0, 1, 1), + False, + Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]), + ), + ], +) +def test_box(coords, ccw, expected): + actual = shapely.box(*coords, ccw=ccw) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "coords,ccw,expected", + [ + ( + (0, 0, [1, 2], [1, 2]), + True, + [ + Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]), + Polygon([(2, 0), (2, 2), (0, 2), (0, 0), (2, 0)]), + ], + ), + ( + (0, 0, [1, 2], [1, 2]), + [True, False], + [ + Polygon([(1, 0), (1, 1), (0, 1), (0, 0), (1, 0)]), + Polygon([(0, 0), (0, 2), (2, 2), (2, 0), (0, 0)]), + ], + ), + ], +) +def test_box_array(coords, ccw, expected): + actual = shapely.box(*coords, ccw=ccw) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "coords", + [ + [np.nan, np.nan, np.nan, np.nan], + [np.nan, 0, 1, 1], + [0, np.nan, 1, 1], + [0, 0, np.nan, 1], + [0, 0, 1, np.nan], + ], +) +def test_box_nan(coords): + assert shapely.box(*coords) is None + + +def test_prepare(): + arr = np.array([shapely.points(1, 1), None, shapely.box(0, 0, 1, 1)]) + assert arr[0]._geom_prepared == 0 + assert arr[2]._geom_prepared == 0 + shapely.prepare(arr) + assert arr[0]._geom_prepared != 0 + assert arr[1] is None + assert arr[2]._geom_prepared != 0 + + # preparing again actually does nothing + original = arr[0]._geom_prepared + shapely.prepare(arr) + assert arr[0]._geom_prepared == original + + +def test_destroy_prepared(): + arr = np.array([shapely.points(1, 1), None, shapely.box(0, 0, 1, 1)]) + shapely.prepare(arr) + assert arr[0]._geom_prepared != 0 + assert arr[2]._geom_prepared != 0 + shapely.destroy_prepared(arr) + assert arr[0]._geom_prepared == 0 + assert arr[1] is None + assert arr[2]._geom_prepared == 0 + shapely.destroy_prepared(arr) # does not error + + +@pytest.mark.parametrize("geom_type", [None, GeometryType.MISSING, -1]) +def test_empty_missing(geom_type): + actual = shapely.empty((2,), geom_type=geom_type) + assert shapely.is_missing(actual).all() + + +@pytest.mark.parametrize("geom_type", range(8)) +def test_empty(geom_type): + actual = shapely.empty((2,), geom_type=geom_type) + assert (~shapely.is_missing(actual)).all() + assert shapely.is_empty(actual).all() + assert (shapely.get_type_id(actual) == geom_type).all() diff --git a/shapely/python/shapely/tests/test_creation_indices.py b/shapely/python/shapely/tests/test_creation_indices.py new file mode 100644 index 0000000..de652fd --- /dev/null +++ b/shapely/python/shapely/tests/test_creation_indices.py @@ -0,0 +1,419 @@ +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, Polygon +from shapely.testing import assert_geometries_equal + +from .common import empty_point, line_string, linear_ring, point, polygon + +pnts = shapely.points +lstrs = shapely.linestrings +geom_coll = shapely.geometrycollections + + +@pytest.mark.parametrize( + "func", [shapely.points, shapely.linestrings, shapely.linearrings] +) +@pytest.mark.parametrize( + "coordinates", + [ + np.empty((2,)), # not enough dimensions + np.empty((2, 4, 1)), # too many dimensions + np.empty((2, 4)), # wrong inner dimension size + None, + np.full((2, 2), "foo", dtype=object), # wrong type + ], +) +def test_invalid_coordinates(func, coordinates): + with pytest.raises((TypeError, ValueError)): + func(coordinates, indices=[0, 1]) + + +@pytest.mark.parametrize( + "func", + [ + shapely.multipoints, + shapely.multilinestrings, + shapely.multipolygons, + shapely.geometrycollections, + ], +) +@pytest.mark.parametrize( + "geometries", [np.array([1, 2], dtype=np.intp), None, np.array([[point]]), "hello"] +) +def test_invalid_geometries(func, geometries): + with pytest.raises((TypeError, ValueError)): + func(geometries, indices=[0, 1]) + + +@pytest.mark.parametrize( + "func", [shapely.points, shapely.linestrings, shapely.linearrings] +) +@pytest.mark.parametrize("indices", [[point], " hello", [0, 1], [-1]]) +def test_invalid_indices_simple(func, indices): + with pytest.raises((TypeError, ValueError)): + func([[0.2, 0.3]], indices=indices) + + +non_writeable = np.empty(3, dtype=object) +non_writeable.flags.writeable = False + + +@pytest.mark.parametrize( + "func", [shapely.points, shapely.linestrings, shapely.geometrycollections] +) +@pytest.mark.parametrize( + "out", + [ + [None, None, None], # not an ndarray + np.empty(3), # wrong dtype + non_writeable, # not writeable + np.empty((3, 2), dtype=object), # too many dimensions + np.empty((), dtype=object), # too few dimensions + np.empty((2,), dtype=object), # too small + ], +) +def test_invalid_out(func, out): + if func is shapely.points: + x = [[0.2, 0.3], [0.4, 0.5]] + indices = [0, 2] + elif func is shapely.linestrings: + x = [[1, 1], [2, 1], [2, 2], [3, 3], [3, 4], [4, 4]] + indices = [0, 0, 0, 2, 2, 2] + else: + x = [point, line_string] + indices = [0, 2] + with pytest.raises((TypeError, ValueError)): + func(x, indices=indices, out=out) + + +def test_points_invalid(): + # attempt to construct a point with 2 coordinates + with pytest.raises(shapely.GEOSException): + shapely.points([[1, 1], [2, 2]], indices=[0, 0]) + + +def test_points(): + actual = shapely.points( + np.array([[2, 3], [2, 3]], dtype=float), + indices=np.array([0, 1], dtype=np.intp), + ) + assert_geometries_equal(actual, [point, point]) + + +def test_points_no_index_raises(): + with pytest.raises(ValueError): + shapely.points( + np.array([[2, 3], [2, 3]], dtype=float), + indices=np.array([0, 2], dtype=np.intp), + ) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 1], [point, point, empty_point, None]), + ([0, 3], [point, None, empty_point, point]), + ([2, 3], [None, None, point, point]), + ], +) +def test_points_out(indices, expected): + out = np.empty(4, dtype=object) + out[2] = empty_point + actual = shapely.points( + [[2, 3], [2, 3]], + indices=indices, + out=out, + ) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize( + "coordinates,indices,expected", + [ + ([[1, 1], [2, 2]], [0, 0], [lstrs([[1, 1], [2, 2]])]), + ([[1, 1, 1], [2, 2, 2]], [0, 0], [lstrs([[1, 1, 1], [2, 2, 2]])]), + ( + [[1, 1], [2, 2], [2, 2], [3, 3]], + [0, 0, 1, 1], + [lstrs([[1, 1], [2, 2]]), lstrs([[2, 2], [3, 3]])], + ), + ], +) +def test_linestrings(coordinates, indices, expected): + actual = shapely.linestrings( + np.array(coordinates, dtype=float), indices=np.array(indices, dtype=np.intp) + ) + assert_geometries_equal(actual, expected) + + +def test_linestrings_invalid(): + # attempt to construct linestrings with 1 coordinate + with pytest.raises(shapely.GEOSException): + shapely.linestrings([[1, 1], [2, 2]], indices=[0, 1]) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 0, 0, 1, 1, 1], [line_string, line_string, empty_point, None]), + ([0, 0, 0, 3, 3, 3], [line_string, None, empty_point, line_string]), + ([2, 2, 2, 3, 3, 3], [None, None, line_string, line_string]), + ], +) +def test_linestrings_out(indices, expected): + out = np.empty(4, dtype=object) + out[2] = empty_point + actual = shapely.linestrings( + [(0, 0), (1, 0), (1, 1), (0, 0), (1, 0), (1, 1)], + indices=indices, + out=out, + ) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize( + "coordinates", [([[1, 1], [2, 1], [2, 2], [1, 1]]), ([[1, 1], [2, 1], [2, 2]])] +) +def test_linearrings(coordinates): + actual = shapely.linearrings( + np.array(coordinates, dtype=np.float64), + indices=np.zeros(len(coordinates), dtype=np.intp), + ) + assert_geometries_equal(actual, shapely.linearrings(coordinates)) + + +@pytest.mark.parametrize( + "coordinates", + [ + ([[1, np.nan], [2, 1], [2, 2], [1, 1]]), # starting with nan + ], +) +def test_linearrings_invalid(coordinates): + # attempt to construct linestrings with 1 coordinate + with pytest.raises((shapely.GEOSException, ValueError)): + shapely.linearrings(coordinates, indices=np.zeros(len(coordinates))) + + +def test_linearrings_unclosed_all_coords_equal(): + actual = shapely.linearrings([(0, 0), (0, 0), (0, 0)], indices=np.zeros(3)) + assert_geometries_equal(actual, LinearRing([(0, 0), (0, 0), (0, 0), (0, 0)])) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 0, 0, 0, 0], [linear_ring, None, None, empty_point]), + ([1, 1, 1, 1, 1], [None, linear_ring, None, empty_point]), + ([3, 3, 3, 3, 3], [None, None, None, linear_ring]), + ], +) +def test_linearrings_out(indices, expected): + out = np.empty(4, dtype=object) + out[3] = empty_point + actual = shapely.linearrings( + [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], + indices=indices, + out=out, + ) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize("dim", [2, 3]) +@pytest.mark.parametrize("order", ["C", "F"]) +def test_linearrings_buffer(dim, order): + coords = np.random.randn(10, 4, dim) + coords1 = np.asarray(coords.reshape(10 * 4, dim), order=order) + indices1 = np.repeat(range(10), 4) + result1 = shapely.linearrings(coords1, indices=indices1) + + # with manual closure -> can directly copy from buffer if C order + coords2 = np.hstack((coords, coords[:, [0], :])) + coords2 = np.asarray(coords2.reshape(10 * 5, dim), order=order) + indices2 = np.repeat(range(10), 5) + result2 = shapely.linearrings(coords2, indices=indices2) + assert_geometries_equal(result1, result2) + + +hole_1 = shapely.linearrings([(0.2, 0.2), (0.2, 0.4), (0.4, 0.4)]) +hole_2 = shapely.linearrings([(0.6, 0.6), (0.6, 0.8), (0.8, 0.8)]) +poly = shapely.polygons(linear_ring) +poly_empty = Polygon() +poly_hole_1 = shapely.polygons(linear_ring, holes=[hole_1]) +poly_hole_2 = shapely.polygons(linear_ring, holes=[hole_2]) +poly_hole_1_2 = shapely.polygons(linear_ring, holes=[hole_1, hole_2]) + + +@pytest.mark.parametrize( + "rings,indices,expected", + [ + ([linear_ring, linear_ring], [0, 1], [poly, poly]), + ([None, linear_ring], [0, 1], [poly_empty, poly]), + ([None, linear_ring, None, None], [0, 0, 1, 1], [poly, poly_empty]), + ([linear_ring, hole_1, linear_ring], [0, 0, 1], [poly_hole_1, poly]), + ([linear_ring, linear_ring, hole_1], [0, 1, 1], [poly, poly_hole_1]), + ([None, linear_ring, linear_ring, hole_1], [0, 0, 1, 1], [poly, poly_hole_1]), + ([linear_ring, None, linear_ring, hole_1], [0, 0, 1, 1], [poly, poly_hole_1]), + ([linear_ring, None, linear_ring, hole_1], [0, 1, 1, 1], [poly, poly_hole_1]), + ([linear_ring, linear_ring, None, hole_1], [0, 1, 1, 1], [poly, poly_hole_1]), + ([linear_ring, linear_ring, hole_1, None], [0, 1, 1, 1], [poly, poly_hole_1]), + ( + [linear_ring, hole_1, hole_2, linear_ring], + [0, 0, 0, 1], + [poly_hole_1_2, poly], + ), + ( + [linear_ring, hole_1, linear_ring, hole_2], + [0, 0, 1, 1], + [poly_hole_1, poly_hole_2], + ), + ( + [linear_ring, linear_ring, hole_1, hole_2], + [0, 1, 1, 1], + [poly, poly_hole_1_2], + ), + ( + [linear_ring, hole_1, None, hole_2, linear_ring], + [0, 0, 0, 0, 1], + [poly_hole_1_2, poly], + ), + ( + [linear_ring, hole_1, None, linear_ring, hole_2], + [0, 0, 0, 1, 1], + [poly_hole_1, poly_hole_2], + ), + ( + [linear_ring, hole_1, linear_ring, None, hole_2], + [0, 0, 1, 1, 1], + [poly_hole_1, poly_hole_2], + ), + ], +) +def test_polygons(rings, indices, expected): + actual = shapely.polygons( + np.array(rings, dtype=object), indices=np.array(indices, dtype=np.intp) + ) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 1], [poly, poly, empty_point, None]), + ([0, 3], [poly, None, empty_point, poly]), + ([2, 3], [None, None, poly, poly]), + ], +) +def test_polygons_out(indices, expected): + out = np.empty(4, dtype=object) + out[2] = empty_point + actual = shapely.polygons([linear_ring, linear_ring], indices=indices, out=out) + assert_geometries_equal(out, expected) + assert actual is out + + +@pytest.mark.parametrize( + "func", + [ + shapely.polygons, + shapely.multipoints, + shapely.multilinestrings, + shapely.multipolygons, + shapely.geometrycollections, + ], +) +@pytest.mark.parametrize("indices", [np.array([point]), " hello", [0, 1], [-1]]) +def test_invalid_indices_collections(func, indices): + with pytest.raises((TypeError, ValueError)): + func([point], indices=indices) + + +@pytest.mark.parametrize( + "geometries,indices,expected", + [ + ([point, line_string], [0, 0], [geom_coll([point, line_string])]), + ([point, line_string], [0, 1], [geom_coll([point]), geom_coll([line_string])]), + ([point, None], [0, 0], [geom_coll([point])]), + ([point, None], [0, 1], [geom_coll([point]), geom_coll([])]), + ([None, point, None, None], [0, 0, 1, 1], [geom_coll([point]), geom_coll([])]), + ([point, None, line_string], [0, 0, 0], [geom_coll([point, line_string])]), + ], +) +def test_geometrycollections(geometries, indices, expected): + actual = shapely.geometrycollections( + np.array(geometries, dtype=object), indices=indices + ) + assert_geometries_equal(actual, expected) + + +def test_geometrycollections_no_index_raises(): + with pytest.raises(ValueError): + shapely.geometrycollections( + np.array([point, line_string], dtype=object), indices=[0, 2] + ) + + +@pytest.mark.parametrize( + "indices,expected", + [ + ([0, 0], [geom_coll([point, line_string]), None, None, empty_point]), + ([3, 3], [None, None, None, geom_coll([point, line_string])]), + ], +) +def test_geometrycollections_out(indices, expected): + out = np.empty(4, dtype=object) + out[3] = empty_point + actual = shapely.geometrycollections([point, line_string], indices=indices, out=out) + assert_geometries_equal(out, expected) + assert actual is out + + +def test_multipoints(): + actual = shapely.multipoints( + np.array([point], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multipoints([point])) + + +def test_multilinestrings(): + actual = shapely.multilinestrings( + np.array([line_string], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multilinestrings([line_string])) + + +def test_multilinearrings(): + actual = shapely.multilinestrings( + np.array([linear_ring], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multilinestrings([linear_ring])) + + +def test_multipolygons(): + actual = shapely.multipolygons( + np.array([polygon], dtype=object), indices=np.zeros(1, dtype=np.intp) + ) + assert_geometries_equal(actual, shapely.multipolygons([polygon])) + + +@pytest.mark.parametrize( + "geometries,func", + [ + ([point], shapely.polygons), + ([line_string], shapely.polygons), + ([polygon], shapely.polygons), + ([line_string], shapely.multipoints), + ([polygon], shapely.multipoints), + ([point], shapely.multilinestrings), + ([polygon], shapely.multilinestrings), + ([point], shapely.multipolygons), + ([line_string], shapely.multipolygons), + ], +) +def test_incompatible_types(geometries, func): + with pytest.raises(TypeError): + func(geometries, indices=[0]) diff --git a/shapely/python/shapely/tests/test_geometry.py b/shapely/python/shapely/tests/test_geometry.py new file mode 100644 index 0000000..3aac086 --- /dev/null +++ b/shapely/python/shapely/tests/test_geometry.py @@ -0,0 +1,745 @@ +import warnings + +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, LineString, MultiPolygon, Point, Polygon +from shapely.testing import assert_geometries_equal + +from .common import all_types +from .common import empty as empty_geometry_collection +from .common import ( + empty_line_string, + empty_line_string_z, + empty_point, + empty_point_z, + empty_polygon, + geometry_collection, + geometry_collection_z, + line_string, + line_string_nan, + line_string_z, + linear_ring, + multi_line_string, + multi_line_string_z, + multi_point, + multi_point_z, + multi_polygon, + multi_polygon_z, + point, + point_z, + polygon, + polygon_with_hole, + polygon_with_hole_z, + polygon_z, +) + + +def test_get_num_points(): + actual = shapely.get_num_points(all_types + (None,)).tolist() + assert actual == [0, 3, 5, 0, 0, 0, 0, 0, 0, 0] + + +def test_get_num_interior_rings(): + actual = shapely.get_num_interior_rings(all_types + (polygon_with_hole, None)) + assert actual.tolist() == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] + + +def test_get_num_geometries(): + actual = shapely.get_num_geometries(all_types + (None,)).tolist() + assert actual == [1, 1, 1, 1, 2, 1, 2, 2, 0, 0] + + +@pytest.mark.parametrize( + "geom", + [ + point, + polygon, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + ], +) +def test_get_point_non_linestring(geom): + actual = shapely.get_point(geom, [0, 2, -1]) + assert shapely.is_missing(actual).all() + + +@pytest.mark.parametrize("geom", [line_string, linear_ring]) +def test_get_point(geom): + n = shapely.get_num_points(geom) + actual = shapely.get_point(geom, [0, -n, n, -(n + 1)]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +@pytest.mark.parametrize( + "geom", + [ + point, + line_string, + linear_ring, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + ], +) +def test_get_exterior_ring_non_polygon(geom): + actual = shapely.get_exterior_ring(geom) + assert shapely.is_missing(actual).all() + + +def test_get_exterior_ring(): + actual = shapely.get_exterior_ring([polygon, polygon_with_hole]) + assert (shapely.get_type_id(actual) == 2).all() + + +@pytest.mark.parametrize( + "geom", + [ + point, + line_string, + linear_ring, + multi_point, + multi_line_string, + multi_polygon, + geometry_collection, + ], +) +def test_get_interior_ring_non_polygon(geom): + actual = shapely.get_interior_ring(geom, [0, 2, -1]) + assert shapely.is_missing(actual).all() + + +def test_get_interior_ring(): + actual = shapely.get_interior_ring(polygon_with_hole, [0, -1, 1, -2]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +@pytest.mark.parametrize("geom", [point, line_string, linear_ring, polygon]) +def test_get_geometry_simple(geom): + actual = shapely.get_geometry(geom, [0, -1, 1, -2]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +@pytest.mark.parametrize( + "geom", [multi_point, multi_line_string, multi_polygon, geometry_collection] +) +def test_get_geometry_collection(geom): + n = shapely.get_num_geometries(geom) + actual = shapely.get_geometry(geom, [0, -n, n, -(n + 1)]) + assert_geometries_equal(actual[0], actual[1]) + assert shapely.is_missing(actual[2:4]).all() + + +def test_get_type_id(): + actual = shapely.get_type_id(all_types).tolist() + assert actual == [0, 1, 2, 3, 4, 5, 6, 7, 7] + + +def test_get_dimensions(): + actual = shapely.get_dimensions(all_types).tolist() + assert actual == [0, 1, 1, 2, 0, 1, 2, 1, -1] + + +def test_get_coordinate_dimension(): + actual = shapely.get_coordinate_dimension([point, point_z, None]).tolist() + assert actual == [2, 3, -1] + + +def test_get_num_coordinates(): + actual = shapely.get_num_coordinates(all_types + (None,)).tolist() + assert actual == [1, 3, 5, 5, 2, 2, 10, 3, 0, 0] + + +def test_get_srid(): + """All geometry types have no SRID by default; None returns -1""" + actual = shapely.get_srid(all_types + (None,)).tolist() + assert actual == [0, 0, 0, 0, 0, 0, 0, 0, 0, -1] + + +def test_get_set_srid(): + actual = shapely.set_srid(point, 4326) + assert shapely.get_srid(point) == 0 + assert shapely.get_srid(actual) == 4326 + + +@pytest.mark.parametrize( + "func", + [ + shapely.get_x, + shapely.get_y, + pytest.param( + shapely.get_z, + marks=pytest.mark.skipif( + shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7" + ), + ), + ], +) +@pytest.mark.parametrize("geom", all_types[1:]) +def test_get_xyz_no_point(func, geom): + assert np.isnan(func(geom)) + + +def test_get_x(): + assert shapely.get_x([point, point_z]).tolist() == [2.0, 2.0] + + +def test_get_y(): + assert shapely.get_y([point, point_z]).tolist() == [3.0, 3.0] + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_get_z(): + assert shapely.get_z([point_z]).tolist() == [4.0] + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_get_z_2d(): + assert np.isnan(shapely.get_z(point)) + + +@pytest.mark.parametrize("geom", all_types) +def test_new_from_wkt(geom): + actual = shapely.from_wkt(str(geom)) + assert_geometries_equal(actual, geom) + + +def test_adapt_ptr_raises(): + point = Point(2, 2) + with pytest.raises(AttributeError): + point._geom += 1 + + +@pytest.mark.parametrize( + "geom", all_types + (shapely.points(np.nan, np.nan), empty_point) +) +def test_hash_same_equal(geom): + assert hash(geom) == hash(shapely.transform(geom, lambda x: x)) + + +@pytest.mark.parametrize("geom", all_types[:-1]) +def test_hash_same_not_equal(geom): + assert hash(geom) != hash(shapely.transform(geom, lambda x: x + 1)) + + +@pytest.mark.parametrize("geom", all_types) +def test_eq(geom): + assert geom == shapely.transform(geom, lambda x: x) + + +@pytest.mark.parametrize("geom", all_types[:-1]) +def test_neq(geom): + assert geom != shapely.transform(geom, lambda x: x + 1) + + +@pytest.mark.parametrize("geom", all_types) +def test_set_unique(geom): + a = {geom, shapely.transform(geom, lambda x: x)} + assert len(a) == 1 + + +def test_eq_nan(): + assert line_string_nan != line_string_nan + + +def test_neq_nan(): + assert not (line_string_nan == line_string_nan) + + +def test_set_nan(): + # As NaN != NaN, you can have multiple "NaN" points in a set + # set([float("nan"), float("nan")]) also returns a set with 2 elements + a = set(shapely.linestrings([[[np.nan, np.nan], [np.nan, np.nan]]] * 10)) + assert len(a) == 10 # different objects: NaN != NaN + + +def test_set_nan_same_objects(): + # You can't put identical objects in a set. + # x = float("nan"); set([x, x]) also retuns a set with 1 element + a = set([line_string_nan] * 10) + assert len(a) == 1 + + +@pytest.mark.parametrize( + "geom", + [ + point, + multi_point, + line_string, + multi_line_string, + polygon, + multi_polygon, + geometry_collection, + empty_point, + empty_line_string, + empty_polygon, + empty_geometry_collection, + np.array([None]), + np.empty_like(np.array([None])), + ], +) +def test_get_parts(geom): + expected_num_parts = shapely.get_num_geometries(geom) + if expected_num_parts == 0: + expected_parts = [] + else: + expected_parts = shapely.get_geometry(geom, range(0, expected_num_parts)) + + parts = shapely.get_parts(geom) + assert len(parts) == expected_num_parts + assert_geometries_equal(parts, expected_parts) + + +def test_get_parts_array(): + # note: this also verifies that None is handled correctly + # in the mix; internally it returns -1 for count of geometries + geom = np.array([None, empty_line_string, multi_point, point, multi_polygon]) + expected_parts = [] + for g in geom: + for i in range(0, shapely.get_num_geometries(g)): + expected_parts.append(shapely.get_geometry(g, i)) + + parts = shapely.get_parts(geom) + assert len(parts) == len(expected_parts) + assert_geometries_equal(parts, expected_parts) + + +def test_get_parts_geometry_collection_multi(): + """On the first pass, the individual Multi* geometry objects are returned + from the collection. On the second pass, the individual singular geometry + objects within those are returned. + """ + geom = shapely.geometrycollections([multi_point, multi_line_string, multi_polygon]) + expected_num_parts = shapely.get_num_geometries(geom) + expected_parts = shapely.get_geometry(geom, range(0, expected_num_parts)) + + parts = shapely.get_parts(geom) + assert len(parts) == expected_num_parts + assert_geometries_equal(parts, expected_parts) + + expected_subparts = [] + for g in np.asarray(expected_parts): + for i in range(0, shapely.get_num_geometries(g)): + expected_subparts.append(shapely.get_geometry(g, i)) + + subparts = shapely.get_parts(parts) + assert len(subparts) == len(expected_subparts) + assert_geometries_equal(subparts, expected_subparts) + + +def test_get_parts_return_index(): + geom = np.array([multi_point, point, multi_polygon]) + expected_parts = [] + expected_index = [] + for i, g in enumerate(geom): + for j in range(0, shapely.get_num_geometries(g)): + expected_parts.append(shapely.get_geometry(g, j)) + expected_index.append(i) + + parts, index = shapely.get_parts(geom, return_index=True) + assert len(parts) == len(expected_parts) + assert_geometries_equal(parts, expected_parts) + assert np.array_equal(index, expected_index) + + +@pytest.mark.parametrize( + "geom", + ([[None]], [[empty_point]], [[multi_point]], [[multi_point, multi_line_string]]), +) +def test_get_parts_invalid_dimensions(geom): + """Only 1D inputs are supported""" + with pytest.raises(ValueError, match="Array should be one dimensional"): + shapely.get_parts(geom) + + +@pytest.mark.parametrize("geom", [point, line_string, polygon]) +def test_get_parts_non_multi(geom): + """Non-multipart geometries should be returned identical to inputs""" + assert_geometries_equal(geom, shapely.get_parts(geom)) + + +@pytest.mark.parametrize("geom", [None, [None], []]) +def test_get_parts_None(geom): + assert len(shapely.get_parts(geom)) == 0 + + +@pytest.mark.parametrize("geom", ["foo", ["foo"], 42]) +def test_get_parts_invalid_geometry(geom): + with pytest.raises(TypeError, match="One of the arguments is of incorrect type."): + shapely.get_parts(geom) + + +@pytest.mark.parametrize( + "geom", + [ + point, + multi_point, + line_string, + multi_line_string, + polygon, + multi_polygon, + geometry_collection, + empty_point, + empty_line_string, + empty_polygon, + empty_geometry_collection, + None, + ], +) +def test_get_rings(geom): + if (shapely.get_type_id(geom) != shapely.GeometryType.POLYGON) or shapely.is_empty( + geom + ): + rings = shapely.get_rings(geom) + assert len(rings) == 0 + else: + rings = shapely.get_rings(geom) + assert len(rings) == 1 + assert rings[0] == shapely.get_exterior_ring(geom) + + +def test_get_rings_holes(): + rings = shapely.get_rings(polygon_with_hole) + assert len(rings) == 2 + assert rings[0] == shapely.get_exterior_ring(polygon_with_hole) + assert rings[1] == shapely.get_interior_ring(polygon_with_hole, 0) + + +def test_get_rings_return_index(): + geom = np.array([polygon, None, empty_polygon, polygon_with_hole]) + expected_parts = [] + expected_index = [] + for i, g in enumerate(geom): + if g is None or shapely.is_empty(g): + continue + expected_parts.append(shapely.get_exterior_ring(g)) + expected_index.append(i) + for j in range(0, shapely.get_num_interior_rings(g)): + expected_parts.append(shapely.get_interior_ring(g, j)) + expected_index.append(i) + + parts, index = shapely.get_rings(geom, return_index=True) + assert len(parts) == len(expected_parts) + assert_geometries_equal(parts, expected_parts) + assert np.array_equal(index, expected_index) + + +@pytest.mark.parametrize("geom", [[[None]], [[polygon]]]) +def test_get_rings_invalid_dimensions(geom): + """Only 1D inputs are supported""" + with pytest.raises(ValueError, match="Array should be one dimensional"): + shapely.get_parts(geom) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_get_precision(): + geometries = all_types + (point_z, empty_point, empty_line_string, empty_polygon) + # default is 0 + actual = shapely.get_precision(geometries).tolist() + assert actual == [0] * len(geometries) + + geometry = shapely.set_precision(geometries, 1) + actual = shapely.get_precision(geometry).tolist() + assert actual == [1] * len(geometries) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_get_precision_none(): + assert np.all(np.isnan(shapely.get_precision([None]))) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("mode", ("valid_output", "pointwise", "keep_collapsed")) +def test_set_precision(mode): + initial_geometry = Point(0.9, 0.9) + assert shapely.get_precision(initial_geometry) == 0 + + geometry = shapely.set_precision(initial_geometry, 0, mode=mode) + assert shapely.get_precision(geometry) == 0 + assert_geometries_equal(geometry, initial_geometry) + + geometry = shapely.set_precision(initial_geometry, 1, mode=mode) + assert shapely.get_precision(geometry) == 1 + assert_geometries_equal(geometry, Point(1, 1)) + # original should remain unchanged + assert_geometries_equal(initial_geometry, Point(0.9, 0.9)) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_drop_coords(): + # setting precision of 0 will not drop duplicated points in original + geometry = shapely.set_precision(LineString([(0, 0), (0, 0), (0, 1), (1, 1)]), 0) + assert_geometries_equal(geometry, LineString([(0, 0), (0, 0), (0, 1), (1, 1)])) + + # setting precision will remove duplicated points + geometry = shapely.set_precision(geometry, 1) + assert_geometries_equal(geometry, LineString([(0, 0), (0, 1), (1, 1)])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("mode", ("valid_output", "pointwise", "keep_collapsed")) +def test_set_precision_z(mode): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") # GEOS <= 3.9 emits warning for 'pointwise' + geometry = shapely.set_precision(Point(0.9, 0.9, 0.9), 1, mode=mode) + assert shapely.get_precision(geometry) == 1 + assert_geometries_equal(geometry, Point(1, 1, 0.9)) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +@pytest.mark.parametrize("mode", ("valid_output", "pointwise", "keep_collapsed")) +def test_set_precision_nan(mode): + with warnings.catch_warnings(): + warnings.simplefilter("ignore") # GEOS <= 3.9 emits warning for 'pointwise' + actual = shapely.set_precision(line_string_nan, 1, mode=mode) + assert_geometries_equal(actual, line_string_nan) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_none(): + assert shapely.set_precision(None, 0) is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_grid_size_nan(): + assert shapely.set_precision(Point(0.9, 0.9), np.nan) is None + + +@pytest.mark.parametrize( + "geometry,mode,expected", + [ + ( + Polygon([(2, 2), (4, 2), (3.2, 3), (4, 4), (2, 4), (2.8, 3), (2, 2)]), + "valid_output", + MultiPolygon( + [ + Polygon([(4, 2), (2, 2), (3, 3), (4, 2)]), + Polygon([(2, 4), (4, 4), (3, 3), (2, 4)]), + ] + ), + ), + pytest.param( + Polygon([(2, 2), (4, 2), (3.2, 3), (4, 4), (2, 4), (2.8, 3), (2, 2)]), + "pointwise", + Polygon([(2, 2), (4, 2), (3, 3), (4, 4), (2, 4), (3, 3), (2, 2)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + ( + Polygon([(2, 2), (4, 2), (3.2, 3), (4, 4), (2, 4), (2.8, 3), (2, 2)]), + "keep_collapsed", + MultiPolygon( + [ + Polygon([(4, 2), (2, 2), (3, 3), (4, 2)]), + Polygon([(2, 4), (4, 4), (3, 3), (2, 4)]), + ] + ), + ), + (LineString([(0, 0), (0.1, 0.1)]), "valid_output", LineString()), + pytest.param( + LineString([(0, 0), (0.1, 0.1)]), + "pointwise", + LineString([(0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + ( + LineString([(0, 0), (0.1, 0.1)]), + "keep_collapsed", + LineString([(0, 0), (0, 0)]), + ), + pytest.param( + LinearRing([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "valid_output", + LinearRing(), + marks=pytest.mark.skipif( + shapely.geos_version == (3, 10, 0), reason="Segfaults on GEOS 3.10.0" + ), + ), + pytest.param( + LinearRing([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "pointwise", + LinearRing([(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + pytest.param( + LinearRing([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "keep_collapsed", + # See https://trac.osgeo.org/geos/ticket/1135#comment:5 + LineString([(0, 0), (0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="this collapsed into an invalid linearring pre-GEOS 3.10", + ), + ), + ( + Polygon([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "valid_output", + Polygon(), + ), + pytest.param( + Polygon([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "pointwise", + Polygon([(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), + reason="pointwise does not work pre-GEOS 3.10", + ), + ), + ( + Polygon([(0, 0), (0.1, 0), (0.1, 0.1), (0, 0.1), (0, 0)]), + "keep_collapsed", + Polygon(), + ), + ], +) +def test_set_precision_collapse(geometry, mode, expected): + """Lines and polygons collapse to empty geometries if vertices are too close""" + actual = shapely.set_precision(geometry, 1, mode=mode) + if shapely.geos_version < (3, 9, 0): + # pre GEOS 3.9 has difficulty comparing empty geometries exactly + # normalize and compare by WKT instead + assert shapely.to_wkt(shapely.normalize(actual)) == shapely.to_wkt( + shapely.normalize(expected) + ) + else: + # force to 2D because GEOS 3.10 yields 3D geometries when they are empty. + assert_geometries_equal(shapely.force_2d(actual), expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_set_precision_intersection(): + """Operations should use the most precise presision grid size of the inputs""" + + box1 = shapely.normalize(shapely.box(0, 0, 0.9, 0.9)) + box2 = shapely.normalize(shapely.box(0.75, 0, 1.75, 0.75)) + + assert shapely.get_precision(shapely.intersection(box1, box2)) == 0 + + # GEOS will use and keep the most precise precision grid size + box1 = shapely.set_precision(box1, 0.5) + box2 = shapely.set_precision(box2, 1) + out = shapely.intersection(box1, box2) + assert shapely.get_precision(out) == 0.5 + assert_geometries_equal(out, LineString([(1, 1), (1, 0)])) + + +@pytest.mark.parametrize("preserve_topology", [False, True]) +def set_precision_preserve_topology(preserve_topology): + # the preserve_topology kwarg is deprecated (ignored) + with pytest.warns(UserWarning): + actual = shapely.set_precision( + LineString([(0, 0), (0.1, 0.1)]), + 1.0, + preserve_topology=preserve_topology, + ) + assert_geometries_equal(shapely.force_2d(actual), LineString()) + + +@pytest.mark.skipif(shapely.geos_version >= (3, 10, 0), reason="GEOS >= 3.10") +def set_precision_pointwise_pre_310(): + # using 'pointwise' emits a warning + with pytest.warns(UserWarning): + actual = shapely.set_precision( + LineString([(0, 0), (0.1, 0.1)]), + 1.0, + mode="pointwise", + ) + assert_geometries_equal(shapely.force_2d(actual), LineString()) + + +@pytest.mark.parametrize("flags", [np.array([0, 1]), 4, "foo"]) +def set_precision_illegal_flags(flags): + # the preserve_topology kwarg is deprecated (ignored) + with pytest.raises((ValueError, TypeError)): + shapely.lib.set_precision(line_string, 1.0, flags) + + +def test_empty(): + """Compatibility with empty_like, see GH373""" + g = np.empty_like(np.array([None, None])) + assert shapely.is_missing(g).all() + + +# corresponding to geometry_collection_z: +geometry_collection_2 = shapely.geometrycollections([point, line_string]) +empty_geom_mark = pytest.mark.skipif( + shapely.geos_version < (3, 9, 0), + reason="Empty points don't have a dimensionality before GEOS 3.9", +) + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point), + (point_z, point), + pytest.param(empty_point, empty_point, marks=empty_geom_mark), + pytest.param(empty_point_z, empty_point, marks=empty_geom_mark), + (line_string, line_string), + (line_string_z, line_string), + pytest.param(empty_line_string, empty_line_string, marks=empty_geom_mark), + pytest.param(empty_line_string_z, empty_line_string, marks=empty_geom_mark), + (polygon, polygon), + (polygon_z, polygon), + (polygon_with_hole, polygon_with_hole), + (polygon_with_hole_z, polygon_with_hole), + (multi_point, multi_point), + (multi_point_z, multi_point), + (multi_line_string, multi_line_string), + (multi_line_string_z, multi_line_string), + (multi_polygon, multi_polygon), + (multi_polygon_z, multi_polygon), + (geometry_collection_2, geometry_collection_2), + (geometry_collection_z, geometry_collection_2), + ], +) +def test_force_2d(geom, expected): + actual = shapely.force_2d(geom) + assert shapely.get_coordinate_dimension(actual) == 2 + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, point_z), + (point_z, point_z), + pytest.param(empty_point, empty_point_z, marks=empty_geom_mark), + pytest.param(empty_point_z, empty_point_z, marks=empty_geom_mark), + (line_string, line_string_z), + (line_string_z, line_string_z), + pytest.param(empty_line_string, empty_line_string_z, marks=empty_geom_mark), + pytest.param(empty_line_string_z, empty_line_string_z, marks=empty_geom_mark), + (polygon, polygon_z), + (polygon_z, polygon_z), + (polygon_with_hole, polygon_with_hole_z), + (polygon_with_hole_z, polygon_with_hole_z), + (multi_point, multi_point_z), + (multi_point_z, multi_point_z), + (multi_line_string, multi_line_string_z), + (multi_line_string_z, multi_line_string_z), + (multi_polygon, multi_polygon_z), + (multi_polygon_z, multi_polygon_z), + (geometry_collection_2, geometry_collection_z), + (geometry_collection_z, geometry_collection_z), + ], +) +def test_force_3d(geom, expected): + actual = shapely.force_3d(geom, z=4) + assert shapely.get_coordinate_dimension(actual) == 3 + assert_geometries_equal(actual, expected) diff --git a/shapely/python/shapely/tests/test_io.py b/shapely/python/shapely/tests/test_io.py new file mode 100644 index 0000000..48e61cd --- /dev/null +++ b/shapely/python/shapely/tests/test_io.py @@ -0,0 +1,722 @@ +import json +import pickle +import struct +import warnings + +import numpy as np +import pytest + +import shapely +from shapely import GeometryCollection, LineString, Point, Polygon +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import all_types, empty_point, empty_point_z, point, point_z + +# fmt: off +POINT11_WKB = b"\x01\x01\x00\x00\x00" + struct.pack("<2d", 1.0, 1.0) +NAN = struct.pack("= (3, 9, 0), + reason="MULTIPOINT (EMPTY, 2 3) gives ValueError on GEOS < 3.9", +) +def test_to_wkt_multipoint_with_point_empty_errors(): + # test if segfault is prevented + geom = shapely.multipoints([empty_point, point]) + with pytest.raises(ValueError): + shapely.to_wkt(geom) + + +def test_repr(): + assert repr(point) == "" + + +def test_repr_max_length(): + # the repr is limited to 80 characters + geom = shapely.linestrings(np.arange(1000), np.arange(1000)) + representation = repr(geom) + assert len(representation) == 80 + assert representation.endswith("...>") + + +@pytest.mark.skipif( + shapely.geos_version >= (3, 9, 0), + reason="MULTIPOINT (EMPTY, 2 3) gives Exception on GEOS < 3.9", +) +def test_repr_multipoint_with_point_empty(): + # Test if segfault is prevented + geom = shapely.multipoints([point, empty_point]) + assert repr(geom) == "" + + +@pytest.mark.skipif( + shapely.geos_version < (3, 9, 0), + reason="Empty geometries have no dimensionality on GEOS < 3.9", +) +def test_repr_point_z_empty(): + assert repr(empty_point_z) == "" + + +def test_to_wkb(): + point = shapely.points(1, 1) + actual = shapely.to_wkb(point, byte_order=1) + assert actual == POINT11_WKB + + +def test_to_wkb_hex(): + point = shapely.points(1, 1) + actual = shapely.to_wkb(point, hex=True, byte_order=1) + le = "01" + point_type = "01000000" + coord = "000000000000F03F" # 1.0 as double (LE) + assert actual == le + point_type + 2 * coord + + +def test_to_wkb_3D(): + point_z = shapely.points(1, 1, 1) + actual = shapely.to_wkb(point_z, byte_order=1) + # fmt: off + assert actual == b"\x01\x01\x00\x00\x80\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?\x00\x00\x00\x00\x00\x00\xf0?" # noqa + # fmt: on + actual = shapely.to_wkb(point_z, output_dimension=2, byte_order=1) + assert actual == POINT11_WKB + + +def test_to_wkb_none(): + # None propagates + assert shapely.to_wkb(None) is None + + +def test_to_wkb_exceptions(): + with pytest.raises(TypeError): + shapely.to_wkb(1) + + with pytest.raises(shapely.GEOSException): + shapely.to_wkb(point, output_dimension=5) + + with pytest.raises(ValueError): + shapely.to_wkb(point, flavor="other") + + +def test_to_wkb_byte_order(): + point = shapely.points(1.0, 1.0) + be = b"\x00" + le = b"\x01" + point_type = b"\x01\x00\x00\x00" # 1 as 32-bit uint (LE) + coord = b"\x00\x00\x00\x00\x00\x00\xf0?" # 1.0 as double (LE) + + assert shapely.to_wkb(point, byte_order=1) == le + point_type + 2 * coord + assert ( + shapely.to_wkb(point, byte_order=0) == be + point_type[::-1] + 2 * coord[::-1] + ) + + +def test_to_wkb_srid(): + # hex representation of POINT (0 0) with SRID=4 + ewkb = "01010000200400000000000000000000000000000000000000" + wkb = "010100000000000000000000000000000000000000" + + actual = shapely.from_wkb(ewkb) + assert shapely.to_wkt(actual, trim=True) == "POINT (0 0)" + + assert shapely.to_wkb(actual, hex=True, byte_order=1) == wkb + assert shapely.to_wkb(actual, hex=True, include_srid=True, byte_order=1) == ewkb + + point = shapely.points(1, 1) + point_with_srid = shapely.set_srid(point, np.int32(4326)) + result = shapely.to_wkb(point_with_srid, include_srid=True, byte_order=1) + assert np.frombuffer(result[5:9], "= (3, 10, 0), reason="GEOS < 3.10.0") +def test_to_wkb_flavor_unsupported_geos(): + with pytest.raises(UnsupportedGEOSVersionError): + shapely.to_wkb(point_z, flavor="iso") + + +@pytest.mark.parametrize( + "geom,expected", + [ + (empty_point, POINT_NAN_WKB), + (empty_point_z, POINT_NAN_WKB), + (shapely.multipoints([empty_point]), MULTIPOINT_NAN_WKB), + (shapely.multipoints([empty_point_z]), MULTIPOINT_NAN_WKB), + (shapely.geometrycollections([empty_point]), GEOMETRYCOLLECTION_NAN_WKB), + (shapely.geometrycollections([empty_point_z]), GEOMETRYCOLLECTION_NAN_WKB), + ( + shapely.geometrycollections([shapely.multipoints([empty_point])]), + NESTED_COLLECTION_NAN_WKB, + ), + ( + shapely.geometrycollections([shapely.multipoints([empty_point_z])]), + NESTED_COLLECTION_NAN_WKB, + ), + ], +) +def test_to_wkb_point_empty_2d(geom, expected): + actual = shapely.to_wkb(geom, output_dimension=2, byte_order=1) + # Split 'actual' into header and coordinates + coordinate_length = 16 + header_length = len(expected) - coordinate_length + # Check the total length (this checks the correct dimensionality) + assert len(actual) == header_length + coordinate_length + # Check the header + assert actual[:header_length] == expected[:header_length] + # Check the coordinates (using numpy.isnan; there are many byte representations for NaN) + assert np.isnan(struct.unpack("<2d", actual[header_length:])).all() + + +@pytest.mark.xfail( + shapely.geos_version[:2] == (3, 8), reason="GEOS==3.8 never outputs 3D empty points" +) +@pytest.mark.parametrize( + "geom,expected", + [ + (empty_point_z, POINTZ_NAN_WKB), + (shapely.multipoints([empty_point_z]), MULTIPOINTZ_NAN_WKB), + (shapely.geometrycollections([empty_point_z]), GEOMETRYCOLLECTIONZ_NAN_WKB), + ( + shapely.geometrycollections([shapely.multipoints([empty_point_z])]), + NESTED_COLLECTIONZ_NAN_WKB, + ), + ], +) +def test_to_wkb_point_empty_3d(geom, expected): + actual = shapely.to_wkb(geom, output_dimension=3, byte_order=1) + # Split 'actual' into header and coordinates + coordinate_length = 24 + header_length = len(expected) - coordinate_length + # Check the total length (this checks the correct dimensionality) + assert len(actual) == header_length + coordinate_length + # Check the header + assert actual[:header_length] == expected[:header_length] + # Check the coordinates (using numpy.isnan; there are many byte representations for NaN) + assert np.isnan(struct.unpack("<3d", actual[header_length:])).all() + + +@pytest.mark.xfail( + shapely.geos_version < (3, 8, 0), + reason="GEOS<3.8 always outputs 3D empty points if output_dimension=3", +) +@pytest.mark.parametrize( + "geom,expected", + [ + (empty_point, POINT_NAN_WKB), + (shapely.multipoints([empty_point]), MULTIPOINT_NAN_WKB), + (shapely.geometrycollections([empty_point]), GEOMETRYCOLLECTION_NAN_WKB), + ( + shapely.geometrycollections([shapely.multipoints([empty_point])]), + NESTED_COLLECTION_NAN_WKB, + ), + ], +) +def test_to_wkb_point_empty_2d_output_dim_3(geom, expected): + actual = shapely.to_wkb(geom, output_dimension=3, byte_order=1) + # Split 'actual' into header and coordinates + coordinate_length = 16 + header_length = len(expected) - coordinate_length + # Check the total length (this checks the correct dimensionality) + assert len(actual) == header_length + coordinate_length + # Check the header + assert actual[:header_length] == expected[:header_length] + # Check the coordinates (using numpy.isnan; there are many byte representations for NaN) + assert np.isnan(struct.unpack("<2d", actual[header_length:])).all() + + +@pytest.mark.parametrize( + "wkb,expected_type,expected_dim", + [ + (POINT_NAN_WKB, 0, 2), + (POINTZ_NAN_WKB, 0, 3), + (MULTIPOINT_NAN_WKB, 4, 2), + (MULTIPOINTZ_NAN_WKB, 4, 3), + (GEOMETRYCOLLECTION_NAN_WKB, 7, 2), + (GEOMETRYCOLLECTIONZ_NAN_WKB, 7, 3), + (NESTED_COLLECTION_NAN_WKB, 7, 2), + (NESTED_COLLECTIONZ_NAN_WKB, 7, 3), + ], +) +def test_from_wkb_point_empty(wkb, expected_type, expected_dim): + geom = shapely.from_wkb(wkb) + # POINT (nan nan) transforms to an empty point + assert shapely.is_empty(geom) + assert shapely.get_type_id(geom) == expected_type + # The dimensionality (2D/3D) is only read correctly for GEOS >= 3.9.0 + if shapely.geos_version >= (3, 9, 0): + assert shapely.get_coordinate_dimension(geom) == expected_dim + + +def test_to_wkb_point_empty_srid(): + expected = shapely.set_srid(empty_point, 4236) + wkb = shapely.to_wkb(expected, include_srid=True) + actual = shapely.from_wkb(wkb) + assert shapely.get_srid(actual) == 4236 + + +@pytest.mark.parametrize("geom", all_types + (point_z, empty_point)) +def test_pickle(geom): + pickled = pickle.dumps(geom) + assert_geometries_equal(pickle.loads(pickled), geom, tolerance=0) + + +@pytest.mark.parametrize("geom", all_types + (point_z, empty_point)) +def test_pickle_with_srid(geom): + geom = shapely.set_srid(geom, 4326) + pickled = pickle.dumps(geom) + assert shapely.get_srid(pickle.loads(pickled)) == 4326 + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +@pytest.mark.parametrize( + "geojson,expected", + [ + (GEOJSON_GEOMETRY, GEOJSON_GEOMETRY_EXPECTED), + (GEOJSON_FEATURE, GEOJSON_GEOMETRY_EXPECTED), + ( + GEOJSON_FEATURECOLECTION, + shapely.geometrycollections(GEOJSON_COLLECTION_EXPECTED), + ), + ([GEOJSON_GEOMETRY] * 2, [GEOJSON_GEOMETRY_EXPECTED] * 2), + (None, None), + ([GEOJSON_GEOMETRY, None], [GEOJSON_GEOMETRY_EXPECTED, None]), + ], +) +def test_from_geojson(geojson, expected): + actual = shapely.from_geojson(geojson) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_exceptions(): + with pytest.raises(TypeError, match="Expected bytes or string, got int"): + shapely.from_geojson(1) + + with pytest.raises(shapely.GEOSException, match="Error parsing JSON"): + shapely.from_geojson("") + + with pytest.raises(shapely.GEOSException, match="Unknown geometry type"): + shapely.from_geojson('{"type": "NoGeometry", "coordinates": []}') + + with pytest.raises(shapely.GEOSException, match="type must be array, but is null"): + shapely.from_geojson('{"type": "LineString", "coordinates": null}') + + # Note: The two below tests are the reason that from_geojson is disabled for + # GEOS 3.10.0 See https://trac.osgeo.org/geos/ticket/1138 + with pytest.raises(shapely.GEOSException, match="key 'type' not found"): + shapely.from_geojson('{"geometry": null, "properties": []}') + + with pytest.raises(shapely.GEOSException, match="key 'type' not found"): + shapely.from_geojson('{"no": "geojson"}') + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_warn_on_invalid(): + with pytest.warns(Warning, match="Invalid GeoJSON"): + assert shapely.from_geojson("", on_invalid="warn") is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_ignore_on_invalid(): + with warnings.catch_warnings(): + warnings.simplefilter("error") + assert shapely.from_geojson("", on_invalid="ignore") is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +def test_from_geojson_on_invalid_unsupported_option(): + with pytest.raises(ValueError, match="not a valid option"): + shapely.from_geojson(GEOJSON_GEOMETRY, on_invalid="unsupported_option") + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "expected,geometry", + [ + (GEOJSON_GEOMETRY, GEOJSON_GEOMETRY_EXPECTED), + ([GEOJSON_GEOMETRY] * 2, [GEOJSON_GEOMETRY_EXPECTED] * 2), + (None, None), + ([GEOJSON_GEOMETRY, None], [GEOJSON_GEOMETRY_EXPECTED, None]), + ], +) +def test_to_geojson(geometry, expected): + actual = shapely.to_geojson(geometry, indent=4) + assert np.all(actual == np.asarray(expected)) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize("indent", [None, 0, 4]) +def test_to_geojson_indent(indent): + separators = (",", ":") if indent is None else (",", ": ") + expected = json.dumps( + json.loads(GEOJSON_GEOMETRY), indent=indent, separators=separators + ) + actual = shapely.to_geojson(GEOJSON_GEOMETRY_EXPECTED, indent=indent) + assert actual == expected + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_to_geojson_exceptions(): + with pytest.raises(TypeError): + shapely.to_geojson(1) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geom", + [ + empty_point, + shapely.multipoints([empty_point, point]), + shapely.geometrycollections([empty_point, point]), + shapely.geometrycollections( + [shapely.geometrycollections([empty_point]), point] + ), + ], +) +def test_to_geojson_point_empty(geom): + # Pending GEOS ticket: https://trac.osgeo.org/geos/ticket/1139 + with pytest.raises(ValueError): + assert shapely.to_geojson(geom) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 1), reason="GEOS < 3.10.1") +@pytest.mark.parametrize("geom", all_types) +def test_geojson_all_types(geom): + if shapely.get_type_id(geom) == shapely.GeometryType.LINEARRING: + pytest.skip("Linearrings are not preserved in GeoJSON") + geojson = shapely.to_geojson(geom) + actual = shapely.from_geojson(geojson) + assert_geometries_equal(actual, geom) diff --git a/shapely/python/shapely/tests/test_linear.py b/shapely/python/shapely/tests/test_linear.py new file mode 100644 index 0000000..05fd651 --- /dev/null +++ b/shapely/python/shapely/tests/test_linear.py @@ -0,0 +1,213 @@ +import numpy as np +import pytest + +import shapely +from shapely import GeometryCollection, LinearRing, LineString, MultiLineString, Point +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import ( + empty_line_string, + empty_point, + line_string, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + polygon, +) + + +def test_line_interpolate_point_geom_array(): + actual = shapely.line_interpolate_point( + [line_string, linear_ring, multi_line_string], -1 + ) + assert_geometries_equal(actual[0], Point(1, 0)) + assert_geometries_equal(actual[1], Point(0, 1)) + assert_geometries_equal(actual[2], Point(0.5528, 1.1056), tolerance=0.001) + + +def test_line_interpolate_point_geom_array_normalized(): + actual = shapely.line_interpolate_point( + [line_string, linear_ring, multi_line_string], 1, normalized=True + ) + assert_geometries_equal(actual[0], Point(1, 1)) + assert_geometries_equal(actual[1], Point(0, 0)) + assert_geometries_equal(actual[2], Point(1, 2)) + + +def test_line_interpolate_point_float_array(): + actual = shapely.line_interpolate_point(line_string, [0.2, 1.5, -0.2]) + assert_geometries_equal(actual[0], Point(0.2, 0)) + assert_geometries_equal(actual[1], Point(1, 0.5)) + assert_geometries_equal(actual[2], Point(1, 0.8)) + + +@pytest.mark.parametrize("normalized", [False, True]) +@pytest.mark.parametrize( + "geom", + [ + LineString(), + LinearRing(), + MultiLineString(), + shapely.from_wkt("MULTILINESTRING (EMPTY, (0 0, 1 1))"), + GeometryCollection(), + GeometryCollection([LineString(), Point(1, 1)]), + ], +) +def test_line_interpolate_point_empty(geom, normalized): + # These geometries segfault in some versions of GEOS (in 3.8.0, still + # some of them segfault). Instead, we patched this to return POINT EMPTY. + # This matches GEOS 3.8.0 behavior on simple empty geometries. + assert_geometries_equal( + shapely.line_interpolate_point(geom, 0.2, normalized=normalized), empty_point + ) + + +@pytest.mark.parametrize("normalized", [False, True]) +@pytest.mark.parametrize( + "geom", + [ + empty_point, + point, + polygon, + multi_point, + multi_polygon, + shapely.geometrycollections([point]), + shapely.geometrycollections([polygon]), + shapely.geometrycollections([multi_line_string]), + shapely.geometrycollections([multi_point]), + shapely.geometrycollections([multi_polygon]), + ], +) +def test_line_interpolate_point_invalid_type(geom, normalized): + with pytest.raises(TypeError): + assert shapely.line_interpolate_point(geom, 0.2, normalized=normalized) + + +def test_line_interpolate_point_none(): + assert shapely.line_interpolate_point(None, 0.2) is None + + +def test_line_interpolate_point_nan(): + assert shapely.line_interpolate_point(line_string, np.nan) is None + + +def test_line_locate_point_geom_array(): + point = shapely.points(0, 1) + actual = shapely.line_locate_point([line_string, linear_ring], point) + np.testing.assert_allclose(actual, [0.0, 3.0]) + + +def test_line_locate_point_geom_array2(): + points = shapely.points([[0, 0], [1, 0]]) + actual = shapely.line_locate_point(line_string, points) + np.testing.assert_allclose(actual, [0.0, 1.0]) + + +@pytest.mark.parametrize("normalized", [False, True]) +def test_line_locate_point_none(normalized): + assert np.isnan(shapely.line_locate_point(line_string, None, normalized=normalized)) + assert np.isnan(shapely.line_locate_point(None, point, normalized=normalized)) + + +@pytest.mark.parametrize("normalized", [False, True]) +def test_line_locate_point_empty(normalized): + assert np.isnan( + shapely.line_locate_point(line_string, empty_point, normalized=normalized) + ) + assert np.isnan( + shapely.line_locate_point(empty_line_string, point, normalized=normalized) + ) + + +@pytest.mark.parametrize("normalized", [False, True]) +def test_line_locate_point_invalid_geometry(normalized): + with pytest.raises(shapely.GEOSException): + shapely.line_locate_point(line_string, line_string, normalized=normalized) + + with pytest.raises(shapely.GEOSException): + shapely.line_locate_point(polygon, point, normalized=normalized) + + +def test_line_merge_geom_array(): + actual = shapely.line_merge([line_string, multi_line_string]) + assert_geometries_equal(actual[0], line_string) + assert_geometries_equal(actual[1], LineString([(0, 0), (1, 2)])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 11, 0), reason="GEOS < 3.11.0") +def test_line_merge_directed(): + lines = MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]]) + # Merge lines without directed, this requires changing the vertex ordering + result = shapely.line_merge(lines) + assert_geometries_equal(result, LineString([(1, 0), (0, 0), (3, 0)])) + # Since the lines can't be merged when directed is specified + # the original geometry is returned + result = shapely.line_merge(lines, directed=True) + assert_geometries_equal(result, lines) + + +@pytest.mark.skipif(shapely.geos_version >= (3, 11, 0), reason="GEOS >= 3.11.0") +def test_line_merge_error(): + lines = MultiLineString([[(0, 0), (1, 0)], [(0, 0), (3, 0)]]) + with pytest.raises(UnsupportedGEOSVersionError): + shapely.line_merge(lines, directed=True) + + +def test_shared_paths_linestring(): + g1 = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + g2 = shapely.linestrings([(0, 0), (1, 0)]) + actual1 = shapely.shared_paths(g1, g2) + assert_geometries_equal( + shapely.get_geometry(actual1, 0), shapely.multilinestrings([g2]) + ) + + +def test_shared_paths_none(): + assert shapely.shared_paths(line_string, None) is None + assert shapely.shared_paths(None, line_string) is None + assert shapely.shared_paths(None, None) is None + + +def test_shared_paths_non_linestring(): + g1 = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + g2 = shapely.points(0, 1) + with pytest.raises(shapely.GEOSException): + shapely.shared_paths(g1, g2) + + +def _prepare_input(geometry, prepare): + """Prepare without modifying inplace""" + if prepare: + geometry = shapely.transform(geometry, lambda x: x) # makes a copy + shapely.prepare(geometry) + return geometry + else: + return geometry + + +@pytest.mark.parametrize("prepare", [True, False]) +def test_shortest_line(prepare): + g1 = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + g2 = shapely.linestrings([(0, 3), (3, 0)]) + actual = shapely.shortest_line(_prepare_input(g1, prepare), g2) + expected = shapely.linestrings([(1, 1), (1.5, 1.5)]) + assert shapely.equals(actual, expected) + + +@pytest.mark.parametrize("prepare", [True, False]) +def test_shortest_line_none(prepare): + assert shapely.shortest_line(_prepare_input(line_string, prepare), None) is None + assert shapely.shortest_line(None, line_string) is None + assert shapely.shortest_line(None, None) is None + + +@pytest.mark.parametrize("prepare", [True, False]) +def test_shortest_line_empty(prepare): + g1 = _prepare_input(line_string, prepare) + assert shapely.shortest_line(g1, empty_line_string) is None + g1_empty = _prepare_input(empty_line_string, prepare) + assert shapely.shortest_line(g1_empty, line_string) is None + assert shapely.shortest_line(g1_empty, empty_line_string) is None diff --git a/shapely/python/shapely/tests/test_measurement.py b/shapely/python/shapely/tests/test_measurement.py new file mode 100644 index 0000000..db85791 --- /dev/null +++ b/shapely/python/shapely/tests/test_measurement.py @@ -0,0 +1,356 @@ +import numpy as np +import pytest +from numpy.testing import assert_allclose, assert_array_equal + +import shapely +from shapely import GeometryCollection, LineString, MultiPoint, Point, Polygon + +from .common import ( + empty, + geometry_collection, + ignore_invalid, + line_string, + linear_ring, + multi_line_string, + multi_point, + multi_polygon, + point, + point_polygon_testdata, + polygon, + polygon_with_hole, +) + + +@pytest.mark.parametrize( + "geom", + [ + point, + line_string, + linear_ring, + multi_point, + multi_line_string, + geometry_collection, + ], +) +def test_area_non_polygon(geom): + assert shapely.area(geom) == 0.0 + + +def test_area(): + actual = shapely.area([polygon, polygon_with_hole, multi_polygon]) + assert actual.tolist() == [4.0, 96.0, 1.01] + + +def test_distance(): + actual = shapely.distance(*point_polygon_testdata) + expected = [2 * 2**0.5, 2**0.5, 0, 0, 0, 2**0.5] + np.testing.assert_allclose(actual, expected) + + +def test_distance_missing(): + actual = shapely.distance(point, None) + assert np.isnan(actual) + + +def test_distance_duplicated(): + a = Point(1, 2) + b = LineString([(0, 0), (0, 0), (1, 1)]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # https://github.com/shapely/shapely/issues/1552 + # GEOS < 3.12 raises "invalid" floating point errors + actual = shapely.distance(a, b) + assert actual == 1.0 + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, [2, 3, 2, 3]), + ([point, multi_point], [[2, 3, 2, 3], [0, 0, 1, 2]]), + (shapely.linestrings([[0, 0], [0, 1]]), [0, 0, 0, 1]), + (shapely.linestrings([[0, 0], [1, 0]]), [0, 0, 1, 0]), + (multi_point, [0, 0, 1, 2]), + (multi_polygon, [0, 0, 2.2, 2.2]), + (geometry_collection, [49, -1, 52, 2]), + (empty, [np.nan, np.nan, np.nan, np.nan]), + (None, [np.nan, np.nan, np.nan, np.nan]), + ], +) +def test_bounds(geom, expected): + assert_array_equal(shapely.bounds(geom), expected) + + +@pytest.mark.parametrize( + "geom,shape", + [ + (point, (4,)), + (None, (4,)), + ([point, multi_point], (2, 4)), + ([[point, multi_point], [polygon, point]], (2, 2, 4)), + ([[[point, multi_point]], [[polygon, point]]], (2, 1, 2, 4)), + ], +) +def test_bounds_dimensions(geom, shape): + assert shapely.bounds(geom).shape == shape + + +@pytest.mark.parametrize( + "geom,expected", + [ + (point, [2, 3, 2, 3]), + (shapely.linestrings([[0, 0], [0, 1]]), [0, 0, 0, 1]), + (shapely.linestrings([[0, 0], [1, 0]]), [0, 0, 1, 0]), + (multi_point, [0, 0, 1, 2]), + (multi_polygon, [0, 0, 2.2, 2.2]), + (geometry_collection, [49, -1, 52, 2]), + (empty, [np.nan, np.nan, np.nan, np.nan]), + (None, [np.nan, np.nan, np.nan, np.nan]), + ([empty, empty, None], [np.nan, np.nan, np.nan, np.nan]), + # mixed missing and non-missing coordinates + ([point, None], [2, 3, 2, 3]), + ([point, empty], [2, 3, 2, 3]), + ([point, empty, None], [2, 3, 2, 3]), + ([point, empty, None, multi_point], [0, 0, 2, 3]), + ], +) +def test_total_bounds(geom, expected): + assert_array_equal(shapely.total_bounds(geom), expected) + + +@pytest.mark.parametrize( + "geom", + [ + point, + None, + [point, multi_point], + [[point, multi_point], [polygon, point]], + [[[point, multi_point]], [[polygon, point]]], + ], +) +def test_total_bounds_dimensions(geom): + assert shapely.total_bounds(geom).shape == (4,) + + +def test_length(): + actual = shapely.length( + [ + point, + line_string, + linear_ring, + polygon, + polygon_with_hole, + multi_point, + multi_polygon, + ] + ) + assert actual.tolist() == [0.0, 2.0, 4.0, 8.0, 48.0, 0.0, 4.4] + + +def test_length_missing(): + actual = shapely.length(None) + assert np.isnan(actual) + + +def test_hausdorff_distance(): + # example from GEOS docs + a = shapely.linestrings([[0, 0], [100, 0], [10, 100], [10, 100]]) + b = shapely.linestrings([[0, 100], [0, 10], [80, 10]]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Hausdorff distance emits "invalid value encountered" + # (see https://github.com/libgeos/geos/issues/515) + actual = shapely.hausdorff_distance(a, b) + assert actual == pytest.approx(22.360679775, abs=1e-7) + + +def test_hausdorff_distance_densify(): + # example from GEOS docs + a = shapely.linestrings([[0, 0], [100, 0], [10, 100], [10, 100]]) + b = shapely.linestrings([[0, 100], [0, 10], [80, 10]]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Hausdorff distance emits "invalid value encountered" + # (see https://github.com/libgeos/geos/issues/515) + actual = shapely.hausdorff_distance(a, b, densify=0.001) + assert actual == pytest.approx(47.8, abs=0.1) + + +def test_hausdorff_distance_missing(): + actual = shapely.hausdorff_distance(point, None) + assert np.isnan(actual) + actual = shapely.hausdorff_distance(point, None, densify=0.001) + assert np.isnan(actual) + + +def test_hausdorff_densify_nan(): + actual = shapely.hausdorff_distance(point, point, densify=np.nan) + assert np.isnan(actual) + + +def test_distance_empty(): + actual = shapely.distance(point, empty) + assert np.isnan(actual) + + +def test_hausdorff_distance_empty(): + actual = shapely.hausdorff_distance(point, empty) + assert np.isnan(actual) + + +def test_hausdorff_distance_densify_empty(): + actual = shapely.hausdorff_distance(point, empty, densify=0.2) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom1, geom2, expected", + [ + # identical geometries should have 0 distance + ( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [100, 0]]), + 0, + ), + # example from GEOS docs + ( + shapely.linestrings([[0, 0], [50, 200], [100, 0], [150, 200], [200, 0]]), + shapely.linestrings([[0, 200], [200, 150], [0, 100], [200, 50], [0, 0]]), + 200, + ), + # same geometries but different curve direction results in maximum + # distance between vertices on the lines. + ( + shapely.linestrings([[0, 0], [50, 200], [100, 0], [150, 200], [200, 0]]), + shapely.linestrings([[200, 0], [150, 200], [100, 0], [50, 200], [0, 0]]), + 200, + ), + # another example from GEOS docs + ( + shapely.linestrings([[0, 0], [50, 200], [100, 0], [150, 200], [200, 0]]), + shapely.linestrings([[0, 0], [200, 50], [0, 100], [200, 150], [0, 200]]), + 282.842712474619, + ), + # example from GEOS tests + ( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [50, 50], [100, 0]]), + 70.7106781186548, + ), + ], +) +def test_frechet_distance(geom1, geom2, expected): + actual = shapely.frechet_distance(geom1, geom2) + assert actual == pytest.approx(expected, abs=1e-12) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom1, geom2, densify, expected", + [ + # example from GEOS tests + ( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [50, 50], [100, 0]]), + 0.001, + 50, + ) + ], +) +def test_frechet_distance_densify(geom1, geom2, densify, expected): + actual = shapely.frechet_distance(geom1, geom2, densify=densify) + assert actual == pytest.approx(expected, abs=1e-12) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom1, geom2", + [ + (line_string, None), + (None, line_string), + (None, None), + (line_string, empty), + (empty, line_string), + (empty, empty), + ], +) +def test_frechet_distance_nan_for_invalid_geometry_inputs(geom1, geom2): + actual = shapely.frechet_distance(geom1, geom2) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_frechet_densify_ndarray(): + actual = shapely.frechet_distance( + shapely.linestrings([[0, 0], [100, 0]]), + shapely.linestrings([[0, 0], [50, 50], [100, 0]]), + densify=[0.1, 0.2, 1], + ) + expected = np.array([50, 50.99019514, 70.7106781186548]) + np.testing.assert_array_almost_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_frechet_densify_nan(): + actual = shapely.frechet_distance(line_string, line_string, densify=np.nan) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize("densify", [0, -1, 2]) +def test_frechet_densify_invalid_values(densify): + with pytest.raises(shapely.GEOSException, match="Fraction is not in range"): + shapely.frechet_distance(line_string, line_string, densify=densify) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +def test_frechet_distance_densify_empty(): + actual = shapely.frechet_distance(line_string, empty, densify=0.2) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_minimum_clearance(): + actual = shapely.minimum_clearance([polygon, polygon_with_hole, multi_polygon]) + assert_allclose(actual, [2.0, 2.0, 0.1]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_minimum_clearance_nonexistent(): + actual = shapely.minimum_clearance([point, empty]) + assert np.isinf(actual).all() + + +@pytest.mark.skipif(shapely.geos_version < (3, 6, 0), reason="GEOS < 3.6") +def test_minimum_clearance_missing(): + actual = shapely.minimum_clearance(None) + assert np.isnan(actual) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geometry, expected", + [ + ( + Polygon([(0, 5), (5, 10), (10, 5), (5, 0), (0, 5)]), + 5, + ), + ( + LineString([(1, 0), (1, 10)]), + 5, + ), + ( + MultiPoint([(2, 2), (4, 2)]), + 1, + ), + ( + Point(2, 2), + 0, + ), + ( + GeometryCollection(), + 0, + ), + ], +) +def test_minimum_bounding_radius(geometry, expected): + actual = shapely.minimum_bounding_radius(geometry) + assert actual == pytest.approx(expected, abs=1e-12) diff --git a/shapely/python/shapely/tests/test_misc.py b/shapely/python/shapely/tests/test_misc.py new file mode 100644 index 0000000..aad4870 --- /dev/null +++ b/shapely/python/shapely/tests/test_misc.py @@ -0,0 +1,184 @@ +import os +import sys +from itertools import chain +from string import ascii_letters, digits +from unittest import mock + +import numpy as np +import pytest + +import shapely +from shapely.decorators import multithreading_enabled, requires_geos + + +@pytest.fixture +def mocked_geos_version(): + with mock.patch.object(shapely.lib, "geos_version", new=(3, 7, 1)): + yield "3.7.1" + + +@pytest.fixture +def sphinx_doc_build(): + os.environ["SPHINX_DOC_BUILD"] = "1" + yield + del os.environ["SPHINX_DOC_BUILD"] + + +def test_version(): + assert isinstance(shapely.__version__, str) + + +def test_geos_version(): + expected = "{}.{}.{}".format(*shapely.geos_version) + actual = shapely.geos_version_string + + # strip any beta / dev qualifiers + if any(c.isalpha() for c in actual): + if actual[-1].isnumeric(): + actual = actual.rstrip(digits) + actual = actual.rstrip(ascii_letters) + + assert actual == expected + + +@pytest.mark.skipif( + sys.platform.startswith("win") and shapely.geos_version[:2] == (3, 7), + reason="GEOS_C_API_VERSION broken for GEOS 3.7.x on Windows", +) +def test_geos_capi_version(): + expected = "{}.{}.{}-CAPI-{}.{}.{}".format( + *(shapely.geos_version + shapely.geos_capi_version) + ) + + # split into component parts and strip any beta / dev qualifiers + ( + actual_geos_version, + actual_geos_api_version, + ) = shapely.geos_capi_version_string.split("-CAPI-") + + if any(c.isalpha() for c in actual_geos_version): + if actual_geos_version[-1].isnumeric(): + actual_geos_version = actual_geos_version.rstrip(digits) + actual_geos_version = actual_geos_version.rstrip(ascii_letters) + actual_geos_version = actual_geos_version.rstrip(ascii_letters) + + assert f"{actual_geos_version}-CAPI-{actual_geos_api_version}" == expected + + +def func(): + """Docstring that will be mocked. + A multiline. + + Some description. + """ + + +class SomeClass: + def func(self): + """Docstring that will be mocked. + A multiline. + + Some description. + """ + + +expected_docstring = """Docstring that will be mocked. +{indent}A multiline. + +{indent}.. note:: 'func' requires at least GEOS {version}. + +{indent}Some description. +{indent}""" + + +@pytest.mark.parametrize("version", ["3.7.0", "3.7.1", "3.6.2"]) +def test_requires_geos_ok(version, mocked_geos_version): + wrapped = requires_geos(version)(func) + assert wrapped is func + + +@pytest.mark.parametrize("version", ["3.7.2", "3.8.0", "3.8.1"]) +def test_requires_geos_not_ok(version, mocked_geos_version): + wrapped = requires_geos(version)(func) + with pytest.raises(shapely.errors.UnsupportedGEOSVersionError): + wrapped() + + assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 4) + + +@pytest.mark.parametrize("version", ["3.6.0", "3.8.0"]) +def test_requires_geos_doc_build(version, mocked_geos_version, sphinx_doc_build): + """The requires_geos decorator always adapts the docstring.""" + wrapped = requires_geos(version)(func) + + assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 4) + + +@pytest.mark.parametrize("version", ["3.6.0", "3.8.0"]) +def test_requires_geos_method(version, mocked_geos_version, sphinx_doc_build): + """The requires_geos decorator adjusts methods docstrings correctly""" + wrapped = requires_geos(version)(SomeClass.func) + + assert wrapped.__doc__ == expected_docstring.format(version=version, indent=" " * 8) + + +@multithreading_enabled +def set_first_element(value, *args, **kwargs): + for arg in chain(args, kwargs.values()): + if hasattr(arg, "__setitem__"): + arg[0] = value + return arg + + +def test_multithreading_enabled_raises_arg(): + arr = np.empty((1,), dtype=object) + + # set_first_element cannot change the input array + with pytest.raises(ValueError): + set_first_element(42, arr) + + # afterwards, we can + arr[0] = 42 + assert arr[0] == 42 + + +def test_multithreading_enabled_raises_kwarg(): + arr = np.empty((1,), dtype=object) + + # set_first_element cannot change the input array + with pytest.raises(ValueError): + set_first_element(42, arr=arr) + + # writable flag goes to original state + assert arr.flags.writeable + + +def test_multithreading_enabled_preserves_flag(): + arr = np.empty((1,), dtype=object) + arr.flags.writeable = False + + # set_first_element cannot change the input array + with pytest.raises(ValueError): + set_first_element(42, arr) + + # writable flag goes to original state + assert not arr.flags.writeable + + +@pytest.mark.parametrize( + "args,kwargs", + [ + ((np.empty((1,), dtype=float),), {}), # float-dtype ndarray is untouched + ((), {"a": np.empty((1,), dtype=float)}), + (([1],), {}), # non-ndarray is untouched + ((), {"a": [1]}), + ((), {"out": np.empty((1,), dtype=object)}), # ufunc kwarg 'out' is untouched + ( + (), + {"where": np.empty((1,), dtype=object)}, + ), # ufunc kwarg 'where' is untouched + ], +) +def test_multithreading_enabled_ok(args, kwargs): + result = set_first_element(42, *args, **kwargs) + assert result[0] == 42 diff --git a/shapely/python/shapely/tests/test_plotting.py b/shapely/python/shapely/tests/test_plotting.py new file mode 100644 index 0000000..f06bec2 --- /dev/null +++ b/shapely/python/shapely/tests/test_plotting.py @@ -0,0 +1,103 @@ +import pytest +from numpy.testing import assert_allclose + +from shapely import box, get_coordinates, LineString, MultiLineString, Point +from shapely.plotting import patch_from_polygon, plot_line, plot_points, plot_polygon + +pytest.importorskip("matplotlib") + + +def test_patch_from_polygon(): + poly = box(0, 0, 1, 1) + artist = patch_from_polygon(poly, facecolor="red", edgecolor="blue", linewidth=3) + assert equal_color(artist.get_facecolor(), "red") + assert equal_color(artist.get_edgecolor(), "blue") + assert artist.get_linewidth() == 3 + + +def test_patch_from_polygon_with_interior(): + poly = box(0, 0, 1, 1).difference(box(0.2, 0.2, 0.5, 0.5)) + artist = patch_from_polygon(poly, facecolor="red", edgecolor="blue", linewidth=3) + assert equal_color(artist.get_facecolor(), "red") + assert equal_color(artist.get_edgecolor(), "blue") + assert artist.get_linewidth() == 3 + + +def test_patch_from_multipolygon(): + poly = box(0, 0, 1, 1).union(box(2, 2, 3, 3)) + artist = patch_from_polygon(poly, facecolor="red", edgecolor="blue", linewidth=3) + assert equal_color(artist.get_facecolor(), "red") + assert equal_color(artist.get_edgecolor(), "blue") + assert artist.get_linewidth() == 3 + + +def test_plot_polygon(): + poly = box(0, 0, 1, 1) + artist, _ = plot_polygon(poly) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(poly)) + + # overriding default styling + artist = plot_polygon(poly, add_points=False, color="red", linewidth=3) + assert equal_color(artist.get_facecolor(), "red", alpha=0.3) + assert equal_color(artist.get_edgecolor(), "red", alpha=1.0) + assert artist.get_linewidth() == 3 + + +def test_plot_polygon_with_interior(): + poly = box(0, 0, 1, 1).difference(box(0.2, 0.2, 0.5, 0.5)) + artist, _ = plot_polygon(poly) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(poly)) + + +def test_plot_multipolygon(): + poly = box(0, 0, 1, 1).union(box(2, 2, 3, 3)) + artist, _ = plot_polygon(poly) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(poly)) + + +def test_plot_line(): + line = LineString([(0, 0), (1, 0), (1, 1)]) + artist, _ = plot_line(line) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(line)) + + # overriding default styling + artist = plot_line(line, add_points=False, color="red", linewidth=3) + assert equal_color(artist.get_edgecolor(), "red") + assert equal_color(artist.get_facecolor(), "none") + assert artist.get_linewidth() == 3 + + +def test_plot_multilinestring(): + line = MultiLineString( + [LineString([(0, 0), (1, 0), (1, 1)]), LineString([(2, 2), (3, 3)])] + ) + artist, _ = plot_line(line) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(line)) + + +def test_plot_points(): + for geom in [Point(0, 0), LineString([(0, 0), (1, 0), (1, 1)]), box(0, 0, 1, 1)]: + artist = plot_points(geom) + plot_coords = artist.get_path().vertices + assert_allclose(plot_coords, get_coordinates(geom)) + assert artist.get_linestyle() == "None" + + # overriding default styling + geom = Point(0, 0) + artist = plot_points(geom, color="red", marker="+", fillstyle="top") + assert artist.get_color() == "red" + assert artist.get_marker() == "+" + assert artist.get_fillstyle() == "top" + + +def equal_color(actual, expected, alpha=None): + import matplotlib.colors as colors + + conv = colors.colorConverter + + return actual == conv.to_rgba(expected, alpha=alpha) diff --git a/shapely/python/shapely/tests/test_predicates.py b/shapely/python/shapely/tests/test_predicates.py new file mode 100644 index 0000000..ffdafb1 --- /dev/null +++ b/shapely/python/shapely/tests/test_predicates.py @@ -0,0 +1,332 @@ +from functools import partial + +import numpy as np +import pytest + +import shapely +from shapely import LinearRing, LineString, Point + +from .common import ( + all_types, + empty, + geometry_collection, + ignore_invalid, + line_string, + linear_ring, + point, + polygon, +) + +UNARY_PREDICATES = ( + shapely.is_empty, + shapely.is_simple, + shapely.is_ring, + shapely.is_closed, + shapely.is_valid, + shapely.is_missing, + shapely.is_geometry, + shapely.is_valid_input, + shapely.is_prepared, + pytest.param( + shapely.is_ccw, + marks=pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7"), + ), +) + +BINARY_PREDICATES = ( + shapely.disjoint, + shapely.touches, + shapely.intersects, + shapely.crosses, + shapely.within, + shapely.contains, + shapely.contains_properly, + shapely.overlaps, + shapely.covers, + shapely.covered_by, + pytest.param( + partial(shapely.dwithin, distance=1.0), + marks=pytest.mark.skipif( + shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10" + ), + ), + shapely.equals, + shapely.equals_exact, +) + +BINARY_PREPARED_PREDICATES = BINARY_PREDICATES[:-2] + +XY_PREDICATES = ( + (shapely.contains_xy, shapely.contains), + (shapely.intersects_xy, shapely.intersects), +) + + +@pytest.mark.parametrize("geometry", all_types) +@pytest.mark.parametrize("func", UNARY_PREDICATES) +def test_unary_array(geometry, func): + actual = func([geometry, geometry]) + assert actual.shape == (2,) + assert actual.dtype == np.bool_ + + +@pytest.mark.parametrize("func", UNARY_PREDICATES) +def test_unary_with_kwargs(func): + out = np.empty((), dtype=np.uint8) + actual = func(point, out=out) + assert actual is out + assert actual.dtype == np.uint8 + + +@pytest.mark.parametrize("func", UNARY_PREDICATES) +def test_unary_missing(func): + if func in (shapely.is_valid_input, shapely.is_missing): + assert func(None) + else: + assert not func(None) + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func", BINARY_PREDICATES) +def test_binary_array(a, func): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func([a, a], point) + assert actual.shape == (2,) + assert actual.dtype == np.bool_ + + +@pytest.mark.parametrize("func", BINARY_PREDICATES) +def test_binary_with_kwargs(func): + out = np.empty((), dtype=np.uint8) + actual = func(point, point, out=out) + assert actual is out + assert actual.dtype == np.uint8 + + +@pytest.mark.parametrize("func", BINARY_PREDICATES) +def test_binary_missing(func): + actual = func(np.array([point, None, None]), np.array([None, point, None])) + assert (~actual).all() + + +def test_binary_empty_result(): + a = LineString([(0, 0), (3, 0), (3, 3), (0, 3)]) + b = LineString([(5, 1), (6, 1)]) + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Intersection resulting in empty geometries give 'invalid value encountered' + # (https://github.com/shapely/shapely/issues/1345) + assert shapely.intersection(a, b).is_empty + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func, func_bin", XY_PREDICATES) +def test_xy_array(a, func, func_bin): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func([a, a], 2, 3) + expected = func_bin([a, a], Point(2, 3)) + assert actual.shape == (2,) + assert actual.dtype == np.bool_ + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func, func_bin", XY_PREDICATES) +def test_xy_array_broadcast(a, func, func_bin): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func(a, [0, 1, 2], [1, 2, 3]) + expected = func_bin(a, [Point(0, 1), Point(1, 2), Point(2, 3)]) + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("func", [funcs[0] for funcs in XY_PREDICATES]) +def test_xy_array_2D(func): + actual = func(polygon, [0, 1, 2], [1, 2, 3]) + expected = func(polygon, [[0, 1], [1, 2], [2, 3]]) + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("func, func_bin", XY_PREDICATES) +def test_xy_prepared(func, func_bin): + actual = func(_prepare_with_copy([polygon, line_string]), 2, 3) + expected = func_bin([polygon, line_string], Point(2, 3)) + np.testing.assert_allclose(actual, expected) + + +@pytest.mark.parametrize("func", [funcs[0] for funcs in XY_PREDICATES]) +def test_xy_with_kwargs(func): + out = np.empty((), dtype=np.uint8) + actual = func(point, point.x, point.y, out=out) + assert actual is out + assert actual.dtype == np.uint8 + + +@pytest.mark.parametrize("func", [funcs[0] for funcs in XY_PREDICATES]) +def test_xy_missing(func): + actual = func( + np.array([point, point, point, None]), + np.array([point.x, np.nan, point.x, point.x]), + np.array([point.y, point.y, np.nan, point.y]), + ) + np.testing.assert_allclose(actual, [True, False, False, False]) + + +def test_equals_exact_tolerance(): + # specifying tolerance + p1 = shapely.points(50, 4) + p2 = shapely.points(50.1, 4.1) + actual = shapely.equals_exact([p1, p2, None], p1, tolerance=0.05) + np.testing.assert_allclose(actual, [True, False, False]) + assert actual.dtype == np.bool_ + actual = shapely.equals_exact([p1, p2, None], p1, tolerance=0.2) + np.testing.assert_allclose(actual, [True, True, False]) + assert actual.dtype == np.bool_ + + # default value for tolerance + assert shapely.equals_exact(p1, p1).item() is True + assert shapely.equals_exact(p1, p2).item() is False + + # an array of tolerances + actual = shapely.equals_exact(p1, p2, tolerance=[0.05, 0.2, np.nan]) + np.testing.assert_allclose(actual, [False, True, False]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 10, 0), reason="GEOS < 3.10") +def test_dwithin(): + p1 = shapely.points(50, 4) + p2 = shapely.points(50.1, 4.1) + actual = shapely.dwithin([p1, p2, None], p1, distance=0.05) + np.testing.assert_equal(actual, [True, False, False]) + assert actual.dtype == np.bool_ + actual = shapely.dwithin([p1, p2, None], p1, distance=0.2) + np.testing.assert_allclose(actual, [True, True, False]) + assert actual.dtype == np.bool_ + + # an array of distances + actual = shapely.dwithin(p1, p2, distance=[0.05, 0.2, np.nan]) + np.testing.assert_allclose(actual, [False, True, False]) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (point, False), + (line_string, False), + (linear_ring, True), + (empty, False), + ], +) +def test_is_closed(geometry, expected): + assert shapely.is_closed(geometry) == expected + + +def test_relate(): + p1 = shapely.points(0, 0) + p2 = shapely.points(1, 1) + actual = shapely.relate(p1, p2) + assert isinstance(actual, str) + assert actual == "FF0FFF0F2" + + +@pytest.mark.parametrize("g1, g2", [(point, None), (None, point), (None, None)]) +def test_relate_none(g1, g2): + assert shapely.relate(g1, g2) is None + + +def test_relate_pattern(): + g = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) + polygon = shapely.box(0, 0, 2, 2) + assert shapely.relate(g, polygon) == "11F00F212" + assert shapely.relate_pattern(g, polygon, "11F00F212") + assert shapely.relate_pattern(g, polygon, "*********") + assert not shapely.relate_pattern(g, polygon, "F********") + + +def test_relate_pattern_empty(): + with ignore_invalid(shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + assert shapely.relate_pattern(empty, empty, "*" * 9).item() is True + + +@pytest.mark.parametrize("g1, g2", [(point, None), (None, point), (None, None)]) +def test_relate_pattern_none(g1, g2): + assert shapely.relate_pattern(g1, g2, "*" * 9).item() is False + + +def test_relate_pattern_incorrect_length(): + with pytest.raises(shapely.GEOSException, match="Should be length 9"): + shapely.relate_pattern(point, polygon, "**") + + with pytest.raises(shapely.GEOSException, match="Should be length 9"): + shapely.relate_pattern(point, polygon, "**********") + + +@pytest.mark.parametrize("pattern", [b"*********", 10, None]) +def test_relate_pattern_non_string(pattern): + with pytest.raises(TypeError, match="expected string"): + shapely.relate_pattern(point, polygon, pattern) + + +def test_relate_pattern_non_scalar(): + with pytest.raises(ValueError, match="only supports scalar"): + shapely.relate_pattern([point] * 2, polygon, ["*********"] * 2) + + +@pytest.mark.skipif(shapely.geos_version < (3, 7, 0), reason="GEOS < 3.7") +@pytest.mark.parametrize( + "geom, expected", + [ + (LinearRing([(0, 0), (0, 1), (1, 1), (0, 0)]), False), + (LinearRing([(0, 0), (1, 1), (0, 1), (0, 0)]), True), + (LineString([(0, 0), (0, 1), (1, 1), (0, 0)]), False), + (LineString([(0, 0), (1, 1), (0, 1), (0, 0)]), True), + (LineString([(0, 0), (1, 1), (0, 1)]), False), + (LineString([(0, 0), (0, 1), (1, 1)]), False), + (point, False), + (polygon, False), + (geometry_collection, False), + (None, False), + ], +) +def test_is_ccw(geom, expected): + assert shapely.is_ccw(geom) == expected + + +def _prepare_with_copy(geometry): + """Prepare without modifying inplace""" + geometry = shapely.transform(geometry, lambda x: x) # makes a copy + shapely.prepare(geometry) + return geometry + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func", BINARY_PREPARED_PREDICATES) +def test_binary_prepared(a, func): + with ignore_invalid(shapely.is_empty(a) and shapely.geos_version < (3, 12, 0)): + # Empty geometries give 'invalid value encountered' in all predicates + # (see https://github.com/libgeos/geos/issues/515) + actual = func(a, point) + result = func(_prepare_with_copy(a), point) + assert actual == result + + +@pytest.mark.parametrize("geometry", all_types + (empty,)) +def test_is_prepared_true(geometry): + assert shapely.is_prepared(_prepare_with_copy(geometry)) + + +@pytest.mark.parametrize("geometry", all_types + (empty, None)) +def test_is_prepared_false(geometry): + assert not shapely.is_prepared(geometry) + + +def test_contains_properly(): + # polygon contains itself, but does not properly contains itself + assert shapely.contains(polygon, polygon).item() is True + assert shapely.contains_properly(polygon, polygon).item() is False diff --git a/shapely/python/shapely/tests/test_ragged_array.py b/shapely/python/shapely/tests/test_ragged_array.py new file mode 100644 index 0000000..2fbc2dc --- /dev/null +++ b/shapely/python/shapely/tests/test_ragged_array.py @@ -0,0 +1,362 @@ +import numpy as np +import pytest +from numpy.testing import assert_allclose + +import shapely +from shapely import MultiLineString, MultiPoint, MultiPolygon +from shapely.testing import assert_geometries_equal + +from .common import ( + empty_line_string, + empty_line_string_z, + geometry_collection, + line_string, + line_string_z, + linear_ring, + multi_line_string, + multi_line_string_z, + multi_point, + multi_point_z, + multi_polygon, + multi_polygon_z, + point, + point_z, + polygon, + polygon_z, +) + +all_types = ( + point, + line_string, + polygon, + multi_point, + multi_line_string, + multi_polygon, +) + +all_types_3d = ( + point_z, + line_string_z, + polygon_z, + multi_point_z, + multi_line_string_z, + multi_polygon_z, +) + +all_types_not_supported = ( + linear_ring, + geometry_collection, +) + + +@pytest.mark.parametrize("geom", all_types + all_types_3d) +def test_roundtrip(geom): + actual = shapely.from_ragged_array(*shapely.to_ragged_array([geom, geom])) + assert_geometries_equal(actual, [geom, geom]) + + +@pytest.mark.parametrize("geom", all_types) +def test_include_z(geom): + _, coords, _ = shapely.to_ragged_array([geom, geom], include_z=True) + # For 2D geoms, z coords are filled in with NaN + assert np.isnan(coords[:, 2]).all() + + +@pytest.mark.parametrize("geom", all_types_3d) +def test_include_z_false(geom): + _, coords, _ = shapely.to_ragged_array([geom, geom], include_z=False) + # For 3D geoms, z coords are dropped + assert coords.shape[1] == 2 + + +def test_include_z_default(): + # corner cases for inferring dimensionality + + # mixed 2D and 3D -> 3D + _, coords, _ = shapely.to_ragged_array([line_string, line_string_z]) + assert coords.shape[1] == 3 + + # only empties -> always 2D + _, coords, _ = shapely.to_ragged_array([empty_line_string]) + assert coords.shape[1] == 2 + _, coords, _ = shapely.to_ragged_array([empty_line_string_z]) + assert coords.shape[1] == 2 + # empty collection -> GEOS indicates 2D + _, coords, _ = shapely.to_ragged_array(shapely.from_wkt(["MULTIPOLYGON Z EMPTY"])) + assert coords.shape[1] == 2 + + +@pytest.mark.parametrize("geom", all_types_not_supported) +def test_raise_geometry_type(geom): + with pytest.raises(ValueError): + shapely.to_ragged_array([geom, geom]) + + +def test_points(): + arr = shapely.from_wkt( + [ + "POINT (0 0)", + "POINT (1 1)", + "POINT EMPTY", + "POINT EMPTY", + "POINT (4 4)", + "POINT EMPTY", + ] + ) + typ, result, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [[0, 0], [1, 1], [np.nan, np.nan], [np.nan, np.nan], [4, 4], [np.nan, np.nan]] + ) + assert typ == shapely.GeometryType.POINT + assert_allclose(result, expected) + assert len(offsets) == 0 + + geoms = shapely.from_ragged_array(typ, result) + assert_geometries_equal(geoms, arr) + + +def test_linestrings(): + arr = shapely.from_wkt( + [ + "LINESTRING (30 10, 10 30, 40 40)", + "LINESTRING (40 40, 30 30, 40 20, 30 10)", + "LINESTRING EMPTY", + "LINESTRING EMPTY", + "LINESTRING (10 10, 20 20, 10 40)", + "LINESTRING EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + [40.0, 40.0], + [30.0, 30.0], + [40.0, 20.0], + [30.0, 10.0], + [10.0, 10.0], + [20.0, 20.0], + [10.0, 40.0], + ] + ) + expected_offsets = np.array([0, 3, 7, 7, 7, 10, 10]) + assert typ == shapely.GeometryType.LINESTRING + assert_allclose(coords, expected) + assert len(offsets) == 1 + assert_allclose(offsets[0], expected_offsets) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_polygons(): + arr = shapely.from_wkt( + [ + "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))", + "POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))", + "POLYGON EMPTY", + "POLYGON EMPTY", + "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))", + "POLYGON EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [30.0, 10.0], + [40.0, 40.0], + [20.0, 40.0], + [10.0, 20.0], + [30.0, 10.0], + [35.0, 10.0], + [45.0, 45.0], + [15.0, 40.0], + [10.0, 20.0], + [35.0, 10.0], + [20.0, 30.0], + [35.0, 35.0], + [30.0, 20.0], + [20.0, 30.0], + [30.0, 10.0], + [40.0, 40.0], + [20.0, 40.0], + [10.0, 20.0], + [30.0, 10.0], + ] + ) + expected_offsets1 = np.array([0, 5, 10, 14, 19]) + expected_offsets2 = np.array([0, 1, 3, 3, 3, 4, 4]) + + assert typ == shapely.GeometryType.POLYGON + assert_allclose(coords, expected) + assert len(offsets) == 2 + assert_allclose(offsets[0], expected_offsets1) + assert_allclose(offsets[1], expected_offsets2) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_multipoints(): + arr = shapely.from_wkt( + [ + "MULTIPOINT (10 40, 40 30, 20 20, 30 10)", + "MULTIPOINT (30 10)", + "MULTIPOINT EMPTY", + "MULTIPOINT EMPTY", + "MULTIPOINT (30 10, 10 30, 40 40)", + "MULTIPOINT EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [10.0, 40.0], + [40.0, 30.0], + [20.0, 20.0], + [30.0, 10.0], + [30.0, 10.0], + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + ] + ) + expected_offsets = np.array([0, 4, 5, 5, 5, 8, 8]) + + assert typ == shapely.GeometryType.MULTIPOINT + assert_allclose(coords, expected) + assert len(offsets) == 1 + assert_allclose(offsets[0], expected_offsets) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_multilinestrings(): + arr = shapely.from_wkt( + [ + "MULTILINESTRING ((30 10, 10 30, 40 40))", + "MULTILINESTRING ((10 10, 20 20, 10 40),(40 40, 30 30, 40 20, 30 10))", + "MULTILINESTRING EMPTY", + "MULTILINESTRING EMPTY", + "MULTILINESTRING ((35 10, 45 45), (15 40, 10 20), (30 10, 10 30, 40 40))", + "MULTILINESTRING EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + [10.0, 10.0], + [20.0, 20.0], + [10.0, 40.0], + [40.0, 40.0], + [30.0, 30.0], + [40.0, 20.0], + [30.0, 10.0], + [35.0, 10.0], + [45.0, 45.0], + [15.0, 40.0], + [10.0, 20.0], + [30.0, 10.0], + [10.0, 30.0], + [40.0, 40.0], + ] + ) + expected_offsets1 = np.array([0, 3, 6, 10, 12, 14, 17]) + expected_offsets2 = np.array([0, 1, 3, 3, 3, 6, 6]) + + assert typ == shapely.GeometryType.MULTILINESTRING + assert_allclose(coords, expected) + assert len(offsets) == 2 + assert_allclose(offsets[0], expected_offsets1) + assert_allclose(offsets[1], expected_offsets2) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_multipolygons(): + arr = shapely.from_wkt( + [ + "MULTIPOLYGON (((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30)))", + "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)),((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30 20)))", + "MULTIPOLYGON EMPTY", + "MULTIPOLYGON EMPTY", + "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)))", + "MULTIPOLYGON EMPTY", + ] + ) + typ, coords, offsets = shapely.to_ragged_array(arr) + expected = np.array( + [ + [35.0, 10.0], + [45.0, 45.0], + [15.0, 40.0], + [10.0, 20.0], + [35.0, 10.0], + [20.0, 30.0], + [35.0, 35.0], + [30.0, 20.0], + [20.0, 30.0], + [40.0, 40.0], + [20.0, 45.0], + [45.0, 30.0], + [40.0, 40.0], + [20.0, 35.0], + [10.0, 30.0], + [10.0, 10.0], + [30.0, 5.0], + [45.0, 20.0], + [20.0, 35.0], + [30.0, 20.0], + [20.0, 15.0], + [20.0, 25.0], + [30.0, 20.0], + [40.0, 40.0], + [20.0, 45.0], + [45.0, 30.0], + [40.0, 40.0], + ] + ) + expected_offsets1 = np.array([0, 5, 9, 13, 19, 23, 27]) + expected_offsets2 = np.array([0, 2, 3, 5, 6]) + expected_offsets3 = np.array([0, 1, 3, 3, 3, 4, 4]) + + assert typ == shapely.GeometryType.MULTIPOLYGON + assert_allclose(coords, expected) + assert len(offsets) == 3 + assert_allclose(offsets[0], expected_offsets1) + assert_allclose(offsets[1], expected_offsets2) + assert_allclose(offsets[2], expected_offsets3) + + result = shapely.from_ragged_array(typ, coords, offsets) + assert_geometries_equal(result, arr) + + +def test_mixture_point_multipoint(): + typ, coords, offsets = shapely.to_ragged_array([point, multi_point]) + assert typ == shapely.GeometryType.MULTIPOINT + result = shapely.from_ragged_array(typ, coords, offsets) + expected = np.array([MultiPoint([point]), multi_point]) + assert_geometries_equal(result, expected) + + +def test_mixture_linestring_multilinestring(): + typ, coords, offsets = shapely.to_ragged_array([line_string, multi_line_string]) + assert typ == shapely.GeometryType.MULTILINESTRING + result = shapely.from_ragged_array(typ, coords, offsets) + expected = np.array([MultiLineString([line_string]), multi_line_string]) + assert_geometries_equal(result, expected) + + +def test_mixture_polygon_multipolygon(): + typ, coords, offsets = shapely.to_ragged_array([polygon, multi_polygon]) + assert typ == shapely.GeometryType.MULTIPOLYGON + result = shapely.from_ragged_array(typ, coords, offsets) + expected = np.array([MultiPolygon([polygon]), multi_polygon]) + assert_geometries_equal(result, expected) diff --git a/shapely/python/shapely/tests/test_set_operations.py b/shapely/python/shapely/tests/test_set_operations.py new file mode 100644 index 0000000..c4bdb7e --- /dev/null +++ b/shapely/python/shapely/tests/test_set_operations.py @@ -0,0 +1,411 @@ +import numpy as np +import pytest + +import shapely +from shapely import Geometry, GeometryCollection, Polygon +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import all_types, empty, geometry_collection, multi_polygon, point, polygon + +# fixed-precision operations raise GEOS exceptions on mixed dimension geometry collections +all_single_types = [g for g in all_types if not shapely.get_type_id(g) == 7] + +SET_OPERATIONS = ( + shapely.difference, + shapely.intersection, + shapely.symmetric_difference, + shapely.union, + # shapely.coverage_union is tested seperately +) + +REDUCE_SET_OPERATIONS = ( + (shapely.intersection_all, shapely.intersection), + (shapely.symmetric_difference_all, shapely.symmetric_difference), + (shapely.union_all, shapely.union), + # shapely.coverage_union_all, shapely.coverage_union) is tested seperately +) + +# operations that support fixed precision +REDUCE_SET_OPERATIONS_PREC = ((shapely.union_all, shapely.union),) + + +reduce_test_data = [ + shapely.box(0, 0, 5, 5), + shapely.box(2, 2, 7, 7), + shapely.box(4, 4, 9, 9), + shapely.box(5, 5, 10, 10), +] + +non_polygon_types = [ + geom + for geom in all_types + if (not shapely.is_empty(geom) and geom not in (polygon, multi_polygon)) +] + + +@pytest.mark.parametrize("a", all_types) +@pytest.mark.parametrize("func", SET_OPERATIONS) +def test_set_operation_array(request, a, func): + if ( + func == shapely.difference + and a == geometry_collection + and shapely.geos_version >= (3, 12, 0) + ): + request.node.add_marker( + pytest.mark.xfail(reason="https://github.com/libgeos/geos/issues/797") + ) + actual = func(a, point) + assert isinstance(actual, Geometry) + + actual = func([a, a], point) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + +@pytest.mark.skipif(shapely.geos_version >= (3, 9, 0), reason="GEOS >= 3.9") +@pytest.mark.parametrize("func", SET_OPERATIONS) +@pytest.mark.parametrize("grid_size", [0, 1]) +def test_set_operations_prec_not_supported(func, grid_size): + with pytest.raises( + UnsupportedGEOSVersionError, match="grid_size parameter requires GEOS >= 3.9.0" + ): + func(point, point, grid_size) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func", SET_OPERATIONS) +def test_set_operation_prec_nonscalar_grid_size(func): + with pytest.raises( + ValueError, match="grid_size parameter only accepts scalar values" + ): + func(point, point, grid_size=[1]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("a", all_single_types) +@pytest.mark.parametrize("func", SET_OPERATIONS) +@pytest.mark.parametrize("grid_size", [0, 1, 2]) +def test_set_operation_prec_array(a, func, grid_size): + actual = func([a, a], point, grid_size=grid_size) + assert actual.shape == (2,) + assert isinstance(actual[0], Geometry) + + # results should match the operation when the precision is previously set + # to same grid_size + b = shapely.set_precision(a, grid_size=grid_size) + point2 = shapely.set_precision(point, grid_size=grid_size) + expected = func([b, b], point2) + + assert shapely.equals(shapely.normalize(actual), shapely.normalize(expected)).all() + + +@pytest.mark.parametrize("n", range(1, 5)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_1dim(n, func, related_func): + actual = func(reduce_test_data[:n]) + # perform the reduction in a python loop and compare + expected = reduce_test_data[0] + for i in range(1, n): + expected = related_func(expected, reduce_test_data[i]) + assert shapely.equals(actual, expected) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_single_geom(func, related_func): + geom = shapely.Point(1, 1) + actual = func([geom, None, None]) + assert shapely.equals(actual, geom) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_axis(func, related_func): + data = [[point] * 2] * 3 # shape = (3, 2) + actual = func(data, axis=None) # default + assert isinstance(actual, Geometry) # scalar output + actual = func(data, axis=0) + assert actual.shape == (2,) + actual = func(data, axis=1) + assert actual.shape == (3,) + actual = func(data, axis=-1) + assert actual.shape == (3,) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_empty(func, related_func): + assert func(np.empty((0,), dtype=object)) == empty + arr_empty_2D = np.empty((0, 2), dtype=object) + assert func(arr_empty_2D) == empty + assert func(arr_empty_2D, axis=0).tolist() == [empty] * 2 + assert func(arr_empty_2D, axis=1).tolist() == [] + + +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_one_none(func, related_func, none_position): + # API change: before, intersection_all and symmetric_difference_all returned + # None if any input geometry was None. + # The new behaviour is to ignore None values. + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + actual = func(test_data) + expected = related_func(reduce_test_data[0], reduce_test_data[1]) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_two_none(func, related_func, none_position): + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + test_data.insert(none_position, None) + actual = func(test_data) + expected = related_func(reduce_test_data[0], reduce_test_data[1]) + assert_geometries_equal(actual, expected) + + +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_some_none_len2(func, related_func): + # in a previous implementation, this would take a different code path + # and return wrong result + assert func([empty, None]) == empty + + +@pytest.mark.parametrize("n", range(1, 3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_all_none(n, func, related_func): + assert_geometries_equal(func([None] * n), GeometryCollection([])) + + +@pytest.mark.parametrize("n", range(1, 3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS) +def test_set_operation_reduce_all_none_arr(n, func, related_func): + assert func([[None] * n] * 2, axis=1).tolist() == [empty, empty] + assert func([[None] * 2] * n, axis=0).tolist() == [empty, empty] + + +@pytest.mark.skipif(shapely.geos_version >= (3, 9, 0), reason="GEOS >= 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +@pytest.mark.parametrize("grid_size", [0, 1]) +def test_set_operation_prec_reduce_not_supported(func, related_func, grid_size): + with pytest.raises( + UnsupportedGEOSVersionError, match="grid_size parameter requires GEOS >= 3.9.0" + ): + func([point, point], grid_size) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_nonscalar_grid_size(func, related_func): + with pytest.raises( + ValueError, match="grid_size parameter only accepts scalar values" + ): + func([point, point], grid_size=[1]) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_grid_size_nan(func, related_func): + actual = func([point, point], grid_size=np.nan) + assert actual is None + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("n", range(1, 5)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +@pytest.mark.parametrize("grid_size", [0, 1]) +def test_set_operation_prec_reduce_1dim(n, func, related_func, grid_size): + actual = func(reduce_test_data[:n], grid_size=grid_size) + # perform the reduction in a python loop and compare + expected = reduce_test_data[0] + for i in range(1, n): + expected = related_func(expected, reduce_test_data[i], grid_size=grid_size) + + assert shapely.equals(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_axis(func, related_func): + data = [[point] * 2] * 3 # shape = (3, 2) + actual = func(data, grid_size=1, axis=None) # default + assert isinstance(actual, Geometry) # scalar output + actual = func(data, grid_size=1, axis=0) + assert actual.shape == (2,) + actual = func(data, grid_size=1, axis=1) + assert actual.shape == (3,) + actual = func(data, grid_size=1, axis=-1) + assert actual.shape == (3,) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_one_none(func, related_func, none_position): + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + actual = func(test_data, grid_size=1) + expected = related_func(reduce_test_data[0], reduce_test_data[1], grid_size=1) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("none_position", range(3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_two_none(func, related_func, none_position): + test_data = reduce_test_data[:2] + test_data.insert(none_position, None) + test_data.insert(none_position, None) + actual = func(test_data, grid_size=1) + expected = related_func(reduce_test_data[0], reduce_test_data[1], grid_size=1) + assert_geometries_equal(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize("n", range(1, 3)) +@pytest.mark.parametrize("func, related_func", REDUCE_SET_OPERATIONS_PREC) +def test_set_operation_prec_reduce_all_none(n, func, related_func): + assert_geometries_equal(func([None] * n, grid_size=1), GeometryCollection([])) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize("n", range(1, 4)) +def test_coverage_union_reduce_1dim(n): + """ + This is tested seperately from other set operations as it differs in two ways: + 1. It expects only non-overlapping polygons + 2. It expects GEOS 3.8.0+ + """ + test_data = [ + shapely.box(0, 0, 1, 1), + shapely.box(1, 0, 2, 1), + shapely.box(2, 0, 3, 1), + ] + actual = shapely.coverage_union_all(test_data[:n]) + # perform the reduction in a python loop and compare + expected = test_data[0] + for i in range(1, n): + expected = shapely.coverage_union(expected, test_data[i]) + assert_geometries_equal(actual, expected, normalize=True) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_coverage_union_reduce_axis(): + # shape = (3, 2), all polygons - none of them overlapping + data = [[shapely.box(i, j, i + 1, j + 1) for i in range(2)] for j in range(3)] + actual = shapely.coverage_union_all(data, axis=None) # default + assert isinstance(actual, Geometry) + actual = shapely.coverage_union_all(data, axis=0) + assert actual.shape == (2,) + actual = shapely.coverage_union_all(data, axis=1) + assert actual.shape == (3,) + actual = shapely.coverage_union_all(data, axis=-1) + assert actual.shape == (3,) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +def test_coverage_union_overlapping_inputs(): + polygon = Polygon([(1, 1), (1, 0), (0, 0), (0, 1), (1, 1)]) + + # Overlapping polygons raise an error + with pytest.raises( + shapely.GEOSException, + match="CoverageUnion cannot process incorrectly noded inputs.", + ): + shapely.coverage_union( + polygon, Polygon([(1, 0), (0.9, 1), (2, 1), (2, 0), (1, 0)]) + ) + + +@pytest.mark.skipif(shapely.geos_version < (3, 8, 0), reason="GEOS < 3.8") +@pytest.mark.parametrize( + "geom_1, geom_2", + # All possible polygon, non_polygon combinations + [[polygon, non_polygon] for non_polygon in non_polygon_types] + # All possible non_polygon, non_polygon combinations + + [ + [non_polygon_1, non_polygon_2] + for non_polygon_1 in non_polygon_types + for non_polygon_2 in non_polygon_types + ], +) +def test_coverage_union_non_polygon_inputs(geom_1, geom_2): + # Non polygon geometries raise an error + with pytest.raises( + shapely.GEOSException, match="Unhandled geometry type in CoverageUnion." + ): + shapely.coverage_union(geom_1, geom_2) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +@pytest.mark.parametrize( + "geom,grid_size,expected", + [ + # floating point precision, expect no change + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 0, + Polygon( + ( + (0, 0.2), + (0, 10), + (5.1, 10), + (5.1, 0.2), + (5, 0.2), + (5, 0.1), + (0.1, 0.1), + (0.1, 0.2), + (0, 0.2), + ) + ), + ), + # grid_size is at effective precision, expect no change + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 0.1, + Polygon( + ( + (0, 0.2), + (0, 10), + (5.1, 10), + (5.1, 0.2), + (5, 0.2), + (5, 0.1), + (0.1, 0.1), + (0.1, 0.2), + (0, 0.2), + ) + ), + ), + # grid_size forces rounding to nearest integer + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 1, + Polygon([(0, 5), (0, 10), (5, 10), (5, 5), (5, 0), (0, 0), (0, 5)]), + ), + # grid_size much larger than effective precision causes rounding to nearest + # multiple of 10 + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 10, + Polygon([(0, 10), (10, 10), (10, 0), (0, 0), (0, 10)]), + ), + # grid_size is so large that polygons collapse to empty + ( + [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)], + 100, + Polygon(), + ), + ], +) +def test_union_all_prec(geom, grid_size, expected): + actual = shapely.union_all(geom, grid_size=grid_size) + assert shapely.equals(actual, expected) + + +@pytest.mark.skipif(shapely.geos_version < (3, 9, 0), reason="GEOS < 3.9") +def test_uary_union_alias(): + geoms = [shapely.box(0.1, 0.1, 5, 5), shapely.box(0, 0.2, 5.1, 10)] + actual = shapely.unary_union(geoms, grid_size=1) + expected = shapely.union_all(geoms, grid_size=1) + assert shapely.equals(actual, expected) diff --git a/shapely/python/shapely/tests/test_strtree.py b/shapely/python/shapely/tests/test_strtree.py new file mode 100644 index 0000000..5769ed2 --- /dev/null +++ b/shapely/python/shapely/tests/test_strtree.py @@ -0,0 +1,1967 @@ +import itertools +import math +import pickle +import subprocess +import sys +from concurrent.futures import ThreadPoolExecutor + +import numpy as np +import pytest +from numpy.testing import assert_array_equal + +import shapely +from shapely import box, geos_version, MultiPoint, Point, STRtree +from shapely.errors import UnsupportedGEOSVersionError +from shapely.testing import assert_geometries_equal + +from .common import empty, empty_line_string, empty_point, point + +# the distance between 2 points spaced at whole numbers along a diagonal +HALF_UNIT_DIAG = math.sqrt(2) / 2 +EPS = 1e-9 + + +@pytest.fixture(scope="session") +def tree(): + geoms = shapely.points(np.arange(10), np.arange(10)) + yield STRtree(geoms) + + +@pytest.fixture(scope="session") +def line_tree(): + x = np.arange(10) + y = np.arange(10) + offset = 1 + geoms = shapely.linestrings(np.array([[x, x + offset], [y, y + offset]]).T) + yield STRtree(geoms) + + +@pytest.fixture(scope="session") +def poly_tree(): + # create buffers so that midpoint between two buffers intersects + # each buffer. NOTE: add EPS to help mitigate rounding errors at midpoint. + geoms = shapely.buffer( + shapely.points(np.arange(10), np.arange(10)), HALF_UNIT_DIAG + EPS, quad_segs=32 + ) + yield STRtree(geoms) + + +@pytest.mark.parametrize( + "geometry,count, hits", + [ + # Empty array produces empty tree + ([], 0, 0), + ([point], 1, 1), + # None geometries are ignored when creating tree + ([None], 0, 0), + ([point, None], 1, 1), + # empty geometries are ignored when creating tree + ([empty, empty_point, empty_line_string], 0, 0), + # only the valid geometry should have a hit + ([empty, point, empty_point, empty_line_string], 1, 1), + ], +) +def test_init(geometry, count, hits): + tree = STRtree(geometry) + assert len(tree) == count + assert tree.query(box(0, 0, 100, 100)).size == hits + + +def test_init_with_invalid_geometry(): + with pytest.raises(TypeError): + STRtree(["Not a geometry"]) + + +def test_references(): + point1 = Point() + point2 = Point(0, 1) + + geoms = [point1, point2] + tree = STRtree(geoms) + + point1 = None + point2 = None + + import gc + + gc.collect() + + # query after freeing geometries does not lead to segfault + assert tree.query(box(0, 0, 1, 1)).tolist() == [1] + + +def test_flush_geometries(): + arr = shapely.points(np.arange(10), np.arange(10)) + tree = STRtree(arr) + + # Dereference geometries + arr[:] = None + import gc + + gc.collect() + # Still it does not lead to a segfault + tree.query(point) + + +def test_geometries_property(): + arr = np.array([point]) + tree = STRtree(arr) + assert_geometries_equal(arr, tree.geometries) + + # modifying elements of input should not modify tree.geometries + arr[0] = shapely.Point(0, 0) + assert_geometries_equal(point, tree.geometries[0]) + + +# TODO(shapely-2.0) this fails on Appveyor, see +# https://github.com/shapely/shapely/pull/983#issuecomment-718557666 +@pytest.mark.skipif(sys.platform.startswith("win32"), reason="does not run on Appveyor") +def test_pickle_persistence(tmp_path): + # write the pickeled tree to another process; the process should not crash + tree = STRtree([Point(i, i).buffer(0.1) for i in range(3)]) + + pickled_strtree = pickle.dumps(tree) + unpickle_script = """ +import pickle +import sys + +from shapely import Point, geos_version + +pickled_strtree = sys.stdin.buffer.read() +print("received pickled strtree:", repr(pickled_strtree)) +tree = pickle.loads(pickled_strtree) + +tree.query(Point(0, 0)) +if geos_version >= (3, 6, 0): + tree.nearest(Point(0, 0)) +print("done") +""" + + filename = tmp_path / "unpickle-strtree.py" + with open(filename, "w") as out: + out.write(unpickle_script) + + proc = subprocess.Popen( + [sys.executable, str(filename)], + stdin=subprocess.PIPE, + ) + proc.communicate(input=pickled_strtree) + proc.wait() + assert proc.returncode == 0 + + +@pytest.mark.parametrize( + "geometry", + [ + "I am not a geometry", + ["I am not a geometry"], + [Point(0, 0), "still not a geometry"], + [[], "in a mixed array", 1], + ], +) +@pytest.mark.filterwarnings("ignore:Creating an ndarray from ragged nested sequences:") +def test_query_invalid_geometry(tree, geometry): + with pytest.raises((TypeError, ValueError)): + tree.query(geometry) + + +def test_query_invalid_dimension(tree): + with pytest.raises(TypeError, match="Array should be one dimensional"): + tree.query([[Point(0.5, 0.5)]]) + + +@pytest.mark.parametrize( + "tree_geometry, geometry,expected", + [ + # Empty tree returns no results + ([], point, []), + ([], [point], [[], []]), + ([], None, []), + ([], [None], [[], []]), + # Tree with only None returns no results + ([None], point, []), + ([None], [point], [[], []]), + ([None], None, []), + ([None], [None], [[], []]), + # querying with None returns no results + ([point], None, []), + ([point], [None], [[], []]), + # Empty is included in the tree, but ignored when querying the tree + ([empty], empty, []), + ([empty], [empty], [[], []]), + ([empty], point, []), + ([empty], [point], [[], []]), + ([point, empty], empty, []), + ([point, empty], [empty], [[], []]), + # None and empty are ignored in the tree, but the index of the valid + # geometry should be retained. + ([None, point], box(0, 0, 10, 10), [1]), + ([None, point], [box(0, 0, 10, 10)], [[0], [1]]), + ([None, empty, point], box(0, 0, 10, 10), [2]), + ([point, None, point], box(0, 0, 10, 10), [0, 2]), + ([point, None, point], [box(0, 0, 10, 10)], [[0, 0], [0, 2]]), + # Only the non-empty query geometry gets hits + ([empty, point], [empty, point], [[1], [1]]), + ( + [empty, empty_point, empty_line_string, point], + [empty, empty_point, empty_line_string, point], + [[3], [3]], + ), + ], +) +def test_query_with_none_and_empty(tree_geometry, geometry, expected): + tree = STRtree(tree_geometry) + assert_array_equal(tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # first and last points intersect + ( + [Point(1, 1), Point(-1, -1), Point(2, 2)], + [[0, 2], [1, 2]], + ), + # box contains points + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # bigger box contains more points + (box(5, 5, 15, 15), [5, 6, 7, 8, 9]), + ([box(5, 5, 15, 15)], [[0, 0, 0, 0, 0], [5, 6, 7, 8, 9]]), + # first and last boxes contains points + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(5, 5, 15, 15)], + [[0, 0, 2, 2, 2, 2, 2], [0, 1, 5, 6, 7, 8, 9]], + ), + # envelope of buffer contains points + (shapely.buffer(Point(3, 3), 1), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 1)], [[0, 0, 0], [2, 3, 4]]), + # envelope of points contains points + (MultiPoint([[5, 7], [7, 5]]), [5, 6, 7]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0, 0], [5, 6, 7]]), + ], +) +def test_query_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + # point at shared vertex between 2 lines + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # box overlaps envelope of first 2 lines (touches edge of 1) + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # envelope of buffer overlaps envelope of 2 lines + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # envelope of points overlaps 5 lines (touches edge of 2 envelopes) + (MultiPoint([[5, 7], [7, 5]]), [4, 5, 6, 7]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0, 0, 0], [4, 5, 6, 7]]), + ], +) +def test_query_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects edge of envelopes of 2 polygons + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # point intersects single polygon + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box overlaps envelope of 2 polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # larger box overlaps envelope of 3 polygons + (box(0, 0, 1.5, 1.5), [0, 1, 2]), + ([box(0, 0, 1.5, 1.5)], [[0, 0, 0], [0, 1, 2]]), + # first and last boxes overlap envelope of 2 polyons + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(2, 2, 3, 3)], + [[0, 0, 2, 2], [0, 1, 2, 3]], + ), + # envelope of buffer overlaps envelope of 3 polygons + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + ( + [shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], + [[0, 0, 0], [2, 3, 4]], + ), + # envelope of larger buffer overlaps envelope of 6 polygons + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [1, 2, 3, 4, 5]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0, 0, 0], [1, 2, 3, 4, 5]], + ), + # envelope of points overlaps 3 polygons + (MultiPoint([[5, 7], [7, 5]]), [5, 6, 7]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0, 0], [5, 6, 7]]), + ], +) +def test_query_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry), expected) + + +@pytest.mark.parametrize( + "predicate", + [ + "bad_predicate", + # disjoint is a valid GEOS binary predicate, but not supported for query + "disjoint", + ], +) +def test_query_invalid_predicate(tree, predicate): + with pytest.raises(ValueError, match="is not a valid option"): + tree.query(Point(1, 1), predicate=predicate) + + +@pytest.mark.parametrize( + "predicate,expected", + [ + ("intersects", [0, 1, 2]), + ("within", []), + ("contains", [1]), + ("overlaps", []), + ("crosses", []), + ("covers", [0, 1, 2]), + ("covered_by", []), + ("contains_properly", [1]), + ], +) +def test_query_prepared_inputs(tree, predicate, expected): + geom = box(0, 0, 2, 2) + shapely.prepare(geom) + assert_array_equal(tree.query(geom, predicate=predicate), expected) + + +def test_query_with_partially_prepared_inputs(tree): + geom = np.array([box(0, 0, 1, 1), box(3, 3, 5, 5)]) + expected = tree.query(geom, predicate="intersects") + + # test with array of partially prepared geometries + shapely.prepare(geom[0]) + assert_array_equal(expected, tree.query(geom, predicate="intersects")) + + +@pytest.mark.parametrize( + "predicate", + [ + # intersects is intentionally omitted; it does not raise an exception + pytest.param( + "within", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + pytest.param( + "contains", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + "overlaps", + "crosses", + "touches", + pytest.param( + "covers", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + pytest.param( + "covered_by", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + pytest.param( + "contains_properly", + marks=pytest.mark.xfail(geos_version < (3, 8, 0), reason="GEOS < 3.8"), + ), + ], +) +def test_query_predicate_errors(tree, predicate): + with pytest.raises(shapely.GEOSException): + tree.query(shapely.linestrings([1, 1], [1, float("nan")]), predicate=predicate) + + +### predicate == 'intersects' + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box contains points + (box(3, 3, 6, 6), [3, 4, 5, 6]), + ([box(3, 3, 6, 6)], [[0, 0, 0, 0], [3, 4, 5, 6]]), + # first and last boxes contain points + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(3, 3, 6, 6)], + [[0, 0, 2, 2, 2, 2], [0, 1, 3, 4, 5, 6]], + ), + # envelope of buffer contains more points than intersect buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0], [2, 3, 4]], + ), + # multipoints intersect + ( + MultiPoint([[5, 5], [7, 7]]), + [5, 7], + ), + ( + [MultiPoint([[5, 5], [7, 7]])], + [[0, 0], [5, 7]], + ), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + ( + MultiPoint([[5, 7], [7, 7]]), + [7], + ), + ( + [MultiPoint([[5, 7], [7, 7]])], + [[0], [7]], + ), + ], +) +def test_query_intersects_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="intersects"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line but does not intersect + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point at shared vertex between 2 lines + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # box overlaps envelope of first 2 lines (touches edge of 1) + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # first and last boxes overlap multiple lines each + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(2, 2, 3, 3)], + [[0, 0, 2, 2, 2], [0, 1, 1, 2, 3]], + ), + # buffer intersects 2 lines + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # buffer intersects midpoint of line at tangent + (shapely.buffer(Point(2, 1), HALF_UNIT_DIAG), [1]), + ([shapely.buffer(Point(2, 1), HALF_UNIT_DIAG)], [[0], [1]]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [6, 7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0, 0], [6, 7]]), + ], +) +def test_query_intersects_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="intersects"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + (Point(0.5, 0), [0]), + ([Point(0.5, 0)], [[0], [0]]), + # midpoint between two polygons intersects both + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # point intersects single polygon + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box overlaps envelope of 2 polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # larger box intersects 3 polygons + (box(0, 0, 1.5, 1.5), [0, 1, 2]), + ([box(0, 0, 1.5, 1.5)], [[0, 0, 0], [0, 1, 2]]), + # first and last boxes overlap + ( + [box(0, 0, 1, 1), box(100, 100, 110, 110), box(2, 2, 3, 3)], + [[0, 0, 2, 2], [0, 1, 2, 3]], + ), + # buffer overlaps 3 polygons + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + ( + [shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], + [[0, 0, 0], [2, 3, 4]], + ), + # larger buffer overlaps 6 polygons (touches midpoints) + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [1, 2, 3, 4, 5]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0, 0, 0], [1, 2, 3, 4, 5]], + ), + # envelope of points overlaps polygons, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint within polygon + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_intersects_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="intersects"), expected) + + +### predicate == 'within' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box not within points + (box(3, 3, 6, 6), []), + ([box(3, 3, 6, 6)], [[], []]), + # envelope of buffer not within points + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # multipoints intersect but are not within points in tree + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + # only one point of multipoint intersects, but multipoints are not + # within any points in tree + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_within_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="within"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # endpoint not within first line + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # point within first line + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line but does not intersect + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point at shared vertex between 2 lines (but within neither) + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + # box not within line + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # buffer intersects 2 lines but not within either + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects, but both are not within line + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + (MultiPoint([[6.5, 6.5], [7, 7]]), [6]), + ([MultiPoint([[6.5, 6.5], [7, 7]])], [[0], [6]]), + ], +) +def test_query_within_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="within"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + (Point(0.5, 0), [0]), + ([Point(0.5, 0)], [[0], [0]]), + # midpoint between two polygons intersects both + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # point intersects single polygon + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box overlaps envelope of 2 polygons but within neither + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # box within polygon + (box(0, 0, 0.5, 0.5), [0]), + ([box(0, 0, 0.5, 0.5)], [[0], [0]]), + # larger box intersects 3 polygons but within none + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer intersects 3 polygons but only within one + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0], [3]]), + # larger buffer overlaps 6 polygons (touches midpoints) but within none + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[], []]), + # envelope of points overlaps polygons, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint within polygon + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points in multipoint within polygon + (MultiPoint([[5.25, 5.5], [5.25, 5.0]]), [5]), + ([MultiPoint([[5.25, 5.5], [5.25, 5.0]])], [[0], [5]]), + ], +) +def test_query_within_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="within"), expected) + + +### predicate == 'contains' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box contains points (2 are at edges and not contained) + (box(3, 3, 6, 6), [4, 5]), + ([box(3, 3, 6, 6)], [[0, 0], [4, 5]]), + # envelope of buffer contains more points than within buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # multipoints intersect + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_contains_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="contains"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not contain any lines (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box contains first line (touches edge of 1 but does not contain it) + (box(0, 0, 1, 1), [0]), + ([box(0, 0, 1, 1)], [[0], [0]]), + # buffer intersects 2 lines but contains neither + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points intersect but do not contain any lines (not valid relation) + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + ], +) +def test_query_contains_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="contains"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not contain any polygons (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps envelope of 2 polygons but contains neither + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # larger box intersects 3 polygons but contains only one + (box(0, 0, 2, 2), [1]), + ([box(0, 0, 2, 2)], [[0], [1]]), + # buffer overlaps 3 polygons but contains none + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # larger buffer overlaps 6 polygons (touches midpoints) but contains one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0], [3]]), + # envelope of points overlaps polygons, but points do not intersect + # (not valid relation) + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_contains_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="contains"), expected) + + +### predicate == 'overlaps' +# Overlaps only returns results where geometries are of same dimensions +# and do not completely contain each other. +# See: https://postgis.net/docs/ST_Overlaps.html +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect but do not overlap + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + # box overlaps points including those at edge but does not overlap + # (completely contains all points) + (box(3, 3, 6, 6), []), + ([box(3, 3, 6, 6)], [[], []]), + # envelope of buffer contains points, but does not overlap + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # multipoints intersect but do not overlap (both completely contain each other) + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + # envelope of points contains points in tree, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects but does not overlap + # the intersecting point from multipoint completely contains point in tree + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + ], +) +def test_query_overlaps_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="overlaps"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects line but is completely contained by it + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps second line (contains first line) + # but of different dimensions so does not overlap + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer intersects 2 lines but of different dimensions so does not overlap + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points intersect but different dimensions + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + ], +) +def test_query_overlaps_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="overlaps"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not overlap any polygons (different dimensions) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps 2 polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # larger box intersects 3 polygons and contains one + (box(0, 0, 2, 2), [0, 2]), + ([box(0, 0, 2, 2)], [[0, 0], [0, 2]]), + # buffer overlaps 3 polygons and contains 1 + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 4]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0, 0], [2, 4]]), + # larger buffer overlaps 6 polygons (touches midpoints) but contains one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [1, 2, 4, 5]), + ( + [shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], + [[0, 0, 0, 0], [1, 2, 4, 5]], + ), + # one of two points intersects but different dimensions + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + ], +) +def test_query_overlaps_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="overlaps"), expected) + + +### predicate == 'crosses' +# Only valid for certain geometry combinations +# See: https://postgis.net/docs/ST_Crosses.html +@pytest.mark.parametrize( + "geometry,expected", + [ + # points intersect but not valid relation + (Point(1, 1), []), + # all points of result from tree are in common with box + (box(3, 3, 6, 6), []), + # all points of result from tree are in common with buffer + (shapely.buffer(Point(3, 3), 1), []), + # only one point of multipoint intersects but not valid relation + (MultiPoint([[5, 7], [7, 7]]), []), + ], +) +def test_query_crosses_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="crosses"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line but is completely in common with line + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps envelope of first 2 lines, contains first and crosses second + (box(0, 0, 1.5, 1.5), [1]), + ([box(0, 0, 1.5, 1.5)], [[0], [1]]), + # buffer intersects 2 lines + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # line crosses line + (shapely.linestrings([(1, 0), (0, 1)]), [0]), + ([shapely.linestrings([(1, 0), (0, 1)])], [[0], [0]]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7], [7, 8]]), []), + ([MultiPoint([[5, 7], [7, 7], [7, 8]])], [[], []]), + ], +) +def test_query_crosses_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="crosses"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon but not valid relation + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # box overlaps 2 polygons but not valid relation + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer overlaps 3 polygons but not valid relation + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # only one point of multipoint within + (MultiPoint([[5, 7], [7, 7], [7, 8]]), [7]), + ([MultiPoint([[5, 7], [7, 7], [7, 8]])], [[0], [7]]), + ], +) +def test_query_crosses_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="crosses"), expected) + + +### predicate == 'touches' +# See: https://postgis.net/docs/ST_Touches.html +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect but not valid relation + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + # box contains points but touches only those at edges + (box(3, 3, 6, 6), [3, 6]), + ([box(3, 3, 6, 6)], [[0, 0], [3, 6]]), + # buffer completely contains point in tree + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # buffer intersects 2 points but touches only one + (shapely.buffer(Point(0, 1), 1), [1]), + ([shapely.buffer(Point(0, 1), 1)], [[0], [1]]), + # multipoints intersect but not valid relation + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + ], +) +def test_query_touches_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="touches"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point intersects first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + # point is within line + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # point at shared vertex between 2 lines + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # box overlaps envelope of first 2 lines (touches edge of 1) + (box(0, 0, 1, 1), [1]), + ([box(0, 0, 1, 1)], [[0], [1]]), + # buffer intersects 2 lines but does not touch edges of either + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # buffer intersects midpoint of line at tangent but there is a little overlap + # due to precision issues + (shapely.buffer(Point(2, 1), HALF_UNIT_DIAG + 1e-7), []), + ([shapely.buffer(Point(2, 1), HALF_UNIT_DIAG + 1e-7)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects at vertex between lines + (MultiPoint([[5, 7], [7, 7], [7, 8]]), [6, 7]), + ([MultiPoint([[5, 7], [7, 7], [7, 8]])], [[0, 0], [6, 7]]), + ], +) +def test_query_touches_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="touches"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point within first polygon + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point is at edge of first polygon + (Point(HALF_UNIT_DIAG + EPS, 0), [0]), + ([Point(HALF_UNIT_DIAG + EPS, 0)], [[0], [0]]), + # box overlaps envelope of 2 polygons does not touch any at edge + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # box overlaps 2 polygons and touches edge of first + (box(HALF_UNIT_DIAG + EPS, 0, 2, 2), [0]), + ([box(HALF_UNIT_DIAG + EPS, 0, 2, 2)], [[0], [0]]), + # buffer overlaps 3 polygons but does not touch any at edge + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG + EPS), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG + EPS)], [[], []]), + # only one point of multipoint within polygon but does not touch + (MultiPoint([[0, 0], [7, 7], [7, 8]]), []), + ([MultiPoint([[0, 0], [7, 7], [7, 8]])], [[], []]), + ], +) +def test_query_touches_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="touches"), expected) + + +### predicate == 'covers' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect and thus no point is outside the other + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box covers any points that intersect or are within + (box(3, 3, 6, 6), [3, 4, 5, 6]), + ([box(3, 3, 6, 6)], [[0, 0, 0, 0], [3, 4, 5, 6]]), + # envelope of buffer covers more points than are covered by buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # multipoints intersect and thus no point is outside the other + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_covers_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="covers"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not cover any lines (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box covers first line (intersects another does not contain it) + (box(0, 0, 1.5, 1.5), [0]), + ([box(0, 0, 1.5, 1.5)], [[0], [0]]), + # box completely covers 2 lines (touches edges of 2 others) + (box(1, 1, 3, 3), [1, 2]), + ([box(1, 1, 3, 3)], [[0, 0], [1, 2]]), + # buffer intersects 2 lines but does not completely cover either + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects a line, but does not completely cover it + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points intersect but do not cover any lines (not valid relation) + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + ], +) +def test_query_covers_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="covers"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not cover any polygons (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # box overlaps envelope of 2 polygons but does not completely cover either + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # larger box intersects 3 polygons but covers only one + (box(0, 0, 2, 2), [1]), + ([box(0, 0, 2, 2)], [[0], [1]]), + # buffer overlaps 3 polygons but does not completely cover any + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # larger buffer overlaps 6 polygons (touches midpoints) but covers only one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0], [3]]), + # envelope of points overlaps polygons, but points do not intersect + # (not valid relation) + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_covers_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="covers"), expected) + + +### predicate == 'covered_by' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # box not covered by points + (box(3, 3, 6, 6), []), + ([box(3, 3, 6, 6)], [[], []]), + # envelope of buffer not covered by points + (shapely.buffer(Point(3, 3), 1), []), + ([shapely.buffer(Point(3, 3), 1)], [[], []]), + # multipoints intersect but are not covered by points in tree + (MultiPoint([[5, 5], [7, 7]]), []), + ([MultiPoint([[5, 5], [7, 7]])], [[], []]), + # only one point of multipoint intersects, but multipoints are not + # covered by any points in tree + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # envelope of points overlaps points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_covered_by_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="covered_by"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # endpoint is covered by first line + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + # point covered by first line + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # point within envelope of first line but does not intersect + (Point(0, 0.5), []), + ([Point(0, 0.5)], [[], []]), + # point at shared vertex between 2 lines and is covered by both + (Point(1, 1), [0, 1]), + ([Point(1, 1)], [[0, 0], [0, 1]]), + # line intersects 3 lines, but is covered by only one + (shapely.linestrings([[1, 1], [2, 2]]), [1]), + ([shapely.linestrings([[1, 1], [2, 2]])], [[0], [1]]), + # line intersects 2 lines, but is covered by neither + (shapely.linestrings([[1.5, 1.5], [2.5, 2.5]]), []), + ([shapely.linestrings([[1.5, 1.5], [2.5, 2.5]])], [[], []]), + # box not covered by line (not valid geometric relation) + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # buffer intersects 2 lines but not within either (not valid geometric relation) + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + # envelope of points overlaps lines but intersects none + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects, but both are not covered by line + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points are covered by a line + (MultiPoint([[6.5, 6.5], [7, 7]]), [6]), + ([MultiPoint([[6.5, 6.5], [7, 7]])], [[0], [6]]), + ], +) +def test_query_covered_by_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query(geometry, predicate="covered_by"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point covered by polygon + (Point(0, 0.5), [0]), + ([Point(0, 0.5)], [[0], [0]]), + (Point(0.5, 0), [0]), + ([Point(0.5, 0)], [[0], [0]]), + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # midpoint between two polygons is covered by both + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # line intersects multiple polygons but is not covered by any + (shapely.linestrings([[0, 0], [2, 2]]), []), + ([shapely.linestrings([[0, 0], [2, 2]])], [[], []]), + # line intersects multiple polygons but is covered by only one + (shapely.linestrings([[1.5, 1.5], [2.5, 2.5]]), [2]), + ([shapely.linestrings([[1.5, 1.5], [2.5, 2.5]])], [[0], [2]]), + # box overlaps envelope of 2 polygons but not covered by either + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # box covered by polygon + (box(0, 0, 0.5, 0.5), [0]), + ([box(0, 0, 0.5, 0.5)], [[0], [0]]), + # larger box intersects 3 polygons but not covered by any + (box(0, 0, 1.5, 1.5), []), + ([box(0, 0, 1.5, 1.5)], [[], []]), + # buffer intersects 3 polygons but only within one + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0], [3]]), + # larger buffer overlaps 6 polygons (touches midpoints) but within none + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[], []]), + # envelope of points overlaps polygons, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint within polygon + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + # both points in multipoint within polygon + (MultiPoint([[5.25, 5.5], [5.25, 5.0]]), [5]), + ([MultiPoint([[5.25, 5.5], [5.25, 5.0]])], [[0], [5]]), + ], +) +def test_query_covered_by_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query(geometry, predicate="covered_by"), expected) + + +### predicate == 'contains_properly' +@pytest.mark.parametrize( + "geometry,expected", + [ + # points do not intersect + (Point(0.5, 0.5), []), + ([Point(0.5, 0.5)], [[], []]), + # points intersect + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # line contains every point that is not on its first or last coordinate + # these are on the "exterior" of the line + (shapely.linestrings([[0, 0], [2, 2]]), [1]), + ([shapely.linestrings([[0, 0], [2, 2]])], [[0], [1]]), + # slightly longer line contains multiple points + (shapely.linestrings([[0.5, 0.5], [2.5, 2.5]]), [1, 2]), + ([shapely.linestrings([[0.5, 0.5], [2.5, 2.5]])], [[0, 0], [1, 2]]), + # line intersects and contains one point + (shapely.linestrings([[0, 2], [2, 0]]), [1]), + ([shapely.linestrings([[0, 2], [2, 0]])], [[0], [1]]), + # box contains points (2 are at edges and not contained) + (box(3, 3, 6, 6), [4, 5]), + ([box(3, 3, 6, 6)], [[0, 0], [4, 5]]), + # envelope of buffer contains more points than within buffer + # due to diagonal distance + (shapely.buffer(Point(3, 3), 1), [3]), + ([shapely.buffer(Point(3, 3), 1)], [[0], [3]]), + # envelope of buffer with 1/2 distance between points should intersect + # same points as envelope + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # multipoints intersect + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # envelope of points contains points, but points do not intersect + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + # only one point of multipoint intersects + (MultiPoint([[5, 7], [7, 7]]), [7]), + ([MultiPoint([[5, 7], [7, 7]])], [[0], [7]]), + ], +) +def test_query_contains_properly_points(tree, geometry, expected): + assert_array_equal(tree.query(geometry, predicate="contains_properly"), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # None of the following conditions satisfy the relation for linestrings + # because they have no interior: + # "a contains b if no points of b lie in the exterior of a, and at least one + # point of the interior of b lies in the interior of a" + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + (shapely.linestrings([[0, 0], [1, 1]]), []), + ([shapely.linestrings([[0, 0], [1, 1]])], [[], []]), + (shapely.linestrings([[0, 0], [2, 2]]), []), + ([shapely.linestrings([[0, 0], [2, 2]])], [[], []]), + (shapely.linestrings([[0, 2], [2, 0]]), []), + ([shapely.linestrings([[0, 2], [2, 0]])], [[], []]), + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + (MultiPoint([[5, 7], [7, 7]]), []), + ([MultiPoint([[5, 7], [7, 7]])], [[], []]), + (MultiPoint([[5, 5], [6, 6]]), []), + ([MultiPoint([[5, 5], [6, 6]])], [[], []]), + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + (box(0, 0, 2, 2), []), + ([box(0, 0, 2, 2)], [[], []]), + (shapely.buffer(Point(3, 3), 0.5), []), + ([shapely.buffer(Point(3, 3), 0.5)], [[], []]), + ], +) +def test_query_contains_properly_lines(line_tree, geometry, expected): + assert_array_equal( + line_tree.query(geometry, predicate="contains_properly"), expected + ) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # point does not contain any polygons (not valid relation) + (Point(0, 0), []), + ([Point(0, 0)], [[], []]), + # line intersects multiple polygons but does not contain any (not valid relation) + (shapely.linestrings([[0, 0], [2, 2]]), []), + ([shapely.linestrings([[0, 0], [2, 2]])], [[], []]), + # box overlaps envelope of 2 polygons but contains neither + (box(0, 0, 1, 1), []), + ([box(0, 0, 1, 1)], [[], []]), + # larger box intersects 3 polygons but contains only one + (box(0, 0, 2, 2), [1]), + ([box(0, 0, 2, 2)], [[0], [1]]), + # buffer overlaps 3 polygons but contains none + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), []), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[], []]), + # larger buffer overlaps 6 polygons (touches midpoints) but contains one + (shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG), [3]), + ([shapely.buffer(Point(3, 3), 3 * HALF_UNIT_DIAG)], [[0], [3]]), + # envelope of points overlaps polygons, but points do not intersect + # (not valid relation) + (MultiPoint([[5, 7], [7, 5]]), []), + ([MultiPoint([[5, 7], [7, 5]])], [[], []]), + ], +) +def test_query_contains_properly_polygons(poly_tree, geometry, expected): + assert_array_equal( + poly_tree.query(geometry, predicate="contains_properly"), expected + ) + + +### predicate = 'dwithin' + + +@pytest.mark.skipif(geos_version >= (3, 10, 0), reason="GEOS >= 3.10") +@pytest.mark.parametrize( + "geometry", [Point(0, 0), [Point(0, 0)], None, [None], empty, [empty]] +) +def test_query_dwithin_geos_version(tree, geometry): + with pytest.raises(UnsupportedGEOSVersionError, match="requires GEOS >= 3.10"): + tree.query(geometry, predicate="dwithin", distance=1) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,match", + [ + (Point(0, 0), None, "distance parameter must be provided"), + ([Point(0, 0)], None, "distance parameter must be provided"), + (Point(0, 0), "foo", "could not convert string to float"), + ([Point(0, 0)], "foo", "could not convert string to float"), + ([Point(0, 0)], ["foo"], "could not convert string to float"), + (Point(0, 0), [0, 1], "Could not broadcast distance to match geometry"), + ([Point(0, 0)], [0, 1], "Could not broadcast distance to match geometry"), + (Point(0, 0), [[1.0]], "should be one dimensional"), + ([Point(0, 0)], [[1.0]], "should be one dimensional"), + ], +) +def test_query_dwithin_invalid_distance(tree, geometry, distance, match): + with pytest.raises(ValueError, match=match): + tree.query(geometry, predicate="dwithin", distance=distance) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,expected", + [ + (None, 1.0, []), + ([None], 1.0, [[], []]), + (Point(0.25, 0.25), 0, []), + ([Point(0.25, 0.25)], 0, [[], []]), + (Point(0.25, 0.25), -1, []), + ([Point(0.25, 0.25)], -1, [[], []]), + (Point(0.25, 0.25), np.nan, []), + ([Point(0.25, 0.25)], np.nan, [[], []]), + (Point(), 1, []), + ([Point()], 1, [[], []]), + (Point(0.25, 0.25), 0.5, [0]), + ([Point(0.25, 0.25)], 0.5, [[0], [0]]), + (Point(0.25, 0.25), 2.5, [0, 1, 2]), + ([Point(0.25, 0.25)], 2.5, [[0, 0, 0], [0, 1, 2]]), + (Point(3, 3), 1.5, [2, 3, 4]), + ([Point(3, 3)], 1.5, [[0, 0, 0], [2, 3, 4]]), + # 2 equidistant points in tree + (Point(0.5, 0.5), 0.75, [0, 1]), + ([Point(0.5, 0.5)], 0.75, [[0, 0], [0, 1]]), + ( + [None, Point(0.5, 0.5)], + 0.75, + [ + [ + 1, + 1, + ], + [0, 1], + ], + ), + ( + [Point(0.5, 0.5), Point(0.25, 0.25)], + 0.75, + [[0, 0, 1], [0, 1, 0]], + ), + ( + [Point(0, 0.2), Point(1.75, 1.75)], + [0.25, 2], + [[0, 1, 1, 1], [0, 1, 2, 3]], + ), + # all points intersect box + (box(0, 0, 3, 3), 0, [0, 1, 2, 3]), + ([box(0, 0, 3, 3)], 0, [[0, 0, 0, 0], [0, 1, 2, 3]]), + (box(0, 0, 3, 3), 0.25, [0, 1, 2, 3]), + ([box(0, 0, 3, 3)], 0.25, [[0, 0, 0, 0], [0, 1, 2, 3]]), + # intersecting and nearby points + (box(1, 1, 2, 2), 1.5, [0, 1, 2, 3]), + ([box(1, 1, 2, 2)], 1.5, [[0, 0, 0, 0], [0, 1, 2, 3]]), + # # return nearest point in tree for each point in multipoint + (MultiPoint([[0.25, 0.25], [1.5, 1.5]]), 0.75, [0, 1, 2]), + ([MultiPoint([[0.25, 0.25], [1.5, 1.5]])], 0.75, [[0, 0, 0], [0, 1, 2]]), + # 2 equidistant points per point in multipoint + ( + MultiPoint([[0.5, 0.5], [3.5, 3.5]]), + 0.75, + [0, 1, 3, 4], + ), + ( + [MultiPoint([[0.5, 0.5], [3.5, 3.5]])], + 0.75, + [[0, 0, 0, 0], [0, 1, 3, 4]], + ), + ], +) +def test_query_dwithin_points(tree, geometry, distance, expected): + assert_array_equal( + tree.query(geometry, predicate="dwithin", distance=distance), expected + ) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,expected", + [ + (None, 1.0, []), + ([None], 1.0, [[], []]), + (Point(0.5, 0.5), 0, [0]), + ([Point(0.5, 0.5)], 0, [[0], [0]]), + (Point(0.5, 0.5), 1.0, [0, 1]), + ([Point(0.5, 0.5)], 1.0, [[0, 0], [0, 1]]), + (Point(2, 2), 0.5, [1, 2]), + ([Point(2, 2)], 0.5, [[0, 0], [1, 2]]), + (box(0, 0, 1, 1), 0.5, [0, 1]), + ([box(0, 0, 1, 1)], 0.5, [[0, 0], [0, 1]]), + (box(0.5, 0.5, 1.5, 1.5), 0.5, [0, 1]), + ([box(0.5, 0.5, 1.5, 1.5)], 0.5, [[0, 0], [0, 1]]), + # multipoints at endpoints of 2 lines each + (MultiPoint([[5, 5], [7, 7]]), 0.5, [4, 5, 6, 7]), + ([MultiPoint([[5, 5], [7, 7]])], 0.5, [[0, 0, 0, 0], [4, 5, 6, 7]]), + # multipoints are equidistant from 2 lines + (MultiPoint([[5, 7], [7, 5]]), 1.5, [5, 6]), + ([MultiPoint([[5, 7], [7, 5]])], 1.5, [[0, 0], [5, 6]]), + ], +) +def test_query_dwithin_lines(line_tree, geometry, distance, expected): + assert_array_equal( + line_tree.query(geometry, predicate="dwithin", distance=distance), + expected, + ) + + +@pytest.mark.skipif(geos_version < (3, 10, 0), reason="GEOS < 3.10") +@pytest.mark.parametrize( + "geometry,distance,expected", + [ + (Point(0, 0), 0, [0]), + ([Point(0, 0)], 0, [[0], [0]]), + (Point(0, 0), 0.5, [0]), + ([Point(0, 0)], 0.5, [[0], [0]]), + (Point(0, 0), 1.5, [0, 1]), + ([Point(0, 0)], 1.5, [[0, 0], [0, 1]]), + (Point(0.5, 0.5), 1, [0, 1]), + ([Point(0.5, 0.5)], 1, [[0, 0], [0, 1]]), + (Point(0.5, 0.5), 0.5, [0, 1]), + ([Point(0.5, 0.5)], 0.5, [[0, 0], [0, 1]]), + (box(0, 0, 1, 1), 0, [0, 1]), + ([box(0, 0, 1, 1)], 0, [[0, 0], [0, 1]]), + (box(0, 0, 1, 1), 2, [0, 1, 2]), + ([box(0, 0, 1, 1)], 2, [[0, 0, 0], [0, 1, 2]]), + (MultiPoint([[5, 5], [7, 7]]), 0.5, [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], 0.5, [[0, 0], [5, 7]]), + ( + MultiPoint([[5, 5], [7, 7]]), + 2.5, + [3, 4, 5, 6, 7, 8, 9], + ), + ( + [MultiPoint([[5, 5], [7, 7]])], + 2.5, + [[0, 0, 0, 0, 0, 0, 0], [3, 4, 5, 6, 7, 8, 9]], + ), + ], +) +def test_query_dwithin_polygons(poly_tree, geometry, distance, expected): + assert_array_equal( + poly_tree.query(geometry, predicate="dwithin", distance=distance), + expected, + ) + + +### STRtree nearest + + +def test_nearest_empty_tree(): + tree = STRtree([]) + assert tree.nearest(point) is None + + +@pytest.mark.parametrize("geometry", ["I am not a geometry"]) +def test_nearest_invalid_geom(tree, geometry): + with pytest.raises(TypeError): + tree.nearest(geometry) + + +@pytest.mark.parametrize("geometry", [None, [None], [Point(1, 1), None]]) +def test_nearest_none(tree, geometry): + with pytest.raises(ValueError): + tree.nearest(geometry) + + +@pytest.mark.parametrize( + "geometry", [empty_point, [empty_point], [Point(1, 1), empty_point]] +) +def test_nearest_empty(tree, geometry): + with pytest.raises(ValueError): + tree.nearest(geometry) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.25, 0.25), 0), + (Point(0.75, 0.75), 1), + (Point(1, 1), 1), + ([Point(1, 1), Point(0, 0)], [1, 0]), + ([Point(1, 1), Point(0.25, 1)], [1, 1]), + ([Point(-10, -10), Point(100, 100)], [0, 9]), + (box(0.5, 0.5, 0.75, 0.75), 1), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), 2), + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), 3), + (MultiPoint([[5.5, 5], [7, 7]]), 7), + (MultiPoint([[5, 7], [7, 5]]), 6), + ], +) +def test_nearest_points(tree, geometry, expected): + assert_array_equal(tree.nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # 2 equidistant points in tree + (Point(0.5, 0.5), [0, 1]), + # multiple points in box + (box(0, 0, 3, 3), [0, 1, 2, 3]), + # return nearest point in tree for each point in multipoint + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ], +) +def test_nearest_points_equidistant(tree, geometry, expected): + # results are returned in order they are traversed when searching the tree, + # which can vary between GEOS versions, so we test that one of the valid + # results is present + result = tree.nearest(geometry) + assert result in expected + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.5, 0.5), 0), + (Point(1.5, 0.5), 0), + (shapely.box(0.5, 1.5, 1, 2), 1), + (shapely.linestrings([[0, 0.5], [1, 2.5]]), 0), + ], +) +def test_nearest_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # at junction between 2 lines + (Point(2, 2), [1, 2]), + # contains one line, intersects with another + (box(0, 0, 1, 1), [0, 1]), + # overlaps 2 lines + (box(0.5, 0.5, 1.5, 1.5), [0, 1]), + # box overlaps 2 lines and intersects endpoints of 2 more + (box(3, 3, 5, 5), [2, 3, 4, 5]), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), [1, 2]), + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3]), + # multipoints at endpoints of 2 lines each + (MultiPoint([[5, 5], [7, 7]]), [4, 5, 6, 7]), + # second point in multipoint at endpoints of 2 lines + (MultiPoint([[5.5, 5], [7, 7]]), [6, 7]), + # multipoints are equidistant from 2 lines + (MultiPoint([[5, 7], [7, 5]]), [5, 6]), + ], +) +def test_nearest_lines_equidistant(line_tree, geometry, expected): + # results are returned in order they are traversed when searching the tree, + # which can vary between GEOS versions, so we test that one of the valid + # results is present + result = line_tree.nearest(geometry) + assert result in expected + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0, 0), 0), + (Point(2, 2), 2), + (shapely.box(0, 5, 1, 6), 3), + (MultiPoint([[5, 7], [7, 5]]), 6), + ], +) +def test_nearest_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + # 2 polygons in tree overlap point + (Point(0.5, 0.5), [0, 1]), + # box overlaps multiple polygons + (box(0, 0, 1, 1), [0, 1]), + (box(0.5, 0.5, 1.5, 1.5), [0, 1, 2]), + (box(3, 3, 5, 5), [3, 4, 5]), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), [2, 3]), + # completely overlaps one polygon, touches 2 others + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + # each point in multi point intersects a polygon in tree + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + (MultiPoint([[5.5, 5], [7, 7]]), [5, 7]), + ], +) +def test_nearest_polygons_equidistant(poly_tree, geometry, expected): + # results are returned in order they are traversed when searching the tree, + # which can vary between GEOS versions, so we test that one of the valid + # results is present + result = poly_tree.nearest(geometry) + assert result in expected + + +def test_query_nearest_empty_tree(): + tree = STRtree([]) + assert_array_equal(tree.query_nearest(point), []) + assert_array_equal(tree.query_nearest([point]), [[], []]) + + +@pytest.mark.parametrize("geometry", ["I am not a geometry", ["still not a geometry"]]) +def test_query_nearest_invalid_geom(tree, geometry): + with pytest.raises(TypeError): + tree.query_nearest(geometry) + + +@pytest.mark.parametrize( + "geometry,return_distance,expected", + [ + (None, False, []), + ([None], False, [[], []]), + (None, True, ([], [])), + ([None], True, ([[], []], [])), + ], +) +def test_query_nearest_none(tree, geometry, return_distance, expected): + if return_distance: + index, distance = tree.query_nearest(geometry, return_distance=True) + assert_array_equal(index, expected[0]) + assert_array_equal(distance, expected[1]) + + else: + assert_array_equal(tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [(empty, []), ([empty], [[], []]), ([empty, point], [[1, 1], [2, 3]])], +) +def test_query_nearest_empty_geom(tree, geometry, expected): + assert_array_equal(tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.25, 0.25), [0]), + ([Point(0.25, 0.25)], [[0], [0]]), + (Point(0.75, 0.75), [1]), + ([Point(0.75, 0.75)], [[0], [1]]), + (Point(1, 1), [1]), + ([Point(1, 1)], [[0], [1]]), + # 2 equidistant points in tree + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + ([Point(1, 1), Point(0, 0)], [[0, 1], [1, 0]]), + ([Point(1, 1), Point(0.25, 1)], [[0, 1], [1, 1]]), + ([Point(-10, -10), Point(100, 100)], [[0, 1], [0, 9]]), + (box(0.5, 0.5, 0.75, 0.75), [1]), + ([box(0.5, 0.5, 0.75, 0.75)], [[0], [1]]), + # multiple points in box + (box(0, 0, 3, 3), [0, 1, 2, 3]), + ([box(0, 0, 3, 3)], [[0, 0, 0, 0], [0, 1, 2, 3]]), + (shapely.buffer(Point(2.5, 2.5), 1), [2, 3]), + ([shapely.buffer(Point(2.5, 2.5), 1)], [[0, 0], [2, 3]]), + (shapely.buffer(Point(3, 3), 0.5), [3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0], [3]]), + (MultiPoint([[5.5, 5], [7, 7]]), [7]), + ([MultiPoint([[5.5, 5], [7, 7]])], [[0], [7]]), + (MultiPoint([[5, 7], [7, 5]]), [6]), + ([MultiPoint([[5, 7], [7, 5]])], [[0], [6]]), + # return nearest point in tree for each point in multipoint + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + # 2 equidistant points per point in multipoint + (MultiPoint([[0.5, 0.5], [3.5, 3.5]]), [0, 1, 3, 4]), + ([MultiPoint([[0.5, 0.5], [3.5, 3.5]])], [[0, 0, 0, 0], [0, 1, 3, 4]]), + ], +) +def test_query_nearest_points(tree, geometry, expected): + assert_array_equal(tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0.5, 0.5), [0]), + ([Point(0.5, 0.5)], [[0], [0]]), + # at junction between 2 lines, will return both + (Point(2, 2), [1, 2]), + ([Point(2, 2)], [[0, 0], [1, 2]]), + # contains one line, intersects with another + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + # overlaps 2 lines + (box(0.5, 0.5, 1.5, 1.5), [0, 1]), + ([box(0.5, 0.5, 1.5, 1.5)], [[0, 0], [0, 1]]), + # second box overlaps 2 lines and intersects endpoints of 2 more + ([box(0, 0, 0.5, 0.5), box(3, 3, 5, 5)], [[0, 1, 1, 1, 1], [0, 2, 3, 4, 5]]), + (shapely.buffer(Point(2.5, 2.5), 1), [1, 2, 3]), + ([shapely.buffer(Point(2.5, 2.5), 1)], [[0, 0, 0], [1, 2, 3]]), + (shapely.buffer(Point(3, 3), 0.5), [2, 3]), + ([shapely.buffer(Point(3, 3), 0.5)], [[0, 0], [2, 3]]), + # multipoints at endpoints of 2 lines each + (MultiPoint([[5, 5], [7, 7]]), [4, 5, 6, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0, 0, 0], [4, 5, 6, 7]]), + # second point in multipoint at endpoints of 2 lines + (MultiPoint([[5.5, 5], [7, 7]]), [6, 7]), + ([MultiPoint([[5.5, 5], [7, 7]])], [[0, 0], [6, 7]]), + # multipoints are equidistant from 2 lines + (MultiPoint([[5, 7], [7, 5]]), [5, 6]), + ([MultiPoint([[5, 7], [7, 5]])], [[0, 0], [5, 6]]), + ], +) +def test_query_nearest_lines(line_tree, geometry, expected): + assert_array_equal(line_tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0, 0), [0]), + ([Point(0, 0)], [[0], [0]]), + (Point(2, 2), [2]), + ([Point(2, 2)], [[0], [2]]), + # 2 polygons in tree overlap point + (Point(0.5, 0.5), [0, 1]), + ([Point(0.5, 0.5)], [[0, 0], [0, 1]]), + # box overlaps multiple polygons + (box(0, 0, 1, 1), [0, 1]), + ([box(0, 0, 1, 1)], [[0, 0], [0, 1]]), + (box(0.5, 0.5, 1.5, 1.5), [0, 1, 2]), + ([box(0.5, 0.5, 1.5, 1.5)], [[0, 0, 0], [0, 1, 2]]), + ([box(0, 0, 1, 1), box(3, 3, 5, 5)], [[0, 0, 1, 1, 1], [0, 1, 3, 4, 5]]), + (shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG), [2, 3]), + ([shapely.buffer(Point(2.5, 2.5), HALF_UNIT_DIAG)], [[0, 0], [2, 3]]), + # completely overlaps one polygon, touches 2 others + (shapely.buffer(Point(3, 3), HALF_UNIT_DIAG), [2, 3, 4]), + ([shapely.buffer(Point(3, 3), HALF_UNIT_DIAG)], [[0, 0, 0], [2, 3, 4]]), + # each point in multi point intersects a polygon in tree + (MultiPoint([[5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5, 5], [7, 7]])], [[0, 0], [5, 7]]), + (MultiPoint([[5.5, 5], [7, 7]]), [5, 7]), + ([MultiPoint([[5.5, 5], [7, 7]])], [[0, 0], [5, 7]]), + (MultiPoint([[5, 7], [7, 5]]), [6]), + ([MultiPoint([[5, 7], [7, 5]])], [[0], [6]]), + ], +) +def test_query_nearest_polygons(poly_tree, geometry, expected): + assert_array_equal(poly_tree.query_nearest(geometry), expected) + + +@pytest.mark.parametrize( + "geometry,max_distance,expected", + [ + # using unset max_distance should return all nearest + (Point(0.5, 0.5), None, [0, 1]), + ([Point(0.5, 0.5)], None, [[0, 0], [0, 1]]), + # using large max_distance should return all nearest + (Point(0.5, 0.5), 10, [0, 1]), + ([Point(0.5, 0.5)], 10, [[0, 0], [0, 1]]), + # using small max_distance should return no results + (Point(0.5, 0.5), 0.1, []), + ([Point(0.5, 0.5)], 0.1, [[], []]), + # using small max_distance should only return results in that distance + ([Point(0.5, 0.5), Point(0, 0)], 0.1, [[1], [0]]), + ], +) +def test_query_nearest_max_distance(tree, geometry, max_distance, expected): + assert_array_equal( + tree.query_nearest(geometry, max_distance=max_distance), expected + ) + + +@pytest.mark.parametrize( + "geometry,max_distance", + [ + (Point(0.5, 0.5), 0), + ([Point(0.5, 0.5)], 0), + (Point(0.5, 0.5), -1), + ([Point(0.5, 0.5)], -1), + ], +) +def test_query_nearest_invalid_max_distance(tree, geometry, max_distance): + with pytest.raises(ValueError, match="max_distance must be greater than 0"): + tree.query_nearest(geometry, max_distance=max_distance) + + +def test_query_nearest_nonscalar_max_distance(tree): + with pytest.raises(ValueError, match="parameter only accepts scalar values"): + tree.query_nearest(Point(0.5, 0.5), max_distance=[1]) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(0, 0), ([0], [0.0])), + ([Point(0, 0)], ([[0], [0]], [0.0])), + (Point(0.5, 0.5), ([0, 1], [0.7071, 0.7071])), + ([Point(0.5, 0.5)], ([[0, 0], [0, 1]], [0.7071, 0.7071])), + (box(0, 0, 1, 1), ([0, 1], [0.0, 0.0])), + ([box(0, 0, 1, 1)], ([[0, 0], [0, 1]], [0.0, 0.0])), + ], +) +def test_query_nearest_return_distance(tree, geometry, expected): + expected_indices, expected_dist = expected + + actual_indices, actual_dist = tree.query_nearest(geometry, return_distance=True) + + assert_array_equal(actual_indices, expected_indices) + assert_array_equal(np.round(actual_dist, 4), expected_dist) + + +@pytest.mark.parametrize( + "geometry,exclusive,expected", + [ + (Point(1, 1), False, [1]), + ([Point(1, 1)], False, [[0], [1]]), + (Point(1, 1), True, [0, 2]), + ([Point(1, 1)], True, [[0, 0], [0, 2]]), + ([Point(1, 1), Point(2, 2)], True, [[0, 0, 1, 1], [0, 2, 1, 3]]), + ], +) +def test_query_nearest_exclusive(tree, geometry, exclusive, expected): + assert_array_equal(tree.query_nearest(geometry, exclusive=exclusive), expected) + + +@pytest.mark.parametrize( + "geometry,expected", + [ + (Point(1, 1), []), + ([Point(1, 1)], [[], []]), + ], +) +def test_query_nearest_exclusive_no_results(tree, geometry, expected): + tree = STRtree([Point(1, 1)]) + assert_array_equal(tree.query_nearest(geometry, exclusive=True), expected) + + +@pytest.mark.parametrize( + "geometry,exclusive", + [ + (Point(1, 1), "invalid"), + # non-scalar exclusive parameter not allowed + (Point(1, 1), ["also invalid"]), + ([Point(1, 1)], []), + ([Point(1, 1)], [False]), + ], +) +def test_query_nearest_invalid_exclusive(tree, geometry, exclusive): + with pytest.raises(ValueError): + tree.query_nearest(geometry, exclusive=exclusive) + + +@pytest.mark.parametrize( + "geometry,all_matches", + [ + (Point(1, 1), "invalid"), + # non-scalar all_matches parameter not allowed + (Point(1, 1), ["also invalid"]), + ([Point(1, 1)], []), + ([Point(1, 1)], [False]), + ], +) +def test_query_nearest_invalid_all_matches(tree, geometry, all_matches): + with pytest.raises(ValueError): + tree.query_nearest(geometry, all_matches=all_matches) + + +def test_query_nearest_all_matches(tree): + point = Point(0.5, 0.5) + assert_array_equal(tree.query_nearest(point, all_matches=True), [0, 1]) + + indices = tree.query_nearest(point, all_matches=False) + # result is dependent on tree traversal order; may vary across test runs + assert np.array_equal(indices, [0]) or np.array_equal(indices, [1]) + + +def test_strtree_threaded_query(): + ## Create data + polygons = shapely.polygons(np.random.randn(1000, 3, 2)) + # needs to be big enough to trigger the segfault + N = 100_000 + points = shapely.points(4 * np.random.random(N) - 2, 4 * np.random.random(N) - 2) + + ## Slice parts of the arrays -> 4x4 => 16 combinations + n = int(len(polygons) / 4) + polygons_parts = [ + polygons[:n], + polygons[n : 2 * n], + polygons[2 * n : 3 * n], + polygons[3 * n :], + ] + n = int(len(points) / 4) + points_parts = [ + points[:n], + points[n : 2 * n], + points[2 * n : 3 * n], + points[3 * n :], + ] + + ## Creating the trees in advance + trees = [] + for i in range(4): + left = points_parts[i] + tree = STRtree(left) + trees.append(tree) + + ## The function querying the trees in parallel + + def thread_func(idxs): + i, j = idxs + tree = trees[i] + right = polygons_parts[j] + return tree.query(right, predicate="contains") + + with ThreadPoolExecutor() as pool: + list(pool.map(thread_func, itertools.product(range(4), range(4)))) diff --git a/shapely/python/shapely/tests/test_testing.py b/shapely/python/shapely/tests/test_testing.py new file mode 100644 index 0000000..4880d92 --- /dev/null +++ b/shapely/python/shapely/tests/test_testing.py @@ -0,0 +1,104 @@ +import numpy as np +import pytest + +import shapely +from shapely.testing import assert_geometries_equal + +from .common import ( + all_types, + empty, + empty_line_string, + empty_line_string_z, + empty_point, + empty_point_z, + empty_polygon, + line_string, + line_string_nan, + line_string_z, + point, +) + +EMPTY_GEOMS = ( + empty_point, + empty_point_z, + empty_line_string, + empty_line_string_z, + empty_polygon, + empty, +) + +line_string_reversed = shapely.linestrings([(0, 0), (1, 0), (1, 1)][::-1]) + + +PRE_GEOS_390 = pytest.mark.skipif( + shapely.geos_version < (3, 9, 0), + reason="2D and 3D empty geometries did not have dimensionality before GEOS 3.9", +) + + +def make_array(left, right, use_array): + if use_array in ("left", "both"): + left = np.array([left] * 3, dtype=object) + if use_array in ("right", "both"): + right = np.array([right] * 3, dtype=object) + return left, right + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +@pytest.mark.parametrize("geom", all_types + EMPTY_GEOMS) +def test_assert_geometries_equal(geom, use_array): + assert_geometries_equal(*make_array(geom, geom, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +@pytest.mark.parametrize( + "geom1,geom2", + [ + (point, line_string), + (line_string, line_string_z), + (empty_point, empty_polygon), + pytest.param(empty_point, empty_point_z, marks=PRE_GEOS_390), + pytest.param(empty_line_string, empty_line_string_z, marks=PRE_GEOS_390), + ], +) +def test_assert_geometries_not_equal(geom1, geom2, use_array): + with pytest.raises(AssertionError): + assert_geometries_equal(*make_array(geom1, geom2, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_none_equal(use_array): + assert_geometries_equal(*make_array(None, None, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_none_not_equal(use_array): + with pytest.raises(AssertionError): + assert_geometries_equal(*make_array(None, None, use_array), equal_none=False) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_nan_equal(use_array): + assert_geometries_equal(*make_array(line_string_nan, line_string_nan, use_array)) + + +@pytest.mark.parametrize("use_array", ["none", "left", "right", "both"]) +def test_assert_nan_not_equal(use_array): + with pytest.raises(AssertionError): + assert_geometries_equal( + *make_array(line_string_nan, line_string_nan, use_array), equal_nan=False + ) + + +def test_normalize_true(): + assert_geometries_equal(line_string_reversed, line_string, normalize=True) + + +def test_normalize_default(): + with pytest.raises(AssertionError): + assert_geometries_equal(line_string_reversed, line_string) + + +def test_normalize_false(): + with pytest.raises(AssertionError): + assert_geometries_equal(line_string_reversed, line_string, normalize=False) diff --git a/shapely/python/shapely/validation.py b/shapely/python/shapely/validation.py new file mode 100644 index 0000000..571b9bd --- /dev/null +++ b/shapely/python/shapely/validation.py @@ -0,0 +1,55 @@ +# TODO: allow for implementations using other than GEOS + +import shapely + +__all__ = ["explain_validity", "make_valid"] + + +def explain_validity(ob): + """ + Explain the validity of the input geometry, if it is invalid. + This will describe why the geometry is invalid, and might + include a location if there is a self-intersection or a + ring self-intersection. + + Parameters + ---------- + ob: Geometry + A shapely geometry object + + Returns + ------- + str + A string describing the reason the geometry is invalid. + + """ + return shapely.is_valid_reason(ob) + + +def make_valid(ob): + """ + Make the input geometry valid according to the GEOS MakeValid algorithm. + + If the input geometry is already valid, then it will be returned. + + If the geometry must be split into multiple parts of the same type to be made valid, + then a multi-part geometry will be returned. + + If the geometry must be split into multiple parts of different types to be made valid, + then a GeometryCollection will be returned. + + Parameters + ---------- + ob : Geometry + A shapely geometry object which should be made valid. If the object is already valid, + it will be returned as-is. + + Returns + ------- + Geometry + The input geometry, made valid according to the GEOS MakeValid algorithm. + + """ + if ob.is_valid: + return ob + return shapely.make_valid(ob) diff --git a/shapely/python/shapely/vectorized/__init__.py b/shapely/python/shapely/vectorized/__init__.py new file mode 100644 index 0000000..5ca5ec1 --- /dev/null +++ b/shapely/python/shapely/vectorized/__init__.py @@ -0,0 +1,75 @@ +"""Provides multi-point element-wise operations such as ``contains``.""" + +import numpy as np + +import shapely +from shapely.prepared import PreparedGeometry + + +def _construct_points(x, y): + x, y = np.asanyarray(x), np.asanyarray(y) + if x.shape != y.shape: + raise ValueError("X and Y shapes must be equivalent.") + + if x.dtype != np.float64: + x = x.astype(np.float64) + if y.dtype != np.float64: + y = y.astype(np.float64) + + return shapely.points(x, y) + + +def contains(geometry, x, y): + """ + Vectorized (element-wise) version of `contains` which checks whether + multiple points are contained by a single geometry. + + Parameters + ---------- + geometry : PreparedGeometry or subclass of BaseGeometry + The geometry which is to be checked to see whether each point is + contained within. The geometry will be "prepared" if it is not already + a PreparedGeometry instance. + x : array + The x coordinates of the points to check. + y : array + The y coordinates of the points to check. + + Returns + ------- + Mask of points contained by the given `geometry`. + + """ + if isinstance(geometry, PreparedGeometry): + geometry = geometry.context + shapely.prepare(geometry) + return shapely.contains_xy(geometry, x, y) + + +def touches(geometry, x, y): + """ + Vectorized (element-wise) version of `touches` which checks whether + multiple points touch the exterior of a single geometry. + + Parameters + ---------- + geometry : PreparedGeometry or subclass of BaseGeometry + The geometry which is to be checked to see whether each point is + contained within. The geometry will be "prepared" if it is not already + a PreparedGeometry instance. + x : array + The x coordinates of the points to check. + y : array + The y coordinates of the points to check. + + Returns + ------- + Mask of points which touch the exterior of the given `geometry`. + + """ + if isinstance(geometry, PreparedGeometry): + geometry = geometry.context + # Touches(geom, point) == Intersects(Boundary(geom), point) + boundary = geometry.boundary + shapely.prepare(boundary) + return shapely.intersects_xy(boundary, x, y) diff --git a/shapely/python/shapely/vectorized/__pycache__/__init__.cpython-311.pyc b/shapely/python/shapely/vectorized/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..21ed558 Binary files /dev/null and b/shapely/python/shapely/vectorized/__pycache__/__init__.cpython-311.pyc differ diff --git a/shapely/python/shapely/wkb.py b/shapely/python/shapely/wkb.py new file mode 100644 index 0000000..c47b424 --- /dev/null +++ b/shapely/python/shapely/wkb.py @@ -0,0 +1,64 @@ +"""Load/dump geometries using the well-known binary (WKB) format. + +Also provides pickle-like convenience functions. +""" +import shapely + + +def loads(data, hex=False): + """Load a geometry from a WKB byte string, or hex-encoded string if + ``hex=True``. + + Raises + ------ + GEOSException, UnicodeDecodeError + If ``data`` contains an invalid geometry. + """ + return shapely.from_wkb(data) + + +def load(fp, hex=False): + """Load a geometry from an open file. + + Raises + ------ + GEOSException, UnicodeDecodeError + If the given file contains an invalid geometry. + """ + data = fp.read() + return loads(data, hex=hex) + + +def dumps(ob, hex=False, srid=None, **kw): + """Dump a WKB representation of a geometry to a byte string, or a + hex-encoded string if ``hex=True``. + + Parameters + ---------- + ob : geometry + The geometry to export to well-known binary (WKB) representation + hex : bool + If true, export the WKB as a hexadecimal string. The default is to + return a binary string/bytes object. + srid : int + Spatial reference system ID to include in the output. The default value + means no SRID is included. + **kw : kwargs, optional + Keyword output options passed to :func:`~shapely.to_wkb`. + """ + if srid is not None: + # clone the object and set the SRID before dumping + ob = shapely.set_srid(ob, srid) + kw["include_srid"] = True + if "big_endian" in kw: + # translate big_endian=True/False into byte_order=0/1 + # but if not specified, keep the default of byte_order=-1 (native) + big_endian = kw.pop("big_endian") + byte_order = 0 if big_endian else 1 + kw.update(byte_order=byte_order) + return shapely.to_wkb(ob, hex=hex, **kw) + + +def dump(ob, fp, hex=False, **kw): + """Dump a geometry to an open file.""" + fp.write(dumps(ob, hex=hex, **kw)) diff --git a/shapely/python/shapely/wkt.py b/shapely/python/shapely/wkt.py new file mode 100644 index 0000000..d496ff2 --- /dev/null +++ b/shapely/python/shapely/wkt.py @@ -0,0 +1,87 @@ +"""Load/dump geometries using the well-known text (WKT) format + +Also provides pickle-like convenience functions. +""" + +import shapely + + +def loads(data): + """ + Load a geometry from a WKT string. + + Parameters + ---------- + data : str + A WKT string + + Returns + ------- + Shapely geometry object + """ + return shapely.from_wkt(data) + + +def load(fp): + """ + Load a geometry from an open file. + + Parameters + ---------- + fp : + A file-like object which implements a `read` method. + + Returns + ------- + Shapely geometry object + """ + data = fp.read() + return loads(data) + + +def dumps(ob, trim=False, rounding_precision=-1, **kw): + """ + Dump a WKT representation of a geometry to a string. + + Parameters + ---------- + ob : + A geometry object of any type to be dumped to WKT. + trim : bool, default False + Remove excess decimals from the WKT. + rounding_precision : int + Round output to the specified number of digits. + Default behavior returns full precision. + output_dimension : int, default 3 + Force removal of dimensions above the one specified. + + Returns + ------- + input geometry as WKT string + """ + return shapely.to_wkt(ob, trim=trim, rounding_precision=rounding_precision, **kw) + + +def dump(ob, fp, **settings): + """ + Dump a geometry to an open file. + + Parameters + ---------- + ob : + A geometry object of any type to be dumped to WKT. + fp : + A file-like object which implements a `write` method. + trim : bool, default False + Remove excess decimals from the WKT. + rounding_precision : int + Round output to the specified number of digits. + Default behavior returns full precision. + output_dimension : int, default 3 + Force removal of dimensions above the one specified. + + Returns + ------- + None + """ + fp.write(dumps(ob, **settings)) diff --git a/shapely/shapely.zip b/shapely/shapely.zip new file mode 100644 index 0000000..c988623 Binary files /dev/null and b/shapely/shapely.zip differ diff --git a/tb-rest-client/.DS_Store b/tb-rest-client/.DS_Store new file mode 100644 index 0000000..5117ba3 Binary files /dev/null and b/tb-rest-client/.DS_Store differ diff --git a/tb-rest-client/python/.DS_Store b/tb-rest-client/python/.DS_Store new file mode 100644 index 0000000..9352014 Binary files /dev/null and b/tb-rest-client/python/.DS_Store differ diff --git a/tb-rest-client/python/tb_rest_client/__init__.py b/tb-rest-client/python/tb_rest_client/__init__.py new file mode 100644 index 0000000..d3af56e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/__init__.py @@ -0,0 +1,16 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .rest_client_ce import RestClientCE +from .rest_client_pe import RestClientPE diff --git a/tb-rest-client/python/tb_rest_client/__pycache__/__init__.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..6942306 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/__pycache__/__init__.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/__pycache__/api_client.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/__pycache__/api_client.cpython-311.pyc new file mode 100644 index 0000000..c3c3d4a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/__pycache__/api_client.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/__pycache__/configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/__pycache__/configuration.cpython-311.pyc new file mode 100644 index 0000000..34c1a26 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/__pycache__/configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/__pycache__/rest.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/__pycache__/rest.cpython-311.pyc new file mode 100644 index 0000000..4a450a6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/__pycache__/rest.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_base.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_base.cpython-311.pyc new file mode 100644 index 0000000..7f7b66a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_base.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_ce.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_ce.cpython-311.pyc new file mode 100644 index 0000000..920f68a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_ce.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_pe.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_pe.cpython-311.pyc new file mode 100644 index 0000000..b72c99e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/__pycache__/rest_client_pe.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/__init__.py b/tb-rest-client/python/tb_rest_client/api/__init__.py new file mode 100644 index 0000000..5154646 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/tb-rest-client/python/tb_rest_client/api/__pycache__/__init__.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..ace2ab5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/__pycache__/__init__.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__init__.py b/tb-rest-client/python/tb_rest_client/api/api_ce/__init__.py new file mode 100644 index 0000000..282107c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/__init__.py @@ -0,0 +1,56 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .o_auth_2_config_template_controller_api import OAuth2ConfigTemplateControllerApi +from .asset_controller_api import AssetControllerApi +from .rule_chain_controller_api import RuleChainControllerApi +from .auth_controller_api import AuthControllerApi +from .event_controller_api import EventControllerApi +from .telemetry_controller_api import TelemetryControllerApi +from .alarm_controller_api import AlarmControllerApi +from .edge_controller_api import EdgeControllerApi +from .rpc_v_2_controller_api import RpcV2ControllerApi +from .edge_event_controller_api import EdgeEventControllerApi +from .customer_controller_api import CustomerControllerApi +from .user_controller_api import UserControllerApi +from .queue_controller_api import QueueControllerApi +from .rpc_v_1_controller_api import RpcV1ControllerApi +from .device_controller_api import DeviceControllerApi +from .entity_relation_controller_api import EntityRelationControllerApi +from .entity_view_controller_api import EntityViewControllerApi +from .admin_controller_api import AdminControllerApi +from .tb_resource_controller_api import TbResourceControllerApi +from .o_auth_2_controller_api import OAuth2ControllerApi +from .tenant_profile_controller_api import TenantProfileControllerApi +from .widgets_bundle_controller_api import WidgetsBundleControllerApi +from .device_profile_controller_api import DeviceProfileControllerApi +from .dashboard_controller_api import DashboardControllerApi +from .entity_query_controller_api import EntityQueryControllerApi +from .widget_type_controller_api import WidgetTypeControllerApi +from .audit_log_controller_api import AuditLogControllerApi +from .lwm_2m_controller_api import Lwm2mControllerApi +from .component_descriptor_controller_api import ComponentDescriptorControllerApi +from .tenant_controller_api import TenantControllerApi +from .ota_package_controller_api import OtaPackageControllerApi +from .entities_version_control_controller_api import EntitiesVersionControlControllerApi +from .device_api_controller_api import DeviceApiControllerApi +from .two_factor_auth_controller_api import TwoFactorAuthControllerApi +from .alarm_comment_controller_api import AlarmCommentControllerApi +from .asset_profile_controller_api import AssetProfileControllerApi +from .notification_controller_api import NotificationControllerApi +from .notification_rule_controller_api import NotificationRuleControllerApi +from .notification_target_controller_api import NotificationTargetControllerApi +from .notification_template_controller_api import NotificationTemplateControllerApi +from .usage_info_controller_api import UsageInfoControllerApi +from .two_factor_auth_config_controller_api import TwoFactorAuthConfigControllerApi diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/__init__.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d7891d2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/__init__.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/admin_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/admin_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d03c6db Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/admin_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/alarm_comment_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/alarm_comment_controller_api.cpython-311.pyc new file mode 100644 index 0000000..16cbdce Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/alarm_comment_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/alarm_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/alarm_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e5f588a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/alarm_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/asset_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/asset_controller_api.cpython-311.pyc new file mode 100644 index 0000000..81dce6b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/asset_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/asset_profile_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/asset_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d27e48d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/asset_profile_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/audit_log_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/audit_log_controller_api.cpython-311.pyc new file mode 100644 index 0000000..94ae442 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/audit_log_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/auth_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..277f42e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/auth_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/component_descriptor_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/component_descriptor_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4f110d1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/component_descriptor_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/customer_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/customer_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f104843 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/customer_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/dashboard_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/dashboard_controller_api.cpython-311.pyc new file mode 100644 index 0000000..db49d3f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/dashboard_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_api_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_api_controller_api.cpython-311.pyc new file mode 100644 index 0000000..3c00723 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_api_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_controller_api.cpython-311.pyc new file mode 100644 index 0000000..095e294 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_profile_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..52d9c93 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/device_profile_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/edge_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/edge_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2176d4c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/edge_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/edge_event_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/edge_event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..58331a1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/edge_event_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entities_version_control_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entities_version_control_controller_api.cpython-311.pyc new file mode 100644 index 0000000..89708a7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entities_version_control_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_query_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_query_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9974be8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_query_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_relation_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_relation_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e329a71 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_relation_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_view_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_view_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5f06532 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/entity_view_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/event_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..dd0e5f8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/event_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/login_endpoint_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/login_endpoint_api.cpython-311.pyc new file mode 100644 index 0000000..876d8cf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/login_endpoint_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/lwm_2m_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/lwm_2m_controller_api.cpython-311.pyc new file mode 100644 index 0000000..621345f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/lwm_2m_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b90b75b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_rule_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_rule_controller_api.cpython-311.pyc new file mode 100644 index 0000000..6fd32ee Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_rule_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_target_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_target_controller_api.cpython-311.pyc new file mode 100644 index 0000000..14c5a20 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_target_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_template_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..65ae5d7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/notification_template_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5fe908a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0f1b39d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/o_auth_2_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/ota_package_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/ota_package_controller_api.cpython-311.pyc new file mode 100644 index 0000000..629035e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/ota_package_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/queue_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/queue_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e4abfb8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/queue_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_1_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_1_controller_api.cpython-311.pyc new file mode 100644 index 0000000..526a95c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_1_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_2_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4ec009b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rpc_v_2_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rule_chain_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rule_chain_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9bf30bb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/rule_chain_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tb_resource_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tb_resource_controller_api.cpython-311.pyc new file mode 100644 index 0000000..03f105e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tb_resource_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/telemetry_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/telemetry_controller_api.cpython-311.pyc new file mode 100644 index 0000000..a985111 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/telemetry_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tenant_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tenant_controller_api.cpython-311.pyc new file mode 100644 index 0000000..be3f48c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tenant_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tenant_profile_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tenant_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..449795e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/tenant_profile_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc new file mode 100644 index 0000000..cf4c600 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e044c1b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/two_factor_auth_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/ui_settings_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/ui_settings_controller_api.cpython-311.pyc new file mode 100644 index 0000000..dd7eee3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/ui_settings_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/usage_info_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/usage_info_controller_api.cpython-311.pyc new file mode 100644 index 0000000..ab95830 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/usage_info_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/user_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/user_controller_api.cpython-311.pyc new file mode 100644 index 0000000..8423982 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/user_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/widget_type_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/widget_type_controller_api.cpython-311.pyc new file mode 100644 index 0000000..14935f8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/widget_type_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/widgets_bundle_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/widgets_bundle_controller_api.cpython-311.pyc new file mode 100644 index 0000000..ad5b585 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_ce/__pycache__/widgets_bundle_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/admin_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/admin_controller_api.py new file mode 100644 index 0000000..17a3a6a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/admin_controller_api.py @@ -0,0 +1,1944 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AdminControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def auto_commit_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def auto_commit_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method auto_commit_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_repository_access_using_post(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_repository_access_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_repository_access_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/checkAccess', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_updates_using_get(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def check_updates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_updates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UpdateMessage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_auto_commit_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_auto_commit_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_auto_commit_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_repository_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_repository_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_repository_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_admin_settings_using_get(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + else: + (data) = self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + return data + + def get_admin_settings_using_get_with_http_info(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get_with_http_info(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_admin_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'key' is set + if ('key' not in params or + params['key'] is None): + raise ValueError("Missing the required parameter `key` when calling `get_admin_settings_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'key' in params: + path_params['key'] = params['key'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/{key}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_commit_settings_using_get(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_commit_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_commit_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_features_info_using_get(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_features_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_features_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/featuresInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FeaturesInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_jwt_settings_using_get(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_jwt_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_jwt_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_info_using_get(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettingsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_using_get(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_security_settings_using_get(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_security_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_security_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_system_info_using_get(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_system_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_system_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/systemInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SystemInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def repository_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def repository_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method repository_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_admin_settings_using_post(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_admin_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_admin_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_auto_commit_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_auto_commit_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_auto_commit_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_jwt_settings_using_post(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_jwt_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_jwt_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_repository_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_repository_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_repository_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultRepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_security_settings_using_post(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_security_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_security_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_mail_using_post(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. You may change the 'To' email in the user profile of the System Administrator. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_mail_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email to the System Administrator User using Mail Settings provided as a parameter. You may change the 'To' email in the user profile of the System Administrator. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_mail_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testMail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_sms_using_post(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_sms_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_sms_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testSms', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/alarm_comment_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/alarm_comment_controller_api.py new file mode 100644 index 0000000..9f65853 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/alarm_comment_controller_api.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmCommentControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_alarm_comment_using_delete(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_comment_using_delete_with_http_info(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'comment_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_comment_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + # verify the required parameter 'comment_id' is set + if ('comment_id' not in params or + params['comment_id'] is None): + raise ValueError("Missing the required parameter `comment_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'comment_id' in params: + path_params['commentId'] = params['comment_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment/{commentId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_comments_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarm_comments_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_comments_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarm_comments_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment{?page,pageSize,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmCommentInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_comment_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def save_alarm_comment_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_comment_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `save_alarm_comment_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmComment', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/alarm_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/alarm_controller_api.py new file mode 100644 index 0000000..4739127 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/alarm_controller_api.py @@ -0,0 +1,1518 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def ack_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def ack_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method ack_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `ack_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/ack', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_alarm_using_post(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + return data + + def assign_alarm_using_post_with_http_info(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `assign_alarm_using_post`") # noqa: E501 + # verify the required parameter 'assignee_id' is set + if ('assignee_id' not in params or + params['assignee_id'] is None): + raise ValueError("Missing the required parameter `assignee_id` when calling `assign_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'assignee_id' in params: + path_params['assigneeId'] = params['assignee_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign/{assigneeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def clear_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def clear_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `clear_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/clear', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_info_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_info_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. If the user has the authority of 'Tenant Administrator', the server checks that the originator of alarm is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the originator of alarm belongs to the customer. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/info/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{entityType}/{entityId}{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_v2_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_v2_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarm/{entityType}/{entityId}{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarms{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_v2_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_v2_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarms{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_highest_alarm_severity_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_highest_alarm_severity_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'search_status', 'status', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_highest_alarm_severity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/highestSeverity/{entityType}/{entityId}{?assigneeId,searchStatus,status}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_using_post(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_alarm_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def unassign_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `unassign_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/asset_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/asset_controller_api.py new file mode 100644 index 0000000..12d7142 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/asset_controller_api.py @@ -0,0 +1,2028 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_asset_to_customer_using_post(self, customer_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to customer (assignAssetToCustomer) # noqa: E501 + + Creates assignment of the asset to customer. Customer will be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_customer_using_post(customer_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_asset_to_customer_using_post_with_http_info(customer_id, asset_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_asset_to_customer_using_post_with_http_info(customer_id, asset_id, **kwargs) # noqa: E501 + return data + + def assign_asset_to_customer_using_post_with_http_info(self, customer_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to customer (assignAssetToCustomer) # noqa: E501 + + Creates assignment of the asset to customer. Customer will be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_customer_using_post_with_http_info(customer_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_asset_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_asset_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `assign_asset_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/asset/{assetId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_asset_to_edge_using_post(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to edge (assignAssetToEdge) # noqa: E501 + + Creates assignment of an existing asset to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once asset will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_edge_using_post(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_asset_to_edge_using_post_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_asset_to_edge_using_post_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + return data + + def assign_asset_to_edge_using_post_with_http_info(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Assign asset to edge (assignAssetToEdge) # noqa: E501 + + Creates assignment of an existing asset to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once asset will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_edge_using_post_with_http_info(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_asset_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_asset_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `assign_asset_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/asset/{assetId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_asset_to_public_customer_using_post(self, asset_id, **kwargs): # noqa: E501 + """Make asset publicly available (assignAssetToPublicCustomer) # noqa: E501 + + Asset will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_public_customer_using_post(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_asset_to_public_customer_using_post_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_asset_to_public_customer_using_post_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def assign_asset_to_public_customer_using_post_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Make asset publicly available (assignAssetToPublicCustomer) # noqa: E501 + + Asset will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_asset_to_public_customer_using_post_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_asset_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `assign_asset_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/asset/{assetId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_asset_using_delete(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def delete_asset_using_delete_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `delete_asset_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_info_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_info_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/info/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_types_using_get(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_asset_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_assets_by_ids_using_get(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing 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 = api.get_assets_by_ids_using_get(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of assets ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + return data + + def get_assets_by_ids_using_get_with_http_info(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing 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 = api.get_assets_by_ids_using_get_with_http_info(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of assets ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_assets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_ids' is set + if ('asset_ids' not in params or + params['asset_ids'] is None): + raise ValueError("Missing the required parameter `asset_ids` when calling `get_assets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_ids' in params: + query_params.append(('assetIds', params['asset_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets{?assetIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_asset_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of assets info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_asset_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of assets info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assetInfos{?assetProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_assets_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_assets_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_assets_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get assets assigned to edge (getEdgeAssets) # noqa: E501 + + Returns a page of assets assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_assets_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Assets with creation time before it won't be queried + :param int end_time: Timestamp. Assets with creation time after it won't be queried + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_assets_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_assets_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_assets_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get assets assigned to edge (getEdgeAssets) # noqa: E501 + + Returns a page of assets assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_assets_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Assets with creation time before it won't be queried + :param int end_time: Timestamp. Assets with creation time after it won't be queried + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_assets_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/assets{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_asset_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Asset Infos (getTenantAssetInfos) # noqa: E501 + + Returns a page of assets info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_asset_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Asset Infos (getTenantAssetInfos) # noqa: E501 + + Returns a page of assets info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assetInfos{?assetProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_asset_using_get(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + return data + + def get_tenant_asset_using_get_with_http_info(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get_with_http_info(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_asset_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_name' is set + if ('asset_name' not in params or + params['asset_name'] is None): + raise ValueError("Missing the required parameter `asset_name` when calling `get_tenant_asset_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_name' in params: + query_params.append(('assetName', params['asset_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?assetName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_assets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_assets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_assets_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_assets_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_assets_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_assets_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_assets_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_assets_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_assets_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_asset_from_customer_using_delete(self, asset_id, **kwargs): # noqa: E501 + """Unassign asset from customer (unassignAssetFromCustomer) # noqa: E501 + + Clears assignment of the asset to customer. Customer will not be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_customer_using_delete(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_asset_from_customer_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_asset_from_customer_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def unassign_asset_from_customer_using_delete_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Unassign asset from customer (unassignAssetFromCustomer) # noqa: E501 + + Clears assignment of the asset to customer. Customer will not be able to query asset afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_customer_using_delete_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_asset_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `unassign_asset_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_asset_from_edge_using_delete(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Unassign asset from edge (unassignAssetFromEdge) # noqa: E501 + + Clears assignment of the asset to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove asset locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_edge_using_delete(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_asset_from_edge_using_delete_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_asset_from_edge_using_delete_with_http_info(edge_id, asset_id, **kwargs) # noqa: E501 + return data + + def unassign_asset_from_edge_using_delete_with_http_info(self, edge_id, asset_id, **kwargs): # noqa: E501 + """Unassign asset from edge (unassignAssetFromEdge) # noqa: E501 + + Clears assignment of the asset to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove asset (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove asset locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_asset_from_edge_using_delete_with_http_info(edge_id, asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_asset_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_asset_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `unassign_asset_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/asset_profile_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/asset_profile_controller_api.py new file mode 100644 index 0000000..3203879 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/asset_profile_controller_api.py @@ -0,0 +1,839 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_asset_profile_using_delete(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def delete_asset_profile_using_delete_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `delete_asset_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_info_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_info_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_asset_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_asset_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_asset_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_asset_profile_using_post(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_asset_profile_using_post_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `set_default_asset_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/audit_log_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/audit_log_controller_api.py new file mode 100644 index 0000000..84c91fd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/audit_log_controller_api.py @@ -0,0 +1,587 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuditLogControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_audit_logs_by_customer_id_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_customer_id_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_customer_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/customer/{customerId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_entity_id_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_entity_id_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_entity_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/entity/{entityType}/{entityId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_user_id_using_get(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_user_id_using_get_with_http_info(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_user_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/user/{userId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/auth_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/auth_controller_api.py new file mode 100644 index 0000000..816f026 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/auth_controller_api.py @@ -0,0 +1,882 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def activate_user_using_post(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def activate_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def change_password_using_post(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def change_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/changePassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ObjectNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_activate_token_using_get(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + else: + (data) = self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + return data + + def check_activate_token_using_get_with_http_info(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get_with_http_info(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['activate_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_activate_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'activate_token' is set + if ('activate_token' not in params or + params['activate_token'] is None): + raise ValueError("Missing the required parameter `activate_token` when calling `check_activate_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'activate_token' in params: + query_params.append(('activateToken', params['activate_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?activateToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_reset_token_using_get(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + else: + (data) = self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + return data + + def check_reset_token_using_get_with_http_info(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get_with_http_info(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['reset_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_reset_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'reset_token' is set + if ('reset_token' not in params or + params['reset_token'] is None): + raise ValueError("Missing the required parameter `reset_token` when calling `check_reset_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'reset_token' in params: + query_params.append(('resetToken', params['reset_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword{?resetToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_password_policy_using_get(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_password_policy_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_password_policy_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/userPasswordPolicy', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserPasswordPolicy', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_using_get(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/user', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def logout_using_post(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def logout_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/logout', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_reset_password_by_email_using_post(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def request_reset_password_by_email_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_reset_password_by_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPasswordByEmail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reset_password_using_post(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def reset_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reset_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/component_descriptor_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/component_descriptor_controller_api.py new file mode 100644 index 0000000..bb75454 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/component_descriptor_controller_api.py @@ -0,0 +1,340 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ComponentDescriptorControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_component_descriptor_by_clazz_using_get(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + return data + + def get_component_descriptor_by_clazz_using_get_with_http_info(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_descriptor_clazz'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptor_by_clazz_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_descriptor_clazz' is set + if ('component_descriptor_clazz' not in params or + params['component_descriptor_clazz'] is None): + raise ValueError("Missing the required parameter `component_descriptor_clazz` when calling `get_component_descriptor_by_clazz_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_descriptor_clazz' in params: + path_params['componentDescriptorClazz'] = params['component_descriptor_clazz'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/component/{componentDescriptorClazz}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ComponentDescriptor', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_type_using_get(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_type_using_get_with_http_info(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get_with_http_info(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_type', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_type' is set + if ('component_type' not in params or + params['component_type'] is None): + raise ValueError("Missing the required parameter `component_type` when calling `get_component_descriptors_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_type' in params: + path_params['componentType'] = params['component_type'] # noqa: E501 + + query_params = [] + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components/{componentType}{?ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_types_using_get(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_types_using_get_with_http_info(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get_with_http_info(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_types', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_types' is set + if ('component_types' not in params or + params['component_types'] is None): + raise ValueError("Missing the required parameter `component_types` when calling `get_component_descriptors_by_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'component_types' in params: + query_params.append(('componentTypes', params['component_types'])) # noqa: E501 + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components{?componentTypes,ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/customer_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/customer_controller_api.py new file mode 100644 index 0000000..cc5c37a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/customer_controller_api.py @@ -0,0 +1,731 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomerControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_customer_using_delete(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def delete_customer_using_delete_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `delete_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_title_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_title_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_title_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_title_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/text']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/title', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_customers_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customers_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customers_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_short_customer_info_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_short_customer_info_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_short_customer_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_short_customer_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/shortInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_customer_using_get(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + return data + + def get_tenant_customer_using_get_with_http_info(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get_with_http_info(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_title'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_customer_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_title' is set + if ('customer_title' not in params or + params['customer_title'] is None): + raise ValueError("Missing the required parameter `customer_title` when calling `get_tenant_customer_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'customer_title' in params: + query_params.append(('customerTitle', params['customer_title'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/customers{?customerTitle}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_customer_using_post(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_customer_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/dashboard_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/dashboard_controller_api.py new file mode 100644 index 0000000..265dd6c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/dashboard_controller_api.py @@ -0,0 +1,2360 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DashboardControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_dashboard_customers_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Adds the Dashboard Customers (addDashboardCustomers) # noqa: E501 + + Adds the list of Customers to the existing list of assignments for the Dashboard. Keeps previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dashboard_customers_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.add_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.add_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def add_dashboard_customers_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Adds the Dashboard Customers (addDashboardCustomers) # noqa: E501 + + Adds the list of Customers to the existing list of assignments for the Dashboard. Keeps previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_dashboard_customers_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_dashboard_customers_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `add_dashboard_customers_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}/customers/add', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_dashboard_to_customer_using_post(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard (assignDashboardToCustomer) # noqa: E501 + + Assign the Dashboard to specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_customer_using_post(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_dashboard_to_customer_using_post_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_dashboard_to_customer_using_post_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def assign_dashboard_to_customer_using_post_with_http_info(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard (assignDashboardToCustomer) # noqa: E501 + + Assign the Dashboard to specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_customer_using_post_with_http_info(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_dashboard_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_dashboard_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `assign_dashboard_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboard/{dashboardId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_dashboard_to_edge_using_post(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Assign dashboard to edge (assignDashboardToEdge) # noqa: E501 + + Creates assignment of an existing dashboard to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once dashboard will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_edge_using_post(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_dashboard_to_edge_using_post_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_dashboard_to_edge_using_post_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def assign_dashboard_to_edge_using_post_with_http_info(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Assign dashboard to edge (assignDashboardToEdge) # noqa: E501 + + Creates assignment of an existing dashboard to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once dashboard will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_edge_using_post_with_http_info(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_dashboard_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_dashboard_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `assign_dashboard_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/dashboard/{dashboardId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_dashboard_to_public_customer_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard to Public Customer (assignDashboardToPublicCustomer) # noqa: E501 + + Assigns the dashboard to a special, auto-generated 'Public' Customer. Once assigned, unauthenticated users may browse the dashboard. This method is useful if you like to embed the dashboard on public web pages to be available for users that are not logged in. Be aware that making the dashboard public does not mean that it automatically makes all devices and assets you use in the dashboard to be public.Use [assign Asset to Public Customer](#!/asset-controller/assignAssetToPublicCustomerUsingPOST) and [assign Device to Public Customer](#!/device-controller/assignDeviceToPublicCustomerUsingPOST) for this purpose. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_public_customer_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_dashboard_to_public_customer_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_dashboard_to_public_customer_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def assign_dashboard_to_public_customer_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Assign the Dashboard to Public Customer (assignDashboardToPublicCustomer) # noqa: E501 + + Assigns the dashboard to a special, auto-generated 'Public' Customer. Once assigned, unauthenticated users may browse the dashboard. This method is useful if you like to embed the dashboard on public web pages to be available for users that are not logged in. Be aware that making the dashboard public does not mean that it automatically makes all devices and assets you use in the dashboard to be public.Use [assign Asset to Public Customer](#!/asset-controller/assignAssetToPublicCustomerUsingPOST) and [assign Device to Public Customer](#!/device-controller/assignDeviceToPublicCustomerUsingPOST) for this purpose. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_dashboard_to_public_customer_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_dashboard_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `assign_dashboard_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/dashboard/{dashboardId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_dashboard_using_delete(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def delete_dashboard_using_delete_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_dashboard_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `delete_dashboard_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_dashboards_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_dashboards_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboards{?mobile,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_info_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_info_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/info/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_dashboards_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Dashboards (getEdgeDashboards) # noqa: E501 + + Returns a page of dashboard info objects assigned to the specified edge. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_dashboards_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_dashboards_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_dashboards_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_dashboards_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Dashboards (getEdgeDashboards) # noqa: E501 + + Returns a page of dashboard info objects assigned to the specified edge. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_dashboards_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_max_datapoints_limit_using_get(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_max_datapoints_limit_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_max_datapoints_limit_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/maxDatapointsLimit', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_server_time_using_get(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_server_time_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_server_time_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/serverTime', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboards{?mobile,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get1(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get1_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_dashboard_customers_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Remove the Dashboard Customers (removeDashboardCustomers) # noqa: E501 + + Removes the list of Customers from the existing list of assignments for the Dashboard. Keeps other assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dashboard_customers_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.remove_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.remove_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def remove_dashboard_customers_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Remove the Dashboard Customers (removeDashboardCustomers) # noqa: E501 + + Removes the list of Customers from the existing list of assignments for the Dashboard. Keeps other assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_dashboard_customers_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_dashboard_customers_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `remove_dashboard_customers_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}/customers/remove', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_dashboard_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_dashboard_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_dashboard_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_tenant_home_dashboard_info_using_post(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def set_tenant_home_dashboard_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_tenant_home_dashboard_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_dashboard_from_customer_using_delete(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard (unassignDashboardFromCustomer) # noqa: E501 + + Unassign the Dashboard from specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_customer_using_delete(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_dashboard_from_customer_using_delete_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_dashboard_from_customer_using_delete_with_http_info(customer_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def unassign_dashboard_from_customer_using_delete_with_http_info(self, customer_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard (unassignDashboardFromCustomer) # noqa: E501 + + Unassign the Dashboard from specified Customer or do nothing if the Dashboard is already assigned to that Customer. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_customer_using_delete_with_http_info(customer_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_dashboard_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `unassign_dashboard_from_customer_using_delete`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `unassign_dashboard_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_dashboard_from_edge_using_delete(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign dashboard from edge (unassignDashboardFromEdge) # noqa: E501 + + Clears assignment of the dashboard to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove dashboard locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_edge_using_delete(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_dashboard_from_edge_using_delete_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_dashboard_from_edge_using_delete_with_http_info(edge_id, dashboard_id, **kwargs) # noqa: E501 + return data + + def unassign_dashboard_from_edge_using_delete_with_http_info(self, edge_id, dashboard_id, **kwargs): # noqa: E501 + """Unassign dashboard from edge (unassignDashboardFromEdge) # noqa: E501 + + Clears assignment of the dashboard to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove dashboard (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove dashboard locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_edge_using_delete_with_http_info(edge_id, dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str dashboard_id: dashboardId (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_dashboard_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_dashboard_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `unassign_dashboard_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_dashboard_from_public_customer_using_delete(self, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard from Public Customer (unassignDashboardFromPublicCustomer) # noqa: E501 + + Unassigns the dashboard from a special, auto-generated 'Public' Customer. Once unassigned, unauthenticated users may no longer browse the dashboard. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_public_customer_using_delete(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_dashboard_from_public_customer_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_dashboard_from_public_customer_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def unassign_dashboard_from_public_customer_using_delete_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Unassign the Dashboard from Public Customer (unassignDashboardFromPublicCustomer) # noqa: E501 + + Unassigns the dashboard from a special, auto-generated 'Public' Customer. Once unassigned, unauthenticated users may no longer browse the dashboard. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_dashboard_from_public_customer_using_delete_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_dashboard_from_public_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `unassign_dashboard_from_public_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_dashboard_customers_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """Update the Dashboard Customers (updateDashboardCustomers) # noqa: E501 + + Updates the list of Customers that this Dashboard is assigned to. Removes previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_dashboard_customers_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.update_dashboard_customers_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def update_dashboard_customers_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Update the Dashboard Customers (updateDashboardCustomers) # noqa: E501 + + Updates the list of Customers that this Dashboard is assigned to. Removes previous assignments to customers that are not in the provided list. Returns the Dashboard object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_dashboard_customers_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_dashboard_customers_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `update_dashboard_customers_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}/customers', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/device_api_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/device_api_controller_api.py new file mode 100644 index 0000000..0379c8b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/device_api_controller_api.py @@ -0,0 +1,1212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceApiControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def claim_device_using_post(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def claim_device_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `claim_device_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/claim', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_attributes_using_get(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + else: + (data) = self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + return data + + def get_device_attributes_using_get_with_http_info(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'client_keys', 'shared_keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'client_keys' is set + if ('client_keys' not in params or + params['client_keys'] is None): + raise ValueError("Missing the required parameter `client_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'shared_keys' is set + if ('shared_keys' not in params or + params['shared_keys'] is None): + raise ValueError("Missing the required parameter `shared_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'client_keys' in params: + query_params.append(('clientKeys', params['client_keys'])) # noqa: E501 + if 'shared_keys' in params: + query_params.append(('sharedKeys', params['shared_keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes{?clientKeys,sharedKeys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_firmware_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_firmware_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_firmware_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_firmware_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/firmware{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_software_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_software_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_software_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_software_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/software{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_device_attributes_using_post(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_device_attributes_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_rpc_request_using_post(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_rpc_request_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_telemetry_using_post(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_telemetry_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/telemetry', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def provision_device_using_post(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def provision_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method provision_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/provision', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reply_to_command_using_post(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + else: + (data) = self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + return data + + def reply_to_command_using_post_with_http_info(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post_with_http_info(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'request_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reply_to_command_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `reply_to_command_using_post`") # noqa: E501 + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `reply_to_command_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc/{requestId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_attributes_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_attributes_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes/updates{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_commands_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_commands_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_commands_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_commands_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/device_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/device_controller_api.py new file mode 100644 index 0000000..8c37513 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/device_controller_api.py @@ -0,0 +1,2737 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_device_to_customer_using_post(self, customer_id, device_id, **kwargs): # noqa: E501 + """Assign device to customer (assignDeviceToCustomer) # noqa: E501 + + Creates assignment of the device to customer. Customer will be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_customer_using_post(customer_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_customer_using_post_with_http_info(customer_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_customer_using_post_with_http_info(customer_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_customer_using_post_with_http_info(self, customer_id, device_id, **kwargs): # noqa: E501 + """Assign device to customer (assignDeviceToCustomer) # noqa: E501 + + Creates assignment of the device to customer. Customer will be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_customer_using_post_with_http_info(customer_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_device_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_device_to_edge_using_post(self, edge_id, device_id, **kwargs): # noqa: E501 + """Assign device to edge (assignDeviceToEdge) # noqa: E501 + + Creates assignment of an existing device to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once device will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_edge_using_post(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_edge_using_post_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_edge_using_post_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_edge_using_post_with_http_info(self, edge_id, device_id, **kwargs): # noqa: E501 + """Assign device to edge (assignDeviceToEdge) # noqa: E501 + + Creates assignment of an existing device to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once device will be delivered to edge service, it's going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_edge_using_post_with_http_info(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_device_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_device_to_public_customer_using_post(self, device_id, **kwargs): # noqa: E501 + """Make device publicly available (assignDeviceToPublicCustomer) # noqa: E501 + + Device will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_public_customer_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_public_customer_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_public_customer_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_public_customer_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Make device publicly available (assignDeviceToPublicCustomer) # noqa: E501 + + Device will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_public_customer_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_device_to_tenant_using_post(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_tenant_using_post_with_http_info(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def claim_device_using_post1(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def claim_device_using_post1_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `claim_device_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_by_device_profile_and_empty_ota_package_using_get(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + return data + + def count_by_device_profile_and_empty_ota_package_using_get_with_http_info(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_type', 'device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_by_device_profile_and_empty_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_type' is set + if ('ota_package_type' not in params or + params['ota_package_type'] is None): + raise ValueError("Missing the required parameter `ota_package_type` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_type' in params: + path_params['otaPackageType'] = params['ota_package_type'] # noqa: E501 + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices/count/{otaPackageType}/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_device_using_delete(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def delete_device_using_delete_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post1(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_device_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of devices info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_device_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of devices info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/deviceInfos{?active,deviceProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_devices_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_devices_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. If the user has the authority of 'TENANT_ADMIN', the server checks that the device is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the device is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. If the user has the authority of 'TENANT_ADMIN', the server checks that the device is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the device is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_credentials_by_device_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_credentials_by_device_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_credentials_by_device_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_credentials_by_device_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}/credentials', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_info_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device Info (getDeviceInfoById) # noqa: E501 + + Fetch the Device Info object based on the provided Device Id. If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_info_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device Info (getDeviceInfoById) # noqa: E501 + + Fetch the Device Info object based on the provided Device Id. If the user has the authority of 'Tenant Administrator', the server checks that the device is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the device is assigned to the same customer. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/info/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_types_using_get(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_device_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_devices_by_ids_using_get(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + return data + + def get_devices_by_ids_using_get_with_http_info(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get_with_http_info(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_devices_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_ids' is set + if ('device_ids' not in params or + params['device_ids'] is None): + raise ValueError("Missing the required parameter `device_ids` when calling `get_devices_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_ids' in params: + query_params.append(('deviceIds', params['device_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices{?deviceIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_devices_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get devices assigned to edge (getEdgeDevices) # noqa: E501 + + Returns a page of devices assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_devices_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Devices with creation time before it won't be queried + :param int end_time: Timestamp. Devices with creation time after it won't be queried + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_devices_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_devices_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_devices_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get devices assigned to edge (getEdgeDevices) # noqa: E501 + + Returns a page of devices assigned to edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_devices_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Devices with creation time before it won't be queried + :param int end_time: Timestamp. Devices with creation time after it won't be queried + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'type', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_devices_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/devices{?active,deviceProfileId,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_device_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Device Infos (getTenantDeviceInfos) # noqa: E501 + + Returns a page of devices info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_device_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Device Infos (getTenantDeviceInfos) # noqa: E501 + + Returns a page of devices info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Info is an extension of the default Device object that contains information about the assigned customer name and device profile name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/deviceInfos{?active,deviceProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_device_using_get(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def get_tenant_device_using_get_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `get_tenant_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_name' in params: + query_params.append(('deviceName', params['device_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?deviceName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_devices_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_devices_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_devices_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_devices_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_devices_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def re_claim_device_using_delete(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def re_claim_device_using_delete_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method re_claim_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `re_claim_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'access_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'access_token' in params: + query_params.append(('accessToken', params['access_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device{?accessToken}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_with_credentials_using_post(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_with_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_with_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device-with-credentials', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_device_from_customer_using_delete(self, device_id, **kwargs): # noqa: E501 + """Unassign device from customer (unassignDeviceFromCustomer) # noqa: E501 + + Clears assignment of the device to customer. Customer will not be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_customer_using_delete(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_device_from_customer_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_device_from_customer_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def unassign_device_from_customer_using_delete_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Unassign device from customer (unassignDeviceFromCustomer) # noqa: E501 + + Clears assignment of the device to customer. Customer will not be able to query device afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_customer_using_delete_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_device_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `unassign_device_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_device_from_edge_using_delete(self, edge_id, device_id, **kwargs): # noqa: E501 + """Unassign device from edge (unassignDeviceFromEdge) # noqa: E501 + + Clears assignment of the device to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove device locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_edge_using_delete(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_device_from_edge_using_delete_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_device_from_edge_using_delete_with_http_info(edge_id, device_id, **kwargs) # noqa: E501 + return data + + def unassign_device_from_edge_using_delete_with_http_info(self, edge_id, device_id, **kwargs): # noqa: E501 + """Unassign device from edge (unassignDeviceFromEdge) # noqa: E501 + + Clears assignment of the device to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove device (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove device locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_device_from_edge_using_delete_with_http_info(edge_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_device_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_device_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `unassign_device_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_device_credentials_using_post(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def update_device_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_device_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/credentials', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/device_profile_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/device_profile_controller_api.py new file mode 100644 index 0000000..f7d31c0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/device_profile_controller_api.py @@ -0,0 +1,1025 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_profile_using_delete(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def delete_device_profile_using_delete_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `delete_device_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_keys_using_get(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_attributes_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/attributes{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_device_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_device_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_device_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_info_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_info_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'transport_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'transport_type' in params: + query_params.append(('transportType', params['transport_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch,transportType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/timeseries{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_device_profile_using_post(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_device_profile_using_post_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `set_default_device_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/edge_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/edge_controller_api.py new file mode 100644 index 0000000..e5459e3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/edge_controller_api.py @@ -0,0 +1,2269 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_edge_to_customer_using_post(self, customer_id, edge_id, **kwargs): # noqa: E501 + """Assign edge to customer (assignEdgeToCustomer) # noqa: E501 + + Creates assignment of the edge to customer. Customer will be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_customer_using_post(customer_id, edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_edge_to_customer_using_post_with_http_info(customer_id, edge_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_edge_to_customer_using_post_with_http_info(customer_id, edge_id, **kwargs) # noqa: E501 + return data + + def assign_edge_to_customer_using_post_with_http_info(self, customer_id, edge_id, **kwargs): # noqa: E501 + """Assign edge to customer (assignEdgeToCustomer) # noqa: E501 + + Creates assignment of the edge to customer. Customer will be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_customer_using_post_with_http_info(customer_id, edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_edge_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_edge_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_edge_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edge/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_edge_to_public_customer_using_post(self, edge_id, **kwargs): # noqa: E501 + """Make edge publicly available (assignEdgeToPublicCustomer) # noqa: E501 + + Edge will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_public_customer_using_post(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_edge_to_public_customer_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_edge_to_public_customer_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def assign_edge_to_public_customer_using_post_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Make edge publicly available (assignEdgeToPublicCustomer) # noqa: E501 + + Edge will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_edge_to_public_customer_using_post_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_edge_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_edge_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/edge/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_edge_using_delete(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def delete_edge_using_delete_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `delete_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post2(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post2_with_http_info(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post2" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_missing_to_related_rule_chains_using_get(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def find_missing_to_related_rule_chains_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_missing_to_related_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `find_missing_to_related_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/missingToRelatedRuleChains/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edge_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edges info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edge_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edges info objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edgeInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edges_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edges_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_docker_install_instructions_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_docker_install_instructions_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_docker_install_instructions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_docker_install_instructions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/instructions/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInstallInstructions', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_info_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge Info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_info_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge Info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/info/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_types_using_get(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_edge_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_by_ids_using_get(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + return data + + def get_edges_by_ids_using_get_with_http_info(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get_with_http_info(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_ids' is set + if ('edge_ids' not in params or + params['edge_ids'] is None): + raise ValueError("Missing the required parameter `edge_ids` when calling `get_edges_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_ids' in params: + query_params.append(('edgeIds', params['edge_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?edgeIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edge_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edge Infos (getTenantEdgeInfos) # noqa: E501 + + Returns a page of edges info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_edge_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edge Infos (getTenantEdgeInfos) # noqa: E501 + + Returns a page of edges info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Edge Info is an extension of the default Edge object that contains information about the assigned customer name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edgeInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edge_using_get(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + return data + + def get_tenant_edge_using_get_with_http_info(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get_with_http_info(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edge_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_name' is set + if ('edge_name' not in params or + params['edge_name'] is None): + raise ValueError("Missing the required parameter `edge_name` when calling `get_tenant_edge_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_name' in params: + query_params.append(('edgeName', params['edge_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?edgeName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_edges_support_enabled_using_get(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_edges_support_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_edges_support_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges/enabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_edges_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_edges_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_edges_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_edge_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_edge_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_root_rule_chain_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_root_rule_chain_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def sync_edge_using_post(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def sync_edge_using_post_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method sync_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `sync_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/sync/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_edge_from_customer_using_delete(self, edge_id, **kwargs): # noqa: E501 + """Unassign edge from customer (unassignEdgeFromCustomer) # noqa: E501 + + Clears assignment of the edge to customer. Customer will not be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_edge_from_customer_using_delete(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_edge_from_customer_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_edge_from_customer_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def unassign_edge_from_customer_using_delete_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Unassign edge from customer (unassignEdgeFromCustomer) # noqa: E501 + + Clears assignment of the edge to customer. Customer will not be able to query edge afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_edge_from_customer_using_delete_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_edge_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_edge_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/edge/{edgeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/edge_event_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/edge_event_controller_api.py new file mode 100644 index 0000000..d005dee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/edge_event_controller_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeEventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_edge_events_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_events_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/events{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/entities_version_control_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/entities_version_control_controller_api.py new file mode 100644 index 0000000..db55a3c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/entities_version_control_controller_api.py @@ -0,0 +1,1327 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntitiesVersionControlControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def compare_entity_data_to_version_using_get(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + else: + (data) = self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + return data + + def compare_entity_data_to_version_using_get_with_http_info(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'internal_entity_uuid', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method compare_entity_data_to_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'internal_entity_uuid' is set + if ('internal_entity_uuid' not in params or + params['internal_entity_uuid'] is None): + raise ValueError("Missing the required parameter `internal_entity_uuid` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'internal_entity_uuid' in params: + path_params['internalEntityUuid'] = params['internal_entity_uuid'] # noqa: E501 + + query_params = [] + if 'version_id' in params: + query_params.append(('versionId', params['version_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/diff/{entityType}/{internalEntityUuid}{?versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataDiff', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_data_info_using_get(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes) and `hasCredentials` (whether stored device data has credentials). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + return data + + def get_entity_data_info_using_get_with_http_info(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes) and `hasCredentials` (whether stored device data has credentials). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id', 'entity_type', 'external_entity_uuid'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_data_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `get_entity_data_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/info/{versionId}/{entityType}/{externalEntityUuid}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_create_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_create_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_create_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_create_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionCreationResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_load_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_load_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_load_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_load_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionLoadResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_all_entities_at_version_using_get(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + return data + + def list_all_entities_at_version_using_get_with_http_info(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get_with_http_info(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_all_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_all_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_branches_using_get(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def list_branches_using_get_with_http_info(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_branches_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/branches', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListBranchInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entities_at_version_using_get(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + return data + + def list_entities_at_version_using_get_with_http_info(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get_with_http_info(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entities_at_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{entityType}/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_type_versions_using_get(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_type_versions_using_get_with_http_info(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_type_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_type_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_versions_using_get(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_versions_using_get_with_http_info(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'external_entity_uuid', 'branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}/{externalEntityUuid}?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_versions_using_get(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_versions_using_get_with_http_info(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get_with_http_info(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def load_entities_version_using_post(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation). An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def load_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation). An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method load_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entities_version_using_post(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify the list of specific entities (`entityIds`); - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify the list of specific entities (`entityIds`); - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultuuid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/entity_query_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/entity_query_controller_api.py new file mode 100644 index 0000000..d03683f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/entity_query_controller_api.py @@ -0,0 +1,538 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityQueryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def count_alarms_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_alarms_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_alarms_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_entities_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_entities_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_entities_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_alarm_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_alarm_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_alarm_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_entity_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_timeseries_and_attributes_keys_by_query_using_post(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + else: + (data) = self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + return data + + def find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['timeseries', 'attributes', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_timeseries_and_attributes_keys_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'timeseries' is set + if ('timeseries' not in params or + params['timeseries'] is None): + raise ValueError("Missing the required parameter `timeseries` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + # verify the required parameter 'attributes' is set + if ('attributes' not in params or + params['attributes'] is None): + raise ValueError("Missing the required parameter `attributes` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'timeseries' in params: + query_params.append(('timeseries', params['timeseries'])) # noqa: E501 + if 'attributes' in params: + query_params.append(('attributes', params['attributes'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find/keys{?attributes,timeseries}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/entity_relation_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/entity_relation_controller_api.py new file mode 100644 index 0000000..90f7257 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/entity_relation_controller_api.py @@ -0,0 +1,1355 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityRelationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_relation_using_delete(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def delete_relation_using_delete_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relation_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `delete_relation_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_relations_using_delete(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + return data + + def delete_relations_using_delete_with_http_info(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete_with_http_info(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_id', 'entity_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relations_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_relations_using_delete`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_relations_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_id' in params: + query_params.append(('entityId', params['entity_id'])) # noqa: E501 + if 'entity_type' in params: + query_params.append(('entityType', params['entity_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?entityId,entityType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get_with_http_info(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get1(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get1_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get1`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post3(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post3_with_http_info(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post3" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get_with_http_info(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get1(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get1_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get1`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_from_using_get(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_info_by_from_using_get_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_info_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_info_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_info_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_to_using_get(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_info_by_to_using_get_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_info_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_info_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_relation_using_get(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def get_relation_using_get_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_relation_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `get_relation_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityRelation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_relation_using_post(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_relation_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_relation_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/entity_view_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/entity_view_controller_api.py new file mode 100644 index 0000000..fb567b9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/entity_view_controller_api.py @@ -0,0 +1,1828 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityViewControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_entity_view_to_customer_using_post(self, customer_id, entity_view_id, **kwargs): # noqa: E501 + """Assign Entity View to customer (assignEntityViewToCustomer) # noqa: E501 + + Creates assignment of the Entity View to customer. Customer will be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_customer_using_post(customer_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_view_to_customer_using_post_with_http_info(customer_id, entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_view_to_customer_using_post_with_http_info(customer_id, entity_view_id, **kwargs) # noqa: E501 + return data + + def assign_entity_view_to_customer_using_post_with_http_info(self, customer_id, entity_view_id, **kwargs): # noqa: E501 + """Assign Entity View to customer (assignEntityViewToCustomer) # noqa: E501 + + Creates assignment of the Entity View to customer. Customer will be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_customer_using_post_with_http_info(customer_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_view_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `assign_entity_view_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `assign_entity_view_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityView/{entityViewId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_entity_view_to_edge_using_post(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Assign entity view to edge (assignEntityViewToEdge) # noqa: E501 + + Creates assignment of an existing entity view to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity view will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_edge_using_post(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_view_to_edge_using_post_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_view_to_edge_using_post_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + return data + + def assign_entity_view_to_edge_using_post_with_http_info(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Assign entity view to edge (assignEntityViewToEdge) # noqa: E501 + + Creates assignment of an existing entity view to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity view will be delivered to edge service, it's going to be available for usage on remote edge instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_edge_using_post_with_http_info(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_view_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_entity_view_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `assign_entity_view_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityView/{entityViewId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_entity_view_to_public_customer_using_post(self, entity_view_id, **kwargs): # noqa: E501 + """Make entity view publicly available (assignEntityViewToPublicCustomer) # noqa: E501 + + Entity View will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the entity view. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_public_customer_using_post(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_view_to_public_customer_using_post_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_view_to_public_customer_using_post_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def assign_entity_view_to_public_customer_using_post_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Make entity view publicly available (assignEntityViewToPublicCustomer) # noqa: E501 + + Entity View will be available for non-authorized (not logged-in) users. This is useful to create dashboards that you plan to share/embed on a publicly available website. However, users that are logged-in and belong to different tenant will not be able to access the entity view. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_view_to_public_customer_using_post_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_view_to_public_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `assign_entity_view_to_public_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/public/entityView/{entityViewId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_view_using_delete(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def delete_entity_view_using_delete_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_view_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `delete_entity_view_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post4(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post4_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post4" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViews', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityView]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_view_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View info (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of Entity View info objects assigned to customer. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_view_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View info (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of Entity View info objects assigned to customer. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViewInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_views_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_views_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_entity_views_using_get(self, edge_id, page, page_size, **kwargs): # noqa: E501 + """getEdgeEntityViews # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_views_using_get(edge_id, page, page_size, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str page: page (required) + :param str page_size: pageSize (required) + :param str type: type + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :param int start_time: startTime + :param int end_time: endTime + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_entity_views_using_get_with_http_info(edge_id, page, page_size, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_entity_views_using_get_with_http_info(edge_id, page, page_size, **kwargs) # noqa: E501 + return data + + def get_edge_entity_views_using_get_with_http_info(self, edge_id, page, page_size, **kwargs): # noqa: E501 + """getEdgeEntityViews # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_views_using_get_with_http_info(edge_id, page, page_size, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str page: page (required) + :param str page_size: pageSize (required) + :param str type: type + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :param int start_time: startTime + :param int end_time: endTime + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page', 'page_size', 'type', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityViews{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_info_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get Entity View info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided Entity View Id. Entity Views Info extends the Entity View with customer title and 'is public' flag. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_info_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get Entity View info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided Entity View Id. Entity Views Info extends the Entity View with customer title and 'is public' flag. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/info/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_types_using_get(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_entity_view_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_view_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views info owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_view_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views info owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViewInfos{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_view_using_get(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_view_using_get_with_http_info(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get_with_http_info(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_view_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_name' is set + if ('entity_view_name' not in params or + params['entity_view_name'] is None): + raise ValueError("Missing the required parameter `entity_view_name` when calling `get_tenant_entity_view_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_view_name' in params: + query_params.append(('entityViewName', params['entity_view_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?entityViewName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_views_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_views_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_view_using_post(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entity_view_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_view_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_entity_view_from_customer_using_delete(self, entity_view_id, **kwargs): # noqa: E501 + """Unassign Entity View from customer (unassignEntityViewFromCustomer) # noqa: E501 + + Clears assignment of the Entity View to customer. Customer will not be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_customer_using_delete(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_entity_view_from_customer_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_entity_view_from_customer_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def unassign_entity_view_from_customer_using_delete_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Unassign Entity View from customer (unassignEntityViewFromCustomer) # noqa: E501 + + Clears assignment of the Entity View to customer. Customer will not be able to query Entity View afterwards. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_customer_using_delete_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_entity_view_from_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `unassign_entity_view_from_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_entity_view_from_edge_using_delete(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Unassign entity view from edge (unassignEntityViewFromEdge) # noqa: E501 + + Clears assignment of the entity view to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity view locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_edge_using_delete(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_entity_view_from_edge_using_delete_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_entity_view_from_edge_using_delete_with_http_info(edge_id, entity_view_id, **kwargs) # noqa: E501 + return data + + def unassign_entity_view_from_edge_using_delete_with_http_info(self, edge_id, entity_view_id, **kwargs): # noqa: E501 + """Unassign entity view from edge (unassignEntityViewFromEdge) # noqa: E501 + + Clears assignment of the entity view to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity view (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity view locally. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_view_from_edge_using_delete_with_http_info(edge_id, entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str entity_view_id: entityViewId (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_entity_view_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_entity_view_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `unassign_entity_view_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/event_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/event_controller_api.py new file mode 100644 index 0000000..a160e18 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/event_controller_api.py @@ -0,0 +1,623 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def clear_events_using_post(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def clear_events_using_post_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'body', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `clear_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `clear_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/clear{?endTime,startTime}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get_with_http_info(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get1(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get1_with_http_info(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'event_type', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'event_type' is set + if ('event_type' not in params or + params['event_type'] is None): + raise ValueError("Missing the required parameter `event_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'event_type' in params: + path_params['eventType'] = params['event_type'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/{eventType}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_post(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_events_using_post_with_http_info(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'entity_type', 'entity_id', 'body', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/login_endpoint_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/login_endpoint_api.py new file mode 100644 index 0000000..4542027 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/login_endpoint_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class LoginEndpointApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def login_post(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.login_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.login_post_with_http_info(**kwargs) # noqa: E501 + return data + + def login_post_with_http_info(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method login_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/login', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/lwm_2m_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/lwm_2m_controller_api.py new file mode 100644 index 0000000..0e14c4a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/lwm_2m_controller_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class Lwm2mControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_lwm2m_bootstrap_security_info_using_get(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + return data + + def get_lwm2m_bootstrap_security_info_using_get_with_http_info(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_bootstrap_server'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_bootstrap_security_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_bootstrap_server' is set + if ('is_bootstrap_server' not in params or + params['is_bootstrap_server'] is None): + raise ValueError("Missing the required parameter `is_bootstrap_server` when calling `get_lwm2m_bootstrap_security_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'is_bootstrap_server' in params: + path_params['isBootstrapServer'] = params['is_bootstrap_server'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/lwm2m/deviceProfile/bootstrap/{isBootstrapServer}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LwM2MServerSecurityConfigDefault', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/notification_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_controller_api.py new file mode 100644 index 0000000..9843459 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_controller_api.py @@ -0,0 +1,1203 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_notification_request_using_post(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def create_notification_request_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_notification_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequest', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_request_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_request_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_request_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_request_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_delivery_methods_using_get(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_delivery_methods_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_delivery_methods_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/deliveryMethods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_request_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_request_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_preview_using_post(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_request_preview_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'recipients_preview_size'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_preview_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'recipients_preview_size' in params: + query_params.append(('recipientsPreviewSize', params['recipients_preview_size'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/preview{?recipientsPreviewSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestPreview', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_requests_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_requests_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_requests_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_requests_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_requests_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/requests{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_settings_using_get(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notifications_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notifications_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'unread_only'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notifications_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notifications_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notifications_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'unread_only' in params: + query_params.append(('unreadOnly', params['unread_only'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications{?page,pageSize,sortOrder,sortProperty,textSearch,unreadOnly}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotification', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_all_notifications_as_read_using_put(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def mark_all_notifications_as_read_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_all_notifications_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_notification_as_read_using_put(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + return data + + def mark_notification_as_read_using_put_with_http_info(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_notification_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `mark_notification_as_read_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_settings_using_post(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/notification_rule_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_rule_controller_api.py new file mode 100644 index 0000000..f58c6d8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_rule_controller_api.py @@ -0,0 +1,447 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationRuleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_rule_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_rule_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_rule_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_rule_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rule_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_rule_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rule_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_rule_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rules_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_rules_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rules_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_rules_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_rules_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rules{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_rule_using_post(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_rule_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_rule_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRule', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/notification_target_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_target_controller_api.py new file mode 100644 index 0000000..caedf71 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_target_controller_api.py @@ -0,0 +1,776 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTargetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_target_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_target_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_target_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_target_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_target_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_target_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_target_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_target_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_notification_targets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[NotificationTarget]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_supported_notification_type_using_get(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_supported_notification_type_using_get_with_http_info(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['notification_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_supported_notification_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'notification_type' is set + if ('notification_type' not in params or + params['notification_type'] is None): + raise ValueError("Missing the required parameter `notification_type` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'notification_type' in params: + query_params.append(('notificationType', params['notification_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?notificationType,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_recipients_for_notification_target_config_using_post(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_recipients_for_notification_target_config_using_post_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_recipients_for_notification_target_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/recipients{?page,pageSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_target_using_post(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `TENANT_ADMINISTRATORS`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_target_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `TENANT_ADMINISTRATORS`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_target_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/notification_template_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_template_controller_api.py new file mode 100644 index 0000000..ea7e344 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/notification_template_controller_api.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_template_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_template_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_template_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_template_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_template_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_template_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_template_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_template_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_templates_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_templates_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'notification_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_templates_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_templates_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'notification_types' in params: + query_params.append(('notificationTypes', params['notification_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/templates{?notificationTypes,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_slack_conversations_using_get(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + return data + + def list_slack_conversations_using_get_with_http_info(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_slack_conversations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `list_slack_conversations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'token' in params: + query_params.append(('token', params['token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/slack/conversations{?token,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SlackConversation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_template_using_post(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/o_auth_2_config_template_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/o_auth_2_config_template_controller_api.py new file mode 100644 index 0000000..226eb2c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/o_auth_2_config_template_controller_api.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ConfigTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_client_registration_template_using_delete(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + return data + + def delete_client_registration_template_using_delete_with_http_info(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['client_registration_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_client_registration_template_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'client_registration_template_id' is set + if ('client_registration_template_id' not in params or + params['client_registration_template_id'] is None): + raise ValueError("Missing the required parameter `client_registration_template_id` when calling `delete_client_registration_template_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'client_registration_template_id' in params: + path_params['clientRegistrationTemplateId'] = params['client_registration_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template/{clientRegistrationTemplateId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_client_registration_templates_using_get(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_client_registration_templates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_client_registration_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientRegistrationTemplate]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_client_registration_template_using_post(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_client_registration_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_client_registration_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2ClientRegistrationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/o_auth_2_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/o_auth_2_controller_api.py new file mode 100644 index 0000000..8e3b9f1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/o_auth_2_controller_api.py @@ -0,0 +1,411 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_o_auth2_info_using_get(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_o_auth2_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_o_auth2_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_login_processing_url_using_get(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_login_processing_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_login_processing_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/loginProcessingUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_o_auth2_clients_using_post(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_o_auth2_clients_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name', 'platform'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_o_auth2_clients_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + if 'platform' in params: + query_params.append(('platform', params['platform'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/oauth2Clients{?pkgName,platform}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_o_auth2_info_using_post(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_o_auth2_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_o_auth2_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/ota_package_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/ota_package_controller_api.py new file mode 100644 index 0000000..9d0717b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/ota_package_controller_api.py @@ -0,0 +1,879 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OtaPackageControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_ota_package_using_delete(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def delete_ota_package_using_delete_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_ota_package_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `delete_ota_package_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_ota_package_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def download_ota_package_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `download_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_info_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_info_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/info/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get1(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get1_with_http_info(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id', 'type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages/{deviceProfileId}/{type}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_data_using_post(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def save_ota_package_data_using_post_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id', 'checksum', 'checksum_algorithm', 'file'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `save_ota_package_data_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'checksum' in params: + form_params.append(('checksum', params['checksum'])) # noqa: E501 + if 'checksum_algorithm' in params: + form_params.append(('checksumAlgorithm', params['checksum_algorithm'])) # noqa: E501 + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', 'multipart/form-data']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_info_using_post(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_ota_package_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/queue_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/queue_controller_api.py new file mode 100644 index 0000000..f6d6cfa --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/queue_controller_api.py @@ -0,0 +1,558 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class QueueControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_queue_using_delete(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def delete_queue_using_delete_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_queue_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `delete_queue_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_id_using_get(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def get_queue_by_id_using_get_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `get_queue_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_name_using_get(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + return data + + def get_queue_by_name_using_get_with_http_info(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get_with_http_info(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_name_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_name' is set + if ('queue_name' not in params or + params['queue_name'] is None): + raise ValueError("Missing the required parameter `queue_name` when calling `get_queue_by_name_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_name' in params: + path_params['queueName'] = params['queue_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/name/{queueName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_queues_by_service_type_using_get(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_queues_by_service_type_using_get_with_http_info(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_queues_by_service_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?page,pageSize,serviceType,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataQueue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_queue_using_post(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + else: + (data) = self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + return data + + def save_queue_using_post_with_http_info(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post_with_http_info(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_queue_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `save_queue_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?serviceType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/rpc_v_1_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/rpc_v_1_controller_api.py new file mode 100644 index 0000000..7d97a65 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/rpc_v_1_controller_api.py @@ -0,0 +1,253 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV1ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_one_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/rpc_v_2_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/rpc_v_2_controller_api.py new file mode 100644 index 0000000..7dce21e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/rpc_v_2_controller_api.py @@ -0,0 +1,570 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_rpc_using_delete(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def delete_rpc_using_delete_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rpc_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `delete_rpc_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_by_device_using_get(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_by_device_using_get_with_http_info(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'page_size', 'page', 'rpc_status', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_by_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'rpc_status' in params: + query_params.append(('rpcStatus', params['rpc_status'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/device/{deviceId}{?page,pageSize,rpcStatus,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_using_get(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_using_get_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `get_persisted_rpc_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Rpc', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_one_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/rule_chain_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/rule_chain_controller_api.py new file mode 100644 index 0000000..60c64f2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/rule_chain_controller_api.py @@ -0,0 +1,2201 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RuleChainControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_rule_chain_to_edge_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def assign_rule_chain_to_edge_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_rule_chain_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def delete_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `delete_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def export_rule_chains_using_get(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + else: + (data) = self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + return data + + def export_rule_chains_using_get_with_http_info(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get_with_http_info(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['limit'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method export_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'limit' is set + if ('limit' not in params or + params['limit'] is None): + raise ValueError("Missing the required parameter `limit` when calling `export_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/export{?limit}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_assign_to_edge_rule_chains_using_get(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_assign_to_edge_rule_chains_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_assign_to_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/autoAssignToEdgeRuleChains', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChain]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_rule_chains_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_rule_chains_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_rule_node_debug_input_using_get(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + return data + + def get_latest_rule_node_debug_input_using_get_with_http_info(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_node_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_rule_node_debug_input_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_node_id' is set + if ('rule_node_id' not in params or + params['rule_node_id'] is None): + raise ValueError("Missing the required parameter `rule_node_id` when calling `get_latest_rule_node_debug_input_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_node_id' in params: + path_params['ruleNodeId'] = params['rule_node_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleNode/{ruleNodeId}/debugIn', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_by_id_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_by_id_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_meta_data_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_meta_data_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_meta_data_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_meta_data_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/metadata', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_usage_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_usage_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_usage_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_usage_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainOutputLabelsUsage]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chains_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_rule_chains_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def import_rule_chains_using_post(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def import_rule_chains_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'overwrite'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method import_rule_chains_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'overwrite' in params: + query_params.append(('overwrite', params['overwrite'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/import{?overwrite}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainImportResult]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_tbel_enabled_using_get(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_tbel_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_tbel_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/tbelEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_meta_data_using_post(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_meta_data_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'update_related'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_meta_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'update_related' in params: + query_params.append(('updateRelated', params['update_related'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/metadata{?updateRelated}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/device/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post1(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_auto_assign_to_edge_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_auto_assign_to_edge_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_auto_assign_to_edge_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_auto_assign_to_edge_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_template_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_template_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_template_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_template_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/edgeTemplateRoot', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_script_using_post(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_script_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_script_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/testScript{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_rule_chain_from_edge_using_delete(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def unassign_rule_chain_from_edge_using_delete_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_rule_chain_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unset_auto_assign_to_edge_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unset_auto_assign_to_edge_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unset_auto_assign_to_edge_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/tb_resource_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/tb_resource_controller_api.py new file mode 100644 index 0000000..d4ce57c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/tb_resource_controller_api.py @@ -0,0 +1,863 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TbResourceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_resource_using_delete(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def delete_resource_using_delete_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_resource_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `delete_resource_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_resource_using_get(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def download_resource_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_resource_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `download_resource_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_page_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_page_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_page_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m/page{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_using_get(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_using_get_with_http_info(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['sort_order', 'sort_property', 'object_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'sort_order' is set + if ('sort_order' not in params or + params['sort_order'] is None): + raise ValueError("Missing the required parameter `sort_order` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'sort_property' is set + if ('sort_property' not in params or + params['sort_property'] is None): + raise ValueError("Missing the required parameter `sort_property` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'object_ids' is set + if ('object_ids' not in params or + params['object_ids'] is None): + raise ValueError("Missing the required parameter `object_ids` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'object_ids' in params: + query_params.append(('objectIds', params['object_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m{?objectIds,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_info_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_info_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/info/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resources_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_resources_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resources_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_resources_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_resources_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_resource_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_resource_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_resource_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/telemetry_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/telemetry_controller_api.py new file mode 100644 index 0000000..de6bb8b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/telemetry_controller_api.py @@ -0,0 +1,1796 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TelemetryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_attributes_using_delete(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_device_attributes_using_delete_with_http_info(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_device_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_attributes_using_delete(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_attributes_using_delete_with_http_info(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_timeseries_using_delete(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_timeseries_using_delete_with_http_info(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'delete_all_data_for_keys', 'start_ts', 'end_ts', 'rewrite_latest_if_deleted'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_timeseries_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'delete_all_data_for_keys' in params: + query_params.append(('deleteAllDataForKeys', params['delete_all_data_for_keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'rewrite_latest_if_deleted' in params: + query_params.append(('rewriteLatestIfDeleted', params['rewrite_latest_if_deleted'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/delete{?deleteAllDataForKeys,endTs,keys,rewriteLatestIfDeleted,startTs}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes/{scope}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attributes_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes/{scope}{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attributes_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_timeseries_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_latest_timeseries_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_latest_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_latest_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?keys,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get1(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get1_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/timeseries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_using_get(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + return data + + def get_timeseries_using_get_with_http_info(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'start_ts', 'end_ts', 'interval', 'limit', 'agg', 'order_by', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'start_ts' is set + if ('start_ts' not in params or + params['start_ts'] is None): + raise ValueError("Missing the required parameter `start_ts` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'end_ts' is set + if ('end_ts' not in params or + params['end_ts'] is None): + raise ValueError("Missing the required parameter `end_ts` when calling `get_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'interval' in params: + query_params.append(('interval', params['interval'])) # noqa: E501 + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + if 'agg' in params: + query_params.append(('agg', params['agg'])) # noqa: E501 + if 'order_by' in params: + query_params.append(('orderBy', params['order_by'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?agg,endTs,interval,keys,limit,orderBy,startTs,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_attributes_using_post(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + return data + + def save_device_attributes_using_post_with_http_info(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post_with_http_info(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `save_device_attributes_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v1_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v1_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v1_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v2_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v2_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v2_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/attributes/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_with_ttl_using_post(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_with_ttl_using_post_with_http_info(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'ttl', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_with_ttl_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'ttl' is set + if ('ttl' not in params or + params['ttl'] is None): + raise ValueError("Missing the required parameter `ttl` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + if 'ttl' in params: + path_params['ttl'] = params['ttl'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}/{ttl}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/tenant_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/tenant_controller_api.py new file mode 100644 index 0000000..d392b8c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/tenant_controller_api.py @@ -0,0 +1,657 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_using_delete(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_using_delete_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `delete_tenant_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_info_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_info_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/info/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenants_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenants_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenants_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenants_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenants_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenants{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/tenant_profile_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/tenant_profile_controller_api.py new file mode 100644 index 0000000..d9697cc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/tenant_profile_controller_api.py @@ -0,0 +1,932 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_profile_using_delete(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_profile_using_delete_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `delete_tenant_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_tenant_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_tenant_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_tenant_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_info_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_info_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_tenant_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TenantProfile]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_tenant_profile_using_post(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_tenant_profile_using_post_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `set_default_tenant_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/two_factor_auth_config_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/two_factor_auth_config_controller_api.py new file mode 100644 index 0000000..d3540f7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/two_factor_auth_config_controller_api.py @@ -0,0 +1,890 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthConfigControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_two_fa_account_config_using_delete(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def delete_two_fa_account_config_using_delete_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_two_fa_account_config_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `delete_two_fa_account_config_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def generate_two_fa_account_config_using_post(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def generate_two_fa_account_config_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method generate_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `generate_two_fa_account_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/generate{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TwoFaAccountConfig', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_account_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_account_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_account_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_platform_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_platform_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_platform_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_platform_two_fa_settings_using_post(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_platform_two_fa_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_platform_two_fa_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def submit_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def submit_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method submit_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/submit', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_two_fa_account_config_using_put(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def update_two_fa_account_config_using_put_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_two_fa_account_config_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `update_two_fa_account_config_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def verify_and_save_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def verify_and_save_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method verify_and_save_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/two_factor_auth_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/two_factor_auth_controller_api.py new file mode 100644 index 0000000..9ef1d61 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/two_factor_auth_controller_api.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_two_fa_verification_code_using_post(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + else: + (data) = self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + return data + + def check_two_fa_verification_code_using_post_with_http_info(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + # verify the required parameter 'verification_code' is set + if ('verification_code' not in params or + params['verification_code'] is None): + raise ValueError("Missing the required parameter `verification_code` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/check{?providerType,verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get1(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get1_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TwoFaProviderInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_two_fa_verification_code_using_post(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def request_two_fa_verification_code_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `request_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/send{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/ui_settings_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/ui_settings_controller_api.py new file mode 100644 index 0000000..65e045e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/ui_settings_controller_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UiSettingsControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_help_base_url_using_get(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_help_base_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_help_base_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/uiSettings/helpBaseUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/usage_info_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/usage_info_controller_api.py new file mode 100644 index 0000000..9bdff35 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/usage_info_controller_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UsageInfoControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_tenant_usage_info_using_get(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_usage_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_usage_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UsageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/user_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/user_controller_api.py new file mode 100644 index 0000000..fe91132 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/user_controller_api.py @@ -0,0 +1,2261 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UserControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_user_settings_using_delete(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete_with_http_info(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete_with_http_info(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths', 'type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `delete_user_settings_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_settings_using_delete1(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete1_with_http_info(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1_with_http_info(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_using_delete(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def delete_user_using_delete_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `delete_user_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_users_by_query_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def find_users_by_query_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_users_by_query_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `find_users_by_query_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `find_users_by_query_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/info{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_activation_link_using_get(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_activation_link_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_activation_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_activation_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/activationLink', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_users_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_users_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_admins_using_get(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_admins_using_get_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_admins_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_admins_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_by_id_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_by_id_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_dashboards_info_using_get(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_dashboards_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_dashboards_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get1(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def get_user_settings_using_get1_with_http_info(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_user_settings_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_token_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_token_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/token', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_for_assign_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_for_assign_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_for_assign_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_for_assign_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/assign/{alarmId}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of users owned by tenant or customer. The scope depends on authority of the user that performs the request.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of users owned by tenant or customer. The scope depends on authority of the user that performs the request.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_user_token_access_enabled_using_get(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_user_token_access_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_user_token_access_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/tokenAccessEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def put_user_settings_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put1(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def put_user_settings_using_put1_with_http_info(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `put_user_settings_using_put1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def report_user_dashboard_action_using_get(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + else: + (data) = self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + return data + + def report_user_dashboard_action_using_get_with_http_info(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'action'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method report_user_dashboard_action_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + # verify the required parameter 'action' is set + if ('action' not in params or + params['action'] is None): + raise ValueError("Missing the required parameter `action` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + if 'action' in params: + path_params['action'] = params['action'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards/{dashboardId}/{action}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_settings_using_post(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_using_post(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Available for users with 'SYS_ADMIN', 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Available for users with 'SYS_ADMIN', 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user{?sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_activation_email_using_post(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + else: + (data) = self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + return data + + def send_activation_email_using_post_with_http_info(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post_with_http_info(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_activation_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email' is set + if ('email' not in params or + params['email'] is None): + raise ValueError("Missing the required parameter `email` when calling `send_activation_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email' in params: + query_params.append(('email', params['email'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/sendActivationMail{?email}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_user_credentials_enabled_using_post(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def set_user_credentials_enabled_using_post_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'user_credentials_enabled'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_user_credentials_enabled_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `set_user_credentials_enabled_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'user_credentials_enabled' in params: + query_params.append(('userCredentialsEnabled', params['user_credentials_enabled'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/userCredentialsEnabled{?userCredentialsEnabled}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/widget_type_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/widget_type_controller_api.py new file mode 100644 index 0000000..3f8a322 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/widget_type_controller_api.py @@ -0,0 +1,752 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetTypeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widget_type_using_delete(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def delete_widget_type_using_delete_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widget_type_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `delete_widget_type_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_details_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_details_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_details_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesDetails{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeDetails]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_infos_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_infos_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesInfos{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypes{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetType]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_by_id_using_get(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def get_widget_type_by_id_using_get_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `get_widget_type_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_using_get(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + return data + + def get_widget_type_using_get_with_http_info(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias', 'alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'alias' is set + if ('alias' not in params or + params['alias'] is None): + raise ValueError("Missing the required parameter `alias` when calling `get_widget_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + if 'alias' in params: + query_params.append(('alias', params['alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType{?alias,bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetType', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widget_type_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widget_type_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widget_type_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_ce/widgets_bundle_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_ce/widgets_bundle_controller_api.py new file mode 100644 index 0000000..cd5ace3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_ce/widgets_bundle_controller_api.py @@ -0,0 +1,534 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetsBundleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widgets_bundle_using_delete(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def delete_widgets_bundle_using_delete_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widgets_bundle_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `delete_widgets_bundle_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundle_by_id_using_get(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def get_widgets_bundle_by_id_using_get_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundle_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `get_widgets_bundle_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetsBundle]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get1(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get1_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataWidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widgets_bundle_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widgets_bundle_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widgets_bundle_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__init__.py b/tb-rest-client/python/tb_rest_client/api/api_pe/__init__.py new file mode 100644 index 0000000..65fff6f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/__init__.py @@ -0,0 +1,57 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .self_registration_controller_api import SelfRegistrationControllerApi +from .http_integration_controller_api import HttpIntegrationControllerApi +from .asset_controller_api import AssetControllerApi +from .device_group_ota_package_controller_api import DeviceGroupOtaPackageControllerApi +from .edge_controller_api import EdgeControllerApi +from .ocean_connect_integration_controller_api import OceanConnectIntegrationControllerApi +from .user_permissions_controller_api import UserPermissionsControllerApi +from .owner_controller_api import OwnerControllerApi +from .rpc_v_2_controller_api import RpcV2ControllerApi +from .edge_event_controller_api import EdgeEventControllerApi +from .customer_controller_api import CustomerControllerApi +from .user_controller_api import UserControllerApi +from .group_permission_controller_api import GroupPermissionControllerApi +from .device_controller_api import DeviceControllerApi +from .converter_controller_api import ConverterControllerApi +from .entity_view_controller_api import EntityViewControllerApi +from .rule_engine_controller_api import RuleEngineControllerApi +from .admin_controller_api import AdminControllerApi +from .t_mobile_iot_cdp_integration_controller_api import TMobileIotCdpIntegrationControllerApi +from .sign_up_controller_api import SignUpControllerApi +from .trail_controller_api import TrailControllerApi +from .thing_park_integration_controller_api import ThingParkIntegrationControllerApi +from .sig_fox_integration_controller_api import SigFoxIntegrationControllerApi +from .scheduler_event_controller_api import SchedulerEventControllerApi +from .report_controller_api import ReportControllerApi +from .dashboard_controller_api import DashboardControllerApi +from .integration_controller_api import IntegrationControllerApi +from .custom_menu_controller_api import CustomMenuControllerApi +from .lwm_2m_controller_api import Lwm2mControllerApi +from .custom_translation_controller_api import CustomTranslationControllerApi +from .role_controller_api import RoleControllerApi +from .blob_entity_controller_api import BlobEntityControllerApi +from .loriot_integration_controller_api import LoriotIntegrationControllerApi +from .tenant_controller_api import TenantControllerApi +from .chirp_stack_integration_controller_api import ChirpStackIntegrationControllerApi +from .white_labeling_controller_api import WhiteLabelingControllerApi +from .ota_package_controller_api import OtaPackageControllerApi +from .entity_group_controller_api import EntityGroupControllerApi +from .subscription_controller_api import SubscriptionControllerApi +from .solution_controller_api import SolutionControllerApi +from .device_profile_controller_api import DeviceProfileControllerApi +from .asset_profile_controller_api import AssetProfileControllerApi +from .two_factor_auth_controller_api import TwoFactorAuthControllerApi diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/__init__.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..3eec950 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/__init__.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/admin_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/admin_controller_api.cpython-311.pyc new file mode 100644 index 0000000..8052a79 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/admin_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/alarm_comment_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/alarm_comment_controller_api.cpython-311.pyc new file mode 100644 index 0000000..67b9214 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/alarm_comment_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/alarm_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/alarm_controller_api.cpython-311.pyc new file mode 100644 index 0000000..40a5995 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/alarm_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/asset_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/asset_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2f96bf2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/asset_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/asset_profile_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/asset_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4294ff6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/asset_profile_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/audit_log_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/audit_log_controller_api.cpython-311.pyc new file mode 100644 index 0000000..265b55b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/audit_log_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/auth_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2b7a9b2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/auth_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/billing_endpoint_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/billing_endpoint_controller_api.cpython-311.pyc new file mode 100644 index 0000000..1fb5e87 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/billing_endpoint_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/blob_entity_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/blob_entity_controller_api.cpython-311.pyc new file mode 100644 index 0000000..cc664e2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/blob_entity_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/chirp_stack_integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/chirp_stack_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..c1321ce Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/chirp_stack_integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/cloud_endpoint_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/cloud_endpoint_controller_api.cpython-311.pyc new file mode 100644 index 0000000..bf28c5d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/cloud_endpoint_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/component_descriptor_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/component_descriptor_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e1a974f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/component_descriptor_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/converter_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/converter_controller_api.cpython-311.pyc new file mode 100644 index 0000000..afbffc8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/converter_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/custom_menu_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/custom_menu_controller_api.cpython-311.pyc new file mode 100644 index 0000000..4deb54c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/custom_menu_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/custom_translation_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/custom_translation_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7eac00b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/custom_translation_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/customer_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/customer_controller_api.cpython-311.pyc new file mode 100644 index 0000000..25ae0c6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/customer_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/dashboard_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/dashboard_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f955f5c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/dashboard_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_api_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_api_controller_api.cpython-311.pyc new file mode 100644 index 0000000..6e96c38 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_api_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f92f55d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_group_ota_package_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_group_ota_package_controller_api.cpython-311.pyc new file mode 100644 index 0000000..78dac05 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_group_ota_package_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_profile_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d09b1d4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/device_profile_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/edge_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/edge_controller_api.cpython-311.pyc new file mode 100644 index 0000000..54a8e48 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/edge_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/edge_event_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/edge_event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d56b4b0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/edge_event_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entities_version_control_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entities_version_control_controller_api.cpython-311.pyc new file mode 100644 index 0000000..19a3531 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entities_version_control_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_group_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_group_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0d0c896 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_group_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_query_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_query_controller_api.cpython-311.pyc new file mode 100644 index 0000000..21041e6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_query_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_relation_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_relation_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0e4230c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_relation_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_view_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_view_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b8ac2b8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/entity_view_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/event_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..bd34baa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/event_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/group_permission_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/group_permission_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5bf6c12 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/group_permission_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/http_integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/http_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..35cf38f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/http_integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7ff5170 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/login_endpoint_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/login_endpoint_api.cpython-311.pyc new file mode 100644 index 0000000..e28fdc1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/login_endpoint_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/loriot_integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/loriot_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..c7b14c0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/loriot_integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/lwm_2m_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/lwm_2m_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d8871a3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/lwm_2m_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_controller_api.cpython-311.pyc new file mode 100644 index 0000000..bcc53fc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_rule_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_rule_controller_api.cpython-311.pyc new file mode 100644 index 0000000..654ec61 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_rule_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_target_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_target_controller_api.cpython-311.pyc new file mode 100644 index 0000000..be4332e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_target_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_template_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e930e71 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/notification_template_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f2448cd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_config_template_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f5e51bf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/o_auth_2_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ocean_connect_integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ocean_connect_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9fa48a0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ocean_connect_integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ota_package_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ota_package_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f5ad7fd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ota_package_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/owner_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/owner_controller_api.cpython-311.pyc new file mode 100644 index 0000000..f3ed45a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/owner_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/queue_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/queue_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7b1b065 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/queue_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/report_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/report_controller_api.cpython-311.pyc new file mode 100644 index 0000000..dc78ca7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/report_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/role_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/role_controller_api.cpython-311.pyc new file mode 100644 index 0000000..7cb97d0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/role_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_controller_api.cpython-311.pyc new file mode 100644 index 0000000..824c7f9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_1_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_1_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5c046f8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_1_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_2_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_2_controller_api.cpython-311.pyc new file mode 100644 index 0000000..d02c70b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rpc_v_2_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rule_chain_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rule_chain_controller_api.cpython-311.pyc new file mode 100644 index 0000000..af71716 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rule_chain_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rule_engine_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rule_engine_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b878097 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/rule_engine_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/scheduler_event_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/scheduler_event_controller_api.cpython-311.pyc new file mode 100644 index 0000000..a7a3bb8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/scheduler_event_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/self_registration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/self_registration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..1ac69fb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/self_registration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/sig_fox_integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/sig_fox_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..8803fef Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/sig_fox_integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/sign_up_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/sign_up_controller_api.cpython-311.pyc new file mode 100644 index 0000000..710d565 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/sign_up_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/solution_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/solution_controller_api.cpython-311.pyc new file mode 100644 index 0000000..22f5ce4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/solution_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/subscription_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/subscription_controller_api.cpython-311.pyc new file mode 100644 index 0000000..5b729db Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/subscription_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/t_mobile_iot_cdp_integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/t_mobile_iot_cdp_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9fee41f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/t_mobile_iot_cdp_integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tb_resource_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tb_resource_controller_api.cpython-311.pyc new file mode 100644 index 0000000..6f03a67 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tb_resource_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/telemetry_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/telemetry_controller_api.cpython-311.pyc new file mode 100644 index 0000000..03cb1a4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/telemetry_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tenant_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tenant_controller_api.cpython-311.pyc new file mode 100644 index 0000000..606c03d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tenant_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tenant_profile_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tenant_profile_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0623f4c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/tenant_profile_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/thing_park_integration_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/thing_park_integration_controller_api.cpython-311.pyc new file mode 100644 index 0000000..08e43b9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/thing_park_integration_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/trail_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/trail_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b0c2c36 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/trail_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc new file mode 100644 index 0000000..055fac6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_config_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b341eee Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/two_factor_auth_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ui_settings_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ui_settings_controller_api.cpython-311.pyc new file mode 100644 index 0000000..04f8a0d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/ui_settings_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/usage_info_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/usage_info_controller_api.cpython-311.pyc new file mode 100644 index 0000000..9040e4b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/usage_info_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/user_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/user_controller_api.cpython-311.pyc new file mode 100644 index 0000000..e1d7d13 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/user_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/user_permissions_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/user_permissions_controller_api.cpython-311.pyc new file mode 100644 index 0000000..77ba4b0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/user_permissions_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/white_labeling_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/white_labeling_controller_api.cpython-311.pyc new file mode 100644 index 0000000..2c2f529 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/white_labeling_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/widget_type_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/widget_type_controller_api.cpython-311.pyc new file mode 100644 index 0000000..b91ec91 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/widget_type_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/widgets_bundle_controller_api.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/widgets_bundle_controller_api.cpython-311.pyc new file mode 100644 index 0000000..0601c02 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/api/api_pe/__pycache__/widgets_bundle_controller_api.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/admin_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/admin_controller_api.py new file mode 100644 index 0000000..8f5a05b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/admin_controller_api.py @@ -0,0 +1,2035 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AdminControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def auto_commit_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.auto_commit_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def auto_commit_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check auto commit settings exists (autoCommitSettingsExists) # noqa: E501 + + Check whether the auto commit settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.auto_commit_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method auto_commit_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_repository_access_using_post(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_repository_access_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_repository_access_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check repository access (checkRepositoryAccess) # noqa: E501 + + Attempts to check repository access. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_repository_access_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_repository_access_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/checkAccess', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_updates_using_get(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_updates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def check_updates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check for new Platform Releases (checkUpdates) # noqa: E501 + + Check notifications about new platform releases. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_updates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UpdateMessage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_updates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/updates', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UpdateMessage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_auto_commit_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_auto_commit_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_auto_commit_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete auto commit settings (deleteAutoCommitSettings) # noqa: E501 + + Deletes the auto commit settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_auto_commit_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_auto_commit_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_repository_settings_using_delete(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_repository_settings_using_delete_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_repository_settings_using_delete_with_http_info(self, **kwargs): # noqa: E501 + """Delete repository settings (deleteRepositorySettings) # noqa: E501 + + Deletes the repository settings. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_repository_settings_using_delete_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultVoid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_repository_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultVoid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_admin_settings_using_get(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :param bool system_by_default: Use system settings if settings are not defined on tenant level. + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + else: + (data) = self.get_admin_settings_using_get_with_http_info(key, **kwargs) # noqa: E501 + return data + + def get_admin_settings_using_get_with_http_info(self, key, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Get the Administration Settings object using specified string key. Referencing non-existing key will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_admin_settings_using_get_with_http_info(key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str key: A string value of the key (e.g. 'general' or 'mail'). (required) + :param bool system_by_default: Use system settings if settings are not defined on tenant level. + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['key', 'system_by_default'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_admin_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'key' is set + if ('key' not in params or + params['key'] is None): + raise ValueError("Missing the required parameter `key` when calling `get_admin_settings_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'key' in params: + path_params['key'] = params['key'] # noqa: E501 + + query_params = [] + if 'system_by_default' in params: + query_params.append(('systemByDefault', params['system_by_default'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/{key}{?systemByDefault}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_commit_settings_using_get(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_commit_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_commit_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get auto commit settings (getAutoCommitSettings) # noqa: E501 + + Get the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_commit_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_commit_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_features_info_using_get(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_features_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_features_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get features info (getFeaturesInfo) # noqa: E501 + + Get information about enabled/disabled features. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_features_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: FeaturesInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_features_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/featuresInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FeaturesInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_jwt_settings_using_get(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_jwt_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_jwt_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the JWT Settings object (getJwtSettings) # noqa: E501 + + Get the JWT Settings object that contains JWT token policy, etc. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_jwt_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JWTSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_jwt_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_license_usage_info_using_get(self, **kwargs): # noqa: E501 + """Get license usage info (getLicenseUsageInfo) # noqa: E501 + + Get license usage info. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_license_usage_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LicenseUsageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_license_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_license_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_license_usage_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get license usage info (getLicenseUsageInfo) # noqa: E501 + + Get license usage info. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_license_usage_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LicenseUsageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_license_usage_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/licenseUsageInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LicenseUsageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_info_using_get(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getRepositorySettingsInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettingsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettingsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_repository_settings_using_get(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_repository_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_repository_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get repository settings (getRepositorySettings) # noqa: E501 + + Get the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_repository_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: RepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_repository_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_security_settings_using_get(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_security_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_security_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the Security Settings object # noqa: E501 + + Get the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_security_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_security_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_system_info_using_get(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_system_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_system_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get system info (getSystemInfo) # noqa: E501 + + Get main information about system. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_system_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SystemInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_system_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/systemInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SystemInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def repository_settings_exists_using_get(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.repository_settings_exists_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def repository_settings_exists_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check repository settings exists (repositorySettingsExists) # noqa: E501 + + Check whether the repository settings exists. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repository_settings_exists_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method repository_settings_exists_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings/exists', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_admin_settings_using_post(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_admin_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_admin_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get the Administration Settings object using key (getAdminSettings) # noqa: E501 + + Creates or Updates the Administration Settings. Platform generates random Administration Settings Id during settings creation. The Administration Settings Id will be present in the response. Specify the Administration Settings Id when you would like to update the Administration Settings. Referencing non-existing Administration Settings Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_admin_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: AdminSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_admin_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AdminSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_auto_commit_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_auto_commit_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_auto_commit_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the auto commit settings (saveAutoCommitSettings) # noqa: E501 + + Creates or Updates the auto commit settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_auto_commit_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param dict(str, AutoVersionCreateConfig) body: + :return: dict(str, AutoVersionCreateConfig) + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_auto_commit_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/autoCommitSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='dict(str, AutoVersionCreateConfig)', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_jwt_settings_using_post(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_jwt_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_jwt_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update JWT Settings (saveJwtSettings) # noqa: E501 + + Updates the JWT Settings object that contains JWT token policy, etc. The tokenSigningKey field is a Base64 encoded string. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_jwt_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JWTSettings body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_jwt_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/jwtSettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_repository_settings_using_post(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_repository_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_repository_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Creates or Updates the repository settings (saveRepositorySettings) # noqa: E501 + + Creates or Updates the repository settings object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_repository_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RepositorySettings body: + :return: DeferredResultRepositorySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_repository_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/repositorySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultRepositorySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_security_settings_using_post(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_security_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_security_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Security Settings (saveSecuritySettings) # noqa: E501 + + Updates the Security Settings object that contains password policy, etc. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_security_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SecuritySettings body: + :return: SecuritySettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_security_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/securitySettings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SecuritySettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_mail_using_post(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email using Mail Settings provided as a parameter. Email is sent to the address specified in the profile of user who is performing the requestYou may change the 'To' email in the user profile of the System/Tenant Administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_mail_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_mail_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test email (sendTestMail) # noqa: E501 + + Attempts to send test email using Mail Settings provided as a parameter. Email is sent to the address specified in the profile of user who is performing the requestYou may change the 'To' email in the user profile of the System/Tenant Administrator. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_mail_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AdminSettings body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_mail_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testMail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_test_sms_using_post(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.send_test_sms_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def send_test_sms_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Send test sms (sendTestMail) # noqa: E501 + + Attempts to send test sms to the System Administrator User using SMS Settings and phone number provided as a parameters of the request. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the 'ADMIN_SETTINGS' (for 'SYS_ADMIN' authority) or 'WHITE_LABELING' (for 'TENANT_ADMIN' authority) resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_test_sms_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TestSmsRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_test_sms_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/admin/settings/testSms', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/alarm_comment_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/alarm_comment_controller_api.py new file mode 100644 index 0000000..49145cd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/alarm_comment_controller_api.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmCommentControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_alarm_comment_using_delete(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_comment_using_delete_with_http_info(self, alarm_id, comment_id, **kwargs): # noqa: E501 + """Delete Alarm comment (deleteAlarmComment) # noqa: E501 + + Deletes the Alarm comment. Referencing non-existing Alarm comment Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_comment_using_delete_with_http_info(alarm_id, comment_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str comment_id: A string value representing the alarm comment id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'comment_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_comment_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + # verify the required parameter 'comment_id' is set + if ('comment_id' not in params or + params['comment_id'] is None): + raise ValueError("Missing the required parameter `comment_id` when calling `delete_alarm_comment_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'comment_id' in params: + path_params['commentId'] = params['comment_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment/{commentId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_comments_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarm_comments_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarm comments (getAlarmComments) # noqa: E501 + + Returns a page of alarm comments for specified alarm. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_comments_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAlarmCommentInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_comments_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarm_comments_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarm_comments_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment{?page,pageSize,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmCommentInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_comment_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.save_alarm_comment_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def save_alarm_comment_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Create or update Alarm Comment # noqa: E501 + + Creates or Updates the Alarm Comment. When creating comment, platform generates Alarm Comment Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Comment id will be present in the response. Specify existing Alarm Comment id to update the alarm. Referencing non-existing Alarm Comment Id will cause 'Not Found' error. To create new Alarm comment entity it is enough to specify 'comment' json element with 'text' node, for example: {\"comment\": { \"text\": \"my comment\"}}. If comment type is not specified the default value 'OTHER' will be saved. If 'alarmId' or 'userId' specified in body it will be ignored. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_comment_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param AlarmComment body: + :return: AlarmComment + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_comment_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `save_alarm_comment_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/comment', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmComment', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/alarm_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/alarm_controller_api.py new file mode 100644 index 0000000..aed42b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/alarm_controller_api.py @@ -0,0 +1,1518 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AlarmControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def ack_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.ack_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def ack_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Acknowledge Alarm (ackAlarm) # noqa: E501 + + Acknowledge the Alarm. Once acknowledged, the 'ack_ts' field will be set to current timestamp and special rule chain event 'ALARM_ACK' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.ack_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method ack_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `ack_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/ack', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_alarm_using_post(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, **kwargs) # noqa: E501 + return data + + def assign_alarm_using_post_with_http_info(self, alarm_id, assignee_id, **kwargs): # noqa: E501 + """Assign/Reassign Alarm (assignAlarm) # noqa: E501 + + Assign the Alarm. Once assigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_ASSIGNED' (or ALARM_REASSIGNED in case of assigning already assigned alarm) will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_alarm_using_post_with_http_info(alarm_id, assignee_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str assignee_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `assign_alarm_using_post`") # noqa: E501 + # verify the required parameter 'assignee_id' is set + if ('assignee_id' not in params or + params['assignee_id'] is None): + raise ValueError("Missing the required parameter `assignee_id` when calling `assign_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + if 'assignee_id' in params: + path_params['assigneeId'] = params['assignee_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign/{assigneeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def clear_alarm_using_post(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_alarm_using_post_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def clear_alarm_using_post_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Clear Alarm (clearAlarm) # noqa: E501 + + Clear the Alarm. Once cleared, the 'clear_ts' field will be set to current timestamp and special rule chain event 'ALARM_CLEAR' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_alarm_using_post_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `clear_alarm_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/clear', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def delete_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Delete Alarm (deleteAlarm) # noqa: E501 + + Deletes the Alarm. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `delete_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm (getAlarmById) # noqa: E501 + + Fetch the Alarm object based on the provided Alarm Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarm_info_by_id_using_get(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.get_alarm_info_by_id_using_get_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def get_alarm_info_by_id_using_get_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Get Alarm Info (getAlarmInfoById) # noqa: E501 + + Fetch the Alarm Info object based on the provided Alarm Id. Alarm Info is an extension of the default Alarm object that also contains name of the alarm originator. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarm_info_by_id_using_get_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarm_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_alarm_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/info/{alarmId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarms) # noqa: E501 + + Returns a page of alarms for the selected entity. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{entityType}/{entityId}{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_alarms_v2_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_alarms_v2_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get Alarms (getAlarmsV2) # noqa: E501 + + Returns a page of alarms for the selected entity. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_alarms_v2_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarm/{entityType}/{entityId}{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarms) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param bool fetch_originator: A boolean value to specify if the alarm originator name will be filled in the AlarmInfo object field: 'originatorName' or will returns as null. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'search_status', 'status', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'fetch_originator'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'fetch_originator' in params: + query_params.append(('fetchOriginator', params['fetch_originator'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarms{?assigneeId,endTime,fetchOriginator,page,pageSize,searchStatus,sortOrder,sortProperty,startTime,status,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_alarms_v2_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_alarms_v2_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_alarms_v2_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Alarms (getAllAlarmsV2) # noqa: E501 + + Returns a page of alarms that belongs to the current user owner. If the user has the authority of 'Tenant Administrator', the server returns alarms that belongs to the tenant of current user. If the user has the authority of 'Customer User', the server returns alarms that belongs to the customer of current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_alarms_v2_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str status_list: A list of string values separated by comma ',' representing one of the AlarmSearchStatus enumeration value + :param str severity_list: A list of string values separated by comma ',' representing one of the AlarmSeverity enumeration value + :param str type_list: A list of string values separated by comma ',' representing alarm types + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on of next alarm fields: type, severity or status + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the Alarm class field: 'createdTime'. + :return: PageDataAlarmInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'status_list', 'severity_list', 'type_list', 'assignee_id', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_alarms_v2_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_alarms_v2_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'status_list' in params: + query_params.append(('statusList', params['status_list'])) # noqa: E501 + if 'severity_list' in params: + query_params.append(('severityList', params['severity_list'])) # noqa: E501 + if 'type_list' in params: + query_params.append(('typeList', params['type_list'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v2/alarms{?assigneeId,endTime,page,pageSize,severityList,sortOrder,sortProperty,startTime,statusList,textSearch,typeList}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_highest_alarm_severity_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_highest_alarm_severity_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Highest Alarm Severity (getHighestAlarmSeverity) # noqa: E501 + + Search the alarms by originator ('entityType' and entityId') and optional 'status' or 'searchStatus' filters and returns the highest AlarmSeverity(CRITICAL, MAJOR, MINOR, WARNING or INDETERMINATE). Specifying both parameters 'searchStatus' and 'status' at the same time will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_highest_alarm_severity_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str search_status: A string value representing one of the AlarmSearchStatus enumeration value + :param str status: A string value representing one of the AlarmStatus enumeration value + :param str assignee_id: A string value representing the assignee user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'search_status', 'status', 'assignee_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_highest_alarm_severity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_highest_alarm_severity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'search_status' in params: + query_params.append(('searchStatus', params['search_status'])) # noqa: E501 + if 'status' in params: + query_params.append(('status', params['status'])) # noqa: E501 + if 'assignee_id' in params: + query_params.append(('assigneeId', params['assignee_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/highestSeverity/{entityType}/{entityId}{?assigneeId,searchStatus,status}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_alarm_using_post(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_alarm_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_alarm_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or Update Alarm (saveAlarm) # noqa: E501 + + Creates or Updates the Alarm. When creating alarm, platform generates Alarm Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm id will be present in the response. Specify existing Alarm id to update the alarm. Referencing non-existing Alarm Id will cause 'Not Found' error. Platform also deduplicate the alarms based on the entity id of originator and alarm 'type'. For example, if the user or system component create the alarm with the type 'HighTemperature' for device 'Device A' the new active alarm is created. If the user tries to create 'HighTemperature' alarm for the same device again, the previous alarm will be updated (the 'end_ts' will be set to current timestamp). If the user clears the alarm (see 'Clear Alarm(clearAlarm)'), than new alarm with the same type and same device may be created. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Alarm entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_alarm_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Alarm body: + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_alarm_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_alarm_using_delete(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_alarm_using_delete_with_http_info(alarm_id, **kwargs) # noqa: E501 + return data + + def unassign_alarm_using_delete_with_http_info(self, alarm_id, **kwargs): # noqa: E501 + """Unassign Alarm (unassignAlarm) # noqa: E501 + + Unassign the Alarm. Once unassigned, the 'assign_ts' field will be set to current timestamp and special rule chain event 'ALARM_UNASSIGNED' will be generated. Referencing non-existing Alarm Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_alarm_using_delete_with_http_info(alarm_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Alarm + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_alarm_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `unassign_alarm_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarm/{alarmId}/assign', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Alarm', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/asset_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/asset_controller_api.py new file mode 100644 index 0000000..30b9eb3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/asset_controller_api.py @@ -0,0 +1,1648 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_asset_using_delete(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_using_delete_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def delete_asset_using_delete_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Delete asset (deleteAsset) # noqa: E501 + + Deletes the asset and all the relations (from and to the asset). Referencing non-existing asset Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_using_delete_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `delete_asset_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related assets (findByQuery) # noqa: E501 + + Returns all assets that are related to the specific entity. The entity id, relation type, asset types, depth of the search, and other query parameters defined using complex 'AssetSearchQuery' object. See 'Model' tab of the Parameters for more info. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetSearchQuery body: + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_asset_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Asset Infos for current user (getAllAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the tenant or the customer of a current user. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_asset_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_asset_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_asset_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Asset Infos for current user (getAllAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the tenant or the customer of a current user. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_asset_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetInfos/all{?assetProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset (getAssetById) # noqa: E501 + + Fetch the Asset object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_info_by_id_using_get(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer.Asset Info is an extension of the default Asset object that contains information about the owner name. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_info_by_id_using_get_with_http_info(asset_id, **kwargs) # noqa: E501 + return data + + def get_asset_info_by_id_using_get_with_http_info(self, asset_id, **kwargs): # noqa: E501 + """Get Asset Info (getAssetInfoById) # noqa: E501 + + Fetch the Asset Info object based on the provided Asset Id. If the user has the authority of 'Tenant Administrator', the server checks that the asset is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the asset is assigned to the same customer.Asset Info is an extension of the default Asset object that contains information about the owner name. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_info_by_id_using_get_with_http_info(asset_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_id: A string value representing the asset id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_id' is set + if ('asset_id' not in params or + params['asset_id'] is None): + raise ValueError("Missing the required parameter `asset_id` when calling `get_asset_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_id' in params: + path_params['assetId'] = params['asset_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/info/{assetId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_types_using_get(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_asset_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_asset_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Asset Types (getAssetTypes) # noqa: E501 + + Returns a set of unique asset types based on assets that are either owned by the tenant or assigned to the customer which user is performing 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 = api.get_asset_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_assets_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get assets by Entity Group Id (getAssetsByEntityGroupId) # noqa: E501 + + Returns a page of asset objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_assets_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_assets_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_assets_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get assets by Entity Group Id (getAssetsByEntityGroupId) # noqa: E501 + + Returns a page of asset objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_assets_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_assets_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_assets_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_assets_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/assets{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_assets_by_ids_using_get(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_ids_using_get(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of asset ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_assets_by_ids_using_get_with_http_info(asset_ids, **kwargs) # noqa: E501 + return data + + def get_assets_by_ids_using_get_with_http_info(self, asset_ids, **kwargs): # noqa: E501 + """Get Assets By Ids (getAssetsByIds) # noqa: E501 + + Requested assets must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_assets_by_ids_using_get_with_http_info(asset_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_ids: A list of asset ids, separated by comma ',' (required) + :return: list[Asset] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_assets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_ids' is set + if ('asset_ids' not in params or + params['asset_ids'] is None): + raise ValueError("Missing the required parameter `asset_ids` when calling `get_assets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_ids' in params: + query_params.append(('assetIds', params['asset_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assets{?assetIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Asset]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_asset_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the specified customer. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_asset_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Asset Infos (getCustomerAssetInfos) # noqa: E501 + + Returns a page of asset info objects owned by the specified customer. Asset Info is an extension of the default Asset object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_asset_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_asset_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_asset_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assetInfos{?assetProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_assets_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_assets_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Assets (getCustomerAssets) # noqa: E501 + + Returns a page of assets objects owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_assets_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_asset_using_get(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_asset_using_get_with_http_info(asset_name, **kwargs) # noqa: E501 + return data + + def get_tenant_asset_using_get_with_http_info(self, asset_name, **kwargs): # noqa: E501 + """Get Tenant Asset (getTenantAsset) # noqa: E501 + + Requested asset must be owned by tenant that the user belongs to. Asset name is an unique property of asset. So it can be used to identify the asset. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_asset_using_get_with_http_info(asset_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_name: A string value representing the Asset name. (required) + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_asset_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_name' is set + if ('asset_name' not in params or + params['asset_name'] is None): + raise ValueError("Missing the required parameter `asset_name` when calling `get_tenant_asset_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_name' in params: + query_params.append(('assetName', params['asset_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?assetName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_assets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_assets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Assets (getTenantAssets) # noqa: E501 + + Returns a page of assets owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_assets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/assets{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_assets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Assets (getUserAssets) # noqa: E501 + + Returns a page of assets objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_assets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_assets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_assets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Assets (getUserAssets) # noqa: E501 + + Returns a page of assets objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Info is an extension of the default Asset object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_assets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Asset type + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param str text_search: The case insensitive 'substring' filter based on the asset name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'asset_profile_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_assets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_assets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_assets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'asset_profile_id' in params: + query_params.append(('assetProfileId', params['asset_profile_id'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/assets{?assetProfileId,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_asset_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_asset_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_asset_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_asset_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_asset_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of assets (processAssetsBulkImport) # noqa: E501 + + There's an ability to import the bulk of assets using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_asset_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultAsset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_asset_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultAsset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset (saveAsset) # noqa: E501 + + Creates or Updates the Asset. When creating asset, platform generates Asset Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Asset id will be present in the response. Specify existing Asset id to update the asset. Referencing non-existing Asset Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Asset entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Asset body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Asset + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/asset{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Asset', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/asset_profile_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/asset_profile_controller_api.py new file mode 100644 index 0000000..b16bd3d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/asset_profile_controller_api.py @@ -0,0 +1,934 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AssetProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_asset_profile_using_delete(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_asset_profile_using_delete_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def delete_asset_profile_using_delete_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Delete asset profile (deleteAssetProfile) # noqa: E501 + + Deletes the asset profile. Referencing non-existing asset profile Id will cause an error. Can't delete the asset profile if it is referenced by existing assets. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_asset_profile_using_delete_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_asset_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `delete_asset_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile (getAssetProfileById) # noqa: E501 + + Fetch the Asset Profile object based on the provided Asset Profile Id. The server checks that the asset profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_info_by_id_using_get(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def get_asset_profile_info_by_id_using_get_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Get Asset Profile Info (getAssetProfileInfoById) # noqa: E501 + + Fetch the Asset Profile Info object based on the provided Asset Profile Id. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_info_by_id_using_get_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `get_asset_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/{assetProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profile infos (getAssetProfileInfos) # noqa: E501 + + Returns a page of asset profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profiles_by_ids_using_get(self, asset_profile_ids, **kwargs): # noqa: E501 + """Get Asset Profiles By Ids (getAssetProfilesByIds) # noqa: E501 + + Requested asset profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_by_ids_using_get(asset_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_ids: A list of asset profile ids, separated by comma ',' (required) + :return: list[AssetProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profiles_by_ids_using_get_with_http_info(asset_profile_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profiles_by_ids_using_get_with_http_info(asset_profile_ids, **kwargs) # noqa: E501 + return data + + def get_asset_profiles_by_ids_using_get_with_http_info(self, asset_profile_ids, **kwargs): # noqa: E501 + """Get Asset Profiles By Ids (getAssetProfilesByIds) # noqa: E501 + + Requested asset profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_by_ids_using_get_with_http_info(asset_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_ids: A list of asset profile ids, separated by comma ',' (required) + :return: list[AssetProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_ids' is set + if ('asset_profile_ids' not in params or + params['asset_profile_ids'] is None): + raise ValueError("Missing the required parameter `asset_profile_ids` when calling `get_asset_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'asset_profile_ids' in params: + query_params.append(('assetProfileIds', params['asset_profile_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfos{?assetProfileIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[AssetProfileInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_asset_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_asset_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_asset_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Asset Profiles (getAssetProfiles) # noqa: E501 + + Returns a page of asset profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_asset_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the asset profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataAssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_asset_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_asset_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_asset_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_asset_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_asset_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_asset_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Asset Profile (getDefaultAssetProfileInfo) # noqa: E501 + + Fetch the Default Asset Profile Info object. Asset Profile Info is a lightweight object that includes main information about Asset Profile. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_asset_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AssetProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_asset_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_asset_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_asset_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_asset_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Asset Profile (saveAssetProfile) # noqa: E501 + + Create or update the Asset Profile. When creating asset profile, platform generates asset profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created asset profile id will be present in the response. Specify existing asset profile id to update the asset profile. Referencing non-existing asset profile Id will cause 'Not Found' error. Asset profile name is unique in the scope of tenant. Only one 'default' asset profile may exist in scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Asset Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_asset_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AssetProfile body: + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_asset_profile_using_post(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_asset_profile_using_post_with_http_info(asset_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_asset_profile_using_post_with_http_info(self, asset_profile_id, **kwargs): # noqa: E501 + """Make Asset Profile Default (setDefaultAssetProfile) # noqa: E501 + + Marks asset profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_asset_profile_using_post_with_http_info(asset_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str asset_profile_id: A string value representing the asset profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: AssetProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['asset_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_asset_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'asset_profile_id' is set + if ('asset_profile_id' not in params or + params['asset_profile_id'] is None): + raise ValueError("Missing the required parameter `asset_profile_id` when calling `set_default_asset_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'asset_profile_id' in params: + path_params['assetProfileId'] = params['asset_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/assetProfile/{assetProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AssetProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/audit_log_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/audit_log_controller_api.py new file mode 100644 index 0000000..93e2106 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/audit_log_controller_api.py @@ -0,0 +1,587 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuditLogControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_audit_logs_by_customer_id_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_customer_id_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by customer id (getAuditLogsByCustomerId) # noqa: E501 + + Returns a page of audit logs related to the targeted customer entities (devices, assets, etc.), and users actions (login, logout, etc.) that belong to this customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_customer_id_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_customer_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_customer_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/customer/{customerId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_entity_id_using_get(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_entity_id_using_get_with_http_info(self, entity_type, entity_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by entity id (getAuditLogsByEntityId) # noqa: E501 + + Returns a page of audit logs related to the actions on the targeted entity. Basically, this API call is used to get the full lifecycle of some specific entity. For example to see when a device was created, updated, assigned to some customer, or even deleted from the system. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_entity_id_using_get_with_http_info(entity_type, entity_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_entity_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_entity_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/entity/{entityType}/{entityId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_by_user_id_using_get(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_by_user_id_using_get_with_http_info(self, user_id, page_size, page, **kwargs): # noqa: E501 + """Get audit logs by user id (getAuditLogsByUserId) # noqa: E501 + + Returns a page of audit logs related to the actions of targeted user. For example, RPC call to a particular device, or alarm acknowledgment for a specific device, etc. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_by_user_id_using_get_with_http_info(user_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_by_user_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_by_user_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs/user/{userId}{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_audit_logs_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_audit_logs_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_audit_logs_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get all audit logs (getAuditLogs) # noqa: E501 + + Returns a page of audit logs related to all entities in the scope of the current user's Tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the audit logs. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_audit_logs_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on one of the next properties: entityType, entityName, userName, actionType, actionStatus. + :param str sort_property: Property of audit log to sort by. See the 'Model' tab of the Response Class for more details. Note: entityType sort property is not defined in the AuditLog class, however, it can be used to sort audit logs by types of entities that were logged. + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the AuditLog class field: 'createdTime'. + :param str action_types: A String value representing comma-separated list of action types. This parameter is optional, but it can be used to filter results to fetch only audit logs of specific action types. For example, 'LOGIN', 'LOGOUT'. See the 'Model' tab of the Response Class for more details. + :return: PageDataAuditLog + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time', 'action_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_audit_logs_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_audit_logs_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_audit_logs_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + if 'action_types' in params: + query_params.append(('actionTypes', params['action_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/audit/logs{?actionTypes,endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAuditLog', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/auth_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/auth_controller_api.py new file mode 100644 index 0000000..5f7e9b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/auth_controller_api.py @@ -0,0 +1,882 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class AuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def activate_user_using_post(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.activate_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def activate_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Activate User # noqa: E501 + + Checks the activation token and updates corresponding user password in the database. Now the user may start using his password to login. The response already contains the [JWT](https://jwt.io) activation and refresh tokens, to simplify the user activation flow and avoid asking user to input password again after activation. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ActivateUserRequest body: + :param bool send_activation_mail: sendActivationMail + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def change_password_using_post(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.change_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def change_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Change password for current User (changePassword) # noqa: E501 + + Change the password for the User which credentials are used to perform this REST API call. Be aware that previously generated [JWT](https://jwt.io/) tokens will be still valid until they expire. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ChangePasswordRequest body: + :return: ObjectNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/changePassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ObjectNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_activate_token_using_get(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + else: + (data) = self.check_activate_token_using_get_with_http_info(activate_token, **kwargs) # noqa: E501 + return data + + def check_activate_token_using_get_with_http_info(self, activate_token, **kwargs): # noqa: E501 + """Check Activate User Token (checkActivateToken) # noqa: E501 + + Checks the activation token and forwards user to 'Create Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Create Password' page and same 'activateToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_activate_token_using_get_with_http_info(activate_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str activate_token: The activate token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['activate_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_activate_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'activate_token' is set + if ('activate_token' not in params or + params['activate_token'] is None): + raise ValueError("Missing the required parameter `activate_token` when calling `check_activate_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'activate_token' in params: + query_params.append(('activateToken', params['activate_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activate{?activateToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_reset_token_using_get(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + else: + (data) = self.check_reset_token_using_get_with_http_info(reset_token, **kwargs) # noqa: E501 + return data + + def check_reset_token_using_get_with_http_info(self, reset_token, **kwargs): # noqa: E501 + """Check password reset token (checkResetToken) # noqa: E501 + + Checks the password reset token and forwards user to 'Reset Password' page. If token is valid, returns '303 See Other' (redirect) response code with the correct address of 'Reset Password' page and same 'resetToken' specified in the URL parameters. If token is not valid, returns '409 Conflict'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_reset_token_using_get_with_http_info(reset_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str reset_token: The reset token string. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['reset_token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_reset_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'reset_token' is set + if ('reset_token' not in params or + params['reset_token'] is None): + raise ValueError("Missing the required parameter `reset_token` when calling `check_reset_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'reset_token' in params: + query_params.append(('resetToken', params['reset_token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword{?resetToken}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_password_policy_using_get(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_password_policy_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_password_policy_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the current User password policy (getUserPasswordPolicy) # noqa: E501 + + API call to get the password policy for the password validation form(s). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_password_policy_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserPasswordPolicy + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_password_policy_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/userPasswordPolicy', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserPasswordPolicy', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_using_get(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current User (getUser) # noqa: E501 + + Get the information about the User which credentials are used to perform this REST API call. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/user', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def logout_using_post(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.logout_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def logout_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Logout (logout) # noqa: E501 + + Special API call to record the 'logout' of the user to the Audit Logs. Since platform uses [JWT](https://jwt.io/), the actual logout is the procedure of clearing the [JWT](https://jwt.io/) token on the client side. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.logout_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/logout', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_reset_password_by_email_using_post(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.request_reset_password_by_email_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def request_reset_password_by_email_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Request reset password email (requestResetPasswordByEmail) # noqa: E501 + + Request to send the reset password email if the user with specified email address is present in the database. Always return '200 OK' status for security purposes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_reset_password_by_email_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordEmailRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_reset_password_by_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPasswordByEmail', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reset_password_using_post(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.reset_password_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def reset_password_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Reset password (resetPassword) # noqa: E501 + + Checks the password reset token and updates the password. If token is valid, returns the object that contains [JWT](https://jwt.io/) access and refresh tokens. If token is not valid, returns '404 Bad Request'. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reset_password_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ResetPasswordRequest body: + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reset_password_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resetPassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/billing_endpoint_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/billing_endpoint_controller_api.py new file mode 100644 index 0000000..9a11d22 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/billing_endpoint_controller_api.py @@ -0,0 +1,868 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class BillingEndpointControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_tenant_can_update_plan_using_post(self, body, **kwargs): # noqa: E501 + """checkTenantCanUpdatePlan # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_tenant_can_update_plan_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: canUpdatePlanRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_tenant_can_update_plan_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.check_tenant_can_update_plan_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def check_tenant_can_update_plan_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """checkTenantCanUpdatePlan # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_tenant_can_update_plan_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: canUpdatePlanRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_tenant_can_update_plan_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `check_tenant_can_update_plan_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenantCanUpdatePlan', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def notify_tenant_plan_changed_using_post(self, body, **kwargs): # noqa: E501 + """notifyTenantPlanChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_plan_changed_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantPlanChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.notify_tenant_plan_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.notify_tenant_plan_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def notify_tenant_plan_changed_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """notifyTenantPlanChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_plan_changed_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantPlanChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method notify_tenant_plan_changed_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `notify_tenant_plan_changed_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenantPlanChanged', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def notify_tenant_state_changed_using_post(self, body, **kwargs): # noqa: E501 + """notifyTenantStateChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_state_changed_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantStateChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.notify_tenant_state_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.notify_tenant_state_changed_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def notify_tenant_state_changed_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """notifyTenantStateChanged # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.notify_tenant_state_changed_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: tenantStateChangedRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method notify_tenant_state_changed_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `notify_tenant_state_changed_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenantStateChanged', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_account_activated_email_using_post(self, body, **kwargs): # noqa: E501 + """sendAccountActivatedEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_account_activated_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendAccountActivatedEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_account_activated_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_account_activated_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_account_activated_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendAccountActivatedEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_account_activated_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendAccountActivatedEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_account_activated_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_account_activated_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendAccountActivated', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_activation_email_using_post(self, body, **kwargs): # noqa: E501 + """sendActivationEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendActivationEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_activation_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_activation_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_activation_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendActivationEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendActivationEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_activation_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_activation_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendActivation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_password_was_reset_email_using_post(self, body, **kwargs): # noqa: E501 + """sendPasswordWasResetEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_password_was_reset_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendPassowordWasResetEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_password_was_reset_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_password_was_reset_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_password_was_reset_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendPasswordWasResetEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_password_was_reset_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendPassowordWasResetEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_password_was_reset_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_password_was_reset_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendPasswordWasReset', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_reset_password_email_using_post(self, body, **kwargs): # noqa: E501 + """sendResetPasswordEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_reset_password_email_using_post(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendResetPasswordEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_reset_password_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + else: + (data) = self.send_reset_password_email_using_post_with_http_info(body, **kwargs) # noqa: E501 + return data + + def send_reset_password_email_using_post_with_http_info(self, body, **kwargs): # noqa: E501 + """sendResetPasswordEmail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_reset_password_email_using_post_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: sendResetPasswordEmailRequest (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_reset_password_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `send_reset_password_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/sendResetPassword', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_has_billing_read_using_get(self, **kwargs): # noqa: E501 + """tenantHasBillingRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_read_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_billing_read_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_billing_read_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_billing_read_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasBillingRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_read_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_billing_read_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenant/permission/billing/read', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_has_billing_write_using_get(self, **kwargs): # noqa: E501 + """tenantHasBillingWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_write_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_billing_write_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_billing_write_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_billing_write_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasBillingWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_billing_write_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_billing_write_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/billingEndpoint/tenant/permission/billing/write', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/blob_entity_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/blob_entity_controller_api.py new file mode 100644 index 0000000..da293ee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/blob_entity_controller_api.py @@ -0,0 +1,554 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class BlobEntityControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_blob_entity_using_delete(self, blob_entity_id, **kwargs): # noqa: E501 + """Delete Blob Entity (deleteBlobEntity) # noqa: E501 + + Delete Blob entity based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_blob_entity_using_delete(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_blob_entity_using_delete_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_blob_entity_using_delete_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + return data + + def delete_blob_entity_using_delete_with_http_info(self, blob_entity_id, **kwargs): # noqa: E501 + """Delete Blob Entity (deleteBlobEntity) # noqa: E501 + + Delete Blob entity based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_blob_entity_using_delete_with_http_info(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_blob_entity_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_id' is set + if ('blob_entity_id' not in params or + params['blob_entity_id'] is None): + raise ValueError("Missing the required parameter `blob_entity_id` when calling `delete_blob_entity_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'blob_entity_id' in params: + path_params['blobEntityId'] = params['blob_entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntity/{blobEntityId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_blob_entity_using_get(self, blob_entity_id, **kwargs): # noqa: E501 + """Download Blob Entity By Id (downloadBlobEntity) # noqa: E501 + + Download report file based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_blob_entity_using_get(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_blob_entity_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + else: + (data) = self.download_blob_entity_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + return data + + def download_blob_entity_using_get_with_http_info(self, blob_entity_id, **kwargs): # noqa: E501 + """Download Blob Entity By Id (downloadBlobEntity) # noqa: E501 + + Download report file based on the provided Blob entity Id. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_blob_entity_using_get_with_http_info(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_blob_entity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_id' is set + if ('blob_entity_id' not in params or + params['blob_entity_id'] is None): + raise ValueError("Missing the required parameter `blob_entity_id` when calling `download_blob_entity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'blob_entity_id' in params: + path_params['blobEntityId'] = params['blob_entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntity/{blobEntityId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_blob_entities_by_ids_using_get(self, blob_entity_ids, **kwargs): # noqa: E501 + """Get Blob Entities By Ids (getBlobEntitiesByIds) # noqa: E501 + + Requested blob entities must be owned by tenant or assigned to customer which user is performing the request. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.). See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_by_ids_using_get(blob_entity_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_ids: A list of blob entity ids, separated by comma ',' (required) + :return: list[BlobEntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_blob_entities_by_ids_using_get_with_http_info(blob_entity_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_blob_entities_by_ids_using_get_with_http_info(blob_entity_ids, **kwargs) # noqa: E501 + return data + + def get_blob_entities_by_ids_using_get_with_http_info(self, blob_entity_ids, **kwargs): # noqa: E501 + """Get Blob Entities By Ids (getBlobEntitiesByIds) # noqa: E501 + + Requested blob entities must be owned by tenant or assigned to customer which user is performing the request. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.). See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_by_ids_using_get_with_http_info(blob_entity_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_ids: A list of blob entity ids, separated by comma ',' (required) + :return: list[BlobEntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_blob_entities_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_ids' is set + if ('blob_entity_ids' not in params or + params['blob_entity_ids'] is None): + raise ValueError("Missing the required parameter `blob_entity_ids` when calling `get_blob_entities_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'blob_entity_ids' in params: + query_params.append(('blobEntityIds', params['blob_entity_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntities{?blobEntityIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[BlobEntityInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_blob_entities_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Blob Entities (getBlobEntities) # noqa: E501 + + Returns a page of BlobEntityWithCustomerInfo object that are available for the current user. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the blob entity type. For example, 'report' + :param str text_search: The case insensitive 'startsWith' filter based on the blob entity name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :return: PageDataBlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_blob_entities_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_blob_entities_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_blob_entities_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Blob Entities (getBlobEntities) # noqa: E501 + + Returns a page of BlobEntityWithCustomerInfo object that are available for the current user. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entities_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the blob entity type. For example, 'report' + :param str text_search: The case insensitive 'startsWith' filter based on the blob entity name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: The start timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :param int end_time: The end timestamp in milliseconds of the search time range over the BlobEntityWithCustomerInfo class field: 'createdTime'. + :return: PageDataBlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_blob_entities_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_blob_entities_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_blob_entities_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntities{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataBlobEntityWithCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_blob_entity_info_by_id_using_get(self, blob_entity_id, **kwargs): # noqa: E501 + """Get Blob Entity With Customer Info (getBlobEntityInfoById) # noqa: E501 + + Fetch the BlobEntityWithCustomerInfo object based on the provided Blob entity Id. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entity_info_by_id_using_get(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: BlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_blob_entity_info_by_id_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_blob_entity_info_by_id_using_get_with_http_info(blob_entity_id, **kwargs) # noqa: E501 + return data + + def get_blob_entity_info_by_id_using_get_with_http_info(self, blob_entity_id, **kwargs): # noqa: E501 + """Get Blob Entity With Customer Info (getBlobEntityInfoById) # noqa: E501 + + Fetch the BlobEntityWithCustomerInfo object based on the provided Blob entity Id. The platform uses Blob(binary large object) entities in the reporting feature, in order to store Dashboard states snapshots of different content types in base64 format. BlobEntityWithCustomerInfo represents an object that contains base info about the blob entity(name, type, contentType, etc.) and info about the customer(customerTitle, customerIsPublic) of the user that scheduled generation of the dashboard report. Referencing non-existing Blob entity Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_blob_entity_info_by_id_using_get_with_http_info(blob_entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str blob_entity_id: A string value representing the blob entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: BlobEntityWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['blob_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_blob_entity_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'blob_entity_id' is set + if ('blob_entity_id' not in params or + params['blob_entity_id'] is None): + raise ValueError("Missing the required parameter `blob_entity_id` when calling `get_blob_entity_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'blob_entity_id' in params: + path_params['blobEntityId'] = params['blob_entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/blobEntity/info/{blobEntityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BlobEntityWithCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/chirp_stack_integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/chirp_stack_integration_controller_api.py new file mode 100644 index 0000000..04e9156 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/chirp_stack_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ChirpStackIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/chirpstack/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/cloud_endpoint_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/cloud_endpoint_controller_api.py new file mode 100644 index 0000000..bedf6e6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/cloud_endpoint_controller_api.py @@ -0,0 +1,298 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CloudEndpointControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def tenant_has_white_label_read_using_get(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_read_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_white_label_read_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_white_label_read_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_white_label_read_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelRead # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_read_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_white_label_read_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/cloudEndpoint/tenant/permission/whiteLabel/read', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_has_white_label_write_using_get(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_write_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_has_white_label_write_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_has_white_label_write_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_has_white_label_write_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantHasWhiteLabelWrite # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_has_white_label_write_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_has_white_label_write_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/cloudEndpoint/tenant/permission/whiteLabel/write', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def tenant_white_labeling_allowed_using_get(self, **kwargs): # noqa: E501 + """tenantWhiteLabelingAllowed # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_white_labeling_allowed_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.tenant_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.tenant_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def tenant_white_labeling_allowed_using_get_with_http_info(self, **kwargs): # noqa: E501 + """tenantWhiteLabelingAllowed # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.tenant_white_labeling_allowed_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method tenant_white_labeling_allowed_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/cloudEndpoint/tenant/permission/whiteLabelingAllowed', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/component_descriptor_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/component_descriptor_controller_api.py new file mode 100644 index 0000000..c445505 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/component_descriptor_controller_api.py @@ -0,0 +1,340 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ComponentDescriptorControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_component_descriptor_by_clazz_using_get(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, **kwargs) # noqa: E501 + return data + + def get_component_descriptor_by_clazz_using_get_with_http_info(self, component_descriptor_clazz, **kwargs): # noqa: E501 + """Get Component Descriptor (getComponentDescriptorByClazz) # noqa: E501 + + Gets the Component Descriptor object using class name from the path parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptor_by_clazz_using_get_with_http_info(component_descriptor_clazz, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_descriptor_clazz: Component Descriptor class name (required) + :return: ComponentDescriptor + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_descriptor_clazz'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptor_by_clazz_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_descriptor_clazz' is set + if ('component_descriptor_clazz' not in params or + params['component_descriptor_clazz'] is None): + raise ValueError("Missing the required parameter `component_descriptor_clazz` when calling `get_component_descriptor_by_clazz_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_descriptor_clazz' in params: + path_params['componentDescriptorClazz'] = params['component_descriptor_clazz'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/component/{componentDescriptorClazz}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ComponentDescriptor', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_type_using_get(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_type_using_get_with_http_info(component_type, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_type_using_get_with_http_info(self, component_type, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByType) # noqa: E501 + + Gets the Component Descriptors using rule node type and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_type_using_get_with_http_info(component_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_type: Type of the Rule Node (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_type', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_type' is set + if ('component_type' not in params or + params['component_type'] is None): + raise ValueError("Missing the required parameter `component_type` when calling `get_component_descriptors_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'component_type' in params: + path_params['componentType'] = params['component_type'] # noqa: E501 + + query_params = [] + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components/{componentType}{?ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_component_descriptors_by_types_using_get(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + else: + (data) = self.get_component_descriptors_by_types_using_get_with_http_info(component_types, **kwargs) # noqa: E501 + return data + + def get_component_descriptors_by_types_using_get_with_http_info(self, component_types, **kwargs): # noqa: E501 + """Get Component Descriptors (getComponentDescriptorsByTypes) # noqa: E501 + + Gets the Component Descriptors using coma separated list of rule node types and optional rule chain type request parameters. Each Component Descriptor represents configuration of specific rule node (e.g. 'Save Timeseries' or 'Send Email'.). The Component Descriptors are used by the rule chain Web UI to build the configuration forms for the rule nodes. The Component Descriptors are discovered at runtime by scanning the class path and searching for @RuleNode annotation. Once discovered, the up to date list of descriptors is persisted to the database. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_component_descriptors_by_types_using_get_with_http_info(component_types, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str component_types: List of types of the Rule Nodes, (ENRICHMENT, FILTER, TRANSFORMATION, ACTION or EXTERNAL) (required) + :param str rule_chain_type: Type of the Rule Chain + :return: list[ComponentDescriptor] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['component_types', 'rule_chain_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_component_descriptors_by_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'component_types' is set + if ('component_types' not in params or + params['component_types'] is None): + raise ValueError("Missing the required parameter `component_types` when calling `get_component_descriptors_by_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'component_types' in params: + query_params.append(('componentTypes', params['component_types'])) # noqa: E501 + if 'rule_chain_type' in params: + query_params.append(('ruleChainType', params['rule_chain_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/components{?componentTypes,ruleChainType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[ComponentDescriptor]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/converter_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/converter_controller_api.py new file mode 100644 index 0000000..70f8d79 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/converter_controller_api.py @@ -0,0 +1,839 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ConverterControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_converter_using_delete(self, converter_id, **kwargs): # noqa: E501 + """Delete converter (deleteConverter) # noqa: E501 + + Deletes the converter and all the relations (from and to the converter). Referencing non-existing converter Id will cause an error. If the converter is associated with the integration, it will not be allowed for deletion. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_converter_using_delete(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_converter_using_delete_with_http_info(converter_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_converter_using_delete_with_http_info(converter_id, **kwargs) # noqa: E501 + return data + + def delete_converter_using_delete_with_http_info(self, converter_id, **kwargs): # noqa: E501 + """Delete converter (deleteConverter) # noqa: E501 + + Deletes the converter and all the relations (from and to the converter). Referencing non-existing converter Id will cause an error. If the converter is associated with the integration, it will not be allowed for deletion. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_converter_using_delete_with_http_info(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_converter_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_id' is set + if ('converter_id' not in params or + params['converter_id'] is None): + raise ValueError("Missing the required parameter `converter_id` when calling `delete_converter_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'converter_id' in params: + path_params['converterId'] = params['converter_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/{converterId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_converter_by_id_using_get(self, converter_id, **kwargs): # noqa: E501 + """Get Converter (getConverterById) # noqa: E501 + + Fetch the Converter object based on the provided Converter Id. The server checks that the converter is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converter_by_id_using_get(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_converter_by_id_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + else: + (data) = self.get_converter_by_id_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + return data + + def get_converter_by_id_using_get_with_http_info(self, converter_id, **kwargs): # noqa: E501 + """Get Converter (getConverterById) # noqa: E501 + + Fetch the Converter object based on the provided Converter Id. The server checks that the converter is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converter_by_id_using_get_with_http_info(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_converter_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_id' is set + if ('converter_id' not in params or + params['converter_id'] is None): + raise ValueError("Missing the required parameter `converter_id` when calling `get_converter_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'converter_id' in params: + path_params['converterId'] = params['converter_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/{converterId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Converter', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_converters_by_ids_using_get(self, converter_ids, **kwargs): # noqa: E501 + """Get Converters By Ids (getConvertersByIds) # noqa: E501 + + Requested converters must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_by_ids_using_get(converter_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_ids: A list of converter ids, separated by comma ',' (required) + :return: list[Converter] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_converters_by_ids_using_get_with_http_info(converter_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_converters_by_ids_using_get_with_http_info(converter_ids, **kwargs) # noqa: E501 + return data + + def get_converters_by_ids_using_get_with_http_info(self, converter_ids, **kwargs): # noqa: E501 + """Get Converters By Ids (getConvertersByIds) # noqa: E501 + + Requested converters must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_by_ids_using_get_with_http_info(converter_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_ids: A list of converter ids, separated by comma ',' (required) + :return: list[Converter] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_converters_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_ids' is set + if ('converter_ids' not in params or + params['converter_ids'] is None): + raise ValueError("Missing the required parameter `converter_ids` when calling `get_converters_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'converter_ids' in params: + query_params.append(('converterIds', params['converter_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converters{?converterIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Converter]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_converters_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Converters (getConverters) # noqa: E501 + + Returns a page of converters owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template converters + :param str text_search: The case insensitive 'startsWith' filter based on the converter name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataConverter + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_converters_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_converters_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_converters_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Converters (getConverters) # noqa: E501 + + Returns a page of converters owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_converters_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template converters + :param str text_search: The case insensitive 'startsWith' filter based on the converter name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataConverter + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'is_edge_template', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_converters_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_converters_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_converters_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_edge_template' in params: + query_params.append(('isEdgeTemplate', params['is_edge_template'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converters{?isEdgeTemplate,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataConverter', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_converter_debug_input_using_get(self, converter_id, **kwargs): # noqa: E501 + """Get latest debug input event (getLatestConverterDebugInput) # noqa: E501 + + Returns a JSON object of the latest debug event representing the input message the converter processed. ## Uplink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":40}\", \"inMetadata\":\"{\\\"Header:sec-ch-ua\\\":\\\"\\\\\\\"Chromium\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\"Google Chrome\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\";Not A Brand\\\\\\\";v=\\\\\\\"99\\\\\\\"\\\",\\\"Header:user-agent\\\":\\\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36\\\",\\\"integrationName\\\":\\\"Integration\\\",\\\"Header:cookie\\\":\\\"GUID=zYSs8hymSwZKv8kHALKY; redirect_to=%2F; JSESSIONID=B0A7C8E481409CE7924E738DB04F62F9\\\",\\\"Header:sec-ch-ua-platform\\\":\\\"\\\\\\\"Linux\\\\\\\"\\\",\\\"Header:accept\\\":\\\"*/*\\\",\\\"Header:origin\\\":\\\"http://localhost:8080\\\",\\\"Header:sec-fetch-site\\\":\\\"same-origin\\\",\\\"Header:connection\\\":\\\"keep-alive\\\",\\\"Header:accept-encoding\\\":\\\"gzip, deflate, br\\\",\\\"Header:content-type\\\":\\\"application/json\\\",\\\"Header:content-length\\\":\\\"16\\\",\\\"Header:sec-fetch-mode\\\":\\\"cors\\\",\\\"Header:sec-ch-ua-mobile\\\":\\\"?0\\\",\\\"Header:sec-fetch-dest\\\":\\\"empty\\\",\\\"Header:host\\\":\\\"localhost:8080\\\",\\\"Header:referer\\\":\\\"http://localhost:8080/swagger-ui.html\\\",\\\"Header:accept-language\\\":\\\"en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,uk;q=0.6,und;q=0.5\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - message data received; * 'inMetadata' - integration metadata (e.g. headers). ## Downlink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":42,\\\"humidity\\\":77}\", \"inMsgType\":\"POST_TELEMETRY_REQUEST\", \"inMetadata\":\"{\\\"data\\\":\\\"40\\\"}\", \"inIntegrationMetadata\":\"{\\\"integrationName\\\":\\\"Integration\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - content of the message pushed from the rule engine; * 'inMsgType' - type of the message pushed from the rule engine; * 'inMetadata' - content of the message metadata pushed from the rule engine; * 'inIntegrationMetadata' - integration metadata. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_converter_debug_input_using_get(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_converter_debug_input_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_converter_debug_input_using_get_with_http_info(converter_id, **kwargs) # noqa: E501 + return data + + def get_latest_converter_debug_input_using_get_with_http_info(self, converter_id, **kwargs): # noqa: E501 + """Get latest debug input event (getLatestConverterDebugInput) # noqa: E501 + + Returns a JSON object of the latest debug event representing the input message the converter processed. ## Uplink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":40}\", \"inMetadata\":\"{\\\"Header:sec-ch-ua\\\":\\\"\\\\\\\"Chromium\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\"Google Chrome\\\\\\\";v=\\\\\\\"94\\\\\\\", \\\\\\\";Not A Brand\\\\\\\";v=\\\\\\\"99\\\\\\\"\\\",\\\"Header:user-agent\\\":\\\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36\\\",\\\"integrationName\\\":\\\"Integration\\\",\\\"Header:cookie\\\":\\\"GUID=zYSs8hymSwZKv8kHALKY; redirect_to=%2F; JSESSIONID=B0A7C8E481409CE7924E738DB04F62F9\\\",\\\"Header:sec-ch-ua-platform\\\":\\\"\\\\\\\"Linux\\\\\\\"\\\",\\\"Header:accept\\\":\\\"*/*\\\",\\\"Header:origin\\\":\\\"http://localhost:8080\\\",\\\"Header:sec-fetch-site\\\":\\\"same-origin\\\",\\\"Header:connection\\\":\\\"keep-alive\\\",\\\"Header:accept-encoding\\\":\\\"gzip, deflate, br\\\",\\\"Header:content-type\\\":\\\"application/json\\\",\\\"Header:content-length\\\":\\\"16\\\",\\\"Header:sec-fetch-mode\\\":\\\"cors\\\",\\\"Header:sec-ch-ua-mobile\\\":\\\"?0\\\",\\\"Header:sec-fetch-dest\\\":\\\"empty\\\",\\\"Header:host\\\":\\\"localhost:8080\\\",\\\"Header:referer\\\":\\\"http://localhost:8080/swagger-ui.html\\\",\\\"Header:accept-language\\\":\\\"en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,uk;q=0.6,und;q=0.5\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - message data received; * 'inMetadata' - integration metadata (e.g. headers). ## Downlink Converter Debug Input Event Example ```json { \"inContentType\":\"JSON\", \"inContent\":\"{\\\"temp\\\":42,\\\"humidity\\\":77}\", \"inMsgType\":\"POST_TELEMETRY_REQUEST\", \"inMetadata\":\"{\\\"data\\\":\\\"40\\\"}\", \"inIntegrationMetadata\":\"{\\\"integrationName\\\":\\\"Integration\\\"}\" } ``` * 'inContentType' - content type of the message received by the integration; * 'inContent' - content of the message pushed from the rule engine; * 'inMsgType' - type of the message pushed from the rule engine; * 'inMetadata' - content of the message metadata pushed from the rule engine; * 'inIntegrationMetadata' - integration metadata. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_converter_debug_input_using_get_with_http_info(converter_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str converter_id: A string value representing the converter id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['converter_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_converter_debug_input_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'converter_id' is set + if ('converter_id' not in params or + params['converter_id'] is None): + raise ValueError("Missing the required parameter `converter_id` when calling `get_latest_converter_debug_input_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'converter_id' in params: + path_params['converterId'] = params['converter_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/{converterId}/debugIn', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_converter_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Converter (saveConverter) # noqa: E501 + + Create or update the Converter. When creating converter, platform generates Converter Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created converter id will be present in the response. Specify existing Converter id to update the converter. Referencing non-existing converter Id will cause 'Not Found' error. Converter name is unique in the scope of tenant. # Converter Configuration Converter configuration (**'configuration'** field) is the JSON object that should contain one of two possible fields: **'decoder'** or **'encoder'**. The former is used when the converter has UPLINK type, the latter is used - when DOWNLINK type. It can contain both 'decoder' and 'encoder' fields, when the correct one is specified for the appropriate converter type, another one can be set to 'null'. See the examples of each one below. ## Uplink Converter Configuration ```json { \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\", \"encoder\":null } ``` Decoder field in the more readable form: ```text // Decode an uplink message from a buffer // payload - array of bytes // metadata - key/value object /** Decoder **/ // decode payload to string var payloadStr = decodeToString(payload); // decode payload to JSON // var data = decodeToJson(payload); var deviceName = 'Device A'; var deviceType = 'thermostat'; var customerName = 'customer'; var groupName = 'thermostat devices'; // use assetName and assetType instead of deviceName and deviceType // to automatically create assets instead of devices. // var assetName = 'Asset A'; // var assetType = 'building'; // Result object with device/asset attributes/telemetry data var result = { // Use deviceName and deviceType or assetName and assetType, but not both. deviceName: deviceName, deviceType: deviceType, // assetName: assetName, // assetType: assetType, customerName: customerName, groupName: groupName, attributes: { model: 'Model A', serialNumber: 'SN111', integrationName: metadata['integrationName'] }, telemetry: { temperature: 42, humidity: 80, rawData: payloadStr } }; /** Helper functions **/ function decodeToString(payload) { return String.fromCharCode.apply(String, payload); } function decodeToJson(payload) { // covert payload to string. var str = decodeToString(payload); // parse string to JSON var data = JSON.parse(str); return data; } return result; ``` ## Downlink Converter Configuration ```json { \"decoder\":null, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempFreq = msg.temperatureUploadFrequency;\\ndata.humFreq = msg.humidityUploadFrequency;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` Encoder field in the more readable form: ```text // Encode downlink data from incoming Rule Engine message // msg - JSON message payload downlink message json // msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. // metadata - list of key-value pairs with additional data about the message // integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter /** Encoder **/ var data = {}; // Process data from incoming message and metadata data.tempFreq = msg.temperatureUploadFrequency; data.humFreq = msg.humidityUploadFrequency; data.devSerialNumber = metadata['ss_serialNumber']; // Result object with encoded downlink payload var result = { // downlink data content type: JSON, TEXT or BINARY (base64 format) contentType: \"JSON\", // downlink data data: JSON.stringify(data), // Optional metadata object presented in key/value format metadata: { topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload' } }; return result; ``` Remove 'id', 'tenantId' from the request body example (below) to create new converter entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_converter_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Converter body: + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_converter_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_converter_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_converter_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Converter (saveConverter) # noqa: E501 + + Create or update the Converter. When creating converter, platform generates Converter Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created converter id will be present in the response. Specify existing Converter id to update the converter. Referencing non-existing converter Id will cause 'Not Found' error. Converter name is unique in the scope of tenant. # Converter Configuration Converter configuration (**'configuration'** field) is the JSON object that should contain one of two possible fields: **'decoder'** or **'encoder'**. The former is used when the converter has UPLINK type, the latter is used - when DOWNLINK type. It can contain both 'decoder' and 'encoder' fields, when the correct one is specified for the appropriate converter type, another one can be set to 'null'. See the examples of each one below. ## Uplink Converter Configuration ```json { \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\", \"encoder\":null } ``` Decoder field in the more readable form: ```text // Decode an uplink message from a buffer // payload - array of bytes // metadata - key/value object /** Decoder **/ // decode payload to string var payloadStr = decodeToString(payload); // decode payload to JSON // var data = decodeToJson(payload); var deviceName = 'Device A'; var deviceType = 'thermostat'; var customerName = 'customer'; var groupName = 'thermostat devices'; // use assetName and assetType instead of deviceName and deviceType // to automatically create assets instead of devices. // var assetName = 'Asset A'; // var assetType = 'building'; // Result object with device/asset attributes/telemetry data var result = { // Use deviceName and deviceType or assetName and assetType, but not both. deviceName: deviceName, deviceType: deviceType, // assetName: assetName, // assetType: assetType, customerName: customerName, groupName: groupName, attributes: { model: 'Model A', serialNumber: 'SN111', integrationName: metadata['integrationName'] }, telemetry: { temperature: 42, humidity: 80, rawData: payloadStr } }; /** Helper functions **/ function decodeToString(payload) { return String.fromCharCode.apply(String, payload); } function decodeToJson(payload) { // covert payload to string. var str = decodeToString(payload); // parse string to JSON var data = JSON.parse(str); return data; } return result; ``` ## Downlink Converter Configuration ```json { \"decoder\":null, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempFreq = msg.temperatureUploadFrequency;\\ndata.humFreq = msg.humidityUploadFrequency;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` Encoder field in the more readable form: ```text // Encode downlink data from incoming Rule Engine message // msg - JSON message payload downlink message json // msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. // metadata - list of key-value pairs with additional data about the message // integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter /** Encoder **/ var data = {}; // Process data from incoming message and metadata data.tempFreq = msg.temperatureUploadFrequency; data.humFreq = msg.humidityUploadFrequency; data.devSerialNumber = metadata['ss_serialNumber']; // Result object with encoded downlink payload var result = { // downlink data content type: JSON, TEXT or BINARY (base64 format) contentType: \"JSON\", // downlink data data: JSON.stringify(data), // Optional metadata object presented in key/value format metadata: { topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload' } }; return result; ``` Remove 'id', 'tenantId' from the request body example (below) to create new converter entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_converter_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Converter body: + :return: Converter + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_converter_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Converter', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_down_link_converter_using_post(self, **kwargs): # noqa: E501 + """Test converter function (testDownLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ \"data\":\"40\" }, \"msg\":\"{\\n \\\"temp\\\": 42,\\n \\\"humidity\\\": 77\\n}\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"integrationMetadata\":{ \"integrationName\":\"Integration\" }, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempValue = msg.temp;\\ndata.humValue = msg.humidity;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` * 'metadata' - message metadata pushed from the rule engine; * 'msg' - message data pushed from the rule engine; * 'msgType' - type of the message pushed from the rule engine; * 'integrationMetadata' - integration metadata object; * 'encoder' - string representation of the encoder configuration. ## Response Body Example ```json { \"contentType\":\"JSON\", \"data\":\"{\\\"tempValue\\\":42,\\\"humValue\\\":77}\", \"metadata\":{ \"topic\":\"sensor/Temp Sensor/upload\" } } ``` * 'contentType' - downlink data content type; * 'data' - downlink data; * 'metadata' - optional metadata object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_down_link_converter_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_down_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_down_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_down_link_converter_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test converter function (testDownLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ \"data\":\"40\" }, \"msg\":\"{\\n \\\"temp\\\": 42,\\n \\\"humidity\\\": 77\\n}\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"integrationMetadata\":{ \"integrationName\":\"Integration\" }, \"encoder\":\"// Encode downlink data from incoming Rule Engine message\\n\\n// msg - JSON message payload downlink message json\\n// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc.\\n// metadata - list of key-value pairs with additional data about the message\\n// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter\\n\\n/** Encoder **/\\n\\nvar data = {};\\n\\n// Process data from incoming message and metadata\\n\\ndata.tempValue = msg.temp;\\ndata.humValue = msg.humidity;\\n\\ndata.devSerialNumber = metadata['ss_serialNumber'];\\n\\n// Result object with encoded downlink payload\\nvar result = {\\n\\n // downlink data content type: JSON, TEXT or BINARY (base64 format)\\n contentType: \\\"JSON\\\",\\n\\n // downlink data\\n data: JSON.stringify(data),\\n\\n // Optional metadata object presented in key/value format\\n metadata: {\\n topic: metadata['deviceType']+'/'+metadata['deviceName']+'/upload'\\n }\\n\\n};\\n\\nreturn result;\" } ``` * 'metadata' - message metadata pushed from the rule engine; * 'msg' - message data pushed from the rule engine; * 'msgType' - type of the message pushed from the rule engine; * 'integrationMetadata' - integration metadata object; * 'encoder' - string representation of the encoder configuration. ## Response Body Example ```json { \"contentType\":\"JSON\", \"data\":\"{\\\"tempValue\\\":42,\\\"humValue\\\":77}\", \"metadata\":{ \"topic\":\"sensor/Temp Sensor/upload\" } } ``` * 'contentType' - downlink data content type; * 'data' - downlink data; * 'metadata' - optional metadata object. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_down_link_converter_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_down_link_converter_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/testDownLink{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_up_link_converter_using_post(self, **kwargs): # noqa: E501 + """Test converter function (testUpLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ }, \"payload\":\"ewogICAgImRhdGEiOiAiZGF0YSIKfQ==\", \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\" } ``` * 'metadata' - integration metadata; * 'payload' - base64 string representation of the data; * 'decoder' - string representation of the decoder configuration. ## Response Body Example ```json { \"output\":\"{\\\"deviceName\\\":\\\"Device A\\\",\\\"deviceType\\\":\\\"thermostat\\\",\\\"customerName\\\":\\\"customer\\\",\\\"groupName\\\":\\\"thermostat devices\\\",\\\"attributes\\\":{\\\"model\\\":\\\"Model A\\\",\\\"serialNumber\\\":\\\"SN111\\\"},\\\"telemetry\\\":{\\\"temperature\\\":42,\\\"humidity\\\":80,\\\"rawData\\\":\\\"{\\\\n \\\\\\\"data\\\\\\\": \\\\\\\"data\\\\\\\"\\\\n}\\\"}}\", \"error\":\"\" } ``` * 'output' - string representation of the output message; * 'error' - string representation of the error message. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_up_link_converter_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_up_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_up_link_converter_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_up_link_converter_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test converter function (testUpLinkConverter) # noqa: E501 + + Returns a JSON object representing the result of the processed incoming message. ## Request Body Example ```json { \"metadata\":{ }, \"payload\":\"ewogICAgImRhdGEiOiAiZGF0YSIKfQ==\", \"decoder\":\"// Decode an uplink message from a buffer\\n// payload - array of bytes\\n// metadata - key/value object\\n\\n/** Decoder **/\\n\\n// decode payload to string\\nvar payloadStr = decodeToString(payload);\\n\\n// decode payload to JSON\\n// var data = decodeToJson(payload);\\n\\nvar deviceName = 'Device A';\\nvar deviceType = 'thermostat';\\nvar customerName = 'customer';\\nvar groupName = 'thermostat devices';\\n// use assetName and assetType instead of deviceName and deviceType\\n// to automatically create assets instead of devices.\\n// var assetName = 'Asset A';\\n// var assetType = 'building';\\n\\n// Result object with device/asset attributes/telemetry data\\nvar result = {\\n// Use deviceName and deviceType or assetName and assetType, but not both.\\n deviceName: deviceName,\\n deviceType: deviceType,\\n// assetName: assetName,\\n// assetType: assetType,\\n customerName: customerName,\\n groupName: groupName,\\n attributes: {\\n model: 'Model A',\\n serialNumber: 'SN111',\\n integrationName: metadata['integrationName']\\n },\\n telemetry: {\\n temperature: 42,\\n humidity: 80,\\n rawData: payloadStr\\n }\\n};\\n\\n/** Helper functions **/\\n\\nfunction decodeToString(payload) {\\n return String.fromCharCode.apply(String, payload);\\n}\\n\\nfunction decodeToJson(payload) {\\n // covert payload to string.\\n var str = decodeToString(payload);\\n\\n // parse string to JSON\\n var data = JSON.parse(str);\\n return data;\\n}\\n\\nreturn result;\" } ``` * 'metadata' - integration metadata; * 'payload' - base64 string representation of the data; * 'decoder' - string representation of the decoder configuration. ## Response Body Example ```json { \"output\":\"{\\\"deviceName\\\":\\\"Device A\\\",\\\"deviceType\\\":\\\"thermostat\\\",\\\"customerName\\\":\\\"customer\\\",\\\"groupName\\\":\\\"thermostat devices\\\",\\\"attributes\\\":{\\\"model\\\":\\\"Model A\\\",\\\"serialNumber\\\":\\\"SN111\\\"},\\\"telemetry\\\":{\\\"temperature\\\":42,\\\"humidity\\\":80,\\\"rawData\\\":\\\"{\\\\n \\\\\\\"data\\\\\\\": \\\\\\\"data\\\\\\\"\\\\n}\\\"}}\", \"error\":\"\" } ``` * 'output' - string representation of the output message; * 'error' - string representation of the error message. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_up_link_converter_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_up_link_converter_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/converter/testUpLink{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/custom_menu_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/custom_menu_controller_api.py new file mode 100644 index 0000000..9af438e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/custom_menu_controller_api.py @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomMenuControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_custom_menu_using_get(self, **kwargs): # noqa: E501 + """Get Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object that corresponds to the authority of the user. The API call is designed to load the custom menu items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom menu configured on a system level. And there is no custom menu items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_menu_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_custom_menu_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object that corresponds to the authority of the user. The API call is designed to load the custom menu items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom menu configured on a system level. And there is no custom menu items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_menu_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_custom_menu_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customMenu/currentCustomMenu', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomMenu', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_custom_menu_using_get(self, **kwargs): # noqa: E501 + """Get end-user Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object for the end user. The custom menu is configured in the white labeling parameters. If custom menu configuration on the tenant level is present, it overrides the menu configuration of the system level. Similar, if the custom menu configuration on the customer level is present, it overrides the menu configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_menu_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_custom_menu_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_custom_menu_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get end-user Custom Menu configuration (getCustomMenu) # noqa: E501 + + Fetch the Custom Menu object for the end user. The custom menu is configured in the white labeling parameters. If custom menu configuration on the tenant level is present, it overrides the menu configuration of the system level. Similar, if the custom menu configuration on the customer level is present, it overrides the menu configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_menu_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_menu_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customMenu/customMenu', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomMenu', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_custom_menu_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Custom Menu (saveCustomMenu) # noqa: E501 + + Creates or Updates the Custom Menu configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_menu_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomMenu body: + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_custom_menu_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_custom_menu_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_custom_menu_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Custom Menu (saveCustomMenu) # noqa: E501 + + Creates or Updates the Custom Menu configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_menu_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomMenu body: + :return: CustomMenu + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_custom_menu_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customMenu/customMenu', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomMenu', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/custom_translation_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/custom_translation_controller_api.py new file mode 100644 index 0000000..6a5885c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/custom_translation_controller_api.py @@ -0,0 +1,316 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomTranslationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_custom_translation_using_get(self, **kwargs): # noqa: E501 + """Get Custom Translation configuration (getCurrentCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map that corresponds to the authority of the user. The API call is designed to load the custom translation items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom translation configured on a system level. And there is no custom translation items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Response example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_translation_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_custom_translation_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Custom Translation configuration (getCurrentCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map that corresponds to the authority of the user. The API call is designed to load the custom translation items for edition. So, the result is NOT merged with the parent level configuration. Let's assume there is a custom translation configured on a system level. And there is no custom translation items configured on a tenant level. In such a case, the API call will return empty object for the tenant administrator. Response example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_custom_translation_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_custom_translation_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customTranslation/currentCustomTranslation', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomTranslation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_custom_translation_using_get(self, **kwargs): # noqa: E501 + """Get end-user Custom Translation configuration (getCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map for the end user. The custom translation is configured in the white labeling parameters. If custom translation translation is defined on the tenant level, it overrides the custom translation of the system level. Similar, if the custom translation is defined on the customer level, it overrides the translation configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_translation_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_custom_translation_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_custom_translation_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get end-user Custom Translation configuration (getCustomTranslation) # noqa: E501 + + Fetch the Custom Translation map for the end user. The custom translation is configured in the white labeling parameters. If custom translation translation is defined on the tenant level, it overrides the custom translation of the system level. Similar, if the custom translation is defined on the customer level, it overrides the translation configuration of the tenant level. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_custom_translation_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_custom_translation_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customTranslation/customTranslation', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomTranslation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_custom_translation_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Custom Translation (saveCustomTranslation) # noqa: E501 + + Creates or Updates the Custom Translation map. Request example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_translation_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomTranslation body: + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_custom_translation_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_custom_translation_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_custom_translation_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Custom Translation (saveCustomTranslation) # noqa: E501 + + Creates or Updates the Custom Translation map. Request example: ```json {\"translationMap\":{\"es_ES\":\"{\\\"home\\\":\\\"MyHome\\\"}\"}} ``` Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_custom_translation_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param CustomTranslation body: + :return: CustomTranslation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_custom_translation_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customTranslation/customTranslation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomTranslation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/customer_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/customer_controller_api.py new file mode 100644 index 0000000..6b64dfa --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/customer_controller_api.py @@ -0,0 +1,1413 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class CustomerControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_customer_using_delete(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_customer_using_delete_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def delete_customer_using_delete_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Delete Customer (deleteCustomer) # noqa: E501 + + Deletes the Customer and all customer Users. All assigned Dashboards, Assets, Devices, etc. will be unassigned but not deleted. Referencing non-existing Customer Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_customer_using_delete_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_customer_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `delete_customer_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_customer_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Customer Infos for current user (getAllCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_customer_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_customer_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_customer_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Customer Infos for current user (getAllCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_customer_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_customer_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_customer_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customerInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer (getCustomerById) # noqa: E501 + + Get the Customer object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_customer_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer sub-customers Infos (getCustomerCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_customer_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_customer_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_customer_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_customer_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer sub-customers Infos (getCustomerCustomerInfos) # noqa: E501 + + Returns a page of customer info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_customer_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_customer_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_customer_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_customer_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_customer_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/customerInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_info_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer info (getCustomerInfoById) # noqa: E501 + + Get the Customer info object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_info_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: CustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_info_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer info (getCustomerInfoById) # noqa: E501 + + Get the Customer info object based on the provided Customer Id. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_info_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: CustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/info/{customerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_title_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_title_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_customer_title_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get Customer Title (getCustomerTitleById) # noqa: E501 + + Get the title of the customer. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_title_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_title_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_title_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/text']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/title', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get customers by Entity Group Id (getCustomersByEntityGroupId) # noqa: E501 + + Returns a page of Customer objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customers_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get customers by Entity Group Id (getCustomersByEntityGroupId) # noqa: E501 + + Returns a page of Customer objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_customers_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customers_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customers_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_by_ids_using_get(self, customer_ids, **kwargs): # noqa: E501 + """Get customers by Customer Ids (getCustomersByEntityGroupId) # noqa: E501 + + Returns a list of Customer objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_ids_using_get(customer_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_ids: A list of customer ids, separated by comma ',' (required) + :return: list[Customer] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_by_ids_using_get_with_http_info(customer_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_by_ids_using_get_with_http_info(customer_ids, **kwargs) # noqa: E501 + return data + + def get_customers_by_ids_using_get_with_http_info(self, customer_ids, **kwargs): # noqa: E501 + """Get customers by Customer Ids (getCustomersByEntityGroupId) # noqa: E501 + + Returns a list of Customer objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_by_ids_using_get_with_http_info(customer_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_ids: A list of customer ids, separated by comma ',' (required) + :return: list[Customer] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_ids' is set + if ('customer_ids' not in params or + params['customer_ids'] is None): + raise ValueError("Missing the required parameter `customer_ids` when calling `get_customers_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'customer_ids' in params: + query_params.append(('customerIds', params['customer_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customers{?customerIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Customer]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customers_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_customers_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Customers (getCustomers) # noqa: E501 + + Returns a page of customers owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customers_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customers_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customers_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customers_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_short_customer_info_by_id_using_get(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + else: + (data) = self.get_short_customer_info_by_id_using_get_with_http_info(customer_id, **kwargs) # noqa: E501 + return data + + def get_short_customer_info_by_id_using_get_with_http_info(self, customer_id, **kwargs): # noqa: E501 + """Get short Customer info (getShortCustomerInfoById) # noqa: E501 + + Get the short customer object that contains only the title and 'isPublic' flag. If the user has the authority of 'Tenant Administrator', the server checks that the customer is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the user belongs to the customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_short_customer_info_by_id_using_get_with_http_info(customer_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_short_customer_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_short_customer_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/shortInfo', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_customer_using_get(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_customer_using_get_with_http_info(customer_title, **kwargs) # noqa: E501 + return data + + def get_tenant_customer_using_get_with_http_info(self, customer_title, **kwargs): # noqa: E501 + """Get Tenant Customer by Customer title (getTenantCustomer) # noqa: E501 + + Get the Customer using Customer Title. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_customer_using_get_with_http_info(customer_title, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_title: A string value representing the Customer title. (required) + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_title'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_customer_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_title' is set + if ('customer_title' not in params or + params['customer_title'] is None): + raise ValueError("Missing the required parameter `customer_title` when calling `get_tenant_customer_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'customer_title' in params: + query_params.append(('customerTitle', params['customer_title'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/customers{?customerTitle}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_customers_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Customers (getUserCustomers) # noqa: E501 + + Returns a page of customers available for the user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_customers_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_customers_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_customers_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Customers (getUserCustomers) # noqa: E501 + + Returns a page of customers available for the user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_customers_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the customer title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataCustomer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_customers_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_customers_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_customers_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/customers{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataCustomer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_customer_using_post(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_customer_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_customer_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update Customer (saveCustomer) # noqa: E501 + + Creates or Updates the Customer. When creating customer, platform generates Customer Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Customer Id will be present in the response. Specify existing Customer Id to update the Customer. Referencing non-existing Customer Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Customer entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_customer_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Customer body: + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity group. + :param str entity_group_ids: A list of string values, separated by comma ',' representing the Entity Group Ids. For example, '784f394c-42b6-435a-983c-b7beff2784f9','a84f394c-42b6-435a-083c-b7beff2784f9'. If specified, the entity will be added to the corresponding entity groups. + :return: Customer + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Customer', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/dashboard_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/dashboard_controller_api.py new file mode 100644 index 0000000..5f08bb0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/dashboard_controller_api.py @@ -0,0 +1,2190 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DashboardControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_dashboard_using_delete(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Only users with 'TENANT_ADMIN') authority may delete the dashboards. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_dashboard_using_delete_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def delete_dashboard_using_delete_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Delete the Dashboard (deleteDashboard) # noqa: E501 + + Delete the Dashboard. Only users with 'TENANT_ADMIN') authority may delete the dashboards. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_dashboard_using_delete_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_dashboard_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `delete_dashboard_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def export_group_dashboards_using_get(self, entity_group_id, limit, **kwargs): # noqa: E501 + """Export Dashboards (exportGroupDashboards) # noqa: E501 + + Export the dashboards that belong to specified group id.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_group_dashboards_using_get(entity_group_id, limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int limit: Limit of the entities to export (required) + :return: list[Dashboard] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.export_group_dashboards_using_get_with_http_info(entity_group_id, limit, **kwargs) # noqa: E501 + else: + (data) = self.export_group_dashboards_using_get_with_http_info(entity_group_id, limit, **kwargs) # noqa: E501 + return data + + def export_group_dashboards_using_get_with_http_info(self, entity_group_id, limit, **kwargs): # noqa: E501 + """Export Dashboards (exportGroupDashboards) # noqa: E501 + + Export the dashboards that belong to specified group id.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_group_dashboards_using_get_with_http_info(entity_group_id, limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int limit: Limit of the entities to export (required) + :return: list[Dashboard] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'limit'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method export_group_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `export_group_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'limit' is set + if ('limit' not in params or + params['limit'] is None): + raise ValueError("Missing the required parameter `limit` when calling `export_group_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/dashboards/export{?limit}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Dashboard]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Dashboards for current user (getAllDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant or the customer of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Dashboards for current user (getAllDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant or the customer of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboards/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_dashboards_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_dashboards_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Dashboards (getCustomerDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the specified customer. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_dashboards_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/dashboards{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Customer Home Dashboard Info (getCustomerHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_customer_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_customer_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Customer Home Dashboard Info (getCustomerHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard (getDashboardById) # noqa: E501 + + Get the dashboard based on 'dashboardId' parameter. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboard_info_by_id_using_get(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def get_dashboard_info_by_id_using_get_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """Get Dashboard Info (getDashboardInfoById) # noqa: E501 + + Get the information about the dashboard based on 'dashboardId' parameter. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboard_info_by_id_using_get_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboard_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `get_dashboard_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/info/{dashboardId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboards_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get dashboards by Entity Group Id (getDashboardsByEntityGroupId) # noqa: E501 + + Returns a page of Dashboard objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboards_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboards_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_dashboards_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get dashboards by Entity Group Id (getDashboardsByEntityGroupId) # noqa: E501 + + Returns a page of Dashboard objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboards_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_dashboards_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_dashboards_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_dashboards_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_dashboards_by_ids_using_get(self, dashboard_ids, **kwargs): # noqa: E501 + """Get dashboards by Dashboard Ids (getDashboardsByIds) # noqa: E501 + + Returns a list of DashboardInfo objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_ids_using_get(dashboard_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_ids: A list of dashboard ids, separated by comma ',' (required) + :return: list[DashboardInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_dashboards_by_ids_using_get_with_http_info(dashboard_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_dashboards_by_ids_using_get_with_http_info(dashboard_ids, **kwargs) # noqa: E501 + return data + + def get_dashboards_by_ids_using_get_with_http_info(self, dashboard_ids, **kwargs): # noqa: E501 + """Get dashboards by Dashboard Ids (getDashboardsByIds) # noqa: E501 + + Returns a list of DashboardInfo objects based on the provided ids. Filters the list based on the user permissions. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_dashboards_by_ids_using_get_with_http_info(dashboard_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_ids: A list of dashboard ids, separated by comma ',' (required) + :return: list[DashboardInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_dashboards_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_ids' is set + if ('dashboard_ids' not in params or + params['dashboard_ids'] is None): + raise ValueError("Missing the required parameter `dashboard_ids` when calling `get_dashboards_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'dashboard_ids' in params: + query_params.append(('dashboardIds', params['dashboard_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboards{?dashboardIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[DashboardInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard Info (getHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_home_dashboard_using_get(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_home_dashboard_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_home_dashboard_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Home Dashboard (getHomeDashboard) # noqa: E501 + + Returns the home dashboard object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the User. If 'homeDashboardId' parameter is not set on the User level and the User has authority 'CUSTOMER_USER', check the same parameter for the corresponding Customer. If 'homeDashboardId' parameter is not set on the User and Customer levels then checks the same parameter for the Tenant that owns the user. The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_home_dashboard_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_home_dashboard_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/home', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_max_datapoints_limit_using_get(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_max_datapoints_limit_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_max_datapoints_limit_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get max data points limit (getMaxDatapointsLimit) # noqa: E501 + + Get the maximum number of data points that dashboard may request from the server per in a single subscription command. This value impacts the time window behavior. It impacts 'Max values' parameter in case user selects 'None' as 'Data aggregation function'. It also impacts the 'Grouping interval' in case of any other 'Data aggregation function' is selected. The actual value of the limit is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_max_datapoints_limit_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_max_datapoints_limit_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/maxDatapointsLimit', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_server_time_using_get(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_server_time_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_server_time_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get server time (getServerTime) # noqa: E501 + + Get the server time (milliseconds since January 1, 1970 UTC). Used to adjust view of the dashboards according to the difference between browser and server time. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_server_time_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_server_time_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard/serverTime', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by the tenant of a current user. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboards{?mobile,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_dashboards_using_get1(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_dashboards_using_get1_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Dashboards by System Administrator (getTenantDashboards) # noqa: E501 + + Returns a page of dashboard info objects owned by tenant. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_dashboards_using_get1_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_dashboards_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_dashboards_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/dashboards{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_home_dashboard_info_using_get(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_home_dashboard_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_home_dashboard_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Returns the home dashboard info object that is configured as 'homeDashboardId' parameter in the 'additionalInfo' of the corresponding tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_home_dashboard_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: HomeDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_home_dashboard_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='HomeDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_dashboards_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Dashboards (getUserDashboards) # noqa: E501 + + Returns a page of Dashboard Info objects available for specified or current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str operation: Filter by allowed operations for the current user + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_dashboards_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_dashboards_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Dashboards (getUserDashboards) # noqa: E501 + + Returns a page of Dashboard Info objects available for specified or current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. The Dashboard Info object contains lightweight information about the dashboard (e.g. title, image, assigned customers) but does not contain the heavyweight configuration JSON. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool mobile: Exclude dashboards that are hidden for mobile + :param str text_search: The case insensitive 'substring' filter based on the dashboard title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str operation: Filter by allowed operations for the current user + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: PageDataDashboardInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'mobile', 'text_search', 'sort_property', 'sort_order', 'operation', 'user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_dashboards_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_dashboards_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_dashboards_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'mobile' in params: + query_params.append(('mobile', params['mobile'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'operation' in params: + query_params.append(('operation', params['operation'])) # noqa: E501 + if 'user_id' in params: + query_params.append(('userId', params['user_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards{?mobile,operation,page,pageSize,sortOrder,sortProperty,textSearch,userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDashboardInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def import_group_dashboards_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Import Dashboards (importGroupDashboards) # noqa: E501 + + Import the dashboards to specified group.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_group_dashboards_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[Dashboard] body: + :param bool overwrite: Overwrite dashboards with the same name + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.import_group_dashboards_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.import_group_dashboards_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def import_group_dashboards_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Import Dashboards (importGroupDashboards) # noqa: E501 + + Import the dashboards to specified group.The Dashboard object is a heavyweight object that contains information about the dashboard (e.g. title, image, assigned customers) and also configuration JSON (e.g. layouts, widgets, entity aliases). Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_group_dashboards_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[Dashboard] body: + :param bool overwrite: Overwrite dashboards with the same name + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body', 'overwrite'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method import_group_dashboards_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `import_group_dashboards_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'overwrite' in params: + query_params.append(('overwrite', params['overwrite'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/dashboards/import{?overwrite}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_dashboard_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Only users with 'TENANT_ADMIN') authority may create the dashboards.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_dashboard_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_dashboard_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Dashboard (saveDashboard) # noqa: E501 + + Create or update the Dashboard. When creating dashboard, platform generates Dashboard Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Dashboard id will be present in the response. Specify existing Dashboard id to update the dashboard. Referencing non-existing dashboard Id will cause 'Not Found' error. Only users with 'TENANT_ADMIN') authority may create the dashboards.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Dashboard entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_dashboard_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Dashboard body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Dashboard + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_dashboard_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/dashboard{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Dashboard', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_customer_home_dashboard_info_using_post(self, **kwargs): # noqa: E501 + """Update Customer Home Dashboard Info (setCustomerHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_customer_home_dashboard_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_customer_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.set_customer_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def set_customer_home_dashboard_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Customer Home Dashboard Info (setCustomerHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current customer. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_customer_home_dashboard_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_customer_home_dashboard_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/dashboard/home/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_tenant_home_dashboard_info_using_post(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.set_tenant_home_dashboard_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def set_tenant_home_dashboard_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Tenant Home Dashboard Info (getTenantHomeDashboardInfo) # noqa: E501 + + Update the home dashboard assignment for the current tenant. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_tenant_home_dashboard_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param HomeDashboardInfo body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_tenant_home_dashboard_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/dashboard/home/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/device_api_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/device_api_controller_api.py new file mode 100644 index 0000000..ddec496 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/device_api_controller_api.py @@ -0,0 +1,1212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceApiControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def claim_device_using_post(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def claim_device_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Save claiming information (claimDevice) # noqa: E501 + + Saves the information required for user to claim the device. See more info about claiming in the corresponding 'Claiming devices' platform documentation. Example of the request payload: ```json {\"secretKey\":\"value\", \"durationMs\":60000} ``` Note: both 'secretKey' and 'durationMs' is optional parameters. In case the secretKey is not specified, the empty string as a default value is used. In case the durationMs is not specified, the system parameter device.claim.duration is used. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `claim_device_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/claim', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_attributes_using_get(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + else: + (data) = self.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, **kwargs) # noqa: E501 + return data + + def get_device_attributes_using_get_with_http_info(self, device_token, client_keys, shared_keys, **kwargs): # noqa: E501 + """Get attributes (getDeviceAttributes) # noqa: E501 + + Returns all attributes that belong to device. Use optional 'clientKeys' and/or 'sharedKeys' parameter to return specific attributes. Example of the result: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_attributes_using_get_with_http_info(device_token, client_keys, shared_keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str client_keys: Comma separated key names for attribute with client scope (required) + :param str shared_keys: Comma separated key names for attribute with shared scope (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'client_keys', 'shared_keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'client_keys' is set + if ('client_keys' not in params or + params['client_keys'] is None): + raise ValueError("Missing the required parameter `client_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + # verify the required parameter 'shared_keys' is set + if ('shared_keys' not in params or + params['shared_keys'] is None): + raise ValueError("Missing the required parameter `shared_keys` when calling `get_device_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'client_keys' in params: + query_params.append(('clientKeys', params['client_keys'])) # noqa: E501 + if 'shared_keys' in params: + query_params.append(('sharedKeys', params['shared_keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes{?clientKeys,sharedKeys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_firmware_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_firmware_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_firmware_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Firmware (getFirmware) # noqa: E501 + + Downloads the current firmware package.When the platform initiates firmware update, it informs the device by updating the 'fw_title', 'fw_version', 'fw_checksum' and 'fw_checksum_algorithm' shared attributes.The 'fw_title' and 'fw_version' parameters must be supplied in this request to double-check that the firmware that device is downloading matches the firmware it expects to download. This is important, since the administrator may change the firmware assignment while device is downloading the firmware. Optional 'chunk' and 'size' parameters may be used to download the firmware in chunks. For example, device may request first 16 KB of firmware using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the firmware, corresponds to the value of 'fw_title' attribute. (required) + :param str version: Version of the firmware, corresponds to the value of 'fw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_firmware_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_firmware_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_firmware_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/firmware{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_software_using_get(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + else: + (data) = self.get_software_using_get_with_http_info(device_token, title, version, **kwargs) # noqa: E501 + return data + + def get_software_using_get_with_http_info(self, device_token, title, version, **kwargs): # noqa: E501 + """Get Device Software (getSoftware) # noqa: E501 + + Downloads the current software package.When the platform initiates software update, it informs the device by updating the 'sw_title', 'sw_version', 'sw_checksum' and 'sw_checksum_algorithm' shared attributes.The 'sw_title' and 'sw_version' parameters must be supplied in this request to double-check that the software that device is downloading matches the software it expects to download. This is important, since the administrator may change the software assignment while device is downloading the software. Optional 'chunk' and 'size' parameters may be used to download the software in chunks. For example, device may request first 16 KB of software using 'chunk'=0 and 'size'=16384. Next 16KB using 'chunk'=1 and 'size'=16384. The last chunk should have less bytes then requested using 'size' parameter. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_software_using_get_with_http_info(device_token, title, version, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str title: Title of the software, corresponds to the value of 'sw_title' attribute. (required) + :param str version: Version of the software, corresponds to the value of 'sw_version' attribute. (required) + :param int size: Size of the chunk. Optional. Omit to download the entire file without using chunks. + :param int chunk: Index of the chunk. Optional. Omit to download the entire file without using chunks. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'title', 'version', 'size', 'chunk'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_software_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'title' is set + if ('title' not in params or + params['title'] is None): + raise ValueError("Missing the required parameter `title` when calling `get_software_using_get`") # noqa: E501 + # verify the required parameter 'version' is set + if ('version' not in params or + params['version'] is None): + raise ValueError("Missing the required parameter `version` when calling `get_software_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'title' in params: + query_params.append(('title', params['title'])) # noqa: E501 + if 'version' in params: + query_params.append(('version', params['version'])) # noqa: E501 + if 'size' in params: + query_params.append(('size', params['size'])) # noqa: E501 + if 'chunk' in params: + query_params.append(('chunk', params['chunk'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/software{?chunk,size,title,version}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_device_attributes_using_post(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_device_attributes_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_device_attributes_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post attributes (postDeviceAttributes) # noqa: E501 + + Post client attribute updates on behalf of device. Example of the request: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_device_attributes_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_rpc_request_using_post(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_rpc_request_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_rpc_request_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Send the RPC command (postRpcRequest) # noqa: E501 + + Send the RPC request to server. The request payload is a JSON document that contains 'method' and 'params'. For example: ```json {\"method\": \"sumOnServer\", \"params\":{\"a\":2, \"b\":2}} ``` The response contains arbitrary JSON with the RPC reply. For example: ```json {\"result\": 4} ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_rpc_request_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_telemetry_using_post(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.post_telemetry_using_post_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def post_telemetry_using_post_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Post time-series data (postTelemetry) # noqa: E501 + + Post time-series data on behalf of device. Example of the request: The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [ {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}} ] ``` The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_telemetry_using_post_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method post_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `post_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/telemetry', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def provision_device_using_post(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.provision_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def provision_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Provision new device (provisionDevice) # noqa: E501 + + Exchange the provision request to the device credentials. See more info about provisioning in the corresponding 'Device provisioning' platform documentation.Requires valid JSON request with the following format: ```json { \"deviceName\": \"NEW_DEVICE_NAME\", \"provisionDeviceKey\": \"u7piawkboq8v32dmcmpp\", \"provisionDeviceSecret\": \"jpmwdn8ptlswmf4m29bw\" } ``` Where 'deviceName' is the name of enw or existing device which depends on the provisioning strategy. The 'provisionDeviceKey' and 'provisionDeviceSecret' matches info configured in one of the existing device profiles. The result of the successful call is the JSON object that contains new credentials: ```json { \"credentialsType\":\"ACCESS_TOKEN\", \"credentialsValue\":\"DEVICE_ACCESS_TOKEN\", \"status\":\"SUCCESS\" } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.provision_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method provision_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/provision', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def reply_to_command_using_post(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + else: + (data) = self.reply_to_command_using_post_with_http_info(device_token, request_id, **kwargs) # noqa: E501 + return data + + def reply_to_command_using_post_with_http_info(self, device_token, request_id, **kwargs): # noqa: E501 + """Reply to RPC commands (replyToCommand) # noqa: E501 + + Replies to server originated RPC command identified by 'requestId' parameter. The response is arbitrary JSON. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.reply_to_command_using_post_with_http_info(device_token, request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int request_id: RPC request id from the incoming RPC request (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'request_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method reply_to_command_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `reply_to_command_using_post`") # noqa: E501 + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `reply_to_command_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc/{requestId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_attributes_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_attributes_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_attributes_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to attribute updates (subscribeToAttributes) (Deprecated) # noqa: E501 + + Subscribes to client and shared scope attribute updates using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_attributes_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/attributes/updates{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def subscribe_to_commands_using_get(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + else: + (data) = self.subscribe_to_commands_using_get_with_http_info(device_token, **kwargs) # noqa: E501 + return data + + def subscribe_to_commands_using_get_with_http_info(self, device_token, **kwargs): # noqa: E501 + """Subscribe to RPC commands (subscribeToCommands) (Deprecated) # noqa: E501 + + Subscribes to RPC commands using http long polling. Deprecated, since long polling is resource and network consuming. Consider using MQTT or CoAP protocol for light-weight real-time updates. The API call is designed to be used by device firmware and requires device access token ('deviceToken'). It is not recommended to use this API call by third-party scripts, rule-engine or platform widgets (use 'Telemetry Controller' instead). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.subscribe_to_commands_using_get_with_http_info(device_token, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_token: Your device access token. (required) + :param int timeout: Optional timeout of the long poll. Typically less then 60 seconds, since limited on the server side. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_token', 'timeout'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method subscribe_to_commands_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_token' is set + if ('device_token' not in params or + params['device_token'] is None): + raise ValueError("Missing the required parameter `device_token` when calling `subscribe_to_commands_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_token' in params: + path_params['deviceToken'] = params['device_token'] # noqa: E501 + + query_params = [] + if 'timeout' in params: + query_params.append(('timeout', params['timeout'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/{deviceToken}/rpc{?timeout}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/device_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/device_controller_api.py new file mode 100644 index 0000000..4724478 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/device_controller_api.py @@ -0,0 +1,2464 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_device_to_tenant_using_post(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'ASSIGN_TO_TENANT' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, **kwargs) # noqa: E501 + return data + + def assign_device_to_tenant_using_post_with_http_info(self, tenant_id, device_id, **kwargs): # noqa: E501 + """Assign device to tenant (assignDeviceToTenant) # noqa: E501 + + Creates assignment of the device to tenant. Thereafter tenant will be able to reassign the device to a customer. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'ASSIGN_TO_TENANT' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_device_to_tenant_using_post_with_http_info(tenant_id, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_device_to_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `assign_device_to_tenant_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/device/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def claim_device_using_post1(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :param str sub_customer_id: subCustomerId + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.claim_device_using_post1_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def claim_device_using_post1_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Claim device (claimDevice) # noqa: E501 + + Claiming makes it possible to assign a device to the specific customer using device/server side claiming data (in the form of secret key).To make this happen you have to provide unique device name and optional claiming data (it is needed only for device-side claiming).Once device is claimed, the customer becomes its owner and customer users may access device data as well as control the device. In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. See official documentation for more details regarding claiming. Available for users with 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.claim_device_using_post1_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be claimed (required) + :param ClaimRequest body: + :param str sub_customer_id: subCustomerId + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name', 'body', 'sub_customer_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method claim_device_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `claim_device_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + if 'sub_customer_id' in params: + query_params.append(('subCustomerId', params['sub_customer_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim{?subCustomerId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_by_device_group_and_empty_ota_package_using_get(self, ota_package_type, ota_package_id, entity_group_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_group_and_empty_ota_package_using_get(ota_package_type, ota_package_id, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str ota_package_id: otaPackageId (required) + :param str entity_group_id: entityGroupId (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_by_device_group_and_empty_ota_package_using_get_with_http_info(ota_package_type, ota_package_id, entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.count_by_device_group_and_empty_ota_package_using_get_with_http_info(ota_package_type, ota_package_id, entity_group_id, **kwargs) # noqa: E501 + return data + + def count_by_device_group_and_empty_ota_package_using_get_with_http_info(self, ota_package_type, ota_package_id, entity_group_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_group_and_empty_ota_package_using_get_with_http_info(ota_package_type, ota_package_id, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str ota_package_id: otaPackageId (required) + :param str entity_group_id: entityGroupId (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_type', 'ota_package_id', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_by_device_group_and_empty_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_type' is set + if ('ota_package_type' not in params or + params['ota_package_type'] is None): + raise ValueError("Missing the required parameter `ota_package_type` when calling `count_by_device_group_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `count_by_device_group_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `count_by_device_group_and_empty_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_type' in params: + path_params['otaPackageType'] = params['ota_package_type'] # noqa: E501 + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices/count/{otaPackageType}/{otaPackageId}/{entityGroupId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_by_device_profile_and_empty_ota_package_using_get(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, **kwargs) # noqa: E501 + return data + + def count_by_device_profile_and_empty_ota_package_using_get_with_http_info(self, ota_package_type, device_profile_id, **kwargs): # noqa: E501 + """Count devices by device profile (countByDeviceProfileAndEmptyOtaPackage) # noqa: E501 + + The platform gives an ability to load OTA (over-the-air) packages to devices. It can be done in two different ways: device scope or device profile scope.In the response you will find the number of devices with specified device profile, but without previously defined device scope OTA package. It can be useful when you want to define number of devices that will be affected with future OTA package Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_by_device_profile_and_empty_ota_package_using_get_with_http_info(ota_package_type, device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_type: OTA package type (required) + :param str device_profile_id: Device Profile Id. I.g. '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_type', 'device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_by_device_profile_and_empty_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_type' is set + if ('ota_package_type' not in params or + params['ota_package_type'] is None): + raise ValueError("Missing the required parameter `ota_package_type` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `count_by_device_profile_and_empty_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_type' in params: + path_params['otaPackageType'] = params['ota_package_type'] # noqa: E501 + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices/count/{otaPackageType}/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_device_using_delete(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_using_delete_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def delete_device_using_delete_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Delete device (deleteDevice) # noqa: E501 + + Deletes the device, it's credentials and all the relations (from and to the device). Referencing non-existing device Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post1(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Find related devices (findByQuery) # noqa: E501 + + Returns all devices that are related to the specific entity. The entity id, relation type, device types, depth of the search, and other query parameters defined using complex 'DeviceSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceSearchQuery body: + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_device_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Device Infos for current user (getAllDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the tenant or the customer of a current user. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_device_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_device_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_device_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Device Infos for current user (getAllDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the tenant or the customer of a current user. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_device_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceInfos/all{?active,deviceProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_device_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the specified customer. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_device_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Device Infos (getCustomerDeviceInfos) # noqa: E501 + + Returns a page of device info objects owned by the specified customer. Device Info is an extension of the default Device object that contains information about the owner name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :param bool active: A boolean value representing the device active flag. + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'device_profile_id', 'active', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_device_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_device_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_device_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + if 'active' in params: + query_params.append(('active', params['active'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/deviceInfos{?active,deviceProfileId,includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_devices_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_devices_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Devices (getCustomerDevices) # noqa: E501 + + Returns a page of devices objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_devices_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceById) # noqa: E501 + + Fetch the Device object based on the provided Device Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_credentials_by_device_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_credentials_by_device_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_credentials_by_device_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device Credentials (getDeviceCredentialsByDeviceId) # noqa: E501 + + If during device creation there wasn't specified any credentials, platform generates random 'ACCESS_TOKEN' credentials. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_credentials_by_device_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_credentials_by_device_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_credentials_by_device_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/{deviceId}/credentials', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_info_by_id_using_get(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceInfoById) # noqa: E501 + + Fetch the Device info object based on the provided Device Id. Device Info is an extension of the default Device object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_info_by_id_using_get_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def get_device_info_by_id_using_get_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Get Device (getDeviceInfoById) # noqa: E501 + + Fetch the Device info object based on the provided Device Id. Device Info is an extension of the default Device object that contains information about the owner name. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_info_by_id_using_get_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_device_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/info/{deviceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_types_using_get(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_device_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_device_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Device Types (getDeviceTypes) # noqa: E501 + + Returns a set of unique device profile names based on devices that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_devices_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get devices by Entity Group Id (getDevicesByEntityGroupId) # noqa: E501 + + Returns a page of Device objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_devices_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_devices_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_devices_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get devices by Entity Group Id (getDevicesByEntityGroupId) # noqa: E501 + + Returns a page of Device objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_devices_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_devices_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_devices_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_devices_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/devices{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_devices_by_ids_using_get(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_devices_by_ids_using_get_with_http_info(device_ids, **kwargs) # noqa: E501 + return data + + def get_devices_by_ids_using_get_with_http_info(self, device_ids, **kwargs): # noqa: E501 + """Get Devices By Ids (getDevicesByIds) # noqa: E501 + + Requested devices must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_devices_by_ids_using_get_with_http_info(device_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_ids: A list of devices ids, separated by comma ',' (required) + :return: list[Device] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_devices_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_ids' is set + if ('device_ids' not in params or + params['device_ids'] is None): + raise ValueError("Missing the required parameter `device_ids` when calling `get_devices_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_ids' in params: + query_params.append(('deviceIds', params['device_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/devices{?deviceIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Device]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_device_using_get(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_device_using_get_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def get_tenant_device_using_get_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Get Tenant Device (getTenantDevice) # noqa: E501 + + Requested device must be owned by tenant that the user belongs to. Device name is an unique property of device. So it can be used to identify the device. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_device_using_get_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: A string value representing the Device name. (required) + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `get_tenant_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_name' in params: + query_params.append(('deviceName', params['device_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?deviceName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_devices_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_devices_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Devices (getTenantDevices) # noqa: E501 + + Returns a page of devices owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_devices_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_devices_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Devices (getUserDevices) # noqa: E501 + + Returns a page of devices that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_devices_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_devices_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_devices_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Devices (getUserDevices) # noqa: E501 + + Returns a page of devices that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_devices_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Device type as the name of the device profile + :param str text_search: The case insensitive 'substring' filter based on the device name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_devices_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_devices_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_devices_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/devices{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_devices_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_devices_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_devices_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of devices (processDevicesBulkImport) # noqa: E501 + + There's an ability to import the bulk of devices using the only .csv file. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_devices_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultDevice + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_devices_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultDevice', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def re_claim_device_using_delete(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + else: + (data) = self.re_claim_device_using_delete_with_http_info(device_name, **kwargs) # noqa: E501 + return data + + def re_claim_device_using_delete_with_http_info(self, device_name, **kwargs): # noqa: E501 + """Reclaim device (reClaimDevice) # noqa: E501 + + Reclaiming means the device will be unassigned from the customer and the device will be available for claiming again. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'CLAIM_DEVICES' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.re_claim_device_using_delete_with_http_info(device_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_name: Unique name of the device which is going to be reclaimed (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method re_claim_device_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_name' is set + if ('device_name' not in params or + params['device_name'] is None): + raise ValueError("Missing the required parameter `device_name` when calling `re_claim_device_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_name' in params: + path_params['deviceName'] = params['device_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/device/{deviceName}/claim', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device (saveDevice) # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Device credentials are also generated if not provided in the 'accessToken' request parameter. The newly created device id will be present in the response. Specify existing Device id to update the device. Referencing non-existing device Id will cause 'Not Found' error. Device name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the device names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Device body: + :param str access_token: Optional value of the device credentials to be used during device creation. If omitted, access token will be auto-generated. + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'access_token', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'access_token' in params: + query_params.append(('accessToken', params['access_token'])) # noqa: E501 + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device{?accessToken,entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_with_credentials_using_post(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :param str entity_group_id: entityGroupId + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_with_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_with_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Device (saveDevice) with credentials # noqa: E501 + + Create or update the Device. When creating device, platform generates Device Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Requires to provide the Device Credentials object as well. Useful to create device and credentials in one request. You may find the example of LwM2M device and RPK credentials below: ```json { \"device\": { \"name\": \"LwRpk00000000\", \"type\": \"lwm2mProfileRpk\" }, \"credentials\": { \"id\": \"null\", \"createdTime\": 0, \"deviceId\": \"null\", \"credentialsType\": \"LWM2M_CREDENTIALS\", \"credentialsId\": \"LwRpk00000000\", \"credentialsValue\": { \"client\": { \"endpoint\": \"LwRpk00000000\", \"securityConfigClientMode\": \"RPK\", \"key\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\" }, \"bootstrap\": { \"bootstrapServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" }, \"lwm2mServer\": { \"securityMode\": \"RPK\", \"clientPublicKeyOrId\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEUEBxNl/RcYJNm8mk91CyVXoIJiROYDlXcSSqK6e5bDHwOW4ZiN2lNnXalyF0Jxw8MbAytnDMERXyAja5VEMeVQ==\", \"clientSecretKey\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgd9GAx7yZW37autew5KZykn4IgRpge/tZSjnudnZJnMahRANCAARQQHE2X9Fxgk2byaT3ULJVeggmJE5gOVdxJKorp7lsMfA5bhmI3aU2ddqXIXQnHDwxsDK2cMwRFfICNrlUQx5V\" } } } } } ```Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Device entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_with_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveDeviceWithCredentialsRequest body: + :param str entity_group_id: entityGroupId + :return: Device + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_with_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device-with-credentials{?entityGroupId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Device', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_device_credentials_using_post(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.update_device_credentials_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def update_device_credentials_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update device credentials (updateDeviceCredentials) # noqa: E501 + + During device creation, platform generates random 'ACCESS_TOKEN' credentials. Use this method to update the device credentials. First use 'getDeviceCredentialsByDeviceId' to get the credentials id and value. Then use current method to update the credentials type and value. It is not possible to create multiple device credentials for the same device. The structure of device credentials id and value is simple for the 'ACCESS_TOKEN' but is much more complex for the 'MQTT_BASIC' or 'LWM2M_CREDENTIALS'. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE_CREDENTIALS' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_device_credentials_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceCredentials body: + :return: DeviceCredentials + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_device_credentials_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/device/credentials', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceCredentials', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/device_group_ota_package_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/device_group_ota_package_controller_api.py new file mode 100644 index 0000000..4da166b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/device_group_ota_package_controller_api.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceGroupOtaPackageControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_group_ota_package_using_delete(self, id, **kwargs): # noqa: E501 + """deleteDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_group_ota_package_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_group_ota_package_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_group_ota_package_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_device_group_ota_package_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """deleteDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_group_ota_package_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_group_ota_package_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_device_group_ota_package_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceGroupOtaPackage/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_firmware_by_id_using_get(self, group_id, firmware_type, **kwargs): # noqa: E501 + """getFirmwareById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_by_id_using_get(group_id, firmware_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: groupId (required) + :param str firmware_type: firmwareType (required) + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_firmware_by_id_using_get_with_http_info(group_id, firmware_type, **kwargs) # noqa: E501 + else: + (data) = self.get_firmware_by_id_using_get_with_http_info(group_id, firmware_type, **kwargs) # noqa: E501 + return data + + def get_firmware_by_id_using_get_with_http_info(self, group_id, firmware_type, **kwargs): # noqa: E501 + """getFirmwareById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_firmware_by_id_using_get_with_http_info(group_id, firmware_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: groupId (required) + :param str firmware_type: firmwareType (required) + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_id', 'firmware_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_firmware_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_id' is set + if ('group_id' not in params or + params['group_id'] is None): + raise ValueError("Missing the required parameter `group_id` when calling `get_firmware_by_id_using_get`") # noqa: E501 + # verify the required parameter 'firmware_type' is set + if ('firmware_type' not in params or + params['firmware_type'] is None): + raise ValueError("Missing the required parameter `firmware_type` when calling `get_firmware_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_id' in params: + path_params['groupId'] = params['group_id'] # noqa: E501 + if 'firmware_type' in params: + path_params['firmwareType'] = params['firmware_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceGroupOtaPackage/{groupId}/{firmwareType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceGroupOtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_group_ota_package_using_post(self, **kwargs): # noqa: E501 + """saveDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_group_ota_package_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceGroupOtaPackage body: + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_group_ota_package_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_group_ota_package_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_group_ota_package_using_post_with_http_info(self, **kwargs): # noqa: E501 + """saveDeviceGroupOtaPackage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_group_ota_package_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceGroupOtaPackage body: + :return: DeviceGroupOtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_group_ota_package_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceGroupOtaPackage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceGroupOtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/device_profile_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/device_profile_controller_api.py new file mode 100644 index 0000000..d70a614 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/device_profile_controller_api.py @@ -0,0 +1,1120 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class DeviceProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_profile_using_delete(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_profile_using_delete_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def delete_device_profile_using_delete_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Delete device profile (deleteDeviceProfile) # noqa: E501 + + Deletes the device profile. Referencing non-existing device profile Id will cause an error. Can't delete the device profile if it is referenced by existing devices. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_profile_using_delete_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `delete_device_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_keys_using_get(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_attributes_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_attributes_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get attribute keys (getAttributesKeys) # noqa: E501 + + Get a set of unique attribute keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/attributes{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_device_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_device_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_device_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Default Device Profile (getDefaultDeviceProfileInfo) # noqa: E501 + + Fetch the Default Device Profile Info object. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_device_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_device_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile (getDeviceProfileById) # noqa: E501 + + Fetch the Device Profile object based on the provided Device Profile Id. The server checks that the device profile is owned by the same tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_info_by_id_using_get(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def get_device_profile_info_by_id_using_get_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Get Device Profile Info (getDeviceProfileInfoById) # noqa: E501 + + Fetch the Device Profile Info object based on the provided Device Profile Id. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_info_by_id_using_get_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_device_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfo/{deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles for transport type (getDeviceProfileInfos) # noqa: E501 + + Returns a page of devices profile info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Device Profile Info is a lightweight object that includes main information about Device Profile excluding the heavyweight configuration object. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str transport_type: Type of the transport + :return: PageDataDeviceProfileInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'transport_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'transport_type' in params: + query_params.append(('transportType', params['transport_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch,transportType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfileInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profiles_by_ids_using_get(self, device_profile_ids, **kwargs): # noqa: E501 + """Get Device Profiles By Ids (getDeviceProfilesByIds) # noqa: E501 + + Requested device profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_by_ids_using_get(device_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_ids: A list of device profile ids, separated by comma ',' (required) + :return: list[DeviceProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profiles_by_ids_using_get_with_http_info(device_profile_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profiles_by_ids_using_get_with_http_info(device_profile_ids, **kwargs) # noqa: E501 + return data + + def get_device_profiles_by_ids_using_get_with_http_info(self, device_profile_ids, **kwargs): # noqa: E501 + """Get Device Profiles By Ids (getDeviceProfilesByIds) # noqa: E501 + + Requested device profiles must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_by_ids_using_get_with_http_info(device_profile_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_ids: A list of device profile ids, separated by comma ',' (required) + :return: list[DeviceProfileInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_ids' is set + if ('device_profile_ids' not in params or + params['device_profile_ids'] is None): + raise ValueError("Missing the required parameter `device_profile_ids` when calling `get_device_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_ids' in params: + query_params.append(('deviceProfileIds', params['device_profile_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfileInfos{?deviceProfileIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[DeviceProfileInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_device_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_device_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_device_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Device Profiles (getDeviceProfiles) # noqa: E501 + + Returns a page of devices profile objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_device_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the device profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataDeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_device_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_device_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_device_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataDeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Get a set of unique time-series keys used by devices that belong to specified profile. If profile is not set returns a list of unique keys among all profiles. The call is used for auto-complete in the UI forms. The implementation limits the number of devices that participate in search to 100 as a trade of between accurate results and time-consuming queries. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'device_profile_id' in params: + query_params.append(('deviceProfileId', params['device_profile_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/devices/keys/timeseries{?deviceProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_device_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_device_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Device Profile (saveDeviceProfile) # noqa: E501 + + Create or update the Device Profile. When creating device profile, platform generates device profile id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created device profile id will be present in the response. Specify existing device profile id to update the device profile. Referencing non-existing device profile Id will cause 'Not Found' error. Device profile name is unique in the scope of tenant. Only one 'default' device profile may exist in scope of tenant. # Device profile data definition Device profile data object contains alarm rules configuration, device provision strategy and transport type configuration for device connectivity. Let's review some examples. First one is the default device profile data configuration and second one - the custom one. ```json { \"alarms\":[ ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"DISABLED\", \"provisionDeviceSecret\":null }, \"transportConfiguration\":{ \"type\":\"DEFAULT\" } } ``` ```json { \"alarms\":[ { \"id\":\"2492b935-1226-59e9-8615-17d8978a4f93\", \"alarmType\":\"Temperature Alarm\", \"clearRule\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"LESS\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"propagate\":false, \"createRules\":{ \"MAJOR\":{ \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] }, \"condition\":{ \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"COMPLEX\", \"operation\":\"OR\", \"predicates\":[ { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"LESS_OR_EQUAL\" }, { \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":30.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" } ] }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"WARNING\":{ \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" }, \"condition\":{ \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":null } }, \"condition\":[ { \"key\":{ \"key\":\"tempConstant\", \"type\":\"CONSTANT\" }, \"value\":30, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":0.0, \"dynamicValue\":{ \"inherit\":false, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempThreshold\" } }, \"operation\":\"EQUAL\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null }, \"CRITICAL\":{ \"schedule\":null, \"condition\":{ \"spec\":{ \"type\":\"SIMPLE\" }, \"condition\":[ { \"key\":{ \"key\":\"temperature\", \"type\":\"TIME_SERIES\" }, \"value\":null, \"predicate\":{ \"type\":\"NUMERIC\", \"value\":{ \"userValue\":null, \"defaultValue\":50.0, \"dynamicValue\":null }, \"operation\":\"GREATER\" }, \"valueType\":\"NUMERIC\" } ] }, \"dashboardId\":null, \"alarmDetails\":null } }, \"propagateRelationTypes\":null } ], \"configuration\":{ \"type\":\"DEFAULT\" }, \"provisionConfiguration\":{ \"type\":\"ALLOW_CREATE_NEW_DEVICES\", \"provisionDeviceSecret\":\"vaxb9hzqdbz3oqukvomg\" }, \"transportConfiguration\":{ \"type\":\"MQTT\", \"deviceTelemetryTopic\":\"v1/devices/me/telemetry\", \"deviceAttributesTopic\":\"v1/devices/me/attributes\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"PROTOBUF\", \"deviceTelemetryProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage telemetry;\\n\\nmessage SensorDataReading {\\n\\n optional double temperature = 1;\\n optional double humidity = 2;\\n InnerObject innerObject = 3;\\n\\n message InnerObject {\\n optional string key1 = 1;\\n optional bool key2 = 2;\\n optional double key3 = 3;\\n optional int32 key4 = 4;\\n optional string key5 = 5;\\n }\\n}\", \"deviceAttributesProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage attributes;\\n\\nmessage SensorConfiguration {\\n optional string firmwareVersion = 1;\\n optional string serialNumber = 2;\\n}\", \"deviceRpcRequestProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcRequestMsg {\\n optional string method = 1;\\n optional int32 requestId = 2;\\n optional string params = 3;\\n}\", \"deviceRpcResponseProtoSchema\":\"syntax =\\\"proto3\\\";\\npackage rpc;\\n\\nmessage RpcResponseMsg {\\n optional string payload = 1;\\n}\" } } } ``` Let's review some specific objects examples related to the device profile configuration: # Alarm Schedule Alarm Schedule JSON object represents the time interval during which the alarm rule is active. Note, ```json \"schedule\": null ``` means alarm rule is active all the time. **'daysOfWeek'** field represents Monday as 1, Tuesday as 2 and so on. **'startsOn'** and **'endsOn'** fields represent hours in millis (e.g. 64800000 = 18:00 or 6pm). **'enabled'** flag specifies if item in a custom rule is active for specific day of the week: ## Specific Time Schedule ```json { \"schedule\":{ \"type\":\"SPECIFIC_TIME\", \"endsOn\":64800000, \"startsOn\":43200000, \"timezone\":\"Europe/Kiev\", \"daysOfWeek\":[ 1, 3, 5 ] } } ``` ## Custom Schedule ```json { \"schedule\":{ \"type\":\"CUSTOM\", \"items\":[ { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":1 }, { \"endsOn\":64800000, \"enabled\":true, \"startsOn\":43200000, \"dayOfWeek\":2 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":3 }, { \"endsOn\":57600000, \"enabled\":true, \"startsOn\":36000000, \"dayOfWeek\":4 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":5 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":6 }, { \"endsOn\":0, \"enabled\":false, \"startsOn\":0, \"dayOfWeek\":7 } ], \"timezone\":\"Europe/Kiev\" } } ``` # Alarm condition type (**'spec'**) Alarm condition type can be either simple, duration, or repeating. For example, 5 times in a row or during 5 minutes. Note, **'userValue'** field is not used and reserved for future usage, **'dynamicValue'** is used for condition appliance by using the value of the **'sourceAttribute'** or else **'defaultValue'** is used (if **'sourceAttribute'** is absent). **'sourceType'** of the **'sourceAttribute'** can be: * 'CURRENT_DEVICE'; * 'CURRENT_CUSTOMER'; * 'CURRENT_TENANT'. **'sourceAttribute'** can be inherited from the owner if **'inherit'** is set to true (for CURRENT_DEVICE and CURRENT_CUSTOMER). ## Repeating alarm condition ```json { \"spec\":{ \"type\":\"REPEATING\", \"predicate\":{ \"userValue\":null, \"defaultValue\":5, \"dynamicValue\":{ \"inherit\":true, \"sourceType\":\"CURRENT_DEVICE\", \"sourceAttribute\":\"tempAttr\" } } } } ``` ## Duration alarm condition ```json { \"spec\":{ \"type\":\"DURATION\", \"unit\":\"MINUTES\", \"predicate\":{ \"userValue\":null, \"defaultValue\":30, \"dynamicValue\":null } } } ``` **'unit'** can be: * 'SECONDS'; * 'MINUTES'; * 'HOURS'; * 'DAYS'. # Key Filters Key filter objects are created under the **'condition'** array. They allow you to define complex logical expressions over entity field, attribute, latest time-series value or constant. The filter is defined using 'key', 'valueType', 'value' (refers to the value of the 'CONSTANT' alarm filter key type) and 'predicate' objects. Let's review each object: ## Alarm Filter Key Filter Key defines either entity field, attribute, telemetry or constant. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'ATTRIBUTE' - used for attributes values; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'CONSTANT' - constant value specified. Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"userValue\": null, \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or device. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"userValue\": null, \"defaultValue\": 0, \"dynamicValue\": { \"inherit\": false, \"sourceType\": \"CURRENT_TENANT\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_DEVICE', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. The 'sourceAttribute' can be inherited from the owner of the specified 'sourceType' if 'inherit' is set to true. # Provision Configuration There are 3 types of device provision configuration for the device profile: * 'DISABLED'; * 'ALLOW_CREATE_NEW_DEVICES'; * 'CHECK_PRE_PROVISIONED_DEVICES'. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-provisioning/) for more details. # Transport Configuration 5 transport configuration types are available: * 'DEFAULT'; * 'MQTT'; * 'LWM2M'; * 'COAP'; * 'SNMP'. Default type supports basic MQTT, HTTP, CoAP and LwM2M transports. Please refer to the [docs](https://thingsboard.io/docs/user-guide/device-profiles/#transport-configuration) for more details about other types. See another example of COAP transport configuration below: ```json { \"type\":\"COAP\", \"clientSettings\":{ \"edrxCycle\":null, \"powerMode\":\"DRX\", \"psmActivityTimer\":null, \"pagingTransmissionWindow\":null }, \"coapDeviceTypeConfiguration\":{ \"coapDeviceType\":\"DEFAULT\", \"transportPayloadTypeConfiguration\":{ \"transportPayloadType\":\"JSON\" } } } ```Remove 'id', 'tenantId' from the request body example (below) to create new Device Profile entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DeviceProfile body: + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_device_profile_using_post(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_device_profile_using_post_with_http_info(device_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_device_profile_using_post_with_http_info(self, device_profile_id, **kwargs): # noqa: E501 + """Make Device Profile Default (setDefaultDeviceProfile) # noqa: E501 + + Marks device profile as default within a tenant scope. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_device_profile_using_post_with_http_info(device_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeviceProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_device_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `set_default_device_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/deviceProfile/{deviceProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeviceProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/edge_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/edge_controller_api.py new file mode 100644 index 0000000..5a76956 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/edge_controller_api.py @@ -0,0 +1,2432 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def activate_instance_using_post(self, license_secret, release_date, **kwargs): # noqa: E501 + """Activate edge instance (activateInstance) # noqa: E501 + + Activates edge license on license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_instance_using_post(license_secret, release_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str license_secret: licenseSecret (required) + :param str release_date: releaseDate (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_instance_using_post_with_http_info(license_secret, release_date, **kwargs) # noqa: E501 + else: + (data) = self.activate_instance_using_post_with_http_info(license_secret, release_date, **kwargs) # noqa: E501 + return data + + def activate_instance_using_post_with_http_info(self, license_secret, release_date, **kwargs): # noqa: E501 + """Activate edge instance (activateInstance) # noqa: E501 + + Activates edge license on license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_instance_using_post_with_http_info(license_secret, release_date, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str license_secret: licenseSecret (required) + :param str release_date: releaseDate (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['license_secret', 'release_date'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_instance_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'license_secret' is set + if ('license_secret' not in params or + params['license_secret'] is None): + raise ValueError("Missing the required parameter `license_secret` when calling `activate_instance_using_post`") # noqa: E501 + # verify the required parameter 'release_date' is set + if ('release_date' not in params or + params['release_date'] is None): + raise ValueError("Missing the required parameter `release_date` when calling `activate_instance_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'license_secret' in params: + query_params.append(('licenseSecret', params['license_secret'])) # noqa: E501 + if 'release_date' in params: + query_params.append(('releaseDate', params['release_date'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/license/activateInstance{?licenseSecret,releaseDate}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_instance_using_post(self, **kwargs): # noqa: E501 + """Check edge license (checkInstance) # noqa: E501 + + Checks license request from edge service by forwarding request to license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_instance_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_instance_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_instance_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_instance_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check edge license (checkInstance) # noqa: E501 + + Checks license request from edge service by forwarding request to license portal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_instance_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_instance_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/license/checkInstance', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_edge_using_delete(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_edge_using_delete_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def delete_edge_using_delete_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Delete edge (deleteEdge) # noqa: E501 + + Deletes the edge. Referencing non-existing edge Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_edge_using_delete_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `delete_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post2(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post2_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post2_with_http_info(self, **kwargs): # noqa: E501 + """Find related edges (findByQuery) # noqa: E501 + + Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post2_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EdgeSearchQuery body: + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post2" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_missing_to_related_rule_chains_using_get(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def find_missing_to_related_rule_chains_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Find missing rule chains (findMissingToRelatedRuleChains) # noqa: E501 + + Returns list of rule chains ids that are not assigned to particular edge, but these rule chains are present in the already assigned rule chains to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_missing_to_related_rule_chains_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_missing_to_related_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `find_missing_to_related_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/missingToRelatedRuleChains/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_edge_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Edge Infos for current user (getAllEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_edge_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_edge_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Edge Infos for current user (getAllEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edgeInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edge_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edge_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edge Infos (getCustomerEdgeInfos) # noqa: E501 + + Returns a page of edge info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edge_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edge_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edge_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edgeInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_edges_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_edges_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Edges (getCustomerEdges) # noqa: E501 + + Returns a page of edges objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_edges_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge (getEdgeById) # noqa: E501 + + Get the Edge object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_docker_install_instructions_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id.If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_docker_install_instructions_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Docker Install Instructions (getEdgeDockerInstallInstructions) # noqa: E501 + + Get a docker install instructions for provided edge id.If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_docker_install_instructions_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInstallInstructions + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_docker_install_instructions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_docker_install_instructions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/instructions/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInstallInstructions', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_info_by_id_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_info_by_id_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_edge_info_by_id_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get Edge Info (getEdgeInfoById) # noqa: E501 + + Get the Edge info object based on the provided Edge Id. If the user has the authority of 'Tenant Administrator', the server checks that the edge is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the edge is assigned to the same customer. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_info_by_id_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EdgeInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/info/{edgeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EdgeInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_types_using_get(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_edge_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_edge_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Edge Types (getEdgeTypes) # noqa: E501 + + Returns a set of unique edge types based on edges that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get edges by Entity Group Id (getEdgesByEntityGroupId) # noqa: E501 + + Returns a page of Edge objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edges_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get edges by Entity Group Id (getEdgesByEntityGroupId) # noqa: E501 + + Returns a page of Edge objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_edges_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edges_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edges_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/edges{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_by_ids_using_get(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_by_ids_using_get_with_http_info(edge_ids, **kwargs) # noqa: E501 + return data + + def get_edges_by_ids_using_get_with_http_info(self, edge_ids, **kwargs): # noqa: E501 + """Get Edges By Ids (getEdgesByIds) # noqa: E501 + + Requested edges must be owned by tenant or assigned to customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_by_ids_using_get_with_http_info(edge_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_ids: A list of edges ids, separated by comma ',' (required) + :return: list[Edge] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_ids' is set + if ('edge_ids' not in params or + params['edge_ids'] is None): + raise ValueError("Missing the required parameter `edge_ids` when calling `get_edges_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_ids' in params: + query_params.append(('edgeIds', params['edge_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?edgeIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Edge]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edge_using_get(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edge_using_get_with_http_info(edge_name, **kwargs) # noqa: E501 + return data + + def get_tenant_edge_using_get_with_http_info(self, edge_name, **kwargs): # noqa: E501 + """Get Tenant Edge (getTenantEdge) # noqa: E501 + + Requested edge must be owned by tenant or customer that the user belongs to. Edge name is an unique property of edge. So it can be used to identify the edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edge_using_get_with_http_info(edge_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_name: Unique name of the edge (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edge_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_name' is set + if ('edge_name' not in params or + params['edge_name'] is None): + raise ValueError("Missing the required parameter `edge_name` when calling `get_tenant_edge_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'edge_name' in params: + query_params.append(('edgeName', params['edge_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?edgeName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Edges (getTenantEdges) # noqa: E501 + + Returns a page of edges owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_edges_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Edges (getUserEdges) # noqa: E501 + + Returns a page of edges available for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_edges_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_edges_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_edges_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Edges (getUserEdges) # noqa: E501 + + Returns a page of edges available for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_edges_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: A string value representing the edge type. For example, 'default' + :param str text_search: The case insensitive 'substring' filter based on the edge name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_edges_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_edges_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_edges_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/edges{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_edges_support_enabled_using_get(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_edges_support_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_edges_support_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is edges support enabled (isEdgesSupportEnabled) # noqa: E501 + + Returns 'true' if edges support enabled on server, 'false' - otherwise. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_edges_support_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_edges_support_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edges/enabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_edges_bulk_import_using_post(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.process_edges_bulk_import_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def process_edges_bulk_import_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import the bulk of edges (processEdgesBulkImport) # noqa: E501 + + There's an ability to import the bulk of edges using the only .csv file. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_edges_bulk_import_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param BulkImportRequest body: + :return: BulkImportResultEdge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_edges_bulk_import_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/bulk_import', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='BulkImportResultEdge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_edge_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_edge_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_edge_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Edge (saveEdge) # noqa: E501 + + Create or update the Edge. When creating edge, platform generates Edge Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created edge id will be present in the response. Specify existing Edge id to update the edge. Referencing non-existing Edge Id will cause 'Not Found' error. Edge name is unique in the scope of tenant. Use unique identifiers like MAC or IMEI for the edge names and non-unique 'label' field for user-friendly visualization purposes.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Edge entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_edge_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Edge body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_root_rule_chain_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_root_rule_chain_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Set root rule chain for provided edge (setEdgeRootRuleChain) # noqa: E501 + + Change root rule chain of the edge to the new provided rule chain. This operation will send a notification to update root rule chain on remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_root_rule_chain_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Edge + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Edge', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def sync_edge_using_post(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.sync_edge_using_post_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def sync_edge_using_post_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Sync edge (syncEdge) # noqa: E501 + + Starts synchronization process between edge and cloud. All entities that are assigned to particular edge are going to be send to remote edge service. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sync_edge_using_post_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method sync_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `sync_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/sync/{edgeId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/edge_event_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/edge_event_controller_api.py new file mode 100644 index 0000000..02e58a8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/edge_event_controller_api.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EdgeEventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_edge_events_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_events_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Events (getEdgeEvents) # noqa: E501 + + Returns a page of edge events for the requested edge. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_events_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the edge event type name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Edge events with creation time before it won't be queried + :param int end_time: Timestamp. Edge events with creation time after it won't be queried + :return: PageDataEdgeEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/events{?endTime,page,pageSize,sortOrder,sortProperty,startTime,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEdgeEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/entities_version_control_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/entities_version_control_controller_api.py new file mode 100644 index 0000000..cd2e2ac --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/entities_version_control_controller_api.py @@ -0,0 +1,1335 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntitiesVersionControlControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def compare_entity_data_to_version_using_get(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + else: + (data) = self.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, **kwargs) # noqa: E501 + return data + + def compare_entity_data_to_version_using_get_with_http_info(self, entity_type, internal_entity_uuid, version_id, **kwargs): # noqa: E501 + """Compare entity data to version (compareEntityDataToVersion) # noqa: E501 + + Returns an object with current entity data and the one at a specific version. Entity data structure is the same as stored in a repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.compare_entity_data_to_version_using_get_with_http_info(entity_type, internal_entity_uuid, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str internal_entity_uuid: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultEntityDataDiff + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'internal_entity_uuid', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method compare_entity_data_to_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'internal_entity_uuid' is set + if ('internal_entity_uuid' not in params or + params['internal_entity_uuid'] is None): + raise ValueError("Missing the required parameter `internal_entity_uuid` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `compare_entity_data_to_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'internal_entity_uuid' in params: + path_params['internalEntityUuid'] = params['internal_entity_uuid'] # noqa: E501 + + query_params = [] + if 'version_id' in params: + query_params.append(('versionId', params['version_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/diff/{entityType}/{internalEntityUuid}{?versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataDiff', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_data_info_using_get(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes), `hasCredentials` (whether stored device data has credentials), `hasPermissions` (user group data contains group permission list) and `hasGroupEntities` (entity group data contains group entities). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :param str internal_entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, **kwargs) # noqa: E501 + return data + + def get_entity_data_info_using_get_with_http_info(self, version_id, entity_type, external_entity_uuid, **kwargs): # noqa: E501 + """Get entity data info (getEntityDataInfo) # noqa: E501 + + Retrieves short info about the remote entity by external id at a concrete version. Returned entity data info contains following properties: `hasRelations` (whether stored entity data contains relations), `hasAttributes` (contains attributes), `hasCredentials` (whether stored device data has credentials), `hasPermissions` (user group data contains group permission list) and `hasGroupEntities` (entity group data contains group entities). Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_data_info_using_get_with_http_info(version_id, entity_type, external_entity_uuid, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id (required) + :param str internal_entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' + :return: DeferredResultEntityDataInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id', 'entity_type', 'external_entity_uuid', 'internal_entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_data_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_entity_data_info_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `get_entity_data_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + if 'internal_entity_id' in params: + query_params.append(('internalEntityId', params['internal_entity_id'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/info/{versionId}/{entityType}/{externalEntityUuid}{?internalEntityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultEntityDataInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_create_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_create_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_create_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version create request status (getVersionCreateRequestStatus) # noqa: E501 + + Returns the status of previously made version create request. This status contains following properties: - `done` - whether request processing is finished; - `version` - created version info: timestamp, version id (commit hash), commit name and commit author; - `added` - count of items that were created in the remote repo; - `modified` - modified items count; - `removed` - removed items count; - `error` - error message, if an error occurred while handling the request. An example of successful status: ```json { \"done\": true, \"added\": 10, \"modified\": 2, \"removed\": 5, \"version\": { \"timestamp\": 1655198528000, \"id\":\"8a834dd389ed80e0759ba8ee338b3f1fd160a114\", \"name\": \"My devices v2.0\", \"author\": \"John Doe\" }, \"error\": null } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_create_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionCreationResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_create_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_create_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionCreationResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_version_load_request_status_using_get(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count; - `groupsCreated` - created entity groups count; - `groupsUpdated` - updated entity groups count; - `groupsDeleted` - removed entity groups count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5, \"groupsCreated\": 1, \"groupsUpdated\": 1, \"groupsDeleted\": 1 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8, \"groupsCreated\": 1, \"groupsUpdated\": 0, \"groupsDeleted\": 2 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + else: + (data) = self.get_version_load_request_status_using_get_with_http_info(request_id, **kwargs) # noqa: E501 + return data + + def get_version_load_request_status_using_get_with_http_info(self, request_id, **kwargs): # noqa: E501 + """Get version load request status (getVersionLoadRequestStatus) # noqa: E501 + + Returns the status of previously made version load request. The structure contains following parameters: - `done` - if the request was successfully processed; - `result` - a list of load results for each entity type: - `created` - created entities count; - `updated` - updated entities count; - `deleted` - removed entities count; - `groupsCreated` - created entity groups count; - `groupsUpdated` - updated entity groups count; - `groupsDeleted` - removed entity groups count. - `error` - if an error occurred during processing, error info: - `type` - error type; - `source` - an external id of remote entity; - `target` - if failed to find referenced entity by external id - this external id; - `message` - error message. An example of successfully processed request status: ```json { \"done\": true, \"result\": [ { \"entityType\": \"DEVICE\", \"created\": 10, \"updated\": 5, \"deleted\": 5, \"groupsCreated\": 1, \"groupsUpdated\": 1, \"groupsDeleted\": 1 }, { \"entityType\": \"ASSET\", \"created\": 4, \"updated\": 0, \"deleted\": 8, \"groupsCreated\": 1, \"groupsUpdated\": 0, \"groupsDeleted\": 2 } ] } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_version_load_request_status_using_get_with_http_info(request_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str request_id: A string value representing the version control request id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: VersionLoadResult + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['request_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_version_load_request_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'request_id' is set + if ('request_id' not in params or + params['request_id'] is None): + raise ValueError("Missing the required parameter `request_id` when calling `get_version_load_request_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'request_id' in params: + path_params['requestId'] = params['request_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{requestId}/status', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='VersionLoadResult', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_all_entities_at_version_using_get(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_all_entities_at_version_using_get_with_http_info(version_id, **kwargs) # noqa: E501 + return data + + def list_all_entities_at_version_using_get_with_http_info(self, version_id, **kwargs): # noqa: E501 + """List all entities at version (listAllEntitiesAtVersion) # noqa: E501 + + Returns a list of all remote entities available in a specific version. Response type is the same as for listAllEntitiesAtVersion API method. Returned entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_all_entities_at_version_using_get_with_http_info(version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_all_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_all_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_branches_using_get(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.list_branches_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def list_branches_using_get_with_http_info(self, **kwargs): # noqa: E501 + """List branches (listBranches) # noqa: E501 + + Lists branches available in the remote repository. Response example: ```json [ { \"name\": \"master\", \"default\": true }, { \"name\": \"dev\", \"default\": false }, { \"name\": \"dev-2\", \"default\": false } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_branches_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: DeferredResultListBranchInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_branches_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/branches', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListBranchInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entities_at_version_using_get(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + else: + (data) = self.list_entities_at_version_using_get_with_http_info(entity_type, version_id, **kwargs) # noqa: E501 + return data + + def list_entities_at_version_using_get_with_http_info(self, entity_type, version_id, **kwargs): # noqa: E501 + """List entities at version (listEntitiesAtVersion) # noqa: E501 + + Returns a list of remote entities of a specific entity type that are available at a concrete version. Each entity item in the result has `externalId` property. Entities order will be the same as in the repository. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entities_at_version_using_get_with_http_info(entity_type, version_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str version_id: Version id, for example fd82625bdd7d6131cf8027b44ee967012ecaf990. Represents commit hash. (required) + :return: DeferredResultListVersionedEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'version_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entities_at_version_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entities_at_version_using_get`") # noqa: E501 + # verify the required parameter 'version_id' is set + if ('version_id' not in params or + params['version_id'] is None): + raise ValueError("Missing the required parameter `version_id` when calling `list_entities_at_version_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'version_id' in params: + path_params['versionId'] = params['version_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity/{entityType}/{versionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultListVersionedEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_type_versions_using_get(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_type_versions_using_get_with_http_info(self, entity_type, branch, page_size, page, **kwargs): # noqa: E501 + """List entity type versions (listEntityTypeVersions) # noqa: E501 + + Returns list of versions of an entity type in a branch. This is a collected list of versions that were created for entities of this type in a remote branch. If specified branch does not exist - empty page data will be returned. The response structure is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_type_versions_using_get_with_http_info(entity_type, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_type_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_type_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_type_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_entity_versions_using_get(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str internal_entity_id: internalEntityId + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_entity_versions_using_get_with_http_info(self, entity_type, external_entity_uuid, branch, page_size, page, **kwargs): # noqa: E501 + """List entity versions (listEntityVersions) # noqa: E501 + + Returns list of versions for a specific entity in a concrete branch. You need to specify external id of an entity to list versions for. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. If specified branch does not exist - empty page data will be returned. Each version info item has timestamp, id, name and author. Version id can then be used to restore the version. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Response example: ```json { \"data\": [ { \"timestamp\": 1655198593000, \"id\": \"fd82625bdd7d6131cf8027b44ee967012ecaf990\", \"name\": \"Devices and assets - v2.0\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198528000, \"id\": \"682adcffa9c8a2f863af6f00c4850323acbd4219\", \"name\": \"Update my device\", \"author\": \"John Doe \" }, { \"timestamp\": 1655198280000, \"id\": \"d2a6087c2b30e18cc55e7cdda345a8d0dfb959a4\", \"name\": \"Devices and assets - v1.0\", \"author\": \"John Doe \" } ], \"totalPages\": 1, \"totalElements\": 3, \"hasNext\": false } ``` Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_entity_versions_using_get_with_http_info(entity_type, external_entity_uuid, branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str external_entity_uuid: A string value representing external entity id. This is `externalId` property of an entity, or otherwise if not set - simply id of this entity. (required) + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str internal_entity_id: internalEntityId + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'external_entity_uuid', 'branch', 'page_size', 'page', 'internal_entity_id', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_entity_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'external_entity_uuid' is set + if ('external_entity_uuid' not in params or + params['external_entity_uuid'] is None): + raise ValueError("Missing the required parameter `external_entity_uuid` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_entity_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_entity_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'external_entity_uuid' in params: + path_params['externalEntityUuid'] = params['external_entity_uuid'] # noqa: E501 + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'internal_entity_id' in params: + query_params.append(('internalEntityId', params['internal_entity_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version/{entityType}/{externalEntityUuid}?sortProperty=timestamp{&branch,internalEntityId,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_versions_using_get(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.list_versions_using_get_with_http_info(branch, page_size, page, **kwargs) # noqa: E501 + return data + + def list_versions_using_get_with_http_info(self, branch, page_size, page, **kwargs): # noqa: E501 + """List all versions (listVersions) # noqa: E501 + + Lists all available versions in a branch for all entity types. If specified branch does not exist - empty page data will be returned. The response format is the same as for `listEntityVersions` API method. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_versions_using_get_with_http_info(branch, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str branch: The name of the working branch, for example 'master' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity version name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultPageDataEntityVersion + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['branch', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_versions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'branch' is set + if ('branch' not in params or + params['branch'] is None): + raise ValueError("Missing the required parameter `branch` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `list_versions_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `list_versions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'branch' in params: + query_params.append(('branch', params['branch'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version?sortProperty=timestamp{&branch,page,pageSize,sortOrder,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultPageDataEntityVersion', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def load_entities_version_using_post(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`), internal entity id (`internalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation); - `loadPermissions` - when loading user group, to update group permission list; - `loadGroupEntities` - when loading an entity group, to load its entities as well; - `autoGenerateIntegrationKey` - if loading integration version, to autogenerate routing key. An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.load_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def load_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Load entities version (loadEntitiesVersion) # noqa: E501 + + Loads specific version of remote entities (or single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are multiple types of request. Each of them requires branch name (`branch`) and version id (`versionId`). Request of type `SINGLE_ENTITY` is needed to restore a concrete version of a specific entity. It contains id of a remote entity (`externalEntityId`), internal entity id (`internalEntityId`) and additional configuration (`config`): - `loadRelations` - to update relations list (in case `saveRelations` option was enabled during version creation); - `loadAttributes` - to load entity attributes (if `saveAttributes` config option was enabled); - `loadCredentials` - to update device credentials (if `saveCredentials` option was enabled during version creation); - `loadPermissions` - when loading user group, to update group permission list; - `loadGroupEntities` - when loading an entity group, to load its entities as well; - `autoGenerateIntegrationKey` - if loading integration version, to autogenerate routing key. An example of such request: ```json { \"type\": \"SINGLE_ENTITY\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"externalEntityId\": { \"entityType\": \"DEVICE\", \"id\": \"b7944123-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"loadRelations\": false, \"loadAttributes\": true, \"loadCredentials\": true } } ``` Another request type (`ENTITY_TYPE`) is needed to load specific version of the whole entity types. It contains a structure with entity types to load and configs for each entity type (`entityTypes`). For each specified entity type, the method will load all remote entities of this type that are present at the version. A config for each entity type contains the same options as in `SINGLE_ENTITY` request type, and additionally contains following options: - `removeOtherEntities` - to remove local entities that are not present on the remote - basically to overwrite local entity type with the remote one; - `findExistingEntityByName` - when you are loading some remote entities that are not yet present at this tenant, try to find existing entity by name and update it rather than create new. Here is an example of the request to completely restore version of the whole device entity type: ```json { \"type\": \"ENTITY_TYPE\", \"branch\": \"dev\", \"versionId\": \"b3c28d722d328324c7c15b0b30047b0c40011cf7\", \"entityTypes\": { \"DEVICE\": { \"removeOtherEntities\": true, \"findExistingEntityByName\": false, \"loadRelations\": true, \"loadAttributes\": true, \"loadCredentials\": true } } } ``` The response will contain generated request UUID that is to be used to check the status of operation via `getVersionLoadRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionLoadRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method load_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/entity', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entities_version_using_post(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version; - `savePermissions` - when saving a user group - to save group permission list; - `saveGroupEntities` - when saving an entity group - to save its entities as well. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify `entityIds` - in case entity type is group entity, list of specific entity groups, or if not - list of entities; - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entities_version_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entities_version_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save entities version (saveEntitiesVersion) # noqa: E501 + + Creates a new version of entities (or a single entity) by request. Supported entity types: CUSTOMER, ASSET, RULE_CHAIN, DASHBOARD, DEVICE_PROFILE, DEVICE, ENTITY_VIEW, WIDGETS_BUNDLE, CONVERTER, INTEGRATION, ROLE and USER group. There are two available types of request: `SINGLE_ENTITY` and `COMPLEX`. Each of them contains version name (`versionName`) and name of a branch (`branch`) to create version (commit) in. If specified branch does not exists in a remote repo, then new empty branch will be created. Request of the `SINGLE_ENTITY` type has id of an entity (`entityId`) and additional configuration (`config`) which has following options: - `saveRelations` - whether to add inbound and outbound relations of type COMMON to created entity version; - `saveAttributes` - to save attributes of server scope (and also shared scope for devices); - `saveCredentials` - when saving a version of a device, to add its credentials to the version; - `savePermissions` - when saving a user group - to save group permission list; - `saveGroupEntities` - when saving an entity group - to save its entities as well. An example of a `SINGLE_ENTITY` version create request: ```json { \"type\": \"SINGLE_ENTITY\", \"versionName\": \"Version 1.0\", \"branch\": \"dev\", \"entityId\": { \"entityType\": \"DEVICE\", \"id\": \"b79448e0-d4f4-11ec-847b-0f432358ab48\" }, \"config\": { \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": false } } ``` Second request type (`COMPLEX`), additionally to `branch` and `versionName`, contains following properties: - `entityTypes` - a structure with entity types to export and configuration for each entity type; this configuration has all the options available for `SINGLE_ENTITY` and additionally has these ones: - `allEntities` and `entityIds` - if you want to save the version of all entities of the entity type then set `allEntities` param to true, otherwise set it to false and specify `entityIds` - in case entity type is group entity, list of specific entity groups, or if not - list of entities; - `syncStrategy` - synchronization strategy to use for this entity type: when set to `OVERWRITE` then the list of remote entities of this type will be overwritten by newly added entities. If set to `MERGE` - existing remote entities of this entity type will not be removed, new entities will just be added on top (or existing remote entities will be updated). - `syncStrategy` - default synchronization strategy to use when it is not specified for an entity type. Example for this type of request: ```json { \"type\": \"COMPLEX\", \"versionName\": \"Devices and profiles: release 2\", \"branch\": \"master\", \"syncStrategy\": \"OVERWRITE\", \"entityTypes\": { \"DEVICE\": { \"syncStrategy\": null, \"allEntities\": true, \"saveRelations\": true, \"saveAttributes\": true, \"saveCredentials\": true }, \"DEVICE_PROFILE\": { \"syncStrategy\": \"MERGE\", \"allEntities\": false, \"entityIds\": [ \"b79448e0-d4f4-11ec-847b-0f432358ab48\" ], \"saveRelations\": true } } } ``` Response wil contain generated request UUID, that can be then used to retrieve status of operation via `getVersionCreateRequestStatus`. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entities_version_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param VersionCreateRequest body: + :return: DeferredResultuuid + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entities_version_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entities/vc/version', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultuuid', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/entity_group_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_group_controller_api.py new file mode 100644 index 0000000..f399795 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_group_controller_api.py @@ -0,0 +1,3936 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityGroupControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def add_entities_to_entity_group_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Add entities to the group (addEntitiesToEntityGroup) # noqa: E501 + + Add entities to the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'ADD_TO_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_entities_to_entity_group_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.add_entities_to_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.add_entities_to_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def add_entities_to_entity_group_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Add entities to the group (addEntitiesToEntityGroup) # noqa: E501 + + Add entities to the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'ADD_TO_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.add_entities_to_entity_group_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_entities_to_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `add_entities_to_entity_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/addEntities', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def assign_entity_group_to_edge_using_post(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Assign entity group to edge (assignEntityGroupToEdge) # noqa: E501 + + Creates assignment of an existing entity group to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity group will be delivered to edge service, edge will request entities of this group to be send to edge. Once entities will be delivered to edge service, they are going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_group_to_edge_using_post(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_entity_group_to_edge_using_post_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_entity_group_to_edge_using_post_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + return data + + def assign_entity_group_to_edge_using_post_with_http_info(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Assign entity group to edge (assignEntityGroupToEdge) # noqa: E501 + + Creates assignment of an existing entity group to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once entity group will be delivered to edge service, edge will request entities of this group to be send to edge. Once entities will be delivered to edge service, they are going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_entity_group_to_edge_using_post_with_http_info(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_entity_group_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_entity_group_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `assign_entity_group_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `assign_entity_group_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityGroup/{entityGroupId}/{groupType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroup', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_group_using_delete(self, entity_group_id, **kwargs): # noqa: E501 + """Delete Entity Group (deleteEntityGroup) # noqa: E501 + + Deletes the entity group but does not delete the entities in the group, since they are also present in reserved group 'All'. Referencing non-existing Entity Group Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_group_using_delete(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_group_using_delete_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_group_using_delete_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def delete_entity_group_using_delete_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Delete Entity Group (deleteEntityGroup) # noqa: E501 + + Deletes the entity group but does not delete the entities in the group, since they are also present in reserved group 'All'. Referencing non-existing Entity Group Id will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'DELETE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_group_using_delete_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_group_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `delete_entity_group_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_edge_entity_groups_using_get(self, edge_id, group_type, **kwargs): # noqa: E501 + """Get All Edge Entity Groups by entity type (getAllEdgeEntityGroups) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_entity_groups_using_get(edge_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_edge_entity_groups_using_get_with_http_info(edge_id, group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_all_edge_entity_groups_using_get_with_http_info(edge_id, group_type, **kwargs) # noqa: E501 + return data + + def get_all_edge_entity_groups_using_get_with_http_info(self, edge_id, group_type, **kwargs): # noqa: E501 + """Get All Edge Entity Groups by entity type (getAllEdgeEntityGroups) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_edge_entity_groups_using_get_with_http_info(edge_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_edge_entity_groups_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_all_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_all_edge_entity_groups_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/allEntityGroups/edge/{edgeId}/{groupType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_entity_groups_using_get(self, edge_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Edge Entity Groups by entity type (getEdgeEntityGroups) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_groups_using_get(edge_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_entity_groups_using_get_with_http_info(edge_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_entity_groups_using_get_with_http_info(edge_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_entity_groups_using_get_with_http_info(self, edge_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Edge Entity Groups by entity type (getEdgeEntityGroups) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and assigned to the provided Edge entity. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_entity_groups_using_get_with_http_info(edge_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_entity_groups_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_entity_groups_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/edge/{edgeId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entities_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get Group Entities (getEntities) # noqa: E501 + + Returns a page of Short Entity View objects that belongs to specified Entity Group Id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entities_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entities_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entities_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entities_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get Group Entities (getEntities) # noqa: E501 + + Returns a page of Short Entity View objects that belongs to specified Entity Group Id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entities_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entities_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entities_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entities_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entities_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/entities{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataShortEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_all_by_owner_and_type_using_get(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get special group All by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch reserved group 'All' based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_all_by_owner_and_type_using_get(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_all_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_all_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + return data + + def get_entity_group_all_by_owner_and_type_using_get_with_http_info(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get special group All by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch reserved group 'All' based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_all_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_all_by_owner_and_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_all_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_all_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_all_by_owner_and_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/all/{ownerType}/{ownerId}/{groupType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_by_id_using_get(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Info (getEntityGroupById) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_id_using_get(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def get_entity_group_by_id_using_get_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Info (getEntityGroupById) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_id_using_get_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_group_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_by_owner_and_name_and_type_using_get(self, owner_type, owner_id, group_type, group_name, **kwargs): # noqa: E501 + """Get Entity Group by owner, type and name (getEntityGroupByOwnerAndNameAndType) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_owner_and_name_and_type_using_get(owner_type, owner_id, group_type, group_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param str group_name: Entity Group name (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(owner_type, owner_id, group_type, group_name, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(owner_type, owner_id, group_type, group_name, **kwargs) # noqa: E501 + return data + + def get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(self, owner_type, owner_id, group_type, group_name, **kwargs): # noqa: E501 + """Get Entity Group by owner, type and name (getEntityGroupByOwnerAndNameAndType) # noqa: E501 + + Fetch the Entity Group object based on the provided Entity Group Id. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_by_owner_and_name_and_type_using_get_with_http_info(owner_type, owner_id, group_type, group_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param str group_name: Entity Group name (required) + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'group_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_by_owner_and_name_and_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_name' is set + if ('group_name' not in params or + params['group_name'] is None): + raise ValueError("Missing the required parameter `group_name` when calling `get_entity_group_by_owner_and_name_and_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + if 'group_name' in params: + path_params['groupName'] = params['group_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{ownerType}/{ownerId}/{groupType}/{groupName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_info_by_id_using_get(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Entity Info (getEntityGroupEntityInfoById) # noqa: E501 + + Fetch the Entity Group Entity Info object based on the provided Entity Group Id. Entity Info is a lightweight object that contains only id and name of the entity group. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_info_by_id_using_get(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_info_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_info_by_id_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_info_by_id_using_get_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Get Entity Group Entity Info (getEntityGroupEntityInfoById) # noqa: E501 + + Fetch the Entity Group Entity Info object based on the provided Entity Group Id. Entity Info is a lightweight object that contains only id and name of the entity group. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_info_by_id_using_get_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_group_entity_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfo/{entityGroupId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_by_ids_using_get(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by Ids (getEntityGroupEntityInfosByIds) # noqa: E501 + + Fetch the list of Entity Group Entity Info objects based on the provided entity group ids list. Entity Info is a lightweight object that contains only id and name of the entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_ids_using_get(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_by_ids_using_get_with_http_info(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by Ids (getEntityGroupEntityInfosByIds) # noqa: E501 + + Fetch the list of Entity Group Entity Info objects based on the provided entity group ids list. Entity Info is a lightweight object that contains only id and name of the entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_ids_using_get_with_http_info(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_ids' is set + if ('entity_group_ids' not in params or + params['entity_group_ids'] is None): + raise ValueError("Missing the required parameter `entity_group_ids` when calling `get_entity_group_entity_infos_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos{?entityGroupIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by owner and entity type and page link (getEntityGroupEntityInfosByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by owner and entity type and page link (getEntityGroupEntityInfosByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by entity type and page link (getEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos by entity type and page link (getEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'include_shared', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'include_shared' in params: + query_params.append(('includeShared', params['include_shared'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos/{groupType}{?includeShared,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos for all owners starting from specified than ending with owner of current user (getEntityGroupEntityInfosHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Group Entity Infos for all owners starting from specified than ending with owner of current user (getEntityGroupEntityInfosHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Entity Info objects based on the provided Owner Id and Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfosHierarchy/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_ids_using_get(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Groups by Ids (getEntityGroupsByIds) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided entity group ids list. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_ids_using_get(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_ids_using_get_with_http_info(entity_group_ids, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_ids_using_get_with_http_info(self, entity_group_ids, **kwargs): # noqa: E501 + """Get Entity Groups by Ids (getEntityGroupsByIds) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided entity group ids list. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_ids_using_get_with_http_info(entity_group_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_ids: A list of group ids, separated by comma ',' (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_ids' is set + if ('entity_group_ids' not in params or + params['entity_group_ids'] is None): + raise ValueError("Missing the required parameter `entity_group_ids` when calling `get_entity_groups_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups{?entityGroupIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type and page link (getEntityGroupsByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type and page link (getEntityGroupsByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_groups_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_owner_and_type_using_get(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_using_get(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_owner_and_type_using_get_with_http_info(self, owner_type, owner_id, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by owner and entity type (getEntityGroupsByOwnerAndType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Owner Id and Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_owner_and_type_using_get_with_http_info(owner_type, owner_id, group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_owner_and_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_groups_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_groups_by_owner_and_type_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_owner_and_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{ownerType}/{ownerId}/{groupType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by entity type and page link (getEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups by entity type and page link (getEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_shared: Whether to include shared entity groups. + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'include_shared', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'include_shared' in params: + query_params.append(('includeShared', params['include_shared'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}{?includeShared,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_by_type_using_get(self, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by entity type (getEntityGroupsByType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_using_get(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param bool include_shared: Whether to include shared entity groups. + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + return data + + def get_entity_groups_by_type_using_get_with_http_info(self, group_type, **kwargs): # noqa: E501 + """Get Entity Groups by entity type (getEntityGroupsByType) # noqa: E501 + + Fetch the list of Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_by_type_using_get_with_http_info(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param bool include_shared: Whether to include shared entity groups. + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'include_shared'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'include_shared' in params: + query_params.append(('includeShared', params['include_shared'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}{?includeShared}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_for_entity_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Entity Groups by Entity Id (getEntityGroupsForEntity) # noqa: E501 + + Returns a list of groups that contain the specified Entity Id. For example, all device groups that contain specific device. The list always contain at least one element - special group 'All'.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_for_entity_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: Entity Group type (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[EntityGroupId] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_for_entity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_for_entity_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_entity_groups_for_entity_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Entity Groups by Entity Id (getEntityGroupsForEntity) # noqa: E501 + + Returns a list of groups that contain the specified Entity Id. For example, all device groups that contain specific device. The list always contain at least one element - special group 'All'.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_for_entity_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: Entity Group type (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[EntityGroupId] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_for_entity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_entity_groups_for_entity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_entity_groups_for_entity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{entityType}/{entityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupId]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups for all owners starting from specified than ending with owner of current user (getEntityGroupsHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(self, owner_type, owner_id, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Entity Groups for all owners starting from specified than ending with owner of current user (getEntityGroupsHierarchyByOwnerAndTypeAndPageLink) # noqa: E501 + + Returns a page of Entity Group objects based on the provided Owner Id and Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get_with_http_info(owner_type, owner_id, group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id', 'group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupsHierarchy/{ownerType}/{ownerId}/{groupType}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_entity_using_get(self, entity_group_id, entity_id, **kwargs): # noqa: E501 + """Get Group Entity (getGroupEntity) # noqa: E501 + + Fetch the Short Entity View object based on the group and entity id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_entity_using_get(entity_group_id, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: ShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_entity_using_get_with_http_info(entity_group_id, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_group_entity_using_get_with_http_info(entity_group_id, entity_id, **kwargs) # noqa: E501 + return data + + def get_group_entity_using_get_with_http_info(self, entity_group_id, entity_id, **kwargs): # noqa: E501 + """Get Group Entity (getGroupEntity) # noqa: E501 + + Fetch the Short Entity View object based on the group and entity id. Short Entity View object contains the entity id and number of fields (attributes, telemetry, etc). List of those fields is configurable and defined in the group configuration. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_entity_using_get_with_http_info(entity_group_id, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: ShortEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_entity_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_group_entity_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_group_entity_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/{entityId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='ShortEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_owner_info_using_get(self, owner_type, owner_id, **kwargs): # noqa: E501 + """Get Owner Info (getOwnerInfo) # noqa: E501 + + Fetch the owner info (tenant or customer) presented as Entity Info object based on the provided owner Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_info_using_get(owner_type, owner_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_owner_info_using_get_with_http_info(owner_type, owner_id, **kwargs) # noqa: E501 + else: + (data) = self.get_owner_info_using_get_with_http_info(owner_type, owner_id, **kwargs) # noqa: E501 + return data + + def get_owner_info_using_get_with_http_info(self, owner_type, owner_id, **kwargs): # noqa: E501 + """Get Owner Info (getOwnerInfo) # noqa: E501 + + Fetch the owner info (tenant or customer) presented as Entity Info object based on the provided owner Id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_info_using_get_with_http_info(owner_type, owner_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_type: Tenant or Customer (required) + :param str owner_id: A string value representing the Tenant or Customer id (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_type', 'owner_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_owner_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_type' is set + if ('owner_type' not in params or + params['owner_type'] is None): + raise ValueError("Missing the required parameter `owner_type` when calling `get_owner_info_using_get`") # noqa: E501 + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `get_owner_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_type' in params: + path_params['ownerType'] = params['owner_type'] # noqa: E501 + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ownerInfo/{ownerType}/{ownerId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_owner_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Owner Infos (getOwnerInfos) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_owner_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_owner_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_owner_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Owner Infos (getOwnerInfos) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owner_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_owner_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_owner_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_owner_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ownerInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_owners_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Owners (getOwners) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owners_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataContactBasedobject + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_owners_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_owners_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_owners_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Owners (getOwners) # noqa: E501 + + Provides a rage view of Customers that the current user has READ access to. If the current user is Tenant administrator, the result set also contains the tenant. The call is designed for the UI auto-complete component to show tenant and all possible Customers that the user may select to change the owner of the particular entity or entity group. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_owners_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataContactBasedobject + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_owners_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_owners_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_owners_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/owners{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataContactBasedobject', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_shared_entity_group_entity_infos_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Group Entity Infos by entity type and page link (getSharedEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Group Entity Infos by entity type and page link (getSharedEntityGroupEntityInfosByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Entity Info objects based on the provided Entity Type and Page Link. Entity Info is a lightweight object that contains only id and name of the entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_entity_group_entity_infos_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_shared_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_shared_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_shared_entity_group_entity_infos_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroupInfos/{groupType}/shared{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_shared_entity_groups_by_type_and_page_link_using_get(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type and page link (getSharedEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_and_page_link_using_get(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(self, group_type, page_size, page, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type and page link (getSharedEntityGroupsByTypeAndPageLink) # noqa: E501 + + Returns a page of Shared Entity Group Info objects based on the provided Entity Type and Page Link. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_and_page_link_using_get_with_http_info(group_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the entity group name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_entity_groups_by_type_and_page_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_shared_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_shared_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_shared_entity_groups_by_type_and_page_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}/shared{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_shared_entity_groups_by_type_using_get(self, group_type, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type (getSharedEntityGroupsByType) # noqa: E501 + + Fetch the list of Shared Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_using_get(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_shared_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + else: + (data) = self.get_shared_entity_groups_by_type_using_get_with_http_info(group_type, **kwargs) # noqa: E501 + return data + + def get_shared_entity_groups_by_type_using_get_with_http_info(self, group_type, **kwargs): # noqa: E501 + """Get Shared Entity Groups by entity type (getSharedEntityGroupsByType) # noqa: E501 + + Fetch the list of Shared Entity Group Info objects based on the provided Entity Type. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously.Entity Group Info extends Entity Group object and adds 'ownerIds' - a list of owner ids. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_shared_entity_groups_by_type_using_get_with_http_info(group_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_type: Entity Group type (required) + :return: list[EntityGroupInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_shared_entity_groups_by_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `get_shared_entity_groups_by_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroups/{groupType}/shared', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityGroupInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def make_entity_group_private_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Private (makeEntityGroupPrivate) # noqa: E501 + + Make the entity group not available for non authorized users. Every group is private by default. This call is useful to hide the group that was previously made public. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_private_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.make_entity_group_private_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.make_entity_group_private_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def make_entity_group_private_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Private (makeEntityGroupPrivate) # noqa: E501 + + Make the entity group not available for non authorized users. Every group is private by default. This call is useful to hide the group that was previously made public. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_private_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method make_entity_group_private_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `make_entity_group_private_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/makePrivate', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def make_entity_group_public_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Publicly available (makeEntityGroupPublic) # noqa: E501 + + Make the entity group available for non authorized users. Useful for public dashboards that will be embedded into the public websites. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_public_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.make_entity_group_public_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.make_entity_group_public_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def make_entity_group_public_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Make Entity Group Publicly available (makeEntityGroupPublic) # noqa: E501 + + Make the entity group available for non authorized users. Useful for public dashboards that will be embedded into the public websites. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.make_entity_group_public_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method make_entity_group_public_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `make_entity_group_public_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/makePublic', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def remove_entities_from_entity_group_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Remove entities from the group (removeEntitiesFromEntityGroup) # noqa: E501 + + Removes entities from the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'REMOVE_FROM_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_entities_from_entity_group_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.remove_entities_from_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.remove_entities_from_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def remove_entities_from_entity_group_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Remove entities from the group (removeEntitiesFromEntityGroup) # noqa: E501 + + Removes entities from the specified entity group. Entity group allows you to group multiple entities of the same entity type (Device, Asset, Customer, User, Dashboard, etc). Entity Group always have an owner - particular Tenant or Customer. Each entity may belong to multiple groups simultaneously. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'REMOVE_FROM_GROUP' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.remove_entities_from_entity_group_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method remove_entities_from_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `remove_entities_from_entity_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/deleteEntities', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_group_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Entity Group (saveEntityGroup) # noqa: E501 + + Create or update the Entity Group. When creating Entity Group, platform generates Entity Group Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Entity Group Id will be present in the response. Specify existing Entity Group Id to update the group. Referencing non-existing Entity Group Id will cause 'Not Found' error.Remove 'id', 'tenantId' and optionally 'ownerId' from the request body example (below) to create new Entity Group entity. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_group_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityGroup body: + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_group_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entity_group_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entity_group_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Entity Group (saveEntityGroup) # noqa: E501 + + Create or update the Entity Group. When creating Entity Group, platform generates Entity Group Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Entity Group Id will be present in the response. Specify existing Entity Group Id to update the group. Referencing non-existing Entity Group Id will cause 'Not Found' error.Remove 'id', 'tenantId' and optionally 'ownerId' from the request body example (below) to create new Entity Group entity. Entity group name is unique in the scope of owner and entity type. For example, you can't create two tenant device groups called 'Water meters'. However, you may create device and asset group with the same name. And also you may create groups with the same name for two different customers of the same tenant. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_group_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityGroup body: + :return: EntityGroupInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroupInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def share_entity_group_to_child_owner_user_group_using_post(self, entity_group_id, user_group_id, role_id, **kwargs): # noqa: E501 + """Share the Entity Group with User group (shareEntityGroupToChildOwnerUserGroup) # noqa: E501 + + Share the entity group with specified user group using specified role. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_to_child_owner_user_group_using_post(entity_group_id, user_group_id, role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id that you would like to share. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str user_group_id: A string value representing the Entity(User) Group Id that you would like to share with. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str role_id: A string value representing the Role Id that describes set of permissions you would like to share (read, write, etc). For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.share_entity_group_to_child_owner_user_group_using_post_with_http_info(entity_group_id, user_group_id, role_id, **kwargs) # noqa: E501 + else: + (data) = self.share_entity_group_to_child_owner_user_group_using_post_with_http_info(entity_group_id, user_group_id, role_id, **kwargs) # noqa: E501 + return data + + def share_entity_group_to_child_owner_user_group_using_post_with_http_info(self, entity_group_id, user_group_id, role_id, **kwargs): # noqa: E501 + """Share the Entity Group with User group (shareEntityGroupToChildOwnerUserGroup) # noqa: E501 + + Share the entity group with specified user group using specified role. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_to_child_owner_user_group_using_post_with_http_info(entity_group_id, user_group_id, role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id that you would like to share. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str user_group_id: A string value representing the Entity(User) Group Id that you would like to share with. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str role_id: A string value representing the Role Id that describes set of permissions you would like to share (read, write, etc). For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'user_group_id', 'role_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method share_entity_group_to_child_owner_user_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `share_entity_group_to_child_owner_user_group_using_post`") # noqa: E501 + # verify the required parameter 'user_group_id' is set + if ('user_group_id' not in params or + params['user_group_id'] is None): + raise ValueError("Missing the required parameter `user_group_id` when calling `share_entity_group_to_child_owner_user_group_using_post`") # noqa: E501 + # verify the required parameter 'role_id' is set + if ('role_id' not in params or + params['role_id'] is None): + raise ValueError("Missing the required parameter `role_id` when calling `share_entity_group_to_child_owner_user_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + if 'user_group_id' in params: + path_params['userGroupId'] = params['user_group_id'] # noqa: E501 + if 'role_id' in params: + path_params['roleId'] = params['role_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/{userGroupId}/{roleId}/share', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def share_entity_group_using_post(self, entity_group_id, **kwargs): # noqa: E501 + """Share the Entity Group (shareEntityGroup) # noqa: E501 + + Share the entity group with certain user group based on the provided Share Group Request. The request is quite flexible and processing of the request involves multiple security checks using platform RBAC feature. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_using_post(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param ShareGroupRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.share_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.share_entity_group_using_post_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def share_entity_group_using_post_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Share the Entity Group (shareEntityGroup) # noqa: E501 + + Share the entity group with certain user group based on the provided Share Group Request. The request is quite flexible and processing of the request involves multiple security checks using platform RBAC feature. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.share_entity_group_using_post_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param ShareGroupRequest body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method share_entity_group_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `share_entity_group_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/share', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_entity_group_from_edge_using_delete(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Unassign entity group from edge (unassignEntityGroupFromEdge) # noqa: E501 + + Clears assignment of the entity group to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_group_from_edge_using_delete(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_entity_group_from_edge_using_delete_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_entity_group_from_edge_using_delete_with_http_info(edge_id, group_type, entity_group_id, **kwargs) # noqa: E501 + return data + + def unassign_entity_group_from_edge_using_delete_with_http_info(self, edge_id, group_type, entity_group_id, **kwargs): # noqa: E501 + """Unassign entity group from edge (unassignEntityGroupFromEdge) # noqa: E501 + + Clears assignment of the entity group to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_entity_group_from_edge_using_delete_with_http_info(edge_id, group_type, entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str group_type: EntityGroup type (required) + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityGroup + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'group_type', 'entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_entity_group_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_entity_group_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'group_type' is set + if ('group_type' not in params or + params['group_type'] is None): + raise ValueError("Missing the required parameter `group_type` when calling `unassign_entity_group_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `unassign_entity_group_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'group_type' in params: + path_params['groupType'] = params['group_type'] # noqa: E501 + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/entityGroup/{entityGroupId}/{groupType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityGroup', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/entity_query_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_query_controller_api.py new file mode 100644 index 0000000..52f62b2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_query_controller_api.py @@ -0,0 +1,538 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityQueryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def count_alarms_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_alarms_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_alarms_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Alarms by Query (countAlarmsByQuery) # noqa: E501 + + Returns the number of alarms that match the query definition. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_alarms_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_alarms_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def count_entities_by_query_using_post(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.count_entities_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def count_entities_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Count Entities by Query # noqa: E501 + + Allows to run complex queries to search the count of platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the number of entities that match the query definition. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the entity filter by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"ATTRIBUTE\", \"key\": \"active\" }, \"valueType\": \"BOOLEAN\", \"predicate\": { \"operation\": \"EQUAL\", \"value\": { \"defaultValue\": true, \"dynamicValue\": null }, \"type\": \"BOOLEAN\" } } ] } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.count_entities_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityCountQuery body: + :return: int + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method count_entities_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/count', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='int', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_alarm_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_alarm_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_alarm_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Alarms by Query # noqa: E501 + + This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'. The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the **'alarmFields'** and combine them with the other entity, attribute and latest time-series fields to return the result. See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"pageLink\": { \"page\": 0, \"pageSize\": 100, \"textSearch\": null, \"searchPropagatedAlarms\": false, \"statusList\": [ \"ACTIVE\" ], \"severityList\": [ \"CRITICAL\", \"MAJOR\" ], \"typeList\": [ \"Temperature Alarm\", \"Fire Alarm\" ], \"sortOrder\": { \"key\": { \"key\": \"createdTime\", \"type\": \"ALARM_FIELD\" }, \"direction\": \"DESC\" }, \"timeWindow\": 86400000 }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ], \"alarmFields\": [ { \"type\": \"ALARM_FIELD\", \"key\": \"createdTime\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"type\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"severity\" }, { \"type\": \"ALARM_FIELD\", \"key\": \"status\" } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ] } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_alarm_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param AlarmDataQuery body: + :return: PageDataAlarmData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_alarm_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/alarmsQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataAlarmData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_data_by_query_using_post(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_entity_data_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_entity_data_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find Entity Data by Query # noqa: E501 + + Allows to run complex queries over platform entities (devices, assets, customers, etc) based on the combination of main entity filter and multiple key filters. Returns the paginated result of the query that contains requested entity fields and latest values of requested attributes and time-series data. # Query Definition Main **entity filter** is mandatory and defines generic search criteria. For example, \"find all devices with profile 'Moisture Sensor'\" or \"Find all devices related to asset 'Building A'\" Optional **key filters** allow to filter results of the **entity filter** by complex criteria against main entity fields (name, label, type, etc), attributes and telemetry. For example, \"temperature > 20 or temperature< 10\" or \"name starts with 'T', and attribute 'model' is 'T1000', and timeseries field 'batteryLevel' > 40\". The **entity fields** and **latest values** contains list of entity fields and latest attribute/telemetry fields to fetch for each entity. The **page link** contains information about the page to fetch and the sort ordering. Let's review the example: ```json { \"entityFilter\": { \"type\": \"entityType\", \"resolveMultiple\": true, \"entityType\": \"DEVICE\" }, \"keyFilters\": [ { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\", \"inherit\": false } }, \"type\": \"NUMERIC\" } } ], \"entityFields\": [ { \"type\": \"ENTITY_FIELD\", \"key\": \"name\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"label\" }, { \"type\": \"ENTITY_FIELD\", \"key\": \"additionalInfo\" } ], \"latestValues\": [ { \"type\": \"ATTRIBUTE\", \"key\": \"model\" }, { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ], \"pageLink\": { \"page\": 0, \"pageSize\": 10, \"sortOrder\": { \"key\": { \"key\": \"name\", \"type\": \"ENTITY_FIELD\" }, \"direction\": \"ASC\" } } } ``` Example mentioned above search all devices which have attribute 'active' set to 'true'. Now let's review available entity filters and key filters syntax: # Entity Filters Entity Filter body depends on the 'type' parameter. Let's review available entity filter types. In fact, they do correspond to available dashboard aliases. ## Single Entity Allows to filter only one entity based on the id. For example, this entity filter selects certain device: ```json { \"type\": \"singleEntity\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Group Entities Filter Allows to filter multiple entities of the same type using the entity group type and id. For example, this entity filter selects all devices that belong to the group 'e52b0020-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"entityGroup\", \"groupType\": \"DEVICE\", \"entityGroup\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" } ``` ## Entity List Filter Allows to filter entities of the same type using their ids. For example, this entity filter selects two devices: ```json { \"type\": \"entityList\", \"entityType\": \"DEVICE\", \"entityList\": [ \"e6501f30-2a7a-11ec-94eb-213c95f54092\", \"e6657bf0-2a7a-11ec-94eb-213c95f54092\" ] } ``` ## Entity Name Filter Allows to filter entities of the same type using the **'starts with'** expression over entity name. For example, this entity filter selects all devices which name starts with 'Air Quality': ```json { \"type\": \"entityName\", \"entityType\": \"DEVICE\", \"entityNameFilter\": \"Air Quality\" } ``` ## Entity Type Filter Allows to filter entities based on their type (CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, etc)For example, this entity filter selects all tenant customers: ```json { \"type\": \"entityType\", \"entityType\": \"CUSTOMER\" } ``` ## Group List Filter Return multiple groups of the same type using specified ids. For example, this entity filter selects 2 device groups (if they are present in the system) with ids 'e52b0020-2a7a-11ec-94eb-213c95f54092' and 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entityGroupList\", \"groupType\": \"DEVICE\", \"entityGroupList\": [\"e52b0020-2a7a-11ec-94eb-213c95f54092\", \"e52b0020-2a7a-11ec-94eb-213c95f54093\"] } ``` ## Group Name Filter Allows to filter entity groups based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all devices which name starts with 'CAT': ```json { \"type\": \"entityGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"CAT\" } ``` ## Entities by Group Name Filter Allows to filter entities that belong to group based on the entity type and the group name. Optional parameter 'ownerId' allows you to specify the owner of the group (Tenant or Customer, current user owner by default).For example, this entity filter selects all devices which belong to group 'Water Meters': ```json { \"type\": \"entitiesByGroupName\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` Other example, this entity filter selects all devices which belong to group 'Water Meters' which in turn belongs to (sub-)Customer with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"entitiesByGroupName\", \"ownerId\": \"e52b0020-2a7a-11ec-94eb-213c95f54093\", \"groupType\": \"DEVICE\", \"entityGroupNameFilter\": \"Water Meters\" } ``` ## Entity owner Filter Allows to fetch owner (Tenant or Customer) of the specified entity. For example, this entity filter selects owner of the device with id 'e52b0020-2a7a-11ec-94eb-213c95f54093': ```json { \"type\": \"stateEntityOwner\", \"singleEntity\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"DEVICE\" } } ``` ## Asset Type Filter Allows to filter assets based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'charging station' assets which name starts with 'Tesla': ```json { \"type\": \"assetType\", \"assetType\": \"charging station\", \"assetNameFilter\": \"Tesla\" } ``` ## Device Type Filter Allows to filter devices based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Temperature Sensor' devices which name starts with 'ABC': ```json { \"type\": \"deviceType\", \"deviceType\": \"Temperature Sensor\", \"deviceNameFilter\": \"ABC\" } ``` ## Edge Type Filter Allows to filter edge instances based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Factory' edge instances which name starts with 'Nevada': ```json { \"type\": \"edgeType\", \"edgeType\": \"Factory\", \"edgeNameFilter\": \"Nevada\" } ``` ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` ## Api Usage Filter Allows to query for Api Usage based on optional customer id. If the customer id is not set, returns current tenant API usage.For example, this entity filter selects the 'Api Usage' entity for customer with id 'e6501f30-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"apiUsageState\", \"customerId\": { \"id\": \"d521edb0-2a7a-11ec-94eb-213c95f54092\", \"entityType\": \"CUSTOMER\" } } ``` ## Relations Query Filter Allows to filter entities that are related to the provided root entity. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'filter' object allows you to define the relation type and set of acceptable entity types to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only those who match the 'filters'. For example, this entity filter selects all devices and assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092': ```json { \"type\": \"relationsQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"filters\": [ { \"relationType\": \"Contains\", \"entityTypes\": [ \"DEVICE\", \"ASSET\" ] } ] } ``` ## Asset Search Query Allows to filter assets that are related to the provided root entity. Filters related assets based on the relation type and set of asset types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'assetTypes' defines the type of the asset to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only assets that match 'relationType' and 'assetTypes' conditions. For example, this entity filter selects 'charging station' assets which are related to the asset with id 'e51de0c0-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"assetSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e51de0c0-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"assetTypes\": [ \"charging station\" ] } ``` ## Device Search Query Allows to filter devices that are related to the provided root entity. Filters related devices based on the relation type and set of device types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Charging port' and 'Air Quality Sensor' devices which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"deviceTypes\": [ \"Air Quality Sensor\", \"Charging port\" ] } ``` ## Entity View Query Allows to filter entity views that are related to the provided root entity. Filters related entity views based on the relation type and set of entity view types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'entityViewTypes' defines the type of the entity view to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Concrete mixer' entity views which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"entityViewSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 1, \"fetchLastLevelOnly\": false, \"relationType\": \"Contains\", \"entityViewTypes\": [ \"Concrete mixer\" ] } ``` ## Edge Search Query Allows to filter edge instances that are related to the provided root entity. Filters related edge instances based on the relation type and set of edge types. Possible direction values are 'TO' and 'FROM'. The 'maxLevel' defines how many relation levels should the query search 'recursively'. Assuming the 'maxLevel' is > 1, the 'fetchLastLevelOnly' defines either to return all related entities or only entities that are on the last level of relations. The 'relationType' defines the type of the relation to search for. The 'deviceTypes' defines the type of the device to search for. The relation query calculates all related entities, even if they are filtered using different relation types, and then extracts only devices that match 'relationType' and 'deviceTypes' conditions. For example, this entity filter selects 'Factory' edge instances which are related to the asset with id 'e52b0020-2a7a-11ec-94eb-213c95f54092' using 'Contains' relation: ```json { \"type\": \"deviceSearchQuery\", \"rootEntity\": { \"entityType\": \"ASSET\", \"id\": \"e52b0020-2a7a-11ec-94eb-213c95f54092\" }, \"direction\": \"FROM\", \"maxLevel\": 2, \"fetchLastLevelOnly\": true, \"relationType\": \"Contains\", \"edgeTypes\": [ \"Factory\" ] } ``` # Key Filters Key Filter allows you to define complex logical expressions over entity field, attribute or latest time-series value. The filter is defined using 'key', 'valueType' and 'predicate' objects. Single Entity Query may have zero, one or multiple predicates. If multiple filters are defined, they are evaluated using logical 'AND'. The example below checks that temperature of the entity is above 20 degrees: ```json { \"key\": { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" }, \"valueType\": \"NUMERIC\", \"predicate\": { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } } ``` Now let's review 'key', 'valueType' and 'predicate' objects in detail. ## Filter Key Filter Key defines either entity field, attribute or telemetry. It is a JSON object that consists the key name and type. The following filter key types are supported: * 'CLIENT_ATTRIBUTE' - used for client attributes; * 'SHARED_ATTRIBUTE' - used for shared attributes; * 'SERVER_ATTRIBUTE' - used for server attributes; * 'ATTRIBUTE' - used for any of the above; * 'TIME_SERIES' - used for time-series values; * 'ENTITY_FIELD' - used for accessing entity fields like 'name', 'label', etc. The list of available fields depends on the entity type; * 'ALARM_FIELD' - similar to entity field, but is used in alarm queries only; Let's review the example: ```json { \"type\": \"TIME_SERIES\", \"key\": \"temperature\" } ``` ## Value Type and Operations Provides a hint about the data type of the entity field that is defined in the filter key. The value type impacts the list of possible operations that you may use in the corresponding predicate. For example, you may use 'STARTS_WITH' or 'END_WITH', but you can't use 'GREATER_OR_EQUAL' for string values.The following filter value types and corresponding predicate operations are supported: * 'STRING' - used to filter any 'String' or 'JSON' values. Operations: EQUAL, NOT_EQUAL, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS; * 'NUMERIC' - used for 'Long' and 'Double' values. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; * 'BOOLEAN' - used for boolean values. Operations: EQUAL, NOT_EQUAL; * 'DATE_TIME' - similar to numeric, transforms value to milliseconds since epoch. Operations: EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL; ## Filter Predicate Filter Predicate defines the logical expression to evaluate. The list of available operations depends on the filter value type, see above. Platform supports 4 predicate types: 'STRING', 'NUMERIC', 'BOOLEAN' and 'COMPLEX'. The last one allows to combine multiple operations over one filter key. Simple predicate example to check 'value < 100': ```json { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 100, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ``` Complex predicate example, to check 'value < 10 or value > 20': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 20, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ``` More complex predicate example, to check 'value < 10 or (value > 50 && value < 60)': ```json { \"type\": \"COMPLEX\", \"operation\": \"OR\", \"predicates\": [ { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 10, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"type\": \"COMPLEX\", \"operation\": \"AND\", \"predicates\": [ { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 50, \"dynamicValue\": null }, \"type\": \"NUMERIC\" }, { \"operation\": \"LESS\", \"value\": { \"defaultValue\": 60, \"dynamicValue\": null }, \"type\": \"NUMERIC\" } ] } ] } ``` You may also want to replace hardcoded values (for example, temperature > 20) with the more dynamic expression (for example, temperature > 'value of the tenant attribute with key 'temperatureThreshold'). It is possible to use 'dynamicValue' to define attribute of the tenant, customer or user that is performing the API call. See example below: ```json { \"operation\": \"GREATER\", \"value\": { \"defaultValue\": 0, \"dynamicValue\": { \"sourceType\": \"CURRENT_USER\", \"sourceAttribute\": \"temperatureThreshold\" } }, \"type\": \"NUMERIC\" } ``` Note that you may use 'CURRENT_USER', 'CURRENT_CUSTOMER' and 'CURRENT_TENANT' as a 'sourceType'. The 'defaultValue' is used when the attribute with such a name is not defined for the chosen source. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_data_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityDataQuery body: + :return: PageDataEntityData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_data_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_entity_timeseries_and_attributes_keys_by_query_using_post(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + else: + (data) = self.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, **kwargs) # noqa: E501 + return data + + def find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(self, timeseries, attributes, **kwargs): # noqa: E501 + """Find Entity Keys by Query # noqa: E501 + + Uses entity data query (see 'Find Entity Data by Query') to find first 100 entities. Then fetch and return all unique time-series and/or attribute keys. Used mostly for UI hints. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_entity_timeseries_and_attributes_keys_by_query_using_post_with_http_info(timeseries, attributes, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool timeseries: Include all unique time-series keys to the result. (required) + :param bool attributes: Include all unique attribute keys to the result. (required) + :param EntityDataQuery body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['timeseries', 'attributes', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_entity_timeseries_and_attributes_keys_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'timeseries' is set + if ('timeseries' not in params or + params['timeseries'] is None): + raise ValueError("Missing the required parameter `timeseries` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + # verify the required parameter 'attributes' is set + if ('attributes' not in params or + params['attributes'] is None): + raise ValueError("Missing the required parameter `attributes` when calling `find_entity_timeseries_and_attributes_keys_by_query_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'timeseries' in params: + query_params.append(('timeseries', params['timeseries'])) # noqa: E501 + if 'attributes' in params: + query_params.append(('attributes', params['attributes'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entitiesQuery/find/keys{?attributes,timeseries}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/entity_relation_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_relation_controller_api.py new file mode 100644 index 0000000..761a99e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_relation_controller_api.py @@ -0,0 +1,1355 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityRelationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_relation_using_delete(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def delete_relation_using_delete_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Delete Relation (deleteRelation) # noqa: E501 + + Deletes a relation between two entities in the platform. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relation_using_delete_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relation_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `delete_relation_using_delete`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `delete_relation_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_relations_using_delete(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_relations_using_delete_with_http_info(entity_id, entity_type, **kwargs) # noqa: E501 + return data + + def delete_relations_using_delete_with_http_info(self, entity_id, entity_type, **kwargs): # noqa: E501 + """Delete Relations (deleteRelations) # noqa: E501 + + Deletes all the relation (both 'from' and 'to' direction) for the specified entity. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_relations_using_delete_with_http_info(entity_id, entity_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_id', 'entity_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_relations_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_relations_using_delete`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_relations_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_id' in params: + query_params.append(('entityId', params['entity_id'])) # noqa: E501 + if 'entity_type' in params: + query_params.append(('entityType', params['entity_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?entityId,entityType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get_with_http_info(self, from_id, from_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get_with_http_info(from_id, from_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_from_using_get1(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_from_using_get1_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_by_from_using_get1_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relations (findByFrom) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_from_using_get1_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_from_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_by_from_using_get1`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_by_from_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post3(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post3_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post3_with_http_info(self, **kwargs): # noqa: E501 + """Find related entities (findByQuery) # noqa: E501 + + Returns all entities that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post3_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post3" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get_with_http_info(self, to_id, to_type, relation_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction and relation type. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get_with_http_info(to_id, to_type, relation_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `find_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_to_using_get1(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_by_to_using_get1_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_by_to_using_get1_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relations (findByTo) # noqa: E501 + + Returns list of relation objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_to_using_get1_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_to_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_by_to_using_get1`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_by_to_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_from_using_get(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_from_using_get_with_http_info(from_id, from_type, **kwargs) # noqa: E501 + return data + + def find_info_by_from_using_get_with_http_info(self, from_id, from_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByFrom) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'from' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_from_using_get_with_http_info(from_id, from_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_from_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `find_info_by_from_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `find_info_by_from_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?fromId,fromType,relationTypeGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_query_using_post(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_info_by_query_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def find_info_by_query_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity infos (findInfoByQuery) # noqa: E501 + + Returns all entity infos that are related to the specific entity. The entity id, relation type, entity types, depth of the search, and other query parameters defined using complex 'EntityRelationsQuery' object. See 'Model' tab of the Parameters for more info. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_query_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelationsQuery body: + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_query_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_info_by_to_using_get(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) # noqa: E501 + return data + + def find_info_by_to_using_get_with_http_info(self, to_id, to_type, **kwargs): # noqa: E501 + """Get List of Relation Infos (findInfoByTo) # noqa: E501 + + Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that the entity is owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the entity is assigned to the same customer. Relation Info is an extension of the default Relation object that contains information about the 'from' and 'to' entity names. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_info_by_to_using_get_with_http_info(to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: list[EntityRelationInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_info_by_to_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `find_info_by_to_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `find_info_by_to_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relations/info{?relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityRelationInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_relation_using_get(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + else: + (data) = self.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, **kwargs) # noqa: E501 + return data + + def get_relation_using_get_with_http_info(self, from_id, from_type, relation_type, to_id, to_type, **kwargs): # noqa: E501 + """Get Relation (getRelation) # noqa: E501 + + Returns relation object between two specified entities if present. Otherwise throws exception. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_relation_using_get_with_http_info(from_id, from_type, relation_type, to_id, to_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str from_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str from_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type: A string value representing relation type between entities. For example, 'Contains', 'Manages'. It can be any string value. (required) + :param str to_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str to_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str relation_type_group: A string value representing relation type group. For example, 'COMMON' + :return: EntityRelation + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['from_id', 'from_type', 'relation_type', 'to_id', 'to_type', 'relation_type_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_relation_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'from_id' is set + if ('from_id' not in params or + params['from_id'] is None): + raise ValueError("Missing the required parameter `from_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'from_type' is set + if ('from_type' not in params or + params['from_type'] is None): + raise ValueError("Missing the required parameter `from_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'relation_type' is set + if ('relation_type' not in params or + params['relation_type'] is None): + raise ValueError("Missing the required parameter `relation_type` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_id' is set + if ('to_id' not in params or + params['to_id'] is None): + raise ValueError("Missing the required parameter `to_id` when calling `get_relation_using_get`") # noqa: E501 + # verify the required parameter 'to_type' is set + if ('to_type' not in params or + params['to_type'] is None): + raise ValueError("Missing the required parameter `to_type` when calling `get_relation_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'from_id' in params: + query_params.append(('fromId', params['from_id'])) # noqa: E501 + if 'from_type' in params: + query_params.append(('fromType', params['from_type'])) # noqa: E501 + if 'relation_type' in params: + query_params.append(('relationType', params['relation_type'])) # noqa: E501 + if 'relation_type_group' in params: + query_params.append(('relationTypeGroup', params['relation_type_group'])) # noqa: E501 + if 'to_id' in params: + query_params.append(('toId', params['to_id'])) # noqa: E501 + if 'to_type' in params: + query_params.append(('toType', params['to_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation{?fromId,fromType,relationType,relationTypeGroup,toId,toType}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityRelation', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_relation_using_post(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_relation_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_relation_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Relation (saveRelation) # noqa: E501 + + Creates or updates a relation between two entities in the platform. Relations unique key is a combination of from/to entity id and relation type group and relation type. If the user has the authority of 'System Administrator', the server checks that 'from' and 'to' entities are owned by the sysadmin. If the user has the authority of 'Tenant Administrator', the server checks that 'from' and 'to' entities are owned by the same tenant. If the user has the authority of 'Customer User', the server checks that the 'from' and 'to' entities are assigned to the same customer. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_relation_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityRelation body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_relation_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/relation', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/entity_view_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_view_controller_api.py new file mode 100644 index 0000000..3a516b9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/entity_view_controller_api.py @@ -0,0 +1,1549 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EntityViewControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_entity_view_using_delete(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_view_using_delete_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def delete_entity_view_using_delete_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Delete entity view (deleteEntityView) # noqa: E501 + + Delete the EntityView object based on the provided entity view id. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_view_using_delete_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_view_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `delete_entity_view_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_by_query_using_post4(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.find_by_query_using_post4_with_http_info(**kwargs) # noqa: E501 + return data + + def find_by_query_using_post4_with_http_info(self, **kwargs): # noqa: E501 + """Find related entity views (findByQuery) # noqa: E501 + + Returns all entity views that are related to the specific entity. The entity id, relation type, entity view types, depth of the search, and other query parameters defined using complex 'EntityViewSearchQuery' object. See 'Model' tab of the Parameters for more info. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_by_query_using_post4_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityViewSearchQuery body: + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_by_query_using_post4" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViews', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityView]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_entity_view_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All Entity View Infos for current user (getAllEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the tenant or the customer of a current user. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_entity_view_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_entity_view_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_entity_view_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All Entity View Infos for current user (getAllEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the tenant or the customer of a current user. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_entity_view_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViewInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_view_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View Infos (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the specified customer. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_view_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity View Infos (getCustomerEntityViewInfos) # noqa: E501 + + Returns a page of entity view info objects owned by the specified customer. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_view_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_view_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_view_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViewInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_entity_views_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_entity_views_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Entity Views (getCustomerEntityViews) # noqa: E501 + + Returns a page of Entity View objects assigned to customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_entity_views_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view (getEntityViewById) # noqa: E501 + + Fetch the EntityView object based on the provided entity view id. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_info_by_id_using_get(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided entity view id. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, **kwargs) # noqa: E501 + return data + + def get_entity_view_info_by_id_using_get_with_http_info(self, entity_view_id, **kwargs): # noqa: E501 + """Get entity view info (getEntityViewInfoById) # noqa: E501 + + Fetch the Entity View info object based on the provided entity view id. Entity Views Info extends the Entity View with owner name. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_info_by_id_using_get_with_http_info(entity_view_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_id: A string value representing the entity view id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityViewInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_id' is set + if ('entity_view_id' not in params or + params['entity_view_id'] is None): + raise ValueError("Missing the required parameter `entity_view_id` when calling `get_entity_view_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_view_id' in params: + path_params['entityViewId'] = params['entity_view_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/info/{entityViewId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityViewInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_view_types_using_get(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_entity_view_types_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_entity_view_types_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Entity View Types (getEntityViewTypes) # noqa: E501 + + Returns a set of unique entity view types based on entity views that are either owned by the tenant or assigned to the customer which user is performing the request. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_view_types_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[EntitySubtype] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_view_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView/types', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntitySubtype]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_views_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get entity views by Entity Group Id (getEntityViewsByEntityGroupId) # noqa: E501 + + Returns a page of Entity View objects that belongs to specified Entity View Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_views_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_views_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_entity_views_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get entity views by Entity Group Id (getEntityViewsByEntityGroupId) # noqa: E501 + + Returns a page of Entity View objects that belongs to specified Entity View Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_views_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_views_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_entity_views_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_entity_views_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_views_by_ids_using_get(self, entity_view_ids, **kwargs): # noqa: E501 + """Get Entity Views By Ids (getEntityViewsByIds) # noqa: E501 + + Requested entity views must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_ids_using_get(entity_view_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_ids: A list of entity view ids, separated by comma ',' (required) + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_views_by_ids_using_get_with_http_info(entity_view_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_views_by_ids_using_get_with_http_info(entity_view_ids, **kwargs) # noqa: E501 + return data + + def get_entity_views_by_ids_using_get_with_http_info(self, entity_view_ids, **kwargs): # noqa: E501 + """Get Entity Views By Ids (getEntityViewsByIds) # noqa: E501 + + Requested entity views must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_views_by_ids_using_get_with_http_info(entity_view_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_ids: A list of entity view ids, separated by comma ',' (required) + :return: list[EntityView] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_views_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_ids' is set + if ('entity_view_ids' not in params or + params['entity_view_ids'] is None): + raise ValueError("Missing the required parameter `entity_view_ids` when calling `get_entity_views_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_view_ids' in params: + query_params.append(('entityViewIds', params['entity_view_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityViews{?entityViewIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[EntityView]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_view_using_get(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_view_using_get_with_http_info(entity_view_name, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_view_using_get_with_http_info(self, entity_view_name, **kwargs): # noqa: E501 + """Get Entity View by name (getTenantEntityView) # noqa: E501 + + Fetch the Entity View object based on the tenant id and entity view name. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_view_using_get_with_http_info(entity_view_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_view_name: Entity View name (required) + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_view_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_view_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_view_name' is set + if ('entity_view_name' not in params or + params['entity_view_name'] is None): + raise ValueError("Missing the required parameter `entity_view_name` when calling `get_tenant_entity_view_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_view_name' in params: + query_params.append(('entityViewName', params['entity_view_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?entityViewName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_entity_views_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_entity_views_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Entity Views (getTenantEntityViews) # noqa: E501 + + Returns a page of entity views owned by tenant. Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_entity_views_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_entity_views_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Entity Views (getUserEntityViews) # noqa: E501 + + Returns a page of entity views that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_entity_views_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_entity_views_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_entity_views_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Entity Views (getUserEntityViews) # noqa: E501 + + Returns a page of entity views that are available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_entity_views_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: ## Entity View Filter Allows to filter entity views based on their type and the **'starts with'** expression over their name. For example, this entity filter selects all 'Concrete Mixer' entity views which name starts with 'CAT': ```json { \"type\": \"entityViewType\", \"entityViewType\": \"Concrete Mixer\", \"entityViewNameFilter\": \"CAT\" } ``` + :param str text_search: The case insensitive 'substring' filter based on the entity view name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_entity_views_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_entity_views_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_entity_views_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/entityViews{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_view_using_post(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_entity_view_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_entity_view_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save or update entity view (saveEntityView) # noqa: E501 + + Entity Views limit the degree of exposure of the Device or Asset telemetry and attributes to the Customers. Every Entity View references exactly one entity (device or asset) and defines telemetry and attribute keys that will be visible to the assigned Customer. As a Tenant Administrator you are able to create multiple EVs per Device or Asset and assign them to different Customers. See the 'Model' tab for more details.Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Entity View entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_view_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param EntityView body: + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: EntityView + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_view_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityView{?entityGroupId,entityGroupIds}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityView', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/event_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/event_controller_api.py new file mode 100644 index 0000000..3ca1aa8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/event_controller_api.py @@ -0,0 +1,623 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class EventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def clear_events_using_post(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.clear_events_using_post_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def clear_events_using_post_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Clear Events (clearEvents) # noqa: E501 + + Clears events by filter for specified entity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.clear_events_using_post_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'body', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method clear_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `clear_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `clear_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/clear{?endTime,startTime}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get_with_http_info(self, entity_type, entity_id, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events (Deprecated) # noqa: E501 + + Returns a page of events for specified entity. Deprecated and will be removed in next minor release. The call was deprecated to improve the performance of the system. Current implementation will return 'Lifecycle' events only. Use 'Get events by type' or 'Get events by filter' instead. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get_with_http_info(entity_type, entity_id, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_get1(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_events_using_get1_with_http_info(self, entity_type, entity_id, event_type, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Events by type (getEvents) # noqa: E501 + + Returns a page of events for specified entity by specifying event type. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_get1_with_http_info(entity_type, entity_id, event_type, tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str event_type: A string value representing event type (required) + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'event_type', 'tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'event_type' is set + if ('event_type' not in params or + params['event_type'] is None): + raise ValueError("Missing the required parameter `event_type` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'event_type' in params: + path_params['eventType'] = params['event_type'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}/{eventType}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_events_using_post(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_events_using_post_with_http_info(self, tenant_id, page_size, page, entity_type, entity_id, **kwargs): # noqa: E501 + """Get Events by event filter (getEvents) # noqa: E501 + + Returns a page of events for the chosen entity by specifying the event filter. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. # Event Filter Definition 5 different eventFilter objects could be set for different event types. The eventType field is required. Others are optional. If some of them are set, the filtering will be applied according to them. See the examples below for all the fields used for each event type filtering. Note, * 'server' - string value representing the server name, identifier or ip address where the platform is running; * 'errorStr' - the case insensitive 'contains' filter based on error message. ## Error Event Filter ```json { \"eventType\":\"ERROR\", \"server\":\"ip-172-31-24-152\", \"method\":\"onClusterEventMsg\", \"errorStr\":\"Error Message\" } ``` * 'method' - string value representing the method name when the error happened. ## Lifecycle Event Filter ```json { \"eventType\":\"LC_EVENT\", \"server\":\"ip-172-31-24-152\", \"event\":\"STARTED\", \"status\":\"Success\", \"errorStr\":\"Error Message\" } ``` * 'event' - string value representing the lifecycle event type; * 'status' - string value representing status of the lifecycle event. ## Statistics Event Filter ```json { \"eventType\":\"STATS\", \"server\":\"ip-172-31-24-152\", \"messagesProcessed\":10, \"errorsOccurred\":5 } ``` * 'messagesProcessed' - the minimum number of successfully processed messages; * 'errorsOccurred' - the minimum number of errors occurred during messages processing. ## Debug Rule Node Event Filter ```json { \"eventType\":\"DEBUG_RULE_NODE\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` ## Debug Rule Chain Event Filter ```json { \"eventType\":\"DEBUG_RULE_CHAIN\", \"msgDirectionType\":\"IN\", \"server\":\"ip-172-31-24-152\", \"dataSearch\":\"humidity\", \"metadataSearch\":\"deviceName\", \"entityName\":\"DEVICE\", \"relationType\":\"Success\", \"entityId\":\"de9d54a0-2b7a-11ec-a3cc-23386423d98f\", \"msgType\":\"POST_TELEMETRY_REQUEST\", \"isError\":\"false\", \"errorStr\":\"Error Message\" } ``` * 'msgDirectionType' - string value representing msg direction type (incoming to entity or outcoming from entity); * 'dataSearch' - the case insensitive 'contains' filter based on data (key and value) for the message; * 'metadataSearch' - the case insensitive 'contains' filter based on metadata (key and value) for the message; * 'entityName' - string value representing the entity type; * 'relationType' - string value representing the type of message routing; * 'entityId' - string value representing the entity id in the event body (originator of the message); * 'msgType' - string value representing the message type; * 'isError' - boolean value to filter the errors. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_events_using_post_with_http_info(tenant_id, page_size, page, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param EventFilter body: + :param str text_search: The value is not used in searching. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param int start_time: Timestamp. Events with creation time before it won't be queried. + :param int end_time: Timestamp. Events with creation time after it won't be queried. + :return: PageDataEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'entity_type', 'entity_id', 'body', 'text_search', 'sort_property', 'sort_order', 'start_time', 'end_time'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_events_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_events_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_events_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'tenant_id' in params: + query_params.append(('tenantId', params['tenant_id'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'start_time' in params: + query_params.append(('startTime', params['start_time'])) # noqa: E501 + if 'end_time' in params: + query_params.append(('endTime', params['end_time'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/events/{entityType}/{entityId}{?endTime,page,pageSize,sortOrder,sortProperty,startTime,tenantId,textSearch}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/group_permission_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/group_permission_controller_api.py new file mode 100644 index 0000000..1f1c1e9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/group_permission_controller_api.py @@ -0,0 +1,720 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class GroupPermissionControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_group_permission_using_delete(self, group_permission_id, **kwargs): # noqa: E501 + """Delete group permission (deleteGroupPermission) # noqa: E501 + + Deletes the group permission. Referencing non-existing group permission Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_group_permission_using_delete(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_group_permission_using_delete_with_http_info(group_permission_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_group_permission_using_delete_with_http_info(group_permission_id, **kwargs) # noqa: E501 + return data + + def delete_group_permission_using_delete_with_http_info(self, group_permission_id, **kwargs): # noqa: E501 + """Delete group permission (deleteGroupPermission) # noqa: E501 + + Deletes the group permission. Referencing non-existing group permission Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_group_permission_using_delete_with_http_info(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_permission_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_group_permission_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_permission_id' is set + if ('group_permission_id' not in params or + params['group_permission_id'] is None): + raise ValueError("Missing the required parameter `group_permission_id` when calling `delete_group_permission_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_permission_id' in params: + path_params['groupPermissionId'] = params['group_permission_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission/{groupPermissionId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_entity_group_permissions_using_get(self, entity_group_id, **kwargs): # noqa: E501 + """Get group permissions by Entity Group Id (getEntityGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that is assigned for the specified Entity Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_permissions_using_get(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_entity_group_permissions_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_entity_group_permissions_using_get_with_http_info(entity_group_id, **kwargs) # noqa: E501 + return data + + def get_entity_group_permissions_using_get_with_http_info(self, entity_group_id, **kwargs): # noqa: E501 + """Get group permissions by Entity Group Id (getEntityGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that is assigned for the specified Entity Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_entity_group_permissions_using_get_with_http_info(entity_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_entity_group_permissions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_entity_group_permissions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/groupPermissions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[GroupPermissionInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_permission_by_id_using_get(self, group_permission_id, **kwargs): # noqa: E501 + """Get Group Permission (getGroupPermissionById) # noqa: E501 + + Fetch the Group Permission object based on the provided Group Permission Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_by_id_using_get(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_permission_by_id_using_get_with_http_info(group_permission_id, **kwargs) # noqa: E501 + else: + (data) = self.get_group_permission_by_id_using_get_with_http_info(group_permission_id, **kwargs) # noqa: E501 + return data + + def get_group_permission_by_id_using_get_with_http_info(self, group_permission_id, **kwargs): # noqa: E501 + """Get Group Permission (getGroupPermissionById) # noqa: E501 + + Fetch the Group Permission object based on the provided Group Permission Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_by_id_using_get_with_http_info(group_permission_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_permission_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_permission_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_permission_id' is set + if ('group_permission_id' not in params or + params['group_permission_id'] is None): + raise ValueError("Missing the required parameter `group_permission_id` when calling `get_group_permission_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_permission_id' in params: + path_params['groupPermissionId'] = params['group_permission_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission/{groupPermissionId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GroupPermission', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_permission_info_by_id_using_get(self, group_permission_id, is_user_group, **kwargs): # noqa: E501 + """Get Group Permission Info (getGroupPermissionInfoById) # noqa: E501 + + Fetch the Group Permission Info object based on the provided Group Permission Id and the flag that controls what additional information to load: User or Entity Group. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_info_by_id_using_get(group_permission_id, is_user_group, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool is_user_group: Load additional information about User('true') or Entity Group('false). (required) + :return: GroupPermissionInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_permission_info_by_id_using_get_with_http_info(group_permission_id, is_user_group, **kwargs) # noqa: E501 + else: + (data) = self.get_group_permission_info_by_id_using_get_with_http_info(group_permission_id, is_user_group, **kwargs) # noqa: E501 + return data + + def get_group_permission_info_by_id_using_get_with_http_info(self, group_permission_id, is_user_group, **kwargs): # noqa: E501 + """Get Group Permission Info (getGroupPermissionInfoById) # noqa: E501 + + Fetch the Group Permission Info object based on the provided Group Permission Id and the flag that controls what additional information to load: User or Entity Group. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_permission_info_by_id_using_get_with_http_info(group_permission_id, is_user_group, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_permission_id: A string value representing the group permission id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool is_user_group: Load additional information about User('true') or Entity Group('false). (required) + :return: GroupPermissionInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_permission_id', 'is_user_group'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_permission_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_permission_id' is set + if ('group_permission_id' not in params or + params['group_permission_id'] is None): + raise ValueError("Missing the required parameter `group_permission_id` when calling `get_group_permission_info_by_id_using_get`") # noqa: E501 + # verify the required parameter 'is_user_group' is set + if ('is_user_group' not in params or + params['is_user_group'] is None): + raise ValueError("Missing the required parameter `is_user_group` when calling `get_group_permission_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_permission_id' in params: + path_params['groupPermissionId'] = params['group_permission_id'] # noqa: E501 + + query_params = [] + if 'is_user_group' in params: + query_params.append(('isUserGroup', params['is_user_group'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission/info/{groupPermissionId}{?isUserGroup}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GroupPermissionInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_group_permissions_using_get(self, user_group_id, **kwargs): # noqa: E501 + """Get group permissions by User Group Id (getUserGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that belongs to specified User Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_group_permissions_using_get(user_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_group_permissions_using_get_with_http_info(user_group_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_group_permissions_using_get_with_http_info(user_group_id, **kwargs) # noqa: E501 + return data + + def get_user_group_permissions_using_get_with_http_info(self, user_group_id, **kwargs): # noqa: E501 + """Get group permissions by User Group Id (getUserGroupPermissions) # noqa: E501 + + Returns a list of group permission objects that belongs to specified User Group Id. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_group_permissions_using_get_with_http_info(user_group_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_group_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_group_permissions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_group_id' is set + if ('user_group_id' not in params or + params['user_group_id'] is None): + raise ValueError("Missing the required parameter `user_group_id` when calling `get_user_group_permissions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_group_id' in params: + path_params['userGroupId'] = params['user_group_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/userGroup/{userGroupId}/groupPermissions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[GroupPermissionInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def load_user_group_permission_infos_using_post(self, **kwargs): # noqa: E501 + """Load User Group Permissions (loadUserGroupPermissionInfos) # noqa: E501 + + Enrich a list of group permission objects with the information about Role, User and Entity Groups. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_user_group_permission_infos_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[GroupPermission] body: + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.load_user_group_permission_infos_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.load_user_group_permission_infos_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def load_user_group_permission_infos_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Load User Group Permissions (loadUserGroupPermissionInfos) # noqa: E501 + + Enrich a list of group permission objects with the information about Role, User and Entity Groups. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Group Permission Info object extends the Group Permissions with the full information about Role and User and/or Entity Groups. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.load_user_group_permission_infos_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param list[GroupPermission] body: + :return: list[GroupPermissionInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method load_user_group_permission_infos_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/userGroup/groupPermissions/info', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[GroupPermissionInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_group_permission_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Group Permission (saveGroupPermission) # noqa: E501 + + Creates or Updates the Group Permission. When creating group permission, platform generates Group Permission Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Group Permission id will be present in the response. Specify existing Group Permission id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_group_permission_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param GroupPermission body: + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_group_permission_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_group_permission_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_group_permission_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Group Permission (saveGroupPermission) # noqa: E501 + + Creates or Updates the Group Permission. When creating group permission, platform generates Group Permission Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Group Permission id will be present in the response. Specify existing Group Permission id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Group permission entity represents list of allowed operations for certain User Group to perform against certain Entity Group. Basically, this entity wires three other entities: * Role that defines set of allowed operations; * User Group that defines set of users who may perform the operations; * Entity Group that defines set of entities which will be accessible to users; Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_group_permission_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param GroupPermission body: + :return: GroupPermission + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_group_permission_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/groupPermission', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='GroupPermission', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/http_integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/http_integration_controller_api.py new file mode 100644 index 0000000..d2b3b15 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/http_integration_controller_api.py @@ -0,0 +1,358 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class HttpIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_status_using_get(self, routing_key, request_params, request_headers, **kwargs): # noqa: E501 + """checkStatus # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_status_using_get(routing_key, request_params, request_headers, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param Object request_params: requestParams (required) + :param Object request_headers: requestHeaders (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_status_using_get_with_http_info(routing_key, request_params, request_headers, **kwargs) # noqa: E501 + else: + (data) = self.check_status_using_get_with_http_info(routing_key, request_params, request_headers, **kwargs) # noqa: E501 + return data + + def check_status_using_get_with_http_info(self, routing_key, request_params, request_headers, **kwargs): # noqa: E501 + """checkStatus # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_status_using_get_with_http_info(routing_key, request_params, request_headers, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param Object request_params: requestParams (required) + :param Object request_headers: requestHeaders (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key', 'request_params', 'request_headers'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_status_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `check_status_using_get`") # noqa: E501 + # verify the required parameter 'request_params' is set + if ('request_params' not in params or + params['request_params'] is None): + raise ValueError("Missing the required parameter `request_params` when calling `check_status_using_get`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `check_status_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'request_params' in params: + query_params.append(('requestParams', params['request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/http/{routingKey}{?requestParams}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post1(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post1(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post1_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post1_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + return data + + def process_request_using_post1_with_http_info(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post1_with_http_info(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key', 'suffix'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post1`") # noqa: E501 + # verify the required parameter 'suffix' is set + if ('suffix' not in params or + params['suffix'] is None): + raise ValueError("Missing the required parameter `suffix` when calling `process_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + if 'suffix' in params: + path_params['suffix'] = params['suffix'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/http/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post2(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post2(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post2_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post2_with_http_info(routing_key, suffix, **kwargs) # noqa: E501 + return data + + def process_request_using_post2_with_http_info(self, routing_key, suffix, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post2_with_http_info(routing_key, suffix, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: routingKey (required) + :param str suffix: suffix (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key', 'suffix'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post2`") # noqa: E501 + # verify the required parameter 'suffix' is set + if ('suffix' not in params or + params['suffix'] is None): + raise ValueError("Missing the required parameter `suffix` when calling `process_request_using_post2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + if 'suffix' in params: + path_params['suffix'] = params['suffix'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/http/{routingKey}/{suffix}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/integration_controller_api.py new file mode 100644 index 0000000..26a6dae --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/integration_controller_api.py @@ -0,0 +1,1505 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class IntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_integration_to_edge_using_post(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Assign integration to edge (assignIntegrationToEdge) # noqa: E501 + + Creates assignment of an existing integration edge template to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once integration will be delivered to edge service, it's going to start locally. Only integration edge template can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_integration_to_edge_using_post(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_integration_to_edge_using_post_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_integration_to_edge_using_post_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + return data + + def assign_integration_to_edge_using_post_with_http_info(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Assign integration to edge (assignIntegrationToEdge) # noqa: E501 + + Creates assignment of an existing integration edge template to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once integration will be delivered to edge service, it's going to start locally. Only integration edge template can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_integration_to_edge_using_post_with_http_info(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_integration_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_integration_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `assign_integration_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integration/{integrationId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def check_integration_connection_using_post(self, **kwargs): # noqa: E501 + """Check integration connectivity (checkIntegrationConnection) # noqa: E501 + + Checks if the connection to the integration is established. Throws an error if the connection is not established. Example: Failed to connect to MQTT broker at host:port. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_integration_connection_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_integration_connection_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.check_integration_connection_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def check_integration_connection_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Check integration connectivity (checkIntegrationConnection) # noqa: E501 + + Checks if the connection to the integration is established. Throws an error if the connection is not established. Example: Failed to connect to MQTT broker at host:port. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_integration_connection_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_integration_connection_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/check', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_integration_using_delete(self, integration_id, **kwargs): # noqa: E501 + """Delete integration (deleteIntegration) # noqa: E501 + + Deletes the integration and all the relations (from and to the integration). Referencing non-existing integration Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_integration_using_delete(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_integration_using_delete_with_http_info(integration_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_integration_using_delete_with_http_info(integration_id, **kwargs) # noqa: E501 + return data + + def delete_integration_using_delete_with_http_info(self, integration_id, **kwargs): # noqa: E501 + """Delete integration (deleteIntegration) # noqa: E501 + + Deletes the integration and all the relations (from and to the integration). Referencing non-existing integration Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_integration_using_delete_with_http_info(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_integration_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `delete_integration_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/{integrationId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_all_related_edges_missing_attributes_using_get(self, integration_id, **kwargs): # noqa: E501 + """Find missing attributes for all related edges (findAllRelatedEdgesMissingAttributes) # noqa: E501 + + Returns list of attribute names of all related edges that are missing in the integration configuration. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_all_related_edges_missing_attributes_using_get(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_all_related_edges_missing_attributes_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + else: + (data) = self.find_all_related_edges_missing_attributes_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + return data + + def find_all_related_edges_missing_attributes_using_get_with_http_info(self, integration_id, **kwargs): # noqa: E501 + """Find missing attributes for all related edges (findAllRelatedEdgesMissingAttributes) # noqa: E501 + + Returns list of attribute names of all related edges that are missing in the integration configuration. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_all_related_edges_missing_attributes_using_get_with_http_info(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_all_related_edges_missing_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `find_all_related_edges_missing_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/integration/{integrationId}/allMissingAttributes', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_edge_missing_attributes_using_get(self, edge_id, integration_ids, **kwargs): # noqa: E501 + """Find edge missing attributes for assigned integrations (findEdgeMissingAttributes) # noqa: E501 + + Returns list of edge attribute names that are missing in assigned integrations. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_edge_missing_attributes_using_get(edge_id, integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str integration_ids: A list of assigned integration ids, separated by comma ',' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_edge_missing_attributes_using_get_with_http_info(edge_id, integration_ids, **kwargs) # noqa: E501 + else: + (data) = self.find_edge_missing_attributes_using_get_with_http_info(edge_id, integration_ids, **kwargs) # noqa: E501 + return data + + def find_edge_missing_attributes_using_get_with_http_info(self, edge_id, integration_ids, **kwargs): # noqa: E501 + """Find edge missing attributes for assigned integrations (findEdgeMissingAttributes) # noqa: E501 + + Returns list of edge attribute names that are missing in assigned integrations. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_edge_missing_attributes_using_get_with_http_info(edge_id, integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str integration_ids: A list of assigned integration ids, separated by comma ',' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'integration_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_edge_missing_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `find_edge_missing_attributes_using_get`") # noqa: E501 + # verify the required parameter 'integration_ids' is set + if ('integration_ids' not in params or + params['integration_ids'] is None): + raise ValueError("Missing the required parameter `integration_ids` when calling `find_edge_missing_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'integration_ids' in params: + query_params.append(('integrationIds', params['integration_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/integration/{edgeId}/missingAttributes{?integrationIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_integration_infos_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrationInfos) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integration_infos_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_integration_infos_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_integration_infos_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_integration_infos_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrationInfos) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integration_infos_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_integration_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_integration_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_integration_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_integration_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integrationInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegrationInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_integrations_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrations) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integrations_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_integrations_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_integrations_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_integrations_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Integrations (getEdgeIntegrations) # noqa: E501 + + Returns a page of Integrations assigned to the specified edge. The integration object contains information about the Integration, including the heavyweight configuration object. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_integrations_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_integrations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_integrations_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_integrations_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_integrations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integrations{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integration_by_id_using_get(self, integration_id, **kwargs): # noqa: E501 + """Get Integration (getIntegrationById) # noqa: E501 + + Fetch the Integration object based on the provided Integration Id. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_id_using_get(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integration_by_id_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + else: + (data) = self.get_integration_by_id_using_get_with_http_info(integration_id, **kwargs) # noqa: E501 + return data + + def get_integration_by_id_using_get_with_http_info(self, integration_id, **kwargs): # noqa: E501 + """Get Integration (getIntegrationById) # noqa: E501 + + Fetch the Integration object based on the provided Integration Id. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_id_using_get_with_http_info(integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_id: A string value representing the integration id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integration_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `get_integration_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/{integrationId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integration_by_routing_key_using_get(self, routing_key, **kwargs): # noqa: E501 + """Get Integration by Routing Key (getIntegrationByRoutingKey) # noqa: E501 + + Fetch the Integration object based on the provided routing key. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_routing_key_using_get(routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: A string value representing the integration routing key. For example, '542047e6-c1b2-112e-a87e-e49247c09d4b' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integration_by_routing_key_using_get_with_http_info(routing_key, **kwargs) # noqa: E501 + else: + (data) = self.get_integration_by_routing_key_using_get_with_http_info(routing_key, **kwargs) # noqa: E501 + return data + + def get_integration_by_routing_key_using_get_with_http_info(self, routing_key, **kwargs): # noqa: E501 + """Get Integration by Routing Key (getIntegrationByRoutingKey) # noqa: E501 + + Fetch the Integration object based on the provided routing key. The server checks that the integration is owned by the same tenant. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_by_routing_key_using_get_with_http_info(routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str routing_key: A string value representing the integration routing key. For example, '542047e6-c1b2-112e-a87e-e49247c09d4b' (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integration_by_routing_key_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `get_integration_by_routing_key_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration/routingKey/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integration_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Integration Infos (getIntegrationInfos) # noqa: E501 + + Returns a page of integration infos owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integration_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_integration_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_integration_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Integration Infos (getIntegrationInfos) # noqa: E501 + + Returns a page of integration infos owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integration_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegrationInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'is_edge_template', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integration_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_integration_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_integration_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_edge_template' in params: + query_params.append(('isEdgeTemplate', params['is_edge_template'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integrationInfos{?isEdgeTemplate,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegrationInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integrations_by_ids_using_get(self, integration_ids, **kwargs): # noqa: E501 + """Get Integrations By Ids (getIntegrationsByIds) # noqa: E501 + + Requested integrations must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_by_ids_using_get(integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_ids: A list of integration ids, separated by comma ',' (required) + :return: list[Integration] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integrations_by_ids_using_get_with_http_info(integration_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_integrations_by_ids_using_get_with_http_info(integration_ids, **kwargs) # noqa: E501 + return data + + def get_integrations_by_ids_using_get_with_http_info(self, integration_ids, **kwargs): # noqa: E501 + """Get Integrations By Ids (getIntegrationsByIds) # noqa: E501 + + Requested integrations must be owned by tenant which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_by_ids_using_get_with_http_info(integration_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str integration_ids: A list of integration ids, separated by comma ',' (required) + :return: list[Integration] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['integration_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integrations_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'integration_ids' is set + if ('integration_ids' not in params or + params['integration_ids'] is None): + raise ValueError("Missing the required parameter `integration_ids` when calling `get_integrations_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'integration_ids' in params: + query_params.append(('integrationIds', params['integration_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integrations{?integrationIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Integration]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_integrations_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Integrations (getIntegrations) # noqa: E501 + + Returns a page of integrations owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_integrations_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_integrations_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_integrations_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Integrations (getIntegrations) # noqa: E501 + + Returns a page of integrations owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_integrations_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool is_edge_template: Fetch edge template integrations + :param str text_search: The case insensitive 'startsWith' filter based on the integration name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataIntegration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'is_edge_template', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_integrations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_integrations_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_integrations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_edge_template' in params: + query_params.append(('isEdgeTemplate', params['is_edge_template'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integrations{?isEdgeTemplate,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataIntegration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_integration_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Integration (saveIntegration) # noqa: E501 + + Create or update the Integration. When creating integration, platform generates Integration Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created integration id will be present in the response. Specify existing Integration id to update the integration. Referencing non-existing integration Id will cause 'Not Found' error. Integration configuration is validated for each type of the integration before it can be created. # Integration Configuration Integration configuration (**'configuration'** field) is the JSON object representing the special configuration per integration type with the connectivity fields and other important parameters dependent on the specific integration type. Let's review the configuration object for the MQTT Integration type below. ```json { \"clientConfiguration\":{ \"host\":\"broker.hivemq.com\", \"port\":1883, \"cleanSession\":false, \"ssl\":false, \"connectTimeoutSec\":10, \"clientId\":\"\", \"maxBytesInMessage\":32368, \"credentials\":{ \"type\":\"anonymous\" } }, \"downlinkTopicPattern\":\"${topic}\", \"topicFilters\":[ { \"filter\":\"tb/mqtt-integration-tutorial/sensors/+/temperature\", \"qos\":0 } ], \"metadata\":{ } } ``` Remove 'id', 'tenantId' from the request body example (below) to create new Integration entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_integration_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_integration_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_integration_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_integration_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Integration (saveIntegration) # noqa: E501 + + Create or update the Integration. When creating integration, platform generates Integration Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created integration id will be present in the response. Specify existing Integration id to update the integration. Referencing non-existing integration Id will cause 'Not Found' error. Integration configuration is validated for each type of the integration before it can be created. # Integration Configuration Integration configuration (**'configuration'** field) is the JSON object representing the special configuration per integration type with the connectivity fields and other important parameters dependent on the specific integration type. Let's review the configuration object for the MQTT Integration type below. ```json { \"clientConfiguration\":{ \"host\":\"broker.hivemq.com\", \"port\":1883, \"cleanSession\":false, \"ssl\":false, \"connectTimeoutSec\":10, \"clientId\":\"\", \"maxBytesInMessage\":32368, \"credentials\":{ \"type\":\"anonymous\" } }, \"downlinkTopicPattern\":\"${topic}\", \"topicFilters\":[ { \"filter\":\"tb/mqtt-integration-tutorial/sensors/+/temperature\", \"qos\":0 } ], \"metadata\":{ } } ``` Remove 'id', 'tenantId' from the request body example (below) to create new Integration entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_integration_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Integration body: + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_integration_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/integration', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_integration_from_edge_using_delete(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Unassign integration from edge (unassignIntegrationFromEdge) # noqa: E501 + + Clears assignment of the integration to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove integration locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_integration_from_edge_using_delete(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_integration_from_edge_using_delete_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_integration_from_edge_using_delete_with_http_info(edge_id, integration_id, **kwargs) # noqa: E501 + return data + + def unassign_integration_from_edge_using_delete_with_http_info(self, edge_id, integration_id, **kwargs): # noqa: E501 + """Unassign integration from edge (unassignIntegrationFromEdge) # noqa: E501 + + Clears assignment of the integration to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove integration (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove integration locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_integration_from_edge_using_delete_with_http_info(edge_id, integration_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str integration_id: integrationId (required) + :return: Integration + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'integration_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_integration_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_integration_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'integration_id' is set + if ('integration_id' not in params or + params['integration_id'] is None): + raise ValueError("Missing the required parameter `integration_id` when calling `unassign_integration_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'integration_id' in params: + path_params['integrationId'] = params['integration_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/integration/{integrationId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Integration', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/login_endpoint_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/login_endpoint_api.py new file mode 100644 index 0000000..f3a3fb7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/login_endpoint_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class LoginEndpointApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def login_post(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.login_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.login_post_with_http_info(**kwargs) # noqa: E501 + return data + + def login_post_with_http_info(self, **kwargs): # noqa: E501 + """Login method to get user JWT token data # noqa: E501 + + Login method used to authenticate user and get JWT token data. Value of the response **token** field can be used as **X-Authorization** header value: `X-Authorization: Bearer $JWT_TOKEN_VALUE`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.login_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginRequest body: + :return: LoginResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method login_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/login', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/loriot_integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/loriot_integration_controller_api.py new file mode 100644 index 0000000..049026a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/loriot_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class LoriotIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post9(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post9(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post9_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post9_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post9_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post9_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post9" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post9`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post9`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post9`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put1(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put1(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put1_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put1_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put1_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put1`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put1`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/loriot/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/lwm_2m_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/lwm_2m_controller_api.py new file mode 100644 index 0000000..ce9ec84 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/lwm_2m_controller_api.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class Lwm2mControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_lwm2m_bootstrap_security_info_using_get(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, **kwargs) # noqa: E501 + return data + + def get_lwm2m_bootstrap_security_info_using_get_with_http_info(self, is_bootstrap_server, **kwargs): # noqa: E501 + """Get Lwm2m Bootstrap SecurityInfo (getLwm2mBootstrapSecurityInfo) # noqa: E501 + + Get the Lwm2m Bootstrap SecurityInfo object (of the current server) based on the provided isBootstrapServer parameter. If isBootstrapServer == true, get the parameters of the current Bootstrap Server. If isBootstrapServer == false, get the parameters of the current Lwm2m Server. Used for client settings when starting the client in Bootstrap mode. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_bootstrap_security_info_using_get_with_http_info(is_bootstrap_server, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_bootstrap_server: A Boolean value representing the Server SecurityInfo for future Bootstrap client mode settings. Values: 'true' for Bootstrap Server; 'false' for Lwm2m Server. (required) + :return: LwM2MServerSecurityConfigDefault + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_bootstrap_server'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_bootstrap_security_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_bootstrap_server' is set + if ('is_bootstrap_server' not in params or + params['is_bootstrap_server'] is None): + raise ValueError("Missing the required parameter `is_bootstrap_server` when calling `get_lwm2m_bootstrap_security_info_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'is_bootstrap_server' in params: + path_params['isBootstrapServer'] = params['is_bootstrap_server'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/lwm2m/deviceProfile/bootstrap/{isBootstrapServer}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LwM2MServerSecurityConfigDefault', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/notification_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_controller_api.py new file mode 100644 index 0000000..cc841a9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_controller_api.py @@ -0,0 +1,1203 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def create_notification_request_using_post(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.create_notification_request_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def create_notification_request_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create notification request (createNotificationRequest) # noqa: E501 + + Processes notification request. Mandatory request properties are `targets` (list of targets ids to send notification to), and either `templateId` (existing notification template id) or `template` (to send notification without saving the template). Optionally, you can set `sendingDelayInSec` inside the `additionalConfig` field to schedule the notification. For each enabled delivery method in the notification template, there must be a target in the `targets` list that supports this delivery method: if you chose `WEB`, `EMAIL` or `SMS` - there must be at least one target in `targets` of `PLATFORM_USERS` type. For `SLACK` delivery method - you need to chose at least one `SLACK` notification target. Notification request object with `PROCESSING` status will be returned immediately, and the notification sending itself is done asynchronously. After all notifications are sent, the `status` of the request becomes `SENT`. Use `getNotificationRequestById` to see the notification request processing status and some sending stats. Here is an example of notification request to one target using saved template: ```json { \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"6dbc3670-e4dd-11ed-9401-dbcc5dff78be\" }, \"targets\": [ \"320e3ed0-d785-11ed-a06c-21dd57dd88ca\" ], \"additionalConfig\": { \"sendingDelayInSec\": 0 } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_notification_request_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :return: NotificationRequest + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_notification_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequest', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_request_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_request_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_request_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification request (deleteNotificationRequest) # noqa: E501 + + Deletes notification request by its id. If the request has status `SENT` - all sent notifications for this request will be deleted. If it is `SCHEDULED`, the request will be cancelled. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_request_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_request_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_request_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_notification_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification (deleteNotification) # noqa: E501 + + Deletes notification by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_delivery_methods_using_get(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_delivery_methods_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_delivery_methods_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available delivery methods (getAvailableDeliveryMethods) # noqa: E501 + + Returns the list of delivery methods that are properly configured and are allowed to be used for sending notifications. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_delivery_methods_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_delivery_methods_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/deliveryMethods', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_request_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification request by id (getNotificationRequestById) # noqa: E501 + + Fetches notification request info by request id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_request_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_request_preview_using_post(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_request_preview_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_request_preview_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get notification request preview (getNotificationRequestPreview) # noqa: E501 + + Returns preview for notification request. `processedTemplates` shows how the notifications for each delivery method will look like for the first recipient of the corresponding notification target. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_request_preview_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRequest body: + :param int recipients_preview_size: Amount of the recipients to show in preview + :return: NotificationRequestPreview + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'recipients_preview_size'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_request_preview_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'recipients_preview_size' in params: + query_params.append(('recipientsPreviewSize', params['recipients_preview_size'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/request/preview{?recipientsPreviewSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRequestPreview', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_requests_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_requests_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_requests_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification requests (getNotificationRequests) # noqa: E501 + + Returns the page of notification requests submitted by users of this tenant or sysadmins. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_requests_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the used template name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRequestInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_requests_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_requests_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_requests_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/requests{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRequestInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_settings_using_get(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_notification_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_notification_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get notification settings (getNotificationSettings) # noqa: E501 + + Retrieves notification settings for this tenant or sysadmin. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notifications_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notifications_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notifications_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notifications (getNotifications) # noqa: E501 + + Returns the page of notifications for current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. **WebSocket API**: There are 2 types of subscriptions: one for unread notifications count, another for unread notifications themselves. The URI for opening WS session for notifications: `/api/ws/plugins/notifications`. Subscription command for unread notifications count: ``` { \"unreadCountSubCmd\": { \"cmdId\": 1234 } } ``` To subscribe for latest unread notifications: ``` { \"unreadSubCmd\": { \"cmdId\": 1234, \"limit\": 10 } } ``` To unsubscribe from any subscription: ``` { \"unsubCmd\": { \"cmdId\": 1234 } } ``` To mark certain notifications as read, use following command: ``` { \"markAsReadCmd\": { \"cmdId\": 1234, \"notifications\": [ \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\", \"5b6dfee0-8d0d-11ed-b61f-35a57b03dade\" ] } } ``` To mark all notifications as read: ``` { \"markAllAsReadCmd\": { \"cmdId\": 1234 } } ``` Update structure for unread **notifications count subscription**: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 55 } ``` For **notifications subscription**: - full update of latest unread notifications: ``` { \"cmdId\": 1234, \"notifications\": [ { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, ... } ], \"totalUnreadCount\": 1 } ``` - when new notification arrives or shown notification is updated: ``` { \"cmdId\": 1234, \"update\": { \"id\": { \"entityType\": \"NOTIFICATION\", \"id\": \"6f860330-7fc2-11ed-b855-7dd3b7d2faa9\" }, # updated notification info, text, subject etc. ... }, \"totalUnreadCount\": 2 } ``` - when unread notifications count changes: ``` { \"cmdId\": 1234, \"totalUnreadCount\": 5 } ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notifications_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on notification subject or text + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool unread_only: To search for unread notifications only + :return: PageDataNotification + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'unread_only'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notifications_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notifications_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notifications_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'unread_only' in params: + query_params.append(('unreadOnly', params['unread_only'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications{?page,pageSize,sortOrder,sortProperty,textSearch,unreadOnly}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotification', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_all_notifications_as_read_using_put(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.mark_all_notifications_as_read_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def mark_all_notifications_as_read_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Mark all notifications as read (markAllNotificationsAsRead) # noqa: E501 + + Marks all unread notifications as read. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_all_notifications_as_read_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_all_notifications_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notifications/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mark_notification_as_read_using_put(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.mark_notification_as_read_using_put_with_http_info(id, **kwargs) # noqa: E501 + return data + + def mark_notification_as_read_using_put_with_http_info(self, id, **kwargs): # noqa: E501 + """Mark notification as read (markNotificationAsRead) # noqa: E501 + + Marks notification as read by its id. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mark_notification_as_read_using_put_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mark_notification_as_read_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `mark_notification_as_read_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/{id}/read', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_settings_using_post(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification settings (saveNotificationSettings) # noqa: E501 + + Saves notification settings for this tenant or sysadmin. `deliveryMethodsConfigs` of the settings must be specified. Here is an example of the notification settings with Slack configuration: ```json { \"deliveryMethodsConfigs\": { \"SLACK\": { \"method\": \"SLACK\", \"botToken\": \"xoxb-....\" } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationSettings body: + :return: NotificationSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/notification_rule_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_rule_controller_api.py new file mode 100644 index 0000000..972b61c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_rule_controller_api.py @@ -0,0 +1,447 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationRuleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_rule_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_rule_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_rule_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification rule (deleteNotificationRule) # noqa: E501 + + Deletes notification rule by id. Cancels all related scheduled notification requests (e.g. due to escalation table) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_rule_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_rule_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_rule_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rule_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rule_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_rule_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification rule by id (getNotificationRuleById) # noqa: E501 + + Fetches notification rule info by rule's id. In addition to regular notification rule fields, there are `templateName` and `deliveryMethods` in the response. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rule_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rule_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_rule_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_rules_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_rules_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_rules_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification rules (getNotificationRules) # noqa: E501 + + Returns the page of notification rules. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_rules_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on rule's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationRuleInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_rules_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_rules_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_rules_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rules{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationRuleInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_rule_using_post(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_rule_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_rule_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification rule (saveNotificationRule) # noqa: E501 + + Creates or updates notification rule. Mandatory properties are `name`, `templateId` (of a template with `notificationType` matching to rule's `triggerType`), `triggerType`, `triggerConfig` and `recipientConfig`. Additionally, you may specify rule `description` inside of `additionalConfig`. Trigger type of the rule cannot be changed. Available trigger types for tenant: `ENTITY_ACTION`, `ALARM`, `ALARM_COMMENT`, `ALARM_ASSIGNMENT`, `DEVICE_ACTIVITY`, `RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT`. For sysadmin, there are following trigger types available: `ENTITIES_LIMIT`, `API_USAGE_LIMIT`, `NEW_PLATFORM_VERSION`. Here is an example of notification rule to send notification when a device, asset or customer is created or deleted: ```json { \"name\": \"Entity action\", \"templateId\": { \"entityType\": \"NOTIFICATION_TEMPLATE\", \"id\": \"32117320-d785-11ed-a06c-21dd57dd88ca\" }, \"triggerType\": \"ENTITY_ACTION\", \"triggerConfig\": { \"entityTypes\": [ \"CUSTOMER\", \"DEVICE\", \"ASSET\" ], \"created\": true, \"updated\": false, \"deleted\": true, \"triggerType\": \"ENTITY_ACTION\" }, \"recipientsConfig\": { \"targets\": [ \"320f2930-d785-11ed-a06c-21dd57dd88ca\" ], \"triggerType\": \"ENTITY_ACTION\" }, \"additionalConfig\": { \"description\": \"Send notification to tenant admins or customer users when a device, asset or customer is created\" }, \"templateName\": \"Entity action notification\", \"deliveryMethods\": [ \"WEB\" ] } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_rule_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationRule body: + :return: NotificationRule + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_rule_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/rule', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationRule', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/notification_target_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_target_controller_api.py new file mode 100644 index 0000000..c5b3f7d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_target_controller_api.py @@ -0,0 +1,776 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTargetControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_target_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_target_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_target_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification target by id (deleteNotificationTargetById) # noqa: E501 + + Deletes notification target by its id. This target cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_target_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_target_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_target_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_target_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_target_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_target_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification target by id (getNotificationTargetById) # noqa: E501 + + Fetches notification target by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_target_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_target_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_target_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """Get notification targets by ids (getNotificationTargetsByIds) # noqa: E501 + + Returns the list of notification targets found by provided ids. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: Comma-separated list of uuids representing targets ids (required) + :return: list[NotificationTarget] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_notification_targets_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[NotificationTarget]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_by_supported_notification_type_using_get(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_by_supported_notification_type_using_get_with_http_info(self, notification_type, page_size, page, **kwargs): # noqa: E501 + """Get notification targets by supported notification type (getNotificationTargetsBySupportedNotificationType) # noqa: E501 + + Returns the page of notification targets filtered by notification type that they can be used for. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_by_supported_notification_type_using_get_with_http_info(notification_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str notification_type: notificationType (required) + :param int page_size: pageSize (required) + :param int page: page (required) + :param str text_search: textSearch + :param str sort_property: sortProperty + :param str sort_order: sortOrder + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['notification_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_by_supported_notification_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'notification_type' is set + if ('notification_type' not in params or + params['notification_type'] is None): + raise ValueError("Missing the required parameter `notification_type` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_by_supported_notification_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'notification_type' in params: + query_params.append(('notificationType', params['notification_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?notificationType,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_targets_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_targets_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_targets_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification targets (getNotificationTargets) # noqa: E501 + + Returns the page of notification targets owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_targets_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filed based on the target's name + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataNotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_targets_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_targets_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_targets_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/targets{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_recipients_for_notification_target_config_using_post(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_recipients_for_notification_target_config_using_post_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get recipients for notification target config (getRecipientsForNotificationTargetConfig) # noqa: E501 + + Returns the page of recipients for such notification target configuration. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_recipients_for_notification_target_config_using_post_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param NotificationTarget body: + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_recipients_for_notification_target_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_recipients_for_notification_target_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target/recipients{?page,pageSize}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_target_using_post(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `USER_GROUP_LIST`, `TENANT_ADMINISTRATORS`, `USER_ROLE`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_target_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_target_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification target (saveNotificationTarget) # noqa: E501 + + Creates or updates notification target. Available `configuration` types are `PLATFORM_USERS` and `SLACK`. For `PLATFORM_USERS` the `usersFilter` must be specified. For tenant, there are following users filter types available: `USER_LIST`, `CUSTOMER_USERS`, `USER_GROUP_LIST`, `TENANT_ADMINISTRATORS`, `USER_ROLE`, `ALL_USERS`, `ORIGINATOR_ENTITY_OWNER_USERS`, `AFFECTED_USER`. For sysadmin: `TENANT_ADMINISTRATORS`, `AFFECTED_TENANT_ADMINISTRATORS`, `SYSTEM_ADMINISTRATORS`, `ALL_USERS`. Here is an example of tenant-level notification target to send notification to customer's users: ```json { \"name\": \"Users of Customer A\", \"configuration\": { \"type\": \"PLATFORM_USERS\", \"usersFilter\": { \"type\": \"CUSTOMER_USERS\", \"customerId\": \"32499a20-d785-11ed-a06c-21dd57dd88ca\" }, \"description\": \"Users of Customer A\" } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_target_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTarget body: + :return: NotificationTarget + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_target_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/target', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTarget', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/notification_template_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_template_controller_api.py new file mode 100644 index 0000000..54a77d2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/notification_template_controller_api.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class NotificationTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_notification_template_by_id_using_delete(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.delete_notification_template_by_id_using_delete_with_http_info(id, **kwargs) # noqa: E501 + return data + + def delete_notification_template_by_id_using_delete_with_http_info(self, id, **kwargs): # noqa: E501 + """Delete notification template by id (deleteNotificationTemplateById # noqa: E501 + + Deletes notification template by its id. This template cannot be referenced by existing scheduled notification requests or any notification rules. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_notification_template_by_id_using_delete_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_notification_template_by_id_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `delete_notification_template_by_id_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_template_by_id_using_get(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_template_by_id_using_get_with_http_info(id, **kwargs) # noqa: E501 + return data + + def get_notification_template_by_id_using_get_with_http_info(self, id, **kwargs): # noqa: E501 + """Get notification template by id (getNotificationTemplateById) # noqa: E501 + + Fetches notification template by id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_template_by_id_using_get_with_http_info(id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str id: id (required) + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_template_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'id' is set + if ('id' not in params or + params['id'] is None): + raise ValueError("Missing the required parameter `id` when calling `get_notification_template_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'id' in params: + path_params['id'] = params['id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template/{id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_notification_templates_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_notification_templates_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_notification_templates_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get notification templates (getNotificationTemplates) # noqa: E501 + + Returns the page of notification templates owned by sysadmin or tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_notification_templates_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: Case-insensitive 'substring' filter based on template's name and notification type + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param str notification_types: Comma-separated list of notification types to filter the templates + :return: PageDataNotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order', 'notification_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_notification_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_notification_templates_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_notification_templates_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'notification_types' in params: + query_params.append(('notificationTypes', params['notification_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/templates{?notificationTypes,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataNotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def list_slack_conversations_using_get(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.list_slack_conversations_using_get_with_http_info(type, **kwargs) # noqa: E501 + return data + + def list_slack_conversations_using_get_with_http_info(self, type, **kwargs): # noqa: E501 + """List Slack conversations (listSlackConversations) # noqa: E501 + + List available Slack conversations by type. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_slack_conversations_using_get_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: type (required) + :param str token: Slack bot token. If absent - system Slack settings will be used + :return: list[SlackConversation] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'token'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method list_slack_conversations_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `list_slack_conversations_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'token' in params: + query_params.append(('token', params['token'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/slack/conversations{?token,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SlackConversation]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_notification_template_using_post(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_notification_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_notification_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save notification template (saveNotificationTemplate) # noqa: E501 + + Creates or updates notification template. Here is an example of template to send notification via Web, SMS and Slack: ```json { \"name\": \"Greetings\", \"notificationType\": \"GENERAL\", \"configuration\": { \"deliveryMethodsTemplates\": { \"WEB\": { \"enabled\": true, \"subject\": \"Greetings\", \"body\": \"Hi there, ${recipientTitle}\", \"additionalConfig\": { \"icon\": { \"enabled\": true, \"icon\": \"back_hand\", \"color\": \"#757575\" }, \"actionButtonConfig\": { \"enabled\": false } }, \"method\": \"WEB\" }, \"SMS\": { \"enabled\": true, \"body\": \"Hi there, ${recipientTitle}\", \"method\": \"SMS\" }, \"SLACK\": { \"enabled\": true, \"body\": \"Hi there, @${recipientTitle}\", \"method\": \"SLACK\" } } } } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_notification_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param NotificationTemplate body: + :return: NotificationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_notification_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/notification/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='NotificationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/o_auth_2_config_template_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/o_auth_2_config_template_controller_api.py new file mode 100644 index 0000000..24cae4f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/o_auth_2_config_template_controller_api.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ConfigTemplateControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_client_registration_template_using_delete(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, **kwargs) # noqa: E501 + return data + + def delete_client_registration_template_using_delete_with_http_info(self, client_registration_template_id, **kwargs): # noqa: E501 + """Delete OAuth2 client registration template by id (deleteClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_client_registration_template_using_delete_with_http_info(client_registration_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str client_registration_template_id: String representation of client registration template id to delete (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['client_registration_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_client_registration_template_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'client_registration_template_id' is set + if ('client_registration_template_id' not in params or + params['client_registration_template_id'] is None): + raise ValueError("Missing the required parameter `client_registration_template_id` when calling `delete_client_registration_template_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'client_registration_template_id' in params: + path_params['clientRegistrationTemplateId'] = params['client_registration_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template/{clientRegistrationTemplateId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_client_registration_templates_using_get(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_client_registration_templates_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_client_registration_templates_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get the list of all OAuth2 client registration templates (getClientRegistrationTemplates) Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_client_registration_templates_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[OAuth2ClientRegistrationTemplate] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_client_registration_templates_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientRegistrationTemplate]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_client_registration_template_using_post(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_client_registration_template_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_client_registration_template_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create or update OAuth2 client registration template (saveClientRegistrationTemplate) Available for users with 'SYS_ADMIN' authority. # noqa: E501 + + Client registration template is OAuth2 provider configuration template with default settings for registering new OAuth2 clients # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_client_registration_template_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2ClientRegistrationTemplate body: + :return: OAuth2ClientRegistrationTemplate + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_client_registration_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config/template', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2ClientRegistrationTemplate', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/o_auth_2_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/o_auth_2_controller_api.py new file mode 100644 index 0000000..ba4841f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/o_auth_2_controller_api.py @@ -0,0 +1,411 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OAuth2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_o_auth2_info_using_get(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_o_auth2_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_o_auth2_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get current OAuth2 settings (getCurrentOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_o_auth2_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_o_auth2_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_login_processing_url_using_get(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_login_processing_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_login_processing_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 log in processing URL (getLoginProcessingUrl) # noqa: E501 + + Returns the URL enclosed in double quotes. After successful authentication with OAuth2 provider, it makes a redirect to this path so that the platform can do further log in processing. This URL may be configured as 'security.oauth2.loginProcessingUrl' property in yml configuration file, or as 'SECURITY_OAUTH2_LOGIN_PROCESSING_URL' env variable. By default it is '/login/oauth2/code/' Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_processing_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_login_processing_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/loginProcessingUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_o_auth2_clients_using_post(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_o_auth2_clients_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def get_o_auth2_clients_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Get OAuth2 clients (getOAuth2Clients) # noqa: E501 + + Get the list of OAuth2 clients to log in with, available for such domain scheme (HTTP or HTTPS) (if x-forwarded-proto request header is present - the scheme is known from it) and domain name and port (port may be known from x-forwarded-port header) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_o_auth2_clients_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile application package name, to find OAuth2 clients where there is configured mobile application with such package name + :param str platform: Platform type to search OAuth2 clients for which the usage with this platform type is allowed in the settings. If platform type is not one of allowable values - it will just be ignored + :return: list[OAuth2ClientInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name', 'platform'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_o_auth2_clients_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + if 'platform' in params: + query_params.append(('platform', params['platform'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/oauth2Clients{?pkgName,platform}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[OAuth2ClientInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_o_auth2_info_using_post(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_o_auth2_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_o_auth2_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save OAuth2 settings (saveOAuth2Info) # noqa: E501 + + Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_o_auth2_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param OAuth2Info body: + :return: OAuth2Info + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_o_auth2_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/oauth2/config', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OAuth2Info', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/ocean_connect_integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/ocean_connect_integration_controller_api.py new file mode 100644 index 0000000..e70406f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/ocean_connect_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OceanConnectIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post10(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post10(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post10_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post10_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post10_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post10_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post10" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post10`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post10`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post10`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put2(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put2(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put2_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put2_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put2_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put2`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put2`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/oceanconnect/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/ota_package_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/ota_package_controller_api.py new file mode 100644 index 0000000..555b529 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/ota_package_controller_api.py @@ -0,0 +1,1010 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OtaPackageControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_ota_package_using_delete(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def delete_ota_package_using_delete_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Delete OTA Package (deleteOtaPackage) # noqa: E501 + + Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_ota_package_using_delete_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_ota_package_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `delete_ota_package_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_ota_package_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def download_ota_package_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Download OTA Package (downloadOtaPackage) # noqa: E501 + + Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_ota_package_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_ota_package_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `download_ota_package_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_group_ota_packages_using_get(self, group_id, type, page_size, page, **kwargs): # noqa: E501 + """Get group OTA Package Infos (getGroupOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant, and by entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_ota_packages_using_get(group_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_group_ota_packages_using_get_with_http_info(group_id, type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_group_ota_packages_using_get_with_http_info(group_id, type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_group_ota_packages_using_get_with_http_info(self, group_id, type, page_size, page, **kwargs): # noqa: E501 + """Get group OTA Package Infos (getGroupOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant, and by entity group. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_group_ota_packages_using_get_with_http_info(group_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['group_id', 'type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_group_ota_packages_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'group_id' is set + if ('group_id' not in params or + params['group_id'] is None): + raise ValueError("Missing the required parameter `group_id` when calling `get_group_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_group_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_group_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_group_ota_packages_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'group_id' in params: + path_params['groupId'] = params['group_id'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages/group/{groupId}/{type}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package (getOtaPackageById) # noqa: E501 + + Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_package_info_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def get_ota_package_info_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 + + Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_package_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/info/{otaPackageId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_ota_packages_using_get1(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_ota_packages_using_get1_with_http_info(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 + """Get OTA Package Infos (getOtaPackages) # noqa: E501 + + Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str type: OTA Package type. (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the ota package title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataOtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_profile_id', 'type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_ota_packages_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_profile_id' is set + if ('device_profile_id' not in params or + params['device_profile_id'] is None): + raise ValueError("Missing the required parameter `device_profile_id` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_profile_id' in params: + path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackages/{deviceProfileId}/{type}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataOtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_data_using_post(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_data_using_post_with_http_info(ota_package_id, **kwargs) # noqa: E501 + return data + + def save_ota_package_data_using_post_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 + """Save OTA Package data (saveOtaPackageData) # noqa: E501 + + Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_data_using_post_with_http_info(ota_package_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str checksum: + :param str checksum_algorithm: + :param str file: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ota_package_id', 'checksum', 'checksum_algorithm', 'file'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ota_package_id' is set + if ('ota_package_id' not in params or + params['ota_package_id'] is None): + raise ValueError("Missing the required parameter `ota_package_id` when calling `save_ota_package_data_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'ota_package_id' in params: + path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + if 'checksum' in params: + form_params.append(('checksum', params['checksum'])) # noqa: E501 + if 'checksum_algorithm' in params: + form_params.append(('checksumAlgorithm', params['checksum_algorithm'])) # noqa: E501 + if 'file' in params: + local_var_files['file'] = params['file'] # noqa: E501 + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json', 'multipart/form-data']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage/{otaPackageId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_ota_package_info_using_post(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_ota_package_info_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 + + Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_ota_package_info_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SaveOtaPackageInfoRequest body: + :return: OtaPackageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_ota_package_info_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/otaPackage', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OtaPackageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/owner_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/owner_controller_api.py new file mode 100644 index 0000000..c775274 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/owner_controller_api.py @@ -0,0 +1,285 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class OwnerControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def change_owner_to_customer_using_post(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to customer (changeOwnerToCustomer) # noqa: E501 + + Tenant/Customer changes Owner to Customer or sub-Customer. Sub-Customer can`t perform this operation! Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_customer_using_post(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_owner_to_customer_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.change_owner_to_customer_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def change_owner_to_customer_using_post_with_http_info(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to customer (changeOwnerToCustomer) # noqa: E501 + + Tenant/Customer changes Owner to Customer or sub-Customer. Sub-Customer can`t perform this operation! Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_customer_using_post_with_http_info(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_id', 'entity_type', 'entity_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_owner_to_customer_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `change_owner_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `change_owner_to_customer_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `change_owner_to_customer_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/owner/CUSTOMER/{ownerId}/{entityType}/{entityId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def change_owner_to_tenant_using_post(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to tenant (changeOwnerToTenant) # noqa: E501 + + Tenant changes Owner from Customer or sub-Customer to Tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_tenant_using_post(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.change_owner_to_tenant_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.change_owner_to_tenant_using_post_with_http_info(owner_id, entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def change_owner_to_tenant_using_post_with_http_info(self, owner_id, entity_type, entity_id, **kwargs): # noqa: E501 + """Change owner to tenant (changeOwnerToTenant) # noqa: E501 + + Tenant changes Owner from Customer or sub-Customer to Tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.change_owner_to_tenant_using_post_with_http_info(owner_id, entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str owner_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param list[str] body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['owner_id', 'entity_type', 'entity_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method change_owner_to_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'owner_id' is set + if ('owner_id' not in params or + params['owner_id'] is None): + raise ValueError("Missing the required parameter `owner_id` when calling `change_owner_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `change_owner_to_tenant_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `change_owner_to_tenant_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'owner_id' in params: + path_params['ownerId'] = params['owner_id'] # noqa: E501 + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/owner/TENANT/{ownerId}/{entityType}/{entityId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/queue_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/queue_controller_api.py new file mode 100644 index 0000000..40831df --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/queue_controller_api.py @@ -0,0 +1,558 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class QueueControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_queue_using_delete(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_queue_using_delete_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def delete_queue_using_delete_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Delete Queue (deleteQueue) # noqa: E501 + + Deletes the Queue. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_queue_using_delete_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_queue_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `delete_queue_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_id_using_get(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_id_using_get_with_http_info(queue_id, **kwargs) # noqa: E501 + return data + + def get_queue_by_id_using_get_with_http_info(self, queue_id, **kwargs): # noqa: E501 + """Get Queue (getQueueById) # noqa: E501 + + Fetch the Queue object based on the provided Queue Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_id_using_get_with_http_info(queue_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_id: A string value representing the queue id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_id' is set + if ('queue_id' not in params or + params['queue_id'] is None): + raise ValueError("Missing the required parameter `queue_id` when calling `get_queue_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_id' in params: + path_params['queueId'] = params['queue_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/{queueId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_queue_by_name_using_get(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + else: + (data) = self.get_queue_by_name_using_get_with_http_info(queue_name, **kwargs) # noqa: E501 + return data + + def get_queue_by_name_using_get_with_http_info(self, queue_name, **kwargs): # noqa: E501 + """Get Queue (getQueueByName) # noqa: E501 + + Fetch the Queue object based on the provided Queue name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_queue_by_name_using_get_with_http_info(queue_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str queue_name: A string value representing the queue id. For example, 'Main' (required) + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['queue_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_queue_by_name_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'queue_name' is set + if ('queue_name' not in params or + params['queue_name'] is None): + raise ValueError("Missing the required parameter `queue_name` when calling `get_queue_by_name_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'queue_name' in params: + path_params['queueName'] = params['queue_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues/name/{queueName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_queues_by_service_type_using_get(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_queues_by_service_type_using_get_with_http_info(self, service_type, page_size, page, **kwargs): # noqa: E501 + """Get Queues (getTenantQueuesByServiceType) # noqa: E501 + + Returns a page of queues registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_queues_by_service_type_using_get_with_http_info(service_type, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the queue name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataQueue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_queues_by_service_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_queues_by_service_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?page,pageSize,serviceType,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataQueue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_queue_using_post(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + else: + (data) = self.save_queue_using_post_with_http_info(service_type, **kwargs) # noqa: E501 + return data + + def save_queue_using_post_with_http_info(self, service_type, **kwargs): # noqa: E501 + """Create Or Update Queue (saveQueue) # noqa: E501 + + Create or update the Queue. When creating queue, platform generates Queue Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Specify existing Queue id to update the queue. Referencing non-existing Queue Id will cause 'Not Found' error. Queue name is unique in the scope of sysadmin. Remove 'id', 'tenantId' from the request body example (below) to create new Queue entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_queue_using_post_with_http_info(service_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str service_type: Service type (implemented only for the TB-RULE-ENGINE) (required) + :param Queue body: + :return: Queue + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['service_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_queue_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'service_type' is set + if ('service_type' not in params or + params['service_type'] is None): + raise ValueError("Missing the required parameter `service_type` when calling `save_queue_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'service_type' in params: + query_params.append(('serviceType', params['service_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/queues{?serviceType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Queue', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/report_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/report_controller_api.py new file mode 100644 index 0000000..268a779 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/report_controller_api.py @@ -0,0 +1,245 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ReportControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def download_dashboard_report_using_post(self, dashboard_id, **kwargs): # noqa: E501 + """downloadDashboardReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_dashboard_report_using_post(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: dashboardId (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_dashboard_report_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + else: + (data) = self.download_dashboard_report_using_post_with_http_info(dashboard_id, **kwargs) # noqa: E501 + return data + + def download_dashboard_report_using_post_with_http_info(self, dashboard_id, **kwargs): # noqa: E501 + """downloadDashboardReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_dashboard_report_using_post_with_http_info(dashboard_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: dashboardId (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_dashboard_report_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `download_dashboard_report_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/report/{dashboardId}/download', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_test_report_using_post(self, **kwargs): # noqa: E501 + """downloadTestReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_test_report_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ReportConfig body: + :param str reports_server_endpoint_url: reportsServerEndpointUrl + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_test_report_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.download_test_report_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def download_test_report_using_post_with_http_info(self, **kwargs): # noqa: E501 + """downloadTestReport # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_test_report_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param ReportConfig body: + :param str reports_server_endpoint_url: reportsServerEndpointUrl + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'reports_server_endpoint_url'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_test_report_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'reports_server_endpoint_url' in params: + query_params.append(('reportsServerEndpointUrl', params['reports_server_endpoint_url'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/report/test{?reportsServerEndpointUrl}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/role_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/role_controller_api.py new file mode 100644 index 0000000..55d402f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/role_controller_api.py @@ -0,0 +1,546 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RoleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_role_using_delete(self, role_id, **kwargs): # noqa: E501 + """Delete role (deleteRole) # noqa: E501 + + Deletes the role. Referencing non-existing role Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_role_using_delete(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_role_using_delete_with_http_info(role_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_role_using_delete_with_http_info(role_id, **kwargs) # noqa: E501 + return data + + def delete_role_using_delete_with_http_info(self, role_id, **kwargs): # noqa: E501 + """Delete role (deleteRole) # noqa: E501 + + Deletes the role. Referencing non-existing role Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_role_using_delete_with_http_info(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['role_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_role_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'role_id' is set + if ('role_id' not in params or + params['role_id'] is None): + raise ValueError("Missing the required parameter `role_id` when calling `delete_role_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'role_id' in params: + path_params['roleId'] = params['role_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/role/{roleId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_role_by_id_using_get(self, role_id, **kwargs): # noqa: E501 + """Get Role by Id (getRoleById) # noqa: E501 + + Fetch the Role object based on the provided Role Id. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_role_by_id_using_get(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_role_by_id_using_get_with_http_info(role_id, **kwargs) # noqa: E501 + else: + (data) = self.get_role_by_id_using_get_with_http_info(role_id, **kwargs) # noqa: E501 + return data + + def get_role_by_id_using_get_with_http_info(self, role_id, **kwargs): # noqa: E501 + """Get Role by Id (getRoleById) # noqa: E501 + + Fetch the Role object based on the provided Role Id. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_role_by_id_using_get_with_http_info(role_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_id: A string value representing the role id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['role_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_role_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'role_id' is set + if ('role_id' not in params or + params['role_id'] is None): + raise ValueError("Missing the required parameter `role_id` when calling `get_role_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'role_id' in params: + path_params['roleId'] = params['role_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/role/{roleId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Role', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_roles_by_ids_using_get(self, role_ids, **kwargs): # noqa: E501 + """Get Roles By Ids (getRolesByIds) # noqa: E501 + + Returns the list of rows based on their ids. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_by_ids_using_get(role_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_ids: A list of role ids, separated by comma ',' (required) + :return: list[Role] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_roles_by_ids_using_get_with_http_info(role_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_roles_by_ids_using_get_with_http_info(role_ids, **kwargs) # noqa: E501 + return data + + def get_roles_by_ids_using_get_with_http_info(self, role_ids, **kwargs): # noqa: E501 + """Get Roles By Ids (getRolesByIds) # noqa: E501 + + Returns the list of rows based on their ids. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_by_ids_using_get_with_http_info(role_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str role_ids: A list of role ids, separated by comma ',' (required) + :return: list[Role] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['role_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_roles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'role_ids' is set + if ('role_ids' not in params or + params['role_ids'] is None): + raise ValueError("Missing the required parameter `role_ids` when calling `get_roles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'role_ids' in params: + query_params.append(('roleIds', params['role_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/roles{?roleIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Role]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_roles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Roles (getRoles) # noqa: E501 + + Returns a page of roles that are available for the current user. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller).You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Type of the role + :param str text_search: The case insensitive 'substring' filter based on the role name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRole + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_roles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_roles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_roles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Roles (getRoles) # noqa: E501 + + Returns a page of roles that are available for the current user. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller).You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_roles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Type of the role + :param str text_search: The case insensitive 'substring' filter based on the role name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRole + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_roles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_roles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_roles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/roles{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRole', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_role_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Role (saveRole) # noqa: E501 + + Creates or Updates the Role. When creating Role, platform generates Role Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Role id will be present in the response. Specify existing Role id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Example of Generic Role with read-only permissions for any resource and all permissions for the 'DEVICE' and 'PROFILE' resources is listed below: ```json { \"name\": \"Read-Only User\", \"type\": \"GENERIC\", \"permissions\": { \"ALL\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"DEVICE\": [ \"ALL\" ] \"PROFILE\": [ \"ALL\" ] }, \"additionalInfo\": { \"description\": \"Read-only permissions for everything, Write permissions for devices and own profile.\" } } ``` Example of Group Role with read-only permissions. Note that the group role has no association with the resources. The type of the resource is taken from the entity group that this role is assigned to: ```json { \"name\": \"Entity Group Read-only User\", \"type\": \"GROUP\", \"permissions\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"additionalInfo\": { \"description\": \"Read-only permissions.\" } } ``` Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_role_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Role body: + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_role_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_role_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_role_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Role (saveRole) # noqa: E501 + + Creates or Updates the Role. When creating Role, platform generates Role Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Role id will be present in the response. Specify existing Role id to update the permission. Referencing non-existing Group Permission Id will cause 'Not Found' error. Role Contains a set of permissions. Role has two types. Generic Role may be assigned to the user group and will provide permissions for all entities of a certain type. Group Role may be assigned to both user and entity group and will provides permissions only for the entities that belong to specified entity group. The assignment of the Role to the User Group is done using [Group Permission Controller](/swagger-ui.html#/group-permission-controller). Example of Generic Role with read-only permissions for any resource and all permissions for the 'DEVICE' and 'PROFILE' resources is listed below: ```json { \"name\": \"Read-Only User\", \"type\": \"GENERIC\", \"permissions\": { \"ALL\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"DEVICE\": [ \"ALL\" ] \"PROFILE\": [ \"ALL\" ] }, \"additionalInfo\": { \"description\": \"Read-only permissions for everything, Write permissions for devices and own profile.\" } } ``` Example of Group Role with read-only permissions. Note that the group role has no association with the resources. The type of the resource is taken from the entity group that this role is assigned to: ```json { \"name\": \"Entity Group Read-only User\", \"type\": \"GROUP\", \"permissions\": [ \"READ\", \"RPC_CALL\", \"READ_CREDENTIALS\", \"READ_ATTRIBUTES\", \"READ_TELEMETRY\" ], \"additionalInfo\": { \"description\": \"Read-only permissions.\" } } ``` Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_role_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Role body: + :return: Role + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_role_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/role', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Role', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_controller_api.py new file mode 100644 index 0000000..c976b0b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_controller_api.py @@ -0,0 +1,257 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_one_way_device_rpc_request_using_post(self, body, device_id, **kwargs): # noqa: E501 + """handleOneWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post_with_http_info(self, body, device_id, **kwargs): # noqa: E501 + """handleOneWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post_with_http_info(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post(self, body, device_id, **kwargs): # noqa: E501 + """handleTwoWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post_with_http_info(body, device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post_with_http_info(self, body, device_id, **kwargs): # noqa: E501 + """handleTwoWayDeviceRPCRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post_with_http_info(body, device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: requestBody (required) + :param str device_id: deviceId (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'device_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_v_1_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_v_1_controller_api.py new file mode 100644 index 0000000..0f5c352 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_v_1_controller_api.py @@ -0,0 +1,253 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV1ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_one_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request (handleOneWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request (handleTwoWayDeviceRPCRequest) # noqa: E501 + + Deprecated. See 'Rpc V 2 Controller' instead. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_v_2_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_v_2_controller_api.py new file mode 100644 index 0000000..481f70f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/rpc_v_2_controller_api.py @@ -0,0 +1,570 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RpcV2ControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_rpc_using_delete(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rpc_using_delete_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def delete_rpc_using_delete_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Delete persistent RPC # noqa: E501 + + Deletes the persistent RPC request. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rpc_using_delete_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rpc_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `delete_rpc_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_by_device_using_get(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_by_device_using_get_with_http_info(self, device_id, page_size, page, **kwargs): # noqa: E501 + """Get persistent RPC requests # noqa: E501 + + Allows to query RPC calls for specific device using pagination. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_by_device_using_get_with_http_info(device_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str rpc_status: Status of the RPC + :param str text_search: Not implemented. Leave empty. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'page_size', 'page', 'rpc_status', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_by_device_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_persisted_rpc_by_device_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'rpc_status' in params: + query_params.append(('rpcStatus', params['rpc_status'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/device/{deviceId}{?page,pageSize,rpcStatus,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_persisted_rpc_using_get(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + else: + (data) = self.get_persisted_rpc_using_get_with_http_info(rpc_id, **kwargs) # noqa: E501 + return data + + def get_persisted_rpc_using_get_with_http_info(self, rpc_id, **kwargs): # noqa: E501 + """Get persistent RPC request # noqa: E501 + + Get information about the status of the RPC call. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_persisted_rpc_using_get_with_http_info(rpc_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rpc_id: A string value representing the rpc id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Rpc + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rpc_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_persisted_rpc_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rpc_id' is set + if ('rpc_id' not in params or + params['rpc_id'] is None): + raise ValueError("Missing the required parameter `rpc_id` when calling `get_persisted_rpc_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rpc_id' in params: + path_params['rpcId'] = params['rpc_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/persistent/{rpcId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Rpc', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_one_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_one_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send one-way RPC request # noqa: E501 + + Sends the one-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is either 200 OK if the message was sent to device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_one_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_one_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_one_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/oneway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_two_way_device_rpc_request_using_post1(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, **kwargs) # noqa: E501 + return data + + def handle_two_way_device_rpc_request_using_post1_with_http_info(self, device_id, **kwargs): # noqa: E501 + """Send two-way RPC request # noqa: E501 + + Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below. ```json { \"method\": \"setGpio\", \"params\": { \"pin\": 7, \"value\": 1 }, \"persistent\": false, \"timeout\": 5000 } ``` ### Server-side RPC structure The body of server-side RPC request consists of multiple fields: * **method** - mandatory, name of the method to distinct the RPC calls. For example, \"getCurrentTime\" or \"getWeatherForecast\". The value of the parameter is a string. * **params** - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON \"{}\" if no parameters needed. * **timeout** - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds). * **expirationTime** - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides **timeout** if present. * **persistent** - optional, indicates persistent RPC. The default value is \"false\". * **retries** - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side. * **additionalInfo** - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events. ### RPC Result In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_two_way_device_rpc_request_using_post1_with_http_info(device_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_two_way_device_rpc_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `handle_two_way_device_rpc_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rpc/twoway/{deviceId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/rule_chain_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/rule_chain_controller_api.py new file mode 100644 index 0000000..51c7ab7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/rule_chain_controller_api.py @@ -0,0 +1,2201 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RuleChainControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_rule_chain_to_edge_using_post(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def assign_rule_chain_to_edge_using_post_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Assign rule chain to edge (assignRuleChainToEdge) # noqa: E501 + + Creates assignment of an existing rule chain to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once rule chain will be delivered to edge service, it's going to start processing messages locally. Only rule chain with type 'EDGE' can be assigned to edge. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_rule_chain_to_edge_using_post_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_rule_chain_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `assign_rule_chain_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def delete_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Delete rule chain (deleteRuleChain) # noqa: E501 + + Deletes the rule chain. Referencing non-existing rule chain Id will cause an error. Referencing rule chain that is used in the device profiles will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `delete_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def export_rule_chains_using_get(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + else: + (data) = self.export_rule_chains_using_get_with_http_info(limit, **kwargs) # noqa: E501 + return data + + def export_rule_chains_using_get_with_http_info(self, limit, **kwargs): # noqa: E501 + """Export Rule Chains # noqa: E501 + + Exports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.export_rule_chains_using_get_with_http_info(limit, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int limit: A limit of rule chains to export. (required) + :return: RuleChainData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['limit'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method export_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'limit' is set + if ('limit' not in params or + params['limit'] is None): + raise ValueError("Missing the required parameter `limit` when calling `export_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/export{?limit}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_auto_assign_to_edge_rule_chains_using_get(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_auto_assign_to_edge_rule_chains_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Auto Assign To Edge Rule Chains (getAutoAssignToEdgeRuleChains) # noqa: E501 + + Returns a list of Rule Chains that will be assigned to a newly created edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_auto_assign_to_edge_rule_chains_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[RuleChain] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_auto_assign_to_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/autoAssignToEdgeRuleChains', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChain]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_rule_chains_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_rule_chains_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Rule Chains (getEdgeRuleChains) # noqa: E501 + + Returns a page of Rule Chains assigned to the specified edge. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_rule_chains_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_rule_node_debug_input_using_get(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, **kwargs) # noqa: E501 + return data + + def get_latest_rule_node_debug_input_using_get_with_http_info(self, rule_node_id, **kwargs): # noqa: E501 + """Get latest input message (getLatestRuleNodeDebugInput) # noqa: E501 + + Gets the input message from the debug events for specified Rule Chain Id. Referencing non-existing rule chain Id will cause an error. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_rule_node_debug_input_using_get_with_http_info(rule_node_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_node_id: A string value representing the rule node id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_node_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_rule_node_debug_input_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_node_id' is set + if ('rule_node_id' not in params or + params['rule_node_id'] is None): + raise ValueError("Missing the required parameter `rule_node_id` when calling `get_latest_rule_node_debug_input_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_node_id' in params: + path_params['ruleNodeId'] = params['rule_node_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleNode/{ruleNodeId}/debugIn', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_by_id_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_by_id_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain object based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_by_id_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_meta_data_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_meta_data_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain (getRuleChainById) # noqa: E501 + + Fetch the Rule Chain Metadata object based on the provided Rule Chain Id. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_meta_data_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_meta_data_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_meta_data_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/metadata', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_usage_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_usage_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get output labels usage (getRuleChainOutputLabelsUsage) # noqa: E501 + + Fetch the list of rule chains and the relation types (labels) they use to process output of the current rule chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_usage_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[RuleChainOutputLabelsUsage] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_usage_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_usage_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainOutputLabelsUsage]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chain_output_labels_using_get(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def get_rule_chain_output_labels_using_get_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Get Rule Chain output labels (getRuleChainOutputLabels) # noqa: E501 + + Fetch the unique labels for the \"output\" Rule Nodes that belong to the Rule Chain based on the provided Rule Chain Id. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chain_output_labels_using_get_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chain_output_labels_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `get_rule_chain_output_labels_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/output/labels', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_rule_chains_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_rule_chains_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_rule_chains_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Rule Chains (getRuleChains) # noqa: E501 + + Returns a page of Rule Chains owned by tenant. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_rule_chains_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str type: Rule chain type (CORE or EDGE) + :param str text_search: The case insensitive 'substring' filter based on the rule chain name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataRuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'type', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_rule_chains_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_rule_chains_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_rule_chains_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains{?page,pageSize,sortOrder,sortProperty,textSearch,type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataRuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def import_rule_chains_using_post(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.import_rule_chains_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def import_rule_chains_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Import Rule Chains # noqa: E501 + + Imports all tenant rule chains as one JSON. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.import_rule_chains_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainData body: + :param bool overwrite: Enables overwrite for existing rule chains with the same name. + :return: list[RuleChainImportResult] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'overwrite'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method import_rule_chains_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'overwrite' in params: + query_params.append(('overwrite', params['overwrite'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChains/import{?overwrite}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[RuleChainImportResult]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_tbel_enabled_using_get(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_tbel_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_tbel_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Is TBEL script executor enabled # noqa: E501 + + Returns 'True' if the TBEL script execution is enabled Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_tbel_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_tbel_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/tbelEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_meta_data_using_post(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_meta_data_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_meta_data_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Update Rule Chain Metadata # noqa: E501 + + Updates the rule chain metadata. The metadata object contains information about the rule nodes and their connections. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_meta_data_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChainMetaData body: + :param bool update_related: Update related rule nodes. + :return: RuleChainMetaData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'update_related'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_meta_data_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'update_related' in params: + query_params.append(('updateRelated', params['update_related'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/metadata{?updateRelated}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChainMetaData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Default Rule Chain # noqa: E501 + + Create rule chain from template, based on the specified name in the request. Creates the rule chain based on the template that is used to create root rule chain. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param DefaultRuleChainCreateRequest body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/device/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_rule_chain_using_post1(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_rule_chain_using_post1_with_http_info(**kwargs) # noqa: E501 + return data + + def save_rule_chain_using_post1_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Rule Chain (saveRuleChain) # noqa: E501 + + Create or update the Rule Chain. When creating Rule Chain, platform generates Rule Chain Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Rule Chain Id will be present in the response. Specify existing Rule Chain id to update the rule chain. Referencing non-existing rule chain Id will cause 'Not Found' error. The rule chain object is lightweight and contains general information about the rule chain. List of rule nodes and their connection is stored in a separate 'metadata' object.Remove 'id', 'tenantId' from the request body example (below) to create new Rule Chain entity. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_rule_chain_using_post1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param RuleChain body: + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_rule_chain_using_post1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_auto_assign_to_edge_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_auto_assign_to_edge_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Auto Assign To Edge Rule Chain (setAutoAssignToEdgeRuleChain) # noqa: E501 + + Makes the rule chain to be automatically assigned for any new edge that will be created. Does not assign this rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_auto_assign_to_edge_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_auto_assign_to_edge_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_auto_assign_to_edge_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_edge_template_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_edge_template_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Edge Template Root Rule Chain (setEdgeTemplateRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain for any new edge that will be created. Does not update root rule chain for already created edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_edge_template_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_edge_template_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_edge_template_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/edgeTemplateRoot', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_root_rule_chain_using_post(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.set_root_rule_chain_using_post_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def set_root_rule_chain_using_post_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Set Root Rule Chain (setRootRuleChain) # noqa: E501 + + Makes the rule chain to be root rule chain. Updates previous root rule chain as well. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_root_rule_chain_using_post_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_root_rule_chain_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `set_root_rule_chain_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/root', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def test_script_using_post(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.test_script_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def test_script_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Test Script function # noqa: E501 + + Execute the Script function and return the result. The format of request: ```json { \"script\": \"Your Function as String\", \"scriptType\": \"One of: update, generate, filter, switch, json, string\", \"argNames\": [\"msg\", \"metadata\", \"type\"], \"msg\": \"{\\\"temperature\\\": 42}\", \"metadata\": { \"deviceName\": \"Device A\", \"deviceType\": \"Thermometer\" }, \"msgType\": \"POST_TELEMETRY_REQUEST\" } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.test_script_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :param str script_lang: Script language: JS or TBEL + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'script_lang'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_script_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'script_lang' in params: + query_params.append(('scriptLang', params['script_lang'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/testScript{?scriptLang}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_rule_chain_from_edge_using_delete(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, **kwargs) # noqa: E501 + return data + + def unassign_rule_chain_from_edge_using_delete_with_http_info(self, edge_id, rule_chain_id, **kwargs): # noqa: E501 + """Unassign rule chain from edge (unassignRuleChainFromEdge) # noqa: E501 + + Clears assignment of the rule chain to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove rule chain (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove rule chain locally. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_rule_chain_from_edge_using_delete_with_http_info(edge_id, rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: edgeId (required) + :param str rule_chain_id: ruleChainId (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_rule_chain_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unassign_rule_chain_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/ruleChain/{ruleChainId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unset_auto_assign_to_edge_rule_chain_using_delete(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + else: + (data) = self.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, **kwargs) # noqa: E501 + return data + + def unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(self, rule_chain_id, **kwargs): # noqa: E501 + """Unset Auto Assign To Edge Rule Chain (unsetAutoAssignToEdgeRuleChain) # noqa: E501 + + Removes the rule chain from the list of rule chains that are going to be automatically assigned for any new edge that will be created. Does not unassign this rule chain for already assigned edges. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unset_auto_assign_to_edge_rule_chain_using_delete_with_http_info(rule_chain_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str rule_chain_id: A string value representing the rule chain id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: RuleChain + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['rule_chain_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unset_auto_assign_to_edge_rule_chain_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'rule_chain_id' is set + if ('rule_chain_id' not in params or + params['rule_chain_id'] is None): + raise ValueError("Missing the required parameter `rule_chain_id` when calling `unset_auto_assign_to_edge_rule_chain_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'rule_chain_id' in params: + path_params['ruleChainId'] = params['rule_chain_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/ruleChain/{ruleChainId}/autoAssignToEdge', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='RuleChain', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/rule_engine_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/rule_engine_controller_api.py new file mode 100644 index 0000000..6b374cd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/rule_engine_controller_api.py @@ -0,0 +1,499 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class RuleEngineControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def handle_rule_engine_request_using_post(self, entity_type, entity_id, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post(entity_type, entity_id, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post_with_http_info(entity_type, entity_id, timeout, **kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post_with_http_info(entity_type, entity_id, timeout, **kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post_with_http_info(self, entity_type, entity_id, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post_with_http_info(entity_type, entity_id, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'timeout', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `handle_rule_engine_request_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `handle_rule_engine_request_using_post`") # noqa: E501 + # verify the required parameter 'timeout' is set + if ('timeout' not in params or + params['timeout'] is None): + raise ValueError("Missing the required parameter `timeout` when calling `handle_rule_engine_request_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'timeout' in params: + path_params['timeout'] = params['timeout'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/{entityType}/{entityId}/{timeout}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_rule_engine_request_using_post1(self, entity_type, entity_id, queue_name, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout and specified queue to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. If request sent for Device/Device Profile or Asset/Asset Profile entity, specified queue will be used instead of the queue selected in the device or asset profile. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post1(entity_type, entity_id, queue_name, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str queue_name: Queue name to process the request in the rule engine (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post1_with_http_info(entity_type, entity_id, queue_name, timeout, **kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post1_with_http_info(entity_type, entity_id, queue_name, timeout, **kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post1_with_http_info(self, entity_type, entity_id, queue_name, timeout, **kwargs): # noqa: E501 + """Push entity message with timeout and specified queue to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. If request sent for Device/Device Profile or Asset/Asset Profile entity, specified queue will be used instead of the queue selected in the device or asset profile. The platform expects the timeout value in milliseconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post1_with_http_info(entity_type, entity_id, queue_name, timeout, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str queue_name: Queue name to process the request in the rule engine (required) + :param int timeout: Timeout to process the request in milliseconds (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'queue_name', 'timeout', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + # verify the required parameter 'queue_name' is set + if ('queue_name' not in params or + params['queue_name'] is None): + raise ValueError("Missing the required parameter `queue_name` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + # verify the required parameter 'timeout' is set + if ('timeout' not in params or + params['timeout'] is None): + raise ValueError("Missing the required parameter `timeout` when calling `handle_rule_engine_request_using_post1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'queue_name' in params: + path_params['queueName'] = params['queue_name'] # noqa: E501 + if 'timeout' in params: + path_params['timeout'] = params['timeout'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/{entityType}/{entityId}/{queueName}/{timeout}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_rule_engine_request_using_post2(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Push entity message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post2(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post2_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post2_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post2_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Push entity message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses specified Entity Id as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post2_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post2" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `handle_rule_engine_request_using_post2`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `handle_rule_engine_request_using_post2`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/{entityType}/{entityId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def handle_rule_engine_request_using_post3(self, **kwargs): # noqa: E501 + """Push user message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses current User Id ( the one which credentials is used to perform the request) as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post3(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.handle_rule_engine_request_using_post3_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.handle_rule_engine_request_using_post3_with_http_info(**kwargs) # noqa: E501 + return data + + def handle_rule_engine_request_using_post3_with_http_info(self, **kwargs): # noqa: E501 + """Push user message to the rule engine (handleRuleEngineRequest) # noqa: E501 + + Creates the Message with type 'REST_API_REQUEST' and payload taken from the request body. Uses current User Id ( the one which credentials is used to perform the request) as the Rule Engine message originator. This method allows you to extend the regular platform API with the power of Rule Engine. You may use default and custom rule nodes to handle the message. The generated message contains two important metadata fields: * **'serviceId'** to identify the platform server that received the request; * **'requestUUID'** to identify the request and route possible response from the Rule Engine; Use **'rest call reply'** rule node to push the reply from rule engine back as a REST API call response. The default timeout of the request processing is 10 seconds. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.handle_rule_engine_request_using_post3_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method handle_rule_engine_request_using_post3" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/rule-engine/', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/scheduler_event_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/scheduler_event_controller_api.py new file mode 100644 index 0000000..5beeedb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/scheduler_event_controller_api.py @@ -0,0 +1,1037 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SchedulerEventControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def assign_scheduler_event_to_edge_using_post(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Assign scheduler event to edge (assignSchedulerEventToEdge) # noqa: E501 + + Creates assignment of an existing scheduler event to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment scheduler event (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once scheduler event will be delivered to edge service, it is going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_scheduler_event_to_edge_using_post(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.assign_scheduler_event_to_edge_using_post_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.assign_scheduler_event_to_edge_using_post_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + return data + + def assign_scheduler_event_to_edge_using_post_with_http_info(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Assign scheduler event to edge (assignSchedulerEventToEdge) # noqa: E501 + + Creates assignment of an existing scheduler event to an instance of The Edge. Assignment works in async way - first, notification event pushed to edge service queue on platform. Second, remote edge service will receive a copy of assignment scheduler event (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once scheduler event will be delivered to edge service, it is going to be available for usage on remote edge instance. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.assign_scheduler_event_to_edge_using_post_with_http_info(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method assign_scheduler_event_to_edge_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `assign_scheduler_event_to_edge_using_post`") # noqa: E501 + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `assign_scheduler_event_to_edge_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/schedulerEvent/{schedulerEventId}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_scheduler_event_using_delete(self, scheduler_event_id, **kwargs): # noqa: E501 + """Delete Scheduler Event (deleteSchedulerEvent) # noqa: E501 + + Deletes the scheduler event. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_scheduler_event_using_delete(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_scheduler_event_using_delete_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_scheduler_event_using_delete_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + return data + + def delete_scheduler_event_using_delete_with_http_info(self, scheduler_event_id, **kwargs): # noqa: E501 + """Delete Scheduler Event (deleteSchedulerEvent) # noqa: E501 + + Deletes the scheduler event. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_scheduler_event_using_delete_with_http_info(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_scheduler_event_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `delete_scheduler_event_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent/{schedulerEventId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_scheduler_events_using_get(self, edge_id, **kwargs): # noqa: E501 + """Get All Edge Scheduler Events (getAllSchedulerEvents) # noqa: E501 + + Fetch the list of Scheduler Event Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_scheduler_events_using_get(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_scheduler_events_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + else: + (data) = self.get_all_scheduler_events_using_get_with_http_info(edge_id, **kwargs) # noqa: E501 + return data + + def get_all_scheduler_events_using_get_with_http_info(self, edge_id, **kwargs): # noqa: E501 + """Get All Edge Scheduler Events (getAllSchedulerEvents) # noqa: E501 + + Fetch the list of Scheduler Event Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_scheduler_events_using_get_with_http_info(edge_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_scheduler_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_all_scheduler_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/allSchedulerEvents', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SchedulerEventInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_edge_scheduler_events_using_get(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Scheduler Events (getEdgeSchedulerEvents) # noqa: E501 + + Returns a page of Scheduler Events Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_scheduler_events_using_get(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the scheduler event name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataSchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_edge_scheduler_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_edge_scheduler_events_using_get_with_http_info(edge_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_edge_scheduler_events_using_get_with_http_info(self, edge_id, page_size, page, **kwargs): # noqa: E501 + """Get Edge Scheduler Events (getEdgeSchedulerEvents) # noqa: E501 + + Returns a page of Scheduler Events Info objects based on the provided Edge entity. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_edge_scheduler_events_using_get_with_http_info(edge_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'startsWith' filter based on the scheduler event name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataSchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_edge_scheduler_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `get_edge_scheduler_events_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_edge_scheduler_events_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_edge_scheduler_events_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/schedulerEvents{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataSchedulerEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_event_by_id_using_get(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event (getSchedulerEventById) # noqa: E501 + + Fetch the SchedulerEvent object based on the provided scheduler event Id. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_by_id_using_get(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_event_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_event_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + return data + + def get_scheduler_event_by_id_using_get_with_http_info(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event (getSchedulerEventById) # noqa: E501 + + Fetch the SchedulerEvent object based on the provided scheduler event Id. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_by_id_using_get_with_http_info(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_event_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `get_scheduler_event_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent/{schedulerEventId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_event_info_by_id_using_get(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event With Customer Info (getSchedulerEventInfoById) # noqa: E501 + + Fetch the SchedulerEventWithCustomerInfo object based on the provided scheduler event Id. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_info_by_id_using_get(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_event_info_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_event_info_by_id_using_get_with_http_info(scheduler_event_id, **kwargs) # noqa: E501 + return data + + def get_scheduler_event_info_by_id_using_get_with_http_info(self, scheduler_event_id, **kwargs): # noqa: E501 + """Get Scheduler Event With Customer Info (getSchedulerEventInfoById) # noqa: E501 + + Fetch the SchedulerEventWithCustomerInfo object based on the provided scheduler event Id. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Referencing non-existing Scheduler Event Id will cause 'Not Found' error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_event_info_by_id_using_get_with_http_info(scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventWithCustomerInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_event_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `get_scheduler_event_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent/info/{schedulerEventId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEventWithCustomerInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_events_by_ids_using_get(self, scheduler_event_ids, **kwargs): # noqa: E501 + """Get Scheduler Events By Ids (getSchedulerEventsByIds) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_by_ids_using_get(scheduler_event_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_ids: A list of scheduler event ids, separated by comma ',' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_events_by_ids_using_get_with_http_info(scheduler_event_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_events_by_ids_using_get_with_http_info(scheduler_event_ids, **kwargs) # noqa: E501 + return data + + def get_scheduler_events_by_ids_using_get_with_http_info(self, scheduler_event_ids, **kwargs): # noqa: E501 + """Get Scheduler Events By Ids (getSchedulerEventsByIds) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Events allows you to schedule various types of events with flexible schedule configuration. Scheduler fires configured scheduler events according to their schedule. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_by_ids_using_get_with_http_info(scheduler_event_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str scheduler_event_ids: A list of scheduler event ids, separated by comma ',' (required) + :return: list[SchedulerEventInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['scheduler_event_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_events_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'scheduler_event_ids' is set + if ('scheduler_event_ids' not in params or + params['scheduler_event_ids'] is None): + raise ValueError("Missing the required parameter `scheduler_event_ids` when calling `get_scheduler_events_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'scheduler_event_ids' in params: + query_params.append(('schedulerEventIds', params['scheduler_event_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvents{?schedulerEventIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SchedulerEventInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_scheduler_events_using_get(self, **kwargs): # noqa: E501 + """Get Scheduler Events By Type (getSchedulerEvents) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: A string value representing the scheduler type. For example, 'generateReport' + :return: list[SchedulerEventWithCustomerInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_scheduler_events_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_scheduler_events_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_scheduler_events_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Scheduler Events By Type (getSchedulerEvents) # noqa: E501 + + Requested scheduler events must be owned by tenant or assigned to customer which user is performing the request. Scheduler Event With Customer Info extends Scheduler Event Info object and adds 'customerTitle' - a String value representing the title of the customer which user created a Scheduler Event and 'customerIsPublic' - a boolean parameter that specifies if customer is public. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_scheduler_events_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: A string value representing the scheduler type. For example, 'generateReport' + :return: list[SchedulerEventWithCustomerInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_scheduler_events_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'type' in params: + query_params.append(('type', params['type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvents{?type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[SchedulerEventWithCustomerInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_scheduler_event_using_post(self, **kwargs): # noqa: E501 + """Save Scheduler Event (saveSchedulerEvent) # noqa: E501 + + Creates or Updates scheduler event. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. When creating scheduler event, platform generates scheduler event Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created scheduler event id will be present in the response. Specify existing scheduler event id to update the scheduler event. Referencing non-existing scheduler event Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Scheduler Event entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_scheduler_event_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SchedulerEvent body: + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_scheduler_event_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_scheduler_event_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_scheduler_event_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save Scheduler Event (saveSchedulerEvent) # noqa: E501 + + Creates or Updates scheduler event. Scheduler Event extends Scheduler Event Info object and adds 'configuration' - a JSON structure of scheduler event configuration. See the 'Model' tab of the Response Class for more details. When creating scheduler event, platform generates scheduler event Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created scheduler event id will be present in the response. Specify existing scheduler event id to update the scheduler event. Referencing non-existing scheduler event Id will cause 'Not Found' error. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new Scheduler Event entity. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_scheduler_event_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SchedulerEvent body: + :return: SchedulerEvent + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_scheduler_event_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/schedulerEvent', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEvent', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def unassign_scheduler_event_from_edge_using_delete(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Unassign scheduler event from edge (unassignSchedulerEventFromEdge) # noqa: E501 + + Clears assignment of the scheduler event to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_scheduler_event_from_edge_using_delete(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.unassign_scheduler_event_from_edge_using_delete_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + else: + (data) = self.unassign_scheduler_event_from_edge_using_delete_with_http_info(edge_id, scheduler_event_id, **kwargs) # noqa: E501 + return data + + def unassign_scheduler_event_from_edge_using_delete_with_http_info(self, edge_id, scheduler_event_id, **kwargs): # noqa: E501 + """Unassign scheduler event from edge (unassignSchedulerEventFromEdge) # noqa: E501 + + Clears assignment of the scheduler event to the edge. Unassignment works in async way - first, 'unassign' notification event pushed to edge queue on platform. Second, remote edge service will receive an 'unassign' command to remove entity group (Edge will receive this instantly, if it's currently connected, or once it's going to be connected to platform). Third, once 'unassign' command will be delivered to edge service, it's going to remove entity group and entities inside this group locally. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.unassign_scheduler_event_from_edge_using_delete_with_http_info(edge_id, scheduler_event_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str edge_id: A string value representing the edge id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scheduler_event_id: A string value representing the scheduler id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SchedulerEventInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['edge_id', 'scheduler_event_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method unassign_scheduler_event_from_edge_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'edge_id' is set + if ('edge_id' not in params or + params['edge_id'] is None): + raise ValueError("Missing the required parameter `edge_id` when calling `unassign_scheduler_event_from_edge_using_delete`") # noqa: E501 + # verify the required parameter 'scheduler_event_id' is set + if ('scheduler_event_id' not in params or + params['scheduler_event_id'] is None): + raise ValueError("Missing the required parameter `scheduler_event_id` when calling `unassign_scheduler_event_from_edge_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'edge_id' in params: + path_params['edgeId'] = params['edge_id'] # noqa: E501 + if 'scheduler_event_id' in params: + path_params['schedulerEventId'] = params['scheduler_event_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/edge/{edgeId}/schedulerEvent/{schedulerEventId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SchedulerEventInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/self_registration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/self_registration_controller_api.py new file mode 100644 index 0000000..8d1f697 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/self_registration_controller_api.py @@ -0,0 +1,587 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SelfRegistrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_self_registration_params_using_delete(self, domain_name, **kwargs): # noqa: E501 + """deleteSelfRegistrationParams # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_self_registration_params_using_delete(domain_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str domain_name: domainName (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_self_registration_params_using_delete_with_http_info(domain_name, **kwargs) # noqa: E501 + else: + (data) = self.delete_self_registration_params_using_delete_with_http_info(domain_name, **kwargs) # noqa: E501 + return data + + def delete_self_registration_params_using_delete_with_http_info(self, domain_name, **kwargs): # noqa: E501 + """deleteSelfRegistrationParams # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_self_registration_params_using_delete_with_http_info(domain_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str domain_name: domainName (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['domain_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_self_registration_params_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'domain_name' is set + if ('domain_name' not in params or + params['domain_name'] is None): + raise ValueError("Missing the required parameter `domain_name` when calling `delete_self_registration_params_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'domain_name' in params: + path_params['domainName'] = params['domain_name'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/selfRegistration/selfRegistrationParams/{domainName}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_privacy_policy_using_get(self, **kwargs): # noqa: E501 + """Get Privacy Policy for Self Registration form (getPrivacyPolicy) # noqa: E501 + + Fetch the Privacy Policy based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_privacy_policy_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_privacy_policy_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_privacy_policy_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_privacy_policy_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Privacy Policy for Self Registration form (getPrivacyPolicy) # noqa: E501 + + Fetch the Privacy Policy based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_privacy_policy_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_privacy_policy_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/selfRegistration/privacyPolicy', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_self_registration_params_using_get(self, **kwargs): # noqa: E501 + """Get Self Registration parameters (getSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters object for the tenant of the current user. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_self_registration_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_self_registration_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Self Registration parameters (getSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters object for the tenant of the current user. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_self_registration_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_self_registration_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/selfRegistration/selfRegistrationParams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SelfRegistrationParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_sign_up_self_registration_params_using_get(self, **kwargs): # noqa: E501 + """Get Self Registration form parameters without authentication (getSignUpSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters based on the domain name from the request. Available for non-authorized users. Contains the information to customize the sign-up form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sign_up_self_registration_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: pkgName + :return: SignUpSelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_sign_up_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_sign_up_self_registration_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_sign_up_self_registration_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Self Registration form parameters without authentication (getSignUpSelfRegistrationParams) # noqa: E501 + + Fetch the Self Registration parameters based on the domain name from the request. Available for non-authorized users. Contains the information to customize the sign-up form. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_sign_up_self_registration_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: pkgName + :return: SignUpSelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_sign_up_self_registration_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/selfRegistration/signUpSelfRegistrationParams{?pkgName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SignUpSelfRegistrationParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_terms_of_use_using_get(self, **kwargs): # noqa: E501 + """Get Terms of Use for Self Registration form (getTermsOfUse) # noqa: E501 + + Fetch the Terms of Use based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_terms_of_use_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_terms_of_use_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_terms_of_use_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_terms_of_use_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Terms of Use for Self Registration form (getTermsOfUse) # noqa: E501 + + Fetch the Terms of Use based on the domain name from the request. Available for non-authorized users. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_terms_of_use_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_terms_of_use_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/selfRegistration/termsOfUse', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_self_registration_params_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Self Registration parameters (saveSelfRegistrationParams) # noqa: E501 + + Creates or Updates the Self Registration parameters. When creating, platform generates Admin Settings Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Admin Settings Id will be present in the response. Specify existing Admin Settings Id to update the Self Registration parameters. Referencing non-existing Admin Settings Id will cause 'Not Found' error. Self Registration allows users to signup for using the platform and automatically create a Customer account for them. You may configure default dashboard and user roles that will be assigned for this Customer. This allows you to build out-of-the-box solutions for customers. Ability to white-label the login and main pages helps to brand the platform. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_self_registration_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SelfRegistrationParams body: + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_self_registration_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_self_registration_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_self_registration_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Self Registration parameters (saveSelfRegistrationParams) # noqa: E501 + + Creates or Updates the Self Registration parameters. When creating, platform generates Admin Settings Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Admin Settings Id will be present in the response. Specify existing Admin Settings Id to update the Self Registration parameters. Referencing non-existing Admin Settings Id will cause 'Not Found' error. Self Registration allows users to signup for using the platform and automatically create a Customer account for them. You may configure default dashboard and user roles that will be assigned for this Customer. This allows you to build out-of-the-box solutions for customers. Ability to white-label the login and main pages helps to brand the platform. Available for users with 'TENANT_ADMIN' authority. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_self_registration_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SelfRegistrationParams body: + :return: SelfRegistrationParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_self_registration_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/selfRegistration/selfRegistrationParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SelfRegistrationParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/sig_fox_integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/sig_fox_integration_controller_api.py new file mode 100644 index 0000000..70e41df --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/sig_fox_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SigFoxIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post11(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post11(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post11_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post11_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post11_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post11_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post11" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post11`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post11`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post11`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put3(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put3(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put3_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put3_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put3_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put3" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put3`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put3`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put3`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/sigfox/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/sign_up_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/sign_up_controller_api.py new file mode 100644 index 0000000..4b58910 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/sign_up_controller_api.py @@ -0,0 +1,882 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SignUpControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def accept_privacy_policy_using_post(self, **kwargs): # noqa: E501 + """Accept privacy policy (acceptPrivacyPolicy) # noqa: E501 + + Accept privacy policy by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_privacy_policy_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.accept_privacy_policy_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.accept_privacy_policy_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def accept_privacy_policy_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Accept privacy policy (acceptPrivacyPolicy) # noqa: E501 + + Accept privacy policy by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_privacy_policy_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method accept_privacy_policy_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/acceptPrivacyPolicy', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def accept_terms_of_use_using_post(self, **kwargs): # noqa: E501 + """Accept Terms of Use (acceptTermsOfUse) # noqa: E501 + + Accept Terms of Use by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_terms_of_use_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.accept_terms_of_use_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.accept_terms_of_use_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def accept_terms_of_use_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Accept Terms of Use (acceptTermsOfUse) # noqa: E501 + + Accept Terms of Use by the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.accept_terms_of_use_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method accept_terms_of_use_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/acceptTermsOfUse', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def activate_email_using_get(self, email_code, **kwargs): # noqa: E501 + """Activate User using code from Email (activateEmail) # noqa: E501 + + Activate the user using code(link) from the activation email. Validates the code an redirects according to the signup flow. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_email_using_get(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_email_using_get_with_http_info(email_code, **kwargs) # noqa: E501 + else: + (data) = self.activate_email_using_get_with_http_info(email_code, **kwargs) # noqa: E501 + return data + + def activate_email_using_get_with_http_info(self, email_code, **kwargs): # noqa: E501 + """Activate User using code from Email (activateEmail) # noqa: E501 + + Activate the user using code(link) from the activation email. Validates the code an redirects according to the signup flow. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_email_using_get_with_http_info(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email_code', 'pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_email_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email_code' is set + if ('email_code' not in params or + params['email_code'] is None): + raise ValueError("Missing the required parameter `email_code` when calling `activate_email_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email_code' in params: + query_params.append(('emailCode', params['email_code'])) # noqa: E501 + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activateEmail{?emailCode,pkgName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def activate_user_by_email_code_using_post(self, email_code, **kwargs): # noqa: E501 + """Activate and login using code from Email (activateUserByEmailCode) # noqa: E501 + + Activate the user using code(link) from the activation email and return the JWT Token. Sends the notification and email about user activation. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_by_email_code_using_post(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.activate_user_by_email_code_using_post_with_http_info(email_code, **kwargs) # noqa: E501 + else: + (data) = self.activate_user_by_email_code_using_post_with_http_info(email_code, **kwargs) # noqa: E501 + return data + + def activate_user_by_email_code_using_post_with_http_info(self, email_code, **kwargs): # noqa: E501 + """Activate and login using code from Email (activateUserByEmailCode) # noqa: E501 + + Activate the user using code(link) from the activation email and return the JWT Token. Sends the notification and email about user activation. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.activate_user_by_email_code_using_post_with_http_info(email_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email_code: Activation token. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email_code', 'pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method activate_user_by_email_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email_code' is set + if ('email_code' not in params or + params['email_code'] is None): + raise ValueError("Missing the required parameter `email_code` when calling `activate_user_by_email_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email_code' in params: + query_params.append(('emailCode', params['email_code'])) # noqa: E501 + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/activateByEmailCode{?emailCode,pkgName}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def mobile_login_using_get(self, pkg_name, **kwargs): # noqa: E501 + """Mobile Login redirect (mobileLogin) # noqa: E501 + + This method generates redirect to the special link that is handled by mobile application. Useful for email verification flow on mobile app. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mobile_login_using_get(pkg_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile app package name. Used to identify the application and build the redirect link. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.mobile_login_using_get_with_http_info(pkg_name, **kwargs) # noqa: E501 + else: + (data) = self.mobile_login_using_get_with_http_info(pkg_name, **kwargs) # noqa: E501 + return data + + def mobile_login_using_get_with_http_info(self, pkg_name, **kwargs): # noqa: E501 + """Mobile Login redirect (mobileLogin) # noqa: E501 + + This method generates redirect to the special link that is handled by mobile application. Useful for email verification flow on mobile app. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.mobile_login_using_get_with_http_info(pkg_name, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str pkg_name: Mobile app package name. Used to identify the application and build the redirect link. (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method mobile_login_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'pkg_name' is set + if ('pkg_name' not in params or + params['pkg_name'] is None): + raise ValueError("Missing the required parameter `pkg_name` when calling `mobile_login_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/login{?pkgName}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def privacy_policy_accepted_using_get(self, **kwargs): # noqa: E501 + """Check privacy policy (privacyPolicyAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.privacy_policy_accepted_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.privacy_policy_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.privacy_policy_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def privacy_policy_accepted_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check privacy policy (privacyPolicyAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.privacy_policy_accepted_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method privacy_policy_accepted_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/privacyPolicyAccepted', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def resend_email_activation_using_post(self, email, **kwargs): # noqa: E501 + """Resend Activation Email (resendEmailActivation) # noqa: E501 + + Request to resend the activation email for the user. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.resend_email_activation_using_post(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.resend_email_activation_using_post_with_http_info(email, **kwargs) # noqa: E501 + else: + (data) = self.resend_email_activation_using_post_with_http_info(email, **kwargs) # noqa: E501 + return data + + def resend_email_activation_using_post_with_http_info(self, email, **kwargs): # noqa: E501 + """Resend Activation Email (resendEmailActivation) # noqa: E501 + + Request to resend the activation email for the user. Checks that user was not activated yet. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.resend_email_activation_using_post_with_http_info(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user. (required) + :param str pkg_name: Optional package name of the mobile application. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email', 'pkg_name'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method resend_email_activation_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email' is set + if ('email' not in params or + params['email'] is None): + raise ValueError("Missing the required parameter `email` when calling `resend_email_activation_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email' in params: + query_params.append(('email', params['email'])) # noqa: E501 + if 'pkg_name' in params: + query_params.append(('pkgName', params['pkg_name'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/resendEmailActivation{?email,pkgName}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def sign_up_using_post(self, **kwargs): # noqa: E501 + """User Sign Up (signUp) # noqa: E501 + + Process user sign up request. Creates the Customer and corresponding User based on self Registration parameters for the domain. See [Self Registration Controller](/swagger-ui.html#/self-registration-controller) for more details. The result is either 'SUCCESS' or 'INACTIVE_USER_EXISTS'. If Success, the user will receive an email with instruction to activate the account. The content of the email is customizable via the mail templates. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sign_up_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SignUpRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.sign_up_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.sign_up_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def sign_up_using_post_with_http_info(self, **kwargs): # noqa: E501 + """User Sign Up (signUp) # noqa: E501 + + Process user sign up request. Creates the Customer and corresponding User based on self Registration parameters for the domain. See [Self Registration Controller](/swagger-ui.html#/self-registration-controller) for more details. The result is either 'SUCCESS' or 'INACTIVE_USER_EXISTS'. If Success, the user will receive an email with instruction to activate the account. The content of the email is customizable via the mail templates. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.sign_up_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param SignUpRequest body: + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method sign_up_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/signup', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def terms_of_use_accepted_using_get(self, **kwargs): # noqa: E501 + """Check Terms Of User (termsOfUseAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.terms_of_use_accepted_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.terms_of_use_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.terms_of_use_accepted_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def terms_of_use_accepted_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Terms Of User (termsOfUseAccepted) # noqa: E501 + + Checks that current user accepted the privacy policy. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.terms_of_use_accepted_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method terms_of_use_accepted_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/signup/termsOfUseAccepted', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/solution_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/solution_controller_api.py new file mode 100644 index 0000000..3f5b348 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/solution_controller_api.py @@ -0,0 +1,514 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SolutionControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_solution_template_details_using_get(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution template details (getSolutionTemplateDetails) # noqa: E501 + + Get a solution template details based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_details_using_get(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_solution_template_details_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.get_solution_template_details_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def get_solution_template_details_using_get_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution template details (getSolutionTemplateDetails) # noqa: E501 + + Get a solution template details based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_details_using_get_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_solution_template_details_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `get_solution_template_details_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/details/{solutionTemplateId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantSolutionTemplateDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_solution_template_infos_using_get(self, **kwargs): # noqa: E501 + """Get Solution templates (getSolutionTemplateInfos) # noqa: E501 + + Get a list of solution template descriptors Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_infos_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TenantSolutionTemplateInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_solution_template_infos_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_solution_template_infos_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_solution_template_infos_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Solution templates (getSolutionTemplateInfos) # noqa: E501 + + Get a list of solution template descriptors Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_infos_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TenantSolutionTemplateInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_solution_template_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/infos', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TenantSolutionTemplateInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_solution_template_instructions_using_get(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution Template Instructions (getSolutionTemplateInstructions) # noqa: E501 + + Get a solution template instructions based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_instructions_using_get(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateInstructions + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_solution_template_instructions_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.get_solution_template_instructions_using_get_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def get_solution_template_instructions_using_get_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Get Solution Template Instructions (getSolutionTemplateInstructions) # noqa: E501 + + Get a solution template instructions based on the provided id Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_solution_template_instructions_using_get_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantSolutionTemplateInstructions + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_solution_template_instructions_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `get_solution_template_instructions_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/instructions/{solutionTemplateId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantSolutionTemplateInstructions', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def install_solution_template_using_post(self, solution_template_id, **kwargs): # noqa: E501 + """Install Solution Template (installSolutionTemplate) # noqa: E501 + + Install solution template based on the provided id Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.install_solution_template_using_post(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SolutionInstallResponse + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.install_solution_template_using_post_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.install_solution_template_using_post_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def install_solution_template_using_post_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Install Solution Template (installSolutionTemplate) # noqa: E501 + + Install solution template based on the provided id Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.install_solution_template_using_post_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: SolutionInstallResponse + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method install_solution_template_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `install_solution_template_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/{solutionTemplateId}/install', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SolutionInstallResponse', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def uninstall_solution_template_using_delete(self, solution_template_id, **kwargs): # noqa: E501 + """Uninstall Solution Template (uninstallSolutionTemplate) # noqa: E501 + + Uninstall solution template based on the provided id Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.uninstall_solution_template_using_delete(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.uninstall_solution_template_using_delete_with_http_info(solution_template_id, **kwargs) # noqa: E501 + else: + (data) = self.uninstall_solution_template_using_delete_with_http_info(solution_template_id, **kwargs) # noqa: E501 + return data + + def uninstall_solution_template_using_delete_with_http_info(self, solution_template_id, **kwargs): # noqa: E501 + """Uninstall Solution Template (uninstallSolutionTemplate) # noqa: E501 + + Uninstall solution template based on the provided id Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.uninstall_solution_template_using_delete_with_http_info(solution_template_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str solution_template_id: A string value representing the solution template id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['solution_template_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method uninstall_solution_template_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'solution_template_id' is set + if ('solution_template_id' not in params or + params['solution_template_id'] is None): + raise ValueError("Missing the required parameter `solution_template_id` when calling `uninstall_solution_template_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'solution_template_id' in params: + path_params['solutionTemplateId'] = params['solution_template_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/solutions/templates/{solutionTemplateId}/delete', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/subscription_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/subscription_controller_api.py new file mode 100644 index 0000000..1ee2b1c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/subscription_controller_api.py @@ -0,0 +1,310 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class SubscriptionControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_tenant_profile_data_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """getTenantProfileDataById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: tenantProfileId (required) + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_data_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_data_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_data_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """getTenantProfileDataById # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: tenantProfileId (required) + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_data_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_data_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}/data', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfileData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_data_using_get(self, **kwargs): # noqa: E501 + """getTenantProfileData # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_data_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_data_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_profile_data_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantProfileData # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_data_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: TenantProfileData + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_data_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/subscription/data', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfileData', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_subscription_usage_using_get(self, **kwargs): # noqa: E501 + """getTenantSubscriptionUsage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_subscription_usage_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SubscriptionUsage + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_subscription_usage_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_subscription_usage_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_subscription_usage_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantSubscriptionUsage # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_subscription_usage_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: SubscriptionUsage + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_subscription_usage_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/subscription/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='SubscriptionUsage', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/t_mobile_iot_cdp_integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/t_mobile_iot_cdp_integration_controller_api.py new file mode 100644 index 0000000..b23267d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/t_mobile_iot_cdp_integration_controller_api.py @@ -0,0 +1,838 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TMobileIotCdpIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_using_delete4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post12(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post12(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post12_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post12_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post12_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post12_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post12" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post12`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post12`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post12`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put4(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put4(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put4_with_http_info(body, request_headers, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put4_with_http_info(self, body, request_headers, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put4_with_http_info(body, request_headers, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put4" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put4`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put4`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put4`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tmobile_iot_cdp/{routingKey}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/tb_resource_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/tb_resource_controller_api.py new file mode 100644 index 0000000..1f9c440 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/tb_resource_controller_api.py @@ -0,0 +1,863 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TbResourceControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_resource_using_delete(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_resource_using_delete_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def delete_resource_using_delete_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Delete Resource (deleteResource) # noqa: E501 + + Deletes the Resource. Referencing non-existing Resource Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_resource_using_delete_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_resource_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `delete_resource_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def download_resource_using_get(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.download_resource_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def download_resource_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Download Resource (downloadResource) # noqa: E501 + + Download Resource based on the provided Resource Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.download_resource_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Resource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method download_resource_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `download_resource_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}/download', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Resource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_page_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_page_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjectsPage) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_page_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_page_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_lwm2m_list_objects_page_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m/page{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_lwm2m_list_objects_using_get(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, **kwargs) # noqa: E501 + return data + + def get_lwm2m_list_objects_using_get_with_http_info(self, sort_order, sort_property, object_ids, **kwargs): # noqa: E501 + """Get LwM2M Objects (getLwm2mListObjects) # noqa: E501 + + Returns a page of LwM2M objects parsed from Resources with type 'LWM2M_MODEL' owned by tenant or sysadmin. You can specify parameters to filter the results. LwM2M Object is a object that includes information about the LwM2M model which can be used in transport configuration for the LwM2M device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_lwm2m_list_objects_using_get_with_http_info(sort_order, sort_property, object_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) (required) + :param str sort_property: Property of entity to sort by (required) + :param str object_ids: LwM2M Object ids. (required) + :return: list[LwM2mObject] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['sort_order', 'sort_property', 'object_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_lwm2m_list_objects_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'sort_order' is set + if ('sort_order' not in params or + params['sort_order'] is None): + raise ValueError("Missing the required parameter `sort_order` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'sort_property' is set + if ('sort_property' not in params or + params['sort_property'] is None): + raise ValueError("Missing the required parameter `sort_property` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + # verify the required parameter 'object_ids' is set + if ('object_ids' not in params or + params['object_ids'] is None): + raise ValueError("Missing the required parameter `object_ids` when calling `get_lwm2m_list_objects_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'object_ids' in params: + query_params.append(('objectIds', params['object_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/lwm2m{?objectIds,sortOrder,sortProperty}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[LwM2mObject]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource (getResourceById) # noqa: E501 + + Fetch the Resource object based on the provided Resource Id. Resource is a heavyweight object that includes main information about the Resource and also data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resource_info_by_id_using_get(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + else: + (data) = self.get_resource_info_by_id_using_get_with_http_info(resource_id, **kwargs) # noqa: E501 + return data + + def get_resource_info_by_id_using_get_with_http_info(self, resource_id, **kwargs): # noqa: E501 + """Get Resource Info (getResourceInfoById) # noqa: E501 + + Fetch the Resource Info object based on the provided Resource Id. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resource_info_by_id_using_get_with_http_info(resource_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str resource_id: A string value representing the resource id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['resource_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resource_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'resource_id' is set + if ('resource_id' not in params or + params['resource_id'] is None): + raise ValueError("Missing the required parameter `resource_id` when calling `get_resource_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'resource_id' in params: + path_params['resourceId'] = params['resource_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource/info/{resourceId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_resources_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_resources_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_resources_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Resource Infos (getResources) # noqa: E501 + + Returns a page of Resource Info objects owned by tenant or sysadmin. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Resource Info is a lightweight object that includes main information about the Resource excluding the heavyweight data. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_resources_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the resource title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTbResourceInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_resources_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_resources_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_resources_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTbResourceInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_resource_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_resource_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_resource_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Resource (saveResource) # noqa: E501 + + Create or update the Resource. When creating the Resource, platform generates Resource id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Resource id will be present in the response. Specify existing Resource id to update the Resource. Referencing non-existing Resource Id will cause 'Not Found' error. Resource combination of the title with the key is unique in the scope of tenant. Remove 'id', 'tenantId' from the request body example (below) to create new Resource entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_resource_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TbResource body: + :return: TbResource + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_resource_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/resource', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TbResource', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/telemetry_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/telemetry_controller_api.py new file mode 100644 index 0000000..cec8f67 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/telemetry_controller_api.py @@ -0,0 +1,1796 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TelemetryControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_attributes_using_delete(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_device_attributes_using_delete_with_http_info(self, device_id, scope, keys, **kwargs): # noqa: E501 + """Delete device attributes (deleteDeviceAttributes) # noqa: E501 + + Delete device attributes using provided Device Id, scope and a list of keys. Referencing a non-existing Device Id will cause an error Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_attributes_using_delete_with_http_info(device_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_device_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_device_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_attributes_using_delete(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_attributes_using_delete_with_http_info(self, entity_type, entity_id, scope, keys, **kwargs): # noqa: E501 + """Delete entity attributes (deleteEntityAttributes) # noqa: E501 + + Delete entity attributes using provided Entity Id, scope and a list of keys. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_attributes_using_delete_with_http_info(entity_type, entity_id, scope, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_attributes_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_attributes_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}{?keys}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_entity_timeseries_using_delete(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + else: + (data) = self.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, **kwargs) # noqa: E501 + return data + + def delete_entity_timeseries_using_delete_with_http_info(self, entity_type, entity_id, keys, **kwargs): # noqa: E501 + """Delete entity time-series data (deleteEntityTimeseries) # noqa: E501 + + Delete time-series for selected entity based on entity id, entity type and keys. Use 'deleteAllDataForKeys' to delete all time-series data. Use 'startTs' and 'endTs' to specify time-range instead. Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) after deletion of the time range. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_entity_timeseries_using_delete_with_http_info(entity_type, entity_id, keys, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. (required) + :param bool delete_all_data_for_keys: A boolean value to specify if should be deleted all data for selected keys or only data that are in the selected time range. + :param int start_ts: A long value representing the start timestamp of removal time range in milliseconds. + :param int end_ts: A long value representing the end timestamp of removal time range in milliseconds. + :param bool rewrite_latest_if_deleted: If the parameter is set to true, the latest telemetry will be rewritten in case that current latest value was removed, otherwise, in case that parameter is set to false the new latest value will not set. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'delete_all_data_for_keys', 'start_ts', 'end_ts', 'rewrite_latest_if_deleted'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_entity_timeseries_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `delete_entity_timeseries_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'delete_all_data_for_keys' in params: + query_params.append(('deleteAllDataForKeys', params['delete_all_data_for_keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'rewrite_latest_if_deleted' in params: + query_params.append(('rewriteLatestIfDeleted', params['rewrite_latest_if_deleted'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/delete{?deleteAllDataForKeys,endTs,keys,rewriteLatestIfDeleted,startTs}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get all attribute keys by scope (getAttributeKeysByScope) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity and attributes scope: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attribute_keys_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes/{scope}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attribute_keys_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attribute_keys_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get all attribute keys (getAttributeKeys) # noqa: E501 + + Returns a set of unique attribute key names for the selected entity. The response will include merged key names set for all attribute scopes: * SERVER_SCOPE - supported for all entity types; * CLIENT_SCOPE - supported for devices; * SHARED_SCOPE - supported for devices. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attribute_keys_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attribute_keys_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attribute_keys_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attribute_keys_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/attributes', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_by_scope_using_get(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def get_attributes_by_scope_using_get_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Get attributes by scope (getAttributesByScope) # noqa: E501 + + Returns all attributes of a specified scope that belong to specified entity. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices; * CLIENT_SCOPE - supported for devices. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_by_scope_using_get_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_by_scope_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `get_attributes_by_scope_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes/{scope}{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_attributes_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_attributes_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_attributes_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get attributes (getAttributes) # noqa: E501 + + Returns all attributes that belong to specified entity. Use optional 'keys' parameter to return specific attributes. Example of the result: ```json [ {\"key\": \"stringAttributeKey\", \"value\": \"value\", \"lastUpdateTs\": 1609459200000}, {\"key\": \"booleanAttributeKey\", \"value\": false, \"lastUpdateTs\": 1609459200001}, {\"key\": \"doubleAttributeKey\", \"value\": 42.2, \"lastUpdateTs\": 1609459200002}, {\"key\": \"longKeyExample\", \"value\": 73, \"lastUpdateTs\": 1609459200003}, {\"key\": \"jsonKeyExample\", \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"lastUpdateTs\": 1609459200004 } ] ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_attributes_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of attributes keys. For example, 'active,inactivityAlarmTime'. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_attributes_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_attributes_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_attributes_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/attributes{?keys}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_latest_timeseries_using_get(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_latest_timeseries_using_get_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get latest time-series value (getLatestTimeseries) # noqa: E501 + + Returns all time-series that belong to specified entity. Use optional 'keys' parameter to return specific time-series. The result is a JSON object. The format of the values depends on the 'useStrictDataTypes' parameter. By default, all time-series values are converted to strings: ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": \"false\", \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": \"42.2\", \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": \"73\", \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": \"{\\\"someNumber\\\": 42,\\\"someArray\\\": [1,2,3],\\\"someNestedObject\\\": {\\\"key\\\": \\\"value\\\"}}\", \"ts\": 1609459200000}] } ``` However, it is possible to request the values without conversion ('useStrictDataTypes'=true): ```json { \"stringTsKey\": [{ \"value\": \"value\", \"ts\": 1609459200000}], \"booleanTsKey\": [{ \"value\": false, \"ts\": 1609459200000}], \"doubleTsKey\": [{ \"value\": 42.2, \"ts\": 1609459200000}], \"longTsKey\": [{ \"value\": 73, \"ts\": 1609459200000}], \"jsonTsKey\": [{ \"value\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} }, \"ts\": 1609459200000}] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_latest_timeseries_using_get_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. If keys are not selected, the result will return all latest timeseries. For example, 'temperature,humidity'. + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_latest_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_latest_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_latest_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?keys,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_keys_using_get1(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, **kwargs) # noqa: E501 + return data + + def get_timeseries_keys_using_get1_with_http_info(self, entity_type, entity_id, **kwargs): # noqa: E501 + """Get time-series keys (getTimeseriesKeys) # noqa: E501 + + Returns a set of unique time-series key names for the selected entity. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_keys_using_get1_with_http_info(entity_type, entity_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_keys_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_keys_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/keys/timeseries', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_timeseries_using_get(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + else: + (data) = self.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, **kwargs) # noqa: E501 + return data + + def get_timeseries_using_get_with_http_info(self, entity_type, entity_id, keys, start_ts, end_ts, **kwargs): # noqa: E501 + """Get time-series data (getTimeseries) # noqa: E501 + + Returns a range of time-series values for specified entity. Returns not aggregated data by default. Use aggregation function ('agg') and aggregation interval ('interval') to enable aggregation of the results on the database / server side. The aggregation is generally more efficient then fetching all records. ```json { \"temperature\": [ { \"value\": 36.7, \"ts\": 1609459200000 }, { \"value\": 36.6, \"ts\": 1609459201000 } ] } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_timeseries_using_get_with_http_info(entity_type, entity_id, keys, start_ts, end_ts, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str keys: A string value representing the comma-separated list of telemetry keys. (required) + :param int start_ts: A long value representing the start timestamp of the time range in milliseconds, UTC. (required) + :param int end_ts: A long value representing the end timestamp of the time range in milliseconds, UTC. (required) + :param int interval: A long value representing the aggregation interval range in milliseconds. + :param int limit: An integer value that represents a max number of timeseries data points to fetch. This parameter is used only in the case if 'agg' parameter is set to 'NONE'. + :param str agg: A string value representing the aggregation function. If the interval is not specified, 'agg' parameter will use 'NONE' value. + :param str order_by: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :param bool use_strict_data_types: Enables/disables conversion of telemetry values to strings. Conversion is enabled by default. Set parameter to 'true' in order to disable the conversion. + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'keys', 'start_ts', 'end_ts', 'interval', 'limit', 'agg', 'order_by', 'use_strict_data_types'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_timeseries_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'keys' is set + if ('keys' not in params or + params['keys'] is None): + raise ValueError("Missing the required parameter `keys` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'start_ts' is set + if ('start_ts' not in params or + params['start_ts'] is None): + raise ValueError("Missing the required parameter `start_ts` when calling `get_timeseries_using_get`") # noqa: E501 + # verify the required parameter 'end_ts' is set + if ('end_ts' not in params or + params['end_ts'] is None): + raise ValueError("Missing the required parameter `end_ts` when calling `get_timeseries_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + + query_params = [] + if 'keys' in params: + query_params.append(('keys', params['keys'])) # noqa: E501 + if 'start_ts' in params: + query_params.append(('startTs', params['start_ts'])) # noqa: E501 + if 'end_ts' in params: + query_params.append(('endTs', params['end_ts'])) # noqa: E501 + if 'interval' in params: + query_params.append(('interval', params['interval'])) # noqa: E501 + if 'limit' in params: + query_params.append(('limit', params['limit'])) # noqa: E501 + if 'agg' in params: + query_params.append(('agg', params['agg'])) # noqa: E501 + if 'order_by' in params: + query_params.append(('orderBy', params['order_by'])) # noqa: E501 + if 'use_strict_data_types' in params: + query_params.append(('useStrictDataTypes', params['use_strict_data_types'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?agg,endTs,interval,keys,limit,orderBy,startTs,useStrictDataTypes}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_device_attributes_using_post(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_device_attributes_using_post_with_http_info(device_id, scope, **kwargs) # noqa: E501 + return data + + def save_device_attributes_using_post_with_http_info(self, device_id, scope, **kwargs): # noqa: E501 + """Save device attributes (saveDeviceAttributes) # noqa: E501 + + Creates or updates the device attributes based on device id and specified attribute scope. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_device_attributes_using_post_with_http_info(device_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str device_id: A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['device_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_device_attributes_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'device_id' is set + if ('device_id' not in params or + params['device_id'] is None): + raise ValueError("Missing the required parameter `device_id` when calling `save_device_attributes_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_device_attributes_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'device_id' in params: + path_params['deviceId'] = params['device_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{deviceId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v1_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v1_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV1) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v1_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v1_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v1_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_attributes_v2_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_attributes_v2_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save entity attributes (saveEntityAttributesV2) # noqa: E501 + + Creates or updates the entity attributes based on Entity Id and the specified attribute scope. List of possible attribute scopes depends on the entity type: * SERVER_SCOPE - supported for all entity types; * SHARED_SCOPE - supported for devices. The request payload is a JSON object with key-value format of attributes to create or update. For example: ```json { \"stringKey\":\"value1\", \"booleanKey\":true, \"doubleKey\":42.0, \"longKey\":73, \"jsonKey\": { \"someNumber\": 42, \"someArray\": [1,2,3], \"someNestedObject\": {\"key\": \"value\"} } } ``` Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_attributes_v2_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: A string value representing the attributes scope. For example, 'SERVER_SCOPE'. (required) + :param JsonNode body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_attributes_v2_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_attributes_v2_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/attributes/{scope}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_using_post(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_using_post_with_http_info(self, entity_type, entity_id, scope, **kwargs): # noqa: E501 + """Save or update time-series data (saveEntityTelemetry) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_using_post_with_http_info(entity_type, entity_id, scope, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_entity_telemetry_with_ttl_using_post(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + else: + (data) = self.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, **kwargs) # noqa: E501 + return data + + def save_entity_telemetry_with_ttl_using_post_with_http_info(self, entity_type, entity_id, scope, ttl, **kwargs): # noqa: E501 + """Save or update time-series data with TTL (saveEntityTelemetryWithTTL) # noqa: E501 + + Creates or updates the entity time-series data based on the Entity Id and request payload.The request payload is a JSON document with three possible formats: Simple format without timestamp. In such a case, current server time will be used: ```json {\"temperature\": 26} ``` Single JSON object with timestamp: ```json {\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}} ``` JSON array with timestamps: ```json [{\"ts\":1634712287000,\"values\":{\"temperature\":26, \"humidity\":87}}, {\"ts\":1634712588000,\"values\":{\"temperature\":25, \"humidity\":88}}] ``` The scope parameter is not used in the API call implementation but should be specified whatever value because it is used as a path variable. The ttl parameter takes affect only in case of Cassandra DB.Referencing a non-existing entity Id or invalid entity type will cause an error. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_entity_telemetry_with_ttl_using_post_with_http_info(entity_type, entity_id, scope, ttl, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_type: A string value representing the entity type. For example, 'DEVICE' (required) + :param str entity_id: A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str scope: Value is deprecated, reserved for backward compatibility and not used in the API call implementation. Specify any scope for compatibility (required) + :param int ttl: A long value representing TTL (Time to Live) parameter. (required) + :param str body: + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_type', 'entity_id', 'scope', 'ttl', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_entity_telemetry_with_ttl_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_type' is set + if ('entity_type' not in params or + params['entity_type'] is None): + raise ValueError("Missing the required parameter `entity_type` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'entity_id' is set + if ('entity_id' not in params or + params['entity_id'] is None): + raise ValueError("Missing the required parameter `entity_id` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'scope' is set + if ('scope' not in params or + params['scope'] is None): + raise ValueError("Missing the required parameter `scope` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + # verify the required parameter 'ttl' is set + if ('ttl' not in params or + params['ttl'] is None): + raise ValueError("Missing the required parameter `ttl` when calling `save_entity_telemetry_with_ttl_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_type' in params: + path_params['entityType'] = params['entity_type'] # noqa: E501 + if 'entity_id' in params: + path_params['entityId'] = params['entity_id'] # noqa: E501 + if 'scope' in params: + path_params['scope'] = params['scope'] # noqa: E501 + if 'ttl' in params: + path_params['ttl'] = params['ttl'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/plugins/telemetry/{entityType}/{entityId}/timeseries/{scope}/{ttl}?scope=ANY', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/tenant_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/tenant_controller_api.py new file mode 100644 index 0000000..5924894 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/tenant_controller_api.py @@ -0,0 +1,750 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_using_delete(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_using_delete_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_using_delete_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Delete Tenant (deleteTenant) # noqa: E501 + + Deletes the tenant, it's customers, rule chains, devices and all other related entities. Referencing non-existing tenant Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_using_delete_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `delete_tenant_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant (getTenantById) # noqa: E501 + + Fetch the Tenant object based on the provided Tenant Id. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_info_by_id_using_get(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_info_by_id_using_get_with_http_info(tenant_id, **kwargs) # noqa: E501 + return data + + def get_tenant_info_by_id_using_get_with_http_info(self, tenant_id, **kwargs): # noqa: E501 + """Get Tenant Info (getTenantInfoById) # noqa: E501 + + Fetch the Tenant Info object based on the provided Tenant Id. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_info_by_id_using_get_with_http_info(tenant_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/info/{tenantId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants Info (getTenants) # noqa: E501 + + Returns a page of tenant info objects registered in the platform. The Tenant Info object extends regular Tenant object and includes Tenant Profile name. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenants_by_ids_using_get(self, tenant_ids, **kwargs): # noqa: E501 + """getTenantsByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_by_ids_using_get(tenant_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_ids: tenantIds (required) + :return: list[Tenant] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenants_by_ids_using_get_with_http_info(tenant_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_tenants_by_ids_using_get_with_http_info(tenant_ids, **kwargs) # noqa: E501 + return data + + def get_tenants_by_ids_using_get_with_http_info(self, tenant_ids, **kwargs): # noqa: E501 + """getTenantsByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_by_ids_using_get_with_http_info(tenant_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_ids: tenantIds (required) + :return: list[Tenant] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenants_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_ids' is set + if ('tenant_ids' not in params or + params['tenant_ids'] is None): + raise ValueError("Missing the required parameter `tenant_ids` when calling `get_tenants_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'tenant_ids' in params: + query_params.append(('tenantIds', params['tenant_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenants{?tenantIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[Tenant]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenants_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenants_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenants_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenants (getTenants) # noqa: E501 + + Returns a page of tenants registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenants_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenants_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenants_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenants_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenants{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant (saveTenant) # noqa: E501 + + Create or update the Tenant. When creating tenant, platform generates Tenant Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). Default Rule Chain and Device profile are also generated for the new tenants automatically. The newly created Tenant Id will be present in the response. Specify existing Tenant Id id to update the Tenant. Referencing non-existing Tenant Id will cause 'Not Found' error.Remove 'id', 'tenantId' from the request body example (below) to create new Tenant entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param Tenant body: + :return: Tenant + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Tenant', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/tenant_profile_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/tenant_profile_controller_api.py new file mode 100644 index 0000000..9a7c72b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/tenant_profile_controller_api.py @@ -0,0 +1,932 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TenantProfileControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_tenant_profile_using_delete(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def delete_tenant_profile_using_delete_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Delete Tenant Profile (deleteTenantProfile) # noqa: E501 + + Deletes the tenant profile. Referencing non-existing tenant profile Id will cause an error. Referencing profile that is used by the tenants will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_tenant_profile_using_delete_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_tenant_profile_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `delete_tenant_profile_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_default_tenant_profile_info_using_get(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_default_tenant_profile_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_default_tenant_profile_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get default Tenant Profile Info (getDefaultTenantProfileInfo) # noqa: E501 + + Fetch the default Tenant Profile Info object based. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_default_tenant_profile_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_default_tenant_profile_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/default', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile (getTenantProfileById) # noqa: E501 + + Fetch the Tenant Profile object based on the provided Tenant Profile Id. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_info_by_id_using_get(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_info_by_id_using_get_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Get Tenant Profile Info (getTenantProfileInfoById) # noqa: E501 + + Fetch the Tenant Profile Info object based on the provided Tenant Profile Id. Tenant Profile Info is a lightweight object that contains only id and name of the profile. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_info_by_id_using_get_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: EntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `get_tenant_profile_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfo/{tenantProfileId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='EntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profile_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profile_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profile_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles Info (getTenantProfileInfos) # noqa: E501 + + Returns a page of tenant profile info objects registered in the platform. Tenant Profile Info is a lightweight object that contains only id and name of the profile. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profile_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataEntityInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profile_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profile_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfileInfos{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataEntityInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_by_ids_using_get(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_by_ids_using_get_with_http_info(ids, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_by_ids_using_get_with_http_info(self, ids, **kwargs): # noqa: E501 + """getTenantProfilesByIds # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_by_ids_using_get_with_http_info(ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str ids: ids (required) + :return: list[TenantProfile] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'ids' is set + if ('ids' not in params or + params['ids'] is None): + raise ValueError("Missing the required parameter `ids` when calling `get_tenant_profiles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'ids' in params: + query_params.append(('ids', params['ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?ids}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TenantProfile]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_profiles_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_profiles_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_profiles_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Profiles (getTenantProfiles) # noqa: E501 + + Returns a page of tenant profiles registered in the platform. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_profiles_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the tenant profile name. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataTenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_profiles_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_profiles_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_profiles_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfiles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataTenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_tenant_profile_using_post(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_tenant_profile_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_tenant_profile_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or update Tenant Profile (saveTenantProfile) # noqa: E501 + + Create or update the Tenant Profile. When creating tenant profile, platform generates Tenant Profile Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Tenant Profile Id will be present in the response. Specify existing Tenant Profile Id id to update the Tenant Profile. Referencing non-existing Tenant Profile Id will cause 'Not Found' error. Update of the tenant profile configuration will cause immediate recalculation of API limits for all affected Tenants. The **'profileData'** object is the part of Tenant Profile that defines API limits and Rate limits. You have an ability to define maximum number of devices ('maxDevice'), assets ('maxAssets') and other entities. You may also define maximum number of messages to be processed per month ('maxTransportMessages', 'maxREExecutions', etc). The '*RateLimit' defines the rate limits using simple syntax. For example, '1000:1,20000:60' means up to 1000 events per second but no more than 20000 event per minute. Let's review the example of tenant profile data below: ```json { \"name\": \"Default\", \"description\": \"Default tenant profile\", \"isolatedTbRuleEngine\": false, \"profileData\": { \"configuration\": { \"type\": \"DEFAULT\", \"maxDevices\": 0, \"maxAssets\": 0, \"maxCustomers\": 0, \"maxUsers\": 0, \"maxDashboards\": 0, \"maxRuleChains\": 0, \"maxResourcesInBytes\": 0, \"maxOtaPackagesInBytes\": 0, \"transportTenantMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryMsgRateLimit\": \"1000:1,20000:60\", \"transportTenantTelemetryDataPointsRateLimit\": \"1000:1,20000:60\", \"transportDeviceMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryMsgRateLimit\": \"20:1,600:60\", \"transportDeviceTelemetryDataPointsRateLimit\": \"20:1,600:60\", \"maxTransportMessages\": 10000000, \"maxTransportDataPoints\": 10000000, \"maxREExecutions\": 4000000, \"maxJSExecutions\": 5000000, \"maxDPStorageDays\": 0, \"maxRuleNodeExecutionsPerMessage\": 50, \"maxEmails\": 0, \"maxSms\": 0, \"maxCreatedAlarms\": 1000, \"defaultStorageTtlDays\": 0, \"alarmsTtlDays\": 0, \"rpcTtlDays\": 0, \"warnThreshold\": 0 } }, \"default\": true } ```Remove 'id', from the request body example (below) to create new Tenant Profile entity. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_tenant_profile_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TenantProfile body: + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_default_tenant_profile_using_post(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + else: + (data) = self.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, **kwargs) # noqa: E501 + return data + + def set_default_tenant_profile_using_post_with_http_info(self, tenant_profile_id, **kwargs): # noqa: E501 + """Make tenant profile default (setDefaultTenantProfile) # noqa: E501 + + Makes specified tenant profile to be default. Referencing non-existing tenant profile Id will cause an error. Available for users with 'SYS_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_default_tenant_profile_using_post_with_http_info(tenant_profile_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_profile_id: A string value representing the tenant profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: TenantProfile + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_profile_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_default_tenant_profile_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_profile_id' is set + if ('tenant_profile_id' not in params or + params['tenant_profile_id'] is None): + raise ValueError("Missing the required parameter `tenant_profile_id` when calling `set_default_tenant_profile_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_profile_id' in params: + path_params['tenantProfileId'] = params['tenant_profile_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenantProfile/{tenantProfileId}/default', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TenantProfile', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/thing_park_integration_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/thing_park_integration_controller_api.py new file mode 100644 index 0000000..c1fb571 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/thing_park_integration_controller_api.py @@ -0,0 +1,1741 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class ThingParkIntegrationControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def process_request_tpe_using_delete(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_delete(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_delete_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_delete_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_delete_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_delete_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_delete`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_delete`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_delete`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_get(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_get(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_get_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_get_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_get_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_get_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_get`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_get`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_get`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_head(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_head(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_head_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_head_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_head_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_head_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_head" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_head`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_head`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_head`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_head`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_options(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_options(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_options_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_options_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_options_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_options_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_options" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_options`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_options`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_options`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_options`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_patch(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_patch(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_patch_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_patch_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_patch_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_patch_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_patch" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_patch`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_patch`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_patch`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_patch`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_post(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_post(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_post_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_post_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_post_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_post_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_post`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_post`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_post`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_tpe_using_put(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_put(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_tpe_using_put_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_tpe_using_put_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_tpe_using_put_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequestTPE # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_tpe_using_put_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_tpe_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_tpe_using_put`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_tpe_using_put`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_tpe_using_put`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_tpe_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/tpe/{routingKey}{?allRequestParams}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_delete5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_delete5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_delete5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_delete5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_delete5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_delete5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_delete5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_delete5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_delete5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_delete5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_get5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_get5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_get5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_get5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_get5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_get5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_get5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_get5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_get5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_get5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_head5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_head5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_head5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_head5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_head5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_head5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_head5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_head5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_head5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_head5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'HEAD', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_options5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_options5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_options5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_options5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_options5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_options5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_options5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_options5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_options5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_options5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'OPTIONS', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_patch5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_patch5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_patch5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_patch5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_patch5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_patch5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_patch5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_patch5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_patch5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_patch5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'PATCH', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_post13(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post13(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_post13_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_post13_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_post13_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_post13_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_post13" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_post13`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_post13`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_post13`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_post13`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def process_request_using_put5(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put5(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.process_request_using_put5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + else: + (data) = self.process_request_using_put5_with_http_info(body, request_headers, all_request_params, routing_key, **kwargs) # noqa: E501 + return data + + def process_request_using_put5_with_http_info(self, body, request_headers, all_request_params, routing_key, **kwargs): # noqa: E501 + """processRequest # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.process_request_using_put5_with_http_info(body, request_headers, all_request_params, routing_key, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str body: msg (required) + :param Object request_headers: requestHeaders (required) + :param Object all_request_params: allRequestParams (required) + :param str routing_key: routingKey (required) + :return: DeferredResultResponseEntity + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'request_headers', 'all_request_params', 'routing_key'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method process_request_using_put5" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params or + params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `process_request_using_put5`") # noqa: E501 + # verify the required parameter 'request_headers' is set + if ('request_headers' not in params or + params['request_headers'] is None): + raise ValueError("Missing the required parameter `request_headers` when calling `process_request_using_put5`") # noqa: E501 + # verify the required parameter 'all_request_params' is set + if ('all_request_params' not in params or + params['all_request_params'] is None): + raise ValueError("Missing the required parameter `all_request_params` when calling `process_request_using_put5`") # noqa: E501 + # verify the required parameter 'routing_key' is set + if ('routing_key' not in params or + params['routing_key'] is None): + raise ValueError("Missing the required parameter `routing_key` when calling `process_request_using_put5`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'routing_key' in params: + path_params['routingKey'] = params['routing_key'] # noqa: E501 + + query_params = [] + if 'all_request_params' in params: + query_params.append(('allRequestParams', params['all_request_params'])) # noqa: E501 + + header_params = {} + if 'request_headers' in params: + header_params['requestHeaders'] = params['request_headers'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/v1/integrations/thingpark/{routingKey}{?allRequestParams}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='DeferredResultResponseEntity', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/trail_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/trail_controller_api.py new file mode 100644 index 0000000..c34bc74 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/trail_controller_api.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TrailControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_device_using_delete1(self, **kwargs): # noqa: E501 + """deleteDevice # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_device_using_delete1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.delete_device_using_delete1_with_http_info(**kwargs) # noqa: E501 + return data + + def delete_device_using_delete1_with_http_info(self, **kwargs): # noqa: E501 + """deleteDevice # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_device_using_delete1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_device_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/trail/invalidateCache', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/two_factor_auth_config_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/two_factor_auth_config_controller_api.py new file mode 100644 index 0000000..7831403 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/two_factor_auth_config_controller_api.py @@ -0,0 +1,890 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthConfigControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_two_fa_account_config_using_delete(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.delete_two_fa_account_config_using_delete_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def delete_two_fa_account_config_using_delete_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Delete 2FA account config (deleteTwoFaAccountConfig) # noqa: E501 + + Delete 2FA config for a given 2FA provider type. Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_two_fa_account_config_using_delete_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_two_fa_account_config_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `delete_two_fa_account_config_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def generate_two_fa_account_config_using_post(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.generate_two_fa_account_config_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def generate_two_fa_account_config_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Generate 2FA account config (generateTwoFaAccountConfig) # noqa: E501 + + Generate new 2FA account config template for specified provider type. For TOTP, this will return a corresponding account config template with a generated OTP auth URL (with new random secret key for each API call) that can be then converted to a QR code to scan with an authenticator app. Example: ``` { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=PNJDNWJVAK4ZTUYT7RFGPQLXA7XGU7PX\" } ``` For EMAIL, the generated config will contain email from user's account: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": false, \"email\": \"tenant@thingsboard.org\" } ``` For SMS 2FA this method will just return a config with empty/default values as there is nothing to generate/preset: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": null } ``` Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.generate_two_fa_account_config_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: 2FA provider type to generate new account config for (required) + :return: TwoFaAccountConfig + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method generate_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `generate_two_fa_account_config_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/generate{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TwoFaAccountConfig', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_account_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_account_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_account_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get account 2FA settings (getAccountTwoFaSettings) # noqa: E501 + + Get user's account 2FA configuration. Configuration contains configs for different 2FA providers. Example: ``` { \"configs\": { \"EMAIL\": { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"tenant@thingsboard.org\" }, \"TOTP\": { \"providerType\": \"TOTP\", \"useByDefault\": false, \"authUrl\": \"otpauth://totp/TB%202FA:tenant@thingsboard.org?issuer=TB+2FA&secret=P6Z2TLYTASOGP6LCJZAD24ETT5DACNNX\" }, \"SMS\": { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+380501253652\" } } } ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_account_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_account_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of provider types available for user to use (the ones configured by tenant or sysadmin). Example of response: ``` [ \"TOTP\", \"EMAIL\", \"SMS\" ] ``` Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[str] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[str]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_platform_two_fa_settings_using_get(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_platform_two_fa_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_platform_two_fa_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get platform 2FA settings (getPlatformTwoFaSettings) # noqa: E501 + + Get platform settings for 2FA. The settings are described for savePlatformTwoFaSettings API method. If 2FA is not configured, then an empty response will be returned. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_platform_two_fa_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_platform_two_fa_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_platform_two_fa_settings_using_post(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `useSystemTwoFactorAuthSettings` - option for tenant admins to use 2FA settings configured by sysadmin. If this param is set to true, then the settings will not be validated for constraints (if it is a tenant admin; for sysadmin this param is ignored). - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"useSystemTwoFactorAuthSettings\": false, \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_platform_two_fa_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_platform_two_fa_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save platform 2FA settings (savePlatformTwoFaSettings) # noqa: E501 + + Save 2FA settings for platform. The settings have following properties: - `useSystemTwoFactorAuthSettings` - option for tenant admins to use 2FA settings configured by sysadmin. If this param is set to true, then the settings will not be validated for constraints (if it is a tenant admin; for sysadmin this param is ignored). - `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. - `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. - `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking. The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute. - `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled. - `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used. TOTP 2FA provider config has following settings: - `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank. For SMS 2FA provider: - `smsVerificationMessageTemplate` - verification message template. Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable. - `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive. For EMAIL provider type: - `verificationCodeLifetime` - the same as for SMS. Example of the settings: ``` { \"useSystemTwoFactorAuthSettings\": false, \"providers\": [ { \"providerType\": \"TOTP\", \"issuerName\": \"TB\" }, { \"providerType\": \"EMAIL\", \"verificationCodeLifetime\": 60 }, { \"providerType\": \"SMS\", \"verificationCodeLifetime\": 60, \"smsVerificationMessageTemplate\": \"Here is your verification code: ${code}\" } ], \"minVerificationCodeSendPeriod\": 60, \"verificationCodeCheckRateLimit\": \"3:900\", \"maxVerificationFailuresBeforeUserLockout\": 10, \"totalAllowedTimeForVerification\": 600 } ``` Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_platform_two_fa_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param PlatformTwoFaSettings body: + :return: PlatformTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_platform_two_fa_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PlatformTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def submit_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.submit_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def submit_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Submit 2FA account config (submitTwoFaAccountConfig) # noqa: E501 + + Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config. Example of EMAIL 2FA account config: ``` { \"providerType\": \"EMAIL\", \"useByDefault\": true, \"email\": \"separate-email-for-2fa@thingsboard.org\" } ``` Example of SMS 2FA account config: ``` { \"providerType\": \"SMS\", \"useByDefault\": false, \"phoneNumber\": \"+38012312321\" } ``` For TOTP this method does nothing. Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.submit_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method submit_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config/submit', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def update_two_fa_account_config_using_put(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.update_two_fa_account_config_using_put_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def update_two_fa_account_config_using_put_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Update 2FA account config (updateTwoFaAccountConfig) # noqa: E501 + + Update config for a given provider type. Update request example: ``` { \"useByDefault\": true } ``` Returns whole account's 2FA settings object. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.update_two_fa_account_config_using_put_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param TwoFaAccountConfigUpdateRequest body: + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_two_fa_account_config_using_put" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `update_two_fa_account_config_using_put`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?providerType}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def verify_and_save_two_fa_account_config_using_post(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.verify_and_save_two_fa_account_config_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def verify_and_save_two_fa_account_config_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Verify and save 2FA account config (verifyAndSaveTwoFaAccountConfig) # noqa: E501 + + Checks the verification code for submitted config, and if it is correct, saves the provided account config. Returns whole account's 2FA settings object. Will throw an error (Bad Request) if the provider is not configured for usage. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.verify_and_save_two_fa_account_config_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param TwoFaAccountConfig body: + :param str verification_code: verificationCode + :return: AccountTwoFaSettings + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method verify_and_save_two_fa_account_config_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/2fa/account/config{?verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AccountTwoFaSettings', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/two_factor_auth_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/two_factor_auth_controller_api.py new file mode 100644 index 0000000..344b072 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/two_factor_auth_controller_api.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class TwoFactorAuthControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def check_two_fa_verification_code_using_post(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + else: + (data) = self.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, **kwargs) # noqa: E501 + return data + + def check_two_fa_verification_code_using_post_with_http_info(self, provider_type, verification_code, **kwargs): # noqa: E501 + """Check 2FA verification code (checkTwoFaVerificationCode) # noqa: E501 + + Checks 2FA verification code, and if it is correct the method returns a regular access and refresh token pair. The API method is rate limited (using rate limit config from TwoFactorAuthSettings), and also will block a user after X unsuccessful verification attempts if such behavior is configured (in TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.check_two_fa_verification_code_using_post_with_http_info(provider_type, verification_code, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :param str verification_code: verificationCode (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type', 'verification_code'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method check_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + # verify the required parameter 'verification_code' is set + if ('verification_code' not in params or + params['verification_code'] is None): + raise ValueError("Missing the required parameter `verification_code` when calling `check_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + if 'verification_code' in params: + query_params.append(('verificationCode', params['verification_code'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/check{?providerType,verificationCode}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_available_two_fa_providers_using_get1(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_available_two_fa_providers_using_get1_with_http_info(**kwargs) # noqa: E501 + return data + + def get_available_two_fa_providers_using_get1_with_http_info(self, **kwargs): # noqa: E501 + """Get available 2FA providers (getAvailableTwoFaProviders) # noqa: E501 + + Get the list of 2FA provider infos available for user to use. Example: ``` [ { \"type\": \"EMAIL\", \"default\": true, \"contact\": \"ab*****ko@gmail.com\" }, { \"type\": \"TOTP\", \"default\": false, \"contact\": null }, { \"type\": \"SMS\", \"default\": false, \"contact\": \"+38********12\" } ] ``` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_available_two_fa_providers_using_get1_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[TwoFaProviderInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_available_two_fa_providers_using_get1" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/providers', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[TwoFaProviderInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def request_two_fa_verification_code_using_post(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + else: + (data) = self.request_two_fa_verification_code_using_post_with_http_info(provider_type, **kwargs) # noqa: E501 + return data + + def request_two_fa_verification_code_using_post_with_http_info(self, provider_type, **kwargs): # noqa: E501 + """Request 2FA verification code (requestTwoFaVerificationCode) # noqa: E501 + + Request 2FA verification code. To make a request to this endpoint, you need an access token with the scope of PRE_VERIFICATION_TOKEN, which is issued on username/password auth if 2FA is enabled. The API method is rate limited (using rate limit config from TwoFactorAuthSettings). Will return a Bad Request error if provider is not configured for usage, and Too Many Requests error if rate limits are exceeded. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.request_two_fa_verification_code_using_post_with_http_info(provider_type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str provider_type: providerType (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['provider_type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method request_two_fa_verification_code_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'provider_type' is set + if ('provider_type' not in params or + params['provider_type'] is None): + raise ValueError("Missing the required parameter `provider_type` when calling `request_two_fa_verification_code_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'provider_type' in params: + query_params.append(('providerType', params['provider_type'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/auth/2fa/verification/send{?providerType}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/ui_settings_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/ui_settings_controller_api.py new file mode 100644 index 0000000..54b6959 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/ui_settings_controller_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UiSettingsControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_help_base_url_using_get(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_help_base_url_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_help_base_url_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get UI help base url (getHelpBaseUrl) # noqa: E501 + + Get UI help base url used to fetch help assets. The actual value of the base url is configurable in the system configuration file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_help_base_url_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_help_base_url_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/uiSettings/helpBaseUrl', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/usage_info_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/usage_info_controller_api.py new file mode 100644 index 0000000..998b596 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/usage_info_controller_api.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UsageInfoControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_tenant_usage_info_using_get(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_tenant_usage_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_tenant_usage_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """getTenantUsageInfo # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_usage_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UsageInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_usage_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/usage', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UsageInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/user_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/user_controller_api.py new file mode 100644 index 0000000..36b6ebc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/user_controller_api.py @@ -0,0 +1,2942 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UserControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_user_settings_using_delete(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete_with_http_info(paths, type, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete_with_http_info(self, paths, type, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete_with_http_info(paths, type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths', 'type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete`") # noqa: E501 + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `delete_user_settings_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_settings_using_delete1(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_settings_using_delete1_with_http_info(paths, **kwargs) # noqa: E501 + return data + + def delete_user_settings_using_delete1_with_http_info(self, paths, **kwargs): # noqa: E501 + """Delete user settings (deleteUserSettings) # noqa: E501 + + Delete user settings by specifying list of json element xpaths. Example: to delete B and C element in { \"A\": {\"B\": 5}, \"C\": 15} send A.B,C in jsonPaths request parameter # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_settings_using_delete1_with_http_info(paths, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str paths: paths (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['paths'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_settings_using_delete1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'paths' is set + if ('paths' not in params or + params['paths'] is None): + raise ValueError("Missing the required parameter `paths` when calling `delete_user_settings_using_delete1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'paths' in params: + path_params['paths'] = params['paths'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{paths}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def delete_user_using_delete(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_user_using_delete_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def delete_user_using_delete_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Delete User (deleteUser) # noqa: E501 + + Deletes the User, it's credentials and all the relations (from and to the User). Referencing non-existing User Id will cause an error. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_user_using_delete_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `delete_user_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def find_users_by_query_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.find_users_by_query_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def find_users_by_query_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Find users by query (findUsersByQuery) # noqa: E501 + + Returns page of user data objects. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.find_users_by_query_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_users_by_query_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `find_users_by_query_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `find_users_by_query_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/info{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_activation_link_using_get(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_activation_link_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_activation_link_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get the activation link (getActivationLink) # noqa: E501 + + Get the activation link for the user. The base url for activation link is configurable in the general settings of system administrator. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_activation_link_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: str + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_activation_link_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_activation_link_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['text/plain']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/activationLink', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='str', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_customer_users_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users for the current tenant with authority 'CUSTOMER_USER'. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_users_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_customer_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_customer_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_customer_users_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users for the current tenant with authority 'CUSTOMER_USER'. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_customer_users_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_customer_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_customer_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_all_user_infos_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get All User Infos for current user (getAllUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_user_infos_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_all_user_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_all_user_infos_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_all_user_infos_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get All User Infos for current user (getAllUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the tenant or the customer of a current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_all_user_infos_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_all_user_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_all_user_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_all_user_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/userInfos/all{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_user_infos_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer user Infos (getCustomerUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_user_infos_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_user_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_user_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_user_infos_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer user Infos (getCustomerUserInfos) # noqa: E501 + + Returns a page of user info objects owned by the specified customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_user_infos_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param bool include_customers: Include customer or sub-customer entities + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'include_customers', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_user_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_user_infos_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_user_infos_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_user_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'include_customers' in params: + query_params.append(('includeCustomers', params['include_customers'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/userInfos{?includeCustomers,page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_customer_users_using_get(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_customer_users_using_get_with_http_info(customer_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_customer_users_using_get_with_http_info(self, customer_id, page_size, page, **kwargs): # noqa: E501 + """Get Customer Users (getCustomerUsers) # noqa: E501 + + Returns a page of users owned by customer. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_customer_users_using_get_with_http_info(customer_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str customer_id: A string value representing the customer id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['customer_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_customer_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'customer_id' is set + if ('customer_id' not in params or + params['customer_id'] is None): + raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_customer_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_customer_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'customer_id' in params: + path_params['customerId'] = params['customer_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/customer/{customerId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_tenant_admins_using_get(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_tenant_admins_using_get_with_http_info(self, tenant_id, page_size, page, **kwargs): # noqa: E501 + """Get Tenant Users (getTenantAdmins) # noqa: E501 + + Returns a page of users owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_tenant_admins_using_get_with_http_info(tenant_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str tenant_id: A string value representing the tenant id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['tenant_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_tenant_admins_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'tenant_id' is set + if ('tenant_id' not in params or + params['tenant_id'] is None): + raise ValueError("Missing the required parameter `tenant_id` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_tenant_admins_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_tenant_admins_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'tenant_id' in params: + path_params['tenantId'] = params['tenant_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/tenant/{tenantId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_by_id_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_by_id_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User (getUserById) # noqa: E501 + + Fetch the User object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_by_id_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_dashboards_info_using_get(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_dashboards_info_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_dashboards_info_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get information about last visited and starred dashboards (getLastVisitedDashboards) # noqa: E501 + + Fetch the list of last visited and starred dashboards. Both lists are limited to 10 items. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_dashboards_info_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_dashboards_info_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_info_by_id_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User info (getUserInfoById) # noqa: E501 + + Fetch the User info object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_info_by_id_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: UserInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_info_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_info_by_id_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_info_by_id_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User info (getUserInfoById) # noqa: E501 + + Fetch the User info object based on the provided User Id. If the user has the authority of 'SYS_ADMIN', the server does not perform additional checks. If the user has the authority of 'TENANT_ADMIN', the server checks that the requested user is owned by the same tenant. If the user has the authority of 'CUSTOMER_USER', the server checks that the requested user is owned by the same customer. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_info_by_id_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: UserInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_info_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_info_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/info/{userId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_user_settings_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_settings_using_get1(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.get_user_settings_using_get1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def get_user_settings_using_get1_with_http_info(self, type, **kwargs): # noqa: E501 + """Get user settings (getUserSettings) # noqa: E501 + + Fetch the User settings based on authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_settings_using_get1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_settings_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `get_user_settings_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_token_using_get(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.get_user_token_using_get_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def get_user_token_using_get_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Get User Token (getUserToken) # noqa: E501 + + Returns the token of the User based on the provided User Id. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to get the token of any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to get the token of any customer user that belongs to the same tenant. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_token_using_get_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: JWTPair + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_token_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `get_user_token_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/token', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JWTPair', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_user_users_using_get(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of user objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_users_using_get(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_user_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_user_users_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_user_users_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Users (getUsers) # noqa: E501 + + Returns a page of user objects available for the current user. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_user_users_using_get_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_users_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_user_users_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_user_users_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_by_entity_group_id_using_get(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get users by Entity Group Id (getUsersByEntityGroupId) # noqa: E501 + + Returns a page of user objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_entity_group_id_using_get(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_by_entity_group_id_using_get_with_http_info(self, entity_group_id, page_size, page, **kwargs): # noqa: E501 + """Get users by Entity Group Id (getUsersByEntityGroupId) # noqa: E501 + + Returns a page of user objects that belongs to specified Entity Group Id. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for specified group. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_entity_group_id_using_get_with_http_info(entity_group_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str entity_group_id: A string value representing the Entity Group Id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUser + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['entity_group_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_by_entity_group_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'entity_group_id' is set + if ('entity_group_id' not in params or + params['entity_group_id'] is None): + raise ValueError("Missing the required parameter `entity_group_id` when calling `get_users_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_by_entity_group_id_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_by_entity_group_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'entity_group_id' in params: + path_params['entityGroupId'] = params['entity_group_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/entityGroup/{entityGroupId}/users{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUser', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_by_ids_using_get(self, user_ids, **kwargs): # noqa: E501 + """Get Users By Ids (getUsersByIds) # noqa: E501 + + Requested users must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_ids_using_get(user_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_ids: A list of user ids, separated by comma ',' (required) + :return: list[User] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_by_ids_using_get_with_http_info(user_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_users_by_ids_using_get_with_http_info(user_ids, **kwargs) # noqa: E501 + return data + + def get_users_by_ids_using_get_with_http_info(self, user_ids, **kwargs): # noqa: E501 + """Get Users By Ids (getUsersByIds) # noqa: E501 + + Requested users must be owned by tenant or assigned to customer which user is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_by_ids_using_get_with_http_info(user_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_ids: A list of user ids, separated by comma ',' (required) + :return: list[User] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_ids' is set + if ('user_ids' not in params or + params['user_ids'] is None): + raise ValueError("Missing the required parameter `user_ids` when calling `get_users_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'user_ids' in params: + query_params.append(('userIds', params['user_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users{?userIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[User]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_users_for_assign_using_get(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, **kwargs) # noqa: E501 + return data + + def get_users_for_assign_using_get_with_http_info(self, alarm_id, page_size, page, **kwargs): # noqa: E501 + """Get usersForAssign (getUsersForAssign) # noqa: E501 + + Returns page of user data objects that can be assigned to provided alarmId. Search is been executed by email, firstName and lastName fields. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_users_for_assign_using_get_with_http_info(alarm_id, page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str alarm_id: A string value representing the alarm id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the user email. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataUserEmailInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['alarm_id', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_users_for_assign_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'alarm_id' is set + if ('alarm_id' not in params or + params['alarm_id'] is None): + raise ValueError("Missing the required parameter `alarm_id` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_users_for_assign_using_get`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_users_for_assign_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'alarm_id' in params: + path_params['alarmId'] = params['alarm_id'] # noqa: E501 + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/users/assign/{alarmId}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataUserEmailInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_user_token_access_enabled_using_get(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_user_token_access_enabled_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_user_token_access_enabled_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Token Access Enabled (isUserTokenAccessEnabled) # noqa: E501 + + Checks that the system is configured to allow administrators to impersonate themself as other users. If the user who performs the request has the authority of 'SYS_ADMIN', it is possible to login as any tenant administrator. If the user who performs the request has the authority of 'TENANT_ADMIN', it is possible to login as any customer user. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_user_token_access_enabled_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_user_token_access_enabled_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/tokenAccessEnabled', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put_with_http_info(**kwargs) # noqa: E501 + return data + + def put_user_settings_using_put_with_http_info(self, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def put_user_settings_using_put1(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + else: + (data) = self.put_user_settings_using_put1_with_http_info(type, **kwargs) # noqa: E501 + return data + + def put_user_settings_using_put1_with_http_info(self, type, **kwargs): # noqa: E501 + """Update user settings (saveUserSettings) # noqa: E501 + + Update user settings for authorized user. Only specified json elements will be updated.Example: you have such settings: {A:5, B:{C:10, D:20}}. Updating it with {B:{C:10, D:30}} will result in{A:5, B:{C:10, D:30}}. The same could be achieved by putting {B.D:30} # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.put_user_settings_using_put1_with_http_info(type, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str type: Settings type, case insensitive, one of: \"general\", \"quick_links\", \"doc_links\" or \"dashboards\". (required) + :param JsonNode body: + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['type', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method put_user_settings_using_put1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'type' is set + if ('type' not in params or + params['type'] is None): + raise ValueError("Missing the required parameter `type` when calling `put_user_settings_using_put1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'type' in params: + path_params['type'] = params['type'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings/{type}', 'PUT', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def report_user_dashboard_action_using_get(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + else: + (data) = self.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, **kwargs) # noqa: E501 + return data + + def report_user_dashboard_action_using_get_with_http_info(self, dashboard_id, action, **kwargs): # noqa: E501 + """Report action of User over the dashboard (reportUserDashboardAction) # noqa: E501 + + Report action of User over the dashboard. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.report_user_dashboard_action_using_get_with_http_info(dashboard_id, action, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str dashboard_id: A string value representing the dashboard id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param str action: Dashboard action, one of: \"visit\", \"star\" or \"unstar\". (required) + :return: UserDashboardsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['dashboard_id', 'action'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method report_user_dashboard_action_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'dashboard_id' is set + if ('dashboard_id' not in params or + params['dashboard_id'] is None): + raise ValueError("Missing the required parameter `dashboard_id` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + # verify the required parameter 'action' is set + if ('action' not in params or + params['action'] is None): + raise ValueError("Missing the required parameter `action` when calling `report_user_dashboard_action_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'dashboard_id' in params: + path_params['dashboardId'] = params['dashboard_id'] # noqa: E501 + if 'action' in params: + path_params['action'] = params['action'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/dashboards/{dashboardId}/{action}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='UserDashboardsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_settings_using_post(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_settings_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_settings_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save user settings (saveUserSettings) # noqa: E501 + + Save user settings represented in json format for authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_settings_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param JsonNode body: + :return: JsonNode + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_settings_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/settings', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='JsonNode', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_user_using_post(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: User + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_user_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_user_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Save Or update User (saveUser) # noqa: E501 + + Create or update the User. When creating user, platform generates User Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created User Id will be present in the response. Specify existing User Id to update the device. Referencing non-existing User Id will cause 'Not Found' error. Device email is unique for entire platform setup. Remove 'id', 'tenantId' and optionally 'customerId' from the request body example (below) to create new User entity. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_user_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param User body: + :param bool send_activation_mail: Send activation email (or use activation link) + :param str entity_group_id: entityGroupId + :param str entity_group_ids: entityGroupIds + :return: User + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body', 'send_activation_mail', 'entity_group_id', 'entity_group_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_user_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'send_activation_mail' in params: + query_params.append(('sendActivationMail', params['send_activation_mail'])) # noqa: E501 + if 'entity_group_id' in params: + query_params.append(('entityGroupId', params['entity_group_id'])) # noqa: E501 + if 'entity_group_ids' in params: + query_params.append(('entityGroupIds', params['entity_group_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user{?entityGroupId,entityGroupIds,sendActivationMail}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='User', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def send_activation_email_using_post(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + else: + (data) = self.send_activation_email_using_post_with_http_info(email, **kwargs) # noqa: E501 + return data + + def send_activation_email_using_post_with_http_info(self, email, **kwargs): # noqa: E501 + """Send or re-send the activation email # noqa: E501 + + Force send the activation email to the user. Useful to resend the email if user has accidentally deleted it. Security check is performed to verify that the user has 'DELETE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.send_activation_email_using_post_with_http_info(email, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str email: Email of the user (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['email'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method send_activation_email_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'email' is set + if ('email' not in params or + params['email'] is None): + raise ValueError("Missing the required parameter `email` when calling `send_activation_email_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'email' in params: + query_params.append(('email', params['email'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/sendActivationMail{?email}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def set_user_credentials_enabled_using_post(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + else: + (data) = self.set_user_credentials_enabled_using_post_with_http_info(user_id, **kwargs) # noqa: E501 + return data + + def set_user_credentials_enabled_using_post_with_http_info(self, user_id, **kwargs): # noqa: E501 + """Enable/Disable User credentials (setUserCredentialsEnabled) # noqa: E501 + + Enables or Disables user credentials. Useful when you would like to block user account without deleting it. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. Security check is performed to verify that the user has 'WRITE' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.set_user_credentials_enabled_using_post_with_http_info(user_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str user_id: A string value representing the user id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :param bool user_credentials_enabled: Disable (\"true\") or enable (\"false\") the credentials. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['user_id', 'user_credentials_enabled'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method set_user_credentials_enabled_using_post" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'user_id' is set + if ('user_id' not in params or + params['user_id'] is None): + raise ValueError("Missing the required parameter `user_id` when calling `set_user_credentials_enabled_using_post`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'user_id' in params: + path_params['userId'] = params['user_id'] # noqa: E501 + + query_params = [] + if 'user_credentials_enabled' in params: + query_params.append(('userCredentialsEnabled', params['user_credentials_enabled'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/user/{userId}/userCredentialsEnabled{?userCredentialsEnabled}', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/user_permissions_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/user_permissions_controller_api.py new file mode 100644 index 0000000..8ea1681 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/user_permissions_controller_api.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class UserPermissionsControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_allowed_permissions_using_get(self, **kwargs): # noqa: E501 + """Get Permissions (getAllowedPermissions) # noqa: E501 + + Returns a complex object that describes: * all possible (both granted and not granted) permissions for the authority of the user (Tenant or Customer); * all granted permissions for the user; The result impacts UI behavior and hides certain UI elements if user has no permissions to invoke the related operations. Nevertheless, all API calls check the permissions each time they are executed on the server side.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_allowed_permissions_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AllowedPermissionsInfo + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_allowed_permissions_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_allowed_permissions_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_allowed_permissions_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Permissions (getAllowedPermissions) # noqa: E501 + + Returns a complex object that describes: * all possible (both granted and not granted) permissions for the authority of the user (Tenant or Customer); * all granted permissions for the user; The result impacts UI behavior and hides certain UI elements if user has no permissions to invoke the related operations. Nevertheless, all API calls check the permissions each time they are executed on the server side.You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_allowed_permissions_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: AllowedPermissionsInfo + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_allowed_permissions_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/permissions/allowedPermissions', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='AllowedPermissionsInfo', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/white_labeling_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/white_labeling_controller_api.py new file mode 100644 index 0000000..336f83c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/white_labeling_controller_api.py @@ -0,0 +1,870 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WhiteLabelingControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_current_login_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get Login White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the Login White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the Login White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_login_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_login_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Login White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the Login White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the Login White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_login_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_login_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/currentLoginWhiteLabelParams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginWhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_current_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_current_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_current_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_current_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get White Labeling configuration (getCurrentWhiteLabelParams) # noqa: E501 + + Fetch the White Labeling configuration that corresponds to the authority of the user. The API call is designed to load the White Labeling configuration for edition. So, the result is NOT merged with the parent level White Labeling configuration. Let's assume there is a custom White Labeling configured on a system level. And there is no custom White Labeling items configured on a tenant level. In such a case, the API call will return default object for the tenant administrator. Security check is performed to verify that the user has 'READ' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_current_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_current_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/currentWhiteLabelParams', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_login_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get Login White Labeling parameters # noqa: E501 + + Returns login white-labeling parameters based on the hostname from request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_login_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_login_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get Login White Labeling parameters # noqa: E501 + + Returns login white-labeling parameters based on the hostname from request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_login_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['logo_image_checksum', 'favicon_checksum'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_login_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'logo_image_checksum' in params: + query_params.append(('logoImageChecksum', params['logo_image_checksum'])) # noqa: E501 + if 'favicon_checksum' in params: + query_params.append(('faviconChecksum', params['favicon_checksum'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/api/noauth/whiteLabel/loginWhiteLabelParams{?faviconChecksum,logoImageChecksum}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginWhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_white_label_params_using_get(self, **kwargs): # noqa: E501 + """Get White Labeling parameters # noqa: E501 + + Returns white-labeling parameters for the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_white_label_params_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_white_label_params_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_white_label_params_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get White Labeling parameters # noqa: E501 + + Returns white-labeling parameters for the current user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_white_label_params_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str logo_image_checksum: Logo image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'logoImageUrl' will be null. + :param str favicon_checksum: Favicon image checksum. Expects value from the browser cache to compare it with the value from settings. If value matches, the 'faviconImageUrl' will be null. + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['logo_image_checksum', 'favicon_checksum'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_white_label_params_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'logo_image_checksum' in params: + query_params.append(('logoImageChecksum', params['logo_image_checksum'])) # noqa: E501 + if 'favicon_checksum' in params: + query_params.append(('faviconChecksum', params['favicon_checksum'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/whiteLabelParams{?faviconChecksum,logoImageChecksum}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_customer_white_labeling_allowed_using_get(self, **kwargs): # noqa: E501 + """Check Customer White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the customers of the current tenant Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_customer_white_labeling_allowed_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_customer_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_customer_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_customer_white_labeling_allowed_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check Customer White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the customers of the current tenant Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_customer_white_labeling_allowed_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_customer_white_labeling_allowed_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/isCustomerWhiteLabelingAllowed', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def is_white_labeling_allowed_using_get(self, **kwargs): # noqa: E501 + """Check White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the current user owner (tenant or customer) Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_white_labeling_allowed_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.is_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.is_white_labeling_allowed_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def is_white_labeling_allowed_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Check White Labeling Allowed # noqa: E501 + + Check if the White Labeling is enabled for the current user owner (tenant or customer) Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.is_white_labeling_allowed_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: bool + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method is_white_labeling_allowed_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/isWhiteLabelingAllowed', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='bool', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def preview_white_label_params_using_post(self, **kwargs): # noqa: E501 + """Preview Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Merge the White Labeling configuration with the parent configuration and return the result. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.preview_white_label_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.preview_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.preview_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def preview_white_label_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Preview Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Merge the White Labeling configuration with the parent configuration and return the result. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.preview_white_label_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method preview_white_label_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/previewWhiteLabelParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_login_white_label_params_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_login_white_label_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginWhiteLabelingParams body: + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_login_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_login_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_login_white_label_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Login White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_login_white_label_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param LoginWhiteLabelingParams body: + :return: LoginWhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_login_white_label_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/loginWhiteLabelParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LoginWhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_white_label_params_using_post(self, **kwargs): # noqa: E501 + """Create Or Update White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_white_label_params_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_white_label_params_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_white_label_params_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update White Labeling configuration (saveWhiteLabelParams) # noqa: E501 + + Creates or Updates the White Labeling configuration. Security check is performed to verify that the user has 'WRITE' permission for the white labeling resource. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_white_label_params_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WhiteLabelingParams body: + :return: WhiteLabelingParams + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_white_label_params_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/whiteLabel/whiteLabelParams', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WhiteLabelingParams', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/widget_type_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/widget_type_controller_api.py new file mode 100644 index 0000000..de5b239 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/widget_type_controller_api.py @@ -0,0 +1,752 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetTypeControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widget_type_using_delete(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widget_type_using_delete_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def delete_widget_type_using_delete_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Delete widget type (deleteWidgetType) # noqa: E501 + + Deletes the Widget Type. Referencing non-existing Widget Type Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widget_type_using_delete_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widget_type_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `delete_widget_type_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_details_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_details_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types details for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type Details objects that belong to specified Widget Bundle.Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_details_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeDetails] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_details_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_details_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesDetails{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeDetails]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_infos_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_infos_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get Widget Type Info objects (getBundleWidgetTypesInfos) # noqa: E501 + + Get the Widget Type Info objects based on the provided parameters. Widget Type Info is a lightweight object that represents Widget Type but does not contain the heavyweight widget descriptor JSON Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_infos_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetTypeInfo] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_infos_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_infos_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypesInfos{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetTypeInfo]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_bundle_widget_types_using_get(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + else: + (data) = self.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, **kwargs) # noqa: E501 + return data + + def get_bundle_widget_types_using_get_with_http_info(self, is_system, bundle_alias, **kwargs): # noqa: E501 + """Get all Widget types for specified Bundle (getBundleWidgetTypes) # noqa: E501 + + Returns an array of Widget Type objects that belong to specified Widget Bundle.Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_bundle_widget_types_using_get_with_http_info(is_system, bundle_alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :return: list[WidgetType] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_bundle_widget_types_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_bundle_widget_types_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetTypes{?bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetType]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_by_id_using_get(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_by_id_using_get_with_http_info(widget_type_id, **kwargs) # noqa: E501 + return data + + def get_widget_type_by_id_using_get_with_http_info(self, widget_type_id, **kwargs): # noqa: E501 + """Get Widget Type Details (getWidgetTypeById) # noqa: E501 + + Get the Widget Type Details based on the provided Widget Type Id. Widget Type Details extend Widget Type and add image and description properties. Those properties are useful to edit the Widget Type but they are not required for Dashboard rendering. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_by_id_using_get_with_http_info(widget_type_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widget_type_id: A string value representing the widget type id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widget_type_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widget_type_id' is set + if ('widget_type_id' not in params or + params['widget_type_id'] is None): + raise ValueError("Missing the required parameter `widget_type_id` when calling `get_widget_type_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widget_type_id' in params: + path_params['widgetTypeId'] = params['widget_type_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType/{widgetTypeId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widget_type_using_get(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + else: + (data) = self.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, **kwargs) # noqa: E501 + return data + + def get_widget_type_using_get_with_http_info(self, is_system, bundle_alias, alias, **kwargs): # noqa: E501 + """Get Widget Type (getWidgetType) # noqa: E501 + + Get the Widget Type based on the provided parameters. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widget_type_using_get_with_http_info(is_system, bundle_alias, alias, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param bool is_system: System or Tenant (required) + :param str bundle_alias: Widget Bundle alias (required) + :param str alias: Widget Type alias (required) + :return: WidgetType + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['is_system', 'bundle_alias', 'alias'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widget_type_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'is_system' is set + if ('is_system' not in params or + params['is_system'] is None): + raise ValueError("Missing the required parameter `is_system` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'bundle_alias' is set + if ('bundle_alias' not in params or + params['bundle_alias'] is None): + raise ValueError("Missing the required parameter `bundle_alias` when calling `get_widget_type_using_get`") # noqa: E501 + # verify the required parameter 'alias' is set + if ('alias' not in params or + params['alias'] is None): + raise ValueError("Missing the required parameter `alias` when calling `get_widget_type_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'is_system' in params: + query_params.append(('isSystem', params['is_system'])) # noqa: E501 + if 'bundle_alias' in params: + query_params.append(('bundleAlias', params['bundle_alias'])) # noqa: E501 + if 'alias' in params: + query_params.append(('alias', params['alias'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType{?alias,bundleAlias,isSystem}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetType', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widget_type_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widget_type_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widget_type_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Type (saveWidgetType) # noqa: E501 + + Create or update the Widget Type. Widget Type represents the template for widget creation. Widget Type and Widget are similar to class and object in OOP theory. When creating the Widget Type, platform generates Widget Type Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Type Id will be present in the response. Specify existing Widget Type id to update the Widget Type. Referencing non-existing Widget Type Id will cause 'Not Found' error. Widget Type alias is unique in the scope of Widget Bundle. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' rom the request body example (below) to create new Widget Type entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widget_type_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetTypeDetails body: + :return: WidgetTypeDetails + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widget_type_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetType', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetTypeDetails', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api/api_pe/widgets_bundle_controller_api.py b/tb-rest-client/python/tb_rest_client/api/api_pe/widgets_bundle_controller_api.py new file mode 100644 index 0000000..b47738c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api/api_pe/widgets_bundle_controller_api.py @@ -0,0 +1,629 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from tb_rest_client.api_client import ApiClient + + +class WidgetsBundleControllerApi(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def delete_widgets_bundle_using_delete(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def delete_widgets_bundle_using_delete_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Delete widgets bundle (deleteWidgetsBundle) # noqa: E501 + + Deletes the widget bundle. Referencing non-existing Widget Bundle Id will cause an error. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.delete_widgets_bundle_using_delete_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_widgets_bundle_using_delete" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `delete_widgets_bundle_using_delete`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundle_by_id_using_get(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, **kwargs) # noqa: E501 + return data + + def get_widgets_bundle_by_id_using_get_with_http_info(self, widgets_bundle_id, **kwargs): # noqa: E501 + """Get Widget Bundle (getWidgetsBundleById) # noqa: E501 + + Get the Widget Bundle based on the provided Widget Bundle Id. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundle_by_id_using_get_with_http_info(widgets_bundle_id, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_id: A string value representing the widget bundle id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundle_by_id_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_id' is set + if ('widgets_bundle_id' not in params or + params['widgets_bundle_id'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_id` when calling `get_widgets_bundle_by_id_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'widgets_bundle_id' in params: + path_params['widgetsBundleId'] = params['widgets_bundle_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle/{widgetsBundleId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_by_ids_using_get(self, widgets_bundle_ids, **kwargs): # noqa: E501 + """Get Widgets Bundles By Ids (getWidgetsBundlesByIds) # noqa: E501 + + Requested widgets bundles must be system level or owned by tenant of the user which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_by_ids_using_get(widgets_bundle_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_ids: A list of widgets bundle ids, separated by comma ',' (required) + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_by_ids_using_get_with_http_info(widgets_bundle_ids, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_by_ids_using_get_with_http_info(widgets_bundle_ids, **kwargs) # noqa: E501 + return data + + def get_widgets_bundles_by_ids_using_get_with_http_info(self, widgets_bundle_ids, **kwargs): # noqa: E501 + """Get Widgets Bundles By Ids (getWidgetsBundlesByIds) # noqa: E501 + + Requested widgets bundles must be system level or owned by tenant of the user which is performing the request. Security check is performed to verify that the user has 'READ' permission for the entity (entities). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_by_ids_using_get_with_http_info(widgets_bundle_ids, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param str widgets_bundle_ids: A list of widgets bundle ids, separated by comma ',' (required) + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['widgets_bundle_ids'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_by_ids_using_get" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'widgets_bundle_ids' is set + if ('widgets_bundle_ids' not in params or + params['widgets_bundle_ids'] is None): + raise ValueError("Missing the required parameter `widgets_bundle_ids` when calling `get_widgets_bundles_by_ids_using_get`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'widgets_bundle_ids' in params: + query_params.append(('widgetsBundleIds', params['widgets_bundle_ids'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles{?widgetsBundleIds}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetsBundle]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get_with_http_info(**kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get_with_http_info(self, **kwargs): # noqa: E501 + """Get all Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns an array of Widget Bundle objects that are available for current user.Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :return: list[WidgetsBundle] + If the method is called asynchronously, + returns the request thread. + """ + + all_params = [] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[WidgetsBundle]', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_widgets_bundles_using_get1(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + else: + (data) = self.get_widgets_bundles_using_get1_with_http_info(page_size, page, **kwargs) # noqa: E501 + return data + + def get_widgets_bundles_using_get1_with_http_info(self, page_size, page, **kwargs): # noqa: E501 + """Get Widget Bundles (getWidgetsBundles) # noqa: E501 + + Returns a page of Widget Bundle objects available for current user. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. Available for any authorized user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_widgets_bundles_using_get1_with_http_info(page_size, page, async_req=True) + >>> result = thread.get() + + :param async_req bool + :param int page_size: Maximum amount of entities in a one page (required) + :param int page: Sequence number of page starting from 0 (required) + :param str text_search: The case insensitive 'substring' filter based on the widget bundle title. + :param str sort_property: Property of entity to sort by + :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) + :return: PageDataWidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_widgets_bundles_using_get1" % key + ) + params[key] = val + del params['kwargs'] + # verify the required parameter 'page_size' is set + if ('page_size' not in params or + params['page_size'] is None): + raise ValueError("Missing the required parameter `page_size` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + # verify the required parameter 'page' is set + if ('page' not in params or + params['page'] is None): + raise ValueError("Missing the required parameter `page` when calling `get_widgets_bundles_using_get1`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'page_size' in params: + query_params.append(('pageSize', params['page_size'])) # noqa: E501 + if 'page' in params: + query_params.append(('page', params['page'])) # noqa: E501 + if 'text_search' in params: + query_params.append(('textSearch', params['text_search'])) # noqa: E501 + if 'sort_property' in params: + query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 + if 'sort_order' in params: + query_params.append(('sortOrder', params['sort_order'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundles{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='PageDataWidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def save_widgets_bundle_using_post(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('async_req'): + return self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + else: + (data) = self.save_widgets_bundle_using_post_with_http_info(**kwargs) # noqa: E501 + return data + + def save_widgets_bundle_using_post_with_http_info(self, **kwargs): # noqa: E501 + """Create Or Update Widget Bundle (saveWidgetsBundle) # noqa: E501 + + Create or update the Widget Bundle. Widget Bundle represents a group(bundle) of widgets. Widgets are grouped into bundle by type or use case. When creating the bundle, platform generates Widget Bundle Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Widget Bundle Id will be present in the response. Specify existing Widget Bundle id to update the Widget Bundle. Referencing non-existing Widget Bundle Id will cause 'Not Found' error. Widget Bundle alias is unique in the scope of tenant. Special Tenant Id '13814000-1dd2-11b2-8080-808080808080' is automatically used if the create bundle request is sent by user with 'SYS_ADMIN' authority.Remove 'id', 'tenantId' from the request body example (below) to create new Widgets Bundle entity. Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.save_widgets_bundle_using_post_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req bool + :param WidgetsBundle body: + :return: WidgetsBundle + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in six.iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method save_widgets_bundle_using_post" % key + ) + params[key] = val + del params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['X-Authorization'] # noqa: E501 + + return self.api_client.call_api( + '/api/widgetsBundle', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='WidgetsBundle', # noqa: E501 + auth_settings=auth_settings, + async_req=params.get('async_req'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/tb-rest-client/python/tb_rest_client/api_client.py b/tb-rest-client/python/tb_rest_client/api_client.py new file mode 100644 index 0000000..d9512b8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/api_client.py @@ -0,0 +1,705 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import + +import datetime +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import quote + +from tb_rest_client.configuration import Configuration +import tb_rest_client.models.models_ce +import tb_rest_client.models.models_pe +from tb_rest_client import rest + + +class ApiClient(object): + """ + :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 + """ + + PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int if six.PY3 else long, # noqa: F821 + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None): + if configuration is None: + configuration = Configuration() + self.configuration = configuration + + # Use the pool property to lazily initialize the ThreadPool. + self._pool = None + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'Swagger-Codegen/1.0.0/python' + + def __del__(self): + if self._pool is not None: + self._pool.close() + self._pool.join() + + @property + def pool(self): + if self._pool is None: + self._pool = ThreadPool() + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + 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)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + if isinstance(v, dict) and v.get("entityType") is not None and v.get('id') is not None: + v = v["id"] + # specified safe chars, encode everything + if v is not None: + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + '{?%s}' % k, + quote(str("?"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + '{?%s,' % k, + quote(str("?"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + ',%s' % k, + quote(str("&"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + ',?%s' % k, + quote(str("&"+k+"="+v) if v is not None else "", safe=config.safe_chars_for_path_param) + ).replace( + ',%s}' % k, + quote("}" + str(v) if v is not None else "", safe=config.safe_chars_for_path_param) + ) + # resource_path = resource_path.replace( + # '{%s}' % k, + # quote(str(k+"="+v), safe=config.safe_chars_for_path_param) + # ).replace( + # '{?%s}' % k, + # quote(str("?"+k+"="+v), safe=config.safe_chars_for_path_param) + # ).replace( + # '{?%s,' % k, + # quote(str("?"+k+"="+v) + "{", safe=config.safe_chars_for_path_param) + # ).replace( + # ',%s,' % k, + # quote("}" + str("&"+k+"="+v) + "{", safe=config.safe_chars_for_path_param) + # ).replace( + # ',?%s,' % k, + # quote("}" + str("&"+k+"="+v) + "{", safe=config.safe_chars_for_path_param) + # ).replace( + # ',%s}' % k, + # 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 = [param for param in query_params if (isinstance(param, tuple) and len(param) > 1 and param[1] is not None) or not isinstance(param, tuple)] + query_params = self.parameters_to_tuples(query_params, + collection_formats) + + # post parameters + if post_params or files: + post_params = self.prepare_post_parameters(post_params, files) + post_params = [param for param in post_params if (isinstance(param, tuple) and len(param) > 1 and param[1] is not None) or not isinstance(param, tuple)] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + + # auth setting + self.update_params_for_auth(header_params, query_params, auth_settings) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + clean_path = self.sanitize_path(resource_path) + url = self.configuration.host + clean_path + + # perform request and return response + response_data = 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) + + self.last_response = response_data + + return_data = response_data + if _preload_content: + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return (return_data) + else: + return (return_data, response_data.status, + response_data.getheaders()) + + def sanitize_path(self, url): + pattern = r'(\{[\?a-zA-Z,]{1,}\})' + matching = re.search(pattern, url) + if matching is not None and len(matching.groups()) > 0: + for match in matching.groups(): + clean_url = url.replace(match, "") + else: + clean_url = url + return clean_url + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + If obj is None, return None. + 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 list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is swagger model, return the properties dict. + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + 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() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `swagger_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.swagger_types) + if getattr(obj, attr) is not None} + + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + 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 data is None: + return None + + if "Deferred" in str(klass): + return self.__deserialize(data, type(data)) + # + # elif type(klass) == str: + # # convert str to class + elif klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + elif klass == list: + return_data = [self.__deserialize(sub_data, type(sub_data)) + for sub_data in data] + return return_data + + elif klass == dict: + return_data = {k: self.__deserialize(v, type(v)) + for k, v in six.iteritems(data)} + return return_data + elif type(klass) == str: + if klass.startswith('list['): + sub_kls = re.match(r'list\[(.*)\]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('dict('): + sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + try: + found_class = getattr(tb_rest_client.models.models_pe, klass) + if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())): + klass = found_class + + # if all(attr in list(found_class.attribute_map.values()) for attr in list(data.keys())): + # klass = found_class + else: + found_class = getattr(tb_rest_client.models.models_ce, klass) + # if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())): + klass = found_class + + except AttributeError: + try: + found_class = getattr(tb_rest_client.models.models_ce, klass) + # if all(attr in list(found_class.attribute_map.values()) for attr in list(data.keys())): + # if sorted(list(found_class.attribute_map.values())) == sorted(list(data.keys())): + klass = found_class + except AttributeError: + print('WARNING: received data fields not the same as in the {0} model (dyn fields problem)'.format( + klass)) + found_class = getattr(tb_rest_client.models.models_pe, klass) + klass = found_class + # else: + # return self.__deserialize(data, type(data)) + return self.__deserialize_data(data, klass) + + def __deserialize_data(self, data, klass): + try: + 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_datatime(data) + else: + return self.__deserialize_model(data, klass) + except Exception as e: + return e + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + To make an async request, set the async_req parameter. + :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: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :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. + """ + 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) + else: + thread = 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)) + return thread + + 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) + else: + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, 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(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def prepare_post_parameters(self, post_params=None, files=None): + """Builds form parameters. + :param post_params: Normal form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if post_params: + params = post_params + + if files: + for k, v in six.iteritems(files): + if not v or k in ['attribute_map', 'discriminator']: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + 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): + """Returns `Accept` based on an array of accepts provided. + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + accepts = [x.lower() for x in accepts] + + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) + + 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. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return 'application/json' + + content_types = [x.lower() for x in content_types] + + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] + + def update_params_for_auth(self, headers, querys, auth_settings): + """Updates header and query params based on authentication setting. + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + """ + if not auth_settings: + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + if not auth_setting['value']: + continue + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + :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: + 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: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + :param data: str. + :param klass: class literal. + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return six.text_type(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return a original value. + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + :param string: str. + :return: date. + """ + try: + from dateutil.parser import parse + 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) + ) + + def __deserialize_datatime(self, string): + """Deserializes string to datetime. + The string should be in iso8601 datetime format. + :param string: str. + :return: datetime. + """ + try: + from dateutil.parser import parse + 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 __hasattr(self, object, name): + return name in object.__class__.__dict__ + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + if (not klass.swagger_types and + not self.__hasattr(klass, 'get_real_child_model')): + return data + + kwargs = {} + if klass.swagger_types is not None: + for attr, attr_type in six.iteritems(klass.swagger_types): + if (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): + value = data[klass.attribute_map[attr]] + kwargs[attr] = self.__deserialize(value, attr_type) + + instance = klass(**kwargs) + + if (isinstance(instance, dict) and + klass.swagger_types is not None and + isinstance(data, dict)): + for key, value in data.items(): + if key not in klass.swagger_types: + instance[key] = value + if self.__hasattr(instance, 'get_real_child_model'): + klass_name = instance.get_real_child_model(data) + if klass_name: + instance = self.__deserialize(data, klass_name) + return instance \ No newline at end of file diff --git a/tb-rest-client/python/tb_rest_client/configuration.py b/tb-rest-client/python/tb_rest_client/configuration.py new file mode 100644 index 0000000..b7d8846 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/configuration.py @@ -0,0 +1,234 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import six +from six.moves import http_client as httplib + + +class Configuration(object): + _default = None + + def __init__(self): + """Constructor""" + if self._default: + for key in self._default.__dict__.keys(): + self.__dict__[key] = copy.copy(self._default.__dict__[key]) + return + + # Default Base url + self.host = "http://127.0.0.1:8080" + # Temp file folder for downloading files + self.temp_folder_path = None + + # Authentication Settings + # dict to store API key(s) + self.api_key = {} + # dict to store API prefix (e.g. Bearer) + self.api_key_prefix = {} + # function to refresh API key if expired + self.refresh_api_key_hook = None + # Username for HTTP basic authentication + self.username = "" + # Password for HTTP basic authentication + self.password = "" + + # Logging Settings + self.logger = {} + self.logger["package_logger"] = logging.getLogger("tb_rest_client") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + # Log format + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + # Log stream handler + self.logger_stream_handler = None + # Log file handler + self.logger_file_handler = None + # Debug file location + self.logger_file = None + # Debug switch + self.debug = False + + # SSL/TLS verification + # Set this to false to skip verifying SSL certificate when calling API + # from https server. + self.verify_ssl = True + # Set this to customize the certificate file to verify the peer. + self.ssl_ca_cert = None + # client certificate file + self.cert_file = None + # client key file + self.key_file = None + # Set this to True/False to enable/disable SSL hostname verification. + self.assert_hostname = None + + # 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 = multiprocessing.cpu_count() * 5 + + # Proxy URL + self.proxy = None + # Safe chars for path_param + self.safe_chars_for_path_param = '' + + @classmethod + def set_default(cls, default): + cls._default = default + + @property + def logger_file(self): + """The logger file. + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_file_handler) + if self.logger_stream_handler: + logger.removeHandler(self.logger_stream_handler) + else: + # If not set logging file, + # then add stream handler and remove file handler. + self.logger_stream_handler = logging.StreamHandler() + self.logger_stream_handler.setFormatter(self.logger_formatter) + for _, logger in six.iteritems(self.logger): + logger.addHandler(self.logger_stream_handler) + if self.logger_file_handler: + logger.removeHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in six.iteritems(self.logger): + logger.setLevel(logging.DEBUG) + # 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 six.iteritems(self.logger): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + The logger_formatter will be updated when sets logger_format. + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + The logger_formatter will be updated when sets logger_format. + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier): + """Gets API key (with prefix if set). + :param identifier: The identifier of apiKey. + :return: The token for api_pe key authentication. + """ + + if self.refresh_api_key_hook: + self.refresh_api_key_hook(self) + + key = self.api_key.get(identifier) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + :return: The token for basic HTTP authentication. + """ + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api_pe client. + :return: The Auth Settings information dict. + """ + return { + 'X-Authorization': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'X-Authorization', + 'value': self.get_api_key_with_prefix('X-Authorization') + }, + + } + + def to_debug_report(self): + """Gets the essential information for debugging. + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n" \ + "OS: {env}\n" \ + "Python Version: {pyversion}\n" \ + "Version of the API: 2.0\n" \ + "SDK Package Version: 1.0.0". \ + format(env=sys.platform, pyversion=sys.version) diff --git a/tb-rest-client/python/tb_rest_client/models/__init__.py b/tb-rest-client/python/tb_rest_client/models/__init__.py new file mode 100644 index 0000000..5154646 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/tb-rest-client/python/tb_rest_client/models/__pycache__/__init__.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..92cf407 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/__pycache__/__init__.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__init__.py b/tb-rest-client/python/tb_rest_client/models/models_ce/__init__.py new file mode 100644 index 0000000..261f5c6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/__init__.py @@ -0,0 +1,394 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .default_device_profile_transport_configuration import DefaultDeviceProfileTransportConfiguration +from .json_node import JsonNode +from .page_data_edge import PageDataEdge +from .tenant_info import TenantInfo +from .admin_settings_id import AdminSettingsId +from .entity_data import EntityData +from .page_data_device import PageDataDevice +from .home_dashboard_info import HomeDashboardInfo +from .login_response import LoginResponse +from .widget_type import WidgetType +from .event_id import EventId +from .test_sms_request import TestSmsRequest +from .ota_package import OtaPackage +from .user import User +from .o_auth2_mobile_info import OAuth2MobileInfo +from .numeric_filter_predicate import NumericFilterPredicate +from .device_profile_alarm import DeviceProfileAlarm +from .ota_package_info import OtaPackageInfo +from .alarm_data import AlarmData +from .entity_id import EntityId +from .event import Event +from .complex_filter_predicate import ComplexFilterPredicate +from .edge_id import EdgeId +from .device_profile_data import DeviceProfileData +from .page_data_customer import PageDataCustomer +from .sign_up_request import SignUpRequest +from .save_ota_package_info_request import SaveOtaPackageInfoRequest +from .mqtt_device_transport_configuration import MqttDeviceTransportConfiguration +from .page_data_tb_resource_info import PageDataTbResourceInfo +from .home_dashboard import HomeDashboard +from .bulk_import_result_device import BulkImportResultDevice +from .device_search_query_filter import DeviceSearchQueryFilter +from .page_data_device_profile import PageDataDeviceProfile +from .dashboard_info import DashboardInfo +from .byte_buffer import ByteBuffer +from .entity_info import EntityInfo +from .edge import Edge +from .tenant import Tenant +from .entity_relations_query import EntityRelationsQuery +from .sms_provider_configuration import SmsProviderConfiguration +from .entity_relation_info import EntityRelationInfo +from .tenant_id import TenantId +from .filter_predicate_valueboolean import FilterPredicateValueboolean +from .component_descriptor import ComponentDescriptor +from .short_customer_info import ShortCustomerInfo +from .device_profile_info import DeviceProfileInfo +from .duration_alarm_condition_spec import DurationAlarmConditionSpec +from .o_auth2_registration_info import OAuth2RegistrationInfo +from .twilio_sms_provider_configuration import TwilioSmsProviderConfiguration +from .device_profile import DeviceProfile +from .lw_m2m_resource_observe import LwM2mResourceObserve +from .default_tenant_profile_configuration import DefaultTenantProfileConfiguration +from .check_pre_provisioned_devices_device_profile_provision_configuration import \ + CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration +from .page_data_dashboard_info import PageDataDashboardInfo +from .alarm_info import AlarmInfo +from .asset import Asset +from .o_auth2_client_info import OAuth2ClientInfo +from .page_data_user import PageDataUser +from .boolean_filter_predicate import BooleanFilterPredicate +from .rule_chain_id import RuleChainId +from .admin_settings import AdminSettings +from .o_auth2_client_registration_template import OAuth2ClientRegistrationTemplate +from .rule_node import RuleNode +from .other_configuration import OtherConfiguration +from .device_data import DeviceData +from .proto_transport_payload_configuration import ProtoTransportPayloadConfiguration +from .dashboard_id import DashboardId +from .change_password_request import ChangePasswordRequest +from .tenant_profile_data import TenantProfileData +from .device import Device +from .shared_attributes_setting_snmp_communication_config import SharedAttributesSettingSnmpCommunicationConfig +from .o_auth2_custom_mapper_config import OAuth2CustomMapperConfig +from .update_message import UpdateMessage +from .power_saving_configuration import PowerSavingConfiguration +from .ota_package_id import OtaPackageId +from .error_event_filter import ErrorEventFilter +from .alarm_schedule import AlarmSchedule +from .user_id import UserId +from .asset_type_filter import AssetTypeFilter +from .statistics_event_filter import StatisticsEventFilter +from .api_usage_state_filter import ApiUsageStateFilter +from .widgets_bundle_id import WidgetsBundleId +from .atomic_integer import AtomicInteger +from .security_settings import SecuritySettings +from .event_filter import EventFilter +from .lw_m2m_object import LwM2mObject +from .edge_search_query import EdgeSearchQuery +from .o_auth2_params_info import OAuth2ParamsInfo +from .entity_view_id import EntityViewId +from .alarm_condition_filter_key import AlarmConditionFilterKey +from .device_transport_configuration import DeviceTransportConfiguration +from .filter_predicate_valuedouble import FilterPredicateValuedouble +from .filter_predicate_valuestring import FilterPredicateValuestring +from .alarm_condition_filter import AlarmConditionFilter +from .alarm import Alarm +from .attributes_entity_view import AttributesEntityView +from .login_request import LoginRequest +from .entity_view import EntityView +from .page_data_device_profile_info import PageDataDeviceProfileInfo +from .device_profile_provision_configuration import DeviceProfileProvisionConfiguration +from .specific_time_schedule import SpecificTimeSchedule +from .o_auth2_info import OAuth2Info +from .activate_user_request import ActivateUserRequest +from .resource import Resource +from .default_device_transport_configuration import DefaultDeviceTransportConfiguration +from .telemetry_mapping_configuration import TelemetryMappingConfiguration +from .default_device_profile_configuration import DefaultDeviceProfileConfiguration +from .any_time_schedule import AnyTimeSchedule +from .page_data_tenant import PageDataTenant +from .allow_create_new_devices_device_profile_provision_configuration import \ + AllowCreateNewDevicesDeviceProfileProvisionConfiguration +from .to_device_rpc_request_snmp_communication_config import ToDeviceRpcRequestSnmpCommunicationConfig +from .default_device_configuration import DefaultDeviceConfiguration +from .widget_type_info import WidgetTypeInfo +from .entity_name_filter import EntityNameFilter +from .tb_resource_id import TbResourceId +from .efento_coap_device_type_configuration import EfentoCoapDeviceTypeConfiguration +from .edge_event import EdgeEvent +from .page_data_rule_chain import PageDataRuleChain +from .customer_id import CustomerId +from .snmp_device_transport_configuration import SnmpDeviceTransportConfiguration +from .alarm_rule import AlarmRule +from .key_filter import KeyFilter +from .client_attributes_querying_snmp_communication_config import ClientAttributesQueryingSnmpCommunicationConfig +from .rule_chain_import_result import RuleChainImportResult +from .input_stream import InputStream +from .edge_type_filter import EdgeTypeFilter +from .object_node import ObjectNode +from .device_configuration import DeviceConfiguration +from .entity_subtype import EntitySubtype +from .entity_key import EntityKey +from .device_type_filter import DeviceTypeFilter +from .edge_search_query_filter import EdgeSearchQueryFilter +from .save_device_with_credentials_request import SaveDeviceWithCredentialsRequest +from .bulk_import_result_edge import BulkImportResultEdge +from .lwm2m_device_transport_configuration import Lwm2mDeviceTransportConfiguration +from .response_entity import ResponseEntity +from .page_data_event import PageDataEvent +from .entity_list_filter import EntityListFilter +from .deferred_result_response_entity import DeferredResultResponseEntity +from .entity_type_filter import EntityTypeFilter +from .custom_time_schedule import CustomTimeSchedule +from .snmp_communication_config import SnmpCommunicationConfig +from .dashboard import Dashboard +from .rule_chain_meta_data import RuleChainMetaData +from .filter_predicate_valueint import FilterPredicateValueint +from .bulk_import_result_asset import BulkImportResultAsset +from .edge_event_id import EdgeEventId +from .column_mapping import ColumnMapping +from .claim_request import ClaimRequest +from .filter_predicate_valuelong import FilterPredicateValuelong +from .widget_type_id import WidgetTypeId +from .relations_search_parameters import RelationsSearchParameters +from .thingsboard_credentials_expired_response import ThingsboardCredentialsExpiredResponse +from .o_auth2_basic_mapper_config import OAuth2BasicMapperConfig +from .page_data_widgets_bundle import PageDataWidgetsBundle +from .simple_alarm_condition_spec import SimpleAlarmConditionSpec +from .rpc import Rpc +from .widgets_bundle import WidgetsBundle +from .rpc_id import RpcId +from .page_data_entity_info import PageDataEntityInfo +from .page_data_alarm_data import PageDataAlarmData +from .default_rule_chain_create_request import DefaultRuleChainCreateRequest +from .transport_payload_type_configuration import TransportPayloadTypeConfiguration +from .ts_value import TsValue +from .telemetry_querying_snmp_communication_config import TelemetryQueryingSnmpCommunicationConfig +from .device_profile_configuration import DeviceProfileConfiguration +from .page_data_asset import PageDataAsset +from .entity_data_query import EntityDataQuery +from .entity_count_query import EntityCountQuery +from .entity_view_search_query import EntityViewSearchQuery +from .o_auth2_domain_info import OAuth2DomainInfo +from .bulk_import_request import BulkImportRequest +from .node_connection_info import NodeConnectionInfo +from .entity_data_page_link import EntityDataPageLink +from .dynamic_valueint import DynamicValueint +from .thingsboard_error_response import ThingsboardErrorResponse +from .coap_device_transport_configuration import CoapDeviceTransportConfiguration +from .string_filter_predicate import StringFilterPredicate +from .snmp_mapping import SnmpMapping +from .mqtt_device_profile_transport_configuration import MqttDeviceProfileTransportConfiguration +from .device_credentials import DeviceCredentials +from .telemetry_entity_view import TelemetryEntityView +from .single_entity_filter import SingleEntityFilter +from .entity_view_search_query_filter import EntityViewSearchQueryFilter +from .disabled_device_profile_provision_configuration import DisabledDeviceProfileProvisionConfiguration +from .asset_search_query import AssetSearchQuery +from .entity_filter import EntityFilter +from .entity_view_type_filter import EntityViewTypeFilter +from .page_data_alarm_info import PageDataAlarmInfo +from .page_data_entity_data import PageDataEntityData +from .dynamic_valueboolean import DynamicValueboolean +from .page_data_tenant_info import PageDataTenantInfo +from .page_data_audit_log import PageDataAuditLog +from .tenant_profile_configuration import TenantProfileConfiguration +from .customer import Customer +from .dynamic_valuelong import DynamicValuelong +from .device_profile_transport_configuration import DeviceProfileTransportConfiguration +from .tb_resource_info import TbResourceInfo +from .widget_type_details import WidgetTypeDetails +from .object_attributes import ObjectAttributes +from .relation_entity_type_filter import RelationEntityTypeFilter +from .asset_search_query_filter import AssetSearchQueryFilter +from .reset_password_email_request import ResetPasswordEmailRequest +from .tenant_profile_id import TenantProfileId +from .tenant_profile import TenantProfile +from .key_filter_predicate import KeyFilterPredicate +from .o_auth2_mapper_config import OAuth2MapperConfig +from .default_coap_device_type_configuration import DefaultCoapDeviceTypeConfiguration +from .snmp_device_profile_transport_configuration import SnmpDeviceProfileTransportConfiguration +from .life_cycle_event_filter import LifeCycleEventFilter +from .relations_query_filter import RelationsQueryFilter +from .alarm_condition import AlarmCondition +from .rule_chain_data import RuleChainData +from .dynamic_valuedouble import DynamicValuedouble +from .dynamic_valuestring import DynamicValuestring +from .lw_m2m_instance import LwM2mInstance +from .repeating_alarm_condition_spec import RepeatingAlarmConditionSpec +from .page_data_tenant_profile import PageDataTenantProfile +from .custom_time_schedule_item import CustomTimeScheduleItem +from .mapping import Mapping +from .page_data_entity_view import PageDataEntityView +from .user_password_policy import UserPasswordPolicy +from .page_data_edge_event import PageDataEdgeEvent +from .device_id import DeviceId +from .aws_sns_sms_provider_configuration import AwsSnsSmsProviderConfiguration +from .lwm2m_device_profile_transport_configuration import Lwm2mDeviceProfileTransportConfiguration +from .component_descriptor_id import ComponentDescriptorId +from .entity_relation import EntityRelation +from .o_auth2_client_registration_template_id import OAuth2ClientRegistrationTemplateId +from .alarm_id import AlarmId +from .audit_log import AuditLog +from .alarm_data_page_link import AlarmDataPageLink +from .device_search_query import DeviceSearchQuery +from .debug_rule_chain_event_filter import DebugRuleChainEventFilter +from .alarm_data_query import AlarmDataQuery +from .alarm_condition_spec import AlarmConditionSpec +from .coap_device_type_configuration import CoapDeviceTypeConfiguration +from .reset_password_request import ResetPasswordRequest +from .asset_id import AssetId +from .tb_resource import TbResource +from .device_credentials_id import DeviceCredentialsId +from .rule_node_id import RuleNodeId +from .rule_chain_connection_info import RuleChainConnectionInfo +from .audit_log_id import AuditLogId +from .device_profile_id import DeviceProfileId +from .coap_device_profile_transport_configuration import CoapDeviceProfileTransportConfiguration +from .json_transport_payload_configuration import JsonTransportPayloadConfiguration +from .entity_data_sort_order import EntityDataSortOrder +from .page_data_ota_package_info import PageDataOtaPackageInfo +from .rule_chain import RuleChain +from .page_data_asset_info import PageDataAssetInfo +from .device_info import DeviceInfo +from .edge_info import EdgeInfo +from .page_data_entity_view_info import PageDataEntityViewInfo +from .page_data_edge_info import PageDataEdgeInfo +from .lw_m2_m_server_security_config_default import LwM2MServerSecurityConfigDefault +from .server_security_config import ServerSecurityConfig +from .no_sec_lw_m2_m_bootstrap_server_credential import NoSecLwM2MBootstrapServerCredential +from .rule_chain_output_labels_usage import RuleChainOutputLabelsUsage +from .asset_info import AssetInfo +from .page_data_device_info import PageDataDeviceInfo +from .entity_view_info import EntityViewInfo +from .x509_lw_m2_m_bootstrap_server_credential import X509LwM2MBootstrapServerCredential +from .lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential +from .queue import Queue +from .queue_id import QueueId +from .version_load_request import VersionLoadRequest +from .version_create_request import VersionCreateRequest +from .entity_export_dataobject import EntityExportDataobject +from .two_fa_account_config import TwoFaAccountConfig +from .two_fa_provider_config import TwoFaProviderConfig +from .transport_payload_type_configuration import TransportPayloadTypeConfiguration +from .version_creation_result import VersionCreationResult +from .entity_version import EntityVersion +from .version_load_result import VersionLoadResult +from .entity_type_load_result import EntityTypeLoadResult +from .entity_version import EntityVersion +from .complex_version_create_request import ComplexVersionCreateRequest +from .version_load_config import VersionLoadConfig +from .single_entity_version_load_request import SingleEntityVersionLoadRequest +from .entity_type_version_load_request import EntityTypeVersionLoadRequest +from .version_create_config import VersionCreateConfig +from .single_entity_version_create_request import SingleEntityVersionCreateRequest +from .entity_type_version_create_config import EntityTypeVersionCreateConfig +from .entity_type_version_load_config import EntityTypeVersionLoadConfig +from .repository_settings import RepositorySettings +from .deferred_result_repository_settings import DeferredResultRepositorySettings +from .deferred_result_void import DeferredResultVoid +from .auto_version_create_config import AutoVersionCreateConfig +from .platform_two_fa_settings import PlatformTwoFaSettings +from .account_two_fa_settings import AccountTwoFaSettings +from .two_fa_account_config_update_request import TwoFaAccountConfigUpdateRequest +from .two_fa_provider_info import TwoFaProviderInfo +from .entity_load_error import EntityLoadError +from .jwt_settings import JWTSettings +from .jwt_pair import JWTPair +from .alarm_comment import AlarmComment +from .alarm_comment_id import AlarmCommentId +from .alarm_comment_info import AlarmCommentInfo +from .alarm_assignee import AlarmAssignee +from .alarm_assignment_notification_rule_trigger_config import AlarmAssignmentNotificationRuleTriggerConfig +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .alarm_count_query import AlarmCountQuery +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .all_users_filter import AllUsersFilter +from .api_usage_limit_notification_rule_trigger_config import ApiUsageLimitNotificationRuleTriggerConfig +from .asset_profile import AssetProfile +from .asset_profile_id import AssetProfileId +from .asset_profile_info import AssetProfileInfo +from .clear_rule import ClearRule +from .comparison_ts_value import ComparisonTsValue +from .customer_users_filter import CustomerUsersFilter +from .delivery_method_notification_template import DeliveryMethodNotificationTemplate +from .device_activity_notification_rule_trigger_config import DeviceActivityNotificationRuleTriggerConfig +from .edge_install_instructions import EdgeInstallInstructions +from .email_delivery_method_notification_template import EmailDeliveryMethodNotificationTemplate +from .entities_limit_notification_rule_trigger_config import EntitiesLimitNotificationRuleTriggerConfig +from .entity_action_notification_rule_trigger_config import EntityActionNotificationRuleTriggerConfig +from .escalated_notification_rule_recipients_config import EscalatedNotificationRuleRecipientsConfig +from .event_info import EventInfo +from .features_info import FeaturesInfo +from .last_visited_dashboard_info import LastVisitedDashboardInfo +from .new_platform_version_notification_rule_trigger_config import NewPlatformVersionNotificationRuleTriggerConfig +from .notification import Notification +from .notification_delivery_method_config import NotificationDeliveryMethodConfig +from .notification_id import NotificationId +from .notification_info import NotificationInfo +from .notification_request import NotificationRequest +from .notification_request_config import NotificationRequestConfig +from .notification_request_id import NotificationRequestId +from .notification_request_info import NotificationRequestInfo +from .notification_request_preview import NotificationRequestPreview +from .notification_request_stats import NotificationRequestStats +from .notification_rule import NotificationRule +from .notification_rule_config import NotificationRuleConfig +from .notification_rule_id import NotificationRuleId +from .notification_rule_info import NotificationRuleInfo +from .notification_rule_recipients_config import NotificationRuleRecipientsConfig +from .notification_rule_trigger_config import NotificationRuleTriggerConfig +from .notification_settings import NotificationSettings +from .notification_target import NotificationTarget +from .notification_target_config import NotificationTargetConfig +from .notification_target_id import NotificationTargetId +from .notification_template import NotificationTemplate +from .notification_template_config import NotificationTemplateConfig +from .notification_template_id import NotificationTemplateId +from .originator_entity_owner_users_filter import OriginatorEntityOwnerUsersFilter +from .page_data_alarm_comment_info import PageDataAlarmCommentInfo +from .page_data_asset_profile import PageDataAssetProfile +from .page_data_asset_profile_info import PageDataAssetProfileInfo +from .page_data_event_info import PageDataEventInfo +from .page_data_notification import PageDataNotification +from .page_data_notification_request_info import PageDataNotificationRequestInfo +from .page_data_notification_rule_info import PageDataNotificationRuleInfo +from .page_data_notification_target import PageDataNotificationTarget +from .page_data_notification_template import PageDataNotificationTemplate +from .page_data_user_email_info import PageDataUserEmailInfo +from .platform_users_notification_target_config import PlatformUsersNotificationTargetConfig +from .repository_settings_info import RepositorySettingsInfo +from .rule_chain_debug_event_filter import RuleChainDebugEventFilter +from .rule_engine_component_lifecycle_event_notification_rule_trigger_config import RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig +from .slack_conversation import SlackConversation +from .slack_delivery_method_notification_template import SlackDeliveryMethodNotificationTemplate +from .slack_notification_delivery_method_config import SlackNotificationDeliveryMethodConfig +from .slack_notification_target_config import SlackNotificationTargetConfig +from .sms_delivery_method_notification_template import SmsDeliveryMethodNotificationTemplate +from .starred_dashboard_info import StarredDashboardInfo +from .system_administrators_filter import SystemAdministratorsFilter +from .system_info import SystemInfo +from .system_info_data import SystemInfoData +from .tenant_administrators_filter import TenantAdministratorsFilter +from .usage_info import UsageInfo +from .user_dashboards_info import UserDashboardsInfo +from .user_email_info import UserEmailInfo +from .user_list_filter import UserListFilter +from .users_filter import UsersFilter +from .web_delivery_method_notification_template import WebDeliveryMethodNotificationTemplate +from .x509_certificate_chain_provision_configuration import X509CertificateChainProvisionConfiguration diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/__init__.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..1e8e07d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/__init__.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/account_two_fa_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/account_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..c4a408e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/account_two_fa_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/activate_user_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/activate_user_request.cpython-311.pyc new file mode 100644 index 0000000..289c9f8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/activate_user_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/admin_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/admin_settings.cpython-311.pyc new file mode 100644 index 0000000..8738ce4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/admin_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/admin_settings_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/admin_settings_id.cpython-311.pyc new file mode 100644 index 0000000..49c2067 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/admin_settings_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..7332586 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/affected_user_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/affected_user_filter.cpython-311.pyc new file mode 100644 index 0000000..a3e4ec8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/affected_user_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm.cpython-311.pyc new file mode 100644 index 0000000..8b5bb3b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignee.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignee.cpython-311.pyc new file mode 100644 index 0000000..20f8ba7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignee.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..ae29854 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment.cpython-311.pyc new file mode 100644 index 0000000..cc4883a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_id.cpython-311.pyc new file mode 100644 index 0000000..7ee5846 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_info.cpython-311.pyc new file mode 100644 index 0000000..9606541 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..49ea9a6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition.cpython-311.pyc new file mode 100644 index 0000000..23cb9eb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter.cpython-311.pyc new file mode 100644 index 0000000..af996dc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter_key.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter_key.cpython-311.pyc new file mode 100644 index 0000000..3c59f43 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_filter_key.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..3150e3d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_count_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_count_query.cpython-311.pyc new file mode 100644 index 0000000..65ee186 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_count_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data.cpython-311.pyc new file mode 100644 index 0000000..8bdd333 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_page_link.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..289937c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_page_link.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_query.cpython-311.pyc new file mode 100644 index 0000000..bfe3a5c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_data_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_id.cpython-311.pyc new file mode 100644 index 0000000..d7d72f5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_info.cpython-311.pyc new file mode 100644 index 0000000..793d62a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..4a1212f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_rule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_rule.cpython-311.pyc new file mode 100644 index 0000000..17a02e8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_rule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_schedule.cpython-311.pyc new file mode 100644 index 0000000..31bbbc9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/alarm_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/all_users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/all_users_filter.cpython-311.pyc new file mode 100644 index 0000000..22cd746 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/all_users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..6658623 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/any_time_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/any_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..dbe0645 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/any_time_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..14159c6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/api_usage_state_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/api_usage_state_filter.cpython-311.pyc new file mode 100644 index 0000000..59996be Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/api_usage_state_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset.cpython-311.pyc new file mode 100644 index 0000000..d7753ea Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_id.cpython-311.pyc new file mode 100644 index 0000000..f511ec6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_info.cpython-311.pyc new file mode 100644 index 0000000..2b7813a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile.cpython-311.pyc new file mode 100644 index 0000000..5d19f9c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_id.cpython-311.pyc new file mode 100644 index 0000000..438f66c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_info.cpython-311.pyc new file mode 100644 index 0000000..adb7518 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_profile_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query.cpython-311.pyc new file mode 100644 index 0000000..2e27852 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..fa7b7bd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_type_filter.cpython-311.pyc new file mode 100644 index 0000000..71ddb4c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/asset_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/atomic_integer.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/atomic_integer.cpython-311.pyc new file mode 100644 index 0000000..af118d4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/atomic_integer.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/attribute_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/attribute_export_data.cpython-311.pyc new file mode 100644 index 0000000..8b346ce Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/attribute_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/attributes_entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/attributes_entity_view.cpython-311.pyc new file mode 100644 index 0000000..1183a27 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/attributes_entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/audit_log.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/audit_log.cpython-311.pyc new file mode 100644 index 0000000..009f432 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/audit_log.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/audit_log_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/audit_log_id.cpython-311.pyc new file mode 100644 index 0000000..a992eff Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/audit_log_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/auto_version_create_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/auto_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..b65d714 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/auto_version_create_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..22a29cc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..49c18ce Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..adf7bbd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/boolean_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/boolean_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..4002c8a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/boolean_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/branch_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/branch_info.cpython-311.pyc new file mode 100644 index 0000000..ca0a865 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/branch_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_request.cpython-311.pyc new file mode 100644 index 0000000..2a1dcdc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_asset.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_asset.cpython-311.pyc new file mode 100644 index 0000000..0497ae5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_asset.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_device.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_device.cpython-311.pyc new file mode 100644 index 0000000..5156e13 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_device.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_edge.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_edge.cpython-311.pyc new file mode 100644 index 0000000..d2c407f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/bulk_import_result_edge.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/byte_buffer.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/byte_buffer.cpython-311.pyc new file mode 100644 index 0000000..dc9184d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/byte_buffer.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/change_password_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/change_password_request.cpython-311.pyc new file mode 100644 index 0000000..2f1c285 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/change_password_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..685599d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/claim_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/claim_request.cpython-311.pyc new file mode 100644 index 0000000..a65ca84 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/claim_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/clear_rule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/clear_rule.cpython-311.pyc new file mode 100644 index 0000000..03920d9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/clear_rule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..a86a239 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..29bbfae Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..5cad3f2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..182a8ac Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/coap_device_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/column_mapping.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/column_mapping.cpython-311.pyc new file mode 100644 index 0000000..129b4b6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/column_mapping.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/comparison_ts_value.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/comparison_ts_value.cpython-311.pyc new file mode 100644 index 0000000..f56161e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/comparison_ts_value.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/complex_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/complex_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..9ebdef8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/complex_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/complex_version_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/complex_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..0f9d77a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/complex_version_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor.cpython-311.pyc new file mode 100644 index 0000000..08132ff Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor_id.cpython-311.pyc new file mode 100644 index 0000000..b90286b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/component_descriptor_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..5dc61a9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule_item.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule_item.cpython-311.pyc new file mode 100644 index 0000000..573c2ae Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/custom_time_schedule_item.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer.cpython-311.pyc new file mode 100644 index 0000000..9c6b316 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer_id.cpython-311.pyc new file mode 100644 index 0000000..a66c174 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer_users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer_users_filter.cpython-311.pyc new file mode 100644 index 0000000..0a80373 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/customer_users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard.cpython-311.pyc new file mode 100644 index 0000000..21f2cab Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard_id.cpython-311.pyc new file mode 100644 index 0000000..a241185 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..201c854 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc new file mode 100644 index 0000000..893eee1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_coap_device_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..229d6db Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_coap_device_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_configuration.cpython-311.pyc new file mode 100644 index 0000000..cb64bb4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..ca4cc75 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..3afca08 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..a22b075 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_rule_chain_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_rule_chain_create_request.cpython-311.pyc new file mode 100644 index 0000000..c9f4f1b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_rule_chain_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_tenant_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..54bdcec Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/default_tenant_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..0637fa0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..83d590e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_entity_data_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_branch_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_branch_info.cpython-311.pyc new file mode 100644 index 0000000..5aa9b67 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_branch_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..0fde29c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..5a0a653 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_repository_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_repository_settings.cpython-311.pyc new file mode 100644 index 0000000..a32380c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_repository_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_response_entity.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_response_entity.cpython-311.pyc new file mode 100644 index 0000000..6982c03 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_response_entity.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_void.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_void.cpython-311.pyc new file mode 100644 index 0000000..c9d262b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_result_void.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_resultuuid.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_resultuuid.cpython-311.pyc new file mode 100644 index 0000000..887551a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/deferred_resultuuid.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..b476e55 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device.cpython-311.pyc new file mode 100644 index 0000000..b36efce Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..9a66e67 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_configuration.cpython-311.pyc new file mode 100644 index 0000000..ae30aac Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_credentials.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_credentials.cpython-311.pyc new file mode 100644 index 0000000..3809188 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_credentials.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_credentials_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_credentials_id.cpython-311.pyc new file mode 100644 index 0000000..0f05acb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_credentials_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_data.cpython-311.pyc new file mode 100644 index 0000000..c302390 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_export_data.cpython-311.pyc new file mode 100644 index 0000000..e7a1e2a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_id.cpython-311.pyc new file mode 100644 index 0000000..2f5b16c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_info.cpython-311.pyc new file mode 100644 index 0000000..aeee6eb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile.cpython-311.pyc new file mode 100644 index 0000000..72bcb17 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_alarm.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_alarm.cpython-311.pyc new file mode 100644 index 0000000..9aaa0ad Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_alarm.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..1512a7b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_data.cpython-311.pyc new file mode 100644 index 0000000..281f071 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_id.cpython-311.pyc new file mode 100644 index 0000000..ffd1789 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_info.cpython-311.pyc new file mode 100644 index 0000000..f01e2ee Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..26e8800 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..ea18df2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_search_query.cpython-311.pyc new file mode 100644 index 0000000..220c027 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..983ba87 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..9e6e6dd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_type_filter.cpython-311.pyc new file mode 100644 index 0000000..73b94b4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/device_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..eb386b5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/duration_alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/duration_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..77d5838 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/duration_alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueboolean.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..bce6b43 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueboolean.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuedouble.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..51ad1ef Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuedouble.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueint.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueint.cpython-311.pyc new file mode 100644 index 0000000..23d5c48 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valueint.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuelong.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuelong.cpython-311.pyc new file mode 100644 index 0000000..0bb8cc7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuelong.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuestring.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuestring.cpython-311.pyc new file mode 100644 index 0000000..0c2a3b6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/dynamic_valuestring.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge.cpython-311.pyc new file mode 100644 index 0000000..649da58 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_event.cpython-311.pyc new file mode 100644 index 0000000..bd50d4c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_event_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_event_id.cpython-311.pyc new file mode 100644 index 0000000..2a841ad Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_event_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_id.cpython-311.pyc new file mode 100644 index 0000000..1997dc2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_info.cpython-311.pyc new file mode 100644 index 0000000..5afa302 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_install_instructions.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_install_instructions.cpython-311.pyc new file mode 100644 index 0000000..1a96d24 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_install_instructions.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query.cpython-311.pyc new file mode 100644 index 0000000..7e56e05 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..434b1be Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_type_filter.cpython-311.pyc new file mode 100644 index 0000000..42efea5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/edge_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..32cc376 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..67fbe82 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..05cb743 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..6c14c5f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/email_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..8d97501 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..b0c259b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_count_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_count_query.cpython-311.pyc new file mode 100644 index 0000000..defbb24 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_count_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data.cpython-311.pyc new file mode 100644 index 0000000..dff458c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_diff.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..811af34 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_diff.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..b9864bf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_page_link.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..6142904 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_page_link.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_query.cpython-311.pyc new file mode 100644 index 0000000..d916cfd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_sort_order.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_sort_order.cpython-311.pyc new file mode 100644 index 0000000..a480658 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_data_sort_order.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_export_dataobject.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_export_dataobject.cpython-311.pyc new file mode 100644 index 0000000..0eb3dfb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_export_dataobject.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_filter.cpython-311.pyc new file mode 100644 index 0000000..9fb45eb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_id.cpython-311.pyc new file mode 100644 index 0000000..aa9e44c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_info.cpython-311.pyc new file mode 100644 index 0000000..6d0e9bb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_key.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_key.cpython-311.pyc new file mode 100644 index 0000000..ad0b1cc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_key.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_list_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_list_filter.cpython-311.pyc new file mode 100644 index 0000000..ae26d30 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_list_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_load_error.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_load_error.cpython-311.pyc new file mode 100644 index 0000000..b1a169f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_load_error.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_name_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_name_filter.cpython-311.pyc new file mode 100644 index 0000000..d3933a1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_name_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relation.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relation.cpython-311.pyc new file mode 100644 index 0000000..3df8294 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relation.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relation_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relation_info.cpython-311.pyc new file mode 100644 index 0000000..d7da184 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relation_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relations_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relations_query.cpython-311.pyc new file mode 100644 index 0000000..18b8a13 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_relations_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_subtype.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_subtype.cpython-311.pyc new file mode 100644 index 0000000..f55664e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_subtype.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..4ce8067 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_load_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_load_result.cpython-311.pyc new file mode 100644 index 0000000..7bfd0c1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_load_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_create_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..2b6561d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_create_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_config.cpython-311.pyc new file mode 100644 index 0000000..c8bcdcf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..cc22e28 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_type_version_load_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_version.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_version.cpython-311.pyc new file mode 100644 index 0000000..c3a6713 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_version.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view.cpython-311.pyc new file mode 100644 index 0000000..b64380f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_id.cpython-311.pyc new file mode 100644 index 0000000..412c0b8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..59c08bf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query.cpython-311.pyc new file mode 100644 index 0000000..4880957 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..88077a0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_type_filter.cpython-311.pyc new file mode 100644 index 0000000..4dc283d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/entity_view_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/error_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/error_event_filter.cpython-311.pyc new file mode 100644 index 0000000..8ddaa5e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/error_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..cd90df9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event.cpython-311.pyc new file mode 100644 index 0000000..35f4d2b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_filter.cpython-311.pyc new file mode 100644 index 0000000..2ef10f3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_id.cpython-311.pyc new file mode 100644 index 0000000..99c1f6d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_info.cpython-311.pyc new file mode 100644 index 0000000..f9e2bd1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/event_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/features_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/features_info.cpython-311.pyc new file mode 100644 index 0000000..92b6b70 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/features_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/file.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/file.cpython-311.pyc new file mode 100644 index 0000000..f77d736 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/file.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueboolean.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..ab876fc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueboolean.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuedouble.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..3a1c91b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuedouble.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueint.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueint.cpython-311.pyc new file mode 100644 index 0000000..218cff3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valueint.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuelong.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuelong.cpython-311.pyc new file mode 100644 index 0000000..5850a49 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuelong.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuestring.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuestring.cpython-311.pyc new file mode 100644 index 0000000..9bd71b7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/filter_predicate_valuestring.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard.cpython-311.pyc new file mode 100644 index 0000000..89d9083 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..0071fa0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/home_dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/input_stream.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/input_stream.cpython-311.pyc new file mode 100644 index 0000000..5378a2d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/input_stream.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/json_node.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/json_node.cpython-311.pyc new file mode 100644 index 0000000..9447d60 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/json_node.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/json_transport_payload_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/json_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..b854a0b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/json_transport_payload_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/jwt_pair.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/jwt_pair.cpython-311.pyc new file mode 100644 index 0000000..8fc5b3c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/jwt_pair.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/jwt_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/jwt_settings.cpython-311.pyc new file mode 100644 index 0000000..aa19f3e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/jwt_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/key_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/key_filter.cpython-311.pyc new file mode 100644 index 0000000..0408a97 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/key_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/key_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/key_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..d9362df Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/key_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/last_visited_dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/last_visited_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..01e9857 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/last_visited_dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/life_cycle_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/life_cycle_event_filter.cpython-311.pyc new file mode 100644 index 0000000..3c55e2f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/life_cycle_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/login_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/login_request.cpython-311.pyc new file mode 100644 index 0000000..68f15d6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/login_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/login_response.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/login_response.cpython-311.pyc new file mode 100644 index 0000000..412761f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/login_response.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..b7d3904 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc new file mode 100644 index 0000000..80ab5ef Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_instance.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_instance.cpython-311.pyc new file mode 100644 index 0000000..c3b18d0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_instance.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_object.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_object.cpython-311.pyc new file mode 100644 index 0000000..139223c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_object.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_resource_observe.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_resource_observe.cpython-311.pyc new file mode 100644 index 0000000..b5a1468 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lw_m2m_resource_observe.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..991a8ed Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..903322c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mapping.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mapping.cpython-311.pyc new file mode 100644 index 0000000..73706d6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mapping.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..b210a59 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..ba6a827 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..2ea08a8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..4c0b69f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/node_connection_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/node_connection_info.cpython-311.pyc new file mode 100644 index 0000000..450092a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/node_connection_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification.cpython-311.pyc new file mode 100644 index 0000000..35074b5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_delivery_method_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..5ccf63b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_delivery_method_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_id.cpython-311.pyc new file mode 100644 index 0000000..038e040 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_info.cpython-311.pyc new file mode 100644 index 0000000..0bbbdc8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request.cpython-311.pyc new file mode 100644 index 0000000..43e9f08 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_config.cpython-311.pyc new file mode 100644 index 0000000..4b3c4ed Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_id.cpython-311.pyc new file mode 100644 index 0000000..ddf6aab Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_info.cpython-311.pyc new file mode 100644 index 0000000..b5ed4a3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_preview.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_preview.cpython-311.pyc new file mode 100644 index 0000000..54dbbad Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_preview.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_stats.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_stats.cpython-311.pyc new file mode 100644 index 0000000..d292e6e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_request_stats.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule.cpython-311.pyc new file mode 100644 index 0000000..fd56464 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_config.cpython-311.pyc new file mode 100644 index 0000000..8166417 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_id.cpython-311.pyc new file mode 100644 index 0000000..45298f7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_info.cpython-311.pyc new file mode 100644 index 0000000..8fc3011 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_recipients_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..bcfd11c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_recipients_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..1ba61a0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_settings.cpython-311.pyc new file mode 100644 index 0000000..43c302e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target.cpython-311.pyc new file mode 100644 index 0000000..6d6a296 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..6669ed6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target_id.cpython-311.pyc new file mode 100644 index 0000000..64a05d9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_target_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template.cpython-311.pyc new file mode 100644 index 0000000..91a6216 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template_config.cpython-311.pyc new file mode 100644 index 0000000..e3fda7e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template_id.cpython-311.pyc new file mode 100644 index 0000000..25a5e21 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/notification_template_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/numeric_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/numeric_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..bc82d40 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/numeric_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..d9881cc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_info.cpython-311.pyc new file mode 100644 index 0000000..793107e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template.cpython-311.pyc new file mode 100644 index 0000000..32f4b28 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc new file mode 100644 index 0000000..994b3b6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..3fb1ae4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_domain_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_domain_info.cpython-311.pyc new file mode 100644 index 0000000..497c13c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_domain_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_info.cpython-311.pyc new file mode 100644 index 0000000..7e51415 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mapper_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..e1a873a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mapper_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mobile_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mobile_info.cpython-311.pyc new file mode 100644 index 0000000..4e893f9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_mobile_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_params_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_params_info.cpython-311.pyc new file mode 100644 index 0000000..e705c27 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_params_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_registration_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_registration_info.cpython-311.pyc new file mode 100644 index 0000000..bb9871f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/o_auth2_registration_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/object_attributes.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/object_attributes.cpython-311.pyc new file mode 100644 index 0000000..d5ba532 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/object_attributes.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/object_node.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/object_node.cpython-311.pyc new file mode 100644 index 0000000..8b74c6e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/object_node.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc new file mode 100644 index 0000000..b502309 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package.cpython-311.pyc new file mode 100644 index 0000000..1e24f87 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_id.cpython-311.pyc new file mode 100644 index 0000000..19ca42b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..aa3a544 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc new file mode 100644 index 0000000..41bc8aa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_idchecksumchecksum_algorithm_body.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_idchecksumchecksum_algorithm_body.cpython-311.pyc new file mode 100644 index 0000000..0843284 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ota_package_ota_package_idchecksumchecksum_algorithm_body.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/other_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/other_configuration.cpython-311.pyc new file mode 100644 index 0000000..c129194 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/other_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_comment_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_comment_info.cpython-311.pyc new file mode 100644 index 0000000..e0bc10b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_comment_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_data.cpython-311.pyc new file mode 100644 index 0000000..f15b676 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_info.cpython-311.pyc new file mode 100644 index 0000000..ff99aac Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_alarm_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset.cpython-311.pyc new file mode 100644 index 0000000..6f22348 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_info.cpython-311.pyc new file mode 100644 index 0000000..0483f78 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile.cpython-311.pyc new file mode 100644 index 0000000..b45aac6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile_info.cpython-311.pyc new file mode 100644 index 0000000..a886479 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_asset_profile_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_audit_log.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_audit_log.cpython-311.pyc new file mode 100644 index 0000000..4f24b7c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_audit_log.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_customer.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_customer.cpython-311.pyc new file mode 100644 index 0000000..c03ce9d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_customer.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..ddc3d12 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device.cpython-311.pyc new file mode 100644 index 0000000..be63b6d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_info.cpython-311.pyc new file mode 100644 index 0000000..2312d70 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile.cpython-311.pyc new file mode 100644 index 0000000..d0f7eea Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile_info.cpython-311.pyc new file mode 100644 index 0000000..1eae2e6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_device_profile_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge.cpython-311.pyc new file mode 100644 index 0000000..86eb3c7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_event.cpython-311.pyc new file mode 100644 index 0000000..f7e478d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_info.cpython-311.pyc new file mode 100644 index 0000000..9724428 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_edge_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_data.cpython-311.pyc new file mode 100644 index 0000000..6b3a02b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_info.cpython-311.pyc new file mode 100644 index 0000000..11c7123 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_version.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..9da7061 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_version.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view.cpython-311.pyc new file mode 100644 index 0000000..b447029 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..8a9e445 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_entity_view_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_event.cpython-311.pyc new file mode 100644 index 0000000..8103612 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_event_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_event_info.cpython-311.pyc new file mode 100644 index 0000000..ef76aa6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_event_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification.cpython-311.pyc new file mode 100644 index 0000000..675a4ab Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_request_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_request_info.cpython-311.pyc new file mode 100644 index 0000000..ef4e191 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_request_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_rule_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_rule_info.cpython-311.pyc new file mode 100644 index 0000000..7bd68db Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_rule_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_target.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_target.cpython-311.pyc new file mode 100644 index 0000000..b38f9e3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_target.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_template.cpython-311.pyc new file mode 100644 index 0000000..4c17e99 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_ota_package_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..b7173f0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_ota_package_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_queue.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_queue.cpython-311.pyc new file mode 100644 index 0000000..a5cfbe7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_queue.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_rpc.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_rpc.cpython-311.pyc new file mode 100644 index 0000000..b3880d2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_rpc.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_rule_chain.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_rule_chain.cpython-311.pyc new file mode 100644 index 0000000..6a8c839 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_rule_chain.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tb_resource_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..e6b1abb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tb_resource_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant.cpython-311.pyc new file mode 100644 index 0000000..ea92c43 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_info.cpython-311.pyc new file mode 100644 index 0000000..b7867af Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_profile.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_profile.cpython-311.pyc new file mode 100644 index 0000000..7b985fd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_tenant_profile.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_user.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_user.cpython-311.pyc new file mode 100644 index 0000000..5d459da Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_user.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_user_email_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_user_email_info.cpython-311.pyc new file mode 100644 index 0000000..36e488c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_user_email_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_widgets_bundle.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_widgets_bundle.cpython-311.pyc new file mode 100644 index 0000000..e320874 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/page_data_widgets_bundle.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/platform_two_fa_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/platform_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..20dfe21 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/platform_two_fa_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/platform_users_notification_target_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/platform_users_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..8463bde Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/platform_users_notification_target_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/power_saving_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/power_saving_configuration.cpython-311.pyc new file mode 100644 index 0000000..39b9cec Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/power_saving_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/processing_strategy.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/processing_strategy.cpython-311.pyc new file mode 100644 index 0000000..3582a89 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/processing_strategy.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/proto_transport_payload_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/proto_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..bbea46f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/proto_transport_payload_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..128c0a0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/queue.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/queue.cpython-311.pyc new file mode 100644 index 0000000..9dc4416 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/queue.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/queue_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/queue_id.cpython-311.pyc new file mode 100644 index 0000000..5470756 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/queue_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relation_entity_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relation_entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..3001bf3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relation_entity_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relations_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relations_query_filter.cpython-311.pyc new file mode 100644 index 0000000..67f057c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relations_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relations_search_parameters.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relations_search_parameters.cpython-311.pyc new file mode 100644 index 0000000..d0a910f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/relations_search_parameters.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..6090001 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repository_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repository_settings.cpython-311.pyc new file mode 100644 index 0000000..c94cfbd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repository_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repository_settings_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repository_settings_info.cpython-311.pyc new file mode 100644 index 0000000..154c691 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/repository_settings_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/reset_password_email_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/reset_password_email_request.cpython-311.pyc new file mode 100644 index 0000000..dc290d6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/reset_password_email_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/reset_password_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/reset_password_request.cpython-311.pyc new file mode 100644 index 0000000..a621a61 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/reset_password_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/resource.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/resource.cpython-311.pyc new file mode 100644 index 0000000..9274b9f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/resource.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/response_entity.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/response_entity.cpython-311.pyc new file mode 100644 index 0000000..1a24e4a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/response_entity.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpc.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpc.cpython-311.pyc new file mode 100644 index 0000000..45112e4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpc.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpc_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpc_id.cpython-311.pyc new file mode 100644 index 0000000..a4d9f8b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpc_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..4b2b19f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain.cpython-311.pyc new file mode 100644 index 0000000..7ca284f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_connection_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_connection_info.cpython-311.pyc new file mode 100644 index 0000000..347b2b6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_connection_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_data.cpython-311.pyc new file mode 100644 index 0000000..fd0727b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..df4607b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_export_data.cpython-311.pyc new file mode 100644 index 0000000..df5677a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_id.cpython-311.pyc new file mode 100644 index 0000000..08e5011 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_import_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_import_result.cpython-311.pyc new file mode 100644 index 0000000..f89d89c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_import_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_meta_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_meta_data.cpython-311.pyc new file mode 100644 index 0000000..d35da8d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_meta_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc new file mode 100644 index 0000000..f2e5d3e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..bf8ab19 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node.cpython-311.pyc new file mode 100644 index 0000000..1d65135 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node_debug_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..e6853b3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node_debug_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node_id.cpython-311.pyc new file mode 100644 index 0000000..32b5afa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/rule_node_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/save_device_with_credentials_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/save_device_with_credentials_request.cpython-311.pyc new file mode 100644 index 0000000..04c1130 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/save_device_with_credentials_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/save_ota_package_info_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/save_ota_package_info_request.cpython-311.pyc new file mode 100644 index 0000000..15cbb68 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/save_ota_package_info_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/security_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/security_settings.cpython-311.pyc new file mode 100644 index 0000000..eca2090 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/security_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/server_security_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/server_security_config.cpython-311.pyc new file mode 100644 index 0000000..df2d7fd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/server_security_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..274bab7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/short_customer_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/short_customer_info.cpython-311.pyc new file mode 100644 index 0000000..a390db8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/short_customer_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sign_up_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sign_up_request.cpython-311.pyc new file mode 100644 index 0000000..8e9003c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sign_up_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/simple_alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/simple_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..abe6a35 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/simple_alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_filter.cpython-311.pyc new file mode 100644 index 0000000..491f768 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..3114f88 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_load_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..e632a49 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/single_entity_version_load_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_conversation.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_conversation.cpython-311.pyc new file mode 100644 index 0000000..56940fd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_conversation.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..59f6f66 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..24eafaf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_target_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..ea7ed35 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/slack_notification_target_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..0e7b636 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..3b9ce50 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..3d4363a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..576ddd4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..dfd2fb7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/sms_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..f73300f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..1684a1b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..8b906d7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_mapping.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_mapping.cpython-311.pyc new file mode 100644 index 0000000..5a1bbc9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/snmp_mapping.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/specific_time_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/specific_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..b48430b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/specific_time_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/starred_dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/starred_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..057aa3f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/starred_dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/statistics_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/statistics_event_filter.cpython-311.pyc new file mode 100644 index 0000000..758015e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/statistics_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/string_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/string_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..6829c3c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/string_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/submit_strategy.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/submit_strategy.cpython-311.pyc new file mode 100644 index 0000000..aebca69 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/submit_strategy.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_administrators_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..29402fb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_administrators_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_info.cpython-311.pyc new file mode 100644 index 0000000..5c46d2a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_info_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_info_data.cpython-311.pyc new file mode 100644 index 0000000..ecad07b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/system_info_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource.cpython-311.pyc new file mode 100644 index 0000000..9008086 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_id.cpython-311.pyc new file mode 100644 index 0000000..7ca2e4f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..ddc012d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tb_resource_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_entity_view.cpython-311.pyc new file mode 100644 index 0000000..d46ef96 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_mapping_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_mapping_configuration.cpython-311.pyc new file mode 100644 index 0000000..46f03d9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_mapping_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..d24f774 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant.cpython-311.pyc new file mode 100644 index 0000000..d672b31 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_administrators_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..d7ecb4c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_administrators_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_id.cpython-311.pyc new file mode 100644 index 0000000..6bed870 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_info.cpython-311.pyc new file mode 100644 index 0000000..8c79187 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile.cpython-311.pyc new file mode 100644 index 0000000..fcc9c3a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..3a838c8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_data.cpython-311.pyc new file mode 100644 index 0000000..2ffc241 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_id.cpython-311.pyc new file mode 100644 index 0000000..4f2756a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc new file mode 100644 index 0000000..ac4736b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/test_sms_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/test_sms_request.cpython-311.pyc new file mode 100644 index 0000000..53277e5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/test_sms_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc new file mode 100644 index 0000000..1c1a8ec Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_error_response.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_error_response.cpython-311.pyc new file mode 100644 index 0000000..b6c5e40 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/thingsboard_error_response.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..6db0811 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..f2af9dd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..0feffaa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/totp_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/transport_payload_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/transport_payload_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..5a30497 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/transport_payload_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ts_value.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ts_value.cpython-311.pyc new file mode 100644 index 0000000..a5be6c6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/ts_value.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..4f33621 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..2272ce3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config_update_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config_update_request.cpython-311.pyc new file mode 100644 index 0000000..acb4bd1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_account_config_update_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..cbfa353 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_info.cpython-311.pyc new file mode 100644 index 0000000..d56e0a3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/two_fa_provider_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/update_message.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/update_message.cpython-311.pyc new file mode 100644 index 0000000..73b9305 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/update_message.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/usage_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/usage_info.cpython-311.pyc new file mode 100644 index 0000000..b8c71bf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/usage_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user.cpython-311.pyc new file mode 100644 index 0000000..ee61a5a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_dashboards_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_dashboards_info.cpython-311.pyc new file mode 100644 index 0000000..271b659 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_dashboards_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_email_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_email_info.cpython-311.pyc new file mode 100644 index 0000000..4941e6b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_email_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_id.cpython-311.pyc new file mode 100644 index 0000000..9f93504 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_list_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_list_filter.cpython-311.pyc new file mode 100644 index 0000000..7c5ee30 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_list_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_password_policy.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_password_policy.cpython-311.pyc new file mode 100644 index 0000000..debeacb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/user_password_policy.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/users_filter.cpython-311.pyc new file mode 100644 index 0000000..b02e3b9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_create_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_create_config.cpython-311.pyc new file mode 100644 index 0000000..698561b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_create_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_create_request.cpython-311.pyc new file mode 100644 index 0000000..9b3b271 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_creation_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_creation_result.cpython-311.pyc new file mode 100644 index 0000000..9123ff6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_creation_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_config.cpython-311.pyc new file mode 100644 index 0000000..984c01a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_request.cpython-311.pyc new file mode 100644 index 0000000..a1a14c1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_result.cpython-311.pyc new file mode 100644 index 0000000..af794f1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/version_load_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/versioned_entity_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..512159e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/versioned_entity_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/web_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/web_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..796d571 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/web_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type.cpython-311.pyc new file mode 100644 index 0000000..77ad194 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_details.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_details.cpython-311.pyc new file mode 100644 index 0000000..18f4bc0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_details.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_id.cpython-311.pyc new file mode 100644 index 0000000..c0a8787 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_info.cpython-311.pyc new file mode 100644 index 0000000..a10f944 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widget_type_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle.cpython-311.pyc new file mode 100644 index 0000000..650a01c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_export_data.cpython-311.pyc new file mode 100644 index 0000000..43ea88b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_id.cpython-311.pyc new file mode 100644 index 0000000..bf52f0e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/widgets_bundle_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..4d2dab5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..79c7254 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_ce/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/account_two_fa_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/account_two_fa_settings.py new file mode 100644 index 0000000..8bdda25 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/account_two_fa_settings.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AccountTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configs': 'dict(str, TwoFaAccountConfig)' + } + + attribute_map = { + 'configs': 'configs' + } + + def __init__(self, configs=None): # noqa: E501 + """AccountTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._configs = None + self.discriminator = None + if configs is not None: + self.configs = configs + + @property + def configs(self): + """Gets the configs of this AccountTwoFaSettings. # noqa: E501 + + + :return: The configs of this AccountTwoFaSettings. # noqa: E501 + :rtype: dict(str, TwoFaAccountConfig) + """ + return self._configs + + @configs.setter + def configs(self, configs): + """Sets the configs of this AccountTwoFaSettings. + + + :param configs: The configs of this AccountTwoFaSettings. # noqa: E501 + :type: dict(str, TwoFaAccountConfig) + """ + + self._configs = configs + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AccountTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AccountTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/activate_user_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/activate_user_request.py new file mode 100644 index 0000000..8134f32 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/activate_user_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ActivateUserRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'activate_token': 'activateToken', + 'password': 'password' + } + + def __init__(self, activate_token=None, password=None): # noqa: E501 + """ActivateUserRequest - a model defined in Swagger""" # noqa: E501 + self._activate_token = None + self._password = None + self.discriminator = None + if activate_token is not None: + self.activate_token = activate_token + if password is not None: + self.password = password + + @property + def activate_token(self): + """Gets the activate_token of this ActivateUserRequest. # noqa: E501 + + The activate token to verify # noqa: E501 + + :return: The activate_token of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._activate_token + + @activate_token.setter + def activate_token(self, activate_token): + """Sets the activate_token of this ActivateUserRequest. + + The activate token to verify # noqa: E501 + + :param activate_token: The activate_token of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._activate_token = activate_token + + @property + def password(self): + """Gets the password of this ActivateUserRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ActivateUserRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ActivateUserRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ActivateUserRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/admin_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/admin_settings.py new file mode 100644 index 0000000..d30ebcb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/admin_settings.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AdminSettingsId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'key': 'str', + 'json_value': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'key': 'key', + 'json_value': 'jsonValue' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, key=None, json_value=None): # noqa: E501 + """AdminSettings - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._key = None + self._json_value = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if key is not None: + self.key = key + if json_value is not None: + self.json_value = json_value + + @property + def id(self): + """Gets the id of this AdminSettings. # noqa: E501 + + + :return: The id of this AdminSettings. # noqa: E501 + :rtype: AdminSettingsId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettings. + + + :param id: The id of this AdminSettings. # noqa: E501 + :type: AdminSettingsId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AdminSettings. # noqa: E501 + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :return: The created_time of this AdminSettings. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AdminSettings. + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AdminSettings. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AdminSettings. # noqa: E501 + + + :return: The tenant_id of this AdminSettings. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AdminSettings. + + + :param tenant_id: The tenant_id of this AdminSettings. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def key(self): + """Gets the key of this AdminSettings. # noqa: E501 + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :return: The key of this AdminSettings. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AdminSettings. + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :param key: The key of this AdminSettings. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def json_value(self): + """Gets the json_value of this AdminSettings. # noqa: E501 + + + :return: The json_value of this AdminSettings. # noqa: E501 + :rtype: JsonNode + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AdminSettings. + + + :param json_value: The json_value of this AdminSettings. # noqa: E501 + :type: JsonNode + """ + + self._json_value = json_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/admin_settings_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/admin_settings_id.py new file mode 100644 index 0000000..16f62bc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/admin_settings_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettingsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AdminSettingsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AdminSettingsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AdminSettingsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettingsId. + + string # noqa: E501 + + :param id: The id of this AdminSettingsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettingsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettingsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/affected_tenant_administrators_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/affected_tenant_administrators_filter.py new file mode 100644 index 0000000..7cf89ea --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/affected_tenant_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedTenantAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedTenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedTenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedTenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/affected_user_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/affected_user_filter.py new file mode 100644 index 0000000..8058d4e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/affected_user_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedUserFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedUserFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedUserFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedUserFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm.py new file mode 100644 index 0000000..b543f1c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm.py @@ -0,0 +1,721 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Alarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate': 'bool', + 'propagate_to_owner': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate': 'propagate', + 'propagate_to_owner': 'propagateToOwner', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate=None, propagate_to_owner=None, propagate_to_tenant=None, propagate_relation_types=None, status=None): # noqa: E501 + """Alarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate = None + self._propagate_to_owner = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate is not None: + self.propagate = propagate + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + self.status = status + + @property + def id(self): + """Gets the id of this Alarm. # noqa: E501 + + + :return: The id of this Alarm. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Alarm. + + + :param id: The id of this Alarm. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Alarm. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this Alarm. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Alarm. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Alarm. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Alarm. # noqa: E501 + + + :return: The tenant_id of this Alarm. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Alarm. + + + :param tenant_id: The tenant_id of this Alarm. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Alarm. # noqa: E501 + + + :return: The customer_id of this Alarm. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Alarm. + + + :param customer_id: The customer_id of this Alarm. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this Alarm. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this Alarm. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this Alarm. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this Alarm. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this Alarm. # noqa: E501 + + + :return: The originator of this Alarm. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this Alarm. + + + :param originator: The originator of this Alarm. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this Alarm. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this Alarm. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this Alarm. + + Alarm severity # noqa: E501 + + :param severity: The severity of this Alarm. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this Alarm. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this Alarm. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this Alarm. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this Alarm. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this Alarm. + + Cleared # noqa: E501 + + :param cleared: The cleared of this Alarm. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this Alarm. # noqa: E501 + + + :return: The assignee_id of this Alarm. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this Alarm. + + + :param assignee_id: The assignee_id of this Alarm. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this Alarm. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this Alarm. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this Alarm. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this Alarm. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this Alarm. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this Alarm. # noqa: E501 + + + :return: The details of this Alarm. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this Alarm. + + + :param details: The details of this Alarm. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate(self): + """Gets the propagate of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this Alarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this Alarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this Alarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this Alarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this Alarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this Alarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this Alarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def status(self): + """Gets the status of this Alarm. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this Alarm. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Alarm. + + status of the Alarm # noqa: E501 + + :param status: The status of this Alarm. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Alarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Alarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_assignee.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_assignee.py new file mode 100644 index 0000000..0c5b705 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_assignee.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignee(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'first_name': 'str', + 'id': 'UserId', + 'last_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'first_name': 'firstName', + 'id': 'id', + 'last_name': 'lastName' + } + + def __init__(self, email=None, first_name=None, id=None, last_name=None): # noqa: E501 + """AlarmAssignee - a model defined in Swagger""" # noqa: E501 + self._email = None + self._first_name = None + self._id = None + self._last_name = None + self.discriminator = None + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if id is not None: + self.id = id + if last_name is not None: + self.last_name = last_name + + @property + def email(self): + """Gets the email of this AlarmAssignee. # noqa: E501 + + + :return: The email of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmAssignee. + + + :param email: The email of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmAssignee. # noqa: E501 + + + :return: The first_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmAssignee. + + + :param first_name: The first_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def id(self): + """Gets the id of this AlarmAssignee. # noqa: E501 + + + :return: The id of this AlarmAssignee. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmAssignee. + + + :param id: The id of this AlarmAssignee. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def last_name(self): + """Gets the last_name of this AlarmAssignee. # noqa: E501 + + + :return: The last_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmAssignee. + + + :param last_name: The last_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignee, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignee): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_assignment_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_assignment_notification_rule_trigger_config.py new file mode 100644 index 0000000..b8367ea --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_assignment_notification_rule_trigger_config.py @@ -0,0 +1,255 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignmentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on=None, trigger_type=None): # noqa: E501 + """AlarmAssignmentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on(self): + """Gets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ASSIGNED", "UNASSIGNED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignmentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignmentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment.py new file mode 100644 index 0000000..f46fc6c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment.py @@ -0,0 +1,293 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmComment(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None): # noqa: E501 + """AlarmComment - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + + @property + def id(self): + """Gets the id of this AlarmComment. # noqa: E501 + + + :return: The id of this AlarmComment. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmComment. + + + :param id: The id of this AlarmComment. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmComment. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmComment. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmComment. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmComment. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmComment. # noqa: E501 + + + :return: The alarm_id of this AlarmComment. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmComment. + + + :param alarm_id: The alarm_id of this AlarmComment. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmComment. # noqa: E501 + + + :return: The user_id of this AlarmComment. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmComment. + + + :param user_id: The user_id of this AlarmComment. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmComment. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmComment. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmComment. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmComment. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmComment. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmComment. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmComment. # noqa: E501 + + + :return: The comment of this AlarmComment. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmComment. + + + :param comment: The comment of this AlarmComment. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmComment, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmComment): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_id.py new file mode 100644 index 0000000..da6d689 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AlarmCommentId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AlarmCommentId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AlarmCommentId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentId. + + string # noqa: E501 + + :param id: The id of this AlarmCommentId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_info.py new file mode 100644 index 0000000..d9dd209 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_info.py @@ -0,0 +1,377 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None, email=None, first_name=None, last_name=None): # noqa: E501 + """AlarmCommentInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this AlarmCommentInfo. # noqa: E501 + + + :return: The id of this AlarmCommentInfo. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentInfo. + + + :param id: The id of this AlarmCommentInfo. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmCommentInfo. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmCommentInfo. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmCommentInfo. + + + :param alarm_id: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The user_id of this AlarmCommentInfo. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmCommentInfo. + + + :param user_id: The user_id of this AlarmCommentInfo. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmCommentInfo. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmCommentInfo. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmCommentInfo. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmCommentInfo. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmCommentInfo. # noqa: E501 + + + :return: The comment of this AlarmCommentInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmCommentInfo. + + + :param comment: The comment of this AlarmCommentInfo. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + @property + def email(self): + """Gets the email of this AlarmCommentInfo. # noqa: E501 + + User email address # noqa: E501 + + :return: The email of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmCommentInfo. + + User email address # noqa: E501 + + :param email: The email of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmCommentInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmCommentInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this AlarmCommentInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmCommentInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_notification_rule_trigger_config.py new file mode 100644 index 0000000..6968805 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_comment_notification_rule_trigger_config.py @@ -0,0 +1,274 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on_comment_update': 'bool', + 'only_user_comments': 'bool', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on_comment_update': 'notifyOnCommentUpdate', + 'only_user_comments': 'onlyUserComments', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on_comment_update=None, only_user_comments=None, trigger_type=None): # noqa: E501 + """AlarmCommentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on_comment_update = None + self._only_user_comments = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on_comment_update is not None: + self.notify_on_comment_update = notify_on_comment_update + if only_user_comments is not None: + self.only_user_comments = only_user_comments + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on_comment_update(self): + """Gets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._notify_on_comment_update + + @notify_on_comment_update.setter + def notify_on_comment_update(self, notify_on_comment_update): + """Sets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. + + + :param notify_on_comment_update: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._notify_on_comment_update = notify_on_comment_update + + @property + def only_user_comments(self): + """Gets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_user_comments + + @only_user_comments.setter + def only_user_comments(self, only_user_comments): + """Sets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. + + + :param only_user_comments: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_user_comments = only_user_comments + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition.py new file mode 100644 index 0000000..ee10719 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCondition(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'list[AlarmConditionFilter]', + 'spec': 'AlarmConditionSpec' + } + + attribute_map = { + 'condition': 'condition', + 'spec': 'spec' + } + + def __init__(self, condition=None, spec=None): # noqa: E501 + """AlarmCondition - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._spec = None + self.discriminator = None + if condition is not None: + self.condition = condition + if spec is not None: + self.spec = spec + + @property + def condition(self): + """Gets the condition of this AlarmCondition. # noqa: E501 + + JSON array of alarm condition filters # noqa: E501 + + :return: The condition of this AlarmCondition. # noqa: E501 + :rtype: list[AlarmConditionFilter] + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmCondition. + + JSON array of alarm condition filters # noqa: E501 + + :param condition: The condition of this AlarmCondition. # noqa: E501 + :type: list[AlarmConditionFilter] + """ + + self._condition = condition + + @property + def spec(self): + """Gets the spec of this AlarmCondition. # noqa: E501 + + + :return: The spec of this AlarmCondition. # noqa: E501 + :rtype: AlarmConditionSpec + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this AlarmCondition. + + + :param spec: The spec of this AlarmCondition. # noqa: E501 + :type: AlarmConditionSpec + """ + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCondition, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCondition): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_filter.py new file mode 100644 index 0000000..93ff301 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_filter.py @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'AlarmConditionFilterKey', + 'value_type': 'str', + 'value': 'object', + 'predicate': 'KeyFilterPredicate' + } + + attribute_map = { + 'key': 'key', + 'value_type': 'valueType', + 'value': 'value', + 'predicate': 'predicate' + } + + def __init__(self, key=None, value_type=None, value=None, predicate=None): # noqa: E501 + """AlarmConditionFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._value_type = None + self._value = None + self._predicate = None + self.discriminator = None + if key is not None: + self.key = key + if value_type is not None: + self.value_type = value_type + if value is not None: + self.value = value + if predicate is not None: + self.predicate = predicate + + @property + def key(self): + """Gets the key of this AlarmConditionFilter. # noqa: E501 + + + :return: The key of this AlarmConditionFilter. # noqa: E501 + :rtype: AlarmConditionFilterKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilter. + + + :param key: The key of this AlarmConditionFilter. # noqa: E501 + :type: AlarmConditionFilterKey + """ + + self._key = key + + @property + def value_type(self): + """Gets the value_type of this AlarmConditionFilter. # noqa: E501 + + String representation of the type of the value # noqa: E501 + + :return: The value_type of this AlarmConditionFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this AlarmConditionFilter. + + String representation of the type of the value # noqa: E501 + + :param value_type: The value_type of this AlarmConditionFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + @property + def value(self): + """Gets the value of this AlarmConditionFilter. # noqa: E501 + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :return: The value of this AlarmConditionFilter. # noqa: E501 + :rtype: object + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this AlarmConditionFilter. + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :param value: The value of this AlarmConditionFilter. # noqa: E501 + :type: object + """ + + self._value = value + + @property + def predicate(self): + """Gets the predicate of this AlarmConditionFilter. # noqa: E501 + + + :return: The predicate of this AlarmConditionFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this AlarmConditionFilter. + + + :param predicate: The predicate of this AlarmConditionFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_filter_key.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_filter_key.py new file mode 100644 index 0000000..be6e0b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_filter_key.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilterKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'key': 'str' + } + + attribute_map = { + 'type': 'type', + 'key': 'key' + } + + def __init__(self, type=None, key=None): # noqa: E501 + """AlarmConditionFilterKey - a model defined in Swagger""" # noqa: E501 + self._type = None + self._key = None + self.discriminator = None + if type is not None: + self.type = type + if key is not None: + self.key = key + + @property + def type(self): + """Gets the type of this AlarmConditionFilterKey. # noqa: E501 + + The key type # noqa: E501 + + :return: The type of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmConditionFilterKey. + + The key type # noqa: E501 + + :param type: The type of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + allowed_values = ["ATTRIBUTE", "CONSTANT", "ENTITY_FIELD", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def key(self): + """Gets the key of this AlarmConditionFilterKey. # noqa: E501 + + String value representing the key # noqa: E501 + + :return: The key of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilterKey. + + String value representing the key # noqa: E501 + + :param key: The key of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilterKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilterKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_spec.py new file mode 100644 index 0000000..f550836 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_condition_spec.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionSpec(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_count_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_count_query.py new file mode 100644 index 0000000..24c16ae --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_count_query.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'end_ts': 'int', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'end_ts': 'endTs', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, end_ts=None, entity_filter=None, key_filters=None, search_propagated_alarms=None, severity_list=None, start_ts=None, status_list=None, time_window=None, type_list=None): # noqa: E501 + """AlarmCountQuery - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._end_ts = None + self._entity_filter = None + self._key_filters = None + self._search_propagated_alarms = None + self._severity_list = None + self._start_ts = None + self._status_list = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if end_ts is not None: + self.end_ts = end_ts + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmCountQuery. # noqa: E501 + + + :return: The assignee_id of this AlarmCountQuery. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmCountQuery. + + + :param assignee_id: The assignee_id of this AlarmCountQuery. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def end_ts(self): + """Gets the end_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The end_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmCountQuery. + + + :param end_ts: The end_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmCountQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmCountQuery. + + + :param entity_filter: The entity_filter of this AlarmCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmCountQuery. # noqa: E501 + + + :return: The key_filters of this AlarmCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmCountQuery. + + + :param key_filters: The key_filters of this AlarmCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmCountQuery. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmCountQuery. # noqa: E501 + + + :return: The severity_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmCountQuery. + + + :param severity_list: The severity_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def start_ts(self): + """Gets the start_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The start_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmCountQuery. + + + :param start_ts: The start_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmCountQuery. # noqa: E501 + + + :return: The status_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmCountQuery. + + + :param status_list: The status_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def time_window(self): + """Gets the time_window of this AlarmCountQuery. # noqa: E501 + + + :return: The time_window of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmCountQuery. + + + :param time_window: The time_window of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmCountQuery. # noqa: E501 + + + :return: The type_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmCountQuery. + + + :param type_list: The type_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data.py new file mode 100644 index 0000000..5badb1d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data.py @@ -0,0 +1,855 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate': 'bool', + 'originator_name': 'str', + 'propagate_to_owner': 'bool', + 'originator_label': 'str', + 'propagate_to_tenant': 'bool', + 'assignee': 'AlarmAssignee', + 'propagate_relation_types': 'list[str]', + 'status': 'str' + } + + attribute_map = { + 'entity_id': 'entityId', + 'latest': 'latest', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate': 'propagate', + 'originator_name': 'originatorName', + 'propagate_to_owner': 'propagateToOwner', + 'originator_label': 'originatorLabel', + 'propagate_to_tenant': 'propagateToTenant', + 'assignee': 'assignee', + 'propagate_relation_types': 'propagateRelationTypes', + 'status': 'status' + } + + def __init__(self, entity_id=None, latest=None, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate=None, originator_name=None, propagate_to_owner=None, originator_label=None, propagate_to_tenant=None, assignee=None, propagate_relation_types=None, status=None): # noqa: E501 + """AlarmData - a model defined in Swagger""" # noqa: E501 + self._entity_id = None + self._latest = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate = None + self._originator_name = None + self._propagate_to_owner = None + self._originator_label = None + self._propagate_to_tenant = None + self._assignee = None + self._propagate_relation_types = None + self._status = None + self.discriminator = None + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate is not None: + self.propagate = propagate + if originator_name is not None: + self.originator_name = originator_name + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_label is not None: + self.originator_label = originator_label + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if assignee is not None: + self.assignee = assignee + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + self.status = status + + @property + def entity_id(self): + """Gets the entity_id of this AlarmData. # noqa: E501 + + + :return: The entity_id of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AlarmData. + + + :param entity_id: The entity_id of this AlarmData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this AlarmData. # noqa: E501 + + + :return: The latest of this AlarmData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this AlarmData. + + + :param latest: The latest of this AlarmData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def id(self): + """Gets the id of this AlarmData. # noqa: E501 + + + :return: The id of this AlarmData. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmData. + + + :param id: The id of this AlarmData. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmData. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmData. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmData. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmData. # noqa: E501 + + + :return: The tenant_id of this AlarmData. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmData. + + + :param tenant_id: The tenant_id of this AlarmData. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmData. # noqa: E501 + + + :return: The customer_id of this AlarmData. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmData. + + + :param customer_id: The customer_id of this AlarmData. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmData. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmData. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmData. # noqa: E501 + + + :return: The originator of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmData. + + + :param originator: The originator of this AlarmData. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmData. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmData. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmData. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmData. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmData. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmData. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmData. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmData. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmData. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmData. # noqa: E501 + + + :return: The assignee_id of this AlarmData. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmData. + + + :param assignee_id: The assignee_id of this AlarmData. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmData. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmData. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmData. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmData. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmData. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmData. # noqa: E501 + + + :return: The details of this AlarmData. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmData. + + + :param details: The details of this AlarmData. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate(self): + """Gets the propagate of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmData. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def originator_name(self): + """Gets the originator_name of this AlarmData. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmData. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_label(self): + """Gets the originator_label of this AlarmData. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmData. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def assignee(self): + """Gets the assignee of this AlarmData. # noqa: E501 + + + :return: The assignee of this AlarmData. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmData. + + + :param assignee: The assignee of this AlarmData. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmData. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmData. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmData. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmData. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def status(self): + """Gets the status of this AlarmData. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmData. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmData. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data_page_link.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data_page_link.py new file mode 100644 index 0000000..0625bca --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data_page_link.py @@ -0,0 +1,450 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'dynamic': 'bool', + 'end_ts': 'int', + 'page': 'int', + 'page_size': 'int', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'sort_order': 'EntityDataSortOrder', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'text_search': 'str', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'dynamic': 'dynamic', + 'end_ts': 'endTs', + 'page': 'page', + 'page_size': 'pageSize', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'sort_order': 'sortOrder', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'text_search': 'textSearch', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, dynamic=None, end_ts=None, page=None, page_size=None, search_propagated_alarms=None, severity_list=None, sort_order=None, start_ts=None, status_list=None, text_search=None, time_window=None, type_list=None): # noqa: E501 + """AlarmDataPageLink - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._dynamic = None + self._end_ts = None + self._page = None + self._page_size = None + self._search_propagated_alarms = None + self._severity_list = None + self._sort_order = None + self._start_ts = None + self._status_list = None + self._text_search = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if dynamic is not None: + self.dynamic = dynamic + if end_ts is not None: + self.end_ts = end_ts + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if sort_order is not None: + self.sort_order = sort_order + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if text_search is not None: + self.text_search = text_search + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmDataPageLink. # noqa: E501 + + + :return: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmDataPageLink. + + + :param assignee_id: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def dynamic(self): + """Gets the dynamic of this AlarmDataPageLink. # noqa: E501 + + + :return: The dynamic of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this AlarmDataPageLink. + + + :param dynamic: The dynamic of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def end_ts(self): + """Gets the end_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The end_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmDataPageLink. + + + :param end_ts: The end_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def page(self): + """Gets the page of this AlarmDataPageLink. # noqa: E501 + + + :return: The page of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this AlarmDataPageLink. + + + :param page: The page of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this AlarmDataPageLink. # noqa: E501 + + + :return: The page_size of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this AlarmDataPageLink. + + + :param page_size: The page_size of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmDataPageLink. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The severity_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmDataPageLink. + + + :param severity_list: The severity_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def sort_order(self): + """Gets the sort_order of this AlarmDataPageLink. # noqa: E501 + + + :return: The sort_order of this AlarmDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this AlarmDataPageLink. + + + :param sort_order: The sort_order of this AlarmDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def start_ts(self): + """Gets the start_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The start_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmDataPageLink. + + + :param start_ts: The start_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The status_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmDataPageLink. + + + :param status_list: The status_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def text_search(self): + """Gets the text_search of this AlarmDataPageLink. # noqa: E501 + + + :return: The text_search of this AlarmDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this AlarmDataPageLink. + + + :param text_search: The text_search of this AlarmDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + @property + def time_window(self): + """Gets the time_window of this AlarmDataPageLink. # noqa: E501 + + + :return: The time_window of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmDataPageLink. + + + :param time_window: The time_window of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The type_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmDataPageLink. + + + :param type_list: The type_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data_query.py new file mode 100644 index 0000000..0bd5a21 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_data_query.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_fields': 'list[EntityKey]', + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'AlarmDataPageLink' + } + + attribute_map = { + 'alarm_fields': 'alarmFields', + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, alarm_fields=None, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """AlarmDataQuery - a model defined in Swagger""" # noqa: E501 + self._alarm_fields = None + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if alarm_fields is not None: + self.alarm_fields = alarm_fields + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def alarm_fields(self): + """Gets the alarm_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._alarm_fields + + @alarm_fields.setter + def alarm_fields(self, alarm_fields): + """Sets the alarm_fields of this AlarmDataQuery. + + + :param alarm_fields: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._alarm_fields = alarm_fields + + @property + def entity_fields(self): + """Gets the entity_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this AlarmDataQuery. + + + :param entity_fields: The entity_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmDataQuery. + + + :param entity_filter: The entity_filter of this AlarmDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmDataQuery. # noqa: E501 + + + :return: The key_filters of this AlarmDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmDataQuery. + + + :param key_filters: The key_filters of this AlarmDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this AlarmDataQuery. # noqa: E501 + + + :return: The latest_values of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this AlarmDataQuery. + + + :param latest_values: The latest_values of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this AlarmDataQuery. # noqa: E501 + + + :return: The page_link of this AlarmDataQuery. # noqa: E501 + :rtype: AlarmDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this AlarmDataQuery. + + + :param page_link: The page_link of this AlarmDataQuery. # noqa: E501 + :type: AlarmDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_id.py new file mode 100644 index 0000000..3fb48c2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AlarmId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AlarmId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AlarmId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AlarmId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AlarmId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AlarmId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_info.py new file mode 100644 index 0000000..addeac2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_info.py @@ -0,0 +1,803 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate': 'bool', + 'originator_name': 'str', + 'propagate_to_owner': 'bool', + 'originator_label': 'str', + 'propagate_to_tenant': 'bool', + 'assignee': 'AlarmAssignee', + 'propagate_relation_types': 'list[str]', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate': 'propagate', + 'originator_name': 'originatorName', + 'propagate_to_owner': 'propagateToOwner', + 'originator_label': 'originatorLabel', + 'propagate_to_tenant': 'propagateToTenant', + 'assignee': 'assignee', + 'propagate_relation_types': 'propagateRelationTypes', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate=None, originator_name=None, propagate_to_owner=None, originator_label=None, propagate_to_tenant=None, assignee=None, propagate_relation_types=None, status=None): # noqa: E501 + """AlarmInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate = None + self._originator_name = None + self._propagate_to_owner = None + self._originator_label = None + self._propagate_to_tenant = None + self._assignee = None + self._propagate_relation_types = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate is not None: + self.propagate = propagate + if originator_name is not None: + self.originator_name = originator_name + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_label is not None: + self.originator_label = originator_label + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if assignee is not None: + self.assignee = assignee + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + self.status = status + + @property + def id(self): + """Gets the id of this AlarmInfo. # noqa: E501 + + + :return: The id of this AlarmInfo. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmInfo. + + + :param id: The id of this AlarmInfo. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmInfo. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmInfo. # noqa: E501 + + + :return: The tenant_id of this AlarmInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmInfo. + + + :param tenant_id: The tenant_id of this AlarmInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmInfo. # noqa: E501 + + + :return: The customer_id of this AlarmInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmInfo. + + + :param customer_id: The customer_id of this AlarmInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmInfo. # noqa: E501 + + + :return: The originator of this AlarmInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmInfo. + + + :param originator: The originator of this AlarmInfo. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmInfo. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmInfo. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmInfo. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmInfo. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmInfo. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmInfo. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmInfo. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmInfo. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmInfo. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmInfo. # noqa: E501 + + + :return: The assignee_id of this AlarmInfo. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmInfo. + + + :param assignee_id: The assignee_id of this AlarmInfo. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmInfo. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmInfo. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmInfo. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmInfo. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmInfo. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmInfo. # noqa: E501 + + + :return: The details of this AlarmInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmInfo. + + + :param details: The details of this AlarmInfo. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate(self): + """Gets the propagate of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def originator_name(self): + """Gets the originator_name of this AlarmInfo. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmInfo. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_label(self): + """Gets the originator_label of this AlarmInfo. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmInfo. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def assignee(self): + """Gets the assignee of this AlarmInfo. # noqa: E501 + + + :return: The assignee of this AlarmInfo. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmInfo. + + + :param assignee: The assignee of this AlarmInfo. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmInfo. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmInfo. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def status(self): + """Gets the status of this AlarmInfo. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmInfo. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmInfo. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_notification_rule_trigger_config.py new file mode 100644 index 0000000..d1556af --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_notification_rule_trigger_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class AlarmNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_types': 'list[str]', + 'clear_rule': 'ClearRule', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_types': 'alarmTypes', + 'clear_rule': 'clearRule', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, alarm_severities=None, alarm_types=None, clear_rule=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """AlarmNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_types = None + self._clear_rule = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_types is not None: + self.alarm_types = alarm_types + if clear_rule is not None: + self.clear_rule = clear_rule + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def clear_rule(self): + """Gets the clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: ClearRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this AlarmNotificationRuleTriggerConfig. + + + :param clear_rule: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: ClearRule + """ + + self._clear_rule = clear_rule + + @property + def notify_on(self): + """Gets the notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACKNOWLEDGED", "CLEARED", "CREATED", "SEVERITY_CHANGED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_rule.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_rule.py new file mode 100644 index 0000000..a8cf0d7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_rule.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'AlarmCondition', + 'schedule': 'AlarmSchedule', + 'alarm_details': 'str', + 'dashboard_id': 'DashboardId' + } + + attribute_map = { + 'condition': 'condition', + 'schedule': 'schedule', + 'alarm_details': 'alarmDetails', + 'dashboard_id': 'dashboardId' + } + + def __init__(self, condition=None, schedule=None, alarm_details=None, dashboard_id=None): # noqa: E501 + """AlarmRule - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._schedule = None + self._alarm_details = None + self._dashboard_id = None + self.discriminator = None + if condition is not None: + self.condition = condition + if schedule is not None: + self.schedule = schedule + if alarm_details is not None: + self.alarm_details = alarm_details + if dashboard_id is not None: + self.dashboard_id = dashboard_id + + @property + def condition(self): + """Gets the condition of this AlarmRule. # noqa: E501 + + + :return: The condition of this AlarmRule. # noqa: E501 + :rtype: AlarmCondition + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmRule. + + + :param condition: The condition of this AlarmRule. # noqa: E501 + :type: AlarmCondition + """ + + self._condition = condition + + @property + def schedule(self): + """Gets the schedule of this AlarmRule. # noqa: E501 + + + :return: The schedule of this AlarmRule. # noqa: E501 + :rtype: AlarmSchedule + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this AlarmRule. + + + :param schedule: The schedule of this AlarmRule. # noqa: E501 + :type: AlarmSchedule + """ + + self._schedule = schedule + + @property + def alarm_details(self): + """Gets the alarm_details of this AlarmRule. # noqa: E501 + + String value representing the additional details for an alarm rule # noqa: E501 + + :return: The alarm_details of this AlarmRule. # noqa: E501 + :rtype: str + """ + return self._alarm_details + + @alarm_details.setter + def alarm_details(self, alarm_details): + """Sets the alarm_details of this AlarmRule. + + String value representing the additional details for an alarm rule # noqa: E501 + + :param alarm_details: The alarm_details of this AlarmRule. # noqa: E501 + :type: str + """ + + self._alarm_details = alarm_details + + @property + def dashboard_id(self): + """Gets the dashboard_id of this AlarmRule. # noqa: E501 + + + :return: The dashboard_id of this AlarmRule. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this AlarmRule. + + + :param dashboard_id: The dashboard_id of this AlarmRule. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_schedule.py new file mode 100644 index 0000000..5bc4b4a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/alarm_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AlarmSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AlarmSchedule. # noqa: E501 + + + :return: The dynamic_value of this AlarmSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AlarmSchedule. + + + :param dynamic_value: The dynamic_value of this AlarmSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AlarmSchedule. # noqa: E501 + + + :return: The type of this AlarmSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmSchedule. + + + :param type: The type of this AlarmSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/all_users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/all_users_filter.py new file mode 100644 index 0000000..0526abf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/all_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AllUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/allow_create_new_devices_device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/allow_create_new_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..3222814 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/allow_create_new_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllowCreateNewDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """AllowCreateNewDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllowCreateNewDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllowCreateNewDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/any_time_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_ce/any_time_schedule.py new file mode 100644 index 0000000..c787cd2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/any_time_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AnyTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AnyTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AnyTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AnyTimeSchedule. + + + :param dynamic_value: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AnyTimeSchedule. # noqa: E501 + + + :return: The type of this AnyTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AnyTimeSchedule. + + + :param type: The type of this AnyTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AnyTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AnyTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/api_usage_limit_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/api_usage_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..9a160c0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/api_usage_limit_notification_rule_trigger_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class ApiUsageLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'api_features': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'api_features': 'apiFeatures', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, api_features=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """ApiUsageLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._api_features = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if api_features is not None: + self.api_features = api_features + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def api_features(self): + """Gets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._api_features + + @api_features.setter + def api_features(self, api_features): + """Sets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param api_features: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "DB", "EMAIL", "JS", "RE", "SMS", "TRANSPORT"] # noqa: E501 + if not set(api_features).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `api_features` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(api_features) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._api_features = api_features + + @property + def notify_on(self): + """Gets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["DISABLED", "ENABLED", "WARNING"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/api_usage_state_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/api_usage_state_filter.py new file mode 100644 index 0000000..3b70f60 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/api_usage_state_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class ApiUsageStateFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'CustomerId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'customer_id': 'customerId' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, customer_id=None, *args, **kwargs): # noqa: E501 + """ApiUsageStateFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + if customer_id is not None: + self.customer_id = customer_id + EntityFilter.__init__(self, *args, **kwargs) + + @property + def customer_id(self): + """Gets the customer_id of this ApiUsageStateFilter. # noqa: E501 + + + :return: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ApiUsageStateFilter. + + + :param customer_id: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageStateFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageStateFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset.py new file mode 100644 index 0000000..7c68164 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset.py @@ -0,0 +1,340 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Asset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None): # noqa: E501 + """Asset - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.label = label + self.asset_profile_id = asset_profile_id + self.type = type + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Asset. # noqa: E501 + + + :return: The id of this Asset. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Asset. + + + :param id: The id of this Asset. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Asset. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this Asset. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Asset. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Asset. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Asset. # noqa: E501 + + + :return: The tenant_id of this Asset. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Asset. + + + :param tenant_id: The tenant_id of this Asset. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Asset. # noqa: E501 + + + :return: The customer_id of this Asset. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Asset. + + + :param customer_id: The customer_id of this Asset. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Asset. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this Asset. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Asset. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this Asset. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Asset. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this Asset. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Asset. + + Asset type # noqa: E501 + + :param type: The type of this Asset. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def label(self): + """Gets the label of this Asset. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Asset. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Asset. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Asset. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this Asset. # noqa: E501 + + + :return: The asset_profile_id of this Asset. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this Asset. + + + :param asset_profile_id: The asset_profile_id of this Asset. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this Asset. # noqa: E501 + + + :return: The additional_info of this Asset. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Asset. + + + :param additional_info: The additional_info of this Asset. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Asset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Asset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_id.py new file mode 100644 index 0000000..a66566c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_info.py new file mode 100644 index 0000000..5296762 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_info.py @@ -0,0 +1,426 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'bool', + 'asset_profile_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic', + 'asset_profile_name': 'assetProfileName' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None, customer_title=None, customer_is_public=None, asset_profile_name=None): # noqa: E501 + """AssetInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self._asset_profile_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.asset_profile_id = asset_profile_id + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + if asset_profile_name is not None: + self.asset_profile_name = asset_profile_name + + @property + def id(self): + """Gets the id of this AssetInfo. # noqa: E501 + + + :return: The id of this AssetInfo. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetInfo. + + + :param id: The id of this AssetInfo. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AssetInfo. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this AssetInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AssetInfo. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AssetInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetInfo. # noqa: E501 + + + :return: The tenant_id of this AssetInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetInfo. + + + :param tenant_id: The tenant_id of this AssetInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AssetInfo. # noqa: E501 + + + :return: The customer_id of this AssetInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AssetInfo. + + + :param customer_id: The customer_id of this AssetInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AssetInfo. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetInfo. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this AssetInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AssetInfo. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AssetInfo. + + Asset type # noqa: E501 + + :param type: The type of this AssetInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this AssetInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this AssetInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this AssetInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this AssetInfo. # noqa: E501 + + + :return: The asset_profile_id of this AssetInfo. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this AssetInfo. + + + :param asset_profile_id: The asset_profile_id of this AssetInfo. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this AssetInfo. # noqa: E501 + + + :return: The additional_info of this AssetInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this AssetInfo. + + + :param additional_info: The additional_info of this AssetInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this AssetInfo. # noqa: E501 + + Title of the Customer that owns the asset. # noqa: E501 + + :return: The customer_title of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this AssetInfo. + + Title of the Customer that owns the asset. # noqa: E501 + + :param customer_title: The customer_title of this AssetInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this AssetInfo. # noqa: E501 + + Indicates special 'Public' Customer that is auto-generated to use the assets on public dashboards. # noqa: E501 + + :return: The customer_is_public of this AssetInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this AssetInfo. + + Indicates special 'Public' Customer that is auto-generated to use the assets on public dashboards. # noqa: E501 + + :param customer_is_public: The customer_is_public of this AssetInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + @property + def asset_profile_name(self): + """Gets the asset_profile_name of this AssetInfo. # noqa: E501 + + Name of the corresponding Asset Profile. # noqa: E501 + + :return: The asset_profile_name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._asset_profile_name + + @asset_profile_name.setter + def asset_profile_name(self, asset_profile_name): + """Sets the asset_profile_name of this AssetInfo. + + Name of the corresponding Asset Profile. # noqa: E501 + + :param asset_profile_name: The asset_profile_name of this AssetInfo. # noqa: E501 + :type: str + """ + + self._asset_profile_name = asset_profile_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile.py new file mode 100644 index 0000000..eea7dbc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile.py @@ -0,0 +1,396 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetProfileId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'default': 'bool', + 'default_dashboard_id': 'DashboardId', + 'default_rule_chain_id': 'RuleChainId', + 'default_queue_name': 'str', + 'description': 'str', + 'image': 'str', + 'default_edge_rule_chain_id': 'RuleChainId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'default': 'default', + 'default_dashboard_id': 'defaultDashboardId', + 'default_rule_chain_id': 'defaultRuleChainId', + 'default_queue_name': 'defaultQueueName', + 'description': 'description', + 'image': 'image', + 'default_edge_rule_chain_id': 'defaultEdgeRuleChainId' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, name=None, default=None, default_dashboard_id=None, default_rule_chain_id=None, default_queue_name=None, description=None, image=None, default_edge_rule_chain_id=None): # noqa: E501 + """AssetProfile - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._default = None + self._default_dashboard_id = None + self._default_rule_chain_id = None + self._default_queue_name = None + self._description = None + self._image = None + self._default_edge_rule_chain_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if default is not None: + self.default = default + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if default_rule_chain_id is not None: + self.default_rule_chain_id = default_rule_chain_id + if default_queue_name is not None: + self.default_queue_name = default_queue_name + if description is not None: + self.description = description + if image is not None: + self.image = image + if default_edge_rule_chain_id is not None: + self.default_edge_rule_chain_id = default_edge_rule_chain_id + + @property + def id(self): + """Gets the id of this AssetProfile. # noqa: E501 + + + :return: The id of this AssetProfile. # noqa: E501 + :rtype: AssetProfileId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfile. + + + :param id: The id of this AssetProfile. # noqa: E501 + :type: AssetProfileId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AssetProfile. # noqa: E501 + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :return: The created_time of this AssetProfile. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AssetProfile. + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AssetProfile. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetProfile. # noqa: E501 + + + :return: The tenant_id of this AssetProfile. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetProfile. + + + :param tenant_id: The tenant_id of this AssetProfile. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this AssetProfile. # noqa: E501 + + Unique Asset Profile Name in scope of Tenant. # noqa: E501 + + :return: The name of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetProfile. + + Unique Asset Profile Name in scope of Tenant. # noqa: E501 + + :param name: The name of this AssetProfile. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def default(self): + """Gets the default of this AssetProfile. # noqa: E501 + + Used to mark the default profile. Default profile is used when the asset profile is not specified during asset creation. # noqa: E501 + + :return: The default of this AssetProfile. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this AssetProfile. + + Used to mark the default profile. Default profile is used when the asset profile is not specified during asset creation. # noqa: E501 + + :param default: The default of this AssetProfile. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this AssetProfile. # noqa: E501 + + + :return: The default_dashboard_id of this AssetProfile. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this AssetProfile. + + + :param default_dashboard_id: The default_dashboard_id of this AssetProfile. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def default_rule_chain_id(self): + """Gets the default_rule_chain_id of this AssetProfile. # noqa: E501 + + + :return: The default_rule_chain_id of this AssetProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_rule_chain_id + + @default_rule_chain_id.setter + def default_rule_chain_id(self, default_rule_chain_id): + """Sets the default_rule_chain_id of this AssetProfile. + + + :param default_rule_chain_id: The default_rule_chain_id of this AssetProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_rule_chain_id = default_rule_chain_id + + @property + def default_queue_name(self): + """Gets the default_queue_name of this AssetProfile. # noqa: E501 + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to asset, including asset updates, telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :return: The default_queue_name of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._default_queue_name + + @default_queue_name.setter + def default_queue_name(self, default_queue_name): + """Sets the default_queue_name of this AssetProfile. + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to asset, including asset updates, telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :param default_queue_name: The default_queue_name of this AssetProfile. # noqa: E501 + :type: str + """ + + self._default_queue_name = default_queue_name + + @property + def description(self): + """Gets the description of this AssetProfile. # noqa: E501 + + Asset Profile description. # noqa: E501 + + :return: The description of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this AssetProfile. + + Asset Profile description. # noqa: E501 + + :param description: The description of this AssetProfile. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this AssetProfile. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :return: The image of this AssetProfile. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this AssetProfile. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :param image: The image of this AssetProfile. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def default_edge_rule_chain_id(self): + """Gets the default_edge_rule_chain_id of this AssetProfile. # noqa: E501 + + + :return: The default_edge_rule_chain_id of this AssetProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_edge_rule_chain_id + + @default_edge_rule_chain_id.setter + def default_edge_rule_chain_id(self, default_edge_rule_chain_id): + """Sets the default_edge_rule_chain_id of this AssetProfile. + + + :param default_edge_rule_chain_id: The default_edge_rule_chain_id of this AssetProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_edge_rule_chain_id = default_edge_rule_chain_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile_id.py new file mode 100644 index 0000000..1c220c5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile_info.py new file mode 100644 index 0000000..2a3efea --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_profile_info.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str', + 'image': 'str', + 'default_dashboard_id': 'DashboardId', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'image': 'image', + 'default_dashboard_id': 'defaultDashboardId', + 'tenant_id': 'tenantId' + } + + def __init__(self, id=None, name=None, image=None, default_dashboard_id=None, tenant_id=None): # noqa: E501 + """AssetProfileInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._image = None + self._default_dashboard_id = None + self._tenant_id = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if image is not None: + self.image = image + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def id(self): + """Gets the id of this AssetProfileInfo. # noqa: E501 + + + :return: The id of this AssetProfileInfo. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfileInfo. + + + :param id: The id of this AssetProfileInfo. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this AssetProfileInfo. # noqa: E501 + + Entity Name # noqa: E501 + + :return: The name of this AssetProfileInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetProfileInfo. + + Entity Name # noqa: E501 + + :param name: The name of this AssetProfileInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def image(self): + """Gets the image of this AssetProfileInfo. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :return: The image of this AssetProfileInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this AssetProfileInfo. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of asset profiles in the grid view. # noqa: E501 + + :param image: The image of this AssetProfileInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this AssetProfileInfo. # noqa: E501 + + + :return: The default_dashboard_id of this AssetProfileInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this AssetProfileInfo. + + + :param default_dashboard_id: The default_dashboard_id of this AssetProfileInfo. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetProfileInfo. # noqa: E501 + + + :return: The tenant_id of this AssetProfileInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetProfileInfo. + + + :param tenant_id: The tenant_id of this AssetProfileInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_search_query.py new file mode 100644 index 0000000..d21cbae --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'asset_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'asset_types': 'assetTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, asset_types=None, parameters=None): # noqa: E501 + """AssetSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._asset_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if asset_types is not None: + self.asset_types = asset_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQuery. # noqa: E501 + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this AssetSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQuery. + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this AssetSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQuery. # noqa: E501 + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :return: The asset_types of this AssetSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQuery. + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :param asset_types: The asset_types of this AssetSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def parameters(self): + """Gets the parameters of this AssetSearchQuery. # noqa: E501 + + + :return: The parameters of this AssetSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this AssetSearchQuery. + + + :param parameters: The parameters of this AssetSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_search_query_filter.py new file mode 100644 index 0000000..3a438ac --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_types': 'assetTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """AssetSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._asset_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if asset_types is not None: + self.asset_types = asset_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQueryFilter. + + + :param asset_types: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def direction(self): + """Gets the direction of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The direction of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this AssetSearchQueryFilter. + + + :param direction: The direction of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this AssetSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this AssetSearchQueryFilter. + + + :param max_level: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQueryFilter. + + + :param relation_type: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this AssetSearchQueryFilter. + + + :param root_entity: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/asset_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_type_filter.py new file mode 100644 index 0000000..74203a4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/asset_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_name_filter': 'str', + 'asset_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_name_filter': 'assetNameFilter', + 'asset_types': 'assetTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_name_filter=None, asset_types=None, *args, **kwargs): # noqa: E501 + """AssetTypeFilter - a model defined in Swagger""" # noqa: E501 + self._asset_name_filter = None + self._asset_types = None + self.discriminator = None + if asset_name_filter is not None: + self.asset_name_filter = asset_name_filter + if asset_types is not None: + self.asset_types = asset_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_name_filter(self): + """Gets the asset_name_filter of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :rtype: str + """ + return self._asset_name_filter + + @asset_name_filter.setter + def asset_name_filter(self, asset_name_filter): + """Sets the asset_name_filter of this AssetTypeFilter. + + + :param asset_name_filter: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :type: str + """ + + self._asset_name_filter = asset_name_filter + + @property + def asset_types(self): + """Gets the asset_types of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_types of this AssetTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetTypeFilter. + + + :param asset_types: The asset_types of this AssetTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/atomic_integer.py b/tb-rest-client/python/tb_rest_client/models/models_ce/atomic_integer.py new file mode 100644 index 0000000..9afe97d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/atomic_integer.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AtomicInteger(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'acquire': 'int', + 'and_decrement': 'int', + 'and_increment': 'int', + 'opaque': 'int', + 'plain': 'int' + } + + attribute_map = { + 'acquire': 'acquire', + 'and_decrement': 'andDecrement', + 'and_increment': 'andIncrement', + 'opaque': 'opaque', + 'plain': 'plain' + } + + def __init__(self, acquire=None, and_decrement=None, and_increment=None, opaque=None, plain=None): # noqa: E501 + """AtomicInteger - a model defined in Swagger""" # noqa: E501 + self._acquire = None + self._and_decrement = None + self._and_increment = None + self._opaque = None + self._plain = None + self.discriminator = None + if acquire is not None: + self.acquire = acquire + if and_decrement is not None: + self.and_decrement = and_decrement + if and_increment is not None: + self.and_increment = and_increment + if opaque is not None: + self.opaque = opaque + if plain is not None: + self.plain = plain + + @property + def acquire(self): + """Gets the acquire of this AtomicInteger. # noqa: E501 + + + :return: The acquire of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._acquire + + @acquire.setter + def acquire(self, acquire): + """Sets the acquire of this AtomicInteger. + + + :param acquire: The acquire of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._acquire = acquire + + @property + def and_decrement(self): + """Gets the and_decrement of this AtomicInteger. # noqa: E501 + + + :return: The and_decrement of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_decrement + + @and_decrement.setter + def and_decrement(self, and_decrement): + """Sets the and_decrement of this AtomicInteger. + + + :param and_decrement: The and_decrement of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_decrement = and_decrement + + @property + def and_increment(self): + """Gets the and_increment of this AtomicInteger. # noqa: E501 + + + :return: The and_increment of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_increment + + @and_increment.setter + def and_increment(self, and_increment): + """Sets the and_increment of this AtomicInteger. + + + :param and_increment: The and_increment of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_increment = and_increment + + @property + def opaque(self): + """Gets the opaque of this AtomicInteger. # noqa: E501 + + + :return: The opaque of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._opaque + + @opaque.setter + def opaque(self, opaque): + """Sets the opaque of this AtomicInteger. + + + :param opaque: The opaque of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._opaque = opaque + + @property + def plain(self): + """Gets the plain of this AtomicInteger. # noqa: E501 + + + :return: The plain of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._plain + + @plain.setter + def plain(self, plain): + """Sets the plain of this AtomicInteger. + + + :param plain: The plain of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._plain = plain + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AtomicInteger, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AtomicInteger): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/attribute_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/attribute_export_data.py new file mode 100644 index 0000000..ceff694 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/attribute_export_data.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributeExportData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'boolean_value': 'bool', + 'double_value': 'float', + 'json_value': 'str', + 'key': 'str', + 'last_update_ts': 'int', + 'long_value': 'int', + 'str_value': 'str' + } + + attribute_map = { + 'boolean_value': 'booleanValue', + 'double_value': 'doubleValue', + 'json_value': 'jsonValue', + 'key': 'key', + 'last_update_ts': 'lastUpdateTs', + 'long_value': 'longValue', + 'str_value': 'strValue' + } + + def __init__(self, boolean_value=None, double_value=None, json_value=None, key=None, last_update_ts=None, long_value=None, str_value=None): # noqa: E501 + """AttributeExportData - a model defined in Swagger""" # noqa: E501 + self._boolean_value = None + self._double_value = None + self._json_value = None + self._key = None + self._last_update_ts = None + self._long_value = None + self._str_value = None + self.discriminator = None + if boolean_value is not None: + self.boolean_value = boolean_value + if double_value is not None: + self.double_value = double_value + if json_value is not None: + self.json_value = json_value + if key is not None: + self.key = key + if last_update_ts is not None: + self.last_update_ts = last_update_ts + if long_value is not None: + self.long_value = long_value + if str_value is not None: + self.str_value = str_value + + @property + def boolean_value(self): + """Gets the boolean_value of this AttributeExportData. # noqa: E501 + + + :return: The boolean_value of this AttributeExportData. # noqa: E501 + :rtype: bool + """ + return self._boolean_value + + @boolean_value.setter + def boolean_value(self, boolean_value): + """Sets the boolean_value of this AttributeExportData. + + + :param boolean_value: The boolean_value of this AttributeExportData. # noqa: E501 + :type: bool + """ + + self._boolean_value = boolean_value + + @property + def double_value(self): + """Gets the double_value of this AttributeExportData. # noqa: E501 + + + :return: The double_value of this AttributeExportData. # noqa: E501 + :rtype: float + """ + return self._double_value + + @double_value.setter + def double_value(self, double_value): + """Sets the double_value of this AttributeExportData. + + + :param double_value: The double_value of this AttributeExportData. # noqa: E501 + :type: float + """ + + self._double_value = double_value + + @property + def json_value(self): + """Gets the json_value of this AttributeExportData. # noqa: E501 + + + :return: The json_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AttributeExportData. + + + :param json_value: The json_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._json_value = json_value + + @property + def key(self): + """Gets the key of this AttributeExportData. # noqa: E501 + + + :return: The key of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AttributeExportData. + + + :param key: The key of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def last_update_ts(self): + """Gets the last_update_ts of this AttributeExportData. # noqa: E501 + + + :return: The last_update_ts of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._last_update_ts + + @last_update_ts.setter + def last_update_ts(self, last_update_ts): + """Sets the last_update_ts of this AttributeExportData. + + + :param last_update_ts: The last_update_ts of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._last_update_ts = last_update_ts + + @property + def long_value(self): + """Gets the long_value of this AttributeExportData. # noqa: E501 + + + :return: The long_value of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._long_value + + @long_value.setter + def long_value(self, long_value): + """Sets the long_value of this AttributeExportData. + + + :param long_value: The long_value of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._long_value = long_value + + @property + def str_value(self): + """Gets the str_value of this AttributeExportData. # noqa: E501 + + + :return: The str_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._str_value + + @str_value.setter + def str_value(self, str_value): + """Sets the str_value of this AttributeExportData. + + + :param str_value: The str_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._str_value = str_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributeExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributeExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/attributes_entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_ce/attributes_entity_view.py new file mode 100644 index 0000000..cf04a4c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/attributes_entity_view.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributesEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'cs': 'list[str]', + 'sh': 'list[str]', + 'ss': 'list[str]' + } + + attribute_map = { + 'cs': 'cs', + 'sh': 'sh', + 'ss': 'ss' + } + + def __init__(self, cs=None, sh=None, ss=None): # noqa: E501 + """AttributesEntityView - a model defined in Swagger""" # noqa: E501 + self._cs = None + self._sh = None + self._ss = None + self.discriminator = None + self.cs = cs + self.sh = sh + self.ss = ss + + @property + def cs(self): + """Gets the cs of this AttributesEntityView. # noqa: E501 + + List of client-side attribute keys to expose # noqa: E501 + + :return: The cs of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._cs + + @cs.setter + def cs(self, cs): + """Sets the cs of this AttributesEntityView. + + List of client-side attribute keys to expose # noqa: E501 + + :param cs: The cs of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if cs is None: + raise ValueError("Invalid value for `cs`, must not be `None`") # noqa: E501 + + self._cs = cs + + @property + def sh(self): + """Gets the sh of this AttributesEntityView. # noqa: E501 + + List of shared attribute keys to expose # noqa: E501 + + :return: The sh of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._sh + + @sh.setter + def sh(self, sh): + """Sets the sh of this AttributesEntityView. + + List of shared attribute keys to expose # noqa: E501 + + :param sh: The sh of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if sh is None: + raise ValueError("Invalid value for `sh`, must not be `None`") # noqa: E501 + + self._sh = sh + + @property + def ss(self): + """Gets the ss of this AttributesEntityView. # noqa: E501 + + List of server-side attribute keys to expose # noqa: E501 + + :return: The ss of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._ss + + @ss.setter + def ss(self, ss): + """Sets the ss of this AttributesEntityView. + + List of server-side attribute keys to expose # noqa: E501 + + :param ss: The ss of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if ss is None: + raise ValueError("Invalid value for `ss`, must not be `None`") # noqa: E501 + + self._ss = ss + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributesEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributesEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/audit_log.py b/tb-rest-client/python/tb_rest_client/models/models_ce/audit_log.py new file mode 100644 index 0000000..2701233 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/audit_log.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLog(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AuditLogId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'entity_id': 'EntityId', + 'entity_name': 'str', + 'user_id': 'UserId', + 'user_name': 'str', + 'action_type': 'str', + 'action_data': 'JsonNode', + 'action_status': 'str', + 'action_failure_details': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'entity_id': 'entityId', + 'entity_name': 'entityName', + 'user_id': 'userId', + 'user_name': 'userName', + 'action_type': 'actionType', + 'action_data': 'actionData', + 'action_status': 'actionStatus', + 'action_failure_details': 'actionFailureDetails' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, entity_id=None, entity_name=None, user_id=None, user_name=None, action_type=None, action_data=None, action_status=None, action_failure_details=None): # noqa: E501 + """AuditLog - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._entity_id = None + self._entity_name = None + self._user_id = None + self._user_name = None + self._action_type = None + self._action_data = None + self._action_status = None + self._action_failure_details = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if entity_id is not None: + self.entity_id = entity_id + if entity_name is not None: + self.entity_name = entity_name + if user_id is not None: + self.user_id = user_id + if user_name is not None: + self.user_name = user_name + if action_type is not None: + self.action_type = action_type + if action_data is not None: + self.action_data = action_data + if action_status is not None: + self.action_status = action_status + if action_failure_details is not None: + self.action_failure_details = action_failure_details + + @property + def id(self): + """Gets the id of this AuditLog. # noqa: E501 + + + :return: The id of this AuditLog. # noqa: E501 + :rtype: AuditLogId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLog. + + + :param id: The id of this AuditLog. # noqa: E501 + :type: AuditLogId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AuditLog. # noqa: E501 + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :return: The created_time of this AuditLog. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AuditLog. + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AuditLog. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AuditLog. # noqa: E501 + + + :return: The tenant_id of this AuditLog. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AuditLog. + + + :param tenant_id: The tenant_id of this AuditLog. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AuditLog. # noqa: E501 + + + :return: The customer_id of this AuditLog. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AuditLog. + + + :param customer_id: The customer_id of this AuditLog. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def entity_id(self): + """Gets the entity_id of this AuditLog. # noqa: E501 + + + :return: The entity_id of this AuditLog. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AuditLog. + + + :param entity_id: The entity_id of this AuditLog. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def entity_name(self): + """Gets the entity_name of this AuditLog. # noqa: E501 + + Name of the logged entity # noqa: E501 + + :return: The entity_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this AuditLog. + + Name of the logged entity # noqa: E501 + + :param entity_name: The entity_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._entity_name = entity_name + + @property + def user_id(self): + """Gets the user_id of this AuditLog. # noqa: E501 + + + :return: The user_id of this AuditLog. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AuditLog. + + + :param user_id: The user_id of this AuditLog. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def user_name(self): + """Gets the user_name of this AuditLog. # noqa: E501 + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :return: The user_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._user_name + + @user_name.setter + def user_name(self, user_name): + """Sets the user_name of this AuditLog. + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :param user_name: The user_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._user_name = user_name + + @property + def action_type(self): + """Gets the action_type of this AuditLog. # noqa: E501 + + String represented Action type # noqa: E501 + + :return: The action_type of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_type + + @action_type.setter + def action_type(self, action_type): + """Sets the action_type of this AuditLog. + + String represented Action type # noqa: E501 + + :param action_type: The action_type of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["ACTIVATED", "ADDED", "ADDED_COMMENT", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_DELETE", "ALARM_UNASSIGNED", "ASSIGNED_FROM_TENANT", "ASSIGNED_TO_CUSTOMER", "ASSIGNED_TO_EDGE", "ASSIGNED_TO_TENANT", "ATTRIBUTES_DELETED", "ATTRIBUTES_READ", "ATTRIBUTES_UPDATED", "CREDENTIALS_READ", "CREDENTIALS_UPDATED", "DELETED", "DELETED_COMMENT", "LOCKOUT", "LOGIN", "LOGOUT", "PROVISION_FAILURE", "PROVISION_SUCCESS", "RELATIONS_DELETED", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "RPC_CALL", "SUSPENDED", "TIMESERIES_DELETED", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_CUSTOMER", "UNASSIGNED_FROM_EDGE", "UPDATED", "UPDATED_COMMENT"] # noqa: E501 + if action_type not in allowed_values: + raise ValueError( + "Invalid value for `action_type` ({0}), must be one of {1}" # noqa: E501 + .format(action_type, allowed_values) + ) + + self._action_type = action_type + + @property + def action_data(self): + """Gets the action_data of this AuditLog. # noqa: E501 + + + :return: The action_data of this AuditLog. # noqa: E501 + :rtype: JsonNode + """ + return self._action_data + + @action_data.setter + def action_data(self, action_data): + """Sets the action_data of this AuditLog. + + + :param action_data: The action_data of this AuditLog. # noqa: E501 + :type: JsonNode + """ + + self._action_data = action_data + + @property + def action_status(self): + """Gets the action_status of this AuditLog. # noqa: E501 + + String represented Action status # noqa: E501 + + :return: The action_status of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_status + + @action_status.setter + def action_status(self, action_status): + """Sets the action_status of this AuditLog. + + String represented Action status # noqa: E501 + + :param action_status: The action_status of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["FAILURE", "SUCCESS"] # noqa: E501 + if action_status not in allowed_values: + raise ValueError( + "Invalid value for `action_status` ({0}), must be one of {1}" # noqa: E501 + .format(action_status, allowed_values) + ) + + self._action_status = action_status + + @property + def action_failure_details(self): + """Gets the action_failure_details of this AuditLog. # noqa: E501 + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :return: The action_failure_details of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_failure_details + + @action_failure_details.setter + def action_failure_details(self, action_failure_details): + """Sets the action_failure_details of this AuditLog. + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :param action_failure_details: The action_failure_details of this AuditLog. # noqa: E501 + :type: str + """ + + self._action_failure_details = action_failure_details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLog, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/audit_log_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/audit_log_id.py new file mode 100644 index 0000000..5a23ffb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/audit_log_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLogId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AuditLogId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AuditLogId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AuditLogId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLogId. + + string # noqa: E501 + + :param id: The id of this AuditLogId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLogId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLogId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/auto_version_create_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/auto_version_create_config.py new file mode 100644 index 0000000..d428fae --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/auto_version_create_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AutoVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'branch': 'branch', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_relations': 'saveRelations' + } + + def __init__(self, branch=None, save_attributes=None, save_credentials=None, save_relations=None): # noqa: E501 + """AutoVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._save_attributes = None + self._save_credentials = None + self._save_relations = None + self.discriminator = None + if branch is not None: + self.branch = branch + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_relations is not None: + self.save_relations = save_relations + + @property + def branch(self): + """Gets the branch of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The branch of this AutoVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this AutoVersionCreateConfig. + + + :param branch: The branch of this AutoVersionCreateConfig. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def save_attributes(self): + """Gets the save_attributes of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this AutoVersionCreateConfig. + + + :param save_attributes: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this AutoVersionCreateConfig. + + + :param save_credentials: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_relations(self): + """Gets the save_relations of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this AutoVersionCreateConfig. + + + :param save_relations: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AutoVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AutoVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/aws_sns_sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/aws_sns_sms_provider_configuration.py new file mode 100644 index 0000000..04c6294 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/aws_sns_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class AwsSnsSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_key_id': 'str', + 'secret_access_key': 'str', + 'region': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'access_key_id': 'accessKeyId', + 'secret_access_key': 'secretAccessKey', + 'region': 'region' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, access_key_id=None, secret_access_key=None, region=None, *args, **kwargs): # noqa: E501 + """AwsSnsSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._access_key_id = None + self._secret_access_key = None + self._region = None + self.discriminator = None + if access_key_id is not None: + self.access_key_id = access_key_id + if secret_access_key is not None: + self.secret_access_key = secret_access_key + if region is not None: + self.region = region + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def access_key_id(self): + """Gets the access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key ID. # noqa: E501 + + :return: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._access_key_id + + @access_key_id.setter + def access_key_id(self, access_key_id): + """Sets the access_key_id of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key ID. # noqa: E501 + + :param access_key_id: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._access_key_id = access_key_id + + @property + def secret_access_key(self): + """Gets the secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key. # noqa: E501 + + :return: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._secret_access_key + + @secret_access_key.setter + def secret_access_key(self, secret_access_key): + """Sets the secret_access_key of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key. # noqa: E501 + + :param secret_access_key: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._secret_access_key = secret_access_key + + @property + def region(self): + """Gets the region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS region. # noqa: E501 + + :return: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this AwsSnsSmsProviderConfiguration. + + The AWS region. # noqa: E501 + + :param region: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._region = region + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AwsSnsSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AwsSnsSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/backup_code_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/backup_code_two_fa_account_config.py new file mode 100644 index 0000000..00bc857 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/backup_code_two_fa_account_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes': 'list[str]', + 'codes_left': 'int', + 'use_by_default': 'bool' + } + + attribute_map = { + 'codes': 'codes', + 'codes_left': 'codesLeft', + 'use_by_default': 'useByDefault' + } + + def __init__(self, codes=None, codes_left=None, use_by_default=None): # noqa: E501 + """BackupCodeTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._codes = None + self._codes_left = None + self._use_by_default = None + self.discriminator = None + if codes is not None: + self.codes = codes + if codes_left is not None: + self.codes_left = codes_left + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def codes(self): + """Gets the codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: list[str] + """ + return self._codes + + @codes.setter + def codes(self, codes): + """Sets the codes of this BackupCodeTwoFaAccountConfig. + + + :param codes: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: list[str] + """ + + self._codes = codes + + @property + def codes_left(self): + """Gets the codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: int + """ + return self._codes_left + + @codes_left.setter + def codes_left(self, codes_left): + """Sets the codes_left of this BackupCodeTwoFaAccountConfig. + + + :param codes_left: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: int + """ + + self._codes_left = codes_left + + @property + def use_by_default(self): + """Gets the use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this BackupCodeTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/backup_code_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/backup_code_two_fa_provider_config.py new file mode 100644 index 0000000..a4d1b17 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/backup_code_two_fa_provider_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes_quantity': 'int' + } + + attribute_map = { + 'codes_quantity': 'codesQuantity' + } + + def __init__(self, codes_quantity=None): # noqa: E501 + """BackupCodeTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._codes_quantity = None + self.discriminator = None + if codes_quantity is not None: + self.codes_quantity = codes_quantity + + @property + def codes_quantity(self): + """Gets the codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + + + :return: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._codes_quantity + + @codes_quantity.setter + def codes_quantity(self, codes_quantity): + """Sets the codes_quantity of this BackupCodeTwoFaProviderConfig. + + + :param codes_quantity: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._codes_quantity = codes_quantity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/boolean_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_ce/boolean_filter_predicate.py new file mode 100644 index 0000000..817351e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/boolean_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class BooleanFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValueboolean' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """BooleanFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this BooleanFilterPredicate. # noqa: E501 + + + :return: The operation of this BooleanFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this BooleanFilterPredicate. + + + :param operation: The operation of this BooleanFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this BooleanFilterPredicate. # noqa: E501 + + + :return: The value of this BooleanFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValueboolean + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this BooleanFilterPredicate. + + + :param value: The value of this BooleanFilterPredicate. # noqa: E501 + :type: FilterPredicateValueboolean + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BooleanFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BooleanFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/branch_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/branch_info.py new file mode 100644 index 0000000..c2c37c3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default': 'bool', + 'name': 'str' + } + + attribute_map = { + 'default': 'default', + 'name': 'name' + } + + def __init__(self, default=None, name=None): # noqa: E501 + """BranchInfo - a model defined in Swagger""" # noqa: E501 + self._default = None + self._name = None + self.discriminator = None + if default is not None: + self.default = default + if name is not None: + self.name = name + + @property + def default(self): + """Gets the default of this BranchInfo. # noqa: E501 + + + :return: The default of this BranchInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this BranchInfo. + + + :param default: The default of this BranchInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def name(self): + """Gets the name of this BranchInfo. # noqa: E501 + + + :return: The name of this BranchInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BranchInfo. + + + :param name: The name of this BranchInfo. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_request.py new file mode 100644 index 0000000..17d8ccd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_request.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'file': 'str', + 'mapping': 'Mapping' + } + + attribute_map = { + 'file': 'file', + 'mapping': 'mapping' + } + + def __init__(self, file=None, mapping=None): # noqa: E501 + """BulkImportRequest - a model defined in Swagger""" # noqa: E501 + self._file = None + self._mapping = None + self.discriminator = None + if file is not None: + self.file = file + if mapping is not None: + self.mapping = mapping + + @property + def file(self): + """Gets the file of this BulkImportRequest. # noqa: E501 + + + :return: The file of this BulkImportRequest. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this BulkImportRequest. + + + :param file: The file of this BulkImportRequest. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def mapping(self): + """Gets the mapping of this BulkImportRequest. # noqa: E501 + + + :return: The mapping of this BulkImportRequest. # noqa: E501 + :rtype: Mapping + """ + return self._mapping + + @mapping.setter + def mapping(self, mapping): + """Sets the mapping of this BulkImportRequest. + + + :param mapping: The mapping of this BulkImportRequest. # noqa: E501 + :type: Mapping + """ + + self._mapping = mapping + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_asset.py b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_asset.py new file mode 100644 index 0000000..f77caef --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_asset.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultAsset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultAsset - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultAsset. # noqa: E501 + + + :return: The created of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultAsset. + + + :param created: The created of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultAsset. + + + :param errors: The errors of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors_list of this BulkImportResultAsset. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultAsset. + + + :param errors_list: The errors_list of this BulkImportResultAsset. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultAsset. # noqa: E501 + + + :return: The updated of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultAsset. + + + :param updated: The updated of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultAsset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultAsset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_device.py b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_device.py new file mode 100644 index 0000000..c404290 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_device.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultDevice(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultDevice - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultDevice. # noqa: E501 + + + :return: The created of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultDevice. + + + :param created: The created of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultDevice. + + + :param errors: The errors of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors_list of this BulkImportResultDevice. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultDevice. + + + :param errors_list: The errors_list of this BulkImportResultDevice. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultDevice. # noqa: E501 + + + :return: The updated of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultDevice. + + + :param updated: The updated of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultDevice, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultDevice): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_edge.py b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_edge.py new file mode 100644 index 0000000..8ba7364 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/bulk_import_result_edge.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultEdge - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultEdge. # noqa: E501 + + + :return: The created of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultEdge. + + + :param created: The created of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultEdge. + + + :param errors: The errors of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors_list of this BulkImportResultEdge. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultEdge. + + + :param errors_list: The errors_list of this BulkImportResultEdge. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultEdge. # noqa: E501 + + + :return: The updated of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultEdge. + + + :param updated: The updated of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/byte_buffer.py b/tb-rest-client/python/tb_rest_client/models/models_ce/byte_buffer.py new file mode 100644 index 0000000..101bdb1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/byte_buffer.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ByteBuffer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'char': 'str', + 'direct': 'bool', + 'double': 'float', + '_float': 'float', + '_int': 'int', + 'long': 'int', + 'read_only': 'bool', + 'short': 'int' + } + + attribute_map = { + 'char': 'char', + 'direct': 'direct', + 'double': 'double', + '_float': 'float', + '_int': 'int', + 'long': 'long', + 'read_only': 'readOnly', + 'short': 'short' + } + + def __init__(self, char=None, direct=None, double=None, _float=None, _int=None, long=None, read_only=None, short=None): # noqa: E501 + """ByteBuffer - a model defined in Swagger""" # noqa: E501 + self._char = None + self._direct = None + self._double = None + self.__float = None + self.__int = None + self._long = None + self._read_only = None + self._short = None + self.discriminator = None + if char is not None: + self.char = char + if direct is not None: + self.direct = direct + if double is not None: + self.double = double + if _float is not None: + self._float = _float + if _int is not None: + self._int = _int + if long is not None: + self.long = long + if read_only is not None: + self.read_only = read_only + if short is not None: + self.short = short + + @property + def char(self): + """Gets the char of this ByteBuffer. # noqa: E501 + + + :return: The char of this ByteBuffer. # noqa: E501 + :rtype: str + """ + return self._char + + @char.setter + def char(self, char): + """Sets the char of this ByteBuffer. + + + :param char: The char of this ByteBuffer. # noqa: E501 + :type: str + """ + + self._char = char + + @property + def direct(self): + """Gets the direct of this ByteBuffer. # noqa: E501 + + + :return: The direct of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._direct + + @direct.setter + def direct(self, direct): + """Sets the direct of this ByteBuffer. + + + :param direct: The direct of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._direct = direct + + @property + def double(self): + """Gets the double of this ByteBuffer. # noqa: E501 + + + :return: The double of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self._double + + @double.setter + def double(self, double): + """Sets the double of this ByteBuffer. + + + :param double: The double of this ByteBuffer. # noqa: E501 + :type: float + """ + + self._double = double + + @property + def _float(self): + """Gets the _float of this ByteBuffer. # noqa: E501 + + + :return: The _float of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self.__float + + @_float.setter + def _float(self, _float): + """Sets the _float of this ByteBuffer. + + + :param _float: The _float of this ByteBuffer. # noqa: E501 + :type: float + """ + + self.__float = _float + + @property + def _int(self): + """Gets the _int of this ByteBuffer. # noqa: E501 + + + :return: The _int of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self.__int + + @_int.setter + def _int(self, _int): + """Sets the _int of this ByteBuffer. + + + :param _int: The _int of this ByteBuffer. # noqa: E501 + :type: int + """ + + self.__int = _int + + @property + def long(self): + """Gets the long of this ByteBuffer. # noqa: E501 + + + :return: The long of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._long + + @long.setter + def long(self, long): + """Sets the long of this ByteBuffer. + + + :param long: The long of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._long = long + + @property + def read_only(self): + """Gets the read_only of this ByteBuffer. # noqa: E501 + + + :return: The read_only of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this ByteBuffer. + + + :param read_only: The read_only of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def short(self): + """Gets the short of this ByteBuffer. # noqa: E501 + + + :return: The short of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._short + + @short.setter + def short(self, short): + """Sets the short of this ByteBuffer. + + + :param short: The short of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._short = short + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ByteBuffer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ByteBuffer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/change_password_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/change_password_request.py new file mode 100644 index 0000000..6cfce18 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/change_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ChangePasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_password': 'str', + 'new_password': 'str' + } + + attribute_map = { + 'current_password': 'currentPassword', + 'new_password': 'newPassword' + } + + def __init__(self, current_password=None, new_password=None): # noqa: E501 + """ChangePasswordRequest - a model defined in Swagger""" # noqa: E501 + self._current_password = None + self._new_password = None + self.discriminator = None + if current_password is not None: + self.current_password = current_password + if new_password is not None: + self.new_password = new_password + + @property + def current_password(self): + """Gets the current_password of this ChangePasswordRequest. # noqa: E501 + + The old password # noqa: E501 + + :return: The current_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._current_password + + @current_password.setter + def current_password(self, current_password): + """Sets the current_password of this ChangePasswordRequest. + + The old password # noqa: E501 + + :param current_password: The current_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._current_password = current_password + + @property + def new_password(self): + """Gets the new_password of this ChangePasswordRequest. # noqa: E501 + + The new password # noqa: E501 + + :return: The new_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._new_password + + @new_password.setter + def new_password(self, new_password): + """Sets the new_password of this ChangePasswordRequest. + + The new password # noqa: E501 + + :param new_password: The new_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._new_password = new_password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ChangePasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ChangePasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/check_pre_provisioned_devices_device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/check_pre_provisioned_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..d69b0ee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/check_pre_provisioned_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/claim_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/claim_request.py new file mode 100644 index 0000000..1658e07 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/claim_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClaimRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'secret_key': 'str' + } + + attribute_map = { + 'secret_key': 'secretKey' + } + + def __init__(self, secret_key=None): # noqa: E501 + """ClaimRequest - a model defined in Swagger""" # noqa: E501 + self._secret_key = None + self.discriminator = None + if secret_key is not None: + self.secret_key = secret_key + + @property + def secret_key(self): + """Gets the secret_key of this ClaimRequest. # noqa: E501 + + + :return: The secret_key of this ClaimRequest. # noqa: E501 + :rtype: str + """ + return self._secret_key + + @secret_key.setter + def secret_key(self, secret_key): + """Sets the secret_key of this ClaimRequest. + + + :param secret_key: The secret_key of this ClaimRequest. # noqa: E501 + :type: str + """ + + self._secret_key = secret_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClaimRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClaimRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/clear_rule.py b/tb-rest-client/python/tb_rest_client/models/models_ce/clear_rule.py new file mode 100644 index 0000000..29bf8f0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/clear_rule.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClearRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_statuses': 'list[str]' + } + + attribute_map = { + 'alarm_statuses': 'alarmStatuses' + } + + def __init__(self, alarm_statuses=None): # noqa: E501 + """ClearRule - a model defined in Swagger""" # noqa: E501 + self._alarm_statuses = None + self.discriminator = None + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this ClearRule. # noqa: E501 + + + :return: The alarm_statuses of this ClearRule. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this ClearRule. + + + :param alarm_statuses: The alarm_statuses of this ClearRule. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClearRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClearRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/client_attributes_querying_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/client_attributes_querying_snmp_communication_config.py new file mode 100644 index 0000000..c88ce58 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/client_attributes_querying_snmp_communication_config.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClientAttributesQueryingSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None): # noqa: E501 + """ClientAttributesQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClientAttributesQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClientAttributesQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_profile_transport_configuration.py new file mode 100644 index 0000000..9877a38 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_profile_transport_configuration.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class CoapDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_settings': 'PowerSavingConfiguration', + 'coap_device_type_configuration': 'CoapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'client_settings': 'clientSettings', + 'coap_device_type_configuration': 'coapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, client_settings=None, coap_device_type_configuration=None, *args, **kwargs): # noqa: E501 + """CoapDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_settings = None + self._coap_device_type_configuration = None + self.discriminator = None + if client_settings is not None: + self.client_settings = client_settings + if coap_device_type_configuration is not None: + self.coap_device_type_configuration = coap_device_type_configuration + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def client_settings(self): + """Gets the client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: PowerSavingConfiguration + """ + return self._client_settings + + @client_settings.setter + def client_settings(self, client_settings): + """Sets the client_settings of this CoapDeviceProfileTransportConfiguration. + + + :param client_settings: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: PowerSavingConfiguration + """ + + self._client_settings = client_settings + + @property + def coap_device_type_configuration(self): + """Gets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: CoapDeviceTypeConfiguration + """ + return self._coap_device_type_configuration + + @coap_device_type_configuration.setter + def coap_device_type_configuration(self, coap_device_type_configuration): + """Sets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. + + + :param coap_device_type_configuration: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: CoapDeviceTypeConfiguration + """ + + self._coap_device_type_configuration = coap_device_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_transport_configuration.py new file mode 100644 index 0000000..b491b65 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class CoapDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """CoapDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this CoapDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this CoapDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this CoapDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this CoapDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_type_configuration.py new file mode 100644 index 0000000..3038e39 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """CoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/column_mapping.py b/tb-rest-client/python/tb_rest_client/models/models_ce/column_mapping.py new file mode 100644 index 0000000..a262f20 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/column_mapping.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ColumnMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """ColumnMapping - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this ColumnMapping. # noqa: E501 + + + :return: The key of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this ColumnMapping. + + + :param key: The key of this ColumnMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this ColumnMapping. # noqa: E501 + + + :return: The type of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ColumnMapping. + + + :param type: The type of this ColumnMapping. # noqa: E501 + :type: str + """ + allowed_values = ["ACCESS_TOKEN", "DESCRIPTION", "IS_GATEWAY", "LABEL", "LWM2M_BOOTSTRAP_SERVER_PUBLIC_KEY_OR_ID", "LWM2M_BOOTSTRAP_SERVER_SECRET_KEY", "LWM2M_BOOTSTRAP_SERVER_SECURITY_MODE", "LWM2M_CLIENT_CERT", "LWM2M_CLIENT_ENDPOINT", "LWM2M_CLIENT_IDENTITY", "LWM2M_CLIENT_KEY", "LWM2M_CLIENT_SECURITY_CONFIG_MODE", "LWM2M_SERVER_CLIENT_PUBLIC_KEY_OR_ID", "LWM2M_SERVER_CLIENT_SECRET_KEY", "LWM2M_SERVER_SECURITY_MODE", "MQTT_CLIENT_ID", "MQTT_PASSWORD", "MQTT_USER_NAME", "NAME", "ROUTING_KEY", "SECRET", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIMESERIES", "TYPE", "X509"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ColumnMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ColumnMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/comparison_ts_value.py b/tb-rest-client/python/tb_rest_client/models/models_ce/comparison_ts_value.py new file mode 100644 index 0000000..aaaa30f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/comparison_ts_value.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComparisonTsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current': 'TsValue', + 'previous': 'TsValue' + } + + attribute_map = { + 'current': 'current', + 'previous': 'previous' + } + + def __init__(self, current=None, previous=None): # noqa: E501 + """ComparisonTsValue - a model defined in Swagger""" # noqa: E501 + self._current = None + self._previous = None + self.discriminator = None + if current is not None: + self.current = current + if previous is not None: + self.previous = previous + + @property + def current(self): + """Gets the current of this ComparisonTsValue. # noqa: E501 + + + :return: The current of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._current + + @current.setter + def current(self, current): + """Sets the current of this ComparisonTsValue. + + + :param current: The current of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._current = current + + @property + def previous(self): + """Gets the previous of this ComparisonTsValue. # noqa: E501 + + + :return: The previous of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._previous + + @previous.setter + def previous(self, previous): + """Sets the previous of this ComparisonTsValue. + + + :param previous: The previous of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._previous = previous + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComparisonTsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComparisonTsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/complex_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_ce/complex_filter_predicate.py new file mode 100644 index 0000000..c0d6431 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/complex_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class ComplexFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'predicates': 'list[KeyFilterPredicate]' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'predicates': 'predicates' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, predicates=None, *args, **kwargs): # noqa: E501 + """ComplexFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._predicates = None + self.discriminator = None + if operation is not None: + self.operation = operation + if predicates is not None: + self.predicates = predicates + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this ComplexFilterPredicate. # noqa: E501 + + + :return: The operation of this ComplexFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this ComplexFilterPredicate. + + + :param operation: The operation of this ComplexFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["AND", "OR"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def predicates(self): + """Gets the predicates of this ComplexFilterPredicate. # noqa: E501 + + + :return: The predicates of this ComplexFilterPredicate. # noqa: E501 + :rtype: list[KeyFilterPredicate] + """ + return self._predicates + + @predicates.setter + def predicates(self, predicates): + """Sets the predicates of this ComplexFilterPredicate. + + + :param predicates: The predicates of this ComplexFilterPredicate. # noqa: E501 + :type: list[KeyFilterPredicate] + """ + + self._predicates = predicates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/complex_version_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/complex_version_create_request.py new file mode 100644 index 0000000..a27cd23 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/complex_version_create_request.py @@ -0,0 +1,246 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class ComplexVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'entity_types': 'dict(str, EntityTypeVersionCreateConfig)', + 'sync_strategy': 'str', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'entity_types': 'entityTypes', + 'sync_strategy': 'syncStrategy', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, entity_types=None, sync_strategy=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """ComplexVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._entity_types = None + self._sync_strategy = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if entity_types is not None: + self.entity_types = entity_types + if sync_strategy is not None: + self.sync_strategy = sync_strategy + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this ComplexVersionCreateRequest. + + + :param branch: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def entity_types(self): + """Gets the entity_types of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionCreateConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this ComplexVersionCreateRequest. + + + :param entity_types: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionCreateConfig) + """ + + self._entity_types = entity_types + + @property + def sync_strategy(self): + """Gets the sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this ComplexVersionCreateRequest. + + + :param sync_strategy: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + @property + def type(self): + """Gets the type of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The type of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComplexVersionCreateRequest. + + + :param type: The type of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this ComplexVersionCreateRequest. + + + :param version_name: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/component_descriptor.py b/tb-rest-client/python/tb_rest_client/models/models_ce/component_descriptor.py new file mode 100644 index 0000000..efd5a19 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/component_descriptor.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptor(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'ComponentDescriptorId', + 'created_time': 'int', + 'type': 'str', + 'scope': 'str', + 'clustering_mode': 'str', + 'name': 'str', + 'clazz': 'str', + 'configuration_descriptor': 'JsonNode', + 'actions': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'type': 'type', + 'scope': 'scope', + 'clustering_mode': 'clusteringMode', + 'name': 'name', + 'clazz': 'clazz', + 'configuration_descriptor': 'configurationDescriptor', + 'actions': 'actions' + } + + def __init__(self, id=None, created_time=None, type=None, scope=None, clustering_mode=None, name=None, clazz=None, configuration_descriptor=None, actions=None): # noqa: E501 + """ComponentDescriptor - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._type = None + self._scope = None + self._clustering_mode = None + self._name = None + self._clazz = None + self._configuration_descriptor = None + self._actions = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if type is not None: + self.type = type + if scope is not None: + self.scope = scope + if clustering_mode is not None: + self.clustering_mode = clustering_mode + if name is not None: + self.name = name + if clazz is not None: + self.clazz = clazz + if configuration_descriptor is not None: + self.configuration_descriptor = configuration_descriptor + if actions is not None: + self.actions = actions + + @property + def id(self): + """Gets the id of this ComponentDescriptor. # noqa: E501 + + + :return: The id of this ComponentDescriptor. # noqa: E501 + :rtype: ComponentDescriptorId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptor. + + + :param id: The id of this ComponentDescriptor. # noqa: E501 + :type: ComponentDescriptorId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this ComponentDescriptor. # noqa: E501 + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :return: The created_time of this ComponentDescriptor. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ComponentDescriptor. + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this ComponentDescriptor. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def type(self): + """Gets the type of this ComponentDescriptor. # noqa: E501 + + Type of the Rule Node # noqa: E501 + + :return: The type of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComponentDescriptor. + + Type of the Rule Node # noqa: E501 + + :param type: The type of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ACTION", "ENRICHMENT", "EXTERNAL", "FILTER", "FLOW", "TRANSFORMATION"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def scope(self): + """Gets the scope of this ComponentDescriptor. # noqa: E501 + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :return: The scope of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this ComponentDescriptor. + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :param scope: The scope of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["TENANT"] # noqa: E501 + if scope not in allowed_values: + raise ValueError( + "Invalid value for `scope` ({0}), must be one of {1}" # noqa: E501 + .format(scope, allowed_values) + ) + + self._scope = scope + + @property + def clustering_mode(self): + """Gets the clustering_mode of this ComponentDescriptor. # noqa: E501 + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :return: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clustering_mode + + @clustering_mode.setter + def clustering_mode(self, clustering_mode): + """Sets the clustering_mode of this ComponentDescriptor. + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :param clustering_mode: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ENABLED", "SINGLETON", "USER_PREFERENCE"] # noqa: E501 + if clustering_mode not in allowed_values: + raise ValueError( + "Invalid value for `clustering_mode` ({0}), must be one of {1}" # noqa: E501 + .format(clustering_mode, allowed_values) + ) + + self._clustering_mode = clustering_mode + + @property + def name(self): + """Gets the name of this ComponentDescriptor. # noqa: E501 + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :return: The name of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ComponentDescriptor. + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :param name: The name of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def clazz(self): + """Gets the clazz of this ComponentDescriptor. # noqa: E501 + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :return: The clazz of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clazz + + @clazz.setter + def clazz(self, clazz): + """Sets the clazz of this ComponentDescriptor. + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :param clazz: The clazz of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._clazz = clazz + + @property + def configuration_descriptor(self): + """Gets the configuration_descriptor of this ComponentDescriptor. # noqa: E501 + + + :return: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration_descriptor + + @configuration_descriptor.setter + def configuration_descriptor(self, configuration_descriptor): + """Sets the configuration_descriptor of this ComponentDescriptor. + + + :param configuration_descriptor: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :type: JsonNode + """ + + self._configuration_descriptor = configuration_descriptor + + @property + def actions(self): + """Gets the actions of this ComponentDescriptor. # noqa: E501 + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :return: The actions of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._actions + + @actions.setter + def actions(self, actions): + """Sets the actions of this ComponentDescriptor. + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :param actions: The actions of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._actions = actions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptor, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptor): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/component_descriptor_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/component_descriptor_id.py new file mode 100644 index 0000000..401c397 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/component_descriptor_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptorId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """ComponentDescriptorId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this ComponentDescriptorId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this ComponentDescriptorId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptorId. + + string # noqa: E501 + + :param id: The id of this ComponentDescriptorId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptorId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptorId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/custom_time_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_ce/custom_time_schedule.py new file mode 100644 index 0000000..18842eb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/custom_time_schedule.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'items': 'list[CustomTimeScheduleItem]', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'items': 'items', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, items=None, timezone=None, type=None): # noqa: E501 + """CustomTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._items = None + self._timezone = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if items is not None: + self.items = items + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this CustomTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this CustomTimeSchedule. + + + :param dynamic_value: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def items(self): + """Gets the items of this CustomTimeSchedule. # noqa: E501 + + + :return: The items of this CustomTimeSchedule. # noqa: E501 + :rtype: list[CustomTimeScheduleItem] + """ + return self._items + + @items.setter + def items(self, items): + """Sets the items of this CustomTimeSchedule. + + + :param items: The items of this CustomTimeSchedule. # noqa: E501 + :type: list[CustomTimeScheduleItem] + """ + + self._items = items + + @property + def timezone(self): + """Gets the timezone of this CustomTimeSchedule. # noqa: E501 + + + :return: The timezone of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this CustomTimeSchedule. + + + :param timezone: The timezone of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this CustomTimeSchedule. # noqa: E501 + + + :return: The type of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this CustomTimeSchedule. + + + :param type: The type of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/custom_time_schedule_item.py b/tb-rest-client/python/tb_rest_client/models/models_ce/custom_time_schedule_item.py new file mode 100644 index 0000000..010c246 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/custom_time_schedule_item.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeScheduleItem(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'day_of_week': 'int', + 'enabled': 'bool', + 'ends_on': 'int', + 'starts_on': 'int' + } + + attribute_map = { + 'day_of_week': 'dayOfWeek', + 'enabled': 'enabled', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn' + } + + def __init__(self, day_of_week=None, enabled=None, ends_on=None, starts_on=None): # noqa: E501 + """CustomTimeScheduleItem - a model defined in Swagger""" # noqa: E501 + self._day_of_week = None + self._enabled = None + self._ends_on = None + self._starts_on = None + self.discriminator = None + if day_of_week is not None: + self.day_of_week = day_of_week + if enabled is not None: + self.enabled = enabled + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + + @property + def day_of_week(self): + """Gets the day_of_week of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._day_of_week + + @day_of_week.setter + def day_of_week(self, day_of_week): + """Sets the day_of_week of this CustomTimeScheduleItem. + + + :param day_of_week: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._day_of_week = day_of_week + + @property + def enabled(self): + """Gets the enabled of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this CustomTimeScheduleItem. + + + :param enabled: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def ends_on(self): + """Gets the ends_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this CustomTimeScheduleItem. + + + :param ends_on: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this CustomTimeScheduleItem. + + + :param starts_on: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeScheduleItem, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeScheduleItem): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/customer.py b/tb-rest-client/python/tb_rest_client/models/models_ce/customer.py new file mode 100644 index 0000000..192f217 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/customer.py @@ -0,0 +1,475 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Customer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'CustomerId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'tenant_id': 'TenantId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'tenant_id': 'tenantId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, tenant_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None): # noqa: E501 + """Customer - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._tenant_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + self.tenant_id = tenant_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Customer. # noqa: E501 + + + :return: The id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Customer. + + + :param id: The id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Customer. # noqa: E501 + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :return: The created_time of this Customer. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Customer. + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Customer. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this Customer. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The title of this Customer. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Customer. + + Title of the customer # noqa: E501 + + :param title: The title of this Customer. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this Customer. # noqa: E501 + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this Customer. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Customer. + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this Customer. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this Customer. # noqa: E501 + + + :return: The tenant_id of this Customer. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Customer. + + + :param tenant_id: The tenant_id of this Customer. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def country(self): + """Gets the country of this Customer. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this Customer. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this Customer. + + Country # noqa: E501 + + :param country: The country of this Customer. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this Customer. # noqa: E501 + + State # noqa: E501 + + :return: The state of this Customer. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Customer. + + State # noqa: E501 + + :param state: The state of this Customer. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this Customer. # noqa: E501 + + City # noqa: E501 + + :return: The city of this Customer. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this Customer. + + City # noqa: E501 + + :param city: The city of this Customer. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this Customer. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this Customer. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this Customer. + + Address Line 1 # noqa: E501 + + :param address: The address of this Customer. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this Customer. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this Customer. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this Customer. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this Customer. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this Customer. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this Customer. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this Customer. + + Zip code # noqa: E501 + + :param zip: The zip of this Customer. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this Customer. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this Customer. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this Customer. + + Phone number # noqa: E501 + + :param phone: The phone of this Customer. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this Customer. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this Customer. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Customer. + + Email # noqa: E501 + + :param email: The email of this Customer. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this Customer. # noqa: E501 + + + :return: The additional_info of this Customer. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Customer. + + + :param additional_info: The additional_info of this Customer. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Customer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Customer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/customer_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/customer_id.py new file mode 100644 index 0000000..1199f81 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/customer_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """CustomerId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this CustomerId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CustomerId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this CustomerId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this CustomerId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this CustomerId. + + string # noqa: E501 + + :param entity_type: The entity_type of this CustomerId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/customer_users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/customer_users_filter.py new file mode 100644 index 0000000..9246ce6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/customer_users_filter.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'str' + } + + attribute_map = { + 'customer_id': 'customerId' + } + + def __init__(self, customer_id=None): # noqa: E501 + """CustomerUsersFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + self.customer_id = customer_id + + @property + def customer_id(self): + """Gets the customer_id of this CustomerUsersFilter. # noqa: E501 + + + :return: The customer_id of this CustomerUsersFilter. # noqa: E501 + :rtype: str + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this CustomerUsersFilter. + + + :param customer_id: The customer_id of this CustomerUsersFilter. # noqa: E501 + :type: str + """ + if customer_id is None: + raise ValueError("Invalid value for `customer_id`, must not be `None`") # noqa: E501 + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard.py new file mode 100644 index 0000000..c947e99 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Dashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'title': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'image': 'str', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'title': 'title', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'image': 'image', + 'configuration': 'configuration' + } + + def __init__(self, created_time=None, tenant_id=None, name=None, title=None, assigned_customers=None, mobile_hide=None, mobile_order=None, image=None, configuration=None): # noqa: E501 + """Dashboard - a model defined in Swagger""" # noqa: E501 + self._created_time = None + self._tenant_id = None + self._name = None + self._title = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._image = None + self._configuration = None + self.discriminator = None + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if title is not None: + self.title = title + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if image is not None: + self.image = image + if configuration is not None: + self.configuration = configuration + + @property + def created_time(self): + """Gets the created_time of this Dashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Dashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Dashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Dashboard. # noqa: E501 + + + :return: The tenant_id of this Dashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Dashboard. + + + :param tenant_id: The tenant_id of this Dashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this Dashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Dashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this Dashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this Dashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Dashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this Dashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def assigned_customers(self): + """Gets the assigned_customers of this Dashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this Dashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this Dashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this Dashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this Dashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this Dashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this Dashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this Dashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this Dashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this Dashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this Dashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def image(self): + """Gets the image of this Dashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this Dashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this Dashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def configuration(self): + """Gets the configuration of this Dashboard. # noqa: E501 + + + :return: The configuration of this Dashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Dashboard. + + + :param configuration: The configuration of this Dashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Dashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Dashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard_id.py new file mode 100644 index 0000000..a56948a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DashboardId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DashboardId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DashboardId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DashboardId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DashboardId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DashboardId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DASHBOARD"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard_info.py new file mode 100644 index 0000000..c943784 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dashboard_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'title': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'image': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'title': 'title', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'image': 'image' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, name=None, title=None, assigned_customers=None, mobile_hide=None, mobile_order=None, image=None): # noqa: E501 + """DashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._title = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._image = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if title is not None: + self.title = title + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if image is not None: + self.image = image + + @property + def id(self): + """Gets the id of this DashboardInfo. # noqa: E501 + + + :return: The id of this DashboardInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardInfo. + + + :param id: The id of this DashboardInfo. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DashboardInfo. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DashboardInfo. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DashboardInfo. # noqa: E501 + + + :return: The tenant_id of this DashboardInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DashboardInfo. + + + :param tenant_id: The tenant_id of this DashboardInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this DashboardInfo. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DashboardInfo. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this DashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this DashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def assigned_customers(self): + """Gets the assigned_customers of this DashboardInfo. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this DashboardInfo. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this DashboardInfo. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this DashboardInfo. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this DashboardInfo. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this DashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this DashboardInfo. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this DashboardInfo. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this DashboardInfo. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this DashboardInfo. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def image(self): + """Gets the image of this DashboardInfo. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DashboardInfo. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._image = image + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/debug_rule_chain_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/debug_rule_chain_event_filter.py new file mode 100644 index 0000000..fdeb490 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/debug_rule_chain_event_filter.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .event_filter import EventFilter # noqa: F401,E501 + +class DebugRuleChainEventFilter(EventFilter): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'event_type': 'str', + 'msg_direction_type': 'str', + 'server': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'entity_name': 'str', + 'relation_type': 'str', + 'entity_id': 'str', + 'msg_type': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'event_type': 'eventType', + 'msg_direction_type': 'msgDirectionType', + 'server': 'server', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'entity_name': 'entityName', + 'relation_type': 'relationType', + 'entity_id': 'entityId', + 'msg_type': 'msgType', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, event_type=None, msg_direction_type=None, server=None, data_search=None, metadata_search=None, entity_name=None, relation_type=None, entity_id=None, msg_type=None, error_str=None, *args, **kwargs): # noqa: E501 + """DebugRuleChainEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._event_type = None + self._msg_direction_type = None + self._server = None + self._data_search = None + self._metadata_search = None + self._entity_name = None + self._relation_type = None + self._entity_id = None + self._msg_type = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + self.event_type = event_type + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if server is not None: + self.server = server + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if entity_name is not None: + self.entity_name = entity_name + if relation_type is not None: + self.relation_type = relation_type + if entity_id is not None: + self.entity_id = entity_id + if msg_type is not None: + self.msg_type = msg_type + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugRuleChainEventFilter. # noqa: E501 + + + :return: The error of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugRuleChainEventFilter. + + + :param error: The error of this DebugRuleChainEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def event_type(self): + """Gets the event_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugRuleChainEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this DebugRuleChainEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def server(self): + """Gets the server of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugRuleChainEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def data_search(self): + """Gets the data_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def entity_name(self): + """Gets the entity_name of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this DebugRuleChainEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_name: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_name not in allowed_values: + raise ValueError( + "Invalid value for `entity_name` ({0}), must be one of {1}" # noqa: E501 + .format(entity_name, allowed_values) + ) + + self._entity_name = entity_name + + @property + def relation_type(self): + """Gets the relation_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DebugRuleChainEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_id(self): + """Gets the entity_id of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this DebugRuleChainEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def msg_type(self): + """Gets the msg_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this DebugRuleChainEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + @property + def error_str(self): + """Gets the error_str of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugRuleChainEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugRuleChainEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/default_coap_device_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/default_coap_device_type_configuration.py new file mode 100644 index 0000000..f4ed1f3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/default_coap_device_type_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.coap_device_type_configuration import CoapDeviceTypeConfiguration # noqa: F401,E501 + +class DefaultCoapDeviceTypeConfiguration(CoapDeviceTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "swagger_types"): + swagger_types.update(CoapDeviceTypeConfiguration.swagger_types) + + attribute_map = { + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "attribute_map"): + attribute_map.update(CoapDeviceTypeConfiguration.attribute_map) + + def __init__(self, transport_payload_type_configuration=None, *args, **kwargs): # noqa: E501 + """DefaultCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self._transport_payload_type_configuration = None + self.discriminator = None + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + CoapDeviceTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_configuration.py new file mode 100644 index 0000000..3a35c14 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_configuration import DeviceConfiguration # noqa: F401,E501 + +class DefaultDeviceConfiguration(DeviceConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceConfiguration, "swagger_types"): + swagger_types.update(DeviceConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceConfiguration, "attribute_map"): + attribute_map.update(DeviceConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_profile_configuration.py new file mode 100644 index 0000000..b849551 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_profile_transport_configuration.py new file mode 100644 index 0000000..79d9c62 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_transport_configuration.py new file mode 100644 index 0000000..8d5e1dd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/default_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class DefaultDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/default_rule_chain_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/default_rule_chain_create_request.py new file mode 100644 index 0000000..621a17b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/default_rule_chain_create_request.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultRuleChainCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str' + } + + attribute_map = { + 'name': 'name' + } + + def __init__(self, name=None): # noqa: E501 + """DefaultRuleChainCreateRequest - a model defined in Swagger""" # noqa: E501 + self._name = None + self.discriminator = None + self.name = name + + @property + def name(self): + """Gets the name of this DefaultRuleChainCreateRequest. # noqa: E501 + + Name of the new rule chain # noqa: E501 + + :return: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DefaultRuleChainCreateRequest. + + Name of the new rule chain # noqa: E501 + + :param name: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultRuleChainCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultRuleChainCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/default_tenant_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/default_tenant_profile_configuration.py new file mode 100644 index 0000000..82e00fe --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/default_tenant_profile_configuration.py @@ -0,0 +1,1242 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultTenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms_ttl_days': 'int', + 'cassandra_query_tenant_rate_limits_configuration': 'str', + 'customer_server_rest_limits_configuration': 'str', + 'default_storage_ttl_days': 'int', + 'max_assets': 'int', + 'max_created_alarms': 'int', + 'max_customers': 'int', + 'max_dp_storage_days': 'int', + 'max_dashboards': 'int', + 'max_devices': 'int', + 'max_emails': 'int', + 'max_js_executions': 'int', + 'max_ota_packages_in_bytes': 'int', + 'max_re_executions': 'int', + 'max_resources_in_bytes': 'int', + 'max_rule_chains': 'int', + 'max_rule_node_executions_per_message': 'int', + 'max_sms': 'int', + 'max_transport_data_points': 'int', + 'max_transport_messages': 'int', + 'max_users': 'int', + 'max_ws_sessions_per_customer': 'int', + 'max_ws_sessions_per_public_user': 'int', + 'max_ws_sessions_per_regular_user': 'int', + 'max_ws_sessions_per_tenant': 'int', + 'max_ws_subscriptions_per_customer': 'int', + 'max_ws_subscriptions_per_public_user': 'int', + 'max_ws_subscriptions_per_regular_user': 'int', + 'max_ws_subscriptions_per_tenant': 'int', + 'rpc_ttl_days': 'int', + 'tenant_entity_export_rate_limit': 'str', + 'tenant_entity_import_rate_limit': 'str', + 'tenant_notification_requests_per_rule_rate_limit': 'str', + 'tenant_notification_requests_rate_limit': 'str', + 'tenant_server_rest_limits_configuration': 'str', + 'transport_device_msg_rate_limit': 'str', + 'transport_device_telemetry_data_points_rate_limit': 'str', + 'transport_device_telemetry_msg_rate_limit': 'str', + 'transport_tenant_msg_rate_limit': 'str', + 'transport_tenant_telemetry_data_points_rate_limit': 'str', + 'transport_tenant_telemetry_msg_rate_limit': 'str', + 'warn_threshold': 'float', + 'ws_msg_queue_limit_per_session': 'int', + 'ws_updates_per_session_rate_limit': 'str' + } + + attribute_map = { + 'alarms_ttl_days': 'alarmsTtlDays', + 'cassandra_query_tenant_rate_limits_configuration': 'cassandraQueryTenantRateLimitsConfiguration', + 'customer_server_rest_limits_configuration': 'customerServerRestLimitsConfiguration', + 'default_storage_ttl_days': 'defaultStorageTtlDays', + 'max_assets': 'maxAssets', + 'max_created_alarms': 'maxCreatedAlarms', + 'max_customers': 'maxCustomers', + 'max_dp_storage_days': 'maxDPStorageDays', + 'max_dashboards': 'maxDashboards', + 'max_devices': 'maxDevices', + 'max_emails': 'maxEmails', + 'max_js_executions': 'maxJSExecutions', + 'max_ota_packages_in_bytes': 'maxOtaPackagesInBytes', + 'max_re_executions': 'maxREExecutions', + 'max_resources_in_bytes': 'maxResourcesInBytes', + 'max_rule_chains': 'maxRuleChains', + 'max_rule_node_executions_per_message': 'maxRuleNodeExecutionsPerMessage', + 'max_sms': 'maxSms', + 'max_transport_data_points': 'maxTransportDataPoints', + 'max_transport_messages': 'maxTransportMessages', + 'max_users': 'maxUsers', + 'max_ws_sessions_per_customer': 'maxWsSessionsPerCustomer', + 'max_ws_sessions_per_public_user': 'maxWsSessionsPerPublicUser', + 'max_ws_sessions_per_regular_user': 'maxWsSessionsPerRegularUser', + 'max_ws_sessions_per_tenant': 'maxWsSessionsPerTenant', + 'max_ws_subscriptions_per_customer': 'maxWsSubscriptionsPerCustomer', + 'max_ws_subscriptions_per_public_user': 'maxWsSubscriptionsPerPublicUser', + 'max_ws_subscriptions_per_regular_user': 'maxWsSubscriptionsPerRegularUser', + 'max_ws_subscriptions_per_tenant': 'maxWsSubscriptionsPerTenant', + 'rpc_ttl_days': 'rpcTtlDays', + 'tenant_entity_export_rate_limit': 'tenantEntityExportRateLimit', + 'tenant_entity_import_rate_limit': 'tenantEntityImportRateLimit', + 'tenant_notification_requests_per_rule_rate_limit': 'tenantNotificationRequestsPerRuleRateLimit', + 'tenant_notification_requests_rate_limit': 'tenantNotificationRequestsRateLimit', + 'tenant_server_rest_limits_configuration': 'tenantServerRestLimitsConfiguration', + 'transport_device_msg_rate_limit': 'transportDeviceMsgRateLimit', + 'transport_device_telemetry_data_points_rate_limit': 'transportDeviceTelemetryDataPointsRateLimit', + 'transport_device_telemetry_msg_rate_limit': 'transportDeviceTelemetryMsgRateLimit', + 'transport_tenant_msg_rate_limit': 'transportTenantMsgRateLimit', + 'transport_tenant_telemetry_data_points_rate_limit': 'transportTenantTelemetryDataPointsRateLimit', + 'transport_tenant_telemetry_msg_rate_limit': 'transportTenantTelemetryMsgRateLimit', + 'warn_threshold': 'warnThreshold', + 'ws_msg_queue_limit_per_session': 'wsMsgQueueLimitPerSession', + 'ws_updates_per_session_rate_limit': 'wsUpdatesPerSessionRateLimit' + } + + def __init__(self, alarms_ttl_days=None, cassandra_query_tenant_rate_limits_configuration=None, customer_server_rest_limits_configuration=None, default_storage_ttl_days=None, max_assets=None, max_created_alarms=None, max_customers=None, max_dp_storage_days=None, max_dashboards=None, max_devices=None, max_emails=None, max_js_executions=None, max_ota_packages_in_bytes=None, max_re_executions=None, max_resources_in_bytes=None, max_rule_chains=None, max_rule_node_executions_per_message=None, max_sms=None, max_transport_data_points=None, max_transport_messages=None, max_users=None, max_ws_sessions_per_customer=None, max_ws_sessions_per_public_user=None, max_ws_sessions_per_regular_user=None, max_ws_sessions_per_tenant=None, max_ws_subscriptions_per_customer=None, max_ws_subscriptions_per_public_user=None, max_ws_subscriptions_per_regular_user=None, max_ws_subscriptions_per_tenant=None, rpc_ttl_days=None, tenant_entity_export_rate_limit=None, tenant_entity_import_rate_limit=None, tenant_notification_requests_per_rule_rate_limit=None, tenant_notification_requests_rate_limit=None, tenant_server_rest_limits_configuration=None, transport_device_msg_rate_limit=None, transport_device_telemetry_data_points_rate_limit=None, transport_device_telemetry_msg_rate_limit=None, transport_tenant_msg_rate_limit=None, transport_tenant_telemetry_data_points_rate_limit=None, transport_tenant_telemetry_msg_rate_limit=None, warn_threshold=None, ws_msg_queue_limit_per_session=None, ws_updates_per_session_rate_limit=None): # noqa: E501 + """DefaultTenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self._alarms_ttl_days = None + self._cassandra_query_tenant_rate_limits_configuration = None + self._customer_server_rest_limits_configuration = None + self._default_storage_ttl_days = None + self._max_assets = None + self._max_created_alarms = None + self._max_customers = None + self._max_dp_storage_days = None + self._max_dashboards = None + self._max_devices = None + self._max_emails = None + self._max_js_executions = None + self._max_ota_packages_in_bytes = None + self._max_re_executions = None + self._max_resources_in_bytes = None + self._max_rule_chains = None + self._max_rule_node_executions_per_message = None + self._max_sms = None + self._max_transport_data_points = None + self._max_transport_messages = None + self._max_users = None + self._max_ws_sessions_per_customer = None + self._max_ws_sessions_per_public_user = None + self._max_ws_sessions_per_regular_user = None + self._max_ws_sessions_per_tenant = None + self._max_ws_subscriptions_per_customer = None + self._max_ws_subscriptions_per_public_user = None + self._max_ws_subscriptions_per_regular_user = None + self._max_ws_subscriptions_per_tenant = None + self._rpc_ttl_days = None + self._tenant_entity_export_rate_limit = None + self._tenant_entity_import_rate_limit = None + self._tenant_notification_requests_per_rule_rate_limit = None + self._tenant_notification_requests_rate_limit = None + self._tenant_server_rest_limits_configuration = None + self._transport_device_msg_rate_limit = None + self._transport_device_telemetry_data_points_rate_limit = None + self._transport_device_telemetry_msg_rate_limit = None + self._transport_tenant_msg_rate_limit = None + self._transport_tenant_telemetry_data_points_rate_limit = None + self._transport_tenant_telemetry_msg_rate_limit = None + self._warn_threshold = None + self._ws_msg_queue_limit_per_session = None + self._ws_updates_per_session_rate_limit = None + self.discriminator = None + if alarms_ttl_days is not None: + self.alarms_ttl_days = alarms_ttl_days + if cassandra_query_tenant_rate_limits_configuration is not None: + self.cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + if customer_server_rest_limits_configuration is not None: + self.customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + if default_storage_ttl_days is not None: + self.default_storage_ttl_days = default_storage_ttl_days + if max_assets is not None: + self.max_assets = max_assets + if max_created_alarms is not None: + self.max_created_alarms = max_created_alarms + if max_customers is not None: + self.max_customers = max_customers + if max_dp_storage_days is not None: + self.max_dp_storage_days = max_dp_storage_days + if max_dashboards is not None: + self.max_dashboards = max_dashboards + if max_devices is not None: + self.max_devices = max_devices + if max_emails is not None: + self.max_emails = max_emails + if max_js_executions is not None: + self.max_js_executions = max_js_executions + if max_ota_packages_in_bytes is not None: + self.max_ota_packages_in_bytes = max_ota_packages_in_bytes + if max_re_executions is not None: + self.max_re_executions = max_re_executions + if max_resources_in_bytes is not None: + self.max_resources_in_bytes = max_resources_in_bytes + if max_rule_chains is not None: + self.max_rule_chains = max_rule_chains + if max_rule_node_executions_per_message is not None: + self.max_rule_node_executions_per_message = max_rule_node_executions_per_message + if max_sms is not None: + self.max_sms = max_sms + if max_transport_data_points is not None: + self.max_transport_data_points = max_transport_data_points + if max_transport_messages is not None: + self.max_transport_messages = max_transport_messages + if max_users is not None: + self.max_users = max_users + if max_ws_sessions_per_customer is not None: + self.max_ws_sessions_per_customer = max_ws_sessions_per_customer + if max_ws_sessions_per_public_user is not None: + self.max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + if max_ws_sessions_per_regular_user is not None: + self.max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + if max_ws_sessions_per_tenant is not None: + self.max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + if max_ws_subscriptions_per_customer is not None: + self.max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + if max_ws_subscriptions_per_public_user is not None: + self.max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + if max_ws_subscriptions_per_regular_user is not None: + self.max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + if max_ws_subscriptions_per_tenant is not None: + self.max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + if rpc_ttl_days is not None: + self.rpc_ttl_days = rpc_ttl_days + if tenant_entity_export_rate_limit is not None: + self.tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + if tenant_entity_import_rate_limit is not None: + self.tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + if tenant_notification_requests_per_rule_rate_limit is not None: + self.tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + if tenant_notification_requests_rate_limit is not None: + self.tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + if tenant_server_rest_limits_configuration is not None: + self.tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + if transport_device_msg_rate_limit is not None: + self.transport_device_msg_rate_limit = transport_device_msg_rate_limit + if transport_device_telemetry_data_points_rate_limit is not None: + self.transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + if transport_device_telemetry_msg_rate_limit is not None: + self.transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + if transport_tenant_msg_rate_limit is not None: + self.transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + if transport_tenant_telemetry_data_points_rate_limit is not None: + self.transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + if transport_tenant_telemetry_msg_rate_limit is not None: + self.transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + if warn_threshold is not None: + self.warn_threshold = warn_threshold + if ws_msg_queue_limit_per_session is not None: + self.ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + if ws_updates_per_session_rate_limit is not None: + self.ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + @property + def alarms_ttl_days(self): + """Gets the alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._alarms_ttl_days + + @alarms_ttl_days.setter + def alarms_ttl_days(self, alarms_ttl_days): + """Sets the alarms_ttl_days of this DefaultTenantProfileConfiguration. + + + :param alarms_ttl_days: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._alarms_ttl_days = alarms_ttl_days + + @property + def cassandra_query_tenant_rate_limits_configuration(self): + """Gets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._cassandra_query_tenant_rate_limits_configuration + + @cassandra_query_tenant_rate_limits_configuration.setter + def cassandra_query_tenant_rate_limits_configuration(self, cassandra_query_tenant_rate_limits_configuration): + """Sets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param cassandra_query_tenant_rate_limits_configuration: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + + @property + def customer_server_rest_limits_configuration(self): + """Gets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._customer_server_rest_limits_configuration + + @customer_server_rest_limits_configuration.setter + def customer_server_rest_limits_configuration(self, customer_server_rest_limits_configuration): + """Sets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param customer_server_rest_limits_configuration: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + + @property + def default_storage_ttl_days(self): + """Gets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._default_storage_ttl_days + + @default_storage_ttl_days.setter + def default_storage_ttl_days(self, default_storage_ttl_days): + """Sets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. + + + :param default_storage_ttl_days: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._default_storage_ttl_days = default_storage_ttl_days + + @property + def max_assets(self): + """Gets the max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this DefaultTenantProfileConfiguration. + + + :param max_assets: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_created_alarms(self): + """Gets the max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_created_alarms + + @max_created_alarms.setter + def max_created_alarms(self, max_created_alarms): + """Sets the max_created_alarms of this DefaultTenantProfileConfiguration. + + + :param max_created_alarms: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_created_alarms = max_created_alarms + + @property + def max_customers(self): + """Gets the max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_customers + + @max_customers.setter + def max_customers(self, max_customers): + """Sets the max_customers of this DefaultTenantProfileConfiguration. + + + :param max_customers: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_customers = max_customers + + @property + def max_dp_storage_days(self): + """Gets the max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dp_storage_days + + @max_dp_storage_days.setter + def max_dp_storage_days(self, max_dp_storage_days): + """Sets the max_dp_storage_days of this DefaultTenantProfileConfiguration. + + + :param max_dp_storage_days: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dp_storage_days = max_dp_storage_days + + @property + def max_dashboards(self): + """Gets the max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dashboards + + @max_dashboards.setter + def max_dashboards(self, max_dashboards): + """Sets the max_dashboards of this DefaultTenantProfileConfiguration. + + + :param max_dashboards: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dashboards = max_dashboards + + @property + def max_devices(self): + """Gets the max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this DefaultTenantProfileConfiguration. + + + :param max_devices: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def max_emails(self): + """Gets the max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_emails + + @max_emails.setter + def max_emails(self, max_emails): + """Sets the max_emails of this DefaultTenantProfileConfiguration. + + + :param max_emails: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_emails = max_emails + + @property + def max_js_executions(self): + """Gets the max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_js_executions + + @max_js_executions.setter + def max_js_executions(self, max_js_executions): + """Sets the max_js_executions of this DefaultTenantProfileConfiguration. + + + :param max_js_executions: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_js_executions = max_js_executions + + @property + def max_ota_packages_in_bytes(self): + """Gets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ota_packages_in_bytes + + @max_ota_packages_in_bytes.setter + def max_ota_packages_in_bytes(self, max_ota_packages_in_bytes): + """Sets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_ota_packages_in_bytes: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ota_packages_in_bytes = max_ota_packages_in_bytes + + @property + def max_re_executions(self): + """Gets the max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_re_executions + + @max_re_executions.setter + def max_re_executions(self, max_re_executions): + """Sets the max_re_executions of this DefaultTenantProfileConfiguration. + + + :param max_re_executions: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_re_executions = max_re_executions + + @property + def max_resources_in_bytes(self): + """Gets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_resources_in_bytes + + @max_resources_in_bytes.setter + def max_resources_in_bytes(self, max_resources_in_bytes): + """Sets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_resources_in_bytes: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_resources_in_bytes = max_resources_in_bytes + + @property + def max_rule_chains(self): + """Gets the max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_chains + + @max_rule_chains.setter + def max_rule_chains(self, max_rule_chains): + """Sets the max_rule_chains of this DefaultTenantProfileConfiguration. + + + :param max_rule_chains: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_chains = max_rule_chains + + @property + def max_rule_node_executions_per_message(self): + """Gets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_node_executions_per_message + + @max_rule_node_executions_per_message.setter + def max_rule_node_executions_per_message(self, max_rule_node_executions_per_message): + """Sets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. + + + :param max_rule_node_executions_per_message: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_node_executions_per_message = max_rule_node_executions_per_message + + @property + def max_sms(self): + """Gets the max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_sms + + @max_sms.setter + def max_sms(self, max_sms): + """Sets the max_sms of this DefaultTenantProfileConfiguration. + + + :param max_sms: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_sms = max_sms + + @property + def max_transport_data_points(self): + """Gets the max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_data_points + + @max_transport_data_points.setter + def max_transport_data_points(self, max_transport_data_points): + """Sets the max_transport_data_points of this DefaultTenantProfileConfiguration. + + + :param max_transport_data_points: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_data_points = max_transport_data_points + + @property + def max_transport_messages(self): + """Gets the max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_messages + + @max_transport_messages.setter + def max_transport_messages(self, max_transport_messages): + """Sets the max_transport_messages of this DefaultTenantProfileConfiguration. + + + :param max_transport_messages: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_messages = max_transport_messages + + @property + def max_users(self): + """Gets the max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_users + + @max_users.setter + def max_users(self, max_users): + """Sets the max_users of this DefaultTenantProfileConfiguration. + + + :param max_users: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_users = max_users + + @property + def max_ws_sessions_per_customer(self): + """Gets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_customer + + @max_ws_sessions_per_customer.setter + def max_ws_sessions_per_customer(self, max_ws_sessions_per_customer): + """Sets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_customer: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_customer = max_ws_sessions_per_customer + + @property + def max_ws_sessions_per_public_user(self): + """Gets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_public_user + + @max_ws_sessions_per_public_user.setter + def max_ws_sessions_per_public_user(self, max_ws_sessions_per_public_user): + """Sets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_public_user: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + + @property + def max_ws_sessions_per_regular_user(self): + """Gets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_regular_user + + @max_ws_sessions_per_regular_user.setter + def max_ws_sessions_per_regular_user(self, max_ws_sessions_per_regular_user): + """Sets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_regular_user: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + + @property + def max_ws_sessions_per_tenant(self): + """Gets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_tenant + + @max_ws_sessions_per_tenant.setter + def max_ws_sessions_per_tenant(self, max_ws_sessions_per_tenant): + """Sets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_tenant: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + + @property + def max_ws_subscriptions_per_customer(self): + """Gets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_customer + + @max_ws_subscriptions_per_customer.setter + def max_ws_subscriptions_per_customer(self, max_ws_subscriptions_per_customer): + """Sets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_customer: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + + @property + def max_ws_subscriptions_per_public_user(self): + """Gets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_public_user + + @max_ws_subscriptions_per_public_user.setter + def max_ws_subscriptions_per_public_user(self, max_ws_subscriptions_per_public_user): + """Sets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_public_user: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + + @property + def max_ws_subscriptions_per_regular_user(self): + """Gets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_regular_user + + @max_ws_subscriptions_per_regular_user.setter + def max_ws_subscriptions_per_regular_user(self, max_ws_subscriptions_per_regular_user): + """Sets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_regular_user: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + + @property + def max_ws_subscriptions_per_tenant(self): + """Gets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_tenant + + @max_ws_subscriptions_per_tenant.setter + def max_ws_subscriptions_per_tenant(self, max_ws_subscriptions_per_tenant): + """Sets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_tenant: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + + @property + def rpc_ttl_days(self): + """Gets the rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._rpc_ttl_days + + @rpc_ttl_days.setter + def rpc_ttl_days(self, rpc_ttl_days): + """Sets the rpc_ttl_days of this DefaultTenantProfileConfiguration. + + + :param rpc_ttl_days: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._rpc_ttl_days = rpc_ttl_days + + @property + def tenant_entity_export_rate_limit(self): + """Gets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_export_rate_limit + + @tenant_entity_export_rate_limit.setter + def tenant_entity_export_rate_limit(self, tenant_entity_export_rate_limit): + """Sets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_export_rate_limit: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + + @property + def tenant_entity_import_rate_limit(self): + """Gets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_import_rate_limit + + @tenant_entity_import_rate_limit.setter + def tenant_entity_import_rate_limit(self, tenant_entity_import_rate_limit): + """Sets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_import_rate_limit: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + + @property + def tenant_notification_requests_per_rule_rate_limit(self): + """Gets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_per_rule_rate_limit + + @tenant_notification_requests_per_rule_rate_limit.setter + def tenant_notification_requests_per_rule_rate_limit(self, tenant_notification_requests_per_rule_rate_limit): + """Sets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_per_rule_rate_limit: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + + @property + def tenant_notification_requests_rate_limit(self): + """Gets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_rate_limit + + @tenant_notification_requests_rate_limit.setter + def tenant_notification_requests_rate_limit(self, tenant_notification_requests_rate_limit): + """Sets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_rate_limit: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + + @property + def tenant_server_rest_limits_configuration(self): + """Gets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_server_rest_limits_configuration + + @tenant_server_rest_limits_configuration.setter + def tenant_server_rest_limits_configuration(self, tenant_server_rest_limits_configuration): + """Sets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param tenant_server_rest_limits_configuration: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + + @property + def transport_device_msg_rate_limit(self): + """Gets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_msg_rate_limit + + @transport_device_msg_rate_limit.setter + def transport_device_msg_rate_limit(self, transport_device_msg_rate_limit): + """Sets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_msg_rate_limit: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_msg_rate_limit = transport_device_msg_rate_limit + + @property + def transport_device_telemetry_data_points_rate_limit(self): + """Gets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_data_points_rate_limit + + @transport_device_telemetry_data_points_rate_limit.setter + def transport_device_telemetry_data_points_rate_limit(self, transport_device_telemetry_data_points_rate_limit): + """Sets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_data_points_rate_limit: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + + @property + def transport_device_telemetry_msg_rate_limit(self): + """Gets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_msg_rate_limit + + @transport_device_telemetry_msg_rate_limit.setter + def transport_device_telemetry_msg_rate_limit(self, transport_device_telemetry_msg_rate_limit): + """Sets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_msg_rate_limit: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + + @property + def transport_tenant_msg_rate_limit(self): + """Gets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_msg_rate_limit + + @transport_tenant_msg_rate_limit.setter + def transport_tenant_msg_rate_limit(self, transport_tenant_msg_rate_limit): + """Sets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_msg_rate_limit: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + + @property + def transport_tenant_telemetry_data_points_rate_limit(self): + """Gets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_data_points_rate_limit + + @transport_tenant_telemetry_data_points_rate_limit.setter + def transport_tenant_telemetry_data_points_rate_limit(self, transport_tenant_telemetry_data_points_rate_limit): + """Sets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_data_points_rate_limit: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + + @property + def transport_tenant_telemetry_msg_rate_limit(self): + """Gets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_msg_rate_limit + + @transport_tenant_telemetry_msg_rate_limit.setter + def transport_tenant_telemetry_msg_rate_limit(self, transport_tenant_telemetry_msg_rate_limit): + """Sets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_msg_rate_limit: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + + @property + def warn_threshold(self): + """Gets the warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: float + """ + return self._warn_threshold + + @warn_threshold.setter + def warn_threshold(self, warn_threshold): + """Sets the warn_threshold of this DefaultTenantProfileConfiguration. + + + :param warn_threshold: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: float + """ + + self._warn_threshold = warn_threshold + + @property + def ws_msg_queue_limit_per_session(self): + """Gets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._ws_msg_queue_limit_per_session + + @ws_msg_queue_limit_per_session.setter + def ws_msg_queue_limit_per_session(self, ws_msg_queue_limit_per_session): + """Sets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. + + + :param ws_msg_queue_limit_per_session: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + + @property + def ws_updates_per_session_rate_limit(self): + """Gets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._ws_updates_per_session_rate_limit + + @ws_updates_per_session_rate_limit.setter + def ws_updates_per_session_rate_limit(self, ws_updates_per_session_rate_limit): + """Sets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. + + + :param ws_updates_per_session_rate_limit: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultTenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultTenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_entity_data_diff.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_entity_data_diff.py new file mode 100644 index 0000000..97d6061 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataDiff. + + + :param result: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataDiff. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_entity_data_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_entity_data_info.py new file mode 100644 index 0000000..fcc9c4f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_entity_data_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataInfo. + + + :param result: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_list_branch_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_list_branch_info.py new file mode 100644 index 0000000..84e1bb2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_list_branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListBranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListBranchInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The result of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListBranchInfo. + + + :param result: The result of this DeferredResultListBranchInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListBranchInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListBranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListBranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_list_versioned_entity_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_list_versioned_entity_info.py new file mode 100644 index 0000000..30d404b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_list_versioned_entity_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListVersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListVersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListVersionedEntityInfo. + + + :param result: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListVersionedEntityInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListVersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListVersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_page_data_entity_version.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_page_data_entity_version.py new file mode 100644 index 0000000..4749b47 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_page_data_entity_version.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultPageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultPageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultPageDataEntityVersion. + + + :param result: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultPageDataEntityVersion. + + + :param set_or_expired: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultPageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultPageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_repository_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_repository_settings.py new file mode 100644 index 0000000..1ab1ad0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_repository_settings.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultRepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultRepositorySettings - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The result of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultRepositorySettings. + + + :param result: The result of this DeferredResultRepositorySettings. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultRepositorySettings. + + + :param set_or_expired: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultRepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultRepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_response_entity.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_response_entity.py new file mode 100644 index 0000000..3ad93e3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_response_entity.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultResponseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultResponseEntity - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultResponseEntity. # noqa: E501 + + + :return: The result of this DeferredResultResponseEntity. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultResponseEntity. + + + :param result: The result of this DeferredResultResponseEntity. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultResponseEntity. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultResponseEntity. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultResponseEntity. + + + :param set_or_expired: The set_or_expired of this DeferredResultResponseEntity. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultResponseEntity, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultResponseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_void.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_void.py new file mode 100644 index 0000000..e7ea554 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_result_void.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultVoid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultVoid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultVoid. # noqa: E501 + + + :return: The result of this DeferredResultVoid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultVoid. + + + :param result: The result of this DeferredResultVoid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultVoid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultVoid. + + + :param set_or_expired: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultVoid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultVoid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_resultuuid.py b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_resultuuid.py new file mode 100644 index 0000000..178c6d7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/deferred_resultuuid.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultuuid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultuuid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultuuid. # noqa: E501 + + + :return: The result of this DeferredResultuuid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultuuid. + + + :param result: The result of this DeferredResultuuid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultuuid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultuuid. + + + :param set_or_expired: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultuuid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultuuid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/delivery_method_notification_template.py new file mode 100644 index 0000000..7128664 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """DeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this DeliveryMethodNotificationTemplate. + + + :param body: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this DeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device.py new file mode 100644 index 0000000..7b838ea --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device.py @@ -0,0 +1,418 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Device(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None): # noqa: E501 + """Device - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Device. # noqa: E501 + + + :return: The id of this Device. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Device. + + + :param id: The id of this Device. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Device. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this Device. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Device. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Device. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Device. # noqa: E501 + + + :return: The tenant_id of this Device. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Device. + + + :param tenant_id: The tenant_id of this Device. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Device. # noqa: E501 + + + :return: The customer_id of this Device. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Device. + + + :param customer_id: The customer_id of this Device. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Device. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this Device. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Device. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this Device. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Device. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this Device. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Device. + + Device Profile Name # noqa: E501 + + :param type: The type of this Device. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def label(self): + """Gets the label of this Device. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Device. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Device. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Device. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this Device. # noqa: E501 + + + :return: The device_profile_id of this Device. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this Device. + + + :param device_profile_id: The device_profile_id of this Device. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this Device. # noqa: E501 + + + :return: The device_data of this Device. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this Device. + + + :param device_data: The device_data of this Device. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this Device. # noqa: E501 + + + :return: The firmware_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this Device. + + + :param firmware_id: The firmware_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this Device. # noqa: E501 + + + :return: The software_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this Device. + + + :param software_id: The software_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this Device. # noqa: E501 + + + :return: The additional_info of this Device. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Device. + + + :param additional_info: The additional_info of this Device. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Device, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Device): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_activity_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_activity_notification_rule_trigger_config.py new file mode 100644 index 0000000..02fdaf5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_activity_notification_rule_trigger_config.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class DeviceActivityNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_profiles': 'list[str]', + 'devices': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'device_profiles': 'deviceProfiles', + 'devices': 'devices', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, device_profiles=None, devices=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """DeviceActivityNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._device_profiles = None + self._devices = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if device_profiles is not None: + self.device_profiles = device_profiles + if devices is not None: + self.devices = devices + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def device_profiles(self): + """Gets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._device_profiles + + @device_profiles.setter + def device_profiles(self, device_profiles): + """Sets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. + + + :param device_profiles: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._device_profiles = device_profiles + + @property + def devices(self): + """Gets the devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this DeviceActivityNotificationRuleTriggerConfig. + + + :param devices: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._devices = devices + + @property + def notify_on(self): + """Gets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVE", "INACTIVE"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceActivityNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceActivityNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_configuration.py new file mode 100644 index 0000000..27c6c20 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_credentials.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_credentials.py new file mode 100644 index 0000000..6301ab8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_credentials.py @@ -0,0 +1,267 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceCredentials(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceCredentialsId', + 'created_time': 'int', + 'device_id': 'DeviceId', + 'credentials_type': 'str', + 'credentials_id': 'str', + 'credentials_value': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'device_id': 'deviceId', + 'credentials_type': 'credentialsType', + 'credentials_id': 'credentialsId', + 'credentials_value': 'credentialsValue' + } + + def __init__(self, id=None, created_time=None, device_id=None, credentials_type=None, credentials_id=None, credentials_value=None): # noqa: E501 + """DeviceCredentials - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._device_id = None + self._credentials_type = None + self._credentials_id = None + self._credentials_value = None + self.discriminator = None + self.id = id + if created_time is not None: + self.created_time = created_time + self.device_id = device_id + if credentials_type is not None: + self.credentials_type = credentials_type + self.credentials_id = credentials_id + if credentials_value is not None: + self.credentials_value = credentials_value + + @property + def id(self): + """Gets the id of this DeviceCredentials. # noqa: E501 + + + :return: The id of this DeviceCredentials. # noqa: E501 + :rtype: DeviceCredentialsId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceCredentials. + + + :param id: The id of this DeviceCredentials. # noqa: E501 + :type: DeviceCredentialsId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DeviceCredentials. # noqa: E501 + + Timestamp of the device credentials creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceCredentials. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceCredentials. + + Timestamp of the device credentials creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceCredentials. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def device_id(self): + """Gets the device_id of this DeviceCredentials. # noqa: E501 + + + :return: The device_id of this DeviceCredentials. # noqa: E501 + :rtype: DeviceId + """ + return self._device_id + + @device_id.setter + def device_id(self, device_id): + """Sets the device_id of this DeviceCredentials. + + + :param device_id: The device_id of this DeviceCredentials. # noqa: E501 + :type: DeviceId + """ + + self._device_id = device_id + + @property + def credentials_type(self): + """Gets the credentials_type of this DeviceCredentials. # noqa: E501 + + Type of the credentials # noqa: E501 + + :return: The credentials_type of this DeviceCredentials. # noqa: E501 + :rtype: str + """ + return self._credentials_type + + @credentials_type.setter + def credentials_type(self, credentials_type): + """Sets the credentials_type of this DeviceCredentials. + + Type of the credentials # noqa: E501 + + :param credentials_type: The credentials_type of this DeviceCredentials. # noqa: E501 + :type: str + """ + allowed_values = ["ACCESS_TOKEN", "LWM2M_CREDENTIALS", "MQTT_BASIC", "X509_CERTIFICATE"] # noqa: E501 + if credentials_type not in allowed_values: + raise ValueError( + "Invalid value for `credentials_type` ({0}), must be one of {1}" # noqa: E501 + .format(credentials_type, allowed_values) + ) + + self._credentials_type = credentials_type + + @property + def credentials_id(self): + """Gets the credentials_id of this DeviceCredentials. # noqa: E501 + + Unique Credentials Id per platform instance. Used to lookup credentials from the database. By default, new access token for your device. Depends on the type of the credentials. # noqa: E501 + + :return: The credentials_id of this DeviceCredentials. # noqa: E501 + :rtype: str + """ + return self._credentials_id + + @credentials_id.setter + def credentials_id(self, credentials_id): + """Sets the credentials_id of this DeviceCredentials. + + Unique Credentials Id per platform instance. Used to lookup credentials from the database. By default, new access token for your device. Depends on the type of the credentials. # noqa: E501 + + :param credentials_id: The credentials_id of this DeviceCredentials. # noqa: E501 + :type: str + """ + if credentials_id is None: + raise ValueError("Invalid value for `credentials_id`, must not be `None`") # noqa: E501 + + self._credentials_id = credentials_id + + @property + def credentials_value(self): + """Gets the credentials_value of this DeviceCredentials. # noqa: E501 + + Value of the credentials. Null in case of ACCESS_TOKEN credentials type. Base64 value in case of X509_CERTIFICATE. Complex object in case of MQTT_BASIC and LWM2M_CREDENTIALS # noqa: E501 + + :return: The credentials_value of this DeviceCredentials. # noqa: E501 + :rtype: str + """ + return self._credentials_value + + @credentials_value.setter + def credentials_value(self, credentials_value): + """Sets the credentials_value of this DeviceCredentials. + + Value of the credentials. Null in case of ACCESS_TOKEN credentials type. Base64 value in case of X509_CERTIFICATE. Complex object in case of MQTT_BASIC and LWM2M_CREDENTIALS # noqa: E501 + + :param credentials_value: The credentials_value of this DeviceCredentials. # noqa: E501 + :type: str + """ + + self._credentials_value = credentials_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceCredentials, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceCredentials): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_credentials_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_credentials_id.py new file mode 100644 index 0000000..cb6ce2f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_credentials_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceCredentialsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """DeviceCredentialsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this DeviceCredentialsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this DeviceCredentialsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceCredentialsId. + + string # noqa: E501 + + :param id: The id of this DeviceCredentialsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceCredentialsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceCredentialsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_data.py new file mode 100644 index 0000000..f5c925a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_data.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceConfiguration', + 'transport_configuration': 'DeviceTransportConfiguration' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration' + } + + def __init__(self, configuration=None, transport_configuration=None): # noqa: E501 + """DeviceData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + + @property + def configuration(self): + """Gets the configuration of this DeviceData. # noqa: E501 + + + :return: The configuration of this DeviceData. # noqa: E501 + :rtype: DeviceConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceData. + + + :param configuration: The configuration of this DeviceData. # noqa: E501 + :type: DeviceConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceData. # noqa: E501 + + + :return: The transport_configuration of this DeviceData. # noqa: E501 + :rtype: DeviceTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceData. + + + :param transport_configuration: The transport_configuration of this DeviceData. # noqa: E501 + :type: DeviceTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_export_data.py new file mode 100644 index 0000000..a410363 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class DeviceExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'credentials': 'DeviceCredentials', + 'entity': 'Device', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'credentials': 'credentials', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, credentials=None, entity=None, entity_type=None, relations=None, *args, **kwargs): # noqa: E501 + """DeviceExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._credentials = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if credentials is not None: + self.credentials = credentials + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this DeviceExportData. # noqa: E501 + + + :return: The attributes of this DeviceExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this DeviceExportData. + + + :param attributes: The attributes of this DeviceExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def credentials(self): + """Gets the credentials of this DeviceExportData. # noqa: E501 + + + :return: The credentials of this DeviceExportData. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this DeviceExportData. + + + :param credentials: The credentials of this DeviceExportData. # noqa: E501 + :type: DeviceCredentials + """ + + self._credentials = credentials + + @property + def entity(self): + """Gets the entity of this DeviceExportData. # noqa: E501 + + + :return: The entity of this DeviceExportData. # noqa: E501 + :rtype: Device + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this DeviceExportData. + + + :param entity: The entity of this DeviceExportData. # noqa: E501 + :type: Device + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this DeviceExportData. # noqa: E501 + + + :return: The entity_type of this DeviceExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceExportData. + + + :param entity_type: The entity_type of this DeviceExportData. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this DeviceExportData. # noqa: E501 + + + :return: The relations of this DeviceExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this DeviceExportData. + + + :param relations: The relations of this DeviceExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_id.py new file mode 100644 index 0000000..2fc8571 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_info.py new file mode 100644 index 0000000..c464108 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_info.py @@ -0,0 +1,532 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'bool', + 'device_profile_name': 'str', + 'active': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic', + 'device_profile_name': 'deviceProfileName', + 'active': 'active' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None, customer_title=None, customer_is_public=None, device_profile_name=None, active=None): # noqa: E501 + """DeviceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self._device_profile_name = None + self._active = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + if device_profile_name is not None: + self.device_profile_name = device_profile_name + if active is not None: + self.active = active + + @property + def id(self): + """Gets the id of this DeviceInfo. # noqa: E501 + + + :return: The id of this DeviceInfo. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceInfo. + + + :param id: The id of this DeviceInfo. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DeviceInfo. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceInfo. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceInfo. # noqa: E501 + + + :return: The tenant_id of this DeviceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceInfo. + + + :param tenant_id: The tenant_id of this DeviceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this DeviceInfo. # noqa: E501 + + + :return: The customer_id of this DeviceInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this DeviceInfo. + + + :param customer_id: The customer_id of this DeviceInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this DeviceInfo. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceInfo. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this DeviceInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this DeviceInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this DeviceInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this DeviceInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this DeviceInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this DeviceInfo. # noqa: E501 + + + :return: The device_profile_id of this DeviceInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this DeviceInfo. + + + :param device_profile_id: The device_profile_id of this DeviceInfo. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this DeviceInfo. # noqa: E501 + + + :return: The device_data of this DeviceInfo. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this DeviceInfo. + + + :param device_data: The device_data of this DeviceInfo. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this DeviceInfo. # noqa: E501 + + + :return: The firmware_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this DeviceInfo. + + + :param firmware_id: The firmware_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this DeviceInfo. # noqa: E501 + + + :return: The software_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this DeviceInfo. + + + :param software_id: The software_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this DeviceInfo. # noqa: E501 + + + :return: The additional_info of this DeviceInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this DeviceInfo. + + + :param additional_info: The additional_info of this DeviceInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this DeviceInfo. # noqa: E501 + + Title of the Customer that owns the device. # noqa: E501 + + :return: The customer_title of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this DeviceInfo. + + Title of the Customer that owns the device. # noqa: E501 + + :param customer_title: The customer_title of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this DeviceInfo. # noqa: E501 + + Indicates special 'Public' Customer that is auto-generated to use the devices on public dashboards. # noqa: E501 + + :return: The customer_is_public of this DeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this DeviceInfo. + + Indicates special 'Public' Customer that is auto-generated to use the devices on public dashboards. # noqa: E501 + + :param customer_is_public: The customer_is_public of this DeviceInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + @property + def device_profile_name(self): + """Gets the device_profile_name of this DeviceInfo. # noqa: E501 + + Name of the corresponding Device Profile. # noqa: E501 + + :return: The device_profile_name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._device_profile_name + + @device_profile_name.setter + def device_profile_name(self, device_profile_name): + """Sets the device_profile_name of this DeviceInfo. + + Name of the corresponding Device Profile. # noqa: E501 + + :param device_profile_name: The device_profile_name of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._device_profile_name = device_profile_name + + @property + def active(self): + """Gets the active of this DeviceInfo. # noqa: E501 + + Device active flag. # noqa: E501 + + :return: The active of this DeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._active + + @active.setter + def active(self, active): + """Sets the active of this DeviceInfo. + + Device active flag. # noqa: E501 + + :param active: The active of this DeviceInfo. # noqa: E501 + :type: bool + """ + + self._active = active + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile.py new file mode 100644 index 0000000..1b34838 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile.py @@ -0,0 +1,616 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceProfileId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'default': 'bool', + 'default_dashboard_id': 'DashboardId', + 'default_rule_chain_id': 'RuleChainId', + 'default_queue_name': 'str', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'description': 'str', + 'image': 'str', + 'provision_device_key': 'str', + 'transport_type': 'str', + 'provision_type': 'str', + 'profile_data': 'DeviceProfileData', + 'type': 'str', + 'default_edge_rule_chain_id': 'RuleChainId', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'default': 'default', + 'default_dashboard_id': 'defaultDashboardId', + 'default_rule_chain_id': 'defaultRuleChainId', + 'default_queue_name': 'defaultQueueName', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'description': 'description', + 'image': 'image', + 'provision_device_key': 'provisionDeviceKey', + 'transport_type': 'transportType', + 'provision_type': 'provisionType', + 'profile_data': 'profileData', + 'type': 'type', + 'default_edge_rule_chain_id': 'defaultEdgeRuleChainId', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, name=None, default=None, default_dashboard_id=None, default_rule_chain_id=None, default_queue_name=None, firmware_id=None, software_id=None, description=None, image=None, provision_device_key=None, transport_type=None, provision_type=None, profile_data=None, type=None, default_edge_rule_chain_id=None): # noqa: E501 + """DeviceProfile - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._default = None + self._default_dashboard_id = None + self._default_rule_chain_id = None + self._default_queue_name = None + self._firmware_id = None + self._software_id = None + self._description = None + self._image = None + self._provision_device_key = None + self._transport_type = None + self._provision_type = None + self._profile_data = None + self._type = None + self._default_edge_rule_chain_id = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if default is not None: + self.default = default + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if default_rule_chain_id is not None: + self.default_rule_chain_id = default_rule_chain_id + if default_queue_name is not None: + self.default_queue_name = default_queue_name + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if description is not None: + self.description = description + if image is not None: + self.image = image + if provision_device_key is not None: + self.provision_device_key = provision_device_key + if transport_type is not None: + self.transport_type = transport_type + if provision_type is not None: + self.provision_type = provision_type + if profile_data is not None: + self.profile_data = profile_data + if type is not None: + self.type = type + if default_edge_rule_chain_id is not None: + self.default_edge_rule_chain_id = default_edge_rule_chain_id + + @property + def id(self): + """Gets the id of this DeviceProfile. # noqa: E501 + + + :return: The id of this DeviceProfile. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfile. + + + :param id: The id of this DeviceProfile. # noqa: E501 + :type: DeviceProfileId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this DeviceProfile. # noqa: E501 + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceProfile. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceProfile. + + Timestamp of the profile creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceProfile. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceProfile. # noqa: E501 + + + :return: The tenant_id of this DeviceProfile. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceProfile. + + + :param tenant_id: The tenant_id of this DeviceProfile. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this DeviceProfile. # noqa: E501 + + Unique Device Profile Name in scope of Tenant. # noqa: E501 + + :return: The name of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceProfile. + + Unique Device Profile Name in scope of Tenant. # noqa: E501 + + :param name: The name of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def default(self): + """Gets the default of this DeviceProfile. # noqa: E501 + + Used to mark the default profile. Default profile is used when the device profile is not specified during device creation. # noqa: E501 + + :return: The default of this DeviceProfile. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this DeviceProfile. + + Used to mark the default profile. Default profile is used when the device profile is not specified during device creation. # noqa: E501 + + :param default: The default of this DeviceProfile. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this DeviceProfile. # noqa: E501 + + + :return: The default_dashboard_id of this DeviceProfile. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this DeviceProfile. + + + :param default_dashboard_id: The default_dashboard_id of this DeviceProfile. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def default_rule_chain_id(self): + """Gets the default_rule_chain_id of this DeviceProfile. # noqa: E501 + + + :return: The default_rule_chain_id of this DeviceProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_rule_chain_id + + @default_rule_chain_id.setter + def default_rule_chain_id(self, default_rule_chain_id): + """Sets the default_rule_chain_id of this DeviceProfile. + + + :param default_rule_chain_id: The default_rule_chain_id of this DeviceProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_rule_chain_id = default_rule_chain_id + + @property + def default_queue_name(self): + """Gets the default_queue_name of this DeviceProfile. # noqa: E501 + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to device, including telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :return: The default_queue_name of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._default_queue_name + + @default_queue_name.setter + def default_queue_name(self, default_queue_name): + """Sets the default_queue_name of this DeviceProfile. + + Rule engine queue name. If present, the specified queue will be used to store all unprocessed messages related to device, including telemetry, attribute updates, etc. Otherwise, the 'Main' queue will be used to store those messages. # noqa: E501 + + :param default_queue_name: The default_queue_name of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._default_queue_name = default_queue_name + + @property + def firmware_id(self): + """Gets the firmware_id of this DeviceProfile. # noqa: E501 + + + :return: The firmware_id of this DeviceProfile. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this DeviceProfile. + + + :param firmware_id: The firmware_id of this DeviceProfile. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this DeviceProfile. # noqa: E501 + + + :return: The software_id of this DeviceProfile. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this DeviceProfile. + + + :param software_id: The software_id of this DeviceProfile. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def description(self): + """Gets the description of this DeviceProfile. # noqa: E501 + + Device Profile description. # noqa: E501 + + :return: The description of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this DeviceProfile. + + Device Profile description. # noqa: E501 + + :param description: The description of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this DeviceProfile. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :return: The image of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DeviceProfile. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :param image: The image of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def provision_device_key(self): + """Gets the provision_device_key of this DeviceProfile. # noqa: E501 + + Unique provisioning key used by 'Device Provisioning' feature. # noqa: E501 + + :return: The provision_device_key of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._provision_device_key + + @provision_device_key.setter + def provision_device_key(self, provision_device_key): + """Sets the provision_device_key of this DeviceProfile. + + Unique provisioning key used by 'Device Provisioning' feature. # noqa: E501 + + :param provision_device_key: The provision_device_key of this DeviceProfile. # noqa: E501 + :type: str + """ + + self._provision_device_key = provision_device_key + + @property + def transport_type(self): + """Gets the transport_type of this DeviceProfile. # noqa: E501 + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :return: The transport_type of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._transport_type + + @transport_type.setter + def transport_type(self, transport_type): + """Sets the transport_type of this DeviceProfile. + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :param transport_type: The transport_type of this DeviceProfile. # noqa: E501 + :type: str + """ + allowed_values = ["COAP", "DEFAULT", "LWM2M", "MQTT", "SNMP"] # noqa: E501 + if transport_type not in allowed_values: + raise ValueError( + "Invalid value for `transport_type` ({0}), must be one of {1}" # noqa: E501 + .format(transport_type, allowed_values) + ) + + self._transport_type = transport_type + + @property + def provision_type(self): + """Gets the provision_type of this DeviceProfile. # noqa: E501 + + Provisioning strategy. # noqa: E501 + + :return: The provision_type of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._provision_type + + @provision_type.setter + def provision_type(self, provision_type): + """Sets the provision_type of this DeviceProfile. + + Provisioning strategy. # noqa: E501 + + :param provision_type: The provision_type of this DeviceProfile. # noqa: E501 + :type: str + """ + allowed_values = ["ALLOW_CREATE_NEW_DEVICES", "CHECK_PRE_PROVISIONED_DEVICES", "DISABLED", "X509_CERTIFICATE_CHAIN"] # noqa: E501 + if provision_type not in allowed_values: + raise ValueError( + "Invalid value for `provision_type` ({0}), must be one of {1}" # noqa: E501 + .format(provision_type, allowed_values) + ) + + self._provision_type = provision_type + + @property + def profile_data(self): + """Gets the profile_data of this DeviceProfile. # noqa: E501 + + + :return: The profile_data of this DeviceProfile. # noqa: E501 + :rtype: DeviceProfileData + """ + return self._profile_data + + @profile_data.setter + def profile_data(self, profile_data): + """Sets the profile_data of this DeviceProfile. + + + :param profile_data: The profile_data of this DeviceProfile. # noqa: E501 + :type: DeviceProfileData + """ + + self._profile_data = profile_data + + @property + def type(self): + """Gets the type of this DeviceProfile. # noqa: E501 + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :return: The type of this DeviceProfile. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceProfile. + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :param type: The type of this DeviceProfile. # noqa: E501 + :type: str + """ + allowed_values = ["DEFAULT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def default_edge_rule_chain_id(self): + """Gets the default_edge_rule_chain_id of this DeviceProfile. # noqa: E501 + + + :return: The default_edge_rule_chain_id of this DeviceProfile. # noqa: E501 + :rtype: RuleChainId + """ + return self._default_edge_rule_chain_id + + @default_edge_rule_chain_id.setter + def default_edge_rule_chain_id(self, default_edge_rule_chain_id): + """Sets the default_edge_rule_chain_id of this DeviceProfile. + + + :param default_edge_rule_chain_id: The default_edge_rule_chain_id of this DeviceProfile. # noqa: E501 + :type: RuleChainId + """ + + self._default_edge_rule_chain_id = default_edge_rule_chain_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_alarm.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_alarm.py new file mode 100644 index 0000000..f82a0f6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_alarm.py @@ -0,0 +1,320 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileAlarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'alarm_type': 'str', + 'create_rules': 'dict(str, AlarmRule)', + 'clear_rule': 'AlarmRule', + 'propagate': 'bool', + 'propagate_to_owner': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]' + } + + attribute_map = { + 'id': 'id', + 'alarm_type': 'alarmType', + 'create_rules': 'createRules', + 'clear_rule': 'clearRule', + 'propagate': 'propagate', + 'propagate_to_owner': 'propagateToOwner', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes' + } + + def __init__(self, id=None, alarm_type=None, create_rules=None, clear_rule=None, propagate=None, propagate_to_owner=None, propagate_to_tenant=None, propagate_relation_types=None): # noqa: E501 + """DeviceProfileAlarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._alarm_type = None + self._create_rules = None + self._clear_rule = None + self._propagate = None + self._propagate_to_owner = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self.discriminator = None + if id is not None: + self.id = id + if alarm_type is not None: + self.alarm_type = alarm_type + if create_rules is not None: + self.create_rules = create_rules + if clear_rule is not None: + self.clear_rule = clear_rule + if propagate is not None: + self.propagate = propagate + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + + @property + def id(self): + """Gets the id of this DeviceProfileAlarm. # noqa: E501 + + String value representing the alarm rule id # noqa: E501 + + :return: The id of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileAlarm. + + String value representing the alarm rule id # noqa: E501 + + :param id: The id of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def alarm_type(self): + """Gets the alarm_type of this DeviceProfileAlarm. # noqa: E501 + + String value representing type of the alarm # noqa: E501 + + :return: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._alarm_type + + @alarm_type.setter + def alarm_type(self, alarm_type): + """Sets the alarm_type of this DeviceProfileAlarm. + + String value representing type of the alarm # noqa: E501 + + :param alarm_type: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._alarm_type = alarm_type + + @property + def create_rules(self): + """Gets the create_rules of this DeviceProfileAlarm. # noqa: E501 + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :return: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :rtype: dict(str, AlarmRule) + """ + return self._create_rules + + @create_rules.setter + def create_rules(self, create_rules): + """Sets the create_rules of this DeviceProfileAlarm. + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :param create_rules: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :type: dict(str, AlarmRule) + """ + + self._create_rules = create_rules + + @property + def clear_rule(self): + """Gets the clear_rule of this DeviceProfileAlarm. # noqa: E501 + + + :return: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :rtype: AlarmRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this DeviceProfileAlarm. + + + :param clear_rule: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :type: AlarmRule + """ + + self._clear_rule = clear_rule + + @property + def propagate(self): + """Gets the propagate of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this DeviceProfileAlarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileAlarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileAlarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_configuration.py new file mode 100644 index 0000000..6063fbf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_data.py new file mode 100644 index 0000000..95587cc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_data.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceProfileConfiguration', + 'transport_configuration': 'DeviceProfileTransportConfiguration', + 'provision_configuration': 'DeviceProfileProvisionConfiguration', + 'alarms': 'list[DeviceProfileAlarm]' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration', + 'provision_configuration': 'provisionConfiguration', + 'alarms': 'alarms' + } + + def __init__(self, configuration=None, transport_configuration=None, provision_configuration=None, alarms=None): # noqa: E501 + """DeviceProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self._provision_configuration = None + self._alarms = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + if provision_configuration is not None: + self.provision_configuration = provision_configuration + if alarms is not None: + self.alarms = alarms + + @property + def configuration(self): + """Gets the configuration of this DeviceProfileData. # noqa: E501 + + + :return: The configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceProfileData. + + + :param configuration: The configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The transport_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceProfileData. + + + :param transport_configuration: The transport_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + @property + def provision_configuration(self): + """Gets the provision_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The provision_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileProvisionConfiguration + """ + return self._provision_configuration + + @provision_configuration.setter + def provision_configuration(self, provision_configuration): + """Sets the provision_configuration of this DeviceProfileData. + + + :param provision_configuration: The provision_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileProvisionConfiguration + """ + + self._provision_configuration = provision_configuration + + @property + def alarms(self): + """Gets the alarms of this DeviceProfileData. # noqa: E501 + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :return: The alarms of this DeviceProfileData. # noqa: E501 + :rtype: list[DeviceProfileAlarm] + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this DeviceProfileData. + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :param alarms: The alarms of this DeviceProfileData. # noqa: E501 + :type: list[DeviceProfileAlarm] + """ + + self._alarms = alarms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_id.py new file mode 100644 index 0000000..44eb3a4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_info.py new file mode 100644 index 0000000..cd2a526 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_info.py @@ -0,0 +1,300 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str', + 'image': 'str', + 'default_dashboard_id': 'DashboardId', + 'type': 'str', + 'transport_type': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'image': 'image', + 'default_dashboard_id': 'defaultDashboardId', + 'type': 'type', + 'transport_type': 'transportType', + 'tenant_id': 'tenantId' + } + + def __init__(self, id=None, name=None, image=None, default_dashboard_id=None, type=None, transport_type=None, tenant_id=None): # noqa: E501 + """DeviceProfileInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._image = None + self._default_dashboard_id = None + self._type = None + self._transport_type = None + self._tenant_id = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if image is not None: + self.image = image + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if type is not None: + self.type = type + if transport_type is not None: + self.transport_type = transport_type + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def id(self): + """Gets the id of this DeviceProfileInfo. # noqa: E501 + + + :return: The id of this DeviceProfileInfo. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileInfo. + + + :param id: The id of this DeviceProfileInfo. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this DeviceProfileInfo. # noqa: E501 + + Entity Name # noqa: E501 + + :return: The name of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceProfileInfo. + + Entity Name # noqa: E501 + + :param name: The name of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def image(self): + """Gets the image of this DeviceProfileInfo. # noqa: E501 + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :return: The image of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DeviceProfileInfo. + + Either URL or Base64 data of the icon. Used in the mobile application to visualize set of device profiles in the grid view. # noqa: E501 + + :param image: The image of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this DeviceProfileInfo. # noqa: E501 + + + :return: The default_dashboard_id of this DeviceProfileInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this DeviceProfileInfo. + + + :param default_dashboard_id: The default_dashboard_id of this DeviceProfileInfo. # noqa: E501 + :type: DashboardId + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def type(self): + """Gets the type of this DeviceProfileInfo. # noqa: E501 + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :return: The type of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceProfileInfo. + + Type of the profile. Always 'DEFAULT' for now. Reserved for future use. # noqa: E501 + + :param type: The type of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + allowed_values = ["DEFAULT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def transport_type(self): + """Gets the transport_type of this DeviceProfileInfo. # noqa: E501 + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :return: The transport_type of this DeviceProfileInfo. # noqa: E501 + :rtype: str + """ + return self._transport_type + + @transport_type.setter + def transport_type(self, transport_type): + """Sets the transport_type of this DeviceProfileInfo. + + Type of the transport used to connect the device. Default transport supports HTTP, CoAP and MQTT. # noqa: E501 + + :param transport_type: The transport_type of this DeviceProfileInfo. # noqa: E501 + :type: str + """ + allowed_values = ["COAP", "DEFAULT", "LWM2M", "MQTT", "SNMP"] # noqa: E501 + if transport_type not in allowed_values: + raise ValueError( + "Invalid value for `transport_type` ({0}), must be one of {1}" # noqa: E501 + .format(transport_type, allowed_values) + ) + + self._transport_type = transport_type + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceProfileInfo. # noqa: E501 + + + :return: The tenant_id of this DeviceProfileInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceProfileInfo. + + + :param tenant_id: The tenant_id of this DeviceProfileInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_provision_configuration.py new file mode 100644 index 0000000..5a358b0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """DeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_transport_configuration.py new file mode 100644 index 0000000..fbb227e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_search_query.py new file mode 100644 index 0000000..20d3539 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'device_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'device_types': 'deviceTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, device_types=None, parameters=None): # noqa: E501 + """DeviceSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._device_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if device_types is not None: + self.device_types = device_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this DeviceSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this DeviceSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQuery. # noqa: E501 + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The device_types of this DeviceSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQuery. + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param device_types: The device_types of this DeviceSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def parameters(self): + """Gets the parameters of this DeviceSearchQuery. # noqa: E501 + + + :return: The parameters of this DeviceSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this DeviceSearchQuery. + + + :param parameters: The parameters of this DeviceSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_search_query_filter.py new file mode 100644 index 0000000..9cb350f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_types': 'deviceTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """DeviceSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._device_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if device_types is not None: + self.device_types = device_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQueryFilter. + + + :param device_types: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def direction(self): + """Gets the direction of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this DeviceSearchQueryFilter. + + + :param direction: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this DeviceSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this DeviceSearchQueryFilter. + + + :param max_level: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQueryFilter. + + + :param relation_type: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this DeviceSearchQueryFilter. + + + :param root_entity: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_transport_configuration.py new file mode 100644 index 0000000..c8e4205 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/device_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/device_type_filter.py new file mode 100644 index 0000000..d48f164 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/device_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_name_filter': 'str', + 'device_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_name_filter': 'deviceNameFilter', + 'device_types': 'deviceTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_name_filter=None, device_types=None, *args, **kwargs): # noqa: E501 + """DeviceTypeFilter - a model defined in Swagger""" # noqa: E501 + self._device_name_filter = None + self._device_types = None + self.discriminator = None + if device_name_filter is not None: + self.device_name_filter = device_name_filter + if device_types is not None: + self.device_types = device_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_name_filter(self): + """Gets the device_name_filter of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :rtype: str + """ + return self._device_name_filter + + @device_name_filter.setter + def device_name_filter(self, device_name_filter): + """Sets the device_name_filter of this DeviceTypeFilter. + + + :param device_name_filter: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :type: str + """ + + self._device_name_filter = device_name_filter + + @property + def device_types(self): + """Gets the device_types of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_types of this DeviceTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceTypeFilter. + + + :param device_types: The device_types of this DeviceTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/disabled_device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/disabled_device_profile_provision_configuration.py new file mode 100644 index 0000000..9f10c32 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/disabled_device_profile_provision_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class DisabledDeviceProfileProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """DisabledDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DisabledDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DisabledDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/duration_alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_ce/duration_alarm_condition_spec.py new file mode 100644 index 0000000..12043e4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/duration_alarm_condition_spec.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class DurationAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValuelong', + 'unit': 'str' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate', + 'unit': 'unit' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, unit=None, *args, **kwargs): # noqa: E501 + """DurationAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self._unit = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + if unit is not None: + self.unit = unit + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValuelong + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this DurationAlarmConditionSpec. + + + :param predicate: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValuelong + """ + + self._predicate = predicate + + @property + def unit(self): + """Gets the unit of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: str + """ + return self._unit + + @unit.setter + def unit(self, unit): + """Sets the unit of this DurationAlarmConditionSpec. + + + :param unit: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :type: str + """ + allowed_values = ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"] # noqa: E501 + if unit not in allowed_values: + raise ValueError( + "Invalid value for `unit` ({0}), must be one of {1}" # noqa: E501 + .format(unit, allowed_values) + ) + + self._unit = unit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DurationAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DurationAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valueboolean.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valueboolean.py new file mode 100644 index 0000000..b93e9e7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valueboolean.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueboolean - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueboolean. # noqa: E501 + + + :return: The inherit of this DynamicValueboolean. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueboolean. + + + :param inherit: The inherit of this DynamicValueboolean. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueboolean. # noqa: E501 + + + :return: The source_attribute of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueboolean. + + + :param source_attribute: The source_attribute of this DynamicValueboolean. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueboolean. # noqa: E501 + + + :return: The source_type of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueboolean. + + + :param source_type: The source_type of this DynamicValueboolean. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuedouble.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuedouble.py new file mode 100644 index 0000000..f5fa9f4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuedouble.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuedouble - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuedouble. # noqa: E501 + + + :return: The inherit of this DynamicValuedouble. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuedouble. + + + :param inherit: The inherit of this DynamicValuedouble. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuedouble. # noqa: E501 + + + :return: The source_attribute of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuedouble. + + + :param source_attribute: The source_attribute of this DynamicValuedouble. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuedouble. # noqa: E501 + + + :return: The source_type of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuedouble. + + + :param source_type: The source_type of this DynamicValuedouble. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valueint.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valueint.py new file mode 100644 index 0000000..b3c9d0b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valueint.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueint - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueint. # noqa: E501 + + + :return: The inherit of this DynamicValueint. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueint. + + + :param inherit: The inherit of this DynamicValueint. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueint. # noqa: E501 + + + :return: The source_attribute of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueint. + + + :param source_attribute: The source_attribute of this DynamicValueint. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueint. # noqa: E501 + + + :return: The source_type of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueint. + + + :param source_type: The source_type of this DynamicValueint. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuelong.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuelong.py new file mode 100644 index 0000000..8fa78d9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuelong.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuelong - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuelong. # noqa: E501 + + + :return: The inherit of this DynamicValuelong. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuelong. + + + :param inherit: The inherit of this DynamicValuelong. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuelong. # noqa: E501 + + + :return: The source_attribute of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuelong. + + + :param source_attribute: The source_attribute of this DynamicValuelong. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuelong. # noqa: E501 + + + :return: The source_type of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuelong. + + + :param source_type: The source_type of this DynamicValuelong. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuestring.py b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuestring.py new file mode 100644 index 0000000..89e7e48 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/dynamic_valuestring.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuestring - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuestring. # noqa: E501 + + + :return: The inherit of this DynamicValuestring. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuestring. + + + :param inherit: The inherit of this DynamicValuestring. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuestring. # noqa: E501 + + + :return: The source_attribute of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuestring. + + + :param source_attribute: The source_attribute of this DynamicValuestring. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuestring. # noqa: E501 + + + :return: The source_type of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuestring. + + + :param source_type: The source_type of this DynamicValuestring. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge.py new file mode 100644 index 0000000..9c02d2c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge.py @@ -0,0 +1,400 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Edge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret' + } + + def __init__(self, additional_info=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None): # noqa: E501 + """Edge - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + + @property + def additional_info(self): + """Gets the additional_info of this Edge. # noqa: E501 + + + :return: The additional_info of this Edge. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Edge. + + + :param additional_info: The additional_info of this Edge. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def id(self): + """Gets the id of this Edge. # noqa: E501 + + + :return: The id of this Edge. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Edge. + + + :param id: The id of this Edge. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Edge. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this Edge. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Edge. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Edge. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Edge. # noqa: E501 + + + :return: The tenant_id of this Edge. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Edge. + + + :param tenant_id: The tenant_id of this Edge. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Edge. # noqa: E501 + + + :return: The customer_id of this Edge. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Edge. + + + :param customer_id: The customer_id of this Edge. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this Edge. # noqa: E501 + + + :return: The root_rule_chain_id of this Edge. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this Edge. + + + :param root_rule_chain_id: The root_rule_chain_id of this Edge. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this Edge. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this Edge. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Edge. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this Edge. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Edge. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this Edge. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Edge. + + Edge type # noqa: E501 + + :param type: The type of this Edge. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this Edge. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Edge. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Edge. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Edge. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this Edge. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this Edge. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this Edge. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this Edge. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this Edge. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this Edge. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this Edge. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this Edge. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Edge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Edge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_event.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_event.py new file mode 100644 index 0000000..8bace4f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_event.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'action': 'str', + 'body': 'JsonNode', + 'created_time': 'int', + 'edge_id': 'EdgeId', + 'entity_id': 'str', + 'id': 'EdgeEventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str' + } + + attribute_map = { + 'action': 'action', + 'body': 'body', + 'created_time': 'createdTime', + 'edge_id': 'edgeId', + 'entity_id': 'entityId', + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid' + } + + def __init__(self, action=None, body=None, created_time=None, edge_id=None, entity_id=None, id=None, tenant_id=None, type=None, uid=None): # noqa: E501 + """EdgeEvent - a model defined in Swagger""" # noqa: E501 + self._action = None + self._body = None + self._created_time = None + self._edge_id = None + self._entity_id = None + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self.discriminator = None + if action is not None: + self.action = action + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + if edge_id is not None: + self.edge_id = edge_id + if entity_id is not None: + self.entity_id = entity_id + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + + @property + def action(self): + """Gets the action of this EdgeEvent. # noqa: E501 + + + :return: The action of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._action + + @action.setter + def action(self, action): + """Sets the action of this EdgeEvent. + + + :param action: The action of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADDED", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_UNASSIGNED", "ASSIGNED_TO_CUSTOMER", "ASSIGNED_TO_EDGE", "ATTRIBUTES_DELETED", "ATTRIBUTES_UPDATED", "CREDENTIALS_REQUEST", "CREDENTIALS_UPDATED", "DELETED", "ENTITY_MERGE_REQUEST", "POST_ATTRIBUTES", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "RPC_CALL", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_CUSTOMER", "UNASSIGNED_FROM_EDGE", "UPDATED"] # noqa: E501 + if action not in allowed_values: + raise ValueError( + "Invalid value for `action` ({0}), must be one of {1}" # noqa: E501 + .format(action, allowed_values) + ) + + self._action = action + + @property + def body(self): + """Gets the body of this EdgeEvent. # noqa: E501 + + + :return: The body of this EdgeEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EdgeEvent. + + + :param body: The body of this EdgeEvent. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EdgeEvent. # noqa: E501 + + + :return: The created_time of this EdgeEvent. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeEvent. + + + :param created_time: The created_time of this EdgeEvent. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def edge_id(self): + """Gets the edge_id of this EdgeEvent. # noqa: E501 + + + :return: The edge_id of this EdgeEvent. # noqa: E501 + :rtype: EdgeId + """ + return self._edge_id + + @edge_id.setter + def edge_id(self, edge_id): + """Sets the edge_id of this EdgeEvent. + + + :param edge_id: The edge_id of this EdgeEvent. # noqa: E501 + :type: EdgeId + """ + + self._edge_id = edge_id + + @property + def entity_id(self): + """Gets the entity_id of this EdgeEvent. # noqa: E501 + + + :return: The entity_id of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EdgeEvent. + + + :param entity_id: The entity_id of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def id(self): + """Gets the id of this EdgeEvent. # noqa: E501 + + + :return: The id of this EdgeEvent. # noqa: E501 + :rtype: EdgeEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEvent. + + + :param id: The id of this EdgeEvent. # noqa: E501 + :type: EdgeEventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeEvent. # noqa: E501 + + + :return: The tenant_id of this EdgeEvent. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeEvent. + + + :param tenant_id: The tenant_id of this EdgeEvent. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EdgeEvent. # noqa: E501 + + + :return: The type of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeEvent. + + + :param type: The type of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADMIN_SETTINGS", "ALARM", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "OTA_PACKAGE", "QUEUE", "RELATION", "RULE_CHAIN", "RULE_CHAIN_METADATA", "TENANT", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def uid(self): + """Gets the uid of this EdgeEvent. # noqa: E501 + + + :return: The uid of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EdgeEvent. + + + :param uid: The uid of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._uid = uid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_event_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_event_id.py new file mode 100644 index 0000000..88475c0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EdgeEventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EdgeEventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EdgeEventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEventId. + + string # noqa: E501 + + :param id: The id of this EdgeEventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_id.py new file mode 100644 index 0000000..baa1e30 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EdgeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EdgeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EdgeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EdgeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EdgeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EdgeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["EDGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_info.py new file mode 100644 index 0000000..d5212b0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_info.py @@ -0,0 +1,452 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'customer_is_public': 'bool', + 'customer_title': 'str', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'customer_is_public': 'customerIsPublic', + 'customer_title': 'customerTitle', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret' + } + + def __init__(self, additional_info=None, customer_is_public=None, customer_title=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None): # noqa: E501 + """EdgeInfo - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._customer_is_public = None + self._customer_title = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if customer_is_public is not None: + self.customer_is_public = customer_is_public + if customer_title is not None: + self.customer_title = customer_title + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + + @property + def additional_info(self): + """Gets the additional_info of this EdgeInfo. # noqa: E501 + + + :return: The additional_info of this EdgeInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EdgeInfo. + + + :param additional_info: The additional_info of this EdgeInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_is_public(self): + """Gets the customer_is_public of this EdgeInfo. # noqa: E501 + + + :return: The customer_is_public of this EdgeInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this EdgeInfo. + + + :param customer_is_public: The customer_is_public of this EdgeInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + @property + def customer_title(self): + """Gets the customer_title of this EdgeInfo. # noqa: E501 + + + :return: The customer_title of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this EdgeInfo. + + + :param customer_title: The customer_title of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def id(self): + """Gets the id of this EdgeInfo. # noqa: E501 + + + :return: The id of this EdgeInfo. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeInfo. + + + :param id: The id of this EdgeInfo. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EdgeInfo. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this EdgeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeInfo. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EdgeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeInfo. # noqa: E501 + + + :return: The tenant_id of this EdgeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeInfo. + + + :param tenant_id: The tenant_id of this EdgeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EdgeInfo. # noqa: E501 + + + :return: The customer_id of this EdgeInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EdgeInfo. + + + :param customer_id: The customer_id of this EdgeInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this EdgeInfo. # noqa: E501 + + + :return: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this EdgeInfo. + + + :param root_rule_chain_id: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this EdgeInfo. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EdgeInfo. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this EdgeInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EdgeInfo. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeInfo. + + Edge type # noqa: E501 + + :param type: The type of this EdgeInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this EdgeInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this EdgeInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this EdgeInfo. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this EdgeInfo. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this EdgeInfo. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this EdgeInfo. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this EdgeInfo. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this EdgeInfo. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_install_instructions.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_install_instructions.py new file mode 100644 index 0000000..d916bf2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_install_instructions.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInstallInstructions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'docker_install_instructions': 'str' + } + + attribute_map = { + 'docker_install_instructions': 'dockerInstallInstructions' + } + + def __init__(self, docker_install_instructions=None): # noqa: E501 + """EdgeInstallInstructions - a model defined in Swagger""" # noqa: E501 + self._docker_install_instructions = None + self.discriminator = None + if docker_install_instructions is not None: + self.docker_install_instructions = docker_install_instructions + + @property + def docker_install_instructions(self): + """Gets the docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + + Markdown with docker install instructions # noqa: E501 + + :return: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :rtype: str + """ + return self._docker_install_instructions + + @docker_install_instructions.setter + def docker_install_instructions(self, docker_install_instructions): + """Sets the docker_install_instructions of this EdgeInstallInstructions. + + Markdown with docker install instructions # noqa: E501 + + :param docker_install_instructions: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :type: str + """ + + self._docker_install_instructions = docker_install_instructions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInstallInstructions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInstallInstructions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_search_query.py new file mode 100644 index 0000000..1d565c5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'edge_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'edge_types': 'edgeTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, edge_types=None, parameters=None): # noqa: E501 + """EdgeSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._edge_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if edge_types is not None: + self.edge_types = edge_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQuery. # noqa: E501 + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EdgeSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQuery. + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EdgeSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQuery. # noqa: E501 + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :return: The edge_types of this EdgeSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQuery. + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :param edge_types: The edge_types of this EdgeSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def parameters(self): + """Gets the parameters of this EdgeSearchQuery. # noqa: E501 + + + :return: The parameters of this EdgeSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EdgeSearchQuery. + + + :param parameters: The parameters of this EdgeSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_search_query_filter.py new file mode 100644 index 0000000..d669ed0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'edge_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'edge_types': 'edgeTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, edge_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EdgeSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._edge_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if edge_types is not None: + self.edge_types = edge_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EdgeSearchQueryFilter. + + + :param direction: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQueryFilter. + + + :param edge_types: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EdgeSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EdgeSearchQueryFilter. + + + :param max_level: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQueryFilter. + + + :param relation_type: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EdgeSearchQueryFilter. + + + :param root_entity: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/edge_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_type_filter.py new file mode 100644 index 0000000..5fa0a1c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/edge_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edge_name_filter': 'str', + 'edge_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'edge_name_filter': 'edgeNameFilter', + 'edge_types': 'edgeTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, edge_name_filter=None, edge_types=None, *args, **kwargs): # noqa: E501 + """EdgeTypeFilter - a model defined in Swagger""" # noqa: E501 + self._edge_name_filter = None + self._edge_types = None + self.discriminator = None + if edge_name_filter is not None: + self.edge_name_filter = edge_name_filter + if edge_types is not None: + self.edge_types = edge_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def edge_name_filter(self): + """Gets the edge_name_filter of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :rtype: str + """ + return self._edge_name_filter + + @edge_name_filter.setter + def edge_name_filter(self, edge_name_filter): + """Sets the edge_name_filter of this EdgeTypeFilter. + + + :param edge_name_filter: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :type: str + """ + + self._edge_name_filter = edge_name_filter + + @property + def edge_types(self): + """Gets the edge_types of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_types of this EdgeTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeTypeFilter. + + + :param edge_types: The edge_types of this EdgeTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/efento_coap_device_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/efento_coap_device_type_configuration.py new file mode 100644 index 0000000..a4191b7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/efento_coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EfentoCoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """EfentoCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EfentoCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EfentoCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/email_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/email_delivery_method_notification_template.py new file mode 100644 index 0000000..7e84a82 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/email_delivery_method_notification_template.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.delivery_method_notification_template import DeliveryMethodNotificationTemplate # noqa: F401,E501 + +class EmailDeliveryMethodNotificationTemplate(DeliveryMethodNotificationTemplate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + if hasattr(DeliveryMethodNotificationTemplate, "swagger_types"): + swagger_types.update(DeliveryMethodNotificationTemplate.swagger_types) + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + if hasattr(DeliveryMethodNotificationTemplate, "attribute_map"): + attribute_map.update(DeliveryMethodNotificationTemplate.attribute_map) + + def __init__(self, body=None, enabled=None, subject=None, *args, **kwargs): # noqa: E501 + """EmailDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + DeliveryMethodNotificationTemplate.__init__(self, *args, **kwargs) + + @property + def body(self): + """Gets the body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EmailDeliveryMethodNotificationTemplate. + + + :param body: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this EmailDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this EmailDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/email_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/email_two_fa_account_config.py new file mode 100644 index 0000000..b286af9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/email_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EmailTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'email': 'email', + 'use_by_default': 'useByDefault' + } + + def __init__(self, email=None, use_by_default=None): # noqa: E501 + """EmailTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._email = None + self._use_by_default = None + self.discriminator = None + self.email = email + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def email(self): + """Gets the email of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this EmailTwoFaAccountConfig. + + + :param email: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if email is None: + raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + + self._email = email + + @property + def use_by_default(self): + """Gets the use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this EmailTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/email_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/email_two_fa_provider_config.py new file mode 100644 index 0000000..a25b758 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/email_two_fa_provider_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.two_fa_provider_config import TwoFaProviderConfig # noqa: F401,E501 + +class EmailTwoFaProviderConfig(TwoFaProviderConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'verification_code_lifetime': 'int' + } + if hasattr(TwoFaProviderConfig, "swagger_types"): + swagger_types.update(TwoFaProviderConfig.swagger_types) + + attribute_map = { + 'verification_code_lifetime': 'verificationCodeLifetime' + } + if hasattr(TwoFaProviderConfig, "attribute_map"): + attribute_map.update(TwoFaProviderConfig.attribute_map) + + def __init__(self, verification_code_lifetime=None, *args, **kwargs): # noqa: E501 + """EmailTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._verification_code_lifetime = None + self.discriminator = None + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + TwoFaProviderConfig.__init__(self, *args, **kwargs) + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this EmailTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entities_limit_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entities_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..d56bd7f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entities_limit_notification_rule_trigger_config.py @@ -0,0 +1,195 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class EntitiesLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'list[str]', + 'threshold': 'float', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'threshold': 'threshold', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, entity_types=None, threshold=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """EntitiesLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._threshold = None + self._trigger_type = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if threshold is not None: + self.threshold = threshold + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def threshold(self): + """Gets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: float + """ + return self._threshold + + @threshold.setter + def threshold(self, threshold): + """Sets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param threshold: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: float + """ + + self._threshold = threshold + + @property + def trigger_type(self): + """Gets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitiesLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitiesLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_action_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_action_notification_rule_trigger_config.py new file mode 100644 index 0000000..bd16c99 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_action_notification_rule_trigger_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityActionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'bool', + 'deleted': 'bool', + 'entity_types': 'list[str]', + 'trigger_type': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_types': 'entityTypes', + 'trigger_type': 'triggerType', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_types=None, trigger_type=None, updated=None): # noqa: E501 + """EntityActionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_types = None + self._trigger_type = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_types is not None: + self.entity_types = entity_types + if trigger_type is not None: + self.trigger_type = trigger_type + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityActionNotificationRuleTriggerConfig. + + + :param created: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityActionNotificationRuleTriggerConfig. + + + :param deleted: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._deleted = deleted + + @property + def entity_types(self): + """Gets the entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityActionNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def trigger_type(self): + """Gets the trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntityActionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + @property + def updated(self): + """Gets the updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityActionNotificationRuleTriggerConfig. + + + :param updated: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityActionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityActionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_count_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_count_query.py new file mode 100644 index 0000000..5e65037 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_count_query.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]' + } + + attribute_map = { + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters' + } + + def __init__(self, entity_filter=None, key_filters=None): # noqa: E501 + """EntityCountQuery - a model defined in Swagger""" # noqa: E501 + self._entity_filter = None + self._key_filters = None + self.discriminator = None + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityCountQuery. # noqa: E501 + + + :return: The entity_filter of this EntityCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityCountQuery. + + + :param entity_filter: The entity_filter of this EntityCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityCountQuery. # noqa: E501 + + + :return: The key_filters of this EntityCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityCountQuery. + + + :param key_filters: The key_filters of this EntityCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data.py new file mode 100644 index 0000000..49036fa --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'agg_latest': 'dict(str, ComparisonTsValue)', + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'timeseries': 'dict(str, list[TsValue])' + } + + attribute_map = { + 'agg_latest': 'aggLatest', + 'entity_id': 'entityId', + 'latest': 'latest', + 'timeseries': 'timeseries' + } + + def __init__(self, agg_latest=None, entity_id=None, latest=None, timeseries=None): # noqa: E501 + """EntityData - a model defined in Swagger""" # noqa: E501 + self._agg_latest = None + self._entity_id = None + self._latest = None + self._timeseries = None + self.discriminator = None + if agg_latest is not None: + self.agg_latest = agg_latest + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if timeseries is not None: + self.timeseries = timeseries + + @property + def agg_latest(self): + """Gets the agg_latest of this EntityData. # noqa: E501 + + + :return: The agg_latest of this EntityData. # noqa: E501 + :rtype: dict(str, ComparisonTsValue) + """ + return self._agg_latest + + @agg_latest.setter + def agg_latest(self, agg_latest): + """Sets the agg_latest of this EntityData. + + + :param agg_latest: The agg_latest of this EntityData. # noqa: E501 + :type: dict(str, ComparisonTsValue) + """ + + self._agg_latest = agg_latest + + @property + def entity_id(self): + """Gets the entity_id of this EntityData. # noqa: E501 + + + :return: The entity_id of this EntityData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityData. + + + :param entity_id: The entity_id of this EntityData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this EntityData. # noqa: E501 + + + :return: The latest of this EntityData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this EntityData. + + + :param latest: The latest of this EntityData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def timeseries(self): + """Gets the timeseries of this EntityData. # noqa: E501 + + + :return: The timeseries of this EntityData. # noqa: E501 + :rtype: dict(str, list[TsValue]) + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this EntityData. + + + :param timeseries: The timeseries of this EntityData. # noqa: E501 + :type: dict(str, list[TsValue]) + """ + + self._timeseries = timeseries + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_diff.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_diff.py new file mode 100644 index 0000000..fce7238 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_version': 'EntityExportDataobject', + 'other_version': 'EntityExportDataobject' + } + + attribute_map = { + 'current_version': 'currentVersion', + 'other_version': 'otherVersion' + } + + def __init__(self, current_version=None, other_version=None): # noqa: E501 + """EntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._current_version = None + self._other_version = None + self.discriminator = None + if current_version is not None: + self.current_version = current_version + if other_version is not None: + self.other_version = other_version + + @property + def current_version(self): + """Gets the current_version of this EntityDataDiff. # noqa: E501 + + + :return: The current_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this EntityDataDiff. + + + :param current_version: The current_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._current_version = current_version + + @property + def other_version(self): + """Gets the other_version of this EntityDataDiff. # noqa: E501 + + + :return: The other_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._other_version + + @other_version.setter + def other_version(self, other_version): + """Sets the other_version of this EntityDataDiff. + + + :param other_version: The other_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._other_version = other_version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_info.py new file mode 100644 index 0000000..8f94dac --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_info.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'has_attributes': 'bool', + 'has_credentials': 'bool', + 'has_relations': 'bool' + } + + attribute_map = { + 'has_attributes': 'hasAttributes', + 'has_credentials': 'hasCredentials', + 'has_relations': 'hasRelations' + } + + def __init__(self, has_attributes=None, has_credentials=None, has_relations=None): # noqa: E501 + """EntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._has_attributes = None + self._has_credentials = None + self._has_relations = None + self.discriminator = None + if has_attributes is not None: + self.has_attributes = has_attributes + if has_credentials is not None: + self.has_credentials = has_credentials + if has_relations is not None: + self.has_relations = has_relations + + @property + def has_attributes(self): + """Gets the has_attributes of this EntityDataInfo. # noqa: E501 + + + :return: The has_attributes of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_attributes + + @has_attributes.setter + def has_attributes(self, has_attributes): + """Sets the has_attributes of this EntityDataInfo. + + + :param has_attributes: The has_attributes of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_attributes = has_attributes + + @property + def has_credentials(self): + """Gets the has_credentials of this EntityDataInfo. # noqa: E501 + + + :return: The has_credentials of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_credentials + + @has_credentials.setter + def has_credentials(self, has_credentials): + """Sets the has_credentials of this EntityDataInfo. + + + :param has_credentials: The has_credentials of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_credentials = has_credentials + + @property + def has_relations(self): + """Gets the has_relations of this EntityDataInfo. # noqa: E501 + + + :return: The has_relations of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_relations + + @has_relations.setter + def has_relations(self, has_relations): + """Sets the has_relations of this EntityDataInfo. + + + :param has_relations: The has_relations of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_relations = has_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_page_link.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_page_link.py new file mode 100644 index 0000000..bfeb5c1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_page_link.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic': 'bool', + 'page': 'int', + 'page_size': 'int', + 'sort_order': 'EntityDataSortOrder', + 'text_search': 'str' + } + + attribute_map = { + 'dynamic': 'dynamic', + 'page': 'page', + 'page_size': 'pageSize', + 'sort_order': 'sortOrder', + 'text_search': 'textSearch' + } + + def __init__(self, dynamic=None, page=None, page_size=None, sort_order=None, text_search=None): # noqa: E501 + """EntityDataPageLink - a model defined in Swagger""" # noqa: E501 + self._dynamic = None + self._page = None + self._page_size = None + self._sort_order = None + self._text_search = None + self.discriminator = None + if dynamic is not None: + self.dynamic = dynamic + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if sort_order is not None: + self.sort_order = sort_order + if text_search is not None: + self.text_search = text_search + + @property + def dynamic(self): + """Gets the dynamic of this EntityDataPageLink. # noqa: E501 + + + :return: The dynamic of this EntityDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this EntityDataPageLink. + + + :param dynamic: The dynamic of this EntityDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def page(self): + """Gets the page of this EntityDataPageLink. # noqa: E501 + + + :return: The page of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this EntityDataPageLink. + + + :param page: The page of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this EntityDataPageLink. # noqa: E501 + + + :return: The page_size of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this EntityDataPageLink. + + + :param page_size: The page_size of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def sort_order(self): + """Gets the sort_order of this EntityDataPageLink. # noqa: E501 + + + :return: The sort_order of this EntityDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this EntityDataPageLink. + + + :param sort_order: The sort_order of this EntityDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def text_search(self): + """Gets the text_search of this EntityDataPageLink. # noqa: E501 + + + :return: The text_search of this EntityDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this EntityDataPageLink. + + + :param text_search: The text_search of this EntityDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_query.py new file mode 100644 index 0000000..04f8b70 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_query.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'EntityDataPageLink' + } + + attribute_map = { + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """EntityDataQuery - a model defined in Swagger""" # noqa: E501 + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def entity_fields(self): + """Gets the entity_fields of this EntityDataQuery. # noqa: E501 + + + :return: The entity_fields of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this EntityDataQuery. + + + :param entity_fields: The entity_fields of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityDataQuery. # noqa: E501 + + + :return: The entity_filter of this EntityDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityDataQuery. + + + :param entity_filter: The entity_filter of this EntityDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityDataQuery. # noqa: E501 + + + :return: The key_filters of this EntityDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityDataQuery. + + + :param key_filters: The key_filters of this EntityDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this EntityDataQuery. # noqa: E501 + + + :return: The latest_values of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this EntityDataQuery. + + + :param latest_values: The latest_values of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this EntityDataQuery. # noqa: E501 + + + :return: The page_link of this EntityDataQuery. # noqa: E501 + :rtype: EntityDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this EntityDataQuery. + + + :param page_link: The page_link of this EntityDataQuery. # noqa: E501 + :type: EntityDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_sort_order.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_sort_order.py new file mode 100644 index 0000000..1bb8f16 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_data_sort_order.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataSortOrder(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'key': 'EntityKey' + } + + attribute_map = { + 'direction': 'direction', + 'key': 'key' + } + + def __init__(self, direction=None, key=None): # noqa: E501 + """EntityDataSortOrder - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._key = None + self.discriminator = None + if direction is not None: + self.direction = direction + if key is not None: + self.key = key + + @property + def direction(self): + """Gets the direction of this EntityDataSortOrder. # noqa: E501 + + + :return: The direction of this EntityDataSortOrder. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityDataSortOrder. + + + :param direction: The direction of this EntityDataSortOrder. # noqa: E501 + :type: str + """ + allowed_values = ["ASC", "DESC"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def key(self): + """Gets the key of this EntityDataSortOrder. # noqa: E501 + + + :return: The key of this EntityDataSortOrder. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityDataSortOrder. + + + :param key: The key of this EntityDataSortOrder. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataSortOrder, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataSortOrder): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_export_dataobject.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_export_dataobject.py new file mode 100644 index 0000000..b5080e4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_export_dataobject.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityExportDataobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'object', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None): # noqa: E501 + """EntityExportDataobject - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + + @property + def attributes(self): + """Gets the attributes of this EntityExportDataobject. # noqa: E501 + + + :return: The attributes of this EntityExportDataobject. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this EntityExportDataobject. + + + :param attributes: The attributes of this EntityExportDataobject. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this EntityExportDataobject. # noqa: E501 + + + :return: The entity of this EntityExportDataobject. # noqa: E501 + :rtype: object + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this EntityExportDataobject. + + + :param entity: The entity of this EntityExportDataobject. # noqa: E501 + :type: object + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this EntityExportDataobject. # noqa: E501 + + + :return: The entity_type of this EntityExportDataobject. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityExportDataobject. + + + :param entity_type: The entity_type of this EntityExportDataobject. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this EntityExportDataobject. # noqa: E501 + + + :return: The relations of this EntityExportDataobject. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this EntityExportDataobject. + + + :param relations: The relations of this EntityExportDataobject. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityExportDataobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityExportDataobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_filter.py new file mode 100644 index 0000000..7e99c98 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_filter.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'resolve_multiple': 'bool', + 'entity_type': 'str' + } + + attribute_map = { + 'type': 'type', + 'resolve_multiple': 'resolveMultiple', + 'entity_type': 'entityType' + } + + def __init__(self, type=None, resolve_multiple=None, entity_type=None): # noqa: E501 + """EntityFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + self._type = None + self._resolve_multiple = None + self._entity_type = None + self.type = type + self.resolve_multiple = resolve_multiple + self.entity_type = entity_type + + @property + def type(self): + return self._type + + @type.setter + def type(self, type): + self._type = type + + @property + def resolve_multiple(self): + return self._resolve_multiple + + @resolve_multiple.setter + def resolve_multiple(self, resolve_multiple): + self._resolve_multiple = resolve_multiple + + @property + def entity_type(self): + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_id.py new file mode 100644 index 0000000..cf4118a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityId. # noqa: E501 + + + :return: The entity_type of this EntityId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityId. + + + :param entity_type: The entity_type of this EntityId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_info.py new file mode 100644 index 0000000..e62d879 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name' + } + + def __init__(self, id=None, name=None): # noqa: E501 + """EntityInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def id(self): + """Gets the id of this EntityInfo. # noqa: E501 + + + :return: The id of this EntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityInfo. + + + :param id: The id of this EntityInfo. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this EntityInfo. # noqa: E501 + + Entity Name # noqa: E501 + + :return: The name of this EntityInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityInfo. + + Entity Name # noqa: E501 + + :param name: The name of this EntityInfo. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_key.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_key.py new file mode 100644 index 0000000..410ce42 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_key.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """EntityKey - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this EntityKey. # noqa: E501 + + + :return: The key of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityKey. + + + :param key: The key of this EntityKey. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this EntityKey. # noqa: E501 + + + :return: The type of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityKey. + + + :param type: The type of this EntityKey. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM_FIELD", "ATTRIBUTE", "CLIENT_ATTRIBUTE", "ENTITY_FIELD", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_list_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_list_filter.py new file mode 100644 index 0000000..ef32146 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_list_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityListFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_list': 'list[str]', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_list': 'entityList', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_list=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityListFilter - a model defined in Swagger""" # noqa: E501 + self._entity_list = None + self._entity_type = None + self.discriminator = None + if entity_list is not None: + self.entity_list = entity_list + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_list(self): + """Gets the entity_list of this EntityListFilter. # noqa: E501 + + + :return: The entity_list of this EntityListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_list + + @entity_list.setter + def entity_list(self, entity_list): + """Sets the entity_list of this EntityListFilter. + + + :param entity_list: The entity_list of this EntityListFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_list = entity_list + + @property + def entity_type(self): + """Gets the entity_type of this EntityListFilter. # noqa: E501 + + + :return: The entity_type of this EntityListFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityListFilter. + + + :param entity_type: The entity_type of this EntityListFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_load_error.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_load_error.py new file mode 100644 index 0000000..45405b6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_load_error.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityLoadError(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str', + 'source': 'EntityId', + 'target': 'EntityId', + 'type': 'str' + } + + attribute_map = { + 'message': 'message', + 'source': 'source', + 'target': 'target', + 'type': 'type' + } + + def __init__(self, message=None, source=None, target=None, type=None): # noqa: E501 + """EntityLoadError - a model defined in Swagger""" # noqa: E501 + self._message = None + self._source = None + self._target = None + self._type = None + self.discriminator = None + if message is not None: + self.message = message + if source is not None: + self.source = source + if target is not None: + self.target = target + if type is not None: + self.type = type + + @property + def message(self): + """Gets the message of this EntityLoadError. # noqa: E501 + + + :return: The message of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this EntityLoadError. + + + :param message: The message of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def source(self): + """Gets the source of this EntityLoadError. # noqa: E501 + + + :return: The source of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._source + + @source.setter + def source(self, source): + """Sets the source of this EntityLoadError. + + + :param source: The source of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._source = source + + @property + def target(self): + """Gets the target of this EntityLoadError. # noqa: E501 + + + :return: The target of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._target + + @target.setter + def target(self, target): + """Sets the target of this EntityLoadError. + + + :param target: The target of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._target = target + + @property + def type(self): + """Gets the type of this EntityLoadError. # noqa: E501 + + + :return: The type of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityLoadError. + + + :param type: The type of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityLoadError, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityLoadError): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_name_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_name_filter.py new file mode 100644 index 0000000..215f604 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_name_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_name_filter': 'str', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_name_filter': 'entityNameFilter', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_name_filter=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_name_filter = None + self._entity_type = None + self.discriminator = None + if entity_name_filter is not None: + self.entity_name_filter = entity_name_filter + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_name_filter(self): + """Gets the entity_name_filter of this EntityNameFilter. # noqa: E501 + + + :return: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name_filter + + @entity_name_filter.setter + def entity_name_filter(self, entity_name_filter): + """Sets the entity_name_filter of this EntityNameFilter. + + + :param entity_name_filter: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :type: str + """ + + self._entity_name_filter = entity_name_filter + + @property + def entity_type(self): + """Gets the entity_type of this EntityNameFilter. # noqa: E501 + + + :return: The entity_type of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityNameFilter. + + + :param entity_type: The entity_type of this EntityNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relation.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relation.py new file mode 100644 index 0000000..ee5b574 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relation.py @@ -0,0 +1,238 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_from': 'EntityId', + 'to': 'EntityId', + 'type': 'str', + 'type_group': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + '_from': 'from', + 'to': 'to', + 'type': 'type', + 'type_group': 'typeGroup', + 'additional_info': 'additionalInfo' + } + + def __init__(self, _from=None, to=None, type=None, type_group=None, additional_info=None): # noqa: E501 + """EntityRelation - a model defined in Swagger""" # noqa: E501 + self.__from = None + self._to = None + self._type = None + self._type_group = None + self._additional_info = None + self.discriminator = None + if _from is not None: + self._from = _from + if to is not None: + self.to = to + if type is not None: + self.type = type + if type_group is not None: + self.type_group = type_group + if additional_info is not None: + self.additional_info = additional_info + + @property + def _from(self): + """Gets the _from of this EntityRelation. # noqa: E501 + + + :return: The _from of this EntityRelation. # noqa: E501 + :rtype: EntityId + """ + return self.__from + + @_from.setter + def _from(self, _from): + """Sets the _from of this EntityRelation. + + + :param _from: The _from of this EntityRelation. # noqa: E501 + :type: EntityId + """ + + self.__from = _from + + @property + def to(self): + """Gets the to of this EntityRelation. # noqa: E501 + + + :return: The to of this EntityRelation. # noqa: E501 + :rtype: EntityId + """ + return self._to + + @to.setter + def to(self, to): + """Sets the to of this EntityRelation. + + + :param to: The to of this EntityRelation. # noqa: E501 + :type: EntityId + """ + + self._to = to + + @property + def type(self): + """Gets the type of this EntityRelation. # noqa: E501 + + String value of relation type. # noqa: E501 + + :return: The type of this EntityRelation. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityRelation. + + String value of relation type. # noqa: E501 + + :param type: The type of this EntityRelation. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def type_group(self): + """Gets the type_group of this EntityRelation. # noqa: E501 + + Represents the type group of the relation. # noqa: E501 + + :return: The type_group of this EntityRelation. # noqa: E501 + :rtype: str + """ + return self._type_group + + @type_group.setter + def type_group(self, type_group): + """Sets the type_group of this EntityRelation. + + Represents the type group of the relation. # noqa: E501 + + :param type_group: The type_group of this EntityRelation. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if type_group not in allowed_values: + raise ValueError( + "Invalid value for `type_group` ({0}), must be one of {1}" # noqa: E501 + .format(type_group, allowed_values) + ) + + self._type_group = type_group + + @property + def additional_info(self): + """Gets the additional_info of this EntityRelation. # noqa: E501 + + + :return: The additional_info of this EntityRelation. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityRelation. + + + :param additional_info: The additional_info of this EntityRelation. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relation_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relation_info.py new file mode 100644 index 0000000..034de04 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relation_info.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_from': 'EntityId', + 'to': 'EntityId', + 'type': 'str', + 'type_group': 'str', + 'additional_info': 'JsonNode', + 'from_name': 'str', + 'to_name': 'str' + } + + attribute_map = { + '_from': 'from', + 'to': 'to', + 'type': 'type', + 'type_group': 'typeGroup', + 'additional_info': 'additionalInfo', + 'from_name': 'fromName', + 'to_name': 'toName' + } + + def __init__(self, _from=None, to=None, type=None, type_group=None, additional_info=None, from_name=None, to_name=None): # noqa: E501 + """EntityRelationInfo - a model defined in Swagger""" # noqa: E501 + self.__from = None + self._to = None + self._type = None + self._type_group = None + self._additional_info = None + self._from_name = None + self._to_name = None + self.discriminator = None + if _from is not None: + self._from = _from + if to is not None: + self.to = to + if type is not None: + self.type = type + if type_group is not None: + self.type_group = type_group + if additional_info is not None: + self.additional_info = additional_info + if from_name is not None: + self.from_name = from_name + if to_name is not None: + self.to_name = to_name + + @property + def _from(self): + """Gets the _from of this EntityRelationInfo. # noqa: E501 + + + :return: The _from of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self.__from + + @_from.setter + def _from(self, _from): + """Sets the _from of this EntityRelationInfo. + + + :param _from: The _from of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self.__from = _from + + @property + def to(self): + """Gets the to of this EntityRelationInfo. # noqa: E501 + + + :return: The to of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._to + + @to.setter + def to(self, to): + """Sets the to of this EntityRelationInfo. + + + :param to: The to of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self._to = to + + @property + def type(self): + """Gets the type of this EntityRelationInfo. # noqa: E501 + + String value of relation type. # noqa: E501 + + :return: The type of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityRelationInfo. + + String value of relation type. # noqa: E501 + + :param type: The type of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def type_group(self): + """Gets the type_group of this EntityRelationInfo. # noqa: E501 + + Represents the type group of the relation. # noqa: E501 + + :return: The type_group of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type_group + + @type_group.setter + def type_group(self, type_group): + """Sets the type_group of this EntityRelationInfo. + + Represents the type group of the relation. # noqa: E501 + + :param type_group: The type_group of this EntityRelationInfo. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if type_group not in allowed_values: + raise ValueError( + "Invalid value for `type_group` ({0}), must be one of {1}" # noqa: E501 + .format(type_group, allowed_values) + ) + + self._type_group = type_group + + @property + def additional_info(self): + """Gets the additional_info of this EntityRelationInfo. # noqa: E501 + + + :return: The additional_info of this EntityRelationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityRelationInfo. + + + :param additional_info: The additional_info of this EntityRelationInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def from_name(self): + """Gets the from_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [from] direction. # noqa: E501 + + :return: The from_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._from_name + + @from_name.setter + def from_name(self, from_name): + """Sets the from_name of this EntityRelationInfo. + + Name of the entity for [from] direction. # noqa: E501 + + :param from_name: The from_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._from_name = from_name + + @property + def to_name(self): + """Gets the to_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [to] direction. # noqa: E501 + + :return: The to_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._to_name + + @to_name.setter + def to_name(self, to_name): + """Sets the to_name of this EntityRelationInfo. + + Name of the entity for [to] direction. # noqa: E501 + + :param to_name: The to_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._to_name = to_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relations_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relations_query.py new file mode 100644 index 0000000..eb568a2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_relations_query.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationsQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'filters': 'list[RelationEntityTypeFilter]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'filters': 'filters', + 'parameters': 'parameters' + } + + def __init__(self, filters=None, parameters=None): # noqa: E501 + """EntityRelationsQuery - a model defined in Swagger""" # noqa: E501 + self._filters = None + self._parameters = None + self.discriminator = None + if filters is not None: + self.filters = filters + if parameters is not None: + self.parameters = parameters + + @property + def filters(self): + """Gets the filters of this EntityRelationsQuery. # noqa: E501 + + Main filters. # noqa: E501 + + :return: The filters of this EntityRelationsQuery. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this EntityRelationsQuery. + + Main filters. # noqa: E501 + + :param filters: The filters of this EntityRelationsQuery. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def parameters(self): + """Gets the parameters of this EntityRelationsQuery. # noqa: E501 + + + :return: The parameters of this EntityRelationsQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityRelationsQuery. + + + :param parameters: The parameters of this EntityRelationsQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationsQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationsQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_subtype.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_subtype.py new file mode 100644 index 0000000..f336971 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_subtype.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntitySubtype(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str', + 'tenant_id': 'TenantId', + 'type': 'str' + } + + attribute_map = { + 'entity_type': 'entityType', + 'tenant_id': 'tenantId', + 'type': 'type' + } + + def __init__(self, entity_type=None, tenant_id=None, type=None): # noqa: E501 + """EntitySubtype - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self._tenant_id = None + self._type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + + @property + def entity_type(self): + """Gets the entity_type of this EntitySubtype. # noqa: E501 + + + :return: The entity_type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntitySubtype. + + + :param entity_type: The entity_type of this EntitySubtype. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def tenant_id(self): + """Gets the tenant_id of this EntitySubtype. # noqa: E501 + + + :return: The tenant_id of this EntitySubtype. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntitySubtype. + + + :param tenant_id: The tenant_id of this EntitySubtype. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EntitySubtype. # noqa: E501 + + + :return: The type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntitySubtype. + + + :param type: The type of this EntitySubtype. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitySubtype, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitySubtype): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_filter.py new file mode 100644 index 0000000..5cd009c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_filter.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeFilter. # noqa: E501 + + + :return: The entity_type of this EntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeFilter. + + + :param entity_type: The entity_type of this EntityTypeFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_load_result.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_load_result.py new file mode 100644 index 0000000..2813f01 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_load_result.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'int', + 'deleted': 'int', + 'entity_type': 'str', + 'updated': 'int' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_type': 'entityType', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_type=None, updated=None): # noqa: E501 + """EntityTypeLoadResult - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_type = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_type is not None: + self.entity_type = entity_type + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityTypeLoadResult. # noqa: E501 + + + :return: The created of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityTypeLoadResult. + + + :param created: The created of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityTypeLoadResult. # noqa: E501 + + + :return: The deleted of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityTypeLoadResult. + + + :param deleted: The deleted of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._deleted = deleted + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeLoadResult. # noqa: E501 + + + :return: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeLoadResult. + + + :param entity_type: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def updated(self): + """Gets the updated of this EntityTypeLoadResult. # noqa: E501 + + + :return: The updated of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityTypeLoadResult. + + + :param updated: The updated of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_create_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_create_config.py new file mode 100644 index 0000000..c8b36ac --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_create_config.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'all_entities': 'bool', + 'entity_ids': 'list[str]', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_relations': 'bool', + 'sync_strategy': 'str' + } + + attribute_map = { + 'all_entities': 'allEntities', + 'entity_ids': 'entityIds', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_relations': 'saveRelations', + 'sync_strategy': 'syncStrategy' + } + + def __init__(self, all_entities=None, entity_ids=None, save_attributes=None, save_credentials=None, save_relations=None, sync_strategy=None): # noqa: E501 + """EntityTypeVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._all_entities = None + self._entity_ids = None + self._save_attributes = None + self._save_credentials = None + self._save_relations = None + self._sync_strategy = None + self.discriminator = None + if all_entities is not None: + self.all_entities = all_entities + if entity_ids is not None: + self.entity_ids = entity_ids + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_relations is not None: + self.save_relations = save_relations + if sync_strategy is not None: + self.sync_strategy = sync_strategy + + @property + def all_entities(self): + """Gets the all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._all_entities + + @all_entities.setter + def all_entities(self, all_entities): + """Sets the all_entities of this EntityTypeVersionCreateConfig. + + + :param all_entities: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._all_entities = all_entities + + @property + def entity_ids(self): + """Gets the entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_ids + + @entity_ids.setter + def entity_ids(self, entity_ids): + """Sets the entity_ids of this EntityTypeVersionCreateConfig. + + + :param entity_ids: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: list[str] + """ + + self._entity_ids = entity_ids + + @property + def save_attributes(self): + """Gets the save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this EntityTypeVersionCreateConfig. + + + :param save_attributes: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this EntityTypeVersionCreateConfig. + + + :param save_credentials: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_relations(self): + """Gets the save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this EntityTypeVersionCreateConfig. + + + :param save_relations: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + @property + def sync_strategy(self): + """Gets the sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this EntityTypeVersionCreateConfig. + + + :param sync_strategy: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_load_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_load_config.py new file mode 100644 index 0000000..734a49a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_load_config.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'find_existing_entity_by_name': 'bool', + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_relations': 'bool', + 'remove_other_entities': 'bool' + } + + attribute_map = { + 'find_existing_entity_by_name': 'findExistingEntityByName', + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_relations': 'loadRelations', + 'remove_other_entities': 'removeOtherEntities' + } + + def __init__(self, find_existing_entity_by_name=None, load_attributes=None, load_credentials=None, load_relations=None, remove_other_entities=None): # noqa: E501 + """EntityTypeVersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._find_existing_entity_by_name = None + self._load_attributes = None + self._load_credentials = None + self._load_relations = None + self._remove_other_entities = None + self.discriminator = None + if find_existing_entity_by_name is not None: + self.find_existing_entity_by_name = find_existing_entity_by_name + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_relations is not None: + self.load_relations = load_relations + if remove_other_entities is not None: + self.remove_other_entities = remove_other_entities + + @property + def find_existing_entity_by_name(self): + """Gets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._find_existing_entity_by_name + + @find_existing_entity_by_name.setter + def find_existing_entity_by_name(self, find_existing_entity_by_name): + """Sets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. + + + :param find_existing_entity_by_name: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._find_existing_entity_by_name = find_existing_entity_by_name + + @property + def load_attributes(self): + """Gets the load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this EntityTypeVersionLoadConfig. + + + :param load_attributes: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this EntityTypeVersionLoadConfig. + + + :param load_credentials: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_relations(self): + """Gets the load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this EntityTypeVersionLoadConfig. + + + :param load_relations: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + @property + def remove_other_entities(self): + """Gets the remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._remove_other_entities + + @remove_other_entities.setter + def remove_other_entities(self, remove_other_entities): + """Sets the remove_other_entities of this EntityTypeVersionLoadConfig. + + + :param remove_other_entities: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._remove_other_entities = remove_other_entities + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_load_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_load_request.py new file mode 100644 index 0000000..2f67474 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_type_version_load_request.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class EntityTypeVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'dict(str, EntityTypeVersionLoadConfig)', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, entity_types=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """EntityTypeVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._type = None + self._version_id = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionLoadConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityTypeVersionLoadRequest. + + + :param entity_types: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionLoadConfig) + """ + + self._entity_types = entity_types + + @property + def type(self): + """Gets the type of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityTypeVersionLoadRequest. + + + :param type: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this EntityTypeVersionLoadRequest. + + + :param version_id: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_version.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_version.py new file mode 100644 index 0000000..01f8c6b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_version.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'author': 'str', + 'id': 'str', + 'name': 'str', + 'timestamp': 'int' + } + + attribute_map = { + 'author': 'author', + 'id': 'id', + 'name': 'name', + 'timestamp': 'timestamp' + } + + def __init__(self, author=None, id=None, name=None, timestamp=None): # noqa: E501 + """EntityVersion - a model defined in Swagger""" # noqa: E501 + self._author = None + self._id = None + self._name = None + self._timestamp = None + self.discriminator = None + if author is not None: + self.author = author + if id is not None: + self.id = id + if name is not None: + self.name = name + if timestamp is not None: + self.timestamp = timestamp + + @property + def author(self): + """Gets the author of this EntityVersion. # noqa: E501 + + + :return: The author of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._author + + @author.setter + def author(self, author): + """Sets the author of this EntityVersion. + + + :param author: The author of this EntityVersion. # noqa: E501 + :type: str + """ + + self._author = author + + @property + def id(self): + """Gets the id of this EntityVersion. # noqa: E501 + + + :return: The id of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityVersion. + + + :param id: The id of this EntityVersion. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this EntityVersion. # noqa: E501 + + + :return: The name of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityVersion. + + + :param name: The name of this EntityVersion. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def timestamp(self): + """Gets the timestamp of this EntityVersion. # noqa: E501 + + + :return: The timestamp of this EntityVersion. # noqa: E501 + :rtype: int + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this EntityVersion. + + + :param timestamp: The timestamp of this EntityVersion. # noqa: E501 + :type: int + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view.py new file mode 100644 index 0000000..7159fa0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view.py @@ -0,0 +1,398 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None): # noqa: E501 + """EntityView - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this EntityView. # noqa: E501 + + + :return: The id of this EntityView. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityView. + + + :param id: The id of this EntityView. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityView. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityView. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityView. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityView. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityView. # noqa: E501 + + + :return: The tenant_id of this EntityView. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityView. + + + :param tenant_id: The tenant_id of this EntityView. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityView. # noqa: E501 + + + :return: The customer_id of this EntityView. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityView. + + + :param customer_id: The customer_id of this EntityView. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityView. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityView. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityView. + + Entity View name # noqa: E501 + + :param name: The name of this EntityView. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityView. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityView. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityView. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityView. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityView. # noqa: E501 + + + :return: The entity_id of this EntityView. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityView. + + + :param entity_id: The entity_id of this EntityView. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityView. # noqa: E501 + + + :return: The keys of this EntityView. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityView. + + + :param keys: The keys of this EntityView. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityView. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityView. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityView. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityView. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityView. # noqa: E501 + + + :return: The additional_info of this EntityView. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityView. + + + :param additional_info: The additional_info of this EntityView. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_id.py new file mode 100644 index 0000000..1701bb1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityViewId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityViewId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityViewId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityViewId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityViewId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EntityViewId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ENTITY_VIEW"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_info.py new file mode 100644 index 0000000..aa0e005 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_info.py @@ -0,0 +1,454 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None, customer_title=None, customer_is_public=None): # noqa: E501 + """EntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + + @property + def id(self): + """Gets the id of this EntityViewInfo. # noqa: E501 + + + :return: The id of this EntityViewInfo. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewInfo. + + + :param id: The id of this EntityViewInfo. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityViewInfo. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityViewInfo. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityViewInfo. # noqa: E501 + + + :return: The tenant_id of this EntityViewInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityViewInfo. + + + :param tenant_id: The tenant_id of this EntityViewInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityViewInfo. # noqa: E501 + + + :return: The customer_id of this EntityViewInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityViewInfo. + + + :param customer_id: The customer_id of this EntityViewInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityViewInfo. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityViewInfo. + + Entity View name # noqa: E501 + + :param name: The name of this EntityViewInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityViewInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityViewInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityViewInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityViewInfo. # noqa: E501 + + + :return: The entity_id of this EntityViewInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityViewInfo. + + + :param entity_id: The entity_id of this EntityViewInfo. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityViewInfo. # noqa: E501 + + + :return: The keys of this EntityViewInfo. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityViewInfo. + + + :param keys: The keys of this EntityViewInfo. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityViewInfo. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityViewInfo. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityViewInfo. # noqa: E501 + + + :return: The additional_info of this EntityViewInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityViewInfo. + + + :param additional_info: The additional_info of this EntityViewInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this EntityViewInfo. # noqa: E501 + + Title of the Customer that owns the entity view. # noqa: E501 + + :return: The customer_title of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this EntityViewInfo. + + Title of the Customer that owns the entity view. # noqa: E501 + + :param customer_title: The customer_title of this EntityViewInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this EntityViewInfo. # noqa: E501 + + Indicates special 'Public' Customer that is auto-generated to use the entity view on public dashboards. # noqa: E501 + + :return: The customer_is_public of this EntityViewInfo. # noqa: E501 + :rtype: bool + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this EntityViewInfo. + + Indicates special 'Public' Customer that is auto-generated to use the entity view on public dashboards. # noqa: E501 + + :param customer_is_public: The customer_is_public of this EntityViewInfo. # noqa: E501 + :type: bool + """ + + self._customer_is_public = customer_is_public + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_search_query.py new file mode 100644 index 0000000..7a507fe --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_view_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_view_types': 'entityViewTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, entity_view_types=None, parameters=None): # noqa: E501 + """EntityViewSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_view_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQuery. # noqa: E501 + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQuery. + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param entity_view_types: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def parameters(self): + """Gets the parameters of this EntityViewSearchQuery. # noqa: E501 + + + :return: The parameters of this EntityViewSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityViewSearchQuery. + + + :param parameters: The parameters of this EntityViewSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_search_query_filter.py new file mode 100644 index 0000000..6bd8f09 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'entity_view_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'entity_view_types': 'entityViewTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, entity_view_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EntityViewSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._entity_view_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityViewSearchQueryFilter. + + + :param direction: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQueryFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EntityViewSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EntityViewSearchQueryFilter. + + + :param max_level: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQueryFilter. + + + :param relation_type: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EntityViewSearchQueryFilter. + + + :param root_entity: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_type_filter.py new file mode 100644 index 0000000..1bb9a85 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/entity_view_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_view_name_filter': 'str', + 'entity_view_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_view_name_filter': 'entityViewNameFilter', + 'entity_view_types': 'entityViewTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_view_name_filter=None, entity_view_types=None, *args, **kwargs): # noqa: E501 + """EntityViewTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_view_name_filter = None + self._entity_view_types = None + self.discriminator = None + if entity_view_name_filter is not None: + self.entity_view_name_filter = entity_view_name_filter + if entity_view_types is not None: + self.entity_view_types = entity_view_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_view_name_filter(self): + """Gets the entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_view_name_filter + + @entity_view_name_filter.setter + def entity_view_name_filter(self, entity_view_name_filter): + """Sets the entity_view_name_filter of this EntityViewTypeFilter. + + + :param entity_view_name_filter: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :type: str + """ + + self._entity_view_name_filter = entity_view_name_filter + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewTypeFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/error_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/error_event_filter.py new file mode 100644 index 0000000..f9d80a4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/error_event_filter.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class ErrorEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'method': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'method': 'method', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, method=None, error_str=None, *args, **kwargs): # noqa: E501 + """ErrorEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._method = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if method is not None: + self.method = method + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this ErrorEventFilter. # noqa: E501 + + + :return: The not_empty of this ErrorEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this ErrorEventFilter. + + + :param not_empty: The not_empty of this ErrorEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this ErrorEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this ErrorEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this ErrorEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this ErrorEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this ErrorEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def method(self): + """Gets the method of this ErrorEventFilter. # noqa: E501 + + String value representing the method name when the error happened # noqa: E501 + + :return: The method of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._method + + @method.setter + def method(self, method): + """Sets the method of this ErrorEventFilter. + + String value representing the method name when the error happened # noqa: E501 + + :param method: The method of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._method = method + + @property + def error_str(self): + """Gets the error_str of this ErrorEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this ErrorEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ErrorEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ErrorEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/escalated_notification_rule_recipients_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/escalated_notification_rule_recipients_config.py new file mode 100644 index 0000000..e24f709 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/escalated_notification_rule_recipients_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EscalatedNotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'escalation_table': 'dict(str, list[str])', + 'trigger_type': 'str' + } + + attribute_map = { + 'escalation_table': 'escalationTable', + 'trigger_type': 'triggerType' + } + + def __init__(self, escalation_table=None, trigger_type=None): # noqa: E501 + """EscalatedNotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._escalation_table = None + self._trigger_type = None + self.discriminator = None + if escalation_table is not None: + self.escalation_table = escalation_table + self.trigger_type = trigger_type + + @property + def escalation_table(self): + """Gets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._escalation_table + + @escalation_table.setter + def escalation_table(self, escalation_table): + """Sets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. + + + :param escalation_table: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._escalation_table = escalation_table + + @property + def trigger_type(self): + """Gets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EscalatedNotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EscalatedNotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/event.py b/tb-rest-client/python/tb_rest_client/models/models_ce/event.py new file mode 100644 index 0000000..1fa4613 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/event.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Event(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """Event - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this Event. # noqa: E501 + + + :return: The id of this Event. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Event. + + + :param id: The id of this Event. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this Event. # noqa: E501 + + + :return: The tenant_id of this Event. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Event. + + + :param tenant_id: The tenant_id of this Event. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this Event. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this Event. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Event. + + Event type # noqa: E501 + + :param type: The type of this Event. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this Event. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this Event. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this Event. + + string # noqa: E501 + + :param uid: The uid of this Event. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this Event. # noqa: E501 + + + :return: The entity_id of this Event. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this Event. + + + :param entity_id: The entity_id of this Event. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this Event. # noqa: E501 + + + :return: The body of this Event. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this Event. + + + :param body: The body of this Event. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this Event. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this Event. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Event. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Event. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Event, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Event): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/event_filter.py new file mode 100644 index 0000000..5de4c94 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/event_filter.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str' + } + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType' + } + + def __init__(self, not_empty=None, event_type=None): # noqa: E501 + """EventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + + @property + def not_empty(self): + """Gets the not_empty of this EventFilter. # noqa: E501 + + + :return: The not_empty of this EventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this EventFilter. + + + :param not_empty: The not_empty of this EventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this EventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this EventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this EventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this EventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/event_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/event_id.py new file mode 100644 index 0000000..878a7b5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventId. + + string # noqa: E501 + + :param id: The id of this EventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/event_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/event_info.py new file mode 100644 index 0000000..4364897 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/event_info.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """EventInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this EventInfo. # noqa: E501 + + + :return: The id of this EventInfo. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventInfo. + + + :param id: The id of this EventInfo. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EventInfo. # noqa: E501 + + + :return: The tenant_id of this EventInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EventInfo. + + + :param tenant_id: The tenant_id of this EventInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EventInfo. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EventInfo. + + Event type # noqa: E501 + + :param type: The type of this EventInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this EventInfo. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EventInfo. + + string # noqa: E501 + + :param uid: The uid of this EventInfo. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this EventInfo. # noqa: E501 + + + :return: The entity_id of this EventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EventInfo. + + + :param entity_id: The entity_id of this EventInfo. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this EventInfo. # noqa: E501 + + + :return: The body of this EventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EventInfo. + + + :param body: The body of this EventInfo. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EventInfo. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this EventInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EventInfo. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EventInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/features_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/features_info.py new file mode 100644 index 0000000..7027db7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/features_info.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FeaturesInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email_enabled': 'bool', + 'notification_enabled': 'bool', + 'oauth_enabled': 'bool', + 'sms_enabled': 'bool', + 'two_fa_enabled': 'bool' + } + + attribute_map = { + 'email_enabled': 'emailEnabled', + 'notification_enabled': 'notificationEnabled', + 'oauth_enabled': 'oauthEnabled', + 'sms_enabled': 'smsEnabled', + 'two_fa_enabled': 'twoFaEnabled' + } + + def __init__(self, email_enabled=None, notification_enabled=None, oauth_enabled=None, sms_enabled=None, two_fa_enabled=None): # noqa: E501 + """FeaturesInfo - a model defined in Swagger""" # noqa: E501 + self._email_enabled = None + self._notification_enabled = None + self._oauth_enabled = None + self._sms_enabled = None + self._two_fa_enabled = None + self.discriminator = None + if email_enabled is not None: + self.email_enabled = email_enabled + if notification_enabled is not None: + self.notification_enabled = notification_enabled + if oauth_enabled is not None: + self.oauth_enabled = oauth_enabled + if sms_enabled is not None: + self.sms_enabled = sms_enabled + if two_fa_enabled is not None: + self.two_fa_enabled = two_fa_enabled + + @property + def email_enabled(self): + """Gets the email_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The email_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._email_enabled + + @email_enabled.setter + def email_enabled(self, email_enabled): + """Sets the email_enabled of this FeaturesInfo. + + + :param email_enabled: The email_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._email_enabled = email_enabled + + @property + def notification_enabled(self): + """Gets the notification_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The notification_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._notification_enabled + + @notification_enabled.setter + def notification_enabled(self, notification_enabled): + """Sets the notification_enabled of this FeaturesInfo. + + + :param notification_enabled: The notification_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._notification_enabled = notification_enabled + + @property + def oauth_enabled(self): + """Gets the oauth_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._oauth_enabled + + @oauth_enabled.setter + def oauth_enabled(self, oauth_enabled): + """Sets the oauth_enabled of this FeaturesInfo. + + + :param oauth_enabled: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._oauth_enabled = oauth_enabled + + @property + def sms_enabled(self): + """Gets the sms_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The sms_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._sms_enabled + + @sms_enabled.setter + def sms_enabled(self, sms_enabled): + """Sets the sms_enabled of this FeaturesInfo. + + + :param sms_enabled: The sms_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._sms_enabled = sms_enabled + + @property + def two_fa_enabled(self): + """Gets the two_fa_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._two_fa_enabled + + @two_fa_enabled.setter + def two_fa_enabled(self, two_fa_enabled): + """Sets the two_fa_enabled of this FeaturesInfo. + + + :param two_fa_enabled: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._two_fa_enabled = two_fa_enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FeaturesInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FeaturesInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/file.py b/tb-rest-client/python/tb_rest_client/models/models_ce/file.py new file mode 100644 index 0000000..c659662 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/file.py @@ -0,0 +1,488 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class File(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'absolute': 'bool', + 'absolute_file': 'file', + 'absolute_path': 'str', + 'canonical_file': 'file', + 'canonical_path': 'str', + 'directory': 'bool', + 'file': 'bool', + 'free_space': 'int', + 'hidden': 'bool', + 'name': 'str', + 'parent': 'str', + 'parent_file': 'file', + 'path': 'str', + 'total_space': 'int', + 'usable_space': 'int' + } + + attribute_map = { + 'absolute': 'absolute', + 'absolute_file': 'absoluteFile', + 'absolute_path': 'absolutePath', + 'canonical_file': 'canonicalFile', + 'canonical_path': 'canonicalPath', + 'directory': 'directory', + 'file': 'file', + 'free_space': 'freeSpace', + 'hidden': 'hidden', + 'name': 'name', + 'parent': 'parent', + 'parent_file': 'parentFile', + 'path': 'path', + 'total_space': 'totalSpace', + 'usable_space': 'usableSpace' + } + + def __init__(self, absolute=None, absolute_file=None, absolute_path=None, canonical_file=None, canonical_path=None, directory=None, file=None, free_space=None, hidden=None, name=None, parent=None, parent_file=None, path=None, total_space=None, usable_space=None): # noqa: E501 + """File - a model defined in Swagger""" # noqa: E501 + self._absolute = None + self._absolute_file = None + self._absolute_path = None + self._canonical_file = None + self._canonical_path = None + self._directory = None + self._file = None + self._free_space = None + self._hidden = None + self._name = None + self._parent = None + self._parent_file = None + self._path = None + self._total_space = None + self._usable_space = None + self.discriminator = None + if absolute is not None: + self.absolute = absolute + if absolute_file is not None: + self.absolute_file = absolute_file + if absolute_path is not None: + self.absolute_path = absolute_path + if canonical_file is not None: + self.canonical_file = canonical_file + if canonical_path is not None: + self.canonical_path = canonical_path + if directory is not None: + self.directory = directory + if file is not None: + self.file = file + if free_space is not None: + self.free_space = free_space + if hidden is not None: + self.hidden = hidden + if name is not None: + self.name = name + if parent is not None: + self.parent = parent + if parent_file is not None: + self.parent_file = parent_file + if path is not None: + self.path = path + if total_space is not None: + self.total_space = total_space + if usable_space is not None: + self.usable_space = usable_space + + @property + def absolute(self): + """Gets the absolute of this File. # noqa: E501 + + + :return: The absolute of this File. # noqa: E501 + :rtype: bool + """ + return self._absolute + + @absolute.setter + def absolute(self, absolute): + """Sets the absolute of this File. + + + :param absolute: The absolute of this File. # noqa: E501 + :type: bool + """ + + self._absolute = absolute + + @property + def absolute_file(self): + """Gets the absolute_file of this File. # noqa: E501 + + + :return: The absolute_file of this File. # noqa: E501 + :rtype: file + """ + return self._absolute_file + + @absolute_file.setter + def absolute_file(self, absolute_file): + """Sets the absolute_file of this File. + + + :param absolute_file: The absolute_file of this File. # noqa: E501 + :type: file + """ + + self._absolute_file = absolute_file + + @property + def absolute_path(self): + """Gets the absolute_path of this File. # noqa: E501 + + + :return: The absolute_path of this File. # noqa: E501 + :rtype: str + """ + return self._absolute_path + + @absolute_path.setter + def absolute_path(self, absolute_path): + """Sets the absolute_path of this File. + + + :param absolute_path: The absolute_path of this File. # noqa: E501 + :type: str + """ + + self._absolute_path = absolute_path + + @property + def canonical_file(self): + """Gets the canonical_file of this File. # noqa: E501 + + + :return: The canonical_file of this File. # noqa: E501 + :rtype: file + """ + return self._canonical_file + + @canonical_file.setter + def canonical_file(self, canonical_file): + """Sets the canonical_file of this File. + + + :param canonical_file: The canonical_file of this File. # noqa: E501 + :type: file + """ + + self._canonical_file = canonical_file + + @property + def canonical_path(self): + """Gets the canonical_path of this File. # noqa: E501 + + + :return: The canonical_path of this File. # noqa: E501 + :rtype: str + """ + return self._canonical_path + + @canonical_path.setter + def canonical_path(self, canonical_path): + """Sets the canonical_path of this File. + + + :param canonical_path: The canonical_path of this File. # noqa: E501 + :type: str + """ + + self._canonical_path = canonical_path + + @property + def directory(self): + """Gets the directory of this File. # noqa: E501 + + + :return: The directory of this File. # noqa: E501 + :rtype: bool + """ + return self._directory + + @directory.setter + def directory(self, directory): + """Sets the directory of this File. + + + :param directory: The directory of this File. # noqa: E501 + :type: bool + """ + + self._directory = directory + + @property + def file(self): + """Gets the file of this File. # noqa: E501 + + + :return: The file of this File. # noqa: E501 + :rtype: bool + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this File. + + + :param file: The file of this File. # noqa: E501 + :type: bool + """ + + self._file = file + + @property + def free_space(self): + """Gets the free_space of this File. # noqa: E501 + + + :return: The free_space of this File. # noqa: E501 + :rtype: int + """ + return self._free_space + + @free_space.setter + def free_space(self, free_space): + """Sets the free_space of this File. + + + :param free_space: The free_space of this File. # noqa: E501 + :type: int + """ + + self._free_space = free_space + + @property + def hidden(self): + """Gets the hidden of this File. # noqa: E501 + + + :return: The hidden of this File. # noqa: E501 + :rtype: bool + """ + return self._hidden + + @hidden.setter + def hidden(self, hidden): + """Sets the hidden of this File. + + + :param hidden: The hidden of this File. # noqa: E501 + :type: bool + """ + + self._hidden = hidden + + @property + def name(self): + """Gets the name of this File. # noqa: E501 + + + :return: The name of this File. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this File. + + + :param name: The name of this File. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def parent(self): + """Gets the parent of this File. # noqa: E501 + + + :return: The parent of this File. # noqa: E501 + :rtype: str + """ + return self._parent + + @parent.setter + def parent(self, parent): + """Sets the parent of this File. + + + :param parent: The parent of this File. # noqa: E501 + :type: str + """ + + self._parent = parent + + @property + def parent_file(self): + """Gets the parent_file of this File. # noqa: E501 + + + :return: The parent_file of this File. # noqa: E501 + :rtype: file + """ + return self._parent_file + + @parent_file.setter + def parent_file(self, parent_file): + """Sets the parent_file of this File. + + + :param parent_file: The parent_file of this File. # noqa: E501 + :type: file + """ + + self._parent_file = parent_file + + @property + def path(self): + """Gets the path of this File. # noqa: E501 + + + :return: The path of this File. # noqa: E501 + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """Sets the path of this File. + + + :param path: The path of this File. # noqa: E501 + :type: str + """ + + self._path = path + + @property + def total_space(self): + """Gets the total_space of this File. # noqa: E501 + + + :return: The total_space of this File. # noqa: E501 + :rtype: int + """ + return self._total_space + + @total_space.setter + def total_space(self, total_space): + """Sets the total_space of this File. + + + :param total_space: The total_space of this File. # noqa: E501 + :type: int + """ + + self._total_space = total_space + + @property + def usable_space(self): + """Gets the usable_space of this File. # noqa: E501 + + + :return: The usable_space of this File. # noqa: E501 + :rtype: int + """ + return self._usable_space + + @usable_space.setter + def usable_space(self, usable_space): + """Sets the usable_space of this File. + + + :param usable_space: The usable_space of this File. # noqa: E501 + :type: int + """ + + self._usable_space = usable_space + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(File, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, File): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valueboolean.py b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valueboolean.py new file mode 100644 index 0000000..90a95f9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valueboolean.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'bool', + 'dynamic_value': 'DynamicValueboolean', + 'user_value': 'bool' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueboolean - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueboolean. + + + :param default_value: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: DynamicValueboolean + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueboolean. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :type: DynamicValueboolean + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueboolean. + + + :param user_value: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuedouble.py b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuedouble.py new file mode 100644 index 0000000..af159f6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuedouble.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'float', + 'dynamic_value': 'DynamicValuedouble', + 'user_value': 'float' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuedouble - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuedouble. + + + :param default_value: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: DynamicValuedouble + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuedouble. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :type: DynamicValuedouble + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuedouble. + + + :param user_value: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valueint.py b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valueint.py new file mode 100644 index 0000000..588b349 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valueint.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValueint', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueint - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueint. + + + :param default_value: The default_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :rtype: DynamicValueint + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueint. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :type: DynamicValueint + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueint. + + + :param user_value: The user_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuelong.py b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuelong.py new file mode 100644 index 0000000..849bc29 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuelong.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValuelong', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuelong - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuelong. + + + :param default_value: The default_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: DynamicValuelong + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuelong. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :type: DynamicValuelong + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuelong. + + + :param user_value: The user_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuestring.py b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuestring.py new file mode 100644 index 0000000..f2d45a2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/filter_predicate_valuestring.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'str', + 'dynamic_value': 'DynamicValuestring', + 'user_value': 'str' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuestring - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuestring. + + + :param default_value: The default_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuestring. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuestring. + + + :param user_value: The user_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/home_dashboard.py b/tb-rest-client/python/tb_rest_client/models/models_ce/home_dashboard.py new file mode 100644 index 0000000..ca79d62 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/home_dashboard.py @@ -0,0 +1,374 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HomeDashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'title': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'image': 'str', + 'configuration': 'JsonNode', + 'hide_dashboard_toolbar': 'bool' + } + + attribute_map = { + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'title': 'title', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'image': 'image', + 'configuration': 'configuration', + 'hide_dashboard_toolbar': 'hideDashboardToolbar' + } + + def __init__(self, created_time=None, tenant_id=None, name=None, title=None, assigned_customers=None, mobile_hide=None, mobile_order=None, image=None, configuration=None, hide_dashboard_toolbar=None): # noqa: E501 + """HomeDashboard - a model defined in Swagger""" # noqa: E501 + self._created_time = None + self._tenant_id = None + self._name = None + self._title = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._image = None + self._configuration = None + self._hide_dashboard_toolbar = None + self.discriminator = None + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if name is not None: + self.name = name + if title is not None: + self.title = title + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if image is not None: + self.image = image + if configuration is not None: + self.configuration = configuration + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def created_time(self): + """Gets the created_time of this HomeDashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this HomeDashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this HomeDashboard. # noqa: E501 + + + :return: The tenant_id of this HomeDashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this HomeDashboard. + + + :param tenant_id: The tenant_id of this HomeDashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this HomeDashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this HomeDashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this HomeDashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this HomeDashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def assigned_customers(self): + """Gets the assigned_customers of this HomeDashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this HomeDashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this HomeDashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this HomeDashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this HomeDashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this HomeDashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this HomeDashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this HomeDashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def image(self): + """Gets the image of this HomeDashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this HomeDashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def configuration(self): + """Gets the configuration of this HomeDashboard. # noqa: E501 + + + :return: The configuration of this HomeDashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this HomeDashboard. + + + :param configuration: The configuration of this HomeDashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :return: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this HomeDashboard. + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HomeDashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HomeDashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/home_dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/home_dashboard_info.py new file mode 100644 index 0000000..c02816b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/home_dashboard_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HomeDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dashboard_id': 'DashboardId', + 'hide_dashboard_toolbar': 'bool' + } + + attribute_map = { + 'dashboard_id': 'dashboardId', + 'hide_dashboard_toolbar': 'hideDashboardToolbar' + } + + def __init__(self, dashboard_id=None, hide_dashboard_toolbar=None): # noqa: E501 + """HomeDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._dashboard_id = None + self._hide_dashboard_toolbar = None + self.discriminator = None + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def dashboard_id(self): + """Gets the dashboard_id of this HomeDashboardInfo. # noqa: E501 + + + :return: The dashboard_id of this HomeDashboardInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this HomeDashboardInfo. + + + :param dashboard_id: The dashboard_id of this HomeDashboardInfo. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this HomeDashboardInfo. # noqa: E501 + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :return: The hide_dashboard_toolbar of this HomeDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this HomeDashboardInfo. + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this HomeDashboardInfo. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HomeDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HomeDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/input_stream.py b/tb-rest-client/python/tb_rest_client/models/models_ce/input_stream.py new file mode 100644 index 0000000..3afd8fe --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/input_stream.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class InputStream(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """InputStream - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(InputStream, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, InputStream): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/json_node.py b/tb-rest-client/python/tb_rest_client/models/models_ce/json_node.py new file mode 100644 index 0000000..650d337 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/json_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JsonNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """JsonNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/json_transport_payload_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/json_transport_payload_configuration.py new file mode 100644 index 0000000..bba4c11 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/json_transport_payload_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class JsonTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """JsonTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/jwt_pair.py b/tb-rest-client/python/tb_rest_client/models/models_ce/jwt_pair.py new file mode 100644 index 0000000..d3502b0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/jwt_pair.py @@ -0,0 +1,186 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JWTPair(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'scope': 'str', + 'refresh_token': 'str', + 'token': 'str' + } + + attribute_map = { + 'scope': 'scope', + 'refresh_token': 'refreshToken', + 'token': 'token' + } + + def __init__(self, scope=None, refresh_token=None, token=None): # noqa: E501 + """JWTPair - a model defined in Swagger""" # noqa: E501 + self._scope = None + self._refresh_token = None + self._token = None + self.discriminator = None + if scope is not None: + self.scope = scope + if refresh_token is not None: + self.refresh_token = refresh_token + if token is not None: + self.token = token + + @property + def scope(self): + """Gets the scope of this JWTPair. # noqa: E501 + + + :return: The scope of this JWTPair. # noqa: E501 + :rtype: str + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this JWTPair. + + + :param scope: The scope of this JWTPair. # noqa: E501 + :type: str + """ + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if scope not in allowed_values: + raise ValueError( + "Invalid value for `scope` ({0}), must be one of {1}" # noqa: E501 + .format(scope, allowed_values) + ) + + self._scope = scope + + @property + def refresh_token(self): + """Gets the refresh_token of this JWTPair. # noqa: E501 + + The JWT Refresh Token. Used to get new JWT Access Token if old one has expired. # noqa: E501 + + :return: The refresh_token of this JWTPair. # noqa: E501 + :rtype: str + """ + return self._refresh_token + + @refresh_token.setter + def refresh_token(self, refresh_token): + """Sets the refresh_token of this JWTPair. + + The JWT Refresh Token. Used to get new JWT Access Token if old one has expired. # noqa: E501 + + :param refresh_token: The refresh_token of this JWTPair. # noqa: E501 + :type: str + """ + + self._refresh_token = refresh_token + + @property + def token(self): + """Gets the token of this JWTPair. # noqa: E501 + + The JWT Access Token. Used to perform API calls. # noqa: E501 + + :return: The token of this JWTPair. # noqa: E501 + :rtype: str + """ + return self._token + + @token.setter + def token(self, token): + """Sets the token of this JWTPair. + + The JWT Access Token. Used to perform API calls. # noqa: E501 + + :param token: The token of this JWTPair. # noqa: E501 + :type: str + """ + + self._token = token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JWTPair, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JWTPair): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/jwt_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/jwt_settings.py new file mode 100644 index 0000000..a3e5e27 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/jwt_settings.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JWTSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token_expiration_time': 'int', + 'refresh_token_exp_time': 'int', + 'token_issuer': 'str', + 'token_signing_key': 'str' + } + + attribute_map = { + 'token_expiration_time': 'tokenExpirationTime', + 'refresh_token_exp_time': 'refreshTokenExpTime', + 'token_issuer': 'tokenIssuer', + 'token_signing_key': 'tokenSigningKey' + } + + def __init__(self, token_expiration_time=None, refresh_token_exp_time=None, token_issuer=None, token_signing_key=None): # noqa: E501 + """JWTSettings - a model defined in Swagger""" # noqa: E501 + self._token_expiration_time = None + self._refresh_token_exp_time = None + self._token_issuer = None + self._token_signing_key = None + self.discriminator = None + if token_expiration_time is not None: + self.token_expiration_time = token_expiration_time + if refresh_token_exp_time is not None: + self.refresh_token_exp_time = refresh_token_exp_time + if token_issuer is not None: + self.token_issuer = token_issuer + if token_signing_key is not None: + self.token_signing_key = token_signing_key + + @property + def token_expiration_time(self): + """Gets the token_expiration_time of this JWTSettings. # noqa: E501 + + The JWT will expire after seconds. # noqa: E501 + + :return: The token_expiration_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._token_expiration_time + + @token_expiration_time.setter + def token_expiration_time(self, token_expiration_time): + """Sets the token_expiration_time of this JWTSettings. + + The JWT will expire after seconds. # noqa: E501 + + :param token_expiration_time: The token_expiration_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._token_expiration_time = token_expiration_time + + @property + def refresh_token_exp_time(self): + """Gets the refresh_token_exp_time of this JWTSettings. # noqa: E501 + + The JWT can be refreshed during seconds. # noqa: E501 + + :return: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._refresh_token_exp_time + + @refresh_token_exp_time.setter + def refresh_token_exp_time(self, refresh_token_exp_time): + """Sets the refresh_token_exp_time of this JWTSettings. + + The JWT can be refreshed during seconds. # noqa: E501 + + :param refresh_token_exp_time: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._refresh_token_exp_time = refresh_token_exp_time + + @property + def token_issuer(self): + """Gets the token_issuer of this JWTSettings. # noqa: E501 + + The JWT issuer. # noqa: E501 + + :return: The token_issuer of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_issuer + + @token_issuer.setter + def token_issuer(self, token_issuer): + """Sets the token_issuer of this JWTSettings. + + The JWT issuer. # noqa: E501 + + :param token_issuer: The token_issuer of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_issuer = token_issuer + + @property + def token_signing_key(self): + """Gets the token_signing_key of this JWTSettings. # noqa: E501 + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :return: The token_signing_key of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_signing_key + + @token_signing_key.setter + def token_signing_key(self, token_signing_key): + """Sets the token_signing_key of this JWTSettings. + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :param token_signing_key: The token_signing_key of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_signing_key = token_signing_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JWTSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JWTSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/key_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/key_filter.py new file mode 100644 index 0000000..4ae0113 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/key_filter.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'EntityKey', + 'predicate': 'KeyFilterPredicate', + 'value_type': 'str' + } + + attribute_map = { + 'key': 'key', + 'predicate': 'predicate', + 'value_type': 'valueType' + } + + def __init__(self, key=None, predicate=None, value_type=None): # noqa: E501 + """KeyFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._predicate = None + self._value_type = None + self.discriminator = None + if key is not None: + self.key = key + if predicate is not None: + self.predicate = predicate + if value_type is not None: + self.value_type = value_type + + @property + def key(self): + """Gets the key of this KeyFilter. # noqa: E501 + + + :return: The key of this KeyFilter. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this KeyFilter. + + + :param key: The key of this KeyFilter. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + @property + def predicate(self): + """Gets the predicate of this KeyFilter. # noqa: E501 + + + :return: The predicate of this KeyFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this KeyFilter. + + + :param predicate: The predicate of this KeyFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + @property + def value_type(self): + """Gets the value_type of this KeyFilter. # noqa: E501 + + + :return: The value_type of this KeyFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this KeyFilter. + + + :param value_type: The value_type of this KeyFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/key_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_ce/key_filter_predicate.py new file mode 100644 index 0000000..a7d54cf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/key_filter_predicate.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilterPredicate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """KeyFilterPredicate - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/last_visited_dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/last_visited_dashboard_info.py new file mode 100644 index 0000000..acbb2d0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/last_visited_dashboard_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LastVisitedDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred': 'bool', + 'last_visited': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred': 'starred', + 'last_visited': 'lastVisited' + } + + def __init__(self, id=None, title=None, starred=None, last_visited=None): # noqa: E501 + """LastVisitedDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred = None + self._last_visited = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred is not None: + self.starred = starred + if last_visited is not None: + self.last_visited = last_visited + + @property + def id(self): + """Gets the id of this LastVisitedDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LastVisitedDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this LastVisitedDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this LastVisitedDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred(self): + """Gets the starred of this LastVisitedDashboardInfo. # noqa: E501 + + Starred flag # noqa: E501 + + :return: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this LastVisitedDashboardInfo. + + Starred flag # noqa: E501 + + :param starred: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :type: bool + """ + + self._starred = starred + + @property + def last_visited(self): + """Gets the last_visited of this LastVisitedDashboardInfo. # noqa: E501 + + Last visit timestamp # noqa: E501 + + :return: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._last_visited + + @last_visited.setter + def last_visited(self, last_visited): + """Sets the last_visited of this LastVisitedDashboardInfo. + + Last visit timestamp # noqa: E501 + + :param last_visited: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :type: int + """ + + self._last_visited = last_visited + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LastVisitedDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LastVisitedDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/life_cycle_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/life_cycle_event_filter.py new file mode 100644 index 0000000..ac2665c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/life_cycle_event_filter.py @@ -0,0 +1,283 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class LifeCycleEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'event': 'str', + 'status': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'event': 'event', + 'status': 'status', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, event=None, status=None, error_str=None, *args, **kwargs): # noqa: E501 + """LifeCycleEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._event = None + self._status = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if event is not None: + self.event = event + if status is not None: + self.status = status + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this LifeCycleEventFilter. # noqa: E501 + + + :return: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this LifeCycleEventFilter. + + + :param not_empty: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this LifeCycleEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this LifeCycleEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this LifeCycleEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this LifeCycleEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def event(self): + """Gets the event of this LifeCycleEventFilter. # noqa: E501 + + String value representing the lifecycle event type # noqa: E501 + + :return: The event of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event + + @event.setter + def event(self, event): + """Sets the event of this LifeCycleEventFilter. + + String value representing the lifecycle event type # noqa: E501 + + :param event: The event of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._event = event + + @property + def status(self): + """Gets the status of this LifeCycleEventFilter. # noqa: E501 + + String value representing status of the lifecycle event # noqa: E501 + + :return: The status of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this LifeCycleEventFilter. + + String value representing status of the lifecycle event # noqa: E501 + + :param status: The status of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["Failure", "Success"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def error_str(self): + """Gets the error_str of this LifeCycleEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this LifeCycleEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LifeCycleEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LifeCycleEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/login_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/login_request.py new file mode 100644 index 0000000..82db76a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/login_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'username': 'str', + 'password': 'str' + } + + attribute_map = { + 'username': 'username', + 'password': 'password' + } + + def __init__(self, username=None, password=None): # noqa: E501 + """LoginRequest - a model defined in Swagger""" # noqa: E501 + self._username = None + self._password = None + self.discriminator = None + self.username = username + self.password = password + + @property + def username(self): + """Gets the username of this LoginRequest. # noqa: E501 + + User email # noqa: E501 + + :return: The username of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this LoginRequest. + + User email # noqa: E501 + + :param username: The username of this LoginRequest. # noqa: E501 + :type: str + """ + if username is None: + raise ValueError("Invalid value for `username`, must not be `None`") # noqa: E501 + + self._username = username + + @property + def password(self): + """Gets the password of this LoginRequest. # noqa: E501 + + User password # noqa: E501 + + :return: The password of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this LoginRequest. + + User password # noqa: E501 + + :param password: The password of this LoginRequest. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/login_response.py b/tb-rest-client/python/tb_rest_client/models/models_ce/login_response.py new file mode 100644 index 0000000..5c626ee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/login_response.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token': 'str', + 'refresh_token': 'str' + } + + attribute_map = { + 'token': 'token', + 'refresh_token': 'refreshToken' + } + + def __init__(self, token=None, refresh_token=None): # noqa: E501 + """LoginResponse - a model defined in Swagger""" # noqa: E501 + self._token = None + self._refresh_token = None + self.discriminator = None + self.token = token + self.refresh_token = refresh_token + + @property + def token(self): + """Gets the token of this LoginResponse. # noqa: E501 + + JWT token # noqa: E501 + + :return: The token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._token + + @token.setter + def token(self, token): + """Sets the token of this LoginResponse. + + JWT token # noqa: E501 + + :param token: The token of this LoginResponse. # noqa: E501 + :type: str + """ + if token is None: + raise ValueError("Invalid value for `token`, must not be `None`") # noqa: E501 + + self._token = token + + @property + def refresh_token(self): + """Gets the refresh_token of this LoginResponse. # noqa: E501 + + Refresh token # noqa: E501 + + :return: The refresh_token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._refresh_token + + @refresh_token.setter + def refresh_token(self, refresh_token): + """Sets the refresh_token of this LoginResponse. + + Refresh token # noqa: E501 + + :param refresh_token: The refresh_token of this LoginResponse. # noqa: E501 + :type: str + """ + if refresh_token is None: + raise ValueError("Invalid value for `refresh_token`, must not be `None`") # noqa: E501 + + self._refresh_token = refresh_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..daecd98 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2_m_server_security_config_default.py b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2_m_server_security_config_default.py new file mode 100644 index 0000000..245f270 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2_m_server_security_config_default.py @@ -0,0 +1,490 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MServerSecurityConfigDefault(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, security_host=None, security_port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """LwM2MServerSecurityConfigDefault - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this LwM2MServerSecurityConfigDefault. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this LwM2MServerSecurityConfigDefault. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this LwM2MServerSecurityConfigDefault. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this LwM2MServerSecurityConfigDefault. + + Host for 'Security' mode (DTLS) # noqa: E501 + + :param security_host: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this LwM2MServerSecurityConfigDefault. + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :param security_port: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this LwM2MServerSecurityConfigDefault. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this LwM2MServerSecurityConfigDefault. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this LwM2MServerSecurityConfigDefault. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MServerSecurityConfigDefault, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MServerSecurityConfigDefault): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_instance.py b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_instance.py new file mode 100644 index 0000000..8c9a1be --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_instance.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mInstance(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'resources': 'list[LwM2mResourceObserve]' + } + + attribute_map = { + 'id': 'id', + 'resources': 'resources' + } + + def __init__(self, id=None, resources=None): # noqa: E501 + """LwM2mInstance - a model defined in Swagger""" # noqa: E501 + self._id = None + self._resources = None + self.discriminator = None + if id is not None: + self.id = id + if resources is not None: + self.resources = resources + + @property + def id(self): + """Gets the id of this LwM2mInstance. # noqa: E501 + + LwM2M Instance id. # noqa: E501 + + :return: The id of this LwM2mInstance. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mInstance. + + LwM2M Instance id. # noqa: E501 + + :param id: The id of this LwM2mInstance. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def resources(self): + """Gets the resources of this LwM2mInstance. # noqa: E501 + + LwM2M Resource observe. # noqa: E501 + + :return: The resources of this LwM2mInstance. # noqa: E501 + :rtype: list[LwM2mResourceObserve] + """ + return self._resources + + @resources.setter + def resources(self, resources): + """Sets the resources of this LwM2mInstance. + + LwM2M Resource observe. # noqa: E501 + + :param resources: The resources of this LwM2mInstance. # noqa: E501 + :type: list[LwM2mResourceObserve] + """ + + self._resources = resources + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mInstance, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mInstance): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_object.py b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_object.py new file mode 100644 index 0000000..b36df52 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_object.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mObject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'key_id': 'str', + 'name': 'str', + 'multiple': 'bool', + 'mandatory': 'bool', + 'instances': 'list[LwM2mInstance]' + } + + attribute_map = { + 'id': 'id', + 'key_id': 'keyId', + 'name': 'name', + 'multiple': 'multiple', + 'mandatory': 'mandatory', + 'instances': 'instances' + } + + def __init__(self, id=None, key_id=None, name=None, multiple=None, mandatory=None, instances=None): # noqa: E501 + """LwM2mObject - a model defined in Swagger""" # noqa: E501 + self._id = None + self._key_id = None + self._name = None + self._multiple = None + self._mandatory = None + self._instances = None + self.discriminator = None + if id is not None: + self.id = id + if key_id is not None: + self.key_id = key_id + if name is not None: + self.name = name + if multiple is not None: + self.multiple = multiple + if mandatory is not None: + self.mandatory = mandatory + if instances is not None: + self.instances = instances + + @property + def id(self): + """Gets the id of this LwM2mObject. # noqa: E501 + + LwM2M Object id. # noqa: E501 + + :return: The id of this LwM2mObject. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mObject. + + LwM2M Object id. # noqa: E501 + + :param id: The id of this LwM2mObject. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def key_id(self): + """Gets the key_id of this LwM2mObject. # noqa: E501 + + LwM2M Object key id. # noqa: E501 + + :return: The key_id of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._key_id + + @key_id.setter + def key_id(self, key_id): + """Sets the key_id of this LwM2mObject. + + LwM2M Object key id. # noqa: E501 + + :param key_id: The key_id of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._key_id = key_id + + @property + def name(self): + """Gets the name of this LwM2mObject. # noqa: E501 + + LwM2M Object name. # noqa: E501 + + :return: The name of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mObject. + + LwM2M Object name. # noqa: E501 + + :param name: The name of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def multiple(self): + """Gets the multiple of this LwM2mObject. # noqa: E501 + + LwM2M Object multiple. # noqa: E501 + + :return: The multiple of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._multiple + + @multiple.setter + def multiple(self, multiple): + """Sets the multiple of this LwM2mObject. + + LwM2M Object multiple. # noqa: E501 + + :param multiple: The multiple of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._multiple = multiple + + @property + def mandatory(self): + """Gets the mandatory of this LwM2mObject. # noqa: E501 + + LwM2M Object mandatory. # noqa: E501 + + :return: The mandatory of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._mandatory + + @mandatory.setter + def mandatory(self, mandatory): + """Sets the mandatory of this LwM2mObject. + + LwM2M Object mandatory. # noqa: E501 + + :param mandatory: The mandatory of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._mandatory = mandatory + + @property + def instances(self): + """Gets the instances of this LwM2mObject. # noqa: E501 + + LwM2M Object instances. # noqa: E501 + + :return: The instances of this LwM2mObject. # noqa: E501 + :rtype: list[LwM2mInstance] + """ + return self._instances + + @instances.setter + def instances(self, instances): + """Sets the instances of this LwM2mObject. + + LwM2M Object instances. # noqa: E501 + + :param instances: The instances of this LwM2mObject. # noqa: E501 + :type: list[LwM2mInstance] + """ + + self._instances = instances + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mObject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mObject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_resource_observe.py b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_resource_observe.py new file mode 100644 index 0000000..38c8293 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/lw_m2m_resource_observe.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mResourceObserve(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str', + 'observe': 'bool', + 'attribute': 'bool', + 'telemetry': 'bool', + 'key_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'observe': 'observe', + 'attribute': 'attribute', + 'telemetry': 'telemetry', + 'key_name': 'keyName' + } + + def __init__(self, id=None, name=None, observe=None, attribute=None, telemetry=None, key_name=None): # noqa: E501 + """LwM2mResourceObserve - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._observe = None + self._attribute = None + self._telemetry = None + self._key_name = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if observe is not None: + self.observe = observe + if attribute is not None: + self.attribute = attribute + if telemetry is not None: + self.telemetry = telemetry + if key_name is not None: + self.key_name = key_name + + @property + def id(self): + """Gets the id of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe id. # noqa: E501 + + :return: The id of this LwM2mResourceObserve. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mResourceObserve. + + LwM2M Resource Observe id. # noqa: E501 + + :param id: The id of this LwM2mResourceObserve. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def name(self): + """Gets the name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe name. # noqa: E501 + + :return: The name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mResourceObserve. + + LwM2M Resource Observe name. # noqa: E501 + + :param name: The name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def observe(self): + """Gets the observe of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe observe. # noqa: E501 + + :return: The observe of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this LwM2mResourceObserve. + + LwM2M Resource Observe observe. # noqa: E501 + + :param observe: The observe of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._observe = observe + + @property + def attribute(self): + """Gets the attribute of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe attribute. # noqa: E501 + + :return: The attribute of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this LwM2mResourceObserve. + + LwM2M Resource Observe attribute. # noqa: E501 + + :param attribute: The attribute of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._attribute = attribute + + @property + def telemetry(self): + """Gets the telemetry of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe telemetry. # noqa: E501 + + :return: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this LwM2mResourceObserve. + + LwM2M Resource Observe telemetry. # noqa: E501 + + :param telemetry: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._telemetry = telemetry + + @property + def key_name(self): + """Gets the key_name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe key name. # noqa: E501 + + :return: The key_name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this LwM2mResourceObserve. + + LwM2M Resource Observe key name. # noqa: E501 + + :param key_name: The key_name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._key_name = key_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mResourceObserve, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mResourceObserve): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/lwm2m_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/lwm2m_device_profile_transport_configuration.py new file mode 100644 index 0000000..b19d0fc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/lwm2m_device_profile_transport_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap': 'list[LwM2MBootstrapServerCredential]', + 'bootstrap_server_update_enable': 'bool', + 'client_lw_m2m_settings': 'OtherConfiguration', + 'observe_attr': 'TelemetryMappingConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'bootstrap': 'bootstrap', + 'bootstrap_server_update_enable': 'bootstrapServerUpdateEnable', + 'client_lw_m2m_settings': 'clientLwM2mSettings', + 'observe_attr': 'observeAttr' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, bootstrap=None, bootstrap_server_update_enable=None, client_lw_m2m_settings=None, observe_attr=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._bootstrap = None + self._bootstrap_server_update_enable = None + self._client_lw_m2m_settings = None + self._observe_attr = None + self.discriminator = None + if bootstrap is not None: + self.bootstrap = bootstrap + if bootstrap_server_update_enable is not None: + self.bootstrap_server_update_enable = bootstrap_server_update_enable + if client_lw_m2m_settings is not None: + self.client_lw_m2m_settings = client_lw_m2m_settings + if observe_attr is not None: + self.observe_attr = observe_attr + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def bootstrap(self): + """Gets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[LwM2MBootstrapServerCredential] + """ + return self._bootstrap + + @bootstrap.setter + def bootstrap(self, bootstrap): + """Sets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[LwM2MBootstrapServerCredential] + """ + + self._bootstrap = bootstrap + + @property + def bootstrap_server_update_enable(self): + """Gets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_update_enable + + @bootstrap_server_update_enable.setter + def bootstrap_server_update_enable(self, bootstrap_server_update_enable): + """Sets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap_server_update_enable: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_update_enable = bootstrap_server_update_enable + + @property + def client_lw_m2m_settings(self): + """Gets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: OtherConfiguration + """ + return self._client_lw_m2m_settings + + @client_lw_m2m_settings.setter + def client_lw_m2m_settings(self, client_lw_m2m_settings): + """Sets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. + + + :param client_lw_m2m_settings: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: OtherConfiguration + """ + + self._client_lw_m2m_settings = client_lw_m2m_settings + + @property + def observe_attr(self): + """Gets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TelemetryMappingConfiguration + """ + return self._observe_attr + + @observe_attr.setter + def observe_attr(self, observe_attr): + """Sets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. + + + :param observe_attr: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: TelemetryMappingConfiguration + """ + + self._observe_attr = observe_attr + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/lwm2m_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/lwm2m_device_transport_configuration.py new file mode 100644 index 0000000..8f2a8fc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/lwm2m_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this Lwm2mDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/mapping.py b/tb-rest-client/python/tb_rest_client/models/models_ce/mapping.py new file mode 100644 index 0000000..fd0ab51 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/mapping.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Mapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'columns': 'list[ColumnMapping]', + 'delimiter': 'str', + 'header': 'bool', + 'update': 'bool' + } + + attribute_map = { + 'columns': 'columns', + 'delimiter': 'delimiter', + 'header': 'header', + 'update': 'update' + } + + def __init__(self, columns=None, delimiter=None, header=None, update=None): # noqa: E501 + """Mapping - a model defined in Swagger""" # noqa: E501 + self._columns = None + self._delimiter = None + self._header = None + self._update = None + self.discriminator = None + if columns is not None: + self.columns = columns + if delimiter is not None: + self.delimiter = delimiter + if header is not None: + self.header = header + if update is not None: + self.update = update + + @property + def columns(self): + """Gets the columns of this Mapping. # noqa: E501 + + + :return: The columns of this Mapping. # noqa: E501 + :rtype: list[ColumnMapping] + """ + return self._columns + + @columns.setter + def columns(self, columns): + """Sets the columns of this Mapping. + + + :param columns: The columns of this Mapping. # noqa: E501 + :type: list[ColumnMapping] + """ + + self._columns = columns + + @property + def delimiter(self): + """Gets the delimiter of this Mapping. # noqa: E501 + + + :return: The delimiter of this Mapping. # noqa: E501 + :rtype: str + """ + return self._delimiter + + @delimiter.setter + def delimiter(self, delimiter): + """Sets the delimiter of this Mapping. + + + :param delimiter: The delimiter of this Mapping. # noqa: E501 + :type: str + """ + + self._delimiter = delimiter + + @property + def header(self): + """Gets the header of this Mapping. # noqa: E501 + + + :return: The header of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._header + + @header.setter + def header(self, header): + """Sets the header of this Mapping. + + + :param header: The header of this Mapping. # noqa: E501 + :type: bool + """ + + self._header = header + + @property + def update(self): + """Gets the update of this Mapping. # noqa: E501 + + + :return: The update of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._update + + @update.setter + def update(self, update): + """Sets the update of this Mapping. + + + :param update: The update of this Mapping. # noqa: E501 + :type: bool + """ + + self._update = update + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Mapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Mapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/mqtt_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/mqtt_device_profile_transport_configuration.py new file mode 100644 index 0000000..7efaa9e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/mqtt_device_profile_transport_configuration.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MqttDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_subscribe_topic': 'str', + 'device_attributes_topic': 'str', + 'device_telemetry_topic': 'str', + 'send_ack_on_validation_exception': 'bool', + 'sparkplug': 'bool', + 'sparkplug_attributes_metric_names': 'list[str]', + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + + attribute_map = { + 'device_attributes_subscribe_topic': 'deviceAttributesSubscribeTopic', + 'device_attributes_topic': 'deviceAttributesTopic', + 'device_telemetry_topic': 'deviceTelemetryTopic', + 'send_ack_on_validation_exception': 'sendAckOnValidationException', + 'sparkplug': 'sparkplug', + 'sparkplug_attributes_metric_names': 'sparkplugAttributesMetricNames', + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + + def __init__(self, device_attributes_subscribe_topic=None, device_attributes_topic=None, device_telemetry_topic=None, send_ack_on_validation_exception=None, sparkplug=None, sparkplug_attributes_metric_names=None, transport_payload_type_configuration=None): # noqa: E501 + """MqttDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_subscribe_topic = None + self._device_attributes_topic = None + self._device_telemetry_topic = None + self._send_ack_on_validation_exception = None + self._sparkplug = None + self._sparkplug_attributes_metric_names = None + self._transport_payload_type_configuration = None + self.discriminator = None + if device_attributes_subscribe_topic is not None: + self.device_attributes_subscribe_topic = device_attributes_subscribe_topic + if device_attributes_topic is not None: + self.device_attributes_topic = device_attributes_topic + if device_telemetry_topic is not None: + self.device_telemetry_topic = device_telemetry_topic + if send_ack_on_validation_exception is not None: + self.send_ack_on_validation_exception = send_ack_on_validation_exception + if sparkplug is not None: + self.sparkplug = sparkplug + if sparkplug_attributes_metric_names is not None: + self.sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + + @property + def device_attributes_subscribe_topic(self): + """Gets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_subscribe_topic + + @device_attributes_subscribe_topic.setter + def device_attributes_subscribe_topic(self, device_attributes_subscribe_topic): + """Sets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_subscribe_topic: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_subscribe_topic = device_attributes_subscribe_topic + + @property + def device_attributes_topic(self): + """Gets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_topic + + @device_attributes_topic.setter + def device_attributes_topic(self, device_attributes_topic): + """Sets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_topic: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_topic = device_attributes_topic + + @property + def device_telemetry_topic(self): + """Gets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_topic + + @device_telemetry_topic.setter + def device_telemetry_topic(self, device_telemetry_topic): + """Sets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_telemetry_topic: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_topic = device_telemetry_topic + + @property + def send_ack_on_validation_exception(self): + """Gets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._send_ack_on_validation_exception + + @send_ack_on_validation_exception.setter + def send_ack_on_validation_exception(self, send_ack_on_validation_exception): + """Sets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. + + + :param send_ack_on_validation_exception: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._send_ack_on_validation_exception = send_ack_on_validation_exception + + @property + def sparkplug(self): + """Gets the sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._sparkplug + + @sparkplug.setter + def sparkplug(self, sparkplug): + """Sets the sparkplug of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._sparkplug = sparkplug + + @property + def sparkplug_attributes_metric_names(self): + """Gets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._sparkplug_attributes_metric_names + + @sparkplug_attributes_metric_names.setter + def sparkplug_attributes_metric_names(self, sparkplug_attributes_metric_names): + """Sets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug_attributes_metric_names: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[str] + """ + + self._sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/mqtt_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/mqtt_device_transport_configuration.py new file mode 100644 index 0000000..f324e62 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/mqtt_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class MqttDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """MqttDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/new_platform_version_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/new_platform_version_notification_rule_trigger_config.py new file mode 100644 index 0000000..1b6c752 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/new_platform_version_notification_rule_trigger_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NewPlatformVersionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NewPlatformVersionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NewPlatformVersionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NewPlatformVersionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/no_sec_lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_ce/no_sec_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..7816c3f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/no_sec_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NoSecLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """NoSecLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this NoSecLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this NoSecLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this NoSecLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this NoSecLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this NoSecLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this NoSecLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NoSecLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NoSecLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/node_connection_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/node_connection_info.py new file mode 100644 index 0000000..20abae0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/node_connection_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NodeConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'to_index': 'int', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'to_index': 'toIndex', + 'type': 'type' + } + + def __init__(self, from_index=None, to_index=None, type=None): # noqa: E501 + """NodeConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._to_index = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.to_index = to_index + self.type = type + + @property + def from_index(self): + """Gets the from_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def to_index(self): + """Gets the to_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :return: The to_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._to_index + + @to_index.setter + def to_index(self, to_index): + """Sets the to_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :param to_index: The to_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if to_index is None: + raise ValueError("Invalid value for `to_index`, must not be `None`") # noqa: E501 + + self._to_index = to_index + + @property + def type(self): + """Gets the type of this NodeConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this NodeConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this NodeConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this NodeConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NodeConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NodeConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification.py new file mode 100644 index 0000000..b078c29 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification.py @@ -0,0 +1,370 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Notification(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'created_time': 'int', + 'id': 'NotificationId', + 'info': 'NotificationInfo', + 'recipient_id': 'UserId', + 'request_id': 'NotificationRequestId', + 'status': 'str', + 'subject': 'str', + 'text': 'str', + 'type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'recipient_id': 'recipientId', + 'request_id': 'requestId', + 'status': 'status', + 'subject': 'subject', + 'text': 'text', + 'type': 'type' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, recipient_id=None, request_id=None, status=None, subject=None, text=None, type=None): # noqa: E501 + """Notification - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._recipient_id = None + self._request_id = None + self._status = None + self._subject = None + self._text = None + self._type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if recipient_id is not None: + self.recipient_id = recipient_id + if request_id is not None: + self.request_id = request_id + if status is not None: + self.status = status + if subject is not None: + self.subject = subject + if text is not None: + self.text = text + if type is not None: + self.type = type + + @property + def additional_config(self): + """Gets the additional_config of this Notification. # noqa: E501 + + + :return: The additional_config of this Notification. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this Notification. + + + :param additional_config: The additional_config of this Notification. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this Notification. # noqa: E501 + + + :return: The created_time of this Notification. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Notification. + + + :param created_time: The created_time of this Notification. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Notification. # noqa: E501 + + + :return: The id of this Notification. # noqa: E501 + :rtype: NotificationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Notification. + + + :param id: The id of this Notification. # noqa: E501 + :type: NotificationId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this Notification. # noqa: E501 + + + :return: The info of this Notification. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this Notification. + + + :param info: The info of this Notification. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def recipient_id(self): + """Gets the recipient_id of this Notification. # noqa: E501 + + + :return: The recipient_id of this Notification. # noqa: E501 + :rtype: UserId + """ + return self._recipient_id + + @recipient_id.setter + def recipient_id(self, recipient_id): + """Sets the recipient_id of this Notification. + + + :param recipient_id: The recipient_id of this Notification. # noqa: E501 + :type: UserId + """ + + self._recipient_id = recipient_id + + @property + def request_id(self): + """Gets the request_id of this Notification. # noqa: E501 + + + :return: The request_id of this Notification. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._request_id + + @request_id.setter + def request_id(self, request_id): + """Sets the request_id of this Notification. + + + :param request_id: The request_id of this Notification. # noqa: E501 + :type: NotificationRequestId + """ + + self._request_id = request_id + + @property + def status(self): + """Gets the status of this Notification. # noqa: E501 + + + :return: The status of this Notification. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Notification. + + + :param status: The status of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["READ", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def subject(self): + """Gets the subject of this Notification. # noqa: E501 + + + :return: The subject of this Notification. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this Notification. + + + :param subject: The subject of this Notification. # noqa: E501 + :type: str + """ + + self._subject = subject + + @property + def text(self): + """Gets the text of this Notification. # noqa: E501 + + + :return: The text of this Notification. # noqa: E501 + :rtype: str + """ + return self._text + + @text.setter + def text(self, text): + """Sets the text of this Notification. + + + :param text: The text of this Notification. # noqa: E501 + :type: str + """ + + self._text = text + + @property + def type(self): + """Gets the type of this Notification. # noqa: E501 + + + :return: The type of this Notification. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Notification. + + + :param type: The type of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "GENERAL", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT", "RULE_NODE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Notification, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Notification): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_delivery_method_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_delivery_method_config.py new file mode 100644 index 0000000..5703947 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_delivery_method_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """NotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_id.py new file mode 100644 index 0000000..a2e68cd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationId. # noqa: E501 + + + :return: The entity_type of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationId. + + + :param entity_type: The entity_type of this NotificationId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_info.py new file mode 100644 index 0000000..5e392ef --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_info.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'state_entity_id': 'EntityId' + } + + attribute_map = { + 'state_entity_id': 'stateEntityId' + } + + def __init__(self, state_entity_id=None): # noqa: E501 + """NotificationInfo - a model defined in Swagger""" # noqa: E501 + self._state_entity_id = None + self.discriminator = None + if state_entity_id is not None: + self.state_entity_id = state_entity_id + + @property + def state_entity_id(self): + """Gets the state_entity_id of this NotificationInfo. # noqa: E501 + + + :return: The state_entity_id of this NotificationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._state_entity_id + + @state_entity_id.setter + def state_entity_id(self, state_entity_id): + """Sets the state_entity_id of this NotificationInfo. + + + :param state_entity_id: The state_entity_id of this NotificationInfo. # noqa: E501 + :type: EntityId + """ + + self._state_entity_id = state_entity_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request.py new file mode 100644 index 0000000..72eef9b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request.py @@ -0,0 +1,416 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRequestConfig', + 'created_time': 'int', + 'id': 'NotificationRequestId', + 'info': 'NotificationInfo', + 'originator_entity_id': 'EntityId', + 'rule_id': 'NotificationRuleId', + 'stats': 'NotificationRequestStats', + 'status': 'str', + 'targets': 'list[str]', + 'template': 'NotificationTemplate', + 'template_id': 'NotificationTemplateId', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'originator_entity_id': 'originatorEntityId', + 'rule_id': 'ruleId', + 'stats': 'stats', + 'status': 'status', + 'targets': 'targets', + 'template': 'template', + 'template_id': 'templateId', + 'tenant_id': 'tenantId' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, originator_entity_id=None, rule_id=None, stats=None, status=None, targets=None, template=None, template_id=None, tenant_id=None): # noqa: E501 + """NotificationRequest - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._originator_entity_id = None + self._rule_id = None + self._stats = None + self._status = None + self._targets = None + self._template = None + self._template_id = None + self._tenant_id = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if originator_entity_id is not None: + self.originator_entity_id = originator_entity_id + if rule_id is not None: + self.rule_id = rule_id + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if targets is not None: + self.targets = targets + if template is not None: + self.template = template + if template_id is not None: + self.template_id = template_id + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRequest. # noqa: E501 + + + :return: The additional_config of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRequest. + + + :param additional_config: The additional_config of this NotificationRequest. # noqa: E501 + :type: NotificationRequestConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRequest. # noqa: E501 + + + :return: The created_time of this NotificationRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRequest. + + + :param created_time: The created_time of this NotificationRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationRequest. # noqa: E501 + + + :return: The id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequest. + + + :param id: The id of this NotificationRequest. # noqa: E501 + :type: NotificationRequestId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this NotificationRequest. # noqa: E501 + + + :return: The info of this NotificationRequest. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this NotificationRequest. + + + :param info: The info of this NotificationRequest. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def originator_entity_id(self): + """Gets the originator_entity_id of this NotificationRequest. # noqa: E501 + + + :return: The originator_entity_id of this NotificationRequest. # noqa: E501 + :rtype: EntityId + """ + return self._originator_entity_id + + @originator_entity_id.setter + def originator_entity_id(self, originator_entity_id): + """Sets the originator_entity_id of this NotificationRequest. + + + :param originator_entity_id: The originator_entity_id of this NotificationRequest. # noqa: E501 + :type: EntityId + """ + + self._originator_entity_id = originator_entity_id + + @property + def rule_id(self): + """Gets the rule_id of this NotificationRequest. # noqa: E501 + + + :return: The rule_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._rule_id + + @rule_id.setter + def rule_id(self, rule_id): + """Sets the rule_id of this NotificationRequest. + + + :param rule_id: The rule_id of this NotificationRequest. # noqa: E501 + :type: NotificationRuleId + """ + + self._rule_id = rule_id + + @property + def stats(self): + """Gets the stats of this NotificationRequest. # noqa: E501 + + + :return: The stats of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestStats + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this NotificationRequest. + + + :param stats: The stats of this NotificationRequest. # noqa: E501 + :type: NotificationRequestStats + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this NotificationRequest. # noqa: E501 + + + :return: The status of this NotificationRequest. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this NotificationRequest. + + + :param status: The status of this NotificationRequest. # noqa: E501 + :type: str + """ + allowed_values = ["PROCESSING", "SCHEDULED", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def targets(self): + """Gets the targets of this NotificationRequest. # noqa: E501 + + + :return: The targets of this NotificationRequest. # noqa: E501 + :rtype: list[str] + """ + return self._targets + + @targets.setter + def targets(self, targets): + """Sets the targets of this NotificationRequest. + + + :param targets: The targets of this NotificationRequest. # noqa: E501 + :type: list[str] + """ + + self._targets = targets + + @property + def template(self): + """Gets the template of this NotificationRequest. # noqa: E501 + + + :return: The template of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplate + """ + return self._template + + @template.setter + def template(self, template): + """Sets the template of this NotificationRequest. + + + :param template: The template of this NotificationRequest. # noqa: E501 + :type: NotificationTemplate + """ + + self._template = template + + @property + def template_id(self): + """Gets the template_id of this NotificationRequest. # noqa: E501 + + + :return: The template_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRequest. + + + :param template_id: The template_id of this NotificationRequest. # noqa: E501 + :type: NotificationTemplateId + """ + + self._template_id = template_id + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRequest. # noqa: E501 + + + :return: The tenant_id of this NotificationRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRequest. + + + :param tenant_id: The tenant_id of this NotificationRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_config.py new file mode 100644 index 0000000..ba59d4f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sending_delay_in_sec': 'int' + } + + attribute_map = { + 'sending_delay_in_sec': 'sendingDelayInSec' + } + + def __init__(self, sending_delay_in_sec=None): # noqa: E501 + """NotificationRequestConfig - a model defined in Swagger""" # noqa: E501 + self._sending_delay_in_sec = None + self.discriminator = None + if sending_delay_in_sec is not None: + self.sending_delay_in_sec = sending_delay_in_sec + + @property + def sending_delay_in_sec(self): + """Gets the sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + + + :return: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :rtype: int + """ + return self._sending_delay_in_sec + + @sending_delay_in_sec.setter + def sending_delay_in_sec(self, sending_delay_in_sec): + """Sets the sending_delay_in_sec of this NotificationRequestConfig. + + + :param sending_delay_in_sec: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :type: int + """ + + self._sending_delay_in_sec = sending_delay_in_sec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_id.py new file mode 100644 index 0000000..213692f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRequestId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRequestId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequestId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRequestId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRequestId. # noqa: E501 + + + :return: The entity_type of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRequestId. + + + :param entity_type: The entity_type of this NotificationRequestId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_info.py new file mode 100644 index 0000000..cf95b5f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_info.py @@ -0,0 +1,475 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRequestConfig', + 'created_time': 'int', + 'delivery_methods': 'list[str]', + 'id': 'NotificationRequestId', + 'info': 'NotificationInfo', + 'originator_entity_id': 'EntityId', + 'rule_id': 'NotificationRuleId', + 'stats': 'NotificationRequestStats', + 'status': 'str', + 'targets': 'list[str]', + 'template': 'NotificationTemplate', + 'template_id': 'NotificationTemplateId', + 'template_name': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'delivery_methods': 'deliveryMethods', + 'id': 'id', + 'info': 'info', + 'originator_entity_id': 'originatorEntityId', + 'rule_id': 'ruleId', + 'stats': 'stats', + 'status': 'status', + 'targets': 'targets', + 'template': 'template', + 'template_id': 'templateId', + 'template_name': 'templateName', + 'tenant_id': 'tenantId' + } + + def __init__(self, additional_config=None, created_time=None, delivery_methods=None, id=None, info=None, originator_entity_id=None, rule_id=None, stats=None, status=None, targets=None, template=None, template_id=None, template_name=None, tenant_id=None): # noqa: E501 + """NotificationRequestInfo - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._delivery_methods = None + self._id = None + self._info = None + self._originator_entity_id = None + self._rule_id = None + self._stats = None + self._status = None + self._targets = None + self._template = None + self._template_id = None + self._template_name = None + self._tenant_id = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if delivery_methods is not None: + self.delivery_methods = delivery_methods + if id is not None: + self.id = id + if info is not None: + self.info = info + if originator_entity_id is not None: + self.originator_entity_id = originator_entity_id + if rule_id is not None: + self.rule_id = rule_id + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if targets is not None: + self.targets = targets + if template is not None: + self.template = template + if template_id is not None: + self.template_id = template_id + if template_name is not None: + self.template_name = template_name + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRequestInfo. # noqa: E501 + + + :return: The additional_config of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRequestConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRequestInfo. + + + :param additional_config: The additional_config of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRequestConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRequestInfo. # noqa: E501 + + + :return: The created_time of this NotificationRequestInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRequestInfo. + + + :param created_time: The created_time of this NotificationRequestInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def delivery_methods(self): + """Gets the delivery_methods of this NotificationRequestInfo. # noqa: E501 + + + :return: The delivery_methods of this NotificationRequestInfo. # noqa: E501 + :rtype: list[str] + """ + return self._delivery_methods + + @delivery_methods.setter + def delivery_methods(self, delivery_methods): + """Sets the delivery_methods of this NotificationRequestInfo. + + + :param delivery_methods: The delivery_methods of this NotificationRequestInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["EMAIL", "SLACK", "SMS", "WEB"] # noqa: E501 + if not set(delivery_methods).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `delivery_methods` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(delivery_methods) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._delivery_methods = delivery_methods + + @property + def id(self): + """Gets the id of this NotificationRequestInfo. # noqa: E501 + + + :return: The id of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequestInfo. + + + :param id: The id of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRequestId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this NotificationRequestInfo. # noqa: E501 + + + :return: The info of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this NotificationRequestInfo. + + + :param info: The info of this NotificationRequestInfo. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def originator_entity_id(self): + """Gets the originator_entity_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The originator_entity_id of this NotificationRequestInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator_entity_id + + @originator_entity_id.setter + def originator_entity_id(self, originator_entity_id): + """Sets the originator_entity_id of this NotificationRequestInfo. + + + :param originator_entity_id: The originator_entity_id of this NotificationRequestInfo. # noqa: E501 + :type: EntityId + """ + + self._originator_entity_id = originator_entity_id + + @property + def rule_id(self): + """Gets the rule_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The rule_id of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._rule_id + + @rule_id.setter + def rule_id(self, rule_id): + """Sets the rule_id of this NotificationRequestInfo. + + + :param rule_id: The rule_id of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRuleId + """ + + self._rule_id = rule_id + + @property + def stats(self): + """Gets the stats of this NotificationRequestInfo. # noqa: E501 + + + :return: The stats of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationRequestStats + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this NotificationRequestInfo. + + + :param stats: The stats of this NotificationRequestInfo. # noqa: E501 + :type: NotificationRequestStats + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this NotificationRequestInfo. # noqa: E501 + + + :return: The status of this NotificationRequestInfo. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this NotificationRequestInfo. + + + :param status: The status of this NotificationRequestInfo. # noqa: E501 + :type: str + """ + allowed_values = ["PROCESSING", "SCHEDULED", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def targets(self): + """Gets the targets of this NotificationRequestInfo. # noqa: E501 + + + :return: The targets of this NotificationRequestInfo. # noqa: E501 + :rtype: list[str] + """ + return self._targets + + @targets.setter + def targets(self, targets): + """Sets the targets of this NotificationRequestInfo. + + + :param targets: The targets of this NotificationRequestInfo. # noqa: E501 + :type: list[str] + """ + + self._targets = targets + + @property + def template(self): + """Gets the template of this NotificationRequestInfo. # noqa: E501 + + + :return: The template of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationTemplate + """ + return self._template + + @template.setter + def template(self, template): + """Sets the template of this NotificationRequestInfo. + + + :param template: The template of this NotificationRequestInfo. # noqa: E501 + :type: NotificationTemplate + """ + + self._template = template + + @property + def template_id(self): + """Gets the template_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The template_id of this NotificationRequestInfo. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRequestInfo. + + + :param template_id: The template_id of this NotificationRequestInfo. # noqa: E501 + :type: NotificationTemplateId + """ + + self._template_id = template_id + + @property + def template_name(self): + """Gets the template_name of this NotificationRequestInfo. # noqa: E501 + + + :return: The template_name of this NotificationRequestInfo. # noqa: E501 + :rtype: str + """ + return self._template_name + + @template_name.setter + def template_name(self, template_name): + """Sets the template_name of this NotificationRequestInfo. + + + :param template_name: The template_name of this NotificationRequestInfo. # noqa: E501 + :type: str + """ + + self._template_name = template_name + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRequestInfo. # noqa: E501 + + + :return: The tenant_id of this NotificationRequestInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRequestInfo. + + + :param tenant_id: The tenant_id of this NotificationRequestInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_preview.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_preview.py new file mode 100644 index 0000000..9452d66 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_preview.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestPreview(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'processed_templates': 'dict(str, DeliveryMethodNotificationTemplate)', + 'recipients_count_by_target': 'dict(str, int)', + 'recipients_preview': 'list[str]', + 'total_recipients_count': 'int' + } + + attribute_map = { + 'processed_templates': 'processedTemplates', + 'recipients_count_by_target': 'recipientsCountByTarget', + 'recipients_preview': 'recipientsPreview', + 'total_recipients_count': 'totalRecipientsCount' + } + + def __init__(self, processed_templates=None, recipients_count_by_target=None, recipients_preview=None, total_recipients_count=None): # noqa: E501 + """NotificationRequestPreview - a model defined in Swagger""" # noqa: E501 + self._processed_templates = None + self._recipients_count_by_target = None + self._recipients_preview = None + self._total_recipients_count = None + self.discriminator = None + if processed_templates is not None: + self.processed_templates = processed_templates + if recipients_count_by_target is not None: + self.recipients_count_by_target = recipients_count_by_target + if recipients_preview is not None: + self.recipients_preview = recipients_preview + if total_recipients_count is not None: + self.total_recipients_count = total_recipients_count + + @property + def processed_templates(self): + """Gets the processed_templates of this NotificationRequestPreview. # noqa: E501 + + + :return: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._processed_templates + + @processed_templates.setter + def processed_templates(self, processed_templates): + """Sets the processed_templates of this NotificationRequestPreview. + + + :param processed_templates: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._processed_templates = processed_templates + + @property + def recipients_count_by_target(self): + """Gets the recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, int) + """ + return self._recipients_count_by_target + + @recipients_count_by_target.setter + def recipients_count_by_target(self, recipients_count_by_target): + """Sets the recipients_count_by_target of this NotificationRequestPreview. + + + :param recipients_count_by_target: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, int) + """ + + self._recipients_count_by_target = recipients_count_by_target + + @property + def recipients_preview(self): + """Gets the recipients_preview of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :rtype: list[str] + """ + return self._recipients_preview + + @recipients_preview.setter + def recipients_preview(self, recipients_preview): + """Sets the recipients_preview of this NotificationRequestPreview. + + + :param recipients_preview: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :type: list[str] + """ + + self._recipients_preview = recipients_preview + + @property + def total_recipients_count(self): + """Gets the total_recipients_count of this NotificationRequestPreview. # noqa: E501 + + + :return: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :rtype: int + """ + return self._total_recipients_count + + @total_recipients_count.setter + def total_recipients_count(self, total_recipients_count): + """Sets the total_recipients_count of this NotificationRequestPreview. + + + :param total_recipients_count: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :type: int + """ + + self._total_recipients_count = total_recipients_count + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestPreview, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestPreview): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_stats.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_stats.py new file mode 100644 index 0000000..9a03edf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_request_stats.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestStats(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'errors': 'dict(str, object)', + 'sent': 'dict(str, AtomicInteger)' + } + + attribute_map = { + 'error': 'error', + 'errors': 'errors', + 'sent': 'sent' + } + + def __init__(self, error=None, errors=None, sent=None): # noqa: E501 + """NotificationRequestStats - a model defined in Swagger""" # noqa: E501 + self._error = None + self._errors = None + self._sent = None + self.discriminator = None + if error is not None: + self.error = error + if errors is not None: + self.errors = errors + if sent is not None: + self.sent = sent + + @property + def error(self): + """Gets the error of this NotificationRequestStats. # noqa: E501 + + + :return: The error of this NotificationRequestStats. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this NotificationRequestStats. + + + :param error: The error of this NotificationRequestStats. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def errors(self): + """Gets the errors of this NotificationRequestStats. # noqa: E501 + + + :return: The errors of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, object) + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this NotificationRequestStats. + + + :param errors: The errors of this NotificationRequestStats. # noqa: E501 + :type: dict(str, object) + """ + + self._errors = errors + + @property + def sent(self): + """Gets the sent of this NotificationRequestStats. # noqa: E501 + + + :return: The sent of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, AtomicInteger) + """ + return self._sent + + @sent.setter + def sent(self, sent): + """Sets the sent of this NotificationRequestStats. + + + :param sent: The sent of this NotificationRequestStats. # noqa: E501 + :type: dict(str, AtomicInteger) + """ + + self._sent = sent + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestStats, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestStats): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule.py new file mode 100644 index 0000000..b91b456 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule.py @@ -0,0 +1,343 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRuleConfig', + 'created_time': 'int', + 'id': 'NotificationRuleId', + 'name': 'str', + 'recipients_config': 'NotificationRuleRecipientsConfig', + 'template_id': 'NotificationTemplateId', + 'tenant_id': 'TenantId', + 'trigger_config': 'NotificationRuleTriggerConfig', + 'trigger_type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'recipients_config': 'recipientsConfig', + 'template_id': 'templateId', + 'tenant_id': 'tenantId', + 'trigger_config': 'triggerConfig', + 'trigger_type': 'triggerType' + } + + def __init__(self, additional_config=None, created_time=None, id=None, name=None, recipients_config=None, template_id=None, tenant_id=None, trigger_config=None, trigger_type=None): # noqa: E501 + """NotificationRule - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._name = None + self._recipients_config = None + self._template_id = None + self._tenant_id = None + self._trigger_config = None + self._trigger_type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + self.name = name + self.recipients_config = recipients_config + self.template_id = template_id + if tenant_id is not None: + self.tenant_id = tenant_id + self.trigger_config = trigger_config + self.trigger_type = trigger_type + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRule. # noqa: E501 + + + :return: The additional_config of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRule. + + + :param additional_config: The additional_config of this NotificationRule. # noqa: E501 + :type: NotificationRuleConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRule. # noqa: E501 + + + :return: The created_time of this NotificationRule. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRule. + + + :param created_time: The created_time of this NotificationRule. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationRule. # noqa: E501 + + + :return: The id of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRule. + + + :param id: The id of this NotificationRule. # noqa: E501 + :type: NotificationRuleId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationRule. # noqa: E501 + + + :return: The name of this NotificationRule. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationRule. + + + :param name: The name of this NotificationRule. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def recipients_config(self): + """Gets the recipients_config of this NotificationRule. # noqa: E501 + + + :return: The recipients_config of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleRecipientsConfig + """ + return self._recipients_config + + @recipients_config.setter + def recipients_config(self, recipients_config): + """Sets the recipients_config of this NotificationRule. + + + :param recipients_config: The recipients_config of this NotificationRule. # noqa: E501 + :type: NotificationRuleRecipientsConfig + """ + if recipients_config is None: + raise ValueError("Invalid value for `recipients_config`, must not be `None`") # noqa: E501 + + self._recipients_config = recipients_config + + @property + def template_id(self): + """Gets the template_id of this NotificationRule. # noqa: E501 + + + :return: The template_id of this NotificationRule. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRule. + + + :param template_id: The template_id of this NotificationRule. # noqa: E501 + :type: NotificationTemplateId + """ + if template_id is None: + raise ValueError("Invalid value for `template_id`, must not be `None`") # noqa: E501 + + self._template_id = template_id + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRule. # noqa: E501 + + + :return: The tenant_id of this NotificationRule. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRule. + + + :param tenant_id: The tenant_id of this NotificationRule. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def trigger_config(self): + """Gets the trigger_config of this NotificationRule. # noqa: E501 + + + :return: The trigger_config of this NotificationRule. # noqa: E501 + :rtype: NotificationRuleTriggerConfig + """ + return self._trigger_config + + @trigger_config.setter + def trigger_config(self, trigger_config): + """Sets the trigger_config of this NotificationRule. + + + :param trigger_config: The trigger_config of this NotificationRule. # noqa: E501 + :type: NotificationRuleTriggerConfig + """ + if trigger_config is None: + raise ValueError("Invalid value for `trigger_config`, must not be `None`") # noqa: E501 + + self._trigger_config = trigger_config + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRule. # noqa: E501 + + + :return: The trigger_type of this NotificationRule. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRule. + + + :param trigger_type: The trigger_type of this NotificationRule. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_config.py new file mode 100644 index 0000000..d7082f0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str' + } + + attribute_map = { + 'description': 'description' + } + + def __init__(self, description=None): # noqa: E501 + """NotificationRuleConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self.discriminator = None + if description is not None: + self.description = description + + @property + def description(self): + """Gets the description of this NotificationRuleConfig. # noqa: E501 + + + :return: The description of this NotificationRuleConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this NotificationRuleConfig. + + + :param description: The description of this NotificationRuleConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_id.py new file mode 100644 index 0000000..0612cd7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRuleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRuleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRuleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRuleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRuleId. # noqa: E501 + + + :return: The entity_type of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRuleId. + + + :param entity_type: The entity_type of this NotificationRuleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_info.py new file mode 100644 index 0000000..19a5141 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_info.py @@ -0,0 +1,402 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRuleConfig', + 'created_time': 'int', + 'delivery_methods': 'list[str]', + 'id': 'NotificationRuleId', + 'name': 'str', + 'recipients_config': 'NotificationRuleRecipientsConfig', + 'template_id': 'NotificationTemplateId', + 'template_name': 'str', + 'tenant_id': 'TenantId', + 'trigger_config': 'NotificationRuleTriggerConfig', + 'trigger_type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'delivery_methods': 'deliveryMethods', + 'id': 'id', + 'name': 'name', + 'recipients_config': 'recipientsConfig', + 'template_id': 'templateId', + 'template_name': 'templateName', + 'tenant_id': 'tenantId', + 'trigger_config': 'triggerConfig', + 'trigger_type': 'triggerType' + } + + def __init__(self, additional_config=None, created_time=None, delivery_methods=None, id=None, name=None, recipients_config=None, template_id=None, template_name=None, tenant_id=None, trigger_config=None, trigger_type=None): # noqa: E501 + """NotificationRuleInfo - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._delivery_methods = None + self._id = None + self._name = None + self._recipients_config = None + self._template_id = None + self._template_name = None + self._tenant_id = None + self._trigger_config = None + self._trigger_type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if delivery_methods is not None: + self.delivery_methods = delivery_methods + if id is not None: + self.id = id + self.name = name + self.recipients_config = recipients_config + self.template_id = template_id + if template_name is not None: + self.template_name = template_name + if tenant_id is not None: + self.tenant_id = tenant_id + self.trigger_config = trigger_config + self.trigger_type = trigger_type + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRuleInfo. # noqa: E501 + + + :return: The additional_config of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRuleInfo. + + + :param additional_config: The additional_config of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRuleInfo. # noqa: E501 + + + :return: The created_time of this NotificationRuleInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRuleInfo. + + + :param created_time: The created_time of this NotificationRuleInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def delivery_methods(self): + """Gets the delivery_methods of this NotificationRuleInfo. # noqa: E501 + + + :return: The delivery_methods of this NotificationRuleInfo. # noqa: E501 + :rtype: list[str] + """ + return self._delivery_methods + + @delivery_methods.setter + def delivery_methods(self, delivery_methods): + """Sets the delivery_methods of this NotificationRuleInfo. + + + :param delivery_methods: The delivery_methods of this NotificationRuleInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["EMAIL", "SLACK", "SMS", "WEB"] # noqa: E501 + if not set(delivery_methods).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `delivery_methods` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(delivery_methods) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._delivery_methods = delivery_methods + + @property + def id(self): + """Gets the id of this NotificationRuleInfo. # noqa: E501 + + + :return: The id of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRuleInfo. + + + :param id: The id of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationRuleInfo. # noqa: E501 + + + :return: The name of this NotificationRuleInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationRuleInfo. + + + :param name: The name of this NotificationRuleInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def recipients_config(self): + """Gets the recipients_config of this NotificationRuleInfo. # noqa: E501 + + + :return: The recipients_config of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleRecipientsConfig + """ + return self._recipients_config + + @recipients_config.setter + def recipients_config(self, recipients_config): + """Sets the recipients_config of this NotificationRuleInfo. + + + :param recipients_config: The recipients_config of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleRecipientsConfig + """ + if recipients_config is None: + raise ValueError("Invalid value for `recipients_config`, must not be `None`") # noqa: E501 + + self._recipients_config = recipients_config + + @property + def template_id(self): + """Gets the template_id of this NotificationRuleInfo. # noqa: E501 + + + :return: The template_id of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRuleInfo. + + + :param template_id: The template_id of this NotificationRuleInfo. # noqa: E501 + :type: NotificationTemplateId + """ + if template_id is None: + raise ValueError("Invalid value for `template_id`, must not be `None`") # noqa: E501 + + self._template_id = template_id + + @property + def template_name(self): + """Gets the template_name of this NotificationRuleInfo. # noqa: E501 + + + :return: The template_name of this NotificationRuleInfo. # noqa: E501 + :rtype: str + """ + return self._template_name + + @template_name.setter + def template_name(self, template_name): + """Sets the template_name of this NotificationRuleInfo. + + + :param template_name: The template_name of this NotificationRuleInfo. # noqa: E501 + :type: str + """ + + self._template_name = template_name + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRuleInfo. # noqa: E501 + + + :return: The tenant_id of this NotificationRuleInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRuleInfo. + + + :param tenant_id: The tenant_id of this NotificationRuleInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def trigger_config(self): + """Gets the trigger_config of this NotificationRuleInfo. # noqa: E501 + + + :return: The trigger_config of this NotificationRuleInfo. # noqa: E501 + :rtype: NotificationRuleTriggerConfig + """ + return self._trigger_config + + @trigger_config.setter + def trigger_config(self, trigger_config): + """Sets the trigger_config of this NotificationRuleInfo. + + + :param trigger_config: The trigger_config of this NotificationRuleInfo. # noqa: E501 + :type: NotificationRuleTriggerConfig + """ + if trigger_config is None: + raise ValueError("Invalid value for `trigger_config`, must not be `None`") # noqa: E501 + + self._trigger_config = trigger_config + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleInfo. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleInfo. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleInfo. + + + :param trigger_type: The trigger_type of this NotificationRuleInfo. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_recipients_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_recipients_config.py new file mode 100644 index 0000000..db23aa8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_recipients_config.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_trigger_config.py new file mode 100644 index 0000000..72b6683 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_rule_trigger_config.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str', + 'alarm_severities': 'list[str]', + 'clear_rule': 'bool', + 'notify_on': 'list[str]', + 'alarm_types': 'list[str]' + } + + attribute_map = { + 'trigger_type': 'triggerType', + 'clear_rule': 'clearRule', + 'notify_on': 'notifyOn', + 'alarm_types': 'alarmTypes', + 'alarm_severities': 'alarmSeverities' + } + + def __init__(self, trigger_type=None, clear_rule=None, notify_on=None, alarm_types=None, alarm_severities=None): # noqa: E501 + """NotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self._clear_rule = None + self._notify_on = None + self._alarm_types = None + self._alarm_severities = None + self.clear_rule = clear_rule + self.notify_on = notify_on + self.alarm_types = alarm_types + self.alarm_severities = alarm_severities + self.discriminator = None + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this NotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + @property + def clear_rule(self): + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + self._clear_rule = clear_rule + + @property + def notify_on(self): + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + self._notify_on = notify_on + + @property + def alarm_types(self): + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + self._alarm_types = alarm_types + + @property + def alarm_severities(self): + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + self._alarm_severities = alarm_severities + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_settings.py new file mode 100644 index 0000000..6aa17c4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_settings.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'delivery_methods_configs': 'dict(str, NotificationDeliveryMethodConfig)' + } + + attribute_map = { + 'delivery_methods_configs': 'deliveryMethodsConfigs' + } + + def __init__(self, delivery_methods_configs=None): # noqa: E501 + """NotificationSettings - a model defined in Swagger""" # noqa: E501 + self._delivery_methods_configs = None + self.discriminator = None + self.delivery_methods_configs = delivery_methods_configs + + @property + def delivery_methods_configs(self): + """Gets the delivery_methods_configs of this NotificationSettings. # noqa: E501 + + + :return: The delivery_methods_configs of this NotificationSettings. # noqa: E501 + :rtype: dict(str, NotificationDeliveryMethodConfig) + """ + return self._delivery_methods_configs + + @delivery_methods_configs.setter + def delivery_methods_configs(self, delivery_methods_configs): + """Sets the delivery_methods_configs of this NotificationSettings. + + + :param delivery_methods_configs: The delivery_methods_configs of this NotificationSettings. # noqa: E501 + :type: dict(str, NotificationDeliveryMethodConfig) + """ + if delivery_methods_configs is None: + raise ValueError("Invalid value for `delivery_methods_configs`, must not be `None`") # noqa: E501 + + self._delivery_methods_configs = delivery_methods_configs + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target.py new file mode 100644 index 0000000..8b48de4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target.py @@ -0,0 +1,230 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTarget(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'NotificationTargetConfig', + 'created_time': 'int', + 'id': 'NotificationTargetId', + 'name': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'configuration': 'configuration', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'tenant_id': 'tenantId' + } + + def __init__(self, configuration=None, created_time=None, id=None, name=None, tenant_id=None): # noqa: E501 + """NotificationTarget - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._created_time = None + self._id = None + self._name = None + self._tenant_id = None + self.discriminator = None + self.configuration = configuration + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + self.name = name + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def configuration(self): + """Gets the configuration of this NotificationTarget. # noqa: E501 + + + :return: The configuration of this NotificationTarget. # noqa: E501 + :rtype: NotificationTargetConfig + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this NotificationTarget. + + + :param configuration: The configuration of this NotificationTarget. # noqa: E501 + :type: NotificationTargetConfig + """ + if configuration is None: + raise ValueError("Invalid value for `configuration`, must not be `None`") # noqa: E501 + + self._configuration = configuration + + @property + def created_time(self): + """Gets the created_time of this NotificationTarget. # noqa: E501 + + + :return: The created_time of this NotificationTarget. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationTarget. + + + :param created_time: The created_time of this NotificationTarget. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationTarget. # noqa: E501 + + + :return: The id of this NotificationTarget. # noqa: E501 + :rtype: NotificationTargetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTarget. + + + :param id: The id of this NotificationTarget. # noqa: E501 + :type: NotificationTargetId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationTarget. # noqa: E501 + + + :return: The name of this NotificationTarget. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationTarget. + + + :param name: The name of this NotificationTarget. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationTarget. # noqa: E501 + + + :return: The tenant_id of this NotificationTarget. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationTarget. + + + :param tenant_id: The tenant_id of this NotificationTarget. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTarget, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTarget): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target_config.py new file mode 100644 index 0000000..f70ac5c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target_config.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTargetConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'type': 'str', + 'users_filter': 'JsonNode' + } + + attribute_map = { + 'description': 'description', + 'type': 'type', + 'users_filter': 'usersFilter' + } + + def __init__(self, description=None, type=None, users_filter=None): # noqa: E501 + """NotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self._type = None + self._users_filter = None + self.type = type + self.users_filter = users_filter + self.discriminator = None + if description is not None: + self.description = description + + @property + def type(self): + return self._type + + @type.setter + def type(self, type): + self._type = type + + @property + def users_filter(self): + return self._users_filter + + @users_filter.setter + def users_filter(self, users_filter): + self._users_filter = users_filter + + @property + def description(self): + """Gets the description of this NotificationTargetConfig. # noqa: E501 + + + :return: The description of this NotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this NotificationTargetConfig. + + + :param description: The description of this NotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target_id.py new file mode 100644 index 0000000..805f8a8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_target_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTargetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTargetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTargetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTargetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTargetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTargetId. # noqa: E501 + + + :return: The entity_type of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTargetId. + + + :param entity_type: The entity_type of this NotificationTargetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTargetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTargetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template.py new file mode 100644 index 0000000..3710733 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template.py @@ -0,0 +1,262 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'NotificationTemplateConfig', + 'created_time': 'int', + 'id': 'NotificationTemplateId', + 'name': 'str', + 'notification_type': 'str', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'configuration': 'configuration', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'notification_type': 'notificationType', + 'tenant_id': 'tenantId' + } + + def __init__(self, configuration=None, created_time=None, id=None, name=None, notification_type=None, tenant_id=None): # noqa: E501 + """NotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._created_time = None + self._id = None + self._name = None + self._notification_type = None + self._tenant_id = None + self.discriminator = None + self.configuration = configuration + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + self.notification_type = notification_type + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def configuration(self): + """Gets the configuration of this NotificationTemplate. # noqa: E501 + + + :return: The configuration of this NotificationTemplate. # noqa: E501 + :rtype: NotificationTemplateConfig + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this NotificationTemplate. + + + :param configuration: The configuration of this NotificationTemplate. # noqa: E501 + :type: NotificationTemplateConfig + """ + if configuration is None: + raise ValueError("Invalid value for `configuration`, must not be `None`") # noqa: E501 + + self._configuration = configuration + + @property + def created_time(self): + """Gets the created_time of this NotificationTemplate. # noqa: E501 + + + :return: The created_time of this NotificationTemplate. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationTemplate. + + + :param created_time: The created_time of this NotificationTemplate. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationTemplate. # noqa: E501 + + + :return: The id of this NotificationTemplate. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTemplate. + + + :param id: The id of this NotificationTemplate. # noqa: E501 + :type: NotificationTemplateId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this NotificationTemplate. # noqa: E501 + + + :return: The name of this NotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this NotificationTemplate. + + + :param name: The name of this NotificationTemplate. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def notification_type(self): + """Gets the notification_type of this NotificationTemplate. # noqa: E501 + + + :return: The notification_type of this NotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._notification_type + + @notification_type.setter + def notification_type(self, notification_type): + """Sets the notification_type of this NotificationTemplate. + + + :param notification_type: The notification_type of this NotificationTemplate. # noqa: E501 + :type: str + """ + if notification_type is None: + raise ValueError("Invalid value for `notification_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "GENERAL", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT", "RULE_NODE"] # noqa: E501 + if notification_type not in allowed_values: + raise ValueError( + "Invalid value for `notification_type` ({0}), must be one of {1}" # noqa: E501 + .format(notification_type, allowed_values) + ) + + self._notification_type = notification_type + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationTemplate. # noqa: E501 + + + :return: The tenant_id of this NotificationTemplate. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationTemplate. + + + :param tenant_id: The tenant_id of this NotificationTemplate. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template_config.py new file mode 100644 index 0000000..52e8e4b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'delivery_methods_templates': 'dict(str, DeliveryMethodNotificationTemplate)' + } + + attribute_map = { + 'delivery_methods_templates': 'deliveryMethodsTemplates' + } + + def __init__(self, delivery_methods_templates=None): # noqa: E501 + """NotificationTemplateConfig - a model defined in Swagger""" # noqa: E501 + self._delivery_methods_templates = None + self.discriminator = None + if delivery_methods_templates is not None: + self.delivery_methods_templates = delivery_methods_templates + + @property + def delivery_methods_templates(self): + """Gets the delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + + + :return: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._delivery_methods_templates + + @delivery_methods_templates.setter + def delivery_methods_templates(self, delivery_methods_templates): + """Sets the delivery_methods_templates of this NotificationTemplateConfig. + + + :param delivery_methods_templates: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._delivery_methods_templates = delivery_methods_templates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template_id.py new file mode 100644 index 0000000..27da460 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/notification_template_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTemplateId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTemplateId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTemplateId. # noqa: E501 + + + :return: The entity_type of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTemplateId. + + + :param entity_type: The entity_type of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/numeric_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_ce/numeric_filter_predicate.py new file mode 100644 index 0000000..de37a37 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/numeric_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class NumericFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValuedouble' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """NumericFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this NumericFilterPredicate. # noqa: E501 + + + :return: The operation of this NumericFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this NumericFilterPredicate. + + + :param operation: The operation of this NumericFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "GREATER", "GREATER_OR_EQUAL", "LESS", "LESS_OR_EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this NumericFilterPredicate. # noqa: E501 + + + :return: The value of this NumericFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuedouble + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this NumericFilterPredicate. + + + :param value: The value of this NumericFilterPredicate. # noqa: E501 + :type: FilterPredicateValuedouble + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NumericFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NumericFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_basic_mapper_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_basic_mapper_config.py new file mode 100644 index 0000000..d3ad203 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_basic_mapper_config.py @@ -0,0 +1,329 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2BasicMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'always_full_screen': 'bool', + 'customer_name_pattern': 'str', + 'default_dashboard_name': 'str', + 'email_attribute_key': 'str', + 'first_name_attribute_key': 'str', + 'last_name_attribute_key': 'str', + 'tenant_name_pattern': 'str', + 'tenant_name_strategy': 'str' + } + + attribute_map = { + 'always_full_screen': 'alwaysFullScreen', + 'customer_name_pattern': 'customerNamePattern', + 'default_dashboard_name': 'defaultDashboardName', + 'email_attribute_key': 'emailAttributeKey', + 'first_name_attribute_key': 'firstNameAttributeKey', + 'last_name_attribute_key': 'lastNameAttributeKey', + 'tenant_name_pattern': 'tenantNamePattern', + 'tenant_name_strategy': 'tenantNameStrategy' + } + + def __init__(self, always_full_screen=None, customer_name_pattern=None, default_dashboard_name=None, email_attribute_key=None, first_name_attribute_key=None, last_name_attribute_key=None, tenant_name_pattern=None, tenant_name_strategy=None): # noqa: E501 + """OAuth2BasicMapperConfig - a model defined in Swagger""" # noqa: E501 + self._always_full_screen = None + self._customer_name_pattern = None + self._default_dashboard_name = None + self._email_attribute_key = None + self._first_name_attribute_key = None + self._last_name_attribute_key = None + self._tenant_name_pattern = None + self._tenant_name_strategy = None + self.discriminator = None + if always_full_screen is not None: + self.always_full_screen = always_full_screen + if customer_name_pattern is not None: + self.customer_name_pattern = customer_name_pattern + if default_dashboard_name is not None: + self.default_dashboard_name = default_dashboard_name + if email_attribute_key is not None: + self.email_attribute_key = email_attribute_key + if first_name_attribute_key is not None: + self.first_name_attribute_key = first_name_attribute_key + if last_name_attribute_key is not None: + self.last_name_attribute_key = last_name_attribute_key + if tenant_name_pattern is not None: + self.tenant_name_pattern = tenant_name_pattern + self.tenant_name_strategy = tenant_name_strategy + + @property + def always_full_screen(self): + """Gets the always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + + Whether default dashboard should be open in full screen # noqa: E501 + + :return: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._always_full_screen + + @always_full_screen.setter + def always_full_screen(self, always_full_screen): + """Sets the always_full_screen of this OAuth2BasicMapperConfig. + + Whether default dashboard should be open in full screen # noqa: E501 + + :param always_full_screen: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :type: bool + """ + + self._always_full_screen = always_full_screen + + @property + def customer_name_pattern(self): + """Gets the customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :return: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._customer_name_pattern + + @customer_name_pattern.setter + def customer_name_pattern(self, customer_name_pattern): + """Sets the customer_name_pattern of this OAuth2BasicMapperConfig. + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :param customer_name_pattern: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._customer_name_pattern = customer_name_pattern + + @property + def default_dashboard_name(self): + """Gets the default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :return: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._default_dashboard_name + + @default_dashboard_name.setter + def default_dashboard_name(self, default_dashboard_name): + """Sets the default_dashboard_name of this OAuth2BasicMapperConfig. + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :param default_dashboard_name: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._default_dashboard_name = default_dashboard_name + + @property + def email_attribute_key(self): + """Gets the email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :return: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._email_attribute_key + + @email_attribute_key.setter + def email_attribute_key(self, email_attribute_key): + """Sets the email_attribute_key of this OAuth2BasicMapperConfig. + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :param email_attribute_key: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._email_attribute_key = email_attribute_key + + @property + def first_name_attribute_key(self): + """Gets the first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + First name attribute key # noqa: E501 + + :return: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._first_name_attribute_key + + @first_name_attribute_key.setter + def first_name_attribute_key(self, first_name_attribute_key): + """Sets the first_name_attribute_key of this OAuth2BasicMapperConfig. + + First name attribute key # noqa: E501 + + :param first_name_attribute_key: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._first_name_attribute_key = first_name_attribute_key + + @property + def last_name_attribute_key(self): + """Gets the last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Last name attribute key # noqa: E501 + + :return: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._last_name_attribute_key + + @last_name_attribute_key.setter + def last_name_attribute_key(self, last_name_attribute_key): + """Sets the last_name_attribute_key of this OAuth2BasicMapperConfig. + + Last name attribute key # noqa: E501 + + :param last_name_attribute_key: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._last_name_attribute_key = last_name_attribute_key + + @property + def tenant_name_pattern(self): + """Gets the tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :return: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_pattern + + @tenant_name_pattern.setter + def tenant_name_pattern(self, tenant_name_pattern): + """Sets the tenant_name_pattern of this OAuth2BasicMapperConfig. + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :param tenant_name_pattern: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._tenant_name_pattern = tenant_name_pattern + + @property + def tenant_name_strategy(self): + """Gets the tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :return: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_strategy + + @tenant_name_strategy.setter + def tenant_name_strategy(self, tenant_name_strategy): + """Sets the tenant_name_strategy of this OAuth2BasicMapperConfig. + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :param tenant_name_strategy: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + if tenant_name_strategy is None: + raise ValueError("Invalid value for `tenant_name_strategy`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOM", "DOMAIN", "EMAIL"] # noqa: E501 + if tenant_name_strategy not in allowed_values: + raise ValueError( + "Invalid value for `tenant_name_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(tenant_name_strategy, allowed_values) + ) + + self._tenant_name_strategy = tenant_name_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2BasicMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2BasicMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_info.py new file mode 100644 index 0000000..a80f96b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'icon': 'str', + 'name': 'str', + 'url': 'str' + } + + attribute_map = { + 'icon': 'icon', + 'name': 'name', + 'url': 'url' + } + + def __init__(self, icon=None, name=None, url=None): # noqa: E501 + """OAuth2ClientInfo - a model defined in Swagger""" # noqa: E501 + self._icon = None + self._name = None + self._url = None + self.discriminator = None + if icon is not None: + self.icon = icon + if name is not None: + self.name = name + if url is not None: + self.url = url + + @property + def icon(self): + """Gets the icon of this OAuth2ClientInfo. # noqa: E501 + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :return: The icon of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._icon + + @icon.setter + def icon(self, icon): + """Sets the icon of this OAuth2ClientInfo. + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :param icon: The icon of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._icon = icon + + @property + def name(self): + """Gets the name of this OAuth2ClientInfo. # noqa: E501 + + OAuth2 client name # noqa: E501 + + :return: The name of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientInfo. + + OAuth2 client name # noqa: E501 + + :param name: The name of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def url(self): + """Gets the url of this OAuth2ClientInfo. # noqa: E501 + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :return: The url of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2ClientInfo. + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :param url: The url of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template.py new file mode 100644 index 0000000..ca355f7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template.py @@ -0,0 +1,565 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'comment': 'str', + 'created_time': 'int', + 'help_link': 'str', + 'id': 'OAuth2ClientRegistrationTemplateId', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'name': 'str', + 'provider_id': 'str', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'comment': 'comment', + 'created_time': 'createdTime', + 'help_link': 'helpLink', + 'id': 'id', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'name': 'name', + 'provider_id': 'providerId', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, comment=None, created_time=None, help_link=None, id=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, name=None, provider_id=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2ClientRegistrationTemplate - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._comment = None + self._created_time = None + self._help_link = None + self._id = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._name = None + self._provider_id = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + if access_token_uri is not None: + self.access_token_uri = access_token_uri + if additional_info is not None: + self.additional_info = additional_info + if authorization_uri is not None: + self.authorization_uri = authorization_uri + if client_authentication_method is not None: + self.client_authentication_method = client_authentication_method + if comment is not None: + self.comment = comment + if created_time is not None: + self.created_time = created_time + if help_link is not None: + self.help_link = help_link + if id is not None: + self.id = id + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + if login_button_label is not None: + self.login_button_label = login_button_label + if mapper_config is not None: + self.mapper_config = mapper_config + if name is not None: + self.name = name + self.provider_id = provider_id + if scope is not None: + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default access token URI of the OAuth2 provider # noqa: E501 + + :return: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2ClientRegistrationTemplate. + + Default access token URI of the OAuth2 provider # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2ClientRegistrationTemplate. + + + :param additional_info: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :return: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2ClientRegistrationTemplate. + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :return: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2ClientRegistrationTemplate. + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._client_authentication_method = client_authentication_method + + @property + def comment(self): + """Gets the comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Comment for OAuth2 provider # noqa: E501 + + :return: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this OAuth2ClientRegistrationTemplate. + + Comment for OAuth2 provider # noqa: E501 + + :param comment: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._comment = comment + + @property + def created_time(self): + """Gets the created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OAuth2ClientRegistrationTemplate. + + + :param created_time: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def help_link(self): + """Gets the help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Help link for OAuth2 provider # noqa: E501 + + :return: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._help_link + + @help_link.setter + def help_link(self, help_link): + """Sets the help_link of this OAuth2ClientRegistrationTemplate. + + Help link for OAuth2 provider # noqa: E501 + + :param help_link: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._help_link = help_link + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2ClientRegistrationTemplateId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplate. + + + :param id: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2ClientRegistrationTemplateId + """ + + self._id = id + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2ClientRegistrationTemplate. + + Default log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth2 provider label # noqa: E501 + + :return: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2ClientRegistrationTemplate. + + Default OAuth2 provider label # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2ClientRegistrationTemplate. + + + :param mapper_config: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2MapperConfig + """ + + self._mapper_config = mapper_config + + @property + def name(self): + """Gets the name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientRegistrationTemplate. + + + :param name: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def provider_id(self): + """Gets the provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :return: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._provider_id + + @provider_id.setter + def provider_id(self, provider_id): + """Sets the provider_id of this OAuth2ClientRegistrationTemplate. + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :param provider_id: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + if provider_id is None: + raise ValueError("Invalid value for `provider_id`, must not be `None`") # noqa: E501 + + self._provider_id = provider_id + + @property + def scope(self): + """Gets the scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :return: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2ClientRegistrationTemplate. + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :param scope: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: list[str] + """ + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default user info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2ClientRegistrationTemplate. + + Default user info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template_id.py new file mode 100644 index 0000000..6b3b175 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_client_registration_template_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """OAuth2ClientRegistrationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplateId. + + string # noqa: E501 + + :param id: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_custom_mapper_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_custom_mapper_config.py new file mode 100644 index 0000000..220b530 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_custom_mapper_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2CustomMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password': 'str', + 'send_token': 'bool', + 'url': 'str', + 'username': 'str' + } + + attribute_map = { + 'password': 'password', + 'send_token': 'sendToken', + 'url': 'url', + 'username': 'username' + } + + def __init__(self, password=None, send_token=None, url=None, username=None): # noqa: E501 + """OAuth2CustomMapperConfig - a model defined in Swagger""" # noqa: E501 + self._password = None + self._send_token = None + self._url = None + self._username = None + self.discriminator = None + if password is not None: + self.password = password + if send_token is not None: + self.send_token = send_token + if url is not None: + self.url = url + if username is not None: + self.username = username + + @property + def password(self): + """Gets the password of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this OAuth2CustomMapperConfig. + + + :param password: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def send_token(self): + """Gets the send_token of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._send_token + + @send_token.setter + def send_token(self, send_token): + """Sets the send_token of this OAuth2CustomMapperConfig. + + + :param send_token: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :type: bool + """ + + self._send_token = send_token + + @property + def url(self): + """Gets the url of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2CustomMapperConfig. + + + :param url: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def username(self): + """Gets the username of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this OAuth2CustomMapperConfig. + + + :param username: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2CustomMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2CustomMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_domain_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_domain_info.py new file mode 100644 index 0000000..2a293c6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_domain_info.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2DomainInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'scheme': 'str' + } + + attribute_map = { + 'name': 'name', + 'scheme': 'scheme' + } + + def __init__(self, name=None, scheme=None): # noqa: E501 + """OAuth2DomainInfo - a model defined in Swagger""" # noqa: E501 + self._name = None + self._scheme = None + self.discriminator = None + self.name = name + self.scheme = scheme + + @property + def name(self): + """Gets the name of this OAuth2DomainInfo. # noqa: E501 + + Domain name. Cannot be empty # noqa: E501 + + :return: The name of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2DomainInfo. + + Domain name. Cannot be empty # noqa: E501 + + :param name: The name of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def scheme(self): + """Gets the scheme of this OAuth2DomainInfo. # noqa: E501 + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :return: The scheme of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._scheme + + @scheme.setter + def scheme(self, scheme): + """Sets the scheme of this OAuth2DomainInfo. + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :param scheme: The scheme of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if scheme is None: + raise ValueError("Invalid value for `scheme`, must not be `None`") # noqa: E501 + allowed_values = ["HTTP", "HTTPS", "MIXED"] # noqa: E501 + if scheme not in allowed_values: + raise ValueError( + "Invalid value for `scheme` ({0}), must be one of {1}" # noqa: E501 + .format(scheme, allowed_values) + ) + + self._scheme = scheme + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2DomainInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2DomainInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_info.py new file mode 100644 index 0000000..b34609a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_info.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2Info(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'enabled': 'bool', + 'oauth2_params_infos': 'list[OAuth2ParamsInfo]' + } + + attribute_map = { + 'enabled': 'enabled', + 'oauth2_params_infos': 'oauth2ParamsInfos' + } + + def __init__(self, enabled=None, oauth2_params_infos=None): # noqa: E501 + """OAuth2Info - a model defined in Swagger""" # noqa: E501 + self._enabled = None + self._oauth2_params_infos = None + self.discriminator = None + if enabled is not None: + self.enabled = enabled + self.oauth2_params_infos = oauth2_params_infos + + @property + def enabled(self): + """Gets the enabled of this OAuth2Info. # noqa: E501 + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :return: The enabled of this OAuth2Info. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this OAuth2Info. + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :param enabled: The enabled of this OAuth2Info. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def oauth2_params_infos(self): + """Gets the oauth2_params_infos of this OAuth2Info. # noqa: E501 + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :return: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :rtype: list[OAuth2ParamsInfo] + """ + return self._oauth2_params_infos + + @oauth2_params_infos.setter + def oauth2_params_infos(self, oauth2_params_infos): + """Sets the oauth2_params_infos of this OAuth2Info. + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :param oauth2_params_infos: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :type: list[OAuth2ParamsInfo] + """ + if oauth2_params_infos is None: + raise ValueError("Invalid value for `oauth2_params_infos`, must not be `None`") # noqa: E501 + + self._oauth2_params_infos = oauth2_params_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2Info, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2Info): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_mapper_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_mapper_config.py new file mode 100644 index 0000000..85009ce --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_mapper_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_user': 'bool', + 'allow_user_creation': 'bool', + 'basic': 'OAuth2BasicMapperConfig', + 'custom': 'OAuth2CustomMapperConfig', + 'type': 'str' + } + + attribute_map = { + 'activate_user': 'activateUser', + 'allow_user_creation': 'allowUserCreation', + 'basic': 'basic', + 'custom': 'custom', + 'type': 'type' + } + + def __init__(self, activate_user=None, allow_user_creation=None, basic=None, custom=None, type=None): # noqa: E501 + """OAuth2MapperConfig - a model defined in Swagger""" # noqa: E501 + self._activate_user = None + self._allow_user_creation = None + self._basic = None + self._custom = None + self._type = None + self.discriminator = None + if activate_user is not None: + self.activate_user = activate_user + if allow_user_creation is not None: + self.allow_user_creation = allow_user_creation + if basic is not None: + self.basic = basic + if custom is not None: + self.custom = custom + self.type = type + + @property + def activate_user(self): + """Gets the activate_user of this OAuth2MapperConfig. # noqa: E501 + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :return: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._activate_user + + @activate_user.setter + def activate_user(self, activate_user): + """Sets the activate_user of this OAuth2MapperConfig. + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :param activate_user: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._activate_user = activate_user + + @property + def allow_user_creation(self): + """Gets the allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :return: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._allow_user_creation + + @allow_user_creation.setter + def allow_user_creation(self, allow_user_creation): + """Sets the allow_user_creation of this OAuth2MapperConfig. + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :param allow_user_creation: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._allow_user_creation = allow_user_creation + + @property + def basic(self): + """Gets the basic of this OAuth2MapperConfig. # noqa: E501 + + + :return: The basic of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2BasicMapperConfig + """ + return self._basic + + @basic.setter + def basic(self, basic): + """Sets the basic of this OAuth2MapperConfig. + + + :param basic: The basic of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2BasicMapperConfig + """ + + self._basic = basic + + @property + def custom(self): + """Gets the custom of this OAuth2MapperConfig. # noqa: E501 + + + :return: The custom of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2CustomMapperConfig + """ + return self._custom + + @custom.setter + def custom(self, custom): + """Sets the custom of this OAuth2MapperConfig. + + + :param custom: The custom of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2CustomMapperConfig + """ + + self._custom = custom + + @property + def type(self): + """Gets the type of this OAuth2MapperConfig. # noqa: E501 + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :return: The type of this OAuth2MapperConfig. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OAuth2MapperConfig. + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :param type: The type of this OAuth2MapperConfig. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APPLE", "BASIC", "CUSTOM", "GITHUB"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_mobile_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_mobile_info.py new file mode 100644 index 0000000..6795891 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_mobile_info.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MobileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'app_secret': 'str', + 'pkg_name': 'str' + } + + attribute_map = { + 'app_secret': 'appSecret', + 'pkg_name': 'pkgName' + } + + def __init__(self, app_secret=None, pkg_name=None): # noqa: E501 + """OAuth2MobileInfo - a model defined in Swagger""" # noqa: E501 + self._app_secret = None + self._pkg_name = None + self.discriminator = None + self.app_secret = app_secret + self.pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this OAuth2MobileInfo. # noqa: E501 + + Application secret. The length must be at least 16 characters # noqa: E501 + + :return: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this OAuth2MobileInfo. + + Application secret. The length must be at least 16 characters # noqa: E501 + + :param app_secret: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if app_secret is None: + raise ValueError("Invalid value for `app_secret`, must not be `None`") # noqa: E501 + + self._app_secret = app_secret + + @property + def pkg_name(self): + """Gets the pkg_name of this OAuth2MobileInfo. # noqa: E501 + + Application package name. Cannot be empty # noqa: E501 + + :return: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this OAuth2MobileInfo. + + Application package name. Cannot be empty # noqa: E501 + + :param pkg_name: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if pkg_name is None: + raise ValueError("Invalid value for `pkg_name`, must not be `None`") # noqa: E501 + + self._pkg_name = pkg_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MobileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MobileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_params_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_params_info.py new file mode 100644 index 0000000..d387e83 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_params_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ParamsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_registrations': 'list[OAuth2RegistrationInfo]', + 'domain_infos': 'list[OAuth2DomainInfo]', + 'mobile_infos': 'list[OAuth2MobileInfo]' + } + + attribute_map = { + 'client_registrations': 'clientRegistrations', + 'domain_infos': 'domainInfos', + 'mobile_infos': 'mobileInfos' + } + + def __init__(self, client_registrations=None, domain_infos=None, mobile_infos=None): # noqa: E501 + """OAuth2ParamsInfo - a model defined in Swagger""" # noqa: E501 + self._client_registrations = None + self._domain_infos = None + self._mobile_infos = None + self.discriminator = None + self.client_registrations = client_registrations + self.domain_infos = domain_infos + self.mobile_infos = mobile_infos + + @property + def client_registrations(self): + """Gets the client_registrations of this OAuth2ParamsInfo. # noqa: E501 + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :return: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2RegistrationInfo] + """ + return self._client_registrations + + @client_registrations.setter + def client_registrations(self, client_registrations): + """Sets the client_registrations of this OAuth2ParamsInfo. + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :param client_registrations: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2RegistrationInfo] + """ + if client_registrations is None: + raise ValueError("Invalid value for `client_registrations`, must not be `None`") # noqa: E501 + + self._client_registrations = client_registrations + + @property + def domain_infos(self): + """Gets the domain_infos of this OAuth2ParamsInfo. # noqa: E501 + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :return: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2DomainInfo] + """ + return self._domain_infos + + @domain_infos.setter + def domain_infos(self, domain_infos): + """Sets the domain_infos of this OAuth2ParamsInfo. + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :param domain_infos: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2DomainInfo] + """ + if domain_infos is None: + raise ValueError("Invalid value for `domain_infos`, must not be `None`") # noqa: E501 + + self._domain_infos = domain_infos + + @property + def mobile_infos(self): + """Gets the mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :return: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2MobileInfo] + """ + return self._mobile_infos + + @mobile_infos.setter + def mobile_infos(self, mobile_infos): + """Sets the mobile_infos of this OAuth2ParamsInfo. + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :param mobile_infos: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2MobileInfo] + """ + if mobile_infos is None: + raise ValueError("Invalid value for `mobile_infos`, must not be `None`") # noqa: E501 + + self._mobile_infos = mobile_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ParamsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ParamsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_registration_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_registration_info.py new file mode 100644 index 0000000..2c75e54 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/o_auth2_registration_info.py @@ -0,0 +1,502 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2RegistrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'client_id': 'str', + 'client_secret': 'str', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'platforms': 'list[str]', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'client_id': 'clientId', + 'client_secret': 'clientSecret', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'platforms': 'platforms', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, client_id=None, client_secret=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, platforms=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2RegistrationInfo - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._client_id = None + self._client_secret = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._platforms = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + self.access_token_uri = access_token_uri + self.additional_info = additional_info + self.authorization_uri = authorization_uri + self.client_authentication_method = client_authentication_method + self.client_id = client_id + self.client_secret = client_secret + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + self.login_button_label = login_button_label + self.mapper_config = mapper_config + if platforms is not None: + self.platforms = platforms + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2RegistrationInfo. + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if access_token_uri is None: + raise ValueError("Invalid value for `access_token_uri`, must not be `None`") # noqa: E501 + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2RegistrationInfo. + + + :param additional_info: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2RegistrationInfo. + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if authorization_uri is None: + raise ValueError("Invalid value for `authorization_uri`, must not be `None`") # noqa: E501 + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :return: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2RegistrationInfo. + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_authentication_method is None: + raise ValueError("Invalid value for `client_authentication_method`, must not be `None`") # noqa: E501 + + self._client_authentication_method = client_authentication_method + + @property + def client_id(self): + """Gets the client_id of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :return: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_id + + @client_id.setter + def client_id(self, client_id): + """Sets the client_id of this OAuth2RegistrationInfo. + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :param client_id: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_id is None: + raise ValueError("Invalid value for `client_id`, must not be `None`") # noqa: E501 + + self._client_id = client_id + + @property + def client_secret(self): + """Gets the client_secret of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :return: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_secret + + @client_secret.setter + def client_secret(self, client_secret): + """Sets the client_secret of this OAuth2RegistrationInfo. + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :param client_secret: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_secret is None: + raise ValueError("Invalid value for `client_secret`, must not be `None`") # noqa: E501 + + self._client_secret = client_secret + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2RegistrationInfo. + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + + Log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2RegistrationInfo. + + Log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :return: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2RegistrationInfo. + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if login_button_label is None: + raise ValueError("Invalid value for `login_button_label`, must not be `None`") # noqa: E501 + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2RegistrationInfo. + + + :param mapper_config: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :type: OAuth2MapperConfig + """ + if mapper_config is None: + raise ValueError("Invalid value for `mapper_config`, must not be `None`") # noqa: E501 + + self._mapper_config = mapper_config + + @property + def platforms(self): + """Gets the platforms of this OAuth2RegistrationInfo. # noqa: E501 + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :return: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._platforms + + @platforms.setter + def platforms(self, platforms): + """Sets the platforms of this OAuth2RegistrationInfo. + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :param platforms: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ANDROID", "IOS", "WEB"] # noqa: E501 + if not set(platforms).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `platforms` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(platforms) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._platforms = platforms + + @property + def scope(self): + """Gets the scope of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :return: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2RegistrationInfo. + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :param scope: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + if scope is None: + raise ValueError("Invalid value for `scope`, must not be `None`") # noqa: E501 + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + + User info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2RegistrationInfo. + + User info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2RegistrationInfo. + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2RegistrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2RegistrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/object_attributes.py b/tb-rest-client/python/tb_rest_client/models/models_ce/object_attributes.py new file mode 100644 index 0000000..11802ef --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/object_attributes.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectAttributes(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dim': 'int', + 'gt': 'float', + 'lt': 'float', + 'pmax': 'int', + 'pmin': 'int', + 'st': 'float', + 'ver': 'str' + } + + attribute_map = { + 'dim': 'dim', + 'gt': 'gt', + 'lt': 'lt', + 'pmax': 'pmax', + 'pmin': 'pmin', + 'st': 'st', + 'ver': 'ver' + } + + def __init__(self, dim=None, gt=None, lt=None, pmax=None, pmin=None, st=None, ver=None): # noqa: E501 + """ObjectAttributes - a model defined in Swagger""" # noqa: E501 + self._dim = None + self._gt = None + self._lt = None + self._pmax = None + self._pmin = None + self._st = None + self._ver = None + self.discriminator = None + if dim is not None: + self.dim = dim + if gt is not None: + self.gt = gt + if lt is not None: + self.lt = lt + if pmax is not None: + self.pmax = pmax + if pmin is not None: + self.pmin = pmin + if st is not None: + self.st = st + if ver is not None: + self.ver = ver + + @property + def dim(self): + """Gets the dim of this ObjectAttributes. # noqa: E501 + + + :return: The dim of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._dim + + @dim.setter + def dim(self, dim): + """Sets the dim of this ObjectAttributes. + + + :param dim: The dim of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._dim = dim + + @property + def gt(self): + """Gets the gt of this ObjectAttributes. # noqa: E501 + + + :return: The gt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._gt + + @gt.setter + def gt(self, gt): + """Sets the gt of this ObjectAttributes. + + + :param gt: The gt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._gt = gt + + @property + def lt(self): + """Gets the lt of this ObjectAttributes. # noqa: E501 + + + :return: The lt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._lt + + @lt.setter + def lt(self, lt): + """Sets the lt of this ObjectAttributes. + + + :param lt: The lt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._lt = lt + + @property + def pmax(self): + """Gets the pmax of this ObjectAttributes. # noqa: E501 + + + :return: The pmax of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmax + + @pmax.setter + def pmax(self, pmax): + """Sets the pmax of this ObjectAttributes. + + + :param pmax: The pmax of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmax = pmax + + @property + def pmin(self): + """Gets the pmin of this ObjectAttributes. # noqa: E501 + + + :return: The pmin of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmin + + @pmin.setter + def pmin(self, pmin): + """Sets the pmin of this ObjectAttributes. + + + :param pmin: The pmin of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmin = pmin + + @property + def st(self): + """Gets the st of this ObjectAttributes. # noqa: E501 + + + :return: The st of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._st + + @st.setter + def st(self, st): + """Sets the st of this ObjectAttributes. + + + :param st: The st of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._st = st + + @property + def ver(self): + """Gets the ver of this ObjectAttributes. # noqa: E501 + + + :return: The ver of this ObjectAttributes. # noqa: E501 + :rtype: str + """ + return self._ver + + @ver.setter + def ver(self, ver): + """Sets the ver of this ObjectAttributes. + + + :param ver: The ver of this ObjectAttributes. # noqa: E501 + :type: str + """ + + self._ver = ver + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectAttributes, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectAttributes): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/object_node.py b/tb-rest-client/python/tb_rest_client/models/models_ce/object_node.py new file mode 100644 index 0000000..97116b3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/object_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """ObjectNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/originator_entity_owner_users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/originator_entity_owner_users_filter.py new file mode 100644 index 0000000..68a6a08 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/originator_entity_owner_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OriginatorEntityOwnerUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OriginatorEntityOwnerUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OriginatorEntityOwnerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OriginatorEntityOwnerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package.py b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package.py new file mode 100644 index 0000000..c5d0680 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package.py @@ -0,0 +1,576 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'data': 'ByteBuffer', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'data': 'data', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, data=None, additional_info=None): # noqa: E501 + """OtaPackage - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._data = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if data is not None: + self.data = data + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackage. # noqa: E501 + + + :return: The id of this OtaPackage. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackage. + + + :param id: The id of this OtaPackage. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackage. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackage. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackage. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackage. # noqa: E501 + + + :return: The tenant_id of this OtaPackage. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackage. + + + :param tenant_id: The tenant_id of this OtaPackage. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackage. # noqa: E501 + + + :return: The device_profile_id of this OtaPackage. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackage. + + + :param device_profile_id: The device_profile_id of this OtaPackage. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackage. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackage. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackage. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackage. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackage. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackage. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackage. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackage. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackage. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackage. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackage. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackage. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackage. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackage. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackage. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackage. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackage. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackage. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackage. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackage. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackage. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackage. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackage. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackage. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackage. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackage. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackage. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackage. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackage. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackage. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackage. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackage. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def data(self): + """Gets the data of this OtaPackage. # noqa: E501 + + + :return: The data of this OtaPackage. # noqa: E501 + :rtype: ByteBuffer + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OtaPackage. + + + :param data: The data of this OtaPackage. # noqa: E501 + :type: ByteBuffer + """ + + self._data = data + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackage. # noqa: E501 + + + :return: The additional_info of this OtaPackage. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackage. + + + :param additional_info: The additional_info of this OtaPackage. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_id.py new file mode 100644 index 0000000..d9cc7a8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """OtaPackageId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this OtaPackageId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this OtaPackageId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this OtaPackageId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this OtaPackageId. + + string # noqa: E501 + + :param entity_type: The entity_type of this OtaPackageId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["OTA_PACKAGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_info.py new file mode 100644 index 0000000..767412c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_info.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, additional_info=None): # noqa: E501 + """OtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackageInfo. # noqa: E501 + + + :return: The id of this OtaPackageInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageInfo. + + + :param id: The id of this OtaPackageInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackageInfo. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackageInfo. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackageInfo. # noqa: E501 + + + :return: The tenant_id of this OtaPackageInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackageInfo. + + + :param tenant_id: The tenant_id of this OtaPackageInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackageInfo. # noqa: E501 + + + :return: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackageInfo. + + + :param device_profile_id: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackageInfo. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackageInfo. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackageInfo. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackageInfo. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackageInfo. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackageInfo. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackageInfo. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackageInfo. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackageInfo. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackageInfo. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackageInfo. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackageInfo. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackageInfo. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackageInfo. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackageInfo. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackageInfo. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageInfo. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageInfo. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackageInfo. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackageInfo. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackageInfo. # noqa: E501 + + + :return: The additional_info of this OtaPackageInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackageInfo. + + + :param additional_info: The additional_info of this OtaPackageInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_ota_package_id_body.py b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_ota_package_id_body.py new file mode 100644 index 0000000..66a8546 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_ota_package_id_body.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageOtaPackageIdBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'checksum': 'str', + 'checksum_algorithm': 'str', + 'file': 'str' + } + + attribute_map = { + 'checksum': 'checksum', + 'checksum_algorithm': 'checksumAlgorithm', + 'file': 'file' + } + + def __init__(self, checksum=None, checksum_algorithm=None, file=None): # noqa: E501 + """OtaPackageOtaPackageIdBody - a model defined in Swagger""" # noqa: E501 + self._checksum = None + self._checksum_algorithm = None + self._file = None + self.discriminator = None + if checksum is not None: + self.checksum = checksum + self.checksum_algorithm = checksum_algorithm + self.file = file + + @property + def checksum(self): + """Gets the checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :return: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageOtaPackageIdBody. + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :param checksum: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageOtaPackageIdBody. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if checksum_algorithm is None: + raise ValueError("Invalid value for `checksum_algorithm`, must not be `None`") # noqa: E501 + + self._checksum_algorithm = checksum_algorithm + + @property + def file(self): + """Gets the file of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package data. # noqa: E501 + + :return: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this OtaPackageOtaPackageIdBody. + + OTA Package data. # noqa: E501 + + :param file: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if file is None: + raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501 + + self._file = file + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageOtaPackageIdBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageOtaPackageIdBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_ota_package_idchecksumchecksum_algorithm_body.py b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_ota_package_idchecksumchecksum_algorithm_body.py new file mode 100644 index 0000000..099b33d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/ota_package_ota_package_idchecksumchecksum_algorithm_body.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'file': 'str' + } + + attribute_map = { + 'file': 'file' + } + + def __init__(self, file=None): # noqa: E501 + """OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody - a model defined in Swagger""" # noqa: E501 + self._file = None + self.discriminator = None + self.file = file + + @property + def file(self): + """Gets the file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. # noqa: E501 + + file # noqa: E501 + + :return: The file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. + + file # noqa: E501 + + :param file: The file of this OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody. # noqa: E501 + :type: str + """ + if file is None: + raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501 + + self._file = file + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageOtaPackageIdchecksumchecksumAlgorithmBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/other_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/other_configuration.py new file mode 100644 index 0000000..65ed3cc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/other_configuration.py @@ -0,0 +1,338 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtherConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_only_observe_after_connect': 'int', + 'edrx_cycle': 'int', + 'fw_update_resource': 'str', + 'fw_update_strategy': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int', + 'sw_update_resource': 'str', + 'sw_update_strategy': 'int' + } + + attribute_map = { + 'client_only_observe_after_connect': 'clientOnlyObserveAfterConnect', + 'edrx_cycle': 'edrxCycle', + 'fw_update_resource': 'fwUpdateResource', + 'fw_update_strategy': 'fwUpdateStrategy', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer', + 'sw_update_resource': 'swUpdateResource', + 'sw_update_strategy': 'swUpdateStrategy' + } + + def __init__(self, client_only_observe_after_connect=None, edrx_cycle=None, fw_update_resource=None, fw_update_strategy=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, sw_update_resource=None, sw_update_strategy=None): # noqa: E501 + """OtherConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_only_observe_after_connect = None + self._edrx_cycle = None + self._fw_update_resource = None + self._fw_update_strategy = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self._sw_update_resource = None + self._sw_update_strategy = None + self.discriminator = None + if client_only_observe_after_connect is not None: + self.client_only_observe_after_connect = client_only_observe_after_connect + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if fw_update_resource is not None: + self.fw_update_resource = fw_update_resource + if fw_update_strategy is not None: + self.fw_update_strategy = fw_update_strategy + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + if sw_update_resource is not None: + self.sw_update_resource = sw_update_resource + if sw_update_strategy is not None: + self.sw_update_strategy = sw_update_strategy + + @property + def client_only_observe_after_connect(self): + """Gets the client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + + + :return: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._client_only_observe_after_connect + + @client_only_observe_after_connect.setter + def client_only_observe_after_connect(self, client_only_observe_after_connect): + """Sets the client_only_observe_after_connect of this OtherConfiguration. + + + :param client_only_observe_after_connect: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._client_only_observe_after_connect = client_only_observe_after_connect + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this OtherConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this OtherConfiguration. + + + :param edrx_cycle: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def fw_update_resource(self): + """Gets the fw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._fw_update_resource + + @fw_update_resource.setter + def fw_update_resource(self, fw_update_resource): + """Sets the fw_update_resource of this OtherConfiguration. + + + :param fw_update_resource: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._fw_update_resource = fw_update_resource + + @property + def fw_update_strategy(self): + """Gets the fw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._fw_update_strategy + + @fw_update_strategy.setter + def fw_update_strategy(self, fw_update_strategy): + """Sets the fw_update_strategy of this OtherConfiguration. + + + :param fw_update_strategy: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._fw_update_strategy = fw_update_strategy + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this OtherConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this OtherConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this OtherConfiguration. # noqa: E501 + + + :return: The power_mode of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this OtherConfiguration. + + + :param power_mode: The power_mode of this OtherConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this OtherConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this OtherConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + @property + def sw_update_resource(self): + """Gets the sw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._sw_update_resource + + @sw_update_resource.setter + def sw_update_resource(self, sw_update_resource): + """Sets the sw_update_resource of this OtherConfiguration. + + + :param sw_update_resource: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._sw_update_resource = sw_update_resource + + @property + def sw_update_strategy(self): + """Gets the sw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._sw_update_strategy + + @sw_update_strategy.setter + def sw_update_strategy(self, sw_update_strategy): + """Sets the sw_update_strategy of this OtherConfiguration. + + + :param sw_update_strategy: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._sw_update_strategy = sw_update_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtherConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtherConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_comment_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_comment_info.py new file mode 100644 index 0000000..7a9a082 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_comment_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAlarmCommentInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AlarmCommentInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAlarmCommentInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAlarmCommentInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: list[AlarmCommentInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAlarmCommentInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAlarmCommentInfo. # noqa: E501 + :type: list[AlarmCommentInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAlarmCommentInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAlarmCommentInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAlarmCommentInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAlarmCommentInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAlarmCommentInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAlarmCommentInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAlarmCommentInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAlarmCommentInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAlarmCommentInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAlarmCommentInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_data.py new file mode 100644 index 0000000..f260b5e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_data.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAlarmData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AlarmData]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAlarmData - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAlarmData. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAlarmData. # noqa: E501 + :rtype: list[AlarmData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAlarmData. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAlarmData. # noqa: E501 + :type: list[AlarmData] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAlarmData. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAlarmData. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAlarmData. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAlarmData. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAlarmData. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAlarmData. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAlarmData. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAlarmData. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAlarmData. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAlarmData. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAlarmData. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAlarmData. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAlarmData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAlarmData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_info.py new file mode 100644 index 0000000..ec0cf11 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_alarm_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAlarmInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AlarmInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAlarmInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAlarmInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAlarmInfo. # noqa: E501 + :rtype: list[AlarmInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAlarmInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAlarmInfo. # noqa: E501 + :type: list[AlarmInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAlarmInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAlarmInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAlarmInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAlarmInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAlarmInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAlarmInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAlarmInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAlarmInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAlarmInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAlarmInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAlarmInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAlarmInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAlarmInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset.py new file mode 100644 index 0000000..1bc4968 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAsset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Asset]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAsset - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAsset. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAsset. # noqa: E501 + :rtype: list[Asset] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAsset. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAsset. # noqa: E501 + :type: list[Asset] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAsset. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAsset. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAsset. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAsset. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAsset. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAsset. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAsset. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAsset. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAsset. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAsset. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAsset. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAsset. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAsset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAsset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_info.py new file mode 100644 index 0000000..fedfc92 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAssetInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AssetInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAssetInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAssetInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAssetInfo. # noqa: E501 + :rtype: list[AssetInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAssetInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAssetInfo. # noqa: E501 + :type: list[AssetInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAssetInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAssetInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAssetInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAssetInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAssetInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAssetInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAssetInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAssetInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAssetInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAssetInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAssetInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAssetInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAssetInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAssetInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_profile.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_profile.py new file mode 100644 index 0000000..4a35a92 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_profile.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAssetProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AssetProfile]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAssetProfile - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAssetProfile. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAssetProfile. # noqa: E501 + :rtype: list[AssetProfile] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAssetProfile. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAssetProfile. # noqa: E501 + :type: list[AssetProfile] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAssetProfile. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAssetProfile. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAssetProfile. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAssetProfile. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAssetProfile. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAssetProfile. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAssetProfile. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAssetProfile. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAssetProfile. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAssetProfile. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAssetProfile. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAssetProfile. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAssetProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAssetProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_profile_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_profile_info.py new file mode 100644 index 0000000..8f2b597 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_asset_profile_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAssetProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AssetProfileInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAssetProfileInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAssetProfileInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: list[AssetProfileInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAssetProfileInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAssetProfileInfo. # noqa: E501 + :type: list[AssetProfileInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAssetProfileInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAssetProfileInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAssetProfileInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAssetProfileInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAssetProfileInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAssetProfileInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAssetProfileInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAssetProfileInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAssetProfileInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAssetProfileInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAssetProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAssetProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_audit_log.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_audit_log.py new file mode 100644 index 0000000..9e9428f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_audit_log.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataAuditLog(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[AuditLog]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataAuditLog - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataAuditLog. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataAuditLog. # noqa: E501 + :rtype: list[AuditLog] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataAuditLog. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataAuditLog. # noqa: E501 + :type: list[AuditLog] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataAuditLog. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataAuditLog. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataAuditLog. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataAuditLog. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataAuditLog. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataAuditLog. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataAuditLog. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataAuditLog. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataAuditLog. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataAuditLog. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataAuditLog. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataAuditLog. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataAuditLog, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataAuditLog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_customer.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_customer.py new file mode 100644 index 0000000..665fa1e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_customer.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataCustomer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Customer]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataCustomer - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataCustomer. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataCustomer. # noqa: E501 + :rtype: list[Customer] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataCustomer. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataCustomer. # noqa: E501 + :type: list[Customer] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataCustomer. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataCustomer. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataCustomer. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataCustomer. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataCustomer. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataCustomer. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataCustomer. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataCustomer. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataCustomer. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataCustomer. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataCustomer. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataCustomer. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataCustomer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataCustomer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_dashboard_info.py new file mode 100644 index 0000000..d435edf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_dashboard_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DashboardInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDashboardInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDashboardInfo. # noqa: E501 + :rtype: list[DashboardInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDashboardInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDashboardInfo. # noqa: E501 + :type: list[DashboardInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDashboardInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDashboardInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDashboardInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDashboardInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDashboardInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDashboardInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDashboardInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDashboardInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDashboardInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device.py new file mode 100644 index 0000000..30d423c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDevice(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Device]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDevice - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDevice. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDevice. # noqa: E501 + :rtype: list[Device] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDevice. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDevice. # noqa: E501 + :type: list[Device] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDevice. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDevice. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDevice. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDevice. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDevice. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDevice. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDevice. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDevice. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDevice. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDevice. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDevice. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDevice. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDevice, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDevice): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_info.py new file mode 100644 index 0000000..b14eb9e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDeviceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DeviceInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDeviceInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDeviceInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDeviceInfo. # noqa: E501 + :rtype: list[DeviceInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDeviceInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDeviceInfo. # noqa: E501 + :type: list[DeviceInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDeviceInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDeviceInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDeviceInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDeviceInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDeviceInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDeviceInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDeviceInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDeviceInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDeviceInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDeviceInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDeviceInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDeviceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDeviceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_profile.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_profile.py new file mode 100644 index 0000000..581e72c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_profile.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDeviceProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DeviceProfile]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDeviceProfile - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDeviceProfile. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDeviceProfile. # noqa: E501 + :rtype: list[DeviceProfile] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDeviceProfile. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDeviceProfile. # noqa: E501 + :type: list[DeviceProfile] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDeviceProfile. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDeviceProfile. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDeviceProfile. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDeviceProfile. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDeviceProfile. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDeviceProfile. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDeviceProfile. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDeviceProfile. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDeviceProfile. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDeviceProfile. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDeviceProfile. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDeviceProfile. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDeviceProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDeviceProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_profile_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_profile_info.py new file mode 100644 index 0000000..0e47110 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_device_profile_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataDeviceProfileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[DeviceProfileInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataDeviceProfileInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataDeviceProfileInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: list[DeviceProfileInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataDeviceProfileInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataDeviceProfileInfo. # noqa: E501 + :type: list[DeviceProfileInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataDeviceProfileInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataDeviceProfileInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataDeviceProfileInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataDeviceProfileInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataDeviceProfileInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataDeviceProfileInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataDeviceProfileInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataDeviceProfileInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataDeviceProfileInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataDeviceProfileInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataDeviceProfileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataDeviceProfileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge.py new file mode 100644 index 0000000..5260b16 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Edge]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdge - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdge. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdge. # noqa: E501 + :rtype: list[Edge] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdge. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdge. # noqa: E501 + :type: list[Edge] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdge. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdge. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdge. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdge. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdge. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdge. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdge. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdge. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge_event.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge_event.py new file mode 100644 index 0000000..28ff883 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeEvent]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeEvent. # noqa: E501 + :rtype: list[EdgeEvent] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeEvent. # noqa: E501 + :type: list[EdgeEvent] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge_info.py new file mode 100644 index 0000000..bb23017 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_edge_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeInfo. # noqa: E501 + :rtype: list[EdgeInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeInfo. # noqa: E501 + :type: list[EdgeInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_data.py new file mode 100644 index 0000000..6f37628 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_data.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityData]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityData - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityData. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityData. # noqa: E501 + :rtype: list[EntityData] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityData. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityData. # noqa: E501 + :type: list[EntityData] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityData. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityData. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityData. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityData. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityData. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityData. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityData. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityData. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityData. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityData. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityData. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityData. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_info.py new file mode 100644 index 0000000..8345b50 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_version.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_version.py new file mode 100644 index 0000000..7435129 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_version.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityVersion]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityVersion. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityVersion. # noqa: E501 + :rtype: list[EntityVersion] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityVersion. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityVersion. # noqa: E501 + :type: list[EntityVersion] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityVersion. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityVersion. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityVersion. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityVersion. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityVersion. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityVersion. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_view.py new file mode 100644 index 0000000..bb7e1e1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_view.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityView]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityView - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityView. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityView. # noqa: E501 + :rtype: list[EntityView] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityView. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityView. # noqa: E501 + :type: list[EntityView] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityView. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityView. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityView. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityView. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityView. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityView. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityView. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityView. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityView. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityView. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityView. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityView. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_view_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_view_info.py new file mode 100644 index 0000000..8aa7df9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_entity_view_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityViewInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityViewInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityViewInfo. # noqa: E501 + :rtype: list[EntityViewInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityViewInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityViewInfo. # noqa: E501 + :type: list[EntityViewInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityViewInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityViewInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityViewInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityViewInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityViewInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityViewInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_event.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_event.py new file mode 100644 index 0000000..af664d5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Event]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEvent. # noqa: E501 + :rtype: list[Event] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEvent. # noqa: E501 + :type: list[Event] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_event_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_event_info.py new file mode 100644 index 0000000..70d1dd8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_event_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EventInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEventInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEventInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEventInfo. # noqa: E501 + :rtype: list[EventInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEventInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEventInfo. # noqa: E501 + :type: list[EventInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEventInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEventInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEventInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEventInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEventInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEventInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEventInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEventInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification.py new file mode 100644 index 0000000..2b3c5a5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotification(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Notification]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotification - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotification. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotification. # noqa: E501 + :rtype: list[Notification] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotification. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotification. # noqa: E501 + :type: list[Notification] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotification. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotification. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotification. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotification. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotification. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotification. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotification. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotification. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotification. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotification. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotification. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotification. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotification, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotification): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_request_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_request_info.py new file mode 100644 index 0000000..d227625 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_request_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationRequestInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationRequestInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationRequestInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationRequestInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: list[NotificationRequestInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationRequestInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationRequestInfo. # noqa: E501 + :type: list[NotificationRequestInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationRequestInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationRequestInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationRequestInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationRequestInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationRequestInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationRequestInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationRequestInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationRequestInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationRequestInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationRequestInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationRequestInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationRequestInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_rule_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_rule_info.py new file mode 100644 index 0000000..f2cb24c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_rule_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationRuleInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationRuleInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationRuleInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationRuleInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: list[NotificationRuleInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationRuleInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationRuleInfo. # noqa: E501 + :type: list[NotificationRuleInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationRuleInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationRuleInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationRuleInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationRuleInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationRuleInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationRuleInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationRuleInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationRuleInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationRuleInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationRuleInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationRuleInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationRuleInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_target.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_target.py new file mode 100644 index 0000000..560379f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_target.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationTarget(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationTarget]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationTarget - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationTarget. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationTarget. # noqa: E501 + :rtype: list[NotificationTarget] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationTarget. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationTarget. # noqa: E501 + :type: list[NotificationTarget] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationTarget. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationTarget. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationTarget. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationTarget. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationTarget. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationTarget. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationTarget. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationTarget. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationTarget. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationTarget. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationTarget. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationTarget. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationTarget, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationTarget): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_template.py new file mode 100644 index 0000000..7df8f62 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_notification_template.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[NotificationTemplate]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataNotificationTemplate. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataNotificationTemplate. # noqa: E501 + :rtype: list[NotificationTemplate] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataNotificationTemplate. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataNotificationTemplate. # noqa: E501 + :type: list[NotificationTemplate] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataNotificationTemplate. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataNotificationTemplate. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataNotificationTemplate. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataNotificationTemplate. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataNotificationTemplate. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataNotificationTemplate. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataNotificationTemplate. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataNotificationTemplate. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataNotificationTemplate. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataNotificationTemplate. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_ota_package_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_ota_package_info.py new file mode 100644 index 0000000..e781dc2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_ota_package_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataOtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[OtaPackageInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataOtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataOtaPackageInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: list[OtaPackageInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataOtaPackageInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataOtaPackageInfo. # noqa: E501 + :type: list[OtaPackageInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataOtaPackageInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataOtaPackageInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataOtaPackageInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataOtaPackageInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataOtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataOtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_queue.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_queue.py new file mode 100644 index 0000000..6930283 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_queue.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataQueue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Queue]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataQueue - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataQueue. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataQueue. # noqa: E501 + :rtype: list[Queue] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataQueue. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataQueue. # noqa: E501 + :type: list[Queue] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataQueue. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataQueue. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataQueue. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataQueue. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataQueue. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataQueue. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataQueue. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataQueue. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataQueue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataQueue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_rpc.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_rpc.py new file mode 100644 index 0000000..b8fd697 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_rpc.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRpc(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Rpc]', + 'has_next': 'bool', + 'total_elements': 'int', + 'total_pages': 'int' + } + + attribute_map = { + 'data': 'data', + 'has_next': 'hasNext', + 'total_elements': 'totalElements', + 'total_pages': 'totalPages' + } + + def __init__(self, data=None, has_next=None, total_elements=None, total_pages=None): # noqa: E501 + """PageDataRpc - a model defined in Swagger""" # noqa: E501 + self._data = None + self._has_next = None + self._total_elements = None + self._total_pages = None + self.discriminator = None + if data is not None: + self.data = data + if has_next is not None: + self.has_next = has_next + if total_elements is not None: + self.total_elements = total_elements + if total_pages is not None: + self.total_pages = total_pages + + @property + def data(self): + """Gets the data of this PageDataRpc. # noqa: E501 + + + :return: The data of this PageDataRpc. # noqa: E501 + :rtype: list[Rpc] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRpc. + + + :param data: The data of this PageDataRpc. # noqa: E501 + :type: list[Rpc] + """ + + self._data = data + + @property + def has_next(self): + """Gets the has_next of this PageDataRpc. # noqa: E501 + + + :return: The has_next of this PageDataRpc. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRpc. + + + :param has_next: The has_next of this PageDataRpc. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRpc. # noqa: E501 + + + :return: The total_elements of this PageDataRpc. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRpc. + + + :param total_elements: The total_elements of this PageDataRpc. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRpc. # noqa: E501 + + + :return: The total_pages of this PageDataRpc. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRpc. + + + :param total_pages: The total_pages of this PageDataRpc. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRpc, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRpc): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_rule_chain.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_rule_chain.py new file mode 100644 index 0000000..0e4dc56 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_rule_chain.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[RuleChain]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataRuleChain - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataRuleChain. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataRuleChain. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRuleChain. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataRuleChain. # noqa: E501 + :type: list[RuleChain] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRuleChain. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRuleChain. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRuleChain. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRuleChain. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataRuleChain. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataRuleChain. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRuleChain. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataRuleChain. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tb_resource_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tb_resource_info.py new file mode 100644 index 0000000..67a0fec --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tb_resource_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TbResourceInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTbResourceInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTbResourceInfo. # noqa: E501 + :rtype: list[TbResourceInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTbResourceInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTbResourceInfo. # noqa: E501 + :type: list[TbResourceInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTbResourceInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTbResourceInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTbResourceInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTbResourceInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTbResourceInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTbResourceInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant.py new file mode 100644 index 0000000..2a9fc38 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTenant(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Tenant]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTenant - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTenant. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTenant. # noqa: E501 + :rtype: list[Tenant] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTenant. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTenant. # noqa: E501 + :type: list[Tenant] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTenant. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTenant. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTenant. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTenant. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTenant. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTenant. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTenant. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTenant. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTenant. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTenant. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTenant. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTenant. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTenant, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTenant): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant_info.py new file mode 100644 index 0000000..01e0342 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTenantInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TenantInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTenantInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTenantInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTenantInfo. # noqa: E501 + :rtype: list[TenantInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTenantInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTenantInfo. # noqa: E501 + :type: list[TenantInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTenantInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTenantInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTenantInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTenantInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTenantInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTenantInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTenantInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTenantInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTenantInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTenantInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTenantInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTenantInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTenantInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTenantInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant_profile.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant_profile.py new file mode 100644 index 0000000..f9b45fe --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_tenant_profile.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTenantProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TenantProfile]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTenantProfile - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTenantProfile. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTenantProfile. # noqa: E501 + :rtype: list[TenantProfile] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTenantProfile. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTenantProfile. # noqa: E501 + :type: list[TenantProfile] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTenantProfile. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTenantProfile. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTenantProfile. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTenantProfile. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTenantProfile. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTenantProfile. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTenantProfile. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTenantProfile. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTenantProfile. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTenantProfile. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTenantProfile. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTenantProfile. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTenantProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTenantProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_user.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_user.py new file mode 100644 index 0000000..736448b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_user.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUser(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[User]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUser - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUser. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUser. # noqa: E501 + :rtype: list[User] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUser. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUser. # noqa: E501 + :type: list[User] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUser. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUser. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUser. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUser. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUser. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUser. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUser. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUser. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUser. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUser. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUser. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUser. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUser, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUser): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_user_email_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_user_email_info.py new file mode 100644 index 0000000..08490cb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_user_email_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[UserEmailInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUserEmailInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUserEmailInfo. # noqa: E501 + :rtype: list[UserEmailInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUserEmailInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUserEmailInfo. # noqa: E501 + :type: list[UserEmailInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUserEmailInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUserEmailInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUserEmailInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUserEmailInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUserEmailInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUserEmailInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_widgets_bundle.py b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_widgets_bundle.py new file mode 100644 index 0000000..71403fb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/page_data_widgets_bundle.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataWidgetsBundle(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[WidgetsBundle]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataWidgetsBundle - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataWidgetsBundle. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataWidgetsBundle. # noqa: E501 + :rtype: list[WidgetsBundle] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataWidgetsBundle. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataWidgetsBundle. # noqa: E501 + :type: list[WidgetsBundle] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataWidgetsBundle. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataWidgetsBundle. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataWidgetsBundle. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataWidgetsBundle. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataWidgetsBundle. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataWidgetsBundle. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataWidgetsBundle. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataWidgetsBundle. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataWidgetsBundle. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataWidgetsBundle. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataWidgetsBundle. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataWidgetsBundle. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataWidgetsBundle, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataWidgetsBundle): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/platform_two_fa_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/platform_two_fa_settings.py new file mode 100644 index 0000000..efa2e2b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/platform_two_fa_settings.py @@ -0,0 +1,231 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PlatformTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'max_verification_failures_before_user_lockout': 'int', + 'min_verification_code_send_period': 'int', + 'providers': 'list[TwoFaProviderConfig]', + 'total_allowed_time_for_verification': 'int', + 'verification_code_check_rate_limit': 'str' + } + + attribute_map = { + 'max_verification_failures_before_user_lockout': 'maxVerificationFailuresBeforeUserLockout', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'providers': 'providers', + 'total_allowed_time_for_verification': 'totalAllowedTimeForVerification', + 'verification_code_check_rate_limit': 'verificationCodeCheckRateLimit' + } + + def __init__(self, max_verification_failures_before_user_lockout=None, min_verification_code_send_period=None, providers=None, total_allowed_time_for_verification=None, verification_code_check_rate_limit=None): # noqa: E501 + """PlatformTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._max_verification_failures_before_user_lockout = None + self._min_verification_code_send_period = None + self._providers = None + self._total_allowed_time_for_verification = None + self._verification_code_check_rate_limit = None + self.discriminator = None + if max_verification_failures_before_user_lockout is not None: + self.max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + self.min_verification_code_send_period = min_verification_code_send_period + self.providers = providers + self.total_allowed_time_for_verification = total_allowed_time_for_verification + if verification_code_check_rate_limit is not None: + self.verification_code_check_rate_limit = verification_code_check_rate_limit + + @property + def max_verification_failures_before_user_lockout(self): + """Gets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._max_verification_failures_before_user_lockout + + @max_verification_failures_before_user_lockout.setter + def max_verification_failures_before_user_lockout(self, max_verification_failures_before_user_lockout): + """Sets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. + + + :param max_verification_failures_before_user_lockout: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + + self._max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this PlatformTwoFaSettings. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if min_verification_code_send_period is None: + raise ValueError("Invalid value for `min_verification_code_send_period`, must not be `None`") # noqa: E501 + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def providers(self): + """Gets the providers of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The providers of this PlatformTwoFaSettings. # noqa: E501 + :rtype: list[TwoFaProviderConfig] + """ + return self._providers + + @providers.setter + def providers(self, providers): + """Sets the providers of this PlatformTwoFaSettings. + + + :param providers: The providers of this PlatformTwoFaSettings. # noqa: E501 + :type: list[TwoFaProviderConfig] + """ + if providers is None: + raise ValueError("Invalid value for `providers`, must not be `None`") # noqa: E501 + + self._providers = providers + + @property + def total_allowed_time_for_verification(self): + """Gets the total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._total_allowed_time_for_verification + + @total_allowed_time_for_verification.setter + def total_allowed_time_for_verification(self, total_allowed_time_for_verification): + """Sets the total_allowed_time_for_verification of this PlatformTwoFaSettings. + + + :param total_allowed_time_for_verification: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if total_allowed_time_for_verification is None: + raise ValueError("Invalid value for `total_allowed_time_for_verification`, must not be `None`") # noqa: E501 + + self._total_allowed_time_for_verification = total_allowed_time_for_verification + + @property + def verification_code_check_rate_limit(self): + """Gets the verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :rtype: str + """ + return self._verification_code_check_rate_limit + + @verification_code_check_rate_limit.setter + def verification_code_check_rate_limit(self, verification_code_check_rate_limit): + """Sets the verification_code_check_rate_limit of this PlatformTwoFaSettings. + + + :param verification_code_check_rate_limit: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :type: str + """ + + self._verification_code_check_rate_limit = verification_code_check_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/platform_users_notification_target_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/platform_users_notification_target_config.py new file mode 100644 index 0000000..2b8b1ba --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/platform_users_notification_target_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class PlatformUsersNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'users_filter': 'UsersFilter' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'description': 'description', + 'users_filter': 'usersFilter' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, description=None, users_filter=None, *args, **kwargs): # noqa: E501 + """PlatformUsersNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self._users_filter = None + self.discriminator = None + if description is not None: + self.description = description + self.users_filter = users_filter + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def description(self): + """Gets the description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this PlatformUsersNotificationTargetConfig. + + + :param description: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def users_filter(self): + """Gets the users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: UsersFilter + """ + return self._users_filter + + @users_filter.setter + def users_filter(self, users_filter): + """Sets the users_filter of this PlatformUsersNotificationTargetConfig. + + + :param users_filter: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: UsersFilter + """ + if users_filter is None: + raise ValueError("Invalid value for `users_filter`, must not be `None`") # noqa: E501 + + self._users_filter = users_filter + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformUsersNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformUsersNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/power_saving_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/power_saving_configuration.py new file mode 100644 index 0000000..07a43e0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/power_saving_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PowerSavingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None): # noqa: E501 + """PowerSavingConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this PowerSavingConfiguration. + + + :param edrx_cycle: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this PowerSavingConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this PowerSavingConfiguration. # noqa: E501 + + + :return: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this PowerSavingConfiguration. + + + :param power_mode: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this PowerSavingConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PowerSavingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PowerSavingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/processing_strategy.py b/tb-rest-client/python/tb_rest_client/models/models_ce/processing_strategy.py new file mode 100644 index 0000000..a23adbe --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/processing_strategy.py @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ProcessingStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'failure_percentage': 'float', + 'max_pause_between_retries': 'int', + 'pause_between_retries': 'int', + 'retries': 'int', + 'type': 'str' + } + + attribute_map = { + 'failure_percentage': 'failurePercentage', + 'max_pause_between_retries': 'maxPauseBetweenRetries', + 'pause_between_retries': 'pauseBetweenRetries', + 'retries': 'retries', + 'type': 'type' + } + + def __init__(self, failure_percentage=None, max_pause_between_retries=None, pause_between_retries=None, retries=None, type=None): # noqa: E501 + """ProcessingStrategy - a model defined in Swagger""" # noqa: E501 + self._failure_percentage = None + self._max_pause_between_retries = None + self._pause_between_retries = None + self._retries = None + self._type = None + self.discriminator = None + if failure_percentage is not None: + self.failure_percentage = failure_percentage + if max_pause_between_retries is not None: + self.max_pause_between_retries = max_pause_between_retries + if pause_between_retries is not None: + self.pause_between_retries = pause_between_retries + if retries is not None: + self.retries = retries + if type is not None: + self.type = type + + @property + def failure_percentage(self): + """Gets the failure_percentage of this ProcessingStrategy. # noqa: E501 + + + :return: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :rtype: float + """ + return self._failure_percentage + + @failure_percentage.setter + def failure_percentage(self, failure_percentage): + """Sets the failure_percentage of this ProcessingStrategy. + + + :param failure_percentage: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :type: float + """ + + self._failure_percentage = failure_percentage + + @property + def max_pause_between_retries(self): + """Gets the max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._max_pause_between_retries + + @max_pause_between_retries.setter + def max_pause_between_retries(self, max_pause_between_retries): + """Sets the max_pause_between_retries of this ProcessingStrategy. + + + :param max_pause_between_retries: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._max_pause_between_retries = max_pause_between_retries + + @property + def pause_between_retries(self): + """Gets the pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._pause_between_retries + + @pause_between_retries.setter + def pause_between_retries(self, pause_between_retries): + """Sets the pause_between_retries of this ProcessingStrategy. + + + :param pause_between_retries: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._pause_between_retries = pause_between_retries + + @property + def retries(self): + """Gets the retries of this ProcessingStrategy. # noqa: E501 + + + :return: The retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this ProcessingStrategy. + + + :param retries: The retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def type(self): + """Gets the type of this ProcessingStrategy. # noqa: E501 + + + :return: The type of this ProcessingStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ProcessingStrategy. + + + :param type: The type of this ProcessingStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["RETRY_ALL", "RETRY_FAILED", "RETRY_FAILED_AND_TIMED_OUT", "RETRY_TIMED_OUT", "SKIP_ALL_FAILURES", "SKIP_ALL_FAILURES_AND_TIMED_OUT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProcessingStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProcessingStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/proto_transport_payload_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/proto_transport_payload_configuration.py new file mode 100644 index 0000000..ec66f53 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/proto_transport_payload_configuration.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class ProtoTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_proto_schema': 'str', + 'device_rpc_request_proto_schema': 'str', + 'device_rpc_response_proto_schema': 'str', + 'device_telemetry_proto_schema': 'str', + 'enable_compatibility_with_json_payload_format': 'bool', + 'use_json_payload_format_for_default_downlink_topics': 'bool' + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + 'device_attributes_proto_schema': 'deviceAttributesProtoSchema', + 'device_rpc_request_proto_schema': 'deviceRpcRequestProtoSchema', + 'device_rpc_response_proto_schema': 'deviceRpcResponseProtoSchema', + 'device_telemetry_proto_schema': 'deviceTelemetryProtoSchema', + 'enable_compatibility_with_json_payload_format': 'enableCompatibilityWithJsonPayloadFormat', + 'use_json_payload_format_for_default_downlink_topics': 'useJsonPayloadFormatForDefaultDownlinkTopics' + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, device_attributes_proto_schema=None, device_rpc_request_proto_schema=None, device_rpc_response_proto_schema=None, device_telemetry_proto_schema=None, enable_compatibility_with_json_payload_format=None, use_json_payload_format_for_default_downlink_topics=None, *args, **kwargs): # noqa: E501 + """ProtoTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_proto_schema = None + self._device_rpc_request_proto_schema = None + self._device_rpc_response_proto_schema = None + self._device_telemetry_proto_schema = None + self._enable_compatibility_with_json_payload_format = None + self._use_json_payload_format_for_default_downlink_topics = None + self.discriminator = None + if device_attributes_proto_schema is not None: + self.device_attributes_proto_schema = device_attributes_proto_schema + if device_rpc_request_proto_schema is not None: + self.device_rpc_request_proto_schema = device_rpc_request_proto_schema + if device_rpc_response_proto_schema is not None: + self.device_rpc_response_proto_schema = device_rpc_response_proto_schema + if device_telemetry_proto_schema is not None: + self.device_telemetry_proto_schema = device_telemetry_proto_schema + if enable_compatibility_with_json_payload_format is not None: + self.enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + if use_json_payload_format_for_default_downlink_topics is not None: + self.use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def device_attributes_proto_schema(self): + """Gets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_proto_schema + + @device_attributes_proto_schema.setter + def device_attributes_proto_schema(self, device_attributes_proto_schema): + """Sets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_attributes_proto_schema: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_proto_schema = device_attributes_proto_schema + + @property + def device_rpc_request_proto_schema(self): + """Gets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_request_proto_schema + + @device_rpc_request_proto_schema.setter + def device_rpc_request_proto_schema(self, device_rpc_request_proto_schema): + """Sets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_request_proto_schema: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_request_proto_schema = device_rpc_request_proto_schema + + @property + def device_rpc_response_proto_schema(self): + """Gets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_response_proto_schema + + @device_rpc_response_proto_schema.setter + def device_rpc_response_proto_schema(self, device_rpc_response_proto_schema): + """Sets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_response_proto_schema: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_response_proto_schema = device_rpc_response_proto_schema + + @property + def device_telemetry_proto_schema(self): + """Gets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_proto_schema + + @device_telemetry_proto_schema.setter + def device_telemetry_proto_schema(self, device_telemetry_proto_schema): + """Sets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_telemetry_proto_schema: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_proto_schema = device_telemetry_proto_schema + + @property + def enable_compatibility_with_json_payload_format(self): + """Gets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._enable_compatibility_with_json_payload_format + + @enable_compatibility_with_json_payload_format.setter + def enable_compatibility_with_json_payload_format(self, enable_compatibility_with_json_payload_format): + """Sets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. + + + :param enable_compatibility_with_json_payload_format: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + + @property + def use_json_payload_format_for_default_downlink_topics(self): + """Gets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._use_json_payload_format_for_default_downlink_topics + + @use_json_payload_format_for_default_downlink_topics.setter + def use_json_payload_format_for_default_downlink_topics(self, use_json_payload_format_for_default_downlink_topics): + """Sets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. + + + :param use_json_payload_format_for_default_downlink_topics: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProtoTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProtoTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/psklw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_ce/psklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..e8b56e1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/psklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential # noqa: F401,E501 + +class PSKLwM2MBootstrapServerCredential(LwM2MBootstrapServerCredential): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + if hasattr(LwM2MBootstrapServerCredential, "swagger_types"): + swagger_types.update(LwM2MBootstrapServerCredential.swagger_types) + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + if hasattr(LwM2MBootstrapServerCredential, "attribute_map"): + attribute_map.update(LwM2MBootstrapServerCredential.attribute_map) + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None, *args, **kwargs): # noqa: E501 + """PSKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + LwM2MBootstrapServerCredential.__init__(self, *args, **kwargs) + + @property + def short_server_id(self): + """Gets the short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this PSKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this PSKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this PSKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this PSKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this PSKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this PSKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PSKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PSKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/queue.py b/tb-rest-client/python/tb_rest_client/models/models_ce/queue.py new file mode 100644 index 0000000..e16d8fc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/queue.py @@ -0,0 +1,410 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Queue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'created_time': 'int', + 'id': 'QueueId', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'tenant_id': 'TenantId', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'tenant_id': 'tenantId', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, created_time=None, id=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, tenant_id=None, topic=None): # noqa: E501 + """Queue - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._created_time = None + self._id = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._tenant_id = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if tenant_id is not None: + self.tenant_id = tenant_id + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this Queue. # noqa: E501 + + + :return: The additional_info of this Queue. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Queue. + + + :param additional_info: The additional_info of this Queue. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this Queue. # noqa: E501 + + + :return: The consumer_per_partition of this Queue. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this Queue. + + + :param consumer_per_partition: The consumer_per_partition of this Queue. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def created_time(self): + """Gets the created_time of this Queue. # noqa: E501 + + + :return: The created_time of this Queue. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Queue. + + + :param created_time: The created_time of this Queue. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Queue. # noqa: E501 + + + :return: The id of this Queue. # noqa: E501 + :rtype: QueueId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Queue. + + + :param id: The id of this Queue. # noqa: E501 + :type: QueueId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Queue. # noqa: E501 + + + :return: The name of this Queue. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Queue. + + + :param name: The name of this Queue. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this Queue. # noqa: E501 + + + :return: The pack_processing_timeout of this Queue. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this Queue. + + + :param pack_processing_timeout: The pack_processing_timeout of this Queue. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this Queue. # noqa: E501 + + + :return: The partitions of this Queue. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this Queue. + + + :param partitions: The partitions of this Queue. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this Queue. # noqa: E501 + + + :return: The poll_interval of this Queue. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this Queue. + + + :param poll_interval: The poll_interval of this Queue. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this Queue. # noqa: E501 + + + :return: The processing_strategy of this Queue. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this Queue. + + + :param processing_strategy: The processing_strategy of this Queue. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this Queue. # noqa: E501 + + + :return: The submit_strategy of this Queue. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this Queue. + + + :param submit_strategy: The submit_strategy of this Queue. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def tenant_id(self): + """Gets the tenant_id of this Queue. # noqa: E501 + + + :return: The tenant_id of this Queue. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Queue. + + + :param tenant_id: The tenant_id of this Queue. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def topic(self): + """Gets the topic of this Queue. # noqa: E501 + + + :return: The topic of this Queue. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this Queue. + + + :param topic: The topic of this Queue. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Queue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Queue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/queue_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/queue_id.py new file mode 100644 index 0000000..163108c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/queue_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class QueueId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """QueueId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this QueueId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this QueueId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this QueueId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this QueueId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this QueueId. # noqa: E501 + + + :return: The entity_type of this QueueId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this QueueId. + + + :param entity_type: The entity_type of this QueueId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(QueueId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, QueueId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/relation_entity_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/relation_entity_type_filter.py new file mode 100644 index 0000000..027ad9c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/relation_entity_type_filter.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationEntityTypeFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_types': 'list[str]' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_types': 'entityTypes' + } + + def __init__(self, relation_type=None, entity_types=None): # noqa: E501 + """RelationEntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_types = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_types is not None: + self.entity_types = entity_types + + @property + def relation_type(self): + """Gets the relation_type of this RelationEntityTypeFilter. # noqa: E501 + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RelationEntityTypeFilter. + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_types(self): + """Gets the entity_types of this RelationEntityTypeFilter. # noqa: E501 + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :return: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this RelationEntityTypeFilter. + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :param entity_types: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationEntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationEntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/relations_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/relations_query_filter.py new file mode 100644 index 0000000..96be25a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/relations_query_filter.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class RelationsQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'filters': 'list[RelationEntityTypeFilter]', + 'max_level': 'int', + 'multi_root': 'bool', + 'multi_root_entities_type': 'str', + 'multi_root_entity_ids': 'list[str]', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'filters': 'filters', + 'max_level': 'maxLevel', + 'multi_root': 'multiRoot', + 'multi_root_entities_type': 'multiRootEntitiesType', + 'multi_root_entity_ids': 'multiRootEntityIds', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, fetch_last_level_only=None, filters=None, max_level=None, multi_root=None, multi_root_entities_type=None, multi_root_entity_ids=None, root_entity=None, *args, **kwargs): # noqa: E501 + """RelationsQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._fetch_last_level_only = None + self._filters = None + self._max_level = None + self._multi_root = None + self._multi_root_entities_type = None + self._multi_root_entity_ids = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if filters is not None: + self.filters = filters + if max_level is not None: + self.max_level = max_level + if multi_root is not None: + self.multi_root = multi_root + if multi_root_entities_type is not None: + self.multi_root_entities_type = multi_root_entities_type + if multi_root_entity_ids is not None: + self.multi_root_entity_ids = multi_root_entity_ids + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this RelationsQueryFilter. # noqa: E501 + + + :return: The direction of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsQueryFilter. + + + :param direction: The direction of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def filters(self): + """Gets the filters of this RelationsQueryFilter. # noqa: E501 + + + :return: The filters of this RelationsQueryFilter. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this RelationsQueryFilter. + + + :param filters: The filters of this RelationsQueryFilter. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def max_level(self): + """Gets the max_level of this RelationsQueryFilter. # noqa: E501 + + + :return: The max_level of this RelationsQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsQueryFilter. + + + :param max_level: The max_level of this RelationsQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def multi_root(self): + """Gets the multi_root of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._multi_root + + @multi_root.setter + def multi_root(self, multi_root): + """Sets the multi_root of this RelationsQueryFilter. + + + :param multi_root: The multi_root of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._multi_root = multi_root + + @property + def multi_root_entities_type(self): + """Gets the multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._multi_root_entities_type + + @multi_root_entities_type.setter + def multi_root_entities_type(self, multi_root_entities_type): + """Sets the multi_root_entities_type of this RelationsQueryFilter. + + + :param multi_root_entities_type: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if multi_root_entities_type not in allowed_values: + raise ValueError( + "Invalid value for `multi_root_entities_type` ({0}), must be one of {1}" # noqa: E501 + .format(multi_root_entities_type, allowed_values) + ) + + self._multi_root_entities_type = multi_root_entities_type + + @property + def multi_root_entity_ids(self): + """Gets the multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._multi_root_entity_ids + + @multi_root_entity_ids.setter + def multi_root_entity_ids(self, multi_root_entity_ids): + """Sets the multi_root_entity_ids of this RelationsQueryFilter. + + + :param multi_root_entity_ids: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._multi_root_entity_ids = multi_root_entity_ids + + @property + def root_entity(self): + """Gets the root_entity of this RelationsQueryFilter. # noqa: E501 + + + :return: The root_entity of this RelationsQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this RelationsQueryFilter. + + + :param root_entity: The root_entity of this RelationsQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/relations_search_parameters.py b/tb-rest-client/python/tb_rest_client/models/models_ce/relations_search_parameters.py new file mode 100644 index 0000000..b1f4c1e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/relations_search_parameters.py @@ -0,0 +1,284 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationsSearchParameters(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'root_id': 'str', + 'root_type': 'str', + 'direction': 'str', + 'relation_type_group': 'str', + 'max_level': 'int', + 'fetch_last_level_only': 'bool' + } + + attribute_map = { + 'root_id': 'rootId', + 'root_type': 'rootType', + 'direction': 'direction', + 'relation_type_group': 'relationTypeGroup', + 'max_level': 'maxLevel', + 'fetch_last_level_only': 'fetchLastLevelOnly' + } + + def __init__(self, root_id=None, root_type=None, direction=None, relation_type_group=None, max_level=None, fetch_last_level_only=None): # noqa: E501 + """RelationsSearchParameters - a model defined in Swagger""" # noqa: E501 + self._root_id = None + self._root_type = None + self._direction = None + self._relation_type_group = None + self._max_level = None + self._fetch_last_level_only = None + self.discriminator = None + if root_id is not None: + self.root_id = root_id + if root_type is not None: + self.root_type = root_type + if direction is not None: + self.direction = direction + if relation_type_group is not None: + self.relation_type_group = relation_type_group + if max_level is not None: + self.max_level = max_level + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + + @property + def root_id(self): + """Gets the root_id of this RelationsSearchParameters. # noqa: E501 + + Root entity id to start search from. # noqa: E501 + + :return: The root_id of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_id + + @root_id.setter + def root_id(self, root_id): + """Sets the root_id of this RelationsSearchParameters. + + Root entity id to start search from. # noqa: E501 + + :param root_id: The root_id of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + + self._root_id = root_id + + @property + def root_type(self): + """Gets the root_type of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The root_type of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_type + + @root_type.setter + def root_type(self, root_type): + """Sets the root_type of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param root_type: The root_type of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if root_type not in allowed_values: + raise ValueError( + "Invalid value for `root_type` ({0}), must be one of {1}" # noqa: E501 + .format(root_type, allowed_values) + ) + + self._root_type = root_type + + @property + def direction(self): + """Gets the direction of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The direction of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param direction: The direction of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def relation_type_group(self): + """Gets the relation_type_group of this RelationsSearchParameters. # noqa: E501 + + Type of the relation. # noqa: E501 + + :return: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._relation_type_group + + @relation_type_group.setter + def relation_type_group(self, relation_type_group): + """Sets the relation_type_group of this RelationsSearchParameters. + + Type of the relation. # noqa: E501 + + :param relation_type_group: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if relation_type_group not in allowed_values: + raise ValueError( + "Invalid value for `relation_type_group` ({0}), must be one of {1}" # noqa: E501 + .format(relation_type_group, allowed_values) + ) + + self._relation_type_group = relation_type_group + + @property + def max_level(self): + """Gets the max_level of this RelationsSearchParameters. # noqa: E501 + + Maximum level of the search depth. # noqa: E501 + + :return: The max_level of this RelationsSearchParameters. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsSearchParameters. + + Maximum level of the search depth. # noqa: E501 + + :param max_level: The max_level of this RelationsSearchParameters. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :return: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsSearchParameters. + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsSearchParameters, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsSearchParameters): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/repeating_alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_ce/repeating_alarm_condition_spec.py new file mode 100644 index 0000000..f0a1f7a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/repeating_alarm_condition_spec.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class RepeatingAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValueint' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, *args, **kwargs): # noqa: E501 + """RepeatingAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValueint + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this RepeatingAlarmConditionSpec. + + + :param predicate: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValueint + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepeatingAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepeatingAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/repository_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/repository_settings.py new file mode 100644 index 0000000..ea6ee37 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/repository_settings.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_method': 'str', + 'default_branch': 'str', + 'password': 'str', + 'private_key': 'str', + 'private_key_file_name': 'str', + 'private_key_password': 'str', + 'read_only': 'bool', + 'repository_uri': 'str', + 'show_merge_commits': 'bool', + 'username': 'str' + } + + attribute_map = { + 'auth_method': 'authMethod', + 'default_branch': 'defaultBranch', + 'password': 'password', + 'private_key': 'privateKey', + 'private_key_file_name': 'privateKeyFileName', + 'private_key_password': 'privateKeyPassword', + 'read_only': 'readOnly', + 'repository_uri': 'repositoryUri', + 'show_merge_commits': 'showMergeCommits', + 'username': 'username' + } + + def __init__(self, auth_method=None, default_branch=None, password=None, private_key=None, private_key_file_name=None, private_key_password=None, read_only=None, repository_uri=None, show_merge_commits=None, username=None): # noqa: E501 + """RepositorySettings - a model defined in Swagger""" # noqa: E501 + self._auth_method = None + self._default_branch = None + self._password = None + self._private_key = None + self._private_key_file_name = None + self._private_key_password = None + self._read_only = None + self._repository_uri = None + self._show_merge_commits = None + self._username = None + self.discriminator = None + if auth_method is not None: + self.auth_method = auth_method + if default_branch is not None: + self.default_branch = default_branch + if password is not None: + self.password = password + if private_key is not None: + self.private_key = private_key + if private_key_file_name is not None: + self.private_key_file_name = private_key_file_name + if private_key_password is not None: + self.private_key_password = private_key_password + if read_only is not None: + self.read_only = read_only + if repository_uri is not None: + self.repository_uri = repository_uri + if show_merge_commits is not None: + self.show_merge_commits = show_merge_commits + if username is not None: + self.username = username + + @property + def auth_method(self): + """Gets the auth_method of this RepositorySettings. # noqa: E501 + + + :return: The auth_method of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._auth_method + + @auth_method.setter + def auth_method(self, auth_method): + """Sets the auth_method of this RepositorySettings. + + + :param auth_method: The auth_method of this RepositorySettings. # noqa: E501 + :type: str + """ + allowed_values = ["PRIVATE_KEY", "USERNAME_PASSWORD"] # noqa: E501 + if auth_method not in allowed_values: + raise ValueError( + "Invalid value for `auth_method` ({0}), must be one of {1}" # noqa: E501 + .format(auth_method, allowed_values) + ) + + self._auth_method = auth_method + + @property + def default_branch(self): + """Gets the default_branch of this RepositorySettings. # noqa: E501 + + + :return: The default_branch of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._default_branch + + @default_branch.setter + def default_branch(self, default_branch): + """Sets the default_branch of this RepositorySettings. + + + :param default_branch: The default_branch of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._default_branch = default_branch + + @property + def password(self): + """Gets the password of this RepositorySettings. # noqa: E501 + + + :return: The password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this RepositorySettings. + + + :param password: The password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def private_key(self): + """Gets the private_key of this RepositorySettings. # noqa: E501 + + + :return: The private_key of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key + + @private_key.setter + def private_key(self, private_key): + """Sets the private_key of this RepositorySettings. + + + :param private_key: The private_key of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key = private_key + + @property + def private_key_file_name(self): + """Gets the private_key_file_name of this RepositorySettings. # noqa: E501 + + + :return: The private_key_file_name of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_file_name + + @private_key_file_name.setter + def private_key_file_name(self, private_key_file_name): + """Sets the private_key_file_name of this RepositorySettings. + + + :param private_key_file_name: The private_key_file_name of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_file_name = private_key_file_name + + @property + def private_key_password(self): + """Gets the private_key_password of this RepositorySettings. # noqa: E501 + + + :return: The private_key_password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_password + + @private_key_password.setter + def private_key_password(self, private_key_password): + """Sets the private_key_password of this RepositorySettings. + + + :param private_key_password: The private_key_password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_password = private_key_password + + @property + def read_only(self): + """Gets the read_only of this RepositorySettings. # noqa: E501 + + + :return: The read_only of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettings. + + + :param read_only: The read_only of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def repository_uri(self): + """Gets the repository_uri of this RepositorySettings. # noqa: E501 + + + :return: The repository_uri of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._repository_uri + + @repository_uri.setter + def repository_uri(self, repository_uri): + """Sets the repository_uri of this RepositorySettings. + + + :param repository_uri: The repository_uri of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._repository_uri = repository_uri + + @property + def show_merge_commits(self): + """Gets the show_merge_commits of this RepositorySettings. # noqa: E501 + + + :return: The show_merge_commits of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._show_merge_commits + + @show_merge_commits.setter + def show_merge_commits(self, show_merge_commits): + """Sets the show_merge_commits of this RepositorySettings. + + + :param show_merge_commits: The show_merge_commits of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._show_merge_commits = show_merge_commits + + @property + def username(self): + """Gets the username of this RepositorySettings. # noqa: E501 + + + :return: The username of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this RepositorySettings. + + + :param username: The username of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/repository_settings_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/repository_settings_info.py new file mode 100644 index 0000000..bd45203 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/repository_settings_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettingsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configured': 'bool', + 'read_only': 'bool' + } + + attribute_map = { + 'configured': 'configured', + 'read_only': 'readOnly' + } + + def __init__(self, configured=None, read_only=None): # noqa: E501 + """RepositorySettingsInfo - a model defined in Swagger""" # noqa: E501 + self._configured = None + self._read_only = None + self.discriminator = None + if configured is not None: + self.configured = configured + if read_only is not None: + self.read_only = read_only + + @property + def configured(self): + """Gets the configured of this RepositorySettingsInfo. # noqa: E501 + + + :return: The configured of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._configured + + @configured.setter + def configured(self, configured): + """Sets the configured of this RepositorySettingsInfo. + + + :param configured: The configured of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._configured = configured + + @property + def read_only(self): + """Gets the read_only of this RepositorySettingsInfo. # noqa: E501 + + + :return: The read_only of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettingsInfo. + + + :param read_only: The read_only of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettingsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettingsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/reset_password_email_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/reset_password_email_request.py new file mode 100644 index 0000000..76819e8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/reset_password_email_request.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordEmailRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str' + } + + attribute_map = { + 'email': 'email' + } + + def __init__(self, email=None): # noqa: E501 + """ResetPasswordEmailRequest - a model defined in Swagger""" # noqa: E501 + self._email = None + self.discriminator = None + if email is not None: + self.email = email + + @property + def email(self): + """Gets the email of this ResetPasswordEmailRequest. # noqa: E501 + + The email of the user # noqa: E501 + + :return: The email of this ResetPasswordEmailRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this ResetPasswordEmailRequest. + + The email of the user # noqa: E501 + + :param email: The email of this ResetPasswordEmailRequest. # noqa: E501 + :type: str + """ + + self._email = email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordEmailRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordEmailRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/reset_password_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/reset_password_request.py new file mode 100644 index 0000000..03f1eef --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/reset_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'reset_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'reset_token': 'resetToken', + 'password': 'password' + } + + def __init__(self, reset_token=None, password=None): # noqa: E501 + """ResetPasswordRequest - a model defined in Swagger""" # noqa: E501 + self._reset_token = None + self._password = None + self.discriminator = None + if reset_token is not None: + self.reset_token = reset_token + if password is not None: + self.password = password + + @property + def reset_token(self): + """Gets the reset_token of this ResetPasswordRequest. # noqa: E501 + + The reset token to verify # noqa: E501 + + :return: The reset_token of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ResetPasswordRequest. + + The reset token to verify # noqa: E501 + + :param reset_token: The reset_token of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + @property + def password(self): + """Gets the password of this ResetPasswordRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ResetPasswordRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/resource.py b/tb-rest-client/python/tb_rest_client/models/models_ce/resource.py new file mode 100644 index 0000000..2247923 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/resource.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Resource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'file': 'str', + 'filename': 'str', + 'input_stream': 'InputStream', + 'open': 'bool', + 'readable': 'bool', + 'uri': 'str', + 'url': 'str' + } + + attribute_map = { + 'description': 'description', + 'file': 'file', + 'filename': 'filename', + 'input_stream': 'inputStream', + 'open': 'open', + 'readable': 'readable', + 'uri': 'uri', + 'url': 'url' + } + + def __init__(self, description=None, file=None, filename=None, input_stream=None, open=None, readable=None, uri=None, url=None): # noqa: E501 + """Resource - a model defined in Swagger""" # noqa: E501 + self._description = None + self._file = None + self._filename = None + self._input_stream = None + self._open = None + self._readable = None + self._uri = None + self._url = None + self.discriminator = None + if description is not None: + self.description = description + if file is not None: + self.file = file + if filename is not None: + self.filename = filename + if input_stream is not None: + self.input_stream = input_stream + if open is not None: + self.open = open + if readable is not None: + self.readable = readable + if uri is not None: + self.uri = uri + if url is not None: + self.url = url + + @property + def description(self): + """Gets the description of this Resource. # noqa: E501 + + + :return: The description of this Resource. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Resource. + + + :param description: The description of this Resource. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def file(self): + """Gets the file of this Resource. # noqa: E501 + + + :return: The file of this Resource. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this Resource. + + + :param file: The file of this Resource. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def filename(self): + """Gets the filename of this Resource. # noqa: E501 + + + :return: The filename of this Resource. # noqa: E501 + :rtype: str + """ + return self._filename + + @filename.setter + def filename(self, filename): + """Sets the filename of this Resource. + + + :param filename: The filename of this Resource. # noqa: E501 + :type: str + """ + + self._filename = filename + + @property + def input_stream(self): + """Gets the input_stream of this Resource. # noqa: E501 + + + :return: The input_stream of this Resource. # noqa: E501 + :rtype: InputStream + """ + return self._input_stream + + @input_stream.setter + def input_stream(self, input_stream): + """Sets the input_stream of this Resource. + + + :param input_stream: The input_stream of this Resource. # noqa: E501 + :type: InputStream + """ + + self._input_stream = input_stream + + @property + def open(self): + """Gets the open of this Resource. # noqa: E501 + + + :return: The open of this Resource. # noqa: E501 + :rtype: bool + """ + return self._open + + @open.setter + def open(self, open): + """Sets the open of this Resource. + + + :param open: The open of this Resource. # noqa: E501 + :type: bool + """ + + self._open = open + + @property + def readable(self): + """Gets the readable of this Resource. # noqa: E501 + + + :return: The readable of this Resource. # noqa: E501 + :rtype: bool + """ + return self._readable + + @readable.setter + def readable(self, readable): + """Sets the readable of this Resource. + + + :param readable: The readable of this Resource. # noqa: E501 + :type: bool + """ + + self._readable = readable + + @property + def uri(self): + """Gets the uri of this Resource. # noqa: E501 + + + :return: The uri of this Resource. # noqa: E501 + :rtype: str + """ + return self._uri + + @uri.setter + def uri(self, uri): + """Sets the uri of this Resource. + + + :param uri: The uri of this Resource. # noqa: E501 + :type: str + """ + + self._uri = uri + + @property + def url(self): + """Gets the url of this Resource. # noqa: E501 + + + :return: The url of this Resource. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this Resource. + + + :param url: The url of this Resource. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Resource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Resource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/response_entity.py b/tb-rest-client/python/tb_rest_client/models/models_ce/response_entity.py new file mode 100644 index 0000000..07baecb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/response_entity.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResponseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'object', + 'status_code': 'str', + 'status_code_value': 'int' + } + + attribute_map = { + 'body': 'body', + 'status_code': 'statusCode', + 'status_code_value': 'statusCodeValue' + } + + def __init__(self, body=None, status_code=None, status_code_value=None): # noqa: E501 + """ResponseEntity - a model defined in Swagger""" # noqa: E501 + self._body = None + self._status_code = None + self._status_code_value = None + self.discriminator = None + if body is not None: + self.body = body + if status_code is not None: + self.status_code = status_code + if status_code_value is not None: + self.status_code_value = status_code_value + + @property + def body(self): + """Gets the body of this ResponseEntity. # noqa: E501 + + + :return: The body of this ResponseEntity. # noqa: E501 + :rtype: object + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this ResponseEntity. + + + :param body: The body of this ResponseEntity. # noqa: E501 + :type: object + """ + + self._body = body + + @property + def status_code(self): + """Gets the status_code of this ResponseEntity. # noqa: E501 + + + :return: The status_code of this ResponseEntity. # noqa: E501 + :rtype: str + """ + return self._status_code + + @status_code.setter + def status_code(self, status_code): + """Sets the status_code of this ResponseEntity. + + + :param status_code: The status_code of this ResponseEntity. # noqa: E501 + :type: str + """ + allowed_values = ["ACCEPTED", "ALREADY_REPORTED", "BAD_GATEWAY", "BAD_REQUEST", "BANDWIDTH_LIMIT_EXCEEDED", "CHECKPOINT", "CONFLICT", "CONTINUE", "CREATED", "DESTINATION_LOCKED", "EXPECTATION_FAILED", "FAILED_DEPENDENCY", "FORBIDDEN", "FOUND", "GATEWAY_TIMEOUT", "GONE", "HTTP_VERSION_NOT_SUPPORTED", "IM_USED", "INSUFFICIENT_SPACE_ON_RESOURCE", "INSUFFICIENT_STORAGE", "INTERNAL_SERVER_ERROR", "I_AM_A_TEAPOT", "LENGTH_REQUIRED", "LOCKED", "LOOP_DETECTED", "METHOD_FAILURE", "METHOD_NOT_ALLOWED", "MOVED_PERMANENTLY", "MOVED_TEMPORARILY", "MULTIPLE_CHOICES", "MULTI_STATUS", "NETWORK_AUTHENTICATION_REQUIRED", "NON_AUTHORITATIVE_INFORMATION", "NOT_ACCEPTABLE", "NOT_EXTENDED", "NOT_FOUND", "NOT_IMPLEMENTED", "NOT_MODIFIED", "NO_CONTENT", "OK", "PARTIAL_CONTENT", "PAYLOAD_TOO_LARGE", "PAYMENT_REQUIRED", "PERMANENT_REDIRECT", "PRECONDITION_FAILED", "PRECONDITION_REQUIRED", "PROCESSING", "PROXY_AUTHENTICATION_REQUIRED", "REQUESTED_RANGE_NOT_SATISFIABLE", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_HEADER_FIELDS_TOO_LARGE", "REQUEST_TIMEOUT", "REQUEST_URI_TOO_LONG", "RESET_CONTENT", "SEE_OTHER", "SERVICE_UNAVAILABLE", "SWITCHING_PROTOCOLS", "TEMPORARY_REDIRECT", "TOO_EARLY", "TOO_MANY_REQUESTS", "UNAUTHORIZED", "UNAVAILABLE_FOR_LEGAL_REASONS", "UNPROCESSABLE_ENTITY", "UNSUPPORTED_MEDIA_TYPE", "UPGRADE_REQUIRED", "URI_TOO_LONG", "USE_PROXY", "VARIANT_ALSO_NEGOTIATES"] # noqa: E501 + if status_code not in allowed_values: + raise ValueError( + "Invalid value for `status_code` ({0}), must be one of {1}" # noqa: E501 + .format(status_code, allowed_values) + ) + + self._status_code = status_code + + @property + def status_code_value(self): + """Gets the status_code_value of this ResponseEntity. # noqa: E501 + + + :return: The status_code_value of this ResponseEntity. # noqa: E501 + :rtype: int + """ + return self._status_code_value + + @status_code_value.setter + def status_code_value(self, status_code_value): + """Sets the status_code_value of this ResponseEntity. + + + :param status_code_value: The status_code_value of this ResponseEntity. # noqa: E501 + :type: int + """ + + self._status_code_value = status_code_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResponseEntity, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResponseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rpc.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rpc.py new file mode 100644 index 0000000..267c9b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rpc.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Rpc(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'RpcId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_id': 'DeviceId', + 'expiration_time': 'int', + 'request': 'JsonNode', + 'response': 'JsonNode', + 'status': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_id': 'deviceId', + 'expiration_time': 'expirationTime', + 'request': 'request', + 'response': 'response', + 'status': 'status', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_id=None, expiration_time=None, request=None, response=None, status=None, additional_info=None): # noqa: E501 + """Rpc - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_id = None + self._expiration_time = None + self._request = None + self._response = None + self._status = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_id is not None: + self.device_id = device_id + if expiration_time is not None: + self.expiration_time = expiration_time + if request is not None: + self.request = request + if response is not None: + self.response = response + if status is not None: + self.status = status + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Rpc. # noqa: E501 + + + :return: The id of this Rpc. # noqa: E501 + :rtype: RpcId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Rpc. + + + :param id: The id of this Rpc. # noqa: E501 + :type: RpcId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Rpc. # noqa: E501 + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :return: The created_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Rpc. + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Rpc. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Rpc. # noqa: E501 + + + :return: The tenant_id of this Rpc. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Rpc. + + + :param tenant_id: The tenant_id of this Rpc. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_id(self): + """Gets the device_id of this Rpc. # noqa: E501 + + + :return: The device_id of this Rpc. # noqa: E501 + :rtype: DeviceId + """ + return self._device_id + + @device_id.setter + def device_id(self, device_id): + """Sets the device_id of this Rpc. + + + :param device_id: The device_id of this Rpc. # noqa: E501 + :type: DeviceId + """ + + self._device_id = device_id + + @property + def expiration_time(self): + """Gets the expiration_time of this Rpc. # noqa: E501 + + Expiration time of the request. # noqa: E501 + + :return: The expiration_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._expiration_time + + @expiration_time.setter + def expiration_time(self, expiration_time): + """Sets the expiration_time of this Rpc. + + Expiration time of the request. # noqa: E501 + + :param expiration_time: The expiration_time of this Rpc. # noqa: E501 + :type: int + """ + + self._expiration_time = expiration_time + + @property + def request(self): + """Gets the request of this Rpc. # noqa: E501 + + + :return: The request of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._request + + @request.setter + def request(self, request): + """Sets the request of this Rpc. + + + :param request: The request of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._request = request + + @property + def response(self): + """Gets the response of this Rpc. # noqa: E501 + + + :return: The response of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._response + + @response.setter + def response(self, response): + """Sets the response of this Rpc. + + + :param response: The response of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._response = response + + @property + def status(self): + """Gets the status of this Rpc. # noqa: E501 + + The current status of the RPC call. # noqa: E501 + + :return: The status of this Rpc. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Rpc. + + The current status of the RPC call. # noqa: E501 + + :param status: The status of this Rpc. # noqa: E501 + :type: str + """ + allowed_values = ["DELETED", "DELIVERED", "EXPIRED", "FAILED", "QUEUED", "SENT", "SUCCESSFUL", "TIMEOUT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def additional_info(self): + """Gets the additional_info of this Rpc. # noqa: E501 + + + :return: The additional_info of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Rpc. + + + :param additional_info: The additional_info of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Rpc, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Rpc): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rpc_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rpc_id.py new file mode 100644 index 0000000..36ac7ee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rpc_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RpcId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RpcId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RpcId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RpcId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RpcId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RpcId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RpcId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RpcId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RpcId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RpcId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RPC"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RpcId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RpcId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rpklw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rpklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..941bf21 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rpklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RPKLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """RPKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this RPKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this RPKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this RPKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this RPKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this RPKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this RPKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RPKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RPKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain.py new file mode 100644 index 0000000..49d0d88 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain.py @@ -0,0 +1,376 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'id': 'RuleChainId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'type': 'str', + 'first_rule_node_id': 'RuleNodeId', + 'root': 'bool', + 'debug_mode': 'bool', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'type': 'type', + 'first_rule_node_id': 'firstRuleNodeId', + 'root': 'root', + 'debug_mode': 'debugMode', + 'configuration': 'configuration' + } + + def __init__(self, additional_info=None, id=None, created_time=None, tenant_id=None, name=None, type=None, first_rule_node_id=None, root=None, debug_mode=None, configuration=None): # noqa: E501 + """RuleChain - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._type = None + self._first_rule_node_id = None + self._root = None + self._debug_mode = None + self._configuration = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + self.tenant_id = tenant_id + self.name = name + if type is not None: + self.type = type + if first_rule_node_id is not None: + self.first_rule_node_id = first_rule_node_id + if root is not None: + self.root = root + if debug_mode is not None: + self.debug_mode = debug_mode + if configuration is not None: + self.configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this RuleChain. # noqa: E501 + + + :return: The additional_info of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChain. + + + :param additional_info: The additional_info of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def id(self): + """Gets the id of this RuleChain. # noqa: E501 + + + :return: The id of this RuleChain. # noqa: E501 + :rtype: RuleChainId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChain. + + + :param id: The id of this RuleChain. # noqa: E501 + :type: RuleChainId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleChain. # noqa: E501 + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleChain. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleChain. + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleChain. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this RuleChain. # noqa: E501 + + + :return: The tenant_id of this RuleChain. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this RuleChain. + + + :param tenant_id: The tenant_id of this RuleChain. # noqa: E501 + :type: TenantId + """ + if tenant_id is None: + raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this RuleChain. # noqa: E501 + + Rule Chain name # noqa: E501 + + :return: The name of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleChain. + + Rule Chain name # noqa: E501 + + :param name: The name of this RuleChain. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this RuleChain. # noqa: E501 + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :return: The type of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChain. + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :param type: The type of this RuleChain. # noqa: E501 + :type: str + """ + allowed_values = ["CORE", "EDGE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def first_rule_node_id(self): + """Gets the first_rule_node_id of this RuleChain. # noqa: E501 + + + :return: The first_rule_node_id of this RuleChain. # noqa: E501 + :rtype: RuleNodeId + """ + return self._first_rule_node_id + + @first_rule_node_id.setter + def first_rule_node_id(self, first_rule_node_id): + """Sets the first_rule_node_id of this RuleChain. + + + :param first_rule_node_id: The first_rule_node_id of this RuleChain. # noqa: E501 + :type: RuleNodeId + """ + + self._first_rule_node_id = first_rule_node_id + + @property + def root(self): + """Gets the root of this RuleChain. # noqa: E501 + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :return: The root of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._root + + @root.setter + def root(self, root): + """Sets the root of this RuleChain. + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :param root: The root of this RuleChain. # noqa: E501 + :type: bool + """ + + self._root = root + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleChain. # noqa: E501 + + Reserved for future usage. # noqa: E501 + + :return: The debug_mode of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleChain. + + Reserved for future usage. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleChain. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def configuration(self): + """Gets the configuration of this RuleChain. # noqa: E501 + + + :return: The configuration of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleChain. + + + :param configuration: The configuration of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_connection_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_connection_info.py new file mode 100644 index 0000000..a9c3afa --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_connection_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'target_rule_chain_id': 'RuleChainId', + 'additional_info': 'JsonNode', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'target_rule_chain_id': 'targetRuleChainId', + 'additional_info': 'additionalInfo', + 'type': 'type' + } + + def __init__(self, from_index=None, target_rule_chain_id=None, additional_info=None, type=None): # noqa: E501 + """RuleChainConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._target_rule_chain_id = None + self._additional_info = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.target_rule_chain_id = target_rule_chain_id + self.additional_info = additional_info + self.type = type + + @property + def from_index(self): + """Gets the from_index of this RuleChainConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this RuleChainConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def target_rule_chain_id(self): + """Gets the target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._target_rule_chain_id + + @target_rule_chain_id.setter + def target_rule_chain_id(self, target_rule_chain_id): + """Sets the target_rule_chain_id of this RuleChainConnectionInfo. + + + :param target_rule_chain_id: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :type: RuleChainId + """ + if target_rule_chain_id is None: + raise ValueError("Invalid value for `target_rule_chain_id`, must not be `None`") # noqa: E501 + + self._target_rule_chain_id = target_rule_chain_id + + @property + def additional_info(self): + """Gets the additional_info of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChainConnectionInfo. + + + :param additional_info: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def type(self): + """Gets the type of this RuleChainConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this RuleChainConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChainConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this RuleChainConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_data.py new file mode 100644 index 0000000..f165612 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_data.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chains': 'list[RuleChain]', + 'metadata': 'list[RuleChainMetaData]' + } + + attribute_map = { + 'rule_chains': 'ruleChains', + 'metadata': 'metadata' + } + + def __init__(self, rule_chains=None, metadata=None): # noqa: E501 + """RuleChainData - a model defined in Swagger""" # noqa: E501 + self._rule_chains = None + self._metadata = None + self.discriminator = None + self.rule_chains = rule_chains + self.metadata = metadata + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleChainData. # noqa: E501 + + List of the Rule Chain objects. # noqa: E501 + + :return: The rule_chains of this RuleChainData. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleChainData. + + List of the Rule Chain objects. # noqa: E501 + + :param rule_chains: The rule_chains of this RuleChainData. # noqa: E501 + :type: list[RuleChain] + """ + if rule_chains is None: + raise ValueError("Invalid value for `rule_chains`, must not be `None`") # noqa: E501 + + self._rule_chains = rule_chains + + @property + def metadata(self): + """Gets the metadata of this RuleChainData. # noqa: E501 + + List of the Rule Chain metadata objects. # noqa: E501 + + :return: The metadata of this RuleChainData. # noqa: E501 + :rtype: list[RuleChainMetaData] + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this RuleChainData. + + List of the Rule Chain metadata objects. # noqa: E501 + + :param metadata: The metadata of this RuleChainData. # noqa: E501 + :type: list[RuleChainMetaData] + """ + if metadata is None: + raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 + + self._metadata = metadata + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_debug_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_debug_event_filter.py new file mode 100644 index 0000000..bd222e3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_debug_event_filter.py @@ -0,0 +1,275 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class RuleChainDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'message': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'message': 'message', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, message=None, error_str=None, *args, **kwargs): # noqa: E501 + """RuleChainDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._message = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if message is not None: + self.message = message + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainDebugEventFilter. + + + :param error: The error of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleChainDebugEventFilter. + + + :param not_empty: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleChainDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleChainDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def message(self): + """Gets the message of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the message # noqa: E501 + + :return: The message of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this RuleChainDebugEventFilter. + + String value representing the message # noqa: E501 + + :param message: The message of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_str(self): + """Gets the error_str of this RuleChainDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleChainDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_export_data.py new file mode 100644 index 0000000..dad52aa --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class RuleChainExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'RuleChain', + 'entity_type': 'str', + 'meta_data': 'RuleChainMetaData', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'meta_data': 'metaData', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, meta_data=None, relations=None, *args, **kwargs): # noqa: E501 + """RuleChainExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._meta_data = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if meta_data is not None: + self.meta_data = meta_data + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this RuleChainExportData. # noqa: E501 + + + :return: The attributes of this RuleChainExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this RuleChainExportData. + + + :param attributes: The attributes of this RuleChainExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this RuleChainExportData. # noqa: E501 + + + :return: The entity of this RuleChainExportData. # noqa: E501 + :rtype: RuleChain + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this RuleChainExportData. + + + :param entity: The entity of this RuleChainExportData. # noqa: E501 + :type: RuleChain + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainExportData. # noqa: E501 + + + :return: The entity_type of this RuleChainExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainExportData. + + + :param entity_type: The entity_type of this RuleChainExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def meta_data(self): + """Gets the meta_data of this RuleChainExportData. # noqa: E501 + + + :return: The meta_data of this RuleChainExportData. # noqa: E501 + :rtype: RuleChainMetaData + """ + return self._meta_data + + @meta_data.setter + def meta_data(self, meta_data): + """Sets the meta_data of this RuleChainExportData. + + + :param meta_data: The meta_data of this RuleChainExportData. # noqa: E501 + :type: RuleChainMetaData + """ + + self._meta_data = meta_data + + @property + def relations(self): + """Gets the relations of this RuleChainExportData. # noqa: E501 + + + :return: The relations of this RuleChainExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this RuleChainExportData. + + + :param relations: The relations of this RuleChainExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_id.py new file mode 100644 index 0000000..a0dfb64 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleChainId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleChainId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChainId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleChainId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleChainId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_CHAIN"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_import_result.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_import_result.py new file mode 100644 index 0000000..2b929d3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_import_result.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainImportResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'rule_chain_id': 'RuleChainId', + 'rule_chain_name': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'error': 'error', + 'rule_chain_id': 'ruleChainId', + 'rule_chain_name': 'ruleChainName', + 'updated': 'updated' + } + + def __init__(self, error=None, rule_chain_id=None, rule_chain_name=None, updated=None): # noqa: E501 + """RuleChainImportResult - a model defined in Swagger""" # noqa: E501 + self._error = None + self._rule_chain_id = None + self._rule_chain_name = None + self._updated = None + self.discriminator = None + if error is not None: + self.error = error + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if rule_chain_name is not None: + self.rule_chain_name = rule_chain_name + if updated is not None: + self.updated = updated + + @property + def error(self): + """Gets the error of this RuleChainImportResult. # noqa: E501 + + + :return: The error of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainImportResult. + + + :param error: The error of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainImportResult. + + + :param rule_chain_id: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainImportResult. + + + :param rule_chain_name: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._rule_chain_name = rule_chain_name + + @property + def updated(self): + """Gets the updated of this RuleChainImportResult. # noqa: E501 + + + :return: The updated of this RuleChainImportResult. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this RuleChainImportResult. + + + :param updated: The updated of this RuleChainImportResult. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainImportResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainImportResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_meta_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_meta_data.py new file mode 100644 index 0000000..2b403a9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_meta_data.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainMetaData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'first_node_index': 'int', + 'nodes': 'list[RuleNode]', + 'connections': 'list[NodeConnectionInfo]', + 'rule_chain_connections': 'list[RuleChainConnectionInfo]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'first_node_index': 'firstNodeIndex', + 'nodes': 'nodes', + 'connections': 'connections', + 'rule_chain_connections': 'ruleChainConnections' + } + + def __init__(self, rule_chain_id=None, first_node_index=None, nodes=None, connections=None, rule_chain_connections=None): # noqa: E501 + """RuleChainMetaData - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._first_node_index = None + self._nodes = None + self._connections = None + self._rule_chain_connections = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.first_node_index = first_node_index + self.nodes = nodes + self.connections = connections + self.rule_chain_connections = rule_chain_connections + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainMetaData. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainMetaData. + + + :param rule_chain_id: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def first_node_index(self): + """Gets the first_node_index of this RuleChainMetaData. # noqa: E501 + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :return: The first_node_index of this RuleChainMetaData. # noqa: E501 + :rtype: int + """ + return self._first_node_index + + @first_node_index.setter + def first_node_index(self, first_node_index): + """Sets the first_node_index of this RuleChainMetaData. + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :param first_node_index: The first_node_index of this RuleChainMetaData. # noqa: E501 + :type: int + """ + if first_node_index is None: + raise ValueError("Invalid value for `first_node_index`, must not be `None`") # noqa: E501 + + self._first_node_index = first_node_index + + @property + def nodes(self): + """Gets the nodes of this RuleChainMetaData. # noqa: E501 + + List of rule node JSON objects # noqa: E501 + + :return: The nodes of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleNode] + """ + return self._nodes + + @nodes.setter + def nodes(self, nodes): + """Sets the nodes of this RuleChainMetaData. + + List of rule node JSON objects # noqa: E501 + + :param nodes: The nodes of this RuleChainMetaData. # noqa: E501 + :type: list[RuleNode] + """ + if nodes is None: + raise ValueError("Invalid value for `nodes`, must not be `None`") # noqa: E501 + + self._nodes = nodes + + @property + def connections(self): + """Gets the connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :return: The connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[NodeConnectionInfo] + """ + return self._connections + + @connections.setter + def connections(self, connections): + """Sets the connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :param connections: The connections of this RuleChainMetaData. # noqa: E501 + :type: list[NodeConnectionInfo] + """ + if connections is None: + raise ValueError("Invalid value for `connections`, must not be `None`") # noqa: E501 + + self._connections = connections + + @property + def rule_chain_connections(self): + """Gets the rule_chain_connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :return: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleChainConnectionInfo] + """ + return self._rule_chain_connections + + @rule_chain_connections.setter + def rule_chain_connections(self, rule_chain_connections): + """Sets the rule_chain_connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :param rule_chain_connections: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :type: list[RuleChainConnectionInfo] + """ + if rule_chain_connections is None: + raise ValueError("Invalid value for `rule_chain_connections`, must not be `None`") # noqa: E501 + + self._rule_chain_connections = rule_chain_connections + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainMetaData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainMetaData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_output_labels_usage.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_output_labels_usage.py new file mode 100644 index 0000000..828d15f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_chain_output_labels_usage.py @@ -0,0 +1,239 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainOutputLabelsUsage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'rule_node_id': 'RuleNodeId', + 'rule_chain_name': 'str', + 'rule_node_name': 'str', + 'labels': 'list[str]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'rule_node_id': 'ruleNodeId', + 'rule_chain_name': 'ruleChainName', + 'rule_node_name': 'ruleNodeName', + 'labels': 'labels' + } + + def __init__(self, rule_chain_id=None, rule_node_id=None, rule_chain_name=None, rule_node_name=None, labels=None): # noqa: E501 + """RuleChainOutputLabelsUsage - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._rule_node_id = None + self._rule_chain_name = None + self._rule_node_name = None + self._labels = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.rule_node_id = rule_node_id + self.rule_chain_name = rule_chain_name + self.rule_node_name = rule_node_name + self.labels = labels + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainOutputLabelsUsage. + + + :param rule_chain_id: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def rule_node_id(self): + """Gets the rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleNodeId + """ + return self._rule_node_id + + @rule_node_id.setter + def rule_node_id(self, rule_node_id): + """Sets the rule_node_id of this RuleChainOutputLabelsUsage. + + + :param rule_node_id: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleNodeId + """ + if rule_node_id is None: + raise ValueError("Invalid value for `rule_node_id`, must not be `None`") # noqa: E501 + + self._rule_node_id = rule_node_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Chain Name # noqa: E501 + + :return: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainOutputLabelsUsage. + + Rule Chain Name # noqa: E501 + + :param rule_chain_name: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_chain_name is None: + raise ValueError("Invalid value for `rule_chain_name`, must not be `None`") # noqa: E501 + + self._rule_chain_name = rule_chain_name + + @property + def rule_node_name(self): + """Gets the rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Node Name # noqa: E501 + + :return: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_node_name + + @rule_node_name.setter + def rule_node_name(self, rule_node_name): + """Sets the rule_node_name of this RuleChainOutputLabelsUsage. + + Rule Node Name # noqa: E501 + + :param rule_node_name: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_node_name is None: + raise ValueError("Invalid value for `rule_node_name`, must not be `None`") # noqa: E501 + + self._rule_node_name = rule_node_name + + @property + def labels(self): + """Gets the labels of this RuleChainOutputLabelsUsage. # noqa: E501 + + Output labels # noqa: E501 + + :return: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: list[str] + """ + return self._labels + + @labels.setter + def labels(self, labels): + """Sets the labels of this RuleChainOutputLabelsUsage. + + Output labels # noqa: E501 + + :param labels: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: list[str] + """ + if labels is None: + raise ValueError("Invalid value for `labels`, must not be `None`") # noqa: E501 + + self._labels = labels + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainOutputLabelsUsage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainOutputLabelsUsage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py new file mode 100644 index 0000000..c293401 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'only_rule_chain_lifecycle_failures': 'bool', + 'only_rule_node_lifecycle_failures': 'bool', + 'rule_chain_events': 'list[str]', + 'rule_chains': 'list[str]', + 'rule_node_events': 'list[str]', + 'track_rule_node_events': 'bool', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'only_rule_chain_lifecycle_failures': 'onlyRuleChainLifecycleFailures', + 'only_rule_node_lifecycle_failures': 'onlyRuleNodeLifecycleFailures', + 'rule_chain_events': 'ruleChainEvents', + 'rule_chains': 'ruleChains', + 'rule_node_events': 'ruleNodeEvents', + 'track_rule_node_events': 'trackRuleNodeEvents', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, only_rule_chain_lifecycle_failures=None, only_rule_node_lifecycle_failures=None, rule_chain_events=None, rule_chains=None, rule_node_events=None, track_rule_node_events=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._only_rule_chain_lifecycle_failures = None + self._only_rule_node_lifecycle_failures = None + self._rule_chain_events = None + self._rule_chains = None + self._rule_node_events = None + self._track_rule_node_events = None + self._trigger_type = None + self.discriminator = None + if only_rule_chain_lifecycle_failures is not None: + self.only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + if only_rule_node_lifecycle_failures is not None: + self.only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + if rule_chain_events is not None: + self.rule_chain_events = rule_chain_events + if rule_chains is not None: + self.rule_chains = rule_chains + if rule_node_events is not None: + self.rule_node_events = rule_node_events + if track_rule_node_events is not None: + self.track_rule_node_events = track_rule_node_events + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def only_rule_chain_lifecycle_failures(self): + """Gets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_chain_lifecycle_failures + + @only_rule_chain_lifecycle_failures.setter + def only_rule_chain_lifecycle_failures(self, only_rule_chain_lifecycle_failures): + """Sets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_chain_lifecycle_failures: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + + @property + def only_rule_node_lifecycle_failures(self): + """Gets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_node_lifecycle_failures + + @only_rule_node_lifecycle_failures.setter + def only_rule_node_lifecycle_failures(self, only_rule_node_lifecycle_failures): + """Sets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_node_lifecycle_failures: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + + @property + def rule_chain_events(self): + """Gets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chain_events + + @rule_chain_events.setter + def rule_chain_events(self, rule_chain_events): + """Sets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chain_events: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_chain_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_chain_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_chain_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_chain_events = rule_chain_events + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chains: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._rule_chains = rule_chains + + @property + def rule_node_events(self): + """Gets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_node_events + + @rule_node_events.setter + def rule_node_events(self, rule_node_events): + """Sets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_node_events: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_node_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_node_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_node_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_node_events = rule_node_events + + @property + def track_rule_node_events(self): + """Gets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._track_rule_node_events + + @track_rule_node_events.setter + def track_rule_node_events(self, track_rule_node_events): + """Sets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param track_rule_node_events: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._track_rule_node_events = track_rule_node_events + + @property + def trigger_type(self): + """Gets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node.py new file mode 100644 index 0000000..60ec592 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node.py @@ -0,0 +1,368 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'RuleNodeId', + 'id': 'RuleNodeId', + 'created_time': 'int', + 'rule_chain_id': 'RuleChainId', + 'type': 'str', + 'name': 'str', + 'debug_mode': 'bool', + 'singleton_mode': 'bool', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'external_id': 'externalId', + 'id': 'id', + 'created_time': 'createdTime', + 'rule_chain_id': 'ruleChainId', + 'type': 'type', + 'name': 'name', + 'debug_mode': 'debugMode', + 'singleton_mode': 'singletonMode', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration' + } + + def __init__(self, external_id=None, id=None, created_time=None, rule_chain_id=None, type=None, name=None, debug_mode=None, singleton_mode=None, additional_info=None, configuration=None): # noqa: E501 + """RuleNode - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self._id = None + self._created_time = None + self._rule_chain_id = None + self._type = None + self._name = None + self._debug_mode = None + self._singleton_mode = None + self._additional_info = None + self._configuration = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if type is not None: + self.type = type + if name is not None: + self.name = name + if debug_mode is not None: + self.debug_mode = debug_mode + if singleton_mode is not None: + self.singleton_mode = singleton_mode + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + + @property + def external_id(self): + """Gets the external_id of this RuleNode. # noqa: E501 + + + :return: The external_id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this RuleNode. + + + :param external_id: The external_id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._external_id = external_id + + @property + def id(self): + """Gets the id of this RuleNode. # noqa: E501 + + + :return: The id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNode. + + + :param id: The id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleNode. # noqa: E501 + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleNode. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleNode. + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleNode. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleNode. # noqa: E501 + + + :return: The rule_chain_id of this RuleNode. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleNode. + + + :param rule_chain_id: The rule_chain_id of this RuleNode. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def type(self): + """Gets the type of this RuleNode. # noqa: E501 + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :return: The type of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleNode. + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :param type: The type of this RuleNode. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def name(self): + """Gets the name of this RuleNode. # noqa: E501 + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :return: The name of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleNode. + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :param name: The name of this RuleNode. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleNode. # noqa: E501 + + Enable/disable debug. # noqa: E501 + + :return: The debug_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleNode. + + Enable/disable debug. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def singleton_mode(self): + """Gets the singleton_mode of this RuleNode. # noqa: E501 + + Enable/disable singleton mode. # noqa: E501 + + :return: The singleton_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._singleton_mode + + @singleton_mode.setter + def singleton_mode(self, singleton_mode): + """Sets the singleton_mode of this RuleNode. + + Enable/disable singleton mode. # noqa: E501 + + :param singleton_mode: The singleton_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._singleton_mode = singleton_mode + + @property + def additional_info(self): + """Gets the additional_info of this RuleNode. # noqa: E501 + + + :return: The additional_info of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleNode. + + + :param additional_info: The additional_info of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this RuleNode. # noqa: E501 + + + :return: The configuration of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleNode. + + + :param configuration: The configuration of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node_debug_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node_debug_event_filter.py new file mode 100644 index 0000000..c3cfe90 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node_debug_event_filter.py @@ -0,0 +1,483 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class RuleNodeDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'msg_direction_type': 'str', + 'entity_id': 'str', + 'entity_type': 'str', + 'msg_id': 'str', + 'msg_type': 'str', + 'relation_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'msg_direction_type': 'msgDirectionType', + 'entity_id': 'entityId', + 'entity_type': 'entityType', + 'msg_id': 'msgId', + 'msg_type': 'msgType', + 'relation_type': 'relationType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, msg_direction_type=None, entity_id=None, entity_type=None, msg_id=None, msg_type=None, relation_type=None, data_search=None, metadata_search=None, error_str=None, *args, **kwargs): # noqa: E501 + """RuleNodeDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._msg_direction_type = None + self._entity_id = None + self._entity_type = None + self._msg_id = None + self._msg_type = None + self._relation_type = None + self._data_search = None + self._metadata_search = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if entity_id is not None: + self.entity_id = entity_id + if entity_type is not None: + self.entity_type = entity_type + if msg_id is not None: + self.msg_id = msg_id + if msg_type is not None: + self.msg_type = msg_type + if relation_type is not None: + self.relation_type = relation_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleNodeDebugEventFilter. + + + :param error: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleNodeDebugEventFilter. + + + :param not_empty: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleNodeDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleNodeDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this RuleNodeDebugEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def entity_id(self): + """Gets the entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this RuleNodeDebugEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeDebugEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def msg_id(self): + """Gets the msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message id in the rule engine # noqa: E501 + + :return: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_id + + @msg_id.setter + def msg_id(self, msg_id): + """Sets the msg_id of this RuleNodeDebugEventFilter. + + String value representing the message id in the rule engine # noqa: E501 + + :param msg_id: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_id = msg_id + + @property + def msg_type(self): + """Gets the msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this RuleNodeDebugEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + @property + def relation_type(self): + """Gets the relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RuleNodeDebugEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def data_search(self): + """Gets the data_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def error_str(self): + """Gets the error_str of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node_id.py new file mode 100644 index 0000000..2f39342 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/rule_node_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNodeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleNodeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleNodeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNodeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleNodeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_NODE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/save_device_with_credentials_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/save_device_with_credentials_request.py new file mode 100644 index 0000000..308f950 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/save_device_with_credentials_request.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveDeviceWithCredentialsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device': 'Device', + 'credentials': 'DeviceCredentials' + } + + attribute_map = { + 'device': 'device', + 'credentials': 'credentials' + } + + def __init__(self, device=None, credentials=None): # noqa: E501 + """SaveDeviceWithCredentialsRequest - a model defined in Swagger""" # noqa: E501 + self._device = None + self._credentials = None + self.discriminator = None + self.device = device + self.credentials = credentials + + @property + def device(self): + """Gets the device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: Device + """ + return self._device + + @device.setter + def device(self, device): + """Sets the device of this SaveDeviceWithCredentialsRequest. + + + :param device: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: Device + """ + if device is None: + raise ValueError("Invalid value for `device`, must not be `None`") # noqa: E501 + + self._device = device + + @property + def credentials(self): + """Gets the credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this SaveDeviceWithCredentialsRequest. + + + :param credentials: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: DeviceCredentials + """ + if credentials is None: + raise ValueError("Invalid value for `credentials`, must not be `None`") # noqa: E501 + + self._credentials = credentials + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveDeviceWithCredentialsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveDeviceWithCredentialsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/save_ota_package_info_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/save_ota_package_info_request.py new file mode 100644 index 0000000..f7b9c61 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/save_ota_package_info_request.py @@ -0,0 +1,578 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveOtaPackageInfoRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'uses_url': 'bool', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'uses_url': 'usesUrl', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, uses_url=None, additional_info=None): # noqa: E501 + """SaveOtaPackageInfoRequest - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._uses_url = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if uses_url is not None: + self.uses_url = uses_url + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SaveOtaPackageInfoRequest. + + + :param id: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SaveOtaPackageInfoRequest. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SaveOtaPackageInfoRequest. + + + :param tenant_id: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this SaveOtaPackageInfoRequest. + + + :param device_profile_id: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SaveOtaPackageInfoRequest. + + OTA Package type. # noqa: E501 + + :param type: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SaveOtaPackageInfoRequest. + + OTA Package title. # noqa: E501 + + :param title: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this SaveOtaPackageInfoRequest. + + OTA Package version. # noqa: E501 + + :param version: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this SaveOtaPackageInfoRequest. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this SaveOtaPackageInfoRequest. + + OTA Package url. # noqa: E501 + + :param url: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this SaveOtaPackageInfoRequest. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this SaveOtaPackageInfoRequest. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this SaveOtaPackageInfoRequest. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this SaveOtaPackageInfoRequest. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this SaveOtaPackageInfoRequest. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this SaveOtaPackageInfoRequest. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def uses_url(self): + """Gets the uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :return: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._uses_url + + @uses_url.setter + def uses_url(self, uses_url): + """Sets the uses_url of this SaveOtaPackageInfoRequest. + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :param uses_url: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._uses_url = uses_url + + @property + def additional_info(self): + """Gets the additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SaveOtaPackageInfoRequest. + + + :param additional_info: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveOtaPackageInfoRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveOtaPackageInfoRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/security_settings.py b/tb-rest-client/python/tb_rest_client/models/models_ce/security_settings.py new file mode 100644 index 0000000..3efbd69 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/security_settings.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SecuritySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password_policy': 'UserPasswordPolicy', + 'max_failed_login_attempts': 'int', + 'user_lockout_notification_email': 'str' + } + + attribute_map = { + 'password_policy': 'passwordPolicy', + 'max_failed_login_attempts': 'maxFailedLoginAttempts', + 'user_lockout_notification_email': 'userLockoutNotificationEmail' + } + + def __init__(self, password_policy=None, max_failed_login_attempts=None, user_lockout_notification_email=None): # noqa: E501 + """SecuritySettings - a model defined in Swagger""" # noqa: E501 + self._password_policy = None + self._max_failed_login_attempts = None + self._user_lockout_notification_email = None + self.discriminator = None + if password_policy is not None: + self.password_policy = password_policy + if max_failed_login_attempts is not None: + self.max_failed_login_attempts = max_failed_login_attempts + if user_lockout_notification_email is not None: + self.user_lockout_notification_email = user_lockout_notification_email + + @property + def password_policy(self): + """Gets the password_policy of this SecuritySettings. # noqa: E501 + + + :return: The password_policy of this SecuritySettings. # noqa: E501 + :rtype: UserPasswordPolicy + """ + return self._password_policy + + @password_policy.setter + def password_policy(self, password_policy): + """Sets the password_policy of this SecuritySettings. + + + :param password_policy: The password_policy of this SecuritySettings. # noqa: E501 + :type: UserPasswordPolicy + """ + + self._password_policy = password_policy + + @property + def max_failed_login_attempts(self): + """Gets the max_failed_login_attempts of this SecuritySettings. # noqa: E501 + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :return: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :rtype: int + """ + return self._max_failed_login_attempts + + @max_failed_login_attempts.setter + def max_failed_login_attempts(self, max_failed_login_attempts): + """Sets the max_failed_login_attempts of this SecuritySettings. + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :param max_failed_login_attempts: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :type: int + """ + + self._max_failed_login_attempts = max_failed_login_attempts + + @property + def user_lockout_notification_email(self): + """Gets the user_lockout_notification_email of this SecuritySettings. # noqa: E501 + + Email to use for notifications about locked users. # noqa: E501 + + :return: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :rtype: str + """ + return self._user_lockout_notification_email + + @user_lockout_notification_email.setter + def user_lockout_notification_email(self, user_lockout_notification_email): + """Sets the user_lockout_notification_email of this SecuritySettings. + + Email to use for notifications about locked users. # noqa: E501 + + :param user_lockout_notification_email: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :type: str + """ + + self._user_lockout_notification_email = user_lockout_notification_email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SecuritySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SecuritySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/server_security_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/server_security_config.py new file mode 100644 index 0000000..c3c48d1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/server_security_config.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ServerSecurityConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap_server_account_timeout': 'int', + 'bootstrap_server_is': 'bool', + 'client_hold_off_time': 'int', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'server_id': 'int', + 'server_public_key': 'str' + } + + attribute_map = { + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'bootstrap_server_is': 'bootstrapServerIs', + 'client_hold_off_time': 'clientHoldOffTime', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'server_id': 'serverId', + 'server_public_key': 'serverPublicKey' + } + + def __init__(self, bootstrap_server_account_timeout=None, bootstrap_server_is=None, client_hold_off_time=None, host=None, port=None, security_host=None, security_port=None, server_id=None, server_public_key=None): # noqa: E501 + """ServerSecurityConfig - a model defined in Swagger""" # noqa: E501 + self._bootstrap_server_account_timeout = None + self._bootstrap_server_is = None + self._client_hold_off_time = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._server_id = None + self._server_public_key = None + self.discriminator = None + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if server_id is not None: + self.server_id = server_id + if server_public_key is not None: + self.server_public_key = server_public_key + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + + + :return: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this ServerSecurityConfig. + + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + + + :return: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this ServerSecurityConfig. + + + :param bootstrap_server_is: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + + + :return: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this ServerSecurityConfig. + + + :param client_hold_off_time: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def host(self): + """Gets the host of this ServerSecurityConfig. # noqa: E501 + + + :return: The host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this ServerSecurityConfig. + + + :param host: The host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this ServerSecurityConfig. # noqa: E501 + + + :return: The port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this ServerSecurityConfig. + + + :param port: The port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this ServerSecurityConfig. # noqa: E501 + + + :return: The security_host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this ServerSecurityConfig. + + + :param security_host: The security_host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this ServerSecurityConfig. # noqa: E501 + + + :return: The security_port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this ServerSecurityConfig. + + + :param security_port: The security_port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def server_id(self): + """Gets the server_id of this ServerSecurityConfig. # noqa: E501 + + + :return: The server_id of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._server_id + + @server_id.setter + def server_id(self, server_id): + """Sets the server_id of this ServerSecurityConfig. + + + :param server_id: The server_id of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._server_id = server_id + + @property + def server_public_key(self): + """Gets the server_public_key of this ServerSecurityConfig. # noqa: E501 + + + :return: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this ServerSecurityConfig. + + + :param server_public_key: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ServerSecurityConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ServerSecurityConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/shared_attributes_setting_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/shared_attributes_setting_snmp_communication_config.py new file mode 100644 index 0000000..a5ecd11 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/shared_attributes_setting_snmp_communication_config.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class SharedAttributesSettingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, spec=None, *args, **kwargs): # noqa: E501 + """SharedAttributesSettingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param mappings: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param spec: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SharedAttributesSettingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SharedAttributesSettingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/short_customer_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/short_customer_info.py new file mode 100644 index 0000000..60efb00 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/short_customer_info.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShortCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'customer_id': 'CustomerId', + 'title': 'str' + } + + attribute_map = { + 'public': 'public', + 'customer_id': 'customerId', + 'title': 'title' + } + + def __init__(self, public=None, customer_id=None, title=None): # noqa: E501 + """ShortCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._public = None + self._customer_id = None + self._title = None + self.discriminator = None + if public is not None: + self.public = public + if customer_id is not None: + self.customer_id = customer_id + if title is not None: + self.title = title + + @property + def public(self): + """Gets the public of this ShortCustomerInfo. # noqa: E501 + + + :return: The public of this ShortCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this ShortCustomerInfo. + + + :param public: The public of this ShortCustomerInfo. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def customer_id(self): + """Gets the customer_id of this ShortCustomerInfo. # noqa: E501 + + + :return: The customer_id of this ShortCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ShortCustomerInfo. + + + :param customer_id: The customer_id of this ShortCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def title(self): + """Gets the title of this ShortCustomerInfo. # noqa: E501 + + Title of the customer. # noqa: E501 + + :return: The title of this ShortCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this ShortCustomerInfo. + + Title of the customer. # noqa: E501 + + :param title: The title of this ShortCustomerInfo. # noqa: E501 + :type: str + """ + + self._title = title + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShortCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShortCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/sign_up_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/sign_up_request.py new file mode 100644 index 0000000..62c08a6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/sign_up_request.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SignUpRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'app_secret': 'str', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'password': 'str', + 'pkg_name': 'str', + 'recaptcha_response': 'str' + } + + attribute_map = { + 'app_secret': 'appSecret', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'password': 'password', + 'pkg_name': 'pkgName', + 'recaptcha_response': 'recaptchaResponse' + } + + def __init__(self, app_secret=None, email=None, first_name=None, last_name=None, password=None, pkg_name=None, recaptcha_response=None): # noqa: E501 + """SignUpRequest - a model defined in Swagger""" # noqa: E501 + self._app_secret = None + self._email = None + self._first_name = None + self._last_name = None + self._password = None + self._pkg_name = None + self._recaptcha_response = None + self.discriminator = None + if app_secret is not None: + self.app_secret = app_secret + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if password is not None: + self.password = password + if pkg_name is not None: + self.pkg_name = pkg_name + if recaptcha_response is not None: + self.recaptcha_response = recaptcha_response + + @property + def app_secret(self): + """Gets the app_secret of this SignUpRequest. # noqa: E501 + + + :return: The app_secret of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this SignUpRequest. + + + :param app_secret: The app_secret of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._app_secret = app_secret + + @property + def email(self): + """Gets the email of this SignUpRequest. # noqa: E501 + + + :return: The email of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SignUpRequest. + + + :param email: The email of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this SignUpRequest. # noqa: E501 + + + :return: The first_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this SignUpRequest. + + + :param first_name: The first_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this SignUpRequest. # noqa: E501 + + + :return: The last_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this SignUpRequest. + + + :param last_name: The last_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def password(self): + """Gets the password of this SignUpRequest. # noqa: E501 + + + :return: The password of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SignUpRequest. + + + :param password: The password of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def pkg_name(self): + """Gets the pkg_name of this SignUpRequest. # noqa: E501 + + + :return: The pkg_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this SignUpRequest. + + + :param pkg_name: The pkg_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._pkg_name = pkg_name + + @property + def recaptcha_response(self): + """Gets the recaptcha_response of this SignUpRequest. # noqa: E501 + + + :return: The recaptcha_response of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._recaptcha_response + + @recaptcha_response.setter + def recaptcha_response(self, recaptcha_response): + """Sets the recaptcha_response of this SignUpRequest. + + + :param recaptcha_response: The recaptcha_response of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._recaptcha_response = recaptcha_response + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SignUpRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SignUpRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/simple_alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_ce/simple_alarm_condition_spec.py new file mode 100644 index 0000000..67831b8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/simple_alarm_condition_spec.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class SimpleAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """SimpleAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + AlarmConditionSpec.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SimpleAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SimpleAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other + + +if __name__ == '__main__': + SimpleAlarmConditionSpec() diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_filter.py new file mode 100644 index 0000000..638d886 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_filter import EntityFilter # noqa: F401,E501 + +class SingleEntityFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'single_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'single_entity': 'singleEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, single_entity=None, *args, **kwargs): # noqa: E501 + """SingleEntityFilter - a model defined in Swagger""" # noqa: E501 + self._single_entity = None + self.discriminator = None + if single_entity is not None: + self.single_entity = single_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def single_entity(self): + """Gets the single_entity of this SingleEntityFilter. # noqa: E501 + + + :return: The single_entity of this SingleEntityFilter. # noqa: E501 + :rtype: EntityId + """ + return self._single_entity + + @single_entity.setter + def single_entity(self, single_entity): + """Sets the single_entity of this SingleEntityFilter. + + + :param single_entity: The single_entity of this SingleEntityFilter. # noqa: E501 + :type: EntityId + """ + + self._single_entity = single_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_version_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_version_create_request.py new file mode 100644 index 0000000..383912e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_version_create_request.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class SingleEntityVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'config': 'VersionCreateConfig', + 'entity_id': 'EntityId', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'config': 'config', + 'entity_id': 'entityId', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, config=None, entity_id=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._config = None + self._entity_id = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if config is not None: + self.config = config + if entity_id is not None: + self.entity_id = entity_id + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this SingleEntityVersionCreateRequest. + + + :param branch: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def config(self): + """Gets the config of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: VersionCreateConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionCreateRequest. + + + :param config: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: VersionCreateConfig + """ + + self._config = config + + @property + def entity_id(self): + """Gets the entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this SingleEntityVersionCreateRequest. + + + :param entity_id: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionCreateRequest. + + + :param type: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this SingleEntityVersionCreateRequest. + + + :param version_name: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_version_load_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_version_load_request.py new file mode 100644 index 0000000..eed965c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/single_entity_version_load_request.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class SingleEntityVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'config': 'VersionLoadConfig', + 'external_entity_id': 'EntityId', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'config': 'config', + 'external_entity_id': 'externalEntityId', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, config=None, external_entity_id=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._config = None + self._external_entity_id = None + self._type = None + self._version_id = None + self.discriminator = None + if config is not None: + self.config = config + if external_entity_id is not None: + self.external_entity_id = external_entity_id + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def config(self): + """Gets the config of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: VersionLoadConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionLoadRequest. + + + :param config: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: VersionLoadConfig + """ + + self._config = config + + @property + def external_entity_id(self): + """Gets the external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: EntityId + """ + return self._external_entity_id + + @external_entity_id.setter + def external_entity_id(self, external_entity_id): + """Sets the external_entity_id of this SingleEntityVersionLoadRequest. + + + :param external_entity_id: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: EntityId + """ + + self._external_entity_id = external_entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionLoadRequest. + + + :param type: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this SingleEntityVersionLoadRequest. + + + :param version_id: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/slack_conversation.py b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_conversation.py new file mode 100644 index 0000000..8e27a52 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_conversation.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackConversation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'id': 'str', + 'name': 'str', + 'title': 'str', + 'type': 'str', + 'whole_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'id': 'id', + 'name': 'name', + 'title': 'title', + 'type': 'type', + 'whole_name': 'wholeName' + } + + def __init__(self, email=None, id=None, name=None, title=None, type=None, whole_name=None): # noqa: E501 + """SlackConversation - a model defined in Swagger""" # noqa: E501 + self._email = None + self._id = None + self._name = None + self._title = None + self._type = None + self._whole_name = None + self.discriminator = None + if email is not None: + self.email = email + if id is not None: + self.id = id + if name is not None: + self.name = name + if title is not None: + self.title = title + self.type = type + if whole_name is not None: + self.whole_name = whole_name + + @property + def email(self): + """Gets the email of this SlackConversation. # noqa: E501 + + + :return: The email of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SlackConversation. + + + :param email: The email of this SlackConversation. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def id(self): + """Gets the id of this SlackConversation. # noqa: E501 + + + :return: The id of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SlackConversation. + + + :param id: The id of this SlackConversation. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this SlackConversation. # noqa: E501 + + + :return: The name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SlackConversation. + + + :param name: The name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this SlackConversation. # noqa: E501 + + + :return: The title of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SlackConversation. + + + :param title: The title of this SlackConversation. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def type(self): + """Gets the type of this SlackConversation. # noqa: E501 + + + :return: The type of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SlackConversation. + + + :param type: The type of this SlackConversation. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def whole_name(self): + """Gets the whole_name of this SlackConversation. # noqa: E501 + + + :return: The whole_name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._whole_name + + @whole_name.setter + def whole_name(self, whole_name): + """Sets the whole_name of this SlackConversation. + + + :param whole_name: The whole_name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._whole_name = whole_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackConversation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackConversation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/slack_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_delivery_method_notification_template.py new file mode 100644 index 0000000..7eebc70 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SlackDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SlackDeliveryMethodNotificationTemplate. + + + :param body: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SlackDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/slack_notification_delivery_method_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_notification_delivery_method_config.py new file mode 100644 index 0000000..27d76f1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_notification_delivery_method_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackNotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bot_token': 'str' + } + + attribute_map = { + 'bot_token': 'botToken' + } + + def __init__(self, bot_token=None): # noqa: E501 + """SlackNotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self._bot_token = None + self.discriminator = None + if bot_token is not None: + self.bot_token = bot_token + + @property + def bot_token(self): + """Gets the bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + + + :return: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :rtype: str + """ + return self._bot_token + + @bot_token.setter + def bot_token(self, bot_token): + """Sets the bot_token of this SlackNotificationDeliveryMethodConfig. + + + :param bot_token: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :type: str + """ + + self._bot_token = bot_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/slack_notification_target_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_notification_target_config.py new file mode 100644 index 0000000..97949cd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/slack_notification_target_config.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class SlackNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'conversation': 'SlackConversation', + 'conversation_type': 'str', + 'description': 'str' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'conversation': 'conversation', + 'conversation_type': 'conversationType', + 'description': 'description' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, conversation=None, conversation_type=None, description=None, *args, **kwargs): # noqa: E501 + """SlackNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._conversation = None + self._conversation_type = None + self._description = None + self.discriminator = None + self.conversation = conversation + if conversation_type is not None: + self.conversation_type = conversation_type + if description is not None: + self.description = description + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def conversation(self): + """Gets the conversation of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: SlackConversation + """ + return self._conversation + + @conversation.setter + def conversation(self, conversation): + """Sets the conversation of this SlackNotificationTargetConfig. + + + :param conversation: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :type: SlackConversation + """ + if conversation is None: + raise ValueError("Invalid value for `conversation`, must not be `None`") # noqa: E501 + + self._conversation = conversation + + @property + def conversation_type(self): + """Gets the conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._conversation_type + + @conversation_type.setter + def conversation_type(self, conversation_type): + """Sets the conversation_type of this SlackNotificationTargetConfig. + + + :param conversation_type: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if conversation_type not in allowed_values: + raise ValueError( + "Invalid value for `conversation_type` ({0}), must be one of {1}" # noqa: E501 + .format(conversation_type, allowed_values) + ) + + self._conversation_type = conversation_type + + @property + def description(self): + """Gets the description of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The description of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this SlackNotificationTargetConfig. + + + :param description: The description of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/smpp_sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/smpp_sms_provider_configuration.py new file mode 100644 index 0000000..cf518df --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/smpp_sms_provider_configuration.py @@ -0,0 +1,541 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class SmppSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'address_range': 'str', + 'bind_type': 'str', + 'coding_scheme': 'str', + 'destination_npi': 'str', + 'destination_ton': 'str', + 'host': 'str', + 'password': 'str', + 'port': 'int', + 'protocol_version': 'str', + 'service_type': 'str', + 'source_address': 'str', + 'source_npi': 'str', + 'source_ton': 'str', + 'system_id': 'str', + 'system_type': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'address_range': 'addressRange', + 'bind_type': 'bindType', + 'coding_scheme': 'codingScheme', + 'destination_npi': 'destinationNpi', + 'destination_ton': 'destinationTon', + 'host': 'host', + 'password': 'password', + 'port': 'port', + 'protocol_version': 'protocolVersion', + 'service_type': 'serviceType', + 'source_address': 'sourceAddress', + 'source_npi': 'sourceNpi', + 'source_ton': 'sourceTon', + 'system_id': 'systemId', + 'system_type': 'systemType' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, address_range=None, bind_type=None, coding_scheme=None, destination_npi=None, destination_ton=None, host=None, password=None, port=None, protocol_version=None, service_type=None, source_address=None, source_npi=None, source_ton=None, system_id=None, system_type=None, *args, **kwargs): # noqa: E501 + """SmppSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._address_range = None + self._bind_type = None + self._coding_scheme = None + self._destination_npi = None + self._destination_ton = None + self._host = None + self._password = None + self._port = None + self._protocol_version = None + self._service_type = None + self._source_address = None + self._source_npi = None + self._source_ton = None + self._system_id = None + self._system_type = None + self.discriminator = None + if address_range is not None: + self.address_range = address_range + if bind_type is not None: + self.bind_type = bind_type + if coding_scheme is not None: + self.coding_scheme = coding_scheme + if destination_npi is not None: + self.destination_npi = destination_npi + if destination_ton is not None: + self.destination_ton = destination_ton + self.host = host + self.password = password + self.port = port + self.protocol_version = protocol_version + if service_type is not None: + self.service_type = service_type + if source_address is not None: + self.source_address = source_address + if source_npi is not None: + self.source_npi = source_npi + if source_ton is not None: + self.source_ton = source_ton + self.system_id = system_id + if system_type is not None: + self.system_type = system_type + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def address_range(self): + """Gets the address_range of this SmppSmsProviderConfiguration. # noqa: E501 + + Address range # noqa: E501 + + :return: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._address_range + + @address_range.setter + def address_range(self, address_range): + """Sets the address_range of this SmppSmsProviderConfiguration. + + Address range # noqa: E501 + + :param address_range: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._address_range = address_range + + @property + def bind_type(self): + """Gets the bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :return: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._bind_type + + @bind_type.setter + def bind_type(self, bind_type): + """Sets the bind_type of this SmppSmsProviderConfiguration. + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :param bind_type: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["RX", "TRX", "TX"] # noqa: E501 + if bind_type not in allowed_values: + raise ValueError( + "Invalid value for `bind_type` ({0}), must be one of {1}" # noqa: E501 + .format(bind_type, allowed_values) + ) + + self._bind_type = bind_type + + @property + def coding_scheme(self): + """Gets the coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :return: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._coding_scheme + + @coding_scheme.setter + def coding_scheme(self, coding_scheme): + """Sets the coding_scheme of this SmppSmsProviderConfiguration. + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :param coding_scheme: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._coding_scheme = coding_scheme + + @property + def destination_npi(self): + """Gets the destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_npi + + @destination_npi.setter + def destination_npi(self, destination_npi): + """Sets the destination_npi of this SmppSmsProviderConfiguration. + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param destination_npi: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_npi = destination_npi + + @property + def destination_ton(self): + """Gets the destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_ton + + @destination_ton.setter + def destination_ton(self, destination_ton): + """Sets the destination_ton of this SmppSmsProviderConfiguration. + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param destination_ton: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_ton = destination_ton + + @property + def host(self): + """Gets the host of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP host # noqa: E501 + + :return: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SmppSmsProviderConfiguration. + + SMPP host # noqa: E501 + + :param host: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if host is None: + raise ValueError("Invalid value for `host`, must not be `None`") # noqa: E501 + + self._host = host + + @property + def password(self): + """Gets the password of this SmppSmsProviderConfiguration. # noqa: E501 + + Password # noqa: E501 + + :return: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SmppSmsProviderConfiguration. + + Password # noqa: E501 + + :param password: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + @property + def port(self): + """Gets the port of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP port # noqa: E501 + + :return: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SmppSmsProviderConfiguration. + + SMPP port # noqa: E501 + + :param port: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :type: int + """ + if port is None: + raise ValueError("Invalid value for `port`, must not be `None`") # noqa: E501 + + self._port = port + + @property + def protocol_version(self): + """Gets the protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP version # noqa: E501 + + :return: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SmppSmsProviderConfiguration. + + SMPP version # noqa: E501 + + :param protocol_version: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if protocol_version is None: + raise ValueError("Invalid value for `protocol_version`, must not be `None`") # noqa: E501 + allowed_values = ["3.3", "3.4"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def service_type(self): + """Gets the service_type of this SmppSmsProviderConfiguration. # noqa: E501 + + Service type # noqa: E501 + + :return: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SmppSmsProviderConfiguration. + + Service type # noqa: E501 + + :param service_type: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def source_address(self): + """Gets the source_address of this SmppSmsProviderConfiguration. # noqa: E501 + + Source address # noqa: E501 + + :return: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_address + + @source_address.setter + def source_address(self, source_address): + """Sets the source_address of this SmppSmsProviderConfiguration. + + Source address # noqa: E501 + + :param source_address: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_address = source_address + + @property + def source_npi(self): + """Gets the source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_npi + + @source_npi.setter + def source_npi(self, source_npi): + """Sets the source_npi of this SmppSmsProviderConfiguration. + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param source_npi: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_npi = source_npi + + @property + def source_ton(self): + """Gets the source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_ton + + @source_ton.setter + def source_ton(self, source_ton): + """Sets the source_ton of this SmppSmsProviderConfiguration. + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param source_ton: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_ton = source_ton + + @property + def system_id(self): + """Gets the system_id of this SmppSmsProviderConfiguration. # noqa: E501 + + System ID # noqa: E501 + + :return: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_id + + @system_id.setter + def system_id(self, system_id): + """Sets the system_id of this SmppSmsProviderConfiguration. + + System ID # noqa: E501 + + :param system_id: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if system_id is None: + raise ValueError("Invalid value for `system_id`, must not be `None`") # noqa: E501 + + self._system_id = system_id + + @property + def system_type(self): + """Gets the system_type of this SmppSmsProviderConfiguration. # noqa: E501 + + System type # noqa: E501 + + :return: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_type + + @system_type.setter + def system_type(self, system_type): + """Sets the system_type of this SmppSmsProviderConfiguration. + + System type # noqa: E501 + + :param system_type: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._system_type = system_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmppSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmppSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/sms_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_delivery_method_notification_template.py new file mode 100644 index 0000000..d6b12b8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SmsDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SmsDeliveryMethodNotificationTemplate. + + + :param body: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SmsDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_provider_configuration.py new file mode 100644 index 0000000..1bb08b6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_provider_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsProviderConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/sms_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_two_fa_account_config.py new file mode 100644 index 0000000..437a7de --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_two_fa_account_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.two_fa_account_config import TwoFaAccountConfig # noqa: F401,E501 + +class SmsTwoFaAccountConfig(TwoFaAccountConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'phone_number': 'str', + 'use_by_default': 'bool' + } + if hasattr(TwoFaAccountConfig, "swagger_types"): + swagger_types.update(TwoFaAccountConfig.swagger_types) + + attribute_map = { + 'phone_number': 'phoneNumber', + 'use_by_default': 'useByDefault' + } + if hasattr(TwoFaAccountConfig, "attribute_map"): + attribute_map.update(TwoFaAccountConfig.attribute_map) + + def __init__(self, phone_number=None, use_by_default=None, *args, **kwargs): # noqa: E501 + """SmsTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._phone_number = None + self._use_by_default = None + self.discriminator = None + self.phone_number = phone_number + if use_by_default is not None: + self.use_by_default = use_by_default + TwoFaAccountConfig.__init__(self, *args, **kwargs) + + @property + def phone_number(self): + """Gets the phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._phone_number + + @phone_number.setter + def phone_number(self, phone_number): + """Sets the phone_number of this SmsTwoFaAccountConfig. + + + :param phone_number: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if phone_number is None: + raise ValueError("Invalid value for `phone_number`, must not be `None`") # noqa: E501 + + self._phone_number = phone_number + + @property + def use_by_default(self): + """Gets the use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this SmsTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/sms_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_two_fa_provider_config.py new file mode 100644 index 0000000..2179e97 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/sms_two_fa_provider_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sms_verification_message_template': 'str', + 'verification_code_lifetime': 'int' + } + + attribute_map = { + 'sms_verification_message_template': 'smsVerificationMessageTemplate', + 'verification_code_lifetime': 'verificationCodeLifetime' + } + + def __init__(self, sms_verification_message_template=None, verification_code_lifetime=None): # noqa: E501 + """SmsTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._sms_verification_message_template = None + self._verification_code_lifetime = None + self.discriminator = None + self.sms_verification_message_template = sms_verification_message_template + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + + @property + def sms_verification_message_template(self): + """Gets the sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._sms_verification_message_template + + @sms_verification_message_template.setter + def sms_verification_message_template(self, sms_verification_message_template): + """Sets the sms_verification_message_template of this SmsTwoFaProviderConfig. + + + :param sms_verification_message_template: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if sms_verification_message_template is None: + raise ValueError("Invalid value for `sms_verification_message_template`, must not be `None`") # noqa: E501 + + self._sms_verification_message_template = sms_verification_message_template + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this SmsTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_communication_config.py new file mode 100644 index 0000000..5f01ccc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_communication_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'spec': 'str' + } + + attribute_map = { + 'spec': 'spec' + } + + def __init__(self, spec=None): # noqa: E501 + """SnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._spec = None + self.discriminator = None + if spec is not None: + self.spec = spec + + @property + def spec(self): + """Gets the spec of this SnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SnmpCommunicationConfig. + + + :param spec: The spec of this SnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_device_profile_transport_configuration.py new file mode 100644 index 0000000..2527fc4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_device_profile_transport_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'communication_configs': 'list[SnmpCommunicationConfig]', + 'retries': 'int', + 'timeout_ms': 'int' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'communication_configs': 'communicationConfigs', + 'retries': 'retries', + 'timeout_ms': 'timeoutMs' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, communication_configs=None, retries=None, timeout_ms=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._communication_configs = None + self._retries = None + self._timeout_ms = None + self.discriminator = None + if communication_configs is not None: + self.communication_configs = communication_configs + if retries is not None: + self.retries = retries + if timeout_ms is not None: + self.timeout_ms = timeout_ms + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def communication_configs(self): + """Gets the communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[SnmpCommunicationConfig] + """ + return self._communication_configs + + @communication_configs.setter + def communication_configs(self, communication_configs): + """Sets the communication_configs of this SnmpDeviceProfileTransportConfiguration. + + + :param communication_configs: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[SnmpCommunicationConfig] + """ + + self._communication_configs = communication_configs + + @property + def retries(self): + """Gets the retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this SnmpDeviceProfileTransportConfiguration. + + + :param retries: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def timeout_ms(self): + """Gets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._timeout_ms + + @timeout_ms.setter + def timeout_ms(self, timeout_ms): + """Sets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. + + + :param timeout_ms: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._timeout_ms = timeout_ms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_device_transport_configuration.py new file mode 100644 index 0000000..75419ff --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_device_transport_configuration.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'authentication_passphrase': 'str', + 'authentication_protocol': 'str', + 'community': 'str', + 'context_name': 'str', + 'engine_id': 'str', + 'host': 'str', + 'port': 'int', + 'privacy_passphrase': 'str', + 'privacy_protocol': 'str', + 'protocol_version': 'str', + 'security_name': 'str', + 'username': 'str' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'authentication_passphrase': 'authenticationPassphrase', + 'authentication_protocol': 'authenticationProtocol', + 'community': 'community', + 'context_name': 'contextName', + 'engine_id': 'engineId', + 'host': 'host', + 'port': 'port', + 'privacy_passphrase': 'privacyPassphrase', + 'privacy_protocol': 'privacyProtocol', + 'protocol_version': 'protocolVersion', + 'security_name': 'securityName', + 'username': 'username' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, authentication_passphrase=None, authentication_protocol=None, community=None, context_name=None, engine_id=None, host=None, port=None, privacy_passphrase=None, privacy_protocol=None, protocol_version=None, security_name=None, username=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._authentication_passphrase = None + self._authentication_protocol = None + self._community = None + self._context_name = None + self._engine_id = None + self._host = None + self._port = None + self._privacy_passphrase = None + self._privacy_protocol = None + self._protocol_version = None + self._security_name = None + self._username = None + self.discriminator = None + if authentication_passphrase is not None: + self.authentication_passphrase = authentication_passphrase + if authentication_protocol is not None: + self.authentication_protocol = authentication_protocol + if community is not None: + self.community = community + if context_name is not None: + self.context_name = context_name + if engine_id is not None: + self.engine_id = engine_id + if host is not None: + self.host = host + if port is not None: + self.port = port + if privacy_passphrase is not None: + self.privacy_passphrase = privacy_passphrase + if privacy_protocol is not None: + self.privacy_protocol = privacy_protocol + if protocol_version is not None: + self.protocol_version = protocol_version + if security_name is not None: + self.security_name = security_name + if username is not None: + self.username = username + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def authentication_passphrase(self): + """Gets the authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_passphrase + + @authentication_passphrase.setter + def authentication_passphrase(self, authentication_passphrase): + """Sets the authentication_passphrase of this SnmpDeviceTransportConfiguration. + + + :param authentication_passphrase: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._authentication_passphrase = authentication_passphrase + + @property + def authentication_protocol(self): + """Gets the authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_protocol + + @authentication_protocol.setter + def authentication_protocol(self, authentication_protocol): + """Sets the authentication_protocol of this SnmpDeviceTransportConfiguration. + + + :param authentication_protocol: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512"] # noqa: E501 + if authentication_protocol not in allowed_values: + raise ValueError( + "Invalid value for `authentication_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(authentication_protocol, allowed_values) + ) + + self._authentication_protocol = authentication_protocol + + @property + def community(self): + """Gets the community of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._community + + @community.setter + def community(self, community): + """Sets the community of this SnmpDeviceTransportConfiguration. + + + :param community: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._community = community + + @property + def context_name(self): + """Gets the context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._context_name + + @context_name.setter + def context_name(self, context_name): + """Sets the context_name of this SnmpDeviceTransportConfiguration. + + + :param context_name: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._context_name = context_name + + @property + def engine_id(self): + """Gets the engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._engine_id + + @engine_id.setter + def engine_id(self, engine_id): + """Sets the engine_id of this SnmpDeviceTransportConfiguration. + + + :param engine_id: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._engine_id = engine_id + + @property + def host(self): + """Gets the host of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SnmpDeviceTransportConfiguration. + + + :param host: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SnmpDeviceTransportConfiguration. + + + :param port: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def privacy_passphrase(self): + """Gets the privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_passphrase + + @privacy_passphrase.setter + def privacy_passphrase(self, privacy_passphrase): + """Sets the privacy_passphrase of this SnmpDeviceTransportConfiguration. + + + :param privacy_passphrase: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._privacy_passphrase = privacy_passphrase + + @property + def privacy_protocol(self): + """Gets the privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_protocol + + @privacy_protocol.setter + def privacy_protocol(self, privacy_protocol): + """Sets the privacy_protocol of this SnmpDeviceTransportConfiguration. + + + :param privacy_protocol: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["AES_128", "AES_192", "AES_256", "DES"] # noqa: E501 + if privacy_protocol not in allowed_values: + raise ValueError( + "Invalid value for `privacy_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(privacy_protocol, allowed_values) + ) + + self._privacy_protocol = privacy_protocol + + @property + def protocol_version(self): + """Gets the protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SnmpDeviceTransportConfiguration. + + + :param protocol_version: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["V1", "V2C", "V3"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def security_name(self): + """Gets the security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._security_name + + @security_name.setter + def security_name(self, security_name): + """Sets the security_name of this SnmpDeviceTransportConfiguration. + + + :param security_name: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._security_name = security_name + + @property + def username(self): + """Gets the username of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this SnmpDeviceTransportConfiguration. + + + :param username: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_mapping.py b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_mapping.py new file mode 100644 index 0000000..3e7c9d5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/snmp_mapping.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data_type': 'str', + 'key': 'str', + 'oid': 'str' + } + + attribute_map = { + 'data_type': 'dataType', + 'key': 'key', + 'oid': 'oid' + } + + def __init__(self, data_type=None, key=None, oid=None): # noqa: E501 + """SnmpMapping - a model defined in Swagger""" # noqa: E501 + self._data_type = None + self._key = None + self._oid = None + self.discriminator = None + if data_type is not None: + self.data_type = data_type + if key is not None: + self.key = key + if oid is not None: + self.oid = oid + + @property + def data_type(self): + """Gets the data_type of this SnmpMapping. # noqa: E501 + + + :return: The data_type of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._data_type + + @data_type.setter + def data_type(self, data_type): + """Sets the data_type of this SnmpMapping. + + + :param data_type: The data_type of this SnmpMapping. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DOUBLE", "JSON", "LONG", "STRING"] # noqa: E501 + if data_type not in allowed_values: + raise ValueError( + "Invalid value for `data_type` ({0}), must be one of {1}" # noqa: E501 + .format(data_type, allowed_values) + ) + + self._data_type = data_type + + @property + def key(self): + """Gets the key of this SnmpMapping. # noqa: E501 + + + :return: The key of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this SnmpMapping. + + + :param key: The key of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def oid(self): + """Gets the oid of this SnmpMapping. # noqa: E501 + + + :return: The oid of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._oid + + @oid.setter + def oid(self, oid): + """Sets the oid of this SnmpMapping. + + + :param oid: The oid of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._oid = oid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/specific_time_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_ce/specific_time_schedule.py new file mode 100644 index 0000000..653c3a3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/specific_time_schedule.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SpecificTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'days_of_week': 'list[int]', + 'dynamic_value': 'DynamicValuestring', + 'ends_on': 'int', + 'starts_on': 'int', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'days_of_week': 'daysOfWeek', + 'dynamic_value': 'dynamicValue', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, days_of_week=None, dynamic_value=None, ends_on=None, starts_on=None, timezone=None, type=None): # noqa: E501 + """SpecificTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._days_of_week = None + self._dynamic_value = None + self._ends_on = None + self._starts_on = None + self._timezone = None + self._type = None + self.discriminator = None + if days_of_week is not None: + self.days_of_week = days_of_week + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def days_of_week(self): + """Gets the days_of_week of this SpecificTimeSchedule. # noqa: E501 + + + :return: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :rtype: list[int] + """ + return self._days_of_week + + @days_of_week.setter + def days_of_week(self, days_of_week): + """Sets the days_of_week of this SpecificTimeSchedule. + + + :param days_of_week: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :type: list[int] + """ + + self._days_of_week = days_of_week + + @property + def dynamic_value(self): + """Gets the dynamic_value of this SpecificTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this SpecificTimeSchedule. + + + :param dynamic_value: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def ends_on(self): + """Gets the ends_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this SpecificTimeSchedule. + + + :param ends_on: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this SpecificTimeSchedule. + + + :param starts_on: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + @property + def timezone(self): + """Gets the timezone of this SpecificTimeSchedule. # noqa: E501 + + + :return: The timezone of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this SpecificTimeSchedule. + + + :param timezone: The timezone of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this SpecificTimeSchedule. # noqa: E501 + + + :return: The type of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SpecificTimeSchedule. + + + :param type: The type of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SpecificTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SpecificTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/starred_dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/starred_dashboard_info.py new file mode 100644 index 0000000..911c9b0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/starred_dashboard_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class StarredDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred_at': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred_at': 'starredAt' + } + + def __init__(self, id=None, title=None, starred_at=None): # noqa: E501 + """StarredDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred_at = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred_at is not None: + self.starred_at = starred_at + + @property + def id(self): + """Gets the id of this StarredDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this StarredDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this StarredDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this StarredDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred_at(self): + """Gets the starred_at of this StarredDashboardInfo. # noqa: E501 + + Starred timestamp # noqa: E501 + + :return: The starred_at of this StarredDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._starred_at + + @starred_at.setter + def starred_at(self, starred_at): + """Sets the starred_at of this StarredDashboardInfo. + + Starred timestamp # noqa: E501 + + :param starred_at: The starred_at of this StarredDashboardInfo. # noqa: E501 + :type: int + """ + + self._starred_at = starred_at + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StarredDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StarredDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/statistics_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/statistics_event_filter.py new file mode 100644 index 0000000..278ef7d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/statistics_event_filter.py @@ -0,0 +1,305 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.event_filter import EventFilter # noqa: F401,E501 + +class StatisticsEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'min_messages_processed': 'int', + 'max_messages_processed': 'int', + 'min_errors_occurred': 'int', + 'max_errors_occurred': 'int' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'min_messages_processed': 'minMessagesProcessed', + 'max_messages_processed': 'maxMessagesProcessed', + 'min_errors_occurred': 'minErrorsOccurred', + 'max_errors_occurred': 'maxErrorsOccurred' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, min_messages_processed=None, max_messages_processed=None, min_errors_occurred=None, max_errors_occurred=None, *args, **kwargs): # noqa: E501 + """StatisticsEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._min_messages_processed = None + self._max_messages_processed = None + self._min_errors_occurred = None + self._max_errors_occurred = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if min_messages_processed is not None: + self.min_messages_processed = min_messages_processed + if max_messages_processed is not None: + self.max_messages_processed = max_messages_processed + if min_errors_occurred is not None: + self.min_errors_occurred = min_errors_occurred + if max_errors_occurred is not None: + self.max_errors_occurred = max_errors_occurred + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this StatisticsEventFilter. # noqa: E501 + + + :return: The not_empty of this StatisticsEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this StatisticsEventFilter. + + + :param not_empty: The not_empty of this StatisticsEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this StatisticsEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this StatisticsEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this StatisticsEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this StatisticsEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def min_messages_processed(self): + """Gets the min_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The minimum number of successfully processed messages # noqa: E501 + + :return: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_messages_processed + + @min_messages_processed.setter + def min_messages_processed(self, min_messages_processed): + """Sets the min_messages_processed of this StatisticsEventFilter. + + The minimum number of successfully processed messages # noqa: E501 + + :param min_messages_processed: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_messages_processed = min_messages_processed + + @property + def max_messages_processed(self): + """Gets the max_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The maximum number of successfully processed messages # noqa: E501 + + :return: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_messages_processed + + @max_messages_processed.setter + def max_messages_processed(self, max_messages_processed): + """Sets the max_messages_processed of this StatisticsEventFilter. + + The maximum number of successfully processed messages # noqa: E501 + + :param max_messages_processed: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_messages_processed = max_messages_processed + + @property + def min_errors_occurred(self): + """Gets the min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The minimum number of errors occurred during messages processing # noqa: E501 + + :return: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_errors_occurred + + @min_errors_occurred.setter + def min_errors_occurred(self, min_errors_occurred): + """Sets the min_errors_occurred of this StatisticsEventFilter. + + The minimum number of errors occurred during messages processing # noqa: E501 + + :param min_errors_occurred: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_errors_occurred = min_errors_occurred + + @property + def max_errors_occurred(self): + """Gets the max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The maximum number of errors occurred during messages processing # noqa: E501 + + :return: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_errors_occurred + + @max_errors_occurred.setter + def max_errors_occurred(self, max_errors_occurred): + """Sets the max_errors_occurred of this StatisticsEventFilter. + + The maximum number of errors occurred during messages processing # noqa: E501 + + :param max_errors_occurred: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_errors_occurred = max_errors_occurred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StatisticsEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StatisticsEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/string_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_ce/string_filter_predicate.py new file mode 100644 index 0000000..9bd6423 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/string_filter_predicate.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class StringFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'ignore_case': 'bool', + 'operation': 'str', + 'value': 'FilterPredicateValuestring' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'ignore_case': 'ignoreCase', + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, ignore_case=None, operation=None, value=None, *args, **kwargs): # noqa: E501 + """StringFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._ignore_case = None + self._operation = None + self._value = None + self.discriminator = None + if ignore_case is not None: + self.ignore_case = ignore_case + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def ignore_case(self): + """Gets the ignore_case of this StringFilterPredicate. # noqa: E501 + + + :return: The ignore_case of this StringFilterPredicate. # noqa: E501 + :rtype: bool + """ + return self._ignore_case + + @ignore_case.setter + def ignore_case(self, ignore_case): + """Sets the ignore_case of this StringFilterPredicate. + + + :param ignore_case: The ignore_case of this StringFilterPredicate. # noqa: E501 + :type: bool + """ + + self._ignore_case = ignore_case + + @property + def operation(self): + """Gets the operation of this StringFilterPredicate. # noqa: E501 + + + :return: The operation of this StringFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this StringFilterPredicate. + + + :param operation: The operation of this StringFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["CONTAINS", "ENDS_WITH", "EQUAL", "IN", "NOT_CONTAINS", "NOT_EQUAL", "NOT_IN", "STARTS_WITH"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this StringFilterPredicate. # noqa: E501 + + + :return: The value of this StringFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuestring + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this StringFilterPredicate. + + + :param value: The value of this StringFilterPredicate. # noqa: E501 + :type: FilterPredicateValuestring + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StringFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StringFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/submit_strategy.py b/tb-rest-client/python/tb_rest_client/models/models_ce/submit_strategy.py new file mode 100644 index 0000000..d9d5776 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/submit_strategy.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SubmitStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'batch_size': 'int', + 'type': 'str' + } + + attribute_map = { + 'batch_size': 'batchSize', + 'type': 'type' + } + + def __init__(self, batch_size=None, type=None): # noqa: E501 + """SubmitStrategy - a model defined in Swagger""" # noqa: E501 + self._batch_size = None + self._type = None + self.discriminator = None + if batch_size is not None: + self.batch_size = batch_size + if type is not None: + self.type = type + + @property + def batch_size(self): + """Gets the batch_size of this SubmitStrategy. # noqa: E501 + + + :return: The batch_size of this SubmitStrategy. # noqa: E501 + :rtype: int + """ + return self._batch_size + + @batch_size.setter + def batch_size(self, batch_size): + """Sets the batch_size of this SubmitStrategy. + + + :param batch_size: The batch_size of this SubmitStrategy. # noqa: E501 + :type: int + """ + + self._batch_size = batch_size + + @property + def type(self): + """Gets the type of this SubmitStrategy. # noqa: E501 + + + :return: The type of this SubmitStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SubmitStrategy. + + + :param type: The type of this SubmitStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["BATCH", "BURST", "SEQUENTIAL", "SEQUENTIAL_BY_ORIGINATOR", "SEQUENTIAL_BY_TENANT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SubmitStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SubmitStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/system_administrators_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/system_administrators_filter.py new file mode 100644 index 0000000..31229ee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/system_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SystemAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/system_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/system_info.py new file mode 100644 index 0000000..1ac3c6b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/system_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'monolith': 'bool', + 'system_data': 'list[SystemInfoData]' + } + + attribute_map = { + 'monolith': 'monolith', + 'system_data': 'systemData' + } + + def __init__(self, monolith=None, system_data=None): # noqa: E501 + """SystemInfo - a model defined in Swagger""" # noqa: E501 + self._monolith = None + self._system_data = None + self.discriminator = None + if monolith is not None: + self.monolith = monolith + if system_data is not None: + self.system_data = system_data + + @property + def monolith(self): + """Gets the monolith of this SystemInfo. # noqa: E501 + + + :return: The monolith of this SystemInfo. # noqa: E501 + :rtype: bool + """ + return self._monolith + + @monolith.setter + def monolith(self, monolith): + """Sets the monolith of this SystemInfo. + + + :param monolith: The monolith of this SystemInfo. # noqa: E501 + :type: bool + """ + + self._monolith = monolith + + @property + def system_data(self): + """Gets the system_data of this SystemInfo. # noqa: E501 + + System data. # noqa: E501 + + :return: The system_data of this SystemInfo. # noqa: E501 + :rtype: list[SystemInfoData] + """ + return self._system_data + + @system_data.setter + def system_data(self, system_data): + """Sets the system_data of this SystemInfo. + + System data. # noqa: E501 + + :param system_data: The system_data of this SystemInfo. # noqa: E501 + :type: list[SystemInfoData] + """ + + self._system_data = system_data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/system_info_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/system_info_data.py new file mode 100644 index 0000000..5205b7c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/system_info_data.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfoData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'service_id': 'str', + 'service_type': 'str', + 'cpu_usage': 'int', + 'cpu_count': 'int', + 'memory_usage': 'int', + 'total_memory': 'int', + 'disc_usage': 'int', + 'total_disc_space': 'int' + } + + attribute_map = { + 'service_id': 'serviceId', + 'service_type': 'serviceType', + 'cpu_usage': 'cpuUsage', + 'cpu_count': 'cpuCount', + 'memory_usage': 'memoryUsage', + 'total_memory': 'totalMemory', + 'disc_usage': 'discUsage', + 'total_disc_space': 'totalDiscSpace' + } + + def __init__(self, service_id=None, service_type=None, cpu_usage=None, cpu_count=None, memory_usage=None, total_memory=None, disc_usage=None, total_disc_space=None): # noqa: E501 + """SystemInfoData - a model defined in Swagger""" # noqa: E501 + self._service_id = None + self._service_type = None + self._cpu_usage = None + self._cpu_count = None + self._memory_usage = None + self._total_memory = None + self._disc_usage = None + self._total_disc_space = None + self.discriminator = None + if service_id is not None: + self.service_id = service_id + if service_type is not None: + self.service_type = service_type + if cpu_usage is not None: + self.cpu_usage = cpu_usage + if cpu_count is not None: + self.cpu_count = cpu_count + if memory_usage is not None: + self.memory_usage = memory_usage + if total_memory is not None: + self.total_memory = total_memory + if disc_usage is not None: + self.disc_usage = disc_usage + if total_disc_space is not None: + self.total_disc_space = total_disc_space + + @property + def service_id(self): + """Gets the service_id of this SystemInfoData. # noqa: E501 + + Service Id. # noqa: E501 + + :return: The service_id of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_id + + @service_id.setter + def service_id(self, service_id): + """Sets the service_id of this SystemInfoData. + + Service Id. # noqa: E501 + + :param service_id: The service_id of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_id = service_id + + @property + def service_type(self): + """Gets the service_type of this SystemInfoData. # noqa: E501 + + Service type. # noqa: E501 + + :return: The service_type of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SystemInfoData. + + Service type. # noqa: E501 + + :param service_type: The service_type of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def cpu_usage(self): + """Gets the cpu_usage of this SystemInfoData. # noqa: E501 + + CPU usage, in percent. # noqa: E501 + + :return: The cpu_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_usage + + @cpu_usage.setter + def cpu_usage(self, cpu_usage): + """Sets the cpu_usage of this SystemInfoData. + + CPU usage, in percent. # noqa: E501 + + :param cpu_usage: The cpu_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_usage = cpu_usage + + @property + def cpu_count(self): + """Gets the cpu_count of this SystemInfoData. # noqa: E501 + + Total CPU usage. # noqa: E501 + + :return: The cpu_count of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_count + + @cpu_count.setter + def cpu_count(self, cpu_count): + """Sets the cpu_count of this SystemInfoData. + + Total CPU usage. # noqa: E501 + + :param cpu_count: The cpu_count of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_count = cpu_count + + @property + def memory_usage(self): + """Gets the memory_usage of this SystemInfoData. # noqa: E501 + + Memory usage, in percent. # noqa: E501 + + :return: The memory_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._memory_usage + + @memory_usage.setter + def memory_usage(self, memory_usage): + """Sets the memory_usage of this SystemInfoData. + + Memory usage, in percent. # noqa: E501 + + :param memory_usage: The memory_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._memory_usage = memory_usage + + @property + def total_memory(self): + """Gets the total_memory of this SystemInfoData. # noqa: E501 + + Total memory in bytes. # noqa: E501 + + :return: The total_memory of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_memory + + @total_memory.setter + def total_memory(self, total_memory): + """Sets the total_memory of this SystemInfoData. + + Total memory in bytes. # noqa: E501 + + :param total_memory: The total_memory of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_memory = total_memory + + @property + def disc_usage(self): + """Gets the disc_usage of this SystemInfoData. # noqa: E501 + + Disk usage, in percent. # noqa: E501 + + :return: The disc_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._disc_usage + + @disc_usage.setter + def disc_usage(self, disc_usage): + """Sets the disc_usage of this SystemInfoData. + + Disk usage, in percent. # noqa: E501 + + :param disc_usage: The disc_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._disc_usage = disc_usage + + @property + def total_disc_space(self): + """Gets the total_disc_space of this SystemInfoData. # noqa: E501 + + Total disc space in bytes. # noqa: E501 + + :return: The total_disc_space of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_disc_space + + @total_disc_space.setter + def total_disc_space(self, total_disc_space): + """Sets the total_disc_space of this SystemInfoData. + + Total disc space in bytes. # noqa: E501 + + :param total_disc_space: The total_disc_space of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_disc_space = total_disc_space + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfoData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfoData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource.py new file mode 100644 index 0000000..42c736b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str', + 'file_name': 'str', + 'data': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey', + 'file_name': 'fileName', + 'data': 'data' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None, file_name=None, data=None): # noqa: E501 + """TbResource - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self._file_name = None + self._data = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + if file_name is not None: + self.file_name = file_name + if data is not None: + self.data = data + + @property + def id(self): + """Gets the id of this TbResource. # noqa: E501 + + + :return: The id of this TbResource. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResource. + + + :param id: The id of this TbResource. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResource. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResource. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResource. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResource. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResource. # noqa: E501 + + + :return: The tenant_id of this TbResource. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResource. + + + :param tenant_id: The tenant_id of this TbResource. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResource. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResource. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResource. + + Resource title. # noqa: E501 + + :param title: The title of this TbResource. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResource. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResource. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResource. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResource. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResource. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResource. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + @property + def file_name(self): + """Gets the file_name of this TbResource. # noqa: E501 + + Resource file name. # noqa: E501 + + :return: The file_name of this TbResource. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this TbResource. + + Resource file name. # noqa: E501 + + :param file_name: The file_name of this TbResource. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def data(self): + """Gets the data of this TbResource. # noqa: E501 + + Resource data. # noqa: E501 + + :return: The data of this TbResource. # noqa: E501 + :rtype: str + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this TbResource. + + Resource data. # noqa: E501 + + :param data: The data of this TbResource. # noqa: E501 + :type: str + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource_id.py new file mode 100644 index 0000000..136ae59 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TbResourceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TbResourceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TbResourceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TbResourceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TbResourceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TbResourceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TB_RESOURCE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource_info.py new file mode 100644 index 0000000..8237a84 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tb_resource_info.py @@ -0,0 +1,268 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None): # noqa: E501 + """TbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + + @property + def id(self): + """Gets the id of this TbResourceInfo. # noqa: E501 + + + :return: The id of this TbResourceInfo. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceInfo. + + + :param id: The id of this TbResourceInfo. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResourceInfo. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResourceInfo. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResourceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResourceInfo. # noqa: E501 + + + :return: The tenant_id of this TbResourceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResourceInfo. + + + :param tenant_id: The tenant_id of this TbResourceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResourceInfo. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResourceInfo. + + Resource title. # noqa: E501 + + :param title: The title of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResourceInfo. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResourceInfo. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResourceInfo. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResourceInfo. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResourceInfo. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_entity_view.py new file mode 100644 index 0000000..42f5b86 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_entity_view.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'timeseries': 'list[str]', + 'attributes': 'AttributesEntityView' + } + + attribute_map = { + 'timeseries': 'timeseries', + 'attributes': 'attributes' + } + + def __init__(self, timeseries=None, attributes=None): # noqa: E501 + """TelemetryEntityView - a model defined in Swagger""" # noqa: E501 + self._timeseries = None + self._attributes = None + self.discriminator = None + self.timeseries = timeseries + self.attributes = attributes + + @property + def timeseries(self): + """Gets the timeseries of this TelemetryEntityView. # noqa: E501 + + List of time-series data keys to expose # noqa: E501 + + :return: The timeseries of this TelemetryEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this TelemetryEntityView. + + List of time-series data keys to expose # noqa: E501 + + :param timeseries: The timeseries of this TelemetryEntityView. # noqa: E501 + :type: list[str] + """ + if timeseries is None: + raise ValueError("Invalid value for `timeseries`, must not be `None`") # noqa: E501 + + self._timeseries = timeseries + + @property + def attributes(self): + """Gets the attributes of this TelemetryEntityView. # noqa: E501 + + + :return: The attributes of this TelemetryEntityView. # noqa: E501 + :rtype: AttributesEntityView + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this TelemetryEntityView. + + + :param attributes: The attributes of this TelemetryEntityView. # noqa: E501 + :type: AttributesEntityView + """ + if attributes is None: + raise ValueError("Invalid value for `attributes`, must not be `None`") # noqa: E501 + + self._attributes = attributes + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_mapping_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_mapping_configuration.py new file mode 100644 index 0000000..e380caf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_mapping_configuration.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryMappingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attribute': 'list[str]', + 'attribute_lwm2m': 'dict(str, ObjectAttributes)', + 'key_name': 'dict(str, str)', + 'observe': 'list[str]', + 'telemetry': 'list[str]' + } + + attribute_map = { + 'attribute': 'attribute', + 'attribute_lwm2m': 'attributeLwm2m', + 'key_name': 'keyName', + 'observe': 'observe', + 'telemetry': 'telemetry' + } + + def __init__(self, attribute=None, attribute_lwm2m=None, key_name=None, observe=None, telemetry=None): # noqa: E501 + """TelemetryMappingConfiguration - a model defined in Swagger""" # noqa: E501 + self._attribute = None + self._attribute_lwm2m = None + self._key_name = None + self._observe = None + self._telemetry = None + self.discriminator = None + if attribute is not None: + self.attribute = attribute + if attribute_lwm2m is not None: + self.attribute_lwm2m = attribute_lwm2m + if key_name is not None: + self.key_name = key_name + if observe is not None: + self.observe = observe + if telemetry is not None: + self.telemetry = telemetry + + @property + def attribute(self): + """Gets the attribute of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this TelemetryMappingConfiguration. + + + :param attribute: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._attribute = attribute + + @property + def attribute_lwm2m(self): + """Gets the attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, ObjectAttributes) + """ + return self._attribute_lwm2m + + @attribute_lwm2m.setter + def attribute_lwm2m(self, attribute_lwm2m): + """Sets the attribute_lwm2m of this TelemetryMappingConfiguration. + + + :param attribute_lwm2m: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, ObjectAttributes) + """ + + self._attribute_lwm2m = attribute_lwm2m + + @property + def key_name(self): + """Gets the key_name of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, str) + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this TelemetryMappingConfiguration. + + + :param key_name: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, str) + """ + + self._key_name = key_name + + @property + def observe(self): + """Gets the observe of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this TelemetryMappingConfiguration. + + + :param observe: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._observe = observe + + @property + def telemetry(self): + """Gets the telemetry of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this TelemetryMappingConfiguration. + + + :param telemetry: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._telemetry = telemetry + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryMappingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryMappingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_querying_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_querying_snmp_communication_config.py new file mode 100644 index 0000000..897178d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/telemetry_querying_snmp_communication_config.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class TelemetryQueryingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None, *args, **kwargs): # noqa: E501 + """TelemetryQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this TelemetryQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this TelemetryQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant.py new file mode 100644 index 0000000..702512f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant.py @@ -0,0 +1,507 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Tenant(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TenantId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'region': 'str', + 'tenant_profile_id': 'TenantProfileId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'region': 'region', + 'tenant_profile_id': 'tenantProfileId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, region=None, tenant_profile_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None): # noqa: E501 + """Tenant - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._region = None + self._tenant_profile_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + if region is not None: + self.region = region + self.tenant_profile_id = tenant_profile_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Tenant. # noqa: E501 + + + :return: The id of this Tenant. # noqa: E501 + :rtype: TenantId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Tenant. + + + :param id: The id of this Tenant. # noqa: E501 + :type: TenantId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Tenant. # noqa: E501 + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :return: The created_time of this Tenant. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Tenant. + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Tenant. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this Tenant. # noqa: E501 + + Title of the tenant # noqa: E501 + + :return: The title of this Tenant. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Tenant. + + Title of the tenant # noqa: E501 + + :param title: The title of this Tenant. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this Tenant. # noqa: E501 + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this Tenant. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Tenant. + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this Tenant. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def region(self): + """Gets the region of this Tenant. # noqa: E501 + + Geo region of the tenant # noqa: E501 + + :return: The region of this Tenant. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this Tenant. + + Geo region of the tenant # noqa: E501 + + :param region: The region of this Tenant. # noqa: E501 + :type: str + """ + + self._region = region + + @property + def tenant_profile_id(self): + """Gets the tenant_profile_id of this Tenant. # noqa: E501 + + + :return: The tenant_profile_id of this Tenant. # noqa: E501 + :rtype: TenantProfileId + """ + return self._tenant_profile_id + + @tenant_profile_id.setter + def tenant_profile_id(self, tenant_profile_id): + """Sets the tenant_profile_id of this Tenant. + + + :param tenant_profile_id: The tenant_profile_id of this Tenant. # noqa: E501 + :type: TenantProfileId + """ + if tenant_profile_id is None: + raise ValueError("Invalid value for `tenant_profile_id`, must not be `None`") # noqa: E501 + + self._tenant_profile_id = tenant_profile_id + + @property + def country(self): + """Gets the country of this Tenant. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this Tenant. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this Tenant. + + Country # noqa: E501 + + :param country: The country of this Tenant. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this Tenant. # noqa: E501 + + State # noqa: E501 + + :return: The state of this Tenant. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Tenant. + + State # noqa: E501 + + :param state: The state of this Tenant. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this Tenant. # noqa: E501 + + City # noqa: E501 + + :return: The city of this Tenant. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this Tenant. + + City # noqa: E501 + + :param city: The city of this Tenant. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this Tenant. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this Tenant. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this Tenant. + + Address Line 1 # noqa: E501 + + :param address: The address of this Tenant. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this Tenant. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this Tenant. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this Tenant. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this Tenant. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this Tenant. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this Tenant. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this Tenant. + + Zip code # noqa: E501 + + :param zip: The zip of this Tenant. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this Tenant. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this Tenant. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this Tenant. + + Phone number # noqa: E501 + + :param phone: The phone of this Tenant. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this Tenant. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this Tenant. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Tenant. + + Email # noqa: E501 + + :param email: The email of this Tenant. # noqa: E501 + :type: str + """ + if email is None: + raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this Tenant. # noqa: E501 + + + :return: The additional_info of this Tenant. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Tenant. + + + :param additional_info: The additional_info of this Tenant. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Tenant, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Tenant): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_administrators_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_administrators_filter.py new file mode 100644 index 0000000..e9c31d8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_administrators_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.users_filter import UsersFilter # noqa: F401,E501 + +class TenantAdministratorsFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'tenant_profiles_ids': 'list[str]', + 'tenants_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'tenant_profiles_ids': 'tenantProfilesIds', + 'tenants_ids': 'tenantsIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, tenant_profiles_ids=None, tenants_ids=None, *args, **kwargs): # noqa: E501 + """TenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self._tenant_profiles_ids = None + self._tenants_ids = None + self.discriminator = None + if tenant_profiles_ids is not None: + self.tenant_profiles_ids = tenant_profiles_ids + if tenants_ids is not None: + self.tenants_ids = tenants_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def tenant_profiles_ids(self): + """Gets the tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_profiles_ids + + @tenant_profiles_ids.setter + def tenant_profiles_ids(self, tenant_profiles_ids): + """Sets the tenant_profiles_ids of this TenantAdministratorsFilter. + + + :param tenant_profiles_ids: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenant_profiles_ids = tenant_profiles_ids + + @property + def tenants_ids(self): + """Gets the tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenants_ids + + @tenants_ids.setter + def tenants_ids(self, tenants_ids): + """Sets the tenants_ids of this TenantAdministratorsFilter. + + + :param tenants_ids: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenants_ids = tenants_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_id.py new file mode 100644 index 0000000..a383689 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_info.py new file mode 100644 index 0000000..f8ff118 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_info.py @@ -0,0 +1,533 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TenantId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'region': 'str', + 'tenant_profile_id': 'TenantProfileId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode', + 'tenant_profile_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'region': 'region', + 'tenant_profile_id': 'tenantProfileId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo', + 'tenant_profile_name': 'tenantProfileName' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, region=None, tenant_profile_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None, tenant_profile_name=None): # noqa: E501 + """TenantInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._region = None + self._tenant_profile_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self._tenant_profile_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + if region is not None: + self.region = region + self.tenant_profile_id = tenant_profile_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + if tenant_profile_name is not None: + self.tenant_profile_name = tenant_profile_name + + @property + def id(self): + """Gets the id of this TenantInfo. # noqa: E501 + + + :return: The id of this TenantInfo. # noqa: E501 + :rtype: TenantId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantInfo. + + + :param id: The id of this TenantInfo. # noqa: E501 + :type: TenantId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TenantInfo. # noqa: E501 + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :return: The created_time of this TenantInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TenantInfo. + + Timestamp of the tenant creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TenantInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this TenantInfo. # noqa: E501 + + Title of the tenant # noqa: E501 + + :return: The title of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TenantInfo. + + Title of the tenant # noqa: E501 + + :param title: The title of this TenantInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this TenantInfo. # noqa: E501 + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantInfo. + + Name of the tenant. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this TenantInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def region(self): + """Gets the region of this TenantInfo. # noqa: E501 + + Geo region of the tenant # noqa: E501 + + :return: The region of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this TenantInfo. + + Geo region of the tenant # noqa: E501 + + :param region: The region of this TenantInfo. # noqa: E501 + :type: str + """ + + self._region = region + + @property + def tenant_profile_id(self): + """Gets the tenant_profile_id of this TenantInfo. # noqa: E501 + + + :return: The tenant_profile_id of this TenantInfo. # noqa: E501 + :rtype: TenantProfileId + """ + return self._tenant_profile_id + + @tenant_profile_id.setter + def tenant_profile_id(self, tenant_profile_id): + """Sets the tenant_profile_id of this TenantInfo. + + + :param tenant_profile_id: The tenant_profile_id of this TenantInfo. # noqa: E501 + :type: TenantProfileId + """ + if tenant_profile_id is None: + raise ValueError("Invalid value for `tenant_profile_id`, must not be `None`") # noqa: E501 + + self._tenant_profile_id = tenant_profile_id + + @property + def country(self): + """Gets the country of this TenantInfo. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this TenantInfo. + + Country # noqa: E501 + + :param country: The country of this TenantInfo. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this TenantInfo. # noqa: E501 + + State # noqa: E501 + + :return: The state of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this TenantInfo. + + State # noqa: E501 + + :param state: The state of this TenantInfo. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this TenantInfo. # noqa: E501 + + City # noqa: E501 + + :return: The city of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this TenantInfo. + + City # noqa: E501 + + :param city: The city of this TenantInfo. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this TenantInfo. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this TenantInfo. + + Address Line 1 # noqa: E501 + + :param address: The address of this TenantInfo. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this TenantInfo. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this TenantInfo. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this TenantInfo. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this TenantInfo. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this TenantInfo. + + Zip code # noqa: E501 + + :param zip: The zip of this TenantInfo. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this TenantInfo. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this TenantInfo. + + Phone number # noqa: E501 + + :param phone: The phone of this TenantInfo. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this TenantInfo. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this TenantInfo. + + Email # noqa: E501 + + :param email: The email of this TenantInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this TenantInfo. # noqa: E501 + + + :return: The additional_info of this TenantInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this TenantInfo. + + + :param additional_info: The additional_info of this TenantInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def tenant_profile_name(self): + """Gets the tenant_profile_name of this TenantInfo. # noqa: E501 + + Tenant Profile name # noqa: E501 + + :return: The tenant_profile_name of this TenantInfo. # noqa: E501 + :rtype: str + """ + return self._tenant_profile_name + + @tenant_profile_name.setter + def tenant_profile_name(self, tenant_profile_name): + """Sets the tenant_profile_name of this TenantInfo. + + Tenant Profile name # noqa: E501 + + :param tenant_profile_name: The tenant_profile_name of this TenantInfo. # noqa: E501 + :type: str + """ + + self._tenant_profile_name = tenant_profile_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile.py new file mode 100644 index 0000000..2cbe46f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile.py @@ -0,0 +1,288 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfile(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default': 'bool', + 'id': 'TenantProfileId', + 'created_time': 'int', + 'name': 'str', + 'description': 'str', + 'isolated_tb_rule_engine': 'bool', + 'profile_data': 'TenantProfileData' + } + + attribute_map = { + 'default': 'default', + 'id': 'id', + 'created_time': 'createdTime', + 'name': 'name', + 'description': 'description', + 'isolated_tb_rule_engine': 'isolatedTbRuleEngine', + 'profile_data': 'profileData' + } + + def __init__(self, default=None, id=None, created_time=None, name=None, description=None, isolated_tb_rule_engine=None, profile_data=None): # noqa: E501 + """TenantProfile - a model defined in Swagger""" # noqa: E501 + self._default = None + self._id = None + self._created_time = None + self._name = None + self._description = None + self._isolated_tb_rule_engine = None + self._profile_data = None + self.discriminator = None + if default is not None: + self.default = default + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if name is not None: + self.name = name + if description is not None: + self.description = description + if isolated_tb_rule_engine is not None: + self.isolated_tb_rule_engine = isolated_tb_rule_engine + if profile_data is not None: + self.profile_data = profile_data + + @property + def default(self): + """Gets the default of this TenantProfile. # noqa: E501 + + + :return: The default of this TenantProfile. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this TenantProfile. + + + :param default: The default of this TenantProfile. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def id(self): + """Gets the id of this TenantProfile. # noqa: E501 + + + :return: The id of this TenantProfile. # noqa: E501 + :rtype: TenantProfileId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantProfile. + + + :param id: The id of this TenantProfile. # noqa: E501 + :type: TenantProfileId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TenantProfile. # noqa: E501 + + Timestamp of the tenant profile creation, in milliseconds # noqa: E501 + + :return: The created_time of this TenantProfile. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TenantProfile. + + Timestamp of the tenant profile creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TenantProfile. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def name(self): + """Gets the name of this TenantProfile. # noqa: E501 + + Name of the tenant profile # noqa: E501 + + :return: The name of this TenantProfile. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantProfile. + + Name of the tenant profile # noqa: E501 + + :param name: The name of this TenantProfile. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this TenantProfile. # noqa: E501 + + Description of the tenant profile # noqa: E501 + + :return: The description of this TenantProfile. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this TenantProfile. + + Description of the tenant profile # noqa: E501 + + :param description: The description of this TenantProfile. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def isolated_tb_rule_engine(self): + """Gets the isolated_tb_rule_engine of this TenantProfile. # noqa: E501 + + If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants # noqa: E501 + + :return: The isolated_tb_rule_engine of this TenantProfile. # noqa: E501 + :rtype: bool + """ + return self._isolated_tb_rule_engine + + @isolated_tb_rule_engine.setter + def isolated_tb_rule_engine(self, isolated_tb_rule_engine): + """Sets the isolated_tb_rule_engine of this TenantProfile. + + If enabled, will push all messages related to this tenant and processed by the rule engine into separate queue. Useful for complex microservices deployments, to isolate processing of the data for specific tenants # noqa: E501 + + :param isolated_tb_rule_engine: The isolated_tb_rule_engine of this TenantProfile. # noqa: E501 + :type: bool + """ + + self._isolated_tb_rule_engine = isolated_tb_rule_engine + + @property + def profile_data(self): + """Gets the profile_data of this TenantProfile. # noqa: E501 + + + :return: The profile_data of this TenantProfile. # noqa: E501 + :rtype: TenantProfileData + """ + return self._profile_data + + @profile_data.setter + def profile_data(self, profile_data): + """Sets the profile_data of this TenantProfile. + + + :param profile_data: The profile_data of this TenantProfile. # noqa: E501 + :type: TenantProfileData + """ + + self._profile_data = profile_data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfile, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfile): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_configuration.py new file mode 100644 index 0000000..0eefc79 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_data.py new file mode 100644 index 0000000..76ab8b6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_data.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'TenantProfileConfiguration', + 'queue_configuration': 'list[TenantProfileQueueConfiguration]' + } + + attribute_map = { + 'configuration': 'configuration', + 'queue_configuration': 'queueConfiguration' + } + + def __init__(self, configuration=None, queue_configuration=None): # noqa: E501 + """TenantProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._queue_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if queue_configuration is not None: + self.queue_configuration = queue_configuration + + @property + def configuration(self): + """Gets the configuration of this TenantProfileData. # noqa: E501 + + + :return: The configuration of this TenantProfileData. # noqa: E501 + :rtype: TenantProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this TenantProfileData. + + + :param configuration: The configuration of this TenantProfileData. # noqa: E501 + :type: TenantProfileConfiguration + """ + + self._configuration = configuration + + @property + def queue_configuration(self): + """Gets the queue_configuration of this TenantProfileData. # noqa: E501 + + JSON array of queue configuration per tenant profile # noqa: E501 + + :return: The queue_configuration of this TenantProfileData. # noqa: E501 + :rtype: list[TenantProfileQueueConfiguration] + """ + return self._queue_configuration + + @queue_configuration.setter + def queue_configuration(self, queue_configuration): + """Sets the queue_configuration of this TenantProfileData. + + JSON array of queue configuration per tenant profile # noqa: E501 + + :param queue_configuration: The queue_configuration of this TenantProfileData. # noqa: E501 + :type: list[TenantProfileQueueConfiguration] + """ + + self._queue_configuration = queue_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_id.py new file mode 100644 index 0000000..f197a7c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_queue_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_queue_configuration.py new file mode 100644 index 0000000..722cead --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/tenant_profile_queue_configuration.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileQueueConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, topic=None): # noqa: E501 + """TenantProfileQueueConfiguration - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this TenantProfileQueueConfiguration. + + + :param additional_info: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this TenantProfileQueueConfiguration. + + + :param consumer_per_partition: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def name(self): + """Gets the name of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantProfileQueueConfiguration. + + + :param name: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this TenantProfileQueueConfiguration. + + + :param pack_processing_timeout: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this TenantProfileQueueConfiguration. + + + :param partitions: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this TenantProfileQueueConfiguration. + + + :param poll_interval: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this TenantProfileQueueConfiguration. + + + :param processing_strategy: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this TenantProfileQueueConfiguration. + + + :param submit_strategy: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def topic(self): + """Gets the topic of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this TenantProfileQueueConfiguration. + + + :param topic: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileQueueConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileQueueConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/test_sms_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/test_sms_request.py new file mode 100644 index 0000000..8170515 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/test_sms_request.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TestSmsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provider_configuration': 'SmsProviderConfiguration', + 'number_to': 'str', + 'message': 'str' + } + + attribute_map = { + 'provider_configuration': 'providerConfiguration', + 'number_to': 'numberTo', + 'message': 'message' + } + + def __init__(self, provider_configuration=None, number_to=None, message=None): # noqa: E501 + """TestSmsRequest - a model defined in Swagger""" # noqa: E501 + self._provider_configuration = None + self._number_to = None + self._message = None + self.discriminator = None + if provider_configuration is not None: + self.provider_configuration = provider_configuration + if number_to is not None: + self.number_to = number_to + if message is not None: + self.message = message + + @property + def provider_configuration(self): + """Gets the provider_configuration of this TestSmsRequest. # noqa: E501 + + + :return: The provider_configuration of this TestSmsRequest. # noqa: E501 + :rtype: SmsProviderConfiguration + """ + return self._provider_configuration + + @provider_configuration.setter + def provider_configuration(self, provider_configuration): + """Sets the provider_configuration of this TestSmsRequest. + + + :param provider_configuration: The provider_configuration of this TestSmsRequest. # noqa: E501 + :type: SmsProviderConfiguration + """ + + self._provider_configuration = provider_configuration + + @property + def number_to(self): + """Gets the number_to of this TestSmsRequest. # noqa: E501 + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :return: The number_to of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._number_to + + @number_to.setter + def number_to(self, number_to): + """Sets the number_to of this TestSmsRequest. + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :param number_to: The number_to of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._number_to = number_to + + @property + def message(self): + """Gets the message of this TestSmsRequest. # noqa: E501 + + The test message # noqa: E501 + + :return: The message of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this TestSmsRequest. + + The test message # noqa: E501 + + :param message: The message of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TestSmsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TestSmsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/thingsboard_credentials_expired_response.py b/tb-rest-client/python/tb_rest_client/models/models_ce/thingsboard_credentials_expired_response.py new file mode 100644 index 0000000..acfa5b6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/thingsboard_credentials_expired_response.py @@ -0,0 +1,238 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardCredentialsExpiredResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime', + 'reset_token': 'str' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp', + 'reset_token': 'resetToken' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None, reset_token=None): # noqa: E501 + """ThingsboardCredentialsExpiredResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self._reset_token = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + if reset_token is not None: + self.reset_token = reset_token + + @property + def status(self): + """Gets the status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardCredentialsExpiredResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardCredentialsExpiredResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardCredentialsExpiredResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardCredentialsExpiredResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + @property + def reset_token(self): + """Gets the reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Password reset token # noqa: E501 + + :return: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ThingsboardCredentialsExpiredResponse. + + Password reset token # noqa: E501 + + :param reset_token: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardCredentialsExpiredResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardCredentialsExpiredResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/thingsboard_error_response.py b/tb-rest-client/python/tb_rest_client/models/models_ce/thingsboard_error_response.py new file mode 100644 index 0000000..fa256b5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/thingsboard_error_response.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardErrorResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None): # noqa: E501 + """ThingsboardErrorResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + + @property + def status(self): + """Gets the status of this ThingsboardErrorResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardErrorResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardErrorResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardErrorResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardErrorResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardErrorResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardErrorResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardErrorResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardErrorResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardErrorResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardErrorResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardErrorResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardErrorResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardErrorResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/to_device_rpc_request_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/to_device_rpc_request_snmp_communication_config.py new file mode 100644 index 0000000..b159826 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/to_device_rpc_request_snmp_communication_config.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ToDeviceRpcRequestSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + + def __init__(self, mappings=None, spec=None): # noqa: E501 + """ToDeviceRpcRequestSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param mappings: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param spec: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ToDeviceRpcRequestSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ToDeviceRpcRequestSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/totp_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/totp_two_fa_account_config.py new file mode 100644 index 0000000..1f69a88 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/totp_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_url': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'auth_url': 'authUrl', + 'use_by_default': 'useByDefault' + } + + def __init__(self, auth_url=None, use_by_default=None): # noqa: E501 + """TotpTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._auth_url = None + self._use_by_default = None + self.discriminator = None + self.auth_url = auth_url + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def auth_url(self): + """Gets the auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._auth_url + + @auth_url.setter + def auth_url(self, auth_url): + """Sets the auth_url of this TotpTwoFaAccountConfig. + + + :param auth_url: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if auth_url is None: + raise ValueError("Invalid value for `auth_url`, must not be `None`") # noqa: E501 + + self._auth_url = auth_url + + @property + def use_by_default(self): + """Gets the use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TotpTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/totp_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/totp_two_fa_provider_config.py new file mode 100644 index 0000000..f92ed06 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/totp_two_fa_provider_config.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'issuer_name': 'str' + } + + attribute_map = { + 'issuer_name': 'issuerName' + } + + def __init__(self, issuer_name=None): # noqa: E501 + """TotpTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._issuer_name = None + self.discriminator = None + self.issuer_name = issuer_name + + @property + def issuer_name(self): + """Gets the issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + + + :return: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._issuer_name + + @issuer_name.setter + def issuer_name(self, issuer_name): + """Sets the issuer_name of this TotpTwoFaProviderConfig. + + + :param issuer_name: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if issuer_name is None: + raise ValueError("Invalid value for `issuer_name`, must not be `None`") # noqa: E501 + + self._issuer_name = issuer_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/transport_payload_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/transport_payload_type_configuration.py new file mode 100644 index 0000000..d03a1c3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/transport_payload_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TransportPayloadTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TransportPayloadTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TransportPayloadTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TransportPayloadTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/ts_value.py b/tb-rest-client/python/tb_rest_client/models/models_ce/ts_value.py new file mode 100644 index 0000000..356fa7f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/ts_value.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'count': 'int', + 'ts': 'int', + 'value': 'str' + } + + attribute_map = { + 'count': 'count', + 'ts': 'ts', + 'value': 'value' + } + + def __init__(self, count=None, ts=None, value=None): # noqa: E501 + """TsValue - a model defined in Swagger""" # noqa: E501 + self._count = None + self._ts = None + self._value = None + self.discriminator = None + if count is not None: + self.count = count + if ts is not None: + self.ts = ts + if value is not None: + self.value = value + + @property + def count(self): + """Gets the count of this TsValue. # noqa: E501 + + + :return: The count of this TsValue. # noqa: E501 + :rtype: int + """ + return self._count + + @count.setter + def count(self, count): + """Sets the count of this TsValue. + + + :param count: The count of this TsValue. # noqa: E501 + :type: int + """ + + self._count = count + + @property + def ts(self): + """Gets the ts of this TsValue. # noqa: E501 + + + :return: The ts of this TsValue. # noqa: E501 + :rtype: int + """ + return self._ts + + @ts.setter + def ts(self, ts): + """Sets the ts of this TsValue. + + + :param ts: The ts of this TsValue. # noqa: E501 + :type: int + """ + + self._ts = ts + + @property + def value(self): + """Gets the value of this TsValue. # noqa: E501 + + + :return: The value of this TsValue. # noqa: E501 + :rtype: str + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this TsValue. + + + :param value: The value of this TsValue. # noqa: E501 + :type: str + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/twilio_sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/twilio_sms_provider_configuration.py new file mode 100644 index 0000000..2b82627 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/twilio_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class TwilioSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'account_sid': 'str', + 'account_token': 'str', + 'number_from': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'account_sid': 'accountSid', + 'account_token': 'accountToken', + 'number_from': 'numberFrom' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, account_sid=None, account_token=None, number_from=None, *args, **kwargs): # noqa: E501 + """TwilioSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._account_sid = None + self._account_token = None + self._number_from = None + self.discriminator = None + if account_sid is not None: + self.account_sid = account_sid + if account_token is not None: + self.account_token = account_token + if number_from is not None: + self.number_from = number_from + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def account_sid(self): + """Gets the account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Sid. # noqa: E501 + + :return: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_sid + + @account_sid.setter + def account_sid(self, account_sid): + """Sets the account_sid of this TwilioSmsProviderConfiguration. + + Twilio account Sid. # noqa: E501 + + :param account_sid: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_sid = account_sid + + @property + def account_token(self): + """Gets the account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Token. # noqa: E501 + + :return: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_token + + @account_token.setter + def account_token(self, account_token): + """Sets the account_token of this TwilioSmsProviderConfiguration. + + Twilio account Token. # noqa: E501 + + :param account_token: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_token = account_token + + @property + def number_from(self): + """Gets the number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + + The number/id of a sender. # noqa: E501 + + :return: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._number_from + + @number_from.setter + def number_from(self, number_from): + """Sets the number_from of this TwilioSmsProviderConfiguration. + + The number/id of a sender. # noqa: E501 + + :param number_from: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._number_from = number_from + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwilioSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwilioSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_account_config.py new file mode 100644 index 0000000..85eee91 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_account_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_account_config_update_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_account_config_update_request.py new file mode 100644 index 0000000..02ec2c1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_account_config_update_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfigUpdateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfigUpdateRequest - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfigUpdateRequest. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfigUpdateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfigUpdateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_provider_config.py new file mode 100644 index 0000000..4733f37 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_provider_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_provider_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_provider_info.py new file mode 100644 index 0000000..da2a5aa --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/two_fa_provider_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'contact': 'str', + 'default': 'bool', + 'min_verification_code_send_period': 'int', + 'type': 'str' + } + + attribute_map = { + 'contact': 'contact', + 'default': 'default', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'type': 'type' + } + + def __init__(self, contact=None, default=None, min_verification_code_send_period=None, type=None): # noqa: E501 + """TwoFaProviderInfo - a model defined in Swagger""" # noqa: E501 + self._contact = None + self._default = None + self._min_verification_code_send_period = None + self._type = None + self.discriminator = None + if contact is not None: + self.contact = contact + if default is not None: + self.default = default + if min_verification_code_send_period is not None: + self.min_verification_code_send_period = min_verification_code_send_period + if type is not None: + self.type = type + + @property + def contact(self): + """Gets the contact of this TwoFaProviderInfo. # noqa: E501 + + + :return: The contact of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._contact + + @contact.setter + def contact(self, contact): + """Sets the contact of this TwoFaProviderInfo. + + + :param contact: The contact of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + + self._contact = contact + + @property + def default(self): + """Gets the default of this TwoFaProviderInfo. # noqa: E501 + + + :return: The default of this TwoFaProviderInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this TwoFaProviderInfo. + + + :param default: The default of this TwoFaProviderInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + + + :return: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this TwoFaProviderInfo. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :type: int + """ + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def type(self): + """Gets the type of this TwoFaProviderInfo. # noqa: E501 + + + :return: The type of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this TwoFaProviderInfo. + + + :param type: The type of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + allowed_values = ["BACKUP_CODE", "EMAIL", "SMS", "TOTP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/update_message.py b/tb-rest-client/python/tb_rest_client/models/models_ce/update_message.py new file mode 100644 index 0000000..6334d0e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/update_message.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UpdateMessage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'update_available': 'bool', + 'current_version': 'str', + 'latest_version': 'str', + 'upgrade_instructions_url': 'str', + 'current_version_release_notes_url': 'str', + 'latest_version_release_notes_url': 'str' + } + + attribute_map = { + 'update_available': 'updateAvailable', + 'current_version': 'currentVersion', + 'latest_version': 'latestVersion', + 'upgrade_instructions_url': 'upgradeInstructionsUrl', + 'current_version_release_notes_url': 'currentVersionReleaseNotesUrl', + 'latest_version_release_notes_url': 'latestVersionReleaseNotesUrl' + } + + def __init__(self, update_available=None, current_version=None, latest_version=None, upgrade_instructions_url=None, current_version_release_notes_url=None, latest_version_release_notes_url=None): # noqa: E501 + """UpdateMessage - a model defined in Swagger""" # noqa: E501 + self._update_available = None + self._current_version = None + self._latest_version = None + self._upgrade_instructions_url = None + self._current_version_release_notes_url = None + self._latest_version_release_notes_url = None + self.discriminator = None + if update_available is not None: + self.update_available = update_available + if current_version is not None: + self.current_version = current_version + if latest_version is not None: + self.latest_version = latest_version + if upgrade_instructions_url is not None: + self.upgrade_instructions_url = upgrade_instructions_url + if current_version_release_notes_url is not None: + self.current_version_release_notes_url = current_version_release_notes_url + if latest_version_release_notes_url is not None: + self.latest_version_release_notes_url = latest_version_release_notes_url + + @property + def update_available(self): + """Gets the update_available of this UpdateMessage. # noqa: E501 + + 'True' if new platform update is available. # noqa: E501 + + :return: The update_available of this UpdateMessage. # noqa: E501 + :rtype: bool + """ + return self._update_available + + @update_available.setter + def update_available(self, update_available): + """Sets the update_available of this UpdateMessage. + + 'True' if new platform update is available. # noqa: E501 + + :param update_available: The update_available of this UpdateMessage. # noqa: E501 + :type: bool + """ + + self._update_available = update_available + + @property + def current_version(self): + """Gets the current_version of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version. # noqa: E501 + + :return: The current_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this UpdateMessage. + + Current ThingsBoard version. # noqa: E501 + + :param current_version: The current_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version = current_version + + @property + def latest_version(self): + """Gets the latest_version of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version. # noqa: E501 + + :return: The latest_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version + + @latest_version.setter + def latest_version(self, latest_version): + """Sets the latest_version of this UpdateMessage. + + Latest ThingsBoard version. # noqa: E501 + + :param latest_version: The latest_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version = latest_version + + @property + def upgrade_instructions_url(self): + """Gets the upgrade_instructions_url of this UpdateMessage. # noqa: E501 + + Upgrade instructions URL. # noqa: E501 + + :return: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._upgrade_instructions_url + + @upgrade_instructions_url.setter + def upgrade_instructions_url(self, upgrade_instructions_url): + """Sets the upgrade_instructions_url of this UpdateMessage. + + Upgrade instructions URL. # noqa: E501 + + :param upgrade_instructions_url: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._upgrade_instructions_url = upgrade_instructions_url + + @property + def current_version_release_notes_url(self): + """Gets the current_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version release notes URL. # noqa: E501 + + :return: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version_release_notes_url + + @current_version_release_notes_url.setter + def current_version_release_notes_url(self, current_version_release_notes_url): + """Sets the current_version_release_notes_url of this UpdateMessage. + + Current ThingsBoard version release notes URL. # noqa: E501 + + :param current_version_release_notes_url: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version_release_notes_url = current_version_release_notes_url + + @property + def latest_version_release_notes_url(self): + """Gets the latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :return: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version_release_notes_url + + @latest_version_release_notes_url.setter + def latest_version_release_notes_url(self, latest_version_release_notes_url): + """Sets the latest_version_release_notes_url of this UpdateMessage. + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :param latest_version_release_notes_url: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version_release_notes_url = latest_version_release_notes_url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UpdateMessage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UpdateMessage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/usage_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/usage_info.py new file mode 100644 index 0000000..3566776 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/usage_info.py @@ -0,0 +1,618 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UsageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms': 'int', + 'assets': 'int', + 'customers': 'int', + 'dashboards': 'int', + 'devices': 'int', + 'emails': 'int', + 'js_executions': 'int', + 'max_alarms': 'int', + 'max_assets': 'int', + 'max_customers': 'int', + 'max_dashboards': 'int', + 'max_devices': 'int', + 'max_emails': 'int', + 'max_js_executions': 'int', + 'max_sms': 'int', + 'max_transport_messages': 'int', + 'max_users': 'int', + 'sms': 'int', + 'transport_messages': 'int', + 'users': 'int' + } + + attribute_map = { + 'alarms': 'alarms', + 'assets': 'assets', + 'customers': 'customers', + 'dashboards': 'dashboards', + 'devices': 'devices', + 'emails': 'emails', + 'js_executions': 'jsExecutions', + 'max_alarms': 'maxAlarms', + 'max_assets': 'maxAssets', + 'max_customers': 'maxCustomers', + 'max_dashboards': 'maxDashboards', + 'max_devices': 'maxDevices', + 'max_emails': 'maxEmails', + 'max_js_executions': 'maxJsExecutions', + 'max_sms': 'maxSms', + 'max_transport_messages': 'maxTransportMessages', + 'max_users': 'maxUsers', + 'sms': 'sms', + 'transport_messages': 'transportMessages', + 'users': 'users' + } + + def __init__(self, alarms=None, assets=None, customers=None, dashboards=None, devices=None, emails=None, js_executions=None, max_alarms=None, max_assets=None, max_customers=None, max_dashboards=None, max_devices=None, max_emails=None, max_js_executions=None, max_sms=None, max_transport_messages=None, max_users=None, sms=None, transport_messages=None, users=None): # noqa: E501 + """UsageInfo - a model defined in Swagger""" # noqa: E501 + self._alarms = None + self._assets = None + self._customers = None + self._dashboards = None + self._devices = None + self._emails = None + self._js_executions = None + self._max_alarms = None + self._max_assets = None + self._max_customers = None + self._max_dashboards = None + self._max_devices = None + self._max_emails = None + self._max_js_executions = None + self._max_sms = None + self._max_transport_messages = None + self._max_users = None + self._sms = None + self._transport_messages = None + self._users = None + self.discriminator = None + if alarms is not None: + self.alarms = alarms + if assets is not None: + self.assets = assets + if customers is not None: + self.customers = customers + if dashboards is not None: + self.dashboards = dashboards + if devices is not None: + self.devices = devices + if emails is not None: + self.emails = emails + if js_executions is not None: + self.js_executions = js_executions + if max_alarms is not None: + self.max_alarms = max_alarms + if max_assets is not None: + self.max_assets = max_assets + if max_customers is not None: + self.max_customers = max_customers + if max_dashboards is not None: + self.max_dashboards = max_dashboards + if max_devices is not None: + self.max_devices = max_devices + if max_emails is not None: + self.max_emails = max_emails + if max_js_executions is not None: + self.max_js_executions = max_js_executions + if max_sms is not None: + self.max_sms = max_sms + if max_transport_messages is not None: + self.max_transport_messages = max_transport_messages + if max_users is not None: + self.max_users = max_users + if sms is not None: + self.sms = sms + if transport_messages is not None: + self.transport_messages = transport_messages + if users is not None: + self.users = users + + @property + def alarms(self): + """Gets the alarms of this UsageInfo. # noqa: E501 + + + :return: The alarms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this UsageInfo. + + + :param alarms: The alarms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._alarms = alarms + + @property + def assets(self): + """Gets the assets of this UsageInfo. # noqa: E501 + + + :return: The assets of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._assets + + @assets.setter + def assets(self, assets): + """Sets the assets of this UsageInfo. + + + :param assets: The assets of this UsageInfo. # noqa: E501 + :type: int + """ + + self._assets = assets + + @property + def customers(self): + """Gets the customers of this UsageInfo. # noqa: E501 + + + :return: The customers of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._customers + + @customers.setter + def customers(self, customers): + """Sets the customers of this UsageInfo. + + + :param customers: The customers of this UsageInfo. # noqa: E501 + :type: int + """ + + self._customers = customers + + @property + def dashboards(self): + """Gets the dashboards of this UsageInfo. # noqa: E501 + + + :return: The dashboards of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._dashboards + + @dashboards.setter + def dashboards(self, dashboards): + """Sets the dashboards of this UsageInfo. + + + :param dashboards: The dashboards of this UsageInfo. # noqa: E501 + :type: int + """ + + self._dashboards = dashboards + + @property + def devices(self): + """Gets the devices of this UsageInfo. # noqa: E501 + + + :return: The devices of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this UsageInfo. + + + :param devices: The devices of this UsageInfo. # noqa: E501 + :type: int + """ + + self._devices = devices + + @property + def emails(self): + """Gets the emails of this UsageInfo. # noqa: E501 + + + :return: The emails of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._emails + + @emails.setter + def emails(self, emails): + """Sets the emails of this UsageInfo. + + + :param emails: The emails of this UsageInfo. # noqa: E501 + :type: int + """ + + self._emails = emails + + @property + def js_executions(self): + """Gets the js_executions of this UsageInfo. # noqa: E501 + + + :return: The js_executions of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._js_executions + + @js_executions.setter + def js_executions(self, js_executions): + """Sets the js_executions of this UsageInfo. + + + :param js_executions: The js_executions of this UsageInfo. # noqa: E501 + :type: int + """ + + self._js_executions = js_executions + + @property + def max_alarms(self): + """Gets the max_alarms of this UsageInfo. # noqa: E501 + + + :return: The max_alarms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_alarms + + @max_alarms.setter + def max_alarms(self, max_alarms): + """Sets the max_alarms of this UsageInfo. + + + :param max_alarms: The max_alarms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_alarms = max_alarms + + @property + def max_assets(self): + """Gets the max_assets of this UsageInfo. # noqa: E501 + + + :return: The max_assets of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this UsageInfo. + + + :param max_assets: The max_assets of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_customers(self): + """Gets the max_customers of this UsageInfo. # noqa: E501 + + + :return: The max_customers of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_customers + + @max_customers.setter + def max_customers(self, max_customers): + """Sets the max_customers of this UsageInfo. + + + :param max_customers: The max_customers of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_customers = max_customers + + @property + def max_dashboards(self): + """Gets the max_dashboards of this UsageInfo. # noqa: E501 + + + :return: The max_dashboards of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_dashboards + + @max_dashboards.setter + def max_dashboards(self, max_dashboards): + """Sets the max_dashboards of this UsageInfo. + + + :param max_dashboards: The max_dashboards of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_dashboards = max_dashboards + + @property + def max_devices(self): + """Gets the max_devices of this UsageInfo. # noqa: E501 + + + :return: The max_devices of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this UsageInfo. + + + :param max_devices: The max_devices of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def max_emails(self): + """Gets the max_emails of this UsageInfo. # noqa: E501 + + + :return: The max_emails of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_emails + + @max_emails.setter + def max_emails(self, max_emails): + """Sets the max_emails of this UsageInfo. + + + :param max_emails: The max_emails of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_emails = max_emails + + @property + def max_js_executions(self): + """Gets the max_js_executions of this UsageInfo. # noqa: E501 + + + :return: The max_js_executions of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_js_executions + + @max_js_executions.setter + def max_js_executions(self, max_js_executions): + """Sets the max_js_executions of this UsageInfo. + + + :param max_js_executions: The max_js_executions of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_js_executions = max_js_executions + + @property + def max_sms(self): + """Gets the max_sms of this UsageInfo. # noqa: E501 + + + :return: The max_sms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_sms + + @max_sms.setter + def max_sms(self, max_sms): + """Sets the max_sms of this UsageInfo. + + + :param max_sms: The max_sms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_sms = max_sms + + @property + def max_transport_messages(self): + """Gets the max_transport_messages of this UsageInfo. # noqa: E501 + + + :return: The max_transport_messages of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_transport_messages + + @max_transport_messages.setter + def max_transport_messages(self, max_transport_messages): + """Sets the max_transport_messages of this UsageInfo. + + + :param max_transport_messages: The max_transport_messages of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_transport_messages = max_transport_messages + + @property + def max_users(self): + """Gets the max_users of this UsageInfo. # noqa: E501 + + + :return: The max_users of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_users + + @max_users.setter + def max_users(self, max_users): + """Sets the max_users of this UsageInfo. + + + :param max_users: The max_users of this UsageInfo. # noqa: E501 + :type: int + """ + + self._max_users = max_users + + @property + def sms(self): + """Gets the sms of this UsageInfo. # noqa: E501 + + + :return: The sms of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._sms + + @sms.setter + def sms(self, sms): + """Sets the sms of this UsageInfo. + + + :param sms: The sms of this UsageInfo. # noqa: E501 + :type: int + """ + + self._sms = sms + + @property + def transport_messages(self): + """Gets the transport_messages of this UsageInfo. # noqa: E501 + + + :return: The transport_messages of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._transport_messages + + @transport_messages.setter + def transport_messages(self, transport_messages): + """Sets the transport_messages of this UsageInfo. + + + :param transport_messages: The transport_messages of this UsageInfo. # noqa: E501 + :type: int + """ + + self._transport_messages = transport_messages + + @property + def users(self): + """Gets the users of this UsageInfo. # noqa: E501 + + + :return: The users of this UsageInfo. # noqa: E501 + :rtype: int + """ + return self._users + + @users.setter + def users(self, users): + """Sets the users of this UsageInfo. + + + :param users: The users of this UsageInfo. # noqa: E501 + :type: int + """ + + self._users = users + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UsageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UsageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/user.py b/tb-rest-client/python/tb_rest_client/models/models_ce/user.py new file mode 100644 index 0000000..50340b6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/user.py @@ -0,0 +1,407 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class User(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'email': 'str', + 'name': 'str', + 'authority': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'phone': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'email': 'email', + 'name': 'name', + 'authority': 'authority', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'phone': 'phone', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, email=None, name=None, authority=None, first_name=None, last_name=None, phone=None, additional_info=None): # noqa: E501 + """User - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._email = None + self._name = None + self._authority = None + self._first_name = None + self._last_name = None + self._phone = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.email = email + if name is not None: + self.name = name + self.authority = authority + self.first_name = first_name + self.last_name = last_name + self.phone = phone + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this User. # noqa: E501 + + + :return: The id of this User. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + + :param id: The id of this User. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this User. # noqa: E501 + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :return: The created_time of this User. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this User. + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this User. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this User. # noqa: E501 + + + :return: The tenant_id of this User. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this User. + + + :param tenant_id: The tenant_id of this User. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this User. # noqa: E501 + + + :return: The customer_id of this User. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this User. + + + :param customer_id: The customer_id of this User. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def email(self): + """Gets the email of this User. # noqa: E501 + + Email of the user # noqa: E501 + + :return: The email of this User. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this User. + + Email of the user # noqa: E501 + + :param email: The email of this User. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def name(self): + """Gets the name of this User. # noqa: E501 + + Duplicates the email of the user, readonly # noqa: E501 + + :return: The name of this User. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this User. + + Duplicates the email of the user, readonly # noqa: E501 + + :param name: The name of this User. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def authority(self): + """Gets the authority of this User. # noqa: E501 + + Authority # noqa: E501 + + :return: The authority of this User. # noqa: E501 + :rtype: str + """ + return self._authority + + @authority.setter + def authority(self, authority): + """Sets the authority of this User. + + Authority # noqa: E501 + + :param authority: The authority of this User. # noqa: E501 + :type: str + """ + if authority is None: + raise ValueError("Invalid value for `authority`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if authority not in allowed_values: + raise ValueError( + "Invalid value for `authority` ({0}), must be one of {1}" # noqa: E501 + .format(authority, allowed_values) + ) + + self._authority = authority + + @property + def first_name(self): + """Gets the first_name of this User. # noqa: E501 + + First name of the user # noqa: E501 + + :return: The first_name of this User. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + First name of the user # noqa: E501 + + :param first_name: The first_name of this User. # noqa: E501 + :type: str + """ + # if first_name is None: + # raise ValueError("Invalid value for `first_name`, must not be `None`") # noqa: E501 + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. # noqa: E501 + + Last name of the user # noqa: E501 + + :return: The last_name of this User. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + Last name of the user # noqa: E501 + + :param last_name: The last_name of this User. # noqa: E501 + :type: str + """ + # if last_name is None: + # raise ValueError("Invalid value for `last_name`, must not be `None`") # noqa: E501 + + self._last_name = last_name + + @property + def phone(self): + """Gets the phone of this User. # noqa: E501 + + Phone number of the user # noqa: E501 + + :return: The phone of this User. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this User. + + Phone number of the user # noqa: E501 + + :param phone: The phone of this User. # noqa: E501 + :type: str + """ + # if phone is None: + # raise ValueError("Invalid value for `phone`, must not be `None`") # noqa: E501 + + self._phone = phone + + @property + def additional_info(self): + """Gets the additional_info of this User. # noqa: E501 + + + :return: The additional_info of this User. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this User. + + + :param additional_info: The additional_info of this User. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(User, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, User): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/user_dashboards_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/user_dashboards_info.py new file mode 100644 index 0000000..d64240e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/user_dashboards_info.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserDashboardsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'last': 'list[LastVisitedDashboardInfo]', + 'starred': 'list[StarredDashboardInfo]' + } + + attribute_map = { + 'last': 'last', + 'starred': 'starred' + } + + def __init__(self, last=None, starred=None): # noqa: E501 + """UserDashboardsInfo - a model defined in Swagger""" # noqa: E501 + self._last = None + self._starred = None + self.discriminator = None + if last is not None: + self.last = last + if starred is not None: + self.starred = starred + + @property + def last(self): + """Gets the last of this UserDashboardsInfo. # noqa: E501 + + List of last visited dashboards. # noqa: E501 + + :return: The last of this UserDashboardsInfo. # noqa: E501 + :rtype: list[LastVisitedDashboardInfo] + """ + return self._last + + @last.setter + def last(self, last): + """Sets the last of this UserDashboardsInfo. + + List of last visited dashboards. # noqa: E501 + + :param last: The last of this UserDashboardsInfo. # noqa: E501 + :type: list[LastVisitedDashboardInfo] + """ + + self._last = last + + @property + def starred(self): + """Gets the starred of this UserDashboardsInfo. # noqa: E501 + + List of starred dashboards. # noqa: E501 + + :return: The starred of this UserDashboardsInfo. # noqa: E501 + :rtype: list[StarredDashboardInfo] + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this UserDashboardsInfo. + + List of starred dashboards. # noqa: E501 + + :param starred: The starred of this UserDashboardsInfo. # noqa: E501 + :type: list[StarredDashboardInfo] + """ + + self._starred = starred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserDashboardsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserDashboardsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/user_email_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/user_email_info.py new file mode 100644 index 0000000..6ac0c08 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/user_email_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, email=None, first_name=None, last_name=None): # noqa: E501 + """UserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this UserEmailInfo. # noqa: E501 + + + :return: The id of this UserEmailInfo. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserEmailInfo. + + + :param id: The id of this UserEmailInfo. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def email(self): + """Gets the email of this UserEmailInfo. # noqa: E501 + + User email # noqa: E501 + + :return: The email of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this UserEmailInfo. + + User email # noqa: E501 + + :param email: The email of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this UserEmailInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this UserEmailInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this UserEmailInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this UserEmailInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/user_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/user_id.py new file mode 100644 index 0000000..dbe4bea --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/user_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """UserId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this UserId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this UserId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this UserId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this UserId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this UserId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this UserId. + + string # noqa: E501 + + :param entity_type: The entity_type of this UserId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["USER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/user_list_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/user_list_filter.py new file mode 100644 index 0000000..41d5d3e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/user_list_filter.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserListFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'users_ids': 'list[str]' + } + + attribute_map = { + 'users_ids': 'usersIds' + } + + def __init__(self, users_ids=None): # noqa: E501 + """UserListFilter - a model defined in Swagger""" # noqa: E501 + self._users_ids = None + self.discriminator = None + if users_ids is not None: + self.users_ids = users_ids + + @property + def users_ids(self): + """Gets the users_ids of this UserListFilter. # noqa: E501 + + + :return: The users_ids of this UserListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._users_ids + + @users_ids.setter + def users_ids(self, users_ids): + """Sets the users_ids of this UserListFilter. + + + :param users_ids: The users_ids of this UserListFilter. # noqa: E501 + :type: list[str] + """ + + self._users_ids = users_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/user_password_policy.py b/tb-rest-client/python/tb_rest_client/models/models_ce/user_password_policy.py new file mode 100644 index 0000000..41b736f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/user_password_policy.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserPasswordPolicy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_whitespaces': 'bool', + 'minimum_digits': 'int', + 'minimum_length': 'int', + 'minimum_lowercase_letters': 'int', + 'minimum_special_characters': 'int', + 'minimum_uppercase_letters': 'int', + 'password_expiration_period_days': 'int', + 'password_reuse_frequency_days': 'int' + } + + attribute_map = { + 'allow_whitespaces': 'allowWhitespaces', + 'minimum_digits': 'minimumDigits', + 'minimum_length': 'minimumLength', + 'minimum_lowercase_letters': 'minimumLowercaseLetters', + 'minimum_special_characters': 'minimumSpecialCharacters', + 'minimum_uppercase_letters': 'minimumUppercaseLetters', + 'password_expiration_period_days': 'passwordExpirationPeriodDays', + 'password_reuse_frequency_days': 'passwordReuseFrequencyDays' + } + + def __init__(self, allow_whitespaces=None, minimum_digits=None, minimum_length=None, minimum_lowercase_letters=None, minimum_special_characters=None, minimum_uppercase_letters=None, password_expiration_period_days=None, password_reuse_frequency_days=None): # noqa: E501 + """UserPasswordPolicy - a model defined in Swagger""" # noqa: E501 + self._allow_whitespaces = None + self._minimum_digits = None + self._minimum_length = None + self._minimum_lowercase_letters = None + self._minimum_special_characters = None + self._minimum_uppercase_letters = None + self._password_expiration_period_days = None + self._password_reuse_frequency_days = None + self.discriminator = None + if allow_whitespaces is not None: + self.allow_whitespaces = allow_whitespaces + if minimum_digits is not None: + self.minimum_digits = minimum_digits + if minimum_length is not None: + self.minimum_length = minimum_length + if minimum_lowercase_letters is not None: + self.minimum_lowercase_letters = minimum_lowercase_letters + if minimum_special_characters is not None: + self.minimum_special_characters = minimum_special_characters + if minimum_uppercase_letters is not None: + self.minimum_uppercase_letters = minimum_uppercase_letters + if password_expiration_period_days is not None: + self.password_expiration_period_days = password_expiration_period_days + if password_reuse_frequency_days is not None: + self.password_reuse_frequency_days = password_reuse_frequency_days + + @property + def allow_whitespaces(self): + """Gets the allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + + Allow whitespaces # noqa: E501 + + :return: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :rtype: bool + """ + return self._allow_whitespaces + + @allow_whitespaces.setter + def allow_whitespaces(self, allow_whitespaces): + """Sets the allow_whitespaces of this UserPasswordPolicy. + + Allow whitespaces # noqa: E501 + + :param allow_whitespaces: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :type: bool + """ + + self._allow_whitespaces = allow_whitespaces + + @property + def minimum_digits(self): + """Gets the minimum_digits of this UserPasswordPolicy. # noqa: E501 + + Minimum number of digits in the password. # noqa: E501 + + :return: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_digits + + @minimum_digits.setter + def minimum_digits(self, minimum_digits): + """Sets the minimum_digits of this UserPasswordPolicy. + + Minimum number of digits in the password. # noqa: E501 + + :param minimum_digits: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_digits = minimum_digits + + @property + def minimum_length(self): + """Gets the minimum_length of this UserPasswordPolicy. # noqa: E501 + + Minimum number of symbols in the password. # noqa: E501 + + :return: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_length + + @minimum_length.setter + def minimum_length(self, minimum_length): + """Sets the minimum_length of this UserPasswordPolicy. + + Minimum number of symbols in the password. # noqa: E501 + + :param minimum_length: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_length = minimum_length + + @property + def minimum_lowercase_letters(self): + """Gets the minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of lowercase letters in the password. # noqa: E501 + + :return: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_lowercase_letters + + @minimum_lowercase_letters.setter + def minimum_lowercase_letters(self, minimum_lowercase_letters): + """Sets the minimum_lowercase_letters of this UserPasswordPolicy. + + Minimum number of lowercase letters in the password. # noqa: E501 + + :param minimum_lowercase_letters: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_lowercase_letters = minimum_lowercase_letters + + @property + def minimum_special_characters(self): + """Gets the minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of special in the password. # noqa: E501 + + :return: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_special_characters + + @minimum_special_characters.setter + def minimum_special_characters(self, minimum_special_characters): + """Sets the minimum_special_characters of this UserPasswordPolicy. + + Minimum number of special in the password. # noqa: E501 + + :param minimum_special_characters: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_special_characters = minimum_special_characters + + @property + def minimum_uppercase_letters(self): + """Gets the minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of uppercase letters in the password. # noqa: E501 + + :return: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_uppercase_letters + + @minimum_uppercase_letters.setter + def minimum_uppercase_letters(self, minimum_uppercase_letters): + """Sets the minimum_uppercase_letters of this UserPasswordPolicy. + + Minimum number of uppercase letters in the password. # noqa: E501 + + :param minimum_uppercase_letters: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_uppercase_letters = minimum_uppercase_letters + + @property + def password_expiration_period_days(self): + """Gets the password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :return: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_expiration_period_days + + @password_expiration_period_days.setter + def password_expiration_period_days(self, password_expiration_period_days): + """Sets the password_expiration_period_days of this UserPasswordPolicy. + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :param password_expiration_period_days: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_expiration_period_days = password_expiration_period_days + + @property + def password_reuse_frequency_days(self): + """Gets the password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :return: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_reuse_frequency_days + + @password_reuse_frequency_days.setter + def password_reuse_frequency_days(self, password_reuse_frequency_days): + """Sets the password_reuse_frequency_days of this UserPasswordPolicy. + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :param password_reuse_frequency_days: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_reuse_frequency_days = password_reuse_frequency_days + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserPasswordPolicy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserPasswordPolicy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_ce/users_filter.py new file mode 100644 index 0000000..a50b520 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """UsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/version_create_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/version_create_config.py new file mode 100644 index 0000000..39c2450 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/version_create_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_relations': 'saveRelations' + } + + def __init__(self, save_attributes=None, save_credentials=None, save_relations=None): # noqa: E501 + """VersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._save_attributes = None + self._save_credentials = None + self._save_relations = None + self.discriminator = None + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_relations is not None: + self.save_relations = save_relations + + @property + def save_attributes(self): + """Gets the save_attributes of this VersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this VersionCreateConfig. + + + :param save_attributes: The save_attributes of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this VersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this VersionCreateConfig. + + + :param save_credentials: The save_credentials of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_relations(self): + """Gets the save_relations of this VersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this VersionCreateConfig. + + + :param save_relations: The save_relations of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/version_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/version_create_request.py new file mode 100644 index 0000000..27de65a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/version_create_request.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'type': 'str', + 'version_name': 'str' + } + + attribute_map = { + 'branch': 'branch', + 'type': 'type', + 'version_name': 'versionName' + } + + def __init__(self, branch=None, type=None, version_name=None): # noqa: E501 + """VersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + + @property + def branch(self): + """Gets the branch of this VersionCreateRequest. # noqa: E501 + + + :return: The branch of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this VersionCreateRequest. + + + :param branch: The branch of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def type(self): + """Gets the type of this VersionCreateRequest. # noqa: E501 + + + :return: The type of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionCreateRequest. + + + :param type: The type of this VersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this VersionCreateRequest. # noqa: E501 + + + :return: The version_name of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this VersionCreateRequest. + + + :param version_name: The version_name of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/version_creation_result.py b/tb-rest-client/python/tb_rest_client/models/models_ce/version_creation_result.py new file mode 100644 index 0000000..3d8599e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/version_creation_result.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreationResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'added': 'int', + 'done': 'bool', + 'error': 'str', + 'modified': 'int', + 'removed': 'int', + 'version': 'EntityVersion' + } + + attribute_map = { + 'added': 'added', + 'done': 'done', + 'error': 'error', + 'modified': 'modified', + 'removed': 'removed', + 'version': 'version' + } + + def __init__(self, added=None, done=None, error=None, modified=None, removed=None, version=None): # noqa: E501 + """VersionCreationResult - a model defined in Swagger""" # noqa: E501 + self._added = None + self._done = None + self._error = None + self._modified = None + self._removed = None + self._version = None + self.discriminator = None + if added is not None: + self.added = added + if done is not None: + self.done = done + if error is not None: + self.error = error + if modified is not None: + self.modified = modified + if removed is not None: + self.removed = removed + if version is not None: + self.version = version + + @property + def added(self): + """Gets the added of this VersionCreationResult. # noqa: E501 + + + :return: The added of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._added + + @added.setter + def added(self, added): + """Sets the added of this VersionCreationResult. + + + :param added: The added of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._added = added + + @property + def done(self): + """Gets the done of this VersionCreationResult. # noqa: E501 + + + :return: The done of this VersionCreationResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionCreationResult. + + + :param done: The done of this VersionCreationResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionCreationResult. # noqa: E501 + + + :return: The error of this VersionCreationResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionCreationResult. + + + :param error: The error of this VersionCreationResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def modified(self): + """Gets the modified of this VersionCreationResult. # noqa: E501 + + + :return: The modified of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._modified + + @modified.setter + def modified(self, modified): + """Sets the modified of this VersionCreationResult. + + + :param modified: The modified of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._modified = modified + + @property + def removed(self): + """Gets the removed of this VersionCreationResult. # noqa: E501 + + + :return: The removed of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._removed + + @removed.setter + def removed(self, removed): + """Sets the removed of this VersionCreationResult. + + + :param removed: The removed of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._removed = removed + + @property + def version(self): + """Gets the version of this VersionCreationResult. # noqa: E501 + + + :return: The version of this VersionCreationResult. # noqa: E501 + :rtype: EntityVersion + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this VersionCreationResult. + + + :param version: The version of this VersionCreationResult. # noqa: E501 + :type: EntityVersion + """ + + self._version = version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreationResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreationResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_config.py b/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_config.py new file mode 100644 index 0000000..a654161 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_relations': 'bool' + } + + attribute_map = { + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_relations': 'loadRelations' + } + + def __init__(self, load_attributes=None, load_credentials=None, load_relations=None): # noqa: E501 + """VersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._load_attributes = None + self._load_credentials = None + self._load_relations = None + self.discriminator = None + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_relations is not None: + self.load_relations = load_relations + + @property + def load_attributes(self): + """Gets the load_attributes of this VersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this VersionLoadConfig. + + + :param load_attributes: The load_attributes of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this VersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this VersionLoadConfig. + + + :param load_credentials: The load_credentials of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_relations(self): + """Gets the load_relations of this VersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this VersionLoadConfig. + + + :param load_relations: The load_relations of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_request.py b/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_request.py new file mode 100644 index 0000000..a7f753c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'version_id': 'str' + } + + attribute_map = { + 'type': 'type', + 'version_id': 'versionId' + } + + def __init__(self, type=None, version_id=None): # noqa: E501 + """VersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._type = None + self._version_id = None + self.discriminator = None + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + + @property + def type(self): + """Gets the type of this VersionLoadRequest. # noqa: E501 + + + :return: The type of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionLoadRequest. + + + :param type: The type of this VersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this VersionLoadRequest. # noqa: E501 + + + :return: The version_id of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this VersionLoadRequest. + + + :param version_id: The version_id of this VersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_result.py b/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_result.py new file mode 100644 index 0000000..060a434 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/version_load_result.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'done': 'bool', + 'error': 'EntityLoadError', + 'result': 'list[EntityTypeLoadResult]' + } + + attribute_map = { + 'done': 'done', + 'error': 'error', + 'result': 'result' + } + + def __init__(self, done=None, error=None, result=None): # noqa: E501 + """VersionLoadResult - a model defined in Swagger""" # noqa: E501 + self._done = None + self._error = None + self._result = None + self.discriminator = None + if done is not None: + self.done = done + if error is not None: + self.error = error + if result is not None: + self.result = result + + @property + def done(self): + """Gets the done of this VersionLoadResult. # noqa: E501 + + + :return: The done of this VersionLoadResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionLoadResult. + + + :param done: The done of this VersionLoadResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionLoadResult. # noqa: E501 + + + :return: The error of this VersionLoadResult. # noqa: E501 + :rtype: EntityLoadError + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionLoadResult. + + + :param error: The error of this VersionLoadResult. # noqa: E501 + :type: EntityLoadError + """ + + self._error = error + + @property + def result(self): + """Gets the result of this VersionLoadResult. # noqa: E501 + + + :return: The result of this VersionLoadResult. # noqa: E501 + :rtype: list[EntityTypeLoadResult] + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this VersionLoadResult. + + + :param result: The result of this VersionLoadResult. # noqa: E501 + :type: list[EntityTypeLoadResult] + """ + + self._result = result + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/versioned_entity_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/versioned_entity_info.py new file mode 100644 index 0000000..75a01a7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/versioned_entity_info.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'EntityId' + } + + attribute_map = { + 'external_id': 'externalId' + } + + def __init__(self, external_id=None): # noqa: E501 + """VersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + + @property + def external_id(self): + """Gets the external_id of this VersionedEntityInfo. # noqa: E501 + + + :return: The external_id of this VersionedEntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this VersionedEntityInfo. + + + :param external_id: The external_id of this VersionedEntityInfo. # noqa: E501 + :type: EntityId + """ + + self._external_id = external_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/web_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_ce/web_delivery_method_notification_template.py new file mode 100644 index 0000000..e62d76c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/web_delivery_method_notification_template.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WebDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + + def __init__(self, additional_config=None, body=None, enabled=None, subject=None): # noqa: E501 + """WebDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + + @property + def additional_config(self): + """Gets the additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this WebDeliveryMethodNotificationTemplate. + + + :param additional_config: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def body(self): + """Gets the body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this WebDeliveryMethodNotificationTemplate. + + + :param body: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this WebDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this WebDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WebDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WebDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type.py b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type.py new file mode 100644 index 0000000..f3729b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type.py @@ -0,0 +1,288 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetType(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'descriptor': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'descriptor': 'descriptor' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, descriptor=None): # noqa: E501 + """WidgetType - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._descriptor = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if descriptor is not None: + self.descriptor = descriptor + + @property + def id(self): + """Gets the id of this WidgetType. # noqa: E501 + + + :return: The id of this WidgetType. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetType. + + + :param id: The id of this WidgetType. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetType. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetType. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetType. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetType. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetType. # noqa: E501 + + + :return: The tenant_id of this WidgetType. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetType. + + + :param tenant_id: The tenant_id of this WidgetType. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetType. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetType. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetType. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetType. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetType. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetType. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetType. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetType. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetType. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetType. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetType. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetType. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def descriptor(self): + """Gets the descriptor of this WidgetType. # noqa: E501 + + + :return: The descriptor of this WidgetType. # noqa: E501 + :rtype: JsonNode + """ + return self._descriptor + + @descriptor.setter + def descriptor(self, descriptor): + """Sets the descriptor of this WidgetType. + + + :param descriptor: The descriptor of this WidgetType. # noqa: E501 + :type: JsonNode + """ + + self._descriptor = descriptor + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetType, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetType): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_details.py b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_details.py new file mode 100644 index 0000000..dd8fc03 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_details.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeDetails(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'descriptor': 'JsonNode', + 'image': 'str', + 'description': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'descriptor': 'descriptor', + 'image': 'image', + 'description': 'description' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, descriptor=None, image=None, description=None): # noqa: E501 + """WidgetTypeDetails - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._descriptor = None + self._image = None + self._description = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if descriptor is not None: + self.descriptor = descriptor + if image is not None: + self.image = image + if description is not None: + self.description = description + + @property + def id(self): + """Gets the id of this WidgetTypeDetails. # noqa: E501 + + + :return: The id of this WidgetTypeDetails. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeDetails. + + + :param id: The id of this WidgetTypeDetails. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetTypeDetails. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetTypeDetails. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetTypeDetails. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetTypeDetails. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetTypeDetails. # noqa: E501 + + + :return: The tenant_id of this WidgetTypeDetails. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetTypeDetails. + + + :param tenant_id: The tenant_id of this WidgetTypeDetails. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetTypeDetails. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetTypeDetails. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetTypeDetails. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetTypeDetails. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetTypeDetails. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetTypeDetails. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def descriptor(self): + """Gets the descriptor of this WidgetTypeDetails. # noqa: E501 + + + :return: The descriptor of this WidgetTypeDetails. # noqa: E501 + :rtype: JsonNode + """ + return self._descriptor + + @descriptor.setter + def descriptor(self, descriptor): + """Sets the descriptor of this WidgetTypeDetails. + + + :param descriptor: The descriptor of this WidgetTypeDetails. # noqa: E501 + :type: JsonNode + """ + + self._descriptor = descriptor + + @property + def image(self): + """Gets the image of this WidgetTypeDetails. # noqa: E501 + + Base64 encoded thumbnail # noqa: E501 + + :return: The image of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetTypeDetails. + + Base64 encoded thumbnail # noqa: E501 + + :param image: The image of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def description(self): + """Gets the description of this WidgetTypeDetails. # noqa: E501 + + Description of the widget # noqa: E501 + + :return: The description of this WidgetTypeDetails. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetTypeDetails. + + Description of the widget # noqa: E501 + + :param description: The description of this WidgetTypeDetails. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeDetails, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeDetails): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_id.py new file mode 100644 index 0000000..5385d7f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetTypeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetTypeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetTypeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetTypeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetTypeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetTypeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_info.py b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_info.py new file mode 100644 index 0000000..563d4ff --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/widget_type_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'description': 'str', + 'image': 'str', + 'widget_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'description': 'description', + 'image': 'image', + 'widget_type': 'widgetType' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, description=None, image=None, widget_type=None): # noqa: E501 + """WidgetTypeInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._description = None + self._image = None + self._widget_type = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if description is not None: + self.description = description + if image is not None: + self.image = image + if widget_type is not None: + self.widget_type = widget_type + + @property + def id(self): + """Gets the id of this WidgetTypeInfo. # noqa: E501 + + + :return: The id of this WidgetTypeInfo. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeInfo. + + + :param id: The id of this WidgetTypeInfo. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetTypeInfo. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetTypeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetTypeInfo. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetTypeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetTypeInfo. # noqa: E501 + + + :return: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetTypeInfo. + + + :param tenant_id: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetTypeInfo. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetTypeInfo. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetTypeInfo. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetTypeInfo. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetTypeInfo. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetTypeInfo. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this WidgetTypeInfo. # noqa: E501 + + Description of the widget type # noqa: E501 + + :return: The description of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetTypeInfo. + + Description of the widget type # noqa: E501 + + :param description: The description of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this WidgetTypeInfo. # noqa: E501 + + Base64 encoded widget thumbnail # noqa: E501 + + :return: The image of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetTypeInfo. + + Base64 encoded widget thumbnail # noqa: E501 + + :param image: The image of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def widget_type(self): + """Gets the widget_type of this WidgetTypeInfo. # noqa: E501 + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :return: The widget_type of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._widget_type + + @widget_type.setter + def widget_type(self, widget_type): + """Sets the widget_type of this WidgetTypeInfo. + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :param widget_type: The widget_type of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._widget_type = widget_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle.py b/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle.py new file mode 100644 index 0000000..94582d9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle.py @@ -0,0 +1,330 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetsBundle(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetsBundleId', + 'created_time': 'int', + 'name': 'str', + 'tenant_id': 'TenantId', + 'alias': 'str', + 'title': 'str', + 'image': 'str', + 'description': 'str', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'name': 'name', + 'tenant_id': 'tenantId', + 'alias': 'alias', + 'title': 'title', + 'image': 'image', + 'description': 'description', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, name=None, tenant_id=None, alias=None, title=None, image=None, description=None): # noqa: E501 + """WidgetsBundle - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._name = None + self._tenant_id = None + self._alias = None + self._title = None + self._image = None + self._description = None + self._external_id = None + self.external_id = external_id + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if name is not None: + self.name = name + if tenant_id is not None: + self.tenant_id = tenant_id + if alias is not None: + self.alias = alias + if title is not None: + self.title = title + if image is not None: + self.image = image + if description is not None: + self.description = description + + @property + def id(self): + """Gets the id of this WidgetsBundle. # noqa: E501 + + + :return: The id of this WidgetsBundle. # noqa: E501 + :rtype: WidgetsBundleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetsBundle. + + + :param id: The id of this WidgetsBundle. # noqa: E501 + :type: WidgetsBundleId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this WidgetsBundle. # noqa: E501 + + Timestamp of the Widget Bundle creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetsBundle. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetsBundle. + + Timestamp of the Widget Bundle creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetsBundle. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def name(self): + """Gets the name of this WidgetsBundle. # noqa: E501 + + Same as title of the Widget Bundle. Read-only field. Update the 'title' to change the 'name' of the Widget Bundle. # noqa: E501 + + :return: The name of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetsBundle. + + Same as title of the Widget Bundle. Read-only field. Update the 'title' to change the 'name' of the Widget Bundle. # noqa: E501 + + :param name: The name of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetsBundle. # noqa: E501 + + + :return: The tenant_id of this WidgetsBundle. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetsBundle. + + + :param tenant_id: The tenant_id of this WidgetsBundle. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def alias(self): + """Gets the alias of this WidgetsBundle. # noqa: E501 + + Unique alias that is used in widget types as a reference widget bundle # noqa: E501 + + :return: The alias of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetsBundle. + + Unique alias that is used in widget types as a reference widget bundle # noqa: E501 + + :param alias: The alias of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def title(self): + """Gets the title of this WidgetsBundle. # noqa: E501 + + Title used in search and UI # noqa: E501 + + :return: The title of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this WidgetsBundle. + + Title used in search and UI # noqa: E501 + + :param title: The title of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this WidgetsBundle. # noqa: E501 + + Base64 encoded thumbnail # noqa: E501 + + :return: The image of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetsBundle. + + Base64 encoded thumbnail # noqa: E501 + + :param image: The image of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def description(self): + """Gets the description of this WidgetsBundle. # noqa: E501 + + Description # noqa: E501 + + :return: The description of this WidgetsBundle. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetsBundle. + + Description # noqa: E501 + + :param description: The description of this WidgetsBundle. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundle, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundle): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle_export_data.py new file mode 100644 index 0000000..004f45b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class WidgetsBundleExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'WidgetsBundle', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]', + 'widgets': 'list[WidgetTypeDetails]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations', + 'widgets': 'widgets' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None, widgets=None, *args, **kwargs): # noqa: E501 + """WidgetsBundleExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self._widgets = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + if widgets is not None: + self.widgets = widgets + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this WidgetsBundleExportData. # noqa: E501 + + + :return: The attributes of this WidgetsBundleExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this WidgetsBundleExportData. + + + :param attributes: The attributes of this WidgetsBundleExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity of this WidgetsBundleExportData. # noqa: E501 + :rtype: WidgetsBundle + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this WidgetsBundleExportData. + + + :param entity: The entity of this WidgetsBundleExportData. # noqa: E501 + :type: WidgetsBundle + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleExportData. + + + :param entity_type: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_VIEW", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "RPC", "RULE_CHAIN", "RULE_NODE", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this WidgetsBundleExportData. # noqa: E501 + + + :return: The relations of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this WidgetsBundleExportData. + + + :param relations: The relations of this WidgetsBundleExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + @property + def widgets(self): + """Gets the widgets of this WidgetsBundleExportData. # noqa: E501 + + + :return: The widgets of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[WidgetTypeDetails] + """ + return self._widgets + + @widgets.setter + def widgets(self, widgets): + """Sets the widgets of this WidgetsBundleExportData. + + + :param widgets: The widgets of this WidgetsBundleExportData. # noqa: E501 + :type: list[WidgetTypeDetails] + """ + + self._widgets = widgets + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle_id.py b/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle_id.py new file mode 100644 index 0000000..f961425 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/widgets_bundle_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetsBundleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetsBundleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetsBundleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetsBundleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGETS_BUNDLE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/x509_certificate_chain_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_ce/x509_certificate_chain_provision_configuration.py new file mode 100644 index 0000000..e915ebe --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/x509_certificate_chain_provision_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class X509CertificateChainProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_create_new_devices_by_x509_certificate': 'bool', + 'certificate_reg_ex_pattern': 'str', + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'allow_create_new_devices_by_x509_certificate': 'allowCreateNewDevicesByX509Certificate', + 'certificate_reg_ex_pattern': 'certificateRegExPattern', + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, allow_create_new_devices_by_x509_certificate=None, certificate_reg_ex_pattern=None, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """X509CertificateChainProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._allow_create_new_devices_by_x509_certificate = None + self._certificate_reg_ex_pattern = None + self._provision_device_secret = None + self.discriminator = None + if allow_create_new_devices_by_x509_certificate is not None: + self.allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + if certificate_reg_ex_pattern is not None: + self.certificate_reg_ex_pattern = certificate_reg_ex_pattern + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def allow_create_new_devices_by_x509_certificate(self): + """Gets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: bool + """ + return self._allow_create_new_devices_by_x509_certificate + + @allow_create_new_devices_by_x509_certificate.setter + def allow_create_new_devices_by_x509_certificate(self, allow_create_new_devices_by_x509_certificate): + """Sets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. + + + :param allow_create_new_devices_by_x509_certificate: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: bool + """ + + self._allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + + @property + def certificate_reg_ex_pattern(self): + """Gets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._certificate_reg_ex_pattern + + @certificate_reg_ex_pattern.setter + def certificate_reg_ex_pattern(self, certificate_reg_ex_pattern): + """Sets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. + + + :param certificate_reg_ex_pattern: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._certificate_reg_ex_pattern = certificate_reg_ex_pattern + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this X509CertificateChainProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509CertificateChainProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509CertificateChainProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_ce/x509_lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_ce/x509_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..4e355c0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_ce/x509_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class X509LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """X509LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this X509LwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this X509LwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this X509LwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this X509LwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this X509LwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this X509LwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__init__.py b/tb-rest-client/python/tb_rest_client/models/models_pe/__init__.py new file mode 100644 index 0000000..574e885 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/__init__.py @@ -0,0 +1,418 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .default_device_profile_transport_configuration import DefaultDeviceProfileTransportConfiguration +from .json_node import JsonNode +from .merged_user_permissions import MergedUserPermissions +from .page_data_edge import PageDataEdge +from .tenant_solution_template_info import TenantSolutionTemplateInfo +from .debug_rule_node_event_filter import DebugRuleNodeEventFilter +from .admin_settings_id import AdminSettingsId +from .entity_data import EntityData +from .server_security_config import ServerSecurityConfig +from .login_response import LoginResponse +from .event_id import EventId +from .scheduler_event_info import SchedulerEventInfo +from .test_sms_request import TestSmsRequest +from .ota_package import OtaPackage +from .group_permission import GroupPermission +from .user import User +from .o_auth2_mobile_info import OAuth2MobileInfo +from .numeric_filter_predicate import NumericFilterPredicate +from .device_profile_alarm import DeviceProfileAlarm +from .ota_package_info import OtaPackageInfo +from .alarm_data import AlarmData +from .entity_id import EntityId +from .event import Event +from .complex_filter_predicate import ComplexFilterPredicate +from .edge_id import EdgeId +from .device_profile_data import DeviceProfileData +from .allowed_permissions_info import AllowedPermissionsInfo +from .device_group_ota_package import DeviceGroupOtaPackage +from .login_white_labeling_params import LoginWhiteLabelingParams +from .sign_up_request import SignUpRequest +from .share_group_request import ShareGroupRequest +from .save_ota_package_info_request import SaveOtaPackageInfoRequest +from .mqtt_device_transport_configuration import MqttDeviceTransportConfiguration +from .page_data_tb_resource_info import PageDataTbResourceInfo +from .home_dashboard import HomeDashboard +from .bulk_import_result_device import BulkImportResultDevice +from .device_search_query_filter import DeviceSearchQueryFilter +from .dashboard_info import DashboardInfo +from .byte_buffer import ByteBuffer +from .edge import Edge +from .scheduler_event_with_customer_info import SchedulerEventWithCustomerInfo +from .entity_relations_query import EntityRelationsQuery +from .sms_provider_configuration import SmsProviderConfiguration +from .entity_relation_info import EntityRelationInfo +from .tenant_id import TenantId +from .filter_predicate_valueboolean import FilterPredicateValueboolean +from .component_descriptor import ComponentDescriptor +from .short_customer_info import ShortCustomerInfo +from .duration_alarm_condition_spec import DurationAlarmConditionSpec +from .group_permission_id import GroupPermissionId +from .o_auth2_registration_info import OAuth2RegistrationInfo +from .twilio_sms_provider_configuration import TwilioSmsProviderConfiguration +from .page_data_converter import PageDataConverter +from .lw_m2m_resource_observe import LwM2mResourceObserve +from .default_tenant_profile_configuration import DefaultTenantProfileConfiguration +from .role_id import RoleId +from .check_pre_provisioned_devices_device_profile_provision_configuration import \ + CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration +from .alarm_info import AlarmInfo +from .asset import Asset +from .debug_converter_event_filter import DebugConverterEventFilter +from .o_auth2_client_info import OAuth2ClientInfo +from .boolean_filter_predicate import BooleanFilterPredicate +from .rule_chain_id import RuleChainId +from .admin_settings import AdminSettings +from .o_auth2_client_registration_template import OAuth2ClientRegistrationTemplate +from .rule_node import RuleNode +from .other_configuration import OtherConfiguration +from .device_data import DeviceData +from .page_data_integration import PageDataIntegration +from .proto_transport_payload_configuration import ProtoTransportPayloadConfiguration +from .dashboard_id import DashboardId +from .change_password_request import ChangePasswordRequest +from .tenant_profile_data import TenantProfileData +from .device import Device +from .shared_attributes_setting_snmp_communication_config import SharedAttributesSettingSnmpCommunicationConfig +from .sign_up_self_registration_params import SignUpSelfRegistrationParams +from .report_config import ReportConfig +from .o_auth2_custom_mapper_config import OAuth2CustomMapperConfig +from .update_message import UpdateMessage +from .power_saving_configuration import PowerSavingConfiguration +from .entity_group_filter import EntityGroupFilter +from .ota_package_id import OtaPackageId +from .error_event_filter import ErrorEventFilter +from .page_data_short_entity_view import PageDataShortEntityView +from .alarm_schedule import AlarmSchedule +from .user_id import UserId +from .entity_group_list_filter import EntityGroupListFilter +from .integration_id import IntegrationId +from .asset_type_filter import AssetTypeFilter +from .statistics_event_filter import StatisticsEventFilter +from .page_data_entity_group_info import PageDataEntityGroupInfo +from .api_usage_state_filter import ApiUsageStateFilter +from .merged_group_permission_info import MergedGroupPermissionInfo +from .widgets_bundle_id import WidgetsBundleId +from .atomic_integer import AtomicInteger +from .security_settings import SecuritySettings +from .event_filter import EventFilter +from .lw_m2m_object import LwM2mObject +from .edge_search_query import EdgeSearchQuery +from .page_data_scheduler_event_info import PageDataSchedulerEventInfo +from .state_entity_owner_filter import StateEntityOwnerFilter +from .o_auth2_params_info import OAuth2ParamsInfo +from .entity_view_id import EntityViewId +from .alarm_condition_filter_key import AlarmConditionFilterKey +from .merged_group_type_permission_info import MergedGroupTypePermissionInfo +from .device_transport_configuration import DeviceTransportConfiguration +from .filter_predicate_valuedouble import FilterPredicateValuedouble +from .filter_predicate_valuestring import FilterPredicateValuestring +from .page_data_role import PageDataRole +from .alarm_condition_filter import AlarmConditionFilter +from .alarm import Alarm +from .attributes_entity_view import AttributesEntityView +from .login_request import LoginRequest +from .entity_view import EntityView +from .device_profile_provision_configuration import DeviceProfileProvisionConfiguration +from .specific_time_schedule import SpecificTimeSchedule +from .favicon import Favicon +from .o_auth2_info import OAuth2Info +from .activate_user_request import ActivateUserRequest +from .converter import Converter +from .resource import Resource +from .subscription_usage import SubscriptionUsage +from .default_device_transport_configuration import DefaultDeviceTransportConfiguration +from .entity_group_id import EntityGroupId +from .telemetry_mapping_configuration import TelemetryMappingConfiguration +from .default_device_profile_configuration import DefaultDeviceProfileConfiguration +from .any_time_schedule import AnyTimeSchedule +from .allow_create_new_devices_device_profile_provision_configuration import \ + AllowCreateNewDevicesDeviceProfileProvisionConfiguration +from .to_device_rpc_request_snmp_communication_config import ToDeviceRpcRequestSnmpCommunicationConfig +from .default_device_configuration import DefaultDeviceConfiguration +from .widget_type_info import WidgetTypeInfo +from .entity_name_filter import EntityNameFilter +from .tb_resource_id import TbResourceId +from .efento_coap_device_type_configuration import EfentoCoapDeviceTypeConfiguration +from .edge_event import EdgeEvent +from .page_data_rule_chain import PageDataRuleChain +from .customer_id import CustomerId +from .snmp_device_transport_configuration import SnmpDeviceTransportConfiguration +from .short_entity_view import ShortEntityView +from .alarm_rule import AlarmRule +from .key_filter import KeyFilter +from .client_attributes_querying_snmp_communication_config import ClientAttributesQueryingSnmpCommunicationConfig +from .rule_chain_import_result import RuleChainImportResult +from .custom_menu_item import CustomMenuItem +from .role import Role +from .entity_group_info import EntityGroupInfo +from .input_stream import InputStream +from .edge_type_filter import EdgeTypeFilter +from .palette import Palette +from .object_node import ObjectNode +from .device_configuration import DeviceConfiguration +from .entity_subtype import EntitySubtype +from .entity_key import EntityKey +from .integration import Integration +from .device_type_filter import DeviceTypeFilter +from .edge_search_query_filter import EdgeSearchQueryFilter +from .save_device_with_credentials_request import SaveDeviceWithCredentialsRequest +from .bulk_import_result_edge import BulkImportResultEdge +from .lwm2m_device_transport_configuration import Lwm2mDeviceTransportConfiguration +from .palette_settings import PaletteSettings +from .response_entity import ResponseEntity +from .page_data_event import PageDataEvent +from .entity_list_filter import EntityListFilter +from .entity_type_filter import EntityTypeFilter +from .custom_time_schedule import CustomTimeSchedule +from .tenant_solution_template_instructions import TenantSolutionTemplateInstructions +from .snmp_communication_config import SnmpCommunicationConfig +from .dashboard import Dashboard +from .rule_chain_meta_data import RuleChainMetaData +from .filter_predicate_valueint import FilterPredicateValueint +from .bulk_import_result_asset import BulkImportResultAsset +from .edge_event_id import EdgeEventId +from .column_mapping import ColumnMapping +from .claim_request import ClaimRequest +from .filter_predicate_valuelong import FilterPredicateValuelong +from .widget_type_id import WidgetTypeId +from .custom_menu import CustomMenu +from .relations_search_parameters import RelationsSearchParameters +from .thingsboard_credentials_expired_response import ThingsboardCredentialsExpiredResponse +from .o_auth2_basic_mapper_config import OAuth2BasicMapperConfig +from .simple_alarm_condition_spec import SimpleAlarmConditionSpec +from .rpc import Rpc +from .group_permission_info import GroupPermissionInfo +from .rpc_id import RpcId +from .default_rule_chain_create_request import DefaultRuleChainCreateRequest +from .transport_payload_type_configuration import TransportPayloadTypeConfiguration +from .entity_group import EntityGroup +from .ts_value import TsValue +from .solution_install_response import SolutionInstallResponse +from .telemetry_querying_snmp_communication_config import TelemetryQueryingSnmpCommunicationConfig +from .device_profile_configuration import DeviceProfileConfiguration +from .entity_group_name_filter import EntityGroupNameFilter +from .entity_data_query import EntityDataQuery +from .custom_translation import CustomTranslation +from .entity_count_query import EntityCountQuery +from .contact_basedobject import ContactBasedobject +from .entity_view_search_query import EntityViewSearchQuery +from .bootstrap_configuration import BootstrapConfiguration +from .o_auth2_domain_info import OAuth2DomainInfo +from .bulk_import_request import BulkImportRequest +from .node_connection_info import NodeConnectionInfo +from .entity_data_page_link import EntityDataPageLink +from .dynamic_valueint import DynamicValueint +from .thingsboard_error_response import ThingsboardErrorResponse +from .coap_device_transport_configuration import CoapDeviceTransportConfiguration +from .string_filter_predicate import StringFilterPredicate +from .snmp_mapping import SnmpMapping +from .mqtt_device_profile_transport_configuration import MqttDeviceProfileTransportConfiguration +from .telemetry_entity_view import TelemetryEntityView +from .single_entity_filter import SingleEntityFilter +from .entity_view_search_query_filter import EntityViewSearchQueryFilter +from .disabled_device_profile_provision_configuration import DisabledDeviceProfileProvisionConfiguration +from .asset_search_query import AssetSearchQuery +from .entity_filter import EntityFilter +from .debug_integration_event_filter import DebugIntegrationEventFilter +from .entity_view_type_filter import EntityViewTypeFilter +from .dynamic_valueboolean import DynamicValueboolean +from .tenant_profile_configuration import TenantProfileConfiguration +from .customer import Customer +from .dynamic_valuelong import DynamicValuelong +from .device_profile_transport_configuration import DeviceProfileTransportConfiguration +from .tb_resource_info import TbResourceInfo +from .object_attributes import ObjectAttributes +from .relation_entity_type_filter import RelationEntityTypeFilter +from .asset_search_query_filter import AssetSearchQueryFilter +from .reset_password_email_request import ResetPasswordEmailRequest +from .tenant_solution_template_details import TenantSolutionTemplateDetails +from .tenant_profile_id import TenantProfileId +from .blob_entity_id import BlobEntityId +from .key_filter_predicate import KeyFilterPredicate +from .o_auth2_mapper_config import OAuth2MapperConfig +from .default_coap_device_type_configuration import DefaultCoapDeviceTypeConfiguration +from .snmp_device_profile_transport_configuration import SnmpDeviceProfileTransportConfiguration +from .life_cycle_event_filter import LifeCycleEventFilter +from .blob_entity_with_customer_info import BlobEntityWithCustomerInfo +from .relations_query_filter import RelationsQueryFilter +from .alarm_condition import AlarmCondition +from .self_registration_params import SelfRegistrationParams +from .rule_chain_data import RuleChainData +from .dynamic_valuedouble import DynamicValuedouble +from .dynamic_valuestring import DynamicValuestring +from .lw_m2m_instance import LwM2mInstance +from .repeating_alarm_condition_spec import RepeatingAlarmConditionSpec +from .custom_time_schedule_item import CustomTimeScheduleItem +from .mapping import Mapping +from .user_password_policy import UserPasswordPolicy +from .delete_tenant_request import DeleteTenantRequest +from .page_data_edge_event import PageDataEdgeEvent +from .device_id import DeviceId +from .converter_id import ConverterId +from .aws_sns_sms_provider_configuration import AwsSnsSmsProviderConfiguration +from .scheduler_event import SchedulerEvent +from .lwm2m_device_profile_transport_configuration import Lwm2mDeviceProfileTransportConfiguration +from .page_data_blob_entity_with_customer_info import PageDataBlobEntityWithCustomerInfo +from .component_descriptor_id import ComponentDescriptorId +from .o_auth2_client_registration_template_id import OAuth2ClientRegistrationTemplateId +from .alarm_id import AlarmId +from .audit_log import AuditLog +from .scheduler_event_id import SchedulerEventId +from .alarm_data_page_link import AlarmDataPageLink +from .device_search_query import DeviceSearchQuery +from .debug_rule_chain_event_filter import DebugRuleChainEventFilter +from .alarm_data_query import AlarmDataQuery +from .alarm_condition_spec import AlarmConditionSpec +from .coap_device_type_configuration import CoapDeviceTypeConfiguration +from .reset_password_request import ResetPasswordRequest +from .white_labeling_params import WhiteLabelingParams +from .asset_id import AssetId +from .tb_resource import TbResource +from .blob_entity_info import BlobEntityInfo +from .device_credentials_id import DeviceCredentialsId +from .rule_node_id import RuleNodeId +from .rule_chain_connection_info import RuleChainConnectionInfo +from .audit_log_id import AuditLogId +from .device_profile_id import DeviceProfileId +from .coap_device_profile_transport_configuration import CoapDeviceProfileTransportConfiguration +from .json_transport_payload_configuration import JsonTransportPayloadConfiguration +from .entity_data_sort_order import EntityDataSortOrder +from .page_data_ota_package_info import PageDataOtaPackageInfo +from .page_data_contact_basedobject import PageDataContactBasedobject +from .rule_chain import RuleChain +from .entities_by_group_name_filter import EntitiesByGroupNameFilter +from .version_create_request import VersionCreateRequest +from .entity_export_dataobject import EntityExportDataobject +from .two_fa_provider_config import TwoFaProviderConfig +from .version_load_request import VersionLoadRequest +from .lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential +from .two_fa_account_config import TwoFaAccountConfig +from .version_load_result import VersionLoadResult +from .deferred_result_list_branch_info import DeferredResultListBranchInfo +from .deferred_result_page_data_entity_version import DeferredResultPageDataEntityVersion +from .deferred_result_entity_data_info import DeferredResultEntityDataInfo +from .version_creation_result import VersionCreationResult +from .deferred_result_list_versioned_entity_info import DeferredResultListVersionedEntityInfo +from .deferred_result_entity_data_diff import DeferredResultEntityDataDiff +from .entity_version import EntityVersion +from .entity_type_load_result import EntityTypeLoadResult +from .complex_version_create_request import ComplexVersionCreateRequest +from .version_load_config import VersionLoadConfig +from .single_entity_version_load_request import SingleEntityVersionLoadRequest +from .entity_type_version_load_request import EntityTypeVersionLoadRequest +from .version_create_config import VersionCreateConfig +from .single_entity_version_create_request import SingleEntityVersionCreateRequest +from .entity_type_version_create_config import EntityTypeVersionCreateConfig +from .entity_type_version_load_config import EntityTypeVersionLoadConfig +from .repository_settings import RepositorySettings +from .deferred_result_repository_settings import DeferredResultRepositorySettings +from .deferred_result_void import DeferredResultVoid +from .auto_version_create_config import AutoVersionCreateConfig +from .platform_two_fa_settings import PlatformTwoFaSettings +from .account_two_fa_settings import AccountTwoFaSettings +from .two_fa_account_config_update_request import TwoFaAccountConfigUpdateRequest +from .two_fa_provider_info import TwoFaProviderInfo +from .entity_load_error import EntityLoadError +from .array_node import ArrayNode +from .integration_info import IntegrationInfo +from .page_data_integration_info import PageDataIntegrationInfo +from .raw_data_event_filter import RawDataEventFilter +from .rule_node_debug_event_filter import RuleNodeDebugEventFilter +from .scheduler_event_filter import SchedulerEventFilter +from .affected_tenant_administrators_filter import AffectedTenantAdministratorsFilter +from .affected_user_filter import AffectedUserFilter +from .alarm_assignee import AlarmAssignee +from .alarm_assignment_notification_rule_trigger_config import AlarmAssignmentNotificationRuleTriggerConfig +from .alarm_comment import AlarmComment +from .alarm_comment_id import AlarmCommentId +from .alarm_comment_info import AlarmCommentInfo +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .alarm_count_query import AlarmCountQuery +from .alarm_comment_notification_rule_trigger_config import AlarmCommentNotificationRuleTriggerConfig +from .all_users_filter import AllUsersFilter +from .api_usage_limit_notification_rule_trigger_config import ApiUsageLimitNotificationRuleTriggerConfig +from .asset_info import AssetInfo +from .asset_profile_id import AssetProfileId +from .clear_rule import ClearRule +from .comparison_ts_value import ComparisonTsValue +from .customer_info import CustomerInfo +from .customer_users_filter import CustomerUsersFilter +from .delivery_method_notification_template import DeliveryMethodNotificationTemplate +from .device_activity_notification_rule_trigger_config import DeviceActivityNotificationRuleTriggerConfig +from .device_info import DeviceInfo +from .edge_info import EdgeInfo +from .edge_install_instructions import EdgeInstallInstructions +from .email_delivery_method_notification_template import EmailDeliveryMethodNotificationTemplate +from .entities_limit_notification_rule_trigger_config import EntitiesLimitNotificationRuleTriggerConfig +from .entity_action_notification_rule_trigger_config import EntityActionNotificationRuleTriggerConfig +from .entity_view_info import EntityViewInfo +from .escalated_notification_rule_recipients_config import EscalatedNotificationRuleRecipientsConfig +from .event_info import EventInfo +from .features_info import FeaturesInfo +from .integration_lifecycle_event_notification_rule_trigger_config import IntegrationLifecycleEventNotificationRuleTriggerConfig +from .jwt_settings import JWTSettings +from .last_visited_dashboard_info import LastVisitedDashboardInfo +from .license_usage_info import LicenseUsageInfo +from .new_platform_version_notification_rule_trigger_config import NewPlatformVersionNotificationRuleTriggerConfig +from .notification import Notification +from .notification_delivery_method_config import NotificationDeliveryMethodConfig +from .notification_id import NotificationId +from .notification_info import NotificationInfo +from .notification_request import NotificationRequest +from .notification_request_config import NotificationRequestConfig +from .notification_request_id import NotificationRequestId +from .notification_request_preview import NotificationRequestPreview +from .notification_request_stats import NotificationRequestStats +from .notification_rule_config import NotificationRuleConfig +from .notification_rule_id import NotificationRuleId +from .notification_rule_recipients_config import NotificationRuleRecipientsConfig +from .notification_target_id import NotificationTargetId +from .notification_template_config import NotificationTemplateConfig +from .notification_template_id import NotificationTemplateId +from .originator_entity_owner_users_filter import OriginatorEntityOwnerUsersFilter +from .page_data_customer_info import PageDataCustomerInfo +from .page_data_edge_info import PageDataEdgeInfo +from .page_data_entity_view_info import PageDataEntityViewInfo +from .page_data_event_info import PageDataEventInfo +from .page_data_user_email_info import PageDataUserEmailInfo +from .page_data_user_info import PageDataUserInfo +from .platform_users_notification_target_config import PlatformUsersNotificationTargetConfig +from .psklw_m2_m_bootstrap_server_credential import PSKLwM2MBootstrapServerCredential +from .repository_settings import RepositorySettings +from .rpklw_m2_m_bootstrap_server_credential import RPKLwM2MBootstrapServerCredential +from .rule_chain_debug_event_filter import RuleChainDebugEventFilter +from .rule_engine_component_lifecycle_event_notification_rule_trigger_config import RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig +from .slack_conversation import SlackConversation +from .slack_delivery_method_notification_template import SlackDeliveryMethodNotificationTemplate +from .slack_notification_delivery_method_config import SlackNotificationDeliveryMethodConfig +from .slack_notification_target_config import SlackNotificationTargetConfig +from .sms_delivery_method_notification_template import SmsDeliveryMethodNotificationTemplate +from .starred_dashboard_info import StarredDashboardInfo +from .system_administrators_filter import SystemAdministratorsFilter +from .system_info import SystemInfo +from .system_info_data import SystemInfoData +from .tenant_administrators_filter import TenantAdministratorsFilter +from .user_dashboards_info import UserDashboardsInfo +from .user_email_info import UserEmailInfo +from .user_group_list_filter import UserGroupListFilter +from .user_info import UserInfo +from .user_list_filter import UserListFilter +from .user_role_filter import UserRoleFilter +from .users_filter import UsersFilter +from .web_delivery_method_notification_template import WebDeliveryMethodNotificationTemplate +from .x509_certificate_chain_provision_configuration import X509CertificateChainProvisionConfiguration diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/__init__.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..83e6144 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/__init__.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/account_two_fa_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/account_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..ba86ad5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/account_two_fa_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/activate_user_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/activate_user_request.cpython-311.pyc new file mode 100644 index 0000000..610a332 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/activate_user_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/admin_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/admin_settings.cpython-311.pyc new file mode 100644 index 0000000..dfdc8e8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/admin_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/admin_settings_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/admin_settings_id.cpython-311.pyc new file mode 100644 index 0000000..85892c0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/admin_settings_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..84c6c10 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/affected_tenant_administrators_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/affected_user_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/affected_user_filter.cpython-311.pyc new file mode 100644 index 0000000..9286497 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/affected_user_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm.cpython-311.pyc new file mode 100644 index 0000000..fae10e2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignee.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignee.cpython-311.pyc new file mode 100644 index 0000000..a730da9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignee.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..d4823c4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_assignment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment.cpython-311.pyc new file mode 100644 index 0000000..3ac98b8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_id.cpython-311.pyc new file mode 100644 index 0000000..03dadc7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_info.cpython-311.pyc new file mode 100644 index 0000000..2ff3608 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..f5377f7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_comment_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition.cpython-311.pyc new file mode 100644 index 0000000..8db432f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter.cpython-311.pyc new file mode 100644 index 0000000..57ddf30 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter_key.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter_key.cpython-311.pyc new file mode 100644 index 0000000..3a98e91 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_filter_key.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..18966b1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_count_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_count_query.cpython-311.pyc new file mode 100644 index 0000000..0b9f957 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_count_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data.cpython-311.pyc new file mode 100644 index 0000000..e284ccb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_page_link.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..dd33367 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_page_link.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_query.cpython-311.pyc new file mode 100644 index 0000000..f6afe4a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_data_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_id.cpython-311.pyc new file mode 100644 index 0000000..ed1f1b3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_info.cpython-311.pyc new file mode 100644 index 0000000..5d46800 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..10f4616 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_rule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_rule.cpython-311.pyc new file mode 100644 index 0000000..56c54e0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_rule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_schedule.cpython-311.pyc new file mode 100644 index 0000000..4ee7d70 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/alarm_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/all_users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/all_users_filter.cpython-311.pyc new file mode 100644 index 0000000..81f92bc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/all_users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..6a34fc8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/allow_create_new_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/allowed_permissions_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/allowed_permissions_info.cpython-311.pyc new file mode 100644 index 0000000..2a9fbaf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/allowed_permissions_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/any_time_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/any_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..ccd6a26 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/any_time_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..2e38db0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/api_usage_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/api_usage_state_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/api_usage_state_filter.cpython-311.pyc new file mode 100644 index 0000000..dce4d69 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/api_usage_state_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/array_node.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/array_node.cpython-311.pyc new file mode 100644 index 0000000..526bf0d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/array_node.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset.cpython-311.pyc new file mode 100644 index 0000000..2cc8730 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_id.cpython-311.pyc new file mode 100644 index 0000000..dcd1a95 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_info.cpython-311.pyc new file mode 100644 index 0000000..f606428 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_profile_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_profile_id.cpython-311.pyc new file mode 100644 index 0000000..ca5e1a5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_profile_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query.cpython-311.pyc new file mode 100644 index 0000000..5a8ac92 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..29b5c16 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_type_filter.cpython-311.pyc new file mode 100644 index 0000000..64d59d7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/asset_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/atomic_integer.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/atomic_integer.cpython-311.pyc new file mode 100644 index 0000000..f948056 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/atomic_integer.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/attribute_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/attribute_export_data.cpython-311.pyc new file mode 100644 index 0000000..640e601 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/attribute_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/attributes_entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/attributes_entity_view.cpython-311.pyc new file mode 100644 index 0000000..de5b05f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/attributes_entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/audit_log.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/audit_log.cpython-311.pyc new file mode 100644 index 0000000..7e78874 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/audit_log.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/audit_log_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/audit_log_id.cpython-311.pyc new file mode 100644 index 0000000..9b93ec5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/audit_log_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/auto_version_create_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/auto_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..928d9cb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/auto_version_create_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..57df6e6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/aws_sns_sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..625e273 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..40258d8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/backup_code_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_id.cpython-311.pyc new file mode 100644 index 0000000..8e7d6a7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_info.cpython-311.pyc new file mode 100644 index 0000000..a7147e3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_with_customer_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_with_customer_info.cpython-311.pyc new file mode 100644 index 0000000..323d12f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/blob_entity_with_customer_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/boolean_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/boolean_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..feb00ac Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/boolean_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bootstrap_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bootstrap_configuration.cpython-311.pyc new file mode 100644 index 0000000..65d0e87 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bootstrap_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/branch_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/branch_info.cpython-311.pyc new file mode 100644 index 0000000..ecba02b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/branch_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_request.cpython-311.pyc new file mode 100644 index 0000000..44957c2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_asset.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_asset.cpython-311.pyc new file mode 100644 index 0000000..cae4b2e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_asset.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_device.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_device.cpython-311.pyc new file mode 100644 index 0000000..2be3c1c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_device.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_edge.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_edge.cpython-311.pyc new file mode 100644 index 0000000..28ad980 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/bulk_import_result_edge.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/byte_buffer.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/byte_buffer.cpython-311.pyc new file mode 100644 index 0000000..1b09676 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/byte_buffer.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/change_password_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/change_password_request.cpython-311.pyc new file mode 100644 index 0000000..b245ca2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/change_password_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..1fc3f84 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/check_pre_provisioned_devices_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/claim_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/claim_request.cpython-311.pyc new file mode 100644 index 0000000..72f0180 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/claim_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/clear_rule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/clear_rule.cpython-311.pyc new file mode 100644 index 0000000..2f65549 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/clear_rule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..80caa9a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/client_attributes_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/client_registration_dto.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/client_registration_dto.cpython-311.pyc new file mode 100644 index 0000000..3e7c09a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/client_registration_dto.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..d3a49ef Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..61e4fa6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..d95c73f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/coap_device_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/column_mapping.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/column_mapping.cpython-311.pyc new file mode 100644 index 0000000..7f3d11d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/column_mapping.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/comparison_ts_value.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/comparison_ts_value.cpython-311.pyc new file mode 100644 index 0000000..7265fce Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/comparison_ts_value.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/complex_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/complex_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..d2b707c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/complex_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/complex_version_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/complex_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..1d38849 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/complex_version_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor.cpython-311.pyc new file mode 100644 index 0000000..f1f2f0f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor_id.cpython-311.pyc new file mode 100644 index 0000000..30030e9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/component_descriptor_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/contact_basedobject.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/contact_basedobject.cpython-311.pyc new file mode 100644 index 0000000..db9ec53 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/contact_basedobject.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/converter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/converter.cpython-311.pyc new file mode 100644 index 0000000..f7592cc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/converter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/converter_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/converter_id.cpython-311.pyc new file mode 100644 index 0000000..dd4ee90 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/converter_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_menu.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_menu.cpython-311.pyc new file mode 100644 index 0000000..8249fb6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_menu.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_menu_item.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_menu_item.cpython-311.pyc new file mode 100644 index 0000000..861c336 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_menu_item.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..30cb667 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule_item.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule_item.cpython-311.pyc new file mode 100644 index 0000000..9f08f7f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_time_schedule_item.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_translation.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_translation.cpython-311.pyc new file mode 100644 index 0000000..1f0d04e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/custom_translation.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer.cpython-311.pyc new file mode 100644 index 0000000..26d243f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_id.cpython-311.pyc new file mode 100644 index 0000000..1189f22 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_info.cpython-311.pyc new file mode 100644 index 0000000..502ac39 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_users_filter.cpython-311.pyc new file mode 100644 index 0000000..e2a77a7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/customer_users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard.cpython-311.pyc new file mode 100644 index 0000000..376c2a4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard_id.cpython-311.pyc new file mode 100644 index 0000000..b6e003b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..ac02e70 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_converter_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_converter_event_filter.cpython-311.pyc new file mode 100644 index 0000000..93b2e32 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_converter_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_integration_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_integration_event_filter.cpython-311.pyc new file mode 100644 index 0000000..7d21689 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_integration_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc new file mode 100644 index 0000000..6b3a4e7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_chain_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_node_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_node_event_filter.cpython-311.pyc new file mode 100644 index 0000000..b14869d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/debug_rule_node_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_coap_device_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..b53d073 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_coap_device_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_configuration.cpython-311.pyc new file mode 100644 index 0000000..60eb890 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..5fc98db Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..a982e65 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..f46faf8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_rule_chain_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_rule_chain_create_request.cpython-311.pyc new file mode 100644 index 0000000..768c418 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_rule_chain_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_tenant_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..13afdd7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/default_tenant_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..8c41c6c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_diff.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..ea9790b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_entity_data_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_branch_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_branch_info.cpython-311.pyc new file mode 100644 index 0000000..e29147a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_branch_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..0d961df Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_list_versioned_entity_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..a0a49d8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_page_data_entity_version.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_repository_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_repository_settings.cpython-311.pyc new file mode 100644 index 0000000..5af3804 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_repository_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_void.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_void.cpython-311.pyc new file mode 100644 index 0000000..6a6e5ab Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_result_void.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_resultuuid.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_resultuuid.cpython-311.pyc new file mode 100644 index 0000000..eeae57e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/deferred_resultuuid.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/delete_tenant_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/delete_tenant_request.cpython-311.pyc new file mode 100644 index 0000000..aee1725 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/delete_tenant_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..3ae4d03 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device.cpython-311.pyc new file mode 100644 index 0000000..3a1edaa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..24e1cd1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_activity_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_configuration.cpython-311.pyc new file mode 100644 index 0000000..f423eeb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_credentials_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_credentials_id.cpython-311.pyc new file mode 100644 index 0000000..e101743 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_credentials_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_data.cpython-311.pyc new file mode 100644 index 0000000..917c8f7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_export_data.cpython-311.pyc new file mode 100644 index 0000000..39ec958 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_group_ota_package.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_group_ota_package.cpython-311.pyc new file mode 100644 index 0000000..83f6faa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_group_ota_package.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_id.cpython-311.pyc new file mode 100644 index 0000000..5d055db Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_info.cpython-311.pyc new file mode 100644 index 0000000..317f39a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_alarm.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_alarm.cpython-311.pyc new file mode 100644 index 0000000..a7f122b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_alarm.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..c778a4e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_data.cpython-311.pyc new file mode 100644 index 0000000..c7a6254 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_id.cpython-311.pyc new file mode 100644 index 0000000..301ac45 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..c7bf681 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..a39f9c2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_search_query.cpython-311.pyc new file mode 100644 index 0000000..8ed3652 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..df0dfed Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..3f6ee5f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_type_filter.cpython-311.pyc new file mode 100644 index 0000000..e686567 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/device_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..d0b340f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/disabled_device_profile_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/domain_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/domain_info.cpython-311.pyc new file mode 100644 index 0000000..22f5e58 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/domain_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/duration_alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/duration_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..4cdfd5d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/duration_alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueboolean.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..746ebf2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueboolean.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuedouble.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..163e2bc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuedouble.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueint.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueint.cpython-311.pyc new file mode 100644 index 0000000..8516923 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valueint.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuelong.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuelong.cpython-311.pyc new file mode 100644 index 0000000..c93c7cc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuelong.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuestring.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuestring.cpython-311.pyc new file mode 100644 index 0000000..230536b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/dynamic_valuestring.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge.cpython-311.pyc new file mode 100644 index 0000000..8a0d675 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_event.cpython-311.pyc new file mode 100644 index 0000000..3ec6576 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_event_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_event_id.cpython-311.pyc new file mode 100644 index 0000000..8674c8a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_event_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_id.cpython-311.pyc new file mode 100644 index 0000000..1b4d585 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_info.cpython-311.pyc new file mode 100644 index 0000000..9301879 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_install_instructions.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_install_instructions.cpython-311.pyc new file mode 100644 index 0000000..2eb3338 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_install_instructions.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query.cpython-311.pyc new file mode 100644 index 0000000..98cd2bd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..4f0a9ca Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_type_filter.cpython-311.pyc new file mode 100644 index 0000000..c20cbb9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/edge_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..001a1d7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/efento_coap_device_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..7a34c0e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..56eb1a5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..ffeb79d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/email_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entities_by_group_name_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entities_by_group_name_filter.cpython-311.pyc new file mode 100644 index 0000000..5af9e14 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entities_by_group_name_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..ab2d125 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entities_limit_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..63ee67c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_action_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_count_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_count_query.cpython-311.pyc new file mode 100644 index 0000000..b79b8ae Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_count_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data.cpython-311.pyc new file mode 100644 index 0000000..d702833 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_diff.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_diff.cpython-311.pyc new file mode 100644 index 0000000..9e24284 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_diff.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_info.cpython-311.pyc new file mode 100644 index 0000000..69dc1c7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_page_link.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_page_link.cpython-311.pyc new file mode 100644 index 0000000..ac67d9e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_page_link.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_query.cpython-311.pyc new file mode 100644 index 0000000..bdec3ef Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_sort_order.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_sort_order.cpython-311.pyc new file mode 100644 index 0000000..c6563fe Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_data_sort_order.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_export_dataobject.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_export_dataobject.cpython-311.pyc new file mode 100644 index 0000000..65557c9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_export_dataobject.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_filter.cpython-311.pyc new file mode 100644 index 0000000..894118a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group.cpython-311.pyc new file mode 100644 index 0000000..2307439 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_export_data.cpython-311.pyc new file mode 100644 index 0000000..d6709d0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_filter.cpython-311.pyc new file mode 100644 index 0000000..733bba8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_id.cpython-311.pyc new file mode 100644 index 0000000..42357c4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_info.cpython-311.pyc new file mode 100644 index 0000000..326a60a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_list_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_list_filter.cpython-311.pyc new file mode 100644 index 0000000..5b59aa3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_list_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_name_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_name_filter.cpython-311.pyc new file mode 100644 index 0000000..bfe9c33 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_group_name_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_id.cpython-311.pyc new file mode 100644 index 0000000..7b98430 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_key.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_key.cpython-311.pyc new file mode 100644 index 0000000..e64e248 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_key.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_list_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_list_filter.cpython-311.pyc new file mode 100644 index 0000000..198a5d8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_list_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_load_error.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_load_error.cpython-311.pyc new file mode 100644 index 0000000..de60aa3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_load_error.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_name_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_name_filter.cpython-311.pyc new file mode 100644 index 0000000..bc9c2b5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_name_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_relation_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_relation_info.cpython-311.pyc new file mode 100644 index 0000000..03c62a5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_relation_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_relations_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_relations_query.cpython-311.pyc new file mode 100644 index 0000000..ac9e3e2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_relations_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_subtype.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_subtype.cpython-311.pyc new file mode 100644 index 0000000..94311a5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_subtype.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..08d1387 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_load_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_load_result.cpython-311.pyc new file mode 100644 index 0000000..b4cad70 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_load_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_create_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_create_config.cpython-311.pyc new file mode 100644 index 0000000..07a9d4e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_create_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_config.cpython-311.pyc new file mode 100644 index 0000000..3803aae Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..1d4230c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_type_version_load_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_version.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_version.cpython-311.pyc new file mode 100644 index 0000000..df9b54b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_version.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view.cpython-311.pyc new file mode 100644 index 0000000..ef11db9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_id.cpython-311.pyc new file mode 100644 index 0000000..2229913 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..a6c480f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query.cpython-311.pyc new file mode 100644 index 0000000..d61ce02 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query_filter.cpython-311.pyc new file mode 100644 index 0000000..24c37cb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_search_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_type_filter.cpython-311.pyc new file mode 100644 index 0000000..9671728 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/entity_view_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/error_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/error_event_filter.cpython-311.pyc new file mode 100644 index 0000000..8385939 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/error_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..ad80b46 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/escalated_notification_rule_recipients_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event.cpython-311.pyc new file mode 100644 index 0000000..3136bad Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_filter.cpython-311.pyc new file mode 100644 index 0000000..4964f61 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_id.cpython-311.pyc new file mode 100644 index 0000000..6a6833b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_info.cpython-311.pyc new file mode 100644 index 0000000..2edbd21 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/event_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/exportable_entity_entity_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/exportable_entity_entity_id.cpython-311.pyc new file mode 100644 index 0000000..174dacd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/exportable_entity_entity_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/favicon.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/favicon.cpython-311.pyc new file mode 100644 index 0000000..35b695d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/favicon.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/features_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/features_info.cpython-311.pyc new file mode 100644 index 0000000..b72a8db Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/features_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueboolean.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueboolean.cpython-311.pyc new file mode 100644 index 0000000..0a171af Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueboolean.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuedouble.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuedouble.cpython-311.pyc new file mode 100644 index 0000000..8c91171 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuedouble.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueint.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueint.cpython-311.pyc new file mode 100644 index 0000000..6caba74 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valueint.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuelong.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuelong.cpython-311.pyc new file mode 100644 index 0000000..f35cbe4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuelong.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuestring.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuestring.cpython-311.pyc new file mode 100644 index 0000000..009fffa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/filter_predicate_valuestring.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_entity_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_entity_export_data.cpython-311.pyc new file mode 100644 index 0000000..56aff7e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_entity_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission.cpython-311.pyc new file mode 100644 index 0000000..bbb588c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission_id.cpython-311.pyc new file mode 100644 index 0000000..9a3893b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission_info.cpython-311.pyc new file mode 100644 index 0000000..14c165c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/group_permission_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/home_dashboard.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/home_dashboard.cpython-311.pyc new file mode 100644 index 0000000..c03b119 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/home_dashboard.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/http_routing_key_body.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/http_routing_key_body.cpython-311.pyc new file mode 100644 index 0000000..698b0f8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/http_routing_key_body.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/input_stream.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/input_stream.cpython-311.pyc new file mode 100644 index 0000000..1ec68a8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/input_stream.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration.cpython-311.pyc new file mode 100644 index 0000000..fdf4c88 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_id.cpython-311.pyc new file mode 100644 index 0000000..a6cb240 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_info.cpython-311.pyc new file mode 100644 index 0000000..f1abbf3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..dc8e039 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/integration_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/json_node.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/json_node.cpython-311.pyc new file mode 100644 index 0000000..7b08f3c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/json_node.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/json_transport_payload_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/json_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..d0205ee Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/json_transport_payload_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/jwt_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/jwt_settings.cpython-311.pyc new file mode 100644 index 0000000..29b49d8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/jwt_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/key_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/key_filter.cpython-311.pyc new file mode 100644 index 0000000..f53d15c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/key_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/key_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/key_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..acd4579 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/key_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/last_visited_dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/last_visited_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..dfcfeb9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/last_visited_dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/license_usage_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/license_usage_info.cpython-311.pyc new file mode 100644 index 0000000..de4b48f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/license_usage_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/life_cycle_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/life_cycle_event_filter.cpython-311.pyc new file mode 100644 index 0000000..1e81ea6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/life_cycle_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_request.cpython-311.pyc new file mode 100644 index 0000000..a60310c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_response.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_response.cpython-311.pyc new file mode 100644 index 0000000..7753526 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_response.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_white_labeling_params.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_white_labeling_params.cpython-311.pyc new file mode 100644 index 0000000..dc31ef3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/login_white_labeling_params.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..9fe9ecf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc new file mode 100644 index 0000000..ec222b9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2_m_server_security_config_default.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_instance.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_instance.cpython-311.pyc new file mode 100644 index 0000000..c58e204 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_instance.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_object.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_object.cpython-311.pyc new file mode 100644 index 0000000..c2524fc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_object.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_resource_observe.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_resource_observe.cpython-311.pyc new file mode 100644 index 0000000..63eb424 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lw_m2m_resource_observe.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..1507575 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..77fc693 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/lwm2m_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mapping.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mapping.cpython-311.pyc new file mode 100644 index 0000000..773af01 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mapping.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_group_permission_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_group_permission_info.cpython-311.pyc new file mode 100644 index 0000000..03981ee Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_group_permission_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_group_type_permission_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_group_type_permission_info.cpython-311.pyc new file mode 100644 index 0000000..ce4e246 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_group_type_permission_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_user_permissions.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_user_permissions.cpython-311.pyc new file mode 100644 index 0000000..dadfbf9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/merged_user_permissions.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..7a02d73 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..3b01b9f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/mqtt_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..1f9dcae Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/new_platform_version_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..c43ebb0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/no_sec_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/node_connection_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/node_connection_info.cpython-311.pyc new file mode 100644 index 0000000..12754a0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/node_connection_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification.cpython-311.pyc new file mode 100644 index 0000000..2609e15 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_delivery_method_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..8896cc9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_delivery_method_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_id.cpython-311.pyc new file mode 100644 index 0000000..84bb924 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_info.cpython-311.pyc new file mode 100644 index 0000000..a70188c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request.cpython-311.pyc new file mode 100644 index 0000000..85b8084 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_config.cpython-311.pyc new file mode 100644 index 0000000..b3fb47b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_id.cpython-311.pyc new file mode 100644 index 0000000..731e43b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_preview.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_preview.cpython-311.pyc new file mode 100644 index 0000000..5d97f49 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_preview.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_stats.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_stats.cpython-311.pyc new file mode 100644 index 0000000..3d74614 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_request_stats.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_config.cpython-311.pyc new file mode 100644 index 0000000..22cf31c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_id.cpython-311.pyc new file mode 100644 index 0000000..9c59fc6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_recipients_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_recipients_config.cpython-311.pyc new file mode 100644 index 0000000..afe8572 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_rule_recipients_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_target_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_target_id.cpython-311.pyc new file mode 100644 index 0000000..d9fdd5b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_target_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_template_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_template_config.cpython-311.pyc new file mode 100644 index 0000000..b79e68a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_template_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_template_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_template_id.cpython-311.pyc new file mode 100644 index 0000000..2dd695e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/notification_template_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/numeric_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/numeric_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..c6bb1e9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/numeric_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..a9fee61 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_basic_mapper_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_info.cpython-311.pyc new file mode 100644 index 0000000..3855d63 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template.cpython-311.pyc new file mode 100644 index 0000000..d37612b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc new file mode 100644 index 0000000..119e9df Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_client_registration_template_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_domain_params.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_domain_params.cpython-311.pyc new file mode 100644 index 0000000..e200edd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_domain_params.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_params.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_params.cpython-311.pyc new file mode 100644 index 0000000..0a5fd5b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_clients_params.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..33b3808 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_custom_mapper_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_domain_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_domain_info.cpython-311.pyc new file mode 100644 index 0000000..fee5397 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_domain_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_info.cpython-311.pyc new file mode 100644 index 0000000..61b955c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mapper_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mapper_config.cpython-311.pyc new file mode 100644 index 0000000..2f9e1a6 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mapper_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mobile_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mobile_info.cpython-311.pyc new file mode 100644 index 0000000..ad6742e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_mobile_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_params_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_params_info.cpython-311.pyc new file mode 100644 index 0000000..c266c1a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_params_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_registration_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_registration_info.cpython-311.pyc new file mode 100644 index 0000000..a675e0e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/o_auth2_registration_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/object_attributes.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/object_attributes.cpython-311.pyc new file mode 100644 index 0000000..169c5e4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/object_attributes.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/object_node.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/object_node.cpython-311.pyc new file mode 100644 index 0000000..fd0a48b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/object_node.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc new file mode 100644 index 0000000..53c6aa2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/originator_entity_owner_users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package.cpython-311.pyc new file mode 100644 index 0000000..34d00eb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_id.cpython-311.pyc new file mode 100644 index 0000000..8c946b1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..0ab6edd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc new file mode 100644 index 0000000..e0daaf7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ota_package_ota_package_id_body.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/other_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/other_configuration.cpython-311.pyc new file mode 100644 index 0000000..2d963c5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/other_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_blob_entity_with_customer_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_blob_entity_with_customer_info.cpython-311.pyc new file mode 100644 index 0000000..22f5645 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_blob_entity_with_customer_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_contact_basedobject.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_contact_basedobject.cpython-311.pyc new file mode 100644 index 0000000..fbe98cd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_contact_basedobject.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_converter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_converter.cpython-311.pyc new file mode 100644 index 0000000..60df920 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_converter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_customer_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_customer_info.cpython-311.pyc new file mode 100644 index 0000000..e9928c5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_customer_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge.cpython-311.pyc new file mode 100644 index 0000000..4b395ba Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_event.cpython-311.pyc new file mode 100644 index 0000000..219243c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_info.cpython-311.pyc new file mode 100644 index 0000000..b00b057 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_edge_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group.cpython-311.pyc new file mode 100644 index 0000000..20ec8b9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group_info.cpython-311.pyc new file mode 100644 index 0000000..6a99835 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_group_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_version.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_version.cpython-311.pyc new file mode 100644 index 0000000..8228d0f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_version.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_view_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_view_info.cpython-311.pyc new file mode 100644 index 0000000..4c28876 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_entity_view_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_event.cpython-311.pyc new file mode 100644 index 0000000..d01dd83 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_event_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_event_info.cpython-311.pyc new file mode 100644 index 0000000..5f5925b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_event_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration.cpython-311.pyc new file mode 100644 index 0000000..deb6f01 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration_info.cpython-311.pyc new file mode 100644 index 0000000..b26fe3b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_integration_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_ota_package_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_ota_package_info.cpython-311.pyc new file mode 100644 index 0000000..bd9776b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_ota_package_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_queue.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_queue.cpython-311.pyc new file mode 100644 index 0000000..026c153 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_queue.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_role.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_role.cpython-311.pyc new file mode 100644 index 0000000..afcdbf7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_role.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_rule_chain.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_rule_chain.cpython-311.pyc new file mode 100644 index 0000000..6cf89c5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_rule_chain.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_scheduler_event_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_scheduler_event_info.cpython-311.pyc new file mode 100644 index 0000000..7243ab9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_scheduler_event_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_short_entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_short_entity_view.cpython-311.pyc new file mode 100644 index 0000000..9793043 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_short_entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_tb_resource_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..efc4e34 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_tb_resource_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_email_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_email_info.cpython-311.pyc new file mode 100644 index 0000000..d2a938f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_email_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_info.cpython-311.pyc new file mode 100644 index 0000000..d117a5c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/page_data_user_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/palette.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/palette.cpython-311.pyc new file mode 100644 index 0000000..a03564d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/palette.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/palette_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/palette_settings.cpython-311.pyc new file mode 100644 index 0000000..c699053 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/palette_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/platform_two_fa_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/platform_two_fa_settings.cpython-311.pyc new file mode 100644 index 0000000..ccfe142 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/platform_two_fa_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/platform_users_notification_target_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/platform_users_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..117420a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/platform_users_notification_target_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/power_saving_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/power_saving_configuration.cpython-311.pyc new file mode 100644 index 0000000..524f1aa Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/power_saving_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/processing_strategy.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/processing_strategy.cpython-311.pyc new file mode 100644 index 0000000..8e5fe79 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/processing_strategy.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/proto_transport_payload_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/proto_transport_payload_configuration.cpython-311.pyc new file mode 100644 index 0000000..5dbe58f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/proto_transport_payload_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/psk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/psk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..ca044cf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/psk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..bb726e0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/psklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/queue.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/queue.cpython-311.pyc new file mode 100644 index 0000000..714fad2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/queue.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/queue_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/queue_id.cpython-311.pyc new file mode 100644 index 0000000..0137967 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/queue_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/raw_data_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/raw_data_event_filter.cpython-311.pyc new file mode 100644 index 0000000..e1eeba8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/raw_data_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relation_entity_type_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relation_entity_type_filter.cpython-311.pyc new file mode 100644 index 0000000..9eb74e1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relation_entity_type_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relations_query_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relations_query_filter.cpython-311.pyc new file mode 100644 index 0000000..3c863bf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relations_query_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relations_search_parameters.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relations_search_parameters.cpython-311.pyc new file mode 100644 index 0000000..eef3554 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/relations_search_parameters.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..47e90bf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repeating_alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/report_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/report_config.cpython-311.pyc new file mode 100644 index 0000000..d85fa5b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/report_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repository_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repository_settings.cpython-311.pyc new file mode 100644 index 0000000..b50045c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repository_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repository_settings_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repository_settings_info.cpython-311.pyc new file mode 100644 index 0000000..bac9c65 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/repository_settings_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/reset_password_email_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/reset_password_email_request.cpython-311.pyc new file mode 100644 index 0000000..51571dd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/reset_password_email_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/reset_password_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/reset_password_request.cpython-311.pyc new file mode 100644 index 0000000..a34a4d7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/reset_password_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/resource.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/resource.cpython-311.pyc new file mode 100644 index 0000000..65a25e4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/resource.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/response_entity.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/response_entity.cpython-311.pyc new file mode 100644 index 0000000..d077854 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/response_entity.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/role.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/role.cpython-311.pyc new file mode 100644 index 0000000..5ccac2a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/role.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/role_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/role_id.cpython-311.pyc new file mode 100644 index 0000000..ce8266b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/role_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpc.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpc.cpython-311.pyc new file mode 100644 index 0000000..cd02bfd Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpc.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpc_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpc_id.cpython-311.pyc new file mode 100644 index 0000000..6faef00 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpc_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..8144ef8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpk_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..9ec68b5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rpklw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain.cpython-311.pyc new file mode 100644 index 0000000..9ed33b4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_connection_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_connection_info.cpython-311.pyc new file mode 100644 index 0000000..e335e24 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_connection_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_data.cpython-311.pyc new file mode 100644 index 0000000..798e545 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..8c5dfbc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_debug_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_export_data.cpython-311.pyc new file mode 100644 index 0000000..ca978fe Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_id.cpython-311.pyc new file mode 100644 index 0000000..fd5f8c2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_import_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_import_result.cpython-311.pyc new file mode 100644 index 0000000..6b4e72c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_import_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_meta_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_meta_data.cpython-311.pyc new file mode 100644 index 0000000..4c5f9d5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_meta_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc new file mode 100644 index 0000000..5005a41 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_chain_output_labels_usage.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc new file mode 100644 index 0000000..d987689 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_engine_component_lifecycle_event_notification_rule_trigger_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node.cpython-311.pyc new file mode 100644 index 0000000..10e0b17 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node_debug_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node_debug_event_filter.cpython-311.pyc new file mode 100644 index 0000000..e6e4912 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node_debug_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node_id.cpython-311.pyc new file mode 100644 index 0000000..641a82b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/rule_node_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/save_device_with_credentials_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/save_device_with_credentials_request.cpython-311.pyc new file mode 100644 index 0000000..1270894 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/save_device_with_credentials_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/save_ota_package_info_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/save_ota_package_info_request.cpython-311.pyc new file mode 100644 index 0000000..c911b0a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/save_ota_package_info_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event.cpython-311.pyc new file mode 100644 index 0000000..d21c1ed Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_filter.cpython-311.pyc new file mode 100644 index 0000000..d44a420 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_id.cpython-311.pyc new file mode 100644 index 0000000..e7a57e8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_info.cpython-311.pyc new file mode 100644 index 0000000..f699dd0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_with_customer_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_with_customer_info.cpython-311.pyc new file mode 100644 index 0000000..414468b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/scheduler_event_with_customer_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/security_settings.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/security_settings.cpython-311.pyc new file mode 100644 index 0000000..362e1ae Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/security_settings.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/self_registration_params.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/self_registration_params.cpython-311.pyc new file mode 100644 index 0000000..e3bdf39 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/self_registration_params.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/server_security_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/server_security_config.cpython-311.pyc new file mode 100644 index 0000000..62f2ce7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/server_security_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/share_group_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/share_group_request.cpython-311.pyc new file mode 100644 index 0000000..56cd6bb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/share_group_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..33b5a73 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/shared_attributes_setting_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/short_customer_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/short_customer_info.cpython-311.pyc new file mode 100644 index 0000000..5b74d6f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/short_customer_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/short_entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/short_entity_view.cpython-311.pyc new file mode 100644 index 0000000..c0e7248 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/short_entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sign_up_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sign_up_request.cpython-311.pyc new file mode 100644 index 0000000..04a68a2 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sign_up_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sign_up_self_registration_params.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sign_up_self_registration_params.cpython-311.pyc new file mode 100644 index 0000000..1892331 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sign_up_self_registration_params.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/simple_alarm_condition_spec.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/simple_alarm_condition_spec.cpython-311.pyc new file mode 100644 index 0000000..70d3843 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/simple_alarm_condition_spec.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_filter.cpython-311.pyc new file mode 100644 index 0000000..67afa35 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_create_request.cpython-311.pyc new file mode 100644 index 0000000..07440f7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_load_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_load_request.cpython-311.pyc new file mode 100644 index 0000000..9732daf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/single_entity_version_load_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_conversation.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_conversation.cpython-311.pyc new file mode 100644 index 0000000..23a30e5 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_conversation.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..10a4f61 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc new file mode 100644 index 0000000..eab7163 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_delivery_method_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_target_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_target_config.cpython-311.pyc new file mode 100644 index 0000000..6d8303d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/slack_notification_target_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..c0527d9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/smpp_sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..47bb19f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..d926682 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..2a65402 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..44769e8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/sms_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..04abd96 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..8d9c51e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_profile_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_transport_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_transport_configuration.cpython-311.pyc new file mode 100644 index 0000000..4482b19 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_device_transport_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_mapping.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_mapping.cpython-311.pyc new file mode 100644 index 0000000..621ea02 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/snmp_mapping.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/solution_install_response.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/solution_install_response.cpython-311.pyc new file mode 100644 index 0000000..660a74f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/solution_install_response.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/specific_time_schedule.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/specific_time_schedule.cpython-311.pyc new file mode 100644 index 0000000..66e383c Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/specific_time_schedule.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/starred_dashboard_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/starred_dashboard_info.cpython-311.pyc new file mode 100644 index 0000000..d5a4083 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/starred_dashboard_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/state_entity_owner_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/state_entity_owner_filter.cpython-311.pyc new file mode 100644 index 0000000..d8419bf Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/state_entity_owner_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/statistics_event_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/statistics_event_filter.cpython-311.pyc new file mode 100644 index 0000000..5cece82 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/statistics_event_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/string_filter_predicate.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/string_filter_predicate.cpython-311.pyc new file mode 100644 index 0000000..8569c68 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/string_filter_predicate.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/submit_strategy.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/submit_strategy.cpython-311.pyc new file mode 100644 index 0000000..52ac2f0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/submit_strategy.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/subscription_usage.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/subscription_usage.cpython-311.pyc new file mode 100644 index 0000000..6e20e3e Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/subscription_usage.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_administrators_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..cf6a58b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_administrators_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_info.cpython-311.pyc new file mode 100644 index 0000000..98fae23 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_info_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_info_data.cpython-311.pyc new file mode 100644 index 0000000..c6d9c67 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/system_info_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource.cpython-311.pyc new file mode 100644 index 0000000..28f26ab Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_id.cpython-311.pyc new file mode 100644 index 0000000..2f80768 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_info.cpython-311.pyc new file mode 100644 index 0000000..ec9c54d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tb_resource_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_entity_view.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_entity_view.cpython-311.pyc new file mode 100644 index 0000000..d9e2e86 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_entity_view.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_mapping_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_mapping_configuration.cpython-311.pyc new file mode 100644 index 0000000..88e1f48 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_mapping_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..da6711a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/telemetry_querying_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_administrators_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_administrators_filter.cpython-311.pyc new file mode 100644 index 0000000..05b9c81 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_administrators_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_id.cpython-311.pyc new file mode 100644 index 0000000..db77ed4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_configuration.cpython-311.pyc new file mode 100644 index 0000000..54044fc Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_data.cpython-311.pyc new file mode 100644 index 0000000..73ea93b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_id.cpython-311.pyc new file mode 100644 index 0000000..91a31c4 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc new file mode 100644 index 0000000..126c277 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_profile_queue_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_details.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_details.cpython-311.pyc new file mode 100644 index 0000000..7ffab29 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_details.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_info.cpython-311.pyc new file mode 100644 index 0000000..a801eb8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_instructions.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_instructions.cpython-311.pyc new file mode 100644 index 0000000..9a94321 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/tenant_solution_template_instructions.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/test_sms_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/test_sms_request.cpython-311.pyc new file mode 100644 index 0000000..64ba5b3 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/test_sms_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc new file mode 100644 index 0000000..3680742 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_credentials_expired_response.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_error_response.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_error_response.cpython-311.pyc new file mode 100644 index 0000000..e095029 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/thingsboard_error_response.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc new file mode 100644 index 0000000..b207487 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/to_device_rpc_request_snmp_communication_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..7985c20 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..14449fb Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/totp_two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/transport_payload_type_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/transport_payload_type_configuration.cpython-311.pyc new file mode 100644 index 0000000..67ef365 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/transport_payload_type_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ts_value.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ts_value.cpython-311.pyc new file mode 100644 index 0000000..c48f40d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/ts_value.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc new file mode 100644 index 0000000..fd13d64 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/twilio_sms_provider_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config.cpython-311.pyc new file mode 100644 index 0000000..9856d82 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config_update_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config_update_request.cpython-311.pyc new file mode 100644 index 0000000..9a8f229 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_account_config_update_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_config.cpython-311.pyc new file mode 100644 index 0000000..0e6e6b8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_info.cpython-311.pyc new file mode 100644 index 0000000..525b127 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/two_fa_provider_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/update_message.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/update_message.cpython-311.pyc new file mode 100644 index 0000000..2f38ed8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/update_message.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user.cpython-311.pyc new file mode 100644 index 0000000..50bbbf7 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_dashboards_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_dashboards_info.cpython-311.pyc new file mode 100644 index 0000000..c1fc911 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_dashboards_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_email_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_email_info.cpython-311.pyc new file mode 100644 index 0000000..eff8b1f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_email_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_group_list_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_group_list_filter.cpython-311.pyc new file mode 100644 index 0000000..e2af867 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_group_list_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_id.cpython-311.pyc new file mode 100644 index 0000000..6a6cdc1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_info.cpython-311.pyc new file mode 100644 index 0000000..85d0cff Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_list_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_list_filter.cpython-311.pyc new file mode 100644 index 0000000..3ee3c5f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_list_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_password_policy.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_password_policy.cpython-311.pyc new file mode 100644 index 0000000..9007bf8 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_password_policy.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_role_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_role_filter.cpython-311.pyc new file mode 100644 index 0000000..683866b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/user_role_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/users_filter.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/users_filter.cpython-311.pyc new file mode 100644 index 0000000..e224107 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/users_filter.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_create_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_create_config.cpython-311.pyc new file mode 100644 index 0000000..8743e0b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_create_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_create_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_create_request.cpython-311.pyc new file mode 100644 index 0000000..bfe3bf1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_create_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_creation_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_creation_result.cpython-311.pyc new file mode 100644 index 0000000..edc749d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_creation_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_config.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_config.cpython-311.pyc new file mode 100644 index 0000000..313807d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_config.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_request.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_request.cpython-311.pyc new file mode 100644 index 0000000..dcbb16a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_request.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_result.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_result.cpython-311.pyc new file mode 100644 index 0000000..89d2ed0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/version_load_result.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/versioned_entity_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/versioned_entity_info.cpython-311.pyc new file mode 100644 index 0000000..4fd3b15 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/versioned_entity_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/web_delivery_method_notification_template.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/web_delivery_method_notification_template.cpython-311.pyc new file mode 100644 index 0000000..63986c0 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/web_delivery_method_notification_template.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/white_labeling_params.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/white_labeling_params.cpython-311.pyc new file mode 100644 index 0000000..18ec06a Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/white_labeling_params.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widget_type_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widget_type_id.cpython-311.pyc new file mode 100644 index 0000000..c7caeff Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widget_type_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widget_type_info.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widget_type_info.cpython-311.pyc new file mode 100644 index 0000000..44fff7d Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widget_type_info.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_export_data.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_export_data.cpython-311.pyc new file mode 100644 index 0000000..121e92f Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_export_data.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_id.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_id.cpython-311.pyc new file mode 100644 index 0000000..030b88b Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/widgets_bundle_id.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc new file mode 100644 index 0000000..6daf0d1 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/x509_certificate_chain_provision_configuration.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc new file mode 100644 index 0000000..5d303f9 Binary files /dev/null and b/tb-rest-client/python/tb_rest_client/models/models_pe/__pycache__/x509_lw_m2_m_bootstrap_server_credential.cpython-311.pyc differ diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/account_two_fa_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/account_two_fa_settings.py new file mode 100644 index 0000000..62a6ab9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/account_two_fa_settings.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AccountTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configs': 'dict(str, TwoFaAccountConfig)' + } + + attribute_map = { + 'configs': 'configs' + } + + def __init__(self, configs=None): # noqa: E501 + """AccountTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._configs = None + self.discriminator = None + if configs is not None: + self.configs = configs + + @property + def configs(self): + """Gets the configs of this AccountTwoFaSettings. # noqa: E501 + + + :return: The configs of this AccountTwoFaSettings. # noqa: E501 + :rtype: dict(str, TwoFaAccountConfig) + """ + return self._configs + + @configs.setter + def configs(self, configs): + """Sets the configs of this AccountTwoFaSettings. + + + :param configs: The configs of this AccountTwoFaSettings. # noqa: E501 + :type: dict(str, TwoFaAccountConfig) + """ + + self._configs = configs + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AccountTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AccountTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/activate_user_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/activate_user_request.py new file mode 100644 index 0000000..88d3384 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/activate_user_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ActivateUserRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'activate_token': 'activateToken', + 'password': 'password' + } + + def __init__(self, activate_token=None, password=None): # noqa: E501 + """ActivateUserRequest - a model defined in Swagger""" # noqa: E501 + self._activate_token = None + self._password = None + self.discriminator = None + if activate_token is not None: + self.activate_token = activate_token + if password is not None: + self.password = password + + @property + def activate_token(self): + """Gets the activate_token of this ActivateUserRequest. # noqa: E501 + + The activate token to verify # noqa: E501 + + :return: The activate_token of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._activate_token + + @activate_token.setter + def activate_token(self, activate_token): + """Sets the activate_token of this ActivateUserRequest. + + The activate token to verify # noqa: E501 + + :param activate_token: The activate_token of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._activate_token = activate_token + + @property + def password(self): + """Gets the password of this ActivateUserRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ActivateUserRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ActivateUserRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ActivateUserRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ActivateUserRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ActivateUserRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/admin_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/admin_settings.py new file mode 100644 index 0000000..0b86036 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/admin_settings.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AdminSettingsId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'key': 'str', + 'json_value': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'key': 'key', + 'json_value': 'jsonValue' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, key=None, json_value=None): # noqa: E501 + """AdminSettings - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._key = None + self._json_value = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if key is not None: + self.key = key + if json_value is not None: + self.json_value = json_value + + @property + def id(self): + """Gets the id of this AdminSettings. # noqa: E501 + + + :return: The id of this AdminSettings. # noqa: E501 + :rtype: AdminSettingsId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettings. + + + :param id: The id of this AdminSettings. # noqa: E501 + :type: AdminSettingsId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AdminSettings. # noqa: E501 + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :return: The created_time of this AdminSettings. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AdminSettings. + + Timestamp of the settings creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AdminSettings. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AdminSettings. # noqa: E501 + + + :return: The tenant_id of this AdminSettings. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AdminSettings. + + + :param tenant_id: The tenant_id of this AdminSettings. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def key(self): + """Gets the key of this AdminSettings. # noqa: E501 + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :return: The key of this AdminSettings. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AdminSettings. + + The Administration Settings key, (e.g. 'general' or 'mail') # noqa: E501 + + :param key: The key of this AdminSettings. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def json_value(self): + """Gets the json_value of this AdminSettings. # noqa: E501 + + + :return: The json_value of this AdminSettings. # noqa: E501 + :rtype: JsonNode + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AdminSettings. + + + :param json_value: The json_value of this AdminSettings. # noqa: E501 + :type: JsonNode + """ + + self._json_value = json_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/admin_settings_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/admin_settings_id.py new file mode 100644 index 0000000..f6fbbfc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/admin_settings_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AdminSettingsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AdminSettingsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AdminSettingsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AdminSettingsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AdminSettingsId. + + string # noqa: E501 + + :param id: The id of this AdminSettingsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AdminSettingsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AdminSettingsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/affected_tenant_administrators_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/affected_tenant_administrators_filter.py new file mode 100644 index 0000000..542d49f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/affected_tenant_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedTenantAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedTenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedTenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedTenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/affected_user_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/affected_user_filter.py new file mode 100644 index 0000000..313b949 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/affected_user_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AffectedUserFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AffectedUserFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AffectedUserFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AffectedUserFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm.py new file mode 100644 index 0000000..47cb306 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm.py @@ -0,0 +1,749 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Alarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'propagate_to_owner': 'bool', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate': 'propagate', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'propagate_to_owner': 'propagateToOwner', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate_to_owner_hierarchy=None, propagate=None, propagate_to_tenant=None, propagate_relation_types=None, propagate_to_owner=None, status=None): # noqa: E501 + """Alarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate_to_owner_hierarchy = None + self._propagate = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._propagate_to_owner = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate is not None: + self.propagate = propagate + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + self.status = status + + @property + def id(self): + """Gets the id of this Alarm. # noqa: E501 + + + :return: The id of this Alarm. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Alarm. + + + :param id: The id of this Alarm. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Alarm. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this Alarm. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Alarm. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Alarm. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Alarm. # noqa: E501 + + + :return: The tenant_id of this Alarm. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Alarm. + + + :param tenant_id: The tenant_id of this Alarm. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Alarm. # noqa: E501 + + + :return: The customer_id of this Alarm. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Alarm. + + + :param customer_id: The customer_id of this Alarm. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this Alarm. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this Alarm. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Alarm. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this Alarm. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Alarm. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this Alarm. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this Alarm. # noqa: E501 + + + :return: The originator of this Alarm. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this Alarm. + + + :param originator: The originator of this Alarm. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this Alarm. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this Alarm. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this Alarm. + + Alarm severity # noqa: E501 + + :param severity: The severity of this Alarm. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this Alarm. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this Alarm. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this Alarm. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this Alarm. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this Alarm. + + Cleared # noqa: E501 + + :param cleared: The cleared of this Alarm. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this Alarm. # noqa: E501 + + + :return: The assignee_id of this Alarm. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this Alarm. + + + :param assignee_id: The assignee_id of this Alarm. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this Alarm. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this Alarm. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this Alarm. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this Alarm. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this Alarm. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this Alarm. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this Alarm. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this Alarm. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this Alarm. # noqa: E501 + + + :return: The details of this Alarm. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this Alarm. + + + :param details: The details of this Alarm. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this Alarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate(self): + """Gets the propagate of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this Alarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this Alarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this Alarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this Alarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this Alarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this Alarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this Alarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this Alarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this Alarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this Alarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def status(self): + """Gets the status of this Alarm. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this Alarm. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Alarm. + + status of the Alarm # noqa: E501 + + :param status: The status of this Alarm. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Alarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Alarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_assignee.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_assignee.py new file mode 100644 index 0000000..aa9fc23 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_assignee.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignee(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'first_name': 'str', + 'id': 'UserId', + 'last_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'first_name': 'firstName', + 'id': 'id', + 'last_name': 'lastName' + } + + def __init__(self, email=None, first_name=None, id=None, last_name=None): # noqa: E501 + """AlarmAssignee - a model defined in Swagger""" # noqa: E501 + self._email = None + self._first_name = None + self._id = None + self._last_name = None + self.discriminator = None + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if id is not None: + self.id = id + if last_name is not None: + self.last_name = last_name + + @property + def email(self): + """Gets the email of this AlarmAssignee. # noqa: E501 + + + :return: The email of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmAssignee. + + + :param email: The email of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmAssignee. # noqa: E501 + + + :return: The first_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmAssignee. + + + :param first_name: The first_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def id(self): + """Gets the id of this AlarmAssignee. # noqa: E501 + + + :return: The id of this AlarmAssignee. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmAssignee. + + + :param id: The id of this AlarmAssignee. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def last_name(self): + """Gets the last_name of this AlarmAssignee. # noqa: E501 + + + :return: The last_name of this AlarmAssignee. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmAssignee. + + + :param last_name: The last_name of this AlarmAssignee. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignee, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignee): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_assignment_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_assignment_notification_rule_trigger_config.py new file mode 100644 index 0000000..06982a4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_assignment_notification_rule_trigger_config.py @@ -0,0 +1,255 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmAssignmentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on=None, trigger_type=None): # noqa: E501 + """AlarmAssignmentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on(self): + """Gets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ASSIGNED", "UNASSIGNED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmAssignmentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmAssignmentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmAssignmentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment.py new file mode 100644 index 0000000..060ecce --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment.py @@ -0,0 +1,293 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmComment(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None): # noqa: E501 + """AlarmComment - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + + @property + def id(self): + """Gets the id of this AlarmComment. # noqa: E501 + + + :return: The id of this AlarmComment. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmComment. + + + :param id: The id of this AlarmComment. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmComment. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmComment. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmComment. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmComment. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmComment. # noqa: E501 + + + :return: The alarm_id of this AlarmComment. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmComment. + + + :param alarm_id: The alarm_id of this AlarmComment. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmComment. # noqa: E501 + + + :return: The user_id of this AlarmComment. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmComment. + + + :param user_id: The user_id of this AlarmComment. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmComment. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmComment. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmComment. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmComment. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmComment. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmComment. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmComment. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmComment. # noqa: E501 + + + :return: The comment of this AlarmComment. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmComment. + + + :param comment: The comment of this AlarmComment. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmComment, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmComment): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_id.py new file mode 100644 index 0000000..134ac70 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AlarmCommentId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AlarmCommentId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AlarmCommentId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentId. + + string # noqa: E501 + + :param id: The id of this AlarmCommentId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_info.py new file mode 100644 index 0000000..fd59618 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_info.py @@ -0,0 +1,377 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmCommentId', + 'created_time': 'int', + 'alarm_id': 'EntityId', + 'user_id': 'UserId', + 'name': 'str', + 'type': 'str', + 'comment': 'JsonNode', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'alarm_id': 'alarmId', + 'user_id': 'userId', + 'name': 'name', + 'type': 'type', + 'comment': 'comment', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, created_time=None, alarm_id=None, user_id=None, name=None, type=None, comment=None, email=None, first_name=None, last_name=None): # noqa: E501 + """AlarmCommentInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._alarm_id = None + self._user_id = None + self._name = None + self._type = None + self._comment = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if alarm_id is not None: + self.alarm_id = alarm_id + if user_id is not None: + self.user_id = user_id + self.name = name + if type is not None: + self.type = type + if comment is not None: + self.comment = comment + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this AlarmCommentInfo. # noqa: E501 + + + :return: The id of this AlarmCommentInfo. # noqa: E501 + :rtype: AlarmCommentId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmCommentInfo. + + + :param id: The id of this AlarmCommentInfo. # noqa: E501 + :type: AlarmCommentId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmCommentInfo. # noqa: E501 + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmCommentInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmCommentInfo. + + Timestamp of the alarm comment creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmCommentInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def alarm_id(self): + """Gets the alarm_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :rtype: EntityId + """ + return self._alarm_id + + @alarm_id.setter + def alarm_id(self, alarm_id): + """Sets the alarm_id of this AlarmCommentInfo. + + + :param alarm_id: The alarm_id of this AlarmCommentInfo. # noqa: E501 + :type: EntityId + """ + + self._alarm_id = alarm_id + + @property + def user_id(self): + """Gets the user_id of this AlarmCommentInfo. # noqa: E501 + + + :return: The user_id of this AlarmCommentInfo. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AlarmCommentInfo. + + + :param user_id: The user_id of this AlarmCommentInfo. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def name(self): + """Gets the name of this AlarmCommentInfo. # noqa: E501 + + representing comment text # noqa: E501 + + :return: The name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmCommentInfo. + + representing comment text # noqa: E501 + + :param name: The name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmCommentInfo. # noqa: E501 + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :return: The type of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmCommentInfo. + + Defines origination of comment. System type means comment was created by TB. OTHER type means comment was created by user. # noqa: E501 + + :param type: The type of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + allowed_values = ["OTHER", "SYSTEM"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def comment(self): + """Gets the comment of this AlarmCommentInfo. # noqa: E501 + + + :return: The comment of this AlarmCommentInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this AlarmCommentInfo. + + + :param comment: The comment of this AlarmCommentInfo. # noqa: E501 + :type: JsonNode + """ + + self._comment = comment + + @property + def email(self): + """Gets the email of this AlarmCommentInfo. # noqa: E501 + + User email address # noqa: E501 + + :return: The email of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this AlarmCommentInfo. + + User email address # noqa: E501 + + :param email: The email of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this AlarmCommentInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this AlarmCommentInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this AlarmCommentInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this AlarmCommentInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this AlarmCommentInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this AlarmCommentInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_notification_rule_trigger_config.py new file mode 100644 index 0000000..a53c06c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_comment_notification_rule_trigger_config.py @@ -0,0 +1,274 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCommentNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_statuses': 'list[str]', + 'alarm_types': 'list[str]', + 'notify_on_comment_update': 'bool', + 'only_user_comments': 'bool', + 'trigger_type': 'str' + } + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_statuses': 'alarmStatuses', + 'alarm_types': 'alarmTypes', + 'notify_on_comment_update': 'notifyOnCommentUpdate', + 'only_user_comments': 'onlyUserComments', + 'trigger_type': 'triggerType' + } + + def __init__(self, alarm_severities=None, alarm_statuses=None, alarm_types=None, notify_on_comment_update=None, only_user_comments=None, trigger_type=None): # noqa: E501 + """AlarmCommentNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_statuses = None + self._alarm_types = None + self._notify_on_comment_update = None + self._only_user_comments = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + if alarm_types is not None: + self.alarm_types = alarm_types + if notify_on_comment_update is not None: + self.notify_on_comment_update = notify_on_comment_update + if only_user_comments is not None: + self.only_user_comments = only_user_comments + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_statuses: The alarm_statuses of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmCommentNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def notify_on_comment_update(self): + """Gets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._notify_on_comment_update + + @notify_on_comment_update.setter + def notify_on_comment_update(self, notify_on_comment_update): + """Sets the notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. + + + :param notify_on_comment_update: The notify_on_comment_update of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._notify_on_comment_update = notify_on_comment_update + + @property + def only_user_comments(self): + """Gets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_user_comments + + @only_user_comments.setter + def only_user_comments(self, only_user_comments): + """Sets the only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. + + + :param only_user_comments: The only_user_comments of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_user_comments = only_user_comments + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmCommentNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmCommentNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCommentNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCommentNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition.py new file mode 100644 index 0000000..9d7268b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCondition(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'list[AlarmConditionFilter]', + 'spec': 'AlarmConditionSpec' + } + + attribute_map = { + 'condition': 'condition', + 'spec': 'spec' + } + + def __init__(self, condition=None, spec=None): # noqa: E501 + """AlarmCondition - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._spec = None + self.discriminator = None + if condition is not None: + self.condition = condition + if spec is not None: + self.spec = spec + + @property + def condition(self): + """Gets the condition of this AlarmCondition. # noqa: E501 + + JSON array of alarm condition filters # noqa: E501 + + :return: The condition of this AlarmCondition. # noqa: E501 + :rtype: list[AlarmConditionFilter] + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmCondition. + + JSON array of alarm condition filters # noqa: E501 + + :param condition: The condition of this AlarmCondition. # noqa: E501 + :type: list[AlarmConditionFilter] + """ + + self._condition = condition + + @property + def spec(self): + """Gets the spec of this AlarmCondition. # noqa: E501 + + + :return: The spec of this AlarmCondition. # noqa: E501 + :rtype: AlarmConditionSpec + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this AlarmCondition. + + + :param spec: The spec of this AlarmCondition. # noqa: E501 + :type: AlarmConditionSpec + """ + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCondition, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCondition): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_filter.py new file mode 100644 index 0000000..4193db8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_filter.py @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'AlarmConditionFilterKey', + 'value_type': 'str', + 'value': 'object', + 'predicate': 'KeyFilterPredicate' + } + + attribute_map = { + 'key': 'key', + 'value_type': 'valueType', + 'value': 'value', + 'predicate': 'predicate' + } + + def __init__(self, key=None, value_type=None, value=None, predicate=None): # noqa: E501 + """AlarmConditionFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._value_type = None + self._value = None + self._predicate = None + self.discriminator = None + if key is not None: + self.key = key + if value_type is not None: + self.value_type = value_type + if value is not None: + self.value = value + if predicate is not None: + self.predicate = predicate + + @property + def key(self): + """Gets the key of this AlarmConditionFilter. # noqa: E501 + + + :return: The key of this AlarmConditionFilter. # noqa: E501 + :rtype: AlarmConditionFilterKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilter. + + + :param key: The key of this AlarmConditionFilter. # noqa: E501 + :type: AlarmConditionFilterKey + """ + + self._key = key + + @property + def value_type(self): + """Gets the value_type of this AlarmConditionFilter. # noqa: E501 + + String representation of the type of the value # noqa: E501 + + :return: The value_type of this AlarmConditionFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this AlarmConditionFilter. + + String representation of the type of the value # noqa: E501 + + :param value_type: The value_type of this AlarmConditionFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + @property + def value(self): + """Gets the value of this AlarmConditionFilter. # noqa: E501 + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :return: The value of this AlarmConditionFilter. # noqa: E501 + :rtype: object + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this AlarmConditionFilter. + + Value used in Constant comparison. For other types, such as TIME_SERIES or ATTRIBUTE, the predicate condition is used # noqa: E501 + + :param value: The value of this AlarmConditionFilter. # noqa: E501 + :type: object + """ + + self._value = value + + @property + def predicate(self): + """Gets the predicate of this AlarmConditionFilter. # noqa: E501 + + + :return: The predicate of this AlarmConditionFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this AlarmConditionFilter. + + + :param predicate: The predicate of this AlarmConditionFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_filter_key.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_filter_key.py new file mode 100644 index 0000000..c6aa286 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_filter_key.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionFilterKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'key': 'str' + } + + attribute_map = { + 'type': 'type', + 'key': 'key' + } + + def __init__(self, type=None, key=None): # noqa: E501 + """AlarmConditionFilterKey - a model defined in Swagger""" # noqa: E501 + self._type = None + self._key = None + self.discriminator = None + if type is not None: + self.type = type + if key is not None: + self.key = key + + @property + def type(self): + """Gets the type of this AlarmConditionFilterKey. # noqa: E501 + + The key type # noqa: E501 + + :return: The type of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmConditionFilterKey. + + The key type # noqa: E501 + + :param type: The type of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + allowed_values = ["ATTRIBUTE", "CONSTANT", "ENTITY_FIELD", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def key(self): + """Gets the key of this AlarmConditionFilterKey. # noqa: E501 + + String value representing the key # noqa: E501 + + :return: The key of this AlarmConditionFilterKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AlarmConditionFilterKey. + + String value representing the key # noqa: E501 + + :param key: The key of this AlarmConditionFilterKey. # noqa: E501 + :type: str + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionFilterKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionFilterKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_spec.py new file mode 100644 index 0000000..7bf4694 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_condition_spec.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmConditionSpec(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_count_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_count_query.py new file mode 100644 index 0000000..94e88ef --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_count_query.py @@ -0,0 +1,372 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'end_ts': 'int', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'end_ts': 'endTs', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, end_ts=None, entity_filter=None, key_filters=None, search_propagated_alarms=None, severity_list=None, start_ts=None, status_list=None, time_window=None, type_list=None): # noqa: E501 + """AlarmCountQuery - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._end_ts = None + self._entity_filter = None + self._key_filters = None + self._search_propagated_alarms = None + self._severity_list = None + self._start_ts = None + self._status_list = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if end_ts is not None: + self.end_ts = end_ts + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmCountQuery. # noqa: E501 + + + :return: The assignee_id of this AlarmCountQuery. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmCountQuery. + + + :param assignee_id: The assignee_id of this AlarmCountQuery. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def end_ts(self): + """Gets the end_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The end_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmCountQuery. + + + :param end_ts: The end_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmCountQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmCountQuery. + + + :param entity_filter: The entity_filter of this AlarmCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmCountQuery. # noqa: E501 + + + :return: The key_filters of this AlarmCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmCountQuery. + + + :param key_filters: The key_filters of this AlarmCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmCountQuery. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmCountQuery. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmCountQuery. # noqa: E501 + + + :return: The severity_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmCountQuery. + + + :param severity_list: The severity_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def start_ts(self): + """Gets the start_ts of this AlarmCountQuery. # noqa: E501 + + + :return: The start_ts of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmCountQuery. + + + :param start_ts: The start_ts of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmCountQuery. # noqa: E501 + + + :return: The status_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmCountQuery. + + + :param status_list: The status_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def time_window(self): + """Gets the time_window of this AlarmCountQuery. # noqa: E501 + + + :return: The time_window of this AlarmCountQuery. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmCountQuery. + + + :param time_window: The time_window of this AlarmCountQuery. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmCountQuery. # noqa: E501 + + + :return: The type_list of this AlarmCountQuery. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmCountQuery. + + + :param type_list: The type_list of this AlarmCountQuery. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data.py new file mode 100644 index 0000000..b7a3173 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data.py @@ -0,0 +1,883 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'propagate_to_owner': 'bool', + 'originator_name': 'str', + 'originator_label': 'str', + 'assignee': 'AlarmAssignee', + 'status': 'str' + } + + attribute_map = { + 'entity_id': 'entityId', + 'latest': 'latest', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate': 'propagate', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'propagate_to_owner': 'propagateToOwner', + 'originator_name': 'originatorName', + 'originator_label': 'originatorLabel', + 'assignee': 'assignee', + 'status': 'status' + } + + def __init__(self, entity_id=None, latest=None, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate_to_owner_hierarchy=None, propagate=None, propagate_to_tenant=None, propagate_relation_types=None, propagate_to_owner=None, originator_name=None, originator_label=None, assignee=None, status=None): # noqa: E501 + """AlarmData - a model defined in Swagger""" # noqa: E501 + self._entity_id = None + self._latest = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate_to_owner_hierarchy = None + self._propagate = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._propagate_to_owner = None + self._originator_name = None + self._originator_label = None + self._assignee = None + self._status = None + self.discriminator = None + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate is not None: + self.propagate = propagate + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_name is not None: + self.originator_name = originator_name + if originator_label is not None: + self.originator_label = originator_label + if assignee is not None: + self.assignee = assignee + self.status = status + + @property + def entity_id(self): + """Gets the entity_id of this AlarmData. # noqa: E501 + + + :return: The entity_id of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AlarmData. + + + :param entity_id: The entity_id of this AlarmData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this AlarmData. # noqa: E501 + + + :return: The latest of this AlarmData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this AlarmData. + + + :param latest: The latest of this AlarmData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def id(self): + """Gets the id of this AlarmData. # noqa: E501 + + + :return: The id of this AlarmData. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmData. + + + :param id: The id of this AlarmData. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmData. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmData. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmData. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmData. # noqa: E501 + + + :return: The tenant_id of this AlarmData. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmData. + + + :param tenant_id: The tenant_id of this AlarmData. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmData. # noqa: E501 + + + :return: The customer_id of this AlarmData. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmData. + + + :param customer_id: The customer_id of this AlarmData. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmData. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmData. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmData. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmData. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmData. # noqa: E501 + + + :return: The originator of this AlarmData. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmData. + + + :param originator: The originator of this AlarmData. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmData. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmData. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmData. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmData. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmData. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmData. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmData. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmData. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmData. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmData. # noqa: E501 + + + :return: The assignee_id of this AlarmData. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmData. + + + :param assignee_id: The assignee_id of this AlarmData. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmData. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmData. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmData. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmData. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmData. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmData. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmData. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmData. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmData. # noqa: E501 + + + :return: The details of this AlarmData. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmData. + + + :param details: The details of this AlarmData. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate(self): + """Gets the propagate of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmData. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmData. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmData. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmData. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmData. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmData. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmData. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmData. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmData. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_name(self): + """Gets the originator_name of this AlarmData. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmData. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def originator_label(self): + """Gets the originator_label of this AlarmData. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmData. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmData. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def assignee(self): + """Gets the assignee of this AlarmData. # noqa: E501 + + + :return: The assignee of this AlarmData. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmData. + + + :param assignee: The assignee of this AlarmData. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def status(self): + """Gets the status of this AlarmData. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmData. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmData. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmData. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data_page_link.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data_page_link.py new file mode 100644 index 0000000..a43e70d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data_page_link.py @@ -0,0 +1,450 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assignee_id': 'UserId', + 'dynamic': 'bool', + 'end_ts': 'int', + 'page': 'int', + 'page_size': 'int', + 'search_propagated_alarms': 'bool', + 'severity_list': 'list[str]', + 'sort_order': 'EntityDataSortOrder', + 'start_ts': 'int', + 'status_list': 'list[str]', + 'text_search': 'str', + 'time_window': 'int', + 'type_list': 'list[str]' + } + + attribute_map = { + 'assignee_id': 'assigneeId', + 'dynamic': 'dynamic', + 'end_ts': 'endTs', + 'page': 'page', + 'page_size': 'pageSize', + 'search_propagated_alarms': 'searchPropagatedAlarms', + 'severity_list': 'severityList', + 'sort_order': 'sortOrder', + 'start_ts': 'startTs', + 'status_list': 'statusList', + 'text_search': 'textSearch', + 'time_window': 'timeWindow', + 'type_list': 'typeList' + } + + def __init__(self, assignee_id=None, dynamic=None, end_ts=None, page=None, page_size=None, search_propagated_alarms=None, severity_list=None, sort_order=None, start_ts=None, status_list=None, text_search=None, time_window=None, type_list=None): # noqa: E501 + """AlarmDataPageLink - a model defined in Swagger""" # noqa: E501 + self._assignee_id = None + self._dynamic = None + self._end_ts = None + self._page = None + self._page_size = None + self._search_propagated_alarms = None + self._severity_list = None + self._sort_order = None + self._start_ts = None + self._status_list = None + self._text_search = None + self._time_window = None + self._type_list = None + self.discriminator = None + if assignee_id is not None: + self.assignee_id = assignee_id + if dynamic is not None: + self.dynamic = dynamic + if end_ts is not None: + self.end_ts = end_ts + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if search_propagated_alarms is not None: + self.search_propagated_alarms = search_propagated_alarms + if severity_list is not None: + self.severity_list = severity_list + if sort_order is not None: + self.sort_order = sort_order + if start_ts is not None: + self.start_ts = start_ts + if status_list is not None: + self.status_list = status_list + if text_search is not None: + self.text_search = text_search + if time_window is not None: + self.time_window = time_window + if type_list is not None: + self.type_list = type_list + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmDataPageLink. # noqa: E501 + + + :return: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmDataPageLink. + + + :param assignee_id: The assignee_id of this AlarmDataPageLink. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def dynamic(self): + """Gets the dynamic of this AlarmDataPageLink. # noqa: E501 + + + :return: The dynamic of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this AlarmDataPageLink. + + + :param dynamic: The dynamic of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def end_ts(self): + """Gets the end_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The end_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmDataPageLink. + + + :param end_ts: The end_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def page(self): + """Gets the page of this AlarmDataPageLink. # noqa: E501 + + + :return: The page of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this AlarmDataPageLink. + + + :param page: The page of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this AlarmDataPageLink. # noqa: E501 + + + :return: The page_size of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this AlarmDataPageLink. + + + :param page_size: The page_size of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def search_propagated_alarms(self): + """Gets the search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + + + :return: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._search_propagated_alarms + + @search_propagated_alarms.setter + def search_propagated_alarms(self, search_propagated_alarms): + """Sets the search_propagated_alarms of this AlarmDataPageLink. + + + :param search_propagated_alarms: The search_propagated_alarms of this AlarmDataPageLink. # noqa: E501 + :type: bool + """ + + self._search_propagated_alarms = search_propagated_alarms + + @property + def severity_list(self): + """Gets the severity_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The severity_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._severity_list + + @severity_list.setter + def severity_list(self, severity_list): + """Sets the severity_list of this AlarmDataPageLink. + + + :param severity_list: The severity_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(severity_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(severity_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._severity_list = severity_list + + @property + def sort_order(self): + """Gets the sort_order of this AlarmDataPageLink. # noqa: E501 + + + :return: The sort_order of this AlarmDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this AlarmDataPageLink. + + + :param sort_order: The sort_order of this AlarmDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def start_ts(self): + """Gets the start_ts of this AlarmDataPageLink. # noqa: E501 + + + :return: The start_ts of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmDataPageLink. + + + :param start_ts: The start_ts of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def status_list(self): + """Gets the status_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The status_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._status_list + + @status_list.setter + def status_list(self, status_list): + """Sets the status_list of this AlarmDataPageLink. + + + :param status_list: The status_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(status_list).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `status_list` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(status_list) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._status_list = status_list + + @property + def text_search(self): + """Gets the text_search of this AlarmDataPageLink. # noqa: E501 + + + :return: The text_search of this AlarmDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this AlarmDataPageLink. + + + :param text_search: The text_search of this AlarmDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + @property + def time_window(self): + """Gets the time_window of this AlarmDataPageLink. # noqa: E501 + + + :return: The time_window of this AlarmDataPageLink. # noqa: E501 + :rtype: int + """ + return self._time_window + + @time_window.setter + def time_window(self, time_window): + """Sets the time_window of this AlarmDataPageLink. + + + :param time_window: The time_window of this AlarmDataPageLink. # noqa: E501 + :type: int + """ + + self._time_window = time_window + + @property + def type_list(self): + """Gets the type_list of this AlarmDataPageLink. # noqa: E501 + + + :return: The type_list of this AlarmDataPageLink. # noqa: E501 + :rtype: list[str] + """ + return self._type_list + + @type_list.setter + def type_list(self, type_list): + """Sets the type_list of this AlarmDataPageLink. + + + :param type_list: The type_list of this AlarmDataPageLink. # noqa: E501 + :type: list[str] + """ + + self._type_list = type_list + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data_query.py new file mode 100644 index 0000000..dcbb9ea --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_data_query.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_fields': 'list[EntityKey]', + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'AlarmDataPageLink' + } + + attribute_map = { + 'alarm_fields': 'alarmFields', + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, alarm_fields=None, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """AlarmDataQuery - a model defined in Swagger""" # noqa: E501 + self._alarm_fields = None + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if alarm_fields is not None: + self.alarm_fields = alarm_fields + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def alarm_fields(self): + """Gets the alarm_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._alarm_fields + + @alarm_fields.setter + def alarm_fields(self, alarm_fields): + """Sets the alarm_fields of this AlarmDataQuery. + + + :param alarm_fields: The alarm_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._alarm_fields = alarm_fields + + @property + def entity_fields(self): + """Gets the entity_fields of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_fields of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this AlarmDataQuery. + + + :param entity_fields: The entity_fields of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this AlarmDataQuery. # noqa: E501 + + + :return: The entity_filter of this AlarmDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this AlarmDataQuery. + + + :param entity_filter: The entity_filter of this AlarmDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this AlarmDataQuery. # noqa: E501 + + + :return: The key_filters of this AlarmDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this AlarmDataQuery. + + + :param key_filters: The key_filters of this AlarmDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this AlarmDataQuery. # noqa: E501 + + + :return: The latest_values of this AlarmDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this AlarmDataQuery. + + + :param latest_values: The latest_values of this AlarmDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this AlarmDataQuery. # noqa: E501 + + + :return: The page_link of this AlarmDataQuery. # noqa: E501 + :rtype: AlarmDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this AlarmDataQuery. + + + :param page_link: The page_link of this AlarmDataQuery. # noqa: E501 + :type: AlarmDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_id.py new file mode 100644 index 0000000..1c22b08 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AlarmId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AlarmId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AlarmId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AlarmId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AlarmId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AlarmId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AlarmId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_info.py new file mode 100644 index 0000000..dc17bd1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_info.py @@ -0,0 +1,831 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AlarmId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'originator': 'EntityId', + 'severity': 'str', + 'acknowledged': 'bool', + 'cleared': 'bool', + 'assignee_id': 'UserId', + 'start_ts': 'int', + 'end_ts': 'int', + 'ack_ts': 'int', + 'clear_ts': 'int', + 'assign_ts': 'int', + 'details': 'JsonNode', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]', + 'propagate_to_owner': 'bool', + 'originator_name': 'str', + 'originator_label': 'str', + 'assignee': 'AlarmAssignee', + 'status': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'originator': 'originator', + 'severity': 'severity', + 'acknowledged': 'acknowledged', + 'cleared': 'cleared', + 'assignee_id': 'assigneeId', + 'start_ts': 'startTs', + 'end_ts': 'endTs', + 'ack_ts': 'ackTs', + 'clear_ts': 'clearTs', + 'assign_ts': 'assignTs', + 'details': 'details', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate': 'propagate', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes', + 'propagate_to_owner': 'propagateToOwner', + 'originator_name': 'originatorName', + 'originator_label': 'originatorLabel', + 'assignee': 'assignee', + 'status': 'status' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, originator=None, severity=None, acknowledged=None, cleared=None, assignee_id=None, start_ts=None, end_ts=None, ack_ts=None, clear_ts=None, assign_ts=None, details=None, propagate_to_owner_hierarchy=None, propagate=None, propagate_to_tenant=None, propagate_relation_types=None, propagate_to_owner=None, originator_name=None, originator_label=None, assignee=None, status=None): # noqa: E501 + """AlarmInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._originator = None + self._severity = None + self._acknowledged = None + self._cleared = None + self._assignee_id = None + self._start_ts = None + self._end_ts = None + self._ack_ts = None + self._clear_ts = None + self._assign_ts = None + self._details = None + self._propagate_to_owner_hierarchy = None + self._propagate = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self._propagate_to_owner = None + self._originator_name = None + self._originator_label = None + self._assignee = None + self._status = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.originator = originator + self.severity = severity + self.acknowledged = acknowledged + self.cleared = cleared + if assignee_id is not None: + self.assignee_id = assignee_id + if start_ts is not None: + self.start_ts = start_ts + if end_ts is not None: + self.end_ts = end_ts + if ack_ts is not None: + self.ack_ts = ack_ts + if clear_ts is not None: + self.clear_ts = clear_ts + if assign_ts is not None: + self.assign_ts = assign_ts + if details is not None: + self.details = details + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate is not None: + self.propagate = propagate + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if originator_name is not None: + self.originator_name = originator_name + if originator_label is not None: + self.originator_label = originator_label + if assignee is not None: + self.assignee = assignee + self.status = status + + @property + def id(self): + """Gets the id of this AlarmInfo. # noqa: E501 + + + :return: The id of this AlarmInfo. # noqa: E501 + :rtype: AlarmId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AlarmInfo. + + + :param id: The id of this AlarmInfo. # noqa: E501 + :type: AlarmId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :return: The created_time of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AlarmInfo. + + Timestamp of the alarm creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AlarmInfo. # noqa: E501 + + + :return: The tenant_id of this AlarmInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AlarmInfo. + + + :param tenant_id: The tenant_id of this AlarmInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AlarmInfo. # noqa: E501 + + + :return: The customer_id of this AlarmInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AlarmInfo. + + + :param customer_id: The customer_id of this AlarmInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param name: The name of this AlarmInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AlarmInfo. # noqa: E501 + + representing type of the Alarm # noqa: E501 + + :return: The type of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmInfo. + + representing type of the Alarm # noqa: E501 + + :param type: The type of this AlarmInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def originator(self): + """Gets the originator of this AlarmInfo. # noqa: E501 + + + :return: The originator of this AlarmInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this AlarmInfo. + + + :param originator: The originator of this AlarmInfo. # noqa: E501 + :type: EntityId + """ + if originator is None: + raise ValueError("Invalid value for `originator`, must not be `None`") # noqa: E501 + + self._originator = originator + + @property + def severity(self): + """Gets the severity of this AlarmInfo. # noqa: E501 + + Alarm severity # noqa: E501 + + :return: The severity of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._severity + + @severity.setter + def severity(self, severity): + """Sets the severity of this AlarmInfo. + + Alarm severity # noqa: E501 + + :param severity: The severity of this AlarmInfo. # noqa: E501 + :type: str + """ + if severity is None: + raise ValueError("Invalid value for `severity`, must not be `None`") # noqa: E501 + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if severity not in allowed_values: + raise ValueError( + "Invalid value for `severity` ({0}), must be one of {1}" # noqa: E501 + .format(severity, allowed_values) + ) + + self._severity = severity + + @property + def acknowledged(self): + """Gets the acknowledged of this AlarmInfo. # noqa: E501 + + Acknowledged # noqa: E501 + + :return: The acknowledged of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._acknowledged + + @acknowledged.setter + def acknowledged(self, acknowledged): + """Sets the acknowledged of this AlarmInfo. + + Acknowledged # noqa: E501 + + :param acknowledged: The acknowledged of this AlarmInfo. # noqa: E501 + :type: bool + """ + if acknowledged is None: + raise ValueError("Invalid value for `acknowledged`, must not be `None`") # noqa: E501 + + self._acknowledged = acknowledged + + @property + def cleared(self): + """Gets the cleared of this AlarmInfo. # noqa: E501 + + Cleared # noqa: E501 + + :return: The cleared of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._cleared + + @cleared.setter + def cleared(self, cleared): + """Sets the cleared of this AlarmInfo. + + Cleared # noqa: E501 + + :param cleared: The cleared of this AlarmInfo. # noqa: E501 + :type: bool + """ + if cleared is None: + raise ValueError("Invalid value for `cleared`, must not be `None`") # noqa: E501 + + self._cleared = cleared + + @property + def assignee_id(self): + """Gets the assignee_id of this AlarmInfo. # noqa: E501 + + + :return: The assignee_id of this AlarmInfo. # noqa: E501 + :rtype: UserId + """ + return self._assignee_id + + @assignee_id.setter + def assignee_id(self, assignee_id): + """Sets the assignee_id of this AlarmInfo. + + + :param assignee_id: The assignee_id of this AlarmInfo. # noqa: E501 + :type: UserId + """ + + self._assignee_id = assignee_id + + @property + def start_ts(self): + """Gets the start_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :return: The start_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._start_ts + + @start_ts.setter + def start_ts(self, start_ts): + """Sets the start_ts of this AlarmInfo. + + Timestamp of the alarm start time, in milliseconds # noqa: E501 + + :param start_ts: The start_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._start_ts = start_ts + + @property + def end_ts(self): + """Gets the end_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :return: The end_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._end_ts + + @end_ts.setter + def end_ts(self, end_ts): + """Sets the end_ts of this AlarmInfo. + + Timestamp of the alarm end time(last time update), in milliseconds # noqa: E501 + + :param end_ts: The end_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._end_ts = end_ts + + @property + def ack_ts(self): + """Gets the ack_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :return: The ack_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._ack_ts + + @ack_ts.setter + def ack_ts(self, ack_ts): + """Sets the ack_ts of this AlarmInfo. + + Timestamp of the alarm acknowledgement, in milliseconds # noqa: E501 + + :param ack_ts: The ack_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._ack_ts = ack_ts + + @property + def clear_ts(self): + """Gets the clear_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :return: The clear_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._clear_ts + + @clear_ts.setter + def clear_ts(self, clear_ts): + """Sets the clear_ts of this AlarmInfo. + + Timestamp of the alarm clearing, in milliseconds # noqa: E501 + + :param clear_ts: The clear_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._clear_ts = clear_ts + + @property + def assign_ts(self): + """Gets the assign_ts of this AlarmInfo. # noqa: E501 + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :return: The assign_ts of this AlarmInfo. # noqa: E501 + :rtype: int + """ + return self._assign_ts + + @assign_ts.setter + def assign_ts(self, assign_ts): + """Sets the assign_ts of this AlarmInfo. + + Timestamp of the alarm assignment, in milliseconds # noqa: E501 + + :param assign_ts: The assign_ts of this AlarmInfo. # noqa: E501 + :type: int + """ + + self._assign_ts = assign_ts + + @property + def details(self): + """Gets the details of this AlarmInfo. # noqa: E501 + + + :return: The details of this AlarmInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this AlarmInfo. + + + :param details: The details of this AlarmInfo. # noqa: E501 + :type: JsonNode + """ + + self._details = details + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate(self): + """Gets the propagate of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this AlarmInfo. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this AlarmInfo. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this AlarmInfo. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this AlarmInfo. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this AlarmInfo. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this AlarmInfo. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def originator_name(self): + """Gets the originator_name of this AlarmInfo. # noqa: E501 + + Alarm originator name # noqa: E501 + + :return: The originator_name of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_name + + @originator_name.setter + def originator_name(self, originator_name): + """Sets the originator_name of this AlarmInfo. + + Alarm originator name # noqa: E501 + + :param originator_name: The originator_name of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_name = originator_name + + @property + def originator_label(self): + """Gets the originator_label of this AlarmInfo. # noqa: E501 + + Alarm originator label # noqa: E501 + + :return: The originator_label of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._originator_label + + @originator_label.setter + def originator_label(self, originator_label): + """Sets the originator_label of this AlarmInfo. + + Alarm originator label # noqa: E501 + + :param originator_label: The originator_label of this AlarmInfo. # noqa: E501 + :type: str + """ + + self._originator_label = originator_label + + @property + def assignee(self): + """Gets the assignee of this AlarmInfo. # noqa: E501 + + + :return: The assignee of this AlarmInfo. # noqa: E501 + :rtype: AlarmAssignee + """ + return self._assignee + + @assignee.setter + def assignee(self, assignee): + """Sets the assignee of this AlarmInfo. + + + :param assignee: The assignee of this AlarmInfo. # noqa: E501 + :type: AlarmAssignee + """ + + self._assignee = assignee + + @property + def status(self): + """Gets the status of this AlarmInfo. # noqa: E501 + + status of the Alarm # noqa: E501 + + :return: The status of this AlarmInfo. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this AlarmInfo. + + status of the Alarm # noqa: E501 + + :param status: The status of this AlarmInfo. # noqa: E501 + :type: str + """ + if status is None: + raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 + allowed_values = ["ACTIVE_ACK", "ACTIVE_UNACK", "CLEARED_ACK", "CLEARED_UNACK"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_notification_rule_trigger_config.py new file mode 100644 index 0000000..59539a5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_notification_rule_trigger_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class AlarmNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_severities': 'list[str]', + 'alarm_types': 'list[str]', + 'clear_rule': 'ClearRule', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'alarm_severities': 'alarmSeverities', + 'alarm_types': 'alarmTypes', + 'clear_rule': 'clearRule', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, alarm_severities=None, alarm_types=None, clear_rule=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """AlarmNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._alarm_severities = None + self._alarm_types = None + self._clear_rule = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if alarm_severities is not None: + self.alarm_severities = alarm_severities + if alarm_types is not None: + self.alarm_types = alarm_types + if clear_rule is not None: + self.clear_rule = clear_rule + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def alarm_severities(self): + """Gets the alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_severities + + @alarm_severities.setter + def alarm_severities(self, alarm_severities): + """Sets the alarm_severities of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_severities: The alarm_severities of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["CRITICAL", "INDETERMINATE", "MAJOR", "MINOR", "WARNING"] # noqa: E501 + if not set(alarm_severities).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_severities` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_severities) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_severities = alarm_severities + + @property + def alarm_types(self): + """Gets the alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_types + + @alarm_types.setter + def alarm_types(self, alarm_types): + """Sets the alarm_types of this AlarmNotificationRuleTriggerConfig. + + + :param alarm_types: The alarm_types of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._alarm_types = alarm_types + + @property + def clear_rule(self): + """Gets the clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: ClearRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this AlarmNotificationRuleTriggerConfig. + + + :param clear_rule: The clear_rule of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: ClearRule + """ + + self._clear_rule = clear_rule + + @property + def notify_on(self): + """Gets the notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this AlarmNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACKNOWLEDGED", "CLEARED", "CREATED", "SEVERITY_CHANGED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this AlarmNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this AlarmNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_rule.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_rule.py new file mode 100644 index 0000000..1d691ff --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_rule.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'condition': 'AlarmCondition', + 'schedule': 'AlarmSchedule', + 'alarm_details': 'str', + 'dashboard_id': 'DashboardId' + } + + attribute_map = { + 'condition': 'condition', + 'schedule': 'schedule', + 'alarm_details': 'alarmDetails', + 'dashboard_id': 'dashboardId' + } + + def __init__(self, condition=None, schedule=None, alarm_details=None, dashboard_id=None): # noqa: E501 + """AlarmRule - a model defined in Swagger""" # noqa: E501 + self._condition = None + self._schedule = None + self._alarm_details = None + self._dashboard_id = None + self.discriminator = None + if condition is not None: + self.condition = condition + if schedule is not None: + self.schedule = schedule + if alarm_details is not None: + self.alarm_details = alarm_details + if dashboard_id is not None: + self.dashboard_id = dashboard_id + + @property + def condition(self): + """Gets the condition of this AlarmRule. # noqa: E501 + + + :return: The condition of this AlarmRule. # noqa: E501 + :rtype: AlarmCondition + """ + return self._condition + + @condition.setter + def condition(self, condition): + """Sets the condition of this AlarmRule. + + + :param condition: The condition of this AlarmRule. # noqa: E501 + :type: AlarmCondition + """ + + self._condition = condition + + @property + def schedule(self): + """Gets the schedule of this AlarmRule. # noqa: E501 + + + :return: The schedule of this AlarmRule. # noqa: E501 + :rtype: AlarmSchedule + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this AlarmRule. + + + :param schedule: The schedule of this AlarmRule. # noqa: E501 + :type: AlarmSchedule + """ + + self._schedule = schedule + + @property + def alarm_details(self): + """Gets the alarm_details of this AlarmRule. # noqa: E501 + + String value representing the additional details for an alarm rule # noqa: E501 + + :return: The alarm_details of this AlarmRule. # noqa: E501 + :rtype: str + """ + return self._alarm_details + + @alarm_details.setter + def alarm_details(self, alarm_details): + """Sets the alarm_details of this AlarmRule. + + String value representing the additional details for an alarm rule # noqa: E501 + + :param alarm_details: The alarm_details of this AlarmRule. # noqa: E501 + :type: str + """ + + self._alarm_details = alarm_details + + @property + def dashboard_id(self): + """Gets the dashboard_id of this AlarmRule. # noqa: E501 + + + :return: The dashboard_id of this AlarmRule. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this AlarmRule. + + + :param dashboard_id: The dashboard_id of this AlarmRule. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_schedule.py new file mode 100644 index 0000000..ab3b844 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/alarm_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AlarmSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AlarmSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AlarmSchedule. # noqa: E501 + + + :return: The dynamic_value of this AlarmSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AlarmSchedule. + + + :param dynamic_value: The dynamic_value of this AlarmSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AlarmSchedule. # noqa: E501 + + + :return: The type of this AlarmSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AlarmSchedule. + + + :param type: The type of this AlarmSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AlarmSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AlarmSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/all_users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/all_users_filter.py new file mode 100644 index 0000000..53023e6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/all_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """AllUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/allow_create_new_devices_device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/allow_create_new_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..831cd5c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/allow_create_new_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllowCreateNewDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """AllowCreateNewDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this AllowCreateNewDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllowCreateNewDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllowCreateNewDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/allowed_permissions_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/allowed_permissions_info.py new file mode 100644 index 0000000..d23046f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/allowed_permissions_info.py @@ -0,0 +1,318 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AllowedPermissionsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'user_owner_id': 'EntityId', + 'user_permissions': 'MergedUserPermissions', + 'allowed_resources': 'list[str]', + 'operations_by_resource': 'dict(str, list[str])', + 'allowed_for_group_role_operations': 'list[str]', + 'allowed_for_group_owner_only_operations': 'list[str]', + 'allowed_for_group_owner_only_group_operations': 'list[str]' + } + + attribute_map = { + 'user_owner_id': 'userOwnerId', + 'user_permissions': 'userPermissions', + 'allowed_resources': 'allowedResources', + 'operations_by_resource': 'operationsByResource', + 'allowed_for_group_role_operations': 'allowedForGroupRoleOperations', + 'allowed_for_group_owner_only_operations': 'allowedForGroupOwnerOnlyOperations', + 'allowed_for_group_owner_only_group_operations': 'allowedForGroupOwnerOnlyGroupOperations' + } + + def __init__(self, user_owner_id=None, user_permissions=None, allowed_resources=None, operations_by_resource=None, allowed_for_group_role_operations=None, allowed_for_group_owner_only_operations=None, allowed_for_group_owner_only_group_operations=None): # noqa: E501 + """AllowedPermissionsInfo - a model defined in Swagger""" # noqa: E501 + self._user_owner_id = None + self._user_permissions = None + self._allowed_resources = None + self._operations_by_resource = None + self._allowed_for_group_role_operations = None + self._allowed_for_group_owner_only_operations = None + self._allowed_for_group_owner_only_group_operations = None + self.discriminator = None + if user_owner_id is not None: + self.user_owner_id = user_owner_id + if user_permissions is not None: + self.user_permissions = user_permissions + if allowed_resources is not None: + self.allowed_resources = allowed_resources + if operations_by_resource is not None: + self.operations_by_resource = operations_by_resource + if allowed_for_group_role_operations is not None: + self.allowed_for_group_role_operations = allowed_for_group_role_operations + if allowed_for_group_owner_only_operations is not None: + self.allowed_for_group_owner_only_operations = allowed_for_group_owner_only_operations + if allowed_for_group_owner_only_group_operations is not None: + self.allowed_for_group_owner_only_group_operations = allowed_for_group_owner_only_group_operations + + @property + def user_owner_id(self): + """Gets the user_owner_id of this AllowedPermissionsInfo. # noqa: E501 + + + :return: The user_owner_id of this AllowedPermissionsInfo. # noqa: E501 + :rtype: EntityId + """ + return self._user_owner_id + + @user_owner_id.setter + def user_owner_id(self, user_owner_id): + """Sets the user_owner_id of this AllowedPermissionsInfo. + + + :param user_owner_id: The user_owner_id of this AllowedPermissionsInfo. # noqa: E501 + :type: EntityId + """ + + self._user_owner_id = user_owner_id + + @property + def user_permissions(self): + """Gets the user_permissions of this AllowedPermissionsInfo. # noqa: E501 + + + :return: The user_permissions of this AllowedPermissionsInfo. # noqa: E501 + :rtype: MergedUserPermissions + """ + return self._user_permissions + + @user_permissions.setter + def user_permissions(self, user_permissions): + """Sets the user_permissions of this AllowedPermissionsInfo. + + + :param user_permissions: The user_permissions of this AllowedPermissionsInfo. # noqa: E501 + :type: MergedUserPermissions + """ + + self._user_permissions = user_permissions + + @property + def allowed_resources(self): + """Gets the allowed_resources of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of all possibly allowed resources. Static and depends only on the authority of the user # noqa: E501 + + :return: The allowed_resources of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_resources + + @allowed_resources.setter + def allowed_resources(self, allowed_resources): + """Sets the allowed_resources of this AllowedPermissionsInfo. + + Static set (vocabulary) of all possibly allowed resources. Static and depends only on the authority of the user # noqa: E501 + + :param allowed_resources: The allowed_resources of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["BILLING", "ADMIN_SETTINGS", "ALARM", "ALL", "API_USAGE_STATE", "ASSET", "ASSET_GROUP", "ASSET_PROFILE", "AUDIT_LOG", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "CUSTOMER_GROUP", "DASHBOARD", "DASHBOARD_GROUP", "DEVICE", "DEVICE_GROUP", "DEVICE_PROFILE", "EDGE", "EDGE_GROUP", "ENTITY_VIEW", "ENTITY_VIEW_GROUP", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "OAUTH2_CONFIGURATION_INFO", "OAUTH2_CONFIGURATION_TEMPLATE", "OTA_PACKAGE", "PROFILE", "QUEUE", "ROLE", "RULE_CHAIN", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "USER_GROUP", "VERSION_CONTROL", "WHITE_LABELING", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(allowed_resources).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_resources` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_resources) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_resources = allowed_resources + + @property + def operations_by_resource(self): + """Gets the operations_by_resource of this AllowedPermissionsInfo. # noqa: E501 + + Static map (vocabulary) of allowed operations by resource type # noqa: E501 + + :return: The operations_by_resource of this AllowedPermissionsInfo. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._operations_by_resource + + @operations_by_resource.setter + def operations_by_resource(self, operations_by_resource): + """Sets the operations_by_resource of this AllowedPermissionsInfo. + + Static map (vocabulary) of allowed operations by resource type # noqa: E501 + + :param operations_by_resource: The operations_by_resource of this AllowedPermissionsInfo. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._operations_by_resource = operations_by_resource + + @property + def allowed_for_group_role_operations(self): + """Gets the allowed_for_group_role_operations of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of allowed operations for group roles # noqa: E501 + + :return: The allowed_for_group_role_operations of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_for_group_role_operations + + @allowed_for_group_role_operations.setter + def allowed_for_group_role_operations(self, allowed_for_group_role_operations): + """Sets the allowed_for_group_role_operations of this AllowedPermissionsInfo. + + Static set (vocabulary) of allowed operations for group roles # noqa: E501 + + :param allowed_for_group_role_operations: The allowed_for_group_role_operations of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(allowed_for_group_role_operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_for_group_role_operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_for_group_role_operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_for_group_role_operations = allowed_for_group_role_operations + + @property + def allowed_for_group_owner_only_operations(self): + """Gets the allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of allowed operations for group owner # noqa: E501 + + :return: The allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_for_group_owner_only_operations + + @allowed_for_group_owner_only_operations.setter + def allowed_for_group_owner_only_operations(self, allowed_for_group_owner_only_operations): + """Sets the allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. + + Static set (vocabulary) of allowed operations for group owner # noqa: E501 + + :param allowed_for_group_owner_only_operations: The allowed_for_group_owner_only_operations of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(allowed_for_group_owner_only_operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_for_group_owner_only_operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_for_group_owner_only_operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_for_group_owner_only_operations = allowed_for_group_owner_only_operations + + @property + def allowed_for_group_owner_only_group_operations(self): + """Gets the allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. # noqa: E501 + + Static set (vocabulary) of allowed group operations for group owner # noqa: E501 + + :return: The allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. # noqa: E501 + :rtype: list[str] + """ + return self._allowed_for_group_owner_only_group_operations + + @allowed_for_group_owner_only_group_operations.setter + def allowed_for_group_owner_only_group_operations(self, allowed_for_group_owner_only_group_operations): + """Sets the allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. + + Static set (vocabulary) of allowed group operations for group owner # noqa: E501 + + :param allowed_for_group_owner_only_group_operations: The allowed_for_group_owner_only_group_operations of this AllowedPermissionsInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(allowed_for_group_owner_only_group_operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `allowed_for_group_owner_only_group_operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(allowed_for_group_owner_only_group_operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._allowed_for_group_owner_only_group_operations = allowed_for_group_owner_only_group_operations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AllowedPermissionsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AllowedPermissionsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/any_time_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_pe/any_time_schedule.py new file mode 100644 index 0000000..a765486 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/any_time_schedule.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AnyTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, type=None): # noqa: E501 + """AnyTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this AnyTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this AnyTimeSchedule. + + + :param dynamic_value: The dynamic_value of this AnyTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def type(self): + """Gets the type of this AnyTimeSchedule. # noqa: E501 + + + :return: The type of this AnyTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AnyTimeSchedule. + + + :param type: The type of this AnyTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AnyTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AnyTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/api_usage_limit_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/api_usage_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..63c8cc8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/api_usage_limit_notification_rule_trigger_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class ApiUsageLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'api_features': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'api_features': 'apiFeatures', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, api_features=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """ApiUsageLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._api_features = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if api_features is not None: + self.api_features = api_features + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def api_features(self): + """Gets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._api_features + + @api_features.setter + def api_features(self, api_features): + """Sets the api_features of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param api_features: The api_features of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "DB", "EMAIL", "JS", "RE", "SMS", "TRANSPORT"] # noqa: E501 + if not set(api_features).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `api_features` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(api_features) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._api_features = api_features + + @property + def notify_on(self): + """Gets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["DISABLED", "ENABLED", "WARNING"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this ApiUsageLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/api_usage_state_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/api_usage_state_filter.py new file mode 100644 index 0000000..c581f2b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/api_usage_state_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class ApiUsageStateFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'CustomerId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'customer_id': 'customerId' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, customer_id=None, *args, **kwargs): # noqa: E501 + """ApiUsageStateFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + if customer_id is not None: + self.customer_id = customer_id + EntityFilter.__init__(self, *args, **kwargs) + + @property + def customer_id(self): + """Gets the customer_id of this ApiUsageStateFilter. # noqa: E501 + + + :return: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ApiUsageStateFilter. + + + :param customer_id: The customer_id of this ApiUsageStateFilter. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ApiUsageStateFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ApiUsageStateFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/array_node.py b/tb-rest-client/python/tb_rest_client/models/models_pe/array_node.py new file mode 100644 index 0000000..62ae172 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/array_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ArrayNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """ArrayNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ArrayNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ArrayNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/asset.py b/tb-rest-client/python/tb_rest_client/models/models_pe/asset.py new file mode 100644 index 0000000..121588a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/asset.py @@ -0,0 +1,378 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Asset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, external_id=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None, owner_id=None): # noqa: E501 + """Asset - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self._owner_id = None + self._external_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.external_id = external_id + self.asset_profile_id = asset_profile_id + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this Asset. # noqa: E501 + + + :return: The id of this Asset. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Asset. + + + :param id: The id of this Asset. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Asset. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this Asset. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Asset. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Asset. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Asset. # noqa: E501 + + + :return: The tenant_id of this Asset. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Asset. + + + :param tenant_id: The tenant_id of this Asset. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Asset. # noqa: E501 + + + :return: The customer_id of this Asset. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Asset. + + + :param customer_id: The customer_id of this Asset. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this Asset. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this Asset. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Asset. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this Asset. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Asset. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this Asset. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Asset. + + Asset type # noqa: E501 + + :param type: The type of this Asset. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def label(self): + """Gets the label of this Asset. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Asset. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Asset. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Asset. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this Asset. # noqa: E501 + + + :return: The asset_profile_id of this Asset. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this Asset. + + + :param asset_profile_id: The asset_profile_id of this Asset. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this Asset. # noqa: E501 + + + :return: The additional_info of this Asset. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Asset. + + + :param additional_info: The additional_info of this Asset. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this Asset. # noqa: E501 + + + :return: The owner_id of this Asset. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Asset. + + + :param owner_id: The owner_id of this Asset. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Asset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Asset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/asset_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_id.py new file mode 100644 index 0000000..204014b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/asset_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_info.py new file mode 100644 index 0000000..89c5642 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_info.py @@ -0,0 +1,424 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AssetId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'asset_profile_id': 'AssetProfileId', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'asset_profile_id': 'assetProfileId', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, label=None, asset_profile_id=None, additional_info=None, owner_id=None, owner_name=None, groups=None): # noqa: E501 + """AssetInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._label = None + self._asset_profile_id = None + self._additional_info = None + self._owner_id = None + self._owner_name = None + self._groups = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.label = label + self.asset_profile_id = asset_profile_id + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this AssetInfo. # noqa: E501 + + + :return: The id of this AssetInfo. # noqa: E501 + :rtype: AssetId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetInfo. + + + :param id: The id of this AssetInfo. # noqa: E501 + :type: AssetId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AssetInfo. # noqa: E501 + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :return: The created_time of this AssetInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AssetInfo. + + Timestamp of the asset creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AssetInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AssetInfo. # noqa: E501 + + + :return: The tenant_id of this AssetInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AssetInfo. + + + :param tenant_id: The tenant_id of this AssetInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AssetInfo. # noqa: E501 + + + :return: The customer_id of this AssetInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AssetInfo. + + + :param customer_id: The customer_id of this AssetInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this AssetInfo. # noqa: E501 + + Unique Asset Name in scope of Tenant # noqa: E501 + + :return: The name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this AssetInfo. + + Unique Asset Name in scope of Tenant # noqa: E501 + + :param name: The name of this AssetInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this AssetInfo. # noqa: E501 + + Asset type # noqa: E501 + + :return: The type of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this AssetInfo. + + Asset type # noqa: E501 + + :param type: The type of this AssetInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this AssetInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this AssetInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this AssetInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def asset_profile_id(self): + """Gets the asset_profile_id of this AssetInfo. # noqa: E501 + + + :return: The asset_profile_id of this AssetInfo. # noqa: E501 + :rtype: AssetProfileId + """ + return self._asset_profile_id + + @asset_profile_id.setter + def asset_profile_id(self, asset_profile_id): + """Sets the asset_profile_id of this AssetInfo. + + + :param asset_profile_id: The asset_profile_id of this AssetInfo. # noqa: E501 + :type: AssetProfileId + """ + if asset_profile_id is None: + raise ValueError("Invalid value for `asset_profile_id`, must not be `None`") # noqa: E501 + + self._asset_profile_id = asset_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this AssetInfo. # noqa: E501 + + + :return: The additional_info of this AssetInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this AssetInfo. + + + :param additional_info: The additional_info of this AssetInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this AssetInfo. # noqa: E501 + + + :return: The owner_id of this AssetInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this AssetInfo. + + + :param owner_id: The owner_id of this AssetInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def owner_name(self): + """Gets the owner_name of this AssetInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this AssetInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this AssetInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this AssetInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this AssetInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this AssetInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this AssetInfo. + + Groups # noqa: E501 + + :param groups: The groups of this AssetInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/asset_profile_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_profile_id.py new file mode 100644 index 0000000..750fe18 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """AssetProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this AssetProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AssetProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this AssetProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/asset_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_search_query.py new file mode 100644 index 0000000..14a115c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AssetSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'asset_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'asset_types': 'assetTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, asset_types=None, parameters=None): # noqa: E501 + """AssetSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._asset_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if asset_types is not None: + self.asset_types = asset_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQuery. # noqa: E501 + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this AssetSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQuery. + + Type of the relation between root entity and asset (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this AssetSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQuery. # noqa: E501 + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :return: The asset_types of this AssetSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQuery. + + Array of asset types to filter the related entities (e.g. 'Building', 'Vehicle'). # noqa: E501 + + :param asset_types: The asset_types of this AssetSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def parameters(self): + """Gets the parameters of this AssetSearchQuery. # noqa: E501 + + + :return: The parameters of this AssetSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this AssetSearchQuery. + + + :param parameters: The parameters of this AssetSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/asset_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_search_query_filter.py new file mode 100644 index 0000000..53e3b77 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_types': 'assetTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """AssetSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._asset_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if asset_types is not None: + self.asset_types = asset_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_types(self): + """Gets the asset_types of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetSearchQueryFilter. + + + :param asset_types: The asset_types of this AssetSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + @property + def direction(self): + """Gets the direction of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The direction of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this AssetSearchQueryFilter. + + + :param direction: The direction of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this AssetSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this AssetSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this AssetSearchQueryFilter. + + + :param max_level: The max_level of this AssetSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this AssetSearchQueryFilter. + + + :param relation_type: The relation_type of this AssetSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this AssetSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this AssetSearchQueryFilter. + + + :param root_entity: The root_entity of this AssetSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/asset_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_type_filter.py new file mode 100644 index 0000000..57e764f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/asset_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class AssetTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'asset_name_filter': 'str', + 'asset_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'asset_name_filter': 'assetNameFilter', + 'asset_types': 'assetTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, asset_name_filter=None, asset_types=None, *args, **kwargs): # noqa: E501 + """AssetTypeFilter - a model defined in Swagger""" # noqa: E501 + self._asset_name_filter = None + self._asset_types = None + self.discriminator = None + if asset_name_filter is not None: + self.asset_name_filter = asset_name_filter + if asset_types is not None: + self.asset_types = asset_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def asset_name_filter(self): + """Gets the asset_name_filter of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :rtype: str + """ + return self._asset_name_filter + + @asset_name_filter.setter + def asset_name_filter(self, asset_name_filter): + """Sets the asset_name_filter of this AssetTypeFilter. + + + :param asset_name_filter: The asset_name_filter of this AssetTypeFilter. # noqa: E501 + :type: str + """ + + self._asset_name_filter = asset_name_filter + + @property + def asset_types(self): + """Gets the asset_types of this AssetTypeFilter. # noqa: E501 + + + :return: The asset_types of this AssetTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._asset_types + + @asset_types.setter + def asset_types(self, asset_types): + """Sets the asset_types of this AssetTypeFilter. + + + :param asset_types: The asset_types of this AssetTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._asset_types = asset_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AssetTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AssetTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/atomic_integer.py b/tb-rest-client/python/tb_rest_client/models/models_pe/atomic_integer.py new file mode 100644 index 0000000..4958429 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/atomic_integer.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AtomicInteger(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'acquire': 'int', + 'and_decrement': 'int', + 'and_increment': 'int', + 'opaque': 'int', + 'plain': 'int' + } + + attribute_map = { + 'acquire': 'acquire', + 'and_decrement': 'andDecrement', + 'and_increment': 'andIncrement', + 'opaque': 'opaque', + 'plain': 'plain' + } + + def __init__(self, acquire=None, and_decrement=None, and_increment=None, opaque=None, plain=None): # noqa: E501 + """AtomicInteger - a model defined in Swagger""" # noqa: E501 + self._acquire = None + self._and_decrement = None + self._and_increment = None + self._opaque = None + self._plain = None + self.discriminator = None + if acquire is not None: + self.acquire = acquire + if and_decrement is not None: + self.and_decrement = and_decrement + if and_increment is not None: + self.and_increment = and_increment + if opaque is not None: + self.opaque = opaque + if plain is not None: + self.plain = plain + + @property + def acquire(self): + """Gets the acquire of this AtomicInteger. # noqa: E501 + + + :return: The acquire of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._acquire + + @acquire.setter + def acquire(self, acquire): + """Sets the acquire of this AtomicInteger. + + + :param acquire: The acquire of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._acquire = acquire + + @property + def and_decrement(self): + """Gets the and_decrement of this AtomicInteger. # noqa: E501 + + + :return: The and_decrement of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_decrement + + @and_decrement.setter + def and_decrement(self, and_decrement): + """Sets the and_decrement of this AtomicInteger. + + + :param and_decrement: The and_decrement of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_decrement = and_decrement + + @property + def and_increment(self): + """Gets the and_increment of this AtomicInteger. # noqa: E501 + + + :return: The and_increment of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._and_increment + + @and_increment.setter + def and_increment(self, and_increment): + """Sets the and_increment of this AtomicInteger. + + + :param and_increment: The and_increment of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._and_increment = and_increment + + @property + def opaque(self): + """Gets the opaque of this AtomicInteger. # noqa: E501 + + + :return: The opaque of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._opaque + + @opaque.setter + def opaque(self, opaque): + """Sets the opaque of this AtomicInteger. + + + :param opaque: The opaque of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._opaque = opaque + + @property + def plain(self): + """Gets the plain of this AtomicInteger. # noqa: E501 + + + :return: The plain of this AtomicInteger. # noqa: E501 + :rtype: int + """ + return self._plain + + @plain.setter + def plain(self, plain): + """Sets the plain of this AtomicInteger. + + + :param plain: The plain of this AtomicInteger. # noqa: E501 + :type: int + """ + + self._plain = plain + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AtomicInteger, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AtomicInteger): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/attribute_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/attribute_export_data.py new file mode 100644 index 0000000..d780c50 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/attribute_export_data.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributeExportData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'boolean_value': 'bool', + 'double_value': 'float', + 'json_value': 'str', + 'key': 'str', + 'last_update_ts': 'int', + 'long_value': 'int', + 'str_value': 'str' + } + + attribute_map = { + 'boolean_value': 'booleanValue', + 'double_value': 'doubleValue', + 'json_value': 'jsonValue', + 'key': 'key', + 'last_update_ts': 'lastUpdateTs', + 'long_value': 'longValue', + 'str_value': 'strValue' + } + + def __init__(self, boolean_value=None, double_value=None, json_value=None, key=None, last_update_ts=None, long_value=None, str_value=None): # noqa: E501 + """AttributeExportData - a model defined in Swagger""" # noqa: E501 + self._boolean_value = None + self._double_value = None + self._json_value = None + self._key = None + self._last_update_ts = None + self._long_value = None + self._str_value = None + self.discriminator = None + if boolean_value is not None: + self.boolean_value = boolean_value + if double_value is not None: + self.double_value = double_value + if json_value is not None: + self.json_value = json_value + if key is not None: + self.key = key + if last_update_ts is not None: + self.last_update_ts = last_update_ts + if long_value is not None: + self.long_value = long_value + if str_value is not None: + self.str_value = str_value + + @property + def boolean_value(self): + """Gets the boolean_value of this AttributeExportData. # noqa: E501 + + + :return: The boolean_value of this AttributeExportData. # noqa: E501 + :rtype: bool + """ + return self._boolean_value + + @boolean_value.setter + def boolean_value(self, boolean_value): + """Sets the boolean_value of this AttributeExportData. + + + :param boolean_value: The boolean_value of this AttributeExportData. # noqa: E501 + :type: bool + """ + + self._boolean_value = boolean_value + + @property + def double_value(self): + """Gets the double_value of this AttributeExportData. # noqa: E501 + + + :return: The double_value of this AttributeExportData. # noqa: E501 + :rtype: float + """ + return self._double_value + + @double_value.setter + def double_value(self, double_value): + """Sets the double_value of this AttributeExportData. + + + :param double_value: The double_value of this AttributeExportData. # noqa: E501 + :type: float + """ + + self._double_value = double_value + + @property + def json_value(self): + """Gets the json_value of this AttributeExportData. # noqa: E501 + + + :return: The json_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._json_value + + @json_value.setter + def json_value(self, json_value): + """Sets the json_value of this AttributeExportData. + + + :param json_value: The json_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._json_value = json_value + + @property + def key(self): + """Gets the key of this AttributeExportData. # noqa: E501 + + + :return: The key of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this AttributeExportData. + + + :param key: The key of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def last_update_ts(self): + """Gets the last_update_ts of this AttributeExportData. # noqa: E501 + + + :return: The last_update_ts of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._last_update_ts + + @last_update_ts.setter + def last_update_ts(self, last_update_ts): + """Sets the last_update_ts of this AttributeExportData. + + + :param last_update_ts: The last_update_ts of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._last_update_ts = last_update_ts + + @property + def long_value(self): + """Gets the long_value of this AttributeExportData. # noqa: E501 + + + :return: The long_value of this AttributeExportData. # noqa: E501 + :rtype: int + """ + return self._long_value + + @long_value.setter + def long_value(self, long_value): + """Sets the long_value of this AttributeExportData. + + + :param long_value: The long_value of this AttributeExportData. # noqa: E501 + :type: int + """ + + self._long_value = long_value + + @property + def str_value(self): + """Gets the str_value of this AttributeExportData. # noqa: E501 + + + :return: The str_value of this AttributeExportData. # noqa: E501 + :rtype: str + """ + return self._str_value + + @str_value.setter + def str_value(self, str_value): + """Sets the str_value of this AttributeExportData. + + + :param str_value: The str_value of this AttributeExportData. # noqa: E501 + :type: str + """ + + self._str_value = str_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributeExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributeExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/attributes_entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_pe/attributes_entity_view.py new file mode 100644 index 0000000..f194c83 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/attributes_entity_view.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AttributesEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'cs': 'list[str]', + 'sh': 'list[str]', + 'ss': 'list[str]' + } + + attribute_map = { + 'cs': 'cs', + 'sh': 'sh', + 'ss': 'ss' + } + + def __init__(self, cs=None, sh=None, ss=None): # noqa: E501 + """AttributesEntityView - a model defined in Swagger""" # noqa: E501 + self._cs = None + self._sh = None + self._ss = None + self.discriminator = None + self.cs = cs + self.sh = sh + self.ss = ss + + @property + def cs(self): + """Gets the cs of this AttributesEntityView. # noqa: E501 + + List of client-side attribute keys to expose # noqa: E501 + + :return: The cs of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._cs + + @cs.setter + def cs(self, cs): + """Sets the cs of this AttributesEntityView. + + List of client-side attribute keys to expose # noqa: E501 + + :param cs: The cs of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if cs is None: + raise ValueError("Invalid value for `cs`, must not be `None`") # noqa: E501 + + self._cs = cs + + @property + def sh(self): + """Gets the sh of this AttributesEntityView. # noqa: E501 + + List of shared attribute keys to expose # noqa: E501 + + :return: The sh of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._sh + + @sh.setter + def sh(self, sh): + """Sets the sh of this AttributesEntityView. + + List of shared attribute keys to expose # noqa: E501 + + :param sh: The sh of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if sh is None: + raise ValueError("Invalid value for `sh`, must not be `None`") # noqa: E501 + + self._sh = sh + + @property + def ss(self): + """Gets the ss of this AttributesEntityView. # noqa: E501 + + List of server-side attribute keys to expose # noqa: E501 + + :return: The ss of this AttributesEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._ss + + @ss.setter + def ss(self, ss): + """Sets the ss of this AttributesEntityView. + + List of server-side attribute keys to expose # noqa: E501 + + :param ss: The ss of this AttributesEntityView. # noqa: E501 + :type: list[str] + """ + if ss is None: + raise ValueError("Invalid value for `ss`, must not be `None`") # noqa: E501 + + self._ss = ss + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AttributesEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AttributesEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/audit_log.py b/tb-rest-client/python/tb_rest_client/models/models_pe/audit_log.py new file mode 100644 index 0000000..310da08 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/audit_log.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLog(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'AuditLogId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'entity_id': 'EntityId', + 'entity_name': 'str', + 'user_id': 'UserId', + 'user_name': 'str', + 'action_type': 'str', + 'action_data': 'JsonNode', + 'action_status': 'str', + 'action_failure_details': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'entity_id': 'entityId', + 'entity_name': 'entityName', + 'user_id': 'userId', + 'user_name': 'userName', + 'action_type': 'actionType', + 'action_data': 'actionData', + 'action_status': 'actionStatus', + 'action_failure_details': 'actionFailureDetails' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, entity_id=None, entity_name=None, user_id=None, user_name=None, action_type=None, action_data=None, action_status=None, action_failure_details=None): # noqa: E501 + """AuditLog - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._entity_id = None + self._entity_name = None + self._user_id = None + self._user_name = None + self._action_type = None + self._action_data = None + self._action_status = None + self._action_failure_details = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if entity_id is not None: + self.entity_id = entity_id + if entity_name is not None: + self.entity_name = entity_name + if user_id is not None: + self.user_id = user_id + if user_name is not None: + self.user_name = user_name + if action_type is not None: + self.action_type = action_type + if action_data is not None: + self.action_data = action_data + if action_status is not None: + self.action_status = action_status + if action_failure_details is not None: + self.action_failure_details = action_failure_details + + @property + def id(self): + """Gets the id of this AuditLog. # noqa: E501 + + + :return: The id of this AuditLog. # noqa: E501 + :rtype: AuditLogId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLog. + + + :param id: The id of this AuditLog. # noqa: E501 + :type: AuditLogId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this AuditLog. # noqa: E501 + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :return: The created_time of this AuditLog. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this AuditLog. + + Timestamp of the auditLog creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this AuditLog. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this AuditLog. # noqa: E501 + + + :return: The tenant_id of this AuditLog. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this AuditLog. + + + :param tenant_id: The tenant_id of this AuditLog. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this AuditLog. # noqa: E501 + + + :return: The customer_id of this AuditLog. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this AuditLog. + + + :param customer_id: The customer_id of this AuditLog. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def entity_id(self): + """Gets the entity_id of this AuditLog. # noqa: E501 + + + :return: The entity_id of this AuditLog. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this AuditLog. + + + :param entity_id: The entity_id of this AuditLog. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def entity_name(self): + """Gets the entity_name of this AuditLog. # noqa: E501 + + Name of the logged entity # noqa: E501 + + :return: The entity_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this AuditLog. + + Name of the logged entity # noqa: E501 + + :param entity_name: The entity_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._entity_name = entity_name + + @property + def user_id(self): + """Gets the user_id of this AuditLog. # noqa: E501 + + + :return: The user_id of this AuditLog. # noqa: E501 + :rtype: UserId + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this AuditLog. + + + :param user_id: The user_id of this AuditLog. # noqa: E501 + :type: UserId + """ + + self._user_id = user_id + + @property + def user_name(self): + """Gets the user_name of this AuditLog. # noqa: E501 + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :return: The user_name of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._user_name + + @user_name.setter + def user_name(self, user_name): + """Sets the user_name of this AuditLog. + + Unique user name(email) of the user that performed some action on logged entity # noqa: E501 + + :param user_name: The user_name of this AuditLog. # noqa: E501 + :type: str + """ + + self._user_name = user_name + + @property + def action_type(self): + """Gets the action_type of this AuditLog. # noqa: E501 + + String represented Action type # noqa: E501 + + :return: The action_type of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_type + + @action_type.setter + def action_type(self, action_type): + """Sets the action_type of this AuditLog. + + String represented Action type # noqa: E501 + + :param action_type: The action_type of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["ACTIVATED", "ADDED", "ADDED_COMMENT", "ADDED_TO_ENTITY_GROUP", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_DELETE", "ALARM_UNASSIGNED", "ASSIGNED_FROM_TENANT", "ASSIGNED_TO_CUSTOMER", "ASSIGNED_TO_EDGE", "ASSIGNED_TO_TENANT", "ATTRIBUTES_DELETED", "ATTRIBUTES_READ", "ATTRIBUTES_UPDATED", "CHANGE_OWNER", "CREDENTIALS_READ", "CREDENTIALS_UPDATED", "DELETED", "DELETED_COMMENT", "LOCKOUT", "LOGIN", "LOGOUT", "MADE_PRIVATE", "MADE_PUBLIC", "PROVISION_FAILURE", "PROVISION_SUCCESS", "RELATIONS_DELETED", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "REMOVED_FROM_ENTITY_GROUP", "REST_API_RULE_ENGINE_CALL", "RPC_CALL", "SUSPENDED", "TIMESERIES_DELETED", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_CUSTOMER", "UNASSIGNED_FROM_EDGE", "UPDATED", "UPDATED_COMMENT"] # noqa: E501 + if action_type not in allowed_values: + raise ValueError( + "Invalid value for `action_type` ({0}), must be one of {1}" # noqa: E501 + .format(action_type, allowed_values) + ) + + self._action_type = action_type + + @property + def action_data(self): + """Gets the action_data of this AuditLog. # noqa: E501 + + + :return: The action_data of this AuditLog. # noqa: E501 + :rtype: JsonNode + """ + return self._action_data + + @action_data.setter + def action_data(self, action_data): + """Sets the action_data of this AuditLog. + + + :param action_data: The action_data of this AuditLog. # noqa: E501 + :type: JsonNode + """ + + self._action_data = action_data + + @property + def action_status(self): + """Gets the action_status of this AuditLog. # noqa: E501 + + String represented Action status # noqa: E501 + + :return: The action_status of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_status + + @action_status.setter + def action_status(self, action_status): + """Sets the action_status of this AuditLog. + + String represented Action status # noqa: E501 + + :param action_status: The action_status of this AuditLog. # noqa: E501 + :type: str + """ + allowed_values = ["FAILURE", "SUCCESS"] # noqa: E501 + if action_status not in allowed_values: + raise ValueError( + "Invalid value for `action_status` ({0}), must be one of {1}" # noqa: E501 + .format(action_status, allowed_values) + ) + + self._action_status = action_status + + @property + def action_failure_details(self): + """Gets the action_failure_details of this AuditLog. # noqa: E501 + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :return: The action_failure_details of this AuditLog. # noqa: E501 + :rtype: str + """ + return self._action_failure_details + + @action_failure_details.setter + def action_failure_details(self, action_failure_details): + """Sets the action_failure_details of this AuditLog. + + Failure action details info. An empty string in case of action status type 'SUCCESS', otherwise includes stack trace of the caused exception. # noqa: E501 + + :param action_failure_details: The action_failure_details of this AuditLog. # noqa: E501 + :type: str + """ + + self._action_failure_details = action_failure_details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLog, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLog): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/audit_log_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/audit_log_id.py new file mode 100644 index 0000000..6710051 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/audit_log_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AuditLogId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """AuditLogId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this AuditLogId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this AuditLogId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this AuditLogId. + + string # noqa: E501 + + :param id: The id of this AuditLogId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AuditLogId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AuditLogId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/auto_version_create_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/auto_version_create_config.py new file mode 100644 index 0000000..357583c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/auto_version_create_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class AutoVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_group_entities': 'bool', + 'save_permissions': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'branch': 'branch', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_group_entities': 'saveGroupEntities', + 'save_permissions': 'savePermissions', + 'save_relations': 'saveRelations' + } + + def __init__(self, branch=None, save_attributes=None, save_credentials=None, save_group_entities=None, save_permissions=None, save_relations=None): # noqa: E501 + """AutoVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._save_attributes = None + self._save_credentials = None + self._save_group_entities = None + self._save_permissions = None + self._save_relations = None + self.discriminator = None + if branch is not None: + self.branch = branch + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_group_entities is not None: + self.save_group_entities = save_group_entities + if save_permissions is not None: + self.save_permissions = save_permissions + if save_relations is not None: + self.save_relations = save_relations + + @property + def branch(self): + """Gets the branch of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The branch of this AutoVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this AutoVersionCreateConfig. + + + :param branch: The branch of this AutoVersionCreateConfig. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def save_attributes(self): + """Gets the save_attributes of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this AutoVersionCreateConfig. + + + :param save_attributes: The save_attributes of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this AutoVersionCreateConfig. + + + :param save_credentials: The save_credentials of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_group_entities(self): + """Gets the save_group_entities of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_group_entities of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_group_entities + + @save_group_entities.setter + def save_group_entities(self, save_group_entities): + """Sets the save_group_entities of this AutoVersionCreateConfig. + + + :param save_group_entities: The save_group_entities of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_group_entities = save_group_entities + + @property + def save_permissions(self): + """Gets the save_permissions of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_permissions of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_permissions + + @save_permissions.setter + def save_permissions(self, save_permissions): + """Sets the save_permissions of this AutoVersionCreateConfig. + + + :param save_permissions: The save_permissions of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_permissions = save_permissions + + @property + def save_relations(self): + """Gets the save_relations of this AutoVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this AutoVersionCreateConfig. + + + :param save_relations: The save_relations of this AutoVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AutoVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AutoVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/aws_sns_sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/aws_sns_sms_provider_configuration.py new file mode 100644 index 0000000..58bd365 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/aws_sns_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class AwsSnsSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_key_id': 'str', + 'secret_access_key': 'str', + 'region': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'access_key_id': 'accessKeyId', + 'secret_access_key': 'secretAccessKey', + 'region': 'region' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, access_key_id=None, secret_access_key=None, region=None, *args, **kwargs): # noqa: E501 + """AwsSnsSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._access_key_id = None + self._secret_access_key = None + self._region = None + self.discriminator = None + if access_key_id is not None: + self.access_key_id = access_key_id + if secret_access_key is not None: + self.secret_access_key = secret_access_key + if region is not None: + self.region = region + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def access_key_id(self): + """Gets the access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key ID. # noqa: E501 + + :return: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._access_key_id + + @access_key_id.setter + def access_key_id(self, access_key_id): + """Sets the access_key_id of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key ID. # noqa: E501 + + :param access_key_id: The access_key_id of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._access_key_id = access_key_id + + @property + def secret_access_key(self): + """Gets the secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS SNS Access Key. # noqa: E501 + + :return: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._secret_access_key + + @secret_access_key.setter + def secret_access_key(self, secret_access_key): + """Sets the secret_access_key of this AwsSnsSmsProviderConfiguration. + + The AWS SNS Access Key. # noqa: E501 + + :param secret_access_key: The secret_access_key of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._secret_access_key = secret_access_key + + @property + def region(self): + """Gets the region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + + The AWS region. # noqa: E501 + + :return: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._region + + @region.setter + def region(self, region): + """Sets the region of this AwsSnsSmsProviderConfiguration. + + The AWS region. # noqa: E501 + + :param region: The region of this AwsSnsSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._region = region + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(AwsSnsSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, AwsSnsSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/backup_code_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/backup_code_two_fa_account_config.py new file mode 100644 index 0000000..6b60109 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/backup_code_two_fa_account_config.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes': 'list[str]', + 'codes_left': 'int', + 'use_by_default': 'bool' + } + + attribute_map = { + 'codes': 'codes', + 'codes_left': 'codesLeft', + 'use_by_default': 'useByDefault' + } + + def __init__(self, codes=None, codes_left=None, use_by_default=None): # noqa: E501 + """BackupCodeTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._codes = None + self._codes_left = None + self._use_by_default = None + self.discriminator = None + if codes is not None: + self.codes = codes + if codes_left is not None: + self.codes_left = codes_left + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def codes(self): + """Gets the codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: list[str] + """ + return self._codes + + @codes.setter + def codes(self, codes): + """Sets the codes of this BackupCodeTwoFaAccountConfig. + + + :param codes: The codes of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: list[str] + """ + + self._codes = codes + + @property + def codes_left(self): + """Gets the codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: int + """ + return self._codes_left + + @codes_left.setter + def codes_left(self, codes_left): + """Sets the codes_left of this BackupCodeTwoFaAccountConfig. + + + :param codes_left: The codes_left of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: int + """ + + self._codes_left = codes_left + + @property + def use_by_default(self): + """Gets the use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this BackupCodeTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this BackupCodeTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/backup_code_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/backup_code_two_fa_provider_config.py new file mode 100644 index 0000000..f32b8d7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/backup_code_two_fa_provider_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BackupCodeTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'codes_quantity': 'int' + } + + attribute_map = { + 'codes_quantity': 'codesQuantity' + } + + def __init__(self, codes_quantity=None): # noqa: E501 + """BackupCodeTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._codes_quantity = None + self.discriminator = None + if codes_quantity is not None: + self.codes_quantity = codes_quantity + + @property + def codes_quantity(self): + """Gets the codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + + + :return: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._codes_quantity + + @codes_quantity.setter + def codes_quantity(self, codes_quantity): + """Sets the codes_quantity of this BackupCodeTwoFaProviderConfig. + + + :param codes_quantity: The codes_quantity of this BackupCodeTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._codes_quantity = codes_quantity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BackupCodeTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BackupCodeTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_id.py new file mode 100644 index 0000000..9883108 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_id.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BlobEntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """BlobEntityId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this BlobEntityId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this BlobEntityId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this BlobEntityId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this BlobEntityId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BlobEntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BlobEntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_info.py new file mode 100644 index 0000000..564887d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BlobEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'BlobEntityId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'content_type': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'content_type': 'contentType', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, content_type=None, additional_info=None): # noqa: E501 + """BlobEntityInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._content_type = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if content_type is not None: + self.content_type = content_type + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this BlobEntityInfo. # noqa: E501 + + + :return: The id of this BlobEntityInfo. # noqa: E501 + :rtype: BlobEntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this BlobEntityInfo. + + + :param id: The id of this BlobEntityInfo. # noqa: E501 + :type: BlobEntityId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this BlobEntityInfo. # noqa: E501 + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :return: The created_time of this BlobEntityInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this BlobEntityInfo. + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this BlobEntityInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this BlobEntityInfo. # noqa: E501 + + + :return: The tenant_id of this BlobEntityInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this BlobEntityInfo. + + + :param tenant_id: The tenant_id of this BlobEntityInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this BlobEntityInfo. # noqa: E501 + + + :return: The customer_id of this BlobEntityInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this BlobEntityInfo. + + + :param customer_id: The customer_id of this BlobEntityInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this BlobEntityInfo. # noqa: E501 + + + :return: The owner_id of this BlobEntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this BlobEntityInfo. + + + :param owner_id: The owner_id of this BlobEntityInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this BlobEntityInfo. # noqa: E501 + + blob entity name # noqa: E501 + + :return: The name of this BlobEntityInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BlobEntityInfo. + + blob entity name # noqa: E501 + + :param name: The name of this BlobEntityInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this BlobEntityInfo. # noqa: E501 + + blob entity type # noqa: E501 + + :return: The type of this BlobEntityInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this BlobEntityInfo. + + blob entity type # noqa: E501 + + :param type: The type of this BlobEntityInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def content_type(self): + """Gets the content_type of this BlobEntityInfo. # noqa: E501 + + blob content type # noqa: E501 + + :return: The content_type of this BlobEntityInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this BlobEntityInfo. + + blob content type # noqa: E501 + + :param content_type: The content_type of this BlobEntityInfo. # noqa: E501 + :type: str + """ + allowed_values = ["application/pdf", "image/jpeg", "image/png"] # noqa: E501 + if content_type not in allowed_values: + raise ValueError( + "Invalid value for `content_type` ({0}), must be one of {1}" # noqa: E501 + .format(content_type, allowed_values) + ) + + self._content_type = content_type + + @property + def additional_info(self): + """Gets the additional_info of this BlobEntityInfo. # noqa: E501 + + + :return: The additional_info of this BlobEntityInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this BlobEntityInfo. + + + :param additional_info: The additional_info of this BlobEntityInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BlobEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BlobEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_with_customer_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_with_customer_info.py new file mode 100644 index 0000000..370564f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/blob_entity_with_customer_info.py @@ -0,0 +1,402 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BlobEntityWithCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'BlobEntityId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'content_type': 'str', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'object' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'content_type': 'contentType', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, content_type=None, additional_info=None, customer_title=None, customer_is_public=None): # noqa: E501 + """BlobEntityWithCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._content_type = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if content_type is not None: + self.content_type = content_type + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + + @property + def id(self): + """Gets the id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: BlobEntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this BlobEntityWithCustomerInfo. + + + :param id: The id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: BlobEntityId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this BlobEntityWithCustomerInfo. # noqa: E501 + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :return: The created_time of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this BlobEntityWithCustomerInfo. + + Timestamp of the blob entity creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The tenant_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this BlobEntityWithCustomerInfo. + + + :param tenant_id: The tenant_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The customer_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this BlobEntityWithCustomerInfo. + + + :param customer_id: The customer_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The owner_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this BlobEntityWithCustomerInfo. + + + :param owner_id: The owner_id of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this BlobEntityWithCustomerInfo. # noqa: E501 + + blob entity name # noqa: E501 + + :return: The name of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BlobEntityWithCustomerInfo. + + blob entity name # noqa: E501 + + :param name: The name of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this BlobEntityWithCustomerInfo. # noqa: E501 + + blob entity type # noqa: E501 + + :return: The type of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this BlobEntityWithCustomerInfo. + + blob entity type # noqa: E501 + + :param type: The type of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def content_type(self): + """Gets the content_type of this BlobEntityWithCustomerInfo. # noqa: E501 + + blob content type # noqa: E501 + + :return: The content_type of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this BlobEntityWithCustomerInfo. + + blob content type # noqa: E501 + + :param content_type: The content_type of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + allowed_values = ["application/pdf", "image/jpeg", "image/png"] # noqa: E501 + if content_type not in allowed_values: + raise ValueError( + "Invalid value for `content_type` ({0}), must be one of {1}" # noqa: E501 + .format(content_type, allowed_values) + ) + + self._content_type = content_type + + @property + def additional_info(self): + """Gets the additional_info of this BlobEntityWithCustomerInfo. # noqa: E501 + + + :return: The additional_info of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this BlobEntityWithCustomerInfo. + + + :param additional_info: The additional_info of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this BlobEntityWithCustomerInfo. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The customer_title of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this BlobEntityWithCustomerInfo. + + Title of the customer # noqa: E501 + + :param customer_title: The customer_title of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this BlobEntityWithCustomerInfo. # noqa: E501 + + Parameter that specifies if customer is public # noqa: E501 + + :return: The customer_is_public of this BlobEntityWithCustomerInfo. # noqa: E501 + :rtype: object + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this BlobEntityWithCustomerInfo. + + Parameter that specifies if customer is public # noqa: E501 + + :param customer_is_public: The customer_is_public of this BlobEntityWithCustomerInfo. # noqa: E501 + :type: object + """ + + self._customer_is_public = customer_is_public + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BlobEntityWithCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BlobEntityWithCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/boolean_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_pe/boolean_filter_predicate.py new file mode 100644 index 0000000..a8e194e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/boolean_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class BooleanFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValueboolean' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """BooleanFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this BooleanFilterPredicate. # noqa: E501 + + + :return: The operation of this BooleanFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this BooleanFilterPredicate. + + + :param operation: The operation of this BooleanFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this BooleanFilterPredicate. # noqa: E501 + + + :return: The value of this BooleanFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValueboolean + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this BooleanFilterPredicate. + + + :param value: The value of this BooleanFilterPredicate. # noqa: E501 + :type: FilterPredicateValueboolean + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BooleanFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BooleanFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/bootstrap_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/bootstrap_configuration.py new file mode 100644 index 0000000..b8c716f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/bootstrap_configuration.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BootstrapConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap_server': 'object', + 'lwm2m_server': 'object', + 'servers': 'object' + } + + attribute_map = { + 'bootstrap_server': 'bootstrapServer', + 'lwm2m_server': 'lwm2mServer', + 'servers': 'servers' + } + + def __init__(self, bootstrap_server=None, lwm2m_server=None, servers=None): # noqa: E501 + """BootstrapConfiguration - a model defined in Swagger""" # noqa: E501 + self._bootstrap_server = None + self._lwm2m_server = None + self._servers = None + self.discriminator = None + if bootstrap_server is not None: + self.bootstrap_server = bootstrap_server + if lwm2m_server is not None: + self.lwm2m_server = lwm2m_server + if servers is not None: + self.servers = servers + + @property + def bootstrap_server(self): + """Gets the bootstrap_server of this BootstrapConfiguration. # noqa: E501 + + + :return: The bootstrap_server of this BootstrapConfiguration. # noqa: E501 + :rtype: object + """ + return self._bootstrap_server + + @bootstrap_server.setter + def bootstrap_server(self, bootstrap_server): + """Sets the bootstrap_server of this BootstrapConfiguration. + + + :param bootstrap_server: The bootstrap_server of this BootstrapConfiguration. # noqa: E501 + :type: object + """ + + self._bootstrap_server = bootstrap_server + + @property + def lwm2m_server(self): + """Gets the lwm2m_server of this BootstrapConfiguration. # noqa: E501 + + + :return: The lwm2m_server of this BootstrapConfiguration. # noqa: E501 + :rtype: object + """ + return self._lwm2m_server + + @lwm2m_server.setter + def lwm2m_server(self, lwm2m_server): + """Sets the lwm2m_server of this BootstrapConfiguration. + + + :param lwm2m_server: The lwm2m_server of this BootstrapConfiguration. # noqa: E501 + :type: object + """ + + self._lwm2m_server = lwm2m_server + + @property + def servers(self): + """Gets the servers of this BootstrapConfiguration. # noqa: E501 + + + :return: The servers of this BootstrapConfiguration. # noqa: E501 + :rtype: object + """ + return self._servers + + @servers.setter + def servers(self, servers): + """Sets the servers of this BootstrapConfiguration. + + + :param servers: The servers of this BootstrapConfiguration. # noqa: E501 + :type: object + """ + + self._servers = servers + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BootstrapConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BootstrapConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/branch_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/branch_info.py new file mode 100644 index 0000000..e5bf61f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default': 'bool', + 'name': 'str' + } + + attribute_map = { + 'default': 'default', + 'name': 'name' + } + + def __init__(self, default=None, name=None): # noqa: E501 + """BranchInfo - a model defined in Swagger""" # noqa: E501 + self._default = None + self._name = None + self.discriminator = None + if default is not None: + self.default = default + if name is not None: + self.name = name + + @property + def default(self): + """Gets the default of this BranchInfo. # noqa: E501 + + + :return: The default of this BranchInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this BranchInfo. + + + :param default: The default of this BranchInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def name(self): + """Gets the name of this BranchInfo. # noqa: E501 + + + :return: The name of this BranchInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this BranchInfo. + + + :param name: The name of this BranchInfo. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_request.py new file mode 100644 index 0000000..5417a49 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_request.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'CustomerId', + 'entity_group_id': 'str', + 'file': 'str', + 'mapping': 'Mapping' + } + + attribute_map = { + 'customer_id': 'customerId', + 'entity_group_id': 'entityGroupId', + 'file': 'file', + 'mapping': 'mapping' + } + + def __init__(self, customer_id=None, entity_group_id=None, file=None, mapping=None): # noqa: E501 + """BulkImportRequest - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self._entity_group_id = None + self._file = None + self._mapping = None + self.discriminator = None + if customer_id is not None: + self.customer_id = customer_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if file is not None: + self.file = file + if mapping is not None: + self.mapping = mapping + + @property + def customer_id(self): + """Gets the customer_id of this BulkImportRequest. # noqa: E501 + + + :return: The customer_id of this BulkImportRequest. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this BulkImportRequest. + + + :param customer_id: The customer_id of this BulkImportRequest. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this BulkImportRequest. # noqa: E501 + + + :return: The entity_group_id of this BulkImportRequest. # noqa: E501 + :rtype: str + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this BulkImportRequest. + + + :param entity_group_id: The entity_group_id of this BulkImportRequest. # noqa: E501 + :type: str + """ + + self._entity_group_id = entity_group_id + + @property + def file(self): + """Gets the file of this BulkImportRequest. # noqa: E501 + + + :return: The file of this BulkImportRequest. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this BulkImportRequest. + + + :param file: The file of this BulkImportRequest. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def mapping(self): + """Gets the mapping of this BulkImportRequest. # noqa: E501 + + + :return: The mapping of this BulkImportRequest. # noqa: E501 + :rtype: Mapping + """ + return self._mapping + + @mapping.setter + def mapping(self, mapping): + """Sets the mapping of this BulkImportRequest. + + + :param mapping: The mapping of this BulkImportRequest. # noqa: E501 + :type: Mapping + """ + + self._mapping = mapping + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_asset.py b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_asset.py new file mode 100644 index 0000000..d14bb42 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_asset.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultAsset(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultAsset - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultAsset. # noqa: E501 + + + :return: The created of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultAsset. + + + :param created: The created of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultAsset. + + + :param errors: The errors of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultAsset. # noqa: E501 + + + :return: The errors_list of this BulkImportResultAsset. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultAsset. + + + :param errors_list: The errors_list of this BulkImportResultAsset. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultAsset. # noqa: E501 + + + :return: The updated of this BulkImportResultAsset. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultAsset. + + + :param updated: The updated of this BulkImportResultAsset. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultAsset, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultAsset): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_device.py b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_device.py new file mode 100644 index 0000000..ee3dd42 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_device.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultDevice(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultDevice - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultDevice. # noqa: E501 + + + :return: The created of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultDevice. + + + :param created: The created of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultDevice. + + + :param errors: The errors of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultDevice. # noqa: E501 + + + :return: The errors_list of this BulkImportResultDevice. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultDevice. + + + :param errors_list: The errors_list of this BulkImportResultDevice. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultDevice. # noqa: E501 + + + :return: The updated of this BulkImportResultDevice. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultDevice. + + + :param updated: The updated of this BulkImportResultDevice. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultDevice, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultDevice): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_edge.py b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_edge.py new file mode 100644 index 0000000..007eb13 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/bulk_import_result_edge.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class BulkImportResultEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'AtomicInteger', + 'errors': 'AtomicInteger', + 'errors_list': 'list[str]', + 'updated': 'AtomicInteger' + } + + attribute_map = { + 'created': 'created', + 'errors': 'errors', + 'errors_list': 'errorsList', + 'updated': 'updated' + } + + def __init__(self, created=None, errors=None, errors_list=None, updated=None): # noqa: E501 + """BulkImportResultEdge - a model defined in Swagger""" # noqa: E501 + self._created = None + self._errors = None + self._errors_list = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if errors is not None: + self.errors = errors + if errors_list is not None: + self.errors_list = errors_list + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this BulkImportResultEdge. # noqa: E501 + + + :return: The created of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this BulkImportResultEdge. + + + :param created: The created of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._created = created + + @property + def errors(self): + """Gets the errors of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this BulkImportResultEdge. + + + :param errors: The errors of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._errors = errors + + @property + def errors_list(self): + """Gets the errors_list of this BulkImportResultEdge. # noqa: E501 + + + :return: The errors_list of this BulkImportResultEdge. # noqa: E501 + :rtype: list[str] + """ + return self._errors_list + + @errors_list.setter + def errors_list(self, errors_list): + """Sets the errors_list of this BulkImportResultEdge. + + + :param errors_list: The errors_list of this BulkImportResultEdge. # noqa: E501 + :type: list[str] + """ + + self._errors_list = errors_list + + @property + def updated(self): + """Gets the updated of this BulkImportResultEdge. # noqa: E501 + + + :return: The updated of this BulkImportResultEdge. # noqa: E501 + :rtype: AtomicInteger + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this BulkImportResultEdge. + + + :param updated: The updated of this BulkImportResultEdge. # noqa: E501 + :type: AtomicInteger + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(BulkImportResultEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BulkImportResultEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/byte_buffer.py b/tb-rest-client/python/tb_rest_client/models/models_pe/byte_buffer.py new file mode 100644 index 0000000..47b7d93 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/byte_buffer.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ByteBuffer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'char': 'str', + 'direct': 'bool', + 'double': 'float', + '_float': 'float', + '_int': 'int', + 'long': 'int', + 'read_only': 'bool', + 'short': 'int' + } + + attribute_map = { + 'char': 'char', + 'direct': 'direct', + 'double': 'double', + '_float': 'float', + '_int': 'int', + 'long': 'long', + 'read_only': 'readOnly', + 'short': 'short' + } + + def __init__(self, char=None, direct=None, double=None, _float=None, _int=None, long=None, read_only=None, short=None): # noqa: E501 + """ByteBuffer - a model defined in Swagger""" # noqa: E501 + self._char = None + self._direct = None + self._double = None + self.__float = None + self.__int = None + self._long = None + self._read_only = None + self._short = None + self.discriminator = None + if char is not None: + self.char = char + if direct is not None: + self.direct = direct + if double is not None: + self.double = double + if _float is not None: + self._float = _float + if _int is not None: + self._int = _int + if long is not None: + self.long = long + if read_only is not None: + self.read_only = read_only + if short is not None: + self.short = short + + @property + def char(self): + """Gets the char of this ByteBuffer. # noqa: E501 + + + :return: The char of this ByteBuffer. # noqa: E501 + :rtype: str + """ + return self._char + + @char.setter + def char(self, char): + """Sets the char of this ByteBuffer. + + + :param char: The char of this ByteBuffer. # noqa: E501 + :type: str + """ + + self._char = char + + @property + def direct(self): + """Gets the direct of this ByteBuffer. # noqa: E501 + + + :return: The direct of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._direct + + @direct.setter + def direct(self, direct): + """Sets the direct of this ByteBuffer. + + + :param direct: The direct of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._direct = direct + + @property + def double(self): + """Gets the double of this ByteBuffer. # noqa: E501 + + + :return: The double of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self._double + + @double.setter + def double(self, double): + """Sets the double of this ByteBuffer. + + + :param double: The double of this ByteBuffer. # noqa: E501 + :type: float + """ + + self._double = double + + @property + def _float(self): + """Gets the _float of this ByteBuffer. # noqa: E501 + + + :return: The _float of this ByteBuffer. # noqa: E501 + :rtype: float + """ + return self.__float + + @_float.setter + def _float(self, _float): + """Sets the _float of this ByteBuffer. + + + :param _float: The _float of this ByteBuffer. # noqa: E501 + :type: float + """ + + self.__float = _float + + @property + def _int(self): + """Gets the _int of this ByteBuffer. # noqa: E501 + + + :return: The _int of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self.__int + + @_int.setter + def _int(self, _int): + """Sets the _int of this ByteBuffer. + + + :param _int: The _int of this ByteBuffer. # noqa: E501 + :type: int + """ + + self.__int = _int + + @property + def long(self): + """Gets the long of this ByteBuffer. # noqa: E501 + + + :return: The long of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._long + + @long.setter + def long(self, long): + """Sets the long of this ByteBuffer. + + + :param long: The long of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._long = long + + @property + def read_only(self): + """Gets the read_only of this ByteBuffer. # noqa: E501 + + + :return: The read_only of this ByteBuffer. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this ByteBuffer. + + + :param read_only: The read_only of this ByteBuffer. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def short(self): + """Gets the short of this ByteBuffer. # noqa: E501 + + + :return: The short of this ByteBuffer. # noqa: E501 + :rtype: int + """ + return self._short + + @short.setter + def short(self, short): + """Sets the short of this ByteBuffer. + + + :param short: The short of this ByteBuffer. # noqa: E501 + :type: int + """ + + self._short = short + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ByteBuffer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ByteBuffer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/change_password_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/change_password_request.py new file mode 100644 index 0000000..8770bbb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/change_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ChangePasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_password': 'str', + 'new_password': 'str' + } + + attribute_map = { + 'current_password': 'currentPassword', + 'new_password': 'newPassword' + } + + def __init__(self, current_password=None, new_password=None): # noqa: E501 + """ChangePasswordRequest - a model defined in Swagger""" # noqa: E501 + self._current_password = None + self._new_password = None + self.discriminator = None + if current_password is not None: + self.current_password = current_password + if new_password is not None: + self.new_password = new_password + + @property + def current_password(self): + """Gets the current_password of this ChangePasswordRequest. # noqa: E501 + + The old password # noqa: E501 + + :return: The current_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._current_password + + @current_password.setter + def current_password(self, current_password): + """Sets the current_password of this ChangePasswordRequest. + + The old password # noqa: E501 + + :param current_password: The current_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._current_password = current_password + + @property + def new_password(self): + """Gets the new_password of this ChangePasswordRequest. # noqa: E501 + + The new password # noqa: E501 + + :return: The new_password of this ChangePasswordRequest. # noqa: E501 + :rtype: str + """ + return self._new_password + + @new_password.setter + def new_password(self, new_password): + """Sets the new_password of this ChangePasswordRequest. + + The new password # noqa: E501 + + :param new_password: The new_password of this ChangePasswordRequest. # noqa: E501 + :type: str + """ + + self._new_password = new_password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ChangePasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ChangePasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/check_pre_provisioned_devices_device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/check_pre_provisioned_devices_device_profile_provision_configuration.py new file mode 100644 index 0000000..7f3662d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/check_pre_provisioned_devices_device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CheckPreProvisionedDevicesDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/claim_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/claim_request.py new file mode 100644 index 0000000..16db2f4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/claim_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClaimRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'secret_key': 'str' + } + + attribute_map = { + 'secret_key': 'secretKey' + } + + def __init__(self, secret_key=None): # noqa: E501 + """ClaimRequest - a model defined in Swagger""" # noqa: E501 + self._secret_key = None + self.discriminator = None + if secret_key is not None: + self.secret_key = secret_key + + @property + def secret_key(self): + """Gets the secret_key of this ClaimRequest. # noqa: E501 + + + :return: The secret_key of this ClaimRequest. # noqa: E501 + :rtype: str + """ + return self._secret_key + + @secret_key.setter + def secret_key(self, secret_key): + """Sets the secret_key of this ClaimRequest. + + + :param secret_key: The secret_key of this ClaimRequest. # noqa: E501 + :type: str + """ + + self._secret_key = secret_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClaimRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClaimRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/clear_rule.py b/tb-rest-client/python/tb_rest_client/models/models_pe/clear_rule.py new file mode 100644 index 0000000..982d347 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/clear_rule.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClearRule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarm_statuses': 'list[str]' + } + + attribute_map = { + 'alarm_statuses': 'alarmStatuses' + } + + def __init__(self, alarm_statuses=None): # noqa: E501 + """ClearRule - a model defined in Swagger""" # noqa: E501 + self._alarm_statuses = None + self.discriminator = None + if alarm_statuses is not None: + self.alarm_statuses = alarm_statuses + + @property + def alarm_statuses(self): + """Gets the alarm_statuses of this ClearRule. # noqa: E501 + + + :return: The alarm_statuses of this ClearRule. # noqa: E501 + :rtype: list[str] + """ + return self._alarm_statuses + + @alarm_statuses.setter + def alarm_statuses(self, alarm_statuses): + """Sets the alarm_statuses of this ClearRule. + + + :param alarm_statuses: The alarm_statuses of this ClearRule. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACK", "ACTIVE", "ANY", "CLEARED", "UNACK"] # noqa: E501 + if not set(alarm_statuses).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `alarm_statuses` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(alarm_statuses) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._alarm_statuses = alarm_statuses + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClearRule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClearRule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/client_attributes_querying_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/client_attributes_querying_snmp_communication_config.py new file mode 100644 index 0000000..71e11c1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/client_attributes_querying_snmp_communication_config.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClientAttributesQueryingSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None): # noqa: E501 + """ClientAttributesQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ClientAttributesQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this ClientAttributesQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClientAttributesQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClientAttributesQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/client_registration_dto.py b/tb-rest-client/python/tb_rest_client/models/models_pe/client_registration_dto.py new file mode 100644 index 0000000..74b704d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/client_registration_dto.py @@ -0,0 +1,436 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ClientRegistrationDto(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'str', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'client_id': 'str', + 'client_secret': 'str', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'client_id': 'clientId', + 'client_secret': 'clientSecret', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, client_id=None, client_secret=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """ClientRegistrationDto - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._client_id = None + self._client_secret = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + if access_token_uri is not None: + self.access_token_uri = access_token_uri + if additional_info is not None: + self.additional_info = additional_info + if authorization_uri is not None: + self.authorization_uri = authorization_uri + if client_authentication_method is not None: + self.client_authentication_method = client_authentication_method + if client_id is not None: + self.client_id = client_id + if client_secret is not None: + self.client_secret = client_secret + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + if login_button_label is not None: + self.login_button_label = login_button_label + if mapper_config is not None: + self.mapper_config = mapper_config + if scope is not None: + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The access_token_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this ClientRegistrationDto. + + + :param access_token_uri: The access_token_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this ClientRegistrationDto. # noqa: E501 + + + :return: The additional_info of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this ClientRegistrationDto. + + + :param additional_info: The additional_info of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The authorization_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this ClientRegistrationDto. + + + :param authorization_uri: The authorization_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this ClientRegistrationDto. # noqa: E501 + + + :return: The client_authentication_method of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this ClientRegistrationDto. + + + :param client_authentication_method: The client_authentication_method of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._client_authentication_method = client_authentication_method + + @property + def client_id(self): + """Gets the client_id of this ClientRegistrationDto. # noqa: E501 + + + :return: The client_id of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._client_id + + @client_id.setter + def client_id(self, client_id): + """Sets the client_id of this ClientRegistrationDto. + + + :param client_id: The client_id of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._client_id = client_id + + @property + def client_secret(self): + """Gets the client_secret of this ClientRegistrationDto. # noqa: E501 + + + :return: The client_secret of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._client_secret + + @client_secret.setter + def client_secret(self, client_secret): + """Sets the client_secret of this ClientRegistrationDto. + + + :param client_secret: The client_secret of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._client_secret = client_secret + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The jwk_set_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this ClientRegistrationDto. + + + :param jwk_set_uri: The jwk_set_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this ClientRegistrationDto. # noqa: E501 + + + :return: The login_button_icon of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this ClientRegistrationDto. + + + :param login_button_icon: The login_button_icon of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this ClientRegistrationDto. # noqa: E501 + + + :return: The login_button_label of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this ClientRegistrationDto. + + + :param login_button_label: The login_button_label of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this ClientRegistrationDto. # noqa: E501 + + + :return: The mapper_config of this ClientRegistrationDto. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this ClientRegistrationDto. + + + :param mapper_config: The mapper_config of this ClientRegistrationDto. # noqa: E501 + :type: OAuth2MapperConfig + """ + + self._mapper_config = mapper_config + + @property + def scope(self): + """Gets the scope of this ClientRegistrationDto. # noqa: E501 + + + :return: The scope of this ClientRegistrationDto. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this ClientRegistrationDto. + + + :param scope: The scope of this ClientRegistrationDto. # noqa: E501 + :type: list[str] + """ + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this ClientRegistrationDto. # noqa: E501 + + + :return: The user_info_uri of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this ClientRegistrationDto. + + + :param user_info_uri: The user_info_uri of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this ClientRegistrationDto. # noqa: E501 + + + :return: The user_name_attribute_name of this ClientRegistrationDto. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this ClientRegistrationDto. + + + :param user_name_attribute_name: The user_name_attribute_name of this ClientRegistrationDto. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ClientRegistrationDto, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ClientRegistrationDto): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_profile_transport_configuration.py new file mode 100644 index 0000000..50fa610 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_profile_transport_configuration.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class CoapDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_settings': 'PowerSavingConfiguration', + 'coap_device_type_configuration': 'CoapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'client_settings': 'clientSettings', + 'coap_device_type_configuration': 'coapDeviceTypeConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, client_settings=None, coap_device_type_configuration=None, *args, **kwargs): # noqa: E501 + """CoapDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_settings = None + self._coap_device_type_configuration = None + self.discriminator = None + if client_settings is not None: + self.client_settings = client_settings + if coap_device_type_configuration is not None: + self.coap_device_type_configuration = coap_device_type_configuration + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def client_settings(self): + """Gets the client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: PowerSavingConfiguration + """ + return self._client_settings + + @client_settings.setter + def client_settings(self, client_settings): + """Sets the client_settings of this CoapDeviceProfileTransportConfiguration. + + + :param client_settings: The client_settings of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: PowerSavingConfiguration + """ + + self._client_settings = client_settings + + @property + def coap_device_type_configuration(self): + """Gets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: CoapDeviceTypeConfiguration + """ + return self._coap_device_type_configuration + + @coap_device_type_configuration.setter + def coap_device_type_configuration(self, coap_device_type_configuration): + """Sets the coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. + + + :param coap_device_type_configuration: The coap_device_type_configuration of this CoapDeviceProfileTransportConfiguration. # noqa: E501 + :type: CoapDeviceTypeConfiguration + """ + + self._coap_device_type_configuration = coap_device_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_transport_configuration.py new file mode 100644 index 0000000..e1c102f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class CoapDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """CoapDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this CoapDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this CoapDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this CoapDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this CoapDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this CoapDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_type_configuration.py new file mode 100644 index 0000000..e4ac6c6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """CoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/column_mapping.py b/tb-rest-client/python/tb_rest_client/models/models_pe/column_mapping.py new file mode 100644 index 0000000..f4ce7bb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/column_mapping.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ColumnMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """ColumnMapping - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this ColumnMapping. # noqa: E501 + + + :return: The key of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this ColumnMapping. + + + :param key: The key of this ColumnMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this ColumnMapping. # noqa: E501 + + + :return: The type of this ColumnMapping. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ColumnMapping. + + + :param type: The type of this ColumnMapping. # noqa: E501 + :type: str + """ + allowed_values = ["ACCESS_TOKEN", "CLOUD_ENDPOINT", "DESCRIPTION", "EDGE_LICENSE_KEY", "IS_GATEWAY", "LABEL", "LWM2M_BOOTSTRAP_SERVER_PUBLIC_KEY_OR_ID", "LWM2M_BOOTSTRAP_SERVER_SECRET_KEY", "LWM2M_BOOTSTRAP_SERVER_SECURITY_MODE", "LWM2M_CLIENT_CERT", "LWM2M_CLIENT_ENDPOINT", "LWM2M_CLIENT_IDENTITY", "LWM2M_CLIENT_KEY", "LWM2M_CLIENT_SECURITY_CONFIG_MODE", "LWM2M_SERVER_CLIENT_PUBLIC_KEY_OR_ID", "LWM2M_SERVER_CLIENT_SECRET_KEY", "LWM2M_SERVER_SECURITY_MODE", "MQTT_CLIENT_ID", "MQTT_PASSWORD", "MQTT_USER_NAME", "NAME", "ROUTING_KEY", "SECRET", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIMESERIES", "TYPE", "X509"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ColumnMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ColumnMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/comparison_ts_value.py b/tb-rest-client/python/tb_rest_client/models/models_pe/comparison_ts_value.py new file mode 100644 index 0000000..5bd4b18 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/comparison_ts_value.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComparisonTsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current': 'TsValue', + 'previous': 'TsValue' + } + + attribute_map = { + 'current': 'current', + 'previous': 'previous' + } + + def __init__(self, current=None, previous=None): # noqa: E501 + """ComparisonTsValue - a model defined in Swagger""" # noqa: E501 + self._current = None + self._previous = None + self.discriminator = None + if current is not None: + self.current = current + if previous is not None: + self.previous = previous + + @property + def current(self): + """Gets the current of this ComparisonTsValue. # noqa: E501 + + + :return: The current of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._current + + @current.setter + def current(self, current): + """Sets the current of this ComparisonTsValue. + + + :param current: The current of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._current = current + + @property + def previous(self): + """Gets the previous of this ComparisonTsValue. # noqa: E501 + + + :return: The previous of this ComparisonTsValue. # noqa: E501 + :rtype: TsValue + """ + return self._previous + + @previous.setter + def previous(self, previous): + """Sets the previous of this ComparisonTsValue. + + + :param previous: The previous of this ComparisonTsValue. # noqa: E501 + :type: TsValue + """ + + self._previous = previous + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComparisonTsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComparisonTsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/complex_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_pe/complex_filter_predicate.py new file mode 100644 index 0000000..84c63d4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/complex_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class ComplexFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'predicates': 'list[KeyFilterPredicate]' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'predicates': 'predicates' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, predicates=None, *args, **kwargs): # noqa: E501 + """ComplexFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._predicates = None + self.discriminator = None + if operation is not None: + self.operation = operation + if predicates is not None: + self.predicates = predicates + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this ComplexFilterPredicate. # noqa: E501 + + + :return: The operation of this ComplexFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this ComplexFilterPredicate. + + + :param operation: The operation of this ComplexFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["AND", "OR"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def predicates(self): + """Gets the predicates of this ComplexFilterPredicate. # noqa: E501 + + + :return: The predicates of this ComplexFilterPredicate. # noqa: E501 + :rtype: list[KeyFilterPredicate] + """ + return self._predicates + + @predicates.setter + def predicates(self, predicates): + """Sets the predicates of this ComplexFilterPredicate. + + + :param predicates: The predicates of this ComplexFilterPredicate. # noqa: E501 + :type: list[KeyFilterPredicate] + """ + + self._predicates = predicates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/complex_version_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/complex_version_create_request.py new file mode 100644 index 0000000..42cd339 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/complex_version_create_request.py @@ -0,0 +1,246 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class ComplexVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'entity_types': 'dict(str, EntityTypeVersionCreateConfig)', + 'sync_strategy': 'str', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'entity_types': 'entityTypes', + 'sync_strategy': 'syncStrategy', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, entity_types=None, sync_strategy=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """ComplexVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._entity_types = None + self._sync_strategy = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if entity_types is not None: + self.entity_types = entity_types + if sync_strategy is not None: + self.sync_strategy = sync_strategy + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this ComplexVersionCreateRequest. + + + :param branch: The branch of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def entity_types(self): + """Gets the entity_types of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionCreateConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this ComplexVersionCreateRequest. + + + :param entity_types: The entity_types of this ComplexVersionCreateRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionCreateConfig) + """ + + self._entity_types = entity_types + + @property + def sync_strategy(self): + """Gets the sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this ComplexVersionCreateRequest. + + + :param sync_strategy: The sync_strategy of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + @property + def type(self): + """Gets the type of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The type of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComplexVersionCreateRequest. + + + :param type: The type of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this ComplexVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this ComplexVersionCreateRequest. + + + :param version_name: The version_name of this ComplexVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComplexVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComplexVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/component_descriptor.py b/tb-rest-client/python/tb_rest_client/models/models_pe/component_descriptor.py new file mode 100644 index 0000000..4c9494e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/component_descriptor.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptor(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'ComponentDescriptorId', + 'created_time': 'int', + 'type': 'str', + 'scope': 'str', + 'clustering_mode': 'str', + 'name': 'str', + 'clazz': 'str', + 'configuration_descriptor': 'JsonNode', + 'actions': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'type': 'type', + 'scope': 'scope', + 'clustering_mode': 'clusteringMode', + 'name': 'name', + 'clazz': 'clazz', + 'configuration_descriptor': 'configurationDescriptor', + 'actions': 'actions' + } + + def __init__(self, id=None, created_time=None, type=None, scope=None, clustering_mode=None, name=None, clazz=None, configuration_descriptor=None, actions=None): # noqa: E501 + """ComponentDescriptor - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._type = None + self._scope = None + self._clustering_mode = None + self._name = None + self._clazz = None + self._configuration_descriptor = None + self._actions = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if type is not None: + self.type = type + if scope is not None: + self.scope = scope + if clustering_mode is not None: + self.clustering_mode = clustering_mode + if name is not None: + self.name = name + if clazz is not None: + self.clazz = clazz + if configuration_descriptor is not None: + self.configuration_descriptor = configuration_descriptor + if actions is not None: + self.actions = actions + + @property + def id(self): + """Gets the id of this ComponentDescriptor. # noqa: E501 + + + :return: The id of this ComponentDescriptor. # noqa: E501 + :rtype: ComponentDescriptorId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptor. + + + :param id: The id of this ComponentDescriptor. # noqa: E501 + :type: ComponentDescriptorId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this ComponentDescriptor. # noqa: E501 + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :return: The created_time of this ComponentDescriptor. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ComponentDescriptor. + + Timestamp of the descriptor creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this ComponentDescriptor. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def type(self): + """Gets the type of this ComponentDescriptor. # noqa: E501 + + Type of the Rule Node # noqa: E501 + + :return: The type of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ComponentDescriptor. + + Type of the Rule Node # noqa: E501 + + :param type: The type of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ACTION", "ANALYTICS", "ENRICHMENT", "EXTERNAL", "FILTER", "FLOW", "TRANSFORMATION"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def scope(self): + """Gets the scope of this ComponentDescriptor. # noqa: E501 + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :return: The scope of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this ComponentDescriptor. + + Scope of the Rule Node. Always set to 'TENANT', since no rule chains on the 'SYSTEM' level yet. # noqa: E501 + + :param scope: The scope of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["TENANT"] # noqa: E501 + if scope not in allowed_values: + raise ValueError( + "Invalid value for `scope` ({0}), must be one of {1}" # noqa: E501 + .format(scope, allowed_values) + ) + + self._scope = scope + + @property + def clustering_mode(self): + """Gets the clustering_mode of this ComponentDescriptor. # noqa: E501 + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :return: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clustering_mode + + @clustering_mode.setter + def clustering_mode(self, clustering_mode): + """Sets the clustering_mode of this ComponentDescriptor. + + Clustering mode of the RuleNode. This mode represents the ability to start Rule Node in multiple microservices. # noqa: E501 + + :param clustering_mode: The clustering_mode of this ComponentDescriptor. # noqa: E501 + :type: str + """ + allowed_values = ["ENABLED", "SINGLETON", "USER_PREFERENCE"] # noqa: E501 + if clustering_mode not in allowed_values: + raise ValueError( + "Invalid value for `clustering_mode` ({0}), must be one of {1}" # noqa: E501 + .format(clustering_mode, allowed_values) + ) + + self._clustering_mode = clustering_mode + + @property + def name(self): + """Gets the name of this ComponentDescriptor. # noqa: E501 + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :return: The name of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ComponentDescriptor. + + Name of the Rule Node. Taken from the @RuleNode annotation. # noqa: E501 + + :param name: The name of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def clazz(self): + """Gets the clazz of this ComponentDescriptor. # noqa: E501 + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :return: The clazz of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._clazz + + @clazz.setter + def clazz(self, clazz): + """Sets the clazz of this ComponentDescriptor. + + Full name of the Java class that implements the Rule Engine Node interface. # noqa: E501 + + :param clazz: The clazz of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._clazz = clazz + + @property + def configuration_descriptor(self): + """Gets the configuration_descriptor of this ComponentDescriptor. # noqa: E501 + + + :return: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration_descriptor + + @configuration_descriptor.setter + def configuration_descriptor(self, configuration_descriptor): + """Sets the configuration_descriptor of this ComponentDescriptor. + + + :param configuration_descriptor: The configuration_descriptor of this ComponentDescriptor. # noqa: E501 + :type: JsonNode + """ + + self._configuration_descriptor = configuration_descriptor + + @property + def actions(self): + """Gets the actions of this ComponentDescriptor. # noqa: E501 + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :return: The actions of this ComponentDescriptor. # noqa: E501 + :rtype: str + """ + return self._actions + + @actions.setter + def actions(self, actions): + """Sets the actions of this ComponentDescriptor. + + Rule Node Actions. Deprecated. Always null. # noqa: E501 + + :param actions: The actions of this ComponentDescriptor. # noqa: E501 + :type: str + """ + + self._actions = actions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptor, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptor): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/component_descriptor_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/component_descriptor_id.py new file mode 100644 index 0000000..c8315e3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/component_descriptor_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ComponentDescriptorId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """ComponentDescriptorId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this ComponentDescriptorId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this ComponentDescriptorId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ComponentDescriptorId. + + string # noqa: E501 + + :param id: The id of this ComponentDescriptorId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ComponentDescriptorId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ComponentDescriptorId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/contact_basedobject.py b/tb-rest-client/python/tb_rest_client/models/models_pe/contact_basedobject.py new file mode 100644 index 0000000..76ef563 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/contact_basedobject.py @@ -0,0 +1,494 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ContactBasedobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'address': 'str', + 'address2': 'str', + 'city': 'str', + 'country': 'str', + 'created_time': 'int', + 'email': 'str', + 'id': 'object', + 'name': 'str', + 'phone': 'str', + 'state': 'str', + 'zip': 'str', + 'external_id': 'EntityId', + 'owner_id': 'EntityId', + 'parent_customer_id': 'CustomerId', + 'tenant_id': 'TenantId', + 'title': 'str', + 'customer_id': 'CustomerId', + 'tenant_profile_id': 'TenantProfileId' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'address': 'address', + 'address2': 'address2', + 'city': 'city', + 'country': 'country', + 'created_time': 'createdTime', + 'email': 'email', + 'id': 'id', + 'name': 'name', + 'phone': 'phone', + 'state': 'state', + 'zip': 'zip', + 'external_id': 'externalId', + 'owner_id': 'ownerId', + 'parent_customer_id': 'parentCustomerId', + 'tenant_id': 'tenantId', + 'title': 'title', + 'customer_id': 'customerId', + 'tenant_profile_id': 'tenantProfileId' + } + + def __init__(self, additional_info=None, address=None, address2=None, tenant_profile_id=None, external_id=None, customer_id=None, owner_id=None, title=None, tenant_id=None, parent_customer_id=None, city=None, country=None, created_time=None, email=None, id=None, name=None, phone=None, state=None, zip=None): # noqa: E501 + """ContactBasedobject - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._address = None + self._address2 = None + self._city = None + self._country = None + self._created_time = None + self._email = None + self._id = None + self._name = None + self._phone = None + self._state = None + self._zip = None + self._external_id = None + self._owner_id = None + self._parent_customer_id = None + self._tenant_id = None + self._title = None + self._customer_id = None + self._tenant_profile_id = None + self.parent_customer_id = parent_customer_id + self.owner_id = owner_id + self.discriminator = None + self.external_id = external_id + self.tenant_id = tenant_id + self.title = title + self.customer_id = customer_id + self.tenant_profile_id = tenant_profile_id + if additional_info is not None: + self.additional_info = additional_info + if address is not None: + self.address = address + if address2 is not None: + self.address2 = address2 + if city is not None: + self.city = city + if country is not None: + self.country = country + if created_time is not None: + self.created_time = created_time + if email is not None: + self.email = email + if id is not None: + self.id = id + if name is not None: + self.name = name + if phone is not None: + self.phone = phone + if state is not None: + self.state = state + if zip is not None: + self.zip = zip + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def owner_id(self): + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + self._owner_id = owner_id + + @property + def parent_customer_id(self): + return self._parent_customer_id + + @parent_customer_id.setter + def parent_customer_id(self, parent_customer_id): + self._parent_customer_id = parent_customer_id + + @property + def tenant_id(self): + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + self._tenant_id = tenant_id + + @property + def title(self): + return self._title + + @title.setter + def title(self, title): + self._title = title + + @property + def customer_id(self): + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + self._customer_id = customer_id + + @property + def tenant_profile_id(self): + return self._tenant_profile_id + + @tenant_profile_id.setter + def tenant_profile_id(self, tenant_profile_id): + self._tenant_profile_id = tenant_profile_id + + @property + def additional_info(self): + """Gets the additional_info of this ContactBasedobject. # noqa: E501 + + + :return: The additional_info of this ContactBasedobject. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this ContactBasedobject. + + + :param additional_info: The additional_info of this ContactBasedobject. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def address(self): + """Gets the address of this ContactBasedobject. # noqa: E501 + + + :return: The address of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this ContactBasedobject. + + + :param address: The address of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this ContactBasedobject. # noqa: E501 + + + :return: The address2 of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this ContactBasedobject. + + + :param address2: The address2 of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def city(self): + """Gets the city of this ContactBasedobject. # noqa: E501 + + + :return: The city of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this ContactBasedobject. + + + :param city: The city of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def country(self): + """Gets the country of this ContactBasedobject. # noqa: E501 + + + :return: The country of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this ContactBasedobject. + + + :param country: The country of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def created_time(self): + """Gets the created_time of this ContactBasedobject. # noqa: E501 + + + :return: The created_time of this ContactBasedobject. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ContactBasedobject. + + + :param created_time: The created_time of this ContactBasedobject. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def email(self): + """Gets the email of this ContactBasedobject. # noqa: E501 + + + :return: The email of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this ContactBasedobject. + + + :param email: The email of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def id(self): + """Gets the id of this ContactBasedobject. # noqa: E501 + + + :return: The id of this ContactBasedobject. # noqa: E501 + :rtype: object + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ContactBasedobject. + + + :param id: The id of this ContactBasedobject. # noqa: E501 + :type: object + """ + + self._id = id + + @property + def name(self): + """Gets the name of this ContactBasedobject. # noqa: E501 + + + :return: The name of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ContactBasedobject. + + + :param name: The name of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def phone(self): + """Gets the phone of this ContactBasedobject. # noqa: E501 + + + :return: The phone of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this ContactBasedobject. + + + :param phone: The phone of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def state(self): + """Gets the state of this ContactBasedobject. # noqa: E501 + + + :return: The state of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ContactBasedobject. + + + :param state: The state of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def zip(self): + """Gets the zip of this ContactBasedobject. # noqa: E501 + + + :return: The zip of this ContactBasedobject. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this ContactBasedobject. + + + :param zip: The zip of this ContactBasedobject. # noqa: E501 + :type: str + """ + + self._zip = zip + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ContactBasedobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ContactBasedobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/converter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/converter.py new file mode 100644 index 0000000..6d5cbe2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/converter.py @@ -0,0 +1,362 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Converter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'ConverterId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'type': 'str', + 'debug_mode': 'bool', + 'configuration': 'JsonNode', + 'additional_info': 'JsonNode', + 'edge_template': 'bool', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'type': 'type', + 'debug_mode': 'debugMode', + 'configuration': 'configuration', + 'additional_info': 'additionalInfo', + 'edge_template': 'edgeTemplate', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, name=None, type=None, debug_mode=None, configuration=None, additional_info=None, edge_template=None): # noqa: E501 + """Converter - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._type = None + self._debug_mode = None + self._configuration = None + self._additional_info = None + self._edge_template = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + self.name = name + self.type = type + if debug_mode is not None: + self.debug_mode = debug_mode + if configuration is not None: + self.configuration = configuration + if additional_info is not None: + self.additional_info = additional_info + if edge_template is not None: + self.edge_template = edge_template + + @property + def id(self): + """Gets the id of this Converter. # noqa: E501 + + + :return: The id of this Converter. # noqa: E501 + :rtype: ConverterId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Converter. + + + :param id: The id of this Converter. # noqa: E501 + :type: ConverterId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Converter. # noqa: E501 + + Timestamp of the converter creation, in milliseconds # noqa: E501 + + :return: The created_time of this Converter. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Converter. + + Timestamp of the converter creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Converter. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Converter. # noqa: E501 + + + :return: The tenant_id of this Converter. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Converter. + + + :param tenant_id: The tenant_id of this Converter. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this Converter. # noqa: E501 + + Unique Converter Name in scope of Tenant # noqa: E501 + + :return: The name of this Converter. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Converter. + + Unique Converter Name in scope of Tenant # noqa: E501 + + :param name: The name of this Converter. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Converter. # noqa: E501 + + The type of the converter to process incoming or outgoing messages # noqa: E501 + + :return: The type of this Converter. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Converter. + + The type of the converter to process incoming or outgoing messages # noqa: E501 + + :param type: The type of this Converter. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["DOWNLINK", "UPLINK"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def debug_mode(self): + """Gets the debug_mode of this Converter. # noqa: E501 + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :return: The debug_mode of this Converter. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this Converter. + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :param debug_mode: The debug_mode of this Converter. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def configuration(self): + """Gets the configuration of this Converter. # noqa: E501 + + + :return: The configuration of this Converter. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Converter. + + + :param configuration: The configuration of this Converter. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this Converter. # noqa: E501 + + + :return: The additional_info of this Converter. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Converter. + + + :param additional_info: The additional_info of this Converter. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def edge_template(self): + """Gets the edge_template of this Converter. # noqa: E501 + + Boolean flag that specifies that is regular or edge template converter # noqa: E501 + + :return: The edge_template of this Converter. # noqa: E501 + :rtype: bool + """ + return self._edge_template + + @edge_template.setter + def edge_template(self, edge_template): + """Sets the edge_template of this Converter. + + Boolean flag that specifies that is regular or edge template converter # noqa: E501 + + :param edge_template: The edge_template of this Converter. # noqa: E501 + :type: bool + """ + + self._edge_template = edge_template + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Converter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Converter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/converter_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/converter_id.py new file mode 100644 index 0000000..e466395 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/converter_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ConverterId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """ConverterId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this ConverterId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this ConverterId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ConverterId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this ConverterId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this ConverterId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this ConverterId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this ConverterId. + + string # noqa: E501 + + :param entity_type: The entity_type of this ConverterId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["CONVERTER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ConverterId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ConverterId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/custom_menu.py b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_menu.py new file mode 100644 index 0000000..c1b5efc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_menu.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomMenu(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'disabled_menu_items': 'list[str]', + 'menu_items': 'list[CustomMenuItem]' + } + + attribute_map = { + 'disabled_menu_items': 'disabledMenuItems', + 'menu_items': 'menuItems' + } + + def __init__(self, disabled_menu_items=None, menu_items=None): # noqa: E501 + """CustomMenu - a model defined in Swagger""" # noqa: E501 + self._disabled_menu_items = None + self._menu_items = None + self.discriminator = None + self.disabled_menu_items = disabled_menu_items + self.menu_items = menu_items + + @property + def disabled_menu_items(self): + """Gets the disabled_menu_items of this CustomMenu. # noqa: E501 + + List of disabled regular menu items # noqa: E501 + + :return: The disabled_menu_items of this CustomMenu. # noqa: E501 + :rtype: list[str] + """ + return self._disabled_menu_items + + @disabled_menu_items.setter + def disabled_menu_items(self, disabled_menu_items): + """Sets the disabled_menu_items of this CustomMenu. + + List of disabled regular menu items # noqa: E501 + + :param disabled_menu_items: The disabled_menu_items of this CustomMenu. # noqa: E501 + :type: list[str] + """ + if disabled_menu_items is None: + raise ValueError("Invalid value for `disabled_menu_items`, must not be `None`") # noqa: E501 + + self._disabled_menu_items = disabled_menu_items + + @property + def menu_items(self): + """Gets the menu_items of this CustomMenu. # noqa: E501 + + List of custom menu items # noqa: E501 + + :return: The menu_items of this CustomMenu. # noqa: E501 + :rtype: list[CustomMenuItem] + """ + return self._menu_items + + @menu_items.setter + def menu_items(self, menu_items): + """Sets the menu_items of this CustomMenu. + + List of custom menu items # noqa: E501 + + :param menu_items: The menu_items of this CustomMenu. # noqa: E501 + :type: list[CustomMenuItem] + """ + if menu_items is None: + raise ValueError("Invalid value for `menu_items`, must not be `None`") # noqa: E501 + + self._menu_items = menu_items + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomMenu, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomMenu): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/custom_menu_item.py b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_menu_item.py new file mode 100644 index 0000000..3858430 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_menu_item.py @@ -0,0 +1,323 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomMenuItem(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'icon_url': 'str', + 'material_icon': 'str', + 'iframe_url': 'str', + 'dashboard_id': 'str', + 'hide_dashboard_toolbar': 'bool', + 'set_access_token': 'bool', + 'child_menu_items': 'list[CustomMenuItem]' + } + + attribute_map = { + 'name': 'name', + 'icon_url': 'iconUrl', + 'material_icon': 'materialIcon', + 'iframe_url': 'iframeUrl', + 'dashboard_id': 'dashboardId', + 'hide_dashboard_toolbar': 'hideDashboardToolbar', + 'set_access_token': 'setAccessToken', + 'child_menu_items': 'childMenuItems' + } + + def __init__(self, name=None, icon_url=None, material_icon=None, iframe_url=None, dashboard_id=None, hide_dashboard_toolbar=None, set_access_token=None, child_menu_items=None): # noqa: E501 + """CustomMenuItem - a model defined in Swagger""" # noqa: E501 + self._name = None + self._icon_url = None + self._material_icon = None + self._iframe_url = None + self._dashboard_id = None + self._hide_dashboard_toolbar = None + self._set_access_token = None + self._child_menu_items = None + self.discriminator = None + self.name = name + if icon_url is not None: + self.icon_url = icon_url + if material_icon is not None: + self.material_icon = material_icon + if iframe_url is not None: + self.iframe_url = iframe_url + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + if set_access_token is not None: + self.set_access_token = set_access_token + if child_menu_items is not None: + self.child_menu_items = child_menu_items + + @property + def name(self): + """Gets the name of this CustomMenuItem. # noqa: E501 + + Name of the menu item # noqa: E501 + + :return: The name of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this CustomMenuItem. + + Name of the menu item # noqa: E501 + + :param name: The name of this CustomMenuItem. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def icon_url(self): + """Gets the icon_url of this CustomMenuItem. # noqa: E501 + + URL of the menu item icon. Overrides 'materialIcon' # noqa: E501 + + :return: The icon_url of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._icon_url + + @icon_url.setter + def icon_url(self, icon_url): + """Sets the icon_url of this CustomMenuItem. + + URL of the menu item icon. Overrides 'materialIcon' # noqa: E501 + + :param icon_url: The icon_url of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._icon_url = icon_url + + @property + def material_icon(self): + """Gets the material_icon of this CustomMenuItem. # noqa: E501 + + Material icon name. See [Material Icons](https://fonts.google.com/icons?selected=Material+Icons) for examples # noqa: E501 + + :return: The material_icon of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._material_icon + + @material_icon.setter + def material_icon(self, material_icon): + """Sets the material_icon of this CustomMenuItem. + + Material icon name. See [Material Icons](https://fonts.google.com/icons?selected=Material+Icons) for examples # noqa: E501 + + :param material_icon: The material_icon of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._material_icon = material_icon + + @property + def iframe_url(self): + """Gets the iframe_url of this CustomMenuItem. # noqa: E501 + + URL to open in the iframe, when user clicks the menu item # noqa: E501 + + :return: The iframe_url of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._iframe_url + + @iframe_url.setter + def iframe_url(self, iframe_url): + """Sets the iframe_url of this CustomMenuItem. + + URL to open in the iframe, when user clicks the menu item # noqa: E501 + + :param iframe_url: The iframe_url of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._iframe_url = iframe_url + + @property + def dashboard_id(self): + """Gets the dashboard_id of this CustomMenuItem. # noqa: E501 + + Id of the Dashboard to open, when user clicks the menu item # noqa: E501 + + :return: The dashboard_id of this CustomMenuItem. # noqa: E501 + :rtype: str + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this CustomMenuItem. + + Id of the Dashboard to open, when user clicks the menu item # noqa: E501 + + :param dashboard_id: The dashboard_id of this CustomMenuItem. # noqa: E501 + :type: str + """ + + self._dashboard_id = dashboard_id + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this CustomMenuItem. # noqa: E501 + + Hide the dashboard toolbar # noqa: E501 + + :return: The hide_dashboard_toolbar of this CustomMenuItem. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this CustomMenuItem. + + Hide the dashboard toolbar # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this CustomMenuItem. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def set_access_token(self): + """Gets the set_access_token of this CustomMenuItem. # noqa: E501 + + Set the access token of the current user to a new dashboard # noqa: E501 + + :return: The set_access_token of this CustomMenuItem. # noqa: E501 + :rtype: bool + """ + return self._set_access_token + + @set_access_token.setter + def set_access_token(self, set_access_token): + """Sets the set_access_token of this CustomMenuItem. + + Set the access token of the current user to a new dashboard # noqa: E501 + + :param set_access_token: The set_access_token of this CustomMenuItem. # noqa: E501 + :type: bool + """ + + self._set_access_token = set_access_token + + @property + def child_menu_items(self): + """Gets the child_menu_items of this CustomMenuItem. # noqa: E501 + + List of child menu items # noqa: E501 + + :return: The child_menu_items of this CustomMenuItem. # noqa: E501 + :rtype: list[CustomMenuItem] + """ + return self._child_menu_items + + @child_menu_items.setter + def child_menu_items(self, child_menu_items): + """Sets the child_menu_items of this CustomMenuItem. + + List of child menu items # noqa: E501 + + :param child_menu_items: The child_menu_items of this CustomMenuItem. # noqa: E501 + :type: list[CustomMenuItem] + """ + + self._child_menu_items = child_menu_items + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomMenuItem, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomMenuItem): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/custom_time_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_time_schedule.py new file mode 100644 index 0000000..c8cd452 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_time_schedule.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic_value': 'DynamicValuestring', + 'items': 'list[CustomTimeScheduleItem]', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'dynamic_value': 'dynamicValue', + 'items': 'items', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, dynamic_value=None, items=None, timezone=None, type=None): # noqa: E501 + """CustomTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._dynamic_value = None + self._items = None + self._timezone = None + self._type = None + self.discriminator = None + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if items is not None: + self.items = items + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def dynamic_value(self): + """Gets the dynamic_value of this CustomTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this CustomTimeSchedule. + + + :param dynamic_value: The dynamic_value of this CustomTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def items(self): + """Gets the items of this CustomTimeSchedule. # noqa: E501 + + + :return: The items of this CustomTimeSchedule. # noqa: E501 + :rtype: list[CustomTimeScheduleItem] + """ + return self._items + + @items.setter + def items(self, items): + """Sets the items of this CustomTimeSchedule. + + + :param items: The items of this CustomTimeSchedule. # noqa: E501 + :type: list[CustomTimeScheduleItem] + """ + + self._items = items + + @property + def timezone(self): + """Gets the timezone of this CustomTimeSchedule. # noqa: E501 + + + :return: The timezone of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this CustomTimeSchedule. + + + :param timezone: The timezone of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this CustomTimeSchedule. # noqa: E501 + + + :return: The type of this CustomTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this CustomTimeSchedule. + + + :param type: The type of this CustomTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/custom_time_schedule_item.py b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_time_schedule_item.py new file mode 100644 index 0000000..4011ddd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_time_schedule_item.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTimeScheduleItem(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'day_of_week': 'int', + 'enabled': 'bool', + 'ends_on': 'int', + 'starts_on': 'int' + } + + attribute_map = { + 'day_of_week': 'dayOfWeek', + 'enabled': 'enabled', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn' + } + + def __init__(self, day_of_week=None, enabled=None, ends_on=None, starts_on=None): # noqa: E501 + """CustomTimeScheduleItem - a model defined in Swagger""" # noqa: E501 + self._day_of_week = None + self._enabled = None + self._ends_on = None + self._starts_on = None + self.discriminator = None + if day_of_week is not None: + self.day_of_week = day_of_week + if enabled is not None: + self.enabled = enabled + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + + @property + def day_of_week(self): + """Gets the day_of_week of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._day_of_week + + @day_of_week.setter + def day_of_week(self, day_of_week): + """Sets the day_of_week of this CustomTimeScheduleItem. + + + :param day_of_week: The day_of_week of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._day_of_week = day_of_week + + @property + def enabled(self): + """Gets the enabled of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this CustomTimeScheduleItem. + + + :param enabled: The enabled of this CustomTimeScheduleItem. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def ends_on(self): + """Gets the ends_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this CustomTimeScheduleItem. + + + :param ends_on: The ends_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this CustomTimeScheduleItem. # noqa: E501 + + + :return: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this CustomTimeScheduleItem. + + + :param starts_on: The starts_on of this CustomTimeScheduleItem. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTimeScheduleItem, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTimeScheduleItem): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/custom_translation.py b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_translation.py new file mode 100644 index 0000000..e979623 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/custom_translation.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomTranslation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'translation_map': 'dict(str, str)' + } + + attribute_map = { + 'translation_map': 'translationMap' + } + + def __init__(self, translation_map=None): # noqa: E501 + """CustomTranslation - a model defined in Swagger""" # noqa: E501 + self._translation_map = None + self.discriminator = None + self.translation_map = translation_map + + @property + def translation_map(self): + """Gets the translation_map of this CustomTranslation. # noqa: E501 + + Map of locale IDs to stringified json object with custom translations # noqa: E501 + + :return: The translation_map of this CustomTranslation. # noqa: E501 + :rtype: dict(str, str) + """ + return self._translation_map + + @translation_map.setter + def translation_map(self, translation_map): + """Sets the translation_map of this CustomTranslation. + + Map of locale IDs to stringified json object with custom translations # noqa: E501 + + :param translation_map: The translation_map of this CustomTranslation. # noqa: E501 + :type: dict(str, str) + """ + if translation_map is None: + raise ValueError("Invalid value for `translation_map`, must not be `None`") # noqa: E501 + + self._translation_map = translation_map + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomTranslation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomTranslation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/customer.py b/tb-rest-client/python/tb_rest_client/models/models_pe/customer.py new file mode 100644 index 0000000..4492a3c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/customer.py @@ -0,0 +1,567 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Customer(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'CustomerId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'tenant_id': 'TenantId', + 'parent_customer_id': 'CustomerId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'tenant_id': 'tenantId', + 'parent_customer_id': 'parentCustomerId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, title=None, external_id=None, name=None, tenant_id=None, parent_customer_id=None, customer_id=None, owner_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None): # noqa: E501 + """Customer - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._tenant_id = None + self._parent_customer_id = None + self._customer_id = None + self._owner_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self._external_id = None + self.external_id = external_id + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + self.tenant_id = tenant_id + if parent_customer_id is not None: + self.parent_customer_id = parent_customer_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def id(self): + """Gets the id of this Customer. # noqa: E501 + + + :return: The id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Customer. + + + :param id: The id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Customer. # noqa: E501 + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :return: The created_time of this Customer. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Customer. + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Customer. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this Customer. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The title of this Customer. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Customer. + + Title of the customer # noqa: E501 + + :param title: The title of this Customer. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this Customer. # noqa: E501 + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this Customer. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Customer. + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this Customer. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this Customer. # noqa: E501 + + + :return: The tenant_id of this Customer. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Customer. + + + :param tenant_id: The tenant_id of this Customer. # noqa: E501 + :type: TenantId + """ + # if tenant_id is None: + # raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def parent_customer_id(self): + """Gets the parent_customer_id of this Customer. # noqa: E501 + + + :return: The parent_customer_id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._parent_customer_id + + @parent_customer_id.setter + def parent_customer_id(self, parent_customer_id): + """Sets the parent_customer_id of this Customer. + + + :param parent_customer_id: The parent_customer_id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._parent_customer_id = parent_customer_id + + @property + def customer_id(self): + """Gets the customer_id of this Customer. # noqa: E501 + + + :return: The customer_id of this Customer. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Customer. + + + :param customer_id: The customer_id of this Customer. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Customer. # noqa: E501 + + + :return: The owner_id of this Customer. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Customer. + + + :param owner_id: The owner_id of this Customer. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def country(self): + """Gets the country of this Customer. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this Customer. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this Customer. + + Country # noqa: E501 + + :param country: The country of this Customer. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this Customer. # noqa: E501 + + State # noqa: E501 + + :return: The state of this Customer. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this Customer. + + State # noqa: E501 + + :param state: The state of this Customer. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this Customer. # noqa: E501 + + City # noqa: E501 + + :return: The city of this Customer. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this Customer. + + City # noqa: E501 + + :param city: The city of this Customer. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this Customer. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this Customer. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this Customer. + + Address Line 1 # noqa: E501 + + :param address: The address of this Customer. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this Customer. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this Customer. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this Customer. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this Customer. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this Customer. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this Customer. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this Customer. + + Zip code # noqa: E501 + + :param zip: The zip of this Customer. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this Customer. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this Customer. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this Customer. + + Phone number # noqa: E501 + + :param phone: The phone of this Customer. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this Customer. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this Customer. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this Customer. + + Email # noqa: E501 + + :param email: The email of this Customer. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this Customer. # noqa: E501 + + + :return: The additional_info of this Customer. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Customer. + + + :param additional_info: The additional_info of this Customer. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Customer, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Customer): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/customer_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/customer_id.py new file mode 100644 index 0000000..5fe6246 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/customer_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """CustomerId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this CustomerId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CustomerId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this CustomerId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this CustomerId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this CustomerId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this CustomerId. + + string # noqa: E501 + + :param entity_type: The entity_type of this CustomerId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/customer_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/customer_info.py new file mode 100644 index 0000000..9ece70e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/customer_info.py @@ -0,0 +1,611 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class CustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'CustomerId', + 'created_time': 'int', + 'title': 'str', + 'name': 'str', + 'tenant_id': 'TenantId', + 'parent_customer_id': 'CustomerId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'country': 'str', + 'state': 'str', + 'city': 'str', + 'address': 'str', + 'address2': 'str', + 'zip': 'str', + 'phone': 'str', + 'email': 'str', + 'additional_info': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'title': 'title', + 'name': 'name', + 'tenant_id': 'tenantId', + 'parent_customer_id': 'parentCustomerId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'country': 'country', + 'state': 'state', + 'city': 'city', + 'address': 'address', + 'address2': 'address2', + 'zip': 'zip', + 'phone': 'phone', + 'email': 'email', + 'additional_info': 'additionalInfo', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, id=None, created_time=None, title=None, name=None, tenant_id=None, parent_customer_id=None, customer_id=None, owner_id=None, country=None, state=None, city=None, address=None, address2=None, zip=None, phone=None, email=None, additional_info=None, owner_name=None, groups=None): # noqa: E501 + """CustomerInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._title = None + self._name = None + self._tenant_id = None + self._parent_customer_id = None + self._customer_id = None + self._owner_id = None + self._country = None + self._state = None + self._city = None + self._address = None + self._address2 = None + self._zip = None + self._phone = None + self._email = None + self._additional_info = None + self._owner_name = None + self._groups = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if title is not None: + self.title = title + if name is not None: + self.name = name + self.tenant_id = tenant_id + if parent_customer_id is not None: + self.parent_customer_id = parent_customer_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.country = country + self.state = state + self.city = city + self.address = address + self.address2 = address2 + self.zip = zip + self.phone = phone + self.email = email + if additional_info is not None: + self.additional_info = additional_info + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this CustomerInfo. # noqa: E501 + + + :return: The id of this CustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CustomerInfo. + + + :param id: The id of this CustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this CustomerInfo. # noqa: E501 + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :return: The created_time of this CustomerInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this CustomerInfo. + + Timestamp of the customer creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this CustomerInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def title(self): + """Gets the title of this CustomerInfo. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The title of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this CustomerInfo. + + Title of the customer # noqa: E501 + + :param title: The title of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def name(self): + """Gets the name of this CustomerInfo. # noqa: E501 + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :return: The name of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this CustomerInfo. + + Name of the customer. Read-only, duplicated from title for backward compatibility # noqa: E501 + + :param name: The name of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def tenant_id(self): + """Gets the tenant_id of this CustomerInfo. # noqa: E501 + + + :return: The tenant_id of this CustomerInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this CustomerInfo. + + + :param tenant_id: The tenant_id of this CustomerInfo. # noqa: E501 + :type: TenantId + """ + if tenant_id is None: + raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def parent_customer_id(self): + """Gets the parent_customer_id of this CustomerInfo. # noqa: E501 + + + :return: The parent_customer_id of this CustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._parent_customer_id + + @parent_customer_id.setter + def parent_customer_id(self, parent_customer_id): + """Sets the parent_customer_id of this CustomerInfo. + + + :param parent_customer_id: The parent_customer_id of this CustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._parent_customer_id = parent_customer_id + + @property + def customer_id(self): + """Gets the customer_id of this CustomerInfo. # noqa: E501 + + + :return: The customer_id of this CustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this CustomerInfo. + + + :param customer_id: The customer_id of this CustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this CustomerInfo. # noqa: E501 + + + :return: The owner_id of this CustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this CustomerInfo. + + + :param owner_id: The owner_id of this CustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def country(self): + """Gets the country of this CustomerInfo. # noqa: E501 + + Country # noqa: E501 + + :return: The country of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._country + + @country.setter + def country(self, country): + """Sets the country of this CustomerInfo. + + Country # noqa: E501 + + :param country: The country of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._country = country + + @property + def state(self): + """Gets the state of this CustomerInfo. # noqa: E501 + + State # noqa: E501 + + :return: The state of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this CustomerInfo. + + State # noqa: E501 + + :param state: The state of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def city(self): + """Gets the city of this CustomerInfo. # noqa: E501 + + City # noqa: E501 + + :return: The city of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._city + + @city.setter + def city(self, city): + """Sets the city of this CustomerInfo. + + City # noqa: E501 + + :param city: The city of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._city = city + + @property + def address(self): + """Gets the address of this CustomerInfo. # noqa: E501 + + Address Line 1 # noqa: E501 + + :return: The address of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """Sets the address of this CustomerInfo. + + Address Line 1 # noqa: E501 + + :param address: The address of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._address = address + + @property + def address2(self): + """Gets the address2 of this CustomerInfo. # noqa: E501 + + Address Line 2 # noqa: E501 + + :return: The address2 of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._address2 + + @address2.setter + def address2(self, address2): + """Sets the address2 of this CustomerInfo. + + Address Line 2 # noqa: E501 + + :param address2: The address2 of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._address2 = address2 + + @property + def zip(self): + """Gets the zip of this CustomerInfo. # noqa: E501 + + Zip code # noqa: E501 + + :return: The zip of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._zip + + @zip.setter + def zip(self, zip): + """Sets the zip of this CustomerInfo. + + Zip code # noqa: E501 + + :param zip: The zip of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._zip = zip + + @property + def phone(self): + """Gets the phone of this CustomerInfo. # noqa: E501 + + Phone number # noqa: E501 + + :return: The phone of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this CustomerInfo. + + Phone number # noqa: E501 + + :param phone: The phone of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def email(self): + """Gets the email of this CustomerInfo. # noqa: E501 + + Email # noqa: E501 + + :return: The email of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this CustomerInfo. + + Email # noqa: E501 + + :param email: The email of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def additional_info(self): + """Gets the additional_info of this CustomerInfo. # noqa: E501 + + + :return: The additional_info of this CustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this CustomerInfo. + + + :param additional_info: The additional_info of this CustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_name(self): + """Gets the owner_name of this CustomerInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this CustomerInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this CustomerInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this CustomerInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this CustomerInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this CustomerInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this CustomerInfo. + + Groups # noqa: E501 + + :param groups: The groups of this CustomerInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/customer_users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/customer_users_filter.py new file mode 100644 index 0000000..86267b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/customer_users_filter.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class CustomerUsersFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'customer_id': 'str' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'customer_id': 'customerId' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, customer_id=None, *args, **kwargs): # noqa: E501 + """CustomerUsersFilter - a model defined in Swagger""" # noqa: E501 + self._customer_id = None + self.discriminator = None + self.customer_id = customer_id + UsersFilter.__init__(self, *args, **kwargs) + + @property + def customer_id(self): + """Gets the customer_id of this CustomerUsersFilter. # noqa: E501 + + + :return: The customer_id of this CustomerUsersFilter. # noqa: E501 + :rtype: str + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this CustomerUsersFilter. + + + :param customer_id: The customer_id of this CustomerUsersFilter. # noqa: E501 + :type: str + """ + if customer_id is None: + raise ValueError("Invalid value for `customer_id`, must not be `None`") # noqa: E501 + + self._customer_id = customer_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(CustomerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CustomerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard.py new file mode 100644 index 0000000..56192fb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard.py @@ -0,0 +1,436 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Dashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'title': 'str', + 'image': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'name': 'str', + 'configuration': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'title': 'title', + 'image': 'image', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'name': 'name', + 'configuration': 'configuration', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, title=None, image=None, assigned_customers=None, mobile_hide=None, mobile_order=None, name=None, configuration=None): # noqa: E501 + """Dashboard - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._title = None + self._image = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._name = None + self._configuration = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if title is not None: + self.title = title + if image is not None: + self.image = image + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if name is not None: + self.name = name + if configuration is not None: + self.configuration = configuration + + @property + def id(self): + """Gets the id of this Dashboard. # noqa: E501 + + + :return: The id of this Dashboard. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Dashboard. + + + :param id: The id of this Dashboard. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Dashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Dashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Dashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Dashboard. # noqa: E501 + + + :return: The tenant_id of this Dashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Dashboard. + + + :param tenant_id: The tenant_id of this Dashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Dashboard. # noqa: E501 + + + :return: The customer_id of this Dashboard. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Dashboard. + + + :param customer_id: The customer_id of this Dashboard. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Dashboard. # noqa: E501 + + + :return: The owner_id of this Dashboard. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Dashboard. + + + :param owner_id: The owner_id of this Dashboard. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def title(self): + """Gets the title of this Dashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this Dashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this Dashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this Dashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this Dashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this Dashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def assigned_customers(self): + """Gets the assigned_customers of this Dashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this Dashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this Dashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this Dashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this Dashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this Dashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this Dashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this Dashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this Dashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this Dashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this Dashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this Dashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def name(self): + """Gets the name of this Dashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this Dashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Dashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this Dashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def configuration(self): + """Gets the configuration of this Dashboard. # noqa: E501 + + + :return: The configuration of this Dashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Dashboard. + + + :param configuration: The configuration of this Dashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Dashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Dashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard_id.py new file mode 100644 index 0000000..d797776 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DashboardId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DashboardId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DashboardId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DashboardId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DashboardId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DashboardId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DashboardId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DASHBOARD"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard_info.py new file mode 100644 index 0000000..9470c88 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dashboard_info.py @@ -0,0 +1,492 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'title': 'str', + 'image': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'name': 'str', + 'configuration': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'title': 'title', + 'image': 'image', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'name': 'name', + 'configuration': 'configuration', + 'owner_name': 'ownerName', + 'groups': 'groups', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, title=None, image=None, assigned_customers=None, mobile_hide=None, mobile_order=None, name=None, configuration=None, owner_name=None, groups=None): # noqa: E501 + """DashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._title = None + self._image = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._name = None + self._configuration = None + self._owner_name = None + self._groups = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if title is not None: + self.title = title + if image is not None: + self.image = image + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if name is not None: + self.name = name + if configuration is not None: + self.configuration = configuration + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this DashboardInfo. # noqa: E501 + + + :return: The id of this DashboardInfo. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DashboardInfo. + + + :param id: The id of this DashboardInfo. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this DashboardInfo. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DashboardInfo. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DashboardInfo. # noqa: E501 + + + :return: The tenant_id of this DashboardInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DashboardInfo. + + + :param tenant_id: The tenant_id of this DashboardInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this DashboardInfo. # noqa: E501 + + + :return: The customer_id of this DashboardInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this DashboardInfo. + + + :param customer_id: The customer_id of this DashboardInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this DashboardInfo. # noqa: E501 + + + :return: The owner_id of this DashboardInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this DashboardInfo. + + + :param owner_id: The owner_id of this DashboardInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def title(self): + """Gets the title of this DashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this DashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this DashboardInfo. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this DashboardInfo. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def assigned_customers(self): + """Gets the assigned_customers of this DashboardInfo. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this DashboardInfo. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this DashboardInfo. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this DashboardInfo. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this DashboardInfo. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this DashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this DashboardInfo. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this DashboardInfo. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this DashboardInfo. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this DashboardInfo. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this DashboardInfo. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this DashboardInfo. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def name(self): + """Gets the name of this DashboardInfo. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DashboardInfo. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def configuration(self): + """Gets the configuration of this DashboardInfo. # noqa: E501 + + + :return: The configuration of this DashboardInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DashboardInfo. + + + :param configuration: The configuration of this DashboardInfo. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def owner_name(self): + """Gets the owner_name of this DashboardInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this DashboardInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this DashboardInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this DashboardInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this DashboardInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this DashboardInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this DashboardInfo. + + Groups # noqa: E501 + + :param groups: The groups of this DashboardInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/debug_converter_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_converter_event_filter.py new file mode 100644 index 0000000..2f15669 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_converter_event_filter.py @@ -0,0 +1,351 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class DebugConverterEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + '_in': 'str', + 'metadata': 'str', + 'not_empty': 'bool', + 'out': 'str', + 'type': 'str', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + '_in': 'in', + 'metadata': 'metadata', + 'not_empty': 'notEmpty', + 'out': 'out', + 'type': 'type', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, _in=None, metadata=None, not_empty=None, out=None, type=None, event_type=None, server=None, error_str=None, *args, **kwargs): # noqa: E501 + """DebugConverterEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self.__in = None + self._metadata = None + self._not_empty = None + self._out = None + self._type = None + self._event_type = None + self._server = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if _in is not None: + self._in = _in + if metadata is not None: + self.metadata = metadata + if not_empty is not None: + self.not_empty = not_empty + if out is not None: + self.out = out + if type is not None: + self.type = type + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugConverterEventFilter. # noqa: E501 + + + :return: The error of this DebugConverterEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugConverterEventFilter. + + + :param error: The error of this DebugConverterEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def _in(self): + """Gets the _in of this DebugConverterEventFilter. # noqa: E501 + + + :return: The _in of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self.__in + + @_in.setter + def _in(self, _in): + """Sets the _in of this DebugConverterEventFilter. + + + :param _in: The _in of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self.__in = _in + + @property + def metadata(self): + """Gets the metadata of this DebugConverterEventFilter. # noqa: E501 + + + :return: The metadata of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this DebugConverterEventFilter. + + + :param metadata: The metadata of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._metadata = metadata + + @property + def not_empty(self): + """Gets the not_empty of this DebugConverterEventFilter. # noqa: E501 + + + :return: The not_empty of this DebugConverterEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this DebugConverterEventFilter. + + + :param not_empty: The not_empty of this DebugConverterEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def out(self): + """Gets the out of this DebugConverterEventFilter. # noqa: E501 + + + :return: The out of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._out + + @out.setter + def out(self, out): + """Sets the out of this DebugConverterEventFilter. + + + :param out: The out of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._out = out + + @property + def type(self): + """Gets the type of this DebugConverterEventFilter. # noqa: E501 + + + :return: The type of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DebugConverterEventFilter. + + + :param type: The type of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def event_type(self): + """Gets the event_type of this DebugConverterEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugConverterEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugConverterEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugConverterEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugConverterEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugConverterEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugConverterEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugConverterEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugConverterEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugConverterEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/debug_integration_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_integration_event_filter.py new file mode 100644 index 0000000..ff0a09e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_integration_event_filter.py @@ -0,0 +1,325 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class DebugIntegrationEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'message': 'str', + 'not_empty': 'bool', + 'status_integration': 'str', + 'type': 'str', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'message': 'message', + 'not_empty': 'notEmpty', + 'status_integration': 'statusIntegration', + 'type': 'type', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, message=None, not_empty=None, status_integration=None, type=None, event_type=None, server=None, error_str=None, *args, **kwargs): # noqa: E501 + """DebugIntegrationEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._message = None + self._not_empty = None + self._status_integration = None + self._type = None + self._event_type = None + self._server = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if message is not None: + self.message = message + if not_empty is not None: + self.not_empty = not_empty + if status_integration is not None: + self.status_integration = status_integration + if type is not None: + self.type = type + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The error of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugIntegrationEventFilter. + + + :param error: The error of this DebugIntegrationEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def message(self): + """Gets the message of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The message of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this DebugIntegrationEventFilter. + + + :param message: The message of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def not_empty(self): + """Gets the not_empty of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The not_empty of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this DebugIntegrationEventFilter. + + + :param not_empty: The not_empty of this DebugIntegrationEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def status_integration(self): + """Gets the status_integration of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The status_integration of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._status_integration + + @status_integration.setter + def status_integration(self, status_integration): + """Sets the status_integration of this DebugIntegrationEventFilter. + + + :param status_integration: The status_integration of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._status_integration = status_integration + + @property + def type(self): + """Gets the type of this DebugIntegrationEventFilter. # noqa: E501 + + + :return: The type of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DebugIntegrationEventFilter. + + + :param type: The type of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def event_type(self): + """Gets the event_type of this DebugIntegrationEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugIntegrationEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugIntegrationEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugIntegrationEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugIntegrationEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugIntegrationEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugIntegrationEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugIntegrationEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugIntegrationEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugIntegrationEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/debug_rule_chain_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_rule_chain_event_filter.py new file mode 100644 index 0000000..3564e44 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_rule_chain_event_filter.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .event_filter import EventFilter # noqa: F401,E501 + +class DebugRuleChainEventFilter(EventFilter): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str', + 'msg_direction_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'entity_name': 'str', + 'relation_type': 'str', + 'entity_id': 'str', + 'msg_type': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr', + 'msg_direction_type': 'msgDirectionType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'entity_name': 'entityName', + 'relation_type': 'relationType', + 'entity_id': 'entityId', + 'msg_type': 'msgType' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, event_type=None, server=None, error_str=None, msg_direction_type=None, data_search=None, metadata_search=None, entity_name=None, relation_type=None, entity_id=None, msg_type=None, *args, **kwargs): # noqa: E501 + """DebugRuleChainEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._event_type = None + self._server = None + self._error_str = None + self._msg_direction_type = None + self._data_search = None + self._metadata_search = None + self._entity_name = None + self._relation_type = None + self._entity_id = None + self._msg_type = None + self.discriminator = None + if error is not None: + self.error = error + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if entity_name is not None: + self.entity_name = entity_name + if relation_type is not None: + self.relation_type = relation_type + if entity_id is not None: + self.entity_id = entity_id + if msg_type is not None: + self.msg_type = msg_type + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugRuleChainEventFilter. # noqa: E501 + + + :return: The error of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugRuleChainEventFilter. + + + :param error: The error of this DebugRuleChainEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def event_type(self): + """Gets the event_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugRuleChainEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugRuleChainEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this DebugRuleChainEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def data_search(self): + """Gets the data_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this DebugRuleChainEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def entity_name(self): + """Gets the entity_name of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this DebugRuleChainEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_name: The entity_name of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_name not in allowed_values: + raise ValueError( + "Invalid value for `entity_name` ({0}), must be one of {1}" # noqa: E501 + .format(entity_name, allowed_values) + ) + + self._entity_name = entity_name + + @property + def relation_type(self): + """Gets the relation_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DebugRuleChainEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_id(self): + """Gets the entity_id of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this DebugRuleChainEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def msg_type(self): + """Gets the msg_type of this DebugRuleChainEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this DebugRuleChainEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this DebugRuleChainEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugRuleChainEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugRuleChainEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/debug_rule_node_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_rule_node_event_filter.py new file mode 100644 index 0000000..8afc612 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/debug_rule_node_event_filter.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .event_filter import EventFilter # noqa: F401,E501 + +class DebugRuleNodeEventFilter(EventFilter): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'event_type': 'str', + 'server': 'str', + 'error_str': 'str', + 'msg_direction_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str', + 'entity_name': 'str', + 'relation_type': 'str', + 'entity_id': 'str', + 'msg_type': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'event_type': 'eventType', + 'server': 'server', + 'error_str': 'errorStr', + 'msg_direction_type': 'msgDirectionType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch', + 'entity_name': 'entityName', + 'relation_type': 'relationType', + 'entity_id': 'entityId', + 'msg_type': 'msgType' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, event_type=None, server=None, error_str=None, msg_direction_type=None, data_search=None, metadata_search=None, entity_name=None, relation_type=None, entity_id=None, msg_type=None, *args, **kwargs): # noqa: E501 + """DebugRuleNodeEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._event_type = None + self._server = None + self._error_str = None + self._msg_direction_type = None + self._data_search = None + self._metadata_search = None + self._entity_name = None + self._relation_type = None + self._entity_id = None + self._msg_type = None + self.discriminator = None + if error is not None: + self.error = error + self.event_type = event_type + if server is not None: + self.server = server + if error_str is not None: + self.error_str = error_str + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + if entity_name is not None: + self.entity_name = entity_name + if relation_type is not None: + self.relation_type = relation_type + if entity_id is not None: + self.entity_id = entity_id + if msg_type is not None: + self.msg_type = msg_type + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this DebugRuleNodeEventFilter. # noqa: E501 + + + :return: The error of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this DebugRuleNodeEventFilter. + + + :param error: The error of this DebugRuleNodeEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def event_type(self): + """Gets the event_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this DebugRuleNodeEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this DebugRuleNodeEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def error_str(self): + """Gets the error_str of this DebugRuleNodeEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this DebugRuleNodeEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this DebugRuleNodeEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def data_search(self): + """Gets the data_search of this DebugRuleNodeEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this DebugRuleNodeEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this DebugRuleNodeEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this DebugRuleNodeEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + @property + def entity_name(self): + """Gets the entity_name of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_name of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name + + @entity_name.setter + def entity_name(self, entity_name): + """Sets the entity_name of this DebugRuleNodeEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_name: The entity_name of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_name not in allowed_values: + raise ValueError( + "Invalid value for `entity_name` ({0}), must be one of {1}" # noqa: E501 + .format(entity_name, allowed_values) + ) + + self._entity_name = entity_name + + @property + def relation_type(self): + """Gets the relation_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DebugRuleNodeEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_id(self): + """Gets the entity_id of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this DebugRuleNodeEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def msg_type(self): + """Gets the msg_type of this DebugRuleNodeEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this DebugRuleNodeEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this DebugRuleNodeEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this DebugRuleNodeEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DebugRuleNodeEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DebugRuleNodeEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/default_coap_device_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/default_coap_device_type_configuration.py new file mode 100644 index 0000000..1a894f5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/default_coap_device_type_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.coap_device_type_configuration import CoapDeviceTypeConfiguration # noqa: F401,E501 + +class DefaultCoapDeviceTypeConfiguration(CoapDeviceTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "swagger_types"): + swagger_types.update(CoapDeviceTypeConfiguration.swagger_types) + + attribute_map = { + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + if hasattr(CoapDeviceTypeConfiguration, "attribute_map"): + attribute_map.update(CoapDeviceTypeConfiguration.attribute_map) + + def __init__(self, transport_payload_type_configuration=None, *args, **kwargs): # noqa: E501 + """DefaultCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self._transport_payload_type_configuration = None + self.discriminator = None + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + CoapDeviceTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this DefaultCoapDeviceTypeConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_configuration.py new file mode 100644 index 0000000..dc2ea7f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_configuration import DeviceConfiguration # noqa: F401,E501 + +class DefaultDeviceConfiguration(DeviceConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceConfiguration, "swagger_types"): + swagger_types.update(DeviceConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceConfiguration, "attribute_map"): + attribute_map.update(DeviceConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_profile_configuration.py new file mode 100644 index 0000000..c172a4d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_profile_transport_configuration.py new file mode 100644 index 0000000..254ad36 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DefaultDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_transport_configuration.py new file mode 100644 index 0000000..d54447a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/default_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class DefaultDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """DefaultDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/default_rule_chain_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/default_rule_chain_create_request.py new file mode 100644 index 0000000..e5114c7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/default_rule_chain_create_request.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultRuleChainCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str' + } + + attribute_map = { + 'name': 'name' + } + + def __init__(self, name=None): # noqa: E501 + """DefaultRuleChainCreateRequest - a model defined in Swagger""" # noqa: E501 + self._name = None + self.discriminator = None + self.name = name + + @property + def name(self): + """Gets the name of this DefaultRuleChainCreateRequest. # noqa: E501 + + Name of the new rule chain # noqa: E501 + + :return: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DefaultRuleChainCreateRequest. + + Name of the new rule chain # noqa: E501 + + :param name: The name of this DefaultRuleChainCreateRequest. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultRuleChainCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultRuleChainCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/default_tenant_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/default_tenant_profile_configuration.py new file mode 100644 index 0000000..f0892f0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/default_tenant_profile_configuration.py @@ -0,0 +1,1320 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DefaultTenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms_ttl_days': 'int', + 'cassandra_query_tenant_rate_limits_configuration': 'str', + 'customer_server_rest_limits_configuration': 'str', + 'default_storage_ttl_days': 'int', + 'max_assets': 'int', + 'max_converters': 'int', + 'max_created_alarms': 'int', + 'max_customers': 'int', + 'max_dp_storage_days': 'int', + 'max_dashboards': 'int', + 'max_devices': 'int', + 'max_emails': 'int', + 'max_integrations': 'int', + 'max_js_executions': 'int', + 'max_ota_packages_in_bytes': 'int', + 'max_re_executions': 'int', + 'max_resources_in_bytes': 'int', + 'max_rule_chains': 'int', + 'max_rule_node_executions_per_message': 'int', + 'max_scheduler_events': 'int', + 'max_sms': 'int', + 'max_transport_data_points': 'int', + 'max_transport_messages': 'int', + 'max_users': 'int', + 'max_ws_sessions_per_customer': 'int', + 'max_ws_sessions_per_public_user': 'int', + 'max_ws_sessions_per_regular_user': 'int', + 'max_ws_sessions_per_tenant': 'int', + 'max_ws_subscriptions_per_customer': 'int', + 'max_ws_subscriptions_per_public_user': 'int', + 'max_ws_subscriptions_per_regular_user': 'int', + 'max_ws_subscriptions_per_tenant': 'int', + 'rpc_ttl_days': 'int', + 'tenant_entity_export_rate_limit': 'str', + 'tenant_entity_import_rate_limit': 'str', + 'tenant_notification_requests_per_rule_rate_limit': 'str', + 'tenant_notification_requests_rate_limit': 'str', + 'tenant_server_rest_limits_configuration': 'str', + 'transport_device_msg_rate_limit': 'str', + 'transport_device_telemetry_data_points_rate_limit': 'str', + 'transport_device_telemetry_msg_rate_limit': 'str', + 'transport_tenant_msg_rate_limit': 'str', + 'transport_tenant_telemetry_data_points_rate_limit': 'str', + 'transport_tenant_telemetry_msg_rate_limit': 'str', + 'warn_threshold': 'float', + 'ws_msg_queue_limit_per_session': 'int', + 'ws_updates_per_session_rate_limit': 'str' + } + + attribute_map = { + 'alarms_ttl_days': 'alarmsTtlDays', + 'cassandra_query_tenant_rate_limits_configuration': 'cassandraQueryTenantRateLimitsConfiguration', + 'customer_server_rest_limits_configuration': 'customerServerRestLimitsConfiguration', + 'default_storage_ttl_days': 'defaultStorageTtlDays', + 'max_assets': 'maxAssets', + 'max_converters': 'maxConverters', + 'max_created_alarms': 'maxCreatedAlarms', + 'max_customers': 'maxCustomers', + 'max_dp_storage_days': 'maxDPStorageDays', + 'max_dashboards': 'maxDashboards', + 'max_devices': 'maxDevices', + 'max_emails': 'maxEmails', + 'max_integrations': 'maxIntegrations', + 'max_js_executions': 'maxJSExecutions', + 'max_ota_packages_in_bytes': 'maxOtaPackagesInBytes', + 'max_re_executions': 'maxREExecutions', + 'max_resources_in_bytes': 'maxResourcesInBytes', + 'max_rule_chains': 'maxRuleChains', + 'max_rule_node_executions_per_message': 'maxRuleNodeExecutionsPerMessage', + 'max_scheduler_events': 'maxSchedulerEvents', + 'max_sms': 'maxSms', + 'max_transport_data_points': 'maxTransportDataPoints', + 'max_transport_messages': 'maxTransportMessages', + 'max_users': 'maxUsers', + 'max_ws_sessions_per_customer': 'maxWsSessionsPerCustomer', + 'max_ws_sessions_per_public_user': 'maxWsSessionsPerPublicUser', + 'max_ws_sessions_per_regular_user': 'maxWsSessionsPerRegularUser', + 'max_ws_sessions_per_tenant': 'maxWsSessionsPerTenant', + 'max_ws_subscriptions_per_customer': 'maxWsSubscriptionsPerCustomer', + 'max_ws_subscriptions_per_public_user': 'maxWsSubscriptionsPerPublicUser', + 'max_ws_subscriptions_per_regular_user': 'maxWsSubscriptionsPerRegularUser', + 'max_ws_subscriptions_per_tenant': 'maxWsSubscriptionsPerTenant', + 'rpc_ttl_days': 'rpcTtlDays', + 'tenant_entity_export_rate_limit': 'tenantEntityExportRateLimit', + 'tenant_entity_import_rate_limit': 'tenantEntityImportRateLimit', + 'tenant_notification_requests_per_rule_rate_limit': 'tenantNotificationRequestsPerRuleRateLimit', + 'tenant_notification_requests_rate_limit': 'tenantNotificationRequestsRateLimit', + 'tenant_server_rest_limits_configuration': 'tenantServerRestLimitsConfiguration', + 'transport_device_msg_rate_limit': 'transportDeviceMsgRateLimit', + 'transport_device_telemetry_data_points_rate_limit': 'transportDeviceTelemetryDataPointsRateLimit', + 'transport_device_telemetry_msg_rate_limit': 'transportDeviceTelemetryMsgRateLimit', + 'transport_tenant_msg_rate_limit': 'transportTenantMsgRateLimit', + 'transport_tenant_telemetry_data_points_rate_limit': 'transportTenantTelemetryDataPointsRateLimit', + 'transport_tenant_telemetry_msg_rate_limit': 'transportTenantTelemetryMsgRateLimit', + 'warn_threshold': 'warnThreshold', + 'ws_msg_queue_limit_per_session': 'wsMsgQueueLimitPerSession', + 'ws_updates_per_session_rate_limit': 'wsUpdatesPerSessionRateLimit' + } + + def __init__(self, alarms_ttl_days=None, cassandra_query_tenant_rate_limits_configuration=None, customer_server_rest_limits_configuration=None, default_storage_ttl_days=None, max_assets=None, max_converters=None, max_created_alarms=None, max_customers=None, max_dp_storage_days=None, max_dashboards=None, max_devices=None, max_emails=None, max_integrations=None, max_js_executions=None, max_ota_packages_in_bytes=None, max_re_executions=None, max_resources_in_bytes=None, max_rule_chains=None, max_rule_node_executions_per_message=None, max_scheduler_events=None, max_sms=None, max_transport_data_points=None, max_transport_messages=None, max_users=None, max_ws_sessions_per_customer=None, max_ws_sessions_per_public_user=None, max_ws_sessions_per_regular_user=None, max_ws_sessions_per_tenant=None, max_ws_subscriptions_per_customer=None, max_ws_subscriptions_per_public_user=None, max_ws_subscriptions_per_regular_user=None, max_ws_subscriptions_per_tenant=None, rpc_ttl_days=None, tenant_entity_export_rate_limit=None, tenant_entity_import_rate_limit=None, tenant_notification_requests_per_rule_rate_limit=None, tenant_notification_requests_rate_limit=None, tenant_server_rest_limits_configuration=None, transport_device_msg_rate_limit=None, transport_device_telemetry_data_points_rate_limit=None, transport_device_telemetry_msg_rate_limit=None, transport_tenant_msg_rate_limit=None, transport_tenant_telemetry_data_points_rate_limit=None, transport_tenant_telemetry_msg_rate_limit=None, warn_threshold=None, ws_msg_queue_limit_per_session=None, ws_updates_per_session_rate_limit=None): # noqa: E501 + """DefaultTenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self._alarms_ttl_days = None + self._cassandra_query_tenant_rate_limits_configuration = None + self._customer_server_rest_limits_configuration = None + self._default_storage_ttl_days = None + self._max_assets = None + self._max_converters = None + self._max_created_alarms = None + self._max_customers = None + self._max_dp_storage_days = None + self._max_dashboards = None + self._max_devices = None + self._max_emails = None + self._max_integrations = None + self._max_js_executions = None + self._max_ota_packages_in_bytes = None + self._max_re_executions = None + self._max_resources_in_bytes = None + self._max_rule_chains = None + self._max_rule_node_executions_per_message = None + self._max_scheduler_events = None + self._max_sms = None + self._max_transport_data_points = None + self._max_transport_messages = None + self._max_users = None + self._max_ws_sessions_per_customer = None + self._max_ws_sessions_per_public_user = None + self._max_ws_sessions_per_regular_user = None + self._max_ws_sessions_per_tenant = None + self._max_ws_subscriptions_per_customer = None + self._max_ws_subscriptions_per_public_user = None + self._max_ws_subscriptions_per_regular_user = None + self._max_ws_subscriptions_per_tenant = None + self._rpc_ttl_days = None + self._tenant_entity_export_rate_limit = None + self._tenant_entity_import_rate_limit = None + self._tenant_notification_requests_per_rule_rate_limit = None + self._tenant_notification_requests_rate_limit = None + self._tenant_server_rest_limits_configuration = None + self._transport_device_msg_rate_limit = None + self._transport_device_telemetry_data_points_rate_limit = None + self._transport_device_telemetry_msg_rate_limit = None + self._transport_tenant_msg_rate_limit = None + self._transport_tenant_telemetry_data_points_rate_limit = None + self._transport_tenant_telemetry_msg_rate_limit = None + self._warn_threshold = None + self._ws_msg_queue_limit_per_session = None + self._ws_updates_per_session_rate_limit = None + self.discriminator = None + if alarms_ttl_days is not None: + self.alarms_ttl_days = alarms_ttl_days + if cassandra_query_tenant_rate_limits_configuration is not None: + self.cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + if customer_server_rest_limits_configuration is not None: + self.customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + if default_storage_ttl_days is not None: + self.default_storage_ttl_days = default_storage_ttl_days + if max_assets is not None: + self.max_assets = max_assets + if max_converters is not None: + self.max_converters = max_converters + if max_created_alarms is not None: + self.max_created_alarms = max_created_alarms + if max_customers is not None: + self.max_customers = max_customers + if max_dp_storage_days is not None: + self.max_dp_storage_days = max_dp_storage_days + if max_dashboards is not None: + self.max_dashboards = max_dashboards + if max_devices is not None: + self.max_devices = max_devices + if max_emails is not None: + self.max_emails = max_emails + if max_integrations is not None: + self.max_integrations = max_integrations + if max_js_executions is not None: + self.max_js_executions = max_js_executions + if max_ota_packages_in_bytes is not None: + self.max_ota_packages_in_bytes = max_ota_packages_in_bytes + if max_re_executions is not None: + self.max_re_executions = max_re_executions + if max_resources_in_bytes is not None: + self.max_resources_in_bytes = max_resources_in_bytes + if max_rule_chains is not None: + self.max_rule_chains = max_rule_chains + if max_rule_node_executions_per_message is not None: + self.max_rule_node_executions_per_message = max_rule_node_executions_per_message + if max_scheduler_events is not None: + self.max_scheduler_events = max_scheduler_events + if max_sms is not None: + self.max_sms = max_sms + if max_transport_data_points is not None: + self.max_transport_data_points = max_transport_data_points + if max_transport_messages is not None: + self.max_transport_messages = max_transport_messages + if max_users is not None: + self.max_users = max_users + if max_ws_sessions_per_customer is not None: + self.max_ws_sessions_per_customer = max_ws_sessions_per_customer + if max_ws_sessions_per_public_user is not None: + self.max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + if max_ws_sessions_per_regular_user is not None: + self.max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + if max_ws_sessions_per_tenant is not None: + self.max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + if max_ws_subscriptions_per_customer is not None: + self.max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + if max_ws_subscriptions_per_public_user is not None: + self.max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + if max_ws_subscriptions_per_regular_user is not None: + self.max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + if max_ws_subscriptions_per_tenant is not None: + self.max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + if rpc_ttl_days is not None: + self.rpc_ttl_days = rpc_ttl_days + if tenant_entity_export_rate_limit is not None: + self.tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + if tenant_entity_import_rate_limit is not None: + self.tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + if tenant_notification_requests_per_rule_rate_limit is not None: + self.tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + if tenant_notification_requests_rate_limit is not None: + self.tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + if tenant_server_rest_limits_configuration is not None: + self.tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + if transport_device_msg_rate_limit is not None: + self.transport_device_msg_rate_limit = transport_device_msg_rate_limit + if transport_device_telemetry_data_points_rate_limit is not None: + self.transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + if transport_device_telemetry_msg_rate_limit is not None: + self.transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + if transport_tenant_msg_rate_limit is not None: + self.transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + if transport_tenant_telemetry_data_points_rate_limit is not None: + self.transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + if transport_tenant_telemetry_msg_rate_limit is not None: + self.transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + if warn_threshold is not None: + self.warn_threshold = warn_threshold + if ws_msg_queue_limit_per_session is not None: + self.ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + if ws_updates_per_session_rate_limit is not None: + self.ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + @property + def alarms_ttl_days(self): + """Gets the alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._alarms_ttl_days + + @alarms_ttl_days.setter + def alarms_ttl_days(self, alarms_ttl_days): + """Sets the alarms_ttl_days of this DefaultTenantProfileConfiguration. + + + :param alarms_ttl_days: The alarms_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._alarms_ttl_days = alarms_ttl_days + + @property + def cassandra_query_tenant_rate_limits_configuration(self): + """Gets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._cassandra_query_tenant_rate_limits_configuration + + @cassandra_query_tenant_rate_limits_configuration.setter + def cassandra_query_tenant_rate_limits_configuration(self, cassandra_query_tenant_rate_limits_configuration): + """Sets the cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param cassandra_query_tenant_rate_limits_configuration: The cassandra_query_tenant_rate_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._cassandra_query_tenant_rate_limits_configuration = cassandra_query_tenant_rate_limits_configuration + + @property + def customer_server_rest_limits_configuration(self): + """Gets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._customer_server_rest_limits_configuration + + @customer_server_rest_limits_configuration.setter + def customer_server_rest_limits_configuration(self, customer_server_rest_limits_configuration): + """Sets the customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param customer_server_rest_limits_configuration: The customer_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._customer_server_rest_limits_configuration = customer_server_rest_limits_configuration + + @property + def default_storage_ttl_days(self): + """Gets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._default_storage_ttl_days + + @default_storage_ttl_days.setter + def default_storage_ttl_days(self, default_storage_ttl_days): + """Sets the default_storage_ttl_days of this DefaultTenantProfileConfiguration. + + + :param default_storage_ttl_days: The default_storage_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._default_storage_ttl_days = default_storage_ttl_days + + @property + def max_assets(self): + """Gets the max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this DefaultTenantProfileConfiguration. + + + :param max_assets: The max_assets of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_converters(self): + """Gets the max_converters of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_converters of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_converters + + @max_converters.setter + def max_converters(self, max_converters): + """Sets the max_converters of this DefaultTenantProfileConfiguration. + + + :param max_converters: The max_converters of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_converters = max_converters + + @property + def max_created_alarms(self): + """Gets the max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_created_alarms + + @max_created_alarms.setter + def max_created_alarms(self, max_created_alarms): + """Sets the max_created_alarms of this DefaultTenantProfileConfiguration. + + + :param max_created_alarms: The max_created_alarms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_created_alarms = max_created_alarms + + @property + def max_customers(self): + """Gets the max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_customers + + @max_customers.setter + def max_customers(self, max_customers): + """Sets the max_customers of this DefaultTenantProfileConfiguration. + + + :param max_customers: The max_customers of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_customers = max_customers + + @property + def max_dp_storage_days(self): + """Gets the max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dp_storage_days + + @max_dp_storage_days.setter + def max_dp_storage_days(self, max_dp_storage_days): + """Sets the max_dp_storage_days of this DefaultTenantProfileConfiguration. + + + :param max_dp_storage_days: The max_dp_storage_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dp_storage_days = max_dp_storage_days + + @property + def max_dashboards(self): + """Gets the max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_dashboards + + @max_dashboards.setter + def max_dashboards(self, max_dashboards): + """Sets the max_dashboards of this DefaultTenantProfileConfiguration. + + + :param max_dashboards: The max_dashboards of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_dashboards = max_dashboards + + @property + def max_devices(self): + """Gets the max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this DefaultTenantProfileConfiguration. + + + :param max_devices: The max_devices of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def max_emails(self): + """Gets the max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_emails + + @max_emails.setter + def max_emails(self, max_emails): + """Sets the max_emails of this DefaultTenantProfileConfiguration. + + + :param max_emails: The max_emails of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_emails = max_emails + + @property + def max_integrations(self): + """Gets the max_integrations of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_integrations of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_integrations + + @max_integrations.setter + def max_integrations(self, max_integrations): + """Sets the max_integrations of this DefaultTenantProfileConfiguration. + + + :param max_integrations: The max_integrations of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_integrations = max_integrations + + @property + def max_js_executions(self): + """Gets the max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_js_executions + + @max_js_executions.setter + def max_js_executions(self, max_js_executions): + """Sets the max_js_executions of this DefaultTenantProfileConfiguration. + + + :param max_js_executions: The max_js_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_js_executions = max_js_executions + + @property + def max_ota_packages_in_bytes(self): + """Gets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ota_packages_in_bytes + + @max_ota_packages_in_bytes.setter + def max_ota_packages_in_bytes(self, max_ota_packages_in_bytes): + """Sets the max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_ota_packages_in_bytes: The max_ota_packages_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ota_packages_in_bytes = max_ota_packages_in_bytes + + @property + def max_re_executions(self): + """Gets the max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_re_executions + + @max_re_executions.setter + def max_re_executions(self, max_re_executions): + """Sets the max_re_executions of this DefaultTenantProfileConfiguration. + + + :param max_re_executions: The max_re_executions of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_re_executions = max_re_executions + + @property + def max_resources_in_bytes(self): + """Gets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_resources_in_bytes + + @max_resources_in_bytes.setter + def max_resources_in_bytes(self, max_resources_in_bytes): + """Sets the max_resources_in_bytes of this DefaultTenantProfileConfiguration. + + + :param max_resources_in_bytes: The max_resources_in_bytes of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_resources_in_bytes = max_resources_in_bytes + + @property + def max_rule_chains(self): + """Gets the max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_chains + + @max_rule_chains.setter + def max_rule_chains(self, max_rule_chains): + """Sets the max_rule_chains of this DefaultTenantProfileConfiguration. + + + :param max_rule_chains: The max_rule_chains of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_chains = max_rule_chains + + @property + def max_rule_node_executions_per_message(self): + """Gets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_rule_node_executions_per_message + + @max_rule_node_executions_per_message.setter + def max_rule_node_executions_per_message(self, max_rule_node_executions_per_message): + """Sets the max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. + + + :param max_rule_node_executions_per_message: The max_rule_node_executions_per_message of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_rule_node_executions_per_message = max_rule_node_executions_per_message + + @property + def max_scheduler_events(self): + """Gets the max_scheduler_events of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_scheduler_events of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_scheduler_events + + @max_scheduler_events.setter + def max_scheduler_events(self, max_scheduler_events): + """Sets the max_scheduler_events of this DefaultTenantProfileConfiguration. + + + :param max_scheduler_events: The max_scheduler_events of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_scheduler_events = max_scheduler_events + + @property + def max_sms(self): + """Gets the max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_sms + + @max_sms.setter + def max_sms(self, max_sms): + """Sets the max_sms of this DefaultTenantProfileConfiguration. + + + :param max_sms: The max_sms of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_sms = max_sms + + @property + def max_transport_data_points(self): + """Gets the max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_data_points + + @max_transport_data_points.setter + def max_transport_data_points(self, max_transport_data_points): + """Sets the max_transport_data_points of this DefaultTenantProfileConfiguration. + + + :param max_transport_data_points: The max_transport_data_points of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_data_points = max_transport_data_points + + @property + def max_transport_messages(self): + """Gets the max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_transport_messages + + @max_transport_messages.setter + def max_transport_messages(self, max_transport_messages): + """Sets the max_transport_messages of this DefaultTenantProfileConfiguration. + + + :param max_transport_messages: The max_transport_messages of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_transport_messages = max_transport_messages + + @property + def max_users(self): + """Gets the max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_users + + @max_users.setter + def max_users(self, max_users): + """Sets the max_users of this DefaultTenantProfileConfiguration. + + + :param max_users: The max_users of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_users = max_users + + @property + def max_ws_sessions_per_customer(self): + """Gets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_customer + + @max_ws_sessions_per_customer.setter + def max_ws_sessions_per_customer(self, max_ws_sessions_per_customer): + """Sets the max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_customer: The max_ws_sessions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_customer = max_ws_sessions_per_customer + + @property + def max_ws_sessions_per_public_user(self): + """Gets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_public_user + + @max_ws_sessions_per_public_user.setter + def max_ws_sessions_per_public_user(self, max_ws_sessions_per_public_user): + """Sets the max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_public_user: The max_ws_sessions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_public_user = max_ws_sessions_per_public_user + + @property + def max_ws_sessions_per_regular_user(self): + """Gets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_regular_user + + @max_ws_sessions_per_regular_user.setter + def max_ws_sessions_per_regular_user(self, max_ws_sessions_per_regular_user): + """Sets the max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_regular_user: The max_ws_sessions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_regular_user = max_ws_sessions_per_regular_user + + @property + def max_ws_sessions_per_tenant(self): + """Gets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_sessions_per_tenant + + @max_ws_sessions_per_tenant.setter + def max_ws_sessions_per_tenant(self, max_ws_sessions_per_tenant): + """Sets the max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_sessions_per_tenant: The max_ws_sessions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_sessions_per_tenant = max_ws_sessions_per_tenant + + @property + def max_ws_subscriptions_per_customer(self): + """Gets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_customer + + @max_ws_subscriptions_per_customer.setter + def max_ws_subscriptions_per_customer(self, max_ws_subscriptions_per_customer): + """Sets the max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_customer: The max_ws_subscriptions_per_customer of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_customer = max_ws_subscriptions_per_customer + + @property + def max_ws_subscriptions_per_public_user(self): + """Gets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_public_user + + @max_ws_subscriptions_per_public_user.setter + def max_ws_subscriptions_per_public_user(self, max_ws_subscriptions_per_public_user): + """Sets the max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_public_user: The max_ws_subscriptions_per_public_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_public_user = max_ws_subscriptions_per_public_user + + @property + def max_ws_subscriptions_per_regular_user(self): + """Gets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_regular_user + + @max_ws_subscriptions_per_regular_user.setter + def max_ws_subscriptions_per_regular_user(self, max_ws_subscriptions_per_regular_user): + """Sets the max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_regular_user: The max_ws_subscriptions_per_regular_user of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_regular_user = max_ws_subscriptions_per_regular_user + + @property + def max_ws_subscriptions_per_tenant(self): + """Gets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._max_ws_subscriptions_per_tenant + + @max_ws_subscriptions_per_tenant.setter + def max_ws_subscriptions_per_tenant(self, max_ws_subscriptions_per_tenant): + """Sets the max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. + + + :param max_ws_subscriptions_per_tenant: The max_ws_subscriptions_per_tenant of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._max_ws_subscriptions_per_tenant = max_ws_subscriptions_per_tenant + + @property + def rpc_ttl_days(self): + """Gets the rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._rpc_ttl_days + + @rpc_ttl_days.setter + def rpc_ttl_days(self, rpc_ttl_days): + """Sets the rpc_ttl_days of this DefaultTenantProfileConfiguration. + + + :param rpc_ttl_days: The rpc_ttl_days of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._rpc_ttl_days = rpc_ttl_days + + @property + def tenant_entity_export_rate_limit(self): + """Gets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_export_rate_limit + + @tenant_entity_export_rate_limit.setter + def tenant_entity_export_rate_limit(self, tenant_entity_export_rate_limit): + """Sets the tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_export_rate_limit: The tenant_entity_export_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_export_rate_limit = tenant_entity_export_rate_limit + + @property + def tenant_entity_import_rate_limit(self): + """Gets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_entity_import_rate_limit + + @tenant_entity_import_rate_limit.setter + def tenant_entity_import_rate_limit(self, tenant_entity_import_rate_limit): + """Sets the tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_entity_import_rate_limit: The tenant_entity_import_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_entity_import_rate_limit = tenant_entity_import_rate_limit + + @property + def tenant_notification_requests_per_rule_rate_limit(self): + """Gets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_per_rule_rate_limit + + @tenant_notification_requests_per_rule_rate_limit.setter + def tenant_notification_requests_per_rule_rate_limit(self, tenant_notification_requests_per_rule_rate_limit): + """Sets the tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_per_rule_rate_limit: The tenant_notification_requests_per_rule_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_per_rule_rate_limit = tenant_notification_requests_per_rule_rate_limit + + @property + def tenant_notification_requests_rate_limit(self): + """Gets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_notification_requests_rate_limit + + @tenant_notification_requests_rate_limit.setter + def tenant_notification_requests_rate_limit(self, tenant_notification_requests_rate_limit): + """Sets the tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. + + + :param tenant_notification_requests_rate_limit: The tenant_notification_requests_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_notification_requests_rate_limit = tenant_notification_requests_rate_limit + + @property + def tenant_server_rest_limits_configuration(self): + """Gets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._tenant_server_rest_limits_configuration + + @tenant_server_rest_limits_configuration.setter + def tenant_server_rest_limits_configuration(self, tenant_server_rest_limits_configuration): + """Sets the tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. + + + :param tenant_server_rest_limits_configuration: The tenant_server_rest_limits_configuration of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._tenant_server_rest_limits_configuration = tenant_server_rest_limits_configuration + + @property + def transport_device_msg_rate_limit(self): + """Gets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_msg_rate_limit + + @transport_device_msg_rate_limit.setter + def transport_device_msg_rate_limit(self, transport_device_msg_rate_limit): + """Sets the transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_msg_rate_limit: The transport_device_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_msg_rate_limit = transport_device_msg_rate_limit + + @property + def transport_device_telemetry_data_points_rate_limit(self): + """Gets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_data_points_rate_limit + + @transport_device_telemetry_data_points_rate_limit.setter + def transport_device_telemetry_data_points_rate_limit(self, transport_device_telemetry_data_points_rate_limit): + """Sets the transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_data_points_rate_limit: The transport_device_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_data_points_rate_limit = transport_device_telemetry_data_points_rate_limit + + @property + def transport_device_telemetry_msg_rate_limit(self): + """Gets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_device_telemetry_msg_rate_limit + + @transport_device_telemetry_msg_rate_limit.setter + def transport_device_telemetry_msg_rate_limit(self, transport_device_telemetry_msg_rate_limit): + """Sets the transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_device_telemetry_msg_rate_limit: The transport_device_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_device_telemetry_msg_rate_limit = transport_device_telemetry_msg_rate_limit + + @property + def transport_tenant_msg_rate_limit(self): + """Gets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_msg_rate_limit + + @transport_tenant_msg_rate_limit.setter + def transport_tenant_msg_rate_limit(self, transport_tenant_msg_rate_limit): + """Sets the transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_msg_rate_limit: The transport_tenant_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_msg_rate_limit = transport_tenant_msg_rate_limit + + @property + def transport_tenant_telemetry_data_points_rate_limit(self): + """Gets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_data_points_rate_limit + + @transport_tenant_telemetry_data_points_rate_limit.setter + def transport_tenant_telemetry_data_points_rate_limit(self, transport_tenant_telemetry_data_points_rate_limit): + """Sets the transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_data_points_rate_limit: The transport_tenant_telemetry_data_points_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_data_points_rate_limit = transport_tenant_telemetry_data_points_rate_limit + + @property + def transport_tenant_telemetry_msg_rate_limit(self): + """Gets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._transport_tenant_telemetry_msg_rate_limit + + @transport_tenant_telemetry_msg_rate_limit.setter + def transport_tenant_telemetry_msg_rate_limit(self, transport_tenant_telemetry_msg_rate_limit): + """Sets the transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. + + + :param transport_tenant_telemetry_msg_rate_limit: The transport_tenant_telemetry_msg_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._transport_tenant_telemetry_msg_rate_limit = transport_tenant_telemetry_msg_rate_limit + + @property + def warn_threshold(self): + """Gets the warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: float + """ + return self._warn_threshold + + @warn_threshold.setter + def warn_threshold(self, warn_threshold): + """Sets the warn_threshold of this DefaultTenantProfileConfiguration. + + + :param warn_threshold: The warn_threshold of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: float + """ + + self._warn_threshold = warn_threshold + + @property + def ws_msg_queue_limit_per_session(self): + """Gets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: int + """ + return self._ws_msg_queue_limit_per_session + + @ws_msg_queue_limit_per_session.setter + def ws_msg_queue_limit_per_session(self, ws_msg_queue_limit_per_session): + """Sets the ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. + + + :param ws_msg_queue_limit_per_session: The ws_msg_queue_limit_per_session of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: int + """ + + self._ws_msg_queue_limit_per_session = ws_msg_queue_limit_per_session + + @property + def ws_updates_per_session_rate_limit(self): + """Gets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + + + :return: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :rtype: str + """ + return self._ws_updates_per_session_rate_limit + + @ws_updates_per_session_rate_limit.setter + def ws_updates_per_session_rate_limit(self, ws_updates_per_session_rate_limit): + """Sets the ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. + + + :param ws_updates_per_session_rate_limit: The ws_updates_per_session_rate_limit of this DefaultTenantProfileConfiguration. # noqa: E501 + :type: str + """ + + self._ws_updates_per_session_rate_limit = ws_updates_per_session_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DefaultTenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DefaultTenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_entity_data_diff.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_entity_data_diff.py new file mode 100644 index 0000000..939a9fa --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataDiff. + + + :param result: The result of this DeferredResultEntityDataDiff. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataDiff. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataDiff. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_entity_data_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_entity_data_info.py new file mode 100644 index 0000000..8587069 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_entity_data_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultEntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultEntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultEntityDataInfo. + + + :param result: The result of this DeferredResultEntityDataInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultEntityDataInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultEntityDataInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultEntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultEntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_list_branch_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_list_branch_info.py new file mode 100644 index 0000000..4a61a3c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_list_branch_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListBranchInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListBranchInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The result of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListBranchInfo. + + + :param result: The result of this DeferredResultListBranchInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListBranchInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListBranchInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListBranchInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListBranchInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_list_versioned_entity_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_list_versioned_entity_info.py new file mode 100644 index 0000000..3b63eb0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_list_versioned_entity_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultListVersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultListVersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultListVersionedEntityInfo. + + + :param result: The result of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultListVersionedEntityInfo. + + + :param set_or_expired: The set_or_expired of this DeferredResultListVersionedEntityInfo. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultListVersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultListVersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_page_data_entity_version.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_page_data_entity_version.py new file mode 100644 index 0000000..32816c0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_page_data_entity_version.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultPageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultPageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultPageDataEntityVersion. + + + :param result: The result of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultPageDataEntityVersion. + + + :param set_or_expired: The set_or_expired of this DeferredResultPageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultPageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultPageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_repository_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_repository_settings.py new file mode 100644 index 0000000..995eaee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_repository_settings.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultRepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultRepositorySettings - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The result of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultRepositorySettings. + + + :param result: The result of this DeferredResultRepositorySettings. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultRepositorySettings. + + + :param set_or_expired: The set_or_expired of this DeferredResultRepositorySettings. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultRepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultRepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_void.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_void.py new file mode 100644 index 0000000..4d71738 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_result_void.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultVoid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultVoid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultVoid. # noqa: E501 + + + :return: The result of this DeferredResultVoid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultVoid. + + + :param result: The result of this DeferredResultVoid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultVoid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultVoid. + + + :param set_or_expired: The set_or_expired of this DeferredResultVoid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultVoid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultVoid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_resultuuid.py b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_resultuuid.py new file mode 100644 index 0000000..31d6fd1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/deferred_resultuuid.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeferredResultuuid(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'result': 'object', + 'set_or_expired': 'bool' + } + + attribute_map = { + 'result': 'result', + 'set_or_expired': 'setOrExpired' + } + + def __init__(self, result=None, set_or_expired=None): # noqa: E501 + """DeferredResultuuid - a model defined in Swagger""" # noqa: E501 + self._result = None + self._set_or_expired = None + self.discriminator = None + if result is not None: + self.result = result + if set_or_expired is not None: + self.set_or_expired = set_or_expired + + @property + def result(self): + """Gets the result of this DeferredResultuuid. # noqa: E501 + + + :return: The result of this DeferredResultuuid. # noqa: E501 + :rtype: object + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this DeferredResultuuid. + + + :param result: The result of this DeferredResultuuid. # noqa: E501 + :type: object + """ + + self._result = result + + @property + def set_or_expired(self): + """Gets the set_or_expired of this DeferredResultuuid. # noqa: E501 + + + :return: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :rtype: bool + """ + return self._set_or_expired + + @set_or_expired.setter + def set_or_expired(self, set_or_expired): + """Sets the set_or_expired of this DeferredResultuuid. + + + :param set_or_expired: The set_or_expired of this DeferredResultuuid. # noqa: E501 + :type: bool + """ + + self._set_or_expired = set_or_expired + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeferredResultuuid, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeferredResultuuid): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/delete_tenant_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/delete_tenant_request.py new file mode 100644 index 0000000..c62c498 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/delete_tenant_request.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeleteTenantRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_notes': 'str', + 'reason': 'str' + } + + attribute_map = { + 'additional_notes': 'additionalNotes', + 'reason': 'reason' + } + + def __init__(self, additional_notes=None, reason=None): # noqa: E501 + """DeleteTenantRequest - a model defined in Swagger""" # noqa: E501 + self._additional_notes = None + self._reason = None + self.discriminator = None + if additional_notes is not None: + self.additional_notes = additional_notes + if reason is not None: + self.reason = reason + + @property + def additional_notes(self): + """Gets the additional_notes of this DeleteTenantRequest. # noqa: E501 + + + :return: The additional_notes of this DeleteTenantRequest. # noqa: E501 + :rtype: str + """ + return self._additional_notes + + @additional_notes.setter + def additional_notes(self, additional_notes): + """Sets the additional_notes of this DeleteTenantRequest. + + + :param additional_notes: The additional_notes of this DeleteTenantRequest. # noqa: E501 + :type: str + """ + + self._additional_notes = additional_notes + + @property + def reason(self): + """Gets the reason of this DeleteTenantRequest. # noqa: E501 + + + :return: The reason of this DeleteTenantRequest. # noqa: E501 + :rtype: str + """ + return self._reason + + @reason.setter + def reason(self, reason): + """Sets the reason of this DeleteTenantRequest. + + + :param reason: The reason of this DeleteTenantRequest. # noqa: E501 + :type: str + """ + + self._reason = reason + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeleteTenantRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeleteTenantRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_pe/delivery_method_notification_template.py new file mode 100644 index 0000000..94af3d7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """DeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this DeliveryMethodNotificationTemplate. + + + :param body: The body of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this DeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this DeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device.py new file mode 100644 index 0000000..c2869b3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device.py @@ -0,0 +1,458 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Device(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, external_id=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None): # noqa: E501 + """Device - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self._external_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + self.label = label + self.external_id = external_id + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Device. # noqa: E501 + + + :return: The id of this Device. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Device. + + + :param id: The id of this Device. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Device. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this Device. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Device. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Device. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def tenant_id(self): + """Gets the tenant_id of this Device. # noqa: E501 + + + :return: The tenant_id of this Device. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Device. + + + :param tenant_id: The tenant_id of this Device. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Device. # noqa: E501 + + + :return: The customer_id of this Device. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Device. + + + :param customer_id: The customer_id of this Device. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Device. # noqa: E501 + + + :return: The owner_id of this Device. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Device. + + + :param owner_id: The owner_id of this Device. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this Device. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this Device. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Device. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this Device. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Device. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this Device. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Device. + + Device Profile Name # noqa: E501 + + :param type: The type of this Device. # noqa: E501 + :type: str + """ + # if type is None: + # raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this Device. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Device. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Device. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Device. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this Device. # noqa: E501 + + + :return: The device_profile_id of this Device. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this Device. + + + :param device_profile_id: The device_profile_id of this Device. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this Device. # noqa: E501 + + + :return: The device_data of this Device. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this Device. + + + :param device_data: The device_data of this Device. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this Device. # noqa: E501 + + + :return: The firmware_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this Device. + + + :param firmware_id: The firmware_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this Device. # noqa: E501 + + + :return: The software_id of this Device. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this Device. + + + :param software_id: The software_id of this Device. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this Device. # noqa: E501 + + + :return: The additional_info of this Device. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Device. + + + :param additional_info: The additional_info of this Device. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Device, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Device): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_activity_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_activity_notification_rule_trigger_config.py new file mode 100644 index 0000000..74f0319 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_activity_notification_rule_trigger_config.py @@ -0,0 +1,221 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class DeviceActivityNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_profiles': 'list[str]', + 'devices': 'list[str]', + 'notify_on': 'list[str]', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'device_profiles': 'deviceProfiles', + 'devices': 'devices', + 'notify_on': 'notifyOn', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, device_profiles=None, devices=None, notify_on=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """DeviceActivityNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._device_profiles = None + self._devices = None + self._notify_on = None + self._trigger_type = None + self.discriminator = None + if device_profiles is not None: + self.device_profiles = device_profiles + if devices is not None: + self.devices = devices + if notify_on is not None: + self.notify_on = notify_on + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def device_profiles(self): + """Gets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._device_profiles + + @device_profiles.setter + def device_profiles(self, device_profiles): + """Sets the device_profiles of this DeviceActivityNotificationRuleTriggerConfig. + + + :param device_profiles: The device_profiles of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._device_profiles = device_profiles + + @property + def devices(self): + """Gets the devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this DeviceActivityNotificationRuleTriggerConfig. + + + :param devices: The devices of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._devices = devices + + @property + def notify_on(self): + """Gets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this DeviceActivityNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVE", "INACTIVE"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def trigger_type(self): + """Gets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this DeviceActivityNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this DeviceActivityNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceActivityNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceActivityNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_configuration.py new file mode 100644 index 0000000..b92fa47 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_credentials_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_credentials_id.py new file mode 100644 index 0000000..e6ad9c3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_credentials_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceCredentialsId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """DeviceCredentialsId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this DeviceCredentialsId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this DeviceCredentialsId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceCredentialsId. + + string # noqa: E501 + + :param id: The id of this DeviceCredentialsId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceCredentialsId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceCredentialsId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_data.py new file mode 100644 index 0000000..23983c4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_data.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceConfiguration', + 'transport_configuration': 'DeviceTransportConfiguration' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration' + } + + def __init__(self, configuration=None, transport_configuration=None): # noqa: E501 + """DeviceData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + + @property + def configuration(self): + """Gets the configuration of this DeviceData. # noqa: E501 + + + :return: The configuration of this DeviceData. # noqa: E501 + :rtype: DeviceConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceData. + + + :param configuration: The configuration of this DeviceData. # noqa: E501 + :type: DeviceConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceData. # noqa: E501 + + + :return: The transport_configuration of this DeviceData. # noqa: E501 + :rtype: DeviceTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceData. + + + :param transport_configuration: The transport_configuration of this DeviceData. # noqa: E501 + :type: DeviceTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_export_data.py new file mode 100644 index 0000000..012ecaf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class DeviceExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'credentials': 'DeviceCredentials', + 'entity': 'Device', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'credentials': 'credentials', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, credentials=None, entity=None, entity_type=None, relations=None, *args, **kwargs): # noqa: E501 + """DeviceExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._credentials = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if credentials is not None: + self.credentials = credentials + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this DeviceExportData. # noqa: E501 + + + :return: The attributes of this DeviceExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this DeviceExportData. + + + :param attributes: The attributes of this DeviceExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def credentials(self): + """Gets the credentials of this DeviceExportData. # noqa: E501 + + + :return: The credentials of this DeviceExportData. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this DeviceExportData. + + + :param credentials: The credentials of this DeviceExportData. # noqa: E501 + :type: DeviceCredentials + """ + + self._credentials = credentials + + @property + def entity(self): + """Gets the entity of this DeviceExportData. # noqa: E501 + + + :return: The entity of this DeviceExportData. # noqa: E501 + :rtype: Device + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this DeviceExportData. + + + :param entity: The entity of this DeviceExportData. # noqa: E501 + :type: Device + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this DeviceExportData. # noqa: E501 + + + :return: The entity_type of this DeviceExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceExportData. + + + :param entity_type: The entity_type of this DeviceExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this DeviceExportData. # noqa: E501 + + + :return: The relations of this DeviceExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this DeviceExportData. + + + :param relations: The relations of this DeviceExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_group_ota_package.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_group_ota_package.py new file mode 100644 index 0000000..a02f819 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_group_ota_package.py @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceGroupOtaPackage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'group_id': 'EntityGroupId', + 'id': 'str', + 'ota_package_id': 'OtaPackageId', + 'ota_package_type': 'str', + 'ota_package_update_time': 'int' + } + + attribute_map = { + 'group_id': 'groupId', + 'id': 'id', + 'ota_package_id': 'otaPackageId', + 'ota_package_type': 'otaPackageType', + 'ota_package_update_time': 'otaPackageUpdateTime' + } + + def __init__(self, group_id=None, id=None, ota_package_id=None, ota_package_type=None, ota_package_update_time=None): # noqa: E501 + """DeviceGroupOtaPackage - a model defined in Swagger""" # noqa: E501 + self._group_id = None + self._id = None + self._ota_package_id = None + self._ota_package_type = None + self._ota_package_update_time = None + self.discriminator = None + if group_id is not None: + self.group_id = group_id + if id is not None: + self.id = id + if ota_package_id is not None: + self.ota_package_id = ota_package_id + if ota_package_type is not None: + self.ota_package_type = ota_package_type + if ota_package_update_time is not None: + self.ota_package_update_time = ota_package_update_time + + @property + def group_id(self): + """Gets the group_id of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The group_id of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: EntityGroupId + """ + return self._group_id + + @group_id.setter + def group_id(self, group_id): + """Sets the group_id of this DeviceGroupOtaPackage. + + + :param group_id: The group_id of this DeviceGroupOtaPackage. # noqa: E501 + :type: EntityGroupId + """ + + self._group_id = group_id + + @property + def id(self): + """Gets the id of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The id of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceGroupOtaPackage. + + + :param id: The id of this DeviceGroupOtaPackage. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def ota_package_id(self): + """Gets the ota_package_id of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The ota_package_id of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: OtaPackageId + """ + return self._ota_package_id + + @ota_package_id.setter + def ota_package_id(self, ota_package_id): + """Sets the ota_package_id of this DeviceGroupOtaPackage. + + + :param ota_package_id: The ota_package_id of this DeviceGroupOtaPackage. # noqa: E501 + :type: OtaPackageId + """ + + self._ota_package_id = ota_package_id + + @property + def ota_package_type(self): + """Gets the ota_package_type of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The ota_package_type of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: str + """ + return self._ota_package_type + + @ota_package_type.setter + def ota_package_type(self, ota_package_type): + """Sets the ota_package_type of this DeviceGroupOtaPackage. + + + :param ota_package_type: The ota_package_type of this DeviceGroupOtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if ota_package_type not in allowed_values: + raise ValueError( + "Invalid value for `ota_package_type` ({0}), must be one of {1}" # noqa: E501 + .format(ota_package_type, allowed_values) + ) + + self._ota_package_type = ota_package_type + + @property + def ota_package_update_time(self): + """Gets the ota_package_update_time of this DeviceGroupOtaPackage. # noqa: E501 + + + :return: The ota_package_update_time of this DeviceGroupOtaPackage. # noqa: E501 + :rtype: int + """ + return self._ota_package_update_time + + @ota_package_update_time.setter + def ota_package_update_time(self, ota_package_update_time): + """Sets the ota_package_update_time of this DeviceGroupOtaPackage. + + + :param ota_package_update_time: The ota_package_update_time of this DeviceGroupOtaPackage. # noqa: E501 + :type: int + """ + + self._ota_package_update_time = ota_package_update_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceGroupOtaPackage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceGroupOtaPackage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_id.py new file mode 100644 index 0000000..6b726b7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_info.py new file mode 100644 index 0000000..4c92934 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_info.py @@ -0,0 +1,530 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DeviceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'device_profile_id': 'DeviceProfileId', + 'device_data': 'DeviceData', + 'firmware_id': 'OtaPackageId', + 'software_id': 'OtaPackageId', + 'additional_info': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]', + 'active': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'device_profile_id': 'deviceProfileId', + 'device_data': 'deviceData', + 'firmware_id': 'firmwareId', + 'software_id': 'softwareId', + 'additional_info': 'additionalInfo', + 'owner_name': 'ownerName', + 'groups': 'groups', + 'active': 'active' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, label=None, device_profile_id=None, device_data=None, firmware_id=None, software_id=None, additional_info=None, owner_name=None, groups=None, active=None): # noqa: E501 + """DeviceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._label = None + self._device_profile_id = None + self._device_data = None + self._firmware_id = None + self._software_id = None + self._additional_info = None + self._owner_name = None + self._groups = None + self._active = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + self.label = label + self.device_profile_id = device_profile_id + if device_data is not None: + self.device_data = device_data + if firmware_id is not None: + self.firmware_id = firmware_id + if software_id is not None: + self.software_id = software_id + if additional_info is not None: + self.additional_info = additional_info + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + if active is not None: + self.active = active + + @property + def id(self): + """Gets the id of this DeviceInfo. # noqa: E501 + + + :return: The id of this DeviceInfo. # noqa: E501 + :rtype: DeviceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceInfo. + + + :param id: The id of this DeviceInfo. # noqa: E501 + :type: DeviceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this DeviceInfo. # noqa: E501 + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :return: The created_time of this DeviceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this DeviceInfo. + + Timestamp of the device creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this DeviceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this DeviceInfo. # noqa: E501 + + + :return: The tenant_id of this DeviceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this DeviceInfo. + + + :param tenant_id: The tenant_id of this DeviceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this DeviceInfo. # noqa: E501 + + + :return: The customer_id of this DeviceInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this DeviceInfo. + + + :param customer_id: The customer_id of this DeviceInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this DeviceInfo. # noqa: E501 + + + :return: The owner_id of this DeviceInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this DeviceInfo. + + + :param owner_id: The owner_id of this DeviceInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this DeviceInfo. # noqa: E501 + + Unique Device Name in scope of Tenant # noqa: E501 + + :return: The name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DeviceInfo. + + Unique Device Name in scope of Tenant # noqa: E501 + + :param name: The name of this DeviceInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this DeviceInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this DeviceInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this DeviceInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this DeviceInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this DeviceInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def device_profile_id(self): + """Gets the device_profile_id of this DeviceInfo. # noqa: E501 + + + :return: The device_profile_id of this DeviceInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this DeviceInfo. + + + :param device_profile_id: The device_profile_id of this DeviceInfo. # noqa: E501 + :type: DeviceProfileId + """ + if device_profile_id is None: + raise ValueError("Invalid value for `device_profile_id`, must not be `None`") # noqa: E501 + + self._device_profile_id = device_profile_id + + @property + def device_data(self): + """Gets the device_data of this DeviceInfo. # noqa: E501 + + + :return: The device_data of this DeviceInfo. # noqa: E501 + :rtype: DeviceData + """ + return self._device_data + + @device_data.setter + def device_data(self, device_data): + """Sets the device_data of this DeviceInfo. + + + :param device_data: The device_data of this DeviceInfo. # noqa: E501 + :type: DeviceData + """ + + self._device_data = device_data + + @property + def firmware_id(self): + """Gets the firmware_id of this DeviceInfo. # noqa: E501 + + + :return: The firmware_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._firmware_id + + @firmware_id.setter + def firmware_id(self, firmware_id): + """Sets the firmware_id of this DeviceInfo. + + + :param firmware_id: The firmware_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._firmware_id = firmware_id + + @property + def software_id(self): + """Gets the software_id of this DeviceInfo. # noqa: E501 + + + :return: The software_id of this DeviceInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._software_id + + @software_id.setter + def software_id(self, software_id): + """Sets the software_id of this DeviceInfo. + + + :param software_id: The software_id of this DeviceInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._software_id = software_id + + @property + def additional_info(self): + """Gets the additional_info of this DeviceInfo. # noqa: E501 + + + :return: The additional_info of this DeviceInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this DeviceInfo. + + + :param additional_info: The additional_info of this DeviceInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_name(self): + """Gets the owner_name of this DeviceInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this DeviceInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this DeviceInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this DeviceInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this DeviceInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this DeviceInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this DeviceInfo. + + Groups # noqa: E501 + + :param groups: The groups of this DeviceInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + @property + def active(self): + """Gets the active of this DeviceInfo. # noqa: E501 + + Device active flag. # noqa: E501 + + :return: The active of this DeviceInfo. # noqa: E501 + :rtype: bool + """ + return self._active + + @active.setter + def active(self, active): + """Sets the active of this DeviceInfo. + + Device active flag. # noqa: E501 + + :param active: The active of this DeviceInfo. # noqa: E501 + :type: bool + """ + + self._active = active + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_alarm.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_alarm.py new file mode 100644 index 0000000..847f9c0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_alarm.py @@ -0,0 +1,348 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileAlarm(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'alarm_type': 'str', + 'create_rules': 'dict(str, AlarmRule)', + 'clear_rule': 'AlarmRule', + 'propagate': 'bool', + 'propagate_to_owner': 'bool', + 'propagate_to_owner_hierarchy': 'bool', + 'propagate_to_tenant': 'bool', + 'propagate_relation_types': 'list[str]' + } + + attribute_map = { + 'id': 'id', + 'alarm_type': 'alarmType', + 'create_rules': 'createRules', + 'clear_rule': 'clearRule', + 'propagate': 'propagate', + 'propagate_to_owner': 'propagateToOwner', + 'propagate_to_owner_hierarchy': 'propagateToOwnerHierarchy', + 'propagate_to_tenant': 'propagateToTenant', + 'propagate_relation_types': 'propagateRelationTypes' + } + + def __init__(self, id=None, alarm_type=None, create_rules=None, clear_rule=None, propagate=None, propagate_to_owner=None, propagate_to_owner_hierarchy=None, propagate_to_tenant=None, propagate_relation_types=None): # noqa: E501 + """DeviceProfileAlarm - a model defined in Swagger""" # noqa: E501 + self._id = None + self._alarm_type = None + self._create_rules = None + self._clear_rule = None + self._propagate = None + self._propagate_to_owner = None + self._propagate_to_owner_hierarchy = None + self._propagate_to_tenant = None + self._propagate_relation_types = None + self.discriminator = None + if id is not None: + self.id = id + if alarm_type is not None: + self.alarm_type = alarm_type + if create_rules is not None: + self.create_rules = create_rules + if clear_rule is not None: + self.clear_rule = clear_rule + if propagate is not None: + self.propagate = propagate + if propagate_to_owner is not None: + self.propagate_to_owner = propagate_to_owner + if propagate_to_owner_hierarchy is not None: + self.propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + if propagate_to_tenant is not None: + self.propagate_to_tenant = propagate_to_tenant + if propagate_relation_types is not None: + self.propagate_relation_types = propagate_relation_types + + @property + def id(self): + """Gets the id of this DeviceProfileAlarm. # noqa: E501 + + String value representing the alarm rule id # noqa: E501 + + :return: The id of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileAlarm. + + String value representing the alarm rule id # noqa: E501 + + :param id: The id of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def alarm_type(self): + """Gets the alarm_type of this DeviceProfileAlarm. # noqa: E501 + + String value representing type of the alarm # noqa: E501 + + :return: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :rtype: str + """ + return self._alarm_type + + @alarm_type.setter + def alarm_type(self, alarm_type): + """Sets the alarm_type of this DeviceProfileAlarm. + + String value representing type of the alarm # noqa: E501 + + :param alarm_type: The alarm_type of this DeviceProfileAlarm. # noqa: E501 + :type: str + """ + + self._alarm_type = alarm_type + + @property + def create_rules(self): + """Gets the create_rules of this DeviceProfileAlarm. # noqa: E501 + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :return: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :rtype: dict(str, AlarmRule) + """ + return self._create_rules + + @create_rules.setter + def create_rules(self, create_rules): + """Sets the create_rules of this DeviceProfileAlarm. + + Complex JSON object representing create alarm rules. The unique create alarm rule can be created for each alarm severity type. There can be 5 create alarm rules configured per a single alarm type. See method implementation notes and AlarmRule model for more details # noqa: E501 + + :param create_rules: The create_rules of this DeviceProfileAlarm. # noqa: E501 + :type: dict(str, AlarmRule) + """ + + self._create_rules = create_rules + + @property + def clear_rule(self): + """Gets the clear_rule of this DeviceProfileAlarm. # noqa: E501 + + + :return: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :rtype: AlarmRule + """ + return self._clear_rule + + @clear_rule.setter + def clear_rule(self, clear_rule): + """Sets the clear_rule of this DeviceProfileAlarm. + + + :param clear_rule: The clear_rule of this DeviceProfileAlarm. # noqa: E501 + :type: AlarmRule + """ + + self._clear_rule = clear_rule + + @property + def propagate(self): + """Gets the propagate of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :return: The propagate of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate + + @propagate.setter + def propagate(self, propagate): + """Sets the propagate of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to parent entities of alarm originator # noqa: E501 + + :param propagate: The propagate of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate = propagate + + @property + def propagate_to_owner(self): + """Gets the propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :return: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner + + @propagate_to_owner.setter + def propagate_to_owner(self, propagate_to_owner): + """Sets the propagate_to_owner of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) of alarm originator # noqa: E501 + + :param propagate_to_owner: The propagate_to_owner of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner = propagate_to_owner + + @property + def propagate_to_owner_hierarchy(self): + """Gets the propagate_to_owner_hierarchy of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :return: The propagate_to_owner_hierarchy of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_owner_hierarchy + + @propagate_to_owner_hierarchy.setter + def propagate_to_owner_hierarchy(self, propagate_to_owner_hierarchy): + """Sets the propagate_to_owner_hierarchy of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the owner (tenant or customer) and all parent owners in the customer hierarchy # noqa: E501 + + :param propagate_to_owner_hierarchy: The propagate_to_owner_hierarchy of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_owner_hierarchy = propagate_to_owner_hierarchy + + @property + def propagate_to_tenant(self): + """Gets the propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :return: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :rtype: bool + """ + return self._propagate_to_tenant + + @propagate_to_tenant.setter + def propagate_to_tenant(self, propagate_to_tenant): + """Sets the propagate_to_tenant of this DeviceProfileAlarm. + + Propagation flag to specify if alarm should be propagated to the tenant entity # noqa: E501 + + :param propagate_to_tenant: The propagate_to_tenant of this DeviceProfileAlarm. # noqa: E501 + :type: bool + """ + + self._propagate_to_tenant = propagate_to_tenant + + @property + def propagate_relation_types(self): + """Gets the propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :return: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :rtype: list[str] + """ + return self._propagate_relation_types + + @propagate_relation_types.setter + def propagate_relation_types(self, propagate_relation_types): + """Sets the propagate_relation_types of this DeviceProfileAlarm. + + JSON array of relation types that should be used for propagation. By default, 'propagateRelationTypes' array is empty which means that the alarm will be propagated based on any relation type to parent entities. This parameter should be used only in case when 'propagate' parameter is set to true, otherwise, 'propagateRelationTypes' array will be ignored. # noqa: E501 + + :param propagate_relation_types: The propagate_relation_types of this DeviceProfileAlarm. # noqa: E501 + :type: list[str] + """ + + self._propagate_relation_types = propagate_relation_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileAlarm, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileAlarm): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_configuration.py new file mode 100644 index 0000000..8605ae8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_data.py new file mode 100644 index 0000000..51da870 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_data.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'DeviceProfileConfiguration', + 'transport_configuration': 'DeviceProfileTransportConfiguration', + 'provision_configuration': 'DeviceProfileProvisionConfiguration', + 'alarms': 'list[DeviceProfileAlarm]' + } + + attribute_map = { + 'configuration': 'configuration', + 'transport_configuration': 'transportConfiguration', + 'provision_configuration': 'provisionConfiguration', + 'alarms': 'alarms' + } + + def __init__(self, configuration=None, transport_configuration=None, provision_configuration=None, alarms=None): # noqa: E501 + """DeviceProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._transport_configuration = None + self._provision_configuration = None + self._alarms = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if transport_configuration is not None: + self.transport_configuration = transport_configuration + if provision_configuration is not None: + self.provision_configuration = provision_configuration + if alarms is not None: + self.alarms = alarms + + @property + def configuration(self): + """Gets the configuration of this DeviceProfileData. # noqa: E501 + + + :return: The configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this DeviceProfileData. + + + :param configuration: The configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileConfiguration + """ + + self._configuration = configuration + + @property + def transport_configuration(self): + """Gets the transport_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The transport_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileTransportConfiguration + """ + return self._transport_configuration + + @transport_configuration.setter + def transport_configuration(self, transport_configuration): + """Sets the transport_configuration of this DeviceProfileData. + + + :param transport_configuration: The transport_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileTransportConfiguration + """ + + self._transport_configuration = transport_configuration + + @property + def provision_configuration(self): + """Gets the provision_configuration of this DeviceProfileData. # noqa: E501 + + + :return: The provision_configuration of this DeviceProfileData. # noqa: E501 + :rtype: DeviceProfileProvisionConfiguration + """ + return self._provision_configuration + + @provision_configuration.setter + def provision_configuration(self, provision_configuration): + """Sets the provision_configuration of this DeviceProfileData. + + + :param provision_configuration: The provision_configuration of this DeviceProfileData. # noqa: E501 + :type: DeviceProfileProvisionConfiguration + """ + + self._provision_configuration = provision_configuration + + @property + def alarms(self): + """Gets the alarms of this DeviceProfileData. # noqa: E501 + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :return: The alarms of this DeviceProfileData. # noqa: E501 + :rtype: list[DeviceProfileAlarm] + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this DeviceProfileData. + + JSON array of alarm rules configuration per device profile # noqa: E501 + + :param alarms: The alarms of this DeviceProfileData. # noqa: E501 + :type: list[DeviceProfileAlarm] + """ + + self._alarms = alarms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_id.py new file mode 100644 index 0000000..f3a8055 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """DeviceProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this DeviceProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this DeviceProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this DeviceProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this DeviceProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this DeviceProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this DeviceProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this DeviceProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEVICE_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_provision_configuration.py new file mode 100644 index 0000000..4ca00e9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_provision_configuration.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileProvisionConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + + def __init__(self, provision_device_secret=None): # noqa: E501 + """DeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_transport_configuration.py new file mode 100644 index 0000000..802a981 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_profile_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_search_query.py new file mode 100644 index 0000000..66a0079 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'device_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'device_types': 'deviceTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, device_types=None, parameters=None): # noqa: E501 + """DeviceSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._device_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if device_types is not None: + self.device_types = device_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this DeviceSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this DeviceSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQuery. # noqa: E501 + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The device_types of this DeviceSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQuery. + + Array of device types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param device_types: The device_types of this DeviceSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def parameters(self): + """Gets the parameters of this DeviceSearchQuery. # noqa: E501 + + + :return: The parameters of this DeviceSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this DeviceSearchQuery. + + + :param parameters: The parameters of this DeviceSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_search_query_filter.py new file mode 100644 index 0000000..c9b451d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_types': 'list[str]', + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_types': 'deviceTypes', + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_types=None, direction=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """DeviceSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._device_types = None + self._direction = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if device_types is not None: + self.device_types = device_types + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_types(self): + """Gets the device_types of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceSearchQueryFilter. + + + :param device_types: The device_types of this DeviceSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + @property + def direction(self): + """Gets the direction of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this DeviceSearchQueryFilter. + + + :param direction: The direction of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this DeviceSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this DeviceSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this DeviceSearchQueryFilter. + + + :param max_level: The max_level of this DeviceSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this DeviceSearchQueryFilter. + + + :param relation_type: The relation_type of this DeviceSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this DeviceSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this DeviceSearchQueryFilter. + + + :param root_entity: The root_entity of this DeviceSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_transport_configuration.py new file mode 100644 index 0000000..701cebb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_transport_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DeviceTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """DeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/device_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/device_type_filter.py new file mode 100644 index 0000000..147c129 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/device_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class DeviceTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_name_filter': 'str', + 'device_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'device_name_filter': 'deviceNameFilter', + 'device_types': 'deviceTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, device_name_filter=None, device_types=None, *args, **kwargs): # noqa: E501 + """DeviceTypeFilter - a model defined in Swagger""" # noqa: E501 + self._device_name_filter = None + self._device_types = None + self.discriminator = None + if device_name_filter is not None: + self.device_name_filter = device_name_filter + if device_types is not None: + self.device_types = device_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def device_name_filter(self): + """Gets the device_name_filter of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :rtype: str + """ + return self._device_name_filter + + @device_name_filter.setter + def device_name_filter(self, device_name_filter): + """Sets the device_name_filter of this DeviceTypeFilter. + + + :param device_name_filter: The device_name_filter of this DeviceTypeFilter. # noqa: E501 + :type: str + """ + + self._device_name_filter = device_name_filter + + @property + def device_types(self): + """Gets the device_types of this DeviceTypeFilter. # noqa: E501 + + + :return: The device_types of this DeviceTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._device_types + + @device_types.setter + def device_types(self, device_types): + """Sets the device_types of this DeviceTypeFilter. + + + :param device_types: The device_types of this DeviceTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._device_types = device_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DeviceTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DeviceTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/disabled_device_profile_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/disabled_device_profile_provision_configuration.py new file mode 100644 index 0000000..2c4985d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/disabled_device_profile_provision_configuration.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class DisabledDeviceProfileProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """DisabledDeviceProfileProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._provision_device_secret = None + self.discriminator = None + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this DisabledDeviceProfileProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DisabledDeviceProfileProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DisabledDeviceProfileProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/domain_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/domain_info.py new file mode 100644 index 0000000..59c1b64 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/domain_info.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DomainInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'scheme': 'str' + } + + attribute_map = { + 'name': 'name', + 'scheme': 'scheme' + } + + def __init__(self, name=None, scheme=None): # noqa: E501 + """DomainInfo - a model defined in Swagger""" # noqa: E501 + self._name = None + self._scheme = None + self.discriminator = None + if name is not None: + self.name = name + if scheme is not None: + self.scheme = scheme + + @property + def name(self): + """Gets the name of this DomainInfo. # noqa: E501 + + + :return: The name of this DomainInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this DomainInfo. + + + :param name: The name of this DomainInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def scheme(self): + """Gets the scheme of this DomainInfo. # noqa: E501 + + + :return: The scheme of this DomainInfo. # noqa: E501 + :rtype: str + """ + return self._scheme + + @scheme.setter + def scheme(self, scheme): + """Sets the scheme of this DomainInfo. + + + :param scheme: The scheme of this DomainInfo. # noqa: E501 + :type: str + """ + allowed_values = ["HTTP", "HTTPS", "MIXED"] # noqa: E501 + if scheme not in allowed_values: + raise ValueError( + "Invalid value for `scheme` ({0}), must be one of {1}" # noqa: E501 + .format(scheme, allowed_values) + ) + + self._scheme = scheme + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DomainInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DomainInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/duration_alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_pe/duration_alarm_condition_spec.py new file mode 100644 index 0000000..97f83b8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/duration_alarm_condition_spec.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class DurationAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValuelong', + 'unit': 'str' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate', + 'unit': 'unit' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, unit=None, *args, **kwargs): # noqa: E501 + """DurationAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self._unit = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + if unit is not None: + self.unit = unit + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValuelong + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this DurationAlarmConditionSpec. + + + :param predicate: The predicate of this DurationAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValuelong + """ + + self._predicate = predicate + + @property + def unit(self): + """Gets the unit of this DurationAlarmConditionSpec. # noqa: E501 + + + :return: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :rtype: str + """ + return self._unit + + @unit.setter + def unit(self, unit): + """Sets the unit of this DurationAlarmConditionSpec. + + + :param unit: The unit of this DurationAlarmConditionSpec. # noqa: E501 + :type: str + """ + allowed_values = ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"] # noqa: E501 + if unit not in allowed_values: + raise ValueError( + "Invalid value for `unit` ({0}), must be one of {1}" # noqa: E501 + .format(unit, allowed_values) + ) + + self._unit = unit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DurationAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DurationAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valueboolean.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valueboolean.py new file mode 100644 index 0000000..1df15a2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valueboolean.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueboolean - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueboolean. # noqa: E501 + + + :return: The inherit of this DynamicValueboolean. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueboolean. + + + :param inherit: The inherit of this DynamicValueboolean. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueboolean. # noqa: E501 + + + :return: The source_attribute of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueboolean. + + + :param source_attribute: The source_attribute of this DynamicValueboolean. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueboolean. # noqa: E501 + + + :return: The source_type of this DynamicValueboolean. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueboolean. + + + :param source_type: The source_type of this DynamicValueboolean. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuedouble.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuedouble.py new file mode 100644 index 0000000..f8b016b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuedouble.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuedouble - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuedouble. # noqa: E501 + + + :return: The inherit of this DynamicValuedouble. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuedouble. + + + :param inherit: The inherit of this DynamicValuedouble. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuedouble. # noqa: E501 + + + :return: The source_attribute of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuedouble. + + + :param source_attribute: The source_attribute of this DynamicValuedouble. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuedouble. # noqa: E501 + + + :return: The source_type of this DynamicValuedouble. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuedouble. + + + :param source_type: The source_type of this DynamicValuedouble. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valueint.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valueint.py new file mode 100644 index 0000000..bbf937b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valueint.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValueint - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValueint. # noqa: E501 + + + :return: The inherit of this DynamicValueint. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValueint. + + + :param inherit: The inherit of this DynamicValueint. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValueint. # noqa: E501 + + + :return: The source_attribute of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValueint. + + + :param source_attribute: The source_attribute of this DynamicValueint. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValueint. # noqa: E501 + + + :return: The source_type of this DynamicValueint. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValueint. + + + :param source_type: The source_type of this DynamicValueint. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuelong.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuelong.py new file mode 100644 index 0000000..ca901f4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuelong.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuelong - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuelong. # noqa: E501 + + + :return: The inherit of this DynamicValuelong. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuelong. + + + :param inherit: The inherit of this DynamicValuelong. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuelong. # noqa: E501 + + + :return: The source_attribute of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuelong. + + + :param source_attribute: The source_attribute of this DynamicValuelong. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuelong. # noqa: E501 + + + :return: The source_type of this DynamicValuelong. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuelong. + + + :param source_type: The source_type of this DynamicValuelong. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuestring.py b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuestring.py new file mode 100644 index 0000000..a7abee0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/dynamic_valuestring.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class DynamicValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'inherit': 'bool', + 'source_attribute': 'str', + 'source_type': 'str' + } + + attribute_map = { + 'inherit': 'inherit', + 'source_attribute': 'sourceAttribute', + 'source_type': 'sourceType' + } + + def __init__(self, inherit=None, source_attribute=None, source_type=None): # noqa: E501 + """DynamicValuestring - a model defined in Swagger""" # noqa: E501 + self._inherit = None + self._source_attribute = None + self._source_type = None + self.discriminator = None + if inherit is not None: + self.inherit = inherit + if source_attribute is not None: + self.source_attribute = source_attribute + if source_type is not None: + self.source_type = source_type + + @property + def inherit(self): + """Gets the inherit of this DynamicValuestring. # noqa: E501 + + + :return: The inherit of this DynamicValuestring. # noqa: E501 + :rtype: bool + """ + return self._inherit + + @inherit.setter + def inherit(self, inherit): + """Sets the inherit of this DynamicValuestring. + + + :param inherit: The inherit of this DynamicValuestring. # noqa: E501 + :type: bool + """ + + self._inherit = inherit + + @property + def source_attribute(self): + """Gets the source_attribute of this DynamicValuestring. # noqa: E501 + + + :return: The source_attribute of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_attribute + + @source_attribute.setter + def source_attribute(self, source_attribute): + """Sets the source_attribute of this DynamicValuestring. + + + :param source_attribute: The source_attribute of this DynamicValuestring. # noqa: E501 + :type: str + """ + + self._source_attribute = source_attribute + + @property + def source_type(self): + """Gets the source_type of this DynamicValuestring. # noqa: E501 + + + :return: The source_type of this DynamicValuestring. # noqa: E501 + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """Sets the source_type of this DynamicValuestring. + + + :param source_type: The source_type of this DynamicValuestring. # noqa: E501 + :type: str + """ + allowed_values = ["CURRENT_CUSTOMER", "CURRENT_DEVICE", "CURRENT_TENANT", "CURRENT_USER"] # noqa: E501 + if source_type not in allowed_values: + raise ValueError( + "Invalid value for `source_type` ({0}), must be one of {1}" # noqa: E501 + .format(source_type, allowed_values) + ) + + self._source_type = source_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(DynamicValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, DynamicValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge.py new file mode 100644 index 0000000..f819fa6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge.py @@ -0,0 +1,484 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Edge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str', + 'edge_license_key': 'str', + 'cloud_endpoint': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret', + 'edge_license_key': 'edgeLicenseKey', + 'cloud_endpoint': 'cloudEndpoint' + } + + def __init__(self, additional_info=None, owner_id=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None, edge_license_key=None, cloud_endpoint=None): # noqa: E501 + """Edge - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._owner_id = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self._edge_license_key = None + self._cloud_endpoint = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + self.edge_license_key = edge_license_key + self.cloud_endpoint = cloud_endpoint + + @property + def additional_info(self): + """Gets the additional_info of this Edge. # noqa: E501 + + + :return: The additional_info of this Edge. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Edge. + + + :param additional_info: The additional_info of this Edge. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this Edge. # noqa: E501 + + + :return: The owner_id of this Edge. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Edge. + + + :param owner_id: The owner_id of this Edge. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def id(self): + """Gets the id of this Edge. # noqa: E501 + + + :return: The id of this Edge. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Edge. + + + :param id: The id of this Edge. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Edge. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this Edge. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Edge. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Edge. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Edge. # noqa: E501 + + + :return: The tenant_id of this Edge. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Edge. + + + :param tenant_id: The tenant_id of this Edge. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Edge. # noqa: E501 + + + :return: The customer_id of this Edge. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Edge. + + + :param customer_id: The customer_id of this Edge. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this Edge. # noqa: E501 + + + :return: The root_rule_chain_id of this Edge. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this Edge. + + + :param root_rule_chain_id: The root_rule_chain_id of this Edge. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this Edge. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this Edge. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Edge. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this Edge. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Edge. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this Edge. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Edge. + + Edge type # noqa: E501 + + :param type: The type of this Edge. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this Edge. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this Edge. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this Edge. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this Edge. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this Edge. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this Edge. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this Edge. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this Edge. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this Edge. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this Edge. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this Edge. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this Edge. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + @property + def edge_license_key(self): + """Gets the edge_license_key of this Edge. # noqa: E501 + + Edge license key obtained from license portal # noqa: E501 + + :return: The edge_license_key of this Edge. # noqa: E501 + :rtype: str + """ + return self._edge_license_key + + @edge_license_key.setter + def edge_license_key(self, edge_license_key): + """Sets the edge_license_key of this Edge. + + Edge license key obtained from license portal # noqa: E501 + + :param edge_license_key: The edge_license_key of this Edge. # noqa: E501 + :type: str + """ + if edge_license_key is None: + raise ValueError("Invalid value for `edge_license_key`, must not be `None`") # noqa: E501 + + self._edge_license_key = edge_license_key + + @property + def cloud_endpoint(self): + """Gets the cloud_endpoint of this Edge. # noqa: E501 + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :return: The cloud_endpoint of this Edge. # noqa: E501 + :rtype: str + """ + return self._cloud_endpoint + + @cloud_endpoint.setter + def cloud_endpoint(self, cloud_endpoint): + """Sets the cloud_endpoint of this Edge. + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :param cloud_endpoint: The cloud_endpoint of this Edge. # noqa: E501 + :type: str + """ + if cloud_endpoint is None: + raise ValueError("Invalid value for `cloud_endpoint`, must not be `None`") # noqa: E501 + + self._cloud_endpoint = cloud_endpoint + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Edge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Edge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_event.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_event.py new file mode 100644 index 0000000..e72eec9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_event.py @@ -0,0 +1,370 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'action': 'str', + 'body': 'JsonNode', + 'created_time': 'int', + 'edge_id': 'EdgeId', + 'entity_group_id': 'str', + 'entity_id': 'str', + 'id': 'EdgeEventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str' + } + + attribute_map = { + 'action': 'action', + 'body': 'body', + 'created_time': 'createdTime', + 'edge_id': 'edgeId', + 'entity_group_id': 'entityGroupId', + 'entity_id': 'entityId', + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid' + } + + def __init__(self, action=None, body=None, created_time=None, edge_id=None, entity_group_id=None, entity_id=None, id=None, tenant_id=None, type=None, uid=None): # noqa: E501 + """EdgeEvent - a model defined in Swagger""" # noqa: E501 + self._action = None + self._body = None + self._created_time = None + self._edge_id = None + self._entity_group_id = None + self._entity_id = None + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self.discriminator = None + if action is not None: + self.action = action + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + if edge_id is not None: + self.edge_id = edge_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if entity_id is not None: + self.entity_id = entity_id + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + + @property + def action(self): + """Gets the action of this EdgeEvent. # noqa: E501 + + + :return: The action of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._action + + @action.setter + def action(self, action): + """Sets the action of this EdgeEvent. + + + :param action: The action of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADDED", "ADDED_TO_ENTITY_GROUP", "ALARM_ACK", "ALARM_ASSIGNED", "ALARM_CLEAR", "ALARM_UNASSIGNED", "ASSIGNED_TO_EDGE", "ATTRIBUTES_DELETED", "ATTRIBUTES_UPDATED", "CHANGE_OWNER", "CREDENTIALS_REQUEST", "CREDENTIALS_UPDATED", "DELETED", "ENTITY_MERGE_REQUEST", "POST_ATTRIBUTES", "RELATION_ADD_OR_UPDATE", "RELATION_DELETED", "REMOVED_FROM_ENTITY_GROUP", "RPC_CALL", "TIMESERIES_UPDATED", "UNASSIGNED_FROM_EDGE", "UPDATED"] # noqa: E501 + if action not in allowed_values: + raise ValueError( + "Invalid value for `action` ({0}), must be one of {1}" # noqa: E501 + .format(action, allowed_values) + ) + + self._action = action + + @property + def body(self): + """Gets the body of this EdgeEvent. # noqa: E501 + + + :return: The body of this EdgeEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EdgeEvent. + + + :param body: The body of this EdgeEvent. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EdgeEvent. # noqa: E501 + + + :return: The created_time of this EdgeEvent. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeEvent. + + + :param created_time: The created_time of this EdgeEvent. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def edge_id(self): + """Gets the edge_id of this EdgeEvent. # noqa: E501 + + + :return: The edge_id of this EdgeEvent. # noqa: E501 + :rtype: EdgeId + """ + return self._edge_id + + @edge_id.setter + def edge_id(self, edge_id): + """Sets the edge_id of this EdgeEvent. + + + :param edge_id: The edge_id of this EdgeEvent. # noqa: E501 + :type: EdgeId + """ + + self._edge_id = edge_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this EdgeEvent. # noqa: E501 + + + :return: The entity_group_id of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this EdgeEvent. + + + :param entity_group_id: The entity_group_id of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._entity_group_id = entity_group_id + + @property + def entity_id(self): + """Gets the entity_id of this EdgeEvent. # noqa: E501 + + + :return: The entity_id of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EdgeEvent. + + + :param entity_id: The entity_id of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def id(self): + """Gets the id of this EdgeEvent. # noqa: E501 + + + :return: The id of this EdgeEvent. # noqa: E501 + :rtype: EdgeEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEvent. + + + :param id: The id of this EdgeEvent. # noqa: E501 + :type: EdgeEventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeEvent. # noqa: E501 + + + :return: The tenant_id of this EdgeEvent. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeEvent. + + + :param tenant_id: The tenant_id of this EdgeEvent. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EdgeEvent. # noqa: E501 + + + :return: The type of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeEvent. + + + :param type: The type of this EdgeEvent. # noqa: E501 + :type: str + """ + allowed_values = ["ADMIN_SETTINGS", "ALARM", "ASSET", "ASSET_PROFILE", "CONVERTER", "CUSTOMER", "CUSTOM_TRANSLATION", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "LOGIN_WHITE_LABELING", "OTA_PACKAGE", "QUEUE", "RELATION", "ROLE", "RULE_CHAIN", "RULE_CHAIN_METADATA", "SCHEDULER_EVENT", "TENANT", "USER", "WHITE_LABELING", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def uid(self): + """Gets the uid of this EdgeEvent. # noqa: E501 + + + :return: The uid of this EdgeEvent. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EdgeEvent. + + + :param uid: The uid of this EdgeEvent. # noqa: E501 + :type: str + """ + + self._uid = uid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_event_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_event_id.py new file mode 100644 index 0000000..36b044e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeEventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EdgeEventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EdgeEventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EdgeEventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeEventId. + + string # noqa: E501 + + :param id: The id of this EdgeEventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeEventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeEventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_id.py new file mode 100644 index 0000000..8871efb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EdgeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EdgeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EdgeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EdgeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EdgeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EdgeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EdgeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["EDGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_info.py new file mode 100644 index 0000000..fac6493 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_info.py @@ -0,0 +1,540 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'id': 'EdgeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'root_rule_chain_id': 'RuleChainId', + 'name': 'str', + 'type': 'str', + 'label': 'str', + 'routing_key': 'str', + 'secret': 'str', + 'edge_license_key': 'str', + 'cloud_endpoint': 'str', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'root_rule_chain_id': 'rootRuleChainId', + 'name': 'name', + 'type': 'type', + 'label': 'label', + 'routing_key': 'routingKey', + 'secret': 'secret', + 'edge_license_key': 'edgeLicenseKey', + 'cloud_endpoint': 'cloudEndpoint', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, additional_info=None, owner_id=None, id=None, created_time=None, tenant_id=None, customer_id=None, root_rule_chain_id=None, name=None, type=None, label=None, routing_key=None, secret=None, edge_license_key=None, cloud_endpoint=None, owner_name=None, groups=None): # noqa: E501 + """EdgeInfo - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._owner_id = None + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._root_rule_chain_id = None + self._name = None + self._type = None + self._label = None + self._routing_key = None + self._secret = None + self._edge_license_key = None + self._cloud_endpoint = None + self._owner_name = None + self._groups = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if root_rule_chain_id is not None: + self.root_rule_chain_id = root_rule_chain_id + self.name = name + self.type = type + if label is not None: + self.label = label + self.routing_key = routing_key + self.secret = secret + self.edge_license_key = edge_license_key + self.cloud_endpoint = cloud_endpoint + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def additional_info(self): + """Gets the additional_info of this EdgeInfo. # noqa: E501 + + + :return: The additional_info of this EdgeInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EdgeInfo. + + + :param additional_info: The additional_info of this EdgeInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this EdgeInfo. # noqa: E501 + + + :return: The owner_id of this EdgeInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EdgeInfo. + + + :param owner_id: The owner_id of this EdgeInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def id(self): + """Gets the id of this EdgeInfo. # noqa: E501 + + + :return: The id of this EdgeInfo. # noqa: E501 + :rtype: EdgeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EdgeInfo. + + + :param id: The id of this EdgeInfo. # noqa: E501 + :type: EdgeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EdgeInfo. # noqa: E501 + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :return: The created_time of this EdgeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EdgeInfo. + + Timestamp of the edge creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EdgeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EdgeInfo. # noqa: E501 + + + :return: The tenant_id of this EdgeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EdgeInfo. + + + :param tenant_id: The tenant_id of this EdgeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EdgeInfo. # noqa: E501 + + + :return: The customer_id of this EdgeInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EdgeInfo. + + + :param customer_id: The customer_id of this EdgeInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def root_rule_chain_id(self): + """Gets the root_rule_chain_id of this EdgeInfo. # noqa: E501 + + + :return: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._root_rule_chain_id + + @root_rule_chain_id.setter + def root_rule_chain_id(self, root_rule_chain_id): + """Sets the root_rule_chain_id of this EdgeInfo. + + + :param root_rule_chain_id: The root_rule_chain_id of this EdgeInfo. # noqa: E501 + :type: RuleChainId + """ + + self._root_rule_chain_id = root_rule_chain_id + + @property + def name(self): + """Gets the name of this EdgeInfo. # noqa: E501 + + Unique Edge Name in scope of Tenant # noqa: E501 + + :return: The name of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EdgeInfo. + + Unique Edge Name in scope of Tenant # noqa: E501 + + :param name: The name of this EdgeInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EdgeInfo. # noqa: E501 + + Edge type # noqa: E501 + + :return: The type of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EdgeInfo. + + Edge type # noqa: E501 + + :param type: The type of this EdgeInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def label(self): + """Gets the label of this EdgeInfo. # noqa: E501 + + Label that may be used in widgets # noqa: E501 + + :return: The label of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._label + + @label.setter + def label(self, label): + """Sets the label of this EdgeInfo. + + Label that may be used in widgets # noqa: E501 + + :param label: The label of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._label = label + + @property + def routing_key(self): + """Gets the routing_key of this EdgeInfo. # noqa: E501 + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :return: The routing_key of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this EdgeInfo. + + Edge routing key ('username') to authorize on cloud # noqa: E501 + + :param routing_key: The routing_key of this EdgeInfo. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def secret(self): + """Gets the secret of this EdgeInfo. # noqa: E501 + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :return: The secret of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this EdgeInfo. + + Edge secret ('password') to authorize on cloud # noqa: E501 + + :param secret: The secret of this EdgeInfo. # noqa: E501 + :type: str + """ + if secret is None: + raise ValueError("Invalid value for `secret`, must not be `None`") # noqa: E501 + + self._secret = secret + + @property + def edge_license_key(self): + """Gets the edge_license_key of this EdgeInfo. # noqa: E501 + + Edge license key obtained from license portal # noqa: E501 + + :return: The edge_license_key of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._edge_license_key + + @edge_license_key.setter + def edge_license_key(self, edge_license_key): + """Sets the edge_license_key of this EdgeInfo. + + Edge license key obtained from license portal # noqa: E501 + + :param edge_license_key: The edge_license_key of this EdgeInfo. # noqa: E501 + :type: str + """ + if edge_license_key is None: + raise ValueError("Invalid value for `edge_license_key`, must not be `None`") # noqa: E501 + + self._edge_license_key = edge_license_key + + @property + def cloud_endpoint(self): + """Gets the cloud_endpoint of this EdgeInfo. # noqa: E501 + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :return: The cloud_endpoint of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._cloud_endpoint + + @cloud_endpoint.setter + def cloud_endpoint(self, cloud_endpoint): + """Sets the cloud_endpoint of this EdgeInfo. + + Edge uses this cloud URL to activate and periodically check it's license # noqa: E501 + + :param cloud_endpoint: The cloud_endpoint of this EdgeInfo. # noqa: E501 + :type: str + """ + if cloud_endpoint is None: + raise ValueError("Invalid value for `cloud_endpoint`, must not be `None`") # noqa: E501 + + self._cloud_endpoint = cloud_endpoint + + @property + def owner_name(self): + """Gets the owner_name of this EdgeInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this EdgeInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this EdgeInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this EdgeInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this EdgeInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this EdgeInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this EdgeInfo. + + Groups # noqa: E501 + + :param groups: The groups of this EdgeInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_install_instructions.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_install_instructions.py new file mode 100644 index 0000000..7b6ba1e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_install_instructions.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeInstallInstructions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'docker_install_instructions': 'str' + } + + attribute_map = { + 'docker_install_instructions': 'dockerInstallInstructions' + } + + def __init__(self, docker_install_instructions=None): # noqa: E501 + """EdgeInstallInstructions - a model defined in Swagger""" # noqa: E501 + self._docker_install_instructions = None + self.discriminator = None + if docker_install_instructions is not None: + self.docker_install_instructions = docker_install_instructions + + @property + def docker_install_instructions(self): + """Gets the docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + + Markdown with docker install instructions # noqa: E501 + + :return: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :rtype: str + """ + return self._docker_install_instructions + + @docker_install_instructions.setter + def docker_install_instructions(self, docker_install_instructions): + """Sets the docker_install_instructions of this EdgeInstallInstructions. + + Markdown with docker install instructions # noqa: E501 + + :param docker_install_instructions: The docker_install_instructions of this EdgeInstallInstructions. # noqa: E501 + :type: str + """ + + self._docker_install_instructions = docker_install_instructions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeInstallInstructions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeInstallInstructions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_search_query.py new file mode 100644 index 0000000..d677f21 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EdgeSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'edge_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'edge_types': 'edgeTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, edge_types=None, parameters=None): # noqa: E501 + """EdgeSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._edge_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if edge_types is not None: + self.edge_types = edge_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQuery. # noqa: E501 + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EdgeSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQuery. + + Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EdgeSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQuery. # noqa: E501 + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :return: The edge_types of this EdgeSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQuery. + + Array of edge types to filter the related entities (e.g. 'Silos', 'Stores'). # noqa: E501 + + :param edge_types: The edge_types of this EdgeSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def parameters(self): + """Gets the parameters of this EdgeSearchQuery. # noqa: E501 + + + :return: The parameters of this EdgeSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EdgeSearchQuery. + + + :param parameters: The parameters of this EdgeSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_search_query_filter.py new file mode 100644 index 0000000..91ba41f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'edge_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'edge_types': 'edgeTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, edge_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EdgeSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._edge_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if edge_types is not None: + self.edge_types = edge_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EdgeSearchQueryFilter. + + + :param direction: The direction of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def edge_types(self): + """Gets the edge_types of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeSearchQueryFilter. + + + :param edge_types: The edge_types of this EdgeSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EdgeSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EdgeSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EdgeSearchQueryFilter. + + + :param max_level: The max_level of this EdgeSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EdgeSearchQueryFilter. + + + :param relation_type: The relation_type of this EdgeSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EdgeSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EdgeSearchQueryFilter. + + + :param root_entity: The root_entity of this EdgeSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/edge_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_type_filter.py new file mode 100644 index 0000000..e5945e6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/edge_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EdgeTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edge_name_filter': 'str', + 'edge_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'edge_name_filter': 'edgeNameFilter', + 'edge_types': 'edgeTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, edge_name_filter=None, edge_types=None, *args, **kwargs): # noqa: E501 + """EdgeTypeFilter - a model defined in Swagger""" # noqa: E501 + self._edge_name_filter = None + self._edge_types = None + self.discriminator = None + if edge_name_filter is not None: + self.edge_name_filter = edge_name_filter + if edge_types is not None: + self.edge_types = edge_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def edge_name_filter(self): + """Gets the edge_name_filter of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :rtype: str + """ + return self._edge_name_filter + + @edge_name_filter.setter + def edge_name_filter(self, edge_name_filter): + """Sets the edge_name_filter of this EdgeTypeFilter. + + + :param edge_name_filter: The edge_name_filter of this EdgeTypeFilter. # noqa: E501 + :type: str + """ + + self._edge_name_filter = edge_name_filter + + @property + def edge_types(self): + """Gets the edge_types of this EdgeTypeFilter. # noqa: E501 + + + :return: The edge_types of this EdgeTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._edge_types + + @edge_types.setter + def edge_types(self, edge_types): + """Sets the edge_types of this EdgeTypeFilter. + + + :param edge_types: The edge_types of this EdgeTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._edge_types = edge_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EdgeTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EdgeTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/efento_coap_device_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/efento_coap_device_type_configuration.py new file mode 100644 index 0000000..b350d27 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/efento_coap_device_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EfentoCoapDeviceTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """EfentoCoapDeviceTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EfentoCoapDeviceTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EfentoCoapDeviceTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/email_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_pe/email_delivery_method_notification_template.py new file mode 100644 index 0000000..d59a3a3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/email_delivery_method_notification_template.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.delivery_method_notification_template import DeliveryMethodNotificationTemplate # noqa: F401,E501 + +class EmailDeliveryMethodNotificationTemplate(DeliveryMethodNotificationTemplate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + if hasattr(DeliveryMethodNotificationTemplate, "swagger_types"): + swagger_types.update(DeliveryMethodNotificationTemplate.swagger_types) + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + if hasattr(DeliveryMethodNotificationTemplate, "attribute_map"): + attribute_map.update(DeliveryMethodNotificationTemplate.attribute_map) + + def __init__(self, body=None, enabled=None, subject=None, *args, **kwargs): # noqa: E501 + """EmailDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + DeliveryMethodNotificationTemplate.__init__(self, *args, **kwargs) + + @property + def body(self): + """Gets the body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EmailDeliveryMethodNotificationTemplate. + + + :param body: The body of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this EmailDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this EmailDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this EmailDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/email_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/email_two_fa_account_config.py new file mode 100644 index 0000000..5632489 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/email_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EmailTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'email': 'email', + 'use_by_default': 'useByDefault' + } + + def __init__(self, email=None, use_by_default=None): # noqa: E501 + """EmailTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._email = None + self._use_by_default = None + self.discriminator = None + self.email = email + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def email(self): + """Gets the email of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this EmailTwoFaAccountConfig. + + + :param email: The email of this EmailTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if email is None: + raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 + + self._email = email + + @property + def use_by_default(self): + """Gets the use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this EmailTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this EmailTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/email_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/email_two_fa_provider_config.py new file mode 100644 index 0000000..16fb2ff --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/email_two_fa_provider_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.two_fa_provider_config import TwoFaProviderConfig # noqa: F401,E501 + +class EmailTwoFaProviderConfig(TwoFaProviderConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'verification_code_lifetime': 'int' + } + if hasattr(TwoFaProviderConfig, "swagger_types"): + swagger_types.update(TwoFaProviderConfig.swagger_types) + + attribute_map = { + 'verification_code_lifetime': 'verificationCodeLifetime' + } + if hasattr(TwoFaProviderConfig, "attribute_map"): + attribute_map.update(TwoFaProviderConfig.attribute_map) + + def __init__(self, verification_code_lifetime=None, *args, **kwargs): # noqa: E501 + """EmailTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._verification_code_lifetime = None + self.discriminator = None + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + TwoFaProviderConfig.__init__(self, *args, **kwargs) + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this EmailTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this EmailTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EmailTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EmailTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entities_by_group_name_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entities_by_group_name_filter.py new file mode 100644 index 0000000..5bfe156 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entities_by_group_name_filter.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntitiesByGroupNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group_name_filter': 'str', + 'group_type': 'str', + 'owner_id': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group_name_filter': 'entityGroupNameFilter', + 'group_type': 'groupType', + 'owner_id': 'ownerId' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group_name_filter=None, group_type=None, owner_id=None, *args, **kwargs): # noqa: E501 + """EntitiesByGroupNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group_name_filter = None + self._group_type = None + self._owner_id = None + self.discriminator = None + if entity_group_name_filter is not None: + self.entity_group_name_filter = entity_group_name_filter + if group_type is not None: + self.group_type = group_type + if owner_id is not None: + self.owner_id = owner_id + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group_name_filter(self): + """Gets the entity_group_name_filter of this EntitiesByGroupNameFilter. # noqa: E501 + + + :return: The entity_group_name_filter of this EntitiesByGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_group_name_filter + + @entity_group_name_filter.setter + def entity_group_name_filter(self, entity_group_name_filter): + """Sets the entity_group_name_filter of this EntitiesByGroupNameFilter. + + + :param entity_group_name_filter: The entity_group_name_filter of this EntitiesByGroupNameFilter. # noqa: E501 + :type: str + """ + + self._entity_group_name_filter = entity_group_name_filter + + @property + def group_type(self): + """Gets the group_type of this EntitiesByGroupNameFilter. # noqa: E501 + + + :return: The group_type of this EntitiesByGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntitiesByGroupNameFilter. + + + :param group_type: The group_type of this EntitiesByGroupNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + @property + def owner_id(self): + """Gets the owner_id of this EntitiesByGroupNameFilter. # noqa: E501 + + + :return: The owner_id of this EntitiesByGroupNameFilter. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntitiesByGroupNameFilter. + + + :param owner_id: The owner_id of this EntitiesByGroupNameFilter. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitiesByGroupNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitiesByGroupNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entities_limit_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entities_limit_notification_rule_trigger_config.py new file mode 100644 index 0000000..c19769c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entities_limit_notification_rule_trigger_config.py @@ -0,0 +1,195 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class EntitiesLimitNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'list[str]', + 'threshold': 'float', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'threshold': 'threshold', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, entity_types=None, threshold=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """EntitiesLimitNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._threshold = None + self._trigger_type = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if threshold is not None: + self.threshold = threshold + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def threshold(self): + """Gets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: float + """ + return self._threshold + + @threshold.setter + def threshold(self, threshold): + """Sets the threshold of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param threshold: The threshold of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: float + """ + + self._threshold = threshold + + @property + def trigger_type(self): + """Gets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntitiesLimitNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitiesLimitNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitiesLimitNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_action_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_action_notification_rule_trigger_config.py new file mode 100644 index 0000000..2a00ee8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_action_notification_rule_trigger_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityActionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'bool', + 'deleted': 'bool', + 'entity_types': 'list[str]', + 'trigger_type': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_types': 'entityTypes', + 'trigger_type': 'triggerType', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_types=None, trigger_type=None, updated=None): # noqa: E501 + """EntityActionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_types = None + self._trigger_type = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_types is not None: + self.entity_types = entity_types + if trigger_type is not None: + self.trigger_type = trigger_type + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityActionNotificationRuleTriggerConfig. + + + :param created: The created of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityActionNotificationRuleTriggerConfig. + + + :param deleted: The deleted of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._deleted = deleted + + @property + def entity_types(self): + """Gets the entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityActionNotificationRuleTriggerConfig. + + + :param entity_types: The entity_types of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + @property + def trigger_type(self): + """Gets the trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EntityActionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + @property + def updated(self): + """Gets the updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityActionNotificationRuleTriggerConfig. + + + :param updated: The updated of this EntityActionNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityActionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityActionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_count_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_count_query.py new file mode 100644 index 0000000..f944aaf --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_count_query.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityCountQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]' + } + + attribute_map = { + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters' + } + + def __init__(self, entity_filter=None, key_filters=None): # noqa: E501 + """EntityCountQuery - a model defined in Swagger""" # noqa: E501 + self._entity_filter = None + self._key_filters = None + self.discriminator = None + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityCountQuery. # noqa: E501 + + + :return: The entity_filter of this EntityCountQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityCountQuery. + + + :param entity_filter: The entity_filter of this EntityCountQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityCountQuery. # noqa: E501 + + + :return: The key_filters of this EntityCountQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityCountQuery. + + + :param key_filters: The key_filters of this EntityCountQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityCountQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityCountQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data.py new file mode 100644 index 0000000..aec6ecc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'agg_latest': 'dict(str, ComparisonTsValue)', + 'entity_id': 'EntityId', + 'latest': 'dict(str, object)', + 'read_attrs': 'bool', + 'read_ts': 'bool', + 'timeseries': 'dict(str, list[TsValue])' + } + + attribute_map = { + 'agg_latest': 'aggLatest', + 'entity_id': 'entityId', + 'latest': 'latest', + 'read_attrs': 'readAttrs', + 'read_ts': 'readTs', + 'timeseries': 'timeseries' + } + + def __init__(self, agg_latest=None, entity_id=None, latest=None, read_attrs=None, read_ts=None, timeseries=None): # noqa: E501 + """EntityData - a model defined in Swagger""" # noqa: E501 + self._agg_latest = None + self._entity_id = None + self._latest = None + self._read_attrs = None + self._read_ts = None + self._timeseries = None + self.discriminator = None + if agg_latest is not None: + self.agg_latest = agg_latest + if entity_id is not None: + self.entity_id = entity_id + if latest is not None: + self.latest = latest + if read_attrs is not None: + self.read_attrs = read_attrs + if read_ts is not None: + self.read_ts = read_ts + if timeseries is not None: + self.timeseries = timeseries + + @property + def agg_latest(self): + """Gets the agg_latest of this EntityData. # noqa: E501 + + + :return: The agg_latest of this EntityData. # noqa: E501 + :rtype: dict(str, ComparisonTsValue) + """ + return self._agg_latest + + @agg_latest.setter + def agg_latest(self, agg_latest): + """Sets the agg_latest of this EntityData. + + + :param agg_latest: The agg_latest of this EntityData. # noqa: E501 + :type: dict(str, ComparisonTsValue) + """ + + self._agg_latest = agg_latest + + @property + def entity_id(self): + """Gets the entity_id of this EntityData. # noqa: E501 + + + :return: The entity_id of this EntityData. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityData. + + + :param entity_id: The entity_id of this EntityData. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def latest(self): + """Gets the latest of this EntityData. # noqa: E501 + + + :return: The latest of this EntityData. # noqa: E501 + :rtype: dict(str, object) + """ + return self._latest + + @latest.setter + def latest(self, latest): + """Sets the latest of this EntityData. + + + :param latest: The latest of this EntityData. # noqa: E501 + :type: dict(str, object) + """ + + self._latest = latest + + @property + def read_attrs(self): + """Gets the read_attrs of this EntityData. # noqa: E501 + + + :return: The read_attrs of this EntityData. # noqa: E501 + :rtype: bool + """ + return self._read_attrs + + @read_attrs.setter + def read_attrs(self, read_attrs): + """Sets the read_attrs of this EntityData. + + + :param read_attrs: The read_attrs of this EntityData. # noqa: E501 + :type: bool + """ + + self._read_attrs = read_attrs + + @property + def read_ts(self): + """Gets the read_ts of this EntityData. # noqa: E501 + + + :return: The read_ts of this EntityData. # noqa: E501 + :rtype: bool + """ + return self._read_ts + + @read_ts.setter + def read_ts(self, read_ts): + """Sets the read_ts of this EntityData. + + + :param read_ts: The read_ts of this EntityData. # noqa: E501 + :type: bool + """ + + self._read_ts = read_ts + + @property + def timeseries(self): + """Gets the timeseries of this EntityData. # noqa: E501 + + + :return: The timeseries of this EntityData. # noqa: E501 + :rtype: dict(str, list[TsValue]) + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this EntityData. + + + :param timeseries: The timeseries of this EntityData. # noqa: E501 + :type: dict(str, list[TsValue]) + """ + + self._timeseries = timeseries + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_diff.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_diff.py new file mode 100644 index 0000000..fef6de1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_diff.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataDiff(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'current_version': 'EntityExportDataobject', + 'other_version': 'EntityExportDataobject' + } + + attribute_map = { + 'current_version': 'currentVersion', + 'other_version': 'otherVersion' + } + + def __init__(self, current_version=None, other_version=None): # noqa: E501 + """EntityDataDiff - a model defined in Swagger""" # noqa: E501 + self._current_version = None + self._other_version = None + self.discriminator = None + if current_version is not None: + self.current_version = current_version + if other_version is not None: + self.other_version = other_version + + @property + def current_version(self): + """Gets the current_version of this EntityDataDiff. # noqa: E501 + + + :return: The current_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this EntityDataDiff. + + + :param current_version: The current_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._current_version = current_version + + @property + def other_version(self): + """Gets the other_version of this EntityDataDiff. # noqa: E501 + + + :return: The other_version of this EntityDataDiff. # noqa: E501 + :rtype: EntityExportDataobject + """ + return self._other_version + + @other_version.setter + def other_version(self, other_version): + """Sets the other_version of this EntityDataDiff. + + + :param other_version: The other_version of this EntityDataDiff. # noqa: E501 + :type: EntityExportDataobject + """ + + self._other_version = other_version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataDiff, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataDiff): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_info.py new file mode 100644 index 0000000..8ba013f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_info.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'has_attributes': 'bool', + 'has_credentials': 'bool', + 'has_group_entities': 'bool', + 'has_permissions': 'bool', + 'has_relations': 'bool' + } + + attribute_map = { + 'has_attributes': 'hasAttributes', + 'has_credentials': 'hasCredentials', + 'has_group_entities': 'hasGroupEntities', + 'has_permissions': 'hasPermissions', + 'has_relations': 'hasRelations' + } + + def __init__(self, has_attributes=None, has_credentials=None, has_group_entities=None, has_permissions=None, has_relations=None): # noqa: E501 + """EntityDataInfo - a model defined in Swagger""" # noqa: E501 + self._has_attributes = None + self._has_credentials = None + self._has_group_entities = None + self._has_permissions = None + self._has_relations = None + self.discriminator = None + if has_attributes is not None: + self.has_attributes = has_attributes + if has_credentials is not None: + self.has_credentials = has_credentials + if has_group_entities is not None: + self.has_group_entities = has_group_entities + if has_permissions is not None: + self.has_permissions = has_permissions + if has_relations is not None: + self.has_relations = has_relations + + @property + def has_attributes(self): + """Gets the has_attributes of this EntityDataInfo. # noqa: E501 + + + :return: The has_attributes of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_attributes + + @has_attributes.setter + def has_attributes(self, has_attributes): + """Sets the has_attributes of this EntityDataInfo. + + + :param has_attributes: The has_attributes of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_attributes = has_attributes + + @property + def has_credentials(self): + """Gets the has_credentials of this EntityDataInfo. # noqa: E501 + + + :return: The has_credentials of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_credentials + + @has_credentials.setter + def has_credentials(self, has_credentials): + """Sets the has_credentials of this EntityDataInfo. + + + :param has_credentials: The has_credentials of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_credentials = has_credentials + + @property + def has_group_entities(self): + """Gets the has_group_entities of this EntityDataInfo. # noqa: E501 + + + :return: The has_group_entities of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_group_entities + + @has_group_entities.setter + def has_group_entities(self, has_group_entities): + """Sets the has_group_entities of this EntityDataInfo. + + + :param has_group_entities: The has_group_entities of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_group_entities = has_group_entities + + @property + def has_permissions(self): + """Gets the has_permissions of this EntityDataInfo. # noqa: E501 + + + :return: The has_permissions of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_permissions + + @has_permissions.setter + def has_permissions(self, has_permissions): + """Sets the has_permissions of this EntityDataInfo. + + + :param has_permissions: The has_permissions of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_permissions = has_permissions + + @property + def has_relations(self): + """Gets the has_relations of this EntityDataInfo. # noqa: E501 + + + :return: The has_relations of this EntityDataInfo. # noqa: E501 + :rtype: bool + """ + return self._has_relations + + @has_relations.setter + def has_relations(self, has_relations): + """Sets the has_relations of this EntityDataInfo. + + + :param has_relations: The has_relations of this EntityDataInfo. # noqa: E501 + :type: bool + """ + + self._has_relations = has_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_page_link.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_page_link.py new file mode 100644 index 0000000..5d67aee --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_page_link.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataPageLink(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dynamic': 'bool', + 'page': 'int', + 'page_size': 'int', + 'sort_order': 'EntityDataSortOrder', + 'text_search': 'str' + } + + attribute_map = { + 'dynamic': 'dynamic', + 'page': 'page', + 'page_size': 'pageSize', + 'sort_order': 'sortOrder', + 'text_search': 'textSearch' + } + + def __init__(self, dynamic=None, page=None, page_size=None, sort_order=None, text_search=None): # noqa: E501 + """EntityDataPageLink - a model defined in Swagger""" # noqa: E501 + self._dynamic = None + self._page = None + self._page_size = None + self._sort_order = None + self._text_search = None + self.discriminator = None + if dynamic is not None: + self.dynamic = dynamic + if page is not None: + self.page = page + if page_size is not None: + self.page_size = page_size + if sort_order is not None: + self.sort_order = sort_order + if text_search is not None: + self.text_search = text_search + + @property + def dynamic(self): + """Gets the dynamic of this EntityDataPageLink. # noqa: E501 + + + :return: The dynamic of this EntityDataPageLink. # noqa: E501 + :rtype: bool + """ + return self._dynamic + + @dynamic.setter + def dynamic(self, dynamic): + """Sets the dynamic of this EntityDataPageLink. + + + :param dynamic: The dynamic of this EntityDataPageLink. # noqa: E501 + :type: bool + """ + + self._dynamic = dynamic + + @property + def page(self): + """Gets the page of this EntityDataPageLink. # noqa: E501 + + + :return: The page of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page + + @page.setter + def page(self, page): + """Sets the page of this EntityDataPageLink. + + + :param page: The page of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page = page + + @property + def page_size(self): + """Gets the page_size of this EntityDataPageLink. # noqa: E501 + + + :return: The page_size of this EntityDataPageLink. # noqa: E501 + :rtype: int + """ + return self._page_size + + @page_size.setter + def page_size(self, page_size): + """Sets the page_size of this EntityDataPageLink. + + + :param page_size: The page_size of this EntityDataPageLink. # noqa: E501 + :type: int + """ + + self._page_size = page_size + + @property + def sort_order(self): + """Gets the sort_order of this EntityDataPageLink. # noqa: E501 + + + :return: The sort_order of this EntityDataPageLink. # noqa: E501 + :rtype: EntityDataSortOrder + """ + return self._sort_order + + @sort_order.setter + def sort_order(self, sort_order): + """Sets the sort_order of this EntityDataPageLink. + + + :param sort_order: The sort_order of this EntityDataPageLink. # noqa: E501 + :type: EntityDataSortOrder + """ + + self._sort_order = sort_order + + @property + def text_search(self): + """Gets the text_search of this EntityDataPageLink. # noqa: E501 + + + :return: The text_search of this EntityDataPageLink. # noqa: E501 + :rtype: str + """ + return self._text_search + + @text_search.setter + def text_search(self, text_search): + """Sets the text_search of this EntityDataPageLink. + + + :param text_search: The text_search of this EntityDataPageLink. # noqa: E501 + :type: str + """ + + self._text_search = text_search + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataPageLink, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataPageLink): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_query.py new file mode 100644 index 0000000..ffa5bda --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_query.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_fields': 'list[EntityKey]', + 'entity_filter': 'EntityFilter', + 'key_filters': 'list[KeyFilter]', + 'latest_values': 'list[EntityKey]', + 'page_link': 'EntityDataPageLink' + } + + attribute_map = { + 'entity_fields': 'entityFields', + 'entity_filter': 'entityFilter', + 'key_filters': 'keyFilters', + 'latest_values': 'latestValues', + 'page_link': 'pageLink' + } + + def __init__(self, entity_fields=None, entity_filter=None, key_filters=None, latest_values=None, page_link=None): # noqa: E501 + """EntityDataQuery - a model defined in Swagger""" # noqa: E501 + self._entity_fields = None + self._entity_filter = None + self._key_filters = None + self._latest_values = None + self._page_link = None + self.discriminator = None + if entity_fields is not None: + self.entity_fields = entity_fields + if entity_filter is not None: + self.entity_filter = entity_filter + if key_filters is not None: + self.key_filters = key_filters + if latest_values is not None: + self.latest_values = latest_values + if page_link is not None: + self.page_link = page_link + + @property + def entity_fields(self): + """Gets the entity_fields of this EntityDataQuery. # noqa: E501 + + + :return: The entity_fields of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._entity_fields + + @entity_fields.setter + def entity_fields(self, entity_fields): + """Sets the entity_fields of this EntityDataQuery. + + + :param entity_fields: The entity_fields of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._entity_fields = entity_fields + + @property + def entity_filter(self): + """Gets the entity_filter of this EntityDataQuery. # noqa: E501 + + + :return: The entity_filter of this EntityDataQuery. # noqa: E501 + :rtype: EntityFilter + """ + return self._entity_filter + + @entity_filter.setter + def entity_filter(self, entity_filter): + """Sets the entity_filter of this EntityDataQuery. + + + :param entity_filter: The entity_filter of this EntityDataQuery. # noqa: E501 + :type: EntityFilter + """ + + self._entity_filter = entity_filter + + @property + def key_filters(self): + """Gets the key_filters of this EntityDataQuery. # noqa: E501 + + + :return: The key_filters of this EntityDataQuery. # noqa: E501 + :rtype: list[KeyFilter] + """ + return self._key_filters + + @key_filters.setter + def key_filters(self, key_filters): + """Sets the key_filters of this EntityDataQuery. + + + :param key_filters: The key_filters of this EntityDataQuery. # noqa: E501 + :type: list[KeyFilter] + """ + + self._key_filters = key_filters + + @property + def latest_values(self): + """Gets the latest_values of this EntityDataQuery. # noqa: E501 + + + :return: The latest_values of this EntityDataQuery. # noqa: E501 + :rtype: list[EntityKey] + """ + return self._latest_values + + @latest_values.setter + def latest_values(self, latest_values): + """Sets the latest_values of this EntityDataQuery. + + + :param latest_values: The latest_values of this EntityDataQuery. # noqa: E501 + :type: list[EntityKey] + """ + + self._latest_values = latest_values + + @property + def page_link(self): + """Gets the page_link of this EntityDataQuery. # noqa: E501 + + + :return: The page_link of this EntityDataQuery. # noqa: E501 + :rtype: EntityDataPageLink + """ + return self._page_link + + @page_link.setter + def page_link(self, page_link): + """Sets the page_link of this EntityDataQuery. + + + :param page_link: The page_link of this EntityDataQuery. # noqa: E501 + :type: EntityDataPageLink + """ + + self._page_link = page_link + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_sort_order.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_sort_order.py new file mode 100644 index 0000000..d9b1c47 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_data_sort_order.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityDataSortOrder(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'key': 'EntityKey' + } + + attribute_map = { + 'direction': 'direction', + 'key': 'key' + } + + def __init__(self, direction=None, key=None): # noqa: E501 + """EntityDataSortOrder - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._key = None + self.discriminator = None + if direction is not None: + self.direction = direction + if key is not None: + self.key = key + + @property + def direction(self): + """Gets the direction of this EntityDataSortOrder. # noqa: E501 + + + :return: The direction of this EntityDataSortOrder. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityDataSortOrder. + + + :param direction: The direction of this EntityDataSortOrder. # noqa: E501 + :type: str + """ + allowed_values = ["ASC", "DESC"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def key(self): + """Gets the key of this EntityDataSortOrder. # noqa: E501 + + + :return: The key of this EntityDataSortOrder. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityDataSortOrder. + + + :param key: The key of this EntityDataSortOrder. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityDataSortOrder, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityDataSortOrder): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_export_dataobject.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_export_dataobject.py new file mode 100644 index 0000000..efaa132 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_export_dataobject.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityExportDataobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'object', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None): # noqa: E501 + """EntityExportDataobject - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + + @property + def attributes(self): + """Gets the attributes of this EntityExportDataobject. # noqa: E501 + + + :return: The attributes of this EntityExportDataobject. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this EntityExportDataobject. + + + :param attributes: The attributes of this EntityExportDataobject. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this EntityExportDataobject. # noqa: E501 + + + :return: The entity of this EntityExportDataobject. # noqa: E501 + :rtype: object + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this EntityExportDataobject. + + + :param entity: The entity of this EntityExportDataobject. # noqa: E501 + :type: object + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this EntityExportDataobject. # noqa: E501 + + + :return: The entity_type of this EntityExportDataobject. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityExportDataobject. + + + :param entity_type: The entity_type of this EntityExportDataobject. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this EntityExportDataobject. # noqa: E501 + + + :return: The relations of this EntityExportDataobject. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this EntityExportDataobject. + + + :param relations: The relations of this EntityExportDataobject. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityExportDataobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityExportDataobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_filter.py new file mode 100644 index 0000000..c14d5f6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """EntityFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group.py new file mode 100644 index 0000000..88763f6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group.py @@ -0,0 +1,348 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityGroup(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityGroupId', + 'created_time': 'int', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode', + 'group_all': 'bool', + 'edge_group_all': 'bool' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration', + 'group_all': 'groupAll', + 'edge_group_all': 'edgeGroupAll' + } + + def __init__(self, id=None, created_time=None, owner_id=None, name=None, type=None, additional_info=None, configuration=None, group_all=None, edge_group_all=None): # noqa: E501 + """EntityGroup - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._owner_id = None + self._name = None + self._type = None + self._additional_info = None + self._configuration = None + self._group_all = None + self._edge_group_all = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + if group_all is not None: + self.group_all = group_all + if edge_group_all is not None: + self.edge_group_all = edge_group_all + + @property + def id(self): + """Gets the id of this EntityGroup. # noqa: E501 + + + :return: The id of this EntityGroup. # noqa: E501 + :rtype: EntityGroupId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityGroup. + + + :param id: The id of this EntityGroup. # noqa: E501 + :type: EntityGroupId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityGroup. # noqa: E501 + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityGroup. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityGroup. + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityGroup. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def owner_id(self): + """Gets the owner_id of this EntityGroup. # noqa: E501 + + + :return: The owner_id of this EntityGroup. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityGroup. + + + :param owner_id: The owner_id of this EntityGroup. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this EntityGroup. # noqa: E501 + + Name of the entity group # noqa: E501 + + :return: The name of this EntityGroup. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityGroup. + + Name of the entity group # noqa: E501 + + :param name: The name of this EntityGroup. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityGroup. # noqa: E501 + + + :return: The type of this EntityGroup. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityGroup. + + + :param type: The type of this EntityGroup. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET", "CUSTOMER", "DASHBOARD", "DEVICE", "EDGE", "ENTITY_VIEW", "USER"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def additional_info(self): + """Gets the additional_info of this EntityGroup. # noqa: E501 + + + :return: The additional_info of this EntityGroup. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityGroup. + + + :param additional_info: The additional_info of this EntityGroup. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this EntityGroup. # noqa: E501 + + + :return: The configuration of this EntityGroup. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this EntityGroup. + + + :param configuration: The configuration of this EntityGroup. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def group_all(self): + """Gets the group_all of this EntityGroup. # noqa: E501 + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The group_all of this EntityGroup. # noqa: E501 + :rtype: bool + """ + return self._group_all + + @group_all.setter + def group_all(self, group_all): + """Sets the group_all of this EntityGroup. + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param group_all: The group_all of this EntityGroup. # noqa: E501 + :type: bool + """ + + self._group_all = group_all + + @property + def edge_group_all(self): + """Gets the edge_group_all of this EntityGroup. # noqa: E501 + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The edge_group_all of this EntityGroup. # noqa: E501 + :rtype: bool + """ + return self._edge_group_all + + @edge_group_all.setter + def edge_group_all(self, edge_group_all): + """Sets the edge_group_all of this EntityGroup. + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param edge_group_all: The edge_group_all of this EntityGroup. # noqa: E501 + :type: bool + """ + + self._edge_group_all = edge_group_all + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroup, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroup): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_export_data.py new file mode 100644 index 0000000..2ddb134 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_export_data.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class EntityGroupExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'EntityGroup', + 'entity_type': 'str', + 'group_entities': 'bool', + 'permissions': 'list[GroupPermission]', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'group_entities': 'groupEntities', + 'permissions': 'permissions', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, group_entities=None, permissions=None, relations=None, *args, **kwargs): # noqa: E501 + """EntityGroupExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._group_entities = None + self._permissions = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if group_entities is not None: + self.group_entities = group_entities + if permissions is not None: + self.permissions = permissions + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this EntityGroupExportData. # noqa: E501 + + + :return: The attributes of this EntityGroupExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this EntityGroupExportData. + + + :param attributes: The attributes of this EntityGroupExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this EntityGroupExportData. # noqa: E501 + + + :return: The entity of this EntityGroupExportData. # noqa: E501 + :rtype: EntityGroup + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this EntityGroupExportData. + + + :param entity: The entity of this EntityGroupExportData. # noqa: E501 + :type: EntityGroup + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this EntityGroupExportData. # noqa: E501 + + + :return: The entity_type of this EntityGroupExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityGroupExportData. + + + :param entity_type: The entity_type of this EntityGroupExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def group_entities(self): + """Gets the group_entities of this EntityGroupExportData. # noqa: E501 + + + :return: The group_entities of this EntityGroupExportData. # noqa: E501 + :rtype: bool + """ + return self._group_entities + + @group_entities.setter + def group_entities(self, group_entities): + """Sets the group_entities of this EntityGroupExportData. + + + :param group_entities: The group_entities of this EntityGroupExportData. # noqa: E501 + :type: bool + """ + + self._group_entities = group_entities + + @property + def permissions(self): + """Gets the permissions of this EntityGroupExportData. # noqa: E501 + + + :return: The permissions of this EntityGroupExportData. # noqa: E501 + :rtype: list[GroupPermission] + """ + return self._permissions + + @permissions.setter + def permissions(self, permissions): + """Sets the permissions of this EntityGroupExportData. + + + :param permissions: The permissions of this EntityGroupExportData. # noqa: E501 + :type: list[GroupPermission] + """ + + self._permissions = permissions + + @property + def relations(self): + """Gets the relations of this EntityGroupExportData. # noqa: E501 + + + :return: The relations of this EntityGroupExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this EntityGroupExportData. + + + :param relations: The relations of this EntityGroupExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_filter.py new file mode 100644 index 0000000..f80823e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityGroupFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group': 'str', + 'group_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group': 'entityGroup', + 'group_type': 'groupType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group=None, group_type=None, *args, **kwargs): # noqa: E501 + """EntityGroupFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group = None + self._group_type = None + self.discriminator = None + if entity_group is not None: + self.entity_group = entity_group + if group_type is not None: + self.group_type = group_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group(self): + """Gets the entity_group of this EntityGroupFilter. # noqa: E501 + + + :return: The entity_group of this EntityGroupFilter. # noqa: E501 + :rtype: str + """ + return self._entity_group + + @entity_group.setter + def entity_group(self, entity_group): + """Sets the entity_group of this EntityGroupFilter. + + + :param entity_group: The entity_group of this EntityGroupFilter. # noqa: E501 + :type: str + """ + + self._entity_group = entity_group + + @property + def group_type(self): + """Gets the group_type of this EntityGroupFilter. # noqa: E501 + + + :return: The group_type of this EntityGroupFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntityGroupFilter. + + + :param group_type: The group_type of this EntityGroupFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_id.py new file mode 100644 index 0000000..50c0209 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityGroupId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityGroupId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityGroupId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityGroupId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityGroupId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityGroupId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this AssetId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this AssetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this AssetId. + + string # noqa: E501 + + :param entity_type: The entity_type of this AssetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ENTITY_GROUP"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_info.py new file mode 100644 index 0000000..9586dc2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_info.py @@ -0,0 +1,389 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityGroupInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityGroupId', + 'created_time': 'int', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode', + 'group_all': 'bool', + 'edge_group_all': 'bool', + 'external_id': 'str', + 'owner_ids': 'list[EntityId]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration', + 'group_all': 'groupAll', + 'edge_group_all': 'edgeGroupAll', + 'external_id': 'externalId', + 'owner_ids': 'ownerIds' + } + + def __init__(self, id=None, created_time=None, owner_id=None, external_id=None, name=None, type=None, additional_info=None, configuration=None, group_all=None, edge_group_all=None, owner_ids=None): # noqa: E501 + """EntityGroupInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._owner_id = None + self._name = None + self._type = None + self._additional_info = None + self._configuration = None + self._group_all = None + self._edge_group_all = None + self._owner_ids = None + self._external_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + if group_all is not None: + self.group_all = group_all + if edge_group_all is not None: + self.edge_group_all = edge_group_all + self.owner_ids = owner_ids + self.external_id = external_id + + @property + def id(self): + """Gets the id of this EntityGroupInfo. # noqa: E501 + + + :return: The id of this EntityGroupInfo. # noqa: E501 + :rtype: EntityGroupId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityGroupInfo. + + + :param id: The id of this EntityGroupInfo. # noqa: E501 + :type: EntityGroupId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityGroupInfo. # noqa: E501 + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityGroupInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityGroupInfo. + + Timestamp of the entity group creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityGroupInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def owner_id(self): + """Gets the owner_id of this EntityGroupInfo. # noqa: E501 + + + :return: The owner_id of this EntityGroupInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityGroupInfo. + + + :param owner_id: The owner_id of this EntityGroupInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this EntityGroupInfo. # noqa: E501 + + Name of the entity group # noqa: E501 + + :return: The name of this EntityGroupInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityGroupInfo. + + Name of the entity group # noqa: E501 + + :param name: The name of this EntityGroupInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityGroupInfo. # noqa: E501 + + + :return: The type of this EntityGroupInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityGroupInfo. + + + :param type: The type of this EntityGroupInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["ASSET", "CUSTOMER", "DASHBOARD", "DEVICE", "EDGE", "ENTITY_VIEW", "USER"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, value): + self._external_id = value + + @property + def additional_info(self): + """Gets the additional_info of this EntityGroupInfo. # noqa: E501 + + + :return: The additional_info of this EntityGroupInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityGroupInfo. + + + :param additional_info: The additional_info of this EntityGroupInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this EntityGroupInfo. # noqa: E501 + + + :return: The configuration of this EntityGroupInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this EntityGroupInfo. + + + :param configuration: The configuration of this EntityGroupInfo. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def group_all(self): + """Gets the group_all of this EntityGroupInfo. # noqa: E501 + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The group_all of this EntityGroupInfo. # noqa: E501 + :rtype: bool + """ + return self._group_all + + @group_all.setter + def group_all(self, group_all): + """Sets the group_all of this EntityGroupInfo. + + Indicates special group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param group_all: The group_all of this EntityGroupInfo. # noqa: E501 + :type: bool + """ + + self._group_all = group_all + + @property + def edge_group_all(self): + """Gets the edge_group_all of this EntityGroupInfo. # noqa: E501 + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :return: The edge_group_all of this EntityGroupInfo. # noqa: E501 + :rtype: bool + """ + return self._edge_group_all + + @edge_group_all.setter + def edge_group_all(self, edge_group_all): + """Sets the edge_group_all of this EntityGroupInfo. + + Indicates special edge group 'All' that contains all entities and can't be deleted. # noqa: E501 + + :param edge_group_all: The edge_group_all of this EntityGroupInfo. # noqa: E501 + :type: bool + """ + + self._edge_group_all = edge_group_all + + @property + def owner_ids(self): + """Gets the owner_ids of this EntityGroupInfo. # noqa: E501 + + List of the entity group owners. # noqa: E501 + + :return: The owner_ids of this EntityGroupInfo. # noqa: E501 + :rtype: list[EntityId] + """ + return self._owner_ids + + @owner_ids.setter + def owner_ids(self, owner_ids): + """Sets the owner_ids of this EntityGroupInfo. + + List of the entity group owners. # noqa: E501 + + :param owner_ids: The owner_ids of this EntityGroupInfo. # noqa: E501 + :type: list[EntityId] + """ + if owner_ids is None: + raise ValueError("Invalid value for `owner_ids`, must not be `None`") # noqa: E501 + + self._owner_ids = owner_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_list_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_list_filter.py new file mode 100644 index 0000000..99a2a3b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_list_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityGroupListFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group_list': 'list[str]', + 'group_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group_list': 'entityGroupList', + 'group_type': 'groupType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group_list=None, group_type=None, *args, **kwargs): # noqa: E501 + """EntityGroupListFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group_list = None + self._group_type = None + self.discriminator = None + if entity_group_list is not None: + self.entity_group_list = entity_group_list + if group_type is not None: + self.group_type = group_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group_list(self): + """Gets the entity_group_list of this EntityGroupListFilter. # noqa: E501 + + + :return: The entity_group_list of this EntityGroupListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_group_list + + @entity_group_list.setter + def entity_group_list(self, entity_group_list): + """Sets the entity_group_list of this EntityGroupListFilter. + + + :param entity_group_list: The entity_group_list of this EntityGroupListFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_group_list = entity_group_list + + @property + def group_type(self): + """Gets the group_type of this EntityGroupListFilter. # noqa: E501 + + + :return: The group_type of this EntityGroupListFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntityGroupListFilter. + + + :param group_type: The group_type of this EntityGroupListFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_name_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_name_filter.py new file mode 100644 index 0000000..07a16df --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_group_name_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityGroupNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_group_name_filter': 'str', + 'group_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_group_name_filter': 'entityGroupNameFilter', + 'group_type': 'groupType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_group_name_filter=None, group_type=None, *args, **kwargs): # noqa: E501 + """EntityGroupNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_group_name_filter = None + self._group_type = None + self.discriminator = None + if entity_group_name_filter is not None: + self.entity_group_name_filter = entity_group_name_filter + if group_type is not None: + self.group_type = group_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_group_name_filter(self): + """Gets the entity_group_name_filter of this EntityGroupNameFilter. # noqa: E501 + + + :return: The entity_group_name_filter of this EntityGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_group_name_filter + + @entity_group_name_filter.setter + def entity_group_name_filter(self, entity_group_name_filter): + """Sets the entity_group_name_filter of this EntityGroupNameFilter. + + + :param entity_group_name_filter: The entity_group_name_filter of this EntityGroupNameFilter. # noqa: E501 + :type: str + """ + + self._entity_group_name_filter = entity_group_name_filter + + @property + def group_type(self): + """Gets the group_type of this EntityGroupNameFilter. # noqa: E501 + + + :return: The group_type of this EntityGroupNameFilter. # noqa: E501 + :rtype: str + """ + return self._group_type + + @group_type.setter + def group_type(self, group_type): + """Sets the group_type of this EntityGroupNameFilter. + + + :param group_type: The group_type of this EntityGroupNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BILLING", "ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if group_type not in allowed_values: + raise ValueError( + "Invalid value for `group_type` ({0}), must be one of {1}" # noqa: E501 + .format(group_type, allowed_values) + ) + + self._group_type = group_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityGroupNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityGroupNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_id.py new file mode 100644 index 0000000..a9aaf9b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityId. # noqa: E501 + + + :return: The entity_type of this EntityId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityId. + + + :param entity_type: The entity_type of this EntityId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_key.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_key.py new file mode 100644 index 0000000..5eca8dc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_key.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityKey(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'type': 'str' + } + + attribute_map = { + 'key': 'key', + 'type': 'type' + } + + def __init__(self, key=None, type=None): # noqa: E501 + """EntityKey - a model defined in Swagger""" # noqa: E501 + self._key = None + self._type = None + self.discriminator = None + if key is not None: + self.key = key + if type is not None: + self.type = type + + @property + def key(self): + """Gets the key of this EntityKey. # noqa: E501 + + + :return: The key of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this EntityKey. + + + :param key: The key of this EntityKey. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def type(self): + """Gets the type of this EntityKey. # noqa: E501 + + + :return: The type of this EntityKey. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityKey. + + + :param type: The type of this EntityKey. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM_FIELD", "ATTRIBUTE", "CLIENT_ATTRIBUTE", "ENTITY_FIELD", "SERVER_ATTRIBUTE", "SHARED_ATTRIBUTE", "TIME_SERIES"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityKey, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityKey): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_list_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_list_filter.py new file mode 100644 index 0000000..73d120a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_list_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityListFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_list': 'list[str]', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_list': 'entityList', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_list=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityListFilter - a model defined in Swagger""" # noqa: E501 + self._entity_list = None + self._entity_type = None + self.discriminator = None + if entity_list is not None: + self.entity_list = entity_list + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_list(self): + """Gets the entity_list of this EntityListFilter. # noqa: E501 + + + :return: The entity_list of this EntityListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_list + + @entity_list.setter + def entity_list(self, entity_list): + """Sets the entity_list of this EntityListFilter. + + + :param entity_list: The entity_list of this EntityListFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_list = entity_list + + @property + def entity_type(self): + """Gets the entity_type of this EntityListFilter. # noqa: E501 + + + :return: The entity_type of this EntityListFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityListFilter. + + + :param entity_type: The entity_type of this EntityListFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_load_error.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_load_error.py new file mode 100644 index 0000000..06e8578 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_load_error.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityLoadError(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'message': 'str', + 'source': 'EntityId', + 'target': 'EntityId', + 'type': 'str' + } + + attribute_map = { + 'message': 'message', + 'source': 'source', + 'target': 'target', + 'type': 'type' + } + + def __init__(self, message=None, source=None, target=None, type=None): # noqa: E501 + """EntityLoadError - a model defined in Swagger""" # noqa: E501 + self._message = None + self._source = None + self._target = None + self._type = None + self.discriminator = None + if message is not None: + self.message = message + if source is not None: + self.source = source + if target is not None: + self.target = target + if type is not None: + self.type = type + + @property + def message(self): + """Gets the message of this EntityLoadError. # noqa: E501 + + + :return: The message of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this EntityLoadError. + + + :param message: The message of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def source(self): + """Gets the source of this EntityLoadError. # noqa: E501 + + + :return: The source of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._source + + @source.setter + def source(self, source): + """Sets the source of this EntityLoadError. + + + :param source: The source of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._source = source + + @property + def target(self): + """Gets the target of this EntityLoadError. # noqa: E501 + + + :return: The target of this EntityLoadError. # noqa: E501 + :rtype: EntityId + """ + return self._target + + @target.setter + def target(self, target): + """Sets the target of this EntityLoadError. + + + :param target: The target of this EntityLoadError. # noqa: E501 + :type: EntityId + """ + + self._target = target + + @property + def type(self): + """Gets the type of this EntityLoadError. # noqa: E501 + + + :return: The type of this EntityLoadError. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityLoadError. + + + :param type: The type of this EntityLoadError. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityLoadError, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityLoadError): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_name_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_name_filter.py new file mode 100644 index 0000000..174ce39 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_name_filter.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityNameFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_name_filter': 'str', + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_name_filter': 'entityNameFilter', + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_name_filter=None, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityNameFilter - a model defined in Swagger""" # noqa: E501 + self._entity_name_filter = None + self._entity_type = None + self.discriminator = None + if entity_name_filter is not None: + self.entity_name_filter = entity_name_filter + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_name_filter(self): + """Gets the entity_name_filter of this EntityNameFilter. # noqa: E501 + + + :return: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_name_filter + + @entity_name_filter.setter + def entity_name_filter(self, entity_name_filter): + """Sets the entity_name_filter of this EntityNameFilter. + + + :param entity_name_filter: The entity_name_filter of this EntityNameFilter. # noqa: E501 + :type: str + """ + + self._entity_name_filter = entity_name_filter + + @property + def entity_type(self): + """Gets the entity_type of this EntityNameFilter. # noqa: E501 + + + :return: The entity_type of this EntityNameFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityNameFilter. + + + :param entity_type: The entity_type of this EntityNameFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityNameFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityNameFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_relation_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_relation_info.py new file mode 100644 index 0000000..a5ef38a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_relation_info.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + '_from': 'EntityId', + 'to': 'EntityId', + 'type': 'str', + 'type_group': 'str', + 'additional_info': 'JsonNode', + 'from_name': 'str', + 'to_name': 'str' + } + + attribute_map = { + '_from': 'from', + 'to': 'to', + 'type': 'type', + 'type_group': 'typeGroup', + 'additional_info': 'additionalInfo', + 'from_name': 'fromName', + 'to_name': 'toName' + } + + def __init__(self, _from=None, to=None, type=None, type_group=None, additional_info=None, from_name=None, to_name=None): # noqa: E501 + """EntityRelationInfo - a model defined in Swagger""" # noqa: E501 + self.__from = None + self._to = None + self._type = None + self._type_group = None + self._additional_info = None + self._from_name = None + self._to_name = None + self.discriminator = None + if _from is not None: + self._from = _from + if to is not None: + self.to = to + if type is not None: + self.type = type + if type_group is not None: + self.type_group = type_group + if additional_info is not None: + self.additional_info = additional_info + if from_name is not None: + self.from_name = from_name + if to_name is not None: + self.to_name = to_name + + @property + def _from(self): + """Gets the _from of this EntityRelationInfo. # noqa: E501 + + + :return: The _from of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self.__from + + @_from.setter + def _from(self, _from): + """Sets the _from of this EntityRelationInfo. + + + :param _from: The _from of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self.__from = _from + + @property + def to(self): + """Gets the to of this EntityRelationInfo. # noqa: E501 + + + :return: The to of this EntityRelationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._to + + @to.setter + def to(self, to): + """Sets the to of this EntityRelationInfo. + + + :param to: The to of this EntityRelationInfo. # noqa: E501 + :type: EntityId + """ + + self._to = to + + @property + def type(self): + """Gets the type of this EntityRelationInfo. # noqa: E501 + + String value of relation type. # noqa: E501 + + :return: The type of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityRelationInfo. + + String value of relation type. # noqa: E501 + + :param type: The type of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def type_group(self): + """Gets the type_group of this EntityRelationInfo. # noqa: E501 + + Represents the type group of the relation. # noqa: E501 + + :return: The type_group of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._type_group + + @type_group.setter + def type_group(self, type_group): + """Sets the type_group of this EntityRelationInfo. + + Represents the type group of the relation. # noqa: E501 + + :param type_group: The type_group of this EntityRelationInfo. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "FROM_ENTITY_GROUP", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if type_group not in allowed_values: + raise ValueError( + "Invalid value for `type_group` ({0}), must be one of {1}" # noqa: E501 + .format(type_group, allowed_values) + ) + + self._type_group = type_group + + @property + def additional_info(self): + """Gets the additional_info of this EntityRelationInfo. # noqa: E501 + + + :return: The additional_info of this EntityRelationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityRelationInfo. + + + :param additional_info: The additional_info of this EntityRelationInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def from_name(self): + """Gets the from_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [from] direction. # noqa: E501 + + :return: The from_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._from_name + + @from_name.setter + def from_name(self, from_name): + """Sets the from_name of this EntityRelationInfo. + + Name of the entity for [from] direction. # noqa: E501 + + :param from_name: The from_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._from_name = from_name + + @property + def to_name(self): + """Gets the to_name of this EntityRelationInfo. # noqa: E501 + + Name of the entity for [to] direction. # noqa: E501 + + :return: The to_name of this EntityRelationInfo. # noqa: E501 + :rtype: str + """ + return self._to_name + + @to_name.setter + def to_name(self, to_name): + """Sets the to_name of this EntityRelationInfo. + + Name of the entity for [to] direction. # noqa: E501 + + :param to_name: The to_name of this EntityRelationInfo. # noqa: E501 + :type: str + """ + + self._to_name = to_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_relations_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_relations_query.py new file mode 100644 index 0000000..1a436c3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_relations_query.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityRelationsQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'filters': 'list[RelationEntityTypeFilter]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'filters': 'filters', + 'parameters': 'parameters' + } + + def __init__(self, filters=None, parameters=None): # noqa: E501 + """EntityRelationsQuery - a model defined in Swagger""" # noqa: E501 + self._filters = None + self._parameters = None + self.discriminator = None + if filters is not None: + self.filters = filters + if parameters is not None: + self.parameters = parameters + + @property + def filters(self): + """Gets the filters of this EntityRelationsQuery. # noqa: E501 + + Main filters. # noqa: E501 + + :return: The filters of this EntityRelationsQuery. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this EntityRelationsQuery. + + Main filters. # noqa: E501 + + :param filters: The filters of this EntityRelationsQuery. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def parameters(self): + """Gets the parameters of this EntityRelationsQuery. # noqa: E501 + + + :return: The parameters of this EntityRelationsQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityRelationsQuery. + + + :param parameters: The parameters of this EntityRelationsQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityRelationsQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityRelationsQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_subtype.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_subtype.py new file mode 100644 index 0000000..d42bf94 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_subtype.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntitySubtype(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str', + 'tenant_id': 'TenantId', + 'type': 'str' + } + + attribute_map = { + 'entity_type': 'entityType', + 'tenant_id': 'tenantId', + 'type': 'type' + } + + def __init__(self, entity_type=None, tenant_id=None, type=None): # noqa: E501 + """EntitySubtype - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self._tenant_id = None + self._type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + + @property + def entity_type(self): + """Gets the entity_type of this EntitySubtype. # noqa: E501 + + + :return: The entity_type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntitySubtype. + + + :param entity_type: The entity_type of this EntitySubtype. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def tenant_id(self): + """Gets the tenant_id of this EntitySubtype. # noqa: E501 + + + :return: The tenant_id of this EntitySubtype. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntitySubtype. + + + :param tenant_id: The tenant_id of this EntitySubtype. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EntitySubtype. # noqa: E501 + + + :return: The type of this EntitySubtype. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntitySubtype. + + + :param type: The type of this EntitySubtype. # noqa: E501 + :type: str + """ + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntitySubtype, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntitySubtype): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_filter.py new file mode 100644 index 0000000..2806526 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_filter.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_type': 'entityType' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_type=None, *args, **kwargs): # noqa: E501 + """EntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeFilter. # noqa: E501 + + + :return: The entity_type of this EntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeFilter. + + + :param entity_type: The entity_type of this EntityTypeFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_load_result.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_load_result.py new file mode 100644 index 0000000..d6dbac0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_load_result.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created': 'int', + 'deleted': 'int', + 'entity_type': 'str', + 'groups_created': 'int', + 'groups_deleted': 'int', + 'groups_updated': 'int', + 'updated': 'int' + } + + attribute_map = { + 'created': 'created', + 'deleted': 'deleted', + 'entity_type': 'entityType', + 'groups_created': 'groupsCreated', + 'groups_deleted': 'groupsDeleted', + 'groups_updated': 'groupsUpdated', + 'updated': 'updated' + } + + def __init__(self, created=None, deleted=None, entity_type=None, groups_created=None, groups_deleted=None, groups_updated=None, updated=None): # noqa: E501 + """EntityTypeLoadResult - a model defined in Swagger""" # noqa: E501 + self._created = None + self._deleted = None + self._entity_type = None + self._groups_created = None + self._groups_deleted = None + self._groups_updated = None + self._updated = None + self.discriminator = None + if created is not None: + self.created = created + if deleted is not None: + self.deleted = deleted + if entity_type is not None: + self.entity_type = entity_type + if groups_created is not None: + self.groups_created = groups_created + if groups_deleted is not None: + self.groups_deleted = groups_deleted + if groups_updated is not None: + self.groups_updated = groups_updated + if updated is not None: + self.updated = updated + + @property + def created(self): + """Gets the created of this EntityTypeLoadResult. # noqa: E501 + + + :return: The created of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._created + + @created.setter + def created(self, created): + """Sets the created of this EntityTypeLoadResult. + + + :param created: The created of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._created = created + + @property + def deleted(self): + """Gets the deleted of this EntityTypeLoadResult. # noqa: E501 + + + :return: The deleted of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._deleted + + @deleted.setter + def deleted(self, deleted): + """Sets the deleted of this EntityTypeLoadResult. + + + :param deleted: The deleted of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._deleted = deleted + + @property + def entity_type(self): + """Gets the entity_type of this EntityTypeLoadResult. # noqa: E501 + + + :return: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityTypeLoadResult. + + + :param entity_type: The entity_type of this EntityTypeLoadResult. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def groups_created(self): + """Gets the groups_created of this EntityTypeLoadResult. # noqa: E501 + + + :return: The groups_created of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._groups_created + + @groups_created.setter + def groups_created(self, groups_created): + """Sets the groups_created of this EntityTypeLoadResult. + + + :param groups_created: The groups_created of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._groups_created = groups_created + + @property + def groups_deleted(self): + """Gets the groups_deleted of this EntityTypeLoadResult. # noqa: E501 + + + :return: The groups_deleted of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._groups_deleted + + @groups_deleted.setter + def groups_deleted(self, groups_deleted): + """Sets the groups_deleted of this EntityTypeLoadResult. + + + :param groups_deleted: The groups_deleted of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._groups_deleted = groups_deleted + + @property + def groups_updated(self): + """Gets the groups_updated of this EntityTypeLoadResult. # noqa: E501 + + + :return: The groups_updated of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._groups_updated + + @groups_updated.setter + def groups_updated(self, groups_updated): + """Sets the groups_updated of this EntityTypeLoadResult. + + + :param groups_updated: The groups_updated of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._groups_updated = groups_updated + + @property + def updated(self): + """Gets the updated of this EntityTypeLoadResult. # noqa: E501 + + + :return: The updated of this EntityTypeLoadResult. # noqa: E501 + :rtype: int + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this EntityTypeLoadResult. + + + :param updated: The updated of this EntityTypeLoadResult. # noqa: E501 + :type: int + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_create_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_create_config.py new file mode 100644 index 0000000..b738664 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_create_config.py @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'all_entities': 'bool', + 'entity_ids': 'list[str]', + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_group_entities': 'bool', + 'save_permissions': 'bool', + 'save_relations': 'bool', + 'sync_strategy': 'str' + } + + attribute_map = { + 'all_entities': 'allEntities', + 'entity_ids': 'entityIds', + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_group_entities': 'saveGroupEntities', + 'save_permissions': 'savePermissions', + 'save_relations': 'saveRelations', + 'sync_strategy': 'syncStrategy' + } + + def __init__(self, all_entities=None, entity_ids=None, save_attributes=None, save_credentials=None, save_group_entities=None, save_permissions=None, save_relations=None, sync_strategy=None): # noqa: E501 + """EntityTypeVersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._all_entities = None + self._entity_ids = None + self._save_attributes = None + self._save_credentials = None + self._save_group_entities = None + self._save_permissions = None + self._save_relations = None + self._sync_strategy = None + self.discriminator = None + if all_entities is not None: + self.all_entities = all_entities + if entity_ids is not None: + self.entity_ids = entity_ids + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_group_entities is not None: + self.save_group_entities = save_group_entities + if save_permissions is not None: + self.save_permissions = save_permissions + if save_relations is not None: + self.save_relations = save_relations + if sync_strategy is not None: + self.sync_strategy = sync_strategy + + @property + def all_entities(self): + """Gets the all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._all_entities + + @all_entities.setter + def all_entities(self, all_entities): + """Sets the all_entities of this EntityTypeVersionCreateConfig. + + + :param all_entities: The all_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._all_entities = all_entities + + @property + def entity_ids(self): + """Gets the entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: list[str] + """ + return self._entity_ids + + @entity_ids.setter + def entity_ids(self, entity_ids): + """Sets the entity_ids of this EntityTypeVersionCreateConfig. + + + :param entity_ids: The entity_ids of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: list[str] + """ + + self._entity_ids = entity_ids + + @property + def save_attributes(self): + """Gets the save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this EntityTypeVersionCreateConfig. + + + :param save_attributes: The save_attributes of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this EntityTypeVersionCreateConfig. + + + :param save_credentials: The save_credentials of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_group_entities(self): + """Gets the save_group_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_group_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_group_entities + + @save_group_entities.setter + def save_group_entities(self, save_group_entities): + """Sets the save_group_entities of this EntityTypeVersionCreateConfig. + + + :param save_group_entities: The save_group_entities of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_group_entities = save_group_entities + + @property + def save_permissions(self): + """Gets the save_permissions of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_permissions of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_permissions + + @save_permissions.setter + def save_permissions(self, save_permissions): + """Sets the save_permissions of this EntityTypeVersionCreateConfig. + + + :param save_permissions: The save_permissions of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_permissions = save_permissions + + @property + def save_relations(self): + """Gets the save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this EntityTypeVersionCreateConfig. + + + :param save_relations: The save_relations of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + @property + def sync_strategy(self): + """Gets the sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + + + :return: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :rtype: str + """ + return self._sync_strategy + + @sync_strategy.setter + def sync_strategy(self, sync_strategy): + """Sets the sync_strategy of this EntityTypeVersionCreateConfig. + + + :param sync_strategy: The sync_strategy of this EntityTypeVersionCreateConfig. # noqa: E501 + :type: str + """ + allowed_values = ["MERGE", "OVERWRITE"] # noqa: E501 + if sync_strategy not in allowed_values: + raise ValueError( + "Invalid value for `sync_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(sync_strategy, allowed_values) + ) + + self._sync_strategy = sync_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_load_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_load_config.py new file mode 100644 index 0000000..8f1975c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_load_config.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityTypeVersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auto_generate_integration_key': 'bool', + 'find_existing_entity_by_name': 'bool', + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_group_entities': 'bool', + 'load_permissions': 'bool', + 'load_relations': 'bool', + 'remove_other_entities': 'bool' + } + + attribute_map = { + 'auto_generate_integration_key': 'autoGenerateIntegrationKey', + 'find_existing_entity_by_name': 'findExistingEntityByName', + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_group_entities': 'loadGroupEntities', + 'load_permissions': 'loadPermissions', + 'load_relations': 'loadRelations', + 'remove_other_entities': 'removeOtherEntities' + } + + def __init__(self, auto_generate_integration_key=None, find_existing_entity_by_name=None, load_attributes=None, load_credentials=None, load_group_entities=None, load_permissions=None, load_relations=None, remove_other_entities=None): # noqa: E501 + """EntityTypeVersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._auto_generate_integration_key = None + self._find_existing_entity_by_name = None + self._load_attributes = None + self._load_credentials = None + self._load_group_entities = None + self._load_permissions = None + self._load_relations = None + self._remove_other_entities = None + self.discriminator = None + if auto_generate_integration_key is not None: + self.auto_generate_integration_key = auto_generate_integration_key + if find_existing_entity_by_name is not None: + self.find_existing_entity_by_name = find_existing_entity_by_name + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_group_entities is not None: + self.load_group_entities = load_group_entities + if load_permissions is not None: + self.load_permissions = load_permissions + if load_relations is not None: + self.load_relations = load_relations + if remove_other_entities is not None: + self.remove_other_entities = remove_other_entities + + @property + def auto_generate_integration_key(self): + """Gets the auto_generate_integration_key of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The auto_generate_integration_key of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._auto_generate_integration_key + + @auto_generate_integration_key.setter + def auto_generate_integration_key(self, auto_generate_integration_key): + """Sets the auto_generate_integration_key of this EntityTypeVersionLoadConfig. + + + :param auto_generate_integration_key: The auto_generate_integration_key of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._auto_generate_integration_key = auto_generate_integration_key + + @property + def find_existing_entity_by_name(self): + """Gets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._find_existing_entity_by_name + + @find_existing_entity_by_name.setter + def find_existing_entity_by_name(self, find_existing_entity_by_name): + """Sets the find_existing_entity_by_name of this EntityTypeVersionLoadConfig. + + + :param find_existing_entity_by_name: The find_existing_entity_by_name of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._find_existing_entity_by_name = find_existing_entity_by_name + + @property + def load_attributes(self): + """Gets the load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this EntityTypeVersionLoadConfig. + + + :param load_attributes: The load_attributes of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this EntityTypeVersionLoadConfig. + + + :param load_credentials: The load_credentials of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_group_entities(self): + """Gets the load_group_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_group_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_group_entities + + @load_group_entities.setter + def load_group_entities(self, load_group_entities): + """Sets the load_group_entities of this EntityTypeVersionLoadConfig. + + + :param load_group_entities: The load_group_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_group_entities = load_group_entities + + @property + def load_permissions(self): + """Gets the load_permissions of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_permissions of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_permissions + + @load_permissions.setter + def load_permissions(self, load_permissions): + """Sets the load_permissions of this EntityTypeVersionLoadConfig. + + + :param load_permissions: The load_permissions of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_permissions = load_permissions + + @property + def load_relations(self): + """Gets the load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this EntityTypeVersionLoadConfig. + + + :param load_relations: The load_relations of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + @property + def remove_other_entities(self): + """Gets the remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + + + :return: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._remove_other_entities + + @remove_other_entities.setter + def remove_other_entities(self, remove_other_entities): + """Sets the remove_other_entities of this EntityTypeVersionLoadConfig. + + + :param remove_other_entities: The remove_other_entities of this EntityTypeVersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._remove_other_entities = remove_other_entities + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_load_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_load_request.py new file mode 100644 index 0000000..7ef10e3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_type_version_load_request.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class EntityTypeVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_types': 'dict(str, EntityTypeVersionLoadConfig)', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'entity_types': 'entityTypes', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, entity_types=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """EntityTypeVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._entity_types = None + self._type = None + self._version_id = None + self.discriminator = None + if entity_types is not None: + self.entity_types = entity_types + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def entity_types(self): + """Gets the entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: dict(str, EntityTypeVersionLoadConfig) + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this EntityTypeVersionLoadRequest. + + + :param entity_types: The entity_types of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: dict(str, EntityTypeVersionLoadConfig) + """ + + self._entity_types = entity_types + + @property + def type(self): + """Gets the type of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityTypeVersionLoadRequest. + + + :param type: The type of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this EntityTypeVersionLoadRequest. + + + :param version_id: The version_id of this EntityTypeVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityTypeVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityTypeVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_version.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_version.py new file mode 100644 index 0000000..f4749ce --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_version.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'author': 'str', + 'id': 'str', + 'name': 'str', + 'timestamp': 'int' + } + + attribute_map = { + 'author': 'author', + 'id': 'id', + 'name': 'name', + 'timestamp': 'timestamp' + } + + def __init__(self, author=None, id=None, name=None, timestamp=None): # noqa: E501 + """EntityVersion - a model defined in Swagger""" # noqa: E501 + self._author = None + self._id = None + self._name = None + self._timestamp = None + self.discriminator = None + if author is not None: + self.author = author + if id is not None: + self.id = id + if name is not None: + self.name = name + if timestamp is not None: + self.timestamp = timestamp + + @property + def author(self): + """Gets the author of this EntityVersion. # noqa: E501 + + + :return: The author of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._author + + @author.setter + def author(self, author): + """Sets the author of this EntityVersion. + + + :param author: The author of this EntityVersion. # noqa: E501 + :type: str + """ + + self._author = author + + @property + def id(self): + """Gets the id of this EntityVersion. # noqa: E501 + + + :return: The id of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityVersion. + + + :param id: The id of this EntityVersion. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this EntityVersion. # noqa: E501 + + + :return: The name of this EntityVersion. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityVersion. + + + :param name: The name of this EntityVersion. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def timestamp(self): + """Gets the timestamp of this EntityVersion. # noqa: E501 + + + :return: The timestamp of this EntityVersion. # noqa: E501 + :rtype: int + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this EntityVersion. + + + :param timestamp: The timestamp of this EntityVersion. # noqa: E501 + :type: int + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view.py new file mode 100644 index 0000000..dfdeeed --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view.py @@ -0,0 +1,436 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None, owner_id=None): # noqa: E501 + """EntityView - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self._owner_id = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this EntityView. # noqa: E501 + + + :return: The id of this EntityView. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityView. + + + :param id: The id of this EntityView. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this EntityView. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityView. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityView. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityView. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityView. # noqa: E501 + + + :return: The tenant_id of this EntityView. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityView. + + + :param tenant_id: The tenant_id of this EntityView. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityView. # noqa: E501 + + + :return: The customer_id of this EntityView. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityView. + + + :param customer_id: The customer_id of this EntityView. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityView. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityView. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityView. + + Entity View name # noqa: E501 + + :param name: The name of this EntityView. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityView. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityView. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityView. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityView. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityView. # noqa: E501 + + + :return: The entity_id of this EntityView. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityView. + + + :param entity_id: The entity_id of this EntityView. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityView. # noqa: E501 + + + :return: The keys of this EntityView. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityView. + + + :param keys: The keys of this EntityView. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityView. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityView. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityView. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityView. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityView. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityView. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityView. # noqa: E501 + + + :return: The additional_info of this EntityView. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityView. + + + :param additional_info: The additional_info of this EntityView. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this EntityView. # noqa: E501 + + + :return: The owner_id of this EntityView. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityView. + + + :param owner_id: The owner_id of this EntityView. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_id.py new file mode 100644 index 0000000..629f50f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """EntityViewId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this EntityViewId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this EntityViewId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this EntityViewId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this EntityViewId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this EntityViewId. + + string # noqa: E501 + + :param entity_type: The entity_type of this EntityViewId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ENTITY_VIEW"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_info.py new file mode 100644 index 0000000..9c0a738 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_info.py @@ -0,0 +1,480 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityViewId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'name': 'str', + 'type': 'str', + 'entity_id': 'EntityId', + 'keys': 'TelemetryEntityView', + 'start_time_ms': 'int', + 'end_time_ms': 'int', + 'additional_info': 'JsonNode', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]', + 'owner_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'name': 'name', + 'type': 'type', + 'entity_id': 'entityId', + 'keys': 'keys', + 'start_time_ms': 'startTimeMs', + 'end_time_ms': 'endTimeMs', + 'additional_info': 'additionalInfo', + 'owner_name': 'ownerName', + 'groups': 'groups', + 'owner_id': 'ownerId' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, name=None, type=None, entity_id=None, keys=None, start_time_ms=None, end_time_ms=None, additional_info=None, owner_name=None, groups=None, owner_id=None): # noqa: E501 + """EntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._name = None + self._type = None + self._entity_id = None + self._keys = None + self._start_time_ms = None + self._end_time_ms = None + self._additional_info = None + self._owner_name = None + self._groups = None + self._owner_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.name = name + self.type = type + self.entity_id = entity_id + self.keys = keys + if start_time_ms is not None: + self.start_time_ms = start_time_ms + if end_time_ms is not None: + self.end_time_ms = end_time_ms + if additional_info is not None: + self.additional_info = additional_info + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this EntityViewInfo. # noqa: E501 + + + :return: The id of this EntityViewInfo. # noqa: E501 + :rtype: EntityViewId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EntityViewInfo. + + + :param id: The id of this EntityViewInfo. # noqa: E501 + :type: EntityViewId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this EntityViewInfo. # noqa: E501 + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :return: The created_time of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EntityViewInfo. + + Timestamp of the Entity View creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this EntityViewInfo. # noqa: E501 + + + :return: The tenant_id of this EntityViewInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EntityViewInfo. + + + :param tenant_id: The tenant_id of this EntityViewInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this EntityViewInfo. # noqa: E501 + + + :return: The customer_id of this EntityViewInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this EntityViewInfo. + + + :param customer_id: The customer_id of this EntityViewInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def name(self): + """Gets the name of this EntityViewInfo. # noqa: E501 + + Entity View name # noqa: E501 + + :return: The name of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this EntityViewInfo. + + Entity View name # noqa: E501 + + :param name: The name of this EntityViewInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this EntityViewInfo. # noqa: E501 + + Device Profile Name # noqa: E501 + + :return: The type of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EntityViewInfo. + + Device Profile Name # noqa: E501 + + :param type: The type of this EntityViewInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def entity_id(self): + """Gets the entity_id of this EntityViewInfo. # noqa: E501 + + + :return: The entity_id of this EntityViewInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EntityViewInfo. + + + :param entity_id: The entity_id of this EntityViewInfo. # noqa: E501 + :type: EntityId + """ + if entity_id is None: + raise ValueError("Invalid value for `entity_id`, must not be `None`") # noqa: E501 + + self._entity_id = entity_id + + @property + def keys(self): + """Gets the keys of this EntityViewInfo. # noqa: E501 + + + :return: The keys of this EntityViewInfo. # noqa: E501 + :rtype: TelemetryEntityView + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this EntityViewInfo. + + + :param keys: The keys of this EntityViewInfo. # noqa: E501 + :type: TelemetryEntityView + """ + if keys is None: + raise ValueError("Invalid value for `keys`, must not be `None`") # noqa: E501 + + self._keys = keys + + @property + def start_time_ms(self): + """Gets the start_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The start_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._start_time_ms + + @start_time_ms.setter + def start_time_ms(self, start_time_ms): + """Sets the start_time_ms of this EntityViewInfo. + + Represents the start time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param start_time_ms: The start_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._start_time_ms = start_time_ms + + @property + def end_time_ms(self): + """Gets the end_time_ms of this EntityViewInfo. # noqa: E501 + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :return: The end_time_ms of this EntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._end_time_ms + + @end_time_ms.setter + def end_time_ms(self, end_time_ms): + """Sets the end_time_ms of this EntityViewInfo. + + Represents the end time of the interval that is used to limit access to target device telemetry. Customer will not be able to see entity telemetry that is outside the specified interval; # noqa: E501 + + :param end_time_ms: The end_time_ms of this EntityViewInfo. # noqa: E501 + :type: int + """ + + self._end_time_ms = end_time_ms + + @property + def additional_info(self): + """Gets the additional_info of this EntityViewInfo. # noqa: E501 + + + :return: The additional_info of this EntityViewInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this EntityViewInfo. + + + :param additional_info: The additional_info of this EntityViewInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_name(self): + """Gets the owner_name of this EntityViewInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this EntityViewInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this EntityViewInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this EntityViewInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this EntityViewInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this EntityViewInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this EntityViewInfo. + + Groups # noqa: E501 + + :param groups: The groups of this EntityViewInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + @property + def owner_id(self): + """Gets the owner_id of this EntityViewInfo. # noqa: E501 + + + :return: The owner_id of this EntityViewInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this EntityViewInfo. + + + :param owner_id: The owner_id of this EntityViewInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_search_query.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_search_query.py new file mode 100644 index 0000000..821983c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_search_query.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EntityViewSearchQuery(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_view_types': 'list[str]', + 'parameters': 'RelationsSearchParameters' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_view_types': 'entityViewTypes', + 'parameters': 'parameters' + } + + def __init__(self, relation_type=None, entity_view_types=None, parameters=None): # noqa: E501 + """EntityViewSearchQuery - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_view_types = None + self._parameters = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if parameters is not None: + self.parameters = parameters + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQuery. # noqa: E501 + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQuery. + + Type of the relation between root entity and device (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this EntityViewSearchQuery. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQuery. # noqa: E501 + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :return: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQuery. + + Array of entity view types to filter the related entities (e.g. 'Temperature Sensor', 'Smoke Sensor'). # noqa: E501 + + :param entity_view_types: The entity_view_types of this EntityViewSearchQuery. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def parameters(self): + """Gets the parameters of this EntityViewSearchQuery. # noqa: E501 + + + :return: The parameters of this EntityViewSearchQuery. # noqa: E501 + :rtype: RelationsSearchParameters + """ + return self._parameters + + @parameters.setter + def parameters(self, parameters): + """Sets the parameters of this EntityViewSearchQuery. + + + :param parameters: The parameters of this EntityViewSearchQuery. # noqa: E501 + :type: RelationsSearchParameters + """ + + self._parameters = parameters + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQuery, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQuery): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_search_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_search_query_filter.py new file mode 100644 index 0000000..eb1243a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_search_query_filter.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewSearchQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'entity_view_types': 'list[str]', + 'fetch_last_level_only': 'bool', + 'max_level': 'int', + 'relation_type': 'str', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'entity_view_types': 'entityViewTypes', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'max_level': 'maxLevel', + 'relation_type': 'relationType', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, entity_view_types=None, fetch_last_level_only=None, max_level=None, relation_type=None, root_entity=None, *args, **kwargs): # noqa: E501 + """EntityViewSearchQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._entity_view_types = None + self._fetch_last_level_only = None + self._max_level = None + self._relation_type = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if entity_view_types is not None: + self.entity_view_types = entity_view_types + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if max_level is not None: + self.max_level = max_level + if relation_type is not None: + self.relation_type = relation_type + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this EntityViewSearchQueryFilter. + + + :param direction: The direction of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewSearchQueryFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewSearchQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this EntityViewSearchQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this EntityViewSearchQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def max_level(self): + """Gets the max_level of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this EntityViewSearchQueryFilter. + + + :param max_level: The max_level of this EntityViewSearchQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def relation_type(self): + """Gets the relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this EntityViewSearchQueryFilter. + + + :param relation_type: The relation_type of this EntityViewSearchQueryFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def root_entity(self): + """Gets the root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + + + :return: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this EntityViewSearchQueryFilter. + + + :param root_entity: The root_entity of this EntityViewSearchQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewSearchQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewSearchQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_type_filter.py new file mode 100644 index 0000000..0dcccba --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/entity_view_type_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class EntityViewTypeFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_view_name_filter': 'str', + 'entity_view_types': 'list[str]' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'entity_view_name_filter': 'entityViewNameFilter', + 'entity_view_types': 'entityViewTypes' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, entity_view_name_filter=None, entity_view_types=None, *args, **kwargs): # noqa: E501 + """EntityViewTypeFilter - a model defined in Swagger""" # noqa: E501 + self._entity_view_name_filter = None + self._entity_view_types = None + self.discriminator = None + if entity_view_name_filter is not None: + self.entity_view_name_filter = entity_view_name_filter + if entity_view_types is not None: + self.entity_view_types = entity_view_types + EntityFilter.__init__(self, *args, **kwargs) + + @property + def entity_view_name_filter(self): + """Gets the entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :rtype: str + """ + return self._entity_view_name_filter + + @entity_view_name_filter.setter + def entity_view_name_filter(self, entity_view_name_filter): + """Sets the entity_view_name_filter of this EntityViewTypeFilter. + + + :param entity_view_name_filter: The entity_view_name_filter of this EntityViewTypeFilter. # noqa: E501 + :type: str + """ + + self._entity_view_name_filter = entity_view_name_filter + + @property + def entity_view_types(self): + """Gets the entity_view_types of this EntityViewTypeFilter. # noqa: E501 + + + :return: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_view_types + + @entity_view_types.setter + def entity_view_types(self, entity_view_types): + """Sets the entity_view_types of this EntityViewTypeFilter. + + + :param entity_view_types: The entity_view_types of this EntityViewTypeFilter. # noqa: E501 + :type: list[str] + """ + + self._entity_view_types = entity_view_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EntityViewTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EntityViewTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/error_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/error_event_filter.py new file mode 100644 index 0000000..04eb11e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/error_event_filter.py @@ -0,0 +1,249 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class ErrorEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'method': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'method': 'method', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, method=None, error_str=None, *args, **kwargs): # noqa: E501 + """ErrorEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._method = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if method is not None: + self.method = method + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this ErrorEventFilter. # noqa: E501 + + + :return: The not_empty of this ErrorEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this ErrorEventFilter. + + + :param not_empty: The not_empty of this ErrorEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this ErrorEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this ErrorEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this ErrorEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this ErrorEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this ErrorEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def method(self): + """Gets the method of this ErrorEventFilter. # noqa: E501 + + String value representing the method name when the error happened # noqa: E501 + + :return: The method of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._method + + @method.setter + def method(self, method): + """Sets the method of this ErrorEventFilter. + + String value representing the method name when the error happened # noqa: E501 + + :param method: The method of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._method = method + + @property + def error_str(self): + """Gets the error_str of this ErrorEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this ErrorEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this ErrorEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this ErrorEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ErrorEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ErrorEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/escalated_notification_rule_recipients_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/escalated_notification_rule_recipients_config.py new file mode 100644 index 0000000..e3987a5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/escalated_notification_rule_recipients_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EscalatedNotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'escalation_table': 'dict(str, list[str])', + 'trigger_type': 'str' + } + + attribute_map = { + 'escalation_table': 'escalationTable', + 'trigger_type': 'triggerType' + } + + def __init__(self, escalation_table=None, trigger_type=None): # noqa: E501 + """EscalatedNotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._escalation_table = None + self._trigger_type = None + self.discriminator = None + if escalation_table is not None: + self.escalation_table = escalation_table + self.trigger_type = trigger_type + + @property + def escalation_table(self): + """Gets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._escalation_table + + @escalation_table.setter + def escalation_table(self, escalation_table): + """Sets the escalation_table of this EscalatedNotificationRuleRecipientsConfig. + + + :param escalation_table: The escalation_table of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._escalation_table = escalation_table + + @property + def trigger_type(self): + """Gets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this EscalatedNotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this EscalatedNotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EscalatedNotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EscalatedNotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/event.py b/tb-rest-client/python/tb_rest_client/models/models_pe/event.py new file mode 100644 index 0000000..2925e8a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/event.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Event(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """Event - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this Event. # noqa: E501 + + + :return: The id of this Event. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Event. + + + :param id: The id of this Event. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this Event. # noqa: E501 + + + :return: The tenant_id of this Event. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Event. + + + :param tenant_id: The tenant_id of this Event. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this Event. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this Event. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Event. + + Event type # noqa: E501 + + :param type: The type of this Event. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this Event. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this Event. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this Event. + + string # noqa: E501 + + :param uid: The uid of this Event. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this Event. # noqa: E501 + + + :return: The entity_id of this Event. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this Event. + + + :param entity_id: The entity_id of this Event. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this Event. # noqa: E501 + + + :return: The body of this Event. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this Event. + + + :param body: The body of this Event. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this Event. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this Event. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Event. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Event. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Event, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Event): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/event_filter.py new file mode 100644 index 0000000..338afe9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/event_filter.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str' + } + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType' + } + + def __init__(self, not_empty=None, event_type=None): # noqa: E501 + """EventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + + @property + def not_empty(self): + """Gets the not_empty of this EventFilter. # noqa: E501 + + + :return: The not_empty of this EventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this EventFilter. + + + :param not_empty: The not_empty of this EventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this EventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this EventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this EventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this EventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/event_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/event_id.py new file mode 100644 index 0000000..63a436e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/event_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """EventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this EventId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this EventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventId. + + string # noqa: E501 + + :param id: The id of this EventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/event_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/event_info.py new file mode 100644 index 0000000..2236301 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/event_info.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class EventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EventId', + 'tenant_id': 'TenantId', + 'type': 'str', + 'uid': 'str', + 'entity_id': 'EntityId', + 'body': 'JsonNode', + 'created_time': 'int' + } + + attribute_map = { + 'id': 'id', + 'tenant_id': 'tenantId', + 'type': 'type', + 'uid': 'uid', + 'entity_id': 'entityId', + 'body': 'body', + 'created_time': 'createdTime' + } + + def __init__(self, id=None, tenant_id=None, type=None, uid=None, entity_id=None, body=None, created_time=None): # noqa: E501 + """EventInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._tenant_id = None + self._type = None + self._uid = None + self._entity_id = None + self._body = None + self._created_time = None + self.discriminator = None + if id is not None: + self.id = id + if tenant_id is not None: + self.tenant_id = tenant_id + if type is not None: + self.type = type + if uid is not None: + self.uid = uid + if entity_id is not None: + self.entity_id = entity_id + if body is not None: + self.body = body + if created_time is not None: + self.created_time = created_time + + @property + def id(self): + """Gets the id of this EventInfo. # noqa: E501 + + + :return: The id of this EventInfo. # noqa: E501 + :rtype: EventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this EventInfo. + + + :param id: The id of this EventInfo. # noqa: E501 + :type: EventId + """ + + self._id = id + + @property + def tenant_id(self): + """Gets the tenant_id of this EventInfo. # noqa: E501 + + + :return: The tenant_id of this EventInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this EventInfo. + + + :param tenant_id: The tenant_id of this EventInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this EventInfo. # noqa: E501 + + Event type # noqa: E501 + + :return: The type of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this EventInfo. + + Event type # noqa: E501 + + :param type: The type of this EventInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def uid(self): + """Gets the uid of this EventInfo. # noqa: E501 + + string # noqa: E501 + + :return: The uid of this EventInfo. # noqa: E501 + :rtype: str + """ + return self._uid + + @uid.setter + def uid(self, uid): + """Sets the uid of this EventInfo. + + string # noqa: E501 + + :param uid: The uid of this EventInfo. # noqa: E501 + :type: str + """ + + self._uid = uid + + @property + def entity_id(self): + """Gets the entity_id of this EventInfo. # noqa: E501 + + + :return: The entity_id of this EventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this EventInfo. + + + :param entity_id: The entity_id of this EventInfo. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def body(self): + """Gets the body of this EventInfo. # noqa: E501 + + + :return: The body of this EventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this EventInfo. + + + :param body: The body of this EventInfo. # noqa: E501 + :type: JsonNode + """ + + self._body = body + + @property + def created_time(self): + """Gets the created_time of this EventInfo. # noqa: E501 + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :return: The created_time of this EventInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this EventInfo. + + Timestamp of the event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this EventInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(EventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, EventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/exportable_entity_entity_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/exportable_entity_entity_id.py new file mode 100644 index 0000000..085aff6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/exportable_entity_entity_id.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ExportableEntityEntityId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'created_time': 'int', + 'id': 'EntityId', + 'name': 'str' + } + + attribute_map = { + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name' + } + + def __init__(self, created_time=None, id=None, name=None): # noqa: E501 + """ExportableEntityEntityId - a model defined in Swagger""" # noqa: E501 + self._created_time = None + self._id = None + self._name = None + self.discriminator = None + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + + @property + def created_time(self): + """Gets the created_time of this ExportableEntityEntityId. # noqa: E501 + + + :return: The created_time of this ExportableEntityEntityId. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this ExportableEntityEntityId. + + + :param created_time: The created_time of this ExportableEntityEntityId. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this ExportableEntityEntityId. # noqa: E501 + + + :return: The id of this ExportableEntityEntityId. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ExportableEntityEntityId. + + + :param id: The id of this ExportableEntityEntityId. # noqa: E501 + :type: EntityId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this ExportableEntityEntityId. # noqa: E501 + + + :return: The name of this ExportableEntityEntityId. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ExportableEntityEntityId. + + + :param name: The name of this ExportableEntityEntityId. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ExportableEntityEntityId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ExportableEntityEntityId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/favicon.py b/tb-rest-client/python/tb_rest_client/models/models_pe/favicon.py new file mode 100644 index 0000000..a28169d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/favicon.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Favicon(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'url': 'str' + } + + attribute_map = { + 'type': 'type', + 'url': 'url' + } + + def __init__(self, type=None, url=None): # noqa: E501 + """Favicon - a model defined in Swagger""" # noqa: E501 + self._type = None + self._url = None + self.discriminator = None + if type is not None: + self.type = type + if url is not None: + self.url = url + + @property + def type(self): + """Gets the type of this Favicon. # noqa: E501 + + + :return: The type of this Favicon. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Favicon. + + + :param type: The type of this Favicon. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def url(self): + """Gets the url of this Favicon. # noqa: E501 + + + :return: The url of this Favicon. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this Favicon. + + + :param url: The url of this Favicon. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Favicon, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Favicon): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/features_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/features_info.py new file mode 100644 index 0000000..9e86600 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/features_info.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FeaturesInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email_enabled': 'bool', + 'notification_enabled': 'bool', + 'oauth_enabled': 'bool', + 'sms_enabled': 'bool', + 'two_fa_enabled': 'bool', + 'white_labeling_enabled': 'bool' + } + + attribute_map = { + 'email_enabled': 'emailEnabled', + 'notification_enabled': 'notificationEnabled', + 'oauth_enabled': 'oauthEnabled', + 'sms_enabled': 'smsEnabled', + 'two_fa_enabled': 'twoFaEnabled', + 'white_labeling_enabled': 'whiteLabelingEnabled' + } + + def __init__(self, email_enabled=None, notification_enabled=None, oauth_enabled=None, sms_enabled=None, two_fa_enabled=None, white_labeling_enabled=None): # noqa: E501 + """FeaturesInfo - a model defined in Swagger""" # noqa: E501 + self._email_enabled = None + self._notification_enabled = None + self._oauth_enabled = None + self._sms_enabled = None + self._two_fa_enabled = None + self._white_labeling_enabled = None + self.discriminator = None + if email_enabled is not None: + self.email_enabled = email_enabled + if notification_enabled is not None: + self.notification_enabled = notification_enabled + if oauth_enabled is not None: + self.oauth_enabled = oauth_enabled + if sms_enabled is not None: + self.sms_enabled = sms_enabled + if two_fa_enabled is not None: + self.two_fa_enabled = two_fa_enabled + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + + @property + def email_enabled(self): + """Gets the email_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The email_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._email_enabled + + @email_enabled.setter + def email_enabled(self, email_enabled): + """Sets the email_enabled of this FeaturesInfo. + + + :param email_enabled: The email_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._email_enabled = email_enabled + + @property + def notification_enabled(self): + """Gets the notification_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The notification_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._notification_enabled + + @notification_enabled.setter + def notification_enabled(self, notification_enabled): + """Sets the notification_enabled of this FeaturesInfo. + + + :param notification_enabled: The notification_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._notification_enabled = notification_enabled + + @property + def oauth_enabled(self): + """Gets the oauth_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._oauth_enabled + + @oauth_enabled.setter + def oauth_enabled(self, oauth_enabled): + """Sets the oauth_enabled of this FeaturesInfo. + + + :param oauth_enabled: The oauth_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._oauth_enabled = oauth_enabled + + @property + def sms_enabled(self): + """Gets the sms_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The sms_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._sms_enabled + + @sms_enabled.setter + def sms_enabled(self, sms_enabled): + """Sets the sms_enabled of this FeaturesInfo. + + + :param sms_enabled: The sms_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._sms_enabled = sms_enabled + + @property + def two_fa_enabled(self): + """Gets the two_fa_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._two_fa_enabled + + @two_fa_enabled.setter + def two_fa_enabled(self, two_fa_enabled): + """Sets the two_fa_enabled of this FeaturesInfo. + + + :param two_fa_enabled: The two_fa_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._two_fa_enabled = two_fa_enabled + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this FeaturesInfo. # noqa: E501 + + + :return: The white_labeling_enabled of this FeaturesInfo. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this FeaturesInfo. + + + :param white_labeling_enabled: The white_labeling_enabled of this FeaturesInfo. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FeaturesInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FeaturesInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valueboolean.py b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valueboolean.py new file mode 100644 index 0000000..fab089c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valueboolean.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueboolean(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'bool', + 'dynamic_value': 'DynamicValueboolean', + 'user_value': 'bool' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueboolean - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueboolean. + + + :param default_value: The default_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: DynamicValueboolean + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueboolean. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueboolean. # noqa: E501 + :type: DynamicValueboolean + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueboolean. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :rtype: bool + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueboolean. + + + :param user_value: The user_value of this FilterPredicateValueboolean. # noqa: E501 + :type: bool + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueboolean, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueboolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuedouble.py b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuedouble.py new file mode 100644 index 0000000..3467a02 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuedouble.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuedouble(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'float', + 'dynamic_value': 'DynamicValuedouble', + 'user_value': 'float' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuedouble - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuedouble. + + + :param default_value: The default_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: DynamicValuedouble + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuedouble. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuedouble. # noqa: E501 + :type: DynamicValuedouble + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuedouble. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :rtype: float + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuedouble. + + + :param user_value: The user_value of this FilterPredicateValuedouble. # noqa: E501 + :type: float + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuedouble, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuedouble): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valueint.py b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valueint.py new file mode 100644 index 0000000..8def90a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valueint.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValueint(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValueint', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValueint - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The default_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValueint. + + + :param default_value: The default_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :rtype: DynamicValueint + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValueint. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValueint. # noqa: E501 + :type: DynamicValueint + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValueint. # noqa: E501 + + + :return: The user_value of this FilterPredicateValueint. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValueint. + + + :param user_value: The user_value of this FilterPredicateValueint. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValueint, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValueint): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuelong.py b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuelong.py new file mode 100644 index 0000000..915a56a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuelong.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuelong(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'int', + 'dynamic_value': 'DynamicValuelong', + 'user_value': 'int' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuelong - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuelong. + + + :param default_value: The default_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: DynamicValuelong + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuelong. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuelong. # noqa: E501 + :type: DynamicValuelong + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuelong. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuelong. # noqa: E501 + :rtype: int + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuelong. + + + :param user_value: The user_value of this FilterPredicateValuelong. # noqa: E501 + :type: int + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuelong, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuelong): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuestring.py b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuestring.py new file mode 100644 index 0000000..f7598bb --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/filter_predicate_valuestring.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class FilterPredicateValuestring(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'default_value': 'str', + 'dynamic_value': 'DynamicValuestring', + 'user_value': 'str' + } + + attribute_map = { + 'default_value': 'defaultValue', + 'dynamic_value': 'dynamicValue', + 'user_value': 'userValue' + } + + def __init__(self, default_value=None, dynamic_value=None, user_value=None): # noqa: E501 + """FilterPredicateValuestring - a model defined in Swagger""" # noqa: E501 + self._default_value = None + self._dynamic_value = None + self._user_value = None + self.discriminator = None + if default_value is not None: + self.default_value = default_value + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if user_value is not None: + self.user_value = user_value + + @property + def default_value(self): + """Gets the default_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The default_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._default_value + + @default_value.setter + def default_value(self, default_value): + """Sets the default_value of this FilterPredicateValuestring. + + + :param default_value: The default_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._default_value = default_value + + @property + def dynamic_value(self): + """Gets the dynamic_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this FilterPredicateValuestring. + + + :param dynamic_value: The dynamic_value of this FilterPredicateValuestring. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def user_value(self): + """Gets the user_value of this FilterPredicateValuestring. # noqa: E501 + + + :return: The user_value of this FilterPredicateValuestring. # noqa: E501 + :rtype: str + """ + return self._user_value + + @user_value.setter + def user_value(self, user_value): + """Sets the user_value of this FilterPredicateValuestring. + + + :param user_value: The user_value of this FilterPredicateValuestring. # noqa: E501 + :type: str + """ + + self._user_value = user_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(FilterPredicateValuestring, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, FilterPredicateValuestring): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/group_entity_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/group_entity_export_data.py new file mode 100644 index 0000000..f60f8a8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/group_entity_export_data.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class GroupEntityExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'ExportableEntityEntityId', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None, *args, **kwargs): # noqa: E501 + """GroupEntityExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this GroupEntityExportData. # noqa: E501 + + + :return: The attributes of this GroupEntityExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this GroupEntityExportData. + + + :param attributes: The attributes of this GroupEntityExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this GroupEntityExportData. # noqa: E501 + + + :return: The entity of this GroupEntityExportData. # noqa: E501 + :rtype: ExportableEntityEntityId + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this GroupEntityExportData. + + + :param entity: The entity of this GroupEntityExportData. # noqa: E501 + :type: ExportableEntityEntityId + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this GroupEntityExportData. # noqa: E501 + + + :return: The entity_type of this GroupEntityExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this GroupEntityExportData. + + + :param entity_type: The entity_type of this GroupEntityExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this GroupEntityExportData. # noqa: E501 + + + :return: The relations of this GroupEntityExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this GroupEntityExportData. + + + :param relations: The relations of this GroupEntityExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupEntityExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupEntityExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission.py b/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission.py new file mode 100644 index 0000000..4da9a36 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class GroupPermission(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'id': 'GroupPermissionId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'user_group_id': 'EntityGroupId', + 'role_id': 'RoleId', + 'entity_group_id': 'EntityGroupId', + 'entity_group_type': 'str', + 'name': 'str' + } + + attribute_map = { + 'public': 'public', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'user_group_id': 'userGroupId', + 'role_id': 'roleId', + 'entity_group_id': 'entityGroupId', + 'entity_group_type': 'entityGroupType', + 'name': 'name' + } + + def __init__(self, public=None, id=None, created_time=None, tenant_id=None, user_group_id=None, role_id=None, entity_group_id=None, entity_group_type=None, name=None): # noqa: E501 + """GroupPermission - a model defined in Swagger""" # noqa: E501 + self._public = None + self._id = None + self._created_time = None + self._tenant_id = None + self._user_group_id = None + self._role_id = None + self._entity_group_id = None + self._entity_group_type = None + self._name = None + self.discriminator = None + if public is not None: + self.public = public + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if user_group_id is not None: + self.user_group_id = user_group_id + if role_id is not None: + self.role_id = role_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if entity_group_type is not None: + self.entity_group_type = entity_group_type + if name is not None: + self.name = name + + @property + def public(self): + """Gets the public of this GroupPermission. # noqa: E501 + + + :return: The public of this GroupPermission. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this GroupPermission. + + + :param public: The public of this GroupPermission. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def id(self): + """Gets the id of this GroupPermission. # noqa: E501 + + + :return: The id of this GroupPermission. # noqa: E501 + :rtype: GroupPermissionId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this GroupPermission. + + + :param id: The id of this GroupPermission. # noqa: E501 + :type: GroupPermissionId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this GroupPermission. # noqa: E501 + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :return: The created_time of this GroupPermission. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this GroupPermission. + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this GroupPermission. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this GroupPermission. # noqa: E501 + + + :return: The tenant_id of this GroupPermission. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this GroupPermission. + + + :param tenant_id: The tenant_id of this GroupPermission. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def user_group_id(self): + """Gets the user_group_id of this GroupPermission. # noqa: E501 + + + :return: The user_group_id of this GroupPermission. # noqa: E501 + :rtype: EntityGroupId + """ + return self._user_group_id + + @user_group_id.setter + def user_group_id(self, user_group_id): + """Sets the user_group_id of this GroupPermission. + + + :param user_group_id: The user_group_id of this GroupPermission. # noqa: E501 + :type: EntityGroupId + """ + + self._user_group_id = user_group_id + + @property + def role_id(self): + """Gets the role_id of this GroupPermission. # noqa: E501 + + + :return: The role_id of this GroupPermission. # noqa: E501 + :rtype: RoleId + """ + return self._role_id + + @role_id.setter + def role_id(self, role_id): + """Sets the role_id of this GroupPermission. + + + :param role_id: The role_id of this GroupPermission. # noqa: E501 + :type: RoleId + """ + + self._role_id = role_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this GroupPermission. # noqa: E501 + + + :return: The entity_group_id of this GroupPermission. # noqa: E501 + :rtype: EntityGroupId + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this GroupPermission. + + + :param entity_group_id: The entity_group_id of this GroupPermission. # noqa: E501 + :type: EntityGroupId + """ + + self._entity_group_id = entity_group_id + + @property + def entity_group_type(self): + """Gets the entity_group_type of this GroupPermission. # noqa: E501 + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :return: The entity_group_type of this GroupPermission. # noqa: E501 + :rtype: str + """ + return self._entity_group_type + + @entity_group_type.setter + def entity_group_type(self, entity_group_type): + """Sets the entity_group_type of this GroupPermission. + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :param entity_group_type: The entity_group_type of this GroupPermission. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_group_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_group_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_group_type, allowed_values) + ) + + self._entity_group_type = entity_group_type + + @property + def name(self): + """Gets the name of this GroupPermission. # noqa: E501 + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :return: The name of this GroupPermission. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this GroupPermission. + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :param name: The name of this GroupPermission. # noqa: E501 + :type: str + """ + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupPermission, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupPermission): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission_id.py new file mode 100644 index 0000000..9869cc8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class GroupPermissionId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """GroupPermissionId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this GroupPermissionId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this GroupPermissionId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this GroupPermissionId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this GroupPermissionId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this GroupPermissionId. # noqa: E501 + + + :return: The entity_type of this GroupPermissionId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this GroupPermissionId. + + + :param entity_type: The entity_type of this GroupPermissionId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupPermissionId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupPermissionId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission_info.py new file mode 100644 index 0000000..bc84e3e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/group_permission_info.py @@ -0,0 +1,560 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class GroupPermissionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'read_only': 'bool', + 'id': 'GroupPermissionId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'user_group_id': 'EntityGroupId', + 'role_id': 'RoleId', + 'entity_group_id': 'EntityGroupId', + 'entity_group_type': 'str', + 'name': 'str', + 'role': 'Role', + 'entity_group_name': 'str', + 'entity_group_owner_id': 'EntityId', + 'entity_group_owner_name': 'str', + 'user_group_name': 'str', + 'user_group_owner_id': 'EntityId', + 'user_group_owner_name': 'str' + } + + attribute_map = { + 'public': 'public', + 'read_only': 'readOnly', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'user_group_id': 'userGroupId', + 'role_id': 'roleId', + 'entity_group_id': 'entityGroupId', + 'entity_group_type': 'entityGroupType', + 'name': 'name', + 'role': 'role', + 'entity_group_name': 'entityGroupName', + 'entity_group_owner_id': 'entityGroupOwnerId', + 'entity_group_owner_name': 'entityGroupOwnerName', + 'user_group_name': 'userGroupName', + 'user_group_owner_id': 'userGroupOwnerId', + 'user_group_owner_name': 'userGroupOwnerName' + } + + def __init__(self, public=None, read_only=None, id=None, created_time=None, tenant_id=None, user_group_id=None, role_id=None, entity_group_id=None, entity_group_type=None, name=None, role=None, entity_group_name=None, entity_group_owner_id=None, entity_group_owner_name=None, user_group_name=None, user_group_owner_id=None, user_group_owner_name=None): # noqa: E501 + """GroupPermissionInfo - a model defined in Swagger""" # noqa: E501 + self._public = None + self._read_only = None + self._id = None + self._created_time = None + self._tenant_id = None + self._user_group_id = None + self._role_id = None + self._entity_group_id = None + self._entity_group_type = None + self._name = None + self._role = None + self._entity_group_name = None + self._entity_group_owner_id = None + self._entity_group_owner_name = None + self._user_group_name = None + self._user_group_owner_id = None + self._user_group_owner_name = None + self.discriminator = None + if public is not None: + self.public = public + if read_only is not None: + self.read_only = read_only + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if user_group_id is not None: + self.user_group_id = user_group_id + if role_id is not None: + self.role_id = role_id + if entity_group_id is not None: + self.entity_group_id = entity_group_id + if entity_group_type is not None: + self.entity_group_type = entity_group_type + if name is not None: + self.name = name + if role is not None: + self.role = role + if entity_group_name is not None: + self.entity_group_name = entity_group_name + if entity_group_owner_id is not None: + self.entity_group_owner_id = entity_group_owner_id + if entity_group_owner_name is not None: + self.entity_group_owner_name = entity_group_owner_name + if user_group_name is not None: + self.user_group_name = user_group_name + if user_group_owner_id is not None: + self.user_group_owner_id = user_group_owner_id + if user_group_owner_name is not None: + self.user_group_owner_name = user_group_owner_name + + @property + def public(self): + """Gets the public of this GroupPermissionInfo. # noqa: E501 + + + :return: The public of this GroupPermissionInfo. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this GroupPermissionInfo. + + + :param public: The public of this GroupPermissionInfo. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def read_only(self): + """Gets the read_only of this GroupPermissionInfo. # noqa: E501 + + + :return: The read_only of this GroupPermissionInfo. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this GroupPermissionInfo. + + + :param read_only: The read_only of this GroupPermissionInfo. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def id(self): + """Gets the id of this GroupPermissionInfo. # noqa: E501 + + + :return: The id of this GroupPermissionInfo. # noqa: E501 + :rtype: GroupPermissionId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this GroupPermissionInfo. + + + :param id: The id of this GroupPermissionInfo. # noqa: E501 + :type: GroupPermissionId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this GroupPermissionInfo. # noqa: E501 + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :return: The created_time of this GroupPermissionInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this GroupPermissionInfo. + + Timestamp of the group permission creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this GroupPermissionInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The tenant_id of this GroupPermissionInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this GroupPermissionInfo. + + + :param tenant_id: The tenant_id of this GroupPermissionInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def user_group_id(self): + """Gets the user_group_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The user_group_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityGroupId + """ + return self._user_group_id + + @user_group_id.setter + def user_group_id(self, user_group_id): + """Sets the user_group_id of this GroupPermissionInfo. + + + :param user_group_id: The user_group_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityGroupId + """ + + self._user_group_id = user_group_id + + @property + def role_id(self): + """Gets the role_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The role_id of this GroupPermissionInfo. # noqa: E501 + :rtype: RoleId + """ + return self._role_id + + @role_id.setter + def role_id(self, role_id): + """Sets the role_id of this GroupPermissionInfo. + + + :param role_id: The role_id of this GroupPermissionInfo. # noqa: E501 + :type: RoleId + """ + + self._role_id = role_id + + @property + def entity_group_id(self): + """Gets the entity_group_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The entity_group_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityGroupId + """ + return self._entity_group_id + + @entity_group_id.setter + def entity_group_id(self, entity_group_id): + """Sets the entity_group_id of this GroupPermissionInfo. + + + :param entity_group_id: The entity_group_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityGroupId + """ + + self._entity_group_id = entity_group_id + + @property + def entity_group_type(self): + """Gets the entity_group_type of this GroupPermissionInfo. # noqa: E501 + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :return: The entity_group_type of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_group_type + + @entity_group_type.setter + def entity_group_type(self, entity_group_type): + """Sets the entity_group_type of this GroupPermissionInfo. + + Type of the entities in the group: DEVICE, ASSET, CUSTOMER, etc. # noqa: E501 + + :param entity_group_type: The entity_group_type of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_group_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_group_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_group_type, allowed_values) + ) + + self._entity_group_type = entity_group_type + + @property + def name(self): + """Gets the name of this GroupPermissionInfo. # noqa: E501 + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :return: The name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this GroupPermissionInfo. + + Name of the Group Permissions. Auto-generated # noqa: E501 + + :param name: The name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def role(self): + """Gets the role of this GroupPermissionInfo. # noqa: E501 + + + :return: The role of this GroupPermissionInfo. # noqa: E501 + :rtype: Role + """ + return self._role + + @role.setter + def role(self, role): + """Sets the role of this GroupPermissionInfo. + + + :param role: The role of this GroupPermissionInfo. # noqa: E501 + :type: Role + """ + + self._role = role + + @property + def entity_group_name(self): + """Gets the entity_group_name of this GroupPermissionInfo. # noqa: E501 + + Entity Group Name. # noqa: E501 + + :return: The entity_group_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_group_name + + @entity_group_name.setter + def entity_group_name(self, entity_group_name): + """Sets the entity_group_name of this GroupPermissionInfo. + + Entity Group Name. # noqa: E501 + + :param entity_group_name: The entity_group_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._entity_group_name = entity_group_name + + @property + def entity_group_owner_id(self): + """Gets the entity_group_owner_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The entity_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityId + """ + return self._entity_group_owner_id + + @entity_group_owner_id.setter + def entity_group_owner_id(self, entity_group_owner_id): + """Sets the entity_group_owner_id of this GroupPermissionInfo. + + + :param entity_group_owner_id: The entity_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityId + """ + + self._entity_group_owner_id = entity_group_owner_id + + @property + def entity_group_owner_name(self): + """Gets the entity_group_owner_name of this GroupPermissionInfo. # noqa: E501 + + Name of the entity group owner (Tenant or Customer title). # noqa: E501 + + :return: The entity_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_group_owner_name + + @entity_group_owner_name.setter + def entity_group_owner_name(self, entity_group_owner_name): + """Sets the entity_group_owner_name of this GroupPermissionInfo. + + Name of the entity group owner (Tenant or Customer title). # noqa: E501 + + :param entity_group_owner_name: The entity_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._entity_group_owner_name = entity_group_owner_name + + @property + def user_group_name(self): + """Gets the user_group_name of this GroupPermissionInfo. # noqa: E501 + + User Group Name. # noqa: E501 + + :return: The user_group_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._user_group_name + + @user_group_name.setter + def user_group_name(self, user_group_name): + """Sets the user_group_name of this GroupPermissionInfo. + + User Group Name. # noqa: E501 + + :param user_group_name: The user_group_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._user_group_name = user_group_name + + @property + def user_group_owner_id(self): + """Gets the user_group_owner_id of this GroupPermissionInfo. # noqa: E501 + + + :return: The user_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :rtype: EntityId + """ + return self._user_group_owner_id + + @user_group_owner_id.setter + def user_group_owner_id(self, user_group_owner_id): + """Sets the user_group_owner_id of this GroupPermissionInfo. + + + :param user_group_owner_id: The user_group_owner_id of this GroupPermissionInfo. # noqa: E501 + :type: EntityId + """ + + self._user_group_owner_id = user_group_owner_id + + @property + def user_group_owner_name(self): + """Gets the user_group_owner_name of this GroupPermissionInfo. # noqa: E501 + + Name of the user group owner (Tenant or Customer title). # noqa: E501 + + :return: The user_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._user_group_owner_name + + @user_group_owner_name.setter + def user_group_owner_name(self, user_group_owner_name): + """Sets the user_group_owner_name of this GroupPermissionInfo. + + Name of the user group owner (Tenant or Customer title). # noqa: E501 + + :param user_group_owner_name: The user_group_owner_name of this GroupPermissionInfo. # noqa: E501 + :type: str + """ + + self._user_group_owner_name = user_group_owner_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GroupPermissionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GroupPermissionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/home_dashboard.py b/tb-rest-client/python/tb_rest_client/models/models_pe/home_dashboard.py new file mode 100644 index 0000000..2134628 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/home_dashboard.py @@ -0,0 +1,464 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HomeDashboard(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'DashboardId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'title': 'str', + 'image': 'str', + 'assigned_customers': 'list[ShortCustomerInfo]', + 'mobile_hide': 'bool', + 'mobile_order': 'int', + 'name': 'str', + 'configuration': 'JsonNode', + 'hide_dashboard_toolbar': 'bool', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'title': 'title', + 'image': 'image', + 'assigned_customers': 'assignedCustomers', + 'mobile_hide': 'mobileHide', + 'mobile_order': 'mobileOrder', + 'name': 'name', + 'configuration': 'configuration', + 'hide_dashboard_toolbar': 'hideDashboardToolbar', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, customer_id=None, owner_id=None, title=None, image=None, assigned_customers=None, mobile_hide=None, mobile_order=None, name=None, configuration=None, hide_dashboard_toolbar=None): # noqa: E501 + """HomeDashboard - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._title = None + self._image = None + self._assigned_customers = None + self._mobile_hide = None + self._mobile_order = None + self._name = None + self._configuration = None + self._hide_dashboard_toolbar = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + if title is not None: + self.title = title + if image is not None: + self.image = image + if assigned_customers is not None: + self.assigned_customers = assigned_customers + if mobile_hide is not None: + self.mobile_hide = mobile_hide + if mobile_order is not None: + self.mobile_order = mobile_order + if name is not None: + self.name = name + if configuration is not None: + self.configuration = configuration + if hide_dashboard_toolbar is not None: + self.hide_dashboard_toolbar = hide_dashboard_toolbar + + @property + def id(self): + """Gets the id of this HomeDashboard. # noqa: E501 + + + :return: The id of this HomeDashboard. # noqa: E501 + :rtype: DashboardId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this HomeDashboard. + + + :param id: The id of this HomeDashboard. # noqa: E501 + :type: DashboardId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this HomeDashboard. # noqa: E501 + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :return: The created_time of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this HomeDashboard. + + Timestamp of the dashboard creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this HomeDashboard. # noqa: E501 + + + :return: The tenant_id of this HomeDashboard. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this HomeDashboard. + + + :param tenant_id: The tenant_id of this HomeDashboard. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this HomeDashboard. # noqa: E501 + + + :return: The customer_id of this HomeDashboard. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this HomeDashboard. + + + :param customer_id: The customer_id of this HomeDashboard. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this HomeDashboard. # noqa: E501 + + + :return: The owner_id of this HomeDashboard. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this HomeDashboard. + + + :param owner_id: The owner_id of this HomeDashboard. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def title(self): + """Gets the title of this HomeDashboard. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this HomeDashboard. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def image(self): + """Gets the image of this HomeDashboard. # noqa: E501 + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :return: The image of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this HomeDashboard. + + Thumbnail picture for rendering of the dashboards in a grid view on mobile devices. # noqa: E501 + + :param image: The image of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def assigned_customers(self): + """Gets the assigned_customers of this HomeDashboard. # noqa: E501 + + List of assigned customers with their info. # noqa: E501 + + :return: The assigned_customers of this HomeDashboard. # noqa: E501 + :rtype: list[ShortCustomerInfo] + """ + return self._assigned_customers + + @assigned_customers.setter + def assigned_customers(self, assigned_customers): + """Sets the assigned_customers of this HomeDashboard. + + List of assigned customers with their info. # noqa: E501 + + :param assigned_customers: The assigned_customers of this HomeDashboard. # noqa: E501 + :type: list[ShortCustomerInfo] + """ + + self._assigned_customers = assigned_customers + + @property + def mobile_hide(self): + """Gets the mobile_hide of this HomeDashboard. # noqa: E501 + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :return: The mobile_hide of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._mobile_hide + + @mobile_hide.setter + def mobile_hide(self, mobile_hide): + """Sets the mobile_hide of this HomeDashboard. + + Hide dashboard from mobile devices. Useful if the dashboard is not designed for small screens. # noqa: E501 + + :param mobile_hide: The mobile_hide of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._mobile_hide = mobile_hide + + @property + def mobile_order(self): + """Gets the mobile_order of this HomeDashboard. # noqa: E501 + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :return: The mobile_order of this HomeDashboard. # noqa: E501 + :rtype: int + """ + return self._mobile_order + + @mobile_order.setter + def mobile_order(self, mobile_order): + """Sets the mobile_order of this HomeDashboard. + + Order on mobile devices. Useful to adjust sorting of the dashboards for mobile applications # noqa: E501 + + :param mobile_order: The mobile_order of this HomeDashboard. # noqa: E501 + :type: int + """ + + self._mobile_order = mobile_order + + @property + def name(self): + """Gets the name of this HomeDashboard. # noqa: E501 + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :return: The name of this HomeDashboard. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this HomeDashboard. + + Same as title of the dashboard. Read-only field. Update the 'title' to change the 'name' of the dashboard. # noqa: E501 + + :param name: The name of this HomeDashboard. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def configuration(self): + """Gets the configuration of this HomeDashboard. # noqa: E501 + + + :return: The configuration of this HomeDashboard. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this HomeDashboard. + + + :param configuration: The configuration of this HomeDashboard. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def hide_dashboard_toolbar(self): + """Gets the hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :return: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :rtype: bool + """ + return self._hide_dashboard_toolbar + + @hide_dashboard_toolbar.setter + def hide_dashboard_toolbar(self, hide_dashboard_toolbar): + """Sets the hide_dashboard_toolbar of this HomeDashboard. + + Hide dashboard toolbar flag. Useful for rendering dashboards on mobile. # noqa: E501 + + :param hide_dashboard_toolbar: The hide_dashboard_toolbar of this HomeDashboard. # noqa: E501 + :type: bool + """ + + self._hide_dashboard_toolbar = hide_dashboard_toolbar + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HomeDashboard, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HomeDashboard): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/http_routing_key_body.py b/tb-rest-client/python/tb_rest_client/models/models_pe/http_routing_key_body.py new file mode 100644 index 0000000..dfc6388 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/http_routing_key_body.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class HttpRoutingKeyBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'request_params': 'Object' + } + + attribute_map = { + 'request_params': 'requestParams' + } + + def __init__(self, request_params=None): # noqa: E501 + """HttpRoutingKeyBody - a model defined in Swagger""" # noqa: E501 + self._request_params = None + self.discriminator = None + self.request_params = request_params + + @property + def request_params(self): + """Gets the request_params of this HttpRoutingKeyBody. # noqa: E501 + + requestParams # noqa: E501 + + :return: The request_params of this HttpRoutingKeyBody. # noqa: E501 + :rtype: Object + """ + return self._request_params + + @request_params.setter + def request_params(self, request_params): + """Sets the request_params of this HttpRoutingKeyBody. + + requestParams # noqa: E501 + + :param request_params: The request_params of this HttpRoutingKeyBody. # noqa: E501 + :type: Object + """ + if request_params is None: + raise ValueError("Invalid value for `request_params`, must not be `None`") # noqa: E501 + + self._request_params = request_params + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(HttpRoutingKeyBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, HttpRoutingKeyBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/input_stream.py b/tb-rest-client/python/tb_rest_client/models/models_pe/input_stream.py new file mode 100644 index 0000000..02d378d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/input_stream.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class InputStream(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """InputStream - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(InputStream, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, InputStream): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/integration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/integration.py new file mode 100644 index 0000000..6ad69e5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/integration.py @@ -0,0 +1,557 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Integration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'IntegrationId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'default_converter_id': 'ConverterId', + 'downlink_converter_id': 'ConverterId', + 'routing_key': 'str', + 'type': 'str', + 'debug_mode': 'bool', + 'enabled': 'bool', + 'remote': 'bool', + 'allow_create_devices_or_assets': 'bool', + 'secret': 'str', + 'configuration': 'JsonNode', + 'additional_info': 'JsonNode', + 'name': 'str', + 'edge_template': 'bool', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'default_converter_id': 'defaultConverterId', + 'downlink_converter_id': 'downlinkConverterId', + 'routing_key': 'routingKey', + 'type': 'type', + 'debug_mode': 'debugMode', + 'enabled': 'enabled', + 'remote': 'remote', + 'allow_create_devices_or_assets': 'allowCreateDevicesOrAssets', + 'secret': 'secret', + 'configuration': 'configuration', + 'additional_info': 'additionalInfo', + 'name': 'name', + 'edge_template': 'edgeTemplate', + 'external_id': 'externalId' + } + + def __init__(self, id=None, external_id=None, created_time=None, tenant_id=None, default_converter_id=None, downlink_converter_id=None, routing_key=None, type=None, debug_mode=None, enabled=None, remote=None, allow_create_devices_or_assets=None, secret=None, configuration=None, additional_info=None, name=None, edge_template=None): # noqa: E501 + """Integration - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._default_converter_id = None + self._downlink_converter_id = None + self._routing_key = None + self._type = None + self._debug_mode = None + self._enabled = None + self._remote = None + self._allow_create_devices_or_assets = None + self._secret = None + self._configuration = None + self._additional_info = None + self._name = None + self._edge_template = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + self.default_converter_id = default_converter_id + if downlink_converter_id is not None: + self.downlink_converter_id = downlink_converter_id + self.routing_key = routing_key + self.type = type + if debug_mode is not None: + self.debug_mode = debug_mode + if enabled is not None: + self.enabled = enabled + if remote is not None: + self.remote = remote + if allow_create_devices_or_assets is not None: + self.allow_create_devices_or_assets = allow_create_devices_or_assets + if secret is not None: + self.secret = secret + self.configuration = configuration + if additional_info is not None: + self.additional_info = additional_info + self.name = name + if edge_template is not None: + self.edge_template = edge_template + + @property + def id(self): + """Gets the id of this Integration. # noqa: E501 + + + :return: The id of this Integration. # noqa: E501 + :rtype: IntegrationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Integration. + + + :param id: The id of this Integration. # noqa: E501 + :type: IntegrationId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Integration. # noqa: E501 + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :return: The created_time of this Integration. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Integration. + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Integration. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Integration. # noqa: E501 + + + :return: The tenant_id of this Integration. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Integration. + + + :param tenant_id: The tenant_id of this Integration. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def default_converter_id(self): + """Gets the default_converter_id of this Integration. # noqa: E501 + + + :return: The default_converter_id of this Integration. # noqa: E501 + :rtype: ConverterId + """ + return self._default_converter_id + + @default_converter_id.setter + def default_converter_id(self, default_converter_id): + """Sets the default_converter_id of this Integration. + + + :param default_converter_id: The default_converter_id of this Integration. # noqa: E501 + :type: ConverterId + """ + if default_converter_id is None: + raise ValueError("Invalid value for `default_converter_id`, must not be `None`") # noqa: E501 + + self._default_converter_id = default_converter_id + + @property + def downlink_converter_id(self): + """Gets the downlink_converter_id of this Integration. # noqa: E501 + + + :return: The downlink_converter_id of this Integration. # noqa: E501 + :rtype: ConverterId + """ + return self._downlink_converter_id + + @downlink_converter_id.setter + def downlink_converter_id(self, downlink_converter_id): + """Sets the downlink_converter_id of this Integration. + + + :param downlink_converter_id: The downlink_converter_id of this Integration. # noqa: E501 + :type: ConverterId + """ + + self._downlink_converter_id = downlink_converter_id + + @property + def routing_key(self): + """Gets the routing_key of this Integration. # noqa: E501 + + String value used by HTTP based integrations for the base URL construction and by the remote integrations. Remote integration uses this value along with the 'secret' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :return: The routing_key of this Integration. # noqa: E501 + :rtype: str + """ + return self._routing_key + + @routing_key.setter + def routing_key(self, routing_key): + """Sets the routing_key of this Integration. + + String value used by HTTP based integrations for the base URL construction and by the remote integrations. Remote integration uses this value along with the 'secret' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :param routing_key: The routing_key of this Integration. # noqa: E501 + :type: str + """ + if routing_key is None: + raise ValueError("Invalid value for `routing_key`, must not be `None`") # noqa: E501 + + self._routing_key = routing_key + + @property + def type(self): + """Gets the type of this Integration. # noqa: E501 + + The type of the integration # noqa: E501 + + :return: The type of this Integration. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Integration. + + The type of the integration # noqa: E501 + + :param type: The type of this Integration. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APACHE_PULSAR", "AWS_IOT", "AWS_KINESIS", "AWS_SQS", "AZURE_EVENT_HUB", "AZURE_IOT_HUB", "AZURE_SERVICE_BUS", "CHIRPSTACK", "COAP", "CUSTOM", "HTTP", "IBM_WATSON_IOT", "KAFKA", "LORIOT", "MQTT", "OCEANCONNECT", "OPC_UA", "PUB_SUB", "RABBITMQ", "SIGFOX", "TCP", "THINGPARK", "TMOBILE_IOT_CDP", "TPE", "TTI", "TTN", "TUYA", "UDP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def debug_mode(self): + """Gets the debug_mode of this Integration. # noqa: E501 + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :return: The debug_mode of this Integration. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this Integration. + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :param debug_mode: The debug_mode of this Integration. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def enabled(self): + """Gets the enabled of this Integration. # noqa: E501 + + Boolean flag to enable/disable the integration # noqa: E501 + + :return: The enabled of this Integration. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this Integration. + + Boolean flag to enable/disable the integration # noqa: E501 + + :param enabled: The enabled of this Integration. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def remote(self): + """Gets the remote of this Integration. # noqa: E501 + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :return: The remote of this Integration. # noqa: E501 + :rtype: bool + """ + return self._remote + + @remote.setter + def remote(self, remote): + """Sets the remote of this Integration. + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :param remote: The remote of this Integration. # noqa: E501 + :type: bool + """ + + self._remote = remote + + @property + def allow_create_devices_or_assets(self): + """Gets the allow_create_devices_or_assets of this Integration. # noqa: E501 + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :return: The allow_create_devices_or_assets of this Integration. # noqa: E501 + :rtype: bool + """ + return self._allow_create_devices_or_assets + + @allow_create_devices_or_assets.setter + def allow_create_devices_or_assets(self, allow_create_devices_or_assets): + """Sets the allow_create_devices_or_assets of this Integration. + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :param allow_create_devices_or_assets: The allow_create_devices_or_assets of this Integration. # noqa: E501 + :type: bool + """ + + self._allow_create_devices_or_assets = allow_create_devices_or_assets + + @property + def secret(self): + """Gets the secret of this Integration. # noqa: E501 + + String value used by the remote integrations. Remote integration uses this value along with the 'routingKey' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :return: The secret of this Integration. # noqa: E501 + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """Sets the secret of this Integration. + + String value used by the remote integrations. Remote integration uses this value along with the 'routingKey' for kind of security and validation to be able to connect to the platform using Grpc # noqa: E501 + + :param secret: The secret of this Integration. # noqa: E501 + :type: str + """ + + self._secret = secret + + @property + def configuration(self): + """Gets the configuration of this Integration. # noqa: E501 + + + :return: The configuration of this Integration. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this Integration. + + + :param configuration: The configuration of this Integration. # noqa: E501 + :type: JsonNode + """ + if configuration is None: + raise ValueError("Invalid value for `configuration`, must not be `None`") # noqa: E501 + + self._configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this Integration. # noqa: E501 + + + :return: The additional_info of this Integration. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Integration. + + + :param additional_info: The additional_info of this Integration. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def name(self): + """Gets the name of this Integration. # noqa: E501 + + Integration Name # noqa: E501 + + :return: The name of this Integration. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Integration. + + Integration Name # noqa: E501 + + :param name: The name of this Integration. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def edge_template(self): + """Gets the edge_template of this Integration. # noqa: E501 + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :return: The edge_template of this Integration. # noqa: E501 + :rtype: bool + """ + return self._edge_template + + @edge_template.setter + def edge_template(self, edge_template): + """Sets the edge_template of this Integration. + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :param edge_template: The edge_template of this Integration. # noqa: E501 + :type: bool + """ + + self._edge_template = edge_template + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Integration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Integration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/integration_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/integration_id.py new file mode 100644 index 0000000..04d0f8c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/integration_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class IntegrationId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """IntegrationId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this IntegrationId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this IntegrationId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this IntegrationId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this IntegrationId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this IntegrationId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this IntegrationId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this IntegrationId. + + string # noqa: E501 + + :param entity_type: The entity_type of this IntegrationId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["INTEGRATION"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(IntegrationId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, IntegrationId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/integration_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/integration_info.py new file mode 100644 index 0000000..b980418 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/integration_info.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class IntegrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'stats': 'ArrayNode', + 'status': 'ObjectNode', + 'id': 'IntegrationId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'type': 'str', + 'debug_mode': 'bool', + 'enabled': 'bool', + 'remote': 'bool', + 'allow_create_devices_or_assets': 'bool', + 'name': 'str', + 'edge_template': 'bool' + } + + attribute_map = { + 'stats': 'stats', + 'status': 'status', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'type': 'type', + 'debug_mode': 'debugMode', + 'enabled': 'enabled', + 'remote': 'remote', + 'allow_create_devices_or_assets': 'allowCreateDevicesOrAssets', + 'name': 'name', + 'edge_template': 'edgeTemplate' + } + + def __init__(self, stats=None, status=None, id=None, created_time=None, tenant_id=None, type=None, debug_mode=None, enabled=None, remote=None, allow_create_devices_or_assets=None, name=None, edge_template=None): # noqa: E501 + """IntegrationInfo - a model defined in Swagger""" # noqa: E501 + self._stats = None + self._status = None + self._id = None + self._created_time = None + self._tenant_id = None + self._type = None + self._debug_mode = None + self._enabled = None + self._remote = None + self._allow_create_devices_or_assets = None + self._name = None + self._edge_template = None + self.discriminator = None + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + self.type = type + if debug_mode is not None: + self.debug_mode = debug_mode + if enabled is not None: + self.enabled = enabled + if remote is not None: + self.remote = remote + if allow_create_devices_or_assets is not None: + self.allow_create_devices_or_assets = allow_create_devices_or_assets + self.name = name + if edge_template is not None: + self.edge_template = edge_template + + @property + def stats(self): + """Gets the stats of this IntegrationInfo. # noqa: E501 + + + :return: The stats of this IntegrationInfo. # noqa: E501 + :rtype: ArrayNode + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this IntegrationInfo. + + + :param stats: The stats of this IntegrationInfo. # noqa: E501 + :type: ArrayNode + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this IntegrationInfo. # noqa: E501 + + + :return: The status of this IntegrationInfo. # noqa: E501 + :rtype: ObjectNode + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this IntegrationInfo. + + + :param status: The status of this IntegrationInfo. # noqa: E501 + :type: ObjectNode + """ + + self._status = status + + @property + def id(self): + """Gets the id of this IntegrationInfo. # noqa: E501 + + + :return: The id of this IntegrationInfo. # noqa: E501 + :rtype: IntegrationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this IntegrationInfo. + + + :param id: The id of this IntegrationInfo. # noqa: E501 + :type: IntegrationId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this IntegrationInfo. # noqa: E501 + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :return: The created_time of this IntegrationInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this IntegrationInfo. + + Timestamp of the integration creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this IntegrationInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this IntegrationInfo. # noqa: E501 + + + :return: The tenant_id of this IntegrationInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this IntegrationInfo. + + + :param tenant_id: The tenant_id of this IntegrationInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def type(self): + """Gets the type of this IntegrationInfo. # noqa: E501 + + The type of the integration # noqa: E501 + + :return: The type of this IntegrationInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this IntegrationInfo. + + The type of the integration # noqa: E501 + + :param type: The type of this IntegrationInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APACHE_PULSAR", "AWS_IOT", "AWS_KINESIS", "AWS_SQS", "AZURE_EVENT_HUB", "AZURE_IOT_HUB", "AZURE_SERVICE_BUS", "CHIRPSTACK", "COAP", "CUSTOM", "HTTP", "IBM_WATSON_IOT", "KAFKA", "LORIOT", "MQTT", "OCEANCONNECT", "OPC_UA", "PUB_SUB", "RABBITMQ", "SIGFOX", "TCP", "THINGPARK", "TMOBILE_IOT_CDP", "TPE", "TTI", "TTN", "TUYA", "UDP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def debug_mode(self): + """Gets the debug_mode of this IntegrationInfo. # noqa: E501 + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :return: The debug_mode of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this IntegrationInfo. + + Boolean flag to enable/disable saving received messages as debug events # noqa: E501 + + :param debug_mode: The debug_mode of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def enabled(self): + """Gets the enabled of this IntegrationInfo. # noqa: E501 + + Boolean flag to enable/disable the integration # noqa: E501 + + :return: The enabled of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this IntegrationInfo. + + Boolean flag to enable/disable the integration # noqa: E501 + + :param enabled: The enabled of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def remote(self): + """Gets the remote of this IntegrationInfo. # noqa: E501 + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :return: The remote of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._remote + + @remote.setter + def remote(self, remote): + """Sets the remote of this IntegrationInfo. + + Boolean flag to enable/disable the integration to be executed remotely. Remote integration is launched in a separate microservice. Local integration is executed by the platform core # noqa: E501 + + :param remote: The remote of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._remote = remote + + @property + def allow_create_devices_or_assets(self): + """Gets the allow_create_devices_or_assets of this IntegrationInfo. # noqa: E501 + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :return: The allow_create_devices_or_assets of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._allow_create_devices_or_assets + + @allow_create_devices_or_assets.setter + def allow_create_devices_or_assets(self, allow_create_devices_or_assets): + """Sets the allow_create_devices_or_assets of this IntegrationInfo. + + Boolean flag to allow/disallow the integration to create devices or assets that send message and do not exist in the system yet # noqa: E501 + + :param allow_create_devices_or_assets: The allow_create_devices_or_assets of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._allow_create_devices_or_assets = allow_create_devices_or_assets + + @property + def name(self): + """Gets the name of this IntegrationInfo. # noqa: E501 + + Integration Name # noqa: E501 + + :return: The name of this IntegrationInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this IntegrationInfo. + + Integration Name # noqa: E501 + + :param name: The name of this IntegrationInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def edge_template(self): + """Gets the edge_template of this IntegrationInfo. # noqa: E501 + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :return: The edge_template of this IntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._edge_template + + @edge_template.setter + def edge_template(self, edge_template): + """Sets the edge_template of this IntegrationInfo. + + Boolean flag that specifies that is regular or edge template integration # noqa: E501 + + :param edge_template: The edge_template of this IntegrationInfo. # noqa: E501 + :type: bool + """ + + self._edge_template = edge_template + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(IntegrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, IntegrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/integration_lifecycle_event_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/integration_lifecycle_event_notification_rule_trigger_config.py new file mode 100644 index 0000000..0cb1767 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/integration_lifecycle_event_notification_rule_trigger_config.py @@ -0,0 +1,248 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class IntegrationLifecycleEventNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'integration_types': 'list[str]', + 'integrations': 'list[str]', + 'notify_on': 'list[str]', + 'only_on_error': 'bool', + 'trigger_type': 'str' + } + + attribute_map = { + 'integration_types': 'integrationTypes', + 'integrations': 'integrations', + 'notify_on': 'notifyOn', + 'only_on_error': 'onlyOnError', + 'trigger_type': 'triggerType' + } + + def __init__(self, integration_types=None, integrations=None, notify_on=None, only_on_error=None, trigger_type=None): # noqa: E501 + """IntegrationLifecycleEventNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._integration_types = None + self._integrations = None + self._notify_on = None + self._only_on_error = None + self._trigger_type = None + self.discriminator = None + if integration_types is not None: + self.integration_types = integration_types + if integrations is not None: + self.integrations = integrations + if notify_on is not None: + self.notify_on = notify_on + if only_on_error is not None: + self.only_on_error = only_on_error + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def integration_types(self): + """Gets the integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._integration_types + + @integration_types.setter + def integration_types(self, integration_types): + """Sets the integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param integration_types: The integration_types of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["APACHE_PULSAR", "AWS_IOT", "AWS_KINESIS", "AWS_SQS", "AZURE_EVENT_HUB", "AZURE_IOT_HUB", "AZURE_SERVICE_BUS", "CHIRPSTACK", "COAP", "CUSTOM", "HTTP", "IBM_WATSON_IOT", "KAFKA", "LORIOT", "MQTT", "OCEANCONNECT", "OPC_UA", "PUB_SUB", "RABBITMQ", "SIGFOX", "TCP", "THINGPARK", "TMOBILE_IOT_CDP", "TPE", "TTI", "TTN", "TUYA", "UDP"] # noqa: E501 + if not set(integration_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `integration_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(integration_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._integration_types = integration_types + + @property + def integrations(self): + """Gets the integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._integrations + + @integrations.setter + def integrations(self, integrations): + """Sets the integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param integrations: The integrations of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._integrations = integrations + + @property + def notify_on(self): + """Gets the notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._notify_on + + @notify_on.setter + def notify_on(self, notify_on): + """Sets the notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param notify_on: The notify_on of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "FAILED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(notify_on).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `notify_on` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(notify_on) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._notify_on = notify_on + + @property + def only_on_error(self): + """Gets the only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_on_error + + @only_on_error.setter + def only_on_error(self, only_on_error): + """Sets the only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param only_on_error: The only_on_error of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_on_error = only_on_error + + @property + def trigger_type(self): + """Gets the trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this IntegrationLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(IntegrationLifecycleEventNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, IntegrationLifecycleEventNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/json_node.py b/tb-rest-client/python/tb_rest_client/models/models_pe/json_node.py new file mode 100644 index 0000000..a476292 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/json_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JsonNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """JsonNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/json_transport_payload_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/json_transport_payload_configuration.py new file mode 100644 index 0000000..dc88ec5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/json_transport_payload_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class JsonTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """JsonTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JsonTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JsonTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/jwt_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/jwt_settings.py new file mode 100644 index 0000000..b1af7ce --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/jwt_settings.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class JWTSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token_expiration_time': 'int', + 'refresh_token_exp_time': 'int', + 'token_issuer': 'str', + 'token_signing_key': 'str' + } + + attribute_map = { + 'token_expiration_time': 'tokenExpirationTime', + 'refresh_token_exp_time': 'refreshTokenExpTime', + 'token_issuer': 'tokenIssuer', + 'token_signing_key': 'tokenSigningKey' + } + + def __init__(self, token_expiration_time=None, refresh_token_exp_time=None, token_issuer=None, token_signing_key=None): # noqa: E501 + """JWTSettings - a model defined in Swagger""" # noqa: E501 + self._token_expiration_time = None + self._refresh_token_exp_time = None + self._token_issuer = None + self._token_signing_key = None + self.discriminator = None + if token_expiration_time is not None: + self.token_expiration_time = token_expiration_time + if refresh_token_exp_time is not None: + self.refresh_token_exp_time = refresh_token_exp_time + if token_issuer is not None: + self.token_issuer = token_issuer + if token_signing_key is not None: + self.token_signing_key = token_signing_key + + @property + def token_expiration_time(self): + """Gets the token_expiration_time of this JWTSettings. # noqa: E501 + + The JWT will expire after seconds. # noqa: E501 + + :return: The token_expiration_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._token_expiration_time + + @token_expiration_time.setter + def token_expiration_time(self, token_expiration_time): + """Sets the token_expiration_time of this JWTSettings. + + The JWT will expire after seconds. # noqa: E501 + + :param token_expiration_time: The token_expiration_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._token_expiration_time = token_expiration_time + + @property + def refresh_token_exp_time(self): + """Gets the refresh_token_exp_time of this JWTSettings. # noqa: E501 + + The JWT can be refreshed during seconds. # noqa: E501 + + :return: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :rtype: int + """ + return self._refresh_token_exp_time + + @refresh_token_exp_time.setter + def refresh_token_exp_time(self, refresh_token_exp_time): + """Sets the refresh_token_exp_time of this JWTSettings. + + The JWT can be refreshed during seconds. # noqa: E501 + + :param refresh_token_exp_time: The refresh_token_exp_time of this JWTSettings. # noqa: E501 + :type: int + """ + + self._refresh_token_exp_time = refresh_token_exp_time + + @property + def token_issuer(self): + """Gets the token_issuer of this JWTSettings. # noqa: E501 + + The JWT issuer. # noqa: E501 + + :return: The token_issuer of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_issuer + + @token_issuer.setter + def token_issuer(self, token_issuer): + """Sets the token_issuer of this JWTSettings. + + The JWT issuer. # noqa: E501 + + :param token_issuer: The token_issuer of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_issuer = token_issuer + + @property + def token_signing_key(self): + """Gets the token_signing_key of this JWTSettings. # noqa: E501 + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :return: The token_signing_key of this JWTSettings. # noqa: E501 + :rtype: str + """ + return self._token_signing_key + + @token_signing_key.setter + def token_signing_key(self, token_signing_key): + """Sets the token_signing_key of this JWTSettings. + + The JWT key is used to sing token. Base64 encoded. # noqa: E501 + + :param token_signing_key: The token_signing_key of this JWTSettings. # noqa: E501 + :type: str + """ + + self._token_signing_key = token_signing_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(JWTSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, JWTSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/key_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/key_filter.py new file mode 100644 index 0000000..b904bcd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/key_filter.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'EntityKey', + 'predicate': 'KeyFilterPredicate', + 'value_type': 'str' + } + + attribute_map = { + 'key': 'key', + 'predicate': 'predicate', + 'value_type': 'valueType' + } + + def __init__(self, key=None, predicate=None, value_type=None): # noqa: E501 + """KeyFilter - a model defined in Swagger""" # noqa: E501 + self._key = None + self._predicate = None + self._value_type = None + self.discriminator = None + if key is not None: + self.key = key + if predicate is not None: + self.predicate = predicate + if value_type is not None: + self.value_type = value_type + + @property + def key(self): + """Gets the key of this KeyFilter. # noqa: E501 + + + :return: The key of this KeyFilter. # noqa: E501 + :rtype: EntityKey + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this KeyFilter. + + + :param key: The key of this KeyFilter. # noqa: E501 + :type: EntityKey + """ + + self._key = key + + @property + def predicate(self): + """Gets the predicate of this KeyFilter. # noqa: E501 + + + :return: The predicate of this KeyFilter. # noqa: E501 + :rtype: KeyFilterPredicate + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this KeyFilter. + + + :param predicate: The predicate of this KeyFilter. # noqa: E501 + :type: KeyFilterPredicate + """ + + self._predicate = predicate + + @property + def value_type(self): + """Gets the value_type of this KeyFilter. # noqa: E501 + + + :return: The value_type of this KeyFilter. # noqa: E501 + :rtype: str + """ + return self._value_type + + @value_type.setter + def value_type(self, value_type): + """Sets the value_type of this KeyFilter. + + + :param value_type: The value_type of this KeyFilter. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DATE_TIME", "NUMERIC", "STRING"] # noqa: E501 + if value_type not in allowed_values: + raise ValueError( + "Invalid value for `value_type` ({0}), must be one of {1}" # noqa: E501 + .format(value_type, allowed_values) + ) + + self._value_type = value_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/key_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_pe/key_filter_predicate.py new file mode 100644 index 0000000..c03c5dd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/key_filter_predicate.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class KeyFilterPredicate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """KeyFilterPredicate - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(KeyFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, KeyFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/last_visited_dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/last_visited_dashboard_info.py new file mode 100644 index 0000000..7ea0a5b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/last_visited_dashboard_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LastVisitedDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred': 'bool', + 'last_visited': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred': 'starred', + 'last_visited': 'lastVisited' + } + + def __init__(self, id=None, title=None, starred=None, last_visited=None): # noqa: E501 + """LastVisitedDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred = None + self._last_visited = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred is not None: + self.starred = starred + if last_visited is not None: + self.last_visited = last_visited + + @property + def id(self): + """Gets the id of this LastVisitedDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LastVisitedDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this LastVisitedDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this LastVisitedDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this LastVisitedDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred(self): + """Gets the starred of this LastVisitedDashboardInfo. # noqa: E501 + + Starred flag # noqa: E501 + + :return: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: bool + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this LastVisitedDashboardInfo. + + Starred flag # noqa: E501 + + :param starred: The starred of this LastVisitedDashboardInfo. # noqa: E501 + :type: bool + """ + + self._starred = starred + + @property + def last_visited(self): + """Gets the last_visited of this LastVisitedDashboardInfo. # noqa: E501 + + Last visit timestamp # noqa: E501 + + :return: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._last_visited + + @last_visited.setter + def last_visited(self, last_visited): + """Sets the last_visited of this LastVisitedDashboardInfo. + + Last visit timestamp # noqa: E501 + + :param last_visited: The last_visited of this LastVisitedDashboardInfo. # noqa: E501 + :type: int + """ + + self._last_visited = last_visited + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LastVisitedDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LastVisitedDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/license_usage_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/license_usage_info.py new file mode 100644 index 0000000..5aa179f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/license_usage_info.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LicenseUsageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'assets_count': 'int', + 'dashboards_count': 'int', + 'development': 'bool', + 'devices_count': 'int', + 'integrations_count': 'int', + 'max_assets': 'int', + 'max_devices': 'int', + 'plan': 'str', + 'white_labeling_enabled': 'bool' + } + + attribute_map = { + 'assets_count': 'assetsCount', + 'dashboards_count': 'dashboardsCount', + 'development': 'development', + 'devices_count': 'devicesCount', + 'integrations_count': 'integrationsCount', + 'max_assets': 'maxAssets', + 'max_devices': 'maxDevices', + 'plan': 'plan', + 'white_labeling_enabled': 'whiteLabelingEnabled' + } + + def __init__(self, assets_count=None, dashboards_count=None, development=None, devices_count=None, integrations_count=None, max_assets=None, max_devices=None, plan=None, white_labeling_enabled=None): # noqa: E501 + """LicenseUsageInfo - a model defined in Swagger""" # noqa: E501 + self._assets_count = None + self._dashboards_count = None + self._development = None + self._devices_count = None + self._integrations_count = None + self._max_assets = None + self._max_devices = None + self._plan = None + self._white_labeling_enabled = None + self.discriminator = None + if assets_count is not None: + self.assets_count = assets_count + if dashboards_count is not None: + self.dashboards_count = dashboards_count + if development is not None: + self.development = development + if devices_count is not None: + self.devices_count = devices_count + if integrations_count is not None: + self.integrations_count = integrations_count + if max_assets is not None: + self.max_assets = max_assets + if max_devices is not None: + self.max_devices = max_devices + if plan is not None: + self.plan = plan + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + + @property + def assets_count(self): + """Gets the assets_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The assets_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._assets_count + + @assets_count.setter + def assets_count(self, assets_count): + """Sets the assets_count of this LicenseUsageInfo. + + + :param assets_count: The assets_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._assets_count = assets_count + + @property + def dashboards_count(self): + """Gets the dashboards_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The dashboards_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._dashboards_count + + @dashboards_count.setter + def dashboards_count(self, dashboards_count): + """Sets the dashboards_count of this LicenseUsageInfo. + + + :param dashboards_count: The dashboards_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._dashboards_count = dashboards_count + + @property + def development(self): + """Gets the development of this LicenseUsageInfo. # noqa: E501 + + + :return: The development of this LicenseUsageInfo. # noqa: E501 + :rtype: bool + """ + return self._development + + @development.setter + def development(self, development): + """Sets the development of this LicenseUsageInfo. + + + :param development: The development of this LicenseUsageInfo. # noqa: E501 + :type: bool + """ + + self._development = development + + @property + def devices_count(self): + """Gets the devices_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The devices_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._devices_count + + @devices_count.setter + def devices_count(self, devices_count): + """Sets the devices_count of this LicenseUsageInfo. + + + :param devices_count: The devices_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._devices_count = devices_count + + @property + def integrations_count(self): + """Gets the integrations_count of this LicenseUsageInfo. # noqa: E501 + + + :return: The integrations_count of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._integrations_count + + @integrations_count.setter + def integrations_count(self, integrations_count): + """Sets the integrations_count of this LicenseUsageInfo. + + + :param integrations_count: The integrations_count of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._integrations_count = integrations_count + + @property + def max_assets(self): + """Gets the max_assets of this LicenseUsageInfo. # noqa: E501 + + + :return: The max_assets of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_assets + + @max_assets.setter + def max_assets(self, max_assets): + """Sets the max_assets of this LicenseUsageInfo. + + + :param max_assets: The max_assets of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._max_assets = max_assets + + @property + def max_devices(self): + """Gets the max_devices of this LicenseUsageInfo. # noqa: E501 + + + :return: The max_devices of this LicenseUsageInfo. # noqa: E501 + :rtype: int + """ + return self._max_devices + + @max_devices.setter + def max_devices(self, max_devices): + """Sets the max_devices of this LicenseUsageInfo. + + + :param max_devices: The max_devices of this LicenseUsageInfo. # noqa: E501 + :type: int + """ + + self._max_devices = max_devices + + @property + def plan(self): + """Gets the plan of this LicenseUsageInfo. # noqa: E501 + + + :return: The plan of this LicenseUsageInfo. # noqa: E501 + :rtype: str + """ + return self._plan + + @plan.setter + def plan(self, plan): + """Sets the plan of this LicenseUsageInfo. + + + :param plan: The plan of this LicenseUsageInfo. # noqa: E501 + :type: str + """ + + self._plan = plan + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this LicenseUsageInfo. # noqa: E501 + + + :return: The white_labeling_enabled of this LicenseUsageInfo. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this LicenseUsageInfo. + + + :param white_labeling_enabled: The white_labeling_enabled of this LicenseUsageInfo. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LicenseUsageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LicenseUsageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/life_cycle_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/life_cycle_event_filter.py new file mode 100644 index 0000000..e66f7f1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/life_cycle_event_filter.py @@ -0,0 +1,283 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class LifeCycleEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'event': 'str', + 'status': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'event': 'event', + 'status': 'status', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, event=None, status=None, error_str=None, *args, **kwargs): # noqa: E501 + """LifeCycleEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._event = None + self._status = None + self._error_str = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if event is not None: + self.event = event + if status is not None: + self.status = status + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this LifeCycleEventFilter. # noqa: E501 + + + :return: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this LifeCycleEventFilter. + + + :param not_empty: The not_empty of this LifeCycleEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this LifeCycleEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this LifeCycleEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this LifeCycleEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this LifeCycleEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def event(self): + """Gets the event of this LifeCycleEventFilter. # noqa: E501 + + String value representing the lifecycle event type # noqa: E501 + + :return: The event of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._event + + @event.setter + def event(self, event): + """Sets the event of this LifeCycleEventFilter. + + String value representing the lifecycle event type # noqa: E501 + + :param event: The event of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._event = event + + @property + def status(self): + """Gets the status of this LifeCycleEventFilter. # noqa: E501 + + String value representing status of the lifecycle event # noqa: E501 + + :return: The status of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this LifeCycleEventFilter. + + String value representing status of the lifecycle event # noqa: E501 + + :param status: The status of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["Failure", "Success"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def error_str(self): + """Gets the error_str of this LifeCycleEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this LifeCycleEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this LifeCycleEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this LifeCycleEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LifeCycleEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LifeCycleEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/login_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/login_request.py new file mode 100644 index 0000000..75bddca --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/login_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'username': 'str', + 'password': 'str' + } + + attribute_map = { + 'username': 'username', + 'password': 'password' + } + + def __init__(self, username=None, password=None): # noqa: E501 + """LoginRequest - a model defined in Swagger""" # noqa: E501 + self._username = None + self._password = None + self.discriminator = None + self.username = username + self.password = password + + @property + def username(self): + """Gets the username of this LoginRequest. # noqa: E501 + + User email # noqa: E501 + + :return: The username of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this LoginRequest. + + User email # noqa: E501 + + :param username: The username of this LoginRequest. # noqa: E501 + :type: str + """ + if username is None: + raise ValueError("Invalid value for `username`, must not be `None`") # noqa: E501 + + self._username = username + + @property + def password(self): + """Gets the password of this LoginRequest. # noqa: E501 + + User password # noqa: E501 + + :return: The password of this LoginRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this LoginRequest. + + User password # noqa: E501 + + :param password: The password of this LoginRequest. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/login_response.py b/tb-rest-client/python/tb_rest_client/models/models_pe/login_response.py new file mode 100644 index 0000000..ee50016 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/login_response.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'token': 'str', + 'refresh_token': 'str' + } + + attribute_map = { + 'token': 'token', + 'refresh_token': 'refreshToken' + } + + def __init__(self, token=None, refresh_token=None): # noqa: E501 + """LoginResponse - a model defined in Swagger""" # noqa: E501 + self._token = None + self._refresh_token = None + self.discriminator = None + self.token = token + self.refresh_token = refresh_token + + @property + def token(self): + """Gets the token of this LoginResponse. # noqa: E501 + + JWT token # noqa: E501 + + :return: The token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._token + + @token.setter + def token(self, token): + """Sets the token of this LoginResponse. + + JWT token # noqa: E501 + + :param token: The token of this LoginResponse. # noqa: E501 + :type: str + """ + if token is None: + raise ValueError("Invalid value for `token`, must not be `None`") # noqa: E501 + + self._token = token + + @property + def refresh_token(self): + """Gets the refresh_token of this LoginResponse. # noqa: E501 + + Refresh token # noqa: E501 + + :return: The refresh_token of this LoginResponse. # noqa: E501 + :rtype: str + """ + return self._refresh_token + + @refresh_token.setter + def refresh_token(self, refresh_token): + """Sets the refresh_token of this LoginResponse. + + Refresh token # noqa: E501 + + :param refresh_token: The refresh_token of this LoginResponse. # noqa: E501 + :type: str + """ + if refresh_token is None: + raise ValueError("Invalid value for `refresh_token`, must not be `None`") # noqa: E501 + + self._refresh_token = refresh_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/login_white_labeling_params.py b/tb-rest-client/python/tb_rest_client/models/models_pe/login_white_labeling_params.py new file mode 100644 index 0000000..129c308 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/login_white_labeling_params.py @@ -0,0 +1,710 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LoginWhiteLabelingParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'logo_image_url': 'str', + 'logo_image_checksum': 'str', + 'logo_image_height': 'int', + 'app_title': 'str', + 'favicon': 'Favicon', + 'favicon_checksum': 'str', + 'palette_settings': 'PaletteSettings', + 'help_link_base_url': 'str', + 'ui_help_base_url': 'str', + 'enable_help_links': 'bool', + 'white_labeling_enabled': 'bool', + 'show_name_version': 'bool', + 'platform_name': 'str', + 'platform_version': 'str', + 'custom_css': 'str', + 'page_background_color': 'str', + 'dark_foreground': 'bool', + 'domain_name': 'str', + 'base_url': 'str', + 'prohibit_different_url': 'bool', + 'admin_settings_id': 'str', + 'show_name_bottom': 'bool' + } + + attribute_map = { + 'logo_image_url': 'logoImageUrl', + 'logo_image_checksum': 'logoImageChecksum', + 'logo_image_height': 'logoImageHeight', + 'app_title': 'appTitle', + 'favicon': 'favicon', + 'favicon_checksum': 'faviconChecksum', + 'palette_settings': 'paletteSettings', + 'help_link_base_url': 'helpLinkBaseUrl', + 'ui_help_base_url': 'uiHelpBaseUrl', + 'enable_help_links': 'enableHelpLinks', + 'white_labeling_enabled': 'whiteLabelingEnabled', + 'show_name_version': 'showNameVersion', + 'platform_name': 'platformName', + 'platform_version': 'platformVersion', + 'custom_css': 'customCss', + 'page_background_color': 'pageBackgroundColor', + 'dark_foreground': 'darkForeground', + 'domain_name': 'domainName', + 'base_url': 'baseUrl', + 'prohibit_different_url': 'prohibitDifferentUrl', + 'admin_settings_id': 'adminSettingsId', + 'show_name_bottom': 'showNameBottom' + } + + def __init__(self, logo_image_url=None, logo_image_checksum=None, logo_image_height=None, app_title=None, favicon=None, favicon_checksum=None, palette_settings=None, help_link_base_url=None, ui_help_base_url=None, enable_help_links=None, white_labeling_enabled=None, show_name_version=None, platform_name=None, platform_version=None, custom_css=None, page_background_color=None, dark_foreground=None, domain_name=None, base_url=None, prohibit_different_url=None, admin_settings_id=None, show_name_bottom=None): # noqa: E501 + """LoginWhiteLabelingParams - a model defined in Swagger""" # noqa: E501 + self._logo_image_url = None + self._logo_image_checksum = None + self._logo_image_height = None + self._app_title = None + self._favicon = None + self._favicon_checksum = None + self._palette_settings = None + self._help_link_base_url = None + self._ui_help_base_url = None + self._enable_help_links = None + self._white_labeling_enabled = None + self._show_name_version = None + self._platform_name = None + self._platform_version = None + self._custom_css = None + self._page_background_color = None + self._dark_foreground = None + self._domain_name = None + self._base_url = None + self._prohibit_different_url = None + self._admin_settings_id = None + self._show_name_bottom = None + self.discriminator = None + if logo_image_url is not None: + self.logo_image_url = logo_image_url + if logo_image_checksum is not None: + self.logo_image_checksum = logo_image_checksum + if logo_image_height is not None: + self.logo_image_height = logo_image_height + if app_title is not None: + self.app_title = app_title + if favicon is not None: + self.favicon = favicon + if favicon_checksum is not None: + self.favicon_checksum = favicon_checksum + if palette_settings is not None: + self.palette_settings = palette_settings + if help_link_base_url is not None: + self.help_link_base_url = help_link_base_url + if ui_help_base_url is not None: + self.ui_help_base_url = ui_help_base_url + if enable_help_links is not None: + self.enable_help_links = enable_help_links + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + if show_name_version is not None: + self.show_name_version = show_name_version + if platform_name is not None: + self.platform_name = platform_name + if platform_version is not None: + self.platform_version = platform_version + if custom_css is not None: + self.custom_css = custom_css + if page_background_color is not None: + self.page_background_color = page_background_color + if dark_foreground is not None: + self.dark_foreground = dark_foreground + if domain_name is not None: + self.domain_name = domain_name + if base_url is not None: + self.base_url = base_url + if prohibit_different_url is not None: + self.prohibit_different_url = prohibit_different_url + if admin_settings_id is not None: + self.admin_settings_id = admin_settings_id + if show_name_bottom is not None: + self.show_name_bottom = show_name_bottom + + @property + def logo_image_url(self): + """Gets the logo_image_url of this LoginWhiteLabelingParams. # noqa: E501 + + Logo image URL # noqa: E501 + + :return: The logo_image_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_url + + @logo_image_url.setter + def logo_image_url(self, logo_image_url): + """Sets the logo_image_url of this LoginWhiteLabelingParams. + + Logo image URL # noqa: E501 + + :param logo_image_url: The logo_image_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_url = logo_image_url + + @property + def logo_image_checksum(self): + """Gets the logo_image_checksum of this LoginWhiteLabelingParams. # noqa: E501 + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :return: The logo_image_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_checksum + + @logo_image_checksum.setter + def logo_image_checksum(self, logo_image_checksum): + """Sets the logo_image_checksum of this LoginWhiteLabelingParams. + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :param logo_image_checksum: The logo_image_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_checksum = logo_image_checksum + + @property + def logo_image_height(self): + """Gets the logo_image_height of this LoginWhiteLabelingParams. # noqa: E501 + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :return: The logo_image_height of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: int + """ + return self._logo_image_height + + @logo_image_height.setter + def logo_image_height(self, logo_image_height): + """Sets the logo_image_height of this LoginWhiteLabelingParams. + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :param logo_image_height: The logo_image_height of this LoginWhiteLabelingParams. # noqa: E501 + :type: int + """ + + self._logo_image_height = logo_image_height + + @property + def app_title(self): + """Gets the app_title of this LoginWhiteLabelingParams. # noqa: E501 + + White-labeled name of the platform # noqa: E501 + + :return: The app_title of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._app_title + + @app_title.setter + def app_title(self, app_title): + """Sets the app_title of this LoginWhiteLabelingParams. + + White-labeled name of the platform # noqa: E501 + + :param app_title: The app_title of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._app_title = app_title + + @property + def favicon(self): + """Gets the favicon of this LoginWhiteLabelingParams. # noqa: E501 + + + :return: The favicon of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: Favicon + """ + return self._favicon + + @favicon.setter + def favicon(self, favicon): + """Sets the favicon of this LoginWhiteLabelingParams. + + + :param favicon: The favicon of this LoginWhiteLabelingParams. # noqa: E501 + :type: Favicon + """ + + self._favicon = favicon + + @property + def favicon_checksum(self): + """Gets the favicon_checksum of this LoginWhiteLabelingParams. # noqa: E501 + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :return: The favicon_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._favicon_checksum + + @favicon_checksum.setter + def favicon_checksum(self, favicon_checksum): + """Sets the favicon_checksum of this LoginWhiteLabelingParams. + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :param favicon_checksum: The favicon_checksum of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._favicon_checksum = favicon_checksum + + @property + def palette_settings(self): + """Gets the palette_settings of this LoginWhiteLabelingParams. # noqa: E501 + + + :return: The palette_settings of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: PaletteSettings + """ + return self._palette_settings + + @palette_settings.setter + def palette_settings(self, palette_settings): + """Sets the palette_settings of this LoginWhiteLabelingParams. + + + :param palette_settings: The palette_settings of this LoginWhiteLabelingParams. # noqa: E501 + :type: PaletteSettings + """ + + self._palette_settings = palette_settings + + @property + def help_link_base_url(self): + """Gets the help_link_base_url of this LoginWhiteLabelingParams. # noqa: E501 + + Base URL for help link # noqa: E501 + + :return: The help_link_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._help_link_base_url + + @help_link_base_url.setter + def help_link_base_url(self, help_link_base_url): + """Sets the help_link_base_url of this LoginWhiteLabelingParams. + + Base URL for help link # noqa: E501 + + :param help_link_base_url: The help_link_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._help_link_base_url = help_link_base_url + + @property + def ui_help_base_url(self): + """Gets the ui_help_base_url of this LoginWhiteLabelingParams. # noqa: E501 + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :return: The ui_help_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._ui_help_base_url + + @ui_help_base_url.setter + def ui_help_base_url(self, ui_help_base_url): + """Sets the ui_help_base_url of this LoginWhiteLabelingParams. + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :param ui_help_base_url: The ui_help_base_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._ui_help_base_url = ui_help_base_url + + @property + def enable_help_links(self): + """Gets the enable_help_links of this LoginWhiteLabelingParams. # noqa: E501 + + Enable or Disable help links # noqa: E501 + + :return: The enable_help_links of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._enable_help_links + + @enable_help_links.setter + def enable_help_links(self, enable_help_links): + """Sets the enable_help_links of this LoginWhiteLabelingParams. + + Enable or Disable help links # noqa: E501 + + :param enable_help_links: The enable_help_links of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._enable_help_links = enable_help_links + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this LoginWhiteLabelingParams. # noqa: E501 + + Enable white-labeling # noqa: E501 + + :return: The white_labeling_enabled of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this LoginWhiteLabelingParams. + + Enable white-labeling # noqa: E501 + + :param white_labeling_enabled: The white_labeling_enabled of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + @property + def show_name_version(self): + """Gets the show_name_version of this LoginWhiteLabelingParams. # noqa: E501 + + Show platform name and version on UI and login screen # noqa: E501 + + :return: The show_name_version of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._show_name_version + + @show_name_version.setter + def show_name_version(self, show_name_version): + """Sets the show_name_version of this LoginWhiteLabelingParams. + + Show platform name and version on UI and login screen # noqa: E501 + + :param show_name_version: The show_name_version of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._show_name_version = show_name_version + + @property + def platform_name(self): + """Gets the platform_name of this LoginWhiteLabelingParams. # noqa: E501 + + White-labeled platform name # noqa: E501 + + :return: The platform_name of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_name + + @platform_name.setter + def platform_name(self, platform_name): + """Sets the platform_name of this LoginWhiteLabelingParams. + + White-labeled platform name # noqa: E501 + + :param platform_name: The platform_name of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_name = platform_name + + @property + def platform_version(self): + """Gets the platform_version of this LoginWhiteLabelingParams. # noqa: E501 + + White-labeled platform version # noqa: E501 + + :return: The platform_version of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_version + + @platform_version.setter + def platform_version(self, platform_version): + """Sets the platform_version of this LoginWhiteLabelingParams. + + White-labeled platform version # noqa: E501 + + :param platform_version: The platform_version of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_version = platform_version + + @property + def custom_css(self): + """Gets the custom_css of this LoginWhiteLabelingParams. # noqa: E501 + + Custom CSS content # noqa: E501 + + :return: The custom_css of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._custom_css + + @custom_css.setter + def custom_css(self, custom_css): + """Sets the custom_css of this LoginWhiteLabelingParams. + + Custom CSS content # noqa: E501 + + :param custom_css: The custom_css of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._custom_css = custom_css + + @property + def page_background_color(self): + """Gets the page_background_color of this LoginWhiteLabelingParams. # noqa: E501 + + Login page background color # noqa: E501 + + :return: The page_background_color of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._page_background_color + + @page_background_color.setter + def page_background_color(self, page_background_color): + """Sets the page_background_color of this LoginWhiteLabelingParams. + + Login page background color # noqa: E501 + + :param page_background_color: The page_background_color of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._page_background_color = page_background_color + + @property + def dark_foreground(self): + """Gets the dark_foreground of this LoginWhiteLabelingParams. # noqa: E501 + + Enable/Disable dark foreground # noqa: E501 + + :return: The dark_foreground of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._dark_foreground + + @dark_foreground.setter + def dark_foreground(self, dark_foreground): + """Sets the dark_foreground of this LoginWhiteLabelingParams. + + Enable/Disable dark foreground # noqa: E501 + + :param dark_foreground: The dark_foreground of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._dark_foreground = dark_foreground + + @property + def domain_name(self): + """Gets the domain_name of this LoginWhiteLabelingParams. # noqa: E501 + + Domain name of the login page # noqa: E501 + + :return: The domain_name of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._domain_name + + @domain_name.setter + def domain_name(self, domain_name): + """Sets the domain_name of this LoginWhiteLabelingParams. + + Domain name of the login page # noqa: E501 + + :param domain_name: The domain_name of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._domain_name = domain_name + + @property + def base_url(self): + """Gets the base_url of this LoginWhiteLabelingParams. # noqa: E501 + + Base URL for the activation link, etc # noqa: E501 + + :return: The base_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._base_url + + @base_url.setter + def base_url(self, base_url): + """Sets the base_url of this LoginWhiteLabelingParams. + + Base URL for the activation link, etc # noqa: E501 + + :param base_url: The base_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._base_url = base_url + + @property + def prohibit_different_url(self): + """Gets the prohibit_different_url of this LoginWhiteLabelingParams. # noqa: E501 + + Prohibit use of other URLs. It is recommended to enable this setting # noqa: E501 + + :return: The prohibit_different_url of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._prohibit_different_url + + @prohibit_different_url.setter + def prohibit_different_url(self, prohibit_different_url): + """Sets the prohibit_different_url of this LoginWhiteLabelingParams. + + Prohibit use of other URLs. It is recommended to enable this setting # noqa: E501 + + :param prohibit_different_url: The prohibit_different_url of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._prohibit_different_url = prohibit_different_url + + @property + def admin_settings_id(self): + """Gets the admin_settings_id of this LoginWhiteLabelingParams. # noqa: E501 + + Id of the settings object that store this parameters # noqa: E501 + + :return: The admin_settings_id of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._admin_settings_id + + @admin_settings_id.setter + def admin_settings_id(self, admin_settings_id): + """Sets the admin_settings_id of this LoginWhiteLabelingParams. + + Id of the settings object that store this parameters # noqa: E501 + + :param admin_settings_id: The admin_settings_id of this LoginWhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._admin_settings_id = admin_settings_id + + @property + def show_name_bottom(self): + """Gets the show_name_bottom of this LoginWhiteLabelingParams. # noqa: E501 + + Show platform name and version on login page # noqa: E501 + + :return: The show_name_bottom of this LoginWhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._show_name_bottom + + @show_name_bottom.setter + def show_name_bottom(self, show_name_bottom): + """Sets the show_name_bottom of this LoginWhiteLabelingParams. + + Show platform name and version on login page # noqa: E501 + + :param show_name_bottom: The show_name_bottom of this LoginWhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._show_name_bottom = show_name_bottom + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LoginWhiteLabelingParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LoginWhiteLabelingParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..7ec3448 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2_m_server_security_config_default.py b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2_m_server_security_config_default.py new file mode 100644 index 0000000..31e06fc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2_m_server_security_config_default.py @@ -0,0 +1,490 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2MServerSecurityConfigDefault(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, security_host=None, security_port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """LwM2MServerSecurityConfigDefault - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this LwM2MServerSecurityConfigDefault. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this LwM2MServerSecurityConfigDefault. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this LwM2MServerSecurityConfigDefault. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this LwM2MServerSecurityConfigDefault. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Host for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this LwM2MServerSecurityConfigDefault. + + Host for 'Security' mode (DTLS) # noqa: E501 + + :param security_host: The security_host of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this LwM2MServerSecurityConfigDefault. + + Port for 'Security' mode (DTLS): Lwm2m Server or Bootstrap Server # noqa: E501 + + :param security_port: The security_port of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this LwM2MServerSecurityConfigDefault. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this LwM2MServerSecurityConfigDefault. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this LwM2MServerSecurityConfigDefault. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this LwM2MServerSecurityConfigDefault. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this LwM2MServerSecurityConfigDefault. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this LwM2MServerSecurityConfigDefault. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this LwM2MServerSecurityConfigDefault. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2MServerSecurityConfigDefault, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2MServerSecurityConfigDefault): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_instance.py b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_instance.py new file mode 100644 index 0000000..fafd5c0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_instance.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mInstance(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'resources': 'list[LwM2mResourceObserve]' + } + + attribute_map = { + 'id': 'id', + 'resources': 'resources' + } + + def __init__(self, id=None, resources=None): # noqa: E501 + """LwM2mInstance - a model defined in Swagger""" # noqa: E501 + self._id = None + self._resources = None + self.discriminator = None + if id is not None: + self.id = id + if resources is not None: + self.resources = resources + + @property + def id(self): + """Gets the id of this LwM2mInstance. # noqa: E501 + + LwM2M Instance id. # noqa: E501 + + :return: The id of this LwM2mInstance. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mInstance. + + LwM2M Instance id. # noqa: E501 + + :param id: The id of this LwM2mInstance. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def resources(self): + """Gets the resources of this LwM2mInstance. # noqa: E501 + + LwM2M Resource observe. # noqa: E501 + + :return: The resources of this LwM2mInstance. # noqa: E501 + :rtype: list[LwM2mResourceObserve] + """ + return self._resources + + @resources.setter + def resources(self, resources): + """Sets the resources of this LwM2mInstance. + + LwM2M Resource observe. # noqa: E501 + + :param resources: The resources of this LwM2mInstance. # noqa: E501 + :type: list[LwM2mResourceObserve] + """ + + self._resources = resources + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mInstance, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mInstance): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_object.py b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_object.py new file mode 100644 index 0000000..177b339 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_object.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mObject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'key_id': 'str', + 'name': 'str', + 'multiple': 'bool', + 'mandatory': 'bool', + 'instances': 'list[LwM2mInstance]' + } + + attribute_map = { + 'id': 'id', + 'key_id': 'keyId', + 'name': 'name', + 'multiple': 'multiple', + 'mandatory': 'mandatory', + 'instances': 'instances' + } + + def __init__(self, id=None, key_id=None, name=None, multiple=None, mandatory=None, instances=None): # noqa: E501 + """LwM2mObject - a model defined in Swagger""" # noqa: E501 + self._id = None + self._key_id = None + self._name = None + self._multiple = None + self._mandatory = None + self._instances = None + self.discriminator = None + if id is not None: + self.id = id + if key_id is not None: + self.key_id = key_id + if name is not None: + self.name = name + if multiple is not None: + self.multiple = multiple + if mandatory is not None: + self.mandatory = mandatory + if instances is not None: + self.instances = instances + + @property + def id(self): + """Gets the id of this LwM2mObject. # noqa: E501 + + LwM2M Object id. # noqa: E501 + + :return: The id of this LwM2mObject. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mObject. + + LwM2M Object id. # noqa: E501 + + :param id: The id of this LwM2mObject. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def key_id(self): + """Gets the key_id of this LwM2mObject. # noqa: E501 + + LwM2M Object key id. # noqa: E501 + + :return: The key_id of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._key_id + + @key_id.setter + def key_id(self, key_id): + """Sets the key_id of this LwM2mObject. + + LwM2M Object key id. # noqa: E501 + + :param key_id: The key_id of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._key_id = key_id + + @property + def name(self): + """Gets the name of this LwM2mObject. # noqa: E501 + + LwM2M Object name. # noqa: E501 + + :return: The name of this LwM2mObject. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mObject. + + LwM2M Object name. # noqa: E501 + + :param name: The name of this LwM2mObject. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def multiple(self): + """Gets the multiple of this LwM2mObject. # noqa: E501 + + LwM2M Object multiple. # noqa: E501 + + :return: The multiple of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._multiple + + @multiple.setter + def multiple(self, multiple): + """Sets the multiple of this LwM2mObject. + + LwM2M Object multiple. # noqa: E501 + + :param multiple: The multiple of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._multiple = multiple + + @property + def mandatory(self): + """Gets the mandatory of this LwM2mObject. # noqa: E501 + + LwM2M Object mandatory. # noqa: E501 + + :return: The mandatory of this LwM2mObject. # noqa: E501 + :rtype: bool + """ + return self._mandatory + + @mandatory.setter + def mandatory(self, mandatory): + """Sets the mandatory of this LwM2mObject. + + LwM2M Object mandatory. # noqa: E501 + + :param mandatory: The mandatory of this LwM2mObject. # noqa: E501 + :type: bool + """ + + self._mandatory = mandatory + + @property + def instances(self): + """Gets the instances of this LwM2mObject. # noqa: E501 + + LwM2M Object instances. # noqa: E501 + + :return: The instances of this LwM2mObject. # noqa: E501 + :rtype: list[LwM2mInstance] + """ + return self._instances + + @instances.setter + def instances(self, instances): + """Sets the instances of this LwM2mObject. + + LwM2M Object instances. # noqa: E501 + + :param instances: The instances of this LwM2mObject. # noqa: E501 + :type: list[LwM2mInstance] + """ + + self._instances = instances + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mObject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mObject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_resource_observe.py b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_resource_observe.py new file mode 100644 index 0000000..9cbee35 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/lw_m2m_resource_observe.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class LwM2mResourceObserve(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'int', + 'name': 'str', + 'observe': 'bool', + 'attribute': 'bool', + 'telemetry': 'bool', + 'key_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'observe': 'observe', + 'attribute': 'attribute', + 'telemetry': 'telemetry', + 'key_name': 'keyName' + } + + def __init__(self, id=None, name=None, observe=None, attribute=None, telemetry=None, key_name=None): # noqa: E501 + """LwM2mResourceObserve - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._observe = None + self._attribute = None + self._telemetry = None + self._key_name = None + self.discriminator = None + if id is not None: + self.id = id + if name is not None: + self.name = name + if observe is not None: + self.observe = observe + if attribute is not None: + self.attribute = attribute + if telemetry is not None: + self.telemetry = telemetry + if key_name is not None: + self.key_name = key_name + + @property + def id(self): + """Gets the id of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe id. # noqa: E501 + + :return: The id of this LwM2mResourceObserve. # noqa: E501 + :rtype: int + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this LwM2mResourceObserve. + + LwM2M Resource Observe id. # noqa: E501 + + :param id: The id of this LwM2mResourceObserve. # noqa: E501 + :type: int + """ + + self._id = id + + @property + def name(self): + """Gets the name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe name. # noqa: E501 + + :return: The name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this LwM2mResourceObserve. + + LwM2M Resource Observe name. # noqa: E501 + + :param name: The name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def observe(self): + """Gets the observe of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe observe. # noqa: E501 + + :return: The observe of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this LwM2mResourceObserve. + + LwM2M Resource Observe observe. # noqa: E501 + + :param observe: The observe of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._observe = observe + + @property + def attribute(self): + """Gets the attribute of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe attribute. # noqa: E501 + + :return: The attribute of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this LwM2mResourceObserve. + + LwM2M Resource Observe attribute. # noqa: E501 + + :param attribute: The attribute of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._attribute = attribute + + @property + def telemetry(self): + """Gets the telemetry of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe telemetry. # noqa: E501 + + :return: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :rtype: bool + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this LwM2mResourceObserve. + + LwM2M Resource Observe telemetry. # noqa: E501 + + :param telemetry: The telemetry of this LwM2mResourceObserve. # noqa: E501 + :type: bool + """ + + self._telemetry = telemetry + + @property + def key_name(self): + """Gets the key_name of this LwM2mResourceObserve. # noqa: E501 + + LwM2M Resource Observe key name. # noqa: E501 + + :return: The key_name of this LwM2mResourceObserve. # noqa: E501 + :rtype: str + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this LwM2mResourceObserve. + + LwM2M Resource Observe key name. # noqa: E501 + + :param key_name: The key_name of this LwM2mResourceObserve. # noqa: E501 + :type: str + """ + + self._key_name = key_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(LwM2mResourceObserve, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, LwM2mResourceObserve): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/lwm2m_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/lwm2m_device_profile_transport_configuration.py new file mode 100644 index 0000000..08f1932 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/lwm2m_device_profile_transport_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap': 'list[LwM2MBootstrapServerCredential]', + 'bootstrap_server_update_enable': 'bool', + 'client_lw_m2m_settings': 'OtherConfiguration', + 'observe_attr': 'TelemetryMappingConfiguration' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'bootstrap': 'bootstrap', + 'bootstrap_server_update_enable': 'bootstrapServerUpdateEnable', + 'client_lw_m2m_settings': 'clientLwM2mSettings', + 'observe_attr': 'observeAttr' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, bootstrap=None, bootstrap_server_update_enable=None, client_lw_m2m_settings=None, observe_attr=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._bootstrap = None + self._bootstrap_server_update_enable = None + self._client_lw_m2m_settings = None + self._observe_attr = None + self.discriminator = None + if bootstrap is not None: + self.bootstrap = bootstrap + if bootstrap_server_update_enable is not None: + self.bootstrap_server_update_enable = bootstrap_server_update_enable + if client_lw_m2m_settings is not None: + self.client_lw_m2m_settings = client_lw_m2m_settings + if observe_attr is not None: + self.observe_attr = observe_attr + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def bootstrap(self): + """Gets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[LwM2MBootstrapServerCredential] + """ + return self._bootstrap + + @bootstrap.setter + def bootstrap(self, bootstrap): + """Sets the bootstrap of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap: The bootstrap of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[LwM2MBootstrapServerCredential] + """ + + self._bootstrap = bootstrap + + @property + def bootstrap_server_update_enable(self): + """Gets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_update_enable + + @bootstrap_server_update_enable.setter + def bootstrap_server_update_enable(self, bootstrap_server_update_enable): + """Sets the bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. + + + :param bootstrap_server_update_enable: The bootstrap_server_update_enable of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_update_enable = bootstrap_server_update_enable + + @property + def client_lw_m2m_settings(self): + """Gets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: OtherConfiguration + """ + return self._client_lw_m2m_settings + + @client_lw_m2m_settings.setter + def client_lw_m2m_settings(self, client_lw_m2m_settings): + """Sets the client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. + + + :param client_lw_m2m_settings: The client_lw_m2m_settings of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: OtherConfiguration + """ + + self._client_lw_m2m_settings = client_lw_m2m_settings + + @property + def observe_attr(self): + """Gets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TelemetryMappingConfiguration + """ + return self._observe_attr + + @observe_attr.setter + def observe_attr(self, observe_attr): + """Sets the observe_attr of this Lwm2mDeviceProfileTransportConfiguration. + + + :param observe_attr: The observe_attr of this Lwm2mDeviceProfileTransportConfiguration. # noqa: E501 + :type: TelemetryMappingConfiguration + """ + + self._observe_attr = observe_attr + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/lwm2m_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/lwm2m_device_transport_configuration.py new file mode 100644 index 0000000..374377f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/lwm2m_device_transport_configuration.py @@ -0,0 +1,214 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class Lwm2mDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, *args, **kwargs): # noqa: E501 + """Lwm2mDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this Lwm2mDeviceTransportConfiguration. + + + :param edrx_cycle: The edrx_cycle of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this Lwm2mDeviceTransportConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this Lwm2mDeviceTransportConfiguration. + + + :param power_mode: The power_mode of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this Lwm2mDeviceTransportConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this Lwm2mDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Lwm2mDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Lwm2mDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/mapping.py b/tb-rest-client/python/tb_rest_client/models/models_pe/mapping.py new file mode 100644 index 0000000..5435a36 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/mapping.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Mapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'columns': 'list[ColumnMapping]', + 'delimiter': 'str', + 'header': 'bool', + 'update': 'bool' + } + + attribute_map = { + 'columns': 'columns', + 'delimiter': 'delimiter', + 'header': 'header', + 'update': 'update' + } + + def __init__(self, columns=None, delimiter=None, header=None, update=None): # noqa: E501 + """Mapping - a model defined in Swagger""" # noqa: E501 + self._columns = None + self._delimiter = None + self._header = None + self._update = None + self.discriminator = None + if columns is not None: + self.columns = columns + if delimiter is not None: + self.delimiter = delimiter + if header is not None: + self.header = header + if update is not None: + self.update = update + + @property + def columns(self): + """Gets the columns of this Mapping. # noqa: E501 + + + :return: The columns of this Mapping. # noqa: E501 + :rtype: list[ColumnMapping] + """ + return self._columns + + @columns.setter + def columns(self, columns): + """Sets the columns of this Mapping. + + + :param columns: The columns of this Mapping. # noqa: E501 + :type: list[ColumnMapping] + """ + + self._columns = columns + + @property + def delimiter(self): + """Gets the delimiter of this Mapping. # noqa: E501 + + + :return: The delimiter of this Mapping. # noqa: E501 + :rtype: str + """ + return self._delimiter + + @delimiter.setter + def delimiter(self, delimiter): + """Sets the delimiter of this Mapping. + + + :param delimiter: The delimiter of this Mapping. # noqa: E501 + :type: str + """ + + self._delimiter = delimiter + + @property + def header(self): + """Gets the header of this Mapping. # noqa: E501 + + + :return: The header of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._header + + @header.setter + def header(self, header): + """Sets the header of this Mapping. + + + :param header: The header of this Mapping. # noqa: E501 + :type: bool + """ + + self._header = header + + @property + def update(self): + """Gets the update of this Mapping. # noqa: E501 + + + :return: The update of this Mapping. # noqa: E501 + :rtype: bool + """ + return self._update + + @update.setter + def update(self, update): + """Sets the update of this Mapping. + + + :param update: The update of this Mapping. # noqa: E501 + :type: bool + """ + + self._update = update + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Mapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Mapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/merged_group_permission_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/merged_group_permission_info.py new file mode 100644 index 0000000..67d5839 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/merged_group_permission_info.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MergedGroupPermissionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'entity_type': 'str', + 'operations': 'list[str]' + } + + attribute_map = { + 'entity_type': 'entityType', + 'operations': 'operations' + } + + def __init__(self, entity_type=None, operations=None): # noqa: E501 + """MergedGroupPermissionInfo - a model defined in Swagger""" # noqa: E501 + self._entity_type = None + self._operations = None + self.discriminator = None + if entity_type is not None: + self.entity_type = entity_type + if operations is not None: + self.operations = operations + + @property + def entity_type(self): + """Gets the entity_type of this MergedGroupPermissionInfo. # noqa: E501 + + + :return: The entity_type of this MergedGroupPermissionInfo. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this MergedGroupPermissionInfo. + + + :param entity_type: The entity_type of this MergedGroupPermissionInfo. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def operations(self): + """Gets the operations of this MergedGroupPermissionInfo. # noqa: E501 + + + :return: The operations of this MergedGroupPermissionInfo. # noqa: E501 + :rtype: list[str] + """ + return self._operations + + @operations.setter + def operations(self, operations): + """Sets the operations of this MergedGroupPermissionInfo. + + + :param operations: The operations of this MergedGroupPermissionInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ADD_TO_GROUP", "ALL", "ASSIGN_TO_TENANT", "CHANGE_OWNER", "CLAIM_DEVICES", "CREATE", "DELETE", "IMPERSONATE", "READ", "READ_ATTRIBUTES", "READ_CREDENTIALS", "READ_TELEMETRY", "REMOVE_FROM_GROUP", "RPC_CALL", "SHARE_GROUP", "WRITE", "WRITE_ATTRIBUTES", "WRITE_CREDENTIALS", "WRITE_TELEMETRY"] # noqa: E501 + if not set(operations).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `operations` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(operations) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._operations = operations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MergedGroupPermissionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MergedGroupPermissionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/merged_group_type_permission_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/merged_group_type_permission_info.py new file mode 100644 index 0000000..9a03462 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/merged_group_type_permission_info.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MergedGroupTypePermissionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'has_generic_read': 'bool', + 'entity_group_ids': 'list[EntityGroupId]' + } + + attribute_map = { + 'has_generic_read': 'hasGenericRead', + 'entity_group_ids': 'entityGroupIds' + } + + def __init__(self, has_generic_read=None, entity_group_ids=None): # noqa: E501 + """MergedGroupTypePermissionInfo - a model defined in Swagger""" # noqa: E501 + self._has_generic_read = None + self._entity_group_ids = None + self.discriminator = None + if has_generic_read is not None: + self.has_generic_read = has_generic_read + if entity_group_ids is not None: + self.entity_group_ids = entity_group_ids + + @property + def has_generic_read(self): + """Gets the has_generic_read of this MergedGroupTypePermissionInfo. # noqa: E501 + + Indicates if generic permission assigned to the user group. # noqa: E501 + + :return: The has_generic_read of this MergedGroupTypePermissionInfo. # noqa: E501 + :rtype: bool + """ + return self._has_generic_read + + @has_generic_read.setter + def has_generic_read(self, has_generic_read): + """Sets the has_generic_read of this MergedGroupTypePermissionInfo. + + Indicates if generic permission assigned to the user group. # noqa: E501 + + :param has_generic_read: The has_generic_read of this MergedGroupTypePermissionInfo. # noqa: E501 + :type: bool + """ + + self._has_generic_read = has_generic_read + + @property + def entity_group_ids(self): + """Gets the entity_group_ids of this MergedGroupTypePermissionInfo. # noqa: E501 + + List of Entity Groups in case of group roles are assigned to the user (user group) # noqa: E501 + + :return: The entity_group_ids of this MergedGroupTypePermissionInfo. # noqa: E501 + :rtype: list[EntityGroupId] + """ + return self._entity_group_ids + + @entity_group_ids.setter + def entity_group_ids(self, entity_group_ids): + """Sets the entity_group_ids of this MergedGroupTypePermissionInfo. + + List of Entity Groups in case of group roles are assigned to the user (user group) # noqa: E501 + + :param entity_group_ids: The entity_group_ids of this MergedGroupTypePermissionInfo. # noqa: E501 + :type: list[EntityGroupId] + """ + + self._entity_group_ids = entity_group_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MergedGroupTypePermissionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MergedGroupTypePermissionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/merged_user_permissions.py b/tb-rest-client/python/tb_rest_client/models/models_pe/merged_user_permissions.py new file mode 100644 index 0000000..aef6067 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/merged_user_permissions.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MergedUserPermissions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'generic_permissions': 'dict(str, list[str])', + 'group_permissions': 'dict(str, MergedGroupPermissionInfo)', + 'read_group_permissions': 'dict(str, MergedGroupTypePermissionInfo)', + 'read_entity_permissions': 'dict(str, MergedGroupTypePermissionInfo)', + 'read_attr_permissions': 'dict(str, MergedGroupTypePermissionInfo)', + 'read_ts_permissions': 'dict(str, MergedGroupTypePermissionInfo)' + } + + attribute_map = { + 'generic_permissions': 'genericPermissions', + 'group_permissions': 'groupPermissions', + 'read_group_permissions': 'readGroupPermissions', + 'read_entity_permissions': 'readEntityPermissions', + 'read_attr_permissions': 'readAttrPermissions', + 'read_ts_permissions': 'readTsPermissions' + } + + def __init__(self, generic_permissions=None, group_permissions=None, read_group_permissions=None, read_entity_permissions=None, read_attr_permissions=None, read_ts_permissions=None): # noqa: E501 + """MergedUserPermissions - a model defined in Swagger""" # noqa: E501 + self._generic_permissions = None + self._group_permissions = None + self._read_group_permissions = None + self._read_entity_permissions = None + self._read_attr_permissions = None + self._read_ts_permissions = None + self.discriminator = None + if generic_permissions is not None: + self.generic_permissions = generic_permissions + if group_permissions is not None: + self.group_permissions = group_permissions + if read_group_permissions is not None: + self.read_group_permissions = read_group_permissions + if read_entity_permissions is not None: + self.read_entity_permissions = read_entity_permissions + if read_attr_permissions is not None: + self.read_attr_permissions = read_attr_permissions + if read_ts_permissions is not None: + self.read_ts_permissions = read_ts_permissions + + @property + def generic_permissions(self): + """Gets the generic_permissions of this MergedUserPermissions. # noqa: E501 + + Map of permissions defined using generic roles ('Customer Administrator', etc) # noqa: E501 + + :return: The generic_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, list[str]) + """ + return self._generic_permissions + + @generic_permissions.setter + def generic_permissions(self, generic_permissions): + """Sets the generic_permissions of this MergedUserPermissions. + + Map of permissions defined using generic roles ('Customer Administrator', etc) # noqa: E501 + + :param generic_permissions: The generic_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, list[str]) + """ + + self._generic_permissions = generic_permissions + + @property + def group_permissions(self): + """Gets the group_permissions of this MergedUserPermissions. # noqa: E501 + + Map of permissions defined using group roles ('Read' or 'Write' access to specific entity group, etc) # noqa: E501 + + :return: The group_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupPermissionInfo) + """ + return self._group_permissions + + @group_permissions.setter + def group_permissions(self, group_permissions): + """Sets the group_permissions of this MergedUserPermissions. + + Map of permissions defined using group roles ('Read' or 'Write' access to specific entity group, etc) # noqa: E501 + + :param group_permissions: The group_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupPermissionInfo) + """ + + self._group_permissions = group_permissions + + @property + def read_group_permissions(self): + """Gets the read_group_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read permissions per entity type. Used on the UI to enable/disable certain components. # noqa: E501 + + :return: The read_group_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_group_permissions + + @read_group_permissions.setter + def read_group_permissions(self, read_group_permissions): + """Sets the read_group_permissions of this MergedUserPermissions. + + Map of read permissions per entity type. Used on the UI to enable/disable certain components. # noqa: E501 + + :param read_group_permissions: The read_group_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_group_permissions = read_group_permissions + + @property + def read_entity_permissions(self): + """Gets the read_entity_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read permissions per resource. Used on the UI to enable/disable certain components. # noqa: E501 + + :return: The read_entity_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_entity_permissions + + @read_entity_permissions.setter + def read_entity_permissions(self, read_entity_permissions): + """Sets the read_entity_permissions of this MergedUserPermissions. + + Map of read permissions per resource. Used on the UI to enable/disable certain components. # noqa: E501 + + :param read_entity_permissions: The read_entity_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_entity_permissions = read_entity_permissions + + @property + def read_attr_permissions(self): + """Gets the read_attr_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read entity attributes permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :return: The read_attr_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_attr_permissions + + @read_attr_permissions.setter + def read_attr_permissions(self, read_attr_permissions): + """Sets the read_attr_permissions of this MergedUserPermissions. + + Map of read entity attributes permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :param read_attr_permissions: The read_attr_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_attr_permissions = read_attr_permissions + + @property + def read_ts_permissions(self): + """Gets the read_ts_permissions of this MergedUserPermissions. # noqa: E501 + + Map of read entity time-series permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :return: The read_ts_permissions of this MergedUserPermissions. # noqa: E501 + :rtype: dict(str, MergedGroupTypePermissionInfo) + """ + return self._read_ts_permissions + + @read_ts_permissions.setter + def read_ts_permissions(self, read_ts_permissions): + """Sets the read_ts_permissions of this MergedUserPermissions. + + Map of read entity time-series permissions per resource. Used on the UI to enable/disable certain tabs. # noqa: E501 + + :param read_ts_permissions: The read_ts_permissions of this MergedUserPermissions. # noqa: E501 + :type: dict(str, MergedGroupTypePermissionInfo) + """ + + self._read_ts_permissions = read_ts_permissions + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MergedUserPermissions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MergedUserPermissions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/mqtt_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/mqtt_device_profile_transport_configuration.py new file mode 100644 index 0000000..f5b6bf1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/mqtt_device_profile_transport_configuration.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class MqttDeviceProfileTransportConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_subscribe_topic': 'str', + 'device_attributes_topic': 'str', + 'device_telemetry_topic': 'str', + 'send_ack_on_validation_exception': 'bool', + 'sparkplug': 'bool', + 'sparkplug_attributes_metric_names': 'list[str]', + 'transport_payload_type_configuration': 'TransportPayloadTypeConfiguration' + } + + attribute_map = { + 'device_attributes_subscribe_topic': 'deviceAttributesSubscribeTopic', + 'device_attributes_topic': 'deviceAttributesTopic', + 'device_telemetry_topic': 'deviceTelemetryTopic', + 'send_ack_on_validation_exception': 'sendAckOnValidationException', + 'sparkplug': 'sparkplug', + 'sparkplug_attributes_metric_names': 'sparkplugAttributesMetricNames', + 'transport_payload_type_configuration': 'transportPayloadTypeConfiguration' + } + + def __init__(self, device_attributes_subscribe_topic=None, device_attributes_topic=None, device_telemetry_topic=None, send_ack_on_validation_exception=None, sparkplug=None, sparkplug_attributes_metric_names=None, transport_payload_type_configuration=None): # noqa: E501 + """MqttDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_subscribe_topic = None + self._device_attributes_topic = None + self._device_telemetry_topic = None + self._send_ack_on_validation_exception = None + self._sparkplug = None + self._sparkplug_attributes_metric_names = None + self._transport_payload_type_configuration = None + self.discriminator = None + if device_attributes_subscribe_topic is not None: + self.device_attributes_subscribe_topic = device_attributes_subscribe_topic + if device_attributes_topic is not None: + self.device_attributes_topic = device_attributes_topic + if device_telemetry_topic is not None: + self.device_telemetry_topic = device_telemetry_topic + if send_ack_on_validation_exception is not None: + self.send_ack_on_validation_exception = send_ack_on_validation_exception + if sparkplug is not None: + self.sparkplug = sparkplug + if sparkplug_attributes_metric_names is not None: + self.sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + if transport_payload_type_configuration is not None: + self.transport_payload_type_configuration = transport_payload_type_configuration + + @property + def device_attributes_subscribe_topic(self): + """Gets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_subscribe_topic + + @device_attributes_subscribe_topic.setter + def device_attributes_subscribe_topic(self, device_attributes_subscribe_topic): + """Sets the device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_subscribe_topic: The device_attributes_subscribe_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_subscribe_topic = device_attributes_subscribe_topic + + @property + def device_attributes_topic(self): + """Gets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_topic + + @device_attributes_topic.setter + def device_attributes_topic(self, device_attributes_topic): + """Sets the device_attributes_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_attributes_topic: The device_attributes_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_topic = device_attributes_topic + + @property + def device_telemetry_topic(self): + """Gets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_topic + + @device_telemetry_topic.setter + def device_telemetry_topic(self, device_telemetry_topic): + """Sets the device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. + + + :param device_telemetry_topic: The device_telemetry_topic of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_topic = device_telemetry_topic + + @property + def send_ack_on_validation_exception(self): + """Gets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._send_ack_on_validation_exception + + @send_ack_on_validation_exception.setter + def send_ack_on_validation_exception(self, send_ack_on_validation_exception): + """Sets the send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. + + + :param send_ack_on_validation_exception: The send_ack_on_validation_exception of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._send_ack_on_validation_exception = send_ack_on_validation_exception + + @property + def sparkplug(self): + """Gets the sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: bool + """ + return self._sparkplug + + @sparkplug.setter + def sparkplug(self, sparkplug): + """Sets the sparkplug of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug: The sparkplug of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: bool + """ + + self._sparkplug = sparkplug + + @property + def sparkplug_attributes_metric_names(self): + """Gets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._sparkplug_attributes_metric_names + + @sparkplug_attributes_metric_names.setter + def sparkplug_attributes_metric_names(self, sparkplug_attributes_metric_names): + """Sets the sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. + + + :param sparkplug_attributes_metric_names: The sparkplug_attributes_metric_names of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[str] + """ + + self._sparkplug_attributes_metric_names = sparkplug_attributes_metric_names + + @property + def transport_payload_type_configuration(self): + """Gets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: TransportPayloadTypeConfiguration + """ + return self._transport_payload_type_configuration + + @transport_payload_type_configuration.setter + def transport_payload_type_configuration(self, transport_payload_type_configuration): + """Sets the transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. + + + :param transport_payload_type_configuration: The transport_payload_type_configuration of this MqttDeviceProfileTransportConfiguration. # noqa: E501 + :type: TransportPayloadTypeConfiguration + """ + + self._transport_payload_type_configuration = transport_payload_type_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/mqtt_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/mqtt_device_transport_configuration.py new file mode 100644 index 0000000..cef731e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/mqtt_device_transport_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class MqttDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """MqttDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(MqttDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, MqttDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/new_platform_version_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/new_platform_version_notification_rule_trigger_config.py new file mode 100644 index 0000000..a127075 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/new_platform_version_notification_rule_trigger_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NewPlatformVersionNotificationRuleTriggerConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NewPlatformVersionNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + if trigger_type is not None: + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this NewPlatformVersionNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NewPlatformVersionNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NewPlatformVersionNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/no_sec_lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_pe/no_sec_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..a7a923c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/no_sec_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NoSecLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """NoSecLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this NoSecLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this NoSecLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this NoSecLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this NoSecLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this NoSecLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this NoSecLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this NoSecLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this NoSecLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NoSecLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NoSecLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/node_connection_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/node_connection_info.py new file mode 100644 index 0000000..449f6e3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/node_connection_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NodeConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'to_index': 'int', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'to_index': 'toIndex', + 'type': 'type' + } + + def __init__(self, from_index=None, to_index=None, type=None): # noqa: E501 + """NodeConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._to_index = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.to_index = to_index + self.type = type + + @property + def from_index(self): + """Gets the from_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def to_index(self): + """Gets the to_index of this NodeConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :return: The to_index of this NodeConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._to_index + + @to_index.setter + def to_index(self, to_index): + """Sets the to_index of this NodeConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'to' part of the connection. # noqa: E501 + + :param to_index: The to_index of this NodeConnectionInfo. # noqa: E501 + :type: int + """ + if to_index is None: + raise ValueError("Invalid value for `to_index`, must not be `None`") # noqa: E501 + + self._to_index = to_index + + @property + def type(self): + """Gets the type of this NodeConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this NodeConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this NodeConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this NodeConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NodeConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NodeConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification.py new file mode 100644 index 0000000..f470b37 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification.py @@ -0,0 +1,370 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Notification(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'created_time': 'int', + 'id': 'NotificationId', + 'info': 'NotificationInfo', + 'recipient_id': 'UserId', + 'request_id': 'NotificationRequestId', + 'status': 'str', + 'subject': 'str', + 'text': 'str', + 'type': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'recipient_id': 'recipientId', + 'request_id': 'requestId', + 'status': 'status', + 'subject': 'subject', + 'text': 'text', + 'type': 'type' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, recipient_id=None, request_id=None, status=None, subject=None, text=None, type=None): # noqa: E501 + """Notification - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._recipient_id = None + self._request_id = None + self._status = None + self._subject = None + self._text = None + self._type = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if recipient_id is not None: + self.recipient_id = recipient_id + if request_id is not None: + self.request_id = request_id + if status is not None: + self.status = status + if subject is not None: + self.subject = subject + if text is not None: + self.text = text + if type is not None: + self.type = type + + @property + def additional_config(self): + """Gets the additional_config of this Notification. # noqa: E501 + + + :return: The additional_config of this Notification. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this Notification. + + + :param additional_config: The additional_config of this Notification. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this Notification. # noqa: E501 + + + :return: The created_time of this Notification. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Notification. + + + :param created_time: The created_time of this Notification. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Notification. # noqa: E501 + + + :return: The id of this Notification. # noqa: E501 + :rtype: NotificationId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Notification. + + + :param id: The id of this Notification. # noqa: E501 + :type: NotificationId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this Notification. # noqa: E501 + + + :return: The info of this Notification. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this Notification. + + + :param info: The info of this Notification. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def recipient_id(self): + """Gets the recipient_id of this Notification. # noqa: E501 + + + :return: The recipient_id of this Notification. # noqa: E501 + :rtype: UserId + """ + return self._recipient_id + + @recipient_id.setter + def recipient_id(self, recipient_id): + """Sets the recipient_id of this Notification. + + + :param recipient_id: The recipient_id of this Notification. # noqa: E501 + :type: UserId + """ + + self._recipient_id = recipient_id + + @property + def request_id(self): + """Gets the request_id of this Notification. # noqa: E501 + + + :return: The request_id of this Notification. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._request_id + + @request_id.setter + def request_id(self, request_id): + """Sets the request_id of this Notification. + + + :param request_id: The request_id of this Notification. # noqa: E501 + :type: NotificationRequestId + """ + + self._request_id = request_id + + @property + def status(self): + """Gets the status of this Notification. # noqa: E501 + + + :return: The status of this Notification. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Notification. + + + :param status: The status of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["READ", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def subject(self): + """Gets the subject of this Notification. # noqa: E501 + + + :return: The subject of this Notification. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this Notification. + + + :param subject: The subject of this Notification. # noqa: E501 + :type: str + """ + + self._subject = subject + + @property + def text(self): + """Gets the text of this Notification. # noqa: E501 + + + :return: The text of this Notification. # noqa: E501 + :rtype: str + """ + return self._text + + @text.setter + def text(self, text): + """Sets the text of this Notification. + + + :param text: The text of this Notification. # noqa: E501 + :type: str + """ + + self._text = text + + @property + def type(self): + """Gets the type of this Notification. # noqa: E501 + + + :return: The type of this Notification. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Notification. + + + :param type: The type of this Notification. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "GENERAL", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT", "RULE_NODE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Notification, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Notification): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_delivery_method_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_delivery_method_config.py new file mode 100644 index 0000000..7077eb5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_delivery_method_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """NotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_id.py new file mode 100644 index 0000000..02efb37 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationId. # noqa: E501 + + + :return: The entity_type of this NotificationId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationId. + + + :param entity_type: The entity_type of this NotificationId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_info.py new file mode 100644 index 0000000..0e847ec --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_info.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'state_entity_id': 'EntityId' + } + + attribute_map = { + 'state_entity_id': 'stateEntityId' + } + + def __init__(self, state_entity_id=None): # noqa: E501 + """NotificationInfo - a model defined in Swagger""" # noqa: E501 + self._state_entity_id = None + self.discriminator = None + if state_entity_id is not None: + self.state_entity_id = state_entity_id + + @property + def state_entity_id(self): + """Gets the state_entity_id of this NotificationInfo. # noqa: E501 + + + :return: The state_entity_id of this NotificationInfo. # noqa: E501 + :rtype: EntityId + """ + return self._state_entity_id + + @state_entity_id.setter + def state_entity_id(self, state_entity_id): + """Sets the state_entity_id of this NotificationInfo. + + + :param state_entity_id: The state_entity_id of this NotificationInfo. # noqa: E501 + :type: EntityId + """ + + self._state_entity_id = state_entity_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request.py new file mode 100644 index 0000000..87c0d17 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request.py @@ -0,0 +1,416 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'NotificationRequestConfig', + 'created_time': 'int', + 'id': 'NotificationRequestId', + 'info': 'NotificationInfo', + 'originator_entity_id': 'EntityId', + 'rule_id': 'NotificationRuleId', + 'stats': 'NotificationRequestStats', + 'status': 'str', + 'targets': 'list[str]', + 'template': 'NotificationTemplate', + 'template_id': 'NotificationTemplateId', + 'tenant_id': 'TenantId' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'created_time': 'createdTime', + 'id': 'id', + 'info': 'info', + 'originator_entity_id': 'originatorEntityId', + 'rule_id': 'ruleId', + 'stats': 'stats', + 'status': 'status', + 'targets': 'targets', + 'template': 'template', + 'template_id': 'templateId', + 'tenant_id': 'tenantId' + } + + def __init__(self, additional_config=None, created_time=None, id=None, info=None, originator_entity_id=None, rule_id=None, stats=None, status=None, targets=None, template=None, template_id=None, tenant_id=None): # noqa: E501 + """NotificationRequest - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._created_time = None + self._id = None + self._info = None + self._originator_entity_id = None + self._rule_id = None + self._stats = None + self._status = None + self._targets = None + self._template = None + self._template_id = None + self._tenant_id = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if info is not None: + self.info = info + if originator_entity_id is not None: + self.originator_entity_id = originator_entity_id + if rule_id is not None: + self.rule_id = rule_id + if stats is not None: + self.stats = stats + if status is not None: + self.status = status + if targets is not None: + self.targets = targets + if template is not None: + self.template = template + if template_id is not None: + self.template_id = template_id + if tenant_id is not None: + self.tenant_id = tenant_id + + @property + def additional_config(self): + """Gets the additional_config of this NotificationRequest. # noqa: E501 + + + :return: The additional_config of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestConfig + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this NotificationRequest. + + + :param additional_config: The additional_config of this NotificationRequest. # noqa: E501 + :type: NotificationRequestConfig + """ + + self._additional_config = additional_config + + @property + def created_time(self): + """Gets the created_time of this NotificationRequest. # noqa: E501 + + + :return: The created_time of this NotificationRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this NotificationRequest. + + + :param created_time: The created_time of this NotificationRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this NotificationRequest. # noqa: E501 + + + :return: The id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequest. + + + :param id: The id of this NotificationRequest. # noqa: E501 + :type: NotificationRequestId + """ + + self._id = id + + @property + def info(self): + """Gets the info of this NotificationRequest. # noqa: E501 + + + :return: The info of this NotificationRequest. # noqa: E501 + :rtype: NotificationInfo + """ + return self._info + + @info.setter + def info(self, info): + """Sets the info of this NotificationRequest. + + + :param info: The info of this NotificationRequest. # noqa: E501 + :type: NotificationInfo + """ + + self._info = info + + @property + def originator_entity_id(self): + """Gets the originator_entity_id of this NotificationRequest. # noqa: E501 + + + :return: The originator_entity_id of this NotificationRequest. # noqa: E501 + :rtype: EntityId + """ + return self._originator_entity_id + + @originator_entity_id.setter + def originator_entity_id(self, originator_entity_id): + """Sets the originator_entity_id of this NotificationRequest. + + + :param originator_entity_id: The originator_entity_id of this NotificationRequest. # noqa: E501 + :type: EntityId + """ + + self._originator_entity_id = originator_entity_id + + @property + def rule_id(self): + """Gets the rule_id of this NotificationRequest. # noqa: E501 + + + :return: The rule_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationRuleId + """ + return self._rule_id + + @rule_id.setter + def rule_id(self, rule_id): + """Sets the rule_id of this NotificationRequest. + + + :param rule_id: The rule_id of this NotificationRequest. # noqa: E501 + :type: NotificationRuleId + """ + + self._rule_id = rule_id + + @property + def stats(self): + """Gets the stats of this NotificationRequest. # noqa: E501 + + + :return: The stats of this NotificationRequest. # noqa: E501 + :rtype: NotificationRequestStats + """ + return self._stats + + @stats.setter + def stats(self, stats): + """Sets the stats of this NotificationRequest. + + + :param stats: The stats of this NotificationRequest. # noqa: E501 + :type: NotificationRequestStats + """ + + self._stats = stats + + @property + def status(self): + """Gets the status of this NotificationRequest. # noqa: E501 + + + :return: The status of this NotificationRequest. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this NotificationRequest. + + + :param status: The status of this NotificationRequest. # noqa: E501 + :type: str + """ + allowed_values = ["PROCESSING", "SCHEDULED", "SENT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def targets(self): + """Gets the targets of this NotificationRequest. # noqa: E501 + + + :return: The targets of this NotificationRequest. # noqa: E501 + :rtype: list[str] + """ + return self._targets + + @targets.setter + def targets(self, targets): + """Sets the targets of this NotificationRequest. + + + :param targets: The targets of this NotificationRequest. # noqa: E501 + :type: list[str] + """ + + self._targets = targets + + @property + def template(self): + """Gets the template of this NotificationRequest. # noqa: E501 + + + :return: The template of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplate + """ + return self._template + + @template.setter + def template(self, template): + """Sets the template of this NotificationRequest. + + + :param template: The template of this NotificationRequest. # noqa: E501 + :type: NotificationTemplate + """ + + self._template = template + + @property + def template_id(self): + """Gets the template_id of this NotificationRequest. # noqa: E501 + + + :return: The template_id of this NotificationRequest. # noqa: E501 + :rtype: NotificationTemplateId + """ + return self._template_id + + @template_id.setter + def template_id(self, template_id): + """Sets the template_id of this NotificationRequest. + + + :param template_id: The template_id of this NotificationRequest. # noqa: E501 + :type: NotificationTemplateId + """ + + self._template_id = template_id + + @property + def tenant_id(self): + """Gets the tenant_id of this NotificationRequest. # noqa: E501 + + + :return: The tenant_id of this NotificationRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this NotificationRequest. + + + :param tenant_id: The tenant_id of this NotificationRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_config.py new file mode 100644 index 0000000..54f9de4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sending_delay_in_sec': 'int' + } + + attribute_map = { + 'sending_delay_in_sec': 'sendingDelayInSec' + } + + def __init__(self, sending_delay_in_sec=None): # noqa: E501 + """NotificationRequestConfig - a model defined in Swagger""" # noqa: E501 + self._sending_delay_in_sec = None + self.discriminator = None + if sending_delay_in_sec is not None: + self.sending_delay_in_sec = sending_delay_in_sec + + @property + def sending_delay_in_sec(self): + """Gets the sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + + + :return: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :rtype: int + """ + return self._sending_delay_in_sec + + @sending_delay_in_sec.setter + def sending_delay_in_sec(self, sending_delay_in_sec): + """Sets the sending_delay_in_sec of this NotificationRequestConfig. + + + :param sending_delay_in_sec: The sending_delay_in_sec of this NotificationRequestConfig. # noqa: E501 + :type: int + """ + + self._sending_delay_in_sec = sending_delay_in_sec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_id.py new file mode 100644 index 0000000..8b9bfd8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRequestId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRequestId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRequestId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRequestId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRequestId. # noqa: E501 + + + :return: The entity_type of this NotificationRequestId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRequestId. + + + :param entity_type: The entity_type of this NotificationRequestId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_preview.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_preview.py new file mode 100644 index 0000000..c16ca74 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_preview.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestPreview(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'processed_templates': 'dict(str, DeliveryMethodNotificationTemplate)', + 'recipients_count_by_target': 'dict(str, int)', + 'recipients_preview': 'list[str]', + 'total_recipients_count': 'int' + } + + attribute_map = { + 'processed_templates': 'processedTemplates', + 'recipients_count_by_target': 'recipientsCountByTarget', + 'recipients_preview': 'recipientsPreview', + 'total_recipients_count': 'totalRecipientsCount' + } + + def __init__(self, processed_templates=None, recipients_count_by_target=None, recipients_preview=None, total_recipients_count=None): # noqa: E501 + """NotificationRequestPreview - a model defined in Swagger""" # noqa: E501 + self._processed_templates = None + self._recipients_count_by_target = None + self._recipients_preview = None + self._total_recipients_count = None + self.discriminator = None + if processed_templates is not None: + self.processed_templates = processed_templates + if recipients_count_by_target is not None: + self.recipients_count_by_target = recipients_count_by_target + if recipients_preview is not None: + self.recipients_preview = recipients_preview + if total_recipients_count is not None: + self.total_recipients_count = total_recipients_count + + @property + def processed_templates(self): + """Gets the processed_templates of this NotificationRequestPreview. # noqa: E501 + + + :return: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._processed_templates + + @processed_templates.setter + def processed_templates(self, processed_templates): + """Sets the processed_templates of this NotificationRequestPreview. + + + :param processed_templates: The processed_templates of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._processed_templates = processed_templates + + @property + def recipients_count_by_target(self): + """Gets the recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :rtype: dict(str, int) + """ + return self._recipients_count_by_target + + @recipients_count_by_target.setter + def recipients_count_by_target(self, recipients_count_by_target): + """Sets the recipients_count_by_target of this NotificationRequestPreview. + + + :param recipients_count_by_target: The recipients_count_by_target of this NotificationRequestPreview. # noqa: E501 + :type: dict(str, int) + """ + + self._recipients_count_by_target = recipients_count_by_target + + @property + def recipients_preview(self): + """Gets the recipients_preview of this NotificationRequestPreview. # noqa: E501 + + + :return: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :rtype: list[str] + """ + return self._recipients_preview + + @recipients_preview.setter + def recipients_preview(self, recipients_preview): + """Sets the recipients_preview of this NotificationRequestPreview. + + + :param recipients_preview: The recipients_preview of this NotificationRequestPreview. # noqa: E501 + :type: list[str] + """ + + self._recipients_preview = recipients_preview + + @property + def total_recipients_count(self): + """Gets the total_recipients_count of this NotificationRequestPreview. # noqa: E501 + + + :return: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :rtype: int + """ + return self._total_recipients_count + + @total_recipients_count.setter + def total_recipients_count(self, total_recipients_count): + """Sets the total_recipients_count of this NotificationRequestPreview. + + + :param total_recipients_count: The total_recipients_count of this NotificationRequestPreview. # noqa: E501 + :type: int + """ + + self._total_recipients_count = total_recipients_count + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestPreview, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestPreview): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_stats.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_stats.py new file mode 100644 index 0000000..5338f06 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_request_stats.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRequestStats(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'errors': 'dict(str, object)', + 'sent': 'dict(str, AtomicInteger)' + } + + attribute_map = { + 'error': 'error', + 'errors': 'errors', + 'sent': 'sent' + } + + def __init__(self, error=None, errors=None, sent=None): # noqa: E501 + """NotificationRequestStats - a model defined in Swagger""" # noqa: E501 + self._error = None + self._errors = None + self._sent = None + self.discriminator = None + if error is not None: + self.error = error + if errors is not None: + self.errors = errors + if sent is not None: + self.sent = sent + + @property + def error(self): + """Gets the error of this NotificationRequestStats. # noqa: E501 + + + :return: The error of this NotificationRequestStats. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this NotificationRequestStats. + + + :param error: The error of this NotificationRequestStats. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def errors(self): + """Gets the errors of this NotificationRequestStats. # noqa: E501 + + + :return: The errors of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, object) + """ + return self._errors + + @errors.setter + def errors(self, errors): + """Sets the errors of this NotificationRequestStats. + + + :param errors: The errors of this NotificationRequestStats. # noqa: E501 + :type: dict(str, object) + """ + + self._errors = errors + + @property + def sent(self): + """Gets the sent of this NotificationRequestStats. # noqa: E501 + + + :return: The sent of this NotificationRequestStats. # noqa: E501 + :rtype: dict(str, AtomicInteger) + """ + return self._sent + + @sent.setter + def sent(self, sent): + """Sets the sent of this NotificationRequestStats. + + + :param sent: The sent of this NotificationRequestStats. # noqa: E501 + :type: dict(str, AtomicInteger) + """ + + self._sent = sent + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRequestStats, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRequestStats): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_config.py new file mode 100644 index 0000000..f07ae78 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str' + } + + attribute_map = { + 'description': 'description' + } + + def __init__(self, description=None): # noqa: E501 + """NotificationRuleConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self.discriminator = None + if description is not None: + self.description = description + + @property + def description(self): + """Gets the description of this NotificationRuleConfig. # noqa: E501 + + + :return: The description of this NotificationRuleConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this NotificationRuleConfig. + + + :param description: The description of this NotificationRuleConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_id.py new file mode 100644 index 0000000..5e847d8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationRuleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationRuleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationRuleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationRuleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationRuleId. # noqa: E501 + + + :return: The entity_type of this NotificationRuleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationRuleId. + + + :param entity_type: The entity_type of this NotificationRuleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_recipients_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_recipients_config.py new file mode 100644 index 0000000..29a0d61 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_rule_recipients_config.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationRuleRecipientsConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'trigger_type': 'str' + } + + attribute_map = { + 'trigger_type': 'triggerType' + } + + def __init__(self, trigger_type=None): # noqa: E501 + """NotificationRuleRecipientsConfig - a model defined in Swagger""" # noqa: E501 + self._trigger_type = None + self.discriminator = None + self.trigger_type = trigger_type + + @property + def trigger_type(self): + """Gets the trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + + + :return: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this NotificationRuleRecipientsConfig. + + + :param trigger_type: The trigger_type of this NotificationRuleRecipientsConfig. # noqa: E501 + :type: str + """ + if trigger_type is None: + raise ValueError("Invalid value for `trigger_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationRuleRecipientsConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationRuleRecipientsConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_target_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_target_id.py new file mode 100644 index 0000000..1cbe661 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_target_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTargetId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTargetId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTargetId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTargetId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTargetId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTargetId. # noqa: E501 + + + :return: The entity_type of this NotificationTargetId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTargetId. + + + :param entity_type: The entity_type of this NotificationTargetId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTargetId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTargetId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_template_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_template_config.py new file mode 100644 index 0000000..edb7f35 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_template_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'delivery_methods_templates': 'dict(str, DeliveryMethodNotificationTemplate)' + } + + attribute_map = { + 'delivery_methods_templates': 'deliveryMethodsTemplates' + } + + def __init__(self, delivery_methods_templates=None): # noqa: E501 + """NotificationTemplateConfig - a model defined in Swagger""" # noqa: E501 + self._delivery_methods_templates = None + self.discriminator = None + if delivery_methods_templates is not None: + self.delivery_methods_templates = delivery_methods_templates + + @property + def delivery_methods_templates(self): + """Gets the delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + + + :return: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :rtype: dict(str, DeliveryMethodNotificationTemplate) + """ + return self._delivery_methods_templates + + @delivery_methods_templates.setter + def delivery_methods_templates(self, delivery_methods_templates): + """Sets the delivery_methods_templates of this NotificationTemplateConfig. + + + :param delivery_methods_templates: The delivery_methods_templates of this NotificationTemplateConfig. # noqa: E501 + :type: dict(str, DeliveryMethodNotificationTemplate) + """ + + self._delivery_methods_templates = delivery_methods_templates + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/notification_template_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_template_id.py new file mode 100644 index 0000000..89379cc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/notification_template_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class NotificationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """NotificationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this NotificationTemplateId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this NotificationTemplateId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this NotificationTemplateId. # noqa: E501 + + + :return: The entity_type of this NotificationTemplateId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this NotificationTemplateId. + + + :param entity_type: The entity_type of this NotificationTemplateId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NotificationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NotificationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/numeric_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_pe/numeric_filter_predicate.py new file mode 100644 index 0000000..22eeea7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/numeric_filter_predicate.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class NumericFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'operation': 'str', + 'value': 'FilterPredicateValuedouble' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, operation=None, value=None, *args, **kwargs): # noqa: E501 + """NumericFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._operation = None + self._value = None + self.discriminator = None + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def operation(self): + """Gets the operation of this NumericFilterPredicate. # noqa: E501 + + + :return: The operation of this NumericFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this NumericFilterPredicate. + + + :param operation: The operation of this NumericFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["EQUAL", "GREATER", "GREATER_OR_EQUAL", "LESS", "LESS_OR_EQUAL", "NOT_EQUAL"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this NumericFilterPredicate. # noqa: E501 + + + :return: The value of this NumericFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuedouble + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this NumericFilterPredicate. + + + :param value: The value of this NumericFilterPredicate. # noqa: E501 + :type: FilterPredicateValuedouble + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(NumericFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, NumericFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_basic_mapper_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_basic_mapper_config.py new file mode 100644 index 0000000..6fde47a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_basic_mapper_config.py @@ -0,0 +1,381 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2BasicMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'always_full_screen': 'bool', + 'customer_name_pattern': 'str', + 'default_dashboard_name': 'str', + 'email_attribute_key': 'str', + 'first_name_attribute_key': 'str', + 'last_name_attribute_key': 'str', + 'parent_customer_name_pattern': 'str', + 'tenant_name_pattern': 'str', + 'tenant_name_strategy': 'str', + 'user_groups_name_pattern': 'list[str]' + } + + attribute_map = { + 'always_full_screen': 'alwaysFullScreen', + 'customer_name_pattern': 'customerNamePattern', + 'default_dashboard_name': 'defaultDashboardName', + 'email_attribute_key': 'emailAttributeKey', + 'first_name_attribute_key': 'firstNameAttributeKey', + 'last_name_attribute_key': 'lastNameAttributeKey', + 'parent_customer_name_pattern': 'parentCustomerNamePattern', + 'tenant_name_pattern': 'tenantNamePattern', + 'tenant_name_strategy': 'tenantNameStrategy', + 'user_groups_name_pattern': 'userGroupsNamePattern' + } + + def __init__(self, always_full_screen=None, customer_name_pattern=None, default_dashboard_name=None, email_attribute_key=None, first_name_attribute_key=None, last_name_attribute_key=None, parent_customer_name_pattern=None, tenant_name_pattern=None, tenant_name_strategy=None, user_groups_name_pattern=None): # noqa: E501 + """OAuth2BasicMapperConfig - a model defined in Swagger""" # noqa: E501 + self._always_full_screen = None + self._customer_name_pattern = None + self._default_dashboard_name = None + self._email_attribute_key = None + self._first_name_attribute_key = None + self._last_name_attribute_key = None + self._parent_customer_name_pattern = None + self._tenant_name_pattern = None + self._tenant_name_strategy = None + self._user_groups_name_pattern = None + self.discriminator = None + if always_full_screen is not None: + self.always_full_screen = always_full_screen + if customer_name_pattern is not None: + self.customer_name_pattern = customer_name_pattern + if default_dashboard_name is not None: + self.default_dashboard_name = default_dashboard_name + if email_attribute_key is not None: + self.email_attribute_key = email_attribute_key + if first_name_attribute_key is not None: + self.first_name_attribute_key = first_name_attribute_key + if last_name_attribute_key is not None: + self.last_name_attribute_key = last_name_attribute_key + if parent_customer_name_pattern is not None: + self.parent_customer_name_pattern = parent_customer_name_pattern + if tenant_name_pattern is not None: + self.tenant_name_pattern = tenant_name_pattern + self.tenant_name_strategy = tenant_name_strategy + if user_groups_name_pattern is not None: + self.user_groups_name_pattern = user_groups_name_pattern + + @property + def always_full_screen(self): + """Gets the always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + + Whether default dashboard should be open in full screen # noqa: E501 + + :return: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._always_full_screen + + @always_full_screen.setter + def always_full_screen(self, always_full_screen): + """Sets the always_full_screen of this OAuth2BasicMapperConfig. + + Whether default dashboard should be open in full screen # noqa: E501 + + :param always_full_screen: The always_full_screen of this OAuth2BasicMapperConfig. # noqa: E501 + :type: bool + """ + + self._always_full_screen = always_full_screen + + @property + def customer_name_pattern(self): + """Gets the customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :return: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._customer_name_pattern + + @customer_name_pattern.setter + def customer_name_pattern(self, customer_name_pattern): + """Sets the customer_name_pattern of this OAuth2BasicMapperConfig. + + Customer name pattern. When creating a user on the first OAuth2 log in, if specified, customer name will be used to create or find existing customer in the platform and assign customerId to the user # noqa: E501 + + :param customer_name_pattern: The customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._customer_name_pattern = customer_name_pattern + + @property + def default_dashboard_name(self): + """Gets the default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :return: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._default_dashboard_name + + @default_dashboard_name.setter + def default_dashboard_name(self, default_dashboard_name): + """Sets the default_dashboard_name of this OAuth2BasicMapperConfig. + + Name of the tenant's dashboard to set as default dashboard for newly created user # noqa: E501 + + :param default_dashboard_name: The default_dashboard_name of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._default_dashboard_name = default_dashboard_name + + @property + def email_attribute_key(self): + """Gets the email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :return: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._email_attribute_key + + @email_attribute_key.setter + def email_attribute_key(self, email_attribute_key): + """Sets the email_attribute_key of this OAuth2BasicMapperConfig. + + Email attribute key of OAuth2 principal attributes. Must be specified for BASIC mapper type and cannot be specified for GITHUB type # noqa: E501 + + :param email_attribute_key: The email_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._email_attribute_key = email_attribute_key + + @property + def first_name_attribute_key(self): + """Gets the first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + First name attribute key # noqa: E501 + + :return: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._first_name_attribute_key + + @first_name_attribute_key.setter + def first_name_attribute_key(self, first_name_attribute_key): + """Sets the first_name_attribute_key of this OAuth2BasicMapperConfig. + + First name attribute key # noqa: E501 + + :param first_name_attribute_key: The first_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._first_name_attribute_key = first_name_attribute_key + + @property + def last_name_attribute_key(self): + """Gets the last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + + Last name attribute key # noqa: E501 + + :return: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._last_name_attribute_key + + @last_name_attribute_key.setter + def last_name_attribute_key(self, last_name_attribute_key): + """Sets the last_name_attribute_key of this OAuth2BasicMapperConfig. + + Last name attribute key # noqa: E501 + + :param last_name_attribute_key: The last_name_attribute_key of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._last_name_attribute_key = last_name_attribute_key + + @property + def parent_customer_name_pattern(self): + """Gets the parent_customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + + :return: The parent_customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._parent_customer_name_pattern + + @parent_customer_name_pattern.setter + def parent_customer_name_pattern(self, parent_customer_name_pattern): + """Sets the parent_customer_name_pattern of this OAuth2BasicMapperConfig. + + + :param parent_customer_name_pattern: The parent_customer_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._parent_customer_name_pattern = parent_customer_name_pattern + + @property + def tenant_name_pattern(self): + """Gets the tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :return: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_pattern + + @tenant_name_pattern.setter + def tenant_name_pattern(self, tenant_name_pattern): + """Sets the tenant_name_pattern of this OAuth2BasicMapperConfig. + + Tenant name pattern for CUSTOM naming strategy. OAuth2 attributes in the pattern can be used by enclosing attribute key in '%{' and '}' # noqa: E501 + + :param tenant_name_pattern: The tenant_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + + self._tenant_name_pattern = tenant_name_pattern + + @property + def tenant_name_strategy(self): + """Gets the tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :return: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: str + """ + return self._tenant_name_strategy + + @tenant_name_strategy.setter + def tenant_name_strategy(self, tenant_name_strategy): + """Sets the tenant_name_strategy of this OAuth2BasicMapperConfig. + + Tenant naming strategy. For DOMAIN type, domain for tenant name will be taken from the email (substring before '@') # noqa: E501 + + :param tenant_name_strategy: The tenant_name_strategy of this OAuth2BasicMapperConfig. # noqa: E501 + :type: str + """ + if tenant_name_strategy is None: + raise ValueError("Invalid value for `tenant_name_strategy`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOM", "DOMAIN", "EMAIL"] # noqa: E501 + if tenant_name_strategy not in allowed_values: + raise ValueError( + "Invalid value for `tenant_name_strategy` ({0}), must be one of {1}" # noqa: E501 + .format(tenant_name_strategy, allowed_values) + ) + + self._tenant_name_strategy = tenant_name_strategy + + @property + def user_groups_name_pattern(self): + """Gets the user_groups_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + + + :return: The user_groups_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :rtype: list[str] + """ + return self._user_groups_name_pattern + + @user_groups_name_pattern.setter + def user_groups_name_pattern(self, user_groups_name_pattern): + """Sets the user_groups_name_pattern of this OAuth2BasicMapperConfig. + + + :param user_groups_name_pattern: The user_groups_name_pattern of this OAuth2BasicMapperConfig. # noqa: E501 + :type: list[str] + """ + + self._user_groups_name_pattern = user_groups_name_pattern + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2BasicMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2BasicMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_info.py new file mode 100644 index 0000000..c023158 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'icon': 'str', + 'name': 'str', + 'url': 'str' + } + + attribute_map = { + 'icon': 'icon', + 'name': 'name', + 'url': 'url' + } + + def __init__(self, icon=None, name=None, url=None): # noqa: E501 + """OAuth2ClientInfo - a model defined in Swagger""" # noqa: E501 + self._icon = None + self._name = None + self._url = None + self.discriminator = None + if icon is not None: + self.icon = icon + if name is not None: + self.name = name + if url is not None: + self.url = url + + @property + def icon(self): + """Gets the icon of this OAuth2ClientInfo. # noqa: E501 + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :return: The icon of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._icon + + @icon.setter + def icon(self, icon): + """Sets the icon of this OAuth2ClientInfo. + + Name of the icon, displayed on OAuth2 log in button # noqa: E501 + + :param icon: The icon of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._icon = icon + + @property + def name(self): + """Gets the name of this OAuth2ClientInfo. # noqa: E501 + + OAuth2 client name # noqa: E501 + + :return: The name of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientInfo. + + OAuth2 client name # noqa: E501 + + :param name: The name of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def url(self): + """Gets the url of this OAuth2ClientInfo. # noqa: E501 + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :return: The url of this OAuth2ClientInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2ClientInfo. + + URI for OAuth2 log in. On HTTP GET request to this URI, it redirects to the OAuth2 provider page # noqa: E501 + + :param url: The url of this OAuth2ClientInfo. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template.py new file mode 100644 index 0000000..8238cdd --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template.py @@ -0,0 +1,565 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'comment': 'str', + 'created_time': 'int', + 'help_link': 'str', + 'id': 'OAuth2ClientRegistrationTemplateId', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'name': 'str', + 'provider_id': 'str', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'comment': 'comment', + 'created_time': 'createdTime', + 'help_link': 'helpLink', + 'id': 'id', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'name': 'name', + 'provider_id': 'providerId', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, comment=None, created_time=None, help_link=None, id=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, name=None, provider_id=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2ClientRegistrationTemplate - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._comment = None + self._created_time = None + self._help_link = None + self._id = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._name = None + self._provider_id = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + if access_token_uri is not None: + self.access_token_uri = access_token_uri + if additional_info is not None: + self.additional_info = additional_info + if authorization_uri is not None: + self.authorization_uri = authorization_uri + if client_authentication_method is not None: + self.client_authentication_method = client_authentication_method + if comment is not None: + self.comment = comment + if created_time is not None: + self.created_time = created_time + if help_link is not None: + self.help_link = help_link + if id is not None: + self.id = id + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + if login_button_label is not None: + self.login_button_label = login_button_label + if mapper_config is not None: + self.mapper_config = mapper_config + if name is not None: + self.name = name + self.provider_id = provider_id + if scope is not None: + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default access token URI of the OAuth2 provider # noqa: E501 + + :return: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2ClientRegistrationTemplate. + + Default access token URI of the OAuth2 provider # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2ClientRegistrationTemplate. + + + :param additional_info: The additional_info of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :return: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2ClientRegistrationTemplate. + + Default authorization URI of the OAuth2 provider # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :return: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2ClientRegistrationTemplate. + + Default client authentication method to use: 'BASIC' or 'POST' # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._client_authentication_method = client_authentication_method + + @property + def comment(self): + """Gets the comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Comment for OAuth2 provider # noqa: E501 + + :return: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this OAuth2ClientRegistrationTemplate. + + Comment for OAuth2 provider # noqa: E501 + + :param comment: The comment of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._comment = comment + + @property + def created_time(self): + """Gets the created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OAuth2ClientRegistrationTemplate. + + + :param created_time: The created_time of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def help_link(self): + """Gets the help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Help link for OAuth2 provider # noqa: E501 + + :return: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._help_link + + @help_link.setter + def help_link(self, help_link): + """Sets the help_link of this OAuth2ClientRegistrationTemplate. + + Help link for OAuth2 provider # noqa: E501 + + :param help_link: The help_link of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._help_link = help_link + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2ClientRegistrationTemplateId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplate. + + + :param id: The id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2ClientRegistrationTemplateId + """ + + self._id = id + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2ClientRegistrationTemplate. + + Default JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2ClientRegistrationTemplate. + + Default log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth2 provider label # noqa: E501 + + :return: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2ClientRegistrationTemplate. + + Default OAuth2 provider label # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2ClientRegistrationTemplate. + + + :param mapper_config: The mapper_config of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: OAuth2MapperConfig + """ + + self._mapper_config = mapper_config + + @property + def name(self): + """Gets the name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + + :return: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2ClientRegistrationTemplate. + + + :param name: The name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def provider_id(self): + """Gets the provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :return: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._provider_id + + @provider_id.setter + def provider_id(self, provider_id): + """Sets the provider_id of this OAuth2ClientRegistrationTemplate. + + OAuth2 provider identifier (e.g. its name) # noqa: E501 + + :param provider_id: The provider_id of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + if provider_id is None: + raise ValueError("Invalid value for `provider_id`, must not be `None`") # noqa: E501 + + self._provider_id = provider_id + + @property + def scope(self): + """Gets the scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :return: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2ClientRegistrationTemplate. + + Default OAuth scopes that will be requested from OAuth2 platform # noqa: E501 + + :param scope: The scope of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: list[str] + """ + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default user info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2ClientRegistrationTemplate. + + Default user info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2ClientRegistrationTemplate. + + Default name of the username attribute in OAuth2 provider log in response # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2ClientRegistrationTemplate. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template_id.py new file mode 100644 index 0000000..93ea683 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_client_registration_template_id.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientRegistrationTemplateId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str' + } + + attribute_map = { + 'id': 'id' + } + + def __init__(self, id=None): # noqa: E501 + """OAuth2ClientRegistrationTemplateId - a model defined in Swagger""" # noqa: E501 + self._id = None + self.discriminator = None + self.id = id + + @property + def id(self): + """Gets the id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + + string # noqa: E501 + + :return: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OAuth2ClientRegistrationTemplateId. + + string # noqa: E501 + + :param id: The id of this OAuth2ClientRegistrationTemplateId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientRegistrationTemplateId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientRegistrationTemplateId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_clients_domain_params.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_clients_domain_params.py new file mode 100644 index 0000000..4383a89 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_clients_domain_params.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientsDomainParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_registrations': 'list[ClientRegistrationDto]', + 'domain_infos': 'list[DomainInfo]' + } + + attribute_map = { + 'client_registrations': 'clientRegistrations', + 'domain_infos': 'domainInfos' + } + + def __init__(self, client_registrations=None, domain_infos=None): # noqa: E501 + """OAuth2ClientsDomainParams - a model defined in Swagger""" # noqa: E501 + self._client_registrations = None + self._domain_infos = None + self.discriminator = None + if client_registrations is not None: + self.client_registrations = client_registrations + if domain_infos is not None: + self.domain_infos = domain_infos + + @property + def client_registrations(self): + """Gets the client_registrations of this OAuth2ClientsDomainParams. # noqa: E501 + + + :return: The client_registrations of this OAuth2ClientsDomainParams. # noqa: E501 + :rtype: list[ClientRegistrationDto] + """ + return self._client_registrations + + @client_registrations.setter + def client_registrations(self, client_registrations): + """Sets the client_registrations of this OAuth2ClientsDomainParams. + + + :param client_registrations: The client_registrations of this OAuth2ClientsDomainParams. # noqa: E501 + :type: list[ClientRegistrationDto] + """ + + self._client_registrations = client_registrations + + @property + def domain_infos(self): + """Gets the domain_infos of this OAuth2ClientsDomainParams. # noqa: E501 + + + :return: The domain_infos of this OAuth2ClientsDomainParams. # noqa: E501 + :rtype: list[DomainInfo] + """ + return self._domain_infos + + @domain_infos.setter + def domain_infos(self, domain_infos): + """Sets the domain_infos of this OAuth2ClientsDomainParams. + + + :param domain_infos: The domain_infos of this OAuth2ClientsDomainParams. # noqa: E501 + :type: list[DomainInfo] + """ + + self._domain_infos = domain_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientsDomainParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientsDomainParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_clients_params.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_clients_params.py new file mode 100644 index 0000000..a249d83 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_clients_params.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + For instructions how to authorize requests please visit REST API documentation page. # noqa: E501 + + OpenAPI spec version: 2.0 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ClientsParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'domains_params': 'list[OAuth2ClientsDomainParams]', + 'enabled': 'bool' + } + + attribute_map = { + 'domains_params': 'domainsParams', + 'enabled': 'enabled' + } + + def __init__(self, domains_params=None, enabled=None): # noqa: E501 + """OAuth2ClientsParams - a model defined in Swagger""" # noqa: E501 + self._domains_params = None + self._enabled = None + self.discriminator = None + if domains_params is not None: + self.domains_params = domains_params + if enabled is not None: + self.enabled = enabled + + @property + def domains_params(self): + """Gets the domains_params of this OAuth2ClientsParams. # noqa: E501 + + + :return: The domains_params of this OAuth2ClientsParams. # noqa: E501 + :rtype: list[OAuth2ClientsDomainParams] + """ + return self._domains_params + + @domains_params.setter + def domains_params(self, domains_params): + """Sets the domains_params of this OAuth2ClientsParams. + + + :param domains_params: The domains_params of this OAuth2ClientsParams. # noqa: E501 + :type: list[OAuth2ClientsDomainParams] + """ + + self._domains_params = domains_params + + @property + def enabled(self): + """Gets the enabled of this OAuth2ClientsParams. # noqa: E501 + + + :return: The enabled of this OAuth2ClientsParams. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this OAuth2ClientsParams. + + + :param enabled: The enabled of this OAuth2ClientsParams. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ClientsParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ClientsParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_custom_mapper_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_custom_mapper_config.py new file mode 100644 index 0000000..90ae2c8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_custom_mapper_config.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2CustomMapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password': 'str', + 'send_token': 'bool', + 'url': 'str', + 'username': 'str' + } + + attribute_map = { + 'password': 'password', + 'send_token': 'sendToken', + 'url': 'url', + 'username': 'username' + } + + def __init__(self, password=None, send_token=None, url=None, username=None): # noqa: E501 + """OAuth2CustomMapperConfig - a model defined in Swagger""" # noqa: E501 + self._password = None + self._send_token = None + self._url = None + self._username = None + self.discriminator = None + if password is not None: + self.password = password + if send_token is not None: + self.send_token = send_token + if url is not None: + self.url = url + if username is not None: + self.username = username + + @property + def password(self): + """Gets the password of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this OAuth2CustomMapperConfig. + + + :param password: The password of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def send_token(self): + """Gets the send_token of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: bool + """ + return self._send_token + + @send_token.setter + def send_token(self, send_token): + """Sets the send_token of this OAuth2CustomMapperConfig. + + + :param send_token: The send_token of this OAuth2CustomMapperConfig. # noqa: E501 + :type: bool + """ + + self._send_token = send_token + + @property + def url(self): + """Gets the url of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OAuth2CustomMapperConfig. + + + :param url: The url of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def username(self): + """Gets the username of this OAuth2CustomMapperConfig. # noqa: E501 + + + :return: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this OAuth2CustomMapperConfig. + + + :param username: The username of this OAuth2CustomMapperConfig. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2CustomMapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2CustomMapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_domain_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_domain_info.py new file mode 100644 index 0000000..7fe98b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_domain_info.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2DomainInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'scheme': 'str' + } + + attribute_map = { + 'name': 'name', + 'scheme': 'scheme' + } + + def __init__(self, name=None, scheme=None): # noqa: E501 + """OAuth2DomainInfo - a model defined in Swagger""" # noqa: E501 + self._name = None + self._scheme = None + self.discriminator = None + self.name = name + self.scheme = scheme + + @property + def name(self): + """Gets the name of this OAuth2DomainInfo. # noqa: E501 + + Domain name. Cannot be empty # noqa: E501 + + :return: The name of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this OAuth2DomainInfo. + + Domain name. Cannot be empty # noqa: E501 + + :param name: The name of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def scheme(self): + """Gets the scheme of this OAuth2DomainInfo. # noqa: E501 + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :return: The scheme of this OAuth2DomainInfo. # noqa: E501 + :rtype: str + """ + return self._scheme + + @scheme.setter + def scheme(self, scheme): + """Sets the scheme of this OAuth2DomainInfo. + + Domain scheme. Mixed scheme means than both HTTP and HTTPS are going to be used # noqa: E501 + + :param scheme: The scheme of this OAuth2DomainInfo. # noqa: E501 + :type: str + """ + if scheme is None: + raise ValueError("Invalid value for `scheme`, must not be `None`") # noqa: E501 + allowed_values = ["HTTP", "HTTPS", "MIXED"] # noqa: E501 + if scheme not in allowed_values: + raise ValueError( + "Invalid value for `scheme` ({0}), must be one of {1}" # noqa: E501 + .format(scheme, allowed_values) + ) + + self._scheme = scheme + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2DomainInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2DomainInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_info.py new file mode 100644 index 0000000..0f1439b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_info.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2Info(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'enabled': 'bool', + 'oauth2_params_infos': 'list[OAuth2ParamsInfo]' + } + + attribute_map = { + 'enabled': 'enabled', + 'oauth2_params_infos': 'oauth2ParamsInfos' + } + + def __init__(self, enabled=None, oauth2_params_infos=None): # noqa: E501 + """OAuth2Info - a model defined in Swagger""" # noqa: E501 + self._enabled = None + self._oauth2_params_infos = None + self.discriminator = None + if enabled is not None: + self.enabled = enabled + self.oauth2_params_infos = oauth2_params_infos + + @property + def enabled(self): + """Gets the enabled of this OAuth2Info. # noqa: E501 + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :return: The enabled of this OAuth2Info. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this OAuth2Info. + + Whether OAuth2 settings are enabled or not # noqa: E501 + + :param enabled: The enabled of this OAuth2Info. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def oauth2_params_infos(self): + """Gets the oauth2_params_infos of this OAuth2Info. # noqa: E501 + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :return: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :rtype: list[OAuth2ParamsInfo] + """ + return self._oauth2_params_infos + + @oauth2_params_infos.setter + def oauth2_params_infos(self, oauth2_params_infos): + """Sets the oauth2_params_infos of this OAuth2Info. + + List of configured OAuth2 clients. Cannot contain null values # noqa: E501 + + :param oauth2_params_infos: The oauth2_params_infos of this OAuth2Info. # noqa: E501 + :type: list[OAuth2ParamsInfo] + """ + if oauth2_params_infos is None: + raise ValueError("Invalid value for `oauth2_params_infos`, must not be `None`") # noqa: E501 + + self._oauth2_params_infos = oauth2_params_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2Info, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2Info): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_mapper_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_mapper_config.py new file mode 100644 index 0000000..d874927 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_mapper_config.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MapperConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'activate_user': 'bool', + 'allow_user_creation': 'bool', + 'basic': 'OAuth2BasicMapperConfig', + 'custom': 'OAuth2CustomMapperConfig', + 'type': 'str' + } + + attribute_map = { + 'activate_user': 'activateUser', + 'allow_user_creation': 'allowUserCreation', + 'basic': 'basic', + 'custom': 'custom', + 'type': 'type' + } + + def __init__(self, activate_user=None, allow_user_creation=None, basic=None, custom=None, type=None): # noqa: E501 + """OAuth2MapperConfig - a model defined in Swagger""" # noqa: E501 + self._activate_user = None + self._allow_user_creation = None + self._basic = None + self._custom = None + self._type = None + self.discriminator = None + if activate_user is not None: + self.activate_user = activate_user + if allow_user_creation is not None: + self.allow_user_creation = allow_user_creation + if basic is not None: + self.basic = basic + if custom is not None: + self.custom = custom + self.type = type + + @property + def activate_user(self): + """Gets the activate_user of this OAuth2MapperConfig. # noqa: E501 + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :return: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._activate_user + + @activate_user.setter + def activate_user(self, activate_user): + """Sets the activate_user of this OAuth2MapperConfig. + + Whether user credentials should be activated when user is created after successful authentication # noqa: E501 + + :param activate_user: The activate_user of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._activate_user = activate_user + + @property + def allow_user_creation(self): + """Gets the allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :return: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :rtype: bool + """ + return self._allow_user_creation + + @allow_user_creation.setter + def allow_user_creation(self, allow_user_creation): + """Sets the allow_user_creation of this OAuth2MapperConfig. + + Whether user should be created if not yet present on the platform after successful authentication # noqa: E501 + + :param allow_user_creation: The allow_user_creation of this OAuth2MapperConfig. # noqa: E501 + :type: bool + """ + + self._allow_user_creation = allow_user_creation + + @property + def basic(self): + """Gets the basic of this OAuth2MapperConfig. # noqa: E501 + + + :return: The basic of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2BasicMapperConfig + """ + return self._basic + + @basic.setter + def basic(self, basic): + """Sets the basic of this OAuth2MapperConfig. + + + :param basic: The basic of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2BasicMapperConfig + """ + + self._basic = basic + + @property + def custom(self): + """Gets the custom of this OAuth2MapperConfig. # noqa: E501 + + + :return: The custom of this OAuth2MapperConfig. # noqa: E501 + :rtype: OAuth2CustomMapperConfig + """ + return self._custom + + @custom.setter + def custom(self, custom): + """Sets the custom of this OAuth2MapperConfig. + + + :param custom: The custom of this OAuth2MapperConfig. # noqa: E501 + :type: OAuth2CustomMapperConfig + """ + + self._custom = custom + + @property + def type(self): + """Gets the type of this OAuth2MapperConfig. # noqa: E501 + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :return: The type of this OAuth2MapperConfig. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OAuth2MapperConfig. + + Type of OAuth2 mapper. Depending on this param, different mapper config fields must be specified # noqa: E501 + + :param type: The type of this OAuth2MapperConfig. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["APPLE", "BASIC", "CUSTOM", "GITHUB"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MapperConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MapperConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_mobile_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_mobile_info.py new file mode 100644 index 0000000..c6c6238 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_mobile_info.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2MobileInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'app_secret': 'str', + 'pkg_name': 'str' + } + + attribute_map = { + 'app_secret': 'appSecret', + 'pkg_name': 'pkgName' + } + + def __init__(self, app_secret=None, pkg_name=None): # noqa: E501 + """OAuth2MobileInfo - a model defined in Swagger""" # noqa: E501 + self._app_secret = None + self._pkg_name = None + self.discriminator = None + self.app_secret = app_secret + self.pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this OAuth2MobileInfo. # noqa: E501 + + Application secret. The length must be at least 16 characters # noqa: E501 + + :return: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this OAuth2MobileInfo. + + Application secret. The length must be at least 16 characters # noqa: E501 + + :param app_secret: The app_secret of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if app_secret is None: + raise ValueError("Invalid value for `app_secret`, must not be `None`") # noqa: E501 + + self._app_secret = app_secret + + @property + def pkg_name(self): + """Gets the pkg_name of this OAuth2MobileInfo. # noqa: E501 + + Application package name. Cannot be empty # noqa: E501 + + :return: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this OAuth2MobileInfo. + + Application package name. Cannot be empty # noqa: E501 + + :param pkg_name: The pkg_name of this OAuth2MobileInfo. # noqa: E501 + :type: str + """ + if pkg_name is None: + raise ValueError("Invalid value for `pkg_name`, must not be `None`") # noqa: E501 + + self._pkg_name = pkg_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2MobileInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2MobileInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_params_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_params_info.py new file mode 100644 index 0000000..879921c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_params_info.py @@ -0,0 +1,185 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2ParamsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_registrations': 'list[OAuth2RegistrationInfo]', + 'domain_infos': 'list[OAuth2DomainInfo]', + 'mobile_infos': 'list[OAuth2MobileInfo]' + } + + attribute_map = { + 'client_registrations': 'clientRegistrations', + 'domain_infos': 'domainInfos', + 'mobile_infos': 'mobileInfos' + } + + def __init__(self, client_registrations=None, domain_infos=None, mobile_infos=None): # noqa: E501 + """OAuth2ParamsInfo - a model defined in Swagger""" # noqa: E501 + self._client_registrations = None + self._domain_infos = None + self._mobile_infos = None + self.discriminator = None + self.client_registrations = client_registrations + self.domain_infos = domain_infos + self.mobile_infos = mobile_infos + + @property + def client_registrations(self): + """Gets the client_registrations of this OAuth2ParamsInfo. # noqa: E501 + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :return: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2RegistrationInfo] + """ + return self._client_registrations + + @client_registrations.setter + def client_registrations(self, client_registrations): + """Sets the client_registrations of this OAuth2ParamsInfo. + + List of OAuth2 provider settings. Cannot be empty # noqa: E501 + + :param client_registrations: The client_registrations of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2RegistrationInfo] + """ + if client_registrations is None: + raise ValueError("Invalid value for `client_registrations`, must not be `None`") # noqa: E501 + + self._client_registrations = client_registrations + + @property + def domain_infos(self): + """Gets the domain_infos of this OAuth2ParamsInfo. # noqa: E501 + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :return: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2DomainInfo] + """ + return self._domain_infos + + @domain_infos.setter + def domain_infos(self, domain_infos): + """Sets the domain_infos of this OAuth2ParamsInfo. + + List of configured domains where OAuth2 platform will redirect a user after successful authentication. Cannot be empty. There have to be only one domain with specific name with scheme type 'MIXED'. Configured domains with the same name must have different scheme types # noqa: E501 + + :param domain_infos: The domain_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2DomainInfo] + """ + if domain_infos is None: + raise ValueError("Invalid value for `domain_infos`, must not be `None`") # noqa: E501 + + self._domain_infos = domain_infos + + @property + def mobile_infos(self): + """Gets the mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :return: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :rtype: list[OAuth2MobileInfo] + """ + return self._mobile_infos + + @mobile_infos.setter + def mobile_infos(self, mobile_infos): + """Sets the mobile_infos of this OAuth2ParamsInfo. + + Mobile applications settings. Application package name must be unique within the list # noqa: E501 + + :param mobile_infos: The mobile_infos of this OAuth2ParamsInfo. # noqa: E501 + :type: list[OAuth2MobileInfo] + """ + if mobile_infos is None: + raise ValueError("Invalid value for `mobile_infos`, must not be `None`") # noqa: E501 + + self._mobile_infos = mobile_infos + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2ParamsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2ParamsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_registration_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_registration_info.py new file mode 100644 index 0000000..553b1b2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/o_auth2_registration_info.py @@ -0,0 +1,502 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OAuth2RegistrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'access_token_uri': 'str', + 'additional_info': 'JsonNode', + 'authorization_uri': 'str', + 'client_authentication_method': 'str', + 'client_id': 'str', + 'client_secret': 'str', + 'jwk_set_uri': 'str', + 'login_button_icon': 'str', + 'login_button_label': 'str', + 'mapper_config': 'OAuth2MapperConfig', + 'platforms': 'list[str]', + 'scope': 'list[str]', + 'user_info_uri': 'str', + 'user_name_attribute_name': 'str' + } + + attribute_map = { + 'access_token_uri': 'accessTokenUri', + 'additional_info': 'additionalInfo', + 'authorization_uri': 'authorizationUri', + 'client_authentication_method': 'clientAuthenticationMethod', + 'client_id': 'clientId', + 'client_secret': 'clientSecret', + 'jwk_set_uri': 'jwkSetUri', + 'login_button_icon': 'loginButtonIcon', + 'login_button_label': 'loginButtonLabel', + 'mapper_config': 'mapperConfig', + 'platforms': 'platforms', + 'scope': 'scope', + 'user_info_uri': 'userInfoUri', + 'user_name_attribute_name': 'userNameAttributeName' + } + + def __init__(self, access_token_uri=None, additional_info=None, authorization_uri=None, client_authentication_method=None, client_id=None, client_secret=None, jwk_set_uri=None, login_button_icon=None, login_button_label=None, mapper_config=None, platforms=None, scope=None, user_info_uri=None, user_name_attribute_name=None): # noqa: E501 + """OAuth2RegistrationInfo - a model defined in Swagger""" # noqa: E501 + self._access_token_uri = None + self._additional_info = None + self._authorization_uri = None + self._client_authentication_method = None + self._client_id = None + self._client_secret = None + self._jwk_set_uri = None + self._login_button_icon = None + self._login_button_label = None + self._mapper_config = None + self._platforms = None + self._scope = None + self._user_info_uri = None + self._user_name_attribute_name = None + self.discriminator = None + self.access_token_uri = access_token_uri + self.additional_info = additional_info + self.authorization_uri = authorization_uri + self.client_authentication_method = client_authentication_method + self.client_id = client_id + self.client_secret = client_secret + if jwk_set_uri is not None: + self.jwk_set_uri = jwk_set_uri + if login_button_icon is not None: + self.login_button_icon = login_button_icon + self.login_button_label = login_button_label + self.mapper_config = mapper_config + if platforms is not None: + self.platforms = platforms + self.scope = scope + if user_info_uri is not None: + self.user_info_uri = user_info_uri + if user_name_attribute_name is not None: + self.user_name_attribute_name = user_name_attribute_name + + @property + def access_token_uri(self): + """Gets the access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._access_token_uri + + @access_token_uri.setter + def access_token_uri(self, access_token_uri): + """Sets the access_token_uri of this OAuth2RegistrationInfo. + + Access token URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param access_token_uri: The access_token_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if access_token_uri is None: + raise ValueError("Invalid value for `access_token_uri`, must not be `None`") # noqa: E501 + + self._access_token_uri = access_token_uri + + @property + def additional_info(self): + """Gets the additional_info of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OAuth2RegistrationInfo. + + + :param additional_info: The additional_info of this OAuth2RegistrationInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def authorization_uri(self): + """Gets the authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :return: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._authorization_uri + + @authorization_uri.setter + def authorization_uri(self, authorization_uri): + """Sets the authorization_uri of this OAuth2RegistrationInfo. + + Authorization URI of the OAuth2 provider. Cannot be empty # noqa: E501 + + :param authorization_uri: The authorization_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if authorization_uri is None: + raise ValueError("Invalid value for `authorization_uri`, must not be `None`") # noqa: E501 + + self._authorization_uri = authorization_uri + + @property + def client_authentication_method(self): + """Gets the client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :return: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_authentication_method + + @client_authentication_method.setter + def client_authentication_method(self, client_authentication_method): + """Sets the client_authentication_method of this OAuth2RegistrationInfo. + + Client authentication method to use: 'BASIC' or 'POST'. Cannot be empty # noqa: E501 + + :param client_authentication_method: The client_authentication_method of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_authentication_method is None: + raise ValueError("Invalid value for `client_authentication_method`, must not be `None`") # noqa: E501 + + self._client_authentication_method = client_authentication_method + + @property + def client_id(self): + """Gets the client_id of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :return: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_id + + @client_id.setter + def client_id(self, client_id): + """Sets the client_id of this OAuth2RegistrationInfo. + + OAuth2 client ID. Cannot be empty # noqa: E501 + + :param client_id: The client_id of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_id is None: + raise ValueError("Invalid value for `client_id`, must not be `None`") # noqa: E501 + + self._client_id = client_id + + @property + def client_secret(self): + """Gets the client_secret of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :return: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._client_secret + + @client_secret.setter + def client_secret(self, client_secret): + """Sets the client_secret of this OAuth2RegistrationInfo. + + OAuth2 client secret. Cannot be empty # noqa: E501 + + :param client_secret: The client_secret of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if client_secret is None: + raise ValueError("Invalid value for `client_secret`, must not be `None`") # noqa: E501 + + self._client_secret = client_secret + + @property + def jwk_set_uri(self): + """Gets the jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :return: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._jwk_set_uri + + @jwk_set_uri.setter + def jwk_set_uri(self, jwk_set_uri): + """Sets the jwk_set_uri of this OAuth2RegistrationInfo. + + JSON Web Key URI of the OAuth2 provider # noqa: E501 + + :param jwk_set_uri: The jwk_set_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._jwk_set_uri = jwk_set_uri + + @property + def login_button_icon(self): + """Gets the login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + + Log in button icon for OAuth2 provider # noqa: E501 + + :return: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_icon + + @login_button_icon.setter + def login_button_icon(self, login_button_icon): + """Sets the login_button_icon of this OAuth2RegistrationInfo. + + Log in button icon for OAuth2 provider # noqa: E501 + + :param login_button_icon: The login_button_icon of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._login_button_icon = login_button_icon + + @property + def login_button_label(self): + """Gets the login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :return: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._login_button_label + + @login_button_label.setter + def login_button_label(self, login_button_label): + """Sets the login_button_label of this OAuth2RegistrationInfo. + + OAuth2 provider label. Cannot be empty # noqa: E501 + + :param login_button_label: The login_button_label of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + if login_button_label is None: + raise ValueError("Invalid value for `login_button_label`, must not be `None`") # noqa: E501 + + self._login_button_label = login_button_label + + @property + def mapper_config(self): + """Gets the mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + + + :return: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: OAuth2MapperConfig + """ + return self._mapper_config + + @mapper_config.setter + def mapper_config(self, mapper_config): + """Sets the mapper_config of this OAuth2RegistrationInfo. + + + :param mapper_config: The mapper_config of this OAuth2RegistrationInfo. # noqa: E501 + :type: OAuth2MapperConfig + """ + if mapper_config is None: + raise ValueError("Invalid value for `mapper_config`, must not be `None`") # noqa: E501 + + self._mapper_config = mapper_config + + @property + def platforms(self): + """Gets the platforms of this OAuth2RegistrationInfo. # noqa: E501 + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :return: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._platforms + + @platforms.setter + def platforms(self, platforms): + """Sets the platforms of this OAuth2RegistrationInfo. + + List of platforms for which usage of the OAuth2 client is allowed (empty for all allowed) # noqa: E501 + + :param platforms: The platforms of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ANDROID", "IOS", "WEB"] # noqa: E501 + if not set(platforms).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `platforms` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(platforms) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._platforms = platforms + + @property + def scope(self): + """Gets the scope of this OAuth2RegistrationInfo. # noqa: E501 + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :return: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: list[str] + """ + return self._scope + + @scope.setter + def scope(self, scope): + """Sets the scope of this OAuth2RegistrationInfo. + + OAuth scopes that will be requested from OAuth2 platform. Cannot be empty # noqa: E501 + + :param scope: The scope of this OAuth2RegistrationInfo. # noqa: E501 + :type: list[str] + """ + if scope is None: + raise ValueError("Invalid value for `scope`, must not be `None`") # noqa: E501 + + self._scope = scope + + @property + def user_info_uri(self): + """Gets the user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + + User info URI of the OAuth2 provider # noqa: E501 + + :return: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_info_uri + + @user_info_uri.setter + def user_info_uri(self, user_info_uri): + """Sets the user_info_uri of this OAuth2RegistrationInfo. + + User info URI of the OAuth2 provider # noqa: E501 + + :param user_info_uri: The user_info_uri of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_info_uri = user_info_uri + + @property + def user_name_attribute_name(self): + """Gets the user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :return: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :rtype: str + """ + return self._user_name_attribute_name + + @user_name_attribute_name.setter + def user_name_attribute_name(self, user_name_attribute_name): + """Sets the user_name_attribute_name of this OAuth2RegistrationInfo. + + Name of the username attribute in OAuth2 provider response. Cannot be empty # noqa: E501 + + :param user_name_attribute_name: The user_name_attribute_name of this OAuth2RegistrationInfo. # noqa: E501 + :type: str + """ + + self._user_name_attribute_name = user_name_attribute_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OAuth2RegistrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OAuth2RegistrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/object_attributes.py b/tb-rest-client/python/tb_rest_client/models/models_pe/object_attributes.py new file mode 100644 index 0000000..61ac821 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/object_attributes.py @@ -0,0 +1,280 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectAttributes(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dim': 'int', + 'gt': 'float', + 'lt': 'float', + 'pmax': 'int', + 'pmin': 'int', + 'st': 'float', + 'ver': 'str' + } + + attribute_map = { + 'dim': 'dim', + 'gt': 'gt', + 'lt': 'lt', + 'pmax': 'pmax', + 'pmin': 'pmin', + 'st': 'st', + 'ver': 'ver' + } + + def __init__(self, dim=None, gt=None, lt=None, pmax=None, pmin=None, st=None, ver=None): # noqa: E501 + """ObjectAttributes - a model defined in Swagger""" # noqa: E501 + self._dim = None + self._gt = None + self._lt = None + self._pmax = None + self._pmin = None + self._st = None + self._ver = None + self.discriminator = None + if dim is not None: + self.dim = dim + if gt is not None: + self.gt = gt + if lt is not None: + self.lt = lt + if pmax is not None: + self.pmax = pmax + if pmin is not None: + self.pmin = pmin + if st is not None: + self.st = st + if ver is not None: + self.ver = ver + + @property + def dim(self): + """Gets the dim of this ObjectAttributes. # noqa: E501 + + + :return: The dim of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._dim + + @dim.setter + def dim(self, dim): + """Sets the dim of this ObjectAttributes. + + + :param dim: The dim of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._dim = dim + + @property + def gt(self): + """Gets the gt of this ObjectAttributes. # noqa: E501 + + + :return: The gt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._gt + + @gt.setter + def gt(self, gt): + """Sets the gt of this ObjectAttributes. + + + :param gt: The gt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._gt = gt + + @property + def lt(self): + """Gets the lt of this ObjectAttributes. # noqa: E501 + + + :return: The lt of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._lt + + @lt.setter + def lt(self, lt): + """Sets the lt of this ObjectAttributes. + + + :param lt: The lt of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._lt = lt + + @property + def pmax(self): + """Gets the pmax of this ObjectAttributes. # noqa: E501 + + + :return: The pmax of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmax + + @pmax.setter + def pmax(self, pmax): + """Sets the pmax of this ObjectAttributes. + + + :param pmax: The pmax of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmax = pmax + + @property + def pmin(self): + """Gets the pmin of this ObjectAttributes. # noqa: E501 + + + :return: The pmin of this ObjectAttributes. # noqa: E501 + :rtype: int + """ + return self._pmin + + @pmin.setter + def pmin(self, pmin): + """Sets the pmin of this ObjectAttributes. + + + :param pmin: The pmin of this ObjectAttributes. # noqa: E501 + :type: int + """ + + self._pmin = pmin + + @property + def st(self): + """Gets the st of this ObjectAttributes. # noqa: E501 + + + :return: The st of this ObjectAttributes. # noqa: E501 + :rtype: float + """ + return self._st + + @st.setter + def st(self, st): + """Sets the st of this ObjectAttributes. + + + :param st: The st of this ObjectAttributes. # noqa: E501 + :type: float + """ + + self._st = st + + @property + def ver(self): + """Gets the ver of this ObjectAttributes. # noqa: E501 + + + :return: The ver of this ObjectAttributes. # noqa: E501 + :rtype: str + """ + return self._ver + + @ver.setter + def ver(self, ver): + """Sets the ver of this ObjectAttributes. + + + :param ver: The ver of this ObjectAttributes. # noqa: E501 + :type: str + """ + + self._ver = ver + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectAttributes, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectAttributes): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/object_node.py b/tb-rest-client/python/tb_rest_client/models/models_pe/object_node.py new file mode 100644 index 0000000..ad354da --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/object_node.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ObjectNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """ObjectNode - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ObjectNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ObjectNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/originator_entity_owner_users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/originator_entity_owner_users_filter.py new file mode 100644 index 0000000..9e8a3c8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/originator_entity_owner_users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OriginatorEntityOwnerUsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """OriginatorEntityOwnerUsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OriginatorEntityOwnerUsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OriginatorEntityOwnerUsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package.py b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package.py new file mode 100644 index 0000000..bf480a5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package.py @@ -0,0 +1,576 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'data': 'ByteBuffer', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'data': 'data', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, data=None, additional_info=None): # noqa: E501 + """OtaPackage - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._data = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if data is not None: + self.data = data + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackage. # noqa: E501 + + + :return: The id of this OtaPackage. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackage. + + + :param id: The id of this OtaPackage. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackage. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackage. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackage. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackage. # noqa: E501 + + + :return: The tenant_id of this OtaPackage. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackage. + + + :param tenant_id: The tenant_id of this OtaPackage. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackage. # noqa: E501 + + + :return: The device_profile_id of this OtaPackage. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackage. + + + :param device_profile_id: The device_profile_id of this OtaPackage. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackage. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackage. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackage. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackage. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackage. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackage. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackage. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackage. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackage. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackage. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackage. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackage. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackage. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackage. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackage. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackage. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackage. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackage. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackage. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackage. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackage. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackage. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackage. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackage. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackage. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackage. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackage. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackage. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackage. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackage. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackage. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackage. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackage. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackage. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackage. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def data(self): + """Gets the data of this OtaPackage. # noqa: E501 + + + :return: The data of this OtaPackage. # noqa: E501 + :rtype: ByteBuffer + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this OtaPackage. + + + :param data: The data of this OtaPackage. # noqa: E501 + :type: ByteBuffer + """ + + self._data = data + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackage. # noqa: E501 + + + :return: The additional_info of this OtaPackage. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackage. + + + :param additional_info: The additional_info of this OtaPackage. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_id.py new file mode 100644 index 0000000..b014418 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """OtaPackageId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this OtaPackageId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this OtaPackageId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this OtaPackageId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this OtaPackageId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this OtaPackageId. + + string # noqa: E501 + + :param entity_type: The entity_type of this OtaPackageId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["OTA_PACKAGE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_info.py new file mode 100644 index 0000000..1d66159 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_info.py @@ -0,0 +1,550 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, additional_info=None): # noqa: E501 + """OtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this OtaPackageInfo. # noqa: E501 + + + :return: The id of this OtaPackageInfo. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this OtaPackageInfo. + + + :param id: The id of this OtaPackageInfo. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this OtaPackageInfo. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this OtaPackageInfo. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this OtaPackageInfo. # noqa: E501 + + + :return: The tenant_id of this OtaPackageInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this OtaPackageInfo. + + + :param tenant_id: The tenant_id of this OtaPackageInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this OtaPackageInfo. # noqa: E501 + + + :return: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this OtaPackageInfo. + + + :param device_profile_id: The device_profile_id of this OtaPackageInfo. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this OtaPackageInfo. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this OtaPackageInfo. + + OTA Package type. # noqa: E501 + + :param type: The type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this OtaPackageInfo. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this OtaPackageInfo. + + OTA Package title. # noqa: E501 + + :param title: The title of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this OtaPackageInfo. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this OtaPackageInfo. + + OTA Package version. # noqa: E501 + + :param version: The version of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this OtaPackageInfo. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this OtaPackageInfo. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this OtaPackageInfo. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this OtaPackageInfo. + + OTA Package url. # noqa: E501 + + :param url: The url of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this OtaPackageInfo. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this OtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this OtaPackageInfo. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this OtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this OtaPackageInfo. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this OtaPackageInfo. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this OtaPackageInfo. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this OtaPackageInfo. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageInfo. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageInfo. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this OtaPackageInfo. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this OtaPackageInfo. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageInfo. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this OtaPackageInfo. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this OtaPackageInfo. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this OtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this OtaPackageInfo. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this OtaPackageInfo. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def additional_info(self): + """Gets the additional_info of this OtaPackageInfo. # noqa: E501 + + + :return: The additional_info of this OtaPackageInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this OtaPackageInfo. + + + :param additional_info: The additional_info of this OtaPackageInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_ota_package_id_body.py b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_ota_package_id_body.py new file mode 100644 index 0000000..4cde49f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/ota_package_ota_package_id_body.py @@ -0,0 +1,184 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtaPackageOtaPackageIdBody(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'checksum': 'str', + 'checksum_algorithm': 'str', + 'file': 'str' + } + + attribute_map = { + 'checksum': 'checksum', + 'checksum_algorithm': 'checksumAlgorithm', + 'file': 'file' + } + + def __init__(self, checksum=None, checksum_algorithm=None, file=None): # noqa: E501 + """OtaPackageOtaPackageIdBody - a model defined in Swagger""" # noqa: E501 + self._checksum = None + self._checksum_algorithm = None + self._file = None + self.discriminator = None + if checksum is not None: + self.checksum = checksum + self.checksum_algorithm = checksum_algorithm + self.file = file + + @property + def checksum(self): + """Gets the checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :return: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this OtaPackageOtaPackageIdBody. + + OTA Package checksum. For example, '0xd87f7e0c' # noqa: E501 + + :param checksum: The checksum of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this OtaPackageOtaPackageIdBody. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if checksum_algorithm is None: + raise ValueError("Invalid value for `checksum_algorithm`, must not be `None`") # noqa: E501 + + self._checksum_algorithm = checksum_algorithm + + @property + def file(self): + """Gets the file of this OtaPackageOtaPackageIdBody. # noqa: E501 + + OTA Package data. # noqa: E501 + + :return: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this OtaPackageOtaPackageIdBody. + + OTA Package data. # noqa: E501 + + :param file: The file of this OtaPackageOtaPackageIdBody. # noqa: E501 + :type: str + """ + if file is None: + raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501 + + self._file = file + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtaPackageOtaPackageIdBody, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtaPackageOtaPackageIdBody): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/other_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/other_configuration.py new file mode 100644 index 0000000..3a97795 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/other_configuration.py @@ -0,0 +1,338 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class OtherConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'client_only_observe_after_connect': 'int', + 'edrx_cycle': 'int', + 'fw_update_resource': 'str', + 'fw_update_strategy': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int', + 'sw_update_resource': 'str', + 'sw_update_strategy': 'int' + } + + attribute_map = { + 'client_only_observe_after_connect': 'clientOnlyObserveAfterConnect', + 'edrx_cycle': 'edrxCycle', + 'fw_update_resource': 'fwUpdateResource', + 'fw_update_strategy': 'fwUpdateStrategy', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer', + 'sw_update_resource': 'swUpdateResource', + 'sw_update_strategy': 'swUpdateStrategy' + } + + def __init__(self, client_only_observe_after_connect=None, edrx_cycle=None, fw_update_resource=None, fw_update_strategy=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None, sw_update_resource=None, sw_update_strategy=None): # noqa: E501 + """OtherConfiguration - a model defined in Swagger""" # noqa: E501 + self._client_only_observe_after_connect = None + self._edrx_cycle = None + self._fw_update_resource = None + self._fw_update_strategy = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self._sw_update_resource = None + self._sw_update_strategy = None + self.discriminator = None + if client_only_observe_after_connect is not None: + self.client_only_observe_after_connect = client_only_observe_after_connect + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if fw_update_resource is not None: + self.fw_update_resource = fw_update_resource + if fw_update_strategy is not None: + self.fw_update_strategy = fw_update_strategy + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + if sw_update_resource is not None: + self.sw_update_resource = sw_update_resource + if sw_update_strategy is not None: + self.sw_update_strategy = sw_update_strategy + + @property + def client_only_observe_after_connect(self): + """Gets the client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + + + :return: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._client_only_observe_after_connect + + @client_only_observe_after_connect.setter + def client_only_observe_after_connect(self, client_only_observe_after_connect): + """Sets the client_only_observe_after_connect of this OtherConfiguration. + + + :param client_only_observe_after_connect: The client_only_observe_after_connect of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._client_only_observe_after_connect = client_only_observe_after_connect + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this OtherConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this OtherConfiguration. + + + :param edrx_cycle: The edrx_cycle of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def fw_update_resource(self): + """Gets the fw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._fw_update_resource + + @fw_update_resource.setter + def fw_update_resource(self, fw_update_resource): + """Sets the fw_update_resource of this OtherConfiguration. + + + :param fw_update_resource: The fw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._fw_update_resource = fw_update_resource + + @property + def fw_update_strategy(self): + """Gets the fw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._fw_update_strategy + + @fw_update_strategy.setter + def fw_update_strategy(self, fw_update_strategy): + """Sets the fw_update_strategy of this OtherConfiguration. + + + :param fw_update_strategy: The fw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._fw_update_strategy = fw_update_strategy + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this OtherConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this OtherConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this OtherConfiguration. # noqa: E501 + + + :return: The power_mode of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this OtherConfiguration. + + + :param power_mode: The power_mode of this OtherConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this OtherConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this OtherConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + @property + def sw_update_resource(self): + """Gets the sw_update_resource of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :rtype: str + """ + return self._sw_update_resource + + @sw_update_resource.setter + def sw_update_resource(self, sw_update_resource): + """Sets the sw_update_resource of this OtherConfiguration. + + + :param sw_update_resource: The sw_update_resource of this OtherConfiguration. # noqa: E501 + :type: str + """ + + self._sw_update_resource = sw_update_resource + + @property + def sw_update_strategy(self): + """Gets the sw_update_strategy of this OtherConfiguration. # noqa: E501 + + + :return: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :rtype: int + """ + return self._sw_update_strategy + + @sw_update_strategy.setter + def sw_update_strategy(self, sw_update_strategy): + """Sets the sw_update_strategy of this OtherConfiguration. + + + :param sw_update_strategy: The sw_update_strategy of this OtherConfiguration. # noqa: E501 + :type: int + """ + + self._sw_update_strategy = sw_update_strategy + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(OtherConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, OtherConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_blob_entity_with_customer_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_blob_entity_with_customer_info.py new file mode 100644 index 0000000..af1633a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_blob_entity_with_customer_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataBlobEntityWithCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[BlobEntityWithCustomerInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataBlobEntityWithCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: list[BlobEntityWithCustomerInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataBlobEntityWithCustomerInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: list[BlobEntityWithCustomerInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataBlobEntityWithCustomerInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataBlobEntityWithCustomerInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataBlobEntityWithCustomerInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataBlobEntityWithCustomerInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataBlobEntityWithCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataBlobEntityWithCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_contact_basedobject.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_contact_basedobject.py new file mode 100644 index 0000000..ea5cf2b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_contact_basedobject.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataContactBasedobject(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[ContactBasedobject]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataContactBasedobject - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataContactBasedobject. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataContactBasedobject. # noqa: E501 + :rtype: list[ContactBasedobject] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataContactBasedobject. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataContactBasedobject. # noqa: E501 + :type: list[ContactBasedobject] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataContactBasedobject. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataContactBasedobject. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataContactBasedobject. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataContactBasedobject. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataContactBasedobject. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataContactBasedobject. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataContactBasedobject. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataContactBasedobject. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataContactBasedobject. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataContactBasedobject. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataContactBasedobject. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataContactBasedobject. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataContactBasedobject, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataContactBasedobject): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_converter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_converter.py new file mode 100644 index 0000000..bb12633 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_converter.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataConverter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Converter]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataConverter - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataConverter. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataConverter. # noqa: E501 + :rtype: list[Converter] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataConverter. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataConverter. # noqa: E501 + :type: list[Converter] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataConverter. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataConverter. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataConverter. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataConverter. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataConverter. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataConverter. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataConverter. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataConverter. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataConverter. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataConverter. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataConverter. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataConverter. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataConverter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataConverter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_customer_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_customer_info.py new file mode 100644 index 0000000..70a1668 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_customer_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[CustomerInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataCustomerInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataCustomerInfo. # noqa: E501 + :rtype: list[CustomerInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataCustomerInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataCustomerInfo. # noqa: E501 + :type: list[CustomerInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataCustomerInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataCustomerInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataCustomerInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataCustomerInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataCustomerInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataCustomerInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataCustomerInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataCustomerInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge.py new file mode 100644 index 0000000..a7b3929 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdge(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Edge]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdge - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdge. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdge. # noqa: E501 + :rtype: list[Edge] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdge. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdge. # noqa: E501 + :type: list[Edge] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdge. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdge. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdge. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdge. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdge. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdge. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdge. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdge. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdge. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdge. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdge, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdge): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge_event.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge_event.py new file mode 100644 index 0000000..093296a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeEvent]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeEvent. # noqa: E501 + :rtype: list[EdgeEvent] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeEvent. # noqa: E501 + :type: list[EdgeEvent] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge_info.py new file mode 100644 index 0000000..9c0d44f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_edge_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEdgeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EdgeInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEdgeInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEdgeInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEdgeInfo. # noqa: E501 + :rtype: list[EdgeInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEdgeInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEdgeInfo. # noqa: E501 + :type: list[EdgeInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEdgeInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEdgeInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEdgeInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEdgeInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEdgeInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEdgeInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEdgeInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEdgeInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEdgeInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEdgeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEdgeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_group.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_group.py new file mode 100644 index 0000000..0bd1f79 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_group.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityGroup(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityGroup]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityGroup - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityGroup. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityGroup. # noqa: E501 + :rtype: list[EntityGroup] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityGroup. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityGroup. # noqa: E501 + :type: list[EntityGroup] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityGroup. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityGroup. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityGroup. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityGroup. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityGroup. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityGroup. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityGroup. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityGroup. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityGroup. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityGroup. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityGroup. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityGroup. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityGroup, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityGroup): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_group_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_group_info.py new file mode 100644 index 0000000..82b3918 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_group_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityGroupInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityGroupInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityGroupInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityGroupInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: list[EntityGroupInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityGroupInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityGroupInfo. # noqa: E501 + :type: list[EntityGroupInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityGroupInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityGroupInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityGroupInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityGroupInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityGroupInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityGroupInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityGroupInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityGroupInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityGroupInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityGroupInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityGroupInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityGroupInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_version.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_version.py new file mode 100644 index 0000000..a26c1db --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_version.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityVersion(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityVersion]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityVersion - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityVersion. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityVersion. # noqa: E501 + :rtype: list[EntityVersion] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityVersion. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityVersion. # noqa: E501 + :type: list[EntityVersion] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityVersion. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityVersion. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityVersion. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityVersion. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityVersion. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityVersion. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityVersion. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityVersion. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityVersion. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityVersion. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityVersion, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityVersion): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_view_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_view_info.py new file mode 100644 index 0000000..7c7fed2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_entity_view_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEntityViewInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EntityViewInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEntityViewInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEntityViewInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEntityViewInfo. # noqa: E501 + :rtype: list[EntityViewInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEntityViewInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEntityViewInfo. # noqa: E501 + :type: list[EntityViewInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEntityViewInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEntityViewInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEntityViewInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEntityViewInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEntityViewInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEntityViewInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEntityViewInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEntityViewInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEntityViewInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEntityViewInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_event.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_event.py new file mode 100644 index 0000000..7a4d5f0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_event.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Event]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEvent - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEvent. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEvent. # noqa: E501 + :rtype: list[Event] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEvent. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEvent. # noqa: E501 + :type: list[Event] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEvent. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEvent. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEvent. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEvent. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEvent. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEvent. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEvent. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEvent. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEvent. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEvent. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_event_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_event_info.py new file mode 100644 index 0000000..4dd244a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_event_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[EventInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataEventInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataEventInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataEventInfo. # noqa: E501 + :rtype: list[EventInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataEventInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataEventInfo. # noqa: E501 + :type: list[EventInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataEventInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataEventInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataEventInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataEventInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataEventInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataEventInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataEventInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataEventInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataEventInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_integration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_integration.py new file mode 100644 index 0000000..2cd4de5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_integration.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataIntegration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Integration]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataIntegration - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataIntegration. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataIntegration. # noqa: E501 + :rtype: list[Integration] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataIntegration. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataIntegration. # noqa: E501 + :type: list[Integration] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataIntegration. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataIntegration. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataIntegration. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataIntegration. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataIntegration. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataIntegration. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataIntegration. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataIntegration. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataIntegration. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataIntegration. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataIntegration. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataIntegration. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataIntegration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataIntegration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_integration_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_integration_info.py new file mode 100644 index 0000000..cf532e4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_integration_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataIntegrationInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[IntegrationInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataIntegrationInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataIntegrationInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataIntegrationInfo. # noqa: E501 + :rtype: list[IntegrationInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataIntegrationInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataIntegrationInfo. # noqa: E501 + :type: list[IntegrationInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataIntegrationInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataIntegrationInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataIntegrationInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataIntegrationInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataIntegrationInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataIntegrationInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataIntegrationInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataIntegrationInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataIntegrationInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataIntegrationInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataIntegrationInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataIntegrationInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataIntegrationInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataIntegrationInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_ota_package_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_ota_package_info.py new file mode 100644 index 0000000..27170d7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_ota_package_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataOtaPackageInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[OtaPackageInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataOtaPackageInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataOtaPackageInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: list[OtaPackageInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataOtaPackageInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataOtaPackageInfo. # noqa: E501 + :type: list[OtaPackageInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataOtaPackageInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataOtaPackageInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataOtaPackageInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataOtaPackageInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataOtaPackageInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataOtaPackageInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataOtaPackageInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataOtaPackageInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataOtaPackageInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_queue.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_queue.py new file mode 100644 index 0000000..ee319f3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_queue.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataQueue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Queue]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataQueue - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataQueue. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataQueue. # noqa: E501 + :rtype: list[Queue] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataQueue. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataQueue. # noqa: E501 + :type: list[Queue] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataQueue. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataQueue. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataQueue. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataQueue. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataQueue. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataQueue. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataQueue. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataQueue. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataQueue. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataQueue. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataQueue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataQueue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_role.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_role.py new file mode 100644 index 0000000..38b734c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_role.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRole(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[Role]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataRole - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataRole. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataRole. # noqa: E501 + :rtype: list[Role] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRole. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataRole. # noqa: E501 + :type: list[Role] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRole. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataRole. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRole. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataRole. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRole. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataRole. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRole. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataRole. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataRole. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataRole. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRole. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataRole. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRole, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRole): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_rule_chain.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_rule_chain.py new file mode 100644 index 0000000..d9f93a9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_rule_chain.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataRuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[RuleChain]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataRuleChain - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataRuleChain. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataRuleChain. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataRuleChain. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataRuleChain. # noqa: E501 + :type: list[RuleChain] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataRuleChain. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataRuleChain. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataRuleChain. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataRuleChain. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataRuleChain. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataRuleChain. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataRuleChain. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataRuleChain. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataRuleChain. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataRuleChain. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataRuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataRuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_scheduler_event_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_scheduler_event_info.py new file mode 100644 index 0000000..6a96fe7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_scheduler_event_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataSchedulerEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[SchedulerEventInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataSchedulerEventInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataSchedulerEventInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: list[SchedulerEventInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataSchedulerEventInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataSchedulerEventInfo. # noqa: E501 + :type: list[SchedulerEventInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataSchedulerEventInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataSchedulerEventInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataSchedulerEventInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataSchedulerEventInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataSchedulerEventInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataSchedulerEventInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataSchedulerEventInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataSchedulerEventInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataSchedulerEventInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataSchedulerEventInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataSchedulerEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataSchedulerEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_short_entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_short_entity_view.py new file mode 100644 index 0000000..c463e1a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_short_entity_view.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataShortEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[ShortEntityView]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataShortEntityView - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataShortEntityView. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataShortEntityView. # noqa: E501 + :rtype: list[ShortEntityView] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataShortEntityView. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataShortEntityView. # noqa: E501 + :type: list[ShortEntityView] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataShortEntityView. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataShortEntityView. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataShortEntityView. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataShortEntityView. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataShortEntityView. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataShortEntityView. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataShortEntityView. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataShortEntityView. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataShortEntityView. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataShortEntityView. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataShortEntityView. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataShortEntityView. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataShortEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataShortEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_tb_resource_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_tb_resource_info.py new file mode 100644 index 0000000..23e3b00 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_tb_resource_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataTbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[TbResourceInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataTbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataTbResourceInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataTbResourceInfo. # noqa: E501 + :rtype: list[TbResourceInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataTbResourceInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataTbResourceInfo. # noqa: E501 + :type: list[TbResourceInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataTbResourceInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataTbResourceInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataTbResourceInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataTbResourceInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataTbResourceInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataTbResourceInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataTbResourceInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataTbResourceInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataTbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataTbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_user_email_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_user_email_info.py new file mode 100644 index 0000000..3a14aa3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_user_email_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[UserEmailInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUserEmailInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUserEmailInfo. # noqa: E501 + :rtype: list[UserEmailInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUserEmailInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUserEmailInfo. # noqa: E501 + :type: list[UserEmailInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUserEmailInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUserEmailInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUserEmailInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUserEmailInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUserEmailInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUserEmailInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUserEmailInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUserEmailInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_user_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_user_info.py new file mode 100644 index 0000000..60a6106 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/page_data_user_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PageDataUserInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data': 'list[UserInfo]', + 'total_pages': 'int', + 'total_elements': 'int', + 'has_next': 'bool' + } + + attribute_map = { + 'data': 'data', + 'total_pages': 'totalPages', + 'total_elements': 'totalElements', + 'has_next': 'hasNext' + } + + def __init__(self, data=None, total_pages=None, total_elements=None, has_next=None): # noqa: E501 + """PageDataUserInfo - a model defined in Swagger""" # noqa: E501 + self._data = None + self._total_pages = None + self._total_elements = None + self._has_next = None + self.discriminator = None + if data is not None: + self.data = data + if total_pages is not None: + self.total_pages = total_pages + if total_elements is not None: + self.total_elements = total_elements + if has_next is not None: + self.has_next = has_next + + @property + def data(self): + """Gets the data of this PageDataUserInfo. # noqa: E501 + + Array of the entities # noqa: E501 + + :return: The data of this PageDataUserInfo. # noqa: E501 + :rtype: list[UserInfo] + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this PageDataUserInfo. + + Array of the entities # noqa: E501 + + :param data: The data of this PageDataUserInfo. # noqa: E501 + :type: list[UserInfo] + """ + + self._data = data + + @property + def total_pages(self): + """Gets the total_pages of this PageDataUserInfo. # noqa: E501 + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :return: The total_pages of this PageDataUserInfo. # noqa: E501 + :rtype: int + """ + return self._total_pages + + @total_pages.setter + def total_pages(self, total_pages): + """Sets the total_pages of this PageDataUserInfo. + + Total number of available pages. Calculated based on the 'pageSize' request parameter and total number of entities that match search criteria # noqa: E501 + + :param total_pages: The total_pages of this PageDataUserInfo. # noqa: E501 + :type: int + """ + + self._total_pages = total_pages + + @property + def total_elements(self): + """Gets the total_elements of this PageDataUserInfo. # noqa: E501 + + Total number of elements in all available pages # noqa: E501 + + :return: The total_elements of this PageDataUserInfo. # noqa: E501 + :rtype: int + """ + return self._total_elements + + @total_elements.setter + def total_elements(self, total_elements): + """Sets the total_elements of this PageDataUserInfo. + + Total number of elements in all available pages # noqa: E501 + + :param total_elements: The total_elements of this PageDataUserInfo. # noqa: E501 + :type: int + """ + + self._total_elements = total_elements + + @property + def has_next(self): + """Gets the has_next of this PageDataUserInfo. # noqa: E501 + + 'false' value indicates the end of the result set # noqa: E501 + + :return: The has_next of this PageDataUserInfo. # noqa: E501 + :rtype: bool + """ + return self._has_next + + @has_next.setter + def has_next(self, has_next): + """Sets the has_next of this PageDataUserInfo. + + 'false' value indicates the end of the result set # noqa: E501 + + :param has_next: The has_next of this PageDataUserInfo. # noqa: E501 + :type: bool + """ + + self._has_next = has_next + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PageDataUserInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PageDataUserInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/palette.py b/tb-rest-client/python/tb_rest_client/models/models_pe/palette.py new file mode 100644 index 0000000..9935214 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/palette.py @@ -0,0 +1,183 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Palette(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'extends': 'str', + 'colors': 'dict(str, str)' + } + + attribute_map = { + 'type': 'type', + 'extends': 'extends', + 'colors': 'colors' + } + + def __init__(self, type=None, extends=None, colors=None): # noqa: E501 + """Palette - a model defined in Swagger""" # noqa: E501 + self._type = None + self._extends = None + self._colors = None + self.discriminator = None + self.type = type + if extends is not None: + self.extends = extends + if colors is not None: + self.colors = colors + + @property + def type(self): + """Gets the type of this Palette. # noqa: E501 + + Name of the pre-defined palette, or 'custom' # noqa: E501 + + :return: The type of this Palette. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Palette. + + Name of the pre-defined palette, or 'custom' # noqa: E501 + + :param type: The type of this Palette. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + @property + def extends(self): + """Gets the extends of this Palette. # noqa: E501 + + Pre-defined palette name that the custom palette extends # noqa: E501 + + :return: The extends of this Palette. # noqa: E501 + :rtype: str + """ + return self._extends + + @extends.setter + def extends(self, extends): + """Sets the extends of this Palette. + + Pre-defined palette name that the custom palette extends # noqa: E501 + + :param extends: The extends of this Palette. # noqa: E501 + :type: str + """ + + self._extends = extends + + @property + def colors(self): + """Gets the colors of this Palette. # noqa: E501 + + Mapping of hue identifier number to the rgb(a) color code # noqa: E501 + + :return: The colors of this Palette. # noqa: E501 + :rtype: dict(str, str) + """ + return self._colors + + @colors.setter + def colors(self, colors): + """Sets the colors of this Palette. + + Mapping of hue identifier number to the rgb(a) color code # noqa: E501 + + :param colors: The colors of this Palette. # noqa: E501 + :type: dict(str, str) + """ + + self._colors = colors + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Palette, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Palette): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/palette_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/palette_settings.py new file mode 100644 index 0000000..d50a7e3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/palette_settings.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PaletteSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'primary_palette': 'Palette', + 'accent_palette': 'Palette' + } + + attribute_map = { + 'primary_palette': 'primaryPalette', + 'accent_palette': 'accentPalette' + } + + def __init__(self, primary_palette=None, accent_palette=None): # noqa: E501 + """PaletteSettings - a model defined in Swagger""" # noqa: E501 + self._primary_palette = None + self._accent_palette = None + self.discriminator = None + self.primary_palette = primary_palette + self.accent_palette = accent_palette + + @property + def primary_palette(self): + """Gets the primary_palette of this PaletteSettings. # noqa: E501 + + + :return: The primary_palette of this PaletteSettings. # noqa: E501 + :rtype: Palette + """ + return self._primary_palette + + @primary_palette.setter + def primary_palette(self, primary_palette): + """Sets the primary_palette of this PaletteSettings. + + + :param primary_palette: The primary_palette of this PaletteSettings. # noqa: E501 + :type: Palette + """ + if primary_palette is None: + raise ValueError("Invalid value for `primary_palette`, must not be `None`") # noqa: E501 + + self._primary_palette = primary_palette + + @property + def accent_palette(self): + """Gets the accent_palette of this PaletteSettings. # noqa: E501 + + + :return: The accent_palette of this PaletteSettings. # noqa: E501 + :rtype: Palette + """ + return self._accent_palette + + @accent_palette.setter + def accent_palette(self, accent_palette): + """Sets the accent_palette of this PaletteSettings. + + + :param accent_palette: The accent_palette of this PaletteSettings. # noqa: E501 + :type: Palette + """ + if accent_palette is None: + raise ValueError("Invalid value for `accent_palette`, must not be `None`") # noqa: E501 + + self._accent_palette = accent_palette + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PaletteSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PaletteSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/platform_two_fa_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/platform_two_fa_settings.py new file mode 100644 index 0000000..18d6d89 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/platform_two_fa_settings.py @@ -0,0 +1,257 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PlatformTwoFaSettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'max_verification_failures_before_user_lockout': 'int', + 'min_verification_code_send_period': 'int', + 'providers': 'list[TwoFaProviderConfig]', + 'total_allowed_time_for_verification': 'int', + 'use_system_two_factor_auth_settings': 'bool', + 'verification_code_check_rate_limit': 'str' + } + + attribute_map = { + 'max_verification_failures_before_user_lockout': 'maxVerificationFailuresBeforeUserLockout', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'providers': 'providers', + 'total_allowed_time_for_verification': 'totalAllowedTimeForVerification', + 'use_system_two_factor_auth_settings': 'useSystemTwoFactorAuthSettings', + 'verification_code_check_rate_limit': 'verificationCodeCheckRateLimit' + } + + def __init__(self, max_verification_failures_before_user_lockout=None, min_verification_code_send_period=None, providers=None, total_allowed_time_for_verification=None, use_system_two_factor_auth_settings=None, verification_code_check_rate_limit=None): # noqa: E501 + """PlatformTwoFaSettings - a model defined in Swagger""" # noqa: E501 + self._max_verification_failures_before_user_lockout = None + self._min_verification_code_send_period = None + self._providers = None + self._total_allowed_time_for_verification = None + self._use_system_two_factor_auth_settings = None + self._verification_code_check_rate_limit = None + self.discriminator = None + if max_verification_failures_before_user_lockout is not None: + self.max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + self.min_verification_code_send_period = min_verification_code_send_period + self.providers = providers + self.total_allowed_time_for_verification = total_allowed_time_for_verification + if use_system_two_factor_auth_settings is not None: + self.use_system_two_factor_auth_settings = use_system_two_factor_auth_settings + if verification_code_check_rate_limit is not None: + self.verification_code_check_rate_limit = verification_code_check_rate_limit + + @property + def max_verification_failures_before_user_lockout(self): + """Gets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._max_verification_failures_before_user_lockout + + @max_verification_failures_before_user_lockout.setter + def max_verification_failures_before_user_lockout(self, max_verification_failures_before_user_lockout): + """Sets the max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. + + + :param max_verification_failures_before_user_lockout: The max_verification_failures_before_user_lockout of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + + self._max_verification_failures_before_user_lockout = max_verification_failures_before_user_lockout + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this PlatformTwoFaSettings. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if min_verification_code_send_period is None: + raise ValueError("Invalid value for `min_verification_code_send_period`, must not be `None`") # noqa: E501 + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def providers(self): + """Gets the providers of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The providers of this PlatformTwoFaSettings. # noqa: E501 + :rtype: list[TwoFaProviderConfig] + """ + return self._providers + + @providers.setter + def providers(self, providers): + """Sets the providers of this PlatformTwoFaSettings. + + + :param providers: The providers of this PlatformTwoFaSettings. # noqa: E501 + :type: list[TwoFaProviderConfig] + """ + if providers is None: + raise ValueError("Invalid value for `providers`, must not be `None`") # noqa: E501 + + self._providers = providers + + @property + def total_allowed_time_for_verification(self): + """Gets the total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :rtype: int + """ + return self._total_allowed_time_for_verification + + @total_allowed_time_for_verification.setter + def total_allowed_time_for_verification(self, total_allowed_time_for_verification): + """Sets the total_allowed_time_for_verification of this PlatformTwoFaSettings. + + + :param total_allowed_time_for_verification: The total_allowed_time_for_verification of this PlatformTwoFaSettings. # noqa: E501 + :type: int + """ + if total_allowed_time_for_verification is None: + raise ValueError("Invalid value for `total_allowed_time_for_verification`, must not be `None`") # noqa: E501 + + self._total_allowed_time_for_verification = total_allowed_time_for_verification + + @property + def use_system_two_factor_auth_settings(self): + """Gets the use_system_two_factor_auth_settings of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The use_system_two_factor_auth_settings of this PlatformTwoFaSettings. # noqa: E501 + :rtype: bool + """ + return self._use_system_two_factor_auth_settings + + @use_system_two_factor_auth_settings.setter + def use_system_two_factor_auth_settings(self, use_system_two_factor_auth_settings): + """Sets the use_system_two_factor_auth_settings of this PlatformTwoFaSettings. + + + :param use_system_two_factor_auth_settings: The use_system_two_factor_auth_settings of this PlatformTwoFaSettings. # noqa: E501 + :type: bool + """ + + self._use_system_two_factor_auth_settings = use_system_two_factor_auth_settings + + @property + def verification_code_check_rate_limit(self): + """Gets the verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + + + :return: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :rtype: str + """ + return self._verification_code_check_rate_limit + + @verification_code_check_rate_limit.setter + def verification_code_check_rate_limit(self, verification_code_check_rate_limit): + """Sets the verification_code_check_rate_limit of this PlatformTwoFaSettings. + + + :param verification_code_check_rate_limit: The verification_code_check_rate_limit of this PlatformTwoFaSettings. # noqa: E501 + :type: str + """ + + self._verification_code_check_rate_limit = verification_code_check_rate_limit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformTwoFaSettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformTwoFaSettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/platform_users_notification_target_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/platform_users_notification_target_config.py new file mode 100644 index 0000000..8754aa2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/platform_users_notification_target_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class PlatformUsersNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'users_filter': 'UsersFilter' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'description': 'description', + 'users_filter': 'usersFilter' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, description=None, users_filter=None, *args, **kwargs): # noqa: E501 + """PlatformUsersNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._description = None + self._users_filter = None + self.discriminator = None + if description is not None: + self.description = description + self.users_filter = users_filter + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def description(self): + """Gets the description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this PlatformUsersNotificationTargetConfig. + + + :param description: The description of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def users_filter(self): + """Gets the users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + + + :return: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :rtype: UsersFilter + """ + return self._users_filter + + @users_filter.setter + def users_filter(self, users_filter): + """Sets the users_filter of this PlatformUsersNotificationTargetConfig. + + + :param users_filter: The users_filter of this PlatformUsersNotificationTargetConfig. # noqa: E501 + :type: UsersFilter + """ + if users_filter is None: + raise ValueError("Invalid value for `users_filter`, must not be `None`") # noqa: E501 + + self._users_filter = users_filter + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PlatformUsersNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PlatformUsersNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/power_saving_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/power_saving_configuration.py new file mode 100644 index 0000000..4504589 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/power_saving_configuration.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class PowerSavingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'edrx_cycle': 'int', + 'paging_transmission_window': 'int', + 'power_mode': 'str', + 'psm_activity_timer': 'int' + } + + attribute_map = { + 'edrx_cycle': 'edrxCycle', + 'paging_transmission_window': 'pagingTransmissionWindow', + 'power_mode': 'powerMode', + 'psm_activity_timer': 'psmActivityTimer' + } + + def __init__(self, edrx_cycle=None, paging_transmission_window=None, power_mode=None, psm_activity_timer=None): # noqa: E501 + """PowerSavingConfiguration - a model defined in Swagger""" # noqa: E501 + self._edrx_cycle = None + self._paging_transmission_window = None + self._power_mode = None + self._psm_activity_timer = None + self.discriminator = None + if edrx_cycle is not None: + self.edrx_cycle = edrx_cycle + if paging_transmission_window is not None: + self.paging_transmission_window = paging_transmission_window + if power_mode is not None: + self.power_mode = power_mode + if psm_activity_timer is not None: + self.psm_activity_timer = psm_activity_timer + + @property + def edrx_cycle(self): + """Gets the edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + + + :return: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._edrx_cycle + + @edrx_cycle.setter + def edrx_cycle(self, edrx_cycle): + """Sets the edrx_cycle of this PowerSavingConfiguration. + + + :param edrx_cycle: The edrx_cycle of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._edrx_cycle = edrx_cycle + + @property + def paging_transmission_window(self): + """Gets the paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + + + :return: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._paging_transmission_window + + @paging_transmission_window.setter + def paging_transmission_window(self, paging_transmission_window): + """Sets the paging_transmission_window of this PowerSavingConfiguration. + + + :param paging_transmission_window: The paging_transmission_window of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._paging_transmission_window = paging_transmission_window + + @property + def power_mode(self): + """Gets the power_mode of this PowerSavingConfiguration. # noqa: E501 + + + :return: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :rtype: str + """ + return self._power_mode + + @power_mode.setter + def power_mode(self, power_mode): + """Sets the power_mode of this PowerSavingConfiguration. + + + :param power_mode: The power_mode of this PowerSavingConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["DRX", "E_DRX", "PSM"] # noqa: E501 + if power_mode not in allowed_values: + raise ValueError( + "Invalid value for `power_mode` ({0}), must be one of {1}" # noqa: E501 + .format(power_mode, allowed_values) + ) + + self._power_mode = power_mode + + @property + def psm_activity_timer(self): + """Gets the psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + + + :return: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :rtype: int + """ + return self._psm_activity_timer + + @psm_activity_timer.setter + def psm_activity_timer(self, psm_activity_timer): + """Sets the psm_activity_timer of this PowerSavingConfiguration. + + + :param psm_activity_timer: The psm_activity_timer of this PowerSavingConfiguration. # noqa: E501 + :type: int + """ + + self._psm_activity_timer = psm_activity_timer + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PowerSavingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PowerSavingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/processing_strategy.py b/tb-rest-client/python/tb_rest_client/models/models_pe/processing_strategy.py new file mode 100644 index 0000000..831fef8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/processing_strategy.py @@ -0,0 +1,234 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ProcessingStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'failure_percentage': 'float', + 'max_pause_between_retries': 'int', + 'pause_between_retries': 'int', + 'retries': 'int', + 'type': 'str' + } + + attribute_map = { + 'failure_percentage': 'failurePercentage', + 'max_pause_between_retries': 'maxPauseBetweenRetries', + 'pause_between_retries': 'pauseBetweenRetries', + 'retries': 'retries', + 'type': 'type' + } + + def __init__(self, failure_percentage=None, max_pause_between_retries=None, pause_between_retries=None, retries=None, type=None): # noqa: E501 + """ProcessingStrategy - a model defined in Swagger""" # noqa: E501 + self._failure_percentage = None + self._max_pause_between_retries = None + self._pause_between_retries = None + self._retries = None + self._type = None + self.discriminator = None + if failure_percentage is not None: + self.failure_percentage = failure_percentage + if max_pause_between_retries is not None: + self.max_pause_between_retries = max_pause_between_retries + if pause_between_retries is not None: + self.pause_between_retries = pause_between_retries + if retries is not None: + self.retries = retries + if type is not None: + self.type = type + + @property + def failure_percentage(self): + """Gets the failure_percentage of this ProcessingStrategy. # noqa: E501 + + + :return: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :rtype: float + """ + return self._failure_percentage + + @failure_percentage.setter + def failure_percentage(self, failure_percentage): + """Sets the failure_percentage of this ProcessingStrategy. + + + :param failure_percentage: The failure_percentage of this ProcessingStrategy. # noqa: E501 + :type: float + """ + + self._failure_percentage = failure_percentage + + @property + def max_pause_between_retries(self): + """Gets the max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._max_pause_between_retries + + @max_pause_between_retries.setter + def max_pause_between_retries(self, max_pause_between_retries): + """Sets the max_pause_between_retries of this ProcessingStrategy. + + + :param max_pause_between_retries: The max_pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._max_pause_between_retries = max_pause_between_retries + + @property + def pause_between_retries(self): + """Gets the pause_between_retries of this ProcessingStrategy. # noqa: E501 + + + :return: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._pause_between_retries + + @pause_between_retries.setter + def pause_between_retries(self, pause_between_retries): + """Sets the pause_between_retries of this ProcessingStrategy. + + + :param pause_between_retries: The pause_between_retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._pause_between_retries = pause_between_retries + + @property + def retries(self): + """Gets the retries of this ProcessingStrategy. # noqa: E501 + + + :return: The retries of this ProcessingStrategy. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this ProcessingStrategy. + + + :param retries: The retries of this ProcessingStrategy. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def type(self): + """Gets the type of this ProcessingStrategy. # noqa: E501 + + + :return: The type of this ProcessingStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ProcessingStrategy. + + + :param type: The type of this ProcessingStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["RETRY_ALL", "RETRY_FAILED", "RETRY_FAILED_AND_TIMED_OUT", "RETRY_TIMED_OUT", "SKIP_ALL_FAILURES", "SKIP_ALL_FAILURES_AND_TIMED_OUT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProcessingStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProcessingStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/proto_transport_payload_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/proto_transport_payload_configuration.py new file mode 100644 index 0000000..3471428 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/proto_transport_payload_configuration.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.transport_payload_type_configuration import TransportPayloadTypeConfiguration # noqa: F401,E501 + +class ProtoTransportPayloadConfiguration(TransportPayloadTypeConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device_attributes_proto_schema': 'str', + 'device_rpc_request_proto_schema': 'str', + 'device_rpc_response_proto_schema': 'str', + 'device_telemetry_proto_schema': 'str', + 'enable_compatibility_with_json_payload_format': 'bool', + 'use_json_payload_format_for_default_downlink_topics': 'bool' + } + if hasattr(TransportPayloadTypeConfiguration, "swagger_types"): + swagger_types.update(TransportPayloadTypeConfiguration.swagger_types) + + attribute_map = { + 'device_attributes_proto_schema': 'deviceAttributesProtoSchema', + 'device_rpc_request_proto_schema': 'deviceRpcRequestProtoSchema', + 'device_rpc_response_proto_schema': 'deviceRpcResponseProtoSchema', + 'device_telemetry_proto_schema': 'deviceTelemetryProtoSchema', + 'enable_compatibility_with_json_payload_format': 'enableCompatibilityWithJsonPayloadFormat', + 'use_json_payload_format_for_default_downlink_topics': 'useJsonPayloadFormatForDefaultDownlinkTopics' + } + if hasattr(TransportPayloadTypeConfiguration, "attribute_map"): + attribute_map.update(TransportPayloadTypeConfiguration.attribute_map) + + def __init__(self, device_attributes_proto_schema=None, device_rpc_request_proto_schema=None, device_rpc_response_proto_schema=None, device_telemetry_proto_schema=None, enable_compatibility_with_json_payload_format=None, use_json_payload_format_for_default_downlink_topics=None, *args, **kwargs): # noqa: E501 + """ProtoTransportPayloadConfiguration - a model defined in Swagger""" # noqa: E501 + self._device_attributes_proto_schema = None + self._device_rpc_request_proto_schema = None + self._device_rpc_response_proto_schema = None + self._device_telemetry_proto_schema = None + self._enable_compatibility_with_json_payload_format = None + self._use_json_payload_format_for_default_downlink_topics = None + self.discriminator = None + if device_attributes_proto_schema is not None: + self.device_attributes_proto_schema = device_attributes_proto_schema + if device_rpc_request_proto_schema is not None: + self.device_rpc_request_proto_schema = device_rpc_request_proto_schema + if device_rpc_response_proto_schema is not None: + self.device_rpc_response_proto_schema = device_rpc_response_proto_schema + if device_telemetry_proto_schema is not None: + self.device_telemetry_proto_schema = device_telemetry_proto_schema + if enable_compatibility_with_json_payload_format is not None: + self.enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + if use_json_payload_format_for_default_downlink_topics is not None: + self.use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + TransportPayloadTypeConfiguration.__init__(self, *args, **kwargs) + + @property + def device_attributes_proto_schema(self): + """Gets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_attributes_proto_schema + + @device_attributes_proto_schema.setter + def device_attributes_proto_schema(self, device_attributes_proto_schema): + """Sets the device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_attributes_proto_schema: The device_attributes_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_attributes_proto_schema = device_attributes_proto_schema + + @property + def device_rpc_request_proto_schema(self): + """Gets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_request_proto_schema + + @device_rpc_request_proto_schema.setter + def device_rpc_request_proto_schema(self, device_rpc_request_proto_schema): + """Sets the device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_request_proto_schema: The device_rpc_request_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_request_proto_schema = device_rpc_request_proto_schema + + @property + def device_rpc_response_proto_schema(self): + """Gets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_rpc_response_proto_schema + + @device_rpc_response_proto_schema.setter + def device_rpc_response_proto_schema(self, device_rpc_response_proto_schema): + """Sets the device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_rpc_response_proto_schema: The device_rpc_response_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_rpc_response_proto_schema = device_rpc_response_proto_schema + + @property + def device_telemetry_proto_schema(self): + """Gets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: str + """ + return self._device_telemetry_proto_schema + + @device_telemetry_proto_schema.setter + def device_telemetry_proto_schema(self, device_telemetry_proto_schema): + """Sets the device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. + + + :param device_telemetry_proto_schema: The device_telemetry_proto_schema of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: str + """ + + self._device_telemetry_proto_schema = device_telemetry_proto_schema + + @property + def enable_compatibility_with_json_payload_format(self): + """Gets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._enable_compatibility_with_json_payload_format + + @enable_compatibility_with_json_payload_format.setter + def enable_compatibility_with_json_payload_format(self, enable_compatibility_with_json_payload_format): + """Sets the enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. + + + :param enable_compatibility_with_json_payload_format: The enable_compatibility_with_json_payload_format of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._enable_compatibility_with_json_payload_format = enable_compatibility_with_json_payload_format + + @property + def use_json_payload_format_for_default_downlink_topics(self): + """Gets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + + + :return: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :rtype: bool + """ + return self._use_json_payload_format_for_default_downlink_topics + + @use_json_payload_format_for_default_downlink_topics.setter + def use_json_payload_format_for_default_downlink_topics(self, use_json_payload_format_for_default_downlink_topics): + """Sets the use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. + + + :param use_json_payload_format_for_default_downlink_topics: The use_json_payload_format_for_default_downlink_topics of this ProtoTransportPayloadConfiguration. # noqa: E501 + :type: bool + """ + + self._use_json_payload_format_for_default_downlink_topics = use_json_payload_format_for_default_downlink_topics + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ProtoTransportPayloadConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ProtoTransportPayloadConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/psk_lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_pe/psk_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..c32b3d8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/psk_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from .lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential # noqa: F401,E501 + +class PSKLwM2MBootstrapServerCredential(LwM2MBootstrapServerCredential): + """ + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + if hasattr(LwM2MBootstrapServerCredential, "swagger_types"): + swagger_types.update(LwM2MBootstrapServerCredential.swagger_types) + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + if hasattr(LwM2MBootstrapServerCredential, "attribute_map"): + attribute_map.update(LwM2MBootstrapServerCredential.attribute_map) + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None, *args, **kwargs): # noqa: E501 + """PSKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + LwM2MBootstrapServerCredential.__init__(self, *args, **kwargs) + + @property + def short_server_id(self): + """Gets the short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this PSKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this PSKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this PSKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this PSKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this PSKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this PSKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PSKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PSKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/psklw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_pe/psklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..04d0d7c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/psklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.lw_m2_m_bootstrap_server_credential import LwM2MBootstrapServerCredential # noqa: F401,E501 + +class PSKLwM2MBootstrapServerCredential(LwM2MBootstrapServerCredential): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + if hasattr(LwM2MBootstrapServerCredential, "swagger_types"): + swagger_types.update(LwM2MBootstrapServerCredential.swagger_types) + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + if hasattr(LwM2MBootstrapServerCredential, "attribute_map"): + attribute_map.update(LwM2MBootstrapServerCredential.attribute_map) + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None, *args, **kwargs): # noqa: E501 + """PSKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + LwM2MBootstrapServerCredential.__init__(self, *args, **kwargs) + + @property + def short_server_id(self): + """Gets the short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this PSKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this PSKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this PSKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this PSKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this PSKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this PSKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this PSKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this PSKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this PSKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this PSKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PSKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PSKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/queue.py b/tb-rest-client/python/tb_rest_client/models/models_pe/queue.py new file mode 100644 index 0000000..ddc6f1b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/queue.py @@ -0,0 +1,410 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Queue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'created_time': 'int', + 'id': 'QueueId', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'tenant_id': 'TenantId', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'created_time': 'createdTime', + 'id': 'id', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'tenant_id': 'tenantId', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, created_time=None, id=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, tenant_id=None, topic=None): # noqa: E501 + """Queue - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._created_time = None + self._id = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._tenant_id = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if created_time is not None: + self.created_time = created_time + if id is not None: + self.id = id + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if tenant_id is not None: + self.tenant_id = tenant_id + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this Queue. # noqa: E501 + + + :return: The additional_info of this Queue. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Queue. + + + :param additional_info: The additional_info of this Queue. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this Queue. # noqa: E501 + + + :return: The consumer_per_partition of this Queue. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this Queue. + + + :param consumer_per_partition: The consumer_per_partition of this Queue. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def created_time(self): + """Gets the created_time of this Queue. # noqa: E501 + + + :return: The created_time of this Queue. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Queue. + + + :param created_time: The created_time of this Queue. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def id(self): + """Gets the id of this Queue. # noqa: E501 + + + :return: The id of this Queue. # noqa: E501 + :rtype: QueueId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Queue. + + + :param id: The id of this Queue. # noqa: E501 + :type: QueueId + """ + + self._id = id + + @property + def name(self): + """Gets the name of this Queue. # noqa: E501 + + + :return: The name of this Queue. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Queue. + + + :param name: The name of this Queue. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this Queue. # noqa: E501 + + + :return: The pack_processing_timeout of this Queue. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this Queue. + + + :param pack_processing_timeout: The pack_processing_timeout of this Queue. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this Queue. # noqa: E501 + + + :return: The partitions of this Queue. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this Queue. + + + :param partitions: The partitions of this Queue. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this Queue. # noqa: E501 + + + :return: The poll_interval of this Queue. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this Queue. + + + :param poll_interval: The poll_interval of this Queue. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this Queue. # noqa: E501 + + + :return: The processing_strategy of this Queue. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this Queue. + + + :param processing_strategy: The processing_strategy of this Queue. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this Queue. # noqa: E501 + + + :return: The submit_strategy of this Queue. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this Queue. + + + :param submit_strategy: The submit_strategy of this Queue. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def tenant_id(self): + """Gets the tenant_id of this Queue. # noqa: E501 + + + :return: The tenant_id of this Queue. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Queue. + + + :param tenant_id: The tenant_id of this Queue. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def topic(self): + """Gets the topic of this Queue. # noqa: E501 + + + :return: The topic of this Queue. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this Queue. + + + :param topic: The topic of this Queue. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Queue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Queue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/queue_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/queue_id.py new file mode 100644 index 0000000..66232db --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/queue_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class QueueId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """QueueId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this QueueId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this QueueId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this QueueId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this QueueId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this QueueId. # noqa: E501 + + + :return: The entity_type of this QueueId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this QueueId. + + + :param entity_type: The entity_type of this QueueId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(QueueId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, QueueId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/raw_data_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/raw_data_event_filter.py new file mode 100644 index 0000000..dccd75a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/raw_data_event_filter.py @@ -0,0 +1,277 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class RawDataEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'uuid': 'str', + 'message_type': 'str', + 'message': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'uuid': 'uuid', + 'message_type': 'messageType', + 'message': 'message' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, uuid=None, message_type=None, message=None, *args, **kwargs): # noqa: E501 + """RawDataEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._uuid = None + self._message_type = None + self._message = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if uuid is not None: + self.uuid = uuid + if message_type is not None: + self.message_type = message_type + if message is not None: + self.message = message + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this RawDataEventFilter. # noqa: E501 + + + :return: The not_empty of this RawDataEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RawDataEventFilter. + + + :param not_empty: The not_empty of this RawDataEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RawDataEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RawDataEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RawDataEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RawDataEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RawDataEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def uuid(self): + """Gets the uuid of this RawDataEventFilter. # noqa: E501 + + String value representing the uuid # noqa: E501 + + :return: The uuid of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._uuid + + @uuid.setter + def uuid(self, uuid): + """Sets the uuid of this RawDataEventFilter. + + String value representing the uuid # noqa: E501 + + :param uuid: The uuid of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._uuid = uuid + + @property + def message_type(self): + """Gets the message_type of this RawDataEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The message_type of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._message_type + + @message_type.setter + def message_type(self, message_type): + """Sets the message_type of this RawDataEventFilter. + + String value representing the message type # noqa: E501 + + :param message_type: The message_type of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._message_type = message_type + + @property + def message(self): + """Gets the message of this RawDataEventFilter. # noqa: E501 + + String value representing the message # noqa: E501 + + :return: The message of this RawDataEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this RawDataEventFilter. + + String value representing the message # noqa: E501 + + :param message: The message of this RawDataEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RawDataEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RawDataEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/relation_entity_type_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/relation_entity_type_filter.py new file mode 100644 index 0000000..0edd2b6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/relation_entity_type_filter.py @@ -0,0 +1,161 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationEntityTypeFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'relation_type': 'str', + 'entity_types': 'list[str]' + } + + attribute_map = { + 'relation_type': 'relationType', + 'entity_types': 'entityTypes' + } + + def __init__(self, relation_type=None, entity_types=None): # noqa: E501 + """RelationEntityTypeFilter - a model defined in Swagger""" # noqa: E501 + self._relation_type = None + self._entity_types = None + self.discriminator = None + if relation_type is not None: + self.relation_type = relation_type + if entity_types is not None: + self.entity_types = entity_types + + @property + def relation_type(self): + """Gets the relation_type of this RelationEntityTypeFilter. # noqa: E501 + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :return: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RelationEntityTypeFilter. + + Type of the relation between root entity and other entity (e.g. 'Contains' or 'Manages'). # noqa: E501 + + :param relation_type: The relation_type of this RelationEntityTypeFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def entity_types(self): + """Gets the entity_types of this RelationEntityTypeFilter. # noqa: E501 + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :return: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :rtype: list[str] + """ + return self._entity_types + + @entity_types.setter + def entity_types(self, entity_types): + """Sets the entity_types of this RelationEntityTypeFilter. + + Array of entity types to filter the related entities (e.g. 'DEVICE', 'ASSET'). # noqa: E501 + + :param entity_types: The entity_types of this RelationEntityTypeFilter. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if not set(entity_types).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `entity_types` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(entity_types) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._entity_types = entity_types + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationEntityTypeFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationEntityTypeFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/relations_query_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/relations_query_filter.py new file mode 100644 index 0000000..aa8188d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/relations_query_filter.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class RelationsQueryFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'direction': 'str', + 'fetch_last_level_only': 'bool', + 'filters': 'list[RelationEntityTypeFilter]', + 'max_level': 'int', + 'multi_root': 'bool', + 'multi_root_entities_type': 'str', + 'multi_root_entity_ids': 'list[str]', + 'root_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'direction': 'direction', + 'fetch_last_level_only': 'fetchLastLevelOnly', + 'filters': 'filters', + 'max_level': 'maxLevel', + 'multi_root': 'multiRoot', + 'multi_root_entities_type': 'multiRootEntitiesType', + 'multi_root_entity_ids': 'multiRootEntityIds', + 'root_entity': 'rootEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, direction=None, fetch_last_level_only=None, filters=None, max_level=None, multi_root=None, multi_root_entities_type=None, multi_root_entity_ids=None, root_entity=None, *args, **kwargs): # noqa: E501 + """RelationsQueryFilter - a model defined in Swagger""" # noqa: E501 + self._direction = None + self._fetch_last_level_only = None + self._filters = None + self._max_level = None + self._multi_root = None + self._multi_root_entities_type = None + self._multi_root_entity_ids = None + self._root_entity = None + self.discriminator = None + if direction is not None: + self.direction = direction + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + if filters is not None: + self.filters = filters + if max_level is not None: + self.max_level = max_level + if multi_root is not None: + self.multi_root = multi_root + if multi_root_entities_type is not None: + self.multi_root_entities_type = multi_root_entities_type + if multi_root_entity_ids is not None: + self.multi_root_entity_ids = multi_root_entity_ids + if root_entity is not None: + self.root_entity = root_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def direction(self): + """Gets the direction of this RelationsQueryFilter. # noqa: E501 + + + :return: The direction of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsQueryFilter. + + + :param direction: The direction of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + + + :return: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsQueryFilter. + + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + @property + def filters(self): + """Gets the filters of this RelationsQueryFilter. # noqa: E501 + + + :return: The filters of this RelationsQueryFilter. # noqa: E501 + :rtype: list[RelationEntityTypeFilter] + """ + return self._filters + + @filters.setter + def filters(self, filters): + """Sets the filters of this RelationsQueryFilter. + + + :param filters: The filters of this RelationsQueryFilter. # noqa: E501 + :type: list[RelationEntityTypeFilter] + """ + + self._filters = filters + + @property + def max_level(self): + """Gets the max_level of this RelationsQueryFilter. # noqa: E501 + + + :return: The max_level of this RelationsQueryFilter. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsQueryFilter. + + + :param max_level: The max_level of this RelationsQueryFilter. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def multi_root(self): + """Gets the multi_root of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root of this RelationsQueryFilter. # noqa: E501 + :rtype: bool + """ + return self._multi_root + + @multi_root.setter + def multi_root(self, multi_root): + """Sets the multi_root of this RelationsQueryFilter. + + + :param multi_root: The multi_root of this RelationsQueryFilter. # noqa: E501 + :type: bool + """ + + self._multi_root = multi_root + + @property + def multi_root_entities_type(self): + """Gets the multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :rtype: str + """ + return self._multi_root_entities_type + + @multi_root_entities_type.setter + def multi_root_entities_type(self, multi_root_entities_type): + """Sets the multi_root_entities_type of this RelationsQueryFilter. + + + :param multi_root_entities_type: The multi_root_entities_type of this RelationsQueryFilter. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if multi_root_entities_type not in allowed_values: + raise ValueError( + "Invalid value for `multi_root_entities_type` ({0}), must be one of {1}" # noqa: E501 + .format(multi_root_entities_type, allowed_values) + ) + + self._multi_root_entities_type = multi_root_entities_type + + @property + def multi_root_entity_ids(self): + """Gets the multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + + + :return: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :rtype: list[str] + """ + return self._multi_root_entity_ids + + @multi_root_entity_ids.setter + def multi_root_entity_ids(self, multi_root_entity_ids): + """Sets the multi_root_entity_ids of this RelationsQueryFilter. + + + :param multi_root_entity_ids: The multi_root_entity_ids of this RelationsQueryFilter. # noqa: E501 + :type: list[str] + """ + + self._multi_root_entity_ids = multi_root_entity_ids + + @property + def root_entity(self): + """Gets the root_entity of this RelationsQueryFilter. # noqa: E501 + + + :return: The root_entity of this RelationsQueryFilter. # noqa: E501 + :rtype: EntityId + """ + return self._root_entity + + @root_entity.setter + def root_entity(self, root_entity): + """Sets the root_entity of this RelationsQueryFilter. + + + :param root_entity: The root_entity of this RelationsQueryFilter. # noqa: E501 + :type: EntityId + """ + + self._root_entity = root_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsQueryFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsQueryFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/relations_search_parameters.py b/tb-rest-client/python/tb_rest_client/models/models_pe/relations_search_parameters.py new file mode 100644 index 0000000..c686cf4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/relations_search_parameters.py @@ -0,0 +1,284 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RelationsSearchParameters(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'root_id': 'str', + 'root_type': 'str', + 'direction': 'str', + 'relation_type_group': 'str', + 'max_level': 'int', + 'fetch_last_level_only': 'bool' + } + + attribute_map = { + 'root_id': 'rootId', + 'root_type': 'rootType', + 'direction': 'direction', + 'relation_type_group': 'relationTypeGroup', + 'max_level': 'maxLevel', + 'fetch_last_level_only': 'fetchLastLevelOnly' + } + + def __init__(self, root_id=None, root_type=None, direction=None, relation_type_group=None, max_level=None, fetch_last_level_only=None): # noqa: E501 + """RelationsSearchParameters - a model defined in Swagger""" # noqa: E501 + self._root_id = None + self._root_type = None + self._direction = None + self._relation_type_group = None + self._max_level = None + self._fetch_last_level_only = None + self.discriminator = None + if root_id is not None: + self.root_id = root_id + if root_type is not None: + self.root_type = root_type + if direction is not None: + self.direction = direction + if relation_type_group is not None: + self.relation_type_group = relation_type_group + if max_level is not None: + self.max_level = max_level + if fetch_last_level_only is not None: + self.fetch_last_level_only = fetch_last_level_only + + @property + def root_id(self): + """Gets the root_id of this RelationsSearchParameters. # noqa: E501 + + Root entity id to start search from. # noqa: E501 + + :return: The root_id of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_id + + @root_id.setter + def root_id(self, root_id): + """Sets the root_id of this RelationsSearchParameters. + + Root entity id to start search from. # noqa: E501 + + :param root_id: The root_id of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + + self._root_id = root_id + + @property + def root_type(self): + """Gets the root_type of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The root_type of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._root_type + + @root_type.setter + def root_type(self, root_type): + """Sets the root_type of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param root_type: The root_type of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if root_type not in allowed_values: + raise ValueError( + "Invalid value for `root_type` ({0}), must be one of {1}" # noqa: E501 + .format(root_type, allowed_values) + ) + + self._root_type = root_type + + @property + def direction(self): + """Gets the direction of this RelationsSearchParameters. # noqa: E501 + + Type of the root entity. # noqa: E501 + + :return: The direction of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._direction + + @direction.setter + def direction(self, direction): + """Sets the direction of this RelationsSearchParameters. + + Type of the root entity. # noqa: E501 + + :param direction: The direction of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["FROM", "TO"] # noqa: E501 + if direction not in allowed_values: + raise ValueError( + "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 + .format(direction, allowed_values) + ) + + self._direction = direction + + @property + def relation_type_group(self): + """Gets the relation_type_group of this RelationsSearchParameters. # noqa: E501 + + Type of the relation. # noqa: E501 + + :return: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :rtype: str + """ + return self._relation_type_group + + @relation_type_group.setter + def relation_type_group(self, relation_type_group): + """Sets the relation_type_group of this RelationsSearchParameters. + + Type of the relation. # noqa: E501 + + :param relation_type_group: The relation_type_group of this RelationsSearchParameters. # noqa: E501 + :type: str + """ + allowed_values = ["COMMON", "DASHBOARD", "EDGE", "EDGE_AUTO_ASSIGN_RULE_CHAIN", "FROM_ENTITY_GROUP", "RULE_CHAIN", "RULE_NODE"] # noqa: E501 + if relation_type_group not in allowed_values: + raise ValueError( + "Invalid value for `relation_type_group` ({0}), must be one of {1}" # noqa: E501 + .format(relation_type_group, allowed_values) + ) + + self._relation_type_group = relation_type_group + + @property + def max_level(self): + """Gets the max_level of this RelationsSearchParameters. # noqa: E501 + + Maximum level of the search depth. # noqa: E501 + + :return: The max_level of this RelationsSearchParameters. # noqa: E501 + :rtype: int + """ + return self._max_level + + @max_level.setter + def max_level(self, max_level): + """Sets the max_level of this RelationsSearchParameters. + + Maximum level of the search depth. # noqa: E501 + + :param max_level: The max_level of this RelationsSearchParameters. # noqa: E501 + :type: int + """ + + self._max_level = max_level + + @property + def fetch_last_level_only(self): + """Gets the fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :return: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :rtype: bool + """ + return self._fetch_last_level_only + + @fetch_last_level_only.setter + def fetch_last_level_only(self, fetch_last_level_only): + """Sets the fetch_last_level_only of this RelationsSearchParameters. + + Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity. # noqa: E501 + + :param fetch_last_level_only: The fetch_last_level_only of this RelationsSearchParameters. # noqa: E501 + :type: bool + """ + + self._fetch_last_level_only = fetch_last_level_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RelationsSearchParameters, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RelationsSearchParameters): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/repeating_alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_pe/repeating_alarm_condition_spec.py new file mode 100644 index 0000000..593e10e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/repeating_alarm_condition_spec.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class RepeatingAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'predicate': 'FilterPredicateValueint' + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + 'predicate': 'predicate' + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, predicate=None, *args, **kwargs): # noqa: E501 + """RepeatingAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self._predicate = None + self.discriminator = None + if predicate is not None: + self.predicate = predicate + AlarmConditionSpec.__init__(self, *args, **kwargs) + + @property + def predicate(self): + """Gets the predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + + + :return: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :rtype: FilterPredicateValueint + """ + return self._predicate + + @predicate.setter + def predicate(self, predicate): + """Sets the predicate of this RepeatingAlarmConditionSpec. + + + :param predicate: The predicate of this RepeatingAlarmConditionSpec. # noqa: E501 + :type: FilterPredicateValueint + """ + + self._predicate = predicate + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepeatingAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepeatingAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/report_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/report_config.py new file mode 100644 index 0000000..fc35c8d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/report_config.py @@ -0,0 +1,358 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ReportConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'base_url': 'str', + 'dashboard_id': 'str', + 'name_pattern': 'str', + 'state': 'str', + 'timewindow': 'JsonNode', + 'timezone': 'str', + 'type': 'str', + 'use_current_user_credentials': 'bool', + 'use_dashboard_timewindow': 'bool', + 'user_id': 'str' + } + + attribute_map = { + 'base_url': 'baseUrl', + 'dashboard_id': 'dashboardId', + 'name_pattern': 'namePattern', + 'state': 'state', + 'timewindow': 'timewindow', + 'timezone': 'timezone', + 'type': 'type', + 'use_current_user_credentials': 'useCurrentUserCredentials', + 'use_dashboard_timewindow': 'useDashboardTimewindow', + 'user_id': 'userId' + } + + def __init__(self, base_url=None, dashboard_id=None, name_pattern=None, state=None, timewindow=None, timezone=None, type=None, use_current_user_credentials=None, use_dashboard_timewindow=None, user_id=None): # noqa: E501 + """ReportConfig - a model defined in Swagger""" # noqa: E501 + self._base_url = None + self._dashboard_id = None + self._name_pattern = None + self._state = None + self._timewindow = None + self._timezone = None + self._type = None + self._use_current_user_credentials = None + self._use_dashboard_timewindow = None + self._user_id = None + self.discriminator = None + if base_url is not None: + self.base_url = base_url + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if name_pattern is not None: + self.name_pattern = name_pattern + if state is not None: + self.state = state + if timewindow is not None: + self.timewindow = timewindow + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + if use_current_user_credentials is not None: + self.use_current_user_credentials = use_current_user_credentials + if use_dashboard_timewindow is not None: + self.use_dashboard_timewindow = use_dashboard_timewindow + if user_id is not None: + self.user_id = user_id + + @property + def base_url(self): + """Gets the base_url of this ReportConfig. # noqa: E501 + + + :return: The base_url of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._base_url + + @base_url.setter + def base_url(self, base_url): + """Sets the base_url of this ReportConfig. + + + :param base_url: The base_url of this ReportConfig. # noqa: E501 + :type: str + """ + + self._base_url = base_url + + @property + def dashboard_id(self): + """Gets the dashboard_id of this ReportConfig. # noqa: E501 + + + :return: The dashboard_id of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this ReportConfig. + + + :param dashboard_id: The dashboard_id of this ReportConfig. # noqa: E501 + :type: str + """ + + self._dashboard_id = dashboard_id + + @property + def name_pattern(self): + """Gets the name_pattern of this ReportConfig. # noqa: E501 + + + :return: The name_pattern of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._name_pattern + + @name_pattern.setter + def name_pattern(self, name_pattern): + """Sets the name_pattern of this ReportConfig. + + + :param name_pattern: The name_pattern of this ReportConfig. # noqa: E501 + :type: str + """ + + self._name_pattern = name_pattern + + @property + def state(self): + """Gets the state of this ReportConfig. # noqa: E501 + + + :return: The state of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._state + + @state.setter + def state(self, state): + """Sets the state of this ReportConfig. + + + :param state: The state of this ReportConfig. # noqa: E501 + :type: str + """ + + self._state = state + + @property + def timewindow(self): + """Gets the timewindow of this ReportConfig. # noqa: E501 + + + :return: The timewindow of this ReportConfig. # noqa: E501 + :rtype: JsonNode + """ + return self._timewindow + + @timewindow.setter + def timewindow(self, timewindow): + """Sets the timewindow of this ReportConfig. + + + :param timewindow: The timewindow of this ReportConfig. # noqa: E501 + :type: JsonNode + """ + + self._timewindow = timewindow + + @property + def timezone(self): + """Gets the timezone of this ReportConfig. # noqa: E501 + + + :return: The timezone of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this ReportConfig. + + + :param timezone: The timezone of this ReportConfig. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this ReportConfig. # noqa: E501 + + + :return: The type of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ReportConfig. + + + :param type: The type of this ReportConfig. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def use_current_user_credentials(self): + """Gets the use_current_user_credentials of this ReportConfig. # noqa: E501 + + + :return: The use_current_user_credentials of this ReportConfig. # noqa: E501 + :rtype: bool + """ + return self._use_current_user_credentials + + @use_current_user_credentials.setter + def use_current_user_credentials(self, use_current_user_credentials): + """Sets the use_current_user_credentials of this ReportConfig. + + + :param use_current_user_credentials: The use_current_user_credentials of this ReportConfig. # noqa: E501 + :type: bool + """ + + self._use_current_user_credentials = use_current_user_credentials + + @property + def use_dashboard_timewindow(self): + """Gets the use_dashboard_timewindow of this ReportConfig. # noqa: E501 + + + :return: The use_dashboard_timewindow of this ReportConfig. # noqa: E501 + :rtype: bool + """ + return self._use_dashboard_timewindow + + @use_dashboard_timewindow.setter + def use_dashboard_timewindow(self, use_dashboard_timewindow): + """Sets the use_dashboard_timewindow of this ReportConfig. + + + :param use_dashboard_timewindow: The use_dashboard_timewindow of this ReportConfig. # noqa: E501 + :type: bool + """ + + self._use_dashboard_timewindow = use_dashboard_timewindow + + @property + def user_id(self): + """Gets the user_id of this ReportConfig. # noqa: E501 + + + :return: The user_id of this ReportConfig. # noqa: E501 + :rtype: str + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this ReportConfig. + + + :param user_id: The user_id of this ReportConfig. # noqa: E501 + :type: str + """ + + self._user_id = user_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ReportConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ReportConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/repository_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/repository_settings.py new file mode 100644 index 0000000..82375e7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/repository_settings.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_method': 'str', + 'default_branch': 'str', + 'password': 'str', + 'private_key': 'str', + 'private_key_file_name': 'str', + 'private_key_password': 'str', + 'read_only': 'bool', + 'repository_uri': 'str', + 'show_merge_commits': 'bool', + 'username': 'str' + } + + attribute_map = { + 'auth_method': 'authMethod', + 'default_branch': 'defaultBranch', + 'password': 'password', + 'private_key': 'privateKey', + 'private_key_file_name': 'privateKeyFileName', + 'private_key_password': 'privateKeyPassword', + 'read_only': 'readOnly', + 'repository_uri': 'repositoryUri', + 'show_merge_commits': 'showMergeCommits', + 'username': 'username' + } + + def __init__(self, auth_method=None, default_branch=None, password=None, private_key=None, private_key_file_name=None, private_key_password=None, read_only=None, repository_uri=None, show_merge_commits=None, username=None): # noqa: E501 + """RepositorySettings - a model defined in Swagger""" # noqa: E501 + self._auth_method = None + self._default_branch = None + self._password = None + self._private_key = None + self._private_key_file_name = None + self._private_key_password = None + self._read_only = None + self._repository_uri = None + self._show_merge_commits = None + self._username = None + self.discriminator = None + if auth_method is not None: + self.auth_method = auth_method + if default_branch is not None: + self.default_branch = default_branch + if password is not None: + self.password = password + if private_key is not None: + self.private_key = private_key + if private_key_file_name is not None: + self.private_key_file_name = private_key_file_name + if private_key_password is not None: + self.private_key_password = private_key_password + if read_only is not None: + self.read_only = read_only + if repository_uri is not None: + self.repository_uri = repository_uri + if show_merge_commits is not None: + self.show_merge_commits = show_merge_commits + if username is not None: + self.username = username + + @property + def auth_method(self): + """Gets the auth_method of this RepositorySettings. # noqa: E501 + + + :return: The auth_method of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._auth_method + + @auth_method.setter + def auth_method(self, auth_method): + """Sets the auth_method of this RepositorySettings. + + + :param auth_method: The auth_method of this RepositorySettings. # noqa: E501 + :type: str + """ + allowed_values = ["PRIVATE_KEY", "USERNAME_PASSWORD"] # noqa: E501 + if auth_method not in allowed_values: + raise ValueError( + "Invalid value for `auth_method` ({0}), must be one of {1}" # noqa: E501 + .format(auth_method, allowed_values) + ) + + self._auth_method = auth_method + + @property + def default_branch(self): + """Gets the default_branch of this RepositorySettings. # noqa: E501 + + + :return: The default_branch of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._default_branch + + @default_branch.setter + def default_branch(self, default_branch): + """Sets the default_branch of this RepositorySettings. + + + :param default_branch: The default_branch of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._default_branch = default_branch + + @property + def password(self): + """Gets the password of this RepositorySettings. # noqa: E501 + + + :return: The password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this RepositorySettings. + + + :param password: The password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def private_key(self): + """Gets the private_key of this RepositorySettings. # noqa: E501 + + + :return: The private_key of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key + + @private_key.setter + def private_key(self, private_key): + """Sets the private_key of this RepositorySettings. + + + :param private_key: The private_key of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key = private_key + + @property + def private_key_file_name(self): + """Gets the private_key_file_name of this RepositorySettings. # noqa: E501 + + + :return: The private_key_file_name of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_file_name + + @private_key_file_name.setter + def private_key_file_name(self, private_key_file_name): + """Sets the private_key_file_name of this RepositorySettings. + + + :param private_key_file_name: The private_key_file_name of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_file_name = private_key_file_name + + @property + def private_key_password(self): + """Gets the private_key_password of this RepositorySettings. # noqa: E501 + + + :return: The private_key_password of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._private_key_password + + @private_key_password.setter + def private_key_password(self, private_key_password): + """Sets the private_key_password of this RepositorySettings. + + + :param private_key_password: The private_key_password of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._private_key_password = private_key_password + + @property + def read_only(self): + """Gets the read_only of this RepositorySettings. # noqa: E501 + + + :return: The read_only of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettings. + + + :param read_only: The read_only of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + @property + def repository_uri(self): + """Gets the repository_uri of this RepositorySettings. # noqa: E501 + + + :return: The repository_uri of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._repository_uri + + @repository_uri.setter + def repository_uri(self, repository_uri): + """Sets the repository_uri of this RepositorySettings. + + + :param repository_uri: The repository_uri of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._repository_uri = repository_uri + + @property + def show_merge_commits(self): + """Gets the show_merge_commits of this RepositorySettings. # noqa: E501 + + + :return: The show_merge_commits of this RepositorySettings. # noqa: E501 + :rtype: bool + """ + return self._show_merge_commits + + @show_merge_commits.setter + def show_merge_commits(self, show_merge_commits): + """Sets the show_merge_commits of this RepositorySettings. + + + :param show_merge_commits: The show_merge_commits of this RepositorySettings. # noqa: E501 + :type: bool + """ + + self._show_merge_commits = show_merge_commits + + @property + def username(self): + """Gets the username of this RepositorySettings. # noqa: E501 + + + :return: The username of this RepositorySettings. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this RepositorySettings. + + + :param username: The username of this RepositorySettings. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/repository_settings_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/repository_settings_info.py new file mode 100644 index 0000000..f45d24d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/repository_settings_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RepositorySettingsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configured': 'bool', + 'read_only': 'bool' + } + + attribute_map = { + 'configured': 'configured', + 'read_only': 'readOnly' + } + + def __init__(self, configured=None, read_only=None): # noqa: E501 + """RepositorySettingsInfo - a model defined in Swagger""" # noqa: E501 + self._configured = None + self._read_only = None + self.discriminator = None + if configured is not None: + self.configured = configured + if read_only is not None: + self.read_only = read_only + + @property + def configured(self): + """Gets the configured of this RepositorySettingsInfo. # noqa: E501 + + + :return: The configured of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._configured + + @configured.setter + def configured(self, configured): + """Sets the configured of this RepositorySettingsInfo. + + + :param configured: The configured of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._configured = configured + + @property + def read_only(self): + """Gets the read_only of this RepositorySettingsInfo. # noqa: E501 + + + :return: The read_only of this RepositorySettingsInfo. # noqa: E501 + :rtype: bool + """ + return self._read_only + + @read_only.setter + def read_only(self, read_only): + """Sets the read_only of this RepositorySettingsInfo. + + + :param read_only: The read_only of this RepositorySettingsInfo. # noqa: E501 + :type: bool + """ + + self._read_only = read_only + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RepositorySettingsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RepositorySettingsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/reset_password_email_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/reset_password_email_request.py new file mode 100644 index 0000000..4ec3127 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/reset_password_email_request.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordEmailRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str' + } + + attribute_map = { + 'email': 'email' + } + + def __init__(self, email=None): # noqa: E501 + """ResetPasswordEmailRequest - a model defined in Swagger""" # noqa: E501 + self._email = None + self.discriminator = None + if email is not None: + self.email = email + + @property + def email(self): + """Gets the email of this ResetPasswordEmailRequest. # noqa: E501 + + The email of the user # noqa: E501 + + :return: The email of this ResetPasswordEmailRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this ResetPasswordEmailRequest. + + The email of the user # noqa: E501 + + :param email: The email of this ResetPasswordEmailRequest. # noqa: E501 + :type: str + """ + + self._email = email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordEmailRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordEmailRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/reset_password_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/reset_password_request.py new file mode 100644 index 0000000..e5cbe9e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/reset_password_request.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResetPasswordRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'reset_token': 'str', + 'password': 'str' + } + + attribute_map = { + 'reset_token': 'resetToken', + 'password': 'password' + } + + def __init__(self, reset_token=None, password=None): # noqa: E501 + """ResetPasswordRequest - a model defined in Swagger""" # noqa: E501 + self._reset_token = None + self._password = None + self.discriminator = None + if reset_token is not None: + self.reset_token = reset_token + if password is not None: + self.password = password + + @property + def reset_token(self): + """Gets the reset_token of this ResetPasswordRequest. # noqa: E501 + + The reset token to verify # noqa: E501 + + :return: The reset_token of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ResetPasswordRequest. + + The reset token to verify # noqa: E501 + + :param reset_token: The reset_token of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + @property + def password(self): + """Gets the password of this ResetPasswordRequest. # noqa: E501 + + The new password to set # noqa: E501 + + :return: The password of this ResetPasswordRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this ResetPasswordRequest. + + The new password to set # noqa: E501 + + :param password: The password of this ResetPasswordRequest. # noqa: E501 + :type: str + """ + + self._password = password + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResetPasswordRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResetPasswordRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/resource.py b/tb-rest-client/python/tb_rest_client/models/models_pe/resource.py new file mode 100644 index 0000000..df14158 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/resource.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Resource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'file': 'str', + 'filename': 'str', + 'input_stream': 'InputStream', + 'open': 'bool', + 'readable': 'bool', + 'uri': 'str', + 'url': 'str' + } + + attribute_map = { + 'description': 'description', + 'file': 'file', + 'filename': 'filename', + 'input_stream': 'inputStream', + 'open': 'open', + 'readable': 'readable', + 'uri': 'uri', + 'url': 'url' + } + + def __init__(self, description=None, file=None, filename=None, input_stream=None, open=None, readable=None, uri=None, url=None): # noqa: E501 + """Resource - a model defined in Swagger""" # noqa: E501 + self._description = None + self._file = None + self._filename = None + self._input_stream = None + self._open = None + self._readable = None + self._uri = None + self._url = None + self.discriminator = None + if description is not None: + self.description = description + if file is not None: + self.file = file + if filename is not None: + self.filename = filename + if input_stream is not None: + self.input_stream = input_stream + if open is not None: + self.open = open + if readable is not None: + self.readable = readable + if uri is not None: + self.uri = uri + if url is not None: + self.url = url + + @property + def description(self): + """Gets the description of this Resource. # noqa: E501 + + + :return: The description of this Resource. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this Resource. + + + :param description: The description of this Resource. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def file(self): + """Gets the file of this Resource. # noqa: E501 + + + :return: The file of this Resource. # noqa: E501 + :rtype: str + """ + return self._file + + @file.setter + def file(self, file): + """Sets the file of this Resource. + + + :param file: The file of this Resource. # noqa: E501 + :type: str + """ + + self._file = file + + @property + def filename(self): + """Gets the filename of this Resource. # noqa: E501 + + + :return: The filename of this Resource. # noqa: E501 + :rtype: str + """ + return self._filename + + @filename.setter + def filename(self, filename): + """Sets the filename of this Resource. + + + :param filename: The filename of this Resource. # noqa: E501 + :type: str + """ + + self._filename = filename + + @property + def input_stream(self): + """Gets the input_stream of this Resource. # noqa: E501 + + + :return: The input_stream of this Resource. # noqa: E501 + :rtype: InputStream + """ + return self._input_stream + + @input_stream.setter + def input_stream(self, input_stream): + """Sets the input_stream of this Resource. + + + :param input_stream: The input_stream of this Resource. # noqa: E501 + :type: InputStream + """ + + self._input_stream = input_stream + + @property + def open(self): + """Gets the open of this Resource. # noqa: E501 + + + :return: The open of this Resource. # noqa: E501 + :rtype: bool + """ + return self._open + + @open.setter + def open(self, open): + """Sets the open of this Resource. + + + :param open: The open of this Resource. # noqa: E501 + :type: bool + """ + + self._open = open + + @property + def readable(self): + """Gets the readable of this Resource. # noqa: E501 + + + :return: The readable of this Resource. # noqa: E501 + :rtype: bool + """ + return self._readable + + @readable.setter + def readable(self, readable): + """Sets the readable of this Resource. + + + :param readable: The readable of this Resource. # noqa: E501 + :type: bool + """ + + self._readable = readable + + @property + def uri(self): + """Gets the uri of this Resource. # noqa: E501 + + + :return: The uri of this Resource. # noqa: E501 + :rtype: str + """ + return self._uri + + @uri.setter + def uri(self, uri): + """Sets the uri of this Resource. + + + :param uri: The uri of this Resource. # noqa: E501 + :type: str + """ + + self._uri = uri + + @property + def url(self): + """Gets the url of this Resource. # noqa: E501 + + + :return: The url of this Resource. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this Resource. + + + :param url: The url of this Resource. # noqa: E501 + :type: str + """ + + self._url = url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Resource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Resource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/response_entity.py b/tb-rest-client/python/tb_rest_client/models/models_pe/response_entity.py new file mode 100644 index 0000000..64d542e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/response_entity.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ResponseEntity(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'object', + 'status_code': 'str', + 'status_code_value': 'int' + } + + attribute_map = { + 'body': 'body', + 'status_code': 'statusCode', + 'status_code_value': 'statusCodeValue' + } + + def __init__(self, body=None, status_code=None, status_code_value=None): # noqa: E501 + """ResponseEntity - a model defined in Swagger""" # noqa: E501 + self._body = None + self._status_code = None + self._status_code_value = None + self.discriminator = None + if body is not None: + self.body = body + if status_code is not None: + self.status_code = status_code + if status_code_value is not None: + self.status_code_value = status_code_value + + @property + def body(self): + """Gets the body of this ResponseEntity. # noqa: E501 + + + :return: The body of this ResponseEntity. # noqa: E501 + :rtype: object + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this ResponseEntity. + + + :param body: The body of this ResponseEntity. # noqa: E501 + :type: object + """ + + self._body = body + + @property + def status_code(self): + """Gets the status_code of this ResponseEntity. # noqa: E501 + + + :return: The status_code of this ResponseEntity. # noqa: E501 + :rtype: str + """ + return self._status_code + + @status_code.setter + def status_code(self, status_code): + """Sets the status_code of this ResponseEntity. + + + :param status_code: The status_code of this ResponseEntity. # noqa: E501 + :type: str + """ + allowed_values = ["ACCEPTED", "ALREADY_REPORTED", "BAD_GATEWAY", "BAD_REQUEST", "BANDWIDTH_LIMIT_EXCEEDED", "CHECKPOINT", "CONFLICT", "CONTINUE", "CREATED", "DESTINATION_LOCKED", "EXPECTATION_FAILED", "FAILED_DEPENDENCY", "FORBIDDEN", "FOUND", "GATEWAY_TIMEOUT", "GONE", "HTTP_VERSION_NOT_SUPPORTED", "IM_USED", "INSUFFICIENT_SPACE_ON_RESOURCE", "INSUFFICIENT_STORAGE", "INTERNAL_SERVER_ERROR", "I_AM_A_TEAPOT", "LENGTH_REQUIRED", "LOCKED", "LOOP_DETECTED", "METHOD_FAILURE", "METHOD_NOT_ALLOWED", "MOVED_PERMANENTLY", "MOVED_TEMPORARILY", "MULTIPLE_CHOICES", "MULTI_STATUS", "NETWORK_AUTHENTICATION_REQUIRED", "NON_AUTHORITATIVE_INFORMATION", "NOT_ACCEPTABLE", "NOT_EXTENDED", "NOT_FOUND", "NOT_IMPLEMENTED", "NOT_MODIFIED", "NO_CONTENT", "OK", "PARTIAL_CONTENT", "PAYLOAD_TOO_LARGE", "PAYMENT_REQUIRED", "PERMANENT_REDIRECT", "PRECONDITION_FAILED", "PRECONDITION_REQUIRED", "PROCESSING", "PROXY_AUTHENTICATION_REQUIRED", "REQUESTED_RANGE_NOT_SATISFIABLE", "REQUEST_ENTITY_TOO_LARGE", "REQUEST_HEADER_FIELDS_TOO_LARGE", "REQUEST_TIMEOUT", "REQUEST_URI_TOO_LONG", "RESET_CONTENT", "SEE_OTHER", "SERVICE_UNAVAILABLE", "SWITCHING_PROTOCOLS", "TEMPORARY_REDIRECT", "TOO_EARLY", "TOO_MANY_REQUESTS", "UNAUTHORIZED", "UNAVAILABLE_FOR_LEGAL_REASONS", "UNPROCESSABLE_ENTITY", "UNSUPPORTED_MEDIA_TYPE", "UPGRADE_REQUIRED", "URI_TOO_LONG", "USE_PROXY", "VARIANT_ALSO_NEGOTIATES"] # noqa: E501 + if status_code not in allowed_values: + raise ValueError( + "Invalid value for `status_code` ({0}), must be one of {1}" # noqa: E501 + .format(status_code, allowed_values) + ) + + self._status_code = status_code + + @property + def status_code_value(self): + """Gets the status_code_value of this ResponseEntity. # noqa: E501 + + + :return: The status_code_value of this ResponseEntity. # noqa: E501 + :rtype: int + """ + return self._status_code_value + + @status_code_value.setter + def status_code_value(self, status_code_value): + """Sets the status_code_value of this ResponseEntity. + + + :param status_code_value: The status_code_value of this ResponseEntity. # noqa: E501 + :type: int + """ + + self._status_code_value = status_code_value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ResponseEntity, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ResponseEntity): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/role.py b/tb-rest-client/python/tb_rest_client/models/models_pe/role.py new file mode 100644 index 0000000..48ab3a2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/role.py @@ -0,0 +1,357 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Role(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'RoleId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'permissions': 'JsonNode', + 'additional_info': 'JsonNode', + 'external_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'permissions': 'permissions', + 'additional_info': 'additionalInfo', + 'external_id': 'externalId' + } + + def __init__(self, id=None, created_time=None, external_id=None, tenant_id=None, customer_id=None, owner_id=None, name=None, type=None, permissions=None, additional_info=None): # noqa: E501 + """Role - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._owner_id = None + self._name = None + self._type = None + self._permissions = None + self._additional_info = None + self._external_id = None + self.discriminator = None + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if owner_id is not None: + self.owner_id = owner_id + self.name = name + self.type = type + if permissions is not None: + self.permissions = permissions + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Role. # noqa: E501 + + + :return: The id of this Role. # noqa: E501 + :rtype: RoleId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Role. + + + :param id: The id of this Role. # noqa: E501 + :type: RoleId + """ + + self._id = id + + @property + def external_id(self): + return self._external_id + + @external_id.setter + def external_id(self, external_id): + self._external_id = external_id + + @property + def created_time(self): + """Gets the created_time of this Role. # noqa: E501 + + Timestamp of the role creation, in milliseconds # noqa: E501 + + :return: The created_time of this Role. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Role. + + Timestamp of the role creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Role. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Role. # noqa: E501 + + + :return: The tenant_id of this Role. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Role. + + + :param tenant_id: The tenant_id of this Role. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this Role. # noqa: E501 + + + :return: The customer_id of this Role. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this Role. + + + :param customer_id: The customer_id of this Role. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def owner_id(self): + """Gets the owner_id of this Role. # noqa: E501 + + + :return: The owner_id of this Role. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this Role. + + + :param owner_id: The owner_id of this Role. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this Role. # noqa: E501 + + Role Name # noqa: E501 + + :return: The name of this Role. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this Role. + + Role Name # noqa: E501 + + :param name: The name of this Role. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this Role. # noqa: E501 + + Type of the role: generic or group # noqa: E501 + + :return: The type of this Role. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Role. + + Type of the role: generic or group # noqa: E501 + + :param type: The type of this Role. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["GENERIC", "GROUP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def permissions(self): + """Gets the permissions of this Role. # noqa: E501 + + + :return: The permissions of this Role. # noqa: E501 + :rtype: JsonNode + """ + return self._permissions + + @permissions.setter + def permissions(self, permissions): + """Sets the permissions of this Role. + + + :param permissions: The permissions of this Role. # noqa: E501 + :type: JsonNode + """ + + self._permissions = permissions + + @property + def additional_info(self): + """Gets the additional_info of this Role. # noqa: E501 + + + :return: The additional_info of this Role. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Role. + + + :param additional_info: The additional_info of this Role. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Role, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Role): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/role_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/role_id.py new file mode 100644 index 0000000..b238d53 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/role_id.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RoleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RoleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RoleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RoleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RoleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RoleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RoleId. # noqa: E501 + + + :return: The entity_type of this RoleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RoleId. + + + :param entity_type: The entity_type of this RoleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RoleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RoleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rpc.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rpc.py new file mode 100644 index 0000000..8ad8c7e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rpc.py @@ -0,0 +1,344 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class Rpc(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'RpcId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_id': 'DeviceId', + 'expiration_time': 'int', + 'request': 'JsonNode', + 'response': 'JsonNode', + 'status': 'str', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_id': 'deviceId', + 'expiration_time': 'expirationTime', + 'request': 'request', + 'response': 'response', + 'status': 'status', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_id=None, expiration_time=None, request=None, response=None, status=None, additional_info=None): # noqa: E501 + """Rpc - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_id = None + self._expiration_time = None + self._request = None + self._response = None + self._status = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_id is not None: + self.device_id = device_id + if expiration_time is not None: + self.expiration_time = expiration_time + if request is not None: + self.request = request + if response is not None: + self.response = response + if status is not None: + self.status = status + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this Rpc. # noqa: E501 + + + :return: The id of this Rpc. # noqa: E501 + :rtype: RpcId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Rpc. + + + :param id: The id of this Rpc. # noqa: E501 + :type: RpcId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this Rpc. # noqa: E501 + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :return: The created_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this Rpc. + + Timestamp of the rpc creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this Rpc. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this Rpc. # noqa: E501 + + + :return: The tenant_id of this Rpc. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this Rpc. + + + :param tenant_id: The tenant_id of this Rpc. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_id(self): + """Gets the device_id of this Rpc. # noqa: E501 + + + :return: The device_id of this Rpc. # noqa: E501 + :rtype: DeviceId + """ + return self._device_id + + @device_id.setter + def device_id(self, device_id): + """Sets the device_id of this Rpc. + + + :param device_id: The device_id of this Rpc. # noqa: E501 + :type: DeviceId + """ + + self._device_id = device_id + + @property + def expiration_time(self): + """Gets the expiration_time of this Rpc. # noqa: E501 + + Expiration time of the request. # noqa: E501 + + :return: The expiration_time of this Rpc. # noqa: E501 + :rtype: int + """ + return self._expiration_time + + @expiration_time.setter + def expiration_time(self, expiration_time): + """Sets the expiration_time of this Rpc. + + Expiration time of the request. # noqa: E501 + + :param expiration_time: The expiration_time of this Rpc. # noqa: E501 + :type: int + """ + + self._expiration_time = expiration_time + + @property + def request(self): + """Gets the request of this Rpc. # noqa: E501 + + + :return: The request of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._request + + @request.setter + def request(self, request): + """Sets the request of this Rpc. + + + :param request: The request of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._request = request + + @property + def response(self): + """Gets the response of this Rpc. # noqa: E501 + + + :return: The response of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._response + + @response.setter + def response(self, response): + """Sets the response of this Rpc. + + + :param response: The response of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._response = response + + @property + def status(self): + """Gets the status of this Rpc. # noqa: E501 + + The current status of the RPC call. # noqa: E501 + + :return: The status of this Rpc. # noqa: E501 + :rtype: str + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this Rpc. + + The current status of the RPC call. # noqa: E501 + + :param status: The status of this Rpc. # noqa: E501 + :type: str + """ + allowed_values = ["DELETED", "DELIVERED", "EXPIRED", "FAILED", "QUEUED", "SENT", "SUCCESSFUL", "TIMEOUT"] # noqa: E501 + if status not in allowed_values: + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 + .format(status, allowed_values) + ) + + self._status = status + + @property + def additional_info(self): + """Gets the additional_info of this Rpc. # noqa: E501 + + + :return: The additional_info of this Rpc. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this Rpc. + + + :param additional_info: The additional_info of this Rpc. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Rpc, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Rpc): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rpc_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rpc_id.py new file mode 100644 index 0000000..00197f2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rpc_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RpcId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RpcId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RpcId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RpcId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RpcId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RpcId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RpcId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RpcId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RpcId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RpcId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RPC"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RpcId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RpcId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rpk_lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rpk_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..0be8710 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rpk_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.4.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RPKLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """RPKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this RPKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this RPKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this RPKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this RPKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this RPKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this RPKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RPKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RPKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rpklw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rpklw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..9aa502e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rpklw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RPKLwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """RPKLwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this RPKLwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this RPKLwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this RPKLwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this RPKLwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this RPKLwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this RPKLwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this RPKLwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this RPKLwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this RPKLwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this RPKLwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RPKLwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RPKLwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain.py new file mode 100644 index 0000000..7f57525 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain.py @@ -0,0 +1,376 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChain(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'id': 'RuleChainId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'name': 'str', + 'type': 'str', + 'first_rule_node_id': 'RuleNodeId', + 'root': 'bool', + 'debug_mode': 'bool', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'name': 'name', + 'type': 'type', + 'first_rule_node_id': 'firstRuleNodeId', + 'root': 'root', + 'debug_mode': 'debugMode', + 'configuration': 'configuration' + } + + def __init__(self, additional_info=None, id=None, created_time=None, tenant_id=None, name=None, type=None, first_rule_node_id=None, root=None, debug_mode=None, configuration=None): # noqa: E501 + """RuleChain - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._id = None + self._created_time = None + self._tenant_id = None + self._name = None + self._type = None + self._first_rule_node_id = None + self._root = None + self._debug_mode = None + self._configuration = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + self.tenant_id = tenant_id + self.name = name + if type is not None: + self.type = type + if first_rule_node_id is not None: + self.first_rule_node_id = first_rule_node_id + if root is not None: + self.root = root + if debug_mode is not None: + self.debug_mode = debug_mode + if configuration is not None: + self.configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this RuleChain. # noqa: E501 + + + :return: The additional_info of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChain. + + + :param additional_info: The additional_info of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def id(self): + """Gets the id of this RuleChain. # noqa: E501 + + + :return: The id of this RuleChain. # noqa: E501 + :rtype: RuleChainId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChain. + + + :param id: The id of this RuleChain. # noqa: E501 + :type: RuleChainId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleChain. # noqa: E501 + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleChain. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleChain. + + Timestamp of the rule chain creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleChain. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this RuleChain. # noqa: E501 + + + :return: The tenant_id of this RuleChain. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this RuleChain. + + + :param tenant_id: The tenant_id of this RuleChain. # noqa: E501 + :type: TenantId + """ + if tenant_id is None: + raise ValueError("Invalid value for `tenant_id`, must not be `None`") # noqa: E501 + + self._tenant_id = tenant_id + + @property + def name(self): + """Gets the name of this RuleChain. # noqa: E501 + + Rule Chain name # noqa: E501 + + :return: The name of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleChain. + + Rule Chain name # noqa: E501 + + :param name: The name of this RuleChain. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + @property + def type(self): + """Gets the type of this RuleChain. # noqa: E501 + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :return: The type of this RuleChain. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChain. + + Rule Chain type. 'EDGE' rule chains are processing messages on the edge devices only. # noqa: E501 + + :param type: The type of this RuleChain. # noqa: E501 + :type: str + """ + allowed_values = ["CORE", "EDGE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def first_rule_node_id(self): + """Gets the first_rule_node_id of this RuleChain. # noqa: E501 + + + :return: The first_rule_node_id of this RuleChain. # noqa: E501 + :rtype: RuleNodeId + """ + return self._first_rule_node_id + + @first_rule_node_id.setter + def first_rule_node_id(self, first_rule_node_id): + """Sets the first_rule_node_id of this RuleChain. + + + :param first_rule_node_id: The first_rule_node_id of this RuleChain. # noqa: E501 + :type: RuleNodeId + """ + + self._first_rule_node_id = first_rule_node_id + + @property + def root(self): + """Gets the root of this RuleChain. # noqa: E501 + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :return: The root of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._root + + @root.setter + def root(self, root): + """Sets the root of this RuleChain. + + Indicates root rule chain. The root rule chain process messages from all devices and entities by default. User may configure default rule chain per device profile. # noqa: E501 + + :param root: The root of this RuleChain. # noqa: E501 + :type: bool + """ + + self._root = root + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleChain. # noqa: E501 + + Reserved for future usage. # noqa: E501 + + :return: The debug_mode of this RuleChain. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleChain. + + Reserved for future usage. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleChain. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def configuration(self): + """Gets the configuration of this RuleChain. # noqa: E501 + + + :return: The configuration of this RuleChain. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleChain. + + + :param configuration: The configuration of this RuleChain. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChain, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChain): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_connection_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_connection_info.py new file mode 100644 index 0000000..3973a0f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_connection_info.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainConnectionInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'from_index': 'int', + 'target_rule_chain_id': 'RuleChainId', + 'additional_info': 'JsonNode', + 'type': 'str' + } + + attribute_map = { + 'from_index': 'fromIndex', + 'target_rule_chain_id': 'targetRuleChainId', + 'additional_info': 'additionalInfo', + 'type': 'type' + } + + def __init__(self, from_index=None, target_rule_chain_id=None, additional_info=None, type=None): # noqa: E501 + """RuleChainConnectionInfo - a model defined in Swagger""" # noqa: E501 + self._from_index = None + self._target_rule_chain_id = None + self._additional_info = None + self._type = None + self.discriminator = None + self.from_index = from_index + self.target_rule_chain_id = target_rule_chain_id + self.additional_info = additional_info + self.type = type + + @property + def from_index(self): + """Gets the from_index of this RuleChainConnectionInfo. # noqa: E501 + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :return: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :rtype: int + """ + return self._from_index + + @from_index.setter + def from_index(self, from_index): + """Sets the from_index of this RuleChainConnectionInfo. + + Index of rule node in the 'nodes' array of the RuleChainMetaData. Indicates the 'from' part of the connection. # noqa: E501 + + :param from_index: The from_index of this RuleChainConnectionInfo. # noqa: E501 + :type: int + """ + if from_index is None: + raise ValueError("Invalid value for `from_index`, must not be `None`") # noqa: E501 + + self._from_index = from_index + + @property + def target_rule_chain_id(self): + """Gets the target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :rtype: RuleChainId + """ + return self._target_rule_chain_id + + @target_rule_chain_id.setter + def target_rule_chain_id(self, target_rule_chain_id): + """Sets the target_rule_chain_id of this RuleChainConnectionInfo. + + + :param target_rule_chain_id: The target_rule_chain_id of this RuleChainConnectionInfo. # noqa: E501 + :type: RuleChainId + """ + if target_rule_chain_id is None: + raise ValueError("Invalid value for `target_rule_chain_id`, must not be `None`") # noqa: E501 + + self._target_rule_chain_id = target_rule_chain_id + + @property + def additional_info(self): + """Gets the additional_info of this RuleChainConnectionInfo. # noqa: E501 + + + :return: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleChainConnectionInfo. + + + :param additional_info: The additional_info of this RuleChainConnectionInfo. # noqa: E501 + :type: JsonNode + """ + if additional_info is None: + raise ValueError("Invalid value for `additional_info`, must not be `None`") # noqa: E501 + + self._additional_info = additional_info + + @property + def type(self): + """Gets the type of this RuleChainConnectionInfo. # noqa: E501 + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :return: The type of this RuleChainConnectionInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleChainConnectionInfo. + + Type of the relation. Typically indicated the result of processing by the 'from' rule node. For example, 'Success' or 'Failure' # noqa: E501 + + :param type: The type of this RuleChainConnectionInfo. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainConnectionInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainConnectionInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_data.py new file mode 100644 index 0000000..0452057 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_data.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chains': 'list[RuleChain]', + 'metadata': 'list[RuleChainMetaData]' + } + + attribute_map = { + 'rule_chains': 'ruleChains', + 'metadata': 'metadata' + } + + def __init__(self, rule_chains=None, metadata=None): # noqa: E501 + """RuleChainData - a model defined in Swagger""" # noqa: E501 + self._rule_chains = None + self._metadata = None + self.discriminator = None + self.rule_chains = rule_chains + self.metadata = metadata + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleChainData. # noqa: E501 + + List of the Rule Chain objects. # noqa: E501 + + :return: The rule_chains of this RuleChainData. # noqa: E501 + :rtype: list[RuleChain] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleChainData. + + List of the Rule Chain objects. # noqa: E501 + + :param rule_chains: The rule_chains of this RuleChainData. # noqa: E501 + :type: list[RuleChain] + """ + if rule_chains is None: + raise ValueError("Invalid value for `rule_chains`, must not be `None`") # noqa: E501 + + self._rule_chains = rule_chains + + @property + def metadata(self): + """Gets the metadata of this RuleChainData. # noqa: E501 + + List of the Rule Chain metadata objects. # noqa: E501 + + :return: The metadata of this RuleChainData. # noqa: E501 + :rtype: list[RuleChainMetaData] + """ + return self._metadata + + @metadata.setter + def metadata(self, metadata): + """Sets the metadata of this RuleChainData. + + List of the Rule Chain metadata objects. # noqa: E501 + + :param metadata: The metadata of this RuleChainData. # noqa: E501 + :type: list[RuleChainMetaData] + """ + if metadata is None: + raise ValueError("Invalid value for `metadata`, must not be `None`") # noqa: E501 + + self._metadata = metadata + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_debug_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_debug_event_filter.py new file mode 100644 index 0000000..227bc4f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_debug_event_filter.py @@ -0,0 +1,275 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class RuleChainDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'message': 'str', + 'error_str': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'message': 'message', + 'error_str': 'errorStr' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, message=None, error_str=None, *args, **kwargs): # noqa: E501 + """RuleChainDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._message = None + self._error_str = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if message is not None: + self.message = message + if error_str is not None: + self.error_str = error_str + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainDebugEventFilter. + + + :param error: The error of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleChainDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleChainDebugEventFilter. + + + :param not_empty: The not_empty of this RuleChainDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleChainDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleChainDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def message(self): + """Gets the message of this RuleChainDebugEventFilter. # noqa: E501 + + String value representing the message # noqa: E501 + + :return: The message of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this RuleChainDebugEventFilter. + + String value representing the message # noqa: E501 + + :param message: The message of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_str(self): + """Gets the error_str of this RuleChainDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleChainDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleChainDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_export_data.py new file mode 100644 index 0000000..11da9be --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class RuleChainExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'RuleChain', + 'entity_type': 'str', + 'meta_data': 'RuleChainMetaData', + 'relations': 'list[EntityRelation]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'meta_data': 'metaData', + 'relations': 'relations' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, meta_data=None, relations=None, *args, **kwargs): # noqa: E501 + """RuleChainExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._meta_data = None + self._relations = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if meta_data is not None: + self.meta_data = meta_data + if relations is not None: + self.relations = relations + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this RuleChainExportData. # noqa: E501 + + + :return: The attributes of this RuleChainExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this RuleChainExportData. + + + :param attributes: The attributes of this RuleChainExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this RuleChainExportData. # noqa: E501 + + + :return: The entity of this RuleChainExportData. # noqa: E501 + :rtype: RuleChain + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this RuleChainExportData. + + + :param entity: The entity of this RuleChainExportData. # noqa: E501 + :type: RuleChain + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainExportData. # noqa: E501 + + + :return: The entity_type of this RuleChainExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainExportData. + + + :param entity_type: The entity_type of this RuleChainExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def meta_data(self): + """Gets the meta_data of this RuleChainExportData. # noqa: E501 + + + :return: The meta_data of this RuleChainExportData. # noqa: E501 + :rtype: RuleChainMetaData + """ + return self._meta_data + + @meta_data.setter + def meta_data(self, meta_data): + """Sets the meta_data of this RuleChainExportData. + + + :param meta_data: The meta_data of this RuleChainExportData. # noqa: E501 + :type: RuleChainMetaData + """ + + self._meta_data = meta_data + + @property + def relations(self): + """Gets the relations of this RuleChainExportData. # noqa: E501 + + + :return: The relations of this RuleChainExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this RuleChainExportData. + + + :param relations: The relations of this RuleChainExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_id.py new file mode 100644 index 0000000..d42b988 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleChainId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleChainId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleChainId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleChainId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleChainId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleChainId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleChainId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleChainId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_CHAIN"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_import_result.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_import_result.py new file mode 100644 index 0000000..b69387d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_import_result.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainImportResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'str', + 'rule_chain_id': 'RuleChainId', + 'rule_chain_name': 'str', + 'updated': 'bool' + } + + attribute_map = { + 'error': 'error', + 'rule_chain_id': 'ruleChainId', + 'rule_chain_name': 'ruleChainName', + 'updated': 'updated' + } + + def __init__(self, error=None, rule_chain_id=None, rule_chain_name=None, updated=None): # noqa: E501 + """RuleChainImportResult - a model defined in Swagger""" # noqa: E501 + self._error = None + self._rule_chain_id = None + self._rule_chain_name = None + self._updated = None + self.discriminator = None + if error is not None: + self.error = error + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if rule_chain_name is not None: + self.rule_chain_name = rule_chain_name + if updated is not None: + self.updated = updated + + @property + def error(self): + """Gets the error of this RuleChainImportResult. # noqa: E501 + + + :return: The error of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleChainImportResult. + + + :param error: The error of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainImportResult. + + + :param rule_chain_id: The rule_chain_id of this RuleChainImportResult. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainImportResult. # noqa: E501 + + + :return: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainImportResult. + + + :param rule_chain_name: The rule_chain_name of this RuleChainImportResult. # noqa: E501 + :type: str + """ + + self._rule_chain_name = rule_chain_name + + @property + def updated(self): + """Gets the updated of this RuleChainImportResult. # noqa: E501 + + + :return: The updated of this RuleChainImportResult. # noqa: E501 + :rtype: bool + """ + return self._updated + + @updated.setter + def updated(self, updated): + """Sets the updated of this RuleChainImportResult. + + + :param updated: The updated of this RuleChainImportResult. # noqa: E501 + :type: bool + """ + + self._updated = updated + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainImportResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainImportResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_meta_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_meta_data.py new file mode 100644 index 0000000..43b42d7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_meta_data.py @@ -0,0 +1,241 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainMetaData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'first_node_index': 'int', + 'nodes': 'list[RuleNode]', + 'connections': 'list[NodeConnectionInfo]', + 'rule_chain_connections': 'list[RuleChainConnectionInfo]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'first_node_index': 'firstNodeIndex', + 'nodes': 'nodes', + 'connections': 'connections', + 'rule_chain_connections': 'ruleChainConnections' + } + + def __init__(self, rule_chain_id=None, first_node_index=None, nodes=None, connections=None, rule_chain_connections=None): # noqa: E501 + """RuleChainMetaData - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._first_node_index = None + self._nodes = None + self._connections = None + self._rule_chain_connections = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.first_node_index = first_node_index + self.nodes = nodes + self.connections = connections + self.rule_chain_connections = rule_chain_connections + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainMetaData. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainMetaData. + + + :param rule_chain_id: The rule_chain_id of this RuleChainMetaData. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def first_node_index(self): + """Gets the first_node_index of this RuleChainMetaData. # noqa: E501 + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :return: The first_node_index of this RuleChainMetaData. # noqa: E501 + :rtype: int + """ + return self._first_node_index + + @first_node_index.setter + def first_node_index(self, first_node_index): + """Sets the first_node_index of this RuleChainMetaData. + + Index of the first rule node in the 'nodes' list # noqa: E501 + + :param first_node_index: The first_node_index of this RuleChainMetaData. # noqa: E501 + :type: int + """ + if first_node_index is None: + raise ValueError("Invalid value for `first_node_index`, must not be `None`") # noqa: E501 + + self._first_node_index = first_node_index + + @property + def nodes(self): + """Gets the nodes of this RuleChainMetaData. # noqa: E501 + + List of rule node JSON objects # noqa: E501 + + :return: The nodes of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleNode] + """ + return self._nodes + + @nodes.setter + def nodes(self, nodes): + """Sets the nodes of this RuleChainMetaData. + + List of rule node JSON objects # noqa: E501 + + :param nodes: The nodes of this RuleChainMetaData. # noqa: E501 + :type: list[RuleNode] + """ + if nodes is None: + raise ValueError("Invalid value for `nodes`, must not be `None`") # noqa: E501 + + self._nodes = nodes + + @property + def connections(self): + """Gets the connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :return: The connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[NodeConnectionInfo] + """ + return self._connections + + @connections.setter + def connections(self, connections): + """Sets the connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes # noqa: E501 + + :param connections: The connections of this RuleChainMetaData. # noqa: E501 + :type: list[NodeConnectionInfo] + """ + if connections is None: + raise ValueError("Invalid value for `connections`, must not be `None`") # noqa: E501 + + self._connections = connections + + @property + def rule_chain_connections(self): + """Gets the rule_chain_connections of this RuleChainMetaData. # noqa: E501 + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :return: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :rtype: list[RuleChainConnectionInfo] + """ + return self._rule_chain_connections + + @rule_chain_connections.setter + def rule_chain_connections(self, rule_chain_connections): + """Sets the rule_chain_connections of this RuleChainMetaData. + + List of JSON objects that represent connections between rule nodes and other rule chains. # noqa: E501 + + :param rule_chain_connections: The rule_chain_connections of this RuleChainMetaData. # noqa: E501 + :type: list[RuleChainConnectionInfo] + """ + if rule_chain_connections is None: + raise ValueError("Invalid value for `rule_chain_connections`, must not be `None`") # noqa: E501 + + self._rule_chain_connections = rule_chain_connections + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainMetaData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainMetaData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_output_labels_usage.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_output_labels_usage.py new file mode 100644 index 0000000..3b23ad2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_chain_output_labels_usage.py @@ -0,0 +1,239 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleChainOutputLabelsUsage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'rule_chain_id': 'RuleChainId', + 'rule_node_id': 'RuleNodeId', + 'rule_chain_name': 'str', + 'rule_node_name': 'str', + 'labels': 'list[str]' + } + + attribute_map = { + 'rule_chain_id': 'ruleChainId', + 'rule_node_id': 'ruleNodeId', + 'rule_chain_name': 'ruleChainName', + 'rule_node_name': 'ruleNodeName', + 'labels': 'labels' + } + + def __init__(self, rule_chain_id=None, rule_node_id=None, rule_chain_name=None, rule_node_name=None, labels=None): # noqa: E501 + """RuleChainOutputLabelsUsage - a model defined in Swagger""" # noqa: E501 + self._rule_chain_id = None + self._rule_node_id = None + self._rule_chain_name = None + self._rule_node_name = None + self._labels = None + self.discriminator = None + self.rule_chain_id = rule_chain_id + self.rule_node_id = rule_node_id + self.rule_chain_name = rule_chain_name + self.rule_node_name = rule_node_name + self.labels = labels + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleChainOutputLabelsUsage. + + + :param rule_chain_id: The rule_chain_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleChainId + """ + if rule_chain_id is None: + raise ValueError("Invalid value for `rule_chain_id`, must not be `None`") # noqa: E501 + + self._rule_chain_id = rule_chain_id + + @property + def rule_node_id(self): + """Gets the rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + + + :return: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: RuleNodeId + """ + return self._rule_node_id + + @rule_node_id.setter + def rule_node_id(self, rule_node_id): + """Sets the rule_node_id of this RuleChainOutputLabelsUsage. + + + :param rule_node_id: The rule_node_id of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: RuleNodeId + """ + if rule_node_id is None: + raise ValueError("Invalid value for `rule_node_id`, must not be `None`") # noqa: E501 + + self._rule_node_id = rule_node_id + + @property + def rule_chain_name(self): + """Gets the rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Chain Name # noqa: E501 + + :return: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_chain_name + + @rule_chain_name.setter + def rule_chain_name(self, rule_chain_name): + """Sets the rule_chain_name of this RuleChainOutputLabelsUsage. + + Rule Chain Name # noqa: E501 + + :param rule_chain_name: The rule_chain_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_chain_name is None: + raise ValueError("Invalid value for `rule_chain_name`, must not be `None`") # noqa: E501 + + self._rule_chain_name = rule_chain_name + + @property + def rule_node_name(self): + """Gets the rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + + Rule Node Name # noqa: E501 + + :return: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: str + """ + return self._rule_node_name + + @rule_node_name.setter + def rule_node_name(self, rule_node_name): + """Sets the rule_node_name of this RuleChainOutputLabelsUsage. + + Rule Node Name # noqa: E501 + + :param rule_node_name: The rule_node_name of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: str + """ + if rule_node_name is None: + raise ValueError("Invalid value for `rule_node_name`, must not be `None`") # noqa: E501 + + self._rule_node_name = rule_node_name + + @property + def labels(self): + """Gets the labels of this RuleChainOutputLabelsUsage. # noqa: E501 + + Output labels # noqa: E501 + + :return: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :rtype: list[str] + """ + return self._labels + + @labels.setter + def labels(self, labels): + """Sets the labels of this RuleChainOutputLabelsUsage. + + Output labels # noqa: E501 + + :param labels: The labels of this RuleChainOutputLabelsUsage. # noqa: E501 + :type: list[str] + """ + if labels is None: + raise ValueError("Invalid value for `labels`, must not be `None`") # noqa: E501 + + self._labels = labels + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleChainOutputLabelsUsage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleChainOutputLabelsUsage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py new file mode 100644 index 0000000..3d341a5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_engine_component_lifecycle_event_notification_rule_trigger_config.py @@ -0,0 +1,306 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_rule_trigger_config import NotificationRuleTriggerConfig # noqa: F401,E501 + +class RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig(NotificationRuleTriggerConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'only_rule_chain_lifecycle_failures': 'bool', + 'only_rule_node_lifecycle_failures': 'bool', + 'rule_chain_events': 'list[str]', + 'rule_chains': 'list[str]', + 'rule_node_events': 'list[str]', + 'track_rule_node_events': 'bool', + 'trigger_type': 'str' + } + if hasattr(NotificationRuleTriggerConfig, "swagger_types"): + swagger_types.update(NotificationRuleTriggerConfig.swagger_types) + + attribute_map = { + 'only_rule_chain_lifecycle_failures': 'onlyRuleChainLifecycleFailures', + 'only_rule_node_lifecycle_failures': 'onlyRuleNodeLifecycleFailures', + 'rule_chain_events': 'ruleChainEvents', + 'rule_chains': 'ruleChains', + 'rule_node_events': 'ruleNodeEvents', + 'track_rule_node_events': 'trackRuleNodeEvents', + 'trigger_type': 'triggerType' + } + if hasattr(NotificationRuleTriggerConfig, "attribute_map"): + attribute_map.update(NotificationRuleTriggerConfig.attribute_map) + + def __init__(self, only_rule_chain_lifecycle_failures=None, only_rule_node_lifecycle_failures=None, rule_chain_events=None, rule_chains=None, rule_node_events=None, track_rule_node_events=None, trigger_type=None, *args, **kwargs): # noqa: E501 + """RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig - a model defined in Swagger""" # noqa: E501 + self._only_rule_chain_lifecycle_failures = None + self._only_rule_node_lifecycle_failures = None + self._rule_chain_events = None + self._rule_chains = None + self._rule_node_events = None + self._track_rule_node_events = None + self._trigger_type = None + self.discriminator = None + if only_rule_chain_lifecycle_failures is not None: + self.only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + if only_rule_node_lifecycle_failures is not None: + self.only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + if rule_chain_events is not None: + self.rule_chain_events = rule_chain_events + if rule_chains is not None: + self.rule_chains = rule_chains + if rule_node_events is not None: + self.rule_node_events = rule_node_events + if track_rule_node_events is not None: + self.track_rule_node_events = track_rule_node_events + if trigger_type is not None: + self.trigger_type = trigger_type + NotificationRuleTriggerConfig.__init__(self, *args, **kwargs) + + @property + def only_rule_chain_lifecycle_failures(self): + """Gets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_chain_lifecycle_failures + + @only_rule_chain_lifecycle_failures.setter + def only_rule_chain_lifecycle_failures(self, only_rule_chain_lifecycle_failures): + """Sets the only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_chain_lifecycle_failures: The only_rule_chain_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_chain_lifecycle_failures = only_rule_chain_lifecycle_failures + + @property + def only_rule_node_lifecycle_failures(self): + """Gets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._only_rule_node_lifecycle_failures + + @only_rule_node_lifecycle_failures.setter + def only_rule_node_lifecycle_failures(self, only_rule_node_lifecycle_failures): + """Sets the only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param only_rule_node_lifecycle_failures: The only_rule_node_lifecycle_failures of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._only_rule_node_lifecycle_failures = only_rule_node_lifecycle_failures + + @property + def rule_chain_events(self): + """Gets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chain_events + + @rule_chain_events.setter + def rule_chain_events(self, rule_chain_events): + """Sets the rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chain_events: The rule_chain_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "FAILED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_chain_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_chain_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_chain_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_chain_events = rule_chain_events + + @property + def rule_chains(self): + """Gets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_chains: The rule_chains of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + + self._rule_chains = rule_chains + + @property + def rule_node_events(self): + """Gets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: list[str] + """ + return self._rule_node_events + + @rule_node_events.setter + def rule_node_events(self, rule_node_events): + """Sets the rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param rule_node_events: The rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: list[str] + """ + allowed_values = ["ACTIVATED", "CREATED", "DELETED", "FAILED", "STARTED", "STOPPED", "SUSPENDED", "UPDATED"] # noqa: E501 + if not set(rule_node_events).issubset(set(allowed_values)): + raise ValueError( + "Invalid values for `rule_node_events` [{0}], must be a subset of [{1}]" # noqa: E501 + .format(", ".join(map(str, set(rule_node_events) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) + + self._rule_node_events = rule_node_events + + @property + def track_rule_node_events(self): + """Gets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: bool + """ + return self._track_rule_node_events + + @track_rule_node_events.setter + def track_rule_node_events(self, track_rule_node_events): + """Sets the track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param track_rule_node_events: The track_rule_node_events of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: bool + """ + + self._track_rule_node_events = track_rule_node_events + + @property + def trigger_type(self): + """Gets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + + + :return: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :rtype: str + """ + return self._trigger_type + + @trigger_type.setter + def trigger_type(self, trigger_type): + """Sets the trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. + + + :param trigger_type: The trigger_type of this RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "ALARM_ASSIGNMENT", "ALARM_COMMENT", "API_USAGE_LIMIT", "DEVICE_ACTIVITY", "ENTITIES_LIMIT", "ENTITY_ACTION", "INTEGRATION_LIFECYCLE_EVENT", "NEW_PLATFORM_VERSION", "RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT"] # noqa: E501 + if trigger_type not in allowed_values: + raise ValueError( + "Invalid value for `trigger_type` ({0}), must be one of {1}" # noqa: E501 + .format(trigger_type, allowed_values) + ) + + self._trigger_type = trigger_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleEngineComponentLifecycleEventNotificationRuleTriggerConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node.py new file mode 100644 index 0000000..3d66394 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node.py @@ -0,0 +1,368 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNode(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'RuleNodeId', + 'id': 'RuleNodeId', + 'created_time': 'int', + 'rule_chain_id': 'RuleChainId', + 'type': 'str', + 'name': 'str', + 'debug_mode': 'bool', + 'singleton_mode': 'bool', + 'additional_info': 'JsonNode', + 'configuration': 'JsonNode' + } + + attribute_map = { + 'external_id': 'externalId', + 'id': 'id', + 'created_time': 'createdTime', + 'rule_chain_id': 'ruleChainId', + 'type': 'type', + 'name': 'name', + 'debug_mode': 'debugMode', + 'singleton_mode': 'singletonMode', + 'additional_info': 'additionalInfo', + 'configuration': 'configuration' + } + + def __init__(self, external_id=None, id=None, created_time=None, rule_chain_id=None, type=None, name=None, debug_mode=None, singleton_mode=None, additional_info=None, configuration=None): # noqa: E501 + """RuleNode - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self._id = None + self._created_time = None + self._rule_chain_id = None + self._type = None + self._name = None + self._debug_mode = None + self._singleton_mode = None + self._additional_info = None + self._configuration = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if rule_chain_id is not None: + self.rule_chain_id = rule_chain_id + if type is not None: + self.type = type + if name is not None: + self.name = name + if debug_mode is not None: + self.debug_mode = debug_mode + if singleton_mode is not None: + self.singleton_mode = singleton_mode + if additional_info is not None: + self.additional_info = additional_info + if configuration is not None: + self.configuration = configuration + + @property + def external_id(self): + """Gets the external_id of this RuleNode. # noqa: E501 + + + :return: The external_id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this RuleNode. + + + :param external_id: The external_id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._external_id = external_id + + @property + def id(self): + """Gets the id of this RuleNode. # noqa: E501 + + + :return: The id of this RuleNode. # noqa: E501 + :rtype: RuleNodeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNode. + + + :param id: The id of this RuleNode. # noqa: E501 + :type: RuleNodeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this RuleNode. # noqa: E501 + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :return: The created_time of this RuleNode. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this RuleNode. + + Timestamp of the rule node creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this RuleNode. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def rule_chain_id(self): + """Gets the rule_chain_id of this RuleNode. # noqa: E501 + + + :return: The rule_chain_id of this RuleNode. # noqa: E501 + :rtype: RuleChainId + """ + return self._rule_chain_id + + @rule_chain_id.setter + def rule_chain_id(self, rule_chain_id): + """Sets the rule_chain_id of this RuleNode. + + + :param rule_chain_id: The rule_chain_id of this RuleNode. # noqa: E501 + :type: RuleChainId + """ + + self._rule_chain_id = rule_chain_id + + @property + def type(self): + """Gets the type of this RuleNode. # noqa: E501 + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :return: The type of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this RuleNode. + + Full Java Class Name of the rule node implementation. # noqa: E501 + + :param type: The type of this RuleNode. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def name(self): + """Gets the name of this RuleNode. # noqa: E501 + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :return: The name of this RuleNode. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this RuleNode. + + User defined name of the rule node. Used on UI and for logging. # noqa: E501 + + :param name: The name of this RuleNode. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def debug_mode(self): + """Gets the debug_mode of this RuleNode. # noqa: E501 + + Enable/disable debug. # noqa: E501 + + :return: The debug_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._debug_mode + + @debug_mode.setter + def debug_mode(self, debug_mode): + """Sets the debug_mode of this RuleNode. + + Enable/disable debug. # noqa: E501 + + :param debug_mode: The debug_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._debug_mode = debug_mode + + @property + def singleton_mode(self): + """Gets the singleton_mode of this RuleNode. # noqa: E501 + + Enable/disable singleton mode. # noqa: E501 + + :return: The singleton_mode of this RuleNode. # noqa: E501 + :rtype: bool + """ + return self._singleton_mode + + @singleton_mode.setter + def singleton_mode(self, singleton_mode): + """Sets the singleton_mode of this RuleNode. + + Enable/disable singleton mode. # noqa: E501 + + :param singleton_mode: The singleton_mode of this RuleNode. # noqa: E501 + :type: bool + """ + + self._singleton_mode = singleton_mode + + @property + def additional_info(self): + """Gets the additional_info of this RuleNode. # noqa: E501 + + + :return: The additional_info of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this RuleNode. + + + :param additional_info: The additional_info of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def configuration(self): + """Gets the configuration of this RuleNode. # noqa: E501 + + + :return: The configuration of this RuleNode. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this RuleNode. + + + :param configuration: The configuration of this RuleNode. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNode, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNode): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node_debug_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node_debug_event_filter.py new file mode 100644 index 0000000..e7d7658 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node_debug_event_filter.py @@ -0,0 +1,483 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class RuleNodeDebugEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'error': 'bool', + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'msg_direction_type': 'str', + 'entity_id': 'str', + 'error_str': 'str', + 'entity_type': 'str', + 'msg_id': 'str', + 'msg_type': 'str', + 'relation_type': 'str', + 'data_search': 'str', + 'metadata_search': 'str' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'error': 'error', + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'msg_direction_type': 'msgDirectionType', + 'entity_id': 'entityId', + 'error_str': 'errorStr', + 'entity_type': 'entityType', + 'msg_id': 'msgId', + 'msg_type': 'msgType', + 'relation_type': 'relationType', + 'data_search': 'dataSearch', + 'metadata_search': 'metadataSearch' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, error=None, not_empty=None, event_type=None, server=None, msg_direction_type=None, entity_id=None, error_str=None, entity_type=None, msg_id=None, msg_type=None, relation_type=None, data_search=None, metadata_search=None, *args, **kwargs): # noqa: E501 + """RuleNodeDebugEventFilter - a model defined in Swagger""" # noqa: E501 + self._error = None + self._not_empty = None + self._event_type = None + self._server = None + self._msg_direction_type = None + self._entity_id = None + self._error_str = None + self._entity_type = None + self._msg_id = None + self._msg_type = None + self._relation_type = None + self._data_search = None + self._metadata_search = None + self.discriminator = None + if error is not None: + self.error = error + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if msg_direction_type is not None: + self.msg_direction_type = msg_direction_type + if entity_id is not None: + self.entity_id = entity_id + if error_str is not None: + self.error_str = error_str + if entity_type is not None: + self.entity_type = entity_type + if msg_id is not None: + self.msg_id = msg_id + if msg_type is not None: + self.msg_type = msg_type + if relation_type is not None: + self.relation_type = relation_type + if data_search is not None: + self.data_search = data_search + if metadata_search is not None: + self.metadata_search = metadata_search + EventFilter.__init__(self, *args, **kwargs) + + @property + def error(self): + """Gets the error of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this RuleNodeDebugEventFilter. + + + :param error: The error of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._error = error + + @property + def not_empty(self): + """Gets the not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + + + :return: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this RuleNodeDebugEventFilter. + + + :param not_empty: The not_empty of this RuleNodeDebugEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this RuleNodeDebugEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this RuleNodeDebugEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def msg_direction_type(self): + """Gets the msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :return: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_direction_type + + @msg_direction_type.setter + def msg_direction_type(self, msg_direction_type): + """Sets the msg_direction_type of this RuleNodeDebugEventFilter. + + String value representing msg direction type (incoming to entity or outcoming from entity) # noqa: E501 + + :param msg_direction_type: The msg_direction_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["IN", "OUT"] # noqa: E501 + if msg_direction_type not in allowed_values: + raise ValueError( + "Invalid value for `msg_direction_type` ({0}), must be one of {1}" # noqa: E501 + .format(msg_direction_type, allowed_values) + ) + + self._msg_direction_type = msg_direction_type + + @property + def entity_id(self): + """Gets the entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :return: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this RuleNodeDebugEventFilter. + + String value representing the entity id in the event body (originator of the message) # noqa: E501 + + :param entity_id: The entity_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._entity_id = entity_id + + @property + def error_str(self): + """Gets the error_str of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :return: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._error_str + + @error_str.setter + def error_str(self, error_str): + """Sets the error_str of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on error message # noqa: E501 + + :param error_str: The error_str of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._error_str = error_str + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the entity type # noqa: E501 + + :return: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeDebugEventFilter. + + String value representing the entity type # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + allowed_values = ["DEVICE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def msg_id(self): + """Gets the msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message id in the rule engine # noqa: E501 + + :return: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_id + + @msg_id.setter + def msg_id(self, msg_id): + """Sets the msg_id of this RuleNodeDebugEventFilter. + + String value representing the message id in the rule engine # noqa: E501 + + :param msg_id: The msg_id of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_id = msg_id + + @property + def msg_type(self): + """Gets the msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the message type # noqa: E501 + + :return: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._msg_type + + @msg_type.setter + def msg_type(self, msg_type): + """Sets the msg_type of this RuleNodeDebugEventFilter. + + String value representing the message type # noqa: E501 + + :param msg_type: The msg_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._msg_type = msg_type + + @property + def relation_type(self): + """Gets the relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + + String value representing the type of message routing # noqa: E501 + + :return: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._relation_type + + @relation_type.setter + def relation_type(self, relation_type): + """Sets the relation_type of this RuleNodeDebugEventFilter. + + String value representing the type of message routing # noqa: E501 + + :param relation_type: The relation_type of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._relation_type = relation_type + + @property + def data_search(self): + """Gets the data_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :return: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._data_search + + @data_search.setter + def data_search(self, data_search): + """Sets the data_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on data (key and value) for the message. # noqa: E501 + + :param data_search: The data_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._data_search = data_search + + @property + def metadata_search(self): + """Gets the metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :return: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :rtype: str + """ + return self._metadata_search + + @metadata_search.setter + def metadata_search(self, metadata_search): + """Sets the metadata_search of this RuleNodeDebugEventFilter. + + The case insensitive 'contains' filter based on metadata (key and value) for the message. # noqa: E501 + + :param metadata_search: The metadata_search of this RuleNodeDebugEventFilter. # noqa: E501 + :type: str + """ + + self._metadata_search = metadata_search + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeDebugEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeDebugEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node_id.py new file mode 100644 index 0000000..7d3b8ba --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/rule_node_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class RuleNodeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """RuleNodeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this RuleNodeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this RuleNodeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this RuleNodeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this RuleNodeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this RuleNodeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this RuleNodeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this RuleNodeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["RULE_NODE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(RuleNodeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, RuleNodeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/save_device_with_credentials_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/save_device_with_credentials_request.py new file mode 100644 index 0000000..7ad0047 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/save_device_with_credentials_request.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveDeviceWithCredentialsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'device': 'Device', + 'credentials': 'DeviceCredentials' + } + + attribute_map = { + 'device': 'device', + 'credentials': 'credentials' + } + + def __init__(self, device=None, credentials=None): # noqa: E501 + """SaveDeviceWithCredentialsRequest - a model defined in Swagger""" # noqa: E501 + self._device = None + self._credentials = None + self.discriminator = None + self.device = device + self.credentials = credentials + + @property + def device(self): + """Gets the device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: Device + """ + return self._device + + @device.setter + def device(self, device): + """Sets the device of this SaveDeviceWithCredentialsRequest. + + + :param device: The device of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: Device + """ + if device is None: + raise ValueError("Invalid value for `device`, must not be `None`") # noqa: E501 + + self._device = device + + @property + def credentials(self): + """Gets the credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + + + :return: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :rtype: DeviceCredentials + """ + return self._credentials + + @credentials.setter + def credentials(self, credentials): + """Sets the credentials of this SaveDeviceWithCredentialsRequest. + + + :param credentials: The credentials of this SaveDeviceWithCredentialsRequest. # noqa: E501 + :type: DeviceCredentials + """ + if credentials is None: + raise ValueError("Invalid value for `credentials`, must not be `None`") # noqa: E501 + + self._credentials = credentials + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveDeviceWithCredentialsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveDeviceWithCredentialsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/save_ota_package_info_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/save_ota_package_info_request.py new file mode 100644 index 0000000..63a3a6f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/save_ota_package_info_request.py @@ -0,0 +1,578 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SaveOtaPackageInfoRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'OtaPackageId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'device_profile_id': 'DeviceProfileId', + 'type': 'str', + 'title': 'str', + 'version': 'str', + 'tag': 'str', + 'url': 'str', + 'has_data': 'bool', + 'file_name': 'str', + 'content_type': 'str', + 'checksum_algorithm': 'str', + 'checksum': 'str', + 'data_size': 'int', + 'uses_url': 'bool', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'device_profile_id': 'deviceProfileId', + 'type': 'type', + 'title': 'title', + 'version': 'version', + 'tag': 'tag', + 'url': 'url', + 'has_data': 'hasData', + 'file_name': 'fileName', + 'content_type': 'contentType', + 'checksum_algorithm': 'checksumAlgorithm', + 'checksum': 'checksum', + 'data_size': 'dataSize', + 'uses_url': 'usesUrl', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, device_profile_id=None, type=None, title=None, version=None, tag=None, url=None, has_data=None, file_name=None, content_type=None, checksum_algorithm=None, checksum=None, data_size=None, uses_url=None, additional_info=None): # noqa: E501 + """SaveOtaPackageInfoRequest - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._device_profile_id = None + self._type = None + self._title = None + self._version = None + self._tag = None + self._url = None + self._has_data = None + self._file_name = None + self._content_type = None + self._checksum_algorithm = None + self._checksum = None + self._data_size = None + self._uses_url = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if device_profile_id is not None: + self.device_profile_id = device_profile_id + if type is not None: + self.type = type + if title is not None: + self.title = title + if version is not None: + self.version = version + if tag is not None: + self.tag = tag + if url is not None: + self.url = url + if has_data is not None: + self.has_data = has_data + if file_name is not None: + self.file_name = file_name + if content_type is not None: + self.content_type = content_type + if checksum_algorithm is not None: + self.checksum_algorithm = checksum_algorithm + if checksum is not None: + self.checksum = checksum + if data_size is not None: + self.data_size = data_size + if uses_url is not None: + self.uses_url = uses_url + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: OtaPackageId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SaveOtaPackageInfoRequest. + + + :param id: The id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: OtaPackageId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :return: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SaveOtaPackageInfoRequest. + + Timestamp of the ota package creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SaveOtaPackageInfoRequest. + + + :param tenant_id: The tenant_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def device_profile_id(self): + """Gets the device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: DeviceProfileId + """ + return self._device_profile_id + + @device_profile_id.setter + def device_profile_id(self, device_profile_id): + """Sets the device_profile_id of this SaveOtaPackageInfoRequest. + + + :param device_profile_id: The device_profile_id of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: DeviceProfileId + """ + + self._device_profile_id = device_profile_id + + @property + def type(self): + """Gets the type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package type. # noqa: E501 + + :return: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SaveOtaPackageInfoRequest. + + OTA Package type. # noqa: E501 + + :param type: The type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["FIRMWARE", "SOFTWARE"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def title(self): + """Gets the title of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package title. # noqa: E501 + + :return: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SaveOtaPackageInfoRequest. + + OTA Package title. # noqa: E501 + + :param title: The title of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def version(self): + """Gets the version of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package version. # noqa: E501 + + :return: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this SaveOtaPackageInfoRequest. + + OTA Package version. # noqa: E501 + + :param version: The version of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._version = version + + @property + def tag(self): + """Gets the tag of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package tag. # noqa: E501 + + :return: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._tag + + @tag.setter + def tag(self, tag): + """Sets the tag of this SaveOtaPackageInfoRequest. + + OTA Package tag. # noqa: E501 + + :param tag: The tag of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._tag = tag + + @property + def url(self): + """Gets the url of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package url. # noqa: E501 + + :return: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._url + + @url.setter + def url(self, url): + """Sets the url of this SaveOtaPackageInfoRequest. + + OTA Package url. # noqa: E501 + + :param url: The url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._url = url + + @property + def has_data(self): + """Gets the has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :return: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._has_data + + @has_data.setter + def has_data(self, has_data): + """Sets the has_data of this SaveOtaPackageInfoRequest. + + Indicates OTA Package 'has data'. Field is returned from DB ('true' if data exists or url is set). If OTA Package 'has data' is 'false' we can not assign the OTA Package to the Device or Device Profile. # noqa: E501 + + :param has_data: The has_data of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._has_data = has_data + + @property + def file_name(self): + """Gets the file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package file name. # noqa: E501 + + :return: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this SaveOtaPackageInfoRequest. + + OTA Package file name. # noqa: E501 + + :param file_name: The file_name of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def content_type(self): + """Gets the content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package content type. # noqa: E501 + + :return: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._content_type + + @content_type.setter + def content_type(self, content_type): + """Sets the content_type of this SaveOtaPackageInfoRequest. + + OTA Package content type. # noqa: E501 + + :param content_type: The content_type of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._content_type = content_type + + @property + def checksum_algorithm(self): + """Gets the checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum algorithm. # noqa: E501 + + :return: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum_algorithm + + @checksum_algorithm.setter + def checksum_algorithm(self, checksum_algorithm): + """Sets the checksum_algorithm of this SaveOtaPackageInfoRequest. + + OTA Package checksum algorithm. # noqa: E501 + + :param checksum_algorithm: The checksum_algorithm of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + allowed_values = ["CRC32", "MD5", "MURMUR3_128", "MURMUR3_32", "SHA256", "SHA384", "SHA512"] # noqa: E501 + if checksum_algorithm not in allowed_values: + raise ValueError( + "Invalid value for `checksum_algorithm` ({0}), must be one of {1}" # noqa: E501 + .format(checksum_algorithm, allowed_values) + ) + + self._checksum_algorithm = checksum_algorithm + + @property + def checksum(self): + """Gets the checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package checksum. # noqa: E501 + + :return: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: str + """ + return self._checksum + + @checksum.setter + def checksum(self, checksum): + """Sets the checksum of this SaveOtaPackageInfoRequest. + + OTA Package checksum. # noqa: E501 + + :param checksum: The checksum of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: str + """ + + self._checksum = checksum + + @property + def data_size(self): + """Gets the data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + + OTA Package data size. # noqa: E501 + + :return: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: int + """ + return self._data_size + + @data_size.setter + def data_size(self, data_size): + """Sets the data_size of this SaveOtaPackageInfoRequest. + + OTA Package data size. # noqa: E501 + + :param data_size: The data_size of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: int + """ + + self._data_size = data_size + + @property + def uses_url(self): + """Gets the uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :return: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: bool + """ + return self._uses_url + + @uses_url.setter + def uses_url(self, uses_url): + """Sets the uses_url of this SaveOtaPackageInfoRequest. + + Indicates OTA Package uses url. Should be 'true' if uses url or 'false' if will be used data. # noqa: E501 + + :param uses_url: The uses_url of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: bool + """ + + self._uses_url = uses_url + + @property + def additional_info(self): + """Gets the additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + + + :return: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SaveOtaPackageInfoRequest. + + + :param additional_info: The additional_info of this SaveOtaPackageInfoRequest. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SaveOtaPackageInfoRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SaveOtaPackageInfoRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event.py b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event.py new file mode 100644 index 0000000..53655bc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event.py @@ -0,0 +1,390 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEvent(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'SchedulerEventId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'originator_id': 'EntityId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'schedule': 'JsonNode', + 'configuration': 'JsonNode', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'originator_id': 'originatorId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'schedule': 'schedule', + 'configuration': 'configuration', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, originator_id=None, owner_id=None, name=None, type=None, schedule=None, configuration=None, additional_info=None): # noqa: E501 + """SchedulerEvent - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._originator_id = None + self._owner_id = None + self._name = None + self._type = None + self._schedule = None + self._configuration = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if originator_id is not None: + self.originator_id = originator_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if schedule is not None: + self.schedule = schedule + if configuration is not None: + self.configuration = configuration + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SchedulerEvent. # noqa: E501 + + + :return: The id of this SchedulerEvent. # noqa: E501 + :rtype: SchedulerEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEvent. + + + :param id: The id of this SchedulerEvent. # noqa: E501 + :type: SchedulerEventId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SchedulerEvent. # noqa: E501 + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :return: The created_time of this SchedulerEvent. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SchedulerEvent. + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SchedulerEvent. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SchedulerEvent. # noqa: E501 + + + :return: The tenant_id of this SchedulerEvent. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SchedulerEvent. + + + :param tenant_id: The tenant_id of this SchedulerEvent. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this SchedulerEvent. # noqa: E501 + + + :return: The customer_id of this SchedulerEvent. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this SchedulerEvent. + + + :param customer_id: The customer_id of this SchedulerEvent. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def originator_id(self): + """Gets the originator_id of this SchedulerEvent. # noqa: E501 + + + :return: The originator_id of this SchedulerEvent. # noqa: E501 + :rtype: EntityId + """ + return self._originator_id + + @originator_id.setter + def originator_id(self, originator_id): + """Sets the originator_id of this SchedulerEvent. + + + :param originator_id: The originator_id of this SchedulerEvent. # noqa: E501 + :type: EntityId + """ + + self._originator_id = originator_id + + @property + def owner_id(self): + """Gets the owner_id of this SchedulerEvent. # noqa: E501 + + + :return: The owner_id of this SchedulerEvent. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this SchedulerEvent. + + + :param owner_id: The owner_id of this SchedulerEvent. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this SchedulerEvent. # noqa: E501 + + scheduler event name # noqa: E501 + + :return: The name of this SchedulerEvent. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SchedulerEvent. + + scheduler event name # noqa: E501 + + :param name: The name of this SchedulerEvent. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this SchedulerEvent. # noqa: E501 + + scheduler event type # noqa: E501 + + :return: The type of this SchedulerEvent. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SchedulerEvent. + + scheduler event type # noqa: E501 + + :param type: The type of this SchedulerEvent. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def schedule(self): + """Gets the schedule of this SchedulerEvent. # noqa: E501 + + + :return: The schedule of this SchedulerEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this SchedulerEvent. + + + :param schedule: The schedule of this SchedulerEvent. # noqa: E501 + :type: JsonNode + """ + + self._schedule = schedule + + @property + def configuration(self): + """Gets the configuration of this SchedulerEvent. # noqa: E501 + + + :return: The configuration of this SchedulerEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this SchedulerEvent. + + + :param configuration: The configuration of this SchedulerEvent. # noqa: E501 + :type: JsonNode + """ + + self._configuration = configuration + + @property + def additional_info(self): + """Gets the additional_info of this SchedulerEvent. # noqa: E501 + + + :return: The additional_info of this SchedulerEvent. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SchedulerEvent. + + + :param additional_info: The additional_info of this SchedulerEvent. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEvent, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEvent): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_filter.py new file mode 100644 index 0000000..cc5d73b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class SchedulerEventFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'event_type': 'str', + 'originator': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'event_type': 'eventType', + 'originator': 'originator' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, event_type=None, originator=None, *args, **kwargs): # noqa: E501 + """SchedulerEventFilter - a model defined in Swagger""" # noqa: E501 + self._event_type = None + self._originator = None + self.discriminator = None + if event_type is not None: + self.event_type = event_type + if originator is not None: + self.originator = originator + EntityFilter.__init__(self, *args, **kwargs) + + @property + def event_type(self): + """Gets the event_type of this SchedulerEventFilter. # noqa: E501 + + + :return: The event_type of this SchedulerEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this SchedulerEventFilter. + + + :param event_type: The event_type of this SchedulerEventFilter. # noqa: E501 + :type: str + """ + + self._event_type = event_type + + @property + def originator(self): + """Gets the originator of this SchedulerEventFilter. # noqa: E501 + + + :return: The originator of this SchedulerEventFilter. # noqa: E501 + :rtype: EntityId + """ + return self._originator + + @originator.setter + def originator(self, originator): + """Sets the originator of this SchedulerEventFilter. + + + :param originator: The originator of this SchedulerEventFilter. # noqa: E501 + :type: EntityId + """ + + self._originator = originator + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_id.py new file mode 100644 index 0000000..f9514d4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_id.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEventId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """SchedulerEventId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this SchedulerEventId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this SchedulerEventId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEventId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this SchedulerEventId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_info.py new file mode 100644 index 0000000..8218fe1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_info.py @@ -0,0 +1,364 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEventInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'SchedulerEventId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'originator_id': 'EntityId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'schedule': 'JsonNode', + 'additional_info': 'JsonNode' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'originator_id': 'originatorId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'schedule': 'schedule', + 'additional_info': 'additionalInfo' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, originator_id=None, owner_id=None, name=None, type=None, schedule=None, additional_info=None): # noqa: E501 + """SchedulerEventInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._originator_id = None + self._owner_id = None + self._name = None + self._type = None + self._schedule = None + self._additional_info = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if originator_id is not None: + self.originator_id = originator_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if schedule is not None: + self.schedule = schedule + if additional_info is not None: + self.additional_info = additional_info + + @property + def id(self): + """Gets the id of this SchedulerEventInfo. # noqa: E501 + + + :return: The id of this SchedulerEventInfo. # noqa: E501 + :rtype: SchedulerEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEventInfo. + + + :param id: The id of this SchedulerEventInfo. # noqa: E501 + :type: SchedulerEventId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SchedulerEventInfo. # noqa: E501 + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :return: The created_time of this SchedulerEventInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SchedulerEventInfo. + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SchedulerEventInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The tenant_id of this SchedulerEventInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SchedulerEventInfo. + + + :param tenant_id: The tenant_id of this SchedulerEventInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The customer_id of this SchedulerEventInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this SchedulerEventInfo. + + + :param customer_id: The customer_id of this SchedulerEventInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def originator_id(self): + """Gets the originator_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The originator_id of this SchedulerEventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator_id + + @originator_id.setter + def originator_id(self, originator_id): + """Sets the originator_id of this SchedulerEventInfo. + + + :param originator_id: The originator_id of this SchedulerEventInfo. # noqa: E501 + :type: EntityId + """ + + self._originator_id = originator_id + + @property + def owner_id(self): + """Gets the owner_id of this SchedulerEventInfo. # noqa: E501 + + + :return: The owner_id of this SchedulerEventInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this SchedulerEventInfo. + + + :param owner_id: The owner_id of this SchedulerEventInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this SchedulerEventInfo. # noqa: E501 + + scheduler event name # noqa: E501 + + :return: The name of this SchedulerEventInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SchedulerEventInfo. + + scheduler event name # noqa: E501 + + :param name: The name of this SchedulerEventInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this SchedulerEventInfo. # noqa: E501 + + scheduler event type # noqa: E501 + + :return: The type of this SchedulerEventInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SchedulerEventInfo. + + scheduler event type # noqa: E501 + + :param type: The type of this SchedulerEventInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def schedule(self): + """Gets the schedule of this SchedulerEventInfo. # noqa: E501 + + + :return: The schedule of this SchedulerEventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this SchedulerEventInfo. + + + :param schedule: The schedule of this SchedulerEventInfo. # noqa: E501 + :type: JsonNode + """ + + self._schedule = schedule + + @property + def additional_info(self): + """Gets the additional_info of this SchedulerEventInfo. # noqa: E501 + + + :return: The additional_info of this SchedulerEventInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SchedulerEventInfo. + + + :param additional_info: The additional_info of this SchedulerEventInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_with_customer_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_with_customer_info.py new file mode 100644 index 0000000..e919a2a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/scheduler_event_with_customer_info.py @@ -0,0 +1,420 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SchedulerEventWithCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'SchedulerEventId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'originator_id': 'EntityId', + 'owner_id': 'EntityId', + 'name': 'str', + 'type': 'str', + 'schedule': 'JsonNode', + 'additional_info': 'JsonNode', + 'customer_title': 'str', + 'customer_is_public': 'object' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'originator_id': 'originatorId', + 'owner_id': 'ownerId', + 'name': 'name', + 'type': 'type', + 'schedule': 'schedule', + 'additional_info': 'additionalInfo', + 'customer_title': 'customerTitle', + 'customer_is_public': 'customerIsPublic' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, originator_id=None, owner_id=None, name=None, type=None, schedule=None, additional_info=None, customer_title=None, customer_is_public=None): # noqa: E501 + """SchedulerEventWithCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._originator_id = None + self._owner_id = None + self._name = None + self._type = None + self._schedule = None + self._additional_info = None + self._customer_title = None + self._customer_is_public = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + if originator_id is not None: + self.originator_id = originator_id + if owner_id is not None: + self.owner_id = owner_id + if name is not None: + self.name = name + if type is not None: + self.type = type + if schedule is not None: + self.schedule = schedule + if additional_info is not None: + self.additional_info = additional_info + if customer_title is not None: + self.customer_title = customer_title + if customer_is_public is not None: + self.customer_is_public = customer_is_public + + @property + def id(self): + """Gets the id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: SchedulerEventId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SchedulerEventWithCustomerInfo. + + + :param id: The id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: SchedulerEventId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this SchedulerEventWithCustomerInfo. # noqa: E501 + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :return: The created_time of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this SchedulerEventWithCustomerInfo. + + Timestamp of the scheduler event creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The tenant_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this SchedulerEventWithCustomerInfo. + + + :param tenant_id: The tenant_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The customer_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this SchedulerEventWithCustomerInfo. + + + :param customer_id: The customer_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def originator_id(self): + """Gets the originator_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The originator_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._originator_id + + @originator_id.setter + def originator_id(self, originator_id): + """Sets the originator_id of this SchedulerEventWithCustomerInfo. + + + :param originator_id: The originator_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._originator_id = originator_id + + @property + def owner_id(self): + """Gets the owner_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The owner_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this SchedulerEventWithCustomerInfo. + + + :param owner_id: The owner_id of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def name(self): + """Gets the name of this SchedulerEventWithCustomerInfo. # noqa: E501 + + scheduler event name # noqa: E501 + + :return: The name of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SchedulerEventWithCustomerInfo. + + scheduler event name # noqa: E501 + + :param name: The name of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def type(self): + """Gets the type of this SchedulerEventWithCustomerInfo. # noqa: E501 + + scheduler event type # noqa: E501 + + :return: The type of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SchedulerEventWithCustomerInfo. + + scheduler event type # noqa: E501 + + :param type: The type of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._type = type + + @property + def schedule(self): + """Gets the schedule of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The schedule of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._schedule + + @schedule.setter + def schedule(self, schedule): + """Sets the schedule of this SchedulerEventWithCustomerInfo. + + + :param schedule: The schedule of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._schedule = schedule + + @property + def additional_info(self): + """Gets the additional_info of this SchedulerEventWithCustomerInfo. # noqa: E501 + + + :return: The additional_info of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this SchedulerEventWithCustomerInfo. + + + :param additional_info: The additional_info of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def customer_title(self): + """Gets the customer_title of this SchedulerEventWithCustomerInfo. # noqa: E501 + + Title of the customer # noqa: E501 + + :return: The customer_title of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._customer_title + + @customer_title.setter + def customer_title(self, customer_title): + """Sets the customer_title of this SchedulerEventWithCustomerInfo. + + Title of the customer # noqa: E501 + + :param customer_title: The customer_title of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: str + """ + + self._customer_title = customer_title + + @property + def customer_is_public(self): + """Gets the customer_is_public of this SchedulerEventWithCustomerInfo. # noqa: E501 + + Parameter that specifies if customer is public # noqa: E501 + + :return: The customer_is_public of this SchedulerEventWithCustomerInfo. # noqa: E501 + :rtype: object + """ + return self._customer_is_public + + @customer_is_public.setter + def customer_is_public(self, customer_is_public): + """Sets the customer_is_public of this SchedulerEventWithCustomerInfo. + + Parameter that specifies if customer is public # noqa: E501 + + :param customer_is_public: The customer_is_public of this SchedulerEventWithCustomerInfo. # noqa: E501 + :type: object + """ + + self._customer_is_public = customer_is_public + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SchedulerEventWithCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SchedulerEventWithCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/security_settings.py b/tb-rest-client/python/tb_rest_client/models/models_pe/security_settings.py new file mode 100644 index 0000000..9bb96b6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/security_settings.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SecuritySettings(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'password_policy': 'UserPasswordPolicy', + 'max_failed_login_attempts': 'int', + 'user_lockout_notification_email': 'str' + } + + attribute_map = { + 'password_policy': 'passwordPolicy', + 'max_failed_login_attempts': 'maxFailedLoginAttempts', + 'user_lockout_notification_email': 'userLockoutNotificationEmail' + } + + def __init__(self, password_policy=None, max_failed_login_attempts=None, user_lockout_notification_email=None): # noqa: E501 + """SecuritySettings - a model defined in Swagger""" # noqa: E501 + self._password_policy = None + self._max_failed_login_attempts = None + self._user_lockout_notification_email = None + self.discriminator = None + if password_policy is not None: + self.password_policy = password_policy + if max_failed_login_attempts is not None: + self.max_failed_login_attempts = max_failed_login_attempts + if user_lockout_notification_email is not None: + self.user_lockout_notification_email = user_lockout_notification_email + + @property + def password_policy(self): + """Gets the password_policy of this SecuritySettings. # noqa: E501 + + + :return: The password_policy of this SecuritySettings. # noqa: E501 + :rtype: UserPasswordPolicy + """ + return self._password_policy + + @password_policy.setter + def password_policy(self, password_policy): + """Sets the password_policy of this SecuritySettings. + + + :param password_policy: The password_policy of this SecuritySettings. # noqa: E501 + :type: UserPasswordPolicy + """ + + self._password_policy = password_policy + + @property + def max_failed_login_attempts(self): + """Gets the max_failed_login_attempts of this SecuritySettings. # noqa: E501 + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :return: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :rtype: int + """ + return self._max_failed_login_attempts + + @max_failed_login_attempts.setter + def max_failed_login_attempts(self, max_failed_login_attempts): + """Sets the max_failed_login_attempts of this SecuritySettings. + + Maximum number of failed login attempts allowed before user account is locked. # noqa: E501 + + :param max_failed_login_attempts: The max_failed_login_attempts of this SecuritySettings. # noqa: E501 + :type: int + """ + + self._max_failed_login_attempts = max_failed_login_attempts + + @property + def user_lockout_notification_email(self): + """Gets the user_lockout_notification_email of this SecuritySettings. # noqa: E501 + + Email to use for notifications about locked users. # noqa: E501 + + :return: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :rtype: str + """ + return self._user_lockout_notification_email + + @user_lockout_notification_email.setter + def user_lockout_notification_email(self, user_lockout_notification_email): + """Sets the user_lockout_notification_email of this SecuritySettings. + + Email to use for notifications about locked users. # noqa: E501 + + :param user_lockout_notification_email: The user_lockout_notification_email of this SecuritySettings. # noqa: E501 + :type: str + """ + + self._user_lockout_notification_email = user_lockout_notification_email + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SecuritySettings, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SecuritySettings): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/self_registration_params.py b/tb-rest-client/python/tb_rest_client/models/models_pe/self_registration_params.py new file mode 100644 index 0000000..ad2092e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/self_registration_params.py @@ -0,0 +1,592 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SelfRegistrationParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'admin_settings_id': 'str', + 'sign_up_text_message': 'str', + 'captcha_site_key': 'str', + 'captcha_version': 'str', + 'captcha_action': 'str', + 'show_privacy_policy': 'bool', + 'show_terms_of_use': 'bool', + 'domain_name': 'str', + 'captcha_secret_key': 'str', + 'privacy_policy': 'str', + 'terms_of_use': 'str', + 'notification_email': 'str', + 'default_dashboard_id': 'str', + 'default_dashboard_fullscreen': 'bool', + 'permissions': 'list[GroupPermission]', + 'pkg_name': 'str', + 'app_secret': 'str', + 'app_scheme': 'str', + 'app_host': 'str' + } + + attribute_map = { + 'admin_settings_id': 'adminSettingsId', + 'sign_up_text_message': 'signUpTextMessage', + 'captcha_site_key': 'captchaSiteKey', + 'captcha_version': 'captchaVersion', + 'captcha_action': 'captchaAction', + 'show_privacy_policy': 'showPrivacyPolicy', + 'show_terms_of_use': 'showTermsOfUse', + 'domain_name': 'domainName', + 'captcha_secret_key': 'captchaSecretKey', + 'privacy_policy': 'privacyPolicy', + 'terms_of_use': 'termsOfUse', + 'notification_email': 'notificationEmail', + 'default_dashboard_id': 'defaultDashboardId', + 'default_dashboard_fullscreen': 'defaultDashboardFullscreen', + 'permissions': 'permissions', + 'pkg_name': 'pkgName', + 'app_secret': 'appSecret', + 'app_scheme': 'appScheme', + 'app_host': 'appHost' + } + + def __init__(self, admin_settings_id=None, sign_up_text_message=None, captcha_site_key=None, captcha_version=None, captcha_action=None, show_privacy_policy=None, show_terms_of_use=None, domain_name=None, captcha_secret_key=None, privacy_policy=None, terms_of_use=None, notification_email=None, default_dashboard_id=None, default_dashboard_fullscreen=None, permissions=None, pkg_name=None, app_secret=None, app_scheme=None, app_host=None): # noqa: E501 + """SelfRegistrationParams - a model defined in Swagger""" # noqa: E501 + self._admin_settings_id = None + self._sign_up_text_message = None + self._captcha_site_key = None + self._captcha_version = None + self._captcha_action = None + self._show_privacy_policy = None + self._show_terms_of_use = None + self._domain_name = None + self._captcha_secret_key = None + self._privacy_policy = None + self._terms_of_use = None + self._notification_email = None + self._default_dashboard_id = None + self._default_dashboard_fullscreen = None + self._permissions = None + self._pkg_name = None + self._app_secret = None + self._app_scheme = None + self._app_host = None + self.discriminator = None + if admin_settings_id is not None: + self.admin_settings_id = admin_settings_id + if sign_up_text_message is not None: + self.sign_up_text_message = sign_up_text_message + if captcha_site_key is not None: + self.captcha_site_key = captcha_site_key + if captcha_version is not None: + self.captcha_version = captcha_version + if captcha_action is not None: + self.captcha_action = captcha_action + if show_privacy_policy is not None: + self.show_privacy_policy = show_privacy_policy + if show_terms_of_use is not None: + self.show_terms_of_use = show_terms_of_use + if domain_name is not None: + self.domain_name = domain_name + if captcha_secret_key is not None: + self.captcha_secret_key = captcha_secret_key + if privacy_policy is not None: + self.privacy_policy = privacy_policy + if terms_of_use is not None: + self.terms_of_use = terms_of_use + if notification_email is not None: + self.notification_email = notification_email + if default_dashboard_id is not None: + self.default_dashboard_id = default_dashboard_id + if default_dashboard_fullscreen is not None: + self.default_dashboard_fullscreen = default_dashboard_fullscreen + if permissions is not None: + self.permissions = permissions + if pkg_name is not None: + self.pkg_name = pkg_name + if app_secret is not None: + self.app_secret = app_secret + if app_scheme is not None: + self.app_scheme = app_scheme + if app_host is not None: + self.app_host = app_host + + @property + def admin_settings_id(self): + """Gets the admin_settings_id of this SelfRegistrationParams. # noqa: E501 + + + :return: The admin_settings_id of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._admin_settings_id + + @admin_settings_id.setter + def admin_settings_id(self, admin_settings_id): + """Sets the admin_settings_id of this SelfRegistrationParams. + + + :param admin_settings_id: The admin_settings_id of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._admin_settings_id = admin_settings_id + + @property + def sign_up_text_message(self): + """Gets the sign_up_text_message of this SelfRegistrationParams. # noqa: E501 + + + :return: The sign_up_text_message of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._sign_up_text_message + + @sign_up_text_message.setter + def sign_up_text_message(self, sign_up_text_message): + """Sets the sign_up_text_message of this SelfRegistrationParams. + + + :param sign_up_text_message: The sign_up_text_message of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._sign_up_text_message = sign_up_text_message + + @property + def captcha_site_key(self): + """Gets the captcha_site_key of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_site_key of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_site_key + + @captcha_site_key.setter + def captcha_site_key(self, captcha_site_key): + """Sets the captcha_site_key of this SelfRegistrationParams. + + + :param captcha_site_key: The captcha_site_key of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_site_key = captcha_site_key + + @property + def captcha_version(self): + """Gets the captcha_version of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_version of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_version + + @captcha_version.setter + def captcha_version(self, captcha_version): + """Sets the captcha_version of this SelfRegistrationParams. + + + :param captcha_version: The captcha_version of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_version = captcha_version + + @property + def captcha_action(self): + """Gets the captcha_action of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_action of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_action + + @captcha_action.setter + def captcha_action(self, captcha_action): + """Sets the captcha_action of this SelfRegistrationParams. + + + :param captcha_action: The captcha_action of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_action = captcha_action + + @property + def show_privacy_policy(self): + """Gets the show_privacy_policy of this SelfRegistrationParams. # noqa: E501 + + + :return: The show_privacy_policy of this SelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_privacy_policy + + @show_privacy_policy.setter + def show_privacy_policy(self, show_privacy_policy): + """Sets the show_privacy_policy of this SelfRegistrationParams. + + + :param show_privacy_policy: The show_privacy_policy of this SelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_privacy_policy = show_privacy_policy + + @property + def show_terms_of_use(self): + """Gets the show_terms_of_use of this SelfRegistrationParams. # noqa: E501 + + + :return: The show_terms_of_use of this SelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_terms_of_use + + @show_terms_of_use.setter + def show_terms_of_use(self, show_terms_of_use): + """Sets the show_terms_of_use of this SelfRegistrationParams. + + + :param show_terms_of_use: The show_terms_of_use of this SelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_terms_of_use = show_terms_of_use + + @property + def domain_name(self): + """Gets the domain_name of this SelfRegistrationParams. # noqa: E501 + + + :return: The domain_name of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._domain_name + + @domain_name.setter + def domain_name(self, domain_name): + """Sets the domain_name of this SelfRegistrationParams. + + + :param domain_name: The domain_name of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._domain_name = domain_name + + @property + def captcha_secret_key(self): + """Gets the captcha_secret_key of this SelfRegistrationParams. # noqa: E501 + + + :return: The captcha_secret_key of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_secret_key + + @captcha_secret_key.setter + def captcha_secret_key(self, captcha_secret_key): + """Sets the captcha_secret_key of this SelfRegistrationParams. + + + :param captcha_secret_key: The captcha_secret_key of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_secret_key = captcha_secret_key + + @property + def privacy_policy(self): + """Gets the privacy_policy of this SelfRegistrationParams. # noqa: E501 + + + :return: The privacy_policy of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._privacy_policy + + @privacy_policy.setter + def privacy_policy(self, privacy_policy): + """Sets the privacy_policy of this SelfRegistrationParams. + + + :param privacy_policy: The privacy_policy of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._privacy_policy = privacy_policy + + @property + def terms_of_use(self): + """Gets the terms_of_use of this SelfRegistrationParams. # noqa: E501 + + + :return: The terms_of_use of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._terms_of_use + + @terms_of_use.setter + def terms_of_use(self, terms_of_use): + """Sets the terms_of_use of this SelfRegistrationParams. + + + :param terms_of_use: The terms_of_use of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._terms_of_use = terms_of_use + + @property + def notification_email(self): + """Gets the notification_email of this SelfRegistrationParams. # noqa: E501 + + + :return: The notification_email of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._notification_email + + @notification_email.setter + def notification_email(self, notification_email): + """Sets the notification_email of this SelfRegistrationParams. + + + :param notification_email: The notification_email of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._notification_email = notification_email + + @property + def default_dashboard_id(self): + """Gets the default_dashboard_id of this SelfRegistrationParams. # noqa: E501 + + + :return: The default_dashboard_id of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._default_dashboard_id + + @default_dashboard_id.setter + def default_dashboard_id(self, default_dashboard_id): + """Sets the default_dashboard_id of this SelfRegistrationParams. + + + :param default_dashboard_id: The default_dashboard_id of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._default_dashboard_id = default_dashboard_id + + @property + def default_dashboard_fullscreen(self): + """Gets the default_dashboard_fullscreen of this SelfRegistrationParams. # noqa: E501 + + + :return: The default_dashboard_fullscreen of this SelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._default_dashboard_fullscreen + + @default_dashboard_fullscreen.setter + def default_dashboard_fullscreen(self, default_dashboard_fullscreen): + """Sets the default_dashboard_fullscreen of this SelfRegistrationParams. + + + :param default_dashboard_fullscreen: The default_dashboard_fullscreen of this SelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._default_dashboard_fullscreen = default_dashboard_fullscreen + + @property + def permissions(self): + """Gets the permissions of this SelfRegistrationParams. # noqa: E501 + + + :return: The permissions of this SelfRegistrationParams. # noqa: E501 + :rtype: list[GroupPermission] + """ + return self._permissions + + @permissions.setter + def permissions(self, permissions): + """Sets the permissions of this SelfRegistrationParams. + + + :param permissions: The permissions of this SelfRegistrationParams. # noqa: E501 + :type: list[GroupPermission] + """ + + self._permissions = permissions + + @property + def pkg_name(self): + """Gets the pkg_name of this SelfRegistrationParams. # noqa: E501 + + + :return: The pkg_name of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this SelfRegistrationParams. + + + :param pkg_name: The pkg_name of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this SelfRegistrationParams. # noqa: E501 + + + :return: The app_secret of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this SelfRegistrationParams. + + + :param app_secret: The app_secret of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._app_secret = app_secret + + @property + def app_scheme(self): + """Gets the app_scheme of this SelfRegistrationParams. # noqa: E501 + + + :return: The app_scheme of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._app_scheme + + @app_scheme.setter + def app_scheme(self, app_scheme): + """Sets the app_scheme of this SelfRegistrationParams. + + + :param app_scheme: The app_scheme of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._app_scheme = app_scheme + + @property + def app_host(self): + """Gets the app_host of this SelfRegistrationParams. # noqa: E501 + + + :return: The app_host of this SelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._app_host + + @app_host.setter + def app_host(self, app_host): + """Sets the app_host of this SelfRegistrationParams. + + + :param app_host: The app_host of this SelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._app_host = app_host + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SelfRegistrationParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SelfRegistrationParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/server_security_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/server_security_config.py new file mode 100644 index 0000000..c41c95f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/server_security_config.py @@ -0,0 +1,350 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ServerSecurityConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'security_host': 'str', + 'security_port': 'int', + 'server_id': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'bootstrap_server_account_timeout': 'int' + } + + attribute_map = { + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'security_host': 'securityHost', + 'security_port': 'securityPort', + 'server_id': 'serverId', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout' + } + + def __init__(self, bootstrap_server_is=None, host=None, port=None, security_host=None, security_port=None, server_id=None, client_hold_off_time=None, server_public_key=None, bootstrap_server_account_timeout=None): # noqa: E501 + """ServerSecurityConfig - a model defined in Swagger""" # noqa: E501 + self._bootstrap_server_is = None + self._host = None + self._port = None + self._security_host = None + self._security_port = None + self._server_id = None + self._client_hold_off_time = None + self._server_public_key = None + self._bootstrap_server_account_timeout = None + self.discriminator = None + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if security_host is not None: + self.security_host = security_host + if security_port is not None: + self.security_port = security_port + if server_id is not None: + self.server_id = server_id + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + + Is Bootstrap Server # noqa: E501 + + :return: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this ServerSecurityConfig. + + Is Bootstrap Server # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this ServerSecurityConfig. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this ServerSecurityConfig. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this ServerSecurityConfig. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this ServerSecurityConfig. # noqa: E501 + + Port for 'No Security' mode # noqa: E501 + + :return: The port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this ServerSecurityConfig. + + Port for 'No Security' mode # noqa: E501 + + :param port: The port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def security_host(self): + """Gets the security_host of this ServerSecurityConfig. # noqa: E501 + + Host for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_host of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._security_host + + @security_host.setter + def security_host(self, security_host): + """Sets the security_host of this ServerSecurityConfig. + + Host for 'Security' mode (DTLS) # noqa: E501 + + :param security_host: The security_host of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._security_host = security_host + + @property + def security_port(self): + """Gets the security_port of this ServerSecurityConfig. # noqa: E501 + + Port for 'Security' mode (DTLS) # noqa: E501 + + :return: The security_port of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._security_port + + @security_port.setter + def security_port(self, security_port): + """Sets the security_port of this ServerSecurityConfig. + + Port for 'Security' mode (DTLS) # noqa: E501 + + :param security_port: The security_port of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._security_port = security_port + + @property + def server_id(self): + """Gets the server_id of this ServerSecurityConfig. # noqa: E501 + + Server short Id # noqa: E501 + + :return: The server_id of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._server_id + + @server_id.setter + def server_id(self, server_id): + """Sets the server_id of this ServerSecurityConfig. + + Server short Id # noqa: E501 + + :param server_id: The server_id of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._server_id = server_id + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + + Client Hold Off Time # noqa: E501 + + :return: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this ServerSecurityConfig. + + Client Hold Off Time # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this ServerSecurityConfig. # noqa: E501 + + Server Public Key (base64 encoded) # noqa: E501 + + :return: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this ServerSecurityConfig. + + Server Public Key (base64 encoded) # noqa: E501 + + :param server_public_key: The server_public_key of this ServerSecurityConfig. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + + Bootstrap Server Account Timeout # noqa: E501 + + :return: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this ServerSecurityConfig. + + Bootstrap Server Account Timeout # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this ServerSecurityConfig. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ServerSecurityConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ServerSecurityConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/share_group_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/share_group_request.py new file mode 100644 index 0000000..d8748ea --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/share_group_request.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShareGroupRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'all_user_group': 'bool', + 'owner_id': 'EntityId', + 'user_group_id': 'EntityGroupId', + 'read_else_write': 'bool', + 'role_ids': 'list[RoleId]' + } + + attribute_map = { + 'all_user_group': 'allUserGroup', + 'owner_id': 'ownerId', + 'user_group_id': 'userGroupId', + 'read_else_write': 'readElseWrite', + 'role_ids': 'roleIds' + } + + def __init__(self, all_user_group=None, owner_id=None, user_group_id=None, read_else_write=None, role_ids=None): # noqa: E501 + """ShareGroupRequest - a model defined in Swagger""" # noqa: E501 + self._all_user_group = None + self._owner_id = None + self._user_group_id = None + self._read_else_write = None + self._role_ids = None + self.discriminator = None + self.all_user_group = all_user_group + if owner_id is not None: + self.owner_id = owner_id + if user_group_id is not None: + self.user_group_id = user_group_id + if read_else_write is not None: + self.read_else_write = read_else_write + if role_ids is not None: + self.role_ids = role_ids + + @property + def all_user_group(self): + """Gets the all_user_group of this ShareGroupRequest. # noqa: E501 + + Indicate that the group should be shared with user group 'All' that belongs to Tenant or Customer (see 'ownerId' property description). # noqa: E501 + + :return: The all_user_group of this ShareGroupRequest. # noqa: E501 + :rtype: bool + """ + return self._all_user_group + + @all_user_group.setter + def all_user_group(self, all_user_group): + """Sets the all_user_group of this ShareGroupRequest. + + Indicate that the group should be shared with user group 'All' that belongs to Tenant or Customer (see 'ownerId' property description). # noqa: E501 + + :param all_user_group: The all_user_group of this ShareGroupRequest. # noqa: E501 + :type: bool + """ + if all_user_group is None: + raise ValueError("Invalid value for `all_user_group`, must not be `None`") # noqa: E501 + + self._all_user_group = all_user_group + + @property + def owner_id(self): + """Gets the owner_id of this ShareGroupRequest. # noqa: E501 + + + :return: The owner_id of this ShareGroupRequest. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this ShareGroupRequest. + + + :param owner_id: The owner_id of this ShareGroupRequest. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def user_group_id(self): + """Gets the user_group_id of this ShareGroupRequest. # noqa: E501 + + + :return: The user_group_id of this ShareGroupRequest. # noqa: E501 + :rtype: EntityGroupId + """ + return self._user_group_id + + @user_group_id.setter + def user_group_id(self, user_group_id): + """Sets the user_group_id of this ShareGroupRequest. + + + :param user_group_id: The user_group_id of this ShareGroupRequest. # noqa: E501 + :type: EntityGroupId + """ + + self._user_group_id = user_group_id + + @property + def read_else_write(self): + """Gets the read_else_write of this ShareGroupRequest. # noqa: E501 + + Used if 'roleIds' property is not present. if the value is 'true', creates role with read-only permissions. If the value is 'false', creates role with write permissions. # noqa: E501 + + :return: The read_else_write of this ShareGroupRequest. # noqa: E501 + :rtype: bool + """ + return self._read_else_write + + @read_else_write.setter + def read_else_write(self, read_else_write): + """Sets the read_else_write of this ShareGroupRequest. + + Used if 'roleIds' property is not present. if the value is 'true', creates role with read-only permissions. If the value is 'false', creates role with write permissions. # noqa: E501 + + :param read_else_write: The read_else_write of this ShareGroupRequest. # noqa: E501 + :type: bool + """ + + self._read_else_write = read_else_write + + @property + def role_ids(self): + """Gets the role_ids of this ShareGroupRequest. # noqa: E501 + + List of group role Ids that should be used to share the entity group with the user group. If not set, the platform will create new role (see 'readElseWrite' property description) # noqa: E501 + + :return: The role_ids of this ShareGroupRequest. # noqa: E501 + :rtype: list[RoleId] + """ + return self._role_ids + + @role_ids.setter + def role_ids(self, role_ids): + """Sets the role_ids of this ShareGroupRequest. + + List of group role Ids that should be used to share the entity group with the user group. If not set, the platform will create new role (see 'readElseWrite' property description) # noqa: E501 + + :param role_ids: The role_ids of this ShareGroupRequest. # noqa: E501 + :type: list[RoleId] + """ + + self._role_ids = role_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShareGroupRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShareGroupRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/shared_attributes_setting_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/shared_attributes_setting_snmp_communication_config.py new file mode 100644 index 0000000..a0e2d73 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/shared_attributes_setting_snmp_communication_config.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class SharedAttributesSettingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, spec=None, *args, **kwargs): # noqa: E501 + """SharedAttributesSettingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param mappings: The mappings of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SharedAttributesSettingSnmpCommunicationConfig. + + + :param spec: The spec of this SharedAttributesSettingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SharedAttributesSettingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SharedAttributesSettingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/short_customer_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/short_customer_info.py new file mode 100644 index 0000000..37e5b87 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/short_customer_info.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShortCustomerInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'public': 'bool', + 'customer_id': 'CustomerId', + 'title': 'str' + } + + attribute_map = { + 'public': 'public', + 'customer_id': 'customerId', + 'title': 'title' + } + + def __init__(self, public=None, customer_id=None, title=None): # noqa: E501 + """ShortCustomerInfo - a model defined in Swagger""" # noqa: E501 + self._public = None + self._customer_id = None + self._title = None + self.discriminator = None + if public is not None: + self.public = public + if customer_id is not None: + self.customer_id = customer_id + if title is not None: + self.title = title + + @property + def public(self): + """Gets the public of this ShortCustomerInfo. # noqa: E501 + + + :return: The public of this ShortCustomerInfo. # noqa: E501 + :rtype: bool + """ + return self._public + + @public.setter + def public(self, public): + """Sets the public of this ShortCustomerInfo. + + + :param public: The public of this ShortCustomerInfo. # noqa: E501 + :type: bool + """ + + self._public = public + + @property + def customer_id(self): + """Gets the customer_id of this ShortCustomerInfo. # noqa: E501 + + + :return: The customer_id of this ShortCustomerInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this ShortCustomerInfo. + + + :param customer_id: The customer_id of this ShortCustomerInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def title(self): + """Gets the title of this ShortCustomerInfo. # noqa: E501 + + Title of the customer. # noqa: E501 + + :return: The title of this ShortCustomerInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this ShortCustomerInfo. + + Title of the customer. # noqa: E501 + + :param title: The title of this ShortCustomerInfo. # noqa: E501 + :type: str + """ + + self._title = title + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShortCustomerInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShortCustomerInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/short_entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_pe/short_entity_view.py new file mode 100644 index 0000000..fb8eed8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/short_entity_view.py @@ -0,0 +1,190 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ShortEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'EntityId', + 'name': 'str', + 'created_time': 'int', + 'device_profile': 'str', + 'label': 'str' + } + + attribute_map = { + 'id': 'id', + 'name': 'name', + 'created_time': 'created_time', + 'device_profile': 'device_profile', + 'label': 'label' + } + + def __init__(self, id=None, name=None, label=None, device_profile=None, created_time=None): # noqa: E501 + """ShortEntityView - a model defined in Swagger""" # noqa: E501 + self._id = None + self._name = None + self._label = None + self._device_profile_id = None + self._created_time = None + self.discriminator = None + self.id = id + self.name = name + self.label = label + self.device_profile = device_profile + self.created_time = created_time + + @property + def label(self): + return self._label + + @label.setter + def label(self, val): + self._label = val + + @property + def device_profile(self): + return self._device_profile + + @device_profile.setter + def device_profile(self, val): + self._device_profile = val + + @property + def created_time(self): + return self._created_time + + @created_time.setter + def created_time(self, val): + self._created_time = val + + @property + def id(self): + """Gets the id of this ShortEntityView. # noqa: E501 + + + :return: The id of this ShortEntityView. # noqa: E501 + :rtype: EntityId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ShortEntityView. + + + :param id: The id of this ShortEntityView. # noqa: E501 + :type: EntityId + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def name(self): + """Gets the name of this ShortEntityView. # noqa: E501 + + Name of the entity # noqa: E501 + + :return: The name of this ShortEntityView. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this ShortEntityView. + + Name of the entity # noqa: E501 + + :param name: The name of this ShortEntityView. # noqa: E501 + :type: str + """ + if name is None: + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + + self._name = name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ShortEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ShortEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/sign_up_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/sign_up_request.py new file mode 100644 index 0000000..c27d374 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/sign_up_request.py @@ -0,0 +1,294 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SignUpRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'first_name': 'str', + 'last_name': 'str', + 'email': 'str', + 'password': 'str', + 'recaptcha_response': 'str', + 'pkg_name': 'str', + 'app_secret': 'str' + } + + attribute_map = { + 'first_name': 'firstName', + 'last_name': 'lastName', + 'email': 'email', + 'password': 'password', + 'recaptcha_response': 'recaptchaResponse', + 'pkg_name': 'pkgName', + 'app_secret': 'appSecret' + } + + def __init__(self, first_name=None, last_name=None, email=None, password=None, recaptcha_response=None, pkg_name=None, app_secret=None): # noqa: E501 + """SignUpRequest - a model defined in Swagger""" # noqa: E501 + self._first_name = None + self._last_name = None + self._email = None + self._password = None + self._recaptcha_response = None + self._pkg_name = None + self._app_secret = None + self.discriminator = None + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + if email is not None: + self.email = email + if password is not None: + self.password = password + if recaptcha_response is not None: + self.recaptcha_response = recaptcha_response + if pkg_name is not None: + self.pkg_name = pkg_name + if app_secret is not None: + self.app_secret = app_secret + + @property + def first_name(self): + """Gets the first_name of this SignUpRequest. # noqa: E501 + + First Name # noqa: E501 + + :return: The first_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this SignUpRequest. + + First Name # noqa: E501 + + :param first_name: The first_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this SignUpRequest. # noqa: E501 + + Last Name # noqa: E501 + + :return: The last_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this SignUpRequest. + + Last Name # noqa: E501 + + :param last_name: The last_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def email(self): + """Gets the email of this SignUpRequest. # noqa: E501 + + Email will be used for new user to login # noqa: E501 + + :return: The email of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SignUpRequest. + + Email will be used for new user to login # noqa: E501 + + :param email: The email of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def password(self): + """Gets the password of this SignUpRequest. # noqa: E501 + + New User Password # noqa: E501 + + :return: The password of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SignUpRequest. + + New User Password # noqa: E501 + + :param password: The password of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._password = password + + @property + def recaptcha_response(self): + """Gets the recaptcha_response of this SignUpRequest. # noqa: E501 + + Response from reCAPTCHA validation # noqa: E501 + + :return: The recaptcha_response of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._recaptcha_response + + @recaptcha_response.setter + def recaptcha_response(self, recaptcha_response): + """Sets the recaptcha_response of this SignUpRequest. + + Response from reCAPTCHA validation # noqa: E501 + + :param recaptcha_response: The recaptcha_response of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._recaptcha_response = recaptcha_response + + @property + def pkg_name(self): + """Gets the pkg_name of this SignUpRequest. # noqa: E501 + + For mobile apps only. Mobile app package name # noqa: E501 + + :return: The pkg_name of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._pkg_name + + @pkg_name.setter + def pkg_name(self, pkg_name): + """Sets the pkg_name of this SignUpRequest. + + For mobile apps only. Mobile app package name # noqa: E501 + + :param pkg_name: The pkg_name of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._pkg_name = pkg_name + + @property + def app_secret(self): + """Gets the app_secret of this SignUpRequest. # noqa: E501 + + For mobile apps only. Mobile app secret # noqa: E501 + + :return: The app_secret of this SignUpRequest. # noqa: E501 + :rtype: str + """ + return self._app_secret + + @app_secret.setter + def app_secret(self, app_secret): + """Sets the app_secret of this SignUpRequest. + + For mobile apps only. Mobile app secret # noqa: E501 + + :param app_secret: The app_secret of this SignUpRequest. # noqa: E501 + :type: str + """ + + self._app_secret = app_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SignUpRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SignUpRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/sign_up_self_registration_params.py b/tb-rest-client/python/tb_rest_client/models/models_pe/sign_up_self_registration_params.py new file mode 100644 index 0000000..24878b0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/sign_up_self_registration_params.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SignUpSelfRegistrationParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sign_up_text_message': 'str', + 'captcha_site_key': 'str', + 'captcha_version': 'str', + 'captcha_action': 'str', + 'show_privacy_policy': 'bool', + 'show_terms_of_use': 'bool' + } + + attribute_map = { + 'sign_up_text_message': 'signUpTextMessage', + 'captcha_site_key': 'captchaSiteKey', + 'captcha_version': 'captchaVersion', + 'captcha_action': 'captchaAction', + 'show_privacy_policy': 'showPrivacyPolicy', + 'show_terms_of_use': 'showTermsOfUse' + } + + def __init__(self, sign_up_text_message=None, captcha_site_key=None, captcha_version=None, captcha_action=None, show_privacy_policy=None, show_terms_of_use=None): # noqa: E501 + """SignUpSelfRegistrationParams - a model defined in Swagger""" # noqa: E501 + self._sign_up_text_message = None + self._captcha_site_key = None + self._captcha_version = None + self._captcha_action = None + self._show_privacy_policy = None + self._show_terms_of_use = None + self.discriminator = None + if sign_up_text_message is not None: + self.sign_up_text_message = sign_up_text_message + if captcha_site_key is not None: + self.captcha_site_key = captcha_site_key + if captcha_version is not None: + self.captcha_version = captcha_version + if captcha_action is not None: + self.captcha_action = captcha_action + if show_privacy_policy is not None: + self.show_privacy_policy = show_privacy_policy + if show_terms_of_use is not None: + self.show_terms_of_use = show_terms_of_use + + @property + def sign_up_text_message(self): + """Gets the sign_up_text_message of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The sign_up_text_message of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._sign_up_text_message + + @sign_up_text_message.setter + def sign_up_text_message(self, sign_up_text_message): + """Sets the sign_up_text_message of this SignUpSelfRegistrationParams. + + + :param sign_up_text_message: The sign_up_text_message of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._sign_up_text_message = sign_up_text_message + + @property + def captcha_site_key(self): + """Gets the captcha_site_key of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The captcha_site_key of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_site_key + + @captcha_site_key.setter + def captcha_site_key(self, captcha_site_key): + """Sets the captcha_site_key of this SignUpSelfRegistrationParams. + + + :param captcha_site_key: The captcha_site_key of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_site_key = captcha_site_key + + @property + def captcha_version(self): + """Gets the captcha_version of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The captcha_version of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_version + + @captcha_version.setter + def captcha_version(self, captcha_version): + """Sets the captcha_version of this SignUpSelfRegistrationParams. + + + :param captcha_version: The captcha_version of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_version = captcha_version + + @property + def captcha_action(self): + """Gets the captcha_action of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The captcha_action of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: str + """ + return self._captcha_action + + @captcha_action.setter + def captcha_action(self, captcha_action): + """Sets the captcha_action of this SignUpSelfRegistrationParams. + + + :param captcha_action: The captcha_action of this SignUpSelfRegistrationParams. # noqa: E501 + :type: str + """ + + self._captcha_action = captcha_action + + @property + def show_privacy_policy(self): + """Gets the show_privacy_policy of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The show_privacy_policy of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_privacy_policy + + @show_privacy_policy.setter + def show_privacy_policy(self, show_privacy_policy): + """Sets the show_privacy_policy of this SignUpSelfRegistrationParams. + + + :param show_privacy_policy: The show_privacy_policy of this SignUpSelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_privacy_policy = show_privacy_policy + + @property + def show_terms_of_use(self): + """Gets the show_terms_of_use of this SignUpSelfRegistrationParams. # noqa: E501 + + + :return: The show_terms_of_use of this SignUpSelfRegistrationParams. # noqa: E501 + :rtype: bool + """ + return self._show_terms_of_use + + @show_terms_of_use.setter + def show_terms_of_use(self, show_terms_of_use): + """Sets the show_terms_of_use of this SignUpSelfRegistrationParams. + + + :param show_terms_of_use: The show_terms_of_use of this SignUpSelfRegistrationParams. # noqa: E501 + :type: bool + """ + + self._show_terms_of_use = show_terms_of_use + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SignUpSelfRegistrationParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SignUpSelfRegistrationParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/simple_alarm_condition_spec.py b/tb-rest-client/python/tb_rest_client/models/models_pe/simple_alarm_condition_spec.py new file mode 100644 index 0000000..f9a6833 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/simple_alarm_condition_spec.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.alarm_condition_spec import AlarmConditionSpec # noqa: F401,E501 + +class SimpleAlarmConditionSpec(AlarmConditionSpec): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + if hasattr(AlarmConditionSpec, "swagger_types"): + swagger_types.update(AlarmConditionSpec.swagger_types) + + attribute_map = { + } + if hasattr(AlarmConditionSpec, "attribute_map"): + attribute_map.update(AlarmConditionSpec.attribute_map) + + def __init__(self, *args, **kwargs): # noqa: E501 + """SimpleAlarmConditionSpec - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + AlarmConditionSpec.__init__(self, *args, **kwargs) + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SimpleAlarmConditionSpec, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SimpleAlarmConditionSpec): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_filter.py new file mode 100644 index 0000000..5edc2a7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class SingleEntityFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'single_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'single_entity': 'singleEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, single_entity=None, *args, **kwargs): # noqa: E501 + """SingleEntityFilter - a model defined in Swagger""" # noqa: E501 + self._single_entity = None + self.discriminator = None + if single_entity is not None: + self.single_entity = single_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def single_entity(self): + """Gets the single_entity of this SingleEntityFilter. # noqa: E501 + + + :return: The single_entity of this SingleEntityFilter. # noqa: E501 + :rtype: EntityId + """ + return self._single_entity + + @single_entity.setter + def single_entity(self, single_entity): + """Sets the single_entity of this SingleEntityFilter. + + + :param single_entity: The single_entity of this SingleEntityFilter. # noqa: E501 + :type: EntityId + """ + + self._single_entity = single_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_version_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_version_create_request.py new file mode 100644 index 0000000..896aa32 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_version_create_request.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_create_request import VersionCreateRequest # noqa: F401,E501 + +class SingleEntityVersionCreateRequest(VersionCreateRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'config': 'VersionCreateConfig', + 'entity_id': 'EntityId', + 'type': 'str', + 'version_name': 'str' + } + if hasattr(VersionCreateRequest, "swagger_types"): + swagger_types.update(VersionCreateRequest.swagger_types) + + attribute_map = { + 'branch': 'branch', + 'config': 'config', + 'entity_id': 'entityId', + 'type': 'type', + 'version_name': 'versionName' + } + if hasattr(VersionCreateRequest, "attribute_map"): + attribute_map.update(VersionCreateRequest.attribute_map) + + def __init__(self, branch=None, config=None, entity_id=None, type=None, version_name=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._config = None + self._entity_id = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if config is not None: + self.config = config + if entity_id is not None: + self.entity_id = entity_id + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + VersionCreateRequest.__init__(self, *args, **kwargs) + + @property + def branch(self): + """Gets the branch of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this SingleEntityVersionCreateRequest. + + + :param branch: The branch of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def config(self): + """Gets the config of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: VersionCreateConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionCreateRequest. + + + :param config: The config of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: VersionCreateConfig + """ + + self._config = config + + @property + def entity_id(self): + """Gets the entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: EntityId + """ + return self._entity_id + + @entity_id.setter + def entity_id(self, entity_id): + """Sets the entity_id of this SingleEntityVersionCreateRequest. + + + :param entity_id: The entity_id of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: EntityId + """ + + self._entity_id = entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionCreateRequest. + + + :param type: The type of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + + + :return: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this SingleEntityVersionCreateRequest. + + + :param version_name: The version_name of this SingleEntityVersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_version_load_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_version_load_request.py new file mode 100644 index 0000000..fb4d344 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/single_entity_version_load_request.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.version_load_request import VersionLoadRequest # noqa: F401,E501 + +class SingleEntityVersionLoadRequest(VersionLoadRequest): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'config': 'VersionLoadConfig', + 'external_entity_id': 'EntityId', + 'internal_entity_id': 'EntityId', + 'type': 'str', + 'version_id': 'str' + } + if hasattr(VersionLoadRequest, "swagger_types"): + swagger_types.update(VersionLoadRequest.swagger_types) + + attribute_map = { + 'config': 'config', + 'external_entity_id': 'externalEntityId', + 'internal_entity_id': 'internalEntityId', + 'type': 'type', + 'version_id': 'versionId' + } + if hasattr(VersionLoadRequest, "attribute_map"): + attribute_map.update(VersionLoadRequest.attribute_map) + + def __init__(self, config=None, external_entity_id=None, internal_entity_id=None, type=None, version_id=None, *args, **kwargs): # noqa: E501 + """SingleEntityVersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._config = None + self._external_entity_id = None + self._internal_entity_id = None + self._type = None + self._version_id = None + self.discriminator = None + if config is not None: + self.config = config + if external_entity_id is not None: + self.external_entity_id = external_entity_id + if internal_entity_id is not None: + self.internal_entity_id = internal_entity_id + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + VersionLoadRequest.__init__(self, *args, **kwargs) + + @property + def config(self): + """Gets the config of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: VersionLoadConfig + """ + return self._config + + @config.setter + def config(self, config): + """Sets the config of this SingleEntityVersionLoadRequest. + + + :param config: The config of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: VersionLoadConfig + """ + + self._config = config + + @property + def external_entity_id(self): + """Gets the external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: EntityId + """ + return self._external_entity_id + + @external_entity_id.setter + def external_entity_id(self, external_entity_id): + """Sets the external_entity_id of this SingleEntityVersionLoadRequest. + + + :param external_entity_id: The external_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: EntityId + """ + + self._external_entity_id = external_entity_id + + @property + def internal_entity_id(self): + """Gets the internal_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The internal_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: EntityId + """ + return self._internal_entity_id + + @internal_entity_id.setter + def internal_entity_id(self, internal_entity_id): + """Sets the internal_entity_id of this SingleEntityVersionLoadRequest. + + + :param internal_entity_id: The internal_entity_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: EntityId + """ + + self._internal_entity_id = internal_entity_id + + @property + def type(self): + """Gets the type of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SingleEntityVersionLoadRequest. + + + :param type: The type of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + + + :return: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this SingleEntityVersionLoadRequest. + + + :param version_id: The version_id of this SingleEntityVersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SingleEntityVersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SingleEntityVersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/slack_conversation.py b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_conversation.py new file mode 100644 index 0000000..320e74d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_conversation.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackConversation(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'email': 'str', + 'id': 'str', + 'name': 'str', + 'title': 'str', + 'type': 'str', + 'whole_name': 'str' + } + + attribute_map = { + 'email': 'email', + 'id': 'id', + 'name': 'name', + 'title': 'title', + 'type': 'type', + 'whole_name': 'wholeName' + } + + def __init__(self, email=None, id=None, name=None, title=None, type=None, whole_name=None): # noqa: E501 + """SlackConversation - a model defined in Swagger""" # noqa: E501 + self._email = None + self._id = None + self._name = None + self._title = None + self._type = None + self._whole_name = None + self.discriminator = None + if email is not None: + self.email = email + if id is not None: + self.id = id + if name is not None: + self.name = name + if title is not None: + self.title = title + self.type = type + if whole_name is not None: + self.whole_name = whole_name + + @property + def email(self): + """Gets the email of this SlackConversation. # noqa: E501 + + + :return: The email of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this SlackConversation. + + + :param email: The email of this SlackConversation. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def id(self): + """Gets the id of this SlackConversation. # noqa: E501 + + + :return: The id of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this SlackConversation. + + + :param id: The id of this SlackConversation. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def name(self): + """Gets the name of this SlackConversation. # noqa: E501 + + + :return: The name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this SlackConversation. + + + :param name: The name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def title(self): + """Gets the title of this SlackConversation. # noqa: E501 + + + :return: The title of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this SlackConversation. + + + :param title: The title of this SlackConversation. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def type(self): + """Gets the type of this SlackConversation. # noqa: E501 + + + :return: The type of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SlackConversation. + + + :param type: The type of this SlackConversation. # noqa: E501 + :type: str + """ + if type is None: + raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def whole_name(self): + """Gets the whole_name of this SlackConversation. # noqa: E501 + + + :return: The whole_name of this SlackConversation. # noqa: E501 + :rtype: str + """ + return self._whole_name + + @whole_name.setter + def whole_name(self, whole_name): + """Sets the whole_name of this SlackConversation. + + + :param whole_name: The whole_name of this SlackConversation. # noqa: E501 + :type: str + """ + + self._whole_name = whole_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackConversation, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackConversation): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/slack_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_delivery_method_notification_template.py new file mode 100644 index 0000000..3f24ab3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SlackDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SlackDeliveryMethodNotificationTemplate. + + + :param body: The body of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SlackDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SlackDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/slack_notification_delivery_method_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_notification_delivery_method_config.py new file mode 100644 index 0000000..81fe50e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_notification_delivery_method_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SlackNotificationDeliveryMethodConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'bot_token': 'str' + } + + attribute_map = { + 'bot_token': 'botToken' + } + + def __init__(self, bot_token=None): # noqa: E501 + """SlackNotificationDeliveryMethodConfig - a model defined in Swagger""" # noqa: E501 + self._bot_token = None + self.discriminator = None + if bot_token is not None: + self.bot_token = bot_token + + @property + def bot_token(self): + """Gets the bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + + + :return: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :rtype: str + """ + return self._bot_token + + @bot_token.setter + def bot_token(self, bot_token): + """Sets the bot_token of this SlackNotificationDeliveryMethodConfig. + + + :param bot_token: The bot_token of this SlackNotificationDeliveryMethodConfig. # noqa: E501 + :type: str + """ + + self._bot_token = bot_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationDeliveryMethodConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationDeliveryMethodConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/slack_notification_target_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_notification_target_config.py new file mode 100644 index 0000000..fa8f57a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/slack_notification_target_config.py @@ -0,0 +1,189 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_ce.notification_target_config import NotificationTargetConfig # noqa: F401,E501 + +class SlackNotificationTargetConfig(NotificationTargetConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'conversation': 'SlackConversation', + 'conversation_type': 'str', + 'description': 'str' + } + if hasattr(NotificationTargetConfig, "swagger_types"): + swagger_types.update(NotificationTargetConfig.swagger_types) + + attribute_map = { + 'conversation': 'conversation', + 'conversation_type': 'conversationType', + 'description': 'description' + } + if hasattr(NotificationTargetConfig, "attribute_map"): + attribute_map.update(NotificationTargetConfig.attribute_map) + + def __init__(self, conversation=None, conversation_type=None, description=None, *args, **kwargs): # noqa: E501 + """SlackNotificationTargetConfig - a model defined in Swagger""" # noqa: E501 + self._conversation = None + self._conversation_type = None + self._description = None + self.discriminator = None + self.conversation = conversation + if conversation_type is not None: + self.conversation_type = conversation_type + if description is not None: + self.description = description + NotificationTargetConfig.__init__(self, *args, **kwargs) + + @property + def conversation(self): + """Gets the conversation of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: SlackConversation + """ + return self._conversation + + @conversation.setter + def conversation(self, conversation): + """Sets the conversation of this SlackNotificationTargetConfig. + + + :param conversation: The conversation of this SlackNotificationTargetConfig. # noqa: E501 + :type: SlackConversation + """ + if conversation is None: + raise ValueError("Invalid value for `conversation`, must not be `None`") # noqa: E501 + + self._conversation = conversation + + @property + def conversation_type(self): + """Gets the conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._conversation_type + + @conversation_type.setter + def conversation_type(self, conversation_type): + """Sets the conversation_type of this SlackNotificationTargetConfig. + + + :param conversation_type: The conversation_type of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + allowed_values = ["DIRECT", "PRIVATE_CHANNEL", "PUBLIC_CHANNEL"] # noqa: E501 + if conversation_type not in allowed_values: + raise ValueError( + "Invalid value for `conversation_type` ({0}), must be one of {1}" # noqa: E501 + .format(conversation_type, allowed_values) + ) + + self._conversation_type = conversation_type + + @property + def description(self): + """Gets the description of this SlackNotificationTargetConfig. # noqa: E501 + + + :return: The description of this SlackNotificationTargetConfig. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this SlackNotificationTargetConfig. + + + :param description: The description of this SlackNotificationTargetConfig. # noqa: E501 + :type: str + """ + + self._description = description + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SlackNotificationTargetConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SlackNotificationTargetConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/smpp_sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/smpp_sms_provider_configuration.py new file mode 100644 index 0000000..f925381 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/smpp_sms_provider_configuration.py @@ -0,0 +1,541 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class SmppSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'address_range': 'str', + 'bind_type': 'str', + 'coding_scheme': 'str', + 'destination_npi': 'str', + 'destination_ton': 'str', + 'host': 'str', + 'password': 'str', + 'port': 'int', + 'protocol_version': 'str', + 'service_type': 'str', + 'source_address': 'str', + 'source_npi': 'str', + 'source_ton': 'str', + 'system_id': 'str', + 'system_type': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'address_range': 'addressRange', + 'bind_type': 'bindType', + 'coding_scheme': 'codingScheme', + 'destination_npi': 'destinationNpi', + 'destination_ton': 'destinationTon', + 'host': 'host', + 'password': 'password', + 'port': 'port', + 'protocol_version': 'protocolVersion', + 'service_type': 'serviceType', + 'source_address': 'sourceAddress', + 'source_npi': 'sourceNpi', + 'source_ton': 'sourceTon', + 'system_id': 'systemId', + 'system_type': 'systemType' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, address_range=None, bind_type=None, coding_scheme=None, destination_npi=None, destination_ton=None, host=None, password=None, port=None, protocol_version=None, service_type=None, source_address=None, source_npi=None, source_ton=None, system_id=None, system_type=None, *args, **kwargs): # noqa: E501 + """SmppSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._address_range = None + self._bind_type = None + self._coding_scheme = None + self._destination_npi = None + self._destination_ton = None + self._host = None + self._password = None + self._port = None + self._protocol_version = None + self._service_type = None + self._source_address = None + self._source_npi = None + self._source_ton = None + self._system_id = None + self._system_type = None + self.discriminator = None + if address_range is not None: + self.address_range = address_range + if bind_type is not None: + self.bind_type = bind_type + if coding_scheme is not None: + self.coding_scheme = coding_scheme + if destination_npi is not None: + self.destination_npi = destination_npi + if destination_ton is not None: + self.destination_ton = destination_ton + self.host = host + self.password = password + self.port = port + self.protocol_version = protocol_version + if service_type is not None: + self.service_type = service_type + if source_address is not None: + self.source_address = source_address + if source_npi is not None: + self.source_npi = source_npi + if source_ton is not None: + self.source_ton = source_ton + self.system_id = system_id + if system_type is not None: + self.system_type = system_type + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def address_range(self): + """Gets the address_range of this SmppSmsProviderConfiguration. # noqa: E501 + + Address range # noqa: E501 + + :return: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._address_range + + @address_range.setter + def address_range(self, address_range): + """Sets the address_range of this SmppSmsProviderConfiguration. + + Address range # noqa: E501 + + :param address_range: The address_range of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._address_range = address_range + + @property + def bind_type(self): + """Gets the bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :return: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._bind_type + + @bind_type.setter + def bind_type(self, bind_type): + """Sets the bind_type of this SmppSmsProviderConfiguration. + + TX - Transmitter, RX - Receiver, TRX - Transciever. By default TX is used # noqa: E501 + + :param bind_type: The bind_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["RX", "TRX", "TX"] # noqa: E501 + if bind_type not in allowed_values: + raise ValueError( + "Invalid value for `bind_type` ({0}), must be one of {1}" # noqa: E501 + .format(bind_type, allowed_values) + ) + + self._bind_type = bind_type + + @property + def coding_scheme(self): + """Gets the coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :return: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._coding_scheme + + @coding_scheme.setter + def coding_scheme(self, coding_scheme): + """Sets the coding_scheme of this SmppSmsProviderConfiguration. + + 0 - SMSC Default Alphabet (ASCII for short and long code and to GSM for toll-free, used as default) 1 - IA5 (ASCII for short and long code, Latin 9 for toll-free (ISO-8859-9)) 2 - Octet Unspecified (8-bit binary) 3 - Latin 1 (ISO-8859-1) 4 - Octet Unspecified (8-bit binary) 5 - JIS (X 0208-1990) 6 - Cyrillic (ISO-8859-5) 7 - Latin/Hebrew (ISO-8859-8) 8 - UCS2/UTF-16 (ISO/IEC-10646) 9 - Pictogram Encoding 10 - Music Codes (ISO-2022-JP) 13 - Extended Kanji JIS (X 0212-1990) 14 - Korean Graphic Character Set (KS C 5601/KS X 1001) # noqa: E501 + + :param coding_scheme: The coding_scheme of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._coding_scheme = coding_scheme + + @property + def destination_npi(self): + """Gets the destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_npi + + @destination_npi.setter + def destination_npi(self, destination_npi): + """Sets the destination_npi of this SmppSmsProviderConfiguration. + + Destination NPI (Numbering Plan Identification). 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param destination_npi: The destination_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_npi = destination_npi + + @property + def destination_ton(self): + """Gets the destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._destination_ton + + @destination_ton.setter + def destination_ton(self, destination_ton): + """Sets the destination_ton of this SmppSmsProviderConfiguration. + + Destination TON (Type of Number). 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param destination_ton: The destination_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._destination_ton = destination_ton + + @property + def host(self): + """Gets the host of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP host # noqa: E501 + + :return: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SmppSmsProviderConfiguration. + + SMPP host # noqa: E501 + + :param host: The host of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if host is None: + raise ValueError("Invalid value for `host`, must not be `None`") # noqa: E501 + + self._host = host + + @property + def password(self): + """Gets the password of this SmppSmsProviderConfiguration. # noqa: E501 + + Password # noqa: E501 + + :return: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """Sets the password of this SmppSmsProviderConfiguration. + + Password # noqa: E501 + + :param password: The password of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if password is None: + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + + self._password = password + + @property + def port(self): + """Gets the port of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP port # noqa: E501 + + :return: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SmppSmsProviderConfiguration. + + SMPP port # noqa: E501 + + :param port: The port of this SmppSmsProviderConfiguration. # noqa: E501 + :type: int + """ + if port is None: + raise ValueError("Invalid value for `port`, must not be `None`") # noqa: E501 + + self._port = port + + @property + def protocol_version(self): + """Gets the protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + + SMPP version # noqa: E501 + + :return: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SmppSmsProviderConfiguration. + + SMPP version # noqa: E501 + + :param protocol_version: The protocol_version of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if protocol_version is None: + raise ValueError("Invalid value for `protocol_version`, must not be `None`") # noqa: E501 + allowed_values = ["3.3", "3.4"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def service_type(self): + """Gets the service_type of this SmppSmsProviderConfiguration. # noqa: E501 + + Service type # noqa: E501 + + :return: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SmppSmsProviderConfiguration. + + Service type # noqa: E501 + + :param service_type: The service_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def source_address(self): + """Gets the source_address of this SmppSmsProviderConfiguration. # noqa: E501 + + Source address # noqa: E501 + + :return: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_address + + @source_address.setter + def source_address(self, source_address): + """Sets the source_address of this SmppSmsProviderConfiguration. + + Source address # noqa: E501 + + :param source_address: The source_address of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_address = source_address + + @property + def source_npi(self): + """Gets the source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :return: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_npi + + @source_npi.setter + def source_npi(self, source_npi): + """Sets the source_npi of this SmppSmsProviderConfiguration. + + Source NPI (Numbering Plan Identification). Needed is source address is set. 0 by default. 0 - Unknown 1 - ISDN/telephone numbering plan (E163/E164) 3 - Data numbering plan (X.121) 4 - Telex numbering plan (F.69) 6 - Land Mobile (E.212) =6 8 - National numbering plan 9 - Private numbering plan 10 - ERMES numbering plan (ETSI DE/PS 3 01-3) 13 - Internet (IP) 18 - WAP Client Id (to be defined by WAP Forum) # noqa: E501 + + :param source_npi: The source_npi of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_npi = source_npi + + @property + def source_ton(self): + """Gets the source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :return: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._source_ton + + @source_ton.setter + def source_ton(self, source_ton): + """Sets the source_ton of this SmppSmsProviderConfiguration. + + Source TON (Type of Number). Needed is source address is set. 5 by default. 0 - Unknown 1 - International 2 - National 3 - Network Specific 4 - Subscriber Number 5 - Alphanumeric 6 - Abbreviated # noqa: E501 + + :param source_ton: The source_ton of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._source_ton = source_ton + + @property + def system_id(self): + """Gets the system_id of this SmppSmsProviderConfiguration. # noqa: E501 + + System ID # noqa: E501 + + :return: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_id + + @system_id.setter + def system_id(self, system_id): + """Sets the system_id of this SmppSmsProviderConfiguration. + + System ID # noqa: E501 + + :param system_id: The system_id of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + if system_id is None: + raise ValueError("Invalid value for `system_id`, must not be `None`") # noqa: E501 + + self._system_id = system_id + + @property + def system_type(self): + """Gets the system_type of this SmppSmsProviderConfiguration. # noqa: E501 + + System type # noqa: E501 + + :return: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._system_type + + @system_type.setter + def system_type(self, system_type): + """Sets the system_type of this SmppSmsProviderConfiguration. + + System type # noqa: E501 + + :param system_type: The system_type of this SmppSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._system_type = system_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmppSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmppSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/sms_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_delivery_method_notification_template.py new file mode 100644 index 0000000..a8cd25f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_delivery_method_notification_template.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'body': 'str', + 'enabled': 'bool' + } + + attribute_map = { + 'body': 'body', + 'enabled': 'enabled' + } + + def __init__(self, body=None, enabled=None): # noqa: E501 + """SmsDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._body = None + self._enabled = None + self.discriminator = None + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + + @property + def body(self): + """Gets the body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this SmsDeliveryMethodNotificationTemplate. + + + :param body: The body of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this SmsDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this SmsDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_provider_configuration.py new file mode 100644 index 0000000..d60a33d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_provider_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsProviderConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/sms_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_two_fa_account_config.py new file mode 100644 index 0000000..9bf96c7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_two_fa_account_config.py @@ -0,0 +1,157 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.two_fa_account_config import TwoFaAccountConfig # noqa: F401,E501 + +class SmsTwoFaAccountConfig(TwoFaAccountConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'phone_number': 'str', + 'use_by_default': 'bool' + } + if hasattr(TwoFaAccountConfig, "swagger_types"): + swagger_types.update(TwoFaAccountConfig.swagger_types) + + attribute_map = { + 'phone_number': 'phoneNumber', + 'use_by_default': 'useByDefault' + } + if hasattr(TwoFaAccountConfig, "attribute_map"): + attribute_map.update(TwoFaAccountConfig.attribute_map) + + def __init__(self, phone_number=None, use_by_default=None, *args, **kwargs): # noqa: E501 + """SmsTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._phone_number = None + self._use_by_default = None + self.discriminator = None + self.phone_number = phone_number + if use_by_default is not None: + self.use_by_default = use_by_default + TwoFaAccountConfig.__init__(self, *args, **kwargs) + + @property + def phone_number(self): + """Gets the phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._phone_number + + @phone_number.setter + def phone_number(self, phone_number): + """Sets the phone_number of this SmsTwoFaAccountConfig. + + + :param phone_number: The phone_number of this SmsTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if phone_number is None: + raise ValueError("Invalid value for `phone_number`, must not be `None`") # noqa: E501 + + self._phone_number = phone_number + + @property + def use_by_default(self): + """Gets the use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this SmsTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this SmsTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/sms_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_two_fa_provider_config.py new file mode 100644 index 0000000..bfb6ed0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/sms_two_fa_provider_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SmsTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'sms_verification_message_template': 'str', + 'verification_code_lifetime': 'int' + } + + attribute_map = { + 'sms_verification_message_template': 'smsVerificationMessageTemplate', + 'verification_code_lifetime': 'verificationCodeLifetime' + } + + def __init__(self, sms_verification_message_template=None, verification_code_lifetime=None): # noqa: E501 + """SmsTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._sms_verification_message_template = None + self._verification_code_lifetime = None + self.discriminator = None + self.sms_verification_message_template = sms_verification_message_template + if verification_code_lifetime is not None: + self.verification_code_lifetime = verification_code_lifetime + + @property + def sms_verification_message_template(self): + """Gets the sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._sms_verification_message_template + + @sms_verification_message_template.setter + def sms_verification_message_template(self, sms_verification_message_template): + """Sets the sms_verification_message_template of this SmsTwoFaProviderConfig. + + + :param sms_verification_message_template: The sms_verification_message_template of this SmsTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if sms_verification_message_template is None: + raise ValueError("Invalid value for `sms_verification_message_template`, must not be `None`") # noqa: E501 + + self._sms_verification_message_template = sms_verification_message_template + + @property + def verification_code_lifetime(self): + """Gets the verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + + + :return: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :rtype: int + """ + return self._verification_code_lifetime + + @verification_code_lifetime.setter + def verification_code_lifetime(self, verification_code_lifetime): + """Sets the verification_code_lifetime of this SmsTwoFaProviderConfig. + + + :param verification_code_lifetime: The verification_code_lifetime of this SmsTwoFaProviderConfig. # noqa: E501 + :type: int + """ + + self._verification_code_lifetime = verification_code_lifetime + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SmsTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SmsTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_communication_config.py new file mode 100644 index 0000000..31ce853 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_communication_config.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'spec': 'str' + } + + attribute_map = { + 'spec': 'spec' + } + + def __init__(self, spec=None): # noqa: E501 + """SnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._spec = None + self.discriminator = None + if spec is not None: + self.spec = spec + + @property + def spec(self): + """Gets the spec of this SnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this SnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this SnmpCommunicationConfig. + + + :param spec: The spec of this SnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_device_profile_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_device_profile_transport_configuration.py new file mode 100644 index 0000000..b8da5b5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_device_profile_transport_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_transport_configuration import DeviceProfileTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceProfileTransportConfiguration(DeviceProfileTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'communication_configs': 'list[SnmpCommunicationConfig]', + 'retries': 'int', + 'timeout_ms': 'int' + } + if hasattr(DeviceProfileTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileTransportConfiguration.swagger_types) + + attribute_map = { + 'communication_configs': 'communicationConfigs', + 'retries': 'retries', + 'timeout_ms': 'timeoutMs' + } + if hasattr(DeviceProfileTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileTransportConfiguration.attribute_map) + + def __init__(self, communication_configs=None, retries=None, timeout_ms=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceProfileTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._communication_configs = None + self._retries = None + self._timeout_ms = None + self.discriminator = None + if communication_configs is not None: + self.communication_configs = communication_configs + if retries is not None: + self.retries = retries + if timeout_ms is not None: + self.timeout_ms = timeout_ms + DeviceProfileTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def communication_configs(self): + """Gets the communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: list[SnmpCommunicationConfig] + """ + return self._communication_configs + + @communication_configs.setter + def communication_configs(self, communication_configs): + """Sets the communication_configs of this SnmpDeviceProfileTransportConfiguration. + + + :param communication_configs: The communication_configs of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: list[SnmpCommunicationConfig] + """ + + self._communication_configs = communication_configs + + @property + def retries(self): + """Gets the retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._retries + + @retries.setter + def retries(self, retries): + """Sets the retries of this SnmpDeviceProfileTransportConfiguration. + + + :param retries: The retries of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._retries = retries + + @property + def timeout_ms(self): + """Gets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + + + :return: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._timeout_ms + + @timeout_ms.setter + def timeout_ms(self, timeout_ms): + """Sets the timeout_ms of this SnmpDeviceProfileTransportConfiguration. + + + :param timeout_ms: The timeout_ms of this SnmpDeviceProfileTransportConfiguration. # noqa: E501 + :type: int + """ + + self._timeout_ms = timeout_ms + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceProfileTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceProfileTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_device_transport_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_device_transport_configuration.py new file mode 100644 index 0000000..20bde4e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_device_transport_configuration.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_transport_configuration import DeviceTransportConfiguration # noqa: F401,E501 + +class SnmpDeviceTransportConfiguration(DeviceTransportConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'authentication_passphrase': 'str', + 'authentication_protocol': 'str', + 'community': 'str', + 'context_name': 'str', + 'engine_id': 'str', + 'host': 'str', + 'port': 'int', + 'privacy_passphrase': 'str', + 'privacy_protocol': 'str', + 'protocol_version': 'str', + 'security_name': 'str', + 'username': 'str' + } + if hasattr(DeviceTransportConfiguration, "swagger_types"): + swagger_types.update(DeviceTransportConfiguration.swagger_types) + + attribute_map = { + 'authentication_passphrase': 'authenticationPassphrase', + 'authentication_protocol': 'authenticationProtocol', + 'community': 'community', + 'context_name': 'contextName', + 'engine_id': 'engineId', + 'host': 'host', + 'port': 'port', + 'privacy_passphrase': 'privacyPassphrase', + 'privacy_protocol': 'privacyProtocol', + 'protocol_version': 'protocolVersion', + 'security_name': 'securityName', + 'username': 'username' + } + if hasattr(DeviceTransportConfiguration, "attribute_map"): + attribute_map.update(DeviceTransportConfiguration.attribute_map) + + def __init__(self, authentication_passphrase=None, authentication_protocol=None, community=None, context_name=None, engine_id=None, host=None, port=None, privacy_passphrase=None, privacy_protocol=None, protocol_version=None, security_name=None, username=None, *args, **kwargs): # noqa: E501 + """SnmpDeviceTransportConfiguration - a model defined in Swagger""" # noqa: E501 + self._authentication_passphrase = None + self._authentication_protocol = None + self._community = None + self._context_name = None + self._engine_id = None + self._host = None + self._port = None + self._privacy_passphrase = None + self._privacy_protocol = None + self._protocol_version = None + self._security_name = None + self._username = None + self.discriminator = None + if authentication_passphrase is not None: + self.authentication_passphrase = authentication_passphrase + if authentication_protocol is not None: + self.authentication_protocol = authentication_protocol + if community is not None: + self.community = community + if context_name is not None: + self.context_name = context_name + if engine_id is not None: + self.engine_id = engine_id + if host is not None: + self.host = host + if port is not None: + self.port = port + if privacy_passphrase is not None: + self.privacy_passphrase = privacy_passphrase + if privacy_protocol is not None: + self.privacy_protocol = privacy_protocol + if protocol_version is not None: + self.protocol_version = protocol_version + if security_name is not None: + self.security_name = security_name + if username is not None: + self.username = username + DeviceTransportConfiguration.__init__(self, *args, **kwargs) + + @property + def authentication_passphrase(self): + """Gets the authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_passphrase + + @authentication_passphrase.setter + def authentication_passphrase(self, authentication_passphrase): + """Sets the authentication_passphrase of this SnmpDeviceTransportConfiguration. + + + :param authentication_passphrase: The authentication_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._authentication_passphrase = authentication_passphrase + + @property + def authentication_protocol(self): + """Gets the authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._authentication_protocol + + @authentication_protocol.setter + def authentication_protocol(self, authentication_protocol): + """Sets the authentication_protocol of this SnmpDeviceTransportConfiguration. + + + :param authentication_protocol: The authentication_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["MD5", "SHA_1", "SHA_224", "SHA_256", "SHA_384", "SHA_512"] # noqa: E501 + if authentication_protocol not in allowed_values: + raise ValueError( + "Invalid value for `authentication_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(authentication_protocol, allowed_values) + ) + + self._authentication_protocol = authentication_protocol + + @property + def community(self): + """Gets the community of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._community + + @community.setter + def community(self, community): + """Sets the community of this SnmpDeviceTransportConfiguration. + + + :param community: The community of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._community = community + + @property + def context_name(self): + """Gets the context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._context_name + + @context_name.setter + def context_name(self, context_name): + """Sets the context_name of this SnmpDeviceTransportConfiguration. + + + :param context_name: The context_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._context_name = context_name + + @property + def engine_id(self): + """Gets the engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._engine_id + + @engine_id.setter + def engine_id(self, engine_id): + """Sets the engine_id of this SnmpDeviceTransportConfiguration. + + + :param engine_id: The engine_id of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._engine_id = engine_id + + @property + def host(self): + """Gets the host of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this SnmpDeviceTransportConfiguration. + + + :param host: The host of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this SnmpDeviceTransportConfiguration. + + + :param port: The port of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def privacy_passphrase(self): + """Gets the privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_passphrase + + @privacy_passphrase.setter + def privacy_passphrase(self, privacy_passphrase): + """Sets the privacy_passphrase of this SnmpDeviceTransportConfiguration. + + + :param privacy_passphrase: The privacy_passphrase of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._privacy_passphrase = privacy_passphrase + + @property + def privacy_protocol(self): + """Gets the privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._privacy_protocol + + @privacy_protocol.setter + def privacy_protocol(self, privacy_protocol): + """Sets the privacy_protocol of this SnmpDeviceTransportConfiguration. + + + :param privacy_protocol: The privacy_protocol of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["AES_128", "AES_192", "AES_256", "DES"] # noqa: E501 + if privacy_protocol not in allowed_values: + raise ValueError( + "Invalid value for `privacy_protocol` ({0}), must be one of {1}" # noqa: E501 + .format(privacy_protocol, allowed_values) + ) + + self._privacy_protocol = privacy_protocol + + @property + def protocol_version(self): + """Gets the protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._protocol_version + + @protocol_version.setter + def protocol_version(self, protocol_version): + """Sets the protocol_version of this SnmpDeviceTransportConfiguration. + + + :param protocol_version: The protocol_version of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + allowed_values = ["V1", "V2C", "V3"] # noqa: E501 + if protocol_version not in allowed_values: + raise ValueError( + "Invalid value for `protocol_version` ({0}), must be one of {1}" # noqa: E501 + .format(protocol_version, allowed_values) + ) + + self._protocol_version = protocol_version + + @property + def security_name(self): + """Gets the security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._security_name + + @security_name.setter + def security_name(self, security_name): + """Sets the security_name of this SnmpDeviceTransportConfiguration. + + + :param security_name: The security_name of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._security_name = security_name + + @property + def username(self): + """Gets the username of this SnmpDeviceTransportConfiguration. # noqa: E501 + + + :return: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :rtype: str + """ + return self._username + + @username.setter + def username(self, username): + """Sets the username of this SnmpDeviceTransportConfiguration. + + + :param username: The username of this SnmpDeviceTransportConfiguration. # noqa: E501 + :type: str + """ + + self._username = username + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpDeviceTransportConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpDeviceTransportConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_mapping.py b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_mapping.py new file mode 100644 index 0000000..5857164 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/snmp_mapping.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SnmpMapping(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'data_type': 'str', + 'key': 'str', + 'oid': 'str' + } + + attribute_map = { + 'data_type': 'dataType', + 'key': 'key', + 'oid': 'oid' + } + + def __init__(self, data_type=None, key=None, oid=None): # noqa: E501 + """SnmpMapping - a model defined in Swagger""" # noqa: E501 + self._data_type = None + self._key = None + self._oid = None + self.discriminator = None + if data_type is not None: + self.data_type = data_type + if key is not None: + self.key = key + if oid is not None: + self.oid = oid + + @property + def data_type(self): + """Gets the data_type of this SnmpMapping. # noqa: E501 + + + :return: The data_type of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._data_type + + @data_type.setter + def data_type(self, data_type): + """Sets the data_type of this SnmpMapping. + + + :param data_type: The data_type of this SnmpMapping. # noqa: E501 + :type: str + """ + allowed_values = ["BOOLEAN", "DOUBLE", "JSON", "LONG", "STRING"] # noqa: E501 + if data_type not in allowed_values: + raise ValueError( + "Invalid value for `data_type` ({0}), must be one of {1}" # noqa: E501 + .format(data_type, allowed_values) + ) + + self._data_type = data_type + + @property + def key(self): + """Gets the key of this SnmpMapping. # noqa: E501 + + + :return: The key of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this SnmpMapping. + + + :param key: The key of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._key = key + + @property + def oid(self): + """Gets the oid of this SnmpMapping. # noqa: E501 + + + :return: The oid of this SnmpMapping. # noqa: E501 + :rtype: str + """ + return self._oid + + @oid.setter + def oid(self, oid): + """Sets the oid of this SnmpMapping. + + + :param oid: The oid of this SnmpMapping. # noqa: E501 + :type: str + """ + + self._oid = oid + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SnmpMapping, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SnmpMapping): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/solution_install_response.py b/tb-rest-client/python/tb_rest_client/models/models_pe/solution_install_response.py new file mode 100644 index 0000000..acb33dc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/solution_install_response.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SolutionInstallResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dashboard_group_id': 'EntityGroupId', + 'dashboard_id': 'DashboardId', + 'public_id': 'CustomerId', + 'main_dashboard_public': 'bool', + 'success': 'bool', + 'details': 'str' + } + + attribute_map = { + 'dashboard_group_id': 'dashboardGroupId', + 'dashboard_id': 'dashboardId', + 'public_id': 'publicId', + 'main_dashboard_public': 'mainDashboardPublic', + 'success': 'success', + 'details': 'details' + } + + def __init__(self, dashboard_group_id=None, dashboard_id=None, public_id=None, main_dashboard_public=None, success=None, details=None): # noqa: E501 + """SolutionInstallResponse - a model defined in Swagger""" # noqa: E501 + self._dashboard_group_id = None + self._dashboard_id = None + self._public_id = None + self._main_dashboard_public = None + self._success = None + self._details = None + self.discriminator = None + if dashboard_group_id is not None: + self.dashboard_group_id = dashboard_group_id + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if public_id is not None: + self.public_id = public_id + if main_dashboard_public is not None: + self.main_dashboard_public = main_dashboard_public + if success is not None: + self.success = success + if details is not None: + self.details = details + + @property + def dashboard_group_id(self): + """Gets the dashboard_group_id of this SolutionInstallResponse. # noqa: E501 + + + :return: The dashboard_group_id of this SolutionInstallResponse. # noqa: E501 + :rtype: EntityGroupId + """ + return self._dashboard_group_id + + @dashboard_group_id.setter + def dashboard_group_id(self, dashboard_group_id): + """Sets the dashboard_group_id of this SolutionInstallResponse. + + + :param dashboard_group_id: The dashboard_group_id of this SolutionInstallResponse. # noqa: E501 + :type: EntityGroupId + """ + + self._dashboard_group_id = dashboard_group_id + + @property + def dashboard_id(self): + """Gets the dashboard_id of this SolutionInstallResponse. # noqa: E501 + + + :return: The dashboard_id of this SolutionInstallResponse. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this SolutionInstallResponse. + + + :param dashboard_id: The dashboard_id of this SolutionInstallResponse. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + @property + def public_id(self): + """Gets the public_id of this SolutionInstallResponse. # noqa: E501 + + + :return: The public_id of this SolutionInstallResponse. # noqa: E501 + :rtype: CustomerId + """ + return self._public_id + + @public_id.setter + def public_id(self, public_id): + """Sets the public_id of this SolutionInstallResponse. + + + :param public_id: The public_id of this SolutionInstallResponse. # noqa: E501 + :type: CustomerId + """ + + self._public_id = public_id + + @property + def main_dashboard_public(self): + """Gets the main_dashboard_public of this SolutionInstallResponse. # noqa: E501 + + Is the main dashboard public # noqa: E501 + + :return: The main_dashboard_public of this SolutionInstallResponse. # noqa: E501 + :rtype: bool + """ + return self._main_dashboard_public + + @main_dashboard_public.setter + def main_dashboard_public(self, main_dashboard_public): + """Sets the main_dashboard_public of this SolutionInstallResponse. + + Is the main dashboard public # noqa: E501 + + :param main_dashboard_public: The main_dashboard_public of this SolutionInstallResponse. # noqa: E501 + :type: bool + """ + + self._main_dashboard_public = main_dashboard_public + + @property + def success(self): + """Gets the success of this SolutionInstallResponse. # noqa: E501 + + Indicates that template was installed successfully # noqa: E501 + + :return: The success of this SolutionInstallResponse. # noqa: E501 + :rtype: bool + """ + return self._success + + @success.setter + def success(self, success): + """Sets the success of this SolutionInstallResponse. + + Indicates that template was installed successfully # noqa: E501 + + :param success: The success of this SolutionInstallResponse. # noqa: E501 + :type: bool + """ + + self._success = success + + @property + def details(self): + """Gets the details of this SolutionInstallResponse. # noqa: E501 + + Markdown with solution usage instructions # noqa: E501 + + :return: The details of this SolutionInstallResponse. # noqa: E501 + :rtype: str + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this SolutionInstallResponse. + + Markdown with solution usage instructions # noqa: E501 + + :param details: The details of this SolutionInstallResponse. # noqa: E501 + :type: str + """ + + self._details = details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SolutionInstallResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SolutionInstallResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/specific_time_schedule.py b/tb-rest-client/python/tb_rest_client/models/models_pe/specific_time_schedule.py new file mode 100644 index 0000000..2c57b29 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/specific_time_schedule.py @@ -0,0 +1,260 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SpecificTimeSchedule(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'days_of_week': 'list[int]', + 'dynamic_value': 'DynamicValuestring', + 'ends_on': 'int', + 'starts_on': 'int', + 'timezone': 'str', + 'type': 'str' + } + + attribute_map = { + 'days_of_week': 'daysOfWeek', + 'dynamic_value': 'dynamicValue', + 'ends_on': 'endsOn', + 'starts_on': 'startsOn', + 'timezone': 'timezone', + 'type': 'type' + } + + def __init__(self, days_of_week=None, dynamic_value=None, ends_on=None, starts_on=None, timezone=None, type=None): # noqa: E501 + """SpecificTimeSchedule - a model defined in Swagger""" # noqa: E501 + self._days_of_week = None + self._dynamic_value = None + self._ends_on = None + self._starts_on = None + self._timezone = None + self._type = None + self.discriminator = None + if days_of_week is not None: + self.days_of_week = days_of_week + if dynamic_value is not None: + self.dynamic_value = dynamic_value + if ends_on is not None: + self.ends_on = ends_on + if starts_on is not None: + self.starts_on = starts_on + if timezone is not None: + self.timezone = timezone + if type is not None: + self.type = type + + @property + def days_of_week(self): + """Gets the days_of_week of this SpecificTimeSchedule. # noqa: E501 + + + :return: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :rtype: list[int] + """ + return self._days_of_week + + @days_of_week.setter + def days_of_week(self, days_of_week): + """Sets the days_of_week of this SpecificTimeSchedule. + + + :param days_of_week: The days_of_week of this SpecificTimeSchedule. # noqa: E501 + :type: list[int] + """ + + self._days_of_week = days_of_week + + @property + def dynamic_value(self): + """Gets the dynamic_value of this SpecificTimeSchedule. # noqa: E501 + + + :return: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :rtype: DynamicValuestring + """ + return self._dynamic_value + + @dynamic_value.setter + def dynamic_value(self, dynamic_value): + """Sets the dynamic_value of this SpecificTimeSchedule. + + + :param dynamic_value: The dynamic_value of this SpecificTimeSchedule. # noqa: E501 + :type: DynamicValuestring + """ + + self._dynamic_value = dynamic_value + + @property + def ends_on(self): + """Gets the ends_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._ends_on + + @ends_on.setter + def ends_on(self, ends_on): + """Sets the ends_on of this SpecificTimeSchedule. + + + :param ends_on: The ends_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._ends_on = ends_on + + @property + def starts_on(self): + """Gets the starts_on of this SpecificTimeSchedule. # noqa: E501 + + + :return: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :rtype: int + """ + return self._starts_on + + @starts_on.setter + def starts_on(self, starts_on): + """Sets the starts_on of this SpecificTimeSchedule. + + + :param starts_on: The starts_on of this SpecificTimeSchedule. # noqa: E501 + :type: int + """ + + self._starts_on = starts_on + + @property + def timezone(self): + """Gets the timezone of this SpecificTimeSchedule. # noqa: E501 + + + :return: The timezone of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._timezone + + @timezone.setter + def timezone(self, timezone): + """Sets the timezone of this SpecificTimeSchedule. + + + :param timezone: The timezone of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + + self._timezone = timezone + + @property + def type(self): + """Gets the type of this SpecificTimeSchedule. # noqa: E501 + + + :return: The type of this SpecificTimeSchedule. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SpecificTimeSchedule. + + + :param type: The type of this SpecificTimeSchedule. # noqa: E501 + :type: str + """ + allowed_values = ["ANY_TIME", "CUSTOM", "SPECIFIC_TIME"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SpecificTimeSchedule, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SpecificTimeSchedule): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/starred_dashboard_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/starred_dashboard_info.py new file mode 100644 index 0000000..efa5080 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/starred_dashboard_info.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class StarredDashboardInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'starred_at': 'int' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'starred_at': 'starredAt' + } + + def __init__(self, id=None, title=None, starred_at=None): # noqa: E501 + """StarredDashboardInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._starred_at = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if starred_at is not None: + self.starred_at = starred_at + + @property + def id(self): + """Gets the id of this StarredDashboardInfo. # noqa: E501 + + JSON object with Dashboard id. # noqa: E501 + + :return: The id of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this StarredDashboardInfo. + + JSON object with Dashboard id. # noqa: E501 + + :param id: The id of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this StarredDashboardInfo. # noqa: E501 + + Title of the dashboard. # noqa: E501 + + :return: The title of this StarredDashboardInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this StarredDashboardInfo. + + Title of the dashboard. # noqa: E501 + + :param title: The title of this StarredDashboardInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def starred_at(self): + """Gets the starred_at of this StarredDashboardInfo. # noqa: E501 + + Starred timestamp # noqa: E501 + + :return: The starred_at of this StarredDashboardInfo. # noqa: E501 + :rtype: int + """ + return self._starred_at + + @starred_at.setter + def starred_at(self, starred_at): + """Sets the starred_at of this StarredDashboardInfo. + + Starred timestamp # noqa: E501 + + :param starred_at: The starred_at of this StarredDashboardInfo. # noqa: E501 + :type: int + """ + + self._starred_at = starred_at + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StarredDashboardInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StarredDashboardInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/state_entity_owner_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/state_entity_owner_filter.py new file mode 100644 index 0000000..a9e0524 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/state_entity_owner_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_filter import EntityFilter # noqa: F401,E501 + +class StateEntityOwnerFilter(EntityFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'single_entity': 'EntityId' + } + if hasattr(EntityFilter, "swagger_types"): + swagger_types.update(EntityFilter.swagger_types) + + attribute_map = { + 'single_entity': 'singleEntity' + } + if hasattr(EntityFilter, "attribute_map"): + attribute_map.update(EntityFilter.attribute_map) + + def __init__(self, single_entity=None, *args, **kwargs): # noqa: E501 + """StateEntityOwnerFilter - a model defined in Swagger""" # noqa: E501 + self._single_entity = None + self.discriminator = None + if single_entity is not None: + self.single_entity = single_entity + EntityFilter.__init__(self, *args, **kwargs) + + @property + def single_entity(self): + """Gets the single_entity of this StateEntityOwnerFilter. # noqa: E501 + + + :return: The single_entity of this StateEntityOwnerFilter. # noqa: E501 + :rtype: EntityId + """ + return self._single_entity + + @single_entity.setter + def single_entity(self, single_entity): + """Sets the single_entity of this StateEntityOwnerFilter. + + + :param single_entity: The single_entity of this StateEntityOwnerFilter. # noqa: E501 + :type: EntityId + """ + + self._single_entity = single_entity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StateEntityOwnerFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StateEntityOwnerFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/statistics_event_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/statistics_event_filter.py new file mode 100644 index 0000000..1de4462 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/statistics_event_filter.py @@ -0,0 +1,305 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.event_filter import EventFilter # noqa: F401,E501 + +class StatisticsEventFilter(EventFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'not_empty': 'bool', + 'event_type': 'str', + 'server': 'str', + 'min_messages_processed': 'int', + 'max_messages_processed': 'int', + 'min_errors_occurred': 'int', + 'max_errors_occurred': 'int' + } + if hasattr(EventFilter, "swagger_types"): + swagger_types.update(EventFilter.swagger_types) + + attribute_map = { + 'not_empty': 'notEmpty', + 'event_type': 'eventType', + 'server': 'server', + 'min_messages_processed': 'minMessagesProcessed', + 'max_messages_processed': 'maxMessagesProcessed', + 'min_errors_occurred': 'minErrorsOccurred', + 'max_errors_occurred': 'maxErrorsOccurred' + } + if hasattr(EventFilter, "attribute_map"): + attribute_map.update(EventFilter.attribute_map) + + def __init__(self, not_empty=None, event_type=None, server=None, min_messages_processed=None, max_messages_processed=None, min_errors_occurred=None, max_errors_occurred=None, *args, **kwargs): # noqa: E501 + """StatisticsEventFilter - a model defined in Swagger""" # noqa: E501 + self._not_empty = None + self._event_type = None + self._server = None + self._min_messages_processed = None + self._max_messages_processed = None + self._min_errors_occurred = None + self._max_errors_occurred = None + self.discriminator = None + if not_empty is not None: + self.not_empty = not_empty + self.event_type = event_type + if server is not None: + self.server = server + if min_messages_processed is not None: + self.min_messages_processed = min_messages_processed + if max_messages_processed is not None: + self.max_messages_processed = max_messages_processed + if min_errors_occurred is not None: + self.min_errors_occurred = min_errors_occurred + if max_errors_occurred is not None: + self.max_errors_occurred = max_errors_occurred + EventFilter.__init__(self, *args, **kwargs) + + @property + def not_empty(self): + """Gets the not_empty of this StatisticsEventFilter. # noqa: E501 + + + :return: The not_empty of this StatisticsEventFilter. # noqa: E501 + :rtype: bool + """ + return self._not_empty + + @not_empty.setter + def not_empty(self, not_empty): + """Sets the not_empty of this StatisticsEventFilter. + + + :param not_empty: The not_empty of this StatisticsEventFilter. # noqa: E501 + :type: bool + """ + + self._not_empty = not_empty + + @property + def event_type(self): + """Gets the event_type of this StatisticsEventFilter. # noqa: E501 + + String value representing the event type # noqa: E501 + + :return: The event_type of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._event_type + + @event_type.setter + def event_type(self, event_type): + """Sets the event_type of this StatisticsEventFilter. + + String value representing the event type # noqa: E501 + + :param event_type: The event_type of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + if event_type is None: + raise ValueError("Invalid value for `event_type`, must not be `None`") # noqa: E501 + allowed_values = ["DEBUG_CONVERTER", "DEBUG_INTEGRATION", "DEBUG_RULE_CHAIN", "DEBUG_RULE_NODE", "ERROR", "LC_EVENT", "RAW_DATA", "STATS"] # noqa: E501 + if event_type not in allowed_values: + raise ValueError( + "Invalid value for `event_type` ({0}), must be one of {1}" # noqa: E501 + .format(event_type, allowed_values) + ) + + self._event_type = event_type + + @property + def server(self): + """Gets the server of this StatisticsEventFilter. # noqa: E501 + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :return: The server of this StatisticsEventFilter. # noqa: E501 + :rtype: str + """ + return self._server + + @server.setter + def server(self, server): + """Sets the server of this StatisticsEventFilter. + + String value representing the server name, identifier or ip address where the platform is running # noqa: E501 + + :param server: The server of this StatisticsEventFilter. # noqa: E501 + :type: str + """ + + self._server = server + + @property + def min_messages_processed(self): + """Gets the min_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The minimum number of successfully processed messages # noqa: E501 + + :return: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_messages_processed + + @min_messages_processed.setter + def min_messages_processed(self, min_messages_processed): + """Sets the min_messages_processed of this StatisticsEventFilter. + + The minimum number of successfully processed messages # noqa: E501 + + :param min_messages_processed: The min_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_messages_processed = min_messages_processed + + @property + def max_messages_processed(self): + """Gets the max_messages_processed of this StatisticsEventFilter. # noqa: E501 + + The maximum number of successfully processed messages # noqa: E501 + + :return: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_messages_processed + + @max_messages_processed.setter + def max_messages_processed(self, max_messages_processed): + """Sets the max_messages_processed of this StatisticsEventFilter. + + The maximum number of successfully processed messages # noqa: E501 + + :param max_messages_processed: The max_messages_processed of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_messages_processed = max_messages_processed + + @property + def min_errors_occurred(self): + """Gets the min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The minimum number of errors occurred during messages processing # noqa: E501 + + :return: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._min_errors_occurred + + @min_errors_occurred.setter + def min_errors_occurred(self, min_errors_occurred): + """Sets the min_errors_occurred of this StatisticsEventFilter. + + The minimum number of errors occurred during messages processing # noqa: E501 + + :param min_errors_occurred: The min_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._min_errors_occurred = min_errors_occurred + + @property + def max_errors_occurred(self): + """Gets the max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + + The maximum number of errors occurred during messages processing # noqa: E501 + + :return: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :rtype: int + """ + return self._max_errors_occurred + + @max_errors_occurred.setter + def max_errors_occurred(self, max_errors_occurred): + """Sets the max_errors_occurred of this StatisticsEventFilter. + + The maximum number of errors occurred during messages processing # noqa: E501 + + :param max_errors_occurred: The max_errors_occurred of this StatisticsEventFilter. # noqa: E501 + :type: int + """ + + self._max_errors_occurred = max_errors_occurred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StatisticsEventFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StatisticsEventFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/string_filter_predicate.py b/tb-rest-client/python/tb_rest_client/models/models_pe/string_filter_predicate.py new file mode 100644 index 0000000..61b692d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/string_filter_predicate.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.key_filter_predicate import KeyFilterPredicate # noqa: F401,E501 + +class StringFilterPredicate(KeyFilterPredicate): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'ignore_case': 'bool', + 'operation': 'str', + 'value': 'FilterPredicateValuestring' + } + if hasattr(KeyFilterPredicate, "swagger_types"): + swagger_types.update(KeyFilterPredicate.swagger_types) + + attribute_map = { + 'ignore_case': 'ignoreCase', + 'operation': 'operation', + 'value': 'value' + } + if hasattr(KeyFilterPredicate, "attribute_map"): + attribute_map.update(KeyFilterPredicate.attribute_map) + + def __init__(self, ignore_case=None, operation=None, value=None, *args, **kwargs): # noqa: E501 + """StringFilterPredicate - a model defined in Swagger""" # noqa: E501 + self._ignore_case = None + self._operation = None + self._value = None + self.discriminator = None + if ignore_case is not None: + self.ignore_case = ignore_case + if operation is not None: + self.operation = operation + if value is not None: + self.value = value + KeyFilterPredicate.__init__(self, *args, **kwargs) + + @property + def ignore_case(self): + """Gets the ignore_case of this StringFilterPredicate. # noqa: E501 + + + :return: The ignore_case of this StringFilterPredicate. # noqa: E501 + :rtype: bool + """ + return self._ignore_case + + @ignore_case.setter + def ignore_case(self, ignore_case): + """Sets the ignore_case of this StringFilterPredicate. + + + :param ignore_case: The ignore_case of this StringFilterPredicate. # noqa: E501 + :type: bool + """ + + self._ignore_case = ignore_case + + @property + def operation(self): + """Gets the operation of this StringFilterPredicate. # noqa: E501 + + + :return: The operation of this StringFilterPredicate. # noqa: E501 + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """Sets the operation of this StringFilterPredicate. + + + :param operation: The operation of this StringFilterPredicate. # noqa: E501 + :type: str + """ + allowed_values = ["CONTAINS", "ENDS_WITH", "EQUAL", "IN", "NOT_CONTAINS", "NOT_EQUAL", "NOT_IN", "STARTS_WITH"] # noqa: E501 + if operation not in allowed_values: + raise ValueError( + "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 + .format(operation, allowed_values) + ) + + self._operation = operation + + @property + def value(self): + """Gets the value of this StringFilterPredicate. # noqa: E501 + + + :return: The value of this StringFilterPredicate. # noqa: E501 + :rtype: FilterPredicateValuestring + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this StringFilterPredicate. + + + :param value: The value of this StringFilterPredicate. # noqa: E501 + :type: FilterPredicateValuestring + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(StringFilterPredicate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, StringFilterPredicate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/submit_strategy.py b/tb-rest-client/python/tb_rest_client/models/models_pe/submit_strategy.py new file mode 100644 index 0000000..0b3706c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/submit_strategy.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SubmitStrategy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'batch_size': 'int', + 'type': 'str' + } + + attribute_map = { + 'batch_size': 'batchSize', + 'type': 'type' + } + + def __init__(self, batch_size=None, type=None): # noqa: E501 + """SubmitStrategy - a model defined in Swagger""" # noqa: E501 + self._batch_size = None + self._type = None + self.discriminator = None + if batch_size is not None: + self.batch_size = batch_size + if type is not None: + self.type = type + + @property + def batch_size(self): + """Gets the batch_size of this SubmitStrategy. # noqa: E501 + + + :return: The batch_size of this SubmitStrategy. # noqa: E501 + :rtype: int + """ + return self._batch_size + + @batch_size.setter + def batch_size(self, batch_size): + """Sets the batch_size of this SubmitStrategy. + + + :param batch_size: The batch_size of this SubmitStrategy. # noqa: E501 + :type: int + """ + + self._batch_size = batch_size + + @property + def type(self): + """Gets the type of this SubmitStrategy. # noqa: E501 + + + :return: The type of this SubmitStrategy. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this SubmitStrategy. + + + :param type: The type of this SubmitStrategy. # noqa: E501 + :type: str + """ + allowed_values = ["BATCH", "BURST", "SEQUENTIAL", "SEQUENTIAL_BY_ORIGINATOR", "SEQUENTIAL_BY_TENANT"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SubmitStrategy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SubmitStrategy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/subscription_usage.py b/tb-rest-client/python/tb_rest_client/models/models_pe/subscription_usage.py new file mode 100644 index 0000000..2c5b358 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/subscription_usage.py @@ -0,0 +1,540 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3PAAS-RC1 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SubscriptionUsage(object): + """NOTE: This class is auto generated by the swagger code generator program. +from tb_rest_client.api_client import ApiClient + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'alarms': 'int', + 'assets': 'int', + 'converters': 'int', + 'customers': 'int', + 'dashboards': 'int', + 'devices': 'int', + 'dp_storage_days': 'int', + 'emails': 'int', + 'integrations': 'int', + 'js_executions': 'int', + 're_executions': 'int', + 'rule_chains': 'int', + 'scheduler_events': 'int', + 'sms': 'int', + 'transport_data_points': 'int', + 'transport_messages': 'int', + 'users': 'int' + } + + attribute_map = { + 'alarms': 'alarms', + 'assets': 'assets', + 'converters': 'converters', + 'customers': 'customers', + 'dashboards': 'dashboards', + 'devices': 'devices', + 'dp_storage_days': 'dpStorageDays', + 'emails': 'emails', + 'integrations': 'integrations', + 'js_executions': 'jsExecutions', + 're_executions': 'reExecutions', + 'rule_chains': 'ruleChains', + 'scheduler_events': 'schedulerEvents', + 'sms': 'sms', + 'transport_data_points': 'transportDataPoints', + 'transport_messages': 'transportMessages', + 'users': 'users' + } + + def __init__(self, alarms=None, assets=None, converters=None, customers=None, dashboards=None, devices=None, dp_storage_days=None, emails=None, integrations=None, js_executions=None, re_executions=None, rule_chains=None, scheduler_events=None, sms=None, transport_data_points=None, transport_messages=None, users=None): # noqa: E501 + """SubscriptionUsage - a model defined in Swagger""" # noqa: E501 + self._alarms = None + self._assets = None + self._converters = None + self._customers = None + self._dashboards = None + self._devices = None + self._dp_storage_days = None + self._emails = None + self._integrations = None + self._js_executions = None + self._re_executions = None + self._rule_chains = None + self._scheduler_events = None + self._sms = None + self._transport_data_points = None + self._transport_messages = None + self._users = None + self.discriminator = None + if alarms is not None: + self.alarms = alarms + if assets is not None: + self.assets = assets + if converters is not None: + self.converters = converters + if customers is not None: + self.customers = customers + if dashboards is not None: + self.dashboards = dashboards + if devices is not None: + self.devices = devices + if dp_storage_days is not None: + self.dp_storage_days = dp_storage_days + if emails is not None: + self.emails = emails + if integrations is not None: + self.integrations = integrations + if js_executions is not None: + self.js_executions = js_executions + if re_executions is not None: + self.re_executions = re_executions + if rule_chains is not None: + self.rule_chains = rule_chains + if scheduler_events is not None: + self.scheduler_events = scheduler_events + if sms is not None: + self.sms = sms + if transport_data_points is not None: + self.transport_data_points = transport_data_points + if transport_messages is not None: + self.transport_messages = transport_messages + if users is not None: + self.users = users + + @property + def alarms(self): + """Gets the alarms of this SubscriptionUsage. # noqa: E501 + + + :return: The alarms of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._alarms + + @alarms.setter + def alarms(self, alarms): + """Sets the alarms of this SubscriptionUsage. + + + :param alarms: The alarms of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._alarms = alarms + + @property + def assets(self): + """Gets the assets of this SubscriptionUsage. # noqa: E501 + + + :return: The assets of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._assets + + @assets.setter + def assets(self, assets): + """Sets the assets of this SubscriptionUsage. + + + :param assets: The assets of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._assets = assets + + @property + def converters(self): + """Gets the converters of this SubscriptionUsage. # noqa: E501 + + + :return: The converters of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._converters + + @converters.setter + def converters(self, converters): + """Sets the converters of this SubscriptionUsage. + + + :param converters: The converters of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._converters = converters + + @property + def customers(self): + """Gets the customers of this SubscriptionUsage. # noqa: E501 + + + :return: The customers of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._customers + + @customers.setter + def customers(self, customers): + """Sets the customers of this SubscriptionUsage. + + + :param customers: The customers of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._customers = customers + + @property + def dashboards(self): + """Gets the dashboards of this SubscriptionUsage. # noqa: E501 + + + :return: The dashboards of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._dashboards + + @dashboards.setter + def dashboards(self, dashboards): + """Sets the dashboards of this SubscriptionUsage. + + + :param dashboards: The dashboards of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._dashboards = dashboards + + @property + def devices(self): + """Gets the devices of this SubscriptionUsage. # noqa: E501 + + + :return: The devices of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._devices + + @devices.setter + def devices(self, devices): + """Sets the devices of this SubscriptionUsage. + + + :param devices: The devices of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._devices = devices + + @property + def dp_storage_days(self): + """Gets the dp_storage_days of this SubscriptionUsage. # noqa: E501 + + + :return: The dp_storage_days of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._dp_storage_days + + @dp_storage_days.setter + def dp_storage_days(self, dp_storage_days): + """Sets the dp_storage_days of this SubscriptionUsage. + + + :param dp_storage_days: The dp_storage_days of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._dp_storage_days = dp_storage_days + + @property + def emails(self): + """Gets the emails of this SubscriptionUsage. # noqa: E501 + + + :return: The emails of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._emails + + @emails.setter + def emails(self, emails): + """Sets the emails of this SubscriptionUsage. + + + :param emails: The emails of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._emails = emails + + @property + def integrations(self): + """Gets the integrations of this SubscriptionUsage. # noqa: E501 + + + :return: The integrations of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._integrations + + @integrations.setter + def integrations(self, integrations): + """Sets the integrations of this SubscriptionUsage. + + + :param integrations: The integrations of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._integrations = integrations + + @property + def js_executions(self): + """Gets the js_executions of this SubscriptionUsage. # noqa: E501 + + + :return: The js_executions of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._js_executions + + @js_executions.setter + def js_executions(self, js_executions): + """Sets the js_executions of this SubscriptionUsage. + + + :param js_executions: The js_executions of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._js_executions = js_executions + + @property + def re_executions(self): + """Gets the re_executions of this SubscriptionUsage. # noqa: E501 + + + :return: The re_executions of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._re_executions + + @re_executions.setter + def re_executions(self, re_executions): + """Sets the re_executions of this SubscriptionUsage. + + + :param re_executions: The re_executions of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._re_executions = re_executions + + @property + def rule_chains(self): + """Gets the rule_chains of this SubscriptionUsage. # noqa: E501 + + + :return: The rule_chains of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._rule_chains + + @rule_chains.setter + def rule_chains(self, rule_chains): + """Sets the rule_chains of this SubscriptionUsage. + + + :param rule_chains: The rule_chains of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._rule_chains = rule_chains + + @property + def scheduler_events(self): + """Gets the scheduler_events of this SubscriptionUsage. # noqa: E501 + + + :return: The scheduler_events of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._scheduler_events + + @scheduler_events.setter + def scheduler_events(self, scheduler_events): + """Sets the scheduler_events of this SubscriptionUsage. + + + :param scheduler_events: The scheduler_events of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._scheduler_events = scheduler_events + + @property + def sms(self): + """Gets the sms of this SubscriptionUsage. # noqa: E501 + + + :return: The sms of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._sms + + @sms.setter + def sms(self, sms): + """Sets the sms of this SubscriptionUsage. + + + :param sms: The sms of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._sms = sms + + @property + def transport_data_points(self): + """Gets the transport_data_points of this SubscriptionUsage. # noqa: E501 + + + :return: The transport_data_points of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._transport_data_points + + @transport_data_points.setter + def transport_data_points(self, transport_data_points): + """Sets the transport_data_points of this SubscriptionUsage. + + + :param transport_data_points: The transport_data_points of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._transport_data_points = transport_data_points + + @property + def transport_messages(self): + """Gets the transport_messages of this SubscriptionUsage. # noqa: E501 + + + :return: The transport_messages of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._transport_messages + + @transport_messages.setter + def transport_messages(self, transport_messages): + """Sets the transport_messages of this SubscriptionUsage. + + + :param transport_messages: The transport_messages of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._transport_messages = transport_messages + + @property + def users(self): + """Gets the users of this SubscriptionUsage. # noqa: E501 + + + :return: The users of this SubscriptionUsage. # noqa: E501 + :rtype: int + """ + return self._users + + @users.setter + def users(self, users): + """Sets the users of this SubscriptionUsage. + + + :param users: The users of this SubscriptionUsage. # noqa: E501 + :type: int + """ + + self._users = users + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SubscriptionUsage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SubscriptionUsage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/system_administrators_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/system_administrators_filter.py new file mode 100644 index 0000000..795789a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/system_administrators_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemAdministratorsFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """SystemAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/system_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/system_info.py new file mode 100644 index 0000000..ac5ca7f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/system_info.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'monolith': 'bool', + 'system_data': 'list[SystemInfoData]' + } + + attribute_map = { + 'monolith': 'monolith', + 'system_data': 'systemData' + } + + def __init__(self, monolith=None, system_data=None): # noqa: E501 + """SystemInfo - a model defined in Swagger""" # noqa: E501 + self._monolith = None + self._system_data = None + self.discriminator = None + if monolith is not None: + self.monolith = monolith + if system_data is not None: + self.system_data = system_data + + @property + def monolith(self): + """Gets the monolith of this SystemInfo. # noqa: E501 + + + :return: The monolith of this SystemInfo. # noqa: E501 + :rtype: bool + """ + return self._monolith + + @monolith.setter + def monolith(self, monolith): + """Sets the monolith of this SystemInfo. + + + :param monolith: The monolith of this SystemInfo. # noqa: E501 + :type: bool + """ + + self._monolith = monolith + + @property + def system_data(self): + """Gets the system_data of this SystemInfo. # noqa: E501 + + System data. # noqa: E501 + + :return: The system_data of this SystemInfo. # noqa: E501 + :rtype: list[SystemInfoData] + """ + return self._system_data + + @system_data.setter + def system_data(self, system_data): + """Sets the system_data of this SystemInfo. + + System data. # noqa: E501 + + :param system_data: The system_data of this SystemInfo. # noqa: E501 + :type: list[SystemInfoData] + """ + + self._system_data = system_data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/system_info_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/system_info_data.py new file mode 100644 index 0000000..0067e39 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/system_info_data.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class SystemInfoData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'service_id': 'str', + 'service_type': 'str', + 'cpu_usage': 'int', + 'cpu_count': 'int', + 'memory_usage': 'int', + 'total_memory': 'int', + 'disc_usage': 'int', + 'total_disc_space': 'int' + } + + attribute_map = { + 'service_id': 'serviceId', + 'service_type': 'serviceType', + 'cpu_usage': 'cpuUsage', + 'cpu_count': 'cpuCount', + 'memory_usage': 'memoryUsage', + 'total_memory': 'totalMemory', + 'disc_usage': 'discUsage', + 'total_disc_space': 'totalDiscSpace' + } + + def __init__(self, service_id=None, service_type=None, cpu_usage=None, cpu_count=None, memory_usage=None, total_memory=None, disc_usage=None, total_disc_space=None): # noqa: E501 + """SystemInfoData - a model defined in Swagger""" # noqa: E501 + self._service_id = None + self._service_type = None + self._cpu_usage = None + self._cpu_count = None + self._memory_usage = None + self._total_memory = None + self._disc_usage = None + self._total_disc_space = None + self.discriminator = None + if service_id is not None: + self.service_id = service_id + if service_type is not None: + self.service_type = service_type + if cpu_usage is not None: + self.cpu_usage = cpu_usage + if cpu_count is not None: + self.cpu_count = cpu_count + if memory_usage is not None: + self.memory_usage = memory_usage + if total_memory is not None: + self.total_memory = total_memory + if disc_usage is not None: + self.disc_usage = disc_usage + if total_disc_space is not None: + self.total_disc_space = total_disc_space + + @property + def service_id(self): + """Gets the service_id of this SystemInfoData. # noqa: E501 + + Service Id. # noqa: E501 + + :return: The service_id of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_id + + @service_id.setter + def service_id(self, service_id): + """Sets the service_id of this SystemInfoData. + + Service Id. # noqa: E501 + + :param service_id: The service_id of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_id = service_id + + @property + def service_type(self): + """Gets the service_type of this SystemInfoData. # noqa: E501 + + Service type. # noqa: E501 + + :return: The service_type of this SystemInfoData. # noqa: E501 + :rtype: str + """ + return self._service_type + + @service_type.setter + def service_type(self, service_type): + """Sets the service_type of this SystemInfoData. + + Service type. # noqa: E501 + + :param service_type: The service_type of this SystemInfoData. # noqa: E501 + :type: str + """ + + self._service_type = service_type + + @property + def cpu_usage(self): + """Gets the cpu_usage of this SystemInfoData. # noqa: E501 + + CPU usage, in percent. # noqa: E501 + + :return: The cpu_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_usage + + @cpu_usage.setter + def cpu_usage(self, cpu_usage): + """Sets the cpu_usage of this SystemInfoData. + + CPU usage, in percent. # noqa: E501 + + :param cpu_usage: The cpu_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_usage = cpu_usage + + @property + def cpu_count(self): + """Gets the cpu_count of this SystemInfoData. # noqa: E501 + + Total CPU usage. # noqa: E501 + + :return: The cpu_count of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._cpu_count + + @cpu_count.setter + def cpu_count(self, cpu_count): + """Sets the cpu_count of this SystemInfoData. + + Total CPU usage. # noqa: E501 + + :param cpu_count: The cpu_count of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._cpu_count = cpu_count + + @property + def memory_usage(self): + """Gets the memory_usage of this SystemInfoData. # noqa: E501 + + Memory usage, in percent. # noqa: E501 + + :return: The memory_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._memory_usage + + @memory_usage.setter + def memory_usage(self, memory_usage): + """Sets the memory_usage of this SystemInfoData. + + Memory usage, in percent. # noqa: E501 + + :param memory_usage: The memory_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._memory_usage = memory_usage + + @property + def total_memory(self): + """Gets the total_memory of this SystemInfoData. # noqa: E501 + + Total memory in bytes. # noqa: E501 + + :return: The total_memory of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_memory + + @total_memory.setter + def total_memory(self, total_memory): + """Sets the total_memory of this SystemInfoData. + + Total memory in bytes. # noqa: E501 + + :param total_memory: The total_memory of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_memory = total_memory + + @property + def disc_usage(self): + """Gets the disc_usage of this SystemInfoData. # noqa: E501 + + Disk usage, in percent. # noqa: E501 + + :return: The disc_usage of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._disc_usage + + @disc_usage.setter + def disc_usage(self, disc_usage): + """Sets the disc_usage of this SystemInfoData. + + Disk usage, in percent. # noqa: E501 + + :param disc_usage: The disc_usage of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._disc_usage = disc_usage + + @property + def total_disc_space(self): + """Gets the total_disc_space of this SystemInfoData. # noqa: E501 + + Total disc space in bytes. # noqa: E501 + + :return: The total_disc_space of this SystemInfoData. # noqa: E501 + :rtype: int + """ + return self._total_disc_space + + @total_disc_space.setter + def total_disc_space(self, total_disc_space): + """Sets the total_disc_space of this SystemInfoData. + + Total disc space in bytes. # noqa: E501 + + :param total_disc_space: The total_disc_space of this SystemInfoData. # noqa: E501 + :type: int + """ + + self._total_disc_space = total_disc_space + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(SystemInfoData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, SystemInfoData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource.py new file mode 100644 index 0000000..beeb657 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource.py @@ -0,0 +1,324 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResource(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str', + 'file_name': 'str', + 'data': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey', + 'file_name': 'fileName', + 'data': 'data' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None, file_name=None, data=None): # noqa: E501 + """TbResource - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self._file_name = None + self._data = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + if file_name is not None: + self.file_name = file_name + if data is not None: + self.data = data + + @property + def id(self): + """Gets the id of this TbResource. # noqa: E501 + + + :return: The id of this TbResource. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResource. + + + :param id: The id of this TbResource. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResource. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResource. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResource. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResource. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResource. # noqa: E501 + + + :return: The tenant_id of this TbResource. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResource. + + + :param tenant_id: The tenant_id of this TbResource. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResource. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResource. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResource. + + Resource title. # noqa: E501 + + :param title: The title of this TbResource. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResource. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResource. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResource. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResource. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResource. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResource. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResource. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + @property + def file_name(self): + """Gets the file_name of this TbResource. # noqa: E501 + + Resource file name. # noqa: E501 + + :return: The file_name of this TbResource. # noqa: E501 + :rtype: str + """ + return self._file_name + + @file_name.setter + def file_name(self, file_name): + """Sets the file_name of this TbResource. + + Resource file name. # noqa: E501 + + :param file_name: The file_name of this TbResource. # noqa: E501 + :type: str + """ + + self._file_name = file_name + + @property + def data(self): + """Gets the data of this TbResource. # noqa: E501 + + Resource data. # noqa: E501 + + :return: The data of this TbResource. # noqa: E501 + :rtype: str + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this TbResource. + + Resource data. # noqa: E501 + + :param data: The data of this TbResource. # noqa: E501 + :type: str + """ + + self._data = data + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResource, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResource): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource_id.py new file mode 100644 index 0000000..16ac0e4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TbResourceId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TbResourceId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TbResourceId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TbResourceId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TbResourceId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TbResourceId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TbResourceId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TB_RESOURCE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource_info.py new file mode 100644 index 0000000..beed8be --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tb_resource_info.py @@ -0,0 +1,268 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TbResourceInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'TbResourceId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'title': 'str', + 'resource_type': 'str', + 'resource_key': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'title': 'title', + 'resource_type': 'resourceType', + 'resource_key': 'resourceKey' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, title=None, resource_type=None, resource_key=None): # noqa: E501 + """TbResourceInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._title = None + self._resource_type = None + self._resource_key = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if title is not None: + self.title = title + if resource_type is not None: + self.resource_type = resource_type + if resource_key is not None: + self.resource_key = resource_key + + @property + def id(self): + """Gets the id of this TbResourceInfo. # noqa: E501 + + + :return: The id of this TbResourceInfo. # noqa: E501 + :rtype: TbResourceId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TbResourceInfo. + + + :param id: The id of this TbResourceInfo. # noqa: E501 + :type: TbResourceId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this TbResourceInfo. # noqa: E501 + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :return: The created_time of this TbResourceInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this TbResourceInfo. + + Timestamp of the resource creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this TbResourceInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this TbResourceInfo. # noqa: E501 + + + :return: The tenant_id of this TbResourceInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this TbResourceInfo. + + + :param tenant_id: The tenant_id of this TbResourceInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def title(self): + """Gets the title of this TbResourceInfo. # noqa: E501 + + Resource title. # noqa: E501 + + :return: The title of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TbResourceInfo. + + Resource title. # noqa: E501 + + :param title: The title of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def resource_type(self): + """Gets the resource_type of this TbResourceInfo. # noqa: E501 + + Resource type. # noqa: E501 + + :return: The resource_type of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_type + + @resource_type.setter + def resource_type(self, resource_type): + """Sets the resource_type of this TbResourceInfo. + + Resource type. # noqa: E501 + + :param resource_type: The resource_type of this TbResourceInfo. # noqa: E501 + :type: str + """ + allowed_values = ["JKS", "LWM2M_MODEL", "PKCS_12"] # noqa: E501 + if resource_type not in allowed_values: + raise ValueError( + "Invalid value for `resource_type` ({0}), must be one of {1}" # noqa: E501 + .format(resource_type, allowed_values) + ) + + self._resource_type = resource_type + + @property + def resource_key(self): + """Gets the resource_key of this TbResourceInfo. # noqa: E501 + + Resource key. # noqa: E501 + + :return: The resource_key of this TbResourceInfo. # noqa: E501 + :rtype: str + """ + return self._resource_key + + @resource_key.setter + def resource_key(self, resource_key): + """Sets the resource_key of this TbResourceInfo. + + Resource key. # noqa: E501 + + :param resource_key: The resource_key of this TbResourceInfo. # noqa: E501 + :type: str + """ + + self._resource_key = resource_key + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TbResourceInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TbResourceInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_entity_view.py b/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_entity_view.py new file mode 100644 index 0000000..bd26484 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_entity_view.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryEntityView(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'timeseries': 'list[str]', + 'attributes': 'AttributesEntityView' + } + + attribute_map = { + 'timeseries': 'timeseries', + 'attributes': 'attributes' + } + + def __init__(self, timeseries=None, attributes=None): # noqa: E501 + """TelemetryEntityView - a model defined in Swagger""" # noqa: E501 + self._timeseries = None + self._attributes = None + self.discriminator = None + self.timeseries = timeseries + self.attributes = attributes + + @property + def timeseries(self): + """Gets the timeseries of this TelemetryEntityView. # noqa: E501 + + List of time-series data keys to expose # noqa: E501 + + :return: The timeseries of this TelemetryEntityView. # noqa: E501 + :rtype: list[str] + """ + return self._timeseries + + @timeseries.setter + def timeseries(self, timeseries): + """Sets the timeseries of this TelemetryEntityView. + + List of time-series data keys to expose # noqa: E501 + + :param timeseries: The timeseries of this TelemetryEntityView. # noqa: E501 + :type: list[str] + """ + if timeseries is None: + raise ValueError("Invalid value for `timeseries`, must not be `None`") # noqa: E501 + + self._timeseries = timeseries + + @property + def attributes(self): + """Gets the attributes of this TelemetryEntityView. # noqa: E501 + + + :return: The attributes of this TelemetryEntityView. # noqa: E501 + :rtype: AttributesEntityView + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this TelemetryEntityView. + + + :param attributes: The attributes of this TelemetryEntityView. # noqa: E501 + :type: AttributesEntityView + """ + if attributes is None: + raise ValueError("Invalid value for `attributes`, must not be `None`") # noqa: E501 + + self._attributes = attributes + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryEntityView, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryEntityView): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_mapping_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_mapping_configuration.py new file mode 100644 index 0000000..393d74d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_mapping_configuration.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TelemetryMappingConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attribute': 'list[str]', + 'attribute_lwm2m': 'dict(str, ObjectAttributes)', + 'key_name': 'dict(str, str)', + 'observe': 'list[str]', + 'telemetry': 'list[str]' + } + + attribute_map = { + 'attribute': 'attribute', + 'attribute_lwm2m': 'attributeLwm2m', + 'key_name': 'keyName', + 'observe': 'observe', + 'telemetry': 'telemetry' + } + + def __init__(self, attribute=None, attribute_lwm2m=None, key_name=None, observe=None, telemetry=None): # noqa: E501 + """TelemetryMappingConfiguration - a model defined in Swagger""" # noqa: E501 + self._attribute = None + self._attribute_lwm2m = None + self._key_name = None + self._observe = None + self._telemetry = None + self.discriminator = None + if attribute is not None: + self.attribute = attribute + if attribute_lwm2m is not None: + self.attribute_lwm2m = attribute_lwm2m + if key_name is not None: + self.key_name = key_name + if observe is not None: + self.observe = observe + if telemetry is not None: + self.telemetry = telemetry + + @property + def attribute(self): + """Gets the attribute of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._attribute + + @attribute.setter + def attribute(self, attribute): + """Sets the attribute of this TelemetryMappingConfiguration. + + + :param attribute: The attribute of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._attribute = attribute + + @property + def attribute_lwm2m(self): + """Gets the attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, ObjectAttributes) + """ + return self._attribute_lwm2m + + @attribute_lwm2m.setter + def attribute_lwm2m(self, attribute_lwm2m): + """Sets the attribute_lwm2m of this TelemetryMappingConfiguration. + + + :param attribute_lwm2m: The attribute_lwm2m of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, ObjectAttributes) + """ + + self._attribute_lwm2m = attribute_lwm2m + + @property + def key_name(self): + """Gets the key_name of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: dict(str, str) + """ + return self._key_name + + @key_name.setter + def key_name(self, key_name): + """Sets the key_name of this TelemetryMappingConfiguration. + + + :param key_name: The key_name of this TelemetryMappingConfiguration. # noqa: E501 + :type: dict(str, str) + """ + + self._key_name = key_name + + @property + def observe(self): + """Gets the observe of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._observe + + @observe.setter + def observe(self, observe): + """Sets the observe of this TelemetryMappingConfiguration. + + + :param observe: The observe of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._observe = observe + + @property + def telemetry(self): + """Gets the telemetry of this TelemetryMappingConfiguration. # noqa: E501 + + + :return: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :rtype: list[str] + """ + return self._telemetry + + @telemetry.setter + def telemetry(self, telemetry): + """Sets the telemetry of this TelemetryMappingConfiguration. + + + :param telemetry: The telemetry of this TelemetryMappingConfiguration. # noqa: E501 + :type: list[str] + """ + + self._telemetry = telemetry + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryMappingConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryMappingConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_querying_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_querying_snmp_communication_config.py new file mode 100644 index 0000000..9e41084 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/telemetry_querying_snmp_communication_config.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.snmp_communication_config import SnmpCommunicationConfig # noqa: F401,E501 + +class TelemetryQueryingSnmpCommunicationConfig(SnmpCommunicationConfig): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'querying_frequency_ms': 'int', + 'spec': 'str' + } + if hasattr(SnmpCommunicationConfig, "swagger_types"): + swagger_types.update(SnmpCommunicationConfig.swagger_types) + + attribute_map = { + 'mappings': 'mappings', + 'querying_frequency_ms': 'queryingFrequencyMs', + 'spec': 'spec' + } + if hasattr(SnmpCommunicationConfig, "attribute_map"): + attribute_map.update(SnmpCommunicationConfig.attribute_map) + + def __init__(self, mappings=None, querying_frequency_ms=None, spec=None, *args, **kwargs): # noqa: E501 + """TelemetryQueryingSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._querying_frequency_ms = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if querying_frequency_ms is not None: + self.querying_frequency_ms = querying_frequency_ms + if spec is not None: + self.spec = spec + SnmpCommunicationConfig.__init__(self, *args, **kwargs) + + @property + def mappings(self): + """Gets the mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this TelemetryQueryingSnmpCommunicationConfig. + + + :param mappings: The mappings of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def querying_frequency_ms(self): + """Gets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: int + """ + return self._querying_frequency_ms + + @querying_frequency_ms.setter + def querying_frequency_ms(self, querying_frequency_ms): + """Sets the querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. + + + :param querying_frequency_ms: The querying_frequency_ms of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: int + """ + + self._querying_frequency_ms = querying_frequency_ms + + @property + def spec(self): + """Gets the spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this TelemetryQueryingSnmpCommunicationConfig. + + + :param spec: The spec of this TelemetryQueryingSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TelemetryQueryingSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TelemetryQueryingSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_administrators_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_administrators_filter.py new file mode 100644 index 0000000..68cf9b0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_administrators_filter.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class TenantAdministratorsFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'tenant_profiles_ids': 'list[str]', + 'tenants_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'tenant_profiles_ids': 'tenantProfilesIds', + 'tenants_ids': 'tenantsIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, tenant_profiles_ids=None, tenants_ids=None, *args, **kwargs): # noqa: E501 + """TenantAdministratorsFilter - a model defined in Swagger""" # noqa: E501 + self._tenant_profiles_ids = None + self._tenants_ids = None + self.discriminator = None + if tenant_profiles_ids is not None: + self.tenant_profiles_ids = tenant_profiles_ids + if tenants_ids is not None: + self.tenants_ids = tenants_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def tenant_profiles_ids(self): + """Gets the tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_profiles_ids + + @tenant_profiles_ids.setter + def tenant_profiles_ids(self, tenant_profiles_ids): + """Sets the tenant_profiles_ids of this TenantAdministratorsFilter. + + + :param tenant_profiles_ids: The tenant_profiles_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenant_profiles_ids = tenant_profiles_ids + + @property + def tenants_ids(self): + """Gets the tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + + + :return: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :rtype: list[str] + """ + return self._tenants_ids + + @tenants_ids.setter + def tenants_ids(self, tenants_ids): + """Sets the tenants_ids of this TenantAdministratorsFilter. + + + :param tenants_ids: The tenants_ids of this TenantAdministratorsFilter. # noqa: E501 + :type: list[str] + """ + + self._tenants_ids = tenants_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantAdministratorsFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantAdministratorsFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_id.py new file mode 100644 index 0000000..97106e5 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_configuration.py new file mode 100644 index 0000000..3b9bb45 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TenantProfileConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_data.py new file mode 100644 index 0000000..0d8bbe6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_data.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileData(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'configuration': 'TenantProfileConfiguration', + 'queue_configuration': 'list[TenantProfileQueueConfiguration]' + } + + attribute_map = { + 'configuration': 'configuration', + 'queue_configuration': 'queueConfiguration' + } + + def __init__(self, configuration=None, queue_configuration=None): # noqa: E501 + """TenantProfileData - a model defined in Swagger""" # noqa: E501 + self._configuration = None + self._queue_configuration = None + self.discriminator = None + if configuration is not None: + self.configuration = configuration + if queue_configuration is not None: + self.queue_configuration = queue_configuration + + @property + def configuration(self): + """Gets the configuration of this TenantProfileData. # noqa: E501 + + + :return: The configuration of this TenantProfileData. # noqa: E501 + :rtype: TenantProfileConfiguration + """ + return self._configuration + + @configuration.setter + def configuration(self, configuration): + """Sets the configuration of this TenantProfileData. + + + :param configuration: The configuration of this TenantProfileData. # noqa: E501 + :type: TenantProfileConfiguration + """ + + self._configuration = configuration + + @property + def queue_configuration(self): + """Gets the queue_configuration of this TenantProfileData. # noqa: E501 + + JSON array of queue configuration per tenant profile # noqa: E501 + + :return: The queue_configuration of this TenantProfileData. # noqa: E501 + :rtype: list[TenantProfileQueueConfiguration] + """ + return self._queue_configuration + + @queue_configuration.setter + def queue_configuration(self, queue_configuration): + """Sets the queue_configuration of this TenantProfileData. + + JSON array of queue configuration per tenant profile # noqa: E501 + + :param queue_configuration: The queue_configuration of this TenantProfileData. # noqa: E501 + :type: list[TenantProfileQueueConfiguration] + """ + + self._queue_configuration = queue_configuration + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_id.py new file mode 100644 index 0000000..def1758 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """TenantProfileId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this TenantProfileId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantProfileId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this TenantProfileId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this TenantProfileId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this TenantProfileId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this TenantProfileId. + + string # noqa: E501 + + :param entity_type: The entity_type of this TenantProfileId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["TENANT_PROFILE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_queue_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_queue_configuration.py new file mode 100644 index 0000000..e8009dc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_profile_queue_configuration.py @@ -0,0 +1,332 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantProfileQueueConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_info': 'JsonNode', + 'consumer_per_partition': 'bool', + 'name': 'str', + 'pack_processing_timeout': 'int', + 'partitions': 'int', + 'poll_interval': 'int', + 'processing_strategy': 'ProcessingStrategy', + 'submit_strategy': 'SubmitStrategy', + 'topic': 'str' + } + + attribute_map = { + 'additional_info': 'additionalInfo', + 'consumer_per_partition': 'consumerPerPartition', + 'name': 'name', + 'pack_processing_timeout': 'packProcessingTimeout', + 'partitions': 'partitions', + 'poll_interval': 'pollInterval', + 'processing_strategy': 'processingStrategy', + 'submit_strategy': 'submitStrategy', + 'topic': 'topic' + } + + def __init__(self, additional_info=None, consumer_per_partition=None, name=None, pack_processing_timeout=None, partitions=None, poll_interval=None, processing_strategy=None, submit_strategy=None, topic=None): # noqa: E501 + """TenantProfileQueueConfiguration - a model defined in Swagger""" # noqa: E501 + self._additional_info = None + self._consumer_per_partition = None + self._name = None + self._pack_processing_timeout = None + self._partitions = None + self._poll_interval = None + self._processing_strategy = None + self._submit_strategy = None + self._topic = None + self.discriminator = None + if additional_info is not None: + self.additional_info = additional_info + if consumer_per_partition is not None: + self.consumer_per_partition = consumer_per_partition + if name is not None: + self.name = name + if pack_processing_timeout is not None: + self.pack_processing_timeout = pack_processing_timeout + if partitions is not None: + self.partitions = partitions + if poll_interval is not None: + self.poll_interval = poll_interval + if processing_strategy is not None: + self.processing_strategy = processing_strategy + if submit_strategy is not None: + self.submit_strategy = submit_strategy + if topic is not None: + self.topic = topic + + @property + def additional_info(self): + """Gets the additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this TenantProfileQueueConfiguration. + + + :param additional_info: The additional_info of this TenantProfileQueueConfiguration. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def consumer_per_partition(self): + """Gets the consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: bool + """ + return self._consumer_per_partition + + @consumer_per_partition.setter + def consumer_per_partition(self, consumer_per_partition): + """Sets the consumer_per_partition of this TenantProfileQueueConfiguration. + + + :param consumer_per_partition: The consumer_per_partition of this TenantProfileQueueConfiguration. # noqa: E501 + :type: bool + """ + + self._consumer_per_partition = consumer_per_partition + + @property + def name(self): + """Gets the name of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this TenantProfileQueueConfiguration. + + + :param name: The name of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def pack_processing_timeout(self): + """Gets the pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._pack_processing_timeout + + @pack_processing_timeout.setter + def pack_processing_timeout(self, pack_processing_timeout): + """Sets the pack_processing_timeout of this TenantProfileQueueConfiguration. + + + :param pack_processing_timeout: The pack_processing_timeout of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._pack_processing_timeout = pack_processing_timeout + + @property + def partitions(self): + """Gets the partitions of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._partitions + + @partitions.setter + def partitions(self, partitions): + """Sets the partitions of this TenantProfileQueueConfiguration. + + + :param partitions: The partitions of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._partitions = partitions + + @property + def poll_interval(self): + """Gets the poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: int + """ + return self._poll_interval + + @poll_interval.setter + def poll_interval(self, poll_interval): + """Sets the poll_interval of this TenantProfileQueueConfiguration. + + + :param poll_interval: The poll_interval of this TenantProfileQueueConfiguration. # noqa: E501 + :type: int + """ + + self._poll_interval = poll_interval + + @property + def processing_strategy(self): + """Gets the processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: ProcessingStrategy + """ + return self._processing_strategy + + @processing_strategy.setter + def processing_strategy(self, processing_strategy): + """Sets the processing_strategy of this TenantProfileQueueConfiguration. + + + :param processing_strategy: The processing_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: ProcessingStrategy + """ + + self._processing_strategy = processing_strategy + + @property + def submit_strategy(self): + """Gets the submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: SubmitStrategy + """ + return self._submit_strategy + + @submit_strategy.setter + def submit_strategy(self, submit_strategy): + """Sets the submit_strategy of this TenantProfileQueueConfiguration. + + + :param submit_strategy: The submit_strategy of this TenantProfileQueueConfiguration. # noqa: E501 + :type: SubmitStrategy + """ + + self._submit_strategy = submit_strategy + + @property + def topic(self): + """Gets the topic of this TenantProfileQueueConfiguration. # noqa: E501 + + + :return: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :rtype: str + """ + return self._topic + + @topic.setter + def topic(self, topic): + """Sets the topic of this TenantProfileQueueConfiguration. + + + :param topic: The topic of this TenantProfileQueueConfiguration. # noqa: E501 + :type: str + """ + + self._topic = topic + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantProfileQueueConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantProfileQueueConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_details.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_details.py new file mode 100644 index 0000000..dff6c1b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_details.py @@ -0,0 +1,376 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantSolutionTemplateDetails(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'description': 'str', + 'highlights': 'str', + 'image_urls': 'list[str]', + 'installed': 'bool', + 'id': 'str', + 'title': 'str', + 'level': 'str', + 'install_timeout_ms': 'int', + 'tenant_telemetry_keys': 'list[str]', + 'tenant_attribute_keys': 'list[str]' + } + + attribute_map = { + 'description': 'description', + 'highlights': 'highlights', + 'image_urls': 'imageUrls', + 'installed': 'installed', + 'id': 'id', + 'title': 'title', + 'level': 'level', + 'install_timeout_ms': 'installTimeoutMs', + 'tenant_telemetry_keys': 'tenantTelemetryKeys', + 'tenant_attribute_keys': 'tenantAttributeKeys' + } + + def __init__(self, description=None, highlights=None, image_urls=None, installed=None, id=None, title=None, level=None, install_timeout_ms=None, tenant_telemetry_keys=None, tenant_attribute_keys=None): # noqa: E501 + """TenantSolutionTemplateDetails - a model defined in Swagger""" # noqa: E501 + self._description = None + self._highlights = None + self._image_urls = None + self._installed = None + self._id = None + self._title = None + self._level = None + self._install_timeout_ms = None + self._tenant_telemetry_keys = None + self._tenant_attribute_keys = None + self.discriminator = None + if description is not None: + self.description = description + if highlights is not None: + self.highlights = highlights + if image_urls is not None: + self.image_urls = image_urls + if installed is not None: + self.installed = installed + if id is not None: + self.id = id + if title is not None: + self.title = title + if level is not None: + self.level = level + if install_timeout_ms is not None: + self.install_timeout_ms = install_timeout_ms + if tenant_telemetry_keys is not None: + self.tenant_telemetry_keys = tenant_telemetry_keys + if tenant_attribute_keys is not None: + self.tenant_attribute_keys = tenant_attribute_keys + + @property + def description(self): + """Gets the description of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The description of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this TenantSolutionTemplateDetails. + + + :param description: The description of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def highlights(self): + """Gets the highlights of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The highlights of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._highlights + + @highlights.setter + def highlights(self, highlights): + """Sets the highlights of this TenantSolutionTemplateDetails. + + + :param highlights: The highlights of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._highlights = highlights + + @property + def image_urls(self): + """Gets the image_urls of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The image_urls of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: list[str] + """ + return self._image_urls + + @image_urls.setter + def image_urls(self, image_urls): + """Sets the image_urls of this TenantSolutionTemplateDetails. + + + :param image_urls: The image_urls of this TenantSolutionTemplateDetails. # noqa: E501 + :type: list[str] + """ + + self._image_urls = image_urls + + @property + def installed(self): + """Gets the installed of this TenantSolutionTemplateDetails. # noqa: E501 + + + :return: The installed of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: bool + """ + return self._installed + + @installed.setter + def installed(self, installed): + """Sets the installed of this TenantSolutionTemplateDetails. + + + :param installed: The installed of this TenantSolutionTemplateDetails. # noqa: E501 + :type: bool + """ + + self._installed = installed + + @property + def id(self): + """Gets the id of this TenantSolutionTemplateDetails. # noqa: E501 + + ID of the solution template # noqa: E501 + + :return: The id of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantSolutionTemplateDetails. + + ID of the solution template # noqa: E501 + + :param id: The id of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this TenantSolutionTemplateDetails. # noqa: E501 + + Template Title # noqa: E501 + + :return: The title of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TenantSolutionTemplateDetails. + + Template Title # noqa: E501 + + :param title: The title of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def level(self): + """Gets the level of this TenantSolutionTemplateDetails. # noqa: E501 + + Level of the subscription that is required to unlock the template # noqa: E501 + + :return: The level of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: str + """ + return self._level + + @level.setter + def level(self, level): + """Sets the level of this TenantSolutionTemplateDetails. + + Level of the subscription that is required to unlock the template # noqa: E501 + + :param level: The level of this TenantSolutionTemplateDetails. # noqa: E501 + :type: str + """ + allowed_values = ["MAKER", "PROTOTYPE", "STARTUP"] # noqa: E501 + if level not in allowed_values: + raise ValueError( + "Invalid value for `level` ({0}), must be one of {1}" # noqa: E501 + .format(level, allowed_values) + ) + + self._level = level + + @property + def install_timeout_ms(self): + """Gets the install_timeout_ms of this TenantSolutionTemplateDetails. # noqa: E501 + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :return: The install_timeout_ms of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: int + """ + return self._install_timeout_ms + + @install_timeout_ms.setter + def install_timeout_ms(self, install_timeout_ms): + """Sets the install_timeout_ms of this TenantSolutionTemplateDetails. + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :param install_timeout_ms: The install_timeout_ms of this TenantSolutionTemplateDetails. # noqa: E501 + :type: int + """ + + self._install_timeout_ms = install_timeout_ms + + @property + def tenant_telemetry_keys(self): + """Gets the tenant_telemetry_keys of this TenantSolutionTemplateDetails. # noqa: E501 + + What keys to delete during template uninstall # noqa: E501 + + :return: The tenant_telemetry_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_telemetry_keys + + @tenant_telemetry_keys.setter + def tenant_telemetry_keys(self, tenant_telemetry_keys): + """Sets the tenant_telemetry_keys of this TenantSolutionTemplateDetails. + + What keys to delete during template uninstall # noqa: E501 + + :param tenant_telemetry_keys: The tenant_telemetry_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :type: list[str] + """ + + self._tenant_telemetry_keys = tenant_telemetry_keys + + @property + def tenant_attribute_keys(self): + """Gets the tenant_attribute_keys of this TenantSolutionTemplateDetails. # noqa: E501 + + What attributes to delete during template uninstall # noqa: E501 + + :return: The tenant_attribute_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_attribute_keys + + @tenant_attribute_keys.setter + def tenant_attribute_keys(self, tenant_attribute_keys): + """Sets the tenant_attribute_keys of this TenantSolutionTemplateDetails. + + What attributes to delete during template uninstall # noqa: E501 + + :param tenant_attribute_keys: The tenant_attribute_keys of this TenantSolutionTemplateDetails. # noqa: E501 + :type: list[str] + """ + + self._tenant_attribute_keys = tenant_attribute_keys + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantSolutionTemplateDetails, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantSolutionTemplateDetails): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_info.py new file mode 100644 index 0000000..e48998b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_info.py @@ -0,0 +1,440 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantSolutionTemplateInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'title': 'str', + 'level': 'str', + 'install_timeout_ms': 'int', + 'tenant_telemetry_keys': 'list[str]', + 'tenant_attribute_keys': 'list[str]', + 'preview_image_url': 'str', + 'short_description': 'str', + 'installed': 'bool', + 'video_preview_image_url': 'str', + 'preview_mp4_url': 'str', + 'preview_webm_url': 'str' + } + + attribute_map = { + 'id': 'id', + 'title': 'title', + 'level': 'level', + 'install_timeout_ms': 'installTimeoutMs', + 'tenant_telemetry_keys': 'tenantTelemetryKeys', + 'tenant_attribute_keys': 'tenantAttributeKeys', + 'preview_image_url': 'previewImageUrl', + 'short_description': 'shortDescription', + 'installed': 'installed', + 'video_preview_image_url': 'videoPreviewImageUrl', + 'preview_mp4_url': 'previewMp4Url', + 'preview_webm_url': 'previewWebmUrl' + } + + def __init__(self, id=None, title=None, level=None, install_timeout_ms=None, tenant_telemetry_keys=None, tenant_attribute_keys=None, preview_image_url=None, short_description=None, installed=None, video_preview_image_url=None, preview_mp4_url=None, preview_webm_url=None): # noqa: E501 + """TenantSolutionTemplateInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._title = None + self._level = None + self._install_timeout_ms = None + self._tenant_telemetry_keys = None + self._tenant_attribute_keys = None + self._preview_image_url = None + self._short_description = None + self._installed = None + self._video_preview_image_url = None + self._preview_mp4_url = None + self._preview_webm_url = None + self.discriminator = None + if id is not None: + self.id = id + if title is not None: + self.title = title + if level is not None: + self.level = level + if install_timeout_ms is not None: + self.install_timeout_ms = install_timeout_ms + if tenant_telemetry_keys is not None: + self.tenant_telemetry_keys = tenant_telemetry_keys + if tenant_attribute_keys is not None: + self.tenant_attribute_keys = tenant_attribute_keys + if preview_image_url is not None: + self.preview_image_url = preview_image_url + if short_description is not None: + self.short_description = short_description + if installed is not None: + self.installed = installed + if video_preview_image_url is not None: + self.video_preview_image_url = video_preview_image_url + if preview_mp4_url is not None: + self.preview_mp4_url = preview_mp4_url + if preview_webm_url is not None: + self.preview_webm_url = preview_webm_url + + @property + def id(self): + """Gets the id of this TenantSolutionTemplateInfo. # noqa: E501 + + ID of the solution template # noqa: E501 + + :return: The id of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this TenantSolutionTemplateInfo. + + ID of the solution template # noqa: E501 + + :param id: The id of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def title(self): + """Gets the title of this TenantSolutionTemplateInfo. # noqa: E501 + + Template Title # noqa: E501 + + :return: The title of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._title + + @title.setter + def title(self, title): + """Sets the title of this TenantSolutionTemplateInfo. + + Template Title # noqa: E501 + + :param title: The title of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._title = title + + @property + def level(self): + """Gets the level of this TenantSolutionTemplateInfo. # noqa: E501 + + Level of the subscription that is required to unlock the template # noqa: E501 + + :return: The level of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._level + + @level.setter + def level(self, level): + """Sets the level of this TenantSolutionTemplateInfo. + + Level of the subscription that is required to unlock the template # noqa: E501 + + :param level: The level of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + allowed_values = ["MAKER", "PROTOTYPE", "STARTUP"] # noqa: E501 + if level not in allowed_values: + raise ValueError( + "Invalid value for `level` ({0}), must be one of {1}" # noqa: E501 + .format(level, allowed_values) + ) + + self._level = level + + @property + def install_timeout_ms(self): + """Gets the install_timeout_ms of this TenantSolutionTemplateInfo. # noqa: E501 + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :return: The install_timeout_ms of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: int + """ + return self._install_timeout_ms + + @install_timeout_ms.setter + def install_timeout_ms(self, install_timeout_ms): + """Sets the install_timeout_ms of this TenantSolutionTemplateInfo. + + Timeout for the installation UI to wait while template is installing # noqa: E501 + + :param install_timeout_ms: The install_timeout_ms of this TenantSolutionTemplateInfo. # noqa: E501 + :type: int + """ + + self._install_timeout_ms = install_timeout_ms + + @property + def tenant_telemetry_keys(self): + """Gets the tenant_telemetry_keys of this TenantSolutionTemplateInfo. # noqa: E501 + + What keys to delete during template uninstall # noqa: E501 + + :return: The tenant_telemetry_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_telemetry_keys + + @tenant_telemetry_keys.setter + def tenant_telemetry_keys(self, tenant_telemetry_keys): + """Sets the tenant_telemetry_keys of this TenantSolutionTemplateInfo. + + What keys to delete during template uninstall # noqa: E501 + + :param tenant_telemetry_keys: The tenant_telemetry_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :type: list[str] + """ + + self._tenant_telemetry_keys = tenant_telemetry_keys + + @property + def tenant_attribute_keys(self): + """Gets the tenant_attribute_keys of this TenantSolutionTemplateInfo. # noqa: E501 + + What attributes to delete during template uninstall # noqa: E501 + + :return: The tenant_attribute_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: list[str] + """ + return self._tenant_attribute_keys + + @tenant_attribute_keys.setter + def tenant_attribute_keys(self, tenant_attribute_keys): + """Sets the tenant_attribute_keys of this TenantSolutionTemplateInfo. + + What attributes to delete during template uninstall # noqa: E501 + + :param tenant_attribute_keys: The tenant_attribute_keys of this TenantSolutionTemplateInfo. # noqa: E501 + :type: list[str] + """ + + self._tenant_attribute_keys = tenant_attribute_keys + + @property + def preview_image_url(self): + """Gets the preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + + URL of the preview image # noqa: E501 + + :return: The preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._preview_image_url + + @preview_image_url.setter + def preview_image_url(self, preview_image_url): + """Sets the preview_image_url of this TenantSolutionTemplateInfo. + + URL of the preview image # noqa: E501 + + :param preview_image_url: The preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._preview_image_url = preview_image_url + + @property + def short_description(self): + """Gets the short_description of this TenantSolutionTemplateInfo. # noqa: E501 + + Short description to display on template card # noqa: E501 + + :return: The short_description of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._short_description + + @short_description.setter + def short_description(self, short_description): + """Sets the short_description of this TenantSolutionTemplateInfo. + + Short description to display on template card # noqa: E501 + + :param short_description: The short_description of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._short_description = short_description + + @property + def installed(self): + """Gets the installed of this TenantSolutionTemplateInfo. # noqa: E501 + + Indicates that template is already installed for the current tenant # noqa: E501 + + :return: The installed of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: bool + """ + return self._installed + + @installed.setter + def installed(self, installed): + """Sets the installed of this TenantSolutionTemplateInfo. + + Indicates that template is already installed for the current tenant # noqa: E501 + + :param installed: The installed of this TenantSolutionTemplateInfo. # noqa: E501 + :type: bool + """ + + self._installed = installed + + @property + def video_preview_image_url(self): + """Gets the video_preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + + Video preview image URL # noqa: E501 + + :return: The video_preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._video_preview_image_url + + @video_preview_image_url.setter + def video_preview_image_url(self, video_preview_image_url): + """Sets the video_preview_image_url of this TenantSolutionTemplateInfo. + + Video preview image URL # noqa: E501 + + :param video_preview_image_url: The video_preview_image_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._video_preview_image_url = video_preview_image_url + + @property + def preview_mp4_url(self): + """Gets the preview_mp4_url of this TenantSolutionTemplateInfo. # noqa: E501 + + Video MP4 URL # noqa: E501 + + :return: The preview_mp4_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._preview_mp4_url + + @preview_mp4_url.setter + def preview_mp4_url(self, preview_mp4_url): + """Sets the preview_mp4_url of this TenantSolutionTemplateInfo. + + Video MP4 URL # noqa: E501 + + :param preview_mp4_url: The preview_mp4_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._preview_mp4_url = preview_mp4_url + + @property + def preview_webm_url(self): + """Gets the preview_webm_url of this TenantSolutionTemplateInfo. # noqa: E501 + + Video WEBM URL # noqa: E501 + + :return: The preview_webm_url of this TenantSolutionTemplateInfo. # noqa: E501 + :rtype: str + """ + return self._preview_webm_url + + @preview_webm_url.setter + def preview_webm_url(self, preview_webm_url): + """Sets the preview_webm_url of this TenantSolutionTemplateInfo. + + Video WEBM URL # noqa: E501 + + :param preview_webm_url: The preview_webm_url of this TenantSolutionTemplateInfo. # noqa: E501 + :type: str + """ + + self._preview_webm_url = preview_webm_url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantSolutionTemplateInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantSolutionTemplateInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_instructions.py b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_instructions.py new file mode 100644 index 0000000..8c8169e --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/tenant_solution_template_instructions.py @@ -0,0 +1,232 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TenantSolutionTemplateInstructions(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'dashboard_group_id': 'EntityGroupId', + 'dashboard_id': 'DashboardId', + 'public_id': 'CustomerId', + 'main_dashboard_public': 'bool', + 'details': 'str' + } + + attribute_map = { + 'dashboard_group_id': 'dashboardGroupId', + 'dashboard_id': 'dashboardId', + 'public_id': 'publicId', + 'main_dashboard_public': 'mainDashboardPublic', + 'details': 'details' + } + + def __init__(self, dashboard_group_id=None, dashboard_id=None, public_id=None, main_dashboard_public=None, details=None): # noqa: E501 + """TenantSolutionTemplateInstructions - a model defined in Swagger""" # noqa: E501 + self._dashboard_group_id = None + self._dashboard_id = None + self._public_id = None + self._main_dashboard_public = None + self._details = None + self.discriminator = None + if dashboard_group_id is not None: + self.dashboard_group_id = dashboard_group_id + if dashboard_id is not None: + self.dashboard_id = dashboard_id + if public_id is not None: + self.public_id = public_id + if main_dashboard_public is not None: + self.main_dashboard_public = main_dashboard_public + if details is not None: + self.details = details + + @property + def dashboard_group_id(self): + """Gets the dashboard_group_id of this TenantSolutionTemplateInstructions. # noqa: E501 + + + :return: The dashboard_group_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: EntityGroupId + """ + return self._dashboard_group_id + + @dashboard_group_id.setter + def dashboard_group_id(self, dashboard_group_id): + """Sets the dashboard_group_id of this TenantSolutionTemplateInstructions. + + + :param dashboard_group_id: The dashboard_group_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: EntityGroupId + """ + + self._dashboard_group_id = dashboard_group_id + + @property + def dashboard_id(self): + """Gets the dashboard_id of this TenantSolutionTemplateInstructions. # noqa: E501 + + + :return: The dashboard_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: DashboardId + """ + return self._dashboard_id + + @dashboard_id.setter + def dashboard_id(self, dashboard_id): + """Sets the dashboard_id of this TenantSolutionTemplateInstructions. + + + :param dashboard_id: The dashboard_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: DashboardId + """ + + self._dashboard_id = dashboard_id + + @property + def public_id(self): + """Gets the public_id of this TenantSolutionTemplateInstructions. # noqa: E501 + + + :return: The public_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: CustomerId + """ + return self._public_id + + @public_id.setter + def public_id(self, public_id): + """Sets the public_id of this TenantSolutionTemplateInstructions. + + + :param public_id: The public_id of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: CustomerId + """ + + self._public_id = public_id + + @property + def main_dashboard_public(self): + """Gets the main_dashboard_public of this TenantSolutionTemplateInstructions. # noqa: E501 + + Is the main dashboard public # noqa: E501 + + :return: The main_dashboard_public of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: bool + """ + return self._main_dashboard_public + + @main_dashboard_public.setter + def main_dashboard_public(self, main_dashboard_public): + """Sets the main_dashboard_public of this TenantSolutionTemplateInstructions. + + Is the main dashboard public # noqa: E501 + + :param main_dashboard_public: The main_dashboard_public of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: bool + """ + + self._main_dashboard_public = main_dashboard_public + + @property + def details(self): + """Gets the details of this TenantSolutionTemplateInstructions. # noqa: E501 + + Markdown with solution usage instructions # noqa: E501 + + :return: The details of this TenantSolutionTemplateInstructions. # noqa: E501 + :rtype: str + """ + return self._details + + @details.setter + def details(self, details): + """Sets the details of this TenantSolutionTemplateInstructions. + + Markdown with solution usage instructions # noqa: E501 + + :param details: The details of this TenantSolutionTemplateInstructions. # noqa: E501 + :type: str + """ + + self._details = details + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TenantSolutionTemplateInstructions, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TenantSolutionTemplateInstructions): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/test_sms_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/test_sms_request.py new file mode 100644 index 0000000..5be2ec1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/test_sms_request.py @@ -0,0 +1,180 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TestSmsRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'provider_configuration': 'SmsProviderConfiguration', + 'number_to': 'str', + 'message': 'str' + } + + attribute_map = { + 'provider_configuration': 'providerConfiguration', + 'number_to': 'numberTo', + 'message': 'message' + } + + def __init__(self, provider_configuration=None, number_to=None, message=None): # noqa: E501 + """TestSmsRequest - a model defined in Swagger""" # noqa: E501 + self._provider_configuration = None + self._number_to = None + self._message = None + self.discriminator = None + if provider_configuration is not None: + self.provider_configuration = provider_configuration + if number_to is not None: + self.number_to = number_to + if message is not None: + self.message = message + + @property + def provider_configuration(self): + """Gets the provider_configuration of this TestSmsRequest. # noqa: E501 + + + :return: The provider_configuration of this TestSmsRequest. # noqa: E501 + :rtype: SmsProviderConfiguration + """ + return self._provider_configuration + + @provider_configuration.setter + def provider_configuration(self, provider_configuration): + """Sets the provider_configuration of this TestSmsRequest. + + + :param provider_configuration: The provider_configuration of this TestSmsRequest. # noqa: E501 + :type: SmsProviderConfiguration + """ + + self._provider_configuration = provider_configuration + + @property + def number_to(self): + """Gets the number_to of this TestSmsRequest. # noqa: E501 + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :return: The number_to of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._number_to + + @number_to.setter + def number_to(self, number_to): + """Sets the number_to of this TestSmsRequest. + + The phone number or other identifier to specify as a recipient of the SMS. # noqa: E501 + + :param number_to: The number_to of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._number_to = number_to + + @property + def message(self): + """Gets the message of this TestSmsRequest. # noqa: E501 + + The test message # noqa: E501 + + :return: The message of this TestSmsRequest. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this TestSmsRequest. + + The test message # noqa: E501 + + :param message: The message of this TestSmsRequest. # noqa: E501 + :type: str + """ + + self._message = message + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TestSmsRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TestSmsRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/thingsboard_credentials_expired_response.py b/tb-rest-client/python/tb_rest_client/models/models_pe/thingsboard_credentials_expired_response.py new file mode 100644 index 0000000..8203161 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/thingsboard_credentials_expired_response.py @@ -0,0 +1,238 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardCredentialsExpiredResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime', + 'reset_token': 'str' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp', + 'reset_token': 'resetToken' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None, reset_token=None): # noqa: E501 + """ThingsboardCredentialsExpiredResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self._reset_token = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + if reset_token is not None: + self.reset_token = reset_token + + @property + def status(self): + """Gets the status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardCredentialsExpiredResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardCredentialsExpiredResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardCredentialsExpiredResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardCredentialsExpiredResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + @property + def reset_token(self): + """Gets the reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + + Password reset token # noqa: E501 + + :return: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :rtype: str + """ + return self._reset_token + + @reset_token.setter + def reset_token(self, reset_token): + """Sets the reset_token of this ThingsboardCredentialsExpiredResponse. + + Password reset token # noqa: E501 + + :param reset_token: The reset_token of this ThingsboardCredentialsExpiredResponse. # noqa: E501 + :type: str + """ + + self._reset_token = reset_token + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardCredentialsExpiredResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardCredentialsExpiredResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/thingsboard_error_response.py b/tb-rest-client/python/tb_rest_client/models/models_pe/thingsboard_error_response.py new file mode 100644 index 0000000..6466951 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/thingsboard_error_response.py @@ -0,0 +1,210 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ThingsboardErrorResponse(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'status': 'int', + 'message': 'str', + 'error_code': 'object', + 'timestamp': 'datetime' + } + + attribute_map = { + 'status': 'status', + 'message': 'message', + 'error_code': 'errorCode', + 'timestamp': 'timestamp' + } + + def __init__(self, status=None, message=None, error_code=None, timestamp=None): # noqa: E501 + """ThingsboardErrorResponse - a model defined in Swagger""" # noqa: E501 + self._status = None + self._message = None + self._error_code = None + self._timestamp = None + self.discriminator = None + if status is not None: + self.status = status + if message is not None: + self.message = message + if error_code is not None: + self.error_code = error_code + if timestamp is not None: + self.timestamp = timestamp + + @property + def status(self): + """Gets the status of this ThingsboardErrorResponse. # noqa: E501 + + HTTP Response Status Code # noqa: E501 + + :return: The status of this ThingsboardErrorResponse. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this ThingsboardErrorResponse. + + HTTP Response Status Code # noqa: E501 + + :param status: The status of this ThingsboardErrorResponse. # noqa: E501 + :type: int + """ + + self._status = status + + @property + def message(self): + """Gets the message of this ThingsboardErrorResponse. # noqa: E501 + + Error message # noqa: E501 + + :return: The message of this ThingsboardErrorResponse. # noqa: E501 + :rtype: str + """ + return self._message + + @message.setter + def message(self, message): + """Sets the message of this ThingsboardErrorResponse. + + Error message # noqa: E501 + + :param message: The message of this ThingsboardErrorResponse. # noqa: E501 + :type: str + """ + + self._message = message + + @property + def error_code(self): + """Gets the error_code of this ThingsboardErrorResponse. # noqa: E501 + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :return: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :rtype: object + """ + return self._error_code + + @error_code.setter + def error_code(self, error_code): + """Sets the error_code of this ThingsboardErrorResponse. + + Platform error code: * `2` - General error (HTTP: 500 - Internal Server Error) * `10` - Authentication failed (HTTP: 401 - Unauthorized) * `11` - JWT token expired (HTTP: 401 - Unauthorized) * `15` - Credentials expired (HTTP: 401 - Unauthorized) * `20` - Permission denied (HTTP: 403 - Forbidden) * `30` - Invalid arguments (HTTP: 400 - Bad Request) * `31` - Bad request params (HTTP: 400 - Bad Request) * `32` - Item not found (HTTP: 404 - Not Found) * `33` - Too many requests (HTTP: 429 - Too Many Requests) * `34` - Too many updates (Too many updates over Websocket session) * `40` - Subscription violation (HTTP: 403 - Forbidden) # noqa: E501 + + :param error_code: The error_code of this ThingsboardErrorResponse. # noqa: E501 + :type: object + """ + + self._error_code = error_code + + @property + def timestamp(self): + """Gets the timestamp of this ThingsboardErrorResponse. # noqa: E501 + + Timestamp # noqa: E501 + + :return: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :rtype: datetime + """ + return self._timestamp + + @timestamp.setter + def timestamp(self, timestamp): + """Sets the timestamp of this ThingsboardErrorResponse. + + Timestamp # noqa: E501 + + :param timestamp: The timestamp of this ThingsboardErrorResponse. # noqa: E501 + :type: datetime + """ + + self._timestamp = timestamp + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ThingsboardErrorResponse, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ThingsboardErrorResponse): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/to_device_rpc_request_snmp_communication_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/to_device_rpc_request_snmp_communication_config.py new file mode 100644 index 0000000..5715783 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/to_device_rpc_request_snmp_communication_config.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class ToDeviceRpcRequestSnmpCommunicationConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'mappings': 'list[SnmpMapping]', + 'spec': 'str' + } + + attribute_map = { + 'mappings': 'mappings', + 'spec': 'spec' + } + + def __init__(self, mappings=None, spec=None): # noqa: E501 + """ToDeviceRpcRequestSnmpCommunicationConfig - a model defined in Swagger""" # noqa: E501 + self._mappings = None + self._spec = None + self.discriminator = None + if mappings is not None: + self.mappings = mappings + if spec is not None: + self.spec = spec + + @property + def mappings(self): + """Gets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: list[SnmpMapping] + """ + return self._mappings + + @mappings.setter + def mappings(self, mappings): + """Sets the mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param mappings: The mappings of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: list[SnmpMapping] + """ + + self._mappings = mappings + + @property + def spec(self): + """Gets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + + + :return: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :rtype: str + """ + return self._spec + + @spec.setter + def spec(self, spec): + """Sets the spec of this ToDeviceRpcRequestSnmpCommunicationConfig. + + + :param spec: The spec of this ToDeviceRpcRequestSnmpCommunicationConfig. # noqa: E501 + :type: str + """ + allowed_values = ["CLIENT_ATTRIBUTES_QUERYING", "SHARED_ATTRIBUTES_SETTING", "TELEMETRY_QUERYING", "TO_DEVICE_RPC_REQUEST"] # noqa: E501 + if spec not in allowed_values: + raise ValueError( + "Invalid value for `spec` ({0}), must be one of {1}" # noqa: E501 + .format(spec, allowed_values) + ) + + self._spec = spec + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(ToDeviceRpcRequestSnmpCommunicationConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ToDeviceRpcRequestSnmpCommunicationConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/totp_two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/totp_two_fa_account_config.py new file mode 100644 index 0000000..fc97a60 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/totp_two_fa_account_config.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auth_url': 'str', + 'use_by_default': 'bool' + } + + attribute_map = { + 'auth_url': 'authUrl', + 'use_by_default': 'useByDefault' + } + + def __init__(self, auth_url=None, use_by_default=None): # noqa: E501 + """TotpTwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._auth_url = None + self._use_by_default = None + self.discriminator = None + self.auth_url = auth_url + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def auth_url(self): + """Gets the auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: str + """ + return self._auth_url + + @auth_url.setter + def auth_url(self, auth_url): + """Sets the auth_url of this TotpTwoFaAccountConfig. + + + :param auth_url: The auth_url of this TotpTwoFaAccountConfig. # noqa: E501 + :type: str + """ + if auth_url is None: + raise ValueError("Invalid value for `auth_url`, must not be `None`") # noqa: E501 + + self._auth_url = auth_url + + @property + def use_by_default(self): + """Gets the use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TotpTwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TotpTwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/totp_two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/totp_two_fa_provider_config.py new file mode 100644 index 0000000..9a7d2e0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/totp_two_fa_provider_config.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TotpTwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'issuer_name': 'str' + } + + attribute_map = { + 'issuer_name': 'issuerName' + } + + def __init__(self, issuer_name=None): # noqa: E501 + """TotpTwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self._issuer_name = None + self.discriminator = None + self.issuer_name = issuer_name + + @property + def issuer_name(self): + """Gets the issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + + + :return: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :rtype: str + """ + return self._issuer_name + + @issuer_name.setter + def issuer_name(self, issuer_name): + """Sets the issuer_name of this TotpTwoFaProviderConfig. + + + :param issuer_name: The issuer_name of this TotpTwoFaProviderConfig. # noqa: E501 + :type: str + """ + if issuer_name is None: + raise ValueError("Invalid value for `issuer_name`, must not be `None`") # noqa: E501 + + self._issuer_name = issuer_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TotpTwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TotpTwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/transport_payload_type_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/transport_payload_type_configuration.py new file mode 100644 index 0000000..2581ed6 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/transport_payload_type_configuration.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TransportPayloadTypeConfiguration(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TransportPayloadTypeConfiguration - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TransportPayloadTypeConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TransportPayloadTypeConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/ts_value.py b/tb-rest-client/python/tb_rest_client/models/models_pe/ts_value.py new file mode 100644 index 0000000..0aacd09 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/ts_value.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TsValue(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'count': 'int', + 'ts': 'int', + 'value': 'str' + } + + attribute_map = { + 'count': 'count', + 'ts': 'ts', + 'value': 'value' + } + + def __init__(self, count=None, ts=None, value=None): # noqa: E501 + """TsValue - a model defined in Swagger""" # noqa: E501 + self._count = None + self._ts = None + self._value = None + self.discriminator = None + if count is not None: + self.count = count + if ts is not None: + self.ts = ts + if value is not None: + self.value = value + + @property + def count(self): + """Gets the count of this TsValue. # noqa: E501 + + + :return: The count of this TsValue. # noqa: E501 + :rtype: int + """ + return self._count + + @count.setter + def count(self, count): + """Sets the count of this TsValue. + + + :param count: The count of this TsValue. # noqa: E501 + :type: int + """ + + self._count = count + + @property + def ts(self): + """Gets the ts of this TsValue. # noqa: E501 + + + :return: The ts of this TsValue. # noqa: E501 + :rtype: int + """ + return self._ts + + @ts.setter + def ts(self, ts): + """Sets the ts of this TsValue. + + + :param ts: The ts of this TsValue. # noqa: E501 + :type: int + """ + + self._ts = ts + + @property + def value(self): + """Gets the value of this TsValue. # noqa: E501 + + + :return: The value of this TsValue. # noqa: E501 + :rtype: str + """ + return self._value + + @value.setter + def value(self, value): + """Sets the value of this TsValue. + + + :param value: The value of this TsValue. # noqa: E501 + :type: str + """ + + self._value = value + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TsValue, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TsValue): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/twilio_sms_provider_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/twilio_sms_provider_configuration.py new file mode 100644 index 0000000..93b199a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/twilio_sms_provider_configuration.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.sms_provider_configuration import SmsProviderConfiguration # noqa: F401,E501 + +class TwilioSmsProviderConfiguration(SmsProviderConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'account_sid': 'str', + 'account_token': 'str', + 'number_from': 'str' + } + if hasattr(SmsProviderConfiguration, "swagger_types"): + swagger_types.update(SmsProviderConfiguration.swagger_types) + + attribute_map = { + 'account_sid': 'accountSid', + 'account_token': 'accountToken', + 'number_from': 'numberFrom' + } + if hasattr(SmsProviderConfiguration, "attribute_map"): + attribute_map.update(SmsProviderConfiguration.attribute_map) + + def __init__(self, account_sid=None, account_token=None, number_from=None, *args, **kwargs): # noqa: E501 + """TwilioSmsProviderConfiguration - a model defined in Swagger""" # noqa: E501 + self._account_sid = None + self._account_token = None + self._number_from = None + self.discriminator = None + if account_sid is not None: + self.account_sid = account_sid + if account_token is not None: + self.account_token = account_token + if number_from is not None: + self.number_from = number_from + SmsProviderConfiguration.__init__(self, *args, **kwargs) + + @property + def account_sid(self): + """Gets the account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Sid. # noqa: E501 + + :return: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_sid + + @account_sid.setter + def account_sid(self, account_sid): + """Sets the account_sid of this TwilioSmsProviderConfiguration. + + Twilio account Sid. # noqa: E501 + + :param account_sid: The account_sid of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_sid = account_sid + + @property + def account_token(self): + """Gets the account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + + Twilio account Token. # noqa: E501 + + :return: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._account_token + + @account_token.setter + def account_token(self, account_token): + """Sets the account_token of this TwilioSmsProviderConfiguration. + + Twilio account Token. # noqa: E501 + + :param account_token: The account_token of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._account_token = account_token + + @property + def number_from(self): + """Gets the number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + + The number/id of a sender. # noqa: E501 + + :return: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :rtype: str + """ + return self._number_from + + @number_from.setter + def number_from(self, number_from): + """Sets the number_from of this TwilioSmsProviderConfiguration. + + The number/id of a sender. # noqa: E501 + + :param number_from: The number_from of this TwilioSmsProviderConfiguration. # noqa: E501 + :type: str + """ + + self._number_from = number_from + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwilioSmsProviderConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwilioSmsProviderConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_account_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_account_config.py new file mode 100644 index 0000000..3f122d3 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_account_config.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfig - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfig. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfig. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfig. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_account_config_update_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_account_config_update_request.py new file mode 100644 index 0000000..38c98b1 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_account_config_update_request.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaAccountConfigUpdateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'use_by_default': 'bool' + } + + attribute_map = { + 'use_by_default': 'useByDefault' + } + + def __init__(self, use_by_default=None): # noqa: E501 + """TwoFaAccountConfigUpdateRequest - a model defined in Swagger""" # noqa: E501 + self._use_by_default = None + self.discriminator = None + if use_by_default is not None: + self.use_by_default = use_by_default + + @property + def use_by_default(self): + """Gets the use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + + + :return: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :rtype: bool + """ + return self._use_by_default + + @use_by_default.setter + def use_by_default(self, use_by_default): + """Sets the use_by_default of this TwoFaAccountConfigUpdateRequest. + + + :param use_by_default: The use_by_default of this TwoFaAccountConfigUpdateRequest. # noqa: E501 + :type: bool + """ + + self._use_by_default = use_by_default + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaAccountConfigUpdateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaAccountConfigUpdateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_provider_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_provider_config.py new file mode 100644 index 0000000..d94f428 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_provider_config.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """TwoFaProviderConfig - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_provider_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_provider_info.py new file mode 100644 index 0000000..3628b32 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/two_fa_provider_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class TwoFaProviderInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'contact': 'str', + 'default': 'bool', + 'min_verification_code_send_period': 'int', + 'type': 'str' + } + + attribute_map = { + 'contact': 'contact', + 'default': 'default', + 'min_verification_code_send_period': 'minVerificationCodeSendPeriod', + 'type': 'type' + } + + def __init__(self, contact=None, default=None, min_verification_code_send_period=None, type=None): # noqa: E501 + """TwoFaProviderInfo - a model defined in Swagger""" # noqa: E501 + self._contact = None + self._default = None + self._min_verification_code_send_period = None + self._type = None + self.discriminator = None + if contact is not None: + self.contact = contact + if default is not None: + self.default = default + if min_verification_code_send_period is not None: + self.min_verification_code_send_period = min_verification_code_send_period + if type is not None: + self.type = type + + @property + def contact(self): + """Gets the contact of this TwoFaProviderInfo. # noqa: E501 + + + :return: The contact of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._contact + + @contact.setter + def contact(self, contact): + """Sets the contact of this TwoFaProviderInfo. + + + :param contact: The contact of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + + self._contact = contact + + @property + def default(self): + """Gets the default of this TwoFaProviderInfo. # noqa: E501 + + + :return: The default of this TwoFaProviderInfo. # noqa: E501 + :rtype: bool + """ + return self._default + + @default.setter + def default(self, default): + """Sets the default of this TwoFaProviderInfo. + + + :param default: The default of this TwoFaProviderInfo. # noqa: E501 + :type: bool + """ + + self._default = default + + @property + def min_verification_code_send_period(self): + """Gets the min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + + + :return: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :rtype: int + """ + return self._min_verification_code_send_period + + @min_verification_code_send_period.setter + def min_verification_code_send_period(self, min_verification_code_send_period): + """Sets the min_verification_code_send_period of this TwoFaProviderInfo. + + + :param min_verification_code_send_period: The min_verification_code_send_period of this TwoFaProviderInfo. # noqa: E501 + :type: int + """ + + self._min_verification_code_send_period = min_verification_code_send_period + + @property + def type(self): + """Gets the type of this TwoFaProviderInfo. # noqa: E501 + + + :return: The type of this TwoFaProviderInfo. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this TwoFaProviderInfo. + + + :param type: The type of this TwoFaProviderInfo. # noqa: E501 + :type: str + """ + allowed_values = ["BACKUP_CODE", "EMAIL", "SMS", "TOTP"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(TwoFaProviderInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, TwoFaProviderInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/update_message.py b/tb-rest-client/python/tb_rest_client/models/models_pe/update_message.py new file mode 100644 index 0000000..0aad87d --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/update_message.py @@ -0,0 +1,266 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UpdateMessage(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'update_available': 'bool', + 'current_version': 'str', + 'latest_version': 'str', + 'upgrade_instructions_url': 'str', + 'current_version_release_notes_url': 'str', + 'latest_version_release_notes_url': 'str' + } + + attribute_map = { + 'update_available': 'updateAvailable', + 'current_version': 'currentVersion', + 'latest_version': 'latestVersion', + 'upgrade_instructions_url': 'upgradeInstructionsUrl', + 'current_version_release_notes_url': 'currentVersionReleaseNotesUrl', + 'latest_version_release_notes_url': 'latestVersionReleaseNotesUrl' + } + + def __init__(self, update_available=None, current_version=None, latest_version=None, upgrade_instructions_url=None, current_version_release_notes_url=None, latest_version_release_notes_url=None): # noqa: E501 + """UpdateMessage - a model defined in Swagger""" # noqa: E501 + self._update_available = None + self._current_version = None + self._latest_version = None + self._upgrade_instructions_url = None + self._current_version_release_notes_url = None + self._latest_version_release_notes_url = None + self.discriminator = None + if update_available is not None: + self.update_available = update_available + if current_version is not None: + self.current_version = current_version + if latest_version is not None: + self.latest_version = latest_version + if upgrade_instructions_url is not None: + self.upgrade_instructions_url = upgrade_instructions_url + if current_version_release_notes_url is not None: + self.current_version_release_notes_url = current_version_release_notes_url + if latest_version_release_notes_url is not None: + self.latest_version_release_notes_url = latest_version_release_notes_url + + @property + def update_available(self): + """Gets the update_available of this UpdateMessage. # noqa: E501 + + 'True' if new platform update is available. # noqa: E501 + + :return: The update_available of this UpdateMessage. # noqa: E501 + :rtype: bool + """ + return self._update_available + + @update_available.setter + def update_available(self, update_available): + """Sets the update_available of this UpdateMessage. + + 'True' if new platform update is available. # noqa: E501 + + :param update_available: The update_available of this UpdateMessage. # noqa: E501 + :type: bool + """ + + self._update_available = update_available + + @property + def current_version(self): + """Gets the current_version of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version. # noqa: E501 + + :return: The current_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version + + @current_version.setter + def current_version(self, current_version): + """Sets the current_version of this UpdateMessage. + + Current ThingsBoard version. # noqa: E501 + + :param current_version: The current_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version = current_version + + @property + def latest_version(self): + """Gets the latest_version of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version. # noqa: E501 + + :return: The latest_version of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version + + @latest_version.setter + def latest_version(self, latest_version): + """Sets the latest_version of this UpdateMessage. + + Latest ThingsBoard version. # noqa: E501 + + :param latest_version: The latest_version of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version = latest_version + + @property + def upgrade_instructions_url(self): + """Gets the upgrade_instructions_url of this UpdateMessage. # noqa: E501 + + Upgrade instructions URL. # noqa: E501 + + :return: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._upgrade_instructions_url + + @upgrade_instructions_url.setter + def upgrade_instructions_url(self, upgrade_instructions_url): + """Sets the upgrade_instructions_url of this UpdateMessage. + + Upgrade instructions URL. # noqa: E501 + + :param upgrade_instructions_url: The upgrade_instructions_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._upgrade_instructions_url = upgrade_instructions_url + + @property + def current_version_release_notes_url(self): + """Gets the current_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Current ThingsBoard version release notes URL. # noqa: E501 + + :return: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._current_version_release_notes_url + + @current_version_release_notes_url.setter + def current_version_release_notes_url(self, current_version_release_notes_url): + """Sets the current_version_release_notes_url of this UpdateMessage. + + Current ThingsBoard version release notes URL. # noqa: E501 + + :param current_version_release_notes_url: The current_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._current_version_release_notes_url = current_version_release_notes_url + + @property + def latest_version_release_notes_url(self): + """Gets the latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :return: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :rtype: str + """ + return self._latest_version_release_notes_url + + @latest_version_release_notes_url.setter + def latest_version_release_notes_url(self, latest_version_release_notes_url): + """Sets the latest_version_release_notes_url of this UpdateMessage. + + Latest ThingsBoard version release notes URL. # noqa: E501 + + :param latest_version_release_notes_url: The latest_version_release_notes_url of this UpdateMessage. # noqa: E501 + :type: str + """ + + self._latest_version_release_notes_url = latest_version_release_notes_url + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UpdateMessage, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UpdateMessage): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user.py new file mode 100644 index 0000000..03fa28b --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user.py @@ -0,0 +1,429 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class User(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'email': 'str', + 'name': 'str', + 'authority': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'phone': 'str', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'email': 'email', + 'name': 'name', + 'authority': 'authority', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'phone': 'phone', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, email=None, name=None, authority=None, first_name=None, last_name=None, phone=None, additional_info=None, owner_id=None): # noqa: E501 + """User - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._email = None + self._name = None + self._authority = None + self._first_name = None + self._last_name = None + self._phone = None + self._additional_info = None + self._owner_id = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.email = email + if name is not None: + self.name = name + self.authority = authority + self.first_name = first_name + self.last_name = last_name + self.phone = phone + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + + @property + def id(self): + """Gets the id of this User. # noqa: E501 + + + :return: The id of this User. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this User. + + + :param id: The id of this User. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this User. # noqa: E501 + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :return: The created_time of this User. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this User. + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this User. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this User. # noqa: E501 + + + :return: The tenant_id of this User. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this User. + + + :param tenant_id: The tenant_id of this User. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this User. # noqa: E501 + + + :return: The customer_id of this User. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this User. + + + :param customer_id: The customer_id of this User. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def email(self): + """Gets the email of this User. # noqa: E501 + + Email of the user # noqa: E501 + + :return: The email of this User. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this User. + + Email of the user # noqa: E501 + + :param email: The email of this User. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def name(self): + """Gets the name of this User. # noqa: E501 + + Duplicates the email of the user, readonly # noqa: E501 + + :return: The name of this User. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this User. + + Duplicates the email of the user, readonly # noqa: E501 + + :param name: The name of this User. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def authority(self): + """Gets the authority of this User. # noqa: E501 + + Authority # noqa: E501 + + :return: The authority of this User. # noqa: E501 + :rtype: str + """ + return self._authority + + @authority.setter + def authority(self, authority): + """Sets the authority of this User. + + Authority # noqa: E501 + + :param authority: The authority of this User. # noqa: E501 + :type: str + """ + if authority is None: + raise ValueError("Invalid value for `authority`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if authority not in allowed_values: + raise ValueError( + "Invalid value for `authority` ({0}), must be one of {1}" # noqa: E501 + .format(authority, allowed_values) + ) + + self._authority = authority + + @property + def first_name(self): + """Gets the first_name of this User. # noqa: E501 + + First name of the user # noqa: E501 + + :return: The first_name of this User. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this User. + + First name of the user # noqa: E501 + + :param first_name: The first_name of this User. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this User. # noqa: E501 + + Last name of the user # noqa: E501 + + :return: The last_name of this User. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this User. + + Last name of the user # noqa: E501 + + :param last_name: The last_name of this User. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def phone(self): + """Gets the phone of this User. # noqa: E501 + + Phone number of the user # noqa: E501 + + :return: The phone of this User. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this User. + + Phone number of the user # noqa: E501 + + :param phone: The phone of this User. # noqa: E501 + :type: str + """ + # if phone is None: + # raise ValueError("Invalid value for `phone`, must not be `None`") # noqa: E501 + + self._phone = phone + + @property + def additional_info(self): + """Gets the additional_info of this User. # noqa: E501 + + + :return: The additional_info of this User. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this User. + + + :param additional_info: The additional_info of this User. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this User. # noqa: E501 + + + :return: The owner_id of this User. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this User. + + + :param owner_id: The owner_id of this User. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(User, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, User): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_dashboards_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_dashboards_info.py new file mode 100644 index 0000000..7a08fb4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_dashboards_info.py @@ -0,0 +1,154 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserDashboardsInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'last': 'list[LastVisitedDashboardInfo]', + 'starred': 'list[StarredDashboardInfo]' + } + + attribute_map = { + 'last': 'last', + 'starred': 'starred' + } + + def __init__(self, last=None, starred=None): # noqa: E501 + """UserDashboardsInfo - a model defined in Swagger""" # noqa: E501 + self._last = None + self._starred = None + self.discriminator = None + if last is not None: + self.last = last + if starred is not None: + self.starred = starred + + @property + def last(self): + """Gets the last of this UserDashboardsInfo. # noqa: E501 + + List of last visited dashboards. # noqa: E501 + + :return: The last of this UserDashboardsInfo. # noqa: E501 + :rtype: list[LastVisitedDashboardInfo] + """ + return self._last + + @last.setter + def last(self, last): + """Sets the last of this UserDashboardsInfo. + + List of last visited dashboards. # noqa: E501 + + :param last: The last of this UserDashboardsInfo. # noqa: E501 + :type: list[LastVisitedDashboardInfo] + """ + + self._last = last + + @property + def starred(self): + """Gets the starred of this UserDashboardsInfo. # noqa: E501 + + List of starred dashboards. # noqa: E501 + + :return: The starred of this UserDashboardsInfo. # noqa: E501 + :rtype: list[StarredDashboardInfo] + """ + return self._starred + + @starred.setter + def starred(self, starred): + """Sets the starred of this UserDashboardsInfo. + + List of starred dashboards. # noqa: E501 + + :param starred: The starred of this UserDashboardsInfo. # noqa: E501 + :type: list[StarredDashboardInfo] + """ + + self._starred = starred + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserDashboardsInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserDashboardsInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_email_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_email_info.py new file mode 100644 index 0000000..efa2db7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_email_info.py @@ -0,0 +1,208 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserEmailInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'email': 'str', + 'first_name': 'str', + 'last_name': 'str' + } + + attribute_map = { + 'id': 'id', + 'email': 'email', + 'first_name': 'firstName', + 'last_name': 'lastName' + } + + def __init__(self, id=None, email=None, first_name=None, last_name=None): # noqa: E501 + """UserEmailInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._email = None + self._first_name = None + self._last_name = None + self.discriminator = None + if id is not None: + self.id = id + if email is not None: + self.email = email + if first_name is not None: + self.first_name = first_name + if last_name is not None: + self.last_name = last_name + + @property + def id(self): + """Gets the id of this UserEmailInfo. # noqa: E501 + + + :return: The id of this UserEmailInfo. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserEmailInfo. + + + :param id: The id of this UserEmailInfo. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def email(self): + """Gets the email of this UserEmailInfo. # noqa: E501 + + User email # noqa: E501 + + :return: The email of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this UserEmailInfo. + + User email # noqa: E501 + + :param email: The email of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def first_name(self): + """Gets the first_name of this UserEmailInfo. # noqa: E501 + + User first name # noqa: E501 + + :return: The first_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this UserEmailInfo. + + User first name # noqa: E501 + + :param first_name: The first_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this UserEmailInfo. # noqa: E501 + + User last name # noqa: E501 + + :return: The last_name of this UserEmailInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this UserEmailInfo. + + User last name # noqa: E501 + + :param last_name: The last_name of this UserEmailInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserEmailInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserEmailInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_group_list_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_group_list_filter.py new file mode 100644 index 0000000..0ba91dc --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_group_list_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class UserGroupListFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'groups_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'groups_ids': 'groupsIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, groups_ids=None, *args, **kwargs): # noqa: E501 + """UserGroupListFilter - a model defined in Swagger""" # noqa: E501 + self._groups_ids = None + self.discriminator = None + if groups_ids is not None: + self.groups_ids = groups_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def groups_ids(self): + """Gets the groups_ids of this UserGroupListFilter. # noqa: E501 + + + :return: The groups_ids of this UserGroupListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._groups_ids + + @groups_ids.setter + def groups_ids(self, groups_ids): + """Sets the groups_ids of this UserGroupListFilter. + + + :param groups_ids: The groups_ids of this UserGroupListFilter. # noqa: E501 + :type: list[str] + """ + + self._groups_ids = groups_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserGroupListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserGroupListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_id.py new file mode 100644 index 0000000..594add0 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """UserId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this UserId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this UserId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this UserId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this UserId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this UserId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this UserId. + + string # noqa: E501 + + :param entity_type: The entity_type of this UserId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["USER"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_info.py new file mode 100644 index 0000000..840f5f4 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_info.py @@ -0,0 +1,483 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'UserId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'customer_id': 'CustomerId', + 'email': 'str', + 'name': 'str', + 'authority': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'phone': 'str', + 'additional_info': 'JsonNode', + 'owner_id': 'EntityId', + 'owner_name': 'str', + 'groups': 'list[EntityInfo]' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'customer_id': 'customerId', + 'email': 'email', + 'name': 'name', + 'authority': 'authority', + 'first_name': 'firstName', + 'last_name': 'lastName', + 'phone': 'phone', + 'additional_info': 'additionalInfo', + 'owner_id': 'ownerId', + 'owner_name': 'ownerName', + 'groups': 'groups' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, customer_id=None, email=None, name=None, authority=None, first_name=None, last_name=None, phone=None, additional_info=None, owner_id=None, owner_name=None, groups=None): # noqa: E501 + """UserInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._customer_id = None + self._email = None + self._name = None + self._authority = None + self._first_name = None + self._last_name = None + self._phone = None + self._additional_info = None + self._owner_id = None + self._owner_name = None + self._groups = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if customer_id is not None: + self.customer_id = customer_id + self.email = email + if name is not None: + self.name = name + self.authority = authority + self.first_name = first_name + self.last_name = last_name + self.phone = phone + if additional_info is not None: + self.additional_info = additional_info + if owner_id is not None: + self.owner_id = owner_id + if owner_name is not None: + self.owner_name = owner_name + if groups is not None: + self.groups = groups + + @property + def id(self): + """Gets the id of this UserInfo. # noqa: E501 + + + :return: The id of this UserInfo. # noqa: E501 + :rtype: UserId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this UserInfo. + + + :param id: The id of this UserInfo. # noqa: E501 + :type: UserId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this UserInfo. # noqa: E501 + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :return: The created_time of this UserInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this UserInfo. + + Timestamp of the user creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this UserInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this UserInfo. # noqa: E501 + + + :return: The tenant_id of this UserInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this UserInfo. + + + :param tenant_id: The tenant_id of this UserInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def customer_id(self): + """Gets the customer_id of this UserInfo. # noqa: E501 + + + :return: The customer_id of this UserInfo. # noqa: E501 + :rtype: CustomerId + """ + return self._customer_id + + @customer_id.setter + def customer_id(self, customer_id): + """Sets the customer_id of this UserInfo. + + + :param customer_id: The customer_id of this UserInfo. # noqa: E501 + :type: CustomerId + """ + + self._customer_id = customer_id + + @property + def email(self): + """Gets the email of this UserInfo. # noqa: E501 + + Email of the user # noqa: E501 + + :return: The email of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._email + + @email.setter + def email(self, email): + """Sets the email of this UserInfo. + + Email of the user # noqa: E501 + + :param email: The email of this UserInfo. # noqa: E501 + :type: str + """ + + self._email = email + + @property + def name(self): + """Gets the name of this UserInfo. # noqa: E501 + + Duplicates the email of the user, readonly # noqa: E501 + + :return: The name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this UserInfo. + + Duplicates the email of the user, readonly # noqa: E501 + + :param name: The name of this UserInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def authority(self): + """Gets the authority of this UserInfo. # noqa: E501 + + Authority # noqa: E501 + + :return: The authority of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._authority + + @authority.setter + def authority(self, authority): + """Sets the authority of this UserInfo. + + Authority # noqa: E501 + + :param authority: The authority of this UserInfo. # noqa: E501 + :type: str + """ + if authority is None: + raise ValueError("Invalid value for `authority`, must not be `None`") # noqa: E501 + allowed_values = ["CUSTOMER_USER", "PRE_VERIFICATION_TOKEN", "REFRESH_TOKEN", "SYS_ADMIN", "TENANT_ADMIN"] # noqa: E501 + if authority not in allowed_values: + raise ValueError( + "Invalid value for `authority` ({0}), must be one of {1}" # noqa: E501 + .format(authority, allowed_values) + ) + + self._authority = authority + + @property + def first_name(self): + """Gets the first_name of this UserInfo. # noqa: E501 + + First name of the user # noqa: E501 + + :return: The first_name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._first_name + + @first_name.setter + def first_name(self, first_name): + """Sets the first_name of this UserInfo. + + First name of the user # noqa: E501 + + :param first_name: The first_name of this UserInfo. # noqa: E501 + :type: str + """ + + self._first_name = first_name + + @property + def last_name(self): + """Gets the last_name of this UserInfo. # noqa: E501 + + Last name of the user # noqa: E501 + + :return: The last_name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._last_name + + @last_name.setter + def last_name(self, last_name): + """Sets the last_name of this UserInfo. + + Last name of the user # noqa: E501 + + :param last_name: The last_name of this UserInfo. # noqa: E501 + :type: str + """ + + self._last_name = last_name + + @property + def phone(self): + """Gets the phone of this UserInfo. # noqa: E501 + + Phone number of the user # noqa: E501 + + :return: The phone of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._phone + + @phone.setter + def phone(self, phone): + """Sets the phone of this UserInfo. + + Phone number of the user # noqa: E501 + + :param phone: The phone of this UserInfo. # noqa: E501 + :type: str + """ + + self._phone = phone + + @property + def additional_info(self): + """Gets the additional_info of this UserInfo. # noqa: E501 + + + :return: The additional_info of this UserInfo. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_info + + @additional_info.setter + def additional_info(self, additional_info): + """Sets the additional_info of this UserInfo. + + + :param additional_info: The additional_info of this UserInfo. # noqa: E501 + :type: JsonNode + """ + + self._additional_info = additional_info + + @property + def owner_id(self): + """Gets the owner_id of this UserInfo. # noqa: E501 + + + :return: The owner_id of this UserInfo. # noqa: E501 + :rtype: EntityId + """ + return self._owner_id + + @owner_id.setter + def owner_id(self, owner_id): + """Sets the owner_id of this UserInfo. + + + :param owner_id: The owner_id of this UserInfo. # noqa: E501 + :type: EntityId + """ + + self._owner_id = owner_id + + @property + def owner_name(self): + """Gets the owner_name of this UserInfo. # noqa: E501 + + Owner name # noqa: E501 + + :return: The owner_name of this UserInfo. # noqa: E501 + :rtype: str + """ + return self._owner_name + + @owner_name.setter + def owner_name(self, owner_name): + """Sets the owner_name of this UserInfo. + + Owner name # noqa: E501 + + :param owner_name: The owner_name of this UserInfo. # noqa: E501 + :type: str + """ + + self._owner_name = owner_name + + @property + def groups(self): + """Gets the groups of this UserInfo. # noqa: E501 + + Groups # noqa: E501 + + :return: The groups of this UserInfo. # noqa: E501 + :rtype: list[EntityInfo] + """ + return self._groups + + @groups.setter + def groups(self, groups): + """Sets the groups of this UserInfo. + + Groups # noqa: E501 + + :param groups: The groups of this UserInfo. # noqa: E501 + :type: list[EntityInfo] + """ + + self._groups = groups + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_list_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_list_filter.py new file mode 100644 index 0000000..74207f9 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_list_filter.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserListFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'users_ids': 'list[str]' + } + + attribute_map = { + 'users_ids': 'usersIds' + } + + def __init__(self, users_ids=None): # noqa: E501 + """UserListFilter - a model defined in Swagger""" # noqa: E501 + self._users_ids = None + self.discriminator = None + if users_ids is not None: + self.users_ids = users_ids + + @property + def users_ids(self): + """Gets the users_ids of this UserListFilter. # noqa: E501 + + + :return: The users_ids of this UserListFilter. # noqa: E501 + :rtype: list[str] + """ + return self._users_ids + + @users_ids.setter + def users_ids(self, users_ids): + """Sets the users_ids of this UserListFilter. + + + :param users_ids: The users_ids of this UserListFilter. # noqa: E501 + :type: list[str] + """ + + self._users_ids = users_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserListFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserListFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_password_policy.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_password_policy.py new file mode 100644 index 0000000..6558c6c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_password_policy.py @@ -0,0 +1,322 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UserPasswordPolicy(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_whitespaces': 'bool', + 'minimum_digits': 'int', + 'minimum_length': 'int', + 'minimum_lowercase_letters': 'int', + 'minimum_special_characters': 'int', + 'minimum_uppercase_letters': 'int', + 'password_expiration_period_days': 'int', + 'password_reuse_frequency_days': 'int' + } + + attribute_map = { + 'allow_whitespaces': 'allowWhitespaces', + 'minimum_digits': 'minimumDigits', + 'minimum_length': 'minimumLength', + 'minimum_lowercase_letters': 'minimumLowercaseLetters', + 'minimum_special_characters': 'minimumSpecialCharacters', + 'minimum_uppercase_letters': 'minimumUppercaseLetters', + 'password_expiration_period_days': 'passwordExpirationPeriodDays', + 'password_reuse_frequency_days': 'passwordReuseFrequencyDays' + } + + def __init__(self, allow_whitespaces=None, minimum_digits=None, minimum_length=None, minimum_lowercase_letters=None, minimum_special_characters=None, minimum_uppercase_letters=None, password_expiration_period_days=None, password_reuse_frequency_days=None): # noqa: E501 + """UserPasswordPolicy - a model defined in Swagger""" # noqa: E501 + self._allow_whitespaces = None + self._minimum_digits = None + self._minimum_length = None + self._minimum_lowercase_letters = None + self._minimum_special_characters = None + self._minimum_uppercase_letters = None + self._password_expiration_period_days = None + self._password_reuse_frequency_days = None + self.discriminator = None + if allow_whitespaces is not None: + self.allow_whitespaces = allow_whitespaces + if minimum_digits is not None: + self.minimum_digits = minimum_digits + if minimum_length is not None: + self.minimum_length = minimum_length + if minimum_lowercase_letters is not None: + self.minimum_lowercase_letters = minimum_lowercase_letters + if minimum_special_characters is not None: + self.minimum_special_characters = minimum_special_characters + if minimum_uppercase_letters is not None: + self.minimum_uppercase_letters = minimum_uppercase_letters + if password_expiration_period_days is not None: + self.password_expiration_period_days = password_expiration_period_days + if password_reuse_frequency_days is not None: + self.password_reuse_frequency_days = password_reuse_frequency_days + + @property + def allow_whitespaces(self): + """Gets the allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + + Allow whitespaces # noqa: E501 + + :return: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :rtype: bool + """ + return self._allow_whitespaces + + @allow_whitespaces.setter + def allow_whitespaces(self, allow_whitespaces): + """Sets the allow_whitespaces of this UserPasswordPolicy. + + Allow whitespaces # noqa: E501 + + :param allow_whitespaces: The allow_whitespaces of this UserPasswordPolicy. # noqa: E501 + :type: bool + """ + + self._allow_whitespaces = allow_whitespaces + + @property + def minimum_digits(self): + """Gets the minimum_digits of this UserPasswordPolicy. # noqa: E501 + + Minimum number of digits in the password. # noqa: E501 + + :return: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_digits + + @minimum_digits.setter + def minimum_digits(self, minimum_digits): + """Sets the minimum_digits of this UserPasswordPolicy. + + Minimum number of digits in the password. # noqa: E501 + + :param minimum_digits: The minimum_digits of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_digits = minimum_digits + + @property + def minimum_length(self): + """Gets the minimum_length of this UserPasswordPolicy. # noqa: E501 + + Minimum number of symbols in the password. # noqa: E501 + + :return: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_length + + @minimum_length.setter + def minimum_length(self, minimum_length): + """Sets the minimum_length of this UserPasswordPolicy. + + Minimum number of symbols in the password. # noqa: E501 + + :param minimum_length: The minimum_length of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_length = minimum_length + + @property + def minimum_lowercase_letters(self): + """Gets the minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of lowercase letters in the password. # noqa: E501 + + :return: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_lowercase_letters + + @minimum_lowercase_letters.setter + def minimum_lowercase_letters(self, minimum_lowercase_letters): + """Sets the minimum_lowercase_letters of this UserPasswordPolicy. + + Minimum number of lowercase letters in the password. # noqa: E501 + + :param minimum_lowercase_letters: The minimum_lowercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_lowercase_letters = minimum_lowercase_letters + + @property + def minimum_special_characters(self): + """Gets the minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of special in the password. # noqa: E501 + + :return: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_special_characters + + @minimum_special_characters.setter + def minimum_special_characters(self, minimum_special_characters): + """Sets the minimum_special_characters of this UserPasswordPolicy. + + Minimum number of special in the password. # noqa: E501 + + :param minimum_special_characters: The minimum_special_characters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_special_characters = minimum_special_characters + + @property + def minimum_uppercase_letters(self): + """Gets the minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + + Minimum number of uppercase letters in the password. # noqa: E501 + + :return: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._minimum_uppercase_letters + + @minimum_uppercase_letters.setter + def minimum_uppercase_letters(self, minimum_uppercase_letters): + """Sets the minimum_uppercase_letters of this UserPasswordPolicy. + + Minimum number of uppercase letters in the password. # noqa: E501 + + :param minimum_uppercase_letters: The minimum_uppercase_letters of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._minimum_uppercase_letters = minimum_uppercase_letters + + @property + def password_expiration_period_days(self): + """Gets the password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :return: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_expiration_period_days + + @password_expiration_period_days.setter + def password_expiration_period_days(self, password_expiration_period_days): + """Sets the password_expiration_period_days of this UserPasswordPolicy. + + Password expiration period (days). Force expiration of the password. # noqa: E501 + + :param password_expiration_period_days: The password_expiration_period_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_expiration_period_days = password_expiration_period_days + + @property + def password_reuse_frequency_days(self): + """Gets the password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :return: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :rtype: int + """ + return self._password_reuse_frequency_days + + @password_reuse_frequency_days.setter + def password_reuse_frequency_days(self, password_reuse_frequency_days): + """Sets the password_reuse_frequency_days of this UserPasswordPolicy. + + Password reuse frequency (days). Disallow to use the same password for the defined number of days # noqa: E501 + + :param password_reuse_frequency_days: The password_reuse_frequency_days of this UserPasswordPolicy. # noqa: E501 + :type: int + """ + + self._password_reuse_frequency_days = password_reuse_frequency_days + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserPasswordPolicy, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserPasswordPolicy): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/user_role_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/user_role_filter.py new file mode 100644 index 0000000..2630604 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/user_role_filter.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.users_filter import UsersFilter # noqa: F401,E501 + +class UserRoleFilter(UsersFilter): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'roles_ids': 'list[str]' + } + if hasattr(UsersFilter, "swagger_types"): + swagger_types.update(UsersFilter.swagger_types) + + attribute_map = { + 'roles_ids': 'rolesIds' + } + if hasattr(UsersFilter, "attribute_map"): + attribute_map.update(UsersFilter.attribute_map) + + def __init__(self, roles_ids=None, *args, **kwargs): # noqa: E501 + """UserRoleFilter - a model defined in Swagger""" # noqa: E501 + self._roles_ids = None + self.discriminator = None + if roles_ids is not None: + self.roles_ids = roles_ids + UsersFilter.__init__(self, *args, **kwargs) + + @property + def roles_ids(self): + """Gets the roles_ids of this UserRoleFilter. # noqa: E501 + + + :return: The roles_ids of this UserRoleFilter. # noqa: E501 + :rtype: list[str] + """ + return self._roles_ids + + @roles_ids.setter + def roles_ids(self, roles_ids): + """Sets the roles_ids of this UserRoleFilter. + + + :param roles_ids: The roles_ids of this UserRoleFilter. # noqa: E501 + :type: list[str] + """ + + self._roles_ids = roles_ids + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UserRoleFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UserRoleFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/users_filter.py b/tb-rest-client/python/tb_rest_client/models/models_pe/users_filter.py new file mode 100644 index 0000000..ad1e5c8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/users_filter.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class UsersFilter(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """UsersFilter - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(UsersFilter, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, UsersFilter): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/version_create_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/version_create_config.py new file mode 100644 index 0000000..d04fa00 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/version_create_config.py @@ -0,0 +1,228 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'save_attributes': 'bool', + 'save_credentials': 'bool', + 'save_group_entities': 'bool', + 'save_permissions': 'bool', + 'save_relations': 'bool' + } + + attribute_map = { + 'save_attributes': 'saveAttributes', + 'save_credentials': 'saveCredentials', + 'save_group_entities': 'saveGroupEntities', + 'save_permissions': 'savePermissions', + 'save_relations': 'saveRelations' + } + + def __init__(self, save_attributes=None, save_credentials=None, save_group_entities=None, save_permissions=None, save_relations=None): # noqa: E501 + """VersionCreateConfig - a model defined in Swagger""" # noqa: E501 + self._save_attributes = None + self._save_credentials = None + self._save_group_entities = None + self._save_permissions = None + self._save_relations = None + self.discriminator = None + if save_attributes is not None: + self.save_attributes = save_attributes + if save_credentials is not None: + self.save_credentials = save_credentials + if save_group_entities is not None: + self.save_group_entities = save_group_entities + if save_permissions is not None: + self.save_permissions = save_permissions + if save_relations is not None: + self.save_relations = save_relations + + @property + def save_attributes(self): + """Gets the save_attributes of this VersionCreateConfig. # noqa: E501 + + + :return: The save_attributes of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_attributes + + @save_attributes.setter + def save_attributes(self, save_attributes): + """Sets the save_attributes of this VersionCreateConfig. + + + :param save_attributes: The save_attributes of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_attributes = save_attributes + + @property + def save_credentials(self): + """Gets the save_credentials of this VersionCreateConfig. # noqa: E501 + + + :return: The save_credentials of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_credentials + + @save_credentials.setter + def save_credentials(self, save_credentials): + """Sets the save_credentials of this VersionCreateConfig. + + + :param save_credentials: The save_credentials of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_credentials = save_credentials + + @property + def save_group_entities(self): + """Gets the save_group_entities of this VersionCreateConfig. # noqa: E501 + + + :return: The save_group_entities of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_group_entities + + @save_group_entities.setter + def save_group_entities(self, save_group_entities): + """Sets the save_group_entities of this VersionCreateConfig. + + + :param save_group_entities: The save_group_entities of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_group_entities = save_group_entities + + @property + def save_permissions(self): + """Gets the save_permissions of this VersionCreateConfig. # noqa: E501 + + + :return: The save_permissions of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_permissions + + @save_permissions.setter + def save_permissions(self, save_permissions): + """Sets the save_permissions of this VersionCreateConfig. + + + :param save_permissions: The save_permissions of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_permissions = save_permissions + + @property + def save_relations(self): + """Gets the save_relations of this VersionCreateConfig. # noqa: E501 + + + :return: The save_relations of this VersionCreateConfig. # noqa: E501 + :rtype: bool + """ + return self._save_relations + + @save_relations.setter + def save_relations(self, save_relations): + """Sets the save_relations of this VersionCreateConfig. + + + :param save_relations: The save_relations of this VersionCreateConfig. # noqa: E501 + :type: bool + """ + + self._save_relations = save_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/version_create_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/version_create_request.py new file mode 100644 index 0000000..c321158 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/version_create_request.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreateRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'branch': 'str', + 'type': 'str', + 'version_name': 'str' + } + + attribute_map = { + 'branch': 'branch', + 'type': 'type', + 'version_name': 'versionName' + } + + def __init__(self, branch=None, type=None, version_name=None): # noqa: E501 + """VersionCreateRequest - a model defined in Swagger""" # noqa: E501 + self._branch = None + self._type = None + self._version_name = None + self.discriminator = None + if branch is not None: + self.branch = branch + if type is not None: + self.type = type + if version_name is not None: + self.version_name = version_name + + @property + def branch(self): + """Gets the branch of this VersionCreateRequest. # noqa: E501 + + + :return: The branch of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._branch + + @branch.setter + def branch(self, branch): + """Sets the branch of this VersionCreateRequest. + + + :param branch: The branch of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._branch = branch + + @property + def type(self): + """Gets the type of this VersionCreateRequest. # noqa: E501 + + + :return: The type of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionCreateRequest. + + + :param type: The type of this VersionCreateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["COMPLEX", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_name(self): + """Gets the version_name of this VersionCreateRequest. # noqa: E501 + + + :return: The version_name of this VersionCreateRequest. # noqa: E501 + :rtype: str + """ + return self._version_name + + @version_name.setter + def version_name(self, version_name): + """Sets the version_name of this VersionCreateRequest. + + + :param version_name: The version_name of this VersionCreateRequest. # noqa: E501 + :type: str + """ + + self._version_name = version_name + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreateRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreateRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/version_creation_result.py b/tb-rest-client/python/tb_rest_client/models/models_pe/version_creation_result.py new file mode 100644 index 0000000..20df78f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/version_creation_result.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionCreationResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'added': 'int', + 'done': 'bool', + 'error': 'str', + 'modified': 'int', + 'removed': 'int', + 'version': 'EntityVersion' + } + + attribute_map = { + 'added': 'added', + 'done': 'done', + 'error': 'error', + 'modified': 'modified', + 'removed': 'removed', + 'version': 'version' + } + + def __init__(self, added=None, done=None, error=None, modified=None, removed=None, version=None): # noqa: E501 + """VersionCreationResult - a model defined in Swagger""" # noqa: E501 + self._added = None + self._done = None + self._error = None + self._modified = None + self._removed = None + self._version = None + self.discriminator = None + if added is not None: + self.added = added + if done is not None: + self.done = done + if error is not None: + self.error = error + if modified is not None: + self.modified = modified + if removed is not None: + self.removed = removed + if version is not None: + self.version = version + + @property + def added(self): + """Gets the added of this VersionCreationResult. # noqa: E501 + + + :return: The added of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._added + + @added.setter + def added(self, added): + """Sets the added of this VersionCreationResult. + + + :param added: The added of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._added = added + + @property + def done(self): + """Gets the done of this VersionCreationResult. # noqa: E501 + + + :return: The done of this VersionCreationResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionCreationResult. + + + :param done: The done of this VersionCreationResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionCreationResult. # noqa: E501 + + + :return: The error of this VersionCreationResult. # noqa: E501 + :rtype: str + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionCreationResult. + + + :param error: The error of this VersionCreationResult. # noqa: E501 + :type: str + """ + + self._error = error + + @property + def modified(self): + """Gets the modified of this VersionCreationResult. # noqa: E501 + + + :return: The modified of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._modified + + @modified.setter + def modified(self, modified): + """Sets the modified of this VersionCreationResult. + + + :param modified: The modified of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._modified = modified + + @property + def removed(self): + """Gets the removed of this VersionCreationResult. # noqa: E501 + + + :return: The removed of this VersionCreationResult. # noqa: E501 + :rtype: int + """ + return self._removed + + @removed.setter + def removed(self, removed): + """Sets the removed of this VersionCreationResult. + + + :param removed: The removed of this VersionCreationResult. # noqa: E501 + :type: int + """ + + self._removed = removed + + @property + def version(self): + """Gets the version of this VersionCreationResult. # noqa: E501 + + + :return: The version of this VersionCreationResult. # noqa: E501 + :rtype: EntityVersion + """ + return self._version + + @version.setter + def version(self, version): + """Sets the version of this VersionCreationResult. + + + :param version: The version of this VersionCreationResult. # noqa: E501 + :type: EntityVersion + """ + + self._version = version + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionCreationResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionCreationResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_config.py b/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_config.py new file mode 100644 index 0000000..fb0529f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_config.py @@ -0,0 +1,254 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadConfig(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'auto_generate_integration_key': 'bool', + 'load_attributes': 'bool', + 'load_credentials': 'bool', + 'load_group_entities': 'bool', + 'load_permissions': 'bool', + 'load_relations': 'bool' + } + + attribute_map = { + 'auto_generate_integration_key': 'autoGenerateIntegrationKey', + 'load_attributes': 'loadAttributes', + 'load_credentials': 'loadCredentials', + 'load_group_entities': 'loadGroupEntities', + 'load_permissions': 'loadPermissions', + 'load_relations': 'loadRelations' + } + + def __init__(self, auto_generate_integration_key=None, load_attributes=None, load_credentials=None, load_group_entities=None, load_permissions=None, load_relations=None): # noqa: E501 + """VersionLoadConfig - a model defined in Swagger""" # noqa: E501 + self._auto_generate_integration_key = None + self._load_attributes = None + self._load_credentials = None + self._load_group_entities = None + self._load_permissions = None + self._load_relations = None + self.discriminator = None + if auto_generate_integration_key is not None: + self.auto_generate_integration_key = auto_generate_integration_key + if load_attributes is not None: + self.load_attributes = load_attributes + if load_credentials is not None: + self.load_credentials = load_credentials + if load_group_entities is not None: + self.load_group_entities = load_group_entities + if load_permissions is not None: + self.load_permissions = load_permissions + if load_relations is not None: + self.load_relations = load_relations + + @property + def auto_generate_integration_key(self): + """Gets the auto_generate_integration_key of this VersionLoadConfig. # noqa: E501 + + + :return: The auto_generate_integration_key of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._auto_generate_integration_key + + @auto_generate_integration_key.setter + def auto_generate_integration_key(self, auto_generate_integration_key): + """Sets the auto_generate_integration_key of this VersionLoadConfig. + + + :param auto_generate_integration_key: The auto_generate_integration_key of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._auto_generate_integration_key = auto_generate_integration_key + + @property + def load_attributes(self): + """Gets the load_attributes of this VersionLoadConfig. # noqa: E501 + + + :return: The load_attributes of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_attributes + + @load_attributes.setter + def load_attributes(self, load_attributes): + """Sets the load_attributes of this VersionLoadConfig. + + + :param load_attributes: The load_attributes of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_attributes = load_attributes + + @property + def load_credentials(self): + """Gets the load_credentials of this VersionLoadConfig. # noqa: E501 + + + :return: The load_credentials of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_credentials + + @load_credentials.setter + def load_credentials(self, load_credentials): + """Sets the load_credentials of this VersionLoadConfig. + + + :param load_credentials: The load_credentials of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_credentials = load_credentials + + @property + def load_group_entities(self): + """Gets the load_group_entities of this VersionLoadConfig. # noqa: E501 + + + :return: The load_group_entities of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_group_entities + + @load_group_entities.setter + def load_group_entities(self, load_group_entities): + """Sets the load_group_entities of this VersionLoadConfig. + + + :param load_group_entities: The load_group_entities of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_group_entities = load_group_entities + + @property + def load_permissions(self): + """Gets the load_permissions of this VersionLoadConfig. # noqa: E501 + + + :return: The load_permissions of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_permissions + + @load_permissions.setter + def load_permissions(self, load_permissions): + """Sets the load_permissions of this VersionLoadConfig. + + + :param load_permissions: The load_permissions of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_permissions = load_permissions + + @property + def load_relations(self): + """Gets the load_relations of this VersionLoadConfig. # noqa: E501 + + + :return: The load_relations of this VersionLoadConfig. # noqa: E501 + :rtype: bool + """ + return self._load_relations + + @load_relations.setter + def load_relations(self, load_relations): + """Sets the load_relations of this VersionLoadConfig. + + + :param load_relations: The load_relations of this VersionLoadConfig. # noqa: E501 + :type: bool + """ + + self._load_relations = load_relations + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadConfig, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadConfig): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_request.py b/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_request.py new file mode 100644 index 0000000..a1239b2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_request.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadRequest(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'type': 'str', + 'version_id': 'str' + } + + attribute_map = { + 'type': 'type', + 'version_id': 'versionId' + } + + def __init__(self, type=None, version_id=None): # noqa: E501 + """VersionLoadRequest - a model defined in Swagger""" # noqa: E501 + self._type = None + self._version_id = None + self.discriminator = None + if type is not None: + self.type = type + if version_id is not None: + self.version_id = version_id + + @property + def type(self): + """Gets the type of this VersionLoadRequest. # noqa: E501 + + + :return: The type of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this VersionLoadRequest. + + + :param type: The type of this VersionLoadRequest. # noqa: E501 + :type: str + """ + allowed_values = ["ENTITY_TYPE", "SINGLE_ENTITY"] # noqa: E501 + if type not in allowed_values: + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def version_id(self): + """Gets the version_id of this VersionLoadRequest. # noqa: E501 + + + :return: The version_id of this VersionLoadRequest. # noqa: E501 + :rtype: str + """ + return self._version_id + + @version_id.setter + def version_id(self, version_id): + """Sets the version_id of this VersionLoadRequest. + + + :param version_id: The version_id of this VersionLoadRequest. # noqa: E501 + :type: str + """ + + self._version_id = version_id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadRequest, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadRequest): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_result.py b/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_result.py new file mode 100644 index 0000000..f21fdc2 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/version_load_result.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionLoadResult(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'done': 'bool', + 'error': 'EntityLoadError', + 'result': 'list[EntityTypeLoadResult]' + } + + attribute_map = { + 'done': 'done', + 'error': 'error', + 'result': 'result' + } + + def __init__(self, done=None, error=None, result=None): # noqa: E501 + """VersionLoadResult - a model defined in Swagger""" # noqa: E501 + self._done = None + self._error = None + self._result = None + self.discriminator = None + if done is not None: + self.done = done + if error is not None: + self.error = error + if result is not None: + self.result = result + + @property + def done(self): + """Gets the done of this VersionLoadResult. # noqa: E501 + + + :return: The done of this VersionLoadResult. # noqa: E501 + :rtype: bool + """ + return self._done + + @done.setter + def done(self, done): + """Sets the done of this VersionLoadResult. + + + :param done: The done of this VersionLoadResult. # noqa: E501 + :type: bool + """ + + self._done = done + + @property + def error(self): + """Gets the error of this VersionLoadResult. # noqa: E501 + + + :return: The error of this VersionLoadResult. # noqa: E501 + :rtype: EntityLoadError + """ + return self._error + + @error.setter + def error(self, error): + """Sets the error of this VersionLoadResult. + + + :param error: The error of this VersionLoadResult. # noqa: E501 + :type: EntityLoadError + """ + + self._error = error + + @property + def result(self): + """Gets the result of this VersionLoadResult. # noqa: E501 + + + :return: The result of this VersionLoadResult. # noqa: E501 + :rtype: list[EntityTypeLoadResult] + """ + return self._result + + @result.setter + def result(self, result): + """Sets the result of this VersionLoadResult. + + + :param result: The result of this VersionLoadResult. # noqa: E501 + :type: list[EntityTypeLoadResult] + """ + + self._result = result + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionLoadResult, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionLoadResult): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/versioned_entity_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/versioned_entity_info.py new file mode 100644 index 0000000..7ef8251 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/versioned_entity_info.py @@ -0,0 +1,150 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class VersionedEntityInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'external_id': 'EntityId', + 'path': 'str' + } + + attribute_map = { + 'external_id': 'externalId', + 'path': 'path' + } + + def __init__(self, external_id=None, path=None): # noqa: E501 + """VersionedEntityInfo - a model defined in Swagger""" # noqa: E501 + self._external_id = None + self._path = None + self.discriminator = None + if external_id is not None: + self.external_id = external_id + if path is not None: + self.path = path + + @property + def external_id(self): + """Gets the external_id of this VersionedEntityInfo. # noqa: E501 + + + :return: The external_id of this VersionedEntityInfo. # noqa: E501 + :rtype: EntityId + """ + return self._external_id + + @external_id.setter + def external_id(self, external_id): + """Sets the external_id of this VersionedEntityInfo. + + + :param external_id: The external_id of this VersionedEntityInfo. # noqa: E501 + :type: EntityId + """ + + self._external_id = external_id + + @property + def path(self): + """Gets the path of this VersionedEntityInfo. # noqa: E501 + + + :return: The path of this VersionedEntityInfo. # noqa: E501 + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """Sets the path of this VersionedEntityInfo. + + + :param path: The path of this VersionedEntityInfo. # noqa: E501 + :type: str + """ + + self._path = path + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(VersionedEntityInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, VersionedEntityInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/web_delivery_method_notification_template.py b/tb-rest-client/python/tb_rest_client/models/models_pe/web_delivery_method_notification_template.py new file mode 100644 index 0000000..6e40782 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/web_delivery_method_notification_template.py @@ -0,0 +1,202 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WebDeliveryMethodNotificationTemplate(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'additional_config': 'JsonNode', + 'body': 'str', + 'enabled': 'bool', + 'subject': 'str' + } + + attribute_map = { + 'additional_config': 'additionalConfig', + 'body': 'body', + 'enabled': 'enabled', + 'subject': 'subject' + } + + def __init__(self, additional_config=None, body=None, enabled=None, subject=None): # noqa: E501 + """WebDeliveryMethodNotificationTemplate - a model defined in Swagger""" # noqa: E501 + self._additional_config = None + self._body = None + self._enabled = None + self._subject = None + self.discriminator = None + if additional_config is not None: + self.additional_config = additional_config + if body is not None: + self.body = body + if enabled is not None: + self.enabled = enabled + if subject is not None: + self.subject = subject + + @property + def additional_config(self): + """Gets the additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: JsonNode + """ + return self._additional_config + + @additional_config.setter + def additional_config(self, additional_config): + """Sets the additional_config of this WebDeliveryMethodNotificationTemplate. + + + :param additional_config: The additional_config of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: JsonNode + """ + + self._additional_config = additional_config + + @property + def body(self): + """Gets the body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._body + + @body.setter + def body(self, body): + """Sets the body of this WebDeliveryMethodNotificationTemplate. + + + :param body: The body of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._body = body + + @property + def enabled(self): + """Gets the enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: bool + """ + return self._enabled + + @enabled.setter + def enabled(self, enabled): + """Sets the enabled of this WebDeliveryMethodNotificationTemplate. + + + :param enabled: The enabled of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: bool + """ + + self._enabled = enabled + + @property + def subject(self): + """Gets the subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + + + :return: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :rtype: str + """ + return self._subject + + @subject.setter + def subject(self, subject): + """Sets the subject of this WebDeliveryMethodNotificationTemplate. + + + :param subject: The subject of this WebDeliveryMethodNotificationTemplate. # noqa: E501 + :type: str + """ + + self._subject = subject + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WebDeliveryMethodNotificationTemplate, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WebDeliveryMethodNotificationTemplate): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/white_labeling_params.py b/tb-rest-client/python/tb_rest_client/models/models_pe/white_labeling_params.py new file mode 100644 index 0000000..8cc0c21 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/white_labeling_params.py @@ -0,0 +1,514 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WhiteLabelingParams(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'logo_image_url': 'str', + 'logo_image_checksum': 'str', + 'logo_image_height': 'int', + 'app_title': 'str', + 'favicon': 'Favicon', + 'favicon_checksum': 'str', + 'palette_settings': 'PaletteSettings', + 'help_link_base_url': 'str', + 'ui_help_base_url': 'str', + 'enable_help_links': 'bool', + 'white_labeling_enabled': 'bool', + 'show_name_version': 'bool', + 'platform_name': 'str', + 'platform_version': 'str', + 'custom_css': 'str' + } + + attribute_map = { + 'logo_image_url': 'logoImageUrl', + 'logo_image_checksum': 'logoImageChecksum', + 'logo_image_height': 'logoImageHeight', + 'app_title': 'appTitle', + 'favicon': 'favicon', + 'favicon_checksum': 'faviconChecksum', + 'palette_settings': 'paletteSettings', + 'help_link_base_url': 'helpLinkBaseUrl', + 'ui_help_base_url': 'uiHelpBaseUrl', + 'enable_help_links': 'enableHelpLinks', + 'white_labeling_enabled': 'whiteLabelingEnabled', + 'show_name_version': 'showNameVersion', + 'platform_name': 'platformName', + 'platform_version': 'platformVersion', + 'custom_css': 'customCss' + } + + def __init__(self, logo_image_url=None, logo_image_checksum=None, logo_image_height=None, app_title=None, favicon=None, favicon_checksum=None, palette_settings=None, help_link_base_url=None, ui_help_base_url=None, enable_help_links=None, white_labeling_enabled=None, show_name_version=None, platform_name=None, platform_version=None, custom_css=None): # noqa: E501 + """WhiteLabelingParams - a model defined in Swagger""" # noqa: E501 + self._logo_image_url = None + self._logo_image_checksum = None + self._logo_image_height = None + self._app_title = None + self._favicon = None + self._favicon_checksum = None + self._palette_settings = None + self._help_link_base_url = None + self._ui_help_base_url = None + self._enable_help_links = None + self._white_labeling_enabled = None + self._show_name_version = None + self._platform_name = None + self._platform_version = None + self._custom_css = None + self.discriminator = None + if logo_image_url is not None: + self.logo_image_url = logo_image_url + if logo_image_checksum is not None: + self.logo_image_checksum = logo_image_checksum + if logo_image_height is not None: + self.logo_image_height = logo_image_height + if app_title is not None: + self.app_title = app_title + if favicon is not None: + self.favicon = favicon + if favicon_checksum is not None: + self.favicon_checksum = favicon_checksum + if palette_settings is not None: + self.palette_settings = palette_settings + if help_link_base_url is not None: + self.help_link_base_url = help_link_base_url + if ui_help_base_url is not None: + self.ui_help_base_url = ui_help_base_url + if enable_help_links is not None: + self.enable_help_links = enable_help_links + if white_labeling_enabled is not None: + self.white_labeling_enabled = white_labeling_enabled + if show_name_version is not None: + self.show_name_version = show_name_version + if platform_name is not None: + self.platform_name = platform_name + if platform_version is not None: + self.platform_version = platform_version + if custom_css is not None: + self.custom_css = custom_css + + @property + def logo_image_url(self): + """Gets the logo_image_url of this WhiteLabelingParams. # noqa: E501 + + Logo image URL # noqa: E501 + + :return: The logo_image_url of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_url + + @logo_image_url.setter + def logo_image_url(self, logo_image_url): + """Sets the logo_image_url of this WhiteLabelingParams. + + Logo image URL # noqa: E501 + + :param logo_image_url: The logo_image_url of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_url = logo_image_url + + @property + def logo_image_checksum(self): + """Gets the logo_image_checksum of this WhiteLabelingParams. # noqa: E501 + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :return: The logo_image_checksum of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._logo_image_checksum + + @logo_image_checksum.setter + def logo_image_checksum(self, logo_image_checksum): + """Sets the logo_image_checksum of this WhiteLabelingParams. + + Logo image checksum. Used to detect the changes of the logo image. # noqa: E501 + + :param logo_image_checksum: The logo_image_checksum of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._logo_image_checksum = logo_image_checksum + + @property + def logo_image_height(self): + """Gets the logo_image_height of this WhiteLabelingParams. # noqa: E501 + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :return: The logo_image_height of this WhiteLabelingParams. # noqa: E501 + :rtype: int + """ + return self._logo_image_height + + @logo_image_height.setter + def logo_image_height(self, logo_image_height): + """Sets the logo_image_height of this WhiteLabelingParams. + + The height of a logo container. Logo image will be automatically scaled. # noqa: E501 + + :param logo_image_height: The logo_image_height of this WhiteLabelingParams. # noqa: E501 + :type: int + """ + + self._logo_image_height = logo_image_height + + @property + def app_title(self): + """Gets the app_title of this WhiteLabelingParams. # noqa: E501 + + White-labeled name of the platform # noqa: E501 + + :return: The app_title of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._app_title + + @app_title.setter + def app_title(self, app_title): + """Sets the app_title of this WhiteLabelingParams. + + White-labeled name of the platform # noqa: E501 + + :param app_title: The app_title of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._app_title = app_title + + @property + def favicon(self): + """Gets the favicon of this WhiteLabelingParams. # noqa: E501 + + + :return: The favicon of this WhiteLabelingParams. # noqa: E501 + :rtype: Favicon + """ + return self._favicon + + @favicon.setter + def favicon(self, favicon): + """Sets the favicon of this WhiteLabelingParams. + + + :param favicon: The favicon of this WhiteLabelingParams. # noqa: E501 + :type: Favicon + """ + + self._favicon = favicon + + @property + def favicon_checksum(self): + """Gets the favicon_checksum of this WhiteLabelingParams. # noqa: E501 + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :return: The favicon_checksum of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._favicon_checksum + + @favicon_checksum.setter + def favicon_checksum(self, favicon_checksum): + """Sets the favicon_checksum of this WhiteLabelingParams. + + Favicon image checksum. Used to detect the changes of the website icon # noqa: E501 + + :param favicon_checksum: The favicon_checksum of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._favicon_checksum = favicon_checksum + + @property + def palette_settings(self): + """Gets the palette_settings of this WhiteLabelingParams. # noqa: E501 + + + :return: The palette_settings of this WhiteLabelingParams. # noqa: E501 + :rtype: PaletteSettings + """ + return self._palette_settings + + @palette_settings.setter + def palette_settings(self, palette_settings): + """Sets the palette_settings of this WhiteLabelingParams. + + + :param palette_settings: The palette_settings of this WhiteLabelingParams. # noqa: E501 + :type: PaletteSettings + """ + + self._palette_settings = palette_settings + + @property + def help_link_base_url(self): + """Gets the help_link_base_url of this WhiteLabelingParams. # noqa: E501 + + Base URL for help link # noqa: E501 + + :return: The help_link_base_url of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._help_link_base_url + + @help_link_base_url.setter + def help_link_base_url(self, help_link_base_url): + """Sets the help_link_base_url of this WhiteLabelingParams. + + Base URL for help link # noqa: E501 + + :param help_link_base_url: The help_link_base_url of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._help_link_base_url = help_link_base_url + + @property + def ui_help_base_url(self): + """Gets the ui_help_base_url of this WhiteLabelingParams. # noqa: E501 + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :return: The ui_help_base_url of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._ui_help_base_url + + @ui_help_base_url.setter + def ui_help_base_url(self, ui_help_base_url): + """Sets the ui_help_base_url of this WhiteLabelingParams. + + Base URL for the repository with the UI help components (markdown) # noqa: E501 + + :param ui_help_base_url: The ui_help_base_url of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._ui_help_base_url = ui_help_base_url + + @property + def enable_help_links(self): + """Gets the enable_help_links of this WhiteLabelingParams. # noqa: E501 + + Enable or Disable help links # noqa: E501 + + :return: The enable_help_links of this WhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._enable_help_links + + @enable_help_links.setter + def enable_help_links(self, enable_help_links): + """Sets the enable_help_links of this WhiteLabelingParams. + + Enable or Disable help links # noqa: E501 + + :param enable_help_links: The enable_help_links of this WhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._enable_help_links = enable_help_links + + @property + def white_labeling_enabled(self): + """Gets the white_labeling_enabled of this WhiteLabelingParams. # noqa: E501 + + Enable white-labeling # noqa: E501 + + :return: The white_labeling_enabled of this WhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._white_labeling_enabled + + @white_labeling_enabled.setter + def white_labeling_enabled(self, white_labeling_enabled): + """Sets the white_labeling_enabled of this WhiteLabelingParams. + + Enable white-labeling # noqa: E501 + + :param white_labeling_enabled: The white_labeling_enabled of this WhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._white_labeling_enabled = white_labeling_enabled + + @property + def show_name_version(self): + """Gets the show_name_version of this WhiteLabelingParams. # noqa: E501 + + Show platform name and version on UI and login screen # noqa: E501 + + :return: The show_name_version of this WhiteLabelingParams. # noqa: E501 + :rtype: bool + """ + return self._show_name_version + + @show_name_version.setter + def show_name_version(self, show_name_version): + """Sets the show_name_version of this WhiteLabelingParams. + + Show platform name and version on UI and login screen # noqa: E501 + + :param show_name_version: The show_name_version of this WhiteLabelingParams. # noqa: E501 + :type: bool + """ + + self._show_name_version = show_name_version + + @property + def platform_name(self): + """Gets the platform_name of this WhiteLabelingParams. # noqa: E501 + + White-labeled platform name # noqa: E501 + + :return: The platform_name of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_name + + @platform_name.setter + def platform_name(self, platform_name): + """Sets the platform_name of this WhiteLabelingParams. + + White-labeled platform name # noqa: E501 + + :param platform_name: The platform_name of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_name = platform_name + + @property + def platform_version(self): + """Gets the platform_version of this WhiteLabelingParams. # noqa: E501 + + White-labeled platform version # noqa: E501 + + :return: The platform_version of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._platform_version + + @platform_version.setter + def platform_version(self, platform_version): + """Sets the platform_version of this WhiteLabelingParams. + + White-labeled platform version # noqa: E501 + + :param platform_version: The platform_version of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._platform_version = platform_version + + @property + def custom_css(self): + """Gets the custom_css of this WhiteLabelingParams. # noqa: E501 + + Custom CSS content # noqa: E501 + + :return: The custom_css of this WhiteLabelingParams. # noqa: E501 + :rtype: str + """ + return self._custom_css + + @custom_css.setter + def custom_css(self, custom_css): + """Sets the custom_css of this WhiteLabelingParams. + + Custom CSS content # noqa: E501 + + :param custom_css: The custom_css of this WhiteLabelingParams. # noqa: E501 + :type: str + """ + + self._custom_css = custom_css + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WhiteLabelingParams, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WhiteLabelingParams): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/widget_type_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/widget_type_id.py new file mode 100644 index 0000000..3afb09c --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/widget_type_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetTypeId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetTypeId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetTypeId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetTypeId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetTypeId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetTypeId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetTypeId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/widget_type_info.py b/tb-rest-client/python/tb_rest_client/models/models_pe/widget_type_info.py new file mode 100644 index 0000000..9cd3427 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/widget_type_info.py @@ -0,0 +1,346 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetTypeInfo(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'WidgetTypeId', + 'created_time': 'int', + 'tenant_id': 'TenantId', + 'bundle_alias': 'str', + 'alias': 'str', + 'name': 'str', + 'description': 'str', + 'image': 'str', + 'widget_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'created_time': 'createdTime', + 'tenant_id': 'tenantId', + 'bundle_alias': 'bundleAlias', + 'alias': 'alias', + 'name': 'name', + 'description': 'description', + 'image': 'image', + 'widget_type': 'widgetType' + } + + def __init__(self, id=None, created_time=None, tenant_id=None, bundle_alias=None, alias=None, name=None, description=None, image=None, widget_type=None): # noqa: E501 + """WidgetTypeInfo - a model defined in Swagger""" # noqa: E501 + self._id = None + self._created_time = None + self._tenant_id = None + self._bundle_alias = None + self._alias = None + self._name = None + self._description = None + self._image = None + self._widget_type = None + self.discriminator = None + if id is not None: + self.id = id + if created_time is not None: + self.created_time = created_time + if tenant_id is not None: + self.tenant_id = tenant_id + if bundle_alias is not None: + self.bundle_alias = bundle_alias + if alias is not None: + self.alias = alias + if name is not None: + self.name = name + if description is not None: + self.description = description + if image is not None: + self.image = image + if widget_type is not None: + self.widget_type = widget_type + + @property + def id(self): + """Gets the id of this WidgetTypeInfo. # noqa: E501 + + + :return: The id of this WidgetTypeInfo. # noqa: E501 + :rtype: WidgetTypeId + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetTypeInfo. + + + :param id: The id of this WidgetTypeInfo. # noqa: E501 + :type: WidgetTypeId + """ + + self._id = id + + @property + def created_time(self): + """Gets the created_time of this WidgetTypeInfo. # noqa: E501 + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :return: The created_time of this WidgetTypeInfo. # noqa: E501 + :rtype: int + """ + return self._created_time + + @created_time.setter + def created_time(self, created_time): + """Sets the created_time of this WidgetTypeInfo. + + Timestamp of the Widget Type creation, in milliseconds # noqa: E501 + + :param created_time: The created_time of this WidgetTypeInfo. # noqa: E501 + :type: int + """ + + self._created_time = created_time + + @property + def tenant_id(self): + """Gets the tenant_id of this WidgetTypeInfo. # noqa: E501 + + + :return: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :rtype: TenantId + """ + return self._tenant_id + + @tenant_id.setter + def tenant_id(self, tenant_id): + """Sets the tenant_id of this WidgetTypeInfo. + + + :param tenant_id: The tenant_id of this WidgetTypeInfo. # noqa: E501 + :type: TenantId + """ + + self._tenant_id = tenant_id + + @property + def bundle_alias(self): + """Gets the bundle_alias of this WidgetTypeInfo. # noqa: E501 + + Reference to widget bundle # noqa: E501 + + :return: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._bundle_alias + + @bundle_alias.setter + def bundle_alias(self, bundle_alias): + """Sets the bundle_alias of this WidgetTypeInfo. + + Reference to widget bundle # noqa: E501 + + :param bundle_alias: The bundle_alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._bundle_alias = bundle_alias + + @property + def alias(self): + """Gets the alias of this WidgetTypeInfo. # noqa: E501 + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :return: The alias of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._alias + + @alias.setter + def alias(self, alias): + """Sets the alias of this WidgetTypeInfo. + + Unique alias that is used in dashboards as a reference widget type # noqa: E501 + + :param alias: The alias of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._alias = alias + + @property + def name(self): + """Gets the name of this WidgetTypeInfo. # noqa: E501 + + Widget name used in search and UI # noqa: E501 + + :return: The name of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this WidgetTypeInfo. + + Widget name used in search and UI # noqa: E501 + + :param name: The name of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def description(self): + """Gets the description of this WidgetTypeInfo. # noqa: E501 + + Description of the widget type # noqa: E501 + + :return: The description of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._description + + @description.setter + def description(self, description): + """Sets the description of this WidgetTypeInfo. + + Description of the widget type # noqa: E501 + + :param description: The description of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._description = description + + @property + def image(self): + """Gets the image of this WidgetTypeInfo. # noqa: E501 + + Base64 encoded widget thumbnail # noqa: E501 + + :return: The image of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._image + + @image.setter + def image(self, image): + """Sets the image of this WidgetTypeInfo. + + Base64 encoded widget thumbnail # noqa: E501 + + :param image: The image of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._image = image + + @property + def widget_type(self): + """Gets the widget_type of this WidgetTypeInfo. # noqa: E501 + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :return: The widget_type of this WidgetTypeInfo. # noqa: E501 + :rtype: str + """ + return self._widget_type + + @widget_type.setter + def widget_type(self, widget_type): + """Sets the widget_type of this WidgetTypeInfo. + + Type of the widget (timeseries, latest, control, alarm or static) # noqa: E501 + + :param widget_type: The widget_type of this WidgetTypeInfo. # noqa: E501 + :type: str + """ + + self._widget_type = widget_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetTypeInfo, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetTypeInfo): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/widgets_bundle_export_data.py b/tb-rest-client/python/tb_rest_client/models/models_pe/widgets_bundle_export_data.py new file mode 100644 index 0000000..8cefc9a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/widgets_bundle_export_data.py @@ -0,0 +1,240 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.entity_export_dataobject import EntityExportDataobject # noqa: F401,E501 + +class WidgetsBundleExportData(EntityExportDataobject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'attributes': 'dict(str, list[AttributeExportData])', + 'entity': 'WidgetsBundle', + 'entity_type': 'str', + 'relations': 'list[EntityRelation]', + 'widgets': 'list[WidgetTypeDetails]' + } + if hasattr(EntityExportDataobject, "swagger_types"): + swagger_types.update(EntityExportDataobject.swagger_types) + + attribute_map = { + 'attributes': 'attributes', + 'entity': 'entity', + 'entity_type': 'entityType', + 'relations': 'relations', + 'widgets': 'widgets' + } + if hasattr(EntityExportDataobject, "attribute_map"): + attribute_map.update(EntityExportDataobject.attribute_map) + + def __init__(self, attributes=None, entity=None, entity_type=None, relations=None, widgets=None, *args, **kwargs): # noqa: E501 + """WidgetsBundleExportData - a model defined in Swagger""" # noqa: E501 + self._attributes = None + self._entity = None + self._entity_type = None + self._relations = None + self._widgets = None + self.discriminator = None + if attributes is not None: + self.attributes = attributes + if entity is not None: + self.entity = entity + if entity_type is not None: + self.entity_type = entity_type + if relations is not None: + self.relations = relations + if widgets is not None: + self.widgets = widgets + EntityExportDataobject.__init__(self, *args, **kwargs) + + @property + def attributes(self): + """Gets the attributes of this WidgetsBundleExportData. # noqa: E501 + + + :return: The attributes of this WidgetsBundleExportData. # noqa: E501 + :rtype: dict(str, list[AttributeExportData]) + """ + return self._attributes + + @attributes.setter + def attributes(self, attributes): + """Sets the attributes of this WidgetsBundleExportData. + + + :param attributes: The attributes of this WidgetsBundleExportData. # noqa: E501 + :type: dict(str, list[AttributeExportData]) + """ + + self._attributes = attributes + + @property + def entity(self): + """Gets the entity of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity of this WidgetsBundleExportData. # noqa: E501 + :rtype: WidgetsBundle + """ + return self._entity + + @entity.setter + def entity(self, entity): + """Sets the entity of this WidgetsBundleExportData. + + + :param entity: The entity of this WidgetsBundleExportData. # noqa: E501 + :type: WidgetsBundle + """ + + self._entity = entity + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleExportData. # noqa: E501 + + + :return: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleExportData. + + + :param entity_type: The entity_type of this WidgetsBundleExportData. # noqa: E501 + :type: str + """ + allowed_values = ["ALARM", "API_USAGE_STATE", "ASSET", "ASSET_PROFILE", "BLOB_ENTITY", "CONVERTER", "CUSTOMER", "DASHBOARD", "DEVICE", "DEVICE_PROFILE", "EDGE", "ENTITY_GROUP", "ENTITY_VIEW", "GROUP_PERMISSION", "INTEGRATION", "NOTIFICATION", "NOTIFICATION_REQUEST", "NOTIFICATION_RULE", "NOTIFICATION_TARGET", "NOTIFICATION_TEMPLATE", "OTA_PACKAGE", "QUEUE", "ROLE", "RPC", "RULE_CHAIN", "RULE_NODE", "SCHEDULER_EVENT", "TB_RESOURCE", "TENANT", "TENANT_PROFILE", "USER", "WIDGETS_BUNDLE", "WIDGET_TYPE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + @property + def relations(self): + """Gets the relations of this WidgetsBundleExportData. # noqa: E501 + + + :return: The relations of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[EntityRelation] + """ + return self._relations + + @relations.setter + def relations(self, relations): + """Sets the relations of this WidgetsBundleExportData. + + + :param relations: The relations of this WidgetsBundleExportData. # noqa: E501 + :type: list[EntityRelation] + """ + + self._relations = relations + + @property + def widgets(self): + """Gets the widgets of this WidgetsBundleExportData. # noqa: E501 + + + :return: The widgets of this WidgetsBundleExportData. # noqa: E501 + :rtype: list[WidgetTypeDetails] + """ + return self._widgets + + @widgets.setter + def widgets(self, widgets): + """Sets the widgets of this WidgetsBundleExportData. + + + :param widgets: The widgets of this WidgetsBundleExportData. # noqa: E501 + :type: list[WidgetTypeDetails] + """ + + self._widgets = widgets + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleExportData, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleExportData): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/widgets_bundle_id.py b/tb-rest-client/python/tb_rest_client/models/models_pe/widgets_bundle_id.py new file mode 100644 index 0000000..7e91e2f --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/widgets_bundle_id.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class WidgetsBundleId(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'id': 'str', + 'entity_type': 'str' + } + + attribute_map = { + 'id': 'id', + 'entity_type': 'entityType' + } + + def __init__(self, id=None, entity_type=None): # noqa: E501 + """WidgetsBundleId - a model defined in Swagger""" # noqa: E501 + self._id = None + self._entity_type = None + self.discriminator = None + self.id = id + self.entity_type = entity_type + + @property + def id(self): + """Gets the id of this WidgetsBundleId. # noqa: E501 + + ID of the entity, time-based UUID v1 # noqa: E501 + + :return: The id of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this WidgetsBundleId. + + ID of the entity, time-based UUID v1 # noqa: E501 + + :param id: The id of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if id is None: + raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 + + self._id = id + + @property + def entity_type(self): + """Gets the entity_type of this WidgetsBundleId. # noqa: E501 + + string # noqa: E501 + + :return: The entity_type of this WidgetsBundleId. # noqa: E501 + :rtype: str + """ + return self._entity_type + + @entity_type.setter + def entity_type(self, entity_type): + """Sets the entity_type of this WidgetsBundleId. + + string # noqa: E501 + + :param entity_type: The entity_type of this WidgetsBundleId. # noqa: E501 + :type: str + """ + if entity_type is None: + raise ValueError("Invalid value for `entity_type`, must not be `None`") # noqa: E501 + allowed_values = ["WIDGETS_BUNDLE"] # noqa: E501 + if entity_type not in allowed_values: + raise ValueError( + "Invalid value for `entity_type` ({0}), must be one of {1}" # noqa: E501 + .format(entity_type, allowed_values) + ) + + self._entity_type = entity_type + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(WidgetsBundleId, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, WidgetsBundleId): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/x509_certificate_chain_provision_configuration.py b/tb-rest-client/python/tb_rest_client/models/models_pe/x509_certificate_chain_provision_configuration.py new file mode 100644 index 0000000..880f9c7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/x509_certificate_chain_provision_configuration.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six +from tb_rest_client.models.models_pe.device_profile_provision_configuration import DeviceProfileProvisionConfiguration # noqa: F401,E501 + +class X509CertificateChainProvisionConfiguration(DeviceProfileProvisionConfiguration): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'allow_create_new_devices_by_x509_certificate': 'bool', + 'certificate_reg_ex_pattern': 'str', + 'provision_device_secret': 'str' + } + if hasattr(DeviceProfileProvisionConfiguration, "swagger_types"): + swagger_types.update(DeviceProfileProvisionConfiguration.swagger_types) + + attribute_map = { + 'allow_create_new_devices_by_x509_certificate': 'allowCreateNewDevicesByX509Certificate', + 'certificate_reg_ex_pattern': 'certificateRegExPattern', + 'provision_device_secret': 'provisionDeviceSecret' + } + if hasattr(DeviceProfileProvisionConfiguration, "attribute_map"): + attribute_map.update(DeviceProfileProvisionConfiguration.attribute_map) + + def __init__(self, allow_create_new_devices_by_x509_certificate=None, certificate_reg_ex_pattern=None, provision_device_secret=None, *args, **kwargs): # noqa: E501 + """X509CertificateChainProvisionConfiguration - a model defined in Swagger""" # noqa: E501 + self._allow_create_new_devices_by_x509_certificate = None + self._certificate_reg_ex_pattern = None + self._provision_device_secret = None + self.discriminator = None + if allow_create_new_devices_by_x509_certificate is not None: + self.allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + if certificate_reg_ex_pattern is not None: + self.certificate_reg_ex_pattern = certificate_reg_ex_pattern + if provision_device_secret is not None: + self.provision_device_secret = provision_device_secret + DeviceProfileProvisionConfiguration.__init__(self, *args, **kwargs) + + @property + def allow_create_new_devices_by_x509_certificate(self): + """Gets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: bool + """ + return self._allow_create_new_devices_by_x509_certificate + + @allow_create_new_devices_by_x509_certificate.setter + def allow_create_new_devices_by_x509_certificate(self, allow_create_new_devices_by_x509_certificate): + """Sets the allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. + + + :param allow_create_new_devices_by_x509_certificate: The allow_create_new_devices_by_x509_certificate of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: bool + """ + + self._allow_create_new_devices_by_x509_certificate = allow_create_new_devices_by_x509_certificate + + @property + def certificate_reg_ex_pattern(self): + """Gets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._certificate_reg_ex_pattern + + @certificate_reg_ex_pattern.setter + def certificate_reg_ex_pattern(self, certificate_reg_ex_pattern): + """Sets the certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. + + + :param certificate_reg_ex_pattern: The certificate_reg_ex_pattern of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._certificate_reg_ex_pattern = certificate_reg_ex_pattern + + @property + def provision_device_secret(self): + """Gets the provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + + + :return: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :rtype: str + """ + return self._provision_device_secret + + @provision_device_secret.setter + def provision_device_secret(self, provision_device_secret): + """Sets the provision_device_secret of this X509CertificateChainProvisionConfiguration. + + + :param provision_device_secret: The provision_device_secret of this X509CertificateChainProvisionConfiguration. # noqa: E501 + :type: str + """ + + self._provision_device_secret = provision_device_secret + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509CertificateChainProvisionConfiguration, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509CertificateChainProvisionConfiguration): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/models/models_pe/x509_lw_m2_m_bootstrap_server_credential.py b/tb-rest-client/python/tb_rest_client/models/models_pe/x509_lw_m2_m_bootstrap_server_credential.py new file mode 100644 index 0000000..30531f7 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/models/models_pe/x509_lw_m2_m_bootstrap_server_credential.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + ThingsBoard REST API + + ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.5.0PE + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pprint +import re # noqa: F401 + +import six + +class X509LwM2MBootstrapServerCredential(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'short_server_id': 'int', + 'bootstrap_server_is': 'bool', + 'host': 'str', + 'port': 'int', + 'client_hold_off_time': 'int', + 'server_public_key': 'str', + 'server_certificate': 'str', + 'bootstrap_server_account_timeout': 'int', + 'lifetime': 'int', + 'default_min_period': 'int', + 'notif_if_disabled': 'bool', + 'binding': 'str' + } + + attribute_map = { + 'short_server_id': 'shortServerId', + 'bootstrap_server_is': 'bootstrapServerIs', + 'host': 'host', + 'port': 'port', + 'client_hold_off_time': 'clientHoldOffTime', + 'server_public_key': 'serverPublicKey', + 'server_certificate': 'serverCertificate', + 'bootstrap_server_account_timeout': 'bootstrapServerAccountTimeout', + 'lifetime': 'lifetime', + 'default_min_period': 'defaultMinPeriod', + 'notif_if_disabled': 'notifIfDisabled', + 'binding': 'binding' + } + + def __init__(self, short_server_id=None, bootstrap_server_is=None, host=None, port=None, client_hold_off_time=None, server_public_key=None, server_certificate=None, bootstrap_server_account_timeout=None, lifetime=None, default_min_period=None, notif_if_disabled=None, binding=None): # noqa: E501 + """X509LwM2MBootstrapServerCredential - a model defined in Swagger""" # noqa: E501 + self._short_server_id = None + self._bootstrap_server_is = None + self._host = None + self._port = None + self._client_hold_off_time = None + self._server_public_key = None + self._server_certificate = None + self._bootstrap_server_account_timeout = None + self._lifetime = None + self._default_min_period = None + self._notif_if_disabled = None + self._binding = None + self.discriminator = None + if short_server_id is not None: + self.short_server_id = short_server_id + if bootstrap_server_is is not None: + self.bootstrap_server_is = bootstrap_server_is + if host is not None: + self.host = host + if port is not None: + self.port = port + if client_hold_off_time is not None: + self.client_hold_off_time = client_hold_off_time + if server_public_key is not None: + self.server_public_key = server_public_key + if server_certificate is not None: + self.server_certificate = server_certificate + if bootstrap_server_account_timeout is not None: + self.bootstrap_server_account_timeout = bootstrap_server_account_timeout + if lifetime is not None: + self.lifetime = lifetime + if default_min_period is not None: + self.default_min_period = default_min_period + if notif_if_disabled is not None: + self.notif_if_disabled = notif_if_disabled + if binding is not None: + self.binding = binding + + @property + def short_server_id(self): + """Gets the short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :return: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._short_server_id + + @short_server_id.setter + def short_server_id(self, short_server_id): + """Sets the short_server_id of this X509LwM2MBootstrapServerCredential. + + Server short Id. Used as link to associate server Object Instance. This identifier uniquely identifies each LwM2M Server configured for the LwM2M Client. This Resource MUST be set when the Bootstrap-Server Resource has a value of 'false'. The values ID:0 and ID:65535 values MUST NOT be used for identifying the LwM2M Server. # noqa: E501 + + :param short_server_id: The short_server_id of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._short_server_id = short_server_id + + @property + def bootstrap_server_is(self): + """Gets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :return: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._bootstrap_server_is + + @bootstrap_server_is.setter + def bootstrap_server_is(self, bootstrap_server_is): + """Sets the bootstrap_server_is of this X509LwM2MBootstrapServerCredential. + + Is Bootstrap Server or Lwm2m Server. The LwM2M Client MAY be configured to use one or more LwM2M Server Account(s). The LwM2M Client MUST have at most one LwM2M Bootstrap-Server Account. (*) The LwM2M client MUST have at least one LwM2M server account after completing the boot sequence specified. # noqa: E501 + + :param bootstrap_server_is: The bootstrap_server_is of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._bootstrap_server_is = bootstrap_server_is + + @property + def host(self): + """Gets the host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Host for 'No Security' mode # noqa: E501 + + :return: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this X509LwM2MBootstrapServerCredential. + + Host for 'No Security' mode # noqa: E501 + + :param host: The host of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._host = host + + @property + def port(self): + """Gets the port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :return: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """Sets the port of this X509LwM2MBootstrapServerCredential. + + Port for Lwm2m Server: 'No Security' mode: Lwm2m Server or Bootstrap Server # noqa: E501 + + :param port: The port of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._port = port + + @property + def client_hold_off_time(self): + """Gets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :return: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._client_hold_off_time + + @client_hold_off_time.setter + def client_hold_off_time(self, client_hold_off_time): + """Sets the client_hold_off_time of this X509LwM2MBootstrapServerCredential. + + Client Hold Off Time. The number of seconds to wait before initiating a Client Initiated Bootstrap once the LwM2M Client has determined it should initiate this bootstrap mode. (This information is relevant for use with a Bootstrap-Server only.) # noqa: E501 + + :param client_hold_off_time: The client_hold_off_time of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._client_hold_off_time = client_hold_off_time + + @property + def server_public_key(self): + """Gets the server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :return: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_public_key + + @server_public_key.setter + def server_public_key(self, server_public_key): + """Sets the server_public_key of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): RPK or X509. Format: base64 encoded # noqa: E501 + + :param server_public_key: The server_public_key of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_public_key = server_public_key + + @property + def server_certificate(self): + """Gets the server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :return: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._server_certificate + + @server_certificate.setter + def server_certificate(self, server_certificate): + """Sets the server_certificate of this X509LwM2MBootstrapServerCredential. + + Server Public Key for 'Security' mode (DTLS): X509. Format: base64 encoded # noqa: E501 + + :param server_certificate: The server_certificate of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._server_certificate = server_certificate + + @property + def bootstrap_server_account_timeout(self): + """Gets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :return: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._bootstrap_server_account_timeout + + @bootstrap_server_account_timeout.setter + def bootstrap_server_account_timeout(self, bootstrap_server_account_timeout): + """Sets the bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. + + Bootstrap Server Account Timeout (If the value is set to 0, or if this resource is not instantiated, the Bootstrap-Server Account lifetime is infinite.) # noqa: E501 + + :param bootstrap_server_account_timeout: The bootstrap_server_account_timeout of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._bootstrap_server_account_timeout = bootstrap_server_account_timeout + + @property + def lifetime(self): + """Gets the lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :return: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """Sets the lifetime of this X509LwM2MBootstrapServerCredential. + + Specify the lifetime of the registration in seconds. # noqa: E501 + + :param lifetime: The lifetime of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._lifetime = lifetime + + @property + def default_min_period(self): + """Gets the default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :return: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: int + """ + return self._default_min_period + + @default_min_period.setter + def default_min_period(self, default_min_period): + """Sets the default_min_period of this X509LwM2MBootstrapServerCredential. + + The default value the LwM2M Client should use for the Minimum Period of an Observation in the absence of this parameter being included in an Observation. If this Resource doesn’t exist, the default value is 0. # noqa: E501 + + :param default_min_period: The default_min_period of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: int + """ + + self._default_min_period = default_min_period + + @property + def notif_if_disabled(self): + """Gets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :return: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: bool + """ + return self._notif_if_disabled + + @notif_if_disabled.setter + def notif_if_disabled(self, notif_if_disabled): + """Sets the notif_if_disabled of this X509LwM2MBootstrapServerCredential. + + If true, the LwM2M Client stores “Notify” operations to the LwM2M Server while the LwM2M Server account is disabled or the LwM2M Client is offline. After the LwM2M Server account is enabled or the LwM2M Client is online, the LwM2M Client reports the stored “Notify” operations to the Server. If false, the LwM2M Client discards all the “Notify” operations or temporarily disables the Observe function while the LwM2M Server is disabled or the LwM2M Client is offline. The default value is true. # noqa: E501 + + :param notif_if_disabled: The notif_if_disabled of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: bool + """ + + self._notif_if_disabled = notif_if_disabled + + @property + def binding(self): + """Gets the binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :return: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :rtype: str + """ + return self._binding + + @binding.setter + def binding(self, binding): + """Sets the binding of this X509LwM2MBootstrapServerCredential. + + This Resource defines the transport binding configured for the LwM2M Client. If the LwM2M Client supports the binding specified in this Resource, the LwM2M Client MUST use that transport for the Current Binding Mode. # noqa: E501 + + :param binding: The binding of this X509LwM2MBootstrapServerCredential. # noqa: E501 + :type: str + """ + + self._binding = binding + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(X509LwM2MBootstrapServerCredential, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, X509LwM2MBootstrapServerCredential): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/tb-rest-client/python/tb_rest_client/rest.py b/tb-rest-client/python/tb_rest_client/rest.py new file mode 100644 index 0000000..e7a990a --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/rest.py @@ -0,0 +1,342 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +""" + ThingsBoard REST API + + ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 + + OpenAPI spec version: 3.3.3 + Contact: info@thingsboard.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +from __future__ import absolute_import + +import io +import json +import logging +import re +import ssl + +import certifi +# python 2 and python 3 compatibility library +import six +from six.moves.urllib.parse import urlencode + +try: + import urllib3 +except ImportError: + raise ImportError('Swagger python client requires urllib3.') + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.getheaders() + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.getheader(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + # ca_certs + if configuration.ssl_ca_cert: + ca_certs = configuration.ssl_ca_cert + else: + # if not set certificate file, use Mozilla's root certificates. + ca_certs = certifi.where() + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :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: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting 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'] + + if post_params and body: + raise ValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if query_params: + url += '?' + urlencode(query_params) + if re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = '{}' + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + +class ApiException(Exception): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message diff --git a/tb-rest-client/python/tb_rest_client/rest_client_base.py b/tb-rest-client/python/tb_rest_client/rest_client_base.py new file mode 100644 index 0000000..12ab2d8 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/rest_client_base.py @@ -0,0 +1,1819 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import jwt +from time import time, sleep + +from requests import post +from threading import Thread +from logging import getLogger + +from typing import List, Optional, Union, Any, Dict + +from tb_rest_client.models.models_ce import * +from tb_rest_client.rest import RESTResponse +from tb_rest_client.api.api_ce.two_factor_auth_controller_api import TwoFactorAuthControllerApi +from tb_rest_client.api.api_ce.entities_version_control_controller_api import EntitiesVersionControlControllerApi +from tb_rest_client.api.api_ce.admin_controller_api import AdminControllerApi +from tb_rest_client.api.api_ce.alarm_controller_api import AlarmControllerApi +from tb_rest_client.api.api_ce.asset_controller_api import AssetControllerApi +from tb_rest_client.api.api_ce.audit_log_controller_api import AuditLogControllerApi +from tb_rest_client.api.api_ce.auth_controller_api import AuthControllerApi +from tb_rest_client.api.api_ce.component_descriptor_controller_api import ComponentDescriptorControllerApi +from tb_rest_client.api.api_ce.customer_controller_api import CustomerControllerApi +from tb_rest_client.api.api_ce.dashboard_controller_api import DashboardControllerApi +from tb_rest_client.api.api_ce.device_controller_api import DeviceControllerApi +from tb_rest_client.api.api_ce.device_api_controller_api import DeviceApiControllerApi +from tb_rest_client.api.api_ce.device_profile_controller_api import DeviceProfileControllerApi +from tb_rest_client.api.api_ce.edge_controller_api import EdgeControllerApi +from tb_rest_client.api.api_ce.edge_event_controller_api import EdgeEventControllerApi +from tb_rest_client.api.api_ce.entity_query_controller_api import EntityQueryControllerApi +from tb_rest_client.api.api_ce.entity_relation_controller_api import EntityRelationControllerApi +from tb_rest_client.api.api_ce.entity_view_controller_api import EntityViewControllerApi +from tb_rest_client.api.api_ce.event_controller_api import EventControllerApi +from tb_rest_client.api.api_ce.lwm_2m_controller_api import Lwm2mControllerApi +from tb_rest_client.api.api_ce.o_auth_2_config_template_controller_api import OAuth2ConfigTemplateControllerApi +from tb_rest_client.api.api_ce.o_auth_2_controller_api import OAuth2ControllerApi +from tb_rest_client.api.api_ce.ota_package_controller_api import OtaPackageControllerApi +from tb_rest_client.api.api_ce.queue_controller_api import QueueControllerApi +from tb_rest_client.api.api_ce.rpc_v_1_controller_api import RpcV1ControllerApi +from tb_rest_client.api.api_ce.rpc_v_2_controller_api import RpcV2ControllerApi +from tb_rest_client.api.api_ce.rule_chain_controller_api import RuleChainControllerApi +from tb_rest_client.api.api_ce.tb_resource_controller_api import TbResourceControllerApi +from tb_rest_client.api.api_ce.telemetry_controller_api import TelemetryControllerApi +from tb_rest_client.api.api_ce.tenant_controller_api import TenantControllerApi +from tb_rest_client.api.api_ce.tenant_profile_controller_api import TenantProfileControllerApi +from tb_rest_client.api.api_ce.user_controller_api import UserControllerApi +from tb_rest_client.api.api_ce.widget_type_controller_api import WidgetTypeControllerApi +from tb_rest_client.api.api_ce.widgets_bundle_controller_api import WidgetsBundleControllerApi +from tb_rest_client.api.api_ce.ui_settings_controller_api import UiSettingsControllerApi +from tb_rest_client.api.api_ce.alarm_comment_controller_api import AlarmCommentControllerApi +from tb_rest_client.api.api_ce.notification_target_controller_api import NotificationTargetControllerApi +from tb_rest_client.api.api_ce.usage_info_controller_api import UsageInfoControllerApi +from tb_rest_client.api.api_ce.notification_rule_controller_api import NotificationRuleControllerApi +from tb_rest_client.api.api_ce.notification_controller_api import NotificationControllerApi +from tb_rest_client.api.api_ce.notification_template_controller_api import NotificationTemplateControllerApi +from tb_rest_client.api.api_ce.asset_profile_controller_api import AssetProfileControllerApi +from tb_rest_client.api.api_ce.two_factor_auth_config_controller_api import TwoFactorAuthConfigControllerApi +# from tb_rest_client.models.models_pe import * +from tb_rest_client.configuration import Configuration +from tb_rest_client.api_client import ApiClient + +logger = getLogger(__name__) + + +class RestClientBase(Thread): + def __init__(self, base_url): + super().__init__() + if base_url.startswith("http"): + self.base_url = base_url + else: + self.base_url = "http://" + base_url + self.token_info = {"token": "", "refreshToken": "", "exp": 0} + self.api_client = None + self.logged_in = False + self.stopped = True + self.configuration = Configuration() + self.configuration.host = self.base_url + + def run(self): + self.stopped = False + while not self.stopped: + try: + check_time = time() + if check_time >= self.token_info["exp"] and self.logged_in: + if self.token_info["refreshToken"]: + self.refresh() + else: + logger.error("No username or password provided!") + sleep(1) + except Exception as e: + logger.exception(e) + break + except KeyboardInterrupt: + break + + def stop(self): + self.stopped = True + + def __enter__(self): + self.start() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.stop() + + def login(self, username, password): + """Authorization on the host and saving the toke information""" + token_json = post(self.base_url + "/api/auth/login", json={"username": username, "password": password}, + verify=self.configuration.verify_ssl).json() + self.__save_token(token_json) + + self.logged_in = True + + self.__load_configuration() + + def public_login(self, public_id): + token_json = post(self.base_url + "/api/auth/login/public", json={"publicId": public_id}, + verify=self.configuration.verify_ssl).json() + + self.__save_token(token_json) + self.__load_configuration() + + def token_login(self, token, refresh_token=None): + token_json = { + "token": token, + "refreshToken": refresh_token, + } + + self.__save_token(token_json) + self.__load_configuration() + + def refresh(self): + if not self.token_info["refreshToken"]: + return + + token_json = post(self.base_url + "/api/auth/token", json={"refreshToken": self.token_info["refreshToken"]}, + verify=self.configuration.verify_ssl).json() + + self.__save_token(token_json) + self.__load_configuration() + + def __save_token(self, token_json): + token = None + refresh_token = None + if isinstance(token_json, dict) and token_json.get("token") is not None: + token = token_json["token"] + refresh_token = token_json["refreshToken"] + self.configuration.api_key_prefix["X-Authorization"] = "Bearer" + self.configuration.api_key["X-Authorization"] = token + self.token_info['token'] = token + self.token_info['refreshToken'] = refresh_token + try: + parsed_token = jwt.decode(token, options={"verify_signature": False}) + self.token_info['exp'] = parsed_token['exp'] + except Exception: + return + + def __load_configuration(self): + self.api_client = ApiClient(self.configuration) + self.__load_controllers() + + def get_token(self): + return self.token_info["token"] + + # OAuth2 Controller + def delete_client_registration_template(self, client_registration_template_id: EntityId): + client_registration_template_id = self.get_id(client_registration_template_id) + return self.o_auth2_config_template_controller.delete_client_registration_template_using_delete( + client_registration_template_id=client_registration_template_id) + + def get_client_registration_templates(self) -> List[OAuth2ClientRegistrationTemplate]: + return self.o_auth2_config_template_controller.get_client_registration_templates_using_get() + + def save_client_registration_template(self, + body: Optional[OAuth2ClientRegistrationTemplate]) -> OAuth2ClientRegistrationTemplate: + return self.o_auth2_config_template_controller.save_client_registration_template_using_post(body=body) + + # Asset Controller + def get_customer_assets(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataAsset: + customer_id = self.get_id(customer_id) + return self.asset_controller.get_customer_assets_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_asset(self, asset_name: str) -> Asset: + return self.asset_controller.get_tenant_asset_using_get(asset_name=asset_name) + + def delete_asset(self, asset_id: AssetId) -> None: + asset_id = self.get_id(asset_id) + return self.asset_controller.delete_asset_using_delete(asset_id=asset_id) + + def get_assets_by_ids(self, asset_ids: list) -> List[Asset]: + asset_ids = ','.join(asset_ids) + return self.asset_controller.get_assets_by_ids_using_get(asset_ids=asset_ids) + + def get_tenant_assets(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAsset: + return self.asset_controller.get_tenant_assets_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_asset_types(self) -> List[EntitySubtype]: + return self.asset_controller.get_asset_types_using_get() + + def find_by_query(self, body: Optional[AssetSearchQuery]) -> List[Asset]: + return self.asset_controller.find_by_query_using_post(body=body) + + def get_asset_by_id(self, asset_id: AssetId) -> Asset: + asset_id = self.get_id(asset_id) + return self.asset_controller.get_asset_by_id_using_get(asset_id=asset_id) + + # Rule Chain Controller + def export_rule_chains(self, limit: int) -> RuleChainData: + return self.rule_chain_controller.export_rule_chains_using_get(limit=limit) + + def delete_rule_chain(self, rule_chain_id: RuleChainId) -> None: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.delete_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def set_edge_template_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_edge_template_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def save_rule_chain(self, body: Optional[DefaultRuleChainCreateRequest]) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post(body=body) + + def unassign_rule_chain_from_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unassign_rule_chain_from_edge_using_delete(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def assign_rule_chain_to_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.assign_rule_chain_to_edge_using_post(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def unset_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def get_rule_chain_by_id(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_by_id_using_get(rule_chain_id=rule_chain_id) + + def test_script(self, body: Optional[RuleChain]) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.rule_chain_controller.test_script_using_post(body=body) + + def save_rule_chain_v1(self, body: Optional[RuleChain]) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post1(body=body) + + def get_edge_rule_chains(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + edge_id = self.get_id(edge_id) + return self.rule_chain_controller.get_edge_rule_chains_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def set_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def import_rule_chains(self, body: Optional[RuleChainData], overwrite: Optional[bool] = None) -> List[ + RuleChainImportResult]: + return self.rule_chain_controller.import_rule_chains_using_post(body=body, overwrite=overwrite) + + def set_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def get_rule_chains(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + return self.rule_chain_controller.get_rule_chains_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_auto_assign_to_edge_rule_chains(self) -> List[RuleChain]: + return self.rule_chain_controller.get_auto_assign_to_edge_rule_chains_using_get() + + def get_latest_rule_node_debug_input(self, rule_node_id: RuleNodeId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + rule_node_id = self.get_id(rule_node_id) + return self.rule_chain_controller.get_latest_rule_node_debug_input_using_get(rule_node_id=rule_node_id) + + def get_rule_chain_meta_data(self, rule_chain_id: RuleChainId) -> RuleChainMetaData: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_meta_data_using_get(rule_chain_id=rule_chain_id) + + # Auth Controller + def get_user(self) -> User: + return self.auth_controller.get_user_using_get() + + def change_password(self, body: Optional[ChangePasswordRequest] = None) -> ObjectNode: + return self.auth_controller.change_password_using_post(body=body) + + def logout(self) -> None: + return self.auth_controller.logout_using_post() + + def check_reset_token(self, reset_token: str) -> str: + return self.auth_controller.check_reset_token_using_get(reset_token=reset_token) + + def reset_password(self, body: Optional[ResetPasswordRequest] = None) -> JWTPair: + return self.auth_controller.reset_password_using_post(body=body) + + def activate_user(self, body: Optional[ActivateUserRequest], send_activation_mail: bool) -> JWTPair: + return self.auth_controller.activate_user_using_post(body=body, send_activation_mail=send_activation_mail) + + def get_user_password_policy(self) -> UserPasswordPolicy: + return self.auth_controller.get_user_password_policy_using_get() + + def check_activate_token(self, activate_token: str) -> str: + return self.auth_controller.check_activate_token_using_get(activate_token=activate_token) + + def request_reset_password_by_email(self, body: Optional[ResetPasswordEmailRequest] = None) -> None: + return self.auth_controller.request_reset_password_by_email_using_post(body=body) + + # Event Controller # + def get_events_post(self, tenant_id: TenantId, page_size: int, page: int, entity_id: EntityId, + body: Optional[EventFilter], text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEventInfo: + tenant_id = self.get_id(tenant_id) + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.event_controller.get_events_using_post(tenant_id=tenant_id, page_size=page_size, page=page, + entity_type=entity_type, entity_id=entity_id, body=body, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + def get_events_v1_get1(self, entity_id: EntityId, event_type: str, tenant_id: TenantId, + page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataEvent: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + tenant_id = self.get_id(tenant_id) + return self.event_controller.get_events_using_get1(entity_type=entity_type, entity_id=entity_id, + event_type=event_type, tenant_id=tenant_id, + page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + def clear_events_post(self, entity_id: EntityId, body: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.event_controller.clear_events_using_post(entity_type=entity_type, entity_id=entity_id, body=body, + start_time=start_time, end_time=end_time) + + def get_events_get(self, entity_id: EntityId, tenant_id: TenantId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEventInfo: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + tenant_id = self.get_id(tenant_id) + return self.event_controller.get_events_using_get(entity_type=entity_type, entity_id=entity_id, + tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + # Telemetry Controller # + def get_attribute_keys_by_scope(self, entity_id: EntityId, scope: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_by_scope_using_get(entity_type=entity_type, + entity_id=entity_id, scope=scope) + + def get_timeseries(self, entity_id: EntityId, keys: str, start_ts: int, end_ts: int, + interval: Optional[int] = None, limit: Optional[int] = None, agg: Optional[str] = None, order_by: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, start_ts=start_ts, end_ts=end_ts, + interval=interval, limit=limit, agg=agg, + order_by=order_by, + use_strict_data_types=use_strict_data_types) + + def delete_device_attributes(self, device_id: DeviceId, scope: str, keys: str): + device_id = self.get_id(device_id) + return self.telemetry_controller.delete_device_attributes_using_delete(device_id=device_id, scope=scope, + keys=keys) + + def save_entity_attributes_v1(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v1_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def delete_entity_timeseries(self, entity_id: EntityId, keys: str, delete_all_data_for_keys: Optional[bool] = None, + start_ts: Optional[int] = None, end_ts: Optional[int] = None, + rewrite_latest_if_deleted: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_timeseries_using_delete(entity_type=entity_type, + entity_id=entity_id, keys=keys, + delete_all_data_for_keys=delete_all_data_for_keys, + start_ts=start_ts, end_ts=end_ts, + rewrite_latest_if_deleted=rewrite_latest_if_deleted) + + def save_device_attributes(self, device_id: DeviceId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + device_id = self.get_id(device_id) + return self.telemetry_controller.save_device_attributes_using_post(device_id=device_id, scope=scope, body=body) + + def get_latest_timeseries(self, entity_id: EntityId, keys: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_latest_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, + use_strict_data_types=use_strict_data_types) + + def get_timeseries_keys_v1(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_keys_using_get1(entity_type=entity_type, entity_id=entity_id) + + def get_attributes_by_scope(self, entity_id: EntityId, scope: str, + keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_by_scope_using_get(entity_type=entity_type, entity_id=entity_id, + scope=scope, keys=keys) + + def get_attribute_keys(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_using_get(entity_type=entity_type, entity_id=entity_id) + + def save_entity_attributes_v2(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v2_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def save_entity_telemetry(self, entity_id: EntityId, scope: str, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_telemetry_using_post(entity_type=entity_type, entity_id=entity_id, + scope=scope, body=body) + + def save_entity_telemetry_with_ttl(self, entity_id: EntityId, scope: str, ttl: int, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + ttl = str(ttl) + return self.telemetry_controller.save_entity_telemetry_with_ttl_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + ttl=ttl, body=body) + + def get_attributes(self, entity_id: EntityId, keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys) + + def delete_entity_attributes(self, entity_id: EntityId, scope: str, keys: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_attributes_using_delete(entity_type=entity_type, + entity_id=entity_id, scope=scope, + keys=keys) + + # Alarm Controller + def ack_alarm(self, alarm_id: AlarmId) -> AlarmInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.ack_alarm_using_post(alarm_id=alarm_id) + + def get_alarm_info_by_id(self, alarm_id: AlarmId) -> AlarmInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.get_alarm_info_by_id_using_get(alarm_id=alarm_id) + + def delete_alarm(self, alarm_id: AlarmId) -> bool: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.delete_alarm_using_delete(alarm_id=alarm_id) + + def clear_alarm(self, alarm_id: AlarmId) -> AlarmInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.clear_alarm_using_post(alarm_id=alarm_id) + + def save_alarm(self, body: Alarm) -> Alarm: + return self.alarm_controller.save_alarm_using_post(body=body) + + def get_alarms(self, entity_id: EntityId, page_size: int, page: int, search_status: Optional[str] = None, + status: Optional[str] = None, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, end_time: Optional[int] = None, + fetch_originator: Optional[bool] = None, assignee_id: Optional[str] = None) -> PageDataAlarmInfo: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.alarm_controller.get_alarms_using_get(entity_type=entity_type, entity_id=entity_id, + page_size=page_size, page=page, search_status=search_status, + status=status, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time, + fetch_originator=fetch_originator, assignee_id=assignee_id) + + def unassign_alarm(self, id: AlarmId) -> Alarm: + id = self.get_id(id) + return self.alarm_controller.unassign_alarm_using_delete(alarm_id=id) + + def get_asset_info_by_id(self, asset_id: AssetId) -> AssetInfo: + asset_id = self.get_id(asset_id) + return self.asset_controller.get_asset_info_by_id_using_get(asset_id=asset_id) + + def get_customer_asset_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAssetInfo: + customer_id = self.get_id(customer_id) + + if asset_profile_id: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_customer_asset_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, asset_profile_id=asset_profile_id) + + def count_alarms_by_query(self, body: AlarmCountQuery) -> int: + return self.entity_query_controller.count_alarms_by_query_using_post(body=body) + + def get_customer_dashboards(self, customer_id: CustomerId, page_size: int, page: int, mobile: Optional[bool] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + customer_id = self.get_id(customer_id) + return self.dashboard_controller.get_customer_dashboards_using_get(customer_id=customer_id, page_size=page_size, + page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_settings(self) -> JsonNode: + return self.user_controller.get_user_settings_using_get() + + def get_tenant_usage_info(self) -> UsageInfo: + return self.usage_info_controller.get_tenant_usage_info_using_get() + + def save_user_settings(self, body: JsonNode) -> JsonNode: + return self.user_controller.save_user_settings_using_post(body=body) + + def put_user_settings(self, body: JsonNode): + return self.user_controller.put_user_settings_using_put(body=body) + + def report_user_dashboard_action(self, dashboard_id: DashboardId, action: str) -> UserDashboardsInfo: + dashboard_id = self.get_id(dashboard_id) + return self.user_controller.report_user_dashboard_action_using_get(dashboard_id=dashboard_id, action=action) + + def get_users_for_assign(self, alarm_id: AlarmId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUserEmailInfo: + alarm_id = self.get_id(alarm_id) + return self.user_controller.get_users_for_assign_using_get(alarm_id=alarm_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_users_by_query(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUserEmailInfo: + return self.user_controller.find_users_by_query_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_dashboards_info(self) -> UserDashboardsInfo: + return self.user_controller.get_user_dashboards_info_using_get() + + def delete_user_settings(self, paths: List[str], type: str): + paths = ','.join(paths) + return self.user_controller.delete_user_settings_using_delete(paths=paths, type=type) + + def get_tenant_profiles_by_ids(self, ids: List[str]) -> List[TenantProfile]: + ids = ','.join(ids) + return self.tenant_profile_controller.get_tenant_profiles_by_ids_using_get(ids=ids) + + def get_entity_view_info_by_id(self, entity_view_id: EntityViewId) -> EntityViewInfo: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_info_by_id_using_get(entity_view_id=entity_view_id) + + def get_device_info_by_id(self, device_id: DeviceId) -> DeviceInfo: + device_id = self.get_id(device_id) + return self.device_controller.get_device_info_by_id_using_get(device_id=device_id) + + def get_alarm_by_id(self, alarm_id: AlarmId) -> Alarm: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.get_alarm_by_id_using_get(alarm_id=alarm_id) + + def get_all_alarms(self, page_size: int, page: int, search_status: Optional[str] = None, status: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None, + fetch_originator: Optional[bool] = None) -> PageDataAlarmInfo: + return self.alarm_controller.get_all_alarms_using_get(page_size=page_size, page=page, + search_status=search_status, status=status, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time, fetch_originator=fetch_originator) + + # Alarm Comment Controller + def delete_alarm_comment(self, alarm_id: AlarmId, comment_id: AlarmCommentId): + alarm_id = self.get_id(alarm_id) + comment_id = self.get_id(comment_id) + return self.alarm_comment_controller.delete_alarm_comment_using_delete(alarm_id=alarm_id, comment_id=comment_id) + + def get_alarm_comments(self, alarm_id: AlarmId, page_size: int, page: int, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAlarmCommentInfo: + alarm_id = self.get_id(alarm_id) + return self.alarm_comment_controller.get_alarm_comments_using_get(alarm_id=alarm_id, page_size=page_size, + page=page, sort_property=sort_property, + sort_order=sort_order) + + def save_alarm_comment(self, alarm_id: AlarmId, body: Optional[AlarmComment] = None) -> AlarmComment: + alarm_id = self.get_id(alarm_id) + return self.alarm_comment_controller.save_alarm_comment_using_post(alarm_id=alarm_id, body=body) + + # Edge Controller # + def get_tenant_edge(self, edge_name: str) -> Edge: + return self.edge_controller.get_tenant_edge_using_get(edge_name=edge_name) + + def delete_edge(self, edge_id: EdgeId) -> None: + edge_id = self.get_id(edge_id) + return self.edge_controller.delete_edge_using_delete(edge_id=edge_id) + + def is_edges_support_enabled(self) -> bool: + return self.edge_controller.is_edges_support_enabled_using_get() + + def get_edge_by_id(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_by_id_using_get(edge_id=edge_id) + + def sync_edge(self, edge_id: EdgeId) -> DeferredResultResponseEntity: + edge_id = self.get_id(edge_id) + return self.edge_controller.sync_edge_using_post(edge_id=edge_id) + + def get_tenant_edges(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_tenant_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def find_by_query_v2(self, body: Optional[EdgeSearchQuery] = None) -> List[Edge]: + return self.edge_controller.find_by_query_using_post2(body=body) + + def get_edges(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_edges_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edge_types(self) -> List[EntitySubtype]: + return self.edge_controller.get_edge_types_using_get() + + def set_edge_root_rule_chain(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> Edge: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.edge_controller.set_edge_root_rule_chain_using_post(edge_id=edge_id, rule_chain_id=rule_chain_id) + + def find_missing_to_related_rule_chains(self, edge_id: EdgeId) -> str: + edge_id = self.get_id(edge_id) + return self.edge_controller.find_missing_to_related_rule_chains_using_get(edge_id=edge_id) + + def get_customer_edges(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edges_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edges_by_ids(self, edge_ids: list) -> List[Edge]: + return self.edge_controller.get_edges_by_ids_using_get(edge_ids=str(edge_ids)) + + def process_edges_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultEdge: + return self.edge_controller.process_edges_bulk_import_using_post(body=body) + + def get_edge_events(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEdgeEvent: + edge_id = self.get_id(edge_id) + return self.edge_event_controller.get_edge_events_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + # RPC v2 Controller + def get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def handle_one_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_one_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_two_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def get_persisted_rpc_by_device(self, device_id: DeviceId, page_size: int, page: int, rpc_status: str, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.get_persisted_rpc_by_device_using_get(device_id=device_id, page_size=page_size, + page=page, rpc_status=rpc_status, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + def get_rule_chain_output_labels_usage(self, rule_chain_id: RuleChainId) -> List[RuleChainOutputLabelsUsage]: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_output_labels_usage_using_get(rule_chain_id=rule_chain_id) + + def get_rule_chain_output_labels(self, rule_chain_id: RuleChainId) -> List[str]: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_output_labels_using_get(rule_chain_id=rule_chain_id) + + def is_tbel_enabled(self) -> bool: + return self.rule_chain_controller.is_tbel_enabled_using_get() + + def save_rule_chain_meta_data(self, body: Optional[RuleChainMetaData] = None, + update_related: Optional[bool] = None) -> RuleChainMetaData: + return self.rule_chain_controller.save_rule_chain_meta_data_using_post(body=body, update_related=update_related) + + def delete_rpc(self, rpc_id: RpcId) -> None: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.delete_rpc_using_delete(rpc_id=rpc_id) + + def delete_resource(self, rpc_id: RpcId) -> None: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.delete_resource_using_delete(rpc_id=rpc_id) + + # Customer Controller # + def get_customer_title_by_id(self, customer_id: CustomerId) -> str: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_title_by_id_using_get(customer_id=customer_id) + + def get_customers(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataCustomer: + return self.customer_controller.get_customers_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_customer_by_id(self, customer_id: CustomerId) -> Customer: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_by_id_using_get(customer_id=customer_id) + + def get_short_customer_info_by_id(self, customer_id: CustomerId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_short_customer_info_by_id_using_get(customer_id=customer_id) + + def get_tenant_customer(self, customer_title: str) -> Customer: + return self.customer_controller.get_tenant_customer_using_get(customer_title=customer_title) + + def delete_customer(self, customer_id: CustomerId) -> None: + customer_id = self.get_id(customer_id) + return self.customer_controller.delete_customer_using_delete(customer_id=customer_id) + + # User Controller # + def get_user_token(self, user_id: UserId) -> JWTPair: + user_id = self.get_id(user_id) + return self.user_controller.get_user_token_using_get(user_id=user_id) + + def get_activation_link(self, user_id: UserId) -> str: + user_id = self.get_id(user_id) + return self.user_controller.get_activation_link_using_get(user_id=user_id) + + def delete_user(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.delete_user_using_delete(user_id=user_id) + + def set_user_credentials_enabled(self, user_id: UserId, user_credentials_enabled: bool) -> None: + user_id = self.get_id(user_id) + return self.user_controller.set_user_credentials_enabled_using_post(user_id=user_id, + user_credentials_enabled=user_credentials_enabled) + + def get_customer_users(self, customer_id: CustomerId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataUser: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_users_using_get(customer_id=customer_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_user_by_id(self, user_id: UserId) -> User: + user_id = self.get_id(user_id) + return self.user_controller.get_user_by_id_using_get(user_id=user_id) + + def get_tenant_admins(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUser: + tenant_id = self.get_id(tenant_id) + return self.user_controller.get_tenant_admins_using_get(tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def is_user_token_access_enabled(self) -> bool: + return self.user_controller.is_user_token_access_enabled_using_get() + + def send_activation_email(self, email: str) -> None: + return self.user_controller.send_activation_email_using_post(email=email) + + # Queue Controller + def get_tenant_queues_by_service_type(self, service_type: str, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> List[str]: + return self.queue_controller.get_tenant_queues_by_service_type_using_get(service_type=service_type, + page_size=page_size, + page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_queue(self, service_type: str, body: Optional[Queue] = None) -> Queue: + return self.queue_controller.save_queue_using_post(service_type=service_type, body=body) + + # RPC v1 Controller + def handle_one_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_one_way_device_rpc_request_using_post(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_two_way_device_rpc_request_using_post(device_id=device_id, body=body) + + # Device Controller + def get_device_types(self) -> List[EntitySubtype]: + return self.device_controller.get_device_types_using_get() + + def update_device_credentials(self, body: Optional[DeviceCredentials] = None) -> DeviceCredentials: + return self.device_controller.update_device_credentials_using_post(body=body) + + def delete_device(self, device_id: DeviceId) -> None: + device_id = self.get_id(device_id) + return self.device_controller.delete_device_using_delete(device_id=device_id) + + def assign_device_to_tenant(self, tenant_id: TenantId, device_id: DeviceId) -> Device: + tenant_id = self.get_id(tenant_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_tenant_using_post(tenant_id=tenant_id, device_id=device_id) + + def re_claim_device(self, device_name: str): + return self.device_controller.re_claim_device_using_delete(device_name=device_name) + + def process_devices_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultDevice: + return self.device_controller.process_devices_bulk_import_using_post(body=body) + + def count_by_device_profile_and_empty_ota_package(self, ota_package_type: str, + device_profile_id: DeviceProfileId) -> int: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.count_by_device_profile_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, device_profile_id=device_profile_id) + + def get_devices_by_ids(self, device_ids: list) -> List[Device]: + return self.device_controller.get_devices_by_ids_using_get(device_ids=str(device_ids)) + + def get_device_by_id(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.get_device_by_id_using_get(device_id=device_id) + + def find_by_query_v1(self, body: Optional[DeviceSearchQuery] = None) -> List[Device]: + return self.device_controller.find_by_query_using_post1(body=body) + + def get_customer_devices(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDevice: + customer_id = self.get_id(customer_id) + return self.device_controller.get_customer_devices_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_devices(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDevice: + return self.device_controller.get_tenant_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_device(self, device_name: str) -> Device: + return self.device_controller.get_tenant_device_using_get(device_name=device_name) + + def get_device_credentials_by_device_id(self, device_id: DeviceId) -> DeviceCredentials: + device_id = self.get_id(device_id) + return self.device_controller.get_device_credentials_by_device_id_using_get(device_id=device_id) + + # Entity Relation Controller + def find_by_to_v1(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[EntityRelation]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get1(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def find_info_by_to(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelationInfo]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_info_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def delete_relations(self, entity_id: EntityId) -> None: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entity_relation_controller.delete_relations_using_delete(entity_id=entity_id, + entity_type=entity_type) + + def delete_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> None: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.delete_relation_using_delete(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_info_by_query(self, body: Optional[EntityRelationsQuery] = None) -> List[EntityRelationInfo]: + return self.entity_relation_controller.find_info_by_query_using_post(body=body) + + def find_by_query_v3(self, body: Optional[EntityRelationsQuery] = None) -> List[EntityRelation]: + return self.entity_relation_controller.find_by_query_using_post3(body=body) + + def save_relation(self, body: Optional[EntityRelation] = None) -> None: + return self.entity_relation_controller.save_relation_using_post(body=body) + + def find_by_to(self, to_id: EntityId, relation_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelation]: + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + def find_info_by_from(self, from_id: EntityId, + relation_type_group: Optional[str] = None) -> List[EntityRelationInfo]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_info_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def get_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> EntityRelation: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.get_relation_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_by_from_v1(self, from_id: EntityId, from_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelation]: + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get1(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def find_by_from(self, from_id: EntityId, relation_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + # Entity View Controller + def get_tenant_entity_view(self, entity_view_name: str) -> EntityView: + return self.entity_view_controller.get_tenant_entity_view_using_get(entity_view_name=entity_view_name) + + def get_tenant_entity_views(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityView: + return self.entity_view_controller.get_tenant_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_view_by_id(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_by_id_using_get(entity_view_id=entity_view_id) + + def find_by_query_v4(self, body: Optional[EntityViewSearchQuery] = None) -> List[EntityView]: + return self.entity_view_controller.find_by_query_using_post4(body=body) + + def get_entity_view_types(self) -> List[EntitySubtype]: + return self.entity_view_controller.get_entity_view_types_using_get() + + def delete_entity_view(self, entity_view_id: EntityViewId) -> None: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.delete_entity_view_using_delete(entity_view_id=entity_view_id) + + def get_customer_entity_views(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEntityView: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_views_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Admin Controller + def send_test_sms(self, body: Optional[TestSmsRequest] = None) -> None: + return self.admin_controller.send_test_sms_using_post(body=body) + + def check_updates(self) -> UpdateMessage: + return self.admin_controller.check_updates_using_get() + + def get_security_settings(self) -> SecuritySettings: + return self.admin_controller.get_security_settings_using_get() + + def send_test_mail(self, body: Optional[AdminSettings] = None) -> None: + return self.admin_controller.send_test_mail_using_post(body=body) + + def save_admin_settings(self, body: Optional[AdminSettings] = None) -> AdminSettings: + return self.admin_controller.save_admin_settings_using_post(body=body) + + def save_security_settings(self, body: Optional[SecuritySettings] = None) -> SecuritySettings: + return self.admin_controller.save_security_settings_using_post(body=body) + + def get_repository_settings(self) -> RepositorySettings: + return self.admin_controller.get_repository_settings_using_get() + + def save_repository_settings(self, body: Optional[RepositorySettings] = None) -> DeferredResultRepositorySettings: + return self.admin_controller.save_repository_settings_using_post(body=body) + + def delete_repository_settings(self) -> DeferredResultVoid: + return self.admin_controller.delete_repository_settings_using_delete() + + def repository_settings_exists(self) -> bool: + return self.admin_controller.repository_settings_exists_using_get() + + def check_repository_access(self, body: Optional[RepositorySettings] = None) -> DeferredResultVoid: + return self.admin_controller.check_repository_access_using_post(body=body) + + def delete_auto_commit_settings(self) -> None: + return self.admin_controller.delete_auto_commit_settings_using_delete() + + def auto_commit_settings_exists(self) -> bool: + return self.admin_controller.auto_commit_settings_exists_using_get() + + def save_auto_commit_settings(self, body: Optional[Dict[str, AutoVersionCreateConfig]] = None) -> Dict[str, AutoVersionCreateConfig]: + return self.admin_controller.save_auto_commit_settings_using_post(body=body) + + def get_auto_commit_settings(self) -> Dict[str, AutoVersionCreateConfig]: + return self.admin_controller.get_auto_commit_settings_using_get() + + def get_jwt_setting(self) -> JWTSettings: + return self.admin_controller.get_jwt_settings_using_get() + + def save_jwt_settings(self, body: Optional[JWTSettings] = None) -> JWTPair: + return self.admin_controller.save_jwt_settings_using_post(body=body) + + # TB Resource Controller + def get_resource_info_by_id(self, resource_id: EntityId) -> TbResourceInfo: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_info_by_id_using_get(resource_id=resource_id) + + def delete_resource_v1(self, resource_id: EntityId): + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.delete_resource_using_delete1(resource_id=resource_id) + + def get_resource_by_id(self, resource_id: EntityId) -> None: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_by_id_using_get(resource_id=resource_id) + + def save_resource(self, body: Optional[TbResource] = None) -> TbResource: + return self.tb_resource_controller.save_resource_using_post(body=body) + + def get_resources(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTbResourceInfo: + return self.tb_resource_controller.get_resources_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_lwm2m_list_objects(self, sort_order: str, sort_property: str, object_ids: list) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_using_get(sort_order=sort_order, + sort_property=sort_property, + object_ids=str(object_ids)) + + def download_resource(self, resource_id: EntityId) -> Resource: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.download_resource_using_get(resource_id=resource_id) + + def get_lwm2m_list_objects_page(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_page_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_repository_settings_info(self) -> RepositorySettingsInfo: + return self.admin_controller.get_repository_settings_info_using_get() + + # O Auth 2 Controller + def get_login_processing_url(self) -> str: + return self.o_auth2_controller.get_login_processing_url_using_get() + + def get_current_o_auth2_info(self) -> OAuth2Info: + return self.o_auth2_controller.get_current_o_auth2_info_using_get() + + def save_o_auth2_info(self, body: Optional[OAuth2Info] = None) -> OAuth2Info: + return self.o_auth2_controller.save_o_auth2_info_using_post(body=body) + + def get_o_auth2_clients(self, pkg_name: Optional[str] = None, platform: Optional[str] = None) -> List[OAuth2ClientInfo]: + return self.o_auth2_controller.get_o_auth2_clients_using_post(pkg_name=pkg_name, platform=platform) + + # Tenant Profile Controller + def get_default_tenant_profile_info(self) -> EntityInfo: + return self.tenant_profile_controller.get_default_tenant_profile_info_using_get() + + def save_tenant_profile(self, body: Optional[TenantProfile] = None) -> TenantProfile: + return self.tenant_profile_controller.save_tenant_profile_using_post(body=body) + + def get_tenant_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantProfile: + return self.tenant_profile_controller.get_tenant_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_tenant_profile(self, tenant_profile_id: TenantProfileId) -> None: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.delete_tenant_profile_using_delete(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_info_by_id(self, tenant_profile_id: TenantProfileId) -> EntityInfo: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_info_by_id_using_get( + tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_by_id(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_by_id_using_get(tenant_profile_id=tenant_profile_id) + + def set_default_tenant_profile(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.set_default_tenant_profile_using_post(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityInfo: + return self.tenant_profile_controller.get_tenant_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Widgets Bundle Controller + def get_widgets_bundle_by_id(self, widgets_bundle_id: WidgetsBundleId) -> WidgetsBundle: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.get_widgets_bundle_by_id_using_get(widgets_bundle_id=widgets_bundle_id) + + def save_widgets_bundle(self, body: Optional[WidgetsBundle] = None) -> WidgetsBundle: + return self.widgets_bundle_controller.save_widgets_bundle_using_post(body=body) + + def get_widgets_bundles_v1(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataWidgetsBundle: + return self.widgets_bundle_controller.get_widgets_bundles_using_get1(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_widgets_bundle(self, widgets_bundle_id: WidgetsBundleId) -> None: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.delete_widgets_bundle_using_delete(widgets_bundle_id=widgets_bundle_id) + + def get_widgets_bundles(self, ): + return self.widgets_bundle_controller.get_widgets_bundles_using_get() + + # Device Profile Controller + def get_device_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + transport_type: Optional[str] = None) -> PageDataDeviceProfileInfo: + return self.device_profile_controller.get_device_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + transport_type=transport_type) + + def set_default_device_profile(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.set_default_device_profile_using_post(device_profile_id=device_profile_id) + + def delete_device_profile(self, device_profile_id: DeviceProfileId) -> None: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.delete_device_profile_using_delete(device_profile_id=device_profile_id) + + def get_attributes_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_attributes_keys_using_get(device_profile_id=device_profile_id) + + def save_device_profile(self, body: Optional[DeviceProfile] = None) -> DeviceProfile: + return self.device_profile_controller.save_device_profile_using_post(body=body) + + def get_default_device_profile_info(self) -> DeviceProfileInfo: + return self.device_profile_controller.get_default_device_profile_info_using_get() + + def get_timeseries_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_timeseries_keys_using_get(device_profile_id=device_profile_id) + + def get_device_profile_info_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfileInfo: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_info_by_id_using_get( + device_profile_id=device_profile_id) + + def get_device_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDeviceProfile: + return self.device_profile_controller.get_device_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_device_profile_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_by_id_using_get(device_profile_id=device_profile_id) + + # Dashboard Controller + def get_tenant_dashboards_v1(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + tenant_id = self.get_id(tenant_id) + return self.dashboard_controller.get_tenant_dashboards_using_get1(tenant_id=tenant_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_info_by_id(self, dashboard_id: DashboardId) -> DashboardInfo: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_info_by_id_using_get(dashboard_id=dashboard_id) + + def get_home_dashboard(self) -> HomeDashboard: + return self.dashboard_controller.get_home_dashboard_using_get() + + def set_tenant_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_tenant_home_dashboard_info_using_post(body=body) + + def get_server_time(self) -> int: + return self.dashboard_controller.get_server_time_using_get() + + def get_highest_alarm_severity(self, entity_id: EntityId, search_status: Optional[str] = None, + status: Optional[str] = None, assignee_id: Optional[str] = None) -> str: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.alarm_controller.get_highest_alarm_severity_using_get(entity_id=entity_id, entity_type=entity_type, + search_status=search_status, status=status, + assignee_id=assignee_id) + + def get_max_datapoints_limit(self) -> int: + return self.dashboard_controller.get_max_datapoints_limit_using_get() + + def get_home_dashboard_info(self) -> HomeDashboardInfo: + return self.dashboard_controller.get_home_dashboard_info_using_get() + + def get_dashboard_by_id(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_by_id_using_get(dashboard_id=dashboard_id) + + def get_tenant_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_tenant_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_dashboard(self, dashboard_id: DashboardId) -> None: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.delete_dashboard_using_delete(dashboard_id=dashboard_id) + + def get_tenant_home_dashboard_info(self) -> HomeDashboardInfo: + return self.dashboard_controller.get_tenant_home_dashboard_info_using_get() + + # Entity Query Controller + def find_entity_timeseries_and_attributes_keys_by_query(self, timeseries: bool, attributes: bool, body: Optional[ + EntityDataQuery]): + return self.entity_query_controller.find_entity_timeseries_and_attributes_keys_by_query_using_post( + timeseries=timeseries, attributes=attributes, body=body) + + def find_alarm_data_by_query(self, body: Optional[AlarmDataQuery] = None) -> PageDataAlarmData: + return self.entity_query_controller.find_alarm_data_by_query_using_post(body=body) + + def find_entity_data_by_query(self, body: Optional[EntityDataQuery] = None) -> PageDataEntityData: + return self.entity_query_controller.find_entity_data_by_query_using_post(body=body) + + # Widget Type Controller + def get_bundle_widget_types_infos(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeInfo]: + return self.widget_type_controller.get_bundle_widget_types_infos_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_bundle_widget_types_details(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeDetails]: + return self.widget_type_controller.get_bundle_widget_types_details_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def delete_widget_type(self, widget_type_id: WidgetTypeId) -> None: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.delete_widget_type_using_delete(widget_type_id=widget_type_id) + + def save_widget_type(self, body: Optional[WidgetTypeDetails] = None) -> WidgetTypeDetails: + return self.widget_type_controller.save_widget_type_using_post(body=body) + + def get_bundle_widget_types(self, is_system: bool, bundle_alias: str) -> List[WidgetType]: + return self.widget_type_controller.get_bundle_widget_types_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_widget_type(self, is_system: bool, bundle_alias: str, alias: str): + return self.widget_type_controller.get_widget_type_using_get(is_system=is_system, bundle_alias=bundle_alias, + alias=alias) + + def get_widget_type_by_id(self, widget_type_id: WidgetTypeId) -> WidgetType: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.get_widget_type_by_id_using_get(widget_type_id=widget_type_id) + + # Audit Log Controller + def get_audit_logs_by_customer_id(self, customer_id: CustomerId, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + customer_id = self.get_id(customer_id) + return self.audit_log_controller.get_audit_logs_by_customer_id_using_get(customer_id=customer_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, + end_time=end_time, + action_types=action_types) + + def get_audit_logs_by_user_id(self, user_id: UserId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + user_id = self.get_id(user_id) + return self.audit_log_controller.get_audit_logs_by_user_id_using_get(user_id=user_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + def get_audit_logs(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + return self.audit_log_controller.get_audit_logs_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time, action_types=action_types) + + def get_audit_logs_by_entity_id(self, entity_id: EntityId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None, action_types: Optional[str] = None) -> PageDataAuditLog: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.audit_log_controller.get_audit_logs_by_entity_id_using_get(entity_type=entity_type, + entity_id=entity_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + # Lwm2M Controller + def get_lwm2m_bootstrap_security_info(self, is_bootstrap_server: bool) -> ServerSecurityConfig: + return self.lwm2m_controller.get_lwm2m_bootstrap_security_info_using_get( + is_bootstrap_server=is_bootstrap_server) + + # Component Descriptor Controller + def get_component_descriptors_by_type(self, component_type: str, + rule_chain_type: Optional[str] = None) -> List[ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_type_using_get( + component_type=component_type, rule_chain_type=rule_chain_type) + + def get_component_descriptor_by_clazz(self, component_descriptor_clazz: str) -> ComponentDescriptor: + return self.component_descriptor_controller.get_component_descriptor_by_clazz_using_get( + component_descriptor_clazz=component_descriptor_clazz) + + def get_component_descriptors_by_types(self, component_types: str, + rule_chain_type: Optional[str] = None) -> List[ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_types_using_get( + component_types=component_types, rule_chain_type=rule_chain_type) + + # UI Controller + def get_help_base_url(self) -> str: + return self.ui_settings_controller.get_help_base_url_using_get() + + # Device API Controller + def subscribe_to_attributes(self, device_token: str, timeout: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.subscribe_to_attributes_using_get(device_token=device_token, timeout=timeout) + + def subscribe_to_commands(self, device_token: str, timeout: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.subscribe_to_commands_using_get(device_token=device_token, timeout=timeout) + + def get_device_attributes(self, device_token: str, client_keys: str, + shared_keys: str) -> DeferredResultResponseEntity: + return self.device_api_controller.get_device_attributes_using_get(device_token=device_token, + client_keys=client_keys, + shared_keys=shared_keys) + + def get_firmware(self, device_token: str, title: str, version: str, size: Optional[int] = None, + chunk: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.get_firmware_using_get(device_token=device_token, title=title, + version=version, size=size, chunk=chunk) + + def reply_to_command(self, device_token: str, request_id: int, + body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.reply_to_command_using_post(device_token=device_token, request_id=request_id, + body=body) + + def get_software(self, device_token: str, title: str, version: str, size: Optional[int] = None, + chunk: Optional[int] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.get_software_using_get(device_token=device_token, title=title, + version=version, size=size, chunk=chunk) + + def post_telemetry(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.post_telemetry_using_post(device_token=device_token, body=body) + + def claim_device(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.claim_device_using_post(device_token=device_token, body=body) + + def post_rpc_request(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.post_rpc_request_using_post(device_token=device_token, body=body) + + def provision_device(self, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.provision_device_using_post(body=body) + + def post_device_attributes(self, device_token: str, body: Optional[str] = None) -> DeferredResultResponseEntity: + return self.device_api_controller.post_device_attributes_using_post(device_token=device_token, body=body) + + # Tenant Controller + def get_tenant_infos(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantInfo: + return self.tenant_controller.get_tenant_infos_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_by_id(self, tenant_id: TenantId) -> Tenant: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_by_id_using_get(tenant_id=tenant_id) + + def save_tenant(self, body: Optional[Tenant] = None) -> Tenant: + return self.tenant_controller.save_tenant_using_post(body=body) + + def get_tenants(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenant: + return self.tenant_controller.get_tenants_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_info_by_id(self, tenant_id: TenantId) -> TenantInfo: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_info_by_id_using_get(tenant_id=tenant_id) + + def delete_tenant(self, tenant_id: TenantId) -> None: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.delete_tenant_using_delete(tenant_id=tenant_id) + + # OTA Package Controller + def delete_ota_package(self, ota_package_id: OtaPackageId) -> None: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.delete_ota_package_using_delete(ota_package_id=ota_package_id) + + def save_ota_package_data(self, ota_package_id: OtaPackageId, checksum: Optional[str] = None, + checksum_algorithm: Optional[str] = None, file: Optional[str] = None) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.save_ota_package_data_using_post(ota_package_id=ota_package_id, + checksum=checksum, + checksum_algorithm=checksum_algorithm, + file=file) + + def get_ota_packages_v1(self, device_profile_id: DeviceProfileId, type: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + device_profile_id = self.get_id(device_profile_id) + return self.ota_package_controller.get_ota_packages_using_get1(device_profile_id=device_profile_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_ota_package_info(self, body: Optional[SaveOtaPackageInfoRequest] = None) -> OtaPackageInfo: + return self.ota_package_controller.save_ota_package_info_using_post(body=body) + + def get_ota_packages(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + return self.ota_package_controller.get_ota_packages_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_ota_package_by_id(self, ota_package_id: OtaPackageId) -> OtaPackage: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_by_id_using_get(ota_package_id=ota_package_id) + + def download_ota_package(self, ota_package_id: OtaPackageId) -> Resource: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.download_ota_package_using_get(ota_package_id=ota_package_id) + + def get_ota_package_info_by_id(self, ota_package_id: OtaPackageId) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_info_by_id_using_get(ota_package_id=ota_package_id) + + def save_entities_version(self, body: Optional[VersionCreateRequest] = None) -> str: + return self.entities_version_control_controller.save_entities_version_using_post(body=body) + + def get_version_load_request_status(self, request_id: str) -> VersionLoadResult: + return self.entities_version_control_controller.get_version_load_request_status_using_get(request_id=request_id) + + def list_branches(self): + return self.entities_version_control_controller.list_branches_using_get() + + def list_entity_versions(self, entity_type: str, external_entity_uuid: str, branch: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + return self.entities_version_control_controller.list_entity_versions_using_get(entity_type=entity_type, + external_entity_uuid=external_entity_uuid, + branch=branch, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_data_info(self, version_id: str, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entities_version_control_controller.get_entity_data_info_using_get(version_id=version_id, + entity_type=entity_type, + external_entity_uuid=entity_id) + + def get_version_create_request_status(self, request_id: str) -> VersionCreationResult: + return self.entities_version_control_controller.get_version_create_request_status_using_get( + request_id=request_id) + + def load_entities_version(self, body: Optional[VersionLoadRequest] = None) -> str: + return self.entities_version_control_controller.load_entities_version_using_post(body=body) + + def list_entity_type_versions(self, entity_type: str, branch: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + return self.entities_version_control_controller.list_entity_type_versions_using_get(entity_type=entity_type, + branch=branch, + page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def list_entities_at_version(self, entity_type: str, version_id: str): + return self.entities_version_control_controller.list_entities_at_version_using_get(entity_type=entity_type, + version_id=version_id) + + def list_all_entities_at_version(self, version_id: str): + return self.entities_version_control_controller.list_all_entities_at_version_using_get(version_id=version_id) + + def compare_entity_data_to_version(self, entity_id: EntityId, + version_id: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entities_version_control_controller.compare_entity_data_to_version_using_get( + entity_type=entity_type, internal_entity_uuid=entity_id, version_id=version_id) + + def list_versions(self, branch: str, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + return self.entities_version_control_controller.list_versions_using_get(branch=branch, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_queue(self, queue_id: QueueId) -> None: + queue_id = self.get_id(queue_id) + return self.queue_controller.delete_queue_using_delete(queue_id=queue_id) + + def get_queue_by_id(self, queue_id: QueueId) -> Queue: + queue_id = self.get_id(queue_id) + return self.queue_controller.get_queue_by_id_using_get(queue_id=queue_id) + + def get_queue_by_name(self, queue_name: str) -> Queue: + return self.queue_controller.get_queue_by_name_using_get(queue_name=queue_name) + + # Two-Factor Auth Controller + def check_two_fa_verification_code(self, provider_type: str, verification_code: str) -> JWTPair: + return self.two_factor_auth_controller.check_two_fa_verification_code_using_post(provider_type=provider_type, + verification_code=verification_code) + + def get_available_two_fa_providers_v1(self, ) -> List[TwoFaProviderInfo]: + return self.two_factor_auth_controller.get_available_two_fa_providers_using_get1() + + def request_two_fa_verification_code(self, provider_type: str) -> None: + return self.two_factor_auth_controller.request_two_fa_verification_code_using_post(provider_type=provider_type) + + # Tow Factor Auth Config Controller + def delete_two_fa_account_config(self, provider_type: str) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.delete_two_fa_account_config_using_delete(provider_type=provider_type) + + def generate_two_fa_account_config(self, provider_type: str) -> TwoFaAccountConfig: + return self.two_factor_auth_config_controller.generate_two_fa_account_config_using_post(provider_type=provider_type) + + def get_account_two_fa_settings(self) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.get_account_two_fa_settings_using_get() + + def get_available_two_fa_providers(self) -> List[str]: + return self.two_factor_auth_config_controller.get_available_two_fa_providers_using_get() + + def get_platform_two_fa_settings(self) -> PlatformTwoFaSettings: + return self.two_factor_auth_config_controller.get_platform_two_fa_settings_using_get() + + def save_platform_two_fa_settings(self, body: PlatformTwoFaSettings) -> PlatformTwoFaSettings: + return self.two_factor_auth_config_controller.save_platform_two_fa_settings_using_post(body=body) + + def submit_two_fa_account_config(self, body: TwoFaAccountConfig): + return self.two_factor_auth_config_controller.submit_two_fa_account_config_using_post(body=body) + + def update_two_fa_account_config(self, provider_type: str, body: TwoFaAccountConfigUpdateRequest) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.update_two_fa_account_config_using_put(provider_type=provider_type, body=body) + + def verify_and_save_two_fa_account_config(self, body: TwoFaAccountConfig, verification_code: str) -> AccountTwoFaSettings: + return self.two_factor_auth_config_controller.verify_and_save_two_fa_account_config_using_post(body=body, verification_code=verification_code) + + def create_notification_request(self, body: NotificationRequest) -> NotificationRequest: + return self.notification_controller.create_notification_request_using_post(body=body) + + def delete_notification_request(self, id: str): + return self.notification_controller.delete_notification_request_using_delete(id=id) + + def delete_notification(self, id: str): + return self.notification_controller.delete_notification_using_delete(id=id) + + def get_available_delivery_methods(self) -> List[str]: + return self.notification_controller.get_available_delivery_methods_using_get() + + def get_notification_request_by_id(self, id: str) -> NotificationRequestInfo: + return self.notification_controller.get_notification_request_by_id_using_get(id=id) + + def get_notification_request_preview(self, body: NotificationRequest, + recipients_preview_size: Optional[int] = None): + return self.notification_controller.get_notification_request_preview_using_post(body=body, + recipients_preview_size=recipients_preview_size) + + def get_notification_requests(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationRequestInfo: + return self.notification_controller.get_notification_requests_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_notification_settings(self) -> NotificationSettings: + return self.notification_controller.get_notification_settings_using_get() + + def get_notifications(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotification: + return self.notification_controller.get_notifications_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def mark_all_notifications_as_read(self): + return self.notification_controller.mark_all_notifications_as_read_using_put() + + def mark_notification_as_read(self, id: str): + return self.notification_controller.mark_notification_as_read_using_put(id=id) + + def save_notification_settings(self, body: NotificationSettings) -> NotificationSettings: + return self.notification_controller.save_notification_settings_using_post(body=body) + + def delete_notification_rule(self, id: str): + return self.notification_rule_controller.delete_notification_rule_using_delete(id=id) + + def get_notification_rule_by_id(self, id: str) -> NotificationRuleInfo: + return self.notification_rule_controller.get_notification_rule_by_id_using_get(id=id) + + def get_notification_rules(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationRuleInfo: + return self.notification_rule_controller.get_notification_rules_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_notification_rule(self, body: NotificationRule) -> NotificationRule: + return self.notification_rule_controller.save_notification_rule_using_post(body=body) + + def delete_notification_target_by_id(self, id: str): + return self.notification_target_controller.delete_notification_target_by_id_using_delete(id=id) + + def get_notification_target_by_id(self, id: str) -> NotificationTarget: + return self.notification_target_controller.get_notification_target_by_id_using_get(id=id) + + def get_notification_targets_by_ids(self, ids: list) -> List[NotificationTarget]: + ids = ','.join(ids) + return self.notification_target_controller.get_notification_targets_by_ids_using_get(ids=ids) + + def get_notification_targets_by_supported_notification_type(self, notification_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataNotificationTarget: + return self.notification_target_controller.get_notification_targets_by_supported_notification_type_using_get( + notification_type=notification_type, page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_notification_targets(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationTarget: + return self.notification_target_controller.get_notification_targets_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_recipients_for_notification_target_config(self, page_size: int, page: int): + return self.notification_target_controller.get_recipients_for_notification_target_config_using_post( + page_size=page_size, page=page) + + def save_notification_target(self, body: NotificationTarget) -> NotificationTarget: + return self.notification_target_controller.save_notification_target_using_post(body=body) + + def delete_notification_template_by_id(self, id: str): + return self.notification_template_controller.delete_notification_template_by_id_using_delete(id=id) + + def get_notification_template_by_id(self, id: str) -> NotificationTemplate: + return self.notification_template_controller.get_notification_template_by_id_using_get(id=id) + + def get_notification_templates(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataNotificationTemplate: + return self.notification_template_controller.get_notification_templates_using_get(page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def list_slack_conversations(self, type: str, token: Optional[str] = None) -> List[SlackConversation]: + return self.notification_template_controller.list_slack_conversations_using_get(type=type, token=token) + + def save_notification_template(self, body: NotificationTemplate) -> NotificationTemplate: + return self.notification_template_controller.save_notification_template_using_post(body=body) + + def __load_controllers(self): + self.audit_log_controller = AuditLogControllerApi(self.api_client) + self.o_auth2_config_template_controller = OAuth2ConfigTemplateControllerApi(self.api_client) + self.entity_view_controller = EntityViewControllerApi(self.api_client) + self.entity_query_controller = EntityQueryControllerApi(self.api_client) + self.o_auth2_controller = OAuth2ControllerApi(self.api_client) + self.entity_relation_controller = EntityRelationControllerApi(self.api_client) + self.rpc_v2_controller = RpcV2ControllerApi(self.api_client) + self.edge_controller = EdgeControllerApi(self.api_client) + self.admin_controller = AdminControllerApi(self.api_client) + self.user_controller = UserControllerApi(self.api_client) + self.asset_controller = AssetControllerApi(self.api_client) + self.widgets_bundle_controller = WidgetsBundleControllerApi(self.api_client) + self.tenant_profile_controller = TenantProfileControllerApi(self.api_client) + self.event_controller = EventControllerApi(self.api_client) + self.lwm2m_controller = Lwm2mControllerApi(self.api_client) + self.dashboard_controller = DashboardControllerApi(self.api_client) + self.component_descriptor_controller = ComponentDescriptorControllerApi(self.api_client) + self.device_profile_controller = DeviceProfileControllerApi(self.api_client) + self.customer_controller = CustomerControllerApi(self.api_client) + self.telemetry_controller = TelemetryControllerApi(self.api_client) + self.tenant_controller = TenantControllerApi(self.api_client) + self.rpc_v1_controller = RpcV1ControllerApi(self.api_client) + self.widget_type_controller = WidgetTypeControllerApi(self.api_client) + self.device_controller = DeviceControllerApi(self.api_client) + self.device_api_controller = DeviceApiControllerApi(self.api_client) + self.rule_chain_controller = RuleChainControllerApi(self.api_client) + self.tb_resource_controller = TbResourceControllerApi(self.api_client) + self.auth_controller = AuthControllerApi(self.api_client) + self.queue_controller = QueueControllerApi(self.api_client) + self.ota_package_controller = OtaPackageControllerApi(self.api_client) + self.alarm_controller = AlarmControllerApi(self.api_client) + self.edge_event_controller = EdgeEventControllerApi(self.api_client) + self.ui_settings_controller = UiSettingsControllerApi(self.api_client) + self.entities_version_control_controller = EntitiesVersionControlControllerApi(self.api_client) + self.two_factor_auth_controller = TwoFactorAuthControllerApi(self.api_client) + self.alarm_comment_controller = AlarmCommentControllerApi(self.api_client) + self.notification_target_controller = NotificationTargetControllerApi(self.api_client) + self.usage_info_controller = UsageInfoControllerApi(self.api_client) + self.notification_rule_controller = NotificationRuleControllerApi(self.api_client) + self.notification_controller = NotificationControllerApi(self.api_client) + self.notification_template_controller = NotificationTemplateControllerApi(self.api_client) + self.asset_profile_controller = AssetProfileControllerApi(self.api_client) + self.two_factor_auth_config_controller = TwoFactorAuthConfigControllerApi(self.api_client) + + @staticmethod + def get_type(type): + return type.entity_type if hasattr(type, "entity_type") else type + + @staticmethod + def get_id(id): + return id.id if hasattr(id, "id") else id diff --git a/tb-rest-client/python/tb_rest_client/rest_client_ce.py b/tb-rest-client/python/tb_rest_client/rest_client_ce.py new file mode 100644 index 0000000..1a8f799 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/rest_client_ce.py @@ -0,0 +1,1348 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from tb_rest_client.rest_client_base import * + +logger = getLogger(__name__) + + +class RestClientCE(RestClientBase): + def __init__(self, base_url): + super().__init__(base_url) + + # O Auth 2 Config Template Controller + def delete_client_registration_template(self, client_registration_template_id: EntityId) -> None: + client_registration_template_id = self.get_id(client_registration_template_id) + return self.o_auth2_config_template_controller.delete_client_registration_template_using_delete( + client_registration_template_id=client_registration_template_id) + + def get_client_registration_templates(self) -> List[OAuth2ClientRegistrationTemplate]: + return self.o_auth2_config_template_controller.get_client_registration_templates_using_get() + + def save_client_registration_template(self, body: Optional[ + OAuth2ClientRegistrationTemplate] = None) -> OAuth2ClientRegistrationTemplate: + return self.o_auth2_config_template_controller.save_client_registration_template_using_post(body=body) + + # Asset Controller + def assign_asset_to_edge(self, edge_id: EdgeId, asset_id: AssetId) -> Asset: + edge_id = self.get_id(edge_id) + asset_id = self.get_id(asset_id) + return self.asset_controller.assign_asset_to_edge_using_post(edge_id=edge_id, asset_id=asset_id) + + def get_tenant_asset_infos(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAssetInfo: + + if asset_profile_id: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_tenant_asset_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, asset_profile_id=asset_profile_id) + + def process_assets_bulk_import(self, body: BulkImportRequest) -> BulkImportResultAsset: + return self.asset_controller.process_assets_bulk_import_using_post(body=body) + + def unassign_asset_from_edge(self, edge_id: EdgeId, asset_id: AssetId) -> Asset: + edge_id = self.get_id(edge_id) + asset_id = self.get_id(asset_id) + return self.asset_controller.unassign_asset_from_edge_using_delete(edge_id=edge_id, asset_id=asset_id) + + def get_edge_assets(self, edge_id: EdgeId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataAsset: + edge_id = self.get_id(edge_id) + return self.asset_controller.get_edge_assets_using_get(edge_id=edge_id, page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + def assign_asset_to_customer(self, customer_id: CustomerId, asset_id: AssetId) -> Asset: + customer_id = self.get_id(customer_id) + asset_id = self.get_id(asset_id) + return self.asset_controller.assign_asset_to_customer_using_post(customer_id=customer_id, asset_id=asset_id) + + def unassign_asset_from_customer(self, asset_id: AssetId) -> Asset: + asset_id = self.get_id(asset_id) + return self.asset_controller.unassign_asset_from_customer_using_delete(asset_id=asset_id) + + def assign_asset_to_public_customer(self, asset_id: AssetId) -> Asset: + asset_id = self.get_id(asset_id) + return self.asset_controller.assign_asset_to_public_customer_using_post(asset_id=asset_id) + + def save_asset(self, body: Optional[Asset] = None) -> Asset: + return self.asset_controller.save_asset_using_post(body=body) + + # Edge Controller + def get_tenant_edge_infos(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdgeInfo: + return self.edge_controller.get_tenant_edge_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edge_info_by_id(self, edge_id: EdgeId) -> EdgeInfo: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_info_by_id_using_get(edge_id=edge_id) + + def get_customer_edge_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdgeInfo: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edge_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def assign_edge_to_customer(self, customer_id: CustomerId, edge_id: EdgeId) -> Edge: + customer_id = self.get_id(customer_id) + edge_id = self.get_id(edge_id) + return self.edge_controller.assign_edge_to_customer_using_post(customer_id=customer_id, edge_id=edge_id) + + def find_by_query_v2(self, body: Optional[EdgeSearchQuery] = None) -> List[Edge]: + return self.edge_controller.find_by_query_using_post2(body=body) + + def get_tenant_edges(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_tenant_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def find_missing_to_related_rule_chains(self, edge_id: EdgeId) -> str: + edge_id = self.get_id(edge_id) + return self.edge_controller.find_missing_to_related_rule_chains_using_get(edge_id=edge_id) + + def get_customer_edges(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edges_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def process_edges_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultEdge: + return self.edge_controller.process_edges_bulk_import_using_post(body=body) + + def activate_instance(self, license_secret: str, release_date: str) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.edge_controller.activate_instance_using_post(license_secret=license_secret, + release_date=release_date) + + def get_tenant_edge(self, edge_name: str) -> Edge: + return self.edge_controller.get_tenant_edge_using_get(edge_name=edge_name) + + def get_edge_by_id(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_by_id_using_get(edge_id=edge_id) + + def delete_edge(self, edge_id: EdgeId) -> None: + edge_id = self.get_id(edge_id) + return self.edge_controller.delete_edge_using_delete(edge_id=edge_id) + + def save_edge(self, body: Optional[Edge] = None) -> Edge: + return self.edge_controller.save_edge_using_post(body=body) + + def is_edges_support_enabled(self, ) -> bool: + return self.edge_controller.is_edges_support_enabled_using_get() + + def get_edges(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_edges_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def unassign_edge_from_customer(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.unassign_edge_from_customer_using_delete(edge_id=edge_id) + + def assign_edge_to_public_customer(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.assign_edge_to_public_customer_using_post(edge_id=edge_id) + + def get_edge_types(self, ) -> List[EntitySubtype]: + return self.edge_controller.get_edge_types_using_get() + + def set_edge_root_rule_chain(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> Edge: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.edge_controller.set_edge_root_rule_chain_using_post(edge_id=edge_id, rule_chain_id=rule_chain_id) + + def get_edges_by_ids(self, edge_ids: list) -> List[Edge]: + return self.edge_controller.get_edges_by_ids_using_get(edge_ids=edge_ids) + + # Rule Chain Controller + def export_rule_chains(self, limit: int) -> RuleChainData: + return self.rule_chain_controller.export_rule_chains_using_get(limit=limit) + + def delete_rule_chain(self, rule_chain_id: RuleChainId) -> None: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.delete_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def set_edge_template_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_edge_template_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def save_rule_chain(self, body: Optional[DefaultRuleChainCreateRequest] = None) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post(body=body) + + def assign_rule_chain_to_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.assign_rule_chain_to_edge_using_post(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def unassign_rule_chain_from_edge(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> RuleChain: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unassign_rule_chain_from_edge_using_delete(edge_id=edge_id, + rule_chain_id=rule_chain_id) + + def unset_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.unset_auto_assign_to_edge_rule_chain_using_delete(rule_chain_id=rule_chain_id) + + def get_rule_chain_by_id(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_by_id_using_get(rule_chain_id=rule_chain_id) + + def test_script(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.rule_chain_controller.test_script_using_post(body=body) + + def save_rule_chain_v1(self, body: Optional[RuleChain] = None) -> RuleChain: + return self.rule_chain_controller.save_rule_chain_using_post1(body=body) + + def get_edge_rule_chains(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + edge_id = self.get_id(edge_id) + return self.rule_chain_controller.get_edge_rule_chains_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def set_auto_assign_to_edge_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_auto_assign_to_edge_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def import_rule_chains(self, body: Optional[RuleChainData] = None, overwrite: Optional[bool] = None) -> List[ + RuleChainImportResult]: + return self.rule_chain_controller.import_rule_chains_using_post(body=body, overwrite=overwrite) + + def set_root_rule_chain(self, rule_chain_id: RuleChainId) -> RuleChain: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.set_root_rule_chain_using_post(rule_chain_id=rule_chain_id) + + def get_rule_chains(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataRuleChain: + return self.rule_chain_controller.get_rule_chains_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_auto_assign_to_edge_rule_chains(self, ) -> List[RuleChain]: + return self.rule_chain_controller.get_auto_assign_to_edge_rule_chains_using_get() + + def get_latest_rule_node_debug_input(self, rule_node_id: RuleNodeId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + rule_node_id = self.get_id(rule_node_id) + return self.rule_chain_controller.get_latest_rule_node_debug_input_using_get(rule_node_id=rule_node_id) + + def get_rule_chain_meta_data(self, rule_chain_id: RuleChainId) -> RuleChainMetaData: + rule_chain_id = self.get_id(rule_chain_id) + return self.rule_chain_controller.get_rule_chain_meta_data_using_get(rule_chain_id=rule_chain_id) + + # Auth Controller + def get_user(self, ) -> User: + return self.auth_controller.get_user_using_get() + + def change_password(self, body: Optional[ChangePasswordRequest] = None) -> ObjectNode: + return self.auth_controller.change_password_using_post(body=body) + + def logout(self, ) -> None: + return self.auth_controller.logout_using_post() + + def check_reset_token(self, reset_token: str) -> str: + return self.auth_controller.check_reset_token_using_get(reset_token=reset_token) + + def get_user_password_policy(self, ) -> UserPasswordPolicy: + return self.auth_controller.get_user_password_policy_using_get() + + def check_activate_token(self, activate_token: str) -> str: + return self.auth_controller.check_activate_token_using_get(activate_token=activate_token) + + def request_reset_password_by_email(self, body: Optional[ResetPasswordEmailRequest] = None) -> None: + return self.auth_controller.request_reset_password_by_email_using_post(body=body) + + # Event Controller + def get_events_v1_get1(self, entity_id: EntityId, event_type: str, tenant_id: TenantId, + page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataEvent: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + tenant_id = self.get_id(tenant_id) + return self.event_controller.get_events_using_get1(entity_type=entity_type, entity_id=entity_id, + event_type=event_type, tenant_id=tenant_id, + page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + # Telemetry Controller + def get_attribute_keys_by_scope(self, entity_id: EntityId, scope: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_by_scope_using_get(entity_type=entity_type, + entity_id=entity_id, scope=scope) + + def get_timeseries(self, entity_id: EntityId, keys: str, start_ts: int, end_ts: int, + interval: Optional[int] = None, limit: Optional[int] = None, agg: Optional[str] = None, order_by: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, start_ts=start_ts, end_ts=end_ts, + interval=interval, limit=limit, agg=agg, + order_by=order_by, + use_strict_data_types=use_strict_data_types) + + def delete_device_attributes(self, device_id: DeviceId, scope: str, keys: str): + device_id = self.get_id(device_id) + return self.telemetry_controller.delete_device_attributes_using_delete(device_id=device_id, scope=scope, + keys=keys) + + def delete_entity_timeseries(self, entity_id: EntityId, keys: str, delete_all_data_for_keys: Optional[bool] = None, + start_ts: Optional[int] = None, end_ts: Optional[int] = None, + rewrite_latest_if_deleted: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_timeseries_using_delete(entity_type=entity_type, + entity_id=entity_id, keys=keys, + delete_all_data_for_keys=delete_all_data_for_keys, + start_ts=start_ts, end_ts=end_ts, + rewrite_latest_if_deleted=rewrite_latest_if_deleted) + + def save_entity_attributes_v1(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v1_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def save_device_attributes(self, device_id: DeviceId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + device_id = self.get_id(device_id) + return self.telemetry_controller.save_device_attributes_using_post(device_id=device_id, scope=scope, body=body) + + def get_latest_timeseries(self, entity_id: EntityId, keys: Optional[str] = None, + use_strict_data_types: Optional[bool] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_latest_timeseries_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys, + use_strict_data_types=use_strict_data_types) + + def get_timeseries_keys_v1(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_timeseries_keys_using_get1(entity_type=entity_type, entity_id=entity_id) + + def get_attributes_by_scope(self, entity_id: EntityId, scope: str, + keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_by_scope_using_get(entity_type=entity_type, entity_id=entity_id, + scope=scope, keys=keys) + + def get_attribute_keys(self, entity_id: EntityId): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attribute_keys_using_get(entity_type=entity_type, entity_id=entity_id) + + def save_entity_attributes_v2(self, entity_id: EntityId, scope: str, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_attributes_v2_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + body=body) + + def save_entity_telemetry(self, entity_id: EntityId, scope: str, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.save_entity_telemetry_using_post(entity_type=entity_type, entity_id=entity_id, + scope=scope, body=body) + + def save_entity_telemetry_with_ttl(self, entity_id: EntityId, scope: str, ttl: int, + body: Optional[dict] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + ttl = str(ttl) + return self.telemetry_controller.save_entity_telemetry_with_ttl_using_post(entity_type=entity_type, + entity_id=entity_id, scope=scope, + ttl=ttl, body=body) + + def get_attributes(self, entity_id: EntityId, keys: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.get_attributes_using_get(entity_type=entity_type, entity_id=entity_id, + keys=keys) + + def delete_entity_attributes(self, entity_id: EntityId, scope: str, keys: str): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.telemetry_controller.delete_entity_attributes_using_delete(entity_type=entity_type, + entity_id=entity_id, scope=scope, + keys=keys) + + # Alarm Controller + def clear_alarm(self, alarm_id: AlarmId) -> None: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.clear_alarm_using_post(alarm_id=alarm_id) + + # RPC v2 Controller + def get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def handle_one_way_device_rpc_request_v1(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_one_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request_v1(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_two_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def get_persisted_rpc_by_device(self, device_id: DeviceId, page_size: int, page: int, rpc_status: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.get_persisted_rpc_by_device_using_get(device_id=device_id, page_size=page_size, + page=page, rpc_status=rpc_status, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_resource(self, rpc_id: RpcId) -> None: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.delete_resource_using_delete(rpc_id=rpc_id) + + # Edge Event Controller + def get_edge_events(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEdgeEvent: + edge_id = self.get_id(edge_id) + return self.edge_event_controller.get_edge_events_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + # Customer Controller + def get_customer_title_by_id(self, customer_id: CustomerId) -> str: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_title_by_id_using_get(customer_id=customer_id) + + def get_customers(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataCustomer: + return self.customer_controller.get_customers_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_customer_by_id(self, customer_id: CustomerId) -> Customer: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_by_id_using_get(customer_id=customer_id) + + def get_short_customer_info_by_id(self, customer_id: CustomerId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_short_customer_info_by_id_using_get(customer_id=customer_id) + + def save_customer(self, body: Optional[Customer] = None) -> Customer: + return self.customer_controller.save_customer_using_post(body=body) + + def get_tenant_customer(self, customer_title: str) -> Customer: + return self.customer_controller.get_tenant_customer_using_get(customer_title=customer_title) + + def delete_customer(self, customer_id: CustomerId) -> None: + customer_id = self.get_id(customer_id) + return self.customer_controller.delete_customer_using_delete(customer_id=customer_id) + + # User Controller + def get_user_token(self, user_id: UserId) -> JWTPair: + user_id = self.get_id(user_id) + return self.user_controller.get_user_token_using_get(user_id=user_id) + + def get_activation_link(self, user_id: UserId) -> str: + user_id = self.get_id(user_id) + return self.user_controller.get_activation_link_using_get(user_id=user_id) + + def delete_user(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.delete_user_using_delete(user_id=user_id) + + def get_users(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUser: + return self.user_controller.get_users_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def set_user_credentials_enabled(self, user_id: UserId, user_credentials_enabled: Optional[bool] = None) -> None: + user_id = self.get_id(user_id) + return self.user_controller.set_user_credentials_enabled_using_post(user_id=user_id, + user_credentials_enabled=user_credentials_enabled) + + def get_customer_users(self, customer_id: CustomerId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataUser: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_users_using_get(customer_id=customer_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_user_by_id(self, user_id: UserId) -> User: + user_id = self.get_id(user_id) + return self.user_controller.get_user_by_id_using_get(user_id=user_id) + + def get_tenant_admins(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataUser: + tenant_id = self.get_id(tenant_id) + return self.user_controller.get_tenant_admins_using_get(tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def is_user_token_access_enabled(self, ) -> bool: + return self.user_controller.is_user_token_access_enabled_using_get() + + def save_user(self, body: Optional[User] = None, send_activation_mail: Optional[bool] = None) -> User: + return self.user_controller.save_user_using_post(body=body, send_activation_mail=send_activation_mail) + + def send_activation_email(self, email: str) -> None: + return self.user_controller.send_activation_email_using_post(email=email) + + # RPC v1 Controller + def handle_one_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_one_way_device_rpc_request_using_post(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request(self, device_id: DeviceId, + body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v1_controller.handle_two_way_device_rpc_request_using_post(device_id=device_id, body=body) + + # Device Controller + def get_device_types(self, ) -> List[EntitySubtype]: + return self.device_controller.get_device_types_using_get() + + def process_devices_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultDevice: + return self.device_controller.process_devices_bulk_import_using_post(body=body) + + def count_by_device_profile_and_empty_ota_package(self, ota_package_type: str, + device_profile_id: DeviceProfileId) -> int: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.count_by_device_profile_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, device_profile_id=device_profile_id) + + def get_devices_by_ids(self, device_ids: list) -> List[Device]: + device_ids = ','.join(device_ids) + return self.device_controller.get_devices_by_ids_using_get(device_ids=device_ids) + + def save_device_with_credentials(self, body: Optional[SaveDeviceWithCredentialsRequest] = None) -> Device: + return self.device_controller.save_device_with_credentials_using_post(body=body) + + def update_device_credentials(self, body: Optional[DeviceCredentials] = None) -> DeviceCredentials: + return self.device_controller.update_device_credentials_using_post(body=body) + + def save_device(self, body: Optional[Device] = None, access_token: Optional[str] = None) -> Device: + return self.device_controller.save_device_using_post(body=body, access_token=access_token) + + def assign_device_to_public_customer(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_public_customer_using_post(device_id=device_id) + + def unassign_device_from_customer(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.unassign_device_from_customer_using_delete(device_id=device_id) + + def get_device_by_id(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.get_device_by_id_using_get(device_id=device_id) + + def get_tenant_device_infos(self, page_size: int, page: int, type: Optional[str] = None, + device_profile_id: Optional[DeviceProfileId] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + active: Optional[bool] = None) -> PageDataDeviceInfo: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_tenant_device_infos_using_get(page_size=page_size, page=page, type=type, + device_profile_id=device_profile_id, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, active=active) + + def get_customer_device_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + device_profile_id: Optional[DeviceProfileId] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + active: Optional[bool] = None) -> PageDataDeviceInfo: + customer_id = self.get_id(customer_id) + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_customer_device_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, + device_profile_id=device_profile_id, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, active=active) + + def get_tenant_devices(self, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDevice: + return self.device_controller.get_tenant_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_customer_devices(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDevice: + customer_id = self.get_id(customer_id) + return self.device_controller.get_customer_devices_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def unassign_device_from_edge(self, edge_id: EdgeId, device_id: DeviceId) -> Device: + edge_id = self.get_id(edge_id) + device_id = self.get_id(device_id) + return self.device_controller.unassign_device_from_edge_using_delete(edge_id=edge_id, device_id=device_id) + + def assign_device_to_tenant(self, tenant_id: TenantId, device_id: DeviceId) -> Device: + tenant_id = self.get_id(tenant_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_tenant_using_post(tenant_id=tenant_id, device_id=device_id) + + def find_by_query_v1(self, body: DeviceSearchQuery) -> List[Device]: + return self.device_controller.find_by_query_using_post1(body=body) + + def assign_device_to_edge(self, edge_id: EdgeId, device_id: DeviceId) -> Device: + edge_id = self.get_id(edge_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_edge_using_post(edge_id=edge_id, device_id=device_id) + + def delete_device(self, device_id: DeviceId) -> None: + device_id = self.get_id(device_id) + return self.device_controller.delete_device_using_delete(device_id=device_id) + + def re_claim_device(self, device_name: str): + return self.device_controller.re_claim_device_using_delete(device_name=device_name) + + def assign_device_to_customer(self, customer_id: CustomerId, device_id: DeviceId) -> Device: + customer_id = self.get_id(customer_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_customer_using_post(customer_id=customer_id, device_id=device_id) + + def get_edge_devices(self, edge_id: EdgeId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None, device_profile_id: Optional[DeviceProfileId] = None, active: Optional[bool] = None) -> PageDataDevice: + edge_id = self.get_id(edge_id) + + if device_profile_id: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_edge_devices_using_get(edge_id=edge_id, page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time, device_profile_id=device_profile_id, active=active) + + def get_tenant_device(self, device_name: str) -> Device: + return self.device_controller.get_tenant_device_using_get(device_name=device_name) + + def get_device_credentials_by_device_id(self, device_id: DeviceId) -> DeviceCredentials: + device_id = self.get_id(device_id) + return self.device_controller.get_device_credentials_by_device_id_using_get(device_id=device_id) + + # Entity View Controller + def find_by_to_v1(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[EntityRelation]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get1(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def find_info_by_to(self, to_id: EntityId, to_type: str, relation_type_group: Optional[str] = None) -> List[ + EntityRelationInfo]: + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_info_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type_group=relation_type_group) + + def delete_relations(self, entity_id: EntityId) -> None: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entity_relation_controller.delete_relations_using_delete(entity_id=entity_id, + entity_type=entity_type) + + def delete_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> None: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.delete_relation_using_delete(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_by_from_v1(self, from_id: EntityId, from_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get1(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def find_by_query_v3(self, body: EntityRelationsQuery) -> List[EntityRelation]: + return self.entity_relation_controller.find_by_query_using_post3(body=body) + + def find_info_by_query(self, body: EntityRelationsQuery) -> List[EntityRelationInfo]: + return self.entity_relation_controller.find_info_by_query_using_post(body=body) + + def save_relation(self, body: Optional[EntityRelation] = None) -> None: + return self.entity_relation_controller.save_relation_using_post(body=body) + + def find_by_to(self, to_id: EntityId, relation_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.find_by_to_using_get(to_id=to_id, to_type=to_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + def find_info_by_from(self, from_id: EntityId, + relation_type_group: Optional[str] = None) -> List[EntityRelationInfo]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_info_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type_group=relation_type_group) + + def get_relation(self, from_id: EntityId, relation_type: str, to_id: EntityId, + relation_type_group: Optional[str] = None) -> EntityRelation: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + to_type = self.get_type(to_id) + to_id = self.get_id(to_id) + return self.entity_relation_controller.get_relation_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, to_id=to_id, + to_type=to_type, + relation_type_group=relation_type_group) + + def find_by_from(self, from_id: EntityId, relation_type: str, + relation_type_group: Optional[str] = None) -> List[EntityRelation]: + from_type = self.get_type(from_id) + from_id = self.get_id(from_id) + return self.entity_relation_controller.find_by_from_using_get(from_id=from_id, from_type=from_type, + relation_type=relation_type, + relation_type_group=relation_type_group) + + def assign_entity_view_to_edge(self, edge_id: EdgeId, entity_view_id: EntityViewId) -> EntityView: + edge_id = self.get_id(edge_id) + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.assign_entity_view_to_edge_using_post(edge_id=edge_id, + entity_view_id=entity_view_id) + + def get_entity_view_types(self, ) -> List[EntitySubtype]: + return self.entity_view_controller.get_entity_view_types_using_get() + + def delete_entity_view(self, entity_view_id: EntityViewId) -> None: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.delete_entity_view_using_delete(entity_view_id=entity_view_id) + + def assign_entity_view_to_customer(self, customer_id: CustomerId, entity_view_id: EntityViewId) -> EntityView: + customer_id = self.get_id(customer_id) + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.assign_entity_view_to_customer_using_post(customer_id=customer_id, + entity_view_id=entity_view_id) + + def get_entity_view_by_id(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_by_id_using_get(entity_view_id=entity_view_id) + + def get_customer_entity_view_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityViewInfo: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_view_infos_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_entity_view_infos(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEntityViewInfo: + return self.entity_view_controller.get_tenant_entity_view_infos_using_get(page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_entity_view(self, entity_view_name: str) -> EntityView: + return self.entity_view_controller.get_tenant_entity_view_using_get(entity_view_name=entity_view_name) + + def get_edge_entity_views(self, edge_id: EdgeId, page: int, page_size: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, start_time: Optional[int] = None, + end_time: Optional[int] = None) -> PageDataEntityView: + edge_id = self.get_id(edge_id) + return self.entity_view_controller.get_edge_entity_views_using_get(edge_id=edge_id, page=page, + page_size=page_size, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + def unassign_entity_view_from_customer(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.unassign_entity_view_from_customer_using_delete( + entity_view_id=entity_view_id) + + def save_entity_view(self, body: Optional[EntityView] = None) -> EntityView: + return self.entity_view_controller.save_entity_view_using_post(body=body) + + def unassign_entity_view_from_edge(self, edge_id: EdgeId, entity_view_id: EntityViewId) -> EntityView: + edge_id = self.get_id(edge_id) + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.unassign_entity_view_from_edge_using_delete(edge_id=edge_id, + entity_view_id=entity_view_id) + + def get_tenant_entity_views(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityView: + return self.entity_view_controller.get_tenant_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def assign_entity_view_to_public_customer(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.assign_entity_view_to_public_customer_using_post( + entity_view_id=entity_view_id) + + def find_by_query_v4(self, body: EntityViewSearchQuery) -> List[EntityView]: + return self.entity_view_controller.find_by_query_using_post4(body=body) + + def get_customer_entity_views(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEntityView: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_views_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Admin Controller + def get_admin_settings(self, key: str) -> AdminSettings: + return self.admin_controller.get_admin_settings_using_get(key=key) + + # TB Resource Controller + def get_resource_info_by_id(self, resource_id: EntityId) -> TbResourceInfo: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_info_by_id_using_get(resource_id=resource_id) + + def delete_resource_v1(self, resource_id: EntityId) -> None: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.delete_resource_using_delete1(resource_id=resource_id) + + def get_resource_by_id(self, resource_id: EntityId) -> TbResource: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.get_resource_by_id_using_get(resource_id=resource_id) + + def save_resource(self, body=None): + return self.tb_resource_controller.save_resource_using_post(body=body) + + def get_resources(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTbResourceInfo: + return self.tb_resource_controller.get_resources_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_lwm2m_list_objects(self, sort_order: str, sort_property: str, object_ids: list) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_using_get(sort_order=sort_order, + sort_property=sort_property, + object_ids=object_ids) + + def download_resource(self, resource_id: EntityId) -> Resource: + resource_id = self.get_id(resource_id) + return self.tb_resource_controller.download_resource_using_get(resource_id=resource_id) + + def get_lwm2m_list_objects_page(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> List[LwM2mObject]: + return self.tb_resource_controller.get_lwm2m_list_objects_page_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_features_info(self) -> FeaturesInfo: + return self.admin_controller.get_features_info_using_get() + + def get_system_info(self) -> SystemInfo: + return self.admin_controller.get_system_info_using_get() + + # O Auth 2 Controller + def get_login_processing_url(self, ) -> str: + return self.o_auth2_controller.get_login_processing_url_using_get() + + def save_o_auth2_info(self, body: Optional[OAuth2Info] = None) -> OAuth2Info: + return self.o_auth2_controller.save_o_auth2_info_using_post(body=body) + + def get_o_auth2_clients(self, pkg_name: Optional[str] = None, platform: Optional[str] = None) -> List[OAuth2ClientInfo]: + return self.o_auth2_controller.get_o_auth2_clients_using_post(pkg_name=pkg_name, platform=platform) + + def get_current_o_auth2_info(self, ) -> OAuth2Info: + return self.o_auth2_controller.get_current_o_auth2_info_using_get() + + # Tenant Profile Controller + def get_default_tenant_profile_info(self, ) -> EntityInfo: + return self.tenant_profile_controller.get_default_tenant_profile_info_using_get() + + def save_tenant_profile(self, body: Optional[TenantProfile] = None) -> TenantProfile: + return self.tenant_profile_controller.save_tenant_profile_using_post(body=body) + + def get_tenant_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantProfile: + return self.tenant_profile_controller.get_tenant_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_tenant_profile(self, tenant_profile_id: TenantProfileId) -> None: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.delete_tenant_profile_using_delete(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_info_by_id(self, tenant_profile_id: TenantProfileId) -> EntityInfo: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_info_by_id_using_get( + tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_by_id(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.get_tenant_profile_by_id_using_get(tenant_profile_id=tenant_profile_id) + + def set_default_tenant_profile(self, tenant_profile_id: TenantProfileId) -> TenantProfile: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.tenant_profile_controller.set_default_tenant_profile_using_post(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityInfo: + return self.tenant_profile_controller.get_tenant_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + # Widgets Bundle Controller + def get_widgets_bundle_by_id(self, widgets_bundle_id: WidgetsBundleId) -> WidgetsBundle: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.get_widgets_bundle_by_id_using_get(widgets_bundle_id=widgets_bundle_id) + + def save_widgets_bundle(self, body: Optional[WidgetsBundle] = None) -> WidgetsBundle: + return self.widgets_bundle_controller.save_widgets_bundle_using_post(body=body) + + def get_widgets_bundles_v1(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataWidgetsBundle: + return self.widgets_bundle_controller.get_widgets_bundles_using_get1(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_widgets_bundle(self, widgets_bundle_id: WidgetsBundleId) -> None: + widgets_bundle_id = self.get_id(widgets_bundle_id) + return self.widgets_bundle_controller.delete_widgets_bundle_using_delete(widgets_bundle_id=widgets_bundle_id) + + def get_widgets_bundles(self, ) -> List[WidgetsBundle]: + return self.widgets_bundle_controller.get_widgets_bundles_using_get() + + # Device Profile Controller + def get_device_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, transport_type: Optional[str] = None) -> PageDataDeviceProfileInfo: + return self.device_profile_controller.get_device_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + transport_type=transport_type) + + def set_default_device_profile(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.set_default_device_profile_using_post(device_profile_id=device_profile_id) + + def get_attributes_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_attributes_keys_using_get(device_profile_id=device_profile_id) + + def delete_device_profile(self, device_profile_id: DeviceProfileId) -> None: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.delete_device_profile_using_delete(device_profile_id=device_profile_id) + + def save_device_profile(self, body: Optional[DeviceProfile] = None) -> DeviceProfile: + return self.device_profile_controller.save_device_profile_using_post(body=body) + + def get_default_device_profile_info(self, ) -> DeviceProfileInfo: + return self.device_profile_controller.get_default_device_profile_info_using_get() + + def get_timeseries_keys(self, device_profile_id: Optional[DeviceProfileId] = None) -> List[str]: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_timeseries_keys_using_get(device_profile_id=device_profile_id) + + def get_device_profile_info_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfileInfo: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_info_by_id_using_get( + device_profile_id=device_profile_id) + + def get_device_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDeviceProfile: + return self.device_profile_controller.get_device_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_device_profile_by_id(self, device_profile_id: DeviceProfileId) -> DeviceProfile: + device_profile_id = self.get_id(device_profile_id) + return self.device_profile_controller.get_device_profile_by_id_using_get(device_profile_id=device_profile_id) + + # Dashboard Controller + def add_dashboard_customers(self, dashboard_id: DashboardId, body: Optional[List[str]] = None) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.add_dashboard_customers_using_post(dashboard_id=dashboard_id, body=body) + + def assign_dashboard_to_edge(self, edge_id: EdgeId, dashboard_id: DashboardId) -> Dashboard: + edge_id = self.get_id(edge_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.assign_dashboard_to_edge_using_post(edge_id=edge_id, dashboard_id=dashboard_id) + + def remove_dashboard_customers(self, dashboard_id: DashboardId, body: Optional[List[str]] = None) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.remove_dashboard_customers_using_post(dashboard_id=dashboard_id, body=body) + + def get_server_time(self, ) -> int: + return self.dashboard_controller.get_server_time_using_get() + + def get_dashboard_by_id(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_by_id_using_get(dashboard_id=dashboard_id) + + def assign_dashboard_to_public_customer(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.assign_dashboard_to_public_customer_using_post(dashboard_id=dashboard_id) + + def delete_dashboard(self, dashboard_id: DashboardId) -> None: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.delete_dashboard_using_delete(dashboard_id=dashboard_id) + + def update_dashboard_customers(self, dashboard_id: DashboardId, body: Optional[List[str]] = None) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.update_dashboard_customers_using_post(dashboard_id=dashboard_id, body=body) + + def unassign_dashboard_from_public_customer(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.unassign_dashboard_from_public_customer_using_delete(dashboard_id=dashboard_id) + + def save_dashboard(self, body: Optional[Dashboard] = None) -> Dashboard: + return self.dashboard_controller.save_dashboard_using_post(body=body) + + def get_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_home_dashboard_info_using_get() + + def get_tenant_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_tenant_home_dashboard_info_using_get() + + def get_tenant_dashboards_v1(self, tenant_id: TenantId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + tenant_id = self.get_id(tenant_id) + return self.dashboard_controller.get_tenant_dashboards_using_get1(tenant_id=tenant_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_info_by_id(self, dashboard_id: DashboardId) -> DashboardInfo: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_info_by_id_using_get(dashboard_id=dashboard_id) + + def unassign_dashboard_from_edge(self, edge_id: EdgeId, dashboard_id: DashboardId) -> Dashboard: + edge_id = self.get_id(edge_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.unassign_dashboard_from_edge_using_delete(edge_id=edge_id, + dashboard_id=dashboard_id) + + def get_home_dashboard(self, ) -> HomeDashboard: + return self.dashboard_controller.get_home_dashboard_using_get() + + def get_max_datapoints_limit(self, ) -> int: + return self.dashboard_controller.get_max_datapoints_limit_using_get() + + def get_tenant_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_tenant_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def assign_dashboard_to_customer(self, customer_id: CustomerId, dashboard_id: DashboardId) -> Dashboard: + customer_id = self.get_id(customer_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.assign_dashboard_to_customer_using_post(customer_id=customer_id, + dashboard_id=dashboard_id) + + def set_tenant_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_tenant_home_dashboard_info_using_post(body=body) + + def get_edge_dashboards(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDashboardInfo: + edge_id = self.get_id(edge_id) + return self.dashboard_controller.get_edge_dashboards_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def unassign_dashboard_from_customer(self, customer_id: CustomerId, dashboard_id: DashboardId) -> Dashboard: + customer_id = self.get_id(customer_id) + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.unassign_dashboard_from_customer_using_delete(customer_id=customer_id, + dashboard_id=dashboard_id) + + # Entity Query Controller + def count_entities_by_query(self, body: Optional[EntityCountQuery] = None) -> int: + return self.entity_query_controller.count_entities_by_query_using_post(body=body) + + def find_entity_timeseries_and_attributes_keys_by_query(self, timeseries: bool, attributes: bool, body: Optional[ + EntityDataQuery]) -> DeferredResultResponseEntity: + return self.entity_query_controller.find_entity_timeseries_and_attributes_keys_by_query_using_post( + timeseries=timeseries, attributes=attributes, body=body) + + def find_alarm_data_by_query(self, body: Optional[AlarmDataQuery] = None) -> PageDataAlarmData: + return self.entity_query_controller.find_alarm_data_by_query_using_post(body=body) + + def find_entity_data_by_query(self, body: Optional[EntityDataQuery] = None) -> PageDataEntityData: + return self.entity_query_controller.find_entity_data_by_query_using_post(body=body) + + # Widget Type Controller + def get_bundle_widget_types_infos(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeInfo]: + return self.widget_type_controller.get_bundle_widget_types_infos_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_bundle_widget_types_details(self, is_system: bool, bundle_alias: str) -> List[WidgetTypeDetails]: + return self.widget_type_controller.get_bundle_widget_types_details_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def delete_widget_type(self, widget_type_id: WidgetTypeId) -> None: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.delete_widget_type_using_delete(widget_type_id=widget_type_id) + + def save_widget_type(self, body: Optional[WidgetTypeDetails] = None) -> WidgetTypeDetails: + return self.widget_type_controller.save_widget_type_using_post(body=body) + + def get_bundle_widget_types(self, is_system: bool, bundle_alias: str) -> List[WidgetType]: + return self.widget_type_controller.get_bundle_widget_types_using_get(is_system=is_system, + bundle_alias=bundle_alias) + + def get_widget_type(self, is_system: bool, bundle_alias: str, alias: str) -> WidgetType: + return self.widget_type_controller.get_widget_type_using_get(is_system=is_system, bundle_alias=bundle_alias, + alias=alias) + + def get_widget_type_by_id(self, widget_type_id: WidgetTypeId) -> WidgetTypeDetails: + widget_type_id = self.get_id(widget_type_id) + return self.widget_type_controller.get_widget_type_by_id_using_get(widget_type_id=widget_type_id) + + # Audit Log Controller + def get_audit_logs_by_customer_id(self, customer_id: CustomerId, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + customer_id = self.get_id(customer_id) + return self.audit_log_controller.get_audit_logs_by_customer_id_using_get(customer_id=customer_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, + end_time=end_time, + action_types=action_types) + + def get_audit_logs_by_user_id(self, user_id: UserId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + user_id = self.get_id(user_id) + return self.audit_log_controller.get_audit_logs_by_user_id_using_get(user_id=user_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + def get_audit_logs_by_entity_id(self, entity_id: EntityId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None, + start_time: Optional[int] = None, end_time: Optional[int] = None, + action_types: Optional[str] = None) -> PageDataAuditLog: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.audit_log_controller.get_audit_logs_by_entity_id_using_get(entity_type=entity_type, + entity_id=entity_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + start_time=start_time, end_time=end_time, + action_types=action_types) + + # Lwm2m Controller + def get_lwm2m_bootstrap_security_info(self, is_bootstrap_server: bool): + return self.lwm2m_controller.get_lwm2m_bootstrap_security_info_using_get( + is_bootstrap_server=is_bootstrap_server) + + # UI Controller + def get_help_base_url(self, ) -> str: + return self.ui_settings_controller.get_help_base_url_using_get() + + # Component Descriptor Controller + def get_component_descriptors_by_types(self, component_types: str, rule_chain_type: Optional[str] = None) -> List[ + ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_types_using_get( + component_types=component_types, rule_chain_type=rule_chain_type) + + def get_component_descriptor_by_clazz(self, component_descriptor_clazz: str) -> ComponentDescriptor: + return self.component_descriptor_controller.get_component_descriptor_by_clazz_using_get( + component_descriptor_clazz=component_descriptor_clazz) + + def get_component_descriptors_by_type(self, component_type: str, rule_chain_type: Optional[str] = None) -> List[ + ComponentDescriptor]: + return self.component_descriptor_controller.get_component_descriptors_by_type_using_get( + component_type=component_type, rule_chain_type=rule_chain_type) + + # Tenant Controller + def get_tenant_infos(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenantInfo: + return self.tenant_controller.get_tenant_infos_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_by_id(self, tenant_id: TenantId) -> Tenant: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_by_id_using_get(tenant_id=tenant_id) + + def save_tenant(self, body: Optional[Tenant] = None) -> Tenant: + return self.tenant_controller.save_tenant_using_post(body=body) + + def get_tenants(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataTenant: + return self.tenant_controller.get_tenants_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenant_info_by_id(self, tenant_id: TenantId) -> TenantInfo: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_info_by_id_using_get(tenant_id=tenant_id) + + def delete_tenant(self, tenant_id: TenantId) -> None: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.delete_tenant_using_delete(tenant_id=tenant_id) + + # OTA Package Controller + def delete_ota_package(self, ota_package_id: OtaPackageId) -> None: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.delete_ota_package_using_delete(ota_package_id=ota_package_id) + + def get_ota_packages_v1(self, device_profile_id: DeviceProfileId, type: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + device_profile_id = self.get_id(device_profile_id) + return self.ota_package_controller.get_ota_packages_using_get1(device_profile_id=device_profile_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_ota_package_data(self, ota_package_id: OtaPackageId, checksum: Optional[str] = None, + checksum_algorithm: Optional[str] = None, file: Optional[str] = None) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.save_ota_package_data_using_post(ota_package_id=ota_package_id, + checksum=checksum, + checksum_algorithm=checksum_algorithm, + file=file) + + def save_ota_package_info(self, body: Optional[SaveOtaPackageInfoRequest] = None) -> OtaPackageInfo: + return self.ota_package_controller.save_ota_package_info_using_post(body=body) + + def get_ota_packages(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataOtaPackageInfo: + return self.ota_package_controller.get_ota_packages_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_ota_package_by_id(self, ota_package_id: OtaPackageId) -> OtaPackage: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_by_id_using_get(ota_package_id=ota_package_id) + + def download_ota_package(self, ota_package_id: OtaPackageId) -> Resource: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.download_ota_package_using_get(ota_package_id=ota_package_id) + + def get_ota_package_info_by_id(self, ota_package_id: OtaPackageId) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_info_by_id_using_get(ota_package_id=ota_package_id) + + def assign_alarm(self, alarm_id: AlarmId, assignee_id: str) -> Alarm: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.assign_alarm_using_post(alarm_id=alarm_id, assignee_id=assignee_id) + + # Asset Profile Controller + def delete_asset_profile(self, asset_profile_id: str): + return self.asset_profile_controller.delete_asset_profile_using_delete(asset_profile_id=asset_profile_id) + + def get_asset_profile_by_id(self, asset_profile_id: str) -> AssetProfile: + return self.asset_profile_controller.get_asset_profile_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_info_by_id(self, asset_profile_id: str) -> AssetProfileInfo: + return self.asset_profile_controller.get_asset_profile_info_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfileInfo: + return self.asset_profile_controller.get_asset_profile_infos_using_get(page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_asset_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfile: + return self.asset_profile_controller.get_asset_profiles_using_get(page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_default_asset_profile_info(self) -> AssetProfileInfo: + return self.asset_profile_controller.get_default_asset_profile_info_using_get() + + def save_asset_profile(self, body: AssetProfile) -> AssetProfile: + return self.asset_profile_controller.save_asset_profile_using_post(body=body) + + def set_default_asset_profile(self, asset_profile_id: str) -> AssetProfile: + return self.asset_profile_controller.set_default_asset_profile_using_post(asset_profile_id=asset_profile_id) diff --git a/tb-rest-client/python/tb_rest_client/rest_client_pe.py b/tb-rest-client/python/tb_rest_client/rest_client_pe.py new file mode 100644 index 0000000..59daf63 --- /dev/null +++ b/tb-rest-client/python/tb_rest_client/rest_client_pe.py @@ -0,0 +1,1806 @@ +# Copyright 2023. ThingsBoard +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from tb_rest_client.rest_client_base import * +from tb_rest_client.api.api_pe import * +from tb_rest_client.api.api_pe import DashboardControllerApi +from tb_rest_client.models.models_pe import * + +logger = getLogger(__name__) + + +class RestClientPE(RestClientBase): + def __init__(self, base_url): + super().__init__(base_url) + + def login(self, username, password): + super(RestClientPE, self).login(username=username, password=password) + self.__load_controllers() + + def public_login(self, public_id): + super(RestClientPE, self).public_login(public_id=public_id) + self.__load_controllers() + + def token_login(self, token, refresh_token=None): + super(RestClientPE, self).token_login(token=token, refresh_token=refresh_token) + self.__load_controllers() + + # Self Registration Controller + def get_privacy_policy(self, ) -> str: + return self.self_registration_controller.get_privacy_policy_using_get() + + def get_self_registration_params(self, ) -> SelfRegistrationParams: + return self.self_registration_controller.get_self_registration_params_using_get() + + def get_sign_up_self_registration_params(self, pkg_name: Optional[str] = None) -> SignUpSelfRegistrationParams: + return self.self_registration_controller.get_sign_up_self_registration_params_using_get(pkg_name=pkg_name) + + def get_terms_of_use(self, ) -> str: + return self.self_registration_controller.get_terms_of_use_using_get() + + def delete_self_registration_params(self, domain_name: str): + return self.self_registration_controller.delete_self_registration_params_using_delete(domain_name=domain_name) + + def save_self_registration_params(self, body: Optional[SelfRegistrationParams] = None) -> SelfRegistrationParams: + return self.self_registration_controller.save_self_registration_params_using_post(body=body) + + # O Auth 2 Config Template Controller + def delete_client_registration_template(self, client_registration_template_id: EntityId) -> None: + client_registration_template_id = self.get_id(client_registration_template_id) + return self.o_auth2_config_template_controller.delete_client_registration_template_using_delete( + client_registration_template_id=client_registration_template_id) + + def get_client_registration_templates(self, ) -> List[OAuth2ClientRegistrationTemplate]: + return self.o_auth2_config_template_controller.get_client_registration_templates_using_get() + + def save_client_registration_template(self, body: Optional[OAuth2ClientRegistrationTemplate] = None) -> OAuth2ClientRegistrationTemplate: + return self.o_auth2_config_template_controller.save_client_registration_template_using_post(body=body) + + # HTTP Integration Controller + def http_check_status_get(self, routing_key: str, request_params: dict, request_headers: dict): + return self.http_integration_controller.check_status_using_get(routing_key=routing_key, + request_params=request_params, + request_headers=request_headers) + + def http_process_request_v1_post1(self, routing_key: str, suffix: str): + return self.http_integration_controller.process_request_using_post1(routing_key=routing_key, suffix=suffix) + + def http_process_request_v2_post2(self, routing_key: str, suffix: str): + return self.http_integration_controller.process_request_using_post2(routing_key=routing_key, suffix=suffix) + + def get_asset_types(self, ) -> List[EntitySubtype]: + return self.asset_controller.get_asset_types_using_get() + + def find_by_query(self, body: Optional[AssetSearchQuery] = None) -> List[Asset]: + return self.asset_controller.find_by_query_using_post(body=body) + + def get_tenant_assets(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAsset: + return self.asset_controller.get_tenant_assets_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + # Asset Controller + def process_asset_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultAsset: + return self.asset_controller.process_asset_bulk_import_using_post(body=body) + + def save_asset(self, body: Optional[Asset] = None, entity_group_id: EntityGroupId = None, entity_group_ids: Optional[str] = None): + entity_group_id = self.get_id(entity_group_id) + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + return self.asset_controller.save_asset_using_post(body=body, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def get_all_customer_infos(self, page_size: int, page: int, type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataCustomerInfo: + return self.customer_controller.get_all_customer_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_customer_customer_infos(self, customer_id: CustomerId, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataCustomerInfo: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_customer_infos_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + customer_id=customer_id) + + def get_customer_info_by_id(self, customer_id: CustomerId) -> CustomerInfo: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_info_by_id_using_get(customer_id=customer_id) + + def get_assets_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataAsset: + entity_group_id = self.get_id(entity_group_id) + return self.asset_controller.get_assets_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_assets(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAsset: + if asset_profile_id: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_user_assets_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order, asset_profile_id=asset_profile_id) + + def delete_device_group_ota_package(self, id: str) -> None: + return self.device_group_ota_package_controller.delete_device_group_ota_package_using_delete(id=id) + + def get_firmware_by_id(self, group_id: EntityGroupId, firmware_type: str) -> DeviceGroupOtaPackage: + group_id = self.get_id(group_id) + return self.device_group_ota_package_controller.get_firmware_by_id_using_get(group_id=group_id, + firmware_type=firmware_type) + + def save_device_group_ota_package(self, body: Optional[DeviceGroupOtaPackage] = None) -> DeviceGroupOtaPackage: + return self.device_group_ota_package_controller.save_device_group_ota_package_using_post(body=body) + + def find_by_query_v2(self, body: Optional[EdgeSearchQuery] = None) -> List[Edge]: + return self.edge_controller.find_by_query_using_post2(body=body) + + def check_instance(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.edge_controller.check_instance_using_post(body=body) + + def get_tenant_edges(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_tenant_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def find_missing_to_related_rule_chains(self, edge_id: EdgeId) -> str: + edge_id = self.get_id(edge_id) + return self.edge_controller.find_missing_to_related_rule_chains_using_get(edge_id=edge_id) + + def get_customer_edges(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + customer_id = self.get_id(customer_id) + return self.edge_controller.get_customer_edges_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def process_edges_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultEdge: + return self.edge_controller.process_edges_bulk_import_using_post(body=body) + + def activate_instance(self, license_secret: str, release_date: str) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.edge_controller.activate_instance_using_post(license_secret=license_secret, + release_date=release_date) + + def get_tenant_edge(self, edge_name: str) -> Edge: + return self.edge_controller.get_tenant_edge_using_get(edge_name=edge_name) + + def get_edge_by_id(self, edge_id: EdgeId) -> Edge: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_by_id_using_get(edge_id=edge_id) + + def get_user_edges(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_user_edges_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def delete_edge(self, edge_id: EdgeId) -> None: + edge_id = self.get_id(edge_id) + return self.edge_controller.delete_edge_using_delete(edge_id=edge_id) + + def save_edge(self, body: Optional[Edge] = None) -> Edge: + return self.edge_controller.save_edge_using_post(body=body) + + def is_edges_support_enabled(self, ) -> bool: + return self.edge_controller.is_edges_support_enabled_using_get() + + def get_edges(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataEdge: + return self.edge_controller.get_edges_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_edge_types(self, ) -> List[EntitySubtype]: + return self.edge_controller.get_edge_types_using_get() + + def set_edge_root_rule_chain(self, edge_id: EdgeId, rule_chain_id: RuleChainId) -> Edge: + edge_id = self.get_id(edge_id) + rule_chain_id = self.get_id(rule_chain_id) + return self.edge_controller.set_edge_root_rule_chain_using_post(edge_id=edge_id, rule_chain_id=rule_chain_id) + + def get_edges_by_ids(self, edge_ids: list) -> List[Edge]: + return self.edge_controller.get_edges_by_ids_using_get(edge_ids=str(edge_ids)) + + def ocean_connect_process_request_v2_delete2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_delete2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_get2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_get2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_head2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_head2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_options2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_options2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_patch2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_patch2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v10_post10(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_post10(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def ocean_connect_process_request_v2_put2(self, body: str, request_headers: dict, routing_key: str): + return self.ocean_connect_integration_controller.process_request_using_put2(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def get_allowed_permissions(self, ) -> AllowedPermissionsInfo: + return self.user_permissions_controller.get_allowed_permissions_using_get() + + def change_owner_to_customer(self, owner_id: UserId, entity_id: EntityId, body: Optional[List[str]] = None) -> None: + owner_id = self.get_id(owner_id) + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + if body: + body = ','.join(body) + return self.owner_controller.change_owner_to_customer_using_post(owner_id=owner_id, entity_type=entity_type, + entity_id=entity_id, body=body) + + def change_owner_to_tenant(self, owner_id: UserId, entity_id: EntityId, body: Optional[List[str]] = None) -> None: + owner_id = self.get_id(owner_id) + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + if body: + body = ','.join(body) + return self.owner_controller.change_owner_to_tenant_using_post(owner_id=owner_id, entity_type=entity_type, + entity_id=entity_id, body=body) + + def get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def rpc_v2_get_persisted_rpc(self, rpc_id: RpcId) -> Rpc: + rpc_id = self.get_id(rpc_id) + return self.rpc_v2_controller.get_persisted_rpc_using_get(rpc_id=rpc_id) + + def get_user_customers(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataCustomer: + return self.customer_controller.get_user_customers_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def handle_one_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_one_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def handle_two_way_device_rpc_request_v1(self, device_id: DeviceId, body: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.handle_two_way_device_rpc_request_using_post1(device_id=device_id, body=body) + + def get_persisted_rpc_by_device(self, device_id: DeviceId, page_size: int, page: int, rpc_status: str, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None): + device_id = self.get_id(device_id) + return self.rpc_v2_controller.get_persisted_rpc_by_device_using_get(device_id=device_id, page_size=page_size, + page=page, rpc_status=rpc_status, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_customers_by_ids(self, customer_ids: str) -> List[Customer]: + return self.customer_controller.get_customers_by_ids_using_get(customer_ids=customer_ids) + + def get_edge_events(self, edge_id: EdgeId, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataEdgeEvent: + edge_id = self.get_id(edge_id) + return self.edge_event_controller.get_edge_events_using_get(edge_id=edge_id, page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order, + start_time=start_time, end_time=end_time) + + def get_customers_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataCustomer: + entity_group_id = self.get_id(entity_group_id) + return self.customer_controller.get_customers_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_customer_title_by_id(self, customer_id: CustomerId) -> str: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_title_by_id_using_get(customer_id=customer_id) + + def get_customers(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataCustomer: + return self.customer_controller.get_customers_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_customer_by_id(self, customer_id: CustomerId) -> Customer: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_customer_by_id_using_get(customer_id=customer_id) + + def get_short_customer_info_by_id(self, customer_id: CustomerId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + customer_id = self.get_id(customer_id) + return self.customer_controller.get_short_customer_info_by_id_using_get(customer_id=customer_id) + + def save_customer(self, body: Optional[Customer] = None, entity_group_id: Optional[EntityGroupId] = None, entity_group_ids: Optional[List[str]] = None) -> Customer: + if entity_group_id: + entity_group_id = self.get_id(entity_group_id) + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + return self.customer_controller.save_customer_using_post(body=body, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def get_tenant_customer(self, customer_title: str) -> Customer: + return self.customer_controller.get_tenant_customer_using_get(customer_title=customer_title) + + def delete_customer(self, customer_id: CustomerId) -> None: + customer_id = self.get_id(customer_id) + return self.customer_controller.delete_customer_using_delete(customer_id=customer_id) + + def get_user_token(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.get_user_token_using_get(user_id=user_id) + + def get_activation_link(self, user_id: UserId) -> str: + user_id = self.get_id(user_id) + return self.user_controller.get_activation_link_using_get(user_id=user_id) + + def get_user_users(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None) -> PageDataUser: + return self.user_controller.get_user_users_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def delete_user(self, user_id: UserId) -> None: + user_id = self.get_id(user_id) + return self.user_controller.delete_user_using_delete(user_id=user_id) + + def get_all_customer_users(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataUser: + return self.user_controller.get_all_customer_users_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def set_user_credentials_enabled(self, user_id: UserId, user_credentials_enabled: Optional[bool] = None) -> None: + user_id = self.get_id(user_id) + return self.user_controller.set_user_credentials_enabled_using_post(user_id=user_id, + user_credentials_enabled=user_credentials_enabled) + + def get_customer_users(self, customer_id: CustomerId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataUser: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_users_using_get(customer_id=customer_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_user_by_id(self, user_id: UserId) -> User: + user_id = self.get_id(user_id) + return self.user_controller.get_user_by_id_using_get(user_id=user_id) + + def get_tenant_admins(self, tenant_id: TenantId, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataUser: + tenant_id = self.get_id(tenant_id) + return self.user_controller.get_tenant_admins_using_get(tenant_id=tenant_id, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def is_user_token_access_enabled(self, ) -> bool: + return self.user_controller.is_user_token_access_enabled_using_get() + + def get_users_by_ids(self, user_ids: list) -> List[User]: + return self.user_controller.get_users_by_ids_using_get(user_ids=str(user_ids)) + + def save_user(self, body: Optional[User] = None, send_activation_mail: Optional[bool] = None, entity_group_id: Optional[EntityGroupId] = None, entity_group_ids: Optional[List[str]] = None) -> User: + if entity_group_id: + entity_group_id = self.get_id(entity_group_id) + + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + + return self.user_controller.save_user_using_post(body=body, send_activation_mail=send_activation_mail, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def send_activation_email(self, email: str) -> None: + return self.user_controller.send_activation_email_using_post(email=email) + + def get_users_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataUser: + entity_group_id = self.get_id(entity_group_id) + return self.user_controller.get_users_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def delete_group_permission(self, group_permission_id: GroupPermissionId) -> None: + group_permission_id = self.get_id(group_permission_id) + return self.group_permission_controller.delete_group_permission_using_delete( + group_permission_id=group_permission_id) + + def get_entity_group_permissions(self, entity_group_id: EntityGroupId) -> List[GroupPermissionInfo]: + entity_group_id = self.get_id(entity_group_id) + return self.group_permission_controller.get_entity_group_permissions_using_get(entity_group_id=entity_group_id) + + def get_group_permission_by_id(self, group_permission_id: GroupPermissionId) -> GroupPermission: + group_permission_id = self.get_id(group_permission_id) + return self.group_permission_controller.get_group_permission_by_id_using_get( + group_permission_id=group_permission_id) + + def get_group_permission_info_by_id(self, group_permission_id: GroupPermissionId, is_user_group: bool) -> GroupPermissionInfo: + group_permission_id = self.get_id(group_permission_id) + return self.group_permission_controller.get_group_permission_info_by_id_using_get( + group_permission_id=group_permission_id, is_user_group=is_user_group) + + def get_user_group_permissions(self, user_group_id: EntityId) -> List[GroupPermissionInfo]: + user_group_id = self.get_id(user_group_id) + return self.group_permission_controller.get_user_group_permissions_using_get(user_group_id=user_group_id) + + def load_user_group_permission_infos(self, body: Optional[List[GroupPermission]] = None) -> List[GroupPermissionInfo]: + return self.group_permission_controller.load_user_group_permission_infos_using_post(body=body) + + def save_group_permission(self, body: Optional[GroupPermission] = None) -> GroupPermission: + return self.group_permission_controller.save_group_permission_using_post(body=body) + + def get_device_types(self, ) -> List[EntitySubtype]: + return self.device_controller.get_device_types_using_get() + + def process_devices_bulk_import(self, body: Optional[BulkImportRequest] = None) -> BulkImportResultDevice: + return self.device_controller.process_devices_bulk_import_using_post(body=body) + + def count_by_device_profile_and_empty_ota_package(self, ota_package_type: str, device_profile_id: DeviceProfileId) -> int: + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.count_by_device_profile_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, device_profile_id=device_profile_id) + + def get_devices_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDevice: + entity_group_id = self.get_id(entity_group_id) + return self.device_controller.get_devices_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_devices_by_ids(self, device_ids: list) -> List[Device]: + device_ids = ','.join(device_ids) + return self.device_controller.get_devices_by_ids_using_get(device_ids=device_ids) + + def get_user_devices(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataDevice: + return self.device_controller.get_user_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def save_device_with_credentials(self, body: Optional[SaveDeviceWithCredentialsRequest] = None) -> Device: + return self.device_controller.save_device_with_credentials_using_post(body=body) + + def update_device_credentials(self, body: Optional[DeviceCredentials] = None) -> DeviceCredentials: + return self.device_controller.update_device_credentials_using_post(body=body) + + def save_device(self, body: Optional[Device], access_token: Optional[str] = None) -> Device: + return self.device_controller.save_device_using_post(body=body, access_token=access_token) + + def get_device_by_id(self, device_id: DeviceId) -> Device: + device_id = self.get_id(device_id) + return self.device_controller.get_device_by_id_using_get(device_id=device_id) + + def get_tenant_devices(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataDevice: + return self.device_controller.get_tenant_devices_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_customer_devices(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDevice: + customer_id = self.get_id(customer_id) + return self.device_controller.get_customer_devices_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def assign_device_to_tenant(self, tenant_id: TenantId, device_id: DeviceId) -> Device: + tenant_id = self.get_id(tenant_id) + device_id = self.get_id(device_id) + return self.device_controller.assign_device_to_tenant_using_post(tenant_id=tenant_id, device_id=device_id) + + def find_by_query_v1(self, body: Optional[DeviceSearchQuery] = None) -> List[Device]: + return self.device_controller.find_by_query_using_post1(body=body) + + def count_by_device_group_and_empty_ota_package(self, ota_package_type: str, ota_package_id: OtaPackageId, + entity_group_id: EntityGroupId) -> int: + ota_package_id = self.get_id(ota_package_id) + entity_group_id = self.get_id(entity_group_id) + return self.device_controller.count_by_device_group_and_empty_ota_package_using_get( + ota_package_type=ota_package_type, ota_package_id=ota_package_id, entity_group_id=entity_group_id) + + def delete_device(self, device_id: DeviceId) -> None: + device_id = self.get_id(device_id) + return self.device_controller.delete_device_using_delete(device_id=device_id) + + def re_claim_device(self, device_name: str): + return self.device_controller.re_claim_device_using_delete(device_name=device_name) + + def get_tenant_device(self, device_name: str) -> Device: + return self.device_controller.get_tenant_device_using_get(device_name=device_name) + + def get_device_credentials_by_device_id(self, device_id: DeviceId) -> DeviceCredentials: + device_id = self.get_id(device_id) + return self.device_controller.get_device_credentials_by_device_id_using_get(device_id=device_id) + + def delete_converter(self, converter_id: ConverterId) -> None: + converter_id = self.get_id(converter_id) + return self.converter_controller.delete_converter_using_delete(converter_id=converter_id) + + def get_converter_by_id(self, converter_id: ConverterId) -> Converter: + converter_id = self.get_id(converter_id) + return self.converter_controller.get_converter_by_id_using_get(converter_id=converter_id) + + def get_converters_by_ids(self, converter_ids: list) -> List[Converter]: + converter_ids = ','.join(converter_ids) + return self.converter_controller.get_converters_by_ids_using_get(converter_ids=converter_ids) + + def get_converters(self, page_size: int, page: int, is_edge_template: Optional[bool] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataConverter: + return self.converter_controller.get_converters_using_get(page_size=page_size, page=page, + is_edge_template=is_edge_template, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_latest_converter_debug_input(self, converter_id: ConverterId) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + converter_id = self.get_id(converter_id) + return self.converter_controller.get_latest_converter_debug_input_using_get(converter_id=converter_id) + + def assign_integration_to_edge(self, edge_id: EdgeId, integration_id: IntegrationId) -> Integration: + edge_id = self.get_id(edge_id) + integration_id = self.get_id(integration_id) + return self.integration_controller.assign_integration_to_edge_using_post(edge_id=edge_id, + integration_id=integration_id) + + def unassign_integration_from_edge(self, edge_id: EdgeId, integration_id: IntegrationId) -> Integration: + edge_id = self.get_id(edge_id) + integration_id = self.get_id(integration_id) + return self.integration_controller.unassign_integration_from_edge_using_delete(edge_id=edge_id, + integration_id=integration_id) + + def get_edge_integrations(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataIntegration: + edge_id = self.get_id(edge_id) + return self.integration_controller.get_edge_integrations_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_all_related_edges_missing_attributes(self, integration_id: IntegrationId) -> str: + integration_id = self.get_id(integration_id) + return self.integration_controller.find_all_related_edges_missing_attributes_using_get( + integration_id=integration_id) + + def get_edge_integration_infos(self, edge_id: EdgeId, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, ) -> PageDataIntegrationInfo: + edge_id = self.get_id(edge_id) + return self.integration_controller.get_edge_integration_infos_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_edge_missing_attributes_get(self, edge_id: EdgeId, integration_ids: str) -> str: + edge_id = self.get_id(edge_id) + return self.integration_controller.find_edge_missing_attributes_using_get(edge_id=edge_id, + integration_ids=integration_ids) + + def save_converter(self, body: Optional[Converter] = None) -> Converter: + return self.converter_controller.save_converter_using_post(body=body) + + def test_down_link_converter(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None, script_lang: Optional[str] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.converter_controller.test_down_link_converter_using_post(body=body, script_lang=script_lang) + + def test_up_link_converter(self, body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None, script_lang: Optional[str] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.converter_controller.test_up_link_converter_using_post(body=body, script_lang=script_lang) + + def get_entity_view_types(self, ) -> List[EntitySubtype]: + return self.entity_view_controller.get_entity_view_types_using_get() + + def delete_entity_view(self, entity_view_id: EntityViewId) -> None: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.delete_entity_view_using_delete(entity_view_id=entity_view_id) + + def get_entity_view_by_id(self, entity_view_id: EntityViewId) -> EntityView: + entity_view_id = self.get_id(entity_view_id) + return self.entity_view_controller.get_entity_view_by_id_using_get(entity_view_id=entity_view_id) + + def get_tenant_entity_view(self, entity_view_name: str) -> EntityView: + return self.entity_view_controller.get_tenant_entity_view_using_get(entity_view_name=entity_view_name) + + def get_user_entity_views(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataEntityView: + return self.entity_view_controller.get_user_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_views_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataEntityView: + entity_group_id = self.get_id(entity_group_id) + return self.entity_view_controller.get_entity_views_by_entity_group_id_using_get( + entity_group_id=entity_group_id, page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_entity_views_by_ids(self, entity_view_ids: list) -> List[EntityView]: + entity_view_ids = ','.join(entity_view_ids) + return self.entity_view_controller.get_entity_views_by_ids_using_get(entity_view_ids=entity_view_ids) + + def save_entity_view(self, body: Optional[EntityView] = None, entity_group_id: Optional[EntityGroupId] = None, entity_group_ids: Optional[List[str]] = None) -> EntityView: + if entity_group_id: + entity_group_id = self.get_id(entity_group_id) + if entity_group_ids: + entity_group_ids = ','.join(entity_group_ids) + return self.entity_view_controller.save_entity_view_using_post(body=body, entity_group_id=entity_group_id, entity_group_ids=entity_group_ids) + + def get_tenant_entity_views(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataEntityView: + return self.entity_view_controller.get_tenant_entity_views_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def find_by_query_v4(self, body: Optional[EntityViewSearchQuery] = None) -> List[EntityView]: + return self.entity_view_controller.find_by_query_using_post4(body=body) + + def get_customer_entity_views(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataEntityView: + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_views_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def handle_rule_engine_request(self, entity_id: EntityId, timeout: int, body: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.rule_engine_controller.handle_rule_engine_request_using_post(entity_type=entity_type, + entity_id=entity_id, timeout=timeout, + body=body) + + def handle_rule_engine_request_v1(self, entity_id: EntityId, body: Optional[str] = None, + queue_name: Optional[str] = None, + timeout: Optional[int] = None) -> DeferredResultResponseEntity: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.rule_engine_controller.handle_rule_engine_request_using_post1(entity_type=entity_type, + entity_id=entity_id, body=body, + queue_nam=queue_name, timeout=timeout) + + def handle_rule_engine_request_v2(self, entity_id: EntityId, body: Optional[str] = None): + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.rule_engine_controller.handle_rule_engine_request_using_post2(entity_type=entity_type, + entity_id=entity_id, body=body) + + def get_admin_settings(self, key: str, system_by_default=None) -> AdminSettings: + return self.admin_controller.get_admin_settings_using_get(key=key, system_by_default=system_by_default) + + def t_mobile_iot_cdp_process_request_v4_delete4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_delete4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_get4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_get4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_head4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_head4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_options4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_options4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_patch4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_patch4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v12_post12(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_post12(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def t_mobile_iot_cdp_process_request_v4_put4(self, body: str, request_headers: dict, routing_key: str): + return self.t_mobile_iot_cdp_integration_controller.process_request_using_put4(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sign_up(self, body: Optional[SignUpRequest] = None) -> str: + return self.sign_up_controller.sign_up_using_post(body=body) + + def resend_email_activation(self, email: str, pkg_name: Optional[str] = None) -> None: + return self.sign_up_controller.resend_email_activation_using_post(email=email, pkg_name=pkg_name) + + def activate_user_by_email_code(self, email_code: str, pkg_name: Optional[str] = None) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.sign_up_controller.activate_user_by_email_code_using_post(email_code=email_code, pkg_name=pkg_name) + + def privacy_policy_accepted(self, ) -> bool: + return self.sign_up_controller.privacy_policy_accepted_using_get() + + def accept_terms_of_use(self, ) -> Union[ + dict, str, list, bytes, None, RESTResponse, tuple, Any]: + return self.sign_up_controller.accept_terms_of_use_using_post() + + def activate_email(self, email_code: str, pkg_name: Optional[str] = None) -> str: + return self.sign_up_controller.activate_email_using_get(email_code=email_code, pkg_name=pkg_name) + + def mobile_login(self, pkg_name: str) -> str: + return self.sign_up_controller.mobile_login_using_get(pkg_name=pkg_name) + + def terms_of_use_accepted(self, ) -> bool: + return self.sign_up_controller.terms_of_use_accepted_using_get() + + def get_device_profiles_by_ids(self, device_profile_ids: list) -> List[DeviceProfileInfo]: + device_profile_ids = ','.join(device_profile_ids) + return self.device_profile_controller.get_device_profiles_by_ids_using_get( + device_profile_ids=device_profile_ids) + + def delete_device_v1(self, ) -> None: + return self.trail_controller.delete_device_using_delete1() + + def thing_park_process_request_tpe_delete(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_delete(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_get(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_get(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_head(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_head(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_options(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_options(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_patch(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_patch(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_post(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_post(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_tpe_put(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_tpe_using_put(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_delete5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_delete5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_get5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_get5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_head5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_head5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_options5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_options5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_patch5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_patch5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v13_post13(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_post13(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def thing_park_process_request_v5_put5(self, body: str, request_headers: dict, all_request_params: dict, + routing_key: str): + return self.thing_park_integration_controller.process_request_using_put5(body=body, + request_headers=request_headers, + all_request_params=all_request_params, + routing_key=routing_key) + + def sig_fox_process_request_v3_delete3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_delete3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_get3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_get3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_head3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_head3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_options3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_options3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_patch3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_patch3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v11_post11(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_post11(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def sig_fox_process_request_v3_put3(self, body: str, request_headers: dict, routing_key: str): + return self.sig_fox_integration_controller.process_request_using_put3(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def assign_scheduler_event_to_edge(self, edge_id: EdgeId, scheduler_event_id: SchedulerEventId) -> SchedulerEventInfo: + edge_id = self.get_id(edge_id) + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.assign_scheduler_event_to_edge_using_post(edge_id=edge_id, + scheduler_event_id=scheduler_event_id) + + def delete_scheduler_event(self, scheduler_event_id: SchedulerEventId) -> None: + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.delete_scheduler_event_using_delete( + scheduler_event_id=scheduler_event_id) + + def get_all_scheduler_events(self, edge_id: EdgeId) -> List[SchedulerEventInfo]: + edge_id = self.get_id(edge_id) + return self.scheduler_event_controller.get_all_scheduler_events_using_get(edge_id=edge_id) + + def get_edge_scheduler_events(self, edge_id: EdgeId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataSchedulerEventInfo: + edge_id = self.get_id(edge_id) + return self.scheduler_event_controller.get_edge_scheduler_events_using_get(edge_id=edge_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_scheduler_event_by_id(self, scheduler_event_id: SchedulerEventId) -> SchedulerEvent: + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.get_scheduler_event_by_id_using_get( + scheduler_event_id=scheduler_event_id) + + def get_scheduler_event_info_by_id(self, scheduler_event_id: SchedulerEventId) -> SchedulerEventWithCustomerInfo: + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.get_scheduler_event_info_by_id_using_get( + scheduler_event_id=scheduler_event_id) + + def get_scheduler_events_by_ids(self, scheduler_event_ids: list) -> List[SchedulerEventInfo]: + return self.scheduler_event_controller.get_scheduler_events_by_ids_using_get( + scheduler_event_ids=str(scheduler_event_ids)) + + def get_scheduler_events(self, type: Optional[str] = None) -> List[SchedulerEventWithCustomerInfo]: + return self.scheduler_event_controller.get_scheduler_events_using_get(type=type) + + def save_scheduler_event(self, body: Optional[SchedulerEvent] = None) -> SchedulerEvent: + return self.scheduler_event_controller.save_scheduler_event_using_post(body=body) + + def unassign_scheduler_event_from_edge(self, edge_id: EdgeId, scheduler_event_id: SchedulerEventId) -> SchedulerEventInfo: + edge_id = self.get_id(edge_id) + scheduler_event_id = self.get_id(scheduler_event_id) + return self.scheduler_event_controller.unassign_scheduler_event_from_edge_using_delete(edge_id=edge_id, + scheduler_event_id=scheduler_event_id) + + def download_dashboard_report(self, dashboard_id: DashboardId, + body: Union[dict, str, list, bytes, None, RESTResponse, tuple, Any] = None): + dashboard_id = self.get_id(dashboard_id) + return self.report_controller.download_dashboard_report_using_post(dashboard_id=dashboard_id, body=body) + + def download_test_report(self, body: Optional[ReportConfig], reports_server_endpoint_url: Optional[str] = None): + return self.report_controller.download_test_report_using_post(body=body, + reports_server_endpoint_url=reports_server_endpoint_url) + + def get_server_time(self, ) -> int: + return self.dashboard_controller.get_server_time_using_get() + + def get_dashboards_by_entity_group_id(self, entity_group_id: EntityGroupId, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDashboardInfo: + entity_group_id = self.get_id(entity_group_id) + return self.dashboard_controller.get_dashboards_by_entity_group_id_using_get(entity_group_id=entity_group_id, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_by_id(self, dashboard_id: DashboardId) -> Dashboard: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_by_id_using_get(dashboard_id=dashboard_id) + + def delete_dashboard(self, dashboard_id: DashboardId) -> None: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.delete_dashboard_using_delete(dashboard_id=dashboard_id) + + def save_dashboard(self, body: Optional[Dashboard] = None) -> Dashboard: + return self.dashboard_controller.save_dashboard_using_post(body=body) + + def get_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_home_dashboard_info_using_get() + + def get_tenant_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_tenant_home_dashboard_info_using_get() + + def set_customer_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_customer_home_dashboard_info_using_post(body=body) + + def get_edge_docker_install_instructions(self, edge_id: EdgeId) -> EdgeInstallInstructions: + edge_id = self.get_id(edge_id) + return self.edge_controller.get_edge_docker_install_instructions_using_get(edge_id=edge_id) + + def get_tenant_dashboards_v1(self, tenant_id: TenantId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataDashboardInfo: + tenant_id = self.get_id(tenant_id) + return self.dashboard_controller.get_tenant_dashboards_using_get1(tenant_id=tenant_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_dashboard_info_by_id(self, dashboard_id: DashboardId) -> DashboardInfo: + dashboard_id = self.get_id(dashboard_id) + return self.dashboard_controller.get_dashboard_info_by_id_using_get(dashboard_id=dashboard_id) + + def get_home_dashboard(self, ) -> HomeDashboard: + return self.dashboard_controller.get_home_dashboard_using_get() + + def get_max_datapoints_limit(self, ) -> int: + return self.dashboard_controller.get_max_datapoints_limit_using_get() + + def get_dashboards_by_ids(self, dashboard_ids: list) -> List[DashboardInfo]: + dashboard_ids = ','.join(dashboard_ids) + return self.dashboard_controller.get_dashboards_by_ids_using_get(dashboard_ids=dashboard_ids) + + def get_customer_home_dashboard_info(self, ) -> HomeDashboardInfo: + return self.dashboard_controller.get_customer_home_dashboard_info_using_get() + + def get_tenant_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_tenant_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_user_dashboards(self, page_size: int, page: int, mobile: Optional[bool] = None, text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, operation: Optional[str] = None, user_id: Optional[str] = None) -> PageDataDashboardInfo: + user_id = self.get_id(user_id) + return self.dashboard_controller.get_user_dashboards_using_get(page_size=page_size, page=page, mobile=mobile, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, operation=operation, + user_id=user_id) + + def import_group_dashboards(self, entity_group_id: EntityGroupId, body: Optional[List[Dashboard]] = None, overwrite: Optional[bool] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.dashboard_controller.import_group_dashboards_using_post(entity_group_id=entity_group_id, body=body, + overwrite=overwrite) + + def set_tenant_home_dashboard_info(self, body: Optional[HomeDashboardInfo] = None) -> None: + return self.dashboard_controller.set_tenant_home_dashboard_info_using_post(body=body) + + def export_group_dashboards(self, entity_group_id: EntityGroupId, limit: int) -> List[Dashboard]: + entity_group_id = self.get_id(entity_group_id) + return self.dashboard_controller.export_group_dashboards_using_get(entity_group_id=entity_group_id, limit=limit) + + def check_integration_connection(self, body: Optional[Integration] = None) -> None: + return self.integration_controller.check_integration_connection_using_post(body=body) + + def delete_integration(self, integration_id: IntegrationId) -> None: + integration_id = self.get_id(integration_id) + return self.integration_controller.delete_integration_using_delete(integration_id=integration_id) + + def get_integration_by_id(self, integration_id: IntegrationId) -> Integration: + integration_id = self.get_id(integration_id) + return self.integration_controller.get_integration_by_id_using_get(integration_id=integration_id) + + def get_integration_by_routing_key(self, routing_key: str) -> Integration: + return self.integration_controller.get_integration_by_routing_key_using_get(routing_key=routing_key) + + def get_integrations_by_ids(self, integration_ids: list) -> List[Integration]: + integration_ids = ','.join(integration_ids) + return self.integration_controller.get_integrations_by_ids_using_get(integration_ids=integration_ids) + + def get_integration_infos(self, page_size: int, page: int, is_edge_template: Optional[bool], + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataIntegrationInfo: + return self.integration_controller.get_integration_infos_using_get(page_size=page_size, page=page, + is_edge_template=is_edge_template, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_integrations(self, page_size: int, page: int, is_edge_template: Optional[bool], text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataIntegration: + return self.integration_controller.get_integrations_using_get(page_size=page_size, page=page, + is_edge_template=is_edge_template, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_integration(self, body: Optional[Integration] = None) -> Integration: + return self.integration_controller.save_integration_using_post(body=body) + + def get_current_custom_menu(self, ) -> CustomMenu: + return self.custom_menu_controller.get_current_custom_menu_using_get() + + def get_custom_menu(self, ) -> CustomMenu: + return self.custom_menu_controller.get_custom_menu_using_get() + + def save_custom_menu(self, body: Optional[CustomMenu] = None) -> CustomMenu: + return self.custom_menu_controller.save_custom_menu_using_post(body=body) + + def get_lwm2m_bootstrap_security_info(self, is_bootstrap_server: bool) -> ServerSecurityConfig: + return self.lwm2m_controller.get_lwm2m_bootstrap_security_info_using_get( + is_bootstrap_server=is_bootstrap_server) + + def get_current_custom_translation(self, ) -> CustomTranslation: + return self.custom_translation_controller.get_current_custom_translation_using_get() + + def get_custom_translation(self, ) -> CustomTranslation: + return self.custom_translation_controller.get_custom_translation_using_get() + + def save_custom_translation(self, body: Optional[CustomTranslation] = None) -> CustomTranslation: + return self.custom_translation_controller.save_custom_translation_using_post(body=body) + + def delete_role(self, role_id: RoleId) -> None: + role_id = self.get_id(role_id) + return self.role_controller.delete_role_using_delete(role_id=role_id) + + def get_role_by_id(self, role_id: RoleId) -> Role: + role_id = self.get_id(role_id) + return self.role_controller.get_role_by_id_using_get(role_id=role_id) + + def get_roles_by_ids(self, role_ids: list) -> List[Role]: + role_ids = ','.join(role_ids) + return self.role_controller.get_roles_by_ids_using_get(role_ids=role_ids) + + def get_roles(self, page_size: int, page: int, type: Optional[str] = None, text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, ) -> PageDataRole: + return self.role_controller.get_roles_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def save_role(self, body: Optional[Role] = None) -> Role: + return self.role_controller.save_role_using_post(body=body) + + def delete_blob_entity(self, blob_entity_id: BlobEntityId) -> None: + blob_entity_id = self.get_id(blob_entity_id) + return self.blob_entity_controller.delete_blob_entity_using_delete(blob_entity_id=blob_entity_id) + + def download_blob_entity(self, blob_entity_id: BlobEntityId) -> Resource: + blob_entity_id = self.get_id(blob_entity_id) + return self.blob_entity_controller.download_blob_entity_using_get(blob_entity_id=blob_entity_id) + + def get_blob_entities_by_ids(self, blob_entity_ids: list) -> List[BlobEntityInfo]: + return self.blob_entity_controller.get_blob_entities_by_ids_using_get(blob_entity_ids=str(blob_entity_ids)) + + def get_blob_entities(self, page_size: int, page: int, type: Optional[str] = None,text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, start_time: Optional[int] = None, end_time: Optional[int] = None) -> PageDataBlobEntityWithCustomerInfo: + return self.blob_entity_controller.get_blob_entities_using_get(page_size=page_size, page=page, type=type, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, start_time=start_time, + end_time=end_time) + + def get_blob_entity_info_by_id(self, blob_entity_id: BlobEntityId) -> BlobEntityWithCustomerInfo: + blob_entity_id = self.get_id(blob_entity_id) + return self.blob_entity_controller.get_blob_entity_info_by_id_using_get(blob_entity_id=blob_entity_id) + + def loriot_process_request_v1_delete1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_delete1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_get1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_get1(body=body, request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_head1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_head1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_options1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_options1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_patch1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_patch1(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v9_post9(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_post9(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def loriot_process_request_v1_put1(self, body: str, request_headers: dict, routing_key: str): + return self.loriot_integration_controller.process_request_using_put1(body=body, request_headers=request_headers, + routing_key=routing_key) + + def get_tenant_infos(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataTenantInfo: + return self.tenant_controller.get_tenant_infos_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def get_tenant_by_id(self, tenant_id: TenantId) -> Tenant: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_by_id_using_get(tenant_id=tenant_id) + + def save_tenant(self, body: Optional[Tenant] = None) -> Tenant: + return self.tenant_controller.save_tenant_using_post(body=body) + + def get_tenants(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataTenant: + return self.tenant_controller.get_tenants_using_get(page_size=page_size, page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_tenants_by_ids(self, tenant_ids: list) -> List[Tenant]: + return self.tenant_controller.get_tenants_by_ids_using_get(tenant_ids=str(tenant_ids)) + + def get_tenant_info_by_id(self, tenant_id: TenantId) -> TenantInfo: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.get_tenant_info_by_id_using_get(tenant_id=tenant_id) + + def delete_tenant(self, tenant_id: TenantId) -> None: + tenant_id = self.get_id(tenant_id) + return self.tenant_controller.delete_tenant_using_delete(tenant_id=tenant_id) + + def chirp_stack_process_request_delete(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_delete(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_get(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_get(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_head(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_head(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_options(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_options(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_patch(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_patch(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_post(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_post(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def chirp_stack_process_request_put(self, body: str, request_headers: dict, routing_key: str): + return self.chirp_stack_integration_controller.process_request_using_put(body=body, + request_headers=request_headers, + routing_key=routing_key) + + def get_current_login_white_label_params(self, ) -> LoginWhiteLabelingParams: + return self.white_labeling_controller.get_current_login_white_label_params_using_get() + + def get_current_white_label_params(self, ) -> WhiteLabelingParams: + return self.white_labeling_controller.get_current_white_label_params_using_get() + + def get_login_white_label_params(self, logo_image_checksum: str, favicon_checksum: str) -> LoginWhiteLabelingParams: + return self.white_labeling_controller.get_login_white_label_params_using_get( + logo_image_checksum=logo_image_checksum, favicon_checksum=favicon_checksum) + + def get_white_label_params(self, logo_image_checksum: str, favicon_checksum: str) -> WhiteLabelingParams: + return self.white_labeling_controller.get_white_label_params_using_get(logo_image_checksum=logo_image_checksum, + favicon_checksum=favicon_checksum) + + def get_widgets_bundles_by_ids(self, widget_bundle_ids: List[str]) -> List[WidgetsBundle]: + widget_bundle_ids = ','.join(widget_bundle_ids) + return self.widgets_bundle_controller.get_widgets_bundles_by_ids_using_get(widget_bundle_ids=widget_bundle_ids) + + def is_customer_white_labeling_allowed(self, ) -> bool: + return self.white_labeling_controller.is_customer_white_labeling_allowed_using_get() + + def is_white_labeling_allowed(self, ) -> bool: + return self.white_labeling_controller.is_white_labeling_allowed_using_get() + + def preview_white_label_params(self, body: Optional[WhiteLabelingParams] = None) -> WhiteLabelingParams: + return self.white_labeling_controller.preview_white_label_params_using_post(body=body) + + def save_login_white_label_params(self, body: Optional[LoginWhiteLabelingParams] = None) -> LoginWhiteLabelingParams: + return self.white_labeling_controller.save_login_white_label_params_using_post(body=body) + + def save_white_label_params(self, body: Optional[WhiteLabelingParams] = None) -> WhiteLabelingParams: + return self.white_labeling_controller.save_white_label_params_using_post(body=body) + + def delete_ota_package(self, ota_package_id: OtaPackageId) -> None: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.delete_ota_package_using_delete(ota_package_id=ota_package_id) + + def get_ota_packages_v1(self, device_profile_id: DeviceProfileId, type: str, page_size: int, page: int, + text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataOtaPackageInfo: + device_profile_id = self.get_id(device_profile_id) + return self.ota_package_controller.get_ota_packages_using_get1(device_profile_id=device_profile_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def save_ota_package_data(self, ota_package_id: OtaPackageId, checksum=None, checksum_algorithm: str = None, file=None) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.save_ota_package_data_using_post(checksum_algorithm=checksum_algorithm, + ota_package_id=ota_package_id, file=file, + checksum=checksum) + + def save_ota_package_info(self, body: Optional[SaveOtaPackageInfoRequest] = None) -> OtaPackageInfo: + return self.ota_package_controller.save_ota_package_info_using_post(body=body) + + def get_ota_packages(self, page_size: int, page: int,text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataOtaPackageInfo: + return self.ota_package_controller.get_ota_packages_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_ota_package_by_id(self, ota_package_id: OtaPackageId) -> OtaPackage: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_by_id_using_get(ota_package_id=ota_package_id) + + def get_group_ota_packages(self, group_id: EntityGroupId, type: str, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataOtaPackageInfo: + group_id = self.get_id(group_id) + return self.ota_package_controller.get_group_ota_packages_using_get(group_id=group_id, type=type, + page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def download_ota_package(self, ota_package_id: OtaPackageId) -> Resource: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.download_ota_package_using_get(ota_package_id=ota_package_id) + + def get_ota_package_info_by_id(self, ota_package_id: OtaPackageId) -> OtaPackageInfo: + ota_package_id = self.get_id(ota_package_id) + return self.ota_package_controller.get_ota_package_info_by_id_using_get(ota_package_id=ota_package_id) + + def add_entities_to_entity_group(self, entity_group_id: EntityGroupId, body: Optional[List[str]] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.add_entities_to_entity_group_using_post(entity_group_id=entity_group_id, + body=body) + + def assign_entity_group_to_edge(self, edge_id: EdgeId, group_type: str, entity_group_id: EntityGroupId) -> EntityGroup: + edge_id = self.get_id(edge_id) + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.assign_entity_group_to_edge_using_post(edge_id=edge_id, + group_type=group_type, + entity_group_id=entity_group_id) + + def delete_entity_group(self, entity_group_id: EntityGroupId) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.delete_entity_group_using_delete(entity_group_id=entity_group_id) + + def get_all_edge_entity_groups(self, edge_id: EdgeId, group_type: str) -> List[EntityGroupInfo]: + edge_id = self.get_id(edge_id) + return self.entity_group_controller.get_all_edge_entity_groups_using_get(edge_id=edge_id, group_type=group_type) + + def get_edge_entity_groups(self, edge_id: EdgeId, group_type: str, page_size: int, page: int, sort_property: Optional[str] = None, + sort_order: Optional[str] = None,) -> PageDataEntityGroupInfo: + edge_id = self.get_id(edge_id) + return self.entity_group_controller.get_edge_entity_groups_using_get(edge_id=edge_id, group_type=group_type, + page_size=page_size, page=page, + sort_property=sort_property, + sort_order=sort_order) + + def get_entities(self, entity_group_id: EntityGroupId, page_size: int, page: int,text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataShortEntityView: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.get_entities_using_get(entity_group_id=entity_group_id, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_all_by_owner_and_type(self, owner_type: str, owner_id: UserId, group_type: str) -> EntityGroupInfo: + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_group_all_by_owner_and_type_using_get(owner_type=owner_type, + owner_id=owner_id, + group_type=group_type) + + def get_entity_groups_by_owner_and_type_and_page_link(self, owner_type: str, owner_id: UserId, group_type: str, + page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataEntityGroupInfo: + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_groups_by_owner_and_type_and_page_link_using_get( + owner_type=owner_type, + owner_id=owner_id, + group_type=group_type, page_size=page_size, + page=page, text_search=text_search, + sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_by_id(self, entity_group_id: EntityGroupId) -> EntityGroupInfo: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.get_entity_group_by_id_using_get(entity_group_id=entity_group_id) + + def get_entity_group_by_owner_and_name_and_type(self, owner_id: UserId, group_type: str, + group_name: str) -> EntityGroupInfo: + owner_type = self.get_type(owner_id) + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_group_by_owner_and_name_and_type_using_get(owner_type=owner_type, + owner_id=owner_id, + group_type=group_type, + group_name=group_name) + + def get_entity_groups_by_ids(self, entity_group_ids: List[str]) -> List[EntityGroupInfo]: + entity_group_ids = ','.join(entity_group_ids) + return self.entity_group_controller.get_entity_groups_by_ids_using_get(entity_group_ids=entity_group_ids) + + def get_entity_groups_by_owner_and_type(self, owner_type: str, owner_id: UserId, group_type: str) -> List[EntityGroupInfo]: + owner_id = self.get_id(owner_id) + return self.entity_group_controller.get_entity_groups_by_owner_and_type_using_get(owner_type=owner_type, + owner_id=owner_id, + group_type=group_type) + + def get_entity_groups_by_type(self, group_type: str, include_shared: Optional[bool] = None) -> List[EntityGroupInfo]: + return self.entity_group_controller.get_entity_groups_by_type_using_get(group_type=group_type, include_shared=include_shared) + + def get_entity_groups_for_entity(self, entity_id: EntityId) -> List[EntityGroupId]: + entity_type = self.get_type(entity_id) + entity_id = self.get_id(entity_id) + return self.entity_group_controller.get_entity_groups_for_entity_using_get(entity_type=entity_type, + entity_id=entity_id) + + def get_group_entity(self, entity_group_id: EntityGroupId, entity_id: EntityId) -> ShortEntityView: + entity_group_id = self.get_id(entity_group_id) + entity_id = self.get_id(entity_id) + return self.entity_group_controller.get_group_entity_using_get(entity_group_id=entity_group_id, + entity_id=entity_id) + + def get_owners(self, page_size: int, page: int, text_search: Optional[str] = None, sort_property: Optional[str] = None, sort_order: Optional[str] = None,) -> PageDataContactBasedobject: + return self.entity_group_controller.get_owners_using_get(page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, + sort_order=sort_order) + + def make_entity_group_private(self, entity_group_id: EntityGroupId) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.make_entity_group_private_using_post(entity_group_id=entity_group_id) + + def make_entity_group_public(self, entity_group_id: EntityGroupId) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.make_entity_group_public_using_post(entity_group_id=entity_group_id) + + def remove_entities_from_entity_group(self, entity_group_id: EntityGroupId, body: Optional[List[str]] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.remove_entities_from_entity_group_using_post( + entity_group_id=entity_group_id, body=body) + + def save_entity_group(self, body: Optional[EntityGroup] = None) -> EntityGroupInfo: + return self.entity_group_controller.save_entity_group_using_post(body=body) + + def share_entity_group_to_child_owner_user_group(self, entity_group_id: EntityGroupId, user_group_id: EntityId, + role_id: RoleId) -> None: + entity_group_id = self.get_id(entity_group_id) + user_group_id = self.get_id(user_group_id) + role_id = self.get_id(role_id) + return self.entity_group_controller.share_entity_group_to_child_owner_user_group_using_post( + entity_group_id=entity_group_id, user_group_id=user_group_id, role_id=role_id) + + def share_entity_group(self, entity_group_id: EntityGroupId, body: Optional[ShareGroupRequest] = None) -> None: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.share_entity_group_using_post(entity_group_id=entity_group_id, body=body) + + def unassign_entity_group_from_edge(self, edge_id: EdgeId, group_type: str, entity_group_id: EntityGroupId) -> EntityGroup: + edge_id = self.get_id(edge_id) + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.unassign_entity_group_from_edge_using_delete(edge_id=edge_id, + group_type=group_type, + entity_group_id=entity_group_id) + + # Subscription Controller + def get_tenant_profile_data_by_id(self, tenant_profile_id: TenantProfileId) -> TenantProfileData: + tenant_profile_id = self.get_id(tenant_profile_id) + return self.subscription_controller.get_tenant_profile_data_by_id_using_get(tenant_profile_id=tenant_profile_id) + + def get_tenant_profile_data(self, ) -> TenantProfileData: + return self.subscription_controller.get_tenant_profile_data_using_get() + + def get_tenant_subscription_usage(self) -> SubscriptionUsage: + return self.subscription_controller.get_tenant_subscription_usage_using_get() + + # Solution Controller + def get_solution_template_details(self, solution_template_id) -> TenantSolutionTemplateDetails: + return self.solution_controller.get_solution_template_details_using_get( + solution_template_id=solution_template_id) + + def get_solution_template_infos(self) -> List[TenantSolutionTemplateInfo]: + return self.solution_controller.get_solution_template_infos_using_get() + + def get_solution_template_instructions(self, solution_template_id) -> TenantSolutionTemplateInstructions: + return self.solution_controller.get_solution_template_instructions_using_get( + solution_template_id=solution_template_id) + + def install_solution_template(self, solution_template_id) -> SolutionInstallResponse: + return self.solution_controller.install_solution_template_using_post(solution_template_id=solution_template_id) + + def uninstall_solution_template(self, solution_template_id) -> None: + return self.solution_controller.uninstall_solution_template_using_delete( + solution_template_id=solution_template_id) + + # Asset Profile Controller + def delete_asset_profile(self, asset_profile_id: AssetProfileId): + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.delete_asset_profile_using_delete(asset_profile_id=asset_profile_id) + + def get_asset_profile_by_id(self, asset_profile_id: AssetProfileId) -> AssetProfile: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.get_asset_profile_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_info_by_id(self, asset_profile_id: AssetProfileId) -> AssetProfileInfo: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.get_asset_profile_info_by_id_using_get(asset_profile_id=asset_profile_id) + + def get_asset_profile_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfileInfo: + return self.asset_profile_controller.get_asset_profile_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_asset_profiles_by_ids(self, asset_profile_ids: List[str]) -> List[AssetProfileInfo]: + asset_profile_ids = ','.join(asset_profile_ids) + return self.asset_profile_controller.get_asset_profiles_by_ids_using_get(asset_profile_ids=asset_profile_ids) + + def get_asset_profiles(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None) -> PageDataAssetProfile: + return self.asset_profile_controller.get_asset_profiles_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_default_asset_profile_info(self) -> AssetProfileInfo: + return self.asset_profile_controller.get_default_asset_profile_info_using_get() + + def save_asset_profile(self, body: AssetProfile) -> AssetProfile: + return self.asset_profile_controller.save_asset_profile_using_post(body=body) + + def set_default_asset_profile(self, asset_profile_id: AssetProfileId) -> AssetProfile: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_profile_controller.set_default_asset_profile_using_post(asset_profile_id=asset_profile_id) + + def get_features_info(self) -> FeaturesInfo: + return self.admin_controller.get_features_info_using_get() + + def get_license_usage_info(self) -> LicenseUsageInfo: + return self.admin_controller.get_license_usage_info_using_get() + + def get_system_info(self) -> SystemInfo: + return self.admin_controller.get_system_info_using_get() + + def assign_alarm(self, alarm_id: AlarmId, assignee_id: str) -> Alarm: + alarm_id = self.get_id(alarm_id) + return self.alarm_controller.assign_alarm_using_post(alarm_id=alarm_id, assignee_id=assignee_id) + + def get_all_asset_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, include_customers: Optional[bool] = None, + asset_profile_id: Optional[AssetProfileId] = None) -> PageDataAssetInfo: + asset_profile_id = self.get_id(asset_profile_id) + return self.asset_controller.get_all_asset_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + asset_profile_id=asset_profile_id) + + def get_all_dashboards(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataDashboardInfo: + return self.dashboard_controller.get_all_dashboards_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_all_device_infos(self, page_size: int, page: int, text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None, + device_profile_id: Optional[DeviceProfileId] = None) -> PageDataDeviceInfo: + if device_profile_id: + device_profile_id = self.get_id(device_profile_id) + + return self.device_controller.get_all_device_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + device_profile_id=device_profile_id) + + def get_customer_device_infos(self, customer_id: CustomerId, page_size: int, page: int, type: Optional[str] = None, + device_profile_id: Optional[DeviceProfileId] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, sort_order: Optional[str] = None, + active: Optional[bool] = None, + include_customers: Optional[bool] = None) -> PageDataDeviceInfo: + customer_id = self.get_id(customer_id) + device_profile_id = self.get_id(device_profile_id) + return self.device_controller.get_customer_device_infos_using_get(customer_id=customer_id, page_size=page_size, + page=page, type=type, + device_profile_id=device_profile_id, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, active=active, + include_customers=include_customers) + + def get_entity_group_entity_info_by_id(self, entity_group_id: EntityGroupId) -> EntityInfo: + entity_group_id = self.get_id(entity_group_id) + return self.entity_group_controller.get_entity_group_entity_info_by_id_using_get(entity_group_id=entity_group_id) + + def get_entity_group_entity_infos_by_ids(self, entity_group_ids: List[str]) -> List[EntityInfo]: + entity_group_ids = ','.join(entity_group_ids) + return self.entity_group_controller.get_entity_group_entity_infos_by_ids_using_get(entity_group_ids=entity_group_ids) + + def get_entity_group_entity_infos_by_owner_and_type_and_page_link(self, owner_id: str, owner_type: str, + group_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_entity_group_entity_infos_by_owner_and_type_and_page_link_using_get( + owner_id=owner_id, owner_type=owner_type, group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_entity_infos_by_type_and_page_link(self, group_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_entity_group_entity_infos_by_type_and_page_link_using_get( + group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link(self, owner_id: str, owner_type: str, + group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_entity_group_entity_infos_hierarchy_by_owner_and_type_and_page_link_using_get( + owner_id=owner_id, owner_type=owner_type, group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_entity_groups_by_type_and_page_link(self, group_type: str, page_size: int, page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityGroupInfo: + return self.entity_group_controller.get_entity_groups_by_type_and_page_link_using_get(group_type=group_type, + page_size=page_size, + page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_entity_groups_hierarchy_by_owner_and_type_and_page_link(self, owner_id: str, owner_type: str, + group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityGroupInfo: + return self.entity_group_controller.get_entity_groups_hierarchy_by_owner_and_type_and_page_link_using_get( + owner_id=owner_id, owner_type=owner_type, group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_owner_info(self, owner_type: str, owner_id: str) -> EntityInfo: + return self.entity_group_controller.get_owner_info_using_get(owner_type=owner_type, owner_id=owner_id) + + def get_owner_infos(self, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_owner_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order) + + def get_shared_entity_group_entity_infos_by_type_and_page_link(self, group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityInfo: + return self.entity_group_controller.get_shared_entity_group_entity_infos_by_type_and_page_link_using_get( + group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_shared_entity_groups_by_type_and_page_link(self, group_type: str, page_size: int, + page: int, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityGroupInfo: + return self.entity_group_controller.get_shared_entity_groups_by_type_and_page_link_using_get( + group_type=group_type, page_size=page_size, page=page, + text_search=text_search, sort_property=sort_property, sort_order=sort_order) + + def get_shared_entity_groups_by_type(self, group_type: str) -> List[EntityGroupInfo]: + return self.entity_group_controller.get_shared_entity_groups_by_type_using_get(group_type=group_type) + + def get_all_entity_view_infos(self, page_size: int, + page: int, + include_customers: Optional[bool] = None, + type: Optional[str] = None, + text_search: Optional[str] = None, + sort_property: Optional[str] = None, + sort_order: Optional[ + str] = None) -> PageDataEntityViewInfo: + return self.entity_view_controller.get_all_entity_view_infos_using_get(page_size=page_size, page=page, + text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers, + type=type) + + def get_customer_entity_view_infos(self, customer_id: CustomerId, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, include_customers: Optional[bool] = None): + customer_id = self.get_id(customer_id) + return self.entity_view_controller.get_customer_entity_view_infos_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_all_user_infos(self, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataUserInfo: + return self.user_controller.get_all_user_infos_using_get(page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_customer_user_infos(self, customer_id: CustomerId, page_size: int, page: int, + type: Optional[str] = None, + text_search: Optional[str] = None, sort_property: Optional[str] = None, + sort_order: Optional[str] = None, + include_customers: Optional[bool] = None) -> PageDataUserInfo: + customer_id = self.get_id(customer_id) + return self.user_controller.get_customer_user_infos_using_get(customer_id=customer_id, + page_size=page_size, page=page, + type=type, text_search=text_search, + sort_property=sort_property, + sort_order=sort_order, + include_customers=include_customers) + + def get_user_info_by_id(self, user_id: UserId) -> UserInfo: + user_id = self.get_id(user_id) + return self.user_controller.get_user_info_by_id_using_get(user_id=user_id) + + def __load_controllers(self): + self.dashboard_controller = DashboardControllerApi(self.api_client) + self.device_profile_controller = DeviceProfileControllerApi(self.api_client) + self.http_integration_controller = HttpIntegrationControllerApi(self.api_client) + self.user_permissions_controller = UserPermissionsControllerApi(self.api_client) + self.device_group_ota_package_controller = DeviceGroupOtaPackageControllerApi(self.api_client) + self.converter_controller = ConverterControllerApi(self.api_client) + self.t_mobile_iot_cdp_integration_controller = TMobileIotCdpIntegrationControllerApi(self.api_client) + self.customer_controller = CustomerControllerApi(self.api_client) + self.role_controller = RoleControllerApi(self.api_client) + self.entity_group_controller = EntityGroupControllerApi(self.api_client) + self.admin_controller = AdminControllerApi(self.api_client) + self.edge_controller = EdgeControllerApi(self.api_client) + self.tenant_controller = TenantControllerApi(self.api_client) + self.trail_controller = TrailControllerApi(self.api_client) + self.report_controller = ReportControllerApi(self.api_client) + self.loriot_integration_controller = LoriotIntegrationControllerApi(self.api_client) + self.entity_view_controller = EntityViewControllerApi(self.api_client) + self.rpc_v2_controller = RpcV2ControllerApi(self.api_client) + self.lwm2m_controller = Lwm2mControllerApi(self.api_client) + self.scheduler_event_controller = SchedulerEventControllerApi(self.api_client) + self.custom_menu_controller = CustomMenuControllerApi(self.api_client) + self.thing_park_integration_controller = ThingParkIntegrationControllerApi(self.api_client) + self.rule_engine_controller = RuleEngineControllerApi(self.api_client) + self.ocean_connect_integration_controller = OceanConnectIntegrationControllerApi(self.api_client) + self.integration_controller = IntegrationControllerApi(self.api_client) + self.custom_translation_controller = CustomTranslationControllerApi(self.api_client) + self.ota_package_controller = OtaPackageControllerApi(self.api_client) + self.edge_event_controller = EdgeEventControllerApi(self.api_client) + self.device_controller = DeviceControllerApi(self.api_client) + self.group_permission_controller = GroupPermissionControllerApi(self.api_client) + self.chirp_stack_integration_controller = ChirpStackIntegrationControllerApi(self.api_client) + self.user_controller = UserControllerApi(self.api_client) + self.white_labeling_controller = WhiteLabelingControllerApi(self.api_client) + self.sign_up_controller = SignUpControllerApi(self.api_client) + self.blob_entity_controller = BlobEntityControllerApi(self.api_client) + self.owner_controller = OwnerControllerApi(self.api_client) + self.self_registration_controller = SelfRegistrationControllerApi(self.api_client) + self.sig_fox_integration_controller = SigFoxIntegrationControllerApi(self.api_client) + self.asset_controller = AssetControllerApi(self.api_client) + self.subscription_controller = SubscriptionControllerApi(self.api_client) + self.solution_controller = SolutionControllerApi(self.api_client) + self.asset_profile_controller = AssetProfileControllerApi(self.api_client) diff --git a/tb-rest-client/tb-rest-client.zip b/tb-rest-client/tb-rest-client.zip new file mode 100644 index 0000000..3bfada9 Binary files /dev/null and b/tb-rest-client/tb-rest-client.zip differ diff --git a/xlsxwriter/.DS_Store b/xlsxwriter/.DS_Store new file mode 100644 index 0000000..5117ba3 Binary files /dev/null and b/xlsxwriter/.DS_Store differ diff --git a/xlsxwriter/python/.DS_Store b/xlsxwriter/python/.DS_Store new file mode 100644 index 0000000..7b6eb1a Binary files /dev/null and b/xlsxwriter/python/.DS_Store differ diff --git a/xlsxwriter/python/bin/__pycache__/vba_extract.cpython-311.pyc b/xlsxwriter/python/bin/__pycache__/vba_extract.cpython-311.pyc new file mode 100644 index 0000000..a0f92ad Binary files /dev/null and b/xlsxwriter/python/bin/__pycache__/vba_extract.cpython-311.pyc differ diff --git a/xlsxwriter/python/bin/vba_extract.py b/xlsxwriter/python/bin/vba_extract.py new file mode 100755 index 0000000..e4c6848 --- /dev/null +++ b/xlsxwriter/python/bin/vba_extract.py @@ -0,0 +1,65 @@ +#!/var/lang/bin/python3.11 + +############################################################################## +# +# vba_extract - A simple utility to extract a vbaProject.bin binary from an +# Excel 2007+ xlsm file for insertion into an XlsxWriter file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import sys +from zipfile import ZipFile +from zipfile import BadZipFile + +# The VBA project file we want to extract. +vba_filename = "vbaProject.bin" + +# Get the xlsm file name from the commandline. +if len(sys.argv) > 1: + xlsm_file = sys.argv[1] +else: + print( + "\nUtility to extract a vbaProject.bin binary from an Excel 2007+ " + "xlsm macro file for insertion into an XlsxWriter file." + "\n" + "See: https://xlsxwriter.readthedocs.io/working_with_macros.html\n" + "\n" + "Usage: vba_extract file.xlsm\n" + ) + exit() + +try: + # Open the Excel xlsm file as a zip file. + xlsm_zip = ZipFile(xlsm_file, "r") + + # Read the xl/vbaProject.bin file. + vba_data = xlsm_zip.read("xl/" + vba_filename) + + # Write the vba data to a local file. + vba_file = open(vba_filename, "wb") + vba_file.write(vba_data) + vba_file.close() + +except IOError as e: + print("File error: %s" % str(e)) + exit() + +except KeyError as e: + # Usually when there isn't a xl/vbaProject.bin member in the file. + print("File error: %s" % str(e)) + print("File may not be an Excel xlsm macro file: '%s'" % xlsm_file) + exit() + +except BadZipFile as e: + # Usually if the file is an xls file and not an xlsm file. + print("File error: %s: '%s'" % (str(e), xlsm_file)) + print("File may not be an Excel xlsm macro file.") + exit() + +except Exception as e: + # Catch any other exceptions. + print("File error: %s" % str(e)) + exit() + +print("Extracted: %s" % vba_filename) diff --git a/xlsxwriter/python/xlsxwriter/__init__.py b/xlsxwriter/python/xlsxwriter/__init__.py new file mode 100644 index 0000000..d91139d --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/__init__.py @@ -0,0 +1,7 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +__version__ = "3.1.2" +__VERSION__ = __version__ +from .workbook import Workbook # noqa diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/__init__.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..82d7905 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/__init__.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/app.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/app.cpython-311.pyc new file mode 100644 index 0000000..2955a67 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/app.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart.cpython-311.pyc new file mode 100644 index 0000000..1f198f9 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_area.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_area.cpython-311.pyc new file mode 100644 index 0000000..e3c594c Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_area.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_bar.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_bar.cpython-311.pyc new file mode 100644 index 0000000..d20d683 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_bar.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_column.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_column.cpython-311.pyc new file mode 100644 index 0000000..427e3f7 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_column.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_doughnut.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_doughnut.cpython-311.pyc new file mode 100644 index 0000000..a893d43 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_doughnut.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_line.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_line.cpython-311.pyc new file mode 100644 index 0000000..e02126e Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_line.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_pie.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_pie.cpython-311.pyc new file mode 100644 index 0000000..9fa966a Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_pie.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_radar.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_radar.cpython-311.pyc new file mode 100644 index 0000000..3c7fde5 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_radar.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_scatter.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_scatter.cpython-311.pyc new file mode 100644 index 0000000..851ee18 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_scatter.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chart_stock.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chart_stock.cpython-311.pyc new file mode 100644 index 0000000..463a613 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chart_stock.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/chartsheet.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/chartsheet.cpython-311.pyc new file mode 100644 index 0000000..def0b65 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/chartsheet.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/comments.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/comments.cpython-311.pyc new file mode 100644 index 0000000..64796e0 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/comments.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/contenttypes.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/contenttypes.cpython-311.pyc new file mode 100644 index 0000000..841e6a8 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/contenttypes.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/core.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/core.cpython-311.pyc new file mode 100644 index 0000000..dcc6e9d Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/core.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/custom.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/custom.cpython-311.pyc new file mode 100644 index 0000000..8275002 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/custom.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/drawing.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/drawing.cpython-311.pyc new file mode 100644 index 0000000..b5f1aff Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/drawing.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/exceptions.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/exceptions.cpython-311.pyc new file mode 100644 index 0000000..2f0434a Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/exceptions.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/format.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/format.cpython-311.pyc new file mode 100644 index 0000000..dfd74d5 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/format.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/metadata.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/metadata.cpython-311.pyc new file mode 100644 index 0000000..2b8943a Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/metadata.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/packager.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/packager.cpython-311.pyc new file mode 100644 index 0000000..86501e0 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/packager.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/relationships.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/relationships.cpython-311.pyc new file mode 100644 index 0000000..ca67f06 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/relationships.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/shape.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/shape.cpython-311.pyc new file mode 100644 index 0000000..c69b368 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/shape.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/sharedstrings.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/sharedstrings.cpython-311.pyc new file mode 100644 index 0000000..f6e23fc Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/sharedstrings.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/styles.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/styles.cpython-311.pyc new file mode 100644 index 0000000..6d20803 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/styles.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/table.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/table.cpython-311.pyc new file mode 100644 index 0000000..c8cc621 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/table.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/theme.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/theme.cpython-311.pyc new file mode 100644 index 0000000..b8a6c04 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/theme.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/utility.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/utility.cpython-311.pyc new file mode 100644 index 0000000..af9e839 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/utility.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/vml.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/vml.cpython-311.pyc new file mode 100644 index 0000000..3476c11 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/vml.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/workbook.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/workbook.cpython-311.pyc new file mode 100644 index 0000000..afa4b6f Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/workbook.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/worksheet.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/worksheet.cpython-311.pyc new file mode 100644 index 0000000..ff13af3 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/worksheet.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/__pycache__/xmlwriter.cpython-311.pyc b/xlsxwriter/python/xlsxwriter/__pycache__/xmlwriter.cpython-311.pyc new file mode 100644 index 0000000..e044d35 Binary files /dev/null and b/xlsxwriter/python/xlsxwriter/__pycache__/xmlwriter.cpython-311.pyc differ diff --git a/xlsxwriter/python/xlsxwriter/app.py b/xlsxwriter/python/xlsxwriter/app.py new file mode 100644 index 0000000..2b7d5d6 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/app.py @@ -0,0 +1,198 @@ +############################################################################### +# +# App - A class for writing the Excel XLSX App file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class App(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX App file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(App, self).__init__() + + self.part_names = [] + self.heading_pairs = [] + self.properties = {} + self.doc_security = 0 + + def _add_part_name(self, part_name): + # Add the name of a workbook Part such as 'Sheet1' or 'Print_Titles'. + self.part_names.append(part_name) + + def _add_heading_pair(self, heading_pair): + # Add the name of a workbook Heading Pair such as 'Worksheets', + # 'Charts' or 'Named Ranges'. + + # Ignore empty pairs such as chartsheets. + if not heading_pair[1]: + return + + self.heading_pairs.append(("lpstr", heading_pair[0])) + self.heading_pairs.append(("i4", heading_pair[1])) + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_properties() + self._write_application() + self._write_doc_security() + self._write_scale_crop() + self._write_heading_pairs() + self._write_titles_of_parts() + self._write_manager() + self._write_company() + self._write_links_up_to_date() + self._write_shared_doc() + self._write_hyperlink_base() + self._write_hyperlinks_changed() + self._write_app_version() + + self._xml_end_tag("Properties") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_properties(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/2006/" + xmlns = schema + "extended-properties" + xmlns_vt = schema + "docPropsVTypes" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:vt", xmlns_vt), + ] + + self._xml_start_tag("Properties", attributes) + + def _write_application(self): + # Write the element. + self._xml_data_element("Application", "Microsoft Excel") + + def _write_doc_security(self): + # Write the element. + self._xml_data_element("DocSecurity", self.doc_security) + + def _write_scale_crop(self): + # Write the element. + self._xml_data_element("ScaleCrop", "false") + + def _write_heading_pairs(self): + # Write the element. + self._xml_start_tag("HeadingPairs") + self._write_vt_vector("variant", self.heading_pairs) + self._xml_end_tag("HeadingPairs") + + def _write_titles_of_parts(self): + # Write the element. + parts_data = [] + + self._xml_start_tag("TitlesOfParts") + + for part_name in self.part_names: + parts_data.append(("lpstr", part_name)) + + self._write_vt_vector("lpstr", parts_data) + + self._xml_end_tag("TitlesOfParts") + + def _write_vt_vector(self, base_type, vector_data): + # Write the element. + attributes = [ + ("size", len(vector_data)), + ("baseType", base_type), + ] + + self._xml_start_tag("vt:vector", attributes) + + for vt_data in vector_data: + if base_type == "variant": + self._xml_start_tag("vt:variant") + + self._write_vt_data(vt_data) + + if base_type == "variant": + self._xml_end_tag("vt:variant") + + self._xml_end_tag("vt:vector") + + def _write_vt_data(self, vt_data): + # Write the elements such as and . + self._xml_data_element("vt:%s" % vt_data[0], vt_data[1]) + + def _write_company(self): + company = self.properties.get("company", "") + + self._xml_data_element("Company", company) + + def _write_manager(self): + # Write the element. + if "manager" not in self.properties: + return + + self._xml_data_element("Manager", self.properties["manager"]) + + def _write_links_up_to_date(self): + # Write the element. + self._xml_data_element("LinksUpToDate", "false") + + def _write_shared_doc(self): + # Write the element. + self._xml_data_element("SharedDoc", "false") + + def _write_hyperlink_base(self): + # Write the element. + hyperlink_base = self.properties.get("hyperlink_base") + + if hyperlink_base is None: + return + + self._xml_data_element("HyperlinkBase", hyperlink_base) + + def _write_hyperlinks_changed(self): + # Write the element. + self._xml_data_element("HyperlinksChanged", "false") + + def _write_app_version(self): + # Write the element. + self._xml_data_element("AppVersion", "12.0000") diff --git a/xlsxwriter/python/xlsxwriter/chart.py b/xlsxwriter/python/xlsxwriter/chart.py new file mode 100644 index 0000000..d34fa83 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart.py @@ -0,0 +1,4278 @@ +############################################################################### +# +# Chart - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import re +import copy +from warnings import warn + +from .shape import Shape +from . import xmlwriter +from .utility import get_rgb_color +from .utility import xl_rowcol_to_cell +from .utility import xl_range_formula +from .utility import supported_datetime +from .utility import datetime_to_excel_datetime +from .utility import quote_sheetname + + +class Chart(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Chart file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + + super(Chart, self).__init__() + + self.subtype = None + self.sheet_type = 0x0200 + self.orientation = 0x0 + self.series = [] + self.embedded = 0 + self.id = -1 + self.series_index = 0 + self.style_id = 2 + self.axis_ids = [] + self.axis2_ids = [] + self.cat_has_num_fmt = 0 + self.requires_category = False + self.legend = {} + self.cat_axis_position = "b" + self.val_axis_position = "l" + self.formula_ids = {} + self.formula_data = [] + self.horiz_cat_axis = 0 + self.horiz_val_axis = 1 + self.protection = 0 + self.chartarea = {} + self.plotarea = {} + self.x_axis = {} + self.y_axis = {} + self.y2_axis = {} + self.x2_axis = {} + self.chart_name = "" + self.show_blanks = "gap" + self.show_hidden = 0 + self.show_crosses = 1 + self.width = 480 + self.height = 288 + self.x_scale = 1 + self.y_scale = 1 + self.x_offset = 0 + self.y_offset = 0 + self.table = None + self.cross_between = "between" + self.default_marker = None + self.series_gap_1 = None + self.series_gap_2 = None + self.series_overlap_1 = None + self.series_overlap_2 = None + self.drop_lines = None + self.hi_low_lines = None + self.up_down_bars = None + self.smooth_allowed = False + self.title_font = None + self.title_name = None + self.title_formula = None + self.title_data_id = None + self.title_layout = None + self.title_overlay = None + self.title_none = False + self.date_category = False + self.date_1904 = False + self.remove_timezone = False + self.label_positions = {} + self.label_position_default = "" + self.already_inserted = False + self.combined = None + self.is_secondary = False + self.warn_sheetname = True + self._set_default_properties() + + def add_series(self, options=None): + """ + Add a data series to a chart. + + Args: + options: A dictionary of chart series options. + + Returns: + Nothing. + + """ + # Add a series and it's properties to a chart. + if options is None: + options = {} + + # Check that the required input has been specified. + if "values" not in options: + warn("Must specify 'values' in add_series()") + return + + if self.requires_category and "categories" not in options: + warn("Must specify 'categories' in add_series() for this chart type") + return + + if len(self.series) == 255: + warn( + "The maximum number of series that can be added to an " + "Excel Chart is 255" + ) + return + + # Convert list into a formula string. + values = self._list_to_formula(options.get("values")) + categories = self._list_to_formula(options.get("categories")) + + # Switch name and name_formula parameters if required. + name, name_formula = self._process_names( + options.get("name"), options.get("name_formula") + ) + + # Get an id for the data equivalent to the range formula. + cat_id = self._get_data_id(categories, options.get("categories_data")) + val_id = self._get_data_id(values, options.get("values_data")) + name_id = self._get_data_id(name_formula, options.get("name_data")) + + # Set the line properties for the series. + line = Shape._get_line_properties(options.get("line")) + + # Allow 'border' as a synonym for 'line' in bar/column style charts. + if options.get("border"): + line = Shape._get_line_properties(options["border"]) + + # Set the fill properties for the series. + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + # Set the marker properties for the series. + marker = self._get_marker_properties(options.get("marker")) + + # Set the trendline properties for the series. + trendline = self._get_trendline_properties(options.get("trendline")) + + # Set the line smooth property for the series. + smooth = options.get("smooth") + + # Set the error bars properties for the series. + y_error_bars = self._get_error_bars_props(options.get("y_error_bars")) + x_error_bars = self._get_error_bars_props(options.get("x_error_bars")) + + error_bars = {"x_error_bars": x_error_bars, "y_error_bars": y_error_bars} + + # Set the point properties for the series. + points = self._get_points_properties(options.get("points")) + + # Set the labels properties for the series. + labels = self._get_labels_properties(options.get("data_labels")) + + # Set the "invert if negative" fill property. + invert_if_neg = options.get("invert_if_negative", False) + inverted_color = options.get("invert_if_negative_color", False) + + # Set the secondary axis properties. + x2_axis = options.get("x2_axis") + y2_axis = options.get("y2_axis") + + # Store secondary status for combined charts. + if x2_axis or y2_axis: + self.is_secondary = True + + # Set the gap for Bar/Column charts. + if options.get("gap") is not None: + if y2_axis: + self.series_gap_2 = options["gap"] + else: + self.series_gap_1 = options["gap"] + + # Set the overlap for Bar/Column charts. + if options.get("overlap"): + if y2_axis: + self.series_overlap_2 = options["overlap"] + else: + self.series_overlap_1 = options["overlap"] + + # Add the user supplied data to the internal structures. + series = { + "values": values, + "categories": categories, + "name": name, + "name_formula": name_formula, + "name_id": name_id, + "val_data_id": val_id, + "cat_data_id": cat_id, + "line": line, + "fill": fill, + "pattern": pattern, + "gradient": gradient, + "marker": marker, + "trendline": trendline, + "labels": labels, + "invert_if_neg": invert_if_neg, + "inverted_color": inverted_color, + "x2_axis": x2_axis, + "y2_axis": y2_axis, + "points": points, + "error_bars": error_bars, + "smooth": smooth, + } + + self.series.append(series) + + def set_x_axis(self, options): + """ + Set the chart X axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.x_axis, options) + + self.x_axis = axis + + def set_y_axis(self, options): + """ + Set the chart Y axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.y_axis, options) + + self.y_axis = axis + + def set_x2_axis(self, options): + """ + Set the chart secondary X axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.x2_axis, options) + + self.x2_axis = axis + + def set_y2_axis(self, options): + """ + Set the chart secondary Y axis options. + + Args: + options: A dictionary of axis options. + + Returns: + Nothing. + + """ + axis = self._convert_axis_args(self.y2_axis, options) + + self.y2_axis = axis + + def set_title(self, options=None): + """ + Set the chart title options. + + Args: + options: A dictionary of chart title options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + name, name_formula = self._process_names( + options.get("name"), options.get("name_formula") + ) + + data_id = self._get_data_id(name_formula, options.get("data")) + + self.title_name = name + self.title_formula = name_formula + self.title_data_id = data_id + + # Set the font properties if present. + self.title_font = self._convert_font_args(options.get("name_font")) + + # Set the axis name layout. + self.title_layout = self._get_layout_properties(options.get("layout"), True) + # Set the title overlay option. + self.title_overlay = options.get("overlay") + + # Set the automatic title option. + self.title_none = options.get("none") + + def set_legend(self, options): + """ + Set the chart legend options. + + Args: + options: A dictionary of chart legend options. + + Returns: + Nothing. + """ + # Convert the user defined properties to internal properties. + self.legend = self._get_legend_properties(options) + + def set_plotarea(self, options): + """ + Set the chart plot area options. + + Args: + options: A dictionary of chart plot area options. + + Returns: + Nothing. + """ + # Convert the user defined properties to internal properties. + self.plotarea = self._get_area_properties(options) + + def set_chartarea(self, options): + """ + Set the chart area options. + + Args: + options: A dictionary of chart area options. + + Returns: + Nothing. + """ + # Convert the user defined properties to internal properties. + self.chartarea = self._get_area_properties(options) + + def set_style(self, style_id): + """ + Set the chart style type. + + Args: + style_id: An int representing the chart style. + + Returns: + Nothing. + """ + # Set one of the 48 built-in Excel chart styles. The default is 2. + if style_id is None: + style_id = 2 + + if style_id < 1 or style_id > 48: + style_id = 2 + + self.style_id = style_id + + def show_blanks_as(self, option): + """ + Set the option for displaying blank data in a chart. + + Args: + option: A string representing the display option. + + Returns: + Nothing. + """ + if not option: + return + + valid_options = { + "gap": 1, + "zero": 1, + "span": 1, + } + + if option not in valid_options: + warn("Unknown show_blanks_as() option '%s'" % option) + return + + self.show_blanks = option + + def show_hidden_data(self): + """ + Display data on charts from hidden rows or columns. + + Args: + option: A string representing the display option. + + Returns: + Nothing. + """ + self.show_hidden = 1 + + def set_size(self, options=None): + """ + Set size or scale of the chart. + + Args: + options: A dictionary of chart size options. + + Returns: + Nothing. + """ + if options is None: + options = {} + + # Set dimensions or scale for the chart. + self.width = options.get("width", self.width) + self.height = options.get("height", self.height) + self.x_scale = options.get("x_scale", 1) + self.y_scale = options.get("y_scale", 1) + self.x_offset = options.get("x_offset", 0) + self.y_offset = options.get("y_offset", 0) + + def set_table(self, options=None): + """ + Set properties for an axis data table. + + Args: + options: A dictionary of axis table options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + table = {} + + table["horizontal"] = options.get("horizontal", 1) + table["vertical"] = options.get("vertical", 1) + table["outline"] = options.get("outline", 1) + table["show_keys"] = options.get("show_keys", 0) + table["font"] = self._convert_font_args(options.get("font")) + + self.table = table + + def set_up_down_bars(self, options=None): + """ + Set properties for the chart up-down bars. + + Args: + options: A dictionary of options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + # Defaults. + up_line = None + up_fill = None + down_line = None + down_fill = None + + # Set properties for 'up' bar. + if options.get("up"): + if "border" in options["up"]: + # Map border to line. + up_line = Shape._get_line_properties(options["up"]["border"]) + + if "line" in options["up"]: + up_line = Shape._get_line_properties(options["up"]["line"]) + + if "fill" in options["up"]: + up_fill = Shape._get_fill_properties(options["up"]["fill"]) + + # Set properties for 'down' bar. + if options.get("down"): + if "border" in options["down"]: + # Map border to line. + down_line = Shape._get_line_properties(options["down"]["border"]) + + if "line" in options["down"]: + down_line = Shape._get_line_properties(options["down"]["line"]) + + if "fill" in options["down"]: + down_fill = Shape._get_fill_properties(options["down"]["fill"]) + + self.up_down_bars = { + "up": { + "line": up_line, + "fill": up_fill, + }, + "down": { + "line": down_line, + "fill": down_fill, + }, + } + + def set_drop_lines(self, options=None): + """ + Set properties for the chart drop lines. + + Args: + options: A dictionary of options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + line = Shape._get_line_properties(options.get("line")) + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + self.drop_lines = { + "line": line, + "fill": fill, + "pattern": pattern, + "gradient": gradient, + } + + def set_high_low_lines(self, options=None): + """ + Set properties for the chart high-low lines. + + Args: + options: A dictionary of options. + + Returns: + Nothing. + + """ + if options is None: + options = {} + + line = Shape._get_line_properties(options.get("line")) + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + self.hi_low_lines = { + "line": line, + "fill": fill, + "pattern": pattern, + "gradient": gradient, + } + + def combine(self, chart=None): + """ + Create a combination chart with a secondary chart. + + Args: + chart: The secondary chart to combine with the primary chart. + + Returns: + Nothing. + + """ + if chart is None: + return + + self.combined = chart + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the c:chartSpace element. + self._write_chart_space() + + # Write the c:lang element. + self._write_lang() + + # Write the c:style element. + self._write_style() + + # Write the c:protection element. + self._write_protection() + + # Write the c:chart element. + self._write_chart() + + # Write the c:spPr element for the chartarea formatting. + self._write_sp_pr(self.chartarea) + + # Write the c:printSettings element. + if self.embedded: + self._write_print_settings() + + # Close the worksheet tag. + self._xml_end_tag("c:chartSpace") + # Close the file. + self._xml_close() + + def _convert_axis_args(self, axis, user_options): + # Convert user defined axis values into private hash values. + options = axis["defaults"].copy() + options.update(user_options) + + name, name_formula = self._process_names( + options.get("name"), options.get("name_formula") + ) + + data_id = self._get_data_id(name_formula, options.get("data")) + + axis = { + "defaults": axis["defaults"], + "name": name, + "formula": name_formula, + "data_id": data_id, + "reverse": options.get("reverse"), + "min": options.get("min"), + "max": options.get("max"), + "minor_unit": options.get("minor_unit"), + "major_unit": options.get("major_unit"), + "minor_unit_type": options.get("minor_unit_type"), + "major_unit_type": options.get("major_unit_type"), + "display_units": options.get("display_units"), + "log_base": options.get("log_base"), + "crossing": options.get("crossing"), + "position_axis": options.get("position_axis"), + "position": options.get("position"), + "label_position": options.get("label_position"), + "label_align": options.get("label_align"), + "num_format": options.get("num_format"), + "num_format_linked": options.get("num_format_linked"), + "interval_unit": options.get("interval_unit"), + "interval_tick": options.get("interval_tick"), + "text_axis": False, + } + + if "visible" in options: + axis["visible"] = options.get("visible") + else: + axis["visible"] = 1 + + # Convert the display units. + axis["display_units"] = self._get_display_units(axis["display_units"]) + axis["display_units_visible"] = options.get("display_units_visible", True) + + # Map major_gridlines properties. + if options.get("major_gridlines") and options["major_gridlines"]["visible"]: + axis["major_gridlines"] = self._get_gridline_properties( + options["major_gridlines"] + ) + + # Map minor_gridlines properties. + if options.get("minor_gridlines") and options["minor_gridlines"]["visible"]: + axis["minor_gridlines"] = self._get_gridline_properties( + options["minor_gridlines"] + ) + + # Only use the first letter of bottom, top, left or right. + if axis.get("position"): + axis["position"] = axis["position"].lower()[0] + + # Set the position for a category axis on or between the tick marks. + if axis.get("position_axis"): + if axis["position_axis"] == "on_tick": + axis["position_axis"] = "midCat" + elif axis["position_axis"] == "between": + # Doesn't need to be modified. + pass + else: + # Otherwise use the default value. + axis["position_axis"] = None + + # Set the category axis as a date axis. + if options.get("date_axis"): + self.date_category = True + + # Set the category axis as a text axis. + if options.get("text_axis"): + self.date_category = False + axis["text_axis"] = True + + # Convert datetime args if required. + if axis.get("min") and supported_datetime(axis["min"]): + axis["min"] = datetime_to_excel_datetime( + axis["min"], self.date_1904, self.remove_timezone + ) + if axis.get("max") and supported_datetime(axis["max"]): + axis["max"] = datetime_to_excel_datetime( + axis["max"], self.date_1904, self.remove_timezone + ) + if axis.get("crossing") and supported_datetime(axis["crossing"]): + axis["crossing"] = datetime_to_excel_datetime( + axis["crossing"], self.date_1904, self.remove_timezone + ) + + # Set the font properties if present. + axis["num_font"] = self._convert_font_args(options.get("num_font")) + axis["name_font"] = self._convert_font_args(options.get("name_font")) + + # Set the axis name layout. + axis["name_layout"] = self._get_layout_properties( + options.get("name_layout"), True + ) + + # Set the line properties for the axis. + axis["line"] = Shape._get_line_properties(options.get("line")) + + # Set the fill properties for the axis. + axis["fill"] = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + axis["pattern"] = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + axis["gradient"] = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if axis.get("pattern"): + axis["fill"] = None + + # Gradient fill overrides the solid and pattern fill. + if axis.get("gradient"): + axis["pattern"] = None + axis["fill"] = None + + # Set the tick marker types. + axis["minor_tick_mark"] = self._get_tick_type(options.get("minor_tick_mark")) + axis["major_tick_mark"] = self._get_tick_type(options.get("major_tick_mark")) + + return axis + + def _convert_font_args(self, options): + # Convert user defined font values into private dict values. + if not options: + return + + font = { + "name": options.get("name"), + "color": options.get("color"), + "size": options.get("size"), + "bold": options.get("bold"), + "italic": options.get("italic"), + "underline": options.get("underline"), + "pitch_family": options.get("pitch_family"), + "charset": options.get("charset"), + "baseline": options.get("baseline", 0), + "rotation": options.get("rotation"), + } + + # Convert font size units. + if font["size"]: + font["size"] = int(font["size"] * 100) + + # Convert rotation into 60,000ths of a degree. + if font["rotation"]: + font["rotation"] = 60000 * int(font["rotation"]) + + return font + + def _list_to_formula(self, data): + # Convert and list of row col values to a range formula. + + # If it isn't an array ref it is probably a formula already. + if type(data) is not list: + # Check for unquoted sheetnames. + if data and " " in data and "'" not in data and self.warn_sheetname: + warn( + "Sheetname in '%s' contains spaces but isn't quoted. " + "This may cause errors in Excel." % data + ) + return data + + formula = xl_range_formula(*data) + + return formula + + def _process_names(self, name, name_formula): + # Switch name and name_formula parameters if required. + + if name is not None: + if isinstance(name, list): + # Convert a list of values into a name formula. + cell = xl_rowcol_to_cell(name[1], name[2], True, True) + name_formula = quote_sheetname(name[0]) + "!" + cell + name = "" + elif re.match(r"^=?[^!]+!\$?[A-Z]+\$?\d+", name): + # Name looks like a formula, use it to set name_formula. + name_formula = name + name = "" + + return name, name_formula + + def _get_data_type(self, data): + # Find the overall type of the data associated with a series. + + # Check for no data in the series. + if data is None or len(data) == 0: + return "none" + + if isinstance(data[0], list): + return "multi_str" + + # Determine if data is numeric or strings. + for token in data: + if token is None: + continue + + # Check for strings that would evaluate to float like + # '1.1_1' of ' 1'. + if type(token) == str and re.search("[_ ]", token): + # Assume entire data series is string data. + return "str" + + try: + float(token) + except ValueError: + # Not a number. Assume entire data series is string data. + return "str" + + # The series data was all numeric. + return "num" + + def _get_data_id(self, formula, data): + # Assign an id to a each unique series formula or title/axis formula. + # Repeated formulas such as for categories get the same id. If the + # series or title has user specified data associated with it then + # that is also stored. This data is used to populate cached Excel + # data when creating a chart. If there is no user defined data then + # it will be populated by the parent Workbook._add_chart_data(). + + # Ignore series without a range formula. + if not formula: + return + + # Strip the leading '=' from the formula. + if formula.startswith("="): + formula = formula.lstrip("=") + + # Store the data id in a hash keyed by the formula and store the data + # in a separate array with the same id. + if formula not in self.formula_ids: + # Haven't seen this formula before. + formula_id = len(self.formula_data) + + self.formula_data.append(data) + self.formula_ids[formula] = formula_id + else: + # Formula already seen. Return existing id. + formula_id = self.formula_ids[formula] + + # Store user defined data if it isn't already there. + if self.formula_data[formula_id] is None: + self.formula_data[formula_id] = data + + return formula_id + + def _get_marker_properties(self, marker): + # Convert user marker properties to the structure required internally. + + if not marker: + return + + # Copy the user defined properties since they will be modified. + marker = copy.deepcopy(marker) + + types = { + "automatic": "automatic", + "none": "none", + "square": "square", + "diamond": "diamond", + "triangle": "triangle", + "x": "x", + "star": "star", + "dot": "dot", + "short_dash": "dot", + "dash": "dash", + "long_dash": "dash", + "circle": "circle", + "plus": "plus", + "picture": "picture", + } + + # Check for valid types. + marker_type = marker.get("type") + + if marker_type is not None: + if marker_type in types: + marker["type"] = types[marker_type] + else: + warn("Unknown marker type '%s" % marker_type) + return + + # Set the line properties for the marker. + line = Shape._get_line_properties(marker.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in marker: + line = Shape._get_line_properties(marker["border"]) + + # Set the fill properties for the marker. + fill = Shape._get_fill_properties(marker.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(marker.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(marker.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + marker["line"] = line + marker["fill"] = fill + marker["pattern"] = pattern + marker["gradient"] = gradient + + return marker + + def _get_trendline_properties(self, trendline): + # Convert user trendline properties to structure required internally. + + if not trendline: + return + + # Copy the user defined properties since they will be modified. + trendline = copy.deepcopy(trendline) + + types = { + "exponential": "exp", + "linear": "linear", + "log": "log", + "moving_average": "movingAvg", + "polynomial": "poly", + "power": "power", + } + + # Check the trendline type. + trend_type = trendline.get("type") + + if trend_type in types: + trendline["type"] = types[trend_type] + else: + warn("Unknown trendline type '%s'" % trend_type) + return + + # Set the line properties for the trendline. + line = Shape._get_line_properties(trendline.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in trendline: + line = Shape._get_line_properties(trendline["border"]) + + # Set the fill properties for the trendline. + fill = Shape._get_fill_properties(trendline.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(trendline.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(trendline.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + trendline["line"] = line + trendline["fill"] = fill + trendline["pattern"] = pattern + trendline["gradient"] = gradient + + return trendline + + def _get_error_bars_props(self, options): + # Convert user error bars properties to structure required internally. + if not options: + return + + # Default values. + error_bars = {"type": "fixedVal", "value": 1, "endcap": 1, "direction": "both"} + + types = { + "fixed": "fixedVal", + "percentage": "percentage", + "standard_deviation": "stdDev", + "standard_error": "stdErr", + "custom": "cust", + } + + # Check the error bars type. + error_type = options["type"] + + if error_type in types: + error_bars["type"] = types[error_type] + else: + warn("Unknown error bars type '%s" % error_type) + return + + # Set the value for error types that require it. + if "value" in options: + error_bars["value"] = options["value"] + + # Set the end-cap style. + if "end_style" in options: + error_bars["endcap"] = options["end_style"] + + # Set the error bar direction. + if "direction" in options: + if options["direction"] == "minus": + error_bars["direction"] = "minus" + elif options["direction"] == "plus": + error_bars["direction"] = "plus" + else: + # Default to 'both'. + pass + + # Set any custom values. + error_bars["plus_values"] = options.get("plus_values") + error_bars["minus_values"] = options.get("minus_values") + error_bars["plus_data"] = options.get("plus_data") + error_bars["minus_data"] = options.get("minus_data") + + # Set the line properties for the error bars. + error_bars["line"] = Shape._get_line_properties(options.get("line")) + + return error_bars + + def _get_gridline_properties(self, options): + # Convert user gridline properties to structure required internally. + + # Set the visible property for the gridline. + gridline = {"visible": options.get("visible")} + + # Set the line properties for the gridline. + gridline["line"] = Shape._get_line_properties(options.get("line")) + + return gridline + + def _get_labels_properties(self, labels): + # Convert user labels properties to the structure required internally. + + if not labels: + return None + + # Copy the user defined properties since they will be modified. + labels = copy.deepcopy(labels) + + # Map user defined label positions to Excel positions. + position = labels.get("position") + + if position: + if position in self.label_positions: + if position == self.label_position_default: + labels["position"] = None + else: + labels["position"] = self.label_positions[position] + else: + warn("Unsupported label position '%s' for this chart type" % position) + return + + # Map the user defined label separator to the Excel separator. + separator = labels.get("separator") + separators = { + ",": ", ", + ";": "; ", + ".": ". ", + "\n": "\n", + " ": " ", + } + + if separator: + if separator in separators: + labels["separator"] = separators[separator] + else: + warn("Unsupported label separator") + return + + # Set the font properties if present. + labels["font"] = self._convert_font_args(labels.get("font")) + + # Set the line properties for the labels. + line = Shape._get_line_properties(labels.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in labels: + line = Shape._get_line_properties(labels["border"]) + + # Set the fill properties for the labels. + fill = Shape._get_fill_properties(labels.get("fill")) + + # Set the pattern fill properties for the labels. + pattern = Shape._get_pattern_properties(labels.get("pattern")) + + # Set the gradient fill properties for the labels. + gradient = Shape._get_gradient_properties(labels.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + labels["line"] = line + labels["fill"] = fill + labels["pattern"] = pattern + labels["gradient"] = gradient + + if labels.get("custom"): + for label in labels["custom"]: + if label is None: + continue + + value = label.get("value") + if value and re.match(r"^=?[^!]+!\$?[A-Z]+\$?\d+", str(value)): + label["formula"] = value + + formula = label.get("formula") + if formula and formula.startswith("="): + label["formula"] = formula.lstrip("=") + + data_id = self._get_data_id(formula, label.get("data")) + label["data_id"] = data_id + + label["font"] = self._convert_font_args(label.get("font")) + + # Set the line properties for the label. + line = Shape._get_line_properties(label.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in label: + line = Shape._get_line_properties(label["border"]) + + # Set the fill properties for the label. + fill = Shape._get_fill_properties(label.get("fill")) + + # Set the pattern fill properties for the label. + pattern = Shape._get_pattern_properties(label.get("pattern")) + + # Set the gradient fill properties for the label. + gradient = Shape._get_gradient_properties(label.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + label["line"] = line + label["fill"] = fill + label["pattern"] = pattern + label["gradient"] = gradient + + return labels + + def _get_area_properties(self, options): + # Convert user area properties to the structure required internally. + area = {} + + # Set the line properties for the chartarea. + line = Shape._get_line_properties(options.get("line")) + + # Allow 'border' as a synonym for 'line'. + if options.get("border"): + line = Shape._get_line_properties(options["border"]) + + # Set the fill properties for the chartarea. + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + # Set the plotarea layout. + layout = self._get_layout_properties(options.get("layout"), False) + + area["line"] = line + area["fill"] = fill + area["pattern"] = pattern + area["layout"] = layout + area["gradient"] = gradient + + return area + + def _get_legend_properties(self, options=None): + # Convert user legend properties to the structure required internally. + legend = {} + + if options is None: + options = {} + + legend["position"] = options.get("position", "right") + legend["delete_series"] = options.get("delete_series") + legend["font"] = self._convert_font_args(options.get("font")) + legend["layout"] = self._get_layout_properties(options.get("layout"), False) + + # Turn off the legend. + if options.get("none"): + legend["position"] = "none" + + # Set the line properties for the legend. + line = Shape._get_line_properties(options.get("line")) + + # Allow 'border' as a synonym for 'line'. + if options.get("border"): + line = Shape._get_line_properties(options["border"]) + + # Set the fill properties for the legend. + fill = Shape._get_fill_properties(options.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(options.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(options.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + # Set the legend layout. + layout = self._get_layout_properties(options.get("layout"), False) + + legend["line"] = line + legend["fill"] = fill + legend["pattern"] = pattern + legend["layout"] = layout + legend["gradient"] = gradient + + return legend + + def _get_layout_properties(self, args, is_text): + # Convert user defined layout properties to format used internally. + layout = {} + + if not args: + return + + if is_text: + properties = ("x", "y") + else: + properties = ("x", "y", "width", "height") + + # Check for valid properties. + for key in args.keys(): + if key not in properties: + warn("Property '%s' allowed not in layout options" % key) + return + + # Set the layout properties. + for prop in properties: + if prop not in args.keys(): + warn("Property '%s' must be specified in layout options" % prop) + return + + value = args[prop] + + try: + float(value) + except ValueError: + warn( + "Property '%s' value '%s' must be numeric in layout" % (prop, value) + ) + return + + if value < 0 or value > 1: + warn( + "Property '%s' value '%s' must be in range " + "0 < x <= 1 in layout options" % (prop, value) + ) + return + + # Convert to the format used by Excel for easier testing + layout[prop] = "%.17g" % value + + return layout + + def _get_points_properties(self, user_points): + # Convert user points properties to structure required internally. + points = [] + + if not user_points: + return + + for user_point in user_points: + point = {} + + if user_point is not None: + # Set the line properties for the point. + line = Shape._get_line_properties(user_point.get("line")) + + # Allow 'border' as a synonym for 'line'. + if "border" in user_point: + line = Shape._get_line_properties(user_point["border"]) + + # Set the fill properties for the chartarea. + fill = Shape._get_fill_properties(user_point.get("fill")) + + # Set the pattern fill properties for the series. + pattern = Shape._get_pattern_properties(user_point.get("pattern")) + + # Set the gradient fill properties for the series. + gradient = Shape._get_gradient_properties(user_point.get("gradient")) + + # Pattern fill overrides solid fill. + if pattern: + self.fill = None + + # Gradient fill overrides the solid and pattern fill. + if gradient: + pattern = None + fill = None + + point["line"] = line + point["fill"] = fill + point["pattern"] = pattern + point["gradient"] = gradient + + points.append(point) + + return points + + def _has_fill_formatting(self, element): + # Check if a chart element has line, fill or gradient formatting. + has_fill = False + has_line = False + has_pattern = element.get("pattern") + has_gradient = element.get("gradient") + + if element.get("fill") and element["fill"]["defined"]: + has_fill = True + + if element.get("line") and element["line"]["defined"]: + has_line = True + + if not has_fill and not has_line and not has_pattern and not has_gradient: + return False + else: + return True + + def _get_display_units(self, display_units): + # Convert user defined display units to internal units. + if not display_units: + return + + types = { + "hundreds": "hundreds", + "thousands": "thousands", + "ten_thousands": "tenThousands", + "hundred_thousands": "hundredThousands", + "millions": "millions", + "ten_millions": "tenMillions", + "hundred_millions": "hundredMillions", + "billions": "billions", + "trillions": "trillions", + } + + if display_units in types: + display_units = types[display_units] + else: + warn("Unknown display_units type '%s'" % display_units) + return + + return display_units + + def _get_tick_type(self, tick_type): + # Convert user defined display units to internal units. + if not tick_type: + return + + types = { + "outside": "out", + "inside": "in", + "none": "none", + "cross": "cross", + } + + if tick_type in types: + tick_type = types[tick_type] + else: + warn("Unknown tick_type '%s'" % tick_type) + return + + return tick_type + + def _get_primary_axes_series(self): + # Returns series which use the primary axes. + primary_axes_series = [] + + for series in self.series: + if not series["y2_axis"]: + primary_axes_series.append(series) + + return primary_axes_series + + def _get_secondary_axes_series(self): + # Returns series which use the secondary axes. + secondary_axes_series = [] + + for series in self.series: + if series["y2_axis"]: + secondary_axes_series.append(series) + + return secondary_axes_series + + def _add_axis_ids(self, args): + # Add unique ids for primary or secondary axes + chart_id = 5001 + int(self.id) + axis_count = 1 + len(self.axis2_ids) + len(self.axis_ids) + + id1 = "%04d%04d" % (chart_id, axis_count) + id2 = "%04d%04d" % (chart_id, axis_count + 1) + + if args["primary_axes"]: + self.axis_ids.append(id1) + self.axis_ids.append(id2) + + if not args["primary_axes"]: + self.axis2_ids.append(id1) + self.axis2_ids.append(id2) + + def _set_default_properties(self): + # Setup the default properties for a chart. + + self.x_axis["defaults"] = { + "num_format": "General", + "major_gridlines": {"visible": 0}, + } + + self.y_axis["defaults"] = { + "num_format": "General", + "major_gridlines": {"visible": 1}, + } + + self.x2_axis["defaults"] = { + "num_format": "General", + "label_position": "none", + "crossing": "max", + "visible": 0, + } + + self.y2_axis["defaults"] = { + "num_format": "General", + "major_gridlines": {"visible": 0}, + "position": "right", + "visible": 1, + } + + self.set_x_axis({}) + self.set_y_axis({}) + + self.set_x2_axis({}) + self.set_y2_axis({}) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_chart_space(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/" + xmlns_c = schema + "drawingml/2006/chart" + xmlns_a = schema + "drawingml/2006/main" + xmlns_r = schema + "officeDocument/2006/relationships" + + attributes = [ + ("xmlns:c", xmlns_c), + ("xmlns:a", xmlns_a), + ("xmlns:r", xmlns_r), + ] + + self._xml_start_tag("c:chartSpace", attributes) + + def _write_lang(self): + # Write the element. + val = "en-US" + + attributes = [("val", val)] + + self._xml_empty_tag("c:lang", attributes) + + def _write_style(self): + # Write the element. + style_id = self.style_id + + # Don't write an element for the default style, 2. + if style_id == 2: + return + + attributes = [("val", style_id)] + + self._xml_empty_tag("c:style", attributes) + + def _write_chart(self): + # Write the element. + self._xml_start_tag("c:chart") + + if self.title_none: + # Turn off the title. + self._write_c_auto_title_deleted() + else: + # Write the chart title elements. + if self.title_formula is not None: + self._write_title_formula( + self.title_formula, + self.title_data_id, + None, + self.title_font, + self.title_layout, + self.title_overlay, + ) + elif self.title_name is not None: + self._write_title_rich( + self.title_name, + None, + self.title_font, + self.title_layout, + self.title_overlay, + ) + + # Write the c:plotArea element. + self._write_plot_area() + + # Write the c:legend element. + self._write_legend() + + # Write the c:plotVisOnly element. + self._write_plot_vis_only() + + # Write the c:dispBlanksAs element. + self._write_disp_blanks_as() + + self._xml_end_tag("c:chart") + + def _write_disp_blanks_as(self): + # Write the element. + val = self.show_blanks + + # Ignore the default value. + if val == "gap": + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:dispBlanksAs", attributes) + + def _write_plot_area(self): + # Write the element. + self._xml_start_tag("c:plotArea") + + # Write the c:layout element. + self._write_layout(self.plotarea.get("layout"), "plot") + + # Write subclass chart type elements for primary and secondary axes. + self._write_chart_type({"primary_axes": True}) + self._write_chart_type({"primary_axes": False}) + + # Configure a combined chart if present. + second_chart = self.combined + if second_chart: + # Secondary axis has unique id otherwise use same as primary. + if second_chart.is_secondary: + second_chart.id = 1000 + self.id + else: + second_chart.id = self.id + + # Share the same filehandle for writing. + second_chart.fh = self.fh + + # Share series index with primary chart. + second_chart.series_index = self.series_index + + # Write the subclass chart type elements for combined chart. + second_chart._write_chart_type({"primary_axes": True}) + second_chart._write_chart_type({"primary_axes": False}) + + # Write the category and value elements for the primary axes. + args = {"x_axis": self.x_axis, "y_axis": self.y_axis, "axis_ids": self.axis_ids} + + if self.date_category: + self._write_date_axis(args) + else: + self._write_cat_axis(args) + + self._write_val_axis(args) + + # Write the category and value elements for the secondary axes. + args = { + "x_axis": self.x2_axis, + "y_axis": self.y2_axis, + "axis_ids": self.axis2_ids, + } + + self._write_val_axis(args) + + # Write the secondary axis for the secondary chart. + if second_chart and second_chart.is_secondary: + args = { + "x_axis": second_chart.x2_axis, + "y_axis": second_chart.y2_axis, + "axis_ids": second_chart.axis2_ids, + } + + second_chart._write_val_axis(args) + + if self.date_category: + self._write_date_axis(args) + else: + self._write_cat_axis(args) + + # Write the c:dTable element. + self._write_d_table() + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(self.plotarea) + + self._xml_end_tag("c:plotArea") + + def _write_layout(self, layout, layout_type): + # Write the element. + + if not layout: + # Automatic layout. + self._xml_empty_tag("c:layout") + else: + # User defined manual layout. + self._xml_start_tag("c:layout") + self._write_manual_layout(layout, layout_type) + self._xml_end_tag("c:layout") + + def _write_manual_layout(self, layout, layout_type): + # Write the element. + self._xml_start_tag("c:manualLayout") + + # Plotarea has a layoutTarget element. + if layout_type == "plot": + self._xml_empty_tag("c:layoutTarget", [("val", "inner")]) + + # Set the x, y positions. + self._xml_empty_tag("c:xMode", [("val", "edge")]) + self._xml_empty_tag("c:yMode", [("val", "edge")]) + self._xml_empty_tag("c:x", [("val", layout["x"])]) + self._xml_empty_tag("c:y", [("val", layout["y"])]) + + # For plotarea and legend set the width and height. + if layout_type != "text": + self._xml_empty_tag("c:w", [("val", layout["width"])]) + self._xml_empty_tag("c:h", [("val", layout["height"])]) + + self._xml_end_tag("c:manualLayout") + + def _write_chart_type(self, options): + # Write the chart type element. This method should be overridden + # by the subclasses. + return + + def _write_grouping(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("c:grouping", attributes) + + def _write_series(self, series): + # Write the series elements. + self._write_ser(series) + + def _write_ser(self, series): + # Write the element. + index = self.series_index + self.series_index += 1 + + self._xml_start_tag("c:ser") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:order element. + self._write_order(index) + + # Write the series name. + self._write_series_name(series) + + # Write the c:spPr element. + self._write_sp_pr(series) + + # Write the c:marker element. + self._write_marker(series["marker"]) + + # Write the c:invertIfNegative element. + self._write_c_invert_if_negative(series["invert_if_neg"]) + + # Write the c:dPt element. + self._write_d_pt(series["points"]) + + # Write the c:dLbls element. + self._write_d_lbls(series["labels"]) + + # Write the c:trendline element. + self._write_trendline(series["trendline"]) + + # Write the c:errBars element. + self._write_error_bars(series["error_bars"]) + + # Write the c:cat element. + self._write_cat(series) + + # Write the c:val element. + self._write_val(series) + + # Write the c:smooth element. + if self.smooth_allowed: + self._write_c_smooth(series["smooth"]) + + # Write the c:extLst element. + if series.get("inverted_color"): + self._write_c_ext_lst(series["inverted_color"]) + + self._xml_end_tag("c:ser") + + def _write_c_ext_lst(self, color): + # Write the element for the inverted fill color. + + uri = "{6F2FDCE9-48DA-4B69-8628-5D25D57E5C99}" + xmlns_c_14 = "http://schemas.microsoft.com/office/drawing/2007/8/2/chart" + + attributes1 = [ + ("uri", uri), + ("xmlns:c14", xmlns_c_14), + ] + + attributes2 = [("xmlns:c14", xmlns_c_14)] + + self._xml_start_tag("c:extLst") + self._xml_start_tag("c:ext", attributes1) + self._xml_start_tag("c14:invertSolidFillFmt") + self._xml_start_tag("c14:spPr", attributes2) + + self._write_a_solid_fill({"color": color}) + + self._xml_end_tag("c14:spPr") + self._xml_end_tag("c14:invertSolidFillFmt") + self._xml_end_tag("c:ext") + self._xml_end_tag("c:extLst") + + def _write_idx(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:idx", attributes) + + def _write_order(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:order", attributes) + + def _write_series_name(self, series): + # Write the series name. + + if series["name_formula"] is not None: + self._write_tx_formula(series["name_formula"], series["name_id"]) + elif series["name"] is not None: + self._write_tx_value(series["name"]) + + def _write_c_smooth(self, smooth): + # Write the element. + + if smooth: + self._xml_empty_tag("c:smooth", [("val", "1")]) + + def _write_cat(self, series): + # Write the element. + formula = series["categories"] + data_id = series["cat_data_id"] + data = None + + if data_id is not None: + data = self.formula_data[data_id] + + # Ignore elements for charts without category values. + if not formula: + return + + self._xml_start_tag("c:cat") + + # Check the type of cached data. + cat_type = self._get_data_type(data) + + if cat_type == "str": + self.cat_has_num_fmt = 0 + # Write the c:numRef element. + self._write_str_ref(formula, data, cat_type) + + elif cat_type == "multi_str": + self.cat_has_num_fmt = 0 + # Write the c:numRef element. + self._write_multi_lvl_str_ref(formula, data) + + else: + self.cat_has_num_fmt = 1 + # Write the c:numRef element. + self._write_num_ref(formula, data, cat_type) + + self._xml_end_tag("c:cat") + + def _write_val(self, series): + # Write the element. + formula = series["values"] + data_id = series["val_data_id"] + data = self.formula_data[data_id] + + self._xml_start_tag("c:val") + + # Unlike Cat axes data should only be numeric. + # Write the c:numRef element. + self._write_num_ref(formula, data, "num") + + self._xml_end_tag("c:val") + + def _write_num_ref(self, formula, data, ref_type): + # Write the element. + self._xml_start_tag("c:numRef") + + # Write the c:f element. + self._write_series_formula(formula) + + if ref_type == "num": + # Write the c:numCache element. + self._write_num_cache(data) + elif ref_type == "str": + # Write the c:strCache element. + self._write_str_cache(data) + + self._xml_end_tag("c:numRef") + + def _write_str_ref(self, formula, data, ref_type): + # Write the element. + + self._xml_start_tag("c:strRef") + + # Write the c:f element. + self._write_series_formula(formula) + + if ref_type == "num": + # Write the c:numCache element. + self._write_num_cache(data) + elif ref_type == "str": + # Write the c:strCache element. + self._write_str_cache(data) + + self._xml_end_tag("c:strRef") + + def _write_multi_lvl_str_ref(self, formula, data): + # Write the element. + + if not data: + return + + self._xml_start_tag("c:multiLvlStrRef") + + # Write the c:f element. + self._write_series_formula(formula) + + self._xml_start_tag("c:multiLvlStrCache") + + # Write the c:ptCount element. + count = len(data[-1]) + self._write_pt_count(count) + + for cat_data in reversed(data): + self._xml_start_tag("c:lvl") + + for i, point in enumerate(cat_data): + # Write the c:pt element. + self._write_pt(i, cat_data[i]) + + self._xml_end_tag("c:lvl") + + self._xml_end_tag("c:multiLvlStrCache") + self._xml_end_tag("c:multiLvlStrRef") + + def _write_series_formula(self, formula): + # Write the element. + + # Strip the leading '=' from the formula. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("c:f", formula) + + def _write_axis_ids(self, args): + # Write the elements for the primary or secondary axes. + + # Generate the axis ids. + self._add_axis_ids(args) + + if args["primary_axes"]: + # Write the axis ids for the primary axes. + self._write_axis_id(self.axis_ids[0]) + self._write_axis_id(self.axis_ids[1]) + else: + # Write the axis ids for the secondary axes. + self._write_axis_id(self.axis2_ids[0]) + self._write_axis_id(self.axis2_ids[1]) + + def _write_axis_id(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:axId", attributes) + + def _write_cat_axis(self, args): + # Write the element. Usually the X axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + position = self.cat_axis_position + is_y_axis = self.horiz_cat_axis + + # Overwrite the default axis position with a user supplied value. + if x_axis.get("position"): + position = x_axis["position"] + + self._xml_start_tag("c:catAx") + + self._write_axis_id(axis_ids[0]) + + # Write the c:scaling element. + self._write_scaling(x_axis.get("reverse"), None, None, None) + + if not x_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, y_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(x_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(x_axis.get("minor_gridlines")) + + # Write the axis title elements. + if x_axis["formula"] is not None: + self._write_title_formula( + x_axis["formula"], + x_axis["data_id"], + is_y_axis, + x_axis["name_font"], + x_axis["name_layout"], + ) + elif x_axis["name"] is not None: + self._write_title_rich( + x_axis["name"], is_y_axis, x_axis["name_font"], x_axis["name_layout"] + ) + + # Write the c:numFmt element. + self._write_cat_number_format(x_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(x_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(x_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(x_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(x_axis) + + # Write the axis font elements. + self._write_axis_font(x_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[1]) + + if self.show_crosses or x_axis.get("visible"): + # Note, the category crossing comes from the value axis. + if ( + y_axis.get("crossing") is None + or y_axis.get("crossing") == "max" + or y_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(y_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(y_axis.get("crossing")) + + # Write the c:auto element. + if not x_axis.get("text_axis"): + self._write_auto(1) + + # Write the c:labelAlign element. + self._write_label_align(x_axis.get("label_align")) + + # Write the c:labelOffset element. + self._write_label_offset(100) + + # Write the c:tickLblSkip element. + self._write_c_tick_lbl_skip(x_axis.get("interval_unit")) + + # Write the c:tickMarkSkip element. + self._write_c_tick_mark_skip(x_axis.get("interval_tick")) + + self._xml_end_tag("c:catAx") + + def _write_val_axis(self, args): + # Write the element. Usually the Y axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + position = args.get("position", self.val_axis_position) + is_y_axis = self.horiz_val_axis + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + # Overwrite the default axis position with a user supplied value. + position = y_axis.get("position") or position + + self._xml_start_tag("c:valAx") + + self._write_axis_id(axis_ids[1]) + + # Write the c:scaling element. + self._write_scaling( + y_axis.get("reverse"), + y_axis.get("min"), + y_axis.get("max"), + y_axis.get("log_base"), + ) + + if not y_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, x_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(y_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(y_axis.get("minor_gridlines")) + + # Write the axis title elements. + if y_axis["formula"] is not None: + self._write_title_formula( + y_axis["formula"], + y_axis["data_id"], + is_y_axis, + y_axis["name_font"], + y_axis["name_layout"], + ) + elif y_axis["name"] is not None: + self._write_title_rich( + y_axis["name"], + is_y_axis, + y_axis.get("name_font"), + y_axis.get("name_layout"), + ) + + # Write the c:numberFormat element. + self._write_number_format(y_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(y_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(y_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(y_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(y_axis) + + # Write the axis font elements. + self._write_axis_font(y_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[0]) + + # Note, the category crossing comes from the value axis. + if ( + x_axis.get("crossing") is None + or x_axis["crossing"] == "max" + or x_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(x_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(x_axis.get("crossing")) + + # Write the c:crossBetween element. + self._write_cross_between(x_axis.get("position_axis")) + + # Write the c:majorUnit element. + self._write_c_major_unit(y_axis.get("major_unit")) + + # Write the c:minorUnit element. + self._write_c_minor_unit(y_axis.get("minor_unit")) + + # Write the c:dispUnits element. + self._write_disp_units( + y_axis.get("display_units"), y_axis.get("display_units_visible") + ) + + self._xml_end_tag("c:valAx") + + def _write_cat_val_axis(self, args): + # Write the element. This is for the second valAx + # in scatter plots. Usually the X axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + position = args["position"] or self.val_axis_position + is_y_axis = self.horiz_val_axis + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + # Overwrite the default axis position with a user supplied value. + position = x_axis.get("position") or position + + self._xml_start_tag("c:valAx") + + self._write_axis_id(axis_ids[0]) + + # Write the c:scaling element. + self._write_scaling( + x_axis.get("reverse"), + x_axis.get("min"), + x_axis.get("max"), + x_axis.get("log_base"), + ) + + if not x_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, y_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(x_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(x_axis.get("minor_gridlines")) + + # Write the axis title elements. + if x_axis["formula"] is not None: + self._write_title_formula( + x_axis["formula"], + x_axis["data_id"], + is_y_axis, + x_axis["name_font"], + x_axis["name_layout"], + ) + elif x_axis["name"] is not None: + self._write_title_rich( + x_axis["name"], is_y_axis, x_axis["name_font"], x_axis["name_layout"] + ) + + # Write the c:numberFormat element. + self._write_number_format(x_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(x_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(x_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(x_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(x_axis) + + # Write the axis font elements. + self._write_axis_font(x_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[1]) + + # Note, the category crossing comes from the value axis. + if ( + y_axis.get("crossing") is None + or y_axis["crossing"] == "max" + or y_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(y_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(y_axis.get("crossing")) + + # Write the c:crossBetween element. + self._write_cross_between(y_axis.get("position_axis")) + + # Write the c:majorUnit element. + self._write_c_major_unit(x_axis.get("major_unit")) + + # Write the c:minorUnit element. + self._write_c_minor_unit(x_axis.get("minor_unit")) + + # Write the c:dispUnits element. + self._write_disp_units( + x_axis.get("display_units"), x_axis.get("display_units_visible") + ) + + self._xml_end_tag("c:valAx") + + def _write_date_axis(self, args): + # Write the element. Usually the X axis. + x_axis = args["x_axis"] + y_axis = args["y_axis"] + axis_ids = args["axis_ids"] + + # If there are no axis_ids then we don't need to write this element. + if axis_ids is None or not len(axis_ids): + return + + position = self.cat_axis_position + + # Overwrite the default axis position with a user supplied value. + position = x_axis.get("position") or position + + self._xml_start_tag("c:dateAx") + + self._write_axis_id(axis_ids[0]) + + # Write the c:scaling element. + self._write_scaling( + x_axis.get("reverse"), + x_axis.get("min"), + x_axis.get("max"), + x_axis.get("log_base"), + ) + + if not x_axis.get("visible"): + self._write_delete(1) + + # Write the c:axPos element. + self._write_axis_pos(position, y_axis.get("reverse")) + + # Write the c:majorGridlines element. + self._write_major_gridlines(x_axis.get("major_gridlines")) + + # Write the c:minorGridlines element. + self._write_minor_gridlines(x_axis.get("minor_gridlines")) + + # Write the axis title elements. + if x_axis["formula"] is not None: + self._write_title_formula( + x_axis["formula"], + x_axis["data_id"], + None, + x_axis["name_font"], + x_axis["name_layout"], + ) + elif x_axis["name"] is not None: + self._write_title_rich( + x_axis["name"], None, x_axis["name_font"], x_axis["name_layout"] + ) + + # Write the c:numFmt element. + self._write_number_format(x_axis) + + # Write the c:majorTickMark element. + self._write_major_tick_mark(x_axis.get("major_tick_mark")) + + # Write the c:minorTickMark element. + self._write_minor_tick_mark(x_axis.get("minor_tick_mark")) + + # Write the c:tickLblPos element. + self._write_tick_label_pos(x_axis.get("label_position")) + + # Write the c:spPr element for the axis line. + self._write_sp_pr(x_axis) + + # Write the axis font elements. + self._write_axis_font(x_axis.get("num_font")) + + # Write the c:crossAx element. + self._write_cross_axis(axis_ids[1]) + + if self.show_crosses or x_axis.get("visible"): + # Note, the category crossing comes from the value axis. + if ( + y_axis.get("crossing") is None + or y_axis.get("crossing") == "max" + or y_axis["crossing"] == "min" + ): + # Write the c:crosses element. + self._write_crosses(y_axis.get("crossing")) + else: + # Write the c:crossesAt element. + self._write_c_crosses_at(y_axis.get("crossing")) + + # Write the c:auto element. + self._write_auto(1) + + # Write the c:labelOffset element. + self._write_label_offset(100) + + # Write the c:tickLblSkip element. + self._write_c_tick_lbl_skip(x_axis.get("interval_unit")) + + # Write the c:tickMarkSkip element. + self._write_c_tick_mark_skip(x_axis.get("interval_tick")) + + # Write the c:majorUnit element. + self._write_c_major_unit(x_axis.get("major_unit")) + + # Write the c:majorTimeUnit element. + if x_axis.get("major_unit"): + self._write_c_major_time_unit(x_axis["major_unit_type"]) + + # Write the c:minorUnit element. + self._write_c_minor_unit(x_axis.get("minor_unit")) + + # Write the c:minorTimeUnit element. + if x_axis.get("minor_unit"): + self._write_c_minor_time_unit(x_axis["minor_unit_type"]) + + self._xml_end_tag("c:dateAx") + + def _write_scaling(self, reverse, min_val, max_val, log_base): + # Write the element. + + self._xml_start_tag("c:scaling") + + # Write the c:logBase element. + self._write_c_log_base(log_base) + + # Write the c:orientation element. + self._write_orientation(reverse) + + # Write the c:max element. + self._write_c_max(max_val) + + # Write the c:min element. + self._write_c_min(min_val) + + self._xml_end_tag("c:scaling") + + def _write_c_log_base(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:logBase", attributes) + + def _write_orientation(self, reverse): + # Write the element. + val = "minMax" + + if reverse: + val = "maxMin" + + attributes = [("val", val)] + + self._xml_empty_tag("c:orientation", attributes) + + def _write_c_max(self, max_val): + # Write the element. + + if max_val is None: + return + + attributes = [("val", max_val)] + + self._xml_empty_tag("c:max", attributes) + + def _write_c_min(self, min_val): + # Write the element. + + if min_val is None: + return + + attributes = [("val", min_val)] + + self._xml_empty_tag("c:min", attributes) + + def _write_axis_pos(self, val, reverse): + # Write the element. + + if reverse: + if val == "l": + val = "r" + if val == "b": + val = "t" + + attributes = [("val", val)] + + self._xml_empty_tag("c:axPos", attributes) + + def _write_number_format(self, axis): + # Write the element. Note: It is assumed that if + # a user defined number format is supplied (i.e., non-default) then + # the sourceLinked attribute is 0. + # The user can override this if required. + format_code = axis.get("num_format") + source_linked = 1 + + # Check if a user defined number format has been set. + if format_code is not None and format_code != axis["defaults"]["num_format"]: + source_linked = 0 + + # User override of sourceLinked. + if axis.get("num_format_linked"): + source_linked = 1 + + attributes = [ + ("formatCode", format_code), + ("sourceLinked", source_linked), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_cat_number_format(self, axis): + # Write the element. Special case handler for category + # axes which don't always have a number format. + format_code = axis.get("num_format") + source_linked = 1 + default_format = 1 + + # Check if a user defined number format has been set. + if format_code is not None and format_code != axis["defaults"]["num_format"]: + source_linked = 0 + default_format = 0 + + # User override of sourceLinked. + if axis.get("num_format_linked"): + source_linked = 1 + + # Skip if cat doesn't have a num format (unless it is non-default). + if not self.cat_has_num_fmt and default_format: + return + + attributes = [ + ("formatCode", format_code), + ("sourceLinked", source_linked), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_data_label_number_format(self, format_code): + # Write the element for data labels. + source_linked = 0 + + attributes = [ + ("formatCode", format_code), + ("sourceLinked", source_linked), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_major_tick_mark(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:majorTickMark", attributes) + + def _write_minor_tick_mark(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:minorTickMark", attributes) + + def _write_tick_label_pos(self, val=None): + # Write the element. + if val is None or val == "next_to": + val = "nextTo" + + attributes = [("val", val)] + + self._xml_empty_tag("c:tickLblPos", attributes) + + def _write_cross_axis(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:crossAx", attributes) + + def _write_crosses(self, val=None): + # Write the element. + if val is None: + val = "autoZero" + + attributes = [("val", val)] + + self._xml_empty_tag("c:crosses", attributes) + + def _write_c_crosses_at(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:crossesAt", attributes) + + def _write_auto(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:auto", attributes) + + def _write_label_align(self, val=None): + # Write the element. + + if val is None: + val = "ctr" + + if val == "right": + val = "r" + + if val == "left": + val = "l" + + attributes = [("val", val)] + + self._xml_empty_tag("c:lblAlgn", attributes) + + def _write_label_offset(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:lblOffset", attributes) + + def _write_c_tick_lbl_skip(self, val): + # Write the element. + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:tickLblSkip", attributes) + + def _write_c_tick_mark_skip(self, val): + # Write the element. + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:tickMarkSkip", attributes) + + def _write_major_gridlines(self, gridlines): + # Write the element. + + if not gridlines: + return + + if not gridlines["visible"]: + return + + if gridlines["line"]["defined"]: + self._xml_start_tag("c:majorGridlines") + + # Write the c:spPr element. + self._write_sp_pr(gridlines) + + self._xml_end_tag("c:majorGridlines") + else: + self._xml_empty_tag("c:majorGridlines") + + def _write_minor_gridlines(self, gridlines): + # Write the element. + + if not gridlines: + return + + if not gridlines["visible"]: + return + + if gridlines["line"]["defined"]: + self._xml_start_tag("c:minorGridlines") + + # Write the c:spPr element. + self._write_sp_pr(gridlines) + + self._xml_end_tag("c:minorGridlines") + else: + self._xml_empty_tag("c:minorGridlines") + + def _write_cross_between(self, val): + # Write the element. + if val is None: + val = self.cross_between + + attributes = [("val", val)] + + self._xml_empty_tag("c:crossBetween", attributes) + + def _write_c_major_unit(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:majorUnit", attributes) + + def _write_c_minor_unit(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:minorUnit", attributes) + + def _write_c_major_time_unit(self, val=None): + # Write the element. + if val is None: + val = "days" + + attributes = [("val", val)] + + self._xml_empty_tag("c:majorTimeUnit", attributes) + + def _write_c_minor_time_unit(self, val=None): + # Write the element. + if val is None: + val = "days" + + attributes = [("val", val)] + + self._xml_empty_tag("c:minorTimeUnit", attributes) + + def _write_legend(self): + # Write the element. + legend = self.legend + position = legend.get("position", "right") + font = legend.get("font") + delete_series = [] + overlay = 0 + + if legend.get("delete_series") and type(legend["delete_series"]) is list: + delete_series = legend["delete_series"] + + if position.startswith("overlay_"): + position = position.replace("overlay_", "") + overlay = 1 + + allowed = { + "right": "r", + "left": "l", + "top": "t", + "bottom": "b", + "top_right": "tr", + } + + if position == "none": + return + + if position not in allowed: + return + + position = allowed[position] + + self._xml_start_tag("c:legend") + + # Write the c:legendPos element. + self._write_legend_pos(position) + + # Remove series labels from the legend. + for index in delete_series: + # Write the c:legendEntry element. + self._write_legend_entry(index) + + # Write the c:layout element. + self._write_layout(legend.get("layout"), "legend") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + if font: + self._write_tx_pr(font) + + # Write the c:spPr element. + self._write_sp_pr(legend) + + self._xml_end_tag("c:legend") + + def _write_legend_pos(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:legendPos", attributes) + + def _write_legend_entry(self, index): + # Write the element. + + self._xml_start_tag("c:legendEntry") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:delete element. + self._write_delete(1) + + self._xml_end_tag("c:legendEntry") + + def _write_overlay(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:overlay", attributes) + + def _write_plot_vis_only(self): + # Write the element. + val = 1 + + # Ignore this element if we are plotting hidden data. + if self.show_hidden: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:plotVisOnly", attributes) + + def _write_print_settings(self): + # Write the element. + self._xml_start_tag("c:printSettings") + + # Write the c:headerFooter element. + self._write_header_footer() + + # Write the c:pageMargins element. + self._write_page_margins() + + # Write the c:pageSetup element. + self._write_page_setup() + + self._xml_end_tag("c:printSettings") + + def _write_header_footer(self): + # Write the element. + self._xml_empty_tag("c:headerFooter") + + def _write_page_margins(self): + # Write the element. + bottom = 0.75 + left = 0.7 + right = 0.7 + top = 0.75 + header = 0.3 + footer = 0.3 + + attributes = [ + ("b", bottom), + ("l", left), + ("r", right), + ("t", top), + ("header", header), + ("footer", footer), + ] + + self._xml_empty_tag("c:pageMargins", attributes) + + def _write_page_setup(self): + # Write the element. + self._xml_empty_tag("c:pageSetup") + + def _write_c_auto_title_deleted(self): + # Write the element. + self._xml_empty_tag("c:autoTitleDeleted", [("val", 1)]) + + def _write_title_rich(self, title, is_y_axis, font, layout, overlay=False): + # Write the element for a rich string. + + self._xml_start_tag("c:title") + + # Write the c:tx element. + self._write_tx_rich(title, is_y_axis, font) + + # Write the c:layout element. + self._write_layout(layout, "text") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + self._xml_end_tag("c:title") + + def _write_title_formula( + self, title, data_id, is_y_axis, font, layout, overlay=False + ): + # Write the element for a rich string. + + self._xml_start_tag("c:title") + + # Write the c:tx element. + self._write_tx_formula(title, data_id) + + # Write the c:layout element. + self._write_layout(layout, "text") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + # Write the c:txPr element. + self._write_tx_pr(font, is_y_axis) + + self._xml_end_tag("c:title") + + def _write_tx_rich(self, title, is_y_axis, font): + # Write the element. + + self._xml_start_tag("c:tx") + + # Write the c:rich element. + self._write_rich(title, font, is_y_axis, ignore_rich_pr=False) + + self._xml_end_tag("c:tx") + + def _write_tx_value(self, title): + # Write the element with a value such as for series names. + + self._xml_start_tag("c:tx") + + # Write the c:v element. + self._write_v(title) + + self._xml_end_tag("c:tx") + + def _write_tx_formula(self, title, data_id): + # Write the element. + data = None + + if data_id is not None: + data = self.formula_data[data_id] + + self._xml_start_tag("c:tx") + + # Write the c:strRef element. + self._write_str_ref(title, data, "str") + + self._xml_end_tag("c:tx") + + def _write_rich(self, title, font, is_y_axis, ignore_rich_pr): + # Write the element. + + if font and font.get("rotation") is not None: + rotation = font["rotation"] + else: + rotation = None + + self._xml_start_tag("c:rich") + + # Write the a:bodyPr element. + self._write_a_body_pr(rotation, is_y_axis) + + # Write the a:lstStyle element. + self._write_a_lst_style() + + # Write the a:p element. + self._write_a_p_rich(title, font, ignore_rich_pr) + + self._xml_end_tag("c:rich") + + def _write_a_body_pr(self, rotation, is_y_axis): + # Write the element. + attributes = [] + + if rotation is None and is_y_axis: + rotation = -5400000 + + if rotation is not None: + if rotation == 16200000: + # 270 deg/stacked angle. + attributes.append(("rot", 0)) + attributes.append(("vert", "wordArtVert")) + elif rotation == 16260000: + # 271 deg/East Asian vertical. + attributes.append(("rot", 0)) + attributes.append(("vert", "eaVert")) + else: + attributes.append(("rot", rotation)) + attributes.append(("vert", "horz")) + + self._xml_empty_tag("a:bodyPr", attributes) + + def _write_a_lst_style(self): + # Write the element. + self._xml_empty_tag("a:lstStyle") + + def _write_a_p_rich(self, title, font, ignore_rich_pr): + # Write the element for rich string titles. + + self._xml_start_tag("a:p") + + # Write the a:pPr element. + if not ignore_rich_pr: + self._write_a_p_pr_rich(font) + + # Write the a:r element. + self._write_a_r(title, font) + + self._xml_end_tag("a:p") + + def _write_a_p_formula(self, font): + # Write the element for formula titles. + + self._xml_start_tag("a:p") + + # Write the a:pPr element. + self._write_a_p_pr_rich(font) + + # Write the a:endParaRPr element. + self._write_a_end_para_rpr() + + self._xml_end_tag("a:p") + + def _write_a_p_pr_rich(self, font): + # Write the element for rich string titles. + + self._xml_start_tag("a:pPr") + + # Write the a:defRPr element. + self._write_a_def_rpr(font) + + self._xml_end_tag("a:pPr") + + def _write_a_def_rpr(self, font): + # Write the element. + has_color = 0 + + style_attributes = Shape._get_font_style_attributes(font) + latin_attributes = Shape._get_font_latin_attributes(font) + + if font and font.get("color") is not None: + has_color = 1 + + if latin_attributes or has_color: + self._xml_start_tag("a:defRPr", style_attributes) + + if has_color: + self._write_a_solid_fill({"color": font["color"]}) + + if latin_attributes: + self._write_a_latin(latin_attributes) + + self._xml_end_tag("a:defRPr") + else: + self._xml_empty_tag("a:defRPr", style_attributes) + + def _write_a_end_para_rpr(self): + # Write the element. + lang = "en-US" + + attributes = [("lang", lang)] + + self._xml_empty_tag("a:endParaRPr", attributes) + + def _write_a_r(self, title, font): + # Write the element. + + self._xml_start_tag("a:r") + + # Write the a:rPr element. + self._write_a_r_pr(font) + + # Write the a:t element. + self._write_a_t(title) + + self._xml_end_tag("a:r") + + def _write_a_r_pr(self, font): + # Write the element. + has_color = 0 + lang = "en-US" + + style_attributes = Shape._get_font_style_attributes(font) + latin_attributes = Shape._get_font_latin_attributes(font) + + if font and font["color"] is not None: + has_color = 1 + + # Add the lang type to the attributes. + style_attributes.insert(0, ("lang", lang)) + + if latin_attributes or has_color: + self._xml_start_tag("a:rPr", style_attributes) + + if has_color: + self._write_a_solid_fill({"color": font["color"]}) + + if latin_attributes: + self._write_a_latin(latin_attributes) + + self._xml_end_tag("a:rPr") + else: + self._xml_empty_tag("a:rPr", style_attributes) + + def _write_a_t(self, title): + # Write the element. + + self._xml_data_element("a:t", title) + + def _write_tx_pr(self, font, is_y_axis=False): + # Write the element. + + if font and font.get("rotation") is not None: + rotation = font["rotation"] + else: + rotation = None + + self._xml_start_tag("c:txPr") + + # Write the a:bodyPr element. + self._write_a_body_pr(rotation, is_y_axis) + + # Write the a:lstStyle element. + self._write_a_lst_style() + + # Write the a:p element. + self._write_a_p_formula(font) + + self._xml_end_tag("c:txPr") + + def _write_marker(self, marker): + # Write the element. + if marker is None: + marker = self.default_marker + + if not marker: + return + + if marker["type"] == "automatic": + return + + self._xml_start_tag("c:marker") + + # Write the c:symbol element. + self._write_symbol(marker["type"]) + + # Write the c:size element. + if marker.get("size"): + self._write_marker_size(marker["size"]) + + # Write the c:spPr element. + self._write_sp_pr(marker) + + self._xml_end_tag("c:marker") + + def _write_marker_size(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:size", attributes) + + def _write_symbol(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:symbol", attributes) + + def _write_sp_pr(self, series): + # Write the element. + + if not self._has_fill_formatting(series): + return + + self._xml_start_tag("c:spPr") + + # Write the fill elements for solid charts such as pie and bar. + if series.get("fill") and series["fill"]["defined"]: + if "none" in series["fill"]: + # Write the a:noFill element. + self._write_a_no_fill() + else: + # Write the a:solidFill element. + self._write_a_solid_fill(series["fill"]) + + if series.get("pattern"): + # Write the a:gradFill element. + self._write_a_patt_fill(series["pattern"]) + + if series.get("gradient"): + # Write the a:gradFill element. + self._write_a_grad_fill(series["gradient"]) + + # Write the a:ln element. + if series.get("line") and series["line"]["defined"]: + self._write_a_ln(series["line"]) + + self._xml_end_tag("c:spPr") + + def _write_a_ln(self, line): + # Write the element. + attributes = [] + + # Add the line width as an attribute. + width = line.get("width") + + if width is not None: + # Round width to nearest 0.25, like Excel. + width = int((width + 0.125) * 4) / 4.0 + + # Convert to internal units. + width = int(0.5 + (12700 * width)) + + attributes = [("w", width)] + + if line.get("none") or line.get("color") or line.get("dash_type"): + self._xml_start_tag("a:ln", attributes) + + # Write the line fill. + if "none" in line: + # Write the a:noFill element. + self._write_a_no_fill() + elif "color" in line: + # Write the a:solidFill element. + self._write_a_solid_fill(line) + + # Write the line/dash type. + line_type = line.get("dash_type") + if line_type: + # Write the a:prstDash element. + self._write_a_prst_dash(line_type) + + self._xml_end_tag("a:ln") + else: + self._xml_empty_tag("a:ln", attributes) + + def _write_a_no_fill(self): + # Write the element. + self._xml_empty_tag("a:noFill") + + def _write_a_solid_fill(self, fill): + # Write the element. + + self._xml_start_tag("a:solidFill") + + if "color" in fill: + color = get_rgb_color(fill["color"]) + transparency = fill.get("transparency") + # Write the a:srgbClr element. + self._write_a_srgb_clr(color, transparency) + + self._xml_end_tag("a:solidFill") + + def _write_a_srgb_clr(self, val, transparency=None): + # Write the element. + attributes = [("val", val)] + + if transparency: + self._xml_start_tag("a:srgbClr", attributes) + + # Write the a:alpha element. + self._write_a_alpha(transparency) + + self._xml_end_tag("a:srgbClr") + else: + self._xml_empty_tag("a:srgbClr", attributes) + + def _write_a_alpha(self, val): + # Write the element. + + val = int((100 - int(val)) * 1000) + + attributes = [("val", val)] + + self._xml_empty_tag("a:alpha", attributes) + + def _write_a_prst_dash(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("a:prstDash", attributes) + + def _write_trendline(self, trendline): + # Write the element. + + if not trendline: + return + + self._xml_start_tag("c:trendline") + + # Write the c:name element. + self._write_name(trendline.get("name")) + + # Write the c:spPr element. + self._write_sp_pr(trendline) + + # Write the c:trendlineType element. + self._write_trendline_type(trendline["type"]) + + # Write the c:order element for polynomial trendlines. + if trendline["type"] == "poly": + self._write_trendline_order(trendline.get("order")) + + # Write the c:period element for moving average trendlines. + if trendline["type"] == "movingAvg": + self._write_period(trendline.get("period")) + + # Write the c:forward element. + self._write_forward(trendline.get("forward")) + + # Write the c:backward element. + self._write_backward(trendline.get("backward")) + + if "intercept" in trendline: + # Write the c:intercept element. + self._write_c_intercept(trendline["intercept"]) + + if trendline.get("display_r_squared"): + # Write the c:dispRSqr element. + self._write_c_disp_rsqr() + + if trendline.get("display_equation"): + # Write the c:dispEq element. + self._write_c_disp_eq() + + # Write the c:trendlineLbl element. + self._write_c_trendline_lbl() + + self._xml_end_tag("c:trendline") + + def _write_trendline_type(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:trendlineType", attributes) + + def _write_name(self, data): + # Write the element. + + if data is None: + return + + self._xml_data_element("c:name", data) + + def _write_trendline_order(self, val): + # Write the element. + if val < 2: + val = 2 + + attributes = [("val", val)] + + self._xml_empty_tag("c:order", attributes) + + def _write_period(self, val): + # Write the element. + if val < 2: + val = 2 + + attributes = [("val", val)] + + self._xml_empty_tag("c:period", attributes) + + def _write_forward(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:forward", attributes) + + def _write_backward(self, val): + # Write the element. + + if not val: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:backward", attributes) + + def _write_c_intercept(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("c:intercept", attributes) + + def _write_c_disp_eq(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:dispEq", attributes) + + def _write_c_disp_rsqr(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:dispRSqr", attributes) + + def _write_c_trendline_lbl(self): + # Write the element. + self._xml_start_tag("c:trendlineLbl") + + # Write the c:layout element. + self._write_layout(None, None) + + # Write the c:numFmt element. + self._write_trendline_num_fmt() + + self._xml_end_tag("c:trendlineLbl") + + def _write_trendline_num_fmt(self): + # Write the element. + attributes = [ + ("formatCode", "General"), + ("sourceLinked", 0), + ] + + self._xml_empty_tag("c:numFmt", attributes) + + def _write_hi_low_lines(self): + # Write the element. + hi_low_lines = self.hi_low_lines + + if hi_low_lines is None: + return + + if "line" in hi_low_lines and hi_low_lines["line"]["defined"]: + self._xml_start_tag("c:hiLowLines") + + # Write the c:spPr element. + self._write_sp_pr(hi_low_lines) + + self._xml_end_tag("c:hiLowLines") + else: + self._xml_empty_tag("c:hiLowLines") + + def _write_drop_lines(self): + # Write the element. + drop_lines = self.drop_lines + + if drop_lines is None: + return + + if drop_lines["line"]["defined"]: + self._xml_start_tag("c:dropLines") + + # Write the c:spPr element. + self._write_sp_pr(drop_lines) + + self._xml_end_tag("c:dropLines") + else: + self._xml_empty_tag("c:dropLines") + + def _write_overlap(self, val): + # Write the element. + + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:overlap", attributes) + + def _write_num_cache(self, data): + # Write the element. + if data: + count = len(data) + else: + count = 0 + + self._xml_start_tag("c:numCache") + + # Write the c:formatCode element. + self._write_format_code("General") + + # Write the c:ptCount element. + self._write_pt_count(count) + + for i in range(count): + token = data[i] + + if token is None: + continue + + try: + float(token) + except ValueError: + # Write non-numeric data as 0. + token = 0 + + # Write the c:pt element. + self._write_pt(i, token) + + self._xml_end_tag("c:numCache") + + def _write_str_cache(self, data): + # Write the element. + count = len(data) + + self._xml_start_tag("c:strCache") + + # Write the c:ptCount element. + self._write_pt_count(count) + + for i in range(count): + # Write the c:pt element. + self._write_pt(i, data[i]) + + self._xml_end_tag("c:strCache") + + def _write_format_code(self, data): + # Write the element. + + self._xml_data_element("c:formatCode", data) + + def _write_pt_count(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:ptCount", attributes) + + def _write_pt(self, idx, value): + # Write the element. + + if value is None: + return + + attributes = [("idx", idx)] + + self._xml_start_tag("c:pt", attributes) + + # Write the c:v element. + self._write_v(value) + + self._xml_end_tag("c:pt") + + def _write_v(self, data): + # Write the element. + + self._xml_data_element("c:v", data) + + def _write_protection(self): + # Write the element. + if not self.protection: + return + + self._xml_empty_tag("c:protection") + + def _write_d_pt(self, points): + # Write the elements. + index = -1 + + if not points: + return + + for point in points: + index += 1 + if not point: + continue + + self._write_d_pt_point(index, point) + + def _write_d_pt_point(self, index, point): + # Write an individual element. + + self._xml_start_tag("c:dPt") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:spPr element. + self._write_sp_pr(point) + + self._xml_end_tag("c:dPt") + + def _write_d_lbls(self, labels): + # Write the element. + + if not labels: + return + + self._xml_start_tag("c:dLbls") + + # Write the custom c:dLbl elements. + if labels.get("custom"): + self._write_custom_labels(labels, labels["custom"]) + + # Write the c:numFmt element. + if labels.get("num_format"): + self._write_data_label_number_format(labels["num_format"]) + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(labels) + + # Write the data label font elements. + if labels.get("font"): + self._write_axis_font(labels["font"]) + + # Write the c:dLblPos element. + if labels.get("position"): + self._write_d_lbl_pos(labels["position"]) + + # Write the c:showLegendKey element. + if labels.get("legend_key"): + self._write_show_legend_key() + + # Write the c:showVal element. + if labels.get("value"): + self._write_show_val() + + # Write the c:showCatName element. + if labels.get("category"): + self._write_show_cat_name() + + # Write the c:showSerName element. + if labels.get("series_name"): + self._write_show_ser_name() + + # Write the c:showPercent element. + if labels.get("percentage"): + self._write_show_percent() + + # Write the c:separator element. + if labels.get("separator"): + self._write_separator(labels["separator"]) + + # Write the c:showLeaderLines element. + if labels.get("leader_lines"): + self._write_show_leader_lines() + + self._xml_end_tag("c:dLbls") + + def _write_custom_labels(self, parent, labels): + # Write the element. + index = 0 + + for label in labels: + index += 1 + + if label is None: + continue + + self._xml_start_tag("c:dLbl") + + # Write the c:idx element. + self._write_idx(index - 1) + + delete_label = label.get("delete") + + if delete_label: + self._write_delete(1) + + elif label.get("formula"): + self._write_custom_label_formula(label) + + if parent.get("position"): + self._write_d_lbl_pos(parent["position"]) + + if parent.get("value"): + self._write_show_val() + if parent.get("category"): + self._write_show_cat_name() + if parent.get("series_name"): + self._write_show_ser_name() + + elif label.get("value"): + self._write_custom_label_str(label) + + if parent.get("position"): + self._write_d_lbl_pos(parent["position"]) + + if parent.get("value"): + self._write_show_val() + if parent.get("category"): + self._write_show_cat_name() + if parent.get("series_name"): + self._write_show_ser_name() + else: + self._write_custom_label_format_only(label) + + self._xml_end_tag("c:dLbl") + + def _write_custom_label_str(self, label): + # Write parts of the element for strings. + title = label.get("value") + font = label.get("font") + has_formatting = self._has_fill_formatting(label) + + # Write the c:layout element. + self._write_layout(None, None) + + self._xml_start_tag("c:tx") + + # Write the c:rich element. + self._write_rich(title, font, False, not has_formatting) + + self._xml_end_tag("c:tx") + + # Write the c:spPr element. + self._write_sp_pr(label) + + def _write_custom_label_formula(self, label): + # Write parts of the element for formulas. + formula = label.get("formula") + data_id = label.get("data_id") + data = None + + if data_id is not None: + data = self.formula_data[data_id] + + # Write the c:layout element. + self._write_layout(None, None) + + self._xml_start_tag("c:tx") + + # Write the c:strRef element. + self._write_str_ref(formula, data, "str") + + self._xml_end_tag("c:tx") + + # Write the data label formatting, if any. + self._write_custom_label_format_only(label) + + def _write_custom_label_format_only(self, label): + # Write parts of the labels with changed formatting. + font = label.get("font") + has_formatting = self._has_fill_formatting(label) + + if has_formatting: + self._write_sp_pr(label) + self._write_tx_pr(font) + elif font: + self._xml_empty_tag("c:spPr") + self._write_tx_pr(font) + + def _write_show_legend_key(self): + # Write the element. + val = "1" + + attributes = [("val", val)] + + self._xml_empty_tag("c:showLegendKey", attributes) + + def _write_show_val(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showVal", attributes) + + def _write_show_cat_name(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showCatName", attributes) + + def _write_show_ser_name(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showSerName", attributes) + + def _write_show_percent(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showPercent", attributes) + + def _write_separator(self, data): + # Write the element. + self._xml_data_element("c:separator", data) + + def _write_show_leader_lines(self): + # Write the element. + val = 1 + + attributes = [("val", val)] + + self._xml_empty_tag("c:showLeaderLines", attributes) + + def _write_d_lbl_pos(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:dLblPos", attributes) + + def _write_delete(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:delete", attributes) + + def _write_c_invert_if_negative(self, invert): + # Write the element. + val = 1 + + if not invert: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:invertIfNegative", attributes) + + def _write_axis_font(self, font): + # Write the axis font elements. + + if not font: + return + + self._xml_start_tag("c:txPr") + self._write_a_body_pr(font.get("rotation"), None) + self._write_a_lst_style() + self._xml_start_tag("a:p") + + self._write_a_p_pr_rich(font) + + self._write_a_end_para_rpr() + self._xml_end_tag("a:p") + self._xml_end_tag("c:txPr") + + def _write_a_latin(self, attributes): + # Write the element. + self._xml_empty_tag("a:latin", attributes) + + def _write_d_table(self): + # Write the element. + table = self.table + + if not table: + return + + self._xml_start_tag("c:dTable") + + if table["horizontal"]: + # Write the c:showHorzBorder element. + self._write_show_horz_border() + + if table["vertical"]: + # Write the c:showVertBorder element. + self._write_show_vert_border() + + if table["outline"]: + # Write the c:showOutline element. + self._write_show_outline() + + if table["show_keys"]: + # Write the c:showKeys element. + self._write_show_keys() + + if table["font"]: + # Write the table font. + self._write_tx_pr(table["font"]) + + self._xml_end_tag("c:dTable") + + def _write_show_horz_border(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showHorzBorder", attributes) + + def _write_show_vert_border(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showVertBorder", attributes) + + def _write_show_outline(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showOutline", attributes) + + def _write_show_keys(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:showKeys", attributes) + + def _write_error_bars(self, error_bars): + # Write the X and Y error bars. + + if not error_bars: + return + + if error_bars["x_error_bars"]: + self._write_err_bars("x", error_bars["x_error_bars"]) + + if error_bars["y_error_bars"]: + self._write_err_bars("y", error_bars["y_error_bars"]) + + def _write_err_bars(self, direction, error_bars): + # Write the element. + + if not error_bars: + return + + self._xml_start_tag("c:errBars") + + # Write the c:errDir element. + self._write_err_dir(direction) + + # Write the c:errBarType element. + self._write_err_bar_type(error_bars["direction"]) + + # Write the c:errValType element. + self._write_err_val_type(error_bars["type"]) + + if not error_bars["endcap"]: + # Write the c:noEndCap element. + self._write_no_end_cap() + + if error_bars["type"] == "stdErr": + # Don't need to write a c:errValType tag. + pass + elif error_bars["type"] == "cust": + # Write the custom error tags. + self._write_custom_error(error_bars) + else: + # Write the c:val element. + self._write_error_val(error_bars["value"]) + + # Write the c:spPr element. + self._write_sp_pr(error_bars) + + self._xml_end_tag("c:errBars") + + def _write_err_dir(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:errDir", attributes) + + def _write_err_bar_type(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:errBarType", attributes) + + def _write_err_val_type(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("c:errValType", attributes) + + def _write_no_end_cap(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:noEndCap", attributes) + + def _write_error_val(self, val): + # Write the element for error bars. + + attributes = [("val", val)] + + self._xml_empty_tag("c:val", attributes) + + def _write_custom_error(self, error_bars): + # Write the custom error bars tags. + + if error_bars["plus_values"]: + # Write the c:plus element. + self._xml_start_tag("c:plus") + + if isinstance(error_bars["plus_values"], list): + self._write_num_lit(error_bars["plus_values"]) + else: + self._write_num_ref( + error_bars["plus_values"], error_bars["plus_data"], "num" + ) + self._xml_end_tag("c:plus") + + if error_bars["minus_values"]: + # Write the c:minus element. + self._xml_start_tag("c:minus") + + if isinstance(error_bars["minus_values"], list): + self._write_num_lit(error_bars["minus_values"]) + else: + self._write_num_ref( + error_bars["minus_values"], error_bars["minus_data"], "num" + ) + self._xml_end_tag("c:minus") + + def _write_num_lit(self, data): + # Write the element for literal number list elements. + count = len(data) + + # Write the c:numLit element. + self._xml_start_tag("c:numLit") + + # Write the c:formatCode element. + self._write_format_code("General") + + # Write the c:ptCount element. + self._write_pt_count(count) + + for i in range(count): + token = data[i] + + if token is None: + continue + + try: + float(token) + except ValueError: + # Write non-numeric data as 0. + token = 0 + + # Write the c:pt element. + self._write_pt(i, token) + + self._xml_end_tag("c:numLit") + + def _write_up_down_bars(self): + # Write the element. + up_down_bars = self.up_down_bars + + if up_down_bars is None: + return + + self._xml_start_tag("c:upDownBars") + + # Write the c:gapWidth element. + self._write_gap_width(150) + + # Write the c:upBars element. + self._write_up_bars(up_down_bars.get("up")) + + # Write the c:downBars element. + self._write_down_bars(up_down_bars.get("down")) + + self._xml_end_tag("c:upDownBars") + + def _write_gap_width(self, val): + # Write the element. + + if val is None: + return + + attributes = [("val", val)] + + self._xml_empty_tag("c:gapWidth", attributes) + + def _write_up_bars(self, bar_format): + # Write the element. + + if bar_format["line"] and bar_format["line"]["defined"]: + self._xml_start_tag("c:upBars") + + # Write the c:spPr element. + self._write_sp_pr(bar_format) + + self._xml_end_tag("c:upBars") + else: + self._xml_empty_tag("c:upBars") + + def _write_down_bars(self, bar_format): + # Write the element. + + if bar_format["line"] and bar_format["line"]["defined"]: + self._xml_start_tag("c:downBars") + + # Write the c:spPr element. + self._write_sp_pr(bar_format) + + self._xml_end_tag("c:downBars") + else: + self._xml_empty_tag("c:downBars") + + def _write_disp_units(self, units, display): + # Write the element. + + if not units: + return + + attributes = [("val", units)] + + self._xml_start_tag("c:dispUnits") + self._xml_empty_tag("c:builtInUnit", attributes) + + if display: + self._xml_start_tag("c:dispUnitsLbl") + self._xml_empty_tag("c:layout") + self._xml_end_tag("c:dispUnitsLbl") + + self._xml_end_tag("c:dispUnits") + + def _write_a_grad_fill(self, gradient): + # Write the element. + + attributes = [("flip", "none"), ("rotWithShape", "1")] + + if gradient["type"] == "linear": + attributes = [] + + self._xml_start_tag("a:gradFill", attributes) + + # Write the a:gsLst element. + self._write_a_gs_lst(gradient) + + if gradient["type"] == "linear": + # Write the a:lin element. + self._write_a_lin(gradient["angle"]) + else: + # Write the a:path element. + self._write_a_path(gradient["type"]) + + # Write the a:tileRect element. + self._write_a_tile_rect(gradient["type"]) + + self._xml_end_tag("a:gradFill") + + def _write_a_gs_lst(self, gradient): + # Write the element. + positions = gradient["positions"] + colors = gradient["colors"] + + self._xml_start_tag("a:gsLst") + + for i in range(len(colors)): + pos = int(positions[i] * 1000) + attributes = [("pos", pos)] + self._xml_start_tag("a:gs", attributes) + + # Write the a:srgbClr element. + color = get_rgb_color(colors[i]) + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:gs") + + self._xml_end_tag("a:gsLst") + + def _write_a_lin(self, angle): + # Write the element. + + angle = int(60000 * angle) + + attributes = [ + ("ang", angle), + ("scaled", "0"), + ] + + self._xml_empty_tag("a:lin", attributes) + + def _write_a_path(self, gradient_type): + # Write the element. + + attributes = [("path", gradient_type)] + + self._xml_start_tag("a:path", attributes) + + # Write the a:fillToRect element. + self._write_a_fill_to_rect(gradient_type) + + self._xml_end_tag("a:path") + + def _write_a_fill_to_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [ + ("l", "50000"), + ("t", "50000"), + ("r", "50000"), + ("b", "50000"), + ] + else: + attributes = [ + ("l", "100000"), + ("t", "100000"), + ] + + self._xml_empty_tag("a:fillToRect", attributes) + + def _write_a_tile_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [] + else: + attributes = [ + ("r", "-100000"), + ("b", "-100000"), + ] + + self._xml_empty_tag("a:tileRect", attributes) + + def _write_a_patt_fill(self, pattern): + # Write the element. + + attributes = [("prst", pattern["pattern"])] + + self._xml_start_tag("a:pattFill", attributes) + + # Write the a:fgClr element. + self._write_a_fg_clr(pattern["fg_color"]) + + # Write the a:bgClr element. + self._write_a_bg_clr(pattern["bg_color"]) + + self._xml_end_tag("a:pattFill") + + def _write_a_fg_clr(self, color): + # Write the element. + + color = get_rgb_color(color) + + self._xml_start_tag("a:fgClr") + + # Write the a:srgbClr element. + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:fgClr") + + def _write_a_bg_clr(self, color): + # Write the element. + + color = get_rgb_color(color) + + self._xml_start_tag("a:bgClr") + + # Write the a:srgbClr element. + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:bgClr") diff --git a/xlsxwriter/python/xlsxwriter/chart_area.py b/xlsxwriter/python/xlsxwriter/chart_area.py new file mode 100644 index 0000000..6d0e37e --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_area.py @@ -0,0 +1,101 @@ +############################################################################### +# +# ChartArea - A class for writing the Excel XLSX Area charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartArea(chart.Chart): + """ + A class for writing the Excel XLSX Area charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartArea, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "standard" + + self.cross_between = "midCat" + self.show_crosses = 0 + + # Override and reset the default axis values. + if self.subtype == "percent_stacked": + self.y_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "center" + self.label_positions = {"center": "ctr"} + + self.set_y_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:areaChart element. + self._write_area_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + # + def _write_area_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + + if subtype == "percent_stacked": + subtype = "percentStacked" + + self._xml_start_tag("c:areaChart") + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:dropLines element. + self._write_drop_lines() + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:areaChart") diff --git a/xlsxwriter/python/xlsxwriter/chart_bar.py b/xlsxwriter/python/xlsxwriter/chart_bar.py new file mode 100644 index 0000000..93aa48f --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_bar.py @@ -0,0 +1,173 @@ +############################################################################### +# +# ChartBar - A class for writing the Excel XLSX Bar charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart +from warnings import warn + + +class ChartBar(chart.Chart): + """ + A class for writing the Excel XLSX Bar charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartBar, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "clustered" + + self.cat_axis_position = "l" + self.val_axis_position = "b" + self.horiz_val_axis = 0 + self.horiz_cat_axis = 1 + self.show_crosses = 0 + + # Override and reset the default axis values. + self.x_axis["defaults"]["major_gridlines"] = {"visible": 1} + self.y_axis["defaults"]["major_gridlines"] = {"visible": 0} + + if self.subtype == "percent_stacked": + self.x_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "outside_end" + self.label_positions = { + "center": "ctr", + "inside_base": "inBase", + "inside_end": "inEnd", + "outside_end": "outEnd", + } + + self.set_x_axis({}) + self.set_y_axis({}) + + def combine(self, chart=None): + """ + Create a combination chart with a secondary chart. + + Note: Override parent method to add an extra check that is required + for Bar charts to ensure that their combined chart is on a secondary + axis. + + Args: + chart: The secondary chart to combine with the primary chart. + + Returns: + Nothing. + + """ + if chart is None: + return + + if not chart.is_secondary: + warn("Charts combined with Bar charts must be on a secondary axis") + + self.combined = chart + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + if args["primary_axes"]: + # Reverse X and Y axes for Bar charts. + tmp = self.y_axis + self.y_axis = self.x_axis + self.x_axis = tmp + + if self.y2_axis["position"] == "r": + self.y2_axis["position"] = "t" + + # Write the c:barChart element. + self._write_bar_chart(args) + + def _write_bar_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + if subtype == "percent_stacked": + subtype = "percentStacked" + + # Set a default overlap for stacked charts. + if "stacked" in self.subtype and self.series_overlap_1 is None: + self.series_overlap_1 = 100 + + self._xml_start_tag("c:barChart") + + # Write the c:barDir element. + self._write_bar_dir() + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the c:ser elements. + for data in series: + self._write_ser(data) + + # Write the c:gapWidth element. + if args["primary_axes"]: + self._write_gap_width(self.series_gap_1) + else: + self._write_gap_width(self.series_gap_2) + + # Write the c:overlap element. + if args["primary_axes"]: + self._write_overlap(self.series_overlap_1) + else: + self._write_overlap(self.series_overlap_2) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:barChart") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_bar_dir(self): + # Write the element. + val = "bar" + + attributes = [("val", val)] + + self._xml_empty_tag("c:barDir", attributes) + + def _write_err_dir(self, val): + # Overridden from Chart class since it is not used in Bar charts. + pass diff --git a/xlsxwriter/python/xlsxwriter/chart_column.py b/xlsxwriter/python/xlsxwriter/chart_column.py new file mode 100644 index 0000000..20eaaa8 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_column.py @@ -0,0 +1,132 @@ +############################################################################### +# +# ChartColumn - A class for writing the Excel XLSX Column charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartColumn(chart.Chart): + """ + A class for writing the Excel XLSX Column charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartColumn, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "clustered" + + self.horiz_val_axis = 0 + + if self.subtype == "percent_stacked": + self.y_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "outside_end" + self.label_positions = { + "center": "ctr", + "inside_base": "inBase", + "inside_end": "inEnd", + "outside_end": "outEnd", + } + + self.set_y_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + + # Write the c:barChart element. + self._write_bar_chart(args) + + def _write_bar_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + if subtype == "percent_stacked": + subtype = "percentStacked" + + # Set a default overlap for stacked charts. + if "stacked" in self.subtype and self.series_overlap_1 is None: + self.series_overlap_1 = 100 + + self._xml_start_tag("c:barChart") + + # Write the c:barDir element. + self._write_bar_dir() + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the c:ser elements. + for data in series: + self._write_ser(data) + + # Write the c:gapWidth element. + if args["primary_axes"]: + self._write_gap_width(self.series_gap_1) + else: + self._write_gap_width(self.series_gap_2) + + # Write the c:overlap element. + if args["primary_axes"]: + self._write_overlap(self.series_overlap_1) + else: + self._write_overlap(self.series_overlap_2) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:barChart") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_bar_dir(self): + # Write the element. + val = "col" + + attributes = [("val", val)] + + self._xml_empty_tag("c:barDir", attributes) + + def _write_err_dir(self, val): + # Overridden from Chart class since it is not used in Column charts. + pass diff --git a/xlsxwriter/python/xlsxwriter/chart_doughnut.py b/xlsxwriter/python/xlsxwriter/chart_doughnut.py new file mode 100644 index 0000000..adca88d --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_doughnut.py @@ -0,0 +1,99 @@ +############################################################################### +# +# ChartDoughnut - A class for writing the Excel XLSX Doughnut charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from warnings import warn +from . import chart_pie + + +class ChartDoughnut(chart_pie.ChartPie): + """ + A class for writing the Excel XLSX Doughnut charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartDoughnut, self).__init__() + + self.vary_data_color = 1 + self.rotation = 0 + self.hole_size = 50 + + def set_hole_size(self, size): + """ + Set the Doughnut chart hole size. + + Args: + size: 10 <= size <= 90. + + Returns: + Nothing. + + """ + if size is None: + return + + # Ensure the size is in Excel's range. + if size < 10 or size > 90: + warn("Chart hole size %d outside Excel range: 10 <= size <= 90" % size) + return + + self.hole_size = int(size) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:doughnutChart element. + self._write_doughnut_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_doughnut_chart(self, args): + # Write the element. Over-ridden method to remove + # axis_id code since Doughnut charts don't require val and cat axes. + self._xml_start_tag("c:doughnutChart") + + # Write the c:varyColors element. + self._write_vary_colors() + + # Write the series elements. + for data in self.series: + self._write_ser(data) + + # Write the c:firstSliceAng element. + self._write_first_slice_ang() + + # Write the c:holeSize element. + self._write_c_hole_size() + + self._xml_end_tag("c:doughnutChart") + + def _write_c_hole_size(self): + # Write the element. + attributes = [("val", self.hole_size)] + + self._xml_empty_tag("c:holeSize", attributes) diff --git a/xlsxwriter/python/xlsxwriter/chart_line.py b/xlsxwriter/python/xlsxwriter/chart_line.py new file mode 100644 index 0000000..4c73a4d --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_line.py @@ -0,0 +1,143 @@ +############################################################################### +# +# ChartLine - A class for writing the Excel XLSX Line charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartLine(chart.Chart): + """ + A class for writing the Excel XLSX Line charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartLine, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "standard" + + self.default_marker = {"type": "none"} + self.smooth_allowed = True + + # Override and reset the default axis values. + if self.subtype == "percent_stacked": + self.y_axis["defaults"]["num_format"] = "0%" + + # Set the available data label positions for this chart type. + self.label_position_default = "right" + self.label_positions = { + "center": "ctr", + "right": "r", + "left": "l", + "above": "t", + "below": "b", + # For backward compatibility. + "top": "t", + "bottom": "b", + } + + self.set_y_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:lineChart element. + self._write_line_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_line_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + subtype = self.subtype + + if subtype == "percent_stacked": + subtype = "percentStacked" + + self._xml_start_tag("c:lineChart") + + # Write the c:grouping element. + self._write_grouping(subtype) + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:dropLines element. + self._write_drop_lines() + + # Write the c:hiLowLines element. + self._write_hi_low_lines() + + # Write the c:upDownBars element. + self._write_up_down_bars() + + # Write the c:marker element. + self._write_marker_value() + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:lineChart") + + def _write_d_pt_point(self, index, point): + # Write an individual element. Override the parent method to + # add markers. + + self._xml_start_tag("c:dPt") + + # Write the c:idx element. + self._write_idx(index) + + self._xml_start_tag("c:marker") + + # Write the c:spPr element. + self._write_sp_pr(point) + + self._xml_end_tag("c:marker") + + self._xml_end_tag("c:dPt") + + def _write_marker_value(self): + # Write the element without a sub-element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:marker", attributes) diff --git a/xlsxwriter/python/xlsxwriter/chart_pie.py b/xlsxwriter/python/xlsxwriter/chart_pie.py new file mode 100644 index 0000000..908fc32 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_pie.py @@ -0,0 +1,251 @@ +############################################################################### +# +# ChartPie - A class for writing the Excel XLSX Pie charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from warnings import warn +from . import chart + + +class ChartPie(chart.Chart): + """ + A class for writing the Excel XLSX Pie charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartPie, self).__init__() + + self.vary_data_color = 1 + self.rotation = 0 + + # Set the available data label positions for this chart type. + self.label_position_default = "best_fit" + self.label_positions = { + "center": "ctr", + "inside_end": "inEnd", + "outside_end": "outEnd", + "best_fit": "bestFit", + } + + def set_rotation(self, rotation): + """ + Set the Pie/Doughnut chart rotation: the angle of the first slice. + + Args: + rotation: First segment angle: 0 <= rotation <= 360. + + Returns: + Nothing. + + """ + if rotation is None: + return + + # Ensure the rotation is in Excel's range. + if rotation < 0 or rotation > 360: + warn( + "Chart rotation %d outside Excel range: 0 <= rotation <= 360" % rotation + ) + return + + self.rotation = int(rotation) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:pieChart element. + self._write_pie_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_pie_chart(self, args): + # Write the element. Over-ridden method to remove + # axis_id code since Pie charts don't require val and cat axes. + self._xml_start_tag("c:pieChart") + + # Write the c:varyColors element. + self._write_vary_colors() + + # Write the series elements. + for data in self.series: + self._write_ser(data) + + # Write the c:firstSliceAng element. + self._write_first_slice_ang() + + self._xml_end_tag("c:pieChart") + + def _write_plot_area(self): + # Over-ridden method to remove the cat_axis() and val_axis() code + # since Pie charts don't require those axes. + # + # Write the element. + + self._xml_start_tag("c:plotArea") + + # Write the c:layout element. + self._write_layout(self.plotarea.get("layout"), "plot") + + # Write the subclass chart type element. + self._write_chart_type(None) + # Configure a combined chart if present. + second_chart = self.combined + + if second_chart: + # Secondary axis has unique id otherwise use same as primary. + if second_chart.is_secondary: + second_chart.id = 1000 + self.id + else: + second_chart.id = self.id + + # Share the same filehandle for writing. + second_chart.fh = self.fh + + # Share series index with primary chart. + second_chart.series_index = self.series_index + + # Write the subclass chart type elements for combined chart. + second_chart._write_chart_type(None) + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(self.plotarea) + + self._xml_end_tag("c:plotArea") + + def _write_legend(self): + # Over-ridden method to add to legend. + # Write the element. + legend = self.legend + position = legend.get("position", "right") + font = legend.get("font") + delete_series = [] + overlay = 0 + + if legend.get("delete_series") and type(legend["delete_series"]) is list: + delete_series = legend["delete_series"] + + if position.startswith("overlay_"): + position = position.replace("overlay_", "") + overlay = 1 + + allowed = { + "right": "r", + "left": "l", + "top": "t", + "bottom": "b", + "top_right": "tr", + } + + if position == "none": + return + + if position not in allowed: + return + + position = allowed[position] + + self._xml_start_tag("c:legend") + + # Write the c:legendPos element. + self._write_legend_pos(position) + + # Remove series labels from the legend. + for index in delete_series: + # Write the c:legendEntry element. + self._write_legend_entry(index) + + # Write the c:layout element. + self._write_layout(legend.get("layout"), "legend") + + # Write the c:overlay element. + if overlay: + self._write_overlay() + + # Write the c:spPr element. + self._write_sp_pr(legend) + + # Write the c:txPr element. Over-ridden. + self._write_tx_pr_legend(None, font) + + self._xml_end_tag("c:legend") + + def _write_tx_pr_legend(self, horiz, font): + # Write the element for legends. + + if font and font.get("rotation"): + rotation = font["rotation"] + else: + rotation = None + + self._xml_start_tag("c:txPr") + + # Write the a:bodyPr element. + self._write_a_body_pr(rotation, horiz) + + # Write the a:lstStyle element. + self._write_a_lst_style() + + # Write the a:p element. + self._write_a_p_legend(font) + + self._xml_end_tag("c:txPr") + + def _write_a_p_legend(self, font): + # Write the element for legends. + + self._xml_start_tag("a:p") + + # Write the a:pPr element. + self._write_a_p_pr_legend(font) + + # Write the a:endParaRPr element. + self._write_a_end_para_rpr() + + self._xml_end_tag("a:p") + + def _write_a_p_pr_legend(self, font): + # Write the element for legends. + attributes = [("rtl", 0)] + + self._xml_start_tag("a:pPr", attributes) + + # Write the a:defRPr element. + self._write_a_def_rpr(font) + + self._xml_end_tag("a:pPr") + + def _write_vary_colors(self): + # Write the element. + attributes = [("val", 1)] + + self._xml_empty_tag("c:varyColors", attributes) + + def _write_first_slice_ang(self): + # Write the element. + attributes = [("val", self.rotation)] + + self._xml_empty_tag("c:firstSliceAng", attributes) diff --git a/xlsxwriter/python/xlsxwriter/chart_radar.py b/xlsxwriter/python/xlsxwriter/chart_radar.py new file mode 100644 index 0000000..cdf62eb --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_radar.py @@ -0,0 +1,102 @@ +############################################################################### +# +# ChartRadar - A class for writing the Excel XLSX Radar charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartRadar(chart.Chart): + """ + A class for writing the Excel XLSX Radar charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartRadar, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "marker" + self.default_marker = {"type": "none"} + + # Override and reset the default axis values. + self.x_axis["defaults"]["major_gridlines"] = {"visible": 1} + self.set_x_axis({}) + + # Set the available data label positions for this chart type. + self.label_position_default = "center" + self.label_positions = {"center": "ctr"} + + # Hardcode major_tick_mark for now until there is an accessor. + self.y_axis["major_tick_mark"] = "cross" + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Write the c:radarChart element. + self._write_radar_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_radar_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + self._xml_start_tag("c:radarChart") + + # Write the c:radarStyle element. + self._write_radar_style() + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:radarChart") + + def _write_radar_style(self): + # Write the element. + val = "marker" + + if self.subtype == "filled": + val = "filled" + + attributes = [("val", val)] + + self._xml_empty_tag("c:radarStyle", attributes) diff --git a/xlsxwriter/python/xlsxwriter/chart_scatter.py b/xlsxwriter/python/xlsxwriter/chart_scatter.py new file mode 100644 index 0000000..104c9ed --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_scatter.py @@ -0,0 +1,333 @@ +############################################################################### +# +# ChartScatter - A class for writing the Excel XLSX Scatter charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart +from warnings import warn + + +class ChartScatter(chart.Chart): + """ + A class for writing the Excel XLSX Scatter charts. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartScatter, self).__init__() + + if options is None: + options = {} + + self.subtype = options.get("subtype") + + if not self.subtype: + self.subtype = "marker_only" + + self.cross_between = "midCat" + self.horiz_val_axis = 0 + self.val_axis_position = "b" + self.smooth_allowed = True + self.requires_category = True + + # Set the available data label positions for this chart type. + self.label_position_default = "right" + self.label_positions = { + "center": "ctr", + "right": "r", + "left": "l", + "above": "t", + "below": "b", + # For backward compatibility. + "top": "t", + "bottom": "b", + } + + def combine(self, chart=None): + """ + Create a combination chart with a secondary chart. + + Note: Override parent method to add a warning. + + Args: + chart: The secondary chart to combine with the primary chart. + + Returns: + Nothing. + + """ + if chart is None: + return + + warn( + "Combined chart not currently supported with scatter chart " + "as the primary chart" + ) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:scatterChart element. + self._write_scatter_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_scatter_chart(self, args): + # Write the element. + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + style = "lineMarker" + subtype = self.subtype + + # Set the user defined chart subtype. + if subtype == "marker_only": + style = "lineMarker" + + if subtype == "straight_with_markers": + style = "lineMarker" + + if subtype == "straight": + style = "lineMarker" + self.default_marker = {"type": "none"} + + if subtype == "smooth_with_markers": + style = "smoothMarker" + + if subtype == "smooth": + style = "smoothMarker" + self.default_marker = {"type": "none"} + + # Add default formatting to the series data. + self._modify_series_formatting() + + self._xml_start_tag("c:scatterChart") + + # Write the c:scatterStyle element. + self._write_scatter_style(style) + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:scatterChart") + + def _write_ser(self, series): + # Over-ridden to write c:xVal/c:yVal instead of c:cat/c:val elements. + # Write the element. + + index = self.series_index + self.series_index += 1 + + self._xml_start_tag("c:ser") + + # Write the c:idx element. + self._write_idx(index) + + # Write the c:order element. + self._write_order(index) + + # Write the series name. + self._write_series_name(series) + + # Write the c:spPr element. + self._write_sp_pr(series) + + # Write the c:marker element. + self._write_marker(series.get("marker")) + + # Write the c:dPt element. + self._write_d_pt(series.get("points")) + + # Write the c:dLbls element. + self._write_d_lbls(series.get("labels")) + + # Write the c:trendline element. + self._write_trendline(series.get("trendline")) + + # Write the c:errBars element. + self._write_error_bars(series.get("error_bars")) + + # Write the c:xVal element. + self._write_x_val(series) + + # Write the c:yVal element. + self._write_y_val(series) + + # Write the c:smooth element. + if "smooth" in self.subtype and series["smooth"] is None: + # Default is on for smooth scatter charts. + self._write_c_smooth(True) + else: + self._write_c_smooth(series["smooth"]) + + self._xml_end_tag("c:ser") + + def _write_plot_area(self): + # Over-ridden to have 2 valAx elements for scatter charts instead + # of catAx/valAx. + # + # Write the element. + self._xml_start_tag("c:plotArea") + + # Write the c:layout element. + self._write_layout(self.plotarea.get("layout"), "plot") + + # Write the subclass chart elements for primary and secondary axes. + self._write_chart_type({"primary_axes": 1}) + self._write_chart_type({"primary_axes": 0}) + + # Write c:catAx and c:valAx elements for series using primary axes. + self._write_cat_val_axis( + { + "x_axis": self.x_axis, + "y_axis": self.y_axis, + "axis_ids": self.axis_ids, + "position": "b", + } + ) + + tmp = self.horiz_val_axis + self.horiz_val_axis = 1 + + self._write_val_axis( + { + "x_axis": self.x_axis, + "y_axis": self.y_axis, + "axis_ids": self.axis_ids, + "position": "l", + } + ) + + self.horiz_val_axis = tmp + + # Write c:valAx and c:catAx elements for series using secondary axes + self._write_cat_val_axis( + { + "x_axis": self.x2_axis, + "y_axis": self.y2_axis, + "axis_ids": self.axis2_ids, + "position": "b", + } + ) + self.horiz_val_axis = 1 + self._write_val_axis( + { + "x_axis": self.x2_axis, + "y_axis": self.y2_axis, + "axis_ids": self.axis2_ids, + "position": "l", + } + ) + + # Write the c:spPr element for the plotarea formatting. + self._write_sp_pr(self.plotarea) + + self._xml_end_tag("c:plotArea") + + def _write_x_val(self, series): + # Write the element. + formula = series.get("categories") + data_id = series.get("cat_data_id") + data = self.formula_data[data_id] + + self._xml_start_tag("c:xVal") + + # Check the type of cached data. + data_type = self._get_data_type(data) + + if data_type == "str": + # Write the c:numRef element. + self._write_str_ref(formula, data, data_type) + else: + # Write the c:numRef element. + self._write_num_ref(formula, data, data_type) + + self._xml_end_tag("c:xVal") + + def _write_y_val(self, series): + # Write the element. + formula = series.get("values") + data_id = series.get("val_data_id") + data = self.formula_data[data_id] + + self._xml_start_tag("c:yVal") + + # Unlike Cat axes data should only be numeric. + # Write the c:numRef element. + self._write_num_ref(formula, data, "num") + + self._xml_end_tag("c:yVal") + + def _write_scatter_style(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("c:scatterStyle", attributes) + + def _modify_series_formatting(self): + # Add default formatting to the series data unless it has already been + # specified by the user. + subtype = self.subtype + + # The default scatter style "markers only" requires a line type. + if subtype == "marker_only": + # Go through each series and define default values. + for series in self.series: + # Set a line type unless there is already a user defined type. + if not series["line"]["defined"]: + series["line"] = { + "width": 2.25, + "none": 1, + "defined": 1, + } + + def _write_d_pt_point(self, index, point): + # Write an individual element. Override the parent method to + # add markers. + + self._xml_start_tag("c:dPt") + + # Write the c:idx element. + self._write_idx(index) + + self._xml_start_tag("c:marker") + + # Write the c:spPr element. + self._write_sp_pr(point) + + self._xml_end_tag("c:marker") + + self._xml_end_tag("c:dPt") diff --git a/xlsxwriter/python/xlsxwriter/chart_stock.py b/xlsxwriter/python/xlsxwriter/chart_stock.py new file mode 100644 index 0000000..5dc9843 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chart_stock.py @@ -0,0 +1,124 @@ +############################################################################### +# +# ChartStock - A class for writing the Excel XLSX Stock charts. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import chart + + +class ChartStock(chart.Chart): + """ + A class for writing the Excel XLSX Stock charts. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, options=None): + """ + Constructor. + + """ + super(ChartStock, self).__init__() + + self.show_crosses = 0 + self.hi_low_lines = {} + self.date_category = True + + # Override and reset the default axis values. + self.x_axis["defaults"]["num_format"] = "dd/mm/yyyy" + self.x2_axis["defaults"]["num_format"] = "dd/mm/yyyy" + + # Set the available data label positions for this chart type. + self.label_position_default = "right" + self.label_positions = { + "center": "ctr", + "right": "r", + "left": "l", + "above": "t", + "below": "b", + # For backward compatibility. + "top": "t", + "bottom": "b", + } + + self.set_x_axis({}) + self.set_x2_axis({}) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _write_chart_type(self, args): + # Override the virtual superclass method with a chart specific method. + # Write the c:stockChart element. + self._write_stock_chart(args) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_stock_chart(self, args): + # Write the element. + # Overridden to add hi_low_lines(). + + if args["primary_axes"]: + series = self._get_primary_axes_series() + else: + series = self._get_secondary_axes_series() + + if not len(series): + return + + # Add default formatting to the series data. + self._modify_series_formatting() + + self._xml_start_tag("c:stockChart") + + # Write the series elements. + for data in series: + self._write_ser(data) + + # Write the c:dropLines element. + self._write_drop_lines() + + # Write the c:hiLowLines element. + if args.get("primary_axes"): + self._write_hi_low_lines() + + # Write the c:upDownBars element. + self._write_up_down_bars() + + # Write the c:axId elements + self._write_axis_ids(args) + + self._xml_end_tag("c:stockChart") + + def _modify_series_formatting(self): + # Add default formatting to the series data. + + index = 0 + + for series in self.series: + if index % 4 != 3: + if not series["line"]["defined"]: + series["line"] = {"width": 2.25, "none": 1, "defined": 1} + + if series["marker"] is None: + if index % 4 == 2: + series["marker"] = {"type": "dot", "size": 3} + else: + series["marker"] = {"type": "none"} + + index += 1 diff --git a/xlsxwriter/python/xlsxwriter/chartsheet.py b/xlsxwriter/python/xlsxwriter/chartsheet.py new file mode 100644 index 0000000..8ab70af --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/chartsheet.py @@ -0,0 +1,193 @@ +############################################################################### +# +# Chartsheet - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import worksheet +from .drawing import Drawing + + +class Chartsheet(worksheet.Worksheet): + """ + A class for writing the Excel XLSX Chartsheet file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Chartsheet, self).__init__() + + self.is_chartsheet = True + self.drawing = None + self.chart = None + self.charts = [] + self.zoom_scale_normal = 0 + self.orientation = 0 + self.protection = False + + def set_chart(self, chart): + """ + Set the chart object for the chartsheet. + Args: + chart: Chart object. + Returns: + chart: A reference to the chart object. + """ + chart.embedded = False + chart.protection = self.protection + self.chart = chart + self.charts.append([0, 0, chart, 0, 0, 1, 1]) + return chart + + def protect(self, password="", options=None): + """ + Set the password and protection options of the worksheet. + + Args: + password: An optional password string. + options: A dictionary of worksheet objects to protect. + + Returns: + Nothing. + + """ + # This method is overridden from parent worksheet class. + + # Chartsheets only allow a reduced set of protect options. + copy = {} + + if not options: + options = {} + + if options.get("objects") is None: + copy["objects"] = False + else: + # Objects are default on for chartsheets, so reverse state. + copy["objects"] = not options["objects"] + + if options.get("content") is None: + copy["content"] = True + else: + copy["content"] = options["content"] + + copy["sheet"] = False + copy["scenarios"] = True + + # If objects and content are both off then the chartsheet isn't + # protected, unless it has a password. + if password == "" and copy["objects"] and not copy["content"]: + return + + if self.chart: + self.chart.protection = True + else: + self.protection = True + + # Call the parent method. + super(Chartsheet, self).protect(password, copy) + + ########################################################################### + # + # Private API. + # + ########################################################################### + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the root worksheet element. + self._write_chartsheet() + + # Write the worksheet properties. + self._write_sheet_pr() + + # Write the sheet view properties. + self._write_sheet_views() + + # Write the sheetProtection element. + self._write_sheet_protection() + + # Write the printOptions element. + self._write_print_options() + + # Write the worksheet page_margins. + self._write_page_margins() + + # Write the worksheet page setup. + self._write_page_setup() + + # Write the headerFooter element. + self._write_header_footer() + + # Write the drawing element. + self._write_drawings() + + # Close the worksheet tag. + self._xml_end_tag("chartsheet") + + # Close the file. + self._xml_close() + + def _prepare_chart(self, index, chart_id, drawing_id): + # Set up chart/drawings. + + self.chart.id = chart_id - 1 + + self.drawing = Drawing() + self.drawing.orientation = self.orientation + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml"] + ) + + self.drawing_links.append( + ["/chart", "../charts/chart" + str(chart_id) + ".xml"] + ) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_chartsheet(self): + # Write the element. This is the root element. + + schema = "http://schemas.openxmlformats.org/" + xmlns = schema + "spreadsheetml/2006/main" + xmlns_r = schema + "officeDocument/2006/relationships" + + attributes = [("xmlns", xmlns), ("xmlns:r", xmlns_r)] + + self._xml_start_tag("chartsheet", attributes) + + def _write_sheet_pr(self): + # Write the element for Sheet level properties. + attributes = [] + + if self.filter_on: + attributes.append(("filterMode", 1)) + + if self.fit_page or self.tab_color: + self._xml_start_tag("sheetPr", attributes) + self._write_tab_color() + self._write_page_set_up_pr() + self._xml_end_tag("sheetPr") + else: + self._xml_empty_tag("sheetPr", attributes) diff --git a/xlsxwriter/python/xlsxwriter/comments.py b/xlsxwriter/python/xlsxwriter/comments.py new file mode 100644 index 0000000..8c58679 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/comments.py @@ -0,0 +1,209 @@ +############################################################################### +# +# Comments - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter +from .utility import preserve_whitespace +from .utility import xl_rowcol_to_cell + + +class Comments(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Comments file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Comments, self).__init__() + self.author_ids = {} + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self, comments_data=[]): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the comments element. + self._write_comments() + + # Write the authors element. + self._write_authors(comments_data) + + # Write the commentList element. + self._write_comment_list(comments_data) + + self._xml_end_tag("comments") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_comments(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + + attributes = [("xmlns", xmlns)] + + self._xml_start_tag("comments", attributes) + + def _write_authors(self, comment_data): + # Write the element. + author_count = 0 + + self._xml_start_tag("authors") + + for comment in comment_data: + author = comment[3] + + if author is not None and author not in self.author_ids: + # Store the author id. + self.author_ids[author] = author_count + author_count += 1 + + # Write the author element. + self._write_author(author) + + self._xml_end_tag("authors") + + def _write_author(self, data): + # Write the element. + self._xml_data_element("author", data) + + def _write_comment_list(self, comment_data): + # Write the element. + self._xml_start_tag("commentList") + + for comment in comment_data: + row = comment[0] + col = comment[1] + text = comment[2] + author = comment[3] + font_name = comment[6] + font_size = comment[7] + font_family = comment[8] + + # Look up the author id. + author_id = None + if author is not None: + author_id = self.author_ids[author] + + # Write the comment element. + font = (font_name, font_size, font_family) + self._write_comment(row, col, text, author_id, font) + + self._xml_end_tag("commentList") + + def _write_comment(self, row, col, text, author_id, font): + # Write the element. + ref = xl_rowcol_to_cell(row, col) + + attributes = [("ref", ref)] + + if author_id is not None: + attributes.append(("authorId", author_id)) + + self._xml_start_tag("comment", attributes) + + # Write the text element. + self._write_text(text, font) + + self._xml_end_tag("comment") + + def _write_text(self, text, font): + # Write the element. + self._xml_start_tag("text") + + # Write the text r element. + self._write_text_r(text, font) + + self._xml_end_tag("text") + + def _write_text_r(self, text, font): + # Write the element. + self._xml_start_tag("r") + + # Write the rPr element. + self._write_r_pr(font) + + # Write the text r element. + self._write_text_t(text) + + self._xml_end_tag("r") + + def _write_text_t(self, text): + # Write the text element. + attributes = [] + + if preserve_whitespace(text): + attributes.append(("xml:space", "preserve")) + + self._xml_data_element("t", text, attributes) + + def _write_r_pr(self, font): + # Write the element. + self._xml_start_tag("rPr") + + # Write the sz element. + self._write_sz(font[1]) + + # Write the color element. + self._write_color() + + # Write the rFont element. + self._write_r_font(font[0]) + + # Write the family element. + self._write_family(font[2]) + + self._xml_end_tag("rPr") + + def _write_sz(self, font_size): + # Write the element. + attributes = [("val", font_size)] + + self._xml_empty_tag("sz", attributes) + + def _write_color(self): + # Write the element. + attributes = [("indexed", 81)] + + self._xml_empty_tag("color", attributes) + + def _write_r_font(self, font_name): + # Write the element. + attributes = [("val", font_name)] + + self._xml_empty_tag("rFont", attributes) + + def _write_family(self, font_family): + # Write the element. + attributes = [("val", font_family)] + + self._xml_empty_tag("family", attributes) diff --git a/xlsxwriter/python/xlsxwriter/contenttypes.py b/xlsxwriter/python/xlsxwriter/contenttypes.py new file mode 100644 index 0000000..ac345ce --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/contenttypes.py @@ -0,0 +1,222 @@ +############################################################################### +# +# ContentTypes - A class for writing the Excel XLSX ContentTypes file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +import copy +from . import xmlwriter + +# Long namespace strings used in the class. +app_package = "application/vnd.openxmlformats-package." +app_document = "application/vnd.openxmlformats-officedocument." + +defaults = [ + ["rels", app_package + "relationships+xml"], + ["xml", "application/xml"], +] + +overrides = [ + ["/docProps/app.xml", app_document + "extended-properties+xml"], + ["/docProps/core.xml", app_package + "core-properties+xml"], + ["/xl/styles.xml", app_document + "spreadsheetml.styles+xml"], + ["/xl/theme/theme1.xml", app_document + "theme+xml"], + ["/xl/workbook.xml", app_document + "spreadsheetml.sheet.main+xml"], +] + + +class ContentTypes(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX ContentTypes file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(ContentTypes, self).__init__() + + # Copy the defaults in case we need to change them. + self.defaults = copy.deepcopy(defaults) + self.overrides = copy.deepcopy(overrides) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_types() + self._write_defaults() + self._write_overrides() + + self._xml_end_tag("Types") + + # Close the file. + self._xml_close() + + def _add_default(self, default): + # Add elements to the ContentTypes defaults. + self.defaults.append(default) + + def _add_override(self, override): + # Add elements to the ContentTypes overrides. + self.overrides.append(override) + + def _add_worksheet_name(self, worksheet_name): + # Add the name of a worksheet to the ContentTypes overrides. + worksheet_name = "/xl/worksheets/" + worksheet_name + ".xml" + + self._add_override( + (worksheet_name, app_document + "spreadsheetml.worksheet+xml") + ) + + def _add_chartsheet_name(self, chartsheet_name): + # Add the name of a chartsheet to the ContentTypes overrides. + chartsheet_name = "/xl/chartsheets/" + chartsheet_name + ".xml" + + self._add_override( + (chartsheet_name, app_document + "spreadsheetml.chartsheet+xml") + ) + + def _add_chart_name(self, chart_name): + # Add the name of a chart to the ContentTypes overrides. + chart_name = "/xl/charts/" + chart_name + ".xml" + + self._add_override((chart_name, app_document + "drawingml.chart+xml")) + + def _add_drawing_name(self, drawing_name): + # Add the name of a drawing to the ContentTypes overrides. + drawing_name = "/xl/drawings/" + drawing_name + ".xml" + + self._add_override((drawing_name, app_document + "drawing+xml")) + + def _add_vml_name(self): + # Add the name of a VML drawing to the ContentTypes defaults. + self._add_default(("vml", app_document + "vmlDrawing")) + + def _add_comment_name(self, comment_name): + # Add the name of a comment to the ContentTypes overrides. + comment_name = "/xl/" + comment_name + ".xml" + + self._add_override((comment_name, app_document + "spreadsheetml.comments+xml")) + + def _add_shared_strings(self): + # Add the sharedStrings link to the ContentTypes overrides. + self._add_override( + ("/xl/sharedStrings.xml", app_document + "spreadsheetml.sharedStrings+xml") + ) + + def _add_calc_chain(self): + # Add the calcChain link to the ContentTypes overrides. + self._add_override( + ("/xl/calcChain.xml", app_document + "spreadsheetml.calcChain+xml") + ) + + def _add_image_types(self, image_types): + # Add the image default types. + for image_type in image_types: + extension = image_type + + if image_type in ("wmf", "emf"): + image_type = "x-" + image_type + + self._add_default((extension, "image/" + image_type)) + + def _add_table_name(self, table_name): + # Add the name of a table to the ContentTypes overrides. + table_name = "/xl/tables/" + table_name + ".xml" + + self._add_override((table_name, app_document + "spreadsheetml.table+xml")) + + def _add_vba_project(self): + # Add a vbaProject to the ContentTypes defaults. + + # Change the workbook.xml content-type from xlsx to xlsm. + for i, override in enumerate(self.overrides): + if override[0] == "/xl/workbook.xml": + xlsm = "application/vnd.ms-excel.sheet.macroEnabled.main+xml" + self.overrides[i][1] = xlsm + + self._add_default(("bin", "application/vnd.ms-office.vbaProject")) + + def _add_custom_properties(self): + # Add the custom properties to the ContentTypes overrides. + self._add_override( + ("/docProps/custom.xml", app_document + "custom-properties+xml") + ) + + def _add_metadata(self): + # Add the metadata file to the ContentTypes overrides. + self._add_override( + ("/xl/metadata.xml", app_document + "spreadsheetml.sheetMetadata+xml") + ) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_defaults(self): + # Write out all of the types. + + for extension, content_type in self.defaults: + self._xml_empty_tag( + "Default", [("Extension", extension), ("ContentType", content_type)] + ) + + def _write_overrides(self): + # Write out all of the types. + for part_name, content_type in self.overrides: + self._xml_empty_tag( + "Override", [("PartName", part_name), ("ContentType", content_type)] + ) + + def _write_types(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/package/2006/content-types" + + attributes = [ + ( + "xmlns", + xmlns, + ) + ] + self._xml_start_tag("Types", attributes) + + def _write_default(self, extension, content_type): + # Write the element. + attributes = [ + ("Extension", extension), + ("ContentType", content_type), + ] + + self._xml_empty_tag("Default", attributes) + + def _write_override(self, part_name, content_type): + # Write the element. + attributes = [ + ("PartName", part_name), + ("ContentType", content_type), + ] + + self._xml_empty_tag("Override", attributes) diff --git a/xlsxwriter/python/xlsxwriter/core.py b/xlsxwriter/python/xlsxwriter/core.py new file mode 100644 index 0000000..905736f --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/core.py @@ -0,0 +1,205 @@ +############################################################################### +# +# Core - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +from datetime import datetime + +# Package imports. +from . import xmlwriter + + +class Core(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Core file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Core, self).__init__() + + self.properties = {} + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_cp_core_properties() + self._write_dc_title() + self._write_dc_subject() + self._write_dc_creator() + self._write_cp_keywords() + self._write_dc_description() + self._write_cp_last_modified_by() + self._write_dcterms_created() + self._write_dcterms_modified() + self._write_cp_category() + self._write_cp_content_status() + + self._xml_end_tag("cp:coreProperties") + + # Close the file. + self._xml_close() + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + def _datetime_to_iso8601_date(self, date): + # Convert to a ISO 8601 style "2010-01-01T00:00:00Z" date. + if not date: + date = datetime.utcnow() + + return date.strftime("%Y-%m-%dT%H:%M:%SZ") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_cp_core_properties(self): + # Write the element. + + xmlns_cp = ( + "http://schemas.openxmlformats.org/package/2006/" + + "metadata/core-properties" + ) + xmlns_dc = "http://purl.org/dc/elements/1.1/" + xmlns_dcterms = "http://purl.org/dc/terms/" + xmlns_dcmitype = "http://purl.org/dc/dcmitype/" + xmlns_xsi = "http://www.w3.org/2001/XMLSchema-instance" + + attributes = [ + ("xmlns:cp", xmlns_cp), + ("xmlns:dc", xmlns_dc), + ("xmlns:dcterms", xmlns_dcterms), + ("xmlns:dcmitype", xmlns_dcmitype), + ("xmlns:xsi", xmlns_xsi), + ] + + self._xml_start_tag("cp:coreProperties", attributes) + + def _write_dc_creator(self): + # Write the element. + data = self.properties.get("author", "") + + self._xml_data_element("dc:creator", data) + + def _write_cp_last_modified_by(self): + # Write the element. + data = self.properties.get("author", "") + + self._xml_data_element("cp:lastModifiedBy", data) + + def _write_dcterms_created(self): + # Write the element. + date = self.properties.get("created", datetime.utcnow()) + + xsi_type = "dcterms:W3CDTF" + + date = self._datetime_to_iso8601_date(date) + + attributes = [ + ( + "xsi:type", + xsi_type, + ) + ] + + self._xml_data_element("dcterms:created", date, attributes) + + def _write_dcterms_modified(self): + # Write the element. + date = self.properties.get("created", datetime.utcnow()) + + xsi_type = "dcterms:W3CDTF" + + date = self._datetime_to_iso8601_date(date) + + attributes = [ + ( + "xsi:type", + xsi_type, + ) + ] + + self._xml_data_element("dcterms:modified", date, attributes) + + def _write_dc_title(self): + # Write the element. + if "title" in self.properties: + data = self.properties["title"] + else: + return + + self._xml_data_element("dc:title", data) + + def _write_dc_subject(self): + # Write the element. + if "subject" in self.properties: + data = self.properties["subject"] + else: + return + + self._xml_data_element("dc:subject", data) + + def _write_cp_keywords(self): + # Write the element. + if "keywords" in self.properties: + data = self.properties["keywords"] + else: + return + + self._xml_data_element("cp:keywords", data) + + def _write_dc_description(self): + # Write the element. + if "comments" in self.properties: + data = self.properties["comments"] + else: + return + + self._xml_data_element("dc:description", data) + + def _write_cp_category(self): + # Write the element. + if "category" in self.properties: + data = self.properties["category"] + else: + return + + self._xml_data_element("cp:category", data) + + def _write_cp_content_status(self): + # Write the element. + if "status" in self.properties: + data = self.properties["status"] + else: + return + + self._xml_data_element("cp:contentStatus", data) diff --git a/xlsxwriter/python/xlsxwriter/custom.py b/xlsxwriter/python/xlsxwriter/custom.py new file mode 100644 index 0000000..39aabae --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/custom.py @@ -0,0 +1,141 @@ +############################################################################### +# +# Custom - A class for writing the Excel XLSX Custom Property file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class Custom(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Custom Workbook Property file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Custom, self).__init__() + + self.properties = [] + self.pid = 1 + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_properties() + + self._xml_end_tag("Properties") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_properties(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/2006/" + xmlns = schema + "custom-properties" + xmlns_vt = schema + "docPropsVTypes" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:vt", xmlns_vt), + ] + + self._xml_start_tag("Properties", attributes) + + for custom_property in self.properties: + # Write the property element. + self._write_property(custom_property) + + def _write_property(self, custom_property): + # Write the element. + + fmtid = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" + + name, value, property_type = custom_property + self.pid += 1 + + attributes = [ + ("fmtid", fmtid), + ("pid", self.pid), + ("name", name), + ] + + self._xml_start_tag("property", attributes) + + if property_type == "number_int": + # Write the vt:i4 element. + self._write_vt_i4(value) + elif property_type == "number": + # Write the vt:r8 element. + self._write_vt_r8(value) + elif property_type == "date": + # Write the vt:filetime element. + self._write_vt_filetime(value) + elif property_type == "bool": + # Write the vt:bool element. + self._write_vt_bool(value) + else: + # Write the vt:lpwstr element. + self._write_vt_lpwstr(value) + + self._xml_end_tag("property") + + def _write_vt_lpwstr(self, value): + # Write the element. + self._xml_data_element("vt:lpwstr", value) + + def _write_vt_filetime(self, value): + # Write the element. + self._xml_data_element("vt:filetime", value) + + def _write_vt_i4(self, value): + # Write the element. + self._xml_data_element("vt:i4", value) + + def _write_vt_r8(self, value): + # Write the element. + self._xml_data_element("vt:r8", value) + + def _write_vt_bool(self, value): + # Write the element. + + if value: + value = "true" + else: + value = "false" + + self._xml_data_element("vt:bool", value) diff --git a/xlsxwriter/python/xlsxwriter/drawing.py b/xlsxwriter/python/xlsxwriter/drawing.py new file mode 100644 index 0000000..152f4c6 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/drawing.py @@ -0,0 +1,1204 @@ +############################################################################### +# +# Drawing - A class for writing the Excel XLSX Drawing file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter +from .shape import Shape +from .utility import get_rgb_color + + +class Drawing(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Drawing file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Drawing, self).__init__() + + self.drawings = [] + self.embedded = 0 + self.orientation = 0 + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the xdr:wsDr element. + self._write_drawing_workspace() + + if self.embedded: + index = 0 + for drawing_properties in self.drawings: + # Write the xdr:twoCellAnchor element. + index += 1 + self._write_two_cell_anchor(index, drawing_properties) + + else: + # Write the xdr:absoluteAnchor element. + self._write_absolute_anchor(1) + + self._xml_end_tag("xdr:wsDr") + + # Close the file. + self._xml_close() + + def _add_drawing_object(self): + # Add a chart, image or shape sub object to the drawing. + + drawing_object = { + "anchor_type": None, + "dimensions": [], + "width": 0, + "height": 0, + "shape": None, + "anchor": None, + "rel_index": 0, + "url_rel_index": 0, + "tip": None, + "name": None, + "description": None, + "decorative": False, + } + + self.drawings.append(drawing_object) + + return drawing_object + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_drawing_workspace(self): + # Write the element. + schema = "http://schemas.openxmlformats.org/drawingml/" + xmlns_xdr = schema + "2006/spreadsheetDrawing" + xmlns_a = schema + "2006/main" + + attributes = [ + ("xmlns:xdr", xmlns_xdr), + ("xmlns:a", xmlns_a), + ] + + self._xml_start_tag("xdr:wsDr", attributes) + + def _write_two_cell_anchor(self, index, drawing_properties): + # Write the element. + anchor_type = drawing_properties["type"] + dimensions = drawing_properties["dimensions"] + col_from = dimensions[0] + row_from = dimensions[1] + col_from_offset = dimensions[2] + row_from_offset = dimensions[3] + col_to = dimensions[4] + row_to = dimensions[5] + col_to_offset = dimensions[6] + row_to_offset = dimensions[7] + col_absolute = dimensions[8] + row_absolute = dimensions[9] + width = drawing_properties["width"] + height = drawing_properties["height"] + shape = drawing_properties["shape"] + anchor = drawing_properties["anchor"] + rel_index = drawing_properties["rel_index"] + url_rel_index = drawing_properties["url_rel_index"] + tip = drawing_properties["tip"] + name = drawing_properties["name"] + description = drawing_properties["description"] + decorative = drawing_properties["decorative"] + + attributes = [] + + # Add attribute for positioning. + if anchor == 2: + attributes.append(("editAs", "oneCell")) + elif anchor == 3: + attributes.append(("editAs", "absolute")) + + # Add editAs attribute for shapes. + if shape and shape.edit_as: + attributes.append(("editAs", shape.edit_as)) + + self._xml_start_tag("xdr:twoCellAnchor", attributes) + + # Write the xdr:from element. + self._write_from(col_from, row_from, col_from_offset, row_from_offset) + + # Write the xdr:from element. + self._write_to(col_to, row_to, col_to_offset, row_to_offset) + + if anchor_type == 1: + # Graphic frame. + # Write the xdr:graphicFrame element for charts. + self._write_graphic_frame(index, rel_index, name, description, decorative) + elif anchor_type == 2: + # Write the xdr:pic element. + self._write_pic( + index, + rel_index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ) + else: + # Write the xdr:sp element for shapes. + self._write_sp( + index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ) + + # Write the xdr:clientData element. + self._write_client_data() + + self._xml_end_tag("xdr:twoCellAnchor") + + def _write_absolute_anchor(self, frame_index): + self._xml_start_tag("xdr:absoluteAnchor") + # Write the element. + + # Different coordinates for horizontal (= 0) and vertical (= 1). + if self.orientation == 0: + # Write the xdr:pos element. + self._write_pos(0, 0) + + # Write the xdr:ext element. + self._write_xdr_ext(9308969, 6078325) + + else: + # Write the xdr:pos element. + self._write_pos(0, -47625) + + # Write the xdr:ext element. + self._write_xdr_ext(6162675, 6124575) + + # Write the xdr:graphicFrame element. + self._write_graphic_frame(frame_index, frame_index) + + # Write the xdr:clientData element. + self._write_client_data() + + self._xml_end_tag("xdr:absoluteAnchor") + + def _write_from(self, col, row, col_offset, row_offset): + # Write the element. + self._xml_start_tag("xdr:from") + + # Write the xdr:col element. + self._write_col(col) + + # Write the xdr:colOff element. + self._write_col_off(col_offset) + + # Write the xdr:row element. + self._write_row(row) + + # Write the xdr:rowOff element. + self._write_row_off(row_offset) + + self._xml_end_tag("xdr:from") + + def _write_to(self, col, row, col_offset, row_offset): + # Write the element. + self._xml_start_tag("xdr:to") + + # Write the xdr:col element. + self._write_col(col) + + # Write the xdr:colOff element. + self._write_col_off(col_offset) + + # Write the xdr:row element. + self._write_row(row) + + # Write the xdr:rowOff element. + self._write_row_off(row_offset) + + self._xml_end_tag("xdr:to") + + def _write_col(self, data): + # Write the element. + self._xml_data_element("xdr:col", data) + + def _write_col_off(self, data): + # Write the element. + self._xml_data_element("xdr:colOff", data) + + def _write_row(self, data): + # Write the element. + self._xml_data_element("xdr:row", data) + + def _write_row_off(self, data): + # Write the element. + self._xml_data_element("xdr:rowOff", data) + + def _write_pos(self, x, y): + # Write the element. + + attributes = [("x", x), ("y", y)] + + self._xml_empty_tag("xdr:pos", attributes) + + def _write_xdr_ext(self, cx, cy): + # Write the element. + + attributes = [("cx", cx), ("cy", cy)] + + self._xml_empty_tag("xdr:ext", attributes) + + def _write_graphic_frame( + self, index, rel_index, name=None, description=None, decorative=None + ): + # Write the element. + attributes = [("macro", "")] + + self._xml_start_tag("xdr:graphicFrame", attributes) + + # Write the xdr:nvGraphicFramePr element. + self._write_nv_graphic_frame_pr(index, name, description, decorative) + + # Write the xdr:xfrm element. + self._write_xfrm() + + # Write the a:graphic element. + self._write_atag_graphic(rel_index) + + self._xml_end_tag("xdr:graphicFrame") + + def _write_nv_graphic_frame_pr(self, index, name, description, decorative): + # Write the element. + + if not name: + name = "Chart " + str(index) + + self._xml_start_tag("xdr:nvGraphicFramePr") + + # Write the xdr:cNvPr element. + self._write_c_nv_pr(index + 1, name, description, None, None, decorative) + + # Write the xdr:cNvGraphicFramePr element. + self._write_c_nv_graphic_frame_pr() + + self._xml_end_tag("xdr:nvGraphicFramePr") + + def _write_c_nv_pr(self, index, name, description, url_rel_index, tip, decorative): + # Write the element. + attributes = [("id", index), ("name", name)] + + # Add description attribute for images. + if description and not decorative: + attributes.append(("descr", description)) + + if url_rel_index or decorative: + self._xml_start_tag("xdr:cNvPr", attributes) + + if url_rel_index: + self._write_a_hlink_click(url_rel_index, tip) + + if decorative: + self._write_decorative() + + self._xml_end_tag("xdr:cNvPr") + else: + self._xml_empty_tag("xdr:cNvPr", attributes) + + def _write_decorative(self): + self._xml_start_tag("a:extLst") + + self._write_uri_ext("{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}") + self._write_a16_creation_id() + self._xml_end_tag("a:ext") + + self._write_uri_ext("{C183D7F6-B498-43B3-948B-1728B52AA6E4}") + self._write_adec_decorative() + self._xml_end_tag("a:ext") + + self._xml_end_tag("a:extLst") + + def _write_uri_ext(self, uri): + # Write the element. + attributes = [("uri", uri)] + + self._xml_start_tag("a:ext", attributes) + + def _write_adec_decorative(self): + # Write the element. + xmlns = "http://schemas.microsoft.com/office/drawing/2017/decorative" + val = "1" + + attributes = [ + ("xmlns:adec", xmlns), + ("val", val), + ] + + self._xml_empty_tag("adec:decorative", attributes) + + def _write_a16_creation_id(self): + # Write the element. + + xmlns_a_16 = "http://schemas.microsoft.com/office/drawing/2014/main" + creation_id = "{00000000-0008-0000-0000-000002000000}" + + attributes = [ + ("xmlns:a16", xmlns_a_16), + ("id", creation_id), + ] + + self._xml_empty_tag("a16:creationId", attributes) + + def _write_a_hlink_click(self, rel_index, tip): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/" + xmlns_r = schema + "2006/relationships" + + attributes = [ + ("xmlns:r", xmlns_r), + ("r:id", "rId" + str(rel_index)), + ] + + if tip: + attributes.append(("tooltip", tip)) + + self._xml_empty_tag("a:hlinkClick", attributes) + + def _write_c_nv_graphic_frame_pr(self): + # Write the element. + if self.embedded: + self._xml_empty_tag("xdr:cNvGraphicFramePr") + else: + self._xml_start_tag("xdr:cNvGraphicFramePr") + + # Write the a:graphicFrameLocks element. + self._write_a_graphic_frame_locks() + + self._xml_end_tag("xdr:cNvGraphicFramePr") + + def _write_a_graphic_frame_locks(self): + # Write the element. + attributes = [("noGrp", 1)] + + self._xml_empty_tag("a:graphicFrameLocks", attributes) + + def _write_xfrm(self): + # Write the element. + self._xml_start_tag("xdr:xfrm") + + # Write the xfrmOffset element. + self._write_xfrm_offset() + + # Write the xfrmOffset element. + self._write_xfrm_extension() + + self._xml_end_tag("xdr:xfrm") + + def _write_xfrm_offset(self): + # Write the xfrm sub-element. + + attributes = [ + ("x", 0), + ("y", 0), + ] + + self._xml_empty_tag("a:off", attributes) + + def _write_xfrm_extension(self): + # Write the xfrm sub-element. + + attributes = [ + ("cx", 0), + ("cy", 0), + ] + + self._xml_empty_tag("a:ext", attributes) + + def _write_atag_graphic(self, index): + # Write the element. + self._xml_start_tag("a:graphic") + + # Write the a:graphicData element. + self._write_atag_graphic_data(index) + + self._xml_end_tag("a:graphic") + + def _write_atag_graphic_data(self, index): + # Write the element. + uri = "http://schemas.openxmlformats.org/drawingml/2006/chart" + + attributes = [ + ( + "uri", + uri, + ) + ] + + self._xml_start_tag("a:graphicData", attributes) + + # Write the c:chart element. + self._write_c_chart("rId" + str(index)) + + self._xml_end_tag("a:graphicData") + + def _write_c_chart(self, r_id): + # Write the element. + + schema = "http://schemas.openxmlformats.org/" + xmlns_c = schema + "drawingml/2006/chart" + xmlns_r = schema + "officeDocument/2006/relationships" + + attributes = [ + ("xmlns:c", xmlns_c), + ("xmlns:r", xmlns_r), + ("r:id", r_id), + ] + + self._xml_empty_tag("c:chart", attributes) + + def _write_client_data(self): + # Write the element. + self._xml_empty_tag("xdr:clientData") + + def _write_sp( + self, + index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ): + # Write the element. + + if shape and shape.connect: + attributes = [("macro", "")] + self._xml_start_tag("xdr:cxnSp", attributes) + + # Write the xdr:nvCxnSpPr element. + self._write_nv_cxn_sp_pr(index, shape) + + # Write the xdr:spPr element. + self._write_xdr_sp_pr( + index, col_absolute, row_absolute, width, height, shape + ) + + self._xml_end_tag("xdr:cxnSp") + else: + # Add attribute for shapes. + attributes = [("macro", ""), ("textlink", shape.textlink)] + + self._xml_start_tag("xdr:sp", attributes) + + # Write the xdr:nvSpPr element. + self._write_nv_sp_pr( + index, shape, url_rel_index, tip, description, decorative + ) + + # Write the xdr:spPr element. + self._write_xdr_sp_pr( + index, col_absolute, row_absolute, width, height, shape + ) + + # Write the xdr:style element. + self._write_style() + + # Write the xdr:txBody element. + if shape.text is not None: + self._write_tx_body(col_absolute, row_absolute, width, height, shape) + + self._xml_end_tag("xdr:sp") + + def _write_nv_cxn_sp_pr(self, index, shape): + # Write the element. + self._xml_start_tag("xdr:nvCxnSpPr") + + name = shape.name + " " + str(index) + if name is not None: + self._write_c_nv_pr(index, name, None, None, None, None) + + self._xml_start_tag("xdr:cNvCxnSpPr") + + attributes = [("noChangeShapeType", "1")] + self._xml_empty_tag("a:cxnSpLocks", attributes) + + if shape.start: + attributes = [("id", shape.start), ("idx", shape.start_index)] + self._xml_empty_tag("a:stCxn", attributes) + + if shape.end: + attributes = [("id", shape.end), ("idx", shape.end_index)] + self._xml_empty_tag("a:endCxn", attributes) + + self._xml_end_tag("xdr:cNvCxnSpPr") + self._xml_end_tag("xdr:nvCxnSpPr") + + def _write_nv_sp_pr( + self, index, shape, url_rel_index, tip, description, decorative + ): + # Write the element. + attributes = [] + + self._xml_start_tag("xdr:nvSpPr") + + name = shape.name + " " + str(index) + + self._write_c_nv_pr( + index + 1, name, description, url_rel_index, tip, decorative + ) + + if shape.name == "TextBox": + attributes = [("txBox", 1)] + + self._xml_empty_tag("xdr:cNvSpPr", attributes) + + self._xml_end_tag("xdr:nvSpPr") + + def _write_pic( + self, + index, + rel_index, + col_absolute, + row_absolute, + width, + height, + shape, + description, + url_rel_index, + tip, + decorative, + ): + # Write the element. + self._xml_start_tag("xdr:pic") + + # Write the xdr:nvPicPr element. + self._write_nv_pic_pr( + index, rel_index, description, url_rel_index, tip, decorative + ) + # Write the xdr:blipFill element. + self._write_blip_fill(rel_index) + + # Write the xdr:spPr element. + self._write_sp_pr(col_absolute, row_absolute, width, height, shape) + + self._xml_end_tag("xdr:pic") + + def _write_nv_pic_pr( + self, index, rel_index, description, url_rel_index, tip, decorative + ): + # Write the element. + self._xml_start_tag("xdr:nvPicPr") + + # Write the xdr:cNvPr element. + self._write_c_nv_pr( + index + 1, + "Picture " + str(index), + description, + url_rel_index, + tip, + decorative, + ) + + # Write the xdr:cNvPicPr element. + self._write_c_nv_pic_pr() + + self._xml_end_tag("xdr:nvPicPr") + + def _write_c_nv_pic_pr(self): + # Write the element. + self._xml_start_tag("xdr:cNvPicPr") + + # Write the a:picLocks element. + self._write_a_pic_locks() + + self._xml_end_tag("xdr:cNvPicPr") + + def _write_a_pic_locks(self): + # Write the element. + attributes = [("noChangeAspect", 1)] + + self._xml_empty_tag("a:picLocks", attributes) + + def _write_blip_fill(self, index): + # Write the element. + self._xml_start_tag("xdr:blipFill") + + # Write the a:blip element. + self._write_a_blip(index) + + # Write the a:stretch element. + self._write_a_stretch() + + self._xml_end_tag("xdr:blipFill") + + def _write_a_blip(self, index): + # Write the element. + schema = "http://schemas.openxmlformats.org/officeDocument/" + xmlns_r = schema + "2006/relationships" + r_embed = "rId" + str(index) + + attributes = [("xmlns:r", xmlns_r), ("r:embed", r_embed)] + + self._xml_empty_tag("a:blip", attributes) + + def _write_a_stretch(self): + # Write the element. + self._xml_start_tag("a:stretch") + + # Write the a:fillRect element. + self._write_a_fill_rect() + + self._xml_end_tag("a:stretch") + + def _write_a_fill_rect(self): + # Write the element. + self._xml_empty_tag("a:fillRect") + + def _write_sp_pr(self, col_absolute, row_absolute, width, height, shape=None): + # Write the element, for charts. + + self._xml_start_tag("xdr:spPr") + + # Write the a:xfrm element. + self._write_a_xfrm(col_absolute, row_absolute, width, height) + + # Write the a:prstGeom element. + self._write_a_prst_geom(shape) + + self._xml_end_tag("xdr:spPr") + + def _write_xdr_sp_pr(self, index, col_absolute, row_absolute, width, height, shape): + # Write the element for shapes. + self._xml_start_tag("xdr:spPr") + + # Write the a:xfrm element. + self._write_a_xfrm(col_absolute, row_absolute, width, height, shape) + + # Write the a:prstGeom element. + self._write_a_prst_geom(shape) + + if shape.fill: + if not shape.fill["defined"]: + # Write the a:solidFill element. + self._write_a_solid_fill_scheme("lt1") + elif "none" in shape.fill: + # Write the a:noFill element. + self._xml_empty_tag("a:noFill") + elif "color" in shape.fill: + # Write the a:solidFill element. + self._write_a_solid_fill(get_rgb_color(shape.fill["color"])) + + if shape.gradient: + # Write the a:gradFill element. + self._write_a_grad_fill(shape.gradient) + + # Write the a:ln element. + self._write_a_ln(shape.line) + + self._xml_end_tag("xdr:spPr") + + def _write_a_xfrm(self, col_absolute, row_absolute, width, height, shape=None): + # Write the element. + attributes = [] + + if shape: + if shape.rotation: + rotation = shape.rotation + rotation *= 60000 + attributes.append(("rot", rotation)) + + if shape.flip_h: + attributes.append(("flipH", 1)) + if shape.flip_v: + attributes.append(("flipV", 1)) + + self._xml_start_tag("a:xfrm", attributes) + + # Write the a:off element. + self._write_a_off(col_absolute, row_absolute) + + # Write the a:ext element. + self._write_a_ext(width, height) + + self._xml_end_tag("a:xfrm") + + def _write_a_off(self, x, y): + # Write the element. + attributes = [ + ("x", x), + ("y", y), + ] + + self._xml_empty_tag("a:off", attributes) + + def _write_a_ext(self, cx, cy): + # Write the element. + attributes = [ + ("cx", cx), + ("cy", cy), + ] + + self._xml_empty_tag("a:ext", attributes) + + def _write_a_prst_geom(self, shape=None): + # Write the element. + attributes = [("prst", "rect")] + + self._xml_start_tag("a:prstGeom", attributes) + + # Write the a:avLst element. + self._write_a_av_lst(shape) + + self._xml_end_tag("a:prstGeom") + + def _write_a_av_lst(self, shape=None): + # Write the element. + adjustments = [] + + if shape and shape.adjustments: + adjustments = shape.adjustments + + if adjustments: + self._xml_start_tag("a:avLst") + + i = 0 + for adj in adjustments: + i += 1 + # Only connectors have multiple adjustments. + if shape.connect: + suffix = i + else: + suffix = "" + + # Scale Adjustments: 100,000 = 100%. + adj_int = str(int(adj * 1000)) + + attributes = [("name", "adj" + suffix), ("fmla", "val" + adj_int)] + + self._xml_empty_tag("a:gd", attributes) + + self._xml_end_tag("a:avLst") + else: + self._xml_empty_tag("a:avLst") + + def _write_a_solid_fill(self, rgb): + # Write the element. + if rgb is None: + rgb = "FFFFFF" + + self._xml_start_tag("a:solidFill") + + # Write the a:srgbClr element. + self._write_a_srgb_clr(rgb) + + self._xml_end_tag("a:solidFill") + + def _write_a_solid_fill_scheme(self, color, shade=None): + attributes = [("val", color)] + + self._xml_start_tag("a:solidFill") + + if shade: + self._xml_start_tag("a:schemeClr", attributes) + self._write_a_shade(shade) + self._xml_end_tag("a:schemeClr") + else: + self._xml_empty_tag("a:schemeClr", attributes) + + self._xml_end_tag("a:solidFill") + + def _write_a_ln(self, line): + # Write the element. + width = line.get("width", 0.75) + + # Round width to nearest 0.25, like Excel. + width = int((width + 0.125) * 4) / 4.0 + + # Convert to internal units. + width = int(0.5 + (12700 * width)) + + attributes = [("w", width), ("cmpd", "sng")] + + self._xml_start_tag("a:ln", attributes) + + if "none" in line: + # Write the a:noFill element. + self._xml_empty_tag("a:noFill") + + elif "color" in line: + # Write the a:solidFill element. + self._write_a_solid_fill(get_rgb_color(line["color"])) + + else: + # Write the a:solidFill element. + self._write_a_solid_fill_scheme("lt1", "50000") + + # Write the line/dash type. + line_type = line.get("dash_type") + if line_type: + # Write the a:prstDash element. + self._write_a_prst_dash(line_type) + + self._xml_end_tag("a:ln") + + def _write_tx_body(self, col_absolute, row_absolute, width, height, shape): + # Write the element. + attributes = [] + + if shape.text_rotation != 0: + if shape.text_rotation == 90: + attributes.append(("vert", "vert270")) + if shape.text_rotation == -90: + attributes.append(("vert", "vert")) + if shape.text_rotation == 270: + attributes.append(("vert", "wordArtVert")) + if shape.text_rotation == 271: + attributes.append(("vert", "eaVert")) + + attributes.append(("wrap", "square")) + attributes.append(("rtlCol", "0")) + + if not shape.align["defined"]: + attributes.append(("anchor", "t")) + else: + if "vertical" in shape.align: + align = shape.align["vertical"] + if align == "top": + attributes.append(("anchor", "t")) + elif align == "middle": + attributes.append(("anchor", "ctr")) + elif align == "bottom": + attributes.append(("anchor", "b")) + else: + attributes.append(("anchor", "t")) + + if "horizontal" in shape.align: + align = shape.align["horizontal"] + if align == "center": + attributes.append(("anchorCtr", "1")) + else: + attributes.append(("anchorCtr", "0")) + + self._xml_start_tag("xdr:txBody") + self._xml_empty_tag("a:bodyPr", attributes) + self._xml_empty_tag("a:lstStyle") + + lines = shape.text.split("\n") + + # Set the font attributes. + font = shape.font + style_attrs = Shape._get_font_style_attributes(font) + latin_attrs = Shape._get_font_latin_attributes(font) + style_attrs.insert(0, ("lang", font["lang"])) + + if shape.textlink != "": + attributes = [ + ("id", "{B8ADDEFE-BF52-4FD4-8C5D-6B85EF6FF707}"), + ("type", "TxLink"), + ] + + self._xml_start_tag("a:p") + self._xml_start_tag("a:fld", attributes) + + self._write_font_run(font, style_attrs, latin_attrs, "a:rPr") + + self._xml_data_element("a:t", shape.text) + self._xml_end_tag("a:fld") + + self._write_font_run(font, style_attrs, latin_attrs, "a:endParaRPr") + + self._xml_end_tag("a:p") + else: + for line in lines: + self._xml_start_tag("a:p") + + if line == "": + self._write_font_run(font, style_attrs, latin_attrs, "a:endParaRPr") + self._xml_end_tag("a:p") + continue + elif "text" in shape.align: + if shape.align["text"] == "left": + self._xml_empty_tag("a:pPr", [("algn", "l")]) + if shape.align["text"] == "center": + self._xml_empty_tag("a:pPr", [("algn", "ctr")]) + if shape.align["text"] == "right": + self._xml_empty_tag("a:pPr", [("algn", "r")]) + + self._xml_start_tag("a:r") + + self._write_font_run(font, style_attrs, latin_attrs, "a:rPr") + + self._xml_data_element("a:t", line) + + self._xml_end_tag("a:r") + self._xml_end_tag("a:p") + + self._xml_end_tag("xdr:txBody") + + def _write_font_run(self, font, style_attrs, latin_attrs, run_type): + # Write a:rPr or a:endParaRPr. + if font.get("color") is not None: + has_color = True + else: + has_color = False + + if latin_attrs or has_color: + self._xml_start_tag(run_type, style_attrs) + + if has_color: + self._write_a_solid_fill(get_rgb_color(font["color"])) + + if latin_attrs: + self._write_a_latin(latin_attrs) + self._write_a_cs(latin_attrs) + + self._xml_end_tag(run_type) + else: + self._xml_empty_tag(run_type, style_attrs) + + def _write_style(self): + # Write the element. + self._xml_start_tag("xdr:style") + + # Write the a:lnRef element. + self._write_a_ln_ref() + + # Write the a:fillRef element. + self._write_a_fill_ref() + + # Write the a:effectRef element. + self._write_a_effect_ref() + + # Write the a:fontRef element. + self._write_a_font_ref() + + self._xml_end_tag("xdr:style") + + def _write_a_ln_ref(self): + # Write the element. + attributes = [("idx", "0")] + + self._xml_start_tag("a:lnRef", attributes) + + # Write the a:scrgbClr element. + self._write_a_scrgb_clr() + + self._xml_end_tag("a:lnRef") + + def _write_a_fill_ref(self): + # Write the element. + attributes = [("idx", "0")] + + self._xml_start_tag("a:fillRef", attributes) + + # Write the a:scrgbClr element. + self._write_a_scrgb_clr() + + self._xml_end_tag("a:fillRef") + + def _write_a_effect_ref(self): + # Write the element. + attributes = [("idx", "0")] + + self._xml_start_tag("a:effectRef", attributes) + + # Write the a:scrgbClr element. + self._write_a_scrgb_clr() + + self._xml_end_tag("a:effectRef") + + def _write_a_scrgb_clr(self): + # Write the element. + + attributes = [ + ("r", "0"), + ("g", "0"), + ("b", "0"), + ] + + self._xml_empty_tag("a:scrgbClr", attributes) + + def _write_a_font_ref(self): + # Write the element. + attributes = [("idx", "minor")] + + self._xml_start_tag("a:fontRef", attributes) + + # Write the a:schemeClr element. + self._write_a_scheme_clr("dk1") + + self._xml_end_tag("a:fontRef") + + def _write_a_scheme_clr(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("a:schemeClr", attributes) + + def _write_a_shade(self, shade): + # Write the element. + attributes = [("val", shade)] + + self._xml_empty_tag("a:shade", attributes) + + def _write_a_prst_dash(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("a:prstDash", attributes) + + def _write_a_grad_fill(self, gradient): + # Write the element. + + attributes = [("flip", "none"), ("rotWithShape", "1")] + + if gradient["type"] == "linear": + attributes = [] + + self._xml_start_tag("a:gradFill", attributes) + + # Write the a:gsLst element. + self._write_a_gs_lst(gradient) + + if gradient["type"] == "linear": + # Write the a:lin element. + self._write_a_lin(gradient["angle"]) + else: + # Write the a:path element. + self._write_a_path(gradient["type"]) + + # Write the a:tileRect element. + self._write_a_tile_rect(gradient["type"]) + + self._xml_end_tag("a:gradFill") + + def _write_a_gs_lst(self, gradient): + # Write the element. + positions = gradient["positions"] + colors = gradient["colors"] + + self._xml_start_tag("a:gsLst") + + for i in range(len(colors)): + pos = int(positions[i] * 1000) + attributes = [("pos", pos)] + self._xml_start_tag("a:gs", attributes) + + # Write the a:srgbClr element. + color = get_rgb_color(colors[i]) + self._write_a_srgb_clr(color) + + self._xml_end_tag("a:gs") + + self._xml_end_tag("a:gsLst") + + def _write_a_lin(self, angle): + # Write the element. + + angle = int(60000 * angle) + + attributes = [ + ("ang", angle), + ("scaled", "0"), + ] + + self._xml_empty_tag("a:lin", attributes) + + def _write_a_path(self, gradient_type): + # Write the element. + + attributes = [("path", gradient_type)] + + self._xml_start_tag("a:path", attributes) + + # Write the a:fillToRect element. + self._write_a_fill_to_rect(gradient_type) + + self._xml_end_tag("a:path") + + def _write_a_fill_to_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [ + ("l", "50000"), + ("t", "50000"), + ("r", "50000"), + ("b", "50000"), + ] + else: + attributes = [ + ("l", "100000"), + ("t", "100000"), + ] + + self._xml_empty_tag("a:fillToRect", attributes) + + def _write_a_tile_rect(self, gradient_type): + # Write the element. + + if gradient_type == "shape": + attributes = [] + else: + attributes = [ + ("r", "-100000"), + ("b", "-100000"), + ] + + self._xml_empty_tag("a:tileRect", attributes) + + def _write_a_srgb_clr(self, val): + # Write the element. + + attributes = [("val", val)] + + self._xml_empty_tag("a:srgbClr", attributes) + + def _write_a_latin(self, attributes): + # Write the element. + self._xml_empty_tag("a:latin", attributes) + + def _write_a_cs(self, attributes): + # Write the element. + self._xml_empty_tag("a:cs", attributes) diff --git a/xlsxwriter/python/xlsxwriter/exceptions.py b/xlsxwriter/python/xlsxwriter/exceptions.py new file mode 100644 index 0000000..ccb7d73 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/exceptions.py @@ -0,0 +1,55 @@ +############################################################################### +# +# Exceptions - A class for XlsxWriter exceptions. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + + +class XlsxWriterException(Exception): + """Base exception for XlsxWriter.""" + + +class XlsxInputError(XlsxWriterException): + """Base exception for all input data related errors.""" + + +class XlsxFileError(XlsxWriterException): + """Base exception for all file related errors.""" + + +class EmptyChartSeries(XlsxInputError): + """Chart must contain at least one data series.""" + + +class DuplicateTableName(XlsxInputError): + """Worksheet table name already exists.""" + + +class InvalidWorksheetName(XlsxInputError): + """Worksheet name is too long or contains restricted characters.""" + + +class DuplicateWorksheetName(XlsxInputError): + """Worksheet name already exists.""" + + +class OverlappingRange(XlsxInputError): + """Worksheet merge range or table overlaps previous range.""" + + +class UndefinedImageSize(XlsxFileError): + """No size data found in image file.""" + + +class UnsupportedImageFormat(XlsxFileError): + """Unsupported image file format.""" + + +class FileCreateError(XlsxFileError): + """IO error when creating xlsx file.""" + + +class FileSizeError(XlsxFileError): + """Filesize would require ZIP64 extensions. Use workbook.use_zip64().""" diff --git a/xlsxwriter/python/xlsxwriter/format.py b/xlsxwriter/python/xlsxwriter/format.py new file mode 100644 index 0000000..2769ac2 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/format.py @@ -0,0 +1,1030 @@ +############################################################################### +# +# Format - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter +from warnings import warn + + +class Format(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Format file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, properties=None, xf_indices=None, dxf_indices=None): + """ + Constructor. + + """ + if properties is None: + properties = {} + + super(Format, self).__init__() + + self.xf_format_indices = xf_indices + self.dxf_format_indices = dxf_indices + self.xf_index = None + self.dxf_index = None + + self.num_format = "General" + self.num_format_index = 0 + self.font_index = 0 + self.has_font = 0 + self.has_dxf_font = 0 + + self.bold = 0 + self.underline = 0 + self.italic = 0 + self.font_name = "Calibri" + self.font_size = 11 + self.font_color = 0x0 + self.font_strikeout = 0 + self.font_outline = 0 + self.font_shadow = 0 + self.font_script = 0 + self.font_family = 2 + self.font_charset = 0 + self.font_scheme = "minor" + self.font_condense = 0 + self.font_extend = 0 + self.theme = 0 + self.hyperlink = False + self.xf_id = 0 + + self.hidden = 0 + self.locked = 1 + + self.text_h_align = 0 + self.text_wrap = 0 + self.text_v_align = 0 + self.text_justlast = 0 + self.rotation = 0 + + self.fg_color = 0 + self.bg_color = 0 + self.pattern = 0 + self.has_fill = 0 + self.has_dxf_fill = 0 + self.fill_index = 0 + self.fill_count = 0 + + self.border_index = 0 + self.has_border = 0 + self.has_dxf_border = 0 + self.border_count = 0 + + self.bottom = 0 + self.bottom_color = 0 + self.diag_border = 0 + self.diag_color = 0 + self.diag_type = 0 + self.left = 0 + self.left_color = 0 + self.right = 0 + self.right_color = 0 + self.top = 0 + self.top_color = 0 + + self.indent = 0 + self.shrink = 0 + self.merge_range = 0 + self.reading_order = 0 + self.just_distrib = 0 + self.color_indexed = 0 + self.font_only = 0 + + self.quote_prefix = False + + # Convert properties in the constructor to method calls. + for key, value in properties.items(): + getattr(self, "set_" + key)(value) + + self._format_key = None + + ########################################################################### + # + # Format properties. + # + ########################################################################### + + def set_font_name(self, font_name): + """ + Set the Format font_name property such as 'Time New Roman'. The + default Excel font is 'Calibri'. + + Args: + font_name: String with the font name. No default. + + Returns: + Nothing. + + """ + self.font_name = font_name + + def set_font_size(self, font_size=11): + """ + Set the Format font_size property. The default Excel font size is 11. + + Args: + font_size: Int with font size. No default. + + Returns: + Nothing. + + """ + self.font_size = font_size + + def set_font_color(self, font_color): + """ + Set the Format font_color property. The Excel default is black. + + Args: + font_color: String with the font color. No default. + + Returns: + Nothing. + + """ + self.font_color = self._get_color(font_color) + + def set_bold(self, bold=True): + """ + Set the Format bold property. + + Args: + bold: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.bold = bold + + def set_italic(self, italic=True): + """ + Set the Format italic property. + + Args: + italic: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.italic = italic + + def set_underline(self, underline=1): + """ + Set the Format underline property. + + Args: + underline: Default is 1, single underline. + + Returns: + Nothing. + + """ + self.underline = underline + + def set_font_strikeout(self, font_strikeout=True): + """ + Set the Format font_strikeout property. + + Args: + font_strikeout: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.font_strikeout = font_strikeout + + def set_font_script(self, font_script=1): + """ + Set the Format font_script property. + + Args: + font_script: Default is 1, superscript. + + Returns: + Nothing. + + """ + self.font_script = font_script + + def set_font_outline(self, font_outline=True): + """ + Set the Format font_outline property. + + Args: + font_outline: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.font_outline = font_outline + + def set_font_shadow(self, font_shadow=True): + """ + Set the Format font_shadow property. + + Args: + font_shadow: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.font_shadow = font_shadow + + def set_num_format(self, num_format): + """ + Set the Format num_format property such as '#,##0'. + + Args: + num_format: String representing the number format. No default. + + Returns: + Nothing. + + """ + self.num_format = num_format + + def set_locked(self, locked=True): + """ + Set the Format locked property. + + Args: + locked: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.locked = locked + + def set_hidden(self, hidden=True): + """ + Set the Format hidden property. + + Args: + hidden: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.hidden = hidden + + def set_align(self, alignment): + """ + Set the Format cell alignment. + + Args: + alignment: String representing alignment. No default. + + Returns: + Nothing. + """ + alignment = alignment.lower() + + # Set horizontal alignment properties. + if alignment == "left": + self.set_text_h_align(1) + if alignment == "centre": + self.set_text_h_align(2) + if alignment == "center": + self.set_text_h_align(2) + if alignment == "right": + self.set_text_h_align(3) + if alignment == "fill": + self.set_text_h_align(4) + if alignment == "justify": + self.set_text_h_align(5) + if alignment == "center_across": + self.set_text_h_align(6) + if alignment == "centre_across": + self.set_text_h_align(6) + if alignment == "distributed": + self.set_text_h_align(7) + if alignment == "justify_distributed": + self.set_text_h_align(7) + + if alignment == "justify_distributed": + self.just_distrib = 1 + + # Set vertical alignment properties. + if alignment == "top": + self.set_text_v_align(1) + if alignment == "vcentre": + self.set_text_v_align(2) + if alignment == "vcenter": + self.set_text_v_align(2) + if alignment == "bottom": + self.set_text_v_align(3) + if alignment == "vjustify": + self.set_text_v_align(4) + if alignment == "vdistributed": + self.set_text_v_align(5) + + def set_center_across(self, align_type=None): + """ + Set the Format center_across property. + + Returns: + Nothing. + + """ + self.set_text_h_align(6) + + def set_text_wrap(self, text_wrap=True): + """ + Set the Format text_wrap property. + + Args: + text_wrap: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.text_wrap = text_wrap + + def set_rotation(self, rotation): + """ + Set the Format rotation property. + + Args: + rotation: Rotation angle. No default. + + Returns: + Nothing. + + """ + rotation = int(rotation) + + # Map user angle to Excel angle. + if rotation == 270: + rotation = 255 + elif -90 <= rotation <= 90: + if rotation < 0: + rotation = -rotation + 90 + else: + warn("Rotation rotation outside range: -90 <= angle <= 90") + return + + self.rotation = rotation + + def set_indent(self, indent=1): + """ + Set the Format indent property. + + Args: + indent: Default is 1, first indentation level. + + Returns: + Nothing. + + """ + self.indent = indent + + def set_shrink(self, shrink=True): + """ + Set the Format shrink property. + + Args: + shrink: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.shrink = shrink + + def set_text_justlast(self, text_justlast=True): + """ + Set the Format text_justlast property. + + Args: + text_justlast: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.text_justlast = text_justlast + + def set_pattern(self, pattern=1): + """ + Set the Format pattern property. + + Args: + pattern: Default is 1, solid fill. + + Returns: + Nothing. + + """ + self.pattern = pattern + + def set_bg_color(self, bg_color): + """ + Set the Format bg_color property. + + Args: + bg_color: Background color. No default. + + Returns: + Nothing. + + """ + self.bg_color = self._get_color(bg_color) + + def set_fg_color(self, fg_color): + """ + Set the Format fg_color property. + + Args: + fg_color: Foreground color. No default. + + Returns: + Nothing. + + """ + self.fg_color = self._get_color(fg_color) + + # set_border(style) Set cells borders to the same style + def set_border(self, style=1): + """ + Set the Format bottom property. + + Args: + bottom: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.set_bottom(style) + self.set_top(style) + self.set_left(style) + self.set_right(style) + + # set_border_color(color) Set cells border to the same color + def set_border_color(self, color): + """ + Set the Format bottom property. + + Args: + color: Color string. No default. + + Returns: + Nothing. + + """ + self.set_bottom_color(color) + self.set_top_color(color) + self.set_left_color(color) + self.set_right_color(color) + + def set_bottom(self, bottom=1): + """ + Set the Format bottom property. + + Args: + bottom: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.bottom = bottom + + def set_bottom_color(self, bottom_color): + """ + Set the Format bottom_color property. + + Args: + bottom_color: Color string. No default. + + Returns: + Nothing. + + """ + self.bottom_color = self._get_color(bottom_color) + + def set_diag_type(self, diag_type=1): + """ + Set the Format diag_type property. + + Args: + diag_type: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.diag_type = diag_type + + def set_left(self, left=1): + """ + Set the Format left property. + + Args: + left: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.left = left + + def set_left_color(self, left_color): + """ + Set the Format left_color property. + + Args: + left_color: Color string. No default. + + Returns: + Nothing. + + """ + self.left_color = self._get_color(left_color) + + def set_right(self, right=1): + """ + Set the Format right property. + + Args: + right: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.right = right + + def set_right_color(self, right_color): + """ + Set the Format right_color property. + + Args: + right_color: Color string. No default. + + Returns: + Nothing. + + """ + self.right_color = self._get_color(right_color) + + def set_top(self, top=1): + """ + Set the Format top property. + + Args: + top: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.top = top + + def set_top_color(self, top_color): + """ + Set the Format top_color property. + + Args: + top_color: Color string. No default. + + Returns: + Nothing. + + """ + self.top_color = self._get_color(top_color) + + def set_diag_color(self, diag_color): + """ + Set the Format diag_color property. + + Args: + diag_color: Color string. No default. + + Returns: + Nothing. + + """ + self.diag_color = self._get_color(diag_color) + + def set_diag_border(self, diag_border=1): + """ + Set the Format diag_border property. + + Args: + diag_border: Default is 1, border type 1. + + Returns: + Nothing. + + """ + self.diag_border = diag_border + + def set_quote_prefix(self, quote_prefix=True): + """ + Set the Format quote prefix property. + + Args: + quote_prefix: Default is True, turns property on. + + Returns: + Nothing. + + """ + self.quote_prefix = quote_prefix + + ########################################################################### + # + # Internal Format properties. These aren't documented since they are + # either only used internally or else are unlikely to be set by the user. + # + ########################################################################### + + def set_has_font(self, has_font=True): + # Set the has_font property. + self.has_font = has_font + + def set_has_fill(self, has_fill=True): + # Set the has_fill property. + self.has_fill = has_fill + + def set_font_index(self, font_index): + # Set the font_index property. + self.font_index = font_index + + def set_xf_index(self, xf_index): + # Set the xf_index property. + self.xf_index = xf_index + + def set_dxf_index(self, dxf_index): + # Set the xf_index property. + self.dxf_index = dxf_index + + def set_num_format_index(self, num_format_index): + # Set the num_format_index property. + self.num_format_index = num_format_index + + def set_text_h_align(self, text_h_align): + # Set the text_h_align property. + self.text_h_align = text_h_align + + def set_text_v_align(self, text_v_align): + # Set the text_v_align property. + self.text_v_align = text_v_align + + def set_reading_order(self, direction=0): + # Set the reading_order property. + self.reading_order = direction + + def set_valign(self, align): + # Set vertical cell alignment. This is required by the constructor + # properties dict to differentiate between the vertical and horizontal + # properties. + self.set_align(align) + + def set_font_family(self, font_family): + # Set the Format font_family property. + self.font_family = font_family + + def set_font_charset(self, font_charset): + # Set the Format font_charset property. + self.font_charset = font_charset + + def set_font_scheme(self, font_scheme): + # Set the Format font_scheme property. + self.font_scheme = font_scheme + + def set_font_condense(self, font_condense): + # Set the Format font_condense property. + self.font_condense = font_condense + + def set_font_extend(self, font_extend): + # Set the Format font_extend property. + self.font_extend = font_extend + + def set_theme(self, theme): + # Set the Format theme property. + self.theme = theme + + def set_hyperlink(self, hyperlink=True): + # Set the properties for the hyperlink style. This isn't + # currently public. To be fixed when styles are supported. + self.xf_id = 1 + self.set_underline(1) + self.set_theme(10) + self.hyperlink = hyperlink + + def set_color_indexed(self, color_index): + # Used in the cell comment format. + self.color_indexed = color_index + + def set_font_only(self, font_only=True): + # Used in the cell comment format. + self.font_only = font_only + + # Compatibility methods. + def set_font(self, font_name): + # For compatibility with Excel::Writer::XLSX. + self.font_name = font_name + + def set_size(self, font_size): + # For compatibility with Excel::Writer::XLSX. + self.font_size = font_size + + def set_color(self, font_color): + # For compatibility with Excel::Writer::XLSX. + self.font_color = self._get_color(font_color) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _get_align_properties(self): + # Return properties for an Style xf sub-element. + changed = 0 + align = [] + + # Check if any alignment options in the format have been changed. + if ( + self.text_h_align + or self.text_v_align + or self.indent + or self.rotation + or self.text_wrap + or self.shrink + or self.reading_order + ): + changed = 1 + else: + return changed, align + + # Indent is only allowed for horizontal left, right and distributed. + # If it is defined for any other alignment or no alignment has + # been set then default to left alignment. + if ( + self.indent + and self.text_h_align != 1 + and self.text_h_align != 3 + and self.text_h_align != 7 + ): + self.text_h_align = 1 + + # Check for properties that are mutually exclusive. + if self.text_wrap: + self.shrink = 0 + if self.text_h_align == 4: + self.shrink = 0 + if self.text_h_align == 5: + self.shrink = 0 + if self.text_h_align == 7: + self.shrink = 0 + if self.text_h_align != 7: + self.just_distrib = 0 + if self.indent: + self.just_distrib = 0 + + continuous = "centerContinuous" + + if self.text_h_align == 1: + align.append(("horizontal", "left")) + if self.text_h_align == 2: + align.append(("horizontal", "center")) + if self.text_h_align == 3: + align.append(("horizontal", "right")) + if self.text_h_align == 4: + align.append(("horizontal", "fill")) + if self.text_h_align == 5: + align.append(("horizontal", "justify")) + if self.text_h_align == 6: + align.append(("horizontal", continuous)) + if self.text_h_align == 7: + align.append(("horizontal", "distributed")) + + if self.just_distrib: + align.append(("justifyLastLine", 1)) + + # Property 'vertical' => 'bottom' is a default. It sets applyAlignment + # without an alignment sub-element. + if self.text_v_align == 1: + align.append(("vertical", "top")) + if self.text_v_align == 2: + align.append(("vertical", "center")) + if self.text_v_align == 4: + align.append(("vertical", "justify")) + if self.text_v_align == 5: + align.append(("vertical", "distributed")) + + if self.indent: + align.append(("indent", self.indent)) + if self.rotation: + align.append(("textRotation", self.rotation)) + + if self.text_wrap: + align.append(("wrapText", 1)) + if self.shrink: + align.append(("shrinkToFit", 1)) + + if self.reading_order == 1: + align.append(("readingOrder", 1)) + if self.reading_order == 2: + align.append(("readingOrder", 2)) + + return changed, align + + def _get_protection_properties(self): + # Return properties for an Excel XML element. + attribs = [] + + if not self.locked: + attribs.append(("locked", 0)) + if self.hidden: + attribs.append(("hidden", 1)) + + return attribs + + def _get_format_key(self): + # Returns a unique hash key for a format. Used by Workbook. + if self._format_key is None: + self._format_key = ":".join( + str(x) + for x in ( + self._get_font_key(), + self._get_border_key(), + self._get_fill_key(), + self._get_alignment_key(), + self.num_format, + self.locked, + self.quote_prefix, + self.hidden, + ) + ) + + return self._format_key + + def _get_font_key(self): + # Returns a unique hash key for a font. Used by Workbook. + key = ":".join( + str(x) + for x in ( + self.bold, + self.font_color, + self.font_charset, + self.font_family, + self.font_outline, + self.font_script, + self.font_shadow, + self.font_strikeout, + self.font_name, + self.italic, + self.font_size, + self.underline, + self.theme, + ) + ) + + return key + + def _get_border_key(self): + # Returns a unique hash key for a border style. Used by Workbook. + key = ":".join( + str(x) + for x in ( + self.bottom, + self.bottom_color, + self.diag_border, + self.diag_color, + self.diag_type, + self.left, + self.left_color, + self.right, + self.right_color, + self.top, + self.top_color, + ) + ) + + return key + + def _get_fill_key(self): + # Returns a unique hash key for a fill style. Used by Workbook. + key = ":".join(str(x) for x in (self.pattern, self.bg_color, self.fg_color)) + + return key + + def _get_alignment_key(self): + # Returns a unique hash key for alignment formats. + + key = ":".join( + str(x) + for x in ( + self.text_h_align, + self.text_v_align, + self.indent, + self.rotation, + self.text_wrap, + self.shrink, + self.reading_order, + ) + ) + + return key + + def _get_xf_index(self): + # Returns the XF index number used by Excel to identify a format. + if self.xf_index is not None: + # Format already has an index number so return it. + return self.xf_index + else: + # Format doesn't have an index number so assign one. + key = self._get_format_key() + + if key in self.xf_format_indices: + # Format matches existing format with an index. + return self.xf_format_indices[key] + else: + # New format requiring an index. Note. +1 since Excel + # has an implicit "General" format at index 0. + index = 1 + len(self.xf_format_indices) + self.xf_format_indices[key] = index + self.xf_index = index + return index + + def _get_dxf_index(self): + # Returns the DXF index number used by Excel to identify a format. + if self.dxf_index is not None: + # Format already has an index number so return it. + return self.dxf_index + else: + # Format doesn't have an index number so assign one. + key = self._get_format_key() + + if key in self.dxf_format_indices: + # Format matches existing format with an index. + return self.dxf_format_indices[key] + else: + # New format requiring an index. + index = len(self.dxf_format_indices) + self.dxf_format_indices[key] = index + self.dxf_index = index + return index + + def _get_color(self, color): + # Used in conjunction with the set_xxx_color methods to convert a + # color name into an RGB formatted string. These colors are for + # backward compatibility with older versions of Excel. + named_colors = { + "black": "#000000", + "blue": "#0000FF", + "brown": "#800000", + "cyan": "#00FFFF", + "gray": "#808080", + "green": "#008000", + "lime": "#00FF00", + "magenta": "#FF00FF", + "navy": "#000080", + "orange": "#FF6600", + "pink": "#FF00FF", + "purple": "#800080", + "red": "#FF0000", + "silver": "#C0C0C0", + "white": "#FFFFFF", + "yellow": "#FFFF00", + "automatic": "Automatic", + } + + if color in named_colors: + color = named_colors[color] + + return color + + ########################################################################### + # + # XML methods. + # + ########################################################################### diff --git a/xlsxwriter/python/xlsxwriter/metadata.py b/xlsxwriter/python/xlsxwriter/metadata.py new file mode 100644 index 0000000..5495a96 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/metadata.py @@ -0,0 +1,170 @@ +############################################################################### +# +# Metadata - A class for writing the Excel XLSX Metadata file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter + + +class Metadata(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Metadata file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Metadata, self).__init__() + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the metadata element. + self._write_metadata() + + # Write the metadataTypes element. + self._write_metadata_types() + + # Write the futureMetadata element. + self._write_future_metadata() + + # Write the cellMetadata element. + self._write_cell_metadata() + + self._xml_end_tag("metadata") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_metadata(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + schema = "http://schemas.microsoft.com/office" + xmlns_xda = schema + "/spreadsheetml/2017/dynamicarray" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:xda", xmlns_xda), + ] + + self._xml_start_tag("metadata", attributes) + + def _write_metadata_types(self): + # Write the element. + attributes = [("count", 1)] + + self._xml_start_tag("metadataTypes", attributes) + + # Write the metadataType element. + self._write_metadata_type() + + self._xml_end_tag("metadataTypes") + + def _write_metadata_type(self): + # Write the element. + attributes = [ + ("name", "XLDAPR"), + ("minSupportedVersion", 120000), + ("copy", 1), + ("pasteAll", 1), + ("pasteValues", 1), + ("merge", 1), + ("splitFirst", 1), + ("rowColShift", 1), + ("clearFormats", 1), + ("clearComments", 1), + ("assign", 1), + ("coerce", 1), + ("cellMeta", 1), + ] + + self._xml_empty_tag("metadataType", attributes) + + def _write_future_metadata(self): + # Write the element. + attributes = [ + ("name", "XLDAPR"), + ("count", 1), + ] + + self._xml_start_tag("futureMetadata", attributes) + self._xml_start_tag("bk") + self._xml_start_tag("extLst") + + # Write the ext element. + self._write_ext() + + self._xml_end_tag("extLst") + self._xml_end_tag("bk") + self._xml_end_tag("futureMetadata") + + def _write_ext(self): + # Write the element. + attributes = [("uri", "{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}")] + + self._xml_start_tag("ext", attributes) + + # Write the xda:dynamicArrayProperties element. + self._write_xda_dynamic_array_properties() + + self._xml_end_tag("ext") + + def _write_xda_dynamic_array_properties(self): + # Write the element. + attributes = [ + ("fDynamic", 1), + ("fCollapsed", 0), + ] + + self._xml_empty_tag("xda:dynamicArrayProperties", attributes) + + def _write_cell_metadata(self): + # Write the element. + attributes = [("count", 1)] + + self._xml_start_tag("cellMetadata", attributes) + self._xml_start_tag("bk") + + # Write the rc element. + self._write_rc() + + self._xml_end_tag("bk") + self._xml_end_tag("cellMetadata") + + def _write_rc(self): + # Write the element. + attributes = [ + ("t", 1), + ("v", 0), + ] + + self._xml_empty_tag("rc", attributes) diff --git a/xlsxwriter/python/xlsxwriter/packager.py b/xlsxwriter/python/xlsxwriter/packager.py new file mode 100644 index 0000000..bc239c3 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/packager.py @@ -0,0 +1,711 @@ +############################################################################### +# +# Packager - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import os +import stat +import tempfile +from shutil import copy + +from io import StringIO +from io import BytesIO + +# Package imports. +from .app import App +from .contenttypes import ContentTypes +from .core import Core +from .custom import Custom +from .metadata import Metadata +from .relationships import Relationships +from .sharedstrings import SharedStrings +from .styles import Styles +from .theme import Theme +from .vml import Vml +from .table import Table +from .comments import Comments +from .exceptions import EmptyChartSeries + + +class Packager(object): + """ + A class for writing the Excel XLSX Packager file. + + This module is used in conjunction with XlsxWriter to create an + Excel XLSX container file. + + From Wikipedia: The Open Packaging Conventions (OPC) is a + container-file technology initially created by Microsoft to store + a combination of XML and non-XML files that together form a single + entity such as an Open XML Paper Specification (OpenXPS) + document. http://en.wikipedia.org/wiki/Open_Packaging_Conventions. + + At its simplest an Excel XLSX file contains the following elements:: + + ____ [Content_Types].xml + | + |____ docProps + | |____ app.xml + | |____ core.xml + | + |____ xl + | |____ workbook.xml + | |____ worksheets + | | |____ sheet1.xml + | | + | |____ styles.xml + | | + | |____ theme + | | |____ theme1.xml + | | + | |_____rels + | |____ workbook.xml.rels + | + |_____rels + |____ .rels + + The Packager class coordinates the classes that represent the + elements of the package and writes them into the XLSX file. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Packager, self).__init__() + + self.tmpdir = "" + self.in_memory = False + self.workbook = None + self.worksheet_count = 0 + self.chartsheet_count = 0 + self.chart_count = 0 + self.drawing_count = 0 + self.table_count = 0 + self.num_vml_files = 0 + self.num_comment_files = 0 + self.named_ranges = [] + self.filenames = [] + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _set_tmpdir(self, tmpdir): + # Set an optional user defined temp directory. + self.tmpdir = tmpdir + + def _set_in_memory(self, in_memory): + # Set the optional 'in_memory' mode. + self.in_memory = in_memory + + def _add_workbook(self, workbook): + # Add the Excel::Writer::XLSX::Workbook object to the package. + self.workbook = workbook + self.chart_count = len(workbook.charts) + self.drawing_count = len(workbook.drawings) + self.num_vml_files = workbook.num_vml_files + self.num_comment_files = workbook.num_comment_files + self.named_ranges = workbook.named_ranges + + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + self.chartsheet_count += 1 + else: + self.worksheet_count += 1 + + def _create_package(self): + # Write the xml files that make up the XLSX OPC package. + self._write_content_types_file() + self._write_root_rels_file() + self._write_workbook_rels_file() + self._write_worksheet_files() + self._write_chartsheet_files() + self._write_workbook_file() + self._write_chart_files() + self._write_drawing_files() + self._write_vml_files() + self._write_comment_files() + self._write_table_files() + self._write_shared_strings_file() + self._write_styles_file() + self._write_custom_file() + self._write_theme_file() + self._write_worksheet_rels_files() + self._write_chartsheet_rels_files() + self._write_drawing_rels_files() + self._add_image_files() + self._add_vba_project() + self._write_core_file() + self._write_app_file() + self._write_metadata_file() + + return self.filenames + + def _filename(self, xml_filename): + # Create a temp filename to write the XML data to and store the Excel + # filename to use as the name in the Zip container. + if self.in_memory: + os_filename = StringIO() + else: + (fd, os_filename) = tempfile.mkstemp(dir=self.tmpdir) + os.close(fd) + + self.filenames.append((os_filename, xml_filename, False)) + + return os_filename + + def _write_workbook_file(self): + # Write the workbook.xml file. + workbook = self.workbook + + workbook._set_xml_writer(self._filename("xl/workbook.xml")) + workbook._assemble_xml_file() + + def _write_worksheet_files(self): + # Write the worksheet files. + index = 1 + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + continue + + if worksheet.constant_memory: + worksheet._opt_reopen() + worksheet._write_single_row() + + worksheet._set_xml_writer( + self._filename("xl/worksheets/sheet" + str(index) + ".xml") + ) + worksheet._assemble_xml_file() + index += 1 + + def _write_chartsheet_files(self): + # Write the chartsheet files. + index = 1 + for worksheet in self.workbook.worksheets(): + if not worksheet.is_chartsheet: + continue + + worksheet._set_xml_writer( + self._filename("xl/chartsheets/sheet" + str(index) + ".xml") + ) + worksheet._assemble_xml_file() + index += 1 + + def _write_chart_files(self): + # Write the chart files. + if not self.workbook.charts: + return + + index = 1 + for chart in self.workbook.charts: + # Check that the chart has at least one data series. + if not chart.series: + raise EmptyChartSeries( + "Chart%d must contain at least one " + "data series. See chart.add_series()." % index + ) + + chart._set_xml_writer( + self._filename("xl/charts/chart" + str(index) + ".xml") + ) + chart._assemble_xml_file() + index += 1 + + def _write_drawing_files(self): + # Write the drawing files. + if not self.drawing_count: + return + + index = 1 + for drawing in self.workbook.drawings: + drawing._set_xml_writer( + self._filename("xl/drawings/drawing" + str(index) + ".xml") + ) + drawing._assemble_xml_file() + index += 1 + + def _write_vml_files(self): + # Write the comment VML files. + index = 1 + for worksheet in self.workbook.worksheets(): + if not worksheet.has_vml and not worksheet.has_header_vml: + continue + if worksheet.has_vml: + vml = Vml() + vml._set_xml_writer( + self._filename("xl/drawings/vmlDrawing" + str(index) + ".vml") + ) + vml._assemble_xml_file( + worksheet.vml_data_id, + worksheet.vml_shape_id, + worksheet.comments_list, + worksheet.buttons_list, + ) + index += 1 + + if worksheet.has_header_vml: + vml = Vml() + + vml._set_xml_writer( + self._filename("xl/drawings/vmlDrawing" + str(index) + ".vml") + ) + vml._assemble_xml_file( + worksheet.vml_header_id, + worksheet.vml_header_id * 1024, + None, + None, + worksheet.header_images_list, + ) + + self._write_vml_drawing_rels_file(worksheet, index) + index += 1 + + def _write_comment_files(self): + # Write the comment files. + index = 1 + for worksheet in self.workbook.worksheets(): + if not worksheet.has_comments: + continue + + comment = Comments() + comment._set_xml_writer(self._filename("xl/comments" + str(index) + ".xml")) + comment._assemble_xml_file(worksheet.comments_list) + index += 1 + + def _write_shared_strings_file(self): + # Write the sharedStrings.xml file. + sst = SharedStrings() + sst.string_table = self.workbook.str_table + + if not self.workbook.str_table.count: + return + + sst._set_xml_writer(self._filename("xl/sharedStrings.xml")) + sst._assemble_xml_file() + + def _write_app_file(self): + # Write the app.xml file. + properties = self.workbook.doc_properties + app = App() + + # Add the Worksheet heading pairs. + app._add_heading_pair(["Worksheets", self.worksheet_count]) + + # Add the Chartsheet heading pairs. + app._add_heading_pair(["Charts", self.chartsheet_count]) + + # Add the Worksheet parts. + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + continue + app._add_part_name(worksheet.name) + + # Add the Chartsheet parts. + for worksheet in self.workbook.worksheets(): + if not worksheet.is_chartsheet: + continue + app._add_part_name(worksheet.name) + + # Add the Named Range heading pairs. + if self.named_ranges: + app._add_heading_pair(["Named Ranges", len(self.named_ranges)]) + + # Add the Named Ranges parts. + for named_range in self.named_ranges: + app._add_part_name(named_range) + + app._set_properties(properties) + app.doc_security = self.workbook.read_only + + app._set_xml_writer(self._filename("docProps/app.xml")) + app._assemble_xml_file() + + def _write_core_file(self): + # Write the core.xml file. + properties = self.workbook.doc_properties + core = Core() + + core._set_properties(properties) + core._set_xml_writer(self._filename("docProps/core.xml")) + core._assemble_xml_file() + + def _write_metadata_file(self): + # Write the metadata.xml file. + if not self.workbook.has_metadata: + return + + metadata = Metadata() + metadata._set_xml_writer(self._filename("xl/metadata.xml")) + metadata._assemble_xml_file() + + def _write_custom_file(self): + # Write the custom.xml file. + properties = self.workbook.custom_properties + custom = Custom() + + if not len(properties): + return + + custom._set_properties(properties) + custom._set_xml_writer(self._filename("docProps/custom.xml")) + custom._assemble_xml_file() + + def _write_content_types_file(self): + # Write the ContentTypes.xml file. + content = ContentTypes() + content._add_image_types(self.workbook.image_types) + + self._get_table_count() + + worksheet_index = 1 + chartsheet_index = 1 + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + content._add_chartsheet_name("sheet" + str(chartsheet_index)) + chartsheet_index += 1 + else: + content._add_worksheet_name("sheet" + str(worksheet_index)) + worksheet_index += 1 + + for i in range(1, self.chart_count + 1): + content._add_chart_name("chart" + str(i)) + + for i in range(1, self.drawing_count + 1): + content._add_drawing_name("drawing" + str(i)) + + if self.num_vml_files: + content._add_vml_name() + + for i in range(1, self.table_count + 1): + content._add_table_name("table" + str(i)) + + for i in range(1, self.num_comment_files + 1): + content._add_comment_name("comments" + str(i)) + + # Add the sharedString rel if there is string data in the workbook. + if self.workbook.str_table.count: + content._add_shared_strings() + + # Add vbaProject if present. + if self.workbook.vba_project: + content._add_vba_project() + + # Add the custom properties if present. + if self.workbook.custom_properties: + content._add_custom_properties() + + # Add the metadata file if present. + if self.workbook.has_metadata: + content._add_metadata() + + content._set_xml_writer(self._filename("[Content_Types].xml")) + content._assemble_xml_file() + + def _write_styles_file(self): + # Write the style xml file. + xf_formats = self.workbook.xf_formats + palette = self.workbook.palette + font_count = self.workbook.font_count + num_formats = self.workbook.num_formats + border_count = self.workbook.border_count + fill_count = self.workbook.fill_count + custom_colors = self.workbook.custom_colors + dxf_formats = self.workbook.dxf_formats + has_comments = self.workbook.has_comments + + styles = Styles() + styles._set_style_properties( + [ + xf_formats, + palette, + font_count, + num_formats, + border_count, + fill_count, + custom_colors, + dxf_formats, + has_comments, + ] + ) + + styles._set_xml_writer(self._filename("xl/styles.xml")) + styles._assemble_xml_file() + + def _write_theme_file(self): + # Write the theme xml file. + theme = Theme() + + theme._set_xml_writer(self._filename("xl/theme/theme1.xml")) + theme._assemble_xml_file() + + def _write_table_files(self): + # Write the table files. + index = 1 + for worksheet in self.workbook.worksheets(): + table_props = worksheet.tables + + if not table_props: + continue + + for table_props in table_props: + table = Table() + table._set_xml_writer( + self._filename("xl/tables/table" + str(index) + ".xml") + ) + table._set_properties(table_props) + table._assemble_xml_file() + index += 1 + + def _get_table_count(self): + # Count the table files. Required for the [Content_Types] file. + for worksheet in self.workbook.worksheets(): + for _ in worksheet.tables: + self.table_count += 1 + + def _write_root_rels_file(self): + # Write the _rels/.rels xml file. + rels = Relationships() + + rels._add_document_relationship("/officeDocument", "xl/workbook.xml") + + rels._add_package_relationship("/metadata/core-properties", "docProps/core.xml") + + rels._add_document_relationship("/extended-properties", "docProps/app.xml") + + if self.workbook.custom_properties: + rels._add_document_relationship("/custom-properties", "docProps/custom.xml") + + rels._set_xml_writer(self._filename("_rels/.rels")) + + rels._assemble_xml_file() + + def _write_workbook_rels_file(self): + # Write the _rels/.rels xml file. + rels = Relationships() + + worksheet_index = 1 + chartsheet_index = 1 + + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + rels._add_document_relationship( + "/chartsheet", "chartsheets/sheet" + str(chartsheet_index) + ".xml" + ) + chartsheet_index += 1 + else: + rels._add_document_relationship( + "/worksheet", "worksheets/sheet" + str(worksheet_index) + ".xml" + ) + worksheet_index += 1 + + rels._add_document_relationship("/theme", "theme/theme1.xml") + rels._add_document_relationship("/styles", "styles.xml") + + # Add the sharedString rel if there is string data in the workbook. + if self.workbook.str_table.count: + rels._add_document_relationship("/sharedStrings", "sharedStrings.xml") + + # Add vbaProject if present. + if self.workbook.vba_project: + rels._add_ms_package_relationship("/vbaProject", "vbaProject.bin") + + # Add the metadata file if required. + if self.workbook.has_metadata: + rels._add_document_relationship("/sheetMetadata", "metadata.xml") + + rels._set_xml_writer(self._filename("xl/_rels/workbook.xml.rels")) + rels._assemble_xml_file() + + def _write_worksheet_rels_files(self): + # Write data such as hyperlinks or drawings. + index = 0 + for worksheet in self.workbook.worksheets(): + if worksheet.is_chartsheet: + continue + + index += 1 + + external_links = ( + worksheet.external_hyper_links + + worksheet.external_drawing_links + + worksheet.external_vml_links + + worksheet.external_background_links + + worksheet.external_table_links + + worksheet.external_comment_links + ) + + if not external_links: + continue + + # Create the worksheet .rels dirs. + rels = Relationships() + + for link_data in external_links: + rels._add_document_relationship(*link_data) + + # Create .rels file such as /xl/worksheets/_rels/sheet1.xml.rels. + rels._set_xml_writer( + self._filename("xl/worksheets/_rels/sheet" + str(index) + ".xml.rels") + ) + rels._assemble_xml_file() + + def _write_chartsheet_rels_files(self): + # Write the chartsheet .rels files for links to drawing files. + index = 0 + for worksheet in self.workbook.worksheets(): + if not worksheet.is_chartsheet: + continue + + index += 1 + + external_links = worksheet.external_drawing_links + + if not external_links: + continue + + # Create the chartsheet .rels xlsx_dir. + rels = Relationships() + + for link_data in external_links: + rels._add_document_relationship(*link_data) + + # Create .rels file such as /xl/chartsheets/_rels/sheet1.xml.rels. + rels._set_xml_writer( + self._filename("xl/chartsheets/_rels/sheet" + str(index) + ".xml.rels") + ) + rels._assemble_xml_file() + + def _write_drawing_rels_files(self): + # Write the drawing .rels files for worksheets with charts or drawings. + index = 0 + for worksheet in self.workbook.worksheets(): + if worksheet.drawing: + index += 1 + + if not worksheet.drawing_links: + continue + + # Create the drawing .rels xlsx_dir. + rels = Relationships() + + for drawing_data in worksheet.drawing_links: + rels._add_document_relationship(*drawing_data) + + # Create .rels file such as /xl/drawings/_rels/sheet1.xml.rels. + rels._set_xml_writer( + self._filename("xl/drawings/_rels/drawing" + str(index) + ".xml.rels") + ) + rels._assemble_xml_file() + + def _write_vml_drawing_rels_file(self, worksheet, index): + # Write the vmlDdrawing .rels files for worksheets with images in + # headers or footers. + + # Create the drawing .rels dir. + rels = Relationships() + + for drawing_data in worksheet.vml_drawing_links: + rels._add_document_relationship(*drawing_data) + + # Create .rels file such as /xl/drawings/_rels/vmlDrawing1.vml.rels. + rels._set_xml_writer( + self._filename("xl/drawings/_rels/vmlDrawing" + str(index) + ".vml.rels") + ) + rels._assemble_xml_file() + + def _add_image_files(self): + # Write the /xl/media/image?.xml files. + workbook = self.workbook + index = 1 + + for image in workbook.images: + filename = image[0] + ext = "." + image[1] + image_data = image[2] + + xml_image_name = "xl/media/image" + str(index) + ext + + if not self.in_memory: + # In file mode we just write or copy the image file. + os_filename = self._filename(xml_image_name) + + if image_data: + # The data is in a byte stream. Write it to the target. + os_file = open(os_filename, mode="wb") + os_file.write(image_data.getvalue()) + os_file.close() + else: + copy(filename, os_filename) + + # Allow copies of Windows read-only images to be deleted. + try: + os.chmod( + os_filename, os.stat(os_filename).st_mode | stat.S_IWRITE + ) + except OSError: + pass + else: + # For in-memory mode we read the image into a stream. + if image_data: + # The data is already in a byte stream. + os_filename = image_data + else: + image_file = open(filename, mode="rb") + image_data = image_file.read() + os_filename = BytesIO(image_data) + image_file.close() + + self.filenames.append((os_filename, xml_image_name, True)) + + index += 1 + + def _add_vba_project(self): + # Copy in a vbaProject.bin file. + vba_project = self.workbook.vba_project + vba_is_stream = self.workbook.vba_is_stream + + if not vba_project: + return + + xml_vba_name = "xl/vbaProject.bin" + + if not self.in_memory: + # In file mode we just write or copy the VBA file. + os_filename = self._filename(xml_vba_name) + + if vba_is_stream: + # The data is in a byte stream. Write it to the target. + os_file = open(os_filename, mode="wb") + os_file.write(vba_project.getvalue()) + os_file.close() + else: + copy(vba_project, os_filename) + + else: + # For in-memory mode we read the vba into a stream. + if vba_is_stream: + # The data is already in a byte stream. + os_filename = vba_project + else: + vba_file = open(vba_project, mode="rb") + vba_data = vba_file.read() + os_filename = BytesIO(vba_data) + vba_file.close() + + self.filenames.append((os_filename, xml_vba_name, True)) diff --git a/xlsxwriter/python/xlsxwriter/relationships.py b/xlsxwriter/python/xlsxwriter/relationships.py new file mode 100644 index 0000000..0db069e --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/relationships.py @@ -0,0 +1,115 @@ +############################################################################### +# +# Relationships - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + +# Long namespace strings used in the class. +schema_root = "http://schemas.openxmlformats.org" +package_schema = schema_root + "/package/2006/relationships" +document_schema = schema_root + "/officeDocument/2006/relationships" + + +class Relationships(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Relationships file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Relationships, self).__init__() + + self.relationships = [] + self.id = 1 + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_relationships() + + # Close the file. + self._xml_close() + + def _add_document_relationship(self, rel_type, target, target_mode=None): + # Add container relationship to XLSX .rels xml files. + rel_type = document_schema + rel_type + + self.relationships.append((rel_type, target, target_mode)) + + def _add_package_relationship(self, rel_type, target): + # Add container relationship to XLSX .rels xml files. + rel_type = package_schema + rel_type + + self.relationships.append((rel_type, target, None)) + + def _add_ms_package_relationship(self, rel_type, target): + # Add container relationship to XLSX .rels xml files. Uses MS schema. + schema = "http://schemas.microsoft.com/office/2006/relationships" + rel_type = schema + rel_type + + self.relationships.append((rel_type, target, None)) + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_relationships(self): + # Write the element. + attributes = [ + ( + "xmlns", + package_schema, + ) + ] + + self._xml_start_tag("Relationships", attributes) + + for relationship in self.relationships: + self._write_relationship(relationship) + + self._xml_end_tag("Relationships") + + def _write_relationship(self, relationship): + # Write the element. + rel_type, target, target_mode = relationship + + attributes = [ + ("Id", "rId" + str(self.id)), + ("Type", rel_type), + ("Target", target), + ] + + self.id += 1 + + if target_mode: + attributes.append(("TargetMode", target_mode)) + + self._xml_empty_tag("Relationship", attributes) diff --git a/xlsxwriter/python/xlsxwriter/shape.py b/xlsxwriter/python/xlsxwriter/shape.py new file mode 100644 index 0000000..fd265cd --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/shape.py @@ -0,0 +1,414 @@ +############################################################################### +# +# Shape - A class for to represent Excel XLSX shape objects. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import copy +from warnings import warn + + +class Shape(object): + """ + A class for to represent Excel XLSX shape objects. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self, shape_type, name, options): + """ + Constructor. + + """ + super(Shape, self).__init__() + self.name = name + self.shape_type = shape_type + self.connect = 0 + self.drawing = 0 + self.edit_as = "" + self.id = 0 + self.text = "" + self.textlink = "" + self.stencil = 1 + self.element = -1 + self.start = None + self.start_index = None + self.end = None + self.end_index = None + self.adjustments = [] + self.start_side = "" + self.end_side = "" + self.flip_h = 0 + self.flip_v = 0 + self.rotation = 0 + self.text_rotation = 0 + self.textbox = False + + self.align = None + self.fill = None + self.font = None + self.format = None + self.line = None + self.url_rel_index = None + self.tip = None + + self._set_options(options) + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _set_options(self, options): + self.align = self._get_align_properties(options.get("align")) + self.fill = self._get_fill_properties(options.get("fill")) + self.font = self._get_font_properties(options.get("font")) + self.gradient = self._get_gradient_properties(options.get("gradient")) + self.line = self._get_line_properties(options.get("line")) + + self.text_rotation = options.get("text_rotation", 0) + + self.textlink = options.get("textlink", "") + if self.textlink.startswith("="): + self.textlink = self.textlink.lstrip("=") + + if options.get("border"): + self.line = self._get_line_properties(options["border"]) + + # Gradient fill overrides solid fill. + if self.gradient: + self.fill = None + + ########################################################################### + # + # Static methods for processing chart/shape style properties. + # + ########################################################################### + + @staticmethod + def _get_line_properties(line): + # Convert user line properties to the structure required internally. + + if not line: + return {"defined": False} + + # Copy the user defined properties since they will be modified. + line = copy.deepcopy(line) + + dash_types = { + "solid": "solid", + "round_dot": "sysDot", + "square_dot": "sysDash", + "dash": "dash", + "dash_dot": "dashDot", + "long_dash": "lgDash", + "long_dash_dot": "lgDashDot", + "long_dash_dot_dot": "lgDashDotDot", + "dot": "dot", + "system_dash_dot": "sysDashDot", + "system_dash_dot_dot": "sysDashDotDot", + } + + # Check the dash type. + dash_type = line.get("dash_type") + + if dash_type is not None: + if dash_type in dash_types: + line["dash_type"] = dash_types[dash_type] + else: + warn("Unknown dash type '%s'" % dash_type) + return + + line["defined"] = True + + return line + + @staticmethod + def _get_fill_properties(fill): + # Convert user fill properties to the structure required internally. + + if not fill: + return {"defined": False} + + # Copy the user defined properties since they will be modified. + fill = copy.deepcopy(fill) + + fill["defined"] = True + + return fill + + @staticmethod + def _get_pattern_properties(pattern): + # Convert user defined pattern to the structure required internally. + + if not pattern: + return + + # Copy the user defined properties since they will be modified. + pattern = copy.deepcopy(pattern) + + if not pattern.get("pattern"): + warn("Pattern must include 'pattern'") + return + + if not pattern.get("fg_color"): + warn("Pattern must include 'fg_color'") + return + + types = { + "percent_5": "pct5", + "percent_10": "pct10", + "percent_20": "pct20", + "percent_25": "pct25", + "percent_30": "pct30", + "percent_40": "pct40", + "percent_50": "pct50", + "percent_60": "pct60", + "percent_70": "pct70", + "percent_75": "pct75", + "percent_80": "pct80", + "percent_90": "pct90", + "light_downward_diagonal": "ltDnDiag", + "light_upward_diagonal": "ltUpDiag", + "dark_downward_diagonal": "dkDnDiag", + "dark_upward_diagonal": "dkUpDiag", + "wide_downward_diagonal": "wdDnDiag", + "wide_upward_diagonal": "wdUpDiag", + "light_vertical": "ltVert", + "light_horizontal": "ltHorz", + "narrow_vertical": "narVert", + "narrow_horizontal": "narHorz", + "dark_vertical": "dkVert", + "dark_horizontal": "dkHorz", + "dashed_downward_diagonal": "dashDnDiag", + "dashed_upward_diagonal": "dashUpDiag", + "dashed_horizontal": "dashHorz", + "dashed_vertical": "dashVert", + "small_confetti": "smConfetti", + "large_confetti": "lgConfetti", + "zigzag": "zigZag", + "wave": "wave", + "diagonal_brick": "diagBrick", + "horizontal_brick": "horzBrick", + "weave": "weave", + "plaid": "plaid", + "divot": "divot", + "dotted_grid": "dotGrid", + "dotted_diamond": "dotDmnd", + "shingle": "shingle", + "trellis": "trellis", + "sphere": "sphere", + "small_grid": "smGrid", + "large_grid": "lgGrid", + "small_check": "smCheck", + "large_check": "lgCheck", + "outlined_diamond": "openDmnd", + "solid_diamond": "solidDmnd", + } + + # Check for valid types. + if pattern["pattern"] not in types: + warn("unknown pattern type '%s'" % pattern["pattern"]) + return + else: + pattern["pattern"] = types[pattern["pattern"]] + + # Specify a default background color. + pattern["bg_color"] = pattern.get("bg_color", "#FFFFFF") + + return pattern + + @staticmethod + def _get_gradient_properties(gradient): + # Convert user defined gradient to the structure required internally. + + if not gradient: + return + + # Copy the user defined properties since they will be modified. + gradient = copy.deepcopy(gradient) + + types = { + "linear": "linear", + "radial": "circle", + "rectangular": "rect", + "path": "shape", + } + + # Check the colors array exists and is valid. + if "colors" not in gradient or type(gradient["colors"]) != list: + warn("Gradient must include colors list") + return + + # Check the colors array has the required number of entries. + if not 2 <= len(gradient["colors"]) <= 10: + warn("Gradient colors list must at least 2 values and not more than 10") + return + + if "positions" in gradient: + # Check the positions array has the right number of entries. + if len(gradient["positions"]) != len(gradient["colors"]): + warn("Gradient positions not equal to number of colors") + return + + # Check the positions are in the correct range. + for pos in gradient["positions"]: + if not 0 <= pos <= 100: + warn("Gradient position must be in the range 0 <= position <= 100") + return + else: + # Use the default gradient positions. + if len(gradient["colors"]) == 2: + gradient["positions"] = [0, 100] + + elif len(gradient["colors"]) == 3: + gradient["positions"] = [0, 50, 100] + + elif len(gradient["colors"]) == 4: + gradient["positions"] = [0, 33, 66, 100] + + else: + warn("Must specify gradient positions") + return + + angle = gradient.get("angle") + if angle: + if not 0 <= angle < 360: + warn("Gradient angle must be in the range 0 <= angle < 360") + return + else: + gradient["angle"] = 90 + + # Check for valid types. + gradient_type = gradient.get("type") + + if gradient_type is not None: + if gradient_type in types: + gradient["type"] = types[gradient_type] + else: + warn("Unknown gradient type '%s" % gradient_type) + return + else: + gradient["type"] = "linear" + + return gradient + + @staticmethod + def _get_font_properties(options): + # Convert user defined font values into private dict values. + if options is None: + options = {} + + font = { + "name": options.get("name"), + "color": options.get("color"), + "size": options.get("size", 11), + "bold": options.get("bold"), + "italic": options.get("italic"), + "underline": options.get("underline"), + "pitch_family": options.get("pitch_family"), + "charset": options.get("charset"), + "baseline": options.get("baseline", -1), + "lang": options.get("lang", "en-US"), + } + + # Convert font size units. + if font["size"]: + font["size"] = int(font["size"] * 100) + + return font + + @staticmethod + def _get_font_style_attributes(font): + # _get_font_style_attributes. + attributes = [] + + if not font: + return attributes + + if font.get("size"): + attributes.append(("sz", font["size"])) + + if font.get("bold") is not None: + attributes.append(("b", 0 + font["bold"])) + + if font.get("italic") is not None: + attributes.append(("i", 0 + font["italic"])) + + if font.get("underline") is not None: + attributes.append(("u", "sng")) + + if font.get("baseline") != -1: + attributes.append(("baseline", font["baseline"])) + + return attributes + + @staticmethod + def _get_font_latin_attributes(font): + # _get_font_latin_attributes. + attributes = [] + + if not font: + return attributes + + if font["name"] is not None: + attributes.append(("typeface", font["name"])) + + if font["pitch_family"] is not None: + attributes.append(("pitchFamily", font["pitch_family"])) + + if font["charset"] is not None: + attributes.append(("charset", font["charset"])) + + return attributes + + @staticmethod + def _get_align_properties(align): + # Convert user defined align to the structure required internally. + if not align: + return {"defined": False} + + # Copy the user defined properties since they will be modified. + align = copy.deepcopy(align) + + if "vertical" in align: + align_type = align["vertical"] + + align_types = { + "top": "top", + "middle": "middle", + "bottom": "bottom", + } + + if align_type in align_types: + align["vertical"] = align_types[align_type] + else: + warn("Unknown alignment type '%s'" % align_type) + return {"defined": False} + + if "horizontal" in align: + align_type = align["horizontal"] + + align_types = { + "left": "left", + "center": "center", + "right": "right", + } + + if align_type in align_types: + align["horizontal"] = align_types[align_type] + else: + warn("Unknown alignment type '%s'" % align_type) + return {"defined": False} + + align["defined"] = True + + return align diff --git a/xlsxwriter/python/xlsxwriter/sharedstrings.py b/xlsxwriter/python/xlsxwriter/sharedstrings.py new file mode 100644 index 0000000..fc881ef --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/sharedstrings.py @@ -0,0 +1,158 @@ +############################################################################### +# +# SharedStrings - A class for writing the Excel XLSX sharedStrings file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import re + +# Package imports. +from . import xmlwriter +from .utility import preserve_whitespace + +# Compile performance critical regular expressions. +re_control_chars_1 = re.compile("(_x[0-9a-fA-F]{4}_)") +re_control_chars_2 = re.compile(r"([\x00-\x08\x0b-\x1f])") + + +class SharedStrings(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX sharedStrings file. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(SharedStrings, self).__init__() + + self.string_table = None + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the sst element. + self._write_sst() + + # Write the sst strings. + self._write_sst_strings() + + # Close the sst tag. + self._xml_end_tag("sst") + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_sst(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + + attributes = [ + ("xmlns", xmlns), + ("count", self.string_table.count), + ("uniqueCount", self.string_table.unique_count), + ] + + self._xml_start_tag("sst", attributes) + + def _write_sst_strings(self): + # Write the sst string elements. + + for string in self.string_table.string_array: + self._write_si(string) + + def _write_si(self, string): + # Write the element. + attributes = [] + + # Excel escapes control characters with _xHHHH_ and also escapes any + # literal strings of that type by encoding the leading underscore. + # So "\0" -> _x0000_ and "_x0000_" -> _x005F_x0000_. + # The following substitutions deal with those cases. + + # Escape the escape. + string = re_control_chars_1.sub(r"_x005F\1", string) + + # Convert control character to the _xHHHH_ escape. + string = re_control_chars_2.sub( + lambda match: "_x%04X_" % ord(match.group(1)), string + ) + + # Escapes non characters in strings. + string = string.replace("\uFFFE", "_xFFFE_") + string = string.replace("\uFFFF", "_xFFFF_") + + # Add attribute to preserve leading or trailing whitespace. + if preserve_whitespace(string): + attributes.append(("xml:space", "preserve")) + + # Write any rich strings without further tags. + if string.startswith("") and string.endswith(""): + self._xml_rich_si_element(string) + else: + self._xml_si_element(string, attributes) + + +# A metadata class to store Excel strings between worksheets. +class SharedStringTable(object): + """ + A class to track Excel shared strings between worksheets. + + """ + + def __init__(self): + self.count = 0 + self.unique_count = 0 + self.string_table = {} + self.string_array = [] + + def _get_shared_string_index(self, string): + """ " Get the index of the string in the Shared String table.""" + if string not in self.string_table: + # String isn't already stored in the table so add it. + index = self.unique_count + self.string_table[string] = index + self.count += 1 + self.unique_count += 1 + return index + else: + # String exists in the table. + index = self.string_table[string] + self.count += 1 + return index + + def _get_shared_string(self, index): + """ " Get a shared string from the index.""" + return self.string_array[index] + + def _sort_string_data(self): + """ " Sort the shared string data and convert from dict to list.""" + self.string_array = sorted(self.string_table, key=self.string_table.__getitem__) + self.string_table = {} diff --git a/xlsxwriter/python/xlsxwriter/styles.py b/xlsxwriter/python/xlsxwriter/styles.py new file mode 100644 index 0000000..b79c781 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/styles.py @@ -0,0 +1,754 @@ +############################################################################### +# +# Styles - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class Styles(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Styles file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Styles, self).__init__() + + self.xf_formats = [] + self.palette = [] + self.font_count = 0 + self.num_formats = [] + self.border_count = 0 + self.fill_count = 0 + self.custom_colors = [] + self.dxf_formats = [] + self.has_hyperlink = False + self.hyperlink_font_id = 0 + self.has_comments = False + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Add the style sheet. + self._write_style_sheet() + + # Write the number formats. + self._write_num_fmts() + + # Write the fonts. + self._write_fonts() + + # Write the fills. + self._write_fills() + + # Write the borders element. + self._write_borders() + + # Write the cellStyleXfs element. + self._write_cell_style_xfs() + + # Write the cellXfs element. + self._write_cell_xfs() + + # Write the cellStyles element. + self._write_cell_styles() + + # Write the dxfs element. + self._write_dxfs() + + # Write the tableStyles element. + self._write_table_styles() + + # Write the colors element. + self._write_colors() + + # Close the style sheet tag. + self._xml_end_tag("styleSheet") + + # Close the file. + self._xml_close() + + def _set_style_properties(self, properties): + # Pass in the Format objects and other properties used in the styles. + + self.xf_formats = properties[0] + self.palette = properties[1] + self.font_count = properties[2] + self.num_formats = properties[3] + self.border_count = properties[4] + self.fill_count = properties[5] + self.custom_colors = properties[6] + self.dxf_formats = properties[7] + self.has_comments = properties[8] + + def _get_palette_color(self, color): + # Special handling for automatic color. + if color == "Automatic": + return color + + # Convert the RGB color. + if color[0] == "#": + color = color[1:] + + return "FF" + color.upper() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_style_sheet(self): + # Write the element. + xmlns = "http://schemas.openxmlformats.org/spreadsheetml/2006/main" + + attributes = [("xmlns", xmlns)] + self._xml_start_tag("styleSheet", attributes) + + def _write_num_fmts(self): + # Write the element. + if not self.num_formats: + return + + attributes = [("count", len(self.num_formats))] + self._xml_start_tag("numFmts", attributes) + + # Write the numFmts elements. + for index, num_format in enumerate(self.num_formats, 164): + self._write_num_fmt(index, num_format) + + self._xml_end_tag("numFmts") + + def _write_num_fmt(self, num_fmt_id, format_code): + # Write the element. + format_codes = { + 0: "General", + 1: "0", + 2: "0.00", + 3: "#,##0", + 4: "#,##0.00", + 5: "($#,##0_);($#,##0)", + 6: "($#,##0_);[Red]($#,##0)", + 7: "($#,##0.00_);($#,##0.00)", + 8: "($#,##0.00_);[Red]($#,##0.00)", + 9: "0%", + 10: "0.00%", + 11: "0.00E+00", + 12: "# ?/?", + 13: "# ??/??", + 14: "m/d/yy", + 15: "d-mmm-yy", + 16: "d-mmm", + 17: "mmm-yy", + 18: "h:mm AM/PM", + 19: "h:mm:ss AM/PM", + 20: "h:mm", + 21: "h:mm:ss", + 22: "m/d/yy h:mm", + 37: "(#,##0_);(#,##0)", + 38: "(#,##0_);[Red](#,##0)", + 39: "(#,##0.00_);(#,##0.00)", + 40: "(#,##0.00_);[Red](#,##0.00)", + 41: '_(* #,##0_);_(* (#,##0);_(* "-"_);_(_)', + 42: '_($* #,##0_);_($* (#,##0);_($* "-"_);_(_)', + 43: '_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(_)', + 44: '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(_)', + 45: "mm:ss", + 46: "[h]:mm:ss", + 47: "mm:ss.0", + 48: "##0.0E+0", + 49: "@", + } + + # Set the format code for built-in number formats. + if num_fmt_id < 164: + if num_fmt_id in format_codes: + format_code = format_codes[num_fmt_id] + else: + format_code = "General" + + attributes = [ + ("numFmtId", num_fmt_id), + ("formatCode", format_code), + ] + + self._xml_empty_tag("numFmt", attributes) + + def _write_fonts(self): + # Write the element. + if self.has_comments: + # Add extra font for comments. + attributes = [("count", self.font_count + 1)] + else: + attributes = [("count", self.font_count)] + + self._xml_start_tag("fonts", attributes) + + # Write the font elements for xf_format objects that have them. + for xf_format in self.xf_formats: + if xf_format.has_font: + self._write_font(xf_format) + + if self.has_comments: + self._write_comment_font() + + self._xml_end_tag("fonts") + + def _write_font(self, xf_format, is_dxf_format=False): + # Write the element. + self._xml_start_tag("font") + + # The condense and extend elements are mainly used in dxf formats. + if xf_format.font_condense: + self._write_condense() + + if xf_format.font_extend: + self._write_extend() + + if xf_format.bold: + self._xml_empty_tag("b") + + if xf_format.italic: + self._xml_empty_tag("i") + + if xf_format.font_strikeout: + self._xml_empty_tag("strike") + + if xf_format.font_outline: + self._xml_empty_tag("outline") + + if xf_format.font_shadow: + self._xml_empty_tag("shadow") + + # Handle the underline variants. + if xf_format.underline: + self._write_underline(xf_format.underline) + + if xf_format.font_script == 1: + self._write_vert_align("superscript") + + if xf_format.font_script == 2: + self._write_vert_align("subscript") + + if not is_dxf_format: + self._xml_empty_tag("sz", [("val", xf_format.font_size)]) + + if xf_format.theme == -1: + # Ignore for excel2003_style. + pass + elif xf_format.theme: + self._write_color("theme", xf_format.theme) + elif xf_format.color_indexed: + self._write_color("indexed", xf_format.color_indexed) + elif xf_format.font_color: + color = self._get_palette_color(xf_format.font_color) + if color != "Automatic": + self._write_color("rgb", color) + elif not is_dxf_format: + self._write_color("theme", 1) + + if not is_dxf_format: + self._xml_empty_tag("name", [("val", xf_format.font_name)]) + + if xf_format.font_family: + self._xml_empty_tag("family", [("val", xf_format.font_family)]) + + if xf_format.font_charset: + self._xml_empty_tag("charset", [("val", xf_format.font_charset)]) + + if xf_format.font_name == "Calibri" and not xf_format.hyperlink: + self._xml_empty_tag("scheme", [("val", xf_format.font_scheme)]) + + if xf_format.hyperlink: + self.has_hyperlink = True + if self.hyperlink_font_id == 0: + self.hyperlink_font_id = xf_format.font_index + + self._xml_end_tag("font") + + def _write_comment_font(self): + # Write the element for comments. + self._xml_start_tag("font") + + self._xml_empty_tag("sz", [("val", 8)]) + self._write_color("indexed", 81) + self._xml_empty_tag("name", [("val", "Tahoma")]) + self._xml_empty_tag("family", [("val", 2)]) + + self._xml_end_tag("font") + + def _write_underline(self, underline): + # Write the underline font element. + + if underline == 2: + attributes = [("val", "double")] + elif underline == 33: + attributes = [("val", "singleAccounting")] + elif underline == 34: + attributes = [("val", "doubleAccounting")] + else: + # Default to single underline. + attributes = [] + + self._xml_empty_tag("u", attributes) + + def _write_vert_align(self, val): + # Write the font sub-element. + attributes = [("val", val)] + + self._xml_empty_tag("vertAlign", attributes) + + def _write_color(self, name, value): + # Write the element. + attributes = [(name, value)] + + self._xml_empty_tag("color", attributes) + + def _write_fills(self): + # Write the element. + attributes = [("count", self.fill_count)] + + self._xml_start_tag("fills", attributes) + + # Write the default fill element. + self._write_default_fill("none") + self._write_default_fill("gray125") + + # Write the fill elements for xf_format objects that have them. + for xf_format in self.xf_formats: + if xf_format.has_fill: + self._write_fill(xf_format) + + self._xml_end_tag("fills") + + def _write_default_fill(self, pattern_type): + # Write the element for the default fills. + self._xml_start_tag("fill") + self._xml_empty_tag("patternFill", [("patternType", pattern_type)]) + self._xml_end_tag("fill") + + def _write_fill(self, xf_format, is_dxf_format=False): + # Write the element. + pattern = xf_format.pattern + bg_color = xf_format.bg_color + fg_color = xf_format.fg_color + + # Colors for dxf formats are handled differently from normal formats + # since the normal xf_format reverses the meaning of BG and FG for + # solid fills. + if is_dxf_format: + bg_color = xf_format.dxf_bg_color + fg_color = xf_format.dxf_fg_color + + patterns = ( + "none", + "solid", + "mediumGray", + "darkGray", + "lightGray", + "darkHorizontal", + "darkVertical", + "darkDown", + "darkUp", + "darkGrid", + "darkTrellis", + "lightHorizontal", + "lightVertical", + "lightDown", + "lightUp", + "lightGrid", + "lightTrellis", + "gray125", + "gray0625", + ) + + # Special handling for pattern only case. + if not fg_color and not bg_color and patterns[pattern]: + self._write_default_fill(patterns[pattern]) + return + + self._xml_start_tag("fill") + + # The "none" pattern is handled differently for dxf formats. + if is_dxf_format and pattern <= 1: + self._xml_start_tag("patternFill") + else: + self._xml_start_tag("patternFill", [("patternType", patterns[pattern])]) + + if fg_color: + fg_color = self._get_palette_color(fg_color) + if fg_color != "Automatic": + self._xml_empty_tag("fgColor", [("rgb", fg_color)]) + + if bg_color: + bg_color = self._get_palette_color(bg_color) + if bg_color != "Automatic": + self._xml_empty_tag("bgColor", [("rgb", bg_color)]) + else: + if not is_dxf_format and pattern <= 1: + self._xml_empty_tag("bgColor", [("indexed", 64)]) + + self._xml_end_tag("patternFill") + self._xml_end_tag("fill") + + def _write_borders(self): + # Write the element. + attributes = [("count", self.border_count)] + + self._xml_start_tag("borders", attributes) + + # Write the border elements for xf_format objects that have them. + for xf_format in self.xf_formats: + if xf_format.has_border: + self._write_border(xf_format) + + self._xml_end_tag("borders") + + def _write_border(self, xf_format, is_dxf_format=False): + # Write the element. + attributes = [] + + # Diagonal borders add attributes to the element. + if xf_format.diag_type == 1: + attributes.append(("diagonalUp", 1)) + elif xf_format.diag_type == 2: + attributes.append(("diagonalDown", 1)) + elif xf_format.diag_type == 3: + attributes.append(("diagonalUp", 1)) + attributes.append(("diagonalDown", 1)) + + # Ensure that a default diag border is set if the diag type is set. + if xf_format.diag_type and not xf_format.diag_border: + xf_format.diag_border = 1 + + # Write the start border tag. + self._xml_start_tag("border", attributes) + + # Write the sub elements. + self._write_sub_border("left", xf_format.left, xf_format.left_color) + + self._write_sub_border("right", xf_format.right, xf_format.right_color) + + self._write_sub_border("top", xf_format.top, xf_format.top_color) + + self._write_sub_border("bottom", xf_format.bottom, xf_format.bottom_color) + + # Condition DXF formats don't allow diagonal borders. + if not is_dxf_format: + self._write_sub_border( + "diagonal", xf_format.diag_border, xf_format.diag_color + ) + + if is_dxf_format: + self._write_sub_border("vertical", None, None) + self._write_sub_border("horizontal", None, None) + + self._xml_end_tag("border") + + def _write_sub_border(self, border_type, style, color): + # Write the sub elements such as , , etc. + attributes = [] + + if not style: + self._xml_empty_tag(border_type) + return + + border_styles = ( + "none", + "thin", + "medium", + "dashed", + "dotted", + "thick", + "double", + "hair", + "mediumDashed", + "dashDot", + "mediumDashDot", + "dashDotDot", + "mediumDashDotDot", + "slantDashDot", + ) + + attributes.append(("style", border_styles[style])) + + self._xml_start_tag(border_type, attributes) + + if color and color != "Automatic": + color = self._get_palette_color(color) + self._xml_empty_tag("color", [("rgb", color)]) + else: + self._xml_empty_tag("color", [("auto", 1)]) + + self._xml_end_tag(border_type) + + def _write_cell_style_xfs(self): + # Write the element. + count = 1 + + if self.has_hyperlink: + count = 2 + + attributes = [("count", count)] + + self._xml_start_tag("cellStyleXfs", attributes) + self._write_style_xf() + + if self.has_hyperlink: + self._write_style_xf(True, self.hyperlink_font_id) + + self._xml_end_tag("cellStyleXfs") + + def _write_cell_xfs(self): + # Write the element. + formats = self.xf_formats + + # Workaround for when the last xf_format is used for the comment font + # and shouldn't be used for cellXfs. + last_format = formats[-1] + if last_format.font_only: + formats.pop() + + attributes = [("count", len(formats))] + self._xml_start_tag("cellXfs", attributes) + + # Write the xf elements. + for xf_format in formats: + self._write_xf(xf_format) + + self._xml_end_tag("cellXfs") + + def _write_style_xf(self, has_hyperlink=False, font_id=0): + # Write the style element. + num_fmt_id = 0 + fill_id = 0 + border_id = 0 + + attributes = [ + ("numFmtId", num_fmt_id), + ("fontId", font_id), + ("fillId", fill_id), + ("borderId", border_id), + ] + + if has_hyperlink: + attributes.append(("applyNumberFormat", 0)) + attributes.append(("applyFill", 0)) + attributes.append(("applyBorder", 0)) + attributes.append(("applyAlignment", 0)) + attributes.append(("applyProtection", 0)) + + self._xml_start_tag("xf", attributes) + self._xml_empty_tag("alignment", [("vertical", "top")]) + self._xml_empty_tag("protection", [("locked", 0)]) + self._xml_end_tag("xf") + + else: + self._xml_empty_tag("xf", attributes) + + def _write_xf(self, xf_format): + # Write the element. + num_fmt_id = xf_format.num_format_index + font_id = xf_format.font_index + fill_id = xf_format.fill_index + border_id = xf_format.border_index + xf_id = xf_format.xf_id + has_align = 0 + has_protect = 0 + + attributes = [ + ("numFmtId", num_fmt_id), + ("fontId", font_id), + ("fillId", fill_id), + ("borderId", border_id), + ("xfId", xf_id), + ] + + if xf_format.quote_prefix: + attributes.append(("quotePrefix", 1)) + + if xf_format.num_format_index > 0: + attributes.append(("applyNumberFormat", 1)) + + # Add applyFont attribute if XF format uses a font element. + if xf_format.font_index > 0 and not xf_format.hyperlink: + attributes.append(("applyFont", 1)) + + # Add applyFill attribute if XF format uses a fill element. + if xf_format.fill_index > 0: + attributes.append(("applyFill", 1)) + + # Add applyBorder attribute if XF format uses a border element. + if xf_format.border_index > 0: + attributes.append(("applyBorder", 1)) + + # Check if XF format has alignment properties set. + (apply_align, align) = xf_format._get_align_properties() + + # Check if an alignment sub-element should be written. + if apply_align and align: + has_align = 1 + + # We can also have applyAlignment without a sub-element. + if apply_align or xf_format.hyperlink: + attributes.append(("applyAlignment", 1)) + + # Check for cell protection properties. + protection = xf_format._get_protection_properties() + + if protection or xf_format.hyperlink: + attributes.append(("applyProtection", 1)) + + if not xf_format.hyperlink: + has_protect = 1 + + # Write XF with sub-elements if required. + if has_align or has_protect: + self._xml_start_tag("xf", attributes) + if has_align: + self._xml_empty_tag("alignment", align) + if has_protect: + self._xml_empty_tag("protection", protection) + self._xml_end_tag("xf") + else: + self._xml_empty_tag("xf", attributes) + + def _write_cell_styles(self): + # Write the element. + count = 1 + + if self.has_hyperlink: + count = 2 + + attributes = [("count", count)] + + self._xml_start_tag("cellStyles", attributes) + + if self.has_hyperlink: + self._write_cell_style("Hyperlink", 1, 8) + + self._write_cell_style() + + self._xml_end_tag("cellStyles") + + def _write_cell_style(self, name="Normal", xf_id=0, builtin_id=0): + # Write the element. + attributes = [ + ("name", name), + ("xfId", xf_id), + ("builtinId", builtin_id), + ] + + self._xml_empty_tag("cellStyle", attributes) + + def _write_dxfs(self): + # Write the element. + formats = self.dxf_formats + count = len(formats) + + attributes = [("count", len(formats))] + + if count: + self._xml_start_tag("dxfs", attributes) + + # Write the font elements for xf_format objects that have them. + for xf_format in self.dxf_formats: + self._xml_start_tag("dxf") + if xf_format.has_dxf_font: + self._write_font(xf_format, True) + + if xf_format.num_format_index: + self._write_num_fmt( + xf_format.num_format_index, xf_format.num_format + ) + + if xf_format.has_dxf_fill: + self._write_fill(xf_format, True) + if xf_format.has_dxf_border: + self._write_border(xf_format, True) + self._xml_end_tag("dxf") + + self._xml_end_tag("dxfs") + else: + self._xml_empty_tag("dxfs", attributes) + + def _write_table_styles(self): + # Write the element. + count = 0 + default_table_style = "TableStyleMedium9" + default_pivot_style = "PivotStyleLight16" + + attributes = [ + ("count", count), + ("defaultTableStyle", default_table_style), + ("defaultPivotStyle", default_pivot_style), + ] + + self._xml_empty_tag("tableStyles", attributes) + + def _write_colors(self): + # Write the element. + custom_colors = self.custom_colors + + if not custom_colors: + return + + self._xml_start_tag("colors") + self._write_mru_colors(custom_colors) + self._xml_end_tag("colors") + + def _write_mru_colors(self, custom_colors): + # Write the element for the most recently used colors. + + # Write the custom custom_colors in reverse order. + custom_colors.reverse() + + # Limit the mruColors to the last 10. + if len(custom_colors) > 10: + custom_colors = custom_colors[0:10] + + self._xml_start_tag("mruColors") + + # Write the custom custom_colors in reverse order. + for color in custom_colors: + self._write_color("rgb", color) + + self._xml_end_tag("mruColors") + + def _write_condense(self): + # Write the element. + attributes = [("val", 0)] + + self._xml_empty_tag("condense", attributes) + + def _write_extend(self): + # Write the element. + attributes = [("val", 0)] + + self._xml_empty_tag("extend", attributes) diff --git a/xlsxwriter/python/xlsxwriter/table.py b/xlsxwriter/python/xlsxwriter/table.py new file mode 100644 index 0000000..e15e042 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/table.py @@ -0,0 +1,184 @@ +############################################################################### +# +# Table - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from . import xmlwriter + + +class Table(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Table file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Table, self).__init__() + + self.properties = {} + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the table element. + self._write_table() + + # Write the autoFilter element. + self._write_auto_filter() + + # Write the tableColumns element. + self._write_table_columns() + + # Write the tableStyleInfo element. + self._write_table_style_info() + + # Close the table tag. + self._xml_end_tag("table") + + # Close the file. + self._xml_close() + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_table(self): + # Write the
element. + schema = "http://schemas.openxmlformats.org/" + xmlns = schema + "spreadsheetml/2006/main" + table_id = self.properties["id"] + name = self.properties["name"] + display_name = self.properties["name"] + ref = self.properties["range"] + totals_row_shown = self.properties["totals_row_shown"] + header_row_count = self.properties["header_row_count"] + + attributes = [ + ("xmlns", xmlns), + ("id", table_id), + ("name", name), + ("displayName", display_name), + ("ref", ref), + ] + + if not header_row_count: + attributes.append(("headerRowCount", 0)) + + if totals_row_shown: + attributes.append(("totalsRowCount", 1)) + else: + attributes.append(("totalsRowShown", 0)) + + self._xml_start_tag("table", attributes) + + def _write_auto_filter(self): + # Write the element. + autofilter = self.properties.get("autofilter", 0) + + if not autofilter: + return + + attributes = [ + ( + "ref", + autofilter, + ) + ] + + self._xml_empty_tag("autoFilter", attributes) + + def _write_table_columns(self): + # Write the element. + columns = self.properties["columns"] + + count = len(columns) + + attributes = [("count", count)] + + self._xml_start_tag("tableColumns", attributes) + + for col_data in columns: + # Write the tableColumn element. + self._write_table_column(col_data) + + self._xml_end_tag("tableColumns") + + def _write_table_column(self, col_data): + # Write the element. + attributes = [ + ("id", col_data["id"]), + ("name", col_data["name"]), + ] + + if col_data.get("total_string"): + attributes.append(("totalsRowLabel", col_data["total_string"])) + elif col_data.get("total_function"): + attributes.append(("totalsRowFunction", col_data["total_function"])) + + if "format" in col_data and col_data["format"] is not None: + attributes.append(("dataDxfId", col_data["format"])) + + if col_data.get("formula"): + self._xml_start_tag("tableColumn", attributes) + + # Write the calculatedColumnFormula element. + self._write_calculated_column_formula(col_data["formula"]) + + self._xml_end_tag("tableColumn") + else: + self._xml_empty_tag("tableColumn", attributes) + + def _write_table_style_info(self): + # Write the element. + props = self.properties + attributes = [] + + name = props["style"] + show_first_column = 0 + props["show_first_col"] + show_last_column = 0 + props["show_last_col"] + show_row_stripes = 0 + props["show_row_stripes"] + show_column_stripes = 0 + props["show_col_stripes"] + + if name is not None and name != "" and name != "None": + attributes.append(("name", name)) + + attributes.append(("showFirstColumn", show_first_column)) + attributes.append(("showLastColumn", show_last_column)) + attributes.append(("showRowStripes", show_row_stripes)) + attributes.append(("showColumnStripes", show_column_stripes)) + + self._xml_empty_tag("tableStyleInfo", attributes) + + def _write_calculated_column_formula(self, formula): + # Write the element. + self._xml_data_element("calculatedColumnFormula", formula) diff --git a/xlsxwriter/python/xlsxwriter/theme.py b/xlsxwriter/python/xlsxwriter/theme.py new file mode 100644 index 0000000..75c369f --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/theme.py @@ -0,0 +1,66 @@ +############################################################################### +# +# Theme - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +from io import StringIO + + +class Theme(object): + """ + A class for writing the Excel XLSX Theme file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + super(Theme, self).__init__() + self.fh = None + self.internal_fh = False + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + self._write_theme_file() + if self.internal_fh: + self.fh.close() + + def _set_xml_writer(self, filename): + # Set the XML writer filehandle for the object. + if isinstance(filename, StringIO): + self.internal_fh = False + self.fh = filename + else: + self.internal_fh = True + self.fh = open(filename, mode="w", encoding="utf-8") + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_theme_file(self): + # Write a default theme.xml file. + + default_theme = """\n""" # noqa + + self.fh.write(default_theme) diff --git a/xlsxwriter/python/xlsxwriter/utility.py b/xlsxwriter/python/xlsxwriter/utility.py new file mode 100644 index 0000000..b21bd40 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/utility.py @@ -0,0 +1,875 @@ +############################################################################### +# +# Worksheet - A class for writing Excel Worksheets. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# +import re +import datetime +from warnings import warn + +COL_NAMES = {} + +CHAR_WIDTHS = { + " ": 3, + "!": 5, + '"': 6, + "#": 7, + "$": 7, + "%": 11, + "&": 10, + "'": 3, + "(": 5, + ")": 5, + "*": 7, + "+": 7, + ",": 4, + "-": 5, + ".": 4, + "/": 6, + "0": 7, + "1": 7, + "2": 7, + "3": 7, + "4": 7, + "5": 7, + "6": 7, + "7": 7, + "8": 7, + "9": 7, + ":": 4, + ";": 4, + "<": 7, + "=": 7, + ">": 7, + "?": 7, + "@": 13, + "A": 9, + "B": 8, + "C": 8, + "D": 9, + "E": 7, + "F": 7, + "G": 9, + "H": 9, + "I": 4, + "J": 5, + "K": 8, + "L": 6, + "M": 12, + "N": 10, + "O": 10, + "P": 8, + "Q": 10, + "R": 8, + "S": 7, + "T": 7, + "U": 9, + "V": 9, + "W": 13, + "X": 8, + "Y": 7, + "Z": 7, + "[": 5, + "\\": 6, + "]": 5, + "^": 7, + "_": 7, + "`": 4, + "a": 7, + "b": 8, + "c": 6, + "d": 8, + "e": 8, + "f": 5, + "g": 7, + "h": 8, + "i": 4, + "j": 4, + "k": 7, + "l": 4, + "m": 12, + "n": 8, + "o": 8, + "p": 8, + "q": 8, + "r": 5, + "s": 6, + "t": 5, + "u": 8, + "v": 7, + "w": 11, + "x": 7, + "y": 7, + "z": 6, + "{": 5, + "|": 7, + "}": 5, + "~": 7, +} + +# Compile performance critical regular expressions. +re_leading = re.compile(r"^\s") +re_trailing = re.compile(r"\s$") +re_range_parts = re.compile(r"(\$?)([A-Z]{1,3})(\$?)(\d+)") + + +def xl_rowcol_to_cell(row, col, row_abs=False, col_abs=False): + """ + Convert a zero indexed row and column cell reference to a A1 style string. + + Args: + row: The cell row. Int. + col: The cell column. Int. + row_abs: Optional flag to make the row absolute. Bool. + col_abs: Optional flag to make the column absolute. Bool. + + Returns: + A1 style string. + + """ + if row < 0: + warn("Row number %d must be >= 0" % row) + return None + + if col < 0: + warn("Col number %d must be >= 0" % col) + return None + + row += 1 # Change to 1-index. + row_abs = "$" if row_abs else "" + + col_str = xl_col_to_name(col, col_abs) + + return col_str + row_abs + str(row) + + +def xl_rowcol_to_cell_fast(row, col): + """ + Optimized version of the xl_rowcol_to_cell function. Only used internally. + + Args: + row: The cell row. Int. + col: The cell column. Int. + + Returns: + A1 style string. + + """ + if col in COL_NAMES: + col_str = COL_NAMES[col] + else: + col_str = xl_col_to_name(col) + COL_NAMES[col] = col_str + + return col_str + str(row + 1) + + +def xl_col_to_name(col, col_abs=False): + """ + Convert a zero indexed column cell reference to a string. + + Args: + col: The cell column. Int. + col_abs: Optional flag to make the column absolute. Bool. + + Returns: + Column style string. + + """ + col_num = col + if col_num < 0: + warn("Col number %d must be >= 0" % col_num) + return None + + col_num += 1 # Change to 1-index. + col_str = "" + col_abs = "$" if col_abs else "" + + while col_num: + # Set remainder from 1 .. 26 + remainder = col_num % 26 + + if remainder == 0: + remainder = 26 + + # Convert the remainder to a character. + col_letter = chr(ord("A") + remainder - 1) + + # Accumulate the column letters, right to left. + col_str = col_letter + col_str + + # Get the next order of magnitude. + col_num = int((col_num - 1) / 26) + + return col_abs + col_str + + +def xl_cell_to_rowcol(cell_str): + """ + Convert a cell reference in A1 notation to a zero indexed row and column. + + Args: + cell_str: A1 style string. + + Returns: + row, col: Zero indexed cell row and column indices. + + """ + if not cell_str: + return 0, 0 + + match = re_range_parts.match(cell_str) + col_str = match.group(2) + row_str = match.group(4) + + # Convert base26 column string to number. + expn = 0 + col = 0 + for char in reversed(col_str): + col += (ord(char) - ord("A") + 1) * (26**expn) + expn += 1 + + # Convert 1-index to zero-index + row = int(row_str) - 1 + col -= 1 + + return row, col + + +def xl_cell_to_rowcol_abs(cell_str): + """ + Convert an absolute cell reference in A1 notation to a zero indexed + row and column, with True/False values for absolute rows or columns. + + Args: + cell_str: A1 style string. + + Returns: + row, col, row_abs, col_abs: Zero indexed cell row and column indices. + + """ + if not cell_str: + return 0, 0, False, False + + match = re_range_parts.match(cell_str) + + col_abs = match.group(1) + col_str = match.group(2) + row_abs = match.group(3) + row_str = match.group(4) + + if col_abs: + col_abs = True + else: + col_abs = False + + if row_abs: + row_abs = True + else: + row_abs = False + + # Convert base26 column string to number. + expn = 0 + col = 0 + for char in reversed(col_str): + col += (ord(char) - ord("A") + 1) * (26**expn) + expn += 1 + + # Convert 1-index to zero-index + row = int(row_str) - 1 + col -= 1 + + return row, col, row_abs, col_abs + + +def xl_range(first_row, first_col, last_row, last_col): + """ + Convert zero indexed row and col cell references to a A1:B1 range string. + + Args: + first_row: The first cell row. Int. + first_col: The first cell column. Int. + last_row: The last cell row. Int. + last_col: The last cell column. Int. + + Returns: + A1:B1 style range string. + + """ + range1 = xl_rowcol_to_cell(first_row, first_col) + range2 = xl_rowcol_to_cell(last_row, last_col) + + if range1 is None or range2 is None: + warn("Row and column numbers must be >= 0") + return None + + if range1 == range2: + return range1 + else: + return range1 + ":" + range2 + + +def xl_range_abs(first_row, first_col, last_row, last_col): + """ + Convert zero indexed row and col cell references to a $A$1:$B$1 absolute + range string. + + Args: + first_row: The first cell row. Int. + first_col: The first cell column. Int. + last_row: The last cell row. Int. + last_col: The last cell column. Int. + + Returns: + $A$1:$B$1 style range string. + + """ + range1 = xl_rowcol_to_cell(first_row, first_col, True, True) + range2 = xl_rowcol_to_cell(last_row, last_col, True, True) + + if range1 is None or range2 is None: + warn("Row and column numbers must be >= 0") + return None + + if range1 == range2: + return range1 + else: + return range1 + ":" + range2 + + +def xl_range_formula(sheetname, first_row, first_col, last_row, last_col): + """ + Convert worksheet name and zero indexed row and col cell references to + a Sheet1!A1:B1 range formula string. + + Args: + sheetname: The worksheet name. String. + first_row: The first cell row. Int. + first_col: The first cell column. Int. + last_row: The last cell row. Int. + last_col: The last cell column. Int. + + Returns: + A1:B1 style range string. + + """ + cell_range = xl_range_abs(first_row, first_col, last_row, last_col) + sheetname = quote_sheetname(sheetname) + + return sheetname + "!" + cell_range + + +def quote_sheetname(sheetname): + """ + Convert a worksheet name to a quoted name if it contains spaces or + special characters. + + Args: + sheetname: The worksheet name. String. + + Returns: + A quoted worksheet string. + + """ + + if not sheetname.isalnum() and not sheetname.startswith("'"): + # Double quote any single quotes. + sheetname = sheetname.replace("'", "''") + + # Single quote the sheet name. + sheetname = "'%s'" % sheetname + + return sheetname + + +def xl_pixel_width(string): + """ + Get the pixel width of a string based on individual character widths taken + from Excel. UTF8 characters, and other unhandled characters, are given a + default width of 8. + + Args: + string: The string to calculate the width for. String. + + Returns: + The string width in pixels. Note, Excel adds an additional 7 pixels of + padding in the cell. + + """ + length = 0 + for char in string: + length += CHAR_WIDTHS.get(char, 8) + + return length + + +def xl_color(color): + # Used in conjunction with the XlsxWriter *color() methods to convert + # a color name into an RGB formatted string. These colors are for + # backward compatibility with older versions of Excel. + named_colors = { + "black": "#000000", + "blue": "#0000FF", + "brown": "#800000", + "cyan": "#00FFFF", + "gray": "#808080", + "green": "#008000", + "lime": "#00FF00", + "magenta": "#FF00FF", + "navy": "#000080", + "orange": "#FF6600", + "pink": "#FF00FF", + "purple": "#800080", + "red": "#FF0000", + "silver": "#C0C0C0", + "white": "#FFFFFF", + "yellow": "#FFFF00", + } + + if color in named_colors: + color = named_colors[color] + + if not re.match("#[0-9a-fA-F]{6}", color): + warn("Color '%s' isn't a valid Excel color" % color) + + # Convert the RGB color to the Excel ARGB format. + return "FF" + color.lstrip("#").upper() + + +def get_rgb_color(color): + # Convert the user specified color to an RGB color. + rgb_color = xl_color(color) + + # Remove leading FF from RGB color for charts. + rgb_color = re.sub(r"^FF", "", rgb_color) + + return rgb_color + + +def get_sparkline_style(style_id): + styles = [ + { + "series": {"theme": "4", "tint": "-0.499984740745262"}, + "negative": {"theme": "5"}, + "markers": {"theme": "4", "tint": "-0.499984740745262"}, + "first": {"theme": "4", "tint": "0.39997558519241921"}, + "last": {"theme": "4", "tint": "0.39997558519241921"}, + "high": {"theme": "4"}, + "low": {"theme": "4"}, + }, # 0 + { + "series": {"theme": "4", "tint": "-0.499984740745262"}, + "negative": {"theme": "5"}, + "markers": {"theme": "4", "tint": "-0.499984740745262"}, + "first": {"theme": "4", "tint": "0.39997558519241921"}, + "last": {"theme": "4", "tint": "0.39997558519241921"}, + "high": {"theme": "4"}, + "low": {"theme": "4"}, + }, # 1 + { + "series": {"theme": "5", "tint": "-0.499984740745262"}, + "negative": {"theme": "6"}, + "markers": {"theme": "5", "tint": "-0.499984740745262"}, + "first": {"theme": "5", "tint": "0.39997558519241921"}, + "last": {"theme": "5", "tint": "0.39997558519241921"}, + "high": {"theme": "5"}, + "low": {"theme": "5"}, + }, # 2 + { + "series": {"theme": "6", "tint": "-0.499984740745262"}, + "negative": {"theme": "7"}, + "markers": {"theme": "6", "tint": "-0.499984740745262"}, + "first": {"theme": "6", "tint": "0.39997558519241921"}, + "last": {"theme": "6", "tint": "0.39997558519241921"}, + "high": {"theme": "6"}, + "low": {"theme": "6"}, + }, # 3 + { + "series": {"theme": "7", "tint": "-0.499984740745262"}, + "negative": {"theme": "8"}, + "markers": {"theme": "7", "tint": "-0.499984740745262"}, + "first": {"theme": "7", "tint": "0.39997558519241921"}, + "last": {"theme": "7", "tint": "0.39997558519241921"}, + "high": {"theme": "7"}, + "low": {"theme": "7"}, + }, # 4 + { + "series": {"theme": "8", "tint": "-0.499984740745262"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8", "tint": "-0.499984740745262"}, + "first": {"theme": "8", "tint": "0.39997558519241921"}, + "last": {"theme": "8", "tint": "0.39997558519241921"}, + "high": {"theme": "8"}, + "low": {"theme": "8"}, + }, # 5 + { + "series": {"theme": "9", "tint": "-0.499984740745262"}, + "negative": {"theme": "4"}, + "markers": {"theme": "9", "tint": "-0.499984740745262"}, + "first": {"theme": "9", "tint": "0.39997558519241921"}, + "last": {"theme": "9", "tint": "0.39997558519241921"}, + "high": {"theme": "9"}, + "low": {"theme": "9"}, + }, # 6 + { + "series": {"theme": "4", "tint": "-0.249977111117893"}, + "negative": {"theme": "5"}, + "markers": {"theme": "5", "tint": "-0.249977111117893"}, + "first": {"theme": "5", "tint": "-0.249977111117893"}, + "last": {"theme": "5", "tint": "-0.249977111117893"}, + "high": {"theme": "5", "tint": "-0.249977111117893"}, + "low": {"theme": "5", "tint": "-0.249977111117893"}, + }, # 7 + { + "series": {"theme": "5", "tint": "-0.249977111117893"}, + "negative": {"theme": "6"}, + "markers": {"theme": "6", "tint": "-0.249977111117893"}, + "first": {"theme": "6", "tint": "-0.249977111117893"}, + "last": {"theme": "6", "tint": "-0.249977111117893"}, + "high": {"theme": "6", "tint": "-0.249977111117893"}, + "low": {"theme": "6", "tint": "-0.249977111117893"}, + }, # 8 + { + "series": {"theme": "6", "tint": "-0.249977111117893"}, + "negative": {"theme": "7"}, + "markers": {"theme": "7", "tint": "-0.249977111117893"}, + "first": {"theme": "7", "tint": "-0.249977111117893"}, + "last": {"theme": "7", "tint": "-0.249977111117893"}, + "high": {"theme": "7", "tint": "-0.249977111117893"}, + "low": {"theme": "7", "tint": "-0.249977111117893"}, + }, # 9 + { + "series": {"theme": "7", "tint": "-0.249977111117893"}, + "negative": {"theme": "8"}, + "markers": {"theme": "8", "tint": "-0.249977111117893"}, + "first": {"theme": "8", "tint": "-0.249977111117893"}, + "last": {"theme": "8", "tint": "-0.249977111117893"}, + "high": {"theme": "8", "tint": "-0.249977111117893"}, + "low": {"theme": "8", "tint": "-0.249977111117893"}, + }, # 10 + { + "series": {"theme": "8", "tint": "-0.249977111117893"}, + "negative": {"theme": "9"}, + "markers": {"theme": "9", "tint": "-0.249977111117893"}, + "first": {"theme": "9", "tint": "-0.249977111117893"}, + "last": {"theme": "9", "tint": "-0.249977111117893"}, + "high": {"theme": "9", "tint": "-0.249977111117893"}, + "low": {"theme": "9", "tint": "-0.249977111117893"}, + }, # 11 + { + "series": {"theme": "9", "tint": "-0.249977111117893"}, + "negative": {"theme": "4"}, + "markers": {"theme": "4", "tint": "-0.249977111117893"}, + "first": {"theme": "4", "tint": "-0.249977111117893"}, + "last": {"theme": "4", "tint": "-0.249977111117893"}, + "high": {"theme": "4", "tint": "-0.249977111117893"}, + "low": {"theme": "4", "tint": "-0.249977111117893"}, + }, # 12 + { + "series": {"theme": "4"}, + "negative": {"theme": "5"}, + "markers": {"theme": "4", "tint": "-0.249977111117893"}, + "first": {"theme": "4", "tint": "-0.249977111117893"}, + "last": {"theme": "4", "tint": "-0.249977111117893"}, + "high": {"theme": "4", "tint": "-0.249977111117893"}, + "low": {"theme": "4", "tint": "-0.249977111117893"}, + }, # 13 + { + "series": {"theme": "5"}, + "negative": {"theme": "6"}, + "markers": {"theme": "5", "tint": "-0.249977111117893"}, + "first": {"theme": "5", "tint": "-0.249977111117893"}, + "last": {"theme": "5", "tint": "-0.249977111117893"}, + "high": {"theme": "5", "tint": "-0.249977111117893"}, + "low": {"theme": "5", "tint": "-0.249977111117893"}, + }, # 14 + { + "series": {"theme": "6"}, + "negative": {"theme": "7"}, + "markers": {"theme": "6", "tint": "-0.249977111117893"}, + "first": {"theme": "6", "tint": "-0.249977111117893"}, + "last": {"theme": "6", "tint": "-0.249977111117893"}, + "high": {"theme": "6", "tint": "-0.249977111117893"}, + "low": {"theme": "6", "tint": "-0.249977111117893"}, + }, # 15 + { + "series": {"theme": "7"}, + "negative": {"theme": "8"}, + "markers": {"theme": "7", "tint": "-0.249977111117893"}, + "first": {"theme": "7", "tint": "-0.249977111117893"}, + "last": {"theme": "7", "tint": "-0.249977111117893"}, + "high": {"theme": "7", "tint": "-0.249977111117893"}, + "low": {"theme": "7", "tint": "-0.249977111117893"}, + }, # 16 + { + "series": {"theme": "8"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8", "tint": "-0.249977111117893"}, + "first": {"theme": "8", "tint": "-0.249977111117893"}, + "last": {"theme": "8", "tint": "-0.249977111117893"}, + "high": {"theme": "8", "tint": "-0.249977111117893"}, + "low": {"theme": "8", "tint": "-0.249977111117893"}, + }, # 17 + { + "series": {"theme": "9"}, + "negative": {"theme": "4"}, + "markers": {"theme": "9", "tint": "-0.249977111117893"}, + "first": {"theme": "9", "tint": "-0.249977111117893"}, + "last": {"theme": "9", "tint": "-0.249977111117893"}, + "high": {"theme": "9", "tint": "-0.249977111117893"}, + "low": {"theme": "9", "tint": "-0.249977111117893"}, + }, # 18 + { + "series": {"theme": "4", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "4", "tint": "0.79998168889431442"}, + "first": {"theme": "4", "tint": "-0.249977111117893"}, + "last": {"theme": "4", "tint": "-0.249977111117893"}, + "high": {"theme": "4", "tint": "-0.499984740745262"}, + "low": {"theme": "4", "tint": "-0.499984740745262"}, + }, # 19 + { + "series": {"theme": "5", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "5", "tint": "0.79998168889431442"}, + "first": {"theme": "5", "tint": "-0.249977111117893"}, + "last": {"theme": "5", "tint": "-0.249977111117893"}, + "high": {"theme": "5", "tint": "-0.499984740745262"}, + "low": {"theme": "5", "tint": "-0.499984740745262"}, + }, # 20 + { + "series": {"theme": "6", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "6", "tint": "0.79998168889431442"}, + "first": {"theme": "6", "tint": "-0.249977111117893"}, + "last": {"theme": "6", "tint": "-0.249977111117893"}, + "high": {"theme": "6", "tint": "-0.499984740745262"}, + "low": {"theme": "6", "tint": "-0.499984740745262"}, + }, # 21 + { + "series": {"theme": "7", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "7", "tint": "0.79998168889431442"}, + "first": {"theme": "7", "tint": "-0.249977111117893"}, + "last": {"theme": "7", "tint": "-0.249977111117893"}, + "high": {"theme": "7", "tint": "-0.499984740745262"}, + "low": {"theme": "7", "tint": "-0.499984740745262"}, + }, # 22 + { + "series": {"theme": "8", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "8", "tint": "0.79998168889431442"}, + "first": {"theme": "8", "tint": "-0.249977111117893"}, + "last": {"theme": "8", "tint": "-0.249977111117893"}, + "high": {"theme": "8", "tint": "-0.499984740745262"}, + "low": {"theme": "8", "tint": "-0.499984740745262"}, + }, # 23 + { + "series": {"theme": "9", "tint": "0.39997558519241921"}, + "negative": {"theme": "0", "tint": "-0.499984740745262"}, + "markers": {"theme": "9", "tint": "0.79998168889431442"}, + "first": {"theme": "9", "tint": "-0.249977111117893"}, + "last": {"theme": "9", "tint": "-0.249977111117893"}, + "high": {"theme": "9", "tint": "-0.499984740745262"}, + "low": {"theme": "9", "tint": "-0.499984740745262"}, + }, # 24 + { + "series": {"theme": "1", "tint": "0.499984740745262"}, + "negative": {"theme": "1", "tint": "0.249977111117893"}, + "markers": {"theme": "1", "tint": "0.249977111117893"}, + "first": {"theme": "1", "tint": "0.249977111117893"}, + "last": {"theme": "1", "tint": "0.249977111117893"}, + "high": {"theme": "1", "tint": "0.249977111117893"}, + "low": {"theme": "1", "tint": "0.249977111117893"}, + }, # 25 + { + "series": {"theme": "1", "tint": "0.34998626667073579"}, + "negative": {"theme": "0", "tint": "-0.249977111117893"}, + "markers": {"theme": "0", "tint": "-0.249977111117893"}, + "first": {"theme": "0", "tint": "-0.249977111117893"}, + "last": {"theme": "0", "tint": "-0.249977111117893"}, + "high": {"theme": "0", "tint": "-0.249977111117893"}, + "low": {"theme": "0", "tint": "-0.249977111117893"}, + }, # 26 + { + "series": {"rgb": "FF323232"}, + "negative": {"rgb": "FFD00000"}, + "markers": {"rgb": "FFD00000"}, + "first": {"rgb": "FFD00000"}, + "last": {"rgb": "FFD00000"}, + "high": {"rgb": "FFD00000"}, + "low": {"rgb": "FFD00000"}, + }, # 27 + { + "series": {"rgb": "FF000000"}, + "negative": {"rgb": "FF0070C0"}, + "markers": {"rgb": "FF0070C0"}, + "first": {"rgb": "FF0070C0"}, + "last": {"rgb": "FF0070C0"}, + "high": {"rgb": "FF0070C0"}, + "low": {"rgb": "FF0070C0"}, + }, # 28 + { + "series": {"rgb": "FF376092"}, + "negative": {"rgb": "FFD00000"}, + "markers": {"rgb": "FFD00000"}, + "first": {"rgb": "FFD00000"}, + "last": {"rgb": "FFD00000"}, + "high": {"rgb": "FFD00000"}, + "low": {"rgb": "FFD00000"}, + }, # 29 + { + "series": {"rgb": "FF0070C0"}, + "negative": {"rgb": "FF000000"}, + "markers": {"rgb": "FF000000"}, + "first": {"rgb": "FF000000"}, + "last": {"rgb": "FF000000"}, + "high": {"rgb": "FF000000"}, + "low": {"rgb": "FF000000"}, + }, # 30 + { + "series": {"rgb": "FF5F5F5F"}, + "negative": {"rgb": "FFFFB620"}, + "markers": {"rgb": "FFD70077"}, + "first": {"rgb": "FF5687C2"}, + "last": {"rgb": "FF359CEB"}, + "high": {"rgb": "FF56BE79"}, + "low": {"rgb": "FFFF5055"}, + }, # 31 + { + "series": {"rgb": "FF5687C2"}, + "negative": {"rgb": "FFFFB620"}, + "markers": {"rgb": "FFD70077"}, + "first": {"rgb": "FF777777"}, + "last": {"rgb": "FF359CEB"}, + "high": {"rgb": "FF56BE79"}, + "low": {"rgb": "FFFF5055"}, + }, # 32 + { + "series": {"rgb": "FFC6EFCE"}, + "negative": {"rgb": "FFFFC7CE"}, + "markers": {"rgb": "FF8CADD6"}, + "first": {"rgb": "FFFFDC47"}, + "last": {"rgb": "FFFFEB9C"}, + "high": {"rgb": "FF60D276"}, + "low": {"rgb": "FFFF5367"}, + }, # 33 + { + "series": {"rgb": "FF00B050"}, + "negative": {"rgb": "FFFF0000"}, + "markers": {"rgb": "FF0070C0"}, + "first": {"rgb": "FFFFC000"}, + "last": {"rgb": "FFFFC000"}, + "high": {"rgb": "FF00B050"}, + "low": {"rgb": "FFFF0000"}, + }, # 34 + { + "series": {"theme": "3"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8"}, + "first": {"theme": "4"}, + "last": {"theme": "5"}, + "high": {"theme": "6"}, + "low": {"theme": "7"}, + }, # 35 + { + "series": {"theme": "1"}, + "negative": {"theme": "9"}, + "markers": {"theme": "8"}, + "first": {"theme": "4"}, + "last": {"theme": "5"}, + "high": {"theme": "6"}, + "low": {"theme": "7"}, + }, # 36 + ] + + return styles[style_id] + + +def supported_datetime(dt): + # Determine is an argument is a supported datetime object. + return isinstance( + dt, (datetime.datetime, datetime.date, datetime.time, datetime.timedelta) + ) + + +def remove_datetime_timezone(dt_obj, remove_timezone): + # Excel doesn't support timezones in datetimes/times so we remove the + # tzinfo from the object if the user has specified that option in the + # constructor. + if remove_timezone: + dt_obj = dt_obj.replace(tzinfo=None) + else: + if dt_obj.tzinfo: + raise TypeError( + "Excel doesn't support timezones in datetimes. " + "Set the tzinfo in the datetime/time object to None or " + "use the 'remove_timezone' Workbook() option" + ) + + return dt_obj + + +def datetime_to_excel_datetime(dt_obj, date_1904, remove_timezone): + # Convert a datetime object to an Excel serial date and time. The integer + # part of the number stores the number of days since the epoch and the + # fractional part stores the percentage of the day. + date_type = dt_obj + is_timedelta = False + + if date_1904: + # Excel for Mac date epoch. + epoch = datetime.datetime(1904, 1, 1) + else: + # Default Excel epoch. + epoch = datetime.datetime(1899, 12, 31) + + # We handle datetime .datetime, .date and .time objects but convert + # them to datetime.datetime objects and process them in the same way. + if isinstance(dt_obj, datetime.datetime): + dt_obj = remove_datetime_timezone(dt_obj, remove_timezone) + delta = dt_obj - epoch + elif isinstance(dt_obj, datetime.date): + dt_obj = datetime.datetime.fromordinal(dt_obj.toordinal()) + delta = dt_obj - epoch + elif isinstance(dt_obj, datetime.time): + dt_obj = datetime.datetime.combine(epoch, dt_obj) + dt_obj = remove_datetime_timezone(dt_obj, remove_timezone) + delta = dt_obj - epoch + elif isinstance(dt_obj, datetime.timedelta): + is_timedelta = True + delta = dt_obj + else: + raise TypeError("Unknown or unsupported datetime type") + + # Convert a Python datetime.datetime value to an Excel date number. + excel_time = delta.days + ( + float(delta.seconds) + float(delta.microseconds) / 1e6 + ) / (60 * 60 * 24) + + # The following is a workaround for the fact that in Excel a time only + # value is represented as 1899-12-31+time whereas in datetime.datetime() + # it is 1900-1-1+time so we need to subtract the 1 day difference. + if isinstance(date_type, datetime.datetime) and dt_obj.isocalendar() == ( + 1900, + 1, + 1, + ): + excel_time -= 1 + + # Account for Excel erroneously treating 1900 as a leap year. + if not date_1904 and not is_timedelta and excel_time > 59: + excel_time += 1 + + return excel_time + + +def preserve_whitespace(string): + # Check if a string has leading or trailing whitespace that requires a + # "preserve" attribute. + if re_leading.search(string) or re_trailing.search(string): + return True + else: + return False diff --git a/xlsxwriter/python/xlsxwriter/vml.py b/xlsxwriter/python/xlsxwriter/vml.py new file mode 100644 index 0000000..868580c --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/vml.py @@ -0,0 +1,720 @@ +############################################################################### +# +# Vml - A class for writing the Excel XLSX Vml file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Package imports. +from . import xmlwriter + + +class Vml(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Vml file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Vml, self).__init__() + + ########################################################################### + # + # Private API. + # + ########################################################################### + def _assemble_xml_file( + self, + data_id, + vml_shape_id, + comments_data=None, + buttons_data=None, + header_images_data=None, + ): + # Assemble and write the XML file. + z_index = 1 + + self._write_xml_namespace() + + # Write the o:shapelayout element. + self._write_shapelayout(data_id) + + if buttons_data: + # Write the v:shapetype element. + self._write_button_shapetype() + + for button in buttons_data: + # Write the v:shape element. + vml_shape_id += 1 + self._write_button_shape(vml_shape_id, z_index, button) + z_index += 1 + + if comments_data: + # Write the v:shapetype element. + self._write_comment_shapetype() + + for comment in comments_data: + # Write the v:shape element. + vml_shape_id += 1 + self._write_comment_shape(vml_shape_id, z_index, comment) + z_index += 1 + + if header_images_data: + # Write the v:shapetype element. + self._write_image_shapetype() + + index = 1 + for image in header_images_data: + # Write the v:shape element. + vml_shape_id += 1 + self._write_image_shape(vml_shape_id, index, image) + index += 1 + + self._xml_end_tag("xml") + + # Close the XML writer filehandle. + self._xml_close() + + def _pixels_to_points(self, vertices): + # Convert comment vertices from pixels to points. + + left, top, width, height = vertices[8:12] + + # Scale to pixels. + left *= 0.75 + top *= 0.75 + width *= 0.75 + height *= 0.75 + + return left, top, width, height + + ########################################################################### + # + # XML methods. + # + ########################################################################### + def _write_xml_namespace(self): + # Write the element. This is the root element of VML. + schema = "urn:schemas-microsoft-com:" + xmlns = schema + "vml" + xmlns_o = schema + "office:office" + xmlns_x = schema + "office:excel" + + attributes = [ + ("xmlns:v", xmlns), + ("xmlns:o", xmlns_o), + ("xmlns:x", xmlns_x), + ] + + self._xml_start_tag("xml", attributes) + + def _write_shapelayout(self, data_id): + # Write the element. + attributes = [("v:ext", "edit")] + + self._xml_start_tag("o:shapelayout", attributes) + + # Write the o:idmap element. + self._write_idmap(data_id) + + self._xml_end_tag("o:shapelayout") + + def _write_idmap(self, data_id): + # Write the element. + attributes = [ + ("v:ext", "edit"), + ("data", data_id), + ] + + self._xml_empty_tag("o:idmap", attributes) + + def _write_comment_shapetype(self): + # Write the element. + shape_id = "_x0000_t202" + coordsize = "21600,21600" + spt = 202 + path = "m,l,21600r21600,l21600,xe" + + attributes = [ + ("id", shape_id), + ("coordsize", coordsize), + ("o:spt", spt), + ("path", path), + ] + + self._xml_start_tag("v:shapetype", attributes) + + # Write the v:stroke element. + self._write_stroke() + + # Write the v:path element. + self._write_comment_path("t", "rect") + + self._xml_end_tag("v:shapetype") + + def _write_button_shapetype(self): + # Write the element. + shape_id = "_x0000_t201" + coordsize = "21600,21600" + spt = 201 + path = "m,l,21600r21600,l21600,xe" + + attributes = [ + ("id", shape_id), + ("coordsize", coordsize), + ("o:spt", spt), + ("path", path), + ] + + self._xml_start_tag("v:shapetype", attributes) + + # Write the v:stroke element. + self._write_stroke() + + # Write the v:path element. + self._write_button_path() + + # Write the o:lock element. + self._write_shapetype_lock() + + self._xml_end_tag("v:shapetype") + + def _write_image_shapetype(self): + # Write the element. + shape_id = "_x0000_t75" + coordsize = "21600,21600" + spt = 75 + o_preferrelative = "t" + path = "m@4@5l@4@11@9@11@9@5xe" + filled = "f" + stroked = "f" + + attributes = [ + ("id", shape_id), + ("coordsize", coordsize), + ("o:spt", spt), + ("o:preferrelative", o_preferrelative), + ("path", path), + ("filled", filled), + ("stroked", stroked), + ] + + self._xml_start_tag("v:shapetype", attributes) + + # Write the v:stroke element. + self._write_stroke() + + # Write the v:formulas element. + self._write_formulas() + + # Write the v:path element. + self._write_image_path() + + # Write the o:lock element. + self._write_aspect_ratio_lock() + + self._xml_end_tag("v:shapetype") + + def _write_stroke(self): + # Write the element. + joinstyle = "miter" + + attributes = [("joinstyle", joinstyle)] + + self._xml_empty_tag("v:stroke", attributes) + + def _write_comment_path(self, gradientshapeok, connecttype): + # Write the element. + attributes = [] + + if gradientshapeok: + attributes.append(("gradientshapeok", "t")) + + attributes.append(("o:connecttype", connecttype)) + + self._xml_empty_tag("v:path", attributes) + + def _write_button_path(self): + # Write the element. + shadowok = "f" + extrusionok = "f" + strokeok = "f" + fillok = "f" + connecttype = "rect" + + attributes = [ + ("shadowok", shadowok), + ("o:extrusionok", extrusionok), + ("strokeok", strokeok), + ("fillok", fillok), + ("o:connecttype", connecttype), + ] + + self._xml_empty_tag("v:path", attributes) + + def _write_image_path(self): + # Write the element. + extrusionok = "f" + gradientshapeok = "t" + connecttype = "rect" + + attributes = [ + ("o:extrusionok", extrusionok), + ("gradientshapeok", gradientshapeok), + ("o:connecttype", connecttype), + ] + + self._xml_empty_tag("v:path", attributes) + + def _write_shapetype_lock(self): + # Write the element. + ext = "edit" + shapetype = "t" + + attributes = [ + ("v:ext", ext), + ("shapetype", shapetype), + ] + + self._xml_empty_tag("o:lock", attributes) + + def _write_rotation_lock(self): + # Write the element. + ext = "edit" + rotation = "t" + + attributes = [ + ("v:ext", ext), + ("rotation", rotation), + ] + + self._xml_empty_tag("o:lock", attributes) + + def _write_aspect_ratio_lock(self): + # Write the element. + ext = "edit" + aspectratio = "t" + + attributes = [ + ("v:ext", ext), + ("aspectratio", aspectratio), + ] + + self._xml_empty_tag("o:lock", attributes) + + def _write_comment_shape(self, shape_id, z_index, comment): + # Write the element. + shape_type = "#_x0000_t202" + insetmode = "auto" + visibility = "hidden" + + # Set the shape index. + shape_id = "_x0000_s" + str(shape_id) + + # Get the comment parameters + row = comment[0] + col = comment[1] + visible = comment[4] + fillcolor = comment[5] + vertices = comment[9] + + (left, top, width, height) = self._pixels_to_points(vertices) + + # Set the visibility. + if visible: + visibility = "visible" + + style = ( + "position:absolute;" + "margin-left:%.15gpt;" + "margin-top:%.15gpt;" + "width:%.15gpt;" + "height:%.15gpt;" + "z-index:%d;" + "visibility:%s" % (left, top, width, height, z_index, visibility) + ) + + attributes = [ + ("id", shape_id), + ("type", shape_type), + ("style", style), + ("fillcolor", fillcolor), + ("o:insetmode", insetmode), + ] + + self._xml_start_tag("v:shape", attributes) + + # Write the v:fill element. + self._write_comment_fill() + + # Write the v:shadow element. + self._write_shadow() + + # Write the v:path element. + self._write_comment_path(None, "none") + + # Write the v:textbox element. + self._write_comment_textbox() + + # Write the x:ClientData element. + self._write_comment_client_data(row, col, visible, vertices) + + self._xml_end_tag("v:shape") + + def _write_button_shape(self, shape_id, z_index, button): + # Write the element. + shape_type = "#_x0000_t201" + + # Set the shape index. + shape_id = "_x0000_s" + str(shape_id) + + # Get the button parameters. + # row = button["_row"] + # col = button["_col"] + vertices = button["vertices"] + + (left, top, width, height) = self._pixels_to_points(vertices) + + style = ( + "position:absolute;" + "margin-left:%.15gpt;" + "margin-top:%.15gpt;" + "width:%.15gpt;" + "height:%.15gpt;" + "z-index:%d;" + "mso-wrap-style:tight" % (left, top, width, height, z_index) + ) + + attributes = [ + ("id", shape_id), + ("type", shape_type), + ] + + if button.get("description"): + attributes.append(("alt", button["description"])) + + attributes.append(("style", style)) + attributes.append(("o:button", "t")) + attributes.append(("fillcolor", "buttonFace [67]")) + attributes.append(("strokecolor", "windowText [64]")) + attributes.append(("o:insetmode", "auto")) + + self._xml_start_tag("v:shape", attributes) + + # Write the v:fill element. + self._write_button_fill() + + # Write the o:lock element. + self._write_rotation_lock() + + # Write the v:textbox element. + self._write_button_textbox(button["font"]) + + # Write the x:ClientData element. + self._write_button_client_data(button) + + self._xml_end_tag("v:shape") + + def _write_image_shape(self, shape_id, z_index, image_data): + # Write the element. + shape_type = "#_x0000_t75" + + # Set the shape index. + shape_id = "_x0000_s" + str(shape_id) + + # Get the image parameters + width = image_data[0] + height = image_data[1] + name = image_data[2] + position = image_data[3] + x_dpi = image_data[4] + y_dpi = image_data[5] + ref_id = image_data[6] + + # Scale the height/width by the resolution, relative to 72dpi. + width = width * 72.0 / x_dpi + height = height * 72.0 / y_dpi + + # Excel uses a rounding based around 72 and 96 dpi. + width = 72.0 / 96 * int(width * 96.0 / 72 + 0.25) + height = 72.0 / 96 * int(height * 96.0 / 72 + 0.25) + + style = ( + "position:absolute;" + "margin-left:0;" + "margin-top:0;" + "width:%.15gpt;" + "height:%.15gpt;" + "z-index:%d" % (width, height, z_index) + ) + + attributes = [ + ("id", position), + ("o:spid", shape_id), + ("type", shape_type), + ("style", style), + ] + + self._xml_start_tag("v:shape", attributes) + + # Write the v:imagedata element. + self._write_imagedata(ref_id, name) + + # Write the o:lock element. + self._write_rotation_lock() + + self._xml_end_tag("v:shape") + + def _write_comment_fill(self): + # Write the element. + color_2 = "#ffffe1" + + attributes = [("color2", color_2)] + + self._xml_empty_tag("v:fill", attributes) + + def _write_button_fill(self): + # Write the element. + color_2 = "buttonFace [67]" + detectmouseclick = "t" + + attributes = [ + ("color2", color_2), + ("o:detectmouseclick", detectmouseclick), + ] + + self._xml_empty_tag("v:fill", attributes) + + def _write_shadow(self): + # Write the element. + on = "t" + color = "black" + obscured = "t" + + attributes = [ + ("on", on), + ("color", color), + ("obscured", obscured), + ] + + self._xml_empty_tag("v:shadow", attributes) + + def _write_comment_textbox(self): + # Write the element. + style = "mso-direction-alt:auto" + + attributes = [("style", style)] + + self._xml_start_tag("v:textbox", attributes) + + # Write the div element. + self._write_div("left") + + self._xml_end_tag("v:textbox") + + def _write_button_textbox(self, font): + # Write the element. + style = "mso-direction-alt:auto" + + attributes = [("style", style), ("o:singleclick", "f")] + + self._xml_start_tag("v:textbox", attributes) + + # Write the div element. + self._write_div("center", font) + + self._xml_end_tag("v:textbox") + + def _write_div(self, align, font=None): + # Write the
element. + + style = "text-align:" + align + + attributes = [("style", style)] + + self._xml_start_tag("div", attributes) + + if font: + # Write the font element. + self._write_font(font) + + self._xml_end_tag("div") + + def _write_font(self, font): + # Write the element. + caption = font["caption"] + face = "Calibri" + size = 220 + color = "#000000" + + attributes = [ + ("face", face), + ("size", size), + ("color", color), + ] + + self._xml_data_element("font", caption, attributes) + + def _write_comment_client_data(self, row, col, visible, vertices): + # Write the element. + object_type = "Note" + + attributes = [("ObjectType", object_type)] + + self._xml_start_tag("x:ClientData", attributes) + + # Write the x:MoveWithCells element. + self._write_move_with_cells() + + # Write the x:SizeWithCells element. + self._write_size_with_cells() + + # Write the x:Anchor element. + self._write_anchor(vertices) + + # Write the x:AutoFill element. + self._write_auto_fill() + + # Write the x:Row element. + self._write_row(row) + + # Write the x:Column element. + self._write_column(col) + + # Write the x:Visible element. + if visible: + self._write_visible() + + self._xml_end_tag("x:ClientData") + + def _write_button_client_data(self, button): + # Write the element. + macro = button["macro"] + vertices = button["vertices"] + + object_type = "Button" + + attributes = [("ObjectType", object_type)] + + self._xml_start_tag("x:ClientData", attributes) + + # Write the x:Anchor element. + self._write_anchor(vertices) + + # Write the x:PrintObject element. + self._write_print_object() + + # Write the x:AutoFill element. + self._write_auto_fill() + + # Write the x:FmlaMacro element. + self._write_fmla_macro(macro) + + # Write the x:TextHAlign element. + self._write_text_halign() + + # Write the x:TextVAlign element. + self._write_text_valign() + + self._xml_end_tag("x:ClientData") + + def _write_move_with_cells(self): + # Write the element. + self._xml_empty_tag("x:MoveWithCells") + + def _write_size_with_cells(self): + # Write the element. + self._xml_empty_tag("x:SizeWithCells") + + def _write_visible(self): + # Write the element. + self._xml_empty_tag("x:Visible") + + def _write_anchor(self, vertices): + # Write the element. + (col_start, row_start, x1, y1, col_end, row_end, x2, y2) = vertices[:8] + + strings = [col_start, x1, row_start, y1, col_end, x2, row_end, y2] + strings = [str(i) for i in strings] + + data = ", ".join(strings) + + self._xml_data_element("x:Anchor", data) + + def _write_auto_fill(self): + # Write the element. + data = "False" + + self._xml_data_element("x:AutoFill", data) + + def _write_row(self, data): + # Write the element. + self._xml_data_element("x:Row", data) + + def _write_column(self, data): + # Write the element. + self._xml_data_element("x:Column", data) + + def _write_print_object(self): + # Write the element. + self._xml_data_element("x:PrintObject", "False") + + def _write_text_halign(self): + # Write the element. + self._xml_data_element("x:TextHAlign", "Center") + + def _write_text_valign(self): + # Write the element. + self._xml_data_element("x:TextVAlign", "Center") + + def _write_fmla_macro(self, data): + # Write the element. + self._xml_data_element("x:FmlaMacro", data) + + def _write_imagedata(self, ref_id, o_title): + # Write the element. + attributes = [ + ("o:relid", "rId" + str(ref_id)), + ("o:title", o_title), + ] + + self._xml_empty_tag("v:imagedata", attributes) + + def _write_formulas(self): + # Write the element. + self._xml_start_tag("v:formulas") + + # Write the v:f elements. + self._write_formula("if lineDrawn pixelLineWidth 0") + self._write_formula("sum @0 1 0") + self._write_formula("sum 0 0 @1") + self._write_formula("prod @2 1 2") + self._write_formula("prod @3 21600 pixelWidth") + self._write_formula("prod @3 21600 pixelHeight") + self._write_formula("sum @0 0 1") + self._write_formula("prod @6 1 2") + self._write_formula("prod @7 21600 pixelWidth") + self._write_formula("sum @8 21600 0") + self._write_formula("prod @7 21600 pixelHeight") + self._write_formula("sum @10 21600 0") + + self._xml_end_tag("v:formulas") + + def _write_formula(self, eqn): + # Write the element. + attributes = [("eqn", eqn)] + + self._xml_empty_tag("v:f", attributes) diff --git a/xlsxwriter/python/xlsxwriter/workbook.py b/xlsxwriter/python/xlsxwriter/workbook.py new file mode 100644 index 0000000..06eee09 --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/workbook.py @@ -0,0 +1,1968 @@ +############################################################################### +# +# Workbook - A class for writing the Excel XLSX Workbook file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import hashlib +import operator +import os +import re +import time +from datetime import datetime +from decimal import Decimal +from fractions import Fraction +from struct import unpack +from warnings import warn +from zipfile import ZipFile, ZipInfo, ZIP_DEFLATED, LargeZipFile + + +# Package imports. +from . import xmlwriter +from .worksheet import Worksheet +from .chartsheet import Chartsheet +from .sharedstrings import SharedStringTable +from .format import Format +from .packager import Packager +from .utility import xl_cell_to_rowcol +from .chart_area import ChartArea +from .chart_bar import ChartBar +from .chart_column import ChartColumn +from .chart_doughnut import ChartDoughnut +from .chart_line import ChartLine +from .chart_pie import ChartPie +from .chart_radar import ChartRadar +from .chart_scatter import ChartScatter +from .chart_stock import ChartStock +from .exceptions import InvalidWorksheetName +from .exceptions import DuplicateWorksheetName +from .exceptions import UndefinedImageSize +from .exceptions import UnsupportedImageFormat +from .exceptions import FileCreateError +from .exceptions import FileSizeError + + +class Workbook(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Workbook file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + chartsheet_class = Chartsheet + worksheet_class = Worksheet + + def __init__(self, filename=None, options=None): + """ + Constructor. + + """ + if options is None: + options = {} + + super(Workbook, self).__init__() + + self.filename = filename + + self.tmpdir = options.get("tmpdir", None) + self.date_1904 = options.get("date_1904", False) + self.strings_to_numbers = options.get("strings_to_numbers", False) + self.strings_to_formulas = options.get("strings_to_formulas", True) + self.strings_to_urls = options.get("strings_to_urls", True) + self.nan_inf_to_errors = options.get("nan_inf_to_errors", False) + self.default_date_format = options.get("default_date_format", None) + self.constant_memory = options.get("constant_memory", False) + self.in_memory = options.get("in_memory", False) + self.excel2003_style = options.get("excel2003_style", False) + self.remove_timezone = options.get("remove_timezone", False) + self.use_future_functions = options.get("use_future_functions", False) + self.default_format_properties = options.get("default_format_properties", {}) + + self.max_url_length = options.get("max_url_length", 2079) + if self.max_url_length < 255: + self.max_url_length = 2079 + + if options.get("use_zip64"): + self.allow_zip64 = True + else: + self.allow_zip64 = False + + self.worksheet_meta = WorksheetMeta() + self.selected = 0 + self.fileclosed = 0 + self.filehandle = None + self.internal_fh = 0 + self.sheet_name = "Sheet" + self.chart_name = "Chart" + self.sheetname_count = 0 + self.chartname_count = 0 + self.worksheets_objs = [] + self.charts = [] + self.drawings = [] + self.sheetnames = {} + self.formats = [] + self.xf_formats = [] + self.xf_format_indices = {} + self.dxf_formats = [] + self.dxf_format_indices = {} + self.palette = [] + self.font_count = 0 + self.num_formats = [] + self.defined_names = [] + self.named_ranges = [] + self.custom_colors = [] + self.doc_properties = {} + self.custom_properties = [] + self.createtime = datetime.utcnow() + self.num_vml_files = 0 + self.num_comment_files = 0 + self.x_window = 240 + self.y_window = 15 + self.window_width = 16095 + self.window_height = 9660 + self.tab_ratio = 600 + self.str_table = SharedStringTable() + self.vba_project = None + self.vba_is_stream = False + self.vba_codename = None + self.image_types = {} + self.images = [] + self.border_count = 0 + self.fill_count = 0 + self.drawing_count = 0 + self.calc_mode = "auto" + self.calc_on_load = True + self.calc_id = 124519 + self.has_comments = False + self.read_only = 0 + self.has_metadata = False + + # We can't do 'constant_memory' mode while doing 'in_memory' mode. + if self.in_memory: + self.constant_memory = False + + # Add the default cell format. + if self.excel2003_style: + self.add_format({"xf_index": 0, "font_family": 0}) + else: + self.add_format({"xf_index": 0}) + + # Add a default URL format. + self.default_url_format = self.add_format({"hyperlink": True}) + + # Add the default date format. + if self.default_date_format is not None: + self.default_date_format = self.add_format( + {"num_format": self.default_date_format} + ) + + def __enter__(self): + """Return self object to use with "with" statement.""" + return self + + def __exit__(self, type, value, traceback): + """Close workbook when exiting "with" statement.""" + self.close() + + def add_worksheet(self, name=None, worksheet_class=None): + """ + Add a new worksheet to the Excel workbook. + + Args: + name: The worksheet name. Defaults to 'Sheet1', etc. + + Returns: + Reference to a worksheet object. + + """ + if worksheet_class is None: + worksheet_class = self.worksheet_class + + return self._add_sheet(name, worksheet_class=worksheet_class) + + def add_chartsheet(self, name=None, chartsheet_class=None): + """ + Add a new chartsheet to the Excel workbook. + + Args: + name: The chartsheet name. Defaults to 'Sheet1', etc. + + Returns: + Reference to a chartsheet object. + + """ + if chartsheet_class is None: + chartsheet_class = self.chartsheet_class + + return self._add_sheet(name, worksheet_class=chartsheet_class) + + def add_format(self, properties=None): + """ + Add a new Format to the Excel Workbook. + + Args: + properties: The format properties. + + Returns: + Reference to a Format object. + + """ + format_properties = self.default_format_properties.copy() + + if self.excel2003_style: + format_properties = {"font_name": "Arial", "font_size": 10, "theme": 1 * -1} + + if properties: + format_properties.update(properties) + + xf_format = Format( + format_properties, self.xf_format_indices, self.dxf_format_indices + ) + + # Store the format reference. + self.formats.append(xf_format) + + return xf_format + + def add_chart(self, options): + """ + Create a chart object. + + Args: + options: The chart type and subtype options. + + Returns: + Reference to a Chart object. + + """ + + # Type must be specified so we can create the required chart instance. + chart_type = options.get("type") + if chart_type is None: + warn("Chart type must be defined in add_chart()") + return + + if chart_type == "area": + chart = ChartArea(options) + elif chart_type == "bar": + chart = ChartBar(options) + elif chart_type == "column": + chart = ChartColumn(options) + elif chart_type == "doughnut": + chart = ChartDoughnut(options) + elif chart_type == "line": + chart = ChartLine(options) + elif chart_type == "pie": + chart = ChartPie(options) + elif chart_type == "radar": + chart = ChartRadar(options) + elif chart_type == "scatter": + chart = ChartScatter(options) + elif chart_type == "stock": + chart = ChartStock(options) + else: + warn("Unknown chart type '%s' in add_chart()" % chart_type) + return + + # Set the embedded chart name if present. + if "name" in options: + chart.chart_name = options["name"] + + chart.embedded = True + chart.date_1904 = self.date_1904 + chart.remove_timezone = self.remove_timezone + + self.charts.append(chart) + + return chart + + def add_vba_project(self, vba_project, is_stream=False): + """ + Add a vbaProject binary to the Excel workbook. + + Args: + vba_project: The vbaProject binary file name. + is_stream: vba_project is an in memory byte stream. + + Returns: + Nothing. + + """ + if not is_stream and not os.path.exists(vba_project): + warn("VBA project binary file '%s' not found." % vba_project) + return -1 + + if self.vba_codename is None: + self.vba_codename = "ThisWorkbook" + + self.vba_project = vba_project + self.vba_is_stream = is_stream + + def close(self): + """ + Call finalization code and close file. + + Args: + None. + + Returns: + Nothing. + + """ + if not self.fileclosed: + try: + self._store_workbook() + except IOError as e: + raise FileCreateError(e) + except LargeZipFile: + raise FileSizeError( + "Filesize would require ZIP64 extensions. " + "Use workbook.use_zip64()." + ) + + self.fileclosed = True + + # Ensure all constant_memory temp files are closed. + if self.constant_memory: + for worksheet in self.worksheets(): + worksheet._opt_close() + + else: + warn("Calling close() on already closed file.") + + def set_size(self, width, height): + """ + Set the size of a workbook window. + + Args: + width: Width of the window in pixels. + height: Height of the window in pixels. + + Returns: + Nothing. + + """ + # Convert the width/height to twips at 96 dpi. + if width: + self.window_width = int(width * 1440 / 96) + else: + self.window_width = 16095 + + if height: + self.window_height = int(height * 1440 / 96) + else: + self.window_height = 9660 + + def set_tab_ratio(self, tab_ratio=None): + """ + Set the ratio between worksheet tabs and the horizontal slider. + + Args: + tab_ratio: The tab ratio, 0 <= tab_ratio <= 100 + + Returns: + Nothing. + + """ + if tab_ratio is None: + return + + if tab_ratio < 0 or tab_ratio > 100: + warn("Tab ratio '%d' outside: 0 <= tab_ratio <= 100" % tab_ratio) + else: + self.tab_ratio = int(tab_ratio * 10) + + def set_properties(self, properties): + """ + Set the document properties such as Title, Author etc. + + Args: + properties: Dictionary of document properties. + + Returns: + Nothing. + + """ + self.doc_properties = properties + + def set_custom_property(self, name, value, property_type=None): + """ + Set a custom document property. + + Args: + name: The name of the custom property. + value: The value of the custom property. + property_type: The type of the custom property. Optional. + + Returns: + Nothing. + + """ + if name is None or value is None: + warn( + "The name and value parameters must be non-None in " + "set_custom_property()" + ) + return -1 + + if property_type is None: + # Determine the property type from the Python type. + if isinstance(value, bool): + property_type = "bool" + elif isinstance(value, datetime): + property_type = "date" + elif isinstance(value, int): + property_type = "number_int" + elif isinstance(value, (float, int, Decimal, Fraction)): + property_type = "number" + else: + property_type = "text" + + if property_type == "date": + value = value.strftime("%Y-%m-%dT%H:%M:%SZ") + + if property_type == "text" and len(value) > 255: + warn( + "Length of 'value' parameter exceeds Excel's limit of 255 " + "characters in set_custom_property(): '%s'" % value + ) + + if len(name) > 255: + warn( + "Length of 'name' parameter exceeds Excel's limit of 255 " + "characters in set_custom_property(): '%s'" % name + ) + + self.custom_properties.append((name, value, property_type)) + + def set_calc_mode(self, mode, calc_id=None): + """ + Set the Excel calculation mode for the workbook. + + Args: + mode: String containing one of: + * manual + * auto_except_tables + * auto + + Returns: + Nothing. + + """ + self.calc_mode = mode + + if mode == "manual": + self.calc_on_load = False + elif mode == "auto_except_tables": + self.calc_mode = "autoNoTable" + + # Leave undocumented for now. Rarely required. + if calc_id: + self.calc_id = calc_id + + def define_name(self, name, formula): + # Create a defined name in Excel. We handle global/workbook level + # names and local/worksheet names. + """ + Create a defined name in the workbook. + + Args: + name: The defined name. + formula: The cell or range that the defined name refers to. + + Returns: + Nothing. + + """ + sheet_index = None + sheetname = "" + + # Remove the = sign from the formula if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + # Local defined names are formatted like "Sheet1!name". + sheet_parts = re.compile(r"^([^!]+)!([^!]+)$") + match = sheet_parts.match(name) + + if match: + sheetname = match.group(1) + name = match.group(2) + sheet_index = self._get_sheet_index(sheetname) + + # Warn if the sheet index wasn't found. + if sheet_index is None: + warn("Unknown sheet name '%s' in defined_name()" % sheetname) + return -1 + else: + # Use -1 to indicate global names. + sheet_index = -1 + + # Warn if the defined name contains invalid chars as defined by Excel. + if not re.match(r"^[\w\\][\w\\.]*$", name, re.UNICODE) or re.match( + r"^\d", name + ): + warn("Invalid Excel characters in defined_name(): '%s'" % name) + return -1 + + # Warn if the defined name looks like a cell name. + if re.match(r"^[a-zA-Z][a-zA-Z]?[a-dA-D]?\d+$", name): + warn("Name looks like a cell name in defined_name(): '%s'" % name) + return -1 + + # Warn if the name looks like a R1C1 cell reference. + if re.match(r"^[rcRC]$", name) or re.match(r"^[rcRC]\d+[rcRC]\d+$", name): + warn("Invalid name '%s' like a RC cell ref in defined_name()" % name) + return -1 + + self.defined_names.append([name, sheet_index, formula, False]) + + def worksheets(self): + """ + Return a list of the worksheet objects in the workbook. + + Args: + None. + + Returns: + A list of worksheet objects. + + """ + return self.worksheets_objs + + def get_worksheet_by_name(self, name): + """ + Return a worksheet object in the workbook using the sheetname. + + Args: + name: The name of the worksheet. + + Returns: + A worksheet object or None. + + """ + return self.sheetnames.get(name) + + def get_default_url_format(self): + """ + Get the default url format used when a user defined format isn't + specified with write_url(). The format is the hyperlink style defined + by Excel for the default theme. + + Args: + None. + + Returns: + A format object. + + """ + return self.default_url_format + + def use_zip64(self): + """ + Allow ZIP64 extensions when writing xlsx file zip container. + + Args: + None. + + Returns: + Nothing. + + """ + self.allow_zip64 = True + + def set_vba_name(self, name=None): + """ + Set the VBA name for the workbook. By default the workbook is referred + to as ThisWorkbook in VBA. + + Args: + name: The VBA name for the workbook. + + Returns: + Nothing. + + """ + if name is not None: + self.vba_codename = name + else: + self.vba_codename = "ThisWorkbook" + + def read_only_recommended(self): + """ + Set the Excel "Read-only recommended" option when saving a file. + + Args: + None. + + Returns: + Nothing. + + """ + self.read_only = 2 + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Prepare format object for passing to Style.pm. + self._prepare_format_properties() + + # Write the XML declaration. + self._xml_declaration() + + # Write the workbook element. + self._write_workbook() + + # Write the fileVersion element. + self._write_file_version() + + # Write the fileSharing element. + self._write_file_sharing() + + # Write the workbookPr element. + self._write_workbook_pr() + + # Write the bookViews element. + self._write_book_views() + + # Write the sheets element. + self._write_sheets() + + # Write the workbook defined names. + self._write_defined_names() + + # Write the calcPr element. + self._write_calc_pr() + + # Close the workbook tag. + self._xml_end_tag("workbook") + + # Close the file. + self._xml_close() + + def _store_workbook(self): + # Create the xlsx/zip file. + try: + xlsx_file = ZipFile( + self.filename, + "w", + compression=ZIP_DEFLATED, + allowZip64=self.allow_zip64, + ) + except IOError as e: + raise e + + # Assemble worksheets into a workbook. + packager = self._get_packager() + + # Add a default worksheet if non have been added. + if not self.worksheets(): + self.add_worksheet() + + # Ensure that at least one worksheet has been selected. + if self.worksheet_meta.activesheet == 0: + self.worksheets_objs[0].selected = 1 + self.worksheets_objs[0].hidden = 0 + + # Set the active sheet. + for sheet in self.worksheets(): + if sheet.index == self.worksheet_meta.activesheet: + sheet.active = 1 + + # Set the sheet vba_codename the workbook has a vbaProject binary. + if self.vba_project: + for sheet in self.worksheets(): + if sheet.vba_codename is None: + sheet.set_vba_name() + + # Convert the SST strings data structure. + self._prepare_sst_string_data() + + # Prepare the worksheet VML elements such as comments and buttons. + self._prepare_vml() + + # Set the defined names for the worksheets such as Print Titles. + self._prepare_defined_names() + + # Prepare the drawings, charts and images. + self._prepare_drawings() + + # Add cached data to charts. + self._add_chart_data() + + # Prepare the worksheet tables. + self._prepare_tables() + + # Prepare the metadata file links. + self._prepare_metadata() + + # Package the workbook. + packager._add_workbook(self) + packager._set_tmpdir(self.tmpdir) + packager._set_in_memory(self.in_memory) + xml_files = packager._create_package() + + # Free up the Packager object. + packager = None + + # Add XML sub-files to the Zip file with their Excel filename. + for file_id, file_data in enumerate(xml_files): + os_filename, xml_filename, is_binary = file_data + + if self.in_memory: + # Set sub-file timestamp to Excel's timestamp of 1/1/1980. + zipinfo = ZipInfo(xml_filename, (1980, 1, 1, 0, 0, 0)) + + # Copy compression type from parent ZipFile. + zipinfo.compress_type = xlsx_file.compression + + if is_binary: + xlsx_file.writestr(zipinfo, os_filename.getvalue()) + else: + xlsx_file.writestr(zipinfo, os_filename.getvalue().encode("utf-8")) + else: + # The sub-files are tempfiles on disk, i.e, not in memory. + + # Set sub-file timestamp to 31/1/1980 due to portability + # issues setting it to Excel's timestamp of 1/1/1980. + timestamp = time.mktime((1980, 1, 31, 0, 0, 0, 0, 0, -1)) + os.utime(os_filename, (timestamp, timestamp)) + + try: + xlsx_file.write(os_filename, xml_filename) + os.remove(os_filename) + except LargeZipFile as e: + # Close open temp files on zipfile.LargeZipFile exception. + for i in range(file_id, len(xml_files) - 1): + os.remove(xml_files[i][0]) + raise e + + xlsx_file.close() + + def _add_sheet(self, name, worksheet_class=None): + # Utility for shared code in add_worksheet() and add_chartsheet(). + + if worksheet_class: + worksheet = worksheet_class() + else: + worksheet = self.worksheet_class() + + sheet_index = len(self.worksheets_objs) + name = self._check_sheetname(name, isinstance(worksheet, Chartsheet)) + + # Initialization data to pass to the worksheet. + init_data = { + "name": name, + "index": sheet_index, + "str_table": self.str_table, + "worksheet_meta": self.worksheet_meta, + "constant_memory": self.constant_memory, + "tmpdir": self.tmpdir, + "date_1904": self.date_1904, + "strings_to_numbers": self.strings_to_numbers, + "strings_to_formulas": self.strings_to_formulas, + "strings_to_urls": self.strings_to_urls, + "nan_inf_to_errors": self.nan_inf_to_errors, + "default_date_format": self.default_date_format, + "default_url_format": self.default_url_format, + "excel2003_style": self.excel2003_style, + "remove_timezone": self.remove_timezone, + "max_url_length": self.max_url_length, + "use_future_functions": self.use_future_functions, + } + + worksheet._initialize(init_data) + + self.worksheets_objs.append(worksheet) + self.sheetnames[name] = worksheet + + return worksheet + + def _check_sheetname(self, sheetname, is_chartsheet=False): + # Check for valid worksheet names. We check the length, if it contains + # any invalid chars and if the sheetname is unique in the workbook. + invalid_char = re.compile(r"[\[\]:*?/\\]") + + # Increment the Sheet/Chart number used for default sheet names below. + if is_chartsheet: + self.chartname_count += 1 + else: + self.sheetname_count += 1 + + # Supply default Sheet/Chart sheetname if none has been defined. + if sheetname is None or sheetname == "": + if is_chartsheet: + sheetname = self.chart_name + str(self.chartname_count) + else: + sheetname = self.sheet_name + str(self.sheetname_count) + + # Check that sheet sheetname is <= 31. Excel limit. + if len(sheetname) > 31: + raise InvalidWorksheetName( + "Excel worksheet name '%s' must be <= 31 chars." % sheetname + ) + + # Check that sheetname doesn't contain any invalid characters. + if invalid_char.search(sheetname): + raise InvalidWorksheetName( + "Invalid Excel character '[]:*?/\\' in sheetname '%s'." % sheetname + ) + + # Check that sheetname doesn't start or end with an apostrophe. + if sheetname.startswith("'") or sheetname.endswith("'"): + raise InvalidWorksheetName( + 'Sheet name cannot start or end with an apostrophe "%s".' % sheetname + ) + + # Check that the worksheet name doesn't already exist since this is a + # fatal Excel error. The check must be case insensitive like Excel. + for worksheet in self.worksheets(): + if sheetname.lower() == worksheet.name.lower(): + raise DuplicateWorksheetName( + "Sheetname '%s', with case ignored, is already in use." % sheetname + ) + + return sheetname + + def _prepare_format_properties(self): + # Prepare all Format properties prior to passing them to styles.py. + + # Separate format objects into XF and DXF formats. + self._prepare_formats() + + # Set the font index for the format objects. + self._prepare_fonts() + + # Set the number format index for the format objects. + self._prepare_num_formats() + + # Set the border index for the format objects. + self._prepare_borders() + + # Set the fill index for the format objects. + self._prepare_fills() + + def _prepare_formats(self): + # Iterate through the XF Format objects and separate them into + # XF and DXF formats. The XF and DF formats then need to be sorted + # back into index order rather than creation order. + xf_formats = [] + dxf_formats = [] + + # Sort into XF and DXF formats. + for xf_format in self.formats: + if xf_format.xf_index is not None: + xf_formats.append(xf_format) + + if xf_format.dxf_index is not None: + dxf_formats.append(xf_format) + + # Pre-extend the format lists. + self.xf_formats = [None] * len(xf_formats) + self.dxf_formats = [None] * len(dxf_formats) + + # Rearrange formats into index order. + for xf_format in xf_formats: + index = xf_format.xf_index + self.xf_formats[index] = xf_format + + for dxf_format in dxf_formats: + index = dxf_format.dxf_index + self.dxf_formats[index] = dxf_format + + def _set_default_xf_indices(self): + # Set the default index for each format. Only used for testing. + + formats = list(self.formats) + + # Delete the default url format. + del formats[1] + + # Skip the default date format if set. + if self.default_date_format is not None: + del formats[1] + + # Set the remaining formats. + for xf_format in formats: + xf_format._get_xf_index() + + def _prepare_fonts(self): + # Iterate through the XF Format objects and give them an index to + # non-default font elements. + fonts = {} + index = 0 + + for xf_format in self.xf_formats: + key = xf_format._get_font_key() + if key in fonts: + # Font has already been used. + xf_format.font_index = fonts[key] + xf_format.has_font = 0 + else: + # This is a new font. + fonts[key] = index + xf_format.font_index = index + xf_format.has_font = 1 + index += 1 + + self.font_count = index + + # For DXF formats we only need to check if the properties have changed. + for xf_format in self.dxf_formats: + # The only font properties that can change for a DXF format are: + # color, bold, italic, underline and strikethrough. + if ( + xf_format.font_color + or xf_format.bold + or xf_format.italic + or xf_format.underline + or xf_format.font_strikeout + ): + xf_format.has_dxf_font = 1 + + def _prepare_num_formats(self): + # User defined records in Excel start from index 0xA4. + unique_num_formats = {} + num_formats = [] + index = 164 + + for xf_format in self.xf_formats + self.dxf_formats: + num_format = xf_format.num_format + + # Check if num_format is an index to a built-in number format. + if not isinstance(num_format, str): + num_format = int(num_format) + + # Number format '0' is indexed as 1 in Excel. + if num_format == 0: + num_format = 1 + + xf_format.num_format_index = num_format + continue + elif num_format == "0": + # Number format '0' is indexed as 1 in Excel. + xf_format.num_format_index = 1 + continue + elif num_format == "General": + # The 'General' format has an number format index of 0. + xf_format.num_format_index = 0 + continue + + if num_format in unique_num_formats: + # Number xf_format has already been used. + xf_format.num_format_index = unique_num_formats[num_format] + else: + # Add a new number xf_format. + unique_num_formats[num_format] = index + xf_format.num_format_index = index + index += 1 + + # Only increase font count for XF formats (not DXF formats). + if xf_format.xf_index: + num_formats.append(num_format) + + self.num_formats = num_formats + + def _prepare_borders(self): + # Iterate through the XF Format objects and give them an index to + # non-default border elements. + borders = {} + index = 0 + + for xf_format in self.xf_formats: + key = xf_format._get_border_key() + + if key in borders: + # Border has already been used. + xf_format.border_index = borders[key] + xf_format.has_border = 0 + else: + # This is a new border. + borders[key] = index + xf_format.border_index = index + xf_format.has_border = 1 + index += 1 + + self.border_count = index + + # For DXF formats we only need to check if the properties have changed. + has_border = re.compile(r"[^0:]") + + for xf_format in self.dxf_formats: + key = xf_format._get_border_key() + + if has_border.search(key): + xf_format.has_dxf_border = 1 + + def _prepare_fills(self): + # Iterate through the XF Format objects and give them an index to + # non-default fill elements. + # The user defined fill properties start from 2 since there are 2 + # default fills: patternType="none" and patternType="gray125". + fills = {} + index = 2 # Start from 2. See above. + + # Add the default fills. + fills["0:0:0"] = 0 + fills["17:0:0"] = 1 + + # Store the DXF colors separately since them may be reversed below. + for xf_format in self.dxf_formats: + if xf_format.pattern or xf_format.bg_color or xf_format.fg_color: + xf_format.has_dxf_fill = 1 + xf_format.dxf_bg_color = xf_format.bg_color + xf_format.dxf_fg_color = xf_format.fg_color + + for xf_format in self.xf_formats: + # The following logical statements jointly take care of special + # cases in relation to cell colors and patterns: + # 1. For a solid fill (_pattern == 1) Excel reverses the role of + # foreground and background colors, and + # 2. If the user specifies a foreground or background color + # without a pattern they probably wanted a solid fill, so we fill + # in the defaults. + if ( + xf_format.pattern == 1 + and xf_format.bg_color != 0 + and xf_format.fg_color != 0 + ): + tmp = xf_format.fg_color + xf_format.fg_color = xf_format.bg_color + xf_format.bg_color = tmp + + if ( + xf_format.pattern <= 1 + and xf_format.bg_color != 0 + and xf_format.fg_color == 0 + ): + xf_format.fg_color = xf_format.bg_color + xf_format.bg_color = 0 + xf_format.pattern = 1 + + if ( + xf_format.pattern <= 1 + and xf_format.bg_color == 0 + and xf_format.fg_color != 0 + ): + xf_format.pattern = 1 + + key = xf_format._get_fill_key() + + if key in fills: + # Fill has already been used. + xf_format.fill_index = fills[key] + xf_format.has_fill = 0 + else: + # This is a new fill. + fills[key] = index + xf_format.fill_index = index + xf_format.has_fill = 1 + index += 1 + + self.fill_count = index + + def _prepare_defined_names(self): + # Iterate through the worksheets and store any defined names in + # addition to any user defined names. Stores the defined names + # for the Workbook.xml and the named ranges for App.xml. + defined_names = self.defined_names + + for sheet in self.worksheets(): + # Check for Print Area settings. + if sheet.autofilter_area: + hidden = 1 + sheet_range = sheet.autofilter_area + # Store the defined names. + defined_names.append( + ["_xlnm._FilterDatabase", sheet.index, sheet_range, hidden] + ) + + # Check for Print Area settings. + if sheet.print_area_range: + hidden = 0 + sheet_range = sheet.print_area_range + # Store the defined names. + defined_names.append( + ["_xlnm.Print_Area", sheet.index, sheet_range, hidden] + ) + + # Check for repeat rows/cols referred to as Print Titles. + if sheet.repeat_col_range or sheet.repeat_row_range: + hidden = 0 + sheet_range = "" + if sheet.repeat_col_range and sheet.repeat_row_range: + sheet_range = sheet.repeat_col_range + "," + sheet.repeat_row_range + else: + sheet_range = sheet.repeat_col_range + sheet.repeat_row_range + # Store the defined names. + defined_names.append( + ["_xlnm.Print_Titles", sheet.index, sheet_range, hidden] + ) + + defined_names = self._sort_defined_names(defined_names) + self.defined_names = defined_names + self.named_ranges = self._extract_named_ranges(defined_names) + + def _sort_defined_names(self, names): + # Sort the list of list of internal and user defined names in + # the same order as used by Excel. + + # Add a normalize name string to each list for sorting. + for name_list in names: + (defined_name, _, sheet_name, _) = name_list + + # Normalize the defined name by removing any leading '_xmln.' + # from internal names and lowercasing the string. + defined_name = defined_name.replace("_xlnm.", "").lower() + + # Normalize the sheetname by removing the leading quote and + # lowercasing the string. + sheet_name = sheet_name.lstrip("'").lower() + + name_list.append(defined_name + "::" + sheet_name) + + # Sort based on the normalized key. + names.sort(key=operator.itemgetter(4)) + + # Remove the extra key used for sorting. + for name_list in names: + name_list.pop() + + return names + + def _prepare_drawings(self): + # Iterate through the worksheets and set up chart and image drawings. + chart_ref_id = 0 + image_ref_id = 0 + ref_id = 0 + drawing_id = 0 + image_ids = {} + header_image_ids = {} + background_ids = {} + + for sheet in self.worksheets(): + chart_count = len(sheet.charts) + image_count = len(sheet.images) + shape_count = len(sheet.shapes) + + header_image_count = len(sheet.header_images) + footer_image_count = len(sheet.footer_images) + has_background = sheet.background_image + has_drawing = False + + if not ( + chart_count + or image_count + or shape_count + or header_image_count + or footer_image_count + or has_background + ): + continue + + # Don't increase the drawing_id header/footer images. + if chart_count or image_count or shape_count: + drawing_id += 1 + has_drawing = True + + # Prepare the background images. + if sheet.background_image: + if sheet.background_bytes: + filename = "" + image_data = sheet.background_image + else: + filename = sheet.background_image + image_data = None + + ( + image_type, + _, + _, + _, + _, + _, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in background_ids: + ref_id = background_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + background_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_background(ref_id, image_type) + + # Prepare the worksheet images. + for index in range(image_count): + filename = sheet.images[index][2] + image_data = sheet.images[index][10] + ( + image_type, + width, + height, + name, + x_dpi, + y_dpi, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in image_ids: + ref_id = image_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + image_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_image( + index, + ref_id, + drawing_id, + width, + height, + name, + image_type, + x_dpi, + y_dpi, + digest, + ) + + # Prepare the worksheet charts. + for index in range(chart_count): + chart_ref_id += 1 + sheet._prepare_chart(index, chart_ref_id, drawing_id) + + # Prepare the worksheet shapes. + for index in range(shape_count): + sheet._prepare_shape(index, drawing_id) + + # Prepare the header images. + for index in range(header_image_count): + filename = sheet.header_images[index][0] + image_data = sheet.header_images[index][1] + position = sheet.header_images[index][2] + + ( + image_type, + width, + height, + name, + x_dpi, + y_dpi, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in header_image_ids: + ref_id = header_image_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + header_image_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_header_image( + ref_id, + width, + height, + name, + image_type, + position, + x_dpi, + y_dpi, + digest, + ) + + # Prepare the footer images. + for index in range(footer_image_count): + filename = sheet.footer_images[index][0] + image_data = sheet.footer_images[index][1] + position = sheet.footer_images[index][2] + + ( + image_type, + width, + height, + name, + x_dpi, + y_dpi, + digest, + ) = self._get_image_properties(filename, image_data) + + if digest in header_image_ids: + ref_id = header_image_ids[digest] + else: + image_ref_id += 1 + ref_id = image_ref_id + header_image_ids[digest] = image_ref_id + self.images.append([filename, image_type, image_data]) + + sheet._prepare_header_image( + ref_id, + width, + height, + name, + image_type, + position, + x_dpi, + y_dpi, + digest, + ) + + if has_drawing: + drawing = sheet.drawing + self.drawings.append(drawing) + + # Remove charts that were created but not inserted into worksheets. + for chart in self.charts[:]: + if chart.id == -1: + self.charts.remove(chart) + + # Sort the workbook charts references into the order that the were + # written to the worksheets above. + self.charts = sorted(self.charts, key=lambda chart: chart.id) + + self.drawing_count = drawing_id + + def _get_image_properties(self, filename, image_data): + # Extract dimension information from the image file. + height = 0 + width = 0 + x_dpi = 96 + y_dpi = 96 + + if not image_data: + # Open the image file and read in the data. + fh = open(filename, "rb") + data = fh.read() + else: + # Read the image data from the user supplied byte stream. + data = image_data.getvalue() + + digest = hashlib.sha256(data).hexdigest() + + # Get the image filename without the path. + image_name = os.path.basename(filename) + + # Look for some common image file markers. + marker1 = unpack("3s", data[1:4])[0] + marker2 = unpack(">H", data[:2])[0] + marker3 = unpack("2s", data[:2])[0] + marker4 = unpack("I", data[offset + 0 : offset + 4])[0] + marker = unpack("4s", data[offset + 4 : offset + 8])[0] + + # Read the image dimensions. + if marker == b"IHDR": + width = unpack(">I", data[offset + 8 : offset + 12])[0] + height = unpack(">I", data[offset + 12 : offset + 16])[0] + + # Read the image DPI. + if marker == b"pHYs": + x_density = unpack(">I", data[offset + 8 : offset + 12])[0] + y_density = unpack(">I", data[offset + 12 : offset + 16])[0] + units = unpack("b", data[offset + 16 : offset + 17])[0] + + if units == 1: + x_dpi = x_density * 0.0254 + y_dpi = y_density * 0.0254 + + if marker == b"IEND": + end_marker = True + continue + + offset = offset + length + 12 + + return "png", width, height, x_dpi, y_dpi + + def _process_jpg(self, data): + # Extract width and height information from a JPEG file. + offset = 2 + data_length = len(data) + end_marker = False + width = 0 + height = 0 + x_dpi = 96 + y_dpi = 96 + + # Search through the image data to read the JPEG markers. + while not end_marker and offset < data_length: + marker = unpack(">H", data[offset + 0 : offset + 2])[0] + length = unpack(">H", data[offset + 2 : offset + 4])[0] + + # Read the height and width in the 0xFFCn elements (except C4, C8 + # and CC which aren't SOF markers). + if ( + (marker & 0xFFF0) == 0xFFC0 + and marker != 0xFFC4 + and marker != 0xFFC8 + and marker != 0xFFCC + ): + height = unpack(">H", data[offset + 5 : offset + 7])[0] + width = unpack(">H", data[offset + 7 : offset + 9])[0] + + # Read the DPI in the 0xFFE0 element. + if marker == 0xFFE0: + units = unpack("b", data[offset + 11 : offset + 12])[0] + x_density = unpack(">H", data[offset + 12 : offset + 14])[0] + y_density = unpack(">H", data[offset + 14 : offset + 16])[0] + + if units == 1: + x_dpi = x_density + y_dpi = y_density + + if units == 2: + x_dpi = x_density * 2.54 + y_dpi = y_density * 2.54 + + # Workaround for incorrect dpi. + if x_dpi == 1: + x_dpi = 96 + if y_dpi == 1: + y_dpi = 96 + + if marker == 0xFFDA: + end_marker = True + continue + + offset = offset + length + 2 + + return "jpeg", width, height, x_dpi, y_dpi + + def _process_gif(self, data): + # Extract width and height information from a GIF file. + x_dpi = 96 + y_dpi = 96 + + width = unpack(" 0: + sheetname = c_range[:pos] + cells = c_range[pos + 1 :] + else: + return None, None + + # Split the cell range into 2 cells or else use single cell for both. + if cells.find(":") > 0: + (cell_1, cell_2) = cells.split(":", 1) + else: + (cell_1, cell_2) = (cells, cells) + + # Remove leading/trailing quotes and convert escaped quotes to single. + sheetname = sheetname.strip("'") + sheetname = sheetname.replace("''", "'") + + try: + # Get the row, col values from the Excel ranges. We do this in a + # try block for ranges that can't be parsed such as defined names. + (row_start, col_start) = xl_cell_to_rowcol(cell_1) + (row_end, col_end) = xl_cell_to_rowcol(cell_2) + except AttributeError: + return None, None + + # We only handle 1D ranges. + if row_start != row_end and col_start != col_end: + return None, None + + return sheetname, [row_start, col_start, row_end, col_end] + + def _prepare_sst_string_data(self): + # Convert the SST string data from a dict to a list. + self.str_table._sort_string_data() + + def _get_packager(self): + # Get and instance of the Packager class to create the xlsx package. + # This allows the default packager to be over-ridden. + return Packager() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_workbook(self): + # Write element. + + schema = "http://schemas.openxmlformats.org" + xmlns = schema + "/spreadsheetml/2006/main" + xmlns_r = schema + "/officeDocument/2006/relationships" + + attributes = [ + ("xmlns", xmlns), + ("xmlns:r", xmlns_r), + ] + + self._xml_start_tag("workbook", attributes) + + def _write_file_version(self): + # Write the element. + + app_name = "xl" + last_edited = 4 + lowest_edited = 4 + rup_build = 4505 + + attributes = [ + ("appName", app_name), + ("lastEdited", last_edited), + ("lowestEdited", lowest_edited), + ("rupBuild", rup_build), + ] + + if self.vba_project: + attributes.append(("codeName", "{37E998C4-C9E5-D4B9-71C8-EB1FF731991C}")) + + self._xml_empty_tag("fileVersion", attributes) + + def _write_file_sharing(self): + # Write the element. + if self.read_only == 0: + return + + attributes = [("readOnlyRecommended", 1)] + + self._xml_empty_tag("fileSharing", attributes) + + def _write_workbook_pr(self): + # Write element. + default_theme_version = 124226 + attributes = [] + + if self.vba_codename: + attributes.append(("codeName", self.vba_codename)) + if self.date_1904: + attributes.append(("date1904", 1)) + + attributes.append(("defaultThemeVersion", default_theme_version)) + + self._xml_empty_tag("workbookPr", attributes) + + def _write_book_views(self): + # Write element. + self._xml_start_tag("bookViews") + self._write_workbook_view() + self._xml_end_tag("bookViews") + + def _write_workbook_view(self): + # Write element. + attributes = [ + ("xWindow", self.x_window), + ("yWindow", self.y_window), + ("windowWidth", self.window_width), + ("windowHeight", self.window_height), + ] + + # Store the tabRatio attribute when it isn't the default. + if self.tab_ratio != 600: + attributes.append(("tabRatio", self.tab_ratio)) + + # Store the firstSheet attribute when it isn't the default. + if self.worksheet_meta.firstsheet > 0: + firstsheet = self.worksheet_meta.firstsheet + 1 + attributes.append(("firstSheet", firstsheet)) + + # Store the activeTab attribute when it isn't the first sheet. + if self.worksheet_meta.activesheet > 0: + attributes.append(("activeTab", self.worksheet_meta.activesheet)) + + self._xml_empty_tag("workbookView", attributes) + + def _write_sheets(self): + # Write element. + self._xml_start_tag("sheets") + + id_num = 1 + for worksheet in self.worksheets(): + self._write_sheet(worksheet.name, id_num, worksheet.hidden) + id_num += 1 + + self._xml_end_tag("sheets") + + def _write_sheet(self, name, sheet_id, hidden): + # Write element. + attributes = [ + ("name", name), + ("sheetId", sheet_id), + ] + + if hidden: + attributes.append(("state", "hidden")) + + attributes.append(("r:id", "rId" + str(sheet_id))) + + self._xml_empty_tag("sheet", attributes) + + def _write_calc_pr(self): + # Write the element. + attributes = [("calcId", self.calc_id)] + + if self.calc_mode == "manual": + attributes.append(("calcMode", self.calc_mode)) + attributes.append(("calcOnSave", "0")) + elif self.calc_mode == "autoNoTable": + attributes.append(("calcMode", self.calc_mode)) + + if self.calc_on_load: + attributes.append(("fullCalcOnLoad", "1")) + + self._xml_empty_tag("calcPr", attributes) + + def _write_defined_names(self): + # Write the element. + if not self.defined_names: + return + + self._xml_start_tag("definedNames") + + for defined_name in self.defined_names: + self._write_defined_name(defined_name) + + self._xml_end_tag("definedNames") + + def _write_defined_name(self, defined_name): + # Write the element. + name = defined_name[0] + sheet_id = defined_name[1] + sheet_range = defined_name[2] + hidden = defined_name[3] + + attributes = [("name", name)] + + if sheet_id != -1: + attributes.append(("localSheetId", sheet_id)) + if hidden: + attributes.append(("hidden", 1)) + + self._xml_data_element("definedName", sheet_range, attributes) + + +# A metadata class to share data between worksheets. +class WorksheetMeta(object): + """ + A class to track worksheets data such as the active sheet and the + first sheet. + + """ + + def __init__(self): + self.activesheet = 0 + self.firstsheet = 0 diff --git a/xlsxwriter/python/xlsxwriter/worksheet.py b/xlsxwriter/python/xlsxwriter/worksheet.py new file mode 100644 index 0000000..eb2bc2c --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/worksheet.py @@ -0,0 +1,8367 @@ +############################################################################### +# +# Worksheet - A class for writing the Excel XLSX Worksheet file. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import datetime +import math +import os +import re +import tempfile + +from collections import defaultdict +from collections import namedtuple +from decimal import Decimal +from fractions import Fraction +from functools import wraps +from io import StringIO +from math import isinf +from math import isnan +from warnings import warn + +# Package imports. +from . import xmlwriter +from .format import Format +from .drawing import Drawing +from .shape import Shape +from .xmlwriter import XMLwriter +from .utility import xl_rowcol_to_cell +from .utility import xl_rowcol_to_cell_fast +from .utility import xl_cell_to_rowcol +from .utility import xl_col_to_name +from .utility import xl_range +from .utility import xl_color +from .utility import xl_pixel_width +from .utility import get_sparkline_style +from .utility import supported_datetime +from .utility import datetime_to_excel_datetime +from .utility import preserve_whitespace +from .utility import quote_sheetname +from .exceptions import DuplicateTableName +from .exceptions import OverlappingRange + +# Compile performance critical regular expressions. +re_control_chars_1 = re.compile("(_x[0-9a-fA-F]{4}_)") +re_control_chars_2 = re.compile(r"([\x00-\x08\x0b-\x1f])") + +re_dynamic_function = re.compile( + r""" + \bANCHORARRAY\( | + \bBYCOL\( | + \bBYROW\( | + \bCHOOSECOLS\( | + \bCHOOSEROWS\( | + \bDROP\( | + \bEXPAND\( | + \bFILTER\( | + \bHSTACK\( | + \bLAMBDA\( | + \bMAKEARRAY\( | + \bMAP\( | + \bRANDARRAY\( | + \bREDUCE\( | + \bSCAN\( | + \bSEQUENCE\( | + \bSINGLE\( | + \bSORT\( | + \bSORTBY\( | + \bSWITCH\( | + \bTAKE\( | + \bTEXTSPLIT\( | + \bTOCOL\( | + \bTOROW\( | + \bUNIQUE\( | + \bVSTACK\( | + \bWRAPCOLS\( | + \bWRAPROWS\( | + \bXLOOKUP\(""", + re.VERBOSE, +) + + +############################################################################### +# +# Decorator functions. +# +############################################################################### +def convert_cell_args(method): + """ + Decorator function to convert A1 notation in cell method calls + to the default row/col notation. + + """ + + @wraps(method) + def cell_wrapper(self, *args, **kwargs): + try: + # First arg is an int, default to row/col notation. + if args: + first_arg = args[0] + int(first_arg) + except ValueError: + # First arg isn't an int, convert to A1 notation. + new_args = xl_cell_to_rowcol(first_arg) + args = new_args + args[1:] + + return method(self, *args, **kwargs) + + return cell_wrapper + + +def convert_range_args(method): + """ + Decorator function to convert A1 notation in range method calls + to the default row/col notation. + + """ + + @wraps(method) + def cell_wrapper(self, *args, **kwargs): + try: + # First arg is an int, default to row/col notation. + if args: + int(args[0]) + except ValueError: + # First arg isn't an int, convert to A1 notation. + if ":" in args[0]: + cell_1, cell_2 = args[0].split(":") + row_1, col_1 = xl_cell_to_rowcol(cell_1) + row_2, col_2 = xl_cell_to_rowcol(cell_2) + else: + row_1, col_1 = xl_cell_to_rowcol(args[0]) + row_2, col_2 = row_1, col_1 + + new_args = [row_1, col_1, row_2, col_2] + new_args.extend(args[1:]) + args = new_args + + return method(self, *args, **kwargs) + + return cell_wrapper + + +def convert_column_args(method): + """ + Decorator function to convert A1 notation in columns method calls + to the default row/col notation. + + """ + + @wraps(method) + def column_wrapper(self, *args, **kwargs): + try: + # First arg is an int, default to row/col notation. + if args: + int(args[0]) + except ValueError: + # First arg isn't an int, convert to A1 notation. + cell_1, cell_2 = [col + "1" for col in args[0].split(":")] + _, col_1 = xl_cell_to_rowcol(cell_1) + _, col_2 = xl_cell_to_rowcol(cell_2) + new_args = [col_1, col_2] + new_args.extend(args[1:]) + args = new_args + + return method(self, *args, **kwargs) + + return column_wrapper + + +############################################################################### +# +# Named tuples used for cell types. +# +############################################################################### +cell_string_tuple = namedtuple("String", "string, format") +cell_number_tuple = namedtuple("Number", "number, format") +cell_blank_tuple = namedtuple("Blank", "format") +cell_boolean_tuple = namedtuple("Boolean", "boolean, format") +cell_formula_tuple = namedtuple("Formula", "formula, format, value") +cell_datetime_tuple = namedtuple("Datetime", "number, format") +cell_arformula_tuple = namedtuple( + "ArrayFormula", "formula, format, value, range, atype" +) +cell_rich_string_tuple = namedtuple("RichString", "string, format, raw_string") + + +############################################################################### +# +# Worksheet Class definition. +# +############################################################################### +class Worksheet(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Worksheet file. + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Worksheet, self).__init__() + + self.name = None + self.index = None + self.str_table = None + self.palette = None + self.constant_memory = 0 + self.tmpdir = None + self.is_chartsheet = False + + self.ext_sheets = [] + self.fileclosed = 0 + self.excel_version = 2007 + self.excel2003_style = False + + self.xls_rowmax = 1048576 + self.xls_colmax = 16384 + self.xls_strmax = 32767 + self.dim_rowmin = None + self.dim_rowmax = None + self.dim_colmin = None + self.dim_colmax = None + + self.col_info = {} + self.selections = [] + self.hidden = 0 + self.active = 0 + self.tab_color = 0 + self.top_left_cell = "" + + self.panes = [] + self.active_pane = 3 + self.selected = 0 + + self.page_setup_changed = False + self.paper_size = 0 + self.orientation = 1 + + self.print_options_changed = False + self.hcenter = False + self.vcenter = False + self.print_gridlines = False + self.screen_gridlines = True + self.print_headers = False + self.row_col_headers = False + + self.header_footer_changed = False + self.header = "" + self.footer = "" + self.header_footer_aligns = True + self.header_footer_scales = True + self.header_images = [] + self.footer_images = [] + self.header_images_list = [] + + self.margin_left = 0.7 + self.margin_right = 0.7 + self.margin_top = 0.75 + self.margin_bottom = 0.75 + self.margin_header = 0.3 + self.margin_footer = 0.3 + + self.repeat_row_range = "" + self.repeat_col_range = "" + self.print_area_range = "" + + self.page_order = 0 + self.black_white = 0 + self.draft_quality = 0 + self.print_comments = 0 + self.page_start = 0 + + self.fit_page = 0 + self.fit_width = 0 + self.fit_height = 0 + + self.hbreaks = [] + self.vbreaks = [] + + self.protect_options = {} + self.protected_ranges = [] + self.num_protected_ranges = 0 + self.set_cols = {} + self.set_rows = defaultdict(dict) + + self.zoom = 100 + self.zoom_scale_normal = 1 + self.print_scale = 100 + self.is_right_to_left = 0 + self.show_zeros = 1 + self.leading_zeros = 0 + + self.outline_row_level = 0 + self.outline_col_level = 0 + self.outline_style = 0 + self.outline_below = 1 + self.outline_right = 1 + self.outline_on = 1 + self.outline_changed = False + + self.original_row_height = 15 + self.default_row_height = 15 + self.default_row_pixels = 20 + self.default_col_width = 8.43 + self.default_col_pixels = 64 + self.default_date_pixels = 68 + self.default_row_zeroed = 0 + + self.names = {} + self.write_match = [] + self.table = defaultdict(dict) + self.merge = [] + self.merged_cells = {} + self.table_cells = {} + self.row_spans = {} + + self.has_vml = False + self.has_header_vml = False + self.has_comments = False + self.comments = defaultdict(dict) + self.comments_list = [] + self.comments_author = "" + self.comments_visible = 0 + self.vml_shape_id = 1024 + self.buttons_list = [] + self.vml_header_id = 0 + + self.autofilter_area = "" + self.autofilter_ref = None + self.filter_range = [] + self.filter_on = 0 + self.filter_cols = {} + self.filter_type = {} + self.filter_cells = {} + + self.row_sizes = {} + self.col_size_changed = False + self.row_size_changed = False + + self.last_shape_id = 1 + self.rel_count = 0 + self.hlink_count = 0 + self.hlink_refs = [] + self.external_hyper_links = [] + self.external_drawing_links = [] + self.external_comment_links = [] + self.external_vml_links = [] + self.external_table_links = [] + self.external_background_links = [] + self.drawing_links = [] + self.vml_drawing_links = [] + self.charts = [] + self.images = [] + self.tables = [] + self.sparklines = [] + self.shapes = [] + self.shape_hash = {} + self.drawing = 0 + self.drawing_rels = {} + self.drawing_rels_id = 0 + self.vml_drawing_rels = {} + self.vml_drawing_rels_id = 0 + self.background_image = None + self.background_bytes = False + + self.rstring = "" + self.previous_row = 0 + + self.validations = [] + self.cond_formats = {} + self.data_bars_2010 = [] + self.use_data_bars_2010 = False + self.dxf_priority = 1 + self.page_view = 0 + + self.vba_codename = None + + self.date_1904 = False + self.hyperlinks = defaultdict(dict) + + self.strings_to_numbers = False + self.strings_to_urls = True + self.nan_inf_to_errors = False + self.strings_to_formulas = True + + self.default_date_format = None + self.default_url_format = None + self.remove_timezone = False + self.max_url_length = 2079 + + self.row_data_filename = None + self.row_data_fh = None + self.worksheet_meta = None + self.vml_data_id = None + self.vml_shape_id = None + + self.row_data_filename = None + self.row_data_fh = None + self.row_data_fh_closed = False + + self.vertical_dpi = 0 + self.horizontal_dpi = 0 + + self.write_handlers = {} + + self.ignored_errors = None + + self.has_dynamic_arrays = False + self.use_future_functions = False + + # Utility function for writing different types of strings. + def _write_token_as_string(self, token, row, col, *args): + # Map the data to the appropriate write_*() method. + if token == "": + return self._write_blank(row, col, *args) + + if self.strings_to_formulas and token.startswith("="): + return self._write_formula(row, col, *args) + + if token.startswith("{=") and token.endswith("}"): + return self._write_formula(row, col, *args) + + if ( + ":" in token + and self.strings_to_urls + and ( + re.match("(ftp|http)s?://", token) + or re.match("mailto:", token) + or re.match("(in|ex)ternal:", token) + ) + ): + return self._write_url(row, col, *args) + + if self.strings_to_numbers: + try: + f = float(token) + if self.nan_inf_to_errors or (not isnan(f) and not isinf(f)): + return self._write_number(row, col, f, *args[1:]) + except ValueError: + # Not a number, write as a string. + pass + + return self._write_string(row, col, *args) + + else: + # We have a plain string. + return self._write_string(row, col, *args) + + @convert_cell_args + def write(self, row, col, *args): + """ + Write data to a worksheet cell by calling the appropriate write_*() + method based on the type of data being passed. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + *args: Args to pass to sub functions. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + other: Return value of called method. + + """ + return self._write(row, col, *args) + + # Undecorated version of write(). + def _write(self, row, col, *args): + # Check the number of args passed. + if not args: + raise TypeError("write() takes at least 4 arguments (3 given)") + + # The first arg should be the token for all write calls. + token = args[0] + + # Avoid isinstance() for better performance. + token_type = token.__class__ + + # Check for any user defined type handlers with callback functions. + if token_type in self.write_handlers: + write_handler = self.write_handlers[token_type] + function_return = write_handler(self, row, col, *args) + + # If the return value is None then the callback has returned + # control to this function and we should continue as + # normal. Otherwise we return the value to the caller and exit. + if function_return is None: + pass + else: + return function_return + + # Write None as a blank cell. + if token is None: + return self._write_blank(row, col, *args) + + # Check for standard Python types. + if token_type is bool: + return self._write_boolean(row, col, *args) + + if token_type in (float, int, Decimal, Fraction): + return self._write_number(row, col, *args) + + if token_type is str: + return self._write_token_as_string(token, row, col, *args) + + if token_type in ( + datetime.datetime, + datetime.date, + datetime.time, + datetime.timedelta, + ): + return self._write_datetime(row, col, *args) + + # Resort to isinstance() for subclassed primitives. + + # Write number types. + if isinstance(token, (float, int, Decimal, Fraction)): + return self._write_number(row, col, *args) + + # Write string types. + if isinstance(token, str): + return self._write_token_as_string(token, row, col, *args) + + # Write boolean types. + if isinstance(token, bool): + return self._write_boolean(row, col, *args) + + # Write datetime objects. + if supported_datetime(token): + return self._write_datetime(row, col, *args) + + # We haven't matched a supported type. Try float. + try: + f = float(token) + return self._write_number(row, col, f, *args[1:]) + except ValueError: + pass + except TypeError: + raise TypeError("Unsupported type %s in write()" % type(token)) + + # Finally try string. + try: + str(token) + return self._write_string(row, col, *args) + except ValueError: + raise TypeError("Unsupported type %s in write()" % type(token)) + + @convert_cell_args + def write_string(self, row, col, string, cell_format=None): + """ + Write a string to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + string: Cell data. Str. + format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String truncated to 32k characters. + + """ + return self._write_string(row, col, string, cell_format) + + # Undecorated version of write_string(). + def _write_string(self, row, col, string, cell_format=None): + str_error = 0 + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Check that the string is < 32767 chars. + if len(string) > self.xls_strmax: + string = string[: self.xls_strmax] + str_error = -2 + + # Write a shared string or an in-line string in constant_memory mode. + if not self.constant_memory: + string_index = self.str_table._get_shared_string_index(string) + else: + string_index = string + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_string_tuple(string_index, cell_format) + + return str_error + + @convert_cell_args + def write_number(self, row, col, number, cell_format=None): + """ + Write a number to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + number: Cell data. Int or float. + cell_format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_number(row, col, number, cell_format) + + # Undecorated version of write_number(). + def _write_number(self, row, col, number, cell_format=None): + if isnan(number) or isinf(number): + if self.nan_inf_to_errors: + if isnan(number): + return self._write_formula(row, col, "#NUM!", cell_format, "#NUM!") + elif number == math.inf: + return self._write_formula(row, col, "1/0", cell_format, "#DIV/0!") + elif number == -math.inf: + return self._write_formula(row, col, "-1/0", cell_format, "#DIV/0!") + else: + raise TypeError( + "NAN/INF not supported in write_number() " + "without 'nan_inf_to_errors' Workbook() option" + ) + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_number_tuple(number, cell_format) + + return 0 + + @convert_cell_args + def write_blank(self, row, col, blank, cell_format=None): + """ + Write a blank cell with formatting to a worksheet cell. The blank + token is ignored and the format only is written to the cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + blank: Any value. It is ignored. + cell_format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_blank(row, col, blank, cell_format) + + # Undecorated version of write_blank(). + def _write_blank(self, row, col, blank, cell_format=None): + # Don't write a blank cell unless it has a format. + if cell_format is None: + return 0 + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_blank_tuple(cell_format) + + return 0 + + @convert_cell_args + def write_formula(self, row, col, formula, cell_format=None, value=0): + """ + Write a formula to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + formula: Cell formula. + cell_format: An optional cell Format object. + value: An optional value for the formula. Default is 0. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Formula can't be None or empty. + + """ + # Check that row and col are valid and store max and min values. + return self._write_formula(row, col, formula, cell_format, value) + + # Undecorated version of write_formula(). + def _write_formula(self, row, col, formula, cell_format=None, value=0): + if self._check_dimensions(row, col): + return -1 + + if formula is None or formula == "": + warn("Formula can't be None or empty") + return -1 + + # Check for dynamic array functions. + if re_dynamic_function.search(formula): + return self.write_dynamic_array_formula( + row, col, row, col, formula, cell_format, value + ) + + # Hand off array formulas. + if formula.startswith("{") and formula.endswith("}"): + return self._write_array_formula( + row, col, row, col, formula, cell_format, value + ) + + # Modify the formula string, as needed. + formula = self._prepare_formula(formula) + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_formula_tuple(formula, cell_format, value) + + return 0 + + @convert_range_args + def write_array_formula( + self, + first_row, + first_col, + last_row, + last_col, + formula, + cell_format=None, + value=0, + ): + """ + Write a formula to a worksheet cell/range. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + formula: Cell formula. + cell_format: An optional cell Format object. + value: An optional value for the formula. Default is 0. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check for dynamic array functions. + if re_dynamic_function.search(formula): + return self.write_dynamic_array_formula( + first_row, first_col, last_row, last_col, formula, cell_format, value + ) + + return self._write_array_formula( + first_row, + first_col, + last_row, + last_col, + formula, + cell_format, + value, + "static", + ) + + @convert_range_args + def write_dynamic_array_formula( + self, + first_row, + first_col, + last_row, + last_col, + formula, + cell_format=None, + value=0, + ): + """ + Write a dynamic array formula to a worksheet cell/range. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + formula: Cell formula. + cell_format: An optional cell Format object. + value: An optional value for the formula. Default is 0. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + error = self._write_array_formula( + first_row, + first_col, + last_row, + last_col, + formula, + cell_format, + value, + "dynamic", + ) + + if error == 0: + self.has_dynamic_arrays = True + + return error + + # Utility method to strip equal sign and array braces from a formula and + # also expand out future and dynamic array formulas. + def _prepare_formula(self, formula): + # Remove array formula braces and the leading =. + if formula.startswith("{"): + formula = formula[1:] + if formula.startswith("="): + formula = formula[1:] + if formula.endswith("}"): + formula = formula[:-1] + + # Check if formula is already expanded by the user. + if "_xlfn." in formula: + return formula + + # Expand dynamic formulas. + formula = re.sub(r"\bANCHORARRAY\(", "_xlfn.ANCHORARRAY(", formula) + formula = re.sub(r"\bBYCOL\(", "_xlfn.BYCOL(", formula) + formula = re.sub(r"\bBYROW\(", "_xlfn.BYROW(", formula) + formula = re.sub(r"\bCHOOSECOLS\(", "_xlfn.CHOOSECOLS(", formula) + formula = re.sub(r"\bCHOOSEROWS\(", "_xlfn.CHOOSEROWS(", formula) + formula = re.sub(r"\bDROP\(", "_xlfn.DROP(", formula) + formula = re.sub(r"\bEXPAND\(", "_xlfn.EXPAND(", formula) + formula = re.sub(r"\bFILTER\(", "_xlfn._xlws.FILTER(", formula) + formula = re.sub(r"\bHSTACK\(", "_xlfn.HSTACK(", formula) + formula = re.sub(r"\bLAMBDA\(", "_xlfn.LAMBDA(", formula) + formula = re.sub(r"\bMAKEARRAY\(", "_xlfn.MAKEARRAY(", formula) + formula = re.sub(r"\bMAP\(", "_xlfn.MAP(", formula) + formula = re.sub(r"\bRANDARRAY\(", "_xlfn.RANDARRAY(", formula) + formula = re.sub(r"\bREDUCE\(", "_xlfn.REDUCE(", formula) + formula = re.sub(r"\bSCAN\(", "_xlfn.SCAN(", formula) + formula = re.sub(r"\SINGLE\(", "_xlfn.SINGLE(", formula) + formula = re.sub(r"\bSEQUENCE\(", "_xlfn.SEQUENCE(", formula) + formula = re.sub(r"\bSORT\(", "_xlfn._xlws.SORT(", formula) + formula = re.sub(r"\bSORTBY\(", "_xlfn.SORTBY(", formula) + formula = re.sub(r"\bSWITCH\(", "_xlfn.SWITCH(", formula) + formula = re.sub(r"\bTAKE\(", "_xlfn.TAKE(", formula) + formula = re.sub(r"\bTEXTSPLIT\(", "_xlfn.TEXTSPLIT(", formula) + formula = re.sub(r"\bTOCOL\(", "_xlfn.TOCOL(", formula) + formula = re.sub(r"\bTOROW\(", "_xlfn.TOROW(", formula) + formula = re.sub(r"\bUNIQUE\(", "_xlfn.UNIQUE(", formula) + formula = re.sub(r"\bVSTACK\(", "_xlfn.VSTACK(", formula) + formula = re.sub(r"\bWRAPCOLS\(", "_xlfn.WRAPCOLS(", formula) + formula = re.sub(r"\bWRAPROWS\(", "_xlfn.WRAPROWS(", formula) + formula = re.sub(r"\bXLOOKUP\(", "_xlfn.XLOOKUP(", formula) + + if not self.use_future_functions: + return formula + + formula = re.sub(r"\bACOTH\(", "_xlfn.ACOTH(", formula) + formula = re.sub(r"\bACOT\(", "_xlfn.ACOT(", formula) + formula = re.sub(r"\bAGGREGATE\(", "_xlfn.AGGREGATE(", formula) + formula = re.sub(r"\bARABIC\(", "_xlfn.ARABIC(", formula) + formula = re.sub(r"\bARRAYTOTEXT\(", "_xlfn.ARRAYTOTEXT(", formula) + formula = re.sub(r"\bBASE\(", "_xlfn.BASE(", formula) + formula = re.sub(r"\bBETA.DIST\(", "_xlfn.BETA.DIST(", formula) + formula = re.sub(r"\bBETA.INV\(", "_xlfn.BETA.INV(", formula) + formula = re.sub(r"\bBINOM.DIST.RANGE\(", "_xlfn.BINOM.DIST.RANGE(", formula) + formula = re.sub(r"\bBINOM.DIST\(", "_xlfn.BINOM.DIST(", formula) + formula = re.sub(r"\bBINOM.INV\(", "_xlfn.BINOM.INV(", formula) + formula = re.sub(r"\bBITAND\(", "_xlfn.BITAND(", formula) + formula = re.sub(r"\bBITLSHIFT\(", "_xlfn.BITLSHIFT(", formula) + formula = re.sub(r"\bBITOR\(", "_xlfn.BITOR(", formula) + formula = re.sub(r"\bBITRSHIFT\(", "_xlfn.BITRSHIFT(", formula) + formula = re.sub(r"\bBITXOR\(", "_xlfn.BITXOR(", formula) + formula = re.sub(r"\bCEILING.MATH\(", "_xlfn.CEILING.MATH(", formula) + formula = re.sub(r"\bCEILING.PRECISE\(", "_xlfn.CEILING.PRECISE(", formula) + formula = re.sub(r"\bCHISQ.DIST.RT\(", "_xlfn.CHISQ.DIST.RT(", formula) + formula = re.sub(r"\bCHISQ.DIST\(", "_xlfn.CHISQ.DIST(", formula) + formula = re.sub(r"\bCHISQ.INV.RT\(", "_xlfn.CHISQ.INV.RT(", formula) + formula = re.sub(r"\bCHISQ.INV\(", "_xlfn.CHISQ.INV(", formula) + formula = re.sub(r"\bCHISQ.TEST\(", "_xlfn.CHISQ.TEST(", formula) + formula = re.sub(r"\bCOMBINA\(", "_xlfn.COMBINA(", formula) + formula = re.sub(r"\bCONCAT\(", "_xlfn.CONCAT(", formula) + formula = re.sub(r"\bCONFIDENCE.NORM\(", "_xlfn.CONFIDENCE.NORM(", formula) + formula = re.sub(r"\bCONFIDENCE.T\(", "_xlfn.CONFIDENCE.T(", formula) + formula = re.sub(r"\bCOTH\(", "_xlfn.COTH(", formula) + formula = re.sub(r"\bCOT\(", "_xlfn.COT(", formula) + formula = re.sub(r"\bCOVARIANCE.P\(", "_xlfn.COVARIANCE.P(", formula) + formula = re.sub(r"\bCOVARIANCE.S\(", "_xlfn.COVARIANCE.S(", formula) + formula = re.sub(r"\bCSCH\(", "_xlfn.CSCH(", formula) + formula = re.sub(r"\bCSC\(", "_xlfn.CSC(", formula) + formula = re.sub(r"\bDAYS\(", "_xlfn.DAYS(", formula) + formula = re.sub(r"\bDECIMAL\(", "_xlfn.DECIMAL(", formula) + formula = re.sub(r"\bERF.PRECISE\(", "_xlfn.ERF.PRECISE(", formula) + formula = re.sub(r"\bERFC.PRECISE\(", "_xlfn.ERFC.PRECISE(", formula) + formula = re.sub(r"\bEXPON.DIST\(", "_xlfn.EXPON.DIST(", formula) + formula = re.sub(r"\bF.DIST.RT\(", "_xlfn.F.DIST.RT(", formula) + formula = re.sub(r"\bF.DIST\(", "_xlfn.F.DIST(", formula) + formula = re.sub(r"\bF.INV.RT\(", "_xlfn.F.INV.RT(", formula) + formula = re.sub(r"\bF.INV\(", "_xlfn.F.INV(", formula) + formula = re.sub(r"\bF.TEST\(", "_xlfn.F.TEST(", formula) + formula = re.sub(r"\bFILTERXML\(", "_xlfn.FILTERXML(", formula) + formula = re.sub(r"\bFLOOR.MATH\(", "_xlfn.FLOOR.MATH(", formula) + formula = re.sub(r"\bFLOOR.PRECISE\(", "_xlfn.FLOOR.PRECISE(", formula) + formula = re.sub( + r"\bFORECAST.ETS.CONFINT\(", "_xlfn.FORECAST.ETS.CONFINT(", formula + ) + formula = re.sub( + r"\bFORECAST.ETS.SEASONALITY\(", "_xlfn.FORECAST.ETS.SEASONALITY(", formula + ) + formula = re.sub(r"\bFORECAST.ETS.STAT\(", "_xlfn.FORECAST.ETS.STAT(", formula) + formula = re.sub(r"\bFORECAST.ETS\(", "_xlfn.FORECAST.ETS(", formula) + formula = re.sub(r"\bFORECAST.LINEAR\(", "_xlfn.FORECAST.LINEAR(", formula) + formula = re.sub(r"\bFORMULATEXT\(", "_xlfn.FORMULATEXT(", formula) + formula = re.sub(r"\bGAMMA.DIST\(", "_xlfn.GAMMA.DIST(", formula) + formula = re.sub(r"\bGAMMA.INV\(", "_xlfn.GAMMA.INV(", formula) + formula = re.sub(r"\bGAMMALN.PRECISE\(", "_xlfn.GAMMALN.PRECISE(", formula) + formula = re.sub(r"\bGAMMA\(", "_xlfn.GAMMA(", formula) + formula = re.sub(r"\bGAUSS\(", "_xlfn.GAUSS(", formula) + formula = re.sub(r"\bHYPGEOM.DIST\(", "_xlfn.HYPGEOM.DIST(", formula) + formula = re.sub(r"\bIFNA\(", "_xlfn.IFNA(", formula) + formula = re.sub(r"\bIFS\(", "_xlfn.IFS(", formula) + formula = re.sub(r"\bIMAGE\(", "_xlfn.IMAGE(", formula) + formula = re.sub(r"\bIMCOSH\(", "_xlfn.IMCOSH(", formula) + formula = re.sub(r"\bIMCOT\(", "_xlfn.IMCOT(", formula) + formula = re.sub(r"\bIMCSCH\(", "_xlfn.IMCSCH(", formula) + formula = re.sub(r"\bIMCSC\(", "_xlfn.IMCSC(", formula) + formula = re.sub(r"\bIMSECH\(", "_xlfn.IMSECH(", formula) + formula = re.sub(r"\bIMSEC\(", "_xlfn.IMSEC(", formula) + formula = re.sub(r"\bIMSINH\(", "_xlfn.IMSINH(", formula) + formula = re.sub(r"\bIMTAN\(", "_xlfn.IMTAN(", formula) + formula = re.sub(r"\bISFORMULA\(", "_xlfn.ISFORMULA(", formula) + formula = re.sub(r"\bISOMITTED\(", "_xlfn.ISOMITTED(", formula) + formula = re.sub(r"\bISOWEEKNUM\(", "_xlfn.ISOWEEKNUM(", formula) + formula = re.sub(r"\bLET\(", "_xlfn.LET(", formula) + formula = re.sub(r"\bLOGNORM.DIST\(", "_xlfn.LOGNORM.DIST(", formula) + formula = re.sub(r"\bLOGNORM.INV\(", "_xlfn.LOGNORM.INV(", formula) + formula = re.sub(r"\bMAXIFS\(", "_xlfn.MAXIFS(", formula) + formula = re.sub(r"\bMINIFS\(", "_xlfn.MINIFS(", formula) + formula = re.sub(r"\bMODE.MULT\(", "_xlfn.MODE.MULT(", formula) + formula = re.sub(r"\bMODE.SNGL\(", "_xlfn.MODE.SNGL(", formula) + formula = re.sub(r"\bMUNIT\(", "_xlfn.MUNIT(", formula) + formula = re.sub(r"\bNEGBINOM.DIST\(", "_xlfn.NEGBINOM.DIST(", formula) + formula = re.sub(r"\bNORM.DIST\(", "_xlfn.NORM.DIST(", formula) + formula = re.sub(r"\bNORM.INV\(", "_xlfn.NORM.INV(", formula) + formula = re.sub(r"\bNORM.S.DIST\(", "_xlfn.NORM.S.DIST(", formula) + formula = re.sub(r"\bNORM.S.INV\(", "_xlfn.NORM.S.INV(", formula) + formula = re.sub(r"\bNUMBERVALUE\(", "_xlfn.NUMBERVALUE(", formula) + formula = re.sub(r"\bPDURATION\(", "_xlfn.PDURATION(", formula) + formula = re.sub(r"\bPERCENTILE.EXC\(", "_xlfn.PERCENTILE.EXC(", formula) + formula = re.sub(r"\bPERCENTILE.INC\(", "_xlfn.PERCENTILE.INC(", formula) + formula = re.sub(r"\bPERCENTRANK.EXC\(", "_xlfn.PERCENTRANK.EXC(", formula) + formula = re.sub(r"\bPERCENTRANK.INC\(", "_xlfn.PERCENTRANK.INC(", formula) + formula = re.sub(r"\bPERMUTATIONA\(", "_xlfn.PERMUTATIONA(", formula) + formula = re.sub(r"\bPHI\(", "_xlfn.PHI(", formula) + formula = re.sub(r"\bPOISSON.DIST\(", "_xlfn.POISSON.DIST(", formula) + formula = re.sub(r"\bQUARTILE.EXC\(", "_xlfn.QUARTILE.EXC(", formula) + formula = re.sub(r"\bQUARTILE.INC\(", "_xlfn.QUARTILE.INC(", formula) + formula = re.sub(r"\bQUERYSTRING\(", "_xlfn.QUERYSTRING(", formula) + formula = re.sub(r"\bRANK.AVG\(", "_xlfn.RANK.AVG(", formula) + formula = re.sub(r"\bRANK.EQ\(", "_xlfn.RANK.EQ(", formula) + formula = re.sub(r"\bRRI\(", "_xlfn.RRI(", formula) + formula = re.sub(r"\bSECH\(", "_xlfn.SECH(", formula) + formula = re.sub(r"\bSEC\(", "_xlfn.SEC(", formula) + formula = re.sub(r"\bSHEETS\(", "_xlfn.SHEETS(", formula) + formula = re.sub(r"\bSHEET\(", "_xlfn.SHEET(", formula) + formula = re.sub(r"\bSKEW.P\(", "_xlfn.SKEW.P(", formula) + formula = re.sub(r"\bSTDEV.P\(", "_xlfn.STDEV.P(", formula) + formula = re.sub(r"\bSTDEV.S\(", "_xlfn.STDEV.S(", formula) + formula = re.sub(r"\bT.DIST.2T\(", "_xlfn.T.DIST.2T(", formula) + formula = re.sub(r"\bT.DIST.RT\(", "_xlfn.T.DIST.RT(", formula) + formula = re.sub(r"\bT.DIST\(", "_xlfn.T.DIST(", formula) + formula = re.sub(r"\bT.INV.2T\(", "_xlfn.T.INV.2T(", formula) + formula = re.sub(r"\bT.INV\(", "_xlfn.T.INV(", formula) + formula = re.sub(r"\bT.TEST\(", "_xlfn.T.TEST(", formula) + formula = re.sub(r"\bTEXTAFTER\(", "_xlfn.TEXTAFTER(", formula) + formula = re.sub(r"\bTEXTBEFORE\(", "_xlfn.TEXTBEFORE(", formula) + formula = re.sub(r"\bTEXTJOIN\(", "_xlfn.TEXTJOIN(", formula) + formula = re.sub(r"\bUNICHAR\(", "_xlfn.UNICHAR(", formula) + formula = re.sub(r"\bUNICODE\(", "_xlfn.UNICODE(", formula) + formula = re.sub(r"\bVALUETOTEXT\(", "_xlfn.VALUETOTEXT(", formula) + formula = re.sub(r"\bVAR.P\(", "_xlfn.VAR.P(", formula) + formula = re.sub(r"\bVAR.S\(", "_xlfn.VAR.S(", formula) + formula = re.sub(r"\bWEBSERVICE\(", "_xlfn.WEBSERVICE(", formula) + formula = re.sub(r"\bWEIBULL.DIST\(", "_xlfn.WEIBULL.DIST(", formula) + formula = re.sub(r"\bXMATCH\(", "_xlfn.XMATCH(", formula) + formula = re.sub(r"\bXOR\(", "_xlfn.XOR(", formula) + formula = re.sub(r"\bZ.TEST\(", "_xlfn.Z.TEST(", formula) + + return formula + + # Undecorated version of write_array_formula() and + # write_dynamic_array_formula(). + def _write_array_formula( + self, + first_row, + first_col, + last_row, + last_col, + formula, + cell_format=None, + value=0, + atype="static", + ): + # Swap last row/col with first row/col as necessary. + if first_row > last_row: + first_row, last_row = last_row, first_row + if first_col > last_col: + first_col, last_col = last_col, first_col + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(first_row, first_col): + return -1 + if self._check_dimensions(last_row, last_col): + return -1 + + # Define array range + if first_row == last_row and first_col == last_col: + cell_range = xl_rowcol_to_cell(first_row, first_col) + else: + cell_range = ( + xl_rowcol_to_cell(first_row, first_col) + + ":" + + xl_rowcol_to_cell(last_row, last_col) + ) + + # Modify the formula string, as needed. + formula = self._prepare_formula(formula) + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and first_row > self.previous_row: + self._write_single_row(first_row) + + # Store the cell data in the worksheet data table. + self.table[first_row][first_col] = cell_arformula_tuple( + formula, cell_format, value, cell_range, atype + ) + + # Pad out the rest of the area with formatted zeroes. + if not self.constant_memory: + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if row != first_row or col != first_col: + self._write_number(row, col, 0, cell_format) + + return 0 + + @convert_cell_args + def write_datetime(self, row, col, date, cell_format=None): + """ + Write a date or time to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + date: Date and/or time as a datetime object. + cell_format: A cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_datetime(row, col, date, cell_format) + + # Undecorated version of write_datetime(). + def _write_datetime(self, row, col, date, cell_format=None): + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Convert datetime to an Excel date. + number = self._convert_date_time(date) + + # Add the default date format. + if cell_format is None: + cell_format = self.default_date_format + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_datetime_tuple(number, cell_format) + + return 0 + + @convert_cell_args + def write_boolean(self, row, col, boolean, cell_format=None): + """ + Write a boolean value to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + boolean: Cell data. bool type. + cell_format: An optional cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + return self._write_boolean(row, col, boolean, cell_format) + + # Undecorated version of write_boolean(). + def _write_boolean(self, row, col, boolean, cell_format=None): + # Check that row and col are valid and store max and min values. + if self._check_dimensions(row, col): + return -1 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + if boolean: + value = 1 + else: + value = 0 + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_boolean_tuple(value, cell_format) + + return 0 + + # Write a hyperlink. This is comprised of two elements: the displayed + # string and the non-displayed link. The displayed string is the same as + # the link unless an alternative string is specified. The display string + # is written using the write_string() method. Therefore the max characters + # string limit applies. + # + # The hyperlink can be to a http, ftp, mail, internal sheet, or external + # directory urls. + @convert_cell_args + def write_url(self, row, col, url, cell_format=None, string=None, tip=None): + """ + Write a hyperlink to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + url: Hyperlink url. + format: An optional cell Format object. + string: An optional display string for the hyperlink. + tip: An optional tooltip. + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String longer than 32767 characters. + -3: URL longer than Excel limit of 255 characters. + -4: Exceeds Excel limit of 65,530 urls per worksheet. + """ + return self._write_url(row, col, url, cell_format, string, tip) + + # Undecorated version of write_url(). + def _write_url(self, row, col, url, cell_format=None, string=None, tip=None): + # Check that row and col are valid and store max and min values + if self._check_dimensions(row, col): + return -1 + + # Set the displayed string to the URL unless defined by the user. + if string is None: + string = url + + # Default to external link type such as 'http://' or 'external:'. + link_type = 1 + + # Remove the URI scheme from internal links. + if url.startswith("internal:"): + url = url.replace("internal:", "") + string = string.replace("internal:", "") + link_type = 2 + + # Remove the URI scheme from external links and change the directory + # separator from Unix to Dos. + external = False + if url.startswith("external:"): + url = url.replace("external:", "") + url = url.replace("/", "\\") + string = string.replace("external:", "") + string = string.replace("/", "\\") + external = True + + # Strip the mailto header. + string = string.replace("mailto:", "") + + # Check that the string is < 32767 chars + str_error = 0 + if len(string) > self.xls_strmax: + warn( + "Ignoring URL since it exceeds Excel's string limit of " + "32767 characters" + ) + return -2 + + # Copy string for use in hyperlink elements. + url_str = string + + # External links to URLs and to other Excel workbooks have slightly + # different characteristics that we have to account for. + if link_type == 1: + # Split url into the link and optional anchor/location. + if "#" in url: + url, url_str = url.split("#", 1) + else: + url_str = None + + url = self._escape_url(url) + + if url_str is not None and not external: + url_str = self._escape_url(url_str) + + # Add the file:/// URI to the url for Windows style "C:/" link and + # Network shares. + if re.match(r"\w:", url) or re.match(r"\\", url): + url = "file:///" + url + + # Convert a .\dir\file.xlsx link to dir\file.xlsx. + url = re.sub(r"^\.\\", "", url) + + # Excel limits the escaped URL and location/anchor to 255 characters. + tmp_url_str = url_str or "" + max_url = self.max_url_length + if len(url) > max_url or len(tmp_url_str) > max_url: + warn( + "Ignoring URL '%s' with link or location/anchor > %d " + "characters since it exceeds Excel's limit for URLS" % (url, max_url) + ) + return -3 + + # Check the limit of URLS per worksheet. + self.hlink_count += 1 + + if self.hlink_count > 65530: + warn( + "Ignoring URL '%s' since it exceeds Excel's limit of " + "65,530 URLS per worksheet." % url + ) + return -4 + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Add the default URL format. + if cell_format is None: + cell_format = self.default_url_format + + # Write the hyperlink string. + self._write_string(row, col, string, cell_format) + + # Store the hyperlink data in a separate structure. + self.hyperlinks[row][col] = { + "link_type": link_type, + "url": url, + "str": url_str, + "tip": tip, + } + + return str_error + + @convert_cell_args + def write_rich_string(self, row, col, *args): + """ + Write a "rich" string with multiple formats to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + string_parts: String and format pairs. + cell_format: Optional Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String truncated to 32k characters. + -3: 2 consecutive formats used. + -4: Empty string used. + -5: Insufficient parameters. + + """ + + return self._write_rich_string(row, col, *args) + + # Undecorated version of write_rich_string(). + def _write_rich_string(self, row, col, *args): + tokens = list(args) + cell_format = None + string_index = 0 + raw_string = "" + + # Check that row and col are valid and store max and min values + if self._check_dimensions(row, col): + return -1 + + # If the last arg is a format we use it as the cell format. + if isinstance(tokens[-1], Format): + cell_format = tokens.pop() + + # Create a temp XMLWriter object and use it to write the rich string + # XML to a string. + fh = StringIO() + self.rstring = XMLwriter() + self.rstring._set_filehandle(fh) + + # Create a temp format with the default font for unformatted fragments. + default = Format() + + # Convert list of format, string tokens to pairs of (format, string) + # except for the first string fragment which doesn't require a default + # formatting run. Use the default for strings without a leading format. + fragments = [] + previous = "format" + pos = 0 + + if len(tokens) <= 2: + warn( + "You must specify more than 2 format/fragments for rich " + "strings. Ignoring input in write_rich_string()." + ) + return -5 + + for token in tokens: + if not isinstance(token, Format): + # Token is a string. + if previous != "format": + # If previous token wasn't a format add one before string. + fragments.append(default) + fragments.append(token) + else: + # If previous token was a format just add the string. + fragments.append(token) + + if token == "": + warn( + "Excel doesn't allow empty strings in rich strings. " + "Ignoring input in write_rich_string()." + ) + return -4 + + # Keep track of unformatted string. + raw_string += token + previous = "string" + else: + # Can't allow 2 formats in a row. + if previous == "format" and pos > 0: + warn( + "Excel doesn't allow 2 consecutive formats in rich " + "strings. Ignoring input in write_rich_string()." + ) + return -3 + + # Token is a format object. Add it to the fragment list. + fragments.append(token) + previous = "format" + + pos += 1 + + # If the first token is a string start the element. + if not isinstance(fragments[0], Format): + self.rstring._xml_start_tag("r") + + # Write the XML elements for the $format $string fragments. + for token in fragments: + if isinstance(token, Format): + # Write the font run. + self.rstring._xml_start_tag("r") + self._write_font(token) + else: + # Write the string fragment part, with whitespace handling. + attributes = [] + + if preserve_whitespace(token): + attributes.append(("xml:space", "preserve")) + + self.rstring._xml_data_element("t", token, attributes) + self.rstring._xml_end_tag("r") + + # Read the in-memory string. + string = self.rstring.fh.getvalue() + + # Check that the string is < 32767 chars. + if len(raw_string) > self.xls_strmax: + warn( + "String length must be less than or equal to Excel's limit " + "of 32,767 characters in write_rich_string()." + ) + return -2 + + # Write a shared string or an in-line string in constant_memory mode. + if not self.constant_memory: + string_index = self.str_table._get_shared_string_index(string) + else: + string_index = string + + # Write previous row if in in-line string constant_memory mode. + if self.constant_memory and row > self.previous_row: + self._write_single_row(row) + + # Store the cell data in the worksheet data table. + self.table[row][col] = cell_rich_string_tuple( + string_index, cell_format, raw_string + ) + + return 0 + + def add_write_handler(self, user_type, user_function): + """ + Add a callback function to the write() method to handle user defined + types. + + Args: + user_type: The user type() to match on. + user_function: The user defined function to write the type data. + Returns: + Nothing. + + """ + + self.write_handlers[user_type] = user_function + + @convert_cell_args + def write_row(self, row, col, data, cell_format=None): + """ + Write a row of data starting from (row, col). + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + data: A list of tokens to be written with write(). + format: An optional cell Format object. + Returns: + 0: Success. + other: Return value of write() method. + + """ + for token in data: + error = self._write(row, col, token, cell_format) + if error: + return error + col += 1 + + return 0 + + @convert_cell_args + def write_column(self, row, col, data, cell_format=None): + """ + Write a column of data starting from (row, col). + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + data: A list of tokens to be written with write(). + format: An optional cell Format object. + Returns: + 0: Success. + other: Return value of write() method. + + """ + for token in data: + error = self._write(row, col, token, cell_format) + if error: + return error + row += 1 + + return 0 + + @convert_cell_args + def insert_image(self, row, col, filename, options=None): + """ + Insert an image with its top-left corner in a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + filename: Path and filename for in supported formats. + options: Position, scale, url and data stream of the image. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert image at (%d, %d)." % (row, col)) + return -1 + + if options is None: + options = {} + + x_offset = options.get("x_offset", 0) + y_offset = options.get("y_offset", 0) + x_scale = options.get("x_scale", 1) + y_scale = options.get("y_scale", 1) + url = options.get("url", None) + tip = options.get("tip", None) + anchor = options.get("object_position", 2) + image_data = options.get("image_data", None) + description = options.get("description", None) + decorative = options.get("decorative", False) + + # For backward compatibility with older parameter name. + anchor = options.get("positioning", anchor) + + if not image_data and not os.path.exists(filename): + warn("Image file '%s' not found." % filename) + return -1 + + self.images.append( + [ + row, + col, + filename, + x_offset, + y_offset, + x_scale, + y_scale, + url, + tip, + anchor, + image_data, + description, + decorative, + ] + ) + return 0 + + @convert_cell_args + def insert_textbox(self, row, col, text, options=None): + """ + Insert an textbox with its top-left corner in a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + text: The text for the textbox. + options: Textbox options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert textbox at (%d, %d)." % (row, col)) + return -1 + + if text is None: + text = "" + + if options is None: + options = {} + + x_offset = options.get("x_offset", 0) + y_offset = options.get("y_offset", 0) + x_scale = options.get("x_scale", 1) + y_scale = options.get("y_scale", 1) + anchor = options.get("object_position", 1) + description = options.get("description", None) + decorative = options.get("decorative", False) + + self.shapes.append( + [ + row, + col, + x_offset, + y_offset, + x_scale, + y_scale, + text, + anchor, + options, + description, + decorative, + ] + ) + return 0 + + @convert_cell_args + def insert_chart(self, row, col, chart, options=None): + """ + Insert an chart with its top-left corner in a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + chart: Chart object. + options: Position and scale of the chart. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert chart at (%d, %d)." % (row, col)) + return -1 + + if options is None: + options = {} + + # Ensure a chart isn't inserted more than once. + if chart.already_inserted or chart.combined and chart.combined.already_inserted: + warn("Chart cannot be inserted in a worksheet more than once.") + return + else: + chart.already_inserted = True + + if chart.combined: + chart.combined.already_inserted = True + + x_offset = options.get("x_offset", 0) + y_offset = options.get("y_offset", 0) + x_scale = options.get("x_scale", 1) + y_scale = options.get("y_scale", 1) + anchor = options.get("object_position", 1) + description = options.get("description", None) + decorative = options.get("decorative", False) + + # Allow Chart to override the scale and offset. + if chart.x_scale != 1: + x_scale = chart.x_scale + + if chart.y_scale != 1: + y_scale = chart.y_scale + + if chart.x_offset: + x_offset = chart.x_offset + + if chart.y_offset: + y_offset = chart.y_offset + + self.charts.append( + [ + row, + col, + chart, + x_offset, + y_offset, + x_scale, + y_scale, + anchor, + description, + decorative, + ] + ) + return 0 + + @convert_cell_args + def write_comment(self, row, col, comment, options=None): + """ + Write a comment to a worksheet cell. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + comment: Cell comment. Str. + options: Comment formatting options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: String longer than 32k characters. + + """ + if options is None: + options = {} + + # Check that row and col are valid and store max and min values + if self._check_dimensions(row, col): + return -1 + + # Check that the comment string is < 32767 chars. + if len(comment) > self.xls_strmax: + return -2 + + self.has_vml = 1 + self.has_comments = 1 + + # Store the options of the cell comment, to process on file close. + self.comments[row][col] = [row, col, comment, options] + + return 0 + + def show_comments(self): + """ + Make any comments in the worksheet visible. + + Args: + None. + + Returns: + Nothing. + + """ + self.comments_visible = 1 + + def set_background(self, filename, is_byte_stream=False): + """ + Set a background image for a worksheet. + + Args: + filename: Path and filename for in supported formats. + is_byte_stream: File is a stream of bytes. + Returns: + Nothing. + + """ + + if not is_byte_stream and not os.path.exists(filename): + warn("Image file '%s' not found." % filename) + return -1 + + self.background_bytes = is_byte_stream + self.background_image = filename + + def set_comments_author(self, author): + """ + Set the default author of the cell comments. + + Args: + author: Comment author name. String. + + Returns: + Nothing. + + """ + self.comments_author = author + + def get_name(self): + """ + Retrieve the worksheet name. + + Args: + None. + + Returns: + Nothing. + + """ + # There is no set_name() method. Name must be set in add_worksheet(). + return self.name + + def activate(self): + """ + Set this worksheet as the active worksheet, i.e. the worksheet that is + displayed when the workbook is opened. Also set it as selected. + + Note: An active worksheet cannot be hidden. + + Args: + None. + + Returns: + Nothing. + + """ + self.hidden = 0 + self.selected = 1 + self.worksheet_meta.activesheet = self.index + + def select(self): + """ + Set current worksheet as a selected worksheet, i.e. the worksheet + has its tab highlighted. + + Note: A selected worksheet cannot be hidden. + + Args: + None. + + Returns: + Nothing. + + """ + self.selected = 1 + self.hidden = 0 + + def hide(self): + """ + Hide the current worksheet. + + Args: + None. + + Returns: + Nothing. + + """ + self.hidden = 1 + + # A hidden worksheet shouldn't be active or selected. + self.selected = 0 + + def set_first_sheet(self): + """ + Set current worksheet as the first visible sheet. This is necessary + when there are a large number of worksheets and the activated + worksheet is not visible on the screen. + + Note: A selected worksheet cannot be hidden. + + Args: + None. + + Returns: + Nothing. + + """ + self.hidden = 0 # Active worksheet can't be hidden. + self.worksheet_meta.firstsheet = self.index + + @convert_column_args + def set_column( + self, first_col, last_col, width=None, cell_format=None, options=None + ): + """ + Set the width, and other properties of a single column or a + range of columns. + + Args: + first_col: First column (zero-indexed). + last_col: Last column (zero-indexed). Can be same as first_col. + width: Column width. (optional). + cell_format: Column cell_format. (optional). + options: Dict of options such as hidden and level. + + Returns: + 0: Success. + -1: Column number is out of worksheet bounds. + + """ + if options is None: + options = {} + + # Ensure 2nd col is larger than first. + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + # Don't modify the row dimensions when checking the columns. + ignore_row = True + + # Set optional column values. + hidden = options.get("hidden", False) + collapsed = options.get("collapsed", False) + level = options.get("level", 0) + + # Store the column dimension only in some conditions. + if cell_format or (width and hidden): + ignore_col = False + else: + ignore_col = True + + # Check that each column is valid and store the max and min values. + if self._check_dimensions(0, last_col, ignore_row, ignore_col): + return -1 + if self._check_dimensions(0, first_col, ignore_row, ignore_col): + return -1 + + # Set the limits for the outline levels (0 <= x <= 7). + if level < 0: + level = 0 + if level > 7: + level = 7 + + if level > self.outline_col_level: + self.outline_col_level = level + + # Store the column data. + for col in range(first_col, last_col + 1): + self.col_info[col] = [width, cell_format, hidden, level, collapsed, False] + + # Store the column change to allow optimizations. + self.col_size_changed = True + + return 0 + + @convert_column_args + def set_column_pixels( + self, first_col, last_col, width=None, cell_format=None, options=None + ): + """ + Set the width, and other properties of a single column or a + range of columns, where column width is in pixels. + + Args: + first_col: First column (zero-indexed). + last_col: Last column (zero-indexed). Can be same as first_col. + width: Column width in pixels. (optional). + cell_format: Column cell_format. (optional). + options: Dict of options such as hidden and level. + + Returns: + 0: Success. + -1: Column number is out of worksheet bounds. + + """ + if width is not None: + width = self._pixels_to_width(width) + + return self.set_column(first_col, last_col, width, cell_format, options) + + def autofit(self): + """ + Simulate autofit based on the data, and datatypes in each column. + + Args: + None. + + Returns: + Nothing. + + """ + if self.constant_memory: + warn("Autofit is not supported in constant_memory mode.") + return + + # No data written to the target sheet; nothing to autofit + if self.dim_rowmax is None: + return + + # Store the max pixel width for each column. + col_width_max = {} + + # Create a reverse lookup for the share strings table so we can convert + # the string id back to the original string. + strings = sorted( + self.str_table.string_table, key=self.str_table.string_table.__getitem__ + ) + + for row_num in range(self.dim_rowmin, self.dim_rowmax + 1): + if not self.table.get(row_num): + continue + + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + cell = self.table[row_num][col_num] + cell_type = cell.__class__.__name__ + length = 0 + + if cell_type in ("String", "RichString"): + # Handle strings and rich strings. + # + # For standard shared strings we do a reverse lookup + # from the shared string id to the actual string. For + # rich strings we use the unformatted string. We also + # split multi-line strings and handle each part + # separately. + if cell_type == "String": + string_id = cell.string + string = strings[string_id] + else: + string = cell.raw_string + + if "\n" not in string: + # Single line string. + length = xl_pixel_width(string) + else: + # Handle multi-line strings. + for string in string.split("\n"): + seg_length = xl_pixel_width(string) + if seg_length > length: + length = seg_length + + elif cell_type == "Number": + # Handle numbers. + # + # We use a workaround/optimization for numbers since + # digits all have a pixel width of 7. This gives a + # slightly greater width for the decimal place and + # minus sign but only by a few pixels and + # over-estimation is okay. + length = 7 * len(str(cell.number)) + + elif cell_type == "Datetime": + # Handle dates. + # + # The following uses the default width for mm/dd/yyyy + # dates. It isn't feasible to parse the number format + # to get the actual string width for all format types. + length = self.default_date_pixels + + elif cell_type == "Boolean": + # Handle boolean values. + # + # Use the Excel standard widths for TRUE and FALSE. + if cell.boolean: + length = 31 + else: + length = 36 + + elif cell_type == "Formula" or cell_type == "ArrayFormula": + # Handle formulas. + # + # We only try to autofit a formula if it has a + # non-zero value. + if isinstance(cell.value, (float, int)): + if cell.value > 0: + length = 7 * len(str(cell.value)) + + elif isinstance(cell.value, str): + length = xl_pixel_width(cell.value) + + elif type(cell.value) == bool: + if cell.value: + length = 31 + else: + length = 36 + + # If the cell is in an autofilter header we add an + # additional 16 pixels for the dropdown arrow. + if self.filter_cells.get((row_num, col_num)) and length > 0: + length += 16 + + # Add the string length to the lookup table. + width_max = col_width_max.get(col_num, 0) + if length > width_max: + col_width_max[col_num] = length + + # Apply the width to the column. + for col_num, pixel_width in col_width_max.items(): + # Convert the string pixel width to a character width using an + # additional padding of 7 pixels, like Excel. + width = self._pixels_to_width(pixel_width + 7) + + # The max column character width in Excel is 255. + if width > 255.0: + width = 255.0 + + # Add the width to an existing col info structure or add a new one. + if self.col_info.get(col_num): + # We only update the width for an existing column if it is + # greater than the user defined value. This allows the user + # to pre-load a minimum col width. + col_info = self.col_info.get(col_num) + user_width = col_info[0] + hidden = col_info[5] + if user_width is not None and not hidden: + # Col info is user defined. + if width > user_width: + self.col_info[col_num][0] = width + self.col_info[col_num][5] = True + else: + self.col_info[col_num][0] = width + self.col_info[col_num][5] = True + else: + self.col_info[col_num] = [width, None, False, 0, False, True] + + def set_row(self, row, height=None, cell_format=None, options=None): + """ + Set the width, and other properties of a row. + + Args: + row: Row number (zero-indexed). + height: Row height. (optional). + cell_format: Row cell_format. (optional). + options: Dict of options such as hidden, level and collapsed. + + Returns: + 0: Success. + -1: Row number is out of worksheet bounds. + + """ + if options is None: + options = {} + + # Use minimum col in _check_dimensions(). + if self.dim_colmin is not None: + min_col = self.dim_colmin + else: + min_col = 0 + + # Check that row is valid. + if self._check_dimensions(row, min_col): + return -1 + + if height is None: + height = self.default_row_height + + # Set optional row values. + hidden = options.get("hidden", False) + collapsed = options.get("collapsed", False) + level = options.get("level", 0) + + # If the height is 0 the row is hidden and the height is the default. + if height == 0: + hidden = 1 + height = self.default_row_height + + # Set the limits for the outline levels (0 <= x <= 7). + if level < 0: + level = 0 + if level > 7: + level = 7 + + if level > self.outline_row_level: + self.outline_row_level = level + + # Store the row properties. + self.set_rows[row] = [height, cell_format, hidden, level, collapsed] + + # Store the row change to allow optimizations. + self.row_size_changed = True + + # Store the row sizes for use when calculating image vertices. + self.row_sizes[row] = [height, hidden] + + return 0 + + def set_row_pixels(self, row, height=None, cell_format=None, options=None): + """ + Set the width (in pixels), and other properties of a row. + + Args: + row: Row number (zero-indexed). + height: Row height in pixels. (optional). + cell_format: Row cell_format. (optional). + options: Dict of options such as hidden, level and collapsed. + + Returns: + 0: Success. + -1: Row number is out of worksheet bounds. + + """ + if height is not None: + height = self._pixels_to_height(height) + + return self.set_row(row, height, cell_format, options) + + def set_default_row(self, height=None, hide_unused_rows=False): + """ + Set the default row properties. + + Args: + height: Default height. Optional, defaults to 15. + hide_unused_rows: Hide unused rows. Optional, defaults to False. + + Returns: + Nothing. + + """ + if height is None: + height = self.default_row_height + + if height != self.original_row_height: + # Store the row change to allow optimizations. + self.row_size_changed = True + self.default_row_height = height + + if hide_unused_rows: + self.default_row_zeroed = 1 + + @convert_range_args + def merge_range( + self, first_row, first_col, last_row, last_col, data, cell_format=None + ): + """ + Merge a range of cells. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + data: Cell data. + cell_format: Cell Format object. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + other: Return value of write(). + + """ + # Merge a range of cells. The first cell should contain the data and + # the others should be blank. All cells should have the same format. + + # Excel doesn't allow a single cell to be merged + if first_row == last_row and first_col == last_col: + warn("Can't merge single cell") + return + + # Swap last row/col with first row/col as necessary + if first_row > last_row: + (first_row, last_row) = (last_row, first_row) + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + # Check that row and col are valid and store max and min values. + if self._check_dimensions(first_row, first_col): + return -1 + if self._check_dimensions(last_row, last_col): + return -1 + + # Check if the merge range overlaps a previous merged or table range. + # This is a critical file corruption error in Excel. + cell_range = xl_range(first_row, first_col, last_row, last_col) + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if self.merged_cells.get((row, col)): + previous_range = self.merged_cells.get((row, col)) + raise OverlappingRange( + "Merge range '%s' overlaps previous merge range '%s'." + % (cell_range, previous_range) + ) + elif self.table_cells.get((row, col)): + previous_range = self.table_cells.get((row, col)) + raise OverlappingRange( + "Merge range '%s' overlaps previous table range '%s'." + % (cell_range, previous_range) + ) + else: + self.merged_cells[(row, col)] = cell_range + + # Store the merge range. + self.merge.append([first_row, first_col, last_row, last_col]) + + # Write the first cell + self._write(first_row, first_col, data, cell_format) + + # Pad out the rest of the area with formatted blank cells. + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if row == first_row and col == first_col: + continue + self._write_blank(row, col, "", cell_format) + + return 0 + + @convert_range_args + def autofilter(self, first_row, first_col, last_row, last_col): + """ + Set the autofilter area in the worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + + Returns: + Nothing. + + """ + # Reverse max and min values if necessary. + if last_row < first_row: + (first_row, last_row) = (last_row, first_row) + if last_col < first_col: + (first_col, last_col) = (last_col, first_col) + + # Build up the print area range "Sheet1!$A$1:$C$13". + area = self._convert_name_area(first_row, first_col, last_row, last_col) + ref = xl_range(first_row, first_col, last_row, last_col) + + self.autofilter_area = area + self.autofilter_ref = ref + self.filter_range = [first_col, last_col] + + # Store the filter cell positions for use in the autofit calculation. + for col in range(first_col, last_col + 1): + self.filter_cells[(first_row, col)] = True + + def filter_column(self, col, criteria): + """ + Set the column filter criteria. + + Args: + col: Filter column (zero-indexed). + criteria: Filter criteria. + + Returns: + Nothing. + + """ + if not self.autofilter_area: + warn("Must call autofilter() before filter_column()") + return + + # Check for a column reference in A1 notation and substitute. + try: + int(col) + except ValueError: + # Convert col ref to a cell ref and then to a col number. + col_letter = col + (_, col) = xl_cell_to_rowcol(col + "1") + + if col >= self.xls_colmax: + warn("Invalid column '%s'" % col_letter) + return + + (col_first, col_last) = self.filter_range + + # Reject column if it is outside filter range. + if col < col_first or col > col_last: + warn( + "Column '%d' outside autofilter() column range (%d, %d)" + % (col, col_first, col_last) + ) + return + + tokens = self._extract_filter_tokens(criteria) + + if len(tokens) not in (3, 7): + warn("Incorrect number of tokens in criteria '%s'" % criteria) + + tokens = self._parse_filter_expression(criteria, tokens) + + # Excel handles single or double custom filters as default filters. + # We need to check for them and handle them accordingly. + if len(tokens) == 2 and tokens[0] == 2: + # Single equality. + self.filter_column_list(col, [tokens[1]]) + elif len(tokens) == 5 and tokens[0] == 2 and tokens[2] == 1 and tokens[3] == 2: + # Double equality with "or" operator. + self.filter_column_list(col, [tokens[1], tokens[4]]) + else: + # Non default custom filter. + self.filter_cols[col] = tokens + self.filter_type[col] = 0 + + self.filter_on = 1 + + def filter_column_list(self, col, filters): + """ + Set the column filter criteria in Excel 2007 list style. + + Args: + col: Filter column (zero-indexed). + filters: List of filter criteria to match. + + Returns: + Nothing. + + """ + if not self.autofilter_area: + warn("Must call autofilter() before filter_column()") + return + + # Check for a column reference in A1 notation and substitute. + try: + int(col) + except ValueError: + # Convert col ref to a cell ref and then to a col number. + col_letter = col + (_, col) = xl_cell_to_rowcol(col + "1") + + if col >= self.xls_colmax: + warn("Invalid column '%s'" % col_letter) + return + + (col_first, col_last) = self.filter_range + + # Reject column if it is outside filter range. + if col < col_first or col > col_last: + warn( + "Column '%d' outside autofilter() column range " + "(%d,%d)" % (col, col_first, col_last) + ) + return + + self.filter_cols[col] = filters + self.filter_type[col] = 1 + self.filter_on = 1 + + @convert_range_args + def data_validation(self, first_row, first_col, last_row, last_col, options=None): + """ + Add a data validation to a worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + options: Data validation options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + """ + # Check that row and col are valid without storing the values. + if self._check_dimensions(first_row, first_col, True, True): + return -1 + if self._check_dimensions(last_row, last_col, True, True): + return -1 + + if options is None: + options = {} + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + # Valid input parameters. + valid_parameters = { + "validate", + "criteria", + "value", + "source", + "minimum", + "maximum", + "ignore_blank", + "dropdown", + "show_input", + "input_title", + "input_message", + "show_error", + "error_title", + "error_message", + "error_type", + "other_cells", + "multi_range", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameters: + warn("Unknown parameter '%s' in data_validation()" % param_key) + return -2 + + # Map alternative parameter names 'source' or 'minimum' to 'value'. + if "source" in options: + options["value"] = options["source"] + if "minimum" in options: + options["value"] = options["minimum"] + + # 'validate' is a required parameter. + if "validate" not in options: + warn("Parameter 'validate' is required in data_validation()") + return -2 + + # List of valid validation types. + valid_types = { + "any": "none", + "any value": "none", + "whole number": "whole", + "whole": "whole", + "integer": "whole", + "decimal": "decimal", + "list": "list", + "date": "date", + "time": "time", + "text length": "textLength", + "length": "textLength", + "custom": "custom", + } + + # Check for valid validation types. + if options["validate"] not in valid_types: + warn( + "Unknown validation type '%s' for parameter " + "'validate' in data_validation()" % options["validate"] + ) + return -2 + else: + options["validate"] = valid_types[options["validate"]] + + # No action is required for validation type 'any' if there are no + # input messages to display. + if ( + options["validate"] == "none" + and options.get("input_title") is None + and options.get("input_message") is None + ): + return -2 + + # The any, list and custom validations don't have a criteria so we use + # a default of 'between'. + if ( + options["validate"] == "none" + or options["validate"] == "list" + or options["validate"] == "custom" + ): + options["criteria"] = "between" + options["maximum"] = None + + # 'criteria' is a required parameter. + if "criteria" not in options: + warn("Parameter 'criteria' is required in data_validation()") + return -2 + + # Valid criteria types. + criteria_types = { + "between": "between", + "not between": "notBetween", + "equal to": "equal", + "=": "equal", + "==": "equal", + "not equal to": "notEqual", + "!=": "notEqual", + "<>": "notEqual", + "greater than": "greaterThan", + ">": "greaterThan", + "less than": "lessThan", + "<": "lessThan", + "greater than or equal to": "greaterThanOrEqual", + ">=": "greaterThanOrEqual", + "less than or equal to": "lessThanOrEqual", + "<=": "lessThanOrEqual", + } + + # Check for valid criteria types. + if options["criteria"] not in criteria_types: + warn( + "Unknown criteria type '%s' for parameter " + "'criteria' in data_validation()" % options["criteria"] + ) + return -2 + else: + options["criteria"] = criteria_types[options["criteria"]] + + # 'Between' and 'Not between' criteria require 2 values. + if options["criteria"] == "between" or options["criteria"] == "notBetween": + if "maximum" not in options: + warn( + "Parameter 'maximum' is required in data_validation() " + "when using 'between' or 'not between' criteria" + ) + return -2 + else: + options["maximum"] = None + + # Valid error dialog types. + error_types = { + "stop": 0, + "warning": 1, + "information": 2, + } + + # Check for valid error dialog types. + if "error_type" not in options: + options["error_type"] = 0 + elif options["error_type"] not in error_types: + warn( + "Unknown criteria type '%s' for parameter 'error_type' " + "in data_validation()" % options["error_type"] + ) + return -2 + else: + options["error_type"] = error_types[options["error_type"]] + + # Convert date/times value if required. + if ( + options["validate"] in ("date", "time") + and options["value"] + and supported_datetime(options["value"]) + ): + date_time = self._convert_date_time(options["value"]) + # Format date number to the same precision as Excel. + options["value"] = "%.16g" % date_time + + if options["maximum"] and supported_datetime(options["maximum"]): + date_time = self._convert_date_time(options["maximum"]) + options["maximum"] = "%.16g" % date_time + + # Check that the input title doesn't exceed the maximum length. + if options.get("input_title") and len(options["input_title"]) > 32: + warn( + "Length of input title '%s' exceeds Excel's limit of 32" + % options["input_title"] + ) + return -2 + + # Check that the error title doesn't exceed the maximum length. + if options.get("error_title") and len(options["error_title"]) > 32: + warn( + "Length of error title '%s' exceeds Excel's limit of 32" + % options["error_title"] + ) + return -2 + + # Check that the input message doesn't exceed the maximum length. + if options.get("input_message") and len(options["input_message"]) > 255: + warn( + "Length of input message '%s' exceeds Excel's limit of 255" + % options["input_message"] + ) + return -2 + + # Check that the error message doesn't exceed the maximum length. + if options.get("error_message") and len(options["error_message"]) > 255: + warn( + "Length of error message '%s' exceeds Excel's limit of 255" + % options["error_message"] + ) + return -2 + + # Check that the input list doesn't exceed the maximum length. + if options["validate"] == "list" and type(options["value"]) is list: + formula = self._csv_join(*options["value"]) + if len(formula) > 255: + warn( + "Length of list items '%s' exceeds Excel's limit of " + "255, use a formula range instead" % formula + ) + return -2 + + # Set some defaults if they haven't been defined by the user. + if "ignore_blank" not in options: + options["ignore_blank"] = 1 + if "dropdown" not in options: + options["dropdown"] = 1 + if "show_input" not in options: + options["show_input"] = 1 + if "show_error" not in options: + options["show_error"] = 1 + + # These are the cells to which the validation is applied. + options["cells"] = [[first_row, first_col, last_row, last_col]] + + # A (for now) undocumented parameter to pass additional cell ranges. + if "other_cells" in options: + options["cells"].extend(options["other_cells"]) + + # Override with user defined multiple range if provided. + if "multi_range" in options: + options["multi_range"] = options["multi_range"].replace("$", "") + + # Store the validation information until we close the worksheet. + self.validations.append(options) + + return 0 + + @convert_range_args + def conditional_format( + self, first_row, first_col, last_row, last_col, options=None + ): + """ + Add a conditional format to a worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + options: Conditional format options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + """ + # Check that row and col are valid without storing the values. + if self._check_dimensions(first_row, first_col, True, True): + return -1 + if self._check_dimensions(last_row, last_col, True, True): + return -1 + + if options is None: + options = {} + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + # Valid input parameters. + valid_parameter = { + "type", + "format", + "criteria", + "value", + "minimum", + "maximum", + "stop_if_true", + "min_type", + "mid_type", + "max_type", + "min_value", + "mid_value", + "max_value", + "min_color", + "mid_color", + "max_color", + "min_length", + "max_length", + "multi_range", + "bar_color", + "bar_negative_color", + "bar_negative_color_same", + "bar_solid", + "bar_border_color", + "bar_negative_border_color", + "bar_negative_border_color_same", + "bar_no_border", + "bar_direction", + "bar_axis_position", + "bar_axis_color", + "bar_only", + "data_bar_2010", + "icon_style", + "reverse_icons", + "icons_only", + "icons", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameter: + warn("Unknown parameter '%s' in conditional_format()" % param_key) + return -2 + + # 'type' is a required parameter. + if "type" not in options: + warn("Parameter 'type' is required in conditional_format()") + return -2 + + # Valid types. + valid_type = { + "cell": "cellIs", + "date": "date", + "time": "time", + "average": "aboveAverage", + "duplicate": "duplicateValues", + "unique": "uniqueValues", + "top": "top10", + "bottom": "top10", + "text": "text", + "time_period": "timePeriod", + "blanks": "containsBlanks", + "no_blanks": "notContainsBlanks", + "errors": "containsErrors", + "no_errors": "notContainsErrors", + "2_color_scale": "2_color_scale", + "3_color_scale": "3_color_scale", + "data_bar": "dataBar", + "formula": "expression", + "icon_set": "iconSet", + } + + # Check for valid types. + if options["type"] not in valid_type: + warn( + "Unknown value '%s' for parameter 'type' " + "in conditional_format()" % options["type"] + ) + return -2 + else: + if options["type"] == "bottom": + options["direction"] = "bottom" + options["type"] = valid_type[options["type"]] + + # Valid criteria types. + criteria_type = { + "between": "between", + "not between": "notBetween", + "equal to": "equal", + "=": "equal", + "==": "equal", + "not equal to": "notEqual", + "!=": "notEqual", + "<>": "notEqual", + "greater than": "greaterThan", + ">": "greaterThan", + "less than": "lessThan", + "<": "lessThan", + "greater than or equal to": "greaterThanOrEqual", + ">=": "greaterThanOrEqual", + "less than or equal to": "lessThanOrEqual", + "<=": "lessThanOrEqual", + "containing": "containsText", + "not containing": "notContains", + "begins with": "beginsWith", + "ends with": "endsWith", + "yesterday": "yesterday", + "today": "today", + "last 7 days": "last7Days", + "last week": "lastWeek", + "this week": "thisWeek", + "next week": "nextWeek", + "last month": "lastMonth", + "this month": "thisMonth", + "next month": "nextMonth", + # For legacy, but incorrect, support. + "continue week": "nextWeek", + "continue month": "nextMonth", + } + + # Check for valid criteria types. + if "criteria" in options and options["criteria"] in criteria_type: + options["criteria"] = criteria_type[options["criteria"]] + + # Convert date/times value if required. + if options["type"] in ("date", "time"): + options["type"] = "cellIs" + + if "value" in options: + if not supported_datetime(options["value"]): + warn("Conditional format 'value' must be a datetime object.") + return -2 + else: + date_time = self._convert_date_time(options["value"]) + # Format date number to the same precision as Excel. + options["value"] = "%.16g" % date_time + + if "minimum" in options: + if not supported_datetime(options["minimum"]): + warn("Conditional format 'minimum' must be a datetime object.") + return -2 + else: + date_time = self._convert_date_time(options["minimum"]) + options["minimum"] = "%.16g" % date_time + + if "maximum" in options: + if not supported_datetime(options["maximum"]): + warn("Conditional format 'maximum' must be a datetime object.") + return -2 + else: + date_time = self._convert_date_time(options["maximum"]) + options["maximum"] = "%.16g" % date_time + + # Valid icon styles. + valid_icons = { + "3_arrows": "3Arrows", # 1 + "3_flags": "3Flags", # 2 + "3_traffic_lights_rimmed": "3TrafficLights2", # 3 + "3_symbols_circled": "3Symbols", # 4 + "4_arrows": "4Arrows", # 5 + "4_red_to_black": "4RedToBlack", # 6 + "4_traffic_lights": "4TrafficLights", # 7 + "5_arrows_gray": "5ArrowsGray", # 8 + "5_quarters": "5Quarters", # 9 + "3_arrows_gray": "3ArrowsGray", # 10 + "3_traffic_lights": "3TrafficLights", # 11 + "3_signs": "3Signs", # 12 + "3_symbols": "3Symbols2", # 13 + "4_arrows_gray": "4ArrowsGray", # 14 + "4_ratings": "4Rating", # 15 + "5_arrows": "5Arrows", # 16 + "5_ratings": "5Rating", + } # 17 + + # Set the icon set properties. + if options["type"] == "iconSet": + # An icon_set must have an icon style. + if not options.get("icon_style"): + warn( + "The 'icon_style' parameter must be specified when " + "'type' == 'icon_set' in conditional_format()" + ) + return -3 + + # Check for valid icon styles. + if options["icon_style"] not in valid_icons: + warn( + "Unknown icon_style '%s' in conditional_format()" + % options["icon_style"] + ) + return -2 + else: + options["icon_style"] = valid_icons[options["icon_style"]] + + # Set the number of icons for the icon style. + options["total_icons"] = 3 + if options["icon_style"].startswith("4"): + options["total_icons"] = 4 + elif options["icon_style"].startswith("5"): + options["total_icons"] = 5 + + options["icons"] = self._set_icon_props( + options.get("total_icons"), options.get("icons") + ) + + # Swap last row/col for first row/col as necessary + if first_row > last_row: + first_row, last_row = last_row, first_row + + if first_col > last_col: + first_col, last_col = last_col, first_col + + # Set the formatting range. + cell_range = xl_range(first_row, first_col, last_row, last_col) + start_cell = xl_rowcol_to_cell(first_row, first_col) + + # Override with user defined multiple range if provided. + if "multi_range" in options: + cell_range = options["multi_range"] + cell_range = cell_range.replace("$", "") + + # Get the dxf format index. + if "format" in options and options["format"]: + options["format"] = options["format"]._get_dxf_index() + + # Set the priority based on the order of adding. + options["priority"] = self.dxf_priority + self.dxf_priority += 1 + + # Check for 2010 style data_bar parameters. + if ( + self.use_data_bars_2010 + or options.get("data_bar_2010") + or options.get("bar_solid") + or options.get("bar_border_color") + or options.get("bar_negative_color") + or options.get("bar_negative_color_same") + or options.get("bar_negative_border_color") + or options.get("bar_negative_border_color_same") + or options.get("bar_no_border") + or options.get("bar_axis_position") + or options.get("bar_axis_color") + or options.get("bar_direction") + ): + options["is_data_bar_2010"] = True + + # Special handling of text criteria. + if options["type"] == "text": + if options["criteria"] == "containsText": + options["type"] = "containsText" + options["formula"] = 'NOT(ISERROR(SEARCH("%s",%s)))' % ( + options["value"], + start_cell, + ) + elif options["criteria"] == "notContains": + options["type"] = "notContainsText" + options["formula"] = 'ISERROR(SEARCH("%s",%s))' % ( + options["value"], + start_cell, + ) + elif options["criteria"] == "beginsWith": + options["type"] = "beginsWith" + options["formula"] = 'LEFT(%s,%d)="%s"' % ( + start_cell, + len(options["value"]), + options["value"], + ) + elif options["criteria"] == "endsWith": + options["type"] = "endsWith" + options["formula"] = 'RIGHT(%s,%d)="%s"' % ( + start_cell, + len(options["value"]), + options["value"], + ) + else: + warn( + "Invalid text criteria '%s' " + "in conditional_format()" % options["criteria"] + ) + + # Special handling of time time_period criteria. + if options["type"] == "timePeriod": + if options["criteria"] == "yesterday": + options["formula"] = "FLOOR(%s,1)=TODAY()-1" % start_cell + + elif options["criteria"] == "today": + options["formula"] = "FLOOR(%s,1)=TODAY()" % start_cell + + elif options["criteria"] == "tomorrow": + options["formula"] = "FLOOR(%s,1)=TODAY()+1" % start_cell + + elif options["criteria"] == "last7Days": + options[ + "formula" + ] = "AND(TODAY()-FLOOR(%s,1)<=6,FLOOR(%s,1)<=TODAY())" % ( + start_cell, + start_cell, + ) + + elif options["criteria"] == "lastWeek": + options["formula"] = ( + "AND(TODAY()-ROUNDDOWN(%s,0)>=(WEEKDAY(TODAY()))," + "TODAY()-ROUNDDOWN(%s,0)<(WEEKDAY(TODAY())+7))" + % (start_cell, start_cell) + ) + + elif options["criteria"] == "thisWeek": + options["formula"] = ( + "AND(TODAY()-ROUNDDOWN(%s,0)<=WEEKDAY(TODAY())-1," + "ROUNDDOWN(%s,0)-TODAY()<=7-WEEKDAY(TODAY()))" + % (start_cell, start_cell) + ) + + elif options["criteria"] == "nextWeek": + options["formula"] = ( + "AND(ROUNDDOWN(%s,0)-TODAY()>(7-WEEKDAY(TODAY()))," + "ROUNDDOWN(%s,0)-TODAY()<(15-WEEKDAY(TODAY())))" + % (start_cell, start_cell) + ) + + elif options["criteria"] == "lastMonth": + options["formula"] = ( + "AND(MONTH(%s)=MONTH(TODAY())-1,OR(YEAR(%s)=YEAR(" + "TODAY()),AND(MONTH(%s)=1,YEAR(A1)=YEAR(TODAY())-1)))" + % (start_cell, start_cell, start_cell) + ) + + elif options["criteria"] == "thisMonth": + options[ + "formula" + ] = "AND(MONTH(%s)=MONTH(TODAY()),YEAR(%s)=YEAR(TODAY()))" % ( + start_cell, + start_cell, + ) + + elif options["criteria"] == "nextMonth": + options["formula"] = ( + "AND(MONTH(%s)=MONTH(TODAY())+1,OR(YEAR(%s)=YEAR(" + "TODAY()),AND(MONTH(%s)=12,YEAR(%s)=YEAR(TODAY())+1)))" + % (start_cell, start_cell, start_cell, start_cell) + ) + + else: + warn( + "Invalid time_period criteria '%s' " + "in conditional_format()" % options["criteria"] + ) + + # Special handling of blanks/error types. + if options["type"] == "containsBlanks": + options["formula"] = "LEN(TRIM(%s))=0" % start_cell + + if options["type"] == "notContainsBlanks": + options["formula"] = "LEN(TRIM(%s))>0" % start_cell + + if options["type"] == "containsErrors": + options["formula"] = "ISERROR(%s)" % start_cell + + if options["type"] == "notContainsErrors": + options["formula"] = "NOT(ISERROR(%s))" % start_cell + + # Special handling for 2 color scale. + if options["type"] == "2_color_scale": + options["type"] = "colorScale" + + # Color scales don't use any additional formatting. + options["format"] = None + + # Turn off 3 color parameters. + options["mid_type"] = None + options["mid_color"] = None + + options.setdefault("min_type", "min") + options.setdefault("max_type", "max") + options.setdefault("min_value", 0) + options.setdefault("max_value", 0) + options.setdefault("min_color", "#FF7128") + options.setdefault("max_color", "#FFEF9C") + + options["min_color"] = xl_color(options["min_color"]) + options["max_color"] = xl_color(options["max_color"]) + + # Special handling for 3 color scale. + if options["type"] == "3_color_scale": + options["type"] = "colorScale" + + # Color scales don't use any additional formatting. + options["format"] = None + + options.setdefault("min_type", "min") + options.setdefault("mid_type", "percentile") + options.setdefault("max_type", "max") + options.setdefault("min_value", 0) + options.setdefault("max_value", 0) + options.setdefault("min_color", "#F8696B") + options.setdefault("mid_color", "#FFEB84") + options.setdefault("max_color", "#63BE7B") + + options["min_color"] = xl_color(options["min_color"]) + options["mid_color"] = xl_color(options["mid_color"]) + options["max_color"] = xl_color(options["max_color"]) + + # Set a default mid value. + if "mid_value" not in options: + options["mid_value"] = 50 + + # Special handling for data bar. + if options["type"] == "dataBar": + # Color scales don't use any additional formatting. + options["format"] = None + + if not options.get("min_type"): + options["min_type"] = "min" + options["x14_min_type"] = "autoMin" + else: + options["x14_min_type"] = options["min_type"] + + if not options.get("max_type"): + options["max_type"] = "max" + options["x14_max_type"] = "autoMax" + else: + options["x14_max_type"] = options["max_type"] + + options.setdefault("min_value", 0) + options.setdefault("max_value", 0) + options.setdefault("bar_color", "#638EC6") + options.setdefault("bar_border_color", options["bar_color"]) + options.setdefault("bar_only", False) + options.setdefault("bar_no_border", False) + options.setdefault("bar_solid", False) + options.setdefault("bar_direction", "") + options.setdefault("bar_negative_color", "#FF0000") + options.setdefault("bar_negative_border_color", "#FF0000") + options.setdefault("bar_negative_color_same", False) + options.setdefault("bar_negative_border_color_same", False) + options.setdefault("bar_axis_position", "") + options.setdefault("bar_axis_color", "#000000") + + options["bar_color"] = xl_color(options["bar_color"]) + options["bar_border_color"] = xl_color(options["bar_border_color"]) + options["bar_axis_color"] = xl_color(options["bar_axis_color"]) + options["bar_negative_color"] = xl_color(options["bar_negative_color"]) + options["bar_negative_border_color"] = xl_color( + options["bar_negative_border_color"] + ) + + # Adjust for 2010 style data_bar parameters. + if options.get("is_data_bar_2010"): + self.excel_version = 2010 + + if options["min_type"] == "min" and options["min_value"] == 0: + options["min_value"] = None + + if options["max_type"] == "max" and options["max_value"] == 0: + options["max_value"] = None + + options["range"] = cell_range + + # Strip the leading = from formulas. + try: + options["min_value"] = options["min_value"].lstrip("=") + except (KeyError, AttributeError): + pass + try: + options["mid_value"] = options["mid_value"].lstrip("=") + except (KeyError, AttributeError): + pass + try: + options["max_value"] = options["max_value"].lstrip("=") + except (KeyError, AttributeError): + pass + + # Store the conditional format until we close the worksheet. + if cell_range in self.cond_formats: + self.cond_formats[cell_range].append(options) + else: + self.cond_formats[cell_range] = [options] + + return 0 + + @convert_range_args + def add_table(self, first_row, first_col, last_row, last_col, options=None): + """ + Add an Excel table to a worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + options: Table format options. (Optional) + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + -3: Not supported in constant_memory mode. + """ + table = {} + col_formats = {} + + if options is None: + options = {} + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + if self.constant_memory: + warn("add_table() isn't supported in 'constant_memory' mode") + return -3 + + # Check that row and col are valid without storing the values. + if self._check_dimensions(first_row, first_col, True, True): + return -1 + if self._check_dimensions(last_row, last_col, True, True): + return -1 + + # Swap last row/col for first row/col as necessary. + if first_row > last_row: + (first_row, last_row) = (last_row, first_row) + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + # Check if the table range overlaps a previous merged or table range. + # This is a critical file corruption error in Excel. + cell_range = xl_range(first_row, first_col, last_row, last_col) + for row in range(first_row, last_row + 1): + for col in range(first_col, last_col + 1): + if self.table_cells.get((row, col)): + previous_range = self.table_cells.get((row, col)) + raise OverlappingRange( + "Table range '%s' overlaps previous table range '%s'." + % (cell_range, previous_range) + ) + elif self.merged_cells.get((row, col)): + previous_range = self.merged_cells.get((row, col)) + raise OverlappingRange( + "Table range '%s' overlaps previous merge range '%s'." + % (cell_range, previous_range) + ) + else: + self.table_cells[(row, col)] = cell_range + + # Valid input parameters. + valid_parameter = { + "autofilter", + "banded_columns", + "banded_rows", + "columns", + "data", + "first_column", + "header_row", + "last_column", + "name", + "style", + "total_row", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameter: + warn("Unknown parameter '%s' in add_table()" % param_key) + return -2 + + # Turn on Excel's defaults. + options["banded_rows"] = options.get("banded_rows", True) + options["header_row"] = options.get("header_row", True) + options["autofilter"] = options.get("autofilter", True) + + # Check that there are enough rows. + num_rows = last_row - first_row + if options["header_row"]: + num_rows -= 1 + + if num_rows < 0: + warn("Must have at least one data row in in add_table()") + return -2 + + # Set the table options. + table["show_first_col"] = options.get("first_column", False) + table["show_last_col"] = options.get("last_column", False) + table["show_row_stripes"] = options.get("banded_rows", False) + table["show_col_stripes"] = options.get("banded_columns", False) + table["header_row_count"] = options.get("header_row", 0) + table["totals_row_shown"] = options.get("total_row", False) + + # Set the table name. + if "name" in options: + name = options["name"] + table["name"] = name + + if " " in name: + warn("Name '%s' in add_table() cannot contain spaces" % name) + return -2 + + # Warn if the name contains invalid chars as defined by Excel. + if not re.match(r"^[\w\\][\w\\.]*$", name, re.UNICODE) or re.match( + r"^\d", name + ): + warn("Invalid Excel characters in add_table(): '%s'" % name) + return -2 + + # Warn if the name looks like a cell name. + if re.match(r"^[a-zA-Z][a-zA-Z]?[a-dA-D]?\d+$", name): + warn("Name looks like a cell name in add_table(): '%s'" % name) + return -2 + + # Warn if the name looks like a R1C1 cell reference. + if re.match(r"^[rcRC]$", name) or re.match(r"^[rcRC]\d+[rcRC]\d+$", name): + warn("Invalid name '%s' like a RC cell ref in add_table()" % name) + return -2 + + # Set the table style. + if "style" in options: + table["style"] = options["style"] + + if table["style"] is None: + table["style"] = "" + + # Remove whitespace from style name. + table["style"] = table["style"].replace(" ", "") + else: + table["style"] = "TableStyleMedium9" + + # Set the data range rows (without the header and footer). + first_data_row = first_row + last_data_row = last_row + + if options.get("header_row"): + first_data_row += 1 + + if options.get("total_row"): + last_data_row -= 1 + + # Set the table and autofilter ranges. + table["range"] = xl_range(first_row, first_col, last_row, last_col) + + table["a_range"] = xl_range(first_row, first_col, last_data_row, last_col) + + # If the header row if off the default is to turn autofilter off. + if not options["header_row"]: + options["autofilter"] = 0 + + # Set the autofilter range. + if options["autofilter"]: + table["autofilter"] = table["a_range"] + + # Add the table columns. + col_id = 1 + table["columns"] = [] + seen_names = {} + + for col_num in range(first_col, last_col + 1): + # Set up the default column data. + col_data = { + "id": col_id, + "name": "Column" + str(col_id), + "total_string": "", + "total_function": "", + "total_value": 0, + "formula": "", + "format": None, + "name_format": None, + } + + # Overwrite the defaults with any user defined values. + if "columns" in options: + # Check if there are user defined values for this column. + if col_id <= len(options["columns"]): + user_data = options["columns"][col_id - 1] + else: + user_data = None + + if user_data: + # Get the column format. + xformat = user_data.get("format", None) + + # Map user defined values to internal values. + if user_data.get("header"): + col_data["name"] = user_data["header"] + + # Excel requires unique case insensitive header names. + header_name = col_data["name"] + name = header_name.lower() + if name in seen_names: + warn("Duplicate header name in add_table(): '%s'" % name) + return -2 + else: + seen_names[name] = True + + col_data["name_format"] = user_data.get("header_format") + + # Handle the column formula. + if "formula" in user_data and user_data["formula"]: + formula = user_data["formula"] + + # Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + # Convert Excel 2010 "@" ref to 2007 "#This Row". + formula = formula.replace("@", "[#This Row],") + + col_data["formula"] = formula + + for row in range(first_data_row, last_data_row + 1): + self._write_formula(row, col_num, formula, xformat) + + # Handle the function for the total row. + if user_data.get("total_function"): + function = user_data["total_function"] + + # Massage the function name. + function = function.lower() + function = function.replace("_", "") + function = function.replace(" ", "") + + if function == "countnums": + function = "countNums" + if function == "stddev": + function = "stdDev" + + col_data["total_function"] = function + + formula = self._table_function_to_formula( + function, col_data["name"] + ) + + value = user_data.get("total_value", 0) + + self._write_formula(last_row, col_num, formula, xformat, value) + + elif user_data.get("total_string"): + # Total label only (not a function). + total_string = user_data["total_string"] + col_data["total_string"] = total_string + + self._write_string( + last_row, col_num, total_string, user_data.get("format") + ) + + # Get the dxf format index. + if xformat is not None: + col_data["format"] = xformat._get_dxf_index() + + # Store the column format for writing the cell data. + # It doesn't matter if it is undefined. + col_formats[col_id - 1] = xformat + + # Store the column data. + table["columns"].append(col_data) + + # Write the column headers to the worksheet. + if options["header_row"]: + self._write_string( + first_row, col_num, col_data["name"], col_data["name_format"] + ) + + col_id += 1 + + # Write the cell data if supplied. + if "data" in options: + data = options["data"] + + i = 0 # For indexing the row data. + for row in range(first_data_row, last_data_row + 1): + j = 0 # For indexing the col data. + for col in range(first_col, last_col + 1): + if i < len(data) and j < len(data[i]): + token = data[i][j] + if j in col_formats: + self._write(row, col, token, col_formats[j]) + else: + self._write(row, col, token, None) + j += 1 + i += 1 + + # Store the table data. + self.tables.append(table) + + # Store the filter cell positions for use in the autofit calculation. + if options["autofilter"]: + for col in range(first_col, last_col + 1): + self.filter_cells[(first_row, col)] = True + + return 0 + + @convert_cell_args + def add_sparkline(self, row, col, options=None): + """ + Add sparklines to the worksheet. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + options: Sparkline formatting options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + -2: Incorrect parameter or option. + + """ + + # Check that row and col are valid without storing the values. + if self._check_dimensions(row, col, True, True): + return -1 + + sparkline = {"locations": [xl_rowcol_to_cell(row, col)]} + + if options is None: + options = {} + + # Valid input parameters. + valid_parameters = { + "location", + "range", + "type", + "high_point", + "low_point", + "negative_points", + "first_point", + "last_point", + "markers", + "style", + "series_color", + "negative_color", + "markers_color", + "first_color", + "last_color", + "high_color", + "low_color", + "max", + "min", + "axis", + "reverse", + "empty_cells", + "show_hidden", + "plot_hidden", + "date_axis", + "weight", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameters: + warn("Unknown parameter '%s' in add_sparkline()" % param_key) + return -1 + + # 'range' is a required parameter. + if "range" not in options: + warn("Parameter 'range' is required in add_sparkline()") + return -2 + + # Handle the sparkline type. + spark_type = options.get("type", "line") + + if spark_type not in ("line", "column", "win_loss"): + warn( + "Parameter 'type' must be 'line', 'column' " + "or 'win_loss' in add_sparkline()" + ) + return -2 + + if spark_type == "win_loss": + spark_type = "stacked" + sparkline["type"] = spark_type + + # We handle single location/range values or list of values. + if "location" in options: + if type(options["location"]) is list: + sparkline["locations"] = options["location"] + else: + sparkline["locations"] = [options["location"]] + + if type(options["range"]) is list: + sparkline["ranges"] = options["range"] + else: + sparkline["ranges"] = [options["range"]] + + range_count = len(sparkline["ranges"]) + location_count = len(sparkline["locations"]) + + # The ranges and locations must match. + if range_count != location_count: + warn( + "Must have the same number of location and range " + "parameters in add_sparkline()" + ) + return -2 + + # Store the count. + sparkline["count"] = len(sparkline["locations"]) + + # Get the worksheet name for the range conversion below. + sheetname = quote_sheetname(self.name) + + # Cleanup the input ranges. + new_ranges = [] + for spark_range in sparkline["ranges"]: + # Remove the absolute reference $ symbols. + spark_range = spark_range.replace("$", "") + + # Remove the = from formula. + spark_range = spark_range.lstrip("=") + + # Convert a simple range into a full Sheet1!A1:D1 range. + if "!" not in spark_range: + spark_range = sheetname + "!" + spark_range + + new_ranges.append(spark_range) + + sparkline["ranges"] = new_ranges + + # Cleanup the input locations. + new_locations = [] + for location in sparkline["locations"]: + location = location.replace("$", "") + new_locations.append(location) + + sparkline["locations"] = new_locations + + # Map options. + sparkline["high"] = options.get("high_point") + sparkline["low"] = options.get("low_point") + sparkline["negative"] = options.get("negative_points") + sparkline["first"] = options.get("first_point") + sparkline["last"] = options.get("last_point") + sparkline["markers"] = options.get("markers") + sparkline["min"] = options.get("min") + sparkline["max"] = options.get("max") + sparkline["axis"] = options.get("axis") + sparkline["reverse"] = options.get("reverse") + sparkline["hidden"] = options.get("show_hidden") + sparkline["weight"] = options.get("weight") + + # Map empty cells options. + empty = options.get("empty_cells", "") + + if empty == "zero": + sparkline["empty"] = 0 + elif empty == "connect": + sparkline["empty"] = "span" + else: + sparkline["empty"] = "gap" + + # Map the date axis range. + date_range = options.get("date_axis") + + if date_range and "!" not in date_range: + date_range = sheetname + "!" + date_range + + sparkline["date_axis"] = date_range + + # Set the sparkline styles. + style_id = options.get("style", 0) + style = get_sparkline_style(style_id) + + sparkline["series_color"] = style["series"] + sparkline["negative_color"] = style["negative"] + sparkline["markers_color"] = style["markers"] + sparkline["first_color"] = style["first"] + sparkline["last_color"] = style["last"] + sparkline["high_color"] = style["high"] + sparkline["low_color"] = style["low"] + + # Override the style colors with user defined colors. + self._set_spark_color(sparkline, options, "series_color") + self._set_spark_color(sparkline, options, "negative_color") + self._set_spark_color(sparkline, options, "markers_color") + self._set_spark_color(sparkline, options, "first_color") + self._set_spark_color(sparkline, options, "last_color") + self._set_spark_color(sparkline, options, "high_color") + self._set_spark_color(sparkline, options, "low_color") + + self.sparklines.append(sparkline) + + return 0 + + @convert_range_args + def set_selection(self, first_row, first_col, last_row, last_col): + """ + Set the selected cell or cells in a worksheet + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + + Returns: + 0: Nothing. + """ + pane = None + + # Range selection. Do this before swapping max/min to allow the + # selection direction to be reversed. + active_cell = xl_rowcol_to_cell(first_row, first_col) + + # Swap last row/col for first row/col if necessary + if first_row > last_row: + (first_row, last_row) = (last_row, first_row) + + if first_col > last_col: + (first_col, last_col) = (last_col, first_col) + + sqref = xl_range(first_row, first_col, last_row, last_col) + + # Selection isn't set for cell A1. + if sqref == "A1": + return + + self.selections = [[pane, active_cell, sqref]] + + @convert_cell_args + def set_top_left_cell(self, row=0, col=0): + """ + Set the first visible cell at the top left of a worksheet. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + + Returns: + 0: Nothing. + """ + + if row == 0 and col == 0: + return + + self.top_left_cell = xl_rowcol_to_cell(row, col) + + def outline_settings( + self, visible=1, symbols_below=1, symbols_right=1, auto_style=0 + ): + """ + Control outline settings. + + Args: + visible: Outlines are visible. Optional, defaults to True. + symbols_below: Show row outline symbols below the outline bar. + Optional, defaults to True. + symbols_right: Show column outline symbols to the right of the + outline bar. Optional, defaults to True. + auto_style: Use Automatic style. Optional, defaults to False. + + Returns: + 0: Nothing. + """ + self.outline_on = visible + self.outline_below = symbols_below + self.outline_right = symbols_right + self.outline_style = auto_style + + self.outline_changed = True + + @convert_cell_args + def freeze_panes(self, row, col, top_row=None, left_col=None, pane_type=0): + """ + Create worksheet panes and mark them as frozen. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + top_row: Topmost visible row in scrolling region of pane. + left_col: Leftmost visible row in scrolling region of pane. + + Returns: + 0: Nothing. + + """ + if top_row is None: + top_row = row + + if left_col is None: + left_col = col + + self.panes = [row, col, top_row, left_col, pane_type] + + @convert_cell_args + def split_panes(self, x, y, top_row=None, left_col=None): + """ + Create worksheet panes and mark them as split. + + Args: + x: The position for the vertical split. + y: The position for the horizontal split. + top_row: Topmost visible row in scrolling region of pane. + left_col: Leftmost visible row in scrolling region of pane. + + Returns: + 0: Nothing. + + """ + # Same as freeze panes with a different pane type. + self.freeze_panes(x, y, top_row, left_col, 2) + + def set_zoom(self, zoom=100): + """ + Set the worksheet zoom factor. + + Args: + zoom: Scale factor: 10 <= zoom <= 400. + + Returns: + Nothing. + + """ + # Ensure the zoom scale is in Excel's range. + if zoom < 10 or zoom > 400: + warn("Zoom factor %d outside range: 10 <= zoom <= 400" % zoom) + zoom = 100 + + self.zoom = int(zoom) + + def right_to_left(self): + """ + Display the worksheet right to left for some versions of Excel. + + Args: + None. + + Returns: + Nothing. + + """ + self.is_right_to_left = 1 + + def hide_zero(self): + """ + Hide zero values in worksheet cells. + + Args: + None. + + Returns: + Nothing. + + """ + self.show_zeros = 0 + + def set_tab_color(self, color): + """ + Set the color of the worksheet tab. + + Args: + color: A #RGB color index. + + Returns: + Nothing. + + """ + self.tab_color = xl_color(color) + + def protect(self, password="", options=None): + """ + Set the password and protection options of the worksheet. + + Args: + password: An optional password string. + options: A dictionary of worksheet objects to protect. + + Returns: + Nothing. + + """ + if password != "": + password = self._encode_password(password) + + if not options: + options = {} + + # Default values for objects that can be protected. + defaults = { + "sheet": True, + "content": False, + "objects": False, + "scenarios": False, + "format_cells": False, + "format_columns": False, + "format_rows": False, + "insert_columns": False, + "insert_rows": False, + "insert_hyperlinks": False, + "delete_columns": False, + "delete_rows": False, + "select_locked_cells": True, + "sort": False, + "autofilter": False, + "pivot_tables": False, + "select_unlocked_cells": True, + } + + # Overwrite the defaults with user specified values. + for key in options.keys(): + if key in defaults: + defaults[key] = options[key] + else: + warn("Unknown protection object: '%s'" % key) + + # Set the password after the user defined values. + defaults["password"] = password + + self.protect_options = defaults + + def unprotect_range(self, cell_range, range_name=None, password=None): + """ + Unprotect ranges within a protected worksheet. + + Args: + cell_range: The cell or cell range to unprotect. + range_name: An optional name for the range. + password: An optional password string. (undocumented) + + Returns: + Nothing. + + """ + if cell_range is None: + warn("Cell range must be specified in unprotect_range()") + return -1 + + # Sanitize the cell range. + cell_range = cell_range.lstrip("=") + cell_range = cell_range.replace("$", "") + + self.num_protected_ranges += 1 + + if range_name is None: + range_name = "Range" + str(self.num_protected_ranges) + + if password: + password = self._encode_password(password) + + self.protected_ranges.append((cell_range, range_name, password)) + + @convert_cell_args + def insert_button(self, row, col, options=None): + """ + Insert a button form object into the worksheet. + + Args: + row: The cell row (zero indexed). + col: The cell column (zero indexed). + options: Button formatting options. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Check insert (row, col) without storing. + if self._check_dimensions(row, col, True, True): + warn("Cannot insert button at (%d, %d)." % (row, col)) + return -1 + + if options is None: + options = {} + + button = self._button_params(row, col, options) + + self.buttons_list.append(button) + + self.has_vml = 1 + + return 0 + + ########################################################################### + # + # Public API. Page Setup methods. + # + ########################################################################### + def set_landscape(self): + """ + Set the page orientation as landscape. + + Args: + None. + + Returns: + Nothing. + + """ + self.orientation = 0 + self.page_setup_changed = True + + def set_portrait(self): + """ + Set the page orientation as portrait. + + Args: + None. + + Returns: + Nothing. + + """ + self.orientation = 1 + self.page_setup_changed = True + + def set_page_view(self, view=1): + """ + Set the page view mode. + + Args: + 0: Normal view mode + 1: Page view mode (the default) + 2: Page break view mode + + Returns: + Nothing. + + """ + self.page_view = view + + def set_pagebreak_view(self, view=1): + """ + Set the page view mode. + + Args: + None. + + Returns: + Nothing. + + """ + self.page_view = 2 + + def set_paper(self, paper_size): + """ + Set the paper type. US Letter = 1, A4 = 9. + + Args: + paper_size: Paper index. + + Returns: + Nothing. + + """ + if paper_size: + self.paper_size = paper_size + self.page_setup_changed = True + + def center_horizontally(self): + """ + Center the page horizontally. + + Args: + None. + + Returns: + Nothing. + + """ + self.print_options_changed = True + self.hcenter = 1 + + def center_vertically(self): + """ + Center the page vertically. + + Args: + None. + + Returns: + Nothing. + + """ + self.print_options_changed = True + self.vcenter = 1 + + def set_margins(self, left=0.7, right=0.7, top=0.75, bottom=0.75): + """ + Set all the page margins in inches. + + Args: + left: Left margin. + right: Right margin. + top: Top margin. + bottom: Bottom margin. + + Returns: + Nothing. + + """ + self.margin_left = left + self.margin_right = right + self.margin_top = top + self.margin_bottom = bottom + + def set_header(self, header="", options=None, margin=None): + """ + Set the page header caption and optional margin. + + Args: + header: Header string. + margin: Header margin. + options: Header options, mainly for images. + + Returns: + Nothing. + + """ + header_orig = header + header = header.replace("&[Picture]", "&G") + + if len(header) > 255: + warn("Header string cannot be longer than Excel's limit of 255 characters") + return + + if options is not None: + # For backward compatibility allow options to be the margin. + if not isinstance(options, dict): + options = {"margin": options} + else: + options = {} + + # Copy the user defined options so they aren't modified. + options = options.copy() + + # For backward compatibility. + if margin is not None: + options["margin"] = margin + + # Reset the list in case the function is called more than once. + self.header_images = [] + + if options.get("image_left"): + self.header_images.append( + [options.get("image_left"), options.get("image_data_left"), "LH"] + ) + + if options.get("image_center"): + self.header_images.append( + [options.get("image_center"), options.get("image_data_center"), "CH"] + ) + + if options.get("image_right"): + self.header_images.append( + [options.get("image_right"), options.get("image_data_right"), "RH"] + ) + + placeholder_count = header.count("&G") + image_count = len(self.header_images) + + if placeholder_count != image_count: + warn( + "Number of header images (%s) doesn't match placeholder " + "count (%s) in string: %s" + % (image_count, placeholder_count, header_orig) + ) + self.header_images = [] + return + + if "align_with_margins" in options: + self.header_footer_aligns = options["align_with_margins"] + + if "scale_with_doc" in options: + self.header_footer_scales = options["scale_with_doc"] + + self.header = header + self.margin_header = options.get("margin", 0.3) + self.header_footer_changed = True + + if image_count: + self.has_header_vml = True + + def set_footer(self, footer="", options=None, margin=None): + """ + Set the page footer caption and optional margin. + + Args: + footer: Footer string. + margin: Footer margin. + options: Footer options, mainly for images. + + Returns: + Nothing. + + """ + footer_orig = footer + footer = footer.replace("&[Picture]", "&G") + + if len(footer) > 255: + warn("Footer string cannot be longer than Excel's limit of 255 characters") + return + + if options is not None: + # For backward compatibility allow options to be the margin. + if not isinstance(options, dict): + options = {"margin": options} + else: + options = {} + + # Copy the user defined options so they aren't modified. + options = options.copy() + + # For backward compatibility. + if margin is not None: + options["margin"] = margin + + # Reset the list in case the function is called more than once. + self.footer_images = [] + + if options.get("image_left"): + self.footer_images.append( + [options.get("image_left"), options.get("image_data_left"), "LF"] + ) + + if options.get("image_center"): + self.footer_images.append( + [options.get("image_center"), options.get("image_data_center"), "CF"] + ) + + if options.get("image_right"): + self.footer_images.append( + [options.get("image_right"), options.get("image_data_right"), "RF"] + ) + + placeholder_count = footer.count("&G") + image_count = len(self.footer_images) + + if placeholder_count != image_count: + warn( + "Number of footer images (%s) doesn't match placeholder " + "count (%s) in string: %s" + % (image_count, placeholder_count, footer_orig) + ) + self.footer_images = [] + return + + if "align_with_margins" in options: + self.header_footer_aligns = options["align_with_margins"] + + if "scale_with_doc" in options: + self.header_footer_scales = options["scale_with_doc"] + + self.footer = footer + self.margin_footer = options.get("margin", 0.3) + self.header_footer_changed = True + + if image_count: + self.has_header_vml = True + + def repeat_rows(self, first_row, last_row=None): + """ + Set the rows to repeat at the top of each printed page. + + Args: + first_row: Start row for range. + last_row: End row for range. + + Returns: + Nothing. + + """ + if last_row is None: + last_row = first_row + + # Convert rows to 1 based. + first_row += 1 + last_row += 1 + + # Create the row range area like: $1:$2. + area = "$%d:$%d" % (first_row, last_row) + + # Build up the print titles area "Sheet1!$1:$2" + sheetname = quote_sheetname(self.name) + self.repeat_row_range = sheetname + "!" + area + + @convert_column_args + def repeat_columns(self, first_col, last_col=None): + """ + Set the columns to repeat at the left hand side of each printed page. + + Args: + first_col: Start column for range. + last_col: End column for range. + + Returns: + Nothing. + + """ + if last_col is None: + last_col = first_col + + # Convert to A notation. + first_col = xl_col_to_name(first_col, 1) + last_col = xl_col_to_name(last_col, 1) + + # Create a column range like $C:$D. + area = first_col + ":" + last_col + + # Build up the print area range "=Sheet2!$C:$D" + sheetname = quote_sheetname(self.name) + self.repeat_col_range = sheetname + "!" + area + + def hide_gridlines(self, option=1): + """ + Set the option to hide gridlines on the screen and the printed page. + + Args: + option: 0 : Don't hide gridlines + 1 : Hide printed gridlines only + 2 : Hide screen and printed gridlines + + Returns: + Nothing. + + """ + if option == 0: + self.print_gridlines = 1 + self.screen_gridlines = 1 + self.print_options_changed = True + elif option == 1: + self.print_gridlines = 0 + self.screen_gridlines = 1 + else: + self.print_gridlines = 0 + self.screen_gridlines = 0 + + def print_row_col_headers(self): + """ + Set the option to print the row and column headers on the printed page. + + Args: + None. + + Returns: + Nothing. + + """ + self.print_headers = True + self.print_options_changed = True + + def hide_row_col_headers(self): + """ + Set the option to hide the row and column headers on the worksheet. + + Args: + None. + + Returns: + Nothing. + + """ + self.row_col_headers = True + + @convert_range_args + def print_area(self, first_row, first_col, last_row, last_col): + """ + Set the print area in the current worksheet. + + Args: + first_row: The first row of the cell range. (zero indexed). + first_col: The first column of the cell range. + last_row: The last row of the cell range. (zero indexed). + last_col: The last column of the cell range. + + Returns: + 0: Success. + -1: Row or column is out of worksheet bounds. + + """ + # Set the print area in the current worksheet. + + # Ignore max print area since it is the same as no area for Excel. + if ( + first_row == 0 + and first_col == 0 + and last_row == self.xls_rowmax - 1 + and last_col == self.xls_colmax - 1 + ): + return + + # Build up the print area range "Sheet1!$A$1:$C$13". + area = self._convert_name_area(first_row, first_col, last_row, last_col) + self.print_area_range = area + + return 0 + + def print_across(self): + """ + Set the order in which pages are printed. + + Args: + None. + + Returns: + Nothing. + + """ + self.page_order = 1 + self.page_setup_changed = True + + def fit_to_pages(self, width, height): + """ + Fit the printed area to a specific number of pages both vertically and + horizontally. + + Args: + width: Number of pages horizontally. + height: Number of pages vertically. + + Returns: + Nothing. + + """ + self.fit_page = 1 + self.fit_width = width + self.fit_height = height + self.page_setup_changed = True + + def set_start_page(self, start_page): + """ + Set the start page number when printing. + + Args: + start_page: Start page number. + + Returns: + Nothing. + + """ + self.page_start = start_page + + def set_print_scale(self, scale): + """ + Set the scale factor for the printed page. + + Args: + scale: Print scale. 10 <= scale <= 400. + + Returns: + Nothing. + + """ + # Confine the scale to Excel's range. + if scale < 10 or scale > 400: + warn("Print scale '%d' outside range: 10 <= scale <= 400" % scale) + return + + # Turn off "fit to page" option when print scale is on. + self.fit_page = 0 + + self.print_scale = int(scale) + self.page_setup_changed = True + + def print_black_and_white(self): + """ + Set the option to print the worksheet in black and white. + + Args: + None. + + Returns: + Nothing. + + """ + self.black_white = True + self.page_setup_changed = True + + def set_h_pagebreaks(self, breaks): + """ + Set the horizontal page breaks on a worksheet. + + Args: + breaks: List of rows where the page breaks should be added. + + Returns: + Nothing. + + """ + self.hbreaks = breaks + + def set_v_pagebreaks(self, breaks): + """ + Set the horizontal page breaks on a worksheet. + + Args: + breaks: List of columns where the page breaks should be added. + + Returns: + Nothing. + + """ + self.vbreaks = breaks + + def set_vba_name(self, name=None): + """ + Set the VBA name for the worksheet. By default this is the + same as the sheet name: i.e., Sheet1 etc. + + Args: + name: The VBA name for the worksheet. + + Returns: + Nothing. + + """ + if name is not None: + self.vba_codename = name + else: + self.vba_codename = "Sheet" + str(self.index + 1) + + def ignore_errors(self, options=None): + """ + Ignore various Excel errors/warnings in a worksheet for user defined + ranges. + + Args: + options: A dict of ignore errors keys with cell range values. + + Returns: + 0: Success. + -1: Incorrect parameter or option. + + """ + if options is None: + return -1 + else: + # Copy the user defined options so they aren't modified. + options = options.copy() + + # Valid input parameters. + valid_parameters = { + "number_stored_as_text", + "eval_error", + "formula_differs", + "formula_range", + "formula_unlocked", + "empty_cell_reference", + "list_data_validation", + "calculated_column", + "two_digit_text_year", + } + + # Check for valid input parameters. + for param_key in options.keys(): + if param_key not in valid_parameters: + warn("Unknown parameter '%s' in ignore_errors()" % param_key) + return -1 + + self.ignored_errors = options + + return 0 + + ########################################################################### + # + # Private API. + # + ########################################################################### + def _initialize(self, init_data): + self.name = init_data["name"] + self.index = init_data["index"] + self.str_table = init_data["str_table"] + self.worksheet_meta = init_data["worksheet_meta"] + self.constant_memory = init_data["constant_memory"] + self.tmpdir = init_data["tmpdir"] + self.date_1904 = init_data["date_1904"] + self.strings_to_numbers = init_data["strings_to_numbers"] + self.strings_to_formulas = init_data["strings_to_formulas"] + self.strings_to_urls = init_data["strings_to_urls"] + self.nan_inf_to_errors = init_data["nan_inf_to_errors"] + self.default_date_format = init_data["default_date_format"] + self.default_url_format = init_data["default_url_format"] + self.excel2003_style = init_data["excel2003_style"] + self.remove_timezone = init_data["remove_timezone"] + self.max_url_length = init_data["max_url_length"] + self.use_future_functions = init_data["use_future_functions"] + + if self.excel2003_style: + self.original_row_height = 12.75 + self.default_row_height = 12.75 + self.default_row_pixels = 17 + self.margin_left = 0.75 + self.margin_right = 0.75 + self.margin_top = 1 + self.margin_bottom = 1 + self.margin_header = 0.5 + self.margin_footer = 0.5 + self.header_footer_aligns = False + + # Open a temp filehandle to store row data in constant_memory mode. + if self.constant_memory: + # This is sub-optimal but we need to create a temp file + # with utf8 encoding in Python < 3. + (fd, filename) = tempfile.mkstemp(dir=self.tmpdir) + os.close(fd) + self.row_data_filename = filename + self.row_data_fh = open(filename, mode="w+", encoding="utf-8") + + # Set as the worksheet filehandle until the file is assembled. + self.fh = self.row_data_fh + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + # Write the root worksheet element. + self._write_worksheet() + + # Write the worksheet properties. + self._write_sheet_pr() + + # Write the worksheet dimensions. + self._write_dimension() + + # Write the sheet view properties. + self._write_sheet_views() + + # Write the sheet format properties. + self._write_sheet_format_pr() + + # Write the sheet column info. + self._write_cols() + + # Write the worksheet data such as rows columns and cells. + if not self.constant_memory: + self._write_sheet_data() + else: + self._write_optimized_sheet_data() + + # Write the sheetProtection element. + self._write_sheet_protection() + + # Write the protectedRanges element. + self._write_protected_ranges() + + # Write the phoneticPr element. + if self.excel2003_style: + self._write_phonetic_pr() + + # Write the autoFilter element. + self._write_auto_filter() + + # Write the mergeCells element. + self._write_merge_cells() + + # Write the conditional formats. + self._write_conditional_formats() + + # Write the dataValidations element. + self._write_data_validations() + + # Write the hyperlink element. + self._write_hyperlinks() + + # Write the printOptions element. + self._write_print_options() + + # Write the worksheet page_margins. + self._write_page_margins() + + # Write the worksheet page setup. + self._write_page_setup() + + # Write the headerFooter element. + self._write_header_footer() + + # Write the rowBreaks element. + self._write_row_breaks() + + # Write the colBreaks element. + self._write_col_breaks() + + # Write the ignoredErrors element. + self._write_ignored_errors() + + # Write the drawing element. + self._write_drawings() + + # Write the legacyDrawing element. + self._write_legacy_drawing() + + # Write the legacyDrawingHF element. + self._write_legacy_drawing_hf() + + # Write the picture element, for the background. + self._write_picture() + + # Write the tableParts element. + self._write_table_parts() + + # Write the extLst elements. + self._write_ext_list() + + # Close the worksheet tag. + self._xml_end_tag("worksheet") + + # Close the file. + self._xml_close() + + def _check_dimensions(self, row, col, ignore_row=False, ignore_col=False): + # Check that row and col are valid and store the max and min + # values for use in other methods/elements. The ignore_row / + # ignore_col flags is used to indicate that we wish to perform + # the dimension check without storing the value. The ignore + # flags are use by set_row() and data_validate. + + # Check that the row/col are within the worksheet bounds. + if row < 0 or col < 0: + return -1 + if row >= self.xls_rowmax or col >= self.xls_colmax: + return -1 + + # In constant_memory mode we don't change dimensions for rows + # that are already written. + if not ignore_row and not ignore_col and self.constant_memory: + if row < self.previous_row: + return -2 + + if not ignore_row: + if self.dim_rowmin is None or row < self.dim_rowmin: + self.dim_rowmin = row + if self.dim_rowmax is None or row > self.dim_rowmax: + self.dim_rowmax = row + + if not ignore_col: + if self.dim_colmin is None or col < self.dim_colmin: + self.dim_colmin = col + if self.dim_colmax is None or col > self.dim_colmax: + self.dim_colmax = col + + return 0 + + def _convert_date_time(self, dt_obj): + # Convert a datetime object to an Excel serial date and time. + return datetime_to_excel_datetime(dt_obj, self.date_1904, self.remove_timezone) + + def _convert_name_area(self, row_num_1, col_num_1, row_num_2, col_num_2): + # Convert zero indexed rows and columns to the format required by + # worksheet named ranges, eg, "Sheet1!$A$1:$C$13". + + range1 = "" + range2 = "" + area = "" + row_col_only = 0 + + # Convert to A1 notation. + col_char_1 = xl_col_to_name(col_num_1, 1) + col_char_2 = xl_col_to_name(col_num_2, 1) + row_char_1 = "$" + str(row_num_1 + 1) + row_char_2 = "$" + str(row_num_2 + 1) + + # We need to handle special cases that refer to rows or columns only. + if row_num_1 == 0 and row_num_2 == self.xls_rowmax - 1: + range1 = col_char_1 + range2 = col_char_2 + row_col_only = 1 + elif col_num_1 == 0 and col_num_2 == self.xls_colmax - 1: + range1 = row_char_1 + range2 = row_char_2 + row_col_only = 1 + else: + range1 = col_char_1 + row_char_1 + range2 = col_char_2 + row_char_2 + + # A repeated range is only written once (if it isn't a special case). + if range1 == range2 and not row_col_only: + area = range1 + else: + area = range1 + ":" + range2 + + # Build up the print area range "Sheet1!$A$1:$C$13". + sheetname = quote_sheetname(self.name) + area = sheetname + "!" + area + + return area + + def _sort_pagebreaks(self, breaks): + # This is an internal method used to filter elements of a list of + # pagebreaks used in the _store_hbreak() and _store_vbreak() methods. + # It: + # 1. Removes duplicate entries from the list. + # 2. Sorts the list. + # 3. Removes 0 from the list if present. + if not breaks: + return + + breaks_set = set(breaks) + + if 0 in breaks_set: + breaks_set.remove(0) + + breaks_list = list(breaks_set) + breaks_list.sort() + + # The Excel 2007 specification says that the maximum number of page + # breaks is 1026. However, in practice it is actually 1023. + max_num_breaks = 1023 + if len(breaks_list) > max_num_breaks: + breaks_list = breaks_list[:max_num_breaks] + + return breaks_list + + def _extract_filter_tokens(self, expression): + # Extract the tokens from the filter expression. The tokens are mainly + # non-whitespace groups. The only tricky part is to extract string + # tokens that contain whitespace and/or quoted double quotes (Excel's + # escaped quotes). + # + # Examples: 'x < 2000' + # 'x > 2000 and x < 5000' + # 'x = "foo"' + # 'x = "foo bar"' + # 'x = "foo "" bar"' + # + if not expression: + return [] + + token_re = re.compile(r'"(?:[^"]|"")*"|\S+') + tokens = token_re.findall(expression) + + new_tokens = [] + # Remove single leading and trailing quotes and un-escape other quotes. + for token in tokens: + if token.startswith('"'): + token = token[1:] + + if token.endswith('"'): + token = token[:-1] + + token = token.replace('""', '"') + + new_tokens.append(token) + + return new_tokens + + def _parse_filter_expression(self, expression, tokens): + # Converts the tokens of a possibly conditional expression into 1 or 2 + # sub expressions for further parsing. + # + # Examples: + # ('x', '==', 2000) -> exp1 + # ('x', '>', 2000, 'and', 'x', '<', 5000) -> exp1 and exp2 + + if len(tokens) == 7: + # The number of tokens will be either 3 (for 1 expression) + # or 7 (for 2 expressions). + conditional = tokens[3] + + if re.match("(and|&&)", conditional): + conditional = 0 + elif re.match(r"(or|\|\|)", conditional): + conditional = 1 + else: + warn( + "Token '%s' is not a valid conditional " + "in filter expression '%s'" % (conditional, expression) + ) + + expression_1 = self._parse_filter_tokens(expression, tokens[0:3]) + expression_2 = self._parse_filter_tokens(expression, tokens[4:7]) + + return expression_1 + [conditional] + expression_2 + else: + return self._parse_filter_tokens(expression, tokens) + + def _parse_filter_tokens(self, expression, tokens): + # Parse the 3 tokens of a filter expression and return the operator + # and token. The use of numbers instead of operators is a legacy of + # Spreadsheet::WriteExcel. + operators = { + "==": 2, + "=": 2, + "=~": 2, + "eq": 2, + "!=": 5, + "!~": 5, + "ne": 5, + "<>": 5, + "<": 1, + "<=": 3, + ">": 4, + ">=": 6, + } + + operator = operators.get(tokens[1], None) + token = tokens[2] + + # Special handling of "Top" filter expressions. + if re.match("top|bottom", tokens[0].lower()): + value = int(tokens[1]) + + if value < 1 or value > 500: + warn( + "The value '%d' in expression '%s' " + "must be in the range 1 to 500" % (value, expression) + ) + + token = token.lower() + + if token != "items" and token != "%": + warn( + "The type '%s' in expression '%s' " + "must be either 'items' or '%%'" % (token, expression) + ) + + if tokens[0].lower() == "top": + operator = 30 + else: + operator = 32 + + if tokens[2] == "%": + operator += 1 + + token = str(value) + + if not operator and tokens[0]: + warn( + "Token '%s' is not a valid operator " + "in filter expression '%s'" % (token[0], expression) + ) + + # Special handling for Blanks/NonBlanks. + if re.match("blanks|nonblanks", token.lower()): + # Only allow Equals or NotEqual in this context. + if operator != 2 and operator != 5: + warn( + "The operator '%s' in expression '%s' " + "is not valid in relation to Blanks/NonBlanks'" + % (tokens[1], expression) + ) + + token = token.lower() + + # The operator should always be 2 (=) to flag a "simple" equality + # in the binary record. Therefore we convert <> to =. + if token == "blanks": + if operator == 5: + token = " " + else: + if operator == 5: + operator = 2 + token = "blanks" + else: + operator = 5 + token = " " + + # if the string token contains an Excel match character then change the + # operator type to indicate a non "simple" equality. + if operator == 2 and re.search("[*?]", token): + operator = 22 + + return [operator, token] + + def _encode_password(self, password): + # Hash a worksheet password. Based on the algorithm in + # ECMA-376-4:2016, Office Open XML File Formats — Transitional + # Migration Features, Additional attributes for workbookProtection + # element (Part 1, §18.2.29). + hash = 0x0000 + + for char in password[::-1]: + hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7FFF) + hash ^= ord(char) + + hash = ((hash >> 14) & 0x01) | ((hash << 1) & 0x7FFF) + hash ^= len(password) + hash ^= 0xCE4B + + return "%X" % hash + + def _prepare_image( + self, + index, + image_id, + drawing_id, + width, + height, + name, + image_type, + x_dpi, + y_dpi, + digest, + ): + # Set up images/drawings. + drawing_type = 2 + ( + row, + col, + _, + x_offset, + y_offset, + x_scale, + y_scale, + url, + tip, + anchor, + _, + description, + decorative, + ) = self.images[index] + + width *= x_scale + height *= y_scale + + # Scale by non 96dpi resolutions. + width *= 96.0 / x_dpi + height *= 96.0 / y_dpi + + dimensions = self._position_object_emus( + col, row, x_offset, y_offset, width, height, anchor + ) + # Convert from pixels to emus. + width = int(0.5 + (width * 9525)) + height = int(0.5 + (height * 9525)) + + # Create a Drawing obj to use with worksheet unless one already exists. + if not self.drawing: + drawing = Drawing() + drawing.embedded = 1 + self.drawing = drawing + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml", None] + ) + else: + drawing = self.drawing + + drawing_object = drawing._add_drawing_object() + drawing_object["type"] = drawing_type + drawing_object["dimensions"] = dimensions + drawing_object["width"] = width + drawing_object["height"] = height + drawing_object["description"] = name + drawing_object["shape"] = None + drawing_object["anchor"] = anchor + drawing_object["rel_index"] = 0 + drawing_object["url_rel_index"] = 0 + drawing_object["tip"] = tip + drawing_object["decorative"] = decorative + + if description is not None: + drawing_object["description"] = description + + if url: + target = None + rel_type = "/hyperlink" + target_mode = "External" + + if re.match("(ftp|http)s?://", url): + target = self._escape_url(url) + + if re.match("^mailto:", url): + target = self._escape_url(url) + + if re.match("external:", url): + target = url.replace("external:", "") + target = self._escape_url(target) + # Additional escape not required in worksheet hyperlinks. + target = target.replace("#", "%23") + + if re.match(r"\w:", target) or re.match(r"\\", target): + target = "file:///" + target + else: + target = target.replace("\\", "/") + + if re.match("internal:", url): + target = url.replace("internal:", "#") + target_mode = None + + if target is not None: + if len(target) > self.max_url_length: + warn( + "Ignoring URL '%s' with link and/or anchor > %d " + "characters since it exceeds Excel's limit for URLS" + % (url, self.max_url_length) + ) + else: + if not self.drawing_rels.get(url): + self.drawing_links.append([rel_type, target, target_mode]) + + drawing_object["url_rel_index"] = self._get_drawing_rel_index(url) + + if not self.drawing_rels.get(digest): + self.drawing_links.append( + ["/image", "../media/image" + str(image_id) + "." + image_type] + ) + + drawing_object["rel_index"] = self._get_drawing_rel_index(digest) + + def _prepare_shape(self, index, drawing_id): + # Set up shapes/drawings. + drawing_type = 3 + + ( + row, + col, + x_offset, + y_offset, + x_scale, + y_scale, + text, + anchor, + options, + description, + decorative, + ) = self.shapes[index] + + width = options.get("width", self.default_col_pixels * 3) + height = options.get("height", self.default_row_pixels * 6) + + width *= x_scale + height *= y_scale + + dimensions = self._position_object_emus( + col, row, x_offset, y_offset, width, height, anchor + ) + + # Convert from pixels to emus. + width = int(0.5 + (width * 9525)) + height = int(0.5 + (height * 9525)) + + # Create a Drawing obj to use with worksheet unless one already exists. + if not self.drawing: + drawing = Drawing() + drawing.embedded = 1 + self.drawing = drawing + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml", None] + ) + else: + drawing = self.drawing + + shape = Shape("rect", "TextBox", options) + shape.text = text + + drawing_object = drawing._add_drawing_object() + drawing_object["type"] = drawing_type + drawing_object["dimensions"] = dimensions + drawing_object["width"] = width + drawing_object["height"] = height + drawing_object["description"] = description + drawing_object["shape"] = shape + drawing_object["anchor"] = anchor + drawing_object["rel_index"] = 0 + drawing_object["url_rel_index"] = 0 + drawing_object["tip"] = options.get("tip") + drawing_object["decorative"] = decorative + + url = options.get("url", None) + if url: + target = None + rel_type = "/hyperlink" + target_mode = "External" + + if re.match("(ftp|http)s?://", url): + target = self._escape_url(url) + + if re.match("^mailto:", url): + target = self._escape_url(url) + + if re.match("external:", url): + target = url.replace("external:", "file:///") + target = self._escape_url(target) + # Additional escape not required in worksheet hyperlinks. + target = target.replace("#", "%23") + + if re.match("internal:", url): + target = url.replace("internal:", "#") + target_mode = None + + if target is not None: + if len(target) > self.max_url_length: + warn( + "Ignoring URL '%s' with link and/or anchor > %d " + "characters since it exceeds Excel's limit for URLS" + % (url, self.max_url_length) + ) + else: + if not self.drawing_rels.get(url): + self.drawing_links.append([rel_type, target, target_mode]) + + drawing_object["url_rel_index"] = self._get_drawing_rel_index(url) + + def _prepare_header_image( + self, image_id, width, height, name, image_type, position, x_dpi, y_dpi, digest + ): + # Set up an image without a drawing object for header/footer images. + + # Strip the extension from the filename. + name = re.sub(r"\..*$", "", name) + + if not self.vml_drawing_rels.get(digest): + self.vml_drawing_links.append( + ["/image", "../media/image" + str(image_id) + "." + image_type] + ) + + ref_id = self._get_vml_drawing_rel_index(digest) + + self.header_images_list.append( + [width, height, name, position, x_dpi, y_dpi, ref_id] + ) + + def _prepare_background(self, image_id, image_type): + # Set up an image without a drawing object for backgrounds. + self.external_background_links.append( + ["/image", "../media/image" + str(image_id) + "." + image_type] + ) + + def _prepare_chart(self, index, chart_id, drawing_id): + # Set up chart/drawings. + drawing_type = 1 + + ( + row, + col, + chart, + x_offset, + y_offset, + x_scale, + y_scale, + anchor, + description, + decorative, + ) = self.charts[index] + + chart.id = chart_id - 1 + + # Use user specified dimensions, if any. + width = int(0.5 + (chart.width * x_scale)) + height = int(0.5 + (chart.height * y_scale)) + + dimensions = self._position_object_emus( + col, row, x_offset, y_offset, width, height, anchor + ) + + # Set the chart name for the embedded object if it has been specified. + name = chart.chart_name + + # Create a Drawing obj to use with worksheet unless one already exists. + if not self.drawing: + drawing = Drawing() + drawing.embedded = 1 + self.drawing = drawing + + self.external_drawing_links.append( + ["/drawing", "../drawings/drawing" + str(drawing_id) + ".xml"] + ) + else: + drawing = self.drawing + + drawing_object = drawing._add_drawing_object() + drawing_object["type"] = drawing_type + drawing_object["dimensions"] = dimensions + drawing_object["width"] = width + drawing_object["height"] = height + drawing_object["name"] = name + drawing_object["shape"] = None + drawing_object["anchor"] = anchor + drawing_object["rel_index"] = self._get_drawing_rel_index() + drawing_object["url_rel_index"] = 0 + drawing_object["tip"] = None + drawing_object["description"] = description + drawing_object["decorative"] = decorative + + self.drawing_links.append( + ["/chart", "../charts/chart" + str(chart_id) + ".xml"] + ) + + def _position_object_emus( + self, col_start, row_start, x1, y1, width, height, anchor + ): + # Calculate the vertices that define the position of a graphical + # object within the worksheet in EMUs. + # + # The vertices are expressed as English Metric Units (EMUs). There are + # 12,700 EMUs per point. Therefore, 12,700 * 3 /4 = 9,525 EMUs per + # pixel + ( + col_start, + row_start, + x1, + y1, + col_end, + row_end, + x2, + y2, + x_abs, + y_abs, + ) = self._position_object_pixels( + col_start, row_start, x1, y1, width, height, anchor + ) + + # Convert the pixel values to EMUs. See above. + x1 = int(0.5 + 9525 * x1) + y1 = int(0.5 + 9525 * y1) + x2 = int(0.5 + 9525 * x2) + y2 = int(0.5 + 9525 * y2) + x_abs = int(0.5 + 9525 * x_abs) + y_abs = int(0.5 + 9525 * y_abs) + + return (col_start, row_start, x1, y1, col_end, row_end, x2, y2, x_abs, y_abs) + + # Calculate the vertices that define the position of a graphical object + # within the worksheet in pixels. + # + # +------------+------------+ + # | A | B | + # +-----+------------+------------+ + # | |(x1,y1) | | + # | 1 |(A1)._______|______ | + # | | | | | + # | | | | | + # +-----+----| OBJECT |-----+ + # | | | | | + # | 2 | |______________. | + # | | | (B2)| + # | | | (x2,y2)| + # +---- +------------+------------+ + # + # Example of an object that covers some of the area from cell A1 to B2. + # + # Based on the width and height of the object we need to calculate 8 vars: + # + # col_start, row_start, col_end, row_end, x1, y1, x2, y2. + # + # We also calculate the absolute x and y position of the top left vertex of + # the object. This is required for images. + # + # The width and height of the cells that the object occupies can be + # variable and have to be taken into account. + # + # The values of col_start and row_start are passed in from the calling + # function. The values of col_end and row_end are calculated by + # subtracting the width and height of the object from the width and + # height of the underlying cells. + # + def _position_object_pixels( + self, col_start, row_start, x1, y1, width, height, anchor + ): + # col_start # Col containing upper left corner of object. + # x1 # Distance to left side of object. + # + # row_start # Row containing top left corner of object. + # y1 # Distance to top of object. + # + # col_end # Col containing lower right corner of object. + # x2 # Distance to right side of object. + # + # row_end # Row containing bottom right corner of object. + # y2 # Distance to bottom of object. + # + # width # Width of object frame. + # height # Height of object frame. + # + # x_abs # Absolute distance to left side of object. + # y_abs # Absolute distance to top side of object. + x_abs = 0 + y_abs = 0 + + # Adjust start column for negative offsets. + while x1 < 0 and col_start > 0: + x1 += self._size_col(col_start - 1) + col_start -= 1 + + # Adjust start row for negative offsets. + while y1 < 0 and row_start > 0: + y1 += self._size_row(row_start - 1) + row_start -= 1 + + # Ensure that the image isn't shifted off the page at top left. + if x1 < 0: + x1 = 0 + + if y1 < 0: + y1 = 0 + + # Calculate the absolute x offset of the top-left vertex. + if self.col_size_changed: + for col_id in range(col_start): + x_abs += self._size_col(col_id) + else: + # Optimization for when the column widths haven't changed. + x_abs += self.default_col_pixels * col_start + + x_abs += x1 + + # Calculate the absolute y offset of the top-left vertex. + if self.row_size_changed: + for row_id in range(row_start): + y_abs += self._size_row(row_id) + else: + # Optimization for when the row heights haven't changed. + y_abs += self.default_row_pixels * row_start + + y_abs += y1 + + # Adjust start column for offsets that are greater than the col width. + while x1 >= self._size_col(col_start, anchor): + x1 -= self._size_col(col_start) + col_start += 1 + + # Adjust start row for offsets that are greater than the row height. + while y1 >= self._size_row(row_start, anchor): + y1 -= self._size_row(row_start) + row_start += 1 + + # Initialize end cell to the same as the start cell. + col_end = col_start + row_end = row_start + + # Don't offset the image in the cell if the row/col is hidden. + if self._size_col(col_start, anchor) > 0: + width = width + x1 + if self._size_row(row_start, anchor) > 0: + height = height + y1 + + # Subtract the underlying cell widths to find end cell of the object. + while width >= self._size_col(col_end, anchor): + width -= self._size_col(col_end, anchor) + col_end += 1 + + # Subtract the underlying cell heights to find end cell of the object. + while height >= self._size_row(row_end, anchor): + height -= self._size_row(row_end, anchor) + row_end += 1 + + # The end vertices are whatever is left from the width and height. + x2 = width + y2 = height + + return [col_start, row_start, x1, y1, col_end, row_end, x2, y2, x_abs, y_abs] + + def _size_col(self, col, anchor=0): + # Convert the width of a cell from character units to pixels. Excel + # rounds the column width to the nearest pixel. If the width hasn't + # been set by the user we use the default value. A hidden column is + # treated as having a width of zero unless it has the special + # "object_position" of 4 (size with cells). + max_digit_width = 7 # For Calibri 11. + padding = 5 + pixels = 0 + + # Look up the cell value to see if it has been changed. + if col in self.col_info: + width = self.col_info[col][0] + hidden = self.col_info[col][2] + + if width is None: + width = self.default_col_width + + # Convert to pixels. + if hidden and anchor != 4: + pixels = 0 + elif width < 1: + pixels = int(width * (max_digit_width + padding) + 0.5) + else: + pixels = int(width * max_digit_width + 0.5) + padding + else: + pixels = self.default_col_pixels + + return pixels + + def _size_row(self, row, anchor=0): + # Convert the height of a cell from character units to pixels. If the + # height hasn't been set by the user we use the default value. A + # hidden row is treated as having a height of zero unless it has the + # special "object_position" of 4 (size with cells). + pixels = 0 + + # Look up the cell value to see if it has been changed + if row in self.row_sizes: + height = self.row_sizes[row][0] + hidden = self.row_sizes[row][1] + + if hidden and anchor != 4: + pixels = 0 + else: + pixels = int(4.0 / 3.0 * height) + else: + pixels = int(4.0 / 3.0 * self.default_row_height) + + return pixels + + def _pixels_to_width(self, pixels): + # Convert the width of a cell from pixels to character units. + max_digit_width = 7.0 # For Calabri 11. + padding = 5.0 + + if pixels <= 12: + width = pixels / (max_digit_width + padding) + else: + width = (pixels - padding) / max_digit_width + + return width + + def _pixels_to_height(self, pixels): + # Convert the height of a cell from pixels to character units. + return 0.75 * pixels + + def _comment_params(self, row, col, string, options): + # This method handles the additional optional parameters to + # write_comment() as well as calculating the comment object + # position and vertices. + default_width = 128 + default_height = 74 + anchor = 0 + + params = { + "author": None, + "color": "#ffffe1", + "start_cell": None, + "start_col": None, + "start_row": None, + "visible": None, + "width": default_width, + "height": default_height, + "x_offset": None, + "x_scale": 1, + "y_offset": None, + "y_scale": 1, + "font_name": "Tahoma", + "font_size": 8, + "font_family": 2, + } + + # Overwrite the defaults with any user supplied values. Incorrect or + # misspelled parameters are silently ignored. + for key in options.keys(): + params[key] = options[key] + + # Ensure that a width and height have been set. + if not params["width"]: + params["width"] = default_width + if not params["height"]: + params["height"] = default_height + + # Set the comment background color. + params["color"] = xl_color(params["color"]).lower() + + # Convert from Excel XML style color to XML html style color. + params["color"] = params["color"].replace("ff", "#", 1) + + # Convert a cell reference to a row and column. + if params["start_cell"] is not None: + (start_row, start_col) = xl_cell_to_rowcol(params["start_cell"]) + params["start_row"] = start_row + params["start_col"] = start_col + + # Set the default start cell and offsets for the comment. These are + # generally fixed in relation to the parent cell. However there are + # some edge cases for cells at the, er, edges. + row_max = self.xls_rowmax + col_max = self.xls_colmax + + if params["start_row"] is None: + if row == 0: + params["start_row"] = 0 + elif row == row_max - 3: + params["start_row"] = row_max - 7 + elif row == row_max - 2: + params["start_row"] = row_max - 6 + elif row == row_max - 1: + params["start_row"] = row_max - 5 + else: + params["start_row"] = row - 1 + + if params["y_offset"] is None: + if row == 0: + params["y_offset"] = 2 + elif row == row_max - 3: + params["y_offset"] = 16 + elif row == row_max - 2: + params["y_offset"] = 16 + elif row == row_max - 1: + params["y_offset"] = 14 + else: + params["y_offset"] = 10 + + if params["start_col"] is None: + if col == col_max - 3: + params["start_col"] = col_max - 6 + elif col == col_max - 2: + params["start_col"] = col_max - 5 + elif col == col_max - 1: + params["start_col"] = col_max - 4 + else: + params["start_col"] = col + 1 + + if params["x_offset"] is None: + if col == col_max - 3: + params["x_offset"] = 49 + elif col == col_max - 2: + params["x_offset"] = 49 + elif col == col_max - 1: + params["x_offset"] = 49 + else: + params["x_offset"] = 15 + + # Scale the size of the comment box if required. + if params["x_scale"]: + params["width"] = params["width"] * params["x_scale"] + + if params["y_scale"]: + params["height"] = params["height"] * params["y_scale"] + + # Round the dimensions to the nearest pixel. + params["width"] = int(0.5 + params["width"]) + params["height"] = int(0.5 + params["height"]) + + # Calculate the positions of the comment object. + vertices = self._position_object_pixels( + params["start_col"], + params["start_row"], + params["x_offset"], + params["y_offset"], + params["width"], + params["height"], + anchor, + ) + + # Add the width and height for VML. + vertices.append(params["width"]) + vertices.append(params["height"]) + + return [ + row, + col, + string, + params["author"], + params["visible"], + params["color"], + params["font_name"], + params["font_size"], + params["font_family"], + ] + [vertices] + + def _button_params(self, row, col, options): + # This method handles the parameters passed to insert_button() as well + # as calculating the button object position and vertices. + + default_height = self.default_row_pixels + default_width = self.default_col_pixels + anchor = 0 + + button_number = 1 + len(self.buttons_list) + button = {"row": row, "col": col, "font": {}} + params = {} + + # Overwrite the defaults with any user supplied values. Incorrect or + # misspelled parameters are silently ignored. + for key in options.keys(): + params[key] = options[key] + + # Set the button caption. + caption = params.get("caption") + + # Set a default caption if none was specified by user. + if caption is None: + caption = "Button %d" % button_number + + button["font"]["caption"] = caption + + # Set the macro name. + if params.get("macro"): + button["macro"] = "[0]!" + params["macro"] + else: + button["macro"] = "[0]!Button%d_Click" % button_number + + # Set the alt text for the button. + button["description"] = params.get("description") + + # Ensure that a width and height have been set. + params["width"] = params.get("width", default_width) + params["height"] = params.get("height", default_height) + + # Set the x/y offsets. + params["x_offset"] = params.get("x_offset", 0) + params["y_offset"] = params.get("y_offset", 0) + + # Scale the size of the button if required. + params["width"] = params["width"] * params.get("x_scale", 1) + params["height"] = params["height"] * params.get("y_scale", 1) + + # Round the dimensions to the nearest pixel. + params["width"] = int(0.5 + params["width"]) + params["height"] = int(0.5 + params["height"]) + + params["start_row"] = row + params["start_col"] = col + + # Calculate the positions of the button object. + vertices = self._position_object_pixels( + params["start_col"], + params["start_row"], + params["x_offset"], + params["y_offset"], + params["width"], + params["height"], + anchor, + ) + + # Add the width and height for VML. + vertices.append(params["width"]) + vertices.append(params["height"]) + + button["vertices"] = vertices + + return button + + def _prepare_vml_objects( + self, vml_data_id, vml_shape_id, vml_drawing_id, comment_id + ): + comments = [] + # Sort the comments into row/column order for easier comparison + # testing and set the external links for comments and buttons. + row_nums = sorted(self.comments.keys()) + + for row in row_nums: + col_nums = sorted(self.comments[row].keys()) + + for col in col_nums: + user_options = self.comments[row][col] + params = self._comment_params(*user_options) + self.comments[row][col] = params + + # Set comment visibility if required and not user defined. + if self.comments_visible: + if self.comments[row][col][4] is None: + self.comments[row][col][4] = 1 + + # Set comment author if not already user defined. + if self.comments[row][col][3] is None: + self.comments[row][col][3] = self.comments_author + + comments.append(self.comments[row][col]) + + self.external_vml_links.append( + ["/vmlDrawing", "../drawings/vmlDrawing" + str(vml_drawing_id) + ".vml"] + ) + + if self.has_comments: + self.comments_list = comments + + self.external_comment_links.append( + ["/comments", "../comments" + str(comment_id) + ".xml"] + ) + + count = len(comments) + start_data_id = vml_data_id + + # The VML o:idmap data id contains a comma separated range when there + # is more than one 1024 block of comments, like this: data="1,2". + for i in range(int(count / 1024)): + vml_data_id = "%s,%d" % (vml_data_id, start_data_id + i + 1) + + self.vml_data_id = vml_data_id + self.vml_shape_id = vml_shape_id + + return count + + def _prepare_header_vml_objects(self, vml_header_id, vml_drawing_id): + # Set up external linkage for VML header/footer images. + + self.vml_header_id = vml_header_id + + self.external_vml_links.append( + ["/vmlDrawing", "../drawings/vmlDrawing" + str(vml_drawing_id) + ".vml"] + ) + + def _prepare_tables(self, table_id, seen): + # Set the table ids for the worksheet tables. + for table in self.tables: + table["id"] = table_id + + if table.get("name") is None: + # Set a default name. + table["name"] = "Table" + str(table_id) + + # Check for duplicate table names. + name = table["name"].lower() + + if name in seen: + raise DuplicateTableName( + "Duplicate name '%s' used in worksheet.add_table()." % table["name"] + ) + else: + seen[name] = True + + # Store the link used for the rels file. + self.external_table_links.append( + ["/table", "../tables/table" + str(table_id) + ".xml"] + ) + table_id += 1 + + def _table_function_to_formula(self, function, col_name): + # Convert a table total function to a worksheet formula. + formula = "" + + # Escape special characters, as required by Excel. + col_name = col_name.replace("'", "''") + col_name = col_name.replace("#", "'#") + col_name = col_name.replace("]", "']") + col_name = col_name.replace("[", "'[") + + subtotals = { + "average": 101, + "countNums": 102, + "count": 103, + "max": 104, + "min": 105, + "stdDev": 107, + "sum": 109, + "var": 110, + } + + if function in subtotals: + func_num = subtotals[function] + formula = "SUBTOTAL(%s,[%s])" % (func_num, col_name) + else: + warn("Unsupported function '%s' in add_table()" % function) + + return formula + + def _set_spark_color(self, sparkline, options, user_color): + # Set the sparkline color. + if user_color not in options: + return + + sparkline[user_color] = {"rgb": xl_color(options[user_color])} + + def _get_range_data(self, row_start, col_start, row_end, col_end): + # Returns a range of data from the worksheet _table to be used in + # chart cached data. Strings are returned as SST ids and decoded + # in the workbook. Return None for data that doesn't exist since + # Excel can chart series with data missing. + + if self.constant_memory: + return () + + data = [] + + # Iterate through the table data. + for row_num in range(row_start, row_end + 1): + # Store None if row doesn't exist. + if row_num not in self.table: + data.append(None) + continue + + for col_num in range(col_start, col_end + 1): + if col_num in self.table[row_num]: + cell = self.table[row_num][col_num] + + cell_type = cell.__class__.__name__ + + if cell_type in ("Number", "Datetime"): + # Return a number with Excel's precision. + data.append("%.16g" % cell.number) + + elif cell_type == "String": + # Return a string from it's shared string index. + index = cell.string + string = self.str_table._get_shared_string(index) + + data.append(string) + + elif cell_type in ("Formula", "ArrayFormula"): + # Return the formula value. + value = cell.value + + if value is None: + value = 0 + + data.append(value) + + elif cell_type == "Blank": + # Return a empty cell. + data.append("") + else: + # Store None if column doesn't exist. + data.append(None) + + return data + + def _csv_join(self, *items): + # Create a csv string for use with data validation formulas and lists. + + # Convert non string types to string. + items = [str(item) if not isinstance(item, str) else item for item in items] + + return ",".join(items) + + def _escape_url(self, url): + # Don't escape URL if it looks already escaped. + if re.search("%[0-9a-fA-F]{2}", url): + return url + + # Can't use url.quote() here because it doesn't match Excel. + url = url.replace("%", "%25") + url = url.replace('"', "%22") + url = url.replace(" ", "%20") + url = url.replace("<", "%3c") + url = url.replace(">", "%3e") + url = url.replace("[", "%5b") + url = url.replace("]", "%5d") + url = url.replace("^", "%5e") + url = url.replace("`", "%60") + url = url.replace("{", "%7b") + url = url.replace("}", "%7d") + + return url + + def _get_drawing_rel_index(self, target=None): + # Get the index used to address a drawing rel link. + if target is None: + self.drawing_rels_id += 1 + return self.drawing_rels_id + elif self.drawing_rels.get(target): + return self.drawing_rels[target] + else: + self.drawing_rels_id += 1 + self.drawing_rels[target] = self.drawing_rels_id + return self.drawing_rels_id + + def _get_vml_drawing_rel_index(self, target=None): + # Get the index used to address a vml drawing rel link. + if self.vml_drawing_rels.get(target): + return self.vml_drawing_rels[target] + else: + self.vml_drawing_rels_id += 1 + self.vml_drawing_rels[target] = self.vml_drawing_rels_id + return self.vml_drawing_rels_id + + ########################################################################### + # + # The following font methods are, more or less, duplicated from the + # Styles class. Not the cleanest version of reuse but works for now. + # + ########################################################################### + def _write_font(self, xf_format): + # Write the element. + xml_writer = self.rstring + + xml_writer._xml_start_tag("rPr") + + # Handle the main font properties. + if xf_format.bold: + xml_writer._xml_empty_tag("b") + if xf_format.italic: + xml_writer._xml_empty_tag("i") + if xf_format.font_strikeout: + xml_writer._xml_empty_tag("strike") + if xf_format.font_outline: + xml_writer._xml_empty_tag("outline") + if xf_format.font_shadow: + xml_writer._xml_empty_tag("shadow") + + # Handle the underline variants. + if xf_format.underline: + self._write_underline(xf_format.underline) + + # Handle super/subscript. + if xf_format.font_script == 1: + self._write_vert_align("superscript") + if xf_format.font_script == 2: + self._write_vert_align("subscript") + + # Write the font size + xml_writer._xml_empty_tag("sz", [("val", xf_format.font_size)]) + + # Handle colors. + if xf_format.theme == -1: + # Ignore for excel2003_style. + pass + elif xf_format.theme: + self._write_color("theme", xf_format.theme) + elif xf_format.color_indexed: + self._write_color("indexed", xf_format.color_indexed) + elif xf_format.font_color: + color = self._get_palette_color(xf_format.font_color) + self._write_rstring_color("rgb", color) + else: + self._write_rstring_color("theme", 1) + + # Write some other font properties related to font families. + xml_writer._xml_empty_tag("rFont", [("val", xf_format.font_name)]) + xml_writer._xml_empty_tag("family", [("val", xf_format.font_family)]) + + if xf_format.font_name == "Calibri" and not xf_format.hyperlink: + xml_writer._xml_empty_tag("scheme", [("val", xf_format.font_scheme)]) + + xml_writer._xml_end_tag("rPr") + + def _write_underline(self, underline): + # Write the underline font element. + attributes = [] + + # Handle the underline variants. + if underline == 2: + attributes = [("val", "double")] + elif underline == 33: + attributes = [("val", "singleAccounting")] + elif underline == 34: + attributes = [("val", "doubleAccounting")] + + self.rstring._xml_empty_tag("u", attributes) + + def _write_vert_align(self, val): + # Write the font sub-element. + attributes = [("val", val)] + + self.rstring._xml_empty_tag("vertAlign", attributes) + + def _write_rstring_color(self, name, value): + # Write the element. + attributes = [(name, value)] + + self.rstring._xml_empty_tag("color", attributes) + + def _get_palette_color(self, color): + # Convert the RGB color. + if color[0] == "#": + color = color[1:] + + return "FF" + color.upper() + + def _opt_close(self): + # Close the row data filehandle in constant_memory mode. + if not self.row_data_fh_closed: + self.row_data_fh.close() + self.row_data_fh_closed = True + + def _opt_reopen(self): + # Reopen the row data filehandle in constant_memory mode. + if self.row_data_fh_closed: + filename = self.row_data_filename + self.row_data_fh = open(filename, mode="a+", encoding="utf-8") + self.row_data_fh_closed = False + self.fh = self.row_data_fh + + def _set_icon_props(self, total_icons, user_props=None): + # Set the sub-properties for icons. + props = [] + + # Set the defaults. + for _ in range(total_icons): + props.append({"criteria": False, "value": 0, "type": "percent"}) + + # Set the default icon values based on the number of icons. + if total_icons == 3: + props[0]["value"] = 67 + props[1]["value"] = 33 + + if total_icons == 4: + props[0]["value"] = 75 + props[1]["value"] = 50 + props[2]["value"] = 25 + + if total_icons == 5: + props[0]["value"] = 80 + props[1]["value"] = 60 + props[2]["value"] = 40 + props[3]["value"] = 20 + + # Overwrite default properties with user defined properties. + if user_props: + # Ensure we don't set user properties for lowest icon. + max_data = len(user_props) + if max_data >= total_icons: + max_data = total_icons - 1 + + for i in range(max_data): + # Set the user defined 'value' property. + if user_props[i].get("value") is not None: + props[i]["value"] = user_props[i]["value"] + + # Remove the formula '=' sign if it exists. + tmp = props[i]["value"] + if isinstance(tmp, str) and tmp.startswith("="): + props[i]["value"] = tmp.lstrip("=") + + # Set the user defined 'type' property. + if user_props[i].get("type"): + valid_types = ("percent", "percentile", "number", "formula") + + if user_props[i]["type"] not in valid_types: + warn( + "Unknown icon property type '%s' for sub-" + "property 'type' in conditional_format()" + % user_props[i]["type"] + ) + else: + props[i]["type"] = user_props[i]["type"] + + if props[i]["type"] == "number": + props[i]["type"] = "num" + + # Set the user defined 'criteria' property. + criteria = user_props[i].get("criteria") + if criteria and criteria == ">": + props[i]["criteria"] = True + + return props + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_worksheet(self): + # Write the element. This is the root element. + + schema = "http://schemas.openxmlformats.org/" + xmlns = schema + "spreadsheetml/2006/main" + xmlns_r = schema + "officeDocument/2006/relationships" + xmlns_mc = schema + "markup-compatibility/2006" + ms_schema = "http://schemas.microsoft.com/" + xmlns_x14ac = ms_schema + "office/spreadsheetml/2009/9/ac" + + attributes = [("xmlns", xmlns), ("xmlns:r", xmlns_r)] + + # Add some extra attributes for Excel 2010. Mainly for sparklines. + if self.excel_version == 2010: + attributes.append(("xmlns:mc", xmlns_mc)) + attributes.append(("xmlns:x14ac", xmlns_x14ac)) + attributes.append(("mc:Ignorable", "x14ac")) + + self._xml_start_tag("worksheet", attributes) + + def _write_dimension(self): + # Write the element. This specifies the range of + # cells in the worksheet. As a special case, empty + # spreadsheets use 'A1' as a range. + + if self.dim_rowmin is None and self.dim_colmin is None: + # If the min dimensions are not defined then no dimensions + # have been set and we use the default 'A1'. + ref = "A1" + + elif self.dim_rowmin is None and self.dim_colmin is not None: + # If the row dimensions aren't set but the column + # dimensions are set then they have been changed via + # set_column(). + + if self.dim_colmin == self.dim_colmax: + # The dimensions are a single cell and not a range. + ref = xl_rowcol_to_cell(0, self.dim_colmin) + else: + # The dimensions are a cell range. + cell_1 = xl_rowcol_to_cell(0, self.dim_colmin) + cell_2 = xl_rowcol_to_cell(0, self.dim_colmax) + ref = cell_1 + ":" + cell_2 + + elif self.dim_rowmin == self.dim_rowmax and self.dim_colmin == self.dim_colmax: + # The dimensions are a single cell and not a range. + ref = xl_rowcol_to_cell(self.dim_rowmin, self.dim_colmin) + else: + # The dimensions are a cell range. + cell_1 = xl_rowcol_to_cell(self.dim_rowmin, self.dim_colmin) + cell_2 = xl_rowcol_to_cell(self.dim_rowmax, self.dim_colmax) + ref = cell_1 + ":" + cell_2 + + self._xml_empty_tag("dimension", [("ref", ref)]) + + def _write_sheet_views(self): + # Write the element. + self._xml_start_tag("sheetViews") + + # Write the sheetView element. + self._write_sheet_view() + + self._xml_end_tag("sheetViews") + + def _write_sheet_view(self): + # Write the element. + attributes = [] + + # Hide screen gridlines if required. + if not self.screen_gridlines: + attributes.append(("showGridLines", 0)) + + # Hide screen row/column headers. + if self.row_col_headers: + attributes.append(("showRowColHeaders", 0)) + + # Hide zeroes in cells. + if not self.show_zeros: + attributes.append(("showZeros", 0)) + + # Display worksheet right to left for Hebrew, Arabic and others. + if self.is_right_to_left: + attributes.append(("rightToLeft", 1)) + + # Show that the sheet tab is selected. + if self.selected: + attributes.append(("tabSelected", 1)) + + # Turn outlines off. Also required in the outlinePr element. + if not self.outline_on: + attributes.append(("showOutlineSymbols", 0)) + + # Set the page view/layout mode if required. + if self.page_view == 1: + attributes.append(("view", "pageLayout")) + elif self.page_view == 2: + attributes.append(("view", "pageBreakPreview")) + + # Set the first visible cell. + if self.top_left_cell != "": + attributes.append(("topLeftCell", self.top_left_cell)) + + # Set the zoom level. + if self.zoom != 100: + attributes.append(("zoomScale", self.zoom)) + + if self.page_view == 0 and self.zoom_scale_normal: + attributes.append(("zoomScaleNormal", self.zoom)) + if self.page_view == 1: + attributes.append(("zoomScalePageLayoutView", self.zoom)) + if self.page_view == 2: + attributes.append(("zoomScaleSheetLayoutView", self.zoom)) + + attributes.append(("workbookViewId", 0)) + + if self.panes or len(self.selections): + self._xml_start_tag("sheetView", attributes) + self._write_panes() + self._write_selections() + self._xml_end_tag("sheetView") + else: + self._xml_empty_tag("sheetView", attributes) + + def _write_sheet_format_pr(self): + # Write the element. + default_row_height = self.default_row_height + row_level = self.outline_row_level + col_level = self.outline_col_level + + attributes = [("defaultRowHeight", default_row_height)] + + if self.default_row_height != self.original_row_height: + attributes.append(("customHeight", 1)) + + if self.default_row_zeroed: + attributes.append(("zeroHeight", 1)) + + if row_level: + attributes.append(("outlineLevelRow", row_level)) + if col_level: + attributes.append(("outlineLevelCol", col_level)) + + if self.excel_version == 2010: + attributes.append(("x14ac:dyDescent", "0.25")) + + self._xml_empty_tag("sheetFormatPr", attributes) + + def _write_cols(self): + # Write the element and
sub elements. + + # Exit unless some column have been formatted. + if not self.col_info: + return + + self._xml_start_tag("cols") + + # Use the first element of the column information structures to set + # the initial/previous properties. + first_col = (sorted(self.col_info.keys()))[0] + last_col = first_col + prev_col_options = self.col_info[first_col] + del self.col_info[first_col] + deleted_col = first_col + deleted_col_options = prev_col_options + + for col in sorted(self.col_info.keys()): + col_options = self.col_info[col] + # Check if the column number is contiguous with the previous + # column and if the properties are the same. + if col == last_col + 1 and col_options == prev_col_options: + last_col = col + else: + # If not contiguous/equal then we write out the current range + # of columns and start again. + self._write_col_info(first_col, last_col, prev_col_options) + first_col = col + last_col = first_col + prev_col_options = col_options + + # We will exit the previous loop with one unhandled column range. + self._write_col_info(first_col, last_col, prev_col_options) + + # Put back the deleted first column information structure. + self.col_info[deleted_col] = deleted_col_options + + self._xml_end_tag("cols") + + def _write_col_info(self, col_min, col_max, col_info): + # Write the element. + (width, cell_format, hidden, level, collapsed, autofit) = col_info + + custom_width = 1 + xf_index = 0 + + # Get the cell_format index. + if cell_format: + xf_index = cell_format._get_xf_index() + + # Set the Excel default column width. + if width is None: + if not hidden: + width = 8.43 + custom_width = 0 + else: + width = 0 + elif width == 8.43: + # Width is defined but same as default. + custom_width = 0 + + # Convert column width from user units to character width. + if width > 0: + # For Calabri 11. + max_digit_width = 7 + padding = 5 + + if width < 1: + width = ( + int( + (int(width * (max_digit_width + padding) + 0.5)) + / float(max_digit_width) + * 256.0 + ) + / 256.0 + ) + else: + width = ( + int( + (int(width * max_digit_width + 0.5) + padding) + / float(max_digit_width) + * 256.0 + ) + / 256.0 + ) + + attributes = [ + ("min", col_min + 1), + ("max", col_max + 1), + ("width", "%.16g" % width), + ] + + if xf_index: + attributes.append(("style", xf_index)) + if hidden: + attributes.append(("hidden", "1")) + if autofit: + attributes.append(("bestFit", "1")) + if custom_width: + attributes.append(("customWidth", "1")) + if level: + attributes.append(("outlineLevel", level)) + if collapsed: + attributes.append(("collapsed", "1")) + + self._xml_empty_tag("col", attributes) + + def _write_sheet_data(self): + # Write the element. + + if self.dim_rowmin is None: + # If the dimensions aren't defined there is no data to write. + self._xml_empty_tag("sheetData") + else: + self._xml_start_tag("sheetData") + self._write_rows() + self._xml_end_tag("sheetData") + + def _write_optimized_sheet_data(self): + # Write the element when constant_memory is on. In this + # case we read the data stored in the temp file and rewrite it to the + # XML sheet file. + if self.dim_rowmin is None: + # If the dimensions aren't defined then there is no data to write. + self._xml_empty_tag("sheetData") + else: + self._xml_start_tag("sheetData") + + # Rewind the filehandle that was used for temp row data. + buff_size = 65536 + self.row_data_fh.seek(0) + data = self.row_data_fh.read(buff_size) + + while data: + self.fh.write(data) + data = self.row_data_fh.read(buff_size) + + self.row_data_fh.close() + os.unlink(self.row_data_filename) + + self._xml_end_tag("sheetData") + + def _write_page_margins(self): + # Write the element. + attributes = [ + ("left", self.margin_left), + ("right", self.margin_right), + ("top", self.margin_top), + ("bottom", self.margin_bottom), + ("header", self.margin_header), + ("footer", self.margin_footer), + ] + + self._xml_empty_tag("pageMargins", attributes) + + def _write_page_setup(self): + # Write the element. + # + # The following is an example taken from Excel. + # + # + # + attributes = [] + + # Skip this element if no page setup has changed. + if not self.page_setup_changed: + return + + # Set paper size. + if self.paper_size: + attributes.append(("paperSize", self.paper_size)) + + # Set the print_scale. + if self.print_scale != 100: + attributes.append(("scale", self.print_scale)) + + # Set the "Fit to page" properties. + if self.fit_page and self.fit_width != 1: + attributes.append(("fitToWidth", self.fit_width)) + + if self.fit_page and self.fit_height != 1: + attributes.append(("fitToHeight", self.fit_height)) + + # Set the page print direction. + if self.page_order: + attributes.append(("pageOrder", "overThenDown")) + + # Set start page for printing. + if self.page_start > 1: + attributes.append(("firstPageNumber", self.page_start)) + + # Set page orientation. + if self.orientation: + attributes.append(("orientation", "portrait")) + else: + attributes.append(("orientation", "landscape")) + + # Set the print in black and white option. + if self.black_white: + attributes.append(("blackAndWhite", "1")) + + # Set start page for printing. + if self.page_start != 0: + attributes.append(("useFirstPageNumber", "1")) + + # Set the DPI. Mainly only for testing. + if self.is_chartsheet: + if self.horizontal_dpi: + attributes.append(("horizontalDpi", self.horizontal_dpi)) + + if self.vertical_dpi: + attributes.append(("verticalDpi", self.vertical_dpi)) + else: + if self.vertical_dpi: + attributes.append(("verticalDpi", self.vertical_dpi)) + + if self.horizontal_dpi: + attributes.append(("horizontalDpi", self.horizontal_dpi)) + + self._xml_empty_tag("pageSetup", attributes) + + def _write_print_options(self): + # Write the element. + attributes = [] + + if not self.print_options_changed: + return + + # Set horizontal centering. + if self.hcenter: + attributes.append(("horizontalCentered", 1)) + + # Set vertical centering. + if self.vcenter: + attributes.append(("verticalCentered", 1)) + + # Enable row and column headers. + if self.print_headers: + attributes.append(("headings", 1)) + + # Set printed gridlines. + if self.print_gridlines: + attributes.append(("gridLines", 1)) + + self._xml_empty_tag("printOptions", attributes) + + def _write_header_footer(self): + # Write the element. + attributes = [] + + if not self.header_footer_scales: + attributes.append(("scaleWithDoc", 0)) + + if not self.header_footer_aligns: + attributes.append(("alignWithMargins", 0)) + + if self.header_footer_changed: + self._xml_start_tag("headerFooter", attributes) + if self.header: + self._write_odd_header() + if self.footer: + self._write_odd_footer() + self._xml_end_tag("headerFooter") + elif self.excel2003_style: + self._xml_empty_tag("headerFooter", attributes) + + def _write_odd_header(self): + # Write the element. + self._xml_data_element("oddHeader", self.header) + + def _write_odd_footer(self): + # Write the element. + self._xml_data_element("oddFooter", self.footer) + + def _write_rows(self): + # Write out the worksheet data as a series of rows and cells. + self._calculate_spans() + + for row_num in range(self.dim_rowmin, self.dim_rowmax + 1): + if ( + row_num in self.set_rows + or row_num in self.comments + or self.table[row_num] + ): + # Only process rows with formatting, cell data and/or comments. + + span_index = int(row_num / 16) + + if span_index in self.row_spans: + span = self.row_spans[span_index] + else: + span = None + + if self.table[row_num]: + # Write the cells if the row contains data. + if row_num not in self.set_rows: + self._write_row(row_num, span) + else: + self._write_row(row_num, span, self.set_rows[row_num]) + + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + col_ref = self.table[row_num][col_num] + self._write_cell(row_num, col_num, col_ref) + + self._xml_end_tag("row") + + elif row_num in self.comments: + # Row with comments in cells. + self._write_empty_row(row_num, span, self.set_rows[row_num]) + else: + # Blank row with attributes only. + self._write_empty_row(row_num, span, self.set_rows[row_num]) + + def _write_single_row(self, current_row_num=0): + # Write out the worksheet data as a single row with cells. + # This method is used when constant_memory is on. A single + # row is written and the data table is reset. That way only + # one row of data is kept in memory at any one time. We don't + # write span data in the optimized case since it is optional. + + # Set the new previous row as the current row. + row_num = self.previous_row + self.previous_row = current_row_num + + if row_num in self.set_rows or row_num in self.comments or self.table[row_num]: + # Only process rows with formatting, cell data and/or comments. + + # No span data in optimized mode. + span = None + + if self.table[row_num]: + # Write the cells if the row contains data. + if row_num not in self.set_rows: + self._write_row(row_num, span) + else: + self._write_row(row_num, span, self.set_rows[row_num]) + + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + col_ref = self.table[row_num][col_num] + self._write_cell(row_num, col_num, col_ref) + + self._xml_end_tag("row") + else: + # Row attributes or comments only. + self._write_empty_row(row_num, span, self.set_rows[row_num]) + + # Reset table. + self.table.clear() + + def _calculate_spans(self): + # Calculate the "spans" attribute of the tag. This is an + # XLSX optimization and isn't strictly required. However, it + # makes comparing files easier. The span is the same for each + # block of 16 rows. + spans = {} + span_min = None + span_max = None + + for row_num in range(self.dim_rowmin, self.dim_rowmax + 1): + if row_num in self.table: + # Calculate spans for cell data. + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if col_num in self.table[row_num]: + if span_min is None: + span_min = col_num + span_max = col_num + else: + if col_num < span_min: + span_min = col_num + if col_num > span_max: + span_max = col_num + + if row_num in self.comments: + # Calculate spans for comments. + for col_num in range(self.dim_colmin, self.dim_colmax + 1): + if row_num in self.comments and col_num in self.comments[row_num]: + if span_min is None: + span_min = col_num + span_max = col_num + else: + if col_num < span_min: + span_min = col_num + if col_num > span_max: + span_max = col_num + + if ((row_num + 1) % 16 == 0) or row_num == self.dim_rowmax: + span_index = int(row_num / 16) + + if span_min is not None: + span_min += 1 + span_max += 1 + spans[span_index] = "%s:%s" % (span_min, span_max) + span_min = None + + self.row_spans = spans + + def _write_row(self, row, spans, properties=None, empty_row=False): + # Write the element. + xf_index = 0 + + if properties: + height, cell_format, hidden, level, collapsed = properties + else: + height, cell_format, hidden, level, collapsed = None, None, 0, 0, 0 + + if height is None: + height = self.default_row_height + + attributes = [("r", row + 1)] + + # Get the cell_format index. + if cell_format: + xf_index = cell_format._get_xf_index() + + # Add row attributes where applicable. + if spans: + attributes.append(("spans", spans)) + + if xf_index: + attributes.append(("s", xf_index)) + + if cell_format: + attributes.append(("customFormat", 1)) + + if height != self.original_row_height: + attributes.append(("ht", "%g" % height)) + + if hidden: + attributes.append(("hidden", 1)) + + if height != self.original_row_height: + attributes.append(("customHeight", 1)) + + if level: + attributes.append(("outlineLevel", level)) + + if collapsed: + attributes.append(("collapsed", 1)) + + if self.excel_version == 2010: + attributes.append(("x14ac:dyDescent", "0.25")) + + if empty_row: + self._xml_empty_tag_unencoded("row", attributes) + else: + self._xml_start_tag_unencoded("row", attributes) + + def _write_empty_row(self, row, spans, properties=None): + # Write and empty element. + self._write_row(row, spans, properties, empty_row=True) + + def _write_cell(self, row, col, cell): + # Write the element. + # Note. This is the innermost loop so efficiency is important. + + cell_range = xl_rowcol_to_cell_fast(row, col) + attributes = [("r", cell_range)] + + if cell.format: + # Add the cell format index. + xf_index = cell.format._get_xf_index() + attributes.append(("s", xf_index)) + elif row in self.set_rows and self.set_rows[row][1]: + # Add the row format. + row_xf = self.set_rows[row][1] + attributes.append(("s", row_xf._get_xf_index())) + elif col in self.col_info: + # Add the column format. + col_xf = self.col_info[col][1] + if col_xf is not None: + attributes.append(("s", col_xf._get_xf_index())) + + type_cell_name = cell.__class__.__name__ + + # Write the various cell types. + if type_cell_name in ("Number", "Datetime"): + # Write a number. + self._xml_number_element(cell.number, attributes) + + elif type_cell_name in ("String", "RichString"): + # Write a string. + string = cell.string + + if not self.constant_memory: + # Write a shared string. + self._xml_string_element(string, attributes) + else: + # Write an optimized in-line string. + + # Escape control characters. See SharedString.pm for details. + string = re_control_chars_1.sub(r"_x005F\1", string) + string = re_control_chars_2.sub( + lambda match: "_x%04X_" % ord(match.group(1)), string + ) + + # Escapes non characters in strings. + string = string.replace("\uFFFE", "_xFFFE_") + string = string.replace("\uFFFF", "_xFFFF_") + + # Write any rich strings without further tags. + if string.startswith("") and string.endswith(""): + self._xml_rich_inline_string(string, attributes) + else: + # Add attribute to preserve leading or trailing whitespace. + preserve = preserve_whitespace(string) + self._xml_inline_string(string, preserve, attributes) + + elif type_cell_name == "Formula": + # Write a formula. First check the formula value type. + value = cell.value + if type(cell.value) == bool: + attributes.append(("t", "b")) + if cell.value: + value = 1 + else: + value = 0 + + elif isinstance(cell.value, str): + error_codes = ( + "#DIV/0!", + "#N/A", + "#NAME?", + "#NULL!", + "#NUM!", + "#REF!", + "#VALUE!", + ) + + if cell.value == "": + # Allow blank to force recalc in some third party apps. + pass + elif cell.value in error_codes: + attributes.append(("t", "e")) + else: + attributes.append(("t", "str")) + + self._xml_formula_element(cell.formula, value, attributes) + + elif type_cell_name == "ArrayFormula": + # Write a array formula. + + if cell.atype == "dynamic": + attributes.append(("cm", 1)) + + # First check if the formula value is a string. + try: + float(cell.value) + except ValueError: + attributes.append(("t", "str")) + + # Write an array formula. + self._xml_start_tag("c", attributes) + + self._write_cell_array_formula(cell.formula, cell.range) + self._write_cell_value(cell.value) + self._xml_end_tag("c") + + elif type_cell_name == "Blank": + # Write a empty cell. + self._xml_empty_tag("c", attributes) + + elif type_cell_name == "Boolean": + # Write a boolean cell. + attributes.append(("t", "b")) + self._xml_start_tag("c", attributes) + self._write_cell_value(cell.boolean) + self._xml_end_tag("c") + + def _write_cell_value(self, value): + # Write the cell value element. + if value is None: + value = "" + + self._xml_data_element("v", value) + + def _write_cell_array_formula(self, formula, cell_range): + # Write the cell array formula element. + attributes = [("t", "array"), ("ref", cell_range)] + + self._xml_data_element("f", formula, attributes) + + def _write_sheet_pr(self): + # Write the element for Sheet level properties. + attributes = [] + + if ( + not self.fit_page + and not self.filter_on + and not self.tab_color + and not self.outline_changed + and not self.vba_codename + ): + return + + if self.vba_codename: + attributes.append(("codeName", self.vba_codename)) + + if self.filter_on: + attributes.append(("filterMode", 1)) + + if self.fit_page or self.tab_color or self.outline_changed: + self._xml_start_tag("sheetPr", attributes) + self._write_tab_color() + self._write_outline_pr() + self._write_page_set_up_pr() + self._xml_end_tag("sheetPr") + else: + self._xml_empty_tag("sheetPr", attributes) + + def _write_page_set_up_pr(self): + # Write the element. + if not self.fit_page: + return + + attributes = [("fitToPage", 1)] + self._xml_empty_tag("pageSetUpPr", attributes) + + def _write_tab_color(self): + # Write the element. + color = self.tab_color + + if not color: + return + + attributes = [("rgb", color)] + + self._xml_empty_tag("tabColor", attributes) + + def _write_outline_pr(self): + # Write the element. + attributes = [] + + if not self.outline_changed: + return + + if self.outline_style: + attributes.append(("applyStyles", 1)) + if not self.outline_below: + attributes.append(("summaryBelow", 0)) + if not self.outline_right: + attributes.append(("summaryRight", 0)) + if not self.outline_on: + attributes.append(("showOutlineSymbols", 0)) + + self._xml_empty_tag("outlinePr", attributes) + + def _write_row_breaks(self): + # Write the element. + page_breaks = self._sort_pagebreaks(self.hbreaks) + + if not page_breaks: + return + + count = len(page_breaks) + + attributes = [ + ("count", count), + ("manualBreakCount", count), + ] + + self._xml_start_tag("rowBreaks", attributes) + + for row_num in page_breaks: + self._write_brk(row_num, 16383) + + self._xml_end_tag("rowBreaks") + + def _write_col_breaks(self): + # Write the element. + page_breaks = self._sort_pagebreaks(self.vbreaks) + + if not page_breaks: + return + + count = len(page_breaks) + + attributes = [ + ("count", count), + ("manualBreakCount", count), + ] + + self._xml_start_tag("colBreaks", attributes) + + for col_num in page_breaks: + self._write_brk(col_num, 1048575) + + self._xml_end_tag("colBreaks") + + def _write_brk(self, brk_id, brk_max): + # Write the element. + attributes = [("id", brk_id), ("max", brk_max), ("man", 1)] + + self._xml_empty_tag("brk", attributes) + + def _write_merge_cells(self): + # Write the element. + merged_cells = self.merge + count = len(merged_cells) + + if not count: + return + + attributes = [("count", count)] + + self._xml_start_tag("mergeCells", attributes) + + for merged_range in merged_cells: + # Write the mergeCell element. + self._write_merge_cell(merged_range) + + self._xml_end_tag("mergeCells") + + def _write_merge_cell(self, merged_range): + # Write the element. + (row_min, col_min, row_max, col_max) = merged_range + + # Convert the merge dimensions to a cell range. + cell_1 = xl_rowcol_to_cell(row_min, col_min) + cell_2 = xl_rowcol_to_cell(row_max, col_max) + ref = cell_1 + ":" + cell_2 + + attributes = [("ref", ref)] + + self._xml_empty_tag("mergeCell", attributes) + + def _write_hyperlinks(self): + # Process any stored hyperlinks in row/col order and write the + # element. The attributes are different for internal + # and external links. + hlink_refs = [] + display = None + + # Sort the hyperlinks into row order. + row_nums = sorted(self.hyperlinks.keys()) + + # Exit if there are no hyperlinks to process. + if not row_nums: + return + + # Iterate over the rows. + for row_num in row_nums: + # Sort the hyperlinks into column order. + col_nums = sorted(self.hyperlinks[row_num].keys()) + + # Iterate over the columns. + for col_num in col_nums: + # Get the link data for this cell. + link = self.hyperlinks[row_num][col_num] + link_type = link["link_type"] + + # If the cell isn't a string then we have to add the url as + # the string to display. + if self.table and self.table[row_num] and self.table[row_num][col_num]: + cell = self.table[row_num][col_num] + if cell.__class__.__name__ != "String": + display = link["url"] + + if link_type == 1: + # External link with rel file relationship. + self.rel_count += 1 + + hlink_refs.append( + [ + link_type, + row_num, + col_num, + self.rel_count, + link["str"], + display, + link["tip"], + ] + ) + + # Links for use by the packager. + self.external_hyper_links.append( + ["/hyperlink", link["url"], "External"] + ) + else: + # Internal link with rel file relationship. + hlink_refs.append( + [ + link_type, + row_num, + col_num, + link["url"], + link["str"], + link["tip"], + ] + ) + + # Write the hyperlink elements. + self._xml_start_tag("hyperlinks") + + for args in hlink_refs: + link_type = args.pop(0) + + if link_type == 1: + self._write_hyperlink_external(*args) + elif link_type == 2: + self._write_hyperlink_internal(*args) + + self._xml_end_tag("hyperlinks") + + def _write_hyperlink_external( + self, row, col, id_num, location=None, display=None, tooltip=None + ): + # Write the element for external links. + ref = xl_rowcol_to_cell(row, col) + r_id = "rId" + str(id_num) + + attributes = [("ref", ref), ("r:id", r_id)] + + if location is not None: + attributes.append(("location", location)) + if display is not None: + attributes.append(("display", display)) + if tooltip is not None: + attributes.append(("tooltip", tooltip)) + + self._xml_empty_tag("hyperlink", attributes) + + def _write_hyperlink_internal( + self, row, col, location=None, display=None, tooltip=None + ): + # Write the element for internal links. + ref = xl_rowcol_to_cell(row, col) + + attributes = [("ref", ref), ("location", location)] + + if tooltip is not None: + attributes.append(("tooltip", tooltip)) + attributes.append(("display", display)) + + self._xml_empty_tag("hyperlink", attributes) + + def _write_auto_filter(self): + # Write the element. + if not self.autofilter_ref: + return + + attributes = [("ref", self.autofilter_ref)] + + if self.filter_on: + # Autofilter defined active filters. + self._xml_start_tag("autoFilter", attributes) + self._write_autofilters() + self._xml_end_tag("autoFilter") + + else: + # Autofilter defined without active filters. + self._xml_empty_tag("autoFilter", attributes) + + def _write_autofilters(self): + # Function to iterate through the columns that form part of an + # autofilter range and write the appropriate filters. + (col1, col2) = self.filter_range + + for col in range(col1, col2 + 1): + # Skip if column doesn't have an active filter. + if col not in self.filter_cols: + continue + + # Retrieve the filter tokens and write the autofilter records. + tokens = self.filter_cols[col] + filter_type = self.filter_type[col] + + # Filters are relative to first column in the autofilter. + self._write_filter_column(col - col1, filter_type, tokens) + + def _write_filter_column(self, col_id, filter_type, filters): + # Write the element. + attributes = [("colId", col_id)] + + self._xml_start_tag("filterColumn", attributes) + + if filter_type == 1: + # Type == 1 is the new XLSX style filter. + self._write_filters(filters) + else: + # Type == 0 is the classic "custom" filter. + self._write_custom_filters(filters) + + self._xml_end_tag("filterColumn") + + def _write_filters(self, filters): + # Write the element. + non_blanks = [filter for filter in filters if str(filter).lower() != "blanks"] + attributes = [] + + if len(filters) != len(non_blanks): + attributes = [("blank", 1)] + + if len(filters) == 1 and len(non_blanks) == 0: + # Special case for blank cells only. + self._xml_empty_tag("filters", attributes) + else: + # General case. + self._xml_start_tag("filters", attributes) + + for autofilter in sorted(non_blanks): + self._write_filter(autofilter) + + self._xml_end_tag("filters") + + def _write_filter(self, val): + # Write the element. + attributes = [("val", val)] + + self._xml_empty_tag("filter", attributes) + + def _write_custom_filters(self, tokens): + # Write the element. + if len(tokens) == 2: + # One filter expression only. + self._xml_start_tag("customFilters") + self._write_custom_filter(*tokens) + self._xml_end_tag("customFilters") + else: + # Two filter expressions. + attributes = [] + + # Check if the "join" operand is "and" or "or". + if tokens[2] == 0: + attributes = [("and", 1)] + else: + attributes = [("and", 0)] + + # Write the two custom filters. + self._xml_start_tag("customFilters", attributes) + self._write_custom_filter(tokens[0], tokens[1]) + self._write_custom_filter(tokens[3], tokens[4]) + self._xml_end_tag("customFilters") + + def _write_custom_filter(self, operator, val): + # Write the element. + attributes = [] + + operators = { + 1: "lessThan", + 2: "equal", + 3: "lessThanOrEqual", + 4: "greaterThan", + 5: "notEqual", + 6: "greaterThanOrEqual", + 22: "equal", + } + + # Convert the operator from a number to a descriptive string. + if operators[operator] is not None: + operator = operators[operator] + else: + warn("Unknown operator = %s" % operator) + + # The 'equal' operator is the default attribute and isn't stored. + if operator != "equal": + attributes.append(("operator", operator)) + attributes.append(("val", val)) + + self._xml_empty_tag("customFilter", attributes) + + def _write_sheet_protection(self): + # Write the element. + attributes = [] + + if not self.protect_options: + return + + options = self.protect_options + + if options["password"]: + attributes.append(("password", options["password"])) + if options["sheet"]: + attributes.append(("sheet", 1)) + if options["content"]: + attributes.append(("content", 1)) + if not options["objects"]: + attributes.append(("objects", 1)) + if not options["scenarios"]: + attributes.append(("scenarios", 1)) + if options["format_cells"]: + attributes.append(("formatCells", 0)) + if options["format_columns"]: + attributes.append(("formatColumns", 0)) + if options["format_rows"]: + attributes.append(("formatRows", 0)) + if options["insert_columns"]: + attributes.append(("insertColumns", 0)) + if options["insert_rows"]: + attributes.append(("insertRows", 0)) + if options["insert_hyperlinks"]: + attributes.append(("insertHyperlinks", 0)) + if options["delete_columns"]: + attributes.append(("deleteColumns", 0)) + if options["delete_rows"]: + attributes.append(("deleteRows", 0)) + if not options["select_locked_cells"]: + attributes.append(("selectLockedCells", 1)) + if options["sort"]: + attributes.append(("sort", 0)) + if options["autofilter"]: + attributes.append(("autoFilter", 0)) + if options["pivot_tables"]: + attributes.append(("pivotTables", 0)) + if not options["select_unlocked_cells"]: + attributes.append(("selectUnlockedCells", 1)) + + self._xml_empty_tag("sheetProtection", attributes) + + def _write_protected_ranges(self): + # Write the element. + if self.num_protected_ranges == 0: + return + + self._xml_start_tag("protectedRanges") + + for cell_range, range_name, password in self.protected_ranges: + self._write_protected_range(cell_range, range_name, password) + + self._xml_end_tag("protectedRanges") + + def _write_protected_range(self, cell_range, range_name, password): + # Write the element. + attributes = [] + + if password: + attributes.append(("password", password)) + + attributes.append(("sqref", cell_range)) + attributes.append(("name", range_name)) + + self._xml_empty_tag("protectedRange", attributes) + + def _write_drawings(self): + # Write the elements. + if not self.drawing: + return + + self.rel_count += 1 + self._write_drawing(self.rel_count) + + def _write_drawing(self, drawing_id): + # Write the element. + r_id = "rId" + str(drawing_id) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("drawing", attributes) + + def _write_legacy_drawing(self): + # Write the element. + if not self.has_vml: + return + + # Increment the relationship id for any drawings or comments. + self.rel_count += 1 + r_id = "rId" + str(self.rel_count) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("legacyDrawing", attributes) + + def _write_legacy_drawing_hf(self): + # Write the element. + if not self.has_header_vml: + return + + # Increment the relationship id for any drawings or comments. + self.rel_count += 1 + r_id = "rId" + str(self.rel_count) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("legacyDrawingHF", attributes) + + def _write_picture(self): + # Write the element. + if not self.background_image: + return + + # Increment the relationship id. + self.rel_count += 1 + r_id = "rId" + str(self.rel_count) + + attributes = [("r:id", r_id)] + + self._xml_empty_tag("picture", attributes) + + def _write_data_validations(self): + # Write the element. + validations = self.validations + count = len(validations) + + if not count: + return + + attributes = [("count", count)] + + self._xml_start_tag("dataValidations", attributes) + + for validation in validations: + # Write the dataValidation element. + self._write_data_validation(validation) + + self._xml_end_tag("dataValidations") + + def _write_data_validation(self, options): + # Write the element. + sqref = "" + attributes = [] + + # Set the cell range(s) for the data validation. + for cells in options["cells"]: + # Add a space between multiple cell ranges. + if sqref != "": + sqref += " " + + (row_first, col_first, row_last, col_last) = cells + + # Swap last row/col for first row/col as necessary + if row_first > row_last: + (row_first, row_last) = (row_last, row_first) + + if col_first > col_last: + (col_first, col_last) = (col_last, col_first) + + sqref += xl_range(row_first, col_first, row_last, col_last) + + if options.get("multi_range"): + sqref = options["multi_range"] + + if options["validate"] != "none": + attributes.append(("type", options["validate"])) + + if options["criteria"] != "between": + attributes.append(("operator", options["criteria"])) + + if "error_type" in options: + if options["error_type"] == 1: + attributes.append(("errorStyle", "warning")) + if options["error_type"] == 2: + attributes.append(("errorStyle", "information")) + + if options["ignore_blank"]: + attributes.append(("allowBlank", 1)) + + if not options["dropdown"]: + attributes.append(("showDropDown", 1)) + + if options["show_input"]: + attributes.append(("showInputMessage", 1)) + + if options["show_error"]: + attributes.append(("showErrorMessage", 1)) + + if "error_title" in options: + attributes.append(("errorTitle", options["error_title"])) + + if "error_message" in options: + attributes.append(("error", options["error_message"])) + + if "input_title" in options: + attributes.append(("promptTitle", options["input_title"])) + + if "input_message" in options: + attributes.append(("prompt", options["input_message"])) + + attributes.append(("sqref", sqref)) + + if options["validate"] == "none": + self._xml_empty_tag("dataValidation", attributes) + else: + self._xml_start_tag("dataValidation", attributes) + + # Write the formula1 element. + self._write_formula_1(options["value"]) + + # Write the formula2 element. + if options["maximum"] is not None: + self._write_formula_2(options["maximum"]) + + self._xml_end_tag("dataValidation") + + def _write_formula_1(self, formula): + # Write the element. + + if type(formula) is list: + formula = self._csv_join(*formula) + formula = '"%s"' % formula + else: + # Check if the formula is a number. + try: + float(formula) + except ValueError: + # Not a number. Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("formula1", formula) + + def _write_formula_2(self, formula): + # Write the element. + + # Check if the formula is a number. + try: + float(formula) + except ValueError: + # Not a number. Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("formula2", formula) + + def _write_conditional_formats(self): + # Write the Worksheet conditional formats. + ranges = sorted(self.cond_formats.keys()) + + if not ranges: + return + + for cond_range in ranges: + self._write_conditional_formatting( + cond_range, self.cond_formats[cond_range] + ) + + def _write_conditional_formatting(self, cond_range, params): + # Write the element. + attributes = [("sqref", cond_range)] + self._xml_start_tag("conditionalFormatting", attributes) + for param in params: + # Write the cfRule element. + self._write_cf_rule(param) + self._xml_end_tag("conditionalFormatting") + + def _write_cf_rule(self, params): + # Write the element. + attributes = [("type", params["type"])] + + if "format" in params and params["format"] is not None: + attributes.append(("dxfId", params["format"])) + + attributes.append(("priority", params["priority"])) + + if params.get("stop_if_true"): + attributes.append(("stopIfTrue", 1)) + + if params["type"] == "cellIs": + attributes.append(("operator", params["criteria"])) + + self._xml_start_tag("cfRule", attributes) + + if "minimum" in params and "maximum" in params: + self._write_formula_element(params["minimum"]) + self._write_formula_element(params["maximum"]) + else: + self._write_formula_element(params["value"]) + + self._xml_end_tag("cfRule") + + elif params["type"] == "aboveAverage": + if re.search("below", params["criteria"]): + attributes.append(("aboveAverage", 0)) + + if re.search("equal", params["criteria"]): + attributes.append(("equalAverage", 1)) + + if re.search("[123] std dev", params["criteria"]): + match = re.search("([123]) std dev", params["criteria"]) + attributes.append(("stdDev", match.group(1))) + + self._xml_empty_tag("cfRule", attributes) + + elif params["type"] == "top10": + if "criteria" in params and params["criteria"] == "%": + attributes.append(("percent", 1)) + + if "direction" in params: + attributes.append(("bottom", 1)) + + rank = params["value"] or 10 + attributes.append(("rank", rank)) + + self._xml_empty_tag("cfRule", attributes) + + elif params["type"] == "duplicateValues": + self._xml_empty_tag("cfRule", attributes) + + elif params["type"] == "uniqueValues": + self._xml_empty_tag("cfRule", attributes) + + elif ( + params["type"] == "containsText" + or params["type"] == "notContainsText" + or params["type"] == "beginsWith" + or params["type"] == "endsWith" + ): + attributes.append(("operator", params["criteria"])) + attributes.append(("text", params["value"])) + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["formula"]) + self._xml_end_tag("cfRule") + + elif params["type"] == "timePeriod": + attributes.append(("timePeriod", params["criteria"])) + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["formula"]) + self._xml_end_tag("cfRule") + + elif ( + params["type"] == "containsBlanks" + or params["type"] == "notContainsBlanks" + or params["type"] == "containsErrors" + or params["type"] == "notContainsErrors" + ): + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["formula"]) + self._xml_end_tag("cfRule") + + elif params["type"] == "colorScale": + self._xml_start_tag("cfRule", attributes) + self._write_color_scale(params) + self._xml_end_tag("cfRule") + + elif params["type"] == "dataBar": + self._xml_start_tag("cfRule", attributes) + self._write_data_bar(params) + + if params.get("is_data_bar_2010"): + self._write_data_bar_ext(params) + + self._xml_end_tag("cfRule") + + elif params["type"] == "expression": + self._xml_start_tag("cfRule", attributes) + self._write_formula_element(params["criteria"]) + self._xml_end_tag("cfRule") + + elif params["type"] == "iconSet": + self._xml_start_tag("cfRule", attributes) + self._write_icon_set(params) + self._xml_end_tag("cfRule") + + def _write_formula_element(self, formula): + # Write the element. + + # Check if the formula is a number. + try: + float(formula) + except ValueError: + # Not a number. Remove the formula '=' sign if it exists. + if formula.startswith("="): + formula = formula.lstrip("=") + + self._xml_data_element("formula", formula) + + def _write_color_scale(self, param): + # Write the element. + + self._xml_start_tag("colorScale") + + self._write_cfvo(param["min_type"], param["min_value"]) + + if param["mid_type"] is not None: + self._write_cfvo(param["mid_type"], param["mid_value"]) + + self._write_cfvo(param["max_type"], param["max_value"]) + + self._write_color("rgb", param["min_color"]) + + if param["mid_color"] is not None: + self._write_color("rgb", param["mid_color"]) + + self._write_color("rgb", param["max_color"]) + + self._xml_end_tag("colorScale") + + def _write_data_bar(self, param): + # Write the element. + attributes = [] + + # Min and max bar lengths in in the spec but not supported directly by + # Excel. + if param.get("min_length"): + attributes.append(("minLength", param["min_length"])) + + if param.get("max_length"): + attributes.append(("maxLength", param["max_length"])) + + if param.get("bar_only"): + attributes.append(("showValue", 0)) + + self._xml_start_tag("dataBar", attributes) + + self._write_cfvo(param["min_type"], param["min_value"]) + self._write_cfvo(param["max_type"], param["max_value"]) + self._write_color("rgb", param["bar_color"]) + + self._xml_end_tag("dataBar") + + def _write_data_bar_ext(self, param): + # Write the dataBar extension element. + + # Create a pseudo GUID for each unique Excel 2010 data bar. + worksheet_count = self.index + 1 + data_bar_count = len(self.data_bars_2010) + 1 + guid = "{DA7ABA51-AAAA-BBBB-%04X-%012X}" % (worksheet_count, data_bar_count) + + # Store the 2010 data bar parameters to write the extLst elements. + param["guid"] = guid + self.data_bars_2010.append(param) + + self._xml_start_tag("extLst") + self._write_ext("{B025F937-C7B1-47D3-B67F-A62EFF666E3E}") + self._xml_data_element("x14:id", guid) + self._xml_end_tag("ext") + self._xml_end_tag("extLst") + + def _write_icon_set(self, param): + # Write the element. + attributes = [] + + # Don't set attribute for default style. + if param["icon_style"] != "3TrafficLights": + attributes = [("iconSet", param["icon_style"])] + + if param.get("icons_only"): + attributes.append(("showValue", 0)) + + if param.get("reverse_icons"): + attributes.append(("reverse", 1)) + + self._xml_start_tag("iconSet", attributes) + + # Write the properties for different icon styles. + for icon in reversed(param["icons"]): + self._write_cfvo(icon["type"], icon["value"], icon["criteria"]) + + self._xml_end_tag("iconSet") + + def _write_cfvo(self, cf_type, val, criteria=None): + # Write the element. + attributes = [("type", cf_type)] + + if val is not None: + attributes.append(("val", val)) + + if criteria: + attributes.append(("gte", 0)) + + self._xml_empty_tag("cfvo", attributes) + + def _write_color(self, name, value): + # Write the element. + attributes = [(name, value)] + + self._xml_empty_tag("color", attributes) + + def _write_selections(self): + # Write the elements. + for selection in self.selections: + self._write_selection(*selection) + + def _write_selection(self, pane, active_cell, sqref): + # Write the element. + attributes = [] + + if pane: + attributes.append(("pane", pane)) + + if active_cell: + attributes.append(("activeCell", active_cell)) + + if sqref: + attributes.append(("sqref", sqref)) + + self._xml_empty_tag("selection", attributes) + + def _write_panes(self): + # Write the frozen or split elements. + panes = self.panes + + if not len(panes): + return + + if panes[4] == 2: + self._write_split_panes(*panes) + else: + self._write_freeze_panes(*panes) + + def _write_freeze_panes(self, row, col, top_row, left_col, pane_type): + # Write the element for freeze panes. + attributes = [] + + y_split = row + x_split = col + top_left_cell = xl_rowcol_to_cell(top_row, left_col) + active_pane = "" + state = "" + active_cell = "" + sqref = "" + + # Move user cell selection to the panes. + if self.selections: + (_, active_cell, sqref) = self.selections[0] + self.selections = [] + + # Set the active pane. + if row and col: + active_pane = "bottomRight" + + row_cell = xl_rowcol_to_cell(row, 0) + col_cell = xl_rowcol_to_cell(0, col) + + self.selections.append(["topRight", col_cell, col_cell]) + self.selections.append(["bottomLeft", row_cell, row_cell]) + self.selections.append(["bottomRight", active_cell, sqref]) + + elif col: + active_pane = "topRight" + self.selections.append(["topRight", active_cell, sqref]) + + else: + active_pane = "bottomLeft" + self.selections.append(["bottomLeft", active_cell, sqref]) + + # Set the pane type. + if pane_type == 0: + state = "frozen" + elif pane_type == 1: + state = "frozenSplit" + else: + state = "split" + + if x_split: + attributes.append(("xSplit", x_split)) + + if y_split: + attributes.append(("ySplit", y_split)) + + attributes.append(("topLeftCell", top_left_cell)) + attributes.append(("activePane", active_pane)) + attributes.append(("state", state)) + + self._xml_empty_tag("pane", attributes) + + def _write_split_panes(self, row, col, top_row, left_col, pane_type): + # Write the element for split panes. + attributes = [] + has_selection = 0 + active_pane = "" + active_cell = "" + sqref = "" + + y_split = row + x_split = col + + # Move user cell selection to the panes. + if self.selections: + (_, active_cell, sqref) = self.selections[0] + self.selections = [] + has_selection = 1 + + # Convert the row and col to 1/20 twip units with padding. + if y_split: + y_split = int(20 * y_split + 300) + + if x_split: + x_split = self._calculate_x_split_width(x_split) + + # For non-explicit topLeft definitions, estimate the cell offset based + # on the pixels dimensions. This is only a workaround and doesn't take + # adjusted cell dimensions into account. + if top_row == row and left_col == col: + top_row = int(0.5 + (y_split - 300) / 20 / 15) + left_col = int(0.5 + (x_split - 390) / 20 / 3 * 4 / 64) + + top_left_cell = xl_rowcol_to_cell(top_row, left_col) + + # If there is no selection set the active cell to the top left cell. + if not has_selection: + active_cell = top_left_cell + sqref = top_left_cell + + # Set the Cell selections. + if row and col: + active_pane = "bottomRight" + + row_cell = xl_rowcol_to_cell(top_row, 0) + col_cell = xl_rowcol_to_cell(0, left_col) + + self.selections.append(["topRight", col_cell, col_cell]) + self.selections.append(["bottomLeft", row_cell, row_cell]) + self.selections.append(["bottomRight", active_cell, sqref]) + + elif col: + active_pane = "topRight" + self.selections.append(["topRight", active_cell, sqref]) + + else: + active_pane = "bottomLeft" + self.selections.append(["bottomLeft", active_cell, sqref]) + + # Format splits to the same precision as Excel. + if x_split: + attributes.append(("xSplit", "%.16g" % x_split)) + + if y_split: + attributes.append(("ySplit", "%.16g" % y_split)) + + attributes.append(("topLeftCell", top_left_cell)) + + if has_selection: + attributes.append(("activePane", active_pane)) + + self._xml_empty_tag("pane", attributes) + + def _calculate_x_split_width(self, width): + # Convert column width from user units to pane split width. + + max_digit_width = 7 # For Calabri 11. + padding = 5 + + # Convert to pixels. + if width < 1: + pixels = int(width * (max_digit_width + padding) + 0.5) + else: + pixels = int(width * max_digit_width + 0.5) + padding + + # Convert to points. + points = pixels * 3 / 4 + + # Convert to twips (twentieths of a point). + twips = points * 20 + + # Add offset/padding. + width = twips + 390 + + return width + + def _write_table_parts(self): + # Write the element. + tables = self.tables + count = len(tables) + + # Return if worksheet doesn't contain any tables. + if not count: + return + + attributes = [ + ( + "count", + count, + ) + ] + + self._xml_start_tag("tableParts", attributes) + + for _ in tables: + # Write the tablePart element. + self.rel_count += 1 + self._write_table_part(self.rel_count) + + self._xml_end_tag("tableParts") + + def _write_table_part(self, r_id): + # Write the element. + + r_id = "rId" + str(r_id) + + attributes = [ + ( + "r:id", + r_id, + ) + ] + + self._xml_empty_tag("tablePart", attributes) + + def _write_ext_list(self): + # Write the element for data bars and sparklines. + has_data_bars = len(self.data_bars_2010) + has_sparklines = len(self.sparklines) + + if not has_data_bars and not has_sparklines: + return + + # Write the extLst element. + self._xml_start_tag("extLst") + + if has_data_bars: + self._write_ext_list_data_bars() + + if has_sparklines: + self._write_ext_list_sparklines() + + self._xml_end_tag("extLst") + + def _write_ext_list_data_bars(self): + # Write the Excel 2010 data_bar subelements. + self._write_ext("{78C0D931-6437-407d-A8EE-F0AAD7539E65}") + + self._xml_start_tag("x14:conditionalFormattings") + + # Write the Excel 2010 conditional formatting data bar elements. + for data_bar in self.data_bars_2010: + # Write the x14:conditionalFormatting element. + self._write_conditional_formatting_2010(data_bar) + + self._xml_end_tag("x14:conditionalFormattings") + self._xml_end_tag("ext") + + def _write_conditional_formatting_2010(self, data_bar): + # Write the element. + xmlns_xm = "http://schemas.microsoft.com/office/excel/2006/main" + + attributes = [("xmlns:xm", xmlns_xm)] + + self._xml_start_tag("x14:conditionalFormatting", attributes) + + # Write the x14:cfRule element. + self._write_x14_cf_rule(data_bar) + + # Write the x14:dataBar element. + self._write_x14_data_bar(data_bar) + + # Write the x14 max and min data bars. + self._write_x14_cfvo(data_bar["x14_min_type"], data_bar["min_value"]) + self._write_x14_cfvo(data_bar["x14_max_type"], data_bar["max_value"]) + + if not data_bar["bar_no_border"]: + # Write the x14:borderColor element. + self._write_x14_border_color(data_bar["bar_border_color"]) + + # Write the x14:negativeFillColor element. + if not data_bar["bar_negative_color_same"]: + self._write_x14_negative_fill_color(data_bar["bar_negative_color"]) + + # Write the x14:negativeBorderColor element. + if ( + not data_bar["bar_no_border"] + and not data_bar["bar_negative_border_color_same"] + ): + self._write_x14_negative_border_color(data_bar["bar_negative_border_color"]) + + # Write the x14:axisColor element. + if data_bar["bar_axis_position"] != "none": + self._write_x14_axis_color(data_bar["bar_axis_color"]) + + self._xml_end_tag("x14:dataBar") + self._xml_end_tag("x14:cfRule") + + # Write the xm:sqref element. + self._xml_data_element("xm:sqref", data_bar["range"]) + + self._xml_end_tag("x14:conditionalFormatting") + + def _write_x14_cf_rule(self, data_bar): + # Write the element. + rule_type = "dataBar" + guid = data_bar["guid"] + attributes = [("type", rule_type), ("id", guid)] + + self._xml_start_tag("x14:cfRule", attributes) + + def _write_x14_data_bar(self, data_bar): + # Write the element. + min_length = 0 + max_length = 100 + + attributes = [ + ("minLength", min_length), + ("maxLength", max_length), + ] + + if not data_bar["bar_no_border"]: + attributes.append(("border", 1)) + + if data_bar["bar_solid"]: + attributes.append(("gradient", 0)) + + if data_bar["bar_direction"] == "left": + attributes.append(("direction", "leftToRight")) + + if data_bar["bar_direction"] == "right": + attributes.append(("direction", "rightToLeft")) + + if data_bar["bar_negative_color_same"]: + attributes.append(("negativeBarColorSameAsPositive", 1)) + + if ( + not data_bar["bar_no_border"] + and not data_bar["bar_negative_border_color_same"] + ): + attributes.append(("negativeBarBorderColorSameAsPositive", 0)) + + if data_bar["bar_axis_position"] == "middle": + attributes.append(("axisPosition", "middle")) + + if data_bar["bar_axis_position"] == "none": + attributes.append(("axisPosition", "none")) + + self._xml_start_tag("x14:dataBar", attributes) + + def _write_x14_cfvo(self, rule_type, value): + # Write the element. + attributes = [("type", rule_type)] + + if rule_type in ("min", "max", "autoMin", "autoMax"): + self._xml_empty_tag("x14:cfvo", attributes) + else: + self._xml_start_tag("x14:cfvo", attributes) + self._xml_data_element("xm:f", value) + self._xml_end_tag("x14:cfvo") + + def _write_x14_border_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:borderColor", attributes) + + def _write_x14_negative_fill_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:negativeFillColor", attributes) + + def _write_x14_negative_border_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:negativeBorderColor", attributes) + + def _write_x14_axis_color(self, rgb): + # Write the element. + attributes = [("rgb", rgb)] + self._xml_empty_tag("x14:axisColor", attributes) + + def _write_ext_list_sparklines(self): + # Write the sparkline extension sub-elements. + self._write_ext("{05C60535-1F16-4fd2-B633-F4F36F0B64E0}") + + # Write the x14:sparklineGroups element. + self._write_sparkline_groups() + + # Write the sparkline elements. + for sparkline in reversed(self.sparklines): + # Write the x14:sparklineGroup element. + self._write_sparkline_group(sparkline) + + # Write the x14:colorSeries element. + self._write_color_series(sparkline["series_color"]) + + # Write the x14:colorNegative element. + self._write_color_negative(sparkline["negative_color"]) + + # Write the x14:colorAxis element. + self._write_color_axis() + + # Write the x14:colorMarkers element. + self._write_color_markers(sparkline["markers_color"]) + + # Write the x14:colorFirst element. + self._write_color_first(sparkline["first_color"]) + + # Write the x14:colorLast element. + self._write_color_last(sparkline["last_color"]) + + # Write the x14:colorHigh element. + self._write_color_high(sparkline["high_color"]) + + # Write the x14:colorLow element. + self._write_color_low(sparkline["low_color"]) + + if sparkline["date_axis"]: + self._xml_data_element("xm:f", sparkline["date_axis"]) + + self._write_sparklines(sparkline) + + self._xml_end_tag("x14:sparklineGroup") + + self._xml_end_tag("x14:sparklineGroups") + self._xml_end_tag("ext") + + def _write_sparklines(self, sparkline): + # Write the element and sub-elements. + + # Write the sparkline elements. + self._xml_start_tag("x14:sparklines") + + for i in range(sparkline["count"]): + spark_range = sparkline["ranges"][i] + location = sparkline["locations"][i] + + self._xml_start_tag("x14:sparkline") + self._xml_data_element("xm:f", spark_range) + self._xml_data_element("xm:sqref", location) + self._xml_end_tag("x14:sparkline") + + self._xml_end_tag("x14:sparklines") + + def _write_ext(self, uri): + # Write the element. + schema = "http://schemas.microsoft.com/office/" + xmlns_x14 = schema + "spreadsheetml/2009/9/main" + + attributes = [ + ("xmlns:x14", xmlns_x14), + ("uri", uri), + ] + + self._xml_start_tag("ext", attributes) + + def _write_sparkline_groups(self): + # Write the element. + xmlns_xm = "http://schemas.microsoft.com/office/excel/2006/main" + + attributes = [("xmlns:xm", xmlns_xm)] + + self._xml_start_tag("x14:sparklineGroups", attributes) + + def _write_sparkline_group(self, options): + # Write the element. + # + # Example for order. + # + # + # + empty = options.get("empty") + attributes = [] + + if options.get("max") is not None: + if options["max"] == "group": + options["cust_max"] = "group" + else: + attributes.append(("manualMax", options["max"])) + options["cust_max"] = "custom" + + if options.get("min") is not None: + if options["min"] == "group": + options["cust_min"] = "group" + else: + attributes.append(("manualMin", options["min"])) + options["cust_min"] = "custom" + + # Ignore the default type attribute (line). + if options["type"] != "line": + attributes.append(("type", options["type"])) + + if options.get("weight"): + attributes.append(("lineWeight", options["weight"])) + + if options.get("date_axis"): + attributes.append(("dateAxis", 1)) + + if empty: + attributes.append(("displayEmptyCellsAs", empty)) + + if options.get("markers"): + attributes.append(("markers", 1)) + + if options.get("high"): + attributes.append(("high", 1)) + + if options.get("low"): + attributes.append(("low", 1)) + + if options.get("first"): + attributes.append(("first", 1)) + + if options.get("last"): + attributes.append(("last", 1)) + + if options.get("negative"): + attributes.append(("negative", 1)) + + if options.get("axis"): + attributes.append(("displayXAxis", 1)) + + if options.get("hidden"): + attributes.append(("displayHidden", 1)) + + if options.get("cust_min"): + attributes.append(("minAxisType", options["cust_min"])) + + if options.get("cust_max"): + attributes.append(("maxAxisType", options["cust_max"])) + + if options.get("reverse"): + attributes.append(("rightToLeft", 1)) + + self._xml_start_tag("x14:sparklineGroup", attributes) + + def _write_spark_color(self, element, color): + # Helper function for the sparkline color functions below. + attributes = [] + + if color.get("rgb"): + attributes.append(("rgb", color["rgb"])) + + if color.get("theme"): + attributes.append(("theme", color["theme"])) + + if color.get("tint"): + attributes.append(("tint", color["tint"])) + + self._xml_empty_tag(element, attributes) + + def _write_color_series(self, color): + # Write the element. + self._write_spark_color("x14:colorSeries", color) + + def _write_color_negative(self, color): + # Write the element. + self._write_spark_color("x14:colorNegative", color) + + def _write_color_axis(self): + # Write the element. + self._write_spark_color("x14:colorAxis", {"rgb": "FF000000"}) + + def _write_color_markers(self, color): + # Write the element. + self._write_spark_color("x14:colorMarkers", color) + + def _write_color_first(self, color): + # Write the element. + self._write_spark_color("x14:colorFirst", color) + + def _write_color_last(self, color): + # Write the element. + self._write_spark_color("x14:colorLast", color) + + def _write_color_high(self, color): + # Write the element. + self._write_spark_color("x14:colorHigh", color) + + def _write_color_low(self, color): + # Write the element. + self._write_spark_color("x14:colorLow", color) + + def _write_phonetic_pr(self): + # Write the element. + attributes = [ + ("fontId", "0"), + ("type", "noConversion"), + ] + + self._xml_empty_tag("phoneticPr", attributes) + + def _write_ignored_errors(self): + # Write the element. + if not self.ignored_errors: + return + + self._xml_start_tag("ignoredErrors") + + if self.ignored_errors.get("number_stored_as_text"): + ignored_range = self.ignored_errors["number_stored_as_text"] + self._write_ignored_error("numberStoredAsText", ignored_range) + + if self.ignored_errors.get("eval_error"): + ignored_range = self.ignored_errors["eval_error"] + self._write_ignored_error("evalError", ignored_range) + + if self.ignored_errors.get("formula_differs"): + ignored_range = self.ignored_errors["formula_differs"] + self._write_ignored_error("formula", ignored_range) + + if self.ignored_errors.get("formula_ignored_range"): + ignored_range = self.ignored_errors["formula_ignored_range"] + self._write_ignored_error("formulaIgnored_range", ignored_range) + + if self.ignored_errors.get("formula_unlocked"): + ignored_range = self.ignored_errors["formula_unlocked"] + self._write_ignored_error("unlockedFormula", ignored_range) + + if self.ignored_errors.get("empty_cell_reference"): + ignored_range = self.ignored_errors["empty_cell_reference"] + self._write_ignored_error("emptyCellReference", ignored_range) + + if self.ignored_errors.get("list_data_validation"): + ignored_range = self.ignored_errors["list_data_validation"] + self._write_ignored_error("listDataValidation", ignored_range) + + if self.ignored_errors.get("calculated_column"): + ignored_range = self.ignored_errors["calculated_column"] + self._write_ignored_error("calculatedColumn", ignored_range) + + if self.ignored_errors.get("two_digit_text_year"): + ignored_range = self.ignored_errors["two_digit_text_year"] + self._write_ignored_error("twoDigitTextYear", ignored_range) + + self._xml_end_tag("ignoredErrors") + + def _write_ignored_error(self, type, ignored_range): + # Write the element. + attributes = [ + ("sqref", ignored_range), + (type, 1), + ] + + self._xml_empty_tag("ignoredError", attributes) diff --git a/xlsxwriter/python/xlsxwriter/xmlwriter.py b/xlsxwriter/python/xlsxwriter/xmlwriter.py new file mode 100644 index 0000000..28b8a0f --- /dev/null +++ b/xlsxwriter/python/xlsxwriter/xmlwriter.py @@ -0,0 +1,206 @@ +############################################################################### +# +# XMLwriter - A base class for XlsxWriter classes. +# +# Used in conjunction with XlsxWriter. +# +# SPDX-License-Identifier: BSD-2-Clause +# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org +# + +# Standard packages. +import re +from io import StringIO + + +class XMLwriter(object): + """ + Simple XML writer class. + + """ + + def __init__(self): + self.fh = None + self.escapes = re.compile('["&<>\n]') + self.internal_fh = False + + def _set_filehandle(self, filehandle): + # Set the writer filehandle directly. Mainly for testing. + self.fh = filehandle + self.internal_fh = False + + def _set_xml_writer(self, filename): + # Set the XML writer filehandle for the object. + if isinstance(filename, StringIO): + self.internal_fh = False + self.fh = filename + else: + self.internal_fh = True + self.fh = open(filename, "w", encoding="utf-8") + + def _xml_close(self): + # Close the XML filehandle if we created it. + if self.internal_fh: + self.fh.close() + + def _xml_declaration(self): + # Write the XML declaration. + self.fh.write("""\n""") + + def _xml_start_tag(self, tag, attributes=[]): + # Write an XML start tag with optional attributes. + for key, value in attributes: + value = self._escape_attributes(value) + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s>" % tag) + + def _xml_start_tag_unencoded(self, tag, attributes=[]): + # Write an XML start tag with optional, unencoded, attributes. + # This is a minor speed optimization for elements that don't + # need encoding. + for key, value in attributes: + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s>" % tag) + + def _xml_end_tag(self, tag): + # Write an XML end tag. + self.fh.write("" % tag) + + def _xml_empty_tag(self, tag, attributes=[]): + # Write an empty XML tag with optional attributes. + for key, value in attributes: + value = self._escape_attributes(value) + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s/>" % tag) + + def _xml_empty_tag_unencoded(self, tag, attributes=[]): + # Write an empty XML tag with optional, unencoded, attributes. + # This is a minor speed optimization for elements that don't + # need encoding. + for key, value in attributes: + tag += ' %s="%s"' % (key, value) + + self.fh.write("<%s/>" % tag) + + def _xml_data_element(self, tag, data, attributes=[]): + # Write an XML element containing data with optional attributes. + end_tag = tag + + for key, value in attributes: + value = self._escape_attributes(value) + tag += ' %s="%s"' % (key, value) + + data = self._escape_data(data) + self.fh.write("<%s>%s" % (tag, data, end_tag)) + + def _xml_string_element(self, index, attributes=[]): + # Optimized tag writer for cell string elements in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write("""%d""" % (attr, index)) + + def _xml_si_element(self, string, attributes=[]): + # Optimized tag writer for shared strings elements. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + string = self._escape_data(string) + + self.fh.write("""%s""" % (attr, string)) + + def _xml_rich_si_element(self, string): + # Optimized tag writer for shared strings rich string elements. + + self.fh.write("""%s""" % string) + + def _xml_number_element(self, number, attributes=[]): + # Optimized tag writer for cell number elements in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write("""%.16G""" % (attr, number)) + + def _xml_formula_element(self, formula, result, attributes=[]): + # Optimized tag writer for cell formula elements in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write( + """%s%s""" + % (attr, self._escape_data(formula), self._escape_data(result)) + ) + + def _xml_inline_string(self, string, preserve, attributes=[]): + # Optimized tag writer for inlineStr cell elements in the inner loop. + attr = "" + t_attr = "" + + # Set the attribute to preserve whitespace. + if preserve: + t_attr = ' xml:space="preserve"' + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + string = self._escape_data(string) + + self.fh.write( + """%s""" % (attr, t_attr, string) + ) + + def _xml_rich_inline_string(self, string, attributes=[]): + # Optimized tag writer for rich inlineStr in the inner loop. + attr = "" + + for key, value in attributes: + value = self._escape_attributes(value) + attr += ' %s="%s"' % (key, value) + + self.fh.write("""%s""" % (attr, string)) + + def _escape_attributes(self, attribute): + # Escape XML characters in attributes. + try: + if not self.escapes.search(attribute): + return attribute + except TypeError: + return attribute + + attribute = ( + attribute.replace("&", "&") + .replace('"', """) + .replace("<", "<") + .replace(">", ">") + .replace("\n", " ") + ) + return attribute + + def _escape_data(self, data): + # Escape XML characters in data sections of tags. Note, this + # is different from _escape_attributes() in that double quotes + # are not escaped by Excel. + try: + if not self.escapes.search(data): + return data + except TypeError: + return data + + data = data.replace("&", "&").replace("<", "<").replace(">", ">") + return data diff --git a/xlsxwriter/xlsxwriter.zip b/xlsxwriter/xlsxwriter.zip new file mode 100644 index 0000000..0221a9a Binary files /dev/null and b/xlsxwriter/xlsxwriter.zip differ